@nestjs/common 7.6.9 → 7.6.13

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
@@ -99,7 +99,9 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
99
99
  <td align="center" valign="middle"><a href="https://filmen.nu/" target="_blank"><img src="https://nestjs.com/img/filmen-logo.png" width="120" valign="middle" /></a></td></tr><tr>
100
100
  <td align="center" valign="middle"><a href="https://meercode.io/" target="_blank"><img src="https://nestjs.com/img/meercode-logo.png" width="60" valign="middle" /></a></td>
101
101
  <td align="center" valign="middle"><a href="https://www.najlepszeplatformyforex.pl/blog/broker-xtb/" target="_blank"><img src="https://nestjs.com/img/npf-logo.jpg" width="200" valign="middle" /></a></td>
102
- <td align="center" valign="middle"><a href="https://thestandarddaily.com/" target="_blank"><img src="https://nestjs.com/img/the-standard-daily-logo.png" width="180" valign="middle" /></a></td>
102
+ <td align="center" valign="middle"><a href="https://thestandarddaily.com/" target="_blank"><img src="https://nestjs.com/img/the-standard-daily-logo.png" width="180" valign="middle" /></a></td>
103
+ <td align="center" valign="middle"><a href="https://houseofangular.io/" target="_blank"><img src="https://nestjs.com/img/house-of-angular.png" width="100" valign="middle" /></a></td>
104
+ <td align="center" valign="middle"><a href="https://rocketech.it/cases/?utm_source=google&utm_medium=badge&utm_campaign=nestjs" target="_blank"><img src="https://nestjs.com/img/rocketech-logo.svg" width="110" valign="middle" /></a></td>
103
105
  </tr></table>
104
106
 
105
107
  ## Backers
@@ -79,7 +79,7 @@ export declare const Session: () => ParameterDecorator;
79
79
  * Route handler parameter decorator. Extracts the `file` object
80
80
  * and populates the decorated parameter with the value of `file`.
81
81
  * Used in conjunction with
