{"id":13881030,"url":"https://github.com/graphql-compose/graphql-compose-connection","last_synced_at":"2025-10-23T19:08:11.037Z","repository":{"id":9804966,"uuid":"62992139","full_name":"graphql-compose/graphql-compose-connection","owner":"graphql-compose","description":"Plugin for TypeComposer (graphql-compose), that adds `connection` resolver.","archived":false,"fork":false,"pushed_at":"2023-01-07T04:02:43.000Z","size":2236,"stargazers_count":45,"open_issues_count":17,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-08T12:51:19.054Z","etag":null,"topics":["graphql","graphql-compose","graphql-compose-plugin","schema-builder"],"latest_commit_sha":null,"homepage":"https://github.com/nodkz/graphql-compose","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-compose.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-10T09:47:06.000Z","updated_at":"2023-02-24T01:55:13.000Z","dependencies_parsed_at":"2023-01-13T16:24:07.386Z","dependency_job_id":null,"html_url":"https://github.com/graphql-compose/graphql-compose-connection","commit_stats":null,"previous_names":["nodkz/graphql-compose-connection"],"tags_count":62,"template":false,"template_full_name":null,"purl":"pkg:github/graphql-compose/graphql-compose-connection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-connection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-connection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-connection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-connection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-compose","download_url":"https://codeload.github.com/graphql-compose/graphql-compose-connection/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-connection/sbom","scorecard":{"id":443842,"data":{"date":"2025-08-11","repo":{"name":"github.com/graphql-compose/graphql-compose-connection","commit":"3c5b15275817f35967649d7a087de4050a5f0bf5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/17 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/graphql-compose/graphql-compose-connection/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/graphql-compose/graphql-compose-connection/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/graphql-compose/graphql-compose-connection/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/graphql-compose/graphql-compose-connection/nodejs.yml/master?enable=pin","Warn: downloadThenRun not pinned by hash: .github/workflows/nodejs.yml:29","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"53 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-px4h-xg32-q955","Warn: Project is vulnerable to: GHSA-v39p-96qg-c8rf","Warn: Project is vulnerable to: GHSA-8v63-cqqc-6r2c","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-x2pg-mjhr-2m5x","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T06:13:02.667Z","repository_id":9804966,"created_at":"2025-08-19T06:13:02.667Z","updated_at":"2025-08-19T06:13:02.667Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271150421,"owners_count":24707724,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["graphql","graphql-compose","graphql-compose-plugin","schema-builder"],"created_at":"2024-08-06T08:03:48.790Z","updated_at":"2025-10-23T19:08:05.982Z","avatar_url":"https://github.com/graphql-compose.png","language":"TypeScript","readme":"# graphql-compose-connection\n\n[![travis build](https://img.shields.io/travis/graphql-compose/graphql-compose-connection.svg)](https://travis-ci.org/graphql-compose/graphql-compose-connection)\n[![codecov coverage](https://img.shields.io/codecov/c/github/graphql-compose/graphql-compose-connection.svg)](https://codecov.io/github/graphql-compose/graphql-compose-connection)\n[![version](https://img.shields.io/npm/v/graphql-compose-connection.svg)](https://www.npmjs.com/package/graphql-compose-connection)\n[![downloads](https://img.shields.io/npm/dt/graphql-compose-connection.svg)](http://www.npmtrends.com/graphql-compose-connection)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\nThis is a plugin for [graphql-compose](https://github.com/graphql-compose/graphql-compose) family, which adds to the ObjectTypeComposer `connection` resolver.\n\nLive demo: [https://graphql-compose.herokuapp.com/](https://graphql-compose.herokuapp.com/)\n\nThis package completely follows to Relay Cursor Connections Specification (\u003chttps://relay.dev/graphql/connections.htm\u003e).\n\nBesides standard connection arguments `first`, `last`, `before` and `after`, also added significant arguments:\n\n- `filter` arg - for filtering records\n- `sort` arg - for sorting records. Build in mechanism allows sort by any unique indexes (not only by id). Also supported compound sorting (by several fields).\n\n[CHANGELOG](https://github.com/graphql-compose/graphql-compose-connection/blob/master/CHANGELOG.md)\n\n## Installation\n\n```bash\nnpm install graphql graphql-compose graphql-compose-connection --save\n```\n\nModules `graphql` and `graphql-compose` are in `peerDependencies`, so should be installed explicitly in your app. They should not installed as submodules, cause internally checks the classes instances.\n\n## Example\n\nImplementation details of `findManyResolver` and `countResolver` can be found in [this file](./src/__mocks__/User.ts).\n\n```js\nimport { prepareConnectionResolver } from 'graphql-compose-connection';\nimport { UserTC, findManyResolver, countResolver } from './user';\n\nprepareConnectionResolver(userTC, {\n  findManyResolver,\n  countResolver,\n  sort: {\n    // Sorting key, visible for users in GraphQL Schema\n    _ID_ASC: {\n      // Sorting value for ORM/Driver\n      value: { _id: 1 },\n\n      // Field names in record, which data will be packed in `cursor`\n      //   edges {\n      //     cursor   \u003c- base64(cursorData), for this example `cursorData` = { _id: 334ae453 }\n      //     node     \u003c- record from DB\n      //   }\n      // By this fields MUST be created UNIQUE index in database!\n      cursorFields: ['_id'],\n\n      // If for connection query provided `before` argument with above `cursor`.\n      // We should construct (`rawQuery`) which will be point to dataset before cursor.\n      // Unpacked data from `cursor` will be available in (`cursorData`) argument.\n      // PS. All other filter options provided via GraphQL query will be added automatically.\n      // ----- [record] -----   sorted dataset, according to above option with `value` name\n      // ^^^^^                 `rawQuery` should filter this set\n      beforeCursorQuery: (rawQuery, cursorData, resolveParams) =\u003e {\n        if (!rawQuery._id) rawQuery._id = {};\n        rawQuery._id.$lt = cursorData._id;\n      },\n\n      // Constructing `rawQuery` for connection `after` argument.\n      // ----- [record] -----   sorted dataset\n      //                ^^^^^  `rawQuery` should filter this set\n      afterCursorQuery: (rawQuery, cursorData, resolveParams) =\u003e {\n        if (!rawQuery._id) rawQuery._id = {};\n        rawQuery._id.$gt = cursorData._id;\n      },\n    },\n\n    _ID_DESC: {\n      value: { _id: -1 },\n      cursorFields: ['_id'],\n      beforeCursorQuery: (rawQuery, cursorData, resolveParams) =\u003e {\n        if (!rawQuery._id) rawQuery._id = {};\n        rawQuery._id.$gt = cursorData._id;\n      },\n      afterCursorQuery: (rawQuery, cursorData, resolveParams) =\u003e {\n        if (!rawQuery._id) rawQuery._id = {};\n        rawQuery._id.$lt = cursorData._id;\n      },\n    },\n\n    // More complex sorting parameter with 2 fields\n    AGE_ID_ASC: {\n      value: { age: 1, _id: -1 },\n      // By these fields MUST be created COMPOUND UNIQUE index in database!\n      cursorFields: ['age', '_id'],\n      beforeCursorQuery: (rawQuery, cursorData, resolveParams) =\u003e {\n        if (!rawQuery.age) rawQuery.age = {};\n        if (!rawQuery._id) rawQuery._id = {};\n        rawQuery.age.$lt = cursorData.age;\n        rawQuery._id.$gt = cursorData._id;\n      },\n      afterCursorQuery: (rawQuery, cursorData, resolveParams) =\u003e {\n        if (!rawQuery.age) rawQuery.age = {};\n        if (!rawQuery._id) rawQuery._id = {};\n        rawQuery.age.$gt = cursorData.age;\n        rawQuery._id.$lt = cursorData._id;\n      },\n    }\n  },\n});\n```\n\n\u003cimg width=\"1249\" alt=\"screen shot 2016-07-20 at 12 20 08\" src=\"https://cloud.githubusercontent.com/assets/1946920/16976899/67a5e0f8-4e74-11e6-87e5-fc4574deaaab.png\"\u003e\n\n## Used in plugins\n\n[graphql-compose-mongoose](https://github.com/graphql-compose/graphql-compose-mongoose) - converts mongoose models to graphql types\n\n## License\n\n[MIT](https://github.com/graphql-compose/graphql-compose-connection/blob/master/LICENSE.md)\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-compose%2Fgraphql-compose-connection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-compose%2Fgraphql-compose-connection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-compose%2Fgraphql-compose-connection/lists"}