@pattern-stack/codegen 0.15.0 → 0.15.2

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 (562) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/dist/chunk-24CWKBK5.js +94 -0
  3. package/dist/chunk-24CWKBK5.js.map +1 -0
  4. package/dist/chunk-2E224ZSN.js +20 -0
  5. package/dist/chunk-2E224ZSN.js.map +1 -0
  6. package/dist/chunk-2FTZLDBP.js +179 -0
  7. package/dist/chunk-2FTZLDBP.js.map +1 -0
  8. package/dist/chunk-2N4UG4VD.js +20 -0
  9. package/dist/chunk-2N4UG4VD.js.map +1 -0
  10. package/dist/chunk-2TVVBC53.js +92 -0
  11. package/dist/chunk-2TVVBC53.js.map +1 -0
  12. package/dist/chunk-2VHZ7EKC.js +37 -0
  13. package/dist/chunk-2VHZ7EKC.js.map +1 -0
  14. package/dist/chunk-32BMMV4H.js +109 -0
  15. package/dist/chunk-32BMMV4H.js.map +1 -0
  16. package/dist/chunk-32DOFN3T.js +4042 -0
  17. package/dist/chunk-32DOFN3T.js.map +1 -0
  18. package/dist/chunk-36U5UGIO.js +107 -0
  19. package/dist/chunk-36U5UGIO.js.map +1 -0
  20. package/dist/chunk-3CJFPU6Q.js +14 -0
  21. package/dist/chunk-3CJFPU6Q.js.map +1 -0
  22. package/dist/chunk-3NMCDN7L.js +90 -0
  23. package/dist/chunk-3NMCDN7L.js.map +1 -0
  24. package/dist/chunk-3SZFUTXE.js +62 -0
  25. package/dist/chunk-3SZFUTXE.js.map +1 -0
  26. package/dist/chunk-4DOJBQTP.js +117 -0
  27. package/dist/chunk-4DOJBQTP.js.map +1 -0
  28. package/dist/chunk-4JLJYWJC.js +308 -0
  29. package/dist/chunk-4JLJYWJC.js.map +1 -0
  30. package/dist/chunk-4KNXX6TI.js +29 -0
  31. package/dist/chunk-4KNXX6TI.js.map +1 -0
  32. package/dist/chunk-4LH67P4U.js +17 -0
  33. package/dist/chunk-4LH67P4U.js.map +1 -0
  34. package/dist/chunk-4MVGAMUA.js +40 -0
  35. package/dist/chunk-4MVGAMUA.js.map +1 -0
  36. package/dist/chunk-4OMHBMZJ.js +75 -0
  37. package/dist/chunk-4OMHBMZJ.js.map +1 -0
  38. package/dist/chunk-4RFHUZXU.js +635 -0
  39. package/dist/chunk-4RFHUZXU.js.map +1 -0
  40. package/dist/chunk-5A432NZJ.js +7 -0
  41. package/dist/chunk-5A432NZJ.js.map +1 -0
  42. package/dist/chunk-5Y7W3XR6.js +356 -0
  43. package/dist/chunk-5Y7W3XR6.js.map +1 -0
  44. package/dist/chunk-6DWFJNIK.js +15 -0
  45. package/dist/chunk-6DWFJNIK.js.map +1 -0
  46. package/dist/chunk-6I7ULIN6.js +15 -0
  47. package/dist/chunk-6I7ULIN6.js.map +1 -0
  48. package/dist/chunk-6XY6ZMMD.js +25 -0
  49. package/dist/chunk-6XY6ZMMD.js.map +1 -0
  50. package/dist/chunk-7B3RYX45.js +63 -0
  51. package/dist/chunk-7B3RYX45.js.map +1 -0
  52. package/dist/chunk-7C3FOSDI.js +1 -0
  53. package/dist/chunk-7C3FOSDI.js.map +1 -0
  54. package/dist/chunk-7KOW6PU6.js +59 -0
  55. package/dist/chunk-7KOW6PU6.js.map +1 -0
  56. package/dist/chunk-7LKAMLV4.js +92 -0
  57. package/dist/chunk-7LKAMLV4.js.map +1 -0
  58. package/dist/chunk-7RELQJIN.js +22 -0
  59. package/dist/chunk-7RELQJIN.js.map +1 -0
  60. package/dist/chunk-AHV4GDYM.js +63 -0
  61. package/dist/chunk-AHV4GDYM.js.map +1 -0
  62. package/dist/chunk-AQFQ4BYM.js +81 -0
  63. package/dist/chunk-AQFQ4BYM.js.map +1 -0
  64. package/dist/chunk-AS3NAZB6.js +14 -0
  65. package/dist/chunk-AS3NAZB6.js.map +1 -0
  66. package/dist/chunk-BGULBWKJ.js +88 -0
  67. package/dist/chunk-BGULBWKJ.js.map +1 -0
  68. package/dist/chunk-BIO6F7YI.js +17 -0
  69. package/dist/chunk-BIO6F7YI.js.map +1 -0
  70. package/dist/chunk-BOPZWRJK.js +36 -0
  71. package/dist/chunk-BOPZWRJK.js.map +1 -0
  72. package/dist/chunk-BPARRK6F.js +14 -0
  73. package/dist/chunk-BPARRK6F.js.map +1 -0
  74. package/dist/chunk-CO6LUM72.js +59 -0
  75. package/dist/chunk-CO6LUM72.js.map +1 -0
  76. package/dist/chunk-COGHTKXY.js +84 -0
  77. package/dist/chunk-COGHTKXY.js.map +1 -0
  78. package/dist/chunk-DCCZB4UC.js +100 -0
  79. package/dist/chunk-DCCZB4UC.js.map +1 -0
  80. package/dist/chunk-DKKFTHHI.js +53 -0
  81. package/dist/chunk-DKKFTHHI.js.map +1 -0
  82. package/dist/chunk-DV4RV2DC.js +59 -0
  83. package/dist/chunk-DV4RV2DC.js.map +1 -0
  84. package/dist/chunk-EDKJU5BO.js +11 -0
  85. package/dist/chunk-EDKJU5BO.js.map +1 -0
  86. package/dist/chunk-EO2QPOKH.js +116 -0
  87. package/dist/chunk-EO2QPOKH.js.map +1 -0
  88. package/dist/chunk-EOLLMEAH.js +155 -0
  89. package/dist/chunk-EOLLMEAH.js.map +1 -0
  90. package/dist/chunk-EWYCWP4H.js +14 -0
  91. package/dist/chunk-EWYCWP4H.js.map +1 -0
  92. package/dist/chunk-EXVDJMIY.js +33 -0
  93. package/dist/chunk-EXVDJMIY.js.map +1 -0
  94. package/dist/chunk-FASRXRX5.js +19 -0
  95. package/dist/chunk-FASRXRX5.js.map +1 -0
  96. package/dist/chunk-FI34KYZ5.js +1 -0
  97. package/dist/chunk-FI34KYZ5.js.map +1 -0
  98. package/dist/chunk-FN2PYDPP.js +1 -0
  99. package/dist/chunk-FN2PYDPP.js.map +1 -0
  100. package/dist/chunk-GM3RMJIJ.js +92 -0
  101. package/dist/chunk-GM3RMJIJ.js.map +1 -0
  102. package/dist/chunk-GYGNEQSC.js +9 -0
  103. package/dist/chunk-GYGNEQSC.js.map +1 -0
  104. package/dist/chunk-H5NH7KPE.js +21 -0
  105. package/dist/chunk-H5NH7KPE.js.map +1 -0
  106. package/dist/chunk-HNWZFNKP.js +168 -0
  107. package/dist/chunk-HNWZFNKP.js.map +1 -0
  108. package/dist/chunk-HUH73XGI.js +1 -0
  109. package/dist/chunk-HUH73XGI.js.map +1 -0
  110. package/dist/chunk-I6MG4M3F.js +201 -0
  111. package/dist/chunk-I6MG4M3F.js.map +1 -0
  112. package/dist/chunk-I6MVCB5A.js +39 -0
  113. package/dist/chunk-I6MVCB5A.js.map +1 -0
  114. package/dist/chunk-IBGER4YK.js +12 -0
  115. package/dist/chunk-IBGER4YK.js.map +1 -0
  116. package/dist/chunk-IF5I3DAA.js +92 -0
  117. package/dist/chunk-IF5I3DAA.js.map +1 -0
  118. package/dist/chunk-IP4OO26U.js +54 -0
  119. package/dist/chunk-IP4OO26U.js.map +1 -0
  120. package/dist/chunk-IWAOY6KC.js +1 -0
  121. package/dist/chunk-IWAOY6KC.js.map +1 -0
  122. package/dist/chunk-J37YWU7Y.js +19 -0
  123. package/dist/chunk-J37YWU7Y.js.map +1 -0
  124. package/dist/chunk-J6KZS54B.js +269 -0
  125. package/dist/chunk-J6KZS54B.js.map +1 -0
  126. package/dist/chunk-J6MN42LG.js +19 -0
  127. package/dist/chunk-J6MN42LG.js.map +1 -0
  128. package/dist/chunk-JRQO2IOF.js +65 -0
  129. package/dist/chunk-JRQO2IOF.js.map +1 -0
  130. package/dist/chunk-JRVNVKN6.js +212 -0
  131. package/dist/chunk-JRVNVKN6.js.map +1 -0
  132. package/dist/chunk-JWNHNUYL.js +96 -0
  133. package/dist/chunk-JWNHNUYL.js.map +1 -0
  134. package/dist/chunk-K2I6XIK5.js +122 -0
  135. package/dist/chunk-K2I6XIK5.js.map +1 -0
  136. package/dist/chunk-KMZCQASO.js +111 -0
  137. package/dist/chunk-KMZCQASO.js.map +1 -0
  138. package/dist/chunk-KVOWSC5S.js +1 -0
  139. package/dist/chunk-KVOWSC5S.js.map +1 -0
  140. package/dist/chunk-KYR3B3OW.js +79 -0
  141. package/dist/chunk-KYR3B3OW.js.map +1 -0
  142. package/dist/chunk-L3LZWWSX.js +61 -0
  143. package/dist/chunk-L3LZWWSX.js.map +1 -0
  144. package/dist/chunk-L4SDDEEU.js +1 -0
  145. package/dist/chunk-L4SDDEEU.js.map +1 -0
  146. package/dist/chunk-L6FTY45T.js +13 -0
  147. package/dist/chunk-L6FTY45T.js.map +1 -0
  148. package/dist/chunk-L7BNNRGI.js +134 -0
  149. package/dist/chunk-L7BNNRGI.js.map +1 -0
  150. package/dist/chunk-LG57S2SC.js +150 -0
  151. package/dist/chunk-LG57S2SC.js.map +1 -0
  152. package/dist/chunk-M6QLSLPO.js +97 -0
  153. package/dist/chunk-M6QLSLPO.js.map +1 -0
  154. package/dist/chunk-MZ6GV4YF.js +21 -0
  155. package/dist/chunk-MZ6GV4YF.js.map +1 -0
  156. package/dist/chunk-N5OTOWTP.js +55 -0
  157. package/dist/chunk-N5OTOWTP.js.map +1 -0
  158. package/dist/chunk-NN7XZEGF.js +14 -0
  159. package/dist/chunk-NN7XZEGF.js.map +1 -0
  160. package/dist/chunk-NPFPZ2HO.js +13 -0
  161. package/dist/chunk-NPFPZ2HO.js.map +1 -0
  162. package/dist/chunk-NXXDZ6ZF.js +42 -0
  163. package/dist/chunk-NXXDZ6ZF.js.map +1 -0
  164. package/dist/chunk-NYBCQZC7.js +11 -0
  165. package/dist/chunk-NYBCQZC7.js.map +1 -0
  166. package/dist/chunk-OFRRBC7M.js +78 -0
  167. package/dist/chunk-OFRRBC7M.js.map +1 -0
  168. package/dist/chunk-OGIZXGPY.js +222 -0
  169. package/dist/chunk-OGIZXGPY.js.map +1 -0
  170. package/dist/chunk-OKXZ63IA.js +168 -0
  171. package/dist/chunk-OKXZ63IA.js.map +1 -0
  172. package/dist/chunk-OSQRXVG2.js +58 -0
  173. package/dist/chunk-OSQRXVG2.js.map +1 -0
  174. package/dist/chunk-OTDN3OUQ.js +215 -0
  175. package/dist/chunk-OTDN3OUQ.js.map +1 -0
  176. package/dist/chunk-OZZJDRGW.js +122 -0
  177. package/dist/chunk-OZZJDRGW.js.map +1 -0
  178. package/dist/chunk-PNZSGAB2.js +114 -0
  179. package/dist/chunk-PNZSGAB2.js.map +1 -0
  180. package/dist/chunk-PRWIX6UW.js +21 -0
  181. package/dist/chunk-PRWIX6UW.js.map +1 -0
  182. package/dist/chunk-PSXUNOVU.js +7 -0
  183. package/dist/chunk-PSXUNOVU.js.map +1 -0
  184. package/dist/chunk-QLTJSCE6.js +44 -0
  185. package/dist/chunk-QLTJSCE6.js.map +1 -0
  186. package/dist/chunk-RC23QROE.js +447 -0
  187. package/dist/chunk-RC23QROE.js.map +1 -0
  188. package/dist/chunk-RFH7N6EP.js +36 -0
  189. package/dist/chunk-RFH7N6EP.js.map +1 -0
  190. package/dist/chunk-RHVN6NA7.js +134 -0
  191. package/dist/chunk-RHVN6NA7.js.map +1 -0
  192. package/dist/chunk-S7C6TIIF.js +21 -0
  193. package/dist/chunk-S7C6TIIF.js.map +1 -0
  194. package/dist/chunk-SNQ3TOWP.js +20 -0
  195. package/dist/chunk-SNQ3TOWP.js.map +1 -0
  196. package/dist/chunk-SOVM2VEK.js +14 -0
  197. package/dist/chunk-SOVM2VEK.js.map +1 -0
  198. package/dist/chunk-SQDOBLBP.js +13 -0
  199. package/dist/chunk-SQDOBLBP.js.map +1 -0
  200. package/dist/chunk-SR7F3TJY.js +130 -0
  201. package/dist/chunk-SR7F3TJY.js.map +1 -0
  202. package/dist/chunk-SZVPIHWE.js +129 -0
  203. package/dist/chunk-SZVPIHWE.js.map +1 -0
  204. package/dist/chunk-T4BIIU5E.js +89 -0
  205. package/dist/chunk-T4BIIU5E.js.map +1 -0
  206. package/dist/chunk-T6C4LFLC.js +112 -0
  207. package/dist/chunk-T6C4LFLC.js.map +1 -0
  208. package/dist/chunk-TNXH7BJS.js +48 -0
  209. package/dist/chunk-TNXH7BJS.js.map +1 -0
  210. package/dist/chunk-U64T4YZE.js +9 -0
  211. package/dist/chunk-U64T4YZE.js.map +1 -0
  212. package/dist/chunk-UQ5EHOH2.js +39 -0
  213. package/dist/chunk-UQ5EHOH2.js.map +1 -0
  214. package/dist/chunk-UTN4GBPQ.js +1 -0
  215. package/dist/chunk-UTN4GBPQ.js.map +1 -0
  216. package/dist/chunk-V4AF6DI4.js +16 -0
  217. package/dist/chunk-V4AF6DI4.js.map +1 -0
  218. package/dist/chunk-W72PRNJY.js +126 -0
  219. package/dist/chunk-W72PRNJY.js.map +1 -0
  220. package/dist/chunk-WEVWJKOW.js +81 -0
  221. package/dist/chunk-WEVWJKOW.js.map +1 -0
  222. package/dist/chunk-WL67FZGF.js +21 -0
  223. package/dist/chunk-WL67FZGF.js.map +1 -0
  224. package/dist/chunk-WPXNN6QS.js +290 -0
  225. package/dist/chunk-WPXNN6QS.js.map +1 -0
  226. package/dist/chunk-WRUUSZDJ.js +29 -0
  227. package/dist/chunk-WRUUSZDJ.js.map +1 -0
  228. package/dist/chunk-X2GMTYPA.js +50 -0
  229. package/dist/chunk-X2GMTYPA.js.map +1 -0
  230. package/dist/chunk-XCEI7NUH.js +41 -0
  231. package/dist/chunk-XCEI7NUH.js.map +1 -0
  232. package/dist/chunk-Y7GDG744.js +88 -0
  233. package/dist/chunk-Y7GDG744.js.map +1 -0
  234. package/dist/chunk-Y7RRSEOC.js +9 -0
  235. package/dist/chunk-Y7RRSEOC.js.map +1 -0
  236. package/dist/chunk-YPWODKD5.js +184 -0
  237. package/dist/chunk-YPWODKD5.js.map +1 -0
  238. package/dist/chunk-YSLTTQLC.js +25 -0
  239. package/dist/chunk-YSLTTQLC.js.map +1 -0
  240. package/dist/chunk-YTN6BKWA.js +121 -0
  241. package/dist/chunk-YTN6BKWA.js.map +1 -0
  242. package/dist/chunk-Z7PQCAVK.js +200 -0
  243. package/dist/chunk-Z7PQCAVK.js.map +1 -0
  244. package/dist/chunk-ZUKFQL6E.js +47 -0
  245. package/dist/chunk-ZUKFQL6E.js.map +1 -0
  246. package/dist/chunk-ZUMULSEQ.js +1 -0
  247. package/dist/chunk-ZUMULSEQ.js.map +1 -0
  248. package/dist/{job-orchestrator.protocol-CARhMLCO.d.ts → job-orchestrator.protocol-DubMVbm9.d.ts} +1 -1
  249. package/dist/runtime/analytics/index.js +8 -41
  250. package/dist/runtime/analytics/index.js.map +1 -1
  251. package/dist/runtime/analytics/types.js +8 -41
  252. package/dist/runtime/analytics/types.js.map +1 -1
  253. package/dist/runtime/base-classes/activity-entity-repository.js +6 -312
  254. package/dist/runtime/base-classes/activity-entity-repository.js.map +1 -1
  255. package/dist/runtime/base-classes/activity-entity-service.js +6 -212
  256. package/dist/runtime/base-classes/activity-entity-service.js.map +1 -1
  257. package/dist/runtime/base-classes/base-read-use-cases.js +5 -27
  258. package/dist/runtime/base-classes/base-read-use-cases.js.map +1 -1
  259. package/dist/runtime/base-classes/base-repository.js +5 -277
  260. package/dist/runtime/base-classes/base-repository.js.map +1 -1
  261. package/dist/runtime/base-classes/base-service.js +5 -184
  262. package/dist/runtime/base-classes/base-service.js.map +1 -1
  263. package/dist/runtime/base-classes/index.js +59 -1076
  264. package/dist/runtime/base-classes/index.js.map +1 -1
  265. package/dist/runtime/base-classes/integrated-entity-repository.js +6 -486
  266. package/dist/runtime/base-classes/integrated-entity-repository.js.map +1 -1
  267. package/dist/runtime/base-classes/integrated-entity-service.js +6 -213
  268. package/dist/runtime/base-classes/integrated-entity-service.js.map +1 -1
  269. package/dist/runtime/base-classes/junction-integration-repository.js +8 -448
  270. package/dist/runtime/base-classes/junction-integration-repository.js.map +1 -1
  271. package/dist/runtime/base-classes/knowledge-entity-repository.js +6 -283
  272. package/dist/runtime/base-classes/knowledge-entity-repository.js.map +1 -1
  273. package/dist/runtime/base-classes/knowledge-entity-service.js +6 -190
  274. package/dist/runtime/base-classes/knowledge-entity-service.js.map +1 -1
  275. package/dist/runtime/base-classes/lifecycle-events.js +8 -70
  276. package/dist/runtime/base-classes/lifecycle-events.js.map +1 -1
  277. package/dist/runtime/base-classes/metadata-entity-repository.js +6 -330
  278. package/dist/runtime/base-classes/metadata-entity-repository.js.map +1 -1
  279. package/dist/runtime/base-classes/metadata-entity-service.js +6 -212
  280. package/dist/runtime/base-classes/metadata-entity-service.js.map +1 -1
  281. package/dist/runtime/base-classes/tenant-context.js +10 -36
  282. package/dist/runtime/base-classes/tenant-context.js.map +1 -1
  283. package/dist/runtime/base-classes/with-analytics.js +4 -7
  284. package/dist/runtime/base-classes/with-analytics.js.map +1 -1
  285. package/dist/runtime/constants/tokens.js +5 -3
  286. package/dist/runtime/constants/tokens.js.map +1 -1
  287. package/dist/runtime/eav-helpers.js +2 -0
  288. package/dist/runtime/eav-helpers.js.map +1 -1
  289. package/dist/runtime/pipes/zod-validation.pipe.js +3 -10
  290. package/dist/runtime/pipes/zod-validation.pipe.js.map +1 -1
  291. package/dist/runtime/shared/openapi/error-response.dto.js +5 -8
  292. package/dist/runtime/shared/openapi/error-response.dto.js.map +1 -1
  293. package/dist/runtime/shared/openapi/errors.js +5 -19
  294. package/dist/runtime/shared/openapi/errors.js.map +1 -1
  295. package/dist/runtime/shared/openapi/index.js +15 -106
  296. package/dist/runtime/shared/openapi/index.js.map +1 -1
  297. package/dist/runtime/shared/openapi/registry.js +6 -103
  298. package/dist/runtime/shared/openapi/registry.js.map +1 -1
  299. package/dist/runtime/shared/openapi/registry.tokens.js +4 -2
  300. package/dist/runtime/shared/openapi/registry.tokens.js.map +1 -1
  301. package/dist/runtime/subsystems/analytics/analytics.module.js +8 -117
  302. package/dist/runtime/subsystems/analytics/analytics.module.js.map +1 -1
  303. package/dist/runtime/subsystems/analytics/analytics.tokens.js +7 -8
  304. package/dist/runtime/subsystems/analytics/analytics.tokens.js.map +1 -1
  305. package/dist/runtime/subsystems/analytics/cube-backend.js +6 -71
  306. package/dist/runtime/subsystems/analytics/cube-backend.js.map +1 -1
  307. package/dist/runtime/subsystems/analytics/index.js +16 -117
  308. package/dist/runtime/subsystems/analytics/index.js.map +1 -1
  309. package/dist/runtime/subsystems/analytics/noop-backend.js +4 -21
  310. package/dist/runtime/subsystems/analytics/noop-backend.js.map +1 -1
  311. package/dist/runtime/subsystems/auth/auth-oauth-state.schema.js +4 -8
  312. package/dist/runtime/subsystems/auth/auth-oauth-state.schema.js.map +1 -1
  313. package/dist/runtime/subsystems/auth/auth.module.js +12 -359
  314. package/dist/runtime/subsystems/auth/auth.module.js.map +1 -1
  315. package/dist/runtime/subsystems/auth/auth.tokens.js +12 -13
  316. package/dist/runtime/subsystems/auth/auth.tokens.js.map +1 -1
  317. package/dist/runtime/subsystems/auth/backends/encryption-key/env.js +4 -49
  318. package/dist/runtime/subsystems/auth/backends/encryption-key/env.js.map +1 -1
  319. package/dist/runtime/subsystems/auth/backends/state-store.drizzle-backend.js +6 -64
  320. package/dist/runtime/subsystems/auth/backends/state-store.drizzle-backend.js.map +1 -1
  321. package/dist/runtime/subsystems/auth/backends/state-store.memory-backend.js +5 -47
  322. package/dist/runtime/subsystems/auth/backends/state-store.memory-backend.js.map +1 -1
  323. package/dist/runtime/subsystems/auth/controllers/auth.controller.js +5 -139
  324. package/dist/runtime/subsystems/auth/controllers/auth.controller.js.map +1 -1
  325. package/dist/runtime/subsystems/auth/index.js +53 -542
  326. package/dist/runtime/subsystems/auth/index.js.map +1 -1
  327. package/dist/runtime/subsystems/auth/middleware/requester-context.js +9 -65
  328. package/dist/runtime/subsystems/auth/middleware/requester-context.js.map +1 -1
  329. package/dist/runtime/subsystems/auth/protocols/oauth-state-store.js +4 -9
  330. package/dist/runtime/subsystems/auth/protocols/oauth-state-store.js.map +1 -1
  331. package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js +4 -15
  332. package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js.map +1 -1
  333. package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js +5 -104
  334. package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js.map +1 -1
  335. package/dist/runtime/subsystems/auth/runtime/session-expired.error.js +5 -16
  336. package/dist/runtime/subsystems/auth/runtime/session-expired.error.js.map +1 -1
  337. package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js +5 -29
  338. package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js.map +1 -1
  339. package/dist/runtime/subsystems/bridge/assert-tenant-id.js +5 -18
  340. package/dist/runtime/subsystems/bridge/assert-tenant-id.js.map +1 -1
  341. package/dist/runtime/subsystems/bridge/bridge-delivery-handler.d.ts +2 -2
  342. package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js +12 -184
  343. package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js.map +1 -1
  344. package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.d.ts +1 -1
  345. package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js +10 -448
  346. package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js.map +1 -1
  347. package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.d.ts +1 -1
  348. package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.js +5 -126
  349. package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.js.map +1 -1
  350. package/dist/runtime/subsystems/bridge/bridge-delivery.schema.js +6 -308
  351. package/dist/runtime/subsystems/bridge/bridge-delivery.schema.js.map +1 -1
  352. package/dist/runtime/subsystems/bridge/bridge-errors.js +6 -35
  353. package/dist/runtime/subsystems/bridge/bridge-errors.js.map +1 -1
  354. package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.d.ts +1 -1
  355. package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js +14 -606
  356. package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js.map +1 -1
  357. package/dist/runtime/subsystems/bridge/bridge.module.d.ts +2 -2
  358. package/dist/runtime/subsystems/bridge/bridge.module.js +35 -3476
  359. package/dist/runtime/subsystems/bridge/bridge.module.js.map +1 -1
  360. package/dist/runtime/subsystems/bridge/bridge.protocol.d.ts +1 -1
  361. package/dist/runtime/subsystems/bridge/bridge.tokens.js +9 -7
  362. package/dist/runtime/subsystems/bridge/bridge.tokens.js.map +1 -1
  363. package/dist/runtime/subsystems/bridge/event-flow.service.d.ts +2 -2
  364. package/dist/runtime/subsystems/bridge/event-flow.service.js +11 -137
  365. package/dist/runtime/subsystems/bridge/event-flow.service.js.map +1 -1
  366. package/dist/runtime/subsystems/bridge/generated/registry.d.ts +1 -1
  367. package/dist/runtime/subsystems/bridge/generated/registry.js +4 -2
  368. package/dist/runtime/subsystems/bridge/generated/registry.js.map +1 -1
  369. package/dist/runtime/subsystems/bridge/index.d.ts +2 -2
  370. package/dist/runtime/subsystems/bridge/index.js +60 -3470
  371. package/dist/runtime/subsystems/bridge/index.js.map +1 -1
  372. package/dist/runtime/subsystems/bridge/reserved-pools.js +4 -6
  373. package/dist/runtime/subsystems/bridge/reserved-pools.js.map +1 -1
  374. package/dist/runtime/subsystems/cache/cache.drizzle-backend.js +10 -133
  375. package/dist/runtime/subsystems/cache/cache.drizzle-backend.js.map +1 -1
  376. package/dist/runtime/subsystems/cache/cache.memory-backend.js +6 -101
  377. package/dist/runtime/subsystems/cache/cache.memory-backend.js.map +1 -1
  378. package/dist/runtime/subsystems/cache/cache.module.js +10 -278
  379. package/dist/runtime/subsystems/cache/cache.module.js.map +1 -1
  380. package/dist/runtime/subsystems/cache/cache.schema.js +4 -14
  381. package/dist/runtime/subsystems/cache/cache.schema.js.map +1 -1
  382. package/dist/runtime/subsystems/cache/cache.tokens.js +6 -7
  383. package/dist/runtime/subsystems/cache/cache.tokens.js.map +1 -1
  384. package/dist/runtime/subsystems/cache/index.js +20 -278
  385. package/dist/runtime/subsystems/cache/index.js.map +1 -1
  386. package/dist/runtime/subsystems/events/domain-events.schema.js +3 -72
  387. package/dist/runtime/subsystems/events/domain-events.schema.js.map +1 -1
  388. package/dist/runtime/subsystems/events/event-bus.drizzle-backend.d.ts +1 -1
  389. package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js +9 -413
  390. package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js.map +1 -1
  391. package/dist/runtime/subsystems/events/event-bus.memory-backend.js +7 -235
  392. package/dist/runtime/subsystems/events/event-bus.memory-backend.js.map +1 -1
  393. package/dist/runtime/subsystems/events/event-bus.redis-backend.js +8 -20
  394. package/dist/runtime/subsystems/events/event-bus.redis-backend.js.map +1 -1
  395. package/dist/runtime/subsystems/events/event-keyset-cursor.js +8 -30
  396. package/dist/runtime/subsystems/events/event-keyset-cursor.js.map +1 -1
  397. package/dist/runtime/subsystems/events/event-read.protocol.js +2 -0
  398. package/dist/runtime/subsystems/events/event-read.protocol.js.map +1 -1
  399. package/dist/runtime/subsystems/events/event-registry.d.ts +77 -0
  400. package/dist/runtime/subsystems/events/event-registry.js +1 -0
  401. package/dist/runtime/subsystems/events/event-registry.js.map +1 -0
  402. package/dist/runtime/subsystems/events/events-errors.js +4 -11
  403. package/dist/runtime/subsystems/events/events-errors.js.map +1 -1
  404. package/dist/runtime/subsystems/events/events.module.js +15 -949
  405. package/dist/runtime/subsystems/events/events.module.js.map +1 -1
  406. package/dist/runtime/subsystems/events/events.tokens.js +10 -11
  407. package/dist/runtime/subsystems/events/events.tokens.js.map +1 -1
  408. package/dist/runtime/subsystems/events/generated/bus.js +9 -240
  409. package/dist/runtime/subsystems/events/generated/bus.js.map +1 -1
  410. package/dist/runtime/subsystems/events/generated/index.js +23 -240
  411. package/dist/runtime/subsystems/events/generated/index.js.map +1 -1
  412. package/dist/runtime/subsystems/events/generated/registry.js +5 -82
  413. package/dist/runtime/subsystems/events/generated/registry.js.map +1 -1
  414. package/dist/runtime/subsystems/events/generated/schemas.js +12 -52
  415. package/dist/runtime/subsystems/events/generated/schemas.js.map +1 -1
  416. package/dist/runtime/subsystems/events/generated/types.js +1 -0
  417. package/dist/runtime/subsystems/events/index.d.ts +1 -0
  418. package/dist/runtime/subsystems/events/index.js +32 -949
  419. package/dist/runtime/subsystems/events/index.js.map +1 -1
  420. package/dist/runtime/subsystems/index.d.ts +2 -2
  421. package/dist/runtime/subsystems/index.js +171 -5912
  422. package/dist/runtime/subsystems/index.js.map +1 -1
  423. package/dist/runtime/subsystems/integration/build-change-source.js +6 -178
  424. package/dist/runtime/subsystems/integration/build-change-source.js.map +1 -1
  425. package/dist/runtime/subsystems/integration/deep-equal.differ.js +4 -109
  426. package/dist/runtime/subsystems/integration/deep-equal.differ.js.map +1 -1
  427. package/dist/runtime/subsystems/integration/detection-config.schema.js +11 -78
  428. package/dist/runtime/subsystems/integration/detection-config.schema.js.map +1 -1
  429. package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.js +5 -30
  430. package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.js.map +1 -1
  431. package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.js +4 -9
  432. package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.js.map +1 -1
  433. package/dist/runtime/subsystems/integration/execute-integration.use-case.js +6 -239
  434. package/dist/runtime/subsystems/integration/execute-integration.use-case.js.map +1 -1
  435. package/dist/runtime/subsystems/integration/incremental-read.js +5 -144
  436. package/dist/runtime/subsystems/integration/incremental-read.js.map +1 -1
  437. package/dist/runtime/subsystems/integration/index.js +83 -1352
  438. package/dist/runtime/subsystems/integration/index.js.map +1 -1
  439. package/dist/runtime/subsystems/integration/integration-audit.schema.js +10 -155
  440. package/dist/runtime/subsystems/integration/integration-audit.schema.js.map +1 -1
  441. package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js +7 -270
  442. package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js.map +1 -1
  443. package/dist/runtime/subsystems/integration/integration-cursor-store.memory-backend.js +4 -65
  444. package/dist/runtime/subsystems/integration/integration-cursor-store.memory-backend.js.map +1 -1
  445. package/dist/runtime/subsystems/integration/integration-errors.js +5 -15
  446. package/dist/runtime/subsystems/integration/integration-errors.js.map +1 -1
  447. package/dist/runtime/subsystems/integration/integration-field-diff.protocol.js +5 -7
  448. package/dist/runtime/subsystems/integration/integration-field-diff.protocol.js.map +1 -1
  449. package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +8 -303
  450. package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js.map +1 -1
  451. package/dist/runtime/subsystems/integration/integration-run-recorder.memory-backend.js +5 -125
  452. package/dist/runtime/subsystems/integration/integration-run-recorder.memory-backend.js.map +1 -1
  453. package/dist/runtime/subsystems/integration/integration.module.js +13 -700
  454. package/dist/runtime/subsystems/integration/integration.module.js.map +1 -1
  455. package/dist/runtime/subsystems/integration/integration.tokens.js +11 -9
  456. package/dist/runtime/subsystems/integration/integration.tokens.js.map +1 -1
  457. package/dist/runtime/subsystems/integration/loopback.middleware.js +4 -16
  458. package/dist/runtime/subsystems/integration/loopback.middleware.js.map +1 -1
  459. package/dist/runtime/subsystems/integration/poll-change-source.js +4 -89
  460. package/dist/runtime/subsystems/integration/poll-change-source.js.map +1 -1
  461. package/dist/runtime/subsystems/integration/webhook-change-source.js +4 -70
  462. package/dist/runtime/subsystems/integration/webhook-change-source.js.map +1 -1
  463. package/dist/runtime/subsystems/jobs/bullmq.config.js +9 -140
  464. package/dist/runtime/subsystems/jobs/bullmq.config.js.map +1 -1
  465. package/dist/runtime/subsystems/jobs/index.d.ts +2 -2
  466. package/dist/runtime/subsystems/jobs/index.js +88 -2691
  467. package/dist/runtime/subsystems/jobs/index.js.map +1 -1
  468. package/dist/runtime/subsystems/jobs/job-handler.base.d.ts +2 -2
  469. package/dist/runtime/subsystems/jobs/job-handler.base.js +10 -49
  470. package/dist/runtime/subsystems/jobs/job-handler.base.js.map +1 -1
  471. package/dist/runtime/subsystems/jobs/job-orchestration.schema.js +13 -152
  472. package/dist/runtime/subsystems/jobs/job-orchestration.schema.js.map +1 -1
  473. package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.d.ts +2 -2
  474. package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js +36 -699
  475. package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js.map +1 -1
  476. package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.d.ts +2 -2
  477. package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.js +10 -564
  478. package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.js.map +1 -1
  479. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.d.ts +2 -2
  480. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +10 -824
  481. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js.map +1 -1
  482. package/dist/runtime/subsystems/jobs/job-orchestrator.protocol.d.ts +2 -2
  483. package/dist/runtime/subsystems/jobs/job-run-keyset-cursor.d.ts +2 -2
  484. package/dist/runtime/subsystems/jobs/job-run-keyset-cursor.js +9 -51
  485. package/dist/runtime/subsystems/jobs/job-run-keyset-cursor.js.map +1 -1
  486. package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.d.ts +2 -2
  487. package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.js +9 -416
  488. package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.js.map +1 -1
  489. package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.d.ts +2 -2
  490. package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js +9 -290
  491. package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js.map +1 -1
  492. package/dist/runtime/subsystems/jobs/job-run-service.protocol.d.ts +2 -2
  493. package/dist/runtime/subsystems/jobs/job-step-service.drizzle-backend.js +5 -213
  494. package/dist/runtime/subsystems/jobs/job-step-service.drizzle-backend.js.map +1 -1
  495. package/dist/runtime/subsystems/jobs/job-step-service.memory-backend.js +5 -131
  496. package/dist/runtime/subsystems/jobs/job-step-service.memory-backend.js.map +1 -1
  497. package/dist/runtime/subsystems/jobs/job-worker.bullmq-backend.d.ts +2 -2
  498. package/dist/runtime/subsystems/jobs/job-worker.bullmq-backend.js +9 -175
  499. package/dist/runtime/subsystems/jobs/job-worker.bullmq-backend.js.map +1 -1
  500. package/dist/runtime/subsystems/jobs/job-worker.d.ts +2 -2
  501. package/dist/runtime/subsystems/jobs/job-worker.js +14 -613
  502. package/dist/runtime/subsystems/jobs/job-worker.js.map +1 -1
  503. package/dist/runtime/subsystems/jobs/job-worker.module.d.ts +2 -2
  504. package/dist/runtime/subsystems/jobs/job-worker.module.js +23 -2647
  505. package/dist/runtime/subsystems/jobs/job-worker.module.js.map +1 -1
  506. package/dist/runtime/subsystems/jobs/jobs-domain.module.js +19 -1897
  507. package/dist/runtime/subsystems/jobs/jobs-domain.module.js.map +1 -1
  508. package/dist/runtime/subsystems/jobs/jobs-domain.tokens.js +8 -9
  509. package/dist/runtime/subsystems/jobs/jobs-domain.tokens.js.map +1 -1
  510. package/dist/runtime/subsystems/jobs/jobs-errors.d.ts +2 -2
  511. package/dist/runtime/subsystems/jobs/jobs-errors.js +10 -78
  512. package/dist/runtime/subsystems/jobs/jobs-errors.js.map +1 -1
  513. package/dist/runtime/subsystems/jobs/memory-job-store.js +4 -15
  514. package/dist/runtime/subsystems/jobs/memory-job-store.js.map +1 -1
  515. package/dist/runtime/subsystems/jobs/pool-config.loader.js +9 -124
  516. package/dist/runtime/subsystems/jobs/pool-config.loader.js.map +1 -1
  517. package/dist/runtime/subsystems/observability/index.d.ts +2 -2
  518. package/dist/runtime/subsystems/observability/index.js +21 -310
  519. package/dist/runtime/subsystems/observability/index.js.map +1 -1
  520. package/dist/runtime/subsystems/observability/observability-errors.js +4 -9
  521. package/dist/runtime/subsystems/observability/observability-errors.js.map +1 -1
  522. package/dist/runtime/subsystems/observability/observability.module.js +11 -300
  523. package/dist/runtime/subsystems/observability/observability.module.js.map +1 -1
  524. package/dist/runtime/subsystems/observability/observability.protocol.d.ts +2 -2
  525. package/dist/runtime/subsystems/observability/observability.service.d.ts +2 -2
  526. package/dist/runtime/subsystems/observability/observability.service.js +9 -197
  527. package/dist/runtime/subsystems/observability/observability.service.js.map +1 -1
  528. package/dist/runtime/subsystems/observability/observability.tokens.js +5 -3
  529. package/dist/runtime/subsystems/observability/observability.tokens.js.map +1 -1
  530. package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.d.ts +2 -2
  531. package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js +4 -84
  532. package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js.map +1 -1
  533. package/dist/runtime/subsystems/observability/reporters/index.d.ts +2 -2
  534. package/dist/runtime/subsystems/observability/reporters/index.js +5 -84
  535. package/dist/runtime/subsystems/observability/reporters/index.js.map +1 -1
  536. package/dist/runtime/subsystems/storage/index.js +15 -200
  537. package/dist/runtime/subsystems/storage/index.js.map +1 -1
  538. package/dist/runtime/subsystems/storage/storage.local-backend.js +4 -103
  539. package/dist/runtime/subsystems/storage/storage.local-backend.js.map +1 -1
  540. package/dist/runtime/subsystems/storage/storage.memory-backend.js +5 -68
  541. package/dist/runtime/subsystems/storage/storage.memory-backend.js.map +1 -1
  542. package/dist/runtime/subsystems/storage/storage.module.js +8 -200
  543. package/dist/runtime/subsystems/storage/storage.module.js.map +1 -1
  544. package/dist/runtime/subsystems/storage/storage.tokens.js +5 -6
  545. package/dist/runtime/subsystems/storage/storage.tokens.js.map +1 -1
  546. package/dist/runtime/subsystems/storage/storage.utils.js +4 -14
  547. package/dist/runtime/subsystems/storage/storage.utils.js.map +1 -1
  548. package/dist/runtime/subsystems/token-key.js +5 -3
  549. package/dist/runtime/subsystems/token-key.js.map +1 -1
  550. package/dist/src/cli/index.js +653 -5444
  551. package/dist/src/cli/index.js.map +1 -1
  552. package/dist/src/index.js +68 -4170
  553. package/dist/src/index.js.map +1 -1
  554. package/package.json +1 -1
  555. package/runtime/subsystems/bridge/bridge-delivery-handler.ts +1 -1
  556. package/runtime/subsystems/bridge/bridge-outbox-drain-hook.ts +45 -22
  557. package/runtime/subsystems/bridge/bridge.protocol.ts +1 -1
  558. package/runtime/subsystems/bridge/event-flow.service.ts +1 -1
  559. package/runtime/subsystems/events/event-registry.ts +77 -0
  560. package/runtime/subsystems/events/index.ts +12 -0
  561. package/runtime/subsystems/jobs/job-handler.base.ts +1 -1
  562. package/runtime/subsystems/jobs/job-worker.ts +17 -11
