@nicia-ai/typegraph 0.45.0 → 0.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/dist/backend/drizzle/indexes.cjs +11 -11
  2. package/dist/backend/drizzle/indexes.d.cts +1 -1
  3. package/dist/backend/drizzle/indexes.d.ts +1 -1
  4. package/dist/backend/drizzle/indexes.js +7 -7
  5. package/dist/backend/index.cjs +53 -54
  6. package/dist/backend/index.d.cts +3 -3
  7. package/dist/backend/index.d.ts +3 -3
  8. package/dist/backend/index.js +13 -14
  9. package/dist/backend/postgres/index.cjs +29 -30
  10. package/dist/backend/postgres/index.d.cts +7 -7
  11. package/dist/backend/postgres/index.d.ts +7 -7
  12. package/dist/backend/postgres/index.js +16 -17
  13. package/dist/backend/postgres/pglite-store.cjs +48 -42
  14. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  15. package/dist/backend/postgres/pglite-store.d.cts +15 -9
  16. package/dist/backend/postgres/pglite-store.d.ts +15 -9
  17. package/dist/backend/postgres/pglite-store.js +44 -38
  18. package/dist/backend/postgres/pglite-store.js.map +1 -1
  19. package/dist/backend/postgres/pglite.cjs +18 -19
  20. package/dist/backend/postgres/pglite.d.cts +4 -4
  21. package/dist/backend/postgres/pglite.d.ts +4 -4
  22. package/dist/backend/postgres/pglite.js +17 -18
  23. package/dist/backend/sqlite/index.cjs +26 -27
  24. package/dist/backend/sqlite/index.d.cts +6 -6
  25. package/dist/backend/sqlite/index.d.ts +6 -6
  26. package/dist/backend/sqlite/index.js +14 -15
  27. package/dist/backend/sqlite/libsql.cjs +21 -22
  28. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  29. package/dist/backend/sqlite/libsql.d.cts +15 -8
  30. package/dist/backend/sqlite/libsql.d.ts +15 -8
  31. package/dist/backend/sqlite/libsql.js +17 -18
  32. package/dist/backend/sqlite/libsql.js.map +1 -1
  33. package/dist/backend/sqlite/local-store.cjs +49 -43
  34. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  35. package/dist/backend/sqlite/local-store.d.cts +15 -10
  36. package/dist/backend/sqlite/local-store.d.ts +15 -10
  37. package/dist/backend/sqlite/local-store.js +45 -39
  38. package/dist/backend/sqlite/local-store.js.map +1 -1
  39. package/dist/backend/sqlite/local.cjs +19 -20
  40. package/dist/backend/sqlite/local.d.cts +3 -3
  41. package/dist/backend/sqlite/local.d.ts +3 -3
  42. package/dist/backend/sqlite/local.js +17 -18
  43. package/dist/{chunk-S3ZRKJHY.js → chunk-2LG2XB2M.js} +3 -3
  44. package/dist/{chunk-S3ZRKJHY.js.map → chunk-2LG2XB2M.js.map} +1 -1
  45. package/dist/{chunk-7PF2L3H6.cjs → chunk-2NA5DYLO.cjs} +4 -4
  46. package/dist/{chunk-7PF2L3H6.cjs.map → chunk-2NA5DYLO.cjs.map} +1 -1
  47. package/dist/chunk-2Z2Z3ZD6.js +58 -0
  48. package/dist/chunk-2Z2Z3ZD6.js.map +1 -0
  49. package/dist/{chunk-VVQM4CZD.cjs → chunk-3DHZCOT7.cjs} +20 -20
  50. package/dist/{chunk-VVQM4CZD.cjs.map → chunk-3DHZCOT7.cjs.map} +1 -1
  51. package/dist/{chunk-JXUTCSXX.cjs → chunk-4UGOKMI5.cjs} +250 -158
  52. package/dist/chunk-4UGOKMI5.cjs.map +1 -0
  53. package/dist/{chunk-RFRM3Q5K.js → chunk-5262ZMTR.js} +14 -5
  54. package/dist/chunk-5262ZMTR.js.map +1 -0
  55. package/dist/{chunk-QRNYDV5Z.js → chunk-5763DULU.js} +214 -69
  56. package/dist/chunk-5763DULU.js.map +1 -0
  57. package/dist/{chunk-BGYJW37L.js → chunk-5UVRGXD3.js} +277 -7
  58. package/dist/chunk-5UVRGXD3.js.map +1 -0
  59. package/dist/{chunk-QR24DJDF.cjs → chunk-62ZP23AW.cjs} +15 -15
  60. package/dist/{chunk-QR24DJDF.cjs.map → chunk-62ZP23AW.cjs.map} +1 -1
  61. package/dist/{chunk-ZI6VQSZA.cjs → chunk-65E3XWGF.cjs} +724 -577
  62. package/dist/chunk-65E3XWGF.cjs.map +1 -0
  63. package/dist/{chunk-S4KQ5LV4.js → chunk-775A4ZMN.js} +40 -6
  64. package/dist/chunk-775A4ZMN.js.map +1 -0
  65. package/dist/{chunk-J2ICGNHO.cjs → chunk-7BQXPCGN.cjs} +830 -169
  66. package/dist/chunk-7BQXPCGN.cjs.map +1 -0
  67. package/dist/{chunk-FJMPR3OH.cjs → chunk-7EO3TCQB.cjs} +33 -7
  68. package/dist/chunk-7EO3TCQB.cjs.map +1 -0
  69. package/dist/{chunk-DXEEHSGN.js → chunk-7VQXLT5O.js} +436 -43
  70. package/dist/chunk-7VQXLT5O.js.map +1 -0
  71. package/dist/chunk-A4OC4DVN.cjs +12 -0
  72. package/dist/{chunk-4SZ6XPTG.cjs.map → chunk-A4OC4DVN.cjs.map} +1 -1
  73. package/dist/{chunk-TDXIBCGY.cjs → chunk-A7J2YDDI.cjs} +5 -3
  74. package/dist/chunk-A7J2YDDI.cjs.map +1 -0
  75. package/dist/{chunk-55ITBQJI.js → chunk-AKLS3BYZ.js} +56 -5
  76. package/dist/chunk-AKLS3BYZ.js.map +1 -0
  77. package/dist/{chunk-D7PG5D5K.js → chunk-AMKPPFUO.js} +32 -6
  78. package/dist/chunk-AMKPPFUO.js.map +1 -0
  79. package/dist/{chunk-WUFASQUO.js → chunk-ASTI57H3.js} +3 -3
  80. package/dist/{chunk-WUFASQUO.js.map → chunk-ASTI57H3.js.map} +1 -1
  81. package/dist/{chunk-4QIKLIGG.js → chunk-BKCUOV7A.js} +15 -5
  82. package/dist/chunk-BKCUOV7A.js.map +1 -0
  83. package/dist/{chunk-JQXSZHF2.cjs → chunk-BSFJMMV3.cjs} +134 -7
  84. package/dist/chunk-BSFJMMV3.cjs.map +1 -0
  85. package/dist/{chunk-4GUTQPVO.js → chunk-C23WSN5E.js} +185 -24
  86. package/dist/chunk-C23WSN5E.js.map +1 -0
  87. package/dist/{chunk-QLUXRWKL.js → chunk-CBTIUB76.js} +3 -3
  88. package/dist/{chunk-QLUXRWKL.js.map → chunk-CBTIUB76.js.map} +1 -1
  89. package/dist/chunk-CMWHLBVN.cjs +2082 -0
  90. package/dist/chunk-CMWHLBVN.cjs.map +1 -0
  91. package/dist/{chunk-QB6VMOJ2.cjs → chunk-CXBHOOIQ.cjs} +45 -10
  92. package/dist/chunk-CXBHOOIQ.cjs.map +1 -0
  93. package/dist/{chunk-FL5UQRES.js → chunk-DCQVHAYQ.js} +5 -5
  94. package/dist/{chunk-FL5UQRES.js.map → chunk-DCQVHAYQ.js.map} +1 -1
  95. package/dist/chunk-DTVWX77L.cjs +3432 -0
  96. package/dist/chunk-DTVWX77L.cjs.map +1 -0
  97. package/dist/chunk-DYATYRY4.js +47 -0
  98. package/dist/chunk-DYATYRY4.js.map +1 -0
  99. package/dist/chunk-E4WNQBEF.cjs +217 -0
  100. package/dist/chunk-E4WNQBEF.cjs.map +1 -0
  101. package/dist/{chunk-G6Q5UM7U.js → chunk-FWJKWH6U.js} +5 -3
  102. package/dist/chunk-FWJKWH6U.js.map +1 -0
  103. package/dist/chunk-GF3KXUTW.js +3393 -0
  104. package/dist/chunk-GF3KXUTW.js.map +1 -0
  105. package/dist/{chunk-VTN3C3CH.js → chunk-HFHTMECK.js} +7 -7
  106. package/dist/{chunk-VTN3C3CH.js.map → chunk-HFHTMECK.js.map} +1 -1
  107. package/dist/{chunk-FLEQ2HBK.js → chunk-I5MOXA4H.js} +20 -14
  108. package/dist/chunk-I5MOXA4H.js.map +1 -0
  109. package/dist/{chunk-4MB3AQAQ.js → chunk-J3WZ3FA2.js} +77 -3
  110. package/dist/chunk-J3WZ3FA2.js.map +1 -0
  111. package/dist/{chunk-UR7W5YQK.js → chunk-JBQQ7THH.js} +5 -3
  112. package/dist/chunk-JBQQ7THH.js.map +1 -0
  113. package/dist/{chunk-TKP5T34P.js → chunk-JXA2ZP2Q.js} +6 -16
  114. package/dist/chunk-JXA2ZP2Q.js.map +1 -0
  115. package/dist/{chunk-GYA4JRP5.js → chunk-JXXDZTMN.js} +2 -2
  116. package/dist/chunk-JXXDZTMN.js.map +1 -0
  117. package/dist/chunk-JZUR7ZWE.js +254 -0
  118. package/dist/chunk-JZUR7ZWE.js.map +1 -0
  119. package/dist/{chunk-42PYUGLS.js → chunk-K5ELX2GT.js} +108 -8
  120. package/dist/chunk-K5ELX2GT.js.map +1 -0
  121. package/dist/{chunk-Q6EDCUXV.js → chunk-L65OU2U3.js} +556 -204
  122. package/dist/chunk-L65OU2U3.js.map +1 -0
  123. package/dist/{chunk-D54WH24V.cjs → chunk-LBJKZXDE.cjs} +115 -13
  124. package/dist/chunk-LBJKZXDE.cjs.map +1 -0
  125. package/dist/{chunk-FQ7ZPOTZ.js → chunk-LGHCOKTT.js} +637 -493
  126. package/dist/chunk-LGHCOKTT.js.map +1 -0
  127. package/dist/chunk-M3WP7RQZ.js +736 -0
  128. package/dist/chunk-M3WP7RQZ.js.map +1 -0
  129. package/dist/{chunk-4MEWSUVM.cjs → chunk-M4BDU5RX.cjs} +12 -12
  130. package/dist/chunk-M4BDU5RX.cjs.map +1 -0
  131. package/dist/chunk-MCLYU6BN.cjs +332 -0
  132. package/dist/chunk-MCLYU6BN.cjs.map +1 -0
  133. package/dist/{chunk-MIJKEVV7.js → chunk-MSY7FSX4.js} +37 -4
  134. package/dist/chunk-MSY7FSX4.js.map +1 -0
  135. package/dist/{chunk-H7VE3FL4.cjs → chunk-MUK4BU7K.cjs} +519 -125
  136. package/dist/chunk-MUK4BU7K.cjs.map +1 -0
  137. package/dist/{chunk-D56XG4EI.cjs → chunk-MXJDTH5B.cjs} +56 -45
  138. package/dist/chunk-MXJDTH5B.cjs.map +1 -0
  139. package/dist/{chunk-5EKPX6QU.js → chunk-MZLPX2R7.js} +8 -9
  140. package/dist/chunk-MZLPX2R7.js.map +1 -0
  141. package/dist/chunk-N66HCGCY.cjs +57 -0
  142. package/dist/chunk-N66HCGCY.cjs.map +1 -0
  143. package/dist/{chunk-CPEL3YIR.cjs → chunk-NFCVHQ5P.cjs} +55 -22
  144. package/dist/chunk-NFCVHQ5P.cjs.map +1 -0
  145. package/dist/{chunk-C4F7VJ5D.cjs → chunk-NI72YOJB.cjs} +84 -2
  146. package/dist/chunk-NI72YOJB.cjs.map +1 -0
  147. package/dist/{chunk-BNS75YNF.cjs → chunk-NK5Q7UNE.cjs} +10 -20
  148. package/dist/chunk-NK5Q7UNE.cjs.map +1 -0
  149. package/dist/{chunk-TKORQCG4.js → chunk-NLI2AVEF.js} +386 -862
  150. package/dist/chunk-NLI2AVEF.js.map +1 -0
  151. package/dist/{chunk-YMTXMPV6.js → chunk-NMWDXFPH.js} +4 -4
  152. package/dist/{chunk-YMTXMPV6.js.map → chunk-NMWDXFPH.js.map} +1 -1
  153. package/dist/{chunk-J7LXTUTP.cjs → chunk-PF6F5NLJ.cjs} +604 -1094
  154. package/dist/chunk-PF6F5NLJ.cjs.map +1 -0
  155. package/dist/{chunk-NAAMUYMS.cjs → chunk-PNN7RHVR.cjs} +58 -48
  156. package/dist/chunk-PNN7RHVR.cjs.map +1 -0
  157. package/dist/{chunk-YOALGKRE.cjs → chunk-PNTCATDE.cjs} +3528 -1763
  158. package/dist/chunk-PNTCATDE.cjs.map +1 -0
  159. package/dist/{chunk-6DCB664D.js → chunk-PQBQG7IM.js} +3 -3
  160. package/dist/{chunk-6DCB664D.js.map → chunk-PQBQG7IM.js.map} +1 -1
  161. package/dist/{chunk-UCQ3BFSY.cjs → chunk-PT7RIRIZ.cjs} +684 -332
  162. package/dist/chunk-PT7RIRIZ.cjs.map +1 -0
  163. package/dist/{chunk-ACSVZPK7.cjs → chunk-PWLJ77UV.cjs} +5 -3
  164. package/dist/chunk-PWLJ77UV.cjs.map +1 -0
  165. package/dist/chunk-Q3G6A4I3.cjs +755 -0
  166. package/dist/chunk-Q3G6A4I3.cjs.map +1 -0
  167. package/dist/{chunk-Z3WO6MND.cjs → chunk-RMQLSPA2.cjs} +297 -27
  168. package/dist/chunk-RMQLSPA2.cjs.map +1 -0
  169. package/dist/{chunk-SJDMVITW.cjs → chunk-RT5ZY4XA.cjs} +6 -5
  170. package/dist/chunk-RT5ZY4XA.cjs.map +1 -0
  171. package/dist/{chunk-ID4WXTKL.js → chunk-S6PW7VV5.js} +2382 -617
  172. package/dist/chunk-S6PW7VV5.js.map +1 -0
  173. package/dist/{chunk-4GUBTVPV.js → chunk-T4XNKYXB.js} +780 -126
  174. package/dist/chunk-T4XNKYXB.js.map +1 -0
  175. package/dist/{chunk-YDWLUT5V.cjs → chunk-TQR4KBY2.cjs} +323 -178
  176. package/dist/chunk-TQR4KBY2.cjs.map +1 -0
  177. package/dist/{chunk-OOA273IJ.cjs → chunk-U5SON7R2.cjs} +27 -27
  178. package/dist/{chunk-OOA273IJ.cjs.map → chunk-U5SON7R2.cjs.map} +1 -1
  179. package/dist/{chunk-IX64T5OL.cjs → chunk-U63GDNRC.cjs} +32 -26
  180. package/dist/chunk-U63GDNRC.cjs.map +1 -0
  181. package/dist/{chunk-WDBXJOU5.cjs → chunk-UDISNXDL.cjs} +56 -47
  182. package/dist/chunk-UDISNXDL.cjs.map +1 -0
  183. package/dist/{chunk-EFEOOCJ3.js → chunk-UV3SN74I.js} +5 -5
  184. package/dist/{chunk-EFEOOCJ3.js.map → chunk-UV3SN74I.js.map} +1 -1
  185. package/dist/{chunk-U5W4LKZV.cjs → chunk-VCRRKBLN.cjs} +9 -9
  186. package/dist/{chunk-U5W4LKZV.cjs.map → chunk-VCRRKBLN.cjs.map} +1 -1
  187. package/dist/{chunk-ISLPNELU.js → chunk-VGTJPTIC.js} +16 -5
  188. package/dist/chunk-VGTJPTIC.js.map +1 -0
  189. package/dist/chunk-VLT6PEWR.cjs +60 -0
  190. package/dist/chunk-VLT6PEWR.cjs.map +1 -0
  191. package/dist/chunk-VQH4VAWD.cjs +12 -0
  192. package/dist/{chunk-B3F2D3SP.cjs.map → chunk-VQH4VAWD.cjs.map} +1 -1
  193. package/dist/{chunk-SNXVDZAJ.js → chunk-W6OG3HDG.js} +5 -4
  194. package/dist/chunk-W6OG3HDG.js.map +1 -0
  195. package/dist/chunk-WDGA7IYB.js +207 -0
  196. package/dist/chunk-WDGA7IYB.js.map +1 -0
  197. package/dist/chunk-WQZLUGVR.js +2057 -0
  198. package/dist/chunk-WQZLUGVR.js.map +1 -0
  199. package/dist/{chunk-EKFUG4G7.cjs → chunk-XBYVV3MP.cjs} +60 -5
  200. package/dist/chunk-XBYVV3MP.cjs.map +1 -0
  201. package/dist/{chunk-5GAONX5G.cjs → chunk-XCAGZAKP.cjs} +7 -7
  202. package/dist/{chunk-5GAONX5G.cjs.map → chunk-XCAGZAKP.cjs.map} +1 -1
  203. package/dist/chunk-XL7SLCXS.js +309 -0
  204. package/dist/chunk-XL7SLCXS.js.map +1 -0
  205. package/dist/{chunk-SVJ5GEXW.cjs → chunk-XUO3KQFO.cjs} +2 -2
  206. package/dist/chunk-XUO3KQFO.cjs.map +1 -0
  207. package/dist/{chunk-F4NHQHEZ.cjs → chunk-YAAM3M2S.cjs} +10 -10
  208. package/dist/{chunk-F4NHQHEZ.cjs.map → chunk-YAAM3M2S.cjs.map} +1 -1
  209. package/dist/{chunk-RUQS6M7G.js → chunk-YBFHZUXX.js} +6 -6
  210. package/dist/chunk-YBFHZUXX.js.map +1 -0
  211. package/dist/{chunk-KMXWZLQX.cjs → chunk-YBQOHKHN.cjs} +99 -100
  212. package/dist/chunk-YBQOHKHN.cjs.map +1 -0
  213. package/dist/{chunk-PVUI6KGR.js → chunk-YDFDBE6D.js} +93 -6
  214. package/dist/chunk-YDFDBE6D.js.map +1 -0
  215. package/dist/{chunk-P7GTYOLB.cjs → chunk-YVWGEQJE.cjs} +297 -135
  216. package/dist/chunk-YVWGEQJE.cjs.map +1 -0
  217. package/dist/{chunk-QT6V3YRH.js → chunk-YWGVVALJ.js} +3 -3
  218. package/dist/{chunk-QT6V3YRH.js.map → chunk-YWGVVALJ.js.map} +1 -1
  219. package/dist/core/index.cjs +40 -40
  220. package/dist/core/index.d.cts +4 -5
  221. package/dist/core/index.d.ts +4 -5
  222. package/dist/core/index.js +8 -8
  223. package/dist/{ddl-BG4J805L.d.cts → ddl-BJcOp4WZ.d.cts} +3 -3
  224. package/dist/{ddl-CgiS9QLj.d.ts → ddl-BXfGHbPN.d.ts} +3 -3
  225. package/dist/graph-extension/index.cjs +26 -22
  226. package/dist/graph-extension/index.d.cts +16 -6
  227. package/dist/graph-extension/index.d.ts +16 -6
  228. package/dist/graph-extension/index.js +7 -7
  229. package/dist/graph-merge/index.cjs +2459 -654
  230. package/dist/graph-merge/index.cjs.map +1 -1
  231. package/dist/graph-merge/index.d.cts +170 -33
  232. package/dist/graph-merge/index.d.ts +170 -33
  233. package/dist/graph-merge/index.js +2269 -467
  234. package/dist/graph-merge/index.js.map +1 -1
  235. package/dist/{index-C3y_98iN.d.cts → index-BSHvKfok.d.ts} +221 -10
  236. package/dist/{index-BBxZCUdu.d.ts → index-DxaYCv8Y.d.cts} +221 -10
  237. package/dist/index.cjs +330 -268
  238. package/dist/index.cjs.map +1 -1
  239. package/dist/index.d.cts +590 -576
  240. package/dist/index.d.ts +590 -576
  241. package/dist/index.js +73 -49
  242. package/dist/index.js.map +1 -1
  243. package/dist/indexes/index.cjs +17 -17
  244. package/dist/indexes/index.d.cts +4 -4
  245. package/dist/indexes/index.d.ts +4 -4
  246. package/dist/indexes/index.js +10 -10
  247. package/dist/interchange/index.cjs +165 -51
  248. package/dist/interchange/index.cjs.map +1 -1
  249. package/dist/interchange/index.d.cts +261 -16
  250. package/dist/interchange/index.d.ts +261 -16
  251. package/dist/interchange/index.js +128 -25
  252. package/dist/interchange/index.js.map +1 -1
  253. package/dist/{manager-YoLEfcc1.d.ts → manager-CfZAimti.d.ts} +36 -5
  254. package/dist/{manager-KS7CGQQT.d.cts → manager-HGk6E_HW.d.cts} +36 -5
  255. package/dist/{materialize-indexes-Bhhyb1B3.d.ts → materialize-indexes-6A7dWGtb.d.cts} +10 -2
  256. package/dist/{materialize-indexes-OHRWypW6.d.cts → materialize-indexes-BMJP6Tms.d.ts} +10 -2
  257. package/dist/{postgres-DpkW3R5Y.d.cts → postgres-DFYWENdR.d.cts} +1961 -439
  258. package/dist/{postgres-DwqyIniy.d.ts → postgres-e7a9TdvR.d.ts} +1961 -439
  259. package/dist/profiler/index.cjs +15 -15
  260. package/dist/profiler/index.d.cts +9 -10
  261. package/dist/profiler/index.d.ts +9 -10
  262. package/dist/profiler/index.js +4 -4
  263. package/dist/provenance/index.cjs +46 -48
  264. package/dist/provenance/index.cjs.map +1 -1
  265. package/dist/provenance/index.d.cts +7 -7
  266. package/dist/provenance/index.d.ts +7 -7
  267. package/dist/provenance/index.js +12 -14
  268. package/dist/provenance/index.js.map +1 -1
  269. package/dist/schema/index.cjs +50 -48
  270. package/dist/schema/index.d.cts +9 -16
  271. package/dist/schema/index.d.ts +9 -16
  272. package/dist/schema/index.js +23 -21
  273. package/dist/{searchable-DLWEfC4a.d.ts → searchable-9OQoPuRs.d.ts} +1 -2
  274. package/dist/{searchable-CIZL8Hyw.d.cts → searchable-CIje5XYD.d.cts} +1 -2
  275. package/dist/{sqlite-DY0WODUK.d.cts → sqlite-DerU5tc7.d.ts} +2029 -347
  276. package/dist/{sqlite-L-VIRzqA.d.ts → sqlite-DitnISa9.d.cts} +2029 -347
  277. package/dist/{store-view-A85FFRnk.d.cts → store-B0h6x7wo.d.cts} +1289 -767
  278. package/dist/{store-view-66p92IPi.d.ts → store-ClQ-MZQS.d.ts} +1289 -767
  279. package/dist/{temporal-BNbjXqer.d.cts → temporal-Bn-Fi8FJ.d.cts} +1 -1
  280. package/dist/{temporal-Bob6Nfbp.d.ts → temporal-BtM4UALv.d.ts} +1 -1
  281. package/dist/{types-DeORZhxn.d.cts → types-CoIx8HX5.d.cts} +1 -1
  282. package/dist/{types-Ch9a0Dx6.d.ts → types-HkveCCx0.d.cts} +726 -5
  283. package/dist/{types-Ch9a0Dx6.d.cts → types-HkveCCx0.d.ts} +726 -5
  284. package/dist/{types-ClCzT-dT.d.ts → types-KFfk-8Ah.d.ts} +1 -1
  285. package/dist/{where-DPw52ksb.d.cts → where--fk7_0kv.d.cts} +1 -1
  286. package/dist/{where-kWUZPvEA.d.ts → where-ws5hf-Ov.d.ts} +1 -1
  287. package/package.json +3 -3
  288. package/dist/chunk-2L54C2C2.js +0 -144
  289. package/dist/chunk-2L54C2C2.js.map +0 -1
  290. package/dist/chunk-35S6P5ZU.js +0 -27
  291. package/dist/chunk-35S6P5ZU.js.map +0 -1
  292. package/dist/chunk-42PYUGLS.js.map +0 -1
  293. package/dist/chunk-4GUBTVPV.js.map +0 -1
  294. package/dist/chunk-4GUTQPVO.js.map +0 -1
  295. package/dist/chunk-4MB3AQAQ.js.map +0 -1
  296. package/dist/chunk-4MEWSUVM.cjs.map +0 -1
  297. package/dist/chunk-4QIKLIGG.js.map +0 -1
  298. package/dist/chunk-4SZ6XPTG.cjs +0 -12
  299. package/dist/chunk-55ITBQJI.js.map +0 -1
  300. package/dist/chunk-5EKPX6QU.js.map +0 -1
  301. package/dist/chunk-6RYPD3NJ.cjs +0 -1282
  302. package/dist/chunk-6RYPD3NJ.cjs.map +0 -1
  303. package/dist/chunk-764JHTLT.cjs +0 -15
  304. package/dist/chunk-764JHTLT.cjs.map +0 -1
  305. package/dist/chunk-ACSVZPK7.cjs.map +0 -1
  306. package/dist/chunk-B3F2D3SP.cjs +0 -12
  307. package/dist/chunk-BGYJW37L.js.map +0 -1
  308. package/dist/chunk-BNS75YNF.cjs.map +0 -1
  309. package/dist/chunk-C4F7VJ5D.cjs.map +0 -1
  310. package/dist/chunk-CBKG6HEP.js +0 -1263
  311. package/dist/chunk-CBKG6HEP.js.map +0 -1
  312. package/dist/chunk-CPEL3YIR.cjs.map +0 -1
  313. package/dist/chunk-D54WH24V.cjs.map +0 -1
  314. package/dist/chunk-D56XG4EI.cjs.map +0 -1
  315. package/dist/chunk-D7PG5D5K.js.map +0 -1
  316. package/dist/chunk-DI74SMXS.cjs +0 -29
  317. package/dist/chunk-DI74SMXS.cjs.map +0 -1
  318. package/dist/chunk-DK2S42XB.js +0 -77
  319. package/dist/chunk-DK2S42XB.js.map +0 -1
  320. package/dist/chunk-DRACN6XG.js +0 -27
  321. package/dist/chunk-DRACN6XG.js.map +0 -1
  322. package/dist/chunk-DXEEHSGN.js.map +0 -1
  323. package/dist/chunk-EKFUG4G7.cjs.map +0 -1
  324. package/dist/chunk-EQ7JKLZO.cjs +0 -157
  325. package/dist/chunk-EQ7JKLZO.cjs.map +0 -1
  326. package/dist/chunk-FJMPR3OH.cjs.map +0 -1
  327. package/dist/chunk-FLEQ2HBK.js.map +0 -1
  328. package/dist/chunk-FQ7ZPOTZ.js.map +0 -1
  329. package/dist/chunk-G6Q5UM7U.js.map +0 -1
  330. package/dist/chunk-GYA4JRP5.js.map +0 -1
  331. package/dist/chunk-H7VE3FL4.cjs.map +0 -1
  332. package/dist/chunk-ID4WXTKL.js.map +0 -1
  333. package/dist/chunk-ISLPNELU.js.map +0 -1
  334. package/dist/chunk-ITE4IXAK.js +0 -25
  335. package/dist/chunk-ITE4IXAK.js.map +0 -1
  336. package/dist/chunk-IX64T5OL.cjs.map +0 -1
  337. package/dist/chunk-J2ICGNHO.cjs.map +0 -1
  338. package/dist/chunk-J7LXTUTP.cjs.map +0 -1
  339. package/dist/chunk-JQXSZHF2.cjs.map +0 -1
  340. package/dist/chunk-JXUTCSXX.cjs.map +0 -1
  341. package/dist/chunk-KCO5EFJU.js +0 -79
  342. package/dist/chunk-KCO5EFJU.js.map +0 -1
  343. package/dist/chunk-KKYELPZ2.cjs +0 -83
  344. package/dist/chunk-KKYELPZ2.cjs.map +0 -1
  345. package/dist/chunk-KMXWZLQX.cjs.map +0 -1
  346. package/dist/chunk-MIJKEVV7.js.map +0 -1
  347. package/dist/chunk-NAAMUYMS.cjs.map +0 -1
  348. package/dist/chunk-P7GTYOLB.cjs.map +0 -1
  349. package/dist/chunk-PVUI6KGR.js.map +0 -1
  350. package/dist/chunk-Q6EDCUXV.js.map +0 -1
  351. package/dist/chunk-QB6VMOJ2.cjs.map +0 -1
  352. package/dist/chunk-QC4MCOFV.cjs +0 -83
  353. package/dist/chunk-QC4MCOFV.cjs.map +0 -1
  354. package/dist/chunk-QMQLUA66.js +0 -12
  355. package/dist/chunk-QMQLUA66.js.map +0 -1
  356. package/dist/chunk-QRNYDV5Z.js.map +0 -1
  357. package/dist/chunk-RFRM3Q5K.js.map +0 -1
  358. package/dist/chunk-RUQS6M7G.js.map +0 -1
  359. package/dist/chunk-S4KQ5LV4.js.map +0 -1
  360. package/dist/chunk-SJDMVITW.cjs.map +0 -1
  361. package/dist/chunk-SNXVDZAJ.js.map +0 -1
  362. package/dist/chunk-SVJ5GEXW.cjs.map +0 -1
  363. package/dist/chunk-TDXIBCGY.cjs.map +0 -1
  364. package/dist/chunk-TKORQCG4.js.map +0 -1
  365. package/dist/chunk-TKP5T34P.js.map +0 -1
  366. package/dist/chunk-TRF4EBJT.cjs +0 -30
  367. package/dist/chunk-TRF4EBJT.cjs.map +0 -1
  368. package/dist/chunk-UCQ3BFSY.cjs.map +0 -1
  369. package/dist/chunk-UR7W5YQK.js.map +0 -1
  370. package/dist/chunk-V34A6R5V.js +0 -134
  371. package/dist/chunk-V34A6R5V.js.map +0 -1
  372. package/dist/chunk-WDAVPX46.js +0 -81
  373. package/dist/chunk-WDAVPX46.js.map +0 -1
  374. package/dist/chunk-WDBXJOU5.cjs.map +0 -1
  375. package/dist/chunk-YDWLUT5V.cjs.map +0 -1
  376. package/dist/chunk-YOALGKRE.cjs.map +0 -1
  377. package/dist/chunk-Z3WO6MND.cjs.map +0 -1
  378. package/dist/chunk-ZDH3DX3C.cjs +0 -30
  379. package/dist/chunk-ZDH3DX3C.cjs.map +0 -1
  380. package/dist/chunk-ZI6VQSZA.cjs.map +0 -1
  381. package/dist/chunk-ZTAJL4DT.cjs +0 -85
  382. package/dist/chunk-ZTAJL4DT.cjs.map +0 -1
  383. package/dist/define-graph-BGrJahvp.d.ts +0 -173
  384. package/dist/define-graph-alREY2wj.d.cts +0 -173
