@nestjs/common 9.0.0-next.2 → 9.0.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/Readme.md +2 -0
- package/cache/cache.module.js +3 -1
- package/interfaces/nest-application-context.interface.d.ts +1 -1
- package/interfaces/version-options.interface.d.ts +1 -1
- package/package.json +1 -1
- package/pipes/file/file-type.validator.d.ts +6 -2
- package/pipes/file/file-type.validator.js +6 -2
- package/services/console-logger.service.js +2 -2
- package/services/logger.service.js +1 -1
package/Readme.md
CHANGED
|
@@ -128,6 +128,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
128
128
|
<td align="center" valign="middle"><a href="https://polygon-software.ch/" target="_blank"><img src="https://nestjs.com/img/polygon-logo.svg" width="120" valign="middle" /></a></td>
|
|
129
129
|
<td align="center" valign="middle"><a href="https://mobilereality.pl/" target="_blank"><img src="https://nestjs.com/img/mobile-reality-logo.png" width="45" valign="middle" /></a></td>
|
|
130
130
|
<td align="center" valign="middle"><a href="https://boringowl.io/" target="_blank"><img src="https://nestjs.com/img/boringowl-logo.svg" width="120" valign="middle" /></a></td>
|
|
131
|
+
<td align="center" valign="middle"><a href="https://www.mobilefactory.jp/" target="_blank"><img src="https://nestjs.com/img/mobilefactory-logo.png" width="100" valign="middle" /></a></td>
|
|
132
|
+
<td align="center" valign="middle"><a href="https://db.nordbot.app/" target="_blank"><img src="https://nestjs.com/img/nord-logo.png" width="50" valign="middle" /></a></td>
|
|
131
133
|
</tr></table>
|
|
132
134
|
|
|
133
135
|
## Backers
|
package/cache/cache.module.js
CHANGED
|
@@ -34,7 +34,9 @@ let CacheModule = class CacheModule extends cache_module_definition_1.Configurab
|
|
|
34
34
|
*/
|
|
35
35
|
static registerAsync(options) {
|
|
36
36
|
const moduleDefinition = super.registerAsync(options);
|
|
37
|
-
return Object.assign(Object.assign({ global: options.isGlobal }, moduleDefinition), { providers:
|
|
37
|
+
return Object.assign(Object.assign({ global: options.isGlobal }, moduleDefinition), { providers: options.extraProviders
|
|
38
|
+
? moduleDefinition.providers.concat(options.extraProviders)
|
|
39
|
+
: moduleDefinition.providers });
|
|
38
40
|
}
|
|
39
41
|
};
|
|
40
42
|
CacheModule = tslib_1.__decorate([
|
|
@@ -61,7 +61,7 @@ export interface INestApplicationContext {
|
|
|
61
61
|
*/
|
|
62
62
|
enableShutdownHooks(signals?: ShutdownSignal[] | string[]): this;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Initializes the Nest application.
|
|
65
65
|
* Calls the Nest lifecycle events.
|
|
66
66
|
* It isn't mandatory to call this method directly.
|
|
67
67
|
*
|
|
@@ -12,7 +12,7 @@ export declare type VersionValue = string | typeof VERSION_NEUTRAL | Array<strin
|
|
|
12
12
|
export interface VersionOptions {
|
|
13
13
|
/**
|
|
14
14
|
* Specifies an optional API Version. When configured, methods
|
|
15
|
-
*
|
|
15
|
+
* within the controller will only be routed if the request version
|
|
16
16
|
* matches the specified value.
|
|
17
17
|
*
|
|
18
18
|
* Supported only by HTTP-based applications (does not apply to non-HTTP microservices).
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { FileValidator } from './file-validator.interface';
|
|
2
2
|
export declare type FileTypeValidatorOptions = {
|
|
3
|
-
fileType: string;
|
|
3
|
+
fileType: string | RegExp;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
|
-
* Defines the built-in FileType File Validator
|
|
6
|
+
* Defines the built-in FileType File Validator. It validates incoming files mime-type
|
|
7
|
+
* matching a string or a regular expression. Note that this validator uses a naive strategy
|
|
8
|
+
* to check the mime-type and could be fooled if the client provided a file with renamed extension.
|
|
9
|
+
* (for instance, renaming a 'malicious.bat' to 'malicious.jpeg'). To handle such security issues
|
|
10
|
+
* with more reliability, consider checking against the file's [magic-numbers](https://en.wikipedia.org/wiki/Magic_number_%28programming%29)
|
|
7
11
|
*
|
|
8
12
|
* @see [File Validators](https://docs.nestjs.com/techniques/file-upload#validators)
|
|
9
13
|
*
|
|
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FileTypeValidator = void 0;
|
|
4
4
|
const file_validator_interface_1 = require("./file-validator.interface");
|
|
5
5
|
/**
|
|
6
|
-
* Defines the built-in FileType File Validator
|
|
6
|
+
* Defines the built-in FileType File Validator. It validates incoming files mime-type
|
|
7
|
+
* matching a string or a regular expression. Note that this validator uses a naive strategy
|
|
8
|
+
* to check the mime-type and could be fooled if the client provided a file with renamed extension.
|
|
9
|
+
* (for instance, renaming a 'malicious.bat' to 'malicious.jpeg'). To handle such security issues
|
|
10
|
+
* with more reliability, consider checking against the file's [magic-numbers](https://en.wikipedia.org/wiki/Magic_number_%28programming%29)
|
|
7
11
|
*
|
|
8
12
|
* @see [File Validators](https://docs.nestjs.com/techniques/file-upload#validators)
|
|
9
13
|
*
|
|
@@ -20,7 +24,7 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
|
20
24
|
if (!file.mimetype) {
|
|
21
25
|
return false;
|
|
22
26
|
}
|
|
23
|
-
return file.mimetype.
|
|
27
|
+
return Boolean(file.mimetype.match(this.validationOptions.fileType));
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
exports.FileTypeValidator = FileTypeValidator;
|
|
@@ -119,8 +119,8 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
|
119
119
|
const contextMessage = context ? (0, cli_colors_util_1.yellow)(`[${context}] `) : '';
|
|
120
120
|
const timestampDiff = this.updateAndGetTimestampDiff();
|
|
121
121
|
const formattedLogLevel = logLevel.toUpperCase().padStart(7, ' ');
|
|
122
|
-
const
|
|
123
|
-
process[writeStreamType !== null && writeStreamType !== void 0 ? writeStreamType : 'stdout'].write(
|
|
122
|
+
const formattedMessage = this.formatMessage(logLevel, message, pidMessage, formattedLogLevel, contextMessage, timestampDiff);
|
|
123
|
+
process[writeStreamType !== null && writeStreamType !== void 0 ? writeStreamType : 'stdout'].write(formattedMessage);
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
formatPid(pid) {
|
|
@@ -122,7 +122,7 @@ let Logger = Logger_1 = class Logger {
|
|
|
122
122
|
}
|
|
123
123
|
if ((0, shared_utils_1.isObject)(logger)) {
|
|
124
124
|
if (logger instanceof Logger_1 && logger.constructor !== Logger_1) {
|
|
125
|
-
const errorMessage = `Using the "extends Logger" instruction is not allowed in Nest
|
|
125
|
+
const errorMessage = `Using the "extends Logger" instruction is not allowed in Nest v9. Please, use "extends ConsoleLogger" instead.`;
|
|
126
126
|
this.staticInstanceRef.error(errorMessage);
|
|
127
127
|
throw new Error(errorMessage);
|
|
128
128
|
}
|