@munlib/common 1.0.182 → 1.0.183

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,11 +1,10 @@
1
- import { ValidationError } from 'express-validator';
2
1
  import { CustomError } from './custom-error';
3
2
  export declare class RequestValidationError extends CustomError {
4
- errors: ValidationError[];
3
+ errors: any;
5
4
  typeMsg: string;
6
5
  userMsg: string;
7
6
  statusCode: number;
8
- constructor(errors: ValidationError[], typeMsg?: string, userMsg?: string);
7
+ constructor(errors: any, typeMsg?: string, userMsg?: string);
9
8
  serializeErrors(): {
10
9
  status: string;
11
10
  msg: any;
@@ -36,10 +36,10 @@ var RequestValidationError = /** @class */ (function (_super) {
36
36
  return _this;
37
37
  }
38
38
  RequestValidationError.prototype.serializeErrors = function () {
39
- console.log("******1111********", this.errors[0]);
39
+ console.log("******1111********", this.errors);
40
40
  return {
41
41
  status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()),
42
- msg: this.errors[0].msg,
42
+ msg: this.errors.msg,
43
43
  code: this.statusCode.toString(),
44
44
  typeMsg: this.typeMsg,
45
45
  userMsg: this.userMsg
@@ -7,11 +7,11 @@ var validateRequest = function (req, res, next) {
7
7
  var errors = (0, express_validator_1.validationResult)(req);
8
8
  if (!errors.isEmpty()) {
9
9
  // Extraer el primer error y sus detalles personalizados (typeError y userMsg)
10
- var firstError = errors.array()[0]; // Primer error encontrado
11
- var typeError = firstError.msg.typeMsg || "SINTAX";
12
- var userMsg = firstError.msg.userMsg || "Error de validación en la solicitud";
10
+ var msg = errors.array()[0]; // Primer error encontrado
11
+ var typeError = msg.msg.typeMsg || "SINTAX";
12
+ var userMsg = msg.msg.userMsg || "Error de validación en la solicitud";
13
13
  // Lanzar RequestValidationError con los campos personalizados
14
- throw new request_validation_error_1.RequestValidationError(errors.array(), userMsg, typeError);
14
+ throw new request_validation_error_1.RequestValidationError(msg, userMsg, typeError);
15
15
  }
16
16
  next();
17
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@munlib/common",
3
- "version": "1.0.182",
3
+ "version": "1.0.183",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",