@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,16 +1,82 @@
1
- import { formatPostgresTimestamp, coerceNumericScore, nowIso } from './chunk-CVNGKTHO.js';
2
- import { runtimeStrategyContributions } from './chunk-Z3WIL6S3.js';
3
- import { toDrizzleSql } from './chunk-UJRWOV5B.js';
1
+ import { formatPostgresTimestamp, coerceNumericScore, nowIso } from './chunk-YMTXMPV6.js';
2
+ import { runtimeStrategyContributions } from './chunk-BGYJW37L.js';
3
+ import { toDrizzleSql } from './chunk-EFEOOCJ3.js';
4
4
  import { chunk } from './chunk-35S6P5ZU.js';
5
- import { createBackendOverlay } from './chunk-UZLEQFTV.js';
5
+ import { createBackendOverlay } from './chunk-55ITBQJI.js';
6
6
  import { sortedReplacer } from './chunk-UR7W5YQK.js';
7
- import { parseDimensionMismatch, isMissingTableError } from './chunk-CUPJL6TS.js';
7
+ import { parseDimensionMismatch, isMissingTableError } from './chunk-V34A6R5V.js';
8
8
  import { sha256Hex } from './chunk-K34OPSJK.js';
9
- import { sql as sql$1, asCompiledStatementSql, isSqlFragment } from './chunk-M4GYQF2H.js';
9
+ import { getDialect } from './chunk-PVUI6KGR.js';
10
+ import { sql as sql$1, asCompiledStatementSql, isSqlFragment } from './chunk-6DCB664D.js';
10
11
  import { isPresent } from './chunk-QMQLUA66.js';
11
- import { EmbeddingDimensionChangedError, ConfigurationError, MigrationError, SchemaContentConflictError, DatabaseOperationError, UniquenessError, TrustedImportError, StaleVersionError, StoreNotInitializedError } from './chunk-OYJSYDIH.js';
12
+ import { EmbeddingDimensionChangedError, ConfigurationError, StaleVersionError, MigrationError, SchemaContentConflictError, DatabaseOperationError, UniquenessError, TrustedImportError, StoreNotInitializedError } from './chunk-4MB3AQAQ.js';
12
13
  import { sql, is, getTableName } from 'drizzle-orm';
13
14
 
15
+ // src/backend/edge-endpoint-sets.ts
16
+ var FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT = 6;
17
+ var FIND_EDGES_HETEROGENEOUS_FIXED_PARAM_COUNT = 4;
18
+ function assertLimitPerEndpoint(operation, graphId, limitPerEndpoint, kind) {
19
+ if (limitPerEndpoint === void 0 || Number.isInteger(limitPerEndpoint) && limitPerEndpoint > 0) {
20
+ return;
21
+ }
22
+ throw new ConfigurationError(
23
+ `${operation} \`limitPerEndpoint\` must be a positive integer, received ${String(limitPerEndpoint)}.`,
24
+ {
25
+ code: "EDGE_ENDPOINT_SET_INVALID",
26
+ graphId,
27
+ ...kind === void 0 ? {} : { kind }
28
+ },
29
+ {
30
+ suggestion: "Pass a positive integer to cap each endpoint's rows, or omit it for an unbounded read."
31
+ }
32
+ );
33
+ }
34
+ function resolveEdgeEndpointIds(params) {
35
+ assertLimitPerEndpoint(
36
+ "findEdgesByEndpointSet",
37
+ params.graphId,
38
+ params.limitPerEndpoint,
39
+ params.kind
40
+ );
41
+ return [...new Set(params.endpointIds)];
42
+ }
43
+ function endpointKey(endpoint) {
44
+ return `${endpoint.kind}\0${endpoint.id}`;
45
+ }
46
+ function resolveHeterogeneousEdgeRead(params, maxBindParameters) {
47
+ assertLimitPerEndpoint(
48
+ "findEdgesByHeterogeneousEndpointSet",
49
+ params.graphId,
50
+ params.limitPerEndpoint
51
+ );
52
+ const edgeKinds = [...new Set(params.edgeKinds)];
53
+ const endpoints = [
54
+ ...new Map(
55
+ params.endpoints.map((endpoint) => [endpointKey(endpoint), endpoint])
56
+ ).values()
57
+ ];
58
+ if (edgeKinds.length === 0 || endpoints.length === 0) {
59
+ return { edgeKinds, endpoints, endpointChunkSize: 1 };
60
+ }
61
+ const endpointBindBudget = maxBindParameters - FIND_EDGES_HETEROGENEOUS_FIXED_PARAM_COUNT - edgeKinds.length;
62
+ const endpointChunkSize = Math.floor(endpointBindBudget / 2);
63
+ if (endpointChunkSize >= 1) {
64
+ return { edgeKinds, endpoints, endpointChunkSize };
65
+ }
66
+ throw new ConfigurationError(
67
+ "findEdgesByHeterogeneousEndpointSet cannot fit one endpoint and the selected edge kinds within the backend bind-parameter budget.",
68
+ {
69
+ code: "EDGE_HETEROGENEOUS_READ_BIND_BUDGET_EXCEEDED",
70
+ graphId: params.graphId,
71
+ edgeKindCount: edgeKinds.length,
72
+ maxBindParameters
73
+ },
74
+ {
75
+ suggestion: "Select fewer edge kinds in one call or use a backend with a larger bind-parameter budget."
76
+ }
77
+ );
78
+ }
79
+
14
80
  // src/backend/live-node-candidates.ts
