@nestjs/common 10.4.11 → 11.0.0-next.2
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/decorators/core/exception-filters.decorator.js +1 -3
- package/decorators/core/inject.decorator.d.ts +2 -1
- package/decorators/core/use-guards.decorator.js +1 -3
- package/decorators/core/use-interceptors.decorator.js +1 -2
- package/decorators/core/use-pipes.decorator.js +1 -2
- package/decorators/http/create-route-param-metadata.decorator.d.ts +1 -1
- package/decorators/http/create-route-param-metadata.decorator.js +2 -1
- package/decorators/http/request-mapping.decorator.d.ts +56 -0
- package/decorators/http/request-mapping.decorator.js +57 -1
- package/decorators/http/route-params.decorator.d.ts +1 -1
- package/decorators/http/route-params.decorator.js +2 -1
- package/decorators/modules/module.decorator.js +1 -1
- package/enums/http-status.enum.d.ts +8 -1
- package/enums/http-status.enum.js +7 -0
- package/enums/request-method.enum.d.ts +8 -1
- package/enums/request-method.enum.js +7 -0
- package/exceptions/bad-gateway.exception.d.ts +1 -1
- package/exceptions/bad-request.exception.d.ts +1 -1
- package/exceptions/conflict.exception.d.ts +1 -1
- package/exceptions/forbidden.exception.d.ts +1 -1
- package/exceptions/gateway-timeout.exception.d.ts +1 -1
- package/exceptions/gone.exception.d.ts +1 -1
- package/exceptions/http-version-not-supported.exception.d.ts +1 -1
- package/exceptions/http.exception.d.ts +8 -3
- package/exceptions/http.exception.js +4 -4
- package/exceptions/im-a-teapot.exception.d.ts +1 -1
- package/exceptions/index.d.ts +17 -16
- package/exceptions/index.js +17 -16
- package/exceptions/internal-server-error.exception.d.ts +1 -1
- package/exceptions/intrinsic.exception.d.ts +8 -0
- package/exceptions/intrinsic.exception.js +12 -0
- package/exceptions/method-not-allowed.exception.d.ts +1 -1
- package/exceptions/misdirected.exception.d.ts +1 -1
- package/exceptions/not-acceptable.exception.d.ts +1 -1
- package/exceptions/not-found.exception.d.ts +1 -1
- package/exceptions/not-implemented.exception.d.ts +1 -1
- package/exceptions/payload-too-large.exception.d.ts +1 -1
- package/exceptions/precondition-failed.exception.d.ts +1 -1
- package/exceptions/request-timeout.exception.d.ts +1 -1
- package/exceptions/service-unavailable.exception.d.ts +1 -1
- package/exceptions/unauthorized.exception.d.ts +1 -1
- package/exceptions/unprocessable-entity.exception.d.ts +1 -1
- package/exceptions/unsupported-media-type.exception.d.ts +1 -1
- package/file-stream/streamable-file.d.ts +3 -3
- package/file-stream/streamable-file.js +2 -2
- package/interfaces/external/transformer-package.interface.d.ts +1 -1
- package/interfaces/features/custom-route-param-factory.interface.d.ts +2 -1
- package/interfaces/http/http-exception-body.interface.d.ts +1 -1
- package/interfaces/http/http-server.interface.d.ts +15 -0
- package/interfaces/middleware/nest-middleware.interface.d.ts +1 -1
- package/interfaces/modules/module-metadata.interface.d.ts +1 -1
- package/interfaces/nest-application-context-options.interface.d.ts +8 -0
- package/interfaces/nest-application-context.interface.d.ts +3 -1
- package/interfaces/nest-microservice.interface.d.ts +25 -7
- package/module-utils/configurable-module.builder.js +4 -3
- package/module-utils/utils/get-injection-providers.util.d.ts +1 -1
- package/package.json +1 -1
- package/pipes/file/file-type.validator.d.ts +1 -1
- package/pipes/file/file-type.validator.js +4 -1
- package/pipes/file/max-file-size.validator.d.ts +1 -1
- package/pipes/file/max-file-size.validator.js +4 -1
- package/pipes/index.d.ts +4 -3
- package/pipes/index.js +4 -3
- package/pipes/parse-array.pipe.d.ts +17 -0
- package/pipes/parse-array.pipe.js +3 -1
- package/pipes/parse-bool.pipe.d.ts +15 -2
- package/pipes/parse-date.pipe.d.ts +37 -0
- package/pipes/parse-date.pipe.js +42 -0
- package/pipes/parse-enum.pipe.d.ts +15 -2
- package/pipes/parse-float.pipe.d.ts +15 -2
- package/pipes/parse-int.pipe.d.ts +15 -2
- package/pipes/parse-uuid.pipe.d.ts +18 -2
- package/pipes/validation.pipe.d.ts +3 -3
- package/pipes/validation.pipe.js +7 -1
- package/serializer/class-serializer.interceptor.js +1 -1
- package/services/console-logger.service.d.ts +95 -4
- package/services/console-logger.service.js +111 -16
- package/services/logger.service.d.ts +1 -1
- package/services/logger.service.js +2 -2
- package/utils/merge-with-values.util.js +1 -0
- package/utils/shared.utils.js +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UseFilters = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
5
4
|
const constants_1 = require("../../constants");
|
|
6
5
|
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
|
7
6
|
const shared_utils_1 = require("../../utils/shared.utils");
|
|
@@ -31,8 +30,7 @@ const UseFilters = (...filters) => addExceptionFiltersMetadata(...filters);
|
|
|
31
30
|
exports.UseFilters = UseFilters;
|
|
32
31
|
function addExceptionFiltersMetadata(...filters) {
|
|
33
32
|
return (target, key, descriptor) => {
|
|
34
|
-
const isFilterValid = (filter) => filter &&
|
|
35
|
-
((0, shared_utils_1.isFunction)(filter) || (0, shared_utils_1.isFunction)(filter.catch));
|
|
33
|
+
const isFilterValid = (filter) => filter && ((0, shared_utils_1.isFunction)(filter) || (0, shared_utils_1.isFunction)(filter.catch));
|
|
36
34
|
if (descriptor) {
|
|
37
35
|
(0, validate_each_util_1.validateEach)(target.constructor, filters, isFilterValid, '@UseFilters', 'filter');
|
|
38
36
|
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.EXCEPTION_FILTERS_METADATA, filters, descriptor.value);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ForwardReference, InjectionToken } from '../../interfaces';
|
|
1
2
|
/**
|
|
2
3
|
* Decorator that marks a constructor parameter as a target for
|
|
3
4
|
* [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
|
|
@@ -27,4 +28,4 @@
|
|
|
27
28
|
*
|
|
28
29
|
* @publicApi
|
|
29
30
|
*/
|
|
30
|
-
export declare function Inject
|
|
31
|
+
export declare function Inject(token?: InjectionToken | ForwardReference): PropertyDecorator & ParameterDecorator;
|
|
@@ -28,9 +28,7 @@ const validate_each_util_1 = require("../../utils/validate-each.util");
|
|
|
28
28
|
*/
|
|
29
29
|
function UseGuards(...guards) {
|
|
30
30
|
return (target, key, descriptor) => {
|
|
31
|
-
const isGuardValid = (guard) => guard &&
|
|
32
|
-
((0, shared_utils_1.isFunction)(guard) ||
|
|
33
|
-
(0, shared_utils_1.isFunction)(guard.canActivate));
|
|
31
|
+
const isGuardValid = (guard) => guard && ((0, shared_utils_1.isFunction)(guard) || (0, shared_utils_1.isFunction)(guard.canActivate));
|
|
34
32
|
if (descriptor) {
|
|
35
33
|
(0, validate_each_util_1.validateEach)(target.constructor, guards, isGuardValid, '@UseGuards', 'guard');
|
|
36
34
|
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.GUARDS_METADATA, guards, descriptor.value);
|
|
@@ -29,8 +29,7 @@ const validate_each_util_1 = require("../../utils/validate-each.util");
|
|
|
29
29
|
function UseInterceptors(...interceptors) {
|
|
30
30
|
return (target, key, descriptor) => {
|
|
31
31
|
const isInterceptorValid = (interceptor) => interceptor &&
|
|
32
|
-
((0, shared_utils_1.isFunction)(interceptor) ||
|
|
33
|
-
(0, shared_utils_1.isFunction)(interceptor.intercept));
|
|
32
|
+
((0, shared_utils_1.isFunction)(interceptor) || (0, shared_utils_1.isFunction)(interceptor.intercept));
|
|
34
33
|
if (descriptor) {
|
|
35
34
|
(0, validate_each_util_1.validateEach)(target.constructor, interceptors, isInterceptorValid, '@UseInterceptors', 'interceptor');
|
|
36
35
|
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.INTERCEPTORS_METADATA, interceptors, descriptor.value);
|
|
@@ -28,8 +28,7 @@ const validate_each_util_1 = require("../../utils/validate-each.util");
|
|
|
28
28
|
*/
|
|
29
29
|
function UsePipes(...pipes) {
|
|
30
30
|
return (target, key, descriptor) => {
|
|
31
|
-
const isPipeValid = (pipe) => pipe &&
|
|
32
|
-
((0, shared_utils_1.isFunction)(pipe) || (0, shared_utils_1.isFunction)(pipe.transform));
|
|
31
|
+
const isPipeValid = (pipe) => pipe && ((0, shared_utils_1.isFunction)(pipe) || (0, shared_utils_1.isFunction)(pipe.transform));
|
|
33
32
|
if (descriptor) {
|
|
34
33
|
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.PIPES_METADATA, pipes, descriptor.value);
|
|
35
34
|
return descriptor;
|
|
@@ -10,4 +10,4 @@ export type ParamDecoratorEnhancer = ParameterDecorator;
|
|
|
10
10
|
*
|
|
11
11
|
* @publicApi
|
|
12
12
|
*/
|
|
13
|
-
export declare function createParamDecorator<FactoryData = any,
|
|
13
|
+
export declare function createParamDecorator<FactoryData = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryOutput>, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | FactoryData)[]) => ParameterDecorator;
|
|
@@ -16,7 +16,8 @@ const shared_utils_1 = require("../../utils/shared.utils");
|
|
|
16
16
|
function createParamDecorator(factory, enhancers = []) {
|
|
17
17
|
const paramtype = (0, uid_1.uid)(21);
|
|
18
18
|
return (data, ...pipes) => (target, key, index) => {
|
|
19
|
-
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) ||
|
|
19
|
+
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) ||
|
|
20
|
+
{};
|
|
20
21
|
const isPipe = (pipe) => pipe &&
|
|
21
22
|
(((0, shared_utils_1.isFunction)(pipe) &&
|
|
22
23
|
pipe.prototype &&
|
|
@@ -76,3 +76,59 @@ 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 Webdav PROPFIND requests to the specified path.
|
|
81
|
+
*
|
|
82
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
83
|
+
*
|
|
84
|
+
* @publicApi
|
|
85
|
+
*/
|
|
86
|
+
export declare const Propfind: (path?: string | string[]) => MethodDecorator;
|
|
87
|
+
/**
|
|
88
|
+
* Route handler (method) Decorator. Routes Webdav PROPPATCH requests to the specified path.
|
|
89
|
+
*
|
|
90
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
91
|
+
*
|
|
92
|
+
* @publicApi
|
|
93
|
+
*/
|
|
94
|
+
export declare const Proppatch: (path?: string | string[]) => MethodDecorator;
|
|
95
|
+
/**
|
|
96
|
+
* Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.
|
|
97
|
+
*
|
|
98
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
99
|
+
*
|
|
100
|
+
* @publicApi
|
|
101
|
+
*/
|
|
102
|
+
export declare const Mkcol: (path?: string | string[]) => MethodDecorator;
|
|
103
|
+
/**
|
|
104
|
+
* Route handler (method) Decorator. Routes Webdav COPY requests to the specified path.
|
|
105
|
+
*
|
|
106
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
107
|
+
*
|
|
108
|
+
* @publicApi
|
|
109
|
+
*/
|
|
110
|
+
export declare const Copy: (path?: string | string[]) => MethodDecorator;
|
|
111
|
+
/**
|
|
112
|
+
* Route handler (method) Decorator. Routes Webdav MOVE requests to the specified path.
|
|
113
|
+
*
|
|
114
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
115
|
+
*
|
|
116
|
+
* @publicApi
|
|
117
|
+
*/
|
|
118
|
+
export declare const Move: (path?: string | string[]) => MethodDecorator;
|
|
119
|
+
/**
|
|
120
|
+
* Route handler (method) Decorator. Routes Webdav LOCK requests to the specified path.
|
|
121
|
+
*
|
|
122
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
123
|
+
*
|
|
124
|
+
* @publicApi
|
|
125
|
+
*/
|
|
126
|
+
export declare const Lock: (path?: string | string[]) => MethodDecorator;
|
|
127
|
+
/**
|
|
128
|
+
* Route handler (method) Decorator. Routes Webdav UNLOCK requests to the specified path.
|
|
129
|
+
*
|
|
130
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
131
|
+
*
|
|
132
|
+
* @publicApi
|
|
133
|
+
*/
|
|
134
|
+
export declare const Unlock: (path?: string | string[]) => MethodDecorator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.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,3 +96,59 @@ 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 Webdav PROPFIND requests to the specified path.
|
|
101
|
+
*
|
|
102
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
103
|
+
*
|
|
104
|
+
* @publicApi
|
|
105
|
+
*/
|
|
106
|
+
exports.Propfind = createMappingDecorator(request_method_enum_1.RequestMethod.PROPFIND);
|
|
107
|
+
/**
|
|
108
|
+
* Route handler (method) Decorator. Routes Webdav PROPPATCH requests to the specified path.
|
|
109
|
+
*
|
|
110
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
111
|
+
*
|
|
112
|
+
* @publicApi
|
|
113
|
+
*/
|
|
114
|
+
exports.Proppatch = createMappingDecorator(request_method_enum_1.RequestMethod.PROPPATCH);
|
|
115
|
+
/**
|
|
116
|
+
* Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.
|
|
117
|
+
*
|
|
118
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
119
|
+
*
|
|
120
|
+
* @publicApi
|
|
121
|
+
*/
|
|
122
|
+
exports.Mkcol = createMappingDecorator(request_method_enum_1.RequestMethod.MKCOL);
|
|
123
|
+
/**
|
|
124
|
+
* Route handler (method) Decorator. Routes Webdav COPY requests to the specified path.
|
|
125
|
+
*
|
|
126
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
127
|
+
*
|
|
128
|
+
* @publicApi
|
|
129
|
+
*/
|
|
130
|
+
exports.Copy = createMappingDecorator(request_method_enum_1.RequestMethod.COPY);
|
|
131
|
+
/**
|
|
132
|
+
* Route handler (method) Decorator. Routes Webdav MOVE requests to the specified path.
|
|
133
|
+
*
|
|
134
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
135
|
+
*
|
|
136
|
+
* @publicApi
|
|
137
|
+
*/
|
|
138
|
+
exports.Move = createMappingDecorator(request_method_enum_1.RequestMethod.MOVE);
|
|
139
|
+
/**
|
|
140
|
+
* Route handler (method) Decorator. Routes Webdav LOCK requests to the specified path.
|
|
141
|
+
*
|
|
142
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
143
|
+
*
|
|
144
|
+
* @publicApi
|
|
145
|
+
*/
|
|
146
|
+
exports.Lock = createMappingDecorator(request_method_enum_1.RequestMethod.LOCK);
|
|
147
|
+
/**
|
|
148
|
+
* Route handler (method) Decorator. Routes Webdav UNLOCK requests to the specified path.
|
|
149
|
+
*
|
|
150
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
151
|
+
*
|
|
152
|
+
* @publicApi
|
|
153
|
+
*/
|
|
154
|
+
exports.Unlock = createMappingDecorator(request_method_enum_1.RequestMethod.UNLOCK);
|
|
@@ -21,7 +21,7 @@ export interface RouteParamMetadata {
|
|
|
21
21
|
export declare function assignMetadata<TParamtype = any, TArgs = any>(args: TArgs, paramtype: TParamtype, index: number, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): TArgs & {
|
|
22
22
|
[x: string]: {
|
|
23
23
|
index: number;
|
|
24
|
-
data: ParamData;
|
|
24
|
+
data: ParamData | undefined;
|
|
25
25
|
pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[];
|
|
26
26
|
};
|
|
27
27
|
};
|
|
@@ -24,7 +24,8 @@ function assignMetadata(args, paramtype, index, data, ...pipes) {
|
|
|
24
24
|
}
|
|
25
25
|
function createRouteParamDecorator(paramtype) {
|
|
26
26
|
return (data) => (target, key, index) => {
|
|
27
|
-
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) ||
|
|
27
|
+
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) ||
|
|
28
|
+
{};
|
|
28
29
|
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target.constructor, key);
|
|
29
30
|
};
|
|
30
31
|
}
|
|
@@ -21,7 +21,7 @@ function Module(metadata) {
|
|
|
21
21
|
(0, validate_module_keys_util_1.validateModuleKeys)(propsKeys);
|
|
22
22
|
return (target) => {
|
|
23
23
|
for (const property in metadata) {
|
|
24
|
-
if (
|
|
24
|
+
if (Object.hasOwnProperty.call(metadata, property)) {
|
|
25
25
|
Reflect.defineMetadata(property, metadata[property], target);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -13,6 +13,9 @@ export declare enum HttpStatus {
|
|
|
13
13
|
NO_CONTENT = 204,
|
|
14
14
|
RESET_CONTENT = 205,
|
|
15
15
|
PARTIAL_CONTENT = 206,
|
|
16
|
+
MULTI_STATUS = 207,
|
|
17
|
+
ALREADY_REPORTED = 208,
|
|
18
|
+
CONTENT_DIFFERENT = 210,
|
|
16
19
|
AMBIGUOUS = 300,
|
|
17
20
|
MOVED_PERMANENTLY = 301,
|
|
18
21
|
FOUND = 302,
|
|
@@ -41,13 +44,17 @@ export declare enum HttpStatus {
|
|
|
41
44
|
I_AM_A_TEAPOT = 418,
|
|
42
45
|
MISDIRECTED = 421,
|
|
43
46
|
UNPROCESSABLE_ENTITY = 422,
|
|
47
|
+
LOCKED = 423,
|
|
44
48
|
FAILED_DEPENDENCY = 424,
|
|
45
49
|
PRECONDITION_REQUIRED = 428,
|
|
46
50
|
TOO_MANY_REQUESTS = 429,
|
|
51
|
+
UNRECOVERABLE_ERROR = 456,
|
|
47
52
|
INTERNAL_SERVER_ERROR = 500,
|
|
48
53
|
NOT_IMPLEMENTED = 501,
|
|
49
54
|
BAD_GATEWAY = 502,
|
|
50
55
|
SERVICE_UNAVAILABLE = 503,
|
|
51
56
|
GATEWAY_TIMEOUT = 504,
|
|
52
|
-
HTTP_VERSION_NOT_SUPPORTED = 505
|
|
57
|
+
HTTP_VERSION_NOT_SUPPORTED = 505,
|
|
58
|
+
INSUFFICIENT_STORAGE = 507,
|
|
59
|
+
LOOP_DETECTED = 508
|
|
53
60
|
}
|
|
@@ -17,6 +17,9 @@ var HttpStatus;
|
|
|
17
17
|
HttpStatus[HttpStatus["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
18
18
|
HttpStatus[HttpStatus["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
19
19
|
HttpStatus[HttpStatus["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
20
|
+
HttpStatus[HttpStatus["MULTI_STATUS"] = 207] = "MULTI_STATUS";
|
|
21
|
+
HttpStatus[HttpStatus["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
|
|
22
|
+
HttpStatus[HttpStatus["CONTENT_DIFFERENT"] = 210] = "CONTENT_DIFFERENT";
|
|
20
23
|
HttpStatus[HttpStatus["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
21
24
|
HttpStatus[HttpStatus["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
22
25
|
HttpStatus[HttpStatus["FOUND"] = 302] = "FOUND";
|
|
@@ -45,13 +48,17 @@ var HttpStatus;
|
|
|
45
48
|
HttpStatus[HttpStatus["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
46
49
|
HttpStatus[HttpStatus["MISDIRECTED"] = 421] = "MISDIRECTED";
|
|
47
50
|
HttpStatus[HttpStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
51
|
+
HttpStatus[HttpStatus["LOCKED"] = 423] = "LOCKED";
|
|
48
52
|
HttpStatus[HttpStatus["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
49
53
|
HttpStatus[HttpStatus["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
50
54
|
HttpStatus[HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
55
|
+
HttpStatus[HttpStatus["UNRECOVERABLE_ERROR"] = 456] = "UNRECOVERABLE_ERROR";
|
|
51
56
|
HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
52
57
|
HttpStatus[HttpStatus["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
53
58
|
HttpStatus[HttpStatus["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
54
59
|
HttpStatus[HttpStatus["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
55
60
|
HttpStatus[HttpStatus["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
56
61
|
HttpStatus[HttpStatus["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
62
|
+
HttpStatus[HttpStatus["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
63
|
+
HttpStatus[HttpStatus["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
57
64
|
})(HttpStatus || (exports.HttpStatus = HttpStatus = {}));
|
|
@@ -12,4 +12,11 @@ var RequestMethod;
|
|
|
12
12
|
RequestMethod[RequestMethod["OPTIONS"] = 6] = "OPTIONS";
|
|
13
13
|
RequestMethod[RequestMethod["HEAD"] = 7] = "HEAD";
|
|
14
14
|
RequestMethod[RequestMethod["SEARCH"] = 8] = "SEARCH";
|
|
15
|
+
RequestMethod[RequestMethod["PROPFIND"] = 9] = "PROPFIND";
|
|
16
|
+
RequestMethod[RequestMethod["PROPPATCH"] = 10] = "PROPPATCH";
|
|
17
|
+
RequestMethod[RequestMethod["MKCOL"] = 11] = "MKCOL";
|
|
18
|
+
RequestMethod[RequestMethod["COPY"] = 12] = "COPY";
|
|
19
|
+
RequestMethod[RequestMethod["MOVE"] = 13] = "MOVE";
|
|
20
|
+
RequestMethod[RequestMethod["LOCK"] = 14] = "LOCK";
|
|
21
|
+
RequestMethod[RequestMethod["UNLOCK"] = 15] = "UNLOCK";
|
|
15
22
|
})(RequestMethod || (exports.RequestMethod = RequestMethod = {}));
|
|
@@ -31,5 +31,5 @@ export declare class BadGatewayException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class BadRequestException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class ConflictException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class ForbiddenException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class GatewayTimeoutException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class GoneException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class HttpVersionNotSupportedException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpExceptionBody, HttpExceptionBodyMessage } from '../interfaces/http/http-exception-body.interface';
|
|
2
|
+
import { IntrinsicException } from './intrinsic.exception';
|
|
2
3
|
export interface HttpExceptionOptions {
|
|
3
4
|
/** original cause of the error */
|
|
4
5
|
cause?: unknown;
|
|
@@ -16,10 +17,15 @@ export interface DescriptionAndOptions {
|
|
|
16
17
|
*
|
|
17
18
|
* @publicApi
|
|
18
19
|
*/
|
|
19
|
-
export declare class HttpException extends
|
|
20
|
+
export declare class HttpException extends IntrinsicException {
|
|
20
21
|
private readonly response;
|
|
21
22
|
private readonly status;
|
|
22
23
|
private readonly options?;
|
|
24
|
+
/**
|
|
25
|
+
* Exception cause. Indicates the specific original cause of the error.
|
|
26
|
+
* It is used when catching and re-throwing an error with a more-specific or useful error message in order to still have access to the original error.
|
|
27
|
+
*/
|
|
28
|
+
cause: unknown;
|
|
23
29
|
/**
|
|
24
30
|
* Instantiate a plain HTTP Exception.
|
|
25
31
|
*
|
|
@@ -53,8 +59,7 @@ export declare class HttpException extends Error {
|
|
|
53
59
|
* @param status HTTP response status code.
|
|
54
60
|
* @param options An object used to add an error cause.
|
|
55
61
|
*/
|
|
56
|
-
constructor(response: string | Record<string, any>, status: number, options?: HttpExceptionOptions);
|
|
57
|
-
cause: unknown;
|
|
62
|
+
constructor(response: string | Record<string, any>, status: number, options?: HttpExceptionOptions | undefined);
|
|
58
63
|
/**
|
|
59
64
|
* Configures error chaining support
|
|
60
65
|
*
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpException = void 0;
|
|
4
4
|
const shared_utils_1 = require("../utils/shared.utils");
|
|
5
|
+
const intrinsic_exception_1 = require("./intrinsic.exception");
|
|
5
6
|
/**
|
|
6
7
|
* Defines the base Nest HTTP exception, which is handled by the default
|
|
7
8
|
* Exceptions Handler.
|
|
@@ -10,7 +11,7 @@ const shared_utils_1 = require("../utils/shared.utils");
|
|
|
10
11
|
*
|
|
11
12
|
* @publicApi
|
|
12
13
|
*/
|
|
13
|
-
class HttpException extends
|
|
14
|
+
class HttpException extends intrinsic_exception_1.IntrinsicException {
|
|
14
15
|
/**
|
|
15
16
|
* Instantiate a plain HTTP Exception.
|
|
16
17
|
*
|
|
@@ -69,8 +70,7 @@ class HttpException extends Error {
|
|
|
69
70
|
if ((0, shared_utils_1.isString)(this.response)) {
|
|
70
71
|
this.message = this.response;
|
|
71
72
|
}
|
|
72
|
-
else if ((0, shared_utils_1.isObject)(this.response) &&
|
|
73
|
-
(0, shared_utils_1.isString)(this.response.message)) {
|
|
73
|
+
else if ((0, shared_utils_1.isObject)(this.response) && (0, shared_utils_1.isString)(this.response.message)) {
|
|
74
74
|
this.message = this.response.message;
|
|
75
75
|
}
|
|
76
76
|
else if (this.constructor) {
|
|
@@ -95,7 +95,7 @@ class HttpException extends Error {
|
|
|
95
95
|
statusCode: statusCode,
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
if ((0, shared_utils_1.isString)(arg0) || Array.isArray(arg0)) {
|
|
98
|
+
if ((0, shared_utils_1.isString)(arg0) || Array.isArray(arg0) || (0, shared_utils_1.isNumber)(arg0)) {
|
|
99
99
|
return {
|
|
100
100
|
message: arg0,
|
|
101
101
|
error: arg1,
|
|
@@ -34,5 +34,5 @@ export declare class ImATeapotException extends HttpException {
|
|
|
34
34
|
* @param objectOrError string or object describing the error condition.
|
|
35
35
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
36
36
|
*/
|
|
37
|
-
constructor(objectOrError?:
|
|
37
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
38
38
|
}
|
package/exceptions/index.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
export * from './bad-gateway.exception';
|
|
1
2
|
export * from './bad-request.exception';
|
|
2
|
-
export * from './http.exception';
|
|
3
|
-
export * from './unauthorized.exception';
|
|
4
|
-
export * from './method-not-allowed.exception';
|
|
5
|
-
export * from './not-found.exception';
|
|
6
|
-
export * from './forbidden.exception';
|
|
7
|
-
export * from './not-acceptable.exception';
|
|
8
|
-
export * from './request-timeout.exception';
|
|
9
3
|
export * from './conflict.exception';
|
|
4
|
+
export * from './forbidden.exception';
|
|
5
|
+
export * from './gateway-timeout.exception';
|
|
10
6
|
export * from './gone.exception';
|
|
11
|
-
export * from './payload-too-large.exception';
|
|
12
|
-
export * from './unsupported-media-type.exception';
|
|
13
|
-
export * from './unprocessable-entity.exception';
|
|
14
|
-
export * from './internal-server-error.exception';
|
|
15
|
-
export * from './not-implemented.exception';
|
|
16
7
|
export * from './http-version-not-supported.exception';
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './service-unavailable.exception';
|
|
19
|
-
export * from './gateway-timeout.exception';
|
|
8
|
+
export * from './http.exception';
|
|
20
9
|
export * from './im-a-teapot.exception';
|
|
21
|
-
export * from './
|
|
10
|
+
export * from './internal-server-error.exception';
|
|
11
|
+
export * from './intrinsic.exception';
|
|
12
|
+
export * from './method-not-allowed.exception';
|
|
22
13
|
export * from './misdirected.exception';
|
|
14
|
+
export * from './not-acceptable.exception';
|
|
15
|
+
export * from './not-found.exception';
|
|
16
|
+
export * from './not-implemented.exception';
|
|
17
|
+
export * from './payload-too-large.exception';
|
|
18
|
+
export * from './precondition-failed.exception';
|
|
19
|
+
export * from './request-timeout.exception';
|
|
20
|
+
export * from './service-unavailable.exception';
|
|
21
|
+
export * from './unauthorized.exception';
|
|
22
|
+
export * from './unprocessable-entity.exception';
|
|
23
|
+
export * from './unsupported-media-type.exception';
|
package/exceptions/index.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./bad-gateway.exception"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./bad-request.exception"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./http.exception"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./unauthorized.exception"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./method-not-allowed.exception"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./not-found.exception"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./forbidden.exception"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./not-acceptable.exception"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./request-timeout.exception"), exports);
|
|
12
6
|
tslib_1.__exportStar(require("./conflict.exception"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./forbidden.exception"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./gateway-timeout.exception"), exports);
|
|
13
9
|
tslib_1.__exportStar(require("./gone.exception"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./payload-too-large.exception"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./unsupported-media-type.exception"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./unprocessable-entity.exception"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./internal-server-error.exception"), exports);
|
|
18
|
-
tslib_1.__exportStar(require("./not-implemented.exception"), exports);
|
|
19
10
|
tslib_1.__exportStar(require("./http-version-not-supported.exception"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./
|
|
21
|
-
tslib_1.__exportStar(require("./service-unavailable.exception"), exports);
|
|
22
|
-
tslib_1.__exportStar(require("./gateway-timeout.exception"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./http.exception"), exports);
|
|
23
12
|
tslib_1.__exportStar(require("./im-a-teapot.exception"), exports);
|
|
24
|
-
tslib_1.__exportStar(require("./
|
|
13
|
+
tslib_1.__exportStar(require("./internal-server-error.exception"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./intrinsic.exception"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./method-not-allowed.exception"), exports);
|
|
25
16
|
tslib_1.__exportStar(require("./misdirected.exception"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./not-acceptable.exception"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./not-found.exception"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./not-implemented.exception"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./payload-too-large.exception"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./precondition-failed.exception"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./request-timeout.exception"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./service-unavailable.exception"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./unauthorized.exception"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./unprocessable-entity.exception"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./unsupported-media-type.exception"), exports);
|
|
@@ -31,5 +31,5 @@ export declare class InternalServerErrorException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntrinsicException = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Exception that represents an intrinsic error in the application.
|
|
6
|
+
* When thrown, the default exception filter will not log the error message.
|
|
7
|
+
*
|
|
8
|
+
* @publicApi
|
|
9
|
+
*/
|
|
10
|
+
class IntrinsicException extends Error {
|
|
11
|
+
}
|
|
12
|
+
exports.IntrinsicException = IntrinsicException;
|
|
@@ -31,5 +31,5 @@ export declare class MethodNotAllowedException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class MisdirectedException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class NotAcceptableException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class NotFoundException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class NotImplementedException extends HttpException {
|
|
|
31
31
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
32
32
|
* @param error a short description of the HTTP error.
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|
|
@@ -31,5 +31,5 @@ export declare class PayloadTooLargeException extends HttpException {
|
|
|
31
31
|
* @param objectOrError string or object describing the error condition.
|
|
32
32
|
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
|
|
33
33
|
*/
|
|
34
|
-
constructor(objectOrError?:
|
|
34
|
+
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
|
|
35
35
|
}
|