@@ -0,0 +1,290 @@
1
+ import {
2
+ JobWorker
3
+ } from "./chunk-RC23QROE.js";
4
+ import {
5
+ JobsDomainModule
6
+ } from "./chunk-KMZCQASO.js";
7
+ import {
8
+ BootValidationError,
9
+ ReservedPoolViolationError
10
+ } from "./chunk-T4BIIU5E.js";
11
+ import {
12
+ BULLMQ_CONNECTION,
13
+ BULLMQ_RESOLVED_CONFIG,
14
+ resolvePoolQueueName
15
+ } from "./chunk-I6MVCB5A.js";
16
+ import {
17
+ allNonReservedPoolNames,
18
+ allPoolNames,
19
+ loadPoolConfig
20
+ } from "./chunk-RHVN6NA7.js";
21
+ import {
22
+ HandlerRegistry
23
+ } from "./chunk-CO6LUM72.js";
24
+ import {
25
+ JOB_ORCHESTRATOR,
26
+ JOB_RUN_SERVICE,
27
+ JOB_STEP_SERVICE
28
+ } from "./chunk-BIO6F7YI.js";
29
+ import {
30
+ tokenKey
31
+ } from "./chunk-GYGNEQSC.js";
32
+ import {
33
+ DRIZZLE
34
+ } from "./chunk-U64T4YZE.js";
35
+ import {
36
+ __decorateClass,
37
+ __decorateParam
38
+ } from "./chunk-2E224ZSN.js";
39
+
40
+ // runtime/subsystems/jobs/job-worker.module.ts
41
+ import {
42
+ Inject,
43
+ Injectable,
44
+ Logger,
45
+ Module,
46
+ Optional
47
+ } from "@nestjs/common";
48
+ import { ModuleRef } from "@nestjs/core";
49
+ var DEFAULT_SHUTDOWN_TIMEOUT_MS = 3e4;
50
+ var JOB_WORKER_MODULE_OPTIONS = Symbol.for(tokenKey("jobs", "worker-module-options"));
51
+ var JobWorkerOrchestrator = class {
52
+ constructor(orchestrator, runService, stepService, options, db = null, moduleRef, bullConnection = null, bullConfig = null) {
53
+ this.orchestrator = orchestrator;
54
+ this.runService = runService;
55
+ this.stepService = stepService;
56
+ this.options = options;
57
+ this.db = db;
58
+ this.moduleRef = moduleRef;
59
+ this.bullConnection = bullConnection;
60
+ this.bullConfig = bullConfig;
61
+ }
62
+ orchestrator;
63
+ runService;
64
+ stepService;
65
+ options;
66
+ db;
67
+ moduleRef;
68
+ bullConnection;
69
+ bullConfig;
70
+ logger = new Logger(JobWorkerOrchestrator.name);
71
+ workers = [];
72
+ // ============================================================================
73
+ // Lifecycle
74
+ // ============================================================================
75
+ async onModuleInit() {
76
+ const backend = this.options.backend ?? "drizzle";
77
+ const poolConfig = loadPoolConfig(this.options.configPath);
78
+ const entries = HandlerRegistry.getAll();
79
+ this.assertNoReservedPoolHandlers(entries, poolConfig);
80
+ const { orphaned } = await this.orchestrator.upsertJobRows(
81
+ entries,
82
+ poolConfig
83
+ );
84
+ if (backend !== "memory" && orphaned.length > 0) {
85
+ throw new BootValidationError(orphaned);
86
+ }
87
+ const activePools = this.options.pools ? this.options.pools : this.options.allPools ? allPoolNames(poolConfig) : allNonReservedPoolNames(poolConfig);
88
+ for (const poolName of activePools) {
89
+ const def = poolConfig.get(poolName);
90
+ if (!def) {
91
+ throw new Error(
92
+ `JobWorkerModule: active pool '${poolName}' is not defined in the resolved pool config. Configured pools: [${[...poolConfig.keys()].join(", ")}].`
93
+ );
94
+ }
95
+ const workerOptions = {
96
+ pool: poolName,
97
+ concurrency: def.concurrency,
98
+ shutdownTimeoutMs: this.options.shutdownTimeoutMs ?? DEFAULT_SHUTDOWN_TIMEOUT_MS
99
+ };
100
+ const worker = this.options.workerFactory ? this.options.workerFactory(workerOptions) : backend === "bullmq" ? await this.spawnBullMQWorker(poolName, def.queue, def.concurrency, poolConfig) : this.spawnWorker(workerOptions);
101
+ await worker.onModuleInit();
102
+ this.workers.push(worker);
103
+ this.logger.log(
104
+ `JobWorker started: pool='${poolName}' (queue='${def.queue}') concurrency=${def.concurrency} backend='${backend}'`
105
+ );
106
+ }
107
+ }
108
+ async onModuleDestroy() {
109
+ for (let i = this.workers.length - 1; i >= 0; i--) {
110
+ const worker = this.workers[i];
111
+ if (!worker) continue;
112
+ try {
113
+ await worker.onModuleDestroy();
114
+ } catch (err) {
115
+ this.logger.error(
116
+ `JobWorker shutdown failed: ${err.message}`
117
+ );
118
+ }
119
+ }
120
+ this.workers.length = 0;
121
+ const orch = this.orchestrator;
122
+ if (typeof orch.closeConnections === "function") {
123
+ try {
124
+ await orch.closeConnections();
125
+ } catch (err) {
126
+ this.logger.error(
127
+ `BullMQ orchestrator connection close failed: ${err.message}`
128
+ );
129
+ }
130
+ }
131
+ }
132
+ // ============================================================================
133
+ // Internals
134
+ // ============================================================================
135
+ /**
136
+ * Walk every registered handler; collect any whose declared `pool`
137
+ * targets a reserved pool from the resolved config. If non-empty,
138
+ * throw `ReservedPoolViolationError` with the offender list so the
139
+ * operator sees every violating class on a single boot.
140
+ */
141
+ assertNoReservedPoolHandlers(entries, poolConfig) {
142
+ const offenders = [];
143
+ for (const entry of entries) {
144
+ if (entry.type.startsWith("@framework/")) continue;
145
+ const declaredPool = entry.meta.pool ?? "batch";
146
+ const def = poolConfig.get(declaredPool);
147
+ if (def?.reserved) {
148
+ offenders.push({
149
+ handlerClass: entry.handlerClass.name,
150
+ pool: declaredPool
151
+ });
152
+ }
153
+ }
154
+ if (offenders.length > 0) {
155
+ throw new ReservedPoolViolationError(offenders);
156
+ }
157
+ }
158
+ /**
159
+ * Production worker spawn. `JobWorker` requires `DRIZZLE` so this only
160
+ * succeeds when the module was booted with `backend: 'drizzle'`. Memory
161
+ * mode tests must supply `workerFactory` — the memory backend has no
162
+ * polling loop equivalent (`MemoryJobOrchestrator` is direct-invocation
163
+ * only).
164
+ *
165
+ * We instantiate outside the Nest container because the module spawns
166
+ * N workers from a single options shape, which doesn't fit Nest's
167
+ * "one provider per token" model. The dependencies are passed
168
+ * positionally; the constructor's `@Inject` decorators are unused on
169
+ * this path (Nest still uses them when `JobWorker` is a provider — e.g.
170
+ * in JOB-6's standalone `worker.ts` entrypoint).
171
+ */
172
+ spawnWorker(workerOptions) {
173
+ if (!this.db) {
174
+ throw new Error(
175
+ `JobWorkerModule: in-process worker spawning requires the Drizzle backend (no DRIZZLE provider available). Memory-mode tests must pass 'workerFactory' to inject a stub.`
176
+ );
177
+ }
178
+ if (!this.moduleRef) {
179
+ throw new Error(
180
+ `JobWorkerModule: ModuleRef not available \u2014 cannot construct JobWorker with handler DI support. Ensure the orchestrator is resolved through the Nest container (not instantiated manually in tests).`
181
+ );
182
+ }
183
+ return new JobWorker(
184
+ this.db,
185
+ this.orchestrator,
186
+ this.runService,
187
+ this.stepService,
188
+ workerOptions,
189
+ this.moduleRef
190
+ );
191
+ }
192
+ /**
193
+ * BULLMQ-1 — spawn a per-pool `BullMQJobWorker`. Requires the Drizzle
194
+ * client (the worker drives `job_run` as the source of truth) AND the
195
+ * resolved BullMQ connection (bound by `JobsDomainModule` when
196
+ * `backend: 'bullmq'`). The queue name is derived identically to the
197
+ * orchestrator's `dispatch` via `resolvePoolQueueName(pool, …)` so producer
198
+ * and consumer agree.
199
+ */
200
+ /**
201
+ * #6 — async + dynamic-import. The `job-worker.bullmq-backend.ts` file is
202
+ * filtered out of the vendor set for drizzle/memory installs (no `bullmq`
203
+ * peer dep needed). The non-literal import specifier makes TS treat the
204
+ * module as `any` so the consumer's tsc never tries to resolve an absent
205
+ * file. This method is only entered when `backend === 'bullmq'` — at which
206
+ * point the file IS vendored.
207
+ */
208
+ async spawnBullMQWorker(pool, _queueAlias, concurrency, poolConfig) {
209
+ if (!this.db) {
210
+ throw new Error(
211
+ `JobWorkerModule: BullMQ worker spawning requires the Drizzle client (no DRIZZLE provider available) \u2014 job_run remains the source of truth.`
212
+ );
213
+ }
214
+ if (!this.bullConnection) {
215
+ throw new Error(
216
+ `JobWorkerModule: BullMQ worker spawning requires a resolved BULLMQ_CONNECTION. Ensure JobsDomainModule was booted with backend: 'bullmq'.`
217
+ );
218
+ }
219
+ if (!this.moduleRef) {
220
+ throw new Error(
221
+ `JobWorkerModule: ModuleRef not available \u2014 cannot construct BullMQJobWorker with handler DI support.`
222
+ );
223
+ }
224
+ const queueName = resolvePoolQueueName(pool, this.bullConfig, poolConfig);
225
+ const specifier = "./job-worker.bullmq-backend";
226
+ const mod = await import(specifier);
227
+ return new mod.BullMQJobWorker(
228
+ this.db,
229
+ this.orchestrator,
230
+ this.stepService,
231
+ {
232
+ pool,
233
+ queueName,
234
+ concurrency,
235
+ connection: this.bullConnection
236
+ },
237
+ this.moduleRef
238
+ );
239
+ }
240
+ };
241
+ JobWorkerOrchestrator = __decorateClass([
242
+ Injectable(),
243
+ __decorateParam(0, Inject(JOB_ORCHESTRATOR)),
244
+ __decorateParam(1, Inject(JOB_RUN_SERVICE)),
245
+ __decorateParam(2, Inject(JOB_STEP_SERVICE)),
246
+ __decorateParam(3, Inject(JOB_WORKER_MODULE_OPTIONS)),
247
+ __decorateParam(4, Optional()),
248
+ __decorateParam(4, Inject(DRIZZLE)),
249
+ __decorateParam(5, Inject(ModuleRef)),
250
+ __decorateParam(6, Optional()),
251
+ __decorateParam(6, Inject(BULLMQ_CONNECTION)),
252
+ __decorateParam(7, Optional()),
253
+ __decorateParam(7, Inject(BULLMQ_RESOLVED_CONFIG))
254
+ ], JobWorkerOrchestrator);
255
+ var JobWorkerModule = class {
256
+ static forRoot(opts) {
257
+ return {
258
+ module: JobWorkerModule,
259
+ imports: [
260
+ JobsDomainModule.forRoot({
261
+ backend: opts.backend ?? "drizzle",
262
+ extensions: opts.domainModuleExtensions,
263
+ multiTenant: opts.multiTenant
264
+ })
265
+ ],
266
+ providers: [
267
+ { provide: JOB_WORKER_MODULE_OPTIONS, useValue: opts },
268
+ JobWorkerOrchestrator
269
+ ],
270
+ // BULLMQ-1 Phase 1 — export the options token so `BridgeModule`'s
271
+ // reserved-pool guard (`onModuleInit`) can actually inject it.
272
+ // Previously `exports: []` left the `@Optional()` inject resolving to
273
+ // `undefined` and the guard silently no-opped (a dead check). With the
274
+ // token exported the guard fires for real; consumers that omit the
275
+ // reserved pools (and don't set `allPools`) now fail fast with
276
+ // `BridgeReservedPoolsNotPolledError` — which is correct.
277
+ exports: [JOB_WORKER_MODULE_OPTIONS]
278
+ };
279
+ }
280
+ };
281
+ JobWorkerModule = __decorateClass([
282
+ Module({})
283
+ ], JobWorkerModule);
284
+
285
+ export {
286
+ JOB_WORKER_MODULE_OPTIONS,
287
+ JobWorkerOrchestrator,
288
+ JobWorkerModule
289
+ };
290
+ //# sourceMappingURL=chunk-WPXNN6QS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../runtime/subsystems/jobs/job-worker.module.ts"],"sourcesContent":["/**\n * JobWorkerModule — `DynamicModule.forRoot({ mode, pools? })` factory that\n * boots one `JobWorker` per active pool and runs the boot-time validator\n * (Drizzle only) (ADR-022, JOB-5).\n *\n * Imports `JobsDomainModule` internally so call sites only need to add\n * `JobWorkerModule.forRoot(...)` to `AppModule.imports` — the protocol\n * tokens become available transitively via `global: true`.\n *\n * Lifecycle (`onModuleInit`, **order-critical** per JOB-5 spec):\n * 1. `loadPoolConfig()` → resolved `PoolConfig`\n * 2. `HandlerRegistry.getAll()` → registered entries\n * 3. Reserved-pool validation → throws `ReservedPoolViolationError`\n * 4. `orchestrator.upsertJobRows(entries, …)` → persist `job` definitions\n * 5. Boot validator (Drizzle only) → throws `BootValidationError`\n * (skipped entirely in memory mode — Q4 resolution 2026-04-19)\n * 6. Spawn one `JobWorker` per active pool → start polling loops\n *\n * `onModuleDestroy` calls `gracefulStop` on each worker (drains in-flight,\n * resets `running` rows, removes SIGTERM handler).\n */\nimport {\n Inject,\n Injectable,\n Logger,\n Module,\n Optional,\n type DynamicModule,\n type OnModuleDestroy,\n type OnModuleInit,\n} from '@nestjs/common';\nimport { ModuleRef } from '@nestjs/core';\nimport { tokenKey } from '../token-key';\nimport { DRIZZLE } from '../../constants/tokens';\nimport type { DrizzleClient } from '../../types/drizzle';\nimport { HandlerRegistry, type HandlerRegistryEntry } from './job-handler.base';\nimport {\n JobsDomainModule,\n type JobsDomainModuleOptions,\n} from './jobs-domain.module';\nimport {\n JOB_ORCHESTRATOR,\n JOB_RUN_SERVICE,\n JOB_STEP_SERVICE,\n} from './jobs-domain.tokens';\nimport type { IJobOrchestrator } from './job-orchestrator.protocol';\nimport type { IJobRunService } from './job-run-service.protocol';\nimport type { IJobStepService } from './job-step-service.protocol';\nimport {\n allNonReservedPoolNames,\n allPoolNames,\n loadPoolConfig,\n type PoolConfig,\n} from './pool-config.loader';\nimport { JobWorker, type JobWorkerOptions } from './job-worker';\n// #6 — `BullMQJobWorker` is lazy-loaded only when `backend: 'bullmq'` is\n// selected (`spawnBullMQWorker` below). The file is filtered out of drizzle/\n// memory installs (see `backendFileFilter`). The `ConnectionOptions` type\n// previously imported from `'bullmq'` is replaced by `BullMqConnectionOptions`\n// from `./bullmq.config` (a self-contained structural mirror that does NOT\n// require the `bullmq` peer dep to type-check).\nimport {\n BULLMQ_CONNECTION,\n BULLMQ_RESOLVED_CONFIG,\n resolvePoolQueueName,\n type BullMqConnectionOptions,\n type BullMqResolvedConfig,\n} from './bullmq.config';\nimport {\n BootValidationError,\n ReservedPoolViolationError,\n} from './jobs-errors';\n\nconst DEFAULT_SHUTDOWN_TIMEOUT_MS = 30_000;\n\nexport interface JobWorkerModuleOptions {\n mode: 'embedded' | 'standalone';\n /**\n * Threads into the internal `JobsDomainModule.forRoot({ backend })`\n * import. Default `'drizzle'`. The boot-time validator runs for both\n * `'drizzle'` and `'bullmq'` (both persist `job` rows to Postgres);\n * `'memory'` skips it.\n */\n backend?: 'drizzle' | 'memory' | 'bullmq';\n /**\n * Active pool names. Defaults to every non-reserved pool in the resolved\n * config (i.e. `interactive`, `batch`, plus any user-defined pools).\n * Operators reduce this to one or two pools per worker process to scale\n * horizontally.\n */\n pools?: string[];\n /**\n * BULLMQ-1 Phase 1 — when `true`, `onModuleInit` activates **every** pool\n * in the resolved config, including the reserved `events_*` lanes. This is\n * how the standalone worker (`worker.ts`) drains bridge wrappers without\n * the consumer hand-listing `...BRIDGE_RESERVED_POOLS`. Mutually exclusive\n * with an explicit `pools` list — when both are set, `pools` wins (explicit\n * beats blanket) and `allPools` is ignored.\n *\n * `BridgeModule`'s reserved-pool guard short-circuits to \"pass\" when this\n * is `true`, since every reserved pool is provably being polled.\n */\n allPools?: boolean;\n /** SIGTERM drain budget. Default 30_000 ms. */\n shutdownTimeoutMs?: number;\n /**\n * Test-only — point the pool config loader at a specific YAML file.\n * Production code reads `${process.cwd()}/codegen.config.yaml`.\n */\n configPath?: string;\n /**\n * Forwarded into the inner `JobsDomainModule.forRoot()` call so the\n * worker module's caller can configure backend extensions in one place.\n */\n domainModuleExtensions?: JobsDomainModuleOptions['extensions'];\n /** Forwarded into `JobsDomainModule.forRoot()`. JOB-8 wires this. */\n multiTenant?: boolean;\n /**\n * Test-only escape hatch — when set, the module uses this factory\n * instead of `new JobWorker(...)` so unit tests can stub the worker\n * without spinning up the polling loop.\n */\n workerFactory?: (options: JobWorkerOptions) => Pick<JobWorker, 'onModuleInit' | 'onModuleDestroy'>;\n}\n\n/**\n * DI token for the resolved `JobWorkerModuleOptions`. Exported so other\n * subsystems can inject it `@Optional()` and inspect the active\n * configuration — e.g. `BridgeModule.onModuleInit` checks\n * `options.pools` against `BRIDGE_RESERVED_POOLS` to fail fast when a\n * reserved pool isn't being polled (BRIDGE-8).\n *\n * ADR-037: namespaced `Symbol.for(...)` (via `tokenKey()`) — matches by value\n * across runtime copies.\n */\nexport const JOB_WORKER_MODULE_OPTIONS = Symbol.for(tokenKey('jobs', 'worker-module-options'));\n\n/**\n * The lifecycle holder. Named `JobWorkerOrchestrator` in the spec to avoid\n * collision with `JobWorker` and `IJobOrchestrator`. Registered as a\n * provider on `JobWorkerModule`; Nest invokes `onModuleInit` /\n * `onModuleDestroy` automatically.\n */\n@Injectable()\nexport class JobWorkerOrchestrator implements OnModuleInit, OnModuleDestroy {\n private readonly logger = new Logger(JobWorkerOrchestrator.name);\n private readonly workers: Array<Pick<JobWorker, 'onModuleInit' | 'onModuleDestroy'>> = [];\n\n constructor(\n @Inject(JOB_ORCHESTRATOR) private readonly orchestrator: IJobOrchestrator,\n @Inject(JOB_RUN_SERVICE) private readonly runService: IJobRunService,\n @Inject(JOB_STEP_SERVICE) private readonly stepService: IJobStepService,\n @Inject(JOB_WORKER_MODULE_OPTIONS)\n private readonly options: JobWorkerModuleOptions,\n /**\n * Drizzle client is only required when `backend === 'drizzle'`. Made\n * `@Optional()` so memory-mode boots in `Test.createTestingModule`\n * without supplying a `DRIZZLE` provider.\n */\n @Optional() @Inject(DRIZZLE) private readonly db: DrizzleClient | null = null,\n /**\n * ADR-037 (package-mode DI): inject `ModuleRef` EXPLICITLY via `@Inject`\n * rather than relying on `design:paramtypes` reflection. The published\n * package bundle is built without `emitDecoratorMetadata` (tsup/esbuild\n * default), so a by-type injection here would resolve to `undefined` at\n * boot in package mode — breaking the worker entirely (the\n * `ModuleRef not available` throw). Vendored mode happened to work only\n * because the consumer's own `tsc` (emitDecoratorMetadata: true)\n * recompiled the source and emitted the metadata. The explicit token is\n * mode-agnostic. `ModuleRef` is always provided by `@nestjs/core`, so no\n * `@Optional()` is needed (it's a hard dependency of the worker path).\n */\n @Inject(ModuleRef) private readonly moduleRef?: ModuleRef,\n /**\n * BULLMQ-1 — resolved BullMQ connection + config, only bound when the\n * inner `JobsDomainModule` was booted with `backend: 'bullmq'`. `@Optional()`\n * so drizzle/memory boots see `null`.\n */\n @Optional()\n @Inject(BULLMQ_CONNECTION)\n private readonly bullConnection: BullMqConnectionOptions | null = null,\n @Optional()\n @Inject(BULLMQ_RESOLVED_CONFIG)\n private readonly bullConfig: BullMqResolvedConfig | null = null,\n ) {}\n\n // ============================================================================\n // Lifecycle\n // ============================================================================\n\n async onModuleInit(): Promise<void> {\n const backend = this.options.backend ?? 'drizzle';\n\n // (1) Pool config first — every later step needs the resolved map.\n const poolConfig = loadPoolConfig(this.options.configPath);\n\n // (2) Snapshot the registry. Decorators run at class-load time so the\n // map is fully populated before any module init fires.\n const entries = HandlerRegistry.getAll();\n\n // (3) Reserved-pool validation BEFORE the upsert. Persisting a\n // reserved-pool handler row would leave the DB in a bad state for\n // the next boot to clean up.\n this.assertNoReservedPoolHandlers(entries, poolConfig);\n\n // (4) Upsert `job` definitions. Drizzle: hash-gated `ON CONFLICT DO\n // UPDATE`. Memory: populates `MemoryJobStore.jobs` + handler-class\n // registry.\n const { orphaned } = await this.orchestrator.upsertJobRows(\n entries,\n poolConfig,\n );\n\n // (5) Boot validator — Drizzle only. Memory mode never has DB rows\n // to validate (Q4 resolution 2026-04-19); the equivalent\n // protection is `MemoryJobOrchestrator.start()` throwing\n // `JobTypeNotFoundError` synchronously for unknown types.\n if (backend !== 'memory' && orphaned.length > 0) {\n throw new BootValidationError(orphaned);\n }\n\n // (6) Resolve active pool list and spawn one worker per pool.\n // Precedence: explicit `pools` > `allPools` (incl. reserved) >\n // non-reserved default. BULLMQ-1 Phase 1 adds the `allPools` rung so\n // the standalone worker drains the reserved `events_*` bridge lanes.\n const activePools = this.options.pools\n ? this.options.pools\n : this.options.allPools\n ? allPoolNames(poolConfig)\n : allNonReservedPoolNames(poolConfig);\n\n for (const poolName of activePools) {\n const def = poolConfig.get(poolName);\n if (!def) {\n throw new Error(\n `JobWorkerModule: active pool '${poolName}' is not defined in ` +\n `the resolved pool config. Configured pools: [${[...poolConfig.keys()].join(', ')}].`,\n );\n }\n // `pool` here is the logical pool name (e.g. 'crm_sync') — the same\n // value the orchestrator persists into `job_run.pool` from\n // `@JobHandler.meta.pool`, and therefore the value the worker's\n // claim query filters on. `def.queue` is a display/routing alias\n // (e.g. 'jobs-crm-sync') used by BullMQ-style backends for queue\n // naming; it MUST NOT be passed as the claim-filter pool, or the\n // worker will never match any row and the pool silently never\n // drains. See v0.4.4 fix notes.\n const workerOptions: JobWorkerOptions = {\n pool: poolName,\n concurrency: def.concurrency,\n shutdownTimeoutMs:\n this.options.shutdownTimeoutMs ?? DEFAULT_SHUTDOWN_TIMEOUT_MS,\n };\n const worker = this.options.workerFactory\n ? this.options.workerFactory(workerOptions)\n : backend === 'bullmq'\n ? await this.spawnBullMQWorker(poolName, def.queue, def.concurrency, poolConfig)\n : this.spawnWorker(workerOptions);\n // `JobWorker` extends Nest's lifecycle hooks but the worker isn't\n // a Nest provider here (we manage the array ourselves). Call\n // `onModuleInit` to start the loop. The Drizzle/stub workers return\n // void; `BullMQJobWorker.onModuleInit` is async (it lazily loads the\n // optional `bullmq` package), so we `await` — awaiting a `void` is a\n // harmless no-op for the synchronous workers.\n await worker.onModuleInit();\n this.workers.push(worker);\n this.logger.log(\n `JobWorker started: pool='${poolName}' (queue='${def.queue}') ` +\n `concurrency=${def.concurrency} backend='${backend}'`,\n );\n }\n }\n\n async onModuleDestroy(): Promise<void> {\n // Tear down in reverse order so the most recently started worker\n // drains first — keeps the SIGTERM handler graph predictable.\n for (let i = this.workers.length - 1; i >= 0; i--) {\n const worker = this.workers[i];\n if (!worker) continue;\n try {\n await worker.onModuleDestroy();\n } catch (err) {\n this.logger.error(\n `JobWorker shutdown failed: ${(err as Error).message}`,\n );\n }\n }\n this.workers.length = 0;\n\n // BULLMQ-1 — close the orchestrator's producer-side Queue/FlowProducer\n // connections so the process can exit cleanly. The orchestrator is the\n // BullMQ producer; workers are the consumers (closed above).\n const orch = this.orchestrator as { closeConnections?: () => Promise<void> };\n if (typeof orch.closeConnections === 'function') {\n try {\n await orch.closeConnections();\n } catch (err) {\n this.logger.error(\n `BullMQ orchestrator connection close failed: ${(err as Error).message}`,\n );\n }\n }\n }\n\n // ============================================================================\n // Internals\n // ============================================================================\n\n /**\n * Walk every registered handler; collect any whose declared `pool`\n * targets a reserved pool from the resolved config. If non-empty,\n * throw `ReservedPoolViolationError` with the offender list so the\n * operator sees every violating class on a single boot.\n */\n private assertNoReservedPoolHandlers(\n entries: HandlerRegistryEntry[],\n poolConfig: PoolConfig,\n ): void {\n const offenders: Array<{ handlerClass: string; pool: string }> = [];\n for (const entry of entries) {\n // Framework-owned handlers (`@framework/*` job types) are allowed in\n // reserved pools — that is in fact the entire point of the reserved\n // `events_*` pools (ADR-022 + ADR-023). The reserved-pool guard\n // exists to keep USER handlers out, not the framework's own\n // bridge-delivery handler. BRIDGE-5 introduced this exemption.\n if (entry.type.startsWith('@framework/')) continue;\n const declaredPool = entry.meta.pool ?? 'batch';\n const def = poolConfig.get(declaredPool);\n if (def?.reserved) {\n offenders.push({\n handlerClass: entry.handlerClass.name,\n pool: declaredPool,\n });\n }\n }\n if (offenders.length > 0) {\n throw new ReservedPoolViolationError(offenders);\n }\n }\n\n /**\n * Production worker spawn. `JobWorker` requires `DRIZZLE` so this only\n * succeeds when the module was booted with `backend: 'drizzle'`. Memory\n * mode tests must supply `workerFactory` — the memory backend has no\n * polling loop equivalent (`MemoryJobOrchestrator` is direct-invocation\n * only).\n *\n * We instantiate outside the Nest container because the module spawns\n * N workers from a single options shape, which doesn't fit Nest's\n * \"one provider per token\" model. The dependencies are passed\n * positionally; the constructor's `@Inject` decorators are unused on\n * this path (Nest still uses them when `JobWorker` is a provider — e.g.\n * in JOB-6's standalone `worker.ts` entrypoint).\n */\n private spawnWorker(workerOptions: JobWorkerOptions): JobWorker {\n if (!this.db) {\n throw new Error(\n `JobWorkerModule: in-process worker spawning requires the Drizzle ` +\n `backend (no DRIZZLE provider available). Memory-mode tests must ` +\n `pass 'workerFactory' to inject a stub.`,\n );\n }\n if (!this.moduleRef) {\n throw new Error(\n `JobWorkerModule: ModuleRef not available — cannot construct JobWorker ` +\n `with handler DI support. Ensure the orchestrator is resolved through ` +\n `the Nest container (not instantiated manually in tests).`,\n );\n }\n return new JobWorker(\n this.db,\n this.orchestrator,\n this.runService,\n this.stepService,\n workerOptions,\n this.moduleRef,\n );\n }\n\n /**\n * BULLMQ-1 — spawn a per-pool `BullMQJobWorker`. Requires the Drizzle\n * client (the worker drives `job_run` as the source of truth) AND the\n * resolved BullMQ connection (bound by `JobsDomainModule` when\n * `backend: 'bullmq'`). The queue name is derived identically to the\n * orchestrator's `dispatch` via `resolvePoolQueueName(pool, …)` so producer\n * and consumer agree.\n */\n /**\n * #6 — async + dynamic-import. The `job-worker.bullmq-backend.ts` file is\n * filtered out of the vendor set for drizzle/memory installs (no `bullmq`\n * peer dep needed). The non-literal import specifier makes TS treat the\n * module as `any` so the consumer's tsc never tries to resolve an absent\n * file. This method is only entered when `backend === 'bullmq'` — at which\n * point the file IS vendored.\n */\n private async spawnBullMQWorker(\n pool: string,\n _queueAlias: string,\n concurrency: number,\n poolConfig: PoolConfig,\n ): Promise<Pick<JobWorker, 'onModuleInit' | 'onModuleDestroy'>> {\n if (!this.db) {\n throw new Error(\n `JobWorkerModule: BullMQ worker spawning requires the Drizzle client ` +\n `(no DRIZZLE provider available) — job_run remains the source of truth.`,\n );\n }\n if (!this.bullConnection) {\n throw new Error(\n `JobWorkerModule: BullMQ worker spawning requires a resolved ` +\n `BULLMQ_CONNECTION. Ensure JobsDomainModule was booted with ` +\n `backend: 'bullmq'.`,\n );\n }\n if (!this.moduleRef) {\n throw new Error(\n `JobWorkerModule: ModuleRef not available — cannot construct ` +\n `BullMQJobWorker with handler DI support.`,\n );\n }\n const queueName = resolvePoolQueueName(pool, this.bullConfig, poolConfig);\n const specifier = './job-worker.bullmq-backend';\n const mod = (await import(specifier)) as {\n BullMQJobWorker: new (...args: unknown[]) => Pick<\n JobWorker,\n 'onModuleInit' | 'onModuleDestroy'\n >;\n };\n return new mod.BullMQJobWorker(\n this.db,\n this.orchestrator,\n this.stepService,\n {\n pool,\n queueName,\n concurrency,\n connection: this.bullConnection,\n },\n this.moduleRef,\n );\n }\n}\n\n@Module({})\nexport class JobWorkerModule {\n static forRoot(opts: JobWorkerModuleOptions): DynamicModule {\n return {\n module: JobWorkerModule,\n imports: [\n JobsDomainModule.forRoot({\n backend: opts.backend ?? 'drizzle',\n extensions: opts.domainModuleExtensions,\n multiTenant: opts.multiTenant,\n }),\n ],\n providers: [\n { provide: JOB_WORKER_MODULE_OPTIONS, useValue: opts },\n JobWorkerOrchestrator,\n ],\n // BULLMQ-1 Phase 1 — export the options token so `BridgeModule`'s\n // reserved-pool guard (`onModuleInit`) can actually inject it.\n // Previously `exports: []` left the `@Optional()` inject resolving to\n // `undefined` and the guard silently no-opped (a dead check). With the\n // token exported the guard fires for real; consumers that omit the\n // reserved pools (and don't set `allPools`) now fail fast with\n // `BridgeReservedPoolsNotPolledError` — which is correct.\n exports: [JOB_WORKER_MODULE_OPTIONS],\n };\n }\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,29 @@
1
+ import {
2
+ PollChangeSource
3
+ } from "./chunk-24CWKBK5.js";
4
+ import {
5
+ WebhookChangeSource
6
+ } from "./chunk-4OMHBMZJ.js";
7
+
8
+ // runtime/subsystems/integration/build-change-source.ts
9
+ function buildChangeSource(cfg, fetch, middlewares = []) {
10
+ switch (cfg.mode) {
11
+ case "poll":
12
+ return new PollChangeSource({
13
+ adapter: fetch,
14
+ config: cfg,
15
+ middlewares
16
+ });
17
+ case "webhook":
18
+ return new WebhookChangeSource({
19
+ queue: fetch,
20
+ config: cfg,
21
+ middlewares
22
+ });
23
+ }
24
+ }
25
+
26
+ export {
27
+ buildChangeSource
28
+ };
29
+ //# sourceMappingURL=chunk-WRUUSZDJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../runtime/subsystems/integration/build-change-source.ts"],"sourcesContent":["/**\n * Integration subsystem — `buildChangeSource()` runtime factory (#250, ADR-033.1 b).\n *\n * Mode-dispatching constructor for `IChangeSource<T>`. Codegen-emitted\n * provider modules call this from `useFactory` once they've resolved the\n * provider-keyed `fetches[provider]` callback and parsed the per-entity\n * `DetectionConfig`. Switching is on `cfg.mode` so the option-bag shape\n * difference between primitives (`adapter` vs. `queue`) stays internal —\n * consumers pass one fetch callback regardless of mode.\n */\nimport type { DetectionConfig } from './detection-config.schema';\nimport type { IChangeSource } from './integration-change-source.protocol';\nimport type { ChangeMiddleware } from './integration-middleware.protocol';\nimport {\n PollChangeSource,\n type PollFetchCallback,\n} from './poll-change-source';\nimport {\n WebhookChangeSource,\n type WebhookFetchCallback,\n} from './webhook-change-source';\n\nexport function buildChangeSource<T>(\n cfg: DetectionConfig,\n fetch: PollFetchCallback<T> | WebhookFetchCallback<T>,\n middlewares: ReadonlyArray<ChangeMiddleware<T>> = [],\n): IChangeSource<T> {\n switch (cfg.mode) {\n case 'poll':\n return new PollChangeSource<T>({\n adapter: fetch as PollFetchCallback<T>,\n config: cfg,\n middlewares,\n });\n case 'webhook':\n return new WebhookChangeSource<T>({\n queue: fetch as WebhookFetchCallback<T>,\n config: cfg,\n middlewares,\n });\n }\n}\n"],"mappings":";;;;;;;;AAsBO,SAAS,kBACd,KACA,OACA,cAAkD,CAAC,GACjC;AAClB,UAAQ,IAAI,MAAM;AAAA,IAChB,KAAK;AACH,aAAO,IAAI,iBAAoB;AAAA,QAC7B,SAAS;AAAA,QACT,QAAQ;AAAA,QACR;AAAA,MACF,CAAC;AAAA,IACH,KAAK;AACH,aAAO,IAAI,oBAAuB;AAAA,QAChC,OAAO;AAAA,QACP,QAAQ;AAAA,QACR;AAAA,MACF,CAAC;AAAA,EACL;AACF;","names":[]}
@@ -0,0 +1,50 @@
1
+ // runtime/analytics/types.ts
2
+ var AggregationType = /* @__PURE__ */ ((AggregationType2) => {
3
+ AggregationType2["SUM"] = "sum";
4
+ AggregationType2["MIN"] = "min";
5
+ AggregationType2["MAX"] = "max";
6
+ AggregationType2["COUNT"] = "count";
7
+ AggregationType2["COUNT_DISTINCT"] = "count_distinct";
8
+ AggregationType2["AVERAGE"] = "average";
9
+ AggregationType2["MEDIAN"] = "median";
10
+ AggregationType2["PERCENTILE"] = "percentile";
11
+ AggregationType2["SUM_BOOLEAN"] = "sum_boolean";
12
+ return AggregationType2;
13
+ })(AggregationType || {});
14
+ var DimensionType = /* @__PURE__ */ ((DimensionType2) => {
15
+ DimensionType2["CATEGORICAL"] = "categorical";
16
+ DimensionType2["TIME"] = "time";
17
+ return DimensionType2;
18
+ })(DimensionType || {});
19
+ var EntityType = /* @__PURE__ */ ((EntityType2) => {
20
+ EntityType2["PRIMARY"] = "primary";
21
+ EntityType2["UNIQUE"] = "unique";
22
+ EntityType2["FOREIGN"] = "foreign";
23
+ EntityType2["NATURAL"] = "natural";
24
+ return EntityType2;
25
+ })(EntityType || {});
26
+ var MetricType = /* @__PURE__ */ ((MetricType2) => {
27
+ MetricType2["SIMPLE"] = "simple";
28
+ MetricType2["DERIVED"] = "derived";
29
+ MetricType2["RATIO"] = "ratio";
30
+ MetricType2["CUMULATIVE"] = "cumulative";
31
+ MetricType2["CONVERSION"] = "conversion";
32
+ return MetricType2;
33
+ })(MetricType || {});
34
+ var TimeGranularity = /* @__PURE__ */ ((TimeGranularity2) => {
35
+ TimeGranularity2["DAY"] = "day";
36
+ TimeGranularity2["WEEK"] = "week";
37
+ TimeGranularity2["MONTH"] = "month";
38
+ TimeGranularity2["QUARTER"] = "quarter";
39
+ TimeGranularity2["YEAR"] = "year";
40
+ return TimeGranularity2;
41
+ })(TimeGranularity || {});
42
+
43
+ export {
44
+ AggregationType,
45
+ DimensionType,
46
+ EntityType,
47
+ MetricType,
48
+ TimeGranularity
49
+ };
50
+ //# sourceMappingURL=chunk-X2GMTYPA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../runtime/analytics/types.ts"],"sourcesContent":["/**\n * Semantic type definitions for the analytics layer.\n *\n * These types mirror MetricFlow / dbt-semantic-interfaces enums but are\n * defined locally so consumers don't need the full dependency for basic\n * field configuration. When the cube.js backend is used, these values\n * map 1:1 to cube measure/dimension types.\n */\n\n// ============================================================================\n// Enums\n// ============================================================================\n\nexport enum AggregationType {\n SUM = 'sum',\n MIN = 'min',\n MAX = 'max',\n COUNT = 'count',\n COUNT_DISTINCT = 'count_distinct',\n AVERAGE = 'average',\n MEDIAN = 'median',\n PERCENTILE = 'percentile',\n SUM_BOOLEAN = 'sum_boolean',\n}\n\nexport enum DimensionType {\n CATEGORICAL = 'categorical',\n TIME = 'time',\n}\n\nexport enum EntityType {\n PRIMARY = 'primary',\n UNIQUE = 'unique',\n FOREIGN = 'foreign',\n NATURAL = 'natural',\n}\n\nexport enum MetricType {\n SIMPLE = 'simple',\n DERIVED = 'derived',\n RATIO = 'ratio',\n CUMULATIVE = 'cumulative',\n CONVERSION = 'conversion',\n}\n\n/**\n * Time granularity for time dimensions.\n *\n * Sub-day granularities (hour, minute, second) are intentionally omitted\n * because cube.js does not support them.\n */\nexport enum TimeGranularity {\n DAY = 'day',\n WEEK = 'week',\n MONTH = 'month',\n QUARTER = 'quarter',\n YEAR = 'year',\n}\n\n// ============================================================================\n// Config interfaces\n// ============================================================================\n\n/**\n * Configuration for non-additive dimensions on measures.\n *\n * Non-additive dimensions specify that a measure cannot be summed across\n * certain dimensions. For example, inventory balances cannot be summed\n * across time — you need the latest value, not the sum.\n */\nexport interface NonAdditiveDimensionConfig {\n name: string;\n window_choice?: AggregationType;\n window_groupings?: string[];\n}\n\n/**\n * Complete semantic configuration for a field.\n *\n * Used to store all semantic metadata on a field definition for later\n * extraction by the manifest builder / cube schema generator.\n */\nexport interface SemanticFieldConfig {\n // Measure configuration\n measure?: boolean;\n agg?: AggregationType;\n agg_time_dimension?: string;\n non_additive_dimension?: NonAdditiveDimensionConfig;\n\n // Dimension configuration\n dimension?: boolean;\n dimension_type?: DimensionType;\n time_granularity?: TimeGranularity;\n is_partition?: boolean;\n\n // Entity configuration\n entity?: boolean;\n entity_type?: EntityType;\n entity_role?: string;\n\n // Common\n semantic_expr?: string;\n semantic_label?: string;\n visibility?: 'internal' | 'agent' | 'public';\n}\n"],"mappings":";AAaO,IAAK,kBAAL,kBAAKA,qBAAL;AACL,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,oBAAiB;AACjB,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,iBAAc;AATJ,SAAAA;AAAA,GAAA;AAYL,IAAK,gBAAL,kBAAKC,mBAAL;AACL,EAAAA,eAAA,iBAAc;AACd,EAAAA,eAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAKL,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,YAAS;AACT,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AAJA,SAAAA;AAAA,GAAA;AAOL,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,YAAS;AACT,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,WAAQ;AACR,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,gBAAa;AALH,SAAAA;AAAA,GAAA;AAcL,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;","names":["AggregationType","DimensionType","EntityType","MetricType","TimeGranularity"]}
@@ -0,0 +1,41 @@
1
+ import {
2
+ BaseRepository
3
+ } from "./chunk-J6KZS54B.js";
4
+
5
+ // runtime/base-classes/activity-entity-repository.ts
6
+ import { eq, between, desc } from "drizzle-orm";
7
+ var ActivityEntityRepository = class extends BaseRepository {
8
+ /**
9
+ * Find activities within a date range (inclusive).
10
+ */
11
+ async findByDateRange(start, end) {
12
+ const rows = await this.baseQuery().where(between(this.table["occurredAt"], start, end));
13
+ return rows;
14
+ }
15
+ /**
16
+ * Find all activities for a specific user.
17
+ */
18
+ async findByUserId(userId) {
19
+ const rows = await this.baseQuery().where(eq(this.table["userId"], userId));
20
+ return rows;
21
+ }
22
+ /**
23
+ * Find all activities for a specific opportunity.
24
+ */
25
+ async findByOpportunityId(opportunityId) {
26
+ const rows = await this.baseQuery().where(eq(this.table["opportunityId"], opportunityId));
27
+ return rows;
28
+ }
29
+ /**
30
+ * Find the most recent activities for an opportunity, ordered by occurredAt desc.
31
+ */
32
+ async findRecentByOpportunityId(opportunityId, limit = 10) {
33
+ const rows = await this.baseQuery().where(eq(this.table["opportunityId"], opportunityId)).orderBy(desc(this.table["occurredAt"])).limit(limit);
34
+ return rows;
35
+ }
36
+ };
37
+
38
+ export {
39
+ ActivityEntityRepository
40
+ };
41
+ //# sourceMappingURL=chunk-XCEI7NUH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../runtime/base-classes/activity-entity-repository.ts"],"sourcesContent":["/**\n * ActivityEntityRepository<TEntity>\n *\n * Family-specific base for activity entities (emails, calls, meetings, notes).\n * Adds date-range queries, user/opportunity scoping, and recency ordering.\n *\n * Concrete repos extend this and declare their table + behaviors.\n */\nimport { eq, between, desc } from 'drizzle-orm';\nimport { BaseRepository } from './base-repository';\n\nexport abstract class ActivityEntityRepository<TEntity> extends BaseRepository<TEntity> {\n /**\n * Find activities within a date range (inclusive).\n */\n async findByDateRange(start: Date, end: Date): Promise<TEntity[]> {\n const rows = await this.baseQuery()\n .where(between(this.table['occurredAt'], start, end));\n return rows as TEntity[];\n }\n\n /**\n * Find all activities for a specific user.\n */\n async findByUserId(userId: string): Promise<TEntity[]> {\n const rows = await this.baseQuery()\n .where(eq(this.table['userId'], userId));\n return rows as TEntity[];\n }\n\n /**\n * Find all activities for a specific opportunity.\n */\n async findByOpportunityId(opportunityId: string): Promise<TEntity[]> {\n const rows = await this.baseQuery()\n .where(eq(this.table['opportunityId'], opportunityId));\n return rows as TEntity[];\n }\n\n /**\n * Find the most recent activities for an opportunity, ordered by occurredAt desc.\n */\n async findRecentByOpportunityId(opportunityId: string, limit = 10): Promise<TEntity[]> {\n const rows = await this.baseQuery()\n .where(eq(this.table['opportunityId'], opportunityId))\n .orderBy(desc(this.table['occurredAt']))\n .limit(limit);\n return rows as TEntity[];\n }\n}\n"],"mappings":";;;;;AAQA,SAAS,IAAI,SAAS,YAAY;AAG3B,IAAe,2BAAf,cAAyD,eAAwB;AAAA;AAAA;AAAA;AAAA,EAItF,MAAM,gBAAgB,OAAa,KAA+B;AAChE,UAAM,OAAO,MAAM,KAAK,UAAU,EAC/B,MAAM,QAAQ,KAAK,MAAM,YAAY,GAAG,OAAO,GAAG,CAAC;AACtD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa,QAAoC;AACrD,UAAM,OAAO,MAAM,KAAK,UAAU,EAC/B,MAAM,GAAG,KAAK,MAAM,QAAQ,GAAG,MAAM,CAAC;AACzC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,oBAAoB,eAA2C;AACnE,UAAM,OAAO,MAAM,KAAK,UAAU,EAC/B,MAAM,GAAG,KAAK,MAAM,eAAe,GAAG,aAAa,CAAC;AACvD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,0BAA0B,eAAuB,QAAQ,IAAwB;AACrF,UAAM,OAAO,MAAM,KAAK,UAAU,EAC/B,MAAM,GAAG,KAAK,MAAM,eAAe,GAAG,aAAa,CAAC,EACpD,QAAQ,KAAK,KAAK,MAAM,YAAY,CAAC,CAAC,EACtC,MAAM,KAAK;AACd,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,88 @@
1
+ import {
2
+ ERROR_RESPONSE_SCHEMA_NAME,
3
+ errorResponseSchema
4
+ } from "./chunk-SOVM2VEK.js";
5
+ import {
6
+ DuplicateSchemaError,
7
+ OpenApiPeerDepMissingError
8
+ } from "./chunk-YSLTTQLC.js";
9
+
10
+ // runtime/shared/openapi/registry.ts
11
+ var OpenApiRegistry = class {
12
+ zodSchemas = /* @__PURE__ */ new Map();
13
+ pathEntries = /* @__PURE__ */ new Map();
14
+ peer = null;
15
+ constructor() {
16
+ this.zodSchemas.set(ERROR_RESPONSE_SCHEMA_NAME, errorResponseSchema);
17
+ }
18
+ registerSchema(name, schema) {
19
+ if (this.zodSchemas.has(name)) {
20
+ throw new DuplicateSchemaError(name);
21
+ }
22
+ this.zodSchemas.set(name, schema);
23
+ }
24
+ registerPath(path, method, spec) {
25
+ let methods = this.pathEntries.get(path);
26
+ if (!methods) {
27
+ methods = /* @__PURE__ */ new Map();
28
+ this.pathEntries.set(path, methods);
29
+ }
30
+ methods.set(method, spec);
31
+ }
32
+ /**
33
+ * Emit the full OpenAPI document. Lazy-imports `@anatine/zod-openapi`
34
+ * on first call; failure to resolve raises `OpenApiPeerDepMissingError`
35
+ * (matches the `CubeAnalyticsBackend.onModuleInit` precedent).
36
+ *
37
+ * OpenAPI version is pinned to `3.0.3` — Swagger UI tooling is most
38
+ * stable on 3.0.x (see OPENAPI-PHASE-1-PLAN §Four locked decisions).
39
+ */
40
+ async build(info) {
41
+ const peer = await this.loadPeer();
42
+ const schemas = {};
43
+ for (const [name, zodSchema] of this.zodSchemas) {
44
+ schemas[name] = peer.generateSchema(zodSchema, false, "3.0");
45
+ }
46
+ const paths = {};
47
+ for (const [path, methods] of this.pathEntries) {
48
+ const methodMap = {};
49
+ for (const [method, spec] of methods) {
50
+ methodMap[method] = spec;
51
+ }
52
+ paths[path] = methodMap;
53
+ }
54
+ return {
55
+ openapi: "3.0.3",
56
+ info,
57
+ paths,
58
+ components: { schemas }
59
+ };
60
+ }
61
+ /**
62
+ * Test helper — clears registered schemas and paths, then re-seeds the
63
+ * core `ErrorResponseDto` entry so post-reset state matches the
64
+ * invariant established in the constructor.
65
+ */
66
+ reset() {
67
+ this.zodSchemas.clear();
68
+ this.pathEntries.clear();
69
+ this.peer = null;
70
+ this.zodSchemas.set(ERROR_RESPONSE_SCHEMA_NAME, errorResponseSchema);
71
+ }
72
+ async loadPeer() {
73
+ if (this.peer) return this.peer;
74
+ try {
75
+ const specifier = "@anatine/zod-openapi";
76
+ const mod = await import(specifier);
77
+ this.peer = mod;
78
+ return mod;
79
+ } catch {
80
+ throw new OpenApiPeerDepMissingError();
81
+ }
82
+ }
83
+ };
84
+
85
+ export {
86
+ OpenApiRegistry
87
+ };
88
+ //# sourceMappingURL=chunk-Y7GDG744.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../runtime/shared/openapi/registry.ts"],"sourcesContent":["/**\n * OpenApiRegistry — collects Zod schemas and path specs, emits a\n * complete `OpenAPIObject` on `build()` (OPENAPI-1).\n *\n * Wraps `@anatine/zod-openapi` as an **optional peer dependency** using\n * the lazy-import pattern from `runtime/subsystems/analytics/cube-backend.ts`\n * — consumer apps that never call `build()` still boot even if\n * `@anatine/zod-openapi` isn't installed.\n *\n * The registry is the single source of truth consumed by OPENAPI-2\n * (generated DTOs register their Zod schemas at module init), OPENAPI-3\n * (controller decorators reference those schemas), and OPENAPI-4\n * (Swagger UI bootstrap calls `build()` once at startup).\n */\nimport type { z } from 'zod';\n\nimport { ERROR_RESPONSE_SCHEMA_NAME, errorResponseSchema } from './error-response.dto';\nimport { OpenApiPeerDepMissingError, DuplicateSchemaError } from './errors';\n\nexport type HttpMethod = 'get' | 'post' | 'patch' | 'delete' | 'put';\n\n/**\n * OpenAPI path spec. Structurally compatible with `openapi3-ts`'s\n * `OperationObject` but typed loosely here because the peer type package\n * isn't installed as a direct dep — consumers supply whatever their\n * codegen emits.\n */\nexport interface PathSpec {\n summary?: string;\n description?: string;\n operationId?: string;\n tags?: string[];\n parameters?: unknown[];\n requestBody?: unknown;\n responses?: Record<string, unknown>;\n security?: unknown[];\n [key: string]: unknown;\n}\n\nexport interface OpenAPIInfo {\n title: string;\n version: string;\n description?: string;\n}\n\n/**\n * Minimal OpenAPIObject shape. We redeclare rather than pull\n * `openapi3-ts` types through the peer — the peer's `generateSchema`\n * returns a `SchemaObject`, but the final document assembly is ours.\n */\nexport interface OpenAPIObject {\n openapi: string;\n info: OpenAPIInfo;\n paths: Record<string, Record<string, PathSpec>>;\n components: {\n schemas: Record<string, unknown>;\n };\n}\n\ninterface PeerModule {\n generateSchema: (zodRef: unknown, useOutput?: boolean, version?: '3.0' | '3.1') => unknown;\n}\n\nexport class OpenApiRegistry {\n private zodSchemas = new Map<string, z.ZodType>();\n private pathEntries = new Map<string, Map<HttpMethod, PathSpec>>();\n private peer: PeerModule | null = null;\n\n constructor() {\n // Auto-register the shared error response schema so controllers that\n // reference `#/components/schemas/ErrorResponseDto` always resolve\n // (OPENAPI-3). Consumers can `reset()` + re-register in tests.\n this.zodSchemas.set(ERROR_RESPONSE_SCHEMA_NAME, errorResponseSchema);\n }\n\n registerSchema(name: string, schema: z.ZodType): void {\n if (this.zodSchemas.has(name)) {\n throw new DuplicateSchemaError(name);\n }\n this.zodSchemas.set(name, schema);\n }\n\n registerPath(path: string, method: HttpMethod, spec: PathSpec): void {\n let methods = this.pathEntries.get(path);\n if (!methods) {\n methods = new Map();\n this.pathEntries.set(path, methods);\n }\n methods.set(method, spec);\n }\n\n /**\n * Emit the full OpenAPI document. Lazy-imports `@anatine/zod-openapi`\n * on first call; failure to resolve raises `OpenApiPeerDepMissingError`\n * (matches the `CubeAnalyticsBackend.onModuleInit` precedent).\n *\n * OpenAPI version is pinned to `3.0.3` — Swagger UI tooling is most\n * stable on 3.0.x (see OPENAPI-PHASE-1-PLAN §Four locked decisions).\n */\n async build(info: OpenAPIInfo): Promise<OpenAPIObject> {\n const peer = await this.loadPeer();\n\n const schemas: Record<string, unknown> = {};\n for (const [name, zodSchema] of this.zodSchemas) {\n schemas[name] = peer.generateSchema(zodSchema, false, '3.0');\n }\n\n const paths: Record<string, Record<string, PathSpec>> = {};\n for (const [path, methods] of this.pathEntries) {\n const methodMap: Record<string, PathSpec> = {};\n for (const [method, spec] of methods) {\n methodMap[method] = spec;\n }\n paths[path] = methodMap;\n }\n\n return {\n openapi: '3.0.3',\n info,\n paths,\n components: { schemas },\n };\n }\n\n /**\n * Test helper — clears registered schemas and paths, then re-seeds the\n * core `ErrorResponseDto` entry so post-reset state matches the\n * invariant established in the constructor.\n */\n reset(): void {\n this.zodSchemas.clear();\n this.pathEntries.clear();\n this.peer = null;\n this.zodSchemas.set(ERROR_RESPONSE_SCHEMA_NAME, errorResponseSchema);\n }\n\n protected async loadPeer(): Promise<PeerModule> {\n if (this.peer) return this.peer;\n try {\n // Computed specifier: prevents tsc from resolving this import at\n // typecheck time. Consumers vendor this file but may not install\n // @anatine/zod-openapi (optional peer).\n const specifier: string = '@anatine/zod-openapi';\n const mod = (await import(specifier)) as PeerModule;\n this.peer = mod;\n return mod;\n } catch {\n throw new OpenApiPeerDepMissingError();\n }\n }\n}\n"],"mappings":";;;;;;;;;;AA+DO,IAAM,kBAAN,MAAsB;AAAA,EACnB,aAAa,oBAAI,IAAuB;AAAA,EACxC,cAAc,oBAAI,IAAuC;AAAA,EACzD,OAA0B;AAAA,EAElC,cAAc;AAIZ,SAAK,WAAW,IAAI,4BAA4B,mBAAmB;AAAA,EACrE;AAAA,EAEA,eAAe,MAAc,QAAyB;AACpD,QAAI,KAAK,WAAW,IAAI,IAAI,GAAG;AAC7B,YAAM,IAAI,qBAAqB,IAAI;AAAA,IACrC;AACA,SAAK,WAAW,IAAI,MAAM,MAAM;AAAA,EAClC;AAAA,EAEA,aAAa,MAAc,QAAoB,MAAsB;AACnE,QAAI,UAAU,KAAK,YAAY,IAAI,IAAI;AACvC,QAAI,CAAC,SAAS;AACZ,gBAAU,oBAAI,IAAI;AAClB,WAAK,YAAY,IAAI,MAAM,OAAO;AAAA,IACpC;AACA,YAAQ,IAAI,QAAQ,IAAI;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,MAAM,MAA2C;AACrD,UAAM,OAAO,MAAM,KAAK,SAAS;AAEjC,UAAM,UAAmC,CAAC;AAC1C,eAAW,CAAC,MAAM,SAAS,KAAK,KAAK,YAAY;AAC/C,cAAQ,IAAI,IAAI,KAAK,eAAe,WAAW,OAAO,KAAK;AAAA,IAC7D;AAEA,UAAM,QAAkD,CAAC;AACzD,eAAW,CAAC,MAAM,OAAO,KAAK,KAAK,aAAa;AAC9C,YAAM,YAAsC,CAAC;AAC7C,iBAAW,CAAC,QAAQ,IAAI,KAAK,SAAS;AACpC,kBAAU,MAAM,IAAI;AAAA,MACtB;AACA,YAAM,IAAI,IAAI;AAAA,IAChB;AAEA,WAAO;AAAA,MACL,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA,YAAY,EAAE,QAAQ;AAAA,IACxB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,QAAc;AACZ,SAAK,WAAW,MAAM;AACtB,SAAK,YAAY,MAAM;AACvB,SAAK,OAAO;AACZ,SAAK,WAAW,IAAI,4BAA4B,mBAAmB;AAAA,EACrE;AAAA,EAEA,MAAgB,WAAgC;AAC9C,QAAI,KAAK,KAAM,QAAO,KAAK;AAC3B,QAAI;AAIF,YAAM,YAAoB;AAC1B,YAAM,MAAO,MAAM,OAAO;AAC1B,WAAK,OAAO;AACZ,aAAO;AAAA,IACT,QAAQ;AACN,YAAM,IAAI,2BAA2B;AAAA,IACvC;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,9 @@
1
+ // runtime/subsystems/observability/observability.tokens.ts
2
+ var OBSERVABILITY = "OBSERVABILITY";
3
+ var OBSERVABILITY_MODULE_OPTIONS = "OBSERVABILITY_MODULE_OPTIONS";
4
+
5
+ export {
6
+ OBSERVABILITY,
7
+ OBSERVABILITY_MODULE_OPTIONS
8
+ };
9
+ //# sourceMappingURL=chunk-Y7RRSEOC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../runtime/subsystems/observability/observability.tokens.ts"],"sourcesContent":["/**\n * Observability combiner subsystem — DI tokens (ADR-025, OBS-5).\n *\n * String constants (not Symbols), matching the events / bridge / integration\n * convention. The jobs subsystem uses Symbols for its analogous tokens;\n * observability stays internally consistent with its sibling combiner\n * (bridge) because the two are structurally paired (ADR-025).\n *\n * Usage in consumers:\n * ```ts\n * constructor(@Inject(OBSERVABILITY) private readonly obs: IObservability) {}\n * ```\n */\n\n/**\n * Token for the `IObservability` composer facade (OBS-5). Resolves to the\n * single `ObservabilityService` instance registered by\n * `ObservabilityModule.forRoot(...)`.\n */\nexport const OBSERVABILITY = 'OBSERVABILITY' as const;\n\n/**\n * Token for the resolved `ObservabilityModuleOptions` object. Provided by\n * `ObservabilityModule.forRoot(...)`. Reserved for phase 2 — the current\n * options shape is empty; OBS-6 will extend it with a `reporters` field.\n */\nexport const OBSERVABILITY_MODULE_OPTIONS = 'OBSERVABILITY_MODULE_OPTIONS' as const;\n"],"mappings":";AAmBO,IAAM,gBAAgB;AAOtB,IAAM,+BAA+B;","names":[]}