@venok/core 1.0.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/application/config.d.ts +35 -0
- package/application/config.js +85 -0
- package/application/context.d.ts +198 -0
- package/application/context.js +325 -0
- package/application/factory.d.ts +43 -0
- package/application/factory.js +147 -0
- package/constants.d.ts +46 -0
- package/constants.js +53 -0
- package/context/creator.d.ts +9 -0
- package/context/creator.js +32 -0
- package/context/execution-host.d.ts +16 -0
- package/context/execution-host.js +30 -0
- package/context/external/creator.d.ts +63 -0
- package/context/external/creator.js +159 -0
- package/context/external/proxy.d.ts +5 -0
- package/context/external/proxy.js +19 -0
- package/decorators/apply.decorator.d.ts +10 -0
- package/decorators/apply.decorator.js +24 -0
- package/decorators/bind.decorator.d.ts +11 -0
- package/decorators/bind.decorator.js +20 -0
- package/decorators/catch.decorator.d.ts +17 -0
- package/decorators/catch.decorator.js +26 -0
- package/decorators/create-param.decorator.d.ts +29 -0
- package/decorators/create-param.decorator.js +51 -0
- package/decorators/dependencies.decorator.d.ts +6 -0
- package/decorators/dependencies.decorator.js +17 -0
- package/decorators/exception-filters.decorator.d.ts +21 -0
- package/decorators/exception-filters.decorator.js +41 -0
- package/decorators/global.decorator.d.ts +10 -0
- package/decorators/global.decorator.js +19 -0
- package/decorators/index.d.ts +15 -0
- package/decorators/index.js +31 -0
- package/decorators/inject.decorator.d.ts +26 -0
- package/decorators/inject.decorator.js +45 -0
- package/decorators/injectable.decorator.d.ts +40 -0
- package/decorators/injectable.decorator.js +51 -0
- package/decorators/module.decorator.d.ts +14 -0
- package/decorators/module.decorator.js +38 -0
- package/decorators/optional.decorator.d.ts +14 -0
- package/decorators/optional.decorator.js +30 -0
- package/decorators/set-metadata.decorator.d.ts +18 -0
- package/decorators/set-metadata.decorator.js +30 -0
- package/decorators/use-guards.decorator.d.ts +21 -0
- package/decorators/use-guards.decorator.js +40 -0
- package/decorators/use-interceptors.decorator.d.ts +21 -0
- package/decorators/use-interceptors.decorator.js +40 -0
- package/decorators/use-pipes.decorator.d.ts +21 -0
- package/decorators/use-pipes.decorator.js +39 -0
- package/discovery/meta-host-collection.d.ts +32 -0
- package/discovery/meta-host-collection.js +79 -0
- package/discovery/module.d.ts +5 -0
- package/discovery/module.js +24 -0
- package/discovery/service.d.ts +68 -0
- package/discovery/service.js +90 -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 +24 -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 +14 -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-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 +12 -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/messages.d.ts +15 -0
- package/errors/messages.js +126 -0
- package/exceptions/external/filter-context.d.ts +10 -0
- package/exceptions/external/filter-context.js +37 -0
- package/exceptions/external/filter.d.ts +5 -0
- package/exceptions/external/filter.js +16 -0
- package/exceptions/external/handler.d.ts +9 -0
- package/exceptions/external/handler.js +31 -0
- package/exceptions/filter-context.d.ts +14 -0
- package/exceptions/filter-context.js +55 -0
- package/exceptions/select-exception-filter-metadata.d.ts +2 -0
- package/exceptions/select-exception-filter-metadata.js +6 -0
- package/exceptions/zone/handler.d.ts +5 -0
- package/exceptions/zone/handler.js +15 -0
- package/exceptions/zone/zone.d.ts +5 -0
- package/exceptions/zone/zone.js +32 -0
- package/guards/consumer.d.ts +9 -0
- package/guards/consumer.js +33 -0
- package/guards/context-creator.d.ts +17 -0
- package/guards/context-creator.js +69 -0
- package/guards/index.d.ts +2 -0
- package/guards/index.js +18 -0
- package/helpers/color.helper.d.ts +9 -0
- package/helpers/color.helper.js +14 -0
- package/helpers/context-id-factory.helper.d.ts +2 -0
- package/helpers/context-id-factory.helper.js +15 -0
- package/helpers/context.helper.d.ts +23 -0
- package/helpers/context.helper.js +49 -0
- package/helpers/extends-metadata.helper.d.ts +1 -0
- package/helpers/extends-metadata.helper.js +9 -0
- package/helpers/flatten.helper.d.ts +1 -0
- package/helpers/flatten.helper.js +9 -0
- package/helpers/messages.helper.d.ts +2 -0
- package/helpers/messages.helper.js +7 -0
- package/helpers/noop.helper.d.ts +1 -0
- package/helpers/noop.helper.js +5 -0
- package/helpers/random-string-generator.helper.d.ts +1 -0
- package/helpers/random-string-generator.helper.js +6 -0
- package/helpers/rethrow.helper.d.ts +1 -0
- package/helpers/rethrow.helper.js +7 -0
- package/helpers/shared.helper.d.ts +10 -0
- package/helpers/shared.helper.js +33 -0
- package/helpers/silent.helper.d.ts +10 -0
- package/helpers/silent.helper.js +18 -0
- package/helpers/transient.helper.d.ts +12 -0
- package/helpers/transient.helper.js +26 -0
- package/helpers/uuid.helper.d.ts +15 -0
- package/helpers/uuid.helper.js +54 -0
- package/helpers/validate-each.helper.d.ts +8 -0
- package/helpers/validate-each.helper.js +25 -0
- package/hooks/before-app-shutdown.hook.d.ts +9 -0
- package/hooks/before-app-shutdown.hook.js +45 -0
- package/hooks/index.d.ts +5 -0
- package/hooks/index.js +21 -0
- package/hooks/on-app-bootstrap.hook.d.ts +8 -0
- package/hooks/on-app-bootstrap.hook.js +45 -0
- package/hooks/on-app-shutdown.hook.d.ts +9 -0
- package/hooks/on-app-shutdown.hook.js +46 -0
- package/hooks/on-module-destroy.hook.d.ts +8 -0
- package/hooks/on-module-destroy.hook.js +45 -0
- package/hooks/on-module-init.hook.d.ts +8 -0
- package/hooks/on-module-init.hook.js +45 -0
- package/index.d.ts +10 -0
- package/index.js +32 -0
- package/injector/constants.d.ts +2 -0
- package/injector/constants.js +7 -0
- package/injector/container.d.ts +61 -0
- package/injector/container.js +194 -0
- package/injector/helpers/class-scope.helper.d.ts +2 -0
- package/injector/helpers/class-scope.helper.js +9 -0
- package/injector/helpers/classifier.helper.d.ts +4 -0
- package/injector/helpers/classifier.helper.js +17 -0
- package/injector/helpers/is-durable.helper.d.ts +2 -0
- package/injector/helpers/is-durable.helper.js +9 -0
- package/injector/index.d.ts +5 -0
- package/injector/index.js +20 -0
- package/injector/injector.d.ts +87 -0
- package/injector/injector.js +452 -0
- package/injector/instance/links-host.d.ts +22 -0
- package/injector/instance/links-host.js +50 -0
- package/injector/instance/loader.d.ts +21 -0
- package/injector/instance/loader.js +73 -0
- package/injector/instance/resolver.d.ts +16 -0
- package/injector/instance/resolver.js +43 -0
- package/injector/instance/wrapper.d.ts +90 -0
- package/injector/instance/wrapper.js +272 -0
- package/injector/internal-core-module/core-providers.d.ts +4 -0
- package/injector/internal-core-module/core-providers.js +21 -0
- package/injector/internal-core-module/internal-core-module-factory.d.ts +8 -0
- package/injector/internal-core-module/internal-core-module-factory.js +42 -0
- package/injector/internal-core-module/internal-core-module.d.ts +4 -0
- package/injector/internal-core-module/internal-core-module.js +31 -0
- package/injector/module/compiler.d.ts +19 -0
- package/injector/module/compiler.js +27 -0
- package/injector/module/container.d.ts +6 -0
- package/injector/module/container.js +24 -0
- package/injector/module/lazy/loader.d.ts +21 -0
- package/injector/module/lazy/loader.js +49 -0
- package/injector/module/lazy/options.d.ts +6 -0
- package/injector/module/lazy/options.js +2 -0
- package/injector/module/module.d.ts +74 -0
- package/injector/module/module.js +383 -0
- package/injector/module/ref.d.ts +106 -0
- package/injector/module/ref.js +62 -0
- package/injector/module/token-factory.d.ts +13 -0
- package/injector/module/token-factory.js +71 -0
- package/injector/settlement-signal.d.ts +37 -0
- package/injector/settlement-signal.js +55 -0
- package/inspector/graph-inspector.d.ts +26 -0
- package/inspector/graph-inspector.js +163 -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 +10 -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 +49 -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 +121 -0
- package/interceptors/consumer.d.ts +9 -0
- package/interceptors/consumer.js +37 -0
- package/interceptors/context-creator.d.ts +17 -0
- package/interceptors/context-creator.js +67 -0
- package/interceptors/index.d.ts +2 -0
- package/interceptors/index.js +18 -0
- package/interfaces/abstract.interface.d.ts +3 -0
- package/interfaces/abstract.interface.js +2 -0
- package/interfaces/application/context-options.interface.d.ts +41 -0
- package/interfaces/application/context-options.interface.js +9 -0
- package/interfaces/application/context.interface.d.ts +162 -0
- package/interfaces/application/context.interface.js +2 -0
- package/interfaces/application/index.d.ts +1 -0
- package/interfaces/application/index.js +17 -0
- package/interfaces/context/arguments-host.interface.d.ts +22 -0
- package/interfaces/context/arguments-host.interface.js +2 -0
- package/interfaces/context/execution.interface.d.ts +18 -0
- package/interfaces/context/execution.interface.js +2 -0
- package/interfaces/features/exception-filter.interface.d.ts +21 -0
- package/interfaces/features/exception-filter.interface.js +2 -0
- package/interfaces/features/guards.interface.d.ts +20 -0
- package/interfaces/features/guards.interface.js +2 -0
- package/interfaces/features/interceptor.interface.d.ts +30 -0
- package/interfaces/features/interceptor.interface.js +2 -0
- package/interfaces/features/pipes.interface.d.ts +37 -0
- package/interfaces/features/pipes.interface.js +2 -0
- package/interfaces/helper.interface.d.ts +3 -0
- package/interfaces/helper.interface.js +2 -0
- package/interfaces/hooks/before-application-shutdown.interface.d.ts +3 -0
- package/interfaces/hooks/before-application-shutdown.interface.js +2 -0
- package/interfaces/hooks/index.d.ts +5 -0
- package/interfaces/hooks/index.js +21 -0
- package/interfaces/hooks/on-application-bootstrap.interface.d.ts +9 -0
- package/interfaces/hooks/on-application-bootstrap.interface.js +2 -0
- package/interfaces/hooks/on-application-shutdown.interface.d.ts +9 -0
- package/interfaces/hooks/on-application-shutdown.interface.js +2 -0
- package/interfaces/hooks/on-destroy.interface.d.ts +10 -0
- package/interfaces/hooks/on-destroy.interface.js +2 -0
- package/interfaces/hooks/on-init.interface.d.ts +8 -0
- package/interfaces/hooks/on-init.interface.js +2 -0
- package/interfaces/index.d.ts +6 -0
- package/interfaces/index.js +22 -0
- package/interfaces/injectable.interface.d.ts +1 -0
- package/interfaces/injectable.interface.js +2 -0
- package/interfaces/modules/configurable/async-options.interface.d.ts +42 -0
- package/interfaces/modules/configurable/async-options.interface.js +2 -0
- package/interfaces/modules/configurable/cls.interface.d.ts +13 -0
- package/interfaces/modules/configurable/cls.interface.js +2 -0
- package/interfaces/modules/configurable/host.interface.d.ts +62 -0
- package/interfaces/modules/configurable/host.interface.js +2 -0
- package/interfaces/modules/configurable/index.d.ts +3 -0
- package/interfaces/modules/configurable/index.js +19 -0
- package/interfaces/modules/definition.interface.d.ts +4 -0
- package/interfaces/modules/definition.interface.js +2 -0
- package/interfaces/modules/dynamic-module.interface.d.ts +23 -0
- package/interfaces/modules/dynamic-module.interface.js +2 -0
- package/interfaces/modules/forward-reference.interface.d.ts +3 -0
- package/interfaces/modules/forward-reference.interface.js +2 -0
- package/interfaces/modules/index.d.ts +9 -0
- package/interfaces/modules/index.js +25 -0
- package/interfaces/modules/injection-token.interface.d.ts +5 -0
- package/interfaces/modules/injection-token.interface.js +2 -0
- package/interfaces/modules/introspection-result.interface.d.ts +10 -0
- package/interfaces/modules/introspection-result.interface.js +2 -0
- package/interfaces/modules/module-metadata.interface.d.ts +24 -0
- package/interfaces/modules/module-metadata.interface.js +2 -0
- package/interfaces/modules/module.interface.d.ts +2 -0
- package/interfaces/modules/module.interface.js +2 -0
- package/interfaces/modules/optional-factory-dependency.interface.d.ts +8 -0
- package/interfaces/modules/optional-factory-dependency.interface.js +2 -0
- package/interfaces/modules/override.interface.d.ts +5 -0
- package/interfaces/modules/override.interface.js +2 -0
- package/interfaces/modules/provider.interface.d.ts +142 -0
- package/interfaces/modules/provider.interface.js +2 -0
- package/interfaces/scope.interface.d.ts +35 -0
- package/interfaces/scope.interface.js +23 -0
- package/interfaces/type.interface.d.ts +3 -0
- package/interfaces/type.interface.js +2 -0
- package/metadata-scanner.d.ts +4 -0
- package/metadata-scanner.js +34 -0
- package/module/configurable-module.builder.d.ts +93 -0
- package/module/configurable-module.builder.js +204 -0
- package/module/constants.d.ts +4 -0
- package/module/constants.js +7 -0
- package/module/helpers/generate-options-injection-token.helper.d.ts +1 -0
- package/module/helpers/generate-options-injection-token.helper.js +9 -0
- package/module/helpers/get-injection-providers.helper.d.ts +8 -0
- package/module/helpers/get-injection-providers.helper.js +36 -0
- package/module/helpers/index.d.ts +2 -0
- package/module/helpers/index.js +18 -0
- package/module/index.d.ts +2 -0
- package/module/index.js +18 -0
- package/package.json +35 -0
- package/pipes/consumer.d.ts +9 -0
- package/pipes/consumer.js +15 -0
- package/pipes/context-creator.d.ts +18 -0
- package/pipes/context-creator.js +70 -0
- package/pipes/index.d.ts +2 -0
- package/pipes/index.js +18 -0
- package/scanner.d.ts +81 -0
- package/scanner.js +374 -0
- package/services/console.service.d.ts +86 -0
- package/services/console.service.js +233 -0
- package/services/index.d.ts +1 -0
- package/services/index.js +17 -0
- package/services/logger.service.d.ts +157 -0
- package/services/logger.service.js +269 -0
- package/services/reflector.service.d.ts +110 -0
- package/services/reflector.service.js +87 -0
- package/test/context/execution-host.spec.d.ts +1 -0
- package/test/context/execution-host.spec.js +31 -0
- package/test/context/external/creator.spec.d.ts +1 -0
- package/test/context/external/creator.spec.js +149 -0
- package/test/context/external/proxy.spec.d.ts +1 -0
- package/test/context/external/proxy.spec.js +45 -0
- package/test/exceptions/external/handler.spec.d.ts +1 -0
- package/test/exceptions/external/handler.spec.js +89 -0
- package/test/exceptions/filter-context.spec.d.ts +2 -0
- package/test/exceptions/filter-context.spec.js +91 -0
- package/test/exceptions/messages.spec.d.ts +0 -0
- package/test/exceptions/messages.spec.js +201 -0
- package/test/exceptions/zona/handler.spec.d.ts +1 -0
- package/test/exceptions/zona/handler.spec.js +51 -0
- package/test/exceptions/zona/zone.spec.d.ts +1 -0
- package/test/exceptions/zona/zone.spec.js +66 -0
- package/test/guards/consumer.spec.d.ts +1 -0
- package/test/guards/consumer.spec.js +47 -0
- package/test/guards/context-creator.spec.d.ts +1 -0
- package/test/guards/context-creator.spec.js +138 -0
- package/test/helpers/context-id-factory.spec.d.ts +1 -0
- package/test/helpers/context-id-factory.spec.js +9 -0
- package/test/helpers/shared.spec.d.ts +1 -0
- package/test/helpers/shared.spec.js +122 -0
- package/test/hooks/before-app-shutdown.hook.spec.d.ts +1 -0
- package/test/hooks/before-app-shutdown.hook.spec.js +44 -0
- package/test/hooks/on-app-bootstrap.hook.spec.d.ts +1 -0
- package/test/hooks/on-app-bootstrap.hook.spec.js +43 -0
- package/test/hooks/on-app-shutdown.hook.spec.d.ts +1 -0
- package/test/hooks/on-app-shutdown.hook.spec.js +43 -0
- package/test/hooks/on-module-destroy.hook.spec.d.ts +1 -0
- package/test/hooks/on-module-destroy.hook.spec.js +43 -0
- package/test/hooks/on-module-init.hook.spec.d.ts +1 -0
- package/test/hooks/on-module-init.hook.spec.js +43 -0
- package/test/injector/compiler.spec.d.ts +1 -0
- package/test/injector/compiler.spec.js +42 -0
- package/test/injector/container.spec.d.ts +1 -0
- package/test/injector/container.spec.js +203 -0
- package/test/injector/helpers/classifier.spec.d.ts +1 -0
- package/test/injector/helpers/classifier.spec.js +102 -0
- package/test/injector/injector.spec.d.ts +1 -0
- package/test/injector/injector.spec.js +678 -0
- package/test/injector/instance/loader.spec.d.ts +1 -0
- package/test/injector/instance/loader.spec.js +108 -0
- package/test/injector/instance/wrapper.spec.d.ts +1 -0
- package/test/injector/instance/wrapper.spec.js +772 -0
- package/test/injector/internal-core-module/internal-core-module-factory.spec.d.ts +1 -0
- package/test/injector/internal-core-module/internal-core-module-factory.spec.js +27 -0
- package/test/injector/module/lazy/loader.spec.d.ts +1 -0
- package/test/injector/module/lazy/loader.spec.js +71 -0
- package/test/injector/module/module.spec.d.ts +1 -0
- package/test/injector/module/module.spec.js +410 -0
- package/test/injector/module/token-factory.spec.d.ts +1 -0
- package/test/injector/module/token-factory.spec.js +84 -0
- package/test/interceptors/consumer.spec.d.ts +1 -0
- package/test/interceptors/consumer.spec.js +136 -0
- package/test/interceptors/context-creator.spec.d.ts +1 -0
- package/test/interceptors/context-creator.spec.js +139 -0
- package/test/metadata-scanner.spec.d.ts +1 -0
- package/test/metadata-scanner.spec.js +41 -0
- package/test/module/configurable-module.builder.spec.d.ts +1 -0
- package/test/module/configurable-module.builder.spec.js +102 -0
- package/test/module/helpers/get-injection-providers.helper.spec.d.ts +1 -0
- package/test/module/helpers/get-injection-providers.helper.spec.js +49 -0
- package/test/pipes/consumer.spec.d.ts +1 -0
- package/test/pipes/consumer.spec.js +42 -0
- package/test/pipes/context-creator.spec.d.ts +1 -0
- package/test/pipes/context-creator.spec.js +108 -0
- package/test/scanner.spec.d.ts +1 -0
- package/test/scanner.spec.js +620 -0
- package/test/services/logger.service.spec.d.ts +1 -0
- package/test/services/logger.service.spec.js +487 -0
- package/test/services/reflector.service.spec.d.ts +1 -0
- package/test/services/reflector.service.spec.js +105 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModuleRef = void 0;
|
|
4
|
+
const injector_1 = require("@venok/core/injector/injector");
|
|
5
|
+
const interfaces_1 = require("@venok/core/interfaces");
|
|
6
|
+
const wrapper_1 = require("@venok/core/injector/instance/wrapper");
|
|
7
|
+
const resolver_1 = require("@venok/core/injector/instance/resolver");
|
|
8
|
+
const links_host_1 = require("@venok/core/injector/instance/links-host");
|
|
9
|
+
const class_scope_helper_1 = require("@venok/core/injector/helpers/class-scope.helper");
|
|
10
|
+
const is_durable_helper_1 = require("@venok/core/injector/helpers/is-durable.helper");
|
|
11
|
+
class ModuleRef extends resolver_1.AbstractInstanceResolver {
|
|
12
|
+
get instanceLinksHost() {
|
|
13
|
+
if (!this._instanceLinksHost) {
|
|
14
|
+
this._instanceLinksHost = new links_host_1.InstanceLinksHost(this.container);
|
|
15
|
+
}
|
|
16
|
+
return this._instanceLinksHost;
|
|
17
|
+
}
|
|
18
|
+
constructor(container) {
|
|
19
|
+
super();
|
|
20
|
+
this.container = container;
|
|
21
|
+
this.injector = new injector_1.Injector();
|
|
22
|
+
}
|
|
23
|
+
introspect(token) {
|
|
24
|
+
const { wrapperRef } = this.instanceLinksHost.get(token);
|
|
25
|
+
let scope = interfaces_1.Scope.DEFAULT;
|
|
26
|
+
if (!wrapperRef.isDependencyTreeStatic()) {
|
|
27
|
+
scope = interfaces_1.Scope.REQUEST;
|
|
28
|
+
}
|
|
29
|
+
else if (wrapperRef.isTransient) {
|
|
30
|
+
scope = interfaces_1.Scope.TRANSIENT;
|
|
31
|
+
}
|
|
32
|
+
return { scope };
|
|
33
|
+
}
|
|
34
|
+
// public registerRequestByContextId<T = any>(request: T, contextId: ContextId) {
|
|
35
|
+
// this.container.registerRequestProvider(request, contextId);
|
|
36
|
+
// }
|
|
37
|
+
async instantiateClass(type, moduleRef, contextId) {
|
|
38
|
+
const wrapper = new wrapper_1.InstanceWrapper({
|
|
39
|
+
name: type && type.name,
|
|
40
|
+
metatype: type,
|
|
41
|
+
isResolved: false,
|
|
42
|
+
scope: (0, class_scope_helper_1.getClassScope)(type),
|
|
43
|
+
durable: (0, is_durable_helper_1.isDurable)(type),
|
|
44
|
+
host: moduleRef,
|
|
45
|
+
});
|
|
46
|
+
return new Promise(async (resolve, reject) => {
|
|
47
|
+
try {
|
|
48
|
+
const callback = async (instances) => {
|
|
49
|
+
const properties = await this.injector.resolveProperties(wrapper, moduleRef, undefined, contextId);
|
|
50
|
+
const instance = new type(...instances);
|
|
51
|
+
this.injector.applyProperties(instance, properties);
|
|
52
|
+
resolve(instance);
|
|
53
|
+
};
|
|
54
|
+
await this.injector.resolveConstructorParams(wrapper, moduleRef, null, callback, contextId);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
reject(err);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ModuleRef = ModuleRef;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Type } from "@venok/core/interfaces";
|
|
2
|
+
import { DynamicModule } from "@venok/core/interfaces/modules";
|
|
3
|
+
export declare class TokenFactory {
|
|
4
|
+
private readonly moduleTokenCache;
|
|
5
|
+
private readonly moduleIdsCache;
|
|
6
|
+
create(metatype: Type<unknown>, dynamicModuleMetadata?: Partial<DynamicModule> | undefined): string;
|
|
7
|
+
getStaticModuleToken(moduleId: string, moduleName: string): string;
|
|
8
|
+
getStringifiedOpaqueToken(opaqueToken: object | undefined): string;
|
|
9
|
+
getModuleId(metatype: Type<unknown>): string;
|
|
10
|
+
getModuleName(metatype: Type<any>): string;
|
|
11
|
+
private hashString;
|
|
12
|
+
private replacer;
|
|
13
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TokenFactory = void 0;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const fast_safe_stringify_1 = __importDefault(require("fast-safe-stringify"));
|
|
9
|
+
const random_string_generator_helper_1 = require("@venok/core/helpers/random-string-generator.helper");
|
|
10
|
+
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
11
|
+
const CLASS_STR = "class ";
|
|
12
|
+
const CLASS_STR_LEN = CLASS_STR.length;
|
|
13
|
+
class TokenFactory {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.moduleTokenCache = new Map();
|
|
16
|
+
this.moduleIdsCache = new WeakMap();
|
|
17
|
+
}
|
|
18
|
+
create(metatype, dynamicModuleMetadata) {
|
|
19
|
+
const moduleId = this.getModuleId(metatype);
|
|
20
|
+
if (!dynamicModuleMetadata)
|
|
21
|
+
return this.getStaticModuleToken(moduleId, this.getModuleName(metatype));
|
|
22
|
+
const opaqueToken = {
|
|
23
|
+
id: moduleId,
|
|
24
|
+
module: this.getModuleName(metatype),
|
|
25
|
+
dynamic: dynamicModuleMetadata,
|
|
26
|
+
};
|
|
27
|
+
const opaqueTokenString = this.getStringifiedOpaqueToken(opaqueToken);
|
|
28
|
+
return this.hashString(opaqueTokenString);
|
|
29
|
+
}
|
|
30
|
+
getStaticModuleToken(moduleId, moduleName) {
|
|
31
|
+
const key = `${moduleId}_${moduleName}`;
|
|
32
|
+
if (this.moduleTokenCache.has(key))
|
|
33
|
+
return this.moduleTokenCache.get(key);
|
|
34
|
+
const hash = this.hashString(key);
|
|
35
|
+
this.moduleTokenCache.set(key, hash);
|
|
36
|
+
return hash;
|
|
37
|
+
}
|
|
38
|
+
getStringifiedOpaqueToken(opaqueToken) {
|
|
39
|
+
// Uses safeStringify instead of JSON.stringify to support circular dynamic modules
|
|
40
|
+
// The replacer function is also required in order to obtain real class names
|
|
41
|
+
// instead of the unified "Function" key
|
|
42
|
+
return opaqueToken ? (0, fast_safe_stringify_1.default)(opaqueToken, this.replacer) : "";
|
|
43
|
+
}
|
|
44
|
+
getModuleId(metatype) {
|
|
45
|
+
let moduleId = this.moduleIdsCache.get(metatype);
|
|
46
|
+
if (moduleId)
|
|
47
|
+
return moduleId;
|
|
48
|
+
moduleId = (0, random_string_generator_helper_1.randomStringGenerator)();
|
|
49
|
+
this.moduleIdsCache.set(metatype, moduleId);
|
|
50
|
+
return moduleId;
|
|
51
|
+
}
|
|
52
|
+
getModuleName(metatype) {
|
|
53
|
+
return metatype.name;
|
|
54
|
+
}
|
|
55
|
+
hashString(value) {
|
|
56
|
+
return (0, crypto_1.createHash)("sha256").update(value).digest("hex");
|
|
57
|
+
}
|
|
58
|
+
replacer(key, value) {
|
|
59
|
+
if ((0, shared_helper_1.isFunction)(value)) {
|
|
60
|
+
const funcAsString = value.toString();
|
|
61
|
+
const isClass = funcAsString.slice(0, CLASS_STR_LEN) === CLASS_STR;
|
|
62
|
+
if (isClass)
|
|
63
|
+
return value.name;
|
|
64
|
+
return funcAsString;
|
|
65
|
+
}
|
|
66
|
+
if ((0, shared_helper_1.isSymbol)(value))
|
|
67
|
+
return value.toString();
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.TokenFactory = TokenFactory;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SettlementSignal is used to signal the resolution of a provider/instance.
|
|
3
|
+
* Calling `complete` or `error` will resolve the promise returned by `asPromise`.
|
|
4
|
+
* Can be used to detect circular dependencies.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SettlementSignal {
|
|
7
|
+
private readonly _refs;
|
|
8
|
+
private readonly settledPromise;
|
|
9
|
+
private settleFn;
|
|
10
|
+
private completed;
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Resolves the promise returned by `asPromise`.
|
|
14
|
+
*/
|
|
15
|
+
complete(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Rejects the promise returned by `asPromise` with the given error.
|
|
18
|
+
* @param err Error to reject the promise returned by `asPromise` with.
|
|
19
|
+
*/
|
|
20
|
+
error(err: unknown): void;
|
|
21
|
+
/**
|
|
22
|
+
* Returns a promise that will be resolved when `complete` or `error` is called.
|
|
23
|
+
* @returns Promise that will be resolved when `complete` or `error` is called.
|
|
24
|
+
*/
|
|
25
|
+
asPromise(): Promise<unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Inserts a wrapper id that the host of this signal depends on.
|
|
28
|
+
* @param wrapperId Wrapper id to insert.
|
|
29
|
+
*/
|
|
30
|
+
insertRef(wrapperId: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Check if relationship is circular.
|
|
33
|
+
* @param wrapperId Wrapper id to check.
|
|
34
|
+
* @returns True if relationship is circular, false otherwise.
|
|
35
|
+
*/
|
|
36
|
+
isCycle(wrapperId: string): boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettlementSignal = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* SettlementSignal is used to signal the resolution of a provider/instance.
|
|
6
|
+
* Calling `complete` or `error` will resolve the promise returned by `asPromise`.
|
|
7
|
+
* Can be used to detect circular dependencies.
|
|
8
|
+
*/
|
|
9
|
+
class SettlementSignal {
|
|
10
|
+
constructor() {
|
|
11
|
+
this._refs = new Set();
|
|
12
|
+
this.completed = false;
|
|
13
|
+
this.settledPromise = new Promise((resolve) => {
|
|
14
|
+
this.settleFn = resolve;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the promise returned by `asPromise`.
|
|
19
|
+
*/
|
|
20
|
+
complete() {
|
|
21
|
+
this.completed = true;
|
|
22
|
+
this.settleFn();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Rejects the promise returned by `asPromise` with the given error.
|
|
26
|
+
* @param err Error to reject the promise returned by `asPromise` with.
|
|
27
|
+
*/
|
|
28
|
+
error(err) {
|
|
29
|
+
this.completed = true;
|
|
30
|
+
this.settleFn(err);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns a promise that will be resolved when `complete` or `error` is called.
|
|
34
|
+
* @returns Promise that will be resolved when `complete` or `error` is called.
|
|
35
|
+
*/
|
|
36
|
+
asPromise() {
|
|
37
|
+
return this.settledPromise;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Inserts a wrapper id that the host of this signal depends on.
|
|
41
|
+
* @param wrapperId Wrapper id to insert.
|
|
42
|
+
*/
|
|
43
|
+
insertRef(wrapperId) {
|
|
44
|
+
this._refs.add(wrapperId);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check if relationship is circular.
|
|
48
|
+
* @param wrapperId Wrapper id to check.
|
|
49
|
+
* @returns True if relationship is circular, false otherwise.
|
|
50
|
+
*/
|
|
51
|
+
isCycle(wrapperId) {
|
|
52
|
+
return !this.completed && this._refs.has(wrapperId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.SettlementSignal = SettlementSignal;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { VenokContainer } from "../injector/container";
|
|
2
|
+
import { Module } from "../injector/module/module";
|
|
3
|
+
import { EnhancerMetadataCacheEntry } from "./interfaces/enhancer-metadata-cache-entry.interface";
|
|
4
|
+
import { Entrypoint } from "./interfaces/entrypoint.interface";
|
|
5
|
+
import { OrphanedEnhancerDefinition } from "./interfaces/extras.interface";
|
|
6
|
+
import { Node } from "./interfaces/node.interface";
|
|
7
|
+
import { InstanceWrapper } from "@venok/core/injector/instance/wrapper";
|
|
8
|
+
export declare class GraphInspector {
|
|
9
|
+
private readonly container;
|
|
10
|
+
private readonly graph;
|
|
11
|
+
private readonly enhancersMetadataCache;
|
|
12
|
+
constructor(container: VenokContainer);
|
|
13
|
+
inspectModules(modules?: Map<string, Module>): void;
|
|
14
|
+
registerPartial(error: unknown): void;
|
|
15
|
+
inspectInstanceWrapper<T = any>(source: InstanceWrapper<T>, moduleRef: Module): void;
|
|
16
|
+
insertEnhancerMetadataCache(entry: EnhancerMetadataCacheEntry): void;
|
|
17
|
+
insertOrphanedEnhancer(entry: OrphanedEnhancerDefinition): void;
|
|
18
|
+
insertAttachedEnhancer(wrapper: InstanceWrapper): void;
|
|
19
|
+
insertEntrypointDefinition<T>(definition: Entrypoint<T>, parentId: string): void;
|
|
20
|
+
insertClassNode(moduleRef: Module, wrapper: InstanceWrapper, type: Exclude<Node["metadata"]["type"], "module">): void;
|
|
21
|
+
private insertModuleNode;
|
|
22
|
+
private insertModuleToModuleEdges;
|
|
23
|
+
private insertEnhancerEdge;
|
|
24
|
+
private insertClassToClassEdge;
|
|
25
|
+
private insertClassNodes;
|
|
26
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphInspector = void 0;
|
|
4
|
+
const unknown_dependencies_exception_1 = require("../errors/exceptions/unknown-dependencies.exception");
|
|
5
|
+
const partial_graph_host_1 = require("./partial-graph.host");
|
|
6
|
+
const uuid_helper_1 = require("@venok/core/helpers/uuid.helper");
|
|
7
|
+
class GraphInspector {
|
|
8
|
+
constructor(container) {
|
|
9
|
+
this.container = container;
|
|
10
|
+
this.enhancersMetadataCache = new Array();
|
|
11
|
+
this.graph = container.serializedGraph;
|
|
12
|
+
}
|
|
13
|
+
inspectModules(modules = this.container.getModules()) {
|
|
14
|
+
for (const moduleRef of modules.values()) {
|
|
15
|
+
this.insertModuleNode(moduleRef);
|
|
16
|
+
this.insertClassNodes(moduleRef);
|
|
17
|
+
this.insertModuleToModuleEdges(moduleRef);
|
|
18
|
+
}
|
|
19
|
+
this.enhancersMetadataCache.forEach((entry) => this.insertEnhancerEdge(entry));
|
|
20
|
+
uuid_helper_1.DeterministicUuidRegistry.clear();
|
|
21
|
+
}
|
|
22
|
+
registerPartial(error) {
|
|
23
|
+
this.graph.status = "partial";
|
|
24
|
+
if (error instanceof unknown_dependencies_exception_1.UnknownDependenciesException) {
|
|
25
|
+
this.graph.metadata = {
|
|
26
|
+
cause: {
|
|
27
|
+
type: "unknown-dependencies",
|
|
28
|
+
context: error.context,
|
|
29
|
+
moduleId: error.moduleRef?.id,
|
|
30
|
+
nodeId: error.metadata?.id,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.graph.metadata = {
|
|
36
|
+
cause: {
|
|
37
|
+
type: "unknown",
|
|
38
|
+
error,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
partial_graph_host_1.PartialGraphHost.register(this.graph);
|
|
43
|
+
}
|
|
44
|
+
inspectInstanceWrapper(source, moduleRef) {
|
|
45
|
+
const ctorMetadata = source.getCtorMetadata();
|
|
46
|
+
ctorMetadata?.forEach((target, index) => this.insertClassToClassEdge(source, target, moduleRef, index, "constructor"));
|
|
47
|
+
const propertiesMetadata = source.getPropertiesMetadata();
|
|
48
|
+
propertiesMetadata?.forEach(({ key, wrapper: target }) => this.insertClassToClassEdge(source, target, moduleRef, key, "property"));
|
|
49
|
+
}
|
|
50
|
+
insertEnhancerMetadataCache(entry) {
|
|
51
|
+
this.enhancersMetadataCache.push(entry);
|
|
52
|
+
}
|
|
53
|
+
insertOrphanedEnhancer(entry) {
|
|
54
|
+
this.graph.insertOrphanedEnhancer({
|
|
55
|
+
...entry,
|
|
56
|
+
ref: entry.ref?.constructor?.name ?? "Object",
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
insertAttachedEnhancer(wrapper) {
|
|
60
|
+
const existingNode = this.graph.getNodeById(wrapper.id);
|
|
61
|
+
existingNode.metadata.global = true;
|
|
62
|
+
this.graph.insertAttachedEnhancer(existingNode.id);
|
|
63
|
+
}
|
|
64
|
+
insertEntrypointDefinition(definition, parentId) {
|
|
65
|
+
definition = {
|
|
66
|
+
...definition,
|
|
67
|
+
id: `${definition.classNodeId}_${definition.methodName}`,
|
|
68
|
+
};
|
|
69
|
+
this.graph.insertEntrypoint(definition, parentId);
|
|
70
|
+
}
|
|
71
|
+
insertClassNode(moduleRef, wrapper, type) {
|
|
72
|
+
this.graph.insertNode({
|
|
73
|
+
id: wrapper.id,
|
|
74
|
+
label: wrapper.name,
|
|
75
|
+
parent: moduleRef.id,
|
|
76
|
+
metadata: {
|
|
77
|
+
type,
|
|
78
|
+
internal: wrapper.metatype === moduleRef.metatype,
|
|
79
|
+
sourceModuleName: moduleRef.name,
|
|
80
|
+
durable: wrapper.isDependencyTreeDurable(),
|
|
81
|
+
static: wrapper.isDependencyTreeStatic(),
|
|
82
|
+
scope: wrapper.scope,
|
|
83
|
+
transient: wrapper.isTransient,
|
|
84
|
+
exported: moduleRef.exports.has(wrapper.token),
|
|
85
|
+
token: wrapper.token,
|
|
86
|
+
subtype: wrapper.subtype,
|
|
87
|
+
initTime: wrapper.initTime ?? 0,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
insertModuleNode(moduleRef) {
|
|
92
|
+
const dynamicMetadata = this.container.getDynamicMetadataByToken(moduleRef.token);
|
|
93
|
+
const node = {
|
|
94
|
+
id: moduleRef.id,
|
|
95
|
+
label: moduleRef.name,
|
|
96
|
+
metadata: {
|
|
97
|
+
type: "module",
|
|
98
|
+
global: moduleRef.isGlobal,
|
|
99
|
+
dynamic: !!dynamicMetadata,
|
|
100
|
+
internal: moduleRef.name === "InternalCoreModule",
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
this.graph.insertNode(node);
|
|
104
|
+
}
|
|
105
|
+
insertModuleToModuleEdges(moduleRef) {
|
|
106
|
+
for (const targetModuleRef of moduleRef.imports) {
|
|
107
|
+
this.graph.insertEdge({
|
|
108
|
+
source: moduleRef.id,
|
|
109
|
+
target: targetModuleRef.id,
|
|
110
|
+
metadata: {
|
|
111
|
+
type: "module-to-module",
|
|
112
|
+
sourceModuleName: moduleRef.name,
|
|
113
|
+
targetModuleName: targetModuleRef.name,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
insertEnhancerEdge(entry) {
|
|
119
|
+
const moduleRef = this.container.getModuleByKey(entry.moduleToken);
|
|
120
|
+
const sourceInstanceWrapper = moduleRef.providers.get(entry.classRef);
|
|
121
|
+
const existingSourceNode = this.graph.getNodeById(sourceInstanceWrapper.id);
|
|
122
|
+
const enhancers = existingSourceNode.metadata.enhancers ?? [];
|
|
123
|
+
if (entry.enhancerInstanceWrapper) {
|
|
124
|
+
this.insertClassToClassEdge(sourceInstanceWrapper, entry.enhancerInstanceWrapper, moduleRef, undefined, "decorator");
|
|
125
|
+
enhancers.push({
|
|
126
|
+
id: entry.enhancerInstanceWrapper.id,
|
|
127
|
+
methodKey: entry.methodKey,
|
|
128
|
+
subtype: entry.subtype,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const name = entry.enhancerRef.constructor?.name ?? entry.enhancerRef.name;
|
|
133
|
+
enhancers.push({
|
|
134
|
+
name,
|
|
135
|
+
methodKey: entry.methodKey,
|
|
136
|
+
subtype: entry.subtype,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
existingSourceNode.metadata.enhancers = enhancers;
|
|
140
|
+
}
|
|
141
|
+
insertClassToClassEdge(source, target, moduleRef, keyOrIndex, injectionType) {
|
|
142
|
+
this.graph.insertEdge({
|
|
143
|
+
source: source.id,
|
|
144
|
+
target: target.id,
|
|
145
|
+
metadata: {
|
|
146
|
+
type: "class-to-class",
|
|
147
|
+
sourceModuleName: moduleRef.name,
|
|
148
|
+
sourceClassName: source.name,
|
|
149
|
+
targetClassName: target.name,
|
|
150
|
+
sourceClassToken: source.token,
|
|
151
|
+
targetClassToken: target.token,
|
|
152
|
+
targetModuleName: target.host?.name ?? "",
|
|
153
|
+
keyOrIndex,
|
|
154
|
+
injectionType,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
insertClassNodes(moduleRef) {
|
|
159
|
+
moduleRef.providers.forEach((value) => this.insertClassNode(moduleRef, value, "provider"));
|
|
160
|
+
moduleRef.injectables.forEach((value) => this.insertClassNode(moduleRef, value, "injectable"));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.GraphInspector = GraphInspector;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InitializeOnPreviewAllowlist = void 0;
|
|
4
|
+
class InitializeOnPreviewAllowlist {
|
|
5
|
+
static add(type) {
|
|
6
|
+
this.allowlist.set(type, true);
|
|
7
|
+
}
|
|
8
|
+
static has(type) {
|
|
9
|
+
return this.allowlist.has(type);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.InitializeOnPreviewAllowlist = InitializeOnPreviewAllowlist;
|
|
13
|
+
InitializeOnPreviewAllowlist.allowlist = new WeakMap();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { InjectionToken } from "@venok/core/interfaces/modules";
|
|
2
|
+
type CommonEdgeMetadata = {
|
|
3
|
+
sourceModuleName: string;
|
|
4
|
+
targetModuleName: string;
|
|
5
|
+
};
|
|
6
|
+
type ModuleToModuleEdgeMetadata = {
|
|
7
|
+
type: "module-to-module";
|
|
8
|
+
} & CommonEdgeMetadata;
|
|
9
|
+
type ClassToClassEdgeMetadata = {
|
|
10
|
+
type: "class-to-class";
|
|
11
|
+
sourceClassName: string;
|
|
12
|
+
targetClassName: string;
|
|
13
|
+
sourceClassToken: InjectionToken;
|
|
14
|
+
targetClassToken: InjectionToken;
|
|
15
|
+
injectionType: "constructor" | "property" | "decorator";
|
|
16
|
+
keyOrIndex?: string | number | symbol;
|
|
17
|
+
/**
|
|
18
|
+
* If true, indicates that this edge represents an internal providers connection
|
|
19
|
+
*/
|
|
20
|
+
internal?: boolean;
|
|
21
|
+
} & CommonEdgeMetadata;
|
|
22
|
+
export interface Edge {
|
|
23
|
+
id: string;
|
|
24
|
+
source: string;
|
|
25
|
+
target: string;
|
|
26
|
+
metadata: ModuleToModuleEdgeMetadata | ClassToClassEdgeMetadata;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InstanceWrapper } from "@venok/core/injector/instance/wrapper";
|
|
2
|
+
import { EnhancerSubtype } from "@venok/core/constants";
|
|
3
|
+
import { Type } from "@venok/core/interfaces";
|
|
4
|
+
export interface EnhancerMetadataCacheEntry {
|
|
5
|
+
targetNodeId?: string;
|
|
6
|
+
moduleToken: string;
|
|
7
|
+
classRef: Type;
|
|
8
|
+
methodKey: string | undefined;
|
|
9
|
+
enhancerRef?: unknown;
|
|
10
|
+
enhancerInstanceWrapper?: InstanceWrapper;
|
|
11
|
+
subtype: EnhancerSubtype;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EnhancerSubtype } from "@venok/core/constants";
|
|
2
|
+
/**
|
|
3
|
+
* Enhancers attached through APP_PIPE, APP_GUARD, APP_INTERCEPTOR, and APP_FILTER tokens.
|
|
4
|
+
*/
|
|
5
|
+
export interface AttachedEnhancerDefinition {
|
|
6
|
+
nodeId: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Enhancers registered through "app.useGlobalPipes()", "app.useGlobalGuards()", "app.useGlobalInterceptors()", and "app.useGlobalFilters()" methods.
|
|
10
|
+
*/
|
|
11
|
+
export interface OrphanedEnhancerDefinition {
|
|
12
|
+
subtype: EnhancerSubtype;
|
|
13
|
+
ref: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface Extras {
|
|
16
|
+
orphanedEnhancers: Array<OrphanedEnhancerDefinition>;
|
|
17
|
+
attachedEnhancers: Array<AttachedEnhancerDefinition>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EnhancerSubtype } from "@venok/core/constants";
|
|
2
|
+
import { Scope } from "@venok/core/interfaces";
|
|
3
|
+
import { InjectionToken } from "@venok/core/interfaces/modules";
|
|
4
|
+
export type ModuleNode = {
|
|
5
|
+
metadata: {
|
|
6
|
+
type: "module";
|
|
7
|
+
global: boolean;
|
|
8
|
+
dynamic: boolean;
|
|
9
|
+
internal: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type ClassNode = {
|
|
13
|
+
parent: string;
|
|
14
|
+
metadata: {
|
|
15
|
+
type: "provider" | "controller" | "middleware" | "injectable";
|
|
16
|
+
subtype?: EnhancerSubtype;
|
|
17
|
+
sourceModuleName: string;
|
|
18
|
+
durable: boolean;
|
|
19
|
+
static: boolean;
|
|
20
|
+
transient: boolean;
|
|
21
|
+
exported: boolean;
|
|
22
|
+
scope: Scope;
|
|
23
|
+
token: InjectionToken;
|
|
24
|
+
initTime: number;
|
|
25
|
+
/**
|
|
26
|
+
* Enhancers metadata collection
|
|
27
|
+
*/
|
|
28
|
+
enhancers?: Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
subtype: EnhancerSubtype;
|
|
31
|
+
} | {
|
|
32
|
+
name: string;
|
|
33
|
+
methodKey?: string;
|
|
34
|
+
subtype: EnhancerSubtype;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* If true, node is a globally registered enhancer
|
|
38
|
+
*/
|
|
39
|
+
global?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* If true, indicates that this node represents an internal provider
|
|
42
|
+
*/
|
|
43
|
+
internal?: boolean;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export type Node = {
|
|
47
|
+
id: string;
|
|
48
|
+
label: string;
|
|
49
|
+
} & (ClassNode | ModuleNode);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SerializedGraphStatus } from '../serialized-graph';
|
|
2
|
+
import { Edge } from './edge.interface';
|
|
3
|
+
import { Entrypoint } from './entrypoint.interface';
|
|
4
|
+
import { Extras } from './extras.interface';
|
|
5
|
+
import { Node } from './node.interface';
|
|
6
|
+
import { SerializedGraphMetadata } from './serialized-graph-metadata.interface';
|
|
7
|
+
export interface SerializedGraphJson {
|
|
8
|
+
nodes: Record<string, Node>;
|
|
9
|
+
edges: Record<string, Edge>;
|
|
10
|
+
entrypoints: Record<string, Entrypoint<unknown>[]>;
|
|
11
|
+
extras: Extras;
|
|
12
|
+
status?: SerializedGraphStatus;
|
|
13
|
+
metadata?: SerializedGraphMetadata;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InjectorDependencyContext } from '../../injector/injector';
|
|
2
|
+
export interface SerializedGraphMetadata {
|
|
3
|
+
cause: {
|
|
4
|
+
type: 'unknown-dependencies' | 'unknown';
|
|
5
|
+
context?: InjectorDependencyContext;
|
|
6
|
+
moduleId?: string;
|
|
7
|
+
nodeId?: string;
|
|
8
|
+
error?: any;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoopGraphInspector = void 0;
|
|
4
|
+
const graph_inspector_1 = require("./graph-inspector");
|
|
5
|
+
const noop_helper_1 = require("@venok/core/helpers/noop.helper");
|
|
6
|
+
exports.NoopGraphInspector = new Proxy(graph_inspector_1.GraphInspector.prototype, {
|
|
7
|
+
get: () => noop_helper_1.noop,
|
|
8
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SerializedGraph } from './serialized-graph';
|
|
2
|
+
export declare class PartialGraphHost {
|
|
3
|
+
private static partialGraph;
|
|
4
|
+
static toJSON(): import("./interfaces/serialized-graph-json.interface").SerializedGraphJson;
|
|
5
|
+
static toString(): string;
|
|
6
|
+
static register(partialGraph: SerializedGraph): void;
|
|
7
|
+
}
|