
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
rsql-filter
Advanced tools
Rslq-filter is a library that offers an effortless way to dynamically filter entities for Node.js ORM. At moment is aviable for TypeORM and Prisma.
Install rsql-filter
npm i rsql-filter
In case of TypeOrm:
import {EntityManager, QueryBuilder } from 'typeorm';
import { User, Phone } from './entities';
import { rsqlTypeOrmFilter } from "rsql-filter";
async function findAllUsers(userId: number, filter: string): Promise<User> {
const queryBuilder = entityManager.createQueryBuilder(User);
queryBuilder.leftJoinAndSelect("q.phone","phone")
rsqlTypeOrmFilter(filter, queryBuilder)
return queryBuilder.getMany();
}
In case of Prisma:
async function findAllUsers(filter) {
return this.prisma.user.findMany(where: {rsqlPrismaFilter<UserWhereInput>(filter) })
}
The filter parameter could contain the RSQL language string, passed by the frontend, needed for the desired filter. You can use https://www.npmjs.com/package/rsql-filter-builder as frontend builder.
The list of supported RSQL operations:
| Operation | Meaning |
|---|---|
| == | Equals |
| > | Greater |
| >= | Greater than |
| < | Less |
| <= | less than |
| != | Not Equals |
| =in= | in list |
| =out= | not in list |
| ; | AND |
| , | OR |
In case of TypeOrm
//Equals operation
rsqlTypeOrmFilter("name==Larry", queryBuilder)
//Like operation
rsqlTypeOrmFilter("name==*arry", queryBuilder)
//Less than operation
rsqlTypeOrmFilter("age<=5", queryBuilder)
//In list operation
rsqlTypeOrmFilter("age=in=(5,7,8) ", queryBuilder)
//Complex query
rsqlTypeOrmFilter("name==Larry;(lastName==Mason,(latName==Richmond;age>=20));adress=='4567 Evergreen Terrace'", queryBuilder)
//on one to many
rsqlTypeOrmFilter("name==Larry;phone.number==789107890", queryBuilder)
In case of Prisma
rsqlPrismaFilter<UserWhereInput>("name==Larry")
//on one to many or many to many is necessary to put - character before the property name.
rsqlPrismaFilter("name==Larry;-RelProjectOwner.projectId != 'project1'")
FAQs
Implementation of RSQL adapter for NodeJs ORM like TypeORM
We found that rsql-filter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.