@nicia-ai/typegraph 0.49.0 → 0.50.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 (327) 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 +56 -52
  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 +34 -28
  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 +17 -15
  13. package/dist/backend/postgres/pglite-store.cjs +36 -35
  14. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  15. package/dist/backend/postgres/pglite-store.d.cts +8 -8
  16. package/dist/backend/postgres/pglite-store.d.ts +8 -8
  17. package/dist/backend/postgres/pglite-store.js +32 -31
  18. package/dist/backend/postgres/pglite-store.js.map +1 -1
  19. package/dist/backend/postgres/pglite.cjs +19 -17
  20. package/dist/backend/postgres/pglite.d.cts +3 -3
  21. package/dist/backend/postgres/pglite.d.ts +3 -3
  22. package/dist/backend/postgres/pglite.js +18 -16
  23. package/dist/backend/sqlite/index.cjs +31 -25
  24. package/dist/backend/sqlite/index.d.cts +7 -7
  25. package/dist/backend/sqlite/index.d.ts +7 -7
  26. package/dist/backend/sqlite/index.js +15 -13
  27. package/dist/backend/sqlite/libsql.cjs +22 -20
  28. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  29. package/dist/backend/sqlite/libsql.d.cts +3 -3
  30. package/dist/backend/sqlite/libsql.d.ts +3 -3
  31. package/dist/backend/sqlite/libsql.js +17 -15
  32. package/dist/backend/sqlite/libsql.js.map +1 -1
  33. package/dist/backend/sqlite/local-store.cjs +37 -36
  34. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  35. package/dist/backend/sqlite/local-store.d.cts +8 -8
  36. package/dist/backend/sqlite/local-store.d.ts +8 -8
  37. package/dist/backend/sqlite/local-store.js +33 -32
  38. package/dist/backend/sqlite/local-store.js.map +1 -1
  39. package/dist/backend/sqlite/local.cjs +20 -18
  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 +18 -16
  43. package/dist/{chunk-LTXQOEIC.js → chunk-2CYI5HRH.js} +248 -203
  44. package/dist/chunk-2CYI5HRH.js.map +1 -0
  45. package/dist/{chunk-KF6K7TGH.js → chunk-2GIV5X4P.js} +702 -422
  46. package/dist/chunk-2GIV5X4P.js.map +1 -0
  47. package/dist/{chunk-2TYSSBU5.js → chunk-2Q45FAIE.js} +15 -15
  48. package/dist/{chunk-2TYSSBU5.js.map → chunk-2Q45FAIE.js.map} +1 -1
  49. package/dist/{chunk-WODMN3Q2.cjs → chunk-45YZXI6X.cjs} +27 -27
  50. package/dist/{chunk-WODMN3Q2.cjs.map → chunk-45YZXI6X.cjs.map} +1 -1
  51. package/dist/{chunk-3DMMGT6S.js → chunk-46UGOVRW.js} +3 -3
  52. package/dist/{chunk-3DMMGT6S.js.map → chunk-46UGOVRW.js.map} +1 -1
  53. package/dist/{chunk-GLHXM7C4.js → chunk-5LKOVCPP.js} +60 -23
  54. package/dist/chunk-5LKOVCPP.js.map +1 -0
  55. package/dist/{chunk-JFRT7S3B.cjs → chunk-5OWHU7Z7.cjs} +261 -459
  56. package/dist/chunk-5OWHU7Z7.cjs.map +1 -0
  57. package/dist/{chunk-7SQSZN2J.js → chunk-5PP4KRPV.js} +5 -5
  58. package/dist/{chunk-7SQSZN2J.js.map → chunk-5PP4KRPV.js.map} +1 -1
  59. package/dist/chunk-6KQEICJ6.cjs +12 -0
  60. package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
  61. package/dist/{chunk-6SWPJEYN.js → chunk-6LEOAIIB.js} +40 -6
  62. package/dist/chunk-6LEOAIIB.js.map +1 -0
  63. package/dist/{chunk-DZAICA5J.js → chunk-6NKSE5AU.js} +4 -4
  64. package/dist/{chunk-DZAICA5J.js.map → chunk-6NKSE5AU.js.map} +1 -1
  65. package/dist/{chunk-OVI7IXYX.js → chunk-6S3PTHL4.js} +3 -3
  66. package/dist/{chunk-OVI7IXYX.js.map → chunk-6S3PTHL4.js.map} +1 -1
  67. package/dist/{chunk-3FPR224C.cjs → chunk-7CCMCMJO.cjs} +102 -102
  68. package/dist/{chunk-3FPR224C.cjs.map → chunk-7CCMCMJO.cjs.map} +1 -1
  69. package/dist/{chunk-SHFBB23Q.js → chunk-7OWE7WD6.js} +6 -4
  70. package/dist/chunk-7OWE7WD6.js.map +1 -0
  71. package/dist/chunk-7PRMDZIA.cjs +182 -0
  72. package/dist/chunk-7PRMDZIA.cjs.map +1 -0
  73. package/dist/{chunk-CHAOFCHV.js → chunk-AH2A74OZ.js} +3 -3
  74. package/dist/{chunk-CHAOFCHV.js.map → chunk-AH2A74OZ.js.map} +1 -1
  75. package/dist/{chunk-OORXGFL5.cjs → chunk-BYBDM423.cjs} +48 -48
  76. package/dist/{chunk-OORXGFL5.cjs.map → chunk-BYBDM423.cjs.map} +1 -1
  77. package/dist/{chunk-JB6T4GLL.cjs → chunk-C76WFIVZ.cjs} +808 -519
  78. package/dist/chunk-C76WFIVZ.cjs.map +1 -0
  79. package/dist/{chunk-3G5W2U2L.cjs → chunk-CS6JTQQ2.cjs} +302 -257
  80. package/dist/chunk-CS6JTQQ2.cjs.map +1 -0
  81. package/dist/{chunk-AOSSQDVO.cjs → chunk-CSNOYIB4.cjs} +13 -13
  82. package/dist/{chunk-AOSSQDVO.cjs.map → chunk-CSNOYIB4.cjs.map} +1 -1
  83. package/dist/{chunk-HEV35TGT.js → chunk-DI6VC62F.js} +13 -4
  84. package/dist/chunk-DI6VC62F.js.map +1 -0
  85. package/dist/{chunk-2QGYQBS2.cjs → chunk-DWUDZ66O.cjs} +10 -10
  86. package/dist/{chunk-2QGYQBS2.cjs.map → chunk-DWUDZ66O.cjs.map} +1 -1
  87. package/dist/{chunk-ZDKTPBGV.js → chunk-EDLKIQRI.js} +4 -4
  88. package/dist/{chunk-ZDKTPBGV.js.map → chunk-EDLKIQRI.js.map} +1 -1
  89. package/dist/chunk-EH3JZJUM.cjs +567 -0
  90. package/dist/chunk-EH3JZJUM.cjs.map +1 -0
  91. package/dist/{chunk-S5TERQVW.js → chunk-FX5ZW6PN.js} +196 -33
  92. package/dist/chunk-FX5ZW6PN.js.map +1 -0
  93. package/dist/{chunk-XVWOYKIK.js → chunk-FZHF5UWR.js} +3 -3
  94. package/dist/{chunk-XVWOYKIK.js.map → chunk-FZHF5UWR.js.map} +1 -1
  95. package/dist/{chunk-BFUOME67.cjs → chunk-G2TLHH6T.cjs} +20 -11
  96. package/dist/chunk-G2TLHH6T.cjs.map +1 -0
  97. package/dist/{chunk-5PRKMB24.cjs → chunk-GHZPZNFC.cjs} +12 -4
  98. package/dist/chunk-GHZPZNFC.cjs.map +1 -0
  99. package/dist/{chunk-ZFMCDJGB.js → chunk-GVYVGGPJ.js} +11 -199
  100. package/dist/chunk-GVYVGGPJ.js.map +1 -0
  101. package/dist/{chunk-SDBBMD4N.js → chunk-H3XP6BAV.js} +3 -3
  102. package/dist/{chunk-SDBBMD4N.js.map → chunk-H3XP6BAV.js.map} +1 -1
  103. package/dist/{chunk-ROR5ZR6A.cjs → chunk-HSEZ7X6Y.cjs} +45 -45
  104. package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-HSEZ7X6Y.cjs.map} +1 -1
  105. package/dist/{chunk-LRQKXRXO.cjs → chunk-HY5BNOUN.cjs} +4 -4
  106. package/dist/{chunk-LRQKXRXO.cjs.map → chunk-HY5BNOUN.cjs.map} +1 -1
  107. package/dist/chunk-HZUB5CON.js +27 -0
  108. package/dist/chunk-HZUB5CON.js.map +1 -0
  109. package/dist/{chunk-MYKHJI2J.js → chunk-I5C6OTKR.js} +3 -3
  110. package/dist/{chunk-MYKHJI2J.js.map → chunk-I5C6OTKR.js.map} +1 -1
  111. package/dist/{chunk-3U5ABFDW.cjs → chunk-IHK5KA2Q.cjs} +31 -28
  112. package/dist/chunk-IHK5KA2Q.cjs.map +1 -0
  113. package/dist/{chunk-26YKDNUD.cjs → chunk-IPRP6TDL.cjs} +12 -10
  114. package/dist/chunk-IPRP6TDL.cjs.map +1 -0
  115. package/dist/{chunk-UGHG7PGX.js → chunk-IRPYOHRC.js} +26 -4
  116. package/dist/chunk-IRPYOHRC.js.map +1 -0
  117. package/dist/{chunk-7UOLHNWC.cjs → chunk-ISKCIQF2.cjs} +20 -20
  118. package/dist/{chunk-7UOLHNWC.cjs.map → chunk-ISKCIQF2.cjs.map} +1 -1
  119. package/dist/{chunk-7LZJNLA5.js → chunk-JG5XIJDY.js} +57 -31
  120. package/dist/chunk-JG5XIJDY.js.map +1 -0
  121. package/dist/{chunk-YYUHLYM2.cjs → chunk-K2XYLVVB.cjs} +134 -133
  122. package/dist/chunk-K2XYLVVB.cjs.map +1 -0
  123. package/dist/{chunk-5K2BKEBD.js → chunk-K46SDNQD.js} +10 -4
  124. package/dist/chunk-K46SDNQD.js.map +1 -0
  125. package/dist/{chunk-TZEGUG6D.cjs → chunk-K6VKTBST.cjs} +4 -4
  126. package/dist/{chunk-TZEGUG6D.cjs.map → chunk-K6VKTBST.cjs.map} +1 -1
  127. package/dist/chunk-KWNWG4RC.cjs +12 -0
  128. package/dist/{chunk-CICO5GXD.cjs.map → chunk-KWNWG4RC.cjs.map} +1 -1
  129. package/dist/{chunk-FQPEMEWX.cjs → chunk-LLVOQOWE.cjs} +80 -32
  130. package/dist/chunk-LLVOQOWE.cjs.map +1 -0
  131. package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
  132. package/dist/chunk-M5MSP3BI.cjs.map +1 -0
  133. package/dist/{chunk-Z2JCLZFJ.js → chunk-MJPZNEJZ.js} +273 -291
  134. package/dist/chunk-MJPZNEJZ.js.map +1 -0
  135. package/dist/{chunk-TUNPBZY3.cjs → chunk-MM3JHVKZ.cjs} +4 -4
  136. package/dist/{chunk-TUNPBZY3.cjs.map → chunk-MM3JHVKZ.cjs.map} +1 -1
  137. package/dist/{chunk-BRRP76WO.js → chunk-MX7EKQPM.js} +457 -299
  138. package/dist/chunk-MX7EKQPM.js.map +1 -0
  139. package/dist/{chunk-D4QLTJSM.js → chunk-MZ34E2GN.js} +13 -12
  140. package/dist/chunk-MZ34E2GN.js.map +1 -0
  141. package/dist/{chunk-EDN4Y4ZG.cjs → chunk-OJHD3LXJ.cjs} +9 -9
  142. package/dist/{chunk-EDN4Y4ZG.cjs.map → chunk-OJHD3LXJ.cjs.map} +1 -1
  143. package/dist/{chunk-DO7SAMEK.cjs → chunk-ON47CBE4.cjs} +47 -47
  144. package/dist/{chunk-DO7SAMEK.cjs.map → chunk-ON47CBE4.cjs.map} +1 -1
  145. package/dist/{chunk-6LN7FIVU.js → chunk-PALYTHGM.js} +11 -4
  146. package/dist/chunk-PALYTHGM.js.map +1 -0
  147. package/dist/{chunk-YVF2EM7B.js → chunk-R7MRFE5P.js} +3 -3
  148. package/dist/{chunk-YVF2EM7B.js.map → chunk-R7MRFE5P.js.map} +1 -1
  149. package/dist/{chunk-EZEEWCFJ.cjs → chunk-RDP6ZRSM.cjs} +435 -265
  150. package/dist/chunk-RDP6ZRSM.cjs.map +1 -0
  151. package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
  152. package/dist/chunk-RJMHU2MG.cjs.map +1 -0
  153. package/dist/chunk-RWUWTJQY.cjs +30 -0
  154. package/dist/chunk-RWUWTJQY.cjs.map +1 -0
  155. package/dist/{chunk-JPD2CTC3.js → chunk-S33YQEL7.js} +7 -7
  156. package/dist/{chunk-JPD2CTC3.js.map → chunk-S33YQEL7.js.map} +1 -1
  157. package/dist/chunk-S3SDEQMC.js +532 -0
  158. package/dist/chunk-S3SDEQMC.js.map +1 -0
  159. package/dist/{chunk-OI2GQ25X.cjs → chunk-SHC7BCG5.cjs} +7 -7
  160. package/dist/{chunk-OI2GQ25X.cjs.map → chunk-SHC7BCG5.cjs.map} +1 -1
  161. package/dist/{chunk-L3LQNR34.cjs → chunk-TEC24ZDA.cjs} +161 -161
  162. package/dist/{chunk-L3LQNR34.cjs.map → chunk-TEC24ZDA.cjs.map} +1 -1
  163. package/dist/{chunk-HDL2ARHX.cjs → chunk-TP4NJTI3.cjs} +63 -27
  164. package/dist/chunk-TP4NJTI3.cjs.map +1 -0
  165. package/dist/{chunk-UMGZDVOA.cjs → chunk-TTCOPKUL.cjs} +124 -124
  166. package/dist/{chunk-UMGZDVOA.cjs.map → chunk-TTCOPKUL.cjs.map} +1 -1
  167. package/dist/chunk-TUVD4DFR.cjs +1207 -0
  168. package/dist/chunk-TUVD4DFR.cjs.map +1 -0
  169. package/dist/{chunk-UGHQV7MP.cjs → chunk-TYGGUWMS.cjs} +178 -152
  170. package/dist/chunk-TYGGUWMS.cjs.map +1 -0
  171. package/dist/{chunk-WIC7DRXW.js → chunk-U3Z7XKAG.js} +7 -7
  172. package/dist/{chunk-WIC7DRXW.js.map → chunk-U3Z7XKAG.js.map} +1 -1
  173. package/dist/{chunk-NACVVDWB.js → chunk-U5EL6JUV.js} +10 -10
  174. package/dist/{chunk-NACVVDWB.js.map → chunk-U5EL6JUV.js.map} +1 -1
  175. package/dist/{chunk-OMZ37BM2.js → chunk-V76FGHY3.js} +5 -5
  176. package/dist/{chunk-OMZ37BM2.js.map → chunk-V76FGHY3.js.map} +1 -1
  177. package/dist/{chunk-6NGW27EO.cjs → chunk-VLBTRXA2.cjs} +10 -10
  178. package/dist/{chunk-6NGW27EO.cjs.map → chunk-VLBTRXA2.cjs.map} +1 -1
  179. package/dist/chunk-VTJVMP4I.js +1182 -0
  180. package/dist/chunk-VTJVMP4I.js.map +1 -0
  181. package/dist/{chunk-QTD6HX4O.js → chunk-W5SOCUBL.js} +5 -5
  182. package/dist/{chunk-QTD6HX4O.js.map → chunk-W5SOCUBL.js.map} +1 -1
  183. package/dist/{chunk-SR725PWF.cjs → chunk-WCLMKNQE.cjs} +1750 -1592
  184. package/dist/chunk-WCLMKNQE.cjs.map +1 -0
  185. package/dist/{chunk-2O4PCIZ6.cjs → chunk-WK23PGTP.cjs} +13 -13
  186. package/dist/{chunk-2O4PCIZ6.cjs.map → chunk-WK23PGTP.cjs.map} +1 -1
  187. package/dist/{chunk-KKBDXCLQ.js → chunk-WQBAQZHR.js} +4 -4
  188. package/dist/{chunk-KKBDXCLQ.js.map → chunk-WQBAQZHR.js.map} +1 -1
  189. package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
  190. package/dist/chunk-X4GDXBOP.cjs.map +1 -0
  191. package/dist/{chunk-3QNZ5SAJ.cjs → chunk-XMY2SXOH.cjs} +437 -455
  192. package/dist/chunk-XMY2SXOH.cjs.map +1 -0
  193. package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
  194. package/dist/chunk-XZW2CTNO.js.map +1 -0
  195. package/dist/{chunk-NVY5CJFP.js → chunk-Y55DLLEG.js} +9 -6
  196. package/dist/chunk-Y55DLLEG.js.map +1 -0
  197. package/dist/chunk-YA36ABIL.js +174 -0
  198. package/dist/chunk-YA36ABIL.js.map +1 -0
  199. package/dist/{chunk-ZLONH2UD.js → chunk-YDEJQWOL.js} +2 -2
  200. package/dist/chunk-YDEJQWOL.js.map +1 -0
  201. package/dist/{chunk-JONXFAPO.js → chunk-ZAQUKCUC.js} +5 -5
  202. package/dist/{chunk-JONXFAPO.js.map → chunk-ZAQUKCUC.js.map} +1 -1
  203. package/dist/{chunk-SIT26LAZ.cjs → chunk-ZBFZGLZE.cjs} +29 -5
  204. package/dist/chunk-ZBFZGLZE.cjs.map +1 -0
  205. package/dist/{chunk-P6YLZTRE.js → chunk-ZRJTM7MT.js} +3 -3
  206. package/dist/{chunk-P6YLZTRE.js.map → chunk-ZRJTM7MT.js.map} +1 -1
  207. package/dist/core/index.cjs +29 -28
  208. package/dist/core/index.d.cts +4 -4
  209. package/dist/core/index.d.ts +4 -4
  210. package/dist/core/index.js +9 -8
  211. package/dist/{ddl-D_oW-EVO.d.ts → ddl-B49O7dB_.d.ts} +3 -3
  212. package/dist/{ddl-BL1NZLMY.d.cts → ddl-DcZG660s.d.cts} +3 -3
  213. package/dist/graph-extension/index.cjs +21 -20
  214. package/dist/graph-extension/index.d.cts +4 -4
  215. package/dist/graph-extension/index.d.ts +4 -4
  216. package/dist/graph-extension/index.js +5 -4
  217. package/dist/graph-merge/index.cjs +305 -303
  218. package/dist/graph-merge/index.cjs.map +1 -1
  219. package/dist/graph-merge/index.d.cts +9 -9
  220. package/dist/graph-merge/index.d.ts +9 -9
  221. package/dist/graph-merge/index.js +29 -27
  222. package/dist/graph-merge/index.js.map +1 -1
  223. package/dist/{index-D7d1u2gr.d.ts → index-B0PrmE3K.d.cts} +16 -2
  224. package/dist/{index-COs_z6nV.d.cts → index-CwcXsL5R.d.ts} +16 -2
  225. package/dist/index.cjs +223 -222
  226. package/dist/index.cjs.map +1 -1
  227. package/dist/index.d.cts +12 -12
  228. package/dist/index.d.ts +12 -12
  229. package/dist/index.js +37 -36
  230. package/dist/index.js.map +1 -1
  231. package/dist/indexes/index.cjs +13 -13
  232. package/dist/indexes/index.d.cts +4 -4
  233. package/dist/indexes/index.d.ts +4 -4
  234. package/dist/indexes/index.js +6 -6
  235. package/dist/{ingestion-import-target-dNeL7iAv.d.ts → ingestion-import-target-CI8OWIkM.d.ts} +1 -1
  236. package/dist/{ingestion-import-target-XPxZYw89.d.cts → ingestion-import-target-DCpfM1PX.d.cts} +1 -1
  237. package/dist/interchange/index.cjs +55 -54
  238. package/dist/interchange/index.cjs.map +1 -1
  239. package/dist/interchange/index.d.cts +19 -8
  240. package/dist/interchange/index.d.ts +19 -8
  241. package/dist/interchange/index.js +19 -18
  242. package/dist/interchange/index.js.map +1 -1
  243. package/dist/{manager-D9eRT_ns.d.ts → manager-Cfg1ENj1.d.ts} +30 -2
  244. package/dist/{manager-CYaff3n3.d.cts → manager-D348fa6W.d.cts} +30 -2
  245. package/dist/{materialize-indexes-DJ3ykH59.d.ts → materialize-indexes-C9GG3O3C.d.ts} +1 -1
  246. package/dist/{materialize-indexes-DTtAnvfY.d.cts → materialize-indexes-CrSiW_lT.d.cts} +1 -1
  247. package/dist/{postgres-CcL4bAHS.d.ts → postgres-CH1kkM5J.d.cts} +279 -2
  248. package/dist/{postgres-DMj39MEu.d.cts → postgres-UStOycLI.d.ts} +279 -2
  249. package/dist/profiler/index.d.cts +9 -9
  250. package/dist/profiler/index.d.ts +9 -9
  251. package/dist/provenance/index.cjs +46 -44
  252. package/dist/provenance/index.cjs.map +1 -1
  253. package/dist/provenance/index.d.cts +7 -7
  254. package/dist/provenance/index.d.ts +7 -7
  255. package/dist/provenance/index.js +12 -10
  256. package/dist/provenance/index.js.map +1 -1
  257. package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-BtOEe2pS.d.ts} +2 -2
  258. package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-aWX7VNvv.d.cts} +2 -2
  259. package/dist/schema/index.cjs +46 -46
  260. package/dist/schema/index.d.cts +6 -6
  261. package/dist/schema/index.d.ts +6 -6
  262. package/dist/schema/index.js +19 -19
  263. package/dist/{searchable-DHJMh_nj.d.cts → searchable-C8-RrL3l.d.cts} +1 -1
  264. package/dist/{searchable-bpE1bBfc.d.ts → searchable-z4BiFfHI.d.ts} +1 -1
  265. package/dist/{sqlite-YppHrNFb.d.cts → sqlite-Cyx9j9o6.d.cts} +309 -2
  266. package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-axLw5Lo5.d.ts} +309 -2
  267. package/dist/{store-bphCSo7z.d.cts → store-CTfQ9taw.d.ts} +102 -13
  268. package/dist/{store-DRrFCx5x.d.ts → store-DR9J7JVB.d.cts} +102 -13
  269. package/dist/{temporal-5GqpYCk2.d.cts → temporal-B4Ky4wzh.d.cts} +1 -1
  270. package/dist/{temporal-CbnLzTmM.d.ts → temporal-CBOrERz5.d.ts} +1 -1
  271. package/dist/{types-CXAhpW-c.d.cts → types-BE921wRl.d.cts} +1 -1
  272. package/dist/{types-Bx74kaTt.d.ts → types-BScHXVM7.d.ts} +1 -1
  273. package/dist/{types-BqFZTQmV.d.cts → types-CWg4dTjj.d.cts} +257 -6
  274. package/dist/{types-BqFZTQmV.d.ts → types-CWg4dTjj.d.ts} +257 -6
  275. package/dist/{where-O-k2wgYm.d.ts → where-BWXUPV3C.d.ts} +1 -1
  276. package/dist/{where-DI_Fqz-X.d.cts → where-CNtx1aLc.d.cts} +1 -1
  277. package/package.json +3 -2
  278. package/dist/chunk-26YKDNUD.cjs.map +0 -1
  279. package/dist/chunk-3G5W2U2L.cjs.map +0 -1
  280. package/dist/chunk-3KOY4FH3.cjs +0 -934
  281. package/dist/chunk-3KOY4FH3.cjs.map +0 -1
  282. package/dist/chunk-3QNZ5SAJ.cjs.map +0 -1
  283. package/dist/chunk-3U5ABFDW.cjs.map +0 -1
  284. package/dist/chunk-5K2BKEBD.js.map +0 -1
  285. package/dist/chunk-5PRKMB24.cjs.map +0 -1
  286. package/dist/chunk-6LN7FIVU.js.map +0 -1
  287. package/dist/chunk-6SWPJEYN.js.map +0 -1
  288. package/dist/chunk-7LZJNLA5.js.map +0 -1
  289. package/dist/chunk-BFUOME67.cjs.map +0 -1
  290. package/dist/chunk-BRRP76WO.js.map +0 -1
  291. package/dist/chunk-CICO5GXD.cjs +0 -12
  292. package/dist/chunk-D4QLTJSM.js.map +0 -1
  293. package/dist/chunk-D5R42W5D.js.map +0 -1
  294. package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
  295. package/dist/chunk-FA2AFWLP.cjs +0 -167
  296. package/dist/chunk-FA2AFWLP.cjs.map +0 -1
  297. package/dist/chunk-FQPEMEWX.cjs.map +0 -1
  298. package/dist/chunk-GLHXM7C4.js.map +0 -1
  299. package/dist/chunk-GYEG3ZLZ.cjs.map +0 -1
  300. package/dist/chunk-HDL2ARHX.cjs.map +0 -1
  301. package/dist/chunk-HEV35TGT.js.map +0 -1
  302. package/dist/chunk-I4GAZH5Z.js +0 -913
  303. package/dist/chunk-I4GAZH5Z.js.map +0 -1
  304. package/dist/chunk-JB6T4GLL.cjs.map +0 -1
  305. package/dist/chunk-JBQQ7THH.js +0 -20
  306. package/dist/chunk-JBQQ7THH.js.map +0 -1
  307. package/dist/chunk-JFRT7S3B.cjs.map +0 -1
  308. package/dist/chunk-KF6K7TGH.js.map +0 -1
  309. package/dist/chunk-LTXQOEIC.js.map +0 -1
  310. package/dist/chunk-MKJ4KXL5.cjs +0 -12
  311. package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
  312. package/dist/chunk-NVY5CJFP.js.map +0 -1
  313. package/dist/chunk-PWLJ77UV.cjs +0 -23
  314. package/dist/chunk-PWLJ77UV.cjs.map +0 -1
  315. package/dist/chunk-S5TERQVW.js.map +0 -1
  316. package/dist/chunk-SHFBB23Q.js.map +0 -1
  317. package/dist/chunk-SIT26LAZ.cjs.map +0 -1
  318. package/dist/chunk-SR725PWF.cjs.map +0 -1
  319. package/dist/chunk-TQHGE7UC.cjs.map +0 -1
  320. package/dist/chunk-UGHG7PGX.js.map +0 -1
  321. package/dist/chunk-UGHQV7MP.cjs.map +0 -1
  322. package/dist/chunk-YIURNGXI.js +0 -155
  323. package/dist/chunk-YIURNGXI.js.map +0 -1
  324. package/dist/chunk-YYUHLYM2.cjs.map +0 -1
  325. package/dist/chunk-Z2JCLZFJ.js.map +0 -1
  326. package/dist/chunk-ZFMCDJGB.js.map +0 -1
  327. package/dist/chunk-ZLONH2UD.js.map +0 -1
