@depup/nestjs__common 11.1.18-depup.0 → 11.1.29-depup.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 +3 -3
- package/Readme.md +26 -45
- package/changes.json +2 -2
- package/decorators/core/use-pipes.decorator.js +1 -0
- package/decorators/http/route-params.decorator.d.ts +26 -0
- package/decorators/http/route-params.decorator.js +26 -0
- package/exceptions/misdirected.exception.d.ts +1 -1
- package/exceptions/misdirected.exception.js +1 -1
- package/exceptions/not-acceptable.exception.d.ts +2 -2
- package/exceptions/not-acceptable.exception.js +2 -2
- package/interfaces/http/message-event.interface.d.ts +2 -1
- package/interfaces/router-options.interface.d.ts +28 -0
- package/interfaces/router-options.interface.js +1 -0
- package/package.json +6 -6
- package/pipes/file/file-type.validator.d.ts +7 -0
- package/pipes/file/file-type.validator.js +15 -0
- package/pipes/parse-array.pipe.d.ts +5 -3
- package/pipes/parse-date.pipe.d.ts +6 -0
- package/pipes/parse-date.pipe.js +4 -1
- package/pipes/validation.pipe.js +4 -5
- package/utils/http-error-by-code.util.d.ts +1 -1
- package/utils/http-error-by-code.util.js +2 -0
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/nestjs__common
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.1.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.1.29 |
|
|
17
|
+
| Processed | 2026-08-10 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 1 |
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ npm install @depup/nestjs__common
|
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| file-type | 21.3.4 | ^22.0.
|
|
25
|
+
| file-type | 21.3.4 | ^22.0.1 |
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
package/Readme.md
CHANGED
|
@@ -29,7 +29,7 @@ Nest is a framework for building efficient, scalable <a href="https://nodejs.org
|
|
|
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-end and back-end applications, giving rise to awesome projects like <a href="https://angular.
|
|
32
|
+
<p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front-end and back-end applications, giving rise to awesome projects like <a href="https://angular.dev/" target="_blank">Angular</a>, <a href="https://react.dev/" target="_blank">React</a>, and <a href="https://vuejs.org/" 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
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
|
|
@@ -59,11 +59,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
59
59
|
|
|
60
60
|
<table style="text-align:center;">
|
|
61
61
|
<tr>
|
|
62
|
-
<td><a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="200" valign="middle" /></a></td>
|
|
63
|
-
<td><a href="https://microsoft.com/" target="_blank"><img src="https://nestjs.com/img/
|
|
64
|
-
<td><a href="https://mojam.co" target="_blank"><img src="https://
|
|
62
|
+
<td><a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/github/trilon-logo.svg" width="200" valign="middle" /></a></td>
|
|
63
|
+
<td><a href="https://microsoft.com/" target="_blank"><img src="https://nestjs.com/img/github/microsoft-logo.png" width="180" valign="middle" /></a></td>
|
|
64
|
+
<td><a href="https://mojam.co" target="_blank"><img src="https://images.opencollective.com/mojamco/981e9de/logo/256.png?height=256" width="80" valign="middle" /></a></td>
|
|
65
65
|
<td><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>
|
|
66
|
-
<td><a href="https://serpapi.com/" target="_blank"><img src="https://nestjs.com/img/
|
|
66
|
+
<td><a href="https://serpapi.com/" target="_blank"><img src="https://nestjs.com/img/github/serpapi-logo.png" width="150" valign="middle" /></a></td>
|
|
67
67
|
</tr>
|
|
68
68
|
</table>
|
|
69
69
|
|
|
@@ -71,15 +71,15 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
71
71
|
|
|
72
72
|
<table style="text-align:center;">
|
|
73
73
|
<tr>
|
|
74
|
-
<td><a href="https://www.redhat.com" target="_blank"><img src="https://nestjs.com/img/
|
|
75
|
-
<td><a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="
|
|
76
|
-
<td><a href="https://nx.dev" target="_blank"><img src="https://nestjs.com/img/
|
|
77
|
-
<td><a href="https://intrinsic.ventures/" target="_blank"><img src="https://nestjs.com/img/
|
|
78
|
-
<td><a href="https://jetbrains.com/" target="_blank"><img src="https://nestjs.com/img/
|
|
74
|
+
<td><a href="https://www.redhat.com" target="_blank"><img src="https://nestjs.com/img/github/red-hat-logo.svg" width="150" valign="middle" /></a></td>
|
|
75
|
+
<td><a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="120" valign="middle" /></a></td>
|
|
76
|
+
<td><a href="https://nx.dev" target="_blank"><img src="https://nestjs.com/img/github/nx-logo.png" height="45" valign="middle" /></a></td>
|
|
77
|
+
<td><a href="https://intrinsic.ventures/" target="_blank"><img src="https://nestjs.com/img/github/intrinisic-logo.png" width="150" valign="middle" /></a></td>
|
|
78
|
+
<td><a href="https://jetbrains.com/" target="_blank"><img src="https://nestjs.com/img/github/jetbrains-logo.svg" width="70" valign="middle" /></a></td>
|
|
79
79
|
</tr>
|
|
80
80
|
<tr>
|
|
81
|
-
<td><a href="https://snyk.co/nestjs" target="_blank"><img src="https://nestjs.com/img/
|
|
82
|
-
<td><a href="https://www.movavi.com/imovie-for-windows.html" target="_blank"><img src="https://
|
|
81
|
+
<td><a href="https://snyk.co/nestjs" target="_blank"><img src="https://nestjs.com/img/github/snyk-logo-black.png" width="125" valign="middle" /></a></td>
|
|
82
|
+
<td align="center"><a href="https://www.movavi.com/imovie-for-windows.html" target="_blank"><img src="https://images.opencollective.com/movavi/1fb15e5/avatar/256.png?height=256" width="60" valign="middle" /></a></td>
|
|
83
83
|
</tr>
|
|
84
84
|
</table>
|
|
85
85
|
|
|
@@ -87,14 +87,15 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
87
87
|
|
|
88
88
|
<table style="text-align:center;">
|
|
89
89
|
<tr>
|
|
90
|
-
<td><a href="https://www.mercedes-benz.com/" target="_blank"><img src="https://nestjs.com/img/
|
|
91
|
-
<td><a href="https://
|
|
92
|
-
<td><a href="https://
|
|
93
|
-
<td align="center" valign="middle"><a href="https://
|
|
94
|
-
<td align="center" valign="middle"><a href="https://
|
|
95
|
-
<td align="center" valign="middle"><a href="https://crawljobs.com" target="_blank"><img src="https://nestjs.com/img/logos/crawljobs-logo.svg" width="130" valign="middle" /></a></td>
|
|
90
|
+
<td><a href="https://www.mercedes-benz.com/" target="_blank"><img src="https://nestjs.com/img/github/mercedes-logo.png" width="100" valign="middle" /></a></td>
|
|
91
|
+
<td><a href="https://handsontable.com/docs/react-data-grid/?utm_source=NestJS_GH&utm_medium=sponsorship&utm_campaign=library_sponsorship_2024" target="_blank"><img src="https://nestjs.com/img/github/handsontable-dark-logo.svg#2" width="150" valign="middle" /></a></td>
|
|
92
|
+
<td align="center" valign="middle"><a href="https://www.itflashcards.com/" target="_blank"><img src="https://nestjs.com/img/github/it_flashcards-logo.png" width="170" valign="middle" /></a></td>
|
|
93
|
+
<td align="center" valign="middle"><a href="https://arcjet.com/?ref=nestjs" target="_blank"><img src="https://nestjs.com/img/github/arcjet-logo.svg" width="170" valign="middle" /></a></td>
|
|
94
|
+
<td align="center" valign="middle"><a href="https://pandektes.com" target="_blank"><img src="https://nestjs.com/img/github/pandektes-logo.png" width="65" valign="middle" /></a></td>
|
|
96
95
|
</tr><tr>
|
|
97
|
-
<td align="center" valign="middle"><a href="https://
|
|
96
|
+
<td align="center" valign="middle"><a href="https://www.fintechcrafts.com/" target="_blank"><img src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/935813df-48a9-4b41-b923-7d70b5621c6b/2026-05-06%2010%2021%2033.png" width="65" valign="middle" /></a></td>
|
|
97
|
+
<td align="center" valign="middle"><a href="https://talordata.com/?campaignid=Ya5Xpw2gmhyee6Tg&utm_source=nestjs&utm_term=nestjs" target="_blank"><img src="https://images.opencollective.com/elowen/9ccac7f/avatar/512.png" width="65" valign="middle" /></a></td>
|
|
98
|
+
<td align="center" valign="middle"><a href="https://memory2.co/" target="_blank"><img src="https://images.opencollective.com/memory-squared/bbe37f5/avatar/256.png?height=50" width="65" valign="middle" /></a></td>
|
|
98
99
|
</tr>
|
|
99
100
|
</table>
|
|
100
101
|
|
|
@@ -102,32 +103,12 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
102
103
|
|
|
103
104
|
<table>
|
|
104
105
|
<tr>
|
|
105
|
-
<td align="center" valign="middle"><a href="https://
|
|
106
|
-
<td align="center" valign="middle"><a href="https://
|
|
107
|
-
<td align="center" valign="middle"><a href="https://
|
|
108
|
-
<td align="center" valign="middle"><a href="https://
|
|
109
|
-
<td align="center" valign="middle"><a href="https://
|
|
110
|
-
<td align="center" valign="middle"><a href="https://
|
|
111
|
-
</tr>
|
|
112
|
-
<tr>
|
|
113
|
-
<td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/logos/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
|
114
|
-
<td align="center" valign="middle"><a href="https://lambda-it.ch/" target="_blank"><img src="https://nestjs.com/img/logos/lambda-it-logo.svg" width="115" valign="middle" /></a></td>
|
|
115
|
-
<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/logos/rocketech-logo.svg" width="110" valign="middle" /></a></td>
|
|
116
|
-
<td align="center" valign="middle"><a href="https://www.anonymistic.com/" target="_blank"><img src="https://nestjs.com/img/logos/anonymistic-logo.png" width="125" valign="middle" /></a></td>
|
|
117
|
-
<td align="center" valign="middle"><a href="https://www.naologic.com/" target="_blank"><img src="https://nestjs.com/img/logos/naologic-logo.svg" width="125" valign="middle" /></a></td>
|
|
118
|
-
<td align="center" valign="middle"><a href="https://triplecore.io" target="_blank"><img src="https://nestjs.com/img/logos/triplecore-logo.svg" width="50" valign="middle" /></a></td>
|
|
119
|
-
</tr>
|
|
120
|
-
<tr>
|
|
121
|
-
<td align="center" valign="middle"><a href="https://polygon-software.ch/" target="_blank"><img src="https://nestjs.com/img/logos/polygon-logo.svg" width="120" valign="middle" /></a></td>
|
|
122
|
-
<td align="center" valign="middle"><a href="https://boringowl.io/" target="_blank"><img src="https://nestjs.com/img/logos/boringowl-logo.svg" width="120" valign="middle" /></a></td>
|
|
123
|
-
<td align="center" valign="middle"><a href="https://nordbot.app/" target="_blank"><img src="https://nestjs.com/img/logos/nordbot-logo.png" width="120" valign="middle" /></a></td>
|
|
124
|
-
<td align="center" valign="middle"><a href="https://doppio.sh/" target="_blank"><img src="https://nestjs.com/img/logos/dopiosh-logo.png" width="50" valign="middle" /></a></td>
|
|
125
|
-
<td align="center" valign="middle"><a href="https://www.hingehealth.com/" target="_blank"><img src="https://nestjs.com/img/logos/hinge-health-logo.svg" width="100" valign="middle" /></a></td>
|
|
126
|
-
<td align="center" valign="middle"><a href="https://www.tripoffice.com/" target="_blank"><img src="https://nestjs.com/img/logos/tripoffice-logo.png" width="140" valign="middle" /></a></td>
|
|
127
|
-
</tr>
|
|
128
|
-
<tr>
|
|
129
|
-
<td align="center" valign="middle"><a href="https://solcellsforetag.se/" target="_blank"><img src="https://nestjs.com/img/logos/solcellsforetag-logo.svg" width="140" valign="middle" /></a></td>
|
|
130
|
-
<td align="center" valign="middle"><a href="https://www.route4me.com/" target="_blank"><img src="https://nestjs.com/img/logos/route4me-logo.svg" width="100" valign="middle" /></a></td>
|
|
106
|
+
<td align="center" valign="middle"><a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/github/mantro-logo.svg" width="95" valign="middle" /></a></td>
|
|
107
|
+
<td align="center" valign="middle"><a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/github/triplebyte-logo.png" width="107" valign="middle" /></a></td>
|
|
108
|
+
<td align="center" valign="middle"><a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/github/nearpod-logo.svg" width="100" valign="middle" /></a></td>
|
|
109
|
+
<td align="center" valign="middle"><a href="https://www.naologic.com/" target="_blank"><img src="https://nestjs.com/img/github/naologic-logo.svg" width="125" valign="middle" /></a></td>
|
|
110
|
+
<td align="center" valign="middle"><a href="https://triplecore.io" target="_blank"><img src="https://nestjs.com/img/github/triplecore-logo.svg" width="50" valign="middle" /></a>
|
|
111
|
+
<td align="center" valign="middle"><a href="https://www.hingehealth.com/" target="_blank"><img src="https://nestjs.com/img/github/hinge-health-logo.svg" width="100" valign="middle" /></a></td>
|
|
131
112
|
</tr>
|
|
132
113
|
</table>
|
|
133
114
|
|
package/changes.json
CHANGED
|
@@ -30,6 +30,7 @@ function UsePipes(...pipes) {
|
|
|
30
30
|
return (target, key, descriptor) => {
|
|
31
31
|
const isPipeValid = (pipe) => pipe && ((0, shared_utils_1.isFunction)(pipe) || (0, shared_utils_1.isFunction)(pipe.transform));
|
|
32
32
|
if (descriptor) {
|
|
33
|
+
(0, validate_each_util_1.validateEach)(target.constructor, pipes, isPipeValid, '@UsePipes', 'pipe');
|
|
33
34
|
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.PIPES_METADATA, pipes, descriptor.value);
|
|
34
35
|
return descriptor;
|
|
35
36
|
}
|
|
@@ -441,5 +441,31 @@ export declare function HostParam(): ParameterDecorator;
|
|
|
441
441
|
* @publicApi
|
|
442
442
|
*/
|
|
443
443
|
export declare function HostParam(property: string): ParameterDecorator;
|
|
444
|
+
/**
|
|
445
|
+
* Route handler parameter decorator. Extracts the `Request`
|
|
446
|
+
* object from the underlying platform and populates the decorated
|
|
447
|
+
* parameter with the value of `Request`.
|
|
448
|
+
*
|
|
449
|
+
* Alias for @Request().
|
|
450
|
+
*
|
|
451
|
+
* Example: `logout(@Req() req)`
|
|
452
|
+
*
|
|
453
|
+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
|
454
|
+
*
|
|
455
|
+
* @publicApi
|
|
456
|
+
*/
|
|
444
457
|
export declare const Req: () => ParameterDecorator;
|
|
458
|
+
/**
|
|
459
|
+
* Route handler parameter decorator. Extracts the `Response`
|
|
460
|
+
* object from the underlying platform and populates the decorated
|
|
461
|
+
* parameter with the value of `Response`.
|
|
462
|
+
*
|
|
463
|
+
* Alias for @Response().
|
|
464
|
+
*
|
|
465
|
+
* Example: `logout(@Res() res)`
|
|
466
|
+
*
|
|
467
|
+
* @see [Response object](https://docs.nestjs.com/controllers#response-object)
|
|
468
|
+
*
|
|
469
|
+
* @publicApi
|
|
470
|
+
*/
|
|
445
471
|
export declare const Res: (options?: ResponseDecoratorOptions) => ParameterDecorator;
|
|
@@ -261,5 +261,31 @@ function Param(property, ...pipes) {
|
|
|
261
261
|
function HostParam(property) {
|
|
262
262
|
return createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.HOST)(property);
|
|
263
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Route handler parameter decorator. Extracts the `Request`
|
|
266
|
+
* object from the underlying platform and populates the decorated
|
|
267
|
+
* parameter with the value of `Request`.
|
|
268
|
+
*
|
|
269
|
+
* Alias for @Request().
|
|
270
|
+
*
|
|
271
|
+
* Example: `logout(@Req() req)`
|
|
272
|
+
*
|
|
273
|
+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
|
274
|
+
*
|
|
275
|
+
* @publicApi
|
|
276
|
+
*/
|
|
264
277
|
exports.Req = exports.Request;
|
|
278
|
+
/**
|
|
279
|
+
* Route handler parameter decorator. Extracts the `Response`
|
|
280
|
+
* object from the underlying platform and populates the decorated
|
|
281
|
+
* parameter with the value of `Response`.
|
|
282
|
+
*
|
|
283
|
+
* Alias for @Response().
|
|
284
|
+
*
|
|
285
|
+
* Example: `logout(@Res() res)`
|
|
286
|
+
*
|
|
287
|
+
* @see [Response object](https://docs.nestjs.com/controllers#response-object)
|
|
288
|
+
*
|
|
289
|
+
* @publicApi
|
|
290
|
+
*/
|
|
265
291
|
exports.Res = exports.Response;
|
|
@@ -20,7 +20,7 @@ export declare class MisdirectedException extends HttpException {
|
|
|
20
20
|
*
|
|
21
21
|
* By default, the JSON response body contains two properties:
|
|
22
22
|
* - `statusCode`: this will be the value 421.
|
|
23
|
-
* - `message`: the string `'
|
|
23
|
+
* - `message`: the string `'Misdirected'` by default; override this by supplying
|
|
24
24
|
* a string in the `objectOrError` parameter.
|
|
25
25
|
*
|
|
26
26
|
* If the parameter `objectOrError` is a string, the response body will contain an
|
|
@@ -24,7 +24,7 @@ class MisdirectedException extends http_exception_1.HttpException {
|
|
|
24
24
|
*
|
|
25
25
|
* By default, the JSON response body contains two properties:
|
|
26
26
|
* - `statusCode`: this will be the value 421.
|
|
27
|
-
* - `message`: the string `'
|
|
27
|
+
* - `message`: the string `'Misdirected'` by default; override this by supplying
|
|
28
28
|
* a string in the `objectOrError` parameter.
|
|
29
29
|
*
|
|
30
30
|
* If the parameter `objectOrError` is a string, the response body will contain an
|
|
@@ -20,8 +20,8 @@ export declare class NotAcceptableException extends HttpException {
|
|
|
20
20
|
*
|
|
21
21
|
* By default, the JSON response body contains two properties:
|
|
22
22
|
* - `statusCode`: this will be the value 406.
|
|
23
|
-
* - `
|
|
24
|
-
* a string in the `
|
|
23
|
+
* - `message`: the string `'Not Acceptable'` by default; override this by supplying
|
|
24
|
+
* a string in the `objectOrError` parameter.
|
|
25
25
|
*
|
|
26
26
|
* If the parameter `objectOrError` is a string, the response body will contain an
|
|
27
27
|
* additional property, `error`, with a short description of the HTTP error. To override the
|
|
@@ -24,8 +24,8 @@ class NotAcceptableException extends http_exception_1.HttpException {
|
|
|
24
24
|
*
|
|
25
25
|
* By default, the JSON response body contains two properties:
|
|
26
26
|
* - `statusCode`: this will be the value 406.
|
|
27
|
-
* - `
|
|
28
|
-
* a string in the `
|
|
27
|
+
* - `message`: the string `'Not Acceptable'` by default; override this by supplying
|
|
28
|
+
* a string in the `objectOrError` parameter.
|
|
29
29
|
*
|
|
30
30
|
* If the parameter `objectOrError` is a string, the response body will contain an
|
|
31
31
|
* additional property, `error`, with a short description of the HTTP error. To override the
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Severity level applied to a single kind of route conflict detected at
|
|
3
|
+
* bootstrap.
|
|
4
|
+
*
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
7
|
+
export type RouteConflictPolicyLevel = 'off' | 'warn' | 'error';
|
|
8
|
+
/**
|
|
9
|
+
* Per-kind policy for overlapping routes detected at bootstrap.
|
|
10
|
+
* `duplicate` covers identical (method, path, host, version) registrations.
|
|
11
|
+
* `shadow` covers patterns that can match the same request (for example
|
|
12
|
+
* `/users/me` vs `/users/:id`). Each kind defaults to `'off'`.
|
|
13
|
+
*
|
|
14
|
+
* @publicApi
|
|
15
|
+
*/
|
|
16
|
+
export interface RouteConflictPolicy {
|
|
17
|
+
duplicate?: RouteConflictPolicyLevel;
|
|
18
|
+
shadow?: RouteConflictPolicyLevel;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Order in which routes are registered on the underlying HTTP adapter.
|
|
22
|
+
* `'specificity'` registers literal segments before parametric and
|
|
23
|
+
* wildcard ones on order-sensitive adapters (such as Express). Defaults
|
|
24
|
+
* to `'declaration'`.
|
|
25
|
+
*
|
|
26
|
+
* @publicApi
|
|
27
|
+
*/
|
|
28
|
+
export type RouteResolutionStrategy = 'declaration' | 'specificity';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/nestjs__common",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.29-depup.0",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common) (with updated dependencies)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"file-type": "^22.0.
|
|
18
|
+
"file-type": "^22.0.1",
|
|
19
19
|
"iterare": "1.2.1",
|
|
20
20
|
"load-esm": "1.0.3",
|
|
21
21
|
"tslib": "2.8.1",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"optional": true
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "03587a112ebbbb53a6bc3875afb5a9205aa5a5f1",
|
|
39
39
|
"keywords": [
|
|
40
40
|
"@nestjs/common",
|
|
41
41
|
"depup",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"changes": {
|
|
49
49
|
"file-type": {
|
|
50
50
|
"from": "21.3.4",
|
|
51
|
-
"to": "^22.0.
|
|
51
|
+
"to": "^22.0.1"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"depsUpdated": 1,
|
|
55
55
|
"originalPackage": "@nestjs/common",
|
|
56
|
-
"originalVersion": "11.1.
|
|
57
|
-
"processedAt": "2026-
|
|
56
|
+
"originalVersion": "11.1.29",
|
|
57
|
+
"processedAt": "2026-08-10T16:18:30.286Z",
|
|
58
58
|
"smokeTest": "passed"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -45,6 +45,13 @@ export type FileTypeValidatorOptions = {
|
|
|
45
45
|
* @default false
|
|
46
46
|
*/
|
|
47
47
|
fallbackToMimetype?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* If `true`, replaces the client-provided mimetype with the mimetype
|
|
50
|
+
* detected from the file content using magic number validation.
|
|
51
|
+
*
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
overrideMimeType?: boolean;
|
|
48
55
|
};
|
|
49
56
|
/**
|
|
50
57
|
* Defines the built-in FileTypeValidator. It validates incoming files by examining
|
|
@@ -23,6 +23,18 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
|
23
23
|
? errorMessage({ file, config })
|
|
24
24
|
: errorMessage;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* If the file buffer is not available, and fallbackToMimetype is not enabled,
|
|
28
|
+
* we cannot perform magic number validation,
|
|
29
|
+
* so we return a specific error message indicating
|
|
30
|
+
* that validation could not be performed due to missing buffer.
|
|
31
|
+
*/
|
|
32
|
+
if (file?.mimetype &&
|
|
33
|
+
!file.buffer &&
|
|
34
|
+
!this.validationOptions?.fallbackToMimetype &&
|
|
35
|
+
!this.validationOptions?.skipMagicNumbersValidation) {
|
|
36
|
+
return `Validation failed (file buffer is not available; file type validation could not be performed; expected type is ${this.validationOptions.fileType})`;
|
|
37
|
+
}
|
|
26
38
|
if (file?.mimetype) {
|
|
27
39
|
const baseMessage = `Validation failed (current file type is ${file.mimetype}, expected type is ${this.validationOptions.fileType})`;
|
|
28
40
|
/**
|
|
@@ -68,6 +80,9 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
|
68
80
|
const { fileTypeFromBuffer } = await (0, load_esm_1.loadEsm)(fileTypeModule);
|
|
69
81
|
const fileType = await fileTypeFromBuffer(file.buffer);
|
|
70
82
|
if (fileType) {
|
|
83
|
+
if (this.validationOptions.overrideMimeType) {
|
|
84
|
+
file.mimetype = fileType.mime;
|
|
85
|
+
}
|
|
71
86
|
// Match detected mime type against allowed type
|
|
72
87
|
return !!fileType.mime.match(this.validationOptions.fileType);
|
|
73
88
|
}
|
|
@@ -4,7 +4,7 @@ import { ValidationPipe, ValidationPipeOptions } from './validation.pipe';
|
|
|
4
4
|
/**
|
|
5
5
|
* @publicApi
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface ParseArrayPipeOptions extends Omit<ValidationPipeOptions, 'transform' | 'validateCustomDecorators' | 'exceptionFactory'> {
|
|
8
8
|
/**
|
|
9
9
|
* Type for items to be converted into
|
|
10
10
|
*/
|
|
@@ -27,6 +27,8 @@ export interface ParseArrayOptions extends Omit<ValidationPipeOptions, 'transfor
|
|
|
27
27
|
*/
|
|
28
28
|
exceptionFactory?: (error: any) => any;
|
|
29
29
|
}
|
|
30
|
+
/** @deprecated Use `ParseArrayPipeOptions` instead. */
|
|
31
|
+
export type ParseArrayOptions = ParseArrayPipeOptions;
|
|
30
32
|
/**
|
|
31
33
|
* Defines the built-in ParseArray Pipe
|
|
32
34
|
*
|
|
@@ -35,10 +37,10 @@ export interface ParseArrayOptions extends Omit<ValidationPipeOptions, 'transfor
|
|
|
35
37
|
* @publicApi
|
|
36
38
|
*/
|
|
37
39
|
export declare class ParseArrayPipe implements PipeTransform {
|
|
38
|
-
protected readonly options:
|
|
40
|
+
protected readonly options: ParseArrayPipeOptions;
|
|
39
41
|
protected readonly validationPipe: ValidationPipe;
|
|
40
42
|
protected exceptionFactory: (error: string) => any;
|
|
41
|
-
constructor(options?:
|
|
43
|
+
constructor(options?: ParseArrayPipeOptions);
|
|
42
44
|
/**
|
|
43
45
|
* Method that accesses and performs optional transformation on argument for
|
|
44
46
|
* in-flight requests.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
|
|
2
2
|
import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
|
|
3
|
+
/**
|
|
4
|
+
* @publicApi
|
|
5
|
+
*/
|
|
3
6
|
export interface ParseDatePipeOptions {
|
|
4
7
|
/**
|
|
5
8
|
* If true, the pipe will return null or undefined if the value is not provided
|
|
@@ -22,6 +25,9 @@ export interface ParseDatePipeOptions {
|
|
|
22
25
|
*/
|
|
23
26
|
exceptionFactory?: (error: string) => any;
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* @publicApi
|
|
30
|
+
*/
|
|
25
31
|
export declare class ParseDatePipe implements PipeTransform<string | number | undefined | null> {
|
|
26
32
|
private readonly options;
|
|
27
33
|
protected exceptionFactory: (error: string) => any;
|
package/pipes/parse-date.pipe.js
CHANGED
|
@@ -6,6 +6,9 @@ const injectable_decorator_1 = require("../decorators/core/injectable.decorator"
|
|
|
6
6
|
const http_status_enum_1 = require("../enums/http-status.enum");
|
|
7
7
|
const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
|
|
8
8
|
const shared_utils_1 = require("../utils/shared.utils");
|
|
9
|
+
/**
|
|
10
|
+
* @publicApi
|
|
11
|
+
*/
|
|
9
12
|
let ParseDatePipe = class ParseDatePipe {
|
|
10
13
|
constructor(options = {}) {
|
|
11
14
|
this.options = options;
|
|
@@ -25,7 +28,7 @@ let ParseDatePipe = class ParseDatePipe {
|
|
|
25
28
|
if (this.options.optional && (0, shared_utils_1.isNil)(value)) {
|
|
26
29
|
return this.options.default ? this.options.default() : value;
|
|
27
30
|
}
|
|
28
|
-
if (
|
|
31
|
+
if ((0, shared_utils_1.isNil)(value) || value === '') {
|
|
29
32
|
throw this.exceptionFactory('Validation failed (no Date provided)');
|
|
30
33
|
}
|
|
31
34
|
const transformedValue = new Date(value);
|
package/pipes/validation.pipe.js
CHANGED
|
@@ -25,7 +25,7 @@ const BUILT_IN_TYPES = [Date, RegExp, Error, Map, Set, WeakMap, WeakSet];
|
|
|
25
25
|
let ValidationPipe = class ValidationPipe {
|
|
26
26
|
constructor(options) {
|
|
27
27
|
options = options || {};
|
|
28
|
-
const { transform, disableErrorMessages, errorHttpStatusCode, expectedType, transformOptions, validateCustomDecorators, ...validatorOptions } = options;
|
|
28
|
+
const { transform, disableErrorMessages, errorHttpStatusCode, expectedType, transformOptions, exceptionFactory, validatorPackage, transformerPackage, validateCustomDecorators, ...validatorOptions } = options;
|
|
29
29
|
// @see [https://github.com/nestjs/nest/issues/10683#issuecomment-1413690508](https://github.com/nestjs/nest/issues/10683#issuecomment-1413690508)
|
|
30
30
|
this.validatorOptions = { forbidUnknownValues: false, ...validatorOptions };
|
|
31
31
|
this.isTransformEnabled = !!transform;
|
|
@@ -34,10 +34,9 @@ let ValidationPipe = class ValidationPipe {
|
|
|
34
34
|
this.validateCustomDecorators = validateCustomDecorators || false;
|
|
35
35
|
this.errorHttpStatusCode = errorHttpStatusCode || http_status_enum_1.HttpStatus.BAD_REQUEST;
|
|
36
36
|
this.expectedType = expectedType;
|
|
37
|
-
this.exceptionFactory =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
classTransformer = this.loadTransformer(options.transformerPackage);
|
|
37
|
+
this.exceptionFactory = exceptionFactory || this.createExceptionFactory();
|
|
38
|
+
classValidator = this.loadValidator(validatorPackage);
|
|
39
|
+
classTransformer = this.loadTransformer(transformerPackage);
|
|
41
40
|
}
|
|
42
41
|
loadValidator(validatorPackage) {
|
|
43
42
|
return (validatorPackage ??
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { HttpStatus } from '../enums';
|
|
2
2
|
import { Type } from '../interfaces';
|
|
3
|
-
export type ErrorHttpStatusCode = HttpStatus.BAD_GATEWAY | HttpStatus.BAD_REQUEST | HttpStatus.CONFLICT | HttpStatus.FORBIDDEN | HttpStatus.GATEWAY_TIMEOUT | HttpStatus.GONE | HttpStatus.I_AM_A_TEAPOT | HttpStatus.INTERNAL_SERVER_ERROR | HttpStatus.METHOD_NOT_ALLOWED | HttpStatus.NOT_ACCEPTABLE | HttpStatus.NOT_FOUND | HttpStatus.NOT_IMPLEMENTED | HttpStatus.PAYLOAD_TOO_LARGE | HttpStatus.PRECONDITION_FAILED | HttpStatus.REQUEST_TIMEOUT | HttpStatus.SERVICE_UNAVAILABLE | HttpStatus.UNAUTHORIZED | HttpStatus.UNPROCESSABLE_ENTITY | HttpStatus.UNSUPPORTED_MEDIA_TYPE;
|
|
3
|
+
export type ErrorHttpStatusCode = HttpStatus.BAD_GATEWAY | HttpStatus.BAD_REQUEST | HttpStatus.CONFLICT | HttpStatus.FORBIDDEN | HttpStatus.GATEWAY_TIMEOUT | HttpStatus.GONE | HttpStatus.HTTP_VERSION_NOT_SUPPORTED | HttpStatus.I_AM_A_TEAPOT | HttpStatus.INTERNAL_SERVER_ERROR | HttpStatus.METHOD_NOT_ALLOWED | HttpStatus.MISDIRECTED | HttpStatus.NOT_ACCEPTABLE | HttpStatus.NOT_FOUND | HttpStatus.NOT_IMPLEMENTED | HttpStatus.PAYLOAD_TOO_LARGE | HttpStatus.PRECONDITION_FAILED | HttpStatus.REQUEST_TIMEOUT | HttpStatus.SERVICE_UNAVAILABLE | HttpStatus.UNAUTHORIZED | HttpStatus.UNPROCESSABLE_ENTITY | HttpStatus.UNSUPPORTED_MEDIA_TYPE;
|
|
4
4
|
export declare const HttpErrorByCode: Record<ErrorHttpStatusCode, Type<unknown>>;
|
|
@@ -10,9 +10,11 @@ exports.HttpErrorByCode = {
|
|
|
10
10
|
[enums_1.HttpStatus.FORBIDDEN]: exceptions_1.ForbiddenException,
|
|
11
11
|
[enums_1.HttpStatus.GATEWAY_TIMEOUT]: exceptions_1.GatewayTimeoutException,
|
|
12
12
|
[enums_1.HttpStatus.GONE]: exceptions_1.GoneException,
|
|
13
|
+
[enums_1.HttpStatus.HTTP_VERSION_NOT_SUPPORTED]: exceptions_1.HttpVersionNotSupportedException,
|
|
13
14
|
[enums_1.HttpStatus.I_AM_A_TEAPOT]: exceptions_1.ImATeapotException,
|
|
14
15
|
[enums_1.HttpStatus.INTERNAL_SERVER_ERROR]: exceptions_1.InternalServerErrorException,
|
|
15
16
|
[enums_1.HttpStatus.METHOD_NOT_ALLOWED]: exceptions_1.MethodNotAllowedException,
|
|
17
|
+
[enums_1.HttpStatus.MISDIRECTED]: exceptions_1.MisdirectedException,
|
|
16
18
|
[enums_1.HttpStatus.NOT_ACCEPTABLE]: exceptions_1.NotAcceptableException,
|
|
17
19
|
[enums_1.HttpStatus.NOT_FOUND]: exceptions_1.NotFoundException,
|
|
18
20
|
[enums_1.HttpStatus.NOT_IMPLEMENTED]: exceptions_1.NotImplementedException,
|