@zudojs/core 0.1.0 → 1.1.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 +27 -1
- package/dist/application/applicationContext.context.js +22 -2
- package/dist/application/createApplication.d.ts +78 -0
- package/dist/application/createApplication.js +109 -0
- package/dist/application/index.d.ts +2 -1
- package/dist/application/index.js +2 -1
- package/dist/configuration/configurationManager.manager.d.ts +42 -0
- package/dist/configuration/configurationManager.manager.js +104 -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 +51 -5
- package/dist/container/container.js +104 -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 +125 -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 +73 -10
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.js +204 -19
- 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 +78 -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 +168 -59
- 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 +111 -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 +13 -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 +85 -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 +25 -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,103 +1,138 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { RuntimeLoadError, RuntimeInitializationError, RuntimeStartError, } from "../../runtimeError/runtimeError.lifecycle.js";
|
|
2
|
+
import { RuntimeErrorCode } from "../../runtimeError/runtimeError.type.js";
|
|
3
|
+
export function createBootstrapPipelineState() {
|
|
4
|
+
return {
|
|
5
|
+
counters: { loadedModules: 0, initializedModules: 0, startedModules: 0 },
|
|
6
|
+
errors: [],
|
|
7
|
+
};
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Executes the load → initialize → start pipeline.
|
|
11
|
+
*
|
|
12
|
+
* - Module-level failures reported by the ModuleLifecycleManager are
|
|
13
|
+
* recorded once per module (with `moduleName`).
|
|
14
|
+
* - When the phase's continueOn*Error flag is false the pipeline
|
|
15
|
+
* throws; the thrown error is NOT pushed to `errors` here — the
|
|
16
|
+
* caller records it exactly once.
|
|
17
|
+
* - Once `signal` is aborted (timeout) the pipeline stops publishing
|
|
18
|
+
* phase changes so an abandoned run cannot mutate the owner.
|
|
19
|
+
*/
|
|
20
|
+
export async function executeBootstrapPipeline(options, services, state, signal, setPhase, log) {
|
|
21
|
+
const publish = (phase) => {
|
|
22
|
+
if (!signal.aborted)
|
|
23
|
+
setPhase(phase);
|
|
24
|
+
};
|
|
25
|
+
const identity = {
|
|
26
|
+
runtimeId: services.runtimeId,
|
|
27
|
+
runtimeName: services.runtimeName,
|
|
28
|
+
};
|
|
29
|
+
if (options.loadModules) {
|
|
30
|
+
await loadModules(services.moduleLoader, identity, state, publish, log);
|
|
18
31
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
if (options.initializeModules) {
|
|
33
|
+
await runLifecyclePhase("initializing", "initialized", () => services.moduleLifecycle.initialize(phaseOptions(options.continueOnInitializeError)), services.moduleLifecycle, options.continueOnInitializeError, (count) => {
|
|
34
|
+
state.counters.initializedModules = count;
|
|
35
|
+
}, (message, opts) => new RuntimeInitializationError(message, { ...identity, ...opts }), state, publish, log);
|
|
36
|
+
}
|
|
37
|
+
if (options.startModules) {
|
|
38
|
+
await runLifecyclePhase("starting", "started", () => services.moduleLifecycle.start(phaseOptions(options.continueOnStartError)), services.moduleLifecycle, options.continueOnStartError, (count) => {
|
|
39
|
+
state.counters.startedModules = count;
|
|
40
|
+
}, (message, opts) => new RuntimeStartError(message, {
|
|
41
|
+
...identity,
|
|
42
|
+
...opts,
|
|
43
|
+
code: RuntimeErrorCode.MODULE_START_FAILED,
|
|
44
|
+
}), state, publish, log);
|
|
22
45
|
}
|
|
23
46
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Per-phase options handed to the ModuleLifecycleManager.
|
|
49
|
+
*
|
|
50
|
+
* The runtime's continueOn*Error flag can only relax the manager: when
|
|
51
|
+
* it is on, the manager must keep going too (otherwise it would roll
|
|
52
|
+
* every module back and throw, and the runtime would report READY
|
|
53
|
+
* with nothing running). When it is off the manager keeps its own
|
|
54
|
+
* setting; a permissive manager then returns the failures and the
|
|
55
|
+
* runtime throws and unwinds.
|
|
56
|
+
*/
|
|
57
|
+
function phaseOptions(continueOnError) {
|
|
58
|
+
return continueOnError ? { continueOnError: true } : {};
|
|
59
|
+
}
|
|
60
|
+
async function loadModules(moduleLoader, identity, state, publish, log) {
|
|
61
|
+
publish("loading");
|
|
62
|
+
log("debug", "Loading runtime modules.");
|
|
27
63
|
try {
|
|
28
|
-
await
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
64
|
+
const result = await moduleLoader.loadAll();
|
|
65
|
+
state.counters.loadedModules =
|
|
66
|
+
result.loaded.length + result.alreadyLoaded.length;
|
|
67
|
+
publish("loaded");
|
|
68
|
+
log("debug", "Runtime modules loaded.", {
|
|
69
|
+
loaded: result.loaded.length,
|
|
70
|
+
alreadyLoaded: result.alreadyLoaded.length,
|
|
71
|
+
skipped: result.skipped.length,
|
|
72
|
+
});
|
|
32
73
|
}
|
|
33
74
|
catch (error) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
75
|
+
throw new RuntimeLoadError("Failed to load runtime modules.", {
|
|
76
|
+
...identity,
|
|
77
|
+
phase: "loading",
|
|
78
|
+
cause: error,
|
|
79
|
+
});
|
|
39
80
|
}
|
|
40
81
|
}
|
|
41
|
-
async function
|
|
42
|
-
|
|
43
|
-
log("debug",
|
|
82
|
+
async function runLifecyclePhase(phase, donePhase, run, moduleLifecycle, continueOnError, setCount, createError, state, publish, log) {
|
|
83
|
+
publish(phase);
|
|
84
|
+
log("debug", `Runtime modules ${phase}.`);
|
|
85
|
+
let result;
|
|
44
86
|
try {
|
|
45
|
-
await
|
|
46
|
-
setPhase("started");
|
|
47
|
-
counters.incrementStarted();
|
|
48
|
-
log("debug", "Runtime modules started.");
|
|
87
|
+
result = await run();
|
|
49
88
|
}
|
|
50
89
|
catch (error) {
|
|
51
|
-
errors.push({ phase: "starting", error });
|
|
52
90
|
if (!continueOnError) {
|
|
53
|
-
throw
|
|
91
|
+
throw createError(`Runtime module ${phase} failed.`, {
|
|
92
|
+
phase,
|
|
93
|
+
cause: error,
|
|
94
|
+
});
|
|
54
95
|
}
|
|
55
|
-
|
|
96
|
+
state.errors.push({ phase, error });
|
|
97
|
+
log("warn", `Runtime module ${phase} reported an error. Continuing.`, {
|
|
56
98
|
error,
|
|
57
99
|
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export async function executeBootstrapPipeline(options, errors, counters, moduleLoader, moduleLifecycle, setPhase, log) {
|
|
61
|
-
if (options.loadModules) {
|
|
62
|
-
await loadModules(errors, counters, moduleLoader, setPhase, log);
|
|
63
|
-
}
|
|
64
|
-
if (options.initializeModules) {
|
|
65
|
-
await initializeModules(errors, counters, options.continueOnInitializeError, moduleLifecycle, setPhase, log);
|
|
66
|
-
}
|
|
67
|
-
if (options.startModules) {
|
|
68
|
-
await startModules(errors, counters, options.continueOnStartError, moduleLifecycle, setPhase, log);
|
|
69
|
-
}
|
|
70
|
-
if (errors.length > 0 &&
|
|
71
|
-
!options.continueOnInitializeError &&
|
|
72
|
-
!options.continueOnStartError) {
|
|
73
|
-
throw new RuntimeBootstrapError("Runtime bootstrap completed with module errors.", "BOOTSTRAP_MODULE_ERRORS", errors);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
export async function withTimeout(operation, timeoutMs) {
|
|
77
|
-
if (timeoutMs <= 0) {
|
|
78
|
-
await operation;
|
|
79
100
|
return;
|
|
80
101
|
}
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
setCount(result.completed.length);
|
|
103
|
+
for (const moduleId of result.failed) {
|
|
104
|
+
state.errors.push({
|
|
105
|
+
phase,
|
|
106
|
+
moduleName: moduleId,
|
|
107
|
+
error: moduleLifecycle.getState(moduleId)?.error ??
|
|
108
|
+
new Error(`Module "${moduleId}" failed during ${phase}.`),
|
|
109
|
+
});
|
|
89
110
|
}
|
|
90
|
-
|
|
91
|
-
|
|
111
|
+
if (result.failed.length > 0) {
|
|
112
|
+
if (!continueOnError) {
|
|
113
|
+
throw createError(`${result.failed.length} module(s) failed during ${phase}: ${result.failed.join(", ")}.`, {
|
|
114
|
+
phase,
|
|
115
|
+
metadata: { modules: result.failed.join(",") },
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
log("warn", `Runtime module ${phase} completed with failures. Continuing.`, {
|
|
119
|
+
failed: [...result.failed],
|
|
120
|
+
});
|
|
92
121
|
}
|
|
122
|
+
publish(donePhase);
|
|
123
|
+
log("debug", `Runtime modules ${donePhase}.`, {
|
|
124
|
+
completed: result.completed.length,
|
|
125
|
+
failed: result.failed.length,
|
|
126
|
+
skipped: result.skipped.length,
|
|
127
|
+
});
|
|
93
128
|
}
|
|
94
|
-
export function createBootstrapResult(success, phase,
|
|
129
|
+
export function createBootstrapResult(success, phase, counters, errors, startedAt, completedAt) {
|
|
95
130
|
return Object.freeze({
|
|
96
131
|
success,
|
|
97
132
|
phase,
|
|
98
|
-
loadedModules,
|
|
99
|
-
initializedModules,
|
|
100
|
-
startedModules,
|
|
133
|
+
loadedModules: counters.loadedModules,
|
|
134
|
+
initializedModules: counters.initializedModules,
|
|
135
|
+
startedModules: counters.startedModules,
|
|
101
136
|
errors: Object.freeze([...errors]),
|
|
102
137
|
startedAt,
|
|
103
138
|
completedAt,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { ResolvedRuntimeOptions } from "../runtimeOptions/index.js";
|
|
2
2
|
import type { RuntimeBootstrapDependencies, RuntimeBootstrapOptions, RuntimeBootstrapPhase, RuntimeBootstrapResult, RuntimeBootstrap } from "./runtimeBootstrap.type.js";
|
|
3
|
+
/**
|
|
4
|
+
* Default bootstrap service: loads, initializes, and starts modules
|
|
5
|
+
* according to the runtime's startup options.
|
|
6
|
+
*/
|
|
3
7
|
export declare class DefaultRuntimeBootstrap implements RuntimeBootstrap {
|
|
4
|
-
private readonly
|
|
8
|
+
private readonly _identity;
|
|
5
9
|
private readonly _environment;
|
|
6
|
-
private readonly _application;
|
|
7
10
|
private readonly _moduleLoader;
|
|
8
11
|
private readonly _moduleRegistry;
|
|
9
12
|
private readonly _moduleLifecycle;
|
|
@@ -12,14 +15,14 @@ export declare class DefaultRuntimeBootstrap implements RuntimeBootstrap {
|
|
|
12
15
|
private _running;
|
|
13
16
|
private _phase;
|
|
14
17
|
private _lastResult;
|
|
15
|
-
private _bootstrapContext?;
|
|
16
18
|
constructor(dependencies: RuntimeBootstrapDependencies, runtimeOptions: ResolvedRuntimeOptions);
|
|
17
19
|
get running(): boolean;
|
|
18
20
|
get phase(): RuntimeBootstrapPhase;
|
|
19
21
|
bootstrap(options?: RuntimeBootstrapOptions): Promise<RuntimeBootstrapResult>;
|
|
20
|
-
private resolveOptions;
|
|
21
22
|
getLastResult(): RuntimeBootstrapResult | undefined;
|
|
22
23
|
reset(): void;
|
|
24
|
+
private resolveOptions;
|
|
25
|
+
private errorContext;
|
|
23
26
|
private log;
|
|
24
27
|
}
|
|
25
28
|
//# sourceMappingURL=runtimeBootstrap.core.d.ts.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { executeBootstrapPipeline, RuntimeBootstrapError, withTimeout, createBootstrapResult, } from "./pipeline/index.js";
|
|
1
|
+
import { executeBootstrapPipeline, createBootstrapPipelineState, createBootstrapResult, } from "./pipeline/index.js";
|
|
3
2
|
import { logRuntimeEvent } from "../runtimeLogger.js";
|
|
3
|
+
import { withRuntimeTimeout } from "../runtimeTimeout.js";
|
|
4
|
+
import { RuntimeError } from "../runtimeError/runtimeError.base.js";
|
|
5
|
+
import { InvalidRuntimeStateError, RuntimeStartError, } from "../runtimeError/runtimeError.lifecycle.js";
|
|
6
|
+
import { RuntimeErrorCode } from "../runtimeError/runtimeError.type.js";
|
|
7
|
+
/**
|
|
8
|
+
* Default bootstrap service: loads, initializes, and starts modules
|
|
9
|
+
* according to the runtime's startup options.
|
|
10
|
+
*/
|
|
4
11
|
export class DefaultRuntimeBootstrap {
|
|
5
|
-
|
|
12
|
+
_identity;
|
|
6
13
|
_environment;
|
|
7
|
-
_application;
|
|
8
14
|
_moduleLoader;
|
|
9
15
|
_moduleRegistry;
|
|
10
16
|
_moduleLifecycle;
|
|
@@ -13,11 +19,9 @@ export class DefaultRuntimeBootstrap {
|
|
|
13
19
|
_running = false;
|
|
14
20
|
_phase = "created";
|
|
15
21
|
_lastResult;
|
|
16
|
-
_bootstrapContext;
|
|
17
22
|
constructor(dependencies, runtimeOptions) {
|
|
18
|
-
this.
|
|
23
|
+
this._identity = dependencies.identity;
|
|
19
24
|
this._environment = dependencies.environment;
|
|
20
|
-
this._application = dependencies.application;
|
|
21
25
|
this._moduleLoader = dependencies.moduleLoader;
|
|
22
26
|
this._moduleRegistry = dependencies.moduleRegistry;
|
|
23
27
|
this._moduleLifecycle = dependencies.moduleLifecycle;
|
|
@@ -32,91 +36,115 @@ export class DefaultRuntimeBootstrap {
|
|
|
32
36
|
}
|
|
33
37
|
async bootstrap(options = {}) {
|
|
34
38
|
if (this._running) {
|
|
35
|
-
throw new
|
|
39
|
+
throw new InvalidRuntimeStateError("Runtime bootstrap is already running.", this.errorContext({ state: this._phase }));
|
|
36
40
|
}
|
|
37
41
|
if (this._phase === "completed") {
|
|
38
|
-
throw new
|
|
42
|
+
throw new InvalidRuntimeStateError("Runtime has already been bootstrapped.", this.errorContext({ state: this._phase }));
|
|
39
43
|
}
|
|
40
44
|
this._running = true;
|
|
41
45
|
this._phase = "created";
|
|
42
46
|
const startedAt = new Date();
|
|
43
|
-
const errors = [];
|
|
44
|
-
let loadedModules = 0, initializedModules = 0, startedModules = 0;
|
|
45
47
|
const configuration = this.resolveOptions(options);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
type: "worker",
|
|
49
|
-
id: this._context.identity.id,
|
|
50
|
-
});
|
|
48
|
+
const state = createBootstrapPipelineState();
|
|
49
|
+
const diagnostics = this._runtimeOptions.diagnostics;
|
|
51
50
|
try {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, this._moduleLoader, this._moduleLifecycle, (phase) => {
|
|
51
|
+
if (diagnostics.startupLogging) {
|
|
52
|
+
this.log("info", "Runtime bootstrap started.", {
|
|
53
|
+
...(diagnostics.includeState && { phase: this._phase }),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
await withRuntimeTimeout((signal) => executeBootstrapPipeline(configuration, {
|
|
57
|
+
moduleLoader: this._moduleLoader,
|
|
58
|
+
moduleLifecycle: this._moduleLifecycle,
|
|
59
|
+
runtimeId: this._identity.id,
|
|
60
|
+
runtimeName: this._identity.name,
|
|
61
|
+
}, state, signal, (phase) => {
|
|
64
62
|
this._phase = phase;
|
|
65
|
-
}, this.log.bind(this))
|
|
66
|
-
|
|
63
|
+
}, this.log.bind(this)), configuration.timeoutMs, {
|
|
64
|
+
message: `Runtime bootstrap exceeded the configured timeout of ${configuration.timeoutMs}ms.`,
|
|
65
|
+
error: this.errorContext({
|
|
66
|
+
code: RuntimeErrorCode.BOOTSTRAP_TIMEOUT,
|
|
67
|
+
operation: "start",
|
|
68
|
+
phase: "bootstrapping",
|
|
69
|
+
}),
|
|
70
|
+
onLateRejection: (error) => {
|
|
71
|
+
this.log("warn", "Abandoned runtime bootstrap failed late.", {
|
|
72
|
+
error,
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
});
|
|
67
76
|
this._phase = "completed";
|
|
68
|
-
const
|
|
69
|
-
const result = createBootstrapResult(true, "completed", loadedModules, initializedModules, startedModules, errors, startedAt, completedAt);
|
|
77
|
+
const result = createBootstrapResult(state.errors.length === 0, "completed", state.counters, state.errors, startedAt, new Date());
|
|
70
78
|
this._lastResult = result;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
if (diagnostics.startupLogging) {
|
|
80
|
+
this.log(result.success ? "info" : "warn", result.success
|
|
81
|
+
? "Runtime bootstrap completed."
|
|
82
|
+
: "Runtime bootstrap completed with errors.", {
|
|
83
|
+
durationMs: result.durationMs,
|
|
84
|
+
loadedModules: result.loadedModules,
|
|
85
|
+
initializedModules: result.initializedModules,
|
|
86
|
+
startedModules: result.startedModules,
|
|
87
|
+
errors: result.errors.length,
|
|
88
|
+
...(diagnostics.includeState && { phase: result.phase }),
|
|
89
|
+
...(diagnostics.includeModules && {
|
|
90
|
+
modules: this._moduleRegistry
|
|
91
|
+
.getLoadedModules()
|
|
92
|
+
.map((module) => module.id),
|
|
93
|
+
}),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
77
96
|
return result;
|
|
78
97
|
}
|
|
79
98
|
catch (error) {
|
|
99
|
+
const failedPhase = this._phase;
|
|
80
100
|
this._phase = "failed";
|
|
81
|
-
const bootstrapError = error instanceof
|
|
101
|
+
const bootstrapError = error instanceof RuntimeError
|
|
82
102
|
? error
|
|
83
|
-
: new
|
|
84
|
-
errors.push({ phase:
|
|
85
|
-
const
|
|
86
|
-
const result = createBootstrapResult(false, "failed", loadedModules, initializedModules, startedModules, errors, startedAt, completedAt);
|
|
103
|
+
: new RuntimeStartError("Runtime bootstrap failed.", this.errorContext({ phase: "bootstrapping", cause: error }));
|
|
104
|
+
state.errors.push({ phase: failedPhase, error: bootstrapError });
|
|
105
|
+
const result = createBootstrapResult(false, "failed", state.counters, state.errors, startedAt, new Date());
|
|
87
106
|
this._lastResult = result;
|
|
88
|
-
|
|
107
|
+
this.log("error", "Runtime bootstrap failed.", {
|
|
108
|
+
error: bootstrapError,
|
|
109
|
+
failedPhase,
|
|
110
|
+
durationMs: result.durationMs,
|
|
111
|
+
});
|
|
89
112
|
throw bootstrapError;
|
|
90
113
|
}
|
|
91
114
|
finally {
|
|
92
115
|
this._running = false;
|
|
93
116
|
}
|
|
94
117
|
}
|
|
95
|
-
resolveOptions(options) {
|
|
96
|
-
return {
|
|
97
|
-
loadModules: options.loadModules ?? this._runtimeOptions.startup.autoLoadModules,
|
|
98
|
-
initializeModules: options.initializeModules ??
|
|
99
|
-
this._runtimeOptions.startup.autoInitializeModules,
|
|
100
|
-
startModules: options.startModules ?? this._runtimeOptions.startup.autoStartModules,
|
|
101
|
-
continueOnInitializeError: options.continueOnInitializeError ??
|
|
102
|
-
this._runtimeOptions.startup.continueOnInitializeError,
|
|
103
|
-
continueOnStartError: options.continueOnStartError ??
|
|
104
|
-
this._runtimeOptions.startup.continueOnStartError,
|
|
105
|
-
timeoutMs: options.timeoutMs ?? this._runtimeOptions.startup.timeoutMs,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
118
|
getLastResult() {
|
|
109
119
|
return this._lastResult;
|
|
110
120
|
}
|
|
111
121
|
reset() {
|
|
112
122
|
if (this._running) {
|
|
113
|
-
throw new
|
|
123
|
+
throw new InvalidRuntimeStateError("Cannot reset runtime bootstrap while it is running.", this.errorContext({ state: this._phase }));
|
|
114
124
|
}
|
|
115
125
|
this._phase = "created";
|
|
116
126
|
this._lastResult = undefined;
|
|
117
127
|
}
|
|
128
|
+
resolveOptions(options) {
|
|
129
|
+
const startup = this._runtimeOptions.startup;
|
|
130
|
+
return {
|
|
131
|
+
loadModules: options.loadModules ?? startup.autoLoadModules,
|
|
132
|
+
initializeModules: options.initializeModules ?? startup.autoInitializeModules,
|
|
133
|
+
startModules: options.startModules ?? startup.autoStartModules,
|
|
134
|
+
continueOnInitializeError: options.continueOnInitializeError ?? startup.continueOnInitializeError,
|
|
135
|
+
continueOnStartError: options.continueOnStartError ?? startup.continueOnStartError,
|
|
136
|
+
timeoutMs: options.timeoutMs ?? startup.timeoutMs,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
errorContext(extra) {
|
|
140
|
+
return {
|
|
141
|
+
...extra,
|
|
142
|
+
runtimeId: this._identity.id,
|
|
143
|
+
runtimeName: this._identity.name,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
118
146
|
log(level, message, metadata) {
|
|
119
|
-
logRuntimeEvent(this._logger, this.
|
|
147
|
+
logRuntimeEvent(this._logger, this._identity, this._environment, level, message, metadata);
|
|
120
148
|
}
|
|
121
149
|
}
|
|
122
150
|
//# sourceMappingURL=runtimeBootstrap.core.js.map
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import type { Logger } from "../../logging/core/logger.js";
|
|
2
|
-
import type { ApplicationContext } from "../../application/applicationContext.context.js";
|
|
3
2
|
import type { ModuleLoader } from "../../modules/moduleLoader/index.js";
|
|
4
3
|
import type { ModuleLifecycleManager } from "../../modules/moduleLifecycle/index.js";
|
|
5
4
|
import type { ModuleRegistry } from "../../modules/moduleRegistry/index.js";
|
|
6
|
-
import type {
|
|
5
|
+
import type { RuntimeIdentity } from "../runtimeContext/index.js";
|
|
7
6
|
import type { RuntimeEnvironment } from "../runtimeEnvironment/index.js";
|
|
8
7
|
/**
|
|
9
8
|
* Dependencies required by RuntimeBootstrap.
|
|
10
9
|
*/
|
|
11
10
|
export interface RuntimeBootstrapDependencies {
|
|
12
|
-
|
|
11
|
+
/** Identity attached to errors and log entries. */
|
|
12
|
+
readonly identity: RuntimeIdentity;
|
|
13
13
|
readonly environment: RuntimeEnvironment;
|
|
14
|
-
readonly application: ApplicationContext;
|
|
15
14
|
readonly moduleLoader: ModuleLoader;
|
|
16
15
|
readonly moduleRegistry: ModuleRegistry;
|
|
17
16
|
readonly moduleLifecycle: ModuleLifecycleManager;
|
|
@@ -34,6 +33,9 @@ export interface RuntimeBootstrapOptions {
|
|
|
34
33
|
export type RuntimeBootstrapPhase = "created" | "loading" | "loaded" | "initializing" | "initialized" | "starting" | "started" | "completed" | "failed";
|
|
35
34
|
/**
|
|
36
35
|
* Represents an error produced by a bootstrap phase.
|
|
36
|
+
*
|
|
37
|
+
* Module-level failures carry the failing module id in `moduleName`;
|
|
38
|
+
* pipeline-level failures (timeouts, loader errors) do not.
|
|
37
39
|
*/
|
|
38
40
|
export interface RuntimeBootstrapErrorInfo {
|
|
39
41
|
readonly phase: RuntimeBootstrapPhase;
|
|
@@ -42,6 +44,10 @@ export interface RuntimeBootstrapErrorInfo {
|
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* Result of a bootstrap operation.
|
|
47
|
+
*
|
|
48
|
+
* `success` is true only when no error was recorded. A bootstrap that
|
|
49
|
+
* continued past module failures (continueOn*Error) resolves with
|
|
50
|
+
* `success: false` and the failures listed in `errors`.
|
|
45
51
|
*/
|
|
46
52
|
export interface RuntimeBootstrapResult {
|
|
47
53
|
readonly success: boolean;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime Context
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* runtime-owned infrastructure.
|
|
4
|
+
* The runtime's identity and its immutable ExecutionContext.
|
|
6
5
|
*/
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export type { RuntimeIdentity, RuntimeTiming, RuntimeContextDependencies, RuntimeContext, RuntimeContextState, } from "./runtimeContext.type.js";
|
|
6
|
+
export { createRuntimeId, createRuntimeIdentity, createRuntimeExecutionContext, createRuntimeContext, } from "./runtimeContext.factory.js";
|
|
7
|
+
export type { RuntimeIdentity, RuntimeExecutionMetadata, RuntimeExecutionContext, RuntimeContext, } from "./runtimeContext.type.js";
|
|
10
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime Context
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* runtime-owned infrastructure.
|
|
4
|
+
* The runtime's identity and its immutable ExecutionContext.
|
|
6
5
|
*/
|
|
7
|
-
export {
|
|
8
|
-
export { createRuntimeId, createRuntimeIdentity, createRuntimeContext, } from "./runtimeContext.factory.js";
|
|
6
|
+
export { createRuntimeId, createRuntimeIdentity, createRuntimeExecutionContext, createRuntimeContext, } from "./runtimeContext.factory.js";
|
|
9
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { RuntimeMode, RuntimeRole } from "../runtimeOptions/index.js";
|
|
2
|
-
import type {
|
|
3
|
-
import { DefaultRuntimeContext } from "./runtimeContext.core.js";
|
|
2
|
+
import type { RuntimeExecutionContext, RuntimeIdentity } from "./runtimeContext.type.js";
|
|
4
3
|
/**
|
|
5
4
|
* Creates a unique runtime identifier.
|
|
6
5
|
*/
|
|
@@ -16,7 +15,14 @@ export declare function createRuntimeIdentity(options: {
|
|
|
16
15
|
readonly processId?: number;
|
|
17
16
|
}): RuntimeIdentity;
|
|
18
17
|
/**
|
|
19
|
-
* Creates a
|
|
18
|
+
* Creates the execution context of a runtime from its identity.
|
|
19
|
+
*
|
|
20
|
+
* `metadata` (typically `RuntimeOptions.metadata`) is merged under
|
|
21
|
+
* the identity fields, which always win.
|
|
20
22
|
*/
|
|
21
|
-
export declare function
|
|
23
|
+
export declare function createRuntimeExecutionContext(identity: RuntimeIdentity, metadata?: Readonly<Record<string, unknown>>): RuntimeExecutionContext;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use createRuntimeExecutionContext.
|
|
26
|
+
*/
|
|
27
|
+
export declare const createRuntimeContext: typeof createRuntimeExecutionContext;
|
|
22
28
|
//# sourceMappingURL=runtimeContext.factory.d.ts.map
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { createExecutionContext } from "../../context/core/executionContext.context.js";
|
|
2
3
|
/**
|
|
3
4
|
* Creates a unique runtime identifier.
|
|
4
5
|
*/
|
|
5
6
|
export function createRuntimeId(name) {
|
|
6
|
-
const timestamp = Date.now().toString(36);
|
|
7
|
-
const random = Math.random().toString(36).slice(2, 10);
|
|
8
7
|
const normalizedName = name
|
|
9
8
|
.slice(0, 100)
|
|
10
9
|
.trim()
|
|
11
10
|
.toLowerCase()
|
|
12
11
|
.replace(/[^a-z0-9]+/g, "-")
|
|
13
12
|
.replace(/^-+|-+$/g, "");
|
|
14
|
-
return
|
|
13
|
+
return `${normalizedName || "runtime"}-${randomUUID()}`;
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* Creates a RuntimeIdentity.
|
|
@@ -28,11 +27,35 @@ export function createRuntimeIdentity(options) {
|
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
|
-
* Creates a
|
|
30
|
+
* Creates the execution context of a runtime from its identity.
|
|
31
|
+
*
|
|
32
|
+
* `metadata` (typically `RuntimeOptions.metadata`) is merged under
|
|
33
|
+
* the identity fields, which always win.
|
|
32
34
|
*/
|
|
33
|
-
export function
|
|
34
|
-
|
|
35
|
+
export function createRuntimeExecutionContext(identity, metadata = {}) {
|
|
36
|
+
const runtimeMetadata = {
|
|
37
|
+
...metadata,
|
|
38
|
+
runtimeId: identity.id,
|
|
39
|
+
runtimeName: identity.name,
|
|
40
|
+
runtimeMode: identity.mode,
|
|
41
|
+
runtimeRole: identity.role,
|
|
42
|
+
...(identity.processId !== undefined
|
|
43
|
+
? { processId: identity.processId }
|
|
44
|
+
: {}),
|
|
45
|
+
};
|
|
46
|
+
return createExecutionContext({
|
|
47
|
+
executionId: identity.id,
|
|
48
|
+
service: identity.name,
|
|
49
|
+
transport: "runtime",
|
|
50
|
+
operation: "runtime",
|
|
51
|
+
startedAt: identity.createdAt,
|
|
52
|
+
metadata: runtimeMetadata,
|
|
53
|
+
});
|
|
35
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Use createRuntimeExecutionContext.
|
|
57
|
+
*/
|
|
58
|
+
export const createRuntimeContext = createRuntimeExecutionContext;
|
|
36
59
|
/**
|
|
37
60
|
* Attempts to retrieve the current process ID.
|
|
38
61
|
*/
|