@nestjs/common 10.3.3 → 10.3.4

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
@@ -25,12 +25,12 @@
25
25
 
26
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
- <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>
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 <a href="https://github.com/fastify/fastify" target="_blank">Fastify</a>, allowing for easy use of the myriad of third-party plugins which are available.</p>
29
29
 
30
30
  ## Philosophy
31
31
 
32
- <p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front and backend applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a> and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a> which improve developer productivity and enable the construction of fast, testable, extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers and tools for Node, none of them effectively solve the main problem - the architecture.</p>
33
- <p>Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, loosely coupled and easily maintainable applications. The architecture is heavily inspired by Angular.</p>
32
+ <p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front and backend applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a>, and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a>, which improve developer productivity and enable the construction of fast, testable, and extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers, and tools for Node, none of them effectively solve the main problem - the architecture.</p>
33
+ <p>Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, and loosely coupled and easily maintainable applications. The architecture is heavily inspired by Angular.</p>
34
34
 
35
35
  ## Getting started
36
36
 
@@ -93,7 +93,6 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
93
93
  <table style="text-align:center;"><tr>
94
94
  <td><a href="https://n.inc" target="_blank"><img src="https://nestjs.com/img/n-inc-logo.svg" width="120" valign="middle" /></td>
95
95
  <td><a href="https://twistag.com/" target="_blank"><img src="https://nestjs.com/img/twistag-logo.png" width="120" valign="middle" /></td>
96
- <td><a href="https://immediateedgeapp.org/" target="_blank"><img src="https://nestjs.com/img/immediate-edge-logo.png" width="120" valign="middle" /></td>
97
96
  </tr>
98
97
  </table>
99
98
 
@@ -6,6 +6,7 @@ export type ParamDecoratorEnhancer = ParameterDecorator;
6
6
  * Defines HTTP route param decorator
7
7
  *
8
8
  * @param factory
9
+ * @param enhancers
9
10
  *
10
11
  * @publicApi
11
12
  */
@@ -9,6 +9,7 @@ const shared_utils_1 = require("../../utils/shared.utils");
9
9
  * Defines HTTP route param decorator
10
10
  *
11
11
  * @param factory
12
+ * @param enhancers
12
13
  *
13
14
  * @publicApi
14
15
  */
@@ -287,6 +287,21 @@ export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]):
287
287
  * @publicApi
288
288
  */
289
289
  export declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
