@nicia-ai/typegraph 0.45.0 → 0.46.1

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 (384) hide show
  1. package/dist/backend/drizzle/indexes.cjs +11 -11
  2. package/dist/backend/drizzle/indexes.d.cts +1 -1
  3. package/dist/backend/drizzle/indexes.d.ts +1 -1
  4. package/dist/backend/drizzle/indexes.js +7 -7
  5. package/dist/backend/index.cjs +53 -54
  6. package/dist/backend/index.d.cts +3 -3
  7. package/dist/backend/index.d.ts +3 -3
  8. package/dist/backend/index.js +13 -14
  9. package/dist/backend/postgres/index.cjs +29 -30
  10. package/dist/backend/postgres/index.d.cts +7 -7
  11. package/dist/backend/postgres/index.d.ts +7 -7
  12. package/dist/backend/postgres/index.js +16 -17
  13. package/dist/backend/postgres/pglite-store.cjs +48 -42
  14. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  15. package/dist/backend/postgres/pglite-store.d.cts +15 -9
  16. package/dist/backend/postgres/pglite-store.d.ts +15 -9
  17. package/dist/backend/postgres/pglite-store.js +44 -38
  18. package/dist/backend/postgres/pglite-store.js.map +1 -1
  19. package/dist/backend/postgres/pglite.cjs +18 -19
  20. package/dist/backend/postgres/pglite.d.cts +4 -4
  21. package/dist/backend/postgres/pglite.d.ts +4 -4
  22. package/dist/backend/postgres/pglite.js +17 -18
  23. package/dist/backend/sqlite/index.cjs +26 -27
  24. package/dist/backend/sqlite/index.d.cts +6 -6
  25. package/dist/backend/sqlite/index.d.ts +6 -6
  26. package/dist/backend/sqlite/index.js +14 -15
  27. package/dist/backend/sqlite/libsql.cjs +21 -22
  28. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  29. package/dist/backend/sqlite/libsql.d.cts +15 -8
  30. package/dist/backend/sqlite/libsql.d.ts +15 -8
  31. package/dist/backend/sqlite/libsql.js +17 -18
  32. package/dist/backend/sqlite/libsql.js.map +1 -1
  33. package/dist/backend/sqlite/local-store.cjs +49 -43
  34. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  35. package/dist/backend/sqlite/local-store.d.cts +15 -10
  36. package/dist/backend/sqlite/local-store.d.ts +15 -10
  37. package/dist/backend/sqlite/local-store.js +45 -39
  38. package/dist/backend/sqlite/local-store.js.map +1 -1
  39. package/dist/backend/sqlite/local.cjs +19 -20
  40. package/dist/backend/sqlite/local.d.cts +3 -3
  41. package/dist/backend/sqlite/local.d.ts +3 -3
  42. package/dist/backend/sqlite/local.js +17 -18
  43. package/dist/{chunk-S3ZRKJHY.js → chunk-2LG2XB2M.js} +3 -3
  44. package/dist/{chunk-S3ZRKJHY.js.map → chunk-2LG2XB2M.js.map} +1 -1
  45. package/dist/{chunk-7PF2L3H6.cjs → chunk-2NA5DYLO.cjs} +4 -4
  46. package/dist/{chunk-7PF2L3H6.cjs.map → chunk-2NA5DYLO.cjs.map} +1 -1
  47. package/dist/chunk-2Z2Z3ZD6.js +58 -0
  48. package/dist/chunk-2Z2Z3ZD6.js.map +1 -0
  49. package/dist/{chunk-VVQM4CZD.cjs → chunk-3DHZCOT7.cjs} +20 -20
  50. package/dist/{chunk-VVQM4CZD.cjs.map → chunk-3DHZCOT7.cjs.map} +1 -1
  51. package/dist/{chunk-JXUTCSXX.cjs → chunk-4UGOKMI5.cjs} +250 -158
  52. package/dist/chunk-4UGOKMI5.cjs.map +1 -0
  53. package/dist/{chunk-RFRM3Q5K.js → chunk-5262ZMTR.js} +14 -5
  54. package/dist/chunk-5262ZMTR.js.map +1 -0
  55. package/dist/{chunk-QRNYDV5Z.js → chunk-5763DULU.js} +214 -69
  56. package/dist/chunk-5763DULU.js.map +1 -0
  57. package/dist/{chunk-BGYJW37L.js → chunk-5UVRGXD3.js} +277 -7
  58. package/dist/chunk-5UVRGXD3.js.map +1 -0
  59. package/dist/{chunk-QR24DJDF.cjs → chunk-62ZP23AW.cjs} +15 -15
  60. package/dist/{chunk-QR24DJDF.cjs.map → chunk-62ZP23AW.cjs.map} +1 -1
  61. package/dist/{chunk-ZI6VQSZA.cjs → chunk-65E3XWGF.cjs} +724 -577
  62. package/dist/chunk-65E3XWGF.cjs.map +1 -0
  63. package/dist/{chunk-S4KQ5LV4.js → chunk-775A4ZMN.js} +40 -6
  64. package/dist/chunk-775A4ZMN.js.map +1 -0
  65. package/dist/{chunk-J2ICGNHO.cjs → chunk-7BQXPCGN.cjs} +830 -169
  66. package/dist/chunk-7BQXPCGN.cjs.map +1 -0
  67. package/dist/{chunk-FJMPR3OH.cjs → chunk-7EO3TCQB.cjs} +33 -7
  68. package/dist/chunk-7EO3TCQB.cjs.map +1 -0
  69. package/dist/{chunk-DXEEHSGN.js → chunk-7VQXLT5O.js} +436 -43
  70. package/dist/chunk-7VQXLT5O.js.map +1 -0
  71. package/dist/chunk-A4OC4DVN.cjs +12 -0
  72. package/dist/{chunk-4SZ6XPTG.cjs.map → chunk-A4OC4DVN.cjs.map} +1 -1
  73. package/dist/{chunk-TDXIBCGY.cjs → chunk-A7J2YDDI.cjs} +5 -3
  74. package/dist/chunk-A7J2YDDI.cjs.map +1 -0
  75. package/dist/{chunk-55ITBQJI.js → chunk-AKLS3BYZ.js} +56 -5
  76. package/dist/chunk-AKLS3BYZ.js.map +1 -0
  77. package/dist/{chunk-D7PG5D5K.js → chunk-AMKPPFUO.js} +32 -6
  78. package/dist/chunk-AMKPPFUO.js.map +1 -0
  79. package/dist/{chunk-WUFASQUO.js → chunk-ASTI57H3.js} +3 -3
  80. package/dist/{chunk-WUFASQUO.js.map → chunk-ASTI57H3.js.map} +1 -1
  81. package/dist/{chunk-4QIKLIGG.js → chunk-BKCUOV7A.js} +15 -5
  82. package/dist/chunk-BKCUOV7A.js.map +1 -0
  83. package/dist/{chunk-JQXSZHF2.cjs → chunk-BSFJMMV3.cjs} +134 -7
  84. package/dist/chunk-BSFJMMV3.cjs.map +1 -0
  85. package/dist/{chunk-4GUTQPVO.js → chunk-C23WSN5E.js} +185 -24
  86. package/dist/chunk-C23WSN5E.js.map +1 -0
  87. package/dist/{chunk-QLUXRWKL.js → chunk-CBTIUB76.js} +3 -3
  88. package/dist/{chunk-QLUXRWKL.js.map → chunk-CBTIUB76.js.map} +1 -1
  89. package/dist/chunk-CMWHLBVN.cjs +2082 -0
  90. package/dist/chunk-CMWHLBVN.cjs.map +1 -0
  91. package/dist/{chunk-QB6VMOJ2.cjs → chunk-CXBHOOIQ.cjs} +45 -10
  92. package/dist/chunk-CXBHOOIQ.cjs.map +1 -0
  93. package/dist/{chunk-FL5UQRES.js → chunk-DCQVHAYQ.js} +5 -5
  94. package/dist/{chunk-FL5UQRES.js.map → chunk-DCQVHAYQ.js.map} +1 -1
  95. package/dist/chunk-DTVWX77L.cjs +3432 -0
  96. package/dist/chunk-DTVWX77L.cjs.map +1 -0
  97. package/dist/chunk-DYATYRY4.js +47 -0
  98. package/dist/chunk-DYATYRY4.js.map +1 -0
  99. package/dist/chunk-E4WNQBEF.cjs +217 -0
  100. package/dist/chunk-E4WNQBEF.cjs.map +1 -0
  101. package/dist/{chunk-G6Q5UM7U.js → chunk-FWJKWH6U.js} +5 -3
  102. package/dist/chunk-FWJKWH6U.js.map +1 -0
  103. package/dist/chunk-GF3KXUTW.js +3393 -0
  104. package/dist/chunk-GF3KXUTW.js.map +1 -0
  105. package/dist/{chunk-VTN3C3CH.js → chunk-HFHTMECK.js} +7 -7
  106. package/dist/{chunk-VTN3C3CH.js.map → chunk-HFHTMECK.js.map} +1 -1
  107. package/dist/{chunk-FLEQ2HBK.js → chunk-I5MOXA4H.js} +20 -14
  108. package/dist/chunk-I5MOXA4H.js.map +1 -0
  109. package/dist/{chunk-4MB3AQAQ.js → chunk-J3WZ3FA2.js} +77 -3
  110. package/dist/chunk-J3WZ3FA2.js.map +1 -0
  111. package/dist/{chunk-UR7W5YQK.js → chunk-JBQQ7THH.js} +5 -3
  112. package/dist/chunk-JBQQ7THH.js.map +1 -0
  113. package/dist/{chunk-TKP5T34P.js → chunk-JXA2ZP2Q.js} +6 -16
  114. package/dist/chunk-JXA2ZP2Q.js.map +1 -0
  115. package/dist/{chunk-GYA4JRP5.js → chunk-JXXDZTMN.js} +2 -2
  116. package/dist/chunk-JXXDZTMN.js.map +1 -0
  117. package/dist/chunk-JZUR7ZWE.js +254 -0
  118. package/dist/chunk-JZUR7ZWE.js.map +1 -0
  119. package/dist/{chunk-42PYUGLS.js → chunk-K5ELX2GT.js} +108 -8
  120. package/dist/chunk-K5ELX2GT.js.map +1 -0
  121. package/dist/{chunk-Q6EDCUXV.js → chunk-L65OU2U3.js} +556 -204
  122. package/dist/chunk-L65OU2U3.js.map +1 -0
  123. package/dist/{chunk-D54WH24V.cjs → chunk-LBJKZXDE.cjs} +115 -13
  124. package/dist/chunk-LBJKZXDE.cjs.map +1 -0
  125. package/dist/{chunk-FQ7ZPOTZ.js → chunk-LGHCOKTT.js} +637 -493
  126. package/dist/chunk-LGHCOKTT.js.map +1 -0
  127. package/dist/chunk-M3WP7RQZ.js +736 -0
  128. package/dist/chunk-M3WP7RQZ.js.map +1 -0
  129. package/dist/{chunk-4MEWSUVM.cjs → chunk-M4BDU5RX.cjs} +12 -12
  130. package/dist/chunk-M4BDU5RX.cjs.map +1 -0
  131. package/dist/chunk-MCLYU6BN.cjs +332 -0
  132. package/dist/chunk-MCLYU6BN.cjs.map +1 -0
  133. package/dist/{chunk-MIJKEVV7.js → chunk-MSY7FSX4.js} +37 -4
  134. package/dist/chunk-MSY7FSX4.js.map +1 -0
  135. package/dist/{chunk-H7VE3FL4.cjs → chunk-MUK4BU7K.cjs} +519 -125
  136. package/dist/chunk-MUK4BU7K.cjs.map +1 -0
  137. package/dist/{chunk-D56XG4EI.cjs → chunk-MXJDTH5B.cjs} +56 -45
  138. package/dist/chunk-MXJDTH5B.cjs.map +1 -0
  139. package/dist/{chunk-5EKPX6QU.js → chunk-MZLPX2R7.js} +8 -9
  140. package/dist/chunk-MZLPX2R7.js.map +1 -0
  141. package/dist/chunk-N66HCGCY.cjs +57 -0
  142. package/dist/chunk-N66HCGCY.cjs.map +1 -0
  143. package/dist/{chunk-CPEL3YIR.cjs → chunk-NFCVHQ5P.cjs} +55 -22
  144. package/dist/chunk-NFCVHQ5P.cjs.map +1 -0
  145. package/dist/{chunk-C4F7VJ5D.cjs → chunk-NI72YOJB.cjs} +84 -2
  146. package/dist/chunk-NI72YOJB.cjs.map +1 -0
  147. package/dist/{chunk-BNS75YNF.cjs → chunk-NK5Q7UNE.cjs} +10 -20
  148. package/dist/chunk-NK5Q7UNE.cjs.map +1 -0
  149. package/dist/{chunk-TKORQCG4.js → chunk-NLI2AVEF.js} +386 -862
  150. package/dist/chunk-NLI2AVEF.js.map +1 -0
  151. package/dist/{chunk-YMTXMPV6.js → chunk-NMWDXFPH.js} +4 -4
  152. package/dist/{chunk-YMTXMPV6.js.map → chunk-NMWDXFPH.js.map} +1 -1
  153. package/dist/{chunk-J7LXTUTP.cjs → chunk-PF6F5NLJ.cjs} +604 -1094
  154. package/dist/chunk-PF6F5NLJ.cjs.map +1 -0
  155. package/dist/{chunk-NAAMUYMS.cjs → chunk-PNN7RHVR.cjs} +58 -48
  156. package/dist/chunk-PNN7RHVR.cjs.map +1 -0
  157. package/dist/{chunk-YOALGKRE.cjs → chunk-PNTCATDE.cjs} +3528 -1763
  158. package/dist/chunk-PNTCATDE.cjs.map +1 -0
  159. package/dist/{chunk-6DCB664D.js → chunk-PQBQG7IM.js} +3 -3
  160. package/dist/{chunk-6DCB664D.js.map → chunk-PQBQG7IM.js.map} +1 -1
  161. package/dist/{chunk-UCQ3BFSY.cjs → chunk-PT7RIRIZ.cjs} +684 -332
  162. package/dist/chunk-PT7RIRIZ.cjs.map +1 -0
  163. package/dist/{chunk-ACSVZPK7.cjs → chunk-PWLJ77UV.cjs} +5 -3
  164. package/dist/chunk-PWLJ77UV.cjs.map +1 -0
  165. package/dist/chunk-Q3G6A4I3.cjs +755 -0
  166. package/dist/chunk-Q3G6A4I3.cjs.map +1 -0
  167. package/dist/{chunk-Z3WO6MND.cjs → chunk-RMQLSPA2.cjs} +297 -27
  168. package/dist/chunk-RMQLSPA2.cjs.map +1 -0
  169. package/dist/{chunk-SJDMVITW.cjs → chunk-RT5ZY4XA.cjs} +6 -5
  170. package/dist/chunk-RT5ZY4XA.cjs.map +1 -0
  171. package/dist/{chunk-ID4WXTKL.js → chunk-S6PW7VV5.js} +2382 -617
  172. package/dist/chunk-S6PW7VV5.js.map +1 -0
  173. package/dist/{chunk-4GUBTVPV.js → chunk-T4XNKYXB.js} +780 -126
  174. package/dist/chunk-T4XNKYXB.js.map +1 -0
  175. package/dist/{chunk-YDWLUT5V.cjs → chunk-TQR4KBY2.cjs} +323 -178
  176. package/dist/chunk-TQR4KBY2.cjs.map +1 -0
  177. package/dist/{chunk-OOA273IJ.cjs → chunk-U5SON7R2.cjs} +27 -27
  178. package/dist/{chunk-OOA273IJ.cjs.map → chunk-U5SON7R2.cjs.map} +1 -1
  179. package/dist/{chunk-IX64T5OL.cjs → chunk-U63GDNRC.cjs} +32 -26
  180. package/dist/chunk-U63GDNRC.cjs.map +1 -0
  181. package/dist/{chunk-WDBXJOU5.cjs → chunk-UDISNXDL.cjs} +56 -47
  182. package/dist/chunk-UDISNXDL.cjs.map +1 -0
  183. package/dist/{chunk-EFEOOCJ3.js → chunk-UV3SN74I.js} +5 -5
  184. package/dist/{chunk-EFEOOCJ3.js.map → chunk-UV3SN74I.js.map} +1 -1
  185. package/dist/{chunk-U5W4LKZV.cjs → chunk-VCRRKBLN.cjs} +9 -9
  186. package/dist/{chunk-U5W4LKZV.cjs.map → chunk-VCRRKBLN.cjs.map} +1 -1
  187. package/dist/{chunk-ISLPNELU.js → chunk-VGTJPTIC.js} +16 -5
  188. package/dist/chunk-VGTJPTIC.js.map +1 -0
  189. package/dist/chunk-VLT6PEWR.cjs +60 -0
  190. package/dist/chunk-VLT6PEWR.cjs.map +1 -0
  191. package/dist/chunk-VQH4VAWD.cjs +12 -0
  192. package/dist/{chunk-B3F2D3SP.cjs.map → chunk-VQH4VAWD.cjs.map} +1 -1
  193. package/dist/{chunk-SNXVDZAJ.js → chunk-W6OG3HDG.js} +5 -4
  194. package/dist/chunk-W6OG3HDG.js.map +1 -0
  195. package/dist/chunk-WDGA7IYB.js +207 -0
  196. package/dist/chunk-WDGA7IYB.js.map +1 -0
  197. package/dist/chunk-WQZLUGVR.js +2057 -0
  198. package/dist/chunk-WQZLUGVR.js.map +1 -0
  199. package/dist/{chunk-EKFUG4G7.cjs → chunk-XBYVV3MP.cjs} +60 -5
  200. package/dist/chunk-XBYVV3MP.cjs.map +1 -0
  201. package/dist/{chunk-5GAONX5G.cjs → chunk-XCAGZAKP.cjs} +7 -7
  202. package/dist/{chunk-5GAONX5G.cjs.map → chunk-XCAGZAKP.cjs.map} +1 -1
  203. package/dist/chunk-XL7SLCXS.js +309 -0
  204. package/dist/chunk-XL7SLCXS.js.map +1 -0
  205. package/dist/{chunk-SVJ5GEXW.cjs → chunk-XUO3KQFO.cjs} +2 -2
  206. package/dist/chunk-XUO3KQFO.cjs.map +1 -0
  207. package/dist/{chunk-F4NHQHEZ.cjs → chunk-YAAM3M2S.cjs} +10 -10
  208. package/dist/{chunk-F4NHQHEZ.cjs.map → chunk-YAAM3M2S.cjs.map} +1 -1
  209. package/dist/{chunk-RUQS6M7G.js → chunk-YBFHZUXX.js} +6 -6
  210. package/dist/chunk-YBFHZUXX.js.map +1 -0
  211. package/dist/{chunk-KMXWZLQX.cjs → chunk-YBQOHKHN.cjs} +99 -100
  212. package/dist/chunk-YBQOHKHN.cjs.map +1 -0
  213. package/dist/{chunk-PVUI6KGR.js → chunk-YDFDBE6D.js} +93 -6
  214. package/dist/chunk-YDFDBE6D.js.map +1 -0
  215. package/dist/{chunk-P7GTYOLB.cjs → chunk-YVWGEQJE.cjs} +297 -135
  216. package/dist/chunk-YVWGEQJE.cjs.map +1 -0
  217. package/dist/{chunk-QT6V3YRH.js → chunk-YWGVVALJ.js} +3 -3
  218. package/dist/{chunk-QT6V3YRH.js.map → chunk-YWGVVALJ.js.map} +1 -1
  219. package/dist/core/index.cjs +40 -40
  220. package/dist/core/index.d.cts +4 -5
  221. package/dist/core/index.d.ts +4 -5
  222. package/dist/core/index.js +8 -8
  223. package/dist/{ddl-BG4J805L.d.cts → ddl-BJcOp4WZ.d.cts} +3 -3
  224. package/dist/{ddl-CgiS9QLj.d.ts → ddl-BXfGHbPN.d.ts} +3 -3
  225. package/dist/graph-extension/index.cjs +26 -22
  226. package/dist/graph-extension/index.d.cts +16 -6
  227. package/dist/graph-extension/index.d.ts +16 -6
  228. package/dist/graph-extension/index.js +7 -7
  229. package/dist/graph-merge/index.cjs +2459 -654
  230. package/dist/graph-merge/index.cjs.map +1 -1
  231. package/dist/graph-merge/index.d.cts +170 -33
  232. package/dist/graph-merge/index.d.ts +170 -33
  233. package/dist/graph-merge/index.js +2269 -467
  234. package/dist/graph-merge/index.js.map +1 -1
  235. package/dist/{index-C3y_98iN.d.cts → index-BSHvKfok.d.ts} +221 -10
  236. package/dist/{index-BBxZCUdu.d.ts → index-DxaYCv8Y.d.cts} +221 -10
  237. package/dist/index.cjs +330 -268
  238. package/dist/index.cjs.map +1 -1
  239. package/dist/index.d.cts +590 -576
  240. package/dist/index.d.ts +590 -576
  241. package/dist/index.js +73 -49
  242. package/dist/index.js.map +1 -1
  243. package/dist/indexes/index.cjs +17 -17
  244. package/dist/indexes/index.d.cts +4 -4
  245. package/dist/indexes/index.d.ts +4 -4
  246. package/dist/indexes/index.js +10 -10
  247. package/dist/interchange/index.cjs +165 -51
  248. package/dist/interchange/index.cjs.map +1 -1
  249. package/dist/interchange/index.d.cts +261 -16
  250. package/dist/interchange/index.d.ts +261 -16
  251. package/dist/interchange/index.js +128 -25
  252. package/dist/interchange/index.js.map +1 -1
  253. package/dist/{manager-YoLEfcc1.d.ts → manager-CfZAimti.d.ts} +36 -5
  254. package/dist/{manager-KS7CGQQT.d.cts → manager-HGk6E_HW.d.cts} +36 -5
  255. package/dist/{materialize-indexes-Bhhyb1B3.d.ts → materialize-indexes-6A7dWGtb.d.cts} +10 -2
  256. package/dist/{materialize-indexes-OHRWypW6.d.cts → materialize-indexes-BMJP6Tms.d.ts} +10 -2
  257. package/dist/{postgres-DpkW3R5Y.d.cts → postgres-DFYWENdR.d.cts} +1961 -439
  258. package/dist/{postgres-DwqyIniy.d.ts → postgres-e7a9TdvR.d.ts} +1961 -439
  259. package/dist/profiler/index.cjs +15 -15
  260. package/dist/profiler/index.d.cts +9 -10
  261. package/dist/profiler/index.d.ts +9 -10
  262. package/dist/profiler/index.js +4 -4
  263. package/dist/provenance/index.cjs +46 -48
  264. package/dist/provenance/index.cjs.map +1 -1
  265. package/dist/provenance/index.d.cts +7 -7
  266. package/dist/provenance/index.d.ts +7 -7
  267. package/dist/provenance/index.js +12 -14
  268. package/dist/provenance/index.js.map +1 -1
  269. package/dist/schema/index.cjs +50 -48
  270. package/dist/schema/index.d.cts +9 -16
  271. package/dist/schema/index.d.ts +9 -16
  272. package/dist/schema/index.js +23 -21
  273. package/dist/{searchable-DLWEfC4a.d.ts → searchable-9OQoPuRs.d.ts} +1 -2
  274. package/dist/{searchable-CIZL8Hyw.d.cts → searchable-CIje5XYD.d.cts} +1 -2
  275. package/dist/{sqlite-DY0WODUK.d.cts → sqlite-DerU5tc7.d.ts} +2029 -347
  276. package/dist/{sqlite-L-VIRzqA.d.ts → sqlite-DitnISa9.d.cts} +2029 -347
  277. package/dist/{store-view-A85FFRnk.d.cts → store-B0h6x7wo.d.cts} +1289 -767
  278. package/dist/{store-view-66p92IPi.d.ts → store-ClQ-MZQS.d.ts} +1289 -767
  279. package/dist/{temporal-BNbjXqer.d.cts → temporal-Bn-Fi8FJ.d.cts} +1 -1
  280. package/dist/{temporal-Bob6Nfbp.d.ts → temporal-BtM4UALv.d.ts} +1 -1
  281. package/dist/{types-DeORZhxn.d.cts → types-CoIx8HX5.d.cts} +1 -1
  282. package/dist/{types-Ch9a0Dx6.d.ts → types-HkveCCx0.d.cts} +726 -5
  283. package/dist/{types-Ch9a0Dx6.d.cts → types-HkveCCx0.d.ts} +726 -5
  284. package/dist/{types-ClCzT-dT.d.ts → types-KFfk-8Ah.d.ts} +1 -1
  285. package/dist/{where-DPw52ksb.d.cts → where--fk7_0kv.d.cts} +1 -1
  286. package/dist/{where-kWUZPvEA.d.ts → where-ws5hf-Ov.d.ts} +1 -1
  287. package/package.json +3 -3
  288. package/dist/chunk-2L54C2C2.js +0 -144
  289. package/dist/chunk-2L54C2C2.js.map +0 -1
  290. package/dist/chunk-35S6P5ZU.js +0 -27
  291. package/dist/chunk-35S6P5ZU.js.map +0 -1
  292. package/dist/chunk-42PYUGLS.js.map +0 -1
  293. package/dist/chunk-4GUBTVPV.js.map +0 -1
  294. package/dist/chunk-4GUTQPVO.js.map +0 -1
  295. package/dist/chunk-4MB3AQAQ.js.map +0 -1
  296. package/dist/chunk-4MEWSUVM.cjs.map +0 -1
  297. package/dist/chunk-4QIKLIGG.js.map +0 -1
  298. package/dist/chunk-4SZ6XPTG.cjs +0 -12
  299. package/dist/chunk-55ITBQJI.js.map +0 -1
  300. package/dist/chunk-5EKPX6QU.js.map +0 -1
  301. package/dist/chunk-6RYPD3NJ.cjs +0 -1282
  302. package/dist/chunk-6RYPD3NJ.cjs.map +0 -1
  303. package/dist/chunk-764JHTLT.cjs +0 -15
  304. package/dist/chunk-764JHTLT.cjs.map +0 -1
  305. package/dist/chunk-ACSVZPK7.cjs.map +0 -1
  306. package/dist/chunk-B3F2D3SP.cjs +0 -12
  307. package/dist/chunk-BGYJW37L.js.map +0 -1
  308. package/dist/chunk-BNS75YNF.cjs.map +0 -1
  309. package/dist/chunk-C4F7VJ5D.cjs.map +0 -1
  310. package/dist/chunk-CBKG6HEP.js +0 -1263
  311. package/dist/chunk-CBKG6HEP.js.map +0 -1
  312. package/dist/chunk-CPEL3YIR.cjs.map +0 -1
  313. package/dist/chunk-D54WH24V.cjs.map +0 -1
  314. package/dist/chunk-D56XG4EI.cjs.map +0 -1
  315. package/dist/chunk-D7PG5D5K.js.map +0 -1
  316. package/dist/chunk-DI74SMXS.cjs +0 -29
  317. package/dist/chunk-DI74SMXS.cjs.map +0 -1
  318. package/dist/chunk-DK2S42XB.js +0 -77
  319. package/dist/chunk-DK2S42XB.js.map +0 -1
  320. package/dist/chunk-DRACN6XG.js +0 -27
  321. package/dist/chunk-DRACN6XG.js.map +0 -1
  322. package/dist/chunk-DXEEHSGN.js.map +0 -1
  323. package/dist/chunk-EKFUG4G7.cjs.map +0 -1
  324. package/dist/chunk-EQ7JKLZO.cjs +0 -157
  325. package/dist/chunk-EQ7JKLZO.cjs.map +0 -1
  326. package/dist/chunk-FJMPR3OH.cjs.map +0 -1
  327. package/dist/chunk-FLEQ2HBK.js.map +0 -1
  328. package/dist/chunk-FQ7ZPOTZ.js.map +0 -1
  329. package/dist/chunk-G6Q5UM7U.js.map +0 -1
  330. package/dist/chunk-GYA4JRP5.js.map +0 -1
  331. package/dist/chunk-H7VE3FL4.cjs.map +0 -1
  332. package/dist/chunk-ID4WXTKL.js.map +0 -1
  333. package/dist/chunk-ISLPNELU.js.map +0 -1
  334. package/dist/chunk-ITE4IXAK.js +0 -25
  335. package/dist/chunk-ITE4IXAK.js.map +0 -1
  336. package/dist/chunk-IX64T5OL.cjs.map +0 -1
  337. package/dist/chunk-J2ICGNHO.cjs.map +0 -1
  338. package/dist/chunk-J7LXTUTP.cjs.map +0 -1
  339. package/dist/chunk-JQXSZHF2.cjs.map +0 -1
  340. package/dist/chunk-JXUTCSXX.cjs.map +0 -1
  341. package/dist/chunk-KCO5EFJU.js +0 -79
  342. package/dist/chunk-KCO5EFJU.js.map +0 -1
  343. package/dist/chunk-KKYELPZ2.cjs +0 -83
  344. package/dist/chunk-KKYELPZ2.cjs.map +0 -1
  345. package/dist/chunk-KMXWZLQX.cjs.map +0 -1
  346. package/dist/chunk-MIJKEVV7.js.map +0 -1
  347. package/dist/chunk-NAAMUYMS.cjs.map +0 -1
  348. package/dist/chunk-P7GTYOLB.cjs.map +0 -1
  349. package/dist/chunk-PVUI6KGR.js.map +0 -1
  350. package/dist/chunk-Q6EDCUXV.js.map +0 -1
  351. package/dist/chunk-QB6VMOJ2.cjs.map +0 -1
  352. package/dist/chunk-QC4MCOFV.cjs +0 -83
  353. package/dist/chunk-QC4MCOFV.cjs.map +0 -1
  354. package/dist/chunk-QMQLUA66.js +0 -12
  355. package/dist/chunk-QMQLUA66.js.map +0 -1
  356. package/dist/chunk-QRNYDV5Z.js.map +0 -1
  357. package/dist/chunk-RFRM3Q5K.js.map +0 -1
  358. package/dist/chunk-RUQS6M7G.js.map +0 -1
  359. package/dist/chunk-S4KQ5LV4.js.map +0 -1
  360. package/dist/chunk-SJDMVITW.cjs.map +0 -1
  361. package/dist/chunk-SNXVDZAJ.js.map +0 -1
  362. package/dist/chunk-SVJ5GEXW.cjs.map +0 -1
  363. package/dist/chunk-TDXIBCGY.cjs.map +0 -1
  364. package/dist/chunk-TKORQCG4.js.map +0 -1
  365. package/dist/chunk-TKP5T34P.js.map +0 -1
  366. package/dist/chunk-TRF4EBJT.cjs +0 -30
  367. package/dist/chunk-TRF4EBJT.cjs.map +0 -1
  368. package/dist/chunk-UCQ3BFSY.cjs.map +0 -1
  369. package/dist/chunk-UR7W5YQK.js.map +0 -1
  370. package/dist/chunk-V34A6R5V.js +0 -134
  371. package/dist/chunk-V34A6R5V.js.map +0 -1
  372. package/dist/chunk-WDAVPX46.js +0 -81
  373. package/dist/chunk-WDAVPX46.js.map +0 -1
  374. package/dist/chunk-WDBXJOU5.cjs.map +0 -1
  375. package/dist/chunk-YDWLUT5V.cjs.map +0 -1
  376. package/dist/chunk-YOALGKRE.cjs.map +0 -1
  377. package/dist/chunk-Z3WO6MND.cjs.map +0 -1
  378. package/dist/chunk-ZDH3DX3C.cjs +0 -30
  379. package/dist/chunk-ZDH3DX3C.cjs.map +0 -1
  380. package/dist/chunk-ZI6VQSZA.cjs.map +0 -1
  381. package/dist/chunk-ZTAJL4DT.cjs +0 -85
  382. package/dist/chunk-ZTAJL4DT.cjs.map +0 -1
  383. package/dist/define-graph-BGrJahvp.d.ts +0 -173
  384. package/dist/define-graph-alREY2wj.d.cts +0 -173
