@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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request-actor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-actor.js","sourceRoot":"","sources":["../../src/http/request-actor.ts"],"names":[],"mappings":""}
@@ -0,0 +1,60 @@
1
+ import { type FastifyInstance } from 'fastify';
2
+ import { type OpenApiMetadata } from './openapi.js';
3
+ import type { ErrorEnvelopeOptions } from './error-envelope.js';
4
+ import { type TrustedProxy } from './trusted-proxy.js';
5
+ import { type ApiInterceptorRegistry } from './interceptors/index.js';
6
+ /**
7
+ * Module registration hook — each backend module exposes a plugin that takes
8
+ * the composed Fastify app and wires its own routes. Modules receive the
9
+ * composition root's dependency container via a separate mechanism (services
10
+ * are constructed once at boot and passed in explicitly). This keeps the
11
+ * server.ts bootstrap decoupled from any specific module.
12
+ */
13
+ export type ModulePlugin = (app: FastifyInstance) => Promise<void> | void;
14
+ /**
15
+ * Fastify bootstrap — the single entry point used by `src/index.ts` (production) and by
16
+ * test/helpers/test-server.ts (contract tests). All cross-cutting concerns (helmet, cookie
17
+ * parsing, rate limiting, Zod validation, error envelope, request id, OpenAPI) are wired
18
+ * here so individual module routes only deal with domain logic.
19
+ */
20
+ export interface BuildServerOptions {
21
+ /** Secret used to sign session cookies (required in production). */
22
+ sessionCookieSecret: string;
23
+ /** Visible in the generated OpenAPI document. */
24
+ openApi: OpenApiMetadata;
25
+ /** Test overrides — bypass rate limits so contract tests are not flaky. */
26
+ disableRateLimit?: boolean;
27
+ /**
28
+ * Optional per-IP request budget (requests per minute). When omitted, the
29
+ * default is 1000/min — high enough that local SSR dev (which can fire
30
+ * 10+ backend calls per page render across layout hooks, cart, /me,
31
+ * upsells, etc.) does not trip the limiter on every navigation.
32
+ * Production composition can pass a tighter ceiling via env.
33
+ */
34
+ rateLimitMax?: number;
35
+ /** Business-module route registrations, invoked after cross-cutting hooks are installed. */
36
+ modules?: ModulePlugin[];
37
+ /** Optional i18n bridge for translating standardized error envelopes. */
38
+ errorEnvelope?: ErrorEnvelopeOptions;
39
+ /**
40
+ * Feature 060 — API interceptor registry. When present, buildServer installs
41
+ * the pre/post dispatch hooks and seals the registry (after fail-closed
42
+ * target validation) in an onReady hook. When absent, the server is
43
+ * byte-for-byte identical to the pre-060 behavior.
44
+ */
45
+ apiInterceptors?: ApiInterceptorRegistry;
46
+ /**
47
+ * Issue #220 — which upstream proxy may be believed about the client address.
48
+ * Omitted (the default) means none: `request.ip` is the socket's peer, which
49
+ * behind a reverse proxy is the proxy. A deployment that terminates TLS on a
50
+ * host nginx passes the hop count or the proxy's address, and gets the real
51
+ * client on rate-limit buckets and audit rows.
52
+ *
53
+ * The composition root reads the environment and parses it with
54
+ * `parseTrustedProxy`; this platform root reads no configuration itself
55
+ * (D-52/D-53), and the type has no `true` to pass.
56
+ */
57
+ trustedProxy?: TrustedProxy;
58
+ }
59
+ export declare function buildServer(options: BuildServerOptions): Promise<FastifyInstance>;
60
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/http/server.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAaxD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAKL,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE1E;;;;;GAKG;AAEH,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iDAAiD;IACjD,OAAO,EAAE,eAAe,CAAC;IACzB,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4FAA4F;IAC5F,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,yEAAyE;IACzE,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,CA8GvF"}
@@ -0,0 +1,117 @@
1
+ import Fastify, {} from 'fastify';
2
+ import helmet from '@fastify/helmet';
3
+ import cookie from '@fastify/cookie';
4
+ import cors from '@fastify/cors';
5
+ import rateLimit from '@fastify/rate-limit';
6
+ import { serializerCompiler, validatorCompiler, } from '@fastify/type-provider-zod';
7
+ import { attachPlatformLogger } from '../kernel/logging.js';
8
+ import { registerErrorEnvelope } from './error-envelope.js';
9
+ import { attachOpenApiAutoRegistration, registerOpenApiRoutes, } from './openapi.js';
10
+ import { toFastifyTrustProxy } from './trusted-proxy.js';
11
+ import { makePostDispatchPreSerialization, makePreDispatchOnRoute, RouteTable, validateRegistrations, } from './interceptors/index.js';
12
+ export async function buildServer(options) {
13
+ // Fastify configures pino internally from these options. We don't pass a pre-built
14
+ // Logger instance because pino 10's `msgPrefix: string | undefined` conflicts with
15
+ // Fastify's stricter `FastifyBaseLogger` under exactOptionalPropertyTypes.
16
+ const isDev = process.env['NODE_ENV'] !== 'production';
17
+ const app = Fastify({
18
+ logger: {
19
+ level: process.env['LOG_LEVEL'] ?? 'info',
20
+ redact: {
21
+ paths: ['req.headers.authorization', 'req.headers.cookie', '*.password', '*.passwordHash', '*.secret'],
22
+ censor: '[REDACTED]',
23
+ },
24
+ ...(isDev
25
+ ? {
26
+ transport: {
27
+ target: 'pino-pretty',
28
+ options: { colorize: true, translateTime: 'SYS:HH:MM:ss.l', ignore: 'pid,hostname' },
29
+ },
30
+ }
31
+ : {}),
32
+ },
33
+ genReqId: () => `req_${randomHex(16)}`,
34
+ requestIdHeader: 'x-request-id',
35
+ // See BuildServerOptions.trustedProxy — `false` unless a deployment names
36
+ // the hop it trusts.
37
+ trustProxy: options.trustedProxy === undefined ? false : toFastifyTrustProxy(options.trustedProxy),
38
+ disableRequestLogging: false,
39
+ });
40
+ // Issue #269 — this is the moment the log the platform actually collects
41
+ // comes into existence, so it is where every module's `ctx.log` is pointed at
42
+ // it. Doing it here rather than in a composition root is what stops the two
43
+ // roots from drifting on it (they already had: `composition.ts` passed the
44
+ // global `console` and the harness passed a no-op) and covers all four entry
45
+ // points with one call — `index.ts`, `worker.ts`, the test harness and the
46
+ // overlay runtime all reach the platform's logger through `buildServer`.
47
+ //
48
+ // Detached on close, and the detach is a no-op once a later server has
49
+ // attached, so a suite that closes an earlier app does not silence the
50
+ // current one. See `kernel/logging.ts` for what a line emitted while nothing
51
+ // is attached does instead.
52
+ const detachPlatformLogger = attachPlatformLogger(app.log);
53
+ app.addHook('onClose', () => {
54
+ detachPlatformLogger();
55
+ });
56
+ app.setValidatorCompiler(validatorCompiler);
57
+ app.setSerializerCompiler(serializerCompiler);
58
+ await app.register(helmet, { contentSecurityPolicy: false });
59
+ // Allow the storefront (Next.js) and admin panel (Vite) to call the API
60
+ // cross-origin in dev. CORS_ALLOWED_ORIGINS is a comma-separated allow-list;
61
+ // the default covers the local dev ports for both apps. `credentials: true`
62
+ // pairs with the api-client's `credentials: 'include'` so b2b_session
63
+ // cookies survive the round-trip.
64
+ const corsOrigins = (process.env['CORS_ALLOWED_ORIGINS'] ?? 'http://localhost:3000,http://localhost:3002')
65
+ .split(',')
66
+ .map((s) => s.trim())
67
+ .filter(Boolean);
68
+ await app.register(cors, {
69
+ origin: corsOrigins,
70
+ credentials: true,
71
+ methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
72
+ allowedHeaders: ['Content-Type', 'Accept', 'Authorization', 'X-Sales-Channel', 'Accept-Language', 'If-Match', 'X-Request-Id'],
73
+ // `Content-Language` carries the language the error envelope answered in
74
+ // (feature 083, D-139 § 8.2). Without it here, a cross-origin storefront or
75
+ // admin build cannot read the header at all, which is the whole point of
76
+ // echoing it.
77
+ exposedHeaders: ['X-Request-Id', 'ETag', 'Content-Language'],
78
+ });
79
+ await app.register(cookie, { secret: options.sessionCookieSecret });
80
+ if (options.disableRateLimit !== true) {
81
+ await app.register(rateLimit, {
82
+ max: options.rateLimitMax ?? 1000,
83
+ timeWindow: '1 minute',
84
+ });
85
+ }
86
+ // Stamp X-Request-Id on every response so clients and the audit log can correlate.
87
+ app.addHook('onSend', async (request, reply) => {
88
+ reply.header('x-request-id', request.id);
89
+ });
90
+ // Feature 060 — API interceptors. Installed BEFORE the module loop so the
91
+ // onRoute hooks observe every route (including those mounted in encapsulated
92
+ // defineModuleRoutes child contexts, which inherit onRoute).
93
+ if (options.apiInterceptors) {
94
+ const registry = options.apiInterceptors;
95
+ const routeTable = new RouteTable();
96
+ app.addHook('onRoute', routeTable.onRouteListener);
97
+ app.addHook('onRoute', makePreDispatchOnRoute(registry));
98
+ app.addHook('preSerialization', makePostDispatchPreSerialization(registry));
99
+ app.addHook('onReady', async () => {
100
+ validateRegistrations(registry, routeTable);
101
+ registry.seal();
102
+ });
103
+ }
104
+ registerErrorEnvelope(app, options.errorEnvelope);
105
+ attachOpenApiAutoRegistration(app);
106
+ registerOpenApiRoutes(app, options.openApi);
107
+ for (const modulePlugin of options.modules ?? []) {
108
+ await modulePlugin(app);
109
+ }
110
+ return app.withTypeProvider();
111
+ }
112
+ function randomHex(len) {
113
+ const bytes = new Uint8Array(len);
114
+ globalThis.crypto.getRandomValues(bytes);
115
+ return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
116
+ }
117
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","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,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC;QACzD,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,gCAAgC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5E,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;YAChC,qBAAqB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAC5C,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAClD,6BAA6B,CAAC,GAAG,CAAC,CAAC;IACnC,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5C,KAAK,MAAM,YAAY,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;QACjD,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,GAAG,CAAC,gBAAgB,EAAmB,CAAC;AACjD,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAClC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Triggers on-demand revalidation of the storefront's tagged fetch caches
3
+ * (feature 049; promoted to shared HTTP infrastructure in feature 066). It has
4
+ * no module-specific content — it POSTs cache tags to the storefront's
5
+ * revalidate endpoint — and four modules need it, so it lives here rather than
6
+ * inside one of them (Principle I).
7
+ *
8
+ * Best-effort: a failed call is logged and swallowed so a config/custom-event
9
+ * write never fails because the storefront is unreachable. Disabled (no-op)
10
+ * when the base URL or secret is not configured.
11
+ */
12
+ export interface StorefrontRevalidatorOptions {
13
+ baseUrl: string | undefined;
14
+ secret: string | undefined;
15
+ fetchFn?: typeof fetch;
16
+ logger?: {
17
+ warn: (obj: unknown, msg: string) => void;
18
+ };
19
+ }
20
+ export declare class StorefrontRevalidator {
21
+ private readonly options;
22
+ private logger;
23
+ constructor(options: StorefrontRevalidatorOptions);
24
+ /** Attach a logger once the Fastify app (and its `log`) exists. */
25
+ setLogger(logger: NonNullable<StorefrontRevalidatorOptions['logger']>): void;
26
+ get enabled(): boolean;
27
+ revalidate(tags: string[]): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=storefront-revalidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefront-revalidator.d.ts","sourceRoot":"","sources":["../../src/http/storefront-revalidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CACxD;AAED,qBAAa,qBAAqB;IAGpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,MAAM,CAAyC;gBAE1B,OAAO,EAAE,4BAA4B;IAIlE,mEAAmE;IACnE,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI;IAI5E,IAAI,OAAO,IAAI,OAAO,CAErB;IAEK,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBhD"}
@@ -0,0 +1,34 @@
1
+ export class StorefrontRevalidator {
2
+ options;
3
+ logger;
4
+ constructor(options) {
5
+ this.options = options;
6
+ this.logger = options.logger;
7
+ }
8
+ /** Attach a logger once the Fastify app (and its `log`) exists. */
9
+ setLogger(logger) {
10
+ this.logger = logger;
11
+ }
12
+ get enabled() {
13
+ return !!this.options.baseUrl && !!this.options.secret;
14
+ }
15
+ async revalidate(tags) {
16
+ if (!this.enabled || tags.length === 0)
17
+ return;
18
+ const fetchFn = this.options.fetchFn ?? globalThis.fetch;
19
+ try {
20
+ await fetchFn(`${this.options.baseUrl}/api/revalidate`, {
21
+ method: 'POST',
22
+ headers: {
23
+ 'Content-Type': 'application/json',
24
+ 'x-revalidate-secret': this.options.secret,
25
+ },
26
+ body: JSON.stringify({ tags }),
27
+ });
28
+ }
29
+ catch (err) {
30
+ this.logger?.warn({ err }, '[storefront-revalidate] failed');
31
+ }
32
+ }
33
+ }
34
+ //# sourceMappingURL=storefront-revalidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefront-revalidator.js","sourceRoot":"","sources":["../../src/http/storefront-revalidator.ts"],"names":[],"mappings":"AAkBA,MAAM,OAAO,qBAAqB;IAGH;IAFrB,MAAM,CAAyC;IAEvD,YAA6B,OAAqC;QAArC,YAAO,GAAP,OAAO,CAA8B;QAChE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED,mEAAmE;IACnE,SAAS,CAAC,MAA2D;QACnE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAc;QAC7B,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC;QACzD,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,iBAAiB,EAAE;gBACtD,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,qBAAqB,EAAE,IAAI,CAAC,OAAO,CAAC,MAAgB;iBACrD;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC;aAC/B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,gCAAgC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ import type { FastifyRequest } from 'fastify';
2
+ /**
3
+ * Local narrowing for the test harness's `request.testActor` decoration.
4
+ *
5
+ * `test/helpers/test-actors.ts` declares a global `fastify` module augmentation
6
+ * adding `testActor` to `FastifyRequest`. That file lives under `test/`, which
7
+ * `tsconfig.build.json` excludes — so production code that reads the field
8
+ * through the *global* augmentation typechecks under `tsconfig.json` (which
9
+ * includes tests) but fails `pnpm run build`.
10
+ *
11
+ * Production route handlers therefore narrow the field locally through this
12
+ * carrier type instead. It intentionally mirrors only the admin shape actually
13
+ * consumed by `src/` — the full `TestActor` union stays test-only, and no
14
+ * test-only type is added to the production `FastifyRequest` surface.
15
+ */
16
+ export interface TestActorCarrier {
17
+ testActor?: {
18
+ kind: string;
19
+ adminUserId: string;
20
+ };
21
+ }
22
+ /**
23
+ * Returns the harness-supplied admin user id, or `undefined` when the request
24
+ * carries no admin `testActor`. Production requests resolve their actor through
25
+ * the auth plugin (`request.actor`) and always get `undefined` here.
26
+ */
27
+ export declare function testAdminUserId(request: FastifyRequest): string | undefined;
28
+ //# sourceMappingURL=test-actor-carrier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-actor-carrier.d.ts","sourceRoot":"","sources":["../../src/http/test-actor-carrier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAG3E"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns the harness-supplied admin user id, or `undefined` when the request
3
+ * carries no admin `testActor`. Production requests resolve their actor through
4
+ * the auth plugin (`request.actor`) and always get `undefined` here.
5
+ */
6
+ export function testAdminUserId(request) {
7
+ const testActor = request.testActor;
8
+ return testActor?.kind === 'admin' ? testActor.adminUserId : undefined;
9
+ }
10
+ //# sourceMappingURL=test-actor-carrier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-actor-carrier.js","sourceRoot":"","sources":["../../src/http/test-actor-carrier.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAuB;IACrD,MAAM,SAAS,GAAI,OAA6C,CAAC,SAAS,CAAC;IAC3E,OAAO,SAAS,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * What `buildServer` passes to Fastify's `trustProxy`. A hop count, or a list
3
+ * of trusted proxy addresses/CIDRs/named ranges. Deliberately not `boolean`:
4
+ * `true` means "believe every client's X-Forwarded-For".
5
+ */
6
+ export type TrustedProxy = number | string[];
7
+ /** Raw values, as the composition root read them from the environment. */
8
+ export interface TrustedProxyEnv {
9
+ /** `TRUSTED_PROXY_HOPS` — how many proxies sit in front of the backend. */
10
+ hops?: string | undefined;
11
+ /** `TRUSTED_PROXY_ADDRESSES` — comma-separated proxy addresses/CIDRs. */
12
+ addresses?: string | undefined;
13
+ }
14
+ /** A configuration value the parser refuses. The composition root fails the boot on it. */
15
+ export declare class TrustedProxyConfigError extends Error {
16
+ constructor(message: string);
17
+ }
18
+ /** Fastify's `trustProxy` function form: `hop` 0 is the socket's own peer. */
19
+ export type TrustProxyFunction = (address: string, hop: number) => boolean;
20
+ /**
21
+ * What `buildServer` hands Fastify for a {@link TrustedProxy}.
22
+ *
23
+ * Fastify 5.12.1 (GHSA-3m5p-2c4r-xxw2) removed the numeric `trustProxy`: a
24
+ * number now fails closed at runtime, so `TRUSTED_PROXY_HOPS=1` would silently
25
+ * go back to reporting the proxy as the client. A hop count is therefore
26
+ * translated into the function form, and the function is exactly what Fastify
27
+ * compiled a number into before 5.12.1 — `@fastify/proxy-addr` walks the chain
28
+ * from the socket peer (hop 0) through `X-Forwarded-For` right to left, and
29
+ * trusts hop `i` while `i < hops`. The address list is passed through
30
+ * unchanged; Fastify compiles it itself.
31
+ *
32
+ * Like the numeric form it replaces, a hop count does not look at the
33
+ * connecting address, so it is only as safe as the network that guarantees the
34
+ * backend is reachable through its proxies alone. `TRUSTED_PROXY_ADDRESSES`
35
+ * is the form that does not depend on that.
36
+ */
37
+ export declare function toFastifyTrustProxy(trusted: TrustedProxy): TrustProxyFunction | string[];
38
+ /**
39
+ * Turns the two environment variables into the value `buildServer` takes.
40
+ * Returns `undefined` when neither is set — the server then trusts no proxy,
41
+ * which is what it has always done.
42
+ *
43
+ * Throws `TrustedProxyConfigError` on anything it cannot make sense of, rather
44
+ * than falling back to the default: an operator who mistyped the variable would
45
+ * otherwise get the broken behaviour they were trying to fix, silently.
46
+ */
47
+ export declare function parseTrustedProxy(env: TrustedProxyEnv): TrustedProxy | undefined;
48
+ //# sourceMappingURL=trusted-proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trusted-proxy.d.ts","sourceRoot":"","sources":["../../src/http/trusted-proxy.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAE7C,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,2FAA2F;AAC3F,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAiFD,8EAA8E;AAC9E,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;AAE3E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,kBAAkB,GAAG,MAAM,EAAE,CAIxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,GAAG,YAAY,GAAG,SAAS,CAahF"}
@@ -0,0 +1,136 @@
1
+ // Trusted-proxy configuration for the HTTP server (issue #220).
2
+ //
3
+ // Behind a reverse proxy the TCP peer is the proxy, so `request.ip` is the
4
+ // proxy's address for every request unless Fastify is told which hop to trust.
5
+ // That address is what the per-IP rate limiter buckets on and what the MFA,
6
+ // impersonation and prompt-action audit rows record, so an unconfigured
7
+ // deployment behind nginx has one shared rate-limit bucket for the whole
8
+ // internet and a security audit trail that names its own proxy.
9
+ //
10
+ // Trusting the header unconditionally is the other failure, not the fix: with
11
+ // `trustProxy: true` Fastify believes any `X-Forwarded-For` a client sends, and
12
+ // a client can send whatever it likes. So this module parses the *narrow*
13
+ // forms — a hop count, or the addresses the deployment's own proxies use — and
14
+ // has no spelling at all for "trust everything". The unsafe answer is not hard
15
+ // to write here; it is unwritable.
16
+ //
17
+ // This file reads no environment variable. `src/http` is a platform root
18
+ // (D-52/D-53): the composition root reads the variables and injects the parsed
19
+ // value, exactly as it does for the rate-limit ceiling.
20
+ import { isIP } from 'node:net';
21
+ /** A configuration value the parser refuses. The composition root fails the boot on it. */
22
+ export class TrustedProxyConfigError extends Error {
23
+ constructor(message) {
24
+ super(message);
25
+ this.name = 'TrustedProxyConfigError';
26
+ }
27
+ }
28
+ /**
29
+ * Sanity ceiling on the hop count. Real deployments have one or two proxies
30
+ * (host nginx, optionally a CDN in front of it); a larger number is a typo, and
31
+ * a large enough one is `true` written in a way that looks careful.
32
+ */
33
+ const MAX_HOPS = 10;
34
+ /** Address ranges `@fastify/proxy-addr` knows by name. */
35
+ const NAMED_RANGES = new Set(['loopback', 'linklocal', 'uniquelocal']);
36
+ const HOPS_VAR = 'TRUSTED_PROXY_HOPS';
37
+ const ADDRESSES_VAR = 'TRUSTED_PROXY_ADDRESSES';
38
+ function blank(value) {
39
+ return value === undefined || value.trim() === '';
40
+ }
41
+ function parseHops(raw) {
42
+ const trimmed = raw.trim();
43
+ if (!/^[0-9]+$/.test(trimmed)) {
44
+ throw new TrustedProxyConfigError(`${HOPS_VAR}="${raw}" is not a whole number. Set it to the number of proxies in front of ` +
45
+ `the backend (a single host nginx is 1), or use ${ADDRESSES_VAR} instead.`);
46
+ }
47
+ const hops = Number(trimmed);
48
+ if (hops < 1 || hops > MAX_HOPS) {
49
+ throw new TrustedProxyConfigError(`${HOPS_VAR}=${trimmed} is out of range — it must be between 1 and ${MAX_HOPS}. ` +
50
+ `0 does not mean "trust nothing" (leave ${HOPS_VAR} unset for that); it makes the ` +
51
+ `socket's own peer the client.`);
52
+ }
53
+ return hops;
54
+ }
55
+ function assertUsableAddress(entry) {
56
+ if (NAMED_RANGES.has(entry))
57
+ return;
58
+ const slash = entry.indexOf('/');
59
+ const address = slash === -1 ? entry : entry.slice(0, slash);
60
+ const family = isIP(address);
61
+ if (family === 0) {
62
+ throw new TrustedProxyConfigError(`${ADDRESSES_VAR} entry "${entry}" is not an IP address, a CIDR range or one of ` +
63
+ `${[...NAMED_RANGES].join(', ')}. Host names are not resolved — the match is made ` +
64
+ `against the connecting address, so a name would silently match nothing.`);
65
+ }
66
+ if (slash === -1)
67
+ return;
68
+ const prefix = entry.slice(slash + 1);
69
+ const maxPrefix = family === 4 ? 32 : 128;
70
+ if (!/^[0-9]+$/.test(prefix) || Number(prefix) > maxPrefix) {
71
+ throw new TrustedProxyConfigError(`${ADDRESSES_VAR} entry "${entry}" has an invalid prefix length — expected 1..${maxPrefix}.`);
72
+ }
73
+ if (Number(prefix) === 0) {
74
+ throw new TrustedProxyConfigError(`${ADDRESSES_VAR} entry "${entry}" trusts every address, which is the same as believing ` +
75
+ `any client's X-Forwarded-For header. List the deployment's own proxy addresses, or ` +
76
+ `set ${HOPS_VAR} to the number of proxies in front of the backend.`);
77
+ }
78
+ }
79
+ function parseAddresses(raw) {
80
+ const entries = raw
81
+ .split(',')
82
+ .map((entry) => entry.trim())
83
+ .filter((entry) => entry !== '');
84
+ if (entries.length === 0) {
85
+ throw new TrustedProxyConfigError(`${ADDRESSES_VAR}="${raw}" lists no address.`);
86
+ }
87
+ for (const entry of entries)
88
+ assertUsableAddress(entry);
89
+ return entries;
90
+ }
91
+ /**
92
+ * What `buildServer` hands Fastify for a {@link TrustedProxy}.
93
+ *
94
+ * Fastify 5.12.1 (GHSA-3m5p-2c4r-xxw2) removed the numeric `trustProxy`: a
95
+ * number now fails closed at runtime, so `TRUSTED_PROXY_HOPS=1` would silently
96
+ * go back to reporting the proxy as the client. A hop count is therefore
97
+ * translated into the function form, and the function is exactly what Fastify
98
+ * compiled a number into before 5.12.1 — `@fastify/proxy-addr` walks the chain
99
+ * from the socket peer (hop 0) through `X-Forwarded-For` right to left, and
100
+ * trusts hop `i` while `i < hops`. The address list is passed through
101
+ * unchanged; Fastify compiles it itself.
102
+ *
103
+ * Like the numeric form it replaces, a hop count does not look at the
104
+ * connecting address, so it is only as safe as the network that guarantees the
105
+ * backend is reachable through its proxies alone. `TRUSTED_PROXY_ADDRESSES`
106
+ * is the form that does not depend on that.
107
+ */
108
+ export function toFastifyTrustProxy(trusted) {
109
+ if (Array.isArray(trusted))
110
+ return trusted;
111
+ const hops = trusted;
112
+ return (_address, hop) => hop < hops;
113
+ }
114
+ /**
115
+ * Turns the two environment variables into the value `buildServer` takes.
116
+ * Returns `undefined` when neither is set — the server then trusts no proxy,
117
+ * which is what it has always done.
118
+ *
119
+ * Throws `TrustedProxyConfigError` on anything it cannot make sense of, rather
120
+ * than falling back to the default: an operator who mistyped the variable would
121
+ * otherwise get the broken behaviour they were trying to fix, silently.
122
+ */
123
+ export function parseTrustedProxy(env) {
124
+ const hopsSet = !blank(env.hops);
125
+ const addressesSet = !blank(env.addresses);
126
+ if (hopsSet && addressesSet) {
127
+ throw new TrustedProxyConfigError(`${HOPS_VAR} and ${ADDRESSES_VAR} are both set. They are two ways of saying the same ` +
128
+ `thing and Fastify takes one — set exactly one of them.`);
129
+ }
130
+ if (hopsSet)
131
+ return parseHops(env.hops);
132
+ if (addressesSet)
133
+ return parseAddresses(env.addresses);
134
+ return undefined;
135
+ }
136
+ //# sourceMappingURL=trusted-proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trusted-proxy.js","sourceRoot":"","sources":["../../src/http/trusted-proxy.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,yEAAyE;AACzE,gEAAgE;AAChE,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,0EAA0E;AAC1E,+EAA+E;AAC/E,+EAA+E;AAC/E,mCAAmC;AACnC,EAAE;AACF,yEAAyE;AACzE,+EAA+E;AAC/E,wDAAwD;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-0,0 +1,33 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * Row in the audit log of sensitive operations (FR-084, R-12).
4
+ * Never soft-deleted — accounting + audit retention ≥ 5 years per spec assumptions.
5
+ */
6
+ export declare class AuditLogEntry {
7
+ [OptionalProps]?: 'id' | 'actedAt';
8
+ id: string;
9
+ /** The Admin User who performed the action. Null for system-initiated entries. */
10
+ actorAdminUserId?: string | null;
11
+ /**
12
+ * The Customer Account being acted upon by the Admin User during Impersonation (R-12).
13
+ * Non-null entries describe operations performed on behalf of the Customer.
14
+ */
15
+ impersonatedCustomerAccountId?: string | null;
16
+ actedAt: Date;
17
+ /**
18
+ * Screaming-snake-case action identifier, e.g. `price.update`, `permission.change`,
19
+ * `credit_limit.adjust`, `impersonation.start`, `impersonation.end`.
20
+ */
21
+ action: string;
22
+ /** Polymorphic pointer to the affected entity. */
23
+ objectType: string;
24
+ objectId: string;
25
+ /** Diff-friendly snapshot of the affected fields before the mutation. */
26
+ stateBefore?: Record<string, unknown> | null;
27
+ stateAfter?: Record<string, unknown> | null;
28
+ ipAddress?: string | null;
29
+ userAgent?: string | null;
30
+ /** Correlation id from the inbound request (X-Request-Id). */
31
+ requestId?: string | null;
32
+ }
33
+ //# sourceMappingURL=audit-log-entry.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-log-entry.entity.d.ts","sourceRoot":"","sources":["../../../src/kernel/audit/audit-log-entry.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AAIrF;;;GAGG;AACH,qBAEa,aAAa;IACxB,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAGnC,EAAE,EAAE,MAAM,CAAgB;IAE1B,kFAAkF;IAGlF,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IAGH,6BAA6B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI9C,OAAO,EAAE,IAAI,CAAc;IAE3B;;;OAGG;IAGH,MAAM,EAAG,MAAM,CAAC;IAEhB,kDAAkD;IAElD,UAAU,EAAG,MAAM,CAAC;IAIpB,QAAQ,EAAG,MAAM,CAAC;IAElB,yEAAyE;IAEzE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAG7C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAG5C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,8DAA8D;IAE9D,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}