fiscalia_bo-nest-helpers 1.5.2 → 1.5.3

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,3 +1,4 @@
1
+ import { Type } from '@nestjs/common';
1
2
  export declare const VersionDescription: (version: string, summary: string, permissions?: string[]) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
3
  export declare const ApiBodyDto: (dto: any) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
3
4
  export declare const MsRedisCache: (cacheOptions?: {
@@ -10,3 +11,9 @@ export declare const MsRedisCache: (cacheOptions?: {
10
11
  responseHttp?: boolean;
11
12
  db?: number;
12
13
  }) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
14
+ export declare const DtoResponse: (options?: {
15
+ success?: Type<unknown>;
16
+ error?: Type<unknown>;
17
+ successStatus?: number[];
18
+ errorStatus?: number[];
19
+ }) => MethodDecorator;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MsRedisCache = exports.ApiBodyDto = exports.VersionDescription = void 0;
3
+ exports.DtoResponse = exports.MsRedisCache = exports.ApiBodyDto = exports.VersionDescription = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const swagger_1 = require("@nestjs/swagger");
6
6
  const datapass_interceptor_1 = require("../modules/ms-redis/datapass.interceptor");
@@ -35,4 +35,30 @@ const MsRedisCache = (cacheOptions = { ttl: 86400, responseHttp: false, hideSwag
35
35
  return (0, common_1.applyDecorators)(...decorators);
36
36
  };
37
37
  exports.MsRedisCache = MsRedisCache;
38
+ const DtoResponse = (options) => {
39
+ var _a, _b;
40
+ const decorators = [];
41
+ if (((_a = options.successStatus) === null || _a === void 0 ? void 0 : _a.length) > 0)
42
+ options.successStatus.forEach((status) => {
43
+ decorators.push((0, swagger_1.ApiResponse)({ type: options.success, status }));
44
+ });
45
+ else {
46
+ if (options.success) {
47
+ decorators.push((0, swagger_1.ApiResponse)({ type: options.success, status: 200 }));
48
+ decorators.push((0, swagger_1.ApiResponse)({ type: options.success, status: 201 }));
49
+ }
50
+ }
51
+ if (((_b = options.errorStatus) === null || _b === void 0 ? void 0 : _b.length) > 0) {
52
+ options.errorStatus.forEach((status) => {
53
+ decorators.push((0, swagger_1.ApiResponse)({ type: options.error, status }));
54
+ });
55
+ }
56
+ else {
57
+ if (options.error) {
58
+ decorators.push((0, swagger_1.ApiResponse)({ type: options.error }));
59
+ }
60
+ }
61
+ return (0, common_1.applyDecorators)(...decorators);
62
+ };
63
+ exports.DtoResponse = DtoResponse;
38
64
  //# sourceMappingURL=controller.decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.decorator.js","sourceRoot":"","sources":["../../src/decorators/controller.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwF;AACxF,6CAA+E;AAC/E,mFAAgF;AAChF,kDAAyD;AAEzD,MAAM,4BAA4B,GAAG,CAAC,OAAe,EAAE,cAAwB,EAAE,EAAE,EAAE,CAAC,CAAC;IACrF,OAAO;IACP,WAAW,EACT,WAAW,CAAC,MAAM,GAAG,CAAC;QACpB,CAAC,CAAC;;EAEN,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;MAC1C;QACA,CAAC,CAAC,EAAE;CACT,CAAC,CAAC;AAEI,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAE,WAAsB,EAAE,EAAE;IAC7F,OAAO,IAAA,wBAAe,EACpB,IAAA,gBAAO,EAAC,OAAO,CAAC,EAChB,IAAA,sBAAY,EAAC,4BAA4B,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CACjE,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,kBAAkB,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AACxC,CAAC,CAAC;AA7BW,QAAA,WAAW,eA6BtB"}
@@ -1,4 +1,4 @@
1
1
  export { MsPersonasService } from './ms-personas.service';
2
2
  export { MsPersonasModule } from './ms-personas.module';
3
- export * as ResponseDtos from './dto/ms-persona.res';
4
- export * as InputDtos from './dto/ms-persona.input';
3
+ export * from './dto/ms-persona.res';
4
+ export * from './dto/ms-persona.input';
@@ -1,10 +1,24 @@
1
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
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InputDtos = exports.ResponseDtos = exports.MsPersonasModule = exports.MsPersonasService = void 0;
17
+ exports.MsPersonasModule = exports.MsPersonasService = void 0;
4
18
  var ms_personas_service_1 = require("./ms-personas.service");
5
19
  Object.defineProperty(exports, "MsPersonasService", { enumerable: true, get: function () { return ms_personas_service_1.MsPersonasService; } });
6
20
  var ms_personas_module_1 = require("./ms-personas.module");
7
21
  Object.defineProperty(exports, "MsPersonasModule", { enumerable: true, get: function () { return ms_personas_module_1.MsPersonasModule; } });
8
- exports.ResponseDtos = require("./dto/ms-persona.res");
9
- exports.InputDtos = require("./dto/ms-persona.input");
22
+ __exportStar(require("./dto/ms-persona.res"), exports);
23
+ __exportStar(require("./dto/ms-persona.input"), exports);
10
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/ms-personas/index.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,uDAAqD;AACrD,sDAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/ms-personas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,uDAAqC;AACrC,yDAAuC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiscalia_bo-nest-helpers",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Helpers y servicios para NestJS",
5
5
  "author": "DNTIC - Ministerio Público",
6
6
  "contact": {