fiscalia_bo-nest-helpers 0.1.10 → 0.1.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.
Files changed (36) hide show
  1. package/dist/custom-validators/index.d.ts +3 -0
  2. package/dist/custom-validators/index.js +7 -0
  3. package/dist/custom-validators/index.js.map +1 -0
  4. package/dist/custom-validators/regular-expressions.d.ts +20 -0
  5. package/dist/custom-validators/regular-expressions.js +24 -0
  6. package/dist/custom-validators/regular-expressions.js.map +1 -0
  7. package/dist/custom-validators/validator.functions.d.ts +1 -0
  8. package/dist/custom-validators/validator.functions.js +38 -0
  9. package/dist/custom-validators/validator.functions.js.map +1 -0
  10. package/dist/custom-validators/validator.sms.d.ts +26 -0
  11. package/dist/custom-validators/validator.sms.js +105 -0
  12. package/dist/custom-validators/validator.sms.js.map +1 -0
  13. package/dist/decorators/controller.decorator.d.ts +10 -0
  14. package/dist/decorators/controller.decorator.js +33 -0
  15. package/dist/decorators/controller.decorator.js.map +1 -0
  16. package/dist/decorators/dto.decorators.d.ts +3 -0
  17. package/dist/decorators/dto.decorators.js +10 -0
  18. package/dist/decorators/dto.decorators.js.map +1 -0
  19. package/dist/decorators/index.d.ts +3 -0
  20. package/dist/decorators/index.js +7 -0
  21. package/dist/decorators/index.js.map +1 -0
  22. package/dist/decorators/validator.decorators.d.ts +54 -0
  23. package/dist/decorators/validator.decorators.js +205 -0
  24. package/dist/decorators/validator.decorators.js.map +1 -0
  25. package/dist/dto/filter.dto.d.ts +30 -0
  26. package/dist/dto/filter.dto.js +244 -0
  27. package/dist/dto/filter.dto.js.map +1 -0
  28. package/dist/dto/index.d.ts +2 -0
  29. package/dist/dto/index.js +6 -0
  30. package/dist/dto/index.js.map +1 -0
  31. package/dist/dto/response.dto.d.ts +44 -0
  32. package/dist/dto/response.dto.js +52 -0
  33. package/dist/dto/response.dto.js.map +1 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.js +4 -1
  36. package/package.json +4 -1
