{"id":15759536,"url":"https://github.com/cedrickring/prisma-pagination","last_synced_at":"2025-07-10T16:05:19.211Z","repository":{"id":131057470,"uuid":"435436481","full_name":"cedrickring/prisma-pagination","owner":"cedrickring","description":"Pagination Extension for Prisma 2","archived":false,"fork":false,"pushed_at":"2022-01-27T09:52:28.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T19:11:30.009Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedrickring.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-06T09:34:13.000Z","updated_at":"2022-10-09T06:06:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"f515513e-9f58-4321-872e-64787ce24599","html_url":"https://github.com/cedrickring/prisma-pagination","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"69b1b6a9c74ec1c48f76c1b62b9bca987c871ad5"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cedrickring/prisma-pagination","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickring%2Fprisma-pagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickring%2Fprisma-pagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickring%2Fprisma-pagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickring%2Fprisma-pagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedrickring","download_url":"https://codeload.github.com/cedrickring/prisma-pagination/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickring%2Fprisma-pagination/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264604675,"owners_count":23635920,"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-04T10:21:01.838Z","updated_at":"2025-07-10T16:05:19.171Z","avatar_url":"https://github.com/cedrickring.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\nPrisma Pagination\n\u003c/h1\u003e\n\n## About\n\nThis [Prisma Generator](https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#generator) adds polyfills for async-iterable-cursor-based pagination with a simple `.paginate()` method on each prisma delegate. This is a usual opt-in polyfill, so no original/generated prisma files will be touched.\n\nUsage is as easy as:\n\n```ts\nimport { PrismaClient } from '@prisma/client';\nimport '@prismaext/pagination';\n\nconst prisma = new PrismaClient();\n\nasync function printAllPosts() {\n  for await (const posts of prisma.post.paginate({ cursorField: 'id', pageSize: 50, include: { author: true } })) {\n    posts.forEach((post) =\u003e {\n      console.log(post.id, post.author.email);\n    });\n  }\n}\n```\n\n## Installation\n\n1. Install `@prismaext/pagination` with either `yarn` or `npm` (or some other package manager)\n\n   e.g. `npm install @prismaext/pagination` or `yarn add @prismaext/pagination`\n\n2. Add a generator block to your `schema.prisma` like:\n   ```prisma\n   generator pagination {\n      provider = \"pagination-generator\"\n   }\n   ```\n3. Run `prisma generate`\n4. Add `import '@prismaext/pagination';` to the top of the file where your `PrismaClient` is being initialized.\n\nAfter importing the definitions from `@prismaext/pagination`, all prisma delegates will have additional `paginate` methods. To align with the other apis, the method only allows a single argument of the type:\n\n```ts\nexport type ${Model}PaginateArgs = {\n   /**\n    * Select specific fields to fetch from the ${Model}\n    *\n    **/\n   select?: ${Model}Select | null\n   /**\n    * Choose, which related nodes to fetch as well.\n    *\n    **/\n   include?: ${Model}Include | null\n   /**\n    * Filter, which ${Model}s to fetch.\n    *\n    **/\n   where?: ${Model}WhereInput\n   /**\n    * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n    *\n    * Determine the order of ${Model}s to fetch.\n    *\n    **/\n   orderBy?: Enumerable\u003c${Model}OrderByWithRelationInput\u003e\n   /**\n   * Items to be fetched per ${Model}\n   *\n   */\n   pageSize: number\n\n   distinct?: Enumerable\u003c${Model}ScalarFieldEnum\u003e\n\n   /**\n    * The cursor field to be used to paginate through\n    *\n    * defaults to 'id' or the first unique field present in the model\n    *\n    */\n   cursorField?: 'id' // or some other unique field\n}\n```\n\nSimilar to `prisma-client-js`, this generator allows specifying the `output` path where the generated definitions will be placed in.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedrickring%2Fprisma-pagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedrickring%2Fprisma-pagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedrickring%2Fprisma-pagination/lists"}