@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,13 +1,14 @@
1
- import { createNodeBatchValidationBackend, primeBatchValidationCaches } from './chunk-KF6K7TGH.js';
2
- import { storeBackend, storeRuntime, applyNodeInsertSideEffectsBatch, applyNodeUpdate, checkUniquenessConstraints, applyNodeInsertSideEffects } from './chunk-I4GAZH5Z.js';
3
- import { runInWriteTransaction, IDENTITY_IMPORT_PROGRESS, IDENTITY_IMPORT_FAILED_ASSERTION } from './chunk-ZFMCDJGB.js';
4
- import { encodeTupleKey } from './chunk-S5TERQVW.js';
5
- import { acquireSerializedStreamLease, snapshotExportContention } from './chunk-UGHG7PGX.js';
6
- import { isLiveNodeRow, rowPropsToObject } from './chunk-6LN7FIVU.js';
7
- import { getNodeKinds, getEdgeKinds } from './chunk-HEV35TGT.js';
8
- import { validateEdgeEndpoints } from './chunk-GLHXM7C4.js';
9
- import { isCanonicalIsoDate, nowIso, assertWritableValidityWindow, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow } from './chunk-5K2BKEBD.js';
10
- import { ConfigurationError, ValidationError, ExportStreamCancelledError, ExportStreamIdleTimeoutError, NodeNotFoundError, IdentityContradictionError, DatabaseOperationError, UniquenessError, INVERTED_VALIDITY_WINDOW_CODE, IMMUTABLE_VALIDITY_LOWER_BOUND_CODE } from './chunk-ZLONH2UD.js';
1
+ import { graphOwesClaims, runWritePlan, mixedWritePlan, createNodeBatchValidationSeams, primeBatchValidationCaches, createEdgeBatchValidationBackend, checkDisjointnessConstraint, checkCardinalityConstraint } from './chunk-2GIV5X4P.js';
2
+ import { storeBackend, storeRuntime, checkUniquenessConstraints } from './chunk-VTJVMP4I.js';
3
+ import { edgeCardinalityClaim } from './chunk-YA36ABIL.js';
4
+ import { IDENTITY_IMPORT_PROGRESS, IDENTITY_IMPORT_FAILED_ASSERTION } from './chunk-GVYVGGPJ.js';
5
+ import { constraintFenceRefusal } from './chunk-FX5ZW6PN.js';
6
+ import { acquireSerializedStreamLease, snapshotExportContention } from './chunk-IRPYOHRC.js';
7
+ import { isLiveNodeRow, rowPropsToObject } from './chunk-PALYTHGM.js';
8
+ import { getNodeKinds, getEdgeKinds } from './chunk-DI6VC62F.js';
9
+ import { encodeTupleKey, validateEdgeEndpoints } from './chunk-5LKOVCPP.js';
10
+ import { isCanonicalIsoDate, nowIso, assertWritableValidityWindow, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow } from './chunk-K46SDNQD.js';
11
+ import { ConfigurationError, ValidationError, ExportStreamCancelledError, ExportStreamIdleTimeoutError, NodeNotFoundError, IdentityContradictionError, DatabaseOperationError, UniquenessError, DisjointError, CardinalityError, INVERTED_VALIDITY_WINDOW_CODE, IMMUTABLE_VALIDITY_LOWER_BOUND_CODE } from './chunk-YDEJQWOL.js';
11
12
  import { requireDefined, createDataKeyedBag, hasOwnKey } from './chunk-DYATYRY4.js';
12
13
  import { z } from 'zod';
13
14
 
@@ -238,6 +239,29 @@ var ExportStreamOptionsSchema = ExportOptionsSchema.extend({
238
239
  batchSize: z.number().int().positive().default(1e3)
239
240
  });
240
241
 
242
+ // src/interchange/ingestion-import-target.ts
243
+ var INGESTION_IMPORT_TARGETS = /* @__PURE__ */ new WeakMap();
244
+ function registerIngestionImportTarget(handle, store) {
245
+ INGESTION_IMPORT_TARGETS.set(handle, store);
246
+ }
247
+ function resolveIngestionImportTarget(target) {
248
+ const registeredStore = INGESTION_IMPORT_TARGETS.get(target);
249
+ if (registeredStore !== void 0) return registeredStore;
250
+ try {
251
+ storeBackend(target);
252
+ return target;
253
+ } catch (error) {
254
+ throw new ConfigurationError(
255
+ "Interchange import received an unrecognized ingestion target",
256
+ { target: "unregistered-ingestion-target" },
257
+ {
258
+ cause: error,
259
+ suggestion: "Pass a Store or the exact handle returned by ingestionBranch() from this TypeGraph installation."
260
+ }
261
+ );
262
+ }
263
+ }
264
+
241
265
  // src/interchange/stream-source.ts
