@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,21 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var chunkJB6T4GLL_cjs = require('./chunk-JB6T4GLL.cjs');
4
- var chunk3KOY4FH3_cjs = require('./chunk-3KOY4FH3.cjs');
5
- var chunkJFRT7S3B_cjs = require('./chunk-JFRT7S3B.cjs');
6
- var chunkEZEEWCFJ_cjs = require('./chunk-EZEEWCFJ.cjs');
7
- var chunkSIT26LAZ_cjs = require('./chunk-SIT26LAZ.cjs');
8
- var chunk5PRKMB24_cjs = require('./chunk-5PRKMB24.cjs');
9
- var chunkBFUOME67_cjs = require('./chunk-BFUOME67.cjs');
10
- var chunkFQPEMEWX_cjs = require('./chunk-FQPEMEWX.cjs');
11
- var chunkTQHGE7UC_cjs = require('./chunk-TQHGE7UC.cjs');
12
- var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
3
+ var chunkC76WFIVZ_cjs = require('./chunk-C76WFIVZ.cjs');
4
+ var chunkTUVD4DFR_cjs = require('./chunk-TUVD4DFR.cjs');
5
+ var chunk7PRMDZIA_cjs = require('./chunk-7PRMDZIA.cjs');
6
+ var chunk5OWHU7Z7_cjs = require('./chunk-5OWHU7Z7.cjs');
7
+ var chunkRDP6ZRSM_cjs = require('./chunk-RDP6ZRSM.cjs');
8
+ var chunkZBFZGLZE_cjs = require('./chunk-ZBFZGLZE.cjs');
9
+ var chunkGHZPZNFC_cjs = require('./chunk-GHZPZNFC.cjs');
10
+ var chunkG2TLHH6T_cjs = require('./chunk-G2TLHH6T.cjs');
11
+ var chunkLLVOQOWE_cjs = require('./chunk-LLVOQOWE.cjs');
12
+ var chunkM5MSP3BI_cjs = require('./chunk-M5MSP3BI.cjs');
13
+ var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
13
14
  var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
14
15
  var zod = require('zod');
15
16
 
16
17
  var FORMAT_VERSION = "2.0";
17
18
  var AcceptedFormatVersionSchema = zod.z.enum(["1.0", "2.0"]);
