npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

prisma-filter-common

v1.0.0

Published

The PrismaQueryFilter package allows the frontend to request filtered, sorted, and paginated data via query parameters. The package automatically generates Prisma findOptions from these query parameters, which can then be directly used in the backend.

Readme

📦 Prisma Query

🛠 Forked from chax-at/prisma-filter

This library helps you easily create dynamic filter queries for Prisma. It supports building safe and flexible where conditions using TypeScript, and is especially useful when combined with frameworks like NestJS.

👉 Original Documentation: https://github.com/chax-at/prisma-filter


Install - Backend

Sử dụng Yarn:

yarn add @prisma-qs/filter

Sử dụng Npm:

npm i @prisma-qs/filter

Install - Frontend

Sử dụng Yarn:

yarn add @prisma-qs/filter-common

Sử dụng Npm:

npm i @prisma-qs/filter-common

Building a filter

This package provides a FilterBuilder<T> class which can be used to create the filter:

import { FilterBuilder, FilterOperationType } from "prisma-querystring";

const filterBuilder = new FilterBuilder<User>() // create a new filter builder for User entities..
  .addFilter("name", FilterOperationType.Ilike, "%Max%") // ...filter by name ilike '%Max%'
  .addOrFilter("email", FilterOperationType.Ilike, "%email%") // ...orFilter by email ilike '%email%'
  .addOrderBy("name", "asc") // ...order by name, asc
  .setPageSize(40) // ...paginate with a pagesize of 40
  .requestPage(3); // ...return the third page
const filter = filterBuilder.toFilter(); // get the resulting IFilter<User>
const queryString = filterBuilder.toQueryString(); // get the resulting query string (as described below)

// Note that you can also re-use the same filter if you just want to request a different page without changing filter or ordering:
const firstPageFilter = filterBuilder.requestPage(1).toFilter();

Building a query string

In the end, a query string is required which will be sent to the backend server. To build this query string, you can use FilterBuilder.toQueryString() when building a filter using the FilterBuilder as described above. However, it is also possible to transform an existing filter into a query string:

const queryString = FilterBuilder.buildFilterQueryString({
  limit: 20,
  offset: 30,
  filter: [
    { field: "field1", type: FilterOperationType.NeNull, value: "val1" },
  ],
  orFilter: [
    { field: "field2", type: FilterOperationType.NeNull, value: "val2" },
  ],
  order: [{ field: "field1", dir: "asc" }],
});
// queryString is
// ?offset=30&limit=20&filter[0][field]=field1&filter[0][type]=nenull&filter[0][value]=val1&orFilter[0][field]=field2&orFilter[0][type]=nenull&orFilter[0][value]=val2&order[0][field]=field1&order[0][dir]=asc&order[1][field]=field2&order[1][dir]=desc