@depup/nestjs__common 11.1.16-depup.1 → 11.1.17-depup.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 ADDED
@@ -0,0 +1,31 @@
1
+ # @depup/nestjs__common
2
+
3
+ > Dependency-bumped version of [@nestjs/common](https://www.npmjs.com/package/@nestjs/common)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/nestjs__common
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.1.17 |
17
+ | Processed | 2026-03-26 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 1 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | file-type | 21.3.2 | ^22.0.0 |
26
+
27
+ ---
28
+
29
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@nestjs/common
30
+
31
+ License inherited from the original package.
package/Readme.md CHANGED
@@ -1,31 +1,146 @@
1
- # @depup/nestjs__common
1
+ <p align="center">
2
+ <a href="https://nestjs.com/" target="_blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
3
+ </p>
2
4
 
3
- > Dependency-bumped version of [@nestjs/common](https://www.npmjs.com/package/@nestjs/common)
5
+ [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6
+ [circleci-url]: https://circleci.com/gh/nestjs/nest
4
7
 
5
- Generated by [DepUp](https://github.com/depup/npm) -- all production
6
- dependencies bumped to latest versions.
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
+ <p align="center">
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
+ <a href="https://github.com/nestjs/nest/blob/master/LICENSE" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13
+ <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14
+ <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
15
+ <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
16
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
17
+ <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
18
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
19
+ <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
20
+ </p>
21
+ <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
22
+ [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
7
23
 
8
- ## Installation
24
+ ## Description
9
25
 
10
- ```bash
11
- npm install @depup/nestjs__common
12
- ```
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).
13
27
 
14
- | Field | Value |
15
- |-------|-------|
16
- | Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.1.16 |
17
- | Processed | 2026-03-09 |
18
- | Smoke test | passed |
19
- | Deps updated | 1 |
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>
20
29
 
21
- ## Dependency Changes
30
+ ## Philosophy
22
31
 
23
- | Dependency | From | To |
24
- |------------|------|-----|
25
- | file-type | 21.3.0 | ^21.3.1 |
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.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>
26
34
 
27
- ---
35
+ ## Getting started
28
36
 
29
- Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@nestjs/common
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:
30
41
 
31
- License inherited from the original package.
42
+ ## Questions
43
+
44
+ For questions and support please use the official [Discord channel](https://discord.gg/G7Qnnhy). The issue list of this repo is **exclusively** for bug reports and feature requests.
45
+
46
+ ## Issues
47
+
48
+ Please make sure to read the [Issue Reporting Checklist](https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md#-submitting-an-issue) before opening an issue. Issues not conforming to the guidelines may be closed immediately.
49
+
50
+ ## Consulting
51
+
52
+ With official support, you can get expert help straight from the Nest core team. We provide dedicated technical support, migration strategies, advice on best practices (and design decisions), PR reviews, and team augmentation. Read more about [support here](https://enterprise.nestjs.com).
53
+
54
+ ## Support
55
+
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
+
58
+ #### Principal Sponsors
59
+
60
+ <table style="text-align:center;">
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/logos/microsoft-logo.png" width="180" valign="middle" /></a></td>
64
+ <td><a href="https://mojam.co" target="_blank"><img src="https://nestjs.com/img/logos/mojam-logo.png" width="80" valign="middle" /></a></td>
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/logos/serpapi-logo.png" width="150" valign="middle" /></a></td>
67
+ </tr>
68
+ </table>
69
+
70
+ #### Gold Sponsors
71
+
72
+ <table style="text-align:center;">
73
+ <tr>
74
+ <td><a href="https://www.redhat.com" target="_blank"><img src="https://nestjs.com/img/logos/red-hat-logo.svg" width="200" 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="180" valign="middle" /></a></td>
76
+ <td><a href="https://nx.dev" target="_blank"><img src="https://nestjs.com/img/logos/nx-logo.png" height="45" valign="middle" /></a></td>
77
+ <td><a href="https://intrinsic.ventures/" target="_blank"><img src="https://nestjs.com/img/logos/intrinisic-logo.png" width="210" valign="middle" /></a></td>
78
+ <td><a href="https://jetbrains.com/" target="_blank"><img src="https://nestjs.com/img/logos/jetbrains-logo.svg" width="90" valign="middle" /></a></td>
79
+ </tr>
80
+ <tr>
81
+ <td><a href="https://snyk.co/nestjs" target="_blank"><img src="https://nestjs.com/img/logos/snyk-logo-black.png" width="185" valign="middle" /></a></td>
82
+ <td><a href="https://www.movavi.com/imovie-for-windows.html" target="_blank"><img src="https://nestjs.com/img/logos/movavi-logo.svg" width="105" valign="middle" /></a></td>
83
+ </tr>
84
+ </table>
85
+
86
+ #### Silver Sponsors
87
+
88
+ <table style="text-align:center;">
89
+ <tr>
90
+ <td><a href="https://www.mercedes-benz.com/" target="_blank"><img src="https://nestjs.com/img/logos/mercedes-logo.png" width="100" valign="middle" /></a></td>
91
+ <td><a href="https://www.dinii.jp/" target="_blank"><img src="https://nestjs.com/img/logos/dinii-logo.png" width="65" valign="middle" /></a></td>
92
+ <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/logos/handsontable-dark-logo.svg#2" width="150" valign="middle" /></a></td>
93
+ <td align="center" valign="middle"><a href="https://www.itflashcards.com/" target="_blank"><img src="https://nestjs.com/img/logos/it_flashcards-logo.png" width="170" valign="middle" /></a></td>
94
+ <td align="center" valign="middle"><a href="https://arcjet.com/?ref=nestjs" target="_blank"><img src="https://nestjs.com/img/logos/arcjet-logo.svg" width="170" valign="middle" /></a></td>
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>
96
+ </tr><tr>
97
+ <td align="center" valign="middle"><a href="https://pandektes.com" target="_blank"><img src="https://nestjs.com/img/logos/pandektes-logo.png" width="65" valign="middle" /></a></td>
98
+ </tr>
99
+ </table>
100
+
101
+ #### Sponsors
102
+
103
+ <table>
104
+ <tr>
105
+ <td align="center" valign="middle"><a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/logos/swingdev-logo.svg#1" width="110" valign="middle" /></a></td>
106
+ <td align="center" valign="middle"><a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/logos/novologic.png" width="110" valign="middle" /></a></td>
107
+ <td align="center" valign="middle"><a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/logos/mantro-logo.svg" width="95" valign="middle" /></a></td>
108
+ <td align="center" valign="middle"><a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/logos/triplebyte.png" width="107" valign="middle" /></a></td>
109
+ <td align="center" valign="middle"><a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/logos/nearpod-logo.svg" width="100" valign="middle" /></a></td>
110
+ <td align="center" valign="middle"><a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/logos/genuinebee.svg" width="97" valign="middle" /></a></td>
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>
131
+ </tr>
132
+ </table>
133
+
134
+ ## Backers
135
+
136
+ <a href="https://opencollective.com/nest" target="_blank"><img src="https://opencollective.com/nest/backers.svg?width=1000"></a>
137
+
138
+ ## Stay in touch
139
+
140
+ - Author - [Kamil Myśliwiec](https://x.com/kammysliwiec)
141
+ - Website - [https://nestjs.com](https://nestjs.com/)
142
+ - X - [@nestframework](https://x.com/nestframework)
143
+
144
+ ## License
145
+
146
+ Nest is [MIT licensed](LICENSE).
package/changes.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "bumped": {
3
3
  "file-type": {
4
- "from": "21.3.0",
5
- "to": "^21.3.1"
4
+ "from": "21.3.2",
5
+ "to": "^22.0.0"
6
6
  }
7
7
  },
8
- "timestamp": "2026-03-09T21:01:48.096Z",
8
+ "timestamp": "2026-03-26T20:17:39.497Z",
9
9
  "totalUpdated": 1
10
10
  }
@@ -0,0 +1,22 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ExecutionContext } from '../features/execution-context.interface.js';
3
+ /**
4
+ * Interface describing a global preRequest hook for microservices.
5
+ *
6
+ * Hooks are executed before guards, allowing setup of context (e.g. AsyncLocalStorage)
7
+ * that is available to all downstream enhancers.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const als = new AsyncLocalStorage();
12
+ * app.registerPreRequestHook((context, next) => {
13
+ * als.enterWith({ correlationId: uuid() });
14
+ * return next();
15
+ * });
16
+ * ```
17
+ *
18
+ * @publicApi
19
+ */
20
+ export interface PreRequestHook {
21
+ (context: ExecutionContext, next: () => Observable<unknown>): Observable<unknown>;
22
+ }
package/internal.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Internal module - not part of the public API.
3
+ * These exports are used by sibling @nestjs packages.
4
+ * Do not depend on these in your application code.
5
+ * @internal
6
+ * @module
7
+ */
8
+ export * from './constants.js';
9
+ export { RouteParamtypes } from './enums/route-paramtypes.enum.js';
10
+ export * from './utils/shared.utils.js';
11
+ export * from './utils/load-package.util.js';
12
+ export * from './utils/cli-colors.util.js';
13
+ export * from './utils/random-string-generator.util.js';
14
+ export * from './utils/select-exception-filter-metadata.util.js';
15
+ export type { Controller, Injectable } from './interfaces/index.js';
16
+ export type { NestApplicationContextOptions } from './interfaces/nest-application-context-options.interface.js';
17
+ export type { NestMicroserviceOptions } from './interfaces/microservices/nest-microservice-options.interface.js';
18
+ export type { CorsOptions, CorsOptionsDelegate, CustomOrigin, } from './interfaces/external/cors-options.interface.js';
19
+ export type { ExceptionFilterMetadata } from './interfaces/exceptions/exception-filter-metadata.interface.js';
20
+ export type { RpcExceptionFilterMetadata } from './interfaces/exceptions/rpc-exception-filter-metadata.interface.js';
21
+ export type { VersionValue } from './interfaces/version-options.interface.js';
22
+ export type { GlobalPrefixOptions } from './interfaces/global-prefix-options.interface.js';
23
+ export type { MiddlewareConfiguration, RouteInfo, } from './interfaces/middleware/middleware-configuration.interface.js';
24
+ export type { MiddlewareConfigProxy } from './interfaces/middleware/middleware-config-proxy.interface.js';
25
+ export type { ModuleMetadata } from './interfaces/modules/module-metadata.interface.js';
26
+ export type { HttpArgumentsHost, RpcArgumentsHost, WsArgumentsHost, } from './interfaces/features/arguments-host.interface.js';
27
+ export type { RequestHandler } from './interfaces/http/http-server.interface.js';
28
+ export type { GetOrResolveOptions, SelectOptions, } from './interfaces/nest-application-context.interface.js';
29
+ export type { ShutdownHooksOptions } from './interfaces/shutdown-hooks-options.interface.js';
30
+ export { assignMetadata } from './decorators/http/route-params.decorator.js';
package/internal.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Internal module - not part of the public API.
3
+ * These exports are used by sibling @nestjs packages.
4
+ * Do not depend on these in your application code.
5
+ * @internal
6
+ * @module
7
+ */
8
+ // Constants
9
+ export * from './constants.js';
10
+ // Enums (internal)
11
+ export { RouteParamtypes } from './enums/route-paramtypes.enum.js';
12
+ // Utils
13
+ export * from './utils/shared.utils.js';
14
+ export * from './utils/load-package.util.js';
15
+ export * from './utils/cli-colors.util.js';
16
+ export * from './utils/random-string-generator.util.js';
17
+ export * from './utils/select-exception-filter-metadata.util.js';
18
+ // Decorators (internal)
19
+ export { assignMetadata } from './decorators/http/route-params.decorator.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depup/nestjs__common",
3
- "version": "11.1.16-depup.1",
4
- "description": "[DepUp] Nest - modern, fast, powerful node.js web framework (@common)",
3
+ "version": "11.1.17-depup.1",
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",
7
7
  "funding": {
@@ -13,12 +13,9 @@
13
13
  "url": "https://github.com/nestjs/nest.git",
14
14
  "directory": "packages/common"
15
15
  },
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
16
  "license": "MIT",
20
17
  "dependencies": {
21
- "file-type": "^21.3.1",
18
+ "file-type": "^22.0.0",
22
19
  "iterare": "1.2.1",
23
20
  "load-esm": "1.0.3",
24
21
  "tslib": "2.8.1",
@@ -38,24 +35,26 @@
38
35
  "optional": true
39
36
  }
40
37
  },
41
- "gitHead": "315e698096208868b43dda25f2db9ac9d7c1d822",
38
+ "gitHead": "447a373ebebd2c58b5b3c8d718f25922a025f2fe",
42
39
  "keywords": [
40
+ "@nestjs/common",
43
41
  "depup",
44
- "dependency-bumped",
45
- "updated-deps",
46
- "@nestjs/common"
42
+ "updated-dependencies",
43
+ "security",
44
+ "latest",
45
+ "patched"
47
46
  ],
48
47
  "depup": {
49
48
  "changes": {
50
49
  "file-type": {
51
- "from": "21.3.0",
52
- "to": "^21.3.1"
50
+ "from": "21.3.2",
51
+ "to": "^22.0.0"
53
52
  }
54
53
  },
55
54
  "depsUpdated": 1,
56
55
  "originalPackage": "@nestjs/common",
57
- "originalVersion": "11.1.16",
58
- "processedAt": "2026-03-09T21:01:51.396Z",
56
+ "originalVersion": "11.1.17",
57
+ "processedAt": "2026-03-26T20:17:43.671Z",
59
58
  "smokeTest": "passed"
60
59
  }
61
60
  }
@@ -0,0 +1,86 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface.js';
3
+ import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util.js';
4
+ /**
5
+ * @publicApi
6
+ */
7
+ export interface StandardSchemaValidationPipeOptions {
8
+ /**
9
+ * If true, the pipe will return the value produced by the schema
10
+ * (which may differ from the input if the schema coerces/transforms values).
11
+ * If false, the original input value is returned after successful validation.
12
+ * @default true
13
+ */
14
+ transform?: boolean;
15
+ /**
16
+ * If true, the pipe will also validate parameters decorated with custom decorators
17
+ * (created with `createParamDecorator`). When false, custom parameters are skipped.
18
+ * @default false
19
+ */
20
+ validateCustomDecorators?: boolean;
21
+ /**
22
+ * Options to pass to the standard schema `validate` function.
23
+ * These options are forwarded as the second argument to the schema's `~standard.validate` method.
24
+ */
25
+ validateOptions?: Record<string, unknown>;
26
+ /**
27
+ * The HTTP status code to be used in the response when the validation fails.
28
+ * @default HttpStatus.BAD_REQUEST
29
+ */
30
+ errorHttpStatusCode?: ErrorHttpStatusCode;
31
+ /**
32
+ * A factory function that returns an exception object to be thrown
33
+ * if validation fails.
34
+ * @param issues The issues returned by the standard schema validation
35
+ * @returns The exception object
36
+ */
37
+ exceptionFactory?: (issues: readonly StandardSchemaV1.Issue[]) => any;
38
+ }
39
+ /**
40
+ * Defines the built-in StandardSchemaValidation Pipe.
41
+ *
42
+ * Uses a standard schema object (conforming to the Standard Schema spec)
43
+ * attached to the parameter metadata to validate incoming values.
44
+ *
45
+ * @see [Standard Schema](https://github.com/standard-schema/standard-schema)
46
+ *
47
+ * @publicApi
48
+ */
49
+ export declare class StandardSchemaValidationPipe implements PipeTransform {
50
+ protected readonly options?: StandardSchemaValidationPipeOptions | undefined;
51
+ protected isTransformEnabled: boolean;
52
+ protected validateCustomDecorators: boolean;
53
+ protected validateOptions: Record<string, unknown> | undefined;
54
+ protected exceptionFactory: (issues: readonly StandardSchemaV1.Issue[]) => any;
55
+ constructor(options?: StandardSchemaValidationPipeOptions | undefined);
56
+ /**
57
+ * Method that validates the incoming value against the standard schema
58
+ * provided in the parameter metadata.
59
+ *
60
+ * @param value currently processed route argument
61
+ * @param metadata contains metadata about the currently processed route argument
62
+ */
63
+ transform<T = any>(value: T, metadata: ArgumentMetadata): Promise<T>;
64
+ /**
65
+ * Determines whether validation should be performed for the given metadata.
66
+ * Skips validation for custom decorators unless `validateCustomDecorators` is enabled.
67
+ *
68
+ * @param metadata contains metadata about the currently processed route argument
69
+ * @returns `true` if validation should be performed
70
+ */
71
+ protected toValidate(metadata: ArgumentMetadata): boolean;
72
+ /**
73
+ * Validates a value against a standard schema.
74
+ * Can be overridden to customize validation behavior.
75
+ *
76
+ * @param value The value to validate
77
+ * @param schema The standard schema to validate against
78
+ * @param options Optional options forwarded to the schema's validate method
79
+ * @returns The validation result
80
+ */
81
+ protected validate<T = unknown>(value: unknown, schema: StandardSchemaV1, options?: Record<string, unknown>): Promise<StandardSchemaV1.Result<T>> | StandardSchemaV1.Result<T>;
82
+ /**
83
+ * Strips dangerous prototype pollution keys from an object.
84
+ */
85
+ protected stripProtoKeys(value: any): void;
86
+ }
@@ -0,0 +1,120 @@
1
+ import { __decorate, __metadata, __param } from "tslib";
2
+ import { types } from 'util';
3
+ import { Injectable } from '../decorators/core/injectable.decorator.js';
4
+ import { Optional } from '../decorators/core/optional.decorator.js';
5
+ import { HttpStatus } from '../enums/http-status.enum.js';
6
+ import { HttpErrorByCode, } from '../utils/http-error-by-code.util.js';
7
+ /**
8
+ * Built-in JavaScript types that should be excluded from prototype stripping
9
+ * to avoid conflicts with test frameworks like Jest's useFakeTimers
10
+ */
11
+ const BUILT_IN_TYPES = [Date, RegExp, Error, Map, Set, WeakMap, WeakSet];
12
+ /**
13
+ * Defines the built-in StandardSchemaValidation Pipe.
14
+ *
15
+ * Uses a standard schema object (conforming to the Standard Schema spec)
16
+ * attached to the parameter metadata to validate incoming values.
17
+ *
18
+ * @see [Standard Schema](https://github.com/standard-schema/standard-schema)
19
+ *
20
+ * @publicApi
21
+ */
22
+ let StandardSchemaValidationPipe = class StandardSchemaValidationPipe {
23
+ options;
24
+ isTransformEnabled;
25
+ validateCustomDecorators;
26
+ validateOptions;
27
+ exceptionFactory;
28
+ constructor(options) {
29
+ this.options = options;
30
+ const { transform = true, validateCustomDecorators = false, validateOptions, exceptionFactory, errorHttpStatusCode = HttpStatus.BAD_REQUEST, } = options || {};
31
+ this.isTransformEnabled = transform;
32
+ this.validateCustomDecorators = validateCustomDecorators;
33
+ this.validateOptions = validateOptions;
34
+ this.exceptionFactory =
35
+ exceptionFactory ||
36
+ (issues => {
37
+ const messages = issues.map(issue => issue.message);
38
+ return new HttpErrorByCode[errorHttpStatusCode](messages);
39
+ });
40
+ }
41
+ /**
42
+ * Method that validates the incoming value against the standard schema
43
+ * provided in the parameter metadata.
44
+ *
45
+ * @param value currently processed route argument
46
+ * @param metadata contains metadata about the currently processed route argument
47
+ */
48
+ async transform(value, metadata) {
49
+ const schema = metadata.schema;
50
+ if (!schema || !this.toValidate(metadata)) {
51
+ return value;
52
+ }
53
+ this.stripProtoKeys(value);
54
+ const result = await this.validate(value, schema, this.validateOptions);
55
+ if (result.issues) {
56
+ throw this.exceptionFactory(result.issues);
57
+ }
58
+ return this.isTransformEnabled ? result.value : value;
59
+ }
60
+ /**
61
+ * Determines whether validation should be performed for the given metadata.
62
+ * Skips validation for custom decorators unless `validateCustomDecorators` is enabled.
63
+ *
64
+ * @param metadata contains metadata about the currently processed route argument
65
+ * @returns `true` if validation should be performed
66
+ */
67
+ toValidate(metadata) {
68
+ const { type } = metadata;
69
+ if (type === 'custom' && !this.validateCustomDecorators) {
70
+ return false;
71
+ }
72
+ return true;
73
+ }
74
+ /**
75
+ * Validates a value against a standard schema.
76
+ * Can be overridden to customize validation behavior.
77
+ *
78
+ * @param value The value to validate
79
+ * @param schema The standard schema to validate against
80
+ * @param options Optional options forwarded to the schema's validate method
81
+ * @returns The validation result
82
+ */
83
+ validate(value, schema, options) {
84
+ return schema['~standard'].validate(value, options);
85
+ }
86
+ /**
87
+ * Strips dangerous prototype pollution keys from an object.
88
+ */
89
+ stripProtoKeys(value) {
90
+ if (value == null ||
91
+ typeof value !== 'object' ||
92
+ types.isTypedArray(value)) {
93
+ return;
94
+ }
95
+ if (BUILT_IN_TYPES.some(type => value instanceof type)) {
96
+ return;
97
+ }
98
+ if (Array.isArray(value)) {
99
+ for (const v of value) {
100
+ this.stripProtoKeys(v);
101
+ }
102
+ return;
103
+ }
104
+ delete value.__proto__;
105
+ delete value.prototype;
106
+ const constructorType = value?.constructor;
107
+ if (constructorType && !BUILT_IN_TYPES.includes(constructorType)) {
108
+ delete value.constructor;
109
+ }
110
+ for (const key in value) {
111
+ this.stripProtoKeys(value[key]);
112
+ }
113
+ }
114
+ };
115
+ StandardSchemaValidationPipe = __decorate([
116
+ Injectable(),
117
+ __param(0, Optional()),
118
+ __metadata("design:paramtypes", [Object])
119
+ ], StandardSchemaValidationPipe);
120
+ export { StandardSchemaValidationPipe };
@@ -0,0 +1,50 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { Observable } from 'rxjs';
3
+ import { CallHandler, ExecutionContext, NestInterceptor } from '../interfaces/index.js';
4
+ import { StandardSchemaSerializerContextOptions } from './standard-schema-serializer.interfaces.js';
5
+ interface PlainLiteralObject {
6
+ [key: string]: any;
7
+ }
8
+ /**
9
+ * @publicApi
10
+ */
11
+ export interface StandardSchemaSerializerInterceptorOptions {
12
+ /**
13
+ * A default standard schema to use for serialization when no schema
14
+ * is provided via `@SerializeOptions()`.
15
+ */
16
+ schema?: StandardSchemaV1;
17
+ /**
18
+ * Default options forwarded to the schema's `~standard.validate()` call.
19
+ * Can be overridden per-handler via `@SerializeOptions({ validateOptions })`.
20
+ */
21
+ validateOptions?: StandardSchemaV1.Options;
22
+ }
23
+ /**
24
+ * An interceptor that serializes outgoing responses using a Standard Schema.
25
+ *
26
+ * The schema can be provided either:
27
+ * - As a default option in the interceptor constructor
28
+ * - Per-handler or per-class via `@SerializeOptions({ schema })` decorator
29
+ *
30
+ * When a schema is present, the interceptor validates/transforms the response
31
+ * through the schema's `~standard.validate()` method. If validation fails,
32
+ * the issues are thrown as an error.
33
+ *
34
+ * @see [Standard Schema](https://github.com/standard-schema/standard-schema)
35
+ *
36
+ * @publicApi
37
+ */
38
+ export declare class StandardSchemaSerializerInterceptor implements NestInterceptor {
39
+ protected readonly reflector: any;
40
+ protected readonly defaultOptions: StandardSchemaSerializerInterceptorOptions;
41
+ constructor(reflector: any, defaultOptions?: StandardSchemaSerializerInterceptorOptions);
42
+ intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
43
+ /**
44
+ * Serializes responses that are non-null objects nor streamable files.
45
+ */
46
+ serialize(response: PlainLiteralObject | Array<PlainLiteralObject>, schema: StandardSchemaV1 | undefined, validateOptions?: StandardSchemaV1.Options): PlainLiteralObject | Array<PlainLiteralObject> | Promise<PlainLiteralObject | Array<PlainLiteralObject>>;
47
+ transformToPlain(plainOrClass: any, schema: StandardSchemaV1, validateOptions?: StandardSchemaV1.Options): Promise<PlainLiteralObject>;
48
+ protected getContextOptions(context: ExecutionContext): StandardSchemaSerializerContextOptions | undefined;
49
+ }
50
+ export {};
@@ -0,0 +1,75 @@
1
+ import { __decorate, __metadata, __param } from "tslib";
2
+ import { map } from 'rxjs/operators';
3
+ import { Inject, Injectable, Optional } from '../decorators/core/index.js';
4
+ import { StreamableFile } from '../file-stream/index.js';
5
+ import { isObject } from '../utils/shared.utils.js';
6
+ import { CLASS_SERIALIZER_OPTIONS } from './class-serializer.constants.js';
7
+ // NOTE (external)
8
+ // We need to deduplicate them here due to the circular dependency
9
+ // between core and common packages
10
+ const REFLECTOR = 'Reflector';
11
+ /**
12
+ * An interceptor that serializes outgoing responses using a Standard Schema.
13
+ *
14
+ * The schema can be provided either:
15
+ * - As a default option in the interceptor constructor
16
+ * - Per-handler or per-class via `@SerializeOptions({ schema })` decorator
17
+ *
18
+ * When a schema is present, the interceptor validates/transforms the response
19
+ * through the schema's `~standard.validate()` method. If validation fails,
20
+ * the issues are thrown as an error.
21
+ *
22
+ * @see [Standard Schema](https://github.com/standard-schema/standard-schema)
23
+ *
24
+ * @publicApi
25
+ */
26
+ let StandardSchemaSerializerInterceptor = class StandardSchemaSerializerInterceptor {
27
+ reflector;
28
+ defaultOptions;
29
+ constructor(reflector, defaultOptions = {}) {
30
+ this.reflector = reflector;
31
+ this.defaultOptions = defaultOptions;
32
+ }
33
+ intercept(context, next) {
34
+ const contextOptions = this.getContextOptions(context);
35
+ const schema = contextOptions?.schema ?? this.defaultOptions.schema;
36
+ const validateOptions = contextOptions?.validateOptions ?? this.defaultOptions.validateOptions;
37
+ return next
38
+ .handle()
39
+ .pipe(map((res) => this.serialize(res, schema, validateOptions)));
40
+ }
41
+ /**
42
+ * Serializes responses that are non-null objects nor streamable files.
43
+ */
44
+ serialize(response, schema, validateOptions) {
45
+ if (!schema || !isObject(response) || response instanceof StreamableFile) {
46
+ return response;
47
+ }
48
+ return Array.isArray(response)
49
+ ? Promise.all(response.map(item => this.transformToPlain(item, schema, validateOptions)))
50
+ : this.transformToPlain(response, schema, validateOptions);
51
+ }
52
+ async transformToPlain(plainOrClass, schema, validateOptions) {
53
+ if (!plainOrClass) {
54
+ return plainOrClass;
55
+ }
56
+ const result = await schema['~standard'].validate(plainOrClass, validateOptions);
57
+ if (result.issues) {
58
+ throw new Error(`Serialization failed: ${result.issues.map(i => i.message).join(', ')}`);
59
+ }
60
+ return result.value;
61
+ }
62
+ getContextOptions(context) {
63
+ return this.reflector.getAllAndOverride(CLASS_SERIALIZER_OPTIONS, [
64
+ context.getHandler(),
65
+ context.getClass(),
66
+ ]);
67
+ }
68
+ };
69
+ StandardSchemaSerializerInterceptor = __decorate([
70
+ Injectable(),
71
+ __param(0, Inject(REFLECTOR)),
72
+ __param(1, Optional()),
73
+ __metadata("design:paramtypes", [Object, Object])
74
+ ], StandardSchemaSerializerInterceptor);
75
+ export { StandardSchemaSerializerInterceptor };
@@ -0,0 +1,18 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ /**
3
+ * Options for the `StandardSchemaSerializerInterceptor`, passed via
4
+ * `@SerializeOptions({ schema })`.
5
+ *
6
+ * @publicApi
7
+ */
8
+ export interface StandardSchemaSerializerContextOptions {
9
+ /**
10
+ * A standard schema to use for serialization.
11
+ * Used by `StandardSchemaSerializerInterceptor` to validate/transform the response.
12
+ */
13
+ schema?: StandardSchemaV1;
14
+ /**
15
+ * Optional options forwarded to the schema's `~standard.validate()` call.
16
+ */
17
+ validateOptions?: StandardSchemaV1.Options;
18
+ }