@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,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var chunkO7XVCLXW_cjs = require('./chunk-O7XVCLXW.cjs');
4
- var chunk33PAKPED_cjs = require('./chunk-33PAKPED.cjs');
5
- var chunkAQR6BHB3_cjs = require('./chunk-AQR6BHB3.cjs');
6
- var chunkOMQ2NBOR_cjs = require('./chunk-OMQ2NBOR.cjs');
7
- var chunk6TJ6PKPS_cjs = require('./chunk-6TJ6PKPS.cjs');
3
+ var chunkH7VE3FL4_cjs = require('./chunk-H7VE3FL4.cjs');
4
+ var chunkD56XG4EI_cjs = require('./chunk-D56XG4EI.cjs');
5
+ var chunkF4NHQHEZ_cjs = require('./chunk-F4NHQHEZ.cjs');
6
+ var chunkZ3WO6MND_cjs = require('./chunk-Z3WO6MND.cjs');
7
+ var chunkOOA273IJ_cjs = require('./chunk-OOA273IJ.cjs');
8
8
  var chunkZDH3DX3C_cjs = require('./chunk-ZDH3DX3C.cjs');
9
- var chunkECU53PMN_cjs = require('./chunk-ECU53PMN.cjs');
10
- var chunkAO2WPYFZ_cjs = require('./chunk-AO2WPYFZ.cjs');
11
- var chunkUTTW2Q3M_cjs = require('./chunk-UTTW2Q3M.cjs');
12
- var chunkX2XOQZT3_cjs = require('./chunk-X2XOQZT3.cjs');
9
+ var chunkEKFUG4G7_cjs = require('./chunk-EKFUG4G7.cjs');
10
+ var chunkJQXSZHF2_cjs = require('./chunk-JQXSZHF2.cjs');
11
+ var chunkJXUTCSXX_cjs = require('./chunk-JXUTCSXX.cjs');
12
+ var chunkU5W4LKZV_cjs = require('./chunk-U5W4LKZV.cjs');
13
13
  var chunk764JHTLT_cjs = require('./chunk-764JHTLT.cjs');
14
- var chunkKTBTSHU6_cjs = require('./chunk-KTBTSHU6.cjs');
14
+ var chunkC4F7VJ5D_cjs = require('./chunk-C4F7VJ5D.cjs');
15
15
  var drizzleOrm = require('drizzle-orm');
16
16
  var pgCore = require('drizzle-orm/pg-core');
17
17
 
@@ -50,7 +50,7 @@ var DEFAULT_POSTGRES_STATEMENT_CACHE_MAX = 256;
50
50
  var STATEMENT_NAME_CACHE = /* @__PURE__ */ new Map();
51
51
  var nextStatementId = 0;
