@nestjs/common 9.4.0 → 9.4.1
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 -3
- package/interfaces/external/validator-options.interface.d.ts +2 -1
- package/interfaces/http/http-exception-body.interface.d.ts +6 -0
- package/interfaces/http/http-exception-body.interface.js +2 -0
- package/package.json +3 -2
- package/pipes/file/interfaces/file.interface.d.ts +4 -0
- package/pipes/file/interfaces/file.interface.js +2 -0
- package/pipes/file/interfaces/index.d.ts +1 -0
- package/pipes/file/interfaces/index.js +4 -0
- package/pipes/file/max-file-size.validator.d.ts +1 -0
- package/pipes/file/max-file-size.validator.js +6 -0
- package/pipes/parse-float.pipe.js +3 -2
- package/services/console-logger.service.d.ts +2 -0
- package/services/console-logger.service.js +18 -0
- package/services/logger.service.d.ts +1 -0
- package/utils/select-exception-filter-metadata.util.d.ts +2 -0
- package/utils/select-exception-filter-metadata.util.js +6 -0
package/Readme.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="
|
|
2
|
+
<a href="https://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
|
6
6
|
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
|
7
7
|
|
|
8
|
-
<p align="center">A progressive <a href="
|
|
8
|
+
<p align="center">A progressive <a href="https://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
11
11
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
@@ -132,7 +132,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
132
132
|
<td align="center" valign="middle"><a href="https://klqc.de" target="_blank"><img src="https://nestjs.com/img/klcqcl-logo.png" width="120" valign="middle" /></a></td>
|
|
133
133
|
<td align="center" valign="middle"><a href="https://thecasinowizard.com/bonuses/no-deposit-bonuses/" target="_blank"><img src="https://nestjs.com/img/casinowizard-logo.png" width="120" valign="middle" /></a></td></tr><tr>
|
|
134
134
|
<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>
|
|
135
|
-
<td align="center" valign="middle"><a href="https://
|
|
135
|
+
<td align="center" valign="middle"><a href="https://themobilereality.com/" target="_blank"><img src="https://nestjs.com/img/mobile-reality-logo.png" width="45" valign="middle" /></a></td>
|
|
136
136
|
<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>
|
|
137
137
|
<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>
|
|
138
138
|
<td align="center" valign="middle"><a href="https://nordbot.app/" target="_blank"><img src="https://nestjs.com/img/nordbot-logo.png" width="120" valign="middle" /></a></td>
|
|
@@ -69,7 +69,8 @@ export interface ValidatorOptions {
|
|
|
69
69
|
*/
|
|
70
70
|
forbidUnknownValues?: boolean;
|
|
71
71
|
/**
|
|
72
|
-
* When set to true, validation of the given property will stop after encountering the first error.
|
|
72
|
+
* When set to true, validation of the given property will stop after encountering the first error.
|
|
73
|
+
* This is enabled by default.
|
|
73
74
|
*/
|
|
74
75
|
stopAtFirstError?: boolean;
|
|
75
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/common",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/nestjs/nest"
|
|
13
|
+
"url": "https://github.com/nestjs/nest.git",
|
|
14
|
+
"directory": "packages/common"
|
|
14
15
|
},
|
|
15
16
|
"publishConfig": {
|
|
16
17
|
"access": "public"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file.interface';
|
|
@@ -11,6 +11,12 @@ const file_validator_interface_1 = require("./file-validator.interface");
|
|
|
11
11
|
*/
|
|
12
12
|
class MaxFileSizeValidator extends file_validator_interface_1.FileValidator {
|
|
13
13
|
buildErrorMessage() {
|
|
14
|
+
if ('message' in this.validationOptions) {
|
|
15
|
+
if (typeof this.validationOptions.message === 'function') {
|
|
16
|
+
return this.validationOptions.message(this.validationOptions.maxSize);
|
|
17
|
+
}
|
|
18
|
+
return this.validationOptions.message;
|
|
19
|
+
}
|
|
14
20
|
return `Validation failed (expected size is less than ${this.validationOptions.maxSize})`;
|
|
15
21
|
}
|
|
16
22
|
isValid(file) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ParseFloatPipe = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const index_1 = require("../index");
|
|
6
|
+
const core_1 = require("../decorators/core");
|
|
6
7
|
const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
|
|
7
8
|
/**
|
|
8
9
|
* Defines the built-in ParseFloat Pipe
|
|
@@ -43,8 +44,8 @@ let ParseFloatPipe = class ParseFloatPipe {
|
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
ParseFloatPipe = tslib_1.__decorate([
|
|
46
|
-
(0,
|
|
47
|
-
tslib_1.__param(0, (0,
|
|
47
|
+
(0, core_1.Injectable)(),
|
|
48
|
+
tslib_1.__param(0, (0, core_1.Optional)()),
|
|
48
49
|
tslib_1.__metadata("design:paramtypes", [Object])
|
|
49
50
|
], ParseFloatPipe);
|
|
50
51
|
exports.ParseFloatPipe = ParseFloatPipe;
|
|
@@ -27,6 +27,7 @@ export declare class ConsoleLogger implements LoggerService {
|
|
|
27
27
|
* Write an 'error' level log, if the configured level allows for it.
|
|
28
28
|
* Prints to `stderr` with newline.
|
|
29
29
|
*/
|
|
30
|
+
error(message: any, stackOrContext?: string): void;
|
|
30
31
|
error(message: any, stack?: string, context?: string): void;
|
|
31
32
|
error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
|
32
33
|
/**
|
|
@@ -74,5 +75,6 @@ export declare class ConsoleLogger implements LoggerService {
|
|
|
74
75
|
protected formatTimestampDiff(timestampDiff: number): string;
|
|
75
76
|
private getContextAndMessagesToPrint;
|
|
76
77
|
private getContextAndStackAndMessagesToPrint;
|
|
78
|
+
private isStackFormat;
|
|
77
79
|
private getColorByLogLevel;
|
|
78
80
|
}
|
|
@@ -179,6 +179,18 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
getContextAndStackAndMessagesToPrint(args) {
|
|
182
|
+
if (args.length === 2) {
|
|
183
|
+
return this.isStackFormat(args[1])
|
|
184
|
+
? {
|
|
185
|
+
messages: [args[0]],
|
|
186
|
+
stack: args[1],
|
|
187
|
+
context: this.context,
|
|
188
|
+
}
|
|
189
|
+
: {
|
|
190
|
+
messages: [args[0]],
|
|
191
|
+
context: args[1],
|
|
192
|
+
};
|
|
193
|
+
}
|
|
182
194
|
const { messages, context } = this.getContextAndMessagesToPrint(args);
|
|
183
195
|
if ((messages === null || messages === void 0 ? void 0 : messages.length) <= 1) {
|
|
184
196
|
return { messages, context };
|
|
@@ -195,6 +207,12 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
|
195
207
|
context,
|
|
196
208
|
};
|
|
197
209
|
}
|
|
210
|
+
isStackFormat(stack) {
|
|
211
|
+
if (!(0, shared_utils_1.isString)(stack) && !(0, shared_utils_1.isUndefined)(stack)) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
return /^(.)+\n\s+at .+:\d+:\d+$/.test(stack);
|
|
215
|
+
}
|
|
198
216
|
getColorByLogLevel(level) {
|
|
199
217
|
switch (level) {
|
|
200
218
|
case 'debug':
|
|
@@ -90,6 +90,7 @@ export declare class Logger implements LoggerService {
|
|
|
90
90
|
/**
|
|
91
91
|
* Write an 'error' level log.
|
|
92
92
|
*/
|
|
93
|
+
static error(message: any, stackOrContext?: string): void;
|
|
93
94
|
static error(message: any, context?: string): void;
|
|
94
95
|
static error(message: any, stack?: string, context?: string): void;
|
|
95
96
|
static error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectExceptionFilterMetadata = void 0;
|
|
4
|
+
const selectExceptionFilterMetadata = (filters, exception) => filters.find(({ exceptionMetatypes }) => !exceptionMetatypes.length ||
|
|
5
|
+
exceptionMetatypes.some(ExceptionMetaType => exception instanceof ExceptionMetaType));
|
|
6
|
+
exports.selectExceptionFilterMetadata = selectExceptionFilterMetadata;
|