@x-spacy/pagination 1.0.11 → 1.0.13

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,4 +1,4 @@
1
- export declare enum PaginationLinkType {
1
+ export declare enum PaginationLinkTypeEnum {
2
2
  FIRST = 'FIRST',
3
3
  LAST = 'LAST',
4
4
  PREVIOUS = 'PREVIOUS',
package/@types/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
- /// <reference path="./enums/PaginationLinkType.d.ts" />
2
- /// <reference path="./interceptors/PaginationInterceptor.d.ts" />
3
- /// <reference path="./operators/paginate.d.ts" />
4
- /// <reference path="./schemas/PaginatedResponse.d.ts" />
5
- /// <reference path="./schemas/PaginationLink.d.ts" />
6
- /// <reference path="./schemas/PaginationMeta.d.ts" />
1
+ export * from './enums/PaginationLinkTypeEnum.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';
package/README.md CHANGED
@@ -186,7 +186,7 @@ NestJS interceptor that transforms a `Page<T>` into a complete paginated respons
186
186
 
187
187
  ```typescript
188
188
  // Enums
189
- export { PaginationLinkType } from '@x-spacy/pagination';
189
+ export { PaginationLinkTypeEnum } from '@x-spacy/pagination';
190
190
 
191
191
  // Interceptors
192
192
  export { PaginateInterceptor } from '@x-spacy/pagination';
@@ -195,15 +195,15 @@ export { PaginateInterceptor } from '@x-spacy/pagination';
195
195
  export { paginate } from '@x-spacy/pagination';
196
196
  ```
197
197
 
198
- ### `PaginationLinkType`
198
+ ### `PaginationLinkTypeEnum`
199
199
 
200
200
  Enum that defines the types of navigation links:
201
201
 
202
202
  ```typescript
203
- enum PaginationLinkType {
203
+ enum PaginationLinkTypeEnum {
204
204
  FIRST = 'FIRST',
205
205
  LAST = 'LAST',
206
- PREV = 'PREVIOUS',
206
+ PREVIOUS = 'PREVIOUS',
207
207
  NEXT = 'NEXT',
208
208
  PAGE = 'PAGE'
209
209
  }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaginationLinkTypeEnum = void 0;
4
+ var PaginationLinkTypeEnum;
5
+ (function (PaginationLinkTypeEnum) {
6
+ PaginationLinkTypeEnum["FIRST"] = "FIRST";
7
+ PaginationLinkTypeEnum["LAST"] = "LAST";
8
+ PaginationLinkTypeEnum["PREVIOUS"] = "PREVIOUS";
9
+ PaginationLinkTypeEnum["NEXT"] = "NEXT";
10
+ PaginationLinkTypeEnum["PAGE"] = "PAGE";
11
+ })(PaginationLinkTypeEnum || (exports.PaginationLinkTypeEnum = PaginationLinkTypeEnum = {}));
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enums/PaginationLinkTypeEnum"), exports);
17
18
  __exportStar(require("./interceptors/PaginationInterceptor"), exports);
18
19
  __exportStar(require("./operators/paginate"), exports);
19
20
  __exportStar(require("./schemas/Page"), exports);
@@ -13,7 +13,7 @@ const Page_1 = require("../schemas/Page");
13
13
  const PaginatedResponse_1 = require("../schemas/PaginatedResponse");
14
14
  const PaginationLink_1 = require("../schemas/PaginationLink");
15
15
  const PaginationMeta_1 = require("../schemas/PaginationMeta");
16
- const PaginationLinkType_1 = require("../enums/PaginationLinkType");
16
+ const PaginationLinkTypeEnum_1 = require("../enums/PaginationLinkTypeEnum");
17
17
  let PaginateInterceptor = class PaginateInterceptor {
18
18
  intercept(context, next) {
19
19
  const request = context.switchToHttp().getRequest();
@@ -38,11 +38,11 @@ let PaginateInterceptor = class PaginateInterceptor {
38
38
  }
39
39
  buildLinks(currentPage, lastPage, buildUrl) {
40
40
  const links = new Array();
41
- links.push(new PaginationLink_1.PaginationLink(currentPage > 1 ? buildUrl(currentPage - 1) : null, '&laquo; Anterior', PaginationLinkType_1.PaginationLinkType.PREVIOUS, false));
41
+ links.push(new PaginationLink_1.PaginationLink(currentPage > 1 ? buildUrl(currentPage - 1) : null, '&laquo; Previous', PaginationLinkTypeEnum_1.PaginationLinkTypeEnum.PREVIOUS, false));
42
42
  for (let i = 1; i <= lastPage; i++) {
43
- links.push(new PaginationLink_1.PaginationLink(buildUrl(i), String(i), PaginationLinkType_1.PaginationLinkType.PAGE, i === currentPage));
43
+ links.push(new PaginationLink_1.PaginationLink(buildUrl(i), String(i), PaginationLinkTypeEnum_1.PaginationLinkTypeEnum.PAGE, i === currentPage));
44
44
  }
45
- links.push(new PaginationLink_1.PaginationLink(currentPage < lastPage ? buildUrl(currentPage + 1) : null, 'Próximo &raquo;', PaginationLinkType_1.PaginationLinkType.NEXT, false));
45
+ links.push(new PaginationLink_1.PaginationLink(currentPage < lastPage ? buildUrl(currentPage + 1) : null, 'Next &raquo;', PaginationLinkTypeEnum_1.PaginationLinkTypeEnum.NEXT, false));
46
46
  return links;
47
47
  }
48
48
  };
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PaginatedResponse = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
+ const PaginationLink_1 = require("./PaginationLink");
14
15
  const PaginationMeta_1 = require("./PaginationMeta");
15
16
  class PaginatedResponse {
16
17
  items;
@@ -39,6 +40,7 @@ __decorate([
39
40
  ], PaginatedResponse.prototype, "items", void 0);
40
41
  __decorate([
41
42
  (0, class_transformer_1.Expose)({ name: 'meta' }),
43
+ (0, class_transformer_1.Type)(() => PaginationMeta_1.PaginationMeta),
42
44
  __metadata("design:type", PaginationMeta_1.PaginationMeta)
43
45
  ], PaginatedResponse.prototype, "meta", void 0);
44
46
  __decorate([
@@ -63,5 +65,6 @@ __decorate([
63
65
  ], PaginatedResponse.prototype, "lastPageURL", void 0);
64
66
  __decorate([
65
67
  (0, class_transformer_1.Expose)({ name: 'links' }),
68
+ (0, class_transformer_1.Type)(() => PaginationLink_1.PaginationLink),
66
69
  __metadata("design:type", Array)
67
70
  ], PaginatedResponse.prototype, "links", void 0);
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PaginationLink = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
- const PaginationLinkType_1 = require("../enums/PaginationLinkType");
14
+ const PaginationLinkTypeEnum_1 = require("../enums/PaginationLinkTypeEnum");
15
15
  class PaginationLink {
16
16
  url;
17
17
  label;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@x-spacy/pagination",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "A pagination library for NestJS",
5
- "license": "X SPACY LICENSE AGREEMENT",
5
+ "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.js",
8
8
  "types": "@types/index.d.ts",
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaginationLinkType = void 0;
4
- var PaginationLinkType;
5
- (function (PaginationLinkType) {
6
- PaginationLinkType["FIRST"] = "FIRST";
7
- PaginationLinkType["LAST"] = "LAST";
8
- PaginationLinkType["PREVIOUS"] = "PREVIOUS";
9
- PaginationLinkType["NEXT"] = "NEXT";
10
- PaginationLinkType["PAGE"] = "PAGE";
11
- })(PaginationLinkType || (exports.PaginationLinkType = PaginationLinkType = {}));