Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

graphql-compose-pagination

5.1.0 • Public • Published

graphql-compose-pagination

travis build codecov coverage npm trend Join the chat at https://gitter.im/graphql-compose/Lobby Commitizen friendly Greenkeeper badge

This is a plugin for graphql-compose family, which adds to the ObjectTypeComposer pagination resolver.

Live demo: https://graphql-compose.herokuapp.com/

CHANGELOG

Installation

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 submodules, cause internally checks the classes instances.

Example

import composeWithPagination from 'graphql-compose-pagination';
import userTypeComposer from './user.js';
 
composeWithPagination(userTypeComposer, {
  paginationResolverName: 'pagination', // Default
  findResolverName: 'findMany',
  countResolverName: 'count',
  perPage: 20, // Default
});
screen shot 2017-08-07 at 23 31 46

Requirements

Types should have following resolvers:

  • count - for records count
  • findMany - for filtering records. Resolver findMany should have limit and skip args.

Used in plugins

graphql-compose-mongoose - converts mongoose models to graphql types

License

MIT

install

npm i graphql-compose-pagination

Downloadsweekly downloads

2,106

version

5.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability