@zudojs/core 1.2.3 → 1.3.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.
Files changed (282) hide show
  1. package/README.md +13 -2
  2. package/dist/application/application.d.ts +29 -1
  3. package/dist/application/application.js +70 -1
  4. package/dist/application/applicationContext.context.d.ts +0 -1
  5. package/dist/application/applicationContext.context.js +0 -1
  6. package/dist/application/applicationState.state.d.ts +0 -1
  7. package/dist/application/applicationState.state.js +0 -1
  8. package/dist/application/createApplication.d.ts +0 -1
  9. package/dist/application/createApplication.js +0 -1
  10. package/dist/application/index.d.ts +0 -1
  11. package/dist/application/index.js +0 -1
  12. package/dist/configuration/configurationManager.manager.d.ts +0 -1
  13. package/dist/configuration/configurationManager.manager.js +0 -1
  14. package/dist/configuration/core/configuration.d.ts +0 -1
  15. package/dist/configuration/core/configuration.js +0 -1
  16. package/dist/configuration/core/configurationKey.key.d.ts +0 -1
  17. package/dist/configuration/core/configurationKey.key.js +0 -1
  18. package/dist/configuration/core/configurationPath.path.d.ts +0 -1
  19. package/dist/configuration/core/configurationPath.path.js +0 -1
  20. package/dist/configuration/core/configurationSource.source.d.ts +0 -1
  21. package/dist/configuration/core/configurationSource.source.js +0 -1
  22. package/dist/configuration/core/index.d.ts +0 -1
  23. package/dist/configuration/core/index.js +0 -1
  24. package/dist/configuration/error/configurationError.error.d.ts +0 -1
  25. package/dist/configuration/error/configurationError.error.js +0 -1
  26. package/dist/configuration/error/configurationRedactor.redactor.d.ts +0 -1
  27. package/dist/configuration/error/configurationRedactor.redactor.js +0 -1
  28. package/dist/configuration/error/index.d.ts +0 -1
  29. package/dist/configuration/error/index.js +0 -1
  30. package/dist/configuration/events/configurationEvents.events.d.ts +0 -1
  31. package/dist/configuration/events/configurationEvents.events.js +0 -1
  32. package/dist/configuration/events/index.d.ts +0 -1
  33. package/dist/configuration/events/index.js +0 -1
  34. package/dist/configuration/index.d.ts +0 -1
  35. package/dist/configuration/index.js +0 -1
  36. package/dist/configuration/loader/configurationLoader.loader.d.ts +0 -1
  37. package/dist/configuration/loader/configurationLoader.loader.js +0 -1
  38. package/dist/configuration/loader/index.d.ts +0 -1
  39. package/dist/configuration/loader/index.js +0 -1
  40. package/dist/configuration/registry/configurationProvider.provider.d.ts +0 -1
  41. package/dist/configuration/registry/configurationProvider.provider.js +0 -1
  42. package/dist/configuration/registry/configurationRegistry.registry.d.ts +0 -1
  43. package/dist/configuration/registry/configurationRegistry.registry.js +0 -1
  44. package/dist/configuration/registry/index.d.ts +0 -1
  45. package/dist/configuration/registry/index.js +0 -1
  46. package/dist/configuration/schema/configurationSchema.schema.d.ts +0 -1
  47. package/dist/configuration/schema/configurationSchema.schema.js +0 -1
  48. package/dist/configuration/schema/configurationValidation.validator.d.ts +0 -1
  49. package/dist/configuration/schema/configurationValidation.validator.js +0 -1
  50. package/dist/configuration/schema/index.d.ts +0 -1
  51. package/dist/configuration/schema/index.js +0 -1
  52. package/dist/container/container.d.ts +0 -1
  53. package/dist/container/container.js +0 -1
  54. package/dist/container/container.lifetime.d.ts +0 -1
  55. package/dist/container/container.lifetime.js +0 -1
  56. package/dist/container/index.d.ts +0 -1
  57. package/dist/container/index.js +0 -1
  58. package/dist/container/provider.d.ts +0 -1
  59. package/dist/container/provider.js +0 -1
  60. package/dist/container/scope.d.ts +0 -1
  61. package/dist/container/scope.js +0 -1
  62. package/dist/container/token.d.ts +0 -1
  63. package/dist/container/token.js +0 -1
  64. package/dist/context/core/contextAliases.deprecated.d.ts +0 -1
  65. package/dist/context/core/contextAliases.deprecated.js +0 -1
  66. package/dist/context/core/contextKey.key.d.ts +0 -1
  67. package/dist/context/core/contextKey.key.js +4 -3
  68. package/dist/context/core/executionContext.context.d.ts +0 -1
  69. package/dist/context/core/executionContext.context.js +0 -1
  70. package/dist/context/core/index.d.ts +0 -1
  71. package/dist/context/core/index.js +0 -1
  72. package/dist/context/index.d.ts +0 -1
  73. package/dist/context/index.js +0 -1
  74. package/dist/context/provider/contextProvider.provider.d.ts +0 -1
  75. package/dist/context/provider/contextProvider.provider.js +0 -1
  76. package/dist/context/provider/contextStorage.storage.d.ts +0 -1
  77. package/dist/context/provider/contextStorage.storage.js +0 -1
  78. package/dist/context/provider/defaultContextStorage.storage.d.ts +0 -1
  79. package/dist/context/provider/defaultContextStorage.storage.js +0 -1
  80. package/dist/context/provider/index.d.ts +0 -1
  81. package/dist/context/provider/index.js +0 -1
  82. package/dist/context/snapshot/contextSnapshot.snapshot.d.ts +0 -1
  83. package/dist/context/snapshot/contextSnapshot.snapshot.js +0 -1
  84. package/dist/context/snapshot/index.d.ts +0 -1
  85. package/dist/context/snapshot/index.js +0 -1
  86. package/dist/context/values/contextValues.values.d.ts +0 -1
  87. package/dist/context/values/contextValues.values.js +0 -1
  88. package/dist/context/values/index.d.ts +0 -1
  89. package/dist/context/values/index.js +0 -1
  90. package/dist/contracts/adapter.d.ts +0 -1
  91. package/dist/contracts/adapter.js +0 -1
  92. package/dist/contracts/disposable.d.ts +0 -1
  93. package/dist/contracts/disposable.js +0 -1
  94. package/dist/contracts/handler.d.ts +0 -1
  95. package/dist/contracts/handler.js +0 -1
  96. package/dist/contracts/index.d.ts +0 -1
  97. package/dist/contracts/index.js +0 -1
  98. package/dist/errors/contextValueNotFound.error.d.ts +15 -0
  99. package/dist/errors/contextValueNotFound.error.js +23 -0
  100. package/dist/errors/errorCode.code.d.ts +1 -1
  101. package/dist/errors/errorCode.code.js +1 -1
  102. package/dist/errors/exceptions.d.ts +0 -1
  103. package/dist/errors/exceptions.js +0 -1
  104. package/dist/errors/frameworkError.error.d.ts +0 -1
  105. package/dist/errors/frameworkError.error.js +0 -1
  106. package/dist/errors/index.d.ts +1 -1
  107. package/dist/errors/index.js +1 -1
  108. package/dist/index.d.ts +4 -1
  109. package/dist/index.js +16 -1
  110. package/dist/lifecycle/core/index.d.ts +0 -1
  111. package/dist/lifecycle/core/index.js +0 -1
  112. package/dist/lifecycle/core/lifecycle.d.ts +12 -2
  113. package/dist/lifecycle/core/lifecycle.js +12 -2
  114. package/dist/lifecycle/core/lifecycle.rollback.d.ts +0 -1
  115. package/dist/lifecycle/core/lifecycle.rollback.js +0 -1
  116. package/dist/lifecycle/core/lifecycleHook.hook.d.ts +0 -1
  117. package/dist/lifecycle/core/lifecycleHook.hook.js +0 -1
  118. package/dist/lifecycle/core/lifecycleRegistry.registry.d.ts +0 -1
  119. package/dist/lifecycle/core/lifecycleRegistry.registry.js +0 -1
  120. package/dist/lifecycle/index.d.ts +0 -1
  121. package/dist/lifecycle/index.js +0 -1
  122. package/dist/lifecycle/manager/index.d.ts +0 -1
  123. package/dist/lifecycle/manager/index.js +0 -1
  124. package/dist/lifecycle/manager/lifecycleManager.manager.d.ts +0 -1
  125. package/dist/lifecycle/manager/lifecycleManager.manager.js +0 -1
  126. package/dist/lifecycle/scope/index.d.ts +0 -1
  127. package/dist/lifecycle/scope/index.js +0 -1
  128. package/dist/lifecycle/scope/lifecycleScope.scope.d.ts +0 -1
  129. package/dist/lifecycle/scope/lifecycleScope.scope.js +0 -1
  130. package/dist/logging/console/consoleLogger.logger.d.ts +0 -1
  131. package/dist/logging/console/consoleLogger.logger.js +6 -2
  132. package/dist/logging/console/index.d.ts +0 -1
  133. package/dist/logging/console/index.js +0 -1
  134. package/dist/logging/console/loggerFactory.factory.d.ts +0 -1
  135. package/dist/logging/console/loggerFactory.factory.js +0 -1
  136. package/dist/logging/core/index.d.ts +0 -1
  137. package/dist/logging/core/index.js +0 -1
  138. package/dist/logging/core/logEntry.entry.d.ts +0 -1
  139. package/dist/logging/core/logEntry.entry.js +0 -1
  140. package/dist/logging/core/logLevel.level.d.ts +0 -1
  141. package/dist/logging/core/logLevel.level.js +0 -1
  142. package/dist/logging/core/logRedaction.redaction.d.ts +0 -1
  143. package/dist/logging/core/logRedaction.redaction.js +0 -1
  144. package/dist/logging/core/logger.d.ts +7 -2
  145. package/dist/logging/core/logger.js +22 -3
  146. package/dist/logging/core/loggerContext.context.d.ts +0 -1
  147. package/dist/logging/core/loggerContext.context.js +0 -1
  148. package/dist/logging/core/loggerOptions.options.d.ts +6 -3
  149. package/dist/logging/core/loggerOptions.options.js +0 -1
  150. package/dist/logging/index.d.ts +0 -1
  151. package/dist/logging/index.js +0 -1
  152. package/dist/modules/index.d.ts +0 -1
  153. package/dist/modules/index.js +0 -1
  154. package/dist/modules/module.d.ts +0 -1
  155. package/dist/modules/module.js +0 -1
  156. package/dist/modules/moduleContext.context.d.ts +0 -1
  157. package/dist/modules/moduleContext.context.js +0 -1
  158. package/dist/modules/moduleDefinition.definition.d.ts +0 -1
  159. package/dist/modules/moduleDefinition.definition.js +0 -1
  160. package/dist/modules/moduleDependency/index.d.ts +0 -1
  161. package/dist/modules/moduleDependency/index.js +0 -1
  162. package/dist/modules/moduleDependency/moduleDependency.graph.d.ts +0 -1
  163. package/dist/modules/moduleDependency/moduleDependency.graph.js +0 -1
  164. package/dist/modules/moduleDependency/moduleDependency.ordering.d.ts +0 -1
  165. package/dist/modules/moduleDependency/moduleDependency.ordering.js +0 -1
  166. package/dist/modules/moduleDependency/moduleDependency.type.d.ts +0 -1
  167. package/dist/modules/moduleDependency/moduleDependency.type.js +0 -1
  168. package/dist/modules/moduleError/index.d.ts +0 -1
  169. package/dist/modules/moduleError/index.js +0 -1
  170. package/dist/modules/moduleError/moduleError.base.d.ts +0 -1
  171. package/dist/modules/moduleError/moduleError.base.js +0 -1
  172. package/dist/modules/moduleError/moduleError.dependency.d.ts +19 -3
  173. package/dist/modules/moduleError/moduleError.dependency.js +16 -4
  174. package/dist/modules/moduleError/moduleError.helpers.d.ts +0 -1
  175. package/dist/modules/moduleError/moduleError.helpers.js +0 -1
  176. package/dist/modules/moduleError/moduleError.lifecycle.d.ts +0 -1
  177. package/dist/modules/moduleError/moduleError.lifecycle.js +0 -1
  178. package/dist/modules/moduleError/moduleError.registration.d.ts +0 -1
  179. package/dist/modules/moduleError/moduleError.registration.js +0 -1
  180. package/dist/modules/moduleLifecycle/index.d.ts +0 -1
  181. package/dist/modules/moduleLifecycle/index.js +0 -1
  182. package/dist/modules/moduleLifecycle/moduleLifecycle.exclusive.d.ts +25 -0
  183. package/dist/modules/moduleLifecycle/moduleLifecycle.exclusive.js +63 -0
  184. package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.d.ts +20 -2
  185. package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.js +52 -20
  186. package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.d.ts +0 -1
  187. package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.js +4 -3
  188. package/dist/modules/moduleLifecycle/moduleLifecycle.type.d.ts +0 -1
  189. package/dist/modules/moduleLifecycle/moduleLifecycle.type.js +0 -1
  190. package/dist/modules/moduleLoader/index.d.ts +0 -1
  191. package/dist/modules/moduleLoader/index.js +0 -1
  192. package/dist/modules/moduleLoader/moduleLoader.loader.d.ts +0 -1
  193. package/dist/modules/moduleLoader/moduleLoader.loader.js +0 -1
  194. package/dist/modules/moduleLoader/moduleLoader.type.d.ts +0 -1
  195. package/dist/modules/moduleLoader/moduleLoader.type.js +0 -1
  196. package/dist/modules/moduleMetadata.metadata.d.ts +0 -1
  197. package/dist/modules/moduleMetadata.metadata.js +0 -1
  198. package/dist/modules/moduleRegistry/index.d.ts +0 -1
  199. package/dist/modules/moduleRegistry/index.js +0 -1
  200. package/dist/modules/moduleRegistry/moduleRegistry.registry.d.ts +0 -1
  201. package/dist/modules/moduleRegistry/moduleRegistry.registry.js +0 -1
  202. package/dist/modules/moduleRegistry/moduleRegistry.type.d.ts +0 -1
  203. package/dist/modules/moduleRegistry/moduleRegistry.type.js +0 -1
  204. package/dist/runtime/index.d.ts +1 -2
  205. package/dist/runtime/index.js +0 -1
  206. package/dist/runtime/runtime.d.ts +18 -2
  207. package/dist/runtime/runtime.js +23 -1
  208. package/dist/runtime/runtimeBootstrap/index.d.ts +0 -1
  209. package/dist/runtime/runtimeBootstrap/index.js +0 -1
  210. package/dist/runtime/runtimeBootstrap/pipeline/index.d.ts +0 -1
  211. package/dist/runtime/runtimeBootstrap/pipeline/index.js +0 -1
  212. package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.d.ts +0 -1
  213. package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.js +0 -1
  214. package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.d.ts +0 -1
  215. package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.js +8 -2
  216. package/dist/runtime/runtimeBootstrap/runtimeBootstrap.type.d.ts +0 -1
  217. package/dist/runtime/runtimeBootstrap/runtimeBootstrap.type.js +0 -1
  218. package/dist/runtime/runtimeContext/index.d.ts +0 -1
  219. package/dist/runtime/runtimeContext/index.js +0 -1
  220. package/dist/runtime/runtimeContext/runtimeContext.factory.d.ts +0 -1
  221. package/dist/runtime/runtimeContext/runtimeContext.factory.js +0 -1
  222. package/dist/runtime/runtimeContext/runtimeContext.type.d.ts +0 -1
  223. package/dist/runtime/runtimeContext/runtimeContext.type.js +0 -1
  224. package/dist/runtime/runtimeEnvironment/detection/index.d.ts +0 -1
  225. package/dist/runtime/runtimeEnvironment/detection/index.js +0 -1
  226. package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.detection.d.ts +0 -1
  227. package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.detection.js +0 -1
  228. package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.d.ts +0 -1
  229. package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.js +0 -1
  230. package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.d.ts +0 -1
  231. package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.js +0 -1
  232. package/dist/runtime/runtimeEnvironment/index.d.ts +0 -1
  233. package/dist/runtime/runtimeEnvironment/index.js +0 -1
  234. package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.d.ts +0 -1
  235. package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.js +0 -1
  236. package/dist/runtime/runtimeEnvironment/runtimeEnvironment.type.d.ts +0 -1
  237. package/dist/runtime/runtimeEnvironment/runtimeEnvironment.type.js +0 -1
  238. package/dist/runtime/runtimeError/index.d.ts +0 -1
  239. package/dist/runtime/runtimeError/index.js +0 -1
  240. package/dist/runtime/runtimeError/runtimeError.base.d.ts +0 -1
  241. package/dist/runtime/runtimeError/runtimeError.base.js +0 -1
  242. package/dist/runtime/runtimeError/runtimeError.lifecycle.d.ts +0 -1
  243. package/dist/runtime/runtimeError/runtimeError.lifecycle.js +0 -1
  244. package/dist/runtime/runtimeError/runtimeError.specialized.d.ts +0 -1
  245. package/dist/runtime/runtimeError/runtimeError.specialized.js +0 -1
  246. package/dist/runtime/runtimeError/runtimeError.type.d.ts +0 -1
  247. package/dist/runtime/runtimeError/runtimeError.type.js +0 -1
  248. package/dist/runtime/runtimeLogger.d.ts +0 -1
  249. package/dist/runtime/runtimeLogger.js +5 -2
  250. package/dist/runtime/runtimeOptions/index.d.ts +0 -1
  251. package/dist/runtime/runtimeOptions/index.js +0 -1
  252. package/dist/runtime/runtimeOptions/runtimeOptions.defaults.d.ts +0 -1
  253. package/dist/runtime/runtimeOptions/runtimeOptions.defaults.js +0 -1
  254. package/dist/runtime/runtimeOptions/runtimeOptions.mode.d.ts +0 -1
  255. package/dist/runtime/runtimeOptions/runtimeOptions.mode.js +0 -1
  256. package/dist/runtime/runtimeOptions/runtimeOptions.resolver.d.ts +0 -1
  257. package/dist/runtime/runtimeOptions/runtimeOptions.resolver.js +0 -1
  258. package/dist/runtime/runtimeOptions/runtimeOptions.type.d.ts +0 -1
  259. package/dist/runtime/runtimeOptions/runtimeOptions.type.js +0 -1
  260. package/dist/runtime/runtimeOptions/runtimeOptions.validation.d.ts +0 -1
  261. package/dist/runtime/runtimeOptions/runtimeOptions.validation.js +0 -1
  262. package/dist/runtime/runtimeShutdown/index.d.ts +0 -1
  263. package/dist/runtime/runtimeShutdown/index.js +0 -1
  264. package/dist/runtime/runtimeShutdown/pipeline/index.d.ts +0 -1
  265. package/dist/runtime/runtimeShutdown/pipeline/index.js +0 -1
  266. package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.d.ts +0 -1
  267. package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.js +0 -1
  268. package/dist/runtime/runtimeShutdown/runtimeShutdown.core.d.ts +0 -1
  269. package/dist/runtime/runtimeShutdown/runtimeShutdown.core.js +4 -2
  270. package/dist/runtime/runtimeShutdown/runtimeShutdown.type.d.ts +0 -1
  271. package/dist/runtime/runtimeShutdown/runtimeShutdown.type.js +0 -1
  272. package/dist/runtime/runtimeSignals/index.d.ts +0 -1
  273. package/dist/runtime/runtimeSignals/index.js +0 -1
  274. package/dist/runtime/runtimeSignals/runtimeSignals.d.ts +7 -3
  275. package/dist/runtime/runtimeSignals/runtimeSignals.fatal.d.ts +0 -1
  276. package/dist/runtime/runtimeSignals/runtimeSignals.fatal.js +0 -1
  277. package/dist/runtime/runtimeSignals/runtimeSignals.js +4 -5
  278. package/dist/runtime/runtimeState.state.d.ts +0 -1
  279. package/dist/runtime/runtimeState.state.js +0 -1
  280. package/dist/runtime/runtimeTimeout.d.ts +0 -1
  281. package/dist/runtime/runtimeTimeout.js +0 -1
  282. package/package.json +3 -3
