@venok/core 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application/config.js +92 -0
- package/dist/application/context.js +252 -0
- package/dist/application/factory.js +136 -0
- package/dist/constants.js +100 -0
- package/dist/context/context-id.factory.js +58 -0
- package/dist/context/context.js +186 -0
- package/dist/context/creator.js +49 -0
- package/dist/context/execution-host.js +51 -0
- package/dist/context/proxy.js +55 -0
- package/dist/decorators/apply.decorator.js +33 -0
- package/dist/decorators/bind.decorator.js +28 -0
- package/dist/decorators/catch.decorator.js +29 -0
- package/dist/decorators/dependencies.decorator.js +30 -0
- package/dist/decorators/exception-filters.decorator.js +40 -0
- package/dist/decorators/global.decorator.js +28 -0
- package/dist/decorators/inject.decorator.js +42 -0
- package/dist/decorators/injectable.decorator.js +38 -0
- package/dist/decorators/module.decorator.js +42 -0
- package/dist/decorators/optional.decorator.js +35 -0
- package/dist/decorators/set-metadata.decorator.js +35 -0
- package/dist/decorators/use-guards.decorator.js +39 -0
- package/dist/decorators/use-interceptors.decorator.js +39 -0
- package/dist/decorators/use-pipes.decorator.js +38 -0
- package/dist/enums/scope.enum.js +28 -0
- package/dist/enums/shutdown-signal.enum.js +36 -0
- package/dist/errors/exceptions/circular-dependency.exception.js +30 -0
- package/dist/errors/exceptions/invalid-class-module.exception.js +30 -0
- package/dist/errors/exceptions/invalid-class-scope.exception.js +33 -0
- package/dist/errors/exceptions/invalid-class.exception.js +30 -0
- package/dist/errors/exceptions/invalid-exception-filter.exception.js +30 -0
- package/dist/errors/exceptions/invalid-module.exception.js +30 -0
- package/dist/errors/exceptions/runtime.exception.js +30 -0
- package/dist/errors/exceptions/undefined-dependency.exception.js +30 -0
- package/dist/errors/exceptions/undefined-forwardref.exception.js +30 -0
- package/dist/errors/exceptions/undefined-module.exception.js +30 -0
- package/dist/errors/exceptions/unknown-dependencies.exception.js +38 -0
- package/dist/errors/exceptions/unknown-element.exception.js +31 -0
- package/dist/errors/exceptions/unknown-export.exception.js +30 -0
- package/dist/errors/exceptions/unknown-module.exception.js +29 -0
- package/dist/errors/messages.js +134 -0
- package/dist/exceptions/handler.js +53 -0
- package/dist/exceptions/zone/handler.js +30 -0
- package/dist/exceptions/zone/zone.js +49 -0
- package/dist/filters/context-creator.js +65 -0
- package/dist/filters/context.js +58 -0
- package/dist/filters/filter.js +36 -0
- package/dist/guards/consumer.js +54 -0
- package/dist/guards/context-creator.js +76 -0
- package/dist/helpers/color.helper.js +35 -0
- package/dist/helpers/context-id-factory.helper.js +25 -0
- package/dist/helpers/context.helper.js +65 -0
- package/dist/helpers/create-param-decorator.helper.js +73 -0
- package/dist/helpers/filter-log-levels.util.js +38 -0
- package/dist/helpers/flatten.helper.js +26 -0
- package/dist/helpers/is-log-level-enabled.util.js +39 -0
- package/dist/helpers/is-log-level.util.js +26 -0
- package/dist/helpers/messages.helper.js +23 -0
- package/dist/helpers/metadata.helper.js +51 -0
- package/dist/helpers/noop.helper.js +23 -0
- package/dist/helpers/random-string-generator.helper.js +24 -0
- package/dist/helpers/rethrow.helper.js +25 -0
- package/dist/helpers/shared.helper.js +49 -0
- package/dist/helpers/silent.helper.js +34 -0
- package/dist/helpers/transient.helper.js +30 -0
- package/dist/helpers/uuid.helper.js +60 -0
- package/dist/helpers/validate-each.helper.js +42 -0
- package/dist/hooks/before-app-shutdown.hook.js +43 -0
- package/dist/hooks/on-app-bootstrap.hook.js +43 -0
- package/dist/hooks/on-app-shutdown.hook.js +43 -0
- package/dist/hooks/on-module-destroy.hook.js +43 -0
- package/dist/hooks/on-module-init.hook.js +43 -0
- package/dist/index.d.ts +3142 -0
- package/dist/index.js +115 -0
- package/dist/injector/constants.js +28 -0
- package/dist/injector/container.js +229 -0
- package/dist/injector/helpers/barrier.js +48 -0
- package/dist/injector/helpers/class-scope.helper.js +27 -0
- package/dist/injector/helpers/classifier.helper.js +35 -0
- package/dist/injector/helpers/is-durable.helper.js +27 -0
- package/dist/injector/injector.js +490 -0
- package/dist/injector/instance/links-host.js +68 -0
- package/dist/injector/instance/loader.js +95 -0
- package/dist/injector/instance/resolver.js +61 -0
- package/dist/injector/instance/wrapper.js +324 -0
- package/dist/injector/internal-core-module/core-providers.js +42 -0
- package/dist/injector/internal-core-module/internal-core-module-factory.js +66 -0
- package/dist/injector/internal-core-module/internal-core-module.js +46 -0
- package/dist/injector/module/compiler.js +47 -0
- package/dist/injector/module/container.js +33 -0
- package/dist/injector/module/lazy/loader.js +71 -0
- package/dist/injector/module/module.js +395 -0
- package/dist/injector/module/ref.js +78 -0
- package/dist/injector/module/token-factory.js +82 -0
- package/dist/injector/settlement-signal.js +50 -0
- package/dist/injector/topology-tree/topology-tree.js +68 -0
- package/dist/injector/topology-tree/tree-node.js +68 -0
- package/dist/inspector/graph-inspector.js +182 -0
- package/dist/inspector/initialize-on-preview.allowlist.js +31 -0
- package/dist/inspector/noop-graph-inspector.js +27 -0
- package/dist/inspector/partial-graph.host.js +34 -0
- package/dist/inspector/serialized-graph.js +128 -0
- package/dist/interceptors/consumer.js +54 -0
- package/dist/interceptors/context-creator.js +75 -0
- package/dist/interfaces/application/context-options.interface.js +31 -0
- package/dist/interfaces/application/context.interface.js +0 -0
- package/dist/interfaces/application/index.js +3 -0
- package/dist/interfaces/context/arguments-host.interface.js +0 -0
- package/dist/interfaces/context/context-id-factory.interface.js +0 -0
- package/dist/interfaces/context/context.interface.js +0 -0
- package/dist/interfaces/context/creator.interface.js +0 -0
- package/dist/interfaces/context/execution.interface.js +0 -0
- package/dist/interfaces/context/index.js +7 -0
- package/dist/interfaces/context/params.interface.js +0 -0
- package/dist/interfaces/features/exception-filter.interface.js +0 -0
- package/dist/interfaces/features/guards.interface.js +0 -0
- package/dist/interfaces/features/index.js +5 -0
- package/dist/interfaces/features/interceptor.interface.js +0 -0
- package/dist/interfaces/features/pipes.interface.js +0 -0
- package/dist/interfaces/helper.interface.js +0 -0
- package/dist/interfaces/hooks/before-application-shutdown.interface.js +0 -0
- package/dist/interfaces/hooks/index.js +6 -0
- package/dist/interfaces/hooks/on-application-bootstrap.interface.js +0 -0
- package/dist/interfaces/hooks/on-application-shutdown.interface.js +0 -0
- package/dist/interfaces/hooks/on-destroy.interface.js +0 -0
- package/dist/interfaces/hooks/on-init.interface.js +0 -0
- package/dist/interfaces/index.js +16 -0
- package/dist/interfaces/injectable.interface.js +0 -0
- package/dist/interfaces/injector/index.js +6 -0
- package/dist/interfaces/injector/injector.interface.js +0 -0
- package/dist/interfaces/injector/instance-wrapper.interface.js +0 -0
- package/dist/interfaces/injector/lazy-module-options.interface.js +0 -0
- package/dist/interfaces/injector/module-compiler.interface.js +0 -0
- package/dist/interfaces/injector/module-ref.interface.js +0 -0
- package/dist/interfaces/inspector/edge.interface.js +0 -0
- package/dist/interfaces/inspector/enhancer-metadata-cache-entry.interface.js +0 -0
- package/dist/interfaces/inspector/entrypoint.interface.js +0 -0
- package/dist/interfaces/inspector/extras.interface.js +0 -0
- package/dist/interfaces/inspector/index.js +8 -0
- package/dist/interfaces/inspector/node.interface.js +0 -0
- package/dist/interfaces/inspector/serialized-graph-json.interface.js +0 -0
- package/dist/interfaces/inspector/serialized-graph-metadata.interface.js +0 -0
- package/dist/interfaces/modules/definition.interface.js +0 -0
- package/dist/interfaces/modules/dynamic-module.interface.js +0 -0
- package/dist/interfaces/modules/forward-reference.interface.js +0 -0
- package/dist/interfaces/modules/index.js +10 -0
- package/dist/interfaces/modules/injection-token.interface.js +0 -0
- package/dist/interfaces/modules/introspection-result.interface.js +0 -0
- package/dist/interfaces/modules/module-metadata.interface.js +0 -0
- package/dist/interfaces/modules/module.interface.js +0 -0
- package/dist/interfaces/modules/optional-factory-dependency.interface.js +0 -0
- package/dist/interfaces/modules/override.interface.js +0 -0
- package/dist/interfaces/modules/provider.interface.js +0 -0
- package/dist/interfaces/param-decorator.interface.js +0 -0
- package/dist/interfaces/scope.interface.js +0 -0
- package/dist/interfaces/services/console.interface.js +0 -0
- package/dist/interfaces/services/index.js +4 -0
- package/dist/interfaces/services/logger.interface.js +0 -0
- package/dist/interfaces/services/reflector.interface.js +0 -0
- package/dist/interfaces/set-metadata.interface.js +0 -0
- package/dist/interfaces/type.interface.js +0 -0
- package/dist/metadata-scanner.js +50 -0
- package/dist/pipes/consumer.js +33 -0
- package/dist/pipes/context-creator.js +78 -0
- package/dist/scanner.js +371 -0
- package/dist/services/console.service.js +347 -0
- package/dist/services/logger.service.js +276 -0
- package/dist/services/reflector.service.js +82 -0
- package/dist/storage/handler-metadata.storage.js +42 -0
- package/dist/storage/meta-host.storage.js +62 -0
- package/package.json +52 -40
- package/application/config.d.ts +0 -35
- package/application/config.js +0 -85
- package/application/context.d.ts +0 -198
- package/application/context.js +0 -325
- package/application/factory.d.ts +0 -43
- package/application/factory.js +0 -147
- package/constants.d.ts +0 -44
- package/constants.js +0 -51
- package/context/context.d.ts +0 -66
- package/context/context.js +0 -156
- package/context/creator.d.ts +0 -9
- package/context/creator.js +0 -32
- package/context/execution-host.d.ts +0 -16
- package/context/execution-host.js +0 -30
- package/context/index.d.ts +0 -4
- package/context/index.js +0 -20
- package/context/proxy.d.ts +0 -6
- package/context/proxy.js +0 -33
- package/decorators/apply.decorator.d.ts +0 -10
- package/decorators/apply.decorator.js +0 -24
- package/decorators/bind.decorator.d.ts +0 -11
- package/decorators/bind.decorator.js +0 -20
- package/decorators/catch.decorator.d.ts +0 -17
- package/decorators/catch.decorator.js +0 -26
- package/decorators/create-param.decorator.d.ts +0 -29
- package/decorators/create-param.decorator.js +0 -51
- package/decorators/dependencies.decorator.d.ts +0 -6
- package/decorators/dependencies.decorator.js +0 -17
- package/decorators/exception-filters.decorator.d.ts +0 -21
- package/decorators/exception-filters.decorator.js +0 -41
- package/decorators/global.decorator.d.ts +0 -10
- package/decorators/global.decorator.js +0 -19
- package/decorators/index.d.ts +0 -15
- package/decorators/index.js +0 -31
- package/decorators/inject.decorator.d.ts +0 -26
- package/decorators/inject.decorator.js +0 -45
- package/decorators/injectable.decorator.d.ts +0 -40
- package/decorators/injectable.decorator.js +0 -51
- package/decorators/module.decorator.d.ts +0 -14
- package/decorators/module.decorator.js +0 -38
- package/decorators/optional.decorator.d.ts +0 -14
- package/decorators/optional.decorator.js +0 -30
- package/decorators/set-metadata.decorator.d.ts +0 -18
- package/decorators/set-metadata.decorator.js +0 -30
- package/decorators/use-guards.decorator.d.ts +0 -21
- package/decorators/use-guards.decorator.js +0 -40
- package/decorators/use-interceptors.decorator.d.ts +0 -21
- package/decorators/use-interceptors.decorator.js +0 -40
- package/decorators/use-pipes.decorator.d.ts +0 -21
- package/decorators/use-pipes.decorator.js +0 -39
- package/discovery/meta-host-collection.d.ts +0 -32
- package/discovery/meta-host-collection.js +0 -79
- package/discovery/module.d.ts +0 -5
- package/discovery/module.js +0 -24
- package/discovery/service.d.ts +0 -68
- package/discovery/service.js +0 -90
- package/errors/exceptions/circular-dependency.exception.d.ts +0 -4
- package/errors/exceptions/circular-dependency.exception.js +0 -11
- package/errors/exceptions/index.d.ts +0 -8
- package/errors/exceptions/index.js +0 -24
- package/errors/exceptions/invalid-class-module.exception.d.ts +0 -4
- package/errors/exceptions/invalid-class-module.exception.js +0 -11
- package/errors/exceptions/invalid-class-scope.exception.d.ts +0 -5
- package/errors/exceptions/invalid-class-scope.exception.js +0 -14
- package/errors/exceptions/invalid-class.exception.d.ts +0 -4
- package/errors/exceptions/invalid-class.exception.js +0 -11
- package/errors/exceptions/invalid-exception-filter.exception.d.ts +0 -4
- package/errors/exceptions/invalid-exception-filter.exception.js +0 -11
- package/errors/exceptions/invalid-module.exception.d.ts +0 -4
- package/errors/exceptions/invalid-module.exception.js +0 -11
- package/errors/exceptions/runtime.exception.d.ts +0 -4
- package/errors/exceptions/runtime.exception.js +0 -12
- package/errors/exceptions/undefined-dependency.exception.d.ts +0 -6
- package/errors/exceptions/undefined-dependency.exception.js +0 -11
- package/errors/exceptions/undefined-forwardref.exception.d.ts +0 -5
- package/errors/exceptions/undefined-forwardref.exception.js +0 -11
- package/errors/exceptions/undefined-module.exception.d.ts +0 -4
- package/errors/exceptions/undefined-module.exception.js +0 -11
- package/errors/exceptions/unknown-dependencies.exception.d.ts +0 -16
- package/errors/exceptions/unknown-dependencies.exception.js +0 -15
- package/errors/exceptions/unknown-element.exception.d.ts +0 -4
- package/errors/exceptions/unknown-element.exception.js +0 -12
- package/errors/exceptions/unknown-export.exception.d.ts +0 -4
- package/errors/exceptions/unknown-export.exception.js +0 -11
- package/errors/exceptions/unknown-module.exception.d.ts +0 -4
- package/errors/exceptions/unknown-module.exception.js +0 -10
- package/errors/messages.d.ts +0 -15
- package/errors/messages.js +0 -126
- package/exceptions/handler.d.ts +0 -10
- package/exceptions/handler.js +0 -34
- package/exceptions/index.d.ts +0 -2
- package/exceptions/index.js +0 -18
- package/exceptions/zone/handler.d.ts +0 -5
- package/exceptions/zone/handler.js +0 -15
- package/exceptions/zone/index.d.ts +0 -2
- package/exceptions/zone/index.js +0 -18
- package/exceptions/zone/zone.d.ts +0 -5
- package/exceptions/zone/zone.js +0 -32
- package/filters/context-creator.d.ts +0 -14
- package/filters/context-creator.js +0 -48
- package/filters/context.d.ts +0 -12
- package/filters/context.js +0 -41
- package/filters/filter.d.ts +0 -6
- package/filters/filter.js +0 -16
- package/filters/index.d.ts +0 -3
- package/filters/index.js +0 -19
- package/guards/consumer.d.ts +0 -9
- package/guards/consumer.js +0 -33
- package/guards/context-creator.d.ts +0 -17
- package/guards/context-creator.js +0 -69
- package/guards/index.d.ts +0 -2
- package/guards/index.js +0 -18
- package/helpers/color.helper.d.ts +0 -9
- package/helpers/color.helper.js +0 -14
- package/helpers/context-id-factory.helper.d.ts +0 -2
- package/helpers/context-id-factory.helper.js +0 -15
- package/helpers/context.helper.d.ts +0 -23
- package/helpers/context.helper.js +0 -49
- package/helpers/extends-metadata.helper.d.ts +0 -1
- package/helpers/extends-metadata.helper.js +0 -9
- package/helpers/flatten.helper.d.ts +0 -1
- package/helpers/flatten.helper.js +0 -9
- package/helpers/messages.helper.d.ts +0 -2
- package/helpers/messages.helper.js +0 -7
- package/helpers/noop.helper.d.ts +0 -1
- package/helpers/noop.helper.js +0 -5
- package/helpers/random-string-generator.helper.d.ts +0 -1
- package/helpers/random-string-generator.helper.js +0 -6
- package/helpers/rethrow.helper.d.ts +0 -1
- package/helpers/rethrow.helper.js +0 -7
- package/helpers/shared.helper.d.ts +0 -10
- package/helpers/shared.helper.js +0 -33
- package/helpers/silent.helper.d.ts +0 -10
- package/helpers/silent.helper.js +0 -18
- package/helpers/transient.helper.d.ts +0 -12
- package/helpers/transient.helper.js +0 -26
- package/helpers/uuid.helper.d.ts +0 -15
- package/helpers/uuid.helper.js +0 -54
- package/helpers/validate-each.helper.d.ts +0 -8
- package/helpers/validate-each.helper.js +0 -25
- package/hooks/before-app-shutdown.hook.d.ts +0 -9
- package/hooks/before-app-shutdown.hook.js +0 -45
- package/hooks/index.d.ts +0 -5
- package/hooks/index.js +0 -21
- package/hooks/on-app-bootstrap.hook.d.ts +0 -8
- package/hooks/on-app-bootstrap.hook.js +0 -45
- package/hooks/on-app-shutdown.hook.d.ts +0 -9
- package/hooks/on-app-shutdown.hook.js +0 -46
- package/hooks/on-module-destroy.hook.d.ts +0 -8
- package/hooks/on-module-destroy.hook.js +0 -45
- package/hooks/on-module-init.hook.d.ts +0 -8
- package/hooks/on-module-init.hook.js +0 -45
- package/index.d.ts +0 -10
- package/index.js +0 -32
- package/injector/constants.d.ts +0 -2
- package/injector/constants.js +0 -7
- package/injector/container.d.ts +0 -61
- package/injector/container.js +0 -194
- package/injector/helpers/class-scope.helper.d.ts +0 -2
- package/injector/helpers/class-scope.helper.js +0 -9
- package/injector/helpers/classifier.helper.d.ts +0 -4
- package/injector/helpers/classifier.helper.js +0 -17
- package/injector/helpers/is-durable.helper.d.ts +0 -2
- package/injector/helpers/is-durable.helper.js +0 -9
- package/injector/index.d.ts +0 -5
- package/injector/index.js +0 -20
- package/injector/injector.d.ts +0 -87
- package/injector/injector.js +0 -452
- package/injector/instance/links-host.d.ts +0 -22
- package/injector/instance/links-host.js +0 -50
- package/injector/instance/loader.d.ts +0 -21
- package/injector/instance/loader.js +0 -73
- package/injector/instance/resolver.d.ts +0 -16
- package/injector/instance/resolver.js +0 -43
- package/injector/instance/wrapper.d.ts +0 -90
- package/injector/instance/wrapper.js +0 -272
- package/injector/internal-core-module/core-providers.d.ts +0 -4
- package/injector/internal-core-module/core-providers.js +0 -21
- package/injector/internal-core-module/internal-core-module-factory.d.ts +0 -8
- package/injector/internal-core-module/internal-core-module-factory.js +0 -47
- package/injector/internal-core-module/internal-core-module.d.ts +0 -4
- package/injector/internal-core-module/internal-core-module.js +0 -31
- package/injector/module/compiler.d.ts +0 -19
- package/injector/module/compiler.js +0 -27
- package/injector/module/container.d.ts +0 -6
- package/injector/module/container.js +0 -24
- package/injector/module/lazy/loader.d.ts +0 -21
- package/injector/module/lazy/loader.js +0 -49
- package/injector/module/lazy/options.d.ts +0 -6
- package/injector/module/lazy/options.js +0 -2
- package/injector/module/module.d.ts +0 -74
- package/injector/module/module.js +0 -383
- package/injector/module/ref.d.ts +0 -106
- package/injector/module/ref.js +0 -62
- package/injector/module/token-factory.d.ts +0 -13
- package/injector/module/token-factory.js +0 -71
- package/injector/settlement-signal.d.ts +0 -37
- package/injector/settlement-signal.js +0 -55
- package/inspector/graph-inspector.d.ts +0 -26
- package/inspector/graph-inspector.js +0 -163
- package/inspector/initialize-on-preview.allowlist.d.ts +0 -6
- package/inspector/initialize-on-preview.allowlist.js +0 -13
- package/inspector/interfaces/edge.interface.d.ts +0 -28
- package/inspector/interfaces/edge.interface.js +0 -2
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +0 -12
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +0 -2
- package/inspector/interfaces/entrypoint.interface.d.ts +0 -10
- package/inspector/interfaces/entrypoint.interface.js +0 -2
- package/inspector/interfaces/extras.interface.d.ts +0 -18
- package/inspector/interfaces/extras.interface.js +0 -2
- package/inspector/interfaces/node.interface.d.ts +0 -49
- package/inspector/interfaces/node.interface.js +0 -2
- package/inspector/interfaces/serialized-graph-json.interface.d.ts +0 -14
- package/inspector/interfaces/serialized-graph-json.interface.js +0 -2
- package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +0 -10
- package/inspector/interfaces/serialized-graph-metadata.interface.js +0 -2
- package/inspector/noop-graph-inspector.d.ts +0 -2
- package/inspector/noop-graph-inspector.js +0 -8
- package/inspector/partial-graph.host.d.ts +0 -7
- package/inspector/partial-graph.host.js +0 -15
- package/inspector/serialized-graph.d.ts +0 -52
- package/inspector/serialized-graph.js +0 -121
- package/interceptors/consumer.d.ts +0 -9
- package/interceptors/consumer.js +0 -37
- package/interceptors/context-creator.d.ts +0 -17
- package/interceptors/context-creator.js +0 -67
- package/interceptors/index.d.ts +0 -2
- package/interceptors/index.js +0 -18
- package/interfaces/abstract.interface.d.ts +0 -3
- package/interfaces/abstract.interface.js +0 -2
- package/interfaces/application/context-options.interface.d.ts +0 -41
- package/interfaces/application/context-options.interface.js +0 -9
- package/interfaces/application/context.interface.d.ts +0 -162
- package/interfaces/application/context.interface.js +0 -2
- package/interfaces/application/index.d.ts +0 -1
- package/interfaces/application/index.js +0 -17
- package/interfaces/context/arguments-host.interface.d.ts +0 -22
- package/interfaces/context/arguments-host.interface.js +0 -2
- package/interfaces/context/execution.interface.d.ts +0 -18
- package/interfaces/context/execution.interface.js +0 -2
- package/interfaces/context/index.d.ts +0 -2
- package/interfaces/context/index.js +0 -18
- package/interfaces/features/exception-filter.interface.d.ts +0 -21
- package/interfaces/features/exception-filter.interface.js +0 -2
- package/interfaces/features/guards.interface.d.ts +0 -20
- package/interfaces/features/guards.interface.js +0 -2
- package/interfaces/features/index.d.ts +0 -4
- package/interfaces/features/index.js +0 -20
- package/interfaces/features/interceptor.interface.d.ts +0 -30
- package/interfaces/features/interceptor.interface.js +0 -2
- package/interfaces/features/pipes.interface.d.ts +0 -37
- package/interfaces/features/pipes.interface.js +0 -2
- package/interfaces/helper.interface.d.ts +0 -3
- package/interfaces/helper.interface.js +0 -2
- package/interfaces/hooks/before-application-shutdown.interface.d.ts +0 -3
- package/interfaces/hooks/before-application-shutdown.interface.js +0 -2
- package/interfaces/hooks/index.d.ts +0 -5
- package/interfaces/hooks/index.js +0 -21
- package/interfaces/hooks/on-application-bootstrap.interface.d.ts +0 -9
- package/interfaces/hooks/on-application-bootstrap.interface.js +0 -2
- package/interfaces/hooks/on-application-shutdown.interface.d.ts +0 -9
- package/interfaces/hooks/on-application-shutdown.interface.js +0 -2
- package/interfaces/hooks/on-destroy.interface.d.ts +0 -10
- package/interfaces/hooks/on-destroy.interface.js +0 -2
- package/interfaces/hooks/on-init.interface.d.ts +0 -8
- package/interfaces/hooks/on-init.interface.js +0 -2
- package/interfaces/index.d.ts +0 -8
- package/interfaces/index.js +0 -24
- package/interfaces/injectable.interface.d.ts +0 -1
- package/interfaces/injectable.interface.js +0 -2
- package/interfaces/modules/configurable/async-options.interface.d.ts +0 -42
- package/interfaces/modules/configurable/async-options.interface.js +0 -2
- package/interfaces/modules/configurable/cls.interface.d.ts +0 -13
- package/interfaces/modules/configurable/cls.interface.js +0 -2
- package/interfaces/modules/configurable/host.interface.d.ts +0 -62
- package/interfaces/modules/configurable/host.interface.js +0 -2
- package/interfaces/modules/configurable/index.d.ts +0 -3
- package/interfaces/modules/configurable/index.js +0 -19
- package/interfaces/modules/definition.interface.d.ts +0 -4
- package/interfaces/modules/definition.interface.js +0 -2
- package/interfaces/modules/dynamic-module.interface.d.ts +0 -23
- package/interfaces/modules/dynamic-module.interface.js +0 -2
- package/interfaces/modules/forward-reference.interface.d.ts +0 -3
- package/interfaces/modules/forward-reference.interface.js +0 -2
- package/interfaces/modules/index.d.ts +0 -9
- package/interfaces/modules/index.js +0 -25
- package/interfaces/modules/injection-token.interface.d.ts +0 -5
- package/interfaces/modules/injection-token.interface.js +0 -2
- package/interfaces/modules/introspection-result.interface.d.ts +0 -10
- package/interfaces/modules/introspection-result.interface.js +0 -2
- package/interfaces/modules/module-metadata.interface.d.ts +0 -24
- package/interfaces/modules/module-metadata.interface.js +0 -2
- package/interfaces/modules/module.interface.d.ts +0 -2
- package/interfaces/modules/module.interface.js +0 -2
- package/interfaces/modules/optional-factory-dependency.interface.d.ts +0 -8
- package/interfaces/modules/optional-factory-dependency.interface.js +0 -2
- package/interfaces/modules/override.interface.d.ts +0 -5
- package/interfaces/modules/override.interface.js +0 -2
- package/interfaces/modules/provider.interface.d.ts +0 -142
- package/interfaces/modules/provider.interface.js +0 -2
- package/interfaces/scope.interface.d.ts +0 -35
- package/interfaces/scope.interface.js +0 -23
- package/interfaces/type.interface.d.ts +0 -3
- package/interfaces/type.interface.js +0 -2
- package/metadata-scanner.d.ts +0 -4
- package/metadata-scanner.js +0 -34
- package/module/configurable-module.builder.d.ts +0 -93
- package/module/configurable-module.builder.js +0 -204
- package/module/constants.d.ts +0 -4
- package/module/constants.js +0 -7
- package/module/helpers/generate-options-injection-token.helper.d.ts +0 -1
- package/module/helpers/generate-options-injection-token.helper.js +0 -9
- package/module/helpers/get-injection-providers.helper.d.ts +0 -8
- package/module/helpers/get-injection-providers.helper.js +0 -36
- package/module/helpers/index.d.ts +0 -2
- package/module/helpers/index.js +0 -18
- package/module/index.d.ts +0 -2
- package/module/index.js +0 -18
- package/pipes/consumer.d.ts +0 -9
- package/pipes/consumer.js +0 -15
- package/pipes/context-creator.d.ts +0 -18
- package/pipes/context-creator.js +0 -70
- package/pipes/index.d.ts +0 -2
- package/pipes/index.js +0 -18
- package/scanner.d.ts +0 -81
- package/scanner.js +0 -374
- package/services/console.service.d.ts +0 -86
- package/services/console.service.js +0 -233
- package/services/index.d.ts +0 -1
- package/services/index.js +0 -17
- package/services/logger.service.d.ts +0 -157
- package/services/logger.service.js +0 -269
- package/services/reflector.service.d.ts +0 -110
- package/services/reflector.service.js +0 -87
- package/test/context/creator.spec.d.ts +0 -1
- package/test/context/creator.spec.js +0 -149
- package/test/context/execution-host.spec.d.ts +0 -1
- package/test/context/execution-host.spec.js +0 -31
- package/test/context/proxy.spec.d.ts +0 -1
- package/test/context/proxy.spec.js +0 -46
- package/test/exceptions/handler.spec.d.ts +0 -1
- package/test/exceptions/handler.spec.js +0 -90
- package/test/exceptions/messages.spec.js +0 -201
- package/test/exceptions/zona/handler.spec.d.ts +0 -1
- package/test/exceptions/zona/handler.spec.js +0 -51
- package/test/exceptions/zona/zone.spec.d.ts +0 -1
- package/test/exceptions/zona/zone.spec.js +0 -66
- package/test/filters/context-creator.spec.d.ts +0 -2
- package/test/filters/context-creator.spec.js +0 -91
- package/test/guards/consumer.spec.d.ts +0 -1
- package/test/guards/consumer.spec.js +0 -47
- package/test/guards/context-creator.spec.d.ts +0 -1
- package/test/guards/context-creator.spec.js +0 -138
- package/test/helpers/context-id-factory.spec.d.ts +0 -1
- package/test/helpers/context-id-factory.spec.js +0 -9
- package/test/helpers/shared.spec.d.ts +0 -1
- package/test/helpers/shared.spec.js +0 -122
- package/test/hooks/before-app-shutdown.hook.spec.d.ts +0 -1
- package/test/hooks/before-app-shutdown.hook.spec.js +0 -44
- package/test/hooks/on-app-bootstrap.hook.spec.d.ts +0 -1
- package/test/hooks/on-app-bootstrap.hook.spec.js +0 -43
- package/test/hooks/on-app-shutdown.hook.spec.d.ts +0 -1
- package/test/hooks/on-app-shutdown.hook.spec.js +0 -43
- package/test/hooks/on-module-destroy.hook.spec.d.ts +0 -1
- package/test/hooks/on-module-destroy.hook.spec.js +0 -43
- package/test/hooks/on-module-init.hook.spec.d.ts +0 -1
- package/test/hooks/on-module-init.hook.spec.js +0 -43
- package/test/injector/compiler.spec.d.ts +0 -1
- package/test/injector/compiler.spec.js +0 -42
- package/test/injector/container.spec.d.ts +0 -1
- package/test/injector/container.spec.js +0 -203
- package/test/injector/helpers/classifier.spec.d.ts +0 -1
- package/test/injector/helpers/classifier.spec.js +0 -102
- package/test/injector/injector.spec.d.ts +0 -1
- package/test/injector/injector.spec.js +0 -678
- package/test/injector/instance/loader.spec.d.ts +0 -1
- package/test/injector/instance/loader.spec.js +0 -108
- package/test/injector/instance/wrapper.spec.d.ts +0 -1
- package/test/injector/instance/wrapper.spec.js +0 -772
- package/test/injector/internal-core-module/internal-core-module-factory.spec.d.ts +0 -1
- package/test/injector/internal-core-module/internal-core-module-factory.spec.js +0 -27
- package/test/injector/module/lazy/loader.spec.d.ts +0 -1
- package/test/injector/module/lazy/loader.spec.js +0 -71
- package/test/injector/module/module.spec.d.ts +0 -1
- package/test/injector/module/module.spec.js +0 -410
- package/test/injector/module/token-factory.spec.d.ts +0 -1
- package/test/injector/module/token-factory.spec.js +0 -84
- package/test/interceptors/consumer.spec.d.ts +0 -1
- package/test/interceptors/consumer.spec.js +0 -136
- package/test/interceptors/context-creator.spec.d.ts +0 -1
- package/test/interceptors/context-creator.spec.js +0 -139
- package/test/metadata-scanner.spec.d.ts +0 -1
- package/test/metadata-scanner.spec.js +0 -41
- package/test/module/configurable-module.builder.spec.d.ts +0 -1
- package/test/module/configurable-module.builder.spec.js +0 -102
- package/test/module/helpers/get-injection-providers.helper.spec.d.ts +0 -1
- package/test/module/helpers/get-injection-providers.helper.spec.js +0 -49
- package/test/pipes/consumer.spec.d.ts +0 -1
- package/test/pipes/consumer.spec.js +0 -42
- package/test/pipes/context-creator.spec.d.ts +0 -1
- package/test/pipes/context-creator.spec.js +0 -108
- package/test/scanner.spec.d.ts +0 -1
- package/test/scanner.spec.js +0 -620
- package/test/services/logger.service.spec.d.ts +0 -1
- package/test/services/logger.service.spec.js +0 -487
- package/test/services/reflector.service.spec.d.ts +0 -1
- package/test/services/reflector.service.spec.js +0 -105
- package/tsconfig.tsbuildinfo +0 -1
- /package/{test/exceptions/messages.spec.d.ts → dist/interfaces/abstract.interface.js} +0 -0
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var Logger_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.Logger = exports.isLogLevelEnabled = void 0;
|
|
17
|
-
const console_service_1 = require("@venok/core/services/console.service");
|
|
18
|
-
const injectable_decorator_1 = require("@venok/core/decorators/injectable.decorator");
|
|
19
|
-
const optional_decorator_1 = require("@venok/core/decorators/optional.decorator");
|
|
20
|
-
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
21
|
-
const LOG_LEVEL_VALUES = {
|
|
22
|
-
verbose: 0,
|
|
23
|
-
debug: 1,
|
|
24
|
-
log: 2,
|
|
25
|
-
warn: 3,
|
|
26
|
-
error: 4,
|
|
27
|
-
fatal: 5,
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Checks if target level is enabled.
|
|
31
|
-
* @param targetLevel target level
|
|
32
|
-
* @param logLevels array of enabled log levels
|
|
33
|
-
*/
|
|
34
|
-
function isLogLevelEnabled(targetLevel, logLevels) {
|
|
35
|
-
if (!logLevels || (Array.isArray(logLevels) && logLevels?.length === 0)) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
if (logLevels.includes(targetLevel)) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
const highestLogLevelValue = logLevels.map((level) => LOG_LEVEL_VALUES[level]).sort((a, b) => b - a)?.[0];
|
|
42
|
-
const targetLevelValue = LOG_LEVEL_VALUES[targetLevel];
|
|
43
|
-
return targetLevelValue >= highestLogLevelValue;
|
|
44
|
-
}
|
|
45
|
-
exports.isLogLevelEnabled = isLogLevelEnabled;
|
|
46
|
-
const DEFAULT_LOGGER = new console_service_1.ConsoleLogger();
|
|
47
|
-
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
|
|
48
|
-
year: "numeric",
|
|
49
|
-
hour: "numeric",
|
|
50
|
-
minute: "numeric",
|
|
51
|
-
second: "numeric",
|
|
52
|
-
day: "2-digit",
|
|
53
|
-
month: "2-digit",
|
|
54
|
-
});
|
|
55
|
-
/**
|
|
56
|
-
* @publicApi
|
|
57
|
-
*/
|
|
58
|
-
let Logger = Logger_1 = class Logger {
|
|
59
|
-
constructor(context, options = {}) {
|
|
60
|
-
this.context = context;
|
|
61
|
-
this.options = options;
|
|
62
|
-
}
|
|
63
|
-
get localInstance() {
|
|
64
|
-
if (Logger_1.staticInstanceRef === DEFAULT_LOGGER) {
|
|
65
|
-
return this.registerLocalInstanceRef();
|
|
66
|
-
}
|
|
67
|
-
else if (Logger_1.staticInstanceRef instanceof Logger_1) {
|
|
68
|
-
const prototype = Object.getPrototypeOf(Logger_1.staticInstanceRef);
|
|
69
|
-
if (prototype.constructor === Logger_1) {
|
|
70
|
-
return this.registerLocalInstanceRef();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return Logger_1.staticInstanceRef;
|
|
74
|
-
}
|
|
75
|
-
error(message, ...optionalParams) {
|
|
76
|
-
optionalParams = this.context
|
|
77
|
-
? (optionalParams.length ? optionalParams : [undefined]).concat(this.context)
|
|
78
|
-
: optionalParams;
|
|
79
|
-
this.localInstance?.error(message, ...optionalParams);
|
|
80
|
-
}
|
|
81
|
-
log(message, ...optionalParams) {
|
|
82
|
-
optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
|
|
83
|
-
this.localInstance?.log(message, ...optionalParams);
|
|
84
|
-
}
|
|
85
|
-
warn(message, ...optionalParams) {
|
|
86
|
-
optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
|
|
87
|
-
this.localInstance?.warn(message, ...optionalParams);
|
|
88
|
-
}
|
|
89
|
-
debug(message, ...optionalParams) {
|
|
90
|
-
optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
|
|
91
|
-
this.localInstance?.debug?.(message, ...optionalParams);
|
|
92
|
-
}
|
|
93
|
-
verbose(message, ...optionalParams) {
|
|
94
|
-
optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
|
|
95
|
-
this.localInstance?.verbose?.(message, ...optionalParams);
|
|
96
|
-
}
|
|
97
|
-
fatal(message, ...optionalParams) {
|
|
98
|
-
optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
|
|
99
|
-
this.localInstance?.fatal?.(message, ...optionalParams);
|
|
100
|
-
}
|
|
101
|
-
static error(message, ...optionalParams) {
|
|
102
|
-
this.staticInstanceRef?.error(message, ...optionalParams);
|
|
103
|
-
}
|
|
104
|
-
static log(message, ...optionalParams) {
|
|
105
|
-
this.staticInstanceRef?.log(message, ...optionalParams);
|
|
106
|
-
}
|
|
107
|
-
static warn(message, ...optionalParams) {
|
|
108
|
-
this.staticInstanceRef?.warn(message, ...optionalParams);
|
|
109
|
-
}
|
|
110
|
-
static debug(message, ...optionalParams) {
|
|
111
|
-
this.staticInstanceRef?.debug?.(message, ...optionalParams);
|
|
112
|
-
}
|
|
113
|
-
static verbose(message, ...optionalParams) {
|
|
114
|
-
this.staticInstanceRef?.verbose?.(message, ...optionalParams);
|
|
115
|
-
}
|
|
116
|
-
static fatal(message, ...optionalParams) {
|
|
117
|
-
this.staticInstanceRef?.fatal?.(message, ...optionalParams);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Print buffered logs and detach buffer.
|
|
121
|
-
*/
|
|
122
|
-
static flush() {
|
|
123
|
-
this.isBufferAttached = false;
|
|
124
|
-
this.logBuffer.forEach((item) => item.methodRef(...item.arguments));
|
|
125
|
-
this.logBuffer = [];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Attach buffer.
|
|
129
|
-
* Turns on initialization logs buffering.
|
|
130
|
-
*/
|
|
131
|
-
static attachBuffer() {
|
|
132
|
-
this.isBufferAttached = true;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Detach buffer.
|
|
136
|
-
* Turns off initialization logs buffering.
|
|
137
|
-
*/
|
|
138
|
-
static detachBuffer() {
|
|
139
|
-
this.isBufferAttached = false;
|
|
140
|
-
}
|
|
141
|
-
static getTimestamp() {
|
|
142
|
-
return dateTimeFormatter.format(Date.now());
|
|
143
|
-
}
|
|
144
|
-
static overrideLogger(logger) {
|
|
145
|
-
if (Array.isArray(logger) && this.staticInstanceRef.setLogLevels) {
|
|
146
|
-
Logger_1.logLevels = logger;
|
|
147
|
-
return this.staticInstanceRef.setLogLevels(logger);
|
|
148
|
-
}
|
|
149
|
-
if ((0, shared_helper_1.isObject)(logger)) {
|
|
150
|
-
if (logger instanceof Logger_1 && logger.constructor !== Logger_1) {
|
|
151
|
-
const errorMessage = `Using the "extends Logger" instruction is not allowed in Nest v9. Please, use "extends ConsoleLogger" instead.`;
|
|
152
|
-
this.staticInstanceRef.error(errorMessage);
|
|
153
|
-
throw new Error(errorMessage);
|
|
154
|
-
}
|
|
155
|
-
this.staticInstanceRef = logger;
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this.staticInstanceRef = undefined;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
static isLevelEnabled(level) {
|
|
162
|
-
const logLevels = Logger_1.logLevels;
|
|
163
|
-
return isLogLevelEnabled(level, logLevels);
|
|
164
|
-
}
|
|
165
|
-
registerLocalInstanceRef() {
|
|
166
|
-
if (this.localInstanceRef) {
|
|
167
|
-
return this.localInstanceRef;
|
|
168
|
-
}
|
|
169
|
-
this.localInstanceRef = new console_service_1.ConsoleLogger(this.context ?? "", {
|
|
170
|
-
timestamp: this.options?.timestamp,
|
|
171
|
-
logLevels: Logger_1.logLevels,
|
|
172
|
-
});
|
|
173
|
-
return this.localInstanceRef;
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
exports.Logger = Logger;
|
|
177
|
-
Logger.logBuffer = new Array();
|
|
178
|
-
Logger.staticInstanceRef = DEFAULT_LOGGER;
|
|
179
|
-
Logger.WrapBuffer = (target, propertyKey, descriptor) => {
|
|
180
|
-
const originalFn = descriptor.value;
|
|
181
|
-
descriptor.value = function (...args) {
|
|
182
|
-
if (Logger_1.isBufferAttached) {
|
|
183
|
-
Logger_1.logBuffer.push({
|
|
184
|
-
methodRef: originalFn.bind(this),
|
|
185
|
-
arguments: args,
|
|
186
|
-
});
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
return originalFn.call(this, ...args);
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
__decorate([
|
|
193
|
-
Logger.WrapBuffer,
|
|
194
|
-
__metadata("design:type", Function),
|
|
195
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
196
|
-
__metadata("design:returntype", void 0)
|
|
197
|
-
], Logger.prototype, "error", null);
|
|
198
|
-
__decorate([
|
|
199
|
-
Logger.WrapBuffer,
|
|
200
|
-
__metadata("design:type", Function),
|
|
201
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
202
|
-
__metadata("design:returntype", void 0)
|
|
203
|
-
], Logger.prototype, "log", null);
|
|
204
|
-
__decorate([
|
|
205
|
-
Logger.WrapBuffer,
|
|
206
|
-
__metadata("design:type", Function),
|
|
207
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
208
|
-
__metadata("design:returntype", void 0)
|
|
209
|
-
], Logger.prototype, "warn", null);
|
|
210
|
-
__decorate([
|
|
211
|
-
Logger.WrapBuffer,
|
|
212
|
-
__metadata("design:type", Function),
|
|
213
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
214
|
-
__metadata("design:returntype", void 0)
|
|
215
|
-
], Logger.prototype, "debug", null);
|
|
216
|
-
__decorate([
|
|
217
|
-
Logger.WrapBuffer,
|
|
218
|
-
__metadata("design:type", Function),
|
|
219
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
220
|
-
__metadata("design:returntype", void 0)
|
|
221
|
-
], Logger.prototype, "verbose", null);
|
|
222
|
-
__decorate([
|
|
223
|
-
Logger.WrapBuffer,
|
|
224
|
-
__metadata("design:type", Function),
|
|
225
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
226
|
-
__metadata("design:returntype", void 0)
|
|
227
|
-
], Logger.prototype, "fatal", null);
|
|
228
|
-
__decorate([
|
|
229
|
-
Logger.WrapBuffer,
|
|
230
|
-
__metadata("design:type", Function),
|
|
231
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
232
|
-
__metadata("design:returntype", void 0)
|
|
233
|
-
], Logger, "error", null);
|
|
234
|
-
__decorate([
|
|
235
|
-
Logger.WrapBuffer,
|
|
236
|
-
__metadata("design:type", Function),
|
|
237
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
238
|
-
__metadata("design:returntype", void 0)
|
|
239
|
-
], Logger, "log", null);
|
|
240
|
-
__decorate([
|
|
241
|
-
Logger.WrapBuffer,
|
|
242
|
-
__metadata("design:type", Function),
|
|
243
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
244
|
-
__metadata("design:returntype", void 0)
|
|
245
|
-
], Logger, "warn", null);
|
|
246
|
-
__decorate([
|
|
247
|
-
Logger.WrapBuffer,
|
|
248
|
-
__metadata("design:type", Function),
|
|
249
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
250
|
-
__metadata("design:returntype", void 0)
|
|
251
|
-
], Logger, "debug", null);
|
|
252
|
-
__decorate([
|
|
253
|
-
Logger.WrapBuffer,
|
|
254
|
-
__metadata("design:type", Function),
|
|
255
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
256
|
-
__metadata("design:returntype", void 0)
|
|
257
|
-
], Logger, "verbose", null);
|
|
258
|
-
__decorate([
|
|
259
|
-
Logger.WrapBuffer,
|
|
260
|
-
__metadata("design:type", Function),
|
|
261
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
262
|
-
__metadata("design:returntype", void 0)
|
|
263
|
-
], Logger, "fatal", null);
|
|
264
|
-
exports.Logger = Logger = Logger_1 = __decorate([
|
|
265
|
-
(0, injectable_decorator_1.Injectable)(),
|
|
266
|
-
__param(0, (0, optional_decorator_1.Optional)()),
|
|
267
|
-
__param(1, (0, optional_decorator_1.Optional)()),
|
|
268
|
-
__metadata("design:paramtypes", [String, Object])
|
|
269
|
-
], Logger);
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { CustomDecorator } from "@venok/core/decorators/set-metadata.decorator";
|
|
2
|
-
import { Type } from "@venok/core/interfaces";
|
|
3
|
-
/**
|
|
4
|
-
* @publicApi
|
|
5
|
-
*/
|
|
6
|
-
export interface CreateDecoratorOptions<TParam = any, TTransformed = TParam> {
|
|
7
|
-
/**
|
|
8
|
-
* The key for the metadata.
|
|
9
|
-
* @default uid(21)
|
|
10
|
-
*/
|
|
11
|
-
key?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The transform function to apply to the metadata value.
|
|
14
|
-
* @default value => value
|
|
15
|
-
*/
|
|
16
|
-
transform?: (value: TParam) => TTransformed;
|
|
17
|
-
}
|
|
18
|
-
type CreateDecoratorWithTransformOptions<TParam, TTransformed = TParam> = CreateDecoratorOptions<TParam, TTransformed> & Required<Pick<CreateDecoratorOptions<TParam, TTransformed>, "transform">>;
|
|
19
|
-
/**
|
|
20
|
-
* @publicApi
|
|
21
|
-
*/
|
|
22
|
-
export type ReflectableDecorator<TParam, TTransformed = TParam> = ((opts?: TParam) => CustomDecorator) & {
|
|
23
|
-
KEY: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Helper class providing Venok reflection capabilities.
|
|
27
|
-
*
|
|
28
|
-
* @publicApi
|
|
29
|
-
*/
|
|
30
|
-
export declare class Reflector {
|
|
31
|
-
/**
|
|
32
|
-
* Creates a decorator that can be used to decorate classes and methods with metadata.
|
|
33
|
-
* Can be used as a strongly-typed alternative to `@SetMetadata`.
|
|
34
|
-
* @param options Decorator options.
|
|
35
|
-
* @returns A decorator function.
|
|
36
|
-
*/
|
|
37
|
-
static createDecorator<TParam>(options?: CreateDecoratorOptions<TParam>): ReflectableDecorator<TParam>;
|
|
38
|
-
static createDecorator<TParam, TTransformed>(options: CreateDecoratorWithTransformOptions<TParam, TTransformed>): ReflectableDecorator<TParam, TTransformed>;
|
|
39
|
-
/**
|
|
40
|
-
* Retrieve metadata for a reflectable decorator for a specified target.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* `const roles = this.reflector.get(Roles, context.getHandler());`
|
|
44
|
-
*
|
|
45
|
-
* @param decorator reflectable decorator created through `Reflector.createDecorator`
|
|
46
|
-
* @param target context (decorated object) to retrieve metadata from
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
get<T extends ReflectableDecorator<any>>(decorator: T, target: Type | Function): T extends ReflectableDecorator<any, infer R> ? R : unknown;
|
|
50
|
-
/**
|
|
51
|
-
* Retrieve metadata for a specified key for a specified target.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* `const roles = this.reflector.get<string[]>('roles', context.getHandler());`
|
|
55
|
-
*
|
|
56
|
-
* @param metadataKey lookup key for metadata to retrieve
|
|
57
|
-
* @param target context (decorated object) to retrieve metadata from
|
|
58
|
-
*
|
|
59
|
-
*/
|
|
60
|
-
get<TResult = any, TKey = any>(metadataKey: TKey, target: Type | Function): TResult;
|
|
61
|
-
/**
|
|
62
|
-
* Retrieve metadata for a specified decorator for a specified set of targets.
|
|
63
|
-
*
|
|
64
|
-
* @param decorator lookup decorator for metadata to retrieve
|
|
65
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
getAll<T extends ReflectableDecorator<any>>(decorator: T, targets: (Type | Function)[]): T extends ReflectableDecorator<infer R> ? (R extends Array<any> ? R : R[]) : unknown;
|
|
69
|
-
/**
|
|
70
|
-
* Retrieve metadata for a specified key for a specified set of targets.
|
|
71
|
-
*
|
|
72
|
-
* @param metadataKey lookup key for metadata to retrieve
|
|
73
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
74
|
-
*
|
|
75
|
-
*/
|
|
76
|
-
getAll<TResult extends any[] = any[], TKey = any>(metadataKey: TKey, targets: (Type | Function)[]): TResult;
|
|
77
|
-
/**
|
|
78
|
-
* Retrieve metadata for a specified decorator for a specified set of targets and merge results.
|
|
79
|
-
*
|
|
80
|
-
* @param decorator lookup decorator for metadata to retrieve
|
|
81
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
|
-
getAllAndMerge<T extends ReflectableDecorator<any>>(decorator: T, targets: (Type | Function)[]): T extends ReflectableDecorator<infer R> ? R : unknown;
|
|
85
|
-
/**
|
|
86
|
-
* Retrieve metadata for a specified key for a specified set of targets and merge results.
|
|
87
|
-
*
|
|
88
|
-
* @param metadataKey lookup key for metadata to retrieve
|
|
89
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
90
|
-
*
|
|
91
|
-
*/
|
|
92
|
-
getAllAndMerge<TResult extends any[] | object = any[], TKey = any>(metadataKey: TKey, targets: (Type | Function)[]): TResult;
|
|
93
|
-
/**
|
|
94
|
-
* Retrieve metadata for a specified decorator for a specified set of targets and return a first not undefined value.
|
|
95
|
-
*
|
|
96
|
-
* @param decorator lookup decorator for metadata to retrieve
|
|
97
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
getAllAndOverride<T extends ReflectableDecorator<any>>(decorator: T, targets: (Type | Function)[]): T extends ReflectableDecorator<infer R> ? R : unknown;
|
|
101
|
-
/**
|
|
102
|
-
* Retrieve metadata for a specified key for a specified set of targets and return a first not undefined value.
|
|
103
|
-
*
|
|
104
|
-
* @param metadataKey lookup key for metadata to retrieve
|
|
105
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
106
|
-
*
|
|
107
|
-
*/
|
|
108
|
-
getAllAndOverride<TResult = any, TKey = any>(metadataKey: TKey, targets: (Type | Function)[]): TResult;
|
|
109
|
-
}
|
|
110
|
-
export {};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Reflector = void 0;
|
|
4
|
-
const set_metadata_decorator_1 = require("@venok/core/decorators/set-metadata.decorator");
|
|
5
|
-
const uid_1 = require("uid");
|
|
6
|
-
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
7
|
-
/**
|
|
8
|
-
* Helper class providing Venok reflection capabilities.
|
|
9
|
-
*
|
|
10
|
-
* @publicApi
|
|
11
|
-
*/
|
|
12
|
-
class Reflector {
|
|
13
|
-
static createDecorator(options = {}) {
|
|
14
|
-
const metadataKey = options.key ?? (0, uid_1.uid)(21);
|
|
15
|
-
const decoratorFn = (metadataValue) => (target, key, descriptor) => {
|
|
16
|
-
const value = options.transform ? options.transform(metadataValue) : metadataValue;
|
|
17
|
-
(0, set_metadata_decorator_1.SetMetadata)(metadataKey, value ?? {})(target, key, descriptor);
|
|
18
|
-
};
|
|
19
|
-
decoratorFn.KEY = metadataKey;
|
|
20
|
-
return decoratorFn;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Retrieve metadata for a specified key or decorator for a specified target.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* `const roles = this.reflector.get<string[]>('roles', context.getHandler());`
|
|
27
|
-
*
|
|
28
|
-
* @param metadataKeyOrDecorator lookup key or decorator for metadata to retrieve
|
|
29
|
-
* @param target context (decorated object) to retrieve metadata from
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
get(metadataKeyOrDecorator, target) {
|
|
33
|
-
const metadataKey = metadataKeyOrDecorator.KEY ?? metadataKeyOrDecorator;
|
|
34
|
-
return Reflect.getMetadata(metadataKey, target);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Retrieve metadata for a specified key or decorator for a specified set of targets.
|
|
38
|
-
*
|
|
39
|
-
* @param metadataKeyOrDecorator lookup key or decorator for metadata to retrieve
|
|
40
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
getAll(metadataKeyOrDecorator, targets) {
|
|
44
|
-
return (targets || []).map((target) => this.get(metadataKeyOrDecorator, target));
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Retrieve metadata for a specified key or decorator for a specified set of targets and merge results.
|
|
48
|
-
*
|
|
49
|
-
* @param metadataKeyOrDecorator lookup key for metadata to retrieve
|
|
50
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
getAllAndMerge(metadataKeyOrDecorator, targets) {
|
|
54
|
-
const metadataCollection = this.getAll(metadataKeyOrDecorator, targets).filter((item) => item !== undefined);
|
|
55
|
-
if ((0, shared_helper_1.isEmpty)(metadataCollection)) {
|
|
56
|
-
return metadataCollection;
|
|
57
|
-
}
|
|
58
|
-
return metadataCollection.reduce((a, b) => {
|
|
59
|
-
if (Array.isArray(a)) {
|
|
60
|
-
return a.concat(b);
|
|
61
|
-
}
|
|
62
|
-
if ((0, shared_helper_1.isObject)(a) && (0, shared_helper_1.isObject)(b)) {
|
|
63
|
-
return {
|
|
64
|
-
...a,
|
|
65
|
-
...b,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return [a, b];
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Retrieve metadata for a specified key or decorator for a specified set of targets and return a first not undefined value.
|
|
73
|
-
*
|
|
74
|
-
* @param metadataKeyOrDecorator lookup key or metadata for metadata to retrieve
|
|
75
|
-
* @param targets context (decorated objects) to retrieve metadata from
|
|
76
|
-
*
|
|
77
|
-
*/
|
|
78
|
-
getAllAndOverride(metadataKeyOrDecorator, targets) {
|
|
79
|
-
for (const target of targets) {
|
|
80
|
-
const result = this.get(metadataKeyOrDecorator, target);
|
|
81
|
-
if (result !== undefined)
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.Reflector = Reflector;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const chai_1 = require("chai");
|
|
7
|
-
const rxjs_1 = require("rxjs");
|
|
8
|
-
const sinon_1 = __importDefault(require("sinon"));
|
|
9
|
-
const context_1 = require("@venok/core/context/context");
|
|
10
|
-
const guards_1 = require("@venok/core/guards");
|
|
11
|
-
const pipes_1 = require("@venok/core/pipes");
|
|
12
|
-
const container_1 = require("@venok/core/injector/container");
|
|
13
|
-
const interceptors_1 = require("@venok/core/interceptors");
|
|
14
|
-
const container_2 = require("@venok/core/injector/module/container");
|
|
15
|
-
const context_2 = require("@venok/core/filters/context");
|
|
16
|
-
const module_1 = require("@venok/core/injector/module/module");
|
|
17
|
-
describe("VenokContextCreator", () => {
|
|
18
|
-
let contextCreator;
|
|
19
|
-
let callback;
|
|
20
|
-
let bindSpy;
|
|
21
|
-
let applySpy;
|
|
22
|
-
let guardsConsumer;
|
|
23
|
-
let pipesConsumer;
|
|
24
|
-
let guardsContextCreator;
|
|
25
|
-
beforeEach(() => {
|
|
26
|
-
callback = {
|
|
27
|
-
bind: () => ({}),
|
|
28
|
-
apply: () => ({}),
|
|
29
|
-
};
|
|
30
|
-
bindSpy = sinon_1.default.spy(callback, "bind");
|
|
31
|
-
applySpy = sinon_1.default.spy(callback, "apply");
|
|
32
|
-
guardsConsumer = new guards_1.GuardsConsumer();
|
|
33
|
-
pipesConsumer = new pipes_1.PipesConsumer();
|
|
34
|
-
guardsContextCreator = new guards_1.GuardsContextCreator(new container_1.VenokContainer());
|
|
35
|
-
sinon_1.default.stub(guardsContextCreator, "create").returns([{}]);
|
|
36
|
-
contextCreator = new context_1.VenokContextCreator(guardsContextCreator, guardsConsumer, new interceptors_1.InterceptorsContextCreator(new container_1.VenokContainer()), new interceptors_1.InterceptorsConsumer(), new container_2.ModulesContainer(), new pipes_1.PipesContextCreator(new container_1.VenokContainer()), pipesConsumer, new context_2.VenokExceptionFilterContext(new container_1.VenokContainer()));
|
|
37
|
-
});
|
|
38
|
-
describe("create", () => {
|
|
39
|
-
it('should call "getContextModuleName" with expected argument', (done) => {
|
|
40
|
-
const getContextModuleKeySpy = sinon_1.default.spy(contextCreator, "getContextModuleKey");
|
|
41
|
-
contextCreator.create({ foo: "bar" }, callback, "", "", null);
|
|
42
|
-
(0, chai_1.expect)(getContextModuleKeySpy.called).to.be.true;
|
|
43
|
-
done();
|
|
44
|
-
});
|
|
45
|
-
describe("returns proxy function", () => {
|
|
46
|
-
let proxyContext;
|
|
47
|
-
let instance;
|
|
48
|
-
beforeEach(() => {
|
|
49
|
-
instance = { foo: "bar" };
|
|
50
|
-
proxyContext = contextCreator.create(instance, callback, "", "", null);
|
|
51
|
-
});
|
|
52
|
-
it("should be a function", () => {
|
|
53
|
-
(0, chai_1.expect)(proxyContext).to.be.a("function");
|
|
54
|
-
});
|
|
55
|
-
describe("when proxy function called", () => {
|
|
56
|
-
// describe("when can not activate", () => {
|
|
57
|
-
// it('should throw exception when "tryActivate" returns false', async () => {
|
|
58
|
-
// sinon.stub(guardsConsumer, "tryActivate").callsFake(async () => false);
|
|
59
|
-
// let err: any;
|
|
60
|
-
// try {
|
|
61
|
-
// await proxyContext(1, 2, 3);
|
|
62
|
-
// } catch (e) {
|
|
63
|
-
// console.log(e);
|
|
64
|
-
// err = e;
|
|
65
|
-
// }
|
|
66
|
-
// expect(err).to.be.instanceOf(RuntimeException);
|
|
67
|
-
// });
|
|
68
|
-
// });
|
|
69
|
-
describe("when can activate", () => {
|
|
70
|
-
it("should apply context and args", async () => {
|
|
71
|
-
const args = [1, 2, 3];
|
|
72
|
-
sinon_1.default.stub(guardsConsumer, "tryActivate").callsFake(async () => true);
|
|
73
|
-
await proxyContext(...args);
|
|
74
|
-
(0, chai_1.expect)(applySpy.called).to.be.true;
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe("getContextModuleKey", () => {
|
|
81
|
-
describe("when constructor is undefined", () => {
|
|
82
|
-
it("should return empty string", () => {
|
|
83
|
-
(0, chai_1.expect)(contextCreator.getContextModuleKey(undefined)).to.be.eql("");
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
describe("when module reference provider exists", () => {
|
|
87
|
-
it("should return module key", () => {
|
|
88
|
-
const modules = new Map();
|
|
89
|
-
const moduleKey = "key";
|
|
90
|
-
const moduleRef = new module_1.Module(class {
|
|
91
|
-
}, modules);
|
|
92
|
-
modules.set(moduleKey, moduleRef);
|
|
93
|
-
contextCreator.modulesContainer = modules;
|
|
94
|
-
sinon_1.default.stub(moduleRef, "hasProvider").callsFake(() => true);
|
|
95
|
-
(0, chai_1.expect)(contextCreator.getContextModuleKey({ randomObject: true })).to.be.eql(moduleKey);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
describe("when provider does not exists", () => {
|
|
99
|
-
it("should return empty string", () => {
|
|
100
|
-
(0, chai_1.expect)(contextCreator.getContextModuleKey({})).to.be.eql("");
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
describe("createPipesFn", () => {
|
|
105
|
-
describe('when "paramsOptions" is empty', () => {
|
|
106
|
-
it("returns null", async () => {
|
|
107
|
-
const pipesFn = contextCreator.createPipesFn([], []);
|
|
108
|
-
(0, chai_1.expect)(pipesFn).to.be.null;
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
describe('when "paramsOptions" is not empty', () => {
|
|
112
|
-
it("returns function", async () => {
|
|
113
|
-
const pipesFn = contextCreator.createPipesFn([], [
|
|
114
|
-
{
|
|
115
|
-
index: 1,
|
|
116
|
-
type: "test",
|
|
117
|
-
data: null,
|
|
118
|
-
pipes: [],
|
|
119
|
-
extractValue: () => null,
|
|
120
|
-
},
|
|
121
|
-
]);
|
|
122
|
-
await pipesFn([]);
|
|
123
|
-
(0, chai_1.expect)(pipesFn).to.be.a("function");
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
describe("transformToResult", () => {
|
|
128
|
-
describe("when resultOrDeferred", () => {
|
|
129
|
-
describe("is Promise", () => {
|
|
130
|
-
it("should return Promise", async () => {
|
|
131
|
-
const value = 100;
|
|
132
|
-
(0, chai_1.expect)(await contextCreator.transformToResult(Promise.resolve(value))).to.be.eq(100);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
describe("is Observable", () => {
|
|
136
|
-
it("should return Promise", async () => {
|
|
137
|
-
const value = 100;
|
|
138
|
-
(0, chai_1.expect)(await contextCreator.transformToResult((0, rxjs_1.of)(value))).to.be.eq(100);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
describe("is value", () => {
|
|
142
|
-
it("should return Promise", async () => {
|
|
143
|
-
const value = 100;
|
|
144
|
-
(0, chai_1.expect)(await contextCreator.transformToResult(value)).to.be.eq(100);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const chai_1 = require("chai");
|
|
4
|
-
const execution_host_1 = require("@venok/core/context/execution-host");
|
|
5
|
-
describe("ExecutionContextHost", () => {
|
|
6
|
-
let contextHost;
|
|
7
|
-
const args = ["test", "test2", "test3"], constructorRef = { test: "test" }, callback = () => null;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
contextHost = new execution_host_1.ExecutionContextHost(args, constructorRef, callback);
|
|
10
|
-
});
|
|
11
|
-
describe("getClass", () => {
|
|
12
|
-
it("should return constructorRef", () => {
|
|
13
|
-
(0, chai_1.expect)(contextHost.getClass()).to.be.eql(constructorRef);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
describe("getHandler", () => {
|
|
17
|
-
it("should return handler", () => {
|
|
18
|
-
(0, chai_1.expect)(contextHost.getHandler()).to.be.eql(callback);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
describe("getArgs", () => {
|
|
22
|
-
it("should return args", () => {
|
|
23
|
-
(0, chai_1.expect)(contextHost.getArgs()).to.be.eql(args);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
describe("getArgByIndex", () => {
|
|
27
|
-
it("should return argument by index", () => {
|
|
28
|
-
(0, chai_1.expect)(contextHost.getArgByIndex(0)).to.be.eql(args[0]);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|