82
- * [multer middleware](https://github.com/expressjs/multer).
82
+ * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
83
83
  *
84
84
  * For example:
85
85
  * ```typescript
@@ -91,12 +91,63 @@ export declare const Session: () => ParameterDecorator;
91
91
  *
92
92
  * @publicApi
93
93
  */
94
- export declare const UploadedFile: (fileKey?: string) => ParameterDecorator;
94
+ export declare function UploadedFile(): ParameterDecorator;
95
+ /**
96
+ * Route handler parameter decorator. Extracts the `file` object
97
+ * and populates the decorated parameter with the value of `file`.
98
+ * Used in conjunction with
99
+ * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
100
+ *
101
+ * For example:
102
+ * ```typescript
103
+ * uploadFile(@UploadedFile() file) {
104
+ * console.log(file);
105
+ * }
106
+ * ```
107
+ * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
108
+ *
109
+ * @publicApi
110
+ */
111
+ export declare function UploadedFile(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
112
+ /**
113
+ * Route handler parameter decorator. Extracts the `file` object
114
+ * and populates the decorated parameter with the value of `file`.
115
+ * Used in conjunction with
116
+ * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
117
+ *
118
+ * For example:
119
+ * ```typescript
120
+ * uploadFile(@UploadedFile() file) {
121
+ * console.log(file);
122
+ * }
123
+ * ```
124
+ * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
125
+ *
126
+ * @publicApi
127
+ */
128
+ export declare function UploadedFile(fileKey?: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
129
+ /**
130
+ * Route handler parameter decorator. Extracts the `files` object
131
+ * and populates the decorated parameter with the value of `files`.
132
+ * Used in conjunction with
133
+ * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
134
+ *
135
+ * For example:
136
+ * ```typescript
137
+ * uploadFile(@UploadedFiles() files) {
138
+ * console.log(files);
139
+ * }
140
+ * ```
141
+ * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
142
+ *
143
+ * @publicApi
144
+ */
145
+ export declare function UploadedFiles(): ParameterDecorator;
95
146
  /**
96
147
  * Route handler parameter decorator. Extracts the `files` object
97
148
  * and populates the decorated parameter with the value of `files`.
98
149
  * Used in conjunction with
99
- * [multer middleware](https://github.com/expressjs/multer).
150
+ * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
100
151
  *
101
152
  * For example:
102
153
  * ```typescript
@@ -108,7 +159,7 @@ export declare const UploadedFile: (fileKey?: string) => ParameterDecorator;
108
159
  *
109
160
  * @publicApi
110
161
  */
111
- export declare const UploadedFiles: () => ParameterDecorator;
162
+ export declare function UploadedFiles(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
112
163
  /**
113
164
  * Route handler parameter decorator. Extracts the `headers`
114
165
  * property from the `req` object and populates the decorated
@@ -85,7 +85,7 @@ exports.Session = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamty
85
85
  * Route handler parameter decorator. Extracts the `file` object
86
86
  * and populates the decorated parameter with the value of `file`.
87
87
  * Used in conjunction with
88
- * [multer middleware](https://github.com/expressjs/multer).
88
+ * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
89
89
  *
90
90
  * For example:
91
91
  * ```typescript
@@ -97,12 +97,15 @@ exports.Session = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamty
97
97
  *
98
98
  * @publicApi
99
99
  */
100
- exports.UploadedFile = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILE);
100
+ function UploadedFile(fileKey, ...pipes) {
101
+ return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILE)(fileKey, ...pipes);
102
+ }
103
+ exports.UploadedFile = UploadedFile;
101
104
  /**
102
105
  * Route handler parameter decorator. Extracts the `files` object
103
106
  * and populates the decorated parameter with the value of `files`.
104
107
  * Used in conjunction with
105
- * [multer middleware](https://github.com/expressjs/multer).
108
+ * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
106
109
  *
107
110
  * For example:
108
111
  * ```typescript
@@ -114,7 +117,10 @@ exports.UploadedFile = createRouteParamDecorator(route_paramtypes_enum_1.RoutePa
114
117
  *
115
118
  * @publicApi
116
119
  */
117
- exports.UploadedFiles = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILES);
120
+ function UploadedFiles(...pipes) {
121
+ return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILES)(undefined, ...pipes);
122
+ }
123
+ exports.UploadedFiles = UploadedFiles;
118
124
  /**
119
125
  * Route handler parameter decorator. Extracts the `headers`
120
126
  * property from the `req` object and populates the decorated
@@ -35,7 +35,7 @@ export interface HttpServer<TRequest = any, TResponse = any> {
35
35
  createMiddlewareFactory(method: RequestMethod): ((path: string, callback: Function) => any) | Promise<(path: string, callback: Function) => any>;
36
36
  getRequestHostname?(request: TRequest): string;
37
37
  getRequestMethod?(request: TRequest): string;
38
- getRequestUrl?(request: TResponse): string;
38
+ getRequestUrl?(request: TRequest): string;
39
39
  getInstance(): any;
40
40
  registerParserMiddleware(): any;
41
41
  enableCors(options: CorsOptions | CorsOptionsDelegate<TRequest>): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "7.6.9",
3
+ "version": "7.6.13",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@common)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://nestjs.com",
@@ -75,9 +75,19 @@ let ParseArrayPipe = class ParseArrayPipe {
75
75
  targetArray[i] = await toClassInstance(targetArray[i]);
76
76
  }
77
77
  catch (err) {
78
- const message = err.getResponse
79
- ? `[${i}] ` + err.getResponse().message
80
- : err;
78
+ let message;
79
+ if (err.getResponse) {
80
+ const response = err.getResponse();
81
+ if (Array.isArray(response.message)) {
82
+ message = response.message.map((item) => `[${i}] ${item}`);
83
+ }
84
+ else {
85
+ message = `[${i}] ${response.message}`;
86
+ }
87
+ }
88
+ else {
89
+ message = err;
90
+ }
81
91
  errors = errors.concat(message);
82
92
  }
83
93
  }