@endora-commerce/platform 0.100.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 (657) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -0
  3. package/dist/cli/dispatch.d.ts +146 -0
  4. package/dist/cli/dispatch.d.ts.map +1 -0
  5. package/dist/cli/dispatch.js +259 -0
  6. package/dist/cli/dispatch.js.map +1 -0
  7. package/dist/cli/index.d.ts +58 -0
  8. package/dist/cli/index.d.ts.map +1 -0
  9. package/dist/cli/index.js +58 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/cli/module-commands.d.ts +118 -0
  12. package/dist/cli/module-commands.d.ts.map +1 -0
  13. package/dist/cli/module-commands.js +120 -0
  14. package/dist/cli/module-commands.js.map +1 -0
  15. package/dist/commands/actor.d.ts +19 -0
  16. package/dist/commands/actor.d.ts.map +1 -0
  17. package/dist/commands/actor.js +45 -0
  18. package/dist/commands/actor.js.map +1 -0
  19. package/dist/commands/audit-from-context.d.ts +24 -0
  20. package/dist/commands/audit-from-context.d.ts.map +1 -0
  21. package/dist/commands/audit-from-context.js +28 -0
  22. package/dist/commands/audit-from-context.js.map +1 -0
  23. package/dist/commands/command-bus.d.ts +40 -0
  24. package/dist/commands/command-bus.d.ts.map +1 -0
  25. package/dist/commands/command-bus.js +46 -0
  26. package/dist/commands/command-bus.js.map +1 -0
  27. package/dist/commands/command.d.ts +76 -0
  28. package/dist/commands/command.d.ts.map +1 -0
  29. package/dist/commands/command.js +2 -0
  30. package/dist/commands/command.js.map +1 -0
  31. package/dist/commands/index.d.ts +65 -0
  32. package/dist/commands/index.d.ts.map +1 -0
  33. package/dist/commands/index.js +57 -0
  34. package/dist/commands/index.js.map +1 -0
  35. package/dist/commands/reversible.d.ts +66 -0
  36. package/dist/commands/reversible.d.ts.map +1 -0
  37. package/dist/commands/reversible.js +41 -0
  38. package/dist/commands/reversible.js.map +1 -0
  39. package/dist/composition/compose-app.d.ts +305 -0
  40. package/dist/composition/compose-app.d.ts.map +1 -0
  41. package/dist/composition/compose-app.js +939 -0
  42. package/dist/composition/compose-app.js.map +1 -0
  43. package/dist/composition/index.d.ts +92 -0
  44. package/dist/composition/index.d.ts.map +1 -0
  45. package/dist/composition/index.js +175 -0
  46. package/dist/composition/index.js.map +1 -0
  47. package/dist/composition/newsletter-token-secret.d.ts +19 -0
  48. package/dist/composition/newsletter-token-secret.d.ts.map +1 -0
  49. package/dist/composition/newsletter-token-secret.js +24 -0
  50. package/dist/composition/newsletter-token-secret.js.map +1 -0
  51. package/dist/composition/process-runs-workers.d.ts +17 -0
  52. package/dist/composition/process-runs-workers.d.ts.map +1 -0
  53. package/dist/composition/process-runs-workers.js +19 -0
  54. package/dist/composition/process-runs-workers.js.map +1 -0
  55. package/dist/db/baseline-migration-inventory.d.ts +15 -0
  56. package/dist/db/baseline-migration-inventory.d.ts.map +1 -0
  57. package/dist/db/baseline-migration-inventory.js +115 -0
  58. package/dist/db/baseline-migration-inventory.js.map +1 -0
  59. package/dist/db/configured-entities.d.ts +74 -0
  60. package/dist/db/configured-entities.d.ts.map +1 -0
  61. package/dist/db/configured-entities.js +20 -0
  62. package/dist/db/configured-entities.js.map +1 -0
  63. package/dist/db/configured-migrations.d.ts +199 -0
  64. package/dist/db/configured-migrations.d.ts.map +1 -0
  65. package/dist/db/configured-migrations.js +181 -0
  66. package/dist/db/configured-migrations.js.map +1 -0
  67. package/dist/db/index.d.ts +54 -0
  68. package/dist/db/index.d.ts.map +1 -0
  69. package/dist/db/index.js +54 -0
  70. package/dist/db/index.js.map +1 -0
  71. package/dist/db/migrate.d.ts +21 -0
  72. package/dist/db/migrate.d.ts.map +1 -0
  73. package/dist/db/migrate.js +48 -0
  74. package/dist/db/migrate.js.map +1 -0
  75. package/dist/db/migration-order.d.ts +159 -0
  76. package/dist/db/migration-order.d.ts.map +1 -0
  77. package/dist/db/migration-order.js +273 -0
  78. package/dist/db/migration-order.js.map +1 -0
  79. package/dist/db/mikro-orm.config.d.ts +51 -0
  80. package/dist/db/mikro-orm.config.d.ts.map +1 -0
  81. package/dist/db/mikro-orm.config.js +64 -0
  82. package/dist/db/mikro-orm.config.js.map +1 -0
  83. package/dist/db/orm.d.ts +40 -0
  84. package/dist/db/orm.d.ts.map +1 -0
  85. package/dist/db/orm.js +25 -0
  86. package/dist/db/orm.js.map +1 -0
  87. package/dist/db/platform-schema.d.ts +102 -0
  88. package/dist/db/platform-schema.d.ts.map +1 -0
  89. package/dist/db/platform-schema.js +79 -0
  90. package/dist/db/platform-schema.js.map +1 -0
  91. package/dist/db/pluralizing-naming-strategy.d.ts +16 -0
  92. package/dist/db/pluralizing-naming-strategy.d.ts.map +1 -0
  93. package/dist/db/pluralizing-naming-strategy.js +66 -0
  94. package/dist/db/pluralizing-naming-strategy.js.map +1 -0
  95. package/dist/demo/guard.d.ts +101 -0
  96. package/dist/demo/guard.d.ts.map +1 -0
  97. package/dist/demo/guard.js +168 -0
  98. package/dist/demo/guard.js.map +1 -0
  99. package/dist/demo/host-command.d.ts +133 -0
  100. package/dist/demo/host-command.d.ts.map +1 -0
  101. package/dist/demo/host-command.js +113 -0
  102. package/dist/demo/host-command.js.map +1 -0
  103. package/dist/demo/index.d.ts +82 -0
  104. package/dist/demo/index.d.ts.map +1 -0
  105. package/dist/demo/index.js +82 -0
  106. package/dist/demo/index.js.map +1 -0
  107. package/dist/demo/packages.d.ts +67 -0
  108. package/dist/demo/packages.d.ts.map +1 -0
  109. package/dist/demo/packages.js +132 -0
  110. package/dist/demo/packages.js.map +1 -0
  111. package/dist/demo/plan.d.ts +111 -0
  112. package/dist/demo/plan.d.ts.map +1 -0
  113. package/dist/demo/plan.js +74 -0
  114. package/dist/demo/plan.js.map +1 -0
  115. package/dist/demo/report.d.ts +17 -0
  116. package/dist/demo/report.d.ts.map +1 -0
  117. package/dist/demo/report.js +85 -0
  118. package/dist/demo/report.js.map +1 -0
  119. package/dist/demo/runner.d.ts +207 -0
  120. package/dist/demo/runner.d.ts.map +1 -0
  121. package/dist/demo/runner.js +169 -0
  122. package/dist/demo/runner.js.map +1 -0
  123. package/dist/demo/scope.d.ts +44 -0
  124. package/dist/demo/scope.d.ts.map +1 -0
  125. package/dist/demo/scope.js +44 -0
  126. package/dist/demo/scope.js.map +1 -0
  127. package/dist/env/index.d.ts +68 -0
  128. package/dist/env/index.d.ts.map +1 -0
  129. package/dist/env/index.js +427 -0
  130. package/dist/env/index.js.map +1 -0
  131. package/dist/events/bus.d.ts +29 -0
  132. package/dist/events/bus.d.ts.map +1 -0
  133. package/dist/events/bus.js +67 -0
  134. package/dist/events/bus.js.map +1 -0
  135. package/dist/events/index.d.ts +19 -0
  136. package/dist/events/index.d.ts.map +1 -0
  137. package/dist/events/index.js +19 -0
  138. package/dist/events/index.js.map +1 -0
  139. package/dist/http/cursor.d.ts +10 -0
  140. package/dist/http/cursor.d.ts.map +1 -0
  141. package/dist/http/cursor.js +20 -0
  142. package/dist/http/cursor.js.map +1 -0
  143. package/dist/http/error-envelope.d.ts +127 -0
  144. package/dist/http/error-envelope.d.ts.map +1 -0
  145. package/dist/http/error-envelope.js +402 -0
  146. package/dist/http/error-envelope.js.map +1 -0
  147. package/dist/http/health.d.ts +88 -0
  148. package/dist/http/health.d.ts.map +1 -0
  149. package/dist/http/health.js +77 -0
  150. package/dist/http/health.js.map +1 -0
  151. package/dist/http/index.d.ts +50 -0
  152. package/dist/http/index.d.ts.map +1 -0
  153. package/dist/http/index.js +50 -0
  154. package/dist/http/index.js.map +1 -0
  155. package/dist/http/interceptors/dispatch.d.ts +14 -0
  156. package/dist/http/interceptors/dispatch.d.ts.map +1 -0
  157. package/dist/http/interceptors/dispatch.js +113 -0
  158. package/dist/http/interceptors/dispatch.js.map +1 -0
  159. package/dist/http/interceptors/index.d.ts +6 -0
  160. package/dist/http/interceptors/index.d.ts.map +1 -0
  161. package/dist/http/interceptors/index.js +5 -0
  162. package/dist/http/interceptors/index.js.map +1 -0
  163. package/dist/http/interceptors/registry.d.ts +44 -0
  164. package/dist/http/interceptors/registry.d.ts.map +1 -0
  165. package/dist/http/interceptors/registry.js +123 -0
  166. package/dist/http/interceptors/registry.js.map +1 -0
  167. package/dist/http/interceptors/route-table.d.ts +33 -0
  168. package/dist/http/interceptors/route-table.d.ts.map +1 -0
  169. package/dist/http/interceptors/route-table.js +39 -0
  170. package/dist/http/interceptors/route-table.js.map +1 -0
  171. package/dist/http/interceptors/types.d.ts +101 -0
  172. package/dist/http/interceptors/types.d.ts.map +1 -0
  173. package/dist/http/interceptors/types.js +2 -0
  174. package/dist/http/interceptors/types.js.map +1 -0
  175. package/dist/http/interceptors/validation.d.ts +22 -0
  176. package/dist/http/interceptors/validation.d.ts.map +1 -0
  177. package/dist/http/interceptors/validation.js +39 -0
  178. package/dist/http/interceptors/validation.js.map +1 -0
  179. package/dist/http/logger.d.ts +9 -0
  180. package/dist/http/logger.d.ts.map +1 -0
  181. package/dist/http/logger.js +25 -0
  182. package/dist/http/logger.js.map +1 -0
  183. package/dist/http/openapi.d.ts +21 -0
  184. package/dist/http/openapi.d.ts.map +1 -0
  185. package/dist/http/openapi.js +114 -0
  186. package/dist/http/openapi.js.map +1 -0
  187. package/dist/http/product-audience.d.ts +78 -0
  188. package/dist/http/product-audience.d.ts.map +1 -0
  189. package/dist/http/product-audience.js +92 -0
  190. package/dist/http/product-audience.js.map +1 -0
  191. package/dist/http/request-actor.d.ts +82 -0
  192. package/dist/http/request-actor.d.ts.map +1 -0
  193. package/dist/http/request-actor.js +2 -0
  194. package/dist/http/request-actor.js.map +1 -0
  195. package/dist/http/server.d.ts +60 -0
  196. package/dist/http/server.d.ts.map +1 -0
  197. package/dist/http/server.js +117 -0
  198. package/dist/http/server.js.map +1 -0
  199. package/dist/http/storefront-revalidator.d.ts +29 -0
  200. package/dist/http/storefront-revalidator.d.ts.map +1 -0
  201. package/dist/http/storefront-revalidator.js +34 -0
  202. package/dist/http/storefront-revalidator.js.map +1 -0
  203. package/dist/http/test-actor-carrier.d.ts +28 -0
  204. package/dist/http/test-actor-carrier.d.ts.map +1 -0
  205. package/dist/http/test-actor-carrier.js +10 -0
  206. package/dist/http/test-actor-carrier.js.map +1 -0
  207. package/dist/http/trusted-proxy.d.ts +48 -0
  208. package/dist/http/trusted-proxy.d.ts.map +1 -0
  209. package/dist/http/trusted-proxy.js +136 -0
  210. package/dist/http/trusted-proxy.js.map +1 -0
  211. package/dist/kernel/audit/audit-log-entry.entity.d.ts +33 -0
  212. package/dist/kernel/audit/audit-log-entry.entity.d.ts.map +1 -0
  213. package/dist/kernel/audit/audit-log-entry.entity.js +102 -0
  214. package/dist/kernel/audit/audit-log-entry.entity.js.map +1 -0
  215. package/dist/kernel/audit/audit-log-service.d.ts +63 -0
  216. package/dist/kernel/audit/audit-log-service.d.ts.map +1 -0
  217. package/dist/kernel/audit/audit-log-service.js +107 -0
  218. package/dist/kernel/audit/audit-log-service.js.map +1 -0
  219. package/dist/kernel/cache/in-process-cache-registry.d.ts +93 -0
  220. package/dist/kernel/cache/in-process-cache-registry.d.ts.map +1 -0
  221. package/dist/kernel/cache/in-process-cache-registry.js +78 -0
  222. package/dist/kernel/cache/in-process-cache-registry.js.map +1 -0
  223. package/dist/kernel/cache/shared-drop-marks.d.ts +39 -0
  224. package/dist/kernel/cache/shared-drop-marks.d.ts.map +1 -0
  225. package/dist/kernel/cache/shared-drop-marks.js +68 -0
  226. package/dist/kernel/cache/shared-drop-marks.js.map +1 -0
  227. package/dist/kernel/compose.d.ts +234 -0
  228. package/dist/kernel/compose.d.ts.map +1 -0
  229. package/dist/kernel/compose.js +279 -0
  230. package/dist/kernel/compose.js.map +1 -0
  231. package/dist/kernel/container.d.ts +95 -0
  232. package/dist/kernel/container.d.ts.map +1 -0
  233. package/dist/kernel/container.js +90 -0
  234. package/dist/kernel/container.js.map +1 -0
  235. package/dist/kernel/contribution-sinks.d.ts +106 -0
  236. package/dist/kernel/contribution-sinks.d.ts.map +1 -0
  237. package/dist/kernel/contribution-sinks.js +153 -0
  238. package/dist/kernel/contribution-sinks.js.map +1 -0
  239. package/dist/kernel/crypto/password-hasher.d.ts +3 -0
  240. package/dist/kernel/crypto/password-hasher.d.ts.map +1 -0
  241. package/dist/kernel/crypto/password-hasher.js +44 -0
  242. package/dist/kernel/crypto/password-hasher.js.map +1 -0
  243. package/dist/kernel/i18n/error-envelope-options.d.ts +56 -0
  244. package/dist/kernel/i18n/error-envelope-options.d.ts.map +1 -0
  245. package/dist/kernel/i18n/error-envelope-options.js +46 -0
  246. package/dist/kernel/i18n/error-envelope-options.js.map +1 -0
  247. package/dist/kernel/i18n/error-translation.d.ts +144 -0
  248. package/dist/kernel/i18n/error-translation.d.ts.map +1 -0
  249. package/dist/kernel/i18n/error-translation.js +84 -0
  250. package/dist/kernel/i18n/error-translation.js.map +1 -0
  251. package/dist/kernel/i18n/request-language.d.ts +80 -0
  252. package/dist/kernel/i18n/request-language.d.ts.map +1 -0
  253. package/dist/kernel/i18n/request-language.js +168 -0
  254. package/dist/kernel/i18n/request-language.js.map +1 -0
  255. package/dist/kernel/index.d.ts +142 -0
  256. package/dist/kernel/index.d.ts.map +1 -0
  257. package/dist/kernel/index.js +160 -0
  258. package/dist/kernel/index.js.map +1 -0
  259. package/dist/kernel/lazy-port.d.ts +59 -0
  260. package/dist/kernel/lazy-port.d.ts.map +1 -0
  261. package/dist/kernel/lazy-port.js +78 -0
  262. package/dist/kernel/lazy-port.js.map +1 -0
  263. package/dist/kernel/lifecycle/activation-resolver.d.ts +63 -0
  264. package/dist/kernel/lifecycle/activation-resolver.d.ts.map +1 -0
  265. package/dist/kernel/lifecycle/activation-resolver.js +70 -0
  266. package/dist/kernel/lifecycle/activation-resolver.js.map +1 -0
  267. package/dist/kernel/lifecycle/capability-registry.d.ts +145 -0
  268. package/dist/kernel/lifecycle/capability-registry.d.ts.map +1 -0
  269. package/dist/kernel/lifecycle/capability-registry.js +170 -0
  270. package/dist/kernel/lifecycle/capability-registry.js.map +1 -0
  271. package/dist/kernel/lifecycle/effective-state.d.ts +126 -0
  272. package/dist/kernel/lifecycle/effective-state.d.ts.map +1 -0
  273. package/dist/kernel/lifecycle/effective-state.js +111 -0
  274. package/dist/kernel/lifecycle/effective-state.js.map +1 -0
  275. package/dist/kernel/lifecycle/module-registration.entity.d.ts +57 -0
  276. package/dist/kernel/lifecycle/module-registration.entity.d.ts.map +1 -0
  277. package/dist/kernel/lifecycle/module-registration.entity.js +111 -0
  278. package/dist/kernel/lifecycle/module-registration.entity.js.map +1 -0
  279. package/dist/kernel/lifecycle/plugin-helpers.d.ts +165 -0
  280. package/dist/kernel/lifecycle/plugin-helpers.d.ts.map +1 -0
  281. package/dist/kernel/lifecycle/plugin-helpers.js +395 -0
  282. package/dist/kernel/lifecycle/plugin-helpers.js.map +1 -0
  283. package/dist/kernel/lifecycle/registry-cache.d.ts +318 -0
  284. package/dist/kernel/lifecycle/registry-cache.d.ts.map +1 -0
  285. package/dist/kernel/lifecycle/registry-cache.js +509 -0
  286. package/dist/kernel/lifecycle/registry-cache.js.map +1 -0
  287. package/dist/kernel/lifecycle/required-modules.d.ts +137 -0
  288. package/dist/kernel/lifecycle/required-modules.d.ts.map +1 -0
  289. package/dist/kernel/lifecycle/required-modules.js +80 -0
  290. package/dist/kernel/lifecycle/required-modules.js.map +1 -0
  291. package/dist/kernel/lifecycle/unique-module-ids.d.ts +58 -0
  292. package/dist/kernel/lifecycle/unique-module-ids.d.ts.map +1 -0
  293. package/dist/kernel/lifecycle/unique-module-ids.js +82 -0
  294. package/dist/kernel/lifecycle/unique-module-ids.js.map +1 -0
  295. package/dist/kernel/logging.d.ts +116 -0
  296. package/dist/kernel/logging.d.ts.map +1 -0
  297. package/dist/kernel/logging.js +71 -0
  298. package/dist/kernel/logging.js.map +1 -0
  299. package/dist/kernel/module-context.d.ts +563 -0
  300. package/dist/kernel/module-context.d.ts.map +1 -0
  301. package/dist/kernel/module-context.js +670 -0
  302. package/dist/kernel/module-context.js.map +1 -0
  303. package/dist/kernel/ports/audit.d.ts +115 -0
  304. package/dist/kernel/ports/audit.d.ts.map +1 -0
  305. package/dist/kernel/ports/audit.js +2 -0
  306. package/dist/kernel/ports/audit.js.map +1 -0
  307. package/dist/kernel/ports/organizations.d.ts +56 -0
  308. package/dist/kernel/ports/organizations.d.ts.map +1 -0
  309. package/dist/kernel/ports/organizations.js +2 -0
  310. package/dist/kernel/ports/organizations.js.map +1 -0
  311. package/dist/kernel/ports/provide.d.ts +14 -0
  312. package/dist/kernel/ports/provide.d.ts.map +1 -0
  313. package/dist/kernel/ports/provide.js +50 -0
  314. package/dist/kernel/ports/provide.js.map +1 -0
  315. package/dist/kernel/ports/require-admin.d.ts +61 -0
  316. package/dist/kernel/ports/require-admin.d.ts.map +1 -0
  317. package/dist/kernel/ports/require-admin.js +2 -0
  318. package/dist/kernel/ports/require-admin.js.map +1 -0
  319. package/dist/kernel/ports/require-customer.d.ts +17 -0
  320. package/dist/kernel/ports/require-customer.d.ts.map +1 -0
  321. package/dist/kernel/ports/require-customer.js +2 -0
  322. package/dist/kernel/ports/require-customer.js.map +1 -0
  323. package/dist/kernel/ports/sales-channel.d.ts +84 -0
  324. package/dist/kernel/ports/sales-channel.d.ts.map +1 -0
  325. package/dist/kernel/ports/sales-channel.js +2 -0
  326. package/dist/kernel/ports/sales-channel.js.map +1 -0
  327. package/dist/kernel/ports/settings.d.ts +59 -0
  328. package/dist/kernel/ports/settings.d.ts.map +1 -0
  329. package/dist/kernel/ports/settings.js +2 -0
  330. package/dist/kernel/ports/settings.js.map +1 -0
  331. package/dist/kernel/public-api-base-url.d.ts +98 -0
  332. package/dist/kernel/public-api-base-url.d.ts.map +1 -0
  333. package/dist/kernel/public-api-base-url.js +144 -0
  334. package/dist/kernel/public-api-base-url.js.map +1 -0
  335. package/dist/kernel/request-scope-hook.d.ts +63 -0
  336. package/dist/kernel/request-scope-hook.d.ts.map +1 -0
  337. package/dist/kernel/request-scope-hook.js +67 -0
  338. package/dist/kernel/request-scope-hook.js.map +1 -0
  339. package/dist/kernel/sales-channels/channel-bridge-registry.d.ts +109 -0
  340. package/dist/kernel/sales-channels/channel-bridge-registry.d.ts.map +1 -0
  341. package/dist/kernel/sales-channels/channel-bridge-registry.js +75 -0
  342. package/dist/kernel/sales-channels/channel-bridge-registry.js.map +1 -0
  343. package/dist/kernel/sales-channels/compose.d.ts +69 -0
  344. package/dist/kernel/sales-channels/compose.d.ts.map +1 -0
  345. package/dist/kernel/sales-channels/compose.js +43 -0
  346. package/dist/kernel/sales-channels/compose.js.map +1 -0
  347. package/dist/kernel/sales-channels/default-channel-reconciler.d.ts +66 -0
  348. package/dist/kernel/sales-channels/default-channel-reconciler.d.ts.map +1 -0
  349. package/dist/kernel/sales-channels/default-channel-reconciler.js +91 -0
  350. package/dist/kernel/sales-channels/default-channel-reconciler.js.map +1 -0
  351. package/dist/kernel/sales-channels/no-system-default-channel.error.d.ts +28 -0
  352. package/dist/kernel/sales-channels/no-system-default-channel.error.d.ts.map +1 -0
  353. package/dist/kernel/sales-channels/no-system-default-channel.error.js +33 -0
  354. package/dist/kernel/sales-channels/no-system-default-channel.error.js.map +1 -0
  355. package/dist/kernel/sales-channels/request-channel-assortment.d.ts +72 -0
  356. package/dist/kernel/sales-channels/request-channel-assortment.d.ts.map +1 -0
  357. package/dist/kernel/sales-channels/request-channel-assortment.js +83 -0
  358. package/dist/kernel/sales-channels/request-channel-assortment.js.map +1 -0
  359. package/dist/kernel/sales-channels/sales-channel-membership.service.d.ts +157 -0
  360. package/dist/kernel/sales-channels/sales-channel-membership.service.d.ts.map +1 -0
  361. package/dist/kernel/sales-channels/sales-channel-membership.service.js +302 -0
  362. package/dist/kernel/sales-channels/sales-channel-membership.service.js.map +1 -0
  363. package/dist/kernel/sales-channels/sales-channel-resolver.middleware.d.ts +76 -0
  364. package/dist/kernel/sales-channels/sales-channel-resolver.middleware.d.ts.map +1 -0
  365. package/dist/kernel/sales-channels/sales-channel-resolver.middleware.js +184 -0
  366. package/dist/kernel/sales-channels/sales-channel-resolver.middleware.js.map +1 -0
  367. package/dist/kernel/sales-channels/sales-channel-resolver.service.d.ts +82 -0
  368. package/dist/kernel/sales-channels/sales-channel-resolver.service.d.ts.map +1 -0
  369. package/dist/kernel/sales-channels/sales-channel-resolver.service.js +126 -0
  370. package/dist/kernel/sales-channels/sales-channel-resolver.service.js.map +1 -0
  371. package/dist/kernel/sales-channels/sales-channel.entity.d.ts +50 -0
  372. package/dist/kernel/sales-channels/sales-channel.entity.d.ts.map +1 -0
  373. package/dist/kernel/sales-channels/sales-channel.entity.js +132 -0
  374. package/dist/kernel/sales-channels/sales-channel.entity.js.map +1 -0
  375. package/dist/kernel/sales-channels/sales-channels-cache.d.ts +170 -0
  376. package/dist/kernel/sales-channels/sales-channels-cache.d.ts.map +1 -0
  377. package/dist/kernel/sales-channels/sales-channels-cache.js +243 -0
  378. package/dist/kernel/sales-channels/sales-channels-cache.js.map +1 -0
  379. package/dist/kernel/scope.d.ts +153 -0
  380. package/dist/kernel/scope.d.ts.map +1 -0
  381. package/dist/kernel/scope.js +172 -0
  382. package/dist/kernel/scope.js.map +1 -0
  383. package/dist/kernel/settings/compose.d.ts +49 -0
  384. package/dist/kernel/settings/compose.d.ts.map +1 -0
  385. package/dist/kernel/settings/compose.js +21 -0
  386. package/dist/kernel/settings/compose.js.map +1 -0
  387. package/dist/kernel/settings/manifest-reconciler.d.ts +78 -0
  388. package/dist/kernel/settings/manifest-reconciler.d.ts.map +1 -0
  389. package/dist/kernel/settings/manifest-reconciler.js +343 -0
  390. package/dist/kernel/settings/manifest-reconciler.js.map +1 -0
  391. package/dist/kernel/settings/secret-value-codec.d.ts +52 -0
  392. package/dist/kernel/settings/secret-value-codec.d.ts.map +1 -0
  393. package/dist/kernel/settings/secret-value-codec.js +102 -0
  394. package/dist/kernel/settings/secret-value-codec.js.map +1 -0
  395. package/dist/kernel/settings/setting-group.entity.d.ts +25 -0
  396. package/dist/kernel/settings/setting-group.entity.d.ts.map +1 -0
  397. package/dist/kernel/settings/setting-group.entity.js +79 -0
  398. package/dist/kernel/settings/setting-group.entity.js.map +1 -0
  399. package/dist/kernel/settings/setting-value.entity.d.ts +23 -0
  400. package/dist/kernel/settings/setting-value.entity.d.ts.map +1 -0
  401. package/dist/kernel/settings/setting-value.entity.js +66 -0
  402. package/dist/kernel/settings/setting-value.entity.js.map +1 -0
  403. package/dist/kernel/settings/setting.entity.d.ts +56 -0
  404. package/dist/kernel/settings/setting.entity.d.ts.map +1 -0
  405. package/dist/kernel/settings/setting.entity.js +147 -0
  406. package/dist/kernel/settings/setting.entity.js.map +1 -0
  407. package/dist/kernel/settings/settings-cache.d.ts +158 -0
  408. package/dist/kernel/settings/settings-cache.d.ts.map +1 -0
  409. package/dist/kernel/settings/settings-cache.js +253 -0
  410. package/dist/kernel/settings/settings-cache.js.map +1 -0
  411. package/dist/kernel/settings/settings.service.d.ts +142 -0
  412. package/dist/kernel/settings/settings.service.d.ts.map +1 -0
  413. package/dist/kernel/settings/settings.service.js +294 -0
  414. package/dist/kernel/settings/settings.service.js.map +1 -0
  415. package/dist/lifecycle/backend.d.ts +51 -0
  416. package/dist/lifecycle/backend.d.ts.map +1 -0
  417. package/dist/lifecycle/backend.js +40 -0
  418. package/dist/lifecycle/backend.js.map +1 -0
  419. package/dist/lifecycle/commands/activation.commands.d.ts +97 -0
  420. package/dist/lifecycle/commands/activation.commands.d.ts.map +1 -0
  421. package/dist/lifecycle/commands/activation.commands.js +142 -0
  422. package/dist/lifecycle/commands/activation.commands.js.map +1 -0
  423. package/dist/lifecycle/commands/disable.d.ts +3 -0
  424. package/dist/lifecycle/commands/disable.d.ts.map +1 -0
  425. package/dist/lifecycle/commands/disable.js +126 -0
  426. package/dist/lifecycle/commands/disable.js.map +1 -0
  427. package/dist/lifecycle/commands/enable.d.ts +3 -0
  428. package/dist/lifecycle/commands/enable.d.ts.map +1 -0
  429. package/dist/lifecycle/commands/enable.js +102 -0
  430. package/dist/lifecycle/commands/enable.js.map +1 -0
  431. package/dist/lifecycle/commands/install.d.ts +3 -0
  432. package/dist/lifecycle/commands/install.d.ts.map +1 -0
  433. package/dist/lifecycle/commands/install.js +263 -0
  434. package/dist/lifecycle/commands/install.js.map +1 -0
  435. package/dist/lifecycle/commands/operator-entry.d.ts +104 -0
  436. package/dist/lifecycle/commands/operator-entry.d.ts.map +1 -0
  437. package/dist/lifecycle/commands/operator-entry.js +127 -0
  438. package/dist/lifecycle/commands/operator-entry.js.map +1 -0
  439. package/dist/lifecycle/commands/operator-runtime.d.ts +147 -0
  440. package/dist/lifecycle/commands/operator-runtime.d.ts.map +1 -0
  441. package/dist/lifecycle/commands/operator-runtime.js +40 -0
  442. package/dist/lifecycle/commands/operator-runtime.js.map +1 -0
  443. package/dist/lifecycle/commands/status.d.ts +3 -0
  444. package/dist/lifecycle/commands/status.d.ts.map +1 -0
  445. package/dist/lifecycle/commands/status.js +108 -0
  446. package/dist/lifecycle/commands/status.js.map +1 -0
  447. package/dist/lifecycle/commands/uninstall.d.ts +3 -0
  448. package/dist/lifecycle/commands/uninstall.d.ts.map +1 -0
  449. package/dist/lifecycle/commands/uninstall.js +223 -0
  450. package/dist/lifecycle/commands/uninstall.js.map +1 -0
  451. package/dist/lifecycle/divergence-declaration.d.ts +74 -0
  452. package/dist/lifecycle/divergence-declaration.d.ts.map +1 -0
  453. package/dist/lifecycle/divergence-declaration.js +92 -0
  454. package/dist/lifecycle/divergence-declaration.js.map +1 -0
  455. package/dist/lifecycle/i18n/en.json +4 -0
  456. package/dist/lifecycle/i18n/pl.json +4 -0
  457. package/dist/lifecycle/index.d.ts +110 -0
  458. package/dist/lifecycle/index.d.ts.map +1 -0
  459. package/dist/lifecycle/index.js +189 -0
  460. package/dist/lifecycle/index.js.map +1 -0
  461. package/dist/lifecycle/manifest-registry.d.ts +244 -0
  462. package/dist/lifecycle/manifest-registry.d.ts.map +1 -0
  463. package/dist/lifecycle/manifest-registry.js +223 -0
  464. package/dist/lifecycle/manifest-registry.js.map +1 -0
  465. package/dist/lifecycle/manifest.d.ts +166 -0
  466. package/dist/lifecycle/manifest.d.ts.map +1 -0
  467. package/dist/lifecycle/manifest.js +121 -0
  468. package/dist/lifecycle/manifest.js.map +1 -0
  469. package/dist/lifecycle/plugin.d.ts +56 -0
  470. package/dist/lifecycle/plugin.d.ts.map +1 -0
  471. package/dist/lifecycle/plugin.js +59 -0
  472. package/dist/lifecycle/plugin.js.map +1 -0
  473. package/dist/lifecycle/resident.d.ts +16 -0
  474. package/dist/lifecycle/resident.d.ts.map +1 -0
  475. package/dist/lifecycle/resident.js +59 -0
  476. package/dist/lifecycle/resident.js.map +1 -0
  477. package/dist/lifecycle/routes.admin.d.ts +57 -0
  478. package/dist/lifecycle/routes.admin.d.ts.map +1 -0
  479. package/dist/lifecycle/routes.admin.js +162 -0
  480. package/dist/lifecycle/routes.admin.js.map +1 -0
  481. package/dist/lifecycle/routes.storefront.d.ts +26 -0
  482. package/dist/lifecycle/routes.storefront.d.ts.map +1 -0
  483. package/dist/lifecycle/routes.storefront.js +36 -0
  484. package/dist/lifecycle/routes.storefront.js.map +1 -0
  485. package/dist/lifecycle/services/deactivation-ledger.d.ts +216 -0
  486. package/dist/lifecycle/services/deactivation-ledger.d.ts.map +1 -0
  487. package/dist/lifecycle/services/deactivation-ledger.js +171 -0
  488. package/dist/lifecycle/services/deactivation-ledger.js.map +1 -0
  489. package/dist/lifecycle/services/dep-graph.d.ts +119 -0
  490. package/dist/lifecycle/services/dep-graph.d.ts.map +1 -0
  491. package/dist/lifecycle/services/dep-graph.js +334 -0
  492. package/dist/lifecycle/services/dep-graph.js.map +1 -0
  493. package/dist/lifecycle/services/gating-graph.d.ts +164 -0
  494. package/dist/lifecycle/services/gating-graph.d.ts.map +1 -0
  495. package/dist/lifecycle/services/gating-graph.js +203 -0
  496. package/dist/lifecycle/services/gating-graph.js.map +1 -0
  497. package/dist/lifecycle/services/lock.d.ts +27 -0
  498. package/dist/lifecycle/services/lock.d.ts.map +1 -0
  499. package/dist/lifecycle/services/lock.js +82 -0
  500. package/dist/lifecycle/services/lock.js.map +1 -0
  501. package/dist/lifecycle/services/manifest-loader.d.ts +125 -0
  502. package/dist/lifecycle/services/manifest-loader.d.ts.map +1 -0
  503. package/dist/lifecycle/services/manifest-loader.js +210 -0
  504. package/dist/lifecycle/services/manifest-loader.js.map +1 -0
  505. package/dist/lifecycle/services/migration-ownership.d.ts +36 -0
  506. package/dist/lifecycle/services/migration-ownership.d.ts.map +1 -0
  507. package/dist/lifecycle/services/migration-ownership.js +15 -0
  508. package/dist/lifecycle/services/migration-ownership.js.map +1 -0
  509. package/dist/lifecycle/services/module-id-claims.d.ts +38 -0
  510. package/dist/lifecycle/services/module-id-claims.d.ts.map +1 -0
  511. package/dist/lifecycle/services/module-id-claims.js +123 -0
  512. package/dist/lifecycle/services/module-id-claims.js.map +1 -0
  513. package/dist/lifecycle/services/module-origin.d.ts +55 -0
  514. package/dist/lifecycle/services/module-origin.d.ts.map +1 -0
  515. package/dist/lifecycle/services/module-origin.js +47 -0
  516. package/dist/lifecycle/services/module-origin.js.map +1 -0
  517. package/dist/lifecycle/services/orchestrator.d.ts +235 -0
  518. package/dist/lifecycle/services/orchestrator.d.ts.map +1 -0
  519. package/dist/lifecycle/services/orchestrator.js +954 -0
  520. package/dist/lifecycle/services/orchestrator.js.map +1 -0
  521. package/dist/lifecycle/services/presence-load.d.ts +281 -0
  522. package/dist/lifecycle/services/presence-load.d.ts.map +1 -0
  523. package/dist/lifecycle/services/presence-load.js +437 -0
  524. package/dist/lifecycle/services/presence-load.js.map +1 -0
  525. package/dist/lifecycle/services/static-registry.d.ts +47 -0
  526. package/dist/lifecycle/services/static-registry.d.ts.map +1 -0
  527. package/dist/lifecycle/services/static-registry.js +41 -0
  528. package/dist/lifecycle/services/static-registry.js.map +1 -0
  529. package/dist/migrations/20260424T165847_core_foundation_init.d.ts +25 -0
  530. package/dist/migrations/20260424T165847_core_foundation_init.d.ts.map +1 -0
  531. package/dist/migrations/20260424T165847_core_foundation_init.js +238 -0
  532. package/dist/migrations/20260424T165847_core_foundation_init.js.map +1 -0
  533. package/dist/migrations/20260425T050720_core_commerce_init.d.ts +19 -0
  534. package/dist/migrations/20260425T050720_core_commerce_init.d.ts.map +1 -0
  535. package/dist/migrations/20260425T050720_core_commerce_init.js +200 -0
  536. package/dist/migrations/20260425T050720_core_commerce_init.js.map +1 -0
  537. package/dist/migrations/20260430T101450_core_settings_init.d.ts +25 -0
  538. package/dist/migrations/20260430T101450_core_settings_init.d.ts.map +1 -0
  539. package/dist/migrations/20260430T101450_core_settings_init.js +113 -0
  540. package/dist/migrations/20260430T101450_core_settings_init.js.map +1 -0
  541. package/dist/migrations/20260430T170044_core_sales_channels_promote.d.ts +67 -0
  542. package/dist/migrations/20260430T170044_core_sales_channels_promote.d.ts.map +1 -0
  543. package/dist/migrations/20260430T170044_core_sales_channels_promote.js +101 -0
  544. package/dist/migrations/20260430T170044_core_sales_channels_promote.js.map +1 -0
  545. package/dist/migrations/20260506T200657_core_module_lifecycle_init.d.ts +21 -0
  546. package/dist/migrations/20260506T200657_core_module_lifecycle_init.d.ts.map +1 -0
  547. package/dist/migrations/20260506T200657_core_module_lifecycle_init.js +41 -0
  548. package/dist/migrations/20260506T200657_core_module_lifecycle_init.js.map +1 -0
  549. package/dist/migrations/20260514T111329_core_settings_global_value.d.ts +30 -0
  550. package/dist/migrations/20260514T111329_core_settings_global_value.d.ts.map +1 -0
  551. package/dist/migrations/20260514T111329_core_settings_global_value.js +34 -0
  552. package/dist/migrations/20260514T111329_core_settings_global_value.js.map +1 -0
  553. package/dist/migrations/20260611T140411_core_settings_secret_value_type.d.ts +26 -0
  554. package/dist/migrations/20260611T140411_core_settings_secret_value_type.d.ts.map +1 -0
  555. package/dist/migrations/20260611T140411_core_settings_secret_value_type.js +63 -0
  556. package/dist/migrations/20260611T140411_core_settings_secret_value_type.js.map +1 -0
  557. package/dist/migrations/20260611T140419_core_settings_enum_options.d.ts +19 -0
  558. package/dist/migrations/20260611T140419_core_settings_enum_options.d.ts.map +1 -0
  559. package/dist/migrations/20260611T140419_core_settings_enum_options.js +23 -0
  560. package/dist/migrations/20260611T140419_core_settings_enum_options.js.map +1 -0
  561. package/dist/migrations/20260629T090100_core_settings_hidden_flag.d.ts +20 -0
  562. package/dist/migrations/20260629T090100_core_settings_hidden_flag.d.ts.map +1 -0
  563. package/dist/migrations/20260629T090100_core_settings_hidden_flag.js +24 -0
  564. package/dist/migrations/20260629T090100_core_settings_hidden_flag.js.map +1 -0
  565. package/dist/migrations/20260717T134752_core_tenant_scope_indexes.d.ts +27 -0
  566. package/dist/migrations/20260717T134752_core_tenant_scope_indexes.d.ts.map +1 -0
  567. package/dist/migrations/20260717T134752_core_tenant_scope_indexes.js +32 -0
  568. package/dist/migrations/20260717T134752_core_tenant_scope_indexes.js.map +1 -0
  569. package/dist/migrations/20260721T011510_core_settings_credential_ref_value_type.d.ts +24 -0
  570. package/dist/migrations/20260721T011510_core_settings_credential_ref_value_type.d.ts.map +1 -0
  571. package/dist/migrations/20260721T011510_core_settings_credential_ref_value_type.js +57 -0
  572. package/dist/migrations/20260721T011510_core_settings_credential_ref_value_type.js.map +1 -0
  573. package/dist/migrations/20260816T203339_core_retire_core_activation_settings.d.ts +39 -0
  574. package/dist/migrations/20260816T203339_core_retire_core_activation_settings.d.ts.map +1 -0
  575. package/dist/migrations/20260816T203339_core_retire_core_activation_settings.js +59 -0
  576. package/dist/migrations/20260816T203339_core_retire_core_activation_settings.js.map +1 -0
  577. package/dist/migrations/20260919T101500_core_module_registrations_boot_converged.d.ts +34 -0
  578. package/dist/migrations/20260919T101500_core_module_registrations_boot_converged.d.ts.map +1 -0
  579. package/dist/migrations/20260919T101500_core_module_registrations_boot_converged.js +38 -0
  580. package/dist/migrations/20260919T101500_core_module_registrations_boot_converged.js.map +1 -0
  581. package/dist/migrations/baseline-migrations.generated.d.ts +2 -0
  582. package/dist/migrations/baseline-migrations.generated.d.ts.map +1 -0
  583. package/dist/migrations/baseline-migrations.generated.js +136 -0
  584. package/dist/migrations/baseline-migrations.generated.js.map +1 -0
  585. package/dist/migrations/index.d.ts +62 -0
  586. package/dist/migrations/index.d.ts.map +1 -0
  587. package/dist/migrations/index.js +75 -0
  588. package/dist/migrations/index.js.map +1 -0
  589. package/dist/overlay/deployment-roots.d.ts +37 -0
  590. package/dist/overlay/deployment-roots.d.ts.map +1 -0
  591. package/dist/overlay/deployment-roots.js +90 -0
  592. package/dist/overlay/deployment-roots.js.map +1 -0
  593. package/dist/overlay/index.d.ts +62 -0
  594. package/dist/overlay/index.d.ts.map +1 -0
  595. package/dist/overlay/index.js +62 -0
  596. package/dist/overlay/index.js.map +1 -0
  597. package/dist/overlay/overlay-runtime.d.ts +173 -0
  598. package/dist/overlay/overlay-runtime.d.ts.map +1 -0
  599. package/dist/overlay/overlay-runtime.js +281 -0
  600. package/dist/overlay/overlay-runtime.js.map +1 -0
  601. package/dist/overlay/resolve-overlay.d.ts +41 -0
  602. package/dist/overlay/resolve-overlay.d.ts.map +1 -0
  603. package/dist/overlay/resolve-overlay.js +72 -0
  604. package/dist/overlay/resolve-overlay.js.map +1 -0
  605. package/dist/packages/index.d.ts +57 -0
  606. package/dist/packages/index.d.ts.map +1 -0
  607. package/dist/packages/index.js +57 -0
  608. package/dist/packages/index.js.map +1 -0
  609. package/dist/packages/installed-packages.d.ts +79 -0
  610. package/dist/packages/installed-packages.d.ts.map +1 -0
  611. package/dist/packages/installed-packages.js +312 -0
  612. package/dist/packages/installed-packages.js.map +1 -0
  613. package/dist/packages/package-entity-lookup.d.ts +120 -0
  614. package/dist/packages/package-entity-lookup.d.ts.map +1 -0
  615. package/dist/packages/package-entity-lookup.js +17 -0
  616. package/dist/packages/package-entity-lookup.js.map +1 -0
  617. package/dist/packages/package-runtime.d.ts +177 -0
  618. package/dist/packages/package-runtime.d.ts.map +1 -0
  619. package/dist/packages/package-runtime.js +386 -0
  620. package/dist/packages/package-runtime.js.map +1 -0
  621. package/dist/tenancy/derived-scope.d.ts +43 -0
  622. package/dist/tenancy/derived-scope.d.ts.map +1 -0
  623. package/dist/tenancy/derived-scope.js +76 -0
  624. package/dist/tenancy/derived-scope.js.map +1 -0
  625. package/dist/tenancy/escape-hatch.d.ts +30 -0
  626. package/dist/tenancy/escape-hatch.d.ts.map +1 -0
  627. package/dist/tenancy/escape-hatch.js +50 -0
  628. package/dist/tenancy/escape-hatch.js.map +1 -0
  629. package/dist/tenancy/filters.d.ts +87 -0
  630. package/dist/tenancy/filters.d.ts.map +1 -0
  631. package/dist/tenancy/filters.js +126 -0
  632. package/dist/tenancy/filters.js.map +1 -0
  633. package/dist/tenancy/index.d.ts +63 -0
  634. package/dist/tenancy/index.d.ts.map +1 -0
  635. package/dist/tenancy/index.js +61 -0
  636. package/dist/tenancy/index.js.map +1 -0
  637. package/dist/tenancy/org-scoped.decorator.d.ts +150 -0
  638. package/dist/tenancy/org-scoped.decorator.d.ts.map +1 -0
  639. package/dist/tenancy/org-scoped.decorator.js +339 -0
  640. package/dist/tenancy/org-scoped.decorator.js.map +1 -0
  641. package/dist/tenancy/org-write-guard.d.ts +106 -0
  642. package/dist/tenancy/org-write-guard.d.ts.map +1 -0
  643. package/dist/tenancy/org-write-guard.js +141 -0
  644. package/dist/tenancy/org-write-guard.js.map +1 -0
  645. package/dist/tenancy/resolve-tenant-context.d.ts +91 -0
  646. package/dist/tenancy/resolve-tenant-context.d.ts.map +1 -0
  647. package/dist/tenancy/resolve-tenant-context.js +85 -0
  648. package/dist/tenancy/resolve-tenant-context.js.map +1 -0
  649. package/dist/tenancy/scoped-em.d.ts +10 -0
  650. package/dist/tenancy/scoped-em.d.ts.map +1 -0
  651. package/dist/tenancy/scoped-em.js +11 -0
  652. package/dist/tenancy/scoped-em.js.map +1 -0
  653. package/dist/tenancy/tenant-context.d.ts +154 -0
  654. package/dist/tenancy/tenant-context.d.ts.map +1 -0
  655. package/dist/tenancy/tenant-context.js +109 -0
  656. package/dist/tenancy/tenant-context.js.map +1 -0
  657. package/package.json +123 -0
