{"id":17188686,"url":"https://github.com/cainlevy/typeorm-relay-connection","last_synced_at":"2026-02-07T17:32:15.347Z","repository":{"id":62964394,"uuid":"564033187","full_name":"cainlevy/typeorm-relay-connection","owner":"cainlevy","description":"TypeORM implementation of the Relay Connection spec","archived":false,"fork":false,"pushed_at":"2024-07-26T16:06:37.000Z","size":539,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-16T01:09:39.620Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cainlevy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-09T21:10:15.000Z","updated_at":"2024-07-26T16:06:38.000Z","dependencies_parsed_at":"2022-11-10T00:45:25.031Z","dependency_job_id":null,"html_url":"https://github.com/cainlevy/typeorm-relay-connection","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":"cainlevy/node-module-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainlevy%2Ftypeorm-relay-connection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainlevy%2Ftypeorm-relay-connection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainlevy%2Ftypeorm-relay-connection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainlevy%2Ftypeorm-relay-connection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cainlevy","download_url":"https://codeload.github.com/cainlevy/typeorm-relay-connection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227788281,"owners_count":17820038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T01:09:37.430Z","updated_at":"2026-02-07T17:32:15.156Z","avatar_url":"https://github.com/cainlevy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## TypeORM Relay Connection\n\nTypeORM implementation of Relay Connection spec.\n\n## Getting Started\n\nInstall:\n\n```\nnpm install typeorm-relay-connection\n```\n\n### GraphQL Resolver\n\n```js\nconst QueryResolver = {\n  books: async (_, args, { db }) =\u003e\n    new TypeORMRelayConnection(\n      // query builder with some number of requirements\n      db.createQueryBuilder(Book, \"book\").where(\"published_at IS NOT NULL\"),\n      // standard relay arguments from client\n      args,\n      // configuration\n      {\n        // constraint on args.first and args.last\n        // default: 500\n        limit: 100,\n\n        // primary (unique!) key for Book\n        // default: 'id'\n        cursorKey: \"id\",\n\n        // desired sorting for pagination order\n        // default: 'created_at'\n        sortingKey: \"published_at\",\n        // default: 'ASC'\n        sortingOrder: \"ASC\",\n      }\n    ),\n};\n```\n\n### Connection Aggregates\n\nYou can access the scope from connection resolvers to calculate aggregates on whatever query was previously built for pagination:\n\n```graphql\nquery {\n  books {\n    total\n    edges {\n      node {\n        id\n        name\n      }\n    }\n  }\n}\n```\n\n```js\nconst BookConnectionResolver = {\n  // parent is the TypeORMRelayConnection from BookResolver.books\n  total: async (parent) =\u003e await parent.scope.getCount(),\n};\n```\n\n## Releasing\n\n1. Review `CHANGELOG.md` and determine the next semantic version\n2. Commit a change to `package.json` and `CHANGELOG.md` with the next version. Push.\n3. Tag the commit. Push tags.\n4. Run `npm publish`\n\n## Contributing\n\nBug reports and pull requests are welcome! This project is intended to be a safe, welcoming space for collaboration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcainlevy%2Ftypeorm-relay-connection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcainlevy%2Ftypeorm-relay-connection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcainlevy%2Ftypeorm-relay-connection/lists"}