15
81
  function buildLiveNodeCandidates(nodesTableName, graphId, nodeKind, now) {
16
82
  const nodes = sql$1.identifier(nodesTableName);
@@ -133,6 +199,32 @@ function evaluateContributionState(row, signature) {
133
199
  if (row.materializedAt === void 0) return "missing";
134
200
  return "initialized";
135
201
  }
202
+ function diagnoseContribution(row, signature, tableExists) {
203
+ if (!tableExists) {
204
+ if (row === void 0) return void 0;
205
+ if (row.materializedAt !== void 0) return "orphaned-marker";
206
+ return row.lastError === void 0 ? void 0 : "failed-materialization";
207
+ }
208
+ if (row?.materializedAt !== void 0 && row.signature !== signature) {
209
+ return "stale";
210
+ }
211
+ const state = evaluateContributionState(row, signature);
212
+ switch (state) {
213
+ case "initialized": {
214
+ return void 0;
215
+ }
216
+ case "stale": {
217
+ return "stale";
218
+ }
219
+ case "missing":
220
+ case "failed": {
221
+ return "missing-marker";
222
+ }
223
+ default: {
224
+ return state;
225
+ }
226
+ }
227
+ }
136
228
  function identityOf(graphId, contribution) {
137
229
  return {
138
230
  graphId,
@@ -205,6 +297,7 @@ function contributionKey(graphId, contribution) {
205
297
  function createContributionMaterializer(deps) {
206
298
  const { dialect, fulltextStrategy, fulltextTableName } = deps;
207
299
  const initializedSignatures = /* @__PURE__ */ new Map();
300
+ const uncacheableKeys = /* @__PURE__ */ new Set();
208
301
  const computedSignatures = /* @__PURE__ */ new Map();
209
302
  async function resolveContributionSignature(key, contribution) {
210
303
  const cached = computedSignatures.get(key);
@@ -237,6 +330,11 @@ function createContributionMaterializer(deps) {
237
330
  function runtimeContributions() {
238
331
  return runtimeStrategyContributions(fulltextStrategy, fulltextTableName);
239
332
  }
333
+ function cacheInitializedSignature(key, signature) {
334
+ if (!uncacheableKeys.has(key)) {
335
+ initializedSignatures.set(key, signature);
336
+ }
337
+ }
240
338
  async function materializeOne(graphId, contribution, signature, existing, options) {
241
339
  const force = options?.force === true;
242
340
  const identity = identityOf(graphId, contribution);
@@ -305,6 +403,7 @@ function createContributionMaterializer(deps) {
305
403
  }
306
404
  async function ensureContributions(graphId, contributions, options) {
307
405
  const force = options?.force === true;
406
+ const bypassCache = options?.bypassCache === true;
308
407
  const entries = await Promise.all(
309
408
  contributions.map(async (contribution) => {
310
409
  const key = contributionKey(graphId, contribution);
@@ -315,8 +414,14 @@ function createContributionMaterializer(deps) {
315
414
  };
316
415
  })
317
416
  );
318
- const pending = force ? entries : entries.filter(
319
- (entry) => initializedSignatures.get(entry.key) !== entry.signature
417
+ if (bypassCache) {
418
+ for (const entry of entries) {
419
+ uncacheableKeys.add(entry.key);
420
+ initializedSignatures.delete(entry.key);
421
+ }
422
+ }
423
+ const pending = force || bypassCache ? entries : entries.filter(
424
+ (entry) => uncacheableKeys.has(entry.key) || initializedSignatures.get(entry.key) !== entry.signature
320
425
  );
321
426
  if (pending.length === 0) return;
322
427
  const initialRead = force ? void 0 : await readMarkerRows(graphId);
@@ -327,7 +432,7 @@ function createContributionMaterializer(deps) {
327
432
  ) === "initialized"
328
433
  )) {
329
434
  for (const entry of pending) {
330
- initializedSignatures.set(entry.key, entry.signature);
435
+ cacheInitializedSignature(entry.key, entry.signature);
331
436
  }
332
437
  return;
333
438
  }
@@ -348,7 +453,7 @@ function createContributionMaterializer(deps) {
348
453
  }
349
454
  );
350
455
  if (outcome === "materialized") {
351
- initializedSignatures.set(entry.key, entry.signature);
456
+ cacheInitializedSignature(entry.key, entry.signature);
352
457
  }
353
458
  }
354
459
  }
@@ -364,7 +469,7 @@ function createContributionMaterializer(deps) {
364
469
  })
365
470
  );
366
471
  const pending = entries.filter(
367
- (entry) => initializedSignatures.get(entry.key) !== entry.signature
472
+ (entry) => uncacheableKeys.has(entry.key) || initializedSignatures.get(entry.key) !== entry.signature
368
473
  );
369
474
  if (pending.length === 0) return;
370
475
  const read = await readMarkerRows(graphId);
@@ -384,7 +489,7 @@ function createContributionMaterializer(deps) {
384
489
  details: { logicalName: contribution.logicalName }
385
490
  });
386
491
  }
387
- initializedSignatures.set(key, signature);
492
+ cacheInitializedSignature(key, signature);
388
493
  }