@@ -0,0 +1,509 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { ModuleRegistration } from './module-registration.entity.js';
3
+ import { inProcessCaches } from '../cache/in-process-cache-registry.js';
4
+ import { enterSystemScope } from '../scope.js';
5
+ import { resolveActivation, } from './activation-resolver.js';
6
+ export const STATE_CHANGED_CHANNEL = 'b2b:module:state-changed';
7
+ export const FALLBACK_TTL_MS = 5_000;
8
+ /**
9
+ * Per-process cache of module presence. Hot path for the
10
+ * `defineModuleRoutes` / `defineModuleWorker` / `subscribeForModule` /
11
+ * `requireModuleEnabled` wrappers — every request hits it, so the read side
12
+ * MUST stay in-memory after the cold start.
13
+ *
14
+ * It holds **both** presence axes (feature 073):
15
+ *
16
+ * - platform availability, from `module_registrations`;
17
+ * - operator activation, from the declared activation `Setting` rows.
18
+ *
19
+ * They are rebuilt in the same refresh so a process that missed a
20
+ * notification cannot hold the two axes in disagreement. Combining them is
21
+ * `ModuleEffectiveState`'s job, not this class's: here they stay separate,
22
+ * because the Admin UI has to tell "not installed here" from "switched off".
23
+ *
24
+ * The cache keeps itself fresh by subscribing to the
25
+ * `b2b:module:state-changed` pub/sub channel. If that connection drops, a
26
+ * background timer re-reads from PostgreSQL every `FALLBACK_TTL_MS` until it
27
+ * recovers — PostgreSQL is the authority and stays reachable during a Redis
28
+ * outage, so degraded means *stale*, not *everything off*.
29
+ *
30
+ * **Loading and watching are two different things** (feature 072, D-38), and
31
+ * conflating them is what kept the backend from booting:
32
+ *
33
+ * - {@link load} is awaited, fatal and PostgreSQL-only. It runs as a kernel
34
+ * step inside `composeApp()`, before the first module registers, because a
35
+ * boot hook resolving a gated port asks this cache and a composition-time
36
+ * answer of "off" is indistinguishable from "nobody has read the database
37
+ * yet".
38
+ * - {@link watch} is armed after composition, is Redis-only and can never fail
39
+ * a boot: losing the notification channel means *stale*, which is the
40
+ * degraded mode above.
41
+ *
42
+ * Before a load there is no answer, and asking for one throws
43
+ * {@link ModulePresenceNotLoadedError} rather than being answered `false`. It
44
+ * is a wiring defect, and the one thing it must not do is look like data.
45
+ */
46
+ /**
47
+ * A presence read reached the cache before anything loaded it.
48
+ *
49
+ * Not fail-open and not fail-closed — *loud*. Both of the other answers are
50
+ * answers to a question nobody has asked the database yet: `false` takes a
51
+ * correctly-installed platform down at boot (which is exactly what it did), and
52
+ * `true` runs a switched-off module's workers and subscribers.
53
+ */
54
+ export class ModulePresenceNotLoadedError extends Error {
55
+ read;
56
+ constructor(read) {
57
+ super(`[module-lifecycle] module presence was read (${read}) before it was loaded. ` +
58
+ `\`loadModulePresence()\` runs as a composition step in \`composeApp()\`, ` +
59
+ `before the first module registers; a read earlier than that is a wiring defect.`);
60
+ this.read = read;
61
+ this.name = 'ModulePresenceNotLoadedError';
62
+ }
63
+ }
64
+ export class ModuleRegistryCache {
65
+ /**
66
+ * The third state. `false` means "nothing has read the database", which is
67
+ * neither of the two answers a presence read can be given.
68
+ */
69
+ loaded = false;
70
+ enabled = new Set();
71
+ /** Every registry row's state, including the non-installed ones. */
72
+ platformStates = new Map();
73
+ /** Resolved operator activation, per declaring module. */
74
+ activation = new Map();
75
+ declarations = new Map();
76
+ /**
77
+ * The derived capability families (feature 132), indexed the two ways they are
78
+ * read: key → declared member ids, and key → its owner's declaration.
79
+ *
80
+ * They live **here**, beside the activation declarations and the resolved
81
+ * activation, and that is the Redis cache-invalidation design rather than a
82
+ * convenience (`data-model.md` §2.2). An exclusion reads membership and
83
+ * activation together on every refusal, and this cache is refreshed by the
84
+ * `b2b:module:state-changed` pub/sub channel — the same refresh that
85
+ * re-resolves activation. Holding both in one structure with one invalidation
86
+ * is what stops them disagreeing; a family cached anywhere else would need a
87
+ * second refresh path and would be stale for exactly the window in which an
88
+ * operator is flipping a connector, which is the only window that matters.
89
+ */
90
+ capabilityMembers = new Map();
91
+ exclusiveCapabilities = new Map();
92
+ /**
93
+ * Content hash of the two axes, and the counter that moves with it.
94
+ *
95
+ * Issue #225 — a consumer that memoises anything derived from presence needs
96
+ * to know **when the presence it read from was replaced**, and a pub/sub
97
+ * message cannot tell it: the message announces a change whose effect on this
98
+ * cache is still a PostgreSQL round-trip away, so a snapshot rebuilt on the
99
+ * message is rebuilt from the pre-change maps and then kept. The version is
100
+ * the answer to that, and it is a *pull*: no registration, therefore no
101
+ * listener order to get wrong, and a consumer constructed after a refresh
102
+ * still reads the right number.
103
+ *
104
+ * It moves on **content**, not on refresh count. Every state-changed message
105
+ * refreshes every process and the degraded-mode timer refreshes every five
106
+ * seconds; a counter bumped per refresh would drop a consumer's cache each
107
+ * time and make it worthless during a Redis outage, for a presence that did
108
+ * not move. The hash costs one pass over ~70 entries, once per refresh, and
109
+ * never on the read path.
110
+ */
111
+ presenceSignature = '';
112
+ presenceVersionCounter = 0;
113
+ subscriber = null;
114
+ degraded = false;
115
+ fallbackTimer = null;
116
+ fallbackStopped = false;
117
+ presenceListeners = new Set();
118
+ /** True once {@link load} — or the test seam that stands in for it — has run. */
119
+ isLoaded() {
120
+ return this.loaded;
121
+ }
122
+ /**
123
+ * Run `listener` every time this cache **installs** presence — the pub/sub
124
+ * refresh, the degraded-mode refresh, the cold load and the test seams alike.
125
+ *
126
+ * It is the seam a consumer that owns something *stateful* needs, where
127
+ * {@link presenceVersion} is enough for one that merely memoises: a BullMQ
128
+ * worker is not re-read on a request path, so nothing would ever ask it the
129
+ * version, and the orchestrator's `pauseWorkersFor` reaches only the process
130
+ * that ran the orchestrator — never the `BACKEND_ROLE=worker` process, and
131
+ * never the `module:*` CLI, which composes nothing at all. Following the
132
+ * cache instead makes the answer per-process and therefore right in every
133
+ * process.
134
+ *
135
+ * Deliberately **level-triggered**: it fires on every install rather than
136
+ * only when the content moved, because a listener that failed once must get
137
+ * another chance — the degraded-mode timer is then a retry loop rather than a
138
+ * silence. Listeners are therefore obliged to be idempotent and cheap.
139
+ *
140
+ * Notification is synchronous and its errors are contained here: a consumer
141
+ * that throws must not take down a refresh that every gating seam depends on.
142
+ */
143
+ onPresenceInstalled(listener) {
144
+ this.presenceListeners.add(listener);
145
+ return () => {
146
+ this.presenceListeners.delete(listener);
147
+ };
148
+ }
149
+ notifyPresenceInstalled() {
150
+ for (const listener of this.presenceListeners) {
151
+ try {
152
+ listener();
153
+ }
154
+ catch (err) {
155
+ console.warn(`[module-lifecycle] a presence listener threw: ${err instanceof Error ? err.message : String(err)}`);
156
+ }
157
+ }
158
+ }
159
+ /**
160
+ * Monotonic counter over the *content* of both axes. It changes exactly when
161
+ * a load has installed presence that differs from the presence before it, so
162
+ * a consumer that caches a projection of presence can drop that cache by
163
+ * comparing the number it built under with the current one.
164
+ *
165
+ * Synchronous and allocation-free, like every other read here: it is meant to
166
+ * be asked on a request path.
167
+ */
168
+ presenceVersion() {
169
+ return this.presenceVersionCounter;
170
+ }
171
+ /**
172
+ * Re-sign both axes and bump the counter when the signature moved, then tell
173
+ * every {@link onPresenceInstalled} listener that presence was installed.
174
+ * Called at the end of every path that installs presence — the real refresh
175
+ * and the three test seams alike, because a seam that swaps presence without
176
+ * moving the version would leave a consumer serving the presence before it.
177
+ *
178
+ * The notification is unconditional where the counter is not: the counter
179
+ * answers "did the content move", which is the question a memoising consumer
180
+ * asks, and the listeners answer "reconcile yourself to what is here now",
181
+ * which has to keep being asked after a listener that failed.
182
+ */
183
+ restamp() {
184
+ const parts = [];
185
+ for (const moduleId of [...this.platformStates.keys()].sort()) {
186
+ parts.push(`p:${moduleId}=${this.platformStates.get(moduleId) ?? ''}`);
187
+ }
188
+ for (const moduleId of [...this.activation.keys()].sort()) {
189
+ parts.push(`a:${moduleId}=${this.activation.get(moduleId) === true ? '1' : '0'}`);
190
+ }
191
+ const signature = createHash('sha1').update(parts.join('\n')).digest('hex');
192
+ if (signature !== this.presenceSignature) {
193
+ this.presenceSignature = signature;
194
+ this.presenceVersionCounter += 1;
195
+ }
196
+ this.notifyPresenceInstalled();
197
+ }
198
+ assertLoaded(read) {
199
+ if (!this.loaded)
200
+ throw new ModulePresenceNotLoadedError(read);
201
+ }
202
+ isEnabled(moduleId) {
203
+ this.assertLoaded('isEnabled');
204
+ return this.enabled.has(moduleId);
205
+ }
206
+ enabledIds() {
207
+ this.assertLoaded('enabledIds');
208
+ return [...this.enabled].sort();
209
+ }
210
+ /** Platform axis detail for the presence projection. */
211
+ platformStateOf(moduleId) {
212
+ this.assertLoaded('platformStateOf');
213
+ return this.platformStates.get(moduleId) ?? 'not-installed';
214
+ }
215
+ /**
216
+ * Resolved activation for a module that declares a control, or `undefined`
217
+ * when nothing has been resolved for it yet.
218
+ */
219
+ activationValue(moduleId) {
220
+ this.assertLoaded('activationValue');
221
+ return this.activation.get(moduleId);
222
+ }
223
+ activationDeclaration(moduleId) {
224
+ return this.declarations.get(moduleId);
225
+ }
226
+ /**
227
+ * The module that declares `settingCode` as its activation control, if any.
228
+ * Used by the settings write guards: an activation code has exactly one
229
+ * legitimate door, and it is not `PUT /settings/:code/value` (FR-009).
230
+ */
231
+ activationDeclarationByCode(settingCode) {
232
+ for (const declaration of this.declarations.values()) {
233
+ if (declaration.settingCode === settingCode)
234
+ return declaration;
235
+ }
236
+ return undefined;
237
+ }
238
+ /**
239
+ * Install the activation declarations distilled from the manifests. Kept as
240
+ * plain data so the hot path never imports the manifest graph. Refreshing
241
+ * without them resolves the platform axis only, which is exactly the
242
+ * behaviour of a module that has declared no control.
243
+ */
244
+ setActivationDeclarations(declarations) {
245
+ this.declarations = new Map(declarations.map((d) => [d.moduleId, d]));
246
+ }
247
+ /**
248
+ * Install the derived capability registry. Plain data, for the same reason the
249
+ * activation declarations are: the hot path must never import the manifest
250
+ * graph.
251
+ *
252
+ * Replaces the whole registry rather than merging into it — a re-load is a
253
+ * re-derivation from the manifests this process composed, and a merge would
254
+ * keep a member that a `module:uninstall` has taken away.
255
+ */
256
+ setCapabilityDeclarations(registry) {
257
+ const members = new Map();
258
+ for (const declaration of registry.declarations) {
259
+ for (const key of declaration.capabilities) {
260
+ const list = members.get(key) ?? [];
261
+ list.push(declaration.moduleId);
262
+ members.set(key, list);
263
+ }
264
+ }
265
+ this.capabilityMembers = members;
266
+ this.exclusiveCapabilities = new Map(registry.exclusive.map((entry) => [entry.key, entry]));
267
+ }
268
+ /**
269
+ * Every module that **declared** membership of `key`, present or not, in
270
+ * manifest order.
271
+ *
272
+ * No `assertLoaded`, exactly like {@link activationDeclaration}: this is
273
+ * manifest data installed by the composition root before any database read,
274
+ * and the family owner registers its exclusion interceptor at that point. A
275
+ * read that threw before the load would make the family unreadable at the one
276
+ * moment it has to be readable.
277
+ */
278
+ declaredCapabilityMembers(key) {
279
+ return this.capabilityMembers.get(key) ?? [];
280
+ }
281
+ /**
282
+ * The owner and refusal code for `key`, or `undefined` when no installed
283
+ * module owns it — which is not an error (R3.5): the capability is simply not
284
+ * exclusive in that deployment.
285
+ */
286
+ exclusiveCapability(key) {
287
+ return this.exclusiveCapabilities.get(key);
288
+ }
289
+ /** Union of everything the registry knows and everything that declared a control. */
290
+ knownModuleIds() {
291
+ this.assertLoaded('knownModuleIds');
292
+ return [...new Set([...this.platformStates.keys(), ...this.declarations.keys()])].sort();
293
+ }
294
+ /**
295
+ * Load both axes from PostgreSQL. **Awaited, fatal, no Redis.**
296
+ *
297
+ * The composition root calls this before the first module registers, so a
298
+ * boot hook, a plugin body and a worker registration all read a cache that
299
+ * has an answer. Idempotent: a second call re-reads the tables.
300
+ *
301
+ * Fatal is not a new failure mode. `composeApp()` opens with `initOrm()` and
302
+ * MikroORM connects eagerly, so a backend whose database is unreachable
303
+ * already cannot boot; this adds one round-trip to a boot that makes several.
304
+ */
305
+ async load(opts) {
306
+ if (opts.activationDeclarations) {
307
+ this.setActivationDeclarations(opts.activationDeclarations);
308
+ }
309
+ if (opts.capabilityRegistry) {
310
+ this.setCapabilityDeclarations(opts.capabilityRegistry);
311
+ }
312
+ await this.refreshFromDb(opts.em);
313
+ }
314
+ /**
315
+ * Arm the pub/sub subscriber that keeps the loaded state fresh. **Not fatal,
316
+ * no PostgreSQL read of its own.** Safe to call multiple times — a second
317
+ * call does not re-subscribe.
318
+ *
319
+ * A Redis outage must never fail a boot: the channel is a freshness
320
+ * optimisation over an authority that is still reachable, which is the whole
321
+ * argument for the degraded mode below. So a failing subscribe enters that
322
+ * mode instead of propagating.
323
+ */
324
+ async watch(opts) {
325
+ if (this.subscriber)
326
+ return;
327
+ this.subscriber = opts.redisSubscriber;
328
+ this.subscriber.on('message', (channel) => {
329
+ if (channel !== STATE_CHANGED_CHANNEL)
330
+ return;
331
+ // D-174 — this process's caches that are derived from module state, first
332
+ // and synchronously. The channel is the only cross-process announcement
333
+ // of an install rewriting a module's palette rows or another module's
334
+ // translation bundles, and `presenceVersion()` is blind to both: it
335
+ // hashes the two presence axes and nothing else. A module may not name
336
+ // this channel — a transport detail, carrying a payload it does not read
337
+ // — so it registers a layer and the kernel's own subscriber drops it.
338
+ // Before the refresh below, deliberately: the drop's whole value over the
339
+ // version pull is that it lands on receipt rather than a PostgreSQL
340
+ // round-trip later. Errors are contained inside the registry.
341
+ void inProcessCaches.invalidateForModuleStateChange();
342
+ // Issue #235 — the same reason the degraded timer below states, for the
343
+ // same call: this refresh reads `module_registrations` and `settings` from
344
+ // a Redis pub/sub callback, delivered off a socket the composition opened,
345
+ // so there is no caller to inherit a context from. Both entities are
346
+ // `@GlobalEntity()` today and the tenant filters therefore contribute
347
+ // nothing — an accident of classification, not a design, and one that
348
+ // stops holding the moment either query path gains a scoped sibling.
349
+ void enterSystemScope('_lifecycle: registry refresh on state-change notification', () => this.refreshFromDb(opts.em), { entryPoint: 'message' }).catch((err) => {
350
+ // Slip into degraded mode; the fallback timer keeps re-reading.
351
+ this.enterDegradedMode(opts.em);
352
+ console.warn(`[module-lifecycle] registry-cache refresh failed: ${err instanceof Error ? err.message : String(err)}`);
353
+ });
354
+ });
355
+ this.subscriber.on('end', () => {
356
+ this.enterDegradedMode(opts.em);
357
+ });
358
+ try {
359
+ await this.subscriber.subscribe(STATE_CHANGED_CHANNEL);
360
+ }
361
+ catch (err) {
362
+ this.enterDegradedMode(opts.em);
363
+ console.warn(`[module-lifecycle] registry-cache could not subscribe to ${STATE_CHANGED_CHANNEL} — ` +
364
+ `serving the loaded state and re-reading PostgreSQL every ${FALLBACK_TTL_MS}ms: ${err instanceof Error ? err.message : String(err)}`);
365
+ }
366
+ // No Redis mirror of the enabled set (feature 073, T140). One existed —
367
+ // `b2b:module:enabled-set` — written here and read by nothing: a cold start
368
+ // reads `module_registrations`, which is the authority, and every later
369
+ // refresh is triggered by the pub/sub notification above. A second copy of
370
+ // presence that nothing consults can only be a thing to keep in sync and a
371
+ // thing to mislead whoever finds it.
372
+ }
373
+ /**
374
+ * Test seam — replaces both axes without touching Redis or the database.
375
+ * `ids` seeds platform availability; `opts.deactivated` seeds the operator
376
+ * axis to off, which is the axis an operator actually drives.
377
+ *
378
+ * It counts as a {@link load}: it is "the load, without a database", and a
379
+ * harness that seeds it has answered the question the tri-state asks.
380
+ */
381
+ __setEnabledForTesting(ids, opts) {
382
+ this.loaded = true;
383
+ this.enabled = new Set(ids);
384
+ this.platformStates = new Map(ids.map((id) => [id, 'installed']));
385
+ this.activation = new Map(ids.map((id) => [id, true]));
386
+ for (const id of opts?.deactivated ?? []) {
387
+ this.activation.set(id, false);
388
+ }
389
+ this.restamp();
390
+ }
391
+ /**
392
+ * Test seam — return the cache to the unloaded state, which is the one state
393
+ * a test cannot otherwise reach: the suite shares one process, so by the time
394
+ * a file runs, some earlier file has almost certainly seeded the singleton.
395
+ * The invariant "a presence read before the load is an error" is not testable
396
+ * without it.
397
+ */
398
+ __resetForTesting() {
399
+ this.loaded = false;
400
+ this.enabled = new Set();
401
+ this.platformStates = new Map();
402
+ this.activation = new Map();
403
+ this.declarations = new Map();
404
+ this.capabilityMembers = new Map();
405
+ this.exclusiveCapabilities = new Map();
406
+ this.restamp();
407
+ }
408
+ /**
409
+ * Test seam — re-resolve the **operator** axis from the database, leaving the
410
+ * seeded platform axis alone.
411
+ *
412
+ * The shared test harness never populates `module_registrations`; it seeds
413
+ * the enabled-set directly through `__setEnabledForTesting`. A full
414
+ * `refreshFromDb` there would find an empty registry table and take every
415
+ * gated route down mid-run, so a test that has just written an activation
416
+ * value needs this narrower refresh to observe it.
417
+ *
418
+ * Production never calls it: a partial refresh is exactly how the two axes
419
+ * would drift apart in a process that missed a notification, which is why
420
+ * `refreshFromDb` rebuilds both together.
421
+ */
422
+ async __refreshActivationForTesting(em) {
423
+ this.activation = await resolveActivation(em(), [...this.declarations.values()]);
424
+ this.restamp();
425
+ }
426
+ /** True when the pub/sub side is unhealthy and the cache is TTL-refreshing. */
427
+ isDegraded() {
428
+ return this.degraded;
429
+ }
430
+ /** Refresh both axes from the source-of-truth tables. Idempotent. */
431
+ async refreshFromDb(em) {
432
+ const fork = em();
433
+ const rows = await fork.find(ModuleRegistration, {});
434
+ const freshEnabled = new Set();
435
+ const freshStates = new Map();
436
+ for (const r of rows) {
437
+ freshStates.set(r.moduleId, r.state);
438
+ if (r.state === 'installed')
439
+ freshEnabled.add(r.moduleId);
440
+ }
441
+ const freshActivation = await resolveActivation(fork, [...this.declarations.values()]);
442
+ this.enabled = freshEnabled;
443
+ this.platformStates = freshStates;
444
+ this.activation = freshActivation;
445
+ this.loaded = true;
446
+ this.restamp();
447
+ this.clearDegradedMode();
448
+ }
449
+ /**
450
+ * Degraded-mode refresh. Runs on a timer rather than at the seam: the
451
+ * wrappers' check must stay synchronous (FR-004), so a lazy
452
+ * `await maybeRefresh()` on the hot path is not available.
453
+ *
454
+ * Refreshing from PostgreSQL rather than blanking the sets is deliberate.
455
+ * Fail-closed applies to *unresolved* state, not to stale state; treating a
456
+ * Redis blip as "every module is off" would take the platform down, and the
457
+ * database — the actual authority — is still reachable.
458
+ */
459
+ enterDegradedMode(em) {
460
+ this.degraded = true;
461
+ // A disconnecting ioredis client keeps emitting `'end'` while it retries,
462
+ // so without this an explicitly stopped cache re-arms itself and outlives
463
+ // its owner — polling a closed EntityManager for the rest of the process.
464
+ if (this.fallbackStopped)
465
+ return;
466
+ if (this.fallbackTimer)
467
+ return;
468
+ this.fallbackTimer = setInterval(() => {
469
+ // Feature 072 (T034) — the degraded refresh reads `module_registrations`
470
+ // from a timer, with no caller to inherit a context from.
471
+ void enterSystemScope('_lifecycle: degraded registry refresh', () => this.refreshFromDb(em), { entryPoint: 'interval' }).catch((err) => {
472
+ console.warn(`[module-lifecycle] degraded refresh failed: ${err instanceof Error ? err.message : String(err)}`);
473
+ // Stay degraded and try again on the next tick.
474
+ this.degraded = true;
475
+ });
476
+ }, FALLBACK_TTL_MS);
477
+ // Do not hold the process open for the sake of a cache refresh.
478
+ this.fallbackTimer.unref?.();
479
+ }
480
+ clearDegradedMode() {
481
+ this.degraded = false;
482
+ if (this.fallbackTimer) {
483
+ clearInterval(this.fallbackTimer);
484
+ this.fallbackTimer = null;
485
+ }
486
+ }
487
+ /**
488
+ * Stop the degraded-mode timer for good. Used by tests and by process
489
+ * shutdown: after this the cache will not re-arm, so tearing down the
490
+ * database behind it produces no background noise.
491
+ */
492
+ stopFallbackRefresh() {
493
+ this.fallbackStopped = true;
494
+ if (this.fallbackTimer) {
495
+ clearInterval(this.fallbackTimer);
496
+ this.fallbackTimer = null;
497
+ }
498
+ }
499
+ }
500
+ /** Module-internal singleton consumed by the wrappers. */
501
+ export const registryCache = new ModuleRegistryCache();
502
+ /**
503
+ * Publish a state-change notification. Called by the orchestrator on
504
+ * every successful install / uninstall / enable / disable.
505
+ */
506
+ export async function publishStateChanged(redis, payload) {
507
+ await redis.publish(STATE_CHANGED_CHANNEL, JSON.stringify(payload));
508
+ }
509
+ //# sourceMappingURL=registry-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-cache.js","sourceRoot":"","sources":["../../../src/kernel/lifecycle/registry-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,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;IACH,CAAC;CACF;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAAY,EACZ,OAA+C;IAE/C,MAAM,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,137 @@
1
+ import type { ModuleManifest, RegistryState } from '@endora-commerce/contracts';
2
+ /**
3
+ * The modules a composition is **required to have**, and the refusal when it
4
+ * does not (issue #258, owner ruling: *"`settings` is too important to be
5
+ * absent from a deployment"*).
6
+ *
7
+ * ## The gap this closes
8
+ *
9
+ * `activation.nonDeactivatable` guards **withdrawal**: since D-69 the lifecycle
10
+ * orchestrator refuses to disable or uninstall a module that declares it, soft
11
+ * and hard alike, with no `--force`. D-101 then bound the **initial state** for
12
+ * the two absences a manifest analysis can see — a module this deployment never
13
+ * shipped that another manifest names, and a module carrying a
14
+ * `module_registrations` row the boot reconciler will not repair. Both refuse
15
+ * from `loadModulePresence`, before the registry is even read.
16
+ *
17
+ * Neither of them can see the state that actually breaks a first boot: presence
18
+ * answering *absent* for a required module at the moment the boot phase starts.
19
+ * `loadModulePresence` runs before the first module registers, so it knows the
20
+ * manifests but not what was composed; and it is the *first* writer of presence,
21
+ * not the only one. This runs at the other end of the registration pass, where
22
+ * both answers exist at once.
23
+ *
24
+ * ## What a mis-built deployment used to see
25
+ *
26
+ * `invoices` grandfathers its numbering pattern from a `ctx.onBoot` hook
27
+ * (feature 078, D-95.3) and the write goes through `settings`' port.
28
+ * `NumberingConfigurationService` re-throws `ModuleDisabledError` on purpose —
29
+ * the write is the whole point of the hook — `runBootHooks` attributes the
30
+ * failure to `invoices` and re-throws as `ModuleCompositionError`, and
31
+ * `index.ts` turns that into `process.exit(1)`. So the platform did not degrade,
32
+ * it exited, saying:
33
+ *
34
+ * [kernel] module 'invoices' failed in its boot hook:
35
+ * Module 'settings' is currently disabled.
36
+ *
37
+ * — the wrong module, and no remedy. It had never been seen because on any
38
+ * database where the platform booted once the grandfather write has already
39
+ * happened and the hook finds nothing to do; only a genuinely first boot reaches
40
+ * the port.
41
+ *
42
+ * ## Why this is not `assertDeactivatable` and not `assertLockedModulesPresent`
43
+ *
44
+ * Three refusals now rest on one manifest declaration, and D-101 already ruled
45
+ * that they must stay three: *"they share a declaration and share nothing else —
46
+ * not a call site, not an error type, not a message. Anyone reading either
47
+ * should be able to tell which question they are looking at without reading the
48
+ * other."* `assertDeactivatable` refuses a **transition an operator asked for**
49
+ * and answers it with an HTTP envelope. `assertLockedModulesPresent` refuses a
50
+ * **deployment that was assembled wrong**, from the manifests, before the
51
+ * database is touched. This refuses a **composition that reached its boot phase
52
+ * without a module it requires**, from what was actually registered and what
53
+ * presence actually says — the last question, at the last point where the answer
54
+ * is still cheap.
55
+ *
56
+ * ## The required set is derived, never written down
57
+ *
58
+ * D-100 and `check:lock-claims`: a hand-written copy of a derived fact goes stale
59
+ * silently. {@link requiredModulesFrom} reads the shipped manifests on every
60
+ * composition, so an owner who withdraws a lock changes this refusal in the same
61
+ * run, with no list to edit. **"Required to be installed" and "cannot be switched
62
+ * off" are therefore the same set, by derivation and by decision** — the manifest
63
+ * needs no second field, because a module whose author wrote "the platform cannot
64
+ * run without this" has already answered both questions with one sentence, and
65
+ * that sentence is what the refusal below prints.
66
+ *
67
+ * The one absence it cannot see is the one D-101's header names: a module that is
68
+ * not shipped at all takes its manifest with it, so *"was it locked?"* has no
69
+ * answer here. That case belongs to `assertLockedModulesPresent`, which asks it
70
+ * from the declarations of the modules that stayed.
71
+ */
72
+ /** A module this composition must have, and the sentence its manifest gives. */
73
+ export interface RequiredModule {
74
+ readonly moduleId: string;
75
+ /** The module's own `activation.reason` — why the platform cannot run without it. */
76
+ readonly reason: string;
77
+ }
78
+ /**
79
+ * The two ways a composition can reach its boot phase without a module it
80
+ * requires.
81
+ *
82
+ * - `not-composed` — the manifests declare it, but no module registered it.
83
+ * The composed module list and the manifest index disagree, which is a
84
+ * mis-built artefact rather than an operator's choice.
85
+ * - `absent` — it was composed, and presence says it is not there. For a
86
+ * required module that is always the platform axis: `effectiveState` forces
87
+ * the operator axis of a non-deactivatable module on whatever a Setting says,
88
+ * so there is no operator choice that can produce this.
89
+ */
90
+ export type RequiredModuleFinding = {
91
+ readonly kind: 'not-composed';
92
+ readonly moduleId: string;
93
+ readonly reason: string;
94
+ } | {
95
+ readonly kind: 'absent';
96
+ readonly moduleId: string;
97
+ readonly reason: string;
98
+ readonly platformState: RegistryState | 'not-installed';
99
+ };
100
+ /**
101
+ * The presence answers this analysis needs, and nothing else — structurally the
102
+ * two `EffectiveModuleState` members it uses, so a fixture supplies them and
103
+ * nothing more.
104
+ */
105
+ export interface RequiredModulePresence {
106
+ isPresent(moduleId: string): boolean;
107
+ presence(moduleId: string): {
108
+ readonly platformState: RegistryState | 'not-installed';
109
+ } | undefined;
110
+ }
111
+ /**
112
+ * The refusal. A distinct type from every other absence refusal, per D-101's
113
+ * closing rule.
114
+ */
115
+ export declare class RequiredModuleAbsentError extends Error {
116
+ readonly findings: readonly RequiredModuleFinding[];
117
+ constructor(findings: readonly RequiredModuleFinding[]);
118
+ }
119
+ /**
120
+ * The required set, straight from the shipped manifests.
121
+ *
122
+ * Pure and exported so its proof drives the classification from a fixture that
123
+ * enters at the top of the analysis, rather than from a value a composition
124
+ * already computed.
125
+ */
126
+ export declare function requiredModulesFrom(manifests: readonly ModuleManifest[]): readonly RequiredModule[];
127
+ /**
128
+ * Every required module this composition cannot serve, in manifest order.
129
+ *
130
+ * Pure, and that is load-bearing rather than stylistic — the same reason
131
+ * `assertLockedModulesPresent` is: its whole input is the three things a
132
+ * composition has by the end of its registration pass.
133
+ */
134
+ export declare function absentRequiredModules(required: readonly RequiredModule[], composed: ReadonlySet<string>, presence: RequiredModulePresence): readonly RequiredModuleFinding[];
135
+ /** {@link absentRequiredModules}, as the refusal the composer makes. */
136
+ export declare function assertRequiredModulesPresent(required: readonly RequiredModule[], composed: ReadonlySet<string>, presence: RequiredModulePresence): void;
137
+ //# sourceMappingURL=required-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-modules.d.ts","sourceRoot":"","sources":["../../../src/kernel/lifecycle/required-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrF;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,aAAa,GAAG,eAAe,CAAC;CACzD,CAAC;AAEN;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,QAAQ,CACN,QAAQ,EAAE,MAAM,GACf;QAAE,QAAQ,CAAC,aAAa,EAAE,aAAa,GAAG,eAAe,CAAA;KAAE,GAAG,SAAS,CAAC;CAC5E;AAED;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAA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