@venok/core 1.1.0 → 2.0.1-next.1
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 +43 -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 +3141 -0
- package/dist/index.js +117 -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,86 +0,0 @@
|
|
|
1
|
-
import { LoggerService, LogLevel } from "@venok/core/services/logger.service";
|
|
2
|
-
export interface ConsoleLoggerOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Enabled log levels.
|
|
5
|
-
*/
|
|
6
|
-
logLevels?: LogLevel[];
|
|
7
|
-
/**
|
|
8
|
-
* If enabled, will print timestamp (time difference) between current and previous log message.
|
|
9
|
-
*/
|
|
10
|
-
timestamp?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare class ConsoleLogger implements LoggerService {
|
|
13
|
-
protected context?: string | undefined;
|
|
14
|
-
protected options: ConsoleLoggerOptions;
|
|
15
|
-
private static lastTimestampAt?;
|
|
16
|
-
private originalContext?;
|
|
17
|
-
constructor();
|
|
18
|
-
constructor(context: string);
|
|
19
|
-
constructor(context: string, options: ConsoleLoggerOptions);
|
|
20
|
-
/**
|
|
21
|
-
* Write a 'log' level log, if the configured level allows for it.
|
|
22
|
-
* Prints to `stdout` with newline.
|
|
23
|
-
*/
|
|
24
|
-
log(message: any, context?: string): void;
|
|
25
|
-
log(message: any, ...optionalParams: [...any, string?]): void;
|
|
26
|
-
/**
|
|
27
|
-
* Write an 'error' level log, if the configured level allows for it.
|
|
28
|
-
* Prints to `stderr` with newline.
|
|
29
|
-
*/
|
|
30
|
-
error(message: any, stackOrContext?: string): void;
|
|
31
|
-
error(message: any, stack?: string, context?: string): void;
|
|
32
|
-
error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Write a 'warn' level log, if the configured level allows for it.
|
|
35
|
-
* Prints to `stdout` with newline.
|
|
36
|
-
*/
|
|
37
|
-
warn(message: any, context?: string): void;
|
|
38
|
-
warn(message: any, ...optionalParams: [...any, string?]): void;
|
|
39
|
-
/**
|
|
40
|
-
* Write a 'debug' level log, if the configured level allows for it.
|
|
41
|
-
* Prints to `stdout` with newline.
|
|
42
|
-
*/
|
|
43
|
-
debug(message: any, context?: string): void;
|
|
44
|
-
debug(message: any, ...optionalParams: [...any, string?]): void;
|
|
45
|
-
/**
|
|
46
|
-
* Write a 'verbose' level log, if the configured level allows for it.
|
|
47
|
-
* Prints to `stdout` with newline.
|
|
48
|
-
*/
|
|
49
|
-
verbose(message: any, context?: string): void;
|
|
50
|
-
verbose(message: any, ...optionalParams: [...any, string?]): void;
|
|
51
|
-
/**
|
|
52
|
-
* Write a 'fatal' level log, if the configured level allows for it.
|
|
53
|
-
* Prints to `stdout` with newline.
|
|
54
|
-
*/
|
|
55
|
-
fatal(message: any, context?: string): void;
|
|
56
|
-
fatal(message: any, ...optionalParams: [...any, string?]): void;
|
|
57
|
-
/**
|
|
58
|
-
* Set log levels
|
|
59
|
-
* @param levels log levels
|
|
60
|
-
*/
|
|
61
|
-
setLogLevels(levels: LogLevel[]): void;
|
|
62
|
-
/**
|
|
63
|
-
* Set logger context
|
|
64
|
-
* @param context context
|
|
65
|
-
*/
|
|
66
|
-
setContext(context: string): void;
|
|
67
|
-
/**
|
|
68
|
-
* Resets the logger context to the value that was passed in the constructor.
|
|
69
|
-
*/
|
|
70
|
-
resetContext(): void;
|
|
71
|
-
isLevelEnabled(level: LogLevel): boolean;
|
|
72
|
-
protected getTimestamp(): string;
|
|
73
|
-
protected printMessages(messages: unknown[], context?: string, logLevel?: LogLevel, writeStreamType?: "stdout" | "stderr"): void;
|
|
74
|
-
protected formatPid(pid: number): string;
|
|
75
|
-
protected formatContext(context: string): string;
|
|
76
|
-
protected formatMessage(logLevel: LogLevel, message: unknown, pidMessage: string, formattedLogLevel: string, contextMessage: string, timestampDiff: string): string;
|
|
77
|
-
protected stringifyMessage(message: unknown, logLevel: LogLevel): string;
|
|
78
|
-
protected colorize(message: string, logLevel: LogLevel): string;
|
|
79
|
-
protected printStackTrace(stack: string): void;
|
|
80
|
-
protected updateAndGetTimestampDiff(): string;
|
|
81
|
-
protected formatTimestampDiff(timestampDiff: number): string;
|
|
82
|
-
private getContextAndMessagesToPrint;
|
|
83
|
-
private getContextAndStackAndMessagesToPrint;
|
|
84
|
-
private isStackFormat;
|
|
85
|
-
private getColorByLogLevel;
|
|
86
|
-
}
|
|
@@ -1,233 +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 ConsoleLogger_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.ConsoleLogger = void 0;
|
|
17
|
-
const logger_service_1 = require("@venok/core/services/logger.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 color_helper_1 = require("@venok/core/helpers/color.helper");
|
|
21
|
-
const shared_helper_1 = require("@venok/core/helpers/shared.helper");
|
|
22
|
-
const DEFAULT_LOG_LEVELS = ["log", "error", "warn", "debug", "verbose", "fatal"];
|
|
23
|
-
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
|
|
24
|
-
year: "numeric",
|
|
25
|
-
hour: "numeric",
|
|
26
|
-
minute: "numeric",
|
|
27
|
-
second: "numeric",
|
|
28
|
-
day: "2-digit",
|
|
29
|
-
month: "2-digit",
|
|
30
|
-
});
|
|
31
|
-
let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
32
|
-
constructor(context, options = {}) {
|
|
33
|
-
this.context = context;
|
|
34
|
-
this.options = options;
|
|
35
|
-
if (!options.logLevels) {
|
|
36
|
-
options.logLevels = DEFAULT_LOG_LEVELS;
|
|
37
|
-
}
|
|
38
|
-
if (context) {
|
|
39
|
-
this.originalContext = context;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
log(message, ...optionalParams) {
|
|
43
|
-
if (!this.isLevelEnabled("log")) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const { messages, context } = this.getContextAndMessagesToPrint([message, ...optionalParams]);
|
|
47
|
-
this.printMessages(messages, context, "log");
|
|
48
|
-
}
|
|
49
|
-
error(message, ...optionalParams) {
|
|
50
|
-
if (!this.isLevelEnabled("error")) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const { messages, context, stack } = this.getContextAndStackAndMessagesToPrint([message, ...optionalParams]);
|
|
54
|
-
this.printMessages(messages, context, "error", "stderr");
|
|
55
|
-
if ((0, shared_helper_1.isUndefined)(stack))
|
|
56
|
-
return false;
|
|
57
|
-
this.printStackTrace(stack);
|
|
58
|
-
}
|
|
59
|
-
warn(message, ...optionalParams) {
|
|
60
|
-
if (!this.isLevelEnabled("warn")) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const { messages, context } = this.getContextAndMessagesToPrint([message, ...optionalParams]);
|
|
64
|
-
this.printMessages(messages, context, "warn");
|
|
65
|
-
}
|
|
66
|
-
debug(message, ...optionalParams) {
|
|
67
|
-
if (!this.isLevelEnabled("debug")) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const { messages, context } = this.getContextAndMessagesToPrint([message, ...optionalParams]);
|
|
71
|
-
this.printMessages(messages, context, "debug");
|
|
72
|
-
}
|
|
73
|
-
verbose(message, ...optionalParams) {
|
|
74
|
-
if (!this.isLevelEnabled("verbose")) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const { messages, context } = this.getContextAndMessagesToPrint([message, ...optionalParams]);
|
|
78
|
-
this.printMessages(messages, context, "verbose");
|
|
79
|
-
}
|
|
80
|
-
fatal(message, ...optionalParams) {
|
|
81
|
-
if (!this.isLevelEnabled("fatal")) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const { messages, context } = this.getContextAndMessagesToPrint([message, ...optionalParams]);
|
|
85
|
-
this.printMessages(messages, context, "fatal");
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Set log levels
|
|
89
|
-
* @param levels log levels
|
|
90
|
-
*/
|
|
91
|
-
setLogLevels(levels) {
|
|
92
|
-
if (!this.options) {
|
|
93
|
-
this.options = {};
|
|
94
|
-
}
|
|
95
|
-
this.options.logLevels = levels;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Set logger context
|
|
99
|
-
* @param context context
|
|
100
|
-
*/
|
|
101
|
-
setContext(context) {
|
|
102
|
-
this.context = context;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Resets the logger context to the value that was passed in the constructor.
|
|
106
|
-
*/
|
|
107
|
-
resetContext() {
|
|
108
|
-
this.context = this.originalContext;
|
|
109
|
-
}
|
|
110
|
-
isLevelEnabled(level) {
|
|
111
|
-
const logLevels = this.options?.logLevels;
|
|
112
|
-
return (0, logger_service_1.isLogLevelEnabled)(level, logLevels);
|
|
113
|
-
}
|
|
114
|
-
getTimestamp() {
|
|
115
|
-
return dateTimeFormatter.format(Date.now());
|
|
116
|
-
}
|
|
117
|
-
printMessages(messages, context = "", logLevel = "log", writeStreamType) {
|
|
118
|
-
messages.forEach((message) => {
|
|
119
|
-
const pidMessage = this.formatPid(process.pid);
|
|
120
|
-
const contextMessage = this.formatContext(context);
|
|
121
|
-
const timestampDiff = this.updateAndGetTimestampDiff();
|
|
122
|
-
const formattedLogLevel = logLevel.toUpperCase().padStart(7, " ");
|
|
123
|
-
const formattedMessage = this.formatMessage(logLevel, message, pidMessage, formattedLogLevel, contextMessage, timestampDiff);
|
|
124
|
-
process[writeStreamType ?? "stdout"].write(formattedMessage);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
formatPid(pid) {
|
|
128
|
-
return `[Venok] ${pid} - `;
|
|
129
|
-
}
|
|
130
|
-
formatContext(context) {
|
|
131
|
-
return context ? (0, color_helper_1.yellow)(`[${context}] `) : "";
|
|
132
|
-
}
|
|
133
|
-
formatMessage(logLevel, message, pidMessage, formattedLogLevel, contextMessage, timestampDiff) {
|
|
134
|
-
const output = this.stringifyMessage(message, logLevel);
|
|
135
|
-
pidMessage = this.colorize(pidMessage, logLevel);
|
|
136
|
-
formattedLogLevel = this.colorize(formattedLogLevel, logLevel);
|
|
137
|
-
return `${pidMessage}${this.getTimestamp()} ${formattedLogLevel} ${contextMessage}${output}${timestampDiff}\n`;
|
|
138
|
-
}
|
|
139
|
-
stringifyMessage(message, logLevel) {
|
|
140
|
-
// If the message is a function, call it and re-resolve its value.
|
|
141
|
-
return (0, shared_helper_1.isFunction)(message)
|
|
142
|
-
? this.stringifyMessage(message(), logLevel)
|
|
143
|
-
: (0, shared_helper_1.isPlainObject)(message) || Array.isArray(message)
|
|
144
|
-
? `${this.colorize("Object:", logLevel)}\n${JSON.stringify(message, (key, value) => (typeof value === "bigint" ? value.toString() : value), 2)}\n`
|
|
145
|
-
: this.colorize(message, logLevel);
|
|
146
|
-
}
|
|
147
|
-
colorize(message, logLevel) {
|
|
148
|
-
const color = this.getColorByLogLevel(logLevel);
|
|
149
|
-
return color(message);
|
|
150
|
-
}
|
|
151
|
-
printStackTrace(stack) {
|
|
152
|
-
if (!stack)
|
|
153
|
-
return;
|
|
154
|
-
process.stderr.write(`${stack}\n`);
|
|
155
|
-
}
|
|
156
|
-
updateAndGetTimestampDiff() {
|
|
157
|
-
const includeTimestamp = ConsoleLogger_1.lastTimestampAt && this.options?.timestamp;
|
|
158
|
-
const ts = typeof ConsoleLogger_1.lastTimestampAt !== "undefined" ? ConsoleLogger_1.lastTimestampAt : 0;
|
|
159
|
-
const result = includeTimestamp ? this.formatTimestampDiff(Date.now() - ts) : "";
|
|
160
|
-
ConsoleLogger_1.lastTimestampAt = Date.now();
|
|
161
|
-
return result;
|
|
162
|
-
}
|
|
163
|
-
formatTimestampDiff(timestampDiff) {
|
|
164
|
-
return (0, color_helper_1.yellow)(` +${timestampDiff}ms`);
|
|
165
|
-
}
|
|
166
|
-
getContextAndMessagesToPrint(args) {
|
|
167
|
-
if (args?.length <= 1)
|
|
168
|
-
return { messages: args, context: this.context };
|
|
169
|
-
const lastElement = args[args.length - 1];
|
|
170
|
-
const isContext = (0, shared_helper_1.isString)(lastElement);
|
|
171
|
-
if (!isContext)
|
|
172
|
-
return { messages: args, context: this.context };
|
|
173
|
-
return {
|
|
174
|
-
context: lastElement,
|
|
175
|
-
messages: args.slice(0, args.length - 1),
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
getContextAndStackAndMessagesToPrint(args) {
|
|
179
|
-
if (args.length === 2) {
|
|
180
|
-
return this.isStackFormat(args[1])
|
|
181
|
-
? {
|
|
182
|
-
messages: [args[0]],
|
|
183
|
-
stack: args[1],
|
|
184
|
-
context: this.context,
|
|
185
|
-
}
|
|
186
|
-
: {
|
|
187
|
-
messages: [args[0]],
|
|
188
|
-
context: args[1],
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
const { messages, context } = this.getContextAndMessagesToPrint(args);
|
|
192
|
-
if (messages?.length <= 1)
|
|
193
|
-
return { messages, context };
|
|
194
|
-
const lastElement = messages[messages.length - 1];
|
|
195
|
-
const isStack = (0, shared_helper_1.isString)(lastElement);
|
|
196
|
-
// https://github.com/nestjs/nest/issues/11074#issuecomment-1421680060
|
|
197
|
-
if (!isStack && !(0, shared_helper_1.isUndefined)(lastElement))
|
|
198
|
-
return { messages, context };
|
|
199
|
-
return {
|
|
200
|
-
stack: lastElement,
|
|
201
|
-
messages: messages.slice(0, messages.length - 1),
|
|
202
|
-
context,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
isStackFormat(stack) {
|
|
206
|
-
if (!(0, shared_helper_1.isString)(stack))
|
|
207
|
-
return false;
|
|
208
|
-
return /^(.)+\n\s+at .+:\d+:\d+$/.test(stack);
|
|
209
|
-
}
|
|
210
|
-
getColorByLogLevel(level) {
|
|
211
|
-
switch (level) {
|
|
212
|
-
case "debug":
|
|
213
|
-
return color_helper_1.colors.magentaBright;
|
|
214
|
-
case "warn":
|
|
215
|
-
return color_helper_1.colors.yellow;
|
|
216
|
-
case "error":
|
|
217
|
-
return color_helper_1.colors.red;
|
|
218
|
-
case "verbose":
|
|
219
|
-
return color_helper_1.colors.cyanBright;
|
|
220
|
-
case "fatal":
|
|
221
|
-
return color_helper_1.colors.bold;
|
|
222
|
-
default:
|
|
223
|
-
return color_helper_1.colors.green;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
exports.ConsoleLogger = ConsoleLogger;
|
|
228
|
-
exports.ConsoleLogger = ConsoleLogger = ConsoleLogger_1 = __decorate([
|
|
229
|
-
(0, injectable_decorator_1.Injectable)(),
|
|
230
|
-
__param(0, (0, optional_decorator_1.Optional)()),
|
|
231
|
-
__param(1, (0, optional_decorator_1.Optional)()),
|
|
232
|
-
__metadata("design:paramtypes", [String, Object])
|
|
233
|
-
], ConsoleLogger);
|
package/services/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./reflector.service";
|
package/services/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./reflector.service"), exports);
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @publicApi
|
|
3
|
-
*/
|
|
4
|
-
export type LogLevel = "log" | "error" | "warn" | "debug" | "verbose" | "fatal";
|
|
5
|
-
/**
|
|
6
|
-
* Checks if target level is enabled.
|
|
7
|
-
* @param targetLevel target level
|
|
8
|
-
* @param logLevels array of enabled log levels
|
|
9
|
-
*/
|
|
10
|
-
export declare function isLogLevelEnabled(targetLevel: LogLevel, logLevels: LogLevel[] | undefined): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* @publicApi
|
|
13
|
-
*/
|
|
14
|
-
export interface LoggerService {
|
|
15
|
-
/**
|
|
16
|
-
* Write a 'log' level log.
|
|
17
|
-
*/
|
|
18
|
-
log(message: any, ...optionalParams: any[]): any;
|
|
19
|
-
/**
|
|
20
|
-
* Write an 'error' level log.
|
|
21
|
-
*/
|
|
22
|
-
error(message: any, ...optionalParams: any[]): any;
|
|
23
|
-
/**
|
|
24
|
-
* Write a 'warn' level log.
|
|
25
|
-
*/
|
|
26
|
-
warn(message: any, ...optionalParams: any[]): any;
|
|
27
|
-
/**
|
|
28
|
-
* Write a 'debug' level log.
|
|
29
|
-
*/
|
|
30
|
-
debug?(message: any, ...optionalParams: any[]): any;
|
|
31
|
-
/**
|
|
32
|
-
* Write a 'verbose' level log.
|
|
33
|
-
*/
|
|
34
|
-
verbose?(message: any, ...optionalParams: any[]): any;
|
|
35
|
-
/**
|
|
36
|
-
* Write a 'fatal' level log.
|
|
37
|
-
*/
|
|
38
|
-
fatal?(message: any, ...optionalParams: any[]): any;
|
|
39
|
-
/**
|
|
40
|
-
* Set log levels.
|
|
41
|
-
* @param levels log levels
|
|
42
|
-
*/
|
|
43
|
-
setLogLevels?(levels: LogLevel[]): any;
|
|
44
|
-
}
|
|
45
|
-
interface LogBufferRecord {
|
|
46
|
-
/**
|
|
47
|
-
* Method to execute.
|
|
48
|
-
*/
|
|
49
|
-
methodRef: Function;
|
|
50
|
-
/**
|
|
51
|
-
* Arguments to pass to the method.
|
|
52
|
-
*/
|
|
53
|
-
arguments: unknown[];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* @publicApi
|
|
57
|
-
*/
|
|
58
|
-
export declare class Logger implements LoggerService {
|
|
59
|
-
protected context?: string | undefined;
|
|
60
|
-
protected options: {
|
|
61
|
-
timestamp?: boolean;
|
|
62
|
-
};
|
|
63
|
-
protected static logBuffer: LogBufferRecord[];
|
|
64
|
-
protected static staticInstanceRef: LoggerService;
|
|
65
|
-
protected static logLevels?: LogLevel[];
|
|
66
|
-
private static isBufferAttached;
|
|
67
|
-
protected localInstanceRef?: LoggerService;
|
|
68
|
-
private static WrapBuffer;
|
|
69
|
-
constructor();
|
|
70
|
-
constructor(context: string);
|
|
71
|
-
constructor(context: string, options?: {
|
|
72
|
-
timestamp?: boolean;
|
|
73
|
-
});
|
|
74
|
-
get localInstance(): LoggerService;
|
|
75
|
-
/**
|
|
76
|
-
* Write an 'error' level log.
|
|
77
|
-
*/
|
|
78
|
-
error(message: any, stack?: string, context?: string): void;
|
|
79
|
-
error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
|
80
|
-
/**
|
|
81
|
-
* Write a 'log' level log.
|
|
82
|
-
*/
|
|
83
|
-
log(message: any, context?: string): void;
|
|
84
|
-
log(message: any, ...optionalParams: [...any, string?]): void;
|
|
85
|
-
/**
|
|
86
|
-
* Write a 'warn' level log.
|
|
87
|
-
*/
|
|
88
|
-
warn(message: any, context?: string): void;
|
|
89
|
-
warn(message: any, ...optionalParams: [...any, string?]): void;
|
|
90
|
-
/**
|
|
91
|
-
* Write a 'debug' level log.
|
|
92
|
-
*/
|
|
93
|
-
debug(message: any, context?: string): void;
|
|
94
|
-
debug(message: any, ...optionalParams: [...any, string?]): void;
|
|
95
|
-
/**
|
|
96
|
-
* Write a 'verbose' level log.
|
|
97
|
-
*/
|
|
98
|
-
verbose(message: any, context?: string): void;
|
|
99
|
-
verbose(message: any, ...optionalParams: [...any, string?]): void;
|
|
100
|
-
/**
|
|
101
|
-
* Write a 'fatal' level log.
|
|
102
|
-
*/
|
|
103
|
-
fatal(message: any, context?: string): void;
|
|
104
|
-
fatal(message: any, ...optionalParams: [...any, string?]): void;
|
|
105
|
-
/**
|
|
106
|
-
* Write an 'error' level log.
|
|
107
|
-
*/
|
|
108
|
-
static error(message: any, stackOrContext?: string): void;
|
|
109
|
-
static error(message: any, context?: string): void;
|
|
110
|
-
static error(message: any, stack?: string, context?: string): void;
|
|
111
|
-
static error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
|
112
|
-
/**
|
|
113
|
-
* Write a 'log' level log.
|
|
114
|
-
*/
|
|
115
|
-
static log(message: any, context?: string): void;
|
|
116
|
-
static log(message: any, ...optionalParams: [...any, string?]): void;
|
|
117
|
-
/**
|
|
118
|
-
* Write a 'warn' level log.
|
|
119
|
-
*/
|
|
120
|
-
static warn(message: any, context?: string): void;
|
|
121
|
-
static warn(message: any, ...optionalParams: [...any, string?]): void;
|
|
122
|
-
/**
|
|
123
|
-
* Write a 'debug' level log, if the configured level allows for it.
|
|
124
|
-
* Prints to `stdout` with newline.
|
|
125
|
-
*/
|
|
126
|
-
static debug(message: any, context?: string): void;
|
|
127
|
-
static debug(message: any, ...optionalParams: [...any, string?]): void;
|
|
128
|
-
/**
|
|
129
|
-
* Write a 'verbose' level log.
|
|
130
|
-
*/
|
|
131
|
-
static verbose(message: any, context?: string): void;
|
|
132
|
-
static verbose(message: any, ...optionalParams: [...any, string?]): void;
|
|
133
|
-
/**
|
|
134
|
-
* Write a 'fatal' level log.
|
|
135
|
-
*/
|
|
136
|
-
static fatal(message: any, context?: string): void;
|
|
137
|
-
static fatal(message: any, ...optionalParams: [...any, string?]): void;
|
|
138
|
-
/**
|
|
139
|
-
* Print buffered logs and detach buffer.
|
|
140
|
-
*/
|
|
141
|
-
static flush(): void;
|
|
142
|
-
/**
|
|
143
|
-
* Attach buffer.
|
|
144
|
-
* Turns on initialization logs buffering.
|
|
145
|
-
*/
|
|
146
|
-
static attachBuffer(): void;
|
|
147
|
-
/**
|
|
148
|
-
* Detach buffer.
|
|
149
|
-
* Turns off initialization logs buffering.
|
|
150
|
-
*/
|
|
151
|
-
static detachBuffer(): void;
|
|
152
|
-
static getTimestamp(): string;
|
|
153
|
-
static overrideLogger(logger: LoggerService | LogLevel[] | boolean): any;
|
|
154
|
-
static isLevelEnabled(level: LogLevel): boolean;
|
|
155
|
-
private registerLocalInstanceRef;
|
|
156
|
-
}
|
|
157
|
-
export {};
|