Socket
Socket
Sign inDemoInstall

paginate-prisma

Package Overview
Dependencies
6
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    paginate-prisma

[![Maintainability](https://api.codeclimate.com/v1/badges/6b08ca1cc22333d5e1be/maintainability)](https://codeclimate.com/github/qlaffont/paginate-prisma/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/6b08ca1cc22333d5e1be/test_cov


Version published
Weekly downloads
397
decreased by-53.4%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Maintainability Test Coverage npm npm Snyk Vulnerabilities for npm package NPM

Paginate Prisma

A TS plugin wrapping pagination for Prisma ORM. Old Owner: @flexper

Install

pnpm i paginate-prisma

Use

import { paginate, PAGINATION_ORDER } from 'paginate-prisma';

const prisma = new PrismaClient();
await paginate(prisma.user)(
  {},
  {
    sort: {
      field: 'tokens._count',
      order: PAGINATION_ORDER.ASC,
    },
  }
);

For type-graphql integration, check example/type.ts

API

paginate(prismaModel)(query, sortingOptions, additionalFindMany)

Options

Field NameTypeDescription
prismaModelPrisma ModelPrisma model/table/entity to use
sortingOptionsPaginationOptionsOptions to use for pagination (Page, sorting, etc)
additionalFindManyPrisma FindManyArgumentOther params in findMany as include, cursor, etc

Return Promise<PaginationResult & {data: T[]}>

Field NameTypeDescription
dataT[]Paginated Data
pagenumberCurrent page
pagesnumberTotal number of pages
limitnumberNumber of row to be returned
itemsnumberTotal number of items

Test

To test this package, you need to run a PostgresSQL server :


docker-compose up -d
chmod -R 777 docker
pnpm prisma migrate deploy
pnpm test

Maintain

This package use TSdx. Please check documentation to update this package.

FAQs

Last updated on 02 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc