@nestarc/pagination
Classes
InvalidCursorError
Defined in: src/errors/invalid-cursor.error.ts:3
Extends
BadRequestException
Constructors
Constructor
new InvalidCursorError(cursor): InvalidCursorError;Defined in: src/errors/invalid-cursor.error.ts:4
Parameters
| Parameter | Type |
|---|---|
cursor | string |
Returns
Overrides
BadRequestException.constructorProperties
cause
cause: unknown;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:28
Exception cause. Indicates the specific original cause of the error. It is used when catching and re-throwing an error with a more-specific or useful error message in order to still have access to the original error.
Inherited from
BadRequestException.causemessage
message: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
BadRequestException.messagename
name: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
BadRequestException.namestack?
optional stack?: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
BadRequestException.stackstackTraceLimit
static stackTraceLimit: number;Defined in: node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
BadRequestException.stackTraceLimitMethods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;Defined in: node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
BadRequestException.captureStackTracecreateBody()
Call Signature
static createBody(
nil,
message,
statusCode): HttpExceptionBody;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:74
Parameters
| Parameter | Type |
|---|---|
nil | "" | null |
message | HttpExceptionBodyMessage |
statusCode | number |
Returns
HttpExceptionBody
Inherited from
BadRequestException.createBodyCall Signature
static createBody(
message,
error,
statusCode): HttpExceptionBody;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:75
Parameters
| Parameter | Type |
|---|---|
message | HttpExceptionBodyMessage |
error | string |
statusCode | number |
Returns
HttpExceptionBody
Inherited from
BadRequestException.createBodyCall Signature
static createBody<Body>(custom): Body;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:76
Type Parameters
| Type Parameter |
|---|
Body extends Record<string, unknown> |
Parameters
| Parameter | Type |
|---|---|
custom | Body |
Returns
Body
Inherited from
BadRequestException.createBodyextractDescriptionAndOptionsFrom()
static extractDescriptionAndOptionsFrom(descriptionOrOptions): DescriptionAndOptions;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:84
Utility method used to extract the error description and httpExceptionOptions from the given argument. This is used by inheriting classes to correctly parse both options.
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
DescriptionAndOptions
the error description and the httpExceptionOptions as an object.
Inherited from
BadRequestException.extractDescriptionAndOptionsFromgetDescriptionFrom()
static getDescriptionFrom(descriptionOrOptions): string;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:77
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
string
Inherited from
BadRequestException.getDescriptionFromgetHttpExceptionOptionsFrom()
static getHttpExceptionOptionsFrom(descriptionOrOptions): HttpExceptionOptions;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:78
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
HttpExceptionOptions
Inherited from
BadRequestException.getHttpExceptionOptionsFromgetResponse()
getResponse(): string | object;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:72
Returns
string | object
Inherited from
BadRequestException.getResponsegetStatus()
getStatus(): number;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:73
Returns
number
Inherited from
BadRequestException.getStatusinitCause()
initCause(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:69
Configures error chaining support
Returns
void
See
- https://nodejs.org/en/blog/release/v16.9.0/#error-cause
- https://github.com/microsoft/TypeScript/issues/45167
Inherited from
BadRequestException.initCauseinitMessage()
initMessage(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:70
Returns
void
Inherited from
BadRequestException.initMessageinitName()
initName(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:71
Returns
void
Inherited from
BadRequestException.initNameprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
BadRequestException.prepareStackTraceInvalidFilterColumnError
Defined in: src/errors/invalid-filter-column.error.ts:3
Extends
BadRequestException
Constructors
Constructor
new InvalidFilterColumnError(
column,
filterableColumns,
operator?,
allowedOperators?): InvalidFilterColumnError;Defined in: src/errors/invalid-filter-column.error.ts:4
Parameters
| Parameter | Type |
|---|---|
column | string |
filterableColumns | string[] |
operator? | string |
allowedOperators? | string[] |
Returns
Overrides
BadRequestException.constructorProperties
cause
cause: unknown;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:28
Exception cause. Indicates the specific original cause of the error. It is used when catching and re-throwing an error with a more-specific or useful error message in order to still have access to the original error.
Inherited from
BadRequestException.causemessage
message: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
BadRequestException.messagename
name: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
BadRequestException.namestack?
optional stack?: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
BadRequestException.stackstackTraceLimit
static stackTraceLimit: number;Defined in: node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
BadRequestException.stackTraceLimitMethods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;Defined in: node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
BadRequestException.captureStackTracecreateBody()
Call Signature
static createBody(
nil,
message,
statusCode): HttpExceptionBody;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:74
Parameters
| Parameter | Type |
|---|---|
nil | "" | null |
message | HttpExceptionBodyMessage |
statusCode | number |
Returns
HttpExceptionBody
Inherited from
BadRequestException.createBodyCall Signature
static createBody(
message,
error,
statusCode): HttpExceptionBody;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:75
Parameters
| Parameter | Type |
|---|---|
message | HttpExceptionBodyMessage |
error | string |
statusCode | number |
Returns
HttpExceptionBody
Inherited from
BadRequestException.createBodyCall Signature
static createBody<Body>(custom): Body;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:76
Type Parameters
| Type Parameter |
|---|
Body extends Record<string, unknown> |
Parameters
| Parameter | Type |
|---|---|
custom | Body |
Returns
Body
Inherited from
BadRequestException.createBodyextractDescriptionAndOptionsFrom()
static extractDescriptionAndOptionsFrom(descriptionOrOptions): DescriptionAndOptions;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:84
Utility method used to extract the error description and httpExceptionOptions from the given argument. This is used by inheriting classes to correctly parse both options.
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
DescriptionAndOptions
the error description and the httpExceptionOptions as an object.
Inherited from
BadRequestException.extractDescriptionAndOptionsFromgetDescriptionFrom()
static getDescriptionFrom(descriptionOrOptions): string;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:77
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
string
Inherited from
BadRequestException.getDescriptionFromgetHttpExceptionOptionsFrom()
static getHttpExceptionOptionsFrom(descriptionOrOptions): HttpExceptionOptions;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:78
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
HttpExceptionOptions
Inherited from
BadRequestException.getHttpExceptionOptionsFromgetResponse()
getResponse(): string | object;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:72
Returns
string | object
Inherited from
BadRequestException.getResponsegetStatus()
getStatus(): number;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:73
Returns
number
Inherited from
BadRequestException.getStatusinitCause()
initCause(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:69
Configures error chaining support
Returns
void
See
- https://nodejs.org/en/blog/release/v16.9.0/#error-cause
- https://github.com/microsoft/TypeScript/issues/45167
Inherited from
BadRequestException.initCauseinitMessage()
initMessage(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:70
Returns
void
Inherited from
BadRequestException.initMessageinitName()
initName(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:71
Returns
void
Inherited from
BadRequestException.initNameprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
BadRequestException.prepareStackTraceInvalidSortColumnError
Defined in: src/errors/invalid-sort-column.error.ts:3
Extends
BadRequestException
Constructors
Constructor
new InvalidSortColumnError(column, sortableColumns): InvalidSortColumnError;Defined in: src/errors/invalid-sort-column.error.ts:4
Parameters
| Parameter | Type |
|---|---|
column | string |
sortableColumns | string[] |
Returns
Overrides
BadRequestException.constructorProperties
cause
cause: unknown;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:28
Exception cause. Indicates the specific original cause of the error. It is used when catching and re-throwing an error with a more-specific or useful error message in order to still have access to the original error.
Inherited from
BadRequestException.causemessage
message: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
BadRequestException.messagename
name: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
BadRequestException.namestack?
optional stack?: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
BadRequestException.stackstackTraceLimit
static stackTraceLimit: number;Defined in: node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
BadRequestException.stackTraceLimitMethods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;Defined in: node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
BadRequestException.captureStackTracecreateBody()
Call Signature
static createBody(
nil,
message,
statusCode): HttpExceptionBody;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:74
Parameters
| Parameter | Type |
|---|---|
nil | "" | null |
message | HttpExceptionBodyMessage |
statusCode | number |
Returns
HttpExceptionBody
Inherited from
BadRequestException.createBodyCall Signature
static createBody(
message,
error,
statusCode): HttpExceptionBody;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:75
Parameters
| Parameter | Type |
|---|---|
message | HttpExceptionBodyMessage |
error | string |
statusCode | number |
Returns
HttpExceptionBody
Inherited from
BadRequestException.createBodyCall Signature
static createBody<Body>(custom): Body;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:76
Type Parameters
| Type Parameter |
|---|
Body extends Record<string, unknown> |
Parameters
| Parameter | Type |
|---|---|
custom | Body |
Returns
Body
Inherited from
BadRequestException.createBodyextractDescriptionAndOptionsFrom()
static extractDescriptionAndOptionsFrom(descriptionOrOptions): DescriptionAndOptions;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:84
Utility method used to extract the error description and httpExceptionOptions from the given argument. This is used by inheriting classes to correctly parse both options.
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
DescriptionAndOptions
the error description and the httpExceptionOptions as an object.
Inherited from
BadRequestException.extractDescriptionAndOptionsFromgetDescriptionFrom()
static getDescriptionFrom(descriptionOrOptions): string;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:77
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
string
Inherited from
BadRequestException.getDescriptionFromgetHttpExceptionOptionsFrom()
static getHttpExceptionOptionsFrom(descriptionOrOptions): HttpExceptionOptions;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:78
Parameters
| Parameter | Type |
|---|---|
descriptionOrOptions | string | HttpExceptionOptions |
Returns
HttpExceptionOptions
Inherited from
BadRequestException.getHttpExceptionOptionsFromgetResponse()
getResponse(): string | object;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:72
Returns
string | object
Inherited from
BadRequestException.getResponsegetStatus()
getStatus(): number;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:73
Returns
number
Inherited from
BadRequestException.getStatusinitCause()
initCause(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:69
Configures error chaining support
Returns
void
See
- https://nodejs.org/en/blog/release/v16.9.0/#error-cause
- https://github.com/microsoft/TypeScript/issues/45167
Inherited from
BadRequestException.initCauseinitMessage()
initMessage(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:70
Returns
void
Inherited from
BadRequestException.initMessageinitName()
initName(): void;Defined in: node_modules/@nestjs/common/exceptions/http.exception.d.ts:71
Returns
void
Inherited from
BadRequestException.initNameprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
BadRequestException.prepareStackTracePaginateService
Defined in: src/paginate.service.ts:12
Constructors
Constructor
new PaginateService(moduleOptions?, reflector): PaginateService;Defined in: src/paginate.service.ts:13
Parameters
| Parameter | Type |
|---|---|
moduleOptions | PaginationModuleOptions |
reflector | Reflector |
Returns
Methods
paginate()
paginate<T>(
query,
delegate,
config,
handler?): Promise<
| Paginated<T>
| CursorPaginated<T>>;Defined in: src/paginate.service.ts:20
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
query | PaginateQuery |
delegate | { count: (args) => Promise<number>; findMany: (args) => Promise<T[]>; } |
delegate.count | (args) => Promise<number> |
delegate.findMany | (args) => Promise<T[]> |
config? | PaginateConfig<T> |
handler? | Function |
Returns
Promise< | Paginated<T> | CursorPaginated<T>>
PaginationModule
Defined in: src/pagination.module.ts:11
Constructors
Constructor
new PaginationModule(): PaginationModule;Returns
Methods
forRoot()
static forRoot(options?): DynamicModule;Defined in: src/pagination.module.ts:12
Parameters
| Parameter | Type |
|---|---|
options? | PaginationModuleOptions |
Returns
DynamicModule
forRootAsync()
static forRootAsync(options): DynamicModule;Defined in: src/pagination.module.ts:28
Parameters
| Parameter | Type |
|---|---|
options | PaginationModuleAsyncOptions |
Returns
DynamicModule
Interfaces
ApiPaginationQueryOptions
Defined in: src/decorators/api-paginated-response.decorator.ts:11
Properties
allowWithDeleted?
optional allowWithDeleted?: boolean;Defined in: src/decorators/api-paginated-response.decorator.ts:16
filterableColumns?
optional filterableColumns?: Record<string, FilterOperator[]>;Defined in: src/decorators/api-paginated-response.decorator.ts:15
searchableColumns?
optional searchableColumns?: string[];Defined in: src/decorators/api-paginated-response.decorator.ts:14
sortableColumns?
optional sortableColumns?: string[];Defined in: src/decorators/api-paginated-response.decorator.ts:13
type?
optional type?: "offset" | "cursor";Defined in: src/decorators/api-paginated-response.decorator.ts:12
CursorPaginated
Defined in: src/interfaces/paginated.interface.ts:23
Type Parameters
| Type Parameter |
|---|
T |
Properties
data
data: T[];Defined in: src/interfaces/paginated.interface.ts:24
links
links: {
current: string;
next: string | null;
previous: string | null;
};Defined in: src/interfaces/paginated.interface.ts:36
current
current: string;next
next: string | null;previous
previous: string | null;meta
meta: {
endCursor: string | null;
filter?: Record<string, string>;
hasNextPage: boolean;
hasPreviousPage: boolean;
itemsPerPage: number;
search?: string;
sortBy: [string, SortOrder][];
startCursor: string | null;
totalItems?: number;
};Defined in: src/interfaces/paginated.interface.ts:25
endCursor
endCursor: string | null;filter?
optional filter?: Record<string, string>;hasNextPage
hasNextPage: boolean;hasPreviousPage
hasPreviousPage: boolean;itemsPerPage
itemsPerPage: number;search?
optional search?: string;sortBy
sortBy: [string, SortOrder][];startCursor
startCursor: string | null;totalItems?
optional totalItems?: number;PaginateConfig
Defined in: src/interfaces/paginate-config.interface.ts:8
Type Parameters
| Type Parameter | Default type |
|---|---|
T | any |
Properties
allowWithDeleted?
optional allowWithDeleted?: boolean;Defined in: src/interfaces/paginate-config.interface.ts:51
countQuery?
optional countQuery?: (args) => Promise<number>;Defined in: src/interfaces/paginate-config.interface.ts:43
Parameters
| Parameter | Type |
|---|---|
args | { config: PaginateConfig<T>; delegate: { count: (args) => Promise<number>; }; query: PaginateQuery; where: Record<string, any>; } |
args.config | PaginateConfig<T> |
args.delegate | { count: (args) => Promise<number>; } |
args.delegate.count | (args) => Promise<number> |
args.query | PaginateQuery |
args.where | Record<string, any> |
Returns
Promise<number>
countStrategy?
optional countStrategy?: CountStrategy;Defined in: src/interfaces/paginate-config.interface.ts:42
cursorColumn?
optional cursorColumn?: keyof T & string;Defined in: src/interfaces/paginate-config.interface.ts:34
Column used as cursor for cursor-based pagination. Defaults to 'id'.
Requirements:
- Must be included in
sortableColumns - Should have unique, sequential values (e.g., auto-increment ID, UUID v7, timestamp)
- Non-unique cursor columns may produce inconsistent results across pages
See
https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination
cursorColumns?
optional cursorColumns?: keyof T & string[];Defined in: src/interfaces/paginate-config.interface.ts:36
cursorStrategy?
optional cursorStrategy?: CursorStrategy;Defined in: src/interfaces/paginate-config.interface.ts:35
decodeCursor?
optional decodeCursor?: (cursor) => CursorPayload;Defined in: src/interfaces/paginate-config.interface.ts:38
Parameters
| Parameter | Type |
|---|---|
cursor | string |
Returns
CursorPayload
defaultLimit?
optional defaultLimit?: number;Defined in: src/interfaces/paginate-config.interface.ts:39
defaultSortBy?
optional defaultSortBy?: [keyof T & string, SortOrder][];Defined in: src/interfaces/paginate-config.interface.ts:11
encodeCursor?
optional encodeCursor?: (payload) => string;Defined in: src/interfaces/paginate-config.interface.ts:37
Parameters
| Parameter | Type |
|---|---|
payload | CursorPayload |
Returns
string
filterableColumns?
optional filterableColumns?: { [K in string]?: FilterOperator[] };Defined in: src/interfaces/paginate-config.interface.ts:16
maxLimit?
optional maxLimit?: number;Defined in: src/interfaces/paginate-config.interface.ts:40
nullSort?
optional nullSort?: "first" | "last";Defined in: src/interfaces/paginate-config.interface.ts:12
paginationType?
optional paginationType?: "offset" | "cursor";Defined in: src/interfaces/paginate-config.interface.ts:23
relations?
optional relations?: Record<string, boolean | object>;Defined in: src/interfaces/paginate-config.interface.ts:20
searchableColumns?
optional searchableColumns?: keyof T & string[];Defined in: src/interfaces/paginate-config.interface.ts:14
select?
optional select?: keyof T & string[];Defined in: src/interfaces/paginate-config.interface.ts:21
sortableColumns
sortableColumns: keyof T & string[];Defined in: src/interfaces/paginate-config.interface.ts:9
where?
optional where?: object;Defined in: src/interfaces/paginate-config.interface.ts:50
withTotalCount?
optional withTotalCount?: boolean;Defined in: src/interfaces/paginate-config.interface.ts:41
Paginated
Defined in: src/interfaces/paginated.interface.ts:3
Type Parameters
| Type Parameter |
|---|
T |
Properties
data
data: T[];Defined in: src/interfaces/paginated.interface.ts:4
links
links: {
current: string;
first: string;
last: string;
next: string | null;
previous: string | null;
};Defined in: src/interfaces/paginated.interface.ts:14
current
current: string;first
first: string;last
last: string;next
next: string | null;previous
previous: string | null;meta
meta: {
currentPage: number;
filter?: Record<string, string>;
itemsPerPage: number;
search?: string;
sortBy: [string, SortOrder][];
totalItems?: number;
totalPages?: number;
};Defined in: src/interfaces/paginated.interface.ts:5
currentPage
currentPage: number;filter?
optional filter?: Record<string, string>;itemsPerPage
itemsPerPage: number;search?
optional search?: string;sortBy
sortBy: [string, SortOrder][];totalItems?
optional totalItems?: number;totalPages?
optional totalPages?: number;PaginateDefaultsOptions
Defined in: src/decorators/paginate-defaults.decorator.ts:6
Properties
defaultLimit?
optional defaultLimit?: number;Defined in: src/decorators/paginate-defaults.decorator.ts:7
defaultSortBy?
optional defaultSortBy?: [string, SortOrder][];Defined in: src/decorators/paginate-defaults.decorator.ts:9
maxLimit?
optional maxLimit?: number;Defined in: src/decorators/paginate-defaults.decorator.ts:8
paginationType?
optional paginationType?: "offset" | "cursor";Defined in: src/decorators/paginate-defaults.decorator.ts:10
PaginateQuery
Defined in: src/interfaces/paginate-query.interface.ts:3
Properties
after?
optional after?: string;Defined in: src/interfaces/paginate-query.interface.ts:15
before?
optional before?: string;Defined in: src/interfaces/paginate-query.interface.ts:16
filter?
optional filter?: Record<string, string | string[]>;Defined in: src/interfaces/paginate-query.interface.ts:7
limit?
optional limit?: number;Defined in: src/interfaces/paginate-query.interface.ts:4
page?
optional page?: number;Defined in: src/interfaces/paginate-query.interface.ts:12
path
path: string;Defined in: src/interfaces/paginate-query.interface.ts:9
search?
optional search?: string;Defined in: src/interfaces/paginate-query.interface.ts:6
sortBy?
optional sortBy?: [string, SortOrder][];Defined in: src/interfaces/paginate-query.interface.ts:5
withDeleted?
optional withDeleted?: boolean;Defined in: src/interfaces/paginate-query.interface.ts:8
PaginationModuleAsyncOptions
Defined in: src/interfaces/pagination-options.interface.ts:14
Extends
Pick<ModuleMetadata,"imports">
Properties
imports?
optional imports?: (
| DynamicModule
| Type<any>
| Promise<DynamicModule>
| ForwardReference<any>)[];Defined in: node_modules/@nestjs/common/interfaces/modules/module-metadata.interface.d.ts:18
Optional list of imported modules that export the providers which are required in this module.
Inherited from
Pick.importsinject?
optional inject?: any[];Defined in: src/interfaces/pagination-options.interface.ts:19
useFactory
useFactory: (...args) =>
| PaginationModuleOptions
| Promise<PaginationModuleOptions>;Defined in: src/interfaces/pagination-options.interface.ts:16
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
| PaginationModuleOptions | Promise<PaginationModuleOptions>
PaginationModuleOptions
Defined in: src/interfaces/pagination-options.interface.ts:4
Properties
defaultLimit?
optional defaultLimit?: number;Defined in: src/interfaces/pagination-options.interface.ts:5
defaultPaginationType?
optional defaultPaginationType?: "offset" | "cursor";Defined in: src/interfaces/pagination-options.interface.ts:7
defaultSortBy?
optional defaultSortBy?: [string, SortOrder][];Defined in: src/interfaces/pagination-options.interface.ts:8
fieldNamingStrategy?
optional fieldNamingStrategy?: "camelCase" | "snake_case";Defined in: src/interfaces/pagination-options.interface.ts:11
maxLimit?
optional maxLimit?: number;Defined in: src/interfaces/pagination-options.interface.ts:6
withLinks?
optional withLinks?: boolean;Defined in: src/interfaces/pagination-options.interface.ts:9
withTotalCount?
optional withTotalCount?: boolean;Defined in: src/interfaces/pagination-options.interface.ts:10
Type Aliases
CountStrategy
type CountStrategy = "exact" | "none" | "custom";Defined in: src/interfaces/paginate-config.interface.ts:5
FilterOperator
type FilterOperator =
| "$eq"
| "$ne"
| "$gt"
| "$gte"
| "$lt"
| "$lte"
| "$in"
| "$nin"
| "$ilike"
| "$btw"
| "$null"
| "$not:null";Defined in: src/interfaces/filter-operator.type.ts:1
SortOrder
type SortOrder = "ASC" | "DESC";Defined in: src/interfaces/filter-operator.type.ts:15
Variables
Paginate
const Paginate: (...dataOrPipes) => ParameterDecorator;Defined in: src/decorators/paginate.decorator.ts:5
Parameters
| Parameter | Type |
|---|---|
...dataOrPipes | unknown[] |
Returns
ParameterDecorator
PAGINATE_DEFAULTS_KEY
const PAGINATE_DEFAULTS_KEY: "PAGINATE_DEFAULTS" = 'PAGINATE_DEFAULTS';Defined in: src/decorators/paginate-defaults.decorator.ts:4
PAGINATION_MODULE_OPTIONS
const PAGINATION_MODULE_OPTIONS: "PAGINATION_MODULE_OPTIONS" = 'PAGINATION_MODULE_OPTIONS';Defined in: src/pagination.constants.ts:1
Functions
ApiCursorPaginatedResponse()
function ApiCursorPaginatedResponse(dataDto, queryOptions?): MethodDecorator;Defined in: src/decorators/api-paginated-response.decorator.ts:68
Parameters
| Parameter | Type |
|---|---|
dataDto | Type |
queryOptions | Omit<ApiPaginationQueryOptions, "type"> |
Returns
MethodDecorator
ApiPaginatedResponse()
function ApiPaginatedResponse(dataDto, queryOptions?): MethodDecorator;Defined in: src/decorators/api-paginated-response.decorator.ts:19
Parameters
| Parameter | Type |
|---|---|
dataDto | Type |
queryOptions | Omit<ApiPaginationQueryOptions, "type"> |
Returns
MethodDecorator
ApiPaginationQuery()
function ApiPaginationQuery(options?): MethodDecorator;Defined in: src/decorators/api-paginated-response.decorator.ts:116
Parameters
| Parameter | Type |
|---|---|
options | ApiPaginationQueryOptions |
Returns
MethodDecorator
paginate()
function paginate<T>(
query,
delegate,
config): Promise<
| Paginated<T>
| CursorPaginated<T>>;Defined in: src/paginate.ts:23
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
query | PaginateQuery |
delegate | { count: (args) => Promise<number>; findMany: (args) => Promise<T[]>; } |
delegate.count | (args) => Promise<number> |
delegate.findMany | (args) => Promise<T[]> |
config | PaginateConfig<T> |
Returns
Promise< | Paginated<T> | CursorPaginated<T>>
PaginateDefaults()
function PaginateDefaults(defaults): CustomDecorator<string>;Defined in: src/decorators/paginate-defaults.decorator.ts:13
Parameters
| Parameter | Type |
|---|---|
defaults | PaginateDefaultsOptions |
Returns
CustomDecorator<string>