@pattern-stack/codegen 0.15.1 → 0.15.3

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 (527) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/chunk-27ETSJ2X.js +84 -0
  3. package/dist/chunk-27ETSJ2X.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-4H3PETLM.js +290 -0
  29. package/dist/chunk-4H3PETLM.js.map +1 -0
  30. package/dist/chunk-4JLJYWJC.js +308 -0
  31. package/dist/chunk-4JLJYWJC.js.map +1 -0
  32. package/dist/chunk-4KNXX6TI.js +29 -0
  33. package/dist/chunk-4KNXX6TI.js.map +1 -0
  34. package/dist/chunk-4LH67P4U.js +17 -0
  35. package/dist/chunk-4LH67P4U.js.map +1 -0
  36. package/dist/chunk-4MF3HKJA.js +94 -0
  37. package/dist/chunk-4MF3HKJA.js.map +1 -0
  38. package/dist/chunk-4MVGAMUA.js +40 -0
  39. package/dist/chunk-4MVGAMUA.js.map +1 -0
  40. package/dist/chunk-4RFHUZXU.js +635 -0
  41. package/dist/chunk-4RFHUZXU.js.map +1 -0
  42. package/dist/chunk-5A432NZJ.js +7 -0
  43. package/dist/chunk-5A432NZJ.js.map +1 -0
  44. package/dist/chunk-5Y7W3XR6.js +356 -0
  45. package/dist/chunk-5Y7W3XR6.js.map +1 -0
  46. package/dist/chunk-6DWFJNIK.js +15 -0
  47. package/dist/chunk-6DWFJNIK.js.map +1 -0
  48. package/dist/chunk-6I7ULIN6.js +15 -0
  49. package/dist/chunk-6I7ULIN6.js.map +1 -0
  50. package/dist/chunk-6XY6ZMMD.js +25 -0
  51. package/dist/chunk-6XY6ZMMD.js.map +1 -0
  52. package/dist/chunk-7B3RYX45.js +63 -0
  53. package/dist/chunk-7B3RYX45.js.map +1 -0
  54. package/dist/chunk-7C3FOSDI.js +1 -0
  55. package/dist/chunk-7C3FOSDI.js.map +1 -0
  56. package/dist/chunk-7KOW6PU6.js +59 -0
  57. package/dist/chunk-7KOW6PU6.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-7YGORYZD.js +112 -0
  61. package/dist/chunk-7YGORYZD.js.map +1 -0
  62. package/dist/chunk-AHV4GDYM.js +63 -0
  63. package/dist/chunk-AHV4GDYM.js.map +1 -0
  64. package/dist/chunk-AQFQ4BYM.js +81 -0
  65. package/dist/chunk-AQFQ4BYM.js.map +1 -0
  66. package/dist/chunk-AS3NAZB6.js +14 -0
  67. package/dist/chunk-AS3NAZB6.js.map +1 -0
  68. package/dist/chunk-BGULBWKJ.js +88 -0
  69. package/dist/chunk-BGULBWKJ.js.map +1 -0
  70. package/dist/chunk-BIO6F7YI.js +17 -0
  71. package/dist/chunk-BIO6F7YI.js.map +1 -0
  72. package/dist/chunk-BOPZWRJK.js +36 -0
  73. package/dist/chunk-BOPZWRJK.js.map +1 -0
  74. package/dist/chunk-BPARRK6F.js +14 -0
  75. package/dist/chunk-BPARRK6F.js.map +1 -0
  76. package/dist/chunk-CO6LUM72.js +59 -0
  77. package/dist/chunk-CO6LUM72.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-DV4RV2DC.js +59 -0
  81. package/dist/chunk-DV4RV2DC.js.map +1 -0
  82. package/dist/chunk-EDKJU5BO.js +11 -0
  83. package/dist/chunk-EDKJU5BO.js.map +1 -0
  84. package/dist/chunk-EO2QPOKH.js +116 -0
  85. package/dist/chunk-EO2QPOKH.js.map +1 -0
  86. package/dist/chunk-EOLLMEAH.js +155 -0
  87. package/dist/chunk-EOLLMEAH.js.map +1 -0
  88. package/dist/chunk-EWYCWP4H.js +14 -0
  89. package/dist/chunk-EWYCWP4H.js.map +1 -0
  90. package/dist/chunk-EXVDJMIY.js +33 -0
  91. package/dist/chunk-EXVDJMIY.js.map +1 -0
  92. package/dist/chunk-FASRXRX5.js +19 -0
  93. package/dist/chunk-FASRXRX5.js.map +1 -0
  94. package/dist/chunk-FBGHYQIZ.js +201 -0
  95. package/dist/chunk-FBGHYQIZ.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-GCYKMF22.js +81 -0
  101. package/dist/chunk-GCYKMF22.js.map +1 -0
  102. package/dist/chunk-GM3RMJIJ.js +92 -0
  103. package/dist/chunk-GM3RMJIJ.js.map +1 -0
  104. package/dist/chunk-GYGNEQSC.js +9 -0
  105. package/dist/chunk-GYGNEQSC.js.map +1 -0
  106. package/dist/chunk-H5NH7KPE.js +21 -0
  107. package/dist/chunk-H5NH7KPE.js.map +1 -0
  108. package/dist/chunk-HNWZFNKP.js +168 -0
  109. package/dist/chunk-HNWZFNKP.js.map +1 -0
  110. package/dist/chunk-HUH73XGI.js +1 -0
  111. package/dist/chunk-HUH73XGI.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-IYNSRIGR.js +122 -0
  123. package/dist/chunk-IYNSRIGR.js.map +1 -0
  124. package/dist/chunk-J37YWU7Y.js +19 -0
  125. package/dist/chunk-J37YWU7Y.js.map +1 -0
  126. package/dist/chunk-J6KZS54B.js +269 -0
  127. package/dist/chunk-J6KZS54B.js.map +1 -0
  128. package/dist/chunk-J6MN42LG.js +19 -0
  129. package/dist/chunk-J6MN42LG.js.map +1 -0
  130. package/dist/chunk-J7JMVS2B.js +53 -0
  131. package/dist/chunk-J7JMVS2B.js.map +1 -0
  132. package/dist/chunk-JRQO2IOF.js +65 -0
  133. package/dist/chunk-JRQO2IOF.js.map +1 -0
  134. package/dist/chunk-JWNHNUYL.js +96 -0
  135. package/dist/chunk-JWNHNUYL.js.map +1 -0
  136. package/dist/chunk-K2I6XIK5.js +122 -0
  137. package/dist/chunk-K2I6XIK5.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-O37C3YE6.js +111 -0
  167. package/dist/chunk-O37C3YE6.js.map +1 -0
  168. package/dist/chunk-OFRRBC7M.js +78 -0
  169. package/dist/chunk-OFRRBC7M.js.map +1 -0
  170. package/dist/chunk-OGIZXGPY.js +222 -0
  171. package/dist/chunk-OGIZXGPY.js.map +1 -0
  172. package/dist/chunk-OKXZ63IA.js +168 -0
  173. package/dist/chunk-OKXZ63IA.js.map +1 -0
  174. package/dist/chunk-OSQRXVG2.js +58 -0
  175. package/dist/chunk-OSQRXVG2.js.map +1 -0
  176. package/dist/chunk-OTDN3OUQ.js +215 -0
  177. package/dist/chunk-OTDN3OUQ.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-RDVTWIYY.js +212 -0
  189. package/dist/chunk-RDVTWIYY.js.map +1 -0
  190. package/dist/chunk-RFH7N6EP.js +36 -0
  191. package/dist/chunk-RFH7N6EP.js.map +1 -0
  192. package/dist/chunk-RHVN6NA7.js +134 -0
  193. package/dist/chunk-RHVN6NA7.js.map +1 -0
  194. package/dist/chunk-S7C6TIIF.js +21 -0
  195. package/dist/chunk-S7C6TIIF.js.map +1 -0
  196. package/dist/chunk-SNQ3TOWP.js +20 -0
  197. package/dist/chunk-SNQ3TOWP.js.map +1 -0
  198. package/dist/chunk-SOVM2VEK.js +14 -0
  199. package/dist/chunk-SOVM2VEK.js.map +1 -0
  200. package/dist/chunk-SQDOBLBP.js +13 -0
  201. package/dist/chunk-SQDOBLBP.js.map +1 -0
  202. package/dist/chunk-SR7F3TJY.js +130 -0
  203. package/dist/chunk-SR7F3TJY.js.map +1 -0
  204. package/dist/chunk-SZVPIHWE.js +129 -0
  205. package/dist/chunk-SZVPIHWE.js.map +1 -0
  206. package/dist/chunk-T4BIIU5E.js +89 -0
  207. package/dist/chunk-T4BIIU5E.js.map +1 -0
  208. package/dist/chunk-T6SCOJF4.js +92 -0
  209. package/dist/chunk-T6SCOJF4.js.map +1 -0
  210. package/dist/chunk-TNXH7BJS.js +48 -0
  211. package/dist/chunk-TNXH7BJS.js.map +1 -0
  212. package/dist/chunk-U64T4YZE.js +9 -0
  213. package/dist/chunk-U64T4YZE.js.map +1 -0
  214. package/dist/chunk-UQ5EHOH2.js +39 -0
  215. package/dist/chunk-UQ5EHOH2.js.map +1 -0
  216. package/dist/chunk-UTN4GBPQ.js +1 -0
  217. package/dist/chunk-UTN4GBPQ.js.map +1 -0
  218. package/dist/chunk-V4AF6DI4.js +16 -0
  219. package/dist/chunk-V4AF6DI4.js.map +1 -0
  220. package/dist/chunk-W72PRNJY.js +126 -0
  221. package/dist/chunk-W72PRNJY.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-WWGYCIJX.js +29 -0
  225. package/dist/chunk-WWGYCIJX.js.map +1 -0
  226. package/dist/chunk-X2GMTYPA.js +50 -0
  227. package/dist/chunk-X2GMTYPA.js.map +1 -0
  228. package/dist/chunk-XCEI7NUH.js +41 -0
  229. package/dist/chunk-XCEI7NUH.js.map +1 -0
  230. package/dist/chunk-Y7GDG744.js +88 -0
  231. package/dist/chunk-Y7GDG744.js.map +1 -0
  232. package/dist/chunk-Y7RRSEOC.js +9 -0
  233. package/dist/chunk-Y7RRSEOC.js.map +1 -0
  234. package/dist/chunk-YLPAPPLW.js +75 -0
  235. package/dist/chunk-YLPAPPLW.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/runtime/analytics/index.js +8 -41
  249. package/dist/runtime/analytics/index.js.map +1 -1
  250. package/dist/runtime/analytics/types.js +8 -41
  251. package/dist/runtime/analytics/types.js.map +1 -1
  252. package/dist/runtime/base-classes/activity-entity-repository.js +6 -312
  253. package/dist/runtime/base-classes/activity-entity-repository.js.map +1 -1
  254. package/dist/runtime/base-classes/activity-entity-service.js +6 -212
  255. package/dist/runtime/base-classes/activity-entity-service.js.map +1 -1
  256. package/dist/runtime/base-classes/base-read-use-cases.js +5 -27
  257. package/dist/runtime/base-classes/base-read-use-cases.js.map +1 -1
  258. package/dist/runtime/base-classes/base-repository.js +5 -277
  259. package/dist/runtime/base-classes/base-repository.js.map +1 -1
  260. package/dist/runtime/base-classes/base-service.js +5 -184
  261. package/dist/runtime/base-classes/base-service.js.map +1 -1
  262. package/dist/runtime/base-classes/index.js +59 -1076
  263. package/dist/runtime/base-classes/index.js.map +1 -1
  264. package/dist/runtime/base-classes/integrated-entity-repository.js +6 -486
  265. package/dist/runtime/base-classes/integrated-entity-repository.js.map +1 -1
  266. package/dist/runtime/base-classes/integrated-entity-service.js +6 -213
  267. package/dist/runtime/base-classes/integrated-entity-service.js.map +1 -1
  268. package/dist/runtime/base-classes/junction-integration-repository.js +8 -448
  269. package/dist/runtime/base-classes/junction-integration-repository.js.map +1 -1
  270. package/dist/runtime/base-classes/knowledge-entity-repository.js +6 -283
  271. package/dist/runtime/base-classes/knowledge-entity-repository.js.map +1 -1
  272. package/dist/runtime/base-classes/knowledge-entity-service.js +6 -190
  273. package/dist/runtime/base-classes/knowledge-entity-service.js.map +1 -1
  274. package/dist/runtime/base-classes/lifecycle-events.js +8 -70
  275. package/dist/runtime/base-classes/lifecycle-events.js.map +1 -1
  276. package/dist/runtime/base-classes/metadata-entity-repository.js +6 -330
  277. package/dist/runtime/base-classes/metadata-entity-repository.js.map +1 -1
  278. package/dist/runtime/base-classes/metadata-entity-service.js +6 -212
  279. package/dist/runtime/base-classes/metadata-entity-service.js.map +1 -1
  280. package/dist/runtime/base-classes/tenant-context.js +10 -36
  281. package/dist/runtime/base-classes/tenant-context.js.map +1 -1
  282. package/dist/runtime/base-classes/with-analytics.js +4 -7
  283. package/dist/runtime/base-classes/with-analytics.js.map +1 -1
  284. package/dist/runtime/constants/tokens.js +5 -3
  285. package/dist/runtime/constants/tokens.js.map +1 -1
  286. package/dist/runtime/eav-helpers.js +2 -0
  287. package/dist/runtime/eav-helpers.js.map +1 -1
  288. package/dist/runtime/pipes/zod-validation.pipe.js +3 -10
  289. package/dist/runtime/pipes/zod-validation.pipe.js.map +1 -1
  290. package/dist/runtime/shared/openapi/error-response.dto.js +5 -8
  291. package/dist/runtime/shared/openapi/error-response.dto.js.map +1 -1
  292. package/dist/runtime/shared/openapi/errors.js +5 -19
  293. package/dist/runtime/shared/openapi/errors.js.map +1 -1
  294. package/dist/runtime/shared/openapi/index.js +15 -106
  295. package/dist/runtime/shared/openapi/index.js.map +1 -1
  296. package/dist/runtime/shared/openapi/registry.js +6 -103
  297. package/dist/runtime/shared/openapi/registry.js.map +1 -1
  298. package/dist/runtime/shared/openapi/registry.tokens.js +4 -2
  299. package/dist/runtime/shared/openapi/registry.tokens.js.map +1 -1
  300. package/dist/runtime/subsystems/analytics/analytics.module.js +8 -117
  301. package/dist/runtime/subsystems/analytics/analytics.module.js.map +1 -1
  302. package/dist/runtime/subsystems/analytics/analytics.tokens.js +7 -8
  303. package/dist/runtime/subsystems/analytics/analytics.tokens.js.map +1 -1
  304. package/dist/runtime/subsystems/analytics/cube-backend.js +6 -71
  305. package/dist/runtime/subsystems/analytics/cube-backend.js.map +1 -1
  306. package/dist/runtime/subsystems/analytics/index.js +16 -117
  307. package/dist/runtime/subsystems/analytics/index.js.map +1 -1
  308. package/dist/runtime/subsystems/analytics/noop-backend.js +4 -21
  309. package/dist/runtime/subsystems/analytics/noop-backend.js.map +1 -1
  310. package/dist/runtime/subsystems/auth/auth-oauth-state.schema.js +4 -8
  311. package/dist/runtime/subsystems/auth/auth-oauth-state.schema.js.map +1 -1
  312. package/dist/runtime/subsystems/auth/auth.module.js +12 -359
  313. package/dist/runtime/subsystems/auth/auth.module.js.map +1 -1
  314. package/dist/runtime/subsystems/auth/auth.tokens.js +12 -13
  315. package/dist/runtime/subsystems/auth/auth.tokens.js.map +1 -1
  316. package/dist/runtime/subsystems/auth/backends/encryption-key/env.js +4 -49
  317. package/dist/runtime/subsystems/auth/backends/encryption-key/env.js.map +1 -1
  318. package/dist/runtime/subsystems/auth/backends/state-store.drizzle-backend.js +6 -64
  319. package/dist/runtime/subsystems/auth/backends/state-store.drizzle-backend.js.map +1 -1
  320. package/dist/runtime/subsystems/auth/backends/state-store.memory-backend.js +5 -47
  321. package/dist/runtime/subsystems/auth/backends/state-store.memory-backend.js.map +1 -1
  322. package/dist/runtime/subsystems/auth/controllers/auth.controller.js +5 -139
  323. package/dist/runtime/subsystems/auth/controllers/auth.controller.js.map +1 -1
  324. package/dist/runtime/subsystems/auth/index.js +53 -542
  325. package/dist/runtime/subsystems/auth/index.js.map +1 -1
  326. package/dist/runtime/subsystems/auth/middleware/requester-context.js +9 -65
  327. package/dist/runtime/subsystems/auth/middleware/requester-context.js.map +1 -1
  328. package/dist/runtime/subsystems/auth/protocols/oauth-state-store.js +4 -9
  329. package/dist/runtime/subsystems/auth/protocols/oauth-state-store.js.map +1 -1
  330. package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js +4 -15
  331. package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js.map +1 -1
  332. package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js +5 -104
  333. package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js.map +1 -1
  334. package/dist/runtime/subsystems/auth/runtime/session-expired.error.js +5 -16
  335. package/dist/runtime/subsystems/auth/runtime/session-expired.error.js.map +1 -1
  336. package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js +5 -29
  337. package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js.map +1 -1
  338. package/dist/runtime/subsystems/bridge/assert-tenant-id.js +5 -18
  339. package/dist/runtime/subsystems/bridge/assert-tenant-id.js.map +1 -1
  340. package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js +12 -184
  341. package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js.map +1 -1
  342. package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js +10 -448
  343. package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js.map +1 -1
  344. package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.js +5 -126
  345. package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.js.map +1 -1
  346. package/dist/runtime/subsystems/bridge/bridge-delivery.schema.js +6 -308
  347. package/dist/runtime/subsystems/bridge/bridge-delivery.schema.js.map +1 -1
  348. package/dist/runtime/subsystems/bridge/bridge-errors.js +6 -35
  349. package/dist/runtime/subsystems/bridge/bridge-errors.js.map +1 -1
  350. package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js +14 -606
  351. package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js.map +1 -1
  352. package/dist/runtime/subsystems/bridge/bridge.module.js +35 -3476
  353. package/dist/runtime/subsystems/bridge/bridge.module.js.map +1 -1
  354. package/dist/runtime/subsystems/bridge/bridge.tokens.js +9 -7
  355. package/dist/runtime/subsystems/bridge/bridge.tokens.js.map +1 -1
  356. package/dist/runtime/subsystems/bridge/event-flow.service.js +11 -137
  357. package/dist/runtime/subsystems/bridge/event-flow.service.js.map +1 -1
  358. package/dist/runtime/subsystems/bridge/generated/registry.js +4 -2
  359. package/dist/runtime/subsystems/bridge/generated/registry.js.map +1 -1
  360. package/dist/runtime/subsystems/bridge/index.js +60 -3470
  361. package/dist/runtime/subsystems/bridge/index.js.map +1 -1
  362. package/dist/runtime/subsystems/bridge/reserved-pools.js +4 -6
  363. package/dist/runtime/subsystems/bridge/reserved-pools.js.map +1 -1
  364. package/dist/runtime/subsystems/cache/cache.drizzle-backend.js +10 -133
  365. package/dist/runtime/subsystems/cache/cache.drizzle-backend.js.map +1 -1
  366. package/dist/runtime/subsystems/cache/cache.memory-backend.js +6 -101
  367. package/dist/runtime/subsystems/cache/cache.memory-backend.js.map +1 -1
  368. package/dist/runtime/subsystems/cache/cache.module.js +10 -278
  369. package/dist/runtime/subsystems/cache/cache.module.js.map +1 -1
  370. package/dist/runtime/subsystems/cache/cache.schema.js +4 -14
  371. package/dist/runtime/subsystems/cache/cache.schema.js.map +1 -1
  372. package/dist/runtime/subsystems/cache/cache.tokens.js +6 -7
  373. package/dist/runtime/subsystems/cache/cache.tokens.js.map +1 -1
  374. package/dist/runtime/subsystems/cache/index.js +20 -278
  375. package/dist/runtime/subsystems/cache/index.js.map +1 -1
  376. package/dist/runtime/subsystems/events/domain-events.schema.js +3 -72
  377. package/dist/runtime/subsystems/events/domain-events.schema.js.map +1 -1
  378. package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js +9 -413
  379. package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js.map +1 -1
  380. package/dist/runtime/subsystems/events/event-bus.memory-backend.js +7 -235
  381. package/dist/runtime/subsystems/events/event-bus.memory-backend.js.map +1 -1
  382. package/dist/runtime/subsystems/events/event-bus.redis-backend.js +8 -20
  383. package/dist/runtime/subsystems/events/event-bus.redis-backend.js.map +1 -1
  384. package/dist/runtime/subsystems/events/event-keyset-cursor.js +8 -30
  385. package/dist/runtime/subsystems/events/event-keyset-cursor.js.map +1 -1
  386. package/dist/runtime/subsystems/events/event-read.protocol.js +2 -0
  387. package/dist/runtime/subsystems/events/event-read.protocol.js.map +1 -1
  388. package/dist/runtime/subsystems/events/events-errors.js +4 -11
  389. package/dist/runtime/subsystems/events/events-errors.js.map +1 -1
  390. package/dist/runtime/subsystems/events/events.module.js +15 -949
  391. package/dist/runtime/subsystems/events/events.module.js.map +1 -1
  392. package/dist/runtime/subsystems/events/events.tokens.js +10 -11
  393. package/dist/runtime/subsystems/events/events.tokens.js.map +1 -1
  394. package/dist/runtime/subsystems/events/generated/bus.js +9 -240
  395. package/dist/runtime/subsystems/events/generated/bus.js.map +1 -1
  396. package/dist/runtime/subsystems/events/generated/index.js +23 -240
  397. package/dist/runtime/subsystems/events/generated/index.js.map +1 -1
  398. package/dist/runtime/subsystems/events/generated/registry.js +5 -82
  399. package/dist/runtime/subsystems/events/generated/registry.js.map +1 -1
  400. package/dist/runtime/subsystems/events/generated/schemas.js +12 -52
  401. package/dist/runtime/subsystems/events/generated/schemas.js.map +1 -1
  402. package/dist/runtime/subsystems/events/generated/types.js +1 -0
  403. package/dist/runtime/subsystems/events/index.js +32 -949
  404. package/dist/runtime/subsystems/events/index.js.map +1 -1
  405. package/dist/runtime/subsystems/index.d.ts +5 -1
  406. package/dist/runtime/subsystems/index.js +182 -5912
  407. package/dist/runtime/subsystems/index.js.map +1 -1
  408. package/dist/runtime/subsystems/integration/build-change-source.js +6 -178
  409. package/dist/runtime/subsystems/integration/build-change-source.js.map +1 -1
  410. package/dist/runtime/subsystems/integration/deep-equal.differ.js +4 -109
  411. package/dist/runtime/subsystems/integration/deep-equal.differ.js.map +1 -1
  412. package/dist/runtime/subsystems/integration/detection-config.schema.js +11 -78
  413. package/dist/runtime/subsystems/integration/detection-config.schema.js.map +1 -1
  414. package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.js +5 -30
  415. package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.js.map +1 -1
  416. package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.js +4 -9
  417. package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.js.map +1 -1
  418. package/dist/runtime/subsystems/integration/execute-integration.use-case.js +6 -239
  419. package/dist/runtime/subsystems/integration/execute-integration.use-case.js.map +1 -1
  420. package/dist/runtime/subsystems/integration/incremental-read.js +5 -144
  421. package/dist/runtime/subsystems/integration/incremental-read.js.map +1 -1
  422. package/dist/runtime/subsystems/integration/index.js +83 -1352
  423. package/dist/runtime/subsystems/integration/index.js.map +1 -1
  424. package/dist/runtime/subsystems/integration/integration-audit.schema.js +10 -155
  425. package/dist/runtime/subsystems/integration/integration-audit.schema.js.map +1 -1
  426. package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js +7 -270
  427. package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js.map +1 -1
  428. package/dist/runtime/subsystems/integration/integration-cursor-store.memory-backend.js +4 -65
  429. package/dist/runtime/subsystems/integration/integration-cursor-store.memory-backend.js.map +1 -1
  430. package/dist/runtime/subsystems/integration/integration-errors.js +5 -15
  431. package/dist/runtime/subsystems/integration/integration-errors.js.map +1 -1
  432. package/dist/runtime/subsystems/integration/integration-field-diff.protocol.js +5 -7
  433. package/dist/runtime/subsystems/integration/integration-field-diff.protocol.js.map +1 -1
  434. package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +8 -303
  435. package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js.map +1 -1
  436. package/dist/runtime/subsystems/integration/integration-run-recorder.memory-backend.js +5 -125
  437. package/dist/runtime/subsystems/integration/integration-run-recorder.memory-backend.js.map +1 -1
  438. package/dist/runtime/subsystems/integration/integration.module.js +13 -700
  439. package/dist/runtime/subsystems/integration/integration.module.js.map +1 -1
  440. package/dist/runtime/subsystems/integration/integration.tokens.js +11 -9
  441. package/dist/runtime/subsystems/integration/integration.tokens.js.map +1 -1
  442. package/dist/runtime/subsystems/integration/loopback.middleware.js +4 -16
  443. package/dist/runtime/subsystems/integration/loopback.middleware.js.map +1 -1
  444. package/dist/runtime/subsystems/integration/poll-change-source.d.ts +1 -1
  445. package/dist/runtime/subsystems/integration/poll-change-source.js +4 -89
  446. package/dist/runtime/subsystems/integration/poll-change-source.js.map +1 -1
  447. package/dist/runtime/subsystems/integration/webhook-change-source.d.ts +4 -3
  448. package/dist/runtime/subsystems/integration/webhook-change-source.js +4 -70
  449. package/dist/runtime/subsystems/integration/webhook-change-source.js.map +1 -1
  450. package/dist/runtime/subsystems/jobs/bullmq.config.js +9 -140
  451. package/dist/runtime/subsystems/jobs/bullmq.config.js.map +1 -1
  452. package/dist/runtime/subsystems/jobs/index.js +88 -2691
  453. package/dist/runtime/subsystems/jobs/index.js.map +1 -1
  454. package/dist/runtime/subsystems/jobs/job-handler.base.js +10 -49
  455. package/dist/runtime/subsystems/jobs/job-handler.base.js.map +1 -1
  456. package/dist/runtime/subsystems/jobs/job-orchestration.schema.js +13 -152
  457. package/dist/runtime/subsystems/jobs/job-orchestration.schema.js.map +1 -1
  458. package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js +36 -699
  459. package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js.map +1 -1
  460. package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.js +10 -564
  461. package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.js.map +1 -1
  462. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +10 -824
  463. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js.map +1 -1
  464. package/dist/runtime/subsystems/jobs/job-run-keyset-cursor.js +9 -51
  465. package/dist/runtime/subsystems/jobs/job-run-keyset-cursor.js.map +1 -1
  466. package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.js +9 -416
  467. package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.js.map +1 -1
  468. package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js +9 -290
  469. package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js.map +1 -1
  470. package/dist/runtime/subsystems/jobs/job-step-service.drizzle-backend.js +5 -213
  471. package/dist/runtime/subsystems/jobs/job-step-service.drizzle-backend.js.map +1 -1
  472. package/dist/runtime/subsystems/jobs/job-step-service.memory-backend.js +5 -131
  473. package/dist/runtime/subsystems/jobs/job-step-service.memory-backend.js.map +1 -1
  474. package/dist/runtime/subsystems/jobs/job-worker.bullmq-backend.js +9 -175
  475. package/dist/runtime/subsystems/jobs/job-worker.bullmq-backend.js.map +1 -1
  476. package/dist/runtime/subsystems/jobs/job-worker.js +14 -613
  477. package/dist/runtime/subsystems/jobs/job-worker.js.map +1 -1
  478. package/dist/runtime/subsystems/jobs/job-worker.module.js +23 -2647
  479. package/dist/runtime/subsystems/jobs/job-worker.module.js.map +1 -1
  480. package/dist/runtime/subsystems/jobs/jobs-domain.module.js +19 -1897
  481. package/dist/runtime/subsystems/jobs/jobs-domain.module.js.map +1 -1
  482. package/dist/runtime/subsystems/jobs/jobs-domain.tokens.js +8 -9
  483. package/dist/runtime/subsystems/jobs/jobs-domain.tokens.js.map +1 -1
  484. package/dist/runtime/subsystems/jobs/jobs-errors.js +10 -78
  485. package/dist/runtime/subsystems/jobs/jobs-errors.js.map +1 -1
  486. package/dist/runtime/subsystems/jobs/memory-job-store.js +4 -15
  487. package/dist/runtime/subsystems/jobs/memory-job-store.js.map +1 -1
  488. package/dist/runtime/subsystems/jobs/pool-config.loader.js +9 -124
  489. package/dist/runtime/subsystems/jobs/pool-config.loader.js.map +1 -1
  490. package/dist/runtime/subsystems/observability/index.js +21 -310
  491. package/dist/runtime/subsystems/observability/index.js.map +1 -1
  492. package/dist/runtime/subsystems/observability/observability-errors.js +4 -9
  493. package/dist/runtime/subsystems/observability/observability-errors.js.map +1 -1
  494. package/dist/runtime/subsystems/observability/observability.module.js +11 -300
  495. package/dist/runtime/subsystems/observability/observability.module.js.map +1 -1
  496. package/dist/runtime/subsystems/observability/observability.service.js +9 -197
  497. package/dist/runtime/subsystems/observability/observability.service.js.map +1 -1
  498. package/dist/runtime/subsystems/observability/observability.tokens.js +5 -3
  499. package/dist/runtime/subsystems/observability/observability.tokens.js.map +1 -1
  500. package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js +4 -84
  501. package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js.map +1 -1
  502. package/dist/runtime/subsystems/observability/reporters/index.js +5 -84
  503. package/dist/runtime/subsystems/observability/reporters/index.js.map +1 -1
  504. package/dist/runtime/subsystems/storage/index.js +15 -200
  505. package/dist/runtime/subsystems/storage/index.js.map +1 -1
  506. package/dist/runtime/subsystems/storage/storage.local-backend.js +4 -103
  507. package/dist/runtime/subsystems/storage/storage.local-backend.js.map +1 -1
  508. package/dist/runtime/subsystems/storage/storage.memory-backend.js +5 -68
  509. package/dist/runtime/subsystems/storage/storage.memory-backend.js.map +1 -1
  510. package/dist/runtime/subsystems/storage/storage.module.js +8 -200
  511. package/dist/runtime/subsystems/storage/storage.module.js.map +1 -1
  512. package/dist/runtime/subsystems/storage/storage.tokens.js +5 -6
  513. package/dist/runtime/subsystems/storage/storage.tokens.js.map +1 -1
  514. package/dist/runtime/subsystems/storage/storage.utils.js +4 -14
  515. package/dist/runtime/subsystems/storage/storage.utils.js.map +1 -1
  516. package/dist/runtime/subsystems/token-key.js +5 -3
  517. package/dist/runtime/subsystems/token-key.js.map +1 -1
  518. package/dist/src/cli/index.js +637 -5454
  519. package/dist/src/cli/index.js.map +1 -1
  520. package/dist/src/index.js +68 -4170
  521. package/dist/src/index.js.map +1 -1
  522. package/package.json +1 -1
  523. package/runtime/subsystems/bridge/bridge-outbox-drain-hook.ts +44 -21
  524. package/runtime/subsystems/index.ts +27 -0
  525. package/runtime/subsystems/integration/poll-change-source.ts +10 -7
  526. package/runtime/subsystems/integration/webhook-change-source.ts +12 -8
  527. package/runtime/subsystems/jobs/job-worker.ts +17 -11