290
+ /**
291
+ * Route handler parameter decorator. Extracts the `rawBody` Buffer
292
+ * property from the `req` object and populates the decorated parameter with that value.
293
+ *
294
+ * For example:
295
+ * ```typescript
296
+ * async create(@RawBody() rawBody: Buffer | undefined)
297
+ * ```
298
+ *
299
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
300
+ * @see [Raw body](https://docs.nestjs.com/faq/raw-body)
301
+ *
302
+ * @publicApi
303
+ */
304
+ export declare function RawBody(): ParameterDecorator;
290
305
  /**
291
306
  * Route handler parameter decorator. Extracts the `params`
292
307
  * property from the `req` object and populates the decorated
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Res = exports.Req = exports.HostParam = exports.Param = exports.Body = exports.Query = exports.Headers = exports.UploadedFiles = exports.UploadedFile = exports.Session = exports.Ip = exports.Next = exports.Response = exports.Request = exports.assignMetadata = void 0;
3
+ exports.Res = exports.Req = exports.HostParam = exports.Param = exports.RawBody = exports.Body = exports.Query = exports.Headers = exports.UploadedFiles = exports.UploadedFile = exports.Session = exports.Ip = exports.Next = exports.Response = exports.Request = exports.assignMetadata = void 0;
4
4
  const constants_1 = require("../../constants");
5
5
  const route_paramtypes_enum_1 = require("../../enums/route-paramtypes.enum");
6
6
  const shared_utils_1 = require("../../utils/shared.utils");
@@ -184,6 +184,29 @@ function Body(property, ...pipes) {
184
184
  return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.BODY)(property, ...pipes);
185
185
  }
186
186
  exports.Body = Body;
187
+ /**
188
+ * Route handler parameter decorator. Extracts the `rawBody` Buffer
189
+ * property from the `req` object and populates the decorated parameter with that value.
190
+ * Also applies pipes to the bound rawBody parameter.
191
+ *
192
+ * For example:
193
+ * ```typescript
194
+ * async create(@RawBody(new ValidationPipe()) rawBody: Buffer)
195
+ * ```
196
+ *
197
+ * @param pipes one or more pipes - either instances or classes - to apply to
198
+ * the bound body parameter.
199
+ *
200
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
201
+ * @see [Raw body](https://docs.nestjs.com/faq/raw-body)
202
+ * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
203
+ *
204
+ * @publicApi
205
+ */
206
+ function RawBody(...pipes) {
207
+ return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.RAW_BODY)(undefined, ...pipes);
208
+ }
209
+ exports.RawBody = RawBody;
187
210
  /**
188
211
  * Route handler parameter decorator. Extracts the `params`
189
212
  * property from the `req` object and populates the decorated
@@ -3,12 +3,13 @@ export declare enum RouteParamtypes {
3
3
  RESPONSE = 1,
4
4
  NEXT = 2,
5
5
  BODY = 3,
6
- QUERY = 4,
7
- PARAM = 5,
8
- HEADERS = 6,
9
- SESSION = 7,
10
- FILE = 8,
11
- FILES = 9,
12
- HOST = 10,
13
- IP = 11
6
+ RAW_BODY = 4,
7
+ QUERY = 5,
8
+ PARAM = 6,
9
+ HEADERS = 7,
10
+ SESSION = 8,
11
+ FILE = 9,
12
+ FILES = 10,
13
+ HOST = 11,
14
+ IP = 12
14
15
  }
@@ -7,12 +7,13 @@ var RouteParamtypes;
7
7
  RouteParamtypes[RouteParamtypes["RESPONSE"] = 1] = "RESPONSE";
8
8
  RouteParamtypes[RouteParamtypes["NEXT"] = 2] = "NEXT";
9
9
  RouteParamtypes[RouteParamtypes["BODY"] = 3] = "BODY";
10
- RouteParamtypes[RouteParamtypes["QUERY"] = 4] = "QUERY";
11
- RouteParamtypes[RouteParamtypes["PARAM"] = 5] = "PARAM";
12
- RouteParamtypes[RouteParamtypes["HEADERS"] = 6] = "HEADERS";
13
- RouteParamtypes[RouteParamtypes["SESSION"] = 7] = "SESSION";
14
- RouteParamtypes[RouteParamtypes["FILE"] = 8] = "FILE";
15
- RouteParamtypes[RouteParamtypes["FILES"] = 9] = "FILES";
16
- RouteParamtypes[RouteParamtypes["HOST"] = 10] = "HOST";
17
- RouteParamtypes[RouteParamtypes["IP"] = 11] = "IP";
10
+ RouteParamtypes[RouteParamtypes["RAW_BODY"] = 4] = "RAW_BODY";
11
+ RouteParamtypes[RouteParamtypes["QUERY"] = 5] = "QUERY";
12
+ RouteParamtypes[RouteParamtypes["PARAM"] = 6] = "PARAM";
13
+ RouteParamtypes[RouteParamtypes["HEADERS"] = 7] = "HEADERS";
14
+ RouteParamtypes[RouteParamtypes["SESSION"] = 8] = "SESSION";
15
+ RouteParamtypes[RouteParamtypes["FILE"] = 9] = "FILE";
16
+ RouteParamtypes[RouteParamtypes["FILES"] = 10] = "FILES";
17
+ RouteParamtypes[RouteParamtypes["HOST"] = 11] = "HOST";
18
+ RouteParamtypes[RouteParamtypes["IP"] = 12] = "IP";
18
19
  })(RouteParamtypes || (exports.RouteParamtypes = RouteParamtypes = {}));
@@ -24,7 +24,6 @@ export declare class HttpException extends Error {
24
24
  * Instantiate a plain HTTP Exception.
25
25
  *
26
26
  * @example
27
- * throw new HttpException()
28
27
  * throw new HttpException('message', HttpStatus.BAD_REQUEST)
29
28
  * throw new HttpException('custom message', HttpStatus.BAD_REQUEST, {
30
29
  * cause: new Error('Cause Error'),
@@ -15,7 +15,6 @@ class HttpException extends Error {
15
15
  * Instantiate a plain HTTP Exception.
16
16
  *
17
17
  * @example
18
- * throw new HttpException()
19
18
  * throw new HttpException('message', HttpStatus.BAD_REQUEST)
20
19
  * throw new HttpException('custom message', HttpStatus.BAD_REQUEST, {
21
20
  * cause: new Error('Cause Error'),
@@ -7,7 +7,7 @@ import { ConfigurableModuleHost } from './interfaces';
7
7
  */
8
8
  export interface ConfigurableModuleBuilderOptions {
9
9
  /**
10
- * Specified what injection token should be used for the module options provider.
10
+ * Specifies what injection token should be used for the module options provider.
11
11
  * By default, an auto-generated UUID will be used.
12
12
  */
13
13
  optionsInjectionToken?: string | symbol;
@@ -16,11 +16,11 @@ export interface ConfigurableModuleBuilderOptions {
16
16
  * Explicitly specifying the "moduleName" will instruct the "ConfigurableModuleBuilder"
17
17
  * to use a more descriptive provider token.
18
18
  *
19
- * For example, if `moduleName: "Cache"` then auto-generated provider token will be "CACHE_MODULE_OPTIONS".
19
+ * For example, `moduleName: "Cache"` will auto-generate the provider token: "CACHE_MODULE_OPTIONS".
20
20
  */
21
21
  moduleName?: string;
22
22
  /**
23
- * Indicates whether module should always be "transient", meaning,
23
+ * Indicates whether module should always be "transient" - meaning,
24
24
  * every time you call the static method to construct a dynamic module,
25
25
  * regardless of what arguments you pass in, a new "unique" module will be created.
26
26
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "10.3.3",
3
+ "version": "10.3.4",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@common)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://nestjs.com",
@@ -227,7 +227,7 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
227
227
  if (!(0, shared_utils_1.isString)(stack) && !(0, shared_utils_1.isUndefined)(stack)) {
228
228
  return false;
229
229
  }
230
- return /^(.)+\n\s+at .+:\d+:\d+$/.test(stack);
230
+ return /^(.)+\n\s+at .+:\d+:\d+/.test(stack);
231
231
  }
232
232
  getColorByLogLevel(level) {
233
233
  switch (level) {