389
494
  }
390
495
  async function ensureRuntimeContributions(graphId) {
@@ -420,15 +525,123 @@ function createContributionMaterializer(deps) {
420
525
  await assertContributions(graphId, contributions);
421
526
  }
422
527
  }
423
- async function dropVectorSlot(slot) {
528
+ function verificationTargetsByGraph(graphId, vectorSlots) {
529
+ const targets = /* @__PURE__ */ new Map();
530
+ function addTarget(id, target) {
531
+ const existing = targets.get(id);
532
+ if (existing === void 0) targets.set(id, [target]);
533
+ else existing.push(target);
534
+ }
535
+ for (const contribution of runtimeContributions()) {
536
+ addTarget(graphId, { contribution });
537
+ }
538
+ const { vectorStrategy } = deps;
539
+ if (vectorStrategy !== void 0) {
540
+ for (const slot of vectorSlots) {
541
+ for (const contribution of vectorStrategy.ownedTables(slot)) {
542
+ addTarget(slot.graphId, {
543
+ contribution,
544
+ kind: slot.nodeKind,
545
+ fieldPath: slot.fieldPath
546
+ });
547
+ }
548
+ }
549
+ }
550
+ return targets;
551
+ }
552
+ async function diagnoseContributions(graphId, vectorSlots) {
553
+ const targetsByGraph = verificationTargetsByGraph(graphId, vectorSlots);
554
+ const probes = /* @__PURE__ */ new Map();
555
+ function tableExists(tableName) {
556
+ const pending = probes.get(tableName);
557
+ if (pending !== void 0) return pending;
558
+ const probe = deps.tableExists(tableName);
559
+ probes.set(tableName, probe);
560
+ return probe;
561
+ }
562
+ const diagnosed = [];
563
+ for (const [id, targets] of targetsByGraph) {
564
+ const read = await readMarkerRows(id);
565
+ const rows = read.kind === "rows" ? read.rows : /* @__PURE__ */ new Map();
566
+ for (const { contribution, kind, fieldPath } of targets) {
567
+ const key = contributionKey(id, contribution);
568
+ const row = rows.get(key);
569
+ const state = diagnoseContribution(
570
+ row,
571
+ await resolveContributionSignature(key, contribution),
572
+ await tableExists(contribution.tableName)
573
+ );
574
+ if (state === void 0) continue;
575
+ diagnosed.push({
576
+ graphId: id,
577
+ contribution,
578
+ diagnostic: {
579
+ owner: contribution.owner,
580
+ logicalName: contribution.logicalName,
581
+ physicalName: contribution.tableName,
582
+ ...kind === void 0 ? {} : { kind },
583
+ ...fieldPath === void 0 ? {} : { fieldPath },
584
+ state,
585
+ // The recorded reason, carried through verbatim. `state` folds
586
+ // several marker verdicts together because they share a repair;
587
+ // this is what keeps the fold from also discarding the one thing
588
+ // the catalog can never tell the operator.
589
+ ...row?.lastError === void 0 ? {} : { lastError: row.lastError }
590
+ }
591
+ });
592
+ }
593
+ }
594
+ return diagnosed;
595
+ }
596
+ async function verifyContributions(graphId, vectorSlots) {
597
+ const diagnosed = await diagnoseContributions(graphId, vectorSlots);
598
+ return diagnosed.map((entry) => entry.diagnostic);
599
+ }
600
+ async function repairContributions(graphId, vectorSlots) {
601
+ const diagnosed = await diagnoseContributions(graphId, vectorSlots);
602
+ const results = [];
603
+ for (const { graphId: targetGraphId, contribution, diagnostic } of diagnosed) {
604
+ if (diagnostic.state === "stale" || diagnostic.state === "orphaned-marker") {
605
+ results.push({ diagnostic, status: "requires-rebuild" });
606
+ continue;
607
+ }
608
+ try {
609
+ await ensureContributions(targetGraphId, [contribution], {
610
+ bypassCache: true
611
+ });
612
+ results.push({ diagnostic, status: "repaired" });
613
+ } catch (error) {
614
+ results.push({
615
+ diagnostic,
616
+ status: "failed",
617
+ error: error instanceof Error ? error.message : String(error)
618
+ });
619
+ }
620
+ }
621
+ return {
622
+ results,
623
+ remaining: await verifyContributions(graphId, vectorSlots)
624
+ };
625
+ }
626
+ function evictVectorSlot(slot) {
424
627
  if (deps.vectorStrategy === void 0) return;
425
628
  for (const contribution of deps.vectorStrategy.ownedTables(slot)) {
426
- await deps.deleteMarker(identityOf(slot.graphId, contribution));
427
629
  const key = contributionKey(slot.graphId, contribution);
630
+ uncacheableKeys.add(key);
428
631
  initializedSignatures.delete(key);
429
632
  computedSignatures.delete(key);
430
633
  }
431
634
  }
635
+ async function dropVectorSlot(slot) {
636
+ if (deps.vectorStrategy === void 0) return;
637
+ try {
638
+ for (const contribution of deps.vectorStrategy.ownedTables(slot)) {
639
+ await deps.deleteMarker(identityOf(slot.graphId, contribution));
640
+ }
641
+ } finally {
642
+ evictVectorSlot(slot);
643
+ }
644
+ }
432
645
  return {
433
646
  ensureRuntimeContributions,
434
647
  assertInitialized,
@@ -436,7 +649,10 @@ function createContributionMaterializer(deps) {
436
649
  ensureVectorSlots,
437
650
  assertVectorSlot,
438
651
  assertVectorSlots,
439
- dropVectorSlot
652
+ dropVectorSlot,
653
+ evictVectorSlot,
654
+ verifyContributions,
655
+ repairContributions
440
656
  };
441
657
  }
442
658
  var SQLITE_INDEX_MAT_TIMESTAMPS = {
@@ -788,6 +1004,19 @@ function buildCountNodesByKind(tables, params) {
788
1004
  WHERE ${whereClause}
789
1005
  `;
790
1006
  }
1007
+ function buildIdSetCondition(column, ids) {
1008
+ return sql`${column} IN (${sql.join(
1009
+ ids.map((id) => sql`${id}`),
1010
+ sql`, `
1011
+ )})`;
1012
+ }
1013
+ function buildEdgeOrdering(tables, orderBy) {
1014
+ const { edges } = tables;
1015
+ return orderBy === "id" ? { qualified: sql`${edges.id} ASC`, bare: sql.raw(`"id" ASC`) } : {
1016
+ qualified: sql`${edges.createdAt} DESC, ${edges.id} DESC`,
1017
+ bare: sql.raw(`"created_at" DESC, "id" DESC`)
1018
+ };
1019
+ }
791
1020
  function buildFindEdgesByKind(tables, params) {
792
1021
  const { edges } = tables;
793
1022
  const conditions = [
@@ -811,7 +1040,10 @@ function buildFindEdgesByKind(tables, params) {
811
1040
  conditions.push(sql`${edges.id} > ${params.after}`);
812
1041
  }
813
1042
  const whereClause = sql.join(conditions, sql` AND `);
814
- const orderByClause = params.orderBy === "id" ? sql`${edges.id} ASC` : sql`${edges.createdAt} DESC, ${edges.id} DESC`;
1043
+ const { qualified: orderByClause } = buildEdgeOrdering(
1044
+ tables,
1045
+ params.orderBy
1046
+ );
815
1047
  if (params.limit !== void 0 && params.offset !== void 0) {
816
1048
  return sql`
817
1049
  SELECT * FROM ${edges}
@@ -834,6 +1066,94 @@ function buildFindEdgesByKind(tables, params) {
834
1066
  ORDER BY ${orderByClause}
835
1067
  `;
836
1068
  }
1069
+ function buildFindEdgesByEndpointSet(tables, params, endpointIds) {
1070
+ const { edges } = tables;
1071
+ const fromSide = params.side === "from";
1072
+ const kindColumn = fromSide ? edges.fromKind : edges.toKind;
1073
+ const idColumn = fromSide ? edges.fromId : edges.toId;
1074
+ const whereClause = sql.join(
1075
+ [
1076
+ sql`${edges.graphId} = ${params.graphId}`,
1077
+ sql`${edges.kind} = ${params.kind}`,
1078
+ ...buildTemporalConditions(edges, params),
1079
+ sql`${kindColumn} = ${params.endpointKind}`,
1080
+ buildIdSetCondition(idColumn, endpointIds)
1081
+ ],
1082
+ sql` AND `
1083
+ );
1084
+ const { qualified: orderByClause, bare: derivedOrderByClause } = buildEdgeOrdering(tables, void 0);
1085
+ if (params.limitPerEndpoint === void 0) {
1086
+ return sql`
1087
+ SELECT * FROM ${edges}
1088
+ WHERE ${whereClause}
1089
+ ORDER BY ${orderByClause}
1090
+ `;
1091
+ }
1092
+ const ranked = sql`
1093
+ SELECT *, ROW_NUMBER() OVER (
1094
+ PARTITION BY ${idColumn} ORDER BY ${orderByClause}
1095
+ ) AS endpoint_rank
1096
+ FROM ${edges}
1097
+ WHERE ${whereClause}
1098
+ `;
1099
+ return sql`
1100
+ SELECT * FROM (${ranked}) AS ranked_edges
1101
+ WHERE endpoint_rank <= ${params.limitPerEndpoint}
1102
+ ORDER BY ${derivedOrderByClause}
1103
+ `;
1104
+ }
1105
+ function buildFindEdgesByHeterogeneousEndpointSet(tables, params, endpoints, edgeKinds) {
1106
+ const { edges } = tables;
1107
+ const fromSide = params.side === "from";
1108
+ const kindColumn = fromSide ? edges.fromKind : edges.toKind;
1109
+ const idColumn = fromSide ? edges.fromId : edges.toId;
1110
+ const requestedKind = sql.raw(`requested_endpoints."endpoint_kind"`);
1111
+ const requestedId = sql.raw(`requested_endpoints."endpoint_id"`);
1112
+ const requestedRows = sql.join(
1113
+ endpoints.map((endpoint) => sql`(${endpoint.kind}, ${endpoint.id})`),
1114
+ sql`, `
1115
+ );
1116
+ const whereClause = sql.join(
1117
+ [
1118
+ sql`${edges.graphId} = ${params.graphId}`,
1119
+ buildIdSetCondition(edges.kind, edgeKinds),
1120
+ ...buildTemporalConditions(edges, params)
1121
+ ],
1122
+ sql` AND `
1123
+ );
1124
+ const joinClause = sql`
1125
+ FROM ${edges}
1126
+ INNER JOIN requested_endpoints
1127
+ ON ${kindColumn} = ${requestedKind}
1128
+ AND ${idColumn} = ${requestedId}
1129
+ WHERE ${whereClause}
1130
+ `;
1131
+ const { qualified: orderByClause, bare: derivedOrderByClause } = buildEdgeOrdering(tables, void 0);
1132
+ if (params.limitPerEndpoint === void 0) {
1133
+ return sql`
1134
+ WITH requested_endpoints(endpoint_kind, endpoint_id) AS (
1135
+ VALUES ${requestedRows}
1136
+ )
1137
+ SELECT ${edges}.*
1138
+ ${joinClause}
1139
+ ORDER BY ${orderByClause}
1140
+ `;
1141
+ }
1142
+ const ranked = sql`
1143
+ SELECT ${edges}.*, ROW_NUMBER() OVER (
1144
+ PARTITION BY ${kindColumn}, ${idColumn} ORDER BY ${orderByClause}
1145
+ ) AS endpoint_rank
1146
+ ${joinClause}
1147
+ `;
1148
+ return sql`
1149
+ WITH requested_endpoints(endpoint_kind, endpoint_id) AS (
1150
+ VALUES ${requestedRows}
1151
+ )
1152
+ SELECT * FROM (${ranked}) AS ranked_edges
1153
+ WHERE endpoint_rank <= ${params.limitPerEndpoint}
1154
+ ORDER BY ${derivedOrderByClause}
1155
+ `;
1156
+ }
837
1157
  function buildCountEdgesByKind(tables, params) {
838
1158
  const { edges } = tables;
839
1159
  const conditions = [
@@ -1243,6 +1563,37 @@ function buildUpdateNode(tables, params, timestamp) {
1243
1563
  RETURNING *
1244
1564
  `;
1245
1565
  }
1566
+ function buildUpdateNodeSet(tables, dialect, params, timestamp) {
1567
+ const { nodes } = tables;
1568
+ const adapter = getDialect(dialect);
1569
+ const patchedProps = toDrizzleSql(
1570
+ adapter.jsonSetProperties(
1571
+ sql$1.identifier(nodes.props.name),
1572
+ params.patch,
1573
+ params.unsetProperties ?? []
1574
+ ),
1575
+ dialect
1576
+ );
1577
+ const candidateIds = toDrizzleSql(params.candidateIds, dialect);
1578
+ const candidateIdColumn = toDrizzleSql(
1579
+ sql$1.identifier(params.candidateIdColumn),
1580
+ dialect
1581
+ );
1582
+ return sql`
1583
+ UPDATE ${nodes}
1584
+ SET ${quotedColumn(nodes.props)} = ${patchedProps},
1585
+ ${quotedColumn(nodes.updatedAt)} = ${timestamp},
1586
+ ${quotedColumn(nodes.version)} = ${quotedColumn(nodes.version)} + 1
1587
+ WHERE ${nodes.graphId} = ${params.graphId}
1588
+ AND ${nodes.kind} = ${params.kind}
1589
+ AND ${nodes.deletedAt} IS NULL
1590
+ AND ${nodes.id} IN (
1591
+ SELECT ${candidateIdColumn}
1592
+ FROM (${candidateIds}) AS tg_set_candidates
1593
+ )
1594
+ RETURNING *
1595
+ `;
1596
+ }
1246
1597
  function buildDeleteNode(tables, params, timestamp) {
1247
1598
  const { nodes } = tables;
1248
1599
  return sql`
@@ -1478,12 +1829,23 @@ function buildDeleteUnique(tables, params, timestamp) {
1478
1829
  AND ${uniques.deletedAt} IS NULL
1479
1830
  `;
1480
1831
  }
1481
- function buildHardDeleteUniquesByNode(tables, graphId, nodeId) {
1832
+ function buildHardDeleteUniquesByNode(tables, graphId, concreteKind, nodeId) {
1833
+ return buildHardDeleteUniquesByNodeIds(tables, {
1834
+ graphId,
1835
+ concreteKind,
1836
+ nodeIds: [nodeId]
1837
+ });
1838
+ }
1839
+ function buildHardDeleteUniquesByNodeIds(tables, params) {
1482
1840
  const { uniques } = tables;
1483
1841
  return sql`
1484
1842
  DELETE FROM ${uniques}
1485
- WHERE ${uniques.graphId} = ${graphId}
1486
- AND ${uniques.nodeId} = ${nodeId}
1843
+ WHERE ${uniques.graphId} = ${params.graphId}
1844
+ AND ${uniques.concreteKind} = ${params.concreteKind}
1845
+ AND ${uniques.nodeId} IN (${sql.join(
1846
+ params.nodeIds.map((nodeId) => sql`${nodeId}`),
1847
+ sql`, `
1848
+ )})
1487
1849
  `;
1488
1850
  }
1489
1851
  function buildCheckUnique(tables, params) {
@@ -1571,9 +1933,12 @@ var COMMON_TABLE_OPERATION_BUILDERS = {
1571
1933
  buildFindNodesByKind,
1572
1934
  buildCountNodesByKind,
1573
1935
  buildFindEdgesByKind,
1936
+ buildFindEdgesByEndpointSet,
1937
+ buildFindEdgesByHeterogeneousEndpointSet,
1574
1938
  buildCountEdgesByKind,
1575
1939
  buildDeleteUnique,
1576
1940
  buildHardDeleteUniquesByNode,
1941
+ buildHardDeleteUniquesByNodeIds,
1577
1942
  buildCheckUnique,
1578
1943
  buildCheckUniqueBatch,
1579
1944
  buildGetSchemaVersion
@@ -1584,6 +1949,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1584
1949
  COMMON_TABLE_OPERATION_BUILDERS
1585
1950
  );
1586
1951
  const fulltextTable = tables.fulltextTableName;
1952
+ const contributionMaterializations = tables.contributionMaterializations;
1587
1953
  const fulltextBuilders = {
1588
1954
  buildUpsertFulltext: (params, timestamp) => fulltextStrategy.buildUpsert(fulltextTable, params, timestamp).map((statement) => toDrizzleSql(statement, dialect)),
1589
1955
  buildDeleteFulltext: (params) => fulltextStrategy.buildDelete(fulltextTable, params).map((statement) => toDrizzleSql(statement, dialect)),
@@ -1650,9 +2016,22 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
1650
2016
  });
1651
2017
  }
1652
2018
  };
2019
+ function buildDeleteContributionMaterialization(identity) {
2020
+ return sql`
2021
+ DELETE FROM ${contributionMaterializations}
2022
+ WHERE graph_id = ${identity.graphId}
2023
+ AND logical_name = ${identity.logicalName}
2024
+ AND owner = ${identity.owner}
2025
+ AND table_name = ${identity.tableName}
2026
+ `;
2027
+ }
1653
2028
  return {
1654
2029
  ...tableOperations,
1655
2030
  ...fulltextBuilders,
2031
+ buildUpdateNodeSet(params, timestamp) {
2032
+ return buildUpdateNodeSet(tables, dialect, params, timestamp);
2033
+ },
2034
+ buildDeleteContributionMaterialization,
1656
2035
  buildInsertUnique(params) {
1657
2036
  return buildInsertUnique(tables, dialect, params);
1658
2037
  },
@@ -1735,6 +2114,9 @@ function assertAdoptedDialect(externalTx, brand, backend) {
1735
2114
  }
1736
2115
  function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
1737
2116
  const expectedVersion = expected.kind === "active" ? expected.version : 0;
2117
+ assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion);
2118
+ }
2119
+ function assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion) {
1738
2120
  if (actualActiveVersion !== expectedVersion) {
1739
2121
  throw new StaleVersionError({
1740
2122
  graphId,
@@ -1743,17 +2125,58 @@ function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
1743
2125
  });
1744
2126
  }
1745
2127
  }
