
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@bit-architect/nestjs-paginator
Advanced tools
Add the library via
npm i @bit-architect/nestjs-paginator
or
yarn add @bit-architect/nestjs-paginator
The library provides a handy decorator that can be added to any NestJS controller. Consider the following example:
import { Paginator, PaginatorQuery } from '@bit-architect/nestjs-paginator';
import { Controller, Get } from '@nestjs/common';
import { UserService } from './user.service';
@Controller('users')
export class UserController {
constructor(private service: UserService) {}
@Get()
getUsers(@Paginator() query: PaginatorQuery) {
// console.log(query);
return await this.service.getUsers(query);
}
}
Currently, the Paginator supports the following query parameters:
page: numberlimit: numbersort: stringfilter: objectNow, you can make a HTTP Call to the endpoint and pass the params as follows:
http://api.example.com/users?limit=20&page=3&sort=-email,username
This will return
sort and filter parameters)-) and username ascendingThe Paginator is designed to be ORM agnostic, i.e., it can be easily extended / adapted to work with common ORMs, like TypeORM or Prisma.
The easiest approach would be to simply create a PrismaPaginator Decorator and call the PaginatorService, and adapt the response as required.
This may look like this:
import { PaginatorService, PaginatorOptions } from '@bit-architect/nestjs-paginator';
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
import { PrismaPaginatorQuery } from './prisma-paginator-query.model';
export const PrismaPaginator = createParamDecorator((data: Partial<PaginatorOptions>, ctx: ExecutionContext) => {
const request = ctx.switchToHttp().getRequest();
const query = new PaginatorService().parseQuery(request.query, data);
const prismaQuery: PrismaPaginatorQuery = {
skip: query.skip,
take: query.take,
orderBy: query.sort, // note that prisma uses the orderBy instead of sort parameter!
};
return prismaQuery;
});
Now you can just use the PrismaPaginator instead of the default Paginator in your controllers.
FAQs
## Installation
The npm package @bit-architect/nestjs-paginator receives a total of 1 weekly downloads. As such, @bit-architect/nestjs-paginator popularity was classified as not popular.
We found that @bit-architect/nestjs-paginator demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.