@nestjs/common 11.0.16 → 11.0.18
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/common",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.18",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"file-type": "20.4.1",
|
|
21
22
|
"iterare": "1.2.1",
|
|
22
23
|
"tslib": "2.8.1",
|
|
23
24
|
"uid": "2.0.2"
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"class-transformer": "*",
|
|
27
28
|
"class-validator": "*",
|
|
28
|
-
"file-type": "^20.4.1",
|
|
29
29
|
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
30
30
|
"rxjs": "^7.1.0"
|
|
31
31
|
},
|
|
@@ -19,6 +19,7 @@ export type FileTypeValidatorOptions = {
|
|
|
19
19
|
* @publicApi
|
|
20
20
|
*/
|
|
21
21
|
export declare class FileTypeValidator extends FileValidator<FileTypeValidatorOptions, IFile> {
|
|
22
|
+
constructor(validationOptions: FileTypeValidatorOptions);
|
|
22
23
|
buildErrorMessage(file?: IFile): string;
|
|
23
24
|
isValid(file?: IFile): Promise<boolean>;
|
|
24
25
|
}
|
|
@@ -12,6 +12,16 @@ const file_validator_interface_1 = require("./file-validator.interface");
|
|
|
12
12
|
* @publicApi
|
|
13
13
|
*/
|
|
14
14
|
class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
15
|
+
constructor(validationOptions) {
|
|
16
|
+
super(validationOptions);
|
|
17
|
+
// check if file-type is installed
|
|
18
|
+
try {
|
|
19
|
+
require.resolve('file-type');
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
throw new Error(`FileTypeValidator requires the file-type package. Please install it: npm i file-type`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
15
25
|
buildErrorMessage(file) {
|
|
16
26
|
if (file?.mimetype) {
|
|
17
27
|
return `Validation failed (current file type is ${file.mimetype}, expected type is ${this.validationOptions.fileType})`;
|