@nestjs/common 12.1.1 → 12.1.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.
|
@@ -32,7 +32,10 @@ export class StreamableFile {
|
|
|
32
32
|
this.stream = new Readable();
|
|
33
33
|
this.stream.push(bufferOrReadStream);
|
|
34
34
|
this.stream.push(null);
|
|
35
|
-
this.options
|
|
35
|
+
this.options = {
|
|
36
|
+
...this.options,
|
|
37
|
+
length: this.options.length ?? bufferOrReadStream.length,
|
|
38
|
+
};
|
|
36
39
|
}
|
|
37
40
|
else if (bufferOrReadStream.pipe && isFunction(bufferOrReadStream.pipe)) {
|
|
38
41
|
this.stream = bufferOrReadStream;
|
|
@@ -57,19 +57,19 @@ export interface INestApplicationContext {
|
|
|
57
57
|
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options?: GetOrResolveOptions): TResult | Array<TResult>;
|
|
58
58
|
/**
|
|
59
59
|
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
60
|
-
* @returns {
|
|
60
|
+
* @returns {Promise<TResult>}
|
|
61
61
|
*/
|
|
62
62
|
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): Promise<TResult>;
|
|
63
63
|
/**
|
|
64
64
|
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
65
|
-
* @returns {
|
|
65
|
+
* @returns {Promise<TResult>}
|
|
66
66
|
*/
|
|
67
67
|
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
68
68
|
id: number;
|
|
69
69
|
}): Promise<TResult>;
|
|
70
70
|
/**
|
|
71
71
|
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
72
|
-
* @returns {
|
|
72
|
+
* @returns {Promise<TResult>}
|
|
73
73
|
*/
|
|
74
74
|
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
75
75
|
id: number;
|
|
@@ -79,7 +79,7 @@ export interface INestApplicationContext {
|
|
|
79
79
|
}): Promise<TResult>;
|
|
80
80
|
/**
|
|
81
81
|
* Resolves transient or request-scoped instances of either injectables or controllers, otherwise, throws exception.
|
|
82
|
-
* @returns {Array<TResult
|
|
82
|
+
* @returns {Promise<Array<TResult>>}
|
|
83
83
|
*/
|
|
84
84
|
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
85
85
|
id: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/common",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.2",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"optional": true
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "8ab60aa1b2927fbe0e23135ffc65d610c623236a"
|
|
51
51
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface.js';
|
|
2
2
|
import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util.js';
|
|
3
|
+
/**
|
|
4
|
+
* @publicApi
|
|
5
|
+
*/
|
|
6
|
+
export type UUIDVersion = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 'all';
|
|
3
7
|
/**
|
|
4
8
|
* @publicApi
|
|
5
9
|
*/
|
|
@@ -7,7 +11,7 @@ export interface ParseUUIDPipeOptions {
|
|
|
7
11
|
/**
|
|
8
12
|
* UUID version to validate
|
|
9
13
|
*/
|
|
10
|
-
version?:
|
|
14
|
+
version?: UUIDVersion;
|
|
11
15
|
/**
|
|
12
16
|
* The HTTP status code to be used in the response when the validation fails.
|
|
13
17
|
*/
|
|
@@ -34,16 +38,10 @@ export interface ParseUUIDPipeOptions {
|
|
|
34
38
|
*/
|
|
35
39
|
export declare class ParseUUIDPipe implements PipeTransform {
|
|
36
40
|
protected readonly options?: ParseUUIDPipeOptions | undefined;
|
|
37
|
-
protected static uuidRegExps:
|
|
38
|
-
3: RegExp;
|
|
39
|
-
4: RegExp;
|
|
40
|
-
5: RegExp;
|
|
41
|
-
7: RegExp;
|
|
42
|
-
all: RegExp;
|
|
43
|
-
};
|
|
41
|
+
protected static uuidRegExps: Record<UUIDVersion, RegExp>;
|
|
44
42
|
private readonly version;
|
|
45
43
|
protected exceptionFactory: (errors: string) => any;
|
|
46
44
|
constructor(options?: ParseUUIDPipeOptions | undefined);
|
|
47
45
|
transform(value: unknown, metadata: ArgumentMetadata): Promise<string | undefined | null>;
|
|
48
|
-
protected isUUID(str: unknown, version?:
|
|
46
|
+
protected isUUID(str: unknown, version?: UUIDVersion): boolean;
|
|
49
47
|
}
|
package/pipes/parse-uuid.pipe.js
CHANGED
|
@@ -16,10 +16,14 @@ let ParseUUIDPipe = class ParseUUIDPipe {
|
|
|
16
16
|
static { ParseUUIDPipe_1 = this; }
|
|
17
17
|
options;
|
|
18
18
|
static uuidRegExps = {
|
|
19
|
+
1: /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
20
|
+
2: /^[0-9A-F]{8}-[0-9A-F]{4}-2[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
19
21
|
3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
20
22
|
4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
21
23
|
5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
24
|
+
6: /^[0-9A-F]{8}-[0-9A-F]{4}-6[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
22
25
|
7: /^[0-9A-F]{8}-[0-9A-F]{4}-7[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
26
|
+
8: /^[0-9A-F]{8}-[0-9A-F]{4}-8[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
23
27
|
// Versions 1-8 with the RFC variant, or the Nil and Max UUIDs (RFC 9562, sections 5.9, 5.10)
|
|
24
28
|
all: /^(?:[0-9A-F]{8}-[0-9A-F]{4}-[1-8][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}|00000000-0000-0000-0000-000000000000|FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF)$/i,
|
|
25
29
|
};
|
|
@@ -39,7 +43,7 @@ let ParseUUIDPipe = class ParseUUIDPipe {
|
|
|
39
43
|
return value;
|
|
40
44
|
}
|
|
41
45
|
if (!this.isUUID(value, this.version)) {
|
|
42
|
-
throw this.exceptionFactory(`Validation failed (uuid${this.version ? ` v ${this.version}` : ''} is expected)`);
|
|
46
|
+
throw this.exceptionFactory(`Validation failed (uuid${this.version && this.version !== 'all' ? ` v ${this.version}` : ''} is expected)`);
|
|
43
47
|
}
|
|
44
48
|
return value;
|
|
45
49
|
}
|