# graphql-paginate

> graphql pagination helper

Latest version **1.1.1** (published 2020-06-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install graphql-paginate
pnpm add graphql-paginate
yarn add graphql-paginate
bun add graphql-paginate
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2020-06-03 |
| First published | 2020-03-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 (+8 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Masskoder |
| Maintainers | masskoder |
| Keywords | graphql, pagination |

## Links

- npm: https://www.npmjs.com/package/graphql-paginate
- Repository: https://github.com/masskoder/graphql-paginate
- Homepage: https://github.com/masskoder/graphql-paginate#readme
- Issues: https://github.com/masskoder/graphql-paginate/issues
- npm.io page: https://npm.io/package/graphql-paginate

## Dependencies (3)

- [bluebird](https://npm.io/package/bluebird.md) ^3.7.2
- [mongoose](https://npm.io/package/mongoose.md) ^5.9.16
- [sequelize](https://npm.io/package/sequelize.md) ^5.21.5

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

- 1.1.1 (latest) — 2020-06-03
- 1.1.0 — 2020-05-26
- 1.0.1 — 2020-03-12

## README

# Graphql-Pagination

GraphQL pagination helper that makes it easy to get pagination response.

Support only MYSQL and POSTGRESQL databases with Sequelize and also MONGODB with Mongoose

### Installation

```
npm install graphql-paginate
```

### Usage

#### List of args Values

- skip : Number
- after : Any
- before : Any
- first : Number
- last : Number
- limit : number
- \_where : object

```javascript
const pagination = require("graphql-paginate");
module.exports = async function getTransactions(parent, args, context) {
  const { db } = context;
  const { UserTransaction } = db;

  return pagination({
    model: UserTransaction,
    args,
    attribute: "id",
    orderBy: "DESC",
  });
};
```

### Response Schema (Sequelize)

```
 {

  "pageInfo":  {
    "endCursor": 2,
    "hasNextPage": true,
    "hasPreviousPage": true,
    "startCursor": 1,
  },
   "edges": Array [
     {
      "cursor": 1,
      "node":  {
        "id": 1,
        "name": "user 1",
      },
    },
     {
      "cursor": 2,
      "node":  {
        "id": 2,
        "name": "user 2",
      },
    },
  ],
  "totalCount": 5,

```

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