@depup/nestjs__common 11.1.28-depup.0 → 11.1.29-depup.0
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/README.md +2 -2
- package/changes.json +1 -1
- package/exceptions/misdirected.exception.d.ts +1 -1
- package/exceptions/misdirected.exception.js +1 -1
- package/exceptions/not-acceptable.exception.d.ts +2 -2
- package/exceptions/not-acceptable.exception.js +2 -2
- package/interfaces/http/message-event.interface.d.ts +2 -1
- package/package.json +4 -4
- package/pipes/file/file-type.validator.d.ts +7 -0
- package/pipes/file/file-type.validator.js +3 -0
- package/pipes/parse-array.pipe.d.ts +5 -3
- package/pipes/parse-date.pipe.d.ts +6 -0
- package/pipes/parse-date.pipe.js +3 -0
- package/pipes/validation.pipe.js +4 -5
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/nestjs__common
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.1.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.1.29 |
|
|
17
|
+
| Processed | 2026-08-10 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 1 |
|
|
20
20
|
|
package/changes.json
CHANGED
|
@@ -20,7 +20,7 @@ export declare class MisdirectedException extends HttpException {
|
|
|
20
20
|
*
|
|
21
21
|
* By default, the JSON response body contains two properties:
|
|
22
22
|
* - `statusCode`: this will be the value 421.
|
|
23
|
-
* - `message`: the string `'
|
|
23
|
+
* - `message`: the string `'Misdirected'` by default; override this by supplying
|
|
24
24
|
* a string in the `objectOrError` parameter.
|
|
25
25
|
*
|
|
26
26
|
* If the parameter `objectOrError` is a string, the response body will contain an
|
|
@@ -24,7 +24,7 @@ class MisdirectedException extends http_exception_1.HttpException {
|
|
|
24
24
|
*
|
|
25
25
|
* By default, the JSON response body contains two properties:
|
|
26
26
|
* - `statusCode`: this will be the value 421.
|
|
27
|
-
* - `message`: the string `'
|
|
27
|
+
* - `message`: the string `'Misdirected'` by default; override this by supplying
|
|
28
28
|
* a string in the `objectOrError` parameter.
|
|
29
29
|
*
|
|
30
30
|
* If the parameter `objectOrError` is a string, the response body will contain an
|
|
@@ -20,8 +20,8 @@ export declare class NotAcceptableException extends HttpException {
|
|
|
20
20
|
*
|
|
21
21
|
* By default, the JSON response body contains two properties:
|
|
22
22
|
* - `statusCode`: this will be the value 406.
|
|
23
|
-
* - `
|
|
24
|
-
* a string in the `
|
|
23
|
+
* - `message`: the string `'Not Acceptable'` by default; override this by supplying
|
|
24
|
+
* a string in the `objectOrError` parameter.
|
|
25
25
|
*
|
|
26
26
|
* If the parameter `objectOrError` is a string, the response body will contain an
|
|
27
27
|
* additional property, `error`, with a short description of the HTTP error. To override the
|
|
@@ -24,8 +24,8 @@ class NotAcceptableException extends http_exception_1.HttpException {
|
|
|
24
24
|
*
|
|
25
25
|
* By default, the JSON response body contains two properties:
|
|
26
26
|
* - `statusCode`: this will be the value 406.
|
|
27
|
-
* - `
|
|
28
|
-
* a string in the `
|
|
27
|
+
* - `message`: the string `'Not Acceptable'` by default; override this by supplying
|
|
28
|
+
* a string in the `objectOrError` parameter.
|
|
29
29
|
*
|
|
30
30
|
* If the parameter `objectOrError` is a string, the response body will contain an
|
|
31
31
|
* additional property, `error`, with a short description of the HTTP error. To override the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/nestjs__common",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.29-depup.0",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common) (with updated dependencies)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"optional": true
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "03587a112ebbbb53a6bc3875afb5a9205aa5a5f1",
|
|
39
39
|
"keywords": [
|
|
40
40
|
"@nestjs/common",
|
|
41
41
|
"depup",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"depsUpdated": 1,
|
|
55
55
|
"originalPackage": "@nestjs/common",
|
|
56
|
-
"originalVersion": "11.1.
|
|
57
|
-
"processedAt": "2026-
|
|
56
|
+
"originalVersion": "11.1.29",
|
|
57
|
+
"processedAt": "2026-08-10T16:18:30.286Z",
|
|
58
58
|
"smokeTest": "passed"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -45,6 +45,13 @@ export type FileTypeValidatorOptions = {
|
|
|
45
45
|
* @default false
|
|
46
46
|
*/
|
|
47
47
|
fallbackToMimetype?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* If `true`, replaces the client-provided mimetype with the mimetype
|
|
50
|
+
* detected from the file content using magic number validation.
|
|
51
|
+
*
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
overrideMimeType?: boolean;
|
|
48
55
|
};
|
|
49
56
|
/**
|
|
50
57
|
* Defines the built-in FileTypeValidator. It validates incoming files by examining
|
|
@@ -80,6 +80,9 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
|
80
80
|
const { fileTypeFromBuffer } = await (0, load_esm_1.loadEsm)(fileTypeModule);
|
|
81
81
|
const fileType = await fileTypeFromBuffer(file.buffer);
|
|
82
82
|
if (fileType) {
|
|
83
|
+
if (this.validationOptions.overrideMimeType) {
|
|
84
|
+
file.mimetype = fileType.mime;
|
|
85
|
+
}
|
|
83
86
|
// Match detected mime type against allowed type
|
|
84
87
|
return !!fileType.mime.match(this.validationOptions.fileType);
|
|
85
88
|
}
|
|
@@ -4,7 +4,7 @@ import { ValidationPipe, ValidationPipeOptions } from './validation.pipe';
|
|
|
4
4
|
/**
|
|
5
5
|
* @publicApi
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface ParseArrayPipeOptions extends Omit<ValidationPipeOptions, 'transform' | 'validateCustomDecorators' | 'exceptionFactory'> {
|
|
8
8
|
/**
|
|
9
9
|
* Type for items to be converted into
|
|
10
10
|
*/
|
|
@@ -27,6 +27,8 @@ export interface ParseArrayOptions extends Omit<ValidationPipeOptions, 'transfor
|
|
|
27
27
|
*/
|
|
28
28
|
exceptionFactory?: (error: any) => any;
|
|
29
29
|
}
|
|
30
|
+
/** @deprecated Use `ParseArrayPipeOptions` instead. */
|
|
31
|
+
export type ParseArrayOptions = ParseArrayPipeOptions;
|
|
30
32
|
/**
|
|
31
33
|
* Defines the built-in ParseArray Pipe
|
|
32
34
|
*
|
|
@@ -35,10 +37,10 @@ export interface ParseArrayOptions extends Omit<ValidationPipeOptions, 'transfor
|
|
|
35
37
|
* @publicApi
|
|
36
38
|
*/
|
|
37
39
|
export declare class ParseArrayPipe implements PipeTransform {
|
|
38
|
-
protected readonly options:
|
|
40
|
+
protected readonly options: ParseArrayPipeOptions;
|
|
39
41
|
protected readonly validationPipe: ValidationPipe;
|
|
40
42
|
protected exceptionFactory: (error: string) => any;
|
|
41
|
-
constructor(options?:
|
|
43
|
+
constructor(options?: ParseArrayPipeOptions);
|
|
42
44
|
/**
|
|
43
45
|
* Method that accesses and performs optional transformation on argument for
|
|
44
46
|
* in-flight requests.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
|
|
2
2
|
import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
|
|
3
|
+
/**
|
|
4
|
+
* @publicApi
|
|
5
|
+
*/
|
|
3
6
|
export interface ParseDatePipeOptions {
|
|
4
7
|
/**
|
|
5
8
|
* If true, the pipe will return null or undefined if the value is not provided
|
|
@@ -22,6 +25,9 @@ export interface ParseDatePipeOptions {
|
|
|
22
25
|
*/
|
|
23
26
|
exceptionFactory?: (error: string) => any;
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* @publicApi
|
|
30
|
+
*/
|
|
25
31
|
export declare class ParseDatePipe implements PipeTransform<string | number | undefined | null> {
|
|
26
32
|
private readonly options;
|
|
27
33
|
protected exceptionFactory: (error: string) => any;
|
package/pipes/parse-date.pipe.js
CHANGED
|
@@ -6,6 +6,9 @@ const injectable_decorator_1 = require("../decorators/core/injectable.decorator"
|
|
|
6
6
|
const http_status_enum_1 = require("../enums/http-status.enum");
|
|
7
7
|
const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
|
|
8
8
|
const shared_utils_1 = require("../utils/shared.utils");
|
|
9
|
+
/**
|
|
10
|
+
* @publicApi
|
|
11
|
+
*/
|
|
9
12
|
let ParseDatePipe = class ParseDatePipe {
|
|
10
13
|
constructor(options = {}) {
|
|
11
14
|
this.options = options;
|
package/pipes/validation.pipe.js
CHANGED
|
@@ -25,7 +25,7 @@ const BUILT_IN_TYPES = [Date, RegExp, Error, Map, Set, WeakMap, WeakSet];
|
|
|
25
25
|
let ValidationPipe = class ValidationPipe {
|
|
26
26
|
constructor(options) {
|
|
27
27
|
options = options || {};
|
|
28
|
-
const { transform, disableErrorMessages, errorHttpStatusCode, expectedType, transformOptions, validateCustomDecorators, ...validatorOptions } = options;
|
|
28
|
+
const { transform, disableErrorMessages, errorHttpStatusCode, expectedType, transformOptions, exceptionFactory, validatorPackage, transformerPackage, validateCustomDecorators, ...validatorOptions } = options;
|
|
29
29
|
// @see [https://github.com/nestjs/nest/issues/10683#issuecomment-1413690508](https://github.com/nestjs/nest/issues/10683#issuecomment-1413690508)
|
|
30
30
|
this.validatorOptions = { forbidUnknownValues: false, ...validatorOptions };
|
|
31
31
|
this.isTransformEnabled = !!transform;
|
|
@@ -34,10 +34,9 @@ let ValidationPipe = class ValidationPipe {
|
|
|
34
34
|
this.validateCustomDecorators = validateCustomDecorators || false;
|
|
35
35
|
this.errorHttpStatusCode = errorHttpStatusCode || http_status_enum_1.HttpStatus.BAD_REQUEST;
|
|
36
36
|
this.expectedType = expectedType;
|
|
37
|
-
this.exceptionFactory =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
classTransformer = this.loadTransformer(options.transformerPackage);
|
|
37
|
+
this.exceptionFactory = exceptionFactory || this.createExceptionFactory();
|
|
38
|
+
classValidator = this.loadValidator(validatorPackage);
|
|
39
|
+
classTransformer = this.loadTransformer(transformerPackage);
|
|
41
40
|
}
|
|
42
41
|
loadValidator(validatorPackage) {
|
|
43
42
|
return (validatorPackage ??
|