52
52
  function statementNameFor(sqlText, cacheMax) {
53
- return chunkO7XVCLXW_cjs.getOrCreateLru(STATEMENT_NAME_CACHE, sqlText, cacheMax, () => {
53
+ return chunkH7VE3FL4_cjs.getOrCreateLru(STATEMENT_NAME_CACHE, sqlText, cacheMax, () => {
54
54
  const name = `tg_${nextStatementId}`;
55
55
  nextStatementId += 1;
56
56
  return name;
@@ -164,7 +164,7 @@ function createPostgresExecutionAdapter(db, options = {}) {
164
164
  options.useTransactionClient ?? false
165
165
  );
166
166
  function compile(query) {
167
- return chunk6TJ6PKPS_cjs.compileQueryWithDialect(db, query, "PostgreSQL");
167
+ return chunkOOA273IJ_cjs.compileQueryWithDialect(db, query, "PostgreSQL");
168
168
  }
169
169
  function assertCompiledWithinBindParameterLimit(compiledQuery) {
170
170
  assertWithinBindParameterLimit(
@@ -179,7 +179,7 @@ function createPostgresExecutionAdapter(db, options = {}) {
179
179
  assertCompiledWithinBindParameterLimit(compile(query));
180
180
  return executeDrizzleQuery(
181
181
  db,
182
- chunkX2XOQZT3_cjs.isSqlFragment(query) ? chunk6TJ6PKPS_cjs.toDrizzleSql(query, "postgres") : query
182
+ chunkU5W4LKZV_cjs.isSqlFragment(query) ? chunkOOA273IJ_cjs.toDrizzleSql(query, "postgres") : query
183
183
  );
184
184
  }
185
185
  };
@@ -198,7 +198,7 @@ function createPostgresExecutionAdapter(db, options = {}) {
198
198
  async execute(query) {
199
199
  const compiled = compile(query);
200
200
  assertCompiledWithinBindParameterLimit(compiled);
201
- if (chunkX2XOQZT3_cjs.isSqlFragment(query) && chunkX2XOQZT3_cjs.shouldForceCustomPlan(query)) {
201
+ if (chunkU5W4LKZV_cjs.isSqlFragment(query) && chunkU5W4LKZV_cjs.shouldForceCustomPlan(query)) {
202
202
  const result = await pgQueryClient.queryUnnamed(
203
203
  compiled.sql,
204
204
  compiled.params
@@ -221,7 +221,7 @@ function assertWithinBindParameterLimit(parameterCount, maxBindParameters) {
221
221
  if (maxBindParameters === void 0 || parameterCount <= maxBindParameters) {
222
222
  return;
223
223
  }
224
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
224
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
225
225
  `PostgreSQL statement uses ${parameterCount} bound parameters, exceeding this backend's limit of ${maxBindParameters}.`,
226
226
  {
227
227
  capability: "maxBindParameters",
@@ -242,7 +242,7 @@ function createStatementQueue() {
242
242
  let closed = false;
243
243
  return {
244
244
  enqueue(task) {
245
- if (closed) return Promise.reject(new chunkKTBTSHU6_cjs.TransactionClosedError());
245
+ if (closed) return Promise.reject(new chunkC4F7VJ5D_cjs.TransactionClosedError());
246
246
  const result = tail.then(() => task());
247
247
  tail = result.then(ignoreOutcome, ignoreOutcome);
248
248
  return result;
@@ -293,6 +293,7 @@ var GET_EDGES_FIXED_PARAM_COUNT = 1;
293
293
  var FULLTEXT_UPSERT_PARAM_COUNT = 6;
294
294
  var FULLTEXT_DELETE_FIXED_PARAM_COUNT = 2;
295
295
  var CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT = 3;
296
+ var UNIQUE_DELETE_FIXED_PARAM_COUNT = 2;
296
297
  var UNIQUE_INSERT_PARAM_COUNT = 6;
297
298
  function computePostgresBatchChunkSizes(maxBindParameters) {
298
299
  return {
@@ -306,7 +307,11 @@ function computePostgresBatchChunkSizes(maxBindParameters) {
306
307
  ),
307
308
  embeddingUpsertBatchSize: Math.max(
308
309
  1,
309
- Math.floor(maxBindParameters / chunkO7XVCLXW_cjs.EMBEDDING_UPSERT_PARAM_COUNT)
310
+ Math.floor(maxBindParameters / chunkH7VE3FL4_cjs.EMBEDDING_UPSERT_PARAM_COUNT)
311
+ ),
312
+ findEdgesEndpointChunkSize: Math.max(
313
+ 1,
314
+ maxBindParameters - chunkH7VE3FL4_cjs.FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT
310
315
  ),
311
316
  fulltextDeleteChunkSize: Math.max(
312
317
  1,
@@ -328,29 +333,33 @@ function computePostgresBatchChunkSizes(maxBindParameters) {
328
333
  1,
329
334
  Math.floor(maxBindParameters / NODE_INSERT_PARAM_COUNT)
330
335
  ),
336
+ uniqueDeleteChunkSize: Math.max(
337
+ 1,
338
+ maxBindParameters - UNIQUE_DELETE_FIXED_PARAM_COUNT
339
+ ),
331
340
  uniqueInsertBatchSize: Math.max(
332
341
  1,
333
342
  Math.floor(maxBindParameters / UNIQUE_INSERT_PARAM_COUNT)
334
343
  )
335
344
  };
336
345
  }
337
- var toNodeRow = chunkAQR6BHB3_cjs.createNodeRowMapper(chunkAQR6BHB3_cjs.POSTGRES_ROW_MAPPER_CONFIG);
338
- var toEdgeRow = chunkAQR6BHB3_cjs.createEdgeRowMapper(chunkAQR6BHB3_cjs.POSTGRES_ROW_MAPPER_CONFIG);
339
- var toUniqueRow = chunkAQR6BHB3_cjs.createUniqueRowMapper(chunkAQR6BHB3_cjs.POSTGRES_ROW_MAPPER_CONFIG);
340
- var toSchemaVersionRow = chunkAQR6BHB3_cjs.createSchemaVersionRowMapper(
341
- chunkAQR6BHB3_cjs.POSTGRES_ROW_MAPPER_CONFIG
346
+ var toNodeRow = chunkF4NHQHEZ_cjs.createNodeRowMapper(chunkF4NHQHEZ_cjs.POSTGRES_ROW_MAPPER_CONFIG);
347
+ var toEdgeRow = chunkF4NHQHEZ_cjs.createEdgeRowMapper(chunkF4NHQHEZ_cjs.POSTGRES_ROW_MAPPER_CONFIG);
348
+ var toUniqueRow = chunkF4NHQHEZ_cjs.createUniqueRowMapper(chunkF4NHQHEZ_cjs.POSTGRES_ROW_MAPPER_CONFIG);
349
+ var toSchemaVersionRow = chunkF4NHQHEZ_cjs.createSchemaVersionRowMapper(
350
+ chunkF4NHQHEZ_cjs.POSTGRES_ROW_MAPPER_CONFIG
342
351
  );
343
352
  function buildPostgresCapabilities(fulltextStrategy, vectorStrategy) {
344
353
  return {
345
- ...chunkECU53PMN_cjs.POSTGRES_CAPABILITIES,
346
- ...vectorStrategy === void 0 ? {} : { vector: chunkUTTW2Q3M_cjs.buildVectorCapabilities(vectorStrategy) },
347
- fulltext: chunkUTTW2Q3M_cjs.buildFulltextCapabilities(fulltextStrategy)
354
+ ...chunkEKFUG4G7_cjs.POSTGRES_CAPABILITIES,
355
+ ...vectorStrategy === void 0 ? {} : { vector: chunkJXUTCSXX_cjs.buildVectorCapabilities(vectorStrategy) },
356
+ fulltext: chunkJXUTCSXX_cjs.buildFulltextCapabilities(fulltextStrategy)
348
357
  };
349
358
  }
350
359
  function createPostgresBackend(db, options = {}) {
351
- const tables2 = options.tables ?? chunkOMQ2NBOR_cjs.tables;
352
- const fulltextStrategy = options.fulltext ?? chunkUTTW2Q3M_cjs.tsvectorStrategy;
353
- const vectorStrategy = options.vector === false ? void 0 : options.vector ?? chunk33PAKPED_cjs.pgvectorStrategy;
360
+ const tables2 = options.tables ?? chunkZ3WO6MND_cjs.tables;
361
+ const fulltextStrategy = options.fulltext ?? chunkJXUTCSXX_cjs.tsvectorStrategy;
362
+ const vectorStrategy = options.vector === false ? void 0 : options.vector ?? chunkD56XG4EI_cjs.pgvectorStrategy;
354
363
  const iterativeScanProbe = createIterativeScanProbe();
355
364
  const baseCapabilities = buildPostgresCapabilities(
356
365
  fulltextStrategy,
@@ -363,14 +372,14 @@ function createPostgresBackend(db, options = {}) {
363
372
  supported: false
364
373
  }
365
374
  } : {};
366
- const configuredMaxBindParameters = options.capabilities?.maxBindParameters ?? chunkECU53PMN_cjs.POSTGRES_MAX_BIND_PARAMETERS;
375
+ const configuredMaxBindParameters = options.capabilities?.maxBindParameters ?? chunkEKFUG4G7_cjs.POSTGRES_MAX_BIND_PARAMETERS;
367
376
  const driverBindParameterOverrides = isPgliteDatabase(db) ? {
368
377
  maxBindParameters: Math.min(
369
378
  configuredMaxBindParameters,
370
379
  PGLITE_MAX_BIND_PARAMETERS
371
380
  )
372
381
  } : {};
373
- const capabilities = chunkECU53PMN_cjs.normalizeGraphAnalyticsCapabilities({
382
+ const capabilities = chunkEKFUG4G7_cjs.normalizeGraphAnalyticsCapabilities({
374
383
  ...baseCapabilities,
375
384
  ...httpOnlyOverrides,
376
385
  ...options.capabilities,
@@ -379,7 +388,7 @@ function createPostgresBackend(db, options = {}) {
379
388
  const adapterOptions = {
380
389
  ...options.prepareStatements === void 0 ? {} : { prepareStatements: options.prepareStatements },
381
390
  ...options.preparedStatementCacheMax === void 0 ? {} : { preparedStatementCacheMax: options.preparedStatementCacheMax },
382
- maxBindParameters: capabilities.maxBindParameters ?? chunkECU53PMN_cjs.POSTGRES_MAX_BIND_PARAMETERS
391
+ maxBindParameters: capabilities.maxBindParameters ?? chunkEKFUG4G7_cjs.POSTGRES_MAX_BIND_PARAMETERS
383
392
  };
384
393
  const executionAdapter = createPostgresExecutionAdapter(db, adapterOptions);
385
394
  const tableNames = {
@@ -398,8 +407,8 @@ function createPostgresBackend(db, options = {}) {
398
407
  drizzleOrm.getTableName(tables2.uniques),
399
408
  tableNames.fulltext
400
409
  ].map(
401
- (name) => chunk6TJ6PKPS_cjs.toDrizzleSql(
402
- chunkX2XOQZT3_cjs.sql`ANALYZE (SKIP_LOCKED) ${chunkX2XOQZT3_cjs.sql.identifier(name)}`,
410
+ (name) => chunkOOA273IJ_cjs.toDrizzleSql(
411
+ chunkU5W4LKZV_cjs.sql`ANALYZE (SKIP_LOCKED) ${chunkU5W4LKZV_cjs.sql.identifier(name)}`,
403
412
  "postgres"
404
413
  )
405
414
  );
@@ -408,11 +417,11 @@ function createPostgresBackend(db, options = {}) {
408
417
  tableNames.recordedEdges,
409
418
  tableNames.recordedClock
410
419
  ];
411
- const operationStrategy = chunkO7XVCLXW_cjs.createPostgresOperationStrategy(
420
+ const operationStrategy = chunkH7VE3FL4_cjs.createPostgresOperationStrategy(
412
421
  tables2,
413
422
  fulltextStrategy
414
423
  );
415
- const recordedTableExists = chunkO7XVCLXW_cjs.createCachedTableExistence(
424
+ const recordedTableExists = chunkH7VE3FL4_cjs.createCachedTableExistence(
416
425
  async (tableName) => {
417
426
  const rows = await executionAdapter.execute(
418
427
  operationStrategy.buildTableExists(tableName)
@@ -422,8 +431,17 @@ function createPostgresBackend(db, options = {}) {
422
431
  { cacheExisting: false }
423
432
  );
424
433
  const matTable = tables2.contributionMaterializations;
434
+ async function ensureTableWithConcurrentCreateRetry(table) {
435
+ const statement = drizzleOrm.sql.raw(chunkZ3WO6MND_cjs.generatePgCreateTableSQL(table));
436
+ try {
437
+ await db.execute(statement);
438
+ } catch (error) {
439
+ if (!chunkJQXSZHF2_cjs.isPostgresUniqueViolationError(error)) throw error;
440
+ await db.execute(statement);
441
+ }
442
+ }
425
443
  async function ensureContributionMaterializationsTableImpl() {
426
- await db.execute(drizzleOrm.sql.raw(chunkOMQ2NBOR_cjs.generatePgCreateTableSQL(matTable)));
444
+ await ensureTableWithConcurrentCreateRetry(matTable);
427
445
  }
428
446
  async function getContributionMaterializationRow(identity) {
429
447
  const rows = await db.select().from(matTable).where(
@@ -436,25 +454,25 @@ function createPostgresBackend(db, options = {}) {
436
454
  );
437
455
  const row = rows[0];
438
456
  if (row === void 0) return void 0;
439
- return chunkO7XVCLXW_cjs.mapContributionMaterializationRow(
457
+ return chunkH7VE3FL4_cjs.mapContributionMaterializationRow(
440
458
  row,
441
- chunkO7XVCLXW_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
459
+ chunkH7VE3FL4_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
442
460
  );
443
461
  }
444
462
  async function getContributionMaterializationRows(graphId) {
445
463
  const rows = await db.select().from(matTable).where(drizzleOrm.eq(matTable.graphId, graphId));
446
464
  return rows.map(
447
- (row) => chunkO7XVCLXW_cjs.mapContributionMaterializationRow(
465
+ (row) => chunkH7VE3FL4_cjs.mapContributionMaterializationRow(
448
466
  row,
449
- chunkO7XVCLXW_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
467
+ chunkH7VE3FL4_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
450
468
  )
451
469
  );
452
470
  }
453
471
  async function recordContributionMaterializationRow(params) {
454
472
  await db.insert(matTable).values(
455
- chunkO7XVCLXW_cjs.buildContributionInsertValues(
473
+ chunkH7VE3FL4_cjs.buildContributionInsertValues(
456
474
  params,
457
- chunkO7XVCLXW_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.encode
475
+ chunkH7VE3FL4_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.encode
458
476
  )
459
477
  ).onConflictDoUpdate({
460
478
  target: [
@@ -463,7 +481,7 @@ function createPostgresBackend(db, options = {}) {
463
481
  matTable.owner,
464
482
  matTable.tableName
465
483
  ],
466
- set: chunkO7XVCLXW_cjs.buildContributionOnConflictSet(
484
+ set: chunkH7VE3FL4_cjs.buildContributionOnConflictSet(
467
485
  matTable.materializedAt,
468
486
  params.materializedAt
469
487
  )
@@ -479,7 +497,13 @@ function createPostgresBackend(db, options = {}) {
479
497
  )
480
498
  );
481
499
  }
482
- const contributionMaterializer = chunkO7XVCLXW_cjs.createContributionMaterializer({
500
+ async function contributionTableExists(tableName) {
501
+ const rows = await executionAdapter.execute(
502
+ operationStrategy.buildTableExists(tableName)
503
+ );
504
+ return chunkH7VE3FL4_cjs.tableExistsFromRow(rows[0]);
505
+ }
506
+ const contributionMaterializer = chunkH7VE3FL4_cjs.createContributionMaterializer({
483
507
  dialect: "postgres",
484
508
  fulltextStrategy,
485
509
  fulltextTableName: tables2.fulltextTableName,
@@ -490,7 +514,8 @@ function createPostgresBackend(db, options = {}) {
490
514
  ensureMarkerTable: ensureContributionMaterializationsTableImpl,
491
515
  getMarkers: getContributionMaterializationRows,
492
516
  recordMarker: recordContributionMaterializationRow,
493
- deleteMarker: deleteContributionMaterializationRow
517
+ deleteMarker: deleteContributionMaterializationRow,
518
+ tableExists: contributionTableExists
494
519
  });
495
520
  const operations = createPostgresOperationBackend({
496
521
  db,
@@ -502,12 +527,14 @@ function createPostgresBackend(db, options = {}) {
502
527
  fulltextStrategy,
503
528
  vectorStrategy,
504
529
  contributionMaterializer,
505
- iterativeScanProbe
530
+ iterativeScanProbe,
531
+ schemaVersionsTable: tables2.schemaVersions,
532
+ transactionScoped: false
506
533
  });
507
534
  function runSchemaWriteTransaction(graphId, fn) {
508
535
  if (!capabilities.transactions) {
509
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
510
- "commitSchemaVersion and setActiveVersion require atomic transactions, but this Postgres backend does not provide them. The drizzle-orm/neon-http driver communicates over HTTP and cannot hold a session across statements; use drizzle-orm/neon-serverless (websocket) for transactional writes.",
536
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
537
+ "Schema writes and removal cleanup require atomic transactions, but this Postgres backend does not provide them. The drizzle-orm/neon-http driver communicates over HTTP and cannot hold a session across statements; use drizzle-orm/neon-serverless (websocket) for transactional writes.",
511
538
  {
512
539
  backend: "postgres",
513
540
  capability: "transactions",
@@ -517,6 +544,13 @@ function createPostgresBackend(db, options = {}) {
517
544
  }
518
545
  return db.transaction(async (tx) => {
519
546
  await tx.execute(drizzleOrm.sql`SELECT pg_advisory_xact_lock(hashtext(${graphId}))`);
547
+ await tx.execute(drizzleOrm.sql`
548
+ SELECT ${tables2.schemaVersions.version}
549
+ FROM ${tables2.schemaVersions}
550
+ WHERE ${tables2.schemaVersions.graphId} = ${graphId}
551
+ AND ${tables2.schemaVersions.isActive} = TRUE
552
+ FOR UPDATE
553
+ `);
520
554
  const { backend: txBackend, drainAndClose } = createTransactionBackend({
521
555
  db: tx,
522
556
  adapterOptions,
@@ -526,7 +560,8 @@ function createPostgresBackend(db, options = {}) {
526
560
  fulltextStrategy,
527
561
  vectorStrategy,
528
562
  contributionMaterializer,
529
- iterativeScanProbe
563
+ iterativeScanProbe,
564
+ schemaVersionsTable: tables2.schemaVersions
530
565
  });
531
566
  try {
532
567
  return await fn(txBackend);
@@ -545,10 +580,11 @@ function createPostgresBackend(db, options = {}) {
545
580
  fulltextStrategy,
546
581
  vectorStrategy,
547
582
  contributionMaterializer,
548
- iterativeScanProbe
583
+ iterativeScanProbe,
584
+ schemaVersionsTable: tables2.schemaVersions
549
585
  });
550
586
  return {
551
- backend: chunkO7XVCLXW_cjs.gateFulltext(
587
+ backend: chunkH7VE3FL4_cjs.gateFulltext(
552
588
  backend2,
553
589
  contributionMaterializer.assertInitialized
554
590
  ),
@@ -558,56 +594,59 @@ function createPostgresBackend(db, options = {}) {
558
594
  const backend = {
559
595
  ...operations,
560
596
  ...capabilities.transactions && executionAdapter.executeCompiled !== void 0 ? {
561
- async trustedImport(fn) {
597
+ async trustedImport(fn, options_) {
562
598
  return backend.transactionWithNative(async (tx, rawSql) => {
599
+ if (options_?.schemaWrite !== void 0) {
600
+ await chunk764JHTLT_cjs.requireDefined(tx.lockSchemaVersionForWrite)({
601
+ ...options_.schemaWrite
602
+ });
603
+ }
563
604
  const trustedExecutionAdapter = createPostgresExecutionAdapter(
564
605
  rawSql,
565
606
  { ...adapterOptions, useTransactionClient: true }
566
607
  );
567
608
  const executeCompiled = trustedExecutionAdapter.executeCompiled;
568
609
  if (executeCompiled === void 0) {
569
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
610
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
570
611
  "Trusted import could not bind raw execution to the PostgreSQL transaction.",
571
612
  { capability: "trustedImport", dialect: "postgres" }
572
613
  );
573
614
  }
574
- const trustedTx = chunkECU53PMN_cjs.createBackendOverlay(tx, {
615
+ const trustedTx = chunkEKFUG4G7_cjs.createBackendOverlay(tx, {
575
616
  executeRaw(sqlText, params) {
576
617
  return executeCompiled({ params, sql: sqlText });
577
618
  }
578
619
  });
579
- await chunkO7XVCLXW_cjs.lockPostgresTrustedImportTables(trustedTx, tableNames);
580
- await chunkO7XVCLXW_cjs.assertTrustedImportDatabaseEmpty(trustedTx, tableNames);
581
- const indexDefinitions = await chunkO7XVCLXW_cjs.suspendPostgresSecondaryIndexes(
620
+ await chunkH7VE3FL4_cjs.lockPostgresTrustedImportTables(trustedTx, tableNames);
621
+ await chunkH7VE3FL4_cjs.assertTrustedImportDatabaseEmpty(trustedTx, tableNames);
622
+ const indexDefinitions = await chunkH7VE3FL4_cjs.suspendPostgresSecondaryIndexes(
582
623
  trustedTx,
583
624
  tableNames
584
625
  );
585
626
  const result = await fn(
586
- chunkO7XVCLXW_cjs.createPostgresTrustedImportSession(trustedTx, tableNames)
627
+ chunkH7VE3FL4_cjs.createPostgresTrustedImportSession(trustedTx, tableNames)
587
628
  );
588
- await chunkO7XVCLXW_cjs.restoreSecondaryIndexes(trustedTx, indexDefinitions);
589
- await chunkO7XVCLXW_cjs.analyzeImportedTables(trustedTx, tableNames);
629
+ await chunkH7VE3FL4_cjs.restoreSecondaryIndexes(trustedTx, indexDefinitions);
630
+ await chunkH7VE3FL4_cjs.analyzeImportedTables(trustedTx, tableNames);
590
631
  return result;
591
632
  });
592
633
  }
593
634
  } : {},
594
635
  async bootstrapTables() {
595
- const statements = chunkOMQ2NBOR_cjs.generatePostgresDDL(tables2, fulltextStrategy);
636
+ const statements = chunkZ3WO6MND_cjs.generatePostgresDDL(tables2, fulltextStrategy);
596
637
  for (const statement of statements) {
597
638
  await db.execute(drizzleOrm.sql.raw(statement));
598
639
  }
599
640
  },
600
641
  async ensureRevisionOriginsTable() {
601
- await db.execute(
602
- drizzleOrm.sql.raw(chunkOMQ2NBOR_cjs.generatePgCreateTableSQL(tables2.revisionOrigins))
603
- );
642
+ await ensureTableWithConcurrentCreateRetry(tables2.revisionOrigins);
604
643
  },
605
644
  // Every fulltext-touching method asserts the durable marker instead
606
645
  // of lazily emitting DDL. Steady state performs zero ensure; an
607
646
  // uninitialized database throws `StoreNotInitializedError` loudly
608
647
  // rather than self-healing on a read/write path (#135). Shared
609
648
  // verbatim with the tx-scoped gate via `gateFulltextMethods`.
610
- ...chunkO7XVCLXW_cjs.gateFulltextMethods(
649
+ ...chunkH7VE3FL4_cjs.gateFulltextMethods(
611
650
  operations,
612
651
  contributionMaterializer.assertInitialized
613
652
  ),
@@ -615,9 +654,7 @@ function createPostgresBackend(db, options = {}) {
615
654
  await db.execute(drizzleOrm.sql.raw(ddl));
616
655
  },
617
656
  async ensureIndexMaterializationsTable() {
618
- await db.execute(
619
- drizzleOrm.sql.raw(chunkOMQ2NBOR_cjs.generatePgCreateTableSQL(tables2.indexMaterializations))
620
- );
657
+ await ensureTableWithConcurrentCreateRetry(tables2.indexMaterializations);
621
658
  const tableName = drizzleOrm.getTableName(tables2.indexMaterializations);
622
659
  await db.execute(
623
660
  drizzleOrm.sql.raw(
@@ -668,26 +705,26 @@ function createPostgresBackend(db, options = {}) {
668
705
  const rows = await db.select().from(t).where(drizzleOrm.eq(t.indexName, indexName));
669
706
  const row = rows[0];
670
707
  if (row === void 0) return void 0;
671
- return chunkO7XVCLXW_cjs.mapMaterializationRow(row, chunkO7XVCLXW_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode);
708
+ return chunkH7VE3FL4_cjs.mapMaterializationRow(row, chunkH7VE3FL4_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode);
672
709
  },
673
710
  async getIndexMaterializations(statusKeys) {
674
711
  if (statusKeys.length === 0) return [];
675
712
  const t = tables2.indexMaterializations;
676
713
  const rows = await db.select().from(t).where(drizzleOrm.inArray(t.indexName, [...statusKeys]));
677
714
  return rows.map(
678
- (row) => chunkO7XVCLXW_cjs.mapMaterializationRow(row, chunkO7XVCLXW_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode)
715
+ (row) => chunkH7VE3FL4_cjs.mapMaterializationRow(row, chunkH7VE3FL4_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode)
679
716
  );
680
717
  },
681
718
  async recordIndexMaterialization(params) {
682
719
  const t = tables2.indexMaterializations;
683
720
  await db.insert(t).values(
684
- chunkO7XVCLXW_cjs.buildMaterializationInsertValues(
721
+ chunkH7VE3FL4_cjs.buildMaterializationInsertValues(
685
722
  params,
686
- chunkO7XVCLXW_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.encode
723
+ chunkH7VE3FL4_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.encode
687
724
  )
688
725
  ).onConflictDoUpdate({
689
726
  target: t.indexName,
690
- set: chunkO7XVCLXW_cjs.buildMaterializationOnConflictSet(params.materializedAt)
727
+ set: chunkH7VE3FL4_cjs.buildMaterializationOnConflictSet(params.materializedAt)
691
728
  });
692
729
  },
693
730
  async ensureContributionMaterializationsTable() {
@@ -703,38 +740,36 @@ function createPostgresBackend(db, options = {}) {
703
740
  await contributionMaterializer.assertInitialized(graphId);
704
741
  },
705
742
  async ensureKindRemovalsTable() {
706
- await db.execute(drizzleOrm.sql.raw(chunkOMQ2NBOR_cjs.generatePgCreateTableSQL(tables2.kindRemovals)));
743
+ await ensureTableWithConcurrentCreateRetry(tables2.kindRemovals);
707
744
  },
708
745
  async getPendingKindRemovals(graphId) {
709
746
  const t = tables2.kindRemovals;
710
747
  const rows = await db.select().from(t).where(drizzleOrm.and(drizzleOrm.eq(t.graphId, graphId), drizzleOrm.isNull(t.removedAt)));
711
748
  return rows.map(
712
- (row) => chunkO7XVCLXW_cjs.mapKindRemovalRow(row, chunkO7XVCLXW_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
749
+ (row) => chunkH7VE3FL4_cjs.mapKindRemovalRow(row, chunkH7VE3FL4_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
713
750
  );
714
751
  },
715
752
  async getAllKindRemovals(graphId) {
716
753
  const t = tables2.kindRemovals;
717
754
  const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
718
755
  return rows.map(
719
- (row) => chunkO7XVCLXW_cjs.mapKindRemovalRow(row, chunkO7XVCLXW_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
756
+ (row) => chunkH7VE3FL4_cjs.mapKindRemovalRow(row, chunkH7VE3FL4_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
720
757
  );
721
758
  },
722
759
  async recordKindRemoval(params) {
723
760
  const t = tables2.kindRemovals;
724
761
  await db.insert(t).values(
725
- chunkO7XVCLXW_cjs.buildKindRemovalInsertValues(
762
+ chunkH7VE3FL4_cjs.buildKindRemovalInsertValues(
726
763
  params,
727
- chunkO7XVCLXW_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.encode
764
+ chunkH7VE3FL4_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.encode
728
765
  )
729
766
  ).onConflictDoUpdate({
730
767
  target: [t.graphId, t.kindName, t.entity, t.schemaVersion],
731
- set: chunkO7XVCLXW_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
768
+ set: chunkH7VE3FL4_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
732
769
  });
733
770
  },
734
771
  async ensureReconciliationMarkersTable() {
735
- await db.execute(
736
- drizzleOrm.sql.raw(chunkOMQ2NBOR_cjs.generatePgCreateTableSQL(tables2.reconciliationMarkers))
737
- );
772
+ await ensureTableWithConcurrentCreateRetry(tables2.reconciliationMarkers);
738
773
  },
739
774
  async ensureRuntimeContributions(graphId) {
740
775
  await contributionMaterializer.ensureRuntimeContributions(graphId);
@@ -747,6 +782,12 @@ function createPostgresBackend(db, options = {}) {
747
782
  async ensureFulltextTable(graphId) {
748
783
  await contributionMaterializer.ensureRuntimeContributions(graphId);
749
784
  },
785
+ async verifyContributions(graphId, vectorSlots) {
786
+ return contributionMaterializer.verifyContributions(graphId, vectorSlots);
787
+ },
788
+ async repairContributions(graphId, vectorSlots) {
789
+ return contributionMaterializer.repairContributions(graphId, vectorSlots);
790
+ },
750
791
  // Vector counterparts of the runtime-contribution methods. Present
751
792
  // only when a vector strategy is wired (omitted under `vector: false`,
752
793
  // mirroring the embedding/search methods), so a no-vector backend
@@ -793,8 +834,8 @@ function createPostgresBackend(db, options = {}) {
793
834
  const presentRecordedTables = tablePresence.filter((entry) => entry.exists).map((entry) => entry.tableName);
794
835
  for (const tableName of presentRecordedTables) {
795
836
  await db.execute(
796
- chunk6TJ6PKPS_cjs.toDrizzleSql(
797
- chunkX2XOQZT3_cjs.sql`ANALYZE (SKIP_LOCKED) ${chunkX2XOQZT3_cjs.sql.identifier(tableName)}`,
837
+ chunkOOA273IJ_cjs.toDrizzleSql(
838
+ chunkU5W4LKZV_cjs.sql`ANALYZE (SKIP_LOCKED) ${chunkU5W4LKZV_cjs.sql.identifier(tableName)}`,
798
839
  "postgres"
799
840
  )
800
841
  );
@@ -806,19 +847,28 @@ function createPostgresBackend(db, options = {}) {
806
847
  (target) => target.commitSchemaVersion(params)
807
848
  );
808
849
  },
850
+ async commitSchemaVersionIfKindsEmpty(params, probes) {
851
+ return runSchemaWriteTransaction(
852
+ params.graphId,
853
+ (target) => chunkH7VE3FL4_cjs.commitSchemaVersionIfKindsEmpty(target, params, probes)
854
+ );
855
+ },
809
856
  async setActiveVersion(params) {
810
857
  await runSchemaWriteTransaction(
811
858
  params.graphId,
812
859
  (target) => target.setActiveVersion(params)
813
860
  );
814
861
  },
862
+ async schemaWriteTransaction(graphId, fn) {
863
+ return runSchemaWriteTransaction(graphId, (target) => fn(target));
864
+ },
815
865
  async transaction(fn, options2) {
816
866
  return backend.transactionWithNative((tx) => fn(tx), options2);
817
867
  },
818
868
  async transactionWithNative(fn, options2) {
819
- const temporaryWrites = options2?.temporaryWrites === chunkECU53PMN_cjs.INTERNAL_TEMPORARY_WRITES;
869
+ const temporaryWrites = options2?.temporaryWrites === chunkEKFUG4G7_cjs.INTERNAL_TEMPORARY_WRITES;
820
870
  if (temporaryWrites && options2.accessMode !== "read_only") {
821
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
871
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
822
872
  "Temporary-write transactions must be semantically read-only.",
823
873
  { dialect: "postgres" }
824
874
  );
@@ -842,7 +892,7 @@ function createPostgresBackend(db, options = {}) {
842
892
  },
843
893
  adoptTransaction(externalTx) {
844
894
  if (!capabilities.transactions) {
845
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
895
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
846
896
  "Cross-store atomicity is unavailable on this Postgres backend: its driver does not support transactions (drizzle-orm/neon-http, Cloudflare D1). Adopting an external transaction here would let the caller's relational write commit with no way to roll back the graph write. Use a node-postgres or neon-serverless (Pool/WebSocket) connection for cross-store transactions.",
847
897
  {
848
898
  backend: "postgres",
@@ -851,7 +901,7 @@ function createPostgresBackend(db, options = {}) {
851
901
  }
852
902
  );
853
903
  }
854
- chunkO7XVCLXW_cjs.assertAdoptedDialect(
904
+ chunkH7VE3FL4_cjs.assertAdoptedDialect(
855
905
  externalTx,
856
906
  pgCore.PgTransaction,
857
907
  "postgres"
@@ -907,7 +957,9 @@ function createPostgresOperationBackend(options) {
907
957
  fulltextStrategy,
908
958
  vectorStrategy,
909
959
  contributionMaterializer,
910
- iterativeScanProbe
960
+ iterativeScanProbe,
961
+ schemaVersionsTable,
962
+ transactionScoped
911
963
  } = options;
912
964
  async function execAll(query) {
913
965
  return executionAdapter.execute(query);
@@ -959,7 +1011,7 @@ function createPostgresOperationBackend(options) {
959
1011
  async function runVectorSearchGucGroup(overrides, query) {
960
1012
  const runExclusive = executionAdapter.runExclusive;
961
1013
  if (runExclusive === void 0) {
962
- throw new chunkKTBTSHU6_cjs.CompilerInvariantError(
1014
+ throw new chunkC4F7VJ5D_cjs.CompilerInvariantError(
963
1015
  "A transaction-scoped Postgres backend must expose runExclusive; its execution adapter was not wrapped by createSerialExecutionAdapter."
964
1016
  );
965
1017
  }
@@ -1003,16 +1055,17 @@ function createPostgresOperationBackend(options) {
1003
1055
  });
1004
1056
  }
1005
1057
  const batchConfig = computePostgresBatchChunkSizes(
1006
- capabilities.maxBindParameters ?? chunkECU53PMN_cjs.POSTGRES_MAX_BIND_PARAMETERS
1058
+ capabilities.maxBindParameters ?? chunkEKFUG4G7_cjs.POSTGRES_MAX_BIND_PARAMETERS
1007
1059
  );
1008
- const commonBackend = chunkO7XVCLXW_cjs.createCommonOperationBackend({
1060
+ const commonBackend = chunkH7VE3FL4_cjs.createCommonOperationBackend({
1009
1061
  batchConfig,
1010
1062
  execution: {
1011
1063
  execAll,
1012
1064
  execGet,
1013
1065
  execRun
1014
1066
  },
1015
- nowIso: chunkAQR6BHB3_cjs.nowIso,
1067
+ nowIso: chunkF4NHQHEZ_cjs.nowIso,
1068
+ maxBindParameters: capabilities.maxBindParameters ?? chunkEKFUG4G7_cjs.POSTGRES_MAX_BIND_PARAMETERS,
1016
1069
  operationStrategy,
1017
1070
  rowMappers: {
1018
1071
  toEdgeRow,
@@ -1030,26 +1083,26 @@ function createPostgresOperationBackend(options) {
1030
1083
  };
1031
1084
  const vectorEmbeddingMethods = vectorStrategy === void 0 ? {} : {
1032
1085
  async upsertEmbedding(params) {
1033
- const slot = chunkO7XVCLXW_cjs.vectorSlotFromParams(params);
1086
+ const slot = chunkH7VE3FL4_cjs.vectorSlotFromParams(params);
1034
1087
  await contributionMaterializer.assertVectorSlot(slot);
1035
- const statements = vectorStrategy.buildUpsert(slot, params, chunkAQR6BHB3_cjs.nowIso());
1088
+ const statements = vectorStrategy.buildUpsert(slot, params, chunkF4NHQHEZ_cjs.nowIso());
1036
1089
  try {
1037
1090
  for (const statement of statements) {
1038
1091
  await execRun(statement);
1039
1092
  }
1040
1093
  } catch (error) {
1041
- throw chunkO7XVCLXW_cjs.mapVectorWriteError(error, params);
1094
+ throw chunkH7VE3FL4_cjs.mapVectorWriteError(error, params);
1042
1095
  }
1043
1096
  },
1044
1097
  async upsertEmbeddingBatch(params) {
1045
1098
  if (params.rows.length === 0) return;
1046
- const slot = chunkO7XVCLXW_cjs.vectorSlotFromParams(params);
1099
+ const slot = chunkH7VE3FL4_cjs.vectorSlotFromParams(params);
1047
1100
  await contributionMaterializer.assertVectorSlot(slot);
1048
1101
  const rowsById = new Map(
1049
1102
  params.rows.map((row) => [row.nodeId, row])
1050
1103
  );
1051
1104
  const rows = [...rowsById.values()];
1052
- const timestamp = chunkAQR6BHB3_cjs.nowIso();
1105
+ const timestamp = chunkF4NHQHEZ_cjs.nowIso();
1053
1106
  try {
1054
1107
  for (const chunk2 of chunkZDH3DX3C_cjs.chunk(
1055
1108
  rows,
@@ -1080,31 +1133,46 @@ function createPostgresOperationBackend(options) {
1080
1133
  }
1081
1134
  }
1082
1135
  } catch (error) {
1083
- throw chunkO7XVCLXW_cjs.mapVectorWriteError(error, params);
1136
+ throw chunkH7VE3FL4_cjs.mapVectorWriteError(error, params);
1084
1137
  }
1085
1138
  },
1086
1139
  async deleteEmbedding(params) {
1087
- const slot = chunkO7XVCLXW_cjs.vectorSlotFromParams(params);
1140
+ const slot = chunkH7VE3FL4_cjs.vectorSlotFromParams(params);
1088
1141
  await contributionMaterializer.assertVectorSlot(slot);
1089
1142
  const statements = vectorStrategy.buildDelete(slot, params);
1090
1143
  for (const statement of statements) {
1091
1144
  await execRun(statement);
1092
1145
  }
1093
1146
  },
1147
+ async deleteEmbeddingBatch(params) {
1148
+ if (params.nodeIds.length === 0) return;
1149
+ const slot = chunkH7VE3FL4_cjs.vectorSlotFromParams(params);
1150
+ await contributionMaterializer.assertVectorSlot(slot);
1151
+ for (const nodeIds of chunkZDH3DX3C_cjs.chunk(
1152
+ [...new Set(params.nodeIds)],
1153
+ batchConfig.embeddingUpsertBatchSize
1154
+ )) {
1155
+ const statements = vectorStrategy.buildDeleteBatch(slot, {
1156
+ ...params,
1157
+ nodeIds
1158
+ });
1159
+ for (const statement of statements) await execRun(statement);
1160
+ }
1161
+ },
1094
1162
  async vectorSearch(params) {
1095
- chunkUTTW2Q3M_cjs.assertVectorSearchLimit(params.limit);
1096
- chunk33PAKPED_cjs.assertPgvectorEfSearch(params.efSearch);
1097
- const slot = chunkO7XVCLXW_cjs.vectorSlotFromParams(params);
1163
+ chunkJXUTCSXX_cjs.assertVectorSearchLimit(params.limit);
1164
+ chunkD56XG4EI_cjs.assertPgvectorEfSearch(params.efSearch);
1165
+ const slot = chunkH7VE3FL4_cjs.vectorSlotFromParams(params);
1098
1166
  const query = vectorStrategy.buildSearch(
1099
1167
  slot,
1100
1168
  params,
1101
1169
  // Store-compiled candidates (predicates + subclass + currency)
1102
1170
  // take precedence; the live-node default covers direct backend use.
1103
- params.candidates ?? chunkO7XVCLXW_cjs.buildLiveNodeCandidates(
1171
+ params.candidates ?? chunkH7VE3FL4_cjs.buildLiveNodeCandidates(
1104
1172
  tableNames.nodes,
1105
1173
  params.graphId,
1106
1174
  params.nodeKind,
1107
- chunkAQR6BHB3_cjs.nowIso()
1175
+ chunkF4NHQHEZ_cjs.nowIso()
1108
1176
  )
1109
1177
  );
1110
1178
  const gucOverrides = await vectorSearchGucOverrides(params);
@@ -1112,7 +1180,7 @@ function createPostgresOperationBackend(options) {
1112
1180
  try {
1113
1181
  rows = await runVectorSearch(gucOverrides, query);
1114
1182
  } catch (error) {
1115
- throw chunkO7XVCLXW_cjs.mapVectorWriteError(error, params);
1183
+ throw chunkH7VE3FL4_cjs.mapVectorWriteError(error, params);
1116
1184
  }
1117
1185
  return rows.map((row) => ({
1118
1186
  nodeId: row.node_id,
@@ -1124,10 +1192,10 @@ function createPostgresOperationBackend(options) {
1124
1192
  // multi-statement fallback by simply not exposing the member.
1125
1193
  ...capabilities.windowFunctions ? {
1126
1194
  async hybridSearch(params) {
1127
- chunkUTTW2Q3M_cjs.assertVectorSearchLimit(params.limit);
1128
- chunkUTTW2Q3M_cjs.assertVectorSearchLimit(params.vector.k);
1129
- chunk33PAKPED_cjs.assertPgvectorEfSearch(params.vector.efSearch);
1130
- const slot = chunkO7XVCLXW_cjs.vectorSlotFromParams({
1195
+ chunkJXUTCSXX_cjs.assertVectorSearchLimit(params.limit);
1196
+ chunkJXUTCSXX_cjs.assertVectorSearchLimit(params.vector.k);
1197
+ chunkD56XG4EI_cjs.assertPgvectorEfSearch(params.vector.efSearch);
1198
+ const slot = chunkH7VE3FL4_cjs.vectorSlotFromParams({
1131
1199
  graphId: params.graphId,
1132
1200
  nodeKind: params.nodeKind,
1133
1201
  fieldPath: params.vector.fieldPath,
@@ -1135,11 +1203,11 @@ function createPostgresOperationBackend(options) {
1135
1203
  metric: params.vector.metric,
1136
1204
  indexType: params.vector.indexType
1137
1205
  });
1138
- const candidates = params.candidates ?? chunkO7XVCLXW_cjs.buildLiveNodeCandidates(
1206
+ const candidates = params.candidates ?? chunkH7VE3FL4_cjs.buildLiveNodeCandidates(
1139
1207
  tableNames.nodes,
1140
1208
  params.graphId,
1141
1209
  params.nodeKind,
1142
- chunkAQR6BHB3_cjs.nowIso()
1210
+ chunkF4NHQHEZ_cjs.nowIso()
1143
1211
  );
1144
1212
  const vectorParams = {
1145
1213
  graphId: params.graphId,
@@ -1155,11 +1223,11 @@ function createPostgresOperationBackend(options) {
1155
1223
  const vectorSql = vectorStrategy.buildSearch(
1156
1224
  slot,
1157
1225
  vectorParams,
1158
- chunkX2XOQZT3_cjs.sql.raw("SELECT node_id FROM tg_hybrid_cand")
1226
+ chunkU5W4LKZV_cjs.sql.raw("SELECT node_id FROM tg_hybrid_cand")
1159
1227
  );
1160
1228
  const statement = operationStrategy.buildHybridSearch(
1161
1229
  { ...params, candidates },
1162
- chunk6TJ6PKPS_cjs.toDrizzleSql(vectorSql, "postgres"),
1230
+ chunkOOA273IJ_cjs.toDrizzleSql(vectorSql, "postgres"),
1163
1231
  params.vector.metric === "cosine"
1164
1232
  );
1165
1233
  const gucOverrides = await vectorSearchGucOverrides({
@@ -1173,9 +1241,9 @@ function createPostgresOperationBackend(options) {
1173
1241
  statement
1174
1242
  );
1175
1243
  } catch (error) {
1176
- throw chunkO7XVCLXW_cjs.mapVectorWriteError(error, vectorParams);
1244
+ throw chunkH7VE3FL4_cjs.mapVectorWriteError(error, vectorParams);
1177
1245
  }
1178
- return raw.map((row) => chunkO7XVCLXW_cjs.mapHybridSearchRow(row, toNodeRow));
1246
+ return raw.map((row) => chunkH7VE3FL4_cjs.mapHybridSearchRow(row, toNodeRow));
1179
1247
  }
1180
1248
  } : {}
1181
1249
  };
@@ -1183,15 +1251,52 @@ function createPostgresOperationBackend(options) {
1183
1251
  ...commonBackend,
1184
1252
  ...executeRawMethod,
1185
1253
  ...vectorEmbeddingMethods,
1254
+ async deleteSchemaVectorSlotContribution(slot) {
1255
+ if (vectorStrategy === void 0) return;
1256
+ for (const contribution of vectorStrategy.ownedTables(slot)) {
1257
+ await execRun(
1258
+ operationStrategy.buildDeleteContributionMaterialization({
1259
+ graphId: slot.graphId,
1260
+ logicalName: contribution.logicalName,
1261
+ owner: contribution.owner,
1262
+ tableName: contribution.tableName
1263
+ })
1264
+ );
1265
+ }
1266
+ contributionMaterializer.evictVectorSlot(slot);
1267
+ },
1186
1268
  capabilities,
1187
1269
  fulltextStrategy,
1188
1270
  ...vectorStrategy === void 0 ? {} : { vectorStrategy },
1189
1271
  dialect: "postgres",
1190
1272
  tableNames,
1273
+ async lockSchemaVersionForWrite(params) {
1274
+ if (!transactionScoped) {
1275
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
1276
+ "The schema write fence requires an explicit PostgreSQL transaction.",
1277
+ {
1278
+ code: "SCHEMA_WRITE_FENCE_TRANSACTION_REQUIRED",
1279
+ graphId: params.graphId
1280
+ }
1281
+ );
1282
+ }
1283
+ const active = await execGet(drizzleOrm.sql`
1284
+ SELECT ${schemaVersionsTable.version} AS version
1285
+ FROM ${schemaVersionsTable}
1286
+ WHERE ${schemaVersionsTable.graphId} = ${params.graphId}
1287
+ AND ${schemaVersionsTable.isActive} = TRUE
1288
+ FOR SHARE
1289
+ `);
1290
+ chunkH7VE3FL4_cjs.assertActiveSchemaVersion(
1291
+ params.graphId,
1292
+ params.expectedVersion,
1293
+ active?.version ?? 0
1294
+ );
1295
+ },
1191
1296
  // === Vector Index Operations ===
1192
1297
  async createVectorIndex(params) {
1193
1298
  if (vectorStrategy === void 0) return;
1194
- const slot = chunkO7XVCLXW_cjs.vectorSlotFromCreateIndexParams(params);
1299
+ const slot = chunkH7VE3FL4_cjs.vectorSlotFromCreateIndexParams(params);
1195
1300
  await contributionMaterializer.ensureVectorSlot(slot);
1196
1301
  const indexStatement = vectorStrategy.buildCreateIndex?.(slot, {
1197
1302
  concurrent: params.concurrent === true
@@ -1200,12 +1305,12 @@ function createPostgresOperationBackend(options) {
1200
1305
  try {
1201
1306
  await execRun(indexStatement);
1202
1307
  } catch (error) {
1203
- if (!chunkAO2WPYFZ_cjs.isInsufficientResourcesError(error)) throw error;
1308
+ if (!chunkJQXSZHF2_cjs.isInsufficientResourcesError(error)) throw error;
1204
1309
  const dropStatement = vectorStrategy.buildDropIndex?.(slot);
1205
1310
  if (dropStatement !== void 0) {
1206
1311
  await execRun(dropStatement);
1207
1312
  }
1208
- const table = chunkX2XOQZT3_cjs.sql.identifier(
1313
+ const table = chunkU5W4LKZV_cjs.sql.identifier(
1209
1314
  vectorStrategy.tableName(
1210
1315
  slot.graphId,
1211
1316
  slot.nodeKind,
@@ -1213,13 +1318,13 @@ function createPostgresOperationBackend(options) {
1213
1318
  )
1214
1319
  );
1215
1320
  await execRun(
1216
- chunkX2XOQZT3_cjs.sql`ALTER TABLE ${table} SET (parallel_workers = 0)`
1321
+ chunkU5W4LKZV_cjs.sql`ALTER TABLE ${table} SET (parallel_workers = 0)`
1217
1322
  );
1218
1323
  try {
1219
1324
  await execRun(indexStatement);
1220
1325
  } finally {
1221
1326
  await execRun(
1222
- chunkX2XOQZT3_cjs.sql`ALTER TABLE ${table} RESET (parallel_workers)`
1327
+ chunkU5W4LKZV_cjs.sql`ALTER TABLE ${table} RESET (parallel_workers)`
1223
1328
  );
1224
1329
  }
1225
1330
  }
@@ -1227,7 +1332,7 @@ function createPostgresOperationBackend(options) {
1227
1332
  },
1228
1333
  // === Fulltext Operations ===
1229
1334
  async upsertFulltext(params) {
1230
- const timestamp = chunkAQR6BHB3_cjs.nowIso();
1335
+ const timestamp = chunkF4NHQHEZ_cjs.nowIso();
1231
1336
  const statements = operationStrategy.buildUpsertFulltext(
1232
1337
  params,
1233
1338
  timestamp
@@ -1244,7 +1349,7 @@ function createPostgresOperationBackend(options) {
1244
1349
  },
1245
1350
  async upsertFulltextBatch(params) {
1246
1351
  if (params.rows.length === 0) return;
1247
- const timestamp = chunkAQR6BHB3_cjs.nowIso();
1352
+ const timestamp = chunkF4NHQHEZ_cjs.nowIso();
1248
1353
  for (const rows of chunkZDH3DX3C_cjs.chunk(
1249
1354
  params.rows,
1250
1355
  batchConfig.fulltextUpsertBatchSize
@@ -1278,25 +1383,25 @@ function createPostgresOperationBackend(options) {
1278
1383
  const rows = await execAll(query);
1279
1384
  return rows.map((row, index) => ({
1280
1385
  nodeId: row.node_id,
1281
- score: chunkAQR6BHB3_cjs.coerceNumericScore(row.score),
1386
+ score: chunkF4NHQHEZ_cjs.coerceNumericScore(row.score),
1282
1387
  rank: index + 1,
1283
1388
  ...row.snippet === null ? {} : { snippet: row.snippet }
1284
1389
  }));
1285
1390
  },
1286
1391
  async dropVectorIndex(params) {
1287
1392
  if (vectorStrategy === void 0) return;
1288
- const slot = chunkO7XVCLXW_cjs.vectorSlotFromDropIndexParams(params);
1393
+ const slot = chunkH7VE3FL4_cjs.vectorSlotFromDropIndexParams(params);
1289
1394
  const dropStatement = vectorStrategy.buildDropIndex?.(slot);
1290
1395
  if (dropStatement === void 0) return;
1291
1396
  try {
1292
1397
  await execRun(dropStatement);
1293
1398
  } catch (error) {
1294
- if (!chunkAO2WPYFZ_cjs.isMissingTableError(error)) throw error;
1399
+ if (!chunkJQXSZHF2_cjs.isMissingTableError(error)) throw error;
1295
1400
  }
1296
1401
  },
1297
1402
  // === Query Execution ===
1298
1403
  async execute(query) {
1299
- const annTypes = chunkX2XOQZT3_cjs.isSqlFragment(query) ? chunkX2XOQZT3_cjs.annIndexScanTypes(query) : void 0;
1404
+ const annTypes = chunkU5W4LKZV_cjs.isSqlFragment(query) ? chunkU5W4LKZV_cjs.annIndexScanTypes(query) : void 0;
1300
1405
  if (annTypes !== void 0 && vectorStrategy !== void 0) {
1301
1406
  const overrides = [];
1302
1407
  for (const indexType of annTypes) {
@@ -1329,11 +1434,13 @@ function createTransactionBackend(options) {
1329
1434
  contributionMaterializer: options.contributionMaterializer,
1330
1435
  // The probe is process-wide truth, so the outer instance's is reused
1331
1436
  // rather than a fresh one per transaction.
1332
- iterativeScanProbe: options.iterativeScanProbe
1437
+ iterativeScanProbe: options.iterativeScanProbe,
1438
+ schemaVersionsTable: options.schemaVersionsTable,
1439
+ transactionScoped: true
1333
1440
  });
1334
1441
  return { backend, drainAndClose: txExecutionAdapter.drainAndClose };
1335
1442
  }
1336
1443
 
1337
1444
  exports.createPostgresBackend = createPostgresBackend;
1338
- //# sourceMappingURL=chunk-5ZPRE4CV.cjs.map
1339
- //# sourceMappingURL=chunk-5ZPRE4CV.cjs.map
1445
+ //# sourceMappingURL=chunk-YDWLUT5V.cjs.map
1446
+ //# sourceMappingURL=chunk-YDWLUT5V.cjs.map