2128
+ async function commitSchemaVersionIfKindsEmpty(backend, params, probes) {
2129
+ const [existing, active] = await Promise.all([
2130
+ backend.getSchemaVersion(params.graphId, params.version),
2131
+ backend.getActiveSchema(params.graphId)
2132
+ ]);
2133
+ if (existing !== void 0 && (existing.is_active || existing.schema_hash !== params.schemaHash)) {
2134
+ return {
2135
+ status: "committed",
2136
+ row: await backend.commitSchemaVersion(params)
2137
+ };
2138
+ }
2139
+ verifyExpectedActiveVersion(
2140
+ params.graphId,
2141
+ params.expected,
2142
+ active?.version ?? 0
2143
+ );
2144
+ const populated = [];
2145
+ for (const probe of probes) {
2146
+ const count = probe.entity === "node" ? await backend.countNodesByKind({
2147
+ graphId: params.graphId,
2148
+ kind: probe.kind
2149
+ }) : await backend.countEdgesByKind({
2150
+ graphId: params.graphId,
2151
+ kind: probe.kind
2152
+ });
2153
+ if (count > 0) populated.push({ ...probe, count });
2154
+ }
2155
+ if (populated.length > 0) {
2156
+ return { status: "populated", kinds: populated };
2157
+ }
2158
+ return {
2159
+ status: "committed",
2160
+ row: await backend.commitSchemaVersion(params)
2161
+ };
2162
+ }
1746
2163
  function createCommonOperationBackend(options) {
1747
- const { batchConfig, execution, operationStrategy, rowMappers } = options;
2164
+ const {
2165
+ batchConfig,
2166
+ execution,
2167
+ maxBindParameters,
2168
+ operationStrategy,
2169
+ rowMappers
2170
+ } = options;
1748
2171
  const nowIso2 = options.nowIso ?? nowIso;
1749
- const requiredClearTableExists = createCachedTableExistence(
2172
+ const tableExists = createCachedTableExistence(
1750
2173
  (tableName) => execution.execGet(
1751
2174
  operationStrategy.buildTableExists(tableName)
1752
2175
  ),
1753
2176
  options.tableExistenceCache
1754
2177
  );
1755
2178
  async function runIgnorableClearStatement(statement) {
1756
- if (statement.ignoreMissingTable === true && statement.requiredTableName !== void 0 && !await requiredClearTableExists(statement.requiredTableName)) {
2179
+ if (statement.ignoreMissingTable === true && statement.requiredTableName !== void 0 && !await tableExists(statement.requiredTableName)) {
1757
2180
  return;
1758
2181
  }
1759
2182
  await execution.execRun(statement.query);
@@ -1765,6 +2188,10 @@ function createCommonOperationBackend(options) {
1765
2188
  return row === void 0 ? 0 : rowMappers.toSchemaVersionRow(row).version;
1766
2189
  }
1767
2190
  return {
2191
+ tableExists,
2192
+ async executeSchemaDdl(ddl) {
2193
+ await execution.execRun(asCompiledStatementSql(sql$1.raw(ddl)));
2194
+ },
1768
2195
  async executeStatement(query) {
1769
2196
  await execution.execRun(query);
1770
2197
  },
@@ -1842,6 +2269,25 @@ function createCommonOperationBackend(options) {
1842
2269
  );
1843
2270
  return rowMappers.toNodeRow(row);
1844
2271
  },
2272
+ async updateNodeSet(params) {
2273
+ if (Object.keys(params.patch).length === 0 && (params.unsetProperties?.length ?? 0) === 0) {
2274
+ throw new ConfigurationError(
2275
+ "Set-based node update requires at least one property",
2276
+ { operation: "updateNodeSet", kind: params.kind }
2277
+ );
2278
+ }
2279
+ if (params.candidateIdColumn.length === 0) {
2280
+ throw new ConfigurationError(
2281
+ "Set-based node update requires a candidate id column",
2282
+ { operation: "updateNodeSet", kind: params.kind }
2283
+ );
2284
+ }
2285
+ const timestamp = nowIso2();
2286
+ const query = operationStrategy.buildUpdateNodeSet(params, timestamp);
2287
+ const rows = await execution.execAll(query);
2288
+ const updatedRows = rows.map((row) => rowMappers.toNodeRow(row));
2289
+ return { affectedCount: updatedRows.length, rows: updatedRows };
2290
+ },
1845
2291
  async deleteNode(params) {
1846
2292
  const timestamp = nowIso2();
1847
2293
  const query = operationStrategy.buildDeleteNode(params, timestamp);
@@ -1859,6 +2305,7 @@ function createCommonOperationBackend(options) {
1859
2305
  async hardDeleteNode(params) {
1860
2306
  const deleteUniquesQuery = operationStrategy.buildHardDeleteUniquesByNode(
1861
2307
  params.graphId,
2308
+ params.kind,
1862
2309
  params.id
1863
2310
  );
1864
2311
  await execution.execRun(deleteUniquesQuery);
@@ -2017,6 +2464,37 @@ function createCommonOperationBackend(options) {
2017
2464
  const rows = await execution.execAll(query);
2018
2465
  return rows.map((row) => rowMappers.toEdgeRow(row));
2019
2466
  },
2467
+ async findEdgesByEndpointSet(params) {
2468
+ const ids = resolveEdgeEndpointIds(params);
2469
+ const edgeRows = [];
2470
+ for (const idChunk of chunk(
2471
+ ids,
2472
+ batchConfig.findEdgesEndpointChunkSize
2473
+ )) {
2474
+ const query = operationStrategy.buildFindEdgesByEndpointSet(
2475
+ params,
2476
+ idChunk
2477
+ );
2478
+ const rows = await execution.execAll(query);
2479
+ for (const row of rows) edgeRows.push(rowMappers.toEdgeRow(row));
2480
+ }
2481
+ return edgeRows;
2482
+ },
2483
+ async findEdgesByHeterogeneousEndpointSet(params) {
2484
+ const { edgeKinds, endpoints, endpointChunkSize } = resolveHeterogeneousEdgeRead(params, maxBindParameters);
2485
+ if (edgeKinds.length === 0 || endpoints.length === 0) return [];
2486
+ const edgeRows = [];
2487
+ for (const endpointChunk of chunk(endpoints, endpointChunkSize)) {
2488
+ const query = operationStrategy.buildFindEdgesByHeterogeneousEndpointSet(
2489
+ params,
2490
+ endpointChunk,
2491
+ edgeKinds
2492
+ );
2493
+ const rows = await execution.execAll(query);
2494
+ for (const row of rows) edgeRows.push(rowMappers.toEdgeRow(row));
2495
+ }
2496
+ return edgeRows;
2497
+ },
2020
2498
  async countEdgesByKind(params) {
2021
2499
  const query = operationStrategy.buildCountEdgesByKind(params);
2022
2500
  const row = await execution.execGet(query);
@@ -2087,6 +2565,19 @@ function createCommonOperationBackend(options) {
2087
2565
  const query = operationStrategy.buildDeleteUnique(params, timestamp);
2088
2566
  await execution.execRun(query);
2089
2567
  },
2568
+ async hardDeleteUniquesByNodeIds(params) {
2569
+ const nodeIds = [...new Set(params.nodeIds)];
2570
+ for (const chunk2 of chunk(
2571
+ nodeIds,
2572
+ batchConfig.uniqueDeleteChunkSize
2573
+ )) {
2574
+ const query = operationStrategy.buildHardDeleteUniquesByNodeIds({
2575
+ ...params,
2576
+ nodeIds: chunk2
2577
+ });
2578
+ await execution.execRun(query);
2579
+ }
2580
+ },
2090
2581
  async checkUnique(params) {
2091
2582
  const query = operationStrategy.buildCheckUnique(params);
2092
2583
  const row = await execution.execGet(query);
@@ -2487,6 +2978,6 @@ function getOrCreateLru(cache, key, cacheMax, create) {
2487
2978
  return value;
2488
2979
  }
2489
2980
 
2490
- export { EMBEDDING_UPSERT_PARAM_COUNT, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, POSTGRES_INDEX_MAT_TIMESTAMPS, POSTGRES_KIND_REMOVAL_TIMESTAMPS, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, SQLITE_INDEX_MAT_TIMESTAMPS, SQLITE_KIND_REMOVAL_TIMESTAMPS, analyzeImportedTables, assertAdoptedDialect, assertTrustedImportDatabaseEmpty, buildContributionInsertValues, buildContributionOnConflictSet, buildKindRemovalInsertValues, buildKindRemovalOnConflictSet, buildLiveNodeCandidates, buildMaterializationInsertValues, buildMaterializationOnConflictSet, createCachedTableExistence, createCommonOperationBackend, createContributionMaterializer, createPostgresOperationStrategy, createPostgresTrustedImportSession, createSqliteOperationStrategy, createSqliteTrustedImportSession, gateFulltext, gateFulltextMethods, getOrCreateLru, lockPostgresTrustedImportTables, mapContributionMaterializationRow, mapHybridSearchRow, mapKindRemovalRow, mapMaterializationRow, mapVectorWriteError, restoreSecondaryIndexes, suspendPostgresSecondaryIndexes, suspendSqliteSecondaryIndexes, vectorSlotFromCreateIndexParams, vectorSlotFromDropIndexParams, vectorSlotFromParams };
2491
- //# sourceMappingURL=chunk-HHBKGPEI.js.map
2492
- //# sourceMappingURL=chunk-HHBKGPEI.js.map
2981
+ export { EMBEDDING_UPSERT_PARAM_COUNT, FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, POSTGRES_INDEX_MAT_TIMESTAMPS, POSTGRES_KIND_REMOVAL_TIMESTAMPS, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, SQLITE_INDEX_MAT_TIMESTAMPS, SQLITE_KIND_REMOVAL_TIMESTAMPS, analyzeImportedTables, assertActiveSchemaVersion, assertAdoptedDialect, assertTrustedImportDatabaseEmpty, buildContributionInsertValues, buildContributionOnConflictSet, buildKindRemovalInsertValues, buildKindRemovalOnConflictSet, buildLiveNodeCandidates, buildMaterializationInsertValues, buildMaterializationOnConflictSet, commitSchemaVersionIfKindsEmpty, createCachedTableExistence, createCommonOperationBackend, createContributionMaterializer, createPostgresOperationStrategy, createPostgresTrustedImportSession, createSqliteOperationStrategy, createSqliteTrustedImportSession, gateFulltext, gateFulltextMethods, getOrCreateLru, lockPostgresTrustedImportTables, mapContributionMaterializationRow, mapHybridSearchRow, mapKindRemovalRow, mapMaterializationRow, mapVectorWriteError, restoreSecondaryIndexes, suspendPostgresSecondaryIndexes, suspendSqliteSecondaryIndexes, tableExistsFromRow, vectorSlotFromCreateIndexParams, vectorSlotFromDropIndexParams, vectorSlotFromParams };
2982
+ //# sourceMappingURL=chunk-DXEEHSGN.js.map
2983
+ //# sourceMappingURL=chunk-DXEEHSGN.js.map