@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
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LazyModuleLoader = void 0;
|
|
4
|
-
const ref_1 = require("@venok/core/injector/module/ref");
|
|
5
|
-
const silent_helper_1 = require("@venok/core/helpers/silent.helper");
|
|
6
|
-
class LazyModuleLoader {
|
|
7
|
-
constructor(dependenciesScanner, instanceLoader, moduleCompiler, modulesContainer, moduleOverrides) {
|
|
8
|
-
this.dependenciesScanner = dependenciesScanner;
|
|
9
|
-
this.instanceLoader = instanceLoader;
|
|
10
|
-
this.moduleCompiler = moduleCompiler;
|
|
11
|
-
this.modulesContainer = modulesContainer;
|
|
12
|
-
this.moduleOverrides = moduleOverrides;
|
|
13
|
-
}
|
|
14
|
-
async load(loaderFn, loadOpts) {
|
|
15
|
-
this.registerLoggerConfiguration(loadOpts);
|
|
16
|
-
const moduleClassOrDynamicDefinition = await loaderFn();
|
|
17
|
-
const moduleInstances = await this.dependenciesScanner.scanForModules({
|
|
18
|
-
moduleDefinition: moduleClassOrDynamicDefinition,
|
|
19
|
-
overrides: this.moduleOverrides,
|
|
20
|
-
lazy: true,
|
|
21
|
-
});
|
|
22
|
-
if (moduleInstances.length === 0) {
|
|
23
|
-
// The module has been loaded already. In this case, we must
|
|
24
|
-
// retrieve a module reference from the existing container.
|
|
25
|
-
const { token } = await this.moduleCompiler.compile(moduleClassOrDynamicDefinition);
|
|
26
|
-
const moduleInstance = this.modulesContainer.get(token);
|
|
27
|
-
return moduleInstance && this.getTargetModuleRef(moduleInstance);
|
|
28
|
-
}
|
|
29
|
-
const lazyModulesContainer = this.createLazyModulesContainer(moduleInstances);
|
|
30
|
-
await this.dependenciesScanner.scanModulesForDependencies(lazyModulesContainer);
|
|
31
|
-
await this.instanceLoader.createInstancesOfDependencies(lazyModulesContainer);
|
|
32
|
-
const [targetModule] = moduleInstances;
|
|
33
|
-
return this.getTargetModuleRef(targetModule);
|
|
34
|
-
}
|
|
35
|
-
registerLoggerConfiguration(loadOpts) {
|
|
36
|
-
if (loadOpts?.logger === false) {
|
|
37
|
-
this.instanceLoader.setLogger(new silent_helper_1.SilentLogger());
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
createLazyModulesContainer(moduleInstances) {
|
|
41
|
-
moduleInstances = Array.from(new Set(moduleInstances));
|
|
42
|
-
return new Map(moduleInstances.map((ref) => [ref.token, ref]));
|
|
43
|
-
}
|
|
44
|
-
getTargetModuleRef(moduleInstance) {
|
|
45
|
-
const moduleRefInstanceWrapper = moduleInstance.getProviderByKey(ref_1.ModuleRef);
|
|
46
|
-
return moduleRefInstanceWrapper.instance;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.LazyModuleLoader = LazyModuleLoader;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { InstanceWrapper } from "@venok/core/injector/instance/wrapper";
|
|
2
|
-
import { ClassProvider, DynamicModule, ExistingProvider, FactoryProvider, InjectionToken, Provider, ValueProvider, VenokModule } from "@venok/core/interfaces/modules";
|
|
3
|
-
import { Type } from "@venok/core/interfaces";
|
|
4
|
-
import { EnhancerSubtype } from "@venok/core/constants";
|
|
5
|
-
import { ModuleRef } from "@venok/core/injector/module/ref";
|
|
6
|
-
import { VenokContainer } from "@venok/core/injector/container";
|
|
7
|
-
import { Injectable } from "@venok/core/interfaces/injectable.interface";
|
|
8
|
-
export declare class Module {
|
|
9
|
-
private readonly _metatype;
|
|
10
|
-
private readonly container;
|
|
11
|
-
private readonly _id;
|
|
12
|
-
private readonly _imports;
|
|
13
|
-
private readonly _providers;
|
|
14
|
-
private readonly _injectables;
|
|
15
|
-
private readonly _entryProviderKeys;
|
|
16
|
-
private readonly _exports;
|
|
17
|
-
private _distance;
|
|
18
|
-
private _initOnPreview;
|
|
19
|
-
private _isGlobal;
|
|
20
|
-
private _token;
|
|
21
|
-
constructor(_metatype: Type, container: VenokContainer);
|
|
22
|
-
get id(): string;
|
|
23
|
-
get token(): string;
|
|
24
|
-
set token(token: string);
|
|
25
|
-
get name(): string;
|
|
26
|
-
get isGlobal(): boolean;
|
|
27
|
-
set isGlobal(global: boolean);
|
|
28
|
-
get initOnPreview(): boolean;
|
|
29
|
-
set initOnPreview(initOnPreview: boolean);
|
|
30
|
-
get providers(): Map<InjectionToken, InstanceWrapper<Injectable>>;
|
|
31
|
-
get imports(): Set<Module>;
|
|
32
|
-
get injectables(): Map<InjectionToken, InstanceWrapper<Injectable>>;
|
|
33
|
-
get entryProviders(): Array<InstanceWrapper<Injectable>>;
|
|
34
|
-
get exports(): Set<InjectionToken>;
|
|
35
|
-
get instance(): VenokModule;
|
|
36
|
-
get metatype(): Type;
|
|
37
|
-
get distance(): number;
|
|
38
|
-
set distance(value: number);
|
|
39
|
-
addCoreProviders(): void;
|
|
40
|
-
addModuleRef(): void;
|
|
41
|
-
addModuleAsProvider(): void;
|
|
42
|
-
addApplicationConfig(): void;
|
|
43
|
-
addInjectable<T extends Injectable>(injectable: Provider, enhancerSubtype: EnhancerSubtype, host?: Type<T>): string | symbol | Function | InstanceWrapper<unknown>;
|
|
44
|
-
addProvider(provider: Provider, enhancerSubtype?: EnhancerSubtype): InjectionToken;
|
|
45
|
-
isCustomProvider(provider: Provider): provider is ClassProvider | FactoryProvider | ValueProvider | ExistingProvider;
|
|
46
|
-
addCustomProvider(provider: ClassProvider | FactoryProvider | ValueProvider | ExistingProvider, collection: Map<Function | string | symbol, any>, enhancerSubtype?: EnhancerSubtype): InjectionToken;
|
|
47
|
-
isCustomClass(provider: any): provider is ClassProvider;
|
|
48
|
-
isCustomValue(provider: any): provider is ValueProvider;
|
|
49
|
-
isCustomFactory(provider: any): provider is FactoryProvider;
|
|
50
|
-
isCustomUseExisting(provider: any): provider is ExistingProvider;
|
|
51
|
-
isDynamicModule(exported: any): exported is DynamicModule;
|
|
52
|
-
addCustomClass(provider: ClassProvider, collection: Map<InjectionToken, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
|
|
53
|
-
addCustomValue(provider: ValueProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
|
|
54
|
-
addCustomFactory(provider: FactoryProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
|
|
55
|
-
addCustomUseExisting(provider: ExistingProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
|
|
56
|
-
addExportedProvider(provider: Provider | string | symbol | DynamicModule): Set<InjectionToken> | undefined;
|
|
57
|
-
addCustomExportedProvider(provider: FactoryProvider | ValueProvider | ClassProvider | ExistingProvider): Set<InjectionToken> | undefined;
|
|
58
|
-
validateExportedProvider(token: InjectionToken): InjectionToken;
|
|
59
|
-
addImport(moduleRef: Module): void;
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated
|
|
62
|
-
*/
|
|
63
|
-
addRelatedModule(module: Module): void;
|
|
64
|
-
replace(toReplace: InjectionToken, options: any): void;
|
|
65
|
-
hasProvider(token: InjectionToken): boolean;
|
|
66
|
-
hasInjectable(token: InjectionToken): boolean;
|
|
67
|
-
getProviderByKey<T = any>(name: InjectionToken): InstanceWrapper<T>;
|
|
68
|
-
getProviderById<T = any>(id: string): InstanceWrapper<T> | undefined;
|
|
69
|
-
getInjectableById<T = any>(id: string): InstanceWrapper<T> | undefined;
|
|
70
|
-
getNonAliasProviders(): Array<[InjectionToken, InstanceWrapper<Injectable>]>;
|
|
71
|
-
createModuleReferenceType(): Type<ModuleRef>;
|
|
72
|
-
private isEntryProvider;
|
|
73
|
-
private generateUuid;
|
|
74
|
-
}
|
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Module = void 0;
|
|
4
|
-
const wrapper_1 = require("@venok/core/injector/instance/wrapper");
|
|
5
|
-
const exceptions_1 = require("@venok/core/errors/exceptions");
|
|
6
|
-
const constants_1 = require("@venok/core/constants");
|
|
7
|
-
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
8
|
-
const uuid_helper_1 = require("@venok/core/helpers/uuid.helper");
|
|
9
|
-
const random_string_generator_helper_1 = require("@venok/core/helpers/random-string-generator.helper");
|
|
10
|
-
const ref_1 = require("@venok/core/injector/module/ref");
|
|
11
|
-
const class_scope_helper_1 = require("@venok/core/injector/helpers/class-scope.helper");
|
|
12
|
-
const is_durable_helper_1 = require("@venok/core/injector/helpers/is-durable.helper");
|
|
13
|
-
const config_1 = require("@venok/core/application/config");
|
|
14
|
-
const context_id_factory_helper_1 = require("@venok/core/helpers/context-id-factory.helper");
|
|
15
|
-
class Module {
|
|
16
|
-
constructor(_metatype, container) {
|
|
17
|
-
this._metatype = _metatype;
|
|
18
|
-
this.container = container;
|
|
19
|
-
this._imports = new Set();
|
|
20
|
-
this._providers = new Map();
|
|
21
|
-
this._injectables = new Map();
|
|
22
|
-
this._entryProviderKeys = new Set();
|
|
23
|
-
this._exports = new Set();
|
|
24
|
-
this._distance = 0;
|
|
25
|
-
this._initOnPreview = false;
|
|
26
|
-
this._isGlobal = false;
|
|
27
|
-
this.addCoreProviders();
|
|
28
|
-
this._id = this.generateUuid();
|
|
29
|
-
}
|
|
30
|
-
get id() {
|
|
31
|
-
return this._id;
|
|
32
|
-
}
|
|
33
|
-
get token() {
|
|
34
|
-
return this._token;
|
|
35
|
-
}
|
|
36
|
-
set token(token) {
|
|
37
|
-
this._token = token;
|
|
38
|
-
}
|
|
39
|
-
get name() {
|
|
40
|
-
return this.metatype.name;
|
|
41
|
-
}
|
|
42
|
-
get isGlobal() {
|
|
43
|
-
return this._isGlobal;
|
|
44
|
-
}
|
|
45
|
-
set isGlobal(global) {
|
|
46
|
-
this._isGlobal = global;
|
|
47
|
-
}
|
|
48
|
-
get initOnPreview() {
|
|
49
|
-
return this._initOnPreview;
|
|
50
|
-
}
|
|
51
|
-
set initOnPreview(initOnPreview) {
|
|
52
|
-
this._initOnPreview = initOnPreview;
|
|
53
|
-
}
|
|
54
|
-
get providers() {
|
|
55
|
-
return this._providers;
|
|
56
|
-
}
|
|
57
|
-
get imports() {
|
|
58
|
-
return this._imports;
|
|
59
|
-
}
|
|
60
|
-
get injectables() {
|
|
61
|
-
return this._injectables;
|
|
62
|
-
}
|
|
63
|
-
get entryProviders() {
|
|
64
|
-
return Array.from(this._entryProviderKeys)
|
|
65
|
-
.map((token) => this.providers.get(token))
|
|
66
|
-
.filter(Boolean);
|
|
67
|
-
}
|
|
68
|
-
get exports() {
|
|
69
|
-
return this._exports;
|
|
70
|
-
}
|
|
71
|
-
get instance() {
|
|
72
|
-
if (!this._providers.has(this._metatype)) {
|
|
73
|
-
throw new exceptions_1.RuntimeException();
|
|
74
|
-
}
|
|
75
|
-
const module = this._providers.get(this._metatype);
|
|
76
|
-
return module.instance;
|
|
77
|
-
}
|
|
78
|
-
get metatype() {
|
|
79
|
-
return this._metatype;
|
|
80
|
-
}
|
|
81
|
-
get distance() {
|
|
82
|
-
return this._distance;
|
|
83
|
-
}
|
|
84
|
-
set distance(value) {
|
|
85
|
-
this._distance = value;
|
|
86
|
-
}
|
|
87
|
-
addCoreProviders() {
|
|
88
|
-
this.addModuleAsProvider();
|
|
89
|
-
this.addModuleRef();
|
|
90
|
-
this.addApplicationConfig();
|
|
91
|
-
}
|
|
92
|
-
addModuleRef() {
|
|
93
|
-
const moduleRef = this.createModuleReferenceType();
|
|
94
|
-
this._providers.set(ref_1.ModuleRef, new wrapper_1.InstanceWrapper({
|
|
95
|
-
token: ref_1.ModuleRef,
|
|
96
|
-
name: ref_1.ModuleRef.name,
|
|
97
|
-
metatype: ref_1.ModuleRef,
|
|
98
|
-
isResolved: true,
|
|
99
|
-
instance: new moduleRef(),
|
|
100
|
-
host: this,
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
addModuleAsProvider() {
|
|
104
|
-
this._providers.set(this._metatype, new wrapper_1.InstanceWrapper({
|
|
105
|
-
token: this._metatype,
|
|
106
|
-
name: this._metatype.name,
|
|
107
|
-
metatype: this._metatype,
|
|
108
|
-
isResolved: false,
|
|
109
|
-
instance: null,
|
|
110
|
-
host: this,
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
addApplicationConfig() {
|
|
114
|
-
this._providers.set(config_1.ApplicationConfig, new wrapper_1.InstanceWrapper({
|
|
115
|
-
token: config_1.ApplicationConfig,
|
|
116
|
-
name: config_1.ApplicationConfig.name,
|
|
117
|
-
isResolved: true,
|
|
118
|
-
instance: this.container.applicationConfig,
|
|
119
|
-
host: this,
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
addInjectable(injectable, enhancerSubtype, host) {
|
|
123
|
-
if (this.isCustomProvider(injectable)) {
|
|
124
|
-
return this.addCustomProvider(injectable, this._injectables, enhancerSubtype);
|
|
125
|
-
}
|
|
126
|
-
let instanceWrapper = this.injectables.get(injectable);
|
|
127
|
-
if (!instanceWrapper) {
|
|
128
|
-
instanceWrapper = new wrapper_1.InstanceWrapper({
|
|
129
|
-
token: injectable,
|
|
130
|
-
name: injectable.name,
|
|
131
|
-
metatype: injectable,
|
|
132
|
-
instance: null,
|
|
133
|
-
isResolved: false,
|
|
134
|
-
scope: (0, class_scope_helper_1.getClassScope)(injectable),
|
|
135
|
-
durable: (0, is_durable_helper_1.isDurable)(injectable),
|
|
136
|
-
subtype: enhancerSubtype,
|
|
137
|
-
host: this,
|
|
138
|
-
});
|
|
139
|
-
this._injectables.set(injectable, instanceWrapper);
|
|
140
|
-
}
|
|
141
|
-
if (host) {
|
|
142
|
-
const hostWrapper = this._providers.get(host);
|
|
143
|
-
hostWrapper && hostWrapper.addEnhancerMetadata(instanceWrapper);
|
|
144
|
-
}
|
|
145
|
-
return instanceWrapper;
|
|
146
|
-
}
|
|
147
|
-
// public addProvider(provider: Provider): InjectionToken;
|
|
148
|
-
// public addProvider(provider: Provider, enhancerSubtype: EnhancerSubtype): InjectionToken;
|
|
149
|
-
addProvider(provider, enhancerSubtype) {
|
|
150
|
-
if (this.isCustomProvider(provider)) {
|
|
151
|
-
if (this.isEntryProvider(provider.provide)) {
|
|
152
|
-
this._entryProviderKeys.add(provider.provide);
|
|
153
|
-
}
|
|
154
|
-
return this.addCustomProvider(provider, this._providers, enhancerSubtype);
|
|
155
|
-
}
|
|
156
|
-
this._providers.set(provider, new wrapper_1.InstanceWrapper({
|
|
157
|
-
token: provider,
|
|
158
|
-
name: provider.name,
|
|
159
|
-
metatype: provider,
|
|
160
|
-
instance: null,
|
|
161
|
-
isResolved: false,
|
|
162
|
-
scope: (0, class_scope_helper_1.getClassScope)(provider),
|
|
163
|
-
durable: (0, is_durable_helper_1.isDurable)(provider),
|
|
164
|
-
host: this,
|
|
165
|
-
}));
|
|
166
|
-
if (this.isEntryProvider(provider)) {
|
|
167
|
-
this._entryProviderKeys.add(provider);
|
|
168
|
-
}
|
|
169
|
-
return provider;
|
|
170
|
-
}
|
|
171
|
-
isCustomProvider(provider) {
|
|
172
|
-
return !(0, shared_helper_1.isNull)(provider.provide);
|
|
173
|
-
}
|
|
174
|
-
addCustomProvider(provider, collection, enhancerSubtype) {
|
|
175
|
-
if (this.isCustomClass(provider)) {
|
|
176
|
-
this.addCustomClass(provider, collection, enhancerSubtype);
|
|
177
|
-
}
|
|
178
|
-
else if (this.isCustomValue(provider)) {
|
|
179
|
-
this.addCustomValue(provider, collection, enhancerSubtype);
|
|
180
|
-
}
|
|
181
|
-
else if (this.isCustomFactory(provider)) {
|
|
182
|
-
this.addCustomFactory(provider, collection, enhancerSubtype);
|
|
183
|
-
}
|
|
184
|
-
else if (this.isCustomUseExisting(provider)) {
|
|
185
|
-
this.addCustomUseExisting(provider, collection, enhancerSubtype);
|
|
186
|
-
}
|
|
187
|
-
return provider.provide;
|
|
188
|
-
}
|
|
189
|
-
isCustomClass(provider) {
|
|
190
|
-
return !(0, shared_helper_1.isUndefined)(provider.useClass);
|
|
191
|
-
}
|
|
192
|
-
isCustomValue(provider) {
|
|
193
|
-
return (0, shared_helper_1.isObject)(provider) && Object.prototype.hasOwnProperty.call(provider, "useValue");
|
|
194
|
-
}
|
|
195
|
-
isCustomFactory(provider) {
|
|
196
|
-
return !(0, shared_helper_1.isUndefined)(provider.useFactory);
|
|
197
|
-
}
|
|
198
|
-
isCustomUseExisting(provider) {
|
|
199
|
-
return !(0, shared_helper_1.isUndefined)(provider.useExisting);
|
|
200
|
-
}
|
|
201
|
-
isDynamicModule(exported) {
|
|
202
|
-
return exported && exported.module;
|
|
203
|
-
}
|
|
204
|
-
addCustomClass(provider, collection, enhancerSubtype) {
|
|
205
|
-
let { scope, durable } = provider;
|
|
206
|
-
const { useClass } = provider;
|
|
207
|
-
if ((0, shared_helper_1.isUndefined)(scope)) {
|
|
208
|
-
scope = (0, class_scope_helper_1.getClassScope)(useClass);
|
|
209
|
-
}
|
|
210
|
-
if ((0, shared_helper_1.isUndefined)(durable)) {
|
|
211
|
-
durable = (0, is_durable_helper_1.isDurable)(useClass);
|
|
212
|
-
}
|
|
213
|
-
const token = provider.provide;
|
|
214
|
-
collection.set(token, new wrapper_1.InstanceWrapper({
|
|
215
|
-
token,
|
|
216
|
-
name: useClass?.name ?? useClass,
|
|
217
|
-
metatype: useClass,
|
|
218
|
-
instance: null,
|
|
219
|
-
isResolved: false,
|
|
220
|
-
scope,
|
|
221
|
-
durable,
|
|
222
|
-
host: this,
|
|
223
|
-
subtype: enhancerSubtype,
|
|
224
|
-
}));
|
|
225
|
-
}
|
|
226
|
-
addCustomValue(provider, collection, enhancerSubtype) {
|
|
227
|
-
const { useValue: value, provide: providerToken } = provider;
|
|
228
|
-
collection.set(providerToken, new wrapper_1.InstanceWrapper({
|
|
229
|
-
token: providerToken,
|
|
230
|
-
name: providerToken?.name ?? providerToken,
|
|
231
|
-
metatype: null,
|
|
232
|
-
instance: value,
|
|
233
|
-
isResolved: true,
|
|
234
|
-
async: value instanceof Promise,
|
|
235
|
-
host: this,
|
|
236
|
-
subtype: enhancerSubtype,
|
|
237
|
-
}));
|
|
238
|
-
}
|
|
239
|
-
addCustomFactory(provider, collection, enhancerSubtype) {
|
|
240
|
-
const { useFactory: factory, inject, scope, durable, provide: providerToken } = provider;
|
|
241
|
-
collection.set(providerToken, new wrapper_1.InstanceWrapper({
|
|
242
|
-
token: providerToken,
|
|
243
|
-
name: providerToken?.name ?? providerToken,
|
|
244
|
-
metatype: factory,
|
|
245
|
-
instance: null,
|
|
246
|
-
isResolved: false,
|
|
247
|
-
inject: inject || [],
|
|
248
|
-
scope,
|
|
249
|
-
durable,
|
|
250
|
-
host: this,
|
|
251
|
-
subtype: enhancerSubtype,
|
|
252
|
-
}));
|
|
253
|
-
}
|
|
254
|
-
addCustomUseExisting(provider, collection, enhancerSubtype) {
|
|
255
|
-
const { useExisting, provide: providerToken } = provider;
|
|
256
|
-
collection.set(providerToken, new wrapper_1.InstanceWrapper({
|
|
257
|
-
token: providerToken,
|
|
258
|
-
name: providerToken?.name ?? providerToken,
|
|
259
|
-
metatype: ((instance) => instance),
|
|
260
|
-
instance: null,
|
|
261
|
-
isResolved: false,
|
|
262
|
-
inject: [useExisting],
|
|
263
|
-
host: this,
|
|
264
|
-
isAlias: true,
|
|
265
|
-
subtype: enhancerSubtype,
|
|
266
|
-
}));
|
|
267
|
-
}
|
|
268
|
-
addExportedProvider(provider) {
|
|
269
|
-
const addExportedUnit = (token) => this._exports.add(this.validateExportedProvider(token));
|
|
270
|
-
if (this.isCustomProvider(provider)) {
|
|
271
|
-
return this.addCustomExportedProvider(provider);
|
|
272
|
-
}
|
|
273
|
-
else if ((0, shared_helper_1.isString)(provider) || (0, shared_helper_1.isSymbol)(provider)) {
|
|
274
|
-
return addExportedUnit(provider);
|
|
275
|
-
}
|
|
276
|
-
else if (this.isDynamicModule(provider)) {
|
|
277
|
-
const { module: moduleClassRef } = provider;
|
|
278
|
-
return addExportedUnit(moduleClassRef);
|
|
279
|
-
}
|
|
280
|
-
addExportedUnit(provider);
|
|
281
|
-
}
|
|
282
|
-
addCustomExportedProvider(provider) {
|
|
283
|
-
const provide = provider.provide;
|
|
284
|
-
if ((0, shared_helper_1.isString)(provide) || (0, shared_helper_1.isSymbol)(provide)) {
|
|
285
|
-
return this._exports.add(this.validateExportedProvider(provide));
|
|
286
|
-
}
|
|
287
|
-
this._exports.add(this.validateExportedProvider(provide));
|
|
288
|
-
}
|
|
289
|
-
validateExportedProvider(token) {
|
|
290
|
-
if (this._providers.has(token)) {
|
|
291
|
-
return token;
|
|
292
|
-
}
|
|
293
|
-
const imports = Array.from(this._imports.values())
|
|
294
|
-
.filter(Boolean)
|
|
295
|
-
.map(({ metatype }) => metatype)
|
|
296
|
-
.filter(Boolean);
|
|
297
|
-
if (!imports.includes(token)) {
|
|
298
|
-
const { name } = this.metatype;
|
|
299
|
-
const providerName = (0, shared_helper_1.isFunction)(token) ? token.name : token;
|
|
300
|
-
throw new exceptions_1.UnknownExportException(providerName, name);
|
|
301
|
-
}
|
|
302
|
-
return token;
|
|
303
|
-
}
|
|
304
|
-
addImport(moduleRef) {
|
|
305
|
-
this._imports.add(moduleRef);
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* @deprecated
|
|
309
|
-
*/
|
|
310
|
-
addRelatedModule(module) {
|
|
311
|
-
this._imports.add(module);
|
|
312
|
-
}
|
|
313
|
-
replace(toReplace, options) {
|
|
314
|
-
if (options.isProvider && this.hasProvider(toReplace)) {
|
|
315
|
-
const originalProvider = this._providers.get(toReplace);
|
|
316
|
-
return originalProvider.mergeWith({ provide: toReplace, ...options });
|
|
317
|
-
}
|
|
318
|
-
else if (!options.isProvider && this.hasInjectable(toReplace)) {
|
|
319
|
-
const originalInjectable = this._injectables.get(toReplace);
|
|
320
|
-
return originalInjectable.mergeWith({
|
|
321
|
-
provide: toReplace,
|
|
322
|
-
...options,
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
hasProvider(token) {
|
|
327
|
-
return this._providers.has(token);
|
|
328
|
-
}
|
|
329
|
-
hasInjectable(token) {
|
|
330
|
-
return this._injectables.has(token);
|
|
331
|
-
}
|
|
332
|
-
getProviderByKey(name) {
|
|
333
|
-
return this._providers.get(name);
|
|
334
|
-
}
|
|
335
|
-
getProviderById(id) {
|
|
336
|
-
return Array.from(this._providers.values()).find((item) => item.id === id);
|
|
337
|
-
}
|
|
338
|
-
getInjectableById(id) {
|
|
339
|
-
return Array.from(this._injectables.values()).find((item) => item.id === id);
|
|
340
|
-
}
|
|
341
|
-
getNonAliasProviders() {
|
|
342
|
-
return [...this._providers].filter(([_, wrapper]) => !wrapper.isAlias);
|
|
343
|
-
}
|
|
344
|
-
createModuleReferenceType() {
|
|
345
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
346
|
-
const self = this;
|
|
347
|
-
return class extends ref_1.ModuleRef {
|
|
348
|
-
constructor() {
|
|
349
|
-
super(self.container);
|
|
350
|
-
}
|
|
351
|
-
get(typeOrToken, options = {}) {
|
|
352
|
-
options.strict ??= true;
|
|
353
|
-
options.each ??= false;
|
|
354
|
-
return this.find(typeOrToken, options.strict
|
|
355
|
-
? {
|
|
356
|
-
moduleId: self.id,
|
|
357
|
-
each: options.each,
|
|
358
|
-
}
|
|
359
|
-
: options);
|
|
360
|
-
}
|
|
361
|
-
resolve(typeOrToken, contextId = (0, context_id_factory_helper_1.createContextId)(), options = {}) {
|
|
362
|
-
options.strict ??= true;
|
|
363
|
-
options.each ??= false;
|
|
364
|
-
return this.resolvePerContext(typeOrToken, self, contextId, options);
|
|
365
|
-
}
|
|
366
|
-
async create(type, contextId) {
|
|
367
|
-
if (!(type && (0, shared_helper_1.isFunction)(type) && type.prototype)) {
|
|
368
|
-
throw new exceptions_1.InvalidClassException(type);
|
|
369
|
-
}
|
|
370
|
-
return this.instantiateClass(type, self, contextId);
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
isEntryProvider(metatype) {
|
|
375
|
-
return typeof metatype === "function" ? !!Reflect.getMetadata(constants_1.ENTRY_PROVIDER_WATERMARK, metatype) : false;
|
|
376
|
-
}
|
|
377
|
-
generateUuid() {
|
|
378
|
-
const prefix = "M_";
|
|
379
|
-
const key = this.name?.toString() ?? this.token?.toString();
|
|
380
|
-
return key ? uuid_helper_1.UuidFactory.get(`${prefix}_${key}`) : (0, random_string_generator_helper_1.randomStringGenerator)();
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
exports.Module = Module;
|
package/injector/module/ref.d.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { Injector } from "@venok/core/injector/injector";
|
|
2
|
-
import { Type } from "@venok/core/interfaces";
|
|
3
|
-
import { ContextId } from "@venok/core/injector/instance/wrapper";
|
|
4
|
-
import { IntrospectionResult } from "@venok/core/interfaces/modules";
|
|
5
|
-
import { Module } from "@venok/core/injector/module/module";
|
|
6
|
-
import { AbstractInstanceResolver } from "@venok/core/injector/instance/resolver";
|
|
7
|
-
import { InstanceLinksHost } from "@venok/core/injector/instance/links-host";
|
|
8
|
-
import { VenokContainer } from "@venok/core/injector/container";
|
|
9
|
-
export interface ModuleRefGetOrResolveOpts {
|
|
10
|
-
/**
|
|
11
|
-
* If enabled, lookup will only be performed in the host module.
|
|
12
|
-
* @default true
|
|
13
|
-
*/
|
|
14
|
-
strict?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* If enabled, instead of returning a first instance registered under a given token,
|
|
17
|
-
* a list of instances will be returned.
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
each?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export declare abstract class ModuleRef extends AbstractInstanceResolver {
|
|
23
|
-
protected readonly container: VenokContainer;
|
|
24
|
-
protected readonly injector: Injector;
|
|
25
|
-
private _instanceLinksHost;
|
|
26
|
-
protected get instanceLinksHost(): InstanceLinksHost;
|
|
27
|
-
constructor(container: VenokContainer);
|
|
28
|
-
/**
|
|
29
|
-
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
30
|
-
* @returns {TResult}
|
|
31
|
-
*/
|
|
32
|
-
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): TResult;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
35
|
-
* @returns {TResult}
|
|
36
|
-
*/
|
|
37
|
-
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
38
|
-
/**
|
|
39
|
-
* If enabled, lookup will only be performed in the host module.
|
|
40
|
-
* @default true
|
|
41
|
-
*/
|
|
42
|
-
strict?: boolean;
|
|
43
|
-
/** This indicates that only the first instance registered will be returned. */
|
|
44
|
-
each?: undefined | false;
|
|
45
|
-
}): TResult;
|
|
46
|
-
/**
|
|
47
|
-
* Retrieves a list of instances of either injectables or controllers, otherwise, throws exception.
|
|
48
|
-
* @returns {Array<TResult>}
|
|
49
|
-
*/
|
|
50
|
-
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
51
|
-
/**
|
|
52
|
-
* If enabled, lookup will only be performed in the host module.
|
|
53
|
-
* @default true
|
|
54
|
-
*/
|
|
55
|
-
strict?: boolean;
|
|
56
|
-
/** This indicates that a list of instances will be returned. */
|
|
57
|
-
each: true;
|
|
58
|
-
}): Array<TResult>;
|
|
59
|
-
/**
|
|
60
|
-
* Retrieves an instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
61
|
-
* @returns {TResult | Array<TResult>}
|
|
62
|
-
*/
|
|
63
|
-
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options?: ModuleRefGetOrResolveOpts): TResult | Array<TResult>;
|
|
64
|
-
/**
|
|
65
|
-
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
66
|
-
* @returns {Array<TResult>}
|
|
67
|
-
*/
|
|
68
|
-
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): Promise<TResult>;
|
|
69
|
-
/**
|
|
70
|
-
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
71
|
-
* @returns {Array<TResult>}
|
|
72
|
-
*/
|
|
73
|
-
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
74
|
-
id: number;
|
|
75
|
-
}): Promise<TResult>;
|
|
76
|
-
/**
|
|
77
|
-
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
78
|
-
* @returns {Array<TResult>}
|
|
79
|
-
*/
|
|
80
|
-
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
81
|
-
id: number;
|
|
82
|
-
}, options?: {
|
|
83
|
-
strict?: boolean;
|
|
84
|
-
each?: undefined | false;
|
|
85
|
-
}): Promise<TResult>;
|
|
86
|
-
/**
|
|
87
|
-
* Resolves transient or request-scoped instances of either injectables or controllers, otherwise, throws exception.
|
|
88
|
-
* @returns {Array<TResult>}
|
|
89
|
-
*/
|
|
90
|
-
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
91
|
-
id: number;
|
|
92
|
-
}, options?: {
|
|
93
|
-
strict?: boolean;
|
|
94
|
-
each: true;
|
|
95
|
-
}): Promise<Array<TResult>>;
|
|
96
|
-
/**
|
|
97
|
-
* Resolves transient or request-scoped instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
98
|
-
* @returns {Promise<TResult | Array<TResult>>}
|
|
99
|
-
*/
|
|
100
|
-
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
101
|
-
id: number;
|
|
102
|
-
}, options?: ModuleRefGetOrResolveOpts): Promise<TResult | Array<TResult>>;
|
|
103
|
-
abstract create<T = any>(type: Type<T>, contextId?: ContextId): Promise<T>;
|
|
104
|
-
introspect<T = any>(token: Type<T> | string | symbol): IntrospectionResult;
|
|
105
|
-
protected instantiateClass<T = any>(type: Type<T>, moduleRef: Module, contextId?: ContextId): Promise<T>;
|
|
106
|
-
}
|
package/injector/module/ref.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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;
|