@@ -1,17 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkF4NHQHEZ_cjs = require('./chunk-F4NHQHEZ.cjs');
4
- var chunkZ3WO6MND_cjs = require('./chunk-Z3WO6MND.cjs');
5
- var chunkOOA273IJ_cjs = require('./chunk-OOA273IJ.cjs');
6
- var chunkZDH3DX3C_cjs = require('./chunk-ZDH3DX3C.cjs');
7
- var chunkEKFUG4G7_cjs = require('./chunk-EKFUG4G7.cjs');
8
- var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
9
- var chunkJQXSZHF2_cjs = require('./chunk-JQXSZHF2.cjs');
3
+ var chunkYAAM3M2S_cjs = require('./chunk-YAAM3M2S.cjs');
4
+ var chunkRMQLSPA2_cjs = require('./chunk-RMQLSPA2.cjs');
5
+ var chunkU5SON7R2_cjs = require('./chunk-U5SON7R2.cjs');
6
+ var chunkPWLJ77UV_cjs = require('./chunk-PWLJ77UV.cjs');
7
+ var chunkBSFJMMV3_cjs = require('./chunk-BSFJMMV3.cjs');
8
+ var chunkXBYVV3MP_cjs = require('./chunk-XBYVV3MP.cjs');
10
9
  var chunkZY4GXIVN_cjs = require('./chunk-ZY4GXIVN.cjs');