@@ -1,13 +1,14 @@
1
- import { createNodeBatchValidationBackend, primeBatchValidationCaches } from './chunk-KF6K7TGH.js';
2
- import { storeBackend, storeRuntime, applyNodeInsertSideEffectsBatch, applyNodeUpdate, checkUniquenessConstraints, applyNodeInsertSideEffects } from './chunk-I4GAZH5Z.js';
3
- import { runInWriteTransaction, IDENTITY_IMPORT_PROGRESS, IDENTITY_IMPORT_FAILED_ASSERTION } from './chunk-ZFMCDJGB.js';
4
- import { encodeTupleKey } from './chunk-S5TERQVW.js';
5
- import { acquireSerializedStreamLease, snapshotExportContention } from './chunk-UGHG7PGX.js';
6
- import { isLiveNodeRow, rowPropsToObject } from './chunk-6LN7FIVU.js';
7
- import { getNodeKinds, getEdgeKinds } from './chunk-HEV35TGT.js';
8
- import { validateEdgeEndpoints } from './chunk-GLHXM7C4.js';
9
- import { isCanonicalIsoDate, nowIso, assertWritableValidityWindow, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow } from './chunk-5K2BKEBD.js';
10
- import { ConfigurationError, ValidationError, ExportStreamCancelledError, ExportStreamIdleTimeoutError, NodeNotFoundError, IdentityContradictionError, DatabaseOperationError, UniquenessError, INVERTED_VALIDITY_WINDOW_CODE, IMMUTABLE_VALIDITY_LOWER_BOUND_CODE } from './chunk-ZLONH2UD.js';
1
+ import { graphOwesClaims, runWritePlan, mixedWritePlan, createNodeBatchValidationSeams, primeBatchValidationCaches, createEdgeBatchValidationBackend, checkDisjointnessConstraint, checkCardinalityConstraint } from './chunk-2GIV5X4P.js';
2
+ import { storeBackend, storeRuntime, checkUniquenessConstraints } from './chunk-VTJVMP4I.js';
3
+ import { edgeCardinalityClaim } from './chunk-YA36ABIL.js';
4
+ import { IDENTITY_IMPORT_PROGRESS, IDENTITY_IMPORT_FAILED_ASSERTION } from './chunk-GVYVGGPJ.js';
5
+ import { constraintFenceRefusal } from './chunk-FX5ZW6PN.js';
6
+ import { acquireSerializedStreamLease, snapshotExportContention } from './chunk-IRPYOHRC.js';
7
+ import { isLiveNodeRow, rowPropsToObject } from './chunk-PALYTHGM.js';
8
+ import { getNodeKinds, getEdgeKinds } from './chunk-DI6VC62F.js';
9
+ import { encodeTupleKey, validateEdgeEndpoints } from './chunk-5LKOVCPP.js';
10
+ import { isCanonicalIsoDate, nowIso, assertWritableValidityWindow, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow } from './chunk-K46SDNQD.js';
11
+ import { ConfigurationError, ValidationError, ExportStreamCancelledError, ExportStreamIdleTimeoutError, NodeNotFoundError, IdentityContradictionError, DatabaseOperationError, UniquenessError, DisjointError, CardinalityError, INVERTED_VALIDITY_WINDOW_CODE, IMMUTABLE_VALIDITY_LOWER_BOUND_CODE } from './chunk-YDEJQWOL.js';
11
12
  import { requireDefined, createDataKeyedBag, hasOwnKey } from './chunk-DYATYRY4.js';
