@zudojs/core 0.1.0 → 1.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/LICENSE +21 -0
- package/README.md +141 -7
- package/dist/application/application.d.ts +43 -2
- package/dist/application/application.js +111 -13
- package/dist/application/applicationContext.context.d.ts +15 -0
- package/dist/application/applicationContext.context.js +12 -0
- package/dist/application/createApplication.d.ts +78 -0
- package/dist/application/createApplication.js +104 -0
- package/dist/application/index.d.ts +2 -1
- package/dist/application/index.js +2 -1
- package/dist/configuration/configurationManager.manager.d.ts +32 -0
- package/dist/configuration/configurationManager.manager.js +86 -7
- package/dist/configuration/core/configuration.d.ts +60 -15
- package/dist/configuration/core/configuration.js +248 -51
- package/dist/configuration/core/configurationKey.key.d.ts +4 -2
- package/dist/configuration/core/configurationKey.key.js +2 -13
- package/dist/configuration/core/configurationPath.path.d.ts +17 -0
- package/dist/configuration/core/configurationPath.path.js +33 -0
- package/dist/configuration/core/index.d.ts +7 -1
- package/dist/configuration/core/index.js +1 -0
- package/dist/configuration/error/configurationError.error.d.ts +11 -0
- package/dist/configuration/error/configurationError.error.js +29 -1
- package/dist/configuration/error/configurationRedactor.redactor.d.ts +16 -0
- package/dist/configuration/error/configurationRedactor.redactor.js +83 -5
- package/dist/configuration/error/index.d.ts +2 -1
- package/dist/configuration/error/index.js +2 -1
- package/dist/configuration/index.d.ts +1 -1
- package/dist/configuration/loader/configurationLoader.loader.d.ts +47 -9
- package/dist/configuration/loader/configurationLoader.loader.js +107 -26
- package/dist/configuration/loader/index.d.ts +1 -1
- package/dist/configuration/loader/index.js +1 -1
- package/dist/configuration/registry/configurationProvider.provider.d.ts +26 -1
- package/dist/configuration/registry/configurationProvider.provider.js +33 -7
- package/dist/configuration/registry/configurationRegistry.registry.js +2 -1
- package/dist/configuration/schema/configurationSchema.schema.d.ts +0 -4
- package/dist/configuration/schema/configurationSchema.schema.js +11 -32
- package/dist/configuration/schema/configurationValidation.validator.d.ts +14 -2
- package/dist/configuration/schema/configurationValidation.validator.js +55 -7
- package/dist/configuration/schema/index.d.ts +1 -1
- package/dist/configuration/schema/index.js +1 -1
- package/dist/container/container.d.ts +52 -5
- package/dist/container/container.js +110 -33
- package/dist/container/index.d.ts +1 -1
- package/dist/container/index.js +1 -1
- package/dist/container/scope.d.ts +7 -6
- package/dist/context/core/contextAliases.deprecated.d.ts +32 -0
- package/dist/context/core/contextAliases.deprecated.js +6 -0
- package/dist/context/core/executionContext.context.d.ts +8 -0
- package/dist/context/core/executionContext.context.js +38 -15
- package/dist/context/core/index.d.ts +2 -2
- package/dist/context/core/index.js +2 -2
- package/dist/context/index.d.ts +20 -0
- package/dist/context/index.js +20 -0
- package/dist/context/provider/contextProvider.provider.d.ts +7 -4
- package/dist/context/provider/contextProvider.provider.js +9 -6
- package/dist/context/provider/contextStorage.storage.d.ts +47 -7
- package/dist/context/provider/contextStorage.storage.js +54 -12
- package/dist/context/provider/defaultContextStorage.storage.d.ts +18 -0
- package/dist/context/provider/defaultContextStorage.storage.js +20 -0
- package/dist/context/provider/index.d.ts +2 -1
- package/dist/context/provider/index.js +1 -0
- package/dist/errors/exceptions.d.ts +22 -0
- package/dist/errors/exceptions.js +38 -1
- package/dist/errors/frameworkError.error.d.ts +6 -9
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +14 -0
- package/dist/lifecycle/core/index.d.ts +1 -1
- package/dist/lifecycle/core/index.js +1 -1
- package/dist/lifecycle/core/lifecycle.d.ts +47 -2
- package/dist/lifecycle/core/lifecycle.js +251 -85
- package/dist/lifecycle/core/lifecycleRegistry.registry.d.ts +8 -0
- package/dist/lifecycle/core/lifecycleRegistry.registry.js +20 -1
- package/dist/lifecycle/manager/lifecycleManager.manager.d.ts +21 -2
- package/dist/lifecycle/manager/lifecycleManager.manager.js +62 -99
- package/dist/lifecycle/scope/lifecycleScope.scope.d.ts +22 -1
- package/dist/lifecycle/scope/lifecycleScope.scope.js +85 -17
- package/dist/logging/console/consoleLogger.logger.d.ts +20 -1
- package/dist/logging/console/consoleLogger.logger.js +77 -11
- package/dist/logging/console/loggerFactory.factory.d.ts +6 -5
- package/dist/logging/console/loggerFactory.factory.js +1 -7
- package/dist/logging/core/index.d.ts +4 -3
- package/dist/logging/core/index.js +4 -3
- package/dist/logging/core/logEntry.entry.d.ts +41 -3
- package/dist/logging/core/logEntry.entry.js +114 -4
- package/dist/logging/core/logLevel.level.d.ts +18 -0
- package/dist/logging/core/logLevel.level.js +25 -1
- package/dist/logging/core/logRedaction.redaction.d.ts +38 -0
- package/dist/logging/core/logRedaction.redaction.js +19 -0
- package/dist/logging/core/logger.d.ts +14 -11
- package/dist/logging/core/logger.js +31 -6
- package/dist/logging/core/loggerContext.context.d.ts +12 -0
- package/dist/logging/core/loggerContext.context.js +19 -0
- package/dist/logging/core/loggerOptions.options.d.ts +17 -0
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -6
- package/dist/modules/module.d.ts +7 -1
- package/dist/modules/moduleContext.context.d.ts +41 -7
- package/dist/modules/moduleContext.context.js +31 -8
- package/dist/modules/moduleDefinition.definition.d.ts +11 -7
- package/dist/modules/moduleDefinition.definition.js +41 -8
- package/dist/modules/moduleDependency/index.d.ts +2 -2
- package/dist/modules/moduleDependency/index.js +1 -1
- package/dist/modules/moduleDependency/moduleDependency.graph.d.ts +19 -2
- package/dist/modules/moduleDependency/moduleDependency.graph.js +122 -8
- package/dist/modules/moduleDependency/moduleDependency.ordering.d.ts +8 -0
- package/dist/modules/moduleDependency/moduleDependency.ordering.js +85 -57
- package/dist/modules/moduleDependency/moduleDependency.type.d.ts +28 -1
- package/dist/modules/moduleError/index.d.ts +1 -1
- package/dist/modules/moduleError/index.js +1 -1
- package/dist/modules/moduleError/moduleError.dependency.d.ts +11 -0
- package/dist/modules/moduleError/moduleError.dependency.js +15 -0
- package/dist/modules/moduleLifecycle/index.d.ts +5 -2
- package/dist/modules/moduleLifecycle/index.js +4 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.d.ts +44 -6
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.js +153 -9
- package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.d.ts +30 -5
- package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.js +130 -10
- package/dist/modules/moduleLifecycle/moduleLifecycle.type.d.ts +65 -28
- package/dist/modules/moduleLifecycle/moduleLifecycle.type.js +15 -4
- package/dist/modules/moduleLoader/moduleLoader.loader.d.ts +39 -5
- package/dist/modules/moduleLoader/moduleLoader.loader.js +123 -50
- package/dist/modules/moduleLoader/moduleLoader.type.d.ts +4 -2
- package/dist/modules/moduleLoader/moduleLoader.type.js +10 -3
- package/dist/modules/moduleMetadata.metadata.js +15 -5
- package/dist/modules/moduleRegistry/index.d.ts +1 -1
- package/dist/modules/moduleRegistry/moduleRegistry.registry.d.ts +2 -2
- package/dist/modules/moduleRegistry/moduleRegistry.registry.js +38 -6
- package/dist/modules/moduleRegistry/moduleRegistry.type.d.ts +18 -1
- package/dist/runtime/index.d.ts +17 -15
- package/dist/runtime/index.js +14 -10
- package/dist/runtime/runtime.d.ts +135 -33
- package/dist/runtime/runtime.js +344 -114
- package/dist/runtime/runtimeBootstrap/index.d.ts +2 -1
- package/dist/runtime/runtimeBootstrap/index.js +1 -1
- package/dist/runtime/runtimeBootstrap/pipeline/index.d.ts +2 -2
- package/dist/runtime/runtimeBootstrap/pipeline/index.js +1 -2
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.d.ts +41 -15
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.js +98 -76
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.d.ts +7 -4
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.js +87 -59
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.type.d.ts +10 -4
- package/dist/runtime/runtimeContext/index.d.ts +3 -5
- package/dist/runtime/runtimeContext/index.js +2 -4
- package/dist/runtime/runtimeContext/runtimeContext.factory.d.ts +10 -4
- package/dist/runtime/runtimeContext/runtimeContext.factory.js +30 -7
- package/dist/runtime/runtimeContext/runtimeContext.type.d.ts +36 -47
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.d.ts +5 -0
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.js +6 -4
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.d.ts +4 -0
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.js +7 -9
- package/dist/runtime/runtimeEnvironment/index.d.ts +2 -2
- package/dist/runtime/runtimeEnvironment/index.js +1 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.d.ts +20 -17
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.js +20 -13
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.type.d.ts +12 -1
- package/dist/runtime/runtimeError/index.d.ts +3 -3
- package/dist/runtime/runtimeError/index.js +1 -1
- package/dist/runtime/runtimeError/runtimeError.base.d.ts +15 -18
- package/dist/runtime/runtimeError/runtimeError.base.js +38 -36
- package/dist/runtime/runtimeError/runtimeError.lifecycle.d.ts +23 -8
- package/dist/runtime/runtimeError/runtimeError.lifecycle.js +31 -7
- package/dist/runtime/runtimeError/runtimeError.specialized.d.ts +1 -1
- package/dist/runtime/runtimeError/runtimeError.specialized.js +1 -1
- package/dist/runtime/runtimeError/runtimeError.type.d.ts +5 -9
- package/dist/runtime/runtimeLogger.d.ts +2 -2
- package/dist/runtime/runtimeLogger.js +3 -3
- package/dist/runtime/runtimeOptions/index.d.ts +1 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.defaults.d.ts +1 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.defaults.js +2 -0
- package/dist/runtime/runtimeOptions/runtimeOptions.resolver.js +5 -2
- package/dist/runtime/runtimeOptions/runtimeOptions.type.d.ts +45 -16
- package/dist/runtime/runtimeOptions/runtimeOptions.validation.js +0 -1
- package/dist/runtime/runtimeShutdown/index.d.ts +3 -2
- package/dist/runtime/runtimeShutdown/index.js +2 -2
- package/dist/runtime/runtimeShutdown/pipeline/index.d.ts +2 -1
- package/dist/runtime/runtimeShutdown/pipeline/index.js +1 -1
- package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.d.ts +37 -7
- package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.js +77 -51
- package/dist/runtime/runtimeShutdown/runtimeShutdown.core.d.ts +8 -16
- package/dist/runtime/runtimeShutdown/runtimeShutdown.core.js +85 -87
- package/dist/runtime/runtimeShutdown/runtimeShutdown.type.d.ts +9 -5
- package/dist/runtime/runtimeSignals/index.d.ts +8 -0
- package/dist/runtime/runtimeSignals/index.js +7 -0
- package/dist/runtime/runtimeSignals/runtimeSignals.d.ts +93 -0
- package/dist/runtime/runtimeSignals/runtimeSignals.js +149 -0
- package/dist/runtime/runtimeState.state.d.ts +32 -14
- package/dist/runtime/runtimeState.state.js +34 -27
- package/dist/runtime/runtimeTimeout.d.ts +40 -0
- package/dist/runtime/runtimeTimeout.js +42 -0
- package/package.json +21 -15
- package/dist/.tsbuildinfo +0 -1
- package/dist/application/application.d.ts.map +0 -1
- package/dist/application/application.js.map +0 -1
- package/dist/application/applicationContext.context.d.ts.map +0 -1
- package/dist/application/applicationContext.context.js.map +0 -1
- package/dist/application/applicationState.state.d.ts.map +0 -1
- package/dist/application/applicationState.state.js.map +0 -1
- package/dist/application/index.d.ts.map +0 -1
- package/dist/application/index.js.map +0 -1
- package/dist/configuration/configurationManager.manager.d.ts.map +0 -1
- package/dist/configuration/configurationManager.manager.js.map +0 -1
- package/dist/configuration/core/configuration.d.ts.map +0 -1
- package/dist/configuration/core/configuration.js.map +0 -1
- package/dist/configuration/core/configurationKey.key.d.ts.map +0 -1
- package/dist/configuration/core/configurationKey.key.js.map +0 -1
- package/dist/configuration/core/configurationSource.source.d.ts.map +0 -1
- package/dist/configuration/core/configurationSource.source.js.map +0 -1
- package/dist/configuration/core/index.d.ts.map +0 -1
- package/dist/configuration/core/index.js.map +0 -1
- package/dist/configuration/error/configurationError.error.d.ts.map +0 -1
- package/dist/configuration/error/configurationError.error.js.map +0 -1
- package/dist/configuration/error/configurationRedactor.redactor.d.ts.map +0 -1
- package/dist/configuration/error/configurationRedactor.redactor.js.map +0 -1
- package/dist/configuration/error/index.d.ts.map +0 -1
- package/dist/configuration/error/index.js.map +0 -1
- package/dist/configuration/events/configurationEvents.events.d.ts.map +0 -1
- package/dist/configuration/events/configurationEvents.events.js.map +0 -1
- package/dist/configuration/events/index.d.ts.map +0 -1
- package/dist/configuration/events/index.js.map +0 -1
- package/dist/configuration/index.d.ts.map +0 -1
- package/dist/configuration/index.js.map +0 -1
- package/dist/configuration/loader/configurationLoader.loader.d.ts.map +0 -1
- package/dist/configuration/loader/configurationLoader.loader.js.map +0 -1
- package/dist/configuration/loader/index.d.ts.map +0 -1
- package/dist/configuration/loader/index.js.map +0 -1
- package/dist/configuration/registry/configurationProvider.provider.d.ts.map +0 -1
- package/dist/configuration/registry/configurationProvider.provider.js.map +0 -1
- package/dist/configuration/registry/configurationRegistry.registry.d.ts.map +0 -1
- package/dist/configuration/registry/configurationRegistry.registry.js.map +0 -1
- package/dist/configuration/registry/index.d.ts.map +0 -1
- package/dist/configuration/registry/index.js.map +0 -1
- package/dist/configuration/schema/configurationSchema.schema.d.ts.map +0 -1
- package/dist/configuration/schema/configurationSchema.schema.js.map +0 -1
- package/dist/configuration/schema/configurationValidation.validator.d.ts.map +0 -1
- package/dist/configuration/schema/configurationValidation.validator.js.map +0 -1
- package/dist/configuration/schema/index.d.ts.map +0 -1
- package/dist/configuration/schema/index.js.map +0 -1
- package/dist/container/container.d.ts.map +0 -1
- package/dist/container/container.js.map +0 -1
- package/dist/container/index.d.ts.map +0 -1
- package/dist/container/index.js.map +0 -1
- package/dist/container/provider.d.ts.map +0 -1
- package/dist/container/provider.js.map +0 -1
- package/dist/container/scope.d.ts.map +0 -1
- package/dist/container/scope.js.map +0 -1
- package/dist/container/token.d.ts.map +0 -1
- package/dist/container/token.js.map +0 -1
- package/dist/context/core/context.d.ts +0 -95
- package/dist/context/core/context.d.ts.map +0 -1
- package/dist/context/core/context.js +0 -103
- package/dist/context/core/context.js.map +0 -1
- package/dist/context/core/contextKey.key.d.ts.map +0 -1
- package/dist/context/core/contextKey.key.js.map +0 -1
- package/dist/context/core/executionContext.context.d.ts.map +0 -1
- package/dist/context/core/executionContext.context.js.map +0 -1
- package/dist/context/core/index.d.ts.map +0 -1
- package/dist/context/core/index.js.map +0 -1
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js.map +0 -1
- package/dist/context/provider/contextProvider.provider.d.ts.map +0 -1
- package/dist/context/provider/contextProvider.provider.js.map +0 -1
- package/dist/context/provider/contextStorage.storage.d.ts.map +0 -1
- package/dist/context/provider/contextStorage.storage.js.map +0 -1
- package/dist/context/provider/index.d.ts.map +0 -1
- package/dist/context/provider/index.js.map +0 -1
- package/dist/context/snapshot/contextSnapshot.snapshot.d.ts.map +0 -1
- package/dist/context/snapshot/contextSnapshot.snapshot.js.map +0 -1
- package/dist/context/snapshot/index.d.ts.map +0 -1
- package/dist/context/snapshot/index.js.map +0 -1
- package/dist/context/values/contextValues.values.d.ts.map +0 -1
- package/dist/context/values/contextValues.values.js.map +0 -1
- package/dist/context/values/index.d.ts.map +0 -1
- package/dist/context/values/index.js.map +0 -1
- package/dist/contracts/adapter.d.ts.map +0 -1
- package/dist/contracts/adapter.js.map +0 -1
- package/dist/contracts/disposable.d.ts.map +0 -1
- package/dist/contracts/disposable.js.map +0 -1
- package/dist/contracts/handler.d.ts.map +0 -1
- package/dist/contracts/handler.js.map +0 -1
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/errors/errorCode.code.d.ts.map +0 -1
- package/dist/errors/errorCode.code.js.map +0 -1
- package/dist/errors/exceptions.d.ts.map +0 -1
- package/dist/errors/exceptions.js.map +0 -1
- package/dist/errors/frameworkError.error.d.ts.map +0 -1
- package/dist/errors/frameworkError.error.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lifecycle/core/index.d.ts.map +0 -1
- package/dist/lifecycle/core/index.js.map +0 -1
- package/dist/lifecycle/core/lifecycle.d.ts.map +0 -1
- package/dist/lifecycle/core/lifecycle.js.map +0 -1
- package/dist/lifecycle/core/lifecycleHook.hook.d.ts.map +0 -1
- package/dist/lifecycle/core/lifecycleHook.hook.js.map +0 -1
- package/dist/lifecycle/core/lifecycleRegistry.registry.d.ts.map +0 -1
- package/dist/lifecycle/core/lifecycleRegistry.registry.js.map +0 -1
- package/dist/lifecycle/core/lifecycleState.state.d.ts +0 -2
- package/dist/lifecycle/core/lifecycleState.state.d.ts.map +0 -1
- package/dist/lifecycle/core/lifecycleState.state.js +0 -2
- package/dist/lifecycle/core/lifecycleState.state.js.map +0 -1
- package/dist/lifecycle/index.d.ts.map +0 -1
- package/dist/lifecycle/index.js.map +0 -1
- package/dist/lifecycle/manager/index.d.ts.map +0 -1
- package/dist/lifecycle/manager/index.js.map +0 -1
- package/dist/lifecycle/manager/lifecycleManager.manager.d.ts.map +0 -1
- package/dist/lifecycle/manager/lifecycleManager.manager.js.map +0 -1
- package/dist/lifecycle/scope/index.d.ts.map +0 -1
- package/dist/lifecycle/scope/index.js.map +0 -1
- package/dist/lifecycle/scope/lifecycleScope.scope.d.ts.map +0 -1
- package/dist/lifecycle/scope/lifecycleScope.scope.js.map +0 -1
- package/dist/logging/console/consoleLogger.logger.d.ts.map +0 -1
- package/dist/logging/console/consoleLogger.logger.js.map +0 -1
- package/dist/logging/console/index.d.ts.map +0 -1
- package/dist/logging/console/index.js.map +0 -1
- package/dist/logging/console/loggerFactory.factory.d.ts.map +0 -1
- package/dist/logging/console/loggerFactory.factory.js.map +0 -1
- package/dist/logging/core/index.d.ts.map +0 -1
- package/dist/logging/core/index.js.map +0 -1
- package/dist/logging/core/logEntry.entry.d.ts.map +0 -1
- package/dist/logging/core/logEntry.entry.js.map +0 -1
- package/dist/logging/core/logLevel.level.d.ts.map +0 -1
- package/dist/logging/core/logLevel.level.js.map +0 -1
- package/dist/logging/core/logger.d.ts.map +0 -1
- package/dist/logging/core/logger.js.map +0 -1
- package/dist/logging/core/loggerContext.context.d.ts.map +0 -1
- package/dist/logging/core/loggerContext.context.js.map +0 -1
- package/dist/logging/core/loggerOptions.options.d.ts.map +0 -1
- package/dist/logging/core/loggerOptions.options.js.map +0 -1
- package/dist/logging/index.d.ts.map +0 -1
- package/dist/logging/index.js.map +0 -1
- package/dist/modules/index.d.ts.map +0 -1
- package/dist/modules/index.js.map +0 -1
- package/dist/modules/module.d.ts.map +0 -1
- package/dist/modules/module.js.map +0 -1
- package/dist/modules/moduleContext.context.d.ts.map +0 -1
- package/dist/modules/moduleContext.context.js.map +0 -1
- package/dist/modules/moduleDefinition.definition.d.ts.map +0 -1
- package/dist/modules/moduleDefinition.definition.js.map +0 -1
- package/dist/modules/moduleDependency/index.d.ts.map +0 -1
- package/dist/modules/moduleDependency/index.js.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.graph.d.ts.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.graph.js.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.ordering.d.ts.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.ordering.js.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.type.d.ts.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.type.js.map +0 -1
- package/dist/modules/moduleError/index.d.ts.map +0 -1
- package/dist/modules/moduleError/index.js.map +0 -1
- package/dist/modules/moduleError/moduleError.base.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.base.js.map +0 -1
- package/dist/modules/moduleError/moduleError.dependency.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.dependency.js.map +0 -1
- package/dist/modules/moduleError/moduleError.helpers.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.helpers.js.map +0 -1
- package/dist/modules/moduleError/moduleError.lifecycle.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.lifecycle.js.map +0 -1
- package/dist/modules/moduleError/moduleError.registration.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.registration.js.map +0 -1
- package/dist/modules/moduleLifecycle/index.d.ts.map +0 -1
- package/dist/modules/moduleLifecycle/index.js.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.d.ts.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.js.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.d.ts.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.js.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.type.d.ts.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.type.js.map +0 -1
- package/dist/modules/moduleLoader/index.d.ts.map +0 -1
- package/dist/modules/moduleLoader/index.js.map +0 -1
- package/dist/modules/moduleLoader/moduleLoader.loader.d.ts.map +0 -1
- package/dist/modules/moduleLoader/moduleLoader.loader.js.map +0 -1
- package/dist/modules/moduleLoader/moduleLoader.type.d.ts.map +0 -1
- package/dist/modules/moduleLoader/moduleLoader.type.js.map +0 -1
- package/dist/modules/moduleMetadata.metadata.d.ts.map +0 -1
- package/dist/modules/moduleMetadata.metadata.js.map +0 -1
- package/dist/modules/moduleRegistry/index.d.ts.map +0 -1
- package/dist/modules/moduleRegistry/index.js.map +0 -1
- package/dist/modules/moduleRegistry/moduleRegistry.registry.d.ts.map +0 -1
- package/dist/modules/moduleRegistry/moduleRegistry.registry.js.map +0 -1
- package/dist/modules/moduleRegistry/moduleRegistry.type.d.ts.map +0 -1
- package/dist/modules/moduleRegistry/moduleRegistry.type.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/runtime.d.ts.map +0 -1
- package/dist/runtime/runtime.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/index.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/index.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/index.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/index.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.invoke.d.ts +0 -6
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.invoke.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.invoke.js +0 -27
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.invoke.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.type.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.type.js.map +0 -1
- package/dist/runtime/runtimeContext/index.d.ts.map +0 -1
- package/dist/runtime/runtimeContext/index.js.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.core.d.ts +0 -38
- package/dist/runtime/runtimeContext/runtimeContext.core.d.ts.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.core.js +0 -99
- package/dist/runtime/runtimeContext/runtimeContext.core.js.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.factory.d.ts.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.factory.js.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.type.d.ts.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.type.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/index.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/index.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.detection.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.detection.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/index.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/index.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.type.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.type.js.map +0 -1
- package/dist/runtime/runtimeError/index.d.ts.map +0 -1
- package/dist/runtime/runtimeError/index.js.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.base.d.ts.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.base.js.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.lifecycle.d.ts.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.lifecycle.js.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.specialized.d.ts.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.specialized.js.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.type.d.ts.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.type.js.map +0 -1
- package/dist/runtime/runtimeLogger.d.ts.map +0 -1
- package/dist/runtime/runtimeLogger.js.map +0 -1
- package/dist/runtime/runtimeManager/index.d.ts +0 -12
- package/dist/runtime/runtimeManager/index.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/index.js +0 -11
- package/dist/runtime/runtimeManager/index.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.core.d.ts +0 -31
- package/dist/runtime/runtimeManager/runtimeManager.core.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.core.js +0 -136
- package/dist/runtime/runtimeManager/runtimeManager.core.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.error.d.ts +0 -14
- package/dist/runtime/runtimeManager/runtimeManager.error.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.error.js +0 -21
- package/dist/runtime/runtimeManager/runtimeManager.error.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.factory.d.ts +0 -7
- package/dist/runtime/runtimeManager/runtimeManager.factory.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.factory.js +0 -8
- package/dist/runtime/runtimeManager/runtimeManager.factory.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.lifecycle.d.ts +0 -16
- package/dist/runtime/runtimeManager/runtimeManager.lifecycle.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.lifecycle.js +0 -49
- package/dist/runtime/runtimeManager/runtimeManager.lifecycle.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.type.d.ts +0 -54
- package/dist/runtime/runtimeManager/runtimeManager.type.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.type.js +0 -2
- package/dist/runtime/runtimeManager/runtimeManager.type.js.map +0 -1
- package/dist/runtime/runtimeOptions/index.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/index.js.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.defaults.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.defaults.js.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.resolver.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.resolver.js.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.type.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.type.js.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.validation.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.validation.js.map +0 -1
- package/dist/runtime/runtimeShutdown/index.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/index.js.map +0 -1
- package/dist/runtime/runtimeShutdown/pipeline/index.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/pipeline/index.js.map +0 -1
- package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.js.map +0 -1
- package/dist/runtime/runtimeShutdown/runtimeShutdown.core.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/runtimeShutdown.core.js.map +0 -1
- package/dist/runtime/runtimeShutdown/runtimeShutdown.type.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/runtimeShutdown.type.js.map +0 -1
- package/dist/runtime/runtimeState.state.d.ts.map +0 -1
- package/dist/runtime/runtimeState.state.js.map +0 -1
package/dist/context/index.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Execution context.
|
|
3
|
+
*
|
|
4
|
+
* The framework has one execution-context model:
|
|
5
|
+
*
|
|
6
|
+
* - ExecutionContext (core/) is an immutable description of one
|
|
7
|
+
* execution (ids, tracing, principal, metadata). New contexts are
|
|
8
|
+
* created with createExecutionContext and refined with
|
|
9
|
+
* deriveExecutionContext / withExecutionMetadata.
|
|
10
|
+
* - ContextStorage (provider/) propagates the current
|
|
11
|
+
* ExecutionContext across async boundaries via AsyncLocalStorage.
|
|
12
|
+
* getDefaultContextStorage() is the shared instance the runtime,
|
|
13
|
+
* module lifecycle, application, container, and logger use unless
|
|
14
|
+
* another storage is injected.
|
|
15
|
+
* - ContextValues (values/) carries strongly typed per-execution
|
|
16
|
+
* values; ContextStorage.runWithValues / getValues / capture /
|
|
17
|
+
* runSnapshot connect them to the storage, and ContextSnapshot
|
|
18
|
+
* (snapshot/) carries both across scheduling boundaries.
|
|
19
|
+
*
|
|
20
|
+
* The runtime runs its bootstrap and shutdown pipelines, every
|
|
21
|
+
* module lifecycle hook, and application start/stop inside the
|
|
22
|
+
* runtime's own ExecutionContext (see RuntimeExecutionContext).
|
|
3
23
|
*/
|
|
4
24
|
export * from "./core/index.js";
|
|
5
25
|
export * from "./provider/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExecutionContext } from "../core/executionContext.context.js";
|
|
2
|
-
import { ContextStorage } from "
|
|
2
|
+
import type { ContextStorage } from "./contextStorage.storage.js";
|
|
3
3
|
/**
|
|
4
4
|
* Provides access to the current execution context.
|
|
5
5
|
*
|
|
@@ -32,7 +32,9 @@ export interface ContextProvider {
|
|
|
32
32
|
* Default ContextProvider implementation.
|
|
33
33
|
*
|
|
34
34
|
* Uses ContextStorage internally while keeping that
|
|
35
|
-
* implementation detail hidden behind the provider contract.
|
|
35
|
+
* implementation detail hidden behind the provider contract. When
|
|
36
|
+
* no storage is supplied the process-wide default storage is used,
|
|
37
|
+
* so the provider observes the same context the runtime establishes.
|
|
36
38
|
*/
|
|
37
39
|
export declare class DefaultContextProvider implements ContextProvider {
|
|
38
40
|
private readonly storage;
|
|
@@ -55,7 +57,8 @@ export declare class DefaultContextProvider implements ContextProvider {
|
|
|
55
57
|
run<T>(context: ExecutionContext, callback: () => T): T;
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
|
-
* Creates the default framework context provider
|
|
60
|
+
* Creates the default framework context provider, optionally bound
|
|
61
|
+
* to a specific ContextStorage.
|
|
59
62
|
*/
|
|
60
|
-
export declare function createContextProvider(): ContextProvider;
|
|
63
|
+
export declare function createContextProvider(storage?: ContextStorage): ContextProvider;
|
|
61
64
|
//# sourceMappingURL=contextProvider.provider.d.ts.map
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDefaultContextStorage } from "./defaultContextStorage.storage.js";
|
|
2
2
|
/**
|
|
3
3
|
* Default ContextProvider implementation.
|
|
4
4
|
*
|
|
5
5
|
* Uses ContextStorage internally while keeping that
|
|
6
|
-
* implementation detail hidden behind the provider contract.
|
|
6
|
+
* implementation detail hidden behind the provider contract. When
|
|
7
|
+
* no storage is supplied the process-wide default storage is used,
|
|
8
|
+
* so the provider observes the same context the runtime establishes.
|
|
7
9
|
*/
|
|
8
10
|
export class DefaultContextProvider {
|
|
9
11
|
storage;
|
|
10
|
-
constructor(storage =
|
|
12
|
+
constructor(storage = getDefaultContextStorage()) {
|
|
11
13
|
this.storage = storage;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
@@ -36,9 +38,10 @@ export class DefaultContextProvider {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
|
-
* Creates the default framework context provider
|
|
41
|
+
* Creates the default framework context provider, optionally bound
|
|
42
|
+
* to a specific ContextStorage.
|
|
40
43
|
*/
|
|
41
|
-
export function createContextProvider() {
|
|
42
|
-
return new DefaultContextProvider();
|
|
44
|
+
export function createContextProvider(storage) {
|
|
45
|
+
return new DefaultContextProvider(storage);
|
|
43
46
|
}
|
|
44
47
|
//# sourceMappingURL=contextProvider.provider.js.map
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { ExecutionContext } from "../core/executionContext.context.js";
|
|
2
|
+
import { ContextValues } from "../values/contextValues.values.js";
|
|
3
|
+
import type { ContextSnapshot } from "../snapshot/contextSnapshot.snapshot.js";
|
|
4
|
+
/**
|
|
5
|
+
* Overrides accepted when deriving an execution context from
|
|
6
|
+
* the current one.
|
|
7
|
+
*/
|
|
8
|
+
export type ExecutionContextOverrides = Partial<Omit<ExecutionContext, "executionId" | "startedAt" | "metadata">> & {
|
|
9
|
+
readonly executionId?: string;
|
|
10
|
+
readonly startedAt?: Date;
|
|
11
|
+
readonly metadata?: Record<string, unknown>;
|
|
12
|
+
};
|
|
2
13
|
/**
|
|
3
14
|
* Stores the current ExecutionContext across asynchronous
|
|
4
15
|
* boundaries.
|
|
@@ -6,9 +17,14 @@ import type { ExecutionContext } from "../core/executionContext.context.js";
|
|
|
6
17
|
* This allows framework components to access the current
|
|
7
18
|
* execution without explicitly passing the context through
|
|
8
19
|
* every function call.
|
|
20
|
+
*
|
|
21
|
+
* Alongside the ExecutionContext, an optional ContextValues
|
|
22
|
+
* collection can travel with the execution, connecting typed
|
|
23
|
+
* context values to the async storage.
|
|
9
24
|
*/
|
|
10
25
|
export declare class ContextStorage {
|
|
11
26
|
private readonly storage;
|
|
27
|
+
private readonly valuesStorage;
|
|
12
28
|
/**
|
|
13
29
|
* Runs a function inside an execution context.
|
|
14
30
|
*
|
|
@@ -33,19 +49,43 @@ export declare class ContextStorage {
|
|
|
33
49
|
*/
|
|
34
50
|
has(): boolean;
|
|
35
51
|
/**
|
|
36
|
-
* Executes a callback
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
*
|
|
52
|
+
* Executes a callback within a context derived from the
|
|
53
|
+
* current one.
|
|
54
|
+
*
|
|
55
|
+
* The current context is read from storage and combined with
|
|
56
|
+
* the supplied overrides via deriveExecutionContext, so
|
|
57
|
+
* correlation and tracing information propagates into the
|
|
58
|
+
* derived scope. Throws when no context is active.
|
|
42
59
|
*/
|
|
43
|
-
runDerived<T>(
|
|
60
|
+
runDerived<T>(overrides: ExecutionContextOverrides, callback: () => T): T;
|
|
44
61
|
/**
|
|
45
62
|
* Clears the current execution context by executing the
|
|
46
63
|
* callback outside the current storage context.
|
|
47
64
|
*/
|
|
48
65
|
runWithoutContext<T>(callback: () => T): T;
|
|
66
|
+
/**
|
|
67
|
+
* Runs a callback with both an execution context and a typed
|
|
68
|
+
* ContextValues collection bound to the async scope.
|
|
69
|
+
*/
|
|
70
|
+
runWithValues<T>(context: ExecutionContext, values: ContextValues, callback: () => T): T;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the ContextValues bound to the current async scope,
|
|
73
|
+
* when one was provided via runWithValues or runSnapshot.
|
|
74
|
+
*/
|
|
75
|
+
getValues(): ContextValues | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Captures the current execution context and its values as an
|
|
78
|
+
* immutable snapshot for later restoration (for example, when
|
|
79
|
+
* scheduling background work).
|
|
80
|
+
*
|
|
81
|
+
* Throws when no execution context is active.
|
|
82
|
+
*/
|
|
83
|
+
capture(): ContextSnapshot;
|
|
84
|
+
/**
|
|
85
|
+
* Runs a callback inside the execution context and values of
|
|
86
|
+
* a previously captured snapshot.
|
|
87
|
+
*/
|
|
88
|
+
runSnapshot<T>(snapshot: ContextSnapshot, callback: () => T): T;
|
|
49
89
|
}
|
|
50
90
|
/**
|
|
51
91
|
* Creates a ContextStorage instance.
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { deriveExecutionContext } from "../core/executionContext.context.js";
|
|
3
|
+
import { ContextValues } from "../values/contextValues.values.js";
|
|
4
|
+
import { createContextValues } from "../values/contextValues.values.js";
|
|
5
|
+
import { createContextSnapshot } from "../snapshot/contextSnapshot.snapshot.js";
|
|
6
|
+
import { ExecutionContextNotFoundError } from "../../errors/exceptions.js";
|
|
2
7
|
/**
|
|
3
8
|
* Stores the current ExecutionContext across asynchronous
|
|
4
9
|
* boundaries.
|
|
@@ -6,9 +11,14 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
6
11
|
* This allows framework components to access the current
|
|
7
12
|
* execution without explicitly passing the context through
|
|
8
13
|
* every function call.
|
|
14
|
+
*
|
|
15
|
+
* Alongside the ExecutionContext, an optional ContextValues
|
|
16
|
+
* collection can travel with the execution, connecting typed
|
|
17
|
+
* context values to the async storage.
|
|
9
18
|
*/
|
|
10
19
|
export class ContextStorage {
|
|
11
20
|
storage = new AsyncLocalStorage();
|
|
21
|
+
valuesStorage = new AsyncLocalStorage();
|
|
12
22
|
/**
|
|
13
23
|
* Runs a function inside an execution context.
|
|
14
24
|
*
|
|
@@ -34,7 +44,7 @@ export class ContextStorage {
|
|
|
34
44
|
require() {
|
|
35
45
|
const context = this.get();
|
|
36
46
|
if (!context) {
|
|
37
|
-
throw new
|
|
47
|
+
throw new ExecutionContextNotFoundError();
|
|
38
48
|
}
|
|
39
49
|
return context;
|
|
40
50
|
}
|
|
@@ -45,24 +55,56 @@ export class ContextStorage {
|
|
|
45
55
|
return this.get() !== undefined;
|
|
46
56
|
}
|
|
47
57
|
/**
|
|
48
|
-
* Executes a callback
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
* a temporary derived context.
|
|
58
|
+
* Executes a callback within a context derived from the
|
|
59
|
+
* current one.
|
|
60
|
+
*
|
|
61
|
+
* The current context is read from storage and combined with
|
|
62
|
+
* the supplied overrides via deriveExecutionContext, so
|
|
63
|
+
* correlation and tracing information propagates into the
|
|
64
|
+
* derived scope. Throws when no context is active.
|
|
56
65
|
*/
|
|
57
|
-
runDerived(
|
|
58
|
-
|
|
66
|
+
runDerived(overrides, callback) {
|
|
67
|
+
const current = this.require();
|
|
68
|
+
const derived = deriveExecutionContext(current, overrides);
|
|
69
|
+
return this.storage.run(derived, callback);
|
|
59
70
|
}
|
|
60
71
|
/**
|
|
61
72
|
* Clears the current execution context by executing the
|
|
62
73
|
* callback outside the current storage context.
|
|
63
74
|
*/
|
|
64
75
|
runWithoutContext(callback) {
|
|
65
|
-
return this.storage.exit(callback);
|
|
76
|
+
return this.storage.exit(() => this.valuesStorage.exit(callback));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Runs a callback with both an execution context and a typed
|
|
80
|
+
* ContextValues collection bound to the async scope.
|
|
81
|
+
*/
|
|
82
|
+
runWithValues(context, values, callback) {
|
|
83
|
+
return this.storage.run(context, () => this.valuesStorage.run(values, callback));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns the ContextValues bound to the current async scope,
|
|
87
|
+
* when one was provided via runWithValues or runSnapshot.
|
|
88
|
+
*/
|
|
89
|
+
getValues() {
|
|
90
|
+
return this.valuesStorage.getStore();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Captures the current execution context and its values as an
|
|
94
|
+
* immutable snapshot for later restoration (for example, when
|
|
95
|
+
* scheduling background work).
|
|
96
|
+
*
|
|
97
|
+
* Throws when no execution context is active.
|
|
98
|
+
*/
|
|
99
|
+
capture() {
|
|
100
|
+
return createContextSnapshot(this.require(), this.getValues() ?? createContextValues());
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Runs a callback inside the execution context and values of
|
|
104
|
+
* a previously captured snapshot.
|
|
105
|
+
*/
|
|
106
|
+
runSnapshot(snapshot, callback) {
|
|
107
|
+
return this.runWithValues(snapshot.context, snapshot.values, callback);
|
|
66
108
|
}
|
|
67
109
|
}
|
|
68
110
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContextStorage } from "./contextStorage.storage.js";
|
|
2
|
+
/**
|
|
3
|
+
* The process-wide default ContextStorage.
|
|
4
|
+
*
|
|
5
|
+
* Every framework component that needs ambient execution context
|
|
6
|
+
* (runtime, module lifecycle, application, container scoping,
|
|
7
|
+
* logging) falls back to this instance when no storage is injected,
|
|
8
|
+
* so they all observe the same AsyncLocalStorage by default.
|
|
9
|
+
* Inject a dedicated ContextStorage everywhere when isolation is
|
|
10
|
+
* required (for example in tests that run applications in
|
|
11
|
+
* parallel).
|
|
12
|
+
*/
|
|
13
|
+
export declare const defaultContextStorage: ContextStorage;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the process-wide default ContextStorage.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getDefaultContextStorage(): ContextStorage;
|
|
18
|
+
//# sourceMappingURL=defaultContextStorage.storage.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ContextStorage } from "./contextStorage.storage.js";
|
|
2
|
+
/**
|
|
3
|
+
* The process-wide default ContextStorage.
|
|
4
|
+
*
|
|
5
|
+
* Every framework component that needs ambient execution context
|
|
6
|
+
* (runtime, module lifecycle, application, container scoping,
|
|
7
|
+
* logging) falls back to this instance when no storage is injected,
|
|
8
|
+
* so they all observe the same AsyncLocalStorage by default.
|
|
9
|
+
* Inject a dedicated ContextStorage everywhere when isolation is
|
|
10
|
+
* required (for example in tests that run applications in
|
|
11
|
+
* parallel).
|
|
12
|
+
*/
|
|
13
|
+
export const defaultContextStorage = new ContextStorage();
|
|
14
|
+
/**
|
|
15
|
+
* Returns the process-wide default ContextStorage.
|
|
16
|
+
*/
|
|
17
|
+
export function getDefaultContextStorage() {
|
|
18
|
+
return defaultContextStorage;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=defaultContextStorage.storage.js.map
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Async context storage and provider.
|
|
5
5
|
*/
|
|
6
|
-
export { ContextStorage, createContextStorage, } from "./contextStorage.storage.js";
|
|
6
|
+
export { ContextStorage, createContextStorage, type ExecutionContextOverrides, } from "./contextStorage.storage.js";
|
|
7
|
+
export { defaultContextStorage, getDefaultContextStorage, } from "./defaultContextStorage.storage.js";
|
|
7
8
|
export { DefaultContextProvider, createContextProvider, type ContextProvider, } from "./contextProvider.provider.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
* Async context storage and provider.
|
|
5
5
|
*/
|
|
6
6
|
export { ContextStorage, createContextStorage, } from "./contextStorage.storage.js";
|
|
7
|
+
export { defaultContextStorage, getDefaultContextStorage, } from "./defaultContextStorage.storage.js";
|
|
7
8
|
export { DefaultContextProvider, createContextProvider, } from "./contextProvider.provider.js";
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -25,6 +25,24 @@ export declare class ProviderNotFoundError extends FrameworkError {
|
|
|
25
25
|
export declare class ProviderAlreadyRegisteredError extends FrameworkError {
|
|
26
26
|
constructor(token: unknown);
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when a provider definition is not one of the supported
|
|
30
|
+
* shapes (useValue, useFactory, useClass).
|
|
31
|
+
*/
|
|
32
|
+
export declare class InvalidProviderError extends FrameworkError {
|
|
33
|
+
constructor(token: unknown);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Thrown when a dependency cannot be resolved, for example because
|
|
37
|
+
* the resolution chain contains a cycle or a factory failed.
|
|
38
|
+
*/
|
|
39
|
+
export declare class DependencyResolutionError extends FrameworkError {
|
|
40
|
+
/**
|
|
41
|
+
* Tokens in resolution order, ending with the token that failed.
|
|
42
|
+
*/
|
|
43
|
+
readonly chain: readonly string[];
|
|
44
|
+
constructor(message: string, chain: readonly unknown[], cause?: unknown);
|
|
45
|
+
}
|
|
28
46
|
/**
|
|
29
47
|
* Thrown when configuration is required but cannot be found.
|
|
30
48
|
*/
|
|
@@ -49,4 +67,8 @@ export declare class ModuleNotFoundError extends FrameworkError {
|
|
|
49
67
|
export declare class AdapterNotFoundError extends FrameworkError {
|
|
50
68
|
constructor(adapterName: string);
|
|
51
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Creates a readable representation of a dependency token.
|
|
72
|
+
*/
|
|
73
|
+
export declare function describeToken(token: unknown): string;
|
|
52
74
|
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -54,6 +54,43 @@ export class ProviderAlreadyRegisteredError extends FrameworkError {
|
|
|
54
54
|
this.name = "ProviderAlreadyRegisteredError";
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Thrown when a provider definition is not one of the supported
|
|
59
|
+
* shapes (useValue, useFactory, useClass).
|
|
60
|
+
*/
|
|
61
|
+
export class InvalidProviderError extends FrameworkError {
|
|
62
|
+
constructor(token) {
|
|
63
|
+
super(`Invalid provider definition for token "${describeToken(token)}".`, {
|
|
64
|
+
code: ErrorCode.INVALID_PROVIDER,
|
|
65
|
+
details: {
|
|
66
|
+
token: describeToken(token),
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
this.name = "InvalidProviderError";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Thrown when a dependency cannot be resolved, for example because
|
|
74
|
+
* the resolution chain contains a cycle or a factory failed.
|
|
75
|
+
*/
|
|
76
|
+
export class DependencyResolutionError extends FrameworkError {
|
|
77
|
+
/**
|
|
78
|
+
* Tokens in resolution order, ending with the token that failed.
|
|
79
|
+
*/
|
|
80
|
+
chain;
|
|
81
|
+
constructor(message, chain, cause) {
|
|
82
|
+
const describedChain = chain.map(describeToken);
|
|
83
|
+
super(message, {
|
|
84
|
+
code: ErrorCode.DEPENDENCY_RESOLUTION_FAILED,
|
|
85
|
+
details: {
|
|
86
|
+
chain: describedChain,
|
|
87
|
+
},
|
|
88
|
+
cause,
|
|
89
|
+
});
|
|
90
|
+
this.name = "DependencyResolutionError";
|
|
91
|
+
this.chain = Object.freeze(describedChain);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
57
94
|
/**
|
|
58
95
|
* Thrown when configuration is required but cannot be found.
|
|
59
96
|
*/
|
|
@@ -110,7 +147,7 @@ export class AdapterNotFoundError extends FrameworkError {
|
|
|
110
147
|
/**
|
|
111
148
|
* Creates a readable representation of a dependency token.
|
|
112
149
|
*/
|
|
113
|
-
function describeToken(token) {
|
|
150
|
+
export function describeToken(token) {
|
|
114
151
|
if (typeof token === "string") {
|
|
115
152
|
return token;
|
|
116
153
|
}
|
|
@@ -17,14 +17,13 @@ export interface FrameworkErrorOptions {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Serializable representation of a FrameworkError.
|
|
20
|
+
*
|
|
21
|
+
* Mirrors exactly what {@link FrameworkError.toJSON} returns: the
|
|
22
|
+
* serialized BaseError fields plus the optional structured details.
|
|
20
23
|
*/
|
|
21
|
-
export
|
|
22
|
-
readonly name: string;
|
|
23
|
-
readonly message: string;
|
|
24
|
-
readonly code: string;
|
|
25
|
-
readonly status?: number;
|
|
24
|
+
export type FrameworkErrorJSON = SerializedBaseError & {
|
|
26
25
|
readonly details?: unknown;
|
|
27
|
-
}
|
|
26
|
+
};
|
|
28
27
|
/**
|
|
29
28
|
* Base error class for all Zudojs framework errors.
|
|
30
29
|
*
|
|
@@ -44,8 +43,6 @@ export declare class FrameworkError extends ApplicationError {
|
|
|
44
43
|
/**
|
|
45
44
|
* Converts the error into a structured representation.
|
|
46
45
|
*/
|
|
47
|
-
toJSON():
|
|
48
|
-
readonly details?: unknown;
|
|
49
|
-
};
|
|
46
|
+
toJSON(): FrameworkErrorJSON;
|
|
50
47
|
}
|
|
51
48
|
//# sourceMappingURL=frameworkError.error.d.ts.map
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
export { ErrorCode } from "./errorCode.code.js";
|
|
7
7
|
export type { ErrorCode as ErrorCodeType } from "./errorCode.code.js";
|
|
8
8
|
export { FrameworkError, type FrameworkErrorJSON, } from "./frameworkError.error.js";
|
|
9
|
-
export { InvalidArgumentError, InvalidStateError, ProviderNotFoundError, ProviderAlreadyRegisteredError, ConfigurationNotFoundError, ExecutionContextNotFoundError, AdapterNotFoundError, } from "./exceptions.js";
|
|
9
|
+
export { InvalidArgumentError, InvalidStateError, ProviderNotFoundError, ProviderAlreadyRegisteredError, InvalidProviderError, DependencyResolutionError, ConfigurationNotFoundError, ExecutionContextNotFoundError, ModuleNotFoundError, AdapterNotFoundError, describeToken, } from "./exceptions.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/errors/index.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { ErrorCode } from "./errorCode.code.js";
|
|
7
7
|
export { FrameworkError, } from "./frameworkError.error.js";
|
|
8
|
-
export { InvalidArgumentError, InvalidStateError, ProviderNotFoundError, ProviderAlreadyRegisteredError, ConfigurationNotFoundError, ExecutionContextNotFoundError, AdapterNotFoundError, } from "./exceptions.js";
|
|
8
|
+
export { InvalidArgumentError, InvalidStateError, ProviderNotFoundError, ProviderAlreadyRegisteredError, InvalidProviderError, DependencyResolutionError, ConfigurationNotFoundError, ExecutionContextNotFoundError, ModuleNotFoundError, AdapterNotFoundError, describeToken, } from "./exceptions.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Public API
|
|
7
7
|
* ----------
|
|
8
8
|
*
|
|
9
|
+
* container
|
|
9
10
|
* contracts
|
|
10
11
|
* errors
|
|
11
12
|
* logging
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
* configuration
|
|
15
16
|
* modules
|
|
16
17
|
* runtime
|
|
18
|
+
* application
|
|
17
19
|
*
|
|
18
20
|
* Internal implementation details should not be imported directly
|
|
19
21
|
* by consumers when a public export is available here.
|
|
@@ -26,5 +28,7 @@ export * from "./lifecycle/index.js";
|
|
|
26
28
|
export * from "./context/index.js";
|
|
27
29
|
export * from "./configuration/index.js";
|
|
28
30
|
export * from "./modules/index.js";
|
|
31
|
+
export { ModuleNotFoundError } from "./modules/index.js";
|
|
29
32
|
export * from "./runtime/index.js";
|
|
33
|
+
export * from "./application/index.js";
|
|
30
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Public API
|
|
7
7
|
* ----------
|
|
8
8
|
*
|
|
9
|
+
* container
|
|
9
10
|
* contracts
|
|
10
11
|
* errors
|
|
11
12
|
* logging
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
* configuration
|
|
15
16
|
* modules
|
|
16
17
|
* runtime
|
|
18
|
+
* application
|
|
17
19
|
*
|
|
18
20
|
* Internal implementation details should not be imported directly
|
|
19
21
|
* by consumers when a public export is available here.
|
|
@@ -66,10 +68,22 @@ export * from "./configuration/index.js";
|
|
|
66
68
|
* ============================================================
|
|
67
69
|
*/
|
|
68
70
|
export * from "./modules/index.js";
|
|
71
|
+
/*
|
|
72
|
+
* The module subsystem's ModuleNotFoundError is the one thrown by the
|
|
73
|
+
* registry, loader, and runtime, so it wins at the root. The generic
|
|
74
|
+
* core error of the same name remains available via "./errors".
|
|
75
|
+
*/
|
|
76
|
+
export { ModuleNotFoundError } from "./modules/index.js";
|
|
69
77
|
/*
|
|
70
78
|
* ============================================================
|
|
71
79
|
* Runtime
|
|
72
80
|
* ============================================================
|
|
73
81
|
*/
|
|
74
82
|
export * from "./runtime/index.js";
|
|
83
|
+
/*
|
|
84
|
+
* ============================================================
|
|
85
|
+
* Application
|
|
86
|
+
* ============================================================
|
|
87
|
+
*/
|
|
88
|
+
export * from "./application/index.js";
|
|
75
89
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Core lifecycle state machine, hooks, and registry.
|
|
5
5
|
*/
|
|
6
|
-
export { LifecycleState, type LifecycleParticipant } from "./lifecycle.js";
|
|
6
|
+
export { Lifecycle, LifecycleState, type LifecycleOptions, type LifecycleParticipant, } from "./lifecycle.js";
|
|
7
7
|
export { hasInitializeHook, hasStartHook, hasStopHook, hasDestroyHook, type OnInitialize, type OnStart, type OnStop, type OnDestroy, type LifecycleHook, } from "./lifecycleHook.hook.js";
|
|
8
8
|
export { LifecycleRegistry, type LifecycleComponent, type LifecycleRegistration, } from "./lifecycleRegistry.registry.js";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Core lifecycle state machine, hooks, and registry.
|
|
5
5
|
*/
|
|
6
|
-
export { LifecycleState } from "./lifecycle.js";
|
|
6
|
+
export { Lifecycle, LifecycleState, } from "./lifecycle.js";
|
|
7
7
|
export { hasInitializeHook, hasStartHook, hasStopHook, hasDestroyHook, } from "./lifecycleHook.hook.js";
|
|
8
8
|
export { LifecycleRegistry, } from "./lifecycleRegistry.registry.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -22,23 +22,68 @@ export interface LifecycleParticipant {
|
|
|
22
22
|
/** Options used by the lifecycle manager. */
|
|
23
23
|
export interface LifecycleOptions {
|
|
24
24
|
readonly logger?: Logger;
|
|
25
|
+
/**
|
|
26
|
+
* Whether stop/dispose should keep going after a participant fails.
|
|
27
|
+
* When false the phase aborts at the first failure and the lifecycle
|
|
28
|
+
* is left FAILED (remaining participants are not unwound).
|
|
29
|
+
*
|
|
30
|
+
* Defaults to true.
|
|
31
|
+
*/
|
|
25
32
|
readonly continueOnShutdownError?: boolean;
|
|
26
33
|
}
|
|
27
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Coordinates initialization, startup, shutdown, and disposal of
|
|
36
|
+
* application resources.
|
|
37
|
+
*
|
|
38
|
+
* State machine:
|
|
39
|
+
*
|
|
40
|
+
* CREATED → INITIALIZING → INITIALIZED → STARTING → RUNNING
|
|
41
|
+
* RUNNING → STOPPING → STOPPED → (STARTING → RUNNING) restart
|
|
42
|
+
* any phase failure → FAILED; initialize()/start() retry from FAILED
|
|
43
|
+
* resume with the participant that failed; stop() from FAILED unwinds
|
|
44
|
+
* whatever started.
|
|
45
|
+
*
|
|
46
|
+
* Concurrent callers of the same phase share the in-flight promise.
|
|
47
|
+
*/
|
|
28
48
|
export declare class Lifecycle {
|
|
29
49
|
private state;
|
|
30
50
|
private readonly participants;
|
|
31
51
|
private readonly logger?;
|
|
32
52
|
private readonly continueOnShutdownError;
|
|
53
|
+
private initializedCount;
|
|
54
|
+
private startedCount;
|
|
55
|
+
private disposed;
|
|
56
|
+
private failedPhase;
|
|
57
|
+
private initializePromise;
|
|
58
|
+
private startPromise;
|
|
59
|
+
private stopPromise;
|
|
33
60
|
constructor(options?: LifecycleOptions);
|
|
34
61
|
getState(): LifecycleState;
|
|
35
62
|
getParticipants(): readonly LifecycleParticipant[];
|
|
63
|
+
/**
|
|
64
|
+
* Whether dispose() has run. A disposed lifecycle cannot be
|
|
65
|
+
* restarted.
|
|
66
|
+
*/
|
|
67
|
+
isDisposed(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Registers a participant. Only allowed before initialization
|
|
70
|
+
* begins so every participant goes through every phase.
|
|
71
|
+
*/
|
|
36
72
|
register(participant: LifecycleParticipant): void;
|
|
37
73
|
initialize(): Promise<void>;
|
|
38
74
|
start(): Promise<void>;
|
|
39
|
-
private waitForInitialization;
|
|
40
75
|
stop(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Disposes every participant in reverse registration order.
|
|
78
|
+
*
|
|
79
|
+
* Idempotent. Participants that are still running are not stopped
|
|
80
|
+
* first; use shutdown() for stop-then-dispose.
|
|
81
|
+
*/
|
|
41
82
|
dispose(): Promise<void>;
|
|
42
83
|
shutdown(): Promise<void>;
|
|
84
|
+
private runInitialize;
|
|
85
|
+
private runStart;
|
|
86
|
+
private runStop;
|
|
87
|
+
private invalidState;
|
|
43
88
|
}
|
|
44
89
|
//# sourceMappingURL=lifecycle.d.ts.map
|