@venok/core 1.0.1-canary.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application/config.js +92 -0
- package/dist/application/context.js +252 -0
- package/dist/application/factory.js +136 -0
- package/dist/constants.js +100 -0
- package/dist/context/context-id.factory.js +58 -0
- package/dist/context/context.js +186 -0
- package/dist/context/creator.js +49 -0
- package/dist/context/execution-host.js +51 -0
- package/dist/context/proxy.js +55 -0
- package/dist/decorators/apply.decorator.js +33 -0
- package/dist/decorators/bind.decorator.js +28 -0
- package/dist/decorators/catch.decorator.js +29 -0
- package/dist/decorators/dependencies.decorator.js +30 -0
- package/dist/decorators/exception-filters.decorator.js +40 -0
- package/dist/decorators/global.decorator.js +28 -0
- package/dist/decorators/inject.decorator.js +42 -0
- package/dist/decorators/injectable.decorator.js +38 -0
- package/dist/decorators/module.decorator.js +42 -0
- package/dist/decorators/optional.decorator.js +35 -0
- package/dist/decorators/set-metadata.decorator.js +35 -0
- package/dist/decorators/use-guards.decorator.js +39 -0
- package/dist/decorators/use-interceptors.decorator.js +39 -0
- package/dist/decorators/use-pipes.decorator.js +38 -0
- package/dist/enums/scope.enum.js +28 -0
- package/dist/enums/shutdown-signal.enum.js +36 -0
- package/dist/errors/exceptions/circular-dependency.exception.js +30 -0
- package/dist/errors/exceptions/invalid-class-module.exception.js +30 -0
- package/dist/errors/exceptions/invalid-class-scope.exception.js +33 -0
- package/dist/errors/exceptions/invalid-class.exception.js +30 -0
- package/dist/errors/exceptions/invalid-exception-filter.exception.js +30 -0
- package/dist/errors/exceptions/invalid-module.exception.js +30 -0
- package/dist/errors/exceptions/runtime.exception.js +30 -0
- package/dist/errors/exceptions/undefined-dependency.exception.js +30 -0
- package/dist/errors/exceptions/undefined-forwardref.exception.js +30 -0
- package/dist/errors/exceptions/undefined-module.exception.js +30 -0
- package/dist/errors/exceptions/unknown-dependencies.exception.js +38 -0
- package/dist/errors/exceptions/unknown-element.exception.js +31 -0
- package/dist/errors/exceptions/unknown-export.exception.js +30 -0
- package/dist/errors/exceptions/unknown-module.exception.js +29 -0
- package/dist/errors/messages.js +134 -0
- package/dist/exceptions/handler.js +53 -0
- package/dist/exceptions/zone/handler.js +30 -0
- package/dist/exceptions/zone/zone.js +49 -0
- package/dist/filters/context-creator.js +65 -0
- package/dist/filters/context.js +58 -0
- package/dist/filters/filter.js +36 -0
- package/dist/guards/consumer.js +54 -0
- package/dist/guards/context-creator.js +76 -0
- package/dist/helpers/color.helper.js +35 -0
- package/dist/helpers/context-id-factory.helper.js +25 -0
- package/dist/helpers/context.helper.js +65 -0
- package/dist/helpers/create-param-decorator.helper.js +73 -0
- package/dist/helpers/filter-log-levels.util.js +38 -0
- package/dist/helpers/flatten.helper.js +26 -0
- package/dist/helpers/is-log-level-enabled.util.js +39 -0
- package/dist/helpers/is-log-level.util.js +26 -0
- package/dist/helpers/messages.helper.js +23 -0
- package/dist/helpers/metadata.helper.js +51 -0
- package/dist/helpers/noop.helper.js +23 -0
- package/dist/helpers/random-string-generator.helper.js +24 -0
- package/dist/helpers/rethrow.helper.js +25 -0
- package/dist/helpers/shared.helper.js +49 -0
- package/dist/helpers/silent.helper.js +34 -0
- package/dist/helpers/transient.helper.js +30 -0
- package/dist/helpers/uuid.helper.js +60 -0
- package/dist/helpers/validate-each.helper.js +42 -0
- package/dist/hooks/before-app-shutdown.hook.js +43 -0
- package/dist/hooks/on-app-bootstrap.hook.js +43 -0
- package/dist/hooks/on-app-shutdown.hook.js +43 -0
- package/dist/hooks/on-module-destroy.hook.js +43 -0
- package/dist/hooks/on-module-init.hook.js +43 -0
- package/dist/index.d.ts +3142 -0
- package/dist/index.js +115 -0
- package/dist/injector/constants.js +28 -0
- package/dist/injector/container.js +229 -0
- package/dist/injector/helpers/barrier.js +48 -0
- package/dist/injector/helpers/class-scope.helper.js +27 -0
- package/dist/injector/helpers/classifier.helper.js +35 -0
- package/dist/injector/helpers/is-durable.helper.js +27 -0
- package/dist/injector/injector.js +490 -0
- package/dist/injector/instance/links-host.js +68 -0
- package/dist/injector/instance/loader.js +95 -0
- package/dist/injector/instance/resolver.js +61 -0
- package/dist/injector/instance/wrapper.js +324 -0
- package/dist/injector/internal-core-module/core-providers.js +42 -0
- package/dist/injector/internal-core-module/internal-core-module-factory.js +66 -0
- package/dist/injector/internal-core-module/internal-core-module.js +46 -0
- package/dist/injector/module/compiler.js +47 -0
- package/dist/injector/module/container.js +33 -0
- package/dist/injector/module/lazy/loader.js +71 -0
- package/dist/injector/module/module.js +395 -0
- package/dist/injector/module/ref.js +78 -0
- package/dist/injector/module/token-factory.js +82 -0
- package/dist/injector/settlement-signal.js +50 -0
- package/dist/injector/topology-tree/topology-tree.js +68 -0
- package/dist/injector/topology-tree/tree-node.js +68 -0
- package/dist/inspector/graph-inspector.js +182 -0
- package/dist/inspector/initialize-on-preview.allowlist.js +31 -0
- package/dist/inspector/noop-graph-inspector.js +27 -0
- package/dist/inspector/partial-graph.host.js +34 -0
- package/dist/inspector/serialized-graph.js +128 -0
- package/dist/interceptors/consumer.js +54 -0
- package/dist/interceptors/context-creator.js +75 -0
- package/dist/interfaces/application/context-options.interface.js +31 -0
- package/dist/interfaces/application/context.interface.js +0 -0
- package/dist/interfaces/application/index.js +3 -0
- package/dist/interfaces/context/arguments-host.interface.js +0 -0
- package/dist/interfaces/context/context-id-factory.interface.js +0 -0
- package/dist/interfaces/context/context.interface.js +0 -0
- package/dist/interfaces/context/creator.interface.js +0 -0
- package/dist/interfaces/context/execution.interface.js +0 -0
- package/dist/interfaces/context/index.js +7 -0
- package/dist/interfaces/context/params.interface.js +0 -0
- package/dist/interfaces/features/exception-filter.interface.js +0 -0
- package/dist/interfaces/features/guards.interface.js +0 -0
- package/dist/interfaces/features/index.js +5 -0
- package/dist/interfaces/features/interceptor.interface.js +0 -0
- package/dist/interfaces/features/pipes.interface.js +0 -0
- package/dist/interfaces/helper.interface.js +0 -0
- package/dist/interfaces/hooks/before-application-shutdown.interface.js +0 -0
- package/dist/interfaces/hooks/index.js +6 -0
- package/dist/interfaces/hooks/on-application-bootstrap.interface.js +0 -0
- package/dist/interfaces/hooks/on-application-shutdown.interface.js +0 -0
- package/dist/interfaces/hooks/on-destroy.interface.js +0 -0
- package/dist/interfaces/hooks/on-init.interface.js +0 -0
- package/dist/interfaces/index.js +16 -0
- package/dist/interfaces/injectable.interface.js +0 -0
- package/dist/interfaces/injector/index.js +6 -0
- package/dist/interfaces/injector/injector.interface.js +0 -0
- package/dist/interfaces/injector/instance-wrapper.interface.js +0 -0
- package/dist/interfaces/injector/lazy-module-options.interface.js +0 -0
- package/dist/interfaces/injector/module-compiler.interface.js +0 -0
- package/dist/interfaces/injector/module-ref.interface.js +0 -0
- package/dist/interfaces/inspector/edge.interface.js +0 -0
- package/dist/interfaces/inspector/enhancer-metadata-cache-entry.interface.js +0 -0
- package/dist/interfaces/inspector/entrypoint.interface.js +0 -0
- package/dist/interfaces/inspector/extras.interface.js +0 -0
- package/dist/interfaces/inspector/index.js +8 -0
- package/dist/interfaces/inspector/node.interface.js +0 -0
- package/dist/interfaces/inspector/serialized-graph-json.interface.js +0 -0
- package/dist/interfaces/inspector/serialized-graph-metadata.interface.js +0 -0
- package/dist/interfaces/modules/definition.interface.js +0 -0
- package/dist/interfaces/modules/dynamic-module.interface.js +0 -0
- package/dist/interfaces/modules/forward-reference.interface.js +0 -0
- package/dist/interfaces/modules/index.js +10 -0
- package/dist/interfaces/modules/injection-token.interface.js +0 -0
- package/dist/interfaces/modules/introspection-result.interface.js +0 -0
- package/dist/interfaces/modules/module-metadata.interface.js +0 -0
- package/dist/interfaces/modules/module.interface.js +0 -0
- package/dist/interfaces/modules/optional-factory-dependency.interface.js +0 -0
- package/dist/interfaces/modules/override.interface.js +0 -0
- package/dist/interfaces/modules/provider.interface.js +0 -0
- package/dist/interfaces/param-decorator.interface.js +0 -0
- package/dist/interfaces/scope.interface.js +0 -0
- package/dist/interfaces/services/console.interface.js +0 -0
- package/dist/interfaces/services/index.js +4 -0
- package/dist/interfaces/services/logger.interface.js +0 -0
- package/dist/interfaces/services/reflector.interface.js +0 -0
- package/dist/interfaces/set-metadata.interface.js +0 -0
- package/dist/interfaces/type.interface.js +0 -0
- package/dist/metadata-scanner.js +50 -0
- package/dist/pipes/consumer.js +33 -0
- package/dist/pipes/context-creator.js +78 -0
- package/dist/scanner.js +371 -0
- package/dist/services/console.service.js +347 -0
- package/dist/services/logger.service.js +276 -0
- package/dist/services/reflector.service.js +82 -0
- package/dist/storage/handler-metadata.storage.js +42 -0
- package/dist/storage/meta-host.storage.js +62 -0
- package/package.json +52 -40
- package/application/config.d.ts +0 -35
- package/application/config.js +0 -85
- package/application/context.d.ts +0 -198
- package/application/context.js +0 -325
- package/application/factory.d.ts +0 -43
- package/application/factory.js +0 -147
- package/constants.d.ts +0 -44
- package/constants.js +0 -51
- package/context/context.d.ts +0 -66
- package/context/context.js +0 -156
- package/context/creator.d.ts +0 -9
- package/context/creator.js +0 -32
- package/context/execution-host.d.ts +0 -16
- package/context/execution-host.js +0 -30
- package/context/index.d.ts +0 -4
- package/context/index.js +0 -20
- package/context/proxy.d.ts +0 -6
- package/context/proxy.js +0 -33
- package/decorators/apply.decorator.d.ts +0 -10
- package/decorators/apply.decorator.js +0 -24
- package/decorators/bind.decorator.d.ts +0 -11
- package/decorators/bind.decorator.js +0 -20
- package/decorators/catch.decorator.d.ts +0 -17
- package/decorators/catch.decorator.js +0 -26
- package/decorators/create-param.decorator.d.ts +0 -29
- package/decorators/create-param.decorator.js +0 -51
- package/decorators/dependencies.decorator.d.ts +0 -6
- package/decorators/dependencies.decorator.js +0 -17
- package/decorators/exception-filters.decorator.d.ts +0 -21
- package/decorators/exception-filters.decorator.js +0 -41
- package/decorators/global.decorator.d.ts +0 -10
- package/decorators/global.decorator.js +0 -19
- package/decorators/index.d.ts +0 -15
- package/decorators/index.js +0 -31
- package/decorators/inject.decorator.d.ts +0 -26
- package/decorators/inject.decorator.js +0 -45
- package/decorators/injectable.decorator.d.ts +0 -40
- package/decorators/injectable.decorator.js +0 -51
- package/decorators/module.decorator.d.ts +0 -14
- package/decorators/module.decorator.js +0 -38
- package/decorators/optional.decorator.d.ts +0 -14
- package/decorators/optional.decorator.js +0 -30
- package/decorators/set-metadata.decorator.d.ts +0 -18
- package/decorators/set-metadata.decorator.js +0 -30
- package/decorators/use-guards.decorator.d.ts +0 -21
- package/decorators/use-guards.decorator.js +0 -40
- package/decorators/use-interceptors.decorator.d.ts +0 -21
- package/decorators/use-interceptors.decorator.js +0 -40
- package/decorators/use-pipes.decorator.d.ts +0 -21
- package/decorators/use-pipes.decorator.js +0 -39
- package/discovery/meta-host-collection.d.ts +0 -32
- package/discovery/meta-host-collection.js +0 -79
- package/discovery/module.d.ts +0 -5
- package/discovery/module.js +0 -24
- package/discovery/service.d.ts +0 -68
- package/discovery/service.js +0 -90
- package/errors/exceptions/circular-dependency.exception.d.ts +0 -4
- package/errors/exceptions/circular-dependency.exception.js +0 -11
- package/errors/exceptions/index.d.ts +0 -8
- package/errors/exceptions/index.js +0 -24
- package/errors/exceptions/invalid-class-module.exception.d.ts +0 -4
- package/errors/exceptions/invalid-class-module.exception.js +0 -11
- package/errors/exceptions/invalid-class-scope.exception.d.ts +0 -5
- package/errors/exceptions/invalid-class-scope.exception.js +0 -14
- package/errors/exceptions/invalid-class.exception.d.ts +0 -4
- package/errors/exceptions/invalid-class.exception.js +0 -11
- package/errors/exceptions/invalid-exception-filter.exception.d.ts +0 -4
- package/errors/exceptions/invalid-exception-filter.exception.js +0 -11
- package/errors/exceptions/invalid-module.exception.d.ts +0 -4
- package/errors/exceptions/invalid-module.exception.js +0 -11
- package/errors/exceptions/runtime.exception.d.ts +0 -4
- package/errors/exceptions/runtime.exception.js +0 -12
- package/errors/exceptions/undefined-dependency.exception.d.ts +0 -6
- package/errors/exceptions/undefined-dependency.exception.js +0 -11
- package/errors/exceptions/undefined-forwardref.exception.d.ts +0 -5
- package/errors/exceptions/undefined-forwardref.exception.js +0 -11
- package/errors/exceptions/undefined-module.exception.d.ts +0 -4
- package/errors/exceptions/undefined-module.exception.js +0 -11
- package/errors/exceptions/unknown-dependencies.exception.d.ts +0 -16
- package/errors/exceptions/unknown-dependencies.exception.js +0 -15
- package/errors/exceptions/unknown-element.exception.d.ts +0 -4
- package/errors/exceptions/unknown-element.exception.js +0 -12
- package/errors/exceptions/unknown-export.exception.d.ts +0 -4
- package/errors/exceptions/unknown-export.exception.js +0 -11
- package/errors/exceptions/unknown-module.exception.d.ts +0 -4
- package/errors/exceptions/unknown-module.exception.js +0 -10
- package/errors/messages.d.ts +0 -15
- package/errors/messages.js +0 -126
- package/exceptions/handler.d.ts +0 -10
- package/exceptions/handler.js +0 -34
- package/exceptions/index.d.ts +0 -2
- package/exceptions/index.js +0 -18
- package/exceptions/zone/handler.d.ts +0 -5
- package/exceptions/zone/handler.js +0 -15
- package/exceptions/zone/index.d.ts +0 -2
- package/exceptions/zone/index.js +0 -18
- package/exceptions/zone/zone.d.ts +0 -5
- package/exceptions/zone/zone.js +0 -32
- package/filters/context-creator.d.ts +0 -14
- package/filters/context-creator.js +0 -48
- package/filters/context.d.ts +0 -12
- package/filters/context.js +0 -41
- package/filters/filter.d.ts +0 -6
- package/filters/filter.js +0 -16
- package/filters/index.d.ts +0 -3
- package/filters/index.js +0 -19
- package/guards/consumer.d.ts +0 -9
- package/guards/consumer.js +0 -33
- package/guards/context-creator.d.ts +0 -17
- package/guards/context-creator.js +0 -69
- package/guards/index.d.ts +0 -2
- package/guards/index.js +0 -18
- package/helpers/color.helper.d.ts +0 -9
- package/helpers/color.helper.js +0 -14
- package/helpers/context-id-factory.helper.d.ts +0 -2
- package/helpers/context-id-factory.helper.js +0 -15
- package/helpers/context.helper.d.ts +0 -23
- package/helpers/context.helper.js +0 -49
- package/helpers/extends-metadata.helper.d.ts +0 -1
- package/helpers/extends-metadata.helper.js +0 -9
- package/helpers/flatten.helper.d.ts +0 -1
- package/helpers/flatten.helper.js +0 -9
- package/helpers/messages.helper.d.ts +0 -2
- package/helpers/messages.helper.js +0 -7
- package/helpers/noop.helper.d.ts +0 -1
- package/helpers/noop.helper.js +0 -5
- package/helpers/random-string-generator.helper.d.ts +0 -1
- package/helpers/random-string-generator.helper.js +0 -6
- package/helpers/rethrow.helper.d.ts +0 -1
- package/helpers/rethrow.helper.js +0 -7
- package/helpers/shared.helper.d.ts +0 -10
- package/helpers/shared.helper.js +0 -33
- package/helpers/silent.helper.d.ts +0 -10
- package/helpers/silent.helper.js +0 -18
- package/helpers/transient.helper.d.ts +0 -12
- package/helpers/transient.helper.js +0 -26
- package/helpers/uuid.helper.d.ts +0 -15
- package/helpers/uuid.helper.js +0 -54
- package/helpers/validate-each.helper.d.ts +0 -8
- package/helpers/validate-each.helper.js +0 -25
- package/hooks/before-app-shutdown.hook.d.ts +0 -9
- package/hooks/before-app-shutdown.hook.js +0 -45
- package/hooks/index.d.ts +0 -5
- package/hooks/index.js +0 -21
- package/hooks/on-app-bootstrap.hook.d.ts +0 -8
- package/hooks/on-app-bootstrap.hook.js +0 -45
- package/hooks/on-app-shutdown.hook.d.ts +0 -9
- package/hooks/on-app-shutdown.hook.js +0 -46
- package/hooks/on-module-destroy.hook.d.ts +0 -8
- package/hooks/on-module-destroy.hook.js +0 -45
- package/hooks/on-module-init.hook.d.ts +0 -8
- package/hooks/on-module-init.hook.js +0 -45
- package/index.d.ts +0 -10
- package/index.js +0 -32
- package/injector/constants.d.ts +0 -2
- package/injector/constants.js +0 -7
- package/injector/container.d.ts +0 -61
- package/injector/container.js +0 -194
- package/injector/helpers/class-scope.helper.d.ts +0 -2
- package/injector/helpers/class-scope.helper.js +0 -9
- package/injector/helpers/classifier.helper.d.ts +0 -4
- package/injector/helpers/classifier.helper.js +0 -17
- package/injector/helpers/is-durable.helper.d.ts +0 -2
- package/injector/helpers/is-durable.helper.js +0 -9
- package/injector/index.d.ts +0 -5
- package/injector/index.js +0 -20
- package/injector/injector.d.ts +0 -87
- package/injector/injector.js +0 -452
- package/injector/instance/links-host.d.ts +0 -22
- package/injector/instance/links-host.js +0 -50
- package/injector/instance/loader.d.ts +0 -21
- package/injector/instance/loader.js +0 -73
- package/injector/instance/resolver.d.ts +0 -16
- package/injector/instance/resolver.js +0 -43
- package/injector/instance/wrapper.d.ts +0 -90
- package/injector/instance/wrapper.js +0 -272
- package/injector/internal-core-module/core-providers.d.ts +0 -4
- package/injector/internal-core-module/core-providers.js +0 -21
- package/injector/internal-core-module/internal-core-module-factory.d.ts +0 -8
- package/injector/internal-core-module/internal-core-module-factory.js +0 -47
- package/injector/internal-core-module/internal-core-module.d.ts +0 -4
- package/injector/internal-core-module/internal-core-module.js +0 -31
- package/injector/module/compiler.d.ts +0 -19
- package/injector/module/compiler.js +0 -27
- package/injector/module/container.d.ts +0 -6
- package/injector/module/container.js +0 -24
- package/injector/module/lazy/loader.d.ts +0 -21
- package/injector/module/lazy/loader.js +0 -49
- package/injector/module/lazy/options.d.ts +0 -6
- package/injector/module/lazy/options.js +0 -2
- package/injector/module/module.d.ts +0 -74
- package/injector/module/module.js +0 -383
- package/injector/module/ref.d.ts +0 -106
- package/injector/module/ref.js +0 -62
- package/injector/module/token-factory.d.ts +0 -13
- package/injector/module/token-factory.js +0 -71
- package/injector/settlement-signal.d.ts +0 -37
- package/injector/settlement-signal.js +0 -55
- package/inspector/graph-inspector.d.ts +0 -26
- package/inspector/graph-inspector.js +0 -163
- package/inspector/initialize-on-preview.allowlist.d.ts +0 -6
- package/inspector/initialize-on-preview.allowlist.js +0 -13
- package/inspector/interfaces/edge.interface.d.ts +0 -28
- package/inspector/interfaces/edge.interface.js +0 -2
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +0 -12
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +0 -2
- package/inspector/interfaces/entrypoint.interface.d.ts +0 -10
- package/inspector/interfaces/entrypoint.interface.js +0 -2
- package/inspector/interfaces/extras.interface.d.ts +0 -18
- package/inspector/interfaces/extras.interface.js +0 -2
- package/inspector/interfaces/node.interface.d.ts +0 -49
- package/inspector/interfaces/node.interface.js +0 -2
- package/inspector/interfaces/serialized-graph-json.interface.d.ts +0 -14
- package/inspector/interfaces/serialized-graph-json.interface.js +0 -2
- package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +0 -10
- package/inspector/interfaces/serialized-graph-metadata.interface.js +0 -2
- package/inspector/noop-graph-inspector.d.ts +0 -2
- package/inspector/noop-graph-inspector.js +0 -8
- package/inspector/partial-graph.host.d.ts +0 -7
- package/inspector/partial-graph.host.js +0 -15
- package/inspector/serialized-graph.d.ts +0 -52
- package/inspector/serialized-graph.js +0 -121
- package/interceptors/consumer.d.ts +0 -9
- package/interceptors/consumer.js +0 -37
- package/interceptors/context-creator.d.ts +0 -17
- package/interceptors/context-creator.js +0 -67
- package/interceptors/index.d.ts +0 -2
- package/interceptors/index.js +0 -18
- package/interfaces/abstract.interface.d.ts +0 -3
- package/interfaces/abstract.interface.js +0 -2
- package/interfaces/application/context-options.interface.d.ts +0 -41
- package/interfaces/application/context-options.interface.js +0 -9
- package/interfaces/application/context.interface.d.ts +0 -162
- package/interfaces/application/context.interface.js +0 -2
- package/interfaces/application/index.d.ts +0 -1
- package/interfaces/application/index.js +0 -17
- package/interfaces/context/arguments-host.interface.d.ts +0 -22
- package/interfaces/context/arguments-host.interface.js +0 -2
- package/interfaces/context/execution.interface.d.ts +0 -18
- package/interfaces/context/execution.interface.js +0 -2
- package/interfaces/context/index.d.ts +0 -2
- package/interfaces/context/index.js +0 -18
- package/interfaces/features/exception-filter.interface.d.ts +0 -21
- package/interfaces/features/exception-filter.interface.js +0 -2
- package/interfaces/features/guards.interface.d.ts +0 -20
- package/interfaces/features/guards.interface.js +0 -2
- package/interfaces/features/index.d.ts +0 -4
- package/interfaces/features/index.js +0 -20
- package/interfaces/features/interceptor.interface.d.ts +0 -30
- package/interfaces/features/interceptor.interface.js +0 -2
- package/interfaces/features/pipes.interface.d.ts +0 -37
- package/interfaces/features/pipes.interface.js +0 -2
- package/interfaces/helper.interface.d.ts +0 -3
- package/interfaces/helper.interface.js +0 -2
- package/interfaces/hooks/before-application-shutdown.interface.d.ts +0 -3
- package/interfaces/hooks/before-application-shutdown.interface.js +0 -2
- package/interfaces/hooks/index.d.ts +0 -5
- package/interfaces/hooks/index.js +0 -21
- package/interfaces/hooks/on-application-bootstrap.interface.d.ts +0 -9
- package/interfaces/hooks/on-application-bootstrap.interface.js +0 -2
- package/interfaces/hooks/on-application-shutdown.interface.d.ts +0 -9
- package/interfaces/hooks/on-application-shutdown.interface.js +0 -2
- package/interfaces/hooks/on-destroy.interface.d.ts +0 -10
- package/interfaces/hooks/on-destroy.interface.js +0 -2
- package/interfaces/hooks/on-init.interface.d.ts +0 -8
- package/interfaces/hooks/on-init.interface.js +0 -2
- package/interfaces/index.d.ts +0 -8
- package/interfaces/index.js +0 -24
- package/interfaces/injectable.interface.d.ts +0 -1
- package/interfaces/injectable.interface.js +0 -2
- package/interfaces/modules/configurable/async-options.interface.d.ts +0 -42
- package/interfaces/modules/configurable/async-options.interface.js +0 -2
- package/interfaces/modules/configurable/cls.interface.d.ts +0 -13
- package/interfaces/modules/configurable/cls.interface.js +0 -2
- package/interfaces/modules/configurable/host.interface.d.ts +0 -62
- package/interfaces/modules/configurable/host.interface.js +0 -2
- package/interfaces/modules/configurable/index.d.ts +0 -3
- package/interfaces/modules/configurable/index.js +0 -19
- package/interfaces/modules/definition.interface.d.ts +0 -4
- package/interfaces/modules/definition.interface.js +0 -2
- package/interfaces/modules/dynamic-module.interface.d.ts +0 -23
- package/interfaces/modules/dynamic-module.interface.js +0 -2
- package/interfaces/modules/forward-reference.interface.d.ts +0 -3
- package/interfaces/modules/forward-reference.interface.js +0 -2
- package/interfaces/modules/index.d.ts +0 -9
- package/interfaces/modules/index.js +0 -25
- package/interfaces/modules/injection-token.interface.d.ts +0 -5
- package/interfaces/modules/injection-token.interface.js +0 -2
- package/interfaces/modules/introspection-result.interface.d.ts +0 -10
- package/interfaces/modules/introspection-result.interface.js +0 -2
- package/interfaces/modules/module-metadata.interface.d.ts +0 -24
- package/interfaces/modules/module-metadata.interface.js +0 -2
- package/interfaces/modules/module.interface.d.ts +0 -2
- package/interfaces/modules/module.interface.js +0 -2
- package/interfaces/modules/optional-factory-dependency.interface.d.ts +0 -8
- package/interfaces/modules/optional-factory-dependency.interface.js +0 -2
- package/interfaces/modules/override.interface.d.ts +0 -5
- package/interfaces/modules/override.interface.js +0 -2
- package/interfaces/modules/provider.interface.d.ts +0 -142
- package/interfaces/modules/provider.interface.js +0 -2
- package/interfaces/scope.interface.d.ts +0 -35
- package/interfaces/scope.interface.js +0 -23
- package/interfaces/type.interface.d.ts +0 -3
- package/interfaces/type.interface.js +0 -2
- package/metadata-scanner.d.ts +0 -4
- package/metadata-scanner.js +0 -34
- package/module/configurable-module.builder.d.ts +0 -93
- package/module/configurable-module.builder.js +0 -204
- package/module/constants.d.ts +0 -4
- package/module/constants.js +0 -7
- package/module/helpers/generate-options-injection-token.helper.d.ts +0 -1
- package/module/helpers/generate-options-injection-token.helper.js +0 -9
- package/module/helpers/get-injection-providers.helper.d.ts +0 -8
- package/module/helpers/get-injection-providers.helper.js +0 -36
- package/module/helpers/index.d.ts +0 -2
- package/module/helpers/index.js +0 -18
- package/module/index.d.ts +0 -2
- package/module/index.js +0 -18
- package/pipes/consumer.d.ts +0 -9
- package/pipes/consumer.js +0 -15
- package/pipes/context-creator.d.ts +0 -18
- package/pipes/context-creator.js +0 -70
- package/pipes/index.d.ts +0 -2
- package/pipes/index.js +0 -18
- package/scanner.d.ts +0 -81
- package/scanner.js +0 -374
- package/services/console.service.d.ts +0 -86
- package/services/console.service.js +0 -233
- package/services/index.d.ts +0 -1
- package/services/index.js +0 -17
- package/services/logger.service.d.ts +0 -157
- package/services/logger.service.js +0 -269
- package/services/reflector.service.d.ts +0 -110
- package/services/reflector.service.js +0 -87
- package/test/context/creator.spec.d.ts +0 -1
- package/test/context/creator.spec.js +0 -149
- package/test/context/execution-host.spec.d.ts +0 -1
- package/test/context/execution-host.spec.js +0 -31
- package/test/context/proxy.spec.d.ts +0 -1
- package/test/context/proxy.spec.js +0 -46
- package/test/exceptions/handler.spec.d.ts +0 -1
- package/test/exceptions/handler.spec.js +0 -90
- package/test/exceptions/messages.spec.js +0 -201
- package/test/exceptions/zona/handler.spec.d.ts +0 -1
- package/test/exceptions/zona/handler.spec.js +0 -51
- package/test/exceptions/zona/zone.spec.d.ts +0 -1
- package/test/exceptions/zona/zone.spec.js +0 -66
- package/test/filters/context-creator.spec.d.ts +0 -2
- package/test/filters/context-creator.spec.js +0 -91
- package/test/guards/consumer.spec.d.ts +0 -1
- package/test/guards/consumer.spec.js +0 -47
- package/test/guards/context-creator.spec.d.ts +0 -1
- package/test/guards/context-creator.spec.js +0 -138
- package/test/helpers/context-id-factory.spec.d.ts +0 -1
- package/test/helpers/context-id-factory.spec.js +0 -9
- package/test/helpers/shared.spec.d.ts +0 -1
- package/test/helpers/shared.spec.js +0 -122
- package/test/hooks/before-app-shutdown.hook.spec.d.ts +0 -1
- package/test/hooks/before-app-shutdown.hook.spec.js +0 -44
- package/test/hooks/on-app-bootstrap.hook.spec.d.ts +0 -1
- package/test/hooks/on-app-bootstrap.hook.spec.js +0 -43
- package/test/hooks/on-app-shutdown.hook.spec.d.ts +0 -1
- package/test/hooks/on-app-shutdown.hook.spec.js +0 -43
- package/test/hooks/on-module-destroy.hook.spec.d.ts +0 -1
- package/test/hooks/on-module-destroy.hook.spec.js +0 -43
- package/test/hooks/on-module-init.hook.spec.d.ts +0 -1
- package/test/hooks/on-module-init.hook.spec.js +0 -43
- package/test/injector/compiler.spec.d.ts +0 -1
- package/test/injector/compiler.spec.js +0 -42
- package/test/injector/container.spec.d.ts +0 -1
- package/test/injector/container.spec.js +0 -203
- package/test/injector/helpers/classifier.spec.d.ts +0 -1
- package/test/injector/helpers/classifier.spec.js +0 -102
- package/test/injector/injector.spec.d.ts +0 -1
- package/test/injector/injector.spec.js +0 -678
- package/test/injector/instance/loader.spec.d.ts +0 -1
- package/test/injector/instance/loader.spec.js +0 -108
- package/test/injector/instance/wrapper.spec.d.ts +0 -1
- package/test/injector/instance/wrapper.spec.js +0 -772
- package/test/injector/internal-core-module/internal-core-module-factory.spec.d.ts +0 -1
- package/test/injector/internal-core-module/internal-core-module-factory.spec.js +0 -27
- package/test/injector/module/lazy/loader.spec.d.ts +0 -1
- package/test/injector/module/lazy/loader.spec.js +0 -71
- package/test/injector/module/module.spec.d.ts +0 -1
- package/test/injector/module/module.spec.js +0 -410
- package/test/injector/module/token-factory.spec.d.ts +0 -1
- package/test/injector/module/token-factory.spec.js +0 -84
- package/test/interceptors/consumer.spec.d.ts +0 -1
- package/test/interceptors/consumer.spec.js +0 -136
- package/test/interceptors/context-creator.spec.d.ts +0 -1
- package/test/interceptors/context-creator.spec.js +0 -139
- package/test/metadata-scanner.spec.d.ts +0 -1
- package/test/metadata-scanner.spec.js +0 -41
- package/test/module/configurable-module.builder.spec.d.ts +0 -1
- package/test/module/configurable-module.builder.spec.js +0 -102
- package/test/module/helpers/get-injection-providers.helper.spec.d.ts +0 -1
- package/test/module/helpers/get-injection-providers.helper.spec.js +0 -49
- package/test/pipes/consumer.spec.d.ts +0 -1
- package/test/pipes/consumer.spec.js +0 -42
- package/test/pipes/context-creator.spec.d.ts +0 -1
- package/test/pipes/context-creator.spec.js +0 -108
- package/test/scanner.spec.d.ts +0 -1
- package/test/scanner.spec.js +0 -620
- package/test/services/logger.service.spec.d.ts +0 -1
- package/test/services/logger.service.spec.js +0 -487
- package/test/services/reflector.service.spec.d.ts +0 -1
- package/test/services/reflector.service.spec.js +0 -105
- package/tsconfig.tsbuildinfo +0 -1
- /package/{test/exceptions/messages.spec.d.ts → dist/interfaces/abstract.interface.js} +0 -0
package/application/context.js
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApplicationContext = exports.ShutdownSignal = void 0;
|
|
4
|
-
const resolver_1 = require("@venok/core/injector/instance/resolver");
|
|
5
|
-
const injector_1 = require("@venok/core/injector/injector");
|
|
6
|
-
const logger_service_1 = require("@venok/core/services/logger.service");
|
|
7
|
-
const compiler_1 = require("@venok/core/injector/module/compiler");
|
|
8
|
-
const links_host_1 = require("@venok/core/injector/instance/links-host");
|
|
9
|
-
const exceptions_1 = require("@venok/core/errors/exceptions");
|
|
10
|
-
const context_id_factory_helper_1 = require("@venok/core/helpers/context-id-factory.helper");
|
|
11
|
-
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
12
|
-
const hooks_1 = require("@venok/core/hooks");
|
|
13
|
-
const constants_1 = require("@venok/core/constants");
|
|
14
|
-
/**
|
|
15
|
-
* System signals which shut down a process
|
|
16
|
-
*/
|
|
17
|
-
var ShutdownSignal;
|
|
18
|
-
(function (ShutdownSignal) {
|
|
19
|
-
ShutdownSignal["SIGHUP"] = "SIGHUP";
|
|
20
|
-
ShutdownSignal["SIGINT"] = "SIGINT";
|
|
21
|
-
ShutdownSignal["SIGQUIT"] = "SIGQUIT";
|
|
22
|
-
ShutdownSignal["SIGILL"] = "SIGILL";
|
|
23
|
-
ShutdownSignal["SIGTRAP"] = "SIGTRAP";
|
|
24
|
-
ShutdownSignal["SIGABRT"] = "SIGABRT";
|
|
25
|
-
ShutdownSignal["SIGBUS"] = "SIGBUS";
|
|
26
|
-
ShutdownSignal["SIGFPE"] = "SIGFPE";
|
|
27
|
-
ShutdownSignal["SIGSEGV"] = "SIGSEGV";
|
|
28
|
-
ShutdownSignal["SIGUSR2"] = "SIGUSR2";
|
|
29
|
-
ShutdownSignal["SIGTERM"] = "SIGTERM";
|
|
30
|
-
})(ShutdownSignal || (exports.ShutdownSignal = ShutdownSignal = {}));
|
|
31
|
-
/**
|
|
32
|
-
* @publicApi
|
|
33
|
-
*/
|
|
34
|
-
class ApplicationContext extends resolver_1.AbstractInstanceResolver {
|
|
35
|
-
get instanceLinksHost() {
|
|
36
|
-
if (!this._instanceLinksHost) {
|
|
37
|
-
this._instanceLinksHost = new links_host_1.InstanceLinksHost(this.container);
|
|
38
|
-
}
|
|
39
|
-
return this._instanceLinksHost;
|
|
40
|
-
}
|
|
41
|
-
constructor(container, config, appOptions = {}, contextModule = null, scope = new Array()) {
|
|
42
|
-
super();
|
|
43
|
-
this.container = container;
|
|
44
|
-
this.config = config;
|
|
45
|
-
this.appOptions = appOptions;
|
|
46
|
-
this.contextModule = contextModule;
|
|
47
|
-
this.scope = scope;
|
|
48
|
-
this.isInitialized = false;
|
|
49
|
-
this.logger = new logger_service_1.Logger(ApplicationContext.name, {
|
|
50
|
-
timestamp: true,
|
|
51
|
-
});
|
|
52
|
-
this.shouldFlushLogsOnOverride = false;
|
|
53
|
-
this.activeShutdownSignals = new Array();
|
|
54
|
-
this.moduleCompiler = new compiler_1.ModuleCompiler();
|
|
55
|
-
this.injector = new injector_1.Injector();
|
|
56
|
-
if (this.appOptions.preview) {
|
|
57
|
-
this.printInPreviewModeWarning();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
selectContextModule() {
|
|
61
|
-
const modules = this.container.getModules().values();
|
|
62
|
-
this.contextModule = modules.next().value;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Allows navigating through the modules tree, for example, to pull out a specific instance from the selected module.
|
|
66
|
-
* @returns {VenokApplicationContext}
|
|
67
|
-
*/
|
|
68
|
-
select(moduleType) {
|
|
69
|
-
const modulesContainer = this.container.getModules();
|
|
70
|
-
const contextModuleCtor = this.contextModule.metatype;
|
|
71
|
-
const scope = this.scope.concat(contextModuleCtor);
|
|
72
|
-
const moduleTokenFactory = this.container.getModuleTokenFactory();
|
|
73
|
-
const { type, dynamicMetadata } = this.moduleCompiler.extractMetadata(moduleType);
|
|
74
|
-
const token = moduleTokenFactory.create(type, dynamicMetadata);
|
|
75
|
-
const selectedModule = modulesContainer.get(token);
|
|
76
|
-
if (!selectedModule) {
|
|
77
|
-
throw new exceptions_1.UnknownModuleException();
|
|
78
|
-
}
|
|
79
|
-
return new ApplicationContext(this.container, this.config, this.appOptions, selectedModule, scope);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Retrieves an instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
83
|
-
* @returns {TResult | Array<TResult>}
|
|
84
|
-
*/
|
|
85
|
-
get(typeOrToken, options = { strict: false }) {
|
|
86
|
-
return !(options && options.strict)
|
|
87
|
-
? this.find(typeOrToken, options)
|
|
88
|
-
: this.find(typeOrToken, {
|
|
89
|
-
moduleId: this.contextModule?.id,
|
|
90
|
-
each: options.each,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Resolves transient or request-scoped instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
95
|
-
* @returns {Promise<TResult | Array<TResult>>}
|
|
96
|
-
*/
|
|
97
|
-
resolve(typeOrToken, contextId = (0, context_id_factory_helper_1.createContextId)(), options = { strict: false }) {
|
|
98
|
-
return this.resolvePerContext(typeOrToken, this.contextModule, contextId, options);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Registers the request/context object for a given context ID (DI container sub-tree).
|
|
102
|
-
* @returns {void}
|
|
103
|
-
*/
|
|
104
|
-
registerRequestByContextId(request, contextId) {
|
|
105
|
-
this.container.registerRequestProvider(request, contextId);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Initializes the Venok application.
|
|
109
|
-
* Calls the Venok lifecycle events.
|
|
110
|
-
*
|
|
111
|
-
* @returns {Promise<this>} The ApplicationContext instance as Promise
|
|
112
|
-
*/
|
|
113
|
-
async init() {
|
|
114
|
-
if (this.isInitialized) {
|
|
115
|
-
return this;
|
|
116
|
-
}
|
|
117
|
-
await this.callInitHook();
|
|
118
|
-
await this.callBootstrapHook();
|
|
119
|
-
this.isInitialized = true;
|
|
120
|
-
return this;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Terminates the application
|
|
124
|
-
* @returns {Promise<void>}
|
|
125
|
-
*/
|
|
126
|
-
async close(signal) {
|
|
127
|
-
await this.callDestroyHook();
|
|
128
|
-
await this.callBeforeShutdownHook(signal);
|
|
129
|
-
await this.dispose();
|
|
130
|
-
await this.callShutdownHook(signal);
|
|
131
|
-
this.unsubscribeFromProcessSignals();
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Sets custom logger service.
|
|
135
|
-
* Flushes buffered logs if auto flush is on.
|
|
136
|
-
* @returns {void}
|
|
137
|
-
*/
|
|
138
|
-
useLogger(logger) {
|
|
139
|
-
logger_service_1.Logger.overrideLogger(logger);
|
|
140
|
-
if (this.shouldFlushLogsOnOverride) {
|
|
141
|
-
this.flushLogs();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
useGlobalFilters(...filters) {
|
|
145
|
-
this.config.useGlobalFilters(...filters);
|
|
146
|
-
return this;
|
|
147
|
-
}
|
|
148
|
-
useGlobalPipes(...pipes) {
|
|
149
|
-
this.config.useGlobalPipes(...pipes);
|
|
150
|
-
return this;
|
|
151
|
-
}
|
|
152
|
-
useGlobalInterceptors(...interceptors) {
|
|
153
|
-
this.config.useGlobalInterceptors(...interceptors);
|
|
154
|
-
return this;
|
|
155
|
-
}
|
|
156
|
-
useGlobalGuards(...guards) {
|
|
157
|
-
this.config.useGlobalGuards(...guards);
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Prints buffered logs and detaches buffer.
|
|
162
|
-
* @returns {void}
|
|
163
|
-
*/
|
|
164
|
-
flushLogs() {
|
|
165
|
-
logger_service_1.Logger.flush();
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Define that it must flush logs right after defining a custom logger.
|
|
169
|
-
*/
|
|
170
|
-
flushLogsOnOverride() {
|
|
171
|
-
this.shouldFlushLogsOnOverride = true;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Enables the usage of shutdown hooks. Will call the
|
|
175
|
-
* `onApplicationShutdown` function of a provider if the
|
|
176
|
-
* process receives a shutdown signal.
|
|
177
|
-
*
|
|
178
|
-
* @param {ShutdownSignal[]} [signals=[]] The system signals it should listen to
|
|
179
|
-
*
|
|
180
|
-
* @returns {this} The Venok application context instance
|
|
181
|
-
*/
|
|
182
|
-
enableShutdownHooks(signals = []) {
|
|
183
|
-
if ((0, shared_helper_1.isEmpty)(signals)) {
|
|
184
|
-
const keys = Object.keys(ShutdownSignal);
|
|
185
|
-
signals = keys.map((key) => ShutdownSignal[key]);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
// given signals array should be unique because
|
|
189
|
-
// process shouldn't listen to the same signal more than once.
|
|
190
|
-
signals = Array.from(new Set(signals));
|
|
191
|
-
}
|
|
192
|
-
signals = signals
|
|
193
|
-
.map((signal) => signal.toString().toUpperCase().trim())
|
|
194
|
-
// filter out the signals which is already listening to
|
|
195
|
-
.filter((signal) => !this.activeShutdownSignals.includes(signal));
|
|
196
|
-
this.listenToShutdownSignals(signals);
|
|
197
|
-
return this;
|
|
198
|
-
}
|
|
199
|
-
async dispose() {
|
|
200
|
-
// Venok application context has no server
|
|
201
|
-
// to dispose, therefore just call a noop
|
|
202
|
-
return Promise.resolve();
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Listens to shutdown signals by listening to
|
|
206
|
-
* process events
|
|
207
|
-
*
|
|
208
|
-
* @param {string[]} signals The system signals it should listen to
|
|
209
|
-
*/
|
|
210
|
-
listenToShutdownSignals(signals) {
|
|
211
|
-
let receivedSignal = false;
|
|
212
|
-
const cleanup = async (signal) => {
|
|
213
|
-
try {
|
|
214
|
-
if (receivedSignal) {
|
|
215
|
-
// If we receive another signal while we're waiting
|
|
216
|
-
// for the server to stop, just ignore it.
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
receivedSignal = true;
|
|
220
|
-
await this.callDestroyHook();
|
|
221
|
-
await this.callBeforeShutdownHook(signal);
|
|
222
|
-
await this.dispose();
|
|
223
|
-
await this.callShutdownHook(signal);
|
|
224
|
-
signals.forEach((sig) => process.removeListener(sig, cleanup));
|
|
225
|
-
process.kill(process.pid, signal);
|
|
226
|
-
}
|
|
227
|
-
catch (err) {
|
|
228
|
-
logger_service_1.Logger.error(constants_1.MESSAGES.ERROR_DURING_SHUTDOWN, err?.stack, ApplicationContext.name);
|
|
229
|
-
process.exit(1);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
this.shutdownCleanupRef = cleanup;
|
|
233
|
-
signals.forEach((signal) => {
|
|
234
|
-
this.activeShutdownSignals.push(signal);
|
|
235
|
-
process.on(signal, cleanup);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Unsubscribes from shutdown signals (process events)
|
|
240
|
-
*/
|
|
241
|
-
unsubscribeFromProcessSignals() {
|
|
242
|
-
if (!this.shutdownCleanupRef) {
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
this.activeShutdownSignals.forEach((signal) => {
|
|
246
|
-
process.removeListener(signal, this.shutdownCleanupRef);
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Calls the `onModuleInit` function on the registered
|
|
251
|
-
* modules and its children.
|
|
252
|
-
*/
|
|
253
|
-
async callInitHook() {
|
|
254
|
-
const modulesSortedByDistance = this.getModulesToTriggerHooksOn();
|
|
255
|
-
for (const module of modulesSortedByDistance) {
|
|
256
|
-
await (0, hooks_1.callModuleInitHook)(module);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Calls the `onModuleDestroy` function on the registered
|
|
261
|
-
* modules and its children.
|
|
262
|
-
*/
|
|
263
|
-
async callDestroyHook() {
|
|
264
|
-
const modulesSortedByDistance = this.getModulesToTriggerHooksOn();
|
|
265
|
-
for (const module of modulesSortedByDistance) {
|
|
266
|
-
await (0, hooks_1.callModuleDestroyHook)(module);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Calls the `onApplicationBootstrap` function on the registered
|
|
271
|
-
* modules and its children.
|
|
272
|
-
*/
|
|
273
|
-
async callBootstrapHook() {
|
|
274
|
-
const modulesSortedByDistance = this.getModulesToTriggerHooksOn();
|
|
275
|
-
for (const module of modulesSortedByDistance) {
|
|
276
|
-
await (0, hooks_1.callModuleBootstrapHook)(module);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Calls the `onApplicationShutdown` function on the registered
|
|
281
|
-
* modules and children.
|
|
282
|
-
*/
|
|
283
|
-
async callShutdownHook(signal) {
|
|
284
|
-
const modulesSortedByDistance = this.getModulesToTriggerHooksOn();
|
|
285
|
-
for (const module of modulesSortedByDistance) {
|
|
286
|
-
await (0, hooks_1.callAppShutdownHook)(module, signal);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Calls the `beforeApplicationShutdown` function on the registered
|
|
291
|
-
* modules and children.
|
|
292
|
-
*/
|
|
293
|
-
async callBeforeShutdownHook(signal) {
|
|
294
|
-
const modulesSortedByDistance = this.getModulesToTriggerHooksOn();
|
|
295
|
-
for (const module of modulesSortedByDistance) {
|
|
296
|
-
await (0, hooks_1.callBeforeAppShutdownHook)(module, signal);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
assertNotInPreviewMode(methodName) {
|
|
300
|
-
if (this.appOptions.preview) {
|
|
301
|
-
const error = `Calling the "${methodName}" in the preview mode is not supported.`;
|
|
302
|
-
this.logger.error(error);
|
|
303
|
-
throw new Error(error);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
getModulesToTriggerHooksOn() {
|
|
307
|
-
if (this._moduleRefsForHooksByDistance) {
|
|
308
|
-
return this._moduleRefsForHooksByDistance;
|
|
309
|
-
}
|
|
310
|
-
const modulesContainer = this.container.getModules();
|
|
311
|
-
const compareFn = (a, b) => b.distance - a.distance;
|
|
312
|
-
const modulesSortedByDistance = Array.from(modulesContainer.values()).sort(compareFn);
|
|
313
|
-
this._moduleRefsForHooksByDistance = this.appOptions?.preview
|
|
314
|
-
? modulesSortedByDistance.filter((moduleRef) => moduleRef.initOnPreview)
|
|
315
|
-
: modulesSortedByDistance;
|
|
316
|
-
return this._moduleRefsForHooksByDistance;
|
|
317
|
-
}
|
|
318
|
-
printInPreviewModeWarning() {
|
|
319
|
-
this.logger.warn("------------------------------------------------");
|
|
320
|
-
this.logger.warn("Application is running in the PREVIEW mode!");
|
|
321
|
-
this.logger.warn("Providers will not be instantiated.");
|
|
322
|
-
this.logger.warn("------------------------------------------------");
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
exports.ApplicationContext = ApplicationContext;
|
package/application/factory.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { VenokApplicationContext } from "@venok/core/interfaces";
|
|
2
|
-
import { ApplicationContextOptions } from "@venok/core/interfaces/application/context-options.interface";
|
|
3
|
-
/**
|
|
4
|
-
* @publicApi
|
|
5
|
-
*/
|
|
6
|
-
export declare class VenokFactoryStatic {
|
|
7
|
-
private readonly logger;
|
|
8
|
-
private abortOnError;
|
|
9
|
-
private autoFlushLogs;
|
|
10
|
-
/**
|
|
11
|
-
* Creates an instance of VenokApplicationContext.
|
|
12
|
-
*
|
|
13
|
-
* @param moduleCls Entry (root) application module class
|
|
14
|
-
* @param options Optional Venok application configuration
|
|
15
|
-
*
|
|
16
|
-
* @returns A promise that, when resolved,
|
|
17
|
-
* contains a reference to the VenokApplicationContext instance.
|
|
18
|
-
*/
|
|
19
|
-
createApplicationContext(moduleCls: any, options?: ApplicationContextOptions): Promise<VenokApplicationContext>;
|
|
20
|
-
private createVenokInstance;
|
|
21
|
-
private setAbortOnError;
|
|
22
|
-
private initialize;
|
|
23
|
-
private handleInitializationError;
|
|
24
|
-
private createProxy;
|
|
25
|
-
private createExceptionProxy;
|
|
26
|
-
private createExceptionZone;
|
|
27
|
-
private registerLoggerConfiguration;
|
|
28
|
-
private createGraphInspector;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Use VenokFactory to create an application instance.
|
|
32
|
-
*
|
|
33
|
-
* ### Specifying an entry module
|
|
34
|
-
*
|
|
35
|
-
* Pass the required *root module* for the application via the module parameter.
|
|
36
|
-
* By convention, it is usually called `ApplicationModule`. Starting with this
|
|
37
|
-
* module, Venok assembles the dependency graph and begins the process of
|
|
38
|
-
* Dependency Injection and instantiates the classes needed to launch your
|
|
39
|
-
* application.
|
|
40
|
-
*
|
|
41
|
-
* @publicApi
|
|
42
|
-
*/
|
|
43
|
-
export declare const VenokFactory: VenokFactoryStatic;
|
package/application/factory.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VenokFactory = exports.VenokFactoryStatic = void 0;
|
|
4
|
-
const container_1 = require("@venok/core/injector/container");
|
|
5
|
-
const config_1 = require("@venok/core/application/config");
|
|
6
|
-
const logger_service_1 = require("@venok/core/services/logger.service");
|
|
7
|
-
const context_1 = require("@venok/core/application/context");
|
|
8
|
-
const graph_inspector_1 = require("@venok/core/inspector/graph-inspector");
|
|
9
|
-
const uuid_helper_1 = require("@venok/core/helpers/uuid.helper");
|
|
10
|
-
const injector_1 = require("@venok/core/injector/injector");
|
|
11
|
-
const loader_1 = require("@venok/core/injector/instance/loader");
|
|
12
|
-
const metadata_scanner_1 = require("@venok/core/metadata-scanner");
|
|
13
|
-
const scanner_1 = require("@venok/core/scanner");
|
|
14
|
-
const zone_1 = require("@venok/core/exceptions/zone/zone");
|
|
15
|
-
const constants_1 = require("@venok/core/constants");
|
|
16
|
-
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
17
|
-
const noop_graph_inspector_1 = require("@venok/core/inspector/noop-graph-inspector");
|
|
18
|
-
const rethrow_helper_1 = require("@venok/core/helpers/rethrow.helper");
|
|
19
|
-
/**
|
|
20
|
-
* @publicApi
|
|
21
|
-
*/
|
|
22
|
-
class VenokFactoryStatic {
|
|
23
|
-
constructor() {
|
|
24
|
-
this.logger = new logger_service_1.Logger("VenokFactory", {
|
|
25
|
-
timestamp: true,
|
|
26
|
-
});
|
|
27
|
-
this.abortOnError = true;
|
|
28
|
-
this.autoFlushLogs = false;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Creates an instance of VenokApplicationContext.
|
|
32
|
-
*
|
|
33
|
-
* @param moduleCls Entry (root) application module class
|
|
34
|
-
* @param options Optional Venok application configuration
|
|
35
|
-
*
|
|
36
|
-
* @returns A promise that, when resolved,
|
|
37
|
-
* contains a reference to the VenokApplicationContext instance.
|
|
38
|
-
*/
|
|
39
|
-
async createApplicationContext(moduleCls, options) {
|
|
40
|
-
const applicationConfig = new config_1.ApplicationConfig();
|
|
41
|
-
const container = new container_1.VenokContainer(applicationConfig);
|
|
42
|
-
const graphInspector = this.createGraphInspector(options, container);
|
|
43
|
-
this.setAbortOnError(options);
|
|
44
|
-
this.registerLoggerConfiguration(options);
|
|
45
|
-
await this.initialize(moduleCls, container, graphInspector, applicationConfig, options);
|
|
46
|
-
const modules = container.getModules().values();
|
|
47
|
-
const root = modules.next().value;
|
|
48
|
-
const context = this.createVenokInstance(new context_1.ApplicationContext(container, applicationConfig, options, root));
|
|
49
|
-
if (this.autoFlushLogs) {
|
|
50
|
-
context.flushLogsOnOverride();
|
|
51
|
-
}
|
|
52
|
-
// return context.init();
|
|
53
|
-
return context;
|
|
54
|
-
}
|
|
55
|
-
createVenokInstance(instance) {
|
|
56
|
-
return this.createProxy(instance);
|
|
57
|
-
}
|
|
58
|
-
setAbortOnError(options) {
|
|
59
|
-
this.abortOnError = !(options && options.abortOnError === false);
|
|
60
|
-
}
|
|
61
|
-
async initialize(module, container, graphInspector, config = new config_1.ApplicationConfig(), options = {}) {
|
|
62
|
-
uuid_helper_1.UuidFactory.mode = options.snapshot ? uuid_helper_1.UuidFactoryMode.Deterministic : uuid_helper_1.UuidFactoryMode.Random;
|
|
63
|
-
const injector = new injector_1.Injector({ preview: options.preview });
|
|
64
|
-
const instanceLoader = new loader_1.InstanceLoader(container, injector, graphInspector);
|
|
65
|
-
const metadataScanner = new metadata_scanner_1.MetadataScanner();
|
|
66
|
-
const dependenciesScanner = new scanner_1.DependenciesScanner(container, metadataScanner, graphInspector, config);
|
|
67
|
-
// Maybe Error
|
|
68
|
-
const teardown = !this.abortOnError ? rethrow_helper_1.rethrow : undefined;
|
|
69
|
-
try {
|
|
70
|
-
this.logger.log(constants_1.MESSAGES.APPLICATION_START);
|
|
71
|
-
await zone_1.ExceptionsZone.asyncRun(async () => {
|
|
72
|
-
await dependenciesScanner.scan(module);
|
|
73
|
-
await instanceLoader.createInstancesOfDependencies();
|
|
74
|
-
dependenciesScanner.applyApplicationProviders();
|
|
75
|
-
}, teardown, this.autoFlushLogs);
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
this.handleInitializationError(e);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
handleInitializationError(err) {
|
|
82
|
-
if (this.abortOnError) {
|
|
83
|
-
process.abort();
|
|
84
|
-
}
|
|
85
|
-
(0, rethrow_helper_1.rethrow)(err);
|
|
86
|
-
}
|
|
87
|
-
createProxy(target) {
|
|
88
|
-
const proxy = this.createExceptionProxy();
|
|
89
|
-
return new Proxy(target, {
|
|
90
|
-
get: proxy,
|
|
91
|
-
set: proxy,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
createExceptionProxy() {
|
|
95
|
-
return (receiver, prop) => {
|
|
96
|
-
if (!(prop in receiver)) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if ((0, shared_helper_1.isFunction)(receiver[prop])) {
|
|
100
|
-
return this.createExceptionZone(receiver, prop);
|
|
101
|
-
}
|
|
102
|
-
return receiver[prop];
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
createExceptionZone(receiver, prop) {
|
|
106
|
-
// Maybe Error
|
|
107
|
-
const teardown = !this.abortOnError ? rethrow_helper_1.rethrow : undefined;
|
|
108
|
-
return (...args) => {
|
|
109
|
-
let result;
|
|
110
|
-
zone_1.ExceptionsZone.run(() => {
|
|
111
|
-
result = receiver[prop](...args);
|
|
112
|
-
}, teardown);
|
|
113
|
-
return result;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
registerLoggerConfiguration(options) {
|
|
117
|
-
if (!options) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const { logger, bufferLogs, autoFlushLogs } = options;
|
|
121
|
-
if (!!logger && !(0, shared_helper_1.isNull)(logger)) {
|
|
122
|
-
logger_service_1.Logger.overrideLogger(logger);
|
|
123
|
-
}
|
|
124
|
-
if (bufferLogs) {
|
|
125
|
-
logger_service_1.Logger.attachBuffer();
|
|
126
|
-
}
|
|
127
|
-
this.autoFlushLogs = autoFlushLogs ?? true;
|
|
128
|
-
}
|
|
129
|
-
createGraphInspector(appOptions, container) {
|
|
130
|
-
return appOptions?.snapshot ? new graph_inspector_1.GraphInspector(container) : noop_graph_inspector_1.NoopGraphInspector;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.VenokFactoryStatic = VenokFactoryStatic;
|
|
134
|
-
/**
|
|
135
|
-
* Use VenokFactory to create an application instance.
|
|
136
|
-
*
|
|
137
|
-
* ### Specifying an entry module
|
|
138
|
-
*
|
|
139
|
-
* Pass the required *root module* for the application via the module parameter.
|
|
140
|
-
* By convention, it is usually called `ApplicationModule`. Starting with this
|
|
141
|
-
* module, Venok assembles the dependency graph and begins the process of
|
|
142
|
-
* Dependency Injection and instantiates the classes needed to launch your
|
|
143
|
-
* application.
|
|
144
|
-
*
|
|
145
|
-
* @publicApi
|
|
146
|
-
*/
|
|
147
|
-
exports.VenokFactory = new VenokFactoryStatic();
|
package/constants.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export declare const MESSAGES: {
|
|
2
|
-
APPLICATION_START: string;
|
|
3
|
-
APPLICATION_READY: string;
|
|
4
|
-
UNKNOWN_EXCEPTION_MESSAGE: string;
|
|
5
|
-
ERROR_DURING_SHUTDOWN: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const FORBIDDEN_MESSAGE = "Forbidden resource";
|
|
8
|
-
export declare const MODULE_METADATA: {
|
|
9
|
-
IMPORTS: string;
|
|
10
|
-
PROVIDERS: string;
|
|
11
|
-
EXPORTS: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const PIPES_METADATA = "__pipes__";
|
|
14
|
-
export declare const GUARDS_METADATA = "__guards__";
|
|
15
|
-
export declare const INTERCEPTORS_METADATA = "__interceptors__";
|
|
16
|
-
export declare const EXCEPTION_FILTERS_METADATA = "__exceptionFilters__";
|
|
17
|
-
export declare const ENHANCER_KEY_TO_SUBTYPE_MAP: {
|
|
18
|
-
readonly __guards__: "guard";
|
|
19
|
-
readonly __interceptors__: "interceptor";
|
|
20
|
-
readonly __pipes__: "pipe";
|
|
21
|
-
readonly __exceptionFilters__: "filter";
|
|
22
|
-
};
|
|
23
|
-
export type EnhancerSubtype = (typeof ENHANCER_KEY_TO_SUBTYPE_MAP)[keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP];
|
|
24
|
-
export declare const APP_INTERCEPTOR = "APP_INTERCEPTOR";
|
|
25
|
-
export declare const APP_PIPE = "APP_PIPE";
|
|
26
|
-
export declare const APP_GUARD = "APP_GUARD";
|
|
27
|
-
export declare const APP_FILTER = "APP_FILTER";
|
|
28
|
-
export declare const ENHANCER_TOKEN_TO_SUBTYPE_MAP: Record<typeof APP_GUARD | typeof APP_PIPE | typeof APP_FILTER | typeof APP_INTERCEPTOR, EnhancerSubtype>;
|
|
29
|
-
export declare const REQUEST = "REQUEST";
|
|
30
|
-
export declare const GLOBAL_MODULE_METADATA = "__module:global__";
|
|
31
|
-
export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
|
32
|
-
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
|
33
|
-
export declare const OPTIONAL_DEPS_METADATA = "optional:paramtypes";
|
|
34
|
-
export declare const PROPERTY_DEPS_METADATA = "self:properties_metadata";
|
|
35
|
-
export declare const OPTIONAL_PROPERTY_DEPS_METADATA = "optional:properties_metadata";
|
|
36
|
-
export declare const SCOPE_OPTIONS_METADATA = "scope:options";
|
|
37
|
-
export declare const MODULE_PATH = "__module_path__";
|
|
38
|
-
export declare const ROUTE_ARGS_METADATA = "__routeArguments__";
|
|
39
|
-
export declare const CUSTOM_ROUTE_ARGS_METADATA = "__customRouteArgs__";
|
|
40
|
-
export declare const FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__";
|
|
41
|
-
export declare const INJECTABLE_WATERMARK = "__injectable__";
|
|
42
|
-
export declare const CATCH_WATERMARK = "__catch__";
|
|
43
|
-
export declare const ENTRY_PROVIDER_WATERMARK = "__entryProvider__";
|
|
44
|
-
export declare const INQUIRER = "INQUIRER";
|
package/constants.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INQUIRER = exports.ENTRY_PROVIDER_WATERMARK = exports.CATCH_WATERMARK = exports.INJECTABLE_WATERMARK = exports.FILTER_CATCH_EXCEPTIONS = exports.CUSTOM_ROUTE_ARGS_METADATA = exports.ROUTE_ARGS_METADATA = exports.MODULE_PATH = exports.SCOPE_OPTIONS_METADATA = exports.OPTIONAL_PROPERTY_DEPS_METADATA = exports.PROPERTY_DEPS_METADATA = exports.OPTIONAL_DEPS_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.GLOBAL_MODULE_METADATA = exports.REQUEST = exports.ENHANCER_TOKEN_TO_SUBTYPE_MAP = exports.APP_FILTER = exports.APP_GUARD = exports.APP_PIPE = exports.APP_INTERCEPTOR = exports.ENHANCER_KEY_TO_SUBTYPE_MAP = exports.EXCEPTION_FILTERS_METADATA = exports.INTERCEPTORS_METADATA = exports.GUARDS_METADATA = exports.PIPES_METADATA = exports.MODULE_METADATA = exports.FORBIDDEN_MESSAGE = exports.MESSAGES = void 0;
|
|
4
|
-
exports.MESSAGES = {
|
|
5
|
-
APPLICATION_START: `Starting Venok application...`,
|
|
6
|
-
APPLICATION_READY: `Venok application successfully started`,
|
|
7
|
-
UNKNOWN_EXCEPTION_MESSAGE: "Internal server error",
|
|
8
|
-
ERROR_DURING_SHUTDOWN: "Error happened during shutdown",
|
|
9
|
-
};
|
|
10
|
-
exports.FORBIDDEN_MESSAGE = "Forbidden resource";
|
|
11
|
-
exports.MODULE_METADATA = {
|
|
12
|
-
IMPORTS: "imports",
|
|
13
|
-
PROVIDERS: "providers",
|
|
14
|
-
EXPORTS: "exports",
|
|
15
|
-
};
|
|
16
|
-
exports.PIPES_METADATA = "__pipes__";
|
|
17
|
-
exports.GUARDS_METADATA = "__guards__";
|
|
18
|
-
exports.INTERCEPTORS_METADATA = "__interceptors__";
|
|
19
|
-
exports.EXCEPTION_FILTERS_METADATA = "__exceptionFilters__";
|
|
20
|
-
exports.ENHANCER_KEY_TO_SUBTYPE_MAP = {
|
|
21
|
-
[exports.GUARDS_METADATA]: "guard",
|
|
22
|
-
[exports.INTERCEPTORS_METADATA]: "interceptor",
|
|
23
|
-
[exports.PIPES_METADATA]: "pipe",
|
|
24
|
-
[exports.EXCEPTION_FILTERS_METADATA]: "filter",
|
|
25
|
-
};
|
|
26
|
-
exports.APP_INTERCEPTOR = "APP_INTERCEPTOR";
|
|
27
|
-
exports.APP_PIPE = "APP_PIPE";
|
|
28
|
-
exports.APP_GUARD = "APP_GUARD";
|
|
29
|
-
exports.APP_FILTER = "APP_FILTER";
|
|
30
|
-
exports.ENHANCER_TOKEN_TO_SUBTYPE_MAP = {
|
|
31
|
-
[exports.APP_GUARD]: "guard",
|
|
32
|
-
[exports.APP_INTERCEPTOR]: "interceptor",
|
|
33
|
-
[exports.APP_PIPE]: "pipe",
|
|
34
|
-
[exports.APP_FILTER]: "filter",
|
|
35
|
-
};
|
|
36
|
-
exports.REQUEST = "REQUEST";
|
|
37
|
-
exports.GLOBAL_MODULE_METADATA = "__module:global__";
|
|
38
|
-
exports.PARAMTYPES_METADATA = "design:paramtypes";
|
|
39
|
-
exports.SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
|
40
|
-
exports.OPTIONAL_DEPS_METADATA = "optional:paramtypes";
|
|
41
|
-
exports.PROPERTY_DEPS_METADATA = "self:properties_metadata";
|
|
42
|
-
exports.OPTIONAL_PROPERTY_DEPS_METADATA = "optional:properties_metadata";
|
|
43
|
-
exports.SCOPE_OPTIONS_METADATA = "scope:options";
|
|
44
|
-
exports.MODULE_PATH = "__module_path__";
|
|
45
|
-
exports.ROUTE_ARGS_METADATA = "__routeArguments__";
|
|
46
|
-
exports.CUSTOM_ROUTE_ARGS_METADATA = "__customRouteArgs__";
|
|
47
|
-
exports.FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__";
|
|
48
|
-
exports.INJECTABLE_WATERMARK = "__injectable__";
|
|
49
|
-
exports.CATCH_WATERMARK = "__catch__";
|
|
50
|
-
exports.ENTRY_PROVIDER_WATERMARK = "__entryProvider__";
|
|
51
|
-
exports.INQUIRER = "INQUIRER";
|
package/context/context.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Observable } from "rxjs";
|
|
2
|
-
import { ParamData } from "@venok/core/decorators/create-param.decorator";
|
|
3
|
-
import { GuardsConsumer, GuardsContextCreator } from "@venok/core/guards";
|
|
4
|
-
import { InterceptorsConsumer, InterceptorsContextCreator } from "@venok/core/interceptors";
|
|
5
|
-
import { ModulesContainer } from "@venok/core/injector/module/container";
|
|
6
|
-
import { PipesConsumer, PipesContextCreator } from "@venok/core/pipes";
|
|
7
|
-
import { VenokContainer } from "@venok/core/injector/container";
|
|
8
|
-
import { ContextType } from "@venok/core/interfaces/context/arguments-host.interface";
|
|
9
|
-
import { PipeTransform } from "@venok/core/interfaces/features/pipes.interface";
|
|
10
|
-
import { ContextId } from "@venok/core/injector/instance/wrapper";
|
|
11
|
-
import { ContextUtils, ParamProperties } from "@venok/core/helpers/context.helper";
|
|
12
|
-
import { VenokProxy } from "@venok/core/context/proxy";
|
|
13
|
-
import { VenokExceptionFilterContext } from "@venok/core/filters/context";
|
|
14
|
-
export interface ParamsFactory {
|
|
15
|
-
exchangeKeyForValue(type: number, data: ParamData, args: any): any;
|
|
16
|
-
}
|
|
17
|
-
export type ParamsMetadata = Record<number, ParamMetadata>;
|
|
18
|
-
export interface ParamMetadata {
|
|
19
|
-
index: number;
|
|
20
|
-
data?: ParamData;
|
|
21
|
-
}
|
|
22
|
-
type ParamPropertiesWithMetatype<T = any> = ParamProperties & {
|
|
23
|
-
metatype?: T;
|
|
24
|
-
};
|
|
25
|
-
export interface ExternalHandlerMetadata {
|
|
26
|
-
argsLength: number;
|
|
27
|
-
paramtypes: any[];
|
|
28
|
-
getParamsMetadata: (moduleKey: string, contextId?: ContextId, inquirerId?: string) => ParamPropertiesWithMetatype[];
|
|
29
|
-
}
|
|
30
|
-
export interface ExternalContextOptions {
|
|
31
|
-
guards?: boolean;
|
|
32
|
-
interceptors?: boolean;
|
|
33
|
-
filters?: boolean;
|
|
34
|
-
callback?: (result: any | Observable<any>, ...args: any[]) => void;
|
|
35
|
-
}
|
|
36
|
-
export declare class VenokContextCreator {
|
|
37
|
-
private readonly guardsContextCreator;
|
|
38
|
-
private readonly guardsConsumer;
|
|
39
|
-
private readonly interceptorsContextCreator;
|
|
40
|
-
private readonly interceptorsConsumer;
|
|
41
|
-
private readonly modulesContainer;
|
|
42
|
-
private readonly pipesContextCreator;
|
|
43
|
-
private readonly pipesConsumer;
|
|
44
|
-
private readonly filtersContextCreator;
|
|
45
|
-
readonly contextUtils: ContextUtils;
|
|
46
|
-
readonly venokProxy: VenokProxy;
|
|
47
|
-
private container;
|
|
48
|
-
constructor(guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, modulesContainer: ModulesContainer, pipesContextCreator: PipesContextCreator, pipesConsumer: PipesConsumer, filtersContextCreator: VenokExceptionFilterContext);
|
|
49
|
-
static fromContainer(container: VenokContainer): VenokContextCreator;
|
|
50
|
-
create<TParamsMetadata extends ParamsMetadata = ParamsMetadata, TContext extends string = ContextType>(instance: object, callback: (...args: unknown[]) => unknown, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextId?: ContextId, inquirerId?: string, options?: ExternalContextOptions, contextType?: TContext): (...args: any[]) => Promise<any>;
|
|
51
|
-
getMetadata<TMetadata, TContext extends string = ContextType>(instance: any, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextType?: TContext): ExternalHandlerMetadata;
|
|
52
|
-
getContextModuleKey(moduleCtor: Function | undefined): string;
|
|
53
|
-
exchangeKeysForValues<TMetadata extends Record<string | symbol, any>>(keys: string[], metadata: TMetadata, moduleContext: string, paramsFactory: ParamsFactory, contextId?: ContextId, inquirerId?: string, contextFactory?: (args: unknown[]) => import("./execution-host").ExecutionContextHost): ParamProperties[];
|
|
54
|
-
createPipesFn(pipes: PipeTransform[], paramsOptions: (ParamProperties & {
|
|
55
|
-
metatype?: unknown;
|
|
56
|
-
})[]): ((args: unknown[], ...params: unknown[]) => Promise<void>) | null;
|
|
57
|
-
getParamValue<T>(value: T, { metatype, type, data }: {
|
|
58
|
-
metatype: any;
|
|
59
|
-
type: any;
|
|
60
|
-
data: any;
|
|
61
|
-
}, pipes: PipeTransform[]): Promise<any>;
|
|
62
|
-
transformToResult(resultOrDeferred: Observable<any> | any): Promise<any>;
|
|
63
|
-
createGuardsFn<TContext extends string = ContextType>(guards: any[], instance: object, callback: (...args: any[]) => any, contextType?: TContext): Function | null;
|
|
64
|
-
registerRequestProvider<T = any>(request: T, contextId: ContextId): void;
|
|
65
|
-
}
|
|
66
|
-
export {};
|