@@ -55,4 +55,3 @@ export function shouldLog(level, minimumLevel) {
55
55
  const minimumPriority = LogLevelPriority[minimumLevel] ?? LogLevelPriority[DEFAULT_LOG_LEVEL];
56
56
  return levelPriority >= minimumPriority;
57
57
  }
58
- //# sourceMappingURL=logLevel.level.js.map
@@ -35,4 +35,3 @@ export interface LogRedactorOptions {
35
35
  * redacted, "tokenizer" is not.
36
36
  */
37
37
  export declare function createLogRedactor(options?: LogRedactorOptions): LogRedactionHook;
38
- //# sourceMappingURL=logRedaction.redaction.d.ts.map
@@ -16,4 +16,3 @@ export function createLogRedactor(options = {}) {
16
16
  });
17
17
  return (value) => redactor.redactObject(sanitizeLogValue(value));
18
18
  }
19
- //# sourceMappingURL=logRedaction.redaction.js.map
@@ -29,10 +29,16 @@ export interface Logger {
29
29
  warn(message: string, context?: LogContext): void;
30
30
  /**
31
31
  * Logs an error.
32
+ *
33
+ * Argument order differs from `@zudojs/logger`, whose signature is
34
+ * `error(message, metadata)`. Both conventions work here: a plain
35
+ * object in the second position with no third argument is treated
36
+ * as context, not as the error. To log a plain object AS the error,
37
+ * pass a third argument (`{}` will do).
32
38
  */
33
39
  error(message: string, error?: unknown, context?: LogContext): void;
34
40
  /**
35
- * Logs a fatal error.
41
+ * Logs a fatal error. Accepts the same two conventions as `error`.
36
42
  */
37
43
  fatal(message: string, error?: unknown, context?: LogContext): void;
38
44
  /**
@@ -80,4 +86,3 @@ export declare abstract class BaseLogger implements Logger {
80
86
  */
81
87
  protected abstract createChild(context: LogContext): Logger;
82
88
  }
