@venok/core 1.0.1-canary.5 → 2.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/dist/application/config.js +92 -0
- package/dist/application/context.js +252 -0
- package/dist/application/factory.js +136 -0
- package/dist/constants.js +100 -0
- package/dist/context/context-id.factory.js +58 -0
- package/dist/context/context.js +186 -0
- package/dist/context/creator.js +49 -0
- package/dist/context/execution-host.js +51 -0
- package/dist/context/proxy.js +55 -0
- package/dist/decorators/apply.decorator.js +33 -0
- package/dist/decorators/bind.decorator.js +28 -0
- package/dist/decorators/catch.decorator.js +29 -0
- package/dist/decorators/dependencies.decorator.js +30 -0
- package/dist/decorators/exception-filters.decorator.js +40 -0
- package/dist/decorators/global.decorator.js +28 -0
- package/dist/decorators/inject.decorator.js +42 -0
- package/dist/decorators/injectable.decorator.js +38 -0
- package/dist/decorators/module.decorator.js +42 -0
- package/dist/decorators/optional.decorator.js +35 -0
- package/dist/decorators/set-metadata.decorator.js +35 -0
- package/dist/decorators/use-guards.decorator.js +39 -0
- package/dist/decorators/use-interceptors.decorator.js +39 -0
- package/dist/decorators/use-pipes.decorator.js +38 -0
- package/dist/enums/scope.enum.js +28 -0
- package/dist/enums/shutdown-signal.enum.js +36 -0
- package/dist/errors/exceptions/circular-dependency.exception.js +30 -0
- package/dist/errors/exceptions/invalid-class-module.exception.js +30 -0
- package/dist/errors/exceptions/invalid-class-scope.exception.js +33 -0
- package/dist/errors/exceptions/invalid-class.exception.js +30 -0
- package/dist/errors/exceptions/invalid-exception-filter.exception.js +30 -0
- package/dist/errors/exceptions/invalid-module.exception.js +30 -0
- package/dist/errors/exceptions/runtime.exception.js +30 -0
- package/dist/errors/exceptions/undefined-dependency.exception.js +30 -0
- package/dist/errors/exceptions/undefined-forwardref.exception.js +30 -0
- package/dist/errors/exceptions/undefined-module.exception.js +30 -0
- package/dist/errors/exceptions/unknown-dependencies.exception.js +38 -0
- package/dist/errors/exceptions/unknown-element.exception.js +31 -0
- package/dist/errors/exceptions/unknown-export.exception.js +30 -0
- package/dist/errors/exceptions/unknown-module.exception.js +29 -0
- package/dist/errors/messages.js +134 -0
- package/dist/exceptions/handler.js +53 -0
- package/dist/exceptions/zone/handler.js +30 -0
- package/dist/exceptions/zone/zone.js +49 -0
- package/dist/filters/context-creator.js +65 -0
- package/dist/filters/context.js +58 -0
- package/dist/filters/filter.js +36 -0
- package/dist/guards/consumer.js +54 -0
- package/dist/guards/context-creator.js +76 -0
- package/dist/helpers/color.helper.js +35 -0
- package/dist/helpers/context-id-factory.helper.js +25 -0
- package/dist/helpers/context.helper.js +65 -0
- package/dist/helpers/create-param-decorator.helper.js +73 -0
- package/dist/helpers/filter-log-levels.util.js +38 -0
- package/dist/helpers/flatten.helper.js +26 -0
- package/dist/helpers/is-log-level-enabled.util.js +39 -0
- package/dist/helpers/is-log-level.util.js +26 -0
- package/dist/helpers/messages.helper.js +23 -0
- package/dist/helpers/metadata.helper.js +51 -0
- package/dist/helpers/noop.helper.js +23 -0
- package/dist/helpers/random-string-generator.helper.js +24 -0
- package/dist/helpers/rethrow.helper.js +25 -0
- package/dist/helpers/shared.helper.js +49 -0
- package/dist/helpers/silent.helper.js +34 -0
- package/dist/helpers/transient.helper.js +30 -0
- package/dist/helpers/uuid.helper.js +60 -0
- package/dist/helpers/validate-each.helper.js +42 -0
- package/dist/hooks/before-app-shutdown.hook.js +43 -0
- package/dist/hooks/on-app-bootstrap.hook.js +43 -0
- package/dist/hooks/on-app-shutdown.hook.js +43 -0
- package/dist/hooks/on-module-destroy.hook.js +43 -0
- package/dist/hooks/on-module-init.hook.js +43 -0
- package/dist/index.d.ts +3142 -0
- package/dist/index.js +115 -0
- package/dist/injector/constants.js +28 -0
- package/dist/injector/container.js +229 -0
- package/dist/injector/helpers/barrier.js +48 -0
- package/dist/injector/helpers/class-scope.helper.js +27 -0
- package/dist/injector/helpers/classifier.helper.js +35 -0
- package/dist/injector/helpers/is-durable.helper.js +27 -0
- package/dist/injector/injector.js +490 -0
- package/dist/injector/instance/links-host.js +68 -0
- package/dist/injector/instance/loader.js +95 -0
- package/dist/injector/instance/resolver.js +61 -0
- package/dist/injector/instance/wrapper.js +324 -0
- package/dist/injector/internal-core-module/core-providers.js +42 -0
- package/dist/injector/internal-core-module/internal-core-module-factory.js +66 -0
- package/dist/injector/internal-core-module/internal-core-module.js +46 -0
- package/dist/injector/module/compiler.js +47 -0
- package/dist/injector/module/container.js +33 -0
- package/dist/injector/module/lazy/loader.js +71 -0
- package/dist/injector/module/module.js +395 -0
- package/dist/injector/module/ref.js +78 -0
- package/dist/injector/module/token-factory.js +82 -0
- package/dist/injector/settlement-signal.js +50 -0
- package/dist/injector/topology-tree/topology-tree.js +68 -0
- package/dist/injector/topology-tree/tree-node.js +68 -0
- package/dist/inspector/graph-inspector.js +182 -0
- package/dist/inspector/initialize-on-preview.allowlist.js +31 -0
- package/dist/inspector/noop-graph-inspector.js +27 -0
- package/dist/inspector/partial-graph.host.js +34 -0
- package/dist/inspector/serialized-graph.js +128 -0
- package/dist/interceptors/consumer.js +54 -0
- package/dist/interceptors/context-creator.js +75 -0
- package/dist/interfaces/application/context-options.interface.js +31 -0
- package/dist/interfaces/application/context.interface.js +0 -0
- package/dist/interfaces/application/index.js +3 -0
- package/dist/interfaces/context/arguments-host.interface.js +0 -0
- package/dist/interfaces/context/context-id-factory.interface.js +0 -0
- package/dist/interfaces/context/context.interface.js +0 -0
- package/dist/interfaces/context/creator.interface.js +0 -0
- package/dist/interfaces/context/execution.interface.js +0 -0
- package/dist/interfaces/context/index.js +7 -0
- package/dist/interfaces/context/params.interface.js +0 -0
- package/dist/interfaces/features/exception-filter.interface.js +0 -0
- package/dist/interfaces/features/guards.interface.js +0 -0
- package/dist/interfaces/features/index.js +5 -0
- package/dist/interfaces/features/interceptor.interface.js +0 -0
- package/dist/interfaces/features/pipes.interface.js +0 -0
- package/dist/interfaces/helper.interface.js +0 -0
- package/dist/interfaces/hooks/before-application-shutdown.interface.js +0 -0
- package/dist/interfaces/hooks/index.js +6 -0
- package/dist/interfaces/hooks/on-application-bootstrap.interface.js +0 -0
- package/dist/interfaces/hooks/on-application-shutdown.interface.js +0 -0
- package/dist/interfaces/hooks/on-destroy.interface.js +0 -0
- package/dist/interfaces/hooks/on-init.interface.js +0 -0
- package/dist/interfaces/index.js +16 -0
- package/dist/interfaces/injectable.interface.js +0 -0
- package/dist/interfaces/injector/index.js +6 -0
- package/dist/interfaces/injector/injector.interface.js +0 -0
- package/dist/interfaces/injector/instance-wrapper.interface.js +0 -0
- package/dist/interfaces/injector/lazy-module-options.interface.js +0 -0
- package/dist/interfaces/injector/module-compiler.interface.js +0 -0
- package/dist/interfaces/injector/module-ref.interface.js +0 -0
- package/dist/interfaces/inspector/edge.interface.js +0 -0
- package/dist/interfaces/inspector/enhancer-metadata-cache-entry.interface.js +0 -0
- package/dist/interfaces/inspector/entrypoint.interface.js +0 -0
- package/dist/interfaces/inspector/extras.interface.js +0 -0
- package/dist/interfaces/inspector/index.js +8 -0
- package/dist/interfaces/inspector/node.interface.js +0 -0
- package/dist/interfaces/inspector/serialized-graph-json.interface.js +0 -0
- package/dist/interfaces/inspector/serialized-graph-metadata.interface.js +0 -0
- package/dist/interfaces/modules/definition.interface.js +0 -0
- package/dist/interfaces/modules/dynamic-module.interface.js +0 -0
- package/dist/interfaces/modules/forward-reference.interface.js +0 -0
- package/dist/interfaces/modules/index.js +10 -0
- package/dist/interfaces/modules/injection-token.interface.js +0 -0
- package/dist/interfaces/modules/introspection-result.interface.js +0 -0
- package/dist/interfaces/modules/module-metadata.interface.js +0 -0
- package/dist/interfaces/modules/module.interface.js +0 -0
- package/dist/interfaces/modules/optional-factory-dependency.interface.js +0 -0
- package/dist/interfaces/modules/override.interface.js +0 -0
- package/dist/interfaces/modules/provider.interface.js +0 -0
- package/dist/interfaces/param-decorator.interface.js +0 -0
- package/dist/interfaces/scope.interface.js +0 -0
- package/dist/interfaces/services/console.interface.js +0 -0
- package/dist/interfaces/services/index.js +4 -0
- package/dist/interfaces/services/logger.interface.js +0 -0
- package/dist/interfaces/services/reflector.interface.js +0 -0
- package/dist/interfaces/set-metadata.interface.js +0 -0
- package/dist/interfaces/type.interface.js +0 -0
- package/dist/metadata-scanner.js +50 -0
- package/dist/pipes/consumer.js +33 -0
- package/dist/pipes/context-creator.js +78 -0
- package/dist/scanner.js +371 -0
- package/dist/services/console.service.js +347 -0
- package/dist/services/logger.service.js +276 -0
- package/dist/services/reflector.service.js +82 -0
- package/dist/storage/handler-metadata.storage.js +42 -0
- package/dist/storage/meta-host.storage.js +62 -0
- package/package.json +52 -40
- package/application/config.d.ts +0 -35
- package/application/config.js +0 -85
- package/application/context.d.ts +0 -198
- package/application/context.js +0 -325
- package/application/factory.d.ts +0 -43
- package/application/factory.js +0 -147
- package/constants.d.ts +0 -44
- package/constants.js +0 -51
- package/context/context.d.ts +0 -66
- package/context/context.js +0 -156
- package/context/creator.d.ts +0 -9
- package/context/creator.js +0 -32
- package/context/execution-host.d.ts +0 -16
- package/context/execution-host.js +0 -30
- package/context/index.d.ts +0 -4
- package/context/index.js +0 -20
- package/context/proxy.d.ts +0 -6
- package/context/proxy.js +0 -33
- package/decorators/apply.decorator.d.ts +0 -10
- package/decorators/apply.decorator.js +0 -24
- package/decorators/bind.decorator.d.ts +0 -11
- package/decorators/bind.decorator.js +0 -20
- package/decorators/catch.decorator.d.ts +0 -17
- package/decorators/catch.decorator.js +0 -26
- package/decorators/create-param.decorator.d.ts +0 -29
- package/decorators/create-param.decorator.js +0 -51
- package/decorators/dependencies.decorator.d.ts +0 -6
- package/decorators/dependencies.decorator.js +0 -17
- package/decorators/exception-filters.decorator.d.ts +0 -21
- package/decorators/exception-filters.decorator.js +0 -41
- package/decorators/global.decorator.d.ts +0 -10
- package/decorators/global.decorator.js +0 -19
- package/decorators/index.d.ts +0 -15
- package/decorators/index.js +0 -31
- package/decorators/inject.decorator.d.ts +0 -26
- package/decorators/inject.decorator.js +0 -45
- package/decorators/injectable.decorator.d.ts +0 -40
- package/decorators/injectable.decorator.js +0 -51
- package/decorators/module.decorator.d.ts +0 -14
- package/decorators/module.decorator.js +0 -38
- package/decorators/optional.decorator.d.ts +0 -14
- package/decorators/optional.decorator.js +0 -30
- package/decorators/set-metadata.decorator.d.ts +0 -18
- package/decorators/set-metadata.decorator.js +0 -30
- package/decorators/use-guards.decorator.d.ts +0 -21
- package/decorators/use-guards.decorator.js +0 -40
- package/decorators/use-interceptors.decorator.d.ts +0 -21
- package/decorators/use-interceptors.decorator.js +0 -40
- package/decorators/use-pipes.decorator.d.ts +0 -21
- package/decorators/use-pipes.decorator.js +0 -39
- package/discovery/meta-host-collection.d.ts +0 -32
- package/discovery/meta-host-collection.js +0 -79
- package/discovery/module.d.ts +0 -5
- package/discovery/module.js +0 -24
- package/discovery/service.d.ts +0 -68
- package/discovery/service.js +0 -90
- package/errors/exceptions/circular-dependency.exception.d.ts +0 -4
- package/errors/exceptions/circular-dependency.exception.js +0 -11
- package/errors/exceptions/index.d.ts +0 -8
- package/errors/exceptions/index.js +0 -24
- package/errors/exceptions/invalid-class-module.exception.d.ts +0 -4
- package/errors/exceptions/invalid-class-module.exception.js +0 -11
- package/errors/exceptions/invalid-class-scope.exception.d.ts +0 -5
- package/errors/exceptions/invalid-class-scope.exception.js +0 -14
- package/errors/exceptions/invalid-class.exception.d.ts +0 -4
- package/errors/exceptions/invalid-class.exception.js +0 -11
- package/errors/exceptions/invalid-exception-filter.exception.d.ts +0 -4
- package/errors/exceptions/invalid-exception-filter.exception.js +0 -11
- package/errors/exceptions/invalid-module.exception.d.ts +0 -4
- package/errors/exceptions/invalid-module.exception.js +0 -11
- package/errors/exceptions/runtime.exception.d.ts +0 -4
- package/errors/exceptions/runtime.exception.js +0 -12
- package/errors/exceptions/undefined-dependency.exception.d.ts +0 -6
- package/errors/exceptions/undefined-dependency.exception.js +0 -11
- package/errors/exceptions/undefined-forwardref.exception.d.ts +0 -5
- package/errors/exceptions/undefined-forwardref.exception.js +0 -11
- package/errors/exceptions/undefined-module.exception.d.ts +0 -4
- package/errors/exceptions/undefined-module.exception.js +0 -11
- package/errors/exceptions/unknown-dependencies.exception.d.ts +0 -16
- package/errors/exceptions/unknown-dependencies.exception.js +0 -15
- package/errors/exceptions/unknown-element.exception.d.ts +0 -4
- package/errors/exceptions/unknown-element.exception.js +0 -12
- package/errors/exceptions/unknown-export.exception.d.ts +0 -4
- package/errors/exceptions/unknown-export.exception.js +0 -11
- package/errors/exceptions/unknown-module.exception.d.ts +0 -4
- package/errors/exceptions/unknown-module.exception.js +0 -10
- package/errors/messages.d.ts +0 -15
- package/errors/messages.js +0 -126
- package/exceptions/handler.d.ts +0 -10
- package/exceptions/handler.js +0 -34
- package/exceptions/index.d.ts +0 -2
- package/exceptions/index.js +0 -18
- package/exceptions/zone/handler.d.ts +0 -5
- package/exceptions/zone/handler.js +0 -15
- package/exceptions/zone/index.d.ts +0 -2
- package/exceptions/zone/index.js +0 -18
- package/exceptions/zone/zone.d.ts +0 -5
- package/exceptions/zone/zone.js +0 -32
- package/filters/context-creator.d.ts +0 -14
- package/filters/context-creator.js +0 -48
- package/filters/context.d.ts +0 -12
- package/filters/context.js +0 -41
- package/filters/filter.d.ts +0 -6
- package/filters/filter.js +0 -16
- package/filters/index.d.ts +0 -3
- package/filters/index.js +0 -19
- package/guards/consumer.d.ts +0 -9
- package/guards/consumer.js +0 -33
- package/guards/context-creator.d.ts +0 -17
- package/guards/context-creator.js +0 -69
- package/guards/index.d.ts +0 -2
- package/guards/index.js +0 -18
- package/helpers/color.helper.d.ts +0 -9
- package/helpers/color.helper.js +0 -14
- package/helpers/context-id-factory.helper.d.ts +0 -2
- package/helpers/context-id-factory.helper.js +0 -15
- package/helpers/context.helper.d.ts +0 -23
- package/helpers/context.helper.js +0 -49
- package/helpers/extends-metadata.helper.d.ts +0 -1
- package/helpers/extends-metadata.helper.js +0 -9
- package/helpers/flatten.helper.d.ts +0 -1
- package/helpers/flatten.helper.js +0 -9
- package/helpers/messages.helper.d.ts +0 -2
- package/helpers/messages.helper.js +0 -7
- package/helpers/noop.helper.d.ts +0 -1
- package/helpers/noop.helper.js +0 -5
- package/helpers/random-string-generator.helper.d.ts +0 -1
- package/helpers/random-string-generator.helper.js +0 -6
- package/helpers/rethrow.helper.d.ts +0 -1
- package/helpers/rethrow.helper.js +0 -7
- package/helpers/shared.helper.d.ts +0 -10
- package/helpers/shared.helper.js +0 -33
- package/helpers/silent.helper.d.ts +0 -10
- package/helpers/silent.helper.js +0 -18
- package/helpers/transient.helper.d.ts +0 -12
- package/helpers/transient.helper.js +0 -26
- package/helpers/uuid.helper.d.ts +0 -15
- package/helpers/uuid.helper.js +0 -54
- package/helpers/validate-each.helper.d.ts +0 -8
- package/helpers/validate-each.helper.js +0 -25
- package/hooks/before-app-shutdown.hook.d.ts +0 -9
- package/hooks/before-app-shutdown.hook.js +0 -45
- package/hooks/index.d.ts +0 -5
- package/hooks/index.js +0 -21
- package/hooks/on-app-bootstrap.hook.d.ts +0 -8
- package/hooks/on-app-bootstrap.hook.js +0 -45
- package/hooks/on-app-shutdown.hook.d.ts +0 -9
- package/hooks/on-app-shutdown.hook.js +0 -46
- package/hooks/on-module-destroy.hook.d.ts +0 -8
- package/hooks/on-module-destroy.hook.js +0 -45
- package/hooks/on-module-init.hook.d.ts +0 -8
- package/hooks/on-module-init.hook.js +0 -45
- package/index.d.ts +0 -10
- package/index.js +0 -32
- package/injector/constants.d.ts +0 -2
- package/injector/constants.js +0 -7
- package/injector/container.d.ts +0 -61
- package/injector/container.js +0 -194
- package/injector/helpers/class-scope.helper.d.ts +0 -2
- package/injector/helpers/class-scope.helper.js +0 -9
- package/injector/helpers/classifier.helper.d.ts +0 -4
- package/injector/helpers/classifier.helper.js +0 -17
- package/injector/helpers/is-durable.helper.d.ts +0 -2
- package/injector/helpers/is-durable.helper.js +0 -9
- package/injector/index.d.ts +0 -5
- package/injector/index.js +0 -20
- package/injector/injector.d.ts +0 -87
- package/injector/injector.js +0 -452
- package/injector/instance/links-host.d.ts +0 -22
- package/injector/instance/links-host.js +0 -50
- package/injector/instance/loader.d.ts +0 -21
- package/injector/instance/loader.js +0 -73
- package/injector/instance/resolver.d.ts +0 -16
- package/injector/instance/resolver.js +0 -43
- package/injector/instance/wrapper.d.ts +0 -90
- package/injector/instance/wrapper.js +0 -272
- package/injector/internal-core-module/core-providers.d.ts +0 -4
- package/injector/internal-core-module/core-providers.js +0 -21
- package/injector/internal-core-module/internal-core-module-factory.d.ts +0 -8
- package/injector/internal-core-module/internal-core-module-factory.js +0 -47
- package/injector/internal-core-module/internal-core-module.d.ts +0 -4
- package/injector/internal-core-module/internal-core-module.js +0 -31
- package/injector/module/compiler.d.ts +0 -19
- package/injector/module/compiler.js +0 -27
- package/injector/module/container.d.ts +0 -6
- package/injector/module/container.js +0 -24
- package/injector/module/lazy/loader.d.ts +0 -21
- package/injector/module/lazy/loader.js +0 -49
- package/injector/module/lazy/options.d.ts +0 -6
- package/injector/module/lazy/options.js +0 -2
- package/injector/module/module.d.ts +0 -74
- package/injector/module/module.js +0 -383
- package/injector/module/ref.d.ts +0 -106
- package/injector/module/ref.js +0 -62
- package/injector/module/token-factory.d.ts +0 -13
- package/injector/module/token-factory.js +0 -71
- package/injector/settlement-signal.d.ts +0 -37
- package/injector/settlement-signal.js +0 -55
- package/inspector/graph-inspector.d.ts +0 -26
- package/inspector/graph-inspector.js +0 -163
- package/inspector/initialize-on-preview.allowlist.d.ts +0 -6
- package/inspector/initialize-on-preview.allowlist.js +0 -13
- package/inspector/interfaces/edge.interface.d.ts +0 -28
- package/inspector/interfaces/edge.interface.js +0 -2
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +0 -12
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +0 -2
- package/inspector/interfaces/entrypoint.interface.d.ts +0 -10
- package/inspector/interfaces/entrypoint.interface.js +0 -2
- package/inspector/interfaces/extras.interface.d.ts +0 -18
- package/inspector/interfaces/extras.interface.js +0 -2
- package/inspector/interfaces/node.interface.d.ts +0 -49
- package/inspector/interfaces/node.interface.js +0 -2
- package/inspector/interfaces/serialized-graph-json.interface.d.ts +0 -14
- package/inspector/interfaces/serialized-graph-json.interface.js +0 -2
- package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +0 -10
- package/inspector/interfaces/serialized-graph-metadata.interface.js +0 -2
- package/inspector/noop-graph-inspector.d.ts +0 -2
- package/inspector/noop-graph-inspector.js +0 -8
- package/inspector/partial-graph.host.d.ts +0 -7
- package/inspector/partial-graph.host.js +0 -15
- package/inspector/serialized-graph.d.ts +0 -52
- package/inspector/serialized-graph.js +0 -121
- package/interceptors/consumer.d.ts +0 -9
- package/interceptors/consumer.js +0 -37
- package/interceptors/context-creator.d.ts +0 -17
- package/interceptors/context-creator.js +0 -67
- package/interceptors/index.d.ts +0 -2
- package/interceptors/index.js +0 -18
- package/interfaces/abstract.interface.d.ts +0 -3
- package/interfaces/abstract.interface.js +0 -2
- package/interfaces/application/context-options.interface.d.ts +0 -41
- package/interfaces/application/context-options.interface.js +0 -9
- package/interfaces/application/context.interface.d.ts +0 -162
- package/interfaces/application/context.interface.js +0 -2
- package/interfaces/application/index.d.ts +0 -1
- package/interfaces/application/index.js +0 -17
- package/interfaces/context/arguments-host.interface.d.ts +0 -22
- package/interfaces/context/arguments-host.interface.js +0 -2
- package/interfaces/context/execution.interface.d.ts +0 -18
- package/interfaces/context/execution.interface.js +0 -2
- package/interfaces/context/index.d.ts +0 -2
- package/interfaces/context/index.js +0 -18
- package/interfaces/features/exception-filter.interface.d.ts +0 -21
- package/interfaces/features/exception-filter.interface.js +0 -2
- package/interfaces/features/guards.interface.d.ts +0 -20
- package/interfaces/features/guards.interface.js +0 -2
- package/interfaces/features/index.d.ts +0 -4
- package/interfaces/features/index.js +0 -20
- package/interfaces/features/interceptor.interface.d.ts +0 -30
- package/interfaces/features/interceptor.interface.js +0 -2
- package/interfaces/features/pipes.interface.d.ts +0 -37
- package/interfaces/features/pipes.interface.js +0 -2
- package/interfaces/helper.interface.d.ts +0 -3
- package/interfaces/helper.interface.js +0 -2
- package/interfaces/hooks/before-application-shutdown.interface.d.ts +0 -3
- package/interfaces/hooks/before-application-shutdown.interface.js +0 -2
- package/interfaces/hooks/index.d.ts +0 -5
- package/interfaces/hooks/index.js +0 -21
- package/interfaces/hooks/on-application-bootstrap.interface.d.ts +0 -9
- package/interfaces/hooks/on-application-bootstrap.interface.js +0 -2
- package/interfaces/hooks/on-application-shutdown.interface.d.ts +0 -9
- package/interfaces/hooks/on-application-shutdown.interface.js +0 -2
- package/interfaces/hooks/on-destroy.interface.d.ts +0 -10
- package/interfaces/hooks/on-destroy.interface.js +0 -2
- package/interfaces/hooks/on-init.interface.d.ts +0 -8
- package/interfaces/hooks/on-init.interface.js +0 -2
- package/interfaces/index.d.ts +0 -8
- package/interfaces/index.js +0 -24
- package/interfaces/injectable.interface.d.ts +0 -1
- package/interfaces/injectable.interface.js +0 -2
- package/interfaces/modules/configurable/async-options.interface.d.ts +0 -42
- package/interfaces/modules/configurable/async-options.interface.js +0 -2
- package/interfaces/modules/configurable/cls.interface.d.ts +0 -13
- package/interfaces/modules/configurable/cls.interface.js +0 -2
- package/interfaces/modules/configurable/host.interface.d.ts +0 -62
- package/interfaces/modules/configurable/host.interface.js +0 -2
- package/interfaces/modules/configurable/index.d.ts +0 -3
- package/interfaces/modules/configurable/index.js +0 -19
- package/interfaces/modules/definition.interface.d.ts +0 -4
- package/interfaces/modules/definition.interface.js +0 -2
- package/interfaces/modules/dynamic-module.interface.d.ts +0 -23
- package/interfaces/modules/dynamic-module.interface.js +0 -2
- package/interfaces/modules/forward-reference.interface.d.ts +0 -3
- package/interfaces/modules/forward-reference.interface.js +0 -2
- package/interfaces/modules/index.d.ts +0 -9
- package/interfaces/modules/index.js +0 -25
- package/interfaces/modules/injection-token.interface.d.ts +0 -5
- package/interfaces/modules/injection-token.interface.js +0 -2
- package/interfaces/modules/introspection-result.interface.d.ts +0 -10
- package/interfaces/modules/introspection-result.interface.js +0 -2
- package/interfaces/modules/module-metadata.interface.d.ts +0 -24
- package/interfaces/modules/module-metadata.interface.js +0 -2
- package/interfaces/modules/module.interface.d.ts +0 -2
- package/interfaces/modules/module.interface.js +0 -2
- package/interfaces/modules/optional-factory-dependency.interface.d.ts +0 -8
- package/interfaces/modules/optional-factory-dependency.interface.js +0 -2
- package/interfaces/modules/override.interface.d.ts +0 -5
- package/interfaces/modules/override.interface.js +0 -2
- package/interfaces/modules/provider.interface.d.ts +0 -142
- package/interfaces/modules/provider.interface.js +0 -2
- package/interfaces/scope.interface.d.ts +0 -35
- package/interfaces/scope.interface.js +0 -23
- package/interfaces/type.interface.d.ts +0 -3
- package/interfaces/type.interface.js +0 -2
- package/metadata-scanner.d.ts +0 -4
- package/metadata-scanner.js +0 -34
- package/module/configurable-module.builder.d.ts +0 -93
- package/module/configurable-module.builder.js +0 -204
- package/module/constants.d.ts +0 -4
- package/module/constants.js +0 -7
- package/module/helpers/generate-options-injection-token.helper.d.ts +0 -1
- package/module/helpers/generate-options-injection-token.helper.js +0 -9
- package/module/helpers/get-injection-providers.helper.d.ts +0 -8
- package/module/helpers/get-injection-providers.helper.js +0 -36
- package/module/helpers/index.d.ts +0 -2
- package/module/helpers/index.js +0 -18
- package/module/index.d.ts +0 -2
- package/module/index.js +0 -18
- package/pipes/consumer.d.ts +0 -9
- package/pipes/consumer.js +0 -15
- package/pipes/context-creator.d.ts +0 -18
- package/pipes/context-creator.js +0 -70
- package/pipes/index.d.ts +0 -2
- package/pipes/index.js +0 -18
- package/scanner.d.ts +0 -81
- package/scanner.js +0 -374
- package/services/console.service.d.ts +0 -86
- package/services/console.service.js +0 -233
- package/services/index.d.ts +0 -1
- package/services/index.js +0 -17
- package/services/logger.service.d.ts +0 -157
- package/services/logger.service.js +0 -269
- package/services/reflector.service.d.ts +0 -110
- package/services/reflector.service.js +0 -87
- package/test/context/creator.spec.d.ts +0 -1
- package/test/context/creator.spec.js +0 -149
- package/test/context/execution-host.spec.d.ts +0 -1
- package/test/context/execution-host.spec.js +0 -31
- package/test/context/proxy.spec.d.ts +0 -1
- package/test/context/proxy.spec.js +0 -46
- package/test/exceptions/handler.spec.d.ts +0 -1
- package/test/exceptions/handler.spec.js +0 -90
- package/test/exceptions/messages.spec.js +0 -201
- package/test/exceptions/zona/handler.spec.d.ts +0 -1
- package/test/exceptions/zona/handler.spec.js +0 -51
- package/test/exceptions/zona/zone.spec.d.ts +0 -1
- package/test/exceptions/zona/zone.spec.js +0 -66
- package/test/filters/context-creator.spec.d.ts +0 -2
- package/test/filters/context-creator.spec.js +0 -91
- package/test/guards/consumer.spec.d.ts +0 -1
- package/test/guards/consumer.spec.js +0 -47
- package/test/guards/context-creator.spec.d.ts +0 -1
- package/test/guards/context-creator.spec.js +0 -138
- package/test/helpers/context-id-factory.spec.d.ts +0 -1
- package/test/helpers/context-id-factory.spec.js +0 -9
- package/test/helpers/shared.spec.d.ts +0 -1
- package/test/helpers/shared.spec.js +0 -122
- package/test/hooks/before-app-shutdown.hook.spec.d.ts +0 -1
- package/test/hooks/before-app-shutdown.hook.spec.js +0 -44
- package/test/hooks/on-app-bootstrap.hook.spec.d.ts +0 -1
- package/test/hooks/on-app-bootstrap.hook.spec.js +0 -43
- package/test/hooks/on-app-shutdown.hook.spec.d.ts +0 -1
- package/test/hooks/on-app-shutdown.hook.spec.js +0 -43
- package/test/hooks/on-module-destroy.hook.spec.d.ts +0 -1
- package/test/hooks/on-module-destroy.hook.spec.js +0 -43
- package/test/hooks/on-module-init.hook.spec.d.ts +0 -1
- package/test/hooks/on-module-init.hook.spec.js +0 -43
- package/test/injector/compiler.spec.d.ts +0 -1
- package/test/injector/compiler.spec.js +0 -42
- package/test/injector/container.spec.d.ts +0 -1
- package/test/injector/container.spec.js +0 -203
- package/test/injector/helpers/classifier.spec.d.ts +0 -1
- package/test/injector/helpers/classifier.spec.js +0 -102
- package/test/injector/injector.spec.d.ts +0 -1
- package/test/injector/injector.spec.js +0 -678
- package/test/injector/instance/loader.spec.d.ts +0 -1
- package/test/injector/instance/loader.spec.js +0 -108
- package/test/injector/instance/wrapper.spec.d.ts +0 -1
- package/test/injector/instance/wrapper.spec.js +0 -772
- package/test/injector/internal-core-module/internal-core-module-factory.spec.d.ts +0 -1
- package/test/injector/internal-core-module/internal-core-module-factory.spec.js +0 -27
- package/test/injector/module/lazy/loader.spec.d.ts +0 -1
- package/test/injector/module/lazy/loader.spec.js +0 -71
- package/test/injector/module/module.spec.d.ts +0 -1
- package/test/injector/module/module.spec.js +0 -410
- package/test/injector/module/token-factory.spec.d.ts +0 -1
- package/test/injector/module/token-factory.spec.js +0 -84
- package/test/interceptors/consumer.spec.d.ts +0 -1
- package/test/interceptors/consumer.spec.js +0 -136
- package/test/interceptors/context-creator.spec.d.ts +0 -1
- package/test/interceptors/context-creator.spec.js +0 -139
- package/test/metadata-scanner.spec.d.ts +0 -1
- package/test/metadata-scanner.spec.js +0 -41
- package/test/module/configurable-module.builder.spec.d.ts +0 -1
- package/test/module/configurable-module.builder.spec.js +0 -102
- package/test/module/helpers/get-injection-providers.helper.spec.d.ts +0 -1
- package/test/module/helpers/get-injection-providers.helper.spec.js +0 -49
- package/test/pipes/consumer.spec.d.ts +0 -1
- package/test/pipes/consumer.spec.js +0 -42
- package/test/pipes/context-creator.spec.d.ts +0 -1
- package/test/pipes/context-creator.spec.js +0 -108
- package/test/scanner.spec.d.ts +0 -1
- package/test/scanner.spec.js +0 -620
- package/test/services/logger.service.spec.d.ts +0 -1
- package/test/services/logger.service.spec.js +0 -487
- package/test/services/reflector.service.spec.d.ts +0 -1
- package/test/services/reflector.service.spec.js +0 -105
- package/tsconfig.tsbuildinfo +0 -1
- /package/{test/exceptions/messages.spec.d.ts → dist/interfaces/abstract.interface.js} +0 -0
package/injector/injector.js
DELETED
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Injector = void 0;
|
|
4
|
-
const wrapper_1 = require("@venok/core/injector/instance/wrapper");
|
|
5
|
-
const constants_1 = require("@venok/core/injector/constants");
|
|
6
|
-
const logger_service_1 = require("@venok/core/services/logger.service");
|
|
7
|
-
const exceptions_1 = require("@venok/core/errors/exceptions");
|
|
8
|
-
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
9
|
-
const settlement_signal_1 = require("@venok/core/injector/settlement-signal");
|
|
10
|
-
const constants_2 = require("@venok/core/constants");
|
|
11
|
-
const undefined_dependency_exception_1 = require("@venok/core/errors/exceptions/undefined-dependency.exception");
|
|
12
|
-
const unknown_dependencies_exception_1 = require("@venok/core/errors/exceptions/unknown-dependencies.exception");
|
|
13
|
-
const color_helper_1 = require("@venok/core/helpers/color.helper");
|
|
14
|
-
class Injector {
|
|
15
|
-
constructor(options) {
|
|
16
|
-
this.options = options;
|
|
17
|
-
this.logger = new logger_service_1.Logger("InjectorLogger");
|
|
18
|
-
}
|
|
19
|
-
loadPrototype({ token }, collection, contextId = constants_1.STATIC_CONTEXT) {
|
|
20
|
-
if (!collection) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const target = collection.get(token);
|
|
24
|
-
const instance = target.createPrototype(contextId);
|
|
25
|
-
if (instance) {
|
|
26
|
-
const wrapper = new wrapper_1.InstanceWrapper({
|
|
27
|
-
...target,
|
|
28
|
-
instance,
|
|
29
|
-
});
|
|
30
|
-
collection.set(token, wrapper);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async loadInstance(wrapper, collection, moduleRef, contextId = constants_1.STATIC_CONTEXT, inquirer) {
|
|
34
|
-
const inquirerId = this.getInquirerId(inquirer);
|
|
35
|
-
const instanceHost = wrapper.getInstanceByContextId(this.getContextId(contextId, wrapper), inquirerId);
|
|
36
|
-
// Maybe Error
|
|
37
|
-
if (instanceHost.isPending && instanceHost.donePromise) {
|
|
38
|
-
const settlementSignal = wrapper.settlementSignal;
|
|
39
|
-
if (inquirer && settlementSignal?.isCycle(inquirer.id))
|
|
40
|
-
throw new exceptions_1.CircularDependencyException(`"${wrapper.name}"`);
|
|
41
|
-
return instanceHost.donePromise.then((err) => {
|
|
42
|
-
if (err)
|
|
43
|
-
throw err;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const settlementSignal = this.applySettlementSignal(instanceHost, wrapper);
|
|
47
|
-
const token = wrapper.token || wrapper.name;
|
|
48
|
-
const { inject } = wrapper;
|
|
49
|
-
const targetWrapper = collection.get(token);
|
|
50
|
-
if ((0, shared_helper_1.isUndefined)(targetWrapper)) {
|
|
51
|
-
throw new exceptions_1.RuntimeException();
|
|
52
|
-
}
|
|
53
|
-
if (instanceHost.isResolved) {
|
|
54
|
-
return settlementSignal.complete();
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
const t0 = this.getNowTimestamp();
|
|
58
|
-
const callback = async (instances) => {
|
|
59
|
-
const properties = await this.resolveProperties(wrapper, moduleRef, inject, contextId, wrapper, inquirer);
|
|
60
|
-
const instance = await this.instantiateClass(instances, wrapper, targetWrapper, contextId, inquirer);
|
|
61
|
-
this.applyProperties(instance, properties);
|
|
62
|
-
wrapper.initTime = this.getNowTimestamp() - t0;
|
|
63
|
-
settlementSignal.complete();
|
|
64
|
-
};
|
|
65
|
-
await this.resolveConstructorParams(wrapper, moduleRef, inject, callback, contextId, wrapper, inquirer);
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
settlementSignal.error(err);
|
|
69
|
-
throw err;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async loadInjectable(wrapper, moduleRef, contextId = constants_1.STATIC_CONTEXT, inquirer) {
|
|
73
|
-
const injectables = moduleRef.injectables;
|
|
74
|
-
await this.loadInstance(wrapper, injectables, moduleRef, contextId, inquirer);
|
|
75
|
-
}
|
|
76
|
-
async loadProvider(wrapper, moduleRef, contextId = constants_1.STATIC_CONTEXT, inquirer) {
|
|
77
|
-
const providers = moduleRef.providers;
|
|
78
|
-
await this.loadInstance(wrapper, providers, moduleRef, contextId, inquirer);
|
|
79
|
-
await this.loadEnhancersPerContext(wrapper, contextId, wrapper);
|
|
80
|
-
}
|
|
81
|
-
applySettlementSignal(instancePerContext, host) {
|
|
82
|
-
const settlementSignal = new settlement_signal_1.SettlementSignal();
|
|
83
|
-
instancePerContext.donePromise = settlementSignal.asPromise();
|
|
84
|
-
instancePerContext.isPending = true;
|
|
85
|
-
host.settlementSignal = settlementSignal;
|
|
86
|
-
return settlementSignal;
|
|
87
|
-
}
|
|
88
|
-
async resolveConstructorParams(wrapper, moduleRef, inject, callback, contextId = constants_1.STATIC_CONTEXT, inquirer, parentInquirer) {
|
|
89
|
-
let inquirerId = this.getInquirerId(inquirer);
|
|
90
|
-
const metadata = wrapper.getCtorMetadata();
|
|
91
|
-
if (metadata && contextId !== constants_1.STATIC_CONTEXT) {
|
|
92
|
-
const deps = await this.loadCtorMetadata(metadata, contextId, inquirer, parentInquirer);
|
|
93
|
-
return callback(deps);
|
|
94
|
-
}
|
|
95
|
-
const isFactoryProvider = !(0, shared_helper_1.isNull)(inject);
|
|
96
|
-
const [dependencies, optionalDependenciesIds] = isFactoryProvider
|
|
97
|
-
? this.getFactoryProviderDependencies(wrapper)
|
|
98
|
-
: this.getClassDependencies(wrapper);
|
|
99
|
-
let isResolved = true;
|
|
100
|
-
const resolveParam = async (param, index) => {
|
|
101
|
-
try {
|
|
102
|
-
if (this.isInquirer(param, parentInquirer)) {
|
|
103
|
-
return parentInquirer && parentInquirer.instance;
|
|
104
|
-
}
|
|
105
|
-
if (inquirer?.isTransient && parentInquirer) {
|
|
106
|
-
inquirer = parentInquirer;
|
|
107
|
-
inquirerId = this.getInquirerId(parentInquirer);
|
|
108
|
-
}
|
|
109
|
-
const paramWrapper = await this.resolveSingleParam(wrapper, param, { index, dependencies }, moduleRef, contextId, inquirer, index);
|
|
110
|
-
const instanceHost = paramWrapper.getInstanceByContextId(this.getContextId(contextId, paramWrapper), inquirerId);
|
|
111
|
-
if (!instanceHost.isResolved && !paramWrapper.forwardRef) {
|
|
112
|
-
isResolved = false;
|
|
113
|
-
}
|
|
114
|
-
return instanceHost?.instance;
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
const isOptional = optionalDependenciesIds.includes(index);
|
|
118
|
-
if (!isOptional) {
|
|
119
|
-
throw err;
|
|
120
|
-
}
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
const instances = await Promise.all(dependencies.map(resolveParam));
|
|
125
|
-
isResolved && (await callback(instances));
|
|
126
|
-
}
|
|
127
|
-
getClassDependencies(wrapper) {
|
|
128
|
-
const ctorRef = wrapper.metatype;
|
|
129
|
-
return [this.reflectConstructorParams(ctorRef), this.reflectOptionalParams(ctorRef)];
|
|
130
|
-
}
|
|
131
|
-
getFactoryProviderDependencies(wrapper) {
|
|
132
|
-
const optionalDependenciesIds = [];
|
|
133
|
-
const isOptionalFactoryDep = (item) => !(0, shared_helper_1.isUndefined)(item.token) &&
|
|
134
|
-
!(0, shared_helper_1.isUndefined)(item.optional);
|
|
135
|
-
const mapFactoryProviderInjectArray = (item, index) => {
|
|
136
|
-
if (typeof item !== "object") {
|
|
137
|
-
return item;
|
|
138
|
-
}
|
|
139
|
-
if (isOptionalFactoryDep(item)) {
|
|
140
|
-
if (item.optional)
|
|
141
|
-
optionalDependenciesIds.push(index);
|
|
142
|
-
return item?.token;
|
|
143
|
-
}
|
|
144
|
-
return item;
|
|
145
|
-
};
|
|
146
|
-
return [wrapper.inject?.map?.(mapFactoryProviderInjectArray), optionalDependenciesIds];
|
|
147
|
-
}
|
|
148
|
-
reflectConstructorParams(type) {
|
|
149
|
-
const paramtypes = [...(Reflect.getMetadata(constants_2.PARAMTYPES_METADATA, type) || [])];
|
|
150
|
-
const selfParams = this.reflectSelfParams(type);
|
|
151
|
-
selfParams.forEach(({ index, param }) => (paramtypes[index] = param));
|
|
152
|
-
return paramtypes;
|
|
153
|
-
}
|
|
154
|
-
reflectOptionalParams(type) {
|
|
155
|
-
return Reflect.getMetadata(constants_2.OPTIONAL_DEPS_METADATA, type) || [];
|
|
156
|
-
}
|
|
157
|
-
reflectSelfParams(type) {
|
|
158
|
-
return Reflect.getMetadata(constants_2.SELF_DECLARED_DEPS_METADATA, type) || [];
|
|
159
|
-
}
|
|
160
|
-
async resolveSingleParam(wrapper, param, dependencyContext, moduleRef, contextId = constants_1.STATIC_CONTEXT, inquirer, keyOrIndex) {
|
|
161
|
-
if ((0, shared_helper_1.isUndefined)(param)) {
|
|
162
|
-
this.logger.log("Venok encountered an undefined dependency. This may be due to a circular import or a missing dependency declaration.");
|
|
163
|
-
throw new undefined_dependency_exception_1.UndefinedDependencyException(wrapper.name, dependencyContext, moduleRef);
|
|
164
|
-
}
|
|
165
|
-
const token = this.resolveParamToken(wrapper, param);
|
|
166
|
-
return this.resolveComponentInstance(moduleRef, token, dependencyContext, wrapper, contextId, inquirer, keyOrIndex);
|
|
167
|
-
}
|
|
168
|
-
resolveParamToken(wrapper, param) {
|
|
169
|
-
if (!param.forwardRef) {
|
|
170
|
-
return param;
|
|
171
|
-
}
|
|
172
|
-
wrapper.forwardRef = true;
|
|
173
|
-
return param.forwardRef();
|
|
174
|
-
}
|
|
175
|
-
async resolveComponentInstance(moduleRef, token, dependencyContext, wrapper, contextId = constants_1.STATIC_CONTEXT, inquirer, keyOrIndex) {
|
|
176
|
-
this.printResolvingDependenciesLog(token, inquirer);
|
|
177
|
-
this.printLookingForProviderLog(token, moduleRef);
|
|
178
|
-
const providers = moduleRef.providers;
|
|
179
|
-
const instanceWrapper = await this.lookupComponent(providers, moduleRef, { ...dependencyContext, name: token }, wrapper, contextId, inquirer, keyOrIndex);
|
|
180
|
-
return this.resolveComponentHost(moduleRef, instanceWrapper, contextId, inquirer);
|
|
181
|
-
}
|
|
182
|
-
async resolveComponentHost(moduleRef, instanceWrapper, contextId = constants_1.STATIC_CONTEXT, inquirer) {
|
|
183
|
-
const inquirerId = this.getInquirerId(inquirer);
|
|
184
|
-
const instanceHost = instanceWrapper.getInstanceByContextId(this.getContextId(contextId, instanceWrapper), inquirerId);
|
|
185
|
-
if (!instanceHost.isResolved && !instanceWrapper.forwardRef) {
|
|
186
|
-
inquirer?.settlementSignal?.insertRef(instanceWrapper.id);
|
|
187
|
-
await this.loadProvider(instanceWrapper, instanceWrapper.host ?? moduleRef, contextId, inquirer);
|
|
188
|
-
}
|
|
189
|
-
else if (!instanceHost.isResolved &&
|
|
190
|
-
instanceWrapper.forwardRef &&
|
|
191
|
-
(contextId !== constants_1.STATIC_CONTEXT || !!inquirerId)) {
|
|
192
|
-
/**
|
|
193
|
-
* When circular dependency has been detected between
|
|
194
|
-
* either request/transient providers, we have to asynchronously
|
|
195
|
-
* resolve instance host for a specific contextId or inquirer, to ensure
|
|
196
|
-
* that eventual lazily created instance will be merged with the prototype
|
|
197
|
-
* instantiated beforehand.
|
|
198
|
-
*/
|
|
199
|
-
instanceHost.donePromise &&
|
|
200
|
-
instanceHost.donePromise.then(() => this.loadProvider(instanceWrapper, moduleRef, contextId, inquirer));
|
|
201
|
-
}
|
|
202
|
-
if (instanceWrapper.async) {
|
|
203
|
-
const host = instanceWrapper.getInstanceByContextId(this.getContextId(contextId, instanceWrapper), inquirerId);
|
|
204
|
-
host.instance = await host.instance;
|
|
205
|
-
instanceWrapper.setInstanceByContextId(contextId, host, inquirerId);
|
|
206
|
-
}
|
|
207
|
-
return instanceWrapper;
|
|
208
|
-
}
|
|
209
|
-
async lookupComponent(providers, moduleRef, dependencyContext, wrapper, contextId = constants_1.STATIC_CONTEXT, inquirer, keyOrIndex) {
|
|
210
|
-
const token = wrapper.token || wrapper.name;
|
|
211
|
-
const { name } = dependencyContext;
|
|
212
|
-
if (wrapper && token === name) {
|
|
213
|
-
throw new unknown_dependencies_exception_1.UnknownDependenciesException(wrapper.name, dependencyContext, moduleRef, { id: wrapper.id });
|
|
214
|
-
}
|
|
215
|
-
if (name && providers.has(name)) {
|
|
216
|
-
const instanceWrapper = providers.get(name);
|
|
217
|
-
this.printFoundInModuleLog(name, moduleRef);
|
|
218
|
-
this.addDependencyMetadata(keyOrIndex ?? "", wrapper, instanceWrapper);
|
|
219
|
-
return instanceWrapper;
|
|
220
|
-
}
|
|
221
|
-
return this.lookupComponentInParentModules(dependencyContext, moduleRef, wrapper, contextId, inquirer, keyOrIndex);
|
|
222
|
-
}
|
|
223
|
-
async lookupComponentInParentModules(dependencyContext, moduleRef, wrapper, contextId = constants_1.STATIC_CONTEXT, inquirer, keyOrIndex) {
|
|
224
|
-
const instanceWrapper = await this.lookupComponentInImports(moduleRef, dependencyContext.name, wrapper, [], contextId, inquirer, keyOrIndex);
|
|
225
|
-
if ((0, shared_helper_1.isNull)(instanceWrapper)) {
|
|
226
|
-
throw new unknown_dependencies_exception_1.UnknownDependenciesException(wrapper.name, dependencyContext, moduleRef, { id: wrapper.id });
|
|
227
|
-
}
|
|
228
|
-
return instanceWrapper;
|
|
229
|
-
}
|
|
230
|
-
async lookupComponentInImports(moduleRef, name, wrapper, moduleRegistry = [], contextId = constants_1.STATIC_CONTEXT, inquirer, keyOrIndex, isTraversing) {
|
|
231
|
-
let instanceWrapperRef = null;
|
|
232
|
-
const imports = moduleRef.imports || new Set();
|
|
233
|
-
const identity = (item) => item;
|
|
234
|
-
let children = [...imports.values()].filter(identity);
|
|
235
|
-
if (isTraversing) {
|
|
236
|
-
const contextModuleExports = moduleRef.exports;
|
|
237
|
-
children = children.filter((child) => contextModuleExports.has(child.metatype));
|
|
238
|
-
}
|
|
239
|
-
for (const relatedModule of children) {
|
|
240
|
-
if (moduleRegistry.includes(relatedModule.id)) {
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
this.printLookingForProviderLog(name, relatedModule);
|
|
244
|
-
moduleRegistry.push(relatedModule.id);
|
|
245
|
-
const { providers, exports } = relatedModule;
|
|
246
|
-
if (!exports.has(name) || !providers.has(name)) {
|
|
247
|
-
const instanceRef = await this.lookupComponentInImports(relatedModule, name, wrapper, moduleRegistry, contextId, inquirer, keyOrIndex, true);
|
|
248
|
-
// Maybe Error
|
|
249
|
-
if (instanceRef && keyOrIndex) {
|
|
250
|
-
this.addDependencyMetadata(keyOrIndex, wrapper, instanceRef);
|
|
251
|
-
return instanceRef;
|
|
252
|
-
}
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
this.printFoundInModuleLog(name, relatedModule);
|
|
256
|
-
instanceWrapperRef = providers.get(name);
|
|
257
|
-
this.addDependencyMetadata(keyOrIndex ?? "", wrapper, instanceWrapperRef);
|
|
258
|
-
const inquirerId = this.getInquirerId(inquirer);
|
|
259
|
-
const instanceHost = instanceWrapperRef.getInstanceByContextId(this.getContextId(contextId, instanceWrapperRef), inquirerId);
|
|
260
|
-
if (!instanceHost.isResolved && !instanceWrapperRef.forwardRef) {
|
|
261
|
-
wrapper.settlementSignal?.insertRef(instanceWrapperRef.id);
|
|
262
|
-
await this.loadProvider(instanceWrapperRef, relatedModule, contextId, wrapper);
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return instanceWrapperRef;
|
|
267
|
-
}
|
|
268
|
-
async resolveProperties(wrapper, moduleRef, inject, contextId = constants_1.STATIC_CONTEXT, inquirer, parentInquirer) {
|
|
269
|
-
if (!(0, shared_helper_1.isNull)(inject)) {
|
|
270
|
-
return [];
|
|
271
|
-
}
|
|
272
|
-
const metadata = wrapper.getPropertiesMetadata();
|
|
273
|
-
if (metadata && contextId !== constants_1.STATIC_CONTEXT) {
|
|
274
|
-
return this.loadPropertiesMetadata(metadata, contextId, inquirer);
|
|
275
|
-
}
|
|
276
|
-
const properties = this.reflectProperties(wrapper.metatype);
|
|
277
|
-
const instances = await Promise.all(properties.map(async (item) => {
|
|
278
|
-
try {
|
|
279
|
-
const dependencyContext = {
|
|
280
|
-
key: item.key,
|
|
281
|
-
name: item.name,
|
|
282
|
-
};
|
|
283
|
-
if (this.isInquirer(item.name, parentInquirer)) {
|
|
284
|
-
return parentInquirer && parentInquirer.instance;
|
|
285
|
-
}
|
|
286
|
-
const paramWrapper = await this.resolveSingleParam(wrapper, item.name, dependencyContext, moduleRef, contextId, inquirer, item.key);
|
|
287
|
-
if (!paramWrapper) {
|
|
288
|
-
return undefined;
|
|
289
|
-
}
|
|
290
|
-
const inquirerId = this.getInquirerId(inquirer);
|
|
291
|
-
const instanceHost = paramWrapper.getInstanceByContextId(this.getContextId(contextId, paramWrapper), inquirerId);
|
|
292
|
-
return instanceHost.instance;
|
|
293
|
-
}
|
|
294
|
-
catch (err) {
|
|
295
|
-
if (!item.isOptional) {
|
|
296
|
-
throw err;
|
|
297
|
-
}
|
|
298
|
-
return undefined;
|
|
299
|
-
}
|
|
300
|
-
}));
|
|
301
|
-
return properties.map((item, index) => ({
|
|
302
|
-
...item,
|
|
303
|
-
instance: instances[index],
|
|
304
|
-
}));
|
|
305
|
-
}
|
|
306
|
-
reflectProperties(type) {
|
|
307
|
-
const properties = Reflect.getMetadata(constants_2.PROPERTY_DEPS_METADATA, type) || [];
|
|
308
|
-
const optionalKeys = Reflect.getMetadata(constants_2.OPTIONAL_PROPERTY_DEPS_METADATA, type) || [];
|
|
309
|
-
return properties.map((item) => ({
|
|
310
|
-
...item,
|
|
311
|
-
name: item.type,
|
|
312
|
-
isOptional: optionalKeys.includes(item.key),
|
|
313
|
-
}));
|
|
314
|
-
}
|
|
315
|
-
applyProperties(instance, properties) {
|
|
316
|
-
if (!(0, shared_helper_1.isObject)(instance)) {
|
|
317
|
-
return undefined;
|
|
318
|
-
}
|
|
319
|
-
properties
|
|
320
|
-
.filter((item) => !(0, shared_helper_1.isNull)(item.instance))
|
|
321
|
-
.forEach((item) => {
|
|
322
|
-
// Maybe Error
|
|
323
|
-
// @ts-ignore
|
|
324
|
-
instance[item.key] = item.instance;
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
async instantiateClass(instances, wrapper, targetMetatype, contextId = constants_1.STATIC_CONTEXT, inquirer) {
|
|
328
|
-
const { metatype, inject } = wrapper;
|
|
329
|
-
const inquirerId = this.getInquirerId(inquirer);
|
|
330
|
-
const instanceHost = targetMetatype.getInstanceByContextId(this.getContextId(contextId, targetMetatype), inquirerId);
|
|
331
|
-
const isInContext = wrapper.isStatic(contextId, inquirer) ||
|
|
332
|
-
wrapper.isInRequestScope(contextId, inquirer) ||
|
|
333
|
-
wrapper.isLazyTransient(contextId, inquirer) ||
|
|
334
|
-
wrapper.isExplicitlyRequested(contextId, inquirer);
|
|
335
|
-
if (this.options?.preview && !wrapper.host?.initOnPreview) {
|
|
336
|
-
instanceHost.isResolved = true;
|
|
337
|
-
return instanceHost.instance;
|
|
338
|
-
}
|
|
339
|
-
if ((0, shared_helper_1.isNull)(inject) && isInContext) {
|
|
340
|
-
instanceHost.instance = wrapper.forwardRef
|
|
341
|
-
? Object.assign(instanceHost.instance, new metatype(...instances))
|
|
342
|
-
: new metatype(...instances);
|
|
343
|
-
}
|
|
344
|
-
else if (isInContext) {
|
|
345
|
-
const factoryReturnValue = targetMetatype.metatype(...instances);
|
|
346
|
-
instanceHost.instance = await factoryReturnValue;
|
|
347
|
-
}
|
|
348
|
-
instanceHost.isResolved = true;
|
|
349
|
-
return instanceHost.instance;
|
|
350
|
-
}
|
|
351
|
-
async loadPerContext(instance, moduleRef, collection, ctx, wrapper) {
|
|
352
|
-
if (!wrapper) {
|
|
353
|
-
const injectionToken = instance.constructor;
|
|
354
|
-
wrapper = collection.get(injectionToken);
|
|
355
|
-
}
|
|
356
|
-
await this.loadInstance(wrapper, collection, moduleRef, ctx, wrapper);
|
|
357
|
-
await this.loadEnhancersPerContext(wrapper, ctx, wrapper);
|
|
358
|
-
const host = wrapper.getInstanceByContextId(this.getContextId(ctx, wrapper), wrapper.id);
|
|
359
|
-
return host && host.instance;
|
|
360
|
-
}
|
|
361
|
-
async loadEnhancersPerContext(wrapper, ctx, inquirer) {
|
|
362
|
-
const enhancers = wrapper.getEnhancersMetadata() || [];
|
|
363
|
-
const loadEnhancer = (item) => {
|
|
364
|
-
const hostModule = item.host;
|
|
365
|
-
return this.loadInstance(item, hostModule.injectables, hostModule, ctx, inquirer);
|
|
366
|
-
};
|
|
367
|
-
await Promise.all(enhancers.map(loadEnhancer));
|
|
368
|
-
}
|
|
369
|
-
async loadCtorMetadata(metadata, contextId, inquirer, parentInquirer) {
|
|
370
|
-
const hosts = await Promise.all(metadata.map(async (item) => this.resolveScopedComponentHost(item, contextId, inquirer, parentInquirer)));
|
|
371
|
-
const inquirerId = this.getInquirerId(inquirer);
|
|
372
|
-
return hosts.map((item) => item?.getInstanceByContextId(this.getContextId(contextId, item), inquirerId).instance);
|
|
373
|
-
}
|
|
374
|
-
async loadPropertiesMetadata(metadata, contextId, inquirer) {
|
|
375
|
-
const dependenciesHosts = await Promise.all(metadata.map(async ({ wrapper: item, key }) => ({
|
|
376
|
-
key,
|
|
377
|
-
host: await this.resolveComponentHost(item.host, item, contextId, inquirer),
|
|
378
|
-
})));
|
|
379
|
-
const inquirerId = this.getInquirerId(inquirer);
|
|
380
|
-
return dependenciesHosts.map(({ key, host }) => ({
|
|
381
|
-
key,
|
|
382
|
-
name: key,
|
|
383
|
-
instance: host.getInstanceByContextId(this.getContextId(contextId, host), inquirerId).instance,
|
|
384
|
-
}));
|
|
385
|
-
}
|
|
386
|
-
getInquirerId(inquirer) {
|
|
387
|
-
return inquirer && inquirer.id;
|
|
388
|
-
}
|
|
389
|
-
resolveScopedComponentHost(item, contextId, inquirer, parentInquirer) {
|
|
390
|
-
return this.isInquirerRequest(item, parentInquirer)
|
|
391
|
-
? parentInquirer
|
|
392
|
-
: this.resolveComponentHost(item.host, item, contextId, inquirer);
|
|
393
|
-
}
|
|
394
|
-
isInquirerRequest(item, parentInquirer) {
|
|
395
|
-
return item.isTransient && item.name === constants_2.INQUIRER && parentInquirer;
|
|
396
|
-
}
|
|
397
|
-
isInquirer(param, parentInquirer) {
|
|
398
|
-
return param === constants_2.INQUIRER && parentInquirer;
|
|
399
|
-
}
|
|
400
|
-
addDependencyMetadata(keyOrIndex, hostWrapper, instanceWrapper) {
|
|
401
|
-
if ((0, shared_helper_1.isSymbol)(keyOrIndex) || (0, shared_helper_1.isString)(keyOrIndex)) {
|
|
402
|
-
hostWrapper.addPropertiesMetadata(keyOrIndex, instanceWrapper);
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
hostWrapper.addCtorMetadata(keyOrIndex, instanceWrapper);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
getTokenName(token) {
|
|
409
|
-
return (0, shared_helper_1.isFunction)(token) ? token.name : token.toString();
|
|
410
|
-
}
|
|
411
|
-
printResolvingDependenciesLog(token, inquirer) {
|
|
412
|
-
if (!this.isDebugMode()) {
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
const tokenName = this.getTokenName(token);
|
|
416
|
-
const dependentName = (inquirer?.name && inquirer.name.toString?.()) ?? "unknown";
|
|
417
|
-
const isAlias = dependentName === tokenName;
|
|
418
|
-
const messageToPrint = `Resolving dependency ${color_helper_1.colors.cyanBright(tokenName)}${color_helper_1.colors.green(" in the ")}${color_helper_1.colors.yellow(dependentName)}${color_helper_1.colors.green(` provider ${isAlias ? "(alias)" : ""}`)}`;
|
|
419
|
-
this.logger.log(messageToPrint);
|
|
420
|
-
}
|
|
421
|
-
printLookingForProviderLog(token, moduleRef) {
|
|
422
|
-
if (!this.isDebugMode()) {
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
const tokenName = this.getTokenName(token);
|
|
426
|
-
const moduleRefName = moduleRef?.metatype?.name ?? "unknown";
|
|
427
|
-
this.logger.log(`Looking for ${color_helper_1.colors.cyanBright(tokenName)}${color_helper_1.colors.green(" in ")}${color_helper_1.colors.magentaBright(moduleRefName)}`);
|
|
428
|
-
}
|
|
429
|
-
printFoundInModuleLog(token, moduleRef) {
|
|
430
|
-
if (!this.isDebugMode()) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
const tokenName = this.getTokenName(token);
|
|
434
|
-
const moduleRefName = moduleRef?.metatype?.name ?? "unknown";
|
|
435
|
-
this.logger.log(`Found ${color_helper_1.colors.cyanBright(tokenName)}${color_helper_1.colors.green(" in ")}${color_helper_1.colors.magentaBright(moduleRefName)}`);
|
|
436
|
-
}
|
|
437
|
-
isDebugMode() {
|
|
438
|
-
return !!process.env.VENOK_DEBUG;
|
|
439
|
-
}
|
|
440
|
-
getContextId(contextId, instanceWrapper) {
|
|
441
|
-
return contextId.getParent
|
|
442
|
-
? contextId.getParent({
|
|
443
|
-
token: instanceWrapper.token,
|
|
444
|
-
isTreeDurable: instanceWrapper.isDependencyTreeDurable(),
|
|
445
|
-
})
|
|
446
|
-
: contextId;
|
|
447
|
-
}
|
|
448
|
-
getNowTimestamp() {
|
|
449
|
-
return performance.now();
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
exports.Injector = Injector;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { InstanceWrapper } from "@venok/core/injector/instance/wrapper";
|
|
2
|
-
import { InjectionToken } from "@venok/core/interfaces/modules";
|
|
3
|
-
import { VenokContainer } from "@venok/core/injector/container";
|
|
4
|
-
export interface InstanceLink<T = any> {
|
|
5
|
-
token: InjectionToken;
|
|
6
|
-
wrapperRef: InstanceWrapper<T>;
|
|
7
|
-
collection: Map<any, InstanceWrapper>;
|
|
8
|
-
moduleId: string;
|
|
9
|
-
}
|
|
10
|
-
export declare class InstanceLinksHost {
|
|
11
|
-
private readonly container;
|
|
12
|
-
private readonly instanceLinks;
|
|
13
|
-
constructor(container: VenokContainer);
|
|
14
|
-
get<T = any>(token: InjectionToken): InstanceLink<T>;
|
|
15
|
-
get<T = any>(token: InjectionToken, options?: {
|
|
16
|
-
moduleId?: string;
|
|
17
|
-
each?: boolean;
|
|
18
|
-
}): InstanceLink<T> | Array<InstanceLink<T>>;
|
|
19
|
-
private initialize;
|
|
20
|
-
private addLink;
|
|
21
|
-
private getInstanceNameByToken;
|
|
22
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstanceLinksHost = void 0;
|
|
4
|
-
const exceptions_1 = require("@venok/core/errors/exceptions");
|
|
5
|
-
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
6
|
-
class InstanceLinksHost {
|
|
7
|
-
constructor(container) {
|
|
8
|
-
this.container = container;
|
|
9
|
-
this.instanceLinks = new Map();
|
|
10
|
-
this.initialize();
|
|
11
|
-
}
|
|
12
|
-
get(token, options = {}) {
|
|
13
|
-
const instanceLinksForGivenToken = this.instanceLinks.get(token);
|
|
14
|
-
if (!instanceLinksForGivenToken)
|
|
15
|
-
throw new exceptions_1.UnknownElementException(this.getInstanceNameByToken(token));
|
|
16
|
-
if (options.each)
|
|
17
|
-
return instanceLinksForGivenToken;
|
|
18
|
-
const instanceLink = options.moduleId
|
|
19
|
-
? instanceLinksForGivenToken.find((item) => item.moduleId === options.moduleId)
|
|
20
|
-
: instanceLinksForGivenToken[instanceLinksForGivenToken.length - 1];
|
|
21
|
-
if (!instanceLink)
|
|
22
|
-
throw new exceptions_1.UnknownElementException(this.getInstanceNameByToken(token));
|
|
23
|
-
return instanceLink;
|
|
24
|
-
}
|
|
25
|
-
initialize() {
|
|
26
|
-
const modules = this.container.getModules();
|
|
27
|
-
modules.forEach((moduleRef) => {
|
|
28
|
-
const { providers, injectables } = moduleRef;
|
|
29
|
-
providers.forEach((wrapper, token) => this.addLink(wrapper, token, moduleRef, "providers"));
|
|
30
|
-
injectables.forEach((wrapper, token) => this.addLink(wrapper, token, moduleRef, "injectables"));
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
addLink(wrapper, token, moduleRef, collectionName) {
|
|
34
|
-
const instanceLink = {
|
|
35
|
-
moduleId: moduleRef.id,
|
|
36
|
-
wrapperRef: wrapper,
|
|
37
|
-
collection: moduleRef[collectionName],
|
|
38
|
-
token,
|
|
39
|
-
};
|
|
40
|
-
const existingLinks = this.instanceLinks.get(token);
|
|
41
|
-
if (!existingLinks)
|
|
42
|
-
this.instanceLinks.set(token, [instanceLink]);
|
|
43
|
-
else
|
|
44
|
-
existingLinks.push(instanceLink);
|
|
45
|
-
}
|
|
46
|
-
getInstanceNameByToken(token) {
|
|
47
|
-
return (0, shared_helper_1.isFunction)(token) ? token?.name : token;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.InstanceLinksHost = InstanceLinksHost;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { VenokContainer } from "@venok/core/injector/container";
|
|
2
|
-
import { Injector } from "@venok/core/injector/injector";
|
|
3
|
-
import { Logger, LoggerService } from "@venok/core/services/logger.service";
|
|
4
|
-
import { Module } from "@venok/core/injector/module/module";
|
|
5
|
-
import { GraphInspector } from "@venok/core/inspector/graph-inspector";
|
|
6
|
-
export declare class InstanceLoader<TInjector extends Injector = Injector> {
|
|
7
|
-
protected readonly container: VenokContainer;
|
|
8
|
-
protected readonly injector: TInjector;
|
|
9
|
-
protected readonly graphInspector: GraphInspector;
|
|
10
|
-
private logger;
|
|
11
|
-
constructor(container: VenokContainer, injector: TInjector, graphInspector: GraphInspector, logger?: LoggerService);
|
|
12
|
-
setLogger(logger: Logger): void;
|
|
13
|
-
createInstancesOfDependencies(modules?: Map<string, Module>): Promise<void>;
|
|
14
|
-
private createPrototypes;
|
|
15
|
-
private createInstances;
|
|
16
|
-
private createPrototypesOfProviders;
|
|
17
|
-
private createInstancesOfProviders;
|
|
18
|
-
private createPrototypesOfInjectables;
|
|
19
|
-
private createInstancesOfInjectables;
|
|
20
|
-
private isModuleWhitelisted;
|
|
21
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstanceLoader = void 0;
|
|
4
|
-
const logger_service_1 = require("@venok/core/services/logger.service");
|
|
5
|
-
const internal_core_module_1 = require("@venok/core/injector/internal-core-module/internal-core-module");
|
|
6
|
-
const messages_helper_1 = require("@venok/core/helpers/messages.helper");
|
|
7
|
-
class InstanceLoader {
|
|
8
|
-
constructor(container, injector, graphInspector, logger = new logger_service_1.Logger(InstanceLoader.name, {
|
|
9
|
-
timestamp: true,
|
|
10
|
-
})) {
|
|
11
|
-
this.container = container;
|
|
12
|
-
this.injector = injector;
|
|
13
|
-
this.graphInspector = graphInspector;
|
|
14
|
-
this.logger = logger;
|
|
15
|
-
}
|
|
16
|
-
setLogger(logger) {
|
|
17
|
-
this.logger = logger;
|
|
18
|
-
}
|
|
19
|
-
async createInstancesOfDependencies(modules = this.container.getModules()) {
|
|
20
|
-
this.createPrototypes(modules);
|
|
21
|
-
try {
|
|
22
|
-
await this.createInstances(modules);
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
this.graphInspector.inspectModules(modules);
|
|
26
|
-
this.graphInspector.registerPartial(err);
|
|
27
|
-
throw err;
|
|
28
|
-
}
|
|
29
|
-
this.graphInspector.inspectModules(modules);
|
|
30
|
-
}
|
|
31
|
-
createPrototypes(modules) {
|
|
32
|
-
modules.forEach((moduleRef) => {
|
|
33
|
-
this.createPrototypesOfProviders(moduleRef);
|
|
34
|
-
this.createPrototypesOfInjectables(moduleRef);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
async createInstances(modules) {
|
|
38
|
-
await Promise.all([...modules.values()].map(async (moduleRef) => {
|
|
39
|
-
await this.createInstancesOfProviders(moduleRef);
|
|
40
|
-
await this.createInstancesOfInjectables(moduleRef);
|
|
41
|
-
const { name } = moduleRef;
|
|
42
|
-
this.isModuleWhitelisted(name) && this.logger.log((0, messages_helper_1.MODULE_INIT_MESSAGE) `${name}`);
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
createPrototypesOfProviders(moduleRef) {
|
|
46
|
-
const { providers } = moduleRef;
|
|
47
|
-
providers.forEach((wrapper) => this.injector.loadPrototype(wrapper, providers));
|
|
48
|
-
}
|
|
49
|
-
async createInstancesOfProviders(moduleRef) {
|
|
50
|
-
const { providers } = moduleRef;
|
|
51
|
-
const wrappers = [...providers.values()];
|
|
52
|
-
await Promise.all(wrappers.map(async (item) => {
|
|
53
|
-
await this.injector.loadProvider(item, moduleRef);
|
|
54
|
-
this.graphInspector.inspectInstanceWrapper(item, moduleRef);
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
createPrototypesOfInjectables(moduleRef) {
|
|
58
|
-
const { injectables } = moduleRef;
|
|
59
|
-
injectables.forEach((wrapper) => this.injector.loadPrototype(wrapper, injectables));
|
|
60
|
-
}
|
|
61
|
-
async createInstancesOfInjectables(moduleRef) {
|
|
62
|
-
const { injectables } = moduleRef;
|
|
63
|
-
const wrappers = [...injectables.values()];
|
|
64
|
-
await Promise.all(wrappers.map(async (item) => {
|
|
65
|
-
await this.injector.loadInjectable(item, moduleRef);
|
|
66
|
-
this.graphInspector.inspectInstanceWrapper(item, moduleRef);
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
isModuleWhitelisted(name) {
|
|
70
|
-
return name !== internal_core_module_1.InternalCoreModule.name;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.InstanceLoader = InstanceLoader;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Injector } from "@venok/core/injector/injector";
|
|
2
|
-
import { Abstract, Type } from "@venok/core/interfaces";
|
|
3
|
-
import { Module } from "@venok/core/injector/module/module";
|
|
4
|
-
import { ContextId } from "@venok/core/injector/instance/wrapper";
|
|
5
|
-
import { InstanceLinksHost } from "@venok/core/injector/instance/links-host";
|
|
6
|
-
import { GetOrResolveOptions } from "@venok/core/interfaces/application/context.interface";
|
|
7
|
-
export declare abstract class AbstractInstanceResolver {
|
|
8
|
-
protected abstract instanceLinksHost: InstanceLinksHost;
|
|
9
|
-
protected abstract injector: Injector;
|
|
10
|
-
protected abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options?: GetOrResolveOptions): TResult | Array<TResult>;
|
|
11
|
-
protected find<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol, options: {
|
|
12
|
-
moduleId?: string;
|
|
13
|
-
each?: boolean;
|
|
14
|
-
}): TResult | Array<TResult>;
|
|
15
|
-
protected resolvePerContext<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol, contextModule: Module, contextId: ContextId, options?: GetOrResolveOptions): Promise<TResult | Array<TResult>>;
|
|
16
|
-
}
|