@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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else
|
|
7
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
8
|
+
if (d = decorators[i])
|
|
9
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
13
|
+
var __legacyMetadataTS = (k, v) => {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
return Reflect.metadata(k, v);
|
|
16
|
+
};
|
|
17
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
|
+
|
|
19
|
+
// packages/core/src/injector/instance/resolver.ts
|
|
20
|
+
import { InvalidClassScopeException } from "../../errors/exceptions/invalid-class-scope.exception.js";
|
|
21
|
+
import { UnknownElementException } from "../../errors/exceptions/unknown-element.exception.js";
|
|
22
|
+
import { Scope } from "../../enums/scope.enum.js";
|
|
23
|
+
|
|
24
|
+
class AbstractInstanceResolver {
|
|
25
|
+
find(typeOrToken, options) {
|
|
26
|
+
const instanceLinkOrArray = this.instanceLinksHost.get(typeOrToken, options);
|
|
27
|
+
const pluckInstance = ({ wrapperRef }) => {
|
|
28
|
+
if (wrapperRef.scope === Scope.REQUEST || wrapperRef.scope === Scope.TRANSIENT)
|
|
29
|
+
throw new InvalidClassScopeException(typeOrToken);
|
|
30
|
+
return wrapperRef.instance;
|
|
31
|
+
};
|
|
32
|
+
if (Array.isArray(instanceLinkOrArray))
|
|
33
|
+
return instanceLinkOrArray.map(pluckInstance);
|
|
34
|
+
return pluckInstance(instanceLinkOrArray);
|
|
35
|
+
}
|
|
36
|
+
async resolvePerContext(typeOrToken, contextModule, contextId, options) {
|
|
37
|
+
const instanceLinkOrArray = options?.strict ? this.instanceLinksHost.get(typeOrToken, {
|
|
38
|
+
moduleId: contextModule.id,
|
|
39
|
+
each: options.each
|
|
40
|
+
}) : this.instanceLinksHost.get(typeOrToken, {
|
|
41
|
+
each: options?.each ? options.each : false
|
|
42
|
+
});
|
|
43
|
+
const pluckInstance = async (instanceLink) => {
|
|
44
|
+
const { wrapperRef, collection } = instanceLink;
|
|
45
|
+
if (wrapperRef.isDependencyTreeStatic() && !wrapperRef.isTransient)
|
|
46
|
+
return this.get(typeOrToken, { strict: options?.strict });
|
|
47
|
+
const ctorHost = wrapperRef.instance || { constructor: typeOrToken };
|
|
48
|
+
const instance = await this.injector.loadPerContext(ctorHost, wrapperRef.host, collection, contextId, wrapperRef);
|
|
49
|
+
if (!instance)
|
|
50
|
+
throw new UnknownElementException;
|
|
51
|
+
return instance;
|
|
52
|
+
};
|
|
53
|
+
if (Array.isArray(instanceLinkOrArray)) {
|
|
54
|
+
return Promise.all(instanceLinkOrArray.map((instanceLink) => pluckInstance(instanceLink)));
|
|
55
|
+
}
|
|
56
|
+
return pluckInstance(instanceLinkOrArray);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
AbstractInstanceResolver
|
|
61
|
+
};
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else
|
|
7
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
8
|
+
if (d = decorators[i])
|
|
9
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
13
|
+
var __legacyMetadataTS = (k, v) => {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
return Reflect.metadata(k, v);
|
|
16
|
+
};
|
|
17
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
|
+
|
|
19
|
+
// packages/core/src/injector/instance/wrapper.ts
|
|
20
|
+
import { isClassProvider, isFactoryProvider, isValueProvider } from "../../injector/helpers/classifier.helper.js";
|
|
21
|
+
import { STATIC_CONTEXT } from "../../injector/constants.js";
|
|
22
|
+
import { colors } from "../../helpers/color.helper.js";
|
|
23
|
+
import { isNull, isString, isUndefined } from "../../helpers/shared.helper.js";
|
|
24
|
+
import { randomStringGenerator } from "../../helpers/random-string-generator.helper.js";
|
|
25
|
+
import { UuidFactory } from "../../helpers/uuid.helper.js";
|
|
26
|
+
import { Logger } from "../../services/logger.service.js";
|
|
27
|
+
import { Scope } from "../../enums/scope.enum.js";
|
|
28
|
+
var INSTANCE_METADATA_SYMBOL = Symbol.for("instance_metadata:cache");
|
|
29
|
+
var INSTANCE_ID_SYMBOL = Symbol.for("instance_metadata:id");
|
|
30
|
+
|
|
31
|
+
class InstanceWrapper {
|
|
32
|
+
isAlias = false;
|
|
33
|
+
scope = Scope.DEFAULT;
|
|
34
|
+
name;
|
|
35
|
+
token;
|
|
36
|
+
async;
|
|
37
|
+
host;
|
|
38
|
+
subtype;
|
|
39
|
+
metatype;
|
|
40
|
+
inject;
|
|
41
|
+
forwardRef;
|
|
42
|
+
durable;
|
|
43
|
+
initTime;
|
|
44
|
+
settlementSignal;
|
|
45
|
+
static logger = new Logger(InstanceWrapper.name);
|
|
46
|
+
values = new WeakMap;
|
|
47
|
+
[INSTANCE_METADATA_SYMBOL] = {};
|
|
48
|
+
[INSTANCE_ID_SYMBOL];
|
|
49
|
+
transientMap = new Map;
|
|
50
|
+
isTreeStatic;
|
|
51
|
+
isTreeDurable;
|
|
52
|
+
rootInquirer;
|
|
53
|
+
constructor(metadata = {}) {
|
|
54
|
+
this.initialize(metadata);
|
|
55
|
+
this[INSTANCE_ID_SYMBOL] = metadata[INSTANCE_ID_SYMBOL] ?? this.generateUuid();
|
|
56
|
+
}
|
|
57
|
+
get id() {
|
|
58
|
+
return this[INSTANCE_ID_SYMBOL];
|
|
59
|
+
}
|
|
60
|
+
set instance(value) {
|
|
61
|
+
this.values.set(STATIC_CONTEXT, { instance: value });
|
|
62
|
+
}
|
|
63
|
+
get instance() {
|
|
64
|
+
const instancePerContext = this.getInstanceByContextId(STATIC_CONTEXT);
|
|
65
|
+
return instancePerContext.instance;
|
|
66
|
+
}
|
|
67
|
+
get isNotMetatype() {
|
|
68
|
+
return !this.metatype || this.isFactory;
|
|
69
|
+
}
|
|
70
|
+
get isFactory() {
|
|
71
|
+
return !!(this.metatype && !isNull(this.inject));
|
|
72
|
+
}
|
|
73
|
+
get isTransient() {
|
|
74
|
+
return this.scope === Scope.TRANSIENT;
|
|
75
|
+
}
|
|
76
|
+
getInstanceByContextId(contextId, inquirerId) {
|
|
77
|
+
if (this.scope === Scope.TRANSIENT && inquirerId) {
|
|
78
|
+
return this.getInstanceByInquirerId(contextId, inquirerId);
|
|
79
|
+
}
|
|
80
|
+
const instancePerContext = this.values.get(contextId);
|
|
81
|
+
return instancePerContext ? instancePerContext : contextId !== STATIC_CONTEXT ? this.cloneStaticInstance(contextId) : {
|
|
82
|
+
instance: null,
|
|
83
|
+
isResolved: true,
|
|
84
|
+
isPending: false
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
getInstanceByInquirerId(contextId, inquirerId) {
|
|
88
|
+
let collectionPerContext = this.transientMap.get(inquirerId);
|
|
89
|
+
if (!collectionPerContext) {
|
|
90
|
+
collectionPerContext = new WeakMap;
|
|
91
|
+
this.transientMap.set(inquirerId, collectionPerContext);
|
|
92
|
+
}
|
|
93
|
+
const instancePerContext = collectionPerContext.get(contextId);
|
|
94
|
+
return instancePerContext ? instancePerContext : this.cloneTransientInstance(contextId, inquirerId);
|
|
95
|
+
}
|
|
96
|
+
setInstanceByContextId(contextId, value, inquirerId) {
|
|
97
|
+
if (this.scope === Scope.TRANSIENT && inquirerId) {
|
|
98
|
+
return this.setInstanceByInquirerId(contextId, inquirerId, value);
|
|
99
|
+
}
|
|
100
|
+
this.values.set(contextId, value);
|
|
101
|
+
}
|
|
102
|
+
setInstanceByInquirerId(contextId, inquirerId, value) {
|
|
103
|
+
let collection = this.transientMap.get(inquirerId);
|
|
104
|
+
if (!collection) {
|
|
105
|
+
collection = new WeakMap;
|
|
106
|
+
this.transientMap.set(inquirerId, collection);
|
|
107
|
+
}
|
|
108
|
+
collection.set(contextId, value);
|
|
109
|
+
}
|
|
110
|
+
removeInstanceByContextId(contextId, inquirerId) {
|
|
111
|
+
if (this.scope === Scope.TRANSIENT && inquirerId) {
|
|
112
|
+
return this.removeInstanceByInquirerId(contextId, inquirerId);
|
|
113
|
+
}
|
|
114
|
+
this.values.delete(contextId);
|
|
115
|
+
}
|
|
116
|
+
removeInstanceByInquirerId(contextId, inquirerId) {
|
|
117
|
+
const collection = this.transientMap.get(inquirerId);
|
|
118
|
+
if (!collection)
|
|
119
|
+
return;
|
|
120
|
+
collection.delete(contextId);
|
|
121
|
+
}
|
|
122
|
+
addCtorMetadata(index, wrapper) {
|
|
123
|
+
if (!this[INSTANCE_METADATA_SYMBOL].dependencies) {
|
|
124
|
+
this[INSTANCE_METADATA_SYMBOL].dependencies = [];
|
|
125
|
+
}
|
|
126
|
+
this[INSTANCE_METADATA_SYMBOL].dependencies[index] = wrapper;
|
|
127
|
+
}
|
|
128
|
+
getCtorMetadata() {
|
|
129
|
+
return this[INSTANCE_METADATA_SYMBOL].dependencies ?? [];
|
|
130
|
+
}
|
|
131
|
+
addPropertiesMetadata(key, wrapper) {
|
|
132
|
+
if (!this[INSTANCE_METADATA_SYMBOL].properties) {
|
|
133
|
+
this[INSTANCE_METADATA_SYMBOL].properties = [];
|
|
134
|
+
}
|
|
135
|
+
this[INSTANCE_METADATA_SYMBOL].properties.push({
|
|
136
|
+
key,
|
|
137
|
+
wrapper
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
getPropertiesMetadata() {
|
|
141
|
+
return this[INSTANCE_METADATA_SYMBOL].properties ?? [];
|
|
142
|
+
}
|
|
143
|
+
addEnhancerMetadata(wrapper) {
|
|
144
|
+
if (!this[INSTANCE_METADATA_SYMBOL].enhancers) {
|
|
145
|
+
this[INSTANCE_METADATA_SYMBOL].enhancers = [];
|
|
146
|
+
}
|
|
147
|
+
this[INSTANCE_METADATA_SYMBOL].enhancers.push(wrapper);
|
|
148
|
+
}
|
|
149
|
+
getEnhancersMetadata() {
|
|
150
|
+
return this[INSTANCE_METADATA_SYMBOL].enhancers ?? [];
|
|
151
|
+
}
|
|
152
|
+
isDependencyTreeDurable(lookupRegistry = []) {
|
|
153
|
+
if (!isUndefined(this.isTreeDurable)) {
|
|
154
|
+
return this.isTreeDurable;
|
|
155
|
+
}
|
|
156
|
+
if (this.scope === Scope.REQUEST) {
|
|
157
|
+
this.isTreeDurable = this.durable === undefined ? false : this.durable;
|
|
158
|
+
if (this.isTreeDurable) {
|
|
159
|
+
this.printIntrospectedAsDurable();
|
|
160
|
+
}
|
|
161
|
+
return this.isTreeDurable;
|
|
162
|
+
}
|
|
163
|
+
const isStatic = this.isDependencyTreeStatic();
|
|
164
|
+
if (isStatic)
|
|
165
|
+
return false;
|
|
166
|
+
const isTreeNonDurable = this.introspectDepsAttribute((collection, registry) => collection.some((item) => !item.isDependencyTreeStatic() && !item.isDependencyTreeDurable(registry)), lookupRegistry);
|
|
167
|
+
this.isTreeDurable = !isTreeNonDurable;
|
|
168
|
+
if (this.isTreeDurable)
|
|
169
|
+
this.printIntrospectedAsDurable();
|
|
170
|
+
return this.isTreeDurable;
|
|
171
|
+
}
|
|
172
|
+
introspectDepsAttribute(callback, lookupRegistry = []) {
|
|
173
|
+
if (lookupRegistry.includes(this[INSTANCE_ID_SYMBOL])) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
lookupRegistry = lookupRegistry.concat(this[INSTANCE_ID_SYMBOL]);
|
|
177
|
+
const { dependencies, properties, enhancers } = this[INSTANCE_METADATA_SYMBOL];
|
|
178
|
+
let introspectionResult = dependencies ? callback(dependencies, lookupRegistry) : false;
|
|
179
|
+
if (introspectionResult || !(properties || enhancers))
|
|
180
|
+
return introspectionResult;
|
|
181
|
+
introspectionResult = properties ? callback(properties.map((item) => item.wrapper), lookupRegistry) : false;
|
|
182
|
+
if (introspectionResult || !enhancers)
|
|
183
|
+
return introspectionResult;
|
|
184
|
+
return enhancers ? callback(enhancers, lookupRegistry) : false;
|
|
185
|
+
}
|
|
186
|
+
isDependencyTreeStatic(lookupRegistry = []) {
|
|
187
|
+
if (!isUndefined(this.isTreeStatic))
|
|
188
|
+
return this.isTreeStatic;
|
|
189
|
+
if (this.scope === Scope.REQUEST) {
|
|
190
|
+
this.isTreeStatic = false;
|
|
191
|
+
this.printIntrospectedAsRequestScoped();
|
|
192
|
+
return this.isTreeStatic;
|
|
193
|
+
}
|
|
194
|
+
this.isTreeStatic = !this.introspectDepsAttribute((collection, registry) => collection.some((item) => !item.isDependencyTreeStatic(registry)), lookupRegistry);
|
|
195
|
+
if (!this.isTreeStatic)
|
|
196
|
+
this.printIntrospectedAsRequestScoped();
|
|
197
|
+
return this.isTreeStatic;
|
|
198
|
+
}
|
|
199
|
+
cloneStaticInstance(contextId) {
|
|
200
|
+
const staticInstance = this.getInstanceByContextId(STATIC_CONTEXT);
|
|
201
|
+
if (this.isDependencyTreeStatic())
|
|
202
|
+
return staticInstance;
|
|
203
|
+
const instancePerContext = {
|
|
204
|
+
...staticInstance,
|
|
205
|
+
instance: undefined,
|
|
206
|
+
isResolved: false,
|
|
207
|
+
isPending: false
|
|
208
|
+
};
|
|
209
|
+
if (this.isNewable())
|
|
210
|
+
instancePerContext.instance = Object.create(this.metatype.prototype);
|
|
211
|
+
this.setInstanceByContextId(contextId, instancePerContext);
|
|
212
|
+
return instancePerContext;
|
|
213
|
+
}
|
|
214
|
+
cloneTransientInstance(contextId, inquirerId) {
|
|
215
|
+
const staticInstance = this.getInstanceByContextId(STATIC_CONTEXT);
|
|
216
|
+
const instancePerContext = {
|
|
217
|
+
...staticInstance,
|
|
218
|
+
instance: undefined,
|
|
219
|
+
isResolved: false,
|
|
220
|
+
isPending: false
|
|
221
|
+
};
|
|
222
|
+
if (this.isNewable()) {
|
|
223
|
+
instancePerContext.instance = Object.create(this.metatype.prototype);
|
|
224
|
+
}
|
|
225
|
+
this.setInstanceByInquirerId(contextId, inquirerId, instancePerContext);
|
|
226
|
+
return instancePerContext;
|
|
227
|
+
}
|
|
228
|
+
createPrototype(contextId) {
|
|
229
|
+
const host = this.getInstanceByContextId(contextId);
|
|
230
|
+
if (!this.isNewable() || host.isResolved)
|
|
231
|
+
return;
|
|
232
|
+
return Object.create(this.metatype.prototype);
|
|
233
|
+
}
|
|
234
|
+
isInRequestScope(contextId, inquirer) {
|
|
235
|
+
const isDependencyTreeStatic = this.isDependencyTreeStatic();
|
|
236
|
+
return !isDependencyTreeStatic && contextId !== STATIC_CONTEXT && (!this.isTransient || this.isTransient && !!inquirer);
|
|
237
|
+
}
|
|
238
|
+
isLazyTransient(contextId, inquirer) {
|
|
239
|
+
const isInquirerRequestScoped = inquirer && !inquirer.isDependencyTreeStatic();
|
|
240
|
+
return this.isDependencyTreeStatic() && contextId !== STATIC_CONTEXT && this.isTransient && !!isInquirerRequestScoped;
|
|
241
|
+
}
|
|
242
|
+
isExplicitlyRequested(contextId, inquirer) {
|
|
243
|
+
const isSelfRequested = inquirer === this;
|
|
244
|
+
return this.isDependencyTreeStatic() && contextId !== STATIC_CONTEXT && !!(isSelfRequested || inquirer && inquirer.scope === Scope.TRANSIENT);
|
|
245
|
+
}
|
|
246
|
+
isStatic(contextId, inquirer) {
|
|
247
|
+
const isInquirerRequestScoped = inquirer && !inquirer.isDependencyTreeStatic();
|
|
248
|
+
const isStaticTransient = this.isTransient && !isInquirerRequestScoped;
|
|
249
|
+
const rootInquirer = inquirer?.getRootInquirer();
|
|
250
|
+
return this.isDependencyTreeStatic() && contextId === STATIC_CONTEXT && (!this.isTransient || isStaticTransient && !!inquirer && !inquirer.isTransient || isStaticTransient && !!rootInquirer && !rootInquirer.isTransient);
|
|
251
|
+
}
|
|
252
|
+
attachRootInquirer(inquirer) {
|
|
253
|
+
if (!this.isTransient)
|
|
254
|
+
return;
|
|
255
|
+
this.rootInquirer = inquirer.getRootInquirer() ?? inquirer;
|
|
256
|
+
}
|
|
257
|
+
getRootInquirer() {
|
|
258
|
+
return this.rootInquirer;
|
|
259
|
+
}
|
|
260
|
+
getStaticTransientInstances() {
|
|
261
|
+
if (!this.transientMap)
|
|
262
|
+
return [];
|
|
263
|
+
const instances = [...this.transientMap.values()];
|
|
264
|
+
return instances.map((item) => item.get(STATIC_CONTEXT)).filter((item) => {
|
|
265
|
+
return !!(item && item.isConstructorCalled);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
mergeWith(provider) {
|
|
269
|
+
if (isValueProvider(provider)) {
|
|
270
|
+
this.metatype = null;
|
|
271
|
+
this.inject = null;
|
|
272
|
+
this.scope = Scope.DEFAULT;
|
|
273
|
+
this.setInstanceByContextId(STATIC_CONTEXT, {
|
|
274
|
+
instance: provider.useValue,
|
|
275
|
+
isResolved: true,
|
|
276
|
+
isPending: false
|
|
277
|
+
});
|
|
278
|
+
} else if (isClassProvider(provider)) {
|
|
279
|
+
this.inject = null;
|
|
280
|
+
this.metatype = provider.useClass;
|
|
281
|
+
} else if (isFactoryProvider(provider)) {
|
|
282
|
+
this.metatype = provider.useFactory;
|
|
283
|
+
this.inject = provider.inject || [];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
isNewable() {
|
|
287
|
+
return isNull(this.inject) && this.metatype && this.metatype.prototype;
|
|
288
|
+
}
|
|
289
|
+
initialize(metadata) {
|
|
290
|
+
const { instance, isResolved, ...wrapperPartial } = metadata;
|
|
291
|
+
Object.assign(this, wrapperPartial);
|
|
292
|
+
this.setInstanceByContextId(STATIC_CONTEXT, { instance, isResolved });
|
|
293
|
+
this.scope === Scope.TRANSIENT && (this.transientMap = new Map);
|
|
294
|
+
}
|
|
295
|
+
printIntrospectedAsRequestScoped() {
|
|
296
|
+
if (!this.isDebugMode() || this.name === "REQUEST") {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (isString(this.name)) {
|
|
300
|
+
InstanceWrapper.logger.log(`${colors.cyanBright(this.name)}${colors.green(" introspected as ")}${colors.magentaBright("request-scoped")}`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
printIntrospectedAsDurable() {
|
|
304
|
+
if (!this.isDebugMode()) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (isString(this.name)) {
|
|
308
|
+
InstanceWrapper.logger.log(`${colors.cyanBright(this.name)}${colors.green(" introspected as ")}${colors.magentaBright("durable")}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
isDebugMode() {
|
|
312
|
+
return !!process.env.VENOK_DEBUG;
|
|
313
|
+
}
|
|
314
|
+
generateUuid() {
|
|
315
|
+
let key = this.name?.toString() ?? this.token?.toString();
|
|
316
|
+
key += this.host?.name ?? "";
|
|
317
|
+
return key ? UuidFactory.get(key) : randomStringGenerator();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
export {
|
|
321
|
+
InstanceWrapper,
|
|
322
|
+
INSTANCE_METADATA_SYMBOL,
|
|
323
|
+
INSTANCE_ID_SYMBOL
|
|
324
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else
|
|
7
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
8
|
+
if (d = decorators[i])
|
|
9
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
13
|
+
var __legacyMetadataTS = (k, v) => {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
return Reflect.metadata(k, v);
|
|
16
|
+
};
|
|
17
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
|
+
|
|
19
|
+
// packages/core/src/injector/internal-core-module/core-providers.ts
|
|
20
|
+
import { INQUIRER, REQUEST } from "../../constants.js";
|
|
21
|
+
import { Reflector } from "../../services/reflector.service.js";
|
|
22
|
+
import { noop } from "../../helpers/noop.helper.js";
|
|
23
|
+
import { Scope } from "../../enums/scope.enum.js";
|
|
24
|
+
var ReflectorAliasProvider = {
|
|
25
|
+
provide: Reflector.name,
|
|
26
|
+
useExisting: Reflector
|
|
27
|
+
};
|
|
28
|
+
var requestProvider = {
|
|
29
|
+
provide: REQUEST,
|
|
30
|
+
scope: Scope.REQUEST,
|
|
31
|
+
useFactory: noop
|
|
32
|
+
};
|
|
33
|
+
var inquirerProvider = {
|
|
34
|
+
provide: INQUIRER,
|
|
35
|
+
scope: Scope.TRANSIENT,
|
|
36
|
+
useFactory: noop
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
requestProvider,
|
|
40
|
+
inquirerProvider,
|
|
41
|
+
ReflectorAliasProvider
|
|
42
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else
|
|
7
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
8
|
+
if (d = decorators[i])
|
|
9
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
13
|
+
var __legacyMetadataTS = (k, v) => {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
return Reflect.metadata(k, v);
|
|
16
|
+
};
|
|
17
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
|
+
|
|
19
|
+
// packages/core/src/injector/internal-core-module/internal-core-module-factory.ts
|
|
20
|
+
import { Injector } from "../../injector/injector.js";
|
|
21
|
+
import { LazyModuleLoader } from "../../injector/module/lazy/loader.js";
|
|
22
|
+
import { ModulesContainer } from "../../injector/module/container.js";
|
|
23
|
+
import { VenokContainer } from "../../injector/container.js";
|
|
24
|
+
import { InternalCoreModule } from "../../injector/internal-core-module/internal-core-module.js";
|
|
25
|
+
import { InstanceLoader } from "../../injector/instance/loader.js";
|
|
26
|
+
import { SerializedGraph } from "../../inspector/serialized-graph.js";
|
|
27
|
+
import { VenokContextCreator } from "../../context/context.js";
|
|
28
|
+
import { Logger } from "../../services/logger.service.js";
|
|
29
|
+
|
|
30
|
+
class InternalCoreModuleFactory {
|
|
31
|
+
static create(container, scanner, moduleCompiler, graphInspector, moduleOverrides) {
|
|
32
|
+
const lazyModuleLoaderFactory = () => {
|
|
33
|
+
const logger = new Logger(LazyModuleLoader.name, {
|
|
34
|
+
timestamp: false
|
|
35
|
+
});
|
|
36
|
+
const injector = new Injector;
|
|
37
|
+
const instanceLoader = new InstanceLoader(container, injector, graphInspector, logger);
|
|
38
|
+
return new LazyModuleLoader(scanner, instanceLoader, moduleCompiler, container.getModules(), moduleOverrides);
|
|
39
|
+
};
|
|
40
|
+
return InternalCoreModule.register([
|
|
41
|
+
{
|
|
42
|
+
provide: VenokContainer,
|
|
43
|
+
useValue: container
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
provide: VenokContextCreator,
|
|
47
|
+
useValue: VenokContextCreator.fromContainer(container)
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
provide: ModulesContainer,
|
|
51
|
+
useValue: container.getModules()
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
provide: LazyModuleLoader,
|
|
55
|
+
useFactory: lazyModuleLoaderFactory
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
provide: SerializedGraph,
|
|
59
|
+
useValue: container.serializedGraph
|
|
60
|
+
}
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
InternalCoreModuleFactory
|
|
66
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else
|
|
7
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
8
|
+
if (d = decorators[i])
|
|
9
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
13
|
+
var __legacyMetadataTS = (k, v) => {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
return Reflect.metadata(k, v);
|
|
16
|
+
};
|
|
17
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
|
+
|
|
19
|
+
// packages/core/src/injector/internal-core-module/internal-core-module.ts
|
|
20
|
+
import {
|
|
21
|
+
inquirerProvider,
|
|
22
|
+
ReflectorAliasProvider,
|
|
23
|
+
requestProvider
|
|
24
|
+
} from "../../injector/internal-core-module/core-providers.js";
|
|
25
|
+
import { Global } from "../../decorators/global.decorator.js";
|
|
26
|
+
import { Module } from "../../decorators/module.decorator.js";
|
|
27
|
+
import { Reflector } from "../../services/reflector.service.js";
|
|
28
|
+
class InternalCoreModule {
|
|
29
|
+
static register(providers) {
|
|
30
|
+
return {
|
|
31
|
+
module: InternalCoreModule,
|
|
32
|
+
providers: [...providers],
|
|
33
|
+
exports: [...providers.map((item) => item.provide)]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
InternalCoreModule = __legacyDecorateClassTS([
|
|
38
|
+
Global(),
|
|
39
|
+
Module({
|
|
40
|
+
providers: [Reflector, ReflectorAliasProvider, requestProvider, inquirerProvider],
|
|
41
|
+
exports: [Reflector, ReflectorAliasProvider, requestProvider, inquirerProvider]
|
|
42
|
+
})
|
|
43
|
+
], InternalCoreModule);
|
|
44
|
+
export {
|
|
45
|
+
InternalCoreModule
|
|
46
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else
|
|
7
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
8
|
+
if (d = decorators[i])
|
|
9
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
13
|
+
var __legacyMetadataTS = (k, v) => {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
return Reflect.metadata(k, v);
|
|
16
|
+
};
|
|
17
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
|
+
|
|
19
|
+
// packages/core/src/injector/module/compiler.ts
|
|
20
|
+
import { TokenFactory } from "../../injector/module/token-factory.js";
|
|
21
|
+
|
|
22
|
+
class ModuleCompiler {
|
|
23
|
+
moduleTokenFactory;
|
|
24
|
+
constructor(moduleTokenFactory = new TokenFactory) {
|
|
25
|
+
this.moduleTokenFactory = moduleTokenFactory;
|
|
26
|
+
}
|
|
27
|
+
async compile(metatype) {
|
|
28
|
+
const { type, dynamicMetadata } = this.extractMetadata(await metatype);
|
|
29
|
+
const token = this.moduleTokenFactory.create(type, dynamicMetadata);
|
|
30
|
+
return { type, dynamicMetadata, token };
|
|
31
|
+
}
|
|
32
|
+
extractMetadata(metatype) {
|
|
33
|
+
if (!this.isDynamicModule(metatype)) {
|
|
34
|
+
return {
|
|
35
|
+
type: metatype?.forwardRef ? metatype.forwardRef() : metatype
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const { module: type, ...dynamicMetadata } = metatype;
|
|
39
|
+
return { type, dynamicMetadata };
|
|
40
|
+
}
|
|
41
|
+
isDynamicModule(module) {
|
|
42
|
+
return !!module.module;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
ModuleCompiler
|
|
47
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else
|
|
7
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
8
|
+
if (d = decorators[i])
|
|
9
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
13
|
+
var __legacyMetadataTS = (k, v) => {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
return Reflect.metadata(k, v);
|
|
16
|
+
};
|
|
17
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
|
+
|
|
19
|
+
// packages/core/src/injector/module/container.ts
|
|
20
|
+
import { uid } from "uid";
|
|
21
|
+
|
|
22
|
+
class ModulesContainer extends Map {
|
|
23
|
+
#applicationId = uid(21);
|
|
24
|
+
get applicationId() {
|
|
25
|
+
return this.#applicationId;
|
|
26
|
+
}
|
|
27
|
+
getById(id) {
|
|
28
|
+
return Array.from(this.values()).find((moduleRef) => moduleRef.id === id);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
ModulesContainer
|
|
33
|
+
};
|