@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/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thanks for using Venloc Venok <3
|
|
3
|
+
* https://github.com/venloc-tech/svm
|
|
4
|
+
*/
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
import { InspectOptions } from 'util';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* SettlementSignal is used to signal the resolution of a provider/instance.
|
|
10
|
+
* Calling `complete` or `error` will resolve the promise returned by `asPromise`.
|
|
11
|
+
* Can be used to detect circular dependencies.
|
|
12
|
+
*/
|
|
13
|
+
declare class SettlementSignal {
|
|
14
|
+
private readonly _refs;
|
|
15
|
+
private readonly settledPromise;
|
|
16
|
+
private settleFn;
|
|
17
|
+
private completed;
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the promise returned by `asPromise`.
|
|
21
|
+
*/
|
|
22
|
+
complete(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Rejects the promise returned by `asPromise` with the given error.
|
|
25
|
+
* @param err Error to reject the promise returned by `asPromise` with.
|
|
26
|
+
*/
|
|
27
|
+
error(err: unknown): void;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a promise that will be resolved when `complete` or `error` is called.
|
|
30
|
+
* @returns Promise that will be resolved when `complete` or `error` is called.
|
|
31
|
+
*/
|
|
32
|
+
asPromise(): Promise<unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* Inserts a wrapper id that the host of this signal depends on.
|
|
35
|
+
* @param wrapperId Wrapper id to insert.
|
|
36
|
+
*/
|
|
37
|
+
insertRef(wrapperId: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Check if relationship is circular.
|
|
40
|
+
* @param wrapperId Wrapper id to check.
|
|
41
|
+
* @returns True if relationship is circular, false otherwise.
|
|
42
|
+
*/
|
|
43
|
+
isCycle(wrapperId: string): boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare const MESSAGES: {
|
|
47
|
+
APPLICATION_START: string;
|
|
48
|
+
APPLICATION_READY: string;
|
|
49
|
+
UNKNOWN_EXCEPTION_MESSAGE: string;
|
|
50
|
+
ERROR_DURING_SHUTDOWN: string;
|
|
51
|
+
};
|
|
52
|
+
declare const FORBIDDEN_MESSAGE = "Forbidden resource";
|
|
53
|
+
declare const MODULE_METADATA: {
|
|
54
|
+
IMPORTS: string;
|
|
55
|
+
PROVIDERS: string;
|
|
56
|
+
EXPORTS: string;
|
|
57
|
+
};
|
|
58
|
+
declare const PIPES_METADATA = "__pipes__";
|
|
59
|
+
declare const GUARDS_METADATA = "__guards__";
|
|
60
|
+
declare const INTERCEPTORS_METADATA = "__interceptors__";
|
|
61
|
+
declare const EXCEPTION_FILTERS_METADATA = "__exceptionFilters__";
|
|
62
|
+
declare const ENHANCER_KEY_TO_SUBTYPE_MAP: {
|
|
63
|
+
readonly __guards__: "guard";
|
|
64
|
+
readonly __interceptors__: "interceptor";
|
|
65
|
+
readonly __pipes__: "pipe";
|
|
66
|
+
readonly __exceptionFilters__: "filter";
|
|
67
|
+
};
|
|
68
|
+
type EnhancerSubtype = (typeof ENHANCER_KEY_TO_SUBTYPE_MAP)[keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP];
|
|
69
|
+
declare const APP_INTERCEPTOR = "APP_INTERCEPTOR";
|
|
70
|
+
declare const APP_PIPE = "APP_PIPE";
|
|
71
|
+
declare const APP_GUARD = "APP_GUARD";
|
|
72
|
+
declare const APP_FILTER = "APP_FILTER";
|
|
73
|
+
declare const ENHANCER_TOKEN_TO_SUBTYPE_MAP: Record<typeof APP_GUARD | typeof APP_PIPE | typeof APP_FILTER | typeof APP_INTERCEPTOR, EnhancerSubtype>;
|
|
74
|
+
declare const REQUEST = "REQUEST";
|
|
75
|
+
declare const GLOBAL_MODULE_METADATA = "__module:global__";
|
|
76
|
+
declare const PARAMTYPES_METADATA = "design:paramtypes";
|
|
77
|
+
declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
|
78
|
+
declare const OPTIONAL_DEPS_METADATA = "optional:paramtypes";
|
|
79
|
+
declare const PROPERTY_DEPS_METADATA = "self:properties_metadata";
|
|
80
|
+
declare const OPTIONAL_PROPERTY_DEPS_METADATA = "optional:properties_metadata";
|
|
81
|
+
declare const SCOPE_OPTIONS_METADATA = "scope:options";
|
|
82
|
+
declare const MODULE_PATH = "__module_path__";
|
|
83
|
+
declare const ROUTE_ARGS_METADATA = "__routeArguments__";
|
|
84
|
+
declare const CUSTOM_ROUTE_ARGS_METADATA = "__customRouteArgs__";
|
|
85
|
+
declare const FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__";
|
|
86
|
+
declare const INJECTABLE_WATERMARK = "__injectable__";
|
|
87
|
+
declare const CATCH_WATERMARK = "__catch__";
|
|
88
|
+
declare const ENTRY_PROVIDER_WATERMARK = "__entryProvider__";
|
|
89
|
+
declare const INQUIRER = "INQUIRER";
|
|
90
|
+
declare const REQUEST_CONTEXT_ID: unique symbol;
|
|
91
|
+
|
|
92
|
+
type InjectableToken = unknown;
|
|
93
|
+
|
|
94
|
+
interface InstanceLink<T = any> {
|
|
95
|
+
token: InjectionToken;
|
|
96
|
+
wrapperRef: InstanceWrapper<T>;
|
|
97
|
+
collection: Map<InjectionToken, InstanceWrapper>;
|
|
98
|
+
moduleId: string;
|
|
99
|
+
}
|
|
100
|
+
declare class InstanceLinksHost {
|
|
101
|
+
private readonly container;
|
|
102
|
+
private readonly instanceLinks;
|
|
103
|
+
constructor(container: VenokContainer);
|
|
104
|
+
get<T = any>(token: InjectionToken): InstanceLink<T>;
|
|
105
|
+
get<T = any>(token: InjectionToken, options?: {
|
|
106
|
+
moduleId?: string;
|
|
107
|
+
each?: boolean;
|
|
108
|
+
}): InstanceLink<T> | Array<InstanceLink<T>>;
|
|
109
|
+
private initialize;
|
|
110
|
+
private addLink;
|
|
111
|
+
private getInstanceNameByToken;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare class Injector {
|
|
115
|
+
private readonly options?;
|
|
116
|
+
private logger;
|
|
117
|
+
constructor(options?: {
|
|
118
|
+
preview: boolean;
|
|
119
|
+
} | undefined);
|
|
120
|
+
loadPrototype<T>({ token }: InstanceWrapper<T>, collection: Map<InjectionToken, InstanceWrapper<T>>, contextId?: ContextId): void;
|
|
121
|
+
loadInstance<T>(wrapper: InstanceWrapper<T>, collection: Map<InjectionToken, InstanceWrapper>, moduleRef: Module$1, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
|
122
|
+
loadInjectable<T = any>(wrapper: InstanceWrapper<T>, moduleRef: Module$1, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
|
123
|
+
loadProvider(wrapper: InstanceWrapper<InjectableToken>, moduleRef: Module$1, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
|
124
|
+
applySettlementSignal<T>(instancePerContext: InstancePerContext<T>, host: InstanceWrapper<T>): SettlementSignal;
|
|
125
|
+
resolveConstructorParams<T>(wrapper: InstanceWrapper<T>, moduleRef: Module$1, inject: InjectorDependency[] | null, callback: (args: unknown[]) => void | Promise<void>, contextId?: ContextId, inquirer?: InstanceWrapper, parentInquirer?: InstanceWrapper): Promise<void>;
|
|
126
|
+
getClassDependencies<T>(wrapper: InstanceWrapper<T>): [InjectorDependency[], number[]];
|
|
127
|
+
getFactoryProviderDependencies<T>(wrapper: InstanceWrapper<T>): [InjectorDependency[], number[]];
|
|
128
|
+
reflectConstructorParams<T>(type: Type<T>): any[];
|
|
129
|
+
reflectOptionalParams<T>(type: Type<T>): any[];
|
|
130
|
+
reflectSelfParams<T>(type: Type<T>): any[];
|
|
131
|
+
resolveSingleParam<T>(wrapper: InstanceWrapper<T>, param: Type | string | symbol, dependencyContext: InjectorDependencyContext, moduleRef: Module$1, contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number): Promise<InstanceWrapper<any>>;
|
|
132
|
+
resolveParamToken<T>(wrapper: InstanceWrapper<T>, param: Type | string | symbol | any): InjectionToken;
|
|
133
|
+
resolveComponentWrapper<T>(moduleRef: Module$1, token: InjectionToken, dependencyContext: InjectorDependencyContext, wrapper: InstanceWrapper<T>, contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number): Promise<InstanceWrapper>;
|
|
134
|
+
resolveComponentHost<T>(moduleRef: Module$1, instanceWrapper: InstanceWrapper<T | Promise<T>>, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<InstanceWrapper>;
|
|
135
|
+
lookupComponent<T = any>(providers: Map<Function | string | symbol, InstanceWrapper>, moduleRef: Module$1, dependencyContext: InjectorDependencyContext, wrapper: InstanceWrapper<T>, contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number): Promise<InstanceWrapper<T>>;
|
|
136
|
+
lookupComponentInParentModules<T = any>(dependencyContext: InjectorDependencyContext, moduleRef: Module$1, wrapper: InstanceWrapper<T>, contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number): Promise<InstanceWrapper<any>>;
|
|
137
|
+
lookupComponentInImports(moduleRef: Module$1, name: InjectionToken, wrapper: InstanceWrapper, moduleRegistry?: any[], contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number, isTraversing?: boolean): Promise<InstanceWrapper | null>;
|
|
138
|
+
resolveProperties<T>(wrapper: InstanceWrapper<T>, moduleRef: Module$1, inject?: InjectorDependency[], contextId?: ContextId, inquirer?: InstanceWrapper, parentInquirer?: InstanceWrapper): Promise<PropertyDependency[]>;
|
|
139
|
+
reflectProperties<T>(type: Type<T>): PropertyDependency[];
|
|
140
|
+
applyProperties<T = any>(instance: T, properties: PropertyDependency[]): void;
|
|
141
|
+
instantiateClass<T = any>(instances: any[], wrapper: InstanceWrapper, targetMetatype: InstanceWrapper, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<T>;
|
|
142
|
+
loadPerContext<T = any>(instance: T, moduleRef: Module$1, collection: Map<InjectionToken, InstanceWrapper>, ctx: ContextId, wrapper?: InstanceWrapper): Promise<T>;
|
|
143
|
+
loadEnhancersPerContext(wrapper: InstanceWrapper, ctx: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
|
144
|
+
loadCtorMetadata(metadata: InstanceWrapper<any>[], contextId: ContextId, inquirer?: InstanceWrapper, parentInquirer?: InstanceWrapper): Promise<any[]>;
|
|
145
|
+
loadPropertiesMetadata(metadata: PropertyMetadata[], contextId: ContextId, inquirer?: InstanceWrapper): Promise<PropertyDependency[]>;
|
|
146
|
+
private getInquirerId;
|
|
147
|
+
private resolveScopedComponentHost;
|
|
148
|
+
private isInquirerRequest;
|
|
149
|
+
private isInquirer;
|
|
150
|
+
protected addDependencyMetadata(keyOrIndex: symbol | string | number, hostWrapper: InstanceWrapper, instanceWrapper: InstanceWrapper): void;
|
|
151
|
+
private getTokenName;
|
|
152
|
+
private printResolvingDependenciesLog;
|
|
153
|
+
private printLookingForProviderLog;
|
|
154
|
+
private printFoundInModuleLog;
|
|
155
|
+
private isDebugMode;
|
|
156
|
+
private getContextId;
|
|
157
|
+
private getNowTimestamp;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare abstract class AbstractInstanceResolver {
|
|
161
|
+
protected abstract instanceLinksHost: InstanceLinksHost;
|
|
162
|
+
protected abstract injector: Injector;
|
|
163
|
+
protected abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options?: GetOrResolveOptions): TResult | Array<TResult>;
|
|
164
|
+
protected find<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol, options: {
|
|
165
|
+
moduleId?: string;
|
|
166
|
+
each?: boolean;
|
|
167
|
+
}): TResult | Array<TResult>;
|
|
168
|
+
protected resolvePerContext<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol, contextModule: Module$1, contextId: ContextId, options?: GetOrResolveOptions): Promise<TResult | Array<TResult>>;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare abstract class ModuleRef extends AbstractInstanceResolver {
|
|
172
|
+
protected readonly container: VenokContainer;
|
|
173
|
+
protected readonly injector: Injector;
|
|
174
|
+
private _instanceLinksHost;
|
|
175
|
+
protected get instanceLinksHost(): InstanceLinksHost;
|
|
176
|
+
constructor(container: VenokContainer);
|
|
177
|
+
/**
|
|
178
|
+
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
179
|
+
* @returns {TResult}
|
|
180
|
+
*/
|
|
181
|
+
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): TResult;
|
|
182
|
+
/**
|
|
183
|
+
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
184
|
+
* @returns {TResult}
|
|
185
|
+
*/
|
|
186
|
+
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
187
|
+
/**
|
|
188
|
+
* If enabled, lookup will only be performed in the host module.
|
|
189
|
+
* @default true
|
|
190
|
+
*/
|
|
191
|
+
strict?: boolean;
|
|
192
|
+
/** This indicates that only the first instance registered will be returned. */
|
|
193
|
+
each?: undefined | false;
|
|
194
|
+
}): TResult;
|
|
195
|
+
/**
|
|
196
|
+
* Retrieves a list of instances of either injectables or controllers, otherwise, throws exception.
|
|
197
|
+
* @returns {Array<TResult>}
|
|
198
|
+
*/
|
|
199
|
+
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
200
|
+
/**
|
|
201
|
+
* If enabled, lookup will only be performed in the host module.
|
|
202
|
+
* @default true
|
|
203
|
+
*/
|
|
204
|
+
strict?: boolean;
|
|
205
|
+
/** This indicates that a list of instances will be returned. */
|
|
206
|
+
each: true;
|
|
207
|
+
}): Array<TResult>;
|
|
208
|
+
/**
|
|
209
|
+
* Retrieves an instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
210
|
+
* @returns {TResult | Array<TResult>}
|
|
211
|
+
*/
|
|
212
|
+
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options?: ModuleRefGetOrResolveOpts): TResult | Array<TResult>;
|
|
213
|
+
/**
|
|
214
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
215
|
+
* @returns {Array<TResult>}
|
|
216
|
+
*/
|
|
217
|
+
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): Promise<TResult>;
|
|
218
|
+
/**
|
|
219
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
220
|
+
* @returns {Array<TResult>}
|
|
221
|
+
*/
|
|
222
|
+
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
223
|
+
id: number;
|
|
224
|
+
}): Promise<TResult>;
|
|
225
|
+
/**
|
|
226
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
227
|
+
* @returns {Array<TResult>}
|
|
228
|
+
*/
|
|
229
|
+
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
230
|
+
id: number;
|
|
231
|
+
}, options?: {
|
|
232
|
+
strict?: boolean;
|
|
233
|
+
each?: undefined | false;
|
|
234
|
+
}): Promise<TResult>;
|
|
235
|
+
/**
|
|
236
|
+
* Resolves transient or request-scoped instances of either injectables or controllers, otherwise, throws exception.
|
|
237
|
+
* @returns {Array<TResult>}
|
|
238
|
+
*/
|
|
239
|
+
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
240
|
+
id: number;
|
|
241
|
+
}, options?: {
|
|
242
|
+
strict?: boolean;
|
|
243
|
+
each: true;
|
|
244
|
+
}): Promise<Array<TResult>>;
|
|
245
|
+
/**
|
|
246
|
+
* Resolves transient or request-scoped instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
247
|
+
* @returns {Promise<TResult | Array<TResult>>}
|
|
248
|
+
*/
|
|
249
|
+
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
250
|
+
id: number;
|
|
251
|
+
}, options?: ModuleRefGetOrResolveOpts): Promise<TResult | Array<TResult>>;
|
|
252
|
+
abstract create<T = any>(type: Type<T>, contextId?: ContextId): Promise<T>;
|
|
253
|
+
introspect<T = any>(token: Type<T> | string | symbol): IntrospectionResult;
|
|
254
|
+
protected instantiateClass<T = any>(type: Type<T>, moduleRef: Module$1, contextId?: ContextId): Promise<T>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
declare class Module$1 {
|
|
258
|
+
private readonly _metatype;
|
|
259
|
+
private readonly container;
|
|
260
|
+
private readonly _id;
|
|
261
|
+
private readonly _imports;
|
|
262
|
+
private readonly _providers;
|
|
263
|
+
private readonly _injectables;
|
|
264
|
+
private readonly _entryProviderKeys;
|
|
265
|
+
private readonly _exports;
|
|
266
|
+
private _distance;
|
|
267
|
+
private _initOnPreview;
|
|
268
|
+
private _isGlobal;
|
|
269
|
+
private _token;
|
|
270
|
+
constructor(_metatype: Type, container: VenokContainer);
|
|
271
|
+
get id(): string;
|
|
272
|
+
get token(): string;
|
|
273
|
+
set token(token: string);
|
|
274
|
+
get name(): string;
|
|
275
|
+
get isGlobal(): boolean;
|
|
276
|
+
set isGlobal(global: boolean);
|
|
277
|
+
get initOnPreview(): boolean;
|
|
278
|
+
set initOnPreview(initOnPreview: boolean);
|
|
279
|
+
get providers(): Map<InjectionToken, InstanceWrapper<InjectableToken>>;
|
|
280
|
+
get imports(): Set<Module$1>;
|
|
281
|
+
get injectables(): Map<InjectionToken, InstanceWrapper<InjectableToken>>;
|
|
282
|
+
get entryProviders(): Array<InstanceWrapper<InjectableToken>>;
|
|
283
|
+
get exports(): Set<InjectionToken>;
|
|
284
|
+
get instance(): VenokModule;
|
|
285
|
+
get metatype(): Type;
|
|
286
|
+
get distance(): number;
|
|
287
|
+
set distance(value: number);
|
|
288
|
+
addCoreProviders(): void;
|
|
289
|
+
addModuleRef(): void;
|
|
290
|
+
addModuleAsProvider(): void;
|
|
291
|
+
addApplicationConfig(): void;
|
|
292
|
+
addInjectable<T extends InjectableToken>(injectable: Provider, enhancerSubtype: EnhancerSubtype, host?: Type<T>): string | symbol | Function | InstanceWrapper<unknown>;
|
|
293
|
+
assignProviderUniqueId(provider: Type): void;
|
|
294
|
+
addProvider(provider: Provider, enhancerSubtype?: EnhancerSubtype): InjectionToken;
|
|
295
|
+
isCustomProvider(provider: Provider): provider is ClassProvider | FactoryProvider | ValueProvider | ExistingProvider;
|
|
296
|
+
addCustomProvider(provider: ClassProvider | FactoryProvider | ValueProvider | ExistingProvider, collection: Map<InjectionToken, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): InjectionToken;
|
|
297
|
+
isCustomClass(provider: any): provider is ClassProvider;
|
|
298
|
+
isCustomValue(provider: any): provider is ValueProvider;
|
|
299
|
+
isCustomFactory(provider: any): provider is FactoryProvider;
|
|
300
|
+
isCustomUseExisting(provider: any): provider is ExistingProvider;
|
|
301
|
+
isDynamicModule(exported: any): exported is DynamicModule;
|
|
302
|
+
addCustomClass(provider: ClassProvider, collection: Map<InjectionToken, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
|
|
303
|
+
addCustomValue(provider: ValueProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
|
|
304
|
+
addCustomFactory(provider: FactoryProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
|
|
305
|
+
addCustomUseExisting(provider: ExistingProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
|
|
306
|
+
addExportedProviderOrModule(toExport: Provider | string | symbol | DynamicModule): Set<InjectionToken> | undefined;
|
|
307
|
+
addCustomExportedProvider(provider: FactoryProvider | ValueProvider | ClassProvider | ExistingProvider): Set<InjectionToken> | undefined;
|
|
308
|
+
validateExportedProvider(token: InjectionToken): InjectionToken;
|
|
309
|
+
addImport(moduleRef: Module$1): void;
|
|
310
|
+
replace(toReplace: InjectionToken, options: any): void;
|
|
311
|
+
hasProvider(token: InjectionToken): boolean;
|
|
312
|
+
hasInjectable(token: InjectionToken): boolean;
|
|
313
|
+
getProviderByKey<T = any>(name: InjectionToken): InstanceWrapper<T>;
|
|
314
|
+
getProviderById<T = any>(id: string): InstanceWrapper<T> | undefined;
|
|
315
|
+
getInjectableById<T = any>(id: string): InstanceWrapper<T> | undefined;
|
|
316
|
+
getNonAliasProviders(): Array<[InjectionToken, InstanceWrapper<InjectableToken>]>;
|
|
317
|
+
createModuleReferenceType(): Type<ModuleRef>;
|
|
318
|
+
private isEntryProvider;
|
|
319
|
+
private generateUuid;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* @publicApi
|
|
324
|
+
*/
|
|
325
|
+
declare enum Scope {
|
|
326
|
+
/**
|
|
327
|
+
* The provider can be shared across multiple classes. The provider lifetime
|
|
328
|
+
* is strictly tied to the application lifecycle. Once the application has
|
|
329
|
+
* bootstrapped, all providers have been instantiated.
|
|
330
|
+
*/
|
|
331
|
+
DEFAULT = 0,
|
|
332
|
+
/**
|
|
333
|
+
* A new private instance of the provider is instantiated for every use
|
|
334
|
+
*/
|
|
335
|
+
TRANSIENT = 1,
|
|
336
|
+
/**
|
|
337
|
+
* A new instance is instantiated for each request processing pipeline
|
|
338
|
+
*/
|
|
339
|
+
REQUEST = 2
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
declare const INSTANCE_METADATA_SYMBOL: unique symbol;
|
|
343
|
+
declare const INSTANCE_ID_SYMBOL: unique symbol;
|
|
344
|
+
interface PropertyMetadata {
|
|
345
|
+
key: symbol | string;
|
|
346
|
+
wrapper: InstanceWrapper;
|
|
347
|
+
}
|
|
348
|
+
declare class InstanceWrapper<T = any> {
|
|
349
|
+
readonly isAlias: boolean;
|
|
350
|
+
scope?: Scope;
|
|
351
|
+
readonly name: string;
|
|
352
|
+
readonly token: InjectionToken;
|
|
353
|
+
readonly async?: boolean;
|
|
354
|
+
readonly host?: Module$1;
|
|
355
|
+
readonly subtype?: EnhancerSubtype;
|
|
356
|
+
metatype?: Type<T> | Function | null;
|
|
357
|
+
inject?: FactoryProvider["inject"] | null;
|
|
358
|
+
forwardRef?: boolean;
|
|
359
|
+
durable?: boolean;
|
|
360
|
+
initTime?: number;
|
|
361
|
+
settlementSignal?: SettlementSignal;
|
|
362
|
+
private static logger;
|
|
363
|
+
private readonly values;
|
|
364
|
+
private readonly [INSTANCE_METADATA_SYMBOL];
|
|
365
|
+
private readonly [INSTANCE_ID_SYMBOL];
|
|
366
|
+
private transientMap;
|
|
367
|
+
private isTreeStatic;
|
|
368
|
+
private isTreeDurable;
|
|
369
|
+
/**
|
|
370
|
+
* The root inquirer reference. Present only if child instance wrapper
|
|
371
|
+
* is transient and has a parent inquirer.
|
|
372
|
+
*/
|
|
373
|
+
private rootInquirer;
|
|
374
|
+
constructor(metadata?: Partial<InstanceWrapper<T>> & Partial<InstancePerContext<T>>);
|
|
375
|
+
get id(): string;
|
|
376
|
+
set instance(value: T);
|
|
377
|
+
get instance(): T | undefined;
|
|
378
|
+
get isNotMetatype(): boolean;
|
|
379
|
+
get isFactory(): boolean;
|
|
380
|
+
get isTransient(): boolean;
|
|
381
|
+
getInstanceByContextId(contextId: ContextId, inquirerId?: string): InstancePerContext<T>;
|
|
382
|
+
getInstanceByInquirerId(contextId: ContextId, inquirerId: string): InstancePerContext<T>;
|
|
383
|
+
setInstanceByContextId(contextId: ContextId, value: InstancePerContext<T>, inquirerId?: string): void;
|
|
384
|
+
setInstanceByInquirerId(contextId: ContextId, inquirerId: string, value: InstancePerContext<T>): void;
|
|
385
|
+
removeInstanceByContextId(contextId: ContextId, inquirerId?: string): void;
|
|
386
|
+
removeInstanceByInquirerId(contextId: ContextId, inquirerId: string): void;
|
|
387
|
+
addCtorMetadata(index: number, wrapper: InstanceWrapper): void;
|
|
388
|
+
getCtorMetadata(): InstanceWrapper[];
|
|
389
|
+
addPropertiesMetadata(key: symbol | string, wrapper: InstanceWrapper): void;
|
|
390
|
+
getPropertiesMetadata(): PropertyMetadata[];
|
|
391
|
+
addEnhancerMetadata(wrapper: InstanceWrapper): void;
|
|
392
|
+
getEnhancersMetadata(): InstanceWrapper[];
|
|
393
|
+
isDependencyTreeDurable(lookupRegistry?: string[]): boolean;
|
|
394
|
+
introspectDepsAttribute(callback: (collection: InstanceWrapper[], lookupRegistry: string[]) => boolean, lookupRegistry?: string[]): boolean;
|
|
395
|
+
isDependencyTreeStatic(lookupRegistry?: string[]): boolean;
|
|
396
|
+
cloneStaticInstance(contextId: ContextId): InstancePerContext<T>;
|
|
397
|
+
cloneTransientInstance(contextId: ContextId, inquirerId: string): InstancePerContext<T>;
|
|
398
|
+
createPrototype(contextId: ContextId): any;
|
|
399
|
+
isInRequestScope(contextId: ContextId, inquirer?: InstanceWrapper): boolean;
|
|
400
|
+
isLazyTransient(contextId: ContextId, inquirer: InstanceWrapper | undefined): boolean;
|
|
401
|
+
isExplicitlyRequested(contextId: ContextId, inquirer?: InstanceWrapper): boolean;
|
|
402
|
+
isStatic(contextId: ContextId, inquirer: InstanceWrapper | undefined): boolean;
|
|
403
|
+
attachRootInquirer(inquirer: InstanceWrapper): void;
|
|
404
|
+
getRootInquirer(): InstanceWrapper | undefined;
|
|
405
|
+
getStaticTransientInstances(): InstancePerContext<T>[];
|
|
406
|
+
mergeWith(provider: Provider): void;
|
|
407
|
+
private isNewable;
|
|
408
|
+
private initialize;
|
|
409
|
+
private printIntrospectedAsRequestScoped;
|
|
410
|
+
private printIntrospectedAsDurable;
|
|
411
|
+
private isDebugMode;
|
|
412
|
+
private generateUuid;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
declare class TokenFactory {
|
|
416
|
+
private readonly moduleTokenCache;
|
|
417
|
+
private readonly moduleIdsCache;
|
|
418
|
+
create(metatype: Type, dynamicModuleMetadata?: Partial<DynamicModule>): string;
|
|
419
|
+
getStaticModuleToken(moduleId: string, moduleName: string): string;
|
|
420
|
+
getStringifiedOpaqueToken(opaqueToken: object | undefined): string;
|
|
421
|
+
getModuleId(metatype: Type): string;
|
|
422
|
+
getModuleName(metatype: Type): string;
|
|
423
|
+
private hashString;
|
|
424
|
+
private replacer;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
declare class ModuleCompiler {
|
|
428
|
+
private readonly moduleTokenFactory;
|
|
429
|
+
constructor(moduleTokenFactory?: TokenFactory);
|
|
430
|
+
compile(metatype: Type | DynamicModule | Promise<DynamicModule>): Promise<ModuleFactory>;
|
|
431
|
+
extractMetadata(metatype: Type | ForwardReference | DynamicModule): {
|
|
432
|
+
type: Type;
|
|
433
|
+
dynamicMetadata?: Partial<DynamicModule> | undefined;
|
|
434
|
+
};
|
|
435
|
+
isDynamicModule(module: Type | DynamicModule | ForwardReference): module is DynamicModule;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
declare class ModulesContainer extends Map<string, Module$1> {
|
|
439
|
+
#private;
|
|
440
|
+
get applicationId(): string;
|
|
441
|
+
getById(id: string): Module$1 | undefined;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
type WithOptionalId<T extends Record<"id", string>> = Omit<T, "id"> & Partial<Pick<T, "id">>;
|
|
445
|
+
declare class SerializedGraph {
|
|
446
|
+
private readonly nodes;
|
|
447
|
+
private readonly edges;
|
|
448
|
+
private readonly entrypoints;
|
|
449
|
+
private readonly extras;
|
|
450
|
+
private _status;
|
|
451
|
+
private _metadata?;
|
|
452
|
+
private static readonly INTERNAL_PROVIDERS;
|
|
453
|
+
set status(status: SerializedGraphStatus);
|
|
454
|
+
set metadata(metadata: SerializedGraphMetadata);
|
|
455
|
+
insertNode(nodeDefinition: Node): Node | undefined;
|
|
456
|
+
insertEdge(edgeDefinition: WithOptionalId<Edge>): {
|
|
457
|
+
id: string;
|
|
458
|
+
source: string;
|
|
459
|
+
target: string;
|
|
460
|
+
metadata: ({
|
|
461
|
+
type: "module-to-module";
|
|
462
|
+
} & {
|
|
463
|
+
sourceModuleName: string;
|
|
464
|
+
targetModuleName: string;
|
|
465
|
+
}) | ({
|
|
466
|
+
type: "class-to-class";
|
|
467
|
+
sourceClassName: string;
|
|
468
|
+
targetClassName: string;
|
|
469
|
+
sourceClassToken: InjectionToken;
|
|
470
|
+
targetClassToken: InjectionToken;
|
|
471
|
+
injectionType: "constructor" | "property" | "decorator";
|
|
472
|
+
keyOrIndex?: string | number | symbol;
|
|
473
|
+
internal?: boolean;
|
|
474
|
+
} & {
|
|
475
|
+
sourceModuleName: string;
|
|
476
|
+
targetModuleName: string;
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
insertEntrypoint<T>(definition: Entrypoint<T>, parentId: string): void;
|
|
480
|
+
insertOrphanedEnhancer(entry: OrphanedEnhancerDefinition): void;
|
|
481
|
+
insertAttachedEnhancer(nodeId: string): void;
|
|
482
|
+
getNodeById(id: string): Node | undefined;
|
|
483
|
+
toJSON(): SerializedGraphJson;
|
|
484
|
+
toString(): string;
|
|
485
|
+
private generateUuidByEdgeDefinition;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
type ModuleMetatype = Type | DynamicModule | Promise<DynamicModule>;
|
|
489
|
+
type ModuleScope = Type[];
|
|
490
|
+
declare class VenokContainer {
|
|
491
|
+
private readonly _applicationConfig;
|
|
492
|
+
private readonly globalModules;
|
|
493
|
+
private readonly moduleTokenFactory;
|
|
494
|
+
private readonly moduleCompiler;
|
|
495
|
+
private readonly modules;
|
|
496
|
+
private readonly dynamicModulesMetadata;
|
|
497
|
+
private readonly _serializedGraph;
|
|
498
|
+
private internalCoreModule;
|
|
499
|
+
constructor(_applicationConfig?: ApplicationConfig);
|
|
500
|
+
get serializedGraph(): SerializedGraph;
|
|
501
|
+
get applicationConfig(): ApplicationConfig;
|
|
502
|
+
addModule(metatype: ModuleMetatype | undefined, scope: ModuleScope): Promise<{
|
|
503
|
+
moduleRef: Module$1;
|
|
504
|
+
inserted: boolean;
|
|
505
|
+
} | undefined>;
|
|
506
|
+
replaceModule(metatypeToReplace: ModuleMetatype, newMetatype: ModuleMetatype, scope: ModuleScope): Promise<{
|
|
507
|
+
moduleRef: Module$1;
|
|
508
|
+
inserted: boolean;
|
|
509
|
+
} | undefined>;
|
|
510
|
+
private setModule;
|
|
511
|
+
addDynamicMetadata(token: string, dynamicModuleMetadata: Partial<DynamicModule> | undefined, scope: Type[]): Promise<void>;
|
|
512
|
+
addDynamicModules(modules: any[] | undefined, scope: Type[]): Promise<void>;
|
|
513
|
+
isGlobalModule(metatype: Type, dynamicMetadata?: Partial<DynamicModule>): boolean;
|
|
514
|
+
addGlobalModule(module: Module$1): void;
|
|
515
|
+
getModules(): ModulesContainer;
|
|
516
|
+
getModuleCompiler(): ModuleCompiler;
|
|
517
|
+
getModuleByKey(moduleKey: string): Module$1;
|
|
518
|
+
getInternalCoreModuleRef(): Module$1 | undefined;
|
|
519
|
+
addImport(relatedModule: Type | DynamicModule, token: string): Promise<void>;
|
|
520
|
+
addProvider(provider: Provider, token: string, enhancerSubtype?: EnhancerSubtype): string | symbol | Function;
|
|
521
|
+
addInjectable(injectable: Provider, token: string, enhancerSubtype: EnhancerSubtype, host?: Type<InjectableToken>): string | symbol | Function | InstanceWrapper<unknown>;
|
|
522
|
+
addExportedProviderOrModule(provider: Type, token: string): void;
|
|
523
|
+
clear(): void;
|
|
524
|
+
replace(toReplace: any, options: any & {
|
|
525
|
+
scope: any[] | null;
|
|
526
|
+
}): void;
|
|
527
|
+
bindGlobalScope(): void;
|
|
528
|
+
bindGlobalsToImports(moduleRef: Module$1): void;
|
|
529
|
+
bindGlobalModuleToModule(target: Module$1, globalModule: Module$1): void;
|
|
530
|
+
getDynamicMetadataByToken(token: string): Partial<DynamicModule>;
|
|
531
|
+
getDynamicMetadataByToken<K extends Exclude<keyof DynamicModule, "global" | "module">>(token: string, metadataKey: K): DynamicModule[K];
|
|
532
|
+
registerCoreModuleRef(moduleRef: Module$1): void;
|
|
533
|
+
getModuleTokenFactory(): TokenFactory;
|
|
534
|
+
getContextId<T extends Record<any, unknown> = any>(request: T, isTreeDurable: boolean): ContextId;
|
|
535
|
+
registerRequestProvider<T = any>(request: T, contextId: ContextId): void;
|
|
536
|
+
private shouldInitOnPreview;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* System signals which shut down a process
|
|
541
|
+
*/
|
|
542
|
+
declare enum ShutdownSignal {
|
|
543
|
+
SIGHUP = "SIGHUP",
|
|
544
|
+
SIGINT = "SIGINT",
|
|
545
|
+
SIGQUIT = "SIGQUIT",
|
|
546
|
+
SIGILL = "SIGILL",
|
|
547
|
+
SIGTRAP = "SIGTRAP",
|
|
548
|
+
SIGABRT = "SIGABRT",
|
|
549
|
+
SIGBUS = "SIGBUS",
|
|
550
|
+
SIGFPE = "SIGFPE",
|
|
551
|
+
SIGSEGV = "SIGSEGV",
|
|
552
|
+
SIGUSR2 = "SIGUSR2",
|
|
553
|
+
SIGTERM = "SIGTERM"
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
interface GetOrResolveOptions {
|
|
557
|
+
/**
|
|
558
|
+
* If enabled, lookup will only be performed in the host module.
|
|
559
|
+
* @default false
|
|
560
|
+
*/
|
|
561
|
+
strict?: boolean;
|
|
562
|
+
/**
|
|
563
|
+
* If enabled, instead of returning a first instance registered under a given token,
|
|
564
|
+
* a list of instances will be returned.
|
|
565
|
+
* @default false
|
|
566
|
+
*/
|
|
567
|
+
each?: boolean;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Interface defining ApplicationContext.
|
|
571
|
+
*
|
|
572
|
+
* @publicApi
|
|
573
|
+
*/
|
|
574
|
+
interface VenokApplicationContext {
|
|
575
|
+
container: VenokContainer;
|
|
576
|
+
/**
|
|
577
|
+
* Allows navigating through the modules tree, for example, to pull out a specific instance from the selected module.
|
|
578
|
+
* @returns {VenokApplicationContext}
|
|
579
|
+
*/
|
|
580
|
+
select<T>(module: Type<T> | DynamicModule): VenokApplicationContext;
|
|
581
|
+
/**
|
|
582
|
+
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
583
|
+
* @returns {TResult}
|
|
584
|
+
*/
|
|
585
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): TResult;
|
|
586
|
+
/**
|
|
587
|
+
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
588
|
+
* @returns {TResult}
|
|
589
|
+
*/
|
|
590
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
591
|
+
strict?: boolean;
|
|
592
|
+
each?: undefined | false;
|
|
593
|
+
}): TResult;
|
|
594
|
+
/**
|
|
595
|
+
* Retrieves a list of instances of either injectables or controllers, otherwise, throws exception.
|
|
596
|
+
* @returns {Array<TResult>}
|
|
597
|
+
*/
|
|
598
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
599
|
+
strict?: boolean;
|
|
600
|
+
each: true;
|
|
601
|
+
}): Array<TResult>;
|
|
602
|
+
/**
|
|
603
|
+
* Retrieves an instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
604
|
+
* @returns {TResult | Array<TResult>}
|
|
605
|
+
*/
|
|
606
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options?: GetOrResolveOptions): TResult | Array<TResult>;
|
|
607
|
+
/**
|
|
608
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
609
|
+
* @returns {Array<TResult>}
|
|
610
|
+
*/
|
|
611
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): Promise<TResult>;
|
|
612
|
+
/**
|
|
613
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
614
|
+
* @returns {Array<TResult>}
|
|
615
|
+
*/
|
|
616
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
617
|
+
id: number;
|
|
618
|
+
}): Promise<TResult>;
|
|
619
|
+
/**
|
|
620
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
621
|
+
* @returns {Array<TResult>}
|
|
622
|
+
*/
|
|
623
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
624
|
+
id: number;
|
|
625
|
+
}, options?: {
|
|
626
|
+
strict?: boolean;
|
|
627
|
+
each?: undefined | false;
|
|
628
|
+
}): Promise<TResult>;
|
|
629
|
+
/**
|
|
630
|
+
* Resolves transient or request-scoped instances of either injectables or controllers, otherwise, throws exception.
|
|
631
|
+
* @returns {Array<TResult>}
|
|
632
|
+
*/
|
|
633
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
634
|
+
id: number;
|
|
635
|
+
}, options?: {
|
|
636
|
+
strict?: boolean;
|
|
637
|
+
each: true;
|
|
638
|
+
}): Promise<Array<TResult>>;
|
|
639
|
+
/**
|
|
640
|
+
* Resolves transient or request-scoped instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
|
|
641
|
+
* @returns {Promise<TResult | Array<TResult>>}
|
|
642
|
+
*/
|
|
643
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
644
|
+
id: number;
|
|
645
|
+
}, options?: GetOrResolveOptions): Promise<TResult | Array<TResult>>;
|
|
646
|
+
/**
|
|
647
|
+
* Registers the request/context object for a given context ID (DI container sub-tree).
|
|
648
|
+
* @returns {void}
|
|
649
|
+
*/
|
|
650
|
+
registerRequestByContextId<T = any>(request: T, contextId: {
|
|
651
|
+
id: number;
|
|
652
|
+
}): void;
|
|
653
|
+
/**
|
|
654
|
+
* Terminates the application
|
|
655
|
+
* @returns {Promise<void>}
|
|
656
|
+
*/
|
|
657
|
+
close(): Promise<void>;
|
|
658
|
+
/**
|
|
659
|
+
* Sets custom logger service.
|
|
660
|
+
* Flushes buffered logs if auto flush is on.
|
|
661
|
+
* @returns {void}
|
|
662
|
+
*/
|
|
663
|
+
useLogger(logger: LoggerService | LogLevel[] | false): void;
|
|
664
|
+
/**
|
|
665
|
+
* Registers exception filters as global filters (will be used within
|
|
666
|
+
* every route handler)
|
|
667
|
+
*
|
|
668
|
+
* @param {...ExceptionFilter} filters
|
|
669
|
+
*/
|
|
670
|
+
useGlobalFilters(...filters: ExceptionFilter[]): this;
|
|
671
|
+
/**
|
|
672
|
+
* Registers pipes as global pipes (will be used within every route handler)
|
|
673
|
+
*
|
|
674
|
+
* @param {...PipeTransform} pipes
|
|
675
|
+
*/
|
|
676
|
+
useGlobalPipes(...pipes: PipeTransform<any>[]): this;
|
|
677
|
+
/**
|
|
678
|
+
* Registers interceptors as global interceptors (will be used within
|
|
679
|
+
* every route handler)
|
|
680
|
+
*
|
|
681
|
+
* @param {...VenokInterceptor} interceptors
|
|
682
|
+
*/
|
|
683
|
+
useGlobalInterceptors(...interceptors: VenokInterceptor[]): this;
|
|
684
|
+
/**
|
|
685
|
+
* Registers guards as global guards (will be used within every route handler)
|
|
686
|
+
*
|
|
687
|
+
* @param {...CanActivate} guards
|
|
688
|
+
*/
|
|
689
|
+
useGlobalGuards(...guards: CanActivate[]): this;
|
|
690
|
+
/**
|
|
691
|
+
* Prints buffered logs and detaches buffer.
|
|
692
|
+
* @returns {void}
|
|
693
|
+
*/
|
|
694
|
+
flushLogs(): void;
|
|
695
|
+
/**
|
|
696
|
+
* Enables the usage of shutdown hooks. Will call the
|
|
697
|
+
* `onApplicationShutdown` function of a provider if the
|
|
698
|
+
* process receives a shutdown signal.
|
|
699
|
+
*
|
|
700
|
+
* @returns {this} The Venok application context instance
|
|
701
|
+
*/
|
|
702
|
+
enableShutdownHooks(signals?: ShutdownSignal[] | string[]): this;
|
|
703
|
+
/**
|
|
704
|
+
* Initializes the Venok application.
|
|
705
|
+
* Calls the Venok lifecycle events.
|
|
706
|
+
* It isn't mandatory to call this method directly.
|
|
707
|
+
*
|
|
708
|
+
* @returns {Promise<this>} The ApplicationContext instance as Promise
|
|
709
|
+
*/
|
|
710
|
+
init(): Promise<this>;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
type SelectOptions = Pick<ApplicationContextOptions, "abortOnError">;
|
|
714
|
+
/**
|
|
715
|
+
* @publicApi
|
|
716
|
+
*/
|
|
717
|
+
declare class ApplicationContextOptions {
|
|
718
|
+
/**
|
|
719
|
+
* Specifies the logger to use. Pass `false` to turn off logging.
|
|
720
|
+
*/
|
|
721
|
+
logger?: LoggerService | LogLevel[] | false;
|
|
722
|
+
/**
|
|
723
|
+
* Whether to abort the process on Error. By default, the process is exited.
|
|
724
|
+
* Pass `false` to override the default behavior. If `false` is passed, Venok will not exit
|
|
725
|
+
* the application and instead will rethrow the exception.
|
|
726
|
+
* @default true
|
|
727
|
+
*/
|
|
728
|
+
abortOnError?: boolean | undefined;
|
|
729
|
+
/**
|
|
730
|
+
* If enabled, logs will be buffered until the "Logger#flush" method is called.
|
|
731
|
+
* @default false
|
|
732
|
+
*/
|
|
733
|
+
bufferLogs?: boolean;
|
|
734
|
+
/**
|
|
735
|
+
* If enabled, logs will be automatically flushed and buffer detached when
|
|
736
|
+
* application initialization process either completes or fails.
|
|
737
|
+
* @default true
|
|
738
|
+
*/
|
|
739
|
+
autoFlushLogs?: boolean;
|
|
740
|
+
/**
|
|
741
|
+
* Whether to run application in the preview mode.
|
|
742
|
+
* In the preview mode, providers/controllers are not instantiated & resolved.
|
|
743
|
+
*
|
|
744
|
+
* @default false
|
|
745
|
+
*/
|
|
746
|
+
preview?: boolean;
|
|
747
|
+
/**
|
|
748
|
+
* Whether to generate a serialized graph snapshot.
|
|
749
|
+
*
|
|
750
|
+
* @default false
|
|
751
|
+
*/
|
|
752
|
+
snapshot?: boolean;
|
|
753
|
+
/**
|
|
754
|
+
* If enabled, will force the use of console.log/console.error instead of process.stdout/stderr.write
|
|
755
|
+
* in the default ConsoleLogger. This is useful for test environments like Jest that can buffer console calls.
|
|
756
|
+
* @default false
|
|
757
|
+
*/
|
|
758
|
+
forceConsole?: boolean;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
type ContextType = "native" | string;
|
|
762
|
+
/**
|
|
763
|
+
* Provides methods for retrieving the arguments being passed to a handler.
|
|
764
|
+
* Allows choosing the appropriate execution context to retrieve the arguments from.
|
|
765
|
+
*
|
|
766
|
+
* @publicApi
|
|
767
|
+
*/
|
|
768
|
+
interface ArgumentsHost {
|
|
769
|
+
/**
|
|
770
|
+
* Returns the array of arguments being passed to the handler.
|
|
771
|
+
*/
|
|
772
|
+
getArgs<T extends Array<any> = any[]>(): T;
|
|
773
|
+
/**
|
|
774
|
+
* Returns a particular argument by index.
|
|
775
|
+
* @param index index of argument to retrieve
|
|
776
|
+
*/
|
|
777
|
+
getArgByIndex<T = any>(index: number): T;
|
|
778
|
+
/**
|
|
779
|
+
* Returns the current execution context type (string)
|
|
780
|
+
*/
|
|
781
|
+
getType<TContext extends string = ContextType>(): TContext;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
interface ExternalHandlerMetadata {
|
|
785
|
+
argsLength: number;
|
|
786
|
+
paramtypes: any[];
|
|
787
|
+
getParamsMetadata: GetParamsMetadata;
|
|
788
|
+
}
|
|
789
|
+
interface ExternalContextOptions {
|
|
790
|
+
guards?: boolean;
|
|
791
|
+
interceptors?: boolean;
|
|
792
|
+
filters?: boolean;
|
|
793
|
+
callback?: (result: any | Observable<any>, ...args: any[]) => void;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
type ContextIdResolverFn = (info: HostComponentInfo) => ContextId;
|
|
797
|
+
interface ContextIdResolver {
|
|
798
|
+
/**
|
|
799
|
+
* Payload associated with the custom context id
|
|
800
|
+
*/
|
|
801
|
+
payload: unknown;
|
|
802
|
+
/**
|
|
803
|
+
* A context id resolver function
|
|
804
|
+
*/
|
|
805
|
+
resolve: ContextIdResolverFn;
|
|
806
|
+
}
|
|
807
|
+
interface ContextIdStrategy<T = any> {
|
|
808
|
+
/**
|
|
809
|
+
* Allows to attach a parent context id to the existing child context id.
|
|
810
|
+
* This lets you construct durable DI subtrees that can be shared between contexts.
|
|
811
|
+
* @param contextId auto-generated child context id
|
|
812
|
+
* @param request request object
|
|
813
|
+
*/
|
|
814
|
+
attach(contextId: ContextId, request: T): ContextIdResolverFn | ContextIdResolver | undefined;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
interface VenokContextCreatorInterface {
|
|
818
|
+
create: (...args: any[]) => any;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Interface describing details about the current request pipeline.
|
|
823
|
+
*
|
|
824
|
+
* @publicApi
|
|
825
|
+
*/
|
|
826
|
+
interface ExecutionContext extends ArgumentsHost {
|
|
827
|
+
/**
|
|
828
|
+
* Returns the *type* of the controller class which the current handler belongs to.
|
|
829
|
+
*/
|
|
830
|
+
getClass<T = any>(): Type<T>;
|
|
831
|
+
/**
|
|
832
|
+
* Returns a reference to the handler (method) that will be invoked next in the
|
|
833
|
+
* request pipeline.
|
|
834
|
+
*/
|
|
835
|
+
getHandler(): Function;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
type ParamData = object | string | number;
|
|
839
|
+
interface ParamProperties<T = any, IExtractor extends Function = any> {
|
|
840
|
+
index: number;
|
|
841
|
+
type: T | string;
|
|
842
|
+
data: ParamData;
|
|
843
|
+
pipes: PipeTransform[];
|
|
844
|
+
extractValue: IExtractor;
|
|
845
|
+
}
|
|
846
|
+
interface VenokParamsFactoryInterface<TKey = unknown> {
|
|
847
|
+
exchangeKeyForValue(key: TKey | string, data: any, args: any[]): any;
|
|
848
|
+
}
|
|
849
|
+
type ParamsMetadata = Record<number, ParamMetadata>;
|
|
850
|
+
interface ParamMetadata {
|
|
851
|
+
index: number;
|
|
852
|
+
data?: ParamData;
|
|
853
|
+
}
|
|
854
|
+
type ParamPropertiesWithMetatype<T = any> = ParamProperties & {
|
|
855
|
+
metatype?: T;
|
|
856
|
+
};
|
|
857
|
+
type GetParamsMetadata = (moduleKey: string, contextId?: ContextId, inquirerId?: string) => ParamPropertiesWithMetatype[];
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Interface describing implementation of an exception filter.
|
|
861
|
+
*
|
|
862
|
+
* @publicApi
|
|
863
|
+
*/
|
|
864
|
+
interface ExceptionFilter<T = any> {
|
|
865
|
+
/**
|
|
866
|
+
* Method to implement a custom exception filter.
|
|
867
|
+
*
|
|
868
|
+
* @param exception the class of the exception being handled
|
|
869
|
+
* @param host used to access an array of arguments for
|
|
870
|
+
* the in-flight request
|
|
871
|
+
*/
|
|
872
|
+
catch(exception: T, host: ArgumentsHost): any;
|
|
873
|
+
}
|
|
874
|
+
interface ExceptionFilterMetadata {
|
|
875
|
+
func: ExceptionFilter["catch"];
|
|
876
|
+
exceptionMetatypes: Type[];
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Interface defining the `canActivate()` function that must be implemented
|
|
881
|
+
* by a guard. Return value indicates whether the current request is
|
|
882
|
+
* allowed to proceed. Return can be either synchronous (`boolean`)
|
|
883
|
+
* or asynchronous (`Promise` or `Observable`).
|
|
884
|
+
*
|
|
885
|
+
* @publicApi
|
|
886
|
+
*/
|
|
887
|
+
interface CanActivate {
|
|
888
|
+
/**
|
|
889
|
+
* @param context Current execution context. Provides access to details about
|
|
890
|
+
* the current request pipeline.
|
|
891
|
+
*
|
|
892
|
+
* @returns Value indicating whether the current request is allowed to
|
|
893
|
+
* proceed.
|
|
894
|
+
*/
|
|
895
|
+
canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean>;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Interface providing access to the response stream.
|
|
900
|
+
*
|
|
901
|
+
* @publicApi
|
|
902
|
+
*/
|
|
903
|
+
interface CallHandler<T = any> {
|
|
904
|
+
/**
|
|
905
|
+
* Returns an `Observable` representing the response stream from the route
|
|
906
|
+
* handler.
|
|
907
|
+
*/
|
|
908
|
+
handle(): Observable<T>;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Interface describing implementation of an interceptor.
|
|
912
|
+
*
|
|
913
|
+
* @publicApi
|
|
914
|
+
*/
|
|
915
|
+
interface VenokInterceptor<T = any, R = any> {
|
|
916
|
+
/**
|
|
917
|
+
* Method to implement a custom interceptor.
|
|
918
|
+
*
|
|
919
|
+
* @param context an `ExecutionContext` object providing methods to access the
|
|
920
|
+
* route handler and class about to be invoked.
|
|
921
|
+
* @param next a reference to the `CallHandler`, which provides access to an
|
|
922
|
+
* `Observable` representing the response stream from the route handler.
|
|
923
|
+
*/
|
|
924
|
+
intercept(context: ExecutionContext, next: CallHandler<T>): Observable<R> | Promise<Observable<R>>;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
type Transform<T = any> = (value: T, metadata: ArgumentMetadata) => any;
|
|
928
|
+
/**
|
|
929
|
+
* Interface describing a pipe implementation's `transform()` method metadata argument.
|
|
930
|
+
*
|
|
931
|
+
* @publicApi
|
|
932
|
+
*/
|
|
933
|
+
interface ArgumentMetadata {
|
|
934
|
+
/**
|
|
935
|
+
* Indicates whether custom parameter
|
|
936
|
+
*/
|
|
937
|
+
readonly type: string;
|
|
938
|
+
/**
|
|
939
|
+
* Underlying base type (e.g., `String`) of the parameter, based on the type
|
|
940
|
+
* definition in the route handler.
|
|
941
|
+
*/
|
|
942
|
+
readonly metatype?: Type | undefined;
|
|
943
|
+
/**
|
|
944
|
+
* String passed as an argument to the decorator.
|
|
945
|
+
* Example: `@Body('userId')` would yield `userId`
|
|
946
|
+
*/
|
|
947
|
+
readonly data?: string | undefined;
|
|
948
|
+
/**
|
|
949
|
+
* Current execution context type (string)
|
|
950
|
+
* */
|
|
951
|
+
readonly contextType: string;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Interface describing implementation of a pipe.
|
|
955
|
+
*
|
|
956
|
+
* @publicApi
|
|
957
|
+
*/
|
|
958
|
+
interface PipeTransform<T = any, R = any> {
|
|
959
|
+
/**
|
|
960
|
+
* Method to implement a custom pipe. Called with two parameters
|
|
961
|
+
*
|
|
962
|
+
* @param value argument before it is received by route handler method
|
|
963
|
+
* @param metadata contains metadata about the value
|
|
964
|
+
*/
|
|
965
|
+
transform(value: T, metadata: ArgumentMetadata): R;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
interface BeforeApplicationShutdown {
|
|
969
|
+
beforeApplicationShutdown(signal?: string): any;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Interface defining method called once the application has fully started and
|
|
974
|
+
* is bootstrapped.
|
|
975
|
+
*
|
|
976
|
+
* @publicApi
|
|
977
|
+
*/
|
|
978
|
+
interface OnApplicationBootstrap {
|
|
979
|
+
onApplicationBootstrap(): any;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* Interface defining method to respond to system signals (when application gets
|
|
984
|
+
* shutdown by, e.g., SIGTERM)
|
|
985
|
+
*
|
|
986
|
+
* @publicApi
|
|
987
|
+
*/
|
|
988
|
+
interface OnApplicationShutdown {
|
|
989
|
+
onApplicationShutdown(signal?: string): any;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Interface defining method called just before Venok destroys the host module
|
|
994
|
+
* (`app.close()` method has been evaluated). Use to perform cleanup on
|
|
995
|
+
* resources (e.g., Database connections).
|
|
996
|
+
*
|
|
997
|
+
* @publicApi
|
|
998
|
+
*/
|
|
999
|
+
interface OnModuleDestroy {
|
|
1000
|
+
onModuleDestroy(): any;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* Interface defining method called once the host module has been initialized.
|
|
1005
|
+
*
|
|
1006
|
+
* @publicApi
|
|
1007
|
+
*/
|
|
1008
|
+
interface OnModuleInit {
|
|
1009
|
+
onModuleInit(): any;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* The type of injectable dependency
|
|
1014
|
+
*/
|
|
1015
|
+
type InjectorDependency = InjectionToken;
|
|
1016
|
+
/**
|
|
1017
|
+
* The property-based dependency
|
|
1018
|
+
*/
|
|
1019
|
+
interface PropertyDependency {
|
|
1020
|
+
key: symbol | string;
|
|
1021
|
+
name: InjectorDependency;
|
|
1022
|
+
isOptional?: boolean;
|
|
1023
|
+
instance?: any;
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Context of a dependency which gets injected by
|
|
1027
|
+
* the injector
|
|
1028
|
+
*/
|
|
1029
|
+
interface InjectorDependencyContext {
|
|
1030
|
+
/**
|
|
1031
|
+
* The name of the property key (property-based injection)
|
|
1032
|
+
*/
|
|
1033
|
+
key?: string | symbol;
|
|
1034
|
+
/**
|
|
1035
|
+
* The function itself, the name of the function, or injection token.
|
|
1036
|
+
*/
|
|
1037
|
+
name?: Function | string | symbol;
|
|
1038
|
+
/**
|
|
1039
|
+
* The index of the dependency which gets injected
|
|
1040
|
+
* from the dependencies array
|
|
1041
|
+
*/
|
|
1042
|
+
index?: number;
|
|
1043
|
+
/**
|
|
1044
|
+
* The dependency array which gets injected
|
|
1045
|
+
*/
|
|
1046
|
+
dependencies?: InjectorDependency[];
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
interface HostComponentInfo {
|
|
1050
|
+
/**
|
|
1051
|
+
* Injection token (or class reference)
|
|
1052
|
+
*/
|
|
1053
|
+
token: InjectionToken;
|
|
1054
|
+
/**
|
|
1055
|
+
* Flag that indicates whether DI subtree is durable
|
|
1056
|
+
*/
|
|
1057
|
+
isTreeDurable: boolean;
|
|
1058
|
+
}
|
|
1059
|
+
interface ContextId {
|
|
1060
|
+
readonly id: number;
|
|
1061
|
+
payload?: unknown;
|
|
1062
|
+
getParent?(info: HostComponentInfo): ContextId;
|
|
1063
|
+
}
|
|
1064
|
+
interface InstancePerContext<T> {
|
|
1065
|
+
instance: T | undefined;
|
|
1066
|
+
isResolved?: boolean;
|
|
1067
|
+
isPending?: boolean;
|
|
1068
|
+
donePromise?: Promise<unknown>;
|
|
1069
|
+
isConstructorCalled?: boolean;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
interface LazyModuleLoaderLoadOptions {
|
|
1073
|
+
/**
|
|
1074
|
+
* If `false`, no logs will be generated when loading some module lazily.
|
|
1075
|
+
*/
|
|
1076
|
+
logger?: boolean;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
interface ModuleFactory {
|
|
1080
|
+
type: Type;
|
|
1081
|
+
token: string;
|
|
1082
|
+
dynamicMetadata?: Partial<DynamicModule>;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
interface ModuleRefGetOrResolveOpts {
|
|
1086
|
+
/**
|
|
1087
|
+
* If enabled, lookup will only be performed in the host module.
|
|
1088
|
+
* @default true
|
|
1089
|
+
*/
|
|
1090
|
+
strict?: boolean;
|
|
1091
|
+
/**
|
|
1092
|
+
* If enabled, instead of returning a first instance registered under a given token,
|
|
1093
|
+
* a list of instances will be returned.
|
|
1094
|
+
* @default false
|
|
1095
|
+
*/
|
|
1096
|
+
each?: boolean;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
type CommonEdgeMetadata = {
|
|
1100
|
+
sourceModuleName: string;
|
|
1101
|
+
targetModuleName: string;
|
|
1102
|
+
};
|
|
1103
|
+
type ModuleToModuleEdgeMetadata = {
|
|
1104
|
+
type: "module-to-module";
|
|
1105
|
+
} & CommonEdgeMetadata;
|
|
1106
|
+
type ClassToClassEdgeMetadata = {
|
|
1107
|
+
type: "class-to-class";
|
|
1108
|
+
sourceClassName: string;
|
|
1109
|
+
targetClassName: string;
|
|
1110
|
+
sourceClassToken: InjectionToken;
|
|
1111
|
+
targetClassToken: InjectionToken;
|
|
1112
|
+
injectionType: "constructor" | "property" | "decorator";
|
|
1113
|
+
keyOrIndex?: string | number | symbol;
|
|
1114
|
+
/**
|
|
1115
|
+
* If true, indicates that this edge represents an internal providers connection
|
|
1116
|
+
*/
|
|
1117
|
+
internal?: boolean;
|
|
1118
|
+
} & CommonEdgeMetadata;
|
|
1119
|
+
interface Edge {
|
|
1120
|
+
id: string;
|
|
1121
|
+
source: string;
|
|
1122
|
+
target: string;
|
|
1123
|
+
metadata: ModuleToModuleEdgeMetadata | ClassToClassEdgeMetadata;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
interface EnhancerMetadataCacheEntry {
|
|
1127
|
+
targetNodeId?: string;
|
|
1128
|
+
moduleToken: string;
|
|
1129
|
+
classRef: Type;
|
|
1130
|
+
methodKey: string | undefined;
|
|
1131
|
+
enhancerRef?: unknown;
|
|
1132
|
+
enhancerInstanceWrapper?: InstanceWrapper;
|
|
1133
|
+
subtype: EnhancerSubtype;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
type Entrypoint<T> = {
|
|
1137
|
+
id?: string;
|
|
1138
|
+
type: string;
|
|
1139
|
+
methodName: string;
|
|
1140
|
+
className: string;
|
|
1141
|
+
classNodeId: string;
|
|
1142
|
+
metadata: {
|
|
1143
|
+
key: string;
|
|
1144
|
+
} & T;
|
|
1145
|
+
};
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Enhancers attached through APP_PIPE, APP_GUARD, APP_INTERCEPTOR, and APP_FILTER tokens.
|
|
1149
|
+
*/
|
|
1150
|
+
interface AttachedEnhancerDefinition {
|
|
1151
|
+
nodeId: string;
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Enhancers registered through "app.useGlobalPipes()", "app.useGlobalGuards()", "app.useGlobalInterceptors()", and "app.useGlobalFilters()" methods.
|
|
1155
|
+
*/
|
|
1156
|
+
interface OrphanedEnhancerDefinition {
|
|
1157
|
+
subtype: EnhancerSubtype;
|
|
1158
|
+
ref: unknown;
|
|
1159
|
+
}
|
|
1160
|
+
interface Extras {
|
|
1161
|
+
orphanedEnhancers: Array<OrphanedEnhancerDefinition>;
|
|
1162
|
+
attachedEnhancers: Array<AttachedEnhancerDefinition>;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
type ModuleNode = {
|
|
1166
|
+
metadata: {
|
|
1167
|
+
type: "module";
|
|
1168
|
+
global: boolean;
|
|
1169
|
+
dynamic: boolean;
|
|
1170
|
+
internal: boolean;
|
|
1171
|
+
};
|
|
1172
|
+
};
|
|
1173
|
+
type ClassNode = {
|
|
1174
|
+
parent: string;
|
|
1175
|
+
metadata: {
|
|
1176
|
+
type: "provider" | "controller" | "middleware" | "injectable";
|
|
1177
|
+
subtype?: EnhancerSubtype;
|
|
1178
|
+
sourceModuleName: string;
|
|
1179
|
+
durable: boolean;
|
|
1180
|
+
static: boolean;
|
|
1181
|
+
transient: boolean;
|
|
1182
|
+
exported: boolean;
|
|
1183
|
+
scope: Scope;
|
|
1184
|
+
token: InjectionToken;
|
|
1185
|
+
initTime: number;
|
|
1186
|
+
/**
|
|
1187
|
+
* Enhancers metadata collection
|
|
1188
|
+
*/
|
|
1189
|
+
enhancers?: Array<{
|
|
1190
|
+
id: string;
|
|
1191
|
+
subtype: EnhancerSubtype;
|
|
1192
|
+
} | {
|
|
1193
|
+
name: string;
|
|
1194
|
+
methodKey?: string;
|
|
1195
|
+
subtype: EnhancerSubtype;
|
|
1196
|
+
}>;
|
|
1197
|
+
/**
|
|
1198
|
+
* If true, node is a globally registered enhancer
|
|
1199
|
+
*/
|
|
1200
|
+
global?: boolean;
|
|
1201
|
+
/**
|
|
1202
|
+
* If true, indicates that this node represents an internal provider
|
|
1203
|
+
*/
|
|
1204
|
+
internal?: boolean;
|
|
1205
|
+
};
|
|
1206
|
+
};
|
|
1207
|
+
type Node = {
|
|
1208
|
+
id: string;
|
|
1209
|
+
label: string;
|
|
1210
|
+
} & (ClassNode | ModuleNode);
|
|
1211
|
+
|
|
1212
|
+
interface SerializedGraphMetadata {
|
|
1213
|
+
cause: {
|
|
1214
|
+
type: "unknown-dependencies" | "unknown";
|
|
1215
|
+
context?: InjectorDependencyContext;
|
|
1216
|
+
moduleId?: string;
|
|
1217
|
+
nodeId?: string;
|
|
1218
|
+
error?: any;
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
type SerializedGraphStatus = "partial" | "complete";
|
|
1223
|
+
interface SerializedGraphJson {
|
|
1224
|
+
nodes: Record<string, Node>;
|
|
1225
|
+
edges: Record<string, Edge>;
|
|
1226
|
+
entrypoints: Record<string, Entrypoint<unknown>[]>;
|
|
1227
|
+
extras: Extras;
|
|
1228
|
+
status?: SerializedGraphStatus;
|
|
1229
|
+
metadata?: SerializedGraphMetadata;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
type ModuleDefinition = ForwardReference | Type | DynamicModule | Promise<DynamicModule>;
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Interface defining a Dynamic Module.
|
|
1236
|
+
*
|
|
1237
|
+
* @publicApi
|
|
1238
|
+
*/
|
|
1239
|
+
interface DynamicModule extends ModuleMetadata {
|
|
1240
|
+
/**
|
|
1241
|
+
* A module reference
|
|
1242
|
+
*/
|
|
1243
|
+
module: Type;
|
|
1244
|
+
/**
|
|
1245
|
+
* When "true", makes a module global-scoped.
|
|
1246
|
+
*
|
|
1247
|
+
* Once imported into any module, a global-scoped module will be visible
|
|
1248
|
+
* in all modules. Thereafter, modules that wish to inject a service exported
|
|
1249
|
+
* from a global module do not need to import the provider module.
|
|
1250
|
+
*
|
|
1251
|
+
* @default false
|
|
1252
|
+
*/
|
|
1253
|
+
global?: boolean;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
interface ForwardReference<T = any> {
|
|
1257
|
+
forwardRef: T;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* @publicApi
|
|
1262
|
+
*/
|
|
1263
|
+
type InjectionToken<T = any> = string | symbol | Type<T> | Abstract<T> | Function;
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* @publicApi
|
|
1267
|
+
*/
|
|
1268
|
+
interface IntrospectionResult {
|
|
1269
|
+
/**
|
|
1270
|
+
* Enum defining lifetime of host class or factory.
|
|
1271
|
+
*/
|
|
1272
|
+
scope: Scope;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
interface VenokModule {
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Interface defining the property object that describes the module.
|
|
1280
|
+
*
|
|
1281
|
+
* @publicApi
|
|
1282
|
+
*/
|
|
1283
|
+
interface ModuleMetadata {
|
|
1284
|
+
/**
|
|
1285
|
+
* Optional list of imported modules that export the providers which are
|
|
1286
|
+
* required in this module.
|
|
1287
|
+
*/
|
|
1288
|
+
imports?: Array<Type | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
1289
|
+
/**
|
|
1290
|
+
* Optional list of providers that will be instantiated by the Venok injector
|
|
1291
|
+
* and that may be shared at least across this module.
|
|
1292
|
+
*/
|
|
1293
|
+
providers?: Provider[];
|
|
1294
|
+
/**
|
|
1295
|
+
* Optional list of the subset of providers that are provided by this module
|
|
1296
|
+
* and should be available in other modules which import this module.
|
|
1297
|
+
*/
|
|
1298
|
+
exports?: Array<DynamicModule | Promise<DynamicModule> | string | symbol | Provider | ForwardReference | Abstract<any> | Function>;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* @publicApi
|
|
1303
|
+
*/
|
|
1304
|
+
type OptionalFactoryDependency = {
|
|
1305
|
+
token: InjectionToken;
|
|
1306
|
+
optional: boolean;
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
*
|
|
1311
|
+
* @publicApi
|
|
1312
|
+
*/
|
|
1313
|
+
type Provider<T = any> = Type | ClassProvider<T> | ValueProvider<T> | FactoryProvider<T> | ExistingProvider;
|
|
1314
|
+
/**
|
|
1315
|
+
* Interface defining a *Class* type provider.
|
|
1316
|
+
*
|
|
1317
|
+
* For example:
|
|
1318
|
+
* ```typescript
|
|
1319
|
+
* const configServiceProvider = {
|
|
1320
|
+
* provide: ConfigService,
|
|
1321
|
+
* useClass:
|
|
1322
|
+
* process.env.NODE_ENV === 'development'
|
|
1323
|
+
* ? DevelopmentConfigService
|
|
1324
|
+
* : ProductionConfigService,
|
|
1325
|
+
* };
|
|
1326
|
+
* ```
|
|
1327
|
+
*
|
|
1328
|
+
* @publicApi
|
|
1329
|
+
*/
|
|
1330
|
+
interface ClassProvider<T = any> {
|
|
1331
|
+
/**
|
|
1332
|
+
* Injection token
|
|
1333
|
+
*/
|
|
1334
|
+
provide: InjectionToken;
|
|
1335
|
+
/**
|
|
1336
|
+
* Type (class name) of provider (instance to be injected).
|
|
1337
|
+
*/
|
|
1338
|
+
useClass: Type<T>;
|
|
1339
|
+
/**
|
|
1340
|
+
* Optional enum defining lifetime of the provider that is injected.
|
|
1341
|
+
*/
|
|
1342
|
+
scope?: Scope;
|
|
1343
|
+
/**
|
|
1344
|
+
* This option is only available on factory providers!
|
|
1345
|
+
*
|
|
1346
|
+
*/
|
|
1347
|
+
inject?: never;
|
|
1348
|
+
/**
|
|
1349
|
+
* Flags provider as durable. This flag can be used in combination with custom context id
|
|
1350
|
+
* factory strategy to construct lazy DI subtrees.
|
|
1351
|
+
*
|
|
1352
|
+
* This flag can be used only in conjunction with scope = Scope.REQUEST.
|
|
1353
|
+
*/
|
|
1354
|
+
durable?: boolean;
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Interface defining a *Value* type provider.
|
|
1358
|
+
*
|
|
1359
|
+
* For example:
|
|
1360
|
+
* ```typescript
|
|
1361
|
+
* const connectionProvider = {
|
|
1362
|
+
* provide: 'CONNECTION',
|
|
1363
|
+
* useValue: connection,
|
|
1364
|
+
* };
|
|
1365
|
+
* ```
|
|
1366
|
+
*
|
|
1367
|
+
* @publicApi
|
|
1368
|
+
*/
|
|
1369
|
+
interface ValueProvider<T = any> {
|
|
1370
|
+
/**
|
|
1371
|
+
* Injection token
|
|
1372
|
+
*/
|
|
1373
|
+
provide: InjectionToken;
|
|
1374
|
+
/**
|
|
1375
|
+
* Instance of a provider to be injected.
|
|
1376
|
+
*/
|
|
1377
|
+
useValue: T;
|
|
1378
|
+
/**
|
|
1379
|
+
* This option is only available on factory providers!
|
|
1380
|
+
*
|
|
1381
|
+
*/
|
|
1382
|
+
inject?: never;
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Interface defining a *Factory* type provider.
|
|
1386
|
+
*
|
|
1387
|
+
* For example:
|
|
1388
|
+
* ```typescript
|
|
1389
|
+
* const connectionFactory = {
|
|
1390
|
+
* provide: 'CONNECTION',
|
|
1391
|
+
* useFactory: (optionsProvider: OptionsProvider) => {
|
|
1392
|
+
* const options = optionsProvider.get();
|
|
1393
|
+
* return new DatabaseConnection(options);
|
|
1394
|
+
* },
|
|
1395
|
+
* inject: [OptionsProvider],
|
|
1396
|
+
* };
|
|
1397
|
+
* ```
|
|
1398
|
+
*
|
|
1399
|
+
* @publicApi
|
|
1400
|
+
*/
|
|
1401
|
+
interface FactoryProvider<T = any> {
|
|
1402
|
+
/**
|
|
1403
|
+
* Injection token
|
|
1404
|
+
*/
|
|
1405
|
+
provide: InjectionToken;
|
|
1406
|
+
/**
|
|
1407
|
+
* Factory function that returns an instance of the provider to be injected.
|
|
1408
|
+
*/
|
|
1409
|
+
useFactory: (...args: any[]) => T | Promise<T>;
|
|
1410
|
+
/**
|
|
1411
|
+
* Optional list of providers to be injected into the context of the Factory function.
|
|
1412
|
+
*/
|
|
1413
|
+
inject?: Array<InjectionToken | OptionalFactoryDependency>;
|
|
1414
|
+
/**
|
|
1415
|
+
* Optional enum defining lifetime of the provider that is returned by the Factory function.
|
|
1416
|
+
*/
|
|
1417
|
+
scope?: Scope;
|
|
1418
|
+
/**
|
|
1419
|
+
* Flags provider as durable. This flag can be used in combination with custom context id
|
|
1420
|
+
* factory strategy to construct lazy DI subtrees.
|
|
1421
|
+
*
|
|
1422
|
+
* This flag can be used only in conjunction with scope = Scope.REQUEST.
|
|
1423
|
+
*/
|
|
1424
|
+
durable?: boolean;
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Interface defining an *Existing* (aliased) type provider.
|
|
1428
|
+
*
|
|
1429
|
+
* For example:
|
|
1430
|
+
* ```typescript
|
|
1431
|
+
* const loggerAliasProvider = {
|
|
1432
|
+
* provide: 'AliasedLoggerService',
|
|
1433
|
+
* useExisting: LoggerService
|
|
1434
|
+
* };
|
|
1435
|
+
* ```
|
|
1436
|
+
*
|
|
1437
|
+
* @publicApi
|
|
1438
|
+
*/
|
|
1439
|
+
interface ExistingProvider {
|
|
1440
|
+
/**
|
|
1441
|
+
* Injection token
|
|
1442
|
+
*/
|
|
1443
|
+
provide: InjectionToken;
|
|
1444
|
+
/**
|
|
1445
|
+
* Provider to be aliased by the Injection token.
|
|
1446
|
+
*/
|
|
1447
|
+
useExisting: any;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
/**
|
|
1451
|
+
* @publicApi
|
|
1452
|
+
*/
|
|
1453
|
+
interface ConsoleLoggerOptions {
|
|
1454
|
+
/**
|
|
1455
|
+
* Enabled log levels.
|
|
1456
|
+
*/
|
|
1457
|
+
logLevels?: LogLevel[];
|
|
1458
|
+
/**
|
|
1459
|
+
* If enabled, will print timestamp (time difference) between current and previous log message.
|
|
1460
|
+
* Note: This option is not used when `json` is enabled.
|
|
1461
|
+
*/
|
|
1462
|
+
timestamp?: boolean;
|
|
1463
|
+
/**
|
|
1464
|
+
* A prefix to be used for each log message.
|
|
1465
|
+
* Note: This option is not used when `json` is enabled.
|
|
1466
|
+
*/
|
|
1467
|
+
prefix?: string;
|
|
1468
|
+
/**
|
|
1469
|
+
* If enabled, will print the log message in JSON format.
|
|
1470
|
+
*/
|
|
1471
|
+
json?: boolean;
|
|
1472
|
+
/**
|
|
1473
|
+
* If enabled, will print the log message in color.
|
|
1474
|
+
* Default true if json is disabled, false otherwise
|
|
1475
|
+
*/
|
|
1476
|
+
colors?: boolean;
|
|
1477
|
+
/**
|
|
1478
|
+
* The context of the logger.
|
|
1479
|
+
*/
|
|
1480
|
+
context?: string;
|
|
1481
|
+
/**
|
|
1482
|
+
* If enabled, will force the use of console.log/console.error instead of process.stdout/stderr.write.
|
|
1483
|
+
* This is useful for test environments like Jest that can buffer console calls.
|
|
1484
|
+
* @default false
|
|
1485
|
+
*/
|
|
1486
|
+
forceConsole?: boolean;
|
|
1487
|
+
/**
|
|
1488
|
+
* If enabled, will print the log message in a single line, even if it is an object with multiple properties.
|
|
1489
|
+
* If set to a number, the most n inner elements are united on a single line as long as all properties fit into breakLength. Short array elements are also grouped together.
|
|
1490
|
+
* Default true when `json` is enabled, false otherwise.
|
|
1491
|
+
*/
|
|
1492
|
+
compact?: boolean | number;
|
|
1493
|
+
/**
|
|
1494
|
+
* Specifies the maximum number of Array, TypedArray, Map, Set, WeakMap, and WeakSet elements to include when formatting.
|
|
1495
|
+
* Set to null or Infinity to show all elements. Set to 0 or negative to show no elements.
|
|
1496
|
+
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
|
1497
|
+
* @default 100
|
|
1498
|
+
*/
|
|
1499
|
+
maxArrayLength?: number;
|
|
1500
|
+
/**
|
|
1501
|
+
* Specifies the maximum number of characters to include when formatting.
|
|
1502
|
+
* Set to null or Infinity to show all elements. Set to 0 or negative to show no characters.
|
|
1503
|
+
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
|
1504
|
+
* @default 10000.
|
|
1505
|
+
*/
|
|
1506
|
+
maxStringLength?: number;
|
|
1507
|
+
/**
|
|
1508
|
+
* If enabled, will sort keys while formatting objects.
|
|
1509
|
+
* Can also be a custom sorting function.
|
|
1510
|
+
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
|
1511
|
+
* @default false
|
|
1512
|
+
*/
|
|
1513
|
+
sorted?: boolean | ((a: string, b: string) => number);
|
|
1514
|
+
/**
|
|
1515
|
+
* Specifies the number of times to recurse while formatting object.
|
|
1516
|
+
* This is useful for inspecting large objects. To recurse up to the maximum call stack size pass Infinity or null.
|
|
1517
|
+
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
|
1518
|
+
* @default 5
|
|
1519
|
+
*/
|
|
1520
|
+
depth?: number;
|
|
1521
|
+
/**
|
|
1522
|
+
* If true, object's non-enumerable symbols and properties are included in the formatted result.
|
|
1523
|
+
* WeakMap and WeakSet entries are also included as well as user defined prototype properties
|
|
1524
|
+
* @default false
|
|
1525
|
+
*/
|
|
1526
|
+
showHidden?: boolean;
|
|
1527
|
+
/**
|
|
1528
|
+
* The length at which input values are split across multiple lines. Set to Infinity to format the input as a single line (in combination with "compact" set to true).
|
|
1529
|
+
* Default Infinity when "compact" is true, 80 otherwise.
|
|
1530
|
+
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
|
1531
|
+
*/
|
|
1532
|
+
breakLength?: number;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
declare const LOG_LEVELS: ["verbose", "debug", "log", "warn", "error", "fatal"];
|
|
1536
|
+
interface LogBufferRecord {
|
|
1537
|
+
/**
|
|
1538
|
+
* Method to execute.
|
|
1539
|
+
*/
|
|
1540
|
+
methodRef: Function;
|
|
1541
|
+
/**
|
|
1542
|
+
* Arguments to pass to the method.
|
|
1543
|
+
*/
|
|
1544
|
+
arguments: unknown[];
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* @publicApi
|
|
1548
|
+
*/
|
|
1549
|
+
declare class Logger implements LoggerService {
|
|
1550
|
+
protected context?: string | undefined;
|
|
1551
|
+
protected options: {
|
|
1552
|
+
timestamp?: boolean;
|
|
1553
|
+
};
|
|
1554
|
+
protected static logBuffer: LogBufferRecord[];
|
|
1555
|
+
protected static staticInstanceRef?: LoggerService;
|
|
1556
|
+
protected static logLevels?: LogLevel[];
|
|
1557
|
+
private static isBufferAttached;
|
|
1558
|
+
protected localInstanceRef?: LoggerService;
|
|
1559
|
+
private static WrapBuffer;
|
|
1560
|
+
constructor();
|
|
1561
|
+
constructor(context: string);
|
|
1562
|
+
constructor(context: string, options?: {
|
|
1563
|
+
timestamp?: boolean;
|
|
1564
|
+
});
|
|
1565
|
+
get localInstance(): LoggerService;
|
|
1566
|
+
/**
|
|
1567
|
+
* Write an 'error' level log.
|
|
1568
|
+
*/
|
|
1569
|
+
error(message: any, stack?: string, context?: string): void;
|
|
1570
|
+
error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
|
1571
|
+
/**
|
|
1572
|
+
* Write a 'log' level log.
|
|
1573
|
+
*/
|
|
1574
|
+
log(message: any, context?: string): void;
|
|
1575
|
+
log(message: any, ...optionalParams: [...any, string?]): void;
|
|
1576
|
+
/**
|
|
1577
|
+
* Write a 'warn' level log.
|
|
1578
|
+
*/
|
|
1579
|
+
warn(message: any, context?: string): void;
|
|
1580
|
+
warn(message: any, ...optionalParams: [...any, string?]): void;
|
|
1581
|
+
/**
|
|
1582
|
+
* Write a 'debug' level log.
|
|
1583
|
+
*/
|
|
1584
|
+
debug(message: any, context?: string): void;
|
|
1585
|
+
debug(message: any, ...optionalParams: [...any, string?]): void;
|
|
1586
|
+
/**
|
|
1587
|
+
* Write a 'verbose' level log.
|
|
1588
|
+
*/
|
|
1589
|
+
verbose(message: any, context?: string): void;
|
|
1590
|
+
verbose(message: any, ...optionalParams: [...any, string?]): void;
|
|
1591
|
+
/**
|
|
1592
|
+
* Write a 'fatal' level log.
|
|
1593
|
+
*/
|
|
1594
|
+
fatal(message: any, context?: string): void;
|
|
1595
|
+
fatal(message: any, ...optionalParams: [...any, string?]): void;
|
|
1596
|
+
/**
|
|
1597
|
+
* Write an 'error' level log.
|
|
1598
|
+
*/
|
|
1599
|
+
static error(message: any, stackOrContext?: string): void;
|
|
1600
|
+
static error(message: any, context?: string): void;
|
|
1601
|
+
static error(message: any, stack?: string, context?: string): void;
|
|
1602
|
+
static error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
|
1603
|
+
/**
|
|
1604
|
+
* Write a 'log' level log.
|
|
1605
|
+
*/
|
|
1606
|
+
static log(message: any, context?: string): void;
|
|
1607
|
+
static log(message: any, ...optionalParams: [...any, string?]): void;
|
|
1608
|
+
/**
|
|
1609
|
+
* Write a 'warn' level log.
|
|
1610
|
+
*/
|
|
1611
|
+
static warn(message: any, context?: string): void;
|
|
1612
|
+
static warn(message: any, ...optionalParams: [...any, string?]): void;
|
|
1613
|
+
/**
|
|
1614
|
+
* Write a 'debug' level log, if the configured level allows for it.
|
|
1615
|
+
* Prints to `stdout` with newline.
|
|
1616
|
+
*/
|
|
1617
|
+
static debug(message: any, context?: string): void;
|
|
1618
|
+
static debug(message: any, ...optionalParams: [...any, string?]): void;
|
|
1619
|
+
/**
|
|
1620
|
+
* Write a 'verbose' level log.
|
|
1621
|
+
*/
|
|
1622
|
+
static verbose(message: any, context?: string): void;
|
|
1623
|
+
static verbose(message: any, ...optionalParams: [...any, string?]): void;
|
|
1624
|
+
/**
|
|
1625
|
+
* Write a 'fatal' level log.
|
|
1626
|
+
*/
|
|
1627
|
+
static fatal(message: any, context?: string): void;
|
|
1628
|
+
static fatal(message: any, ...optionalParams: [...any, string?]): void;
|
|
1629
|
+
/**
|
|
1630
|
+
* Print buffered logs and detach buffer.
|
|
1631
|
+
*/
|
|
1632
|
+
static flush(): void;
|
|
1633
|
+
/**
|
|
1634
|
+
* Attach buffer.
|
|
1635
|
+
* Turns on initialization logs buffering.
|
|
1636
|
+
*/
|
|
1637
|
+
static attachBuffer(): void;
|
|
1638
|
+
/**
|
|
1639
|
+
* Detach buffer.
|
|
1640
|
+
* Turns off initialization logs buffering.
|
|
1641
|
+
*/
|
|
1642
|
+
static detachBuffer(): void;
|
|
1643
|
+
static getTimestamp(): string;
|
|
1644
|
+
static overrideLogger(logger: LoggerService | LogLevel[] | boolean): any;
|
|
1645
|
+
static isLevelEnabled(level: LogLevel): boolean;
|
|
1646
|
+
private registerLocalInstanceRef;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* @publicApi
|
|
1651
|
+
*/
|
|
1652
|
+
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
1653
|
+
/**
|
|
1654
|
+
* @publicApi
|
|
1655
|
+
*/
|
|
1656
|
+
interface LoggerService {
|
|
1657
|
+
/**
|
|
1658
|
+
* Write a 'log' level log.
|
|
1659
|
+
*/
|
|
1660
|
+
log(message: any, ...optionalParams: any[]): any;
|
|
1661
|
+
/**
|
|
1662
|
+
* Write an 'error' level log.
|
|
1663
|
+
*/
|
|
1664
|
+
error(message: any, ...optionalParams: any[]): any;
|
|
1665
|
+
/**
|
|
1666
|
+
* Write a 'warn' level log.
|
|
1667
|
+
*/
|
|
1668
|
+
warn(message: any, ...optionalParams: any[]): any;
|
|
1669
|
+
/**
|
|
1670
|
+
* Write a 'debug' level log.
|
|
1671
|
+
*/
|
|
1672
|
+
debug?(message: any, ...optionalParams: any[]): any;
|
|
1673
|
+
/**
|
|
1674
|
+
* Write a 'verbose' level log.
|
|
1675
|
+
*/
|
|
1676
|
+
verbose?(message: any, ...optionalParams: any[]): any;
|
|
1677
|
+
/**
|
|
1678
|
+
* Write a 'fatal' level log.
|
|
1679
|
+
*/
|
|
1680
|
+
fatal?(message: any, ...optionalParams: any[]): any;
|
|
1681
|
+
/**
|
|
1682
|
+
* Set log levels.
|
|
1683
|
+
* @param levels log levels
|
|
1684
|
+
*/
|
|
1685
|
+
setLogLevels?(levels: LogLevel[]): any;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
interface DecoratorOptions<Options = any, Transformed = Options> {
|
|
1689
|
+
/**
|
|
1690
|
+
* The key for the metadata.
|
|
1691
|
+
* @default uid(21)
|
|
1692
|
+
*/
|
|
1693
|
+
key?: string;
|
|
1694
|
+
/**
|
|
1695
|
+
* The transform function to apply to the metadata value.
|
|
1696
|
+
* @default value => value
|
|
1697
|
+
*/
|
|
1698
|
+
transform?: (value: Options) => Transformed;
|
|
1699
|
+
}
|
|
1700
|
+
interface ClassDecoratorOptions<Options = any, Transformed = Options> extends DecoratorOptions<Options, Transformed> {
|
|
1701
|
+
type: "class";
|
|
1702
|
+
}
|
|
1703
|
+
interface MethodDecoratorOptions<Options = any, Transformed = Options> extends DecoratorOptions<Options, Transformed> {
|
|
1704
|
+
type: "method";
|
|
1705
|
+
}
|
|
1706
|
+
interface CreateDecoratorOptions<Options = any, Transformed = Options> extends DecoratorOptions<Options, Transformed> {
|
|
1707
|
+
/**
|
|
1708
|
+
* The decorator type (class or method)
|
|
1709
|
+
* @default class & method
|
|
1710
|
+
*/
|
|
1711
|
+
type?: DecoratorsType;
|
|
1712
|
+
}
|
|
1713
|
+
type WithRequired$1<T, K extends keyof T> = T & {
|
|
1714
|
+
[P in K]-?: T[P];
|
|
1715
|
+
};
|
|
1716
|
+
type WithTransform<T extends DecoratorOptions> = WithRequired$1<T, "transform">;
|
|
1717
|
+
type ReflectableDecorator<Options, Transformed = Options> = ((opts?: Options) => ClassDecorator & MethodDecorator) & {
|
|
1718
|
+
KEY: string;
|
|
1719
|
+
};
|
|
1720
|
+
type ReflectableClassDecorator<Options, Transformed = Options> = ((opts?: Options) => ClassDecorator) & {
|
|
1721
|
+
KEY: string;
|
|
1722
|
+
};
|
|
1723
|
+
type ReflectableMethodDecorator<Options, Transformed = Options> = ((opts?: Options) => MethodDecorator) & {
|
|
1724
|
+
KEY: string;
|
|
1725
|
+
};
|
|
1726
|
+
type ReflectableDecorators<Options, Transformed = any> = ReflectableDecorator<Options, Transformed> | ReflectableClassDecorator<Options, Transformed> | ReflectableMethodDecorator<Options, Transformed>;
|
|
1727
|
+
|
|
1728
|
+
interface Abstract<T> extends Function {
|
|
1729
|
+
prototype: T;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
type WithRequired<T, K extends keyof T> = T & {
|
|
1733
|
+
[P in K]-?: T[P];
|
|
1734
|
+
};
|
|
1735
|
+
|
|
1736
|
+
type ParamDecoratorEnhancer = ParameterDecorator;
|
|
1737
|
+
/**
|
|
1738
|
+
* @publicApi
|
|
1739
|
+
*/
|
|
1740
|
+
type CustomParamFactory<TData = any, TContext = any, TOutput = any> = (data: TData, context: TContext) => TOutput;
|
|
1741
|
+
|
|
1742
|
+
/**
|
|
1743
|
+
* @publicApi
|
|
1744
|
+
*/
|
|
1745
|
+
interface ScopeOptions {
|
|
1746
|
+
/**
|
|
1747
|
+
* Specifies the lifetime of an injected Provider or Controller.
|
|
1748
|
+
*/
|
|
1749
|
+
scope?: Scope;
|
|
1750
|
+
/**
|
|
1751
|
+
* Flags provider as durable. This flag can be used in combination with custom context id
|
|
1752
|
+
* factory strategy to construct lazy DI subtrees.
|
|
1753
|
+
*
|
|
1754
|
+
* This flag can be used only in conjunction with scope = Scope.REQUEST.
|
|
1755
|
+
*/
|
|
1756
|
+
durable?: boolean;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
type CustomClassDecorator = <TFunction extends Object | Function>(target: TFunction, ...args: any) => TFunction | void;
|
|
1760
|
+
type CustomDecorator<TKey = string> = MethodDecorator & CustomClassDecorator & {
|
|
1761
|
+
KEY: TKey;
|
|
1762
|
+
};
|
|
1763
|
+
type DecoratorsType = "class" | "method";
|
|
1764
|
+
type SetMetadataType = {
|
|
1765
|
+
/**
|
|
1766
|
+
* Decorator that assigns metadata to the class using the specified `key`.
|
|
1767
|
+
*
|
|
1768
|
+
* Requires three parameters:
|
|
1769
|
+
* - `key` - a value defining the key under which the metadata is stored
|
|
1770
|
+
* - `value` - metadata to be associated with `key`
|
|
1771
|
+
* - `type` - decorator type (class)
|
|
1772
|
+
*
|
|
1773
|
+
* This metadata can be reflected using the `Reflector` class.
|
|
1774
|
+
*
|
|
1775
|
+
* Example: `@SetMetadata('roles', ['admin'], "class")`
|
|
1776
|
+
*
|
|
1777
|
+
* @publicApi
|
|
1778
|
+
*/
|
|
1779
|
+
<K = string, V = any>(metadataKey: K, metadataValue: V, type: "class"): CustomClassDecorator & {
|
|
1780
|
+
KEY: K;
|
|
1781
|
+
};
|
|
1782
|
+
/**
|
|
1783
|
+
* Decorator that assigns metadata to the method using the specified `key`.
|
|
1784
|
+
*
|
|
1785
|
+
* Requires three parameters:
|
|
1786
|
+
* - `key` - a value defining the key under which the metadata is stored
|
|
1787
|
+
* - `value` - metadata to be associated with `key`
|
|
1788
|
+
* - `type` - decorator type (method)
|
|
1789
|
+
*
|
|
1790
|
+
* This metadata can be reflected using the `Reflector` class.
|
|
1791
|
+
*
|
|
1792
|
+
* Example: `@SetMetadata('roles', ['admin'], "method")`
|
|
1793
|
+
*
|
|
1794
|
+
* @publicApi
|
|
1795
|
+
*/
|
|
1796
|
+
<K = string, V = any>(metadataKey: K, metadataValue: V, type: "method"): MethodDecorator & {
|
|
1797
|
+
KEY: K;
|
|
1798
|
+
};
|
|
1799
|
+
/**
|
|
1800
|
+
* Decorator that assigns metadata to the class/method using the specified `key`.
|
|
1801
|
+
*
|
|
1802
|
+
* Requires two parameters:
|
|
1803
|
+
* - `key` - a value defining the key under which the metadata is stored
|
|
1804
|
+
* - `value` - metadata to be associated with `key`
|
|
1805
|
+
*
|
|
1806
|
+
* This metadata can be reflected using the `Reflector` class.
|
|
1807
|
+
*
|
|
1808
|
+
* Example: `@SetMetadata('roles', ['admin'])`
|
|
1809
|
+
*
|
|
1810
|
+
* @publicApi
|
|
1811
|
+
*/
|
|
1812
|
+
<K = string, V = any>(metadataKey: K, metadataValue: V, type?: DecoratorsType): CustomDecorator<K>;
|
|
1813
|
+
};
|
|
1814
|
+
|
|
1815
|
+
interface Type<T = any> extends Function {
|
|
1816
|
+
new (...args: any[]): T;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
declare class ApplicationConfig {
|
|
1820
|
+
private globalPipes;
|
|
1821
|
+
private globalFilters;
|
|
1822
|
+
private globalInterceptors;
|
|
1823
|
+
private globalGuards;
|
|
1824
|
+
private readonly globalRequestPipes;
|
|
1825
|
+
private readonly globalRequestFilters;
|
|
1826
|
+
private readonly globalRequestInterceptors;
|
|
1827
|
+
private readonly globalRequestGuards;
|
|
1828
|
+
addGlobalPipe(pipe: PipeTransform<any>): void;
|
|
1829
|
+
useGlobalPipes(...pipes: PipeTransform<any>[]): void;
|
|
1830
|
+
getGlobalFilters(): ExceptionFilter[];
|
|
1831
|
+
addGlobalFilter(filter: ExceptionFilter): void;
|
|
1832
|
+
useGlobalFilters(...filters: ExceptionFilter[]): void;
|
|
1833
|
+
getGlobalPipes(): PipeTransform<any>[];
|
|
1834
|
+
getGlobalInterceptors(): VenokInterceptor[];
|
|
1835
|
+
addGlobalInterceptor(interceptor: VenokInterceptor): void;
|
|
1836
|
+
useGlobalInterceptors(...interceptors: VenokInterceptor[]): void;
|
|
1837
|
+
getGlobalGuards(): CanActivate[];
|
|
1838
|
+
addGlobalGuard(guard: CanActivate): void;
|
|
1839
|
+
useGlobalGuards(...guards: CanActivate[]): void;
|
|
1840
|
+
addGlobalRequestInterceptor(wrapper: InstanceWrapper<VenokInterceptor>): void;
|
|
1841
|
+
getGlobalRequestInterceptors(): InstanceWrapper<VenokInterceptor>[];
|
|
1842
|
+
addGlobalRequestPipe(wrapper: InstanceWrapper<PipeTransform>): void;
|
|
1843
|
+
getGlobalRequestPipes(): InstanceWrapper<PipeTransform>[];
|
|
1844
|
+
addGlobalRequestFilter(wrapper: InstanceWrapper<ExceptionFilter>): void;
|
|
1845
|
+
getGlobalRequestFilters(): InstanceWrapper<ExceptionFilter>[];
|
|
1846
|
+
addGlobalRequestGuard(wrapper: InstanceWrapper<CanActivate>): void;
|
|
1847
|
+
getGlobalRequestGuards(): InstanceWrapper<CanActivate>[];
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
/**
|
|
1851
|
+
* @publicApi
|
|
1852
|
+
*/
|
|
1853
|
+
declare class ApplicationContext<TOptions extends ApplicationContextOptions = ApplicationContextOptions> extends AbstractInstanceResolver implements VenokApplicationContext {
|
|
1854
|
+
readonly container: VenokContainer;
|
|
1855
|
+
protected readonly config: ApplicationConfig;
|
|
1856
|
+
protected readonly appOptions: TOptions;
|
|
1857
|
+
private contextModule;
|
|
1858
|
+
private readonly scope;
|
|
1859
|
+
protected isInitialized: boolean;
|
|
1860
|
+
protected injector: Injector;
|
|
1861
|
+
protected readonly logger: Logger;
|
|
1862
|
+
private shouldFlushLogsOnOverride;
|
|
1863
|
+
private readonly activeShutdownSignals;
|
|
1864
|
+
private readonly moduleCompiler;
|
|
1865
|
+
private shutdownCleanupRef?;
|
|
1866
|
+
private _instanceLinksHost;
|
|
1867
|
+
private _moduleRefsForHooksByDistance?;
|
|
1868
|
+
private initializationPromise?;
|
|
1869
|
+
protected get instanceLinksHost(): InstanceLinksHost;
|
|
1870
|
+
constructor(container: VenokContainer, config: ApplicationConfig, appOptions?: TOptions, contextModule?: Module$1, scope?: Type<any>[]);
|
|
1871
|
+
selectContextModule(): void;
|
|
1872
|
+
/**
|
|
1873
|
+
* Allows navigating through the modules tree, for example, to pull out a specific instance from the selected module.
|
|
1874
|
+
* @returns {VenokApplicationContext}
|
|
1875
|
+
*/
|
|
1876
|
+
select<T>(moduleType: Type<T> | DynamicModule, selectOptions?: SelectOptions): VenokApplicationContext;
|
|
1877
|
+
/**
|
|
1878
|
+
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
1879
|
+
* @returns {TResult}
|
|
1880
|
+
*/
|
|
1881
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): TResult;
|
|
1882
|
+
/**
|
|
1883
|
+
* Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
|
1884
|
+
* @returns {TResult}
|
|
1885
|
+
*/
|
|
1886
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
1887
|
+
strict?: boolean;
|
|
1888
|
+
each?: undefined | false;
|
|
1889
|
+
}): TResult;
|
|
1890
|
+
/**
|
|
1891
|
+
* Retrieves a list of instances of either injectables or controllers, otherwise, throws exception.
|
|
1892
|
+
* @returns {Array<TResult>}
|
|
1893
|
+
*/
|
|
1894
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
|
1895
|
+
strict?: boolean;
|
|
1896
|
+
each: true;
|
|
1897
|
+
}): Array<TResult>;
|
|
1898
|
+
/**
|
|
1899
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
1900
|
+
* @returns {Array<TResult>}
|
|
1901
|
+
*/
|
|
1902
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): Promise<TResult>;
|
|
1903
|
+
/**
|
|
1904
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
1905
|
+
* @returns {Array<TResult>}
|
|
1906
|
+
*/
|
|
1907
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
1908
|
+
id: number;
|
|
1909
|
+
}): Promise<TResult>;
|
|
1910
|
+
/**
|
|
1911
|
+
* Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
|
1912
|
+
* @returns {Array<TResult>}
|
|
1913
|
+
*/
|
|
1914
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
1915
|
+
id: number;
|
|
1916
|
+
}, options?: {
|
|
1917
|
+
strict?: boolean;
|
|
1918
|
+
each?: undefined | false;
|
|
1919
|
+
}): Promise<TResult>;
|
|
1920
|
+
/**
|
|
1921
|
+
* Resolves transient or request-scoped instances of either injectables or controllers, otherwise, throws exception.
|
|
1922
|
+
* @returns {Array<TResult>}
|
|
1923
|
+
*/
|
|
1924
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
|
1925
|
+
id: number;
|
|
1926
|
+
}, options?: {
|
|
1927
|
+
strict?: boolean;
|
|
1928
|
+
each: true;
|
|
1929
|
+
}): Promise<Array<TResult>>;
|
|
1930
|
+
/**
|
|
1931
|
+
* Registers the request/context object for a given context ID (DI container sub-tree).
|
|
1932
|
+
* @returns {void}
|
|
1933
|
+
*/
|
|
1934
|
+
registerRequestByContextId<T = any>(request: T, contextId: ContextId): void;
|
|
1935
|
+
/**
|
|
1936
|
+
* Initializes the Venok application.
|
|
1937
|
+
* Calls the Venok lifecycle events.
|
|
1938
|
+
*
|
|
1939
|
+
* @returns {Promise<this>} The ApplicationContext instance as Promise
|
|
1940
|
+
*/
|
|
1941
|
+
init(): Promise<this>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Terminates the application
|
|
1944
|
+
* @returns {Promise<void>}
|
|
1945
|
+
*/
|
|
1946
|
+
close(signal?: string): Promise<void>;
|
|
1947
|
+
/**
|
|
1948
|
+
* Sets custom logger service.
|
|
1949
|
+
* Flushes buffered logs if auto flush is on.
|
|
1950
|
+
* @returns {void}
|
|
1951
|
+
*/
|
|
1952
|
+
useLogger(logger: LoggerService | LogLevel[] | false): void;
|
|
1953
|
+
useGlobalFilters(...filters: ExceptionFilter[]): this;
|
|
1954
|
+
useGlobalPipes(...pipes: PipeTransform<any>[]): this;
|
|
1955
|
+
useGlobalInterceptors(...interceptors: VenokInterceptor[]): this;
|
|
1956
|
+
useGlobalGuards(...guards: CanActivate[]): this;
|
|
1957
|
+
/**
|
|
1958
|
+
* Prints buffered logs and detaches buffer.
|
|
1959
|
+
* @returns {void}
|
|
1960
|
+
*/
|
|
1961
|
+
flushLogs(): void;
|
|
1962
|
+
/**
|
|
1963
|
+
* Define that it must flush logs right after defining a custom logger.
|
|
1964
|
+
*/
|
|
1965
|
+
flushLogsOnOverride(): void;
|
|
1966
|
+
/**
|
|
1967
|
+
* Enables the usage of shutdown hooks. Will call the
|
|
1968
|
+
* `onApplicationShutdown` function of a provider if the
|
|
1969
|
+
* process receives a shutdown signal.
|
|
1970
|
+
*
|
|
1971
|
+
* @param {ShutdownSignal[]} [signals=[]] The system signals it should listen to
|
|
1972
|
+
*
|
|
1973
|
+
* @returns {this} The Venok application context instance
|
|
1974
|
+
*/
|
|
1975
|
+
enableShutdownHooks(signals?: (ShutdownSignal | string)[]): this;
|
|
1976
|
+
protected dispose(): Promise<void>;
|
|
1977
|
+
/**
|
|
1978
|
+
* Listens to shutdown signals by listening to
|
|
1979
|
+
* process events
|
|
1980
|
+
*
|
|
1981
|
+
* @param {string[]} signals The system signals it should listen to
|
|
1982
|
+
*/
|
|
1983
|
+
protected listenToShutdownSignals(signals: string[]): void;
|
|
1984
|
+
/**
|
|
1985
|
+
* Unsubscribes from shutdown signals (process events)
|
|
1986
|
+
*/
|
|
1987
|
+
protected unsubscribeFromProcessSignals(): void;
|
|
1988
|
+
/**
|
|
1989
|
+
* Calls the `onModuleInit` function on the registered
|
|
1990
|
+
* modules and its children.
|
|
1991
|
+
*/
|
|
1992
|
+
protected callInitHook(): Promise<void>;
|
|
1993
|
+
/**
|
|
1994
|
+
* Calls the `onModuleDestroy` function on the registered
|
|
1995
|
+
* modules and its children.
|
|
1996
|
+
*/
|
|
1997
|
+
protected callDestroyHook(): Promise<void>;
|
|
1998
|
+
/**
|
|
1999
|
+
* Calls the `onApplicationBootstrap` function on the registered
|
|
2000
|
+
* modules and its children.
|
|
2001
|
+
*/
|
|
2002
|
+
protected callBootstrapHook(): Promise<void>;
|
|
2003
|
+
/**
|
|
2004
|
+
* Calls the `onApplicationShutdown` function on the registered
|
|
2005
|
+
* modules and children.
|
|
2006
|
+
*/
|
|
2007
|
+
protected callShutdownHook(signal?: string): Promise<void>;
|
|
2008
|
+
/**
|
|
2009
|
+
* Calls the `beforeApplicationShutdown` function on the registered
|
|
2010
|
+
* modules and children.
|
|
2011
|
+
*/
|
|
2012
|
+
protected callBeforeShutdownHook(signal?: string): Promise<void>;
|
|
2013
|
+
protected assertNotInPreviewMode(methodName: string): void;
|
|
2014
|
+
private getModulesToTriggerHooksOn;
|
|
2015
|
+
private printInPreviewModeWarning;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
/**
|
|
2019
|
+
* A valid Venok entry (or 'root') module reference.
|
|
2020
|
+
*/
|
|
2021
|
+
type IEntryVenokModule = Type<any> | DynamicModule | ForwardReference | Promise<IEntryVenokModule>;
|
|
2022
|
+
/**
|
|
2023
|
+
* @publicApi
|
|
2024
|
+
*/
|
|
2025
|
+
declare class VenokFactoryStatic {
|
|
2026
|
+
private readonly logger;
|
|
2027
|
+
private abortOnError;
|
|
2028
|
+
private autoFlushLogs;
|
|
2029
|
+
/**
|
|
2030
|
+
* Creates an instance of VenokApplicationContext.
|
|
2031
|
+
*
|
|
2032
|
+
* @param moduleCls Entry (root) application module class
|
|
2033
|
+
* @param options Optional Venok application configuration
|
|
2034
|
+
*
|
|
2035
|
+
* @returns A promise that, when resolved,
|
|
2036
|
+
* contains a reference to the VenokApplicationContext instance.
|
|
2037
|
+
*/
|
|
2038
|
+
createApplicationContext(moduleCls: IEntryVenokModule, options?: ApplicationContextOptions): Promise<VenokApplicationContext>;
|
|
2039
|
+
private createVenokInstance;
|
|
2040
|
+
private setAbortOnError;
|
|
2041
|
+
private initialize;
|
|
2042
|
+
private handleInitializationError;
|
|
2043
|
+
private createProxy;
|
|
2044
|
+
private createExceptionProxy;
|
|
2045
|
+
private createExceptionZone;
|
|
2046
|
+
private registerLoggerConfiguration;
|
|
2047
|
+
private createGraphInspector;
|
|
2048
|
+
}
|
|
2049
|
+
/**
|
|
2050
|
+
* Use VenokFactory to create an application instance.
|
|
2051
|
+
*
|
|
2052
|
+
* ### Specifying an entry module
|
|
2053
|
+
*
|
|
2054
|
+
* Pass the required *root module* for the application via the module parameter.
|
|
2055
|
+
* By convention, it is usually called `ApplicationModule`. Starting with this
|
|
2056
|
+
* module, Venok assembles the dependency graph and begins the process of
|
|
2057
|
+
* Dependency Injection and instantiates the classes needed to launch your
|
|
2058
|
+
* application.
|
|
2059
|
+
*
|
|
2060
|
+
* @publicApi
|
|
2061
|
+
*/
|
|
2062
|
+
declare const VenokFactory: VenokFactoryStatic;
|
|
2063
|
+
|
|
2064
|
+
declare class ExecutionContextHost implements ExecutionContext {
|
|
2065
|
+
private readonly args;
|
|
2066
|
+
private readonly constructorRef;
|
|
2067
|
+
private readonly handler;
|
|
2068
|
+
private contextType;
|
|
2069
|
+
constructor(args: any[], constructorRef?: Type, handler?: Function);
|
|
2070
|
+
setType<TContext extends string = ContextType>(type: TContext): void;
|
|
2071
|
+
getType<TContext extends string = ContextType>(): TContext;
|
|
2072
|
+
getClass<T = any>(): Type<T>;
|
|
2073
|
+
getHandler(): Function;
|
|
2074
|
+
getArgs<T extends Array<any> = any[]>(): T;
|
|
2075
|
+
getArgByIndex<T = any>(index: number): T;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
declare class ContextUtils {
|
|
2079
|
+
mapParamType(key: string): string;
|
|
2080
|
+
reflectCallbackParamtypes(instance: object, methodName: string): any[];
|
|
2081
|
+
reflectCallbackMetadata<T = any>(instance: object, methodName: string, metadataKey: string): T;
|
|
2082
|
+
getArgumentsLength<T extends {
|
|
2083
|
+
[key: string]: {
|
|
2084
|
+
index: number;
|
|
2085
|
+
};
|
|
2086
|
+
}>(keys: string[], metadata: T): number;
|
|
2087
|
+
createNullArray(length: number): any[];
|
|
2088
|
+
mergeParamsMetatypes(paramsProperties: ParamProperties[], paramtypes: any[]): (ParamProperties & {
|
|
2089
|
+
metatype?: any;
|
|
2090
|
+
})[];
|
|
2091
|
+
getCustomFactory(factory: (...args: unknown[]) => void, data: unknown, contextFactory: (args: unknown[]) => ExecutionContextHost): (...args: unknown[]) => unknown;
|
|
2092
|
+
getContextFactory<TContext extends string = ContextType>(contextType: TContext, instance?: object, callback?: Function): (args: unknown[]) => ExecutionContextHost;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
declare class InterceptorsConsumer {
|
|
2096
|
+
intercept<TContext extends string = ContextType>(interceptors: VenokInterceptor[], args: unknown[], instance: object, callback: (...args: unknown[]) => unknown, next: () => Promise<unknown>, type?: TContext): Promise<unknown>;
|
|
2097
|
+
createContext(args: unknown[], instance: object, callback: (...args: unknown[]) => unknown): ExecutionContextHost;
|
|
2098
|
+
transformDeferred(next: () => Promise<any>): Observable<any>;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
declare abstract class ContextCreator {
|
|
2102
|
+
abstract createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: ContextId, inquirerId?: string): R;
|
|
2103
|
+
getGlobalMetadata?<T extends any[]>(contextId?: ContextId, inquirerId?: string): T;
|
|
2104
|
+
createContext<T extends unknown[] = any, R extends unknown[] = any>(instance: object, callback: (...args: any[]) => void, metadataKey: string, contextId?: ContextId, inquirerId?: string): R;
|
|
2105
|
+
reflectClassMetadata<T>(instance: object, metadataKey: string): T;
|
|
2106
|
+
reflectMethodMetadata<T>(callback: (...args: unknown[]) => unknown, metadataKey: string): T;
|
|
2107
|
+
protected getContextId(contextId: ContextId, instanceWrapper: InstanceWrapper): ContextId;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
declare class InterceptorsContextCreator extends ContextCreator {
|
|
2111
|
+
private readonly container;
|
|
2112
|
+
private readonly config?;
|
|
2113
|
+
private moduleContext;
|
|
2114
|
+
constructor(container: VenokContainer, config?: ApplicationConfig | undefined);
|
|
2115
|
+
create(instance: object, callback: (...args: unknown[]) => unknown, module: string, contextId?: ContextId, inquirerId?: string): VenokInterceptor[];
|
|
2116
|
+
createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: ContextId, inquirerId?: string): R;
|
|
2117
|
+
getInterceptorInstance(metatype: Function | VenokInterceptor, contextId?: ContextId, inquirerId?: string): VenokInterceptor | null;
|
|
2118
|
+
getInstanceByMetatype(metatype: Type): InstanceWrapper | undefined;
|
|
2119
|
+
getGlobalMetadata<T extends unknown[]>(contextId?: ContextId, inquirerId?: string): T;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
declare class GuardsConsumer {
|
|
2123
|
+
tryActivate<TContext extends string = ContextType>(guards: CanActivate[], args: unknown[], instance: object, callback: (...args: unknown[]) => unknown, type?: TContext): Promise<boolean>;
|
|
2124
|
+
createContext(args: unknown[], instance: object, callback: (...args: unknown[]) => unknown): ExecutionContextHost;
|
|
2125
|
+
pickResult(result: boolean | Promise<boolean> | Observable<boolean>): Promise<boolean>;
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
declare class GuardsContextCreator extends ContextCreator {
|
|
2129
|
+
private readonly container;
|
|
2130
|
+
private readonly config?;
|
|
2131
|
+
private moduleContext;
|
|
2132
|
+
constructor(container: VenokContainer, config?: ApplicationConfig | undefined);
|
|
2133
|
+
create(instance: object, callback: (...args: unknown[]) => unknown, module: string, contextId?: ContextId, inquirerId?: string): CanActivate[];
|
|
2134
|
+
createConcreteContext<T extends unknown[], R extends unknown[]>(metadata: T, contextId?: ContextId, inquirerId?: string): R;
|
|
2135
|
+
getGuardInstance(metatype: Function | CanActivate, contextId?: ContextId, inquirerId?: string): CanActivate | null;
|
|
2136
|
+
getInstanceByMetatype(metatype: Type): InstanceWrapper | undefined;
|
|
2137
|
+
getGlobalMetadata<T extends unknown[]>(contextId?: ContextId, inquirerId?: string): T;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
declare class PipesConsumer {
|
|
2141
|
+
apply<TInput = unknown>(value: TInput, metadata: ArgumentMetadata, pipes: PipeTransform[]): Promise<any>;
|
|
2142
|
+
applyPipes<TInput = unknown>(value: TInput, metadata: ArgumentMetadata, transforms: PipeTransform[]): Promise<any>;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
declare class PipesContextCreator extends ContextCreator {
|
|
2146
|
+
private readonly container;
|
|
2147
|
+
private readonly config?;
|
|
2148
|
+
private moduleContext;
|
|
2149
|
+
constructor(container: VenokContainer, config?: ApplicationConfig | undefined);
|
|
2150
|
+
create(instance: object, callback: (...args: unknown[]) => unknown, moduleKey: string, contextId?: ContextId, inquirerId?: string): PipeTransform[];
|
|
2151
|
+
createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: ContextId, inquirerId?: string): R;
|
|
2152
|
+
getPipeInstance(pipe: Function | PipeTransform, contextId?: ContextId, inquirerId?: string): PipeTransform | null;
|
|
2153
|
+
getInstanceByMetatype(metatype: Type): InstanceWrapper | undefined;
|
|
2154
|
+
getGlobalMetadata<T extends unknown[]>(contextId?: ContextId, inquirerId?: string): T;
|
|
2155
|
+
setModuleContext(context: string): void;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
declare class ExceptionFilterContextCreator extends ContextCreator {
|
|
2159
|
+
protected readonly container: VenokContainer;
|
|
2160
|
+
protected moduleContext: string;
|
|
2161
|
+
constructor(container: VenokContainer);
|
|
2162
|
+
createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: ContextId, inquirerId?: string): R;
|
|
2163
|
+
getFilterInstance(filter: Function | ExceptionFilter, contextId?: ContextId, inquirerId?: string): ExceptionFilter | null;
|
|
2164
|
+
getInstanceByMetatype(metatype: Type): InstanceWrapper | undefined;
|
|
2165
|
+
reflectCatchExceptions(instance: ExceptionFilter): Type[];
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
declare class VenokExceptionsHandler {
|
|
2169
|
+
private readonly exceptionsFilter;
|
|
2170
|
+
private filters;
|
|
2171
|
+
constructor(exceptionsFilter: ExceptionFilter);
|
|
2172
|
+
next(exception: Error | any, host: ArgumentsHost): any;
|
|
2173
|
+
setCustomFilters(filters: ExceptionFilterMetadata[]): void;
|
|
2174
|
+
invokeCustomFilters<T = any>(exception: T, host: ArgumentsHost): boolean;
|
|
2175
|
+
protected selectExceptionFilterMetadata<T = any>(filters: ExceptionFilterMetadata[], exception: T): ExceptionFilterMetadata | undefined;
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
declare class VenokExceptionFilterContext extends ExceptionFilterContextCreator {
|
|
2179
|
+
private readonly config?;
|
|
2180
|
+
constructor(container: VenokContainer, config?: ApplicationConfig | undefined);
|
|
2181
|
+
create(instance: object, callback: (...args: any) => void, module: string, contextId?: ContextId, inquirerId?: string): VenokExceptionsHandler;
|
|
2182
|
+
getExceptionFilter(): ExceptionFilter;
|
|
2183
|
+
getGlobalMetadata<T extends any[]>(contextId?: ContextId, inquirerId?: string): T;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
declare class VenokProxy {
|
|
2187
|
+
createProxy<TContext extends string = ContextType>(targetCallback: (...args: any[]) => any, exceptionsHandler: VenokExceptionsHandler, type?: ContextType): (...args: any[]) => Promise<any>;
|
|
2188
|
+
private handleError;
|
|
2189
|
+
createExceptionLayerProxy<TContext extends string = ContextType>(targetCallback: <TError>(err: TError, ...args: any[]) => void | Promise<void>, exceptionsHandler: VenokExceptionsHandler, type?: TContext): <TError>(err: TError, req: any, res: any, next: any) => Promise<any>;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Helper class providing Venok reflection capabilities.
|
|
2194
|
+
*
|
|
2195
|
+
* @publicApi
|
|
2196
|
+
*/
|
|
2197
|
+
declare class Reflector {
|
|
2198
|
+
static reflector: Reflector;
|
|
2199
|
+
/**
|
|
2200
|
+
* Creates a decorator that can be used to decorate classes and methods with metadata.
|
|
2201
|
+
* Can be used as a strongly-typed alternative to `@SetMetadata`.
|
|
2202
|
+
* @param options Decorator options.
|
|
2203
|
+
* @returns A decorator function.
|
|
2204
|
+
*/
|
|
2205
|
+
static createDecorator<Options>(options?: DecoratorOptions<Options>): ReflectableDecorator<Options>;
|
|
2206
|
+
static createDecorator<Options>(options?: ClassDecoratorOptions<Options>): ReflectableClassDecorator<Options>;
|
|
2207
|
+
static createDecorator<Options>(options?: MethodDecoratorOptions<Options>): ReflectableMethodDecorator<Options>;
|
|
2208
|
+
static createDecorator<Options, Transformed = Options>(options: WithTransform<DecoratorOptions<Options, Transformed>>): ReflectableDecorator<Options, Transformed>;
|
|
2209
|
+
static createDecorator<Options, Transformed = Options>(options: WithTransform<ClassDecoratorOptions<Options, Transformed>>): ReflectableClassDecorator<Options, Transformed>;
|
|
2210
|
+
static createDecorator<Options, Transformed = Options>(options: WithTransform<MethodDecoratorOptions<Options, Transformed>>): ReflectableMethodDecorator<Options, Transformed>;
|
|
2211
|
+
/**
|
|
2212
|
+
* Creates a decorator with additional metadata that can be
|
|
2213
|
+
* used `(for internal use, like @Sse in Http etc.)`
|
|
2214
|
+
* to decorate classes and methods with metadata.
|
|
2215
|
+
* @param options Decorator options.
|
|
2216
|
+
* @returns A decorator function.
|
|
2217
|
+
*/
|
|
2218
|
+
static createMetadataDecorator<Options, Transformed extends Record<any, any>>(options: WithTransform<DecoratorOptions<Options, Transformed>>): ReflectableDecorator<Options, Transformed>;
|
|
2219
|
+
static createMetadataDecorator<Options, Transformed extends Record<any, any>>(options: WithTransform<ClassDecoratorOptions<Options, Transformed>>): ReflectableClassDecorator<Options, Transformed>;
|
|
2220
|
+
static createMetadataDecorator<Options, Transformed extends Record<any, any>>(options: WithTransform<MethodDecoratorOptions<Options, Transformed>>): ReflectableMethodDecorator<Options, Transformed>;
|
|
2221
|
+
constructor();
|
|
2222
|
+
/**
|
|
2223
|
+
* Check if metadata exist for a metadata decorator for a specified target.
|
|
2224
|
+
*
|
|
2225
|
+
* @example
|
|
2226
|
+
* `const roles = this.reflector.has(Roles, context.getHandler());`
|
|
2227
|
+
*
|
|
2228
|
+
* @param decorator reflectable decorator created through `Reflector.createDecorator`
|
|
2229
|
+
* @param target context (decorated object) to check metadata from
|
|
2230
|
+
*
|
|
2231
|
+
*/
|
|
2232
|
+
has<T extends ReflectableDecorators<any>>(decorator: T, target: Type | Function): boolean;
|
|
2233
|
+
/**
|
|
2234
|
+
* Check if metadata exist for a specified key for a specified target.
|
|
2235
|
+
*
|
|
2236
|
+
* @example
|
|
2237
|
+
* `const roles = this.reflector.has('roles', context.getHandler());`
|
|
2238
|
+
*
|
|
2239
|
+
* @param metadataKey lookup key for metadata to check
|
|
2240
|
+
* @param target context (decorated object) to check metadata from
|
|
2241
|
+
*
|
|
2242
|
+
*/
|
|
2243
|
+
has<TKey = any>(metadataKey: TKey, target: Type | Function): boolean;
|
|
2244
|
+
/**
|
|
2245
|
+
* Retrieve metadata for a reflectable decorator for a specified target.
|
|
2246
|
+
*
|
|
2247
|
+
* @example
|
|
2248
|
+
* `const roles = this.reflector.get(Roles, context.getHandler());`
|
|
2249
|
+
*
|
|
2250
|
+
* @param decorator reflectable decorator created through `Reflector.createDecorator`
|
|
2251
|
+
* @param target context (decorated object) to retrieve metadata from
|
|
2252
|
+
*
|
|
2253
|
+
*/
|
|
2254
|
+
get<T extends ReflectableDecorators<any>>(decorator: T, target: Type | Function): T extends ReflectableDecorators<any, infer R> ? R : unknown;
|
|
2255
|
+
/**
|
|
2256
|
+
* Retrieve metadata for a specified key for a specified target.
|
|
2257
|
+
*
|
|
2258
|
+
* @example
|
|
2259
|
+
* `const roles = this.reflector.get<string[]>('roles', context.getHandler());`
|
|
2260
|
+
*
|
|
2261
|
+
* @param metadataKey lookup key for metadata to retrieve
|
|
2262
|
+
* @param target context (decorated object) to retrieve metadata from
|
|
2263
|
+
*
|
|
2264
|
+
*/
|
|
2265
|
+
get<TResult = any, TKey = any>(metadataKey: TKey, target: Type | Function): TResult;
|
|
2266
|
+
/**
|
|
2267
|
+
* Retrieve metadata for a specified decorator for a specified set of targets.
|
|
2268
|
+
*
|
|
2269
|
+
* @param decorator lookup decorator for metadata to retrieve
|
|
2270
|
+
* @param targets context (decorated objects) to retrieve metadata from
|
|
2271
|
+
*
|
|
2272
|
+
*/
|
|
2273
|
+
getAll<T extends ReflectableDecorators<any>>(decorator: T, targets: (Type | Function)[]): T extends ReflectableDecorators<infer R> ? (R extends Array<any> ? R : R[]) : unknown;
|
|
2274
|
+
/**
|
|
2275
|
+
* Retrieve metadata for a specified key for a specified set of targets.
|
|
2276
|
+
*
|
|
2277
|
+
* @param metadataKey lookup key for metadata to retrieve
|
|
2278
|
+
* @param targets context (decorated objects) to retrieve metadata from
|
|
2279
|
+
*
|
|
2280
|
+
*/
|
|
2281
|
+
getAll<TResult extends any[] = any[], TKey = any>(metadataKey: TKey, targets: (Type | Function)[]): TResult;
|
|
2282
|
+
/**
|
|
2283
|
+
* Retrieve metadata for a specified decorator for a specified set of targets and merge results.
|
|
2284
|
+
*
|
|
2285
|
+
* @param decorator lookup decorator for metadata to retrieve
|
|
2286
|
+
* @param targets context (decorated objects) to retrieve metadata from
|
|
2287
|
+
*
|
|
2288
|
+
*/
|
|
2289
|
+
getAllAndMerge<T extends ReflectableDecorators<any>>(decorator: T, targets: (Type | Function)[]): T extends ReflectableDecorators<infer R> ? R : unknown;
|
|
2290
|
+
/**
|
|
2291
|
+
* Retrieve metadata for a specified key for a specified set of targets and merge results.
|
|
2292
|
+
*
|
|
2293
|
+
* @param metadataKey lookup key for metadata to retrieve
|
|
2294
|
+
* @param targets context (decorated objects) to retrieve metadata from
|
|
2295
|
+
*
|
|
2296
|
+
*/
|
|
2297
|
+
getAllAndMerge<TResult extends any[] | object = any[], TKey = any>(metadataKey: TKey, targets: (Type | Function)[]): TResult;
|
|
2298
|
+
/**
|
|
2299
|
+
* Retrieve metadata for a specified decorator for a specified set of targets and return a first not undefined value.
|
|
2300
|
+
*
|
|
2301
|
+
* @param decorator lookup decorator for metadata to retrieve
|
|
2302
|
+
* @param targets context (decorated objects) to retrieve metadata from
|
|
2303
|
+
*
|
|
2304
|
+
*/
|
|
2305
|
+
getAllAndOverride<T extends ReflectableDecorators<any>>(decorator: T, targets: (Type | Function)[]): T extends ReflectableDecorators<infer R> ? R : unknown;
|
|
2306
|
+
/**
|
|
2307
|
+
* Retrieve metadata for a specified key for a specified set of targets and return a first not undefined value.
|
|
2308
|
+
*
|
|
2309
|
+
* @param metadataKey lookup key for metadata to retrieve
|
|
2310
|
+
* @param targets context (decorated objects) to retrieve metadata from
|
|
2311
|
+
*
|
|
2312
|
+
*/
|
|
2313
|
+
getAllAndOverride<TResult = any, TKey = any>(metadataKey: TKey, targets: (Type | Function)[]): TResult;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
declare class VenokContextCreator implements VenokContextCreatorInterface {
|
|
2317
|
+
private readonly guardsContextCreator;
|
|
2318
|
+
private readonly guardsConsumer;
|
|
2319
|
+
private readonly interceptorsContextCreator;
|
|
2320
|
+
private readonly interceptorsConsumer;
|
|
2321
|
+
private readonly modulesContainer;
|
|
2322
|
+
private readonly pipesContextCreator;
|
|
2323
|
+
private readonly pipesConsumer;
|
|
2324
|
+
protected readonly filtersContextCreator: VenokExceptionFilterContext;
|
|
2325
|
+
readonly contextUtils: ContextUtils;
|
|
2326
|
+
readonly venokProxy: VenokProxy;
|
|
2327
|
+
readonly reflector: Reflector;
|
|
2328
|
+
private readonly handlerMetadataStorage;
|
|
2329
|
+
container: VenokContainer;
|
|
2330
|
+
constructor(guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, modulesContainer: ModulesContainer, pipesContextCreator: PipesContextCreator, pipesConsumer: PipesConsumer, filtersContextCreator: VenokExceptionFilterContext);
|
|
2331
|
+
static fromContainer(container: VenokContainer, contextClass?: typeof VenokContextCreator, filtersContextClass?: typeof VenokExceptionFilterContext): VenokContextCreator;
|
|
2332
|
+
create<TParamsMetadata extends ParamsMetadata = ParamsMetadata, TContext extends string = ContextType>(instance: object, callback: (...args: unknown[]) => unknown, methodName: string, metadataKey?: string, paramsFactory?: VenokParamsFactoryInterface, contextId?: ContextId, inquirerId?: string, options?: ExternalContextOptions, contextType?: TContext): (...args: any[]) => Promise<any>;
|
|
2333
|
+
getMetadata<TMetadata, TContext extends string = ContextType>(instance: object, methodName: string, metadataKey?: string, paramsFactory?: VenokParamsFactoryInterface, contextType?: TContext): ExternalHandlerMetadata;
|
|
2334
|
+
getContextModuleKey(moduleCtor: Function | undefined): string;
|
|
2335
|
+
exchangeKeysForValues<TMetadata extends Record<string | symbol, any>>(keys: string[], metadata: TMetadata, moduleContext: string, paramsFactory: VenokParamsFactoryInterface, contextId?: ContextId, inquirerId?: string, contextFactory?: (args: unknown[]) => ExecutionContextHost): ParamProperties[];
|
|
2336
|
+
createPipesFn(pipes: PipeTransform[], paramsOptions: (ParamProperties & {
|
|
2337
|
+
metatype?: unknown;
|
|
2338
|
+
})[], contextType: string): ((args: unknown[], ...params: unknown[]) => Promise<void>) | null;
|
|
2339
|
+
getParamValue<T>(value: T, metadata: ArgumentMetadata, pipes: PipeTransform[]): Promise<any>;
|
|
2340
|
+
transformToResult(resultOrDeferred: Observable<any> | any): Promise<any>;
|
|
2341
|
+
createGuardsFn<TContext extends string = ContextType>(guards: any[], instance: object, callback: (...args: any[]) => any, contextType?: TContext): Function | null;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
declare class ContextIdFactory {
|
|
2345
|
+
private static strategy?;
|
|
2346
|
+
/**
|
|
2347
|
+
* Generates a context identifier based on the request object.
|
|
2348
|
+
*/
|
|
2349
|
+
static create(): ContextId;
|
|
2350
|
+
/**
|
|
2351
|
+
* Generates a random identifier to track asynchronous execution context.
|
|
2352
|
+
* @param request request object
|
|
2353
|
+
* @param propsToInspect
|
|
2354
|
+
*/
|
|
2355
|
+
static getByRequest<T extends Record<any, any> = any>(request: T, propsToInspect?: string[]): ContextId;
|
|
2356
|
+
/**
|
|
2357
|
+
* Registers a custom context id strategy that lets you attach
|
|
2358
|
+
* a parent context id to the existing context id object.
|
|
2359
|
+
* @param strategy strategy instance
|
|
2360
|
+
*/
|
|
2361
|
+
static apply(strategy: ContextIdStrategy): void;
|
|
2362
|
+
private static isContextIdResolverWithPayload;
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
/**
|
|
2366
|
+
* Function that returns a new decorator that applies all decorators provided by param
|
|
2367
|
+
*
|
|
2368
|
+
* Useful to build new decorators (or a decorator factory) encapsulating multiple decorators related with the same feature
|
|
2369
|
+
*
|
|
2370
|
+
* @param decorators one or more decorators (e.g., `ApplyGuard(...)`)
|
|
2371
|
+
*
|
|
2372
|
+
* @publicApi
|
|
2373
|
+
*/
|
|
2374
|
+
declare function applyDecorators(...decorators: Array<ClassDecorator | MethodDecorator | PropertyDecorator>): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
2375
|
+
|
|
2376
|
+
/**
|
|
2377
|
+
* Decorator that binds *parameter decorators* to the method that follows.
|
|
2378
|
+
*
|
|
2379
|
+
* Useful when the language doesn't provide a 'Parameter Decorator' feature
|
|
2380
|
+
* (i.e., vanilla JavaScript).
|
|
2381
|
+
*
|
|
2382
|
+
* @param decorators one or more parameter decorators (e.g., `Req()`)
|
|
2383
|
+
*
|
|
2384
|
+
* @publicApi
|
|
2385
|
+
*/
|
|
2386
|
+
declare function Bind(...decorators: any[]): MethodDecorator;
|
|
2387
|
+
|
|
2388
|
+
/**
|
|
2389
|
+
* Decorator that marks a class as a Venok exception filter. An exception filter
|
|
2390
|
+
* handles exceptions thrown by or not handled by your application code.
|
|
2391
|
+
*
|
|
2392
|
+
* The decorated class must implement the `ExceptionFilter` interface.
|
|
2393
|
+
*
|
|
2394
|
+
* @param exceptions one or more exception *types* specifying
|
|
2395
|
+
* the exceptions to be caught and handled by this filter.
|
|
2396
|
+
*
|
|
2397
|
+
* @usageNotes
|
|
2398
|
+
* Exception filters are applied using the `@UseFilters()` decorator, or (globally)
|
|
2399
|
+
* with `app.useGlobalFilters()`.
|
|
2400
|
+
*
|
|
2401
|
+
* @publicApi
|
|
2402
|
+
*/
|
|
2403
|
+
declare function Catch(...exceptions: Array<Type | Abstract<any>>): ClassDecorator;
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* Decorator that sets required dependencies (required with a vanilla JavaScript objects)
|
|
2407
|
+
*
|
|
2408
|
+
* @publicApi
|
|
2409
|
+
*/
|
|
2410
|
+
declare const Dependencies: (...dependencies: Array<unknown>) => ClassDecorator;
|
|
2411
|
+
|
|
2412
|
+
/**
|
|
2413
|
+
* Decorator that binds exception filters to the scope of the controller or
|
|
2414
|
+
* method, depending on its context.
|
|
2415
|
+
*
|
|
2416
|
+
* When `@UseFilters` is used at the provider level, the filter will be
|
|
2417
|
+
* applied to every handler (method) in the provider.
|
|
2418
|
+
*
|
|
2419
|
+
* When `@UseFilters` is used at the individual handler level, the filter
|
|
2420
|
+
* will apply only to that specific method.
|
|
2421
|
+
*
|
|
2422
|
+
* @param filters exception filter instance or class, or a list of exception
|
|
2423
|
+
* filter instances or classes.
|
|
2424
|
+
*
|
|
2425
|
+
* @usageNotes
|
|
2426
|
+
* Exception filters can also be set up globally for all controllers and routes
|
|
2427
|
+
* using `app.useGlobalFilters()`.
|
|
2428
|
+
*
|
|
2429
|
+
* @publicApi
|
|
2430
|
+
*/
|
|
2431
|
+
declare const UseFilters: (...filters: (ExceptionFilter | Function)[]) => MethodDecorator & ClassDecorator;
|
|
2432
|
+
|
|
2433
|
+
/**
|
|
2434
|
+
* Decorator that makes a module global-scoped.
|
|
2435
|
+
*
|
|
2436
|
+
* Once imported into any module, a global-scoped module will be visible
|
|
2437
|
+
* in all modules. Thereafter, modules that wish to inject a service exported
|
|
2438
|
+
* from a global module do not need to import the provider module.
|
|
2439
|
+
*
|
|
2440
|
+
* @publicApi
|
|
2441
|
+
*/
|
|
2442
|
+
declare function Global(): ClassDecorator;
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* Decorator that marks a constructor parameter as a target for
|
|
2446
|
+
* Dependency Injection (DI).
|
|
2447
|
+
*
|
|
2448
|
+
* Any injected provider must be visible within the module scope (loosely
|
|
2449
|
+
* speaking, the containing module) of the class it is being injected into. This
|
|
2450
|
+
* can be done by:
|
|
2451
|
+
*
|
|
2452
|
+
* - defining the provider in the same module scope
|
|
2453
|
+
* - exporting the provider from one module scope and importing that module into the
|
|
2454
|
+
* module scope of the class being injected into
|
|
2455
|
+
* - exporting the provider from a module that is marked as global using the
|
|
2456
|
+
* `@Global()` decorator
|
|
2457
|
+
*
|
|
2458
|
+
* #### Injection tokens
|
|
2459
|
+
* Can be *types* (class names), *strings* or *symbols*. This depends on how the
|
|
2460
|
+
* provider with which it is associated was defined. Providers defined with the
|
|
2461
|
+
* `@Injectable()` decorator use the class name. Custom Providers may use strings
|
|
2462
|
+
* or symbols as the injection token.
|
|
2463
|
+
*
|
|
2464
|
+
* @param token lookup key for the provider to be injected (assigned to the constructor
|
|
2465
|
+
* parameter).
|
|
2466
|
+
*
|
|
2467
|
+
* @publicApi
|
|
2468
|
+
*/
|
|
2469
|
+
declare function Inject(token?: InjectionToken | ForwardReference): PropertyDecorator & ParameterDecorator;
|
|
2470
|
+
|
|
2471
|
+
/**
|
|
2472
|
+
* Defines the injection scope.
|
|
2473
|
+
*
|
|
2474
|
+
* @publicApi
|
|
2475
|
+
*/
|
|
2476
|
+
type InjectableOptions = ScopeOptions;
|
|
2477
|
+
/**
|
|
2478
|
+
* Decorator that marks a class as a provider(https://venok.com/providers).
|
|
2479
|
+
* Providers can be injected into other classes via constructor parameter injection
|
|
2480
|
+
* using Venok built-in [Dependency Injection (DI)](https://venok.com/providers#dependency-injection)
|
|
2481
|
+
* system.
|
|
2482
|
+
*
|
|
2483
|
+
* When injecting a provider, it must be visible within the module scope (loosely
|
|
2484
|
+
* speaking, the containing module) of the class it is being injected into. This
|
|
2485
|
+
* can be done by:
|
|
2486
|
+
*
|
|
2487
|
+
* - defining the provider in the same module scope
|
|
2488
|
+
* - exporting the provider from one module scope and importing that module into the
|
|
2489
|
+
* module scope of the class being injected into
|
|
2490
|
+
* - exporting the provider from a module that is marked as global using the
|
|
2491
|
+
* `@Global()` decorator
|
|
2492
|
+
*
|
|
2493
|
+
* Providers can also be defined in a more explicit and imperative form using
|
|
2494
|
+
* various [custom provider](https://venok.com/fundamentals/custom-providers) techniques that expose
|
|
2495
|
+
* more capabilities of the DI system.
|
|
2496
|
+
*
|
|
2497
|
+
* @param options options specifying scope of injectable
|
|
2498
|
+
*
|
|
2499
|
+
* @see [Providers](https://venok.com/providers)
|
|
2500
|
+
* @see [Custom Providers](https://venok.com/fundamentals/custom-providers)
|
|
2501
|
+
* @see [Injection Scopes](https://venok.com/fundamentals/injection-scopes)
|
|
2502
|
+
*
|
|
2503
|
+
* @publicApi
|
|
2504
|
+
*/
|
|
2505
|
+
declare function Injectable(options?: InjectableOptions): ClassDecorator;
|
|
2506
|
+
/**
|
|
2507
|
+
* @publicApi
|
|
2508
|
+
*/
|
|
2509
|
+
declare function mixin<T>(mixinClass: Type<T>): Type<T>;
|
|
2510
|
+
|
|
2511
|
+
/**
|
|
2512
|
+
* Extended interface for Module decorator that allows custom keys
|
|
2513
|
+
*/
|
|
2514
|
+
interface ExtendedModuleMetadata {
|
|
2515
|
+
/**
|
|
2516
|
+
* Allows any additional keys (controllers, queues, processors, etc.)
|
|
2517
|
+
* that will be automatically added to the providers array.
|
|
2518
|
+
*/
|
|
2519
|
+
[key: string]: Provider[];
|
|
2520
|
+
}
|
|
2521
|
+
/**
|
|
2522
|
+
* Decorator that marks a class as a module.
|
|
2523
|
+
*
|
|
2524
|
+
* Modules are used by Venok to organize the application structure into scopes.
|
|
2525
|
+
* Providers are scoped by the module they are declared in. Modules and their
|
|
2526
|
+
* classes (Providers) form a graph that determines how Venok
|
|
2527
|
+
*
|
|
2528
|
+
* @param metadata module configuration metadata
|
|
2529
|
+
*
|
|
2530
|
+
* @publicApi
|
|
2531
|
+
*/
|
|
2532
|
+
declare function Module(metadata: ModuleMetadata & ExtendedModuleMetadata): ClassDecorator;
|
|
2533
|
+
|
|
2534
|
+
/**
|
|
2535
|
+
* Parameter decorator for an injected dependency marking the
|
|
2536
|
+
* dependency as optional.
|
|
2537
|
+
*
|
|
2538
|
+
* For example:
|
|
2539
|
+
* ```typescript
|
|
2540
|
+
* constructor(@Optional() @Inject('HTTP_OPTIONS')private readonly httpClient: T) {}
|
|
2541
|
+
* ```
|
|
2542
|
+
*
|
|
2543
|
+
* @see [Optional providers](https://venok.com/providers#optional-providers)
|
|
2544
|
+
*
|
|
2545
|
+
* @publicApi
|
|
2546
|
+
*/
|
|
2547
|
+
declare function Optional(): PropertyDecorator & ParameterDecorator;
|
|
2548
|
+
|
|
2549
|
+
declare const SetMetadata: SetMetadataType;
|
|
2550
|
+
|
|
2551
|
+
/**
|
|
2552
|
+
* Decorator that binds guards to the scope of the provider or method,
|
|
2553
|
+
* depending on its context.
|
|
2554
|
+
*
|
|
2555
|
+
* When `@UseGuards` is used at the controller level, the guard will be
|
|
2556
|
+
* applied to every handler (method) in the provider.
|
|
2557
|
+
*
|
|
2558
|
+
* When `@UseGuards` is used at the individual handler level, the guard
|
|
2559
|
+
* will apply only to that specific method.
|
|
2560
|
+
*
|
|
2561
|
+
* @param guards a single guard instance or class, or a list of guard instances
|
|
2562
|
+
* or classes.
|
|
2563
|
+
*
|
|
2564
|
+
* @usageNotes
|
|
2565
|
+
* Guards can also be set up globally for all controllers and routes
|
|
2566
|
+
* using `app.useGlobalGuards()`.
|
|
2567
|
+
*
|
|
2568
|
+
* @publicApi
|
|
2569
|
+
*/
|
|
2570
|
+
declare function UseGuards(...guards: (CanActivate | Function)[]): MethodDecorator & ClassDecorator;
|
|
2571
|
+
|
|
2572
|
+
/**
|
|
2573
|
+
* Decorator that binds pipes to the scope of the provider or method,
|
|
2574
|
+
* depending on its context.
|
|
2575
|
+
*
|
|
2576
|
+
* When `@UsePipes` is used at the controller level, the pipe will be
|
|
2577
|
+
* applied to every handler (method) in the provider.
|
|
2578
|
+
*
|
|
2579
|
+
* When `@UsePipes` is used at the individual handler level, the pipe
|
|
2580
|
+
* will apply only to that specific method.
|
|
2581
|
+
*
|
|
2582
|
+
* @param pipes a single pipe instance or class, or a list of pipe instances or
|
|
2583
|
+
* classes.
|
|
2584
|
+
*
|
|
2585
|
+
* @usageNotes
|
|
2586
|
+
* Pipes can also be set up globally for all controllers and routes
|
|
2587
|
+
* using `app.useGlobalPipes()`.
|
|
2588
|
+
*
|
|
2589
|
+
* @publicApi
|
|
2590
|
+
*/
|
|
2591
|
+
declare function UsePipes(...pipes: (PipeTransform | Function)[]): ClassDecorator & MethodDecorator;
|
|
2592
|
+
|
|
2593
|
+
/**
|
|
2594
|
+
* Decorator that binds interceptors to the scope of the provider or method,
|
|
2595
|
+
* depending on its context.
|
|
2596
|
+
*
|
|
2597
|
+
* When `@UseInterceptors` is used at the controller level, the interceptor will
|
|
2598
|
+
* be applied to every handler (method) in the provider.
|
|
2599
|
+
*
|
|
2600
|
+
* When `@UseInterceptors` is used at the individual handler level, the interceptor
|
|
2601
|
+
* will apply only to that specific method.
|
|
2602
|
+
*
|
|
2603
|
+
* @param interceptors a single interceptor instance or class, or a list of
|
|
2604
|
+
* interceptor instances or classes.
|
|
2605
|
+
*
|
|
2606
|
+
* @usageNotes
|
|
2607
|
+
* Interceptors can also be set up globally for all controllers and routes
|
|
2608
|
+
* using `app.useGlobalInterceptors()`.
|
|
2609
|
+
*
|
|
2610
|
+
* @publicApi
|
|
2611
|
+
*/
|
|
2612
|
+
declare function UseInterceptors(...interceptors: (VenokInterceptor | Function)[]): MethodDecorator & ClassDecorator;
|
|
2613
|
+
|
|
2614
|
+
declare class RuntimeException extends Error {
|
|
2615
|
+
constructor(message?: string);
|
|
2616
|
+
what(): string;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
declare class CircularDependencyException extends RuntimeException {
|
|
2620
|
+
constructor(context?: string);
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
declare class InvalidClassException extends RuntimeException {
|
|
2624
|
+
constructor(value: any);
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
declare class InvalidClassModuleException extends RuntimeException {
|
|
2628
|
+
constructor(metatypeUsedAsAModule: any, scope: any[]);
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
declare class InvalidClassScopeException extends RuntimeException {
|
|
2632
|
+
constructor(metatypeOrToken: Type | Abstract<any> | string | symbol);
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
declare class InvalidExceptionFilterException extends RuntimeException {
|
|
2636
|
+
constructor();
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
declare class InvalidModuleException extends RuntimeException {
|
|
2640
|
+
constructor(parentModule: any, index: number, scope: any[]);
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
declare class UndefinedDependencyException extends RuntimeException {
|
|
2644
|
+
constructor(type: string, undefinedDependencyContext: InjectorDependencyContext, module: Module$1);
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
declare class UndefinedForwardRefException extends RuntimeException {
|
|
2648
|
+
constructor(scope: Type[]);
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
declare class UndefinedModuleException extends RuntimeException {
|
|
2652
|
+
constructor(parentModule: any, index: number, scope: any[]);
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
declare class UnknownDependenciesException extends RuntimeException {
|
|
2656
|
+
readonly type: string | symbol;
|
|
2657
|
+
readonly context: InjectorDependencyContext;
|
|
2658
|
+
readonly metadata?: {
|
|
2659
|
+
id: string;
|
|
2660
|
+
} | undefined;
|
|
2661
|
+
readonly moduleRef: {
|
|
2662
|
+
id: string;
|
|
2663
|
+
} | undefined;
|
|
2664
|
+
constructor(type: string | symbol, context: InjectorDependencyContext, moduleRef: Module$1, metadata?: {
|
|
2665
|
+
id: string;
|
|
2666
|
+
} | undefined);
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
declare class UnknownElementException extends RuntimeException {
|
|
2670
|
+
constructor(name?: string | symbol);
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
declare class UnknownExportException extends RuntimeException {
|
|
2674
|
+
constructor(token: string | symbol, moduleName: string);
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
declare class UnknownModuleException extends RuntimeException {
|
|
2678
|
+
constructor(moduleName?: string);
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
declare const UNKNOWN_DEPENDENCIES_MESSAGE: (type: string | symbol, unknownDependencyContext: InjectorDependencyContext, module: Module$1) => string;
|
|
2682
|
+
declare const UNDEFINED_FORWARDREF_MESSAGE: (scope: Type[]) => string;
|
|
2683
|
+
declare const INVALID_MODULE_MESSAGE: (parentModule: any, index: number, scope: any[]) => string;
|
|
2684
|
+
declare const USING_INVALID_CLASS_AS_A_MODULE_MESSAGE: (metatypeUsedAsAModule: Type | ForwardReference, scope: any[]) => string;
|
|
2685
|
+
declare const UNDEFINED_MODULE_MESSAGE: (parentModule: any, index: number, scope: any[]) => string;
|
|
2686
|
+
declare const UNKNOWN_EXPORT_MESSAGE: (token: string | symbol | undefined, module: string) => string;
|
|
2687
|
+
declare const INVALID_CLASS_MESSAGE: (text: TemplateStringsArray, value: any) => string;
|
|
2688
|
+
declare const INVALID_CLASS_SCOPE_MESSAGE: (text: TemplateStringsArray, name: string | undefined) => string;
|
|
2689
|
+
declare const UNHANDLED_RUNTIME_EXCEPTION = "Unhandled Runtime Exception.";
|
|
2690
|
+
declare const INVALID_EXCEPTION_FILTER = "Invalid exception filters (@UseFilters()).";
|
|
2691
|
+
declare const MICROSERVICES_PACKAGE_NOT_FOUND_EXCEPTION = "Unable to load @Venok/microservices package. (Please make sure that it's already installed.)";
|
|
2692
|
+
|
|
2693
|
+
declare const isColorAllowed: () => boolean;
|
|
2694
|
+
declare const colors: {
|
|
2695
|
+
bold: (text: string) => string;
|
|
2696
|
+
green: (text: string) => string;
|
|
2697
|
+
yellow: (text: string) => string;
|
|
2698
|
+
red: (text: string) => string;
|
|
2699
|
+
magentaBright: (text: string) => string;
|
|
2700
|
+
cyanBright: (text: string) => string;
|
|
2701
|
+
};
|
|
2702
|
+
declare const yellow: (text: string) => string;
|
|
2703
|
+
|
|
2704
|
+
declare function createContextId(): ContextId;
|
|
2705
|
+
|
|
2706
|
+
type DefaultParamTypes = {
|
|
2707
|
+
[key: string]: string | number;
|
|
2708
|
+
};
|
|
2709
|
+
declare const createParamDecoratorWithoutPipes: <FactoryData = any, FactoryContext = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryContext, FactoryOutput>) => (data?: ParamData) => ParameterDecorator;
|
|
2710
|
+
/**
|
|
2711
|
+
* Defines custom param decorator
|
|
2712
|
+
*
|
|
2713
|
+
* @param factory
|
|
2714
|
+
* @param enhancers
|
|
2715
|
+
*
|
|
2716
|
+
* @publicApi
|
|
2717
|
+
*/
|
|
2718
|
+
declare const createParamDecorator: <FactoryData = any, FactoryContext = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryContext, FactoryOutput>, enhancers?: ParamDecoratorEnhancer[]) => (...dataOrPipes: (Type<PipeTransform> | PipeTransform | FactoryData)[]) => ParameterDecorator;
|
|
2719
|
+
declare const createNativeParamDecoratorWithoutPipes: <Paramtypes extends DefaultParamTypes>(paramtype: Paramtypes[string]) => (data?: ParamData) => ParameterDecorator;
|
|
2720
|
+
declare const createNativeParamDecorator: <Paramtypes extends DefaultParamTypes>(paramtype: Paramtypes[string]) => (data?: any, ...pipes: (Type<PipeTransform> | PipeTransform)[]) => ParameterDecorator;
|
|
2721
|
+
|
|
2722
|
+
/**
|
|
2723
|
+
* @publicApi
|
|
2724
|
+
*/
|
|
2725
|
+
declare function filterLogLevels(parseableString?: string): LogLevel[];
|
|
2726
|
+
|
|
2727
|
+
declare function flatten<T extends Array<unknown> = any>(arr: T): T extends Array<infer R> ? R : never;
|
|
2728
|
+
|
|
2729
|
+
/**
|
|
2730
|
+
* @publicApi
|
|
2731
|
+
*/
|
|
2732
|
+
declare function isLogLevel(maybeLogLevel: any): maybeLogLevel is LogLevel;
|
|
2733
|
+
|
|
2734
|
+
/**
|
|
2735
|
+
* Checks if target level is enabled.
|
|
2736
|
+
* @param targetLevel target level
|
|
2737
|
+
* @param logLevels array of enabled log levels
|
|
2738
|
+
*/
|
|
2739
|
+
declare function isLogLevelEnabled(targetLevel: LogLevel, logLevels: LogLevel[] | undefined): boolean;
|
|
2740
|
+
|
|
2741
|
+
declare const MODULE_INIT_MESSAGE: (text: TemplateStringsArray, module: string) => string;
|
|
2742
|
+
|
|
2743
|
+
declare function extendArrayMetadata<T extends Array<unknown>>(key: string, metadata: T, target: Function): void;
|
|
2744
|
+
declare function assignMetadata<TParamtype extends string | number = string>(args: Record<string, ParamMetadata>, paramtype: TParamtype, index: number, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): {
|
|
2745
|
+
[x: string]: ParamMetadata | {
|
|
2746
|
+
index: number;
|
|
2747
|
+
data: ParamData | undefined;
|
|
2748
|
+
pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[];
|
|
2749
|
+
};
|
|
2750
|
+
};
|
|
2751
|
+
declare function assignCustomParameterMetadata(args: Record<string, ParamMetadata>, paramtype: number | string, index: number, factory: CustomParamFactory, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): {
|
|
2752
|
+
[x: string]: ParamMetadata | {
|
|
2753
|
+
index: number;
|
|
2754
|
+
factory: CustomParamFactory;
|
|
2755
|
+
data: ParamData | undefined;
|
|
2756
|
+
pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[];
|
|
2757
|
+
};
|
|
2758
|
+
};
|
|
2759
|
+
|
|
2760
|
+
declare const noop: () => void;
|
|
2761
|
+
|
|
2762
|
+
declare const randomStringGenerator: () => string;
|
|
2763
|
+
|
|
2764
|
+
declare const rethrow: (err: unknown) => never;
|
|
2765
|
+
|
|
2766
|
+
declare const isUndefined: (obj: any) => obj is undefined;
|
|
2767
|
+
declare const isNull: (val: any) => val is null | undefined;
|
|
2768
|
+
declare const isObject: (fn: any) => fn is object;
|
|
2769
|
+
declare const isFunction: (val: any) => val is Function;
|
|
2770
|
+
declare const isString: (val: any) => val is string;
|
|
2771
|
+
declare const isNumber: (val: any) => val is number;
|
|
2772
|
+
declare const isConstructor: (val: any) => boolean;
|
|
2773
|
+
declare const isEmpty: (array: any) => boolean;
|
|
2774
|
+
declare const isSymbol: (val: any) => val is symbol;
|
|
2775
|
+
declare const isPlainObject: (fn: any) => fn is object;
|
|
2776
|
+
|
|
2777
|
+
declare class SilentLogger extends Logger {
|
|
2778
|
+
log: () => void;
|
|
2779
|
+
error: () => void;
|
|
2780
|
+
warn: () => void;
|
|
2781
|
+
debug: () => void;
|
|
2782
|
+
verbose: () => void;
|
|
2783
|
+
fatal: () => void;
|
|
2784
|
+
setLogLevels: () => void;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
/**
|
|
2788
|
+
* Returns the instances which are transient
|
|
2789
|
+
* @param instances The instances which should be checked whether they are transient
|
|
2790
|
+
*/
|
|
2791
|
+
declare function getTransientInstances(instances: [InjectionToken, InstanceWrapper][]): InstanceWrapper[];
|
|
2792
|
+
/**
|
|
2793
|
+
* Returns the instances which are not transient
|
|
2794
|
+
* @param instances The instances which should be checked whether they are transient
|
|
2795
|
+
*/
|
|
2796
|
+
declare function getNonTransientInstances(instances: [InjectionToken, InstanceWrapper][]): InstanceWrapper[];
|
|
2797
|
+
|
|
2798
|
+
declare enum UuidFactoryMode {
|
|
2799
|
+
Random = "random",
|
|
2800
|
+
Deterministic = "deterministic"
|
|
2801
|
+
}
|
|
2802
|
+
declare class DeterministicUuidRegistry {
|
|
2803
|
+
private static readonly registry;
|
|
2804
|
+
static get(str: string, inc?: number): string;
|
|
2805
|
+
static clear(): void;
|
|
2806
|
+
private static hashCode;
|
|
2807
|
+
}
|
|
2808
|
+
declare class UuidFactory {
|
|
2809
|
+
#private;
|
|
2810
|
+
static set mode(value: UuidFactoryMode);
|
|
2811
|
+
static get(key?: string): string;
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
declare class InvalidDecoratorItemException extends Error {
|
|
2815
|
+
private readonly msg;
|
|
2816
|
+
constructor(decorator: string, item: string, context: string);
|
|
2817
|
+
what(): string;
|
|
2818
|
+
}
|
|
2819
|
+
declare function validateEach(context: {
|
|
2820
|
+
name: string;
|
|
2821
|
+
}, arr: any[], predicate: Function, decorator: string, item: string): boolean;
|
|
2822
|
+
|
|
2823
|
+
declare const STATIC_CONTEXT: ContextId;
|
|
2824
|
+
declare const PROVIDER_ID_KEY: unique symbol;
|
|
2825
|
+
|
|
2826
|
+
declare const ReflectorAliasProvider: Provider;
|
|
2827
|
+
declare const requestProvider: Provider;
|
|
2828
|
+
declare const inquirerProvider: Provider;
|
|
2829
|
+
|
|
2830
|
+
interface ModuleOverride {
|
|
2831
|
+
moduleToReplace: ModuleDefinition;
|
|
2832
|
+
newModule: ModuleDefinition;
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
declare class GraphInspector {
|
|
2836
|
+
private readonly container;
|
|
2837
|
+
private readonly graph;
|
|
2838
|
+
private readonly enhancersMetadataCache;
|
|
2839
|
+
constructor(container: VenokContainer);
|
|
2840
|
+
inspectModules(modules?: Map<string, Module$1>): void;
|
|
2841
|
+
registerPartial(error: unknown): void;
|
|
2842
|
+
inspectInstanceWrapper<T = any>(source: InstanceWrapper<T>, moduleRef: Module$1): void;
|
|
2843
|
+
insertEnhancerMetadataCache(entry: EnhancerMetadataCacheEntry): void;
|
|
2844
|
+
insertOrphanedEnhancer(entry: OrphanedEnhancerDefinition): void;
|
|
2845
|
+
insertAttachedEnhancer(wrapper: InstanceWrapper): void;
|
|
2846
|
+
insertEntrypointDefinition<T>(definition: Entrypoint<T>, parentId: string): void;
|
|
2847
|
+
insertClassNode(moduleRef: Module$1, wrapper: InstanceWrapper, type: Exclude<Node["metadata"]["type"], "module">): void;
|
|
2848
|
+
private insertModuleNode;
|
|
2849
|
+
private insertModuleToModuleEdges;
|
|
2850
|
+
private insertEnhancerEdge;
|
|
2851
|
+
private insertClassToClassEdge;
|
|
2852
|
+
private insertClassNodes;
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
declare class MetadataScanner {
|
|
2856
|
+
private readonly cachedScannedPrototypes;
|
|
2857
|
+
getAllMethodNames(prototype: object | null): string[];
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
interface ModulesScanParameters {
|
|
2861
|
+
moduleDefinition: ModuleDefinition;
|
|
2862
|
+
scope?: Type[];
|
|
2863
|
+
ctxRegistry?: (ForwardReference | DynamicModule | Type)[];
|
|
2864
|
+
overrides?: ModuleOverride[];
|
|
2865
|
+
lazy?: boolean;
|
|
2866
|
+
}
|
|
2867
|
+
declare class DependenciesScanner {
|
|
2868
|
+
private readonly container;
|
|
2869
|
+
private readonly metadataScanner;
|
|
2870
|
+
private readonly graphInspector;
|
|
2871
|
+
private readonly applicationConfig;
|
|
2872
|
+
private readonly applicationProvidersApplyMap;
|
|
2873
|
+
constructor(container: VenokContainer, metadataScanner: MetadataScanner, graphInspector: GraphInspector, applicationConfig?: ApplicationConfig);
|
|
2874
|
+
scan(module: Type, options?: {
|
|
2875
|
+
overrides?: ModuleOverride[];
|
|
2876
|
+
}): Promise<void>;
|
|
2877
|
+
scanForModules({ moduleDefinition, lazy, scope, ctxRegistry, overrides, }: ModulesScanParameters): Promise<Module$1[]>;
|
|
2878
|
+
insertModule(moduleDefinition: ModuleDefinition, scope: Type[]): Promise<{
|
|
2879
|
+
moduleRef: Module$1;
|
|
2880
|
+
inserted: boolean;
|
|
2881
|
+
} | undefined>;
|
|
2882
|
+
scanModulesForDependencies(modules?: Map<string, Module$1>): Promise<void>;
|
|
2883
|
+
reflectImports(module: Type, token: string, context: string): Promise<void>;
|
|
2884
|
+
reflectProviders(module: Type, token: string): void;
|
|
2885
|
+
reflectDynamicMetadata(cls: Type<InjectableToken>, token: string): void;
|
|
2886
|
+
reflectExports(module: Type, token: string): void;
|
|
2887
|
+
reflectInjectables(component: Type<InjectableToken>, token: string, metadataKey: keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP): void;
|
|
2888
|
+
reflectParamInjectables(component: Type<InjectableToken>, token: string, metadataKey: string): void;
|
|
2889
|
+
reflectKeyMetadata(component: Type<InjectableToken>, key: string, methodKey: string): {
|
|
2890
|
+
methodKey: string;
|
|
2891
|
+
metadata: any;
|
|
2892
|
+
} | undefined;
|
|
2893
|
+
calculateModulesDistance(): void;
|
|
2894
|
+
insertImport(related: Type | DynamicModule, token: string, context: string): Promise<void>;
|
|
2895
|
+
isCustomProvider(provider: Provider): provider is ClassProvider | ValueProvider | FactoryProvider | ExistingProvider;
|
|
2896
|
+
insertProvider(provider: Provider, token: string): string | symbol | Function | InstanceWrapper<unknown> | undefined;
|
|
2897
|
+
insertInjectable(injectable: Type<InjectableToken> | object, token: string, host: Type<InjectableToken>, subtype: EnhancerSubtype, methodKey?: string): InstanceWrapper<any> | undefined;
|
|
2898
|
+
insertExportedProviderOrModule(toExport: ForwardReference | DynamicModule | Type<unknown>, token: string): void;
|
|
2899
|
+
private insertOrOverrideModule;
|
|
2900
|
+
private getOverrideModuleByModule;
|
|
2901
|
+
private overrideModule;
|
|
2902
|
+
reflectMetadata<T = any>(metadataKey: string, metatype: Type): T[];
|
|
2903
|
+
registerCoreModule(overrides?: ModuleOverride[]): Promise<void>;
|
|
2904
|
+
/**
|
|
2905
|
+
* Add either request or transient globally scoped enhancers
|
|
2906
|
+
* to all controllers metadata storage
|
|
2907
|
+
*/
|
|
2908
|
+
addScopedEnhancersMetadata(): void;
|
|
2909
|
+
applyApplicationProviders(): void;
|
|
2910
|
+
getApplyProvidersMap(): {
|
|
2911
|
+
[type: string]: Function;
|
|
2912
|
+
};
|
|
2913
|
+
getApplyRequestProvidersMap(): {
|
|
2914
|
+
[type: string]: Function;
|
|
2915
|
+
};
|
|
2916
|
+
isDynamicModule(module: Type | DynamicModule): module is DynamicModule;
|
|
2917
|
+
/**
|
|
2918
|
+
* @param metatype
|
|
2919
|
+
* @returns `true` if `metatype` is annotated with the `@Injectable()` decorator.
|
|
2920
|
+
*/
|
|
2921
|
+
private isInjectable;
|
|
2922
|
+
/**
|
|
2923
|
+
* @param metatype
|
|
2924
|
+
* @returns `true` if `metatype` is annotated with the `@Catch()` decorator.
|
|
2925
|
+
*/
|
|
2926
|
+
private isExceptionFilter;
|
|
2927
|
+
private isForwardReference;
|
|
2928
|
+
private isRequestOrTransient;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
declare class InstanceLoader<TInjector extends Injector = Injector> {
|
|
2932
|
+
protected readonly container: VenokContainer;
|
|
2933
|
+
protected readonly injector: TInjector;
|
|
2934
|
+
protected readonly graphInspector: GraphInspector;
|
|
2935
|
+
private logger;
|
|
2936
|
+
constructor(container: VenokContainer, injector: TInjector, graphInspector: GraphInspector, logger?: LoggerService);
|
|
2937
|
+
setLogger(logger: Logger): void;
|
|
2938
|
+
createInstancesOfDependencies(modules?: Map<string, Module$1>): Promise<void>;
|
|
2939
|
+
private createPrototypes;
|
|
2940
|
+
private createInstances;
|
|
2941
|
+
private createPrototypesOfProviders;
|
|
2942
|
+
private createInstancesOfProviders;
|
|
2943
|
+
private createPrototypesOfInjectables;
|
|
2944
|
+
private createInstancesOfInjectables;
|
|
2945
|
+
private isModuleWhitelisted;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
declare class LazyModuleLoader {
|
|
2949
|
+
private readonly dependenciesScanner;
|
|
2950
|
+
private readonly instanceLoader;
|
|
2951
|
+
private readonly moduleCompiler;
|
|
2952
|
+
private readonly modulesContainer;
|
|
2953
|
+
private readonly moduleOverrides?;
|
|
2954
|
+
constructor(dependenciesScanner: DependenciesScanner, instanceLoader: InstanceLoader, moduleCompiler: ModuleCompiler, modulesContainer: ModulesContainer, moduleOverrides?: ModuleOverride[] | undefined);
|
|
2955
|
+
load(loaderFn: () => Promise<Type | DynamicModule> | Type | DynamicModule, loadOpts?: LazyModuleLoaderLoadOptions): Promise<ModuleRef>;
|
|
2956
|
+
private registerLoggerConfiguration;
|
|
2957
|
+
private createLazyModulesContainer;
|
|
2958
|
+
private getTargetModuleRef;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
declare function getClassScope(provider: Type): Scope;
|
|
2962
|
+
|
|
2963
|
+
declare function isClassProvider<T = any>(provider: Provider): provider is ClassProvider<T>;
|
|
2964
|
+
declare function isValueProvider<T = any>(provider: Provider): provider is ValueProvider<T>;
|
|
2965
|
+
declare function isFactoryProvider<T = any>(provider: Provider): provider is FactoryProvider<T>;
|
|
2966
|
+
|
|
2967
|
+
declare function isDurable(provider: Type): boolean | undefined;
|
|
2968
|
+
|
|
2969
|
+
declare class InitializeOnPreviewAllowlist {
|
|
2970
|
+
private static readonly allowlist;
|
|
2971
|
+
static add(type: Type): void;
|
|
2972
|
+
static has(type: Type): boolean;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
declare class PartialGraphHost {
|
|
2976
|
+
private static partialGraph;
|
|
2977
|
+
static toJSON(): SerializedGraphJson;
|
|
2978
|
+
static toString(): string;
|
|
2979
|
+
static register(partialGraph: SerializedGraph): void;
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
/**
|
|
2983
|
+
* @publicApi
|
|
2984
|
+
*/
|
|
2985
|
+
declare class ConsoleLogger implements LoggerService {
|
|
2986
|
+
/**
|
|
2987
|
+
* The options of the logger.
|
|
2988
|
+
*/
|
|
2989
|
+
protected options: ConsoleLoggerOptions;
|
|
2990
|
+
/**
|
|
2991
|
+
* The context of the logger (can be set manually or automatically inferred).
|
|
2992
|
+
*/
|
|
2993
|
+
protected context?: string;
|
|
2994
|
+
/**
|
|
2995
|
+
* The original context of the logger (set in the constructor).
|
|
2996
|
+
*/
|
|
2997
|
+
protected originalContext?: string;
|
|
2998
|
+
/**
|
|
2999
|
+
* The options used for the "inspect" method.
|
|
3000
|
+
*/
|
|
3001
|
+
protected inspectOptions: InspectOptions;
|
|
3002
|
+
/**
|
|
3003
|
+
* The last timestamp at which the log message was printed.
|
|
3004
|
+
*/
|
|
3005
|
+
protected static lastTimestampAt?: number;
|
|
3006
|
+
constructor();
|
|
3007
|
+
constructor(context: string);
|
|
3008
|
+
constructor(options: ConsoleLoggerOptions);
|
|
3009
|
+
constructor(context: string, options: ConsoleLoggerOptions);
|
|
3010
|
+
/**
|
|
3011
|
+
* Write a 'log' level log, if the configured level allows for it.
|
|
3012
|
+
* Prints to `stdout` with newline.
|
|
3013
|
+
*/
|
|
3014
|
+
log(message: any, context?: string): void;
|
|
3015
|
+
log(message: any, ...optionalParams: [...any, string?]): void;
|
|
3016
|
+
/**
|
|
3017
|
+
* Write an 'error' level log, if the configured level allows for it.
|
|
3018
|
+
* Prints to `stderr` with newline.
|
|
3019
|
+
*/
|
|
3020
|
+
error(message: any, stackOrContext?: string): void;
|
|
3021
|
+
error(message: any, stack?: string, context?: string): void;
|
|
3022
|
+
error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
|
3023
|
+
/**
|
|
3024
|
+
* Write a 'warn' level log, if the configured level allows for it.
|
|
3025
|
+
* Prints to `stdout` with newline.
|
|
3026
|
+
*/
|
|
3027
|
+
warn(message: any, context?: string): void;
|
|
3028
|
+
warn(message: any, ...optionalParams: [...any, string?]): void;
|
|
3029
|
+
/**
|
|
3030
|
+
* Write a 'debug' level log, if the configured level allows for it.
|
|
3031
|
+
* Prints to `stdout` with newline.
|
|
3032
|
+
*/
|
|
3033
|
+
debug(message: any, context?: string): void;
|
|
3034
|
+
debug(message: any, ...optionalParams: [...any, string?]): void;
|
|
3035
|
+
/**
|
|
3036
|
+
* Write a 'verbose' level log, if the configured level allows for it.
|
|
3037
|
+
* Prints to `stdout` with newline.
|
|
3038
|
+
*/
|
|
3039
|
+
verbose(message: any, context?: string): void;
|
|
3040
|
+
verbose(message: any, ...optionalParams: [...any, string?]): void;
|
|
3041
|
+
/**
|
|
3042
|
+
* Write a 'fatal' level log, if the configured level allows for it.
|
|
3043
|
+
* Prints to `stdout` with newline.
|
|
3044
|
+
*/
|
|
3045
|
+
fatal(message: any, context?: string): void;
|
|
3046
|
+
fatal(message: any, ...optionalParams: [...any, string?]): void;
|
|
3047
|
+
/**
|
|
3048
|
+
* Set log levels
|
|
3049
|
+
* @param levels log levels
|
|
3050
|
+
*/
|
|
3051
|
+
setLogLevels(levels: LogLevel[]): void;
|
|
3052
|
+
/**
|
|
3053
|
+
* Set logger context
|
|
3054
|
+
* @param context context
|
|
3055
|
+
*/
|
|
3056
|
+
setContext(context: string): void;
|
|
3057
|
+
/**
|
|
3058
|
+
* Resets the logger context to the value that was passed in the constructor.
|
|
3059
|
+
*/
|
|
3060
|
+
resetContext(): void;
|
|
3061
|
+
isLevelEnabled(level: LogLevel): boolean;
|
|
3062
|
+
protected getTimestamp(): string;
|
|
3063
|
+
protected printMessages(messages: unknown[], context?: string, logLevel?: LogLevel, writeStreamType?: "stdout" | "stderr", errorStack?: unknown): void;
|
|
3064
|
+
protected printAsJson(message: unknown, options: {
|
|
3065
|
+
context: string;
|
|
3066
|
+
logLevel: LogLevel;
|
|
3067
|
+
writeStreamType?: "stdout" | "stderr";
|
|
3068
|
+
errorStack?: unknown;
|
|
3069
|
+
}): void;
|
|
3070
|
+
protected getJsonLogObject(message: unknown, options: {
|
|
3071
|
+
context: string;
|
|
3072
|
+
logLevel: LogLevel;
|
|
3073
|
+
writeStreamType?: "stdout" | "stderr";
|
|
3074
|
+
errorStack?: unknown;
|
|
3075
|
+
}): {
|
|
3076
|
+
level: LogLevel;
|
|
3077
|
+
pid: number;
|
|
3078
|
+
timestamp: number;
|
|
3079
|
+
message: unknown;
|
|
3080
|
+
context?: string;
|
|
3081
|
+
stack?: unknown;
|
|
3082
|
+
};
|
|
3083
|
+
protected formatPid(pid: number): string;
|
|
3084
|
+
protected formatContext(context: string): string;
|
|
3085
|
+
protected formatMessage(logLevel: LogLevel, message: unknown, pidMessage: string, formattedLogLevel: string, contextMessage: string, timestampDiff: string): string;
|
|
3086
|
+
protected stringifyMessage(message: unknown, logLevel: LogLevel): any;
|
|
3087
|
+
protected colorize(message: string, logLevel: LogLevel): string;
|
|
3088
|
+
protected printStackTrace(stack: string): void;
|
|
3089
|
+
protected updateAndGetTimestampDiff(): string;
|
|
3090
|
+
protected formatTimestampDiff(timestampDiff: number): string;
|
|
3091
|
+
protected getInspectOptions(): InspectOptions;
|
|
3092
|
+
protected stringifyReplacer(key: string, value: unknown): unknown;
|
|
3093
|
+
private getContextAndMessagesToPrint;
|
|
3094
|
+
private getContextAndStackAndMessagesToPrint;
|
|
3095
|
+
private isStackFormat;
|
|
3096
|
+
private getColorByLogLevel;
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
declare const HANDLER_METADATA_SYMBOL: unique symbol;
|
|
3100
|
+
interface HandlerMetadata {
|
|
3101
|
+
argsLength: number;
|
|
3102
|
+
paramtypes: any[];
|
|
3103
|
+
getParamsMetadata: GetParamsMetadata;
|
|
3104
|
+
}
|
|
3105
|
+
declare class HandlerMetadataStorage<TValue = HandlerMetadata, TKey extends Type<unknown> = any> {
|
|
3106
|
+
private readonly [HANDLER_METADATA_SYMBOL];
|
|
3107
|
+
set(instance: TKey, methodName: string, metadata: TValue): void;
|
|
3108
|
+
get(instance: TKey, methodName: string): TValue | undefined;
|
|
3109
|
+
private getMetadataKey;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
declare class MetaHostStorage {
|
|
3113
|
+
/**
|
|
3114
|
+
* A map of class references to metadata keys.
|
|
3115
|
+
*/
|
|
3116
|
+
static readonly metaHostLinks: Map<Function | Type<any>, string>;
|
|
3117
|
+
/**
|
|
3118
|
+
* A map of metadata keys to instance wrappers (providers) with the corresponding metadata key.
|
|
3119
|
+
* The map is weakly referenced by the modules container (unique per application).
|
|
3120
|
+
*/
|
|
3121
|
+
private static readonly providersByMetaKey;
|
|
3122
|
+
/**
|
|
3123
|
+
* Adds a link between a class reference and a metadata key.
|
|
3124
|
+
* @param target The class reference.
|
|
3125
|
+
* @param metadataKey The metadata key.
|
|
3126
|
+
*/
|
|
3127
|
+
static addClassMetaHostLink(target: Type | Function, metadataKey: string): void;
|
|
3128
|
+
/**
|
|
3129
|
+
* Inspects a provider instance wrapper and adds it to the collection of providers
|
|
3130
|
+
* if it has a metadata key.
|
|
3131
|
+
* @param hostContainerRef A reference to the modules' container.
|
|
3132
|
+
* @param instanceWrapper A provider instance wrapper.
|
|
3133
|
+
* @returns void
|
|
3134
|
+
*/
|
|
3135
|
+
static inspectProvider(hostContainerRef: ModulesContainer, instanceWrapper: InstanceWrapper): void;
|
|
3136
|
+
static insertByMetaKey(metaKey: string, instanceWrapper: InstanceWrapper, collection: Map<string, Set<InstanceWrapper>>): void;
|
|
3137
|
+
static getProvidersByMetaKey(hostContainerRef: ModulesContainer, metaKey: string): Set<InstanceWrapper>;
|
|
3138
|
+
private static inspectInstanceWrapper;
|
|
3139
|
+
private static getMetaKeyByInstanceWrapper;
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
export { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE, type Abstract, ApplicationConfig, ApplicationContext, ApplicationContextOptions, type ArgumentMetadata, type ArgumentsHost, type AttachedEnhancerDefinition, type BeforeApplicationShutdown, Bind, CATCH_WATERMARK, CUSTOM_ROUTE_ARGS_METADATA, type CallHandler, type CanActivate, Catch, CircularDependencyException, type ClassDecoratorOptions, type ClassNode, type ClassProvider, ConsoleLogger, type ConsoleLoggerOptions, ContextCreator, type ContextId, ContextIdFactory, type ContextIdResolver, type ContextIdResolverFn, type ContextIdStrategy, type ContextType, ContextUtils, Module$1 as CoreModule, type CreateDecoratorOptions, type CustomDecorator, type CustomParamFactory, type DecoratorOptions, type DecoratorsType, Dependencies, DependenciesScanner, DeterministicUuidRegistry, type DynamicModule, ENHANCER_KEY_TO_SUBTYPE_MAP, ENHANCER_TOKEN_TO_SUBTYPE_MAP, ENTRY_PROVIDER_WATERMARK, EXCEPTION_FILTERS_METADATA, type Edge, type EnhancerMetadataCacheEntry, type EnhancerSubtype, type Entrypoint, type ExceptionFilter, type ExceptionFilterMetadata, type ExecutionContext, ExecutionContextHost, type ExistingProvider, type ExternalContextOptions, type ExternalHandlerMetadata, type Extras, FILTER_CATCH_EXCEPTIONS, FORBIDDEN_MESSAGE, type FactoryProvider, type ForwardReference, GLOBAL_MODULE_METADATA, GUARDS_METADATA, type GetOrResolveOptions, type GetParamsMetadata, Global, GraphInspector, GuardsConsumer, GuardsContextCreator, HANDLER_METADATA_SYMBOL, HandlerMetadataStorage, type HostComponentInfo, INJECTABLE_WATERMARK, INQUIRER, INSTANCE_ID_SYMBOL, INSTANCE_METADATA_SYMBOL, INTERCEPTORS_METADATA, INVALID_CLASS_MESSAGE, INVALID_CLASS_SCOPE_MESSAGE, INVALID_EXCEPTION_FILTER, INVALID_MODULE_MESSAGE, InitializeOnPreviewAllowlist, Inject, Injectable, type InjectableToken, type InjectionToken, Injector, type InjectorDependency, type InjectorDependencyContext, type InstancePerContext, InstanceWrapper, InterceptorsConsumer, InterceptorsContextCreator, type IntrospectionResult, InvalidClassException, InvalidClassModuleException, InvalidClassScopeException, InvalidDecoratorItemException, InvalidExceptionFilterException, InvalidModuleException, LOG_LEVELS, LazyModuleLoader, type LazyModuleLoaderLoadOptions, type LogLevel, Logger, type LoggerService, MESSAGES, MICROSERVICES_PACKAGE_NOT_FOUND_EXCEPTION, MODULE_INIT_MESSAGE, MODULE_METADATA, MODULE_PATH, MetaHostStorage, MetadataScanner, type MethodDecoratorOptions, Module, type ModuleDefinition, type ModuleFactory, type ModuleMetadata, type ModuleNode, ModuleRef, type ModuleRefGetOrResolveOpts, ModulesContainer, type Node, OPTIONAL_DEPS_METADATA, OPTIONAL_PROPERTY_DEPS_METADATA, type OnApplicationBootstrap, type OnApplicationShutdown, type OnModuleDestroy, type OnModuleInit, Optional, type OptionalFactoryDependency, type OrphanedEnhancerDefinition, PARAMTYPES_METADATA, PIPES_METADATA, PROPERTY_DEPS_METADATA, PROVIDER_ID_KEY, type ParamData, type ParamDecoratorEnhancer, type ParamMetadata, type ParamProperties, type ParamsMetadata, PartialGraphHost, type PipeTransform, PipesConsumer, PipesContextCreator, type PropertyDependency, type PropertyMetadata, type Provider, REQUEST, REQUEST_CONTEXT_ID, ROUTE_ARGS_METADATA, type ReflectableClassDecorator, type ReflectableDecorator, type ReflectableDecorators, type ReflectableMethodDecorator, Reflector, ReflectorAliasProvider, RuntimeException, SCOPE_OPTIONS_METADATA, SELF_DECLARED_DEPS_METADATA, STATIC_CONTEXT, Scope, type ScopeOptions, type SelectOptions, SerializedGraph, type SerializedGraphJson, type SerializedGraphMetadata, type SerializedGraphStatus, SetMetadata, type SetMetadataType, SilentLogger, type Transform, type Type, UNDEFINED_FORWARDREF_MESSAGE, UNDEFINED_MODULE_MESSAGE, UNHANDLED_RUNTIME_EXCEPTION, UNKNOWN_DEPENDENCIES_MESSAGE, UNKNOWN_EXPORT_MESSAGE, USING_INVALID_CLASS_AS_A_MODULE_MESSAGE, UndefinedDependencyException, UndefinedForwardRefException, UndefinedModuleException, UnknownDependenciesException, UnknownElementException, UnknownExportException, UnknownModuleException, UseFilters, UseGuards, UseInterceptors, UsePipes, UuidFactory, UuidFactoryMode, type ValueProvider, type VenokApplicationContext, VenokContainer, VenokContextCreator, type VenokContextCreatorInterface, VenokExceptionFilterContext, VenokFactory, type VenokInterceptor, type VenokModule, type VenokParamsFactoryInterface, VenokProxy, type WithRequired, type WithTransform, applyDecorators, assignCustomParameterMetadata, assignMetadata, colors, createContextId, createNativeParamDecorator, createNativeParamDecoratorWithoutPipes, createParamDecorator, createParamDecoratorWithoutPipes, extendArrayMetadata, filterLogLevels, flatten, getClassScope, getNonTransientInstances, getTransientInstances, inquirerProvider, isClassProvider, isColorAllowed, isConstructor, isDurable, isEmpty, isFactoryProvider, isFunction, isLogLevel, isLogLevelEnabled, isNull, isNumber, isObject, isPlainObject, isString, isSymbol, isUndefined, isValueProvider, mixin, noop, randomStringGenerator, requestProvider, rethrow, validateEach, yellow };
|