@nicia-ai/typegraph 0.48.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-AX6JGVTZ.js → chunk-2CYI5HRH.js} +276 -206
  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-OTUPEF2W.cjs → chunk-CS6JTQQ2.cjs} +328 -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-7XUYFFR4.cjs → chunk-ISKCIQF2.cjs} +20 -20
  118. package/dist/{chunk-7XUYFFR4.cjs.map → chunk-ISKCIQF2.cjs.map} +1 -1
  119. package/dist/{chunk-OD4SSY2U.js → chunk-JG5XIJDY.js} +57 -31
  120. package/dist/chunk-JG5XIJDY.js.map +1 -0
  121. package/dist/{chunk-2HIYYMWY.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-ACGSAMD3.js → chunk-MJPZNEJZ.js} +274 -292
  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-2SYZXD54.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-CT3ZKTOF.js → chunk-S33YQEL7.js} +7 -7
  156. package/dist/{chunk-CT3ZKTOF.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-PFBRJBUL.cjs → chunk-TYGGUWMS.cjs} +178 -152
  170. package/dist/chunk-TYGGUWMS.cjs.map +1 -0
  171. package/dist/{chunk-4WMMBDS5.js → chunk-U3Z7XKAG.js} +7 -7
  172. package/dist/{chunk-4WMMBDS5.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-TKZXMWQF.cjs → chunk-WK23PGTP.cjs} +13 -13
  186. package/dist/{chunk-TKZXMWQF.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-WCCATHMB.cjs → chunk-XMY2SXOH.cjs} +438 -456
  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 +327 -302
  218. package/dist/graph-merge/index.cjs.map +1 -1
  219. package/dist/graph-merge/index.d.cts +14 -11
  220. package/dist/graph-merge/index.d.ts +14 -11
  221. package/dist/graph-merge/index.js +52 -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-CI8OWIkM.d.ts +17 -0
  236. package/dist/ingestion-import-target-DCpfM1PX.d.cts +17 -0
  237. package/dist/interchange/index.cjs +55 -54
  238. package/dist/interchange/index.cjs.map +1 -1
  239. package/dist/interchange/index.d.cts +26 -12
  240. package/dist/interchange/index.d.ts +26 -12
  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-DMj39MEu.d.cts → postgres-CH1kkM5J.d.cts} +279 -2
  248. package/dist/{postgres-CcL4bAHS.d.ts → 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-D7Oz0SQh.d.ts → sqlite-Cyx9j9o6.d.cts} +309 -2
  266. package/dist/{sqlite-YppHrNFb.d.cts → sqlite-axLw5Lo5.d.ts} +309 -2
  267. package/dist/{store-JUVvtmR4.d.cts → store-CTfQ9taw.d.ts} +110 -13
  268. package/dist/{store-UzrGvZOo.d.ts → store-DR9J7JVB.d.cts} +110 -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 +4 -4
  278. package/dist/chunk-26YKDNUD.cjs.map +0 -1
  279. package/dist/chunk-2HIYYMWY.cjs.map +0 -1
  280. package/dist/chunk-2SYZXD54.js.map +0 -1
  281. package/dist/chunk-3KOY4FH3.cjs +0 -934
  282. package/dist/chunk-3KOY4FH3.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-ACGSAMD3.js.map +0 -1
  289. package/dist/chunk-AX6JGVTZ.js.map +0 -1
  290. package/dist/chunk-BFUOME67.cjs.map +0 -1
  291. package/dist/chunk-BRRP76WO.js.map +0 -1
  292. package/dist/chunk-CICO5GXD.cjs +0 -12
  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-MKJ4KXL5.cjs +0 -12
  310. package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
  311. package/dist/chunk-NVY5CJFP.js.map +0 -1
  312. package/dist/chunk-OD4SSY2U.js.map +0 -1
  313. package/dist/chunk-OTUPEF2W.cjs.map +0 -1
  314. package/dist/chunk-PFBRJBUL.cjs.map +0 -1
  315. package/dist/chunk-PWLJ77UV.cjs +0 -23
  316. package/dist/chunk-PWLJ77UV.cjs.map +0 -1
  317. package/dist/chunk-S5TERQVW.js.map +0 -1
  318. package/dist/chunk-SHFBB23Q.js.map +0 -1
  319. package/dist/chunk-SIT26LAZ.cjs.map +0 -1
  320. package/dist/chunk-SR725PWF.cjs.map +0 -1
  321. package/dist/chunk-TQHGE7UC.cjs.map +0 -1
  322. package/dist/chunk-UGHG7PGX.js.map +0 -1
  323. package/dist/chunk-WCCATHMB.cjs.map +0 -1
  324. package/dist/chunk-YIURNGXI.js +0 -155
  325. package/dist/chunk-YIURNGXI.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({
@@ -240,6 +241,29 @@ var ExportStreamOptionsSchema = ExportOptionsSchema.extend({
240
241
  batchSize: zod.z.number().int().positive().default(1e3)
241
242
  });
242
243
 
244
+ // src/interchange/ingestion-import-target.ts
245
+ var INGESTION_IMPORT_TARGETS = /* @__PURE__ */ new WeakMap();
246
+ function registerIngestionImportTarget(handle, store) {
247
+ INGESTION_IMPORT_TARGETS.set(handle, store);
248
+ }
249
+ function resolveIngestionImportTarget(target) {
250
+ const registeredStore = INGESTION_IMPORT_TARGETS.get(target);
251
+ if (registeredStore !== void 0) return registeredStore;
252
+ try {
253
+ chunkTUVD4DFR_cjs.storeBackend(target);
254
+ return target;
255
+ } catch (error) {
256
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
257
+ "Interchange import received an unrecognized ingestion target",
258
+ { target: "unregistered-ingestion-target" },
259
+ {
260
+ cause: error,
261
+ suggestion: "Pass a Store or the exact handle returned by ingestionBranch() from this TypeGraph installation."
262
+ }
263
+ );
264
+ }
265
+ }
266
+
243
267
  // src/interchange/stream-source.ts
244
268
  var EXPORT_STREAM_BACKENDS = /* @__PURE__ */ new WeakMap();
245
269
  function markExportStreamBackend(stream, backend) {
@@ -251,7 +275,8 @@ function exportStreamBackend(stream) {
251
275
  }
252
276
 
253
277
  // src/interchange/import.ts
254
- async function importGraph(store, data, rawOptions) {
278
+ async function importGraph(target, data, rawOptions) {
279
+ const store = resolveIngestionImportTarget(target);
255
280
  const options = ImportOptionsSchema.parse(rawOptions);
256
281
  return withImportStreamLease(
257
282
  store,
@@ -259,8 +284,8 @@ async function importGraph(store, data, rawOptions) {
259
284
  );
260
285
  }
261
286
  async function withImportStreamLease(store, run) {
262
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(
263
- chunk3KOY4FH3_cjs.storeBackend(store),
287
+ const lease = chunkZBFZGLZE_cjs.acquireSerializedStreamLease(
288
+ chunkTUVD4DFR_cjs.storeBackend(store),
264
289
  "import-stream"
265
290
  );
266
291
  if (!lease.acquired) {
@@ -283,25 +308,37 @@ async function importGraphData(store, data, options) {
283
308
  const errors = [];
284
309
  const graph = store.graph;
285
310
  const graphId = store.graphId;
286
- const backend = chunk3KOY4FH3_cjs.storeBackend(store);
287
- const runtime = chunk3KOY4FH3_cjs.storeRuntime(store);
311
+ const backend = chunkTUVD4DFR_cjs.storeBackend(store);
312
+ const runtime = chunkTUVD4DFR_cjs.storeRuntime(store);
288
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;
289
317
  const nodeSchemas = buildNodeSchemaMap(graph);
290
318
  const edgeSchemas = buildEdgeSchemaMap(graph);
291
319
  const importedNodeIds = /* @__PURE__ */ new Set();
292
- await chunkJFRT7S3B_cjs.runInWriteTransaction(
320
+ await chunkC76WFIVZ_cjs.runWritePlan(
293
321
  {
294
322
  graphId,
323
+ registry,
295
324
  schemaVersion: store.introspect().schemaVersion,
296
325
  historyEnabled: store.historyEnabled,
297
326
  revisionTrackingEnabled: store.revisionTrackingEnabled,
298
- 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)
299
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),
300
337
  backend,
301
- async (target, lock) => {
302
- await runtime.lockIdentityImportTarget(target);
338
+ async (session, target, overlaidSession) => {
339
+ const frame = { session, target, overlaidSession };
303
340
  await processNodes(
304
- target,
341
+ frame,
305
342
  graphId,
306
343
  registry,
307
344
  data.nodes,
@@ -309,8 +346,7 @@ async function importGraphData(store, data, options) {
309
346
  options,
310
347
  result,
311
348
  errors,
312
- importedNodeIds,
313
- lock
349
+ importedNodeIds
314
350
  );
315
351
  await runtime.foldImportedIdentityNodes(
316
352
  target,
@@ -319,7 +355,7 @@ async function importGraphData(store, data, options) {
319
355
  ).map((node) => ({ kind: node.kind, id: node.id }))
320
356
  );
321
357
  await processEdges(
322
- target,
358
+ frame,
323
359
  graphId,
324
360
  registry,
325
361
  data.edges,
@@ -349,11 +385,12 @@ async function importGraphData(store, data, options) {
349
385
  errors
350
386
  };
351
387
  }
352
- async function importGraphStream(store, chunks, rawOptions) {
388
+ async function importGraphStream(target, chunks, rawOptions) {
389
+ const store = resolveIngestionImportTarget(target);
353
390
  const options = ImportOptionsSchema.parse(rawOptions);
354
391
  const sourceBackend = exportStreamBackend(chunks);
355
- const targetBackend = chunk3KOY4FH3_cjs.storeBackend(store);
356
- 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);
357
394
  if (contention !== void 0) {
358
395
  throw serializedStreamRefusal({
359
396
  graphId: store.graphId,
@@ -370,7 +407,7 @@ async function importGraphStream(store, chunks, rawOptions) {
370
407
  try {
371
408
  for await (const chunk of chunks) {
372
409
  if (releaseImportLease === void 0) {
373
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(
410
+ const lease = chunkZBFZGLZE_cjs.acquireSerializedStreamLease(
374
411
  targetBackend,
375
412
  "import-stream"
376
413
  );
@@ -500,7 +537,7 @@ function serializedStreamRefusal(input) {
500
537
  requested,
501
538
  heldBy
502
539
  );
503
- return new chunkMRDBBHIZ_cjs.ConfigurationError(
540
+ return new chunkX4GDXBOP_cjs.ConfigurationError(
504
541
  message,
505
542
  { code, graphId, requested, heldBy },
506
543
  { suggestion }
@@ -535,7 +572,7 @@ function throwIfStreamChunkFailed(result, options) {
535
572
  }
536
573
  function assertIdentityImportSupported(store, hasIdentitySection) {
537
574
  if (hasIdentitySection && store.graph.identity === void 0) {
538
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
575
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
539
576
  "Cannot import identity assertions into an identity-disabled graph.",
540
577
  { code: "IDENTITY_IMPORT_REQUIRES_PROFILE", graphId: store.graphId }
541
578
  );
@@ -545,7 +582,7 @@ function validateIdentitySection(identity) {
545
582
  if (identity === void 0) return;
546
583
  const parsed = InterchangeIdentitySchema.safeParse(identity);
547
584
  if (parsed.success) return;
548
- throw new chunkMRDBBHIZ_cjs.ValidationError(
585
+ throw new chunkX4GDXBOP_cjs.ValidationError(
549
586
  `Invalid identity interchange section: ${parsed.error.message}`,
550
587
  {
551
588
  issues: parsed.error.issues.map((issue) => ({
@@ -571,19 +608,19 @@ function identityImportError(assertion, graphId, message) {
571
608
  };
572
609
  }
573
610
  function isIdConflictError(error) {
574
- 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;
575
612
  }
576
613
  function touchesRef(assertion, ref) {
577
614
  return assertion.a.kind === ref.kind && assertion.a.id === ref.id || assertion.b.kind === ref.kind && assertion.b.id === ref.id;
578
615
  }
579
616
  function asIdentityImportError(assertions, graphId, error) {
580
617
  const tagged = taggedAssertion(assertions, error);
581
- if (error instanceof chunkMRDBBHIZ_cjs.NodeNotFoundError) {
618
+ if (error instanceof chunkX4GDXBOP_cjs.NodeNotFoundError) {
582
619
  const ref = error.details;
583
620
  const assertion = tagged ?? assertions.find((candidate) => touchesRef(candidate, ref));
584
621
  return identityImportError(assertion, graphId, error.message);
585
622
  }
586
- if (error instanceof chunkMRDBBHIZ_cjs.IdentityContradictionError) {
623
+ if (error instanceof chunkX4GDXBOP_cjs.IdentityContradictionError) {
587
624
  const { a, b } = error.details;
588
625
  const assertion = tagged ?? assertions.find(
589
626
  (candidate) => touchesRef(candidate, a) && touchesRef(candidate, b)
@@ -609,12 +646,12 @@ function asIdentityImportError(assertions, graphId, error) {
609
646
  }
610
647
  function taggedAssertion(assertions, error) {
611
648
  if (typeof error !== "object" || error === null) return void 0;
612
- const id = error[chunkJFRT7S3B_cjs.IDENTITY_IMPORT_FAILED_ASSERTION];
649
+ const id = error[chunk5OWHU7Z7_cjs.IDENTITY_IMPORT_FAILED_ASSERTION];
613
650
  if (typeof id !== "string") return void 0;
614
651
  return assertions.find((candidate) => candidate.id === id);
615
652
  }
616
653
  function isIdentityAssertionValidationError(error) {
617
- 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(
618
655
  (issue) => issue.path === "identity.assertions" && issue.assertionId !== void 0
619
656
  );
620
657
  }
@@ -640,7 +677,7 @@ function identityImportProgress(error) {
640
677
  if (typeof error !== "object" || error === null) {
641
678
  return { created: 0, skipped: 0 };
642
679
  }
643
- const progress = error[chunkJFRT7S3B_cjs.IDENTITY_IMPORT_PROGRESS];
680
+ const progress = error[chunk5OWHU7Z7_cjs.IDENTITY_IMPORT_PROGRESS];
644
681
  if (typeof progress !== "object" || progress === null || !("created" in progress) || typeof progress.created !== "number" || !("skipped" in progress) || typeof progress.skipped !== "number") {
645
682
  return { created: 0, skipped: 0 };
646
683
  }
@@ -649,7 +686,7 @@ function identityImportProgress(error) {
649
686
  function validateStreamHeader(header) {
650
687
  const parsed = GraphDataHeaderSchema.safeParse(header);
651
688
  if (parsed.success) return;
652
- throw new chunkMRDBBHIZ_cjs.ValidationError(
689
+ throw new chunkX4GDXBOP_cjs.ValidationError(
653
690
  `Invalid graph interchange stream header: ${parsed.error.message}`,
654
691
  {
655
692
  issues: parsed.error.issues.map((issue) => ({
@@ -709,7 +746,7 @@ async function refreshStatisticsAfterImport(store, options, result, surface) {
709
746
  }
710
747
  function buildNodeSchemaMap(graph) {
711
748
  const map = /* @__PURE__ */ new Map();
712
- for (const kindName of chunkBFUOME67_cjs.getNodeKinds(graph)) {
749
+ for (const kindName of chunkG2TLHH6T_cjs.getNodeKinds(graph)) {
713
750
  const registration = graph.nodes[kindName];
714
751
  map.set(kindName, {
715
752
  registration,
@@ -720,7 +757,7 @@ function buildNodeSchemaMap(graph) {
720
757
  }
721
758
  function buildEdgeSchemaMap(graph) {
722
759
  const map = /* @__PURE__ */ new Map();
723
- for (const kindName of chunkBFUOME67_cjs.getEdgeKinds(graph)) {
760
+ for (const kindName of chunkG2TLHH6T_cjs.getEdgeKinds(graph)) {
724
761
  const registration = graph.edges[kindName];
725
762
  map.set(kindName, {
726
763
  registration,
@@ -729,12 +766,12 @@ function buildEdgeSchemaMap(graph) {
729
766
  }
730
767
  return map;
731
768
  }
732
- 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) {
733
770
  const batchSize = options.batchSize;
734
771
  for (let index = 0; index < nodes.length; index += batchSize) {
735
772
  const batch = nodes.slice(index, index + batchSize);
736
773
  await processNodeSlice(
737
- backend,
774
+ frame,
738
775
  graphId,
739
776
  registry,
740
777
  batch,
@@ -742,8 +779,7 @@ async function processNodes(backend, graphId, registry, nodes, schemas, options,
742
779
  options,
743
780
  result,
744
781
  errors,
745
- importedNodeIds,
746
- lock
782
+ importedNodeIds
747
783
  );
748
784
  }
749
785
  }
@@ -777,7 +813,7 @@ function recordNodeOutcome(node, outcome, result, errors, importedNodeIds) {
777
813
  }
778
814
  }
779
815
  }
780
- 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) {
781
817
  const record = (node, outcome) => {
782
818
  recordNodeOutcome(node, outcome, result, errors, importedNodeIds);
783
819
  };
@@ -836,20 +872,21 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
836
872
  });
837
873
  }
838
874
  const {
839
- backend: validationBackend,
875
+ reads,
876
+ reader: validationBackend,
840
877
  registerPendingNode,
841
878
  registerPendingUniqueEntries,
842
879
  registerAppliedNodeUpdate,
843
880
  seedNodeRow,
844
881
  seedUniqueRow
845
- } = chunkJB6T4GLL_cjs.createNodeBatchValidationBackend(graphId, registry, backend);
846
- await chunkJB6T4GLL_cjs.primeBatchValidationCaches(
882
+ } = chunkC76WFIVZ_cjs.createNodeBatchValidationSeams(graphId, registry, frame.target);
883
+ await chunkC76WFIVZ_cjs.primeBatchValidationCaches(
847
884
  { graphId, registry },
848
885
  candidates.map((candidate) => candidate.draft),
849
- backend,
886
+ frame.target,
850
887
  { seedNodeRow, seedUniqueRow }
851
888
  );
852
- const writeContext = { graphId, registry, lock };
889
+ const overlaidSession = frame.overlaidSession(reads);
853
890
  const accepted = [];
854
891
  for (const candidate of candidates) {
855
892
  const { node, schemaEntry, props } = candidate;
@@ -864,7 +901,7 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
864
901
  case "skip": {
865
902
  record(node, {
866
903
  status: "skipped",
867
- liveTarget: chunk5PRKMB24_cjs.isLiveNodeRow(existing)
904
+ liveTarget: chunkGHZPZNFC_cjs.isLiveNodeRow(existing)
868
905
  });
869
906
  break;
870
907
  }
@@ -876,7 +913,7 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
876
913
  break;
877
914
  }
878
915
  case "update": {
879
- if (!chunk5PRKMB24_cjs.isLiveNodeRow(existing)) {
916
+ if (!chunkGHZPZNFC_cjs.isLiveNodeRow(existing)) {
880
917
  record(node, { status: "skipped", liveTarget: false });
881
918
  break;
882
919
  }
@@ -888,30 +925,18 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
888
925
  record(node, { status: "error", error: updateWindow.error });
889
926
  break;
890
927
  }
891
- const updateError = await updateImportedNode(
892
- writeContext,
893
- // The pending-aware overlay, not the raw backend: the update's
894
- // uniqueness pre-check must see a unique value already reserved by
895
- // an unflushed create EARLIER in this slice, so it degrades to a
896
- // per-row error exactly as the sequential path does — rather than
897
- // claiming the key on the real backend and colliding with that
898
- // create at flush (which would throw and roll back the whole
899
- // import). Writes still delegate to the real backend.
900
- validationBackend,
901
- node,
902
- {
903
- existing,
904
- schema: schemaEntry.registration.type.schema,
905
- validatedProps: props,
906
- uniqueConstraints,
907
- windowFence: updateWindow.value
908
- }
909
- );
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
+ });
910
935
  if (updateError === void 0) {
911
936
  registerAppliedNodeUpdate(
912
937
  node.kind,
913
938
  node.id,
914
- chunk5PRKMB24_cjs.rowPropsToObject(existing.props),
939
+ chunkGHZPZNFC_cjs.rowPropsToObject(existing.props),
915
940
  props,
916
941
  uniqueConstraints
917
942
  );
@@ -925,44 +950,38 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
925
950
  }
926
951
  continue;
927
952
  }
928
- const uniquenessResult = await catchUniquenessError(
929
- () => chunk3KOY4FH3_cjs.checkUniquenessConstraints(
953
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
954
+ await chunkTUVD4DFR_cjs.checkUniquenessConstraints(
930
955
  { graphId, registry, backend: validationBackend },
931
956
  node.kind,
932
957
  node.id,
933
958
  props,
934
959
  uniqueConstraints
935
- )
936
- );
937
- if (!uniquenessResult.ok) {
938
- 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 });
939
969
  continue;
940
970
  }
941
- registerPendingNode(buildImportInsertParams(graphId, candidate));
971
+ registerPendingNode(buildImportInsertParams(graphId, node, props));
942
972
  registerPendingUniqueEntries(node.kind, node.id, props, uniqueConstraints);
943
973
  accepted.push(candidate);
944
974
  }
945
975
  if (accepted.length > 0) {
946
- const insertParamsList = accepted.map(
947
- (candidate) => buildImportInsertParams(graphId, candidate)
948
- );
949
- if (backend.insertNodesBatch === void 0) {
950
- for (const params of insertParamsList) {
951
- await backend.insertNode(params);
952
- }
953
- } else {
954
- await backend.insertNodesBatch(insertParamsList);
955
- }
956
- await chunk3KOY4FH3_cjs.applyNodeInsertSideEffectsBatch(
957
- writeContext,
958
- accepted.map((candidate) => ({
959
- kind: candidate.node.kind,
960
- id: candidate.node.id,
961
- schema: candidate.schemaEntry.registration.type.schema,
962
- props: candidate.props,
963
- uniqueConstraints: candidate.schemaEntry.registration.unique ?? []
964
- })),
965
- 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
+ )
966
985
  );
967
986
  for (const candidate of accepted) {
968
987
  record(candidate.node, { status: "created" });
@@ -971,20 +990,11 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
971
990
  for (const node of deferred) {
972
991
  record(
973
992
  node,
974
- await processNode(
975
- backend,
976
- graphId,
977
- registry,
978
- node,
979
- schemas,
980
- options,
981
- lock
982
- )
993
+ await processNode(frame, graphId, registry, node, schemas, options)
983
994
  );
984
995
  }
985
996
  }
986
- function buildImportInsertParams(graphId, candidate) {
987
- const { node, props } = candidate;
997
+ function buildImportInsertParams(graphId, node, props) {
988
998
  return {
989
999
  graphId,
990
1000
  kind: node.kind,
@@ -994,36 +1004,58 @@ function buildImportInsertParams(graphId, candidate) {
994
1004
  ...node.validTo !== void 0 && { validTo: node.validTo }
995
1005
  };
996
1006
  }
997
- 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) {
998
1026
  try {
999
1027
  return { ok: true, value: await fn() };
1000
1028
  } catch (error) {
1001
- if (error instanceof chunkMRDBBHIZ_cjs.UniquenessError) {
1029
+ if (error instanceof chunkX4GDXBOP_cjs.UniquenessError || error instanceof chunkX4GDXBOP_cjs.DisjointError || error instanceof chunkX4GDXBOP_cjs.CardinalityError) {
1002
1030
  return { ok: false, error: error.message };
1003
1031
  }
1004
1032
  throw error;
1005
1033
  }
1006
1034
  }
1007
1035
  var NODE_UPDATE_TARGET_CHANGED_CODE = "INTERCHANGE_NODE_UPDATE_TARGET_CHANGED";
1008
- async function updateImportedNode(writeContext, backend, node, args) {
1036
+ async function updateImportedNode(session, node, args) {
1009
1037
  try {
1010
- const result = await catchUniquenessError(
1011
- () => chunk3KOY4FH3_cjs.applyNodeUpdate(
1012
- writeContext,
1013
- {
1014
- existing: args.existing,
1015
- schema: args.schema,
1016
- validatedProps: args.validatedProps,
1017
- uniqueConstraints: args.uniqueConstraints,
1018
- ...args.windowFence,
1019
- ...node.validTo !== void 0 && { validTo: node.validTo }
1020
- },
1021
- 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
+ )
1022
1054
  )
1023
1055
  );
1024
1056
  return result.ok ? void 0 : result.error;
1025
1057
  } catch (error) {
1026
- 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") {
1027
1059
  throw error;
1028
1060
  }
1029
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.`;
@@ -1043,23 +1075,32 @@ function edgeIdentityConflict(edge, existing) {
1043
1075
  if (differences.length === 0) return void 0;
1044
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.`;
1045
1077
  }
1046
- async function updateImportedEdge(backend, graphId, edge, props, windowFence) {
1078
+ async function updateImportedEdge(session, edge, props, windowFence) {
1047
1079
  try {
1048
- await backend.updateEdge({
1049
- graphId,
1050
- id: edge.id,
1051
- kind: edge.kind,
1052
- fromKind: edge.from.kind,
1053
- fromId: edge.from.id,
1054
- toKind: edge.to.kind,
1055
- toId: edge.to.id,
1056
- props,
1057
- ...windowFence,
1058
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1059
- });
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
+ );
1060
1101
  return void 0;
1061
1102
  } catch (error) {
1062
- 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") {
1063
1104
  throw error;
1064
1105
  }
1065
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.`;
@@ -1069,9 +1110,9 @@ function windowResultOf(assert) {
1069
1110
  try {
1070
1111
  return { ok: true, value: assert() };
1071
1112
  } catch (error) {
1072
- if (error instanceof chunkMRDBBHIZ_cjs.ValidationError) {
1113
+ if (error instanceof chunkX4GDXBOP_cjs.ValidationError) {
1073
1114
  const coded = error.details.issues.find(
1074
- (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
1075
1116
  );
1076
1117
  if (coded !== void 0) {
1077
1118
  return { ok: false, error: `${coded.code}: ${error.message}` };
@@ -1089,12 +1130,12 @@ function windowErrorOf(assert) {
1089
1130
  }
1090
1131
  function validateValidityWindow(entity) {
1091
1132
  return windowErrorOf(() => {
1092
- chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
1133
+ chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(
1093
1134
  entity.validFrom ?? void 0,
1094
1135
  "validFrom"
1095
1136
  );
1096
- chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(entity.validTo, "validTo");
1097
- chunkTQHGE7UC_cjs.assertOrderedValidityWindow(
1137
+ chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(entity.validTo, "validTo");
1138
+ chunkM5MSP3BI_cjs.assertOrderedValidityWindow(
1098
1139
  `${entity.kind} "${entity.id}"`,
1099
1140
  entity.validFrom ?? void 0,
1100
1141
  entity.validTo
@@ -1103,7 +1144,7 @@ function validateValidityWindow(entity) {
1103
1144
  }
1104
1145
  function validateUpdateValidityWindow(entity, storedValidFrom) {
1105
1146
  const verdict = windowResultOf(
1106
- () => chunkTQHGE7UC_cjs.assertWritableValidityWindow(
1147
+ () => chunkM5MSP3BI_cjs.assertWritableValidityWindow(
1107
1148
  `${entity.kind} "${entity.id}"`,
1108
1149
  entity.validFrom ?? void 0,
1109
1150
  {
@@ -1118,7 +1159,7 @@ function validateUpdateValidityWindow(entity, storedValidFrom) {
1118
1159
  );
1119
1160
  return verdict.ok ? { ok: true, value: verdict.value.storedLowerBoundFence } : verdict;
1120
1161
  }
1121
- async function processNode(backend, graphId, registry, node, schemas, options, lock) {
1162
+ async function processNode(frame, graphId, registry, node, schemas, options) {
1122
1163
  const schemaEntry = schemas.get(node.kind);
1123
1164
  if (!schemaEntry) {
1124
1165
  return { status: "error", error: `Unknown node kind: ${node.kind}` };
@@ -1137,12 +1178,11 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1137
1178
  }
1138
1179
  const { registration } = schemaEntry;
1139
1180
  const uniqueConstraints = registration.unique ?? [];
1140
- const writeContext = { graphId, registry, lock };
1141
- const existing = await backend.getNode(graphId, node.kind, node.id);
1181
+ const existing = await frame.target.getNode(graphId, node.kind, node.id);
1142
1182
  if (existing) {
1143
1183
  switch (options.onConflict) {
1144
1184
  case "skip": {
1145
- return { status: "skipped", liveTarget: chunk5PRKMB24_cjs.isLiveNodeRow(existing) };
1185
+ return { status: "skipped", liveTarget: chunkGHZPZNFC_cjs.isLiveNodeRow(existing) };
1146
1186
  }
1147
1187
  case "error": {
1148
1188
  return {
@@ -1151,7 +1191,7 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1151
1191
  };
1152
1192
  }
1153
1193
  case "update": {
1154
- if (!chunk5PRKMB24_cjs.isLiveNodeRow(existing)) {
1194
+ if (!chunkGHZPZNFC_cjs.isLiveNodeRow(existing)) {
1155
1195
  return { status: "skipped", liveTarget: false };
1156
1196
  }
1157
1197
  const updateWindow = validateUpdateValidityWindow(
@@ -1161,18 +1201,13 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1161
1201
  if (!updateWindow.ok) {
1162
1202
  return { status: "error", error: updateWindow.error };
1163
1203
  }
1164
- const updateError = await updateImportedNode(
1165
- writeContext,
1166
- backend,
1167
- node,
1168
- {
1169
- existing,
1170
- schema: registration.type.schema,
1171
- validatedProps: propsResult.data,
1172
- uniqueConstraints,
1173
- windowFence: updateWindow.value
1174
- }
1175
- );
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
+ });
1176
1211
  if (updateError !== void 0) {
1177
1212
  return { status: "error", error: updateError };
1178
1213
  }
@@ -1180,45 +1215,34 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1180
1215
  }
1181
1216
  }
1182
1217
  }
1183
- const uniquenessResult = await catchUniquenessError(
1184
- () => chunk3KOY4FH3_cjs.checkUniquenessConstraints(
1185
- { graphId, registry, backend },
1218
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
1219
+ await chunkTUVD4DFR_cjs.checkUniquenessConstraints(
1220
+ { graphId, registry, backend: frame.target },
1186
1221
  node.kind,
1187
1222
  node.id,
1188
1223
  propsResult.data,
1189
1224
  uniqueConstraints
1190
- )
1191
- );
1192
- if (!uniquenessResult.ok) {
1193
- return { status: "error", error: uniquenessResult.error };
1194
- }
1195
- await backend.insertNode({
1196
- graphId,
1197
- kind: node.kind,
1198
- id: node.id,
1199
- props: propsResult.data,
1200
- ...node.validFrom !== void 0 && { validFrom: node.validFrom },
1201
- ...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
+ );
1202
1231
  });
1203
- await chunk3KOY4FH3_cjs.applyNodeInsertSideEffects(
1204
- writeContext,
1205
- {
1206
- kind: node.kind,
1207
- id: node.id,
1208
- schema: registration.type.schema,
1209
- props: propsResult.data,
1210
- uniqueConstraints
1211
- },
1212
- 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)
1213
1237
  );
1214
1238
  return { status: "created" };
1215
1239
  }
1216
- 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) {
1217
1241
  const batchSize = options.batchSize;
1218
1242
  for (let index = 0; index < edges.length; index += batchSize) {
1219
1243
  const batch = edges.slice(index, index + batchSize);
1220
1244
  await processEdgeSlice(
1221
- backend,
1245
+ frame,
1222
1246
  graphId,
1223
1247
  registry,
1224
1248
  batch,
@@ -1256,10 +1280,29 @@ function recordEdgeOutcome(edge, outcome, result, errors) {
1256
1280
  }
1257
1281
  }
1258
1282
  }
1259
- 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) {
1260
1299
  const record = (edge, outcome) => {
1261
1300
  recordEdgeOutcome(edge, outcome, result, errors);
1262
1301
  };
1302
+ const {
1303
+ backend: cardinalityValidationBackend,
1304
+ registerPendingEdgeForCardinality
1305
+ } = chunkC76WFIVZ_cjs.createEdgeBatchValidationBackend(frame.target);
1263
1306
  const candidates = [];
1264
1307
  const deferred = [];
1265
1308
  const seenIds = /* @__PURE__ */ new Set();
@@ -1286,7 +1329,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1286
1329
  });
1287
1330
  continue;
1288
1331
  }
1289
- const endpointError = chunkFQPEMEWX_cjs.validateEdgeEndpoints(
1332
+ const endpointError = chunkLLVOQOWE_cjs.validateEdgeEndpoints(
1290
1333
  edge.kind,
1291
1334
  edge.from.kind,
1292
1335
  edge.to.kind,
@@ -1320,7 +1363,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1320
1363
  }
1321
1364
  const liveEndpointKeys = /* @__PURE__ */ new Set();
1322
1365
  const checkedEndpointKeys = /* @__PURE__ */ new Set();
1323
- if (options.validateReferences && backend.getNodes !== void 0) {
1366
+ if (options.validateReferences && frame.target.getNodes !== void 0) {
1324
1367
  const idsByKind = /* @__PURE__ */ new Map();
1325
1368
  for (const { edge } of candidates) {
1326
1369
  for (const endpoint of [edge.from, edge.to]) {
@@ -1333,9 +1376,9 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1333
1376
  }
1334
1377
  }
1335
1378
  for (const [kind, ids] of idsByKind) {
1336
- const rows = await backend.getNodes(graphId, kind, [...ids]);
1379
+ const rows = await frame.target.getNodes(graphId, kind, [...ids]);
1337
1380
  for (const row of rows) {
1338
- if (chunk5PRKMB24_cjs.isLiveNodeRow(row)) {
1381
+ if (chunkGHZPZNFC_cjs.isLiveNodeRow(row)) {
1339
1382
  liveEndpointKeys.add(makeNodeKey(kind, row.id));
1340
1383
  }
1341
1384
  }
@@ -1345,12 +1388,12 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1345
1388
  const key = makeNodeKey(endpoint.kind, endpoint.id);
1346
1389
  if (importedNodeIds.has(key)) return true;
1347
1390
  if (checkedEndpointKeys.has(key)) return liveEndpointKeys.has(key);
1348
- const row = await backend.getNode(graphId, endpoint.kind, endpoint.id);
1349
- 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);
1350
1393
  };
1351
1394
  const existingById = /* @__PURE__ */ new Map();
1352
- if (candidates.length > 0 && backend.getEdges !== void 0) {
1353
- const rows = await backend.getEdges(
1395
+ if (candidates.length > 0 && frame.target.getEdges !== void 0) {
1396
+ const rows = await frame.target.getEdges(
1354
1397
  graphId,
1355
1398
  candidates.map((candidate) => candidate.edge.id)
1356
1399
  );
@@ -1380,7 +1423,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1380
1423
  continue;
1381
1424
  }
1382
1425
  }
1383
- 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);
1384
1427
  if (existing) {
1385
1428
  const identityConflict = edgeIdentityConflict(edge, existing);
1386
1429
  if (identityConflict !== void 0) {
@@ -1416,8 +1459,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1416
1459
  break;
1417
1460
  }
1418
1461
  const updateError = await updateImportedEdge(
1419
- backend,
1420
- graphId,
1462
+ frame.session,
1421
1463
  edge,
1422
1464
  props,
1423
1465
  updateWindow.value
@@ -1432,28 +1474,37 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1432
1474
  }
1433
1475
  continue;
1434
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);
1435
1496
  accepted.push(candidate);
1436
1497
  }
1437
1498
  if (accepted.length > 0) {
1438
- const insertParamsList = accepted.map(({ edge, props }) => ({
1439
- graphId,
1440
- id: edge.id,
1441
- kind: edge.kind,
1442
- fromKind: edge.from.kind,
1443
- fromId: edge.from.id,
1444
- toKind: edge.to.kind,
1445
- toId: edge.to.id,
1446
- props,
1447
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1448
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1449
- }));
1450
- if (backend.insertEdgesBatch === void 0) {
1451
- for (const params of insertParamsList) {
1452
- await backend.insertEdge(params);
1453
- }
1454
- } else {
1455
- await backend.insertEdgesBatch(insertParamsList);
1456
- }
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
+ );
1457
1508
  for (const candidate of accepted) {
1458
1509
  record(candidate.edge, { status: "created" });
1459
1510
  }
@@ -1462,7 +1513,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1462
1513
  record(
1463
1514
  edge,
1464
1515
  await processEdge(
1465
- backend,
1516
+ frame,
1466
1517
  graphId,
1467
1518
  registry,
1468
1519
  edge,
@@ -1474,7 +1525,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1474
1525
  );
1475
1526
  }
1476
1527
  }
1477
- async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1528
+ async function processEdge(frame, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1478
1529
  const schemaEntry = edgeSchemas.get(edge.kind);
1479
1530
  if (!schemaEntry) {
1480
1531
  return { status: "error", error: `Unknown edge kind: ${edge.kind}` };
@@ -1488,7 +1539,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1488
1539
  if (!nodeSchemas.has(edge.to.kind)) {
1489
1540
  return { status: "error", error: `Unknown to node kind: ${edge.to.kind}` };
1490
1541
  }
1491
- const endpointError = chunkFQPEMEWX_cjs.validateEdgeEndpoints(
1542
+ const endpointError = chunkLLVOQOWE_cjs.validateEdgeEndpoints(
1492
1543
  edge.kind,
1493
1544
  edge.from.kind,
1494
1545
  edge.to.kind,
@@ -1502,12 +1553,12 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1502
1553
  const fromKey = makeNodeKey(edge.from.kind, edge.from.id);
1503
1554
  const toKey = makeNodeKey(edge.to.kind, edge.to.id);
1504
1555
  if (!importedNodeIds.has(fromKey)) {
1505
- const fromExists = await backend.getNode(
1556
+ const fromExists = await frame.target.getNode(
1506
1557
  graphId,
1507
1558
  edge.from.kind,
1508
1559
  edge.from.id
1509
1560
  );
1510
- if (fromExists === void 0 || !chunk5PRKMB24_cjs.isLiveNodeRow(fromExists)) {
1561
+ if (fromExists === void 0 || !chunkGHZPZNFC_cjs.isLiveNodeRow(fromExists)) {
1511
1562
  return {
1512
1563
  status: "error",
1513
1564
  error: `From node not found: ${edge.from.kind}:${edge.from.id}`
@@ -1515,8 +1566,12 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1515
1566
  }
1516
1567
  }
1517
1568
  if (!importedNodeIds.has(toKey)) {
1518
- const toExists = await backend.getNode(graphId, edge.to.kind, edge.to.id);
1519
- 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)) {
1520
1575
  return {
1521
1576
  status: "error",
1522
1577
  error: `To node not found: ${edge.to.kind}:${edge.to.id}`
@@ -1536,7 +1591,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1536
1591
  if (validityError !== void 0) {
1537
1592
  return { status: "error", error: validityError };
1538
1593
  }
1539
- const existing = await backend.getEdge(graphId, edge.id);
1594
+ const existing = await frame.target.getEdge(graphId, edge.id);
1540
1595
  if (existing) {
1541
1596
  const identityConflict = edgeIdentityConflict(edge, existing);
1542
1597
  if (identityConflict !== void 0) {
@@ -1564,8 +1619,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1564
1619
  return { status: "error", error: updateWindow.error };
1565
1620
  }
1566
1621
  const updateError = await updateImportedEdge(
1567
- backend,
1568
- graphId,
1622
+ frame.session,
1569
1623
  edge,
1570
1624
  propsResult.data,
1571
1625
  updateWindow.value
@@ -1577,20 +1631,36 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1577
1631
  }
1578
1632
  }
1579
1633
  }
1580
- await backend.insertEdge({
1581
- graphId,
1582
- id: edge.id,
1583
- kind: edge.kind,
1584
- fromKind: edge.from.kind,
1585
- fromId: edge.from.id,
1586
- toKind: edge.to.kind,
1587
- toId: edge.to.id,
1588
- props: propsResult.data,
1589
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1590
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1591
- });
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
+ );
1592
1657
  return { status: "created" };
1593
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
+ }
1594
1664
  function validateProperties(properties, schema, unknownStrategy) {
1595
1665
  try {
1596
1666
  const knownKeys = new Set(Object.keys(schema.shape));
@@ -1653,7 +1723,7 @@ function formatZodError(error) {
1653
1723
  }).join("; ");
1654
1724
  }
1655
1725
  function makeNodeKey(kind, id) {
1656
- return chunkEZEEWCFJ_cjs.encodeTupleKey([kind, id]);
1726
+ return chunkLLVOQOWE_cjs.encodeTupleKey([kind, id]);
1657
1727
  }
1658
1728
 
1659
1729
  // src/interchange/export.ts
@@ -1696,7 +1766,7 @@ async function exportGraph(store, options) {
1696
1766
  };
1697
1767
  }
1698
1768
  function exportGraphStream(store, options) {
1699
- const backend = chunk3KOY4FH3_cjs.storeBackend(store);
1769
+ const backend = chunkTUVD4DFR_cjs.storeBackend(store);
1700
1770
  return markExportStreamBackend(
1701
1771
  exportGraphStreamFromBackend(store, backend, options),
1702
1772
  backend
@@ -1707,7 +1777,7 @@ async function* exportGraphStreamFromBackend(store, backend, options) {
1707
1777
  const exportsIdentity = store.graph.identity !== void 0;
1708
1778
  const explicitlyDisabledTemporalFields = options?.includeTemporal === false;
1709
1779
  if (exportsIdentity && explicitlyDisabledTemporalFields) {
1710
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
1780
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
1711
1781
  "Identity export requires temporal endpoint fields.",
1712
1782
  {
1713
1783
  code: "IDENTITY_EXPORT_REQUIRES_TEMPORAL_FIELDS",
@@ -1741,7 +1811,7 @@ async function* exportGraphStreamFromBackend(store, backend, options) {
1741
1811
  idleTimer = void 0;
1742
1812
  unsubscribeFromSignal();
1743
1813
  channel.abort(
1744
- new chunkMRDBBHIZ_cjs.ExportStreamIdleTimeoutError(
1814
+ new chunkX4GDXBOP_cjs.ExportStreamIdleTimeoutError(
1745
1815
  store.graphId,
1746
1816
  idleTimeoutMs,
1747
1817
  backend.capabilities.transactions
@@ -1834,7 +1904,7 @@ function exportStreamCancelled(phase, graphId, signal, framed) {
1834
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.";
1835
1905
  const cause = signal?.reason;
1836
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.";
1837
- return new chunkMRDBBHIZ_cjs.ExportStreamCancelledError(
1907
+ return new chunkX4GDXBOP_cjs.ExportStreamCancelledError(
1838
1908
  message,
1839
1909
  { graphId },
1840
1910
  {
@@ -1844,7 +1914,7 @@ function exportStreamCancelled(phase, graphId, signal, framed) {
1844
1914
  );
1845
1915
  }
1846
1916
  function claimSnapshotExportLeaseOrRefuse(graphId, backend) {
1847
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(backend, "export-snapshot");
1917
+ const lease = chunkZBFZGLZE_cjs.acquireSerializedStreamLease(backend, "export-snapshot");
1848
1918
  if (!lease.acquired) {
1849
1919
  throw serializedStreamRefusal({
1850
1920
  graphId,
@@ -1856,14 +1926,14 @@ function claimSnapshotExportLeaseOrRefuse(graphId, backend) {
1856
1926
  }
1857
1927
  async function produceExportChunks(store, backend, options, emit) {
1858
1928
  const graphId = store.graphId;
1859
- const nodeKinds = options.nodeKinds ?? chunkBFUOME67_cjs.getNodeKinds(store.graph);
1860
- 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);
1861
1931
  const schemaVersion = await backend.getActiveSchema(graphId);
1862
1932
  await emit({
1863
1933
  type: "header",
1864
1934
  header: {
1865
1935
  formatVersion: FORMAT_VERSION,
1866
- exportedAt: chunkTQHGE7UC_cjs.nowIso(),
1936
+ exportedAt: chunkM5MSP3BI_cjs.nowIso(),
1867
1937
  source: {
1868
1938
  type: "typegraph-export",
1869
1939
  graphId,
@@ -1900,7 +1970,7 @@ async function produceExportChunks(store, backend, options, emit) {
1900
1970
  if (store.graph.identity === void 0) return;
1901
1971
  let after;
1902
1972
  for (; ; ) {
1903
- const page = await chunk3KOY4FH3_cjs.storeRuntime(store).readIdentityAssertionPageAtTarget(
1973
+ const page = await chunkTUVD4DFR_cjs.storeRuntime(store).readIdentityAssertionPageAtTarget(
1904
1974
  backend,
1905
1975
  options.identityMode,
1906
1976
  {
@@ -2049,7 +2119,7 @@ async function* exportNodeChunks(backend, graphId, kind, options) {
2049
2119
  const node = {
2050
2120
  kind: row.kind,
2051
2121
  id: row.id,
2052
- properties: chunk5PRKMB24_cjs.rowPropsToObject(row.props)
2122
+ properties: chunkGHZPZNFC_cjs.rowPropsToObject(row.props)
2053
2123
  };
2054
2124
  if (options.includeTemporal) {
2055
2125
  const validFrom = (
@@ -2099,7 +2169,7 @@ async function* exportEdgeChunks(backend, graphId, kind, options) {
2099
2169
  kind: row.to_kind,
2100
2170
  id: row.to_id
2101
2171
  },
2102
- properties: chunk5PRKMB24_cjs.rowPropsToObject(row.props)
2172
+ properties: chunkGHZPZNFC_cjs.rowPropsToObject(row.props)
2103
2173
  };
2104
2174
  if (options.includeTemporal) {
2105
2175
  const validFrom = (
@@ -2147,7 +2217,8 @@ exports.exportGraphStream = exportGraphStream;
2147
2217
  exports.exportStreamBackend = exportStreamBackend;
2148
2218
  exports.importGraph = importGraph;
2149
2219
  exports.importGraphStream = importGraphStream;
2220
+ exports.registerIngestionImportTarget = registerIngestionImportTarget;
2150
2221
  exports.serializedStreamRefusal = serializedStreamRefusal;
2151
2222
  exports.withImportStreamLease = withImportStreamLease;
2152
- //# sourceMappingURL=chunk-OTUPEF2W.cjs.map
2153
- //# sourceMappingURL=chunk-OTUPEF2W.cjs.map
2223
+ //# sourceMappingURL=chunk-CS6JTQQ2.cjs.map
2224
+ //# sourceMappingURL=chunk-CS6JTQQ2.cjs.map