diff --git a/package-lock.json b/package-lock.json index a0f0400..c4aa08b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1837,9 +1837,9 @@ } }, "@types/validator": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.0.0.tgz", - "integrity": "sha512-WAy5txG7aFX8Vw3sloEKp5p/t/Xt8jD3GRD9DacnFv6Vo8ubudAsRTXgxpQwU0mpzY/H8U4db3roDuCMjShBmw==", + "version": "13.6.3", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.6.3.tgz", + "integrity": "sha512-fWG42pMJOL4jKsDDZZREnXLjc3UE0R8LOJfARWYg6U966rxDT7TYejYzLnUF5cvSObGg34nd0+H2wHHU5Omdfw==", "dev": true }, "@types/yargs": { @@ -2689,21 +2689,20 @@ "dev": true }, "class-transformer": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.3.2.tgz", - "integrity": "sha512-9QY6QXBH/+Gt1C3HBmJCrgY6+EFpIa6aLjfDnlXFx0zQl/HjrCE7qoaI0srNrxpMIfsobCpgUdDG5JYtJOpVsw==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.4.0.tgz", + "integrity": "sha512-ETWD/H2TbWbKEi7m9N4Km5+cw1hNcqJSxlSYhsLsNjQzWWiZIYA1zafxpK9PwVfaZ6AqR5rrjPVUBGESm5tQUA==", "dev": true }, "class-validator": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.12.2.tgz", - "integrity": "sha512-TDzPzp8BmpsbPhQpccB3jMUE/3pK0TyqamrK0kcx+ZeFytMA+O6q87JZZGObHHnoo9GM8vl/JppIyKWeEA/EVw==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.13.1.tgz", + "integrity": "sha512-zWIeYFhUitvAHBwNhDdCRK09hWx+P0HUwFE8US8/CxFpMVzkUK8RJl7yOIE+BVu2lxyPNgeOaFv78tLE47jBIg==", "dev": true, "requires": { - "@types/validator": "13.0.0", - "google-libphonenumber": "^3.2.8", - "tslib": ">=1.9.0", - "validator": "13.0.0" + "@types/validator": "^13.1.3", + "libphonenumber-js": "^1.9.7", + "validator": "^13.5.2" } }, "cli-cursor": { @@ -4734,12 +4733,6 @@ "slash": "^3.0.0" } }, - "google-libphonenumber": { - "version": "3.2.22", - "resolved": "https://registry.npmjs.org/google-libphonenumber/-/google-libphonenumber-3.2.22.tgz", - "integrity": "sha512-lzEllxWc05n/HEv75SsDrA7zdEVvQzTZimItZm/TZ5XBs7cmx2NJmSlA5I0kZbdKNu8GFETBhSpo+SOhx0JslA==", - "dev": true - }, "graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", @@ -6668,9 +6661,9 @@ } }, "jsdom": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.6.0.tgz", - "integrity": "sha512-Ty1vmF4NHJkolaEmdjtxTfSfkdb8Ywarwf63f+F8/mDD1uLSSWDxDuMiZxiPhwunLrn9LOSVItWj4bLYsLN3Dg==", + "version": "16.7.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz", + "integrity": "sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==", "dev": true, "requires": { "abab": "^2.0.5", @@ -6698,7 +6691,7 @@ "whatwg-encoding": "^1.0.5", "whatwg-mimetype": "^2.3.0", "whatwg-url": "^8.5.0", - "ws": "^7.4.5", + "ws": "^7.4.6", "xml-name-validator": "^3.0.0" } }, @@ -6803,6 +6796,12 @@ "type-check": "~0.4.0" } }, + "libphonenumber-js": { + "version": "1.9.23", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.9.23.tgz", + "integrity": "sha512-+qWSwPyJWSV9ukb7Iu21WpWEP7irFWR1ojoYykL2itAfXKj9FjsTjS6PPZoPUOZk+1kxliHjwsilqA1TNeOhuQ==", + "dev": true + }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -8876,9 +8875,9 @@ } }, "validator": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.0.0.tgz", - "integrity": "sha512-anYx5fURbgF04lQV18nEQWZ/3wHGnxiKdG4aL8J+jEDsm98n/sU/bey+tYk6tnGJzm7ioh5FoqrAiQ6m03IgaA==", + "version": "13.6.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.6.0.tgz", + "integrity": "sha512-gVgKbdbHgtxpRyR8K0O6oFZPhhB5tT1jeEHZR0Znr9Svg03U0+r9DXWMrnRAB+HtCStDQKlaIZm42tVsVjqtjg==", "dev": true }, "w3c-hr-time": { diff --git a/package.json b/package.json index 432ef48..cab1f52 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,8 @@ "@types/supertest": "2.0.11", "@typescript-eslint/eslint-plugin": "4.28.4", "@typescript-eslint/parser": "4.28.4", - "class-transformer": "0.3.2", - "class-validator": "0.12.2", + "class-transformer": "0.4.0", + "class-validator": "0.13.1", "codecov": "3.8.3", "eslint": "7.31.0", "eslint-config-prettier": "8.3.0", @@ -75,7 +75,7 @@ "peerDependencies": { "@nestjs/common": "^6.0.0 || ^7.0.0 || ^8.0.0", "@nestjs/core": "^6.0.0 || ^7.0.0 || ^8.0.0", - "class-transformer": "^0.3.0", - "class-validator": "^0.12.0" + "class-transformer": "^0.3.0 || ^0.4.0", + "class-validator": "^0.12.0 || ^0.13.0" } } diff --git a/src/service/object-validator/object-validator.service.ts b/src/service/object-validator/object-validator.service.ts index bbddb13..c061767 100644 --- a/src/service/object-validator/object-validator.service.ts +++ b/src/service/object-validator/object-validator.service.ts @@ -41,7 +41,7 @@ export class ObjectValidatorService { const object: T = plainToClass(type, plain, { strategy: 'excludeAll', ...transformerOptions }); - const errors = await validate(object, validatorOptions); + const errors = await validate(object as any, validatorOptions); if (errors.length !== 0) { throw new ValidationException(errors); @@ -78,7 +78,7 @@ export class ObjectValidatorService { const errors: ValidationError[] = []; for (const object of objects) { - errors.push(...(await validate(object, validatorOptions))); + errors.push(...(await validate(object as any, validatorOptions))); } if (errors.length !== 0) {