Skip to content

lkrzyzanek/graphql-pagination

Repository files navigation

GraphQL Pagination codecov

Library to easily wrap data to GraphQL Pagination.

Implements Relay's GraphQL Cursor Connections Specification and supports Offset Pagination.

Designed in modular and extendable way.

Getting Started

Use built-in dataSourcePager which provides GraphQL Resolver for your Graph. By implementing / using built-in DataSource you have full control how data is provided to the Pager.

You can use one of these provided:

  1. ArrayDataSource - bundled in @graphql-pagination/core module
  2. OffsetDataSourceWrapper - bundled in @graphql-pagination/core module
  3. SQL Knex - bundled in sql-knex module
  4. MongoDb - bundled in mongodb module

Or implement your own by implementing the DataSource interface.

Apollo Integration

There is no need for any special integration or dependency. Just use core pager. In places where user's input is validated the proper GraphQLError is thrown with extensions object containing code BAD_USER_INPUT.

For more examples go to core package.