@nestjs/common 9.3.0 → 9.3.2
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/constants.d.ts +1 -1
- package/exceptions/http.exception.js +2 -2
- package/index.js +1 -1
- package/package.json +2 -2
- package/pipes/file/parse-file.pipe.js +4 -7
- package/pipes/validation.pipe.js +2 -1
package/constants.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const ENHANCER_KEY_TO_SUBTYPE_MAP: {
|
|
|
31
31
|
readonly __pipes__: "pipe";
|
|
32
32
|
readonly __exceptionFilters__: "filter";
|
|
33
33
|
};
|
|
34
|
-
export type EnhancerSubtype = typeof ENHANCER_KEY_TO_SUBTYPE_MAP[keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP];
|
|
34
|
+
export type EnhancerSubtype = (typeof ENHANCER_KEY_TO_SUBTYPE_MAP)[keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP];
|
|
35
35
|
export declare const RENDER_METADATA = "__renderTemplate__";
|
|
36
36
|
export declare const HTTP_CODE_METADATA = "__httpCode__";
|
|
37
37
|
export declare const MODULE_PATH = "__module_path__";
|
|
@@ -85,8 +85,8 @@ class HttpException extends Error {
|
|
|
85
85
|
this.message = this.response.message;
|
|
86
86
|
}
|
|
87
87
|
else if (this.constructor) {
|
|
88
|
-
this.message =
|
|
89
|
-
.match(/[A-Z][a-z]+|[0-9]+/g)) === null || _a === void 0 ? void 0 : _a.join(' ')) !== null && _b !== void 0 ? _b : 'Error';
|
|
88
|
+
this.message =
|
|
89
|
+
(_b = (_a = this.constructor.name.match(/[A-Z][a-z]+|[0-9]+/g)) === null || _a === void 0 ? void 0 : _a.join(' ')) !== null && _b !== void 0 ? _b : 'Error';
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
initName() {
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/common",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.2",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"iterare": "1.2.1",
|
|
21
|
-
"tslib": "2.
|
|
21
|
+
"tslib": "2.5.0",
|
|
22
22
|
"uid": "2.0.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const core_1 = require("../../decorators/core");
|
|
6
6
|
const enums_1 = require("../../enums");
|
|
7
7
|
const http_error_by_code_util_1 = require("../../utils/http-error-by-code.util");
|
|
8
|
-
const
|
|
8
|
+
const shared_utils_1 = require("../../utils/shared.utils");
|
|
9
9
|
/**
|
|
10
10
|
* Defines the built-in ParseFile Pipe. This pipe can be used to validate incoming files
|
|
11
11
|
* with `@UploadedFile()` decorator. You can use either other specific built-in validators
|
|
@@ -46,12 +46,9 @@ let ParseFilePipe = class ParseFilePipe {
|
|
|
46
46
|
return Promise.all(files.map(f => this.validate(f)));
|
|
47
47
|
}
|
|
48
48
|
thereAreNoFilesIn(value) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
else {
|
|
53
|
-
return (0, class_validator_1.isEmpty)(value);
|
|
54
|
-
}
|
|
49
|
+
const isEmptyArray = Array.isArray(value) && (0, shared_utils_1.isEmpty)(value);
|
|
50
|
+
const isEmptyObject = (0, shared_utils_1.isObject)(value) && (0, shared_utils_1.isEmpty)(Object.keys(value));
|
|
51
|
+
return (0, shared_utils_1.isUndefined)(value) || isEmptyArray || isEmptyObject;
|
|
55
52
|
}
|
|
56
53
|
async validate(file) {
|
|
57
54
|
for (const validator of this.validators) {
|
package/pipes/validation.pipe.js
CHANGED
|
@@ -21,8 +21,9 @@ let ValidationPipe = class ValidationPipe {
|
|
|
21
21
|
constructor(options) {
|
|
22
22
|
options = options || {};
|
|
23
23
|
const { transform, disableErrorMessages, errorHttpStatusCode, expectedType, transformOptions, validateCustomDecorators } = options, validatorOptions = tslib_1.__rest(options, ["transform", "disableErrorMessages", "errorHttpStatusCode", "expectedType", "transformOptions", "validateCustomDecorators"]);
|
|
24
|
+
// @see https://github.com/nestjs/nest/issues/10683#issuecomment-1413690508
|
|
25
|
+
this.validatorOptions = Object.assign({ forbidUnknownValues: false }, validatorOptions);
|
|
24
26
|
this.isTransformEnabled = !!transform;
|
|
25
|
-
this.validatorOptions = validatorOptions;
|
|
26
27
|
this.transformOptions = transformOptions;
|
|
27
28
|
this.isDetailedOutputDisabled = disableErrorMessages;
|
|
28
29
|
this.validateCustomDecorators = validateCustomDecorators || false;
|