83
- //# sourceMappingURL=logger.d.ts.map
@@ -49,10 +49,12 @@ export class BaseLogger {
49
49
  this.write("warn", message, this.mergeCallContext(context));
50
50
  }
51
51
  error(message, error, context) {
52
- this.write("error", message, this.mergeCallContext(context), error);
52
+ const [thrown, callContext] = splitErrorArguments(error, context);
53
+ this.write("error", message, this.mergeCallContext(callContext), thrown);
53
54
  }
54
55
  fatal(message, error, context) {
55
- this.write("fatal", message, this.mergeCallContext(context), error);
56
+ const [thrown, callContext] = splitErrorArguments(error, context);
57
+ this.write("fatal", message, this.mergeCallContext(callContext), thrown);
56
58
  }
57
59
  child(context) {
58
60
  return this.createChild({
@@ -61,4 +63,21 @@ export class BaseLogger {
61
63
  });
62
64
  }
63
65
  }
64
- //# sourceMappingURL=logger.js.map
66
+ /**
67
+ * Resolves the two `error()`/`fatal()` calling conventions: with no
68
+ * third argument, a plain object (not an Error, not a class instance)
69
+ * in the error position is the `@zudojs/logger`-style metadata.
70
+ */
71
+ function splitErrorArguments(error, context) {
72
+ if (context === undefined && isPlainContext(error)) {
73
+ return [undefined, error];
74
+ }
75
+ return [error, context];
76
+ }
77
+ function isPlainContext(value) {
78
+ if (typeof value !== "object" || value === null || value instanceof Error) {
79
+ return false;
80
+ }
81
+ const prototype = Object.getPrototypeOf(value);
82
+ return prototype === Object.prototype || prototype === null;
83
+ }
@@ -71,4 +71,3 @@ export declare function loggerContextFromExecution(context: ExecutionContext): L
71
71
  * with additional values.
