@nicia-ai/typegraph 0.43.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/dist/backend/drizzle/indexes.cjs +9 -9
  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 +5 -5
  5. package/dist/backend/index.cjs +50 -50
  6. package/dist/backend/index.d.cts +3 -3
  7. package/dist/backend/index.d.ts +3 -3
  8. package/dist/backend/index.js +11 -11
  9. package/dist/backend/postgres/index.cjs +26 -26
  10. package/dist/backend/postgres/index.d.cts +6 -5
  11. package/dist/backend/postgres/index.d.ts +6 -5
  12. package/dist/backend/postgres/index.js +13 -13
  13. package/dist/backend/postgres/pglite-store.cjs +32 -33
  14. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  15. package/dist/backend/postgres/pglite-store.d.cts +7 -7
  16. package/dist/backend/postgres/pglite-store.d.ts +7 -7
  17. package/dist/backend/postgres/pglite-store.js +28 -29
  18. package/dist/backend/postgres/pglite-store.js.map +1 -1
  19. package/dist/backend/postgres/pglite.cjs +15 -15
  20. package/dist/backend/postgres/pglite.d.cts +3 -2
  21. package/dist/backend/postgres/pglite.d.ts +3 -2
  22. package/dist/backend/postgres/pglite.js +14 -14
  23. package/dist/backend/sqlite/index.cjs +23 -23
  24. package/dist/backend/sqlite/index.d.cts +7 -6
  25. package/dist/backend/sqlite/index.d.ts +7 -6
  26. package/dist/backend/sqlite/index.js +11 -11
  27. package/dist/backend/sqlite/libsql.cjs +17 -17
  28. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  29. package/dist/backend/sqlite/libsql.d.cts +3 -2
  30. package/dist/backend/sqlite/libsql.d.ts +3 -2
  31. package/dist/backend/sqlite/libsql.js +13 -13
  32. package/dist/backend/sqlite/libsql.js.map +1 -1
  33. package/dist/backend/sqlite/local-store.cjs +33 -34
  34. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  35. package/dist/backend/sqlite/local-store.d.cts +8 -7
  36. package/dist/backend/sqlite/local-store.d.ts +8 -7
  37. package/dist/backend/sqlite/local-store.js +29 -30
  38. package/dist/backend/sqlite/local-store.js.map +1 -1
  39. package/dist/backend/sqlite/local.cjs +16 -16
  40. package/dist/backend/sqlite/local.d.cts +3 -2
  41. package/dist/backend/sqlite/local.d.ts +3 -2
  42. package/dist/backend/sqlite/local.js +14 -14
  43. package/dist/{chunk-2OOY4OYT.js → chunk-2L54C2C2.js} +4 -4
  44. package/dist/{chunk-2OOY4OYT.js.map → chunk-2L54C2C2.js.map} +1 -1
  45. package/dist/{chunk-4WYFRACU.js → chunk-42PYUGLS.js} +58 -4
  46. package/dist/chunk-42PYUGLS.js.map +1 -0
  47. package/dist/{chunk-EQOQOT55.js → chunk-4GUBTVPV.js} +4 -5
  48. package/dist/chunk-4GUBTVPV.js.map +1 -0
  49. package/dist/{chunk-ZIRC2U6G.js → chunk-4GUTQPVO.js} +102 -16
  50. package/dist/chunk-4GUTQPVO.js.map +1 -0
  51. package/dist/{chunk-OYJSYDIH.js → chunk-4MB3AQAQ.js} +13 -3
  52. package/dist/chunk-4MB3AQAQ.js.map +1 -0
  53. package/dist/{chunk-5Q3P6OIC.cjs → chunk-4MEWSUVM.cjs} +12 -12
  54. package/dist/chunk-4MEWSUVM.cjs.map +1 -0
  55. package/dist/{chunk-VC26BUNP.js → chunk-4QIKLIGG.js} +17 -5
  56. package/dist/chunk-4QIKLIGG.js.map +1 -0
  57. package/dist/chunk-4SZ6XPTG.cjs +12 -0
  58. package/dist/{chunk-VGMNGWBR.cjs.map → chunk-4SZ6XPTG.cjs.map} +1 -1
  59. package/dist/{chunk-UZLEQFTV.js → chunk-55ITBQJI.js} +4 -4
  60. package/dist/chunk-55ITBQJI.js.map +1 -0
  61. package/dist/{chunk-JOYPNY33.js → chunk-5EKPX6QU.js} +9 -9
  62. package/dist/{chunk-JOYPNY33.js.map → chunk-5EKPX6QU.js.map} +1 -1
  63. package/dist/{chunk-TRC646QQ.cjs → chunk-5GAONX5G.cjs} +7 -7
  64. package/dist/{chunk-TRC646QQ.cjs.map → chunk-5GAONX5G.cjs.map} +1 -1
  65. package/dist/{chunk-M4GYQF2H.js → chunk-6DCB664D.js} +7 -4
  66. package/dist/chunk-6DCB664D.js.map +1 -0
  67. package/dist/{chunk-64LERBFM.cjs → chunk-6RYPD3NJ.cjs} +75 -65
  68. package/dist/chunk-6RYPD3NJ.cjs.map +1 -0
  69. package/dist/{chunk-5AERZSHC.cjs → chunk-7PF2L3H6.cjs} +4 -4
  70. package/dist/{chunk-5AERZSHC.cjs.map → chunk-7PF2L3H6.cjs.map} +1 -1
  71. package/dist/chunk-B3F2D3SP.cjs +12 -0
  72. package/dist/{chunk-U3YRCZ5L.cjs.map → chunk-B3F2D3SP.cjs.map} +1 -1
  73. package/dist/{chunk-Z3WIL6S3.js → chunk-BGYJW37L.js} +5 -5
  74. package/dist/{chunk-Z3WIL6S3.js.map → chunk-BGYJW37L.js.map} +1 -1
  75. package/dist/{chunk-DMZEVJGL.cjs → chunk-BNS75YNF.cjs} +12 -13
  76. package/dist/chunk-BNS75YNF.cjs.map +1 -0
  77. package/dist/{chunk-KTBTSHU6.cjs → chunk-C4F7VJ5D.cjs} +13 -3
  78. package/dist/chunk-C4F7VJ5D.cjs.map +1 -0
  79. package/dist/{chunk-L2BYRYHC.js → chunk-CBKG6HEP.js} +43 -33
  80. package/dist/chunk-CBKG6HEP.js.map +1 -0
  81. package/dist/{chunk-CVK4T34X.cjs → chunk-CPEL3YIR.cjs} +22 -22
  82. package/dist/{chunk-CVK4T34X.cjs.map → chunk-CPEL3YIR.cjs.map} +1 -1
  83. package/dist/{chunk-O2GZM7UK.cjs → chunk-D54WH24V.cjs} +62 -7
  84. package/dist/chunk-D54WH24V.cjs.map +1 -0
  85. package/dist/{chunk-33PAKPED.cjs → chunk-D56XG4EI.cjs} +53 -41
  86. package/dist/chunk-D56XG4EI.cjs.map +1 -0
  87. package/dist/{chunk-O3USVVWS.js → chunk-DK2S42XB.js} +3 -3
  88. package/dist/{chunk-O3USVVWS.js.map → chunk-DK2S42XB.js.map} +1 -1
  89. package/dist/{chunk-HHBKGPEI.js → chunk-DXEEHSGN.js} +517 -26
  90. package/dist/chunk-DXEEHSGN.js.map +1 -0
  91. package/dist/{chunk-UJRWOV5B.js → chunk-EFEOOCJ3.js} +5 -5
  92. package/dist/{chunk-UJRWOV5B.js.map → chunk-EFEOOCJ3.js.map} +1 -1
  93. package/dist/{chunk-ECU53PMN.cjs → chunk-EKFUG4G7.cjs} +5 -5
  94. package/dist/chunk-EKFUG4G7.cjs.map +1 -0
  95. package/dist/{chunk-FSCJOTHF.cjs → chunk-EQ7JKLZO.cjs} +10 -10
  96. package/dist/{chunk-FSCJOTHF.cjs.map → chunk-EQ7JKLZO.cjs.map} +1 -1
  97. package/dist/{chunk-AQR6BHB3.cjs → chunk-F4NHQHEZ.cjs} +10 -10
  98. package/dist/{chunk-AQR6BHB3.cjs.map → chunk-F4NHQHEZ.cjs.map} +1 -1
  99. package/dist/{chunk-2G6ZEGYO.js → chunk-FL5UQRES.js} +4 -4
  100. package/dist/{chunk-2G6ZEGYO.js.map → chunk-FL5UQRES.js.map} +1 -1
  101. package/dist/{chunk-ZP2KPDNN.js → chunk-FLEQ2HBK.js} +3 -3
  102. package/dist/{chunk-ZP2KPDNN.js.map → chunk-FLEQ2HBK.js.map} +1 -1
  103. package/dist/{chunk-RAWG2FEU.js → chunk-FQ7ZPOTZ.js} +264 -18
  104. package/dist/chunk-FQ7ZPOTZ.js.map +1 -0
  105. package/dist/{chunk-O7XVCLXW.cjs → chunk-H7VE3FL4.cjs} +577 -82
  106. package/dist/chunk-H7VE3FL4.cjs.map +1 -0
  107. package/dist/{chunk-JNXZQBN3.js → chunk-ID4WXTKL.js} +1039 -482
  108. package/dist/chunk-ID4WXTKL.js.map +1 -0
  109. package/dist/{chunk-ZGOUVMVS.js → chunk-ISLPNELU.js} +17 -5
  110. package/dist/chunk-ISLPNELU.js.map +1 -0
  111. package/dist/{chunk-I73ATSAH.cjs → chunk-IX64T5OL.cjs} +4 -4
  112. package/dist/{chunk-I73ATSAH.cjs.map → chunk-IX64T5OL.cjs.map} +1 -1
  113. package/dist/{chunk-XDMPDUKL.cjs → chunk-J2ICGNHO.cjs} +8 -9
  114. package/dist/chunk-J2ICGNHO.cjs.map +1 -0
  115. package/dist/{chunk-KDRF3NR2.cjs → chunk-J7LXTUTP.cjs} +295 -201
  116. package/dist/chunk-J7LXTUTP.cjs.map +1 -0
  117. package/dist/{chunk-AO2WPYFZ.cjs → chunk-JQXSZHF2.cjs} +14 -4
  118. package/dist/chunk-JQXSZHF2.cjs.map +1 -0
  119. package/dist/{chunk-UTTW2Q3M.cjs → chunk-JXUTCSXX.cjs} +197 -133
  120. package/dist/chunk-JXUTCSXX.cjs.map +1 -0
  121. package/dist/{chunk-GT7NEXSU.js → chunk-KCO5EFJU.js} +3 -3
  122. package/dist/{chunk-GT7NEXSU.js.map → chunk-KCO5EFJU.js.map} +1 -1
  123. package/dist/{chunk-ARN3ZODS.cjs → chunk-KKYELPZ2.cjs} +6 -6
  124. package/dist/{chunk-ARN3ZODS.cjs.map → chunk-KKYELPZ2.cjs.map} +1 -1
  125. package/dist/{chunk-7Y6BV3TK.cjs → chunk-KMXWZLQX.cjs} +100 -100
  126. package/dist/{chunk-7Y6BV3TK.cjs.map → chunk-KMXWZLQX.cjs.map} +1 -1
  127. package/dist/{chunk-CDYRPI5U.js → chunk-MIJKEVV7.js} +4 -4
  128. package/dist/{chunk-CDYRPI5U.js.map → chunk-MIJKEVV7.js.map} +1 -1
  129. package/dist/{chunk-FFQGI67R.cjs → chunk-NAAMUYMS.cjs} +56 -44
  130. package/dist/chunk-NAAMUYMS.cjs.map +1 -0
  131. package/dist/{chunk-6TJ6PKPS.cjs → chunk-OOA273IJ.cjs} +27 -27
  132. package/dist/{chunk-6TJ6PKPS.cjs.map → chunk-OOA273IJ.cjs.map} +1 -1
  133. package/dist/{chunk-F2KVJ6FF.cjs → chunk-P7GTYOLB.cjs} +203 -117
  134. package/dist/chunk-P7GTYOLB.cjs.map +1 -0
  135. package/dist/{chunk-42XYPKZU.js → chunk-PVUI6KGR.js} +67 -3
  136. package/dist/chunk-PVUI6KGR.js.map +1 -0
  137. package/dist/{chunk-L5AUCL5P.js → chunk-Q6EDCUXV.js} +274 -14
  138. package/dist/chunk-Q6EDCUXV.js.map +1 -0
  139. package/dist/{chunk-ZPCKPLMX.cjs → chunk-QB6VMOJ2.cjs} +8 -8
  140. package/dist/{chunk-ZPCKPLMX.cjs.map → chunk-QB6VMOJ2.cjs.map} +1 -1
  141. package/dist/{chunk-3RPQDGUE.cjs → chunk-QC4MCOFV.cjs} +5 -5
  142. package/dist/{chunk-3RPQDGUE.cjs.map → chunk-QC4MCOFV.cjs.map} +1 -1
  143. package/dist/{chunk-4XRP2N6B.js → chunk-QLUXRWKL.js} +3 -3
  144. package/dist/{chunk-4XRP2N6B.js.map → chunk-QLUXRWKL.js.map} +1 -1
  145. package/dist/{chunk-OM6RIOA5.cjs → chunk-QR24DJDF.cjs} +13 -13
  146. package/dist/{chunk-OM6RIOA5.cjs.map → chunk-QR24DJDF.cjs.map} +1 -1
  147. package/dist/{chunk-YPVQYM3L.js → chunk-QRNYDV5Z.js} +138 -31
  148. package/dist/chunk-QRNYDV5Z.js.map +1 -0
  149. package/dist/{chunk-ZOHCFYXE.js → chunk-QT6V3YRH.js} +3 -3
  150. package/dist/{chunk-ZOHCFYXE.js.map → chunk-QT6V3YRH.js.map} +1 -1
  151. package/dist/{chunk-5C75HQYQ.js → chunk-RFRM3Q5K.js} +17 -5
  152. package/dist/chunk-RFRM3Q5K.js.map +1 -0
  153. package/dist/{chunk-NXIZL7ZZ.js → chunk-RUQS6M7G.js} +6 -6
  154. package/dist/chunk-RUQS6M7G.js.map +1 -0
  155. package/dist/{chunk-CI5NPLXX.js → chunk-S3ZRKJHY.js} +3 -3
  156. package/dist/{chunk-CI5NPLXX.js.map → chunk-S3ZRKJHY.js.map} +1 -1
  157. package/dist/{chunk-3V6D5DEC.js → chunk-S4KQ5LV4.js} +3 -3
  158. package/dist/{chunk-3V6D5DEC.js.map → chunk-S4KQ5LV4.js.map} +1 -1
  159. package/dist/{chunk-CTWZPYJW.js → chunk-TKORQCG4.js} +108 -15
  160. package/dist/chunk-TKORQCG4.js.map +1 -0
  161. package/dist/{chunk-2HKIID5K.js → chunk-TKP5T34P.js} +4 -5
  162. package/dist/chunk-TKP5T34P.js.map +1 -0
  163. package/dist/{chunk-X2XOQZT3.cjs → chunk-U5W4LKZV.cjs} +13 -9
  164. package/dist/chunk-U5W4LKZV.cjs.map +1 -0
  165. package/dist/{chunk-BLBG2VZ5.cjs → chunk-UCQ3BFSY.cjs} +372 -110
  166. package/dist/chunk-UCQ3BFSY.cjs.map +1 -0
  167. package/dist/{chunk-CUPJL6TS.js → chunk-V34A6R5V.js} +13 -4
  168. package/dist/chunk-V34A6R5V.js.map +1 -0
  169. package/dist/{chunk-LQLVJWUH.js → chunk-VTN3C3CH.js} +7 -7
  170. package/dist/chunk-VTN3C3CH.js.map +1 -0
  171. package/dist/{chunk-FY4VY5EV.cjs → chunk-VVQM4CZD.cjs} +20 -20
  172. package/dist/chunk-VVQM4CZD.cjs.map +1 -0
  173. package/dist/{chunk-LDCWO5B6.js → chunk-WDAVPX46.js} +3 -3
  174. package/dist/{chunk-LDCWO5B6.js.map → chunk-WDAVPX46.js.map} +1 -1
  175. package/dist/{chunk-5GV4JQNA.cjs → chunk-WDBXJOU5.cjs} +55 -43
  176. package/dist/chunk-WDBXJOU5.cjs.map +1 -0
  177. package/dist/{chunk-FMPZPOUD.js → chunk-WUFASQUO.js} +3 -3
  178. package/dist/{chunk-FMPZPOUD.js.map → chunk-WUFASQUO.js.map} +1 -1
  179. package/dist/{chunk-5ZPRE4CV.cjs → chunk-YDWLUT5V.cjs} +237 -130
  180. package/dist/chunk-YDWLUT5V.cjs.map +1 -0
  181. package/dist/{chunk-CVNGKTHO.js → chunk-YMTXMPV6.js} +4 -4
  182. package/dist/{chunk-CVNGKTHO.js.map → chunk-YMTXMPV6.js.map} +1 -1
  183. package/dist/{chunk-NDQLPKBX.cjs → chunk-YOALGKRE.cjs} +2092 -1535
  184. package/dist/chunk-YOALGKRE.cjs.map +1 -0
  185. package/dist/{chunk-OMQ2NBOR.cjs → chunk-Z3WO6MND.cjs} +27 -27
  186. package/dist/{chunk-OMQ2NBOR.cjs.map → chunk-Z3WO6MND.cjs.map} +1 -1
  187. package/dist/{chunk-V2GZBPY2.cjs → chunk-ZI6VQSZA.cjs} +310 -61
  188. package/dist/chunk-ZI6VQSZA.cjs.map +1 -0
  189. package/dist/{chunk-ZBV4LQD2.cjs → chunk-ZTAJL4DT.cjs} +4 -4
  190. package/dist/{chunk-ZBV4LQD2.cjs.map → chunk-ZTAJL4DT.cjs.map} +1 -1
  191. package/dist/core/index.cjs +27 -28
  192. package/dist/core/index.d.cts +5 -5
  193. package/dist/core/index.d.ts +5 -5
  194. package/dist/core/index.js +7 -8
  195. package/dist/{ddl-3unqC-kg.d.cts → ddl-BG4J805L.d.cts} +3 -3
  196. package/dist/{ddl-Bc4Dl8fu.d.ts → ddl-CgiS9QLj.d.ts} +3 -3
  197. package/dist/{define-graph-DBFnc7u_.d.ts → define-graph-BGrJahvp.d.ts} +1 -1
  198. package/dist/{define-graph-Byslw2OO.d.cts → define-graph-alREY2wj.d.cts} +1 -1
  199. package/dist/graph-extension/index.cjs +19 -20
  200. package/dist/graph-extension/index.d.cts +4 -4
  201. package/dist/graph-extension/index.d.ts +4 -4
  202. package/dist/graph-extension/index.js +4 -5
  203. package/dist/graph-merge/index.cjs +103 -104
  204. package/dist/graph-merge/index.cjs.map +1 -1
  205. package/dist/graph-merge/index.d.cts +9 -8
  206. package/dist/graph-merge/index.d.ts +9 -8
  207. package/dist/graph-merge/index.js +23 -24
  208. package/dist/graph-merge/index.js.map +1 -1
  209. package/dist/{index-DHXw7QAl.d.cts → index-BBxZCUdu.d.ts} +37 -7
  210. package/dist/{index-DQzVJBHa.d.ts → index-C3y_98iN.d.cts} +37 -7
  211. package/dist/index.cjs +209 -202
  212. package/dist/index.cjs.map +1 -1
  213. package/dist/index.d.cts +13 -13
  214. package/dist/index.d.ts +13 -13
  215. package/dist/index.js +33 -34
  216. package/dist/index.js.map +1 -1
  217. package/dist/indexes/index.cjs +13 -13
  218. package/dist/indexes/index.d.cts +4 -4
  219. package/dist/indexes/index.d.ts +4 -4
  220. package/dist/indexes/index.js +6 -6
  221. package/dist/interchange/index.cjs +50 -41
  222. package/dist/interchange/index.cjs.map +1 -1
  223. package/dist/interchange/index.d.cts +11 -11
  224. package/dist/interchange/index.d.ts +11 -11
  225. package/dist/interchange/index.js +24 -15
  226. package/dist/interchange/index.js.map +1 -1
  227. package/dist/{manager-U9_zopqr.d.cts → manager-KS7CGQQT.d.cts} +44 -6
  228. package/dist/{manager-Dl0-er1G.d.ts → manager-YoLEfcc1.d.ts} +44 -6
  229. package/dist/{materialize-indexes-BM3u0aXE.d.ts → materialize-indexes-Bhhyb1B3.d.ts} +1 -1
  230. package/dist/{materialize-indexes-DzMCetZe.d.cts → materialize-indexes-OHRWypW6.d.cts} +1 -1
  231. package/dist/{postgres-DpJqtbSX.d.cts → postgres-DpkW3R5Y.d.cts} +1 -1
  232. package/dist/{postgres-C5-WMKFA.d.ts → postgres-DwqyIniy.d.ts} +1 -1
  233. package/dist/profiler/index.d.cts +10 -9
  234. package/dist/profiler/index.d.ts +10 -9
  235. package/dist/provenance/index.cjs +38 -38
  236. package/dist/provenance/index.cjs.map +1 -1
  237. package/dist/provenance/index.d.cts +7 -7
  238. package/dist/provenance/index.d.ts +7 -7
  239. package/dist/provenance/index.js +8 -8
  240. package/dist/provenance/index.js.map +1 -1
  241. package/dist/schema/index.cjs +40 -41
  242. package/dist/schema/index.d.cts +7 -7
  243. package/dist/schema/index.d.ts +7 -7
  244. package/dist/schema/index.js +13 -14
  245. package/dist/{searchable-B4mUXZT6.d.cts → searchable-CIZL8Hyw.d.cts} +2 -2
  246. package/dist/{searchable-C7jmPNLT.d.ts → searchable-DLWEfC4a.d.ts} +2 -2
  247. package/dist/{sqlite-Ch5tSYQY.d.ts → sqlite-DY0WODUK.d.cts} +1 -1
  248. package/dist/{sqlite-Da7jiYu9.d.cts → sqlite-L-VIRzqA.d.ts} +1 -1
  249. package/dist/{store-view-DdwBNjZQ.d.ts → store-view-66p92IPi.d.ts} +1974 -1751
  250. package/dist/{store-view-D1F6KqsE.d.cts → store-view-A85FFRnk.d.cts} +1974 -1751
  251. package/dist/{temporal-CMpigMCW.d.cts → temporal-BNbjXqer.d.cts} +1 -1
  252. package/dist/{temporal-BtrTYTiB.d.ts → temporal-Bob6Nfbp.d.ts} +1 -1
  253. package/dist/{types-Dh-EgT-w.d.cts → types-Ch9a0Dx6.d.cts} +483 -20
  254. package/dist/{types-Dh-EgT-w.d.ts → types-Ch9a0Dx6.d.ts} +483 -20
  255. package/dist/{types-D2rU5Taq.d.ts → types-ClCzT-dT.d.ts} +1 -1
  256. package/dist/{types-G4sVM-76.d.cts → types-DeORZhxn.d.cts} +1 -1
  257. package/dist/{where-DbZ9XDOI.d.cts → where-DPw52ksb.d.cts} +1 -1
  258. package/dist/{where-B8Y21kig.d.ts → where-kWUZPvEA.d.ts} +1 -1
  259. package/package.json +1 -1
  260. package/dist/chunk-2HKIID5K.js.map +0 -1
  261. package/dist/chunk-33PAKPED.cjs.map +0 -1
  262. package/dist/chunk-42XYPKZU.js.map +0 -1
  263. package/dist/chunk-4WYFRACU.js.map +0 -1
  264. package/dist/chunk-5C75HQYQ.js.map +0 -1
  265. package/dist/chunk-5GV4JQNA.cjs.map +0 -1
  266. package/dist/chunk-5Q3P6OIC.cjs.map +0 -1
  267. package/dist/chunk-5ZPRE4CV.cjs.map +0 -1
  268. package/dist/chunk-64LERBFM.cjs.map +0 -1
  269. package/dist/chunk-AO2WPYFZ.cjs.map +0 -1
  270. package/dist/chunk-BLBG2VZ5.cjs.map +0 -1
  271. package/dist/chunk-CTWZPYJW.js.map +0 -1
  272. package/dist/chunk-CUPJL6TS.js.map +0 -1
  273. package/dist/chunk-DMZEVJGL.cjs.map +0 -1
  274. package/dist/chunk-ECU53PMN.cjs.map +0 -1
  275. package/dist/chunk-EQOQOT55.js.map +0 -1
  276. package/dist/chunk-F2KVJ6FF.cjs.map +0 -1
  277. package/dist/chunk-F7TDKSVB.cjs +0 -61
  278. package/dist/chunk-F7TDKSVB.cjs.map +0 -1
  279. package/dist/chunk-FFQGI67R.cjs.map +0 -1
  280. package/dist/chunk-FY4VY5EV.cjs.map +0 -1
  281. package/dist/chunk-HHBKGPEI.js.map +0 -1
  282. package/dist/chunk-JNXZQBN3.js.map +0 -1
  283. package/dist/chunk-KDRF3NR2.cjs.map +0 -1
  284. package/dist/chunk-KTBTSHU6.cjs.map +0 -1
  285. package/dist/chunk-L2BYRYHC.js.map +0 -1
  286. package/dist/chunk-L5AUCL5P.js.map +0 -1
  287. package/dist/chunk-LQLVJWUH.js.map +0 -1
  288. package/dist/chunk-M4GYQF2H.js.map +0 -1
  289. package/dist/chunk-NDQLPKBX.cjs.map +0 -1
  290. package/dist/chunk-NXIZL7ZZ.js.map +0 -1
  291. package/dist/chunk-O2GZM7UK.cjs.map +0 -1
  292. package/dist/chunk-O7XVCLXW.cjs.map +0 -1
  293. package/dist/chunk-OYJSYDIH.js.map +0 -1
  294. package/dist/chunk-RAWG2FEU.js.map +0 -1
  295. package/dist/chunk-RXOAXO3R.js +0 -59
  296. package/dist/chunk-RXOAXO3R.js.map +0 -1
  297. package/dist/chunk-U3YRCZ5L.cjs +0 -12
  298. package/dist/chunk-UTTW2Q3M.cjs.map +0 -1
  299. package/dist/chunk-UZLEQFTV.js.map +0 -1
  300. package/dist/chunk-V2GZBPY2.cjs.map +0 -1
  301. package/dist/chunk-VC26BUNP.js.map +0 -1
  302. package/dist/chunk-VGMNGWBR.cjs +0 -12
  303. package/dist/chunk-X2XOQZT3.cjs.map +0 -1
  304. package/dist/chunk-XDMPDUKL.cjs.map +0 -1
  305. package/dist/chunk-YPVQYM3L.js.map +0 -1
  306. package/dist/chunk-ZGOUVMVS.js.map +0 -1
  307. package/dist/chunk-ZIRC2U6G.js.map +0 -1
