@zola_do/crud 0.2.16 → 0.2.17

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/README.md CHANGED
@@ -752,8 +752,25 @@ import {
752
752
  } from '@zola_do/crud';
753
753
  ```
754
754
 
755
+ ## Supply chain / Socket.dev
756
+
757
+ Dependency Alerts on npm reflect **NestJS, Express, TypeORM, and authorization transitives**, not malware in `@zola_do/crud` source. Use subpath imports (`./optional/swagger`, `./optional/rpc`) where possible to keep optional peer trees smaller.
758
+
759
+ See [docs/SUPPLY_CHAIN.md](../../docs/SUPPLY_CHAIN.md) for per-alert triage.
760
+
755
761
  ## Optional Features
756
762
 
763
+ ### Swagger OpenAPI helpers
764
+
765
+ Paginated response decorators and data response DTOs require `@nestjs/swagger`:
766
+
767
+ ```typescript
768
+ import {
769
+ ApiPaginatedResponse,
770
+ DataResponseFormat,
771
+ } from '@zola_do/crud/optional/swagger';
772
+ ```
773
+
757
774
  ### RPC Exception Filter
758
775
 
759
776
  For NestJS microservices:
@@ -8,7 +8,7 @@ const ApiPaginatedResponse = (model) => {
8
8
  return (0, common_1.applyDecorators)((0, swagger_1.ApiOkResponse)({
9
9
  schema: {
10
10
  allOf: [
11
- { $ref: (0, swagger_1.getSchemaPath)(data_response_format_1.DataResponseFormat) },
11
+ { $ref: (0, swagger_1.getSchemaPath)(data_response_format_1.DataResponseFormatSwagger) },
12
12
  {
13
13
  properties: {
14
14
  total: {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-paginated-response.js","sourceRoot":"","sources":["../../../src/optional/swagger/api-paginated-response.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AACvD,6CAA+D;AAC/D,iEAAmE;AAE5D,MAAM,oBAAoB,GAAG,CAClC,KAAa,EACb,EAAE;IACF,OAAO,IAAA,wBAAe,EACpB,IAAA,uBAAa,EAAC;QACZ,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,gDAAyB,CAAC,EAAE;gBAClD;oBACE,UAAU,EAAE;wBACV,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;yBACf;wBACD,KAAK,EAAE;4BACL,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,KAAK,CAAC,EAAE;yBACtC;wBACD,UAAU,EAAE;4BACV,IAAI,EAAE,QAAQ;4BACd,QAAQ,EAAE,IAAI;yBACf;wBACD,UAAU,EAAE;4BACV,IAAI,EAAE,QAAQ;4BACd,QAAQ,EAAE,IAAI;yBACf;wBACD,WAAW,EAAE;4BACX,IAAI,EAAE,SAAS;4BACf,QAAQ,EAAE,IAAI;yBACf;wBACD,EAAE,EAAE;4BACF,IAAI,EAAE,QAAQ;4BACd,QAAQ,EAAE,IAAI;yBACf;wBACD,EAAE,EAAE;4BACF,IAAI,EAAE,QAAQ;4BACd,QAAQ,EAAE,IAAI;yBACf;wBACD,EAAE,EAAE;4BACF,IAAI,EAAE,SAAS;4BACf,QAAQ,EAAE,IAAI;yBACf;qBACF;iBACF;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,oBAAoB,wBA+C/B"}
@@ -0,0 +1,11 @@
1
+ export declare class DataResponseFormatSwagger<T> {
2
+ total: number;
3
+ items: T[];
4
+ nextCursor?: string;
5
+ prevCursor?: string;
6
+ hasNextPage?: boolean;
7
+ nc?: string;
8
+ pc?: string;
9
+ hn?: boolean;
10
+ }
11
+ export { DataResponseFormatSwagger as DataResponseFormatDto };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DataResponseFormatDto = exports.DataResponseFormatSwagger = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ class DataResponseFormatSwagger {
15
+ }
16
+ exports.DataResponseFormatSwagger = DataResponseFormatSwagger;
17
+ exports.DataResponseFormatDto = DataResponseFormatSwagger;
18
+ __decorate([
19
+ (0, swagger_1.ApiProperty)(),
20
+ __metadata("design:type", Number)
21
+ ], DataResponseFormatSwagger.prototype, "total", void 0);
22
+ __decorate([
23
+ (0, swagger_1.ApiProperty)({ isArray: true }),
24
+ __metadata("design:type", Array)
25
+ ], DataResponseFormatSwagger.prototype, "items", void 0);
26
+ __decorate([
27
+ (0, swagger_1.ApiProperty)({ required: false }),
28
+ __metadata("design:type", String)
29
+ ], DataResponseFormatSwagger.prototype, "nextCursor", void 0);
30
+ __decorate([
31
+ (0, swagger_1.ApiProperty)({ required: false }),
32
+ __metadata("design:type", String)
33
+ ], DataResponseFormatSwagger.prototype, "prevCursor", void 0);
34
+ __decorate([
35
+ (0, swagger_1.ApiProperty)({ required: false }),
36
+ __metadata("design:type", Boolean)
37
+ ], DataResponseFormatSwagger.prototype, "hasNextPage", void 0);
38
+ __decorate([
39
+ (0, swagger_1.ApiProperty)({ required: false }),
40
+ __metadata("design:type", String)
41
+ ], DataResponseFormatSwagger.prototype, "nc", void 0);
42
+ __decorate([
43
+ (0, swagger_1.ApiProperty)({ required: false }),
44
+ __metadata("design:type", String)
45
+ ], DataResponseFormatSwagger.prototype, "pc", void 0);
46
+ __decorate([
47
+ (0, swagger_1.ApiProperty)({ required: false }),
48
+ __metadata("design:type", Boolean)
49
+ ], DataResponseFormatSwagger.prototype, "hn", void 0);
50
+ //# sourceMappingURL=data-response-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-response-format.js","sourceRoot":"","sources":["../../../src/optional/swagger/data-response-format.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAE9C,MAAa,yBAAyB;CAwBrC;AAxBD,8DAwBC;AAGqC,0DAAqB;AAzBzD;IADC,IAAA,qBAAW,GAAE;;wDACC;AAGf;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;wDACnB;AAGZ;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;6DACb;AAGpB;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;6DACb;AAGpB;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;8DACX;AAGtB;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;qDACrB;AAGZ;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;qDACrB;AAGZ;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;qDACpB"}
@@ -0,0 +1,2 @@
1
+ export * from './swagger/api-paginated-response';
2
+ export * from './swagger/data-response-format';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./swagger/api-paginated-response"), exports);
18
+ __exportStar(require("./swagger/data-response-format"), exports);
19
+ //# sourceMappingURL=swagger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../src/optional/swagger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,iEAA+C"}
@@ -1,49 +1,7 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.DataResponseFormat = void 0;
13
- const swagger_1 = require("@nestjs/swagger");
14
4
  class DataResponseFormat {
15
5
  }
16
6
  exports.DataResponseFormat = DataResponseFormat;
17
- __decorate([
18
- (0, swagger_1.ApiProperty)(),
19
- __metadata("design:type", Number)
20
- ], DataResponseFormat.prototype, "total", void 0);
21
- __decorate([
22
- (0, swagger_1.ApiProperty)({ isArray: true }),
23
- __metadata("design:type", Array)
24
- ], DataResponseFormat.prototype, "items", void 0);
25
- __decorate([
26
- (0, swagger_1.ApiProperty)({ required: false }),
27
- __metadata("design:type", String)
28
- ], DataResponseFormat.prototype, "nextCursor", void 0);
29
- __decorate([
30
- (0, swagger_1.ApiProperty)({ required: false }),
31
- __metadata("design:type", String)
32
- ], DataResponseFormat.prototype, "prevCursor", void 0);
33
- __decorate([
34
- (0, swagger_1.ApiProperty)({ required: false }),
35
- __metadata("design:type", Boolean)
36
- ], DataResponseFormat.prototype, "hasNextPage", void 0);
37
- __decorate([
38
- (0, swagger_1.ApiProperty)({ required: false }),
39
- __metadata("design:type", String)
40
- ], DataResponseFormat.prototype, "nc", void 0);
41
- __decorate([
42
- (0, swagger_1.ApiProperty)({ required: false }),
43
- __metadata("design:type", String)
44
- ], DataResponseFormat.prototype, "pc", void 0);
45
- __decorate([
46
- (0, swagger_1.ApiProperty)({ required: false }),
47
- __metadata("design:type", Boolean)
48
- ], DataResponseFormat.prototype, "hn", void 0);
49
7
  //# sourceMappingURL=data-response-format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-response-format.js","sourceRoot":"","sources":["../../../src/shared/api-data/data-response-format.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAE9C,MAAa,kBAAkB;CAiB9B;AAjBD,gDAiBC;AAfC;IADC,IAAA,qBAAW,GAAE;;iDACC;AAEf;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACnB;AAEZ;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;sDACb;AAEpB;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;sDACb;AAEpB;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;uDACX;AAEtB;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;8CACrB;AAEZ;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;8CACrB;AAEZ;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;8CACpB"}
1
+ {"version":3,"file":"data-response-format.js","sourceRoot":"","sources":["../../../src/shared/api-data/data-response-format.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;CAS9B;AATD,gDASC"}
@@ -1,2 +1 @@
1
- export * from './api-paginated-response';
2
1
  export * from './data-response-format';
@@ -14,6 +14,5 @@ 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("./api-paginated-response"), exports);
18
17
  __exportStar(require("./data-response-format"), exports);
19
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/api-data/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/api-data/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zola_do/crud",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "Generic CRUD controllers and services for NestJS",
5
5
  "author": "zolaDO",
6
6
  "license": "ISC",
@@ -43,6 +43,11 @@
43
43
  "types": "./dist/optional/rpc.d.ts",
44
44
  "require": "./dist/optional/rpc.js",
45
45
  "default": "./dist/optional/rpc.js"
46
+ },
47
+ "./optional/swagger": {
48
+ "types": "./dist/optional/swagger.d.ts",
49
+ "require": "./dist/optional/swagger.js",
50
+ "default": "./dist/optional/swagger.js"
46
51
  }
47
52
  },
48
53
  "files": [
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-paginated-response.js","sourceRoot":"","sources":["../../../src/shared/api-data/api-paginated-response.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AACvD,6CAA+D;AAC/D,iEAA4D;AACrD,MAAM,oBAAoB,GAAG,CAClC,KAAa,EACb,EAAE;IACF,OAAO,IAAA,wBAAe,EACpB,IAAA,uBAAa,EAAC;QACZ,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,yCAAkB,CAAC,EAAE;gBAC3C;oBACE,UAAU,EAAE;wBACV,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;yBACf;wBACD,KAAK,EAAE;4BACL,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,KAAK,CAAC,EAAE;yBACtC;wBACD,UAAU,EAAE;4BACV,IAAI,EAAE,QAAQ;4BACd,QAAQ,EAAE,IAAI;yBACf;wBACD,UAAU,EAAE;4BACV,IAAI,EAAE,QAAQ;4BACd,QAAQ,EAAE,IAAI;yBACf;wBACD,WAAW,EAAE;4BACX,IAAI,EAAE,SAAS;4BACf,QAAQ,EAAE,IAAI;yBACf;wBACD,EAAE,EAAE;4BACF,IAAI,EAAE,QAAQ;4BACd,QAAQ,EAAE,IAAI;yBACf;wBACD,EAAE,EAAE;4BACF,IAAI,EAAE,QAAQ;4BACd,QAAQ,EAAE,IAAI;yBACf;wBACD,EAAE,EAAE;4BACF,IAAI,EAAE,SAAS;4BACf,QAAQ,EAAE,IAAI;yBACf;qBACF;iBACF;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,oBAAoB,wBA+C/B"}