72
72
  */
73
73
  export declare function createLoggerContext(base?: LoggerContext, additional?: LoggerContext): LoggerContext;
74
- //# sourceMappingURL=loggerContext.context.d.ts.map
@@ -35,4 +35,3 @@ export function createLoggerContext(base = {}, additional = {}) {
35
35
  : {}),
36
36
  };
37
37
  }
38
- //# sourceMappingURL=loggerContext.context.js.map
@@ -60,9 +60,13 @@ export interface LoggerOptions {
60
60
  * Redaction hook applied to structured log data (entry context
61
61
  * and error details) before it is written.
62
62
  *
63
- * See createLogRedactor for a key-based implementation.
63
+ * Defaults to `createLogRedactor()`, which replaces values under
64
+ * sensitive-looking keys (`password`, `secret`, `token`, `apiKey`,
65
+ * `authorization`, ...) with `"[REDACTED]"`. Logging such keys in
66
+ * clear used to be the default. Pass `false` to disable redaction,
67
+ * or your own hook to replace it.
64
68
  */
65
- readonly redact?: LogRedactionHook;
69
+ readonly redact?: LogRedactionHook | false;
66
70
  /**
67
71
  * ContextStorage consulted on every write. When an execution
68
72
  * context is active, its `executionId`, `correlationId`,
@@ -83,4 +87,3 @@ export type LogLevelOption = "trace" | "debug" | "info" | "warn" | "error" | "fa
83
87
  * Default logging configuration.
84
88
  */
85
89
  export declare const DEFAULT_LOGGER_OPTIONS: Required<Pick<LoggerOptions, "level" | "timestamps" | "structured" | "includeStackTrace">>;
86
- //# sourceMappingURL=loggerOptions.options.d.ts.map
@@ -7,4 +7,3 @@ export const DEFAULT_LOGGER_OPTIONS = {
7
7
  structured: true,
8
8
  includeStackTrace: true,
9
9
  };
10
- //# sourceMappingURL=loggerOptions.options.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export * from "./core/index.js";
7
7
  export * from "./console/index.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export * from "./core/index.js";
7
7
  export * from "./console/index.js";
8
- //# sourceMappingURL=index.js.map
@@ -16,4 +16,3 @@ export * from "./moduleRegistry/index.js";
16
16
  export * from "./moduleLoader/index.js";
17
17
  export * from "./moduleLifecycle/index.js";
18
18
  export * from "./moduleError/index.js";
19
- //# sourceMappingURL=index.d.ts.map
@@ -43,4 +43,3 @@ export * from "./moduleLifecycle/index.js";
43
43
  * Module errors
44
44
  */
45
45
  export * from "./moduleError/index.js";
46
- //# sourceMappingURL=index.js.map
@@ -174,4 +174,3 @@ export declare function isModule(value: unknown): value is Module;
174
174
  * Useful for modules that do not require a class.
175
175
  */
176
176
  export declare function createModule(definition: Module): Module;
177
- //# sourceMappingURL=module.d.ts.map
@@ -96,4 +96,3 @@ export function isModule(value) {
96
96
  export function createModule(definition) {
97
97
  return definition;
98
98
  }
99
- //# sourceMappingURL=module.js.map
@@ -201,4 +201,3 @@ export declare function createModuleContext(options: CreateModuleContextOptions)
201
201
  * Type guard for ModuleContext.
202
202
  */
203
203
  export declare function isModuleContext(value: unknown): value is ModuleContext;
204
- //# sourceMappingURL=moduleContext.context.d.ts.map
@@ -102,4 +102,3 @@ export function isModuleContext(value) {
102
102
  typeof context.getConfig === "function" &&
103
103
  typeof context.requireConfig === "function");
104
104
  }
105
- //# sourceMappingURL=moduleContext.context.js.map
@@ -113,4 +113,3 @@ export declare function normalizeDependencies(dependencies?: readonly (ModuleId
113
113
  * Checks whether a value is a valid module definition.
114
114
  */
115
115
  export declare function isModuleDefinition(value: unknown): value is ModuleDefinition;
116
- //# sourceMappingURL=moduleDefinition.definition.d.ts.map
@@ -131,4 +131,3 @@ function validateModuleDefinition(definition) {
131
131
  dependencyIds.add(id);
132
132
  }
133
133
  }
134
- //# sourceMappingURL=moduleDefinition.definition.js.map
@@ -7,4 +7,3 @@
7
7
  export { type ModuleDependency, type ModuleDependencies, type ModuleDependencyNode, type ModuleDependencyGraph, type ModuleDependencyInput, type ModuleDependencyNodeInput, } from "./moduleDependency.type.js";
8
8
  export { normalizeModuleDependency, normalizeModuleDependencies, validateModuleDependencies, validateModuleDependencyGraph, createModuleDependencyGraph, createModuleDependency, isOptionalModuleDependency, hasModuleVersionConstraint, satisfiesModuleVersionConstraint, } from "./moduleDependency.graph.js";
9
9
  export { findModuleDependencyCycle, hasModuleDependencyCycle, resolveModuleStartupOrder, resolveModuleShutdownOrder, } from "./moduleDependency.ordering.js";
10
- //# sourceMappingURL=index.d.ts.map
@@ -7,4 +7,3 @@
7
7
  export {} from "./moduleDependency.type.js";
8
8
  export { normalizeModuleDependency, normalizeModuleDependencies, validateModuleDependencies, validateModuleDependencyGraph, createModuleDependencyGraph, createModuleDependency, isOptionalModuleDependency, hasModuleVersionConstraint, satisfiesModuleVersionConstraint, } from "./moduleDependency.graph.js";
9
9
  export { findModuleDependencyCycle, hasModuleDependencyCycle, resolveModuleStartupOrder, resolveModuleShutdownOrder, } from "./moduleDependency.ordering.js";
10
- //# sourceMappingURL=index.js.map
@@ -57,4 +57,3 @@ export declare function hasModuleVersionConstraint(dependency: ModuleDependency)
57
57
  * the dependency module declares no version at all.
58
58
  */
59
59
  export declare function satisfiesModuleVersionConstraint(constraint: string, version: string | undefined): boolean;
60
- //# sourceMappingURL=moduleDependency.graph.d.ts.map
@@ -286,4 +286,3 @@ export function satisfiesModuleVersionConstraint(constraint, version) {
286
286
  return false;
287
287
  }
288
288
  }
289
- //# sourceMappingURL=moduleDependency.graph.js.map
@@ -43,4 +43,3 @@ export declare function resolveModuleStartupOrder(graph: ModuleDependencyGraph):
43
43
  * are stopped before the modules they depend on.
44
44
  */
45
45
  export declare function resolveModuleShutdownOrder(graph: ModuleDependencyGraph): readonly ModuleId[];
46
- //# sourceMappingURL=moduleDependency.ordering.d.ts.map
@@ -137,4 +137,3 @@ export function resolveModuleStartupOrder(graph) {
137
137
  export function resolveModuleShutdownOrder(graph) {
138
138
  return Object.freeze([...resolveModuleStartupOrder(graph)].reverse());
139
139
  }
140
- //# sourceMappingURL=moduleDependency.ordering.js.map
@@ -90,4 +90,3 @@ export interface ModuleDependencyNodeInput {
90
90
  */
91
91
  readonly version?: string;
92
92
  }
93
- //# sourceMappingURL=moduleDependency.type.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=moduleDependency.type.js.map
@@ -8,4 +8,3 @@ export { InvalidModuleDefinitionError, ModuleNotFoundError, DuplicateModuleError
8
8
  export { InvalidModuleDependencyError, MissingModuleDependencyError, CircularModuleDependencyError, ModuleVersionMismatchError, } from "./moduleError.dependency.js";
9
9
  export { getLifecycleErrorCode, ModuleInstantiationError, ModuleOperationError, InvalidModuleInstanceError, InvalidModuleStateError, ModuleOperationInProgressError, } from "./moduleError.lifecycle.js";
10
10
  export { isModuleError, hasModuleErrorCode, toModuleError, } from "./moduleError.helpers.js";
11
- //# sourceMappingURL=index.d.ts.map
@@ -8,4 +8,3 @@ export { InvalidModuleDefinitionError, ModuleNotFoundError, DuplicateModuleError
8
8
  export { InvalidModuleDependencyError, MissingModuleDependencyError, CircularModuleDependencyError, ModuleVersionMismatchError, } from "./moduleError.dependency.js";
9
9
  export { getLifecycleErrorCode, ModuleInstantiationError, ModuleOperationError, InvalidModuleInstanceError, InvalidModuleStateError, ModuleOperationInProgressError, } from "./moduleError.lifecycle.js";
10
10
  export { isModuleError, hasModuleErrorCode, toModuleError, } from "./moduleError.helpers.js";
11
- //# sourceMappingURL=index.js.map
@@ -116,4 +116,3 @@ export declare class ModuleError extends FrameworkError {
116
116
  errorMetadata: Readonly<Record<string, unknown>> | undefined;
117
117
  };
118
118
  }
119
- //# sourceMappingURL=moduleError.base.d.ts.map
@@ -102,4 +102,3 @@ export class ModuleError extends FrameworkError {
102
102
  };
103
103
  }
104
104
  }
105
- //# sourceMappingURL=moduleError.base.js.map
@@ -1,10 +1,27 @@
1
1
  import type { ModuleId } from "../module.js";
2
+ import type { ModuleRegistrationState } from "../moduleRegistry/moduleRegistry.type.js";
2
3
  import { ModuleError } from "./moduleError.base.js";
3
4
  /**
4
- * Error thrown when a required module dependency is missing.
5
+ * What is known about the dependency that could not be resolved.
6
+ */
7
+ export interface MissingModuleDependencyContext {
8
+ /**
9
+ * Registration state of the dependency when it IS registered but did
10
+ * not take part in the lifecycle run (not loaded). Omitted when the
11
+ * dependency is not registered at all.
12
+ */
13
+ readonly dependencyState?: ModuleRegistrationState;
14
+ }
15
+ /**
16
+ * Error thrown when a required module dependency cannot be resolved.
17
+ *
18
+ * The message distinguishes a dependency that is not registered from
19
+ * one that is registered but was not loaded; the latter used to be
20
+ * reported as "missing module", which was misleading.
5
21
  */
6
22
  export declare class MissingModuleDependencyError extends ModuleError {
7
- constructor(moduleId: ModuleId, dependencyId: ModuleId);
23
+ readonly dependencyState?: ModuleRegistrationState;
24
+ constructor(moduleId: ModuleId, dependencyId: ModuleId, context?: MissingModuleDependencyContext);
8
25
  }
9
26
  /**
10
27
  * Error thrown when a circular dependency is detected.
@@ -53,4 +70,3 @@ export declare class ModuleVersionMismatchError extends ModuleError {
53
70
  actualVersion: string | undefined;
54
71
  };
55
72
  }
56
- //# sourceMappingURL=moduleError.dependency.d.ts.map
@@ -1,15 +1,28 @@
1
1
  import { ModuleErrorCode, ModuleError } from "./moduleError.base.js";
2
+ function describeMissingDependency(moduleId, dependencyId, dependencyState) {
3
+ if (dependencyState === undefined) {
4
+ return `Module "${moduleId}" requires missing module "${dependencyId}".`;
5
+ }
6
+ return (`Module "${moduleId}" depends on "${dependencyId}", which is registered but not loaded ` +
7
+ `(state: "${dependencyState}"). Load it before starting the lifecycle, or enable autoLoad on its definition.`);
8
+ }
2
9
  /**
3
- * Error thrown when a required module dependency is missing.
10
+ * Error thrown when a required module dependency cannot be resolved.
11
+ *
12
+ * The message distinguishes a dependency that is not registered from
13
+ * one that is registered but was not loaded; the latter used to be
14
+ * reported as "missing module", which was misleading.
4
15
  */
5
16
  export class MissingModuleDependencyError extends ModuleError {
6
- constructor(moduleId, dependencyId) {
7
- super(`Module "${moduleId}" requires missing module "${dependencyId}".`, {
17
+ dependencyState;
18
+ constructor(moduleId, dependencyId, context = {}) {
19
+ super(describeMissingDependency(moduleId, dependencyId, context.dependencyState), {
8
20
  code: ModuleErrorCode.MISSING_DEPENDENCY,
9
21
  moduleId,
10
22
  dependencyId,
11
23
  });
12
24
  this.name = "MissingModuleDependencyError";
25
+ this.dependencyState = context.dependencyState;
13
26
  }
14
27
  }
15
28
  /**
@@ -67,4 +80,3 @@ export class ModuleVersionMismatchError extends ModuleError {
67
80
  };
68
81
  }
69
82
  }
70
- //# sourceMappingURL=moduleError.dependency.js.map
@@ -19,4 +19,3 @@ export declare function toModuleError(error: unknown, options?: {
19
19
  readonly code?: ModuleErrorCode;
20
20
  readonly phase?: string;
21
21
  }): ModuleError;
22
- //# sourceMappingURL=moduleError.helpers.d.ts.map
@@ -29,4 +29,3 @@ export function toModuleError(error, options = {}) {
29
29
  cause: error,
30
30
  });
31
31
  }
32
- //# sourceMappingURL=moduleError.helpers.js.map
@@ -58,4 +58,3 @@ export declare class InvalidModuleStateError extends ModuleError {
58
58
  export declare class ModuleOperationInProgressError extends ModuleError {
59
59
  constructor(operation: string);
60
60
  }
61
- //# sourceMappingURL=moduleError.lifecycle.d.ts.map
@@ -104,4 +104,3 @@ export class ModuleOperationInProgressError extends ModuleError {
104
104
  this.name = "ModuleOperationInProgressError";
105
105
  }
106
106
  }
107
- //# sourceMappingURL=moduleError.lifecycle.js.map
@@ -18,4 +18,3 @@ export declare class ModuleNotFoundError extends ModuleError {
18
18
  export declare class DuplicateModuleError extends ModuleError {
19
19
  constructor(moduleId: ModuleId);
20
20
  }
21
- //# sourceMappingURL=moduleError.registration.d.ts.map
@@ -36,4 +36,3 @@ export class DuplicateModuleError extends ModuleError {
36
36
  this.name = "DuplicateModuleError";
37
37
  }
38
38
  }
39
- //# sourceMappingURL=moduleError.registration.js.map
@@ -10,4 +10,3 @@
10
10
  */
11
11
  export { type ModuleLifecyclePhase, type ModuleLifecycleState, type ModuleLifecycleHookName, type ModuleLifecycleStep, type ModuleLifecycleHooks, type ModuleLifecycleOptions, type ModuleLifecyclePhaseOptions, ModuleLifecycleError, type ModuleLifecycleResult, type ModuleLifecycleSkip, } from "./moduleLifecycle.type.js";
12
12
  export { ModuleLifecycleManager, createModuleLifecycleManager, } from "./moduleLifecycle.lifecycle.js";
13
- //# sourceMappingURL=index.d.ts.map
@@ -10,4 +10,3 @@
10
10
  */
11
11
  export { ModuleLifecycleError, } from "./moduleLifecycle.type.js";
12
12
  export { ModuleLifecycleManager, createModuleLifecycleManager, } from "./moduleLifecycle.lifecycle.js";
13
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Serialises module lifecycle operations, detaching one that was
3
+ * cancelled so teardown never queues behind a hook that may never settle.
4
+ */
5
+ /**
6
+ * A single-lane lock for lifecycle phases.
7
+ *
8
+ * Phases must not overlap, so each operation waits for the previous
9
+ * one — except an operation whose `signal` has been aborted. That is a
10
+ * bootstrap the startup timeout already gave up on, possibly stuck in a
11
+ * hook that never settles; `stop()`/`destroy()` used to wait behind it
12
+ * for the whole shutdown timeout (30 s by default) after `start()` had
13
+ * long since rejected. Such an operation keeps running detached: it
14
+ * starts no further hook (the phase loop checks the signal), the
15
+ * module it is stuck in stays in its active phase, which teardown
16
+ * skips, and when it finally settles `onDetachedSettled` runs so a
17
+ * module that came up late can still be torn down.
18
+ */
19
+ export declare class ExclusiveOperations {
20
+ private current;
21
+ /**
22
+ * Runs `operation` once no other (live) operation is running.
23
+ */
24
+ run<T>(operation: () => Promise<T>, signal?: AbortSignal, onDetachedSettled?: () => void): Promise<T>;
25
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Serialises module lifecycle operations, detaching one that was
3
+ * cancelled so teardown never queues behind a hook that may never settle.
4
+ */
5
+ /**
6
+ * Resolves when `work` settles or `signal` aborts, whichever is first.
7
+ */
8
+ function untilSettledOrAborted(work, signal) {
9
+ if (signal === undefined || signal.aborted)
10
+ return work;
11
+ return new Promise((resolve) => {
12
+ const done = () => {
13
+ signal.removeEventListener("abort", done);
14
+ resolve();
15
+ };
16
+ signal.addEventListener("abort", done, { once: true });
17
+ void work.then(done, done);
18
+ });
19
+ }
20
+ /**
21
+ * A single-lane lock for lifecycle phases.
22
+ *
23
+ * Phases must not overlap, so each operation waits for the previous
24
+ * one — except an operation whose `signal` has been aborted. That is a
25
+ * bootstrap the startup timeout already gave up on, possibly stuck in a
26
+ * hook that never settles; `stop()`/`destroy()` used to wait behind it
27
+ * for the whole shutdown timeout (30 s by default) after `start()` had
28
+ * long since rejected. Such an operation keeps running detached: it
29
+ * starts no further hook (the phase loop checks the signal), the
30
+ * module it is stuck in stays in its active phase, which teardown
31
+ * skips, and when it finally settles `onDetachedSettled` runs so a
32
+ * module that came up late can still be torn down.
33
+ */
34
+ export class ExclusiveOperations {
35
+ current;
36
+ /**
37
+ * Runs `operation` once no other (live) operation is running.
38
+ */
39
+ async run(operation, signal, onDetachedSettled) {
40
+ while (this.current !== undefined && !this.current.signal?.aborted) {
41
+ await untilSettledOrAborted(this.current.done, this.current.signal);
42
+ }
43
+ let release = () => undefined;
44
+ const held = {
45
+ done: new Promise((resolve) => {
46
+ release = resolve;
47
+ }),
48
+ signal,
49
+ };
50
+ this.current = held;
51
+ try {
52
+ return await operation();
53
+ }
54
+ finally {
55
+ const detached = this.current !== held;
56
+ if (!detached)
57
+ this.current = undefined;
58
+ release();
59
+ if (detached)
60
+ onDetachedSettled?.();
61
+ }
62
+ }
63
+ }
@@ -14,7 +14,8 @@ export declare class ModuleLifecycleManager {
14
14
  private readonly options;
15
15
  private readonly contextStorage;
16
16
  private readonly states;
17
- private operation;
17
+ private readonly exclusive;
18
+ private tornDown;
18
19
  constructor(registry: ModuleRegistry, loader: ModuleLoader, options?: ModuleLifecycleOptions);
19
20
  initialize(options?: ModuleLifecyclePhaseOptions): Promise<ModuleLifecycleResult>;
20
21
  start(options?: ModuleLifecyclePhaseOptions): Promise<ModuleLifecycleResult>;
@@ -88,9 +89,27 @@ export declare class ModuleLifecycleManager {
88
89
  * as edges so the ordering reports them as missing.
89
90
  */
90
91
  private createGraph;
92
+ /**
93
+ * Startup order over the loaded modules. A dependency that is
94
+ * registered but not loaded used to be reported as a "missing
95
+ * module", which sent people looking for a typo; it is now described
96
+ * by its registration state.
97
+ */
91
98
  private getStartupOrder;
92
99
  private getShutdownOrder;
100
+ /**
101
+ * Serialises operations. One whose `signal` was aborted (a bootstrap
102
+ * abandoned by the startup timeout) is not waited for, so `stop()`
103
+ * and `destroy()` no longer queue behind a hook that may never
104
+ * settle; a module whose hook does settle later is torn down then.
105
+ */
93
106
  private runExclusive;
107
+ /**
108
+ * Best-effort teardown for modules an abandoned startup brought up
109
+ * after the runtime had already been shut down. Failures land on the
110
+ * module's lifecycle state as they would for any stop/destroy.
111
+ */
112
+ private finalizeLateModules;
94
113
  }
95
114
  /**
96
115
  * Resolves the dependencies of a registration: definition-declared
@@ -101,4 +120,3 @@ export declare class ModuleLifecycleManager {
101
120
  export declare function resolveRegistrationDependencies(registry: ModuleRegistry, registration: ModuleRegistration): readonly ModuleDependency[];
102
121
  /** Creates a module lifecycle manager. */
103
122
  export declare function createModuleLifecycleManager(registry: ModuleRegistry, loader: ModuleLoader, options?: ModuleLifecycleOptions): ModuleLifecycleManager;
104
- //# sourceMappingURL=moduleLifecycle.lifecycle.d.ts.map