@@ -1,22 +1,88 @@
1
1
  'use strict';
2
2
 
3
- var chunkAQR6BHB3_cjs = require('./chunk-AQR6BHB3.cjs');
4
- var chunkOMQ2NBOR_cjs = require('./chunk-OMQ2NBOR.cjs');
5
- var chunk6TJ6PKPS_cjs = require('./chunk-6TJ6PKPS.cjs');
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
6
  var chunkZDH3DX3C_cjs = require('./chunk-ZDH3DX3C.cjs');
7
- var chunkECU53PMN_cjs = require('./chunk-ECU53PMN.cjs');
7
+ var chunkEKFUG4G7_cjs = require('./chunk-EKFUG4G7.cjs');
8
8
  var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
9
- var chunkAO2WPYFZ_cjs = require('./chunk-AO2WPYFZ.cjs');
9
+ var chunkJQXSZHF2_cjs = require('./chunk-JQXSZHF2.cjs');
10
10
  var chunkZY4GXIVN_cjs = require('./chunk-ZY4GXIVN.cjs');
11
- var chunkX2XOQZT3_cjs = require('./chunk-X2XOQZT3.cjs');
11
+ var chunkJXUTCSXX_cjs = require('./chunk-JXUTCSXX.cjs');
12
+ var chunkU5W4LKZV_cjs = require('./chunk-U5W4LKZV.cjs');
12
13
  var chunk764JHTLT_cjs = require('./chunk-764JHTLT.cjs');