11
- var chunkJXUTCSXX_cjs = require('./chunk-JXUTCSXX.cjs');
12
- var chunkU5W4LKZV_cjs = require('./chunk-U5W4LKZV.cjs');
13
- var chunk764JHTLT_cjs = require('./chunk-764JHTLT.cjs');
14
- var chunkC4F7VJ5D_cjs = require('./chunk-C4F7VJ5D.cjs');
10
+ var chunk4UGOKMI5_cjs = require('./chunk-4UGOKMI5.cjs');
11
+ var chunkVCRRKBLN_cjs = require('./chunk-VCRRKBLN.cjs');
12
+ var chunkNI72YOJB_cjs = require('./chunk-NI72YOJB.cjs');
13
+ var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
15
14
  var drizzleOrm = require('drizzle-orm');
16
15
 
17
16
  // src/backend/edge-endpoint-sets.ts
@@ -21,7 +20,7 @@ function assertLimitPerEndpoint(operation, graphId, limitPerEndpoint, kind) {
21
20
  if (limitPerEndpoint === void 0 || Number.isInteger(limitPerEndpoint) && limitPerEndpoint > 0) {
22
21
  return;
23
22
  }
24
- throw new chunkC4F7VJ5D_cjs.ConfigurationError(
23
+ throw new chunkNI72YOJB_cjs.ConfigurationError(
25
24
  `${operation} \`limitPerEndpoint\` must be a positive integer, received ${String(limitPerEndpoint)}.`,
26
25
  {
27
26
  code: "EDGE_ENDPOINT_SET_INVALID",
@@ -65,7 +64,7 @@ function resolveHeterogeneousEdgeRead(params, maxBindParameters) {
65
64
  if (endpointChunkSize >= 1) {
66
65
  return { edgeKinds, endpoints, endpointChunkSize };
67
66
  }
68
- throw new chunkC4F7VJ5D_cjs.ConfigurationError(
67
+ throw new chunkNI72YOJB_cjs.ConfigurationError(
69
68
  "findEdgesByHeterogeneousEndpointSet cannot fit one endpoint and the selected edge kinds within the backend bind-parameter budget.",
70
69
  {
71
70
  code: "EDGE_HETEROGENEOUS_READ_BIND_BUDGET_EXCEEDED",
@@ -81,8 +80,8 @@ function resolveHeterogeneousEdgeRead(params, maxBindParameters) {
81
80
 
82
81
  // src/backend/live-node-candidates.ts
83
82
  function buildLiveNodeCandidates(nodesTableName, graphId, nodeKind, now) {
84
- const nodes = chunkU5W4LKZV_cjs.sql.identifier(nodesTableName);
85
- return chunkU5W4LKZV_cjs.sql`
83
+ const nodes = chunkVCRRKBLN_cjs.sql.identifier(nodesTableName);
84
+ return chunkVCRRKBLN_cjs.sql`
86
85
  SELECT "id" AS node_id
87
86
  FROM ${nodes}
88
87
  WHERE "graph_id" = ${graphId}
@@ -123,10 +122,10 @@ function vectorSlotFromDropIndexParams(params) {
123
122
  };
124
123
  }
125
124
  function mapVectorWriteError(error, params) {
126
- const mismatch = chunkJQXSZHF2_cjs.parseDimensionMismatch(error);
125
+ const mismatch = chunkBSFJMMV3_cjs.parseDimensionMismatch(error);
127
126
  if (mismatch === void 0) return error;
128
127
  const attempted = mismatch.actual ?? "a different number of";
129
- return new chunkC4F7VJ5D_cjs.EmbeddingDimensionChangedError(
128
+ return new chunkNI72YOJB_cjs.EmbeddingDimensionChangedError(
130
129
  `Embedding "${params.nodeKind}.${params.fieldPath}" was written with ${attempted} dimensions, but its per-field storage expects ${mismatch.expected}. The field's embedding dimension changed; existing vectors must be recreated and re-embedded.`,
131
130
  {
132
131
  kind: params.nodeKind,
@@ -142,7 +141,7 @@ var SQLITE_CONTRIBUTION_MAT_TIMESTAMPS = {
142
141
  encode: (value) => value
143
142
  };
144
143
  var POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = {
145
- decode: chunkF4NHQHEZ_cjs.formatPostgresTimestamp,
144
+ decode: chunkYAAM3M2S_cjs.formatPostgresTimestamp,
146
145
  encode: (value) => new Date(value)
147
146
  };
148
147
  function mapContributionMaterializationRow(row, decode) {
@@ -192,7 +191,7 @@ function contributionSignatureInput(dialect, identity, createDdl) {
192
191
  tableName: identity.tableName,
193
192
  createDdl
194
193
  };
195
- return JSON.stringify(hashable, chunkACSVZPK7_cjs.sortedReplacer);
194
+ return JSON.stringify(hashable, chunkPWLJ77UV_cjs.sortedReplacer);
196
195
  }
197
196
  function evaluateContributionState(row, signature) {
198
197
  if (row === void 0) return "missing";
@@ -227,6 +226,20 @@ function diagnoseContribution(row, signature, tableExists) {
227
226
  }
228
227
  }
229
228
  }
229
+ var PROBE_PROJECTION_ORDER = [
230
+ "fulltext",
231
+ "vector"
232
+ ];
233
+ var PROBE_DETAIL_PHRASE = {
234
+ "orphaned-marker": "storage is missing",
235
+ "missing-marker": "storage is not attested by a durable marker",
236
+ "failed-materialization": "provisioning failed and produced no storage",
237
+ stale: "storage exists at a different shape than the current declaration"
238
+ };
239
+ function describeProbeDiagnostic(diagnostic) {
240
+ const subject = diagnostic.kind === void 0 || diagnostic.fieldPath === void 0 ? `table "${diagnostic.physicalName}"` : `${diagnostic.kind}.${diagnostic.fieldPath}`;
241
+ return `${subject}: ${PROBE_DETAIL_PHRASE[diagnostic.state]} (${diagnostic.state})`;
242
+ }
230
243
  function identityOf(graphId, contribution) {
231
244
  return {
232
245
  graphId,
@@ -282,11 +295,18 @@ function gateFulltextMethods(source, assert) {
282
295
  return gated;
283
296
  }
284
297
  function gateFulltext(tx, assert) {
285
- return chunkEKFUG4G7_cjs.createBackendOverlay(
298
+ return chunkXBYVV3MP_cjs.createBackendOverlay(
286
299
  tx,
287
300
  gateFulltextMethods(tx, assert)
288
301
  );
289
302
  }
303
+ function contributionRebuildSupported(fulltextStrategy, fulltextTableName, transactional) {
304
+ return transactional && chunkRMQLSPA2_cjs.runtimeStrategyContributions(fulltextStrategy, fulltextTableName).every(
305
+ (contribution) => contribution.dropDdl !== void 0
306
+ );
307
+ }
308
+ var CONTRIBUTION_DDL_LOCK_KEY = "typegraph:contribution-ddl";
309
+ var FOREIGN_GRAPH_REPORT_LIMIT = 5;
290
310
  var CONTRIBUTION_KEY_SEPARATOR = String.fromCodePoint(0);
291
311
  function contributionKey(graphId, contribution) {
292
312
  return [
@@ -330,7 +350,7 @@ function createContributionMaterializer(deps) {
330
350
  }
331
351
  }
332
352
  function runtimeContributions() {
333
- return chunkZ3WO6MND_cjs.runtimeStrategyContributions(fulltextStrategy, fulltextTableName);
353
+ return chunkRMQLSPA2_cjs.runtimeStrategyContributions(fulltextStrategy, fulltextTableName);
334
354
  }
335
355
  function cacheInitializedSignature(key, signature) {
336
356
  if (!uncacheableKeys.has(key)) {
@@ -356,14 +376,14 @@ function createContributionMaterializer(deps) {
356
376
  );
357
377
  await deps.recordMarker({
358
378
  ...identity,
359
- signature,
360
- attemptedAt: chunkF4NHQHEZ_cjs.nowIso(),
379
+ signature: existing.signature,
380
+ attemptedAt: chunkYAAM3M2S_cjs.nowIso(),
361
381
  materializedAt: void 0,
362
382
  error: error.message
363
383
  });
364
384
  throw error;
365
385
  }
366
- const attemptedAt = chunkF4NHQHEZ_cjs.nowIso();
386
+ const attemptedAt = chunkYAAM3M2S_cjs.nowIso();
367
387
  try {
368
388
  for (const statement of contribution.createDdl) {
369
389
  await deps.execDdl(statement);
@@ -399,7 +419,7 @@ function createContributionMaterializer(deps) {
399
419
  rows: indexMarkerRows(graphId, await deps.getMarkers(graphId))
400
420
  };
401
421
  } catch (error) {
402
- if (!chunkJQXSZHF2_cjs.isMissingTableError(error)) throw error;
422
+ if (!chunkBSFJMMV3_cjs.isMissingTableError(error)) throw error;
403
423
  return { kind: "missing-table", error };
404
424
  }
405
425
  }
@@ -478,7 +498,7 @@ function createContributionMaterializer(deps) {
478
498
  if (read.kind === "missing-table") {
479
499
  const first = pending[0];
480
500
  if (first === void 0) return;
481
- throw new chunkC4F7VJ5D_cjs.StoreNotInitializedError(graphId, "missing", {
501
+ throw new chunkNI72YOJB_cjs.StoreNotInitializedError(graphId, "missing", {
482
502
  cause: read.error,
483
503
  details: { logicalName: first.contribution.logicalName }
484
504
  });
@@ -487,7 +507,7 @@ function createContributionMaterializer(deps) {
487
507
  const { contribution, key, signature } = entry;
488
508
  const state = evaluateContributionState(read.rows.get(key), signature);
489
509
  if (state !== "initialized") {
490
- throw new chunkC4F7VJ5D_cjs.StoreNotInitializedError(graphId, state, {
510
+ throw new chunkNI72YOJB_cjs.StoreNotInitializedError(graphId, state, {
491
511
  details: { logicalName: contribution.logicalName }
492
512
  });
493
513
  }
@@ -535,7 +555,7 @@ function createContributionMaterializer(deps) {
535
555
  else existing.push(target);
536
556
  }
537
557
  for (const contribution of runtimeContributions()) {
538
- addTarget(graphId, { contribution });
558
+ addTarget(graphId, { contribution, projection: "fulltext" });
539
559
  }
540
560
  const { vectorStrategy } = deps;
541
561
  if (vectorStrategy !== void 0) {
@@ -543,6 +563,7 @@ function createContributionMaterializer(deps) {
543
563
  for (const contribution of vectorStrategy.ownedTables(slot)) {
544
564
  addTarget(slot.graphId, {
545
565
  contribution,
566
+ projection: "vector",
546
567
  kind: slot.nodeKind,
547
568
  fieldPath: slot.fieldPath
548
569
  });
@@ -551,8 +572,7 @@ function createContributionMaterializer(deps) {
551
572
  }
552
573
  return targets;
553
574
  }
554
- async function diagnoseContributions(graphId, vectorSlots) {
555
- const targetsByGraph = verificationTargetsByGraph(graphId, vectorSlots);
575
+ async function diagnoseTargets(targetsByGraph) {
556
576
  const probes = /* @__PURE__ */ new Map();
557
577
  function tableExists(tableName) {
558
578
  const pending = probes.get(tableName);
@@ -565,7 +585,7 @@ function createContributionMaterializer(deps) {
565
585
  for (const [id, targets] of targetsByGraph) {
566
586
  const read = await readMarkerRows(id);
567
587
  const rows = read.kind === "rows" ? read.rows : /* @__PURE__ */ new Map();
568
- for (const { contribution, kind, fieldPath } of targets) {
588
+ for (const { contribution, projection, kind, fieldPath } of targets) {
569
589
  const key = contributionKey(id, contribution);
570
590
  const row = rows.get(key);
571
591
  const state = diagnoseContribution(
@@ -577,6 +597,7 @@ function createContributionMaterializer(deps) {
577
597
  diagnosed.push({
578
598
  graphId: id,
579
599
  contribution,
600
+ projection,
580
601
  diagnostic: {
581
602
  owner: contribution.owner,
582
603
  logicalName: contribution.logicalName,
@@ -595,14 +616,46 @@ function createContributionMaterializer(deps) {
595
616
  }
596
617
  return diagnosed;
597
618
  }
619
+ async function diagnoseContributions(graphId, vectorSlots) {
620
+ return diagnoseTargets(verificationTargetsByGraph(graphId, vectorSlots));
621
+ }
598
622
  async function verifyContributions(graphId, vectorSlots) {
599
623
  const diagnosed = await diagnoseContributions(graphId, vectorSlots);
600
624
  return diagnosed.map((entry) => entry.diagnostic);
601
625
  }
626
+ async function probeContributions(graphId, vectorSlots) {
627
+ const targetsByGraph = verificationTargetsByGraph(graphId, vectorSlots);
628
+ const declared = /* @__PURE__ */ new Set();
629
+ for (const targets of targetsByGraph.values()) {
630
+ for (const target of targets) declared.add(target.projection);
631
+ }
632
+ const diagnosed = await diagnoseTargets(targetsByGraph);
633
+ const entries = [];
634
+ for (const projection of PROBE_PROJECTION_ORDER) {
635
+ if (!declared.has(projection)) continue;
636
+ const problems = diagnosed.filter(
637
+ (entry) => entry.projection === projection
638
+ );
639
+ if (problems.length === 0) {
640
+ entries.push({ contribution: projection, state: "ready" });
641
+ continue;
642
+ }
643
+ entries.push({
644
+ contribution: projection,
645
+ state: "degraded",
646
+ detail: problems.map((entry) => describeProbeDiagnostic(entry.diagnostic)).join("; ")
647
+ });
648
+ }
649
+ return entries;
650
+ }
602
651
  async function repairContributions(graphId, vectorSlots) {
603
652
  const diagnosed = await diagnoseContributions(graphId, vectorSlots);
604
653
  const results = [];
605
- for (const { graphId: targetGraphId, contribution, diagnostic } of diagnosed) {
654
+ for (const {
655
+ graphId: targetGraphId,
656
+ contribution,
657
+ diagnostic
658
+ } of diagnosed) {
606
659
  if (diagnostic.state === "stale" || diagnostic.state === "orphaned-marker") {
607
660
  results.push({ diagnostic, status: "requires-rebuild" });
608
661
  continue;
@@ -625,6 +678,156 @@ function createContributionMaterializer(deps) {
625
678
  remaining: await verifyContributions(graphId, vectorSlots)
626
679
  };
627
680
  }
681
+ async function lockContributionDdl(tx) {
682
+ if (dialect !== "postgres") return;
683
+ await tx.execute(
684
+ chunkVCRRKBLN_cjs.asCompiledRowsSql(
685
+ chunkVCRRKBLN_cjs.sql`SELECT pg_advisory_xact_lock(hashtext(${CONTRIBUTION_DDL_LOCK_KEY}), 0)`
686
+ )
687
+ );
688
+ }
689
+ async function lockSharedFulltextTable(tx, tableName) {
690
+ if (dialect !== "postgres") return;
691
+ await tx.executeStatement(
692
+ chunkVCRRKBLN_cjs.asCompiledStatementSql(
693
+ chunkVCRRKBLN_cjs.sql`LOCK TABLE ${chunkVCRRKBLN_cjs.sql.identifier(tableName)} IN ACCESS EXCLUSIVE MODE`
694
+ )
695
+ );
696
+ }
697
+ async function readForeignGraphIds(tx, tableName, graphId) {
698
+ const rows = await tx.execute(
699
+ chunkVCRRKBLN_cjs.asCompiledRowsSql(
700
+ chunk4UGOKMI5_cjs.buildForeignFulltextGraphProbe(
701
+ tableName,
702
+ graphId,
703
+ FOREIGN_GRAPH_REPORT_LIMIT
704
+ )
705
+ )
706
+ );
707
+ return rows.map((row) => String(row.graph_id));
708
+ }
709
+ async function rebuildContribution(graphId, scope, repopulate) {
710
+ if (scope === "vector") {
711
+ throw new chunkNI72YOJB_cjs.ContributionRebuildUnsupportedError(
712
+ "vector-source-unavailable",
713
+ { graphId, contribution: scope }
714
+ );
715
+ }
716
+ const contributions = runtimeContributions();
717
+ const withoutTeardown = contributions.find(
718
+ (contribution) => contribution.dropDdl === void 0
719
+ );
720
+ if (withoutTeardown !== void 0) {
721
+ throw new chunkNI72YOJB_cjs.ContributionRebuildUnsupportedError("no-drop-ddl", {
722
+ graphId,
723
+ contribution: scope,
724
+ owner: withoutTeardown.owner,
725
+ logicalName: withoutTeardown.logicalName,
726
+ physicalName: withoutTeardown.tableName
727
+ });
728
+ }
729
+ const fence = deps.schemaWriteTransaction;
730
+ if (fence === void 0) {
731
+ throw new chunkNI72YOJB_cjs.ContributionRebuildUnsupportedError("no-schema-fence", {
732
+ graphId,
733
+ contribution: scope,
734
+ backend: dialect
735
+ });
736
+ }
737
+ const stamps = await Promise.all(
738
+ contributions.map(async (contribution) => {
739
+ const key = contributionKey(graphId, contribution);
740
+ return {
741
+ contribution,
742
+ key,
743
+ signature: await resolveContributionSignature(key, contribution)
744
+ };
745
+ })
746
+ );
747
+ await deps.ensureMarkerTable();
748
+ const markers = indexMarkerRows(graphId, await deps.getMarkers(graphId));
749
+ const sharedTable = deps.fulltextTableName;
750
+ const sharedTableExisted = await deps.tableExists(sharedTable);
751
+ const rebuilt = await fence(graphId, async (tx) => {
752
+ const record = tx.recordContributionMaterialization;
753
+ if (record === void 0) {
754
+ throw new chunkNI72YOJB_cjs.ConfigurationError(
755
+ "rebuildContribution requires a transaction-scoped backend that can write contribution markers; without it the drop, recreate, and stamp could not commit together.",
756
+ {
757
+ backend: dialect,
758
+ capability: "contributions",
759
+ operation: "rebuild"
760
+ }
761
+ );
762
+ }
763
+ await lockContributionDdl(tx);
764
+ const unlockedForeignGraphIds = sharedTableExisted ? await readForeignGraphIds(tx, sharedTable, graphId) : [];
765
+ const mayRecreate = sharedTableExisted && unlockedForeignGraphIds.length === 0;
766
+ if (mayRecreate) await lockSharedFulltextTable(tx, sharedTable);
767
+ const foreignGraphIds = mayRecreate ? await readForeignGraphIds(tx, sharedTable, graphId) : unlockedForeignGraphIds;
768
+ const recreateStorage = mayRecreate && foreignGraphIds.length === 0;
769
+ if (!recreateStorage) {
770
+ const staleStamp = stamps.find(
771
+ ({ key, signature }) => diagnoseContribution(
772
+ markers.get(key),
773
+ signature,
774
+ sharedTableExisted
775
+ ) === "stale"
776
+ );
777
+ if (staleStamp !== void 0) {
778
+ throw new chunkNI72YOJB_cjs.ContributionRebuildUnsupportedError(
779
+ "shared-storage-in-use",
780
+ {
781
+ graphId,
782
+ contribution: scope,
783
+ owner: staleStamp.contribution.owner,
784
+ logicalName: staleStamp.contribution.logicalName,
785
+ physicalName: staleStamp.contribution.tableName,
786
+ otherGraphIds: foreignGraphIds
787
+ }
788
+ );
789
+ }
790
+ }
791
+ for (const { contribution } of stamps) {
792
+ if (recreateStorage) {
793
+ for (const statement of contribution.dropDdl ?? []) {
794
+ await tx.executeSchemaDdl(statement);
795
+ }
796
+ }
797
+ for (const statement of contribution.createDdl) {
798
+ await tx.executeSchemaDdl(statement);
799
+ }
800
+ }
801
+ if (!recreateStorage) {
802
+ await tx.executeStatement(
803
+ chunkVCRRKBLN_cjs.asCompiledStatementSql(
804
+ chunk4UGOKMI5_cjs.buildFulltextGraphDelete(sharedTable, graphId)
805
+ )
806
+ );
807
+ }
808
+ const stats = await repopulate(tx);
809
+ const now = chunkYAAM3M2S_cjs.nowIso();
810
+ for (const { contribution, signature } of stamps) {
811
+ await record({
812
+ ...identityOf(graphId, contribution),
813
+ signature,
814
+ attemptedAt: now,
815
+ materializedAt: now,
816
+ error: void 0
817
+ });
818
+ }
819
+ return {
820
+ rebuilt: stamps.map(({ contribution }) => contribution.tableName),
821
+ processed: stats.processed,
822
+ repopulated: stats.repopulated,
823
+ skipped: stats.skipped
824
+ };
825
+ });
826
+ for (const { key, signature } of stamps) {
827
+ cacheInitializedSignature(key, signature);
828
+ }
829
+ return rebuilt;
830
+ }
628
831
  function evictVectorSlot(slot) {
629
832
  if (deps.vectorStrategy === void 0) return;
630
833
  for (const contribution of deps.vectorStrategy.ownedTables(slot)) {
@@ -654,7 +857,9 @@ function createContributionMaterializer(deps) {
654
857
  dropVectorSlot,
655
858
  evictVectorSlot,
656
859
  verifyContributions,
657
- repairContributions
860
+ repairContributions,
861
+ probeContributions,
862
+ rebuildContribution
658
863
  };
659
864
  }
660
865
  var SQLITE_INDEX_MAT_TIMESTAMPS = {
@@ -662,7 +867,7 @@ var SQLITE_INDEX_MAT_TIMESTAMPS = {
662
867
  encode: (value) => value
663
868
  };
664
869
  var POSTGRES_INDEX_MAT_TIMESTAMPS = {
665
- decode: chunkF4NHQHEZ_cjs.formatPostgresTimestamp,
870
+ decode: chunkYAAM3M2S_cjs.formatPostgresTimestamp,
666
871
  encode: (value) => new Date(value)
667
872
  };
668
873
  function mapMaterializationRow(row, decode) {
@@ -720,7 +925,7 @@ var SQLITE_KIND_REMOVAL_TIMESTAMPS = {
720
925
  encode: (value) => value
721
926
  };
722
927
  var POSTGRES_KIND_REMOVAL_TIMESTAMPS = {
723
- decode: chunkF4NHQHEZ_cjs.formatPostgresTimestamp,
928
+ decode: chunkYAAM3M2S_cjs.formatPostgresTimestamp,
724
929
  encode: (value) => new Date(value)
725
930
  };
726
931
  function mapKindRemovalRow(row, decode) {
@@ -761,6 +966,30 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
761
966
  lastError: drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("last_error")}`
762
967
  };
763
968
  }
969
+ function primaryKeyConstraintNames(relation, keyColumns) {
970
+ return [`${relation}_pkey`, `${relation}_${keyColumns.join("_")}_pk`];
971
+ }
972
+ function nodePrimaryKeyConstraint(nodes) {
973
+ const relation = drizzleOrm.getTableName(nodes);
974
+ return {
975
+ table: relation,
976
+ constraintNames: primaryKeyConstraintNames(relation, [
977
+ nodes.graphId.name,
978
+ nodes.kind.name,
979
+ nodes.id.name
980
+ ])
981
+ };
982
+ }
983
+ function edgePrimaryKeyConstraint(edges) {
984
+ const relation = drizzleOrm.getTableName(edges);
985
+ return {
986
+ table: relation,
987
+ constraintNames: primaryKeyConstraintNames(relation, [
988
+ edges.graphId.name,
989
+ edges.id.name
990
+ ])
991
+ };
992
+ }
764
993
  function sqlNull(value) {
765
994
  return value ?? drizzleOrm.sql.raw("NULL");
766
995
  }
@@ -768,6 +997,11 @@ function resolveValidFrom(validFrom, timestamp) {
768
997
  if (validFrom === null) return void 0;
769
998
  return validFrom ?? timestamp;
770
999
  }
1000
+ function expectedValidFromPredicate(column, expected) {
1001
+ if (expected === void 0) return drizzleOrm.sql.empty();
1002
+ if (expected === null) return drizzleOrm.sql` AND ${column} IS NULL`;
1003
+ return drizzleOrm.sql` AND ${column} = ${expected}`;
1004
+ }
771
1005
  function quotedColumn(column) {
772
1006
  return drizzleOrm.sql.raw(`"${column.name.replaceAll('"', '""')}"`);
773
1007
  }
@@ -887,12 +1121,12 @@ function present(value) {
887
1121
  function mapHybridSearchRow(row, toNodeRow) {
888
1122
  return {
889
1123
  node: toNodeRow(row),
890
- fusedScore: chunkF4NHQHEZ_cjs.coerceNumericScore(row["fused_score"]),
1124
+ fusedScore: chunkYAAM3M2S_cjs.coerceNumericScore(row["fused_score"]),
891
1125
  ...present(row["vector_rank"]) ? { vectorRank: Number(row["vector_rank"]) } : {},
892
- ...present(row["vector_score"]) ? { vectorScore: chunkF4NHQHEZ_cjs.coerceNumericScore(row["vector_score"]) } : {},
1126
+ ...present(row["vector_score"]) ? { vectorScore: chunkYAAM3M2S_cjs.coerceNumericScore(row["vector_score"]) } : {},
893
1127
  ...present(row["fulltext_rank"]) ? { fulltextRank: Number(row["fulltext_rank"]) } : {},
894
1128
  ...present(row["fulltext_score"]) ? {
895
- fulltextScore: chunkF4NHQHEZ_cjs.coerceNumericScore(
1129
+ fulltextScore: chunkYAAM3M2S_cjs.coerceNumericScore(
896
1130
  row["fulltext_score"]
897
1131
  )
898
1132
  } : {},
@@ -900,9 +1134,16 @@ function mapHybridSearchRow(row, toNodeRow) {
900
1134
  };
901
1135
  }
902
1136
  function buildClearGraph(tables, graphId) {
903
- const fulltext = quotedTableName(tables.fulltextTableName);
904
1137
  return [
905
- { query: drizzleOrm.sql`DELETE FROM ${fulltext} WHERE "graph_id" = ${graphId}` },
1138
+ // The fulltext table is shared by every graph in the database, so its
1139
+ // graph-scoped delete is owned by one builder the destructive
1140
+ // contribution rebuild calls too — see `buildFulltextGraphDelete`.
1141
+ { query: chunk4UGOKMI5_cjs.buildFulltextGraphDelete(tables.fulltextTableName, graphId) },
1142
+ {
1143
+ query: drizzleOrm.sql`DELETE FROM ${tables.recordedIdentityAssertions} WHERE ${tables.recordedIdentityAssertions.graphId} = ${graphId}`,
1144
+ ignoreMissingTable: true,
1145
+ requiredTableName: drizzleOrm.getTableName(tables.recordedIdentityAssertions)
1146
+ },
906
1147
  {
907
1148
  query: drizzleOrm.sql`DELETE FROM ${tables.recordedEdges} WHERE ${tables.recordedEdges.graphId} = ${graphId}`,
908
1149
  ignoreMissingTable: true,
@@ -918,6 +1159,21 @@ function buildClearGraph(tables, graphId) {
918
1159
  ignoreMissingTable: true,
919
1160
  requiredTableName: drizzleOrm.getTableName(tables.recordedClock)
920
1161
  },
1162
+ {
1163
+ query: drizzleOrm.sql`DELETE FROM ${tables.identitySeparation} WHERE ${tables.identitySeparation.graphId} = ${graphId}`,
1164
+ ignoreMissingTable: true,
1165
+ requiredTableName: drizzleOrm.getTableName(tables.identitySeparation)
1166
+ },
1167
+ {
1168
+ query: drizzleOrm.sql`DELETE FROM ${tables.identityClosure} WHERE ${tables.identityClosure.graphId} = ${graphId}`,
1169
+ ignoreMissingTable: true,
1170
+ requiredTableName: drizzleOrm.getTableName(tables.identityClosure)
1171
+ },
1172
+ {
1173
+ query: drizzleOrm.sql`DELETE FROM ${tables.identityAssertions} WHERE ${tables.identityAssertions.graphId} = ${graphId}`,
1174
+ ignoreMissingTable: true,
1175
+ requiredTableName: drizzleOrm.getTableName(tables.identityAssertions)
1176
+ },
921
1177
  {
922
1178
  query: drizzleOrm.sql`DELETE FROM ${tables.uniques} WHERE ${tables.uniques.graphId} = ${graphId}`
923
1179
  },
@@ -1254,6 +1510,17 @@ function buildGetEdges(tables, graphId, ids) {
1254
1510
  )})
1255
1511
  `;
1256
1512
  }
1513
+ function expectedIdentityPredicate(tables, expected) {
1514
+ const { edges } = tables;
1515
+ const parts = [
1516
+ expected.kind === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.kind} = ${expected.kind}`,
1517
+ expected.fromKind === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.fromKind} = ${expected.fromKind}`,
1518
+ expected.fromId === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.fromId} = ${expected.fromId}`,
1519
+ expected.toKind === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.toKind} = ${expected.toKind}`,
1520
+ expected.toId === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.toId} = ${expected.toId}`
1521
+ ].filter((part) => part !== void 0);
1522
+ return parts.length === 0 ? drizzleOrm.sql.empty() : drizzleOrm.sql.join(parts, drizzleOrm.sql``);
1523
+ }
1257
1524
  function buildUpdateEdge(tables, params, timestamp) {
1258
1525
  const { edges } = tables;
1259
1526
  const propsJson = JSON.stringify(params.props);
@@ -1261,19 +1528,29 @@ function buildUpdateEdge(tables, params, timestamp) {
1261
1528
  drizzleOrm.sql`${quotedColumn(edges.props)} = ${propsJson}`,
1262
1529
  drizzleOrm.sql`${quotedColumn(edges.updatedAt)} = ${timestamp}`
1263
1530
  ];
1264
- if (params.validTo !== void 0) {
1531
+ if (params.clearDeleted && params.validFrom !== void 0) {
1532
+ setParts.push(
1533
+ drizzleOrm.sql`${quotedColumn(edges.validFrom)} = ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}`,
1534
+ drizzleOrm.sql`${quotedColumn(edges.validTo)} = ${sqlNull(params.validTo)}`
1535
+ );
1536
+ } else if (params.validTo !== void 0) {
1265
1537
  setParts.push(drizzleOrm.sql`${quotedColumn(edges.validTo)} = ${params.validTo}`);
1266
1538
  }
1267
1539
  if (params.clearDeleted) {
1268
1540
  setParts.push(drizzleOrm.sql`${quotedColumn(edges.deletedAt)} = NULL`);
1269
1541
  }
1270
1542
  const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
1543
+ const expectedIdentity = expectedIdentityPredicate(tables, params);
1544
+ const expectedValidFrom = expectedValidFromPredicate(
1545
+ edges.validFrom,
1546
+ params.expectedValidFrom
1547
+ );
1271
1548
  if (params.clearDeleted) {
1272
1549
  return drizzleOrm.sql`
1273
1550
  UPDATE ${edges}
1274
1551
  SET ${setClause}
1275
1552
  WHERE ${edges.graphId} = ${params.graphId}
1276
- AND ${edges.id} = ${params.id}
1553
+ AND ${edges.id} = ${params.id}${expectedIdentity}${expectedValidFrom}
1277
1554
  RETURNING *
1278
1555
  `;
1279
1556
  }
@@ -1281,7 +1558,7 @@ function buildUpdateEdge(tables, params, timestamp) {
1281
1558
  UPDATE ${edges}
1282
1559
  SET ${setClause}
1283
1560
  WHERE ${edges.graphId} = ${params.graphId}
1284
- AND ${edges.id} = ${params.id}
1561
+ AND ${edges.id} = ${params.id}${expectedIdentity}${expectedValidFrom}
1285
1562
  AND ${edges.deletedAt} IS NULL
1286
1563
  RETURNING *
1287
1564
  `;
@@ -1292,7 +1569,7 @@ function buildDeleteEdge(tables, params, timestamp) {
1292
1569
  UPDATE ${edges}
1293
1570
  SET ${quotedColumn(edges.deletedAt)} = ${timestamp}
1294
1571
  WHERE ${edges.graphId} = ${params.graphId}
1295
- AND ${edges.id} = ${params.id}
1572
+ AND ${edges.id} = ${params.id}${expectedIdentityPredicate(tables, params.kind === void 0 ? {} : { kind: params.kind })}
1296
1573
  AND ${edges.deletedAt} IS NULL
1297
1574
  `;
1298
1575
  }
@@ -1325,7 +1602,7 @@ function buildHardDeleteEdge(tables, params) {
1325
1602
  return drizzleOrm.sql`
1326
1603
  DELETE FROM ${edges}
1327
1604
  WHERE ${edges.graphId} = ${params.graphId}
1328
- AND ${edges.id} = ${params.id}
1605
+ AND ${edges.id} = ${params.id}${expectedIdentityPredicate(tables, params.kind === void 0 ? {} : { kind: params.kind })}
1329
1606
  `;
1330
1607
  }
1331
1608
  function buildHardDeleteEdgesByNode(tables, graphId, nodeKind, nodeId) {
@@ -1402,11 +1679,11 @@ function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
1402
1679
  assertValidSearchParams(params);
1403
1680
  const mode = resolveMode(params.mode);
1404
1681
  const table = quotedTableName(tableName);
1405
- const matchCondition = chunkOOA273IJ_cjs.toDrizzleSql(
1682
+ const matchCondition = chunkU5SON7R2_cjs.toDrizzleSql(
1406
1683
  strategy.matchCondition(tableName, params.query, mode, params.language),
1407
1684
  dialect
1408
1685
  );
1409
- const rankExpression = chunkOOA273IJ_cjs.toDrizzleSql(
1686
+ const rankExpression = chunkU5SON7R2_cjs.toDrizzleSql(
1410
1687
  strategy.rankExpression(tableName, params.query, mode, params.language),
1411
1688
  dialect
1412
1689
  );
@@ -1419,10 +1696,10 @@ function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
1419
1696
  conditions.push(drizzleOrm.sql`${rankExpression} >= ${params.minScore}`);
1420
1697
  }
1421
1698
  if (candidates !== void 0) {
1422
- const candidateSql = chunkU5W4LKZV_cjs.isSqlFragment(candidates) ? chunkOOA273IJ_cjs.toDrizzleSql(candidates, dialect) : candidates;
1699
+ const candidateSql = chunkVCRRKBLN_cjs.isSqlFragment(candidates) ? chunkU5SON7R2_cjs.toDrizzleSql(candidates, dialect) : candidates;
1423
1700
  conditions.push(drizzleOrm.sql`"node_id" IN (${candidateSql})`);
1424
1701
  }
1425
- const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ? chunkOOA273IJ_cjs.toDrizzleSql(
1702
+ const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ? chunkU5SON7R2_cjs.toDrizzleSql(
1426
1703
  strategy.snippetExpression(
1427
1704
  tableName,
1428
1705
  params.query,
@@ -1538,20 +1815,30 @@ function buildUpdateNode(tables, params, timestamp) {
1538
1815
  drizzleOrm.sql`${quotedColumn(nodes.version)} = ${quotedColumn(nodes.version)} + 1`
1539
1816
  );
1540
1817
  }
1541
- if (params.validTo !== void 0) {
1818
+ if (params.clearDeleted) {
1819
+ setParts.push(
1820
+ drizzleOrm.sql`${quotedColumn(nodes.validFrom)} = ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}`,
1821
+ drizzleOrm.sql`${quotedColumn(nodes.validTo)} = ${sqlNull(params.validTo)}`
1822
+ );
1823
+ } else if (params.validTo !== void 0) {
1542
1824
  setParts.push(drizzleOrm.sql`${quotedColumn(nodes.validTo)} = ${params.validTo}`);
1543
1825
  }
1544
1826
  if (params.clearDeleted) {
1545
1827
  setParts.push(drizzleOrm.sql`${quotedColumn(nodes.deletedAt)} = NULL`);
1546
1828
  }
1547
1829
  const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
1830
+ const expectedValidFrom = expectedValidFromPredicate(
1831
+ nodes.validFrom,
1832
+ params.expectedValidFrom
1833
+ );
1548
1834
  if (params.clearDeleted) {
1549
1835
  return drizzleOrm.sql`
1550
1836
  UPDATE ${nodes}
1551
1837
  SET ${setClause}
1552
1838
  WHERE ${nodes.graphId} = ${params.graphId}
1553
1839
  AND ${nodes.kind} = ${params.kind}
1554
- AND ${nodes.id} = ${params.id}
1840
+ AND ${nodes.id} = ${params.id}${expectedValidFrom}
1841
+ AND ${nodes.deletedAt} IS NOT NULL
1555
1842
  RETURNING *
1556
1843
  `;
1557
1844
  }
@@ -1560,25 +1847,25 @@ function buildUpdateNode(tables, params, timestamp) {
1560
1847
  SET ${setClause}
1561
1848
  WHERE ${nodes.graphId} = ${params.graphId}
1562
1849
  AND ${nodes.kind} = ${params.kind}
1563
- AND ${nodes.id} = ${params.id}
1850
+ AND ${nodes.id} = ${params.id}${expectedValidFrom}
1564
1851
  AND ${nodes.deletedAt} IS NULL
1565
1852
  RETURNING *
1566
1853
  `;
1567
1854
  }
1568
1855
  function buildUpdateNodeSet(tables, dialect, params, timestamp) {
1569
1856
  const { nodes } = tables;
1570
- const adapter = chunkJXUTCSXX_cjs.getDialect(dialect);
1571
- const patchedProps = chunkOOA273IJ_cjs.toDrizzleSql(
1857
+ const adapter = chunk4UGOKMI5_cjs.getDialect(dialect);
1858
+ const patchedProps = chunkU5SON7R2_cjs.toDrizzleSql(
1572
1859
  adapter.jsonSetProperties(
1573
- chunkU5W4LKZV_cjs.sql.identifier(nodes.props.name),
1860
+ chunkVCRRKBLN_cjs.sql.identifier(nodes.props.name),
1574
1861
  params.patch,
1575
1862
  params.unsetProperties ?? []
1576
1863
  ),
1577
1864
  dialect
1578
1865
  );
1579
- const candidateIds = chunkOOA273IJ_cjs.toDrizzleSql(params.candidateIds, dialect);
1580
- const candidateIdColumn = chunkOOA273IJ_cjs.toDrizzleSql(
1581
- chunkU5W4LKZV_cjs.sql.identifier(params.candidateIdColumn),
1866
+ const candidateIds = chunkU5SON7R2_cjs.toDrizzleSql(params.candidateIds, dialect);
1867
+ const candidateIdColumn = chunkU5SON7R2_cjs.toDrizzleSql(
1868
+ chunkVCRRKBLN_cjs.sql.identifier(params.candidateIdColumn),
1582
1869
  dialect
1583
1870
  );
1584
1871
  return drizzleOrm.sql`
@@ -1896,6 +2183,9 @@ function buildCheckUniqueBatch(tables, params) {
1896
2183
  }
1897
2184
 
1898
2185
  // src/backend/drizzle/operations/strategy.ts
2186
+ function nullableText(value) {
2187
+ return value === void 0 ? drizzleOrm.sql`NULL` : drizzleOrm.sql`${value}`;
2188
+ }
1899
2189
  function bindTableOperationBuilders(tables, builders) {
1900
2190
  const boundEntries = Object.entries(builders).map(([name, builder]) => {
1901
2191
  function boundBuilder(...args) {
@@ -1953,15 +2243,15 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1953
2243
  const fulltextTable = tables.fulltextTableName;
1954
2244
  const contributionMaterializations = tables.contributionMaterializations;
1955
2245
  const fulltextBuilders = {
1956
- buildUpsertFulltext: (params, timestamp) => fulltextStrategy.buildUpsert(fulltextTable, params, timestamp).map((statement) => chunkOOA273IJ_cjs.toDrizzleSql(statement, dialect)),
1957
- buildDeleteFulltext: (params) => fulltextStrategy.buildDelete(fulltextTable, params).map((statement) => chunkOOA273IJ_cjs.toDrizzleSql(statement, dialect)),
2246
+ buildUpsertFulltext: (params, timestamp) => fulltextStrategy.buildUpsert(fulltextTable, params, timestamp).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
2247
+ buildDeleteFulltext: (params) => fulltextStrategy.buildDelete(fulltextTable, params).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
1958
2248
  buildDeleteFulltextByNode: (graphId, nodeKind, nodeId) => fulltextStrategy.buildDelete(fulltextTable, {
1959
2249
  graphId,
1960
2250
  nodeKind,
1961
2251
  nodeId
1962
- }).map((statement) => chunkOOA273IJ_cjs.toDrizzleSql(statement, dialect)),
1963
- buildUpsertFulltextBatch: (params, timestamp) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp).map((statement) => chunkOOA273IJ_cjs.toDrizzleSql(statement, dialect)),
1964
- buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params).map((statement) => chunkOOA273IJ_cjs.toDrizzleSql(statement, dialect)),
2252
+ }).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
2253
+ buildUpsertFulltextBatch: (params, timestamp) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
2254
+ buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
1965
2255
  buildFulltextSearch: (params) => buildFulltextSearch(
1966
2256
  fulltextTable,
1967
2257
  params,
@@ -1973,7 +2263,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1973
2263
  tables.nodes,
1974
2264
  params.graphId,
1975
2265
  params.nodeKind,
1976
- chunkF4NHQHEZ_cjs.nowIso()
2266
+ chunkYAAM3M2S_cjs.nowIso()
1977
2267
  )
1978
2268
  ),
1979
2269
  buildHybridSearch: (params, vectorSql, vectorScoreDescending) => {
@@ -1981,7 +2271,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1981
2271
  tables.nodes,
1982
2272
  params.graphId,
1983
2273
  params.nodeKind,
1984
- chunkF4NHQHEZ_cjs.nowIso()
2274
+ chunkYAAM3M2S_cjs.nowIso()
1985
2275
  );
1986
2276
  const fulltextSql = buildFulltextSearch(
1987
2277
  fulltextTable,
@@ -2002,7 +2292,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
2002
2292
  hybridCandidatesRef()
2003
2293
  );
2004
2294
  return buildHybridSearchStatement({
2005
- candidatesSql: chunkU5W4LKZV_cjs.isSqlFragment(candidates) ? chunkOOA273IJ_cjs.toDrizzleSql(candidates, dialect) : candidates,
2295
+ candidatesSql: chunkVCRRKBLN_cjs.isSqlFragment(candidates) ? chunkU5SON7R2_cjs.toDrizzleSql(candidates, dialect) : candidates,
2006
2296
  vectorSql,
2007
2297
  vectorScoreDescending,
2008
2298
  fulltextSql,
@@ -2018,6 +2308,24 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
2018
2308
  });
2019
2309
  }
2020
2310
  };
2311
+ function buildInsertContributionMaterialization(params) {
2312
+ return drizzleOrm.sql`
2313
+ INSERT INTO ${contributionMaterializations}
2314
+ (graph_id, logical_name, owner, table_name, signature,
2315
+ materialized_at, last_attempted_at, last_error)
2316
+ VALUES (
2317
+ ${params.graphId}, ${params.logicalName}, ${params.owner},
2318
+ ${params.tableName}, ${params.signature},
2319
+ ${nullableText(params.materializedAt)}, ${params.attemptedAt},
2320
+ ${nullableText(params.error)}
2321
+ )
2322
+ ON CONFLICT (graph_id, logical_name, owner, table_name) DO UPDATE SET
2323
+ signature = excluded.signature,
2324
+ materialized_at = excluded.materialized_at,
2325
+ last_attempted_at = excluded.last_attempted_at,
2326
+ last_error = excluded.last_error
2327
+ `;
2328
+ }
2021
2329
  function buildDeleteContributionMaterialization(identity) {
2022
2330
  return drizzleOrm.sql`
2023
2331
  DELETE FROM ${contributionMaterializations}
@@ -2030,10 +2338,15 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
2030
2338
  return {
2031
2339
  ...tableOperations,
2032
2340
  ...fulltextBuilders,
2341
+ primaryKeyConstraints: {
2342
+ nodes: nodePrimaryKeyConstraint(tables.nodes),
2343
+ edges: edgePrimaryKeyConstraint(tables.edges)
2344
+ },
2033
2345
  buildUpdateNodeSet(params, timestamp) {
2034
2346
  return buildUpdateNodeSet(tables, dialect, params, timestamp);
2035
2347
  },
2036
2348
  buildDeleteContributionMaterialization,
2349
+ buildInsertContributionMaterialization,
2037
2350
  buildInsertUnique(params) {
2038
2351
  return buildInsertUnique(tables, dialect, params);
2039
2352
  },
@@ -2076,7 +2389,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
2076
2389
  }
2077
2390
  function tableExistsFromRow(row) {
2078
2391
  if (row === void 0) return false;
2079
- return Object.values(row).some((value) => chunk764JHTLT_cjs.isPresent(value));
2392
+ return Object.values(row).some((value) => chunkN66HCGCY_cjs.isPresent(value));
2080
2393
  }
2081
2394
  function createCachedTableExistence(probe, options) {
2082
2395
  const cacheExisting = options?.cacheExisting !== false;
@@ -2109,18 +2422,38 @@ var DRIZZLE_DIALECT_LABELS = {
2109
2422
  function assertAdoptedDialect(externalTx, brand, backend) {
2110
2423
  if (drizzleOrm.is(externalTx, brand)) return;
2111
2424
  const label = DRIZZLE_DIALECT_LABELS[backend];
2112
- throw new chunkC4F7VJ5D_cjs.ConfigurationError(
2425
+ throw new chunkNI72YOJB_cjs.ConfigurationError(
2113
2426
  `adoptTransaction received a handle that is not a ${label} Drizzle transaction. Pass the \`tx\` from a ${label} \`db.transaction(...)\` opened on this backend's connection.`,
2114
2427
  { backend, capability: "adoptTransaction" }
2115
2428
  );
2116
2429
  }
2430
+ async function withDuplicateKeyClassification(run, context) {
2431
+ try {
2432
+ return await run();
2433
+ } catch (error) {
2434
+ if (!chunkBSFJMMV3_cjs.isDuplicatePrimaryKeyError(error, context.relation)) throw error;
2435
+ throw new chunkNI72YOJB_cjs.DatabaseOperationError(
2436
+ `Insert ${context.entity} failed: a row with this identity already exists`,
2437
+ {
2438
+ operation: "insert",
2439
+ entity: context.entity,
2440
+ reason: "duplicate_key",
2441
+ attempted: context.attempted
2442
+ },
2443
+ { cause: error }
2444
+ );
2445
+ }
2446
+ }
2447
+ function attemptedInserts(params) {
2448
+ return params.map((item) => ({ kind: item.kind, id: item.id }));
2449
+ }
2117
2450
  function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
2118
2451
  const expectedVersion = expected.kind === "active" ? expected.version : 0;
2119
2452
  assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion);
2120
2453
  }
2121
2454
  function assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion) {
2122
2455
  if (actualActiveVersion !== expectedVersion) {
2123
- throw new chunkC4F7VJ5D_cjs.StaleVersionError({
2456
+ throw new chunkNI72YOJB_cjs.StaleVersionError({
2124
2457
  graphId,
2125
2458
  expected: expectedVersion,
2126
2459
  actual: actualActiveVersion
@@ -2170,7 +2503,7 @@ function createCommonOperationBackend(options) {
2170
2503
  operationStrategy,
2171
2504
  rowMappers
2172
2505
  } = options;
2173
- const nowIso2 = options.nowIso ?? chunkF4NHQHEZ_cjs.nowIso;
2506
+ const nowIso2 = options.nowIso ?? chunkYAAM3M2S_cjs.nowIso;
2174
2507
  const tableExists = createCachedTableExistence(
2175
2508
  (tableName) => execution.execGet(
2176
2509
  operationStrategy.buildTableExists(tableName)
@@ -2192,7 +2525,7 @@ function createCommonOperationBackend(options) {
2192
2525
  return {
2193
2526
  tableExists,
2194
2527
  async executeSchemaDdl(ddl) {
2195
- await execution.execRun(chunkU5W4LKZV_cjs.asCompiledStatementSql(chunkU5W4LKZV_cjs.sql.raw(ddl)));
2528
+ await execution.execRun(chunkVCRRKBLN_cjs.asCompiledStatementSql(chunkVCRRKBLN_cjs.sql.raw(ddl)));
2196
2529
  },
2197
2530
  async executeStatement(query) {
2198
2531
  await execution.execRun(query);
@@ -2203,11 +2536,22 @@ function createCommonOperationBackend(options) {
2203
2536
  async insertNode(params) {
2204
2537
  const timestamp = nowIso2();
2205
2538
  const query = operationStrategy.buildInsertNode(params, timestamp);
2206
- const row = await execution.execGet(query);
2539
+ const row = await withDuplicateKeyClassification(
2540
+ () => execution.execGet(query),
2541
+ {
2542
+ entity: "node",
2543
+ relation: operationStrategy.primaryKeyConstraints.nodes,
2544
+ attempted: attemptedInserts([params])
2545
+ }
2546
+ );
2207
2547
  if (!row)
2208
- throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
2548
+ throw new chunkNI72YOJB_cjs.DatabaseOperationError(
2209
2549
  "Insert node failed: no row returned",
2210
- { operation: "insert", entity: "node" }
2550
+ {
2551
+ operation: "insert",
2552
+ entity: "node",
2553
+ reason: "no_row_returned"
2554
+ }
2211
2555
  );
2212
2556
  return rowMappers.toNodeRow(row);
2213
2557
  },
@@ -2217,16 +2561,24 @@ function createCommonOperationBackend(options) {
2217
2561
  params,
2218
2562
  timestamp
2219
2563
  );
2220
- await execution.execRun(query);
2564
+ await withDuplicateKeyClassification(() => execution.execRun(query), {
2565
+ entity: "node",
2566
+ relation: operationStrategy.primaryKeyConstraints.nodes,
2567
+ attempted: attemptedInserts([params])
2568
+ });
2221
2569
  },
2222
2570
  async insertNodesBatch(params) {
2223
2571
  if (params.length === 0) {
2224
2572
  return;
2225
2573
  }
2226
2574
  const timestamp = nowIso2();
2227
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
2575
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
2228
2576
  const query = operationStrategy.buildInsertNodesBatch(chunk2, timestamp);
2229
- await execution.execRun(query);
2577
+ await withDuplicateKeyClassification(() => execution.execRun(query), {
2578
+ entity: "node",
2579
+ relation: operationStrategy.primaryKeyConstraints.nodes,
2580
+ attempted: attemptedInserts(chunk2)
2581
+ });
2230
2582
  }
2231
2583
  },
2232
2584
  async insertNodesBatchReturning(params) {
@@ -2235,12 +2587,19 @@ function createCommonOperationBackend(options) {
2235
2587
  }
2236
2588
  const timestamp = nowIso2();
2237
2589
  const allRows = [];
2238
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
2590
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
2239
2591
  const query = operationStrategy.buildInsertNodesBatchReturning(
2240
2592
  chunk2,
2241
2593
  timestamp
2242
2594
  );
2243
- const rows = await execution.execAll(query);
2595
+ const rows = await withDuplicateKeyClassification(
2596
+ () => execution.execAll(query),
2597
+ {
2598
+ entity: "node",
2599
+ relation: operationStrategy.primaryKeyConstraints.nodes,
2600
+ attempted: attemptedInserts(chunk2)
2601
+ }
2602
+ );
2244
2603
  allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
2245
2604
  }
2246
2605
  return allRows;
@@ -2253,7 +2612,7 @@ function createCommonOperationBackend(options) {
2253
2612
  async getNodes(graphId, kind, ids) {
2254
2613
  if (ids.length === 0) return [];
2255
2614
  const allRows = [];
2256
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(ids, batchConfig.getNodesChunkSize)) {
2615
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(ids, batchConfig.getNodesChunkSize)) {
2257
2616
  const query = operationStrategy.buildGetNodes(graphId, kind, chunk2);
2258
2617
  const rows = await execution.execAll(query);
2259
2618
  allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
@@ -2265,21 +2624,25 @@ function createCommonOperationBackend(options) {
2265
2624
  const query = operationStrategy.buildUpdateNode(params, timestamp);
2266
2625
  const row = await execution.execGet(query);
2267
2626
  if (!row)
2268
- throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
2627
+ throw new chunkNI72YOJB_cjs.DatabaseOperationError(
2269
2628
  "Update node failed: no row returned",
2270
- { operation: "update", entity: "node" }
2629
+ {
2630
+ operation: "update",
2631
+ entity: "node",
2632
+ reason: "no_row_returned"
2633
+ }
2271
2634
  );
2272
2635
  return rowMappers.toNodeRow(row);
2273
2636
  },
2274
2637
  async updateNodeSet(params) {
2275
2638
  if (Object.keys(params.patch).length === 0 && (params.unsetProperties?.length ?? 0) === 0) {
2276
- throw new chunkC4F7VJ5D_cjs.ConfigurationError(
2639
+ throw new chunkNI72YOJB_cjs.ConfigurationError(
2277
2640
  "Set-based node update requires at least one property",
2278
2641
  { operation: "updateNodeSet", kind: params.kind }
2279
2642
  );
2280
2643
  }
2281
2644
  if (params.candidateIdColumn.length === 0) {
2282
- throw new chunkC4F7VJ5D_cjs.ConfigurationError(
2645
+ throw new chunkNI72YOJB_cjs.ConfigurationError(
2283
2646
  "Set-based node update requires a candidate id column",
2284
2647
  { operation: "updateNodeSet", kind: params.kind }
2285
2648
  );
@@ -2331,11 +2694,22 @@ function createCommonOperationBackend(options) {
2331
2694
  async insertEdge(params) {
2332
2695
  const timestamp = nowIso2();
2333
2696
  const query = operationStrategy.buildInsertEdge(params, timestamp);
2334
- const row = await execution.execGet(query);
2697
+ const row = await withDuplicateKeyClassification(
2698
+ () => execution.execGet(query),
2699
+ {
2700
+ entity: "edge",
2701
+ relation: operationStrategy.primaryKeyConstraints.edges,
2702
+ attempted: attemptedInserts([params])
2703
+ }
2704
+ );
2335
2705
  if (!row)
2336
- throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
2706
+ throw new chunkNI72YOJB_cjs.DatabaseOperationError(
2337
2707
  "Insert edge failed: no row returned",
2338
- { operation: "insert", entity: "edge" }
2708
+ {
2709
+ operation: "insert",
2710
+ entity: "edge",
2711
+ reason: "no_row_returned"
2712
+ }
2339
2713
  );
2340
2714
  return rowMappers.toEdgeRow(row);
2341
2715
  },
@@ -2345,16 +2719,24 @@ function createCommonOperationBackend(options) {
2345
2719
  params,
2346
2720
  timestamp
2347
2721
  );
2348
- await execution.execRun(query);
2722
+ await withDuplicateKeyClassification(() => execution.execRun(query), {
2723
+ entity: "edge",
2724
+ relation: operationStrategy.primaryKeyConstraints.edges,
2725
+ attempted: attemptedInserts([params])
2726
+ });
2349
2727
  },
2350
2728
  async insertEdgesBatch(params) {
2351
2729
  if (params.length === 0) {
2352
2730
  return;
2353
2731
  }
2354
2732
  const timestamp = nowIso2();
2355
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
2733
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
2356
2734
  const query = operationStrategy.buildInsertEdgesBatch(chunk2, timestamp);
2357
- await execution.execRun(query);
2735
+ await withDuplicateKeyClassification(() => execution.execRun(query), {
2736
+ entity: "edge",
2737
+ relation: operationStrategy.primaryKeyConstraints.edges,
2738
+ attempted: attemptedInserts(chunk2)
2739
+ });
2358
2740
  }
2359
2741
  },
2360
2742
  async insertEdgesBatchReturning(params) {
@@ -2363,12 +2745,19 @@ function createCommonOperationBackend(options) {
2363
2745
  }
2364
2746
  const timestamp = nowIso2();
2365
2747
  const allRows = [];
2366
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
2748
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
2367
2749
  const query = operationStrategy.buildInsertEdgesBatchReturning(
2368
2750
  chunk2,
2369
2751
  timestamp
2370
2752
  );
2371
- const rows = await execution.execAll(query);
2753
+ const rows = await withDuplicateKeyClassification(
2754
+ () => execution.execAll(query),
2755
+ {
2756
+ entity: "edge",
2757
+ relation: operationStrategy.primaryKeyConstraints.edges,
2758
+ attempted: attemptedInserts(chunk2)
2759
+ }
2760
+ );
2372
2761
  allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
2373
2762
  }
2374
2763
  return allRows;
@@ -2381,7 +2770,7 @@ function createCommonOperationBackend(options) {
2381
2770
  async getEdges(graphId, ids) {
2382
2771
  if (ids.length === 0) return [];
2383
2772
  const allRows = [];
2384
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(ids, batchConfig.getEdgesChunkSize)) {
2773
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(ids, batchConfig.getEdgesChunkSize)) {
2385
2774
  const query = operationStrategy.buildGetEdges(graphId, chunk2);
2386
2775
  const rows = await execution.execAll(query);
2387
2776
  allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
@@ -2393,9 +2782,13 @@ function createCommonOperationBackend(options) {
2393
2782
  const query = operationStrategy.buildUpdateEdge(params, timestamp);
2394
2783
  const row = await execution.execGet(query);
2395
2784
  if (!row)
2396
- throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
2785
+ throw new chunkNI72YOJB_cjs.DatabaseOperationError(
2397
2786
  "Update edge failed: no row returned",
2398
- { operation: "update", entity: "edge" }
2787
+ {
2788
+ operation: "update",
2789
+ entity: "edge",
2790
+ reason: "no_row_returned"
2791
+ }
2399
2792
  );
2400
2793
  return rowMappers.toEdgeRow(row);
2401
2794
  },
@@ -2415,7 +2808,7 @@ function createCommonOperationBackend(options) {
2415
2808
  1,
2416
2809
  batchConfig.getEdgesChunkSize - 1
2417
2810
  );
2418
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(params.ids, softDeleteChunkSize)) {
2811
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params.ids, softDeleteChunkSize)) {
2419
2812
  const query = operationStrategy.buildDeleteEdgesBatch(
2420
2813
  { graphId: params.graphId, ids: chunk2 },
2421
2814
  timestamp
@@ -2425,7 +2818,7 @@ function createCommonOperationBackend(options) {
2425
2818
  },
2426
2819
  async hardDeleteEdgesBatch(params) {
2427
2820
  if (params.ids.length === 0) return;
2428
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(
2821
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(
2429
2822
  params.ids,
2430
2823
  batchConfig.getEdgesChunkSize
2431
2824
  )) {
@@ -2469,7 +2862,7 @@ function createCommonOperationBackend(options) {
2469
2862
  async findEdgesByEndpointSet(params) {
2470
2863
  const ids = resolveEdgeEndpointIds(params);
2471
2864
  const edgeRows = [];
2472
- for (const idChunk of chunkZDH3DX3C_cjs.chunk(
2865
+ for (const idChunk of chunkBSFJMMV3_cjs.chunk(
2473
2866
  ids,
2474
2867
  batchConfig.findEdgesEndpointChunkSize
2475
2868
  )) {
@@ -2486,7 +2879,7 @@ function createCommonOperationBackend(options) {
2486
2879
  const { edgeKinds, endpoints, endpointChunkSize } = resolveHeterogeneousEdgeRead(params, maxBindParameters);
2487
2880
  if (edgeKinds.length === 0 || endpoints.length === 0) return [];
2488
2881
  const edgeRows = [];
2489
- for (const endpointChunk of chunkZDH3DX3C_cjs.chunk(endpoints, endpointChunkSize)) {
2882
+ for (const endpointChunk of chunkBSFJMMV3_cjs.chunk(endpoints, endpointChunkSize)) {
2490
2883
  const query = operationStrategy.buildFindEdgesByHeterogeneousEndpointSet(
2491
2884
  params,
2492
2885
  endpointChunk,
@@ -2506,7 +2899,7 @@ function createCommonOperationBackend(options) {
2506
2899
  const query = operationStrategy.buildInsertUnique(params);
2507
2900
  const result = await execution.execGet(query);
2508
2901
  if (result && result.node_id !== params.nodeId) {
2509
- throw new chunkC4F7VJ5D_cjs.UniquenessError({
2902
+ throw new chunkNI72YOJB_cjs.UniquenessError({
2510
2903
  constraintName: params.constraintName,
2511
2904
  kind: params.nodeKind,
2512
2905
  existingId: result.node_id,
@@ -2526,7 +2919,7 @@ function createCommonOperationBackend(options) {
2526
2919
  continue;
2527
2920
  }
2528
2921
  if (existing.nodeId !== entry.nodeId) {
2529
- throw new chunkC4F7VJ5D_cjs.UniquenessError({
2922
+ throw new chunkNI72YOJB_cjs.UniquenessError({
2530
2923
  constraintName: entry.constraintName,
2531
2924
  kind: entry.nodeKind,
2532
2925
  existingId: existing.nodeId,
@@ -2536,7 +2929,7 @@ function createCommonOperationBackend(options) {
2536
2929
  }
2537
2930
  }
2538
2931
  const deduped = [...byTarget.values()];
2539
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(
2932
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(
2540
2933
  deduped,
2541
2934
  batchConfig.uniqueInsertBatchSize
2542
2935
  )) {
@@ -2551,7 +2944,7 @@ function createCommonOperationBackend(options) {
2551
2944
  for (const entry of chunk2) {
2552
2945
  const owner = ownerByTarget.get(targetKey(entry));
2553
2946
  if (owner !== void 0 && owner !== entry.nodeId) {
2554
- throw new chunkC4F7VJ5D_cjs.UniquenessError({
2947
+ throw new chunkNI72YOJB_cjs.UniquenessError({
2555
2948
  constraintName: entry.constraintName,
2556
2949
  kind: entry.nodeKind,
2557
2950
  existingId: owner,
@@ -2569,7 +2962,7 @@ function createCommonOperationBackend(options) {
2569
2962
  },
2570
2963
  async hardDeleteUniquesByNodeIds(params) {
2571
2964
  const nodeIds = [...new Set(params.nodeIds)];
2572
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(
2965
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(
2573
2966
  nodeIds,
2574
2967
  batchConfig.uniqueDeleteChunkSize
2575
2968
  )) {
@@ -2588,7 +2981,7 @@ function createCommonOperationBackend(options) {
2588
2981
  async checkUniqueBatch(params) {
2589
2982
  if (params.keys.length === 0) return [];
2590
2983
  const allRows = [];
2591
- for (const chunk2 of chunkZDH3DX3C_cjs.chunk(
2984
+ for (const chunk2 of chunkBSFJMMV3_cjs.chunk(
2592
2985
  params.keys,
2593
2986
  batchConfig.checkUniqueBatchChunkSize
2594
2987
  )) {
@@ -2619,7 +3012,7 @@ function createCommonOperationBackend(options) {
2619
3012
  if (existingRaw !== void 0) {
2620
3013
  const existing = rowMappers.toSchemaVersionRow(existingRaw);
2621
3014
  if (existing.schema_hash !== params.schemaHash) {
2622
- throw new chunkC4F7VJ5D_cjs.SchemaContentConflictError({
3015
+ throw new chunkNI72YOJB_cjs.SchemaContentConflictError({
2623
3016
  graphId: params.graphId,
2624
3017
  version: params.version,
2625
3018
  existingHash: existing.schema_hash,
@@ -2667,7 +3060,7 @@ function createCommonOperationBackend(options) {
2667
3060
  );
2668
3061
  const insertedRaw = await execution.execGet(insertQuery);
2669
3062
  if (!insertedRaw) {
2670
- throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
3063
+ throw new chunkNI72YOJB_cjs.DatabaseOperationError(
2671
3064
  "Insert schema failed: no row returned",
2672
3065
  { operation: "insert", entity: "schema" }
2673
3066
  );
@@ -2685,7 +3078,7 @@ function createCommonOperationBackend(options) {
2685
3078
  operationStrategy.buildGetSchemaVersion(params.graphId, params.version)
2686
3079
  );
2687
3080
  if (!targetRaw) {
2688
- throw new chunkC4F7VJ5D_cjs.MigrationError(
3081
+ throw new chunkNI72YOJB_cjs.MigrationError(
2689
3082
  `Cannot activate version ${params.version}: version does not exist for graph "${params.graphId}".`,
2690
3083
  {
2691
3084
  graphId: params.graphId,
@@ -2718,7 +3111,7 @@ function quoteSqlIdentifier(identifier) {
2718
3111
  }
2719
3112
  function requireRawExecution(backend) {
2720
3113
  if (backend.executeRaw === void 0) {
2721
- throw new chunkC4F7VJ5D_cjs.TrustedImportError(
3114
+ throw new chunkNI72YOJB_cjs.TrustedImportError(
2722
3115
  "This backend cannot execute the raw statements required by trusted import.",
2723
3116
  "backend_unsupported"
2724
3117
  );
@@ -2727,7 +3120,7 @@ function requireRawExecution(backend) {
2727
3120
  }
2728
3121
  function requireStatementExecution(backend) {
2729
3122
  if (backend.executeStatement === void 0) {
2730
- throw new chunkC4F7VJ5D_cjs.TrustedImportError(
3123
+ throw new chunkNI72YOJB_cjs.TrustedImportError(
2731
3124
  "This backend cannot execute the index lifecycle required by trusted import.",
2732
3125
  "backend_unsupported"
2733
3126
  );
@@ -2749,7 +3142,7 @@ async function assertTrustedImportDatabaseEmpty(backend, tableNames) {
2749
3142
  []
2750
3143
  );
2751
3144
  if (!rowIndicatesExistingData(rows[0])) return;
2752
- throw new chunkC4F7VJ5D_cjs.TrustedImportError(
3145
+ throw new chunkNI72YOJB_cjs.TrustedImportError(
2753
3146
  "Trusted import requires globally empty TypeGraph node and edge tables.",
2754
3147
  "database_not_empty",
2755
3148
  { tables: [tableNames.nodes, tableNames.edges] },
@@ -2761,8 +3154,8 @@ async function assertTrustedImportDatabaseEmpty(backend, tableNames) {
2761
3154
  async function lockPostgresTrustedImportTables(backend, tableNames) {
2762
3155
  const executeStatement = requireStatementExecution(backend);
2763
3156
  await executeStatement(
2764
- chunkU5W4LKZV_cjs.asCompiledStatementSql(
2765
- chunkU5W4LKZV_cjs.sql.raw(
3157
+ chunkVCRRKBLN_cjs.asCompiledStatementSql(
3158
+ chunkVCRRKBLN_cjs.sql.raw(
2766
3159
  `LOCK TABLE ${quoteSqlIdentifier(tableNames.nodes)}, ${quoteSqlIdentifier(tableNames.edges)} IN ACCESS EXCLUSIVE MODE`
2767
3160
  )
2768
3161
  )
@@ -2782,8 +3175,8 @@ async function suspendSqliteSecondaryIndexes(backend, tableNames) {
2782
3175
  );
2783
3176
  for (const definition of definitions) {
2784
3177
  await executeStatement(
2785
- chunkU5W4LKZV_cjs.asCompiledStatementSql(
2786
- chunkU5W4LKZV_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
3178
+ chunkVCRRKBLN_cjs.asCompiledStatementSql(
3179
+ chunkVCRRKBLN_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
2787
3180
  )
2788
3181
  );
2789
3182
  }
@@ -2813,8 +3206,8 @@ async function suspendPostgresSecondaryIndexes(backend, tableNames) {
2813
3206
  );
2814
3207
  for (const definition of definitions) {
2815
3208
  await executeStatement(
2816
- chunkU5W4LKZV_cjs.asCompiledStatementSql(
2817
- chunkU5W4LKZV_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
3209
+ chunkVCRRKBLN_cjs.asCompiledStatementSql(
3210
+ chunkVCRRKBLN_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
2818
3211
  )
2819
3212
  );
2820
3213
  }
@@ -2824,20 +3217,20 @@ async function restoreSecondaryIndexes(backend, definitions) {
2824
3217
  const executeStatement = requireStatementExecution(backend);
2825
3218
  for (const definition of definitions) {
2826
3219
  await executeStatement(
2827
- chunkU5W4LKZV_cjs.asCompiledStatementSql(chunkU5W4LKZV_cjs.sql.raw(definition.index_definition))
3220
+ chunkVCRRKBLN_cjs.asCompiledStatementSql(chunkVCRRKBLN_cjs.sql.raw(definition.index_definition))
2828
3221
  );
2829
3222
  }
2830
3223
  }
2831
3224
  async function analyzeImportedTables(backend, tableNames) {
2832
3225
  const executeStatement = requireStatementExecution(backend);
2833
3226
  await executeStatement(
2834
- chunkU5W4LKZV_cjs.asCompiledStatementSql(
2835
- chunkU5W4LKZV_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.nodes)}`)
3227
+ chunkVCRRKBLN_cjs.asCompiledStatementSql(
3228
+ chunkVCRRKBLN_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.nodes)}`)
2836
3229
  )
2837
3230
  );
2838
3231
  await executeStatement(
2839
- chunkU5W4LKZV_cjs.asCompiledStatementSql(
2840
- chunkU5W4LKZV_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.edges)}`)
3232
+ chunkVCRRKBLN_cjs.asCompiledStatementSql(
3233
+ chunkVCRRKBLN_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.edges)}`)
2841
3234
  )
2842
3235
  );
2843
3236
  }
@@ -2852,7 +3245,7 @@ function postgresArray(values) {
2852
3245
  function createSqliteTrustedImportSession(executionAdapter, tableNames) {
2853
3246
  const executePreparedRunBatch = executionAdapter.executePreparedRunBatch;
2854
3247
  if (executePreparedRunBatch === void 0) {
2855
- throw new chunkC4F7VJ5D_cjs.TrustedImportError(
3248
+ throw new chunkNI72YOJB_cjs.TrustedImportError(
2856
3249
  "Trusted import requires a synchronous SQLite driver with prepared statement support.",
2857
3250
  "backend_unsupported"
2858
3251
  );
@@ -3000,6 +3393,7 @@ exports.buildLiveNodeCandidates = buildLiveNodeCandidates;
3000
3393
  exports.buildMaterializationInsertValues = buildMaterializationInsertValues;
3001
3394
  exports.buildMaterializationOnConflictSet = buildMaterializationOnConflictSet;
3002
3395
  exports.commitSchemaVersionIfKindsEmpty = commitSchemaVersionIfKindsEmpty;
3396
+ exports.contributionRebuildSupported = contributionRebuildSupported;
3003
3397
  exports.createCachedTableExistence = createCachedTableExistence;
3004
3398
  exports.createCommonOperationBackend = createCommonOperationBackend;
3005
3399
  exports.createContributionMaterializer = createContributionMaterializer;
@@ -3023,5 +3417,5 @@ exports.tableExistsFromRow = tableExistsFromRow;
3023
3417
  exports.vectorSlotFromCreateIndexParams = vectorSlotFromCreateIndexParams;
3024
3418
  exports.vectorSlotFromDropIndexParams = vectorSlotFromDropIndexParams;
3025
3419
  exports.vectorSlotFromParams = vectorSlotFromParams;
3026
- //# sourceMappingURL=chunk-H7VE3FL4.cjs.map
3027
- //# sourceMappingURL=chunk-H7VE3FL4.cjs.map
3420
+ //# sourceMappingURL=chunk-MUK4BU7K.cjs.map
3421
+ //# sourceMappingURL=chunk-MUK4BU7K.cjs.map