@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.
@@ -1,7 +1,7 @@
1
1
  export declare enum PaginationLinkType {
2
- FIRST = "FIRST",
3
- LAST = "LAST",
4
- PREVIOUS = "PREVIOUS",
5
- NEXT = "NEXT",
6
- PAGE = "PAGE"
2
+ FIRST = 'FIRST',
3
+ LAST = 'LAST',
4
+ PREVIOUS = 'PREVIOUS',
5
+ NEXT = 'NEXT',
6
+ PAGE = 'PAGE'
7
7
  }
package/@types/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
- export * from '@x-spacy/pagination/interceptors/PaginationInterceptor';
2
- export * from '@x-spacy/pagination/operators/paginate';
3
- export * from '@x-spacy/pagination/schemas/Page';
4
- export * from '@x-spacy/pagination/schemas/PaginatedResponse';
5
- export * from '@x-spacy/pagination/schemas/PaginationLink';
6
- export * from '@x-spacy/pagination/schemas/PaginationMeta';
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 { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
2
- import { Page } from '@x-spacy/pagination/schemas/Page';
3
- import { PaginatedResponse } from '@x-spacy/pagination/schemas/PaginatedResponse';
4
- import { PaginationLink } from '@x-spacy/pagination/schemas/PaginationLink';
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
- intercept(context: ExecutionContext, next: CallHandler<Page<T>>): import("rxjs").Observable<PaginatedResponse<T>>;
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
  }
@@ -1,2 +1,3 @@
1
- import { Page } from '@x-spacy/pagination/schemas/Page';
1
+ import { Page } from '../schemas/Page';
2
+
2
3
  export declare function paginate<T>(items: Array<T>, total: number): Page<T>;
@@ -1,5 +1,5 @@
1
- export declare class Page<T> {
2
- readonly items: Array<T>;
3
- readonly total: number;
4
- constructor(items: Array<T>, total: number);
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 '@x-spacy/pagination/schemas/PaginationLink';
2
- import { PaginationMeta } from '@x-spacy/pagination/schemas/PaginationMeta';
1
+ import { PaginationLink } from './PaginationLink';
2
+ import { PaginationMeta } from './PaginationMeta';
3
+
3
4
  export declare class PaginatedResponse<T> {
4
- readonly items: Array<T>;
5
- readonly meta: PaginationMeta;
6
- readonly path: string;
7
- readonly firstPageURL: string;
8
- readonly previousPageURL: string | null;
9
- readonly nextPageURL: string | null;
10
- readonly lastPageURL: string;
11
- readonly links: Array<PaginationLink>;
12
- constructor(items: Array<T>, meta: PaginationMeta, path: string, firstPageURL: string, previousPageURL: string | null, nextPageURL: string | null, lastPageURL: string, links: Array<PaginationLink>);
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 '@x-spacy/pagination/enums/PaginationLinkType';
1
+ import { PaginationLinkType } from './PaginationLinkType';
2
+
2
3
  export declare class PaginationLink {
3
- readonly url: string | null;
4
- readonly label: string;
5
- readonly type: PaginationLinkType;
6
- readonly active: boolean;
7
- constructor(url: string | null, label: string, type: PaginationLinkType, active: boolean);
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
- readonly from: number;
3
- readonly to: number;
4
- readonly currentPage: number;
5
- readonly lastPage: number;
6
- readonly perPage: number;
7
- readonly total: number;
8
- constructor(from: number, to: number, currentPage: number, lastPage: number, perPage: number, total: number);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-spacy/pagination",
3
- "version": "1.0.9",
3
+ "version": "1.0.12",
4
4
  "description": "A pagination library for NestJS",
5
5
  "license": "X SPACY LICENSE AGREEMENT",
6
6
  "private": false,
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,