13
- var chunkKTBTSHU6_cjs = require('./chunk-KTBTSHU6.cjs');
14
+ var chunkC4F7VJ5D_cjs = require('./chunk-C4F7VJ5D.cjs');
14
15
  var drizzleOrm = require('drizzle-orm');
15
16
 
17
+ // src/backend/edge-endpoint-sets.ts
18
+ var FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT = 6;
19
+ var FIND_EDGES_HETEROGENEOUS_FIXED_PARAM_COUNT = 4;
20
+ function assertLimitPerEndpoint(operation, graphId, limitPerEndpoint, kind) {
21
+ if (limitPerEndpoint === void 0 || Number.isInteger(limitPerEndpoint) && limitPerEndpoint > 0) {
22
+ return;
23
+ }
24
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
25
+ `${operation} \`limitPerEndpoint\` must be a positive integer, received ${String(limitPerEndpoint)}.`,
26
+ {
27
+ code: "EDGE_ENDPOINT_SET_INVALID",
28
+ graphId,
29
+ ...kind === void 0 ? {} : { kind }
30
+ },
31
+ {
32
+ suggestion: "Pass a positive integer to cap each endpoint's rows, or omit it for an unbounded read."
33
+ }
34
+ );
35
+ }
36
+ function resolveEdgeEndpointIds(params) {
37
+ assertLimitPerEndpoint(
38
+ "findEdgesByEndpointSet",
39
+ params.graphId,
40
+ params.limitPerEndpoint,
41
+ params.kind
42
+ );
43
+ return [...new Set(params.endpointIds)];
44
+ }
45
+ function endpointKey(endpoint) {
46
+ return `${endpoint.kind}\0${endpoint.id}`;
47
+ }
48
+ function resolveHeterogeneousEdgeRead(params, maxBindParameters) {
49
+ assertLimitPerEndpoint(
50
+ "findEdgesByHeterogeneousEndpointSet",
51
+ params.graphId,
52
+ params.limitPerEndpoint
53
+ );
54
+ const edgeKinds = [...new Set(params.edgeKinds)];
55
+ const endpoints = [
56
+ ...new Map(
57
+ params.endpoints.map((endpoint) => [endpointKey(endpoint), endpoint])
58
+ ).values()
59
+ ];
60
+ if (edgeKinds.length === 0 || endpoints.length === 0) {
61
+ return { edgeKinds, endpoints, endpointChunkSize: 1 };
62
+ }
63
+ const endpointBindBudget = maxBindParameters - FIND_EDGES_HETEROGENEOUS_FIXED_PARAM_COUNT - edgeKinds.length;
64
+ const endpointChunkSize = Math.floor(endpointBindBudget / 2);
65
+ if (endpointChunkSize >= 1) {
66
+ return { edgeKinds, endpoints, endpointChunkSize };
67
+ }
68
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
69
+ "findEdgesByHeterogeneousEndpointSet cannot fit one endpoint and the selected edge kinds within the backend bind-parameter budget.",
70
+ {
71
+ code: "EDGE_HETEROGENEOUS_READ_BIND_BUDGET_EXCEEDED",
72
+ graphId: params.graphId,
73
+ edgeKindCount: edgeKinds.length,
74
+ maxBindParameters
75
+ },
76
+ {
77
+ suggestion: "Select fewer edge kinds in one call or use a backend with a larger bind-parameter budget."
78
+ }
79
+ );
80
+ }
81
+
16
82
  // src/backend/live-node-candidates.ts
17
83
  function buildLiveNodeCandidates(nodesTableName, graphId, nodeKind, now) {
18
- const nodes = chunkX2XOQZT3_cjs.sql.identifier(nodesTableName);
19
- return chunkX2XOQZT3_cjs.sql`
84
+ const nodes = chunkU5W4LKZV_cjs.sql.identifier(nodesTableName);
85
+ return chunkU5W4LKZV_cjs.sql`
20
86
  SELECT "id" AS node_id
21
87
  FROM ${nodes}
22
88
  WHERE "graph_id" = ${graphId}
@@ -57,10 +123,10 @@ function vectorSlotFromDropIndexParams(params) {
57
123
  };
58
124
  }
