@nestjs/common 9.1.6 → 9.2.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 -1
- package/exceptions/bad-gateway.exception.d.ts +4 -4
- package/exceptions/bad-gateway.exception.js +5 -4
- package/exceptions/bad-request.exception.d.ts +4 -4
- package/exceptions/bad-request.exception.js +5 -4
- package/exceptions/conflict.exception.d.ts +4 -4
- package/exceptions/conflict.exception.js +5 -4
- package/exceptions/forbidden.exception.d.ts +4 -4
- package/exceptions/forbidden.exception.js +5 -4
- package/exceptions/gateway-timeout.exception.d.ts +4 -4
- package/exceptions/gateway-timeout.exception.js +5 -4
- package/exceptions/gone.exception.d.ts +4 -4
- package/exceptions/gone.exception.js +5 -4
- package/exceptions/http-version-not-supported.exception.d.ts +4 -4
- package/exceptions/http-version-not-supported.exception.js +5 -4
- package/exceptions/http.exception.d.ts +33 -5
- package/exceptions/http.exception.js +54 -9
- package/exceptions/im-a-teapot.exception.d.ts +4 -4
- package/exceptions/im-a-teapot.exception.js +5 -4
- package/exceptions/internal-server-error.exception.d.ts +4 -4
- package/exceptions/internal-server-error.exception.js +5 -4
- package/exceptions/method-not-allowed.exception.d.ts +4 -4
- package/exceptions/method-not-allowed.exception.js +5 -4
- package/exceptions/misdirected.exception.d.ts +4 -4
- package/exceptions/misdirected.exception.js +5 -4
- package/exceptions/not-acceptable.exception.d.ts +4 -4
- package/exceptions/not-acceptable.exception.js +5 -4
- package/exceptions/not-found.exception.d.ts +4 -4
- package/exceptions/not-found.exception.js +5 -4
- package/exceptions/not-implemented.exception.d.ts +4 -4
- package/exceptions/not-implemented.exception.js +5 -4
- package/exceptions/payload-too-large.exception.d.ts +4 -4
- package/exceptions/payload-too-large.exception.js +5 -4
- package/exceptions/precondition-failed.exception.d.ts +4 -4
- package/exceptions/precondition-failed.exception.js +5 -4
- package/exceptions/request-timeout.exception.d.ts +4 -4
- package/exceptions/request-timeout.exception.js +5 -4
- package/exceptions/service-unavailable.exception.d.ts +4 -4
- package/exceptions/service-unavailable.exception.js +5 -4
- package/exceptions/unauthorized.exception.d.ts +4 -4
- package/exceptions/unauthorized.exception.js +5 -4
- package/exceptions/unprocessable-entity.exception.d.ts +4 -4
- package/exceptions/unprocessable-entity.exception.js +5 -4
- package/exceptions/unsupported-media-type.exception.d.ts +4 -4
- package/exceptions/unsupported-media-type.exception.js +5 -4
- package/interfaces/middleware/middleware-configuration.interface.d.ts +2 -0
- package/interfaces/nest-application-context.interface.d.ts +66 -4
- package/interfaces/nest-application-options.interface.d.ts +5 -0
- package/package.json +2 -2
- package/pipes/file/parse-file-pipe.builder.d.ts +2 -0
- package/pipes/file/parse-file-pipe.builder.js +5 -3
- package/services/console-logger.service.js +4 -5
|
@@ -20,7 +20,7 @@ class UnsupportedMediaTypeException extends http_exception_1.HttpException {
|
|
|
20
20
|
* @usageNotes
|
|
21
21
|
* The HTTP response status code will be 415.
|
|
22
22
|
* - The `objectOrError` argument defines the JSON response body or the message string.
|
|
23
|
-
* - The `
|
|
23
|
+
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
|
|
24
24
|
*
|
|
25
25
|
* By default, the JSON response body contains two properties:
|
|
26
26
|
* - `statusCode`: this will be the value 415.
|
|
@@ -33,10 +33,11 @@ class UnsupportedMediaTypeException extends http_exception_1.HttpException {
|
|
|
33
33
|
* and return it as the JSON response body.
|
|
34
34
|
*
|
|
35
35
|
* @param objectOrError string or object describing the error condition.
|
|
36
|
-
* @param
|
|
36
|
+
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
37
37
|
*/
|
|
38
|
-
constructor(objectOrError,
|
|
39
|
-
|
|
38
|
+
constructor(objectOrError, descriptionOrOptions = 'Unsupported Media Type') {
|
|
39
|
+
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
|
|
40
|
+
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.UNSUPPORTED_MEDIA_TYPE), http_status_enum_1.HttpStatus.UNSUPPORTED_MEDIA_TYPE, httpExceptionOptions);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
exports.UnsupportedMediaTypeException = UnsupportedMediaTypeException;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RequestMethod } from '../../enums';
|
|
2
2
|
import { Type } from '../type.interface';
|
|
3
|
+
import { VersionValue } from '../version-options.interface';
|
|
3
4
|
export interface RouteInfo {
|
|
4
5
|
path: string;
|
|
5
6
|
method: RequestMethod;
|
|
7
|
+
version?: VersionValue;
|
|
6
8
|
}
|
|
7
9
|
export interface MiddlewareConfiguration<T = any> {
|
|
8
10
|
middleware: T;
|
|
@@ -2,6 +2,19 @@ import { ShutdownSignal } from '../enums/shutdown-signal.enum';
|
|
|
2
2
|
import { LoggerService, LogLevel } from '../services/logger.service';
|
|
3
3
|
import { DynamicModule } from './modules';
|
|
4
4
|
import { Type } from './type.interface';
|
|
5
|
+
export interface GetOrResolveOptions {
|
|
6
|
+
/**
|
|
7
|
+
* If enabled, lookup will only be performed in the host module.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
strict?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* If enabled, instead of returning a first instance registered under a given token,
|
|
13
|
+
* a list of instances will be returned.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
each?: boolean;
|
|
17
|
+
}
|
|
5
18
|
/**
|
|
6
19
|
* Interface defining NestApplicationContext.
|
|
7
20
|
*
|
|
@@ -17,18 +30,67 @@ export interface INestApplicationContext {
|
|
|
17
30
|
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
18
31
|
* @returns {TResult}
|
|
19
32
|
*/
|
|
20
|
-
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol
|
|
21
|
-
|
|
33
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): TResult;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
36
|
+
* @returns {TResult}
|
|
37
|
+
*/
|
|
38
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
39
|
+
strict?: boolean;
|
|
40
|
+
each?: undefined | false;
|
|
22
41
|
}): TResult;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves a list of instances of either injectables or controllers, otherwise, throws exception.
|
|
44
|
+
* @returns {Array<TResult>}
|
|
45
|
+
*/
|
|
46
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
47
|
+
strict?: boolean;
|
|
48
|
+
each: true;
|
|
49
|
+
}): Array<TResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves an instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
52
|
+
* @returns {TResult | Array<TResult>}
|
|
53
|
+
*/
|
|
54
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options?: GetOrResolveOptions): TResult | Array<TResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
57
|
+
* @returns {Array<TResult>}
|
|
58
|
+
*/
|
|
59
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): Promise<TResult>;
|
|
23
60
|
/**
|
|
24
61
|
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
25
|
-
* @returns {
|
|
62
|
+
* @returns {Array<TResult>}
|
|
63
|
+
*/
|
|
64
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
65
|
+
id: number;
|
|
66
|
+
}): Promise<TResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
69
|
+
* @returns {Array<TResult>}
|
|
26
70
|
*/
|
|
27
71
|
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
28
72
|
id: number;
|
|
29
73
|
}, options?: {
|
|
30
|
-
strict
|
|
74
|
+
strict?: boolean;
|
|
75
|
+
each?: undefined | false;
|
|
31
76
|
}): Promise<TResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Resolves transient or request-scoped instances of either injectables or controllers, otherwise, throws exception.
|
|
79
|
+
* @returns {Array<TResult>}
|
|
80
|
+
*/
|
|
81
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
82
|
+
id: number;
|
|
83
|
+
}, options?: {
|
|
84
|
+
strict?: boolean;
|
|
85
|
+
each: true;
|
|
86
|
+
}): Promise<Array<TResult>>;
|
|
87
|
+
/**
|
|
88
|
+
* Resolves transient or request-scoped instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
89
|
+
* @returns {Promise<TResult | Array<TResult>>}
|
|
90
|
+
*/
|
|
91
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
92
|
+
id: number;
|
|
93
|
+
}, options?: GetOrResolveOptions): Promise<TResult | Array<TResult>>;
|
|
32
94
|
/**
|
|
33
95
|
* Registers the request/context object for a given context ID (DI container sub-tree).
|
|
34
96
|
* @returns {void}
|
|
@@ -21,4 +21,9 @@ export interface NestApplicationOptions extends NestApplicationContextOptions {
|
|
|
21
21
|
* Whether to register the raw request body on the request. Use `req.rawBody`.
|
|
22
22
|
*/
|
|
23
23
|
rawBody?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Force close open HTTP connections. Useful if restarting your application hangs due to
|
|
26
|
+
* keep-alive connections in the HTTP adapter.
|
|
27
|
+
*/
|
|
28
|
+
forceCloseConnections?: boolean;
|
|
24
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/common",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"iterare": "1.2.1",
|
|
21
|
-
"tslib": "2.4.
|
|
21
|
+
"tslib": "2.4.1",
|
|
22
22
|
"uuid": "9.0.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FileTypeValidatorOptions } from './file-type.validator';
|
|
2
|
+
import { FileValidator } from './file-validator.interface';
|
|
2
3
|
import { MaxFileSizeValidatorOptions } from './max-file-size.validator';
|
|
3
4
|
import { ParseFileOptions } from './parse-file-options.interface';
|
|
4
5
|
import { ParseFilePipe } from './parse-file.pipe';
|
|
@@ -6,5 +7,6 @@ export declare class ParseFilePipeBuilder {
|
|
|
6
7
|
private validators;
|
|
7
8
|
addMaxSizeValidator(options: MaxFileSizeValidatorOptions): this;
|
|
8
9
|
addFileTypeValidator(options: FileTypeValidatorOptions): this;
|
|
10
|
+
addValidator(validator: FileValidator): this;
|
|
9
11
|
build(additionalOptions?: Omit<ParseFileOptions, 'validators'>): ParseFilePipe;
|
|
10
12
|
}
|
|
@@ -9,11 +9,13 @@ class ParseFilePipeBuilder {
|
|
|
9
9
|
this.validators = [];
|
|
10
10
|
}
|
|
11
11
|
addMaxSizeValidator(options) {
|
|
12
|
-
this.
|
|
13
|
-
return this;
|
|
12
|
+
return this.addValidator(new max_file_size_validator_1.MaxFileSizeValidator(options));
|
|
14
13
|
}
|
|
15
14
|
addFileTypeValidator(options) {
|
|
16
|
-
this.
|
|
15
|
+
return this.addValidator(new file_type_validator_1.FileTypeValidator(options));
|
|
16
|
+
}
|
|
17
|
+
addValidator(validator) {
|
|
18
|
+
this.validators.push(validator);
|
|
17
19
|
return this;
|
|
18
20
|
}
|
|
19
21
|
build(additionalOptions) {
|
|
@@ -3,8 +3,7 @@ var ConsoleLogger_1;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ConsoleLogger = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const
|
|
7
|
-
const optional_decorator_1 = require("../decorators/core/optional.decorator");
|
|
6
|
+
const core_1 = require("../decorators/core");
|
|
8
7
|
const cli_colors_util_1 = require("../utils/cli-colors.util");
|
|
9
8
|
const shared_utils_1 = require("../utils/shared.utils");
|
|
10
9
|
const utils_1 = require("./utils");
|
|
@@ -208,9 +207,9 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
|
208
207
|
}
|
|
209
208
|
};
|
|
210
209
|
ConsoleLogger = ConsoleLogger_1 = tslib_1.__decorate([
|
|
211
|
-
(0,
|
|
212
|
-
tslib_1.__param(0, (0,
|
|
213
|
-
tslib_1.__param(1, (0,
|
|
210
|
+
(0, core_1.Injectable)(),
|
|
211
|
+
tslib_1.__param(0, (0, core_1.Optional)()),
|
|
212
|
+
tslib_1.__param(1, (0, core_1.Optional)()),
|
|
214
213
|
tslib_1.__metadata("design:paramtypes", [String, Object])
|
|
215
214
|
], ConsoleLogger);
|
|
216
215
|
exports.ConsoleLogger = ConsoleLogger;
|