@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,755 @@
1
+ 'use strict';
2
+
3
+ var chunkXBYVV3MP_cjs = require('./chunk-XBYVV3MP.cjs');
4
+ var chunkE4WNQBEF_cjs = require('./chunk-E4WNQBEF.cjs');
5
+ var chunkVCRRKBLN_cjs = require('./chunk-VCRRKBLN.cjs');
6
+ var chunkHAHNRASW_cjs = require('./chunk-HAHNRASW.cjs');
7
+ var chunkNI72YOJB_cjs = require('./chunk-NI72YOJB.cjs');
8
+ var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
9
+
10
+ // src/store/types.ts
11
+ var AUTO_REFRESH_STATISTICS_ROW_THRESHOLD = 1e3;
12
+ var TRANSACTION_RUNTIME = chunkVCRRKBLN_cjs.typeGraphGlobalSymbol(
13
+ "transaction-runtime-v1"
14
+ );
15
+
16
+ // src/store/runtime-port.ts
17
+ var STORE_RUNTIME = chunkVCRRKBLN_cjs.typeGraphGlobalSymbol("store-runtime-v1");
18
+ function storeRuntime(store) {
19
+ const runtime = store[STORE_RUNTIME];
20
+ if (runtime === void 0) {
21
+ throw new TypeError(
22
+ "Cannot access this Store's runtime port. The Store may come from an incompatible TypeGraph version."
23
+ );
24
+ }
25
+ return runtime;
26
+ }
27
+ function storeBackend(store) {
28
+ return storeRuntime(store).backend;
29
+ }
30
+ function transactionBackend(transaction) {
31
+ const runtime = transaction[TRANSACTION_RUNTIME];
32
+ if (runtime === void 0) {
33
+ throw new TypeError(
34
+ "Cannot access this transaction's runtime port. The transaction may come from an incompatible TypeGraph version."
35
+ );
36
+ }
37
+ return runtime.backend;
38
+ }
39
+ function transactionNodeOperationHookRunner(transaction) {
40
+ const runtime = transaction[TRANSACTION_RUNTIME];
41
+ if (runtime === void 0) {
42
+ throw new TypeError(
43
+ "Cannot access this transaction's runtime port. The transaction may come from an incompatible TypeGraph version."
44
+ );
45
+ }
46
+ return runtime.runNodeOperationHooks;
47
+ }
48
+
49
+ // src/store/embedding-sync.ts
50
+ var embeddingFieldsCache = /* @__PURE__ */ new WeakMap();
51
+ function getEmbeddingFields(schema) {
52
+ const cached = embeddingFieldsCache.get(schema);
53
+ if (cached) return cached;
54
+ const fields = chunkHAHNRASW_cjs.resolveEmbeddingFields(schema);
55
+ embeddingFieldsCache.set(schema, fields);
56
+ return fields;
57
+ }
58
+ async function syncEmbeddings(ctx, schema, props) {
59
+ const { backend } = ctx;
60
+ if (!backend.upsertEmbedding || !backend.deleteEmbedding) {
61
+ return;
62
+ }
63
+ const embeddingFields = getEmbeddingFields(schema);
64
+ if (embeddingFields.length === 0) {
65
+ return;
66
+ }
67
+ for (const field of embeddingFields) {
68
+ const value = chunkN66HCGCY_cjs.readOwnProperty(props, field.fieldPath);
69
+ if (isValidEmbeddingValue(value)) {
70
+ await backend.upsertEmbedding({
71
+ graphId: ctx.graphId,
72
+ nodeKind: ctx.nodeKind,
73
+ nodeId: ctx.nodeId,
74
+ fieldPath: field.fieldPath,
75
+ embedding: value,
76
+ dimensions: field.dimensions,
77
+ metric: field.metric,
78
+ indexType: field.indexType
79
+ });
80
+ } else if (value === void 0) {
81
+ await backend.deleteEmbedding({
82
+ graphId: ctx.graphId,
83
+ nodeKind: ctx.nodeKind,
84
+ nodeId: ctx.nodeId,
85
+ fieldPath: field.fieldPath,
86
+ dimensions: field.dimensions,
87
+ metric: field.metric,
88
+ indexType: field.indexType
89
+ });
90
+ }
91
+ }
92
+ }
93
+ async function syncEmbeddingsBatchForKind(args, schema, items) {
94
+ const { graphId, nodeKind, backend } = args;
95
+ if (!backend.upsertEmbedding || !backend.deleteEmbedding) {
96
+ return;
97
+ }
98
+ const embeddingFields = getEmbeddingFields(schema);
99
+ if (embeddingFields.length === 0) {
100
+ return;
101
+ }
102
+ for (const field of embeddingFields) {
103
+ const rows = [];
104
+ const deletionIds = [];
105
+ for (const item of items) {
106
+ const value = chunkN66HCGCY_cjs.readOwnProperty(item.props, field.fieldPath);
107
+ if (isValidEmbeddingValue(value)) {
108
+ rows.push({ nodeId: item.nodeId, embedding: value });
109
+ } else if (value === void 0) {
110
+ deletionIds.push(item.nodeId);
111
+ }
112
+ }
113
+ if (rows.length > 0) {
114
+ if (backend.upsertEmbeddingBatch === void 0) {
115
+ for (const row of rows) {
116
+ await backend.upsertEmbedding({
117
+ graphId,
118
+ nodeKind,
119
+ nodeId: row.nodeId,
120
+ fieldPath: field.fieldPath,
121
+ embedding: row.embedding,
122
+ dimensions: field.dimensions,
123
+ metric: field.metric,
124
+ indexType: field.indexType
125
+ });
126
+ }
127
+ } else {
128
+ await backend.upsertEmbeddingBatch({
129
+ graphId,
130
+ nodeKind,
131
+ fieldPath: field.fieldPath,
132
+ dimensions: field.dimensions,
133
+ metric: field.metric,
134
+ indexType: field.indexType,
135
+ rows
136
+ });
137
+ }
138
+ }
139
+ if (deletionIds.length > 0 && backend.deleteEmbeddingBatch !== void 0) {
140
+ await backend.deleteEmbeddingBatch({
141
+ graphId,
142
+ nodeKind,
143
+ nodeIds: deletionIds,
144
+ fieldPath: field.fieldPath,
145
+ dimensions: field.dimensions,
146
+ metric: field.metric,
147
+ indexType: field.indexType
148
+ });
149
+ } else {
150
+ for (const nodeId of deletionIds) {
151
+ await backend.deleteEmbedding({
152
+ graphId,
153
+ nodeKind,
154
+ nodeId,
155
+ fieldPath: field.fieldPath,
156
+ dimensions: field.dimensions,
157
+ metric: field.metric,
158
+ indexType: field.indexType
159
+ });
160
+ }
161
+ }
162
+ }
163
+ }
164
+ async function deleteNodeEmbeddings(ctx, schema) {
165
+ const { backend } = ctx;
166
+ if (!backend.deleteEmbedding) {
167
+ return;
168
+ }
169
+ const embeddingFields = getEmbeddingFields(schema);
170
+ if (embeddingFields.length === 0) {
171
+ return;
172
+ }
173
+ for (const field of embeddingFields) {
174
+ await backend.deleteEmbedding({
175
+ graphId: ctx.graphId,
176
+ nodeKind: ctx.nodeKind,
177
+ nodeId: ctx.nodeId,
178
+ fieldPath: field.fieldPath,
179
+ dimensions: field.dimensions,
180
+ metric: field.metric,
181
+ indexType: field.indexType
182
+ });
183
+ }
184
+ }
185
+ function isValidEmbeddingValue(value) {
186
+ if (!Array.isArray(value)) {
187
+ return false;
188
+ }
189
+ return value.every((n) => typeof n === "number" && Number.isFinite(n));
190
+ }
191
+
192
+ // src/store/fulltext-sync.ts
193
+ var FIELD_SEPARATOR = "\n";
194
+ function resolveCombinedLanguage(fields) {
195
+ return fields[0]?.metadata.language ?? chunkHAHNRASW_cjs.DEFAULT_SEARCHABLE_LANGUAGE;
196
+ }
197
+ function computeFulltextContent(schema, props) {
198
+ const searchableFields = chunkHAHNRASW_cjs.getSearchableFields(schema);
199
+ if (searchableFields.length === 0) return void 0;
200
+ const parts = [];
201
+ for (const field of searchableFields) {
202
+ const value = chunkN66HCGCY_cjs.readOwnProperty(props, field.fieldPath);
203
+ if (typeof value === "string" && value.length > 0) {
204
+ parts.push(value);
205
+ }
206
+ }
207
+ if (parts.length === 0) return void 0;
208
+ return {
209
+ content: parts.join(FIELD_SEPARATOR),
210
+ language: resolveCombinedLanguage(searchableFields)
211
+ };
212
+ }
213
+ async function syncFulltext(ctx, schema, props) {
214
+ const { backend } = ctx;
215
+ if (!backend.upsertFulltext || !backend.deleteFulltext) {
216
+ return;
217
+ }
218
+ const computed = computeFulltextContent(schema, props);
219
+ if (computed !== void 0) {
220
+ await backend.upsertFulltext({
221
+ graphId: ctx.graphId,
222
+ nodeKind: ctx.nodeKind,
223
+ nodeId: ctx.nodeId,
224
+ content: computed.content,
225
+ language: computed.language
226
+ });
227
+ return;
228
+ }
229
+ if (chunkHAHNRASW_cjs.getSearchableFields(schema).length === 0) return;
230
+ await backend.deleteFulltext({
231
+ graphId: ctx.graphId,
232
+ nodeKind: ctx.nodeKind,
233
+ nodeId: ctx.nodeId
234
+ });
235
+ }
236
+ async function syncFulltextBatchForKind(args, schema, items) {
237
+ const { graphId, nodeKind, backend } = args;
238
+ if (!backend.upsertFulltext || !backend.deleteFulltext) {
239
+ return;
240
+ }
241
+ const rows = [];
242
+ const emptyContentIds = [];
243
+ const hasSearchableFields = chunkHAHNRASW_cjs.getSearchableFields(schema).length > 0;
244
+ for (const item of items) {
245
+ const computed = computeFulltextContent(schema, item.props);
246
+ if (computed !== void 0) {
247
+ rows.push({
248
+ nodeId: item.nodeId,
249
+ content: computed.content,
250
+ language: computed.language
251
+ });
252
+ } else if (hasSearchableFields) {
253
+ emptyContentIds.push(item.nodeId);
254
+ }
255
+ }
256
+ if (rows.length > 0) {
257
+ if (backend.upsertFulltextBatch === void 0) {
258
+ for (const row of rows) {
259
+ await backend.upsertFulltext({
260
+ graphId,
261
+ nodeKind,
262
+ nodeId: row.nodeId,
263
+ content: row.content,
264
+ language: row.language
265
+ });
266
+ }
267
+ } else {
268
+ await backend.upsertFulltextBatch({ graphId, nodeKind, rows });
269
+ }
270
+ }
271
+ if (emptyContentIds.length > 0) {
272
+ if (backend.deleteFulltextBatch === void 0) {
273
+ for (const nodeId of emptyContentIds) {
274
+ await backend.deleteFulltext({ graphId, nodeKind, nodeId });
275
+ }
276
+ } else {
277
+ await backend.deleteFulltextBatch({
278
+ graphId,
279
+ nodeKind,
280
+ nodeIds: emptyContentIds
281
+ });
282
+ }
283
+ }
284
+ }
285
+ async function deleteNodeFulltext(ctx, schema) {
286
+ const { backend } = ctx;
287
+ if (!backend.deleteFulltext) {
288
+ return;
289
+ }
290
+ if (chunkHAHNRASW_cjs.getSearchableFields(schema).length === 0) {
291
+ return;
292
+ }
293
+ await backend.deleteFulltext({
294
+ graphId: ctx.graphId,
295
+ nodeKind: ctx.nodeKind,
296
+ nodeId: ctx.nodeId
297
+ });
298
+ }
299
+
300
+ // src/store/uniqueness.ts
301
+ function createUniquenessContext(graphId, registry, backend) {
302
+ return { graphId, registry, backend };
303
+ }
304
+ async function probeUniqueKey(ctx, kind, id, constraint, key) {
305
+ const kindsToCheck = chunkE4WNQBEF_cjs.getKindsForUniquenessCheck(
306
+ kind,
307
+ constraint.scope,
308
+ ctx.registry
309
+ );
310
+ let heldByThisNode = false;
311
+ for (const kindToCheck of kindsToCheck) {
312
+ const existing = await ctx.backend.checkUnique({
313
+ graphId: ctx.graphId,
314
+ nodeKind: kindToCheck,
315
+ constraintName: constraint.name,
316
+ key
317
+ });
318
+ if (existing === void 0) continue;
319
+ if (existing.node_id !== id) {
320
+ throw new chunkNI72YOJB_cjs.UniquenessError({
321
+ constraintName: constraint.name,
322
+ kind: kindToCheck,
323
+ existingId: existing.node_id,
324
+ newId: id,
325
+ fields: constraint.fields
326
+ });
327
+ }
328
+ if (kindToCheck === kind) heldByThisNode = true;
329
+ }
330
+ return heldByThisNode;
331
+ }
332
+ async function checkUniquenessConstraints(ctx, kind, id, props, constraints) {
333
+ for (const constraint of constraints) {
334
+ if (!chunkE4WNQBEF_cjs.checkWherePredicate(constraint, props)) {
335
+ continue;
336
+ }
337
+ await probeUniqueKey(
338
+ ctx,
339
+ kind,
340
+ id,
341
+ constraint,
342
+ chunkE4WNQBEF_cjs.computeUniqueKey(props, constraint.fields, constraint.collation)
343
+ );
344
+ }
345
+ }
346
+ async function insertUniquenessEntries(ctx, kind, id, props, constraints) {
347
+ for (const constraint of constraints) {
348
+ if (!chunkE4WNQBEF_cjs.checkWherePredicate(constraint, props)) {
349
+ continue;
350
+ }
351
+ const key = chunkE4WNQBEF_cjs.computeUniqueKey(
352
+ props,
353
+ constraint.fields,
354
+ constraint.collation
355
+ );
356
+ await ctx.backend.insertUnique({
357
+ graphId: ctx.graphId,
358
+ nodeKind: kind,
359
+ constraintName: constraint.name,
360
+ key,
361
+ nodeId: id,
362
+ concreteKind: kind
363
+ });
364
+ }
365
+ }
366
+ async function insertUniquenessEntriesBatch(ctx, items) {
367
+ const entries = [];
368
+ for (const item of items) {
369
+ for (const constraint of item.constraints) {
370
+ if (!chunkE4WNQBEF_cjs.checkWherePredicate(constraint, item.props)) {
371
+ continue;
372
+ }
373
+ entries.push({
374
+ graphId: ctx.graphId,
375
+ nodeKind: item.kind,
376
+ constraintName: constraint.name,
377
+ key: chunkE4WNQBEF_cjs.computeUniqueKey(
378
+ item.props,
379
+ constraint.fields,
380
+ constraint.collation
381
+ ),
382
+ nodeId: item.id,
383
+ concreteKind: item.kind
384
+ });
385
+ }
386
+ }
387
+ if (entries.length === 0) return;
388
+ if (ctx.backend.insertUniqueBatch !== void 0) {
389
+ await ctx.backend.insertUniqueBatch(entries);
390
+ return;
391
+ }
392
+ for (const entry of entries) {
393
+ await ctx.backend.insertUnique(entry);
394
+ }
395
+ }
396
+ async function deleteUniquenessEntries(ctx, kind, props, constraints) {
397
+ for (const constraint of constraints) {
398
+ if (!chunkE4WNQBEF_cjs.checkWherePredicate(constraint, props)) {
399
+ continue;
400
+ }
401
+ const key = chunkE4WNQBEF_cjs.computeUniqueKey(
402
+ props,
403
+ constraint.fields,
404
+ constraint.collation
405
+ );
406
+ await ctx.backend.deleteUnique({
407
+ graphId: ctx.graphId,
408
+ nodeKind: kind,
409
+ constraintName: constraint.name,
410
+ key
411
+ });
412
+ }
413
+ }
414
+ async function planUniquenessUpdate(ctx, kind, id, oldProps, newProps, constraints) {
415
+ const pending = [];
416
+ for (const constraint of constraints) {
417
+ const oldApplies = chunkE4WNQBEF_cjs.checkWherePredicate(constraint, oldProps);
418
+ const newApplies = chunkE4WNQBEF_cjs.checkWherePredicate(constraint, newProps);
419
+ const oldKey = oldApplies ? chunkE4WNQBEF_cjs.computeUniqueKey(oldProps, constraint.fields, constraint.collation) : void 0;
420
+ const newKey = newApplies ? chunkE4WNQBEF_cjs.computeUniqueKey(newProps, constraint.fields, constraint.collation) : void 0;
421
+ if (!oldApplies && !newApplies) {
422
+ continue;
423
+ }
424
+ if (oldApplies && newApplies && oldKey === newKey) {
425
+ continue;
426
+ }
427
+ const alreadyHeld = newKey === void 0 ? false : await probeUniqueKey(ctx, kind, id, constraint, newKey);
428
+ pending.push({
429
+ constraintName: constraint.name,
430
+ release: oldKey,
431
+ claim: alreadyHeld ? void 0 : newKey
432
+ });
433
+ }
434
+ return pending;
435
+ }
436
+ async function planUniquenessReinsert(ctx, kind, id, props, constraints) {
437
+ const pending = [];
438
+ for (const constraint of constraints) {
439
+ if (!chunkE4WNQBEF_cjs.checkWherePredicate(constraint, props)) continue;
440
+ const key = chunkE4WNQBEF_cjs.computeUniqueKey(
441
+ props,
442
+ constraint.fields,
443
+ constraint.collation
444
+ );
445
+ const alreadyHeld = await probeUniqueKey(ctx, kind, id, constraint, key);
446
+ pending.push({
447
+ constraintName: constraint.name,
448
+ release: void 0,
449
+ claim: alreadyHeld ? void 0 : key
450
+ });
451
+ }
452
+ return pending;
453
+ }
454
+ async function releaseUniqueKeys(ctx, kind, keys) {
455
+ for (const entry of keys) {
456
+ await ctx.backend.deleteUnique({
457
+ graphId: ctx.graphId,
458
+ nodeKind: kind,
459
+ constraintName: entry.constraintName,
460
+ key: entry.key
461
+ });
462
+ }
463
+ }
464
+ async function claimUniqueKeysThen(ctx, kind, id, plan, gatedWrite) {
465
+ const claimed = [];
466
+ try {
467
+ for (const mutation of plan) {
468
+ if (mutation.claim === void 0) continue;
469
+ await ctx.backend.insertUnique({
470
+ graphId: ctx.graphId,
471
+ nodeKind: kind,
472
+ constraintName: mutation.constraintName,
473
+ key: mutation.claim,
474
+ nodeId: id,
475
+ concreteKind: kind
476
+ });
477
+ claimed.push({
478
+ constraintName: mutation.constraintName,
479
+ key: mutation.claim
480
+ });
481
+ }
482
+ return await gatedWrite();
483
+ } catch (error) {
484
+ await releaseUniqueKeys(ctx, kind, claimed);
485
+ throw error;
486
+ }
487
+ }
488
+ async function withUniquenessTransition(ctx, kind, id, plan, gatedWrite) {
489
+ const result = await claimUniqueKeysThen(ctx, kind, id, plan, gatedWrite);
490
+ await releaseUniqueKeys(
491
+ ctx,
492
+ kind,
493
+ plan.flatMap(
494
+ (mutation) => mutation.release === void 0 ? [] : [{ constraintName: mutation.constraintName, key: mutation.release }]
495
+ )
496
+ );
497
+ return result;
498
+ }
499
+
500
+ // src/store/operations/node-write-pipeline.ts
501
+ function createNodeWriteContext(graphId, registry, lock) {
502
+ return { graphId, registry, lock };
503
+ }
504
+ function uniquenessContext(ctx, backend) {
505
+ return createUniquenessContext(ctx.graphId, ctx.registry, backend);
506
+ }
507
+ function nodeSyncContext(ctx, kind, id, backend) {
508
+ return { graphId: ctx.graphId, nodeKind: kind, nodeId: id, backend };
509
+ }
510
+ async function enforceNodeDeleteBehavior(ctx, args, backend, policy) {
511
+ if (policy?.enforceDeleteBehavior === false) return;
512
+ const behavior = args.onDelete ?? "restrict";
513
+ const connectedEdges = await backend.findEdgesConnectedTo({
514
+ graphId: ctx.graphId,
515
+ nodeKind: args.kind,
516
+ nodeId: args.id
517
+ });
518
+ if (connectedEdges.length === 0) return;
519
+ switch (behavior) {
520
+ case "restrict": {
521
+ throw new chunkNI72YOJB_cjs.RestrictedDeleteError({
522
+ nodeKind: args.kind,
523
+ nodeId: args.id,
524
+ edgeCount: connectedEdges.length,
525
+ edgeKinds: [...new Set(connectedEdges.map((edge) => edge.kind))]
526
+ });
527
+ }
528
+ case "cascade":
529
+ case "disconnect": {
530
+ const batchDelete = args.mode === "hard" ? backend.hardDeleteEdgesBatch : backend.deleteEdgesBatch;
531
+ if (batchDelete !== void 0) {
532
+ await batchDelete({
533
+ graphId: ctx.graphId,
534
+ ids: connectedEdges.map((edge) => edge.id)
535
+ });
536
+ break;
537
+ }
538
+ for (const edge of connectedEdges) {
539
+ await (args.mode === "hard" ? backend.hardDeleteEdge({ graphId: ctx.graphId, id: edge.id }) : backend.deleteEdge({ graphId: ctx.graphId, id: edge.id }));
540
+ }
541
+ break;
542
+ }
543
+ }
544
+ }
545
+ async function applyNodeInsertSideEffects(ctx, args, backend) {
546
+ await insertUniquenessEntries(
547
+ uniquenessContext(ctx, backend),
548
+ args.kind,
549
+ args.id,
550
+ args.props,
551
+ args.uniqueConstraints
552
+ );
553
+ await Promise.all([
554
+ syncEmbeddings(
555
+ nodeSyncContext(ctx, args.kind, args.id, backend),
556
+ args.schema,
557
+ args.props
558
+ ),
559
+ syncFulltext(
560
+ nodeSyncContext(ctx, args.kind, args.id, backend),
561
+ args.schema,
562
+ args.props
563
+ )
564
+ ]);
565
+ }
566
+ async function applyNodeInsertSideEffectsBatch(ctx, items, backend) {
567
+ if (items.length === 0) return;
568
+ await insertUniquenessEntriesBatch(
569
+ uniquenessContext(ctx, backend),
570
+ items.map((item) => ({
571
+ kind: item.kind,
572
+ id: item.id,
573
+ props: item.props,
574
+ constraints: item.uniqueConstraints
575
+ }))
576
+ );
577
+ const byKind = /* @__PURE__ */ new Map();
578
+ for (const item of items) {
579
+ const group = byKind.get(item.kind) ?? { schema: item.schema, rows: [] };
580
+ group.rows.push({ nodeId: item.id, props: item.props });
581
+ byKind.set(item.kind, group);
582
+ }
583
+ await Promise.all(
584
+ [...byKind.entries()].flatMap(([kind, group]) => {
585
+ const syncArguments = { graphId: ctx.graphId, nodeKind: kind, backend };
586
+ return [
587
+ syncEmbeddingsBatchForKind(syncArguments, group.schema, group.rows),
588
+ syncFulltextBatchForKind(syncArguments, group.schema, group.rows)
589
+ ];
590
+ })
591
+ );
592
+ }
593
+ function parseRowProps(row) {
594
+ return chunkXBYVV3MP_cjs.rowPropsToObject(row.props);
595
+ }
596
+ async function planNodeUpdateUniqueness(ctx, args, backend) {
597
+ const { kind, id } = args.existing;
598
+ if (args.existing.deleted_at !== void 0) {
599
+ return planUniquenessReinsert(
600
+ uniquenessContext(ctx, backend),
601
+ kind,
602
+ id,
603
+ args.validatedProps,
604
+ args.uniqueConstraints
605
+ );
606
+ }
607
+ return planUniquenessUpdate(
608
+ uniquenessContext(ctx, backend),
609
+ kind,
610
+ id,
611
+ parseRowProps(args.existing),
612
+ args.validatedProps,
613
+ args.uniqueConstraints
614
+ );
615
+ }
616
+ async function applyNodeUpdate(ctx, args, backend) {
617
+ const { kind, id } = args.existing;
618
+ const plan = await planNodeUpdateUniqueness(
619
+ ctx,
620
+ {
621
+ existing: args.existing,
622
+ validatedProps: args.validatedProps,
623
+ uniqueConstraints: args.uniqueConstraints
624
+ },
625
+ backend
626
+ );
627
+ const updateParams = {
628
+ graphId: ctx.graphId,
629
+ kind,
630
+ id,
631
+ props: args.validatedProps,
632
+ incrementVersion: true
633
+ };
634
+ if (args.validFrom !== void 0) updateParams.validFrom = args.validFrom;
635
+ if (args.validTo !== void 0) updateParams.validTo = args.validTo;
636
+ if (args.expectedValidFrom !== void 0) {
637
+ updateParams.expectedValidFrom = args.expectedValidFrom;
638
+ }
639
+ if (args.clearDeleted) updateParams.clearDeleted = true;
640
+ const row = await withUniquenessTransition(
641
+ uniquenessContext(ctx, backend),
642
+ kind,
643
+ id,
644
+ plan,
645
+ () => backend.updateNode(updateParams)
646
+ );
647
+ await Promise.all([
648
+ syncEmbeddings(
649
+ nodeSyncContext(ctx, kind, id, backend),
650
+ args.schema,
651
+ args.validatedProps
652
+ ),
653
+ syncFulltext(
654
+ nodeSyncContext(ctx, kind, id, backend),
655
+ args.schema,
656
+ args.validatedProps
657
+ )
658
+ ]);
659
+ return row;
660
+ }
661
+ async function applyNodeSoftDelete(ctx, args, backend, policy) {
662
+ const { kind, id } = args.existing;
663
+ await enforceNodeDeleteBehavior(
664
+ ctx,
665
+ { kind, id, mode: "soft", onDelete: args.onDelete },
666
+ backend,
667
+ policy
668
+ );
669
+ await backend.deleteNode({
670
+ graphId: ctx.graphId,
671
+ kind,
672
+ id
673
+ });
674
+ await deleteUniquenessEntries(
675
+ uniquenessContext(ctx, backend),
676
+ kind,
677
+ parseRowProps(args.existing),
678
+ args.uniqueConstraints
679
+ );
680
+ await deleteNodeEmbeddings(
681
+ nodeSyncContext(ctx, kind, id, backend),
682
+ args.schema
683
+ );
684
+ await deleteNodeFulltext(
685
+ nodeSyncContext(ctx, kind, id, backend),
686
+ args.schema
687
+ );
688
+ }
689
+ async function applyNodeHardDelete(ctx, args, backend) {
690
+ await enforceNodeDeleteBehavior(
691
+ ctx,
692
+ { kind: args.kind, id: args.id, mode: "hard", onDelete: args.onDelete },
693
+ backend
694
+ );
695
+ await backend.hardDeleteNode({
696
+ graphId: ctx.graphId,
697
+ kind: args.kind,
698
+ id: args.id
699
+ });
700
+ await deleteNodeEmbeddings(
701
+ nodeSyncContext(ctx, args.kind, args.id, backend),
702
+ args.schema
703
+ );
704
+ }
705
+ async function applyNodeResurrect(ctx, args, backend) {
706
+ const { kind, id } = args.existing;
707
+ const props = parseRowProps(args.existing);
708
+ const plan = await planUniquenessReinsert(
709
+ uniquenessContext(ctx, backend),
710
+ kind,
711
+ id,
712
+ props,
713
+ args.uniqueConstraints
714
+ );
715
+ const row = await withUniquenessTransition(
716
+ uniquenessContext(ctx, backend),
717
+ kind,
718
+ id,
719
+ plan,
720
+ () => backend.updateNode({
721
+ graphId: ctx.graphId,
722
+ kind,
723
+ id,
724
+ props,
725
+ incrementVersion: true,
726
+ clearDeleted: true
727
+ })
728
+ );
729
+ await Promise.all([
730
+ syncEmbeddings(nodeSyncContext(ctx, kind, id, backend), args.schema, props),
731
+ syncFulltext(nodeSyncContext(ctx, kind, id, backend), args.schema, props)
732
+ ]);
733
+ return row;
734
+ }
735
+
736
+ exports.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD = AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
737
+ exports.STORE_RUNTIME = STORE_RUNTIME;
738
+ exports.TRANSACTION_RUNTIME = TRANSACTION_RUNTIME;
739
+ exports.applyNodeHardDelete = applyNodeHardDelete;
740
+ exports.applyNodeInsertSideEffects = applyNodeInsertSideEffects;
741
+ exports.applyNodeInsertSideEffectsBatch = applyNodeInsertSideEffectsBatch;
742
+ exports.applyNodeResurrect = applyNodeResurrect;
743
+ exports.applyNodeSoftDelete = applyNodeSoftDelete;
744
+ exports.applyNodeUpdate = applyNodeUpdate;
745
+ exports.checkUniquenessConstraints = checkUniquenessConstraints;
746
+ exports.computeFulltextContent = computeFulltextContent;
747
+ exports.createNodeWriteContext = createNodeWriteContext;
748
+ exports.createUniquenessContext = createUniquenessContext;
749
+ exports.getEmbeddingFields = getEmbeddingFields;
750
+ exports.storeBackend = storeBackend;
751
+ exports.storeRuntime = storeRuntime;
752
+ exports.transactionBackend = transactionBackend;
753
+ exports.transactionNodeOperationHookRunner = transactionNodeOperationHookRunner;
754
+ //# sourceMappingURL=chunk-Q3G6A4I3.cjs.map
755
+ //# sourceMappingURL=chunk-Q3G6A4I3.cjs.map