@nestjs/common 10.1.2 → 10.2.0

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 CHANGED
@@ -23,7 +23,7 @@
23
23
 
24
24
  ## Description
25
25
 
26
- Nest is a framework for building efficient, scalable <a href="https://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="https://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
26
+ Nest is a framework for building efficient, scalable <a href="https://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="https://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
27
27
 
28
28
  <p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also, provides compatibility with a wide range of other libraries, like e.g. <a href="https://github.com/fastify/fastify" target="_blank">Fastify</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
29
29
 
@@ -34,10 +34,10 @@ Nest is a framework for building efficient, scalable <a href="https://nodejs.org
34
34
 
35
35
  ## Getting started
36
36
 
37
- * To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
38
- * 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
39
- * [가이드](readme_kr.md) 문서는 [docs.nestjs.com](https://docs.nestjs.com)에서 확인하실 수 있습니다. :books:
40
- * [ガイド](readme_jp.md)は [docs.nestjs.com](https://docs.nestjs.com)でご確認ください。 :books:
37
+ - To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
38
+ - 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
39
+ - [가이드](readme_kr.md) 문서는 [docs.nestjs.com](https://docs.nestjs.com)에서 확인하실 수 있습니다. :books:
40
+ - [ガイド](readme_jp.md)は [docs.nestjs.com](https://docs.nestjs.com)でご確認ください。 :books:
41
41
 
42
42
  ## Questions
43
43
 
@@ -56,10 +56,13 @@ With official support, you can get expert help straight from Nest core team. We
56
56
  Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
57
57
 
58
58
  #### Principal Sponsors
59
+
59
60
  <table style="text-align:center;"><tr>
60
61
  <td><a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="200" valign="middle" /></a></td>
61
62
  <td>
62
63
  <a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="170" valign="middle" /></a></td>
64
+ <td>
65
+ <a href="https://amplication.com/" target="_blank"><img src="https://nestjs.com/img/amplication-logo.svg" width="190" valign="middle" /></a></td>
63
66
  </tr></table>
64
67
 
65
68
  #### Gold Sponsors
@@ -69,8 +72,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
69
72
  <td>
70
73
  <a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td>
71
74
  <td>
72
- <a href="https://nx.dev" target="_blank"><img src="https://nestjs.com/img/nx-logo.png" height="45" valign="middle" /></a></td><td>
73
- <a href="https://amplication.com/" target="_blank"><img src="https://nestjs.com/img/amplication-logo.svg" width="190" valign="middle" /></a></td>
75
+ <a href="https://nx.dev" target="_blank"><img src="https://nestjs.com/img/nx-logo.png" height="45" valign="middle" /></a></td>
74
76
  <td>
75
77
  <a href="https://weld.app/" target="_blank"><img src="https://nestjs.com/img/weld-logo.svg" width="140" valign="middle" /></a></td>
76
78
  <td>
@@ -86,7 +88,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
86
88
  #### Silver Sponsors
87
89
 
88
90
  <table style="text-align:center;"><tr>
89
- <td><a href="https://n.inc" target="_blank"><img src="https://nestjs.com/img/n-inc-logo.svg" width="120" valign="middle" /></td></tr>
91
+ <td><a href="https://n.inc" target="_blank"><img src="https://nestjs.com/img/n-inc-logo.svg" width="120" valign="middle" /></td>
92
+ <td><a href="https://twistag.com/" target="_blank"><img src="https://nestjs.com/img/twistag-logo.png" width="120" valign="middle" /></td></tr>
90
93
  </table>
91
94
 
92
95
  #### Sponsors
@@ -111,6 +114,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
111
114
  <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></tr><tr>
112
115
  <td align="center" valign="middle"><a href="https://doppio.sh/" target="_blank"><img src="https://nestjs.com/img/dopiosh-logo.png" width="50" valign="middle" /></a></td>
113
116
  <td align="center" valign="middle"><a href="https://www.hingehealth.com/" target="_blank"><img src="https://nestjs.com/img/hinge-health-logo.svg" width="100" valign="middle" /></a></td>
117
+ <td align="center" valign="middle"><a href="https://julienferand.dev/" target="_blank"><img src="https://nestjs.com/img/julienferand-logo.jpeg" width="65" valign="middle" /></a></td>
118
+ <td align="center" valign="middle"><a href="https://www.tripoffice.com/" target="_blank"><img src="https://nestjs.com/img/tripoffice-logo.png" width="140" valign="middle" /></a></td>
114
119
  </tr></table>
115
120
 
116
121
  ## Backers
@@ -119,9 +124,9 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
119
124
 
120
125
  ## Stay in touch
121
126
 
122
- * Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
123
- * Website - [https://nestjs.com](https://nestjs.com/)
124
- * Twitter - [@nestframework](https://twitter.com/nestframework)
127
+ - Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
128
+ - Website - [https://nestjs.com](https://nestjs.com/)
129
+ - Twitter - [@nestframework](https://twitter.com/nestframework)
125
130
 
126
131
  ## License
127
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "10.1.2",
3
+ "version": "10.2.0",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@common)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://nestjs.com",
@@ -12,7 +12,7 @@ export declare abstract class FileValidator<TValidationOptions = Record<string,
12
12
  * Indicates if this file should be considered valid, according to the options passed in the constructor.
13
13
  * @param file the file from the request object
14
14
  */
15
- abstract isValid(file?: TFile): boolean | Promise<boolean>;
15
+ abstract isValid(file?: TFile | TFile[] | Record<string, TFile[]>): boolean | Promise<boolean>;
16
16
  /**
17
17
  * Builds an error message in case the validation fails.
18
18
  * @param file the file from the request object
@@ -48,6 +48,12 @@ export declare class ConsoleLogger implements LoggerService {
48
48
  */
49
49
  verbose(message: any, context?: string): void;
50
50
  verbose(message: any, ...optionalParams: [...any, string?]): void;
51
+ /**
52
+ * Write a 'fatal' level log, if the configured level allows for it.
53
+ * Prints to `stdout` with newline.
54
+ */
55
+ fatal(message: any, context?: string): void;
56
+ fatal(message: any, ...optionalParams: [...any, string?]): void;
51
57
  /**
52
58
  * Set log levels
53
59
  * @param levels log levels
@@ -13,6 +13,7 @@ const DEFAULT_LOG_LEVELS = [
13
13
  'warn',
14
14
  'debug',
15
15
  'verbose',
16
+ 'fatal',
16
17
  ];
17
18
  const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
18
19
  year: 'numeric',
@@ -81,6 +82,16 @@ let ConsoleLogger = exports.ConsoleLogger = ConsoleLogger_1 = class ConsoleLogge
81
82
  ]);
82
83
  this.printMessages(messages, context, 'verbose');
83
84
  }
85
+ fatal(message, ...optionalParams) {
86
+ if (!this.isLevelEnabled('fatal')) {
87
+ return;
88
+ }
89
+ const { messages, context } = this.getContextAndMessagesToPrint([
90
+ message,
91
+ ...optionalParams,
92
+ ]);
93
+ this.printMessages(messages, context, 'fatal');
94
+ }
84
95
  /**
85
96
  * Set log levels
86
97
  * @param levels log levels
@@ -221,6 +232,8 @@ let ConsoleLogger = exports.ConsoleLogger = ConsoleLogger_1 = class ConsoleLogge
221
232
  return cli_colors_util_1.clc.red;
222
233
  case 'verbose':
223
234
  return cli_colors_util_1.clc.cyanBright;
235
+ case 'fatal':
236
+ return cli_colors_util_1.clc.bold;
224
237
  default:
225
238
  return cli_colors_util_1.clc.green;
226
239
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @publicApi
3
3
  */
4
- export type LogLevel = 'log' | 'error' | 'warn' | 'debug' | 'verbose';
4
+ export type LogLevel = 'log' | 'error' | 'warn' | 'debug' | 'verbose' | 'fatal';
5
5
  /**
6
6
  * @publicApi
7
7
  */
@@ -26,6 +26,10 @@ export interface LoggerService {
26
26
  * Write a 'verbose' level log.
27
27
  */
28
28
  verbose?(message: any, ...optionalParams: any[]): any;
29
+ /**
30
+ * Write a 'fatal' level log.
31
+ */
32
+ fatal?(message: any, ...optionalParams: any[]): any;
29
33
  /**
30
34
  * Set log levels.
31
35
  * @param levels log levels
@@ -87,6 +91,11 @@ export declare class Logger implements LoggerService {
87
91
  */
88
92
  verbose(message: any, context?: string): void;
89
93
  verbose(message: any, ...optionalParams: [...any, string?]): void;
94
+ /**
95
+ * Write a 'fatal' level log.
96
+ */
97
+ fatal(message: any, context?: string): void;
98
+ fatal(message: any, ...optionalParams: [...any, string?]): void;
90
99
  /**
91
100
  * Write an 'error' level log.
92
101
  */
@@ -115,6 +124,11 @@ export declare class Logger implements LoggerService {
115
124
  */
116
125
  static verbose(message: any, context?: string): void;
117
126
  static verbose(message: any, ...optionalParams: [...any, string?]): void;
127
+ /**
128
+ * Write a 'fatal' level log.
129
+ */
130
+ static fatal(message: any, context?: string): void;
131
+ static fatal(message: any, ...optionalParams: [...any, string?]): void;
118
132
  /**
119
133
  * Print buffered logs and detach buffer.
120
134
  */
@@ -66,6 +66,12 @@ let Logger = exports.Logger = Logger_1 = class Logger {
66
66
  : optionalParams;
67
67
  this.localInstance?.verbose?.(message, ...optionalParams);
68
68
  }
69
+ fatal(message, ...optionalParams) {
70
+ optionalParams = this.context
71
+ ? optionalParams.concat(this.context)
72
+ : optionalParams;
73
+ this.localInstance?.fatal?.(message, ...optionalParams);
74
+ }
69
75
  static error(message, ...optionalParams) {
70
76
  this.staticInstanceRef?.error(message, ...optionalParams);
71
77
  }
@@ -81,6 +87,9 @@ let Logger = exports.Logger = Logger_1 = class Logger {
81
87
  static verbose(message, ...optionalParams) {
82
88
  this.staticInstanceRef?.verbose?.(message, ...optionalParams);
83
89
  }
90
+ static fatal(message, ...optionalParams) {
91
+ this.staticInstanceRef?.fatal?.(message, ...optionalParams);
92
+ }
84
93
  /**
85
94
  * Print buffered logs and detach buffer.
86
95
  */
@@ -183,6 +192,12 @@ tslib_1.__decorate([
183
192
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
184
193
  tslib_1.__metadata("design:returntype", void 0)
185
194
  ], Logger.prototype, "verbose", null);
195
+ tslib_1.__decorate([
196
+ Logger_1.WrapBuffer,
197
+ tslib_1.__metadata("design:type", Function),
198
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
199
+ tslib_1.__metadata("design:returntype", void 0)
200
+ ], Logger.prototype, "fatal", null);
186
201
  tslib_1.__decorate([
187
202
  Logger_1.WrapBuffer,
188
203
  tslib_1.__metadata("design:type", Function),
@@ -213,6 +228,12 @@ tslib_1.__decorate([
213
228
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
214
229
  tslib_1.__metadata("design:returntype", void 0)
215
230
  ], Logger, "verbose", null);
231
+ tslib_1.__decorate([
232
+ Logger_1.WrapBuffer,
233
+ tslib_1.__metadata("design:type", Function),
234
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
235
+ tslib_1.__metadata("design:returntype", void 0)
236
+ ], Logger, "fatal", null);
216
237
  exports.Logger = Logger = Logger_1 = tslib_1.__decorate([
217
238
  (0, core_1.Injectable)(),
218
239
  tslib_1.__param(0, (0, core_1.Optional)()),
@@ -7,6 +7,7 @@ const LOG_LEVEL_VALUES = {
7
7
  log: 2,
8
8
  warn: 3,
9
9
  error: 4,
10
+ fatal: 5,
10
11
  };
11
12
  /**
12
13
  * Checks if target level is enabled.