@depup/nestjs__common 11.1.28-depup.0 → 11.2.0-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 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.28 |
17
- | Processed | 2026-07-21 |
16
+ | Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.2.0 |
17
+ | Processed | 2026-08-14 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 1 |
20
20
 
package/changes.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "to": "^22.0.1"
6
6
  }
7
7
  },
8
- "timestamp": "2026-07-21T17:10:17.891Z",
8
+ "timestamp": "2026-08-14T16:18:22.898Z",
9
9
  "totalUpdated": 1
10
10
  }
@@ -6,3 +6,4 @@ export * from './render.decorator';
6
6
  export * from './header.decorator';
7
7
  export * from './redirect.decorator';
8
8
  export * from './sse.decorator';
9
+ export * from './sse-signal.decorator';
@@ -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
+ });
@@ -14,5 +14,6 @@ export declare enum RequestMethod {
14
14
  COPY = 12,
15
15
  MOVE = 13,
16
16
  LOCK = 14,
17
- UNLOCK = 15
17
+ UNLOCK = 15,
18
+ QUERY = 16
18
19
  }
@@ -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 = {}));
@@ -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 `'Bad Gateway'` by default; override this by supplying
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 `'Bad Gateway'` by default; override this by supplying
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
- * - `error`: the string `'Not Acceptable'` by default; override this by supplying
24
- * a string in the `error` parameter.
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
- * - `error`: the string `'Not Acceptable'` by default; override this by supplying
28
- * a string in the `error` parameter.
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
@@ -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;
@@ -1,6 +1,7 @@
1
1
  export interface MessageEvent {
2
- data: string | object;
2
+ data?: string | object;
3
3
  id?: string;
4
4
  type?: string;
5
5
  retry?: number;
6
+ comment?: string;
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/nestjs__common",
3
- "version": "11.1.28-depup.0",
3
+ "version": "11.2.0-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": "dfaa376170168d12d9d28bcfe137a9bacce579a3",
38
+ "gitHead": "f2a7e4b1f57193cbbfe34e988276fc0eaf0b6eb5",
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.28",
57
- "processedAt": "2026-07-21T17:10:22.482Z",
56
+ "originalVersion": "11.2.0",
57
+ "processedAt": "2026-08-14T16:18:27.909Z",
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
@@ -58,5 +65,6 @@ export type FileTypeValidatorOptions = {
58
65
  export declare class FileTypeValidator extends FileValidator<FileTypeValidatorOptions, IFile> {
59
66
  buildErrorMessage(file?: IFile): string;
60
67
  isValid(file?: IFile): Promise<boolean>;
68
+ private matchesFileType;
61
69
  }
62
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 (isFileValid && !!file.mimetype.match(this.validationOptions.fileType));
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 !!file.mimetype.match(this.validationOptions.fileType);
67
+ return this.matchesFileType(file.mimetype);
68
68
  }
69
69
  return false;
70
70
  }
@@ -80,8 +80,11 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
80
80
  const { fileTypeFromBuffer } = await (0, load_esm_1.loadEsm)(fileTypeModule);
81
81
  const fileType = await fileTypeFromBuffer(file.buffer);
82
82
  if (fileType) {
83
+ if (this.validationOptions.overrideMimeType) {
84
+ file.mimetype = fileType.mime;
85
+ }
83
86
  // Match detected mime type against allowed type
84
- return !!fileType.mime.match(this.validationOptions.fileType);
87
+ return this.matchesFileType(fileType.mime);
85
88
  }
86
89
  /**
87
90
  * Fallback logic: If file-type cannot detect magic number (e.g. file too small),
@@ -89,7 +92,7 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
89
92
  * This is useful for plain text, CSVs, or files without recognizable signatures.
90
93
  */
91
94
  if (this.validationOptions.fallbackToMimetype) {
92
- return !!file.mimetype.match(this.validationOptions.fileType);
95
+ return this.matchesFileType(file.mimetype);
93
96
  }
94
97
  return false;
95
98
  }
@@ -105,10 +108,19 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
105
108
  }
106
109
  // Fallback to mimetype if enabled
107
110
  if (this.validationOptions.fallbackToMimetype) {
108
- return !!file.mimetype.match(this.validationOptions.fileType);
111
+ return this.matchesFileType(file.mimetype);
109
112
  }
110
113
  return false;
111
114
  }
112
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
+ }
113
125
  }
114
126
  exports.FileTypeValidator = FileTypeValidator;
@@ -4,7 +4,7 @@ import { ValidationPipe, ValidationPipeOptions } from './validation.pipe';
4
4
  /**
5
5
  * @publicApi
6
6
  */
7
- export interface ParseArrayOptions extends Omit<ValidationPipeOptions, 'transform' | 'validateCustomDecorators' | 'exceptionFactory'> {
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: ParseArrayOptions;
40
+ protected readonly options: ParseArrayPipeOptions;
39
41
  protected readonly validationPipe: ValidationPipe;
40
42
  protected exceptionFactory: (error: string) => any;
41
- constructor(options?: ParseArrayOptions);
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;
@@ -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;
@@ -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).map(item => this.enumType[item]);
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
  };
@@ -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
- options.exceptionFactory || this.createExceptionFactory();
39
- classValidator = this.loadValidator(options.validatorPackage);
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 ??