@depup/nestjs__core 11.1.17-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/LICENSE +22 -0
- package/PACKAGE.md +1 -0
- package/README.md +25 -0
- package/Readme.md +146 -0
- package/adapters/http-adapter.d.ts +80 -0
- package/adapters/http-adapter.js +90 -0
- package/adapters/index.d.ts +1 -0
- package/adapters/index.js +4 -0
- package/application-config.d.ts +47 -0
- package/application-config.js +107 -0
- package/changes.json +5 -0
- package/constants.d.ts +14 -0
- package/constants.js +21 -0
- package/discovery/discoverable-meta-host-collection.d.ts +46 -0
- package/discovery/discoverable-meta-host-collection.js +98 -0
- package/discovery/discovery-module.d.ts +5 -0
- package/discovery/discovery-module.js +19 -0
- package/discovery/discovery-service.d.ts +76 -0
- package/discovery/discovery-service.js +98 -0
- package/discovery/index.d.ts +2 -0
- package/discovery/index.js +5 -0
- package/errors/exception-handler.d.ts +4 -0
- package/errors/exception-handler.js +11 -0
- package/errors/exceptions/circular-dependency.exception.d.ts +4 -0
- package/errors/exceptions/circular-dependency.exception.js +11 -0
- package/errors/exceptions/index.d.ts +8 -0
- package/errors/exceptions/index.js +11 -0
- package/errors/exceptions/invalid-class-module.exception.d.ts +4 -0
- package/errors/exceptions/invalid-class-module.exception.js +11 -0
- package/errors/exceptions/invalid-class-scope.exception.d.ts +5 -0
- package/errors/exceptions/invalid-class-scope.exception.js +16 -0
- package/errors/exceptions/invalid-class.exception.d.ts +4 -0
- package/errors/exceptions/invalid-class.exception.js +11 -0
- package/errors/exceptions/invalid-exception-filter.exception.d.ts +4 -0
- package/errors/exceptions/invalid-exception-filter.exception.js +11 -0
- package/errors/exceptions/invalid-middleware-configuration.exception.d.ts +4 -0
- package/errors/exceptions/invalid-middleware-configuration.exception.js +11 -0
- package/errors/exceptions/invalid-middleware.exception.d.ts +4 -0
- package/errors/exceptions/invalid-middleware.exception.js +11 -0
- package/errors/exceptions/invalid-module.exception.d.ts +4 -0
- package/errors/exceptions/invalid-module.exception.js +11 -0
- package/errors/exceptions/runtime.exception.d.ts +4 -0
- package/errors/exceptions/runtime.exception.js +12 -0
- package/errors/exceptions/undefined-dependency.exception.d.ts +6 -0
- package/errors/exceptions/undefined-dependency.exception.js +11 -0
- package/errors/exceptions/undefined-forwardref.exception.d.ts +5 -0
- package/errors/exceptions/undefined-forwardref.exception.js +11 -0
- package/errors/exceptions/undefined-module.exception.d.ts +4 -0
- package/errors/exceptions/undefined-module.exception.js +11 -0
- package/errors/exceptions/unknown-dependencies.exception.d.ts +16 -0
- package/errors/exceptions/unknown-dependencies.exception.js +15 -0
- package/errors/exceptions/unknown-element.exception.d.ts +4 -0
- package/errors/exceptions/unknown-element.exception.js +11 -0
- package/errors/exceptions/unknown-export.exception.d.ts +4 -0
- package/errors/exceptions/unknown-export.exception.js +11 -0
- package/errors/exceptions/unknown-module.exception.d.ts +4 -0
- package/errors/exceptions/unknown-module.exception.js +10 -0
- package/errors/exceptions/unknown-request-mapping.exception.d.ts +5 -0
- package/errors/exceptions/unknown-request-mapping.exception.js +11 -0
- package/errors/exceptions-zone.d.ts +5 -0
- package/errors/exceptions-zone.js +34 -0
- package/errors/messages.d.ts +17 -0
- package/errors/messages.js +174 -0
- package/exceptions/base-exception-filter-context.d.ts +14 -0
- package/exceptions/base-exception-filter-context.js +56 -0
- package/exceptions/base-exception-filter.d.ts +20 -0
- package/exceptions/base-exception-filter.js +72 -0
- package/exceptions/exceptions-handler.d.ts +10 -0
- package/exceptions/exceptions-handler.js +34 -0
- package/exceptions/external-exception-filter-context.d.ts +12 -0
- package/exceptions/external-exception-filter-context.js +42 -0
- package/exceptions/external-exception-filter.d.ts +5 -0
- package/exceptions/external-exception-filter.js +15 -0
- package/exceptions/external-exceptions-handler.d.ts +9 -0
- package/exceptions/external-exceptions-handler.js +34 -0
- package/exceptions/index.d.ts +1 -0
- package/exceptions/index.js +4 -0
- package/guards/constants.d.ts +1 -0
- package/guards/constants.js +4 -0
- package/guards/guards-consumer.d.ts +9 -0
- package/guards/guards-consumer.js +39 -0
- package/guards/guards-context-creator.d.ts +17 -0
- package/guards/guards-context-creator.js +70 -0
- package/guards/index.d.ts +3 -0
- package/guards/index.js +6 -0
- package/helpers/barrier.d.ts +30 -0
- package/helpers/barrier.js +46 -0
- package/helpers/context-creator.d.ts +10 -0
- package/helpers/context-creator.js +33 -0
- package/helpers/context-id-factory.d.ts +41 -0
- package/helpers/context-id-factory.js +67 -0
- package/helpers/context-utils.d.ts +23 -0
- package/helpers/context-utils.js +55 -0
- package/helpers/execution-context-host.d.ts +19 -0
- package/helpers/execution-context-host.js +50 -0
- package/helpers/external-context-creator.d.ts +51 -0
- package/helpers/external-context-creator.js +166 -0
- package/helpers/external-proxy.d.ts +5 -0
- package/helpers/external-proxy.js +19 -0
- package/helpers/get-class-scope.d.ts +3 -0
- package/helpers/get-class-scope.js +8 -0
- package/helpers/handler-metadata-storage.d.ts +27 -0
- package/helpers/handler-metadata-storage.js +26 -0
- package/helpers/http-adapter-host.d.ts +51 -0
- package/helpers/http-adapter-host.js +73 -0
- package/helpers/index.d.ts +3 -0
- package/helpers/index.js +6 -0
- package/helpers/interfaces/external-handler-metadata.interface.d.ts +11 -0
- package/helpers/interfaces/external-handler-metadata.interface.js +2 -0
- package/helpers/interfaces/index.d.ts +2 -0
- package/helpers/interfaces/index.js +5 -0
- package/helpers/interfaces/params-metadata.interface.d.ts +6 -0
- package/helpers/interfaces/params-metadata.interface.js +2 -0
- package/helpers/is-durable.d.ts +2 -0
- package/helpers/is-durable.js +8 -0
- package/helpers/load-adapter.d.ts +1 -0
- package/helpers/load-adapter.js +15 -0
- package/helpers/messages.d.ts +7 -0
- package/helpers/messages.js +29 -0
- package/helpers/optional-require.d.ts +1 -0
- package/helpers/optional-require.js +11 -0
- package/helpers/rethrow.d.ts +1 -0
- package/helpers/rethrow.js +7 -0
- package/helpers/router-method-factory.d.ts +23 -0
- package/helpers/router-method-factory.js +33 -0
- package/hooks/before-app-shutdown.hook.d.ts +9 -0
- package/hooks/before-app-shutdown.hook.js +51 -0
- package/hooks/index.d.ts +5 -0
- package/hooks/index.js +8 -0
- package/hooks/on-app-bootstrap.hook.d.ts +8 -0
- package/hooks/on-app-bootstrap.hook.js +53 -0
- package/hooks/on-app-shutdown.hook.d.ts +9 -0
- package/hooks/on-app-shutdown.hook.js +54 -0
- package/hooks/on-module-destroy.hook.d.ts +8 -0
- package/hooks/on-module-destroy.hook.js +53 -0
- package/hooks/on-module-init.hook.d.ts +8 -0
- package/hooks/on-module-init.hook.js +53 -0
- 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 +17 -0
- package/index.js +32 -0
- package/injector/abstract-instance-resolver.d.ts +16 -0
- package/injector/abstract-instance-resolver.js +49 -0
- package/injector/compiler.d.ts +18 -0
- package/injector/compiler.js +35 -0
- package/injector/constants.d.ts +3 -0
- package/injector/constants.js +8 -0
- package/injector/container.d.ts +67 -0
- package/injector/container.js +233 -0
- package/injector/helpers/provider-classifier.d.ts +4 -0
- package/injector/helpers/provider-classifier.js +16 -0
- package/injector/helpers/silent-logger.d.ts +10 -0
- package/injector/helpers/silent-logger.js +18 -0
- package/injector/helpers/transient-instances.d.ts +12 -0
- package/injector/helpers/transient-instances.js +28 -0
- package/injector/index.d.ts +6 -0
- package/injector/index.js +8 -0
- package/injector/injector.d.ts +104 -0
- package/injector/injector.js +554 -0
- package/injector/inquirer/index.d.ts +1 -0
- package/injector/inquirer/index.js +4 -0
- package/injector/inquirer/inquirer-constants.d.ts +1 -0
- package/injector/inquirer/inquirer-constants.js +4 -0
- package/injector/inquirer/inquirer-providers.d.ts +2 -0
- package/injector/inquirer/inquirer-providers.js +11 -0
- package/injector/instance-links-host.d.ts +22 -0
- package/injector/instance-links-host.js +56 -0
- package/injector/instance-loader.d.ts +23 -0
- package/injector/instance-loader.js +88 -0
- package/injector/instance-wrapper.d.ts +99 -0
- package/injector/instance-wrapper.js +350 -0
- package/injector/internal-core-module/index.d.ts +1 -0
- package/injector/internal-core-module/index.js +4 -0
- package/injector/internal-core-module/internal-core-module-factory.d.ts +9 -0
- package/injector/internal-core-module/internal-core-module-factory.js +52 -0
- package/injector/internal-core-module/internal-core-module.d.ts +5 -0
- package/injector/internal-core-module/internal-core-module.js +40 -0
- package/injector/internal-providers-storage.d.ts +9 -0
- package/injector/internal-providers-storage.js +19 -0
- package/injector/lazy-module-loader/lazy-module-loader-options.interface.d.ts +6 -0
- package/injector/lazy-module-loader/lazy-module-loader-options.interface.js +2 -0
- package/injector/lazy-module-loader/lazy-module-loader.d.ts +20 -0
- package/injector/lazy-module-loader/lazy-module-loader.js +49 -0
- package/injector/module-ref.d.ts +106 -0
- package/injector/module-ref.js +66 -0
- package/injector/module.d.ts +82 -0
- package/injector/module.js +432 -0
- package/injector/modules-container.d.ts +27 -0
- package/injector/modules-container.js +42 -0
- package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.d.ts +15 -0
- package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.js +41 -0
- package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.d.ts +15 -0
- package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.js +83 -0
- package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.d.ts +18 -0
- package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.js +2 -0
- package/injector/settlement-signal.d.ts +37 -0
- package/injector/settlement-signal.js +55 -0
- package/injector/topology-tree/topology-tree.d.ts +8 -0
- package/injector/topology-tree/topology-tree.js +51 -0
- package/injector/topology-tree/tree-node.d.ts +14 -0
- package/injector/topology-tree/tree-node.js +54 -0
- package/inspector/deterministic-uuid-registry.d.ts +6 -0
- package/inspector/deterministic-uuid-registry.js +24 -0
- package/inspector/graph-inspector.d.ts +26 -0
- package/inspector/graph-inspector.js +166 -0
- package/inspector/index.d.ts +4 -0
- package/inspector/index.js +7 -0
- package/inspector/initialize-on-preview.allowlist.d.ts +6 -0
- package/inspector/initialize-on-preview.allowlist.js +13 -0
- package/inspector/interfaces/edge.interface.d.ts +28 -0
- package/inspector/interfaces/edge.interface.js +2 -0
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +12 -0
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +2 -0
- package/inspector/interfaces/entrypoint.interface.d.ts +23 -0
- package/inspector/interfaces/entrypoint.interface.js +2 -0
- package/inspector/interfaces/extras.interface.d.ts +18 -0
- package/inspector/interfaces/extras.interface.js +2 -0
- package/inspector/interfaces/node.interface.d.ts +48 -0
- package/inspector/interfaces/node.interface.js +2 -0
- package/inspector/interfaces/serialized-graph-json.interface.d.ts +14 -0
- package/inspector/interfaces/serialized-graph-json.interface.js +2 -0
- package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +10 -0
- package/inspector/interfaces/serialized-graph-metadata.interface.js +2 -0
- package/inspector/noop-graph-inspector.d.ts +2 -0
- package/inspector/noop-graph-inspector.js +8 -0
- package/inspector/partial-graph.host.d.ts +7 -0
- package/inspector/partial-graph.host.js +15 -0
- package/inspector/serialized-graph.d.ts +52 -0
- package/inspector/serialized-graph.js +124 -0
- package/inspector/uuid-factory.d.ts +9 -0
- package/inspector/uuid-factory.js +22 -0
- package/interceptors/index.d.ts +2 -0
- package/interceptors/index.js +5 -0
- package/interceptors/interceptors-consumer.d.ts +9 -0
- package/interceptors/interceptors-consumer.js +37 -0
- package/interceptors/interceptors-context-creator.d.ts +16 -0
- package/interceptors/interceptors-context-creator.js +69 -0
- package/interfaces/index.d.ts +2 -0
- package/interfaces/index.js +2 -0
- package/interfaces/module-definition.interface.d.ts +3 -0
- package/interfaces/module-definition.interface.js +2 -0
- package/interfaces/module-override.interface.d.ts +5 -0
- package/interfaces/module-override.interface.js +2 -0
- package/internal.d.ts +38 -0
- package/internal.js +46 -0
- package/metadata-scanner.d.ts +17 -0
- package/metadata-scanner.js +83 -0
- package/middleware/builder.d.ts +15 -0
- package/middleware/builder.js +91 -0
- package/middleware/container.d.ts +14 -0
- package/middleware/container.js +49 -0
- package/middleware/index.d.ts +1 -0
- package/middleware/index.js +4 -0
- package/middleware/middleware-module.d.ts +33 -0
- package/middleware/middleware-module.js +208 -0
- package/middleware/resolver.d.ts +10 -0
- package/middleware/resolver.js +18 -0
- package/middleware/route-info-path-extractor.d.ts +15 -0
- package/middleware/route-info-path-extractor.js +81 -0
- package/middleware/routes-mapper.d.ts +19 -0
- package/middleware/routes-mapper.js +117 -0
- package/middleware/utils.d.ts +8 -0
- package/middleware/utils.js +106 -0
- package/nest-application-context.d.ts +173 -0
- package/nest-application-context.js +327 -0
- package/nest-application.d.ts +64 -0
- package/nest-application.js +328 -0
- package/nest-factory.d.ts +83 -0
- package/nest-factory.js +232 -0
- package/package.json +73 -0
- package/pipes/index.d.ts +3 -0
- package/pipes/index.js +6 -0
- package/pipes/params-token-factory.d.ts +5 -0
- package/pipes/params-token-factory.js +19 -0
- package/pipes/pipes-consumer.d.ts +10 -0
- package/pipes/pipes-consumer.js +21 -0
- package/pipes/pipes-context-creator.d.ts +17 -0
- package/pipes/pipes-context-creator.js +72 -0
- package/repl/assign-to-object.util.d.ts +5 -0
- package/repl/assign-to-object.util.js +14 -0
- package/repl/constants.d.ts +1 -0
- package/repl/constants.js +4 -0
- package/repl/index.d.ts +1 -0
- package/repl/index.js +4 -0
- package/repl/native-functions/debug-repl-fn.d.ts +9 -0
- package/repl/native-functions/debug-repl-fn.js +46 -0
- package/repl/native-functions/get-repl-fn.d.ts +7 -0
- package/repl/native-functions/get-repl-fn.js +19 -0
- package/repl/native-functions/help-repl-fn.d.ts +7 -0
- package/repl/native-functions/help-repl-fn.js +29 -0
- package/repl/native-functions/index.d.ts +6 -0
- package/repl/native-functions/index.js +9 -0
- package/repl/native-functions/methods-repl-fn.d.ts +8 -0
- package/repl/native-functions/methods-repl-fn.js +28 -0
- package/repl/native-functions/resolve-repl-fn.d.ts +7 -0
- package/repl/native-functions/resolve-repl-fn.js +18 -0
- package/repl/native-functions/select-relp-fn.d.ts +7 -0
- package/repl/native-functions/select-relp-fn.js +18 -0
- package/repl/repl-context.d.ts +26 -0
- package/repl/repl-context.js +126 -0
- package/repl/repl-function.d.ts +18 -0
- package/repl/repl-function.js +19 -0
- package/repl/repl-logger.d.ts +5 -0
- package/repl/repl-logger.js +22 -0
- package/repl/repl-native-commands.d.ts +2 -0
- package/repl/repl-native-commands.js +46 -0
- package/repl/repl.d.ts +3 -0
- package/repl/repl.interfaces.d.ts +16 -0
- package/repl/repl.interfaces.js +2 -0
- package/repl/repl.js +32 -0
- package/router/index.d.ts +3 -0
- package/router/index.js +8 -0
- package/router/interfaces/exceptions-filter.interface.d.ts +6 -0
- package/router/interfaces/exceptions-filter.interface.js +2 -0
- package/router/interfaces/exclude-route-metadata.interface.d.ts +15 -0
- package/router/interfaces/exclude-route-metadata.interface.js +2 -0
- package/router/interfaces/index.d.ts +1 -0
- package/router/interfaces/index.js +4 -0
- package/router/interfaces/resolver.interface.d.ts +5 -0
- package/router/interfaces/resolver.interface.js +2 -0
- package/router/interfaces/route-params-factory.interface.d.ts +8 -0
- package/router/interfaces/route-params-factory.interface.js +2 -0
- package/router/interfaces/route-path-metadata.interface.d.ts +32 -0
- package/router/interfaces/route-path-metadata.interface.js +2 -0
- package/router/interfaces/routes.interface.d.ts +7 -0
- package/router/interfaces/routes.interface.js +2 -0
- package/router/legacy-route-converter.d.ts +16 -0
- package/router/legacy-route-converter.js +61 -0
- package/router/paths-explorer.d.ts +18 -0
- package/router/paths-explorer.js +45 -0
- package/router/request/index.d.ts +1 -0
- package/router/request/index.js +5 -0
- package/router/request/request-constants.d.ts +2 -0
- package/router/request/request-constants.js +5 -0
- package/router/request/request-providers.d.ts +2 -0
- package/router/request/request-providers.js +11 -0
- package/router/route-params-factory.d.ts +9 -0
- package/router/route-params-factory.js +41 -0
- package/router/route-path-factory.d.ts +14 -0
- package/router/route-path-factory.js +101 -0
- package/router/router-exception-filters.d.ts +14 -0
- package/router/router-exception-filters.js +40 -0
- package/router/router-execution-context.d.ts +54 -0
- package/router/router-execution-context.js +186 -0
- package/router/router-explorer.d.ts +47 -0
- package/router/router-explorer.js +234 -0
- package/router/router-module.d.ts +19 -0
- package/router/router-module.js +80 -0
- package/router/router-proxy.d.ts +6 -0
- package/router/router-proxy.js +31 -0
- package/router/router-response-controller.d.ts +28 -0
- package/router/router-response-controller.js +98 -0
- package/router/routes-resolver.d.ts +27 -0
- package/router/routes-resolver.js +129 -0
- package/router/sse-stream.d.ts +43 -0
- package/router/sse-stream.js +83 -0
- package/router/utils/exclude-route.util.d.ts +4 -0
- package/router/utils/exclude-route.util.js +19 -0
- package/router/utils/flatten-route-paths.util.d.ts +6 -0
- package/router/utils/flatten-route-paths.util.js +25 -0
- package/router/utils/index.d.ts +2 -0
- package/router/utils/index.js +5 -0
- package/scanner.d.ts +89 -0
- package/scanner.js +416 -0
- package/services/index.d.ts +1 -0
- package/services/index.js +4 -0
- package/services/reflector.service.d.ts +111 -0
- package/services/reflector.service.js +100 -0
- package/tsconfig.build.json +21 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiscoverableMetaHostCollection = void 0;
|
|
4
|
+
class DiscoverableMetaHostCollection {
|
|
5
|
+
/**
|
|
6
|
+
* Adds a link between a class reference and a metadata key.
|
|
7
|
+
* @param target The class reference.
|
|
8
|
+
* @param metadataKey The metadata key.
|
|
9
|
+
*/
|
|
10
|
+
static addClassMetaHostLink(target, metadataKey) {
|
|
11
|
+
this.metaHostLinks.set(target, metadataKey);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Inspects a provider instance wrapper and adds it to the collection of providers
|
|
15
|
+
* if it has a metadata key.
|
|
16
|
+
* @param hostContainerRef A reference to the modules container.
|
|
17
|
+
* @param instanceWrapper A provider instance wrapper.
|
|
18
|
+
* @returns void
|
|
19
|
+
*/
|
|
20
|
+
static inspectProvider(hostContainerRef, instanceWrapper) {
|
|
21
|
+
return this.inspectInstanceWrapper(hostContainerRef, instanceWrapper, this.providersByMetaKey);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Inspects a controller instance wrapper and adds it to the collection of controllers
|
|
25
|
+
* if it has a metadata key.
|
|
26
|
+
* @param hostContainerRef A reference to the modules container.
|
|
27
|
+
* @param instanceWrapper A controller's instance wrapper.
|
|
28
|
+
* @returns void
|
|
29
|
+
*/
|
|
30
|
+
static inspectController(hostContainerRef, instanceWrapper) {
|
|
31
|
+
return this.inspectInstanceWrapper(hostContainerRef, instanceWrapper, this.controllersByMetaKey);
|
|
32
|
+
}
|
|
33
|
+
static insertByMetaKey(metaKey, instanceWrapper, collection) {
|
|
34
|
+
if (collection.has(metaKey)) {
|
|
35
|
+
const wrappers = collection.get(metaKey);
|
|
36
|
+
wrappers.add(instanceWrapper);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const wrappers = new Set();
|
|
40
|
+
wrappers.add(instanceWrapper);
|
|
41
|
+
collection.set(metaKey, wrappers);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
static getProvidersByMetaKey(hostContainerRef, metaKey) {
|
|
45
|
+
const wrappersByMetaKey = this.providersByMetaKey.get(hostContainerRef);
|
|
46
|
+
return wrappersByMetaKey?.get(metaKey) ?? new Set();
|
|
47
|
+
}
|
|
48
|
+
static getControllersByMetaKey(hostContainerRef, metaKey) {
|
|
49
|
+
const wrappersByMetaKey = this.controllersByMetaKey.get(hostContainerRef);
|
|
50
|
+
return wrappersByMetaKey?.get(metaKey) ?? new Set();
|
|
51
|
+
}
|
|
52
|
+
static inspectInstanceWrapper(hostContainerRef, instanceWrapper, wrapperByMetaKeyMap) {
|
|
53
|
+
const metaKey = DiscoverableMetaHostCollection.getMetaKeyByInstanceWrapper(instanceWrapper);
|
|
54
|
+
if (!metaKey) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let collection;
|
|
58
|
+
if (wrapperByMetaKeyMap.has(hostContainerRef)) {
|
|
59
|
+
collection = wrapperByMetaKeyMap.get(hostContainerRef);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
collection = new Map();
|
|
63
|
+
wrapperByMetaKeyMap.set(hostContainerRef, collection);
|
|
64
|
+
}
|
|
65
|
+
this.insertByMetaKey(metaKey, instanceWrapper, collection);
|
|
66
|
+
}
|
|
67
|
+
static getMetaKeyByInstanceWrapper(instanceWrapper) {
|
|
68
|
+
return this.metaHostLinks.get(
|
|
69
|
+
// NOTE: Regarding the ternary statement below,
|
|
70
|
+
// - The condition `!wrapper.metatype` is needed because when we use `useValue`
|
|
71
|
+
// the value of `wrapper.metatype` will be `null`.
|
|
72
|
+
// - The condition `wrapper.inject` is needed here because when we use
|
|
73
|
+
// `useFactory`, the value of `wrapper.metatype` will be the supplied
|
|
74
|
+
// factory function.
|
|
75
|
+
// For both cases, we should use `wrapper.instance.constructor` instead
|
|
76
|
+
// of `wrapper.metatype` to resolve processor's class properly.
|
|
77
|
+
// But since calling `wrapper.instance` could degrade overall performance
|
|
78
|
+
// we must defer it as much we can.
|
|
79
|
+
instanceWrapper.metatype || instanceWrapper.inject
|
|
80
|
+
? (instanceWrapper.instance?.constructor ?? instanceWrapper.metatype)
|
|
81
|
+
: instanceWrapper.metatype);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.DiscoverableMetaHostCollection = DiscoverableMetaHostCollection;
|
|
85
|
+
/**
|
|
86
|
+
* A map of class references to metadata keys.
|
|
87
|
+
*/
|
|
88
|
+
DiscoverableMetaHostCollection.metaHostLinks = new Map();
|
|
89
|
+
/**
|
|
90
|
+
* A map of metadata keys to instance wrappers (providers) with the corresponding metadata key.
|
|
91
|
+
* The map is weakly referenced by the modules container (unique per application).
|
|
92
|
+
*/
|
|
93
|
+
DiscoverableMetaHostCollection.providersByMetaKey = new WeakMap();
|
|
94
|
+
/**
|
|
95
|
+
* A map of metadata keys to instance wrappers (controllers) with the corresponding metadata key.
|
|
96
|
+
* The map is weakly referenced by the modules container (unique per application).
|
|
97
|
+
*/
|
|
98
|
+
DiscoverableMetaHostCollection.controllersByMetaKey = new WeakMap();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiscoveryModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const metadata_scanner_1 = require("../metadata-scanner");
|
|
7
|
+
const discovery_service_1 = require("./discovery-service");
|
|
8
|
+
/**
|
|
9
|
+
* @publicApi
|
|
10
|
+
*/
|
|
11
|
+
let DiscoveryModule = class DiscoveryModule {
|
|
12
|
+
};
|
|
13
|
+
exports.DiscoveryModule = DiscoveryModule;
|
|
14
|
+
exports.DiscoveryModule = DiscoveryModule = tslib_1.__decorate([
|
|
15
|
+
(0, common_1.Module)({
|
|
16
|
+
providers: [metadata_scanner_1.MetadataScanner, discovery_service_1.DiscoveryService],
|
|
17
|
+
exports: [metadata_scanner_1.MetadataScanner, discovery_service_1.DiscoveryService],
|
|
18
|
+
})
|
|
19
|
+
], DiscoveryModule);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CustomDecorator } from '@nestjs/common';
|
|
2
|
+
import { InstanceWrapper } from '../injector/instance-wrapper';
|
|
3
|
+
import { Module } from '../injector/module';
|
|
4
|
+
import { ModulesContainer } from '../injector/modules-container';
|
|
5
|
+
/**
|
|
6
|
+
* @publicApi
|
|
7
|
+
*/
|
|
8
|
+
export interface FilterByInclude {
|
|
9
|
+
/**
|
|
10
|
+
* List of modules to include (whitelist) into the discovery process.
|
|
11
|
+
*/
|
|
12
|
+
include?: Function[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @publicApi
|
|
16
|
+
*/
|
|
17
|
+
export interface FilterByMetadataKey {
|
|
18
|
+
/**
|
|
19
|
+
* A key to filter controllers and providers by.
|
|
20
|
+
* Only instance wrappers with the specified metadata key will be returned.
|
|
21
|
+
*/
|
|
22
|
+
metadataKey?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @publicApi
|
|
26
|
+
*/
|
|
27
|
+
export type DiscoveryOptions = FilterByInclude | FilterByMetadataKey;
|
|
28
|
+
/**
|
|
29
|
+
* @publicApi
|
|
30
|
+
*/
|
|
31
|
+
export type DiscoverableDecorator<T> = ((opts?: T) => CustomDecorator) & {
|
|
32
|
+
KEY: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @publicApi
|
|
36
|
+
*/
|
|
37
|
+
export declare class DiscoveryService {
|
|
38
|
+
private readonly modulesContainer;
|
|
39
|
+
constructor(modulesContainer: ModulesContainer);
|
|
40
|
+
/**
|
|
41
|
+
* Creates a decorator that can be used to decorate classes and methods with metadata.
|
|
42
|
+
* The decorator will also add the class to the collection of discoverable classes (by metadata key).
|
|
43
|
+
* Decorated classes can be discovered using the `getProviders` and `getControllers` methods.
|
|
44
|
+
* @returns A decorator function.
|
|
45
|
+
*/
|
|
46
|
+
static createDecorator<T>(): DiscoverableDecorator<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Returns an array of instance wrappers (providers).
|
|
49
|
+
* Depending on the options, the array will contain either all providers or only providers with the specified metadata key.
|
|
50
|
+
* @param options Discovery options.
|
|
51
|
+
* @param modules A list of modules to filter by.
|
|
52
|
+
* @returns An array of instance wrappers (providers).
|
|
53
|
+
*/
|
|
54
|
+
getProviders(options?: DiscoveryOptions, modules?: Module[]): InstanceWrapper[];
|
|
55
|
+
/**
|
|
56
|
+
* Returns an array of instance wrappers (controllers).
|
|
57
|
+
* Depending on the options, the array will contain either all controllers or only controllers with the specified metadata key.
|
|
58
|
+
* @param options Discovery options.
|
|
59
|
+
* @param modules A list of modules to filter by.
|
|
60
|
+
* @returns An array of instance wrappers (controllers).
|
|
61
|
+
*/
|
|
62
|
+
getControllers(options?: DiscoveryOptions, modules?: Module[]): InstanceWrapper[];
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves metadata from the specified instance wrapper.
|
|
65
|
+
* @param decorator The decorator to retrieve metadata of.
|
|
66
|
+
* @param instanceWrapper Reference to the instance wrapper.
|
|
67
|
+
* @param methodKey An optional method key to retrieve metadata from.
|
|
68
|
+
* @returns Discovered metadata.
|
|
69
|
+
*/
|
|
70
|
+
getMetadataByDecorator<T extends DiscoverableDecorator<any>>(decorator: T, instanceWrapper: InstanceWrapper, methodKey?: string): T extends DiscoverableDecorator<infer R> ? R | undefined : T | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Returns a list of modules to be used for discovery.
|
|
73
|
+
*/
|
|
74
|
+
protected getModules(options?: DiscoveryOptions): Module[];
|
|
75
|
+
private includeWhitelisted;
|
|
76
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiscoveryService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const uid_1 = require("uid");
|
|
7
|
+
const modules_container_1 = require("../injector/modules-container");
|
|
8
|
+
const discoverable_meta_host_collection_1 = require("./discoverable-meta-host-collection");
|
|
9
|
+
/**
|
|
10
|
+
* @publicApi
|
|
11
|
+
*/
|
|
12
|
+
let DiscoveryService = class DiscoveryService {
|
|
13
|
+
constructor(modulesContainer) {
|
|
14
|
+
this.modulesContainer = modulesContainer;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a decorator that can be used to decorate classes and methods with metadata.
|
|
18
|
+
* The decorator will also add the class to the collection of discoverable classes (by metadata key).
|
|
19
|
+
* Decorated classes can be discovered using the `getProviders` and `getControllers` methods.
|
|
20
|
+
* @returns A decorator function.
|
|
21
|
+
*/
|
|
22
|
+
static createDecorator() {
|
|
23
|
+
const metadataKey = (0, uid_1.uid)(21);
|
|
24
|
+
const decoratorFn = (opts) => (target, key, descriptor) => {
|
|
25
|
+
if (!descriptor) {
|
|
26
|
+
discoverable_meta_host_collection_1.DiscoverableMetaHostCollection.addClassMetaHostLink(target, metadataKey);
|
|
27
|
+
}
|
|
28
|
+
(0, common_1.SetMetadata)(metadataKey, opts ?? {})(target, key, descriptor);
|
|
29
|
+
};
|
|
30
|
+
decoratorFn.KEY = metadataKey;
|
|
31
|
+
return decoratorFn;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns an array of instance wrappers (providers).
|
|
35
|
+
* Depending on the options, the array will contain either all providers or only providers with the specified metadata key.
|
|
36
|
+
* @param options Discovery options.
|
|
37
|
+
* @param modules A list of modules to filter by.
|
|
38
|
+
* @returns An array of instance wrappers (providers).
|
|
39
|
+
*/
|
|
40
|
+
getProviders(options = {}, modules = this.getModules(options)) {
|
|
41
|
+
if ('metadataKey' in options) {
|
|
42
|
+
const providers = discoverable_meta_host_collection_1.DiscoverableMetaHostCollection.getProvidersByMetaKey(this.modulesContainer, options.metadataKey);
|
|
43
|
+
return Array.from(providers);
|
|
44
|
+
}
|
|
45
|
+
const providers = modules.map(item => [...item.providers.values()]);
|
|
46
|
+
return (0, common_1.flatten)(providers);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns an array of instance wrappers (controllers).
|
|
50
|
+
* Depending on the options, the array will contain either all controllers or only controllers with the specified metadata key.
|
|
51
|
+
* @param options Discovery options.
|
|
52
|
+
* @param modules A list of modules to filter by.
|
|
53
|
+
* @returns An array of instance wrappers (controllers).
|
|
54
|
+
*/
|
|
55
|
+
getControllers(options = {}, modules = this.getModules(options)) {
|
|
56
|
+
if ('metadataKey' in options) {
|
|
57
|
+
const controllers = discoverable_meta_host_collection_1.DiscoverableMetaHostCollection.getControllersByMetaKey(this.modulesContainer, options.metadataKey);
|
|
58
|
+
return Array.from(controllers);
|
|
59
|
+
}
|
|
60
|
+
const controllers = modules.map(item => [...item.controllers.values()]);
|
|
61
|
+
return (0, common_1.flatten)(controllers);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves metadata from the specified instance wrapper.
|
|
65
|
+
* @param decorator The decorator to retrieve metadata of.
|
|
66
|
+
* @param instanceWrapper Reference to the instance wrapper.
|
|
67
|
+
* @param methodKey An optional method key to retrieve metadata from.
|
|
68
|
+
* @returns Discovered metadata.
|
|
69
|
+
*/
|
|
70
|
+
getMetadataByDecorator(decorator, instanceWrapper, methodKey) {
|
|
71
|
+
if (methodKey) {
|
|
72
|
+
return Reflect.getMetadata(decorator.KEY, instanceWrapper.instance[methodKey]);
|
|
73
|
+
}
|
|
74
|
+
const clsRef = instanceWrapper.instance?.constructor ?? instanceWrapper.metatype;
|
|
75
|
+
return Reflect.getMetadata(decorator.KEY, clsRef);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Returns a list of modules to be used for discovery.
|
|
79
|
+
*/
|
|
80
|
+
getModules(options = {}) {
|
|
81
|
+
const includeInOpts = 'include' in options;
|
|
82
|
+
if (!includeInOpts) {
|
|
83
|
+
const moduleRefs = [...this.modulesContainer.values()];
|
|
84
|
+
return moduleRefs;
|
|
85
|
+
}
|
|
86
|
+
const whitelisted = this.includeWhitelisted(options.include);
|
|
87
|
+
return whitelisted;
|
|
88
|
+
}
|
|
89
|
+
includeWhitelisted(include) {
|
|
90
|
+
const moduleRefs = [...this.modulesContainer.values()];
|
|
91
|
+
return moduleRefs.filter(({ metatype }) => include.some(item => item === metatype));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports.DiscoveryService = DiscoveryService;
|
|
95
|
+
exports.DiscoveryService = DiscoveryService = tslib_1.__decorate([
|
|
96
|
+
(0, common_1.Injectable)(),
|
|
97
|
+
tslib_1.__metadata("design:paramtypes", [modules_container_1.ModulesContainer])
|
|
98
|
+
], DiscoveryService);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExceptionHandler = void 0;
|
|
4
|
+
const logger_service_1 = require("@nestjs/common/services/logger.service");
|
|
5
|
+
class ExceptionHandler {
|
|
6
|
+
handle(exception) {
|
|
7
|
+
ExceptionHandler.logger.error(exception);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ExceptionHandler = ExceptionHandler;
|
|
11
|
+
ExceptionHandler.logger = new logger_service_1.Logger(ExceptionHandler.name);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CircularDependencyException = void 0;
|
|
4
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
+
class CircularDependencyException extends runtime_exception_1.RuntimeException {
|
|
6
|
+
constructor(context) {
|
|
7
|
+
const ctx = context ? ` inside ${context}` : ``;
|
|
8
|
+
super(`A circular dependency has been detected${ctx}. Please, make sure that each side of a bidirectional relationships are decorated with "forwardRef()". Note that circular relationships between custom providers (e.g., factories) are not supported since functions cannot be called more than once.`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CircularDependencyException = CircularDependencyException;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './circular-dependency.exception';
|
|
2
|
+
export * from './runtime.exception';
|
|
3
|
+
export * from './unknown-element.exception';
|
|
4
|
+
export * from './invalid-class-scope.exception';
|
|
5
|
+
export * from './invalid-class.exception';
|
|
6
|
+
export * from './unknown-export.exception';
|
|
7
|
+
export * from './unknown-module.exception';
|
|
8
|
+
export * from './undefined-forwardref.exception';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./circular-dependency.exception"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./runtime.exception"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./unknown-element.exception"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./invalid-class-scope.exception"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./invalid-class.exception"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./unknown-export.exception"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./unknown-module.exception"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./undefined-forwardref.exception"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidClassModuleException = void 0;
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
+
class InvalidClassModuleException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor(metatypeUsedAsAModule, scope) {
|
|
8
|
+
super((0, messages_1.USING_INVALID_CLASS_AS_A_MODULE_MESSAGE)(metatypeUsedAsAModule, scope));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidClassModuleException = InvalidClassModuleException;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Abstract, Type } from '@nestjs/common/interfaces';
|
|
2
|
+
import { RuntimeException } from './runtime.exception';
|
|
3
|
+
export declare class InvalidClassScopeException extends RuntimeException {
|
|
4
|
+
constructor(metatypeOrToken: Type<any> | Abstract<any> | string | symbol);
|
|
5
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidClassScopeException = void 0;
|
|
4
|
+
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
5
|
+
const messages_1 = require("../messages");
|
|
6
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
7
|
+
class InvalidClassScopeException extends runtime_exception_1.RuntimeException {
|
|
8
|
+
constructor(metatypeOrToken) {
|
|
9
|
+
let name = (0, shared_utils_1.isFunction)(metatypeOrToken)
|
|
10
|
+
? metatypeOrToken.name
|
|
11
|
+
: metatypeOrToken;
|
|
12
|
+
name = name && name.toString();
|
|
13
|
+
super((0, messages_1.INVALID_CLASS_SCOPE_MESSAGE) `${name}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.InvalidClassScopeException = InvalidClassScopeException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidClassException = void 0;
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
+
class InvalidClassException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor(value) {
|
|
8
|
+
super((0, messages_1.INVALID_CLASS_MESSAGE) `${value}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidClassException = InvalidClassException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidExceptionFilterException = void 0;
|
|
4
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
+
const messages_1 = require("../messages");
|
|
6
|
+
class InvalidExceptionFilterException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(messages_1.INVALID_EXCEPTION_FILTER);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidExceptionFilterException = InvalidExceptionFilterException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidMiddlewareConfigurationException = void 0;
|
|
4
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
+
const messages_1 = require("../messages");
|
|
6
|
+
class InvalidMiddlewareConfigurationException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(messages_1.INVALID_MIDDLEWARE_CONFIGURATION);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidMiddlewareConfigurationException = InvalidMiddlewareConfigurationException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidMiddlewareException = void 0;
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
+
class InvalidMiddlewareException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor(name) {
|
|
8
|
+
super((0, messages_1.INVALID_MIDDLEWARE_MESSAGE) `${name}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidMiddlewareException = InvalidMiddlewareException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidModuleException = void 0;
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
+
class InvalidModuleException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor(parentModule, index, scope) {
|
|
8
|
+
super((0, messages_1.INVALID_MODULE_MESSAGE)(parentModule, index, scope));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidModuleException = InvalidModuleException;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeException = void 0;
|
|
4
|
+
class RuntimeException extends Error {
|
|
5
|
+
constructor(message = ``) {
|
|
6
|
+
super(message);
|
|
7
|
+
}
|
|
8
|
+
what() {
|
|
9
|
+
return this.message;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.RuntimeException = RuntimeException;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InjectorDependencyContext } from '../../injector/injector';
|
|
2
|
+
import { Module } from '../../injector/module';
|
|
3
|
+
import { RuntimeException } from './runtime.exception';
|
|
4
|
+
export declare class UndefinedDependencyException extends RuntimeException {
|
|
5
|
+
constructor(type: string, undefinedDependencyContext: InjectorDependencyContext, moduleRef?: Module);
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UndefinedDependencyException = void 0;
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
+
class UndefinedDependencyException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor(type, undefinedDependencyContext, moduleRef) {
|
|
8
|
+
super((0, messages_1.UNKNOWN_DEPENDENCIES_MESSAGE)(type, undefinedDependencyContext, moduleRef));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.UndefinedDependencyException = UndefinedDependencyException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UndefinedForwardRefException = void 0;
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
+
class UndefinedForwardRefException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor(scope) {
|
|
8
|
+
super((0, messages_1.UNDEFINED_FORWARDREF_MESSAGE)(scope));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.UndefinedForwardRefException = UndefinedForwardRefException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UndefinedModuleException = void 0;
|
|
4
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
+
const messages_1 = require("../messages");
|
|
6
|
+
class UndefinedModuleException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor(parentModule, index, scope) {
|
|
8
|
+
super((0, messages_1.UNDEFINED_MODULE_MESSAGE)(parentModule, index, scope));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.UndefinedModuleException = UndefinedModuleException;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InjectorDependencyContext } from '../../injector/injector';
|
|
2
|
+
import { Module } from '../../injector/module';
|
|
3
|
+
import { RuntimeException } from './runtime.exception';
|
|
4
|
+
export declare class UnknownDependenciesException extends RuntimeException {
|
|
5
|
+
readonly type: string | symbol;
|
|
6
|
+
readonly context: InjectorDependencyContext;
|
|
7
|
+
readonly metadata?: {
|
|
8
|
+
id: string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
readonly moduleRef: {
|
|
11
|
+
id: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
constructor(type: string | symbol, context: InjectorDependencyContext, moduleRef?: Module, metadata?: {
|
|
14
|
+
id: string;
|
|
15
|
+
} | undefined);
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnknownDependenciesException = void 0;
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
6
|
+
class UnknownDependenciesException extends runtime_exception_1.RuntimeException {
|
|
7
|
+
constructor(type, context, moduleRef, metadata) {
|
|
8
|
+
super((0, messages_1.UNKNOWN_DEPENDENCIES_MESSAGE)(type, context, moduleRef));
|
|
9
|
+
this.type = type;
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.metadata = metadata;
|
|
12
|
+
this.moduleRef = moduleRef && { id: moduleRef.id };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.UnknownDependenciesException = UnknownDependenciesException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnknownElementException = void 0;
|
|
4
|
+
const runtime_exception_1 = require("./runtime.exception");
|
|
5
|
+
class UnknownElementException extends runtime_exception_1.RuntimeException {
|
|
6
|
+
constructor(name) {
|
|
7
|
+
name = name && name.toString();
|
|
8
|
+
super(`Nest could not find ${name || 'given'} element (this provider does not exist in the current context)`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.UnknownElementException = UnknownElementException;
|