@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,11 +1,23 @@
|
|
|
1
1
|
import { ModuleLifecycleError } from "./moduleLifecycle.type.js";
|
|
2
|
-
|
|
2
|
+
import { ModuleNotFoundError } from "../moduleError/moduleError.registration.js";
|
|
3
|
+
/**
|
|
4
|
+
* Ensures lifecycle state is synchronized with the registry.
|
|
5
|
+
*
|
|
6
|
+
* Registered modules gain a "created" state; states belonging to
|
|
7
|
+
* modules that are no longer registered are pruned.
|
|
8
|
+
*/
|
|
3
9
|
export function ensureStateSynchronized(registry, states) {
|
|
10
|
+
const registered = new Set();
|
|
4
11
|
for (const registration of registry.getAll()) {
|
|
5
12
|
const moduleId = registration.definition.id;
|
|
13
|
+
registered.add(moduleId);
|
|
6
14
|
if (!states.has(moduleId))
|
|
7
15
|
states.set(moduleId, { moduleId, phase: "created" });
|
|
8
16
|
}
|
|
17
|
+
for (const moduleId of [...states.keys()]) {
|
|
18
|
+
if (!registered.has(moduleId))
|
|
19
|
+
states.delete(moduleId);
|
|
20
|
+
}
|
|
9
21
|
}
|
|
10
22
|
export function getLifecycleState(moduleId, states) {
|
|
11
23
|
return states.get(moduleId);
|
|
@@ -13,7 +25,7 @@ export function getLifecycleState(moduleId, states) {
|
|
|
13
25
|
export function requireLifecycleState(moduleId, states) {
|
|
14
26
|
const state = getLifecycleState(moduleId, states);
|
|
15
27
|
if (!state)
|
|
16
|
-
throw new
|
|
28
|
+
throw new ModuleNotFoundError(moduleId);
|
|
17
29
|
return state;
|
|
18
30
|
}
|
|
19
31
|
export function getAllLifecycleStates(states) {
|
|
@@ -29,13 +41,59 @@ export function isModuleStarted(moduleId, states) {
|
|
|
29
41
|
export function isModuleDestroyed(moduleId, states) {
|
|
30
42
|
return getLifecycleState(moduleId, states)?.phase === "destroyed";
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Maps each lifecycle step to the hook of the public Module
|
|
46
|
+
* contract (ModuleLifecycle) that the engine invokes for it.
|
|
47
|
+
*/
|
|
48
|
+
const STEP_HOOKS = {
|
|
49
|
+
initialize: "onInitialize",
|
|
50
|
+
start: "onReady",
|
|
51
|
+
stop: "onShutdown",
|
|
52
|
+
destroy: "onDestroy",
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Invokes the lifecycle hook for a step on a module.
|
|
56
|
+
*
|
|
57
|
+
* Only the canonical Module contract hooks are invoked:
|
|
58
|
+
*
|
|
59
|
+
* initialize → onInitialize
|
|
60
|
+
* start → onReady
|
|
61
|
+
* stop → onShutdown
|
|
62
|
+
* destroy → onDestroy
|
|
63
|
+
*
|
|
64
|
+
* Modules that do not implement a hook are skipped for that step.
|
|
65
|
+
*
|
|
66
|
+
* When `contextStorage` holds an active execution context (the
|
|
67
|
+
* runtime's, during bootstrap and shutdown), the hook runs inside a
|
|
68
|
+
* context derived from it: `module` is the module id, `operation`
|
|
69
|
+
* is the hook name, and `{ moduleId, phase }` is merged into the
|
|
70
|
+
* metadata. Everything the hook awaits observes that context.
|
|
71
|
+
*/
|
|
72
|
+
export async function invokeLifecycleHook(module, step, context, contextStorage, phase = STEP_PHASES[step]) {
|
|
73
|
+
const hookName = STEP_HOOKS[step];
|
|
74
|
+
const handler = module[hookName];
|
|
35
75
|
if (typeof handler !== "function")
|
|
36
76
|
return;
|
|
37
|
-
|
|
77
|
+
const invoke = () => handler.call(module, context);
|
|
78
|
+
if (contextStorage?.has()) {
|
|
79
|
+
await contextStorage.runDerived({
|
|
80
|
+
module: module.id,
|
|
81
|
+
operation: hookName,
|
|
82
|
+
metadata: { moduleId: module.id, phase },
|
|
83
|
+
}, invoke);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
await invoke();
|
|
38
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Active phase a module is in while each step's hook runs.
|
|
90
|
+
*/
|
|
91
|
+
const STEP_PHASES = {
|
|
92
|
+
initialize: "initializing",
|
|
93
|
+
start: "starting",
|
|
94
|
+
stop: "stopping",
|
|
95
|
+
destroy: "destroying",
|
|
96
|
+
};
|
|
39
97
|
export function canModuleEnterPhase(moduleId, hook, states) {
|
|
40
98
|
const state = getLifecycleState(moduleId, states);
|
|
41
99
|
if (!state)
|
|
@@ -50,7 +108,9 @@ export function canModuleEnterPhase(moduleId, hook, states) {
|
|
|
50
108
|
case "destroy":
|
|
51
109
|
return (state.phase === "stopped" ||
|
|
52
110
|
state.phase === "initialized" ||
|
|
53
|
-
state.phase === "created"
|
|
111
|
+
state.phase === "created" ||
|
|
112
|
+
state.phase === "started" ||
|
|
113
|
+
state.phase === "failed");
|
|
54
114
|
default:
|
|
55
115
|
return false;
|
|
56
116
|
}
|
|
@@ -68,9 +128,30 @@ export function setLifecycleState(moduleId, phase, states, error) {
|
|
|
68
128
|
destroyedAt: phase === "destroyed" ? now : previous?.destroyedAt,
|
|
69
129
|
}));
|
|
70
130
|
}
|
|
71
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Phases that count as "already satisfied" for a hook: modules
|
|
133
|
+
* in these phases are silently skipped rather than reported.
|
|
134
|
+
*/
|
|
135
|
+
const SATISFIED_PHASES = {
|
|
136
|
+
initialize: ["initialized", "starting", "started"],
|
|
137
|
+
start: ["started"],
|
|
138
|
+
stop: ["created", "initialized", "stopped", "destroying", "destroyed"],
|
|
139
|
+
destroy: ["destroyed"],
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Phases a required dependency must be in before a dependent
|
|
143
|
+
* module may enter a forward phase.
|
|
144
|
+
*/
|
|
145
|
+
const REQUIRED_DEPENDENCY_PHASES = {
|
|
146
|
+
initialize: ["initialized", "starting", "started"],
|
|
147
|
+
start: ["started"],
|
|
148
|
+
};
|
|
149
|
+
export async function executeLifecyclePhase(order, hook, activePhase, completedPhase, continueOnError, registry, loader, states, contextStorage) {
|
|
72
150
|
const completed = [];
|
|
73
151
|
const failed = [];
|
|
152
|
+
const skipped = [];
|
|
153
|
+
const blocked = new Set();
|
|
154
|
+
const requiredDependencyPhases = REQUIRED_DEPENDENCY_PHASES[hook];
|
|
74
155
|
for (const moduleId of order) {
|
|
75
156
|
const registration = registry.get(moduleId);
|
|
76
157
|
if (!registration?.instance)
|
|
@@ -84,11 +165,49 @@ export async function executeLifecyclePhase(order, hook, activePhase, completedP
|
|
|
84
165
|
throw new ModuleLifecycleError(moduleId, activePhase, new Error(`Module "${moduleId}" does not have a ModuleContext.`));
|
|
85
166
|
continue;
|
|
86
167
|
}
|
|
87
|
-
|
|
168
|
+
const currentPhase = getLifecycleState(moduleId, states)?.phase;
|
|
169
|
+
if (!canModuleEnterPhase(moduleId, hook, states)) {
|
|
170
|
+
if (currentPhase !== undefined &&
|
|
171
|
+
SATISFIED_PHASES[hook].includes(currentPhase)) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
skipped.push({
|
|
175
|
+
moduleId,
|
|
176
|
+
reason: `Module is in phase "${currentPhase ?? "unknown"}" and cannot enter ${hook}.`,
|
|
177
|
+
});
|
|
178
|
+
blocked.add(moduleId);
|
|
88
179
|
continue;
|
|
180
|
+
}
|
|
181
|
+
/*
|
|
182
|
+
* Forward phases only run when every required dependency
|
|
183
|
+
* reached the requisite state. Modules whose dependencies
|
|
184
|
+
* failed (or were skipped) are skipped with a reason instead
|
|
185
|
+
* of being initialized against a broken dependency.
|
|
186
|
+
*/
|
|
187
|
+
if (requiredDependencyPhases) {
|
|
188
|
+
const blockingDependency = registry
|
|
189
|
+
.getDependencies(moduleId)
|
|
190
|
+
.find((dependency) => {
|
|
191
|
+
if (dependency.optional)
|
|
192
|
+
return false;
|
|
193
|
+
if (blocked.has(dependency.id) || failed.includes(dependency.id))
|
|
194
|
+
return true;
|
|
195
|
+
const dependencyPhase = getLifecycleState(dependency.id, states)?.phase;
|
|
196
|
+
return (dependencyPhase === undefined ||
|
|
197
|
+
!requiredDependencyPhases.includes(dependencyPhase));
|
|
198
|
+
});
|
|
199
|
+
if (blockingDependency) {
|
|
200
|
+
skipped.push({
|
|
201
|
+
moduleId,
|
|
202
|
+
reason: `Dependency "${blockingDependency.id}" is not ready for ${hook}.`,
|
|
203
|
+
});
|
|
204
|
+
blocked.add(moduleId);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
89
208
|
setLifecycleState(moduleId, activePhase, states);
|
|
90
209
|
try {
|
|
91
|
-
await invokeLifecycleHook(module, hook, context);
|
|
210
|
+
await invokeLifecycleHook(module, hook, context, contextStorage, activePhase);
|
|
92
211
|
setLifecycleState(moduleId, completedPhase, states);
|
|
93
212
|
completed.push(moduleId);
|
|
94
213
|
}
|
|
@@ -102,6 +221,7 @@ export async function executeLifecyclePhase(order, hook, activePhase, completedP
|
|
|
102
221
|
return {
|
|
103
222
|
completed: Object.freeze([...completed]),
|
|
104
223
|
failed: Object.freeze([...failed]),
|
|
224
|
+
skipped: Object.freeze([...skipped]),
|
|
105
225
|
};
|
|
106
226
|
}
|
|
107
227
|
//# sourceMappingURL=moduleLifecycle.stateMachine.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ModuleId } from "../module.js";
|
|
2
|
-
import type {
|
|
1
|
+
import type { ModuleId, ModuleLifecycle } from "../module.js";
|
|
2
|
+
import type { ContextStorage } from "../../context/provider/contextStorage.storage.js";
|
|
3
3
|
/**
|
|
4
4
|
* Lifecycle phases supported by the module system.
|
|
5
5
|
*/
|
|
@@ -16,34 +16,34 @@ export interface ModuleLifecycleState {
|
|
|
16
16
|
readonly stoppedAt?: Date;
|
|
17
17
|
readonly destroyedAt?: Date;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Canonical lifecycle hook names of the public Module contract.
|
|
21
|
+
*
|
|
22
|
+
* The lifecycle engine invokes exactly these methods:
|
|
23
|
+
*
|
|
24
|
+
* initialize step → onInitialize
|
|
25
|
+
* start step → onReady
|
|
26
|
+
* stop step → onShutdown
|
|
27
|
+
* destroy step → onDestroy
|
|
28
|
+
*/
|
|
29
|
+
export type ModuleLifecycleHookName = "onInitialize" | "onReady" | "onShutdown" | "onDestroy";
|
|
30
|
+
/**
|
|
31
|
+
* Lifecycle steps executed by the module lifecycle engine.
|
|
32
|
+
*
|
|
33
|
+
* Each step maps onto one ModuleLifecycleHookName; see
|
|
34
|
+
* ModuleLifecycleHookName for the mapping.
|
|
35
|
+
*/
|
|
36
|
+
export type ModuleLifecycleStep = "initialize" | "start" | "stop" | "destroy";
|
|
19
37
|
/**
|
|
20
38
|
* Lifecycle hooks supported by a module.
|
|
21
39
|
*
|
|
22
|
-
*
|
|
40
|
+
* @deprecated The module hook contract is ModuleLifecycle
|
|
41
|
+
* (onInitialize/onReady/onShutdown/onDestroy). This alias exists
|
|
42
|
+
* for source compatibility only; the legacy
|
|
43
|
+
* initialize/start/stop/destroy method names are never invoked
|
|
44
|
+
* by the lifecycle engine.
|
|
23
45
|
*/
|
|
24
|
-
export
|
|
25
|
-
/**
|
|
26
|
-
* Called before the module starts accepting work.
|
|
27
|
-
*/
|
|
28
|
-
initialize?(context: ModuleContext): void | Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Called after all modules have initialized.
|
|
31
|
-
*
|
|
32
|
-
* This is useful when a module needs other modules to
|
|
33
|
-
* already be initialized before it becomes active.
|
|
34
|
-
*/
|
|
35
|
-
start?(context: ModuleContext): void | Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Called when the application begins shutting down.
|
|
38
|
-
*/
|
|
39
|
-
stop?(context: ModuleContext): void | Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Called after the module has stopped.
|
|
42
|
-
*
|
|
43
|
-
* This is the place for final resource cleanup.
|
|
44
|
-
*/
|
|
45
|
-
destroy?(context: ModuleContext): void | Promise<void>;
|
|
46
|
-
}
|
|
46
|
+
export type ModuleLifecycleHooks = ModuleLifecycle;
|
|
47
47
|
/**
|
|
48
48
|
* Options controlling module lifecycle behavior.
|
|
49
49
|
*/
|
|
@@ -72,20 +72,57 @@ export interface ModuleLifecycleOptions {
|
|
|
72
72
|
* Defaults to true.
|
|
73
73
|
*/
|
|
74
74
|
readonly continueOnDestroyError?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* ContextStorage consulted before every hook invocation. When an
|
|
77
|
+
* execution context is active in it (the runtime establishes its
|
|
78
|
+
* RuntimeExecutionContext around bootstrap and shutdown), each
|
|
79
|
+
* hook runs in a context derived from it with
|
|
80
|
+
* `module`/`operation` set and `{ moduleId, phase }` merged into
|
|
81
|
+
* the metadata. When no context is active the hook is invoked
|
|
82
|
+
* directly.
|
|
83
|
+
*
|
|
84
|
+
* Defaults to getDefaultContextStorage(); pass the runtime's
|
|
85
|
+
* storage when injecting a custom one.
|
|
86
|
+
*/
|
|
87
|
+
readonly contextStorage?: ContextStorage;
|
|
75
88
|
}
|
|
76
|
-
import {
|
|
89
|
+
import { ModuleOperationError } from "../moduleError/moduleError.lifecycle.js";
|
|
77
90
|
/**
|
|
78
91
|
* Error thrown when a module lifecycle operation fails.
|
|
92
|
+
*
|
|
93
|
+
* Part of the core module error taxonomy: it is a ModuleError
|
|
94
|
+
* carrying the phase-specific code (MODULE_INITIALIZATION_FAILED,
|
|
95
|
+
* MODULE_START_FAILED, ...), so callers can catch it by type or by
|
|
96
|
+
* code.
|
|
79
97
|
*/
|
|
80
|
-
export declare class ModuleLifecycleError extends
|
|
98
|
+
export declare class ModuleLifecycleError extends ModuleOperationError {
|
|
99
|
+
/**
|
|
100
|
+
* Errors encountered while rolling back already-completed
|
|
101
|
+
* modules after this failure. Best-effort: rollback itself
|
|
102
|
+
* never masks the original failure.
|
|
103
|
+
*/
|
|
104
|
+
rollbackErrors?: readonly unknown[];
|
|
81
105
|
constructor(moduleId: ModuleId, phase: ModuleLifecyclePhase, cause: unknown);
|
|
82
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Reason a module was skipped during a lifecycle phase.
|
|
109
|
+
*/
|
|
110
|
+
export interface ModuleLifecycleSkip {
|
|
111
|
+
readonly moduleId: ModuleId;
|
|
112
|
+
readonly reason: string;
|
|
113
|
+
}
|
|
83
114
|
/**
|
|
84
115
|
* Result of a lifecycle operation.
|
|
85
116
|
*/
|
|
86
117
|
export interface ModuleLifecycleResult {
|
|
87
118
|
readonly completed: readonly ModuleId[];
|
|
88
119
|
readonly failed: readonly ModuleId[];
|
|
120
|
+
/**
|
|
121
|
+
* Modules that could not participate in the phase, with the
|
|
122
|
+
* reason: their required dependencies failed or were skipped,
|
|
123
|
+
* or their current phase does not permit the transition.
|
|
124
|
+
*/
|
|
125
|
+
readonly skipped: readonly ModuleLifecycleSkip[];
|
|
89
126
|
}
|
|
90
127
|
/**
|
|
91
128
|
* Internal lifecycle state map.
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleOperationError } from "../moduleError/moduleError.lifecycle.js";
|
|
2
2
|
/**
|
|
3
3
|
* Error thrown when a module lifecycle operation fails.
|
|
4
|
+
*
|
|
5
|
+
* Part of the core module error taxonomy: it is a ModuleError
|
|
6
|
+
* carrying the phase-specific code (MODULE_INITIALIZATION_FAILED,
|
|
7
|
+
* MODULE_START_FAILED, ...), so callers can catch it by type or by
|
|
8
|
+
* code.
|
|
4
9
|
*/
|
|
5
|
-
export class ModuleLifecycleError extends
|
|
10
|
+
export class ModuleLifecycleError extends ModuleOperationError {
|
|
11
|
+
/**
|
|
12
|
+
* Errors encountered while rolling back already-completed
|
|
13
|
+
* modules after this failure. Best-effort: rollback itself
|
|
14
|
+
* never masks the original failure.
|
|
15
|
+
*/
|
|
16
|
+
rollbackErrors;
|
|
6
17
|
constructor(moduleId, phase, cause) {
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
super(moduleId, phase, cause);
|
|
19
|
+
this.name = "ModuleLifecycleError";
|
|
9
20
|
}
|
|
10
21
|
}
|
|
11
22
|
//# sourceMappingURL=moduleLifecycle.type.js.map
|
|
@@ -7,6 +7,11 @@ import type { ModuleLoaderOptions, ModuleLoadResult } from "./moduleLoader.type.
|
|
|
7
7
|
*
|
|
8
8
|
* Reads definitions from registry, builds dependency graph,
|
|
9
9
|
* validates, resolves startup order, instantiates modules.
|
|
10
|
+
*
|
|
11
|
+
* Dependencies are always resolved against every registered
|
|
12
|
+
* definition. autoLoad filtering applies only to load roots:
|
|
13
|
+
* a module registered with autoLoad disabled is still loaded
|
|
14
|
+
* when another loading module requires it.
|
|
10
15
|
*/
|
|
11
16
|
export declare class ModuleLoader {
|
|
12
17
|
private readonly application;
|
|
@@ -15,21 +20,50 @@ export declare class ModuleLoader {
|
|
|
15
20
|
private readonly registry;
|
|
16
21
|
private readonly allowExplicitLoad;
|
|
17
22
|
private readonly contexts;
|
|
23
|
+
private readonly inFlightLoads;
|
|
18
24
|
constructor(registry: ModuleRegistry, options: ModuleLoaderOptions);
|
|
19
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Loads every module whose definition has autoLoad enabled,
|
|
27
|
+
* plus every module those modules require (regardless of the
|
|
28
|
+
* required module's autoLoad setting).
|
|
29
|
+
*/
|
|
20
30
|
loadAll(): Promise<ModuleLoadResult>;
|
|
21
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Loads a specific module and all of its required dependencies.
|
|
33
|
+
*
|
|
34
|
+
* Concurrent load() calls for the same module share a single
|
|
35
|
+
* in-flight load.
|
|
36
|
+
*/
|
|
22
37
|
load(moduleId: ModuleId): Promise<Module>;
|
|
23
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Loads the dependency closure of the requested module ids.
|
|
40
|
+
*/
|
|
41
|
+
private loadClosure;
|
|
42
|
+
/**
|
|
43
|
+
* Collects the dependency closure of the requested modules
|
|
44
|
+
* across every registered definition.
|
|
45
|
+
*
|
|
46
|
+
* Optional dependencies join the closure only when they are
|
|
47
|
+
* registered; missing required dependencies are reported with
|
|
48
|
+
* the module that needs them.
|
|
49
|
+
*/
|
|
50
|
+
private collectClosure;
|
|
24
51
|
private createGraph;
|
|
25
|
-
private collectDependencies;
|
|
26
52
|
private instantiate;
|
|
27
53
|
private createModuleLogger;
|
|
28
|
-
private isExplicitlyRequested;
|
|
29
54
|
getContext(moduleId: ModuleId): ModuleContext | undefined;
|
|
30
55
|
requireContext(moduleId: ModuleId): ModuleContext;
|
|
31
56
|
getContexts(): ReadonlyMap<ModuleId, ModuleContext>;
|
|
32
57
|
isLoaded(moduleId: ModuleId): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Forgets a module's runtime instance and context.
|
|
60
|
+
*
|
|
61
|
+
* The loader does not run lifecycle hooks; callers that need
|
|
62
|
+
* the instance shut down first should use
|
|
63
|
+
* ModuleLifecycleManager.unloadModule(). Returns false when the
|
|
64
|
+
* module is not registered or holds no instance.
|
|
65
|
+
*/
|
|
66
|
+
unload(moduleId: ModuleId): boolean;
|
|
33
67
|
}
|
|
34
68
|
/** Creates a module loader. */
|
|
35
69
|
export declare function createModuleLoader(registry: ModuleRegistry, options: ModuleLoaderOptions): ModuleLoader;
|