@depup/nestjs__core 11.2.3-depup.0 → 12.0.2-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 +372 -3
- package/adapters/http-adapter.js +135 -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 +25 -20
- 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 +46 -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/is-debug-mode.util.d.ts +1 -0
- package/injector/helpers/is-debug-mode.util.js +3 -0
- 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 -7
- package/injector/injector.js +104 -93
- 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 +17 -11
- package/injector/instance-wrapper.d.ts +8 -6
- package/injector/instance-wrapper.js +98 -81
- 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 +36 -27
- 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 +97 -83
- 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 +26 -11
- package/nest-application-context.js +79 -67
- 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 +2 -1
- package/router/sse-stream.js +29 -24
- 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,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const exceptions_1 = require("../errors/exceptions");
|
|
6
|
-
class AbstractInstanceResolver {
|
|
1
|
+
import { Scope } from '@nestjs/common';
|
|
2
|
+
import { InvalidClassScopeException, UnknownElementException, } from '../errors/exceptions/index.js';
|
|
3
|
+
export class AbstractInstanceResolver {
|
|
7
4
|
find(typeOrToken, options) {
|
|
8
5
|
const instanceLinkOrArray = this.instanceLinksHost.get(typeOrToken, options);
|
|
9
6
|
const pluckInstance = ({ wrapperRef }) => {
|
|
10
|
-
if (wrapperRef.scope ===
|
|
11
|
-
wrapperRef.scope ===
|
|
7
|
+
if (wrapperRef.scope === Scope.REQUEST ||
|
|
8
|
+
wrapperRef.scope === Scope.TRANSIENT ||
|
|
12
9
|
!wrapperRef.isDependencyTreeStatic()) {
|
|
13
|
-
throw new
|
|
10
|
+
throw new InvalidClassScopeException(typeOrToken);
|
|
14
11
|
}
|
|
15
12
|
return wrapperRef.instance;
|
|
16
13
|
};
|
|
@@ -36,7 +33,7 @@ class AbstractInstanceResolver {
|
|
|
36
33
|
const ctorHost = wrapperRef.instance || { constructor: typeOrToken };
|
|
37
34
|
const instance = await this.injector.loadPerContext(ctorHost, wrapperRef.host, collection, contextId, wrapperRef);
|
|
38
35
|
if (!instance) {
|
|
39
|
-
throw new
|
|
36
|
+
throw new UnknownElementException();
|
|
40
37
|
}
|
|
41
38
|
return instance;
|
|
42
39
|
};
|
|
@@ -46,4 +43,3 @@ class AbstractInstanceResolver {
|
|
|
46
43
|
return pluckInstance(instanceLinkOrArray);
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
|
-
exports.AbstractInstanceResolver = AbstractInstanceResolver;
|
package/injector/compiler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ModuleOpaqueKeyFactory } from './opaque-key-factory/interfaces/module-opaque-key-factory.interface.js';
|
|
2
|
+
import type { DynamicModule, ForwardReference, Type } from '@nestjs/common';
|
|
3
3
|
export interface ModuleFactory {
|
|
4
4
|
type: Type<any>;
|
|
5
5
|
token: string;
|
package/injector/compiler.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ModuleCompiler = void 0;
|
|
4
|
-
class ModuleCompiler {
|
|
1
|
+
export class ModuleCompiler {
|
|
2
|
+
_moduleOpaqueKeyFactory;
|
|
5
3
|
constructor(_moduleOpaqueKeyFactory) {
|
|
6
4
|
this._moduleOpaqueKeyFactory = _moduleOpaqueKeyFactory;
|
|
7
5
|
}
|
|
@@ -32,4 +30,3 @@ class ModuleCompiler {
|
|
|
32
30
|
return !!moduleClsOrDynamic.module;
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
|
-
exports.ModuleCompiler = ModuleCompiler;
|
package/injector/constants.d.ts
CHANGED
package/injector/constants.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STATIC_CONTEXT = exports.CONTROLLER_ID_KEY = void 0;
|
|
4
|
-
exports.CONTROLLER_ID_KEY = 'CONTROLLER_ID';
|
|
1
|
+
export const CONTROLLER_ID_KEY = 'CONTROLLER_ID';
|
|
5
2
|
const STATIC_CONTEXT_ID = 1;
|
|
6
|
-
|
|
3
|
+
export const STATIC_CONTEXT = Object.freeze({
|
|
7
4
|
id: STATIC_CONTEXT_ID,
|
|
8
5
|
});
|
package/injector/container.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { DynamicModule, Provider } from '@nestjs/common';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { ModuleOpaqueKeyFactory } from './opaque-key-factory/interfaces/module-opaque-key-factory.interface';
|
|
1
|
+
import type { DynamicModule, Provider } from '@nestjs/common';
|
|
2
|
+
import { ApplicationConfig } from '../application-config.js';
|
|
3
|
+
import { SerializedGraph } from '../inspector/serialized-graph.js';
|
|
4
|
+
import { ModuleCompiler } from './compiler.js';
|
|
5
|
+
import { ContextId } from './instance-wrapper.js';
|
|
6
|
+
import { Module } from './module.js';
|
|
7
|
+
import { ModulesContainer } from './modules-container.js';
|
|
8
|
+
import { ModuleOpaqueKeyFactory } from './opaque-key-factory/interfaces/module-opaque-key-factory.interface.js';
|
|
9
|
+
import { type EnhancerSubtype, type Injectable, type NestApplicationContextOptions } from '@nestjs/common/internal';
|
|
10
|
+
import type { Type } from '@nestjs/common';
|
|
12
11
|
type ModuleMetatype = Type<any> | DynamicModule | Promise<DynamicModule>;
|
|
13
12
|
type ModuleScope = Type<any>[];
|
|
14
13
|
export declare class NestContainer {
|
|
@@ -26,8 +25,8 @@ export declare class NestContainer {
|
|
|
26
25
|
get applicationConfig(): ApplicationConfig | undefined;
|
|
27
26
|
get contextOptions(): NestApplicationContextOptions | undefined;
|
|
28
27
|
setHttpAdapter(httpAdapter: any): void;
|
|
29
|
-
getHttpAdapterRef(): import("
|
|
30
|
-
getHttpAdapterHostRef(): import("
|
|
28
|
+
getHttpAdapterRef(): import("../index.js").AbstractHttpAdapter<any, any, any>;
|
|
29
|
+
getHttpAdapterHostRef(): import("../index.js").HttpAdapterHost<import("../index.js").AbstractHttpAdapter<any, any, any>>;
|
|
31
30
|
addModule(metatype: ModuleMetatype, scope: ModuleScope): Promise<{
|
|
32
31
|
moduleRef: Module;
|
|
33
32
|
inserted: boolean;
|
|
@@ -47,7 +46,7 @@ export declare class NestContainer {
|
|
|
47
46
|
getInternalCoreModuleRef(): Module | undefined;
|
|
48
47
|
addImport(relatedModule: Type<any> | DynamicModule, token: string): Promise<void>;
|
|
49
48
|
addProvider(provider: Provider, token: string, enhancerSubtype?: EnhancerSubtype): string | symbol | Function;
|
|
50
|
-
addInjectable(injectable: Provider, token: string, enhancerSubtype: EnhancerSubtype, host?: Type<Injectable>): string | symbol | Function | import("./instance-wrapper").InstanceWrapper<unknown>;
|
|
49
|
+
addInjectable(injectable: Provider, token: string, enhancerSubtype: EnhancerSubtype, host?: Type<Injectable>): string | symbol | Function | import("./instance-wrapper.js").InstanceWrapper<unknown>;
|
|
51
50
|
addExportedProviderOrModule(toExport: Type<any> | DynamicModule, token: string): void;
|
|
52
51
|
addController(controller: Type<any>, token: string): void;
|
|
53
52
|
clear(): void;
|
package/injector/container.js
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { DiscoverableMetaHostCollection } from '../discovery/discoverable-meta-host-collection.js';
|
|
2
|
+
import { CircularDependencyException, UndefinedForwardRefException, UnknownModuleException, } from '../errors/exceptions/index.js';
|
|
3
|
+
import { InitializeOnPreviewAllowlist } from '../inspector/initialize-on-preview.allowlist.js';
|
|
4
|
+
import { SerializedGraph } from '../inspector/serialized-graph.js';
|
|
5
|
+
import { REQUEST } from '../router/request/request-constants.js';
|
|
6
|
+
import { ModuleCompiler } from './compiler.js';
|
|
7
|
+
import { InternalCoreModule } from './internal-core-module/internal-core-module.js';
|
|
8
|
+
import { InternalProvidersStorage } from './internal-providers-storage.js';
|
|
9
|
+
import { Module } from './module.js';
|
|
10
|
+
import { ModulesContainer } from './modules-container.js';
|
|
11
|
+
import { ByReferenceModuleOpaqueKeyFactory } from './opaque-key-factory/by-reference-module-opaque-key-factory.js';
|
|
12
|
+
import { DeepHashedModuleOpaqueKeyFactory } from './opaque-key-factory/deep-hashed-module-opaque-key-factory.js';
|
|
13
|
+
import { GLOBAL_MODULE_METADATA, } from '@nestjs/common/internal';
|
|
14
|
+
export class NestContainer {
|
|
15
|
+
_applicationConfig;
|
|
16
|
+
_contextOptions;
|
|
17
|
+
globalModules = new Set();
|
|
18
|
+
modules = new ModulesContainer();
|
|
19
|
+
dynamicModulesMetadata = new Map();
|
|
20
|
+
internalProvidersStorage = new InternalProvidersStorage();
|
|
21
|
+
_serializedGraph = new SerializedGraph();
|
|
22
|
+
moduleCompiler;
|
|
23
|
+
internalCoreModule;
|
|
18
24
|
constructor(_applicationConfig = undefined, _contextOptions = undefined) {
|
|
19
25
|
this._applicationConfig = _applicationConfig;
|
|
20
26
|
this._contextOptions = _contextOptions;
|
|
21
|
-
this.globalModules = new Set();
|
|
22
|
-
this.modules = new modules_container_1.ModulesContainer();
|
|
23
|
-
this.dynamicModulesMetadata = new Map();
|
|
24
|
-
this.internalProvidersStorage = new internal_providers_storage_1.InternalProvidersStorage();
|
|
25
|
-
this._serializedGraph = new serialized_graph_1.SerializedGraph();
|
|
26
27
|
const moduleOpaqueKeyFactory = this._contextOptions?.moduleIdGeneratorAlgorithm === 'deep-hash'
|
|
27
|
-
? new
|
|
28
|
-
: new
|
|
28
|
+
? new DeepHashedModuleOpaqueKeyFactory()
|
|
29
|
+
: new ByReferenceModuleOpaqueKeyFactory({
|
|
29
30
|
keyGenerationStrategy: this._contextOptions?.snapshot
|
|
30
31
|
? 'shallow'
|
|
31
32
|
: 'random',
|
|
32
33
|
});
|
|
33
|
-
this.moduleCompiler = new
|
|
34
|
+
this.moduleCompiler = new ModuleCompiler(moduleOpaqueKeyFactory);
|
|
34
35
|
}
|
|
35
36
|
get serializedGraph() {
|
|
36
37
|
return this._serializedGraph;
|
|
@@ -59,7 +60,7 @@ class NestContainer {
|
|
|
59
60
|
// In DependenciesScanner#scanForModules we already check for undefined or invalid modules
|
|
60
61
|
// We still need to catch the edge-case of `forwardRef(() => undefined)`
|
|
61
62
|
if (!metatype) {
|
|
62
|
-
throw new
|
|
63
|
+
throw new UndefinedForwardRefException(scope);
|
|
63
64
|
}
|
|
64
65
|
const { type, dynamicMetadata, token } = await this.moduleCompiler.compile(metatype);
|
|
65
66
|
if (this.modules.has(token)) {
|
|
@@ -81,7 +82,7 @@ class NestContainer {
|
|
|
81
82
|
// In DependenciesScanner#scanForModules we already check for undefined or invalid modules
|
|
82
83
|
// We still need to catch the edge-case of `forwardRef(() => undefined)`
|
|
83
84
|
if (!metatypeToReplace || !newMetatype) {
|
|
84
|
-
throw new
|
|
85
|
+
throw new UndefinedForwardRefException(scope);
|
|
85
86
|
}
|
|
86
87
|
const { token } = await this.moduleCompiler.compile(metatypeToReplace);
|
|
87
88
|
const { type, dynamicMetadata } = await this.moduleCompiler.compile(newMetatype);
|
|
@@ -95,7 +96,7 @@ class NestContainer {
|
|
|
95
96
|
};
|
|
96
97
|
}
|
|
97
98
|
async setModule({ token, dynamicMetadata, type }, scope) {
|
|
98
|
-
const moduleRef = new
|
|
99
|
+
const moduleRef = new Module(type, this);
|
|
99
100
|
moduleRef.token = token;
|
|
100
101
|
moduleRef.initOnPreview = this.shouldInitOnPreview(type);
|
|
101
102
|
this.modules.set(token, moduleRef);
|
|
@@ -128,7 +129,7 @@ class NestContainer {
|
|
|
128
129
|
if (dynamicMetadata && dynamicMetadata.global) {
|
|
129
130
|
return true;
|
|
130
131
|
}
|
|
131
|
-
return !!Reflect.getMetadata(
|
|
132
|
+
return !!Reflect.getMetadata(GLOBAL_MODULE_METADATA, metatype);
|
|
132
133
|
}
|
|
133
134
|
addGlobalModule(module) {
|
|
134
135
|
this.globalModules.add(module);
|
|
@@ -157,38 +158,38 @@ class NestContainer {
|
|
|
157
158
|
addProvider(provider, token, enhancerSubtype) {
|
|
158
159
|
const moduleRef = this.modules.get(token);
|
|
159
160
|
if (!provider) {
|
|
160
|
-
throw new
|
|
161
|
+
throw new CircularDependencyException(moduleRef?.metatype.name);
|
|
161
162
|
}
|
|
162
163
|
if (!moduleRef) {
|
|
163
|
-
throw new
|
|
164
|
+
throw new UnknownModuleException();
|
|
164
165
|
}
|
|
165
166
|
const providerKey = moduleRef.addProvider(provider, enhancerSubtype);
|
|
166
167
|
const providerRef = moduleRef.getProviderByKey(providerKey);
|
|
167
|
-
|
|
168
|
+
DiscoverableMetaHostCollection.inspectProvider(this.modules, providerRef);
|
|
168
169
|
return providerKey;
|
|
169
170
|
}
|
|
170
171
|
addInjectable(injectable, token, enhancerSubtype, host) {
|
|
171
172
|
if (!this.modules.has(token)) {
|
|
172
|
-
throw new
|
|
173
|
+
throw new UnknownModuleException();
|
|
173
174
|
}
|
|
174
175
|
const moduleRef = this.modules.get(token);
|
|
175
176
|
return moduleRef.addInjectable(injectable, enhancerSubtype, host);
|
|
176
177
|
}
|
|
177
178
|
addExportedProviderOrModule(toExport, token) {
|
|
178
179
|
if (!this.modules.has(token)) {
|
|
179
|
-
throw new
|
|
180
|
+
throw new UnknownModuleException();
|
|
180
181
|
}
|
|
181
182
|
const moduleRef = this.modules.get(token);
|
|
182
183
|
moduleRef.addExportedProviderOrModule(toExport);
|
|
183
184
|
}
|
|
184
185
|
addController(controller, token) {
|
|
185
186
|
if (!this.modules.has(token)) {
|
|
186
|
-
throw new
|
|
187
|
+
throw new UnknownModuleException();
|
|
187
188
|
}
|
|
188
189
|
const moduleRef = this.modules.get(token);
|
|
189
190
|
moduleRef.addController(controller);
|
|
190
191
|
const controllerRef = moduleRef.controllers.get(controller);
|
|
191
|
-
|
|
192
|
+
DiscoverableMetaHostCollection.inspectController(this.modules, controllerRef);
|
|
192
193
|
}
|
|
193
194
|
clear() {
|
|
194
195
|
this.modules.clear();
|
|
@@ -214,20 +215,19 @@ class NestContainer {
|
|
|
214
215
|
}
|
|
215
216
|
registerCoreModuleRef(moduleRef) {
|
|
216
217
|
this.internalCoreModule = moduleRef;
|
|
217
|
-
this.modules[
|
|
218
|
+
this.modules[InternalCoreModule.name] = moduleRef;
|
|
218
219
|
}
|
|
219
220
|
getModuleTokenFactory() {
|
|
220
221
|
return this.moduleCompiler.moduleOpaqueKeyFactory;
|
|
221
222
|
}
|
|
222
223
|
registerRequestProvider(request, contextId) {
|
|
223
|
-
const wrapper = this.internalCoreModule.getProviderByKey(
|
|
224
|
+
const wrapper = this.internalCoreModule.getProviderByKey(REQUEST);
|
|
224
225
|
wrapper.setInstanceByContextId(contextId, {
|
|
225
226
|
instance: request,
|
|
226
227
|
isResolved: true,
|
|
227
228
|
});
|
|
228
229
|
}
|
|
229
230
|
shouldInitOnPreview(type) {
|
|
230
|
-
return
|
|
231
|
+
return InitializeOnPreviewAllowlist.has(type);
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
|
-
exports.NestContainer = NestContainer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isDebugMode(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClassProvider, FactoryProvider, Provider, ValueProvider } from '@nestjs/common';
|
|
1
|
+
import type { ClassProvider, FactoryProvider, Provider, ValueProvider } from '@nestjs/common';
|
|
2
2
|
export declare function isClassProvider<T = any>(provider: Provider): provider is ClassProvider<T>;
|
|
3
3
|
export declare function isValueProvider<T = any>(provider: Provider): provider is ValueProvider<T>;
|
|
4
4
|
export declare function isFactoryProvider<T = any>(provider: Provider): provider is FactoryProvider<T>;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.isClassProvider = isClassProvider;
|
|
4
|
-
exports.isValueProvider = isValueProvider;
|
|
5
|
-
exports.isFactoryProvider = isFactoryProvider;
|
|
6
|
-
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
7
|
-
function isClassProvider(provider) {
|
|
1
|
+
import { isUndefined } from '@nestjs/common/internal';
|
|
2
|
+
export function isClassProvider(provider) {
|
|
8
3
|
return Boolean(provider?.useClass);
|
|
9
4
|
}
|
|
10
|
-
function isValueProvider(provider) {
|
|
5
|
+
export function isValueProvider(provider) {
|
|
11
6
|
const providerValue = provider?.useValue;
|
|
12
|
-
return !
|
|
7
|
+
return !isUndefined(providerValue);
|
|
13
8
|
}
|
|
14
|
-
function isFactoryProvider(provider) {
|
|
9
|
+
export function isFactoryProvider(provider) {
|
|
15
10
|
return Boolean(provider.useFactory);
|
|
16
11
|
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SilentLogger = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
5
2
|
const noop = () => { };
|
|
6
|
-
class SilentLogger extends
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.fatal = noop;
|
|
15
|
-
this.setLogLevels = noop;
|
|
16
|
-
}
|
|
3
|
+
export class SilentLogger extends Logger {
|
|
4
|
+
log = noop;
|
|
5
|
+
error = noop;
|
|
6
|
+
warn = noop;
|
|
7
|
+
debug = noop;
|
|
8
|
+
verbose = noop;
|
|
9
|
+
fatal = noop;
|
|
10
|
+
setLogLevels = noop;
|
|
17
11
|
}
|
|
18
|
-
exports.SilentLogger = SilentLogger;
|
package/injector/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './container';
|
|
2
|
-
export * from './inquirer';
|
|
3
|
-
export { ContextId, HostComponentInfo } from './instance-wrapper';
|
|
4
|
-
export * from './lazy-module-loader/lazy-module-loader';
|
|
5
|
-
export * from './module-ref';
|
|
6
|
-
export * from './modules-container';
|
|
1
|
+
export * from './container.js';
|
|
2
|
+
export * from './inquirer/index.js';
|
|
3
|
+
export { ContextId, HostComponentInfo } from './instance-wrapper.js';
|
|
4
|
+
export * from './lazy-module-loader/lazy-module-loader.js';
|
|
5
|
+
export * from './module-ref.js';
|
|
6
|
+
export * from './modules-container.js';
|
package/injector/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tslib_1.__exportStar(require("./lazy-module-loader/lazy-module-loader"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./module-ref"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./modules-container"), exports);
|
|
1
|
+
export * from './container.js';
|
|
2
|
+
export * from './inquirer/index.js';
|
|
3
|
+
export * from './lazy-module-loader/lazy-module-loader.js';
|
|
4
|
+
export * from './module-ref.js';
|
|
5
|
+
export * from './modules-container.js';
|
package/injector/injector.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { ForwardReference, Type } from '@nestjs/common';
|
|
2
|
+
import { type InjectionToken } from '@nestjs/common';
|
|
3
|
+
import { type Controller, type Injectable } from '@nestjs/common/internal';
|
|
4
|
+
import { ContextId, InstancePerContext, InstanceWrapper, PropertyMetadata } from './instance-wrapper.js';
|
|
5
|
+
import { Module } from './module.js';
|
|
6
|
+
import { SettlementSignal } from './settlement-signal.js';
|
|
6
7
|
/**
|
|
7
8
|
* The type of an injectable dependency
|
|
8
9
|
*/
|
|
@@ -69,7 +70,7 @@ export declare class Injector {
|
|
|
69
70
|
loadInjectable<T = any>(wrapper: InstanceWrapper<T>, moduleRef: Module, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
|
70
71
|
loadProvider(wrapper: InstanceWrapper<Injectable>, moduleRef: Module, resolutionContext?: ResolutionContext): Promise<void>;
|
|
71
72
|
applySettlementSignal<T>(instancePerContext: InstancePerContext<T>, host: InstanceWrapper<T>): SettlementSignal;
|
|
72
|
-
resolveConstructorParams<T>(wrapper: InstanceWrapper<T>, moduleRef: Module, inject: InjectorDependency[] | undefined, callback: (args: unknown[]) => void | Promise<void>, resolutionContext?: ResolutionContext, parentInquirer?: InstanceWrapper): Promise<void>;
|
|
73
|
+
resolveConstructorParams<T>(wrapper: InstanceWrapper<T>, moduleRef: Module, inject: InjectorDependency[] | undefined, callback: (args: unknown[], depth?: number) => void | Promise<void>, resolutionContext?: ResolutionContext, parentInquirer?: InstanceWrapper): Promise<void>;
|
|
73
74
|
getClassDependencies<T>(wrapper: InstanceWrapper<T>): [InjectorDependency[], number[]];
|
|
74
75
|
getFactoryProviderDependencies<T>(wrapper: InstanceWrapper<T>): [InjectorDependency[], number[]];
|
|
75
76
|
reflectConstructorParams(type: Type<unknown> | Function): any[];
|
|
@@ -115,7 +116,6 @@ export declare class Injector {
|
|
|
115
116
|
private printResolvingDependenciesLog;
|
|
116
117
|
private printLookingForProviderLog;
|
|
117
118
|
private printFoundInModuleLog;
|
|
118
|
-
private isDebugMode;
|
|
119
119
|
private getContextId;
|
|
120
120
|
private getNowTimestamp;
|
|
121
121
|
}
|