@nestjs/common 8.4.4 → 8.4.5
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 +3 -2
- package/package.json +3 -3
- package/pipes/parse-bool.pipe.d.ts +12 -0
- package/pipes/parse-bool.pipe.js +18 -2
- package/pipes/parse-float.pipe.d.ts +5 -0
- package/pipes/parse-float.pipe.js +10 -4
- package/pipes/parse-int.pipe.d.ts +5 -0
- package/pipes/parse-int.pipe.js +10 -4
package/Readme.md
CHANGED
|
@@ -72,11 +72,12 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
72
72
|
|
|
73
73
|
<table style="text-align:center;"><tr><td>
|
|
74
74
|
<a href="https://careers.labster.com/departments/platform" target="_blank"><img src="https://nestjs.com/img/labster-logo.png" width="170" valign="middle" /></a></td><td>
|
|
75
|
-
<a href="https://weld.app/" target="_blank"><img src="https://nestjs.com/img/weld-logo.svg" width="
|
|
75
|
+
<a href="https://weld.app/" target="_blank"><img src="https://nestjs.com/img/weld-logo.svg" width="140" valign="middle" /></a></td>
|
|
76
76
|
<td>
|
|
77
77
|
<a href="https://intrinsic.ventures/" target="_blank"><img src="https://nestjs.com/img/intrinisic-logo.png" width="210" valign="middle" /></a></td>
|
|
78
78
|
<td>
|
|
79
|
-
<a href="https://jetbrains.com/" target="_blank"><img src="https://nestjs.com/img/jetbrains-logo.svg" width="110" valign="middle" /></a></td
|
|
79
|
+
<a href="https://jetbrains.com/" target="_blank"><img src="https://nestjs.com/img/jetbrains-logo.svg" width="110" valign="middle" /></a></td><td>
|
|
80
|
+
<a href="https://snyk.co/nestjs" target="_blank"><img src="https://nestjs.com/img/snyk-logo-black.png" width="185" valign="middle" /></a></td></</tr></table>
|
|
80
81
|
|
|
81
82
|
#### Silver Sponsors
|
|
82
83
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/common",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.5",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"axios": "0.
|
|
20
|
+
"axios": "0.27.2",
|
|
21
21
|
"iterare": "1.2.1",
|
|
22
|
-
"tslib": "2.
|
|
22
|
+
"tslib": "2.4.0",
|
|
23
23
|
"uuid": "8.3.2"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
@@ -22,4 +22,16 @@ export declare class ParseBoolPipe implements PipeTransform<string | boolean, Pr
|
|
|
22
22
|
* @param metadata contains metadata about the currently processed route argument
|
|
23
23
|
*/
|
|
24
24
|
transform(value: string | boolean, metadata: ArgumentMetadata): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* @param value currently processed route argument
|
|
27
|
+
* @returns `true` if `value` is said 'true', ie., if it is equal to the boolean
|
|
28
|
+
* `true` or the string `"true"`
|
|
29
|
+
*/
|
|
30
|
+
protected isTrue(value: string | boolean): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @param value currently processed route argument
|
|
33
|
+
* @returns `true` if `value` is said 'false', ie., if it is equal to the boolean
|
|
34
|
+
* `false` or the string `"false"`
|
|
35
|
+
*/
|
|
36
|
+
protected isFalse(value: string | boolean): boolean;
|
|
25
37
|
}
|
package/pipes/parse-bool.pipe.js
CHANGED
|
@@ -29,14 +29,30 @@ let ParseBoolPipe = class ParseBoolPipe {
|
|
|
29
29
|
* @param metadata contains metadata about the currently processed route argument
|
|
30
30
|
*/
|
|
31
31
|
async transform(value, metadata) {
|
|
32
|
-
if (value
|
|
32
|
+
if (this.isTrue(value)) {
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
|
-
if (value
|
|
35
|
+
if (this.isFalse(value)) {
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
38
|
throw this.exceptionFactory('Validation failed (boolean string is expected)');
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @param value currently processed route argument
|
|
42
|
+
* @returns `true` if `value` is said 'true', ie., if it is equal to the boolean
|
|
43
|
+
* `true` or the string `"true"`
|
|
44
|
+
*/
|
|
45
|
+
isTrue(value) {
|
|
46
|
+
return value === true || value === 'true';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @param value currently processed route argument
|
|
50
|
+
* @returns `true` if `value` is said 'false', ie., if it is equal to the boolean
|
|
51
|
+
* `false` or the string `"false"`
|
|
52
|
+
*/
|
|
53
|
+
isFalse(value) {
|
|
54
|
+
return value === false || value === 'false';
|
|
55
|
+
}
|
|
40
56
|
};
|
|
41
57
|
ParseBoolPipe = tslib_1.__decorate([
|
|
42
58
|
(0, injectable_decorator_1.Injectable)(),
|
|
@@ -23,4 +23,9 @@ export declare class ParseFloatPipe implements PipeTransform<string> {
|
|
|
23
23
|
* @param metadata contains metadata about the currently processed route argument
|
|
24
24
|
*/
|
|
25
25
|
transform(value: string, metadata: ArgumentMetadata): Promise<number>;
|
|
26
|
+
/**
|
|
27
|
+
* @param value currently processed route argument
|
|
28
|
+
* @returns `true` if `value` is a valid float number
|
|
29
|
+
*/
|
|
30
|
+
protected isNumeric(value: string): boolean;
|
|
26
31
|
}
|
|
@@ -27,14 +27,20 @@ let ParseFloatPipe = class ParseFloatPipe {
|
|
|
27
27
|
* @param metadata contains metadata about the currently processed route argument
|
|
28
28
|
*/
|
|
29
29
|
async transform(value, metadata) {
|
|
30
|
-
|
|
31
|
-
!isNaN(parseFloat(value)) &&
|
|
32
|
-
isFinite(value);
|
|
33
|
-
if (!isNumeric) {
|
|
30
|
+
if (!this.isNumeric(value)) {
|
|
34
31
|
throw this.exceptionFactory('Validation failed (numeric string is expected)');
|
|
35
32
|
}
|
|
36
33
|
return parseFloat(value);
|
|
37
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* @param value currently processed route argument
|
|
37
|
+
* @returns `true` if `value` is a valid float number
|
|
38
|
+
*/
|
|
39
|
+
isNumeric(value) {
|
|
40
|
+
return (['string', 'number'].includes(typeof value) &&
|
|
41
|
+
!isNaN(parseFloat(value)) &&
|
|
42
|
+
isFinite(value));
|
|
43
|
+
}
|
|
38
44
|
};
|
|
39
45
|
ParseFloatPipe = tslib_1.__decorate([
|
|
40
46
|
(0, index_1.Injectable)(),
|
|
@@ -22,4 +22,9 @@ export declare class ParseIntPipe implements PipeTransform<string> {
|
|
|
22
22
|
* @param metadata contains metadata about the currently processed route argument
|
|
23
23
|
*/
|
|
24
24
|
transform(value: string, metadata: ArgumentMetadata): Promise<number>;
|
|
25
|
+
/**
|
|
26
|
+
* @param value currently processed route argument
|
|
27
|
+
* @returns `true` if `value` is a valid integer number
|
|
28
|
+
*/
|
|
29
|
+
protected isNumeric(value: string): boolean;
|
|
25
30
|
}
|
package/pipes/parse-int.pipe.js
CHANGED
|
@@ -29,14 +29,20 @@ let ParseIntPipe = class ParseIntPipe {
|
|
|
29
29
|
* @param metadata contains metadata about the currently processed route argument
|
|
30
30
|
*/
|
|
31
31
|
async transform(value, metadata) {
|
|
32
|
-
|
|
33
|
-
/^-?\d+$/.test(value) &&
|
|
34
|
-
isFinite(value);
|
|
35
|
-
if (!isNumeric) {
|
|
32
|
+
if (!this.isNumeric(value)) {
|
|
36
33
|
throw this.exceptionFactory('Validation failed (numeric string is expected)');
|
|
37
34
|
}
|
|
38
35
|
return parseInt(value, 10);
|
|
39
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* @param value currently processed route argument
|
|
39
|
+
* @returns `true` if `value` is a valid integer number
|
|
40
|
+
*/
|
|
41
|
+
isNumeric(value) {
|
|
42
|
+
return (['string', 'number'].includes(typeof value) &&
|
|
43
|
+
/^-?\d+$/.test(value) &&
|
|
44
|
+
isFinite(value));
|
|
45
|
+
}
|
|
40
46
|
};
|
|
41
47
|
ParseIntPipe = tslib_1.__decorate([
|
|
42
48
|
(0, injectable_decorator_1.Injectable)(),
|