@depup/nestjs__common 11.1.29-depup.0 → 11.2.1-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 +2 -2
- package/changes.json +1 -1
- package/decorators/http/index.d.ts +1 -0
- package/decorators/http/index.js +1 -0
- package/decorators/http/request-mapping.decorator.d.ts +11 -0
- package/decorators/http/request-mapping.decorator.js +12 -1
- package/decorators/http/sse-signal.decorator.d.ts +47 -0
- package/decorators/http/sse-signal.decorator.js +55 -0
- package/enums/request-method.enum.d.ts +2 -1
- package/enums/request-method.enum.js +1 -0
- package/interfaces/http/http-server.interface.d.ts +2 -0
- package/interfaces/microservices/transport-server.interface.d.ts +18 -0
- package/interfaces/microservices/transport-server.interface.js +1 -0
- package/internal.d.ts +1 -0
- package/internal.js +1 -0
- package/package.json +4 -4
- package/pipes/file/file-type.validator.d.ts +1 -0
- package/pipes/file/file-type.validator.js +14 -5
- package/pipes/parse-enum.pipe.js +7 -1
- package/pipes/standard-schema-validation.pipe.d.ts +5 -0
- package/pipes/standard-schema-validation.pipe.js +13 -1
- package/serializer/standard-schema-serializer.interceptor.js +2 -2
- package/utils/parameter-decorator-options.util.d.ts +13 -0
- package/utils/parameter-decorator-options.util.js +22 -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-08-
|
|
16
|
+
| Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.2.1 |
|
|
17
|
+
| Processed | 2026-08-15 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 1 |
|
|
20
20
|
|
package/changes.json
CHANGED
package/decorators/http/index.js
CHANGED
|
@@ -9,3 +9,4 @@ tslib_1.__exportStar(require("./render.decorator"), exports);
|
|
|
9
9
|
tslib_1.__exportStar(require("./header.decorator"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./redirect.decorator"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./sse.decorator"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./sse-signal.decorator"), exports);
|
|
@@ -76,6 +76,17 @@ export declare const All: (path?: string | string[]) => MethodDecorator;
|
|
|
76
76
|
* @publicApi
|
|
77
77
|
*/
|
|
78
78
|
export declare const Search: (path?: string | string[]) => MethodDecorator;
|
|
79
|
+
/**
|
|
80
|
+
* Route handler (method) Decorator. Routes HTTP QUERY requests to the specified path.
|
|
81
|
+
*
|
|
82
|
+
* **Note**: this is named `QueryMethod` (rather than `Query`) to avoid a name clash
|
|
83
|
+
* with the `@Query()` parameter decorator used to extract query-string params.
|
|
84
|
+
*
|
|
85
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
86
|
+
*
|
|
87
|
+
* @publicApi
|
|
88
|
+
*/
|
|
89
|
+
export declare const QueryMethod: (path?: string | string[]) => MethodDecorator;
|
|
79
90
|
/**
|
|
80
91
|
* Route handler (method) Decorator. Routes Webdav PROPFIND requests to the specified path.
|
|
81
92
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Unlock = exports.Lock = exports.Move = exports.Copy = exports.Mkcol = exports.Proppatch = exports.Propfind = exports.Search = exports.All = exports.Head = exports.Options = exports.Patch = exports.Put = exports.Delete = exports.Get = exports.Post = exports.RequestMapping = void 0;
|
|
3
|
+
exports.Unlock = exports.Lock = exports.Move = exports.Copy = exports.Mkcol = exports.Proppatch = exports.Propfind = exports.QueryMethod = exports.Search = exports.All = exports.Head = exports.Options = exports.Patch = exports.Put = exports.Delete = exports.Get = exports.Post = exports.RequestMapping = void 0;
|
|
4
4
|
const constants_1 = require("../../constants");
|
|
5
5
|
const request_method_enum_1 = require("../../enums/request-method.enum");
|
|
6
6
|
const defaultMetadata = {
|
|
@@ -96,6 +96,17 @@ exports.All = createMappingDecorator(request_method_enum_1.RequestMethod.ALL);
|
|
|
96
96
|
* @publicApi
|
|
97
97
|
*/
|
|
98
98
|
exports.Search = createMappingDecorator(request_method_enum_1.RequestMethod.SEARCH);
|
|
99
|
+
/**
|
|
100
|
+
* Route handler (method) Decorator. Routes HTTP QUERY requests to the specified path.
|
|
101
|
+
*
|
|
102
|
+
* **Note**: this is named `QueryMethod` (rather than `Query`) to avoid a name clash
|
|
103
|
+
* with the `@Query()` parameter decorator used to extract query-string params.
|
|
104
|
+
*
|
|
105
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
106
|
+
*
|
|
107
|
+
* @publicApi
|
|
108
|
+
*/
|
|
109
|
+
exports.QueryMethod = createMappingDecorator(request_method_enum_1.RequestMethod.QUERY);
|
|
99
110
|
/**
|
|
100
111
|
* Route handler (method) Decorator. Routes Webdav PROPFIND requests to the specified path.
|
|
101
112
|
*
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Symbol used to carry the per-request SSE `AbortController` on the request object.
|
|
3
|
+
*
|
|
4
|
+
* The controller is attached by the framework before the route handler runs and is
|
|
5
|
+
* aborted when the client disconnects. Its signal is exposed to route handlers
|
|
6
|
+
* through the `@SseSignal()` parameter decorator.
|
|
7
|
+
*
|
|
8
|
+
* @publicApi
|
|
9
|
+
*/
|
|
10
|
+
export declare const SSE_ABORT_CONTROLLER: unique symbol;
|
|
11
|
+
/**
|
|
12
|
+
* Route handler parameter decorator that injects the `AbortSignal` associated
|
|
13
|
+
* with a Server-Sent-Events (SSE) request.
|
|
14
|
+
*
|
|
15
|
+
* The signal represents the lifetime of the SSE response: it is aborted once the
|
|
16
|
+
* stream terminates, whether because the client disconnected, the `Observable`
|
|
17
|
+
* completed, or it errored. Tying setup-phase resources to the signal therefore
|
|
18
|
+
* releases them exactly once on every exit path, including resources allocated
|
|
19
|
+
* before the returned `Observable` exists — which would otherwise leak, since the
|
|
20
|
+
* producer is never subscribed once the client has disconnected.
|
|
21
|
+
*
|
|
22
|
+
* Because the signal also aborts on normal completion, `signal.aborted` is only
|
|
23
|
+
* meaningful as a "did the client go away?" check *during setup*, before the
|
|
24
|
+
* `Observable` is returned; at that point the stream cannot have completed yet.
|
|
25
|
+
* Cleanup wired to the `abort` event should be idempotent, as it may run
|
|
26
|
+
* alongside the `Observable`'s own teardown.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* @Sse('stream')
|
|
31
|
+
* async stream(@SseSignal() signal: AbortSignal): Promise<Observable<MessageEvent>> {
|
|
32
|
+
* const session = await createSession();
|
|
33
|
+
* if (signal.aborted) {
|
|
34
|
+
* await session.close();
|
|
35
|
+
* return EMPTY;
|
|
36
|
+
* }
|
|
37
|
+
* return new Observable(subscriber => {
|
|
38
|
+
* const stream = startGeneration(session);
|
|
39
|
+
* signal.addEventListener('abort', () => stream.stop(), { once: true });
|
|
40
|
+
* return () => stream.stop();
|
|
41
|
+
* });
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @publicApi
|
|
46
|
+
*/
|
|
47
|
+
export declare const SseSignal: () => ParameterDecorator;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SseSignal = exports.SSE_ABORT_CONTROLLER = void 0;
|
|
4
|
+
const create_route_param_metadata_decorator_1 = require("./create-route-param-metadata.decorator");
|
|
5
|
+
/**
|
|
6
|
+
* Symbol used to carry the per-request SSE `AbortController` on the request object.
|
|
7
|
+
*
|
|
8
|
+
* The controller is attached by the framework before the route handler runs and is
|
|
9
|
+
* aborted when the client disconnects. Its signal is exposed to route handlers
|
|
10
|
+
* through the `@SseSignal()` parameter decorator.
|
|
11
|
+
*
|
|
12
|
+
* @publicApi
|
|
13
|
+
*/
|
|
14
|
+
exports.SSE_ABORT_CONTROLLER = Symbol('SSE_ABORT_CONTROLLER');
|
|
15
|
+
/**
|
|
16
|
+
* Route handler parameter decorator that injects the `AbortSignal` associated
|
|
17
|
+
* with a Server-Sent-Events (SSE) request.
|
|
18
|
+
*
|
|
19
|
+
* The signal represents the lifetime of the SSE response: it is aborted once the
|
|
20
|
+
* stream terminates, whether because the client disconnected, the `Observable`
|
|
21
|
+
* completed, or it errored. Tying setup-phase resources to the signal therefore
|
|
22
|
+
* releases them exactly once on every exit path, including resources allocated
|
|
23
|
+
* before the returned `Observable` exists — which would otherwise leak, since the
|
|
24
|
+
* producer is never subscribed once the client has disconnected.
|
|
25
|
+
*
|
|
26
|
+
* Because the signal also aborts on normal completion, `signal.aborted` is only
|
|
27
|
+
* meaningful as a "did the client go away?" check *during setup*, before the
|
|
28
|
+
* `Observable` is returned; at that point the stream cannot have completed yet.
|
|
29
|
+
* Cleanup wired to the `abort` event should be idempotent, as it may run
|
|
30
|
+
* alongside the `Observable`'s own teardown.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* @Sse('stream')
|
|
35
|
+
* async stream(@SseSignal() signal: AbortSignal): Promise<Observable<MessageEvent>> {
|
|
36
|
+
* const session = await createSession();
|
|
37
|
+
* if (signal.aborted) {
|
|
38
|
+
* await session.close();
|
|
39
|
+
* return EMPTY;
|
|
40
|
+
* }
|
|
41
|
+
* return new Observable(subscriber => {
|
|
42
|
+
* const stream = startGeneration(session);
|
|
43
|
+
* signal.addEventListener('abort', () => stream.stop(), { once: true });
|
|
44
|
+
* return () => stream.stop();
|
|
45
|
+
* });
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @publicApi
|
|
50
|
+
*/
|
|
51
|
+
exports.SseSignal = (0, create_route_param_metadata_decorator_1.createParamDecorator)((_data, ctx) => {
|
|
52
|
+
const request = ctx.switchToHttp().getRequest();
|
|
53
|
+
const controller = request?.[exports.SSE_ABORT_CONTROLLER];
|
|
54
|
+
return controller?.signal;
|
|
55
|
+
});
|
|
@@ -19,4 +19,5 @@ var RequestMethod;
|
|
|
19
19
|
RequestMethod[RequestMethod["MOVE"] = 13] = "MOVE";
|
|
20
20
|
RequestMethod[RequestMethod["LOCK"] = 14] = "LOCK";
|
|
21
21
|
RequestMethod[RequestMethod["UNLOCK"] = 15] = "UNLOCK";
|
|
22
|
+
RequestMethod[RequestMethod["QUERY"] = 16] = "QUERY";
|
|
22
23
|
})(RequestMethod || (exports.RequestMethod = RequestMethod = {}));
|
|
@@ -39,6 +39,8 @@ export interface HttpServer<TRequest = any, TResponse = any, ServerInstance = an
|
|
|
39
39
|
options(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
|
40
40
|
search?(handler: RequestHandler<TRequest, TResponse>): any;
|
|
41
41
|
search?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
|
42
|
+
query?(handler: RequestHandler<TRequest, TResponse>): any;
|
|
43
|
+
query?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
|
42
44
|
listen(port: number | string, callback?: () => void): any;
|
|
43
45
|
listen(port: number | string, hostname: string, callback?: () => void): any;
|
|
44
46
|
reply(response: any, body: any, statusCode?: number): any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface describing the shape of a transport server.
|
|
3
|
+
* Used as the return type of `getTransportServer()` to provide
|
|
4
|
+
* autocomplete without creating circular dependencies.
|
|
5
|
+
*
|
|
6
|
+
* @publicApi
|
|
7
|
+
*/
|
|
8
|
+
export interface ITransportServer {
|
|
9
|
+
/**
|
|
10
|
+
* Starts the transport server.
|
|
11
|
+
* @param callback Function to be called upon initialization
|
|
12
|
+
*/
|
|
13
|
+
listen(callback: (...optionalParams: unknown[]) => any): any;
|
|
14
|
+
/**
|
|
15
|
+
* Closes the transport server (stops listening on port/connection).
|
|
16
|
+
*/
|
|
17
|
+
close(): any;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/internal.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
export * from './constants.js';
|
|
9
9
|
export { RouteParamtypes } from './enums/route-paramtypes.enum.js';
|
|
10
10
|
export * from './utils/shared.utils.js';
|
|
11
|
+
export * from './utils/parameter-decorator-options.util.js';
|
|
11
12
|
export * from './utils/load-package.util.js';
|
|
12
13
|
export * from './utils/cli-colors.util.js';
|
|
13
14
|
export * from './utils/random-string-generator.util.js';
|
package/internal.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from './constants.js';
|
|
|
11
11
|
export { RouteParamtypes } from './enums/route-paramtypes.enum.js';
|
|
12
12
|
// Utils
|
|
13
13
|
export * from './utils/shared.utils.js';
|
|
14
|
+
export * from './utils/parameter-decorator-options.util.js';
|
|
14
15
|
export * from './utils/load-package.util.js';
|
|
15
16
|
export * from './utils/cli-colors.util.js';
|
|
16
17
|
export * from './utils/random-string-generator.util.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/nestjs__common",
|
|
3
|
-
"version": "11.1
|
|
3
|
+
"version": "11.2.1-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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"optional": true
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "4535f43b4890c9c69c57c5a5a8b49f62c83d1ed6",
|
|
39
39
|
"keywords": [
|
|
40
40
|
"@nestjs/common",
|
|
41
41
|
"depup",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"depsUpdated": 1,
|
|
55
55
|
"originalPackage": "@nestjs/common",
|
|
56
|
-
"originalVersion": "11.1
|
|
57
|
-
"processedAt": "2026-08-
|
|
56
|
+
"originalVersion": "11.2.1",
|
|
57
|
+
"processedAt": "2026-08-15T00:16:32.505Z",
|
|
58
58
|
"smokeTest": "passed"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -65,5 +65,6 @@ export type FileTypeValidatorOptions = {
|
|
|
65
65
|
export declare class FileTypeValidator extends FileValidator<FileTypeValidatorOptions, IFile> {
|
|
66
66
|
buildErrorMessage(file?: IFile): string;
|
|
67
67
|
isValid(file?: IFile): Promise<boolean>;
|
|
68
|
+
private matchesFileType;
|
|
68
69
|
}
|
|
69
70
|
export {};
|
|
@@ -58,13 +58,13 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
|
58
58
|
const isFileValid = !!file && 'mimetype' in file;
|
|
59
59
|
// Skip magic number validation if set
|
|
60
60
|
if (this.validationOptions.skipMagicNumbersValidation) {
|
|
61
|
-
return
|
|
61
|
+
return isFileValid && this.matchesFileType(file.mimetype);
|
|
62
62
|
}
|
|
63
63
|
if (!isFileValid)
|
|
64
64
|
return false;
|
|
65
65
|
if (!file.buffer) {
|
|
66
66
|
if (this.validationOptions.fallbackToMimetype) {
|
|
67
|
-
return
|
|
67
|
+
return this.matchesFileType(file.mimetype);
|
|
68
68
|
}
|
|
69
69
|
return false;
|
|
70
70
|
}
|
|
@@ -84,7 +84,7 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
|
84
84
|
file.mimetype = fileType.mime;
|
|
85
85
|
}
|
|
86
86
|
// Match detected mime type against allowed type
|
|
87
|
-
return
|
|
87
|
+
return this.matchesFileType(fileType.mime);
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Fallback logic: If file-type cannot detect magic number (e.g. file too small),
|
|
@@ -92,7 +92,7 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
|
92
92
|
* This is useful for plain text, CSVs, or files without recognizable signatures.
|
|
93
93
|
*/
|
|
94
94
|
if (this.validationOptions.fallbackToMimetype) {
|
|
95
|
-
return
|
|
95
|
+
return this.matchesFileType(file.mimetype);
|
|
96
96
|
}
|
|
97
97
|
return false;
|
|
98
98
|
}
|
|
@@ -108,10 +108,19 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
|
|
|
108
108
|
}
|
|
109
109
|
// Fallback to mimetype if enabled
|
|
110
110
|
if (this.validationOptions.fallbackToMimetype) {
|
|
111
|
-
return
|
|
111
|
+
return this.matchesFileType(file.mimetype);
|
|
112
112
|
}
|
|
113
113
|
return false;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
+
matchesFileType(mimetype) {
|
|
117
|
+
const { fileType } = this.validationOptions;
|
|
118
|
+
// A string is coerced into a RegExp by `String#match`, so MIME types holding
|
|
119
|
+
// regex metacharacters (the `+` in `image/svg+xml`) never match themselves.
|
|
120
|
+
if (typeof fileType === 'string' && mimetype === fileType) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
return !!mimetype.match(fileType);
|
|
124
|
+
}
|
|
116
125
|
}
|
|
117
126
|
exports.FileTypeValidator = FileTypeValidator;
|
package/pipes/parse-enum.pipe.js
CHANGED
|
@@ -43,7 +43,13 @@ let ParseEnumPipe = class ParseEnumPipe {
|
|
|
43
43
|
return value;
|
|
44
44
|
}
|
|
45
45
|
isEnum(value) {
|
|
46
|
-
const enumValues = Object.keys(this.enumType)
|
|
46
|
+
const enumValues = Object.keys(this.enumType)
|
|
47
|
+
.filter(key => {
|
|
48
|
+
const enumValue = this.enumType[key];
|
|
49
|
+
return !(typeof enumValue === 'string' &&
|
|
50
|
+
typeof this.enumType[enumValue] === 'number');
|
|
51
|
+
})
|
|
52
|
+
.map(key => this.enumType[key]);
|
|
47
53
|
return enumValues.includes(value);
|
|
48
54
|
}
|
|
49
55
|
};
|
|
@@ -53,6 +53,11 @@ export declare class StandardSchemaValidationPipe implements PipeTransform {
|
|
|
53
53
|
protected validateOptions: Record<string, unknown> | undefined;
|
|
54
54
|
protected exceptionFactory: (issues: readonly StandardSchemaV1.Issue[]) => any;
|
|
55
55
|
constructor(options?: StandardSchemaValidationPipeOptions | undefined);
|
|
56
|
+
/**
|
|
57
|
+
* Formats Standard Schema validation issues into a flat list of error messages.
|
|
58
|
+
* When an issue includes a path, the path is prefixed to the message.
|
|
59
|
+
*/
|
|
60
|
+
protected formatIssueMessages(issues: readonly StandardSchemaV1.Issue[]): string[];
|
|
56
61
|
/**
|
|
57
62
|
* Method that validates the incoming value against the standard schema
|
|
58
63
|
* provided in the parameter metadata.
|
|
@@ -34,10 +34,22 @@ let StandardSchemaValidationPipe = class StandardSchemaValidationPipe {
|
|
|
34
34
|
this.exceptionFactory =
|
|
35
35
|
exceptionFactory ||
|
|
36
36
|
(issues => {
|
|
37
|
-
const messages =
|
|
37
|
+
const messages = this.formatIssueMessages(issues);
|
|
38
38
|
return new HttpErrorByCode[errorHttpStatusCode](messages);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Formats Standard Schema validation issues into a flat list of error messages.
|
|
43
|
+
* When an issue includes a path, the path is prefixed to the message.
|
|
44
|
+
*/
|
|
45
|
+
formatIssueMessages(issues) {
|
|
46
|
+
return issues.map(issue => {
|
|
47
|
+
if (issue.path?.length) {
|
|
48
|
+
return `${issue.path.map(String).join('.')}: ${issue.message}`;
|
|
49
|
+
}
|
|
50
|
+
return issue.message;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
41
53
|
/**
|
|
42
54
|
* Method that validates the incoming value against the standard schema
|
|
43
55
|
* provided in the parameter metadata.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { concatMap } from 'rxjs/operators';
|
|
3
3
|
import { Inject, Injectable, Optional } from '../decorators/core/index.js';
|
|
4
4
|
import { StreamableFile } from '../file-stream/index.js';
|
|
5
5
|
import { isObject } from '../utils/shared.utils.js';
|
|
@@ -36,7 +36,7 @@ let StandardSchemaSerializerInterceptor = class StandardSchemaSerializerIntercep
|
|
|
36
36
|
const validateOptions = contextOptions?.validateOptions ?? this.defaultOptions.validateOptions;
|
|
37
37
|
return next
|
|
38
38
|
.handle()
|
|
39
|
-
.pipe(
|
|
39
|
+
.pipe(concatMap(async (res) => this.serialize(res, schema, validateOptions)));
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Serializes responses that are non-null objects nor streamable files.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ParameterDecoratorOptions } from '../decorators/http/route-params.decorator.js';
|
|
2
|
+
/**
|
|
3
|
+
* Determines whether a parameter-decorator argument is a
|
|
4
|
+
* `ParameterDecoratorOptions` object rather than a pipe (instance or class).
|
|
5
|
+
*
|
|
6
|
+
* Kept in one place so every decorator (`@Query`, `@Body`, `@Param`,
|
|
7
|
+
* `@RawBody`, `@Payload`, `@MessageBody`, custom decorators, ...) classifies
|
|
8
|
+
* arguments identically: a pipe instance that happens to expose a `schema` or
|
|
9
|
+
* `pipes` property must never be mistaken for an options object.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function isParameterDecoratorOptions(value: unknown): value is ParameterDecoratorOptions;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isFunction } from './shared.utils.js';
|
|
2
|
+
const isPipeLike = (value) => isFunction(value?.transform) ||
|
|
3
|
+
(isFunction(value) &&
|
|
4
|
+
value.prototype &&
|
|
5
|
+
isFunction(value.prototype.transform));
|
|
6
|
+
/**
|
|
7
|
+
* Determines whether a parameter-decorator argument is a
|
|
8
|
+
* `ParameterDecoratorOptions` object rather than a pipe (instance or class).
|
|
9
|
+
*
|
|
10
|
+
* Kept in one place so every decorator (`@Query`, `@Body`, `@Param`,
|
|
11
|
+
* `@RawBody`, `@Payload`, `@MessageBody`, custom decorators, ...) classifies
|
|
12
|
+
* arguments identically: a pipe instance that happens to expose a `schema` or
|
|
13
|
+
* `pipes` property must never be mistaken for an options object.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export function isParameterDecoratorOptions(value) {
|
|
18
|
+
return (!!value &&
|
|
19
|
+
typeof value === 'object' &&
|
|
20
|
+
!isPipeLike(value) &&
|
|
21
|
+
('schema' in value || 'pipes' in value));
|
|
22
|
+
}
|