@@ -0,0 +1,3 @@
1
+ export * as RegExpValidators from './regular-expressions';
2
+ export * as ValidatorFuntions from './validator.functions';
3
+ export * as SmsValidators from './/validator.sms';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmsValidators = exports.ValidatorFuntions = exports.RegExpValidators = void 0;
4
+ exports.RegExpValidators = require("./regular-expressions");
5
+ exports.ValidatorFuntions = require("./validator.functions");
6
+ exports.SmsValidators = require(".//validator.sms");
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/custom-validators/index.ts"],"names":[],"mappings":";;;AAAA,4DAA0D;AAC1D,6DAA2D;AAC3D,oDAAkD"}
@@ -0,0 +1,20 @@
1
+ export declare const nombre_usuario_nose: RegExp;
2
+ export declare const nombre: RegExp;
3
+ export declare const nombre_cargo: RegExp;
4
+ export declare const descripcion: RegExp;
5
+ export declare const just_words: RegExp;
6
+ export declare const telf_cel: RegExp;
7
+ export declare const dni: RegExp;
8
+ export declare const findByDni: RegExp;
9
+ export declare const enlace: RegExp;
10
+ export declare const abreviatura: RegExp;
11
+ export declare const sigla: RegExp;
12
+ export declare const usernameRegex: RegExp;
13
+ export declare const passwordRegex: RegExp;
14
+ export declare const url: RegExp;
15
+ export declare const bankAccount: RegExp;
16
+ export declare const billingNumberRegExp: RegExp;
17
+ export declare const nroCuotasRegExp: RegExp;
18
+ export declare const nro_nit: RegExp;
19
+ export declare const exp_email: RegExp;
20
+ export declare const dateRegexWithBar: RegExp;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dateRegexWithBar = exports.exp_email = exports.nro_nit = exports.nroCuotasRegExp = exports.billingNumberRegExp = exports.bankAccount = exports.url = exports.passwordRegex = exports.usernameRegex = exports.sigla = exports.abreviatura = exports.enlace = exports.findByDni = exports.dni = exports.telf_cel = exports.just_words = exports.descripcion = exports.nombre_cargo = exports.nombre = exports.nombre_usuario_nose = void 0;
4
+ exports.nombre_usuario_nose = /^[a-zñáéíóú]{2}(\s[a-zñáéíóú]{2})*$/;
5
+ exports.nombre = /^[A-ZÁÉÍÓÚÑa-zñáéíóú][A-ZÁÉÍÓÚÑa-zñáéíóú ']+(\s[A-ZÁÉÍÓÚÑa-zñáéíóú][A-ZÁÉÍÓÚÑa-zñáéíóú ']+)*$/;
6
+ exports.nombre_cargo = /^[A-ZÁÉÍÓÚÑa-zñáéíóú][A-ZÁÉÍÓÚÑa-zñáéíóú]+(\s[A-ZÁÉÍÓÚÑa-zñáéíóú][A-ZÁÉÍÓÚÑa-zñáéíóú]*)*$/;
7
+ exports.descripcion = /^([a-zñáéíóúA-ZÁÉÍÓÚÑ 0-9])([a-zñáéíóúA-ZÁÉÍÓÚÑ 0-9 % # ° / : , ' " “ ” \- . _ & ()]+)$/;
8
+ exports.just_words = /^[A-ZÁÉÍÓÚÑa-zñáéíóú]+$/;
9
+ exports.telf_cel = /^[1-9][0-9]+$/;
10
+ exports.dni = /^[1-9]\d{4,14}(\-([A-Z0-9]{1,2}))?$/;
11
+ exports.findByDni = /^[1-9]\d{3,14}(\-([A-Z0-9]{1,2}))?$/;
12
+ exports.enlace = /^[A-ZÁÉÍÓÚÑa-zñáéíóú]+$/;
13
+ exports.abreviatura = /^[A-ZÁÉÍÓÚÑa-zñáéíóú][A-ZÁÉÍÓÚÑa-zñáéíóú.-]+(\s[A-ZÁÉÍÓÚÑa-zñáéíóú][A-ZÁÉÍÓÚÑa-zñáéíóú.]*)*$/;
14
+ exports.sigla = /^[A-ZÁÉÍÓÚÑa-zñáéíóú0-9][A-ZÁÉÍÓÚÑa-zñáéíóú0-9.-]+(\s[A-ZÁÉÍÓÚÑa-zñáéíóú0-9][A-ZÁÉÍÓÚÑa-zñáéíóú0-9.]*)*$/;
15
+ exports.usernameRegex = /^[a-zñáéíóúA-ZÁÉÍÓÚÑ0-9\-]+$/;
16
+ exports.passwordRegex = /^[a-zñáéíóúA-ZÁÉÍÓÚÑ0-9%#:,\-.(){[\]}]+$/;
17
+ exports.url = /[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/;
18
+ exports.bankAccount = /^[0-9]{7,20}$/g;
19
+ exports.billingNumberRegExp = /^[0-9]{4,20}$/g;
20
+ exports.nroCuotasRegExp = /^[1-9][0-9]*([,][1-9][0-9]*)*$/;
21
+ exports.nro_nit = /^[0-9]+$/;
22
+ exports.exp_email = /^(([^<>()\[\]\\.,;:\s@”]+(\.[^<>()\[\]\\.,;:\s@”]+)*)|(“.+”))@((\[[0–9]{1,3}\.[0–9]{1,3}\.[0–9]{1,3}\.[0–9]{1,3}])|(([a-zA-Z\-0–9]+\.)+[a-zA-Z]{2,}))$/;
23
+ exports.dateRegexWithBar = /^\d{2}\/\d{2}\/\d{4}\?*$/;
24
+ //# sourceMappingURL=regular-expressions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regular-expressions.js","sourceRoot":"","sources":["../../src/custom-validators/regular-expressions.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG,qCAAqC,CAAC;AAC5D,QAAA,MAAM,GACjB,+FAA+F,CAAC;AACrF,QAAA,YAAY,GACvB,2FAA2F,CAAC;AAEjF,QAAA,WAAW,GACtB,yFAAyF,CAAC;AAC/E,QAAA,UAAU,GAAG,yBAAyB,CAAC;AACvC,QAAA,QAAQ,GAAG,eAAe,CAAC;AAC3B,QAAA,GAAG,GAAG,qCAAqC,CAAC;AAC5C,QAAA,SAAS,GAAG,qCAAqC,CAAC;AAElD,QAAA,MAAM,GAAG,yBAAyB,CAAC;AAEnC,QAAA,WAAW,GACtB,8FAA8F,CAAC;AACpF,QAAA,KAAK,GAChB,0GAA0G,CAAC;AAChG,QAAA,aAAa,GAAG,8BAA8B,CAAC;AAC/C,QAAA,aAAa,GAAG,0CAA0C,CAAC;AAC3D,QAAA,GAAG,GACd,gGAAgG,CAAC;AACtF,QAAA,WAAW,GAAG,gBAAgB,CAAC;AAC/B,QAAA,mBAAmB,GAAG,gBAAgB,CAAC;AACvC,QAAA,eAAe,GAAG,gCAAgC,CAAC;AACnD,QAAA,OAAO,GAAG,UAAU,CAAC;AAErB,QAAA,SAAS,GACpB,wJAAwJ,CAAC;AAE9I,QAAA,gBAAgB,GAAG,0BAA0B,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const paramTypeValidator: (value: string, metaType: any) => any;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.paramTypeValidator = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const class_validator_1 = require("class-validator");
6
+ const MapTypes = {
7
+ string: (str) => str,
8
+ boolean: (str) => {
9
+ if (str === 'true' || str === 'false')
10
+ return str === 'true';
11
+ else
12
+ throw new common_1.HttpException({
13
+ error: true,
14
+ message: 'El parámetro es de tipo boolean',
15
+ response: null,
16
+ status: 400,
17
+ }, 400);
18
+ },
19
+ number: (str) => {
20
+ if ((0, class_validator_1.isNumber)(Number(str), { allowInfinity: false, allowNaN: false }))
21
+ return Number(str);
22
+ else
23
+ throw new common_1.HttpException({
24
+ error: true,
25
+ message: 'El parámetro es de tipo entero',
26
+ response: null,
27
+ status: 400,
28
+ }, 400);
29
+ },
30
+ object: (value) => {
31
+ return value;
32
+ },
33
+ };
34
+ const paramTypeValidator = (value, metaType) => {
35
+ return MapTypes[typeof metaType()](value);
36
+ };
37
+ exports.paramTypeValidator = paramTypeValidator;
38
+ //# sourceMappingURL=validator.functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.functions.js","sourceRoot":"","sources":["../../src/custom-validators/validator.functions.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qDAA2C;AAC3C,MAAM,QAAQ,GAAG;IACf,MAAM,EAAE,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG;IACpC,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE;QACvB,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO;YAAE,OAAO,GAAG,KAAK,MAAM,CAAC;;YAE3D,MAAM,IAAI,sBAAa,CACrB;gBACE,KAAK,EAAE,IAAI;gBACX,OAAO,EAAE,iCAAiC;gBAC1C,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,GAAG;aACZ,EACD,GAAG,CACJ,CAAC;IACN,CAAC;IACD,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE;QACtB,IAAI,IAAA,0BAAQ,EAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;;YAEvF,MAAM,IAAI,sBAAa,CACrB;gBACE,KAAK,EAAE,IAAI;gBACX,OAAO,EAAE,gCAAgC;gBACzC,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,GAAG;aACZ,EACD,GAAG,CACJ,CAAC;IACN,CAAC;IACD,MAAM,EAAE,CAAC,KAAU,EAAE,EAAE;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEK,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,QAAa,EAAE,EAAE;IACjE,OAAO,QAAQ,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B"}
@@ -0,0 +1,26 @@
1
+ import { ValidationArguments, ValidationError } from 'class-validator';
2
+ import { ResponseDTO } from 'src/dto/response.dto';
3
+ export declare const smsMin: (field: any) => string;
4
+ export declare const smsMinStr: (field: string) => string;
5
+ export declare const requiredFile: (field: string) => string;
6
+ export declare const smsBase64: (args: ValidationArguments, fieldName?: string) => string;
7
+ export declare const smsArrayNotSelect: (field: string) => string;
8
+ export declare const smsArrayNotEmpty: (field: string) => string;
9
+ export declare const smsEnum: (args: ValidationArguments) => string;
10
+ export declare const smsIsString: (args: ValidationArguments, fieldName?: string) => string;
11
+ export declare const smsIsStringM: (args: ValidationArguments, fieldName?: string) => string;
12
+ export declare const smsIsStringF: (args: ValidationArguments, fieldName?: string) => string;
13
+ export declare const smsIsDate: (args: ValidationArguments, fieldName?: string) => string;
14
+ export declare const smsIsBoolean: (args: ValidationArguments, fieldName?: string) => string;
15
+ export declare const smsNotEmpty: () => string;
16
+ export declare const smsNotEmptyM: (args: ValidationArguments, fieldName?: string) => string;
17
+ export declare const smsNotEmptyF: (args: ValidationArguments, fieldName?: string) => string;
18
+ export declare const smsMinLength: (args: ValidationArguments, fieldName?: string) => string;
19
+ export declare const smsMaxLength: (args: ValidationArguments, fieldName?: string) => string;
20
+ export declare const smsMinInt: (args: ValidationArguments, fieldName?: string) => string;
21
+ export declare const smsMaxInt: (args: ValidationArguments) => string;
22
+ export declare const smsLength: (args: ValidationArguments, fieldName?: string) => string;
23
+ export declare const smsInteger: (args: ValidationArguments, fieldName?: string) => string;
24
+ export declare const smsDateString: (args: ValidationArguments, fieldName?: string) => string;
25
+ export declare const smsDate: (args: ValidationArguments) => string;
26
+ export declare const formatValidationErrorsToResponseDto: <T>(errors: ValidationError[]) => ResponseDTO<T>;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatValidationErrorsToResponseDto = exports.smsDate = exports.smsDateString = exports.smsInteger = exports.smsLength = exports.smsMaxInt = exports.smsMinInt = exports.smsMaxLength = exports.smsMinLength = exports.smsNotEmptyF = exports.smsNotEmptyM = exports.smsNotEmpty = exports.smsIsBoolean = exports.smsIsDate = exports.smsIsStringF = exports.smsIsStringM = exports.smsIsString = exports.smsEnum = exports.smsArrayNotEmpty = exports.smsArrayNotSelect = exports.smsBase64 = exports.requiredFile = exports.smsMinStr = exports.smsMin = void 0;
4
+ const smsMin = (field) => `valor de ${field} no válido`;
5
+ exports.smsMin = smsMin;
6
+ const smsMinStr = (field) => `valor de ${field} no válido`;
7
+ exports.smsMinStr = smsMinStr;
8
+ const requiredFile = (field) => `Debe incluir un ${field}`;
9
+ exports.requiredFile = requiredFile;
10
+ const smsBase64 = (args, fieldName = null) => `${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} debe estar codificado en base64`;
11
+ exports.smsBase64 = smsBase64;
12
+ const smsArrayNotSelect = (field) => `Debe seleccionar al menos ${field}`;
13
+ exports.smsArrayNotSelect = smsArrayNotSelect;
14
+ const smsArrayNotEmpty = (field) => `Debe contener al menos ${field}`;
15
+ exports.smsArrayNotEmpty = smsArrayNotEmpty;
16
+ const smsEnum = (args) => {
17
+ var _a;
18
+ if (Array.isArray(args.constraints)) {
19
+ const arrayData = (_a = args.constraints[1]) === null || _a === void 0 ? void 0 : _a.join(', ');
20
+ return `'$value' no válido para $property, admite solo '${arrayData}'`;
21
+ }
22
+ return `$property no admite el valor '$value'`;
23
+ };
24
+ exports.smsEnum = smsEnum;
25
+ const smsIsString = (args, fieldName = null) => {
26
+ return `El ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} ingresado no es válido. Por favor, ingrese solo texto.`;
27
+ };
28
+ exports.smsIsString = smsIsString;
29
+ const smsIsStringM = (args, fieldName = null) => {
30
+ return `El ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} ingresado no es válido. Por favor, ingrese solo texto.`;
31
+ };
32
+ exports.smsIsStringM = smsIsStringM;
33
+ const smsIsStringF = (args, fieldName = null) => {
34
+ return `La ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} ingresada no es válido. Por favor, ingrese solo texto.`;
35
+ };
36
+ exports.smsIsStringF = smsIsStringF;
37
+ const smsIsDate = (args, fieldName = null) => {
38
+ return `El ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} ingresado no es válido. Por favor, ingrese un formato de fecha valido.`;
39
+ };
40
+ exports.smsIsDate = smsIsDate;
41
+ const smsIsBoolean = (args, fieldName = null) => {
42
+ return `El ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} ingresado no es válido. Por favor, ingrese un valor binario.`;
43
+ };
44
+ exports.smsIsBoolean = smsIsBoolean;
45
+ const smsNotEmpty = () => {
46
+ return `Este campo no puede estar vacío`;
47
+ };
48
+ exports.smsNotEmpty = smsNotEmpty;
49
+ const smsNotEmptyM = (args, fieldName = null) => {
50
+ return `El ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} no puede estar vacío`;
51
+ };
52
+ exports.smsNotEmptyM = smsNotEmptyM;
53
+ const smsNotEmptyF = (args, fieldName = null) => {
54
+ return `La ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} no puede estar vacío`;
55
+ };
56
+ exports.smsNotEmptyF = smsNotEmptyF;
57
+ const smsMinLength = (args, fieldName = null) => {
58
+ return `valor de ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} muy corto, debe ser mayor a ${args.constraints[0]} carácteres`;
59
+ };
60
+ exports.smsMinLength = smsMinLength;
61
+ const smsMaxLength = (args, fieldName = null) => `${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} muy largo, no debe ser mayor a ${args.constraints[0]} carácteres`;
62
+ exports.smsMaxLength = smsMaxLength;
63
+ const smsMinInt = (args, fieldName = null) => `${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} debe ser mayor o igual a ${args.constraints[0]}`;
64
+ exports.smsMinInt = smsMinInt;
65
+ const smsMaxInt = (args) => `$property debe ser menor o igual a ${args.constraints[0]}`;
66
+ exports.smsMaxInt = smsMaxInt;
67
+ const smsLength = (args, fieldName = null) => {
68
+ return `${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} debe tener entre ${args.constraints[0]} y ${args.constraints[1]} caracteres.`;
69
+ };
70
+ exports.smsLength = smsLength;
71
+ const smsInteger = (args, fieldName = null) => {
72
+ return `${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} debe ser un numero`;
73
+ };
74
+ exports.smsInteger = smsInteger;
75
+ const smsDateString = (args, fieldName = null) => {
76
+ return `La fecha de ${fieldName !== null && fieldName !== void 0 ? fieldName : '$property'} no esta formato ISO 8601`;
77
+ };
78
+ exports.smsDateString = smsDateString;
79
+ const smsDate = (args) => {
80
+ var _a;
81
+ return `La propiedad '${(_a = args.constraints[1]) !== null && _a !== void 0 ? _a : '$property'} debe estar en formato ISO (ej. 2001-12-25T04:00:00.000Z ó 2001-12-25T00:00:00.000Z). Por favor, verifique que haya ingresado correctamente.`;
82
+ };
83
+ exports.smsDate = smsDate;
84
+ const formatValidationErrorsToResponseDto = (errors) => {
85
+ const errorSms = errors.reduce((objErrors, err) => {
86
+ if (!!err.children.length) {
87
+ const tempDAta = (0, exports.formatValidationErrorsToResponseDto)(err.children);
88
+ objErrors[err.property] = tempDAta.response.validationErrors;
89
+ }
90
+ else {
91
+ objErrors[err.property] = Object.values(err.constraints);
92
+ }
93
+ return Object.assign({}, objErrors);
94
+ }, {});
95
+ return {
96
+ error: true,
97
+ message: 'hay un error de validación, por favor verifique los datos ingresados',
98
+ response: {
99
+ validationErrors: errorSms,
100
+ },
101
+ status: 406,
102
+ };
103
+ };
104
+ exports.formatValidationErrorsToResponseDto = formatValidationErrorsToResponseDto;
105
+ //# sourceMappingURL=validator.sms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.sms.js","sourceRoot":"","sources":["../../src/custom-validators/validator.sms.ts"],"names":[],"mappings":";;;AAGO,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,KAAK,YAAY,CAAC;AAAnD,QAAA,MAAM,UAA6C;AAEzD,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,aAAa,KAAK,YAAY,CAAC;AAA9D,QAAA,SAAS,aAAqD;AAEpE,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,mBAAmB,KAAK,EAAE,CAAC;AAA7D,QAAA,YAAY,gBAAiD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IAA8I,CAAC;AACjJ,CAAC,CAAC;AAJW,QAAA,OAAO,WAIlB;AAWK,MAAM,mCAAmC,GAAG,CACjD,MAAyB,EACT,EAAE;IAClB,MAAM,QAAQ,GAAqC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE;QAClF,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,MAAM,QAAQ,GAAG,IAAA,2CAAmC,EAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACnE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC;SAC9D;aAAM;YACL,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;SAC1D;QACD,yBAAY,SAAS,EAAG;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,sEAAsE;QAC/E,QAAQ,EAAE;YACR,gBAAgB,EAAE,QAAmC;SACtD;QACD,MAAM,EAAE,GAAG;KACZ,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,mCAAmC,uCAqB9C"}
@@ -0,0 +1,10 @@
1
+ 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
+ export declare const ApiBodyDto: (dto: any) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
3
+ export declare const MsRedisCache: (cacheOptions?: {
4
+ key?: string;
5
+ ttl: number;
6
+ keyResponse?: string;
7
+ useKeyUrl?: boolean;
8
+ ignoreExceptions?: boolean;
9
+ responseHttp?: boolean;
10
+ }) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MsRedisCache = exports.ApiBodyDto = exports.VersionDescription = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const swagger_1 = require("@nestjs/swagger");
6
+ const datapass_interceptor_1 = require("../ms-redis/datapass.interceptor");
7
+ const filter_dto_1 = require("../dto/filter.dto");
8
+ const genCustomApiOperationContent = (summary, permissions = []) => ({
9
+ summary,
10
+ description: permissions.length > 0
11
+ ? `permisos requeridos:
12
+ <ul>
13
+ ${permissions.map((p) => `<li><b>${p}</b></li>`)}
14
+ </ul>`
15
+ : '',
16
+ });
17
+ const VersionDescription = (version, summary, permissions) => {
18
+ return (0, common_1.applyDecorators)((0, common_1.Version)(version), (0, swagger_1.ApiOperation)(genCustomApiOperationContent(summary, permissions)));
19
+ };
20
+ exports.VersionDescription = VersionDescription;
21
+ const ApiBodyDto = (dto) => {
22
+ return (0, common_1.applyDecorators)((0, swagger_1.ApiBody)({ type: dto }), (0, swagger_1.ApiConsumes)('application/json'));
23
+ };
24
+ exports.ApiBodyDto = ApiBodyDto;
25
+ const MsRedisCache = (cacheOptions = { ttl: 86400, responseHttp: false }) => {
26
+ var _a;
27
+ const responseHttp = (_a = cacheOptions.responseHttp) !== null && _a !== void 0 ? _a : false;
28
+ return (0, common_1.applyDecorators)((0, common_1.SetMetadata)('data-cache', Object.assign(Object.assign({}, cacheOptions), { responseHttp })), (0, swagger_1.ApiQuery)({
29
+ type: () => filter_dto_1.QueryMsRedisCacheDto,
30
+ }), (0, common_1.UseInterceptors)(datapass_interceptor_1.DatapassInterceptor));
31
+ };
32
+ exports.MsRedisCache = MsRedisCache;
33
+ //# sourceMappingURL=controller.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.decorator.js","sourceRoot":"","sources":["../../src/decorators/controller.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwF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CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB"}
@@ -0,0 +1,3 @@
1
+ import { ClassTransformOptions } from '@nestjs/common/interfaces/external/class-transform-options.interface';
2
+ export declare const DTO_PIPE_PLAIN_TO_CLASS_OPTIONS = "dto-pipe-class-transform-options";
3
+ export declare const DtoPipePlainToClassOptions: (plainToClassOptions?: ClassTransformOptions) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DtoPipePlainToClassOptions = exports.DTO_PIPE_PLAIN_TO_CLASS_OPTIONS = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ exports.DTO_PIPE_PLAIN_TO_CLASS_OPTIONS = 'dto-pipe-class-transform-options';
6
+ const DtoPipePlainToClassOptions = (plainToClassOptions = {}) => {
7
+ return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(exports.DTO_PIPE_PLAIN_TO_CLASS_OPTIONS, plainToClassOptions));
8
+ };
9
+ exports.DtoPipePlainToClassOptions = DtoPipePlainToClassOptions;
10
+ //# sourceMappingURL=dto.decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.decorators.js","sourceRoot":"","sources":["../../src/decorators/dto.decorators.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAGjD,QAAA,+BAA+B,GAAG,kCAAkC,CAAC;AAE3E,MAAM,0BAA0B,GAAG,CAAC,sBAA6C,EAAE,EAAE,EAAE;IAC5F,OAAO,IAAA,wBAAe,EAAC,IAAA,oBAAW,EAAC,uCAA+B,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAC5F,CAAC,CAAC;AAFW,QAAA,0BAA0B,8BAErC"}
@@ -0,0 +1,3 @@
1
+ export * as ControllerDecorators from './controller.decorator';
2
+ export * as DtoDecorators from './dto.decorators';
3
+ export * as ValidateDecorators from './validator.decorators';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidateDecorators = exports.DtoDecorators = exports.ControllerDecorators = void 0;
4
+ exports.ControllerDecorators = require("./controller.decorator");
5
+ exports.DtoDecorators = require("./dto.decorators");
6
+ exports.ValidateDecorators = require("./validator.decorators");
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;AAAA,iEAA+D;AAC/D,oDAAkD;AAClD,+DAA6D"}
@@ -0,0 +1,54 @@
1
+ import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
2
+ export declare class IsDateFormatValid implements ValidatorConstraintInterface {
3
+ validate(text: string, validationArguments: ValidationArguments): boolean;
4
+ defaultMessage(args: ValidationArguments): string;
5
+ }
6
+ export declare class CustomWordsValidator implements ValidatorConstraintInterface {
7
+ validate(text: string, validationArguments: ValidationArguments): boolean;
8
+ }
9
+ export declare class CustomIntStringValidator implements ValidatorConstraintInterface {
10
+ validate(text: string): boolean;
11
+ }
12
+ export declare class CustomJustExpressionValidator implements ValidatorConstraintInterface {
13
+ validate(text: string, validationArguments: ValidationArguments): boolean;
14
+ }
15
+ export declare class CustomIdsValidator implements ValidatorConstraintInterface {
16
+ validate(ids: number[]): boolean;
17
+ }
18
+ export declare class CustomCharacterValidator implements ValidatorConstraintInterface {
19
+ validate(text: string, validationArguments: ValidationArguments): boolean;
20
+ }
21
+ export declare class CustomWordsForNameValidator implements ValidatorConstraintInterface {
22
+ validate(name: string, validationArguments: ValidationArguments): boolean;
23
+ }
24
+ export declare class CustomEmailValidator implements ValidatorConstraintInterface {
25
+ validate(text: string, validationArguments: ValidationArguments): boolean;
26
+ }
27
+ export declare class CustomDateValidator implements ValidatorConstraintInterface {
28
+ validate(date: Date, validationArguments: ValidationArguments): boolean;
29
+ }
30
+ export declare class CustomDatesValidator implements ValidatorConstraintInterface {
31
+ validate(dates: any, validationArguments: ValidationArguments): boolean;
32
+ }
33
+ export declare class CustomArrayMinValidator implements ValidatorConstraintInterface {
34
+ validate(array: any, validationArguments: ValidationArguments): Promise<boolean>;
35
+ }
36
+ interface grades {
37
+ idestudiante: number;
38
+ nota1: number;
39
+ nota2: number;
40
+ nota3: number;
41
+ }
42
+ export declare class CustomArrayGradesValidator implements ValidatorConstraintInterface {
43
+ validate(grades: grades[], validationArguments: ValidationArguments): Promise<boolean>;
44
+ }
45
+ export declare class CustomValueValidator implements ValidatorConstraintInterface {
46
+ validate(value: number, validationArguments: ValidationArguments): boolean;
47
+ }
48
+ export declare class CustomMinMaxValueValidator implements ValidatorConstraintInterface {
49
+ validate(value: number, validationArguments: ValidationArguments): boolean;
50
+ }
51
+ export declare class CustomFloatValueValidator implements ValidatorConstraintInterface {
52
+ validate(value: number, validationArguments: ValidationArguments): boolean;
53
+ }
54
+ export {};
@@ -0,0 +1,205 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CustomFloatValueValidator = exports.CustomMinMaxValueValidator = exports.CustomValueValidator = exports.CustomArrayGradesValidator = exports.CustomArrayMinValidator = exports.CustomDatesValidator = exports.CustomDateValidator = exports.CustomEmailValidator = exports.CustomWordsForNameValidator = exports.CustomCharacterValidator = exports.CustomIdsValidator = exports.CustomJustExpressionValidator = exports.CustomIntStringValidator = exports.CustomWordsValidator = exports.IsDateFormatValid = void 0;
10
+ const class_validator_1 = require("class-validator");
11
+ let IsDateFormatValid = class IsDateFormatValid {
12
+ validate(text, validationArguments) {
13
+ const [regex, field] = validationArguments.constraints;
14
+ const regExp = new RegExp(regex);
15
+ return regExp.test(text);
16
+ }
17
+ defaultMessage(args) {
18
+ return 'date format error, only allowed (ej. 01/01/2022)';
19
+ }
20
+ };
21
+ IsDateFormatValid = __decorate([
22
+ (0, class_validator_1.ValidatorConstraint)({ name: 'isDateFormatValid', async: false })
23
+ ], IsDateFormatValid);
24
+ exports.IsDateFormatValid = IsDateFormatValid;
25
+ let CustomWordsValidator = class CustomWordsValidator {
26
+ validate(text, validationArguments) {
27
+ const [min, max, regex] = validationArguments.constraints;
28
+ const regExp = new RegExp(regex);
29
+ return text.length >= min && text.length <= max && regExp.test(text);
30
+ }
31
+ };
32
+ CustomWordsValidator = __decorate([
33
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
34
+ ], CustomWordsValidator);
35
+ exports.CustomWordsValidator = CustomWordsValidator;
36
+ let CustomIntStringValidator = class CustomIntStringValidator {
37
+ validate(text) {
38
+ const value = parseInt(text);
39
+ if (value)
40
+ return true;
41
+ return false;
42
+ }
43
+ };
44
+ CustomIntStringValidator = __decorate([
45
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
46
+ ], CustomIntStringValidator);
47
+ exports.CustomIntStringValidator = CustomIntStringValidator;
48
+ let CustomJustExpressionValidator = class CustomJustExpressionValidator {
49
+ validate(text, validationArguments) {
50
+ const [regex] = validationArguments.constraints;
51
+ const regExp = new RegExp(regex);
52
+ return regExp.test(text);
53
+ }
54
+ };
55
+ CustomJustExpressionValidator = __decorate([
56
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
57
+ ], CustomJustExpressionValidator);
58
+ exports.CustomJustExpressionValidator = CustomJustExpressionValidator;
59
+ let CustomIdsValidator = class CustomIdsValidator {
60
+ validate(ids) {
61
+ if (ids.length === 0)
62
+ return false;
63
+ let valid = true;
64
+ for (const id of ids) {
65
+ if (id < 1)
66
+ valid = false;
67
+ }
68
+ return valid;
69
+ }
70
+ };
71
+ CustomIdsValidator = __decorate([
72
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
73
+ ], CustomIdsValidator);
74
+ exports.CustomIdsValidator = CustomIdsValidator;
75
+ let CustomCharacterValidator = class CustomCharacterValidator {
76
+ validate(text, validationArguments) {
77
+ return text.length === 1 && validationArguments.constraints.includes(text);
78
+ }
79
+ };
80
+ CustomCharacterValidator = __decorate([
81
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
82
+ ], CustomCharacterValidator);
83
+ exports.CustomCharacterValidator = CustomCharacterValidator;
84
+ let CustomWordsForNameValidator = class CustomWordsForNameValidator {
85
+ validate(name, validationArguments) {
86
+ const [min, max, re] = validationArguments.constraints;
87
+ const regExp = new RegExp(re);
88
+ const spName = name.split(' ');
89
+ let valido = true;
90
+ for (const st of spName) {
91
+ let counter = 0;
92
+ if (st.startsWith("'") || st.endsWith("'"))
93
+ valido = false;
94
+ for (let index = 0; index < st.length; index++) {
95
+ if (st.charAt(index) === "'") {
96
+ counter++;
97
+ }
98
+ }
99
+ if (counter > 1)
100
+ valido = false;
101
+ }
102
+ return valido && name.length >= min && name.length <= max && regExp.test(name);
103
+ }
104
+ };
105
+ CustomWordsForNameValidator = __decorate([
106
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
107
+ ], CustomWordsForNameValidator);
108
+ exports.CustomWordsForNameValidator = CustomWordsForNameValidator;
109
+ let CustomEmailValidator = class CustomEmailValidator {
110
+ validate(text, validationArguments) {
111
+ const [min, max] = validationArguments.constraints;
112
+ return text.length >= min && text.length <= max && (0, class_validator_1.isEmail)(text);
113
+ }
114
+ };
115
+ CustomEmailValidator = __decorate([
116
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
117
+ ], CustomEmailValidator);
118
+ exports.CustomEmailValidator = CustomEmailValidator;
119
+ let CustomDateValidator = class CustomDateValidator {
120
+ validate(date, validationArguments) {
121
+ const new_date = new Date(date);
122
+ return (0, class_validator_1.isDate)(new_date);
123
+ }
124
+ };
125
+ CustomDateValidator = __decorate([
126
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
127
+ ], CustomDateValidator);
128
+ exports.CustomDateValidator = CustomDateValidator;
129
+ let CustomDatesValidator = class CustomDatesValidator {
130
+ validate(dates, validationArguments) {
131
+ const { fecha_ini, fecha_fin } = dates;
132
+ const ini = new Date(fecha_ini);
133
+ const fin = new Date(fecha_fin);
134
+ if ((0, class_validator_1.isDate)(ini) && (0, class_validator_1.isDate)(fin) && ini < fin)
135
+ return true;
136
+ return false;
137
+ }
138
+ };
139
+ CustomDatesValidator = __decorate([
140
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
141
+ ], CustomDatesValidator);
142
+ exports.CustomDatesValidator = CustomDatesValidator;
143
+ let CustomArrayMinValidator = class CustomArrayMinValidator {
144
+ async validate(array, validationArguments) {
145
+ const [min] = validationArguments.constraints;
146
+ return array.length >= min;
147
+ }
148
+ };
149
+ CustomArrayMinValidator = __decorate([
150
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
151
+ ], CustomArrayMinValidator);
152
+ exports.CustomArrayMinValidator = CustomArrayMinValidator;
153
+ let CustomArrayGradesValidator = class CustomArrayGradesValidator {
154
+ async validate(grades, validationArguments) {
155
+ let valido = true;
156
+ const [min, max] = validationArguments.constraints;
157
+ if (grades.length === 0)
158
+ valido = false;
159
+ for (const notas of grades) {
160
+ const { nota1, nota2, nota3 } = notas;
161
+ if (nota1 < min || nota1 > max)
162
+ valido = false;
163
+ if (nota2 < min || nota2 > max)
164
+ valido = false;
165
+ if (nota3 < min || nota3 > max)
166
+ valido = false;
167
+ }
168
+ return valido;
169
+ }
170
+ };
171
+ CustomArrayGradesValidator = __decorate([
172
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
173
+ ], CustomArrayGradesValidator);
174
+ exports.CustomArrayGradesValidator = CustomArrayGradesValidator;
175
+ let CustomValueValidator = class CustomValueValidator {
176
+ validate(value, validationArguments) {
177
+ const [min, max] = validationArguments.constraints;
178
+ return value >= min && value <= max && (0, class_validator_1.isInt)(value);
179
+ }
180
+ };
181
+ CustomValueValidator = __decorate([
182
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
183
+ ], CustomValueValidator);
184
+ exports.CustomValueValidator = CustomValueValidator;
185
+ let CustomMinMaxValueValidator = class CustomMinMaxValueValidator {
186
+ validate(value, validationArguments) {
187
+ const [min, max] = validationArguments.constraints;
188
+ return value >= min && value <= max && (0, class_validator_1.isNumber)(value);
189
+ }
190
+ };
191
+ CustomMinMaxValueValidator = __decorate([
192
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
193
+ ], CustomMinMaxValueValidator);
194
+ exports.CustomMinMaxValueValidator = CustomMinMaxValueValidator;
195
+ let CustomFloatValueValidator = class CustomFloatValueValidator {
196
+ validate(value, validationArguments) {
197
+ const [min, max] = validationArguments.constraints;
198
+ return value >= min && value <= max;
199
+ }
200
+ };
201
+ CustomFloatValueValidator = __decorate([
202
+ (0, class_validator_1.ValidatorConstraint)({ name: 'error' })
203
+ ], CustomFloatValueValidator);
204
+ exports.CustomFloatValueValidator = CustomFloatValueValidator;
205
+ //# sourceMappingURL=validator.decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.decorators.js","sourceRoot":"","sources":["../../src/decorators/validator.decorators.ts"],"names":[],"mappings":";;;;;;;;;AACA,qDAQyB;AAGlB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,QAAQ,CAAC,IAAY,EAAE,mBAAwC;QAC7D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,mBAAmB,CAAC,WAAW,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,cAAc,CAAC,IAAyB;QACtC,OAAO,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Q,CAAC,KAAa,EAAE,mBAAwC;QAC9D,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,mBAAmB,CAAC,WAAW,CAAC;QACnD,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,IAAA,0BAAQ,EAAC,KAAK,CAAC,CAAC;IACzD,CAAC;CACF,CAAA;AALY,0BAA0B;IADtC,IAAA,qCAAmB,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;GAC1B,0BAA0B,CAKtC;AALY,gEAA0B;AAQhC,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,QAAQ,CAAC,KAAa,EAAE,mBAAwC;QAC9D,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,mBAAmB,CAAC,WAAW,CAAC;QACnD,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,CAAC;IACtC,CAAC;CACF,CAAA;AALY,yBAAyB;IADrC,IAAA,qCAAmB,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;GAC1B,yBAAyB,CAKrC;AALY,8DAAyB"}
@@ -0,0 +1,30 @@
1
+ export declare enum SortOrder {
2
+ ASCENDENTE = "asc",
3
+ DESCENDENTE = "desc"
4
+ }
5
+ export declare class FilterDto {
6
+ size: number;
7
+ page?: number | undefined;
8
+ orderBy?: string | undefined;
9
+ orderDirection?: SortOrder | undefined;
10
+ where?: string | undefined;
11
+ select?: string | undefined;
12
+ include?: string | undefined;
13
+ }
14
+ export declare class FilterPostDto {
15
+ size: number;
16
+ page?: number | undefined;
17
+ orderBy?: string | undefined;
18
+ orderDirection?: SortOrder | undefined;
19
+ where?: any;
20
+ select?: any;
21
+ include?: any;
22
+ }
23
+ export declare class QueryMsRedisCacheDto {
24
+ desdeCache: boolean;
25
+ ttl: number;
26
+ }
27
+ export declare class FilterRedistCacheDto extends FilterDto {
28
+ noCache: boolean;
29
+ ttl: number;
30
+ }
@@ -0,0 +1,244 @@
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.FilterRedistCacheDto = exports.QueryMsRedisCacheDto = exports.FilterPostDto = exports.FilterDto = exports.SortOrder = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_transformer_1 = require("class-transformer");
15
+ const class_validator_1 = require("class-validator");
16
+ const validator_sms_1 = require("../custom-validators/validator.sms");
17
+ var SortOrder;
18
+ (function (SortOrder) {
19
+ SortOrder["ASCENDENTE"] = "asc";
20
+ SortOrder["DESCENDENTE"] = "desc";
21
+ })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
22
+ class FilterDto {
23
+ }
24
+ __decorate([
25
+ (0, class_transformer_1.Transform)((value) => (value ? +value.value : value.value)),
26
+ (0, class_validator_1.IsNumber)({ allowInfinity: false, allowNaN: false, maxDecimalPlaces: 0 }, { message: (v) => (0, validator_sms_1.smsInteger)(v) }),
27
+ (0, class_validator_1.IsDefined)({ message: validator_sms_1.smsNotEmptyM }),
28
+ (0, swagger_1.ApiProperty)({
29
+ description: 'Límite de registros por petición',
30
+ required: true,
31
+ default: 5,
32
+ }),
33
+ __metadata("design:type", Number)
34
+ ], FilterDto.prototype, "size", void 0);
35
+ __decorate([
36
+ (0, class_transformer_1.Transform)((value) => (value ? +value.value : value.value)),
37
+ (0, class_validator_1.IsNumber)({ allowInfinity: false, allowNaN: false, maxDecimalPlaces: 0 }, { message: (v) => (0, validator_sms_1.smsInteger)(v) }),
38
+ (0, swagger_1.ApiProperty)({
39
+ description: 'Límite de registros por petición',
40
+ required: true,
41
+ default: 0,
42
+ }),
43
+ __metadata("design:type", Number)
44
+ ], FilterDto.prototype, "page", void 0);
45
+ __decorate([
46
+ (0, class_validator_1.IsString)({ message: (v) => (0, validator_sms_1.smsIsStringM)(v) }),
47
+ (0, class_validator_1.IsOptional)(),
48
+ (0, swagger_1.ApiProperty)({ description: 'Campo para ordenación', required: false }),
49
+ __metadata("design:type", String)
50
+ ], FilterDto.prototype, "orderBy", void 0);
51
+ __decorate([
52
+ (0, class_validator_1.IsEnum)(SortOrder, { message: (v) => (0, validator_sms_1.smsEnum)(v) }),
53
+ (0, class_validator_1.IsOptional)(),
54
+ (0, swagger_1.ApiProperty)({
55
+ description: 'dirección de ordenamiento',
56
+ required: false,
57
+ enum: SortOrder,
58
+ }),
59
+ __metadata("design:type", String)
60
+ ], FilterDto.prototype, "orderDirection", void 0);
61
+ __decorate([
62
+ (0, class_validator_1.IsString)({ message: (v) => (0, validator_sms_1.smsIsStringM)(v) }),
63
+ (0, class_validator_1.IsOptional)(),
64
+ (0, swagger_1.ApiProperty)({
65
+ description: 'Filtros para el listado',
66
+ required: false,
67
+ type: String,
68
+ format: 'text',
69
+ example: `{
70
+ "nombre": {
71
+ "contains": "ALGO"
72
+ }
73
+ }`,
74
+ }),
75
+ __metadata("design:type", String)
76
+ ], FilterDto.prototype, "where", void 0);
77
+ __decorate([
78
+ (0, class_validator_1.IsString)({ message: (v) => (0, validator_sms_1.smsIsStringM)(v) }),
79
+ (0, class_validator_1.IsOptional)(),
80
+ (0, swagger_1.ApiProperty)({
81
+ description: 'Seleccionar columnas del listado',
82
+ required: false,
83
+ type: String,
84
+ format: 'text',
85
+ example: `{
86
+ "id": true,
87
+ "nombre": true
88
+ }`,
89
+ }),
90
+ __metadata("design:type", String)
91
+ ], FilterDto.prototype, "select", void 0);
92
+ __decorate([
93
+ (0, class_validator_1.IsString)({ message: (v) => (0, validator_sms_1.smsIsStringM)(v) }),
94
+ (0, class_validator_1.IsOptional)(),
95
+ (0, swagger_1.ApiProperty)({
96
+ description: 'Incluir relaciones a; listado',
97
+ required: false,
98
+ type: String,
99
+ format: 'text-area',
100
+ example: `{
101
+ "relation_name": true
102
+ }`,
103
+ }),
104
+ __metadata("design:type", String)
105
+ ], FilterDto.prototype, "include", void 0);
106
+ exports.FilterDto = FilterDto;
107
+ class FilterPostDto {
108
+ }
109
+ __decorate([
110
+ (0, class_transformer_1.Transform)((value) => (value ? +value.value : value.value)),
111
+ (0, class_validator_1.IsNumber)({ allowInfinity: false, allowNaN: false, maxDecimalPlaces: 0 }, { message: (v) => (0, validator_sms_1.smsInteger)(v) }),
112
+ (0, class_validator_1.IsOptional)(),
113
+ (0, swagger_1.ApiProperty)({
114
+ description: 'Límite de registros por petición',
115
+ required: true,
116
+ default: 5,
117
+ }),
118
+ __metadata("design:type", Number)
119
+ ], FilterPostDto.prototype, "size", void 0);
120
+ __decorate([
121
+ (0, class_transformer_1.Transform)((value) => (value ? +value.value : value.value)),
122
+ (0, class_validator_1.IsNumber)({ allowInfinity: false, allowNaN: false, maxDecimalPlaces: 0 }, { message: (v) => (0, validator_sms_1.smsInteger)(v) }),
123
+ (0, class_validator_1.IsOptional)(),
124
+ (0, swagger_1.ApiProperty)({
125
+ description: 'Límite de registros por petición',
126
+ required: true,
127
+ default: 0,
128
+ }),
129
+ __metadata("design:type", Number)
130
+ ], FilterPostDto.prototype, "page", void 0);
131
+ __decorate([
132
+ (0, class_validator_1.IsString)({ message: (v) => (0, validator_sms_1.smsIsStringM)(v) }),
133
+ (0, class_validator_1.IsOptional)(),
134
+ (0, swagger_1.ApiProperty)({
135
+ description: 'Campo para ordenación',
136
+ required: false,
137
+ }),
138
+ __metadata("design:type", String)
139
+ ], FilterPostDto.prototype, "orderBy", void 0);
140
+ __decorate([
141
+ (0, class_validator_1.IsEnum)(SortOrder, { message: (v) => (0, validator_sms_1.smsEnum)(v) }),
142
+ (0, class_validator_1.IsOptional)(),
143
+ (0, swagger_1.ApiProperty)({
144
+ description: 'dirección de ordenamiento',
145
+ required: false,
146
+ enum: SortOrder,
147
+ }),
148
+ __metadata("design:type", String)
149
+ ], FilterPostDto.prototype, "orderDirection", void 0);
150
+ __decorate([
151
+ (0, class_validator_1.IsObject)({ message: (v) => (0, validator_sms_1.smsIsStringM)(v) }),
152
+ (0, class_validator_1.IsOptional)(),
153
+ (0, swagger_1.ApiProperty)({
154
+ description: 'Filtros para el listado',
155
+ required: false,
156
+ type: Object,
157
+ example: {
158
+ nombre: {
159
+ contains: 'ALGO',
160
+ },
161
+ },
162
+ }),
163
+ __metadata("design:type", Object)
164
+ ], FilterPostDto.prototype, "where", void 0);
165
+ __decorate([
166
+ (0, class_validator_1.IsObject)({ message: (v) => (0, validator_sms_1.smsIsStringM)(v) }),
167
+ (0, class_validator_1.IsOptional)(),
168
+ (0, swagger_1.ApiProperty)({
169
+ description: 'Seleccionar columnas del listado',
170
+ required: false,
171
+ type: Object,
172
+ example: {
173
+ id: true,
174
+ nombre: true,
175
+ },
176
+ }),
177
+ __metadata("design:type", Object)
178
+ ], FilterPostDto.prototype, "select", void 0);
179
+ __decorate([
180
+ (0, class_validator_1.IsObject)({ message: (v) => (0, validator_sms_1.smsIsStringM)(v) }),
181
+ (0, class_validator_1.IsOptional)(),
182
+ (0, swagger_1.ApiProperty)({
183
+ description: 'Incluir relaciones a; listado',
184
+ required: false,
185
+ type: Object,
186
+ example: {
187
+ relation_name: true,
188
+ },
189
+ }),
190
+ __metadata("design:type", Object)
191
+ ], FilterPostDto.prototype, "include", void 0);
192
+ exports.FilterPostDto = FilterPostDto;
193
+ class QueryMsRedisCacheDto {
194
+ }
195
+ __decorate([
196
+ (0, class_transformer_1.Transform)(({ value }) => {
197
+ return value === 'false' ? false : true;
198
+ }),
199
+ (0, class_validator_1.IsBoolean)({ message: (v) => (0, validator_sms_1.smsIsBoolean)(v) }),
200
+ (0, class_validator_1.IsOptional)(),
201
+ (0, swagger_1.ApiProperty)({
202
+ description: 'realizar cacheo',
203
+ required: false,
204
+ default: true,
205
+ }),
206
+ __metadata("design:type", Boolean)
207
+ ], QueryMsRedisCacheDto.prototype, "desdeCache", void 0);
208
+ __decorate([
209
+ (0, class_validator_1.IsNumber)({ allowInfinity: false, allowNaN: false, maxDecimalPlaces: 0 }, { message: (v) => (0, validator_sms_1.smsInteger)(v) }),
210
+ (0, class_validator_1.IsOptional)(),
211
+ (0, swagger_1.ApiProperty)({
212
+ description: 'tiempo de cacheo en segundos',
213
+ required: false,
214
+ example: 60,
215
+ }),
216
+ __metadata("design:type", Number)
217
+ ], QueryMsRedisCacheDto.prototype, "ttl", void 0);
218
+ exports.QueryMsRedisCacheDto = QueryMsRedisCacheDto;
219
+ class FilterRedistCacheDto extends FilterDto {
220
+ }
221
+ __decorate([
222
+ (0, class_validator_1.IsBoolean)({ message: (v) => (0, validator_sms_1.smsIsBoolean)(v) }),
223
+ (0, class_validator_1.IsOptional)(),
224
+ (0, swagger_1.ApiProperty)({
225
+ description: 'realizar cacheo',
226
+ required: false,
227
+ default: false,
228
+ example: false,
229
+ }),
230
+ __metadata("design:type", Boolean)
231
+ ], FilterRedistCacheDto.prototype, "noCache", void 0);
232
+ __decorate([
233
+ (0, class_validator_1.IsNumber)({ allowInfinity: false, allowNaN: false, maxDecimalPlaces: 0 }, { message: (v) => (0, validator_sms_1.smsInteger)(v) }),
234
+ (0, class_validator_1.IsOptional)(),
235
+ (0, swagger_1.ApiProperty)({
236
+ description: 'tiempo de cacheo en segundos',
237
+ required: false,
238
+ default: 0,
239
+ example: 60,
240
+ }),
241
+ __metadata("design:type", Number)
242
+ ], FilterRedistCacheDto.prototype, "ttl", void 0);
243
+ exports.FilterRedistCacheDto = FilterRedistCacheDto;
244
+ //# sourceMappingURL=filter.dto.js.map
@@ -0,0 +1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IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,8BAA8B;QAC3C,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,EAAE;KACZ,CAAC;;iDACU;AAvBd,oDAwBC;AAED,MAAa,oBAAqB,SAAQ,SAAS;CAuBlD;AAtBC;IAAC,IAAA,2BAAS,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAY,EAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,iBAAiB;QAC9B,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,KAAK;KACf,CAAC;;qDACe;AAEjB;IAAC,IAAA,0BAAQ,EACP,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,EAAE,EAC9D,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,0BAAU,EAAC,CAAC,CAAC,EAAE,CAClC;IACA,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,8BAA8B;QAC3C,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,EAAE;KACZ,CAAC;;iDACU;AAtBd,oDAuBC"}
@@ -0,0 +1,2 @@
1
+ export * as ResponsesDto from './response.dto';
2
+ export * as FiltersDto from './filter.dto';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiltersDto = exports.ResponsesDto = void 0;
4
+ exports.ResponsesDto = require("./response.dto");
5
+ exports.FiltersDto = require("./filter.dto");
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,6CAA2C"}
@@ -0,0 +1,44 @@
1
+ export interface IResponse {
2
+ error: boolean;
3
+ message: string;
4
+ response: any;
5
+ status: number;
6
+ }
7
+ export type ResponseDTO<T> = {
8
+ error: boolean;
9
+ message: string;
10
+ response: {
11
+ data?: T;
12
+ pagination?: {
13
+ total: number;
14
+ page: number;
15
+ limit: number;
16
+ };
17
+ validationErrors?: ValidationErrorsType<T>;
18
+ suggestions?: SuggestionsType<T>;
19
+ };
20
+ status: number;
21
+ cache?: boolean;
22
+ };
23
+ export type ValidationErrorsType<T> = {
24
+ [key in keyof T]: Array<string>;
25
+ };
26
+ export type SuggestionsType<T> = {
27
+ [key in keyof T]: Array<string>;
28
+ };
29
+ export declare const dataResponseSuccess: <T>(response: {
30
+ data: T;
31
+ pagination?: {
32
+ total: number;
33
+ page: number;
34
+ limit: number;
35
+ };
36
+ validationErrors?: ValidationErrorsType<T>;
37
+ suggestions?: SuggestionsType<T>;
38
+ }, { error, message, status }?: Partial<ResponseDTO<T>>) => ResponseDTO<T>;
39
+ export declare const dataResponseError: <T>(message?: string, { error, status, response }?: {
40
+ error?: boolean;
41
+ status?: number;
42
+ response?: any;
43
+ }) => ResponseDTO<T>;
44
+ export declare const MsMysqlResponseFormat: <T>(response?: any, { message: successMessage, status: successStatus, }?: Partial<ResponseDTO<T>>, { error: errorError, message: errorMessage, status: errorStatus, }?: Partial<ResponseDTO<T>>) => ResponseDTO<T>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MsMysqlResponseFormat = exports.dataResponseError = exports.dataResponseSuccess = void 0;
4
+ const class_validator_1 = require("class-validator");
5
+ const dataResponseSuccess = (response, { error = false, message = 'operacion Exitosa', status = 200 } = {}) => {
6
+ return { error, message, response, status };
7
+ };
8
+ exports.dataResponseSuccess = dataResponseSuccess;
9
+ const dataResponseError = (message = 'ocurrio un error', { error = true, status = 422, response = null } = {}) => {
10
+ return { error, message, response, status };
11
+ };
12
+ exports.dataResponseError = dataResponseError;
13
+ const MsMysqlResponseFormat = (response = null, { message: successMessage = 'Operación Exitosa', status: successStatus = 200, } = {}, { error: errorError = true, message: errorMessage = 'Error desconocido', status: errorStatus = 500, } = {}) => {
14
+ if (!(response === null || response === void 0 ? void 0 : response.errorMessage)) {
15
+ if ((response === null || response === void 0 ? void 0 : response.data) !== undefined && (response === null || response === void 0 ? void 0 : response.data) !== null) {
16
+ return {
17
+ error: false,
18
+ message: successMessage,
19
+ response: {
20
+ data: response === null || response === void 0 ? void 0 : response.data,
21
+ suggestions: response === null || response === void 0 ? void 0 : response.suggestions,
22
+ validationErrors: response === null || response === void 0 ? void 0 : response.validationErrors,
23
+ pagination: (response === null || response === void 0 ? void 0 : response.pagination) ||
24
+ ((0, class_validator_1.isNumber)(response === null || response === void 0 ? void 0 : response.total) ? { total: response === null || response === void 0 ? void 0 : response.total } : undefined),
25
+ },
26
+ status: successStatus,
27
+ };
28
+ }
29
+ else {
30
+ return {
31
+ error: errorError,
32
+ message: errorMessage,
33
+ response: {},
34
+ status: errorStatus,
35
+ };
36
+ }
37
+ }
38
+ else {
39
+ return {
40
+ error: errorError,
41
+ message: (response === null || response === void 0 ? void 0 : response.errorMessage) ? response === null || response === void 0 ? void 0 : response.errorMessage : errorMessage,
42
+ response: {
43
+ validationErrors: (response === null || response === void 0 ? void 0 : response.validationErrors)
44
+ ? JSON.parse(response === null || response === void 0 ? void 0 : response.validationErrors)
45
+ : undefined,
46
+ },
47
+ status: errorStatus,
48
+ };
49
+ }
50
+ };
51
+ exports.MsMysqlResponseFormat = MsMysqlResponseFormat;
52
+ //# sourceMappingURL=response.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.dto.js","sourceRoot":"","sources":["../../src/dto/response.dto.ts"],"names":[],"mappings":";;;AAAA,qDAA2C;AAuCpC,MAAM,mBAAmB,GAAG,CACjC,QASC,EACD,EAAE,KAAK,GAAG,KAAK,EAAE,OAAO,GAAG,mBAAmB,EAAE,MAAM,GAAG,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AE,gBAAgB;oBAC5C,UAAU,EACR,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,UAAU;wBACpB,CAAC,IAAA,0BAAQ,EAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACvE;gBACD,MAAM,EAAE,aAAa;aACJ,CAAC;SACrB;aAAM;YACL,OAAO;gBACL,KAAK,EAAE,UAAU;gBACjB,OAAO,EAAE,YAAY;gBACrB,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,WAAW;aACF,CAAC;SACrB;KACF;SAAM;QACL,OAAO;YACL,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,EAAC,CAAC,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,CAAC,CAAC,CAAC,YAAY;YACvE,QAAQ,EAAE;gBACR,gBAAgB,EAAE,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,gBAAgB;oBAC1C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,gBAAgB,CAAC;oBACxC,CAAC,CAAC,SAAS;aACd;YACD,MAAM,EAAE,WAAW;SACF,CAAC;KACrB;AACH,CAAC,CAAC;AA/CW,QAAA,qBAAqB,yBA+ChC"}
package/dist/index.d.ts CHANGED
@@ -17,3 +17,6 @@ export * as MsPersonas from './ms-personas';
17
17
  export * as MsPdf from './ms-pdf';
18
18
  export * as MsFiles from './ms-files';
19
19
  export * as MsSkylogs from './ms-skylogs';
20
+ export * as CustomValidators from './custom-validators';
21
+ export * as Decorators from './decorators';
22
+ export * as Dtos from './dto';
package/dist/index.js CHANGED
@@ -14,7 +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
- exports.MsSkylogs = exports.MsFiles = exports.MsPdf = exports.MsPersonas = exports.PermissionsGuard = exports.MsSeguridadHttpError = void 0;
17
+ exports.Dtos = exports.Decorators = exports.CustomValidators = exports.MsSkylogs = exports.MsFiles = exports.MsPdf = exports.MsPersonas = exports.PermissionsGuard = exports.MsSeguridadHttpError = void 0;
18
18
  __exportStar(require("./ms-redis/ms-redis.module"), exports);
19
19
  __exportStar(require("./ms-redis/ms-redis.service"), exports);
20
20
  __exportStar(require("./ms-redis/datapass.interceptor"), exports);
@@ -36,4 +36,7 @@ exports.MsPersonas = require("./ms-personas");
36
36
  exports.MsPdf = require("./ms-pdf");
37
37
  exports.MsFiles = require("./ms-files");
38
38
  exports.MsSkylogs = require("./ms-skylogs");
39
+ exports.CustomValidators = require("./custom-validators");
40
+ exports.Decorators = require("./decorators");
41
+ exports.Dtos = require("./dto");
39
42
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiscalia_bo-nest-helpers",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "author": "UTIC",
5
5
  "contact": {
6
6
  "name": "Unidad de Tecnologías de la Información y Comunicación - Ministerio Público",
@@ -13,6 +13,9 @@
13
13
  "dist/ms-files/*",
14
14
  "dist/ms-personas/*",
15
15
  "dist/ms-pdf/*",
16
+ "dist/custom-validators/*",
17
+ "dist/decorators/*",
18
+ "dist/dto/*",
16
19
  "dist/ms-skylogs/*",
17
20
  "dist/http-service/*",
18
21
  "dist/services/*",