# graphql-compose-pagination

> Plugin for `graphql-compose` which provide a pagination resolver for types.

Latest version **8.3.0** (published 2021-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-compose-pagination
pnpm add graphql-compose-pagination
yarn add graphql-compose-pagination
bun add graphql-compose-pagination
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 8.3.0 |
| Published | 2021-08-06 |
| First published | 2017-08-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 25.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Maintainers | nodkz |
| Keywords | graphql, graphql-compose, pagination |

## Links

- npm: https://www.npmjs.com/package/graphql-compose-pagination
- Repository: https://github.com/graphql-compose/graphql-compose-pagination
- Issues: https://github.com/graphql-compose/graphql-compose-pagination/issues
- npm.io page: https://npm.io/package/graphql-compose-pagination

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 8.3.0 (latest) — 2021-08-06
- 8.2.1 — 2021-07-09
- 8.2.0 — 2021-05-30
- 8.1.0 — 2021-04-30
- 8.0.2 — 2020-12-28
- 8.0.1 — 2020-09-14
- 8.0.0 — 2020-09-14
- 7.0.0 — 2020-08-17
- 6.1.0 — 2020-07-02
- 6.0.3 — 2019-06-04
- 6.0.2 — 2019-04-29
- 6.0.1 — 2019-04-28
- 6.0.0 — 2019-04-28
- 5.1.0 — 2019-03-23
- 5.0.0 — 2019-03-15
- … 17 more at https://npm.io/package/graphql-compose-pagination/versions

## README

# graphql-compose-pagination

[![travis build](https://img.shields.io/travis/graphql-compose/graphql-compose-pagination.svg)](https://travis-ci.org/graphql-compose/graphql-compose-pagination)
[![codecov coverage](https://img.shields.io/codecov/c/github/graphql-compose/graphql-compose-pagination.svg)](https://codecov.io/github/graphql-compose/graphql-compose-pagination)
[![npm](https://img.shields.io/npm/v/graphql-compose-pagination.svg)](https://www.npmjs.com/package/graphql-compose-pagination)
[![trend](https://img.shields.io/npm/dt/graphql-compose-pagination.svg)](http://www.npmtrends.com/graphql-compose-pagination)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](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).

<img width="832" alt="screen shot 2017-08-07 at 23 31 46" src="https://user-images.githubusercontent.com/1946920/29038210-ad2390e4-7bc8-11e7-8143-ff0cca2b39cc.png">

## 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)

---
_Source: https://npm.io/package/graphql-compose-pagination · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
