@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
|
@@ -1,29 +1,53 @@
|
|
|
1
1
|
import { RuntimeErrorCode } from "./runtimeError.type.js";
|
|
2
2
|
import { RuntimeError } from "./runtimeError.base.js";
|
|
3
3
|
/**
|
|
4
|
-
* Error thrown when
|
|
4
|
+
* Error thrown when an operation is attempted while the runtime is
|
|
5
|
+
* in a state that does not permit it (for example starting a runtime
|
|
6
|
+
* that is stopping, or stopping one that is still bootstrapping).
|
|
5
7
|
*/
|
|
6
|
-
export class
|
|
8
|
+
export class InvalidRuntimeStateError extends RuntimeError {
|
|
9
|
+
/**
|
|
10
|
+
* The runtime state in which the operation was rejected.
|
|
11
|
+
*/
|
|
12
|
+
state;
|
|
13
|
+
constructor(message, options = {}) {
|
|
14
|
+
const { state, ...rest } = options;
|
|
15
|
+
super(message, {
|
|
16
|
+
...rest,
|
|
17
|
+
code: RuntimeErrorCode.INVALID_STATE_TRANSITION,
|
|
18
|
+
metadata: {
|
|
19
|
+
...(rest.metadata ?? {}),
|
|
20
|
+
...(state !== undefined && { state }),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
this.name = "InvalidRuntimeStateError";
|
|
24
|
+
this.state = state;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Error thrown when a runtime state transition is not allowed by the
|
|
29
|
+
* runtime state table.
|
|
30
|
+
*/
|
|
31
|
+
export class InvalidRuntimeTransitionError extends RuntimeError {
|
|
7
32
|
from;
|
|
8
33
|
to;
|
|
9
34
|
constructor(from, to, options = {}) {
|
|
10
35
|
super(`Invalid runtime state transition from "${from}" to "${to}".`, {
|
|
11
36
|
...options,
|
|
12
37
|
code: RuntimeErrorCode.INVALID_STATE_TRANSITION,
|
|
13
|
-
operation: options.operation ?? "run",
|
|
14
38
|
metadata: {
|
|
15
39
|
...(options.metadata ?? {}),
|
|
16
40
|
from,
|
|
17
41
|
to,
|
|
18
42
|
},
|
|
19
43
|
});
|
|
20
|
-
this.name = "
|
|
44
|
+
this.name = "InvalidRuntimeTransitionError";
|
|
21
45
|
this.from = from;
|
|
22
46
|
this.to = to;
|
|
23
47
|
}
|
|
24
48
|
}
|
|
25
49
|
/**
|
|
26
|
-
* Error thrown when runtime startup fails.
|
|
50
|
+
* Error thrown when runtime startup (bootstrap) fails.
|
|
27
51
|
*/
|
|
28
52
|
export class RuntimeStartError extends RuntimeError {
|
|
29
53
|
constructor(message, options = {}) {
|
|
@@ -49,7 +73,7 @@ export class RuntimeStopError extends RuntimeError {
|
|
|
49
73
|
}
|
|
50
74
|
}
|
|
51
75
|
/**
|
|
52
|
-
* Error thrown when
|
|
76
|
+
* Error thrown when module initialization fails during bootstrap.
|
|
53
77
|
*/
|
|
54
78
|
export class RuntimeInitializationError extends RuntimeError {
|
|
55
79
|
constructor(message, options = {}) {
|
|
@@ -62,7 +86,7 @@ export class RuntimeInitializationError extends RuntimeError {
|
|
|
62
86
|
}
|
|
63
87
|
}
|
|
64
88
|
/**
|
|
65
|
-
* Error thrown when
|
|
89
|
+
* Error thrown when module loading fails during bootstrap.
|
|
66
90
|
*/
|
|
67
91
|
export class RuntimeLoadError extends RuntimeError {
|
|
68
92
|
constructor(message, options = {}) {
|
|
@@ -5,7 +5,7 @@ import { RuntimeError } from "./runtimeError.base.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class RuntimeTimeoutError extends RuntimeError {
|
|
7
7
|
readonly timeoutMs: number;
|
|
8
|
-
constructor(message: string, timeoutMs: number, options?:
|
|
8
|
+
constructor(message: string, timeoutMs: number, options?: RuntimeErrorOptions);
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Error thrown when a runtime dependency is unavailable.
|
|
@@ -8,7 +8,7 @@ export class RuntimeTimeoutError extends RuntimeError {
|
|
|
8
8
|
constructor(message, timeoutMs, options = {}) {
|
|
9
9
|
super(message, {
|
|
10
10
|
...options,
|
|
11
|
-
code: RuntimeErrorCode.OPERATION_TIMEOUT,
|
|
11
|
+
code: options.code ?? RuntimeErrorCode.OPERATION_TIMEOUT,
|
|
12
12
|
metadata: {
|
|
13
13
|
...(options.metadata ?? {}),
|
|
14
14
|
timeoutMs,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SerializedBaseError } from "@zudojs/errors";
|
|
1
2
|
/**
|
|
2
3
|
* Runtime lifecycle operations.
|
|
3
4
|
*/
|
|
@@ -57,18 +58,13 @@ export interface RuntimeErrorOptions {
|
|
|
57
58
|
/**
|
|
58
59
|
* Serializable representation of RuntimeError.
|
|
59
60
|
*/
|
|
60
|
-
export
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
63
|
-
readonly code: string;
|
|
64
|
-
readonly operation?: RuntimeOperation;
|
|
65
|
-
readonly phase?: RuntimeErrorPhase;
|
|
61
|
+
export type RuntimeErrorJSON = SerializedBaseError & {
|
|
62
|
+
readonly operation?: string;
|
|
63
|
+
readonly phase?: string;
|
|
66
64
|
readonly runtimeId?: string;
|
|
67
65
|
readonly runtimeName?: string;
|
|
68
66
|
readonly moduleName?: string;
|
|
69
67
|
readonly errorMetadata: RuntimeErrorMetadata;
|
|
70
68
|
readonly recoverable: boolean;
|
|
71
|
-
|
|
72
|
-
readonly status?: number;
|
|
73
|
-
}
|
|
69
|
+
};
|
|
74
70
|
//# sourceMappingURL=runtimeError.type.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RuntimeIdentity } from "./runtimeContext/index.js";
|
|
2
2
|
import type { RuntimeEnvironment } from "./runtimeEnvironment/index.js";
|
|
3
3
|
import type { Logger } from "../logging/core/logger.js";
|
|
4
|
-
export declare function logRuntimeEvent(logger: Logger,
|
|
4
|
+
export declare function logRuntimeEvent(logger: Logger, identity: RuntimeIdentity, environment: RuntimeEnvironment, level: "debug" | "info" | "warn" | "error", message: string, metadata?: Record<string, unknown>): void;
|
|
5
5
|
//# sourceMappingURL=runtimeLogger.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export function logRuntimeEvent(logger,
|
|
1
|
+
export function logRuntimeEvent(logger, identity, environment, level, message, metadata) {
|
|
2
2
|
try {
|
|
3
3
|
const log = logger;
|
|
4
4
|
const method = log[level];
|
|
5
5
|
if (typeof method === "function") {
|
|
6
6
|
method.call(logger, message, {
|
|
7
|
-
runtimeId:
|
|
8
|
-
runtimeName:
|
|
7
|
+
runtimeId: identity.id,
|
|
8
|
+
runtimeName: identity.name,
|
|
9
9
|
environment: environment.engine,
|
|
10
10
|
...metadata,
|
|
11
11
|
});
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
export { DEFAULT_RUNTIME_OPTIONS } from "./runtimeOptions.defaults.js";
|
|
7
7
|
export { resolveRuntimeOptions, validateRuntimeOptions, } from "./runtimeOptions.resolver.js";
|
|
8
8
|
export { isRuntimeMode, isRuntimeRole, assertRuntimeMode, assertRuntimeRole, } from "./runtimeOptions.validation.js";
|
|
9
|
-
export type { RuntimeMode, RuntimeRole, RuntimeStartupOptions, RuntimeShutdownOptions, RuntimeSignalOptions, RuntimeDiagnosticsOptions,
|
|
9
|
+
export type { RuntimeMode, RuntimeRole, RuntimeStartupOptions, RuntimeShutdownOptions, RuntimeSignalOptions, RuntimeDiagnosticsOptions, RuntimeEnvironmentOverrides, RuntimeOptions, ResolvedRuntimeOptions, } from "./runtimeOptions.type.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,5 +2,5 @@ import type { ResolvedRuntimeOptions } from "./runtimeOptions.type.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Default runtime configuration.
|
|
4
4
|
*/
|
|
5
|
-
export declare const DEFAULT_RUNTIME_OPTIONS: Readonly<Omit<ResolvedRuntimeOptions, "
|
|
5
|
+
export declare const DEFAULT_RUNTIME_OPTIONS: Readonly<Omit<ResolvedRuntimeOptions, "environment" | "metadata">>;
|
|
6
6
|
//# sourceMappingURL=runtimeOptions.defaults.d.ts.map
|
|
@@ -47,6 +47,9 @@ export function resolveRuntimeOptions(options = {}) {
|
|
|
47
47
|
DEFAULT_RUNTIME_OPTIONS.signals.handleUncaughtException,
|
|
48
48
|
handleUnhandledRejection: signals.handleUnhandledRejection ??
|
|
49
49
|
DEFAULT_RUNTIME_OPTIONS.signals.handleUnhandledRejection,
|
|
50
|
+
forceExitOnSecondSignal: signals.forceExitOnSecondSignal ??
|
|
51
|
+
DEFAULT_RUNTIME_OPTIONS.signals.forceExitOnSecondSignal,
|
|
52
|
+
forceExitCode: signals.forceExitCode ?? DEFAULT_RUNTIME_OPTIONS.signals.forceExitCode,
|
|
50
53
|
},
|
|
51
54
|
diagnostics: {
|
|
52
55
|
startupLogging: diagnostics.startupLogging ??
|
|
@@ -58,8 +61,8 @@ export function resolveRuntimeOptions(options = {}) {
|
|
|
58
61
|
includeModules: diagnostics.includeModules ??
|
|
59
62
|
DEFAULT_RUNTIME_OPTIONS.diagnostics.includeModules,
|
|
60
63
|
},
|
|
61
|
-
|
|
62
|
-
...options.
|
|
64
|
+
environment: Object.freeze({
|
|
65
|
+
...options.environment,
|
|
63
66
|
}),
|
|
64
67
|
metadata: Object.freeze({
|
|
65
68
|
...options.metadata,
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ConfigurationManager } from "../../configuration/configurationManager.manager.js";
|
|
3
|
-
import type { Logger } from "../../logging/core/logger.js";
|
|
4
|
-
import type { ModuleLoader } from "../../modules/moduleLoader/index.js";
|
|
5
|
-
import type { ModuleLifecycleManager } from "../../modules/moduleLifecycle/index.js";
|
|
6
|
-
import type { ModuleRegistry } from "../../modules/moduleRegistry/index.js";
|
|
1
|
+
import type { RuntimeEnvironmentVariables } from "../runtimeEnvironment/runtimeEnvironment.type.js";
|
|
7
2
|
/**
|
|
8
3
|
* Runtime execution mode.
|
|
9
4
|
*/
|
|
@@ -19,8 +14,19 @@ export interface RuntimeStartupOptions {
|
|
|
19
14
|
readonly autoLoadModules?: boolean;
|
|
20
15
|
readonly autoInitializeModules?: boolean;
|
|
21
16
|
readonly autoStartModules?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Continue bootstrapping when one or more modules fail to
|
|
19
|
+
* initialize. The runtime still becomes READY but the bootstrap
|
|
20
|
+
* result reports `success: false` with the failures listed.
|
|
21
|
+
*/
|
|
22
22
|
readonly continueOnInitializeError?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Continue bootstrapping when one or more modules fail to start.
|
|
25
|
+
*/
|
|
23
26
|
readonly continueOnStartError?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Bootstrap timeout in milliseconds. 0 disables the timeout.
|
|
29
|
+
*/
|
|
24
30
|
readonly timeoutMs?: number;
|
|
25
31
|
}
|
|
26
32
|
/**
|
|
@@ -31,37 +37,60 @@ export interface RuntimeShutdownOptions {
|
|
|
31
37
|
readonly autoDestroyModules?: boolean;
|
|
32
38
|
readonly continueOnStopError?: boolean;
|
|
33
39
|
readonly continueOnDestroyError?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Shutdown timeout in milliseconds. 0 disables the timeout.
|
|
42
|
+
*/
|
|
34
43
|
readonly timeoutMs?: number;
|
|
35
44
|
}
|
|
36
45
|
/**
|
|
37
46
|
* Options related to runtime process signals.
|
|
47
|
+
*
|
|
48
|
+
* Handlers are registered when the runtime starts and removed when it
|
|
49
|
+
* stops, fails, or is disposed. The runtime never calls
|
|
50
|
+
* `process.exit()` unless `forceExitOnSecondSignal` is explicitly on.
|
|
38
51
|
*/
|
|
39
52
|
export interface RuntimeSignalOptions {
|
|
53
|
+
/** Stop the runtime gracefully on SIGINT. */
|
|
40
54
|
readonly handleSigint?: boolean;
|
|
55
|
+
/** Stop the runtime gracefully on SIGTERM. */
|
|
41
56
|
readonly handleSigterm?: boolean;
|
|
57
|
+
/** Stop the runtime gracefully on SIGHUP. */
|
|
42
58
|
readonly handleSighup?: boolean;
|
|
59
|
+
/** Mark the runtime failed and stop it on uncaughtException. */
|
|
43
60
|
readonly handleUncaughtException?: boolean;
|
|
61
|
+
/** Mark the runtime failed and stop it on unhandledRejection. */
|
|
44
62
|
readonly handleUnhandledRejection?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* When a second termination signal arrives while a graceful stop is
|
|
65
|
+
* already in progress, exit the process immediately with
|
|
66
|
+
* `forceExitCode`. Off by default: the second signal is logged and
|
|
67
|
+
* ignored.
|
|
68
|
+
*/
|
|
69
|
+
readonly forceExitOnSecondSignal?: boolean;
|
|
70
|
+
/** Exit code used by `forceExitOnSecondSignal`. Defaults to 1. */
|
|
71
|
+
readonly forceExitCode?: number;
|
|
45
72
|
}
|
|
46
73
|
/**
|
|
47
74
|
* Options controlling runtime diagnostics.
|
|
48
75
|
*/
|
|
49
76
|
export interface RuntimeDiagnosticsOptions {
|
|
77
|
+
/** Emit info-level logs for bootstrap start/completion. */
|
|
50
78
|
readonly startupLogging?: boolean;
|
|
79
|
+
/** Emit info-level logs for shutdown start/completion. */
|
|
51
80
|
readonly shutdownLogging?: boolean;
|
|
81
|
+
/** Include the pipeline phase in bootstrap/shutdown logs. */
|
|
52
82
|
readonly includeState?: boolean;
|
|
83
|
+
/** Include loaded module ids in bootstrap/shutdown logs. */
|
|
53
84
|
readonly includeModules?: boolean;
|
|
54
85
|
}
|
|
55
86
|
/**
|
|
56
|
-
*
|
|
87
|
+
* Overrides for runtime environment detection. Useful for tests and
|
|
88
|
+
* for hosts that already know their environment.
|
|
57
89
|
*/
|
|
58
|
-
export interface
|
|
59
|
-
readonly
|
|
60
|
-
readonly
|
|
61
|
-
readonly
|
|
62
|
-
readonly moduleRegistry: ModuleRegistry;
|
|
63
|
-
readonly moduleLoader: ModuleLoader;
|
|
64
|
-
readonly moduleLifecycle: ModuleLifecycleManager;
|
|
90
|
+
export interface RuntimeEnvironmentOverrides {
|
|
91
|
+
readonly variables?: RuntimeEnvironmentVariables;
|
|
92
|
+
readonly isCI?: boolean;
|
|
93
|
+
readonly isContainer?: boolean;
|
|
65
94
|
}
|
|
66
95
|
/**
|
|
67
96
|
* Complete runtime options.
|
|
@@ -74,7 +103,7 @@ export interface RuntimeOptions {
|
|
|
74
103
|
readonly shutdown?: RuntimeShutdownOptions;
|
|
75
104
|
readonly signals?: RuntimeSignalOptions;
|
|
76
105
|
readonly diagnostics?: RuntimeDiagnosticsOptions;
|
|
77
|
-
readonly
|
|
106
|
+
readonly environment?: RuntimeEnvironmentOverrides;
|
|
78
107
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
79
108
|
}
|
|
80
109
|
/**
|
|
@@ -88,7 +117,7 @@ export interface ResolvedRuntimeOptions {
|
|
|
88
117
|
readonly shutdown: Required<RuntimeShutdownOptions>;
|
|
89
118
|
readonly signals: Required<RuntimeSignalOptions>;
|
|
90
119
|
readonly diagnostics: Required<RuntimeDiagnosticsOptions>;
|
|
91
|
-
readonly
|
|
120
|
+
readonly environment: RuntimeEnvironmentOverrides;
|
|
92
121
|
readonly metadata: Readonly<Record<string, unknown>>;
|
|
93
122
|
}
|
|
94
123
|
//# sourceMappingURL=runtimeOptions.type.d.ts.map
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Handles the shutdown pipeline for stopping and
|
|
5
5
|
* destroying runtime modules.
|
|
6
6
|
*/
|
|
7
|
-
export { DefaultRuntimeShutdown
|
|
8
|
-
export { executeShutdownPipeline } from "./pipeline/index.js";
|
|
7
|
+
export { DefaultRuntimeShutdown } from "./runtimeShutdown.core.js";
|
|
8
|
+
export { executeShutdownPipeline, createShutdownPipelineState, createShutdownResult, } from "./pipeline/index.js";
|
|
9
|
+
export type { ShutdownCounters, ShutdownPipelineState, } from "./pipeline/index.js";
|
|
9
10
|
export type { RuntimeShutdownDependencies, RuntimeShutdownConfig, RuntimeShutdownPhase, RuntimeShutdownErrorInfo, RuntimeShutdownResult, RuntimeShutdown, ResolvedShutdownOptions, } from "./runtimeShutdown.type.js";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Handles the shutdown pipeline for stopping and
|
|
5
5
|
* destroying runtime modules.
|
|
6
6
|
*/
|
|
7
|
-
export { DefaultRuntimeShutdown
|
|
8
|
-
export { executeShutdownPipeline } from "./pipeline/index.js";
|
|
7
|
+
export { DefaultRuntimeShutdown } from "./runtimeShutdown.core.js";
|
|
8
|
+
export { executeShutdownPipeline, createShutdownPipelineState, createShutdownResult, } from "./pipeline/index.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Module stopping and destruction stages.
|
|
5
5
|
*/
|
|
6
|
-
export { executeShutdownPipeline } from "./runtimeShutdown.pipeline.js";
|
|
6
|
+
export { executeShutdownPipeline, createShutdownPipelineState, createShutdownResult, } from "./runtimeShutdown.pipeline.js";
|
|
7
|
+
export type { ShutdownCounters, ShutdownLogFn, ShutdownPipelineServices, ShutdownPipelineState, } from "./runtimeShutdown.pipeline.js";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Module stopping and destruction stages.
|
|
5
5
|
*/
|
|
6
|
-
export { executeShutdownPipeline } from "./runtimeShutdown.pipeline.js";
|
|
6
|
+
export { executeShutdownPipeline, createShutdownPipelineState, createShutdownResult, } from "./runtimeShutdown.pipeline.js";
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
import type { ModuleLifecycleManager } from "../../../modules/moduleLifecycle/index.js";
|
|
2
|
-
import type { RuntimeShutdownPhase, RuntimeShutdownErrorInfo, ResolvedShutdownOptions } from "../runtimeShutdown.type.js";
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import type { RuntimeShutdownPhase, RuntimeShutdownErrorInfo, RuntimeShutdownResult, ResolvedShutdownOptions } from "../runtimeShutdown.type.js";
|
|
3
|
+
export type ShutdownLogFn = (level: "debug" | "info" | "warn" | "error", message: string, metadata?: Record<string, unknown>) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Module counts produced by the shutdown pipeline.
|
|
6
|
+
*/
|
|
7
|
+
export interface ShutdownCounters {
|
|
8
|
+
stoppedModules: number;
|
|
9
|
+
destroyedModules: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Mutable pipeline state shared with the caller so that counts and
|
|
13
|
+
* recorded errors survive a thrown failure.
|
|
14
|
+
*/
|
|
15
|
+
export interface ShutdownPipelineState {
|
|
16
|
+
readonly counters: ShutdownCounters;
|
|
17
|
+
readonly errors: RuntimeShutdownErrorInfo[];
|
|
18
|
+
}
|
|
19
|
+
export declare function createShutdownPipelineState(): ShutdownPipelineState;
|
|
20
|
+
/**
|
|
21
|
+
* Executes the stop → destroy pipeline.
|
|
22
|
+
*
|
|
23
|
+
* Mirrors the bootstrap pipeline contract: module-level failures are
|
|
24
|
+
* recorded once per module; a phase whose continueOn*Error flag is
|
|
25
|
+
* false throws (and the caller records that error once); aborted
|
|
26
|
+
* runs stop publishing phase changes.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Services the shutdown pipeline drives.
|
|
30
|
+
*/
|
|
31
|
+
export interface ShutdownPipelineServices {
|
|
32
|
+
readonly moduleLifecycle: ModuleLifecycleManager;
|
|
33
|
+
/** Identity attached to every error the pipeline raises. */
|
|
34
|
+
readonly runtimeId?: string;
|
|
35
|
+
readonly runtimeName?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function executeShutdownPipeline(options: ResolvedShutdownOptions, services: ShutdownPipelineServices, state: ShutdownPipelineState, signal: AbortSignal, setPhase: (phase: RuntimeShutdownPhase) => void, log: ShutdownLogFn): Promise<void>;
|
|
38
|
+
export declare function createShutdownResult(success: boolean, phase: RuntimeShutdownPhase, counters: ShutdownCounters, errors: readonly RuntimeShutdownErrorInfo[], startedAt: Date, completedAt: Date): RuntimeShutdownResult;
|
|
9
39
|
//# sourceMappingURL=runtimeShutdown.pipeline.d.ts.map
|
|
@@ -1,67 +1,93 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { RuntimeStopError } from "../../runtimeError/runtimeError.lifecycle.js";
|
|
2
|
+
import { RuntimeErrorCode } from "../../runtimeError/runtimeError.type.js";
|
|
3
|
+
export function createShutdownPipelineState() {
|
|
4
|
+
return {
|
|
5
|
+
counters: { stoppedModules: 0, destroyedModules: 0 },
|
|
6
|
+
errors: [],
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export async function executeShutdownPipeline(options, services, state, signal, setPhase, log) {
|
|
10
|
+
const publish = (phase) => {
|
|
11
|
+
if (!signal.aborted)
|
|
12
|
+
setPhase(phase);
|
|
13
|
+
};
|
|
14
|
+
const { moduleLifecycle } = services;
|
|
15
|
+
const identity = {
|
|
16
|
+
runtimeId: services.runtimeId,
|
|
17
|
+
runtimeName: services.runtimeName,
|
|
18
|
+
};
|
|
19
|
+
if (options.stopModules) {
|
|
20
|
+
await runShutdownPhase("stopping", "stopped", () => moduleLifecycle.stop(), moduleLifecycle, options.continueOnStopError, (count) => {
|
|
21
|
+
state.counters.stoppedModules = count;
|
|
22
|
+
}, RuntimeErrorCode.MODULE_STOP_FAILED, identity, state, publish, log);
|
|
10
23
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
log("warn", "Runtime module shutdown reported an error. Continuing.", {
|
|
17
|
-
error,
|
|
18
|
-
});
|
|
24
|
+
if (options.destroyModules) {
|
|
25
|
+
await runShutdownPhase("destroying", "destroyed", () => moduleLifecycle.destroy(), moduleLifecycle, options.continueOnDestroyError, (count) => {
|
|
26
|
+
state.counters.destroyedModules = count;
|
|
27
|
+
}, RuntimeErrorCode.MODULE_DESTROY_FAILED, identity, state, publish, log);
|
|
19
28
|
}
|
|
20
29
|
}
|
|
21
|
-
async function
|
|
22
|
-
|
|
23
|
-
log("debug",
|
|
30
|
+
async function runShutdownPhase(phase, donePhase, run, moduleLifecycle, continueOnError, setCount, code, identity, state, publish, log) {
|
|
31
|
+
publish(phase);
|
|
32
|
+
log("debug", `Runtime modules ${phase}.`);
|
|
33
|
+
let result;
|
|
24
34
|
try {
|
|
25
|
-
await
|
|
26
|
-
setPhase("destroyed");
|
|
27
|
-
counters.incrementDestroyed();
|
|
28
|
-
log("debug", "Runtime modules destroyed.");
|
|
35
|
+
result = await run();
|
|
29
36
|
}
|
|
30
37
|
catch (error) {
|
|
31
|
-
errors.push({ phase: "destroying", error });
|
|
32
38
|
if (!continueOnError) {
|
|
33
|
-
throw new
|
|
39
|
+
throw new RuntimeStopError(`Runtime module ${phase} failed.`, {
|
|
40
|
+
...identity,
|
|
41
|
+
code,
|
|
42
|
+
phase,
|
|
43
|
+
cause: error,
|
|
44
|
+
});
|
|
34
45
|
}
|
|
35
|
-
|
|
46
|
+
state.errors.push({ phase, error });
|
|
47
|
+
log("warn", `Runtime module ${phase} reported an error. Continuing.`, {
|
|
36
48
|
error,
|
|
37
49
|
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async function invokeStopModules(moduleLifecycle) {
|
|
41
|
-
if (typeof moduleLifecycle.stop === "function") {
|
|
42
|
-
await moduleLifecycle.stop();
|
|
43
50
|
return;
|
|
44
51
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
export async function executeShutdownPipeline(options, errors, counters, moduleLifecycle, setPhase, log) {
|
|
55
|
-
if (options.stopModules) {
|
|
56
|
-
await stopModules(errors, counters, options.continueOnStopError, moduleLifecycle, setPhase, log);
|
|
57
|
-
}
|
|
58
|
-
if (options.destroyModules) {
|
|
59
|
-
await destroyModules(errors, counters, options.continueOnDestroyError, moduleLifecycle, setPhase, log);
|
|
52
|
+
setCount(result.completed.length);
|
|
53
|
+
for (const moduleId of result.failed) {
|
|
54
|
+
state.errors.push({
|
|
55
|
+
phase,
|
|
56
|
+
moduleName: moduleId,
|
|
57
|
+
error: moduleLifecycle.getState(moduleId)?.error ??
|
|
58
|
+
new Error(`Module "${moduleId}" failed during ${phase}.`),
|
|
59
|
+
});
|
|
60
60
|
}
|
|
61
|
-
if (
|
|
62
|
-
!
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
if (result.failed.length > 0) {
|
|
62
|
+
if (!continueOnError) {
|
|
63
|
+
throw new RuntimeStopError(`${result.failed.length} module(s) failed during ${phase}: ${result.failed.join(", ")}.`, {
|
|
64
|
+
...identity,
|
|
65
|
+
code,
|
|
66
|
+
phase,
|
|
67
|
+
metadata: { modules: result.failed.join(",") },
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
log("warn", `Runtime module ${phase} completed with failures. Continuing.`, {
|
|
71
|
+
failed: [...result.failed],
|
|
72
|
+
});
|
|
65
73
|
}
|
|
74
|
+
publish(donePhase);
|
|
75
|
+
log("debug", `Runtime modules ${donePhase}.`, {
|
|
76
|
+
completed: result.completed.length,
|
|
77
|
+
failed: result.failed.length,
|
|
78
|
+
skipped: result.skipped.length,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export function createShutdownResult(success, phase, counters, errors, startedAt, completedAt) {
|
|
82
|
+
return Object.freeze({
|
|
83
|
+
success,
|
|
84
|
+
phase,
|
|
85
|
+
stoppedModules: counters.stoppedModules,
|
|
86
|
+
destroyedModules: counters.destroyedModules,
|
|
87
|
+
errors: Object.freeze([...errors]),
|
|
88
|
+
startedAt,
|
|
89
|
+
completedAt,
|
|
90
|
+
durationMs: completedAt.getTime() - startedAt.getTime(),
|
|
91
|
+
});
|
|
66
92
|
}
|
|
67
93
|
//# sourceMappingURL=runtimeShutdown.pipeline.js.map
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import type { ResolvedRuntimeOptions } from "../runtimeOptions/index.js";
|
|
2
|
-
import type { RuntimeShutdownDependencies, RuntimeShutdownConfig, RuntimeShutdownPhase, RuntimeShutdownResult, RuntimeShutdown
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly name = "RuntimeShutdownError";
|
|
8
|
-
readonly shutdownCode: RuntimeShutdownErrorCode;
|
|
9
|
-
constructor(message: string, code: RuntimeShutdownErrorCode, cause?: unknown);
|
|
10
|
-
}
|
|
11
|
-
export declare function withShutdownTimeout(operation: Promise<void>, timeoutMs: number): Promise<void>;
|
|
12
|
-
export declare function createShutdownResult(success: boolean, phase: RuntimeShutdownPhase, stoppedModules: number, destroyedModules: number, errors: readonly RuntimeShutdownErrorInfo[], startedAt: Date, completedAt: Date): RuntimeShutdownResult;
|
|
2
|
+
import type { RuntimeShutdownDependencies, RuntimeShutdownConfig, RuntimeShutdownPhase, RuntimeShutdownResult, RuntimeShutdown } from "./runtimeShutdown.type.js";
|
|
3
|
+
/**
|
|
4
|
+
* Default shutdown service: stops and destroys modules according to
|
|
5
|
+
* the runtime's shutdown options.
|
|
6
|
+
*/
|
|
13
7
|
export declare class DefaultRuntimeShutdown implements RuntimeShutdown {
|
|
14
|
-
private readonly
|
|
8
|
+
private readonly _identity;
|
|
15
9
|
private readonly _environment;
|
|
16
|
-
private readonly _application;
|
|
17
10
|
private readonly _moduleRegistry;
|
|
18
11
|
private readonly _moduleLifecycle;
|
|
19
12
|
private readonly _logger;
|
|
@@ -21,15 +14,14 @@ export declare class DefaultRuntimeShutdown implements RuntimeShutdown {
|
|
|
21
14
|
private _running;
|
|
22
15
|
private _phase;
|
|
23
16
|
private _lastResult;
|
|
24
|
-
private _shutdownContext?;
|
|
25
17
|
constructor(dependencies: RuntimeShutdownDependencies, runtimeOptions: ResolvedRuntimeOptions);
|
|
26
18
|
get running(): boolean;
|
|
27
19
|
get phase(): RuntimeShutdownPhase;
|
|
28
20
|
shutdown(options?: RuntimeShutdownConfig): Promise<RuntimeShutdownResult>;
|
|
29
|
-
private resolveOptions;
|
|
30
21
|
getLastResult(): RuntimeShutdownResult | undefined;
|
|
31
|
-
getShutdownContext(): Context | undefined;
|
|
32
22
|
reset(): void;
|
|
23
|
+
private resolveOptions;
|
|
24
|
+
private errorContext;
|
|
33
25
|
private log;
|
|
34
26
|
}
|
|
35
27
|
//# sourceMappingURL=runtimeShutdown.core.d.ts.map
|