59
125
  function mapVectorWriteError(error, params) {
60
- const mismatch = chunkAO2WPYFZ_cjs.parseDimensionMismatch(error);
126
+ const mismatch = chunkJQXSZHF2_cjs.parseDimensionMismatch(error);
61
127
  if (mismatch === void 0) return error;
62
128
  const attempted = mismatch.actual ?? "a different number of";
63
- return new chunkKTBTSHU6_cjs.EmbeddingDimensionChangedError(
129
+ return new chunkC4F7VJ5D_cjs.EmbeddingDimensionChangedError(
64
130
  `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.`,
65
131
  {
66
132
  kind: params.nodeKind,
@@ -76,7 +142,7 @@ var SQLITE_CONTRIBUTION_MAT_TIMESTAMPS = {
76
142
  encode: (value) => value
77
143
  };
78
144
  var POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = {
79
- decode: chunkAQR6BHB3_cjs.formatPostgresTimestamp,
145
+ decode: chunkF4NHQHEZ_cjs.formatPostgresTimestamp,
80
146
  encode: (value) => new Date(value)
81
147
  };
82
148
  function mapContributionMaterializationRow(row, decode) {
@@ -135,6 +201,32 @@ function evaluateContributionState(row, signature) {
135
201
  if (row.materializedAt === void 0) return "missing";
136
202
  return "initialized";
137
203
  }
204
+ function diagnoseContribution(row, signature, tableExists) {
205
+ if (!tableExists) {
206
+ if (row === void 0) return void 0;
207
+ if (row.materializedAt !== void 0) return "orphaned-marker";
208
+ return row.lastError === void 0 ? void 0 : "failed-materialization";
209
+ }
210
+ if (row?.materializedAt !== void 0 && row.signature !== signature) {
211
+ return "stale";
212
+ }
213
+ const state = evaluateContributionState(row, signature);
214
+ switch (state) {
215
+ case "initialized": {
216
+ return void 0;
217
+ }
218
+ case "stale": {
219
+ return "stale";
220
+ }
221
+ case "missing":
222
+ case "failed": {
223
+ return "missing-marker";
224
+ }
225
+ default: {
226
+ return state;
227
+ }
228
+ }
229
+ }
138
230
  function identityOf(graphId, contribution) {
139
231
  return {
140
232
  graphId,
@@ -190,7 +282,7 @@ function gateFulltextMethods(source, assert) {
190
282
  return gated;
191
283
  }
192
284
  function gateFulltext(tx, assert) {
193
- return chunkECU53PMN_cjs.createBackendOverlay(
285
+ return chunkEKFUG4G7_cjs.createBackendOverlay(
194
286
  tx,
195
287
  gateFulltextMethods(tx, assert)
196
288
  );
@@ -207,6 +299,7 @@ function contributionKey(graphId, contribution) {
207
299
  function createContributionMaterializer(deps) {
208
300
  const { dialect, fulltextStrategy, fulltextTableName } = deps;
209
301
  const initializedSignatures = /* @__PURE__ */ new Map();
302
+ const uncacheableKeys = /* @__PURE__ */ new Set();
210
303
  const computedSignatures = /* @__PURE__ */ new Map();
211
304
  async function resolveContributionSignature(key, contribution) {
212
305
  const cached = computedSignatures.get(key);
@@ -237,7 +330,12 @@ function createContributionMaterializer(deps) {
237
330
  }
238
331
  }
239
332
  function runtimeContributions() {
240
- return chunkOMQ2NBOR_cjs.runtimeStrategyContributions(fulltextStrategy, fulltextTableName);
333
+ return chunkZ3WO6MND_cjs.runtimeStrategyContributions(fulltextStrategy, fulltextTableName);
334
+ }
335
+ function cacheInitializedSignature(key, signature) {
336
+ if (!uncacheableKeys.has(key)) {
337
+ initializedSignatures.set(key, signature);
338
+ }
241
339
  }
242
340
  async function materializeOne(graphId, contribution, signature, existing, options) {
243
341
  const force = options?.force === true;
@@ -259,13 +357,13 @@ function createContributionMaterializer(deps) {
259
357
  await deps.recordMarker({
260
358
  ...identity,
261
359
  signature,
262
- attemptedAt: chunkAQR6BHB3_cjs.nowIso(),
360
+ attemptedAt: chunkF4NHQHEZ_cjs.nowIso(),
263
361
  materializedAt: void 0,
264
362
  error: error.message
265
363
  });
266
364
  throw error;
267
365
  }
268
- const attemptedAt = chunkAQR6BHB3_cjs.nowIso();
366
+ const attemptedAt = chunkF4NHQHEZ_cjs.nowIso();
269
367
  try {
270
368
  for (const statement of contribution.createDdl) {
271
369
  await deps.execDdl(statement);
@@ -301,12 +399,13 @@ function createContributionMaterializer(deps) {
301
399
  rows: indexMarkerRows(graphId, await deps.getMarkers(graphId))
302
400
  };
303
401
  } catch (error) {
304
- if (!chunkAO2WPYFZ_cjs.isMissingTableError(error)) throw error;
402
+ if (!chunkJQXSZHF2_cjs.isMissingTableError(error)) throw error;
305
403
  return { kind: "missing-table", error };
306
404
  }
307
405
  }
308
406
  async function ensureContributions(graphId, contributions, options) {
309
407
  const force = options?.force === true;
408
+ const bypassCache = options?.bypassCache === true;
310
409
  const entries = await Promise.all(
311
410
  contributions.map(async (contribution) => {
312
411
  const key = contributionKey(graphId, contribution);
@@ -317,8 +416,14 @@ function createContributionMaterializer(deps) {
317
416
  };
318
417
  })
319
418
  );
320
- const pending = force ? entries : entries.filter(
321
- (entry) => initializedSignatures.get(entry.key) !== entry.signature
419
+ if (bypassCache) {
420
+ for (const entry of entries) {
421
+ uncacheableKeys.add(entry.key);
422
+ initializedSignatures.delete(entry.key);
423
+ }
424
+ }
425
+ const pending = force || bypassCache ? entries : entries.filter(
426
+ (entry) => uncacheableKeys.has(entry.key) || initializedSignatures.get(entry.key) !== entry.signature
322
427
  );
323
428
  if (pending.length === 0) return;
324
429
  const initialRead = force ? void 0 : await readMarkerRows(graphId);
@@ -329,7 +434,7 @@ function createContributionMaterializer(deps) {
329
434
  ) === "initialized"
330
435
  )) {
331
436
  for (const entry of pending) {
332
- initializedSignatures.set(entry.key, entry.signature);
437
+ cacheInitializedSignature(entry.key, entry.signature);
333
438
  }
334
439
  return;
335
440
  }
@@ -350,7 +455,7 @@ function createContributionMaterializer(deps) {
350
455
  }
351
456
  );
352
457
  if (outcome === "materialized") {
353
- initializedSignatures.set(entry.key, entry.signature);
458
+ cacheInitializedSignature(entry.key, entry.signature);
354
459
  }
355
460
  }
356
461
  }
@@ -366,14 +471,14 @@ function createContributionMaterializer(deps) {
366
471
  })
367
472
  );
368
473
  const pending = entries.filter(
369
- (entry) => initializedSignatures.get(entry.key) !== entry.signature
474
+ (entry) => uncacheableKeys.has(entry.key) || initializedSignatures.get(entry.key) !== entry.signature
370
475
  );
371
476
  if (pending.length === 0) return;
372
477
  const read = await readMarkerRows(graphId);
373
478
  if (read.kind === "missing-table") {
374
479
  const first = pending[0];
375
480
  if (first === void 0) return;
376
- throw new chunkKTBTSHU6_cjs.StoreNotInitializedError(graphId, "missing", {
481
+ throw new chunkC4F7VJ5D_cjs.StoreNotInitializedError(graphId, "missing", {
377
482
  cause: read.error,
378
483
  details: { logicalName: first.contribution.logicalName }
379
484
  });
@@ -382,11 +487,11 @@ function createContributionMaterializer(deps) {
382
487
  const { contribution, key, signature } = entry;
383
488
  const state = evaluateContributionState(read.rows.get(key), signature);
384
489
  if (state !== "initialized") {
385
- throw new chunkKTBTSHU6_cjs.StoreNotInitializedError(graphId, state, {
490
+ throw new chunkC4F7VJ5D_cjs.StoreNotInitializedError(graphId, state, {
386
491
  details: { logicalName: contribution.logicalName }
387
492
  });
388
493
  }
389
- initializedSignatures.set(key, signature);
494
+ cacheInitializedSignature(key, signature);
390
495
  }
391
496
  }
392
497
  async function ensureRuntimeContributions(graphId) {
@@ -422,15 +527,123 @@ function createContributionMaterializer(deps) {
422
527
  await assertContributions(graphId, contributions);
423
528
  }
424
529
  }
425
- async function dropVectorSlot(slot) {
530
+ function verificationTargetsByGraph(graphId, vectorSlots) {
531
+ const targets = /* @__PURE__ */ new Map();
532
+ function addTarget(id, target) {
533
+ const existing = targets.get(id);
534
+ if (existing === void 0) targets.set(id, [target]);
535
+ else existing.push(target);
536
+ }
537
+ for (const contribution of runtimeContributions()) {
538
+ addTarget(graphId, { contribution });
539
+ }
540
+ const { vectorStrategy } = deps;
541
+ if (vectorStrategy !== void 0) {
542
+ for (const slot of vectorSlots) {
543
+ for (const contribution of vectorStrategy.ownedTables(slot)) {
544
+ addTarget(slot.graphId, {
545
+ contribution,
546
+ kind: slot.nodeKind,
547
+ fieldPath: slot.fieldPath
548
+ });
549
+ }
550
+ }
551
+ }
552
+ return targets;
553
+ }
554
+ async function diagnoseContributions(graphId, vectorSlots) {
555
+ const targetsByGraph = verificationTargetsByGraph(graphId, vectorSlots);
556
+ const probes = /* @__PURE__ */ new Map();
557
+ function tableExists(tableName) {
558
+ const pending = probes.get(tableName);
559
+ if (pending !== void 0) return pending;
560
+ const probe = deps.tableExists(tableName);
561
+ probes.set(tableName, probe);
562
+ return probe;
563
+ }
564
+ const diagnosed = [];
565
+ for (const [id, targets] of targetsByGraph) {
566
+ const read = await readMarkerRows(id);
567
+ const rows = read.kind === "rows" ? read.rows : /* @__PURE__ */ new Map();
568
+ for (const { contribution, kind, fieldPath } of targets) {
569
+ const key = contributionKey(id, contribution);
570
+ const row = rows.get(key);
571
+ const state = diagnoseContribution(
572
+ row,
573
+ await resolveContributionSignature(key, contribution),
574
+ await tableExists(contribution.tableName)
575
+ );
576
+ if (state === void 0) continue;
577
+ diagnosed.push({
578
+ graphId: id,
579
+ contribution,
580
+ diagnostic: {
581
+ owner: contribution.owner,
582
+ logicalName: contribution.logicalName,
583
+ physicalName: contribution.tableName,
584
+ ...kind === void 0 ? {} : { kind },
585
+ ...fieldPath === void 0 ? {} : { fieldPath },
586
+ state,
587
+ // The recorded reason, carried through verbatim. `state` folds
588
+ // several marker verdicts together because they share a repair;
589
+ // this is what keeps the fold from also discarding the one thing
590
+ // the catalog can never tell the operator.
591
+ ...row?.lastError === void 0 ? {} : { lastError: row.lastError }
592
+ }
593
+ });
594
+ }
595
+ }
596
+ return diagnosed;
597
+ }
598
+ async function verifyContributions(graphId, vectorSlots) {
599
+ const diagnosed = await diagnoseContributions(graphId, vectorSlots);
600
+ return diagnosed.map((entry) => entry.diagnostic);
601
+ }
602
+ async function repairContributions(graphId, vectorSlots) {
603
+ const diagnosed = await diagnoseContributions(graphId, vectorSlots);
604
+ const results = [];
605
+ for (const { graphId: targetGraphId, contribution, diagnostic } of diagnosed) {
606
+ if (diagnostic.state === "stale" || diagnostic.state === "orphaned-marker") {
607
+ results.push({ diagnostic, status: "requires-rebuild" });
608
+ continue;
609
+ }
610
+ try {
611
+ await ensureContributions(targetGraphId, [contribution], {
612
+ bypassCache: true
613
+ });
614
+ results.push({ diagnostic, status: "repaired" });
615
+ } catch (error) {
616
+ results.push({
617
+ diagnostic,
618
+ status: "failed",
619
+ error: error instanceof Error ? error.message : String(error)
620
+ });
621
+ }
622
+ }
623
+ return {
624
+ results,
625
+ remaining: await verifyContributions(graphId, vectorSlots)
626
+ };
627
+ }
628
+ function evictVectorSlot(slot) {
426
629
  if (deps.vectorStrategy === void 0) return;
427
630
  for (const contribution of deps.vectorStrategy.ownedTables(slot)) {
428
- await deps.deleteMarker(identityOf(slot.graphId, contribution));
429
631
  const key = contributionKey(slot.graphId, contribution);
632
+ uncacheableKeys.add(key);
430
633
  initializedSignatures.delete(key);
431
634
  computedSignatures.delete(key);
432
635
  }
433
636
  }
637
+ async function dropVectorSlot(slot) {
638
+ if (deps.vectorStrategy === void 0) return;
639
+ try {
640
+ for (const contribution of deps.vectorStrategy.ownedTables(slot)) {
641
+ await deps.deleteMarker(identityOf(slot.graphId, contribution));
642
+ }
643
+ } finally {
644
+ evictVectorSlot(slot);
645
+ }
646
+ }
434
647
  return {
435
648
  ensureRuntimeContributions,
436
649
  assertInitialized,
@@ -438,7 +651,10 @@ function createContributionMaterializer(deps) {
438
651
  ensureVectorSlots,
439
652
  assertVectorSlot,
440
653
  assertVectorSlots,
441
- dropVectorSlot
654
+ dropVectorSlot,
655
+ evictVectorSlot,
656
+ verifyContributions,
657
+ repairContributions
442
658
  };
443
659
  }
444
660
  var SQLITE_INDEX_MAT_TIMESTAMPS = {
@@ -446,7 +662,7 @@ var SQLITE_INDEX_MAT_TIMESTAMPS = {
446
662
  encode: (value) => value
447
663
  };
448
664
  var POSTGRES_INDEX_MAT_TIMESTAMPS = {
449
- decode: chunkAQR6BHB3_cjs.formatPostgresTimestamp,
665
+ decode: chunkF4NHQHEZ_cjs.formatPostgresTimestamp,
450
666
  encode: (value) => new Date(value)
451
667
  };
452
668
  function mapMaterializationRow(row, decode) {
@@ -504,7 +720,7 @@ var SQLITE_KIND_REMOVAL_TIMESTAMPS = {
504
720
  encode: (value) => value
505
721
  };
506
722
  var POSTGRES_KIND_REMOVAL_TIMESTAMPS = {
507
- decode: chunkAQR6BHB3_cjs.formatPostgresTimestamp,
723
+ decode: chunkF4NHQHEZ_cjs.formatPostgresTimestamp,
508
724
  encode: (value) => new Date(value)
509
725
  };
510
726
  function mapKindRemovalRow(row, decode) {
@@ -671,12 +887,12 @@ function present(value) {
671
887
  function mapHybridSearchRow(row, toNodeRow) {
672
888
  return {
673
889
  node: toNodeRow(row),
674
- fusedScore: chunkAQR6BHB3_cjs.coerceNumericScore(row["fused_score"]),
890
+ fusedScore: chunkF4NHQHEZ_cjs.coerceNumericScore(row["fused_score"]),
675
891
  ...present(row["vector_rank"]) ? { vectorRank: Number(row["vector_rank"]) } : {},
676
- ...present(row["vector_score"]) ? { vectorScore: chunkAQR6BHB3_cjs.coerceNumericScore(row["vector_score"]) } : {},
892
+ ...present(row["vector_score"]) ? { vectorScore: chunkF4NHQHEZ_cjs.coerceNumericScore(row["vector_score"]) } : {},
677
893
  ...present(row["fulltext_rank"]) ? { fulltextRank: Number(row["fulltext_rank"]) } : {},
678
894
  ...present(row["fulltext_score"]) ? {
679
- fulltextScore: chunkAQR6BHB3_cjs.coerceNumericScore(
895
+ fulltextScore: chunkF4NHQHEZ_cjs.coerceNumericScore(
680
896
  row["fulltext_score"]
681
897
  )
682
898
  } : {},
@@ -790,6 +1006,19 @@ function buildCountNodesByKind(tables, params) {
790
1006
  WHERE ${whereClause}
791
1007
  `;
792
1008
  }
1009
+ function buildIdSetCondition(column, ids) {
1010
+ return drizzleOrm.sql`${column} IN (${drizzleOrm.sql.join(
1011
+ ids.map((id) => drizzleOrm.sql`${id}`),
1012
+ drizzleOrm.sql`, `
1013
+ )})`;
1014
+ }
1015
+ function buildEdgeOrdering(tables, orderBy) {
1016
+ const { edges } = tables;
1017
+ return orderBy === "id" ? { qualified: drizzleOrm.sql`${edges.id} ASC`, bare: drizzleOrm.sql.raw(`"id" ASC`) } : {
1018
+ qualified: drizzleOrm.sql`${edges.createdAt} DESC, ${edges.id} DESC`,
1019
+ bare: drizzleOrm.sql.raw(`"created_at" DESC, "id" DESC`)
1020
+ };
1021
+ }
793
1022
  function buildFindEdgesByKind(tables, params) {
794
1023
  const { edges } = tables;
795
1024
  const conditions = [
@@ -813,7 +1042,10 @@ function buildFindEdgesByKind(tables, params) {
813
1042
  conditions.push(drizzleOrm.sql`${edges.id} > ${params.after}`);
814
1043
  }
815
1044
  const whereClause = drizzleOrm.sql.join(conditions, drizzleOrm.sql` AND `);
816
- const orderByClause = params.orderBy === "id" ? drizzleOrm.sql`${edges.id} ASC` : drizzleOrm.sql`${edges.createdAt} DESC, ${edges.id} DESC`;
1045
+ const { qualified: orderByClause } = buildEdgeOrdering(
1046
+ tables,
1047
+ params.orderBy
1048
+ );
817
1049
  if (params.limit !== void 0 && params.offset !== void 0) {
818
1050
  return drizzleOrm.sql`
819
1051
  SELECT * FROM ${edges}
@@ -836,6 +1068,94 @@ function buildFindEdgesByKind(tables, params) {
836
1068
  ORDER BY ${orderByClause}
837
1069
  `;
838
1070
  }
1071
+ function buildFindEdgesByEndpointSet(tables, params, endpointIds) {
1072
+ const { edges } = tables;
1073
+ const fromSide = params.side === "from";
1074
+ const kindColumn = fromSide ? edges.fromKind : edges.toKind;
1075
+ const idColumn = fromSide ? edges.fromId : edges.toId;
1076
+ const whereClause = drizzleOrm.sql.join(
1077
+ [
1078
+ drizzleOrm.sql`${edges.graphId} = ${params.graphId}`,
1079
+ drizzleOrm.sql`${edges.kind} = ${params.kind}`,
1080
+ ...buildTemporalConditions(edges, params),
1081
+ drizzleOrm.sql`${kindColumn} = ${params.endpointKind}`,
1082
+ buildIdSetCondition(idColumn, endpointIds)
1083
+ ],
1084
+ drizzleOrm.sql` AND `
1085
+ );
1086
+ const { qualified: orderByClause, bare: derivedOrderByClause } = buildEdgeOrdering(tables, void 0);
1087
+ if (params.limitPerEndpoint === void 0) {
1088
+ return drizzleOrm.sql`
1089
+ SELECT * FROM ${edges}
1090
+ WHERE ${whereClause}
1091
+ ORDER BY ${orderByClause}
1092
+ `;
1093
+ }
1094
+ const ranked = drizzleOrm.sql`
1095
+ SELECT *, ROW_NUMBER() OVER (
1096
+ PARTITION BY ${idColumn} ORDER BY ${orderByClause}
1097
+ ) AS endpoint_rank
1098
+ FROM ${edges}
1099
+ WHERE ${whereClause}
1100
+ `;
1101
+ return drizzleOrm.sql`
1102
+ SELECT * FROM (${ranked}) AS ranked_edges
1103
+ WHERE endpoint_rank <= ${params.limitPerEndpoint}
1104
+ ORDER BY ${derivedOrderByClause}
1105
+ `;
1106
+ }
1107
+ function buildFindEdgesByHeterogeneousEndpointSet(tables, params, endpoints, edgeKinds) {
1108
+ const { edges } = tables;
1109
+ const fromSide = params.side === "from";
1110
+ const kindColumn = fromSide ? edges.fromKind : edges.toKind;
1111
+ const idColumn = fromSide ? edges.fromId : edges.toId;
1112
+ const requestedKind = drizzleOrm.sql.raw(`requested_endpoints."endpoint_kind"`);
1113
+ const requestedId = drizzleOrm.sql.raw(`requested_endpoints."endpoint_id"`);
1114
+ const requestedRows = drizzleOrm.sql.join(
1115
+ endpoints.map((endpoint) => drizzleOrm.sql`(${endpoint.kind}, ${endpoint.id})`),
1116
+ drizzleOrm.sql`, `
1117
+ );
1118
+ const whereClause = drizzleOrm.sql.join(
1119
+ [
1120
+ drizzleOrm.sql`${edges.graphId} = ${params.graphId}`,
1121
+ buildIdSetCondition(edges.kind, edgeKinds),
1122
+ ...buildTemporalConditions(edges, params)
1123
+ ],
1124
+ drizzleOrm.sql` AND `
1125
+ );
1126
+ const joinClause = drizzleOrm.sql`
1127
+ FROM ${edges}
1128
+ INNER JOIN requested_endpoints
1129
+ ON ${kindColumn} = ${requestedKind}
1130
+ AND ${idColumn} = ${requestedId}
1131
+ WHERE ${whereClause}
1132
+ `;
1133
+ const { qualified: orderByClause, bare: derivedOrderByClause } = buildEdgeOrdering(tables, void 0);
1134
+ if (params.limitPerEndpoint === void 0) {
1135
+ return drizzleOrm.sql`
1136
+ WITH requested_endpoints(endpoint_kind, endpoint_id) AS (
1137
+ VALUES ${requestedRows}
1138
+ )
1139
+ SELECT ${edges}.*
1140
+ ${joinClause}
1141
+ ORDER BY ${orderByClause}
1142
+ `;
1143
+ }
1144
+ const ranked = drizzleOrm.sql`
1145
+ SELECT ${edges}.*, ROW_NUMBER() OVER (
1146
+ PARTITION BY ${kindColumn}, ${idColumn} ORDER BY ${orderByClause}
1147
+ ) AS endpoint_rank
1148
+ ${joinClause}
1149
+ `;
1150
+ return drizzleOrm.sql`
1151
+ WITH requested_endpoints(endpoint_kind, endpoint_id) AS (
1152
+ VALUES ${requestedRows}
1153
+ )
1154
+ SELECT * FROM (${ranked}) AS ranked_edges
1155
+ WHERE endpoint_rank <= ${params.limitPerEndpoint}
1156
+ ORDER BY ${derivedOrderByClause}
1157
+ `;
1158
+ }
839
1159
  function buildCountEdgesByKind(tables, params) {
840
1160
  const { edges } = tables;
841
1161
  const conditions = [
@@ -1082,11 +1402,11 @@ function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
1082
1402
  assertValidSearchParams(params);
1083
1403
  const mode = resolveMode(params.mode);
1084
1404
  const table = quotedTableName(tableName);
1085
- const matchCondition = chunk6TJ6PKPS_cjs.toDrizzleSql(
1405
+ const matchCondition = chunkOOA273IJ_cjs.toDrizzleSql(
1086
1406
  strategy.matchCondition(tableName, params.query, mode, params.language),
1087
1407
  dialect
1088
1408
  );
1089
- const rankExpression = chunk6TJ6PKPS_cjs.toDrizzleSql(
1409
+ const rankExpression = chunkOOA273IJ_cjs.toDrizzleSql(
1090
1410
  strategy.rankExpression(tableName, params.query, mode, params.language),
1091
1411
  dialect
1092
1412
  );
@@ -1099,10 +1419,10 @@ function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
1099
1419
  conditions.push(drizzleOrm.sql`${rankExpression} >= ${params.minScore}`);
1100
1420
  }
1101
1421
  if (candidates !== void 0) {
1102
- const candidateSql = chunkX2XOQZT3_cjs.isSqlFragment(candidates) ? chunk6TJ6PKPS_cjs.toDrizzleSql(candidates, dialect) : candidates;
1422
+ const candidateSql = chunkU5W4LKZV_cjs.isSqlFragment(candidates) ? chunkOOA273IJ_cjs.toDrizzleSql(candidates, dialect) : candidates;
1103
1423
  conditions.push(drizzleOrm.sql`"node_id" IN (${candidateSql})`);
1104
1424
  }
1105
- const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ? chunk6TJ6PKPS_cjs.toDrizzleSql(
1425
+ const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ? chunkOOA273IJ_cjs.toDrizzleSql(
1106
1426
  strategy.snippetExpression(
1107
1427
  tableName,
1108
1428
  params.query,
@@ -1245,6 +1565,37 @@ function buildUpdateNode(tables, params, timestamp) {
1245
1565
  RETURNING *
1246
1566
  `;
1247
1567
  }
1568
+ function buildUpdateNodeSet(tables, dialect, params, timestamp) {
1569
+ const { nodes } = tables;
1570
+ const adapter = chunkJXUTCSXX_cjs.getDialect(dialect);
1571
+ const patchedProps = chunkOOA273IJ_cjs.toDrizzleSql(
1572
+ adapter.jsonSetProperties(
1573
+ chunkU5W4LKZV_cjs.sql.identifier(nodes.props.name),
1574
+ params.patch,
1575
+ params.unsetProperties ?? []
1576
+ ),
1577
+ dialect
1578
+ );
1579
+ const candidateIds = chunkOOA273IJ_cjs.toDrizzleSql(params.candidateIds, dialect);
1580
+ const candidateIdColumn = chunkOOA273IJ_cjs.toDrizzleSql(
1581
+ chunkU5W4LKZV_cjs.sql.identifier(params.candidateIdColumn),
1582
+ dialect
1583
+ );
1584
+ return drizzleOrm.sql`
1585
+ UPDATE ${nodes}
1586
+ SET ${quotedColumn(nodes.props)} = ${patchedProps},
1587
+ ${quotedColumn(nodes.updatedAt)} = ${timestamp},
1588
+ ${quotedColumn(nodes.version)} = ${quotedColumn(nodes.version)} + 1
1589
+ WHERE ${nodes.graphId} = ${params.graphId}
1590
+ AND ${nodes.kind} = ${params.kind}
1591
+ AND ${nodes.deletedAt} IS NULL
1592
+ AND ${nodes.id} IN (
1593
+ SELECT ${candidateIdColumn}
1594
+ FROM (${candidateIds}) AS tg_set_candidates
1595
+ )
1596
+ RETURNING *
1597
+ `;
1598
+ }
1248
1599
  function buildDeleteNode(tables, params, timestamp) {
1249
1600
  const { nodes } = tables;
1250
1601
  return drizzleOrm.sql`
@@ -1480,12 +1831,23 @@ function buildDeleteUnique(tables, params, timestamp) {
1480
1831
  AND ${uniques.deletedAt} IS NULL
1481
1832
  `;
1482
1833
  }
1483
- function buildHardDeleteUniquesByNode(tables, graphId, nodeId) {
1834
+ function buildHardDeleteUniquesByNode(tables, graphId, concreteKind, nodeId) {
1835
+ return buildHardDeleteUniquesByNodeIds(tables, {
1836
+ graphId,
1837
+ concreteKind,
1838
+ nodeIds: [nodeId]
1839
+ });
1840
+ }
1841
+ function buildHardDeleteUniquesByNodeIds(tables, params) {
1484
1842
  const { uniques } = tables;
1485
1843
  return drizzleOrm.sql`
1486
1844
  DELETE FROM ${uniques}
1487
- WHERE ${uniques.graphId} = ${graphId}
1488
- AND ${uniques.nodeId} = ${nodeId}
1845
+ WHERE ${uniques.graphId} = ${params.graphId}
1846
+ AND ${uniques.concreteKind} = ${params.concreteKind}
1847
+ AND ${uniques.nodeId} IN (${drizzleOrm.sql.join(
1848
+ params.nodeIds.map((nodeId) => drizzleOrm.sql`${nodeId}`),
1849
+ drizzleOrm.sql`, `
1850
+ )})
1489
1851
  `;
1490
1852
  }
1491
1853
  function buildCheckUnique(tables, params) {
@@ -1573,9 +1935,12 @@ var COMMON_TABLE_OPERATION_BUILDERS = {
1573
1935
  buildFindNodesByKind,
1574
1936
  buildCountNodesByKind,
1575
1937
  buildFindEdgesByKind,
1938
+ buildFindEdgesByEndpointSet,
1939
+ buildFindEdgesByHeterogeneousEndpointSet,
1576
1940
  buildCountEdgesByKind,
1577
1941
  buildDeleteUnique,
1578
1942
  buildHardDeleteUniquesByNode,
1943
+ buildHardDeleteUniquesByNodeIds,
1579
1944
  buildCheckUnique,
1580
1945
  buildCheckUniqueBatch,
1581
1946
  buildGetSchemaVersion
@@ -1586,16 +1951,17 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1586
1951
  COMMON_TABLE_OPERATION_BUILDERS
1587
1952
  );
1588
1953
  const fulltextTable = tables.fulltextTableName;
1954
+ const contributionMaterializations = tables.contributionMaterializations;
1589
1955
  const fulltextBuilders = {
1590
- buildUpsertFulltext: (params, timestamp) => fulltextStrategy.buildUpsert(fulltextTable, params, timestamp).map((statement) => chunk6TJ6PKPS_cjs.toDrizzleSql(statement, dialect)),
1591
- buildDeleteFulltext: (params) => fulltextStrategy.buildDelete(fulltextTable, params).map((statement) => chunk6TJ6PKPS_cjs.toDrizzleSql(statement, dialect)),
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)),
1592
1958
  buildDeleteFulltextByNode: (graphId, nodeKind, nodeId) => fulltextStrategy.buildDelete(fulltextTable, {
1593
1959
  graphId,
1594
1960
  nodeKind,
1595
1961
  nodeId
1596
- }).map((statement) => chunk6TJ6PKPS_cjs.toDrizzleSql(statement, dialect)),
1597
- buildUpsertFulltextBatch: (params, timestamp) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp).map((statement) => chunk6TJ6PKPS_cjs.toDrizzleSql(statement, dialect)),
1598
- buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params).map((statement) => chunk6TJ6PKPS_cjs.toDrizzleSql(statement, dialect)),
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)),
1599
1965
  buildFulltextSearch: (params) => buildFulltextSearch(
1600
1966
  fulltextTable,
1601
1967
  params,
@@ -1607,7 +1973,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1607
1973
  tables.nodes,
1608
1974
  params.graphId,
1609
1975
  params.nodeKind,
1610
- chunkAQR6BHB3_cjs.nowIso()
1976
+ chunkF4NHQHEZ_cjs.nowIso()
1611
1977
  )
1612
1978
  ),
1613
1979
  buildHybridSearch: (params, vectorSql, vectorScoreDescending) => {
@@ -1615,7 +1981,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1615
1981
  tables.nodes,
1616
1982
  params.graphId,
1617
1983
  params.nodeKind,
1618
- chunkAQR6BHB3_cjs.nowIso()
1984
+ chunkF4NHQHEZ_cjs.nowIso()
1619
1985
  );
1620
1986
  const fulltextSql = buildFulltextSearch(
1621
1987
  fulltextTable,
@@ -1636,7 +2002,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1636
2002
  hybridCandidatesRef()
1637
2003
  );
1638
2004
  return buildHybridSearchStatement({
1639
- candidatesSql: chunkX2XOQZT3_cjs.isSqlFragment(candidates) ? chunk6TJ6PKPS_cjs.toDrizzleSql(candidates, dialect) : candidates,
2005
+ candidatesSql: chunkU5W4LKZV_cjs.isSqlFragment(candidates) ? chunkOOA273IJ_cjs.toDrizzleSql(candidates, dialect) : candidates,
1640
2006
  vectorSql,
1641
2007
  vectorScoreDescending,
1642
2008
  fulltextSql,
@@ -1652,9 +2018,22 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1652
2018
  });
1653
2019
  }
1654
2020
  };
2021
+ function buildDeleteContributionMaterialization(identity) {
2022
+ return drizzleOrm.sql`
2023
+ DELETE FROM ${contributionMaterializations}
2024
+ WHERE graph_id = ${identity.graphId}
2025
+ AND logical_name = ${identity.logicalName}
2026
+ AND owner = ${identity.owner}
2027
+ AND table_name = ${identity.tableName}
2028
+ `;
2029
+ }
1655
2030
  return {
1656
2031
  ...tableOperations,
1657
2032
  ...fulltextBuilders,
2033
+ buildUpdateNodeSet(params, timestamp) {
2034
+ return buildUpdateNodeSet(tables, dialect, params, timestamp);
2035
+ },
2036
+ buildDeleteContributionMaterialization,
1658
2037
  buildInsertUnique(params) {
1659
2038
  return buildInsertUnique(tables, dialect, params);
1660
2039
  },
@@ -1730,32 +2109,76 @@ var DRIZZLE_DIALECT_LABELS = {
1730
2109
  function assertAdoptedDialect(externalTx, brand, backend) {
1731
2110
  if (drizzleOrm.is(externalTx, brand)) return;
1732
2111
  const label = DRIZZLE_DIALECT_LABELS[backend];
1733
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
2112
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
1734
2113
  `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.`,
1735
2114
  { backend, capability: "adoptTransaction" }
1736
2115
  );
1737
2116
  }
1738
2117
  function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
1739
2118
  const expectedVersion = expected.kind === "active" ? expected.version : 0;
2119
+ assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion);
2120
+ }
2121
+ function assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion) {
1740
2122
  if (actualActiveVersion !== expectedVersion) {
1741
- throw new chunkKTBTSHU6_cjs.StaleVersionError({
2123
+ throw new chunkC4F7VJ5D_cjs.StaleVersionError({
1742
2124
  graphId,
1743
2125
  expected: expectedVersion,
1744
2126
  actual: actualActiveVersion
1745
2127
  });
1746
2128
  }
1747
2129
  }
2130
+ async function commitSchemaVersionIfKindsEmpty(backend, params, probes) {
2131
+ const [existing, active] = await Promise.all([
2132
+ backend.getSchemaVersion(params.graphId, params.version),
2133
+ backend.getActiveSchema(params.graphId)
2134
+ ]);
2135
+ if (existing !== void 0 && (existing.is_active || existing.schema_hash !== params.schemaHash)) {
2136
+ return {
2137
+ status: "committed",
2138
+ row: await backend.commitSchemaVersion(params)
2139
+ };
2140
+ }
2141
+ verifyExpectedActiveVersion(
2142
+ params.graphId,
2143
+ params.expected,
2144
+ active?.version ?? 0
2145
+ );
2146
+ const populated = [];
2147
+ for (const probe of probes) {
2148
+ const count = probe.entity === "node" ? await backend.countNodesByKind({
2149
+ graphId: params.graphId,
2150
+ kind: probe.kind
2151
+ }) : await backend.countEdgesByKind({
2152
+ graphId: params.graphId,
2153
+ kind: probe.kind
2154
+ });
2155
+ if (count > 0) populated.push({ ...probe, count });
2156
+ }
2157
+ if (populated.length > 0) {
2158
+ return { status: "populated", kinds: populated };
2159
+ }
2160
+ return {
2161
+ status: "committed",
2162
+ row: await backend.commitSchemaVersion(params)
2163
+ };
2164
+ }
1748
2165
  function createCommonOperationBackend(options) {
1749
- const { batchConfig, execution, operationStrategy, rowMappers } = options;
1750
- const nowIso2 = options.nowIso ?? chunkAQR6BHB3_cjs.nowIso;
1751
- const requiredClearTableExists = createCachedTableExistence(
2166
+ const {
2167
+ batchConfig,
2168
+ execution,
2169
+ maxBindParameters,
2170
+ operationStrategy,
2171
+ rowMappers
2172
+ } = options;
2173
+ const nowIso2 = options.nowIso ?? chunkF4NHQHEZ_cjs.nowIso;
2174
+ const tableExists = createCachedTableExistence(
1752
2175
  (tableName) => execution.execGet(
1753
2176
  operationStrategy.buildTableExists(tableName)
1754
2177
  ),
1755
2178
  options.tableExistenceCache
1756
2179
  );
1757
2180
  async function runIgnorableClearStatement(statement) {
1758
- if (statement.ignoreMissingTable === true && statement.requiredTableName !== void 0 && !await requiredClearTableExists(statement.requiredTableName)) {
2181
+ if (statement.ignoreMissingTable === true && statement.requiredTableName !== void 0 && !await tableExists(statement.requiredTableName)) {
1759
2182
  return;
1760
2183
  }
1761
2184
  await execution.execRun(statement.query);
@@ -1767,6 +2190,10 @@ function createCommonOperationBackend(options) {
1767
2190
  return row === void 0 ? 0 : rowMappers.toSchemaVersionRow(row).version;
1768
2191
  }
1769
2192
  return {
2193
+ tableExists,
2194
+ async executeSchemaDdl(ddl) {
2195
+ await execution.execRun(chunkU5W4LKZV_cjs.asCompiledStatementSql(chunkU5W4LKZV_cjs.sql.raw(ddl)));
2196
+ },
1770
2197
  async executeStatement(query) {
1771
2198
  await execution.execRun(query);
1772
2199
  },
@@ -1778,7 +2205,7 @@ function createCommonOperationBackend(options) {
1778
2205
  const query = operationStrategy.buildInsertNode(params, timestamp);
1779
2206
  const row = await execution.execGet(query);
1780
2207
  if (!row)
1781
- throw new chunkKTBTSHU6_cjs.DatabaseOperationError(
2208
+ throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
1782
2209
  "Insert node failed: no row returned",
1783
2210
  { operation: "insert", entity: "node" }
1784
2211
  );
@@ -1838,12 +2265,31 @@ function createCommonOperationBackend(options) {
1838
2265
  const query = operationStrategy.buildUpdateNode(params, timestamp);
1839
2266
  const row = await execution.execGet(query);
1840
2267
  if (!row)
1841
- throw new chunkKTBTSHU6_cjs.DatabaseOperationError(
2268
+ throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
1842
2269
  "Update node failed: no row returned",
1843
2270
  { operation: "update", entity: "node" }
1844
2271
  );
1845
2272
  return rowMappers.toNodeRow(row);
1846
2273
  },
2274
+ async updateNodeSet(params) {
2275
+ if (Object.keys(params.patch).length === 0 && (params.unsetProperties?.length ?? 0) === 0) {
2276
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
2277
+ "Set-based node update requires at least one property",
2278
+ { operation: "updateNodeSet", kind: params.kind }
2279
+ );
2280
+ }
2281
+ if (params.candidateIdColumn.length === 0) {
2282
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
2283
+ "Set-based node update requires a candidate id column",
2284
+ { operation: "updateNodeSet", kind: params.kind }
2285
+ );
2286
+ }
2287
+ const timestamp = nowIso2();
2288
+ const query = operationStrategy.buildUpdateNodeSet(params, timestamp);
2289
+ const rows = await execution.execAll(query);
2290
+ const updatedRows = rows.map((row) => rowMappers.toNodeRow(row));
2291
+ return { affectedCount: updatedRows.length, rows: updatedRows };
2292
+ },
1847
2293
  async deleteNode(params) {
1848
2294
  const timestamp = nowIso2();
1849
2295
  const query = operationStrategy.buildDeleteNode(params, timestamp);
@@ -1861,6 +2307,7 @@ function createCommonOperationBackend(options) {
1861
2307
  async hardDeleteNode(params) {
1862
2308
  const deleteUniquesQuery = operationStrategy.buildHardDeleteUniquesByNode(
1863
2309
  params.graphId,
2310
+ params.kind,
1864
2311
  params.id
1865
2312
  );
1866
2313
  await execution.execRun(deleteUniquesQuery);
@@ -1886,7 +2333,7 @@ function createCommonOperationBackend(options) {
1886
2333
  const query = operationStrategy.buildInsertEdge(params, timestamp);
1887
2334
  const row = await execution.execGet(query);
1888
2335
  if (!row)
1889
- throw new chunkKTBTSHU6_cjs.DatabaseOperationError(
2336
+ throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
1890
2337
  "Insert edge failed: no row returned",
1891
2338
  { operation: "insert", entity: "edge" }
1892
2339
  );
@@ -1946,7 +2393,7 @@ function createCommonOperationBackend(options) {
1946
2393
  const query = operationStrategy.buildUpdateEdge(params, timestamp);
1947
2394
  const row = await execution.execGet(query);
1948
2395
  if (!row)
1949
- throw new chunkKTBTSHU6_cjs.DatabaseOperationError(
2396
+ throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
1950
2397
  "Update edge failed: no row returned",
1951
2398
  { operation: "update", entity: "edge" }
1952
2399
  );
@@ -2019,6 +2466,37 @@ function createCommonOperationBackend(options) {
2019
2466
  const rows = await execution.execAll(query);
2020
2467
  return rows.map((row) => rowMappers.toEdgeRow(row));
2021
2468
  },
2469
+ async findEdgesByEndpointSet(params) {
2470
+ const ids = resolveEdgeEndpointIds(params);
2471
+ const edgeRows = [];
2472
+ for (const idChunk of chunkZDH3DX3C_cjs.chunk(
2473
+ ids,
2474
+ batchConfig.findEdgesEndpointChunkSize
2475
+ )) {
2476
+ const query = operationStrategy.buildFindEdgesByEndpointSet(
2477
+ params,
2478
+ idChunk
2479
+ );
2480
+ const rows = await execution.execAll(query);
2481
+ for (const row of rows) edgeRows.push(rowMappers.toEdgeRow(row));
2482
+ }
2483
+ return edgeRows;
2484
+ },
2485
+ async findEdgesByHeterogeneousEndpointSet(params) {
2486
+ const { edgeKinds, endpoints, endpointChunkSize } = resolveHeterogeneousEdgeRead(params, maxBindParameters);
2487
+ if (edgeKinds.length === 0 || endpoints.length === 0) return [];
2488
+ const edgeRows = [];
2489
+ for (const endpointChunk of chunkZDH3DX3C_cjs.chunk(endpoints, endpointChunkSize)) {
2490
+ const query = operationStrategy.buildFindEdgesByHeterogeneousEndpointSet(
2491
+ params,
2492
+ endpointChunk,
2493
+ edgeKinds
2494
+ );
2495
+ const rows = await execution.execAll(query);
2496
+ for (const row of rows) edgeRows.push(rowMappers.toEdgeRow(row));
2497
+ }
2498
+ return edgeRows;
2499
+ },
2022
2500
  async countEdgesByKind(params) {
2023
2501
  const query = operationStrategy.buildCountEdgesByKind(params);
2024
2502
  const row = await execution.execGet(query);
@@ -2028,7 +2506,7 @@ function createCommonOperationBackend(options) {
2028
2506
  const query = operationStrategy.buildInsertUnique(params);
2029
2507
  const result = await execution.execGet(query);
2030
2508
  if (result && result.node_id !== params.nodeId) {
2031
- throw new chunkKTBTSHU6_cjs.UniquenessError({
2509
+ throw new chunkC4F7VJ5D_cjs.UniquenessError({
2032
2510
  constraintName: params.constraintName,
2033
2511
  kind: params.nodeKind,
2034
2512
  existingId: result.node_id,
@@ -2048,7 +2526,7 @@ function createCommonOperationBackend(options) {
2048
2526
  continue;
2049
2527
  }
2050
2528
  if (existing.nodeId !== entry.nodeId) {
2051
- throw new chunkKTBTSHU6_cjs.UniquenessError({
2529
+ throw new chunkC4F7VJ5D_cjs.UniquenessError({
2052
2530
  constraintName: entry.constraintName,
2053
2531
  kind: entry.nodeKind,
2054
2532
  existingId: existing.nodeId,
@@ -2073,7 +2551,7 @@ function createCommonOperationBackend(options) {
2073
2551
  for (const entry of chunk2) {
2074
2552
  const owner = ownerByTarget.get(targetKey(entry));
2075
2553
  if (owner !== void 0 && owner !== entry.nodeId) {
2076
- throw new chunkKTBTSHU6_cjs.UniquenessError({
2554
+ throw new chunkC4F7VJ5D_cjs.UniquenessError({
2077
2555
  constraintName: entry.constraintName,
2078
2556
  kind: entry.nodeKind,
2079
2557
  existingId: owner,
@@ -2089,6 +2567,19 @@ function createCommonOperationBackend(options) {
2089
2567
  const query = operationStrategy.buildDeleteUnique(params, timestamp);
2090
2568
  await execution.execRun(query);
2091
2569
  },
2570
+ async hardDeleteUniquesByNodeIds(params) {
2571
+ const nodeIds = [...new Set(params.nodeIds)];
2572
+ for (const chunk2 of chunkZDH3DX3C_cjs.chunk(
2573
+ nodeIds,
2574
+ batchConfig.uniqueDeleteChunkSize
2575
+ )) {
2576
+ const query = operationStrategy.buildHardDeleteUniquesByNodeIds({
2577
+ ...params,
2578
+ nodeIds: chunk2
2579
+ });
2580
+ await execution.execRun(query);
2581
+ }
2582
+ },
2092
2583
  async checkUnique(params) {
2093
2584
  const query = operationStrategy.buildCheckUnique(params);
2094
2585
  const row = await execution.execGet(query);
@@ -2128,7 +2619,7 @@ function createCommonOperationBackend(options) {
2128
2619
  if (existingRaw !== void 0) {
2129
2620
  const existing = rowMappers.toSchemaVersionRow(existingRaw);
2130
2621
  if (existing.schema_hash !== params.schemaHash) {
2131
- throw new chunkKTBTSHU6_cjs.SchemaContentConflictError({
2622
+ throw new chunkC4F7VJ5D_cjs.SchemaContentConflictError({
2132
2623
  graphId: params.graphId,
2133
2624
  version: params.version,
2134
2625
  existingHash: existing.schema_hash,
@@ -2176,7 +2667,7 @@ function createCommonOperationBackend(options) {
2176
2667
  );
2177
2668
  const insertedRaw = await execution.execGet(insertQuery);
2178
2669
  if (!insertedRaw) {
2179
- throw new chunkKTBTSHU6_cjs.DatabaseOperationError(
2670
+ throw new chunkC4F7VJ5D_cjs.DatabaseOperationError(
2180
2671
  "Insert schema failed: no row returned",
2181
2672
  { operation: "insert", entity: "schema" }
2182
2673
  );
@@ -2194,7 +2685,7 @@ function createCommonOperationBackend(options) {
2194
2685
  operationStrategy.buildGetSchemaVersion(params.graphId, params.version)
2195
2686
  );
2196
2687
  if (!targetRaw) {
2197
- throw new chunkKTBTSHU6_cjs.MigrationError(
2688
+ throw new chunkC4F7VJ5D_cjs.MigrationError(
2198
2689
  `Cannot activate version ${params.version}: version does not exist for graph "${params.graphId}".`,
2199
2690
  {
2200
2691
  graphId: params.graphId,
@@ -2227,7 +2718,7 @@ function quoteSqlIdentifier(identifier) {
2227
2718
  }
2228
2719
  function requireRawExecution(backend) {
2229
2720
  if (backend.executeRaw === void 0) {
2230
- throw new chunkKTBTSHU6_cjs.TrustedImportError(
2721
+ throw new chunkC4F7VJ5D_cjs.TrustedImportError(
2231
2722
  "This backend cannot execute the raw statements required by trusted import.",
2232
2723
  "backend_unsupported"
2233
2724
  );
@@ -2236,7 +2727,7 @@ function requireRawExecution(backend) {
2236
2727
  }
2237
2728
  function requireStatementExecution(backend) {
2238
2729
  if (backend.executeStatement === void 0) {
2239
- throw new chunkKTBTSHU6_cjs.TrustedImportError(
2730
+ throw new chunkC4F7VJ5D_cjs.TrustedImportError(
2240
2731
  "This backend cannot execute the index lifecycle required by trusted import.",
2241
2732
  "backend_unsupported"
2242
2733
  );
@@ -2258,7 +2749,7 @@ async function assertTrustedImportDatabaseEmpty(backend, tableNames) {
2258
2749
  []
2259
2750
  );
2260
2751
  if (!rowIndicatesExistingData(rows[0])) return;
2261
- throw new chunkKTBTSHU6_cjs.TrustedImportError(
2752
+ throw new chunkC4F7VJ5D_cjs.TrustedImportError(
2262
2753
  "Trusted import requires globally empty TypeGraph node and edge tables.",
2263
2754
  "database_not_empty",
2264
2755
  { tables: [tableNames.nodes, tableNames.edges] },
@@ -2270,8 +2761,8 @@ async function assertTrustedImportDatabaseEmpty(backend, tableNames) {
2270
2761
  async function lockPostgresTrustedImportTables(backend, tableNames) {
2271
2762
  const executeStatement = requireStatementExecution(backend);
2272
2763
  await executeStatement(
2273
- chunkX2XOQZT3_cjs.asCompiledStatementSql(
2274
- chunkX2XOQZT3_cjs.sql.raw(
2764
+ chunkU5W4LKZV_cjs.asCompiledStatementSql(
2765
+ chunkU5W4LKZV_cjs.sql.raw(
2275
2766
  `LOCK TABLE ${quoteSqlIdentifier(tableNames.nodes)}, ${quoteSqlIdentifier(tableNames.edges)} IN ACCESS EXCLUSIVE MODE`
2276
2767
  )
2277
2768
  )
@@ -2291,8 +2782,8 @@ async function suspendSqliteSecondaryIndexes(backend, tableNames) {
2291
2782
  );
2292
2783
  for (const definition of definitions) {
2293
2784
  await executeStatement(
2294
- chunkX2XOQZT3_cjs.asCompiledStatementSql(
2295
- chunkX2XOQZT3_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
2785
+ chunkU5W4LKZV_cjs.asCompiledStatementSql(
2786
+ chunkU5W4LKZV_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
2296
2787
  )
2297
2788
  );
2298
2789
  }
@@ -2322,8 +2813,8 @@ async function suspendPostgresSecondaryIndexes(backend, tableNames) {
2322
2813
  );
2323
2814
  for (const definition of definitions) {
2324
2815
  await executeStatement(
2325
- chunkX2XOQZT3_cjs.asCompiledStatementSql(
2326
- chunkX2XOQZT3_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
2816
+ chunkU5W4LKZV_cjs.asCompiledStatementSql(
2817
+ chunkU5W4LKZV_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
2327
2818
  )
2328
2819
  );
2329
2820
  }
@@ -2333,20 +2824,20 @@ async function restoreSecondaryIndexes(backend, definitions) {
2333
2824
  const executeStatement = requireStatementExecution(backend);
2334
2825
  for (const definition of definitions) {
2335
2826
  await executeStatement(
2336
- chunkX2XOQZT3_cjs.asCompiledStatementSql(chunkX2XOQZT3_cjs.sql.raw(definition.index_definition))
2827
+ chunkU5W4LKZV_cjs.asCompiledStatementSql(chunkU5W4LKZV_cjs.sql.raw(definition.index_definition))
2337
2828
  );
2338
2829
  }
2339
2830
  }
2340
2831
  async function analyzeImportedTables(backend, tableNames) {
2341
2832
  const executeStatement = requireStatementExecution(backend);
2342
2833
  await executeStatement(
2343
- chunkX2XOQZT3_cjs.asCompiledStatementSql(
2344
- chunkX2XOQZT3_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.nodes)}`)
2834
+ chunkU5W4LKZV_cjs.asCompiledStatementSql(
2835
+ chunkU5W4LKZV_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.nodes)}`)
2345
2836
  )
2346
2837
  );
2347
2838
  await executeStatement(
2348
- chunkX2XOQZT3_cjs.asCompiledStatementSql(
2349
- chunkX2XOQZT3_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.edges)}`)
2839
+ chunkU5W4LKZV_cjs.asCompiledStatementSql(
2840
+ chunkU5W4LKZV_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.edges)}`)
2350
2841
  )
2351
2842
  );
2352
2843
  }
@@ -2361,7 +2852,7 @@ function postgresArray(values) {
2361
2852
  function createSqliteTrustedImportSession(executionAdapter, tableNames) {
2362
2853
  const executePreparedRunBatch = executionAdapter.executePreparedRunBatch;
2363
2854
  if (executePreparedRunBatch === void 0) {
2364
- throw new chunkKTBTSHU6_cjs.TrustedImportError(
2855
+ throw new chunkC4F7VJ5D_cjs.TrustedImportError(
2365
2856
  "Trusted import requires a synchronous SQLite driver with prepared statement support.",
2366
2857
  "backend_unsupported"
2367
2858
  );
@@ -2490,6 +2981,7 @@ function getOrCreateLru(cache, key, cacheMax, create) {
2490
2981
  }
2491
2982
 
2492
2983
  exports.EMBEDDING_UPSERT_PARAM_COUNT = EMBEDDING_UPSERT_PARAM_COUNT;
2984
+ exports.FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT = FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT;
2493
2985
  exports.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS;
2494
2986
  exports.POSTGRES_INDEX_MAT_TIMESTAMPS = POSTGRES_INDEX_MAT_TIMESTAMPS;
2495
2987
  exports.POSTGRES_KIND_REMOVAL_TIMESTAMPS = POSTGRES_KIND_REMOVAL_TIMESTAMPS;
@@ -2497,6 +2989,7 @@ exports.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS = SQLITE_CONTRIBUTION_MAT_TIMESTAMPS;
2497
2989
  exports.SQLITE_INDEX_MAT_TIMESTAMPS = SQLITE_INDEX_MAT_TIMESTAMPS;
2498
2990
  exports.SQLITE_KIND_REMOVAL_TIMESTAMPS = SQLITE_KIND_REMOVAL_TIMESTAMPS;
2499
2991
  exports.analyzeImportedTables = analyzeImportedTables;
2992
+ exports.assertActiveSchemaVersion = assertActiveSchemaVersion;
2500
2993
  exports.assertAdoptedDialect = assertAdoptedDialect;
2501
2994
  exports.assertTrustedImportDatabaseEmpty = assertTrustedImportDatabaseEmpty;
2502
2995
  exports.buildContributionInsertValues = buildContributionInsertValues;
@@ -2506,6 +2999,7 @@ exports.buildKindRemovalOnConflictSet = buildKindRemovalOnConflictSet;
2506
2999
  exports.buildLiveNodeCandidates = buildLiveNodeCandidates;
2507
3000
  exports.buildMaterializationInsertValues = buildMaterializationInsertValues;
2508
3001
  exports.buildMaterializationOnConflictSet = buildMaterializationOnConflictSet;
3002
+ exports.commitSchemaVersionIfKindsEmpty = commitSchemaVersionIfKindsEmpty;
2509
3003
  exports.createCachedTableExistence = createCachedTableExistence;
2510
3004
  exports.createCommonOperationBackend = createCommonOperationBackend;
2511
3005
  exports.createContributionMaterializer = createContributionMaterializer;
@@ -2525,8 +3019,9 @@ exports.mapVectorWriteError = mapVectorWriteError;
2525
3019
  exports.restoreSecondaryIndexes = restoreSecondaryIndexes;
2526
3020
  exports.suspendPostgresSecondaryIndexes = suspendPostgresSecondaryIndexes;
2527
3021
  exports.suspendSqliteSecondaryIndexes = suspendSqliteSecondaryIndexes;
3022
+ exports.tableExistsFromRow = tableExistsFromRow;
2528
3023
  exports.vectorSlotFromCreateIndexParams = vectorSlotFromCreateIndexParams;
2529
3024
  exports.vectorSlotFromDropIndexParams = vectorSlotFromDropIndexParams;
2530
3025
  exports.vectorSlotFromParams = vectorSlotFromParams;
2531
- //# sourceMappingURL=chunk-O7XVCLXW.cjs.map
2532
- //# sourceMappingURL=chunk-O7XVCLXW.cjs.map
3026
+ //# sourceMappingURL=chunk-H7VE3FL4.cjs.map
3027
+ //# sourceMappingURL=chunk-H7VE3FL4.cjs.map