@@ -1,1356 +1,87 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result) __defProp(target, key, result);
9
- return result;
10
- };
11
- var __decorateParam = (index2, decorator) => (target, key) => decorator(target, key, index2);
12
-
13
- // runtime/subsystems/integration/integration-field-diff.protocol.ts
14
- import { z } from "zod";
15
- var FieldDiffValueSchema = z.object({
16
- from: z.unknown(),
17
- to: z.unknown()
18
- });
19
- var FieldDiffSchema = z.record(z.string(), FieldDiffValueSchema);
20
-
21
- // runtime/subsystems/integration/entity-change-source-registry.protocol.ts
22
- var UnknownEntityError = class extends Error {
23
- constructor(entity, available) {
24
- super(
25
- `No change source registered for entity '${entity}'. Available: ${available.join(", ")}`
26
- );
27
- this.name = "UnknownEntityError";
28
- }
29
- };
30
-
31
- // runtime/subsystems/integration/entity-change-source-registry.memory.ts
32
- var MemoryEntityChangeSourceRegistry = class {
33
- constructor(sources) {
34
- this.sources = sources;
35
- }
36
- sources;
37
- get(name) {
38
- const source = this.sources.get(name);
39
- if (!source) {
40
- throw new UnknownEntityError(name, [...this.sources.keys()]);
41
- }
42
- return source;
43
- }
44
- has(name) {
45
- return this.sources.has(name);
46
- }
47
- entities() {
48
- return [...this.sources.keys()];
49
- }
50
- };
51
-
52
- // runtime/subsystems/integration/detection-config.schema.ts
53
- import { z as z2 } from "zod";
54
- var FieldMappingSchema = z2.object({
55
- source: z2.string().min(1),
56
- target: z2.string().min(1),
57
- transform: z2.string().min(1).optional()
58
- });
59
- var ResolvedFilterSchema = z2.object({
60
- field: z2.string().min(1),
61
- op: z2.enum(["eq", "neq", "in", "nin", "gt", "gte", "lt", "lte"]),
62
- value: z2.unknown()
63
- });
64
- var SystemModstampCursorSchema = z2.object({
65
- kind: z2.literal("systemModstamp"),
66
- field: z2.string().min(1)
67
- });
68
- var ReplayIdCursorSchema = z2.object({
69
- kind: z2.literal("replayId"),
70
- field: z2.string().min(1)
71
- });
72
- var TimestampCursorSchema = z2.object({
73
- kind: z2.literal("timestamp"),
74
- field: z2.string().min(1)
75
- });
76
- var EventIdCursorSchema = z2.object({
77
- kind: z2.literal("eventId"),
78
- field: z2.string().min(1)
79
- });
80
- var HistoryIdCursorSchema = z2.object({
81
- kind: z2.literal("historyId"),
82
- field: z2.string().min(1)
83
- });
84
- var SyncTokenCursorSchema = z2.object({
85
- kind: z2.literal("syncToken"),
86
- field: z2.string().min(1)
87
- });
88
- var CursorStrategySchema = z2.discriminatedUnion("kind", [
89
- SystemModstampCursorSchema,
90
- ReplayIdCursorSchema,
91
- TimestampCursorSchema,
92
- EventIdCursorSchema,
93
- HistoryIdCursorSchema,
94
- SyncTokenCursorSchema
95
- ]);
96
- var CURSOR_DIVISIBILITY = {
97
- systemModstamp: true,
98
- timestamp: true,
99
- replayId: true,
100
- eventId: false,
101
- historyId: false,
102
- syncToken: false
103
- };
104
- function isDivisibleCursor(kind) {
105
- return CURSOR_DIVISIBILITY[kind];
106
- }
107
- var PollDetectionSchema = z2.object({
108
- cursor: CursorStrategySchema,
109
- provenance: z2.enum(["poll", "cdc"]).optional()
110
- });
111
- var WebhookDetectionSchema = z2.object({
112
- eventIdField: z2.string().min(1)
113
- });
114
- var PollModeSchema = z2.object({
115
- mode: z2.literal("poll"),
116
- poll: PollDetectionSchema,
117
- mapping: z2.array(FieldMappingSchema).min(1),
118
- filters: z2.array(ResolvedFilterSchema).default([])
119
- });
120
- var WebhookModeSchema = z2.object({
121
- mode: z2.literal("webhook"),
122
- webhook: WebhookDetectionSchema,
123
- mapping: z2.array(FieldMappingSchema).min(1),
124
- filters: z2.array(ResolvedFilterSchema).default([])
125
- });
126
- var DetectionConfigSchema = z2.discriminatedUnion("mode", [
127
- PollModeSchema,
128
- WebhookModeSchema
129
- ]);
130
-
131
- // runtime/subsystems/integration/loopback.middleware.ts
132
- function createLoopbackMiddleware(store) {
133
- return (next) => {
134
- return async function* (subscription, cursor) {
135
- for await (const change of next(subscription, cursor)) {
136
- const isEcho = await store.isEchoOfOwnWrite(
137
- subscription.domain,
138
- change.externalId,
139
- change.record
140
- );
141
- if (isEcho) continue;
142
- yield change;
143
- }
144
- };
145
- };
146
- }
147
-
148
- // runtime/subsystems/integration/poll-change-source.ts
149
- var PollChangeSource = class {
150
- label;
151
- adapter;
152
- filters;
153
- externalIdSourceField;
154
- source;
155
- /**
156
- * When `poll.provenance === 'cdc'`, the field on the emitted record from
157
- * which `Change<T>.dedupKey` is read — sourced from `poll.cursor.field`
158
- * (Stripe-style event endpoints carry the event id on the record itself
159
- * and the cursor advances over the same id). `null` for default poll
160
- * provenance, which does NOT populate `dedupKey`.
161
- */
162
- dedupKeySourceField;
163
- composed;
164
- constructor(opts) {
165
- if (opts.config.mode !== "poll") {
166
- throw new Error(
167
- `PollChangeSource requires DetectionConfig.mode === 'poll'; got '${opts.config.mode}'`
168
- );
169
- }
170
- const config = opts.config;
171
- const externalIdMapping = config.mapping.find(
172
- (m) => m.target === "external_id"
173
- );
174
- if (!externalIdMapping) {
175
- throw new Error(
176
- "PollChangeSource: DetectionConfig.mapping must include an entry with target 'external_id' so emitted Change<T>.externalId can be populated"
177
- );
178
- }
179
- this.externalIdSourceField = externalIdMapping.target;
180
- this.adapter = opts.adapter;
181
- this.filters = config.filters;
182
- const isCdc = config.poll.provenance === "cdc";
183
- this.source = isCdc ? "cdc" : "poll";
184
- this.dedupKeySourceField = isCdc ? config.poll.cursor.field : null;
185
- this.label = opts.label ?? `poll-change-source:${externalIdMapping.source}`;
186
- const inner = (sub, cur) => this.fetch(sub, cur);
187
- const middlewares = opts.middlewares ?? [];
188
- this.composed = middlewares.reduceRight(
189
- (next, mw) => mw(next),
190
- inner
191
- );
192
- }
193
- listChanges(subscription, cursor) {
194
- return this.composed(subscription, cursor);
195
- }
196
- async *fetch(subscription, cursor) {
197
- const ctx = {
198
- subscription,
199
- cursor,
200
- filters: this.filters
201
- };
202
- for await (const { record, cursor: nextCursor } of this.adapter(ctx)) {
203
- const externalIdRaw = record[this.externalIdSourceField];
204
- if (typeof externalIdRaw !== "string" || externalIdRaw.length === 0) {
205
- throw new Error(
206
- `PollChangeSource: record missing string '${this.externalIdSourceField}' \u2014 emitted records MUST carry the canonical external id keyed by the mapping target`
207
- );
208
- }
209
- let dedupKey;
210
- if (this.dedupKeySourceField !== null) {
211
- const dedupRaw = record[this.dedupKeySourceField];
212
- if (typeof dedupRaw !== "string" || dedupRaw.length === 0) {
213
- throw new Error(
214
- `PollChangeSource: cdc-provenance record missing string '${this.dedupKeySourceField}' \u2014 when poll.provenance === 'cdc' the cursor.field must be present on each record so dedupKey can be populated`
215
- );
216
- }
217
- dedupKey = dedupRaw;
218
- }
219
- const change = {
220
- externalId: externalIdRaw,
221
- // Polling cannot distinguish create vs. update vs. delete on its
222
- // own — all yielded records are surfaced as 'updated'. The
223
- // orchestrator's diff stage classifies create-vs-update against
224
- // local state; soft-delete detection is out of scope for the
225
- // primitive (consumer drives via tombstone records or a separate
226
- // sweep — see ADR-033).
227
- operation: "updated",
228
- record,
229
- cursor: nextCursor,
230
- source: this.source,
231
- ...dedupKey !== void 0 ? { dedupKey } : {}
232
- };
233
- yield change;
234
- }
235
- }
236
- };
237
-
238
- // runtime/subsystems/integration/incremental-read.ts
239
- async function mapConcurrent(ids, fn, limit) {
240
- const out = /* @__PURE__ */ new Map();
241
- if (ids.length === 0) return out;
242
- const width = Math.max(1, Math.min(limit, ids.length));
243
- let next = 0;
244
- const worker = async () => {
245
- while (next < ids.length) {
246
- const idx = next++;
247
- const id = ids[idx];
248
- out.set(id, await fn(id));
249
- }
250
- };
251
- await Promise.all(Array.from({ length: width }, worker));
252
- return out;
253
- }
254
- var IncrementalReadBase = class {
255
- /**
256
- * Whether the vendor takes the request predicate server-side. Declared, not
257
- * enforced here — surfaced into the emission manifest (R3) so the falsifier
258
- * suite (R4) can record which adapters filter post-hydrate. `false` is the
259
- * honest floor (e.g. Gmail without `q=`), handled via `matchesRecord`.
260
- */
261
- filterPushdown = false;
262
- /** Max concurrent in-flight calls for a `mapConcurrent`-built `hydrate`. */
263
- hydrateConcurrency = 10;
264
- /** `Change<T>.source` provenance stamped by `listChanges`. */
265
- changeSource = "poll";
266
- /**
267
- * Whether this source's cursor strategy is divisible (RFC-0003 §3). When
268
- * `true` (default — sortable watermarks like `systemModstamp`/`timestamp`/
269
- * `replayId`), `listChanges` emits each record's per-ref cursor, so the
270
- * orchestrator may checkpoint mid-walk and a crash resumes from the last
271
- * delivered ref.
272
- *
273
- * When `false` (atomic opaque tokens — Gmail `historyId`, Calendar
274
- * `syncToken`), `listChanges` WITHHOLDS per-ref cursors and emits the
275
- * end-of-walk token only on the final record, so the orchestrator's
276
- * persist-last-yielded lifecycle can never persist an unresumable mid-walk
277
- * token. The cost is blast-radius: an interrupted atomic run resumes
278
- * all-or-nothing from the prior persisted token. For atomic *backfills* that
279
- * radius is the whole enumerate walk — bound it with `ReadRequest.pageSize`
280
- * (smaller pages ⇒ shorter walks per run). Per-page atomic checkpointing is a
281
- * future refinement; R2 gates at end-of-walk.
282
- *
283
- * Codegen (R3) sets this from the strategy kind via `isDivisibleCursor`.
284
- */
285
- cursorDivisible = true;
286
- // ---- Optional filter hooks — exactly one is live per `filterPushdown` ----
287
- /** Pre-hydrate predicate over the cheap ref (preferred — avoids hydration). */
288
- matchesRef(_ref, _filter) {
289
- return true;
290
- }
291
- /** Post-hydrate predicate over the canonical record (the no-pushdown floor). */
292
- matchesRecord(_record, _filter) {
293
- return true;
294
- }
295
- /**
296
- * Resolve the filter for a subscription when adapting to `listChanges`
297
- * (which has no filter argument). Defaults to none; codegen wiring (R3)
298
- * overrides this to thread `DetectionConfig.filters`.
299
- */
300
- filterFor(_subscription) {
301
- return void 0;
302
- }
303
- // ---- PROVIDED by the base ----
304
- /**
305
- * Stream canonical records for a request. Filter is applied BEFORE hydrate
306
- * (structural: a kept ref is hydrated, a rejected one never is), so an
307
- * adapter cannot hydrate-then-discard. A hydrate miss (deleted mid-run) is
308
- * skipped, never fabricated.
309
- */
310
- async *read(req, ctx) {
311
- for await (const refPage of this.enumerate(req.mode, req.filter, req.pageSize, ctx)) {
312
- const kept = refPage.filter((ref) => this.matchesRef(ref, req.filter));
313
- if (kept.length === 0) continue;
314
- const raws = await this.hydrate(
315
- kept.map((ref) => ref.externalId),
316
- ctx
317
- );
318
- for (const ref of kept) {
319
- const raw = raws.get(ref.externalId);
320
- if (raw === void 0 || raw === null) continue;
321
- const record = this.toCanonical(raw);
322
- if (record !== null && this.matchesRecord(record, req.filter)) {
323
- yield { externalId: ref.externalId, record, raw, cursor: ref.cursor };
324
- }
325
- }
326
- }
327
- }
328
- /**
329
- * `RandomRead<T>` — single-record read, provided for free as
330
- * `toCanonical ∘ hydrate([id])`. Reuses the adapter's batched fetch + miss
331
- * tolerance; returns `null` for a missing or undecodable record.
332
- */
333
- async get(id, ctx) {
334
- const raws = await this.hydrate([id], ctx);
335
- const raw = raws.get(id);
336
- if (raw === void 0 || raw === null) return null;
337
- return this.toCanonical(raw);
338
- }
339
- /**
340
- * `IChangeSource<T>` adaptation. Maps the orchestrator's by-value cursor to a
341
- * `ReadMode` (`null` → `full` backfill, else `delta`), streams `read()`, and
342
- * stamps each `SourcedRecord` into a `Change<T>`. All records surface as
343
- * `'updated'`; the orchestrator's diff stage classifies create-vs-update and
344
- * deletes arrive as tombstone refs (`toCanonical` may flag them).
345
- *
346
- * Cursor emission honors `cursorDivisible` (RFC-0003 §3). Divisible: each
347
- * record carries its own per-ref cursor. Atomic: per-ref cursors are withheld
348
- * (`undefined`, which the orchestrator skips persisting) and the end-of-walk
349
- * token rides only on the final record — so a mid-walk crash never persists
350
- * an unresumable token. If an atomic run yields no surviving records, no
351
- * cursor is persisted and the next run re-reads the same (empty) delta — a
352
- * bounded inefficiency, never data loss.
353
- */
354
- async *listChanges(subscription, cursor) {
355
- const mode = cursor === null || cursor === void 0 ? { kind: "full" } : { kind: "delta", cursor };
356
- const filter = this.filterFor(subscription);
357
- const stream = this.read({ mode, filter }, { subscription });
358
- if (this.cursorDivisible) {
359
- for await (const sourced of stream) {
360
- yield this.toChange(sourced, sourced.cursor);
361
- }
362
- return;
363
- }
364
- let prev = null;
365
- for await (const sourced of stream) {
366
- if (prev !== null) yield this.toChange(prev, void 0);
367
- prev = sourced;
368
- }
369
- if (prev !== null) yield this.toChange(prev, prev.cursor);
370
- }
371
- /** Stamp a `SourcedRecord` into a `Change<T>` with an explicit emitted cursor. */
372
- toChange(sourced, cursor) {
373
- return {
374
- externalId: sourced.externalId,
375
- operation: "updated",
376
- record: sourced.record,
377
- cursor,
378
- source: this.changeSource
379
- };
380
- }
381
- };
382
-
383
- // runtime/subsystems/integration/webhook-change-source.ts
384
- var WebhookChangeSource = class {
385
- label;
386
- queue;
387
- externalIdSourceField;
388
- eventIdSourceField;
389
- composed;
390
- constructor(opts) {
391
- if (opts.config.mode !== "webhook") {
392
- throw new Error(
393
- `WebhookChangeSource requires DetectionConfig.mode === 'webhook'; got '${opts.config.mode}'`
394
- );
395
- }
396
- const config = opts.config;
397
- const externalIdMapping = config.mapping.find(
398
- (m) => m.target === "external_id"
399
- );
400
- if (!externalIdMapping) {
401
- throw new Error(
402
- "WebhookChangeSource: DetectionConfig.mapping must include an entry with target 'external_id' so emitted Change<T>.externalId can be populated"
403
- );
404
- }
405
- this.externalIdSourceField = externalIdMapping.target;
406
- this.eventIdSourceField = config.webhook.eventIdField;
407
- this.queue = opts.queue;
408
- this.label = opts.label ?? `webhook-change-source:${externalIdMapping.source}`;
409
- const inner = (sub, cur) => this.fetch(sub, cur);
410
- const middlewares = opts.middlewares ?? [];
411
- this.composed = middlewares.reduceRight(
412
- (next, mw) => mw(next),
413
- inner
414
- );
415
- }
416
- listChanges(subscription, cursor) {
417
- return this.composed(subscription, cursor);
418
- }
419
- async *fetch(subscription, cursor) {
420
- const ctx = {
421
- subscription,
422
- cursor
423
- };
424
- for await (const { record, cursor: nextCursor } of this.queue(ctx)) {
425
- const externalIdRaw = record[this.externalIdSourceField];
426
- if (typeof externalIdRaw !== "string" || externalIdRaw.length === 0) {
427
- throw new Error(
428
- `WebhookChangeSource: record missing string '${this.externalIdSourceField}' \u2014 emitted records MUST carry the canonical external id keyed by the mapping target`
429
- );
430
- }
431
- const eventIdRaw = record[this.eventIdSourceField];
432
- if (typeof eventIdRaw !== "string" || eventIdRaw.length === 0) {
433
- throw new Error(
434
- `WebhookChangeSource: record missing string '${this.eventIdSourceField}' \u2014 webhook records MUST carry the event id (DetectionConfig.webhook.eventIdField) so Change<T>.dedupKey can be populated`
435
- );
436
- }
437
- const change = {
438
- externalId: externalIdRaw,
439
- // Webhook mode cannot distinguish create vs. update vs. delete on
440
- // its own — the orchestrator's diff stage handles classification.
441
- // Tombstone / soft-delete detection is consumer-driven (same as
442
- // poll mode — see ADR-033).
443
- operation: "updated",
444
- record,
445
- cursor: nextCursor ?? null,
446
- source: "webhook",
447
- dedupKey: eventIdRaw
448
- };
449
- yield change;
450
- }
451
- }
452
- };
453
-
454
- // runtime/subsystems/integration/build-change-source.ts
455
- function buildChangeSource(cfg, fetch, middlewares = []) {
456
- switch (cfg.mode) {
457
- case "poll":
458
- return new PollChangeSource({
459
- adapter: fetch,
460
- config: cfg,
461
- middlewares
462
- });
463
- case "webhook":
464
- return new WebhookChangeSource({
465
- queue: fetch,
466
- config: cfg,
467
- middlewares
468
- });
469
- }
470
- }
471
-
472
- // runtime/subsystems/integration/integration.tokens.ts
473
- var INTEGRATION_CHANGE_SOURCE = "INTEGRATION_CHANGE_SOURCE";
474
- var INTEGRATION_CURSOR_STORE = "INTEGRATION_CURSOR_STORE";
475
- var INTEGRATION_FIELD_DIFFER = "INTEGRATION_FIELD_DIFFER";
476
- var INTEGRATION_SINK = "INTEGRATION_SINK";
477
- var INTEGRATION_RUN_RECORDER = "INTEGRATION_RUN_RECORDER";
478
- var INTEGRATION_MODULE_OPTIONS = "INTEGRATION_MODULE_OPTIONS";
479
- var INTEGRATION_MULTI_TENANT = "INTEGRATION_MULTI_TENANT";
480
- var ENTITY_CHANGE_SOURCE_REGISTRY = "ENTITY_CHANGE_SOURCE_REGISTRY";
481
-
482
- // runtime/subsystems/integration/integration-errors.ts
483
- var MissingTenantIdError = class extends Error {
484
- name = "MissingTenantIdError";
485
- constructor(operation) {
486
- super(
487
- `Missing tenantId for integration operation '${operation}'. IntegrationModule is configured with multiTenant: true \u2014 every call must include a non-null tenantId. Either pass the tenantId or disable multi-tenancy on the module.`
488
- );
489
- }
490
- };
491
- function assertTenantId(tenantId, options) {
492
- if (!options.multiTenant) return;
493
- if (tenantId === void 0 || tenantId === null) {
494
- throw new MissingTenantIdError(options.operation);
495
- }
496
- }
497
-
498
- // runtime/subsystems/integration/integration-audit.schema.ts
1
+ import "../../../chunk-KVOWSC5S.js";
499
2
  import {
500
- pgEnum,
501
- pgTable,
502
- uuid,
503
- text,
504
- jsonb,
505
- integer,
506
- boolean,
507
- timestamp,
508
- index,
509
- uniqueIndex
510
- } from "drizzle-orm/pg-core";
511
- var integrationRunDirectionEnum = pgEnum("integration_run_direction", [
512
- "inbound",
513
- "outbound"
514
- ]);
515
- var integrationRunActionEnum = pgEnum("integration_run_action", [
516
- "poll",
517
- "cdc",
518
- "webhook",
519
- "manual",
520
- "writeback"
521
- ]);
522
- var integrationRunStatusEnum = pgEnum("integration_run_status", [
523
- "running",
524
- "success",
525
- "no_changes",
526
- "failed"
527
- ]);
528
- var integrationRunItemOperationEnum = pgEnum("integration_run_item_operation", [
529
- "created",
530
- "updated",
531
- "deleted",
532
- "noop"
533
- ]);
534
- var integrationRunItemStatusEnum = pgEnum("integration_run_item_status", [
535
- "success",
536
- "failed",
537
- "skipped"
538
- ]);
539
- var integrationSubscriptions = pgTable(
540
- "integration_subscriptions",
541
- {
542
- id: uuid("id").primaryKey().defaultRandom(),
543
- connectionId: text("connection_id").notNull(),
544
- adapter: text("adapter").notNull(),
545
- domain: text("domain").notNull(),
546
- externalRef: text("external_ref"),
547
- enabled: boolean("enabled").notNull().default(true),
548
- /**
549
- * Per-subscription configuration bag. Strategies type it internally;
550
- * e.g. polling strategies stash `{ batchSize, highWatermark }` here.
551
- */
552
- config: jsonb("config").notNull().default({}).$type(),
553
- /**
554
- * Opaque cursor persisted by `ICursorStore.put()`. NULL until the first
555
- * successful run advances it.
556
- */
557
- cursor: jsonb("cursor").$type(),
558
- lastIntegrationAt: timestamp("last_integration_at", { withTimezone: true }),
559
- /** Runtime-enforced when `INTEGRATION_MULTI_TENANT` is true; see SYNC-6. */
560
- tenantId: text("tenant_id"),
561
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
562
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
563
- },
564
- (t) => ({
565
- /**
566
- * Composite uniqueness per the epic shape. `external_ref` is nullable;
567
- * Postgres treats NULLs as distinct in a UNIQUE constraint, which means
568
- * two rows with the same `(connection_id, adapter, domain)` and NULL
569
- * external_ref are allowed. That's intentional — a subscription with
570
- * NULL external_ref covers the full domain, and duplicates there would
571
- * be a consumer-layer modeling issue, not a schema concern.
572
- */
573
- uqIntegrationSubscriptionTuple: uniqueIndex("uq_integration_subscriptions_tuple").on(
574
- t.connectionId,
575
- t.adapter,
576
- t.domain,
577
- t.externalRef
578
- ),
579
- /** Scheduling query: list enabled subscriptions ordered by staleness. */
580
- idxIntegrationSubscriptionsEnabledLastIntegration: index(
581
- "idx_integration_subscriptions_enabled_last_integration"
582
- ).on(t.enabled, t.lastIntegrationAt)
583
- })
584
- );
585
- var integrationRuns = pgTable(
586
- "integration_runs",
587
- {
588
- id: uuid("id").primaryKey().defaultRandom(),
589
- subscriptionId: uuid("subscription_id").notNull().references(() => integrationSubscriptions.id, { onDelete: "cascade" }),
590
- direction: integrationRunDirectionEnum("direction").notNull(),
591
- action: integrationRunActionEnum("action").notNull(),
592
- status: integrationRunStatusEnum("status").notNull().default("running"),
593
- recordsFound: integer("records_found").notNull().default(0),
594
- recordsProcessed: integer("records_processed").notNull().default(0),
595
- cursorBefore: jsonb("cursor_before").$type(),
596
- cursorAfter: jsonb("cursor_after").$type(),
597
- durationMs: integer("duration_ms"),
598
- error: text("error"),
599
- startedAt: timestamp("started_at", { withTimezone: true }).notNull().defaultNow(),
600
- completedAt: timestamp("completed_at", { withTimezone: true }),
601
- /** Runtime-enforced when `INTEGRATION_MULTI_TENANT` is true; see SYNC-6. */
602
- tenantId: text("tenant_id")
603
- },
604
- (t) => ({
605
- /** Timeline read: "most recent runs for this subscription". */
606
- idxIntegrationRunsSubscriptionStartedAt: index(
607
- "idx_integration_runs_subscription_started_at"
608
- ).on(t.subscriptionId, t.startedAt),
609
- /** Stale-run sweeper: "runs that started > N minutes ago and are still running". */
610
- idxIntegrationRunsStatusStartedAt: index("idx_integration_runs_status_started_at").on(
611
- t.status,
612
- t.startedAt
613
- )
614
- })
615
- );
616
- var integrationRunItems = pgTable(
617
- "integration_run_items",
618
- {
619
- id: uuid("id").primaryKey().defaultRandom(),
620
- integrationRunId: uuid("integration_run_id").notNull().references(() => integrationRuns.id, { onDelete: "cascade" }),
621
- entityType: text("entity_type").notNull(),
622
- externalId: text("external_id").notNull(),
623
- localId: text("local_id"),
624
- operation: integrationRunItemOperationEnum("operation").notNull(),
625
- status: integrationRunItemStatusEnum("status").notNull(),
626
- /**
627
- * Structured per-field diff — ADR-0003 shape enforced by
628
- * `FieldDiffSchema.parse` at the recorder service layer.
629
- *
630
- * Shape: `{ [fieldName]: { from: unknown, to: unknown } }`.
631
- * Empty `{}` for `noop` items; `{ [field]: { from: null, to: <value> } }`
632
- * for created items; `{ [field]: { from: <value>, to: null } }` for
633
- * deleted items.
634
- */
635
- changedFields: jsonb("changed_fields").notNull().default({}).$type(),
636
- title: text("title"),
637
- error: text("error"),
638
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
639
- /** Runtime-enforced when `INTEGRATION_MULTI_TENANT` is true; see SYNC-6. */
640
- tenantId: text("tenant_id")
641
- },
642
- (t) => ({
643
- /** Ordered timeline within a run. */
644
- idxIntegrationRunItemsRunCreatedAt: index("idx_integration_run_items_run_created_at").on(
645
- t.integrationRunId,
646
- t.createdAt
647
- ),
648
- /** Per-record history: "every integration that touched opportunity/$extId". */
649
- idxIntegrationRunItemsEntityExternal: index(
650
- "idx_integration_run_items_entity_external"
651
- ).on(t.entityType, t.externalId)
652
- })
653
- );
654
-
655
- // runtime/subsystems/integration/integration-cursor-store.memory-backend.ts
656
- import { Injectable } from "@nestjs/common";
657
- var MemoryCursorStore = class {
658
- /**
659
- * Subscription-id → last persisted cursor. Public so tests can inspect
660
- * or pre-seed state; production callers MUST go through `get`/`put`.
661
- */
662
- cursors = /* @__PURE__ */ new Map();
663
- /**
664
- * Seedable subscription metadata for `listAll` — the memory backend
665
- * stores only `subscriptionId → cursor` in its write path, so the
666
- * snapshot shape (`connectionId`, `adapter`, `domain`, `externalRef`,
667
- * timestamps) has no natural source without test seeding. Tests populate
668
- * this map; unseeded entries get empty-string metadata and `new Date(0)`
669
- * timestamps so the shape stays stable. Production paths go through the
670
- * Drizzle backend.
671
- */
672
- subscriptions = /* @__PURE__ */ new Map();
673
- async get(subscriptionId, _tenantId) {
674
- const value = this.cursors.get(subscriptionId);
675
- return value === void 0 ? null : value;
676
- }
677
- async put(subscriptionId, cursor, _tenantId) {
678
- this.cursors.set(subscriptionId, cursor);
679
- }
680
- async listAll(_tenantId) {
681
- const snapshots = [];
682
- for (const [subscriptionId, cursor] of this.cursors.entries()) {
683
- const meta = this.subscriptions.get(subscriptionId);
684
- snapshots.push({
685
- subscriptionId,
686
- connectionId: meta?.connectionId ?? "",
687
- adapter: meta?.adapter ?? "",
688
- domain: meta?.domain ?? "",
689
- externalRef: meta?.externalRef ?? null,
690
- cursor: cursor ?? null,
691
- lastIntegrationAt: meta?.lastIntegrationAt ?? null,
692
- updatedAt: meta?.updatedAt ?? /* @__PURE__ */ new Date(0),
693
- tenantId: null
694
- });
695
- }
696
- return snapshots.sort(
697
- (a, b) => b.updatedAt.getTime() - a.updatedAt.getTime()
698
- );
699
- }
700
- /** Reset state. Tests call this in `beforeEach`. */
701
- clear() {
702
- this.cursors.clear();
703
- this.subscriptions.clear();
704
- }
705
- };
706
- MemoryCursorStore = __decorateClass([
707
- Injectable()
708
- ], MemoryCursorStore);
709
-
710
- // runtime/subsystems/integration/integration-run-recorder.memory-backend.ts
711
- import { Injectable as Injectable2 } from "@nestjs/common";
712
- var MemoryRunRecorder = class {
713
- /**
714
- * All started runs keyed by id. Public so tests can inspect lifecycle
715
- * transitions without poking through recording methods.
716
- */
717
- runs = /* @__PURE__ */ new Map();
718
- /**
719
- * Items keyed by `integration_run_id`, array order matches insertion order —
720
- * mirrors the timeline the `(integration_run_id, created_at)` index produces
721
- * in Postgres.
722
- */
723
- items = /* @__PURE__ */ new Map();
724
- /**
725
- * Seedable subscription metadata — tests populate this to make
726
- * `listRecent` return meaningful `connectionId` values. The memory
727
- * backend doesn't track subscriptions on its own (only runs + items), so
728
- * this map is the intentional extension point: tests write entries for
729
- * the subscription ids they use, production code never touches it.
730
- */
731
- subscriptions = /* @__PURE__ */ new Map();
732
- async startRun(input) {
733
- const id = crypto.randomUUID();
734
- this.runs.set(id, {
735
- id,
736
- subscriptionId: input.subscriptionId,
737
- direction: input.direction,
738
- action: input.action,
739
- status: "running",
740
- cursorBefore: input.cursorBefore ?? null,
741
- cursorAfter: null,
742
- recordsFound: 0,
743
- recordsProcessed: 0,
744
- durationMs: null,
745
- error: null,
746
- tenantId: input.tenantId ?? null,
747
- startedAt: /* @__PURE__ */ new Date(),
748
- completedAt: null
749
- });
750
- this.items.set(id, []);
751
- return { id };
752
- }
753
- async recordItem(input) {
754
- FieldDiffSchema.parse(input.changedFields);
755
- const bucket = this.items.get(input.integrationRunId);
756
- if (!bucket) {
757
- throw new Error(
758
- `MemoryRunRecorder.recordItem: no run started for id '${input.integrationRunId}'. Call startRun(...) first.`
759
- );
760
- }
761
- bucket.push(input);
762
- }
763
- async completeRun(runId, input) {
764
- const run = this.runs.get(runId);
765
- if (!run) {
766
- throw new Error(
767
- `MemoryRunRecorder.completeRun: no run started for id '${runId}'.`
768
- );
769
- }
770
- run.status = input.status;
771
- run.recordsFound = input.recordsFound;
772
- run.recordsProcessed = input.recordsProcessed;
773
- run.cursorAfter = input.cursorAfter ?? null;
774
- run.durationMs = input.durationMs;
775
- run.error = input.error ?? null;
776
- run.completedAt = /* @__PURE__ */ new Date();
777
- }
778
- async listRecent(limit, subscriptionId, _tenantId) {
779
- const all = Array.from(this.runs.values());
780
- const filtered = subscriptionId === void 0 ? all : all.filter((r) => r.subscriptionId === subscriptionId);
781
- return filtered.sort((a, b) => b.startedAt.getTime() - a.startedAt.getTime()).slice(0, limit).map((r) => ({
782
- id: r.id,
783
- subscriptionId: r.subscriptionId,
784
- // connectionId is only knowable if the test seeded subscriptions
785
- // metadata; empty string otherwise. The Drizzle backend resolves
786
- // it via JOIN, which is the production path.
787
- connectionId: this.subscriptions.get(r.subscriptionId)?.connectionId ?? "",
788
- status: r.status,
789
- startedAt: r.startedAt,
790
- completedAt: r.completedAt,
791
- recordsProcessed: r.recordsProcessed,
792
- tenantId: r.tenantId
793
- }));
794
- }
795
- /** Reset state. Tests call this in `beforeEach`. */
796
- clear() {
797
- this.runs.clear();
798
- this.items.clear();
799
- this.subscriptions.clear();
800
- }
801
- // ─── test ergonomics ─────────────────────────────────────────────────
802
- /** All runs for a subscription, newest first. Timeline reads. */
803
- getRunsForSubscription(subscriptionId) {
804
- return Array.from(this.runs.values()).filter((r) => r.subscriptionId === subscriptionId).sort((a, b) => b.startedAt.getTime() - a.startedAt.getTime());
805
- }
806
- /** All item rows for a run, insertion-ordered. */
807
- getItemsForRun(runId) {
808
- return this.items.get(runId) ?? [];
809
- }
810
- };
811
- MemoryRunRecorder = __decorateClass([
812
- Injectable2()
813
- ], MemoryRunRecorder);
814
-
815
- // runtime/subsystems/integration/deep-equal.differ.ts
816
- import { Injectable as Injectable3 } from "@nestjs/common";
817
- var DEFAULT_IGNORE_FIELDS = /* @__PURE__ */ new Set([
818
- "id",
819
- "createdAt",
820
- "updatedAt",
821
- "deletedAt",
822
- "type",
823
- "lastModifiedAt",
824
- "fields",
825
- "external_id",
826
- "externalId",
827
- "provider",
828
- "provider_metadata",
829
- "providerMetadata"
830
- ]);
831
- var DeepEqualDiffer = class {
832
- ignore;
833
- constructor(opts = {}) {
834
- if (opts.ignore && opts.ignore.length > 0) {
835
- this.ignore = /* @__PURE__ */ new Set([...DEFAULT_IGNORE_FIELDS, ...opts.ignore]);
836
- } else {
837
- this.ignore = DEFAULT_IGNORE_FIELDS;
838
- }
839
- }
840
- diff(existing, incoming, providerChangedFields) {
841
- if (existing === null) {
842
- const out2 = {};
843
- for (const key of Object.keys(incoming)) {
844
- if (this.ignore.has(key)) continue;
845
- const value = incoming[key];
846
- if (value === null || value === void 0) continue;
847
- out2[key] = { from: null, to: value };
848
- }
849
- return Object.keys(out2).length === 0 ? "noop" : out2;
850
- }
851
- const candidates = /* @__PURE__ */ new Set();
852
- if (providerChangedFields && providerChangedFields.length > 0) {
853
- for (const key of providerChangedFields) {
854
- if (!this.ignore.has(key)) candidates.add(key);
855
- }
856
- } else {
857
- for (const key of Object.keys(incoming)) {
858
- if (!this.ignore.has(key)) candidates.add(key);
859
- }
860
- for (const key of Object.keys(existing)) {
861
- if (this.ignore.has(key)) continue;
862
- if (!(key in incoming)) continue;
863
- candidates.add(key);
864
- }
865
- }
866
- const out = {};
867
- for (const key of candidates) {
868
- const before = existing[key];
869
- const after = incoming[key];
870
- if (!isEqual(before, after)) {
871
- out[key] = { from: before ?? null, to: after ?? null };
872
- }
873
- }
874
- return Object.keys(out).length === 0 ? "noop" : out;
875
- }
876
- };
877
- DeepEqualDiffer = __decorateClass([
878
- Injectable3()
879
- ], DeepEqualDiffer);
880
- function isEqual(a, b) {
881
- if (a === b) return true;
882
- const na = normalize(a);
883
- const nb = normalize(b);
884
- if (na === nb) return true;
885
- if (typeof na === "object" && typeof nb === "object" && na !== null && nb !== null) {
886
- return deepEqualObject(na, nb);
887
- }
888
- const numericEqual = maybeNumericEqual(na, nb) || maybeNumericEqual(nb, na);
889
- return numericEqual;
890
- }
891
- function normalize(value) {
892
- if (value instanceof Date) return value.toISOString();
893
- return value;
894
- }
895
- function maybeNumericEqual(a, b) {
896
- if (typeof a !== "string" || typeof b !== "number") return false;
897
- if (a.trim() === "") return false;
898
- const parsed = Number(a);
899
- if (!Number.isFinite(parsed)) return false;
900
- return parsed === b;
901
- }
902
- function deepEqualObject(a, b) {
903
- if (Array.isArray(a) !== Array.isArray(b)) return false;
904
- const aKeys = Object.keys(a);
905
- const bKeys = Object.keys(b);
906
- if (aKeys.length !== bKeys.length) return false;
907
- for (const key of aKeys) {
908
- if (!(key in b)) return false;
909
- if (!isEqual(a[key], b[key])) return false;
910
- }
911
- return true;
912
- }
913
-
914
- // runtime/subsystems/integration/execute-integration.use-case.ts
915
- import { Inject, Injectable as Injectable4, Logger, Optional } from "@nestjs/common";
916
- var ExecuteIntegrationUseCase = class {
917
- constructor(source, cursors, differ, sink, recorder, multiTenant = false) {
918
- this.source = source;
919
- this.cursors = cursors;
920
- this.differ = differ;
921
- this.sink = sink;
922
- this.recorder = recorder;
923
- this.multiTenant = multiTenant;
924
- }
925
- source;
926
- cursors;
927
- differ;
928
- sink;
929
- recorder;
930
- multiTenant;
931
- logger = new Logger(ExecuteIntegrationUseCase.name);
932
- async execute(input) {
933
- assertTenantId(input.tenantId, {
934
- multiTenant: this.multiTenant,
935
- operation: "execute"
936
- });
937
- const source = input.sourceOverride ?? this.source;
938
- const startedAt = Date.now();
939
- const cursorBefore = await this.cursors.get(input.subscription.id, input.tenantId);
940
- const { id: runId } = await this.recorder.startRun({
941
- subscriptionId: input.subscription.id,
942
- direction: input.direction,
943
- action: input.action,
944
- cursorBefore,
945
- tenantId: input.tenantId
946
- });
947
- let recordsFound = 0;
948
- let recordsProcessed = 0;
949
- let recordsFailed = 0;
950
- let latestCursor = cursorBefore;
951
- let cursorAdvanced = false;
952
- let runError = null;
953
- let status = "no_changes";
954
- try {
955
- for await (const change of source.listChanges(input.subscription, cursorBefore)) {
956
- recordsFound++;
957
- latestCursor = change.cursor;
958
- cursorAdvanced = true;
959
- try {
960
- await this.processChange(runId, input, change);
961
- recordsProcessed++;
962
- } catch (err) {
963
- recordsFailed++;
964
- const message = err instanceof Error ? err.message : String(err);
965
- this.logger.warn(
966
- `integration item failed: subscription=${input.subscription.id} externalId=${change.externalId}: ${message}`
967
- );
968
- await this.recorder.recordItem({
969
- integrationRunId: runId,
970
- entityType: input.subscription.domain,
971
- externalId: change.externalId,
972
- operation: change.operation === "deleted" ? "deleted" : "updated",
973
- status: "failed",
974
- changedFields: {},
975
- error: message,
976
- tenantId: input.tenantId
977
- });
978
- }
979
- }
980
- if (recordsFailed > 0 && recordsProcessed === 0 && recordsFound > 0) {
981
- status = "failed";
982
- runError = `all ${recordsFailed} records failed`;
983
- } else if (recordsFound === 0) {
984
- status = "no_changes";
985
- } else {
986
- status = "success";
987
- }
988
- } catch (err) {
989
- status = "failed";
990
- runError = err instanceof Error ? err.message : String(err);
991
- this.logger.error(
992
- `integration source failed: subscription=${input.subscription.id}: ${runError}`
993
- );
994
- }
995
- if (cursorAdvanced && latestCursor !== null && latestCursor !== void 0) {
996
- try {
997
- await this.cursors.put(input.subscription.id, latestCursor, input.tenantId);
998
- } catch (err) {
999
- const message = err instanceof Error ? err.message : String(err);
1000
- this.logger.error(
1001
- `cursor put failed: subscription=${input.subscription.id}: ${message}`
1002
- );
1003
- if (status !== "failed") {
1004
- status = "failed";
1005
- runError = `cursor put failed: ${message}`;
1006
- }
1007
- }
1008
- }
1009
- const durationMs = Date.now() - startedAt;
1010
- await this.recorder.completeRun(runId, {
1011
- status,
1012
- recordsFound,
1013
- recordsProcessed,
1014
- cursorAfter: cursorAdvanced ? latestCursor : cursorBefore,
1015
- durationMs,
1016
- error: runError
1017
- });
1018
- return {
1019
- runId,
1020
- status,
1021
- recordsFound,
1022
- recordsProcessed,
1023
- recordsFailed,
1024
- cursorBefore,
1025
- cursorAfter: cursorAdvanced ? latestCursor : cursorBefore,
1026
- durationMs,
1027
- error: runError
1028
- };
1029
- }
1030
- async processChange(runId, input, change) {
1031
- if (change.operation === "deleted") {
1032
- const result = await this.sink.softDeleteByExternalId(
1033
- input.userId,
1034
- change.externalId
1035
- );
1036
- await this.recorder.recordItem({
1037
- integrationRunId: runId,
1038
- entityType: input.subscription.domain,
1039
- externalId: change.externalId,
1040
- localId: result?.id ?? null,
1041
- operation: result ? "deleted" : "noop",
1042
- status: "success",
1043
- changedFields: {},
1044
- tenantId: input.tenantId
1045
- });
1046
- return;
1047
- }
1048
- const existing = await this.sink.findByExternalId(
1049
- input.userId,
1050
- change.externalId
1051
- );
1052
- const diff = this.differ.diff(
1053
- existing,
1054
- change.record,
1055
- change.providerChangedFields
1056
- );
1057
- if (diff === "noop") {
1058
- if (!this.sink.reprojectsOnNoop) {
1059
- await this.recorder.recordItem({
1060
- integrationRunId: runId,
1061
- entityType: input.subscription.domain,
1062
- externalId: change.externalId,
1063
- localId: null,
1064
- operation: "noop",
1065
- status: "success",
1066
- changedFields: {},
1067
- tenantId: input.tenantId
1068
- });
1069
- return;
1070
- }
1071
- const { id: noopLocalId } = await this.sink.upsertByExternalId(
1072
- input.userId,
1073
- change.record,
1074
- input.provider
1075
- );
1076
- await this.recorder.recordItem({
1077
- integrationRunId: runId,
1078
- entityType: input.subscription.domain,
1079
- externalId: change.externalId,
1080
- localId: noopLocalId,
1081
- operation: "noop",
1082
- status: "success",
1083
- changedFields: {},
1084
- tenantId: input.tenantId
1085
- });
1086
- return;
1087
- }
1088
- const { id: localId } = await this.sink.upsertByExternalId(
1089
- input.userId,
1090
- change.record,
1091
- input.provider
1092
- );
1093
- await this.recorder.recordItem({
1094
- integrationRunId: runId,
1095
- entityType: input.subscription.domain,
1096
- externalId: change.externalId,
1097
- localId,
1098
- operation: existing === null ? "created" : "updated",
1099
- status: "success",
1100
- changedFields: diff,
1101
- tenantId: input.tenantId
1102
- });
1103
- }
1104
- };
1105
- ExecuteIntegrationUseCase = __decorateClass([
1106
- Injectable4(),
1107
- __decorateParam(0, Inject(INTEGRATION_CHANGE_SOURCE)),
1108
- __decorateParam(1, Inject(INTEGRATION_CURSOR_STORE)),
1109
- __decorateParam(2, Inject(INTEGRATION_FIELD_DIFFER)),
1110
- __decorateParam(3, Inject(INTEGRATION_SINK)),
1111
- __decorateParam(4, Inject(INTEGRATION_RUN_RECORDER)),
1112
- __decorateParam(5, Optional()),
1113
- __decorateParam(5, Inject(INTEGRATION_MULTI_TENANT))
1114
- ], ExecuteIntegrationUseCase);
1115
-
1116
- // runtime/subsystems/integration/integration-cursor-store.drizzle-backend.ts
1117
- import { Inject as Inject2, Injectable as Injectable5, Optional as Optional2 } from "@nestjs/common";
1118
- import { and, desc, eq } from "drizzle-orm";
1119
-
1120
- // runtime/constants/tokens.ts
1121
- var DRIZZLE = "DRIZZLE";
1122
-
1123
- // runtime/subsystems/integration/integration-cursor-store.drizzle-backend.ts
1124
- var PostgresCursorStore = class {
1125
- constructor(db, multiTenant) {
1126
- this.db = db;
1127
- this.multiTenant = multiTenant ?? false;
1128
- }
1129
- db;
1130
- multiTenant;
1131
- async get(subscriptionId, tenantId) {
1132
- const where = this.buildWhere(subscriptionId, tenantId, "cursor.get");
1133
- const rows = await this.db.select({ cursor: integrationSubscriptions.cursor }).from(integrationSubscriptions).where(where).limit(1);
1134
- if (rows.length === 0) return null;
1135
- return rows[0]?.cursor ?? null;
1136
- }
1137
- async put(subscriptionId, cursor, tenantId) {
1138
- const where = this.buildWhere(subscriptionId, tenantId, "cursor.put");
1139
- await this.db.update(integrationSubscriptions).set({
1140
- cursor,
1141
- lastIntegrationAt: /* @__PURE__ */ new Date(),
1142
- updatedAt: /* @__PURE__ */ new Date()
1143
- }).where(where);
1144
- }
1145
- async listAll(tenantId) {
1146
- assertTenantId(tenantId, {
1147
- multiTenant: this.multiTenant,
1148
- operation: "cursor.listAll"
1149
- });
1150
- const where = this.multiTenant ? eq(integrationSubscriptions.tenantId, tenantId) : void 0;
1151
- const rows = await this.db.select({
1152
- id: integrationSubscriptions.id,
1153
- connectionId: integrationSubscriptions.connectionId,
1154
- adapter: integrationSubscriptions.adapter,
1155
- domain: integrationSubscriptions.domain,
1156
- externalRef: integrationSubscriptions.externalRef,
1157
- cursor: integrationSubscriptions.cursor,
1158
- lastIntegrationAt: integrationSubscriptions.lastIntegrationAt,
1159
- updatedAt: integrationSubscriptions.updatedAt,
1160
- tenantId: integrationSubscriptions.tenantId
1161
- }).from(integrationSubscriptions).where(where).orderBy(desc(integrationSubscriptions.updatedAt));
1162
- return rows.map((row) => ({
1163
- subscriptionId: row.id,
1164
- connectionId: row.connectionId,
1165
- adapter: row.adapter,
1166
- domain: row.domain,
1167
- externalRef: row.externalRef,
1168
- cursor: row.cursor ?? null,
1169
- lastIntegrationAt: row.lastIntegrationAt,
1170
- updatedAt: row.updatedAt,
1171
- tenantId: row.tenantId
1172
- }));
1173
- }
1174
- /**
1175
- * Centralized WHERE clause — `get` and `put` share identical semantics.
1176
- * Drift here would let a caller read under one tenancy rule and write
1177
- * under another.
1178
- */
1179
- buildWhere(subscriptionId, tenantId, operation) {
1180
- assertTenantId(tenantId, {
1181
- multiTenant: this.multiTenant,
1182
- operation
1183
- });
1184
- if (this.multiTenant) {
1185
- return and(
1186
- eq(integrationSubscriptions.id, subscriptionId),
1187
- eq(integrationSubscriptions.tenantId, tenantId)
1188
- );
1189
- }
1190
- return eq(integrationSubscriptions.id, subscriptionId);
1191
- }
1192
- };
1193
- PostgresCursorStore = __decorateClass([
1194
- Injectable5(),
1195
- __decorateParam(0, Inject2(DRIZZLE)),
1196
- __decorateParam(1, Optional2()),
1197
- __decorateParam(1, Inject2(INTEGRATION_MULTI_TENANT))
1198
- ], PostgresCursorStore);
1199
-
1200
- // runtime/subsystems/integration/integration-run-recorder.drizzle-backend.ts
1201
- import { Inject as Inject3, Injectable as Injectable6, Optional as Optional3 } from "@nestjs/common";
1202
- import { and as and2, desc as desc2, eq as eq2 } from "drizzle-orm";
1203
- var DrizzleIntegrationRunRecorder = class {
1204
- constructor(db, multiTenant) {
1205
- this.db = db;
1206
- this.multiTenant = multiTenant ?? false;
1207
- }
1208
- db;
1209
- multiTenant;
1210
- async startRun(input) {
1211
- assertTenantId(input.tenantId, {
1212
- multiTenant: this.multiTenant,
1213
- operation: "startRun"
1214
- });
1215
- const rows = await this.db.insert(integrationRuns).values({
1216
- subscriptionId: input.subscriptionId,
1217
- direction: input.direction,
1218
- action: input.action,
1219
- status: "running",
1220
- cursorBefore: input.cursorBefore ?? null,
1221
- tenantId: input.tenantId ?? null
1222
- }).returning({ id: integrationRuns.id });
1223
- const id = rows[0]?.id;
1224
- if (!id) {
1225
- throw new Error("DrizzleIntegrationRunRecorder: INSERT RETURNING produced no id");
1226
- }
1227
- return { id };
1228
- }
1229
- async recordItem(input) {
1230
- assertTenantId(input.tenantId, {
1231
- multiTenant: this.multiTenant,
1232
- operation: "recordItem"
1233
- });
1234
- FieldDiffSchema.parse(input.changedFields);
1235
- await this.db.insert(integrationRunItems).values({
1236
- integrationRunId: input.integrationRunId,
1237
- entityType: input.entityType,
1238
- externalId: input.externalId,
1239
- localId: input.localId ?? null,
1240
- operation: input.operation,
1241
- status: input.status,
1242
- changedFields: input.changedFields,
1243
- title: input.title ?? null,
1244
- error: input.error ?? null,
1245
- tenantId: input.tenantId ?? null
1246
- });
1247
- }
1248
- async listRecent(limit, subscriptionId, tenantId) {
1249
- assertTenantId(tenantId, {
1250
- multiTenant: this.multiTenant,
1251
- operation: "listRecent"
1252
- });
1253
- const conditions = [];
1254
- if (subscriptionId !== void 0) {
1255
- conditions.push(eq2(integrationRuns.subscriptionId, subscriptionId));
1256
- }
1257
- if (this.multiTenant) {
1258
- conditions.push(eq2(integrationRuns.tenantId, tenantId));
1259
- }
1260
- const where = conditions.length === 0 ? void 0 : conditions.length === 1 ? conditions[0] : and2(...conditions);
1261
- const rows = await this.db.select({
1262
- id: integrationRuns.id,
1263
- subscriptionId: integrationRuns.subscriptionId,
1264
- connectionId: integrationSubscriptions.connectionId,
1265
- status: integrationRuns.status,
1266
- startedAt: integrationRuns.startedAt,
1267
- completedAt: integrationRuns.completedAt,
1268
- recordsProcessed: integrationRuns.recordsProcessed,
1269
- tenantId: integrationRuns.tenantId
1270
- }).from(integrationRuns).innerJoin(
1271
- integrationSubscriptions,
1272
- eq2(integrationRuns.subscriptionId, integrationSubscriptions.id)
1273
- ).where(where).orderBy(desc2(integrationRuns.startedAt)).limit(limit);
1274
- return rows.map((row) => ({
1275
- id: row.id,
1276
- subscriptionId: row.subscriptionId,
1277
- connectionId: row.connectionId,
1278
- status: row.status,
1279
- startedAt: row.startedAt,
1280
- completedAt: row.completedAt,
1281
- recordsProcessed: row.recordsProcessed,
1282
- tenantId: row.tenantId
1283
- }));
1284
- }
1285
- async completeRun(runId, input) {
1286
- await this.db.update(integrationRuns).set({
1287
- status: input.status,
1288
- recordsFound: input.recordsFound,
1289
- recordsProcessed: input.recordsProcessed,
1290
- cursorAfter: input.cursorAfter ?? null,
1291
- durationMs: input.durationMs,
1292
- error: input.error ?? null,
1293
- completedAt: /* @__PURE__ */ new Date()
1294
- }).where(eq2(integrationRuns.id, runId));
1295
- }
1296
- };
1297
- DrizzleIntegrationRunRecorder = __decorateClass([
1298
- Injectable6(),
1299
- __decorateParam(0, Inject3(DRIZZLE)),
1300
- __decorateParam(1, Optional3()),
1301
- __decorateParam(1, Inject3(INTEGRATION_MULTI_TENANT))
1302
- ], DrizzleIntegrationRunRecorder);
1303
-
1304
- // runtime/subsystems/integration/integration.module.ts
1305
- import { Module } from "@nestjs/common";
1306
- var IntegrationModule = class {
1307
- static forRoot(options) {
1308
- const multiTenant = options.multiTenant ?? false;
1309
- const sharedProviders = [
1310
- { provide: INTEGRATION_MODULE_OPTIONS, useValue: options },
1311
- { provide: INTEGRATION_MULTI_TENANT, useValue: multiTenant },
1312
- // Default differ — consumers can override by binding a different
1313
- // `IFieldDiffer<T>` to `INTEGRATION_FIELD_DIFFER` in their feature module.
1314
- { provide: INTEGRATION_FIELD_DIFFER, useValue: new DeepEqualDiffer() }
1315
- ];
1316
- const backendProviders = options.backend === "memory" ? [
1317
- // Wired as singletons via `useValue` so tests can pull
1318
- // them out via `moduleRef.get(MemoryCursorStore)` for
1319
- // direct assertions. Matches JOB-4 / MemoryJobStore shape.
1320
- { provide: MemoryCursorStore, useValue: new MemoryCursorStore() },
1321
- {
1322
- provide: INTEGRATION_CURSOR_STORE,
1323
- useExisting: MemoryCursorStore
1324
- },
1325
- { provide: MemoryRunRecorder, useValue: new MemoryRunRecorder() },
1326
- {
1327
- provide: INTEGRATION_RUN_RECORDER,
1328
- useExisting: MemoryRunRecorder
1329
- }
1330
- ] : [
1331
- // Drizzle backends — injected with DRIZZLE (provided by the
1332
- // consumer's DrizzleModule) + the INTEGRATION_MULTI_TENANT flag
1333
- // we bound above.
1334
- { provide: INTEGRATION_CURSOR_STORE, useClass: PostgresCursorStore },
1335
- { provide: INTEGRATION_RUN_RECORDER, useClass: DrizzleIntegrationRunRecorder }
1336
- ];
1337
- return {
1338
- module: IntegrationModule,
1339
- global: true,
1340
- providers: [...sharedProviders, ...backendProviders],
1341
- exports: [
1342
- INTEGRATION_MODULE_OPTIONS,
1343
- INTEGRATION_MULTI_TENANT,
1344
- INTEGRATION_FIELD_DIFFER,
1345
- INTEGRATION_CURSOR_STORE,
1346
- INTEGRATION_RUN_RECORDER
1347
- ]
1348
- };
1349
- }
1350
- };
1351
- IntegrationModule = __decorateClass([
1352
- Module({})
1353
- ], IntegrationModule);
3
+ IntegrationModule
4
+ } from "../../../chunk-GCYKMF22.js";
5
+ import {
6
+ MemoryRunRecorder
7
+ } from "../../../chunk-EO2QPOKH.js";
8
+ import {
9
+ createLoopbackMiddleware
10
+ } from "../../../chunk-PRWIX6UW.js";
11
+ import {
12
+ PostgresCursorStore
13
+ } from "../../../chunk-DCCZB4UC.js";
14
+ import {
15
+ MemoryCursorStore
16
+ } from "../../../chunk-AHV4GDYM.js";
17
+ import {
18
+ DrizzleIntegrationRunRecorder
19
+ } from "../../../chunk-SR7F3TJY.js";
20
+ import {
21
+ FieldDiffSchema,
22
+ FieldDiffValueSchema
23
+ } from "../../../chunk-SQDOBLBP.js";
24
+ import {
25
+ CURSOR_DIVISIBILITY,
26
+ CursorStrategySchema,
27
+ DetectionConfigSchema,
28
+ FieldMappingSchema,
29
+ PollDetectionSchema,
30
+ ResolvedFilterSchema,
31
+ WebhookDetectionSchema,
32
+ isDivisibleCursor
33
+ } from "../../../chunk-3NMCDN7L.js";
34
+ import {
35
+ MemoryEntityChangeSourceRegistry
36
+ } from "../../../chunk-4KNXX6TI.js";
37
+ import {
38
+ UnknownEntityError
39
+ } from "../../../chunk-3CJFPU6Q.js";
40
+ import {
41
+ ExecuteIntegrationUseCase
42
+ } from "../../../chunk-OGIZXGPY.js";
43
+ import {
44
+ MissingTenantIdError,
45
+ assertTenantId
46
+ } from "../../../chunk-MZ6GV4YF.js";
47
+ import {
48
+ IncrementalReadBase,
49
+ mapConcurrent
50
+ } from "../../../chunk-LG57S2SC.js";
51
+ import {
52
+ integrationRunActionEnum,
53
+ integrationRunDirectionEnum,
54
+ integrationRunItemOperationEnum,
55
+ integrationRunItemStatusEnum,
56
+ integrationRunItems,
57
+ integrationRunStatusEnum,
58
+ integrationRuns,
59
+ integrationSubscriptions
60
+ } from "../../../chunk-HNWZFNKP.js";
61
+ import {
62
+ buildChangeSource
63
+ } from "../../../chunk-WWGYCIJX.js";
64
+ import {
65
+ PollChangeSource
66
+ } from "../../../chunk-4MF3HKJA.js";
67
+ import {
68
+ WebhookChangeSource
69
+ } from "../../../chunk-YLPAPPLW.js";
70
+ import {
71
+ DeepEqualDiffer
72
+ } from "../../../chunk-36U5UGIO.js";
73
+ import {
74
+ ENTITY_CHANGE_SOURCE_REGISTRY,
75
+ INTEGRATION_CHANGE_SOURCE,
76
+ INTEGRATION_CURSOR_STORE,
77
+ INTEGRATION_FIELD_DIFFER,
78
+ INTEGRATION_MODULE_OPTIONS,
79
+ INTEGRATION_MULTI_TENANT,
80
+ INTEGRATION_RUN_RECORDER,
81
+ INTEGRATION_SINK
82
+ } from "../../../chunk-S7C6TIIF.js";
83
+ import "../../../chunk-U64T4YZE.js";
84
+ import "../../../chunk-2E224ZSN.js";
1354
85
  export {
1355
86
  CURSOR_DIVISIBILITY,
1356
87
  CursorStrategySchema,