@mondart/nestjs-common-module 1.0.7 → 1.0.9
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/dist/index.d.ts +15 -14
- package/dist/index.js +16 -28
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/validators/validation-options.d.ts +1 -2
- package/dist/validators/validation-options.js +11 -11
- package/package.json +2 -1
- package/.eslintrc.js +0 -25
- package/.prettierrc +0 -4
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validationOptions = void 0;
|
|
3
4
|
const common_1 = require("@nestjs/common");
|
|
4
5
|
const message_formatter_helper_1 = require("../helper/message-formatter.helper");
|
|
6
|
+
exports.validationOptions = {
|
|
7
|
+
transform: true,
|
|
8
|
+
whitelist: true,
|
|
9
|
+
errorHttpStatusCode: common_1.HttpStatus.UNPROCESSABLE_ENTITY,
|
|
10
|
+
exceptionFactory: (errors) => new common_1.HttpException({
|
|
11
|
+
status: common_1.HttpStatus.UNPROCESSABLE_ENTITY,
|
|
12
|
+
message: `Validation failed: ${errors.length} errors found`,
|
|
13
|
+
details: mapValidationErrors(errors),
|
|
14
|
+
}, common_1.HttpStatus.UNPROCESSABLE_ENTITY),
|
|
15
|
+
};
|
|
5
16
|
function mapValidationErrors(errors) {
|
|
6
17
|
return errors.reduce((result, error) => {
|
|
7
18
|
const constraints = error.constraints
|
|
@@ -14,14 +25,3 @@ function mapValidationErrors(errors) {
|
|
|
14
25
|
return result;
|
|
15
26
|
}, {});
|
|
16
27
|
}
|
|
17
|
-
const validationOptions = {
|
|
18
|
-
transform: true,
|
|
19
|
-
whitelist: true,
|
|
20
|
-
errorHttpStatusCode: common_1.HttpStatus.UNPROCESSABLE_ENTITY,
|
|
21
|
-
exceptionFactory: (errors) => new common_1.HttpException({
|
|
22
|
-
status: common_1.HttpStatus.UNPROCESSABLE_ENTITY,
|
|
23
|
-
message: `Validation failed: ${errors.length} errors found`,
|
|
24
|
-
details: mapValidationErrors(errors),
|
|
25
|
-
}, common_1.HttpStatus.UNPROCESSABLE_ENTITY),
|
|
26
|
-
};
|
|
27
|
-
exports.default = validationOptions;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondart/nestjs-common-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mondart"
|
|
7
7
|
},
|
|
8
8
|
"private": false,
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"main": "dist/index.js",
|
|
10
11
|
"scripts": {
|
|
11
12
|
"build": "tsc -p tsconfig.json",
|
|
12
13
|
"prepare": "husky",
|
package/.eslintrc.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
project: 'tsconfig.json',
|
|
5
|
-
tsconfigRootDir: __dirname,
|
|
6
|
-
sourceType: 'module',
|
|
7
|
-
},
|
|
8
|
-
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
9
|
-
extends: [
|
|
10
|
-
'plugin:@typescript-eslint/recommended',
|
|
11
|
-
'plugin:prettier/recommended',
|
|
12
|
-
],
|
|
13
|
-
root: true,
|
|
14
|
-
env: {
|
|
15
|
-
node: true,
|
|
16
|
-
jest: true,
|
|
17
|
-
},
|
|
18
|
-
ignorePatterns: ['.eslintrc.js'],
|
|
19
|
-
rules: {
|
|
20
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
21
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
22
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
23
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
24
|
-
},
|
|
25
|
-
};
|
package/.prettierrc
DELETED