@x-spacy/pagination 1.0.9 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/enums/PaginationLinkType.d.ts +5 -5
- package/@types/index.d.ts +11 -6
- package/@types/interceptors/PaginationInterceptor.d.ts +12 -6
- package/@types/operators/paginate.d.ts +2 -1
- package/@types/schemas/Page.d.ts +4 -4
- package/@types/schemas/PaginatedResponse.d.ts +18 -11
- package/@types/schemas/PaginationLink.d.ts +9 -6
- package/@types/schemas/PaginationMeta.d.ts +11 -7
- package/package.json +1 -1
- package/tsconfig.json +0 -2
package/@types/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
|
|
3
|
-
export * from '
|
|
4
|
-
|
|
5
|
-
export * from '
|
|
6
|
-
|
|
1
|
+
export * from './enums/PaginationLinkType.d.ts';
|
|
2
|
+
|
|
3
|
+
export * from './interceptors/PaginationInterceptor.d.ts';
|
|
4
|
+
|
|
5
|
+
export * from './operators/paginate.d.ts';
|
|
6
|
+
|
|
7
|
+
export * from './schemas/PaginatedResponse.d.ts';
|
|
8
|
+
|
|
9
|
+
export * from './schemas/PaginationLink.d.ts';
|
|
10
|
+
|
|
11
|
+
export * from './schemas/PaginationMeta.d.ts';
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
CallHandler,
|
|
3
|
+
ExecutionContext,
|
|
4
|
+
NestInterceptor
|
|
5
|
+
} from '@nestjs/common';
|
|
6
|
+
|
|
7
|
+
import { Observable } from 'rxjs';
|
|
8
|
+
|
|
9
|
+
import { Page } from '../schemas/Page';
|
|
10
|
+
import { PaginatedResponse } from '../schemas/PaginatedResponse';
|
|
11
|
+
|
|
5
12
|
export declare class PaginateInterceptor<T> implements NestInterceptor<Page<T>, PaginatedResponse<T>> {
|
|
6
|
-
|
|
7
|
-
protected buildLinks(currentPage: number, lastPage: number, buildUrl: (page: number) => string): PaginationLink[];
|
|
13
|
+
intercept(context: ExecutionContext, next: CallHandler<Page<T>>): Observable<PaginatedResponse<T>>;
|
|
8
14
|
}
|
package/@types/schemas/Page.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export class Page<T> {
|
|
2
|
+
public readonly items: Array<T>;
|
|
3
|
+
|
|
4
|
+
public readonly total: number;
|
|
5
5
|
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { PaginationLink } from '
|
|
2
|
-
import { PaginationMeta } from '
|
|
1
|
+
import { PaginationLink } from './PaginationLink';
|
|
2
|
+
import { PaginationMeta } from './PaginationMeta';
|
|
3
|
+
|
|
3
4
|
export declare class PaginatedResponse<T> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
public readonly items: Array<T>;
|
|
6
|
+
|
|
7
|
+
public readonly meta: PaginationMeta;
|
|
8
|
+
|
|
9
|
+
public readonly path: string;
|
|
10
|
+
|
|
11
|
+
public readonly firstPageURL: string;
|
|
12
|
+
|
|
13
|
+
public readonly previousPageURL: string | null;
|
|
14
|
+
|
|
15
|
+
public readonly nextPageURL: string | null;
|
|
16
|
+
|
|
17
|
+
public readonly lastPageURL: string;
|
|
18
|
+
|
|
19
|
+
public readonly links: Array<PaginationLink>;
|
|
13
20
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { PaginationLinkType } from '
|
|
1
|
+
import { PaginationLinkType } from './PaginationLinkType';
|
|
2
|
+
|
|
2
3
|
export declare class PaginationLink {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
public readonly url: string | null;
|
|
5
|
+
|
|
6
|
+
public readonly label: string;
|
|
7
|
+
|
|
8
|
+
public readonly type: PaginationLinkType;
|
|
9
|
+
|
|
10
|
+
public readonly active: boolean;
|
|
8
11
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
export declare class PaginationMeta {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
public readonly from: number;
|
|
3
|
+
|
|
4
|
+
public readonly to: number;
|
|
5
|
+
|
|
6
|
+
public readonly currentPage: number;
|
|
7
|
+
|
|
8
|
+
public readonly lastPage: number;
|
|
9
|
+
|
|
10
|
+
public readonly perPage: number;
|
|
11
|
+
|
|
12
|
+
public readonly total: number;
|
|
9
13
|
}
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
"module": "commonjs",
|
|
5
5
|
"rootDir": "src",
|
|
6
6
|
"outDir": "dist",
|
|
7
|
-
"declarationDir": "@types",
|
|
8
7
|
"paths": {
|
|
9
8
|
"@x-spacy/pagination/*": [
|
|
10
9
|
"./src/*"
|
|
11
10
|
]
|
|
12
11
|
},
|
|
13
12
|
"strict": true,
|
|
14
|
-
"declaration": true,
|
|
15
13
|
"skipLibCheck": true,
|
|
16
14
|
"removeComments": true,
|
|
17
15
|
"esModuleInterop": true,
|