@@ -0,0 +1,736 @@
1
+ import { rowPropsToObject } from './chunk-AKLS3BYZ.js';
2
+ import { checkWherePredicate, computeUniqueKey, getKindsForUniquenessCheck } from './chunk-WDGA7IYB.js';
3
+ import { typeGraphGlobalSymbol } from './chunk-PQBQG7IM.js';
4
+ import { resolveEmbeddingFields, getSearchableFields, DEFAULT_SEARCHABLE_LANGUAGE } from './chunk-PC2UBAUB.js';
5
+ import { UniquenessError, RestrictedDeleteError } from './chunk-J3WZ3FA2.js';
6
+ import { readOwnProperty } from './chunk-DYATYRY4.js';
7
+
8
+ // src/store/types.ts
9
+ var AUTO_REFRESH_STATISTICS_ROW_THRESHOLD = 1e3;
10
+ var TRANSACTION_RUNTIME = typeGraphGlobalSymbol(
11
+ "transaction-runtime-v1"
12
+ );
13
+
14
+ // src/store/runtime-port.ts
15
+ var STORE_RUNTIME = typeGraphGlobalSymbol("store-runtime-v1");
16
+ function storeRuntime(store) {
17
+ const runtime = store[STORE_RUNTIME];
18
+ if (runtime === void 0) {
19
+ throw new TypeError(
20
+ "Cannot access this Store's runtime port. The Store may come from an incompatible TypeGraph version."
21
+ );
22
+ }
23
+ return runtime;
24
+ }
25
+ function storeBackend(store) {
26
+ return storeRuntime(store).backend;
27
+ }
28
+ function transactionBackend(transaction) {
29
+ const runtime = transaction[TRANSACTION_RUNTIME];
30
+ if (runtime === void 0) {
31
+ throw new TypeError(
32
+ "Cannot access this transaction's runtime port. The transaction may come from an incompatible TypeGraph version."
33
+ );
34
+ }
35
+ return runtime.backend;
36
+ }
37
+ function transactionNodeOperationHookRunner(transaction) {
38
+ const runtime = transaction[TRANSACTION_RUNTIME];
39
+ if (runtime === void 0) {
40
+ throw new TypeError(
41
+ "Cannot access this transaction's runtime port. The transaction may come from an incompatible TypeGraph version."
42
+ );
43
+ }
44
+ return runtime.runNodeOperationHooks;
45
+ }
46
+
47
+ // src/store/embedding-sync.ts
48
+ var embeddingFieldsCache = /* @__PURE__ */ new WeakMap();
49
+ function getEmbeddingFields(schema) {
50
+ const cached = embeddingFieldsCache.get(schema);
51
+ if (cached) return cached;
52
+ const fields = resolveEmbeddingFields(schema);
53
+ embeddingFieldsCache.set(schema, fields);
54
+ return fields;
55
+ }
56
+ async function syncEmbeddings(ctx, schema, props) {
57
+ const { backend } = ctx;
58
+ if (!backend.upsertEmbedding || !backend.deleteEmbedding) {
59
+ return;
60
+ }
61
+ const embeddingFields = getEmbeddingFields(schema);
62
+ if (embeddingFields.length === 0) {
63
+ return;
64
+ }
65
+ for (const field of embeddingFields) {
66
+ const value = readOwnProperty(props, field.fieldPath);
67
+ if (isValidEmbeddingValue(value)) {
68
+ await backend.upsertEmbedding({
69
+ graphId: ctx.graphId,
70
+ nodeKind: ctx.nodeKind,
71
+ nodeId: ctx.nodeId,
72
+ fieldPath: field.fieldPath,
73
+ embedding: value,
74
+ dimensions: field.dimensions,
75
+ metric: field.metric,
76
+ indexType: field.indexType
77
+ });
78
+ } else if (value === void 0) {
79
+ await backend.deleteEmbedding({
80
+ graphId: ctx.graphId,
81
+ nodeKind: ctx.nodeKind,
82
+ nodeId: ctx.nodeId,
83
+ fieldPath: field.fieldPath,
84
+ dimensions: field.dimensions,
85
+ metric: field.metric,
86
+ indexType: field.indexType
87
+ });
88
+ }
89
+ }
90
+ }
91
+ async function syncEmbeddingsBatchForKind(args, schema, items) {
92
+ const { graphId, nodeKind, backend } = args;
93
+ if (!backend.upsertEmbedding || !backend.deleteEmbedding) {
94
+ return;
95
+ }
96
+ const embeddingFields = getEmbeddingFields(schema);
97
+ if (embeddingFields.length === 0) {
98
+ return;
99
+ }
100
+ for (const field of embeddingFields) {
101
+ const rows = [];
102
+ const deletionIds = [];
103
+ for (const item of items) {
104
+ const value = readOwnProperty(item.props, field.fieldPath);
105
+ if (isValidEmbeddingValue(value)) {
106
+ rows.push({ nodeId: item.nodeId, embedding: value });
107
+ } else if (value === void 0) {
108
+ deletionIds.push(item.nodeId);
109
+ }
110
+ }
111
+ if (rows.length > 0) {
112
+ if (backend.upsertEmbeddingBatch === void 0) {
113
+ for (const row of rows) {
114
+ await backend.upsertEmbedding({
115
+ graphId,
116
+ nodeKind,
117
+ nodeId: row.nodeId,
118
+ fieldPath: field.fieldPath,
119
+ embedding: row.embedding,
120
+ dimensions: field.dimensions,
121
+ metric: field.metric,
122
+ indexType: field.indexType
123
+ });
124
+ }
125
+ } else {
126
+ await backend.upsertEmbeddingBatch({
127
+ graphId,
128
+ nodeKind,
129
+ fieldPath: field.fieldPath,
130
+ dimensions: field.dimensions,
131
+ metric: field.metric,
132
+ indexType: field.indexType,
133
+ rows
134
+ });
135
+ }
136
+ }
137
+ if (deletionIds.length > 0 && backend.deleteEmbeddingBatch !== void 0) {
138
+ await backend.deleteEmbeddingBatch({
139
+ graphId,
140
+ nodeKind,
141
+ nodeIds: deletionIds,
142
+ fieldPath: field.fieldPath,
143
+ dimensions: field.dimensions,
144
+ metric: field.metric,
145
+ indexType: field.indexType
146
+ });
147
+ } else {
148
+ for (const nodeId of deletionIds) {
149
+ await backend.deleteEmbedding({
150
+ graphId,
151
+ nodeKind,
152
+ nodeId,
153
+ fieldPath: field.fieldPath,
154
+ dimensions: field.dimensions,
155
+ metric: field.metric,
156
+ indexType: field.indexType
157
+ });
158
+ }
159
+ }
160
+ }
161
+ }
162
+ async function deleteNodeEmbeddings(ctx, schema) {
163
+ const { backend } = ctx;
164
+ if (!backend.deleteEmbedding) {
165
+ return;
166
+ }
167
+ const embeddingFields = getEmbeddingFields(schema);
168
+ if (embeddingFields.length === 0) {
169
+ return;
170
+ }
171
+ for (const field of embeddingFields) {
172
+ await backend.deleteEmbedding({
173
+ graphId: ctx.graphId,
174
+ nodeKind: ctx.nodeKind,
175
+ nodeId: ctx.nodeId,
176
+ fieldPath: field.fieldPath,
177
+ dimensions: field.dimensions,
178
+ metric: field.metric,
179
+ indexType: field.indexType
180
+ });
181
+ }
182
+ }
183
+ function isValidEmbeddingValue(value) {
184
+ if (!Array.isArray(value)) {
185
+ return false;
186
+ }
187
+ return value.every((n) => typeof n === "number" && Number.isFinite(n));
188
+ }
189
+
190
+ // src/store/fulltext-sync.ts
191
+ var FIELD_SEPARATOR = "\n";
192
+ function resolveCombinedLanguage(fields) {
193
+ return fields[0]?.metadata.language ?? DEFAULT_SEARCHABLE_LANGUAGE;
194
+ }
195
+ function computeFulltextContent(schema, props) {
196
+ const searchableFields = getSearchableFields(schema);
197
+ if (searchableFields.length === 0) return void 0;
198
+ const parts = [];
199
+ for (const field of searchableFields) {
200
+ const value = readOwnProperty(props, field.fieldPath);
201
+ if (typeof value === "string" && value.length > 0) {
202
+ parts.push(value);
203
+ }
204
+ }
205
+ if (parts.length === 0) return void 0;
206
+ return {
207
+ content: parts.join(FIELD_SEPARATOR),
208
+ language: resolveCombinedLanguage(searchableFields)
209
+ };
210
+ }
211
+ async function syncFulltext(ctx, schema, props) {
212
+ const { backend } = ctx;
213
+ if (!backend.upsertFulltext || !backend.deleteFulltext) {
214
+ return;
215
+ }
216
+ const computed = computeFulltextContent(schema, props);
217
+ if (computed !== void 0) {
218
+ await backend.upsertFulltext({
219
+ graphId: ctx.graphId,
220
+ nodeKind: ctx.nodeKind,
221
+ nodeId: ctx.nodeId,
222
+ content: computed.content,
223
+ language: computed.language
224
+ });
225
+ return;
226
+ }
227
+ if (getSearchableFields(schema).length === 0) return;
228
+ await backend.deleteFulltext({
229
+ graphId: ctx.graphId,
230
+ nodeKind: ctx.nodeKind,
231
+ nodeId: ctx.nodeId
232
+ });
233
+ }
234
+ async function syncFulltextBatchForKind(args, schema, items) {
235
+ const { graphId, nodeKind, backend } = args;
236
+ if (!backend.upsertFulltext || !backend.deleteFulltext) {
237
+ return;
238
+ }
239
+ const rows = [];
240
+ const emptyContentIds = [];
241
+ const hasSearchableFields = getSearchableFields(schema).length > 0;
242
+ for (const item of items) {
243
+ const computed = computeFulltextContent(schema, item.props);
244
+ if (computed !== void 0) {
245
+ rows.push({
246
+ nodeId: item.nodeId,
247
+ content: computed.content,
248
+ language: computed.language
249
+ });
250
+ } else if (hasSearchableFields) {
251
+ emptyContentIds.push(item.nodeId);
252
+ }
253
+ }
254
+ if (rows.length > 0) {
255
+ if (backend.upsertFulltextBatch === void 0) {
256
+ for (const row of rows) {
257
+ await backend.upsertFulltext({
258
+ graphId,
259
+ nodeKind,
260
+ nodeId: row.nodeId,
261
+ content: row.content,
262
+ language: row.language
263
+ });
264
+ }
265
+ } else {
266
+ await backend.upsertFulltextBatch({ graphId, nodeKind, rows });
267
+ }
268
+ }
269
+ if (emptyContentIds.length > 0) {
270
+ if (backend.deleteFulltextBatch === void 0) {
271
+ for (const nodeId of emptyContentIds) {
272
+ await backend.deleteFulltext({ graphId, nodeKind, nodeId });
273
+ }
274
+ } else {
275
+ await backend.deleteFulltextBatch({
276
+ graphId,
277
+ nodeKind,
278
+ nodeIds: emptyContentIds
279
+ });
280
+ }
281
+ }
282
+ }
283
+ async function deleteNodeFulltext(ctx, schema) {
284
+ const { backend } = ctx;
285
+ if (!backend.deleteFulltext) {
286
+ return;
287
+ }
288
+ if (getSearchableFields(schema).length === 0) {
289
+ return;
290
+ }
291
+ await backend.deleteFulltext({
292
+ graphId: ctx.graphId,
293
+ nodeKind: ctx.nodeKind,
294
+ nodeId: ctx.nodeId
295
+ });
296
+ }
297
+
298
+ // src/store/uniqueness.ts
299
+ function createUniquenessContext(graphId, registry, backend) {
300
+ return { graphId, registry, backend };
301
+ }
302
+ async function probeUniqueKey(ctx, kind, id, constraint, key) {
303
+ const kindsToCheck = getKindsForUniquenessCheck(
304
+ kind,
305
+ constraint.scope,
306
+ ctx.registry
307
+ );
308
+ let heldByThisNode = false;
309
+ for (const kindToCheck of kindsToCheck) {
310
+ const existing = await ctx.backend.checkUnique({
311
+ graphId: ctx.graphId,
312
+ nodeKind: kindToCheck,
313
+ constraintName: constraint.name,
314
+ key
315
+ });
316
+ if (existing === void 0) continue;
317
+ if (existing.node_id !== id) {
318
+ throw new UniquenessError({
319
+ constraintName: constraint.name,
320
+ kind: kindToCheck,
321
+ existingId: existing.node_id,
322
+ newId: id,
323
+ fields: constraint.fields
324
+ });
325
+ }
326
+ if (kindToCheck === kind) heldByThisNode = true;
327
+ }
328
+ return heldByThisNode;
329
+ }
330
+ async function checkUniquenessConstraints(ctx, kind, id, props, constraints) {
331
+ for (const constraint of constraints) {
332
+ if (!checkWherePredicate(constraint, props)) {
333
+ continue;
334
+ }
335
+ await probeUniqueKey(
336
+ ctx,
337
+ kind,
338
+ id,
339
+ constraint,
340
+ computeUniqueKey(props, constraint.fields, constraint.collation)
341
+ );
342
+ }
343
+ }
344
+ async function insertUniquenessEntries(ctx, kind, id, props, constraints) {
345
+ for (const constraint of constraints) {
346
+ if (!checkWherePredicate(constraint, props)) {
347
+ continue;
348
+ }
349
+ const key = computeUniqueKey(
350
+ props,
351
+ constraint.fields,
352
+ constraint.collation
353
+ );
354
+ await ctx.backend.insertUnique({
355
+ graphId: ctx.graphId,
356
+ nodeKind: kind,
357
+ constraintName: constraint.name,
358
+ key,
359
+ nodeId: id,
360
+ concreteKind: kind
361
+ });
362
+ }
363
+ }
364
+ async function insertUniquenessEntriesBatch(ctx, items) {
365
+ const entries = [];
366
+ for (const item of items) {
367
+ for (const constraint of item.constraints) {
368
+ if (!checkWherePredicate(constraint, item.props)) {
369
+ continue;
370
+ }
371
+ entries.push({
372
+ graphId: ctx.graphId,
373
+ nodeKind: item.kind,
374
+ constraintName: constraint.name,
375
+ key: computeUniqueKey(
376
+ item.props,
377
+ constraint.fields,
378
+ constraint.collation
379
+ ),
380
+ nodeId: item.id,
381
+ concreteKind: item.kind
382
+ });
383
+ }
384
+ }
385
+ if (entries.length === 0) return;
386
+ if (ctx.backend.insertUniqueBatch !== void 0) {
387
+ await ctx.backend.insertUniqueBatch(entries);
388
+ return;
389
+ }
390
+ for (const entry of entries) {
391
+ await ctx.backend.insertUnique(entry);
392
+ }
393
+ }
394
+ async function deleteUniquenessEntries(ctx, kind, props, constraints) {
395
+ for (const constraint of constraints) {
396
+ if (!checkWherePredicate(constraint, props)) {
397
+ continue;
398
+ }
399
+ const key = computeUniqueKey(
400
+ props,
401
+ constraint.fields,
402
+ constraint.collation
403
+ );
404
+ await ctx.backend.deleteUnique({
405
+ graphId: ctx.graphId,
406
+ nodeKind: kind,
407
+ constraintName: constraint.name,
408
+ key
409
+ });
410
+ }
411
+ }
412
+ async function planUniquenessUpdate(ctx, kind, id, oldProps, newProps, constraints) {
413
+ const pending = [];
414
+ for (const constraint of constraints) {
415
+ const oldApplies = checkWherePredicate(constraint, oldProps);
416
+ const newApplies = checkWherePredicate(constraint, newProps);
417
+ const oldKey = oldApplies ? computeUniqueKey(oldProps, constraint.fields, constraint.collation) : void 0;
418
+ const newKey = newApplies ? computeUniqueKey(newProps, constraint.fields, constraint.collation) : void 0;
419
+ if (!oldApplies && !newApplies) {
420
+ continue;
421
+ }
422
+ if (oldApplies && newApplies && oldKey === newKey) {
423
+ continue;
424
+ }
425
+ const alreadyHeld = newKey === void 0 ? false : await probeUniqueKey(ctx, kind, id, constraint, newKey);
426
+ pending.push({
427
+ constraintName: constraint.name,
428
+ release: oldKey,
429
+ claim: alreadyHeld ? void 0 : newKey
430
+ });
431
+ }
432
+ return pending;
433
+ }
434
+ async function planUniquenessReinsert(ctx, kind, id, props, constraints) {
435
+ const pending = [];
436
+ for (const constraint of constraints) {
437
+ if (!checkWherePredicate(constraint, props)) continue;
438
+ const key = computeUniqueKey(
439
+ props,
440
+ constraint.fields,
441
+ constraint.collation
442
+ );
443
+ const alreadyHeld = await probeUniqueKey(ctx, kind, id, constraint, key);
444
+ pending.push({
445
+ constraintName: constraint.name,
446
+ release: void 0,
447
+ claim: alreadyHeld ? void 0 : key
448
+ });
449
+ }
450
+ return pending;
451
+ }
452
+ async function releaseUniqueKeys(ctx, kind, keys) {
453
+ for (const entry of keys) {
454
+ await ctx.backend.deleteUnique({
455
+ graphId: ctx.graphId,
456
+ nodeKind: kind,
457
+ constraintName: entry.constraintName,
458
+ key: entry.key
459
+ });
460
+ }
461
+ }
462
+ async function claimUniqueKeysThen(ctx, kind, id, plan, gatedWrite) {
463
+ const claimed = [];
464
+ try {
465
+ for (const mutation of plan) {
466
+ if (mutation.claim === void 0) continue;
467
+ await ctx.backend.insertUnique({
468
+ graphId: ctx.graphId,
469
+ nodeKind: kind,
470
+ constraintName: mutation.constraintName,
471
+ key: mutation.claim,
472
+ nodeId: id,
473
+ concreteKind: kind
474
+ });
475
+ claimed.push({
476
+ constraintName: mutation.constraintName,
477
+ key: mutation.claim
478
+ });
479
+ }
480
+ return await gatedWrite();
481
+ } catch (error) {
482
+ await releaseUniqueKeys(ctx, kind, claimed);
483
+ throw error;
484
+ }
485
+ }
486
+ async function withUniquenessTransition(ctx, kind, id, plan, gatedWrite) {
487
+ const result = await claimUniqueKeysThen(ctx, kind, id, plan, gatedWrite);
488
+ await releaseUniqueKeys(
489
+ ctx,
490
+ kind,
491
+ plan.flatMap(
492
+ (mutation) => mutation.release === void 0 ? [] : [{ constraintName: mutation.constraintName, key: mutation.release }]
493
+ )
494
+ );
495
+ return result;
496
+ }
497
+
498
+ // src/store/operations/node-write-pipeline.ts
499
+ function createNodeWriteContext(graphId, registry, lock) {
500
+ return { graphId, registry, lock };
501
+ }
502
+ function uniquenessContext(ctx, backend) {
503
+ return createUniquenessContext(ctx.graphId, ctx.registry, backend);
504
+ }
505
+ function nodeSyncContext(ctx, kind, id, backend) {
506
+ return { graphId: ctx.graphId, nodeKind: kind, nodeId: id, backend };
507
+ }
508
+ async function enforceNodeDeleteBehavior(ctx, args, backend, policy) {
509
+ if (policy?.enforceDeleteBehavior === false) return;
510
+ const behavior = args.onDelete ?? "restrict";
511
+ const connectedEdges = await backend.findEdgesConnectedTo({
512
+ graphId: ctx.graphId,
513
+ nodeKind: args.kind,
514
+ nodeId: args.id
515
+ });
516
+ if (connectedEdges.length === 0) return;
517
+ switch (behavior) {
518
+ case "restrict": {
519
+ throw new RestrictedDeleteError({
520
+ nodeKind: args.kind,
521
+ nodeId: args.id,
522
+ edgeCount: connectedEdges.length,
523
+ edgeKinds: [...new Set(connectedEdges.map((edge) => edge.kind))]
524
+ });
525
+ }
526
+ case "cascade":
527
+ case "disconnect": {
528
+ const batchDelete = args.mode === "hard" ? backend.hardDeleteEdgesBatch : backend.deleteEdgesBatch;
529
+ if (batchDelete !== void 0) {
530
+ await batchDelete({
531
+ graphId: ctx.graphId,
532
+ ids: connectedEdges.map((edge) => edge.id)
533
+ });
534
+ break;
535
+ }
536
+ for (const edge of connectedEdges) {
537
+ await (args.mode === "hard" ? backend.hardDeleteEdge({ graphId: ctx.graphId, id: edge.id }) : backend.deleteEdge({ graphId: ctx.graphId, id: edge.id }));
538
+ }
539
+ break;
540
+ }
541
+ }
542
+ }
543
+ async function applyNodeInsertSideEffects(ctx, args, backend) {
544
+ await insertUniquenessEntries(
545
+ uniquenessContext(ctx, backend),
546
+ args.kind,
547
+ args.id,
548
+ args.props,
549
+ args.uniqueConstraints
550
+ );
551
+ await Promise.all([
552
+ syncEmbeddings(
553
+ nodeSyncContext(ctx, args.kind, args.id, backend),
554
+ args.schema,
555
+ args.props
556
+ ),
557
+ syncFulltext(
558
+ nodeSyncContext(ctx, args.kind, args.id, backend),
559
+ args.schema,
560
+ args.props
561
+ )
562
+ ]);
563
+ }
564
+ async function applyNodeInsertSideEffectsBatch(ctx, items, backend) {
565
+ if (items.length === 0) return;
566
+ await insertUniquenessEntriesBatch(
567
+ uniquenessContext(ctx, backend),
568
+ items.map((item) => ({
569
+ kind: item.kind,
570
+ id: item.id,
571
+ props: item.props,
572
+ constraints: item.uniqueConstraints
573
+ }))
574
+ );
575
+ const byKind = /* @__PURE__ */ new Map();
576
+ for (const item of items) {
577
+ const group = byKind.get(item.kind) ?? { schema: item.schema, rows: [] };
578
+ group.rows.push({ nodeId: item.id, props: item.props });
579
+ byKind.set(item.kind, group);
580
+ }
581
+ await Promise.all(
582
+ [...byKind.entries()].flatMap(([kind, group]) => {
583
+ const syncArguments = { graphId: ctx.graphId, nodeKind: kind, backend };
584
+ return [
585
+ syncEmbeddingsBatchForKind(syncArguments, group.schema, group.rows),
586
+ syncFulltextBatchForKind(syncArguments, group.schema, group.rows)
587
+ ];
588
+ })
589
+ );
590
+ }
591
+ function parseRowProps(row) {
592
+ return rowPropsToObject(row.props);
593
+ }
594
+ async function planNodeUpdateUniqueness(ctx, args, backend) {
595
+ const { kind, id } = args.existing;
596
+ if (args.existing.deleted_at !== void 0) {
597
+ return planUniquenessReinsert(
598
+ uniquenessContext(ctx, backend),
599
+ kind,
600
+ id,
601
+ args.validatedProps,
602
+ args.uniqueConstraints
603
+ );
604
+ }
605
+ return planUniquenessUpdate(
606
+ uniquenessContext(ctx, backend),
607
+ kind,
608
+ id,
609
+ parseRowProps(args.existing),
610
+ args.validatedProps,
611
+ args.uniqueConstraints
612
+ );
613
+ }
614
+ async function applyNodeUpdate(ctx, args, backend) {
615
+ const { kind, id } = args.existing;
616
+ const plan = await planNodeUpdateUniqueness(
617
+ ctx,
618
+ {
619
+ existing: args.existing,
620
+ validatedProps: args.validatedProps,
621
+ uniqueConstraints: args.uniqueConstraints
622
+ },
623
+ backend
624
+ );
625
+ const updateParams = {
626
+ graphId: ctx.graphId,
627
+ kind,
628
+ id,
629
+ props: args.validatedProps,
630
+ incrementVersion: true
631
+ };
632
+ if (args.validFrom !== void 0) updateParams.validFrom = args.validFrom;
633
+ if (args.validTo !== void 0) updateParams.validTo = args.validTo;
634
+ if (args.expectedValidFrom !== void 0) {
635
+ updateParams.expectedValidFrom = args.expectedValidFrom;
636
+ }
637
+ if (args.clearDeleted) updateParams.clearDeleted = true;
638
+ const row = await withUniquenessTransition(
639
+ uniquenessContext(ctx, backend),
640
+ kind,
641
+ id,
642
+ plan,
643
+ () => backend.updateNode(updateParams)
644
+ );
645
+ await Promise.all([
646
+ syncEmbeddings(
647
+ nodeSyncContext(ctx, kind, id, backend),
648
+ args.schema,
649
+ args.validatedProps
650
+ ),
651
+ syncFulltext(
652
+ nodeSyncContext(ctx, kind, id, backend),
653
+ args.schema,
654
+ args.validatedProps
655
+ )
656
+ ]);
657
+ return row;
658
+ }
659
+ async function applyNodeSoftDelete(ctx, args, backend, policy) {
660
+ const { kind, id } = args.existing;
661
+ await enforceNodeDeleteBehavior(
662
+ ctx,
663
+ { kind, id, mode: "soft", onDelete: args.onDelete },
664
+ backend,
665
+ policy
666
+ );
667
+ await backend.deleteNode({
668
+ graphId: ctx.graphId,
669
+ kind,
670
+ id
671
+ });
672
+ await deleteUniquenessEntries(
673
+ uniquenessContext(ctx, backend),
674
+ kind,
675
+ parseRowProps(args.existing),
676
+ args.uniqueConstraints
677
+ );
678
+ await deleteNodeEmbeddings(
679
+ nodeSyncContext(ctx, kind, id, backend),
680
+ args.schema
681
+ );
682
+ await deleteNodeFulltext(
683
+ nodeSyncContext(ctx, kind, id, backend),
684
+ args.schema
685
+ );
686
+ }
687
+ async function applyNodeHardDelete(ctx, args, backend) {
688
+ await enforceNodeDeleteBehavior(
689
+ ctx,
690
+ { kind: args.kind, id: args.id, mode: "hard", onDelete: args.onDelete },
691
+ backend
692
+ );
693
+ await backend.hardDeleteNode({
694
+ graphId: ctx.graphId,
695
+ kind: args.kind,
696
+ id: args.id
697
+ });
698
+ await deleteNodeEmbeddings(
699
+ nodeSyncContext(ctx, args.kind, args.id, backend),
700
+ args.schema
701
+ );
702
+ }
703
+ async function applyNodeResurrect(ctx, args, backend) {
704
+ const { kind, id } = args.existing;
705
+ const props = parseRowProps(args.existing);
706
+ const plan = await planUniquenessReinsert(
707
+ uniquenessContext(ctx, backend),
708
+ kind,
709
+ id,
710
+ props,
711
+ args.uniqueConstraints
712
+ );
713
+ const row = await withUniquenessTransition(
714
+ uniquenessContext(ctx, backend),
715
+ kind,
716
+ id,
717
+ plan,
718
+ () => backend.updateNode({
719
+ graphId: ctx.graphId,
720
+ kind,
721
+ id,
722
+ props,
723
+ incrementVersion: true,
724
+ clearDeleted: true
725
+ })
726
+ );
727
+ await Promise.all([
728
+ syncEmbeddings(nodeSyncContext(ctx, kind, id, backend), args.schema, props),
729
+ syncFulltext(nodeSyncContext(ctx, kind, id, backend), args.schema, props)
730
+ ]);
731
+ return row;
732
+ }
733
+
734
+ export { AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, STORE_RUNTIME, TRANSACTION_RUNTIME, applyNodeHardDelete, applyNodeInsertSideEffects, applyNodeInsertSideEffectsBatch, applyNodeResurrect, applyNodeSoftDelete, applyNodeUpdate, checkUniquenessConstraints, computeFulltextContent, createNodeWriteContext, createUniquenessContext, getEmbeddingFields, storeBackend, storeRuntime, transactionBackend, transactionNodeOperationHookRunner };
735
+ //# sourceMappingURL=chunk-M3WP7RQZ.js.map
736
+ //# sourceMappingURL=chunk-M3WP7RQZ.js.map