242
266
  var EXPORT_STREAM_BACKENDS = /* @__PURE__ */ new WeakMap();
243
267
  function markExportStreamBackend(stream, backend) {
@@ -249,7 +273,8 @@ function exportStreamBackend(stream) {
249
273
  }
250
274
 
251
275
  // src/interchange/import.ts
252
- async function importGraph(store, data, rawOptions) {
276
+ async function importGraph(target, data, rawOptions) {
277
+ const store = resolveIngestionImportTarget(target);
253
278
  const options = ImportOptionsSchema.parse(rawOptions);
254
279
  return withImportStreamLease(
255
280
  store,
@@ -284,22 +309,34 @@ async function importGraphData(store, data, options) {
284
309
  const backend = storeBackend(store);
285
310
  const runtime = storeRuntime(store);
286
311
  const registry = store.registry;
312
+ const owedClaimReason = graphOwesClaims(graph, registry);
313
+ const claimRefusal = owedClaimReason === void 0 ? void 0 : constraintFenceRefusal({ graphId }, backend, owedClaimReason);
314
+ if (claimRefusal !== void 0) throw claimRefusal;
287
315
  const nodeSchemas = buildNodeSchemaMap(graph);
288
316
  const edgeSchemas = buildEdgeSchemaMap(graph);
289
317
  const importedNodeIds = /* @__PURE__ */ new Set();
290
- await runInWriteTransaction(
318
+ await runWritePlan(
291
319
  {
292
320
  graphId,
321
+ registry,
293
322
  schemaVersion: store.introspect().schemaVersion,
294
323
  historyEnabled: store.historyEnabled,
295
324
  revisionTrackingEnabled: store.revisionTrackingEnabled,
296
- revisionSchema: store.revisionSchema
325
+ revisionSchema: store.revisionSchema,
326
+ // HOW this caller takes position 3. `lockIdentityImportTarget` is
327
+ // `lockIdentityGraph` on an identity graph and a no-op otherwise, so the
328
+ // participation below is unconditional and the acquirer owns the
329
+ // "identity is configured" test, exactly as before the migration.
330
+ identityLock: (target) => runtime.lockIdentityImportTarget(target)
297
331
  },
332
+ // An import writes node rows AND edge rows in one frame, so it declares the
333
+ // mixed family explicitly instead of receiving either narrower session.
334
+ mixedWritePlan(void 0, true),
298
335
  backend,
299
- async (target, lock) => {
300
- await runtime.lockIdentityImportTarget(target);
336
+ async (session, target, overlaidSession) => {
337
+ const frame = { session, target, overlaidSession };
301
338
  await processNodes(
302
- target,
339
+ frame,
303
340
  graphId,
304
341
  registry,
305
342
  data.nodes,
@@ -307,8 +344,7 @@ async function importGraphData(store, data, options) {
307
344
  options,
308
345
  result,
309
346
  errors,
310
- importedNodeIds,
311
- lock
347
+ importedNodeIds
312
348
  );
313
349
  await runtime.foldImportedIdentityNodes(
314
350
  target,
@@ -317,7 +353,7 @@ async function importGraphData(store, data, options) {
317
353
  ).map((node) => ({ kind: node.kind, id: node.id }))
318
354
  );
319
355
  await processEdges(
320
- target,
356
+ frame,
321
357
  graphId,
322
358
  registry,
323
359
  data.edges,
@@ -347,7 +383,8 @@ async function importGraphData(store, data, options) {
347
383
  errors
348
384
  };
349
385
  }
350
- async function importGraphStream(store, chunks, rawOptions) {
386
+ async function importGraphStream(target, chunks, rawOptions) {
387
+ const store = resolveIngestionImportTarget(target);
351
388
  const options = ImportOptionsSchema.parse(rawOptions);
352
389
  const sourceBackend = exportStreamBackend(chunks);
353
390
  const targetBackend = storeBackend(store);
@@ -727,12 +764,12 @@ function buildEdgeSchemaMap(graph) {
727
764
  }
728
765
  return map;
729
766
  }
730
- async function processNodes(backend, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds, lock) {
767
+ async function processNodes(frame, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds) {
731
768
  const batchSize = options.batchSize;
732
769
  for (let index = 0; index < nodes.length; index += batchSize) {
733
770
  const batch = nodes.slice(index, index + batchSize);
734
771
  await processNodeSlice(
735
- backend,
772
+ frame,
736
773
  graphId,
737
774
  registry,
738
775
  batch,
@@ -740,8 +777,7 @@ async function processNodes(backend, graphId, registry, nodes, schemas, options,
740
777
  options,
741
778
  result,
742
779
  errors,
743
- importedNodeIds,
744
- lock
780
+ importedNodeIds
745
781
  );
746
782
  }
747
783
  }
@@ -775,7 +811,7 @@ function recordNodeOutcome(node, outcome, result, errors, importedNodeIds) {
775
811
  }
776
812
  }
777
813
  }
778
- async function processNodeSlice(backend, graphId, registry, batch, schemas, options, result, errors, importedNodeIds, lock) {
814
+ async function processNodeSlice(frame, graphId, registry, batch, schemas, options, result, errors, importedNodeIds) {
779
815
  const record = (node, outcome) => {
780
816
  recordNodeOutcome(node, outcome, result, errors, importedNodeIds);
781
817
  };
@@ -834,20 +870,21 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
834
870
  });
835
871
  }
836
872
  const {
837
- backend: validationBackend,
873
+ reads,
874
+ reader: validationBackend,
838
875
  registerPendingNode,
839
876
  registerPendingUniqueEntries,
840
877
  registerAppliedNodeUpdate,
841
878
  seedNodeRow,
842
879
  seedUniqueRow
843
- } = createNodeBatchValidationBackend(graphId, registry, backend);
880
+ } = createNodeBatchValidationSeams(graphId, registry, frame.target);
844
881
  await primeBatchValidationCaches(
845
882
  { graphId, registry },
846
883
  candidates.map((candidate) => candidate.draft),
847
- backend,
884
+ frame.target,
848
885
  { seedNodeRow, seedUniqueRow }
849
886
  );
850
- const writeContext = { graphId, registry, lock };
887
+ const overlaidSession = frame.overlaidSession(reads);
851
888
  const accepted = [];
852
889
  for (const candidate of candidates) {
853
890
  const { node, schemaEntry, props } = candidate;
@@ -886,25 +923,13 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
886
923
  record(node, { status: "error", error: updateWindow.error });
887
924
  break;
888
925
  }
889
- const updateError = await updateImportedNode(
890
- writeContext,
891
- // The pending-aware overlay, not the raw backend: the update's
892
- // uniqueness pre-check must see a unique value already reserved by
893
- // an unflushed create EARLIER in this slice, so it degrades to a
894
- // per-row error exactly as the sequential path does — rather than
895
- // claiming the key on the real backend and colliding with that
896
- // create at flush (which would throw and roll back the whole
897
- // import). Writes still delegate to the real backend.
898
- validationBackend,
899
- node,
900
- {
901
- existing,
902
- schema: schemaEntry.registration.type.schema,
903
- validatedProps: props,
904
- uniqueConstraints,
905
- windowFence: updateWindow.value
906
- }
907
- );
926
+ const updateError = await updateImportedNode(overlaidSession, node, {
927
+ existing,
928
+ schema: schemaEntry.registration.type.schema,
929
+ validatedProps: props,
930
+ uniqueConstraints,
931
+ windowFence: updateWindow.value
932
+ });
908
933
  if (updateError === void 0) {
909
934
  registerAppliedNodeUpdate(
910
935
  node.kind,
@@ -923,44 +948,38 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
923
948
  }
924
949
  continue;
925
950
  }
926
- const uniquenessResult = await catchUniquenessError(
927
- () => checkUniquenessConstraints(
951
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
952
+ await checkUniquenessConstraints(
928
953
  { graphId, registry, backend: validationBackend },
929
954
  node.kind,
930
955
  node.id,
931
956
  props,
932
957
  uniqueConstraints
933
- )
934
- );
935
- if (!uniquenessResult.ok) {
936
- record(node, { status: "error", error: uniquenessResult.error });
958
+ );
959
+ await checkDisjointnessConstraint(
960
+ { graphId, registry, backend: validationBackend },
961
+ node.kind,
962
+ node.id
963
+ );
964
+ });
965
+ if (!constraintResult.ok) {
966
+ record(node, { status: "error", error: constraintResult.error });
937
967
  continue;
938
968
  }
939
- registerPendingNode(buildImportInsertParams(graphId, candidate));
969
+ registerPendingNode(buildImportInsertParams(graphId, node, props));
940
970
  registerPendingUniqueEntries(node.kind, node.id, props, uniqueConstraints);
941
971
  accepted.push(candidate);
942
972
  }
943
973
  if (accepted.length > 0) {
944
- const insertParamsList = accepted.map(
945
- (candidate) => buildImportInsertParams(graphId, candidate)
946
- );
947
- if (backend.insertNodesBatch === void 0) {
948
- for (const params of insertParamsList) {
949
- await backend.insertNode(params);
950
- }
951
- } else {
952
- await backend.insertNodesBatch(insertParamsList);
953
- }
954
- await applyNodeInsertSideEffectsBatch(
955
- writeContext,
956
- accepted.map((candidate) => ({
957
- kind: candidate.node.kind,
958
- id: candidate.node.id,
959
- schema: candidate.schemaEntry.registration.type.schema,
960
- props: candidate.props,
961
- uniqueConstraints: candidate.schemaEntry.registration.unique ?? []
962
- })),
963
- backend
974
+ await frame.session.createNodesNoReturn(
975
+ accepted.map(
976
+ (candidate) => importNodeInsertWork(
977
+ graphId,
978
+ candidate.node,
979
+ candidate.schemaEntry.registration,
980
+ candidate.props
981
+ )
982
+ )
964
983
  );
965
984
  for (const candidate of accepted) {
966
985
  record(candidate.node, { status: "created" });
@@ -969,20 +988,11 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
969
988
  for (const node of deferred) {
970
989
  record(
971
990
  node,
972
- await processNode(
973
- backend,
974
- graphId,
975
- registry,
976
- node,
977
- schemas,
978
- options,
979
- lock
980
- )
991
+ await processNode(frame, graphId, registry, node, schemas, options)
981
992
  );
982
993
  }
983
994
  }
984
- function buildImportInsertParams(graphId, candidate) {
985
- const { node, props } = candidate;
995
+ function buildImportInsertParams(graphId, node, props) {
986
996
  return {
987
997
  graphId,
988
998
  kind: node.kind,
@@ -992,31 +1002,53 @@ function buildImportInsertParams(graphId, candidate) {
992
1002
  ...node.validTo !== void 0 && { validTo: node.validTo }
993
1003
  };
994
1004
  }
995
- async function catchUniquenessError(fn) {
1005
+ function importNodeInsertWork(graphId, node, registration, props) {
1006
+ return {
1007
+ params: buildImportInsertParams(graphId, node, props),
1008
+ claim: {
1009
+ kind: node.kind,
1010
+ id: node.id,
1011
+ props,
1012
+ constraints: registration.unique ?? []
1013
+ },
1014
+ sideEffects: {
1015
+ kind: node.kind,
1016
+ id: node.id,
1017
+ schema: registration.type.schema,
1018
+ props,
1019
+ uniqueConstraints: registration.unique ?? []
1020
+ }
1021
+ };
1022
+ }
1023
+ async function catchDeclaredConstraintRefusal(fn) {
996
1024
  try {
997
1025
  return { ok: true, value: await fn() };
998
1026
  } catch (error) {
999
- if (error instanceof UniquenessError) {
1027
+ if (error instanceof UniquenessError || error instanceof DisjointError || error instanceof CardinalityError) {
1000
1028
  return { ok: false, error: error.message };
1001
1029
  }
1002
1030
  throw error;
1003
1031
  }
1004
1032
  }
1005
1033
  var NODE_UPDATE_TARGET_CHANGED_CODE = "INTERCHANGE_NODE_UPDATE_TARGET_CHANGED";
1006
- async function updateImportedNode(writeContext, backend, node, args) {
1034
+ async function updateImportedNode(session, node, args) {
1007
1035
  try {
1008
- const result = await catchUniquenessError(
1009
- () => applyNodeUpdate(
1010
- writeContext,
1011
- {
1012
- existing: args.existing,
1013
- schema: args.schema,
1014
- validatedProps: args.validatedProps,
1015
- uniqueConstraints: args.uniqueConstraints,
1016
- ...args.windowFence,
1017
- ...node.validTo !== void 0 && { validTo: node.validTo }
1018
- },
1019
- backend
1036
+ const result = await catchDeclaredConstraintRefusal(
1037
+ () => (
1038
+ // The fence is an ARGUMENT the method requires, not a spread the call
1039
+ // site may forget: the guard's verdict travels to the statement that
1040
+ // honors it, and an empty fence (`{}`) is the stated decision to assert
1041
+ // nothing rather than an omission.
1042
+ session.reviseNode(
1043
+ {
1044
+ existing: args.existing,
1045
+ schema: args.schema,
1046
+ validatedProps: args.validatedProps,
1047
+ uniqueConstraints: args.uniqueConstraints,
1048
+ ...node.validTo !== void 0 && { validTo: node.validTo }
1049
+ },
1050
+ { validityLowerBound: args.windowFence }
1051
+ )
1020
1052
  )
1021
1053
  );
1022
1054
  return result.ok ? void 0 : result.error;
@@ -1041,20 +1073,29 @@ function edgeIdentityConflict(edge, existing) {
1041
1073
  if (differences.length === 0) return void 0;
1042
1074
  return `${EDGE_IDENTITY_CONFLICT_CODE}: Edge "${edge.id}" already exists with a different immutable identity \u2014 ${differences.join("; ")}. Edge ids are unique per graph, so the incoming edge can neither update nor be created under that id. Give it a distinct id, or import it under the identity the stored row already carries.`;
1043
1075
  }
1044
- async function updateImportedEdge(backend, graphId, edge, props, windowFence) {
1076
+ async function updateImportedEdge(session, edge, props, windowFence) {
1045
1077
  try {
1046
- await backend.updateEdge({
1047
- graphId,
1048
- id: edge.id,
1049
- kind: edge.kind,
1050
- fromKind: edge.from.kind,
1051
- fromId: edge.from.id,
1052
- toKind: edge.to.kind,
1053
- toId: edge.to.id,
1054
- props,
1055
- ...windowFence,
1056
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1057
- });
1078
+ await session.reviseEdge(
1079
+ {
1080
+ id: edge.id,
1081
+ props,
1082
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1083
+ },
1084
+ {
1085
+ validityLowerBound: windowFence,
1086
+ // Import re-admits no row to a counted population — it never resurrects
1087
+ // and never clears an end — so it reads no stored `valid_to` and asserts
1088
+ // none. `{}` is the stated decision, not an omission.
1089
+ validityUpperBound: {},
1090
+ edgeIdentity: {
1091
+ kind: edge.kind,
1092
+ fromKind: edge.from.kind,
1093
+ fromId: edge.from.id,
1094
+ toKind: edge.to.kind,
1095
+ toId: edge.to.id
1096
+ }
1097
+ }
1098
+ );
1058
1099
  return void 0;
1059
1100
  } catch (error) {
1060
1101
  if (!(error instanceof DatabaseOperationError) || error.details.reason !== "no_row_returned") {
@@ -1116,7 +1157,7 @@ function validateUpdateValidityWindow(entity, storedValidFrom) {
1116
1157
  );
1117
1158
  return verdict.ok ? { ok: true, value: verdict.value.storedLowerBoundFence } : verdict;
1118
1159
  }
1119
- async function processNode(backend, graphId, registry, node, schemas, options, lock) {
1160
+ async function processNode(frame, graphId, registry, node, schemas, options) {
1120
1161
  const schemaEntry = schemas.get(node.kind);
1121
1162
  if (!schemaEntry) {
1122
1163
  return { status: "error", error: `Unknown node kind: ${node.kind}` };
@@ -1135,8 +1176,7 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1135
1176
  }
1136
1177
  const { registration } = schemaEntry;
1137
1178
  const uniqueConstraints = registration.unique ?? [];
1138
- const writeContext = { graphId, registry, lock };
1139
- const existing = await backend.getNode(graphId, node.kind, node.id);
1179
+ const existing = await frame.target.getNode(graphId, node.kind, node.id);
1140
1180
  if (existing) {
1141
1181
  switch (options.onConflict) {
1142
1182
  case "skip": {
@@ -1159,18 +1199,13 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1159
1199
  if (!updateWindow.ok) {
1160
1200
  return { status: "error", error: updateWindow.error };
1161
1201
  }
1162
- const updateError = await updateImportedNode(
1163
- writeContext,
1164
- backend,
1165
- node,
1166
- {
1167
- existing,
1168
- schema: registration.type.schema,
1169
- validatedProps: propsResult.data,
1170
- uniqueConstraints,
1171
- windowFence: updateWindow.value
1172
- }
1173
- );
1202
+ const updateError = await updateImportedNode(frame.session, node, {
1203
+ existing,
1204
+ schema: registration.type.schema,
1205
+ validatedProps: propsResult.data,
1206
+ uniqueConstraints,
1207
+ windowFence: updateWindow.value
1208
+ });
1174
1209
  if (updateError !== void 0) {
1175
1210
  return { status: "error", error: updateError };
1176
1211
  }
@@ -1178,45 +1213,34 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1178
1213
  }
1179
1214
  }
1180
1215
  }
1181
- const uniquenessResult = await catchUniquenessError(
1182
- () => checkUniquenessConstraints(
1183
- { graphId, registry, backend },
1216
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
1217
+ await checkUniquenessConstraints(
1218
+ { graphId, registry, backend: frame.target },
1184
1219
  node.kind,
1185
1220
  node.id,
1186
1221
  propsResult.data,
1187
1222
  uniqueConstraints
1188
- )
1189
- );
1190
- if (!uniquenessResult.ok) {
1191
- return { status: "error", error: uniquenessResult.error };
1192
- }
1193
- await backend.insertNode({
1194
- graphId,
1195
- kind: node.kind,
1196
- id: node.id,
1197
- props: propsResult.data,
1198
- ...node.validFrom !== void 0 && { validFrom: node.validFrom },
1199
- ...node.validTo !== void 0 && { validTo: node.validTo }
1223
+ );
1224
+ await checkDisjointnessConstraint(
1225
+ { graphId, registry, backend: frame.target },
1226
+ node.kind,
1227
+ node.id
1228
+ );
1200
1229
  });
1201
- await applyNodeInsertSideEffects(
1202
- writeContext,
1203
- {
1204
- kind: node.kind,
1205
- id: node.id,
1206
- schema: registration.type.schema,
1207
- props: propsResult.data,
1208
- uniqueConstraints
1209
- },
1210
- backend
1230
+ if (!constraintResult.ok) {
1231
+ return { status: "error", error: constraintResult.error };
1232
+ }
1233
+ await frame.session.createNode(
1234
+ importNodeInsertWork(graphId, node, registration, propsResult.data)
1211
1235
  );
1212
1236
  return { status: "created" };
1213
1237
  }
1214
- async function processEdges(backend, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1238
+ async function processEdges(frame, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1215
1239
  const batchSize = options.batchSize;
1216
1240
  for (let index = 0; index < edges.length; index += batchSize) {
1217
1241
  const batch = edges.slice(index, index + batchSize);
1218
1242
  await processEdgeSlice(
1219
- backend,
1243
+ frame,
1220
1244
  graphId,
1221
1245
  registry,
1222
1246
  batch,
@@ -1254,10 +1278,29 @@ function recordEdgeOutcome(edge, outcome, result, errors) {
1254
1278
  }
1255
1279
  }
1256
1280
  }
1257
- async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1281
+ function edgeInsertParamsOf(graphId, candidate) {
1282
+ const { edge, props } = candidate;
1283
+ return {
1284
+ graphId,
1285
+ id: edge.id,
1286
+ kind: edge.kind,
1287
+ fromKind: edge.from.kind,
1288
+ fromId: edge.from.id,
1289
+ toKind: edge.to.kind,
1290
+ toId: edge.to.id,
1291
+ props,
1292
+ ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1293
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1294
+ };
1295
+ }
1296
+ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1258
1297
  const record = (edge, outcome) => {
1259
1298
  recordEdgeOutcome(edge, outcome, result, errors);
1260
1299
  };
1300
+ const {
1301
+ backend: cardinalityValidationBackend,
1302
+ registerPendingEdgeForCardinality
1303
+ } = createEdgeBatchValidationBackend(frame.target);
1261
1304
  const candidates = [];
1262
1305
  const deferred = [];
1263
1306
  const seenIds = /* @__PURE__ */ new Set();
@@ -1318,7 +1361,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1318
1361
  }
1319
1362
  const liveEndpointKeys = /* @__PURE__ */ new Set();
1320
1363
  const checkedEndpointKeys = /* @__PURE__ */ new Set();
1321
- if (options.validateReferences && backend.getNodes !== void 0) {
1364
+ if (options.validateReferences && frame.target.getNodes !== void 0) {
1322
1365
  const idsByKind = /* @__PURE__ */ new Map();
1323
1366
  for (const { edge } of candidates) {
1324
1367
  for (const endpoint of [edge.from, edge.to]) {
@@ -1331,7 +1374,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1331
1374
  }
1332
1375
  }
1333
1376
  for (const [kind, ids] of idsByKind) {
1334
- const rows = await backend.getNodes(graphId, kind, [...ids]);
1377
+ const rows = await frame.target.getNodes(graphId, kind, [...ids]);
1335
1378
  for (const row of rows) {
1336
1379
  if (isLiveNodeRow(row)) {
1337
1380
  liveEndpointKeys.add(makeNodeKey(kind, row.id));
@@ -1343,12 +1386,12 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1343
1386
  const key = makeNodeKey(endpoint.kind, endpoint.id);
1344
1387
  if (importedNodeIds.has(key)) return true;
1345
1388
  if (checkedEndpointKeys.has(key)) return liveEndpointKeys.has(key);
1346
- const row = await backend.getNode(graphId, endpoint.kind, endpoint.id);
1389
+ const row = await frame.target.getNode(graphId, endpoint.kind, endpoint.id);
1347
1390
  return row !== void 0 && isLiveNodeRow(row);
1348
1391
  };
1349
1392
  const existingById = /* @__PURE__ */ new Map();
1350
- if (candidates.length > 0 && backend.getEdges !== void 0) {
1351
- const rows = await backend.getEdges(
1393
+ if (candidates.length > 0 && frame.target.getEdges !== void 0) {
1394
+ const rows = await frame.target.getEdges(
1352
1395
  graphId,
1353
1396
  candidates.map((candidate) => candidate.edge.id)
1354
1397
  );
@@ -1378,7 +1421,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1378
1421
  continue;
1379
1422
  }
1380
1423
  }
1381
- const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await backend.getEdge(graphId, edge.id);
1424
+ const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await frame.target.getEdge(graphId, edge.id);
1382
1425
  if (existing) {
1383
1426
  const identityConflict = edgeIdentityConflict(edge, existing);
1384
1427
  if (identityConflict !== void 0) {
@@ -1414,8 +1457,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1414
1457
  break;
1415
1458
  }
1416
1459
  const updateError = await updateImportedEdge(
1417
- backend,
1418
- graphId,
1460
+ frame.session,
1419
1461
  edge,
1420
1462
  props,
1421
1463
  updateWindow.value
@@ -1430,28 +1472,37 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1430
1472
  }
1431
1473
  continue;
1432
1474
  }
1475
+ const insertParams = edgeInsertParamsOf(graphId, candidate);
1476
+ const cardinality = edgeSchemas.get(edge.kind)?.registration.cardinality ?? "many";
1477
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1478
+ () => checkCardinalityConstraint(
1479
+ { graphId, registry, backend: cardinalityValidationBackend },
1480
+ edge.kind,
1481
+ cardinality,
1482
+ edge.from.kind,
1483
+ edge.from.id,
1484
+ edge.to.kind,
1485
+ edge.to.id,
1486
+ edge.validTo
1487
+ )
1488
+ );
1489
+ if (!cardinalityResult.ok) {
1490
+ record(edge, { status: "error", error: cardinalityResult.error });
1491
+ continue;
1492
+ }
1493
+ registerPendingEdgeForCardinality(insertParams, cardinality);
1433
1494
  accepted.push(candidate);
1434
1495
  }
1435
1496
  if (accepted.length > 0) {
1436
- const insertParamsList = accepted.map(({ edge, props }) => ({
1437
- graphId,
1438
- id: edge.id,
1439
- kind: edge.kind,
1440
- fromKind: edge.from.kind,
1441
- fromId: edge.from.id,
1442
- toKind: edge.to.kind,
1443
- toId: edge.to.id,
1444
- props,
1445
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1446
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1447
- }));
1448
- if (backend.insertEdgesBatch === void 0) {
1449
- for (const params of insertParamsList) {
1450
- await backend.insertEdge(params);
1451
- }
1452
- } else {
1453
- await backend.insertEdgesBatch(insertParamsList);
1454
- }
1497
+ await frame.session.createEdgesNoReturn(
1498
+ accepted.map(
1499
+ (candidate) => importEdgeInsertWork(
1500
+ graphId,
1501
+ candidate,
1502
+ edgeSchemas.get(candidate.edge.kind)?.registration.cardinality ?? "many"
1503
+ )
1504
+ )
1505
+ );
1455
1506
  for (const candidate of accepted) {
1456
1507
  record(candidate.edge, { status: "created" });
1457
1508
  }
@@ -1460,7 +1511,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1460
1511
  record(
1461
1512
  edge,
1462
1513
  await processEdge(
1463
- backend,
1514
+ frame,
1464
1515
  graphId,
1465
1516
  registry,
1466
1517
  edge,
@@ -1472,7 +1523,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1472
1523
  );
1473
1524
  }
1474
1525
  }
1475
- async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1526
+ async function processEdge(frame, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1476
1527
  const schemaEntry = edgeSchemas.get(edge.kind);
1477
1528
  if (!schemaEntry) {
1478
1529
  return { status: "error", error: `Unknown edge kind: ${edge.kind}` };
@@ -1500,7 +1551,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1500
1551
  const fromKey = makeNodeKey(edge.from.kind, edge.from.id);
1501
1552
  const toKey = makeNodeKey(edge.to.kind, edge.to.id);
1502
1553
  if (!importedNodeIds.has(fromKey)) {
1503
- const fromExists = await backend.getNode(
1554
+ const fromExists = await frame.target.getNode(
1504
1555
  graphId,
1505
1556
  edge.from.kind,
1506
1557
  edge.from.id
@@ -1513,7 +1564,11 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1513
1564
  }
1514
1565
  }
1515
1566
  if (!importedNodeIds.has(toKey)) {
1516
- const toExists = await backend.getNode(graphId, edge.to.kind, edge.to.id);
1567
+ const toExists = await frame.target.getNode(
1568
+ graphId,
1569
+ edge.to.kind,
1570
+ edge.to.id
1571
+ );
1517
1572
  if (toExists === void 0 || !isLiveNodeRow(toExists)) {
1518
1573
  return {
1519
1574
  status: "error",
@@ -1534,7 +1589,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1534
1589
  if (validityError !== void 0) {
1535
1590
  return { status: "error", error: validityError };
1536
1591
  }
1537
- const existing = await backend.getEdge(graphId, edge.id);
1592
+ const existing = await frame.target.getEdge(graphId, edge.id);
1538
1593
  if (existing) {
1539
1594
  const identityConflict = edgeIdentityConflict(edge, existing);
1540
1595
  if (identityConflict !== void 0) {
@@ -1562,8 +1617,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1562
1617
  return { status: "error", error: updateWindow.error };
1563
1618
  }
1564
1619
  const updateError = await updateImportedEdge(
1565
- backend,
1566
- graphId,
1620
+ frame.session,
1567
1621
  edge,
1568
1622
  propsResult.data,
1569
1623
  updateWindow.value
@@ -1575,20 +1629,36 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1575
1629
  }
1576
1630
  }
1577
1631
  }
1578
- await backend.insertEdge({
1579
- graphId,
1580
- id: edge.id,
1581
- kind: edge.kind,
1582
- fromKind: edge.from.kind,
1583
- fromId: edge.from.id,
1584
- toKind: edge.to.kind,
1585
- toId: edge.to.id,
1586
- props: propsResult.data,
1587
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1588
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1589
- });
1632
+ const cardinality = schemaEntry.registration.cardinality ?? "many";
1633
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1634
+ () => checkCardinalityConstraint(
1635
+ { graphId, registry, backend: frame.target },
1636
+ edge.kind,
1637
+ cardinality,
1638
+ edge.from.kind,
1639
+ edge.from.id,
1640
+ edge.to.kind,
1641
+ edge.to.id,
1642
+ edge.validTo
1643
+ )
1644
+ );
1645
+ if (!cardinalityResult.ok) {
1646
+ return { status: "error", error: cardinalityResult.error };
1647
+ }
1648
+ await frame.session.createEdge(
1649
+ importEdgeInsertWork(
1650
+ graphId,
1651
+ { edge, props: propsResult.data },
1652
+ cardinality
1653
+ )
1654
+ );
1590
1655
  return { status: "created" };
1591
1656
  }
1657
+ function importEdgeInsertWork(graphId, candidate, cardinality) {
1658
+ const params = edgeInsertParamsOf(graphId, candidate);
1659
+ const claim = edgeCardinalityClaim(cardinality, params);
1660
+ return { params, ...claim === void 0 ? {} : { claim } };
1661
+ }
1592
1662
  function validateProperties(properties, schema, unknownStrategy) {
1593
1663
  try {
1594
1664
  const knownKeys = new Set(Object.keys(schema.shape));
@@ -2123,6 +2193,6 @@ async function* exportEdgeChunks(backend, graphId, kind, options) {
2123
2193
  }
2124
2194
  }
2125
2195
 
2126
- export { ConflictStrategySchema, ExportOptionsSchema, ExportStreamOptionsSchema, FORMAT_VERSION, GraphDataHeaderSchema, GraphDataSchema, GraphDataSourceSchema, GraphInterchangeChunkSchema, IdentityInterchangeModeSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, exportStreamBackend, importGraph, importGraphStream, serializedStreamRefusal, withImportStreamLease };
2127
- //# sourceMappingURL=chunk-AX6JGVTZ.js.map
2128
- //# sourceMappingURL=chunk-AX6JGVTZ.js.map
2196
+ export { ConflictStrategySchema, ExportOptionsSchema, ExportStreamOptionsSchema, FORMAT_VERSION, GraphDataHeaderSchema, GraphDataSchema, GraphDataSourceSchema, GraphInterchangeChunkSchema, IdentityInterchangeModeSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, exportStreamBackend, importGraph, importGraphStream, registerIngestionImportTarget, serializedStreamRefusal, withImportStreamLease };
2197
+ //# sourceMappingURL=chunk-2CYI5HRH.js.map
2198
+ //# sourceMappingURL=chunk-2CYI5HRH.js.map