12
13
  import { z } from 'zod';
13
14
 
@@ -308,22 +309,34 @@ async function importGraphData(store, data, options) {
308
309
  const backend = storeBackend(store);
309
310
  const runtime = storeRuntime(store);
310
311
  const registry = store.registry;
312
+ const owedClaimReason = graphOwesClaims(graph, registry);
313
+ const claimRefusal = owedClaimReason === void 0 ? void 0 : constraintFenceRefusal({ graphId }, backend, owedClaimReason);
314
+ if (claimRefusal !== void 0) throw claimRefusal;
311
315
  const nodeSchemas = buildNodeSchemaMap(graph);
312
316
  const edgeSchemas = buildEdgeSchemaMap(graph);
313
317
  const importedNodeIds = /* @__PURE__ */ new Set();
314
- await runInWriteTransaction(
318
+ await runWritePlan(
315
319
  {
316
320
  graphId,
321
+ registry,
317
322
  schemaVersion: store.introspect().schemaVersion,
318
323
  historyEnabled: store.historyEnabled,
319
324
  revisionTrackingEnabled: store.revisionTrackingEnabled,
320
- revisionSchema: store.revisionSchema
325
+ revisionSchema: store.revisionSchema,
326
+ // HOW this caller takes position 3. `lockIdentityImportTarget` is
327
+ // `lockIdentityGraph` on an identity graph and a no-op otherwise, so the
328
+ // participation below is unconditional and the acquirer owns the
329
+ // "identity is configured" test, exactly as before the migration.
330
+ identityLock: (target) => runtime.lockIdentityImportTarget(target)
321
331
  },
332
+ // An import writes node rows AND edge rows in one frame, so it declares the
333
+ // mixed family explicitly instead of receiving either narrower session.
334
+ mixedWritePlan(void 0, true),
322
335
  backend,
323
- async (target, lock) => {
324
- await runtime.lockIdentityImportTarget(target);
336
+ async (session, target, overlaidSession) => {
337
+ const frame = { session, target, overlaidSession };
325
338
  await processNodes(
326
- target,
339
+ frame,
327
340
  graphId,
328
341
  registry,
329
342
  data.nodes,
@@ -331,8 +344,7 @@ async function importGraphData(store, data, options) {
331
344
  options,
332
345
  result,
333
346
  errors,
334
- importedNodeIds,
335
- lock
347
+ importedNodeIds
336
348
  );
337
349
  await runtime.foldImportedIdentityNodes(
338
350
  target,
@@ -341,7 +353,7 @@ async function importGraphData(store, data, options) {
341
353
  ).map((node) => ({ kind: node.kind, id: node.id }))
342
354
  );
343
355
  await processEdges(
344
- target,
356
+ frame,
345
357
  graphId,
346
358
  registry,
347
359
  data.edges,
@@ -752,12 +764,12 @@ function buildEdgeSchemaMap(graph) {
752
764
  }
753
765
  return map;
754
766
  }
755
- async function processNodes(backend, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds, lock) {
767
+ async function processNodes(frame, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds) {
756
768
  const batchSize = options.batchSize;
757
769
  for (let index = 0; index < nodes.length; index += batchSize) {
758
770
  const batch = nodes.slice(index, index + batchSize);
759
771
  await processNodeSlice(
760
- backend,
772
+ frame,
761
773
  graphId,
762
774
  registry,
763
775
  batch,
@@ -765,8 +777,7 @@ async function processNodes(backend, graphId, registry, nodes, schemas, options,
765
777
  options,
766
778
  result,
767
779
  errors,
768
- importedNodeIds,
769
- lock
780
+ importedNodeIds
770
781
  );
771
782
  }
772
783
  }
@@ -800,7 +811,7 @@ function recordNodeOutcome(node, outcome, result, errors, importedNodeIds) {
800
811
  }
801
812
  }
802
813
  }
803
- async function processNodeSlice(backend, graphId, registry, batch, schemas, options, result, errors, importedNodeIds, lock) {
814
+ async function processNodeSlice(frame, graphId, registry, batch, schemas, options, result, errors, importedNodeIds) {
804
815
  const record = (node, outcome) => {
805
816
  recordNodeOutcome(node, outcome, result, errors, importedNodeIds);
806
817
  };
@@ -859,20 +870,21 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
859
870
  });
860
871
  }
861
872
  const {
862
- backend: validationBackend,
873
+ reads,
874
+ reader: validationBackend,
863
875
  registerPendingNode,
864
876
  registerPendingUniqueEntries,
865
877
  registerAppliedNodeUpdate,
866
878
  seedNodeRow,
867
879
  seedUniqueRow
868
- } = createNodeBatchValidationBackend(graphId, registry, backend);
880
+ } = createNodeBatchValidationSeams(graphId, registry, frame.target);
869
881
  await primeBatchValidationCaches(
870
882
  { graphId, registry },
871
883
  candidates.map((candidate) => candidate.draft),
872
- backend,
884
+ frame.target,
873
885
  { seedNodeRow, seedUniqueRow }
874
886
  );
875
- const writeContext = { graphId, registry, lock };
887
+ const overlaidSession = frame.overlaidSession(reads);
876
888
  const accepted = [];
877
889
  for (const candidate of candidates) {
878
890
  const { node, schemaEntry, props } = candidate;
@@ -911,25 +923,13 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
911
923
  record(node, { status: "error", error: updateWindow.error });
912
924
  break;
913
925
  }
914
- const updateError = await updateImportedNode(
915
- writeContext,
916
- // The pending-aware overlay, not the raw backend: the update's
917
- // uniqueness pre-check must see a unique value already reserved by
918
- // an unflushed create EARLIER in this slice, so it degrades to a
919
- // per-row error exactly as the sequential path does — rather than
920
- // claiming the key on the real backend and colliding with that
921
- // create at flush (which would throw and roll back the whole
922
- // import). Writes still delegate to the real backend.
923
- validationBackend,
924
- node,
925
- {
926
- existing,
927
- schema: schemaEntry.registration.type.schema,
928
- validatedProps: props,
929
- uniqueConstraints,
930
- windowFence: updateWindow.value
931
- }
932
- );
926
+ const updateError = await updateImportedNode(overlaidSession, node, {
927
+ existing,
928
+ schema: schemaEntry.registration.type.schema,
929
+ validatedProps: props,
930
+ uniqueConstraints,
931
+ windowFence: updateWindow.value
932
+ });
933
933
  if (updateError === void 0) {
934
934
  registerAppliedNodeUpdate(
935
935
  node.kind,
@@ -948,44 +948,38 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
948
948
  }
949
949
  continue;
950
950
  }
951
- const uniquenessResult = await catchUniquenessError(
952
- () => checkUniquenessConstraints(
951
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
952
+ await checkUniquenessConstraints(
953
953
  { graphId, registry, backend: validationBackend },
954
954
  node.kind,
955
955
  node.id,
956
956
  props,
957
957
  uniqueConstraints
958
- )
959
- );
960
- if (!uniquenessResult.ok) {
961
- record(node, { status: "error", error: uniquenessResult.error });
958
+ );
959
+ await checkDisjointnessConstraint(
960
+ { graphId, registry, backend: validationBackend },
961
+ node.kind,
962
+ node.id
963
+ );
964
+ });
965
+ if (!constraintResult.ok) {
966
+ record(node, { status: "error", error: constraintResult.error });
962
967
  continue;
963
968
  }
964
- registerPendingNode(buildImportInsertParams(graphId, candidate));
969
+ registerPendingNode(buildImportInsertParams(graphId, node, props));
965
970
  registerPendingUniqueEntries(node.kind, node.id, props, uniqueConstraints);
966
971
  accepted.push(candidate);
967
972
  }
968
973
  if (accepted.length > 0) {
969
- const insertParamsList = accepted.map(
970
- (candidate) => buildImportInsertParams(graphId, candidate)
971
- );
972
- if (backend.insertNodesBatch === void 0) {
973
- for (const params of insertParamsList) {
974
- await backend.insertNode(params);
975
- }
976
- } else {
977
- await backend.insertNodesBatch(insertParamsList);
978
- }
979
- await applyNodeInsertSideEffectsBatch(
980
- writeContext,
981
- accepted.map((candidate) => ({
982
- kind: candidate.node.kind,
983
- id: candidate.node.id,
984
- schema: candidate.schemaEntry.registration.type.schema,
985
- props: candidate.props,
986
- uniqueConstraints: candidate.schemaEntry.registration.unique ?? []
987
- })),
988
- backend
974
+ await frame.session.createNodesNoReturn(
975
+ accepted.map(
976
+ (candidate) => importNodeInsertWork(
977
+ graphId,
978
+ candidate.node,
979
+ candidate.schemaEntry.registration,
980
+ candidate.props
981
+ )
982
+ )
989
983
  );
990
984
  for (const candidate of accepted) {
991
985
  record(candidate.node, { status: "created" });
@@ -994,20 +988,11 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
994
988
  for (const node of deferred) {
995
989
  record(
996
990
  node,
997
- await processNode(
998
- backend,
999
- graphId,
1000
- registry,
1001
- node,
1002
- schemas,
1003
- options,
1004
- lock
1005
- )
991
+ await processNode(frame, graphId, registry, node, schemas, options)
1006
992
  );
1007
993
  }
1008
994
  }
1009
- function buildImportInsertParams(graphId, candidate) {
1010
- const { node, props } = candidate;
995
+ function buildImportInsertParams(graphId, node, props) {
1011
996
  return {
1012
997
  graphId,
1013
998
  kind: node.kind,
@@ -1017,31 +1002,53 @@ function buildImportInsertParams(graphId, candidate) {
1017
1002
  ...node.validTo !== void 0 && { validTo: node.validTo }
1018
1003
  };
1019
1004
  }
1020
- async function catchUniquenessError(fn) {
1005
+ function importNodeInsertWork(graphId, node, registration, props) {
1006
+ return {
1007
+ params: buildImportInsertParams(graphId, node, props),
1008
+ claim: {
1009
+ kind: node.kind,
1010
+ id: node.id,
1011
+ props,
1012
+ constraints: registration.unique ?? []
1013
+ },
1014
+ sideEffects: {
1015
+ kind: node.kind,
1016
+ id: node.id,
1017
+ schema: registration.type.schema,
1018
+ props,
1019
+ uniqueConstraints: registration.unique ?? []
1020
+ }
1021
+ };
1022
+ }
1023
+ async function catchDeclaredConstraintRefusal(fn) {
1021
1024
  try {
1022
1025
  return { ok: true, value: await fn() };
1023
1026
  } catch (error) {
1024
- if (error instanceof UniquenessError) {
1027
+ if (error instanceof UniquenessError || error instanceof DisjointError || error instanceof CardinalityError) {
1025
1028
  return { ok: false, error: error.message };
1026
1029
  }
1027
1030
  throw error;
1028
1031
  }
1029
1032
  }
1030
1033
  var NODE_UPDATE_TARGET_CHANGED_CODE = "INTERCHANGE_NODE_UPDATE_TARGET_CHANGED";
1031
- async function updateImportedNode(writeContext, backend, node, args) {
1034
+ async function updateImportedNode(session, node, args) {
1032
1035
  try {
1033
- const result = await catchUniquenessError(
1034
- () => applyNodeUpdate(
1035
- writeContext,
1036
- {
1037
- existing: args.existing,
1038
- schema: args.schema,
1039
- validatedProps: args.validatedProps,
1040
- uniqueConstraints: args.uniqueConstraints,
1041
- ...args.windowFence,
1042
- ...node.validTo !== void 0 && { validTo: node.validTo }
1043
- },
1044
- backend
1036
+ const result = await catchDeclaredConstraintRefusal(
1037
+ () => (
1038
+ // The fence is an ARGUMENT the method requires, not a spread the call
1039
+ // site may forget: the guard's verdict travels to the statement that
1040
+ // honors it, and an empty fence (`{}`) is the stated decision to assert
1041
+ // nothing rather than an omission.
1042
+ session.reviseNode(
1043
+ {
1044
+ existing: args.existing,
1045
+ schema: args.schema,
1046
+ validatedProps: args.validatedProps,
1047
+ uniqueConstraints: args.uniqueConstraints,
1048
+ ...node.validTo !== void 0 && { validTo: node.validTo }
1049
+ },
1050
+ { validityLowerBound: args.windowFence }
1051
+ )
1045
1052
  )
1046
1053
  );
1047
1054
  return result.ok ? void 0 : result.error;
@@ -1066,20 +1073,29 @@ function edgeIdentityConflict(edge, existing) {
1066
1073
  if (differences.length === 0) return void 0;
1067
1074
  return `${EDGE_IDENTITY_CONFLICT_CODE}: Edge "${edge.id}" already exists with a different immutable identity \u2014 ${differences.join("; ")}. Edge ids are unique per graph, so the incoming edge can neither update nor be created under that id. Give it a distinct id, or import it under the identity the stored row already carries.`;
1068
1075
  }
1069
- async function updateImportedEdge(backend, graphId, edge, props, windowFence) {
1076
+ async function updateImportedEdge(session, edge, props, windowFence) {
1070
1077
  try {
1071
- await backend.updateEdge({
1072
- graphId,
1073
- id: edge.id,
1074
- kind: edge.kind,
1075
- fromKind: edge.from.kind,
1076
- fromId: edge.from.id,
1077
- toKind: edge.to.kind,
1078
- toId: edge.to.id,
1079
- props,
1080
- ...windowFence,
1081
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1082
- });
1078
+ await session.reviseEdge(
1079
+ {
1080
+ id: edge.id,
1081
+ props,
1082
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1083
+ },
1084
+ {
1085
+ validityLowerBound: windowFence,
1086
+ // Import re-admits no row to a counted population — it never resurrects
1087
+ // and never clears an end — so it reads no stored `valid_to` and asserts
1088
+ // none. `{}` is the stated decision, not an omission.
1089
+ validityUpperBound: {},
1090
+ edgeIdentity: {
1091
+ kind: edge.kind,
1092
+ fromKind: edge.from.kind,
1093
+ fromId: edge.from.id,
1094
+ toKind: edge.to.kind,
1095
+ toId: edge.to.id
1096
+ }
1097
+ }
1098
+ );
1083
1099
  return void 0;
1084
1100
  } catch (error) {
1085
1101
  if (!(error instanceof DatabaseOperationError) || error.details.reason !== "no_row_returned") {
@@ -1141,7 +1157,7 @@ function validateUpdateValidityWindow(entity, storedValidFrom) {
1141
1157
  );
1142
1158
  return verdict.ok ? { ok: true, value: verdict.value.storedLowerBoundFence } : verdict;
1143
1159
  }
1144
- async function processNode(backend, graphId, registry, node, schemas, options, lock) {
1160
+ async function processNode(frame, graphId, registry, node, schemas, options) {
1145
1161
  const schemaEntry = schemas.get(node.kind);
1146
1162
  if (!schemaEntry) {
1147
1163
  return { status: "error", error: `Unknown node kind: ${node.kind}` };
@@ -1160,8 +1176,7 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1160
1176
  }
1161
1177
  const { registration } = schemaEntry;
1162
1178
  const uniqueConstraints = registration.unique ?? [];
1163
- const writeContext = { graphId, registry, lock };
1164
- const existing = await backend.getNode(graphId, node.kind, node.id);
1179
+ const existing = await frame.target.getNode(graphId, node.kind, node.id);
1165
1180
  if (existing) {
1166
1181
  switch (options.onConflict) {
1167
1182
  case "skip": {
@@ -1184,18 +1199,13 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1184
1199
  if (!updateWindow.ok) {
1185
1200
  return { status: "error", error: updateWindow.error };
1186
1201
  }
1187
- const updateError = await updateImportedNode(
1188
- writeContext,
1189
- backend,
1190
- node,
1191
- {
1192
- existing,
1193
- schema: registration.type.schema,
1194
- validatedProps: propsResult.data,
1195
- uniqueConstraints,
1196
- windowFence: updateWindow.value
1197
- }
1198
- );
1202
+ const updateError = await updateImportedNode(frame.session, node, {
1203
+ existing,
1204
+ schema: registration.type.schema,
1205
+ validatedProps: propsResult.data,
1206
+ uniqueConstraints,
1207
+ windowFence: updateWindow.value
1208
+ });
1199
1209
  if (updateError !== void 0) {
1200
1210
  return { status: "error", error: updateError };
1201
1211
  }
@@ -1203,45 +1213,34 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1203
1213
  }
1204
1214
  }
1205
1215
  }
1206
- const uniquenessResult = await catchUniquenessError(
1207
- () => checkUniquenessConstraints(
1208
- { graphId, registry, backend },
1216
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
1217
+ await checkUniquenessConstraints(
1218
+ { graphId, registry, backend: frame.target },
1209
1219
  node.kind,
1210
1220
  node.id,
1211
1221
  propsResult.data,
1212
1222
  uniqueConstraints
1213
- )
1214
- );
1215
- if (!uniquenessResult.ok) {
1216
- return { status: "error", error: uniquenessResult.error };
1217
- }
1218
- await backend.insertNode({
1219
- graphId,
1220
- kind: node.kind,
1221
- id: node.id,
1222
- props: propsResult.data,
1223
- ...node.validFrom !== void 0 && { validFrom: node.validFrom },
1224
- ...node.validTo !== void 0 && { validTo: node.validTo }
1223
+ );
1224
+ await checkDisjointnessConstraint(
1225
+ { graphId, registry, backend: frame.target },
1226
+ node.kind,
1227
+ node.id
1228
+ );
1225
1229
  });
1226
- await applyNodeInsertSideEffects(
1227
- writeContext,
1228
- {
1229
- kind: node.kind,
1230
- id: node.id,
1231
- schema: registration.type.schema,
1232
- props: propsResult.data,
1233
- uniqueConstraints
1234
- },
1235
- backend
1230
+ if (!constraintResult.ok) {
1231
+ return { status: "error", error: constraintResult.error };
1232
+ }
1233
+ await frame.session.createNode(
1234
+ importNodeInsertWork(graphId, node, registration, propsResult.data)
1236
1235
  );
1237
1236
  return { status: "created" };
1238
1237
  }
1239
- async function processEdges(backend, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1238
+ async function processEdges(frame, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1240
1239
  const batchSize = options.batchSize;
1241
1240
  for (let index = 0; index < edges.length; index += batchSize) {
1242
1241
  const batch = edges.slice(index, index + batchSize);
1243
1242
  await processEdgeSlice(
1244
- backend,
1243
+ frame,
1245
1244
  graphId,
1246
1245
  registry,
1247
1246
  batch,
@@ -1279,10 +1278,29 @@ function recordEdgeOutcome(edge, outcome, result, errors) {
1279
1278
  }
1280
1279
  }
1281
1280
  }
1282
- async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1281
+ function edgeInsertParamsOf(graphId, candidate) {
1282
+ const { edge, props } = candidate;
1283
+ return {
1284
+ graphId,
1285
+ id: edge.id,
1286
+ kind: edge.kind,
1287
+ fromKind: edge.from.kind,
1288
+ fromId: edge.from.id,
1289
+ toKind: edge.to.kind,
1290
+ toId: edge.to.id,
1291
+ props,
1292
+ ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1293
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1294
+ };
1295
+ }
1296
+ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1283
1297
  const record = (edge, outcome) => {
1284
1298
  recordEdgeOutcome(edge, outcome, result, errors);
1285
1299
  };
1300
+ const {
1301
+ backend: cardinalityValidationBackend,
1302
+ registerPendingEdgeForCardinality
1303
+ } = createEdgeBatchValidationBackend(frame.target);
1286
1304
  const candidates = [];
1287
1305
  const deferred = [];
1288
1306
  const seenIds = /* @__PURE__ */ new Set();
@@ -1343,7 +1361,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1343
1361
  }
1344
1362
  const liveEndpointKeys = /* @__PURE__ */ new Set();
1345
1363
  const checkedEndpointKeys = /* @__PURE__ */ new Set();
1346
- if (options.validateReferences && backend.getNodes !== void 0) {
1364
+ if (options.validateReferences && frame.target.getNodes !== void 0) {
1347
1365
  const idsByKind = /* @__PURE__ */ new Map();
1348
1366
  for (const { edge } of candidates) {
1349
1367
  for (const endpoint of [edge.from, edge.to]) {
@@ -1356,7 +1374,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1356
1374
  }
1357
1375
  }
1358
1376
  for (const [kind, ids] of idsByKind) {
1359
- const rows = await backend.getNodes(graphId, kind, [...ids]);
1377
+ const rows = await frame.target.getNodes(graphId, kind, [...ids]);
1360
1378
  for (const row of rows) {
1361
1379
  if (isLiveNodeRow(row)) {
1362
1380
  liveEndpointKeys.add(makeNodeKey(kind, row.id));
@@ -1368,12 +1386,12 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1368
1386
  const key = makeNodeKey(endpoint.kind, endpoint.id);
1369
1387
  if (importedNodeIds.has(key)) return true;
1370
1388
  if (checkedEndpointKeys.has(key)) return liveEndpointKeys.has(key);
1371
- const row = await backend.getNode(graphId, endpoint.kind, endpoint.id);
1389
+ const row = await frame.target.getNode(graphId, endpoint.kind, endpoint.id);
1372
1390
  return row !== void 0 && isLiveNodeRow(row);
1373
1391
  };
1374
1392
  const existingById = /* @__PURE__ */ new Map();
1375
- if (candidates.length > 0 && backend.getEdges !== void 0) {
1376
- const rows = await backend.getEdges(
1393
+ if (candidates.length > 0 && frame.target.getEdges !== void 0) {
1394
+ const rows = await frame.target.getEdges(
1377
1395
  graphId,
1378
1396
  candidates.map((candidate) => candidate.edge.id)
1379
1397
  );
@@ -1403,7 +1421,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1403
1421
  continue;
1404
1422
  }
1405
1423
  }
1406
- const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await backend.getEdge(graphId, edge.id);
1424
+ const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await frame.target.getEdge(graphId, edge.id);
1407
1425
  if (existing) {
1408
1426
  const identityConflict = edgeIdentityConflict(edge, existing);
1409
1427
  if (identityConflict !== void 0) {
@@ -1439,8 +1457,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1439
1457
  break;
1440
1458
  }
1441
1459
  const updateError = await updateImportedEdge(
1442
- backend,
1443
- graphId,
1460
+ frame.session,
1444
1461
  edge,
1445
1462
  props,
1446
1463
  updateWindow.value
@@ -1455,28 +1472,37 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1455
1472
  }
1456
1473
  continue;
1457
1474
  }
1475
+ const insertParams = edgeInsertParamsOf(graphId, candidate);
1476
+ const cardinality = edgeSchemas.get(edge.kind)?.registration.cardinality ?? "many";
1477
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1478
+ () => checkCardinalityConstraint(
1479
+ { graphId, registry, backend: cardinalityValidationBackend },
1480
+ edge.kind,
1481
+ cardinality,
1482
+ edge.from.kind,
1483
+ edge.from.id,
1484
+ edge.to.kind,
1485
+ edge.to.id,
1486
+ edge.validTo
1487
+ )
1488
+ );
1489
+ if (!cardinalityResult.ok) {
1490
+ record(edge, { status: "error", error: cardinalityResult.error });
1491
+ continue;
1492
+ }
1493
+ registerPendingEdgeForCardinality(insertParams, cardinality);
1458
1494
  accepted.push(candidate);
1459
1495
  }
1460
1496
  if (accepted.length > 0) {
1461
- const insertParamsList = accepted.map(({ edge, props }) => ({
1462
- graphId,
1463
- id: edge.id,
1464
- kind: edge.kind,
1465
- fromKind: edge.from.kind,
1466
- fromId: edge.from.id,
1467
- toKind: edge.to.kind,
1468
- toId: edge.to.id,
1469
- props,
1470
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1471
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1472
- }));
1473
- if (backend.insertEdgesBatch === void 0) {
1474
- for (const params of insertParamsList) {
1475
- await backend.insertEdge(params);
1476
- }
1477
- } else {
1478
- await backend.insertEdgesBatch(insertParamsList);
1479
- }
1497
+ await frame.session.createEdgesNoReturn(
1498
+ accepted.map(
1499
+ (candidate) => importEdgeInsertWork(
1500
+ graphId,
1501
+ candidate,
1502
+ edgeSchemas.get(candidate.edge.kind)?.registration.cardinality ?? "many"
1503
+ )
1504
+ )
1505
+ );
1480
1506
  for (const candidate of accepted) {
1481
1507
  record(candidate.edge, { status: "created" });
1482
1508
  }
@@ -1485,7 +1511,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1485
1511
  record(
1486
1512
  edge,
1487
1513
  await processEdge(
1488
- backend,
1514
+ frame,
1489
1515
  graphId,
1490
1516
  registry,
1491
1517
  edge,
@@ -1497,7 +1523,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1497
1523
  );
1498
1524
  }
1499
1525
  }
1500
- async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1526
+ async function processEdge(frame, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1501
1527
  const schemaEntry = edgeSchemas.get(edge.kind);
1502
1528
  if (!schemaEntry) {
1503
1529
  return { status: "error", error: `Unknown edge kind: ${edge.kind}` };
@@ -1525,7 +1551,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1525
1551
  const fromKey = makeNodeKey(edge.from.kind, edge.from.id);
1526
1552
  const toKey = makeNodeKey(edge.to.kind, edge.to.id);
1527
1553
  if (!importedNodeIds.has(fromKey)) {
1528
- const fromExists = await backend.getNode(
1554
+ const fromExists = await frame.target.getNode(
1529
1555
  graphId,
1530
1556
  edge.from.kind,
1531
1557
  edge.from.id
@@ -1538,7 +1564,11 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1538
1564
  }
1539
1565
  }
1540
1566
  if (!importedNodeIds.has(toKey)) {
1541
- const toExists = await backend.getNode(graphId, edge.to.kind, edge.to.id);
1567
+ const toExists = await frame.target.getNode(
1568
+ graphId,
1569
+ edge.to.kind,
1570
+ edge.to.id
1571
+ );
1542
1572
  if (toExists === void 0 || !isLiveNodeRow(toExists)) {
1543
1573
  return {
1544
1574
  status: "error",
@@ -1559,7 +1589,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1559
1589
  if (validityError !== void 0) {
1560
1590
  return { status: "error", error: validityError };
1561
1591
  }
1562
- const existing = await backend.getEdge(graphId, edge.id);
1592
+ const existing = await frame.target.getEdge(graphId, edge.id);
1563
1593
  if (existing) {
1564
1594
  const identityConflict = edgeIdentityConflict(edge, existing);
1565
1595
  if (identityConflict !== void 0) {
@@ -1587,8 +1617,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1587
1617
  return { status: "error", error: updateWindow.error };
1588
1618
  }
1589
1619
  const updateError = await updateImportedEdge(
1590
- backend,
1591
- graphId,
1620
+ frame.session,
1592
1621
  edge,
1593
1622
  propsResult.data,
1594
1623
  updateWindow.value
@@ -1600,20 +1629,36 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1600
1629
  }
1601
1630
  }
1602
1631
  }
1603
- await backend.insertEdge({
1604
- graphId,
1605
- id: edge.id,
1606
- kind: edge.kind,
1607
- fromKind: edge.from.kind,
1608
- fromId: edge.from.id,
1609
- toKind: edge.to.kind,
1610
- toId: edge.to.id,
1611
- props: propsResult.data,
1612
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1613
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1614
- });
1632
+ const cardinality = schemaEntry.registration.cardinality ?? "many";
1633
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1634
+ () => checkCardinalityConstraint(
1635
+ { graphId, registry, backend: frame.target },
1636
+ edge.kind,
1637
+ cardinality,
1638
+ edge.from.kind,
1639
+ edge.from.id,
1640
+ edge.to.kind,
1641
+ edge.to.id,
1642
+ edge.validTo
1643
+ )
1644
+ );
1645
+ if (!cardinalityResult.ok) {
1646
+ return { status: "error", error: cardinalityResult.error };
1647
+ }
1648
+ await frame.session.createEdge(
1649
+ importEdgeInsertWork(
1650
+ graphId,
1651
+ { edge, props: propsResult.data },
1652
+ cardinality
1653
+ )
1654
+ );
1615
1655
  return { status: "created" };
1616
1656
  }
1657
+ function importEdgeInsertWork(graphId, candidate, cardinality) {
1658
+ const params = edgeInsertParamsOf(graphId, candidate);
1659
+ const claim = edgeCardinalityClaim(cardinality, params);
1660
+ return { params, ...claim === void 0 ? {} : { claim } };
1661
+ }
1617
1662
  function validateProperties(properties, schema, unknownStrategy) {
1618
1663
  try {
1619
1664
  const knownKeys = new Set(Object.keys(schema.shape));
@@ -2149,5 +2194,5 @@ async function* exportEdgeChunks(backend, graphId, kind, options) {
2149
2194
  }
2150
2195
 
2151
2196
  export { ConflictStrategySchema, ExportOptionsSchema, ExportStreamOptionsSchema, FORMAT_VERSION, GraphDataHeaderSchema, GraphDataSchema, GraphDataSourceSchema, GraphInterchangeChunkSchema, IdentityInterchangeModeSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, exportStreamBackend, importGraph, importGraphStream, registerIngestionImportTarget, serializedStreamRefusal, withImportStreamLease };
2152
- //# sourceMappingURL=chunk-LTXQOEIC.js.map
2153
- //# sourceMappingURL=chunk-LTXQOEIC.js.map
2197
+ //# sourceMappingURL=chunk-2CYI5HRH.js.map
2198
+ //# sourceMappingURL=chunk-2CYI5HRH.js.map