https://github.com/graphql-compose/graphql-compose-pagination
Plugin for TypeComposer (graphql-compose), that adds `pagination` resolver.
https://github.com/graphql-compose/graphql-compose-pagination
graphql graphql-compose graphql-compose-plugin pagination
Last synced: 11 days ago
JSON representation
Plugin for TypeComposer (graphql-compose), that adds `pagination` resolver.
- Host: GitHub
- URL: https://github.com/graphql-compose/graphql-compose-pagination
- Owner: graphql-compose
- License: mit
- Created: 2017-08-07T14:43:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:04:47.000Z (over 2 years ago)
- Last Synced: 2025-06-11T14:40:51.618Z (15 days ago)
- Topics: graphql, graphql-compose, graphql-compose-plugin, pagination
- Language: TypeScript
- Homepage: https://github.com/nodkz/graphql-compose
- Size: 1.73 MB
- Stars: 29
- Watchers: 2
- Forks: 8
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# graphql-compose-pagination
[](https://travis-ci.org/graphql-compose/graphql-compose-pagination)
[](https://codecov.io/github/graphql-compose/graphql-compose-pagination)
[](https://www.npmjs.com/package/graphql-compose-pagination)
[](http://www.npmtrends.com/graphql-compose-pagination)
[](http://commitizen.github.io/cz-cli/)This is a plugin for [graphql-compose](https://github.com/graphql-compose/graphql-compose) family, which adds to the ObjectTypeComposer `pagination` resolver.
Live demo: [https://graphql-compose.herokuapp.com/](https://graphql-compose.herokuapp.com/)
[CHANGELOG](https://github.com/graphql-compose/graphql-compose-pagination/blob/master/CHANGELOG.md)
## Installation
```bash
npm install graphql graphql-compose graphql-compose-pagination --save
```Modules `graphql` and `graphql-compose` are in `peerDependencies`, so should be installed explicitly in your app. They should not installed as sub-modules, cause internally checks the classes instances.
## Example
```js
import { preparePaginationResolver } from 'graphql-compose-pagination';
import { UserTC, findManyResolver, countResolver } from './user';const paginationResolver = preparePaginationResolver(UserTC, {
findManyResolver,
countResolver,
name: 'pagination', // Default
perPage: 20, // Default
});
```Implementation of `findManyResolver` and `countResolver` can be found in [this file](./src/__mocks__/User.ts).
## Used in plugins
[graphql-compose-mongoose](https://github.com/graphql-compose/graphql-compose-mongoose) – converts mongoose models to graphql types
## License
[MIT](https://github.com/graphql-compose/graphql-compose-pagination/blob/master/LICENSE.md)