18
- var ValidityTimestampSchema = zod.z.iso.datetime().refine((value) => chunkTQHGE7UC_cjs.isCanonicalIsoDate(value), {
19
+ var ValidityTimestampSchema = zod.z.iso.datetime().refine((value) => chunkM5MSP3BI_cjs.isCanonicalIsoDate(value), {
19
20
  message: "Expected canonical UTC ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ); convert with new Date(value).toISOString()."
20
21
  });
21
22
  var InterchangeNodeSchema = zod.z.object({
@@ -249,10 +250,10 @@ function resolveIngestionImportTarget(target) {
249
250
  const registeredStore = INGESTION_IMPORT_TARGETS.get(target);
250
251
  if (registeredStore !== void 0) return registeredStore;
251
252
  try {
252
- chunk3KOY4FH3_cjs.storeBackend(target);
253
+ chunkTUVD4DFR_cjs.storeBackend(target);
253
254
  return target;
254
255
  } catch (error) {
255
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
256
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
256
257
  "Interchange import received an unrecognized ingestion target",
257
258
  { target: "unregistered-ingestion-target" },
258
259
  {
@@ -283,8 +284,8 @@ async function importGraph(target, data, rawOptions) {
283
284
  );
284
285
  }
285
286
  async function withImportStreamLease(store, run) {
286
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(
287
- chunk3KOY4FH3_cjs.storeBackend(store),
287
+ const lease = chunkZBFZGLZE_cjs.acquireSerializedStreamLease(
288
+ chunkTUVD4DFR_cjs.storeBackend(store),
288
289
  "import-stream"
289
290
  );
290
291
  if (!lease.acquired) {
@@ -307,25 +308,37 @@ async function importGraphData(store, data, options) {
307
308
  const errors = [];
308
309
  const graph = store.graph;
309
310
  const graphId = store.graphId;
310
- const backend = chunk3KOY4FH3_cjs.storeBackend(store);
311
- const runtime = chunk3KOY4FH3_cjs.storeRuntime(store);
311
+ const backend = chunkTUVD4DFR_cjs.storeBackend(store);
312
+ const runtime = chunkTUVD4DFR_cjs.storeRuntime(store);
312
313
  const registry = store.registry;
314
+ const owedClaimReason = chunkC76WFIVZ_cjs.graphOwesClaims(graph, registry);
315
+ const claimRefusal = owedClaimReason === void 0 ? void 0 : chunkRDP6ZRSM_cjs.constraintFenceRefusal({ graphId }, backend, owedClaimReason);
316
+ if (claimRefusal !== void 0) throw claimRefusal;
313
317
  const nodeSchemas = buildNodeSchemaMap(graph);
314
318
  const edgeSchemas = buildEdgeSchemaMap(graph);
315
319
  const importedNodeIds = /* @__PURE__ */ new Set();
316
- await chunkJFRT7S3B_cjs.runInWriteTransaction(
320
+ await chunkC76WFIVZ_cjs.runWritePlan(
317
321
  {
318
322
  graphId,
323
+ registry,
319
324
  schemaVersion: store.introspect().schemaVersion,
320
325
  historyEnabled: store.historyEnabled,
321
326
  revisionTrackingEnabled: store.revisionTrackingEnabled,
322
- revisionSchema: store.revisionSchema
327
+ revisionSchema: store.revisionSchema,
328
+ // HOW this caller takes position 3. `lockIdentityImportTarget` is
329
+ // `lockIdentityGraph` on an identity graph and a no-op otherwise, so the
330
+ // participation below is unconditional and the acquirer owns the
331
+ // "identity is configured" test, exactly as before the migration.
332
+ identityLock: (target) => runtime.lockIdentityImportTarget(target)
323
333
  },
334
+ // An import writes node rows AND edge rows in one frame, so it declares the
335
+ // mixed family explicitly instead of receiving either narrower session.
336
+ chunkC76WFIVZ_cjs.mixedWritePlan(void 0, true),
324
337
  backend,
325
- async (target, lock) => {
326
- await runtime.lockIdentityImportTarget(target);
338
+ async (session, target, overlaidSession) => {
339
+ const frame = { session, target, overlaidSession };
327
340
  await processNodes(
328
- target,
341
+ frame,
329
342
  graphId,
330
343
  registry,
331
344
  data.nodes,
@@ -333,8 +346,7 @@ async function importGraphData(store, data, options) {
333
346
  options,
334
347
  result,
335
348
  errors,
336
- importedNodeIds,
337
- lock
349
+ importedNodeIds
338
350
  );
339
351
  await runtime.foldImportedIdentityNodes(
340
352
  target,
@@ -343,7 +355,7 @@ async function importGraphData(store, data, options) {
343
355
  ).map((node) => ({ kind: node.kind, id: node.id }))
344
356
  );
345
357
  await processEdges(
346
- target,
358
+ frame,
347
359
  graphId,
348
360
  registry,
349
361
  data.edges,
@@ -377,8 +389,8 @@ async function importGraphStream(target, chunks, rawOptions) {
377
389
  const store = resolveIngestionImportTarget(target);
378
390
  const options = ImportOptionsSchema.parse(rawOptions);
379
391
  const sourceBackend = exportStreamBackend(chunks);
380
- const targetBackend = chunk3KOY4FH3_cjs.storeBackend(store);
381
- const contention = sourceBackend === void 0 ? void 0 : chunkSIT26LAZ_cjs.snapshotExportContention(sourceBackend, targetBackend);
392
+ const targetBackend = chunkTUVD4DFR_cjs.storeBackend(store);
393
+ const contention = sourceBackend === void 0 ? void 0 : chunkZBFZGLZE_cjs.snapshotExportContention(sourceBackend, targetBackend);
382
394
  if (contention !== void 0) {
383
395
  throw serializedStreamRefusal({
384
396
  graphId: store.graphId,
@@ -395,7 +407,7 @@ async function importGraphStream(target, chunks, rawOptions) {
395
407
  try {
396
408
  for await (const chunk of chunks) {
397
409
  if (releaseImportLease === void 0) {
398
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(
410
+ const lease = chunkZBFZGLZE_cjs.acquireSerializedStreamLease(
399
411
  targetBackend,
400
412
  "import-stream"
401
413
  );
@@ -525,7 +537,7 @@ function serializedStreamRefusal(input) {
525
537
  requested,
526
538
  heldBy
527
539
  );
528
- return new chunkMRDBBHIZ_cjs.ConfigurationError(
540
+ return new chunkX4GDXBOP_cjs.ConfigurationError(
529
541
  message,
530
542
  { code, graphId, requested, heldBy },
531
543
  { suggestion }
@@ -560,7 +572,7 @@ function throwIfStreamChunkFailed(result, options) {
560
572
  }
561
573
  function assertIdentityImportSupported(store, hasIdentitySection) {
562
574
  if (hasIdentitySection && store.graph.identity === void 0) {
563
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
575
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
564
576
  "Cannot import identity assertions into an identity-disabled graph.",
565
577
  { code: "IDENTITY_IMPORT_REQUIRES_PROFILE", graphId: store.graphId }
566
578
  );
@@ -570,7 +582,7 @@ function validateIdentitySection(identity) {
570
582
  if (identity === void 0) return;
571
583
  const parsed = InterchangeIdentitySchema.safeParse(identity);
572
584
  if (parsed.success) return;
573
- throw new chunkMRDBBHIZ_cjs.ValidationError(
585
+ throw new chunkX4GDXBOP_cjs.ValidationError(
574
586
  `Invalid identity interchange section: ${parsed.error.message}`,
575
587
  {
576
588
  issues: parsed.error.issues.map((issue) => ({
@@ -596,19 +608,19 @@ function identityImportError(assertion, graphId, message) {
596
608
  };
597
609
  }
598
610
  function isIdConflictError(error) {
599
- return error instanceof chunkMRDBBHIZ_cjs.ConfigurationError && error.details["code"] === IDENTITY_IMPORT_ID_CONFLICT_CODE;
611
+ return error instanceof chunkX4GDXBOP_cjs.ConfigurationError && error.details["code"] === IDENTITY_IMPORT_ID_CONFLICT_CODE;
600
612
  }
601
613
  function touchesRef(assertion, ref) {
602
614
  return assertion.a.kind === ref.kind && assertion.a.id === ref.id || assertion.b.kind === ref.kind && assertion.b.id === ref.id;
603
615
  }
604
616
  function asIdentityImportError(assertions, graphId, error) {
605
617
  const tagged = taggedAssertion(assertions, error);
606
- if (error instanceof chunkMRDBBHIZ_cjs.NodeNotFoundError) {
618
+ if (error instanceof chunkX4GDXBOP_cjs.NodeNotFoundError) {
607
619
  const ref = error.details;
608
620
  const assertion = tagged ?? assertions.find((candidate) => touchesRef(candidate, ref));
609
621
  return identityImportError(assertion, graphId, error.message);
610
622
  }
611
- if (error instanceof chunkMRDBBHIZ_cjs.IdentityContradictionError) {
623
+ if (error instanceof chunkX4GDXBOP_cjs.IdentityContradictionError) {
612
624
  const { a, b } = error.details;
613
625
  const assertion = tagged ?? assertions.find(
614
626
  (candidate) => touchesRef(candidate, a) && touchesRef(candidate, b)
@@ -634,12 +646,12 @@ function asIdentityImportError(assertions, graphId, error) {
634
646
  }
635
647
  function taggedAssertion(assertions, error) {
636
648
  if (typeof error !== "object" || error === null) return void 0;
637
- const id = error[chunkJFRT7S3B_cjs.IDENTITY_IMPORT_FAILED_ASSERTION];
649
+ const id = error[chunk5OWHU7Z7_cjs.IDENTITY_IMPORT_FAILED_ASSERTION];
638
650
  if (typeof id !== "string") return void 0;
639
651
  return assertions.find((candidate) => candidate.id === id);
640
652
  }
641
653
  function isIdentityAssertionValidationError(error) {
642
- return error instanceof chunkMRDBBHIZ_cjs.ValidationError && error.details.issues.length > 0 && error.details.issues.every(
654
+ return error instanceof chunkX4GDXBOP_cjs.ValidationError && error.details.issues.length > 0 && error.details.issues.every(
643
655
  (issue) => issue.path === "identity.assertions" && issue.assertionId !== void 0
644
656
  );
645
657
  }
@@ -665,7 +677,7 @@ function identityImportProgress(error) {
665
677
  if (typeof error !== "object" || error === null) {
666
678
  return { created: 0, skipped: 0 };
667
679
  }
668
- const progress = error[chunkJFRT7S3B_cjs.IDENTITY_IMPORT_PROGRESS];
680
+ const progress = error[chunk5OWHU7Z7_cjs.IDENTITY_IMPORT_PROGRESS];
669
681
  if (typeof progress !== "object" || progress === null || !("created" in progress) || typeof progress.created !== "number" || !("skipped" in progress) || typeof progress.skipped !== "number") {
670
682
  return { created: 0, skipped: 0 };
671
683
  }
@@ -674,7 +686,7 @@ function identityImportProgress(error) {
674
686
  function validateStreamHeader(header) {
675
687
  const parsed = GraphDataHeaderSchema.safeParse(header);
676
688
  if (parsed.success) return;
677
- throw new chunkMRDBBHIZ_cjs.ValidationError(
689
+ throw new chunkX4GDXBOP_cjs.ValidationError(
678
690
  `Invalid graph interchange stream header: ${parsed.error.message}`,
679
691
  {
680
692
  issues: parsed.error.issues.map((issue) => ({
@@ -734,7 +746,7 @@ async function refreshStatisticsAfterImport(store, options, result, surface) {
734
746
  }
735
747
  function buildNodeSchemaMap(graph) {
736
748
  const map = /* @__PURE__ */ new Map();
737
- for (const kindName of chunkBFUOME67_cjs.getNodeKinds(graph)) {
749
+ for (const kindName of chunkG2TLHH6T_cjs.getNodeKinds(graph)) {
738
750
  const registration = graph.nodes[kindName];
739
751
  map.set(kindName, {
740
752
  registration,
@@ -745,7 +757,7 @@ function buildNodeSchemaMap(graph) {
745
757
  }
746
758
  function buildEdgeSchemaMap(graph) {
747
759
  const map = /* @__PURE__ */ new Map();
748
- for (const kindName of chunkBFUOME67_cjs.getEdgeKinds(graph)) {
760
+ for (const kindName of chunkG2TLHH6T_cjs.getEdgeKinds(graph)) {
749
761
  const registration = graph.edges[kindName];
750
762
  map.set(kindName, {
751
763
  registration,
@@ -754,12 +766,12 @@ function buildEdgeSchemaMap(graph) {
754
766
  }
755
767
  return map;
756
768
  }
757
- async function processNodes(backend, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds, lock) {
769
+ async function processNodes(frame, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds) {
758
770
  const batchSize = options.batchSize;
759
771
  for (let index = 0; index < nodes.length; index += batchSize) {
760
772
  const batch = nodes.slice(index, index + batchSize);
761
773
  await processNodeSlice(
762
- backend,
774
+ frame,
763
775
  graphId,
764
776
  registry,
765
777
  batch,
@@ -767,8 +779,7 @@ async function processNodes(backend, graphId, registry, nodes, schemas, options,
767
779
  options,
768
780
  result,
769
781
  errors,
770
- importedNodeIds,
771
- lock
782
+ importedNodeIds
772
783
  );
773
784
  }
774
785
  }
@@ -802,7 +813,7 @@ function recordNodeOutcome(node, outcome, result, errors, importedNodeIds) {
802
813
  }
803
814
  }
804
815
  }
805
- async function processNodeSlice(backend, graphId, registry, batch, schemas, options, result, errors, importedNodeIds, lock) {
816
+ async function processNodeSlice(frame, graphId, registry, batch, schemas, options, result, errors, importedNodeIds) {
806
817
  const record = (node, outcome) => {
807
818
  recordNodeOutcome(node, outcome, result, errors, importedNodeIds);
808
819
  };
@@ -861,20 +872,21 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
861
872
  });
862
873
  }
863
874
  const {
864
- backend: validationBackend,
875
+ reads,
876
+ reader: validationBackend,
865
877
  registerPendingNode,
866
878
  registerPendingUniqueEntries,
867
879
  registerAppliedNodeUpdate,
868
880
  seedNodeRow,
869
881
  seedUniqueRow
870
- } = chunkJB6T4GLL_cjs.createNodeBatchValidationBackend(graphId, registry, backend);
871
- await chunkJB6T4GLL_cjs.primeBatchValidationCaches(
882
+ } = chunkC76WFIVZ_cjs.createNodeBatchValidationSeams(graphId, registry, frame.target);
883
+ await chunkC76WFIVZ_cjs.primeBatchValidationCaches(
872
884
  { graphId, registry },
873
885
  candidates.map((candidate) => candidate.draft),
874
- backend,
886
+ frame.target,
875
887
  { seedNodeRow, seedUniqueRow }
876
888
  );
877
- const writeContext = { graphId, registry, lock };
889
+ const overlaidSession = frame.overlaidSession(reads);
878
890
  const accepted = [];
879
891
  for (const candidate of candidates) {
880
892
  const { node, schemaEntry, props } = candidate;
@@ -889,7 +901,7 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
889
901
  case "skip": {
890
902
  record(node, {
891
903
  status: "skipped",
892
- liveTarget: chunk5PRKMB24_cjs.isLiveNodeRow(existing)
904
+ liveTarget: chunkGHZPZNFC_cjs.isLiveNodeRow(existing)
893
905
  });
894
906
  break;
895
907
  }
@@ -901,7 +913,7 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
901
913
  break;
902
914
  }
903
915
  case "update": {
904
- if (!chunk5PRKMB24_cjs.isLiveNodeRow(existing)) {
916
+ if (!chunkGHZPZNFC_cjs.isLiveNodeRow(existing)) {
905
917
  record(node, { status: "skipped", liveTarget: false });
906
918
  break;
907
919
  }
@@ -913,30 +925,18 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
913
925
  record(node, { status: "error", error: updateWindow.error });
914
926
  break;
915
927
  }
916
- const updateError = await updateImportedNode(
917
- writeContext,
918
- // The pending-aware overlay, not the raw backend: the update's
919
- // uniqueness pre-check must see a unique value already reserved by
920
- // an unflushed create EARLIER in this slice, so it degrades to a
921
- // per-row error exactly as the sequential path does — rather than
922
- // claiming the key on the real backend and colliding with that
923
- // create at flush (which would throw and roll back the whole
924
- // import). Writes still delegate to the real backend.
925
- validationBackend,
926
- node,
927
- {
928
- existing,
929
- schema: schemaEntry.registration.type.schema,
930
- validatedProps: props,
931
- uniqueConstraints,
932
- windowFence: updateWindow.value
933
- }
934
- );
928
+ const updateError = await updateImportedNode(overlaidSession, node, {
929
+ existing,
930
+ schema: schemaEntry.registration.type.schema,
931
+ validatedProps: props,
932
+ uniqueConstraints,
933
+ windowFence: updateWindow.value
934
+ });
935
935
  if (updateError === void 0) {
936
936
  registerAppliedNodeUpdate(
937
937
  node.kind,
938
938
  node.id,
939
- chunk5PRKMB24_cjs.rowPropsToObject(existing.props),
939
+ chunkGHZPZNFC_cjs.rowPropsToObject(existing.props),
940
940
  props,
941
941
  uniqueConstraints
942
942
  );
@@ -950,44 +950,38 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
950
950
  }
951
951
  continue;
952
952
  }
953
- const uniquenessResult = await catchUniquenessError(
954
- () => chunk3KOY4FH3_cjs.checkUniquenessConstraints(
953
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
954
+ await chunkTUVD4DFR_cjs.checkUniquenessConstraints(
955
955
  { graphId, registry, backend: validationBackend },
956
956
  node.kind,
957
957
  node.id,
958
958
  props,
959
959
  uniqueConstraints
960
- )
961
- );
962
- if (!uniquenessResult.ok) {
963
- record(node, { status: "error", error: uniquenessResult.error });
960
+ );
961
+ await chunkC76WFIVZ_cjs.checkDisjointnessConstraint(
962
+ { graphId, registry, backend: validationBackend },
963
+ node.kind,
964
+ node.id
965
+ );
966
+ });
967
+ if (!constraintResult.ok) {
968
+ record(node, { status: "error", error: constraintResult.error });
964
969
  continue;
965
970
  }
966
- registerPendingNode(buildImportInsertParams(graphId, candidate));
971
+ registerPendingNode(buildImportInsertParams(graphId, node, props));
967
972
  registerPendingUniqueEntries(node.kind, node.id, props, uniqueConstraints);
968
973
  accepted.push(candidate);
969
974
  }
970
975
  if (accepted.length > 0) {
971
- const insertParamsList = accepted.map(
972
- (candidate) => buildImportInsertParams(graphId, candidate)
973
- );
974
- if (backend.insertNodesBatch === void 0) {
975
- for (const params of insertParamsList) {
976
- await backend.insertNode(params);
977
- }
978
- } else {
979
- await backend.insertNodesBatch(insertParamsList);
980
- }
981
- await chunk3KOY4FH3_cjs.applyNodeInsertSideEffectsBatch(
982
- writeContext,
983
- accepted.map((candidate) => ({
984
- kind: candidate.node.kind,
985
- id: candidate.node.id,
986
- schema: candidate.schemaEntry.registration.type.schema,
987
- props: candidate.props,
988
- uniqueConstraints: candidate.schemaEntry.registration.unique ?? []
989
- })),
990
- backend
976
+ await frame.session.createNodesNoReturn(
977
+ accepted.map(
978
+ (candidate) => importNodeInsertWork(
979
+ graphId,
980
+ candidate.node,
981
+ candidate.schemaEntry.registration,
982
+ candidate.props
983
+ )
984
+ )
991
985
  );
992
986
  for (const candidate of accepted) {
993
987
  record(candidate.node, { status: "created" });
@@ -996,20 +990,11 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
996
990
  for (const node of deferred) {
997
991
  record(
998
992
  node,
999
- await processNode(
1000
- backend,
1001
- graphId,
1002
- registry,
1003
- node,
1004
- schemas,
1005
- options,
1006
- lock
1007
- )
993
+ await processNode(frame, graphId, registry, node, schemas, options)
1008
994
  );
1009
995
  }
1010
996
  }
1011
- function buildImportInsertParams(graphId, candidate) {
1012
- const { node, props } = candidate;
997
+ function buildImportInsertParams(graphId, node, props) {
1013
998
  return {
1014
999
  graphId,
1015
1000
  kind: node.kind,
@@ -1019,36 +1004,58 @@ function buildImportInsertParams(graphId, candidate) {
1019
1004
  ...node.validTo !== void 0 && { validTo: node.validTo }
1020
1005
  };
1021
1006
  }
1022
- async function catchUniquenessError(fn) {
1007
+ function importNodeInsertWork(graphId, node, registration, props) {
1008
+ return {
1009
+ params: buildImportInsertParams(graphId, node, props),
1010
+ claim: {
1011
+ kind: node.kind,
1012
+ id: node.id,
1013
+ props,
1014
+ constraints: registration.unique ?? []
1015
+ },
1016
+ sideEffects: {
1017
+ kind: node.kind,
1018
+ id: node.id,
1019
+ schema: registration.type.schema,
1020
+ props,
1021
+ uniqueConstraints: registration.unique ?? []
1022
+ }
1023
+ };
1024
+ }
1025
+ async function catchDeclaredConstraintRefusal(fn) {
1023
1026
  try {
1024
1027
  return { ok: true, value: await fn() };
1025
1028
  } catch (error) {
1026
- if (error instanceof chunkMRDBBHIZ_cjs.UniquenessError) {
1029
+ if (error instanceof chunkX4GDXBOP_cjs.UniquenessError || error instanceof chunkX4GDXBOP_cjs.DisjointError || error instanceof chunkX4GDXBOP_cjs.CardinalityError) {
1027
1030
  return { ok: false, error: error.message };
1028
1031
  }
1029
1032
  throw error;
1030
1033
  }
1031
1034
  }
1032
1035
  var NODE_UPDATE_TARGET_CHANGED_CODE = "INTERCHANGE_NODE_UPDATE_TARGET_CHANGED";
1033
- async function updateImportedNode(writeContext, backend, node, args) {
1036
+ async function updateImportedNode(session, node, args) {
1034
1037
  try {
1035
- const result = await catchUniquenessError(
1036
- () => chunk3KOY4FH3_cjs.applyNodeUpdate(
1037
- writeContext,
1038
- {
1039
- existing: args.existing,
1040
- schema: args.schema,
1041
- validatedProps: args.validatedProps,
1042
- uniqueConstraints: args.uniqueConstraints,
1043
- ...args.windowFence,
1044
- ...node.validTo !== void 0 && { validTo: node.validTo }
1045
- },
1046
- backend
1038
+ const result = await catchDeclaredConstraintRefusal(
1039
+ () => (
1040
+ // The fence is an ARGUMENT the method requires, not a spread the call
1041
+ // site may forget: the guard's verdict travels to the statement that
1042
+ // honors it, and an empty fence (`{}`) is the stated decision to assert
1043
+ // nothing rather than an omission.
1044
+ session.reviseNode(
1045
+ {
1046
+ existing: args.existing,
1047
+ schema: args.schema,
1048
+ validatedProps: args.validatedProps,
1049
+ uniqueConstraints: args.uniqueConstraints,
1050
+ ...node.validTo !== void 0 && { validTo: node.validTo }
1051
+ },
1052
+ { validityLowerBound: args.windowFence }
1053
+ )
1047
1054
  )
1048
1055
  );
1049
1056
  return result.ok ? void 0 : result.error;
1050
1057
  } catch (error) {
1051
- if (!(error instanceof chunkMRDBBHIZ_cjs.DatabaseOperationError) || error.details.reason !== "no_row_returned") {
1058
+ if (!(error instanceof chunkX4GDXBOP_cjs.DatabaseOperationError) || error.details.reason !== "no_row_returned") {
1052
1059
  throw error;
1053
1060
  }
1054
1061
  return `${NODE_UPDATE_TARGET_CHANGED_CODE}: Node "${node.kind}:${node.id}" was not updated: no live node matching the id and the validity bound this import checked remained when the write ran, so the row changed or was removed after it was checked. Re-export the source and retry.`;
@@ -1068,23 +1075,32 @@ function edgeIdentityConflict(edge, existing) {
1068
1075
  if (differences.length === 0) return void 0;
1069
1076
  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.`;
1070
1077
  }
1071
- async function updateImportedEdge(backend, graphId, edge, props, windowFence) {
1078
+ async function updateImportedEdge(session, edge, props, windowFence) {
1072
1079
  try {
1073
- await backend.updateEdge({
1074
- graphId,
1075
- id: edge.id,
1076
- kind: edge.kind,
1077
- fromKind: edge.from.kind,
1078
- fromId: edge.from.id,
1079
- toKind: edge.to.kind,
1080
- toId: edge.to.id,
1081
- props,
1082
- ...windowFence,
1083
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1084
- });
1080
+ await session.reviseEdge(
1081
+ {
1082
+ id: edge.id,
1083
+ props,
1084
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1085
+ },
1086
+ {
1087
+ validityLowerBound: windowFence,
1088
+ // Import re-admits no row to a counted population — it never resurrects
1089
+ // and never clears an end — so it reads no stored `valid_to` and asserts
1090
+ // none. `{}` is the stated decision, not an omission.
1091
+ validityUpperBound: {},
1092
+ edgeIdentity: {
1093
+ kind: edge.kind,
1094
+ fromKind: edge.from.kind,
1095
+ fromId: edge.from.id,
1096
+ toKind: edge.to.kind,
1097
+ toId: edge.to.id
1098
+ }
1099
+ }
1100
+ );
1085
1101
  return void 0;
1086
1102
  } catch (error) {
1087
- if (!(error instanceof chunkMRDBBHIZ_cjs.DatabaseOperationError) || error.details.reason !== "no_row_returned") {
1103
+ if (!(error instanceof chunkX4GDXBOP_cjs.DatabaseOperationError) || error.details.reason !== "no_row_returned") {
1088
1104
  throw error;
1089
1105
  }
1090
1106
  return `${EDGE_IDENTITY_CONFLICT_CODE}: Edge "${edge.id}" of kind "${edge.kind}" from "${edge.from.kind}:${edge.from.id}" to "${edge.to.kind}:${edge.to.id}" was not updated: no live edge matching the identity and the validity bound this import checked remained when the write ran, so the row changed or was removed after it was checked. Re-export the source and retry.`;
@@ -1094,9 +1110,9 @@ function windowResultOf(assert) {
1094
1110
  try {
1095
1111
  return { ok: true, value: assert() };
1096
1112
  } catch (error) {
1097
- if (error instanceof chunkMRDBBHIZ_cjs.ValidationError) {
1113
+ if (error instanceof chunkX4GDXBOP_cjs.ValidationError) {
1098
1114
  const coded = error.details.issues.find(
1099
- (issue) => issue.code === chunkMRDBBHIZ_cjs.INVERTED_VALIDITY_WINDOW_CODE || issue.code === chunkMRDBBHIZ_cjs.IMMUTABLE_VALIDITY_LOWER_BOUND_CODE
1115
+ (issue) => issue.code === chunkX4GDXBOP_cjs.INVERTED_VALIDITY_WINDOW_CODE || issue.code === chunkX4GDXBOP_cjs.IMMUTABLE_VALIDITY_LOWER_BOUND_CODE
1100
1116
  );
1101
1117
  if (coded !== void 0) {
1102
1118
  return { ok: false, error: `${coded.code}: ${error.message}` };
@@ -1114,12 +1130,12 @@ function windowErrorOf(assert) {
1114
1130
  }
1115
1131
  function validateValidityWindow(entity) {
1116
1132
  return windowErrorOf(() => {
1117
- chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
1133
+ chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(
1118
1134
  entity.validFrom ?? void 0,
1119
1135
  "validFrom"
1120
1136
  );
1121
- chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(entity.validTo, "validTo");
1122
- chunkTQHGE7UC_cjs.assertOrderedValidityWindow(
1137
+ chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(entity.validTo, "validTo");
1138
+ chunkM5MSP3BI_cjs.assertOrderedValidityWindow(
1123
1139
  `${entity.kind} "${entity.id}"`,
1124
1140
  entity.validFrom ?? void 0,
1125
1141
  entity.validTo
@@ -1128,7 +1144,7 @@ function validateValidityWindow(entity) {
1128
1144
  }
1129
1145
  function validateUpdateValidityWindow(entity, storedValidFrom) {
1130
1146
  const verdict = windowResultOf(
1131
- () => chunkTQHGE7UC_cjs.assertWritableValidityWindow(
1147
+ () => chunkM5MSP3BI_cjs.assertWritableValidityWindow(
1132
1148
  `${entity.kind} "${entity.id}"`,
1133
1149
  entity.validFrom ?? void 0,
1134
1150
  {
@@ -1143,7 +1159,7 @@ function validateUpdateValidityWindow(entity, storedValidFrom) {
1143
1159
  );
1144
1160
  return verdict.ok ? { ok: true, value: verdict.value.storedLowerBoundFence } : verdict;
1145
1161
  }
1146
- async function processNode(backend, graphId, registry, node, schemas, options, lock) {
1162
+ async function processNode(frame, graphId, registry, node, schemas, options) {
1147
1163
  const schemaEntry = schemas.get(node.kind);
1148
1164
  if (!schemaEntry) {
1149
1165
  return { status: "error", error: `Unknown node kind: ${node.kind}` };
@@ -1162,12 +1178,11 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1162
1178
  }
1163
1179
  const { registration } = schemaEntry;
1164
1180
  const uniqueConstraints = registration.unique ?? [];
1165
- const writeContext = { graphId, registry, lock };
1166
- const existing = await backend.getNode(graphId, node.kind, node.id);
1181
+ const existing = await frame.target.getNode(graphId, node.kind, node.id);
1167
1182
  if (existing) {
1168
1183
  switch (options.onConflict) {
1169
1184
  case "skip": {
1170
- return { status: "skipped", liveTarget: chunk5PRKMB24_cjs.isLiveNodeRow(existing) };
1185
+ return { status: "skipped", liveTarget: chunkGHZPZNFC_cjs.isLiveNodeRow(existing) };
1171
1186
  }
1172
1187
  case "error": {
1173
1188
  return {
@@ -1176,7 +1191,7 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1176
1191
  };
1177
1192
  }
1178
1193
  case "update": {
1179
- if (!chunk5PRKMB24_cjs.isLiveNodeRow(existing)) {
1194
+ if (!chunkGHZPZNFC_cjs.isLiveNodeRow(existing)) {
1180
1195
  return { status: "skipped", liveTarget: false };
1181
1196
  }
1182
1197
  const updateWindow = validateUpdateValidityWindow(
@@ -1186,18 +1201,13 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1186
1201
  if (!updateWindow.ok) {
1187
1202
  return { status: "error", error: updateWindow.error };
1188
1203
  }
1189
- const updateError = await updateImportedNode(
1190
- writeContext,
1191
- backend,
1192
- node,
1193
- {
1194
- existing,
1195
- schema: registration.type.schema,
1196
- validatedProps: propsResult.data,
1197
- uniqueConstraints,
1198
- windowFence: updateWindow.value
1199
- }
1200
- );
1204
+ const updateError = await updateImportedNode(frame.session, node, {
1205
+ existing,
1206
+ schema: registration.type.schema,
1207
+ validatedProps: propsResult.data,
1208
+ uniqueConstraints,
1209
+ windowFence: updateWindow.value
1210
+ });
1201
1211
  if (updateError !== void 0) {
1202
1212
  return { status: "error", error: updateError };
1203
1213
  }
@@ -1205,45 +1215,34 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1205
1215
  }
1206
1216
  }
1207
1217
  }
1208
- const uniquenessResult = await catchUniquenessError(
1209
- () => chunk3KOY4FH3_cjs.checkUniquenessConstraints(
1210
- { graphId, registry, backend },
1218
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
1219
+ await chunkTUVD4DFR_cjs.checkUniquenessConstraints(
1220
+ { graphId, registry, backend: frame.target },
1211
1221
  node.kind,
1212
1222
  node.id,
1213
1223
  propsResult.data,
1214
1224
  uniqueConstraints
1215
- )
1216
- );
1217
- if (!uniquenessResult.ok) {
1218
- return { status: "error", error: uniquenessResult.error };
1219
- }
1220
- await backend.insertNode({
1221
- graphId,
1222
- kind: node.kind,
1223
- id: node.id,
1224
- props: propsResult.data,
1225
- ...node.validFrom !== void 0 && { validFrom: node.validFrom },
1226
- ...node.validTo !== void 0 && { validTo: node.validTo }
1225
+ );
1226
+ await chunkC76WFIVZ_cjs.checkDisjointnessConstraint(
1227
+ { graphId, registry, backend: frame.target },
1228
+ node.kind,
1229
+ node.id
1230
+ );
1227
1231
  });
1228
- await chunk3KOY4FH3_cjs.applyNodeInsertSideEffects(
1229
- writeContext,
1230
- {
1231
- kind: node.kind,
1232
- id: node.id,
1233
- schema: registration.type.schema,
1234
- props: propsResult.data,
1235
- uniqueConstraints
1236
- },
1237
- backend
1232
+ if (!constraintResult.ok) {
1233
+ return { status: "error", error: constraintResult.error };
1234
+ }
1235
+ await frame.session.createNode(
1236
+ importNodeInsertWork(graphId, node, registration, propsResult.data)
1238
1237
  );
1239
1238
  return { status: "created" };
1240
1239
  }
1241
- async function processEdges(backend, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1240
+ async function processEdges(frame, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1242
1241
  const batchSize = options.batchSize;
1243
1242
  for (let index = 0; index < edges.length; index += batchSize) {
1244
1243
  const batch = edges.slice(index, index + batchSize);
1245
1244
  await processEdgeSlice(
1246
- backend,
1245
+ frame,
1247
1246
  graphId,
1248
1247
  registry,
1249
1248
  batch,
@@ -1281,10 +1280,29 @@ function recordEdgeOutcome(edge, outcome, result, errors) {
1281
1280
  }
1282
1281
  }
1283
1282
  }
1284
- async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1283
+ function edgeInsertParamsOf(graphId, candidate) {
1284
+ const { edge, props } = candidate;
1285
+ return {
1286
+ graphId,
1287
+ id: edge.id,
1288
+ kind: edge.kind,
1289
+ fromKind: edge.from.kind,
1290
+ fromId: edge.from.id,
1291
+ toKind: edge.to.kind,
1292
+ toId: edge.to.id,
1293
+ props,
1294
+ ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1295
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1296
+ };
1297
+ }
1298
+ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1285
1299
  const record = (edge, outcome) => {
1286
1300
  recordEdgeOutcome(edge, outcome, result, errors);
1287
1301
  };
1302
+ const {
1303
+ backend: cardinalityValidationBackend,
1304
+ registerPendingEdgeForCardinality
1305
+ } = chunkC76WFIVZ_cjs.createEdgeBatchValidationBackend(frame.target);
1288
1306
  const candidates = [];
1289
1307
  const deferred = [];
1290
1308
  const seenIds = /* @__PURE__ */ new Set();
@@ -1311,7 +1329,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1311
1329
  });
1312
1330
  continue;
1313
1331
  }
1314
- const endpointError = chunkFQPEMEWX_cjs.validateEdgeEndpoints(
1332
+ const endpointError = chunkLLVOQOWE_cjs.validateEdgeEndpoints(
1315
1333
  edge.kind,
1316
1334
  edge.from.kind,
1317
1335
  edge.to.kind,
@@ -1345,7 +1363,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1345
1363
  }
1346
1364
  const liveEndpointKeys = /* @__PURE__ */ new Set();
1347
1365
  const checkedEndpointKeys = /* @__PURE__ */ new Set();
1348
- if (options.validateReferences && backend.getNodes !== void 0) {
1366
+ if (options.validateReferences && frame.target.getNodes !== void 0) {
1349
1367
  const idsByKind = /* @__PURE__ */ new Map();
1350
1368
  for (const { edge } of candidates) {
1351
1369
  for (const endpoint of [edge.from, edge.to]) {
@@ -1358,9 +1376,9 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1358
1376
  }
1359
1377
  }
1360
1378
  for (const [kind, ids] of idsByKind) {
1361
- const rows = await backend.getNodes(graphId, kind, [...ids]);
1379
+ const rows = await frame.target.getNodes(graphId, kind, [...ids]);
1362
1380
  for (const row of rows) {
1363
- if (chunk5PRKMB24_cjs.isLiveNodeRow(row)) {
1381
+ if (chunkGHZPZNFC_cjs.isLiveNodeRow(row)) {
1364
1382
  liveEndpointKeys.add(makeNodeKey(kind, row.id));
1365
1383
  }
1366
1384
  }
@@ -1370,12 +1388,12 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1370
1388
  const key = makeNodeKey(endpoint.kind, endpoint.id);
1371
1389
  if (importedNodeIds.has(key)) return true;
1372
1390
  if (checkedEndpointKeys.has(key)) return liveEndpointKeys.has(key);
1373
- const row = await backend.getNode(graphId, endpoint.kind, endpoint.id);
1374
- return row !== void 0 && chunk5PRKMB24_cjs.isLiveNodeRow(row);
1391
+ const row = await frame.target.getNode(graphId, endpoint.kind, endpoint.id);
1392
+ return row !== void 0 && chunkGHZPZNFC_cjs.isLiveNodeRow(row);
1375
1393
  };
1376
1394
  const existingById = /* @__PURE__ */ new Map();
1377
- if (candidates.length > 0 && backend.getEdges !== void 0) {
1378
- const rows = await backend.getEdges(
1395
+ if (candidates.length > 0 && frame.target.getEdges !== void 0) {
1396
+ const rows = await frame.target.getEdges(
1379
1397
  graphId,
1380
1398
  candidates.map((candidate) => candidate.edge.id)
1381
1399
  );
@@ -1405,7 +1423,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1405
1423
  continue;
1406
1424
  }
1407
1425
  }
1408
- const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await backend.getEdge(graphId, edge.id);
1426
+ const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await frame.target.getEdge(graphId, edge.id);
1409
1427
  if (existing) {
1410
1428
  const identityConflict = edgeIdentityConflict(edge, existing);
1411
1429
  if (identityConflict !== void 0) {
@@ -1441,8 +1459,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1441
1459
  break;
1442
1460
  }
1443
1461
  const updateError = await updateImportedEdge(
1444
- backend,
1445
- graphId,
1462
+ frame.session,
1446
1463
  edge,
1447
1464
  props,
1448
1465
  updateWindow.value
@@ -1457,28 +1474,37 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1457
1474
  }
1458
1475
  continue;
1459
1476
  }
1477
+ const insertParams = edgeInsertParamsOf(graphId, candidate);
1478
+ const cardinality = edgeSchemas.get(edge.kind)?.registration.cardinality ?? "many";
1479
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1480
+ () => chunkC76WFIVZ_cjs.checkCardinalityConstraint(
1481
+ { graphId, registry, backend: cardinalityValidationBackend },
1482
+ edge.kind,
1483
+ cardinality,
1484
+ edge.from.kind,
1485
+ edge.from.id,
1486
+ edge.to.kind,
1487
+ edge.to.id,
1488
+ edge.validTo
1489
+ )
1490
+ );
1491
+ if (!cardinalityResult.ok) {
1492
+ record(edge, { status: "error", error: cardinalityResult.error });
1493
+ continue;
1494
+ }
1495
+ registerPendingEdgeForCardinality(insertParams, cardinality);
1460
1496
  accepted.push(candidate);
1461
1497
  }
1462
1498
  if (accepted.length > 0) {
1463
- const insertParamsList = accepted.map(({ edge, props }) => ({
1464
- graphId,
1465
- id: edge.id,
1466
- kind: edge.kind,
1467
- fromKind: edge.from.kind,
1468
- fromId: edge.from.id,
1469
- toKind: edge.to.kind,
1470
- toId: edge.to.id,
1471
- props,
1472
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1473
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1474
- }));
1475
- if (backend.insertEdgesBatch === void 0) {
1476
- for (const params of insertParamsList) {
1477
- await backend.insertEdge(params);
1478
- }
1479
- } else {
1480
- await backend.insertEdgesBatch(insertParamsList);
1481
- }
1499
+ await frame.session.createEdgesNoReturn(
1500
+ accepted.map(
1501
+ (candidate) => importEdgeInsertWork(
1502
+ graphId,
1503
+ candidate,
1504
+ edgeSchemas.get(candidate.edge.kind)?.registration.cardinality ?? "many"
1505
+ )
1506
+ )
1507
+ );
1482
1508
  for (const candidate of accepted) {
1483
1509
  record(candidate.edge, { status: "created" });
1484
1510
  }
@@ -1487,7 +1513,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1487
1513
  record(
1488
1514
  edge,
1489
1515
  await processEdge(
1490
- backend,
1516
+ frame,
1491
1517
  graphId,
1492
1518
  registry,
1493
1519
  edge,
@@ -1499,7 +1525,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1499
1525
  );
1500
1526
  }
1501
1527
  }
1502
- async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1528
+ async function processEdge(frame, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1503
1529
  const schemaEntry = edgeSchemas.get(edge.kind);
1504
1530
  if (!schemaEntry) {
1505
1531
  return { status: "error", error: `Unknown edge kind: ${edge.kind}` };
@@ -1513,7 +1539,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1513
1539
  if (!nodeSchemas.has(edge.to.kind)) {
1514
1540
  return { status: "error", error: `Unknown to node kind: ${edge.to.kind}` };
1515
1541
  }
1516
- const endpointError = chunkFQPEMEWX_cjs.validateEdgeEndpoints(
1542
+ const endpointError = chunkLLVOQOWE_cjs.validateEdgeEndpoints(
1517
1543
  edge.kind,
1518
1544
  edge.from.kind,
1519
1545
  edge.to.kind,
@@ -1527,12 +1553,12 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1527
1553
  const fromKey = makeNodeKey(edge.from.kind, edge.from.id);
1528
1554
  const toKey = makeNodeKey(edge.to.kind, edge.to.id);
1529
1555
  if (!importedNodeIds.has(fromKey)) {
1530
- const fromExists = await backend.getNode(
1556
+ const fromExists = await frame.target.getNode(
1531
1557
  graphId,
1532
1558
  edge.from.kind,
1533
1559
  edge.from.id
1534
1560
  );
1535
- if (fromExists === void 0 || !chunk5PRKMB24_cjs.isLiveNodeRow(fromExists)) {
1561
+ if (fromExists === void 0 || !chunkGHZPZNFC_cjs.isLiveNodeRow(fromExists)) {
1536
1562
  return {
1537
1563
  status: "error",
1538
1564
  error: `From node not found: ${edge.from.kind}:${edge.from.id}`
@@ -1540,8 +1566,12 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1540
1566
  }
1541
1567
  }
1542
1568
  if (!importedNodeIds.has(toKey)) {
1543
- const toExists = await backend.getNode(graphId, edge.to.kind, edge.to.id);
1544
- if (toExists === void 0 || !chunk5PRKMB24_cjs.isLiveNodeRow(toExists)) {
1569
+ const toExists = await frame.target.getNode(
1570
+ graphId,
1571
+ edge.to.kind,
1572
+ edge.to.id
1573
+ );
1574
+ if (toExists === void 0 || !chunkGHZPZNFC_cjs.isLiveNodeRow(toExists)) {
1545
1575
  return {
1546
1576
  status: "error",
1547
1577
  error: `To node not found: ${edge.to.kind}:${edge.to.id}`
@@ -1561,7 +1591,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1561
1591
  if (validityError !== void 0) {
1562
1592
  return { status: "error", error: validityError };
1563
1593
  }
1564
- const existing = await backend.getEdge(graphId, edge.id);
1594
+ const existing = await frame.target.getEdge(graphId, edge.id);
1565
1595
  if (existing) {
1566
1596
  const identityConflict = edgeIdentityConflict(edge, existing);
1567
1597
  if (identityConflict !== void 0) {
@@ -1589,8 +1619,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1589
1619
  return { status: "error", error: updateWindow.error };
1590
1620
  }
1591
1621
  const updateError = await updateImportedEdge(
1592
- backend,
1593
- graphId,
1622
+ frame.session,
1594
1623
  edge,
1595
1624
  propsResult.data,
1596
1625
  updateWindow.value
@@ -1602,20 +1631,36 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1602
1631
  }
1603
1632
  }
1604
1633
  }
1605
- await backend.insertEdge({
1606
- graphId,
1607
- id: edge.id,
1608
- kind: edge.kind,
1609
- fromKind: edge.from.kind,
1610
- fromId: edge.from.id,
1611
- toKind: edge.to.kind,
1612
- toId: edge.to.id,
1613
- props: propsResult.data,
1614
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1615
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1616
- });
1634
+ const cardinality = schemaEntry.registration.cardinality ?? "many";
1635
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1636
+ () => chunkC76WFIVZ_cjs.checkCardinalityConstraint(
1637
+ { graphId, registry, backend: frame.target },
1638
+ edge.kind,
1639
+ cardinality,
1640
+ edge.from.kind,
1641
+ edge.from.id,
1642
+ edge.to.kind,
1643
+ edge.to.id,
1644
+ edge.validTo
1645
+ )
1646
+ );
1647
+ if (!cardinalityResult.ok) {
1648
+ return { status: "error", error: cardinalityResult.error };
1649
+ }
1650
+ await frame.session.createEdge(
1651
+ importEdgeInsertWork(
1652
+ graphId,
1653
+ { edge, props: propsResult.data },
1654
+ cardinality
1655
+ )
1656
+ );
1617
1657
  return { status: "created" };
1618
1658
  }
1659
+ function importEdgeInsertWork(graphId, candidate, cardinality) {
1660
+ const params = edgeInsertParamsOf(graphId, candidate);
1661
+ const claim = chunk7PRMDZIA_cjs.edgeCardinalityClaim(cardinality, params);
1662
+ return { params, ...claim === void 0 ? {} : { claim } };
1663
+ }
1619
1664
  function validateProperties(properties, schema, unknownStrategy) {
1620
1665
  try {
1621
1666
  const knownKeys = new Set(Object.keys(schema.shape));
@@ -1678,7 +1723,7 @@ function formatZodError(error) {
1678
1723
  }).join("; ");
1679
1724
  }
1680
1725
  function makeNodeKey(kind, id) {
1681
- return chunkEZEEWCFJ_cjs.encodeTupleKey([kind, id]);
1726
+ return chunkLLVOQOWE_cjs.encodeTupleKey([kind, id]);
1682
1727
  }
1683
1728
 
1684
1729
  // src/interchange/export.ts
@@ -1721,7 +1766,7 @@ async function exportGraph(store, options) {
1721
1766
  };
1722
1767
  }
1723
1768
  function exportGraphStream(store, options) {
1724
- const backend = chunk3KOY4FH3_cjs.storeBackend(store);
1769
+ const backend = chunkTUVD4DFR_cjs.storeBackend(store);
1725
1770
  return markExportStreamBackend(
1726
1771
  exportGraphStreamFromBackend(store, backend, options),
1727
1772
  backend
@@ -1732,7 +1777,7 @@ async function* exportGraphStreamFromBackend(store, backend, options) {
1732
1777
  const exportsIdentity = store.graph.identity !== void 0;
1733
1778
  const explicitlyDisabledTemporalFields = options?.includeTemporal === false;
1734
1779
  if (exportsIdentity && explicitlyDisabledTemporalFields) {
1735
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
1780
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
1736
1781
  "Identity export requires temporal endpoint fields.",
1737
1782
  {
1738
1783
  code: "IDENTITY_EXPORT_REQUIRES_TEMPORAL_FIELDS",
@@ -1766,7 +1811,7 @@ async function* exportGraphStreamFromBackend(store, backend, options) {
1766
1811
  idleTimer = void 0;
1767
1812
  unsubscribeFromSignal();
1768
1813
  channel.abort(
1769
- new chunkMRDBBHIZ_cjs.ExportStreamIdleTimeoutError(
1814
+ new chunkX4GDXBOP_cjs.ExportStreamIdleTimeoutError(
1770
1815
  store.graphId,
1771
1816
  idleTimeoutMs,
1772
1817
  backend.capabilities.transactions
@@ -1859,7 +1904,7 @@ function exportStreamCancelled(phase, graphId, signal, framed) {
1859
1904
  const message = phase === "before-open" ? "The graph export stream was aborted through its AbortSignal before it opened: no snapshot transaction was started and no database connection claimed." : framed ? "The graph export stream was aborted through its AbortSignal: its repeatable-read snapshot has been rolled back and the connection it held released." : "The graph export stream was aborted through its AbortSignal: its remaining reads were abandoned. This backend does not support transactions, so the export held no snapshot and no connection \u2014 and the chunks already delivered were never guaranteed to agree with one another.";
1860
1905
  const cause = signal?.reason;
1861
1906
  const suggestion = phase === "before-open" ? "Start a new export; the aborted one claimed nothing." : framed ? "Start a new export; the aborted one released its snapshot transaction and the connection it held." : "Start a new export; nothing was held, but discard the chunks already delivered unless partial, mutually-inconsistent data is acceptable.";
1862
- return new chunkMRDBBHIZ_cjs.ExportStreamCancelledError(
1907
+ return new chunkX4GDXBOP_cjs.ExportStreamCancelledError(
1863
1908
  message,
1864
1909
  { graphId },
1865
1910
  {
@@ -1869,7 +1914,7 @@ function exportStreamCancelled(phase, graphId, signal, framed) {
1869
1914
  );
1870
1915
  }
1871
1916
  function claimSnapshotExportLeaseOrRefuse(graphId, backend) {
1872
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(backend, "export-snapshot");
1917
+ const lease = chunkZBFZGLZE_cjs.acquireSerializedStreamLease(backend, "export-snapshot");
1873
1918
  if (!lease.acquired) {
1874
1919
  throw serializedStreamRefusal({
1875
1920
  graphId,
@@ -1881,14 +1926,14 @@ function claimSnapshotExportLeaseOrRefuse(graphId, backend) {
1881
1926
  }
1882
1927
  async function produceExportChunks(store, backend, options, emit) {
1883
1928
  const graphId = store.graphId;
1884
- const nodeKinds = options.nodeKinds ?? chunkBFUOME67_cjs.getNodeKinds(store.graph);
1885
- const edgeKinds = options.edgeKinds ?? chunkBFUOME67_cjs.getEdgeKinds(store.graph);
1929
+ const nodeKinds = options.nodeKinds ?? chunkG2TLHH6T_cjs.getNodeKinds(store.graph);
1930
+ const edgeKinds = options.edgeKinds ?? chunkG2TLHH6T_cjs.getEdgeKinds(store.graph);
1886
1931
  const schemaVersion = await backend.getActiveSchema(graphId);
1887
1932
  await emit({
1888
1933
  type: "header",
1889
1934
  header: {
1890
1935
  formatVersion: FORMAT_VERSION,
1891
- exportedAt: chunkTQHGE7UC_cjs.nowIso(),
1936
+ exportedAt: chunkM5MSP3BI_cjs.nowIso(),
1892
1937
  source: {
1893
1938
  type: "typegraph-export",
1894
1939
  graphId,
@@ -1925,7 +1970,7 @@ async function produceExportChunks(store, backend, options, emit) {
1925
1970
  if (store.graph.identity === void 0) return;
1926
1971
  let after;
1927
1972
  for (; ; ) {
1928
- const page = await chunk3KOY4FH3_cjs.storeRuntime(store).readIdentityAssertionPageAtTarget(
1973
+ const page = await chunkTUVD4DFR_cjs.storeRuntime(store).readIdentityAssertionPageAtTarget(
1929
1974
  backend,
1930
1975
  options.identityMode,
1931
1976
  {
@@ -2074,7 +2119,7 @@ async function* exportNodeChunks(backend, graphId, kind, options) {
2074
2119
  const node = {
2075
2120
  kind: row.kind,
2076
2121
  id: row.id,
2077
- properties: chunk5PRKMB24_cjs.rowPropsToObject(row.props)
2122
+ properties: chunkGHZPZNFC_cjs.rowPropsToObject(row.props)
2078
2123
  };
2079
2124
  if (options.includeTemporal) {
2080
2125
  const validFrom = (
@@ -2124,7 +2169,7 @@ async function* exportEdgeChunks(backend, graphId, kind, options) {
2124
2169
  kind: row.to_kind,
2125
2170
  id: row.to_id
2126
2171
  },
2127
- properties: chunk5PRKMB24_cjs.rowPropsToObject(row.props)
2172
+ properties: chunkGHZPZNFC_cjs.rowPropsToObject(row.props)
2128
2173
  };
2129
2174
  if (options.includeTemporal) {
2130
2175
  const validFrom = (
@@ -2175,5 +2220,5 @@ exports.importGraphStream = importGraphStream;
2175
2220
  exports.registerIngestionImportTarget = registerIngestionImportTarget;
2176
2221
  exports.serializedStreamRefusal = serializedStreamRefusal;
2177
2222
  exports.withImportStreamLease = withImportStreamLease;
2178
- //# sourceMappingURL=chunk-3G5W2U2L.cjs.map
2179
- //# sourceMappingURL=chunk-3G5W2U2L.cjs.map
2223
+ //# sourceMappingURL=chunk-CS6JTQQ2.cjs.map
2224
+ //# sourceMappingURL=chunk-CS6JTQQ2.cjs.map