@depup/nestjs__core 11.2.2-depup.0 → 12.0.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/adapters/http-adapter.d.ts +5 -3
- package/adapters/http-adapter.js +8 -5
- package/adapters/index.d.ts +1 -1
- package/adapters/index.js +1 -4
- package/application-config.d.ts +13 -4
- package/application-config.js +34 -15
- package/changes.json +1 -1
- package/constants.d.ts +1 -1
- package/constants.js +10 -13
- package/discovery/discoverable-meta-host-collection.d.ts +3 -3
- package/discovery/discoverable-meta-host-collection.js +15 -19
- package/discovery/discovery-module.js +9 -12
- package/discovery/discovery-service.d.ts +4 -4
- package/discovery/discovery-service.js +17 -19
- package/discovery/index.d.ts +2 -2
- package/discovery/index.js +2 -5
- package/errors/exception-handler.js +3 -7
- package/errors/exceptions/circular-dependency.exception.d.ts +1 -1
- package/errors/exceptions/circular-dependency.exception.js +2 -6
- package/errors/exceptions/index.d.ts +9 -8
- package/errors/exceptions/index.js +9 -11
- package/errors/exceptions/invalid-class-module.exception.d.ts +1 -1
- package/errors/exceptions/invalid-class-module.exception.js +4 -8
- package/errors/exceptions/invalid-class-scope.exception.d.ts +2 -2
- package/errors/exceptions/invalid-class-scope.exception.js +6 -10
- package/errors/exceptions/invalid-class.exception.d.ts +1 -1
- package/errors/exceptions/invalid-class.exception.js +4 -8
- package/errors/exceptions/invalid-exception-filter.exception.d.ts +1 -1
- package/errors/exceptions/invalid-exception-filter.exception.js +4 -8
- package/errors/exceptions/invalid-middleware-configuration.exception.d.ts +1 -1
- package/errors/exceptions/invalid-middleware-configuration.exception.js +4 -8
- package/errors/exceptions/invalid-middleware.exception.d.ts +1 -1
- package/errors/exceptions/invalid-middleware.exception.js +4 -8
- package/errors/exceptions/invalid-module.exception.d.ts +1 -1
- package/errors/exceptions/invalid-module.exception.js +4 -8
- package/errors/exceptions/route-conflict.exception.d.ts +4 -0
- package/errors/exceptions/route-conflict.exception.js +7 -0
- package/errors/exceptions/runtime.exception.js +1 -5
- package/errors/exceptions/undefined-dependency.exception.d.ts +3 -3
- package/errors/exceptions/undefined-dependency.exception.js +4 -8
- package/errors/exceptions/undefined-forwardref.exception.d.ts +2 -2
- package/errors/exceptions/undefined-forwardref.exception.js +4 -8
- package/errors/exceptions/undefined-module.exception.d.ts +1 -1
- package/errors/exceptions/undefined-module.exception.js +4 -8
- package/errors/exceptions/unknown-dependencies.exception.d.ts +3 -3
- package/errors/exceptions/unknown-dependencies.exception.js +8 -8
- package/errors/exceptions/unknown-element.exception.d.ts +1 -1
- package/errors/exceptions/unknown-element.exception.js +2 -6
- package/errors/exceptions/unknown-export.exception.d.ts +1 -1
- package/errors/exceptions/unknown-export.exception.js +4 -8
- package/errors/exceptions/unknown-module.exception.d.ts +1 -1
- package/errors/exceptions/unknown-module.exception.js +2 -6
- package/errors/exceptions/unknown-request-mapping.exception.d.ts +1 -1
- package/errors/exceptions/unknown-request-mapping.exception.js +4 -8
- package/errors/exceptions-zone.js +6 -10
- package/errors/messages.d.ts +5 -2
- package/errors/messages.js +26 -32
- package/exceptions/base-exception-filter-context.d.ts +6 -7
- package/exceptions/base-exception-filter-context.js +13 -16
- package/exceptions/base-exception-filter.d.ts +4 -4
- package/exceptions/base-exception-filter.js +38 -23
- package/exceptions/exceptions-handler.d.ts +4 -4
- package/exceptions/exceptions-handler.js +8 -16
- package/exceptions/external-exception-filter-context.d.ts +8 -8
- package/exceptions/external-exception-filter-context.js +14 -18
- package/exceptions/external-exception-filter.d.ts +1 -1
- package/exceptions/external-exception-filter.js +4 -8
- package/exceptions/external-exceptions-handler.d.ts +3 -3
- package/exceptions/external-exceptions-handler.js +8 -16
- package/exceptions/index.d.ts +1 -1
- package/exceptions/index.js +1 -4
- package/guards/constants.js +1 -4
- package/guards/guards-consumer.d.ts +4 -3
- package/guards/guards-consumer.js +8 -12
- package/guards/guards-context-creator.d.ts +11 -10
- package/guards/guards-context-creator.js +18 -20
- package/guards/index.d.ts +3 -3
- package/guards/index.js +3 -6
- package/helpers/barrier.js +5 -5
- package/helpers/context-creator.d.ts +2 -2
- package/helpers/context-creator.js +3 -7
- package/helpers/context-id-factory.d.ts +1 -1
- package/helpers/context-id-factory.js +10 -14
- package/helpers/context-utils.d.ts +6 -3
- package/helpers/context-utils.js +7 -12
- package/helpers/execution-context-host.d.ts +3 -3
- package/helpers/execution-context-host.js +5 -6
- package/helpers/external-context-creator.d.ts +15 -18
- package/helpers/external-context-creator.js +54 -43
- package/helpers/external-proxy.d.ts +2 -2
- package/helpers/external-proxy.js +3 -7
- package/helpers/get-class-scope.d.ts +2 -2
- package/helpers/get-class-scope.js +3 -6
- package/helpers/handler-metadata-storage.d.ts +4 -4
- package/helpers/handler-metadata-storage.js +7 -15
- package/helpers/http-adapter-host.d.ts +1 -1
- package/helpers/http-adapter-host.js +6 -11
- package/helpers/index.d.ts +3 -3
- package/helpers/index.js +3 -6
- package/helpers/interfaces/external-handler-metadata.interface.d.ts +2 -2
- package/helpers/interfaces/external-handler-metadata.interface.js +1 -2
- package/helpers/interfaces/index.d.ts +2 -2
- package/helpers/interfaces/index.js +2 -5
- package/helpers/interfaces/params-metadata.interface.d.ts +1 -1
- package/helpers/interfaces/params-metadata.interface.js +1 -2
- package/helpers/is-durable.d.ts +1 -1
- package/helpers/is-durable.js +3 -6
- package/helpers/load-adapter.d.ts +1 -1
- package/helpers/load-adapter.js +5 -8
- package/helpers/messages.d.ts +1 -1
- package/helpers/messages.js +10 -20
- package/helpers/optional-require.d.ts +1 -1
- package/helpers/optional-require.js +2 -5
- package/helpers/rethrow.js +1 -5
- package/helpers/router-method-factory.d.ts +2 -2
- package/helpers/router-method-factory.js +21 -25
- package/helpers/safe-instance-decorator.js +3 -6
- package/hooks/before-app-shutdown.hook.d.ts +3 -3
- package/hooks/before-app-shutdown.hook.js +25 -23
- package/hooks/index.d.ts +5 -5
- package/hooks/index.js +5 -8
- package/hooks/on-app-bootstrap.hook.d.ts +3 -3
- package/hooks/on-app-bootstrap.hook.js +15 -22
- package/hooks/on-app-shutdown.hook.d.ts +3 -3
- package/hooks/on-app-shutdown.hook.js +25 -23
- package/hooks/on-module-destroy.hook.d.ts +3 -3
- package/hooks/on-module-destroy.hook.js +25 -23
- package/hooks/on-module-init.hook.d.ts +3 -3
- package/hooks/on-module-init.hook.js +15 -22
- package/hooks/utils/get-instances-grouped-by-hierarchy-level.d.ts +3 -0
- package/hooks/utils/get-instances-grouped-by-hierarchy-level.js +27 -0
- package/hooks/utils/get-sorted-hierarchy-levels.d.ts +1 -0
- package/hooks/utils/get-sorted-hierarchy-levels.js +7 -0
- package/index.d.ts +16 -16
- package/index.js +17 -26
- package/injector/abstract-instance-resolver.d.ts +6 -6
- package/injector/abstract-instance-resolver.js +7 -11
- package/injector/compiler.d.ts +2 -2
- package/injector/compiler.js +2 -5
- package/injector/constants.d.ts +1 -1
- package/injector/constants.js +2 -5
- package/injector/container.d.ts +13 -14
- package/injector/container.js +40 -40
- package/injector/helpers/provider-classifier.d.ts +1 -1
- package/injector/helpers/provider-classifier.js +5 -10
- package/injector/helpers/silent-logger.js +9 -16
- package/injector/index.d.ts +6 -6
- package/injector/index.js +5 -8
- package/injector/injector.d.ts +7 -6
- package/injector/injector.js +98 -87
- package/injector/inquirer/index.d.ts +1 -1
- package/injector/inquirer/index.js +1 -4
- package/injector/inquirer/inquirer-constants.js +1 -4
- package/injector/inquirer/inquirer-providers.d.ts +1 -1
- package/injector/inquirer/inquirer-providers.js +5 -8
- package/injector/instance-links-host.d.ts +3 -3
- package/injector/instance-links-host.js +8 -11
- package/injector/instance-loader.d.ts +5 -5
- package/injector/instance-loader.js +11 -11
- package/injector/instance-wrapper.d.ts +8 -5
- package/injector/instance-wrapper.js +95 -76
- package/injector/internal-core-module/index.d.ts +1 -1
- package/injector/internal-core-module/index.js +1 -4
- package/injector/internal-core-module/internal-core-module-factory.d.ts +6 -6
- package/injector/internal-core-module/internal-core-module-factory.js +23 -27
- package/injector/internal-core-module/internal-core-module.d.ts +2 -2
- package/injector/internal-core-module/internal-core-module.js +17 -20
- package/injector/internal-providers-storage.d.ts +2 -2
- package/injector/internal-providers-storage.js +4 -9
- package/injector/lazy-module-loader/lazy-module-loader-options.interface.js +1 -2
- package/injector/lazy-module-loader/lazy-module-loader.d.ts +8 -8
- package/injector/lazy-module-loader/lazy-module-loader.js +10 -9
- package/injector/module-ref.d.ts +7 -7
- package/injector/module-ref.js +30 -35
- package/injector/module.d.ts +5 -5
- package/injector/module.js +96 -82
- package/injector/modules-container.d.ts +1 -1
- package/injector/modules-container.js +5 -12
- package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.d.ts +2 -4
- package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.js +6 -9
- package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.d.ts +2 -3
- package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.js +17 -22
- package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.d.ts +1 -3
- package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.js +1 -2
- package/injector/settlement-signal.js +5 -7
- package/injector/topology-tree/topology-tree.d.ts +1 -1
- package/injector/topology-tree/topology-tree.js +6 -9
- package/injector/topology-tree/tree-node.js +4 -6
- package/inspector/deterministic-uuid-registry.js +2 -6
- package/inspector/graph-inspector.d.ts +7 -7
- package/inspector/graph-inspector.js +10 -12
- package/inspector/index.d.ts +4 -4
- package/inspector/index.js +4 -7
- package/inspector/initialize-on-preview.allowlist.d.ts +1 -1
- package/inspector/initialize-on-preview.allowlist.js +2 -6
- package/inspector/interfaces/edge.interface.d.ts +1 -1
- package/inspector/interfaces/edge.interface.js +1 -2
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +3 -3
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +1 -2
- package/inspector/interfaces/entrypoint.interface.d.ts +2 -2
- package/inspector/interfaces/entrypoint.interface.js +1 -2
- package/inspector/interfaces/extras.interface.d.ts +1 -1
- package/inspector/interfaces/extras.interface.js +1 -2
- package/inspector/interfaces/node.interface.d.ts +2 -2
- package/inspector/interfaces/node.interface.js +1 -2
- package/inspector/interfaces/serialized-graph-json.interface.d.ts +6 -6
- package/inspector/interfaces/serialized-graph-json.interface.js +1 -2
- package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +1 -1
- package/inspector/interfaces/serialized-graph-metadata.interface.js +1 -2
- package/inspector/noop-graph-inspector.d.ts +1 -1
- package/inspector/noop-graph-inspector.js +2 -5
- package/inspector/partial-graph.host.d.ts +2 -2
- package/inspector/partial-graph.host.js +2 -5
- package/inspector/serialized-graph.d.ts +7 -7
- package/inspector/serialized-graph.js +35 -40
- package/inspector/uuid-factory.js +8 -12
- package/interceptors/index.d.ts +2 -2
- package/interceptors/index.js +2 -5
- package/interceptors/interceptors-consumer.d.ts +4 -3
- package/interceptors/interceptors-consumer.js +14 -18
- package/interceptors/interceptors-context-creator.d.ts +10 -9
- package/interceptors/interceptors-context-creator.js +18 -20
- package/interfaces/index.d.ts +2 -0
- package/interfaces/index.js +2 -0
- package/interfaces/module-definition.interface.d.ts +2 -2
- package/interfaces/module-definition.interface.js +1 -2
- package/interfaces/module-override.interface.d.ts +1 -1
- package/interfaces/module-override.interface.js +1 -2
- package/internal.d.ts +42 -0
- package/internal.js +50 -0
- package/metadata-scanner.d.ts +1 -1
- package/metadata-scanner.js +8 -14
- package/middleware/builder.d.ts +4 -4
- package/middleware/builder.js +82 -80
- package/middleware/container.d.ts +4 -4
- package/middleware/container.js +10 -13
- package/middleware/index.d.ts +1 -1
- package/middleware/index.js +1 -4
- package/middleware/middleware-module.d.ts +8 -9
- package/middleware/middleware-module.js +49 -46
- package/middleware/resolver.d.ts +3 -3
- package/middleware/resolver.js +3 -5
- package/middleware/route-info-path-extractor.d.ts +2 -2
- package/middleware/route-info-path-extractor.js +26 -25
- package/middleware/routes-mapper.d.ts +4 -3
- package/middleware/routes-mapper.js +22 -24
- package/middleware/utils.d.ts +3 -2
- package/middleware/utils.js +34 -45
- package/nest-application-context.d.ts +10 -9
- package/nest-application-context.js +50 -40
- package/nest-application.d.ts +19 -11
- package/nest-application.js +168 -65
- package/nest-factory.d.ts +4 -5
- package/nest-factory.js +61 -68
- package/package.json +17 -9
- package/pipes/index.d.ts +3 -3
- package/pipes/index.js +3 -6
- package/pipes/params-token-factory.d.ts +2 -2
- package/pipes/params-token-factory.js +5 -9
- package/pipes/pipes-consumer.d.ts +3 -7
- package/pipes/pipes-consumer.js +17 -18
- package/pipes/pipes-context-creator.d.ts +10 -9
- package/pipes/pipes-context-creator.js +18 -20
- package/repl/assign-to-object.util.js +1 -4
- package/repl/constants.js +1 -4
- package/repl/index.d.ts +1 -1
- package/repl/index.js +1 -4
- package/repl/native-functions/debug-repl-fn.d.ts +2 -2
- package/repl/native-functions/debug-repl-fn.js +14 -21
- package/repl/native-functions/get-repl-fn.d.ts +2 -2
- package/repl/native-functions/get-repl-fn.js +8 -15
- package/repl/native-functions/help-repl-fn.d.ts +2 -2
- package/repl/native-functions/help-repl-fn.js +13 -20
- package/repl/native-functions/index.d.ts +6 -6
- package/repl/native-functions/index.js +6 -9
- package/repl/native-functions/methods-repl-fn.d.ts +2 -2
- package/repl/native-functions/methods-repl-fn.js +12 -19
- package/repl/native-functions/resolve-repl-fn.d.ts +2 -2
- package/repl/native-functions/resolve-repl-fn.js +7 -14
- package/repl/native-functions/select-relp-fn.d.ts +2 -2
- package/repl/native-functions/select-relp-fn.js +7 -14
- package/repl/repl-context.d.ts +3 -3
- package/repl/repl-context.js +21 -23
- package/repl/repl-function.d.ts +3 -3
- package/repl/repl-function.js +5 -7
- package/repl/repl-logger.js +10 -14
- package/repl/repl-native-commands.js +1 -4
- package/repl/repl.d.ts +1 -1
- package/repl/repl.interfaces.d.ts +2 -2
- package/repl/repl.interfaces.js +1 -2
- package/repl/repl.js +17 -20
- package/router/index.d.ts +3 -3
- package/router/index.js +3 -8
- package/router/interfaces/exceptions-filter.interface.d.ts +3 -3
- package/router/interfaces/exceptions-filter.interface.js +1 -2
- package/router/interfaces/exclude-route-metadata.interface.d.ts +1 -1
- package/router/interfaces/exclude-route-metadata.interface.js +1 -2
- package/router/interfaces/index.d.ts +4 -1
- package/router/interfaces/index.js +4 -4
- package/router/interfaces/resolved-route.interface.d.ts +32 -0
- package/router/interfaces/resolved-route.interface.js +1 -0
- package/router/interfaces/resolver.interface.d.ts +5 -1
- package/router/interfaces/resolver.interface.js +1 -2
- package/router/interfaces/route-conflict.interface.d.ts +14 -0
- package/router/interfaces/route-conflict.interface.js +1 -0
- package/router/interfaces/route-params-factory.interface.d.ts +1 -1
- package/router/interfaces/route-params-factory.interface.js +1 -2
- package/router/interfaces/route-path-metadata.interface.d.ts +2 -2
- package/router/interfaces/route-path-metadata.interface.js +1 -2
- package/router/interfaces/route-resolution-options.interface.d.ts +24 -0
- package/router/interfaces/route-resolution-options.interface.js +1 -0
- package/router/interfaces/routes.interface.d.ts +1 -1
- package/router/interfaces/routes.interface.js +1 -2
- package/router/legacy-route-converter.js +3 -7
- package/router/paths-explorer.d.ts +4 -5
- package/router/paths-explorer.js +11 -15
- package/router/request/index.d.ts +1 -1
- package/router/request/index.js +1 -5
- package/router/request/request-constants.js +2 -5
- package/router/request/request-providers.d.ts +1 -1
- package/router/request/request-providers.js +5 -8
- package/router/route-conflict-detector.d.ts +71 -0
- package/router/route-conflict-detector.js +276 -0
- package/router/route-params-factory.d.ts +2 -2
- package/router/route-params-factory.js +15 -19
- package/router/route-path-factory.d.ts +4 -4
- package/router/route-path-factory.js +19 -22
- package/router/route-specificity-sorter.d.ts +23 -0
- package/router/route-specificity-sorter.js +59 -0
- package/router/router-exception-filters.d.ts +9 -9
- package/router/router-exception-filters.js +15 -18
- package/router/router-execution-context.d.ts +17 -20
- package/router/router-execution-context.js +62 -55
- package/router/router-explorer.d.ts +25 -18
- package/router/router-explorer.js +116 -73
- package/router/router-module.d.ts +4 -4
- package/router/router-module.js +21 -23
- package/router/router-proxy.d.ts +1 -1
- package/router/router-proxy.js +4 -8
- package/router/router-response-controller.d.ts +2 -2
- package/router/router-response-controller.js +23 -27
- package/router/routes-resolver.d.ts +13 -11
- package/router/routes-resolver.js +42 -55
- package/router/sse-stream.d.ts +1 -1
- package/router/sse-stream.js +19 -22
- package/router/utils/exclude-route.util.d.ts +1 -1
- package/router/utils/exclude-route.util.js +7 -12
- package/router/utils/flatten-route-paths.util.d.ts +2 -2
- package/router/utils/flatten-route-paths.util.js +4 -7
- package/router/utils/index.d.ts +2 -2
- package/router/utils/index.js +2 -5
- package/scanner.d.ts +11 -11
- package/scanner.js +66 -67
- package/services/index.d.ts +1 -1
- package/services/index.js +1 -4
- package/services/reflector.service.d.ts +1 -1
- package/services/reflector.service.js +9 -13
- package/tsconfig.build.json +1 -9
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const messages_1 = require("../messages");
|
|
5
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
-
class InvalidMiddlewareException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { INVALID_MIDDLEWARE_MESSAGE } from '../messages.js';
|
|
2
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
3
|
+
export class InvalidMiddlewareException extends RuntimeException {
|
|
7
4
|
constructor(name) {
|
|
8
|
-
super(
|
|
5
|
+
super(INVALID_MIDDLEWARE_MESSAGE `${name}`);
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.InvalidMiddlewareException = InvalidMiddlewareException;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RuntimeException } from './runtime.exception';
|
|
1
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
2
2
|
export declare class InvalidModuleException extends RuntimeException {
|
|
3
3
|
constructor(parentModule: any, index: number, scope: any[], receivedValue: unknown);
|
|
4
4
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const messages_1 = require("../messages");
|
|
5
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
-
class InvalidModuleException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { INVALID_MODULE_MESSAGE } from '../messages.js';
|
|
2
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
3
|
+
export class InvalidModuleException extends RuntimeException {
|
|
7
4
|
constructor(parentModule, index, scope, receivedValue) {
|
|
8
|
-
super(
|
|
5
|
+
super(INVALID_MODULE_MESSAGE(parentModule, index, scope, receivedValue));
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.InvalidModuleException = InvalidModuleException;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RuntimeException = void 0;
|
|
4
|
-
class RuntimeException extends Error {
|
|
1
|
+
export class RuntimeException extends Error {
|
|
5
2
|
constructor(message = ``) {
|
|
6
3
|
super(message);
|
|
7
4
|
}
|
|
@@ -9,4 +6,3 @@ class RuntimeException extends Error {
|
|
|
9
6
|
return this.message;
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
exports.RuntimeException = RuntimeException;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InjectorDependencyContext } from '../../injector/injector';
|
|
2
|
-
import { Module } from '../../injector/module';
|
|
3
|
-
import { RuntimeException } from './runtime.exception';
|
|
1
|
+
import { InjectorDependencyContext } from '../../injector/injector.js';
|
|
2
|
+
import { Module } from '../../injector/module.js';
|
|
3
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
4
4
|
export declare class UndefinedDependencyException extends RuntimeException {
|
|
5
5
|
constructor(type: string, undefinedDependencyContext: InjectorDependencyContext, moduleRef?: Module);
|
|
6
6
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const messages_1 = require("../messages");
|
|
5
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
-
class UndefinedDependencyException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { UNKNOWN_DEPENDENCIES_MESSAGE } from '../messages.js';
|
|
2
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
3
|
+
export class UndefinedDependencyException extends RuntimeException {
|
|
7
4
|
constructor(type, undefinedDependencyContext, moduleRef) {
|
|
8
|
-
super(
|
|
5
|
+
super(UNKNOWN_DEPENDENCIES_MESSAGE(type, undefinedDependencyContext, moduleRef));
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.UndefinedDependencyException = UndefinedDependencyException;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RuntimeException } from './runtime.exception';
|
|
2
|
-
import { Type } from '@nestjs/common';
|
|
1
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
2
|
+
import type { Type } from '@nestjs/common';
|
|
3
3
|
export declare class UndefinedForwardRefException extends RuntimeException {
|
|
4
4
|
constructor(scope: Type<any>[]);
|
|
5
5
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const messages_1 = require("../messages");
|
|
5
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
-
class UndefinedForwardRefException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { UNDEFINED_FORWARDREF_MESSAGE } from '../messages.js';
|
|
2
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
3
|
+
export class UndefinedForwardRefException extends RuntimeException {
|
|
7
4
|
constructor(scope) {
|
|
8
|
-
super(
|
|
5
|
+
super(UNDEFINED_FORWARDREF_MESSAGE(scope));
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.UndefinedForwardRefException = UndefinedForwardRefException;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
-
const messages_1 = require("../messages");
|
|
6
|
-
class UndefinedModuleException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
2
|
+
import { UNDEFINED_MODULE_MESSAGE } from '../messages.js';
|
|
3
|
+
export class UndefinedModuleException extends RuntimeException {
|
|
7
4
|
constructor(parentModule, index, scope) {
|
|
8
|
-
super(
|
|
5
|
+
super(UNDEFINED_MODULE_MESSAGE(parentModule, index, scope));
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.UndefinedModuleException = UndefinedModuleException;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InjectorDependencyContext } from '../../injector/injector';
|
|
2
|
-
import { Module } from '../../injector/module';
|
|
3
|
-
import { RuntimeException } from './runtime.exception';
|
|
1
|
+
import { InjectorDependencyContext } from '../../injector/injector.js';
|
|
2
|
+
import { Module } from '../../injector/module.js';
|
|
3
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
4
4
|
export declare class UnknownDependenciesException extends RuntimeException {
|
|
5
5
|
readonly type: string | symbol;
|
|
6
6
|
readonly context: InjectorDependencyContext;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { UNKNOWN_DEPENDENCIES_MESSAGE } from '../messages.js';
|
|
2
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
3
|
+
export class UnknownDependenciesException extends RuntimeException {
|
|
4
|
+
type;
|
|
5
|
+
context;
|
|
6
|
+
metadata;
|
|
7
|
+
moduleRef;
|
|
7
8
|
constructor(type, context, moduleRef, metadata) {
|
|
8
|
-
super(
|
|
9
|
+
super(UNKNOWN_DEPENDENCIES_MESSAGE(type, context, moduleRef));
|
|
9
10
|
this.type = type;
|
|
10
11
|
this.context = context;
|
|
11
12
|
this.metadata = metadata;
|
|
12
13
|
this.moduleRef = moduleRef && { id: moduleRef.id };
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
exports.UnknownDependenciesException = UnknownDependenciesException;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.UnknownElementException = void 0;
|
|
4
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
-
class UnknownElementException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
2
|
+
export class UnknownElementException extends RuntimeException {
|
|
6
3
|
constructor(name) {
|
|
7
4
|
name = name && name.toString();
|
|
8
5
|
super(`Nest could not find ${name || 'given'} element (this provider does not exist in the current context)`);
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.UnknownElementException = UnknownElementException;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const messages_1 = require("../messages");
|
|
5
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
-
class UnknownExportException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { UNKNOWN_EXPORT_MESSAGE } from '../messages.js';
|
|
2
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
3
|
+
export class UnknownExportException extends RuntimeException {
|
|
7
4
|
constructor(token, moduleName) {
|
|
8
|
-
super(
|
|
5
|
+
super(UNKNOWN_EXPORT_MESSAGE(token, moduleName));
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.UnknownExportException = UnknownExportException;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.UnknownModuleException = void 0;
|
|
4
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
-
class UnknownModuleException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
2
|
+
export class UnknownModuleException extends RuntimeException {
|
|
6
3
|
constructor(moduleName) {
|
|
7
4
|
super(`Nest could not select the given module (${moduleName ? `"${moduleName}"` : 'it'} does not exist in current context).`);
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.UnknownModuleException = UnknownModuleException;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Type } from '@nestjs/common';
|
|
2
|
-
import { RuntimeException } from './runtime.exception';
|
|
2
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
3
3
|
export declare class UnknownRequestMappingException extends RuntimeException {
|
|
4
4
|
constructor(metatype: Type);
|
|
5
5
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
-
const messages_1 = require("../messages");
|
|
6
|
-
class UnknownRequestMappingException extends runtime_exception_1.RuntimeException {
|
|
1
|
+
import { RuntimeException } from './runtime.exception.js';
|
|
2
|
+
import { UNKNOWN_REQUEST_MAPPING } from '../messages.js';
|
|
3
|
+
export class UnknownRequestMappingException extends RuntimeException {
|
|
7
4
|
constructor(metatype) {
|
|
8
|
-
super(
|
|
5
|
+
super(UNKNOWN_REQUEST_MAPPING(metatype));
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.UnknownRequestMappingException = UnknownRequestMappingException;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ExceptionsZone = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const exception_handler_1 = require("./exception-handler");
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import { ExceptionHandler } from './exception-handler.js';
|
|
6
3
|
const DEFAULT_TEARDOWN = () => process.exit(1);
|
|
7
|
-
class ExceptionsZone {
|
|
4
|
+
export class ExceptionsZone {
|
|
5
|
+
static exceptionHandler = new ExceptionHandler();
|
|
8
6
|
static run(callback, teardown = DEFAULT_TEARDOWN, autoFlushLogs) {
|
|
9
7
|
try {
|
|
10
8
|
callback();
|
|
@@ -12,7 +10,7 @@ class ExceptionsZone {
|
|
|
12
10
|
catch (e) {
|
|
13
11
|
this.exceptionHandler.handle(e);
|
|
14
12
|
if (autoFlushLogs) {
|
|
15
|
-
|
|
13
|
+
Logger.flush();
|
|
16
14
|
}
|
|
17
15
|
teardown(e);
|
|
18
16
|
}
|
|
@@ -24,11 +22,9 @@ class ExceptionsZone {
|
|
|
24
22
|
catch (e) {
|
|
25
23
|
this.exceptionHandler.handle(e);
|
|
26
24
|
if (autoFlushLogs) {
|
|
27
|
-
|
|
25
|
+
Logger.flush();
|
|
28
26
|
}
|
|
29
27
|
teardown(e);
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
exports.ExceptionsZone = ExceptionsZone;
|
|
34
|
-
ExceptionsZone.exceptionHandler = new exception_handler_1.ExceptionHandler();
|
package/errors/messages.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ForwardReference, Type } from '@nestjs/common';
|
|
2
|
-
import { InjectorDependencyContext } from '../injector/injector';
|
|
3
|
-
import { Module } from '../injector/module';
|
|
2
|
+
import { InjectorDependencyContext } from '../injector/injector.js';
|
|
3
|
+
import { Module } from '../injector/module.js';
|
|
4
4
|
export declare const UNKNOWN_DEPENDENCIES_MESSAGE: (type: string | symbol, unknownDependencyContext: InjectorDependencyContext, moduleRef: Module | undefined) => string;
|
|
5
5
|
export declare const INVALID_MIDDLEWARE_MESSAGE: (text: TemplateStringsArray, name: string) => string;
|
|
6
6
|
export declare const UNDEFINED_FORWARDREF_MESSAGE: (scope: Type<any>[]) => string;
|
|
@@ -11,6 +11,9 @@ export declare const UNKNOWN_EXPORT_MESSAGE: (token: string | symbol | undefined
|
|
|
11
11
|
export declare const INVALID_CLASS_MESSAGE: (text: TemplateStringsArray, value: any) => string;
|
|
12
12
|
export declare const INVALID_CLASS_SCOPE_MESSAGE: (text: TemplateStringsArray, name: string | undefined) => string;
|
|
13
13
|
export declare const UNKNOWN_REQUEST_MAPPING: (metatype: Type) => string;
|
|
14
|
+
export declare const ROUTE_CONFLICT_MESSAGE: (messages: string[]) => string;
|
|
15
|
+
export declare const DUPLICATE_ROUTE_MESSAGE: (method: string, path: string, firstHandlerLabel: string, secondHandlerLabel: string) => string;
|
|
16
|
+
export declare const SHADOWED_ROUTE_MESSAGE: (method: string, shadowedPath: string, shadowedHandlerLabel: string, winnerPath: string, winnerHandlerLabel: string) => string;
|
|
14
17
|
export declare const INVALID_MIDDLEWARE_CONFIGURATION = "An invalid middleware configuration has been passed inside the module 'configure()' method.";
|
|
15
18
|
export declare const UNHANDLED_RUNTIME_EXCEPTION = "Unhandled Runtime Exception.";
|
|
16
19
|
export declare const INVALID_EXCEPTION_FILTER = "Invalid exception filters (@UseFilters()).";
|
package/errors/messages.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MICROSERVICES_PACKAGE_NOT_FOUND_EXCEPTION = exports.INVALID_EXCEPTION_FILTER = exports.UNHANDLED_RUNTIME_EXCEPTION = exports.INVALID_MIDDLEWARE_CONFIGURATION = exports.UNKNOWN_REQUEST_MAPPING = exports.INVALID_CLASS_SCOPE_MESSAGE = exports.INVALID_CLASS_MESSAGE = exports.UNKNOWN_EXPORT_MESSAGE = exports.UNDEFINED_MODULE_MESSAGE = exports.USING_INVALID_CLASS_AS_A_MODULE_MESSAGE = exports.INVALID_MODULE_MESSAGE = exports.UNDEFINED_FORWARDREF_MESSAGE = exports.INVALID_MIDDLEWARE_MESSAGE = exports.UNKNOWN_DEPENDENCIES_MESSAGE = void 0;
|
|
4
|
-
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
1
|
+
import { isNil, isSymbol } from '@nestjs/common/internal';
|
|
5
2
|
/**
|
|
6
3
|
* Returns the name of an instance or `undefined`
|
|
7
4
|
* @param instance The instance which should get the name from
|
|
@@ -28,7 +25,7 @@ const getDependencyName = (dependency, fallbackValue, disambiguated = true) =>
|
|
|
28
25
|
// use class name
|
|
29
26
|
getInstanceName(dependency) ||
|
|
30
27
|
// use injection token (symbol)
|
|
31
|
-
(
|
|
28
|
+
(isSymbol(dependency) && dependency.toString()) ||
|
|
32
29
|
// use string directly
|
|
33
30
|
(dependency
|
|
34
31
|
? disambiguated
|
|
@@ -44,11 +41,11 @@ getInstanceName(dependency) ||
|
|
|
44
41
|
*/
|
|
45
42
|
const getModuleName = (module) => (module && getInstanceName(module.metatype)) || 'current';
|
|
46
43
|
const stringifyScope = (scope) => (scope || []).map(getInstanceName).join(' -> ');
|
|
47
|
-
const UNKNOWN_DEPENDENCIES_MESSAGE = (type, unknownDependencyContext, moduleRef) => {
|
|
44
|
+
export const UNKNOWN_DEPENDENCIES_MESSAGE = (type, unknownDependencyContext, moduleRef) => {
|
|
48
45
|
const { index, name, dependencies, key } = unknownDependencyContext;
|
|
49
46
|
const moduleName = getModuleName(moduleRef);
|
|
50
47
|
const dependencyName = getDependencyName(name, 'dependency');
|
|
51
|
-
const isImportTypeIssue = !
|
|
48
|
+
const isImportTypeIssue = !isNil(index) &&
|
|
52
49
|
dependencies &&
|
|
53
50
|
(dependencies[index] === undefined ||
|
|
54
51
|
dependencies[index] === Object ||
|
|
@@ -93,7 +90,7 @@ Potential solutions:
|
|
|
93
90
|
For more common dependency resolution issues, see: https://docs.nestjs.com/faq/common-errors`;
|
|
94
91
|
}
|
|
95
92
|
let message = `Nest can't resolve dependencies of the ${type.toString()}`;
|
|
96
|
-
if (
|
|
93
|
+
if (isNil(index)) {
|
|
97
94
|
message += `. Please make sure that the "${key.toString()}" property is available in the current context.${potentialSolutions}`;
|
|
98
95
|
return message;
|
|
99
96
|
}
|
|
@@ -108,16 +105,13 @@ For more common dependency resolution issues, see: https://docs.nestjs.com/faq/c
|
|
|
108
105
|
message += potentialSolutions;
|
|
109
106
|
return message;
|
|
110
107
|
};
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
exports.INVALID_MIDDLEWARE_MESSAGE = INVALID_MIDDLEWARE_MESSAGE;
|
|
114
|
-
const UNDEFINED_FORWARDREF_MESSAGE = (scope) => `Nest cannot create the module instance. Often, this is because of a circular dependency between modules. Use forwardRef() to avoid it.
|
|
108
|
+
export const INVALID_MIDDLEWARE_MESSAGE = (text, name) => `The middleware doesn't provide the 'use' method (${name})`;
|
|
109
|
+
export const UNDEFINED_FORWARDREF_MESSAGE = (scope) => `Nest cannot create the module instance. Often, this is because of a circular dependency between modules. Use forwardRef() to avoid it.
|
|
115
110
|
|
|
116
111
|
(Read more: https://docs.nestjs.com/fundamentals/circular-dependency)
|
|
117
112
|
Scope [${stringifyScope(scope)}]
|
|
118
113
|
`;
|
|
119
|
-
|
|
120
|
-
const INVALID_MODULE_MESSAGE = (parentModule, index, scope, receivedValue) => {
|
|
114
|
+
export const INVALID_MODULE_MESSAGE = (parentModule, index, scope, receivedValue) => {
|
|
121
115
|
const parentModuleName = parentModule?.name || 'module';
|
|
122
116
|
let formattedValue;
|
|
123
117
|
let receivedType;
|
|
@@ -139,8 +133,7 @@ The received value \`${formattedValue}\` is of type "${receivedType}".
|
|
|
139
133
|
|
|
140
134
|
Scope [${stringifyScope(scope)}]`;
|
|
141
135
|
};
|
|
142
|
-
|
|
143
|
-
const USING_INVALID_CLASS_AS_A_MODULE_MESSAGE = (metatypeUsedAsAModule, scope, classKind) => {
|
|
136
|
+
export const USING_INVALID_CLASS_AS_A_MODULE_MESSAGE = (metatypeUsedAsAModule, scope, classKind) => {
|
|
144
137
|
const metatypeNameQuote = `"${getInstanceName(metatypeUsedAsAModule)}"`;
|
|
145
138
|
let hint;
|
|
146
139
|
switch (classKind) {
|
|
@@ -159,8 +152,7 @@ const USING_INVALID_CLASS_AS_A_MODULE_MESSAGE = (metatypeUsedAsAModule, scope, c
|
|
|
159
152
|
Scope [${stringifyScope(scope)}]
|
|
160
153
|
`;
|
|
161
154
|
};
|
|
162
|
-
|
|
163
|
-
const UNDEFINED_MODULE_MESSAGE = (parentModule, index, scope) => {
|
|
155
|
+
export const UNDEFINED_MODULE_MESSAGE = (parentModule, index, scope) => {
|
|
164
156
|
const parentModuleName = parentModule?.name || 'module';
|
|
165
157
|
return `Nest cannot create the ${parentModuleName} instance.
|
|
166
158
|
The module at index [${index}] of the ${parentModuleName} "imports" array is undefined.
|
|
@@ -171,9 +163,8 @@ Potential causes:
|
|
|
171
163
|
|
|
172
164
|
Scope [${stringifyScope(scope)}]`;
|
|
173
165
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
token = (0, shared_utils_1.isSymbol)(token) ? token.toString() : token;
|
|
166
|
+
export const UNKNOWN_EXPORT_MESSAGE = (token = 'item', module) => {
|
|
167
|
+
token = isSymbol(token) ? token.toString() : token;
|
|
177
168
|
return `Nest cannot export a provider/module that is not a part of the currently processed module (${module}). Please verify whether the exported ${token} is available in this particular context.
|
|
178
169
|
|
|
179
170
|
Possible Solutions:
|
|
@@ -182,19 +173,22 @@ Possible Solutions:
|
|
|
182
173
|
For more common dependency resolution issues, see: https://docs.nestjs.com/faq/common-errors
|
|
183
174
|
`;
|
|
184
175
|
};
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
const INVALID_CLASS_SCOPE_MESSAGE = (text, name) => `${name || 'This class'} is marked as a scoped provider. Request and transient-scoped providers can't be used in combination with "get()" method. Please, use "resolve()" instead.`;
|
|
189
|
-
exports.INVALID_CLASS_SCOPE_MESSAGE = INVALID_CLASS_SCOPE_MESSAGE;
|
|
190
|
-
const UNKNOWN_REQUEST_MAPPING = (metatype) => {
|
|
176
|
+
export const INVALID_CLASS_MESSAGE = (text, value) => `ModuleRef cannot instantiate class (${value} is not constructable).`;
|
|
177
|
+
export const INVALID_CLASS_SCOPE_MESSAGE = (text, name) => `${name || 'This class'} is marked as a scoped provider. Request and transient-scoped providers can't be used in combination with "get()" method. Please, use "resolve()" instead.`;
|
|
178
|
+
export const UNKNOWN_REQUEST_MAPPING = (metatype) => {
|
|
191
179
|
const className = metatype.name;
|
|
192
180
|
return className
|
|
193
181
|
? `An invalid controller has been detected. "${className}" does not have the @Controller() decorator but it is being listed in the "controllers" array of some module.`
|
|
194
182
|
: `An invalid controller has been detected. Perhaps, one of your controllers is missing the @Controller() decorator.`;
|
|
195
183
|
};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
184
|
+
export const ROUTE_CONFLICT_MESSAGE = (messages) => [
|
|
185
|
+
'Conflicting HTTP routes detected:',
|
|
186
|
+
...messages.map(message => ` - ${message}`),
|
|
187
|
+
`Adjust route declarations or relax the 'routeConflictPolicy' option passed to NestFactory.create() to allow the application to start.`,
|
|
188
|
+
].join('\n');
|
|
189
|
+
export const DUPLICATE_ROUTE_MESSAGE = (method, path, firstHandlerLabel, secondHandlerLabel) => `Duplicate route: ${method} ${path} is registered by both ${firstHandlerLabel} and ${secondHandlerLabel}.`;
|
|
190
|
+
export const SHADOWED_ROUTE_MESSAGE = (method, shadowedPath, shadowedHandlerLabel, winnerPath, winnerHandlerLabel) => `Route ${method} ${shadowedPath} (${shadowedHandlerLabel}) is shadowed by ${method} ${winnerPath} (${winnerHandlerLabel}). The first-registered route will match all matching requests on order-sensitive adapters.`;
|
|
191
|
+
export const INVALID_MIDDLEWARE_CONFIGURATION = `An invalid middleware configuration has been passed inside the module 'configure()' method.`;
|
|
192
|
+
export const UNHANDLED_RUNTIME_EXCEPTION = `Unhandled Runtime Exception.`;
|
|
193
|
+
export const INVALID_EXCEPTION_FILTER = `Invalid exception filters (@UseFilters()).`;
|
|
194
|
+
export const MICROSERVICES_PACKAGE_NOT_FOUND_EXCEPTION = `Unable to load @nestjs/microservices package. (Please make sure that it's already installed.)`;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { InstanceWrapper } from '../injector/instance-wrapper';
|
|
1
|
+
import { ContextCreator } from '../helpers/context-creator.js';
|
|
2
|
+
import { NestContainer } from '../injector/container.js';
|
|
3
|
+
import { InstanceWrapper } from '../injector/instance-wrapper.js';
|
|
4
|
+
import type { Type, ExceptionFilter } from '@nestjs/common';
|
|
6
5
|
export declare class BaseExceptionFilterContext extends ContextCreator {
|
|
7
6
|
private readonly container;
|
|
8
7
|
protected moduleContext: string;
|
|
9
8
|
constructor(container: NestContainer);
|
|
10
|
-
createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): R;
|
|
11
|
-
getFilterInstance(filter: Function | ExceptionFilter, contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): ExceptionFilter | null;
|
|
9
|
+
createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): R;
|
|
10
|
+
getFilterInstance(filter: Function | ExceptionFilter, contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): ExceptionFilter | null;
|
|
12
11
|
getInstanceByMetatype(metatype: Type<unknown>): InstanceWrapper | undefined;
|
|
13
12
|
reflectCatchExceptions(instance: ExceptionFilter): Type<any>[];
|
|
14
13
|
}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const constants_2 = require("../injector/constants");
|
|
9
|
-
class BaseExceptionFilterContext extends context_creator_1.ContextCreator {
|
|
1
|
+
import { iterate } from 'iterare';
|
|
2
|
+
import { ContextCreator } from '../helpers/context-creator.js';
|
|
3
|
+
import { STATIC_CONTEXT } from '../injector/constants.js';
|
|
4
|
+
import { FILTER_CATCH_EXCEPTIONS, isEmpty, isFunction, } from '@nestjs/common/internal';
|
|
5
|
+
export class BaseExceptionFilterContext extends ContextCreator {
|
|
6
|
+
container;
|
|
7
|
+
moduleContext;
|
|
10
8
|
constructor(container) {
|
|
11
9
|
super();
|
|
12
10
|
this.container = container;
|
|
13
11
|
}
|
|
14
|
-
createConcreteContext(metadata, contextId =
|
|
15
|
-
if (
|
|
12
|
+
createConcreteContext(metadata, contextId = STATIC_CONTEXT, inquirerId) {
|
|
13
|
+
if (isEmpty(metadata)) {
|
|
16
14
|
return [];
|
|
17
15
|
}
|
|
18
|
-
return
|
|
19
|
-
.filter(instance => instance && (
|
|
16
|
+
return iterate(metadata)
|
|
17
|
+
.filter(instance => instance && (isFunction(instance.catch) || instance.name))
|
|
20
18
|
.map(filter => this.getFilterInstance(filter, contextId, inquirerId))
|
|
21
19
|
.filter(item => !!item)
|
|
22
20
|
.map(instance => ({
|
|
@@ -25,7 +23,7 @@ class BaseExceptionFilterContext extends context_creator_1.ContextCreator {
|
|
|
25
23
|
}))
|
|
26
24
|
.toArray();
|
|
27
25
|
}
|
|
28
|
-
getFilterInstance(filter, contextId =
|
|
26
|
+
getFilterInstance(filter, contextId = STATIC_CONTEXT, inquirerId) {
|
|
29
27
|
const isObject = !!filter.catch;
|
|
30
28
|
if (isObject) {
|
|
31
29
|
return filter;
|
|
@@ -50,7 +48,6 @@ class BaseExceptionFilterContext extends context_creator_1.ContextCreator {
|
|
|
50
48
|
}
|
|
51
49
|
reflectCatchExceptions(instance) {
|
|
52
50
|
const prototype = Object.getPrototypeOf(instance);
|
|
53
|
-
return (Reflect.getMetadata(
|
|
51
|
+
return (Reflect.getMetadata(FILTER_CATCH_EXCEPTIONS, prototype.constructor) || []);
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
exports.BaseExceptionFilterContext = BaseExceptionFilterContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ArgumentsHost, ExceptionFilter, HttpServer } from '@nestjs/common';
|
|
2
|
-
import { AbstractHttpAdapter } from '../adapters';
|
|
3
|
-
import { HttpAdapterHost } from '../helpers/http-adapter-host';
|
|
1
|
+
import { type ArgumentsHost, type ExceptionFilter, type HttpServer } from '@nestjs/common';
|
|
2
|
+
import { AbstractHttpAdapter } from '../adapters/index.js';
|
|
3
|
+
import { HttpAdapterHost } from '../helpers/http-adapter-host.js';
|
|
4
4
|
export declare class BaseExceptionFilter<T = any> implements ExceptionFilter<T> {
|
|
5
5
|
protected readonly applicationRef?: HttpServer | undefined;
|
|
6
6
|
private static readonly logger;
|
|
@@ -10,7 +10,7 @@ export declare class BaseExceptionFilter<T = any> implements ExceptionFilter<T>
|
|
|
10
10
|
handleUnknownError(exception: T, host: ArgumentsHost, applicationRef: AbstractHttpAdapter | HttpServer): void;
|
|
11
11
|
isExceptionObject(err: any): err is Error;
|
|
12
12
|
/**
|
|
13
|
-
* Checks if the thrown error comes from the "http-errors" library.
|
|
13
|
+
* Checks if the thrown error is a FastifyError or comes from the "http-errors" library.
|
|
14
14
|
* @param err error object
|
|
15
15
|
*/
|
|
16
16
|
isHttpError(err: any): err is {
|