@nicia-ai/typegraph 0.49.0 → 0.51.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 (370) hide show
  1. package/README.md +12 -0
  2. package/dist/backend/drizzle/indexes.cjs +11 -9
  3. package/dist/backend/drizzle/indexes.d.cts +1 -1
  4. package/dist/backend/drizzle/indexes.d.ts +1 -1
  5. package/dist/backend/drizzle/indexes.js +7 -5
  6. package/dist/backend/index.cjs +190 -53
  7. package/dist/backend/index.d.cts +90 -4
  8. package/dist/backend/index.d.ts +90 -4
  9. package/dist/backend/index.js +9 -12
  10. package/dist/backend/postgres/index.cjs +36 -28
  11. package/dist/backend/postgres/index.d.cts +7 -7
  12. package/dist/backend/postgres/index.d.ts +7 -7
  13. package/dist/backend/postgres/index.js +19 -15
  14. package/dist/backend/postgres/pglite-store.cjs +7 -62
  15. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  16. package/dist/backend/postgres/pglite-store.d.cts +8 -8
  17. package/dist/backend/postgres/pglite-store.d.ts +8 -8
  18. package/dist/backend/postgres/pglite-store.js +7 -62
  19. package/dist/backend/postgres/pglite-store.js.map +1 -1
  20. package/dist/backend/postgres/pglite.cjs +21 -17
  21. package/dist/backend/postgres/pglite.d.cts +3 -3
  22. package/dist/backend/postgres/pglite.d.ts +3 -3
  23. package/dist/backend/postgres/pglite.js +20 -16
  24. package/dist/backend/sqlite/index.cjs +33 -25
  25. package/dist/backend/sqlite/index.d.cts +7 -7
  26. package/dist/backend/sqlite/index.d.ts +7 -7
  27. package/dist/backend/sqlite/index.js +17 -13
  28. package/dist/backend/sqlite/libsql.cjs +24 -20
  29. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  30. package/dist/backend/sqlite/libsql.d.cts +3 -3
  31. package/dist/backend/sqlite/libsql.d.ts +3 -3
  32. package/dist/backend/sqlite/libsql.js +19 -15
  33. package/dist/backend/sqlite/libsql.js.map +1 -1
  34. package/dist/backend/sqlite/local-store.cjs +9 -64
  35. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  36. package/dist/backend/sqlite/local-store.d.cts +8 -8
  37. package/dist/backend/sqlite/local-store.d.ts +8 -8
  38. package/dist/backend/sqlite/local-store.js +8 -64
  39. package/dist/backend/sqlite/local-store.js.map +1 -1
  40. package/dist/backend/sqlite/local.cjs +25 -20
  41. package/dist/backend/sqlite/local.d.cts +3 -3
  42. package/dist/backend/sqlite/local.d.ts +3 -3
  43. package/dist/backend/sqlite/local.js +21 -16
  44. package/dist/chunk-2CVDZCXH.cjs +1278 -0
  45. package/dist/chunk-2CVDZCXH.cjs.map +1 -0
  46. package/dist/{chunk-MYKHJI2J.js → chunk-2DWTBNSH.js} +3 -3
  47. package/dist/{chunk-MYKHJI2J.js.map → chunk-2DWTBNSH.js.map} +1 -1
  48. package/dist/{chunk-JB6T4GLL.cjs → chunk-2KCTP3U2.cjs} +870 -528
  49. package/dist/chunk-2KCTP3U2.cjs.map +1 -0
  50. package/dist/{chunk-OORXGFL5.cjs → chunk-322TBTOQ.cjs} +48 -48
  51. package/dist/{chunk-OORXGFL5.cjs.map → chunk-322TBTOQ.cjs.map} +1 -1
  52. package/dist/{chunk-FA2AFWLP.cjs → chunk-36SX6QXP.cjs} +31 -12
  53. package/dist/chunk-36SX6QXP.cjs.map +1 -0
  54. package/dist/{chunk-SDBBMD4N.js → chunk-36VYWVQU.js} +3 -3
  55. package/dist/{chunk-SDBBMD4N.js.map → chunk-36VYWVQU.js.map} +1 -1
  56. package/dist/chunk-4DKY6RIU.js +1253 -0
  57. package/dist/chunk-4DKY6RIU.js.map +1 -0
  58. package/dist/chunk-4QKOZYMV.js +9 -0
  59. package/dist/chunk-4QKOZYMV.js.map +1 -0
  60. package/dist/{chunk-WIC7DRXW.js → chunk-57JM6NW3.js} +9 -19
  61. package/dist/chunk-57JM6NW3.js.map +1 -0
  62. package/dist/chunk-5WWEYV4H.cjs +5113 -0
  63. package/dist/chunk-5WWEYV4H.cjs.map +1 -0
  64. package/dist/chunk-6KQEICJ6.cjs +12 -0
  65. package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
  66. package/dist/{chunk-DZAICA5J.js → chunk-6NKSE5AU.js} +4 -4
  67. package/dist/{chunk-DZAICA5J.js.map → chunk-6NKSE5AU.js.map} +1 -1
  68. package/dist/{chunk-KKBDXCLQ.js → chunk-6NLYIMJO.js} +4 -4
  69. package/dist/{chunk-KKBDXCLQ.js.map → chunk-6NLYIMJO.js.map} +1 -1
  70. package/dist/{chunk-BFUOME67.cjs → chunk-7B7I7YAW.cjs} +20 -11
  71. package/dist/chunk-7B7I7YAW.cjs.map +1 -0
  72. package/dist/{chunk-ZDKTPBGV.js → chunk-7G5IYROL.js} +6 -548
  73. package/dist/chunk-7G5IYROL.js.map +1 -0
  74. package/dist/{chunk-3DMMGT6S.js → chunk-7QFRK6PU.js} +4 -8
  75. package/dist/chunk-7QFRK6PU.js.map +1 -0
  76. package/dist/chunk-A4C4NJ5U.cjs +12 -0
  77. package/dist/chunk-A4C4NJ5U.cjs.map +1 -0
  78. package/dist/{chunk-CHAOFCHV.js → chunk-AH2A74OZ.js} +3 -3
  79. package/dist/{chunk-CHAOFCHV.js.map → chunk-AH2A74OZ.js.map} +1 -1
  80. package/dist/{chunk-UGHQV7MP.cjs → chunk-B3MN7EJR.cjs} +228 -162
  81. package/dist/chunk-B3MN7EJR.cjs.map +1 -0
  82. package/dist/{chunk-TZEGUG6D.cjs → chunk-BZ5MVITP.cjs} +4 -4
  83. package/dist/{chunk-TZEGUG6D.cjs.map → chunk-BZ5MVITP.cjs.map} +1 -1
  84. package/dist/{chunk-YVF2EM7B.js → chunk-CAI6SMP6.js} +3 -3
  85. package/dist/{chunk-YVF2EM7B.js.map → chunk-CAI6SMP6.js.map} +1 -1
  86. package/dist/{chunk-JONXFAPO.js → chunk-CBOD7TXH.js} +5 -5
  87. package/dist/{chunk-JONXFAPO.js.map → chunk-CBOD7TXH.js.map} +1 -1
  88. package/dist/{chunk-FQPEMEWX.cjs → chunk-CRZ56SZU.cjs} +81 -32
  89. package/dist/chunk-CRZ56SZU.cjs.map +1 -0
  90. package/dist/{chunk-DO7SAMEK.cjs → chunk-D3GWARN7.cjs} +47 -47
  91. package/dist/{chunk-DO7SAMEK.cjs.map → chunk-D3GWARN7.cjs.map} +1 -1
  92. package/dist/{chunk-QTD6HX4O.js → chunk-D3OUDFU7.js} +5 -5
  93. package/dist/{chunk-QTD6HX4O.js.map → chunk-D3OUDFU7.js.map} +1 -1
  94. package/dist/{chunk-2QGYQBS2.cjs → chunk-DWUDZ66O.cjs} +10 -10
  95. package/dist/{chunk-2QGYQBS2.cjs.map → chunk-DWUDZ66O.cjs.map} +1 -1
  96. package/dist/chunk-EKG2UXNX.cjs +23 -0
  97. package/dist/chunk-EKG2UXNX.cjs.map +1 -0
  98. package/dist/chunk-FMMW3KX7.cjs +148 -0
  99. package/dist/chunk-FMMW3KX7.cjs.map +1 -0
  100. package/dist/{chunk-XVWOYKIK.js → chunk-FZHF5UWR.js} +3 -3
  101. package/dist/{chunk-XVWOYKIK.js.map → chunk-FZHF5UWR.js.map} +1 -1
  102. package/dist/chunk-H2VWDQWC.cjs +571 -0
  103. package/dist/chunk-H2VWDQWC.cjs.map +1 -0
  104. package/dist/chunk-H4FY6OZK.js +13 -0
  105. package/dist/chunk-H4FY6OZK.js.map +1 -0
  106. package/dist/{chunk-EDN4Y4ZG.cjs → chunk-H5IJSROF.cjs} +9 -15
  107. package/dist/chunk-H5IJSROF.cjs.map +1 -0
  108. package/dist/chunk-HZUB5CON.js +27 -0
  109. package/dist/chunk-HZUB5CON.js.map +1 -0
  110. package/dist/{chunk-NACVVDWB.js → chunk-I5IOSA27.js} +103 -105
  111. package/dist/chunk-I5IOSA27.js.map +1 -0
  112. package/dist/{chunk-OI2GQ25X.cjs → chunk-I7YAY2VQ.cjs} +7 -7
  113. package/dist/{chunk-OI2GQ25X.cjs.map → chunk-I7YAY2VQ.cjs.map} +1 -1
  114. package/dist/chunk-IRCWIA3R.js +20 -0
  115. package/dist/chunk-IRCWIA3R.js.map +1 -0
  116. package/dist/chunk-IVQBLXBK.cjs +55 -0
  117. package/dist/chunk-IVQBLXBK.cjs.map +1 -0
  118. package/dist/{chunk-7SQSZN2J.js → chunk-IZD4HTCP.js} +5 -5
  119. package/dist/{chunk-7SQSZN2J.js.map → chunk-IZD4HTCP.js.map} +1 -1
  120. package/dist/{chunk-3FPR224C.cjs → chunk-JHRUZ73O.cjs} +116 -107
  121. package/dist/chunk-JHRUZ73O.cjs.map +1 -0
  122. package/dist/{chunk-EZEEWCFJ.cjs → chunk-JQKMEKKW.cjs} +525 -298
  123. package/dist/chunk-JQKMEKKW.cjs.map +1 -0
  124. package/dist/chunk-JVA3KDEA.cjs +691 -0
  125. package/dist/chunk-JVA3KDEA.cjs.map +1 -0
  126. package/dist/{chunk-5K2BKEBD.js → chunk-K46SDNQD.js} +10 -4
  127. package/dist/chunk-K46SDNQD.js.map +1 -0
  128. package/dist/{chunk-7LZJNLA5.js → chunk-K67P5DLL.js} +108 -42
  129. package/dist/chunk-K67P5DLL.js.map +1 -0
  130. package/dist/{chunk-3G5W2U2L.cjs → chunk-KACEYDYV.cjs} +335 -258
  131. package/dist/chunk-KACEYDYV.cjs.map +1 -0
  132. package/dist/{chunk-JFRT7S3B.cjs → chunk-L6EVYIID.cjs} +318 -478
  133. package/dist/chunk-L6EVYIID.cjs.map +1 -0
  134. package/dist/{chunk-SHFBB23Q.js → chunk-LI4K2KEJ.js} +6 -4
  135. package/dist/chunk-LI4K2KEJ.js.map +1 -0
  136. package/dist/chunk-LKZDQ2B4.js +1581 -0
  137. package/dist/chunk-LKZDQ2B4.js.map +1 -0
  138. package/dist/{chunk-WODMN3Q2.cjs → chunk-LLFPQOBA.cjs} +27 -27
  139. package/dist/{chunk-WODMN3Q2.cjs.map → chunk-LLFPQOBA.cjs.map} +1 -1
  140. package/dist/{chunk-P6YLZTRE.js → chunk-LZMQ3SFK.js} +3 -3
  141. package/dist/{chunk-P6YLZTRE.js.map → chunk-LZMQ3SFK.js.map} +1 -1
  142. package/dist/{chunk-HEV35TGT.js → chunk-M3VTS3F6.js} +13 -4
  143. package/dist/chunk-M3VTS3F6.js.map +1 -0
  144. package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
  145. package/dist/chunk-M5MSP3BI.cjs.map +1 -0
  146. package/dist/{chunk-D4QLTJSM.js → chunk-NBOS7BY3.js} +63 -23
  147. package/dist/chunk-NBOS7BY3.js.map +1 -0
  148. package/dist/chunk-NGQDGL5X.js +140 -0
  149. package/dist/chunk-NGQDGL5X.js.map +1 -0
  150. package/dist/{chunk-SIT26LAZ.cjs → chunk-NLX5OWK7.cjs} +33 -5
  151. package/dist/chunk-NLX5OWK7.cjs.map +1 -0
  152. package/dist/chunk-NUQ2YFFH.cjs +1637 -0
  153. package/dist/chunk-NUQ2YFFH.cjs.map +1 -0
  154. package/dist/{chunk-UMGZDVOA.cjs → chunk-OGL4X4PH.cjs} +206 -208
  155. package/dist/chunk-OGL4X4PH.cjs.map +1 -0
  156. package/dist/{chunk-LRQKXRXO.cjs → chunk-OTNTGEXR.cjs} +4 -4
  157. package/dist/{chunk-LRQKXRXO.cjs.map → chunk-OTNTGEXR.cjs.map} +1 -1
  158. package/dist/chunk-OTWE63BW.js +53 -0
  159. package/dist/chunk-OTWE63BW.js.map +1 -0
  160. package/dist/chunk-PC5NGH5A.js +549 -0
  161. package/dist/chunk-PC5NGH5A.js.map +1 -0
  162. package/dist/{chunk-26YKDNUD.cjs → chunk-PS3TUWJM.cjs} +12 -10
  163. package/dist/chunk-PS3TUWJM.cjs.map +1 -0
  164. package/dist/{chunk-OMZ37BM2.js → chunk-PVFFH7TL.js} +5 -5
  165. package/dist/{chunk-OMZ37BM2.js.map → chunk-PVFFH7TL.js.map} +1 -1
  166. package/dist/chunk-QCD5JKU4.cjs +15 -0
  167. package/dist/chunk-QCD5JKU4.cjs.map +1 -0
  168. package/dist/{chunk-UGHG7PGX.js → chunk-QG5VEOKX.js} +30 -4
  169. package/dist/chunk-QG5VEOKX.js.map +1 -0
  170. package/dist/{chunk-TUNPBZY3.cjs → chunk-QLLZM5I3.cjs} +4 -4
  171. package/dist/{chunk-TUNPBZY3.cjs.map → chunk-QLLZM5I3.cjs.map} +1 -1
  172. package/dist/{chunk-BRRP76WO.js → chunk-RCBG6YMT.js} +781 -375
  173. package/dist/chunk-RCBG6YMT.js.map +1 -0
  174. package/dist/{chunk-LTXQOEIC.js → chunk-RI7RJH4G.js} +281 -204
  175. package/dist/chunk-RI7RJH4G.js.map +1 -0
  176. package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
  177. package/dist/chunk-RJMHU2MG.cjs.map +1 -0
  178. package/dist/{chunk-GLHXM7C4.js → chunk-RVUL2HXY.js} +61 -23
  179. package/dist/chunk-RVUL2HXY.js.map +1 -0
  180. package/dist/chunk-RWUWTJQY.cjs +30 -0
  181. package/dist/chunk-RWUWTJQY.cjs.map +1 -0
  182. package/dist/{chunk-2O4PCIZ6.cjs → chunk-S5GU4LUN.cjs} +13 -13
  183. package/dist/{chunk-2O4PCIZ6.cjs.map → chunk-S5GU4LUN.cjs.map} +1 -1
  184. package/dist/{chunk-JPD2CTC3.js → chunk-SDPWO2Z5.js} +7 -7
  185. package/dist/{chunk-JPD2CTC3.js.map → chunk-SDPWO2Z5.js.map} +1 -1
  186. package/dist/{chunk-OVI7IXYX.js → chunk-SLGGT2XD.js} +3 -3
  187. package/dist/{chunk-OVI7IXYX.js.map → chunk-SLGGT2XD.js.map} +1 -1
  188. package/dist/{chunk-ROR5ZR6A.cjs → chunk-TIJUA4I6.cjs} +45 -45
  189. package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-TIJUA4I6.cjs.map} +1 -1
  190. package/dist/{chunk-AOSSQDVO.cjs → chunk-TM54OBHX.cjs} +13 -13
  191. package/dist/{chunk-AOSSQDVO.cjs.map → chunk-TM54OBHX.cjs.map} +1 -1
  192. package/dist/{chunk-KF6K7TGH.js → chunk-TYEYRCXL.js} +766 -433
  193. package/dist/chunk-TYEYRCXL.js.map +1 -0
  194. package/dist/{chunk-Z2JCLZFJ.js → chunk-UKOVGCRN.js} +2151 -570
  195. package/dist/chunk-UKOVGCRN.js.map +1 -0
  196. package/dist/chunk-UYKDYE5D.cjs +12 -0
  197. package/dist/{chunk-CICO5GXD.cjs.map → chunk-UYKDYE5D.cjs.map} +1 -1
  198. package/dist/{chunk-S5TERQVW.js → chunk-VAAC7L57.js} +284 -66
  199. package/dist/chunk-VAAC7L57.js.map +1 -0
  200. package/dist/{chunk-7UOLHNWC.cjs → chunk-VKHXYVN7.cjs} +22 -33
  201. package/dist/chunk-VKHXYVN7.cjs.map +1 -0
  202. package/dist/{chunk-6NGW27EO.cjs → chunk-VLBTRXA2.cjs} +10 -10
  203. package/dist/{chunk-6NGW27EO.cjs.map → chunk-VLBTRXA2.cjs.map} +1 -1
  204. package/dist/{chunk-YIURNGXI.js → chunk-VUQZNUHU.js} +22 -6
  205. package/dist/chunk-VUQZNUHU.js.map +1 -0
  206. package/dist/{chunk-YYUHLYM2.cjs → chunk-WDM5WQK4.cjs} +183 -143
  207. package/dist/chunk-WDM5WQK4.cjs.map +1 -0
  208. package/dist/{chunk-ZFMCDJGB.js → chunk-WFSYYU4W.js} +70 -220
  209. package/dist/chunk-WFSYYU4W.js.map +1 -0
  210. package/dist/{chunk-SR725PWF.cjs → chunk-WRBV2FNH.cjs} +2065 -1659
  211. package/dist/chunk-WRBV2FNH.cjs.map +1 -0
  212. package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
  213. package/dist/chunk-X4GDXBOP.cjs.map +1 -0
  214. package/dist/chunk-XORONCV3.js +202 -0
  215. package/dist/chunk-XORONCV3.js.map +1 -0
  216. package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
  217. package/dist/chunk-XZW2CTNO.js.map +1 -0
  218. package/dist/{chunk-ZLONH2UD.js → chunk-YDEJQWOL.js} +2 -2
  219. package/dist/chunk-YDEJQWOL.js.map +1 -0
  220. package/dist/{chunk-2TYSSBU5.js → chunk-YT2IVFAI.js} +30 -21
  221. package/dist/chunk-YT2IVFAI.js.map +1 -0
  222. package/dist/chunk-ZGVTNKTX.cjs +217 -0
  223. package/dist/chunk-ZGVTNKTX.cjs.map +1 -0
  224. package/dist/core/index.cjs +29 -28
  225. package/dist/core/index.d.cts +4 -4
  226. package/dist/core/index.d.ts +4 -4
  227. package/dist/core/index.js +9 -8
  228. package/dist/{ddl-D_oW-EVO.d.ts → ddl-BvcbgzHo.d.ts} +3 -3
  229. package/dist/{ddl-BL1NZLMY.d.cts → ddl-Ufebz5q5.d.cts} +3 -3
  230. package/dist/graph-extension/index.cjs +21 -20
  231. package/dist/graph-extension/index.d.cts +2 -4
  232. package/dist/graph-extension/index.d.ts +2 -4
  233. package/dist/graph-extension/index.js +5 -4
  234. package/dist/graph-merge/index.cjs +324 -307
  235. package/dist/graph-merge/index.cjs.map +1 -1
  236. package/dist/graph-merge/index.d.cts +8 -9
  237. package/dist/graph-merge/index.d.ts +8 -9
  238. package/dist/graph-merge/index.js +51 -34
  239. package/dist/graph-merge/index.js.map +1 -1
  240. package/dist/index.cjs +224 -222
  241. package/dist/index.cjs.map +1 -1
  242. package/dist/index.d.cts +11 -12
  243. package/dist/index.d.ts +11 -12
  244. package/dist/index.js +38 -36
  245. package/dist/index.js.map +1 -1
  246. package/dist/indexes/index.cjs +15 -13
  247. package/dist/indexes/index.d.cts +4 -4
  248. package/dist/indexes/index.d.ts +4 -4
  249. package/dist/indexes/index.js +8 -6
  250. package/dist/{ingestion-import-target-dNeL7iAv.d.ts → ingestion-import-target-CAs1OX-l.d.cts} +1 -1
  251. package/dist/{ingestion-import-target-XPxZYw89.d.cts → ingestion-import-target-DCQSPfNx.d.ts} +1 -1
  252. package/dist/interchange/index.cjs +57 -54
  253. package/dist/interchange/index.cjs.map +1 -1
  254. package/dist/interchange/index.d.cts +19 -8
  255. package/dist/interchange/index.d.ts +19 -8
  256. package/dist/interchange/index.js +21 -18
  257. package/dist/interchange/index.js.map +1 -1
  258. package/dist/local-store-impl-6DDTFM32.cjs +77 -0
  259. package/dist/local-store-impl-6DDTFM32.cjs.map +1 -0
  260. package/dist/local-store-impl-OXTOVU2J.js +75 -0
  261. package/dist/local-store-impl-OXTOVU2J.js.map +1 -0
  262. package/dist/{manager-CYaff3n3.d.cts → manager-B68OrPR2.d.ts} +29 -2
  263. package/dist/{manager-D9eRT_ns.d.ts → manager-D_t7oK69.d.cts} +29 -2
  264. package/dist/pglite-store-impl-6EMZGL7K.js +73 -0
  265. package/dist/pglite-store-impl-6EMZGL7K.js.map +1 -0
  266. package/dist/pglite-store-impl-GJG3Y7RP.cjs +75 -0
  267. package/dist/pglite-store-impl-GJG3Y7RP.cjs.map +1 -0
  268. package/dist/{postgres-CcL4bAHS.d.ts → postgres-BPLSVyHM.d.ts} +279 -2
  269. package/dist/{postgres-DMj39MEu.d.cts → postgres-CqvtFC2y.d.cts} +279 -2
  270. package/dist/profiler/index.d.cts +9 -9
  271. package/dist/profiler/index.d.ts +9 -9
  272. package/dist/provenance/index.cjs +59 -44
  273. package/dist/provenance/index.cjs.map +1 -1
  274. package/dist/provenance/index.d.cts +7 -7
  275. package/dist/provenance/index.d.ts +7 -7
  276. package/dist/provenance/index.js +28 -13
  277. package/dist/provenance/index.js.map +1 -1
  278. package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-DEzCKAdy.d.cts} +7 -3
  279. package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-GMdaS2AH.d.ts} +7 -3
  280. package/dist/resolve-D_H8MHtq.d.ts +1805 -0
  281. package/dist/resolve-WEW8gWws.d.cts +1805 -0
  282. package/dist/schema/index.cjs +48 -46
  283. package/dist/schema/index.d.cts +4 -6
  284. package/dist/schema/index.d.ts +4 -6
  285. package/dist/schema/index.js +21 -19
  286. package/dist/{searchable-bpE1bBfc.d.ts → searchable-C_UREI9K.d.ts} +1 -1
  287. package/dist/{searchable-DHJMh_nj.d.cts → searchable-ClgET_i7.d.cts} +1 -1
  288. package/dist/{sqlite-YppHrNFb.d.cts → sqlite-D1mXO9Kp.d.cts} +310 -2
  289. package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-MZA3oZNB.d.ts} +310 -2
  290. package/dist/{store-bphCSo7z.d.cts → store-CuFX7fCx.d.cts} +117 -31
  291. package/dist/{store-DRrFCx5x.d.ts → store-D-ZjXQpW.d.ts} +117 -31
  292. package/dist/{temporal-CbnLzTmM.d.ts → temporal-CpyEiRY8.d.cts} +1 -1
  293. package/dist/{temporal-5GqpYCk2.d.cts → temporal-y0Aep9Su.d.ts} +1 -1
  294. package/dist/{types-BqFZTQmV.d.cts → types-6yf0Vv-_.d.cts} +2016 -94
  295. package/dist/{types-BqFZTQmV.d.ts → types-6yf0Vv-_.d.ts} +2016 -94
  296. package/dist/{types-Bx74kaTt.d.ts → types-DzJ4dlzk.d.cts} +1 -1
  297. package/dist/{types-CXAhpW-c.d.cts → types-_vVSB9k-.d.ts} +1 -1
  298. package/dist/{where-O-k2wgYm.d.ts → where-DuG2LCLe.d.ts} +1 -1
  299. package/dist/{where-DI_Fqz-X.d.cts → where-Mhf_yyKX.d.cts} +1 -1
  300. package/package.json +7 -2
  301. package/dist/chunk-26YKDNUD.cjs.map +0 -1
  302. package/dist/chunk-2TYSSBU5.js.map +0 -1
  303. package/dist/chunk-3DMMGT6S.js.map +0 -1
  304. package/dist/chunk-3FPR224C.cjs.map +0 -1
  305. package/dist/chunk-3G5W2U2L.cjs.map +0 -1
  306. package/dist/chunk-3KOY4FH3.cjs +0 -934
  307. package/dist/chunk-3KOY4FH3.cjs.map +0 -1
  308. package/dist/chunk-3QNZ5SAJ.cjs +0 -3502
  309. package/dist/chunk-3QNZ5SAJ.cjs.map +0 -1
  310. package/dist/chunk-3U5ABFDW.cjs +0 -259
  311. package/dist/chunk-3U5ABFDW.cjs.map +0 -1
  312. package/dist/chunk-5K2BKEBD.js.map +0 -1
  313. package/dist/chunk-5PRKMB24.cjs +0 -124
  314. package/dist/chunk-5PRKMB24.cjs.map +0 -1
  315. package/dist/chunk-6LN7FIVU.js +0 -107
  316. package/dist/chunk-6LN7FIVU.js.map +0 -1
  317. package/dist/chunk-6SWPJEYN.js +0 -1126
  318. package/dist/chunk-6SWPJEYN.js.map +0 -1
  319. package/dist/chunk-7LZJNLA5.js.map +0 -1
  320. package/dist/chunk-7UOLHNWC.cjs.map +0 -1
  321. package/dist/chunk-BFUOME67.cjs.map +0 -1
  322. package/dist/chunk-BRRP76WO.js.map +0 -1
  323. package/dist/chunk-CICO5GXD.cjs +0 -12
  324. package/dist/chunk-D4QLTJSM.js.map +0 -1
  325. package/dist/chunk-D5R42W5D.js.map +0 -1
  326. package/dist/chunk-EDN4Y4ZG.cjs.map +0 -1
  327. package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
  328. package/dist/chunk-FA2AFWLP.cjs.map +0 -1
  329. package/dist/chunk-FQPEMEWX.cjs.map +0 -1
  330. package/dist/chunk-GLHXM7C4.js.map +0 -1
  331. package/dist/chunk-GYEG3ZLZ.cjs.map +0 -1
  332. package/dist/chunk-HDL2ARHX.cjs +0 -1156
  333. package/dist/chunk-HDL2ARHX.cjs.map +0 -1
  334. package/dist/chunk-HEV35TGT.js.map +0 -1
  335. package/dist/chunk-I4GAZH5Z.js +0 -913
  336. package/dist/chunk-I4GAZH5Z.js.map +0 -1
  337. package/dist/chunk-JB6T4GLL.cjs.map +0 -1
  338. package/dist/chunk-JBQQ7THH.js +0 -20
  339. package/dist/chunk-JBQQ7THH.js.map +0 -1
  340. package/dist/chunk-JFRT7S3B.cjs.map +0 -1
  341. package/dist/chunk-KF6K7TGH.js.map +0 -1
  342. package/dist/chunk-L3LQNR34.cjs +0 -1254
  343. package/dist/chunk-L3LQNR34.cjs.map +0 -1
  344. package/dist/chunk-LTXQOEIC.js.map +0 -1
  345. package/dist/chunk-MKJ4KXL5.cjs +0 -12
  346. package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
  347. package/dist/chunk-NACVVDWB.js.map +0 -1
  348. package/dist/chunk-NVY5CJFP.js +0 -244
  349. package/dist/chunk-NVY5CJFP.js.map +0 -1
  350. package/dist/chunk-PWLJ77UV.cjs +0 -23
  351. package/dist/chunk-PWLJ77UV.cjs.map +0 -1
  352. package/dist/chunk-S5TERQVW.js.map +0 -1
  353. package/dist/chunk-SHFBB23Q.js.map +0 -1
  354. package/dist/chunk-SIT26LAZ.cjs.map +0 -1
  355. package/dist/chunk-SR725PWF.cjs.map +0 -1
  356. package/dist/chunk-TQHGE7UC.cjs.map +0 -1
  357. package/dist/chunk-UGHG7PGX.js.map +0 -1
  358. package/dist/chunk-UGHQV7MP.cjs.map +0 -1
  359. package/dist/chunk-UMGZDVOA.cjs.map +0 -1
  360. package/dist/chunk-WIC7DRXW.js.map +0 -1
  361. package/dist/chunk-YIURNGXI.js.map +0 -1
  362. package/dist/chunk-YYUHLYM2.cjs.map +0 -1
  363. package/dist/chunk-Z2JCLZFJ.js.map +0 -1
  364. package/dist/chunk-ZDKTPBGV.js.map +0 -1
  365. package/dist/chunk-ZFMCDJGB.js.map +0 -1
  366. package/dist/chunk-ZLONH2UD.js.map +0 -1
  367. package/dist/index-COs_z6nV.d.cts +0 -1132
  368. package/dist/index-D7d1u2gr.d.ts +0 -1132
  369. package/dist/materialize-indexes-DJ3ykH59.d.ts +0 -266
  370. package/dist/materialize-indexes-DTtAnvfY.d.cts +0 -266
@@ -1,21 +1,23 @@
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 chunk2KCTP3U2_cjs = require('./chunk-2KCTP3U2.cjs');
4
+ var chunk2CVDZCXH_cjs = require('./chunk-2CVDZCXH.cjs');
5
+ var chunkFMMW3KX7_cjs = require('./chunk-FMMW3KX7.cjs');
6
+ var chunkL6EVYIID_cjs = require('./chunk-L6EVYIID.cjs');
7
+ var chunkJQKMEKKW_cjs = require('./chunk-JQKMEKKW.cjs');
8
+ var chunkNLX5OWK7_cjs = require('./chunk-NLX5OWK7.cjs');
9
+ var chunkZGVTNKTX_cjs = require('./chunk-ZGVTNKTX.cjs');
10
+ var chunkNUQ2YFFH_cjs = require('./chunk-NUQ2YFFH.cjs');
11
+ var chunk7B7I7YAW_cjs = require('./chunk-7B7I7YAW.cjs');
12
+ var chunkCRZ56SZU_cjs = require('./chunk-CRZ56SZU.cjs');
13
+ var chunkM5MSP3BI_cjs = require('./chunk-M5MSP3BI.cjs');
14
+ var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
13
15
  var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
14
16
  var zod = require('zod');
15
17
 
16
18
  var FORMAT_VERSION = "2.0";
17
19
  var AcceptedFormatVersionSchema = zod.z.enum(["1.0", "2.0"]);
18
- var ValidityTimestampSchema = zod.z.iso.datetime().refine((value) => chunkTQHGE7UC_cjs.isCanonicalIsoDate(value), {
20
+ var ValidityTimestampSchema = zod.z.iso.datetime().refine((value) => chunkM5MSP3BI_cjs.isCanonicalIsoDate(value), {
19
21
  message: "Expected canonical UTC ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ); convert with new Date(value).toISOString()."
20
22
  });
21
23
  var InterchangeNodeSchema = zod.z.object({
@@ -249,10 +251,10 @@ function resolveIngestionImportTarget(target) {
249
251
  const registeredStore = INGESTION_IMPORT_TARGETS.get(target);
250
252
  if (registeredStore !== void 0) return registeredStore;
251
253
  try {
252
- chunk3KOY4FH3_cjs.storeBackend(target);
254
+ chunk2CVDZCXH_cjs.storeBackend(target);
253
255
  return target;
254
256
  } catch (error) {
255
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
257
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
256
258
  "Interchange import received an unrecognized ingestion target",
257
259
  { target: "unregistered-ingestion-target" },
258
260
  {
@@ -283,8 +285,8 @@ async function importGraph(target, data, rawOptions) {
283
285
  );
284
286
  }
285
287
  async function withImportStreamLease(store, run) {
286
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(
287
- chunk3KOY4FH3_cjs.storeBackend(store),
288
+ const lease = chunkNLX5OWK7_cjs.acquireSerializedStreamLease(
289
+ chunk2CVDZCXH_cjs.storeBackend(store),
288
290
  "import-stream"
289
291
  );
290
292
  if (!lease.acquired) {
@@ -307,25 +309,51 @@ async function importGraphData(store, data, options) {
307
309
  const errors = [];
308
310
  const graph = store.graph;
309
311
  const graphId = store.graphId;
310
- const backend = chunk3KOY4FH3_cjs.storeBackend(store);
311
- const runtime = chunk3KOY4FH3_cjs.storeRuntime(store);
312
+ const backend = chunk2CVDZCXH_cjs.storeBackend(store);
313
+ const runtime = chunk2CVDZCXH_cjs.storeRuntime(store);
312
314
  const registry = store.registry;
315
+ const batchPointRead = chunkZGVTNKTX_cjs.batchPointReadVerdict(backend);
316
+ const uniqueSidecarBatch = chunkZGVTNKTX_cjs.uniqueSidecarBatchVerdict(backend);
317
+ const owedClaimReason = chunk2KCTP3U2_cjs.graphOwesClaims(graph, registry);
318
+ const claimRefusal = owedClaimReason === void 0 ? void 0 : chunkJQKMEKKW_cjs.constraintFenceRefusal({ graphId }, backend, owedClaimReason);
319
+ if (claimRefusal !== void 0) throw claimRefusal;
313
320
  const nodeSchemas = buildNodeSchemaMap(graph);
314
321
  const edgeSchemas = buildEdgeSchemaMap(graph);
315
322
  const importedNodeIds = /* @__PURE__ */ new Set();
316
- await chunkJFRT7S3B_cjs.runInWriteTransaction(
323
+ await chunk2KCTP3U2_cjs.runWritePlan(
317
324
  {
318
325
  graphId,
326
+ registry,
327
+ // Interning (`createClaimsVerdictThunk`'s `WeakMap`) makes this the SAME
328
+ // thunk object the store's own operations use for this backend — a
329
+ // second, independent memoization for the same backend is exactly what
330
+ // interning exists to rule out.
331
+ claimsVerdict: chunkZGVTNKTX_cjs.createClaimsVerdictThunk(backend),
332
+ uniqueSidecarBatch,
319
333
  schemaVersion: store.introspect().schemaVersion,
320
334
  historyEnabled: store.historyEnabled,
321
335
  revisionTrackingEnabled: store.revisionTrackingEnabled,
322
- revisionSchema: store.revisionSchema
336
+ revisionSchema: store.revisionSchema,
337
+ // HOW this caller takes position 3. `lockIdentityImportTarget` is
338
+ // `lockIdentityGraph` on an identity graph and a no-op otherwise, so the
339
+ // participation below is unconditional and the acquirer owns the
340
+ // "identity is configured" test, exactly as before the migration.
341
+ identityLock: (target) => runtime.lockIdentityImportTarget(target)
323
342
  },
343
+ // An import writes node rows AND edge rows in one frame, so it declares the
344
+ // mixed family explicitly instead of receiving either narrower session.
345
+ chunk2KCTP3U2_cjs.mixedWritePlan(void 0, true),
324
346
  backend,
325
- async (target, lock) => {
326
- await runtime.lockIdentityImportTarget(target);
327
- await processNodes(
347
+ async (session, target, overlaidSession) => {
348
+ const frame = {
349
+ session,
328
350
  target,
351
+ overlaidSession,
352
+ batchPointRead,
353
+ uniqueSidecarBatch
354
+ };
355
+ await processNodes(
356
+ frame,
329
357
  graphId,
330
358
  registry,
331
359
  data.nodes,
@@ -333,8 +361,7 @@ async function importGraphData(store, data, options) {
333
361
  options,
334
362
  result,
335
363
  errors,
336
- importedNodeIds,
337
- lock
364
+ importedNodeIds
338
365
  );
339
366
  await runtime.foldImportedIdentityNodes(
340
367
  target,
@@ -343,7 +370,7 @@ async function importGraphData(store, data, options) {
343
370
  ).map((node) => ({ kind: node.kind, id: node.id }))
344
371
  );
345
372
  await processEdges(
346
- target,
373
+ frame,
347
374
  graphId,
348
375
  registry,
349
376
  data.edges,
@@ -377,8 +404,8 @@ async function importGraphStream(target, chunks, rawOptions) {
377
404
  const store = resolveIngestionImportTarget(target);
378
405
  const options = ImportOptionsSchema.parse(rawOptions);
379
406
  const sourceBackend = exportStreamBackend(chunks);
380
- const targetBackend = chunk3KOY4FH3_cjs.storeBackend(store);
381
- const contention = sourceBackend === void 0 ? void 0 : chunkSIT26LAZ_cjs.snapshotExportContention(sourceBackend, targetBackend);
407
+ const targetBackend = chunk2CVDZCXH_cjs.storeBackend(store);
408
+ const contention = sourceBackend === void 0 ? void 0 : chunkNLX5OWK7_cjs.snapshotExportContention(sourceBackend, targetBackend);
382
409
  if (contention !== void 0) {
383
410
  throw serializedStreamRefusal({
384
411
  graphId: store.graphId,
@@ -395,7 +422,7 @@ async function importGraphStream(target, chunks, rawOptions) {
395
422
  try {
396
423
  for await (const chunk of chunks) {
397
424
  if (releaseImportLease === void 0) {
398
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(
425
+ const lease = chunkNLX5OWK7_cjs.acquireSerializedStreamLease(
399
426
  targetBackend,
400
427
  "import-stream"
401
428
  );
@@ -525,7 +552,7 @@ function serializedStreamRefusal(input) {
525
552
  requested,
526
553
  heldBy
527
554
  );
528
- return new chunkMRDBBHIZ_cjs.ConfigurationError(
555
+ return new chunkX4GDXBOP_cjs.ConfigurationError(
529
556
  message,
530
557
  { code, graphId, requested, heldBy },
531
558
  { suggestion }
@@ -560,7 +587,7 @@ function throwIfStreamChunkFailed(result, options) {
560
587
  }
561
588
  function assertIdentityImportSupported(store, hasIdentitySection) {
562
589
  if (hasIdentitySection && store.graph.identity === void 0) {
563
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
590
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
564
591
  "Cannot import identity assertions into an identity-disabled graph.",
565
592
  { code: "IDENTITY_IMPORT_REQUIRES_PROFILE", graphId: store.graphId }
566
593
  );
@@ -570,7 +597,7 @@ function validateIdentitySection(identity) {
570
597
  if (identity === void 0) return;
571
598
  const parsed = InterchangeIdentitySchema.safeParse(identity);
572
599
  if (parsed.success) return;
573
- throw new chunkMRDBBHIZ_cjs.ValidationError(
600
+ throw new chunkX4GDXBOP_cjs.ValidationError(
574
601
  `Invalid identity interchange section: ${parsed.error.message}`,
575
602
  {
576
603
  issues: parsed.error.issues.map((issue) => ({
@@ -596,19 +623,19 @@ function identityImportError(assertion, graphId, message) {
596
623
  };
597
624
  }
598
625
  function isIdConflictError(error) {
599
- return error instanceof chunkMRDBBHIZ_cjs.ConfigurationError && error.details["code"] === IDENTITY_IMPORT_ID_CONFLICT_CODE;
626
+ return error instanceof chunkX4GDXBOP_cjs.ConfigurationError && error.details["code"] === IDENTITY_IMPORT_ID_CONFLICT_CODE;
600
627
  }
601
628
  function touchesRef(assertion, ref) {
602
629
  return assertion.a.kind === ref.kind && assertion.a.id === ref.id || assertion.b.kind === ref.kind && assertion.b.id === ref.id;
603
630
  }
604
631
  function asIdentityImportError(assertions, graphId, error) {
605
632
  const tagged = taggedAssertion(assertions, error);
606
- if (error instanceof chunkMRDBBHIZ_cjs.NodeNotFoundError) {
633
+ if (error instanceof chunkX4GDXBOP_cjs.NodeNotFoundError) {
607
634
  const ref = error.details;
608
635
  const assertion = tagged ?? assertions.find((candidate) => touchesRef(candidate, ref));
609
636
  return identityImportError(assertion, graphId, error.message);
610
637
  }
611
- if (error instanceof chunkMRDBBHIZ_cjs.IdentityContradictionError) {
638
+ if (error instanceof chunkX4GDXBOP_cjs.IdentityContradictionError) {
612
639
  const { a, b } = error.details;
613
640
  const assertion = tagged ?? assertions.find(
614
641
  (candidate) => touchesRef(candidate, a) && touchesRef(candidate, b)
@@ -634,12 +661,12 @@ function asIdentityImportError(assertions, graphId, error) {
634
661
  }
635
662
  function taggedAssertion(assertions, error) {
636
663
  if (typeof error !== "object" || error === null) return void 0;
637
- const id = error[chunkJFRT7S3B_cjs.IDENTITY_IMPORT_FAILED_ASSERTION];
664
+ const id = error[chunkL6EVYIID_cjs.IDENTITY_IMPORT_FAILED_ASSERTION];
638
665
  if (typeof id !== "string") return void 0;
639
666
  return assertions.find((candidate) => candidate.id === id);
640
667
  }
641
668
  function isIdentityAssertionValidationError(error) {
642
- return error instanceof chunkMRDBBHIZ_cjs.ValidationError && error.details.issues.length > 0 && error.details.issues.every(
669
+ return error instanceof chunkX4GDXBOP_cjs.ValidationError && error.details.issues.length > 0 && error.details.issues.every(
643
670
  (issue) => issue.path === "identity.assertions" && issue.assertionId !== void 0
644
671
  );
645
672
  }
@@ -665,7 +692,7 @@ function identityImportProgress(error) {
665
692
  if (typeof error !== "object" || error === null) {
666
693
  return { created: 0, skipped: 0 };
667
694
  }
668
- const progress = error[chunkJFRT7S3B_cjs.IDENTITY_IMPORT_PROGRESS];
695
+ const progress = error[chunkL6EVYIID_cjs.IDENTITY_IMPORT_PROGRESS];
669
696
  if (typeof progress !== "object" || progress === null || !("created" in progress) || typeof progress.created !== "number" || !("skipped" in progress) || typeof progress.skipped !== "number") {
670
697
  return { created: 0, skipped: 0 };
671
698
  }
@@ -674,7 +701,7 @@ function identityImportProgress(error) {
674
701
  function validateStreamHeader(header) {
675
702
  const parsed = GraphDataHeaderSchema.safeParse(header);
676
703
  if (parsed.success) return;
677
- throw new chunkMRDBBHIZ_cjs.ValidationError(
704
+ throw new chunkX4GDXBOP_cjs.ValidationError(
678
705
  `Invalid graph interchange stream header: ${parsed.error.message}`,
679
706
  {
680
707
  issues: parsed.error.issues.map((issue) => ({
@@ -734,7 +761,7 @@ async function refreshStatisticsAfterImport(store, options, result, surface) {
734
761
  }
735
762
  function buildNodeSchemaMap(graph) {
736
763
  const map = /* @__PURE__ */ new Map();
737
- for (const kindName of chunkBFUOME67_cjs.getNodeKinds(graph)) {
764
+ for (const kindName of chunk7B7I7YAW_cjs.getNodeKinds(graph)) {
738
765
  const registration = graph.nodes[kindName];
739
766
  map.set(kindName, {
740
767
  registration,
@@ -745,7 +772,7 @@ function buildNodeSchemaMap(graph) {
745
772
  }
746
773
  function buildEdgeSchemaMap(graph) {
747
774
  const map = /* @__PURE__ */ new Map();
748
- for (const kindName of chunkBFUOME67_cjs.getEdgeKinds(graph)) {
775
+ for (const kindName of chunk7B7I7YAW_cjs.getEdgeKinds(graph)) {
749
776
  const registration = graph.edges[kindName];
750
777
  map.set(kindName, {
751
778
  registration,
@@ -754,12 +781,12 @@ function buildEdgeSchemaMap(graph) {
754
781
  }
755
782
  return map;
756
783
  }
757
- async function processNodes(backend, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds, lock) {
784
+ async function processNodes(frame, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds) {
758
785
  const batchSize = options.batchSize;
759
786
  for (let index = 0; index < nodes.length; index += batchSize) {
760
787
  const batch = nodes.slice(index, index + batchSize);
761
788
  await processNodeSlice(
762
- backend,
789
+ frame,
763
790
  graphId,
764
791
  registry,
765
792
  batch,
@@ -767,8 +794,7 @@ async function processNodes(backend, graphId, registry, nodes, schemas, options,
767
794
  options,
768
795
  result,
769
796
  errors,
770
- importedNodeIds,
771
- lock
797
+ importedNodeIds
772
798
  );
773
799
  }
774
800
  }
@@ -802,7 +828,7 @@ function recordNodeOutcome(node, outcome, result, errors, importedNodeIds) {
802
828
  }
803
829
  }
804
830
  }
805
- async function processNodeSlice(backend, graphId, registry, batch, schemas, options, result, errors, importedNodeIds, lock) {
831
+ async function processNodeSlice(frame, graphId, registry, batch, schemas, options, result, errors, importedNodeIds) {
806
832
  const record = (node, outcome) => {
807
833
  recordNodeOutcome(node, outcome, result, errors, importedNodeIds);
808
834
  };
@@ -861,20 +887,26 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
861
887
  });
862
888
  }
863
889
  const {
864
- backend: validationBackend,
890
+ reads,
891
+ reader: validationBackend,
865
892
  registerPendingNode,
866
893
  registerPendingUniqueEntries,
867
894
  registerAppliedNodeUpdate,
868
895
  seedNodeRow,
869
896
  seedUniqueRow
870
- } = chunkJB6T4GLL_cjs.createNodeBatchValidationBackend(graphId, registry, backend);
871
- await chunkJB6T4GLL_cjs.primeBatchValidationCaches(
872
- { graphId, registry },
897
+ } = chunk2KCTP3U2_cjs.createNodeBatchValidationSeams(graphId, registry, frame.target);
898
+ await chunk2KCTP3U2_cjs.primeBatchValidationCaches(
899
+ {
900
+ graphId,
901
+ registry,
902
+ batchPointRead: frame.batchPointRead,
903
+ uniqueSidecarBatch: frame.uniqueSidecarBatch
904
+ },
873
905
  candidates.map((candidate) => candidate.draft),
874
- backend,
906
+ frame.target,
875
907
  { seedNodeRow, seedUniqueRow }
876
908
  );
877
- const writeContext = { graphId, registry, lock };
909
+ const overlaidSession = frame.overlaidSession(reads);
878
910
  const accepted = [];
879
911
  for (const candidate of candidates) {
880
912
  const { node, schemaEntry, props } = candidate;
@@ -889,7 +921,7 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
889
921
  case "skip": {
890
922
  record(node, {
891
923
  status: "skipped",
892
- liveTarget: chunk5PRKMB24_cjs.isLiveNodeRow(existing)
924
+ liveTarget: chunkNUQ2YFFH_cjs.isLiveNodeRow(existing)
893
925
  });
894
926
  break;
895
927
  }
@@ -901,7 +933,7 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
901
933
  break;
902
934
  }
903
935
  case "update": {
904
- if (!chunk5PRKMB24_cjs.isLiveNodeRow(existing)) {
936
+ if (!chunkNUQ2YFFH_cjs.isLiveNodeRow(existing)) {
905
937
  record(node, { status: "skipped", liveTarget: false });
906
938
  break;
907
939
  }
@@ -913,30 +945,18 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
913
945
  record(node, { status: "error", error: updateWindow.error });
914
946
  break;
915
947
  }
916
- const updateError = await updateImportedNode(
917
- writeContext,
918
- // The pending-aware overlay, not the raw backend: the update's
919
- // uniqueness pre-check must see a unique value already reserved by
920
- // an unflushed create EARLIER in this slice, so it degrades to a
921
- // per-row error exactly as the sequential path does — rather than
922
- // claiming the key on the real backend and colliding with that
923
- // create at flush (which would throw and roll back the whole
924
- // import). Writes still delegate to the real backend.
925
- validationBackend,
926
- node,
927
- {
928
- existing,
929
- schema: schemaEntry.registration.type.schema,
930
- validatedProps: props,
931
- uniqueConstraints,
932
- windowFence: updateWindow.value
933
- }
934
- );
948
+ const updateError = await updateImportedNode(overlaidSession, node, {
949
+ existing,
950
+ schema: schemaEntry.registration.type.schema,
951
+ validatedProps: props,
952
+ uniqueConstraints,
953
+ windowFence: updateWindow.value
954
+ });
935
955
  if (updateError === void 0) {
936
956
  registerAppliedNodeUpdate(
937
957
  node.kind,
938
958
  node.id,
939
- chunk5PRKMB24_cjs.rowPropsToObject(existing.props),
959
+ chunkNUQ2YFFH_cjs.rowPropsToObject(existing.props),
940
960
  props,
941
961
  uniqueConstraints
942
962
  );
@@ -950,44 +970,38 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
950
970
  }
951
971
  continue;
952
972
  }
953
- const uniquenessResult = await catchUniquenessError(
954
- () => chunk3KOY4FH3_cjs.checkUniquenessConstraints(
973
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
974
+ await chunk2CVDZCXH_cjs.checkUniquenessConstraints(
955
975
  { graphId, registry, backend: validationBackend },
956
976
  node.kind,
957
977
  node.id,
958
978
  props,
959
979
  uniqueConstraints
960
- )
961
- );
962
- if (!uniquenessResult.ok) {
963
- record(node, { status: "error", error: uniquenessResult.error });
980
+ );
981
+ await chunk2KCTP3U2_cjs.checkDisjointnessConstraint(
982
+ { graphId, registry, backend: validationBackend },
983
+ node.kind,
984
+ node.id
985
+ );
986
+ });
987
+ if (!constraintResult.ok) {
988
+ record(node, { status: "error", error: constraintResult.error });
964
989
  continue;
965
990
  }
966
- registerPendingNode(buildImportInsertParams(graphId, candidate));
991
+ registerPendingNode(buildImportInsertParams(graphId, node, props));
967
992
  registerPendingUniqueEntries(node.kind, node.id, props, uniqueConstraints);
968
993
  accepted.push(candidate);
969
994
  }
970
995
  if (accepted.length > 0) {
971
- const insertParamsList = accepted.map(
972
- (candidate) => buildImportInsertParams(graphId, candidate)
973
- );
974
- if (backend.insertNodesBatch === void 0) {
975
- for (const params of insertParamsList) {
976
- await backend.insertNode(params);
977
- }
978
- } else {
979
- await backend.insertNodesBatch(insertParamsList);
980
- }
981
- await chunk3KOY4FH3_cjs.applyNodeInsertSideEffectsBatch(
982
- writeContext,
983
- accepted.map((candidate) => ({
984
- kind: candidate.node.kind,
985
- id: candidate.node.id,
986
- schema: candidate.schemaEntry.registration.type.schema,
987
- props: candidate.props,
988
- uniqueConstraints: candidate.schemaEntry.registration.unique ?? []
989
- })),
990
- backend
996
+ await frame.session.createNodesNoReturn(
997
+ accepted.map(
998
+ (candidate) => importNodeInsertWork(
999
+ graphId,
1000
+ candidate.node,
1001
+ candidate.schemaEntry.registration,
1002
+ candidate.props
1003
+ )
1004
+ )
991
1005
  );
992
1006
  for (const candidate of accepted) {
993
1007
  record(candidate.node, { status: "created" });
@@ -996,20 +1010,11 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
996
1010
  for (const node of deferred) {
997
1011
  record(
998
1012
  node,
999
- await processNode(
1000
- backend,
1001
- graphId,
1002
- registry,
1003
- node,
1004
- schemas,
1005
- options,
1006
- lock
1007
- )
1013
+ await processNode(frame, graphId, registry, node, schemas, options)
1008
1014
  );
1009
1015
  }
1010
1016
  }
1011
- function buildImportInsertParams(graphId, candidate) {
1012
- const { node, props } = candidate;
1017
+ function buildImportInsertParams(graphId, node, props) {
1013
1018
  return {
1014
1019
  graphId,
1015
1020
  kind: node.kind,
@@ -1019,36 +1024,58 @@ function buildImportInsertParams(graphId, candidate) {
1019
1024
  ...node.validTo !== void 0 && { validTo: node.validTo }
1020
1025
  };
1021
1026
  }
1022
- async function catchUniquenessError(fn) {
1027
+ function importNodeInsertWork(graphId, node, registration, props) {
1028
+ return {
1029
+ params: buildImportInsertParams(graphId, node, props),
1030
+ claim: {
1031
+ kind: node.kind,
1032
+ id: node.id,
1033
+ props,
1034
+ constraints: registration.unique ?? []
1035
+ },
1036
+ sideEffects: {
1037
+ kind: node.kind,
1038
+ id: node.id,
1039
+ schema: registration.type.schema,
1040
+ props,
1041
+ uniqueConstraints: registration.unique ?? []
1042
+ }
1043
+ };
1044
+ }
1045
+ async function catchDeclaredConstraintRefusal(fn) {
1023
1046
  try {
1024
1047
  return { ok: true, value: await fn() };
1025
1048
  } catch (error) {
1026
- if (error instanceof chunkMRDBBHIZ_cjs.UniquenessError) {
1049
+ if (error instanceof chunkX4GDXBOP_cjs.UniquenessError || error instanceof chunkX4GDXBOP_cjs.DisjointError || error instanceof chunkX4GDXBOP_cjs.CardinalityError) {
1027
1050
  return { ok: false, error: error.message };
1028
1051
  }
1029
1052
  throw error;
1030
1053
  }
1031
1054
  }
1032
1055
  var NODE_UPDATE_TARGET_CHANGED_CODE = "INTERCHANGE_NODE_UPDATE_TARGET_CHANGED";
1033
- async function updateImportedNode(writeContext, backend, node, args) {
1056
+ async function updateImportedNode(session, node, args) {
1034
1057
  try {
1035
- const result = await catchUniquenessError(
1036
- () => chunk3KOY4FH3_cjs.applyNodeUpdate(
1037
- writeContext,
1038
- {
1039
- existing: args.existing,
1040
- schema: args.schema,
1041
- validatedProps: args.validatedProps,
1042
- uniqueConstraints: args.uniqueConstraints,
1043
- ...args.windowFence,
1044
- ...node.validTo !== void 0 && { validTo: node.validTo }
1045
- },
1046
- backend
1058
+ const result = await catchDeclaredConstraintRefusal(
1059
+ () => (
1060
+ // The fence is an ARGUMENT the method requires, not a spread the call
1061
+ // site may forget: the guard's verdict travels to the statement that
1062
+ // honors it, and an empty fence (`{}`) is the stated decision to assert
1063
+ // nothing rather than an omission.
1064
+ session.reviseNode(
1065
+ {
1066
+ existing: args.existing,
1067
+ schema: args.schema,
1068
+ validatedProps: args.validatedProps,
1069
+ uniqueConstraints: args.uniqueConstraints,
1070
+ ...node.validTo !== void 0 && { validTo: node.validTo }
1071
+ },
1072
+ { validityLowerBound: args.windowFence }
1073
+ )
1047
1074
  )
1048
1075
  );
1049
1076
  return result.ok ? void 0 : result.error;
1050
1077
  } catch (error) {
1051
- if (!(error instanceof chunkMRDBBHIZ_cjs.DatabaseOperationError) || error.details.reason !== "no_row_returned") {
1078
+ if (!(error instanceof chunkX4GDXBOP_cjs.DatabaseOperationError) || error.details.reason !== "no_row_returned") {
1052
1079
  throw error;
1053
1080
  }
1054
1081
  return `${NODE_UPDATE_TARGET_CHANGED_CODE}: Node "${node.kind}:${node.id}" was not updated: no live node matching the id and the validity bound this import checked remained when the write ran, so the row changed or was removed after it was checked. Re-export the source and retry.`;
@@ -1068,23 +1095,32 @@ function edgeIdentityConflict(edge, existing) {
1068
1095
  if (differences.length === 0) return void 0;
1069
1096
  return `${EDGE_IDENTITY_CONFLICT_CODE}: Edge "${edge.id}" already exists with a different immutable identity \u2014 ${differences.join("; ")}. Edge ids are unique per graph, so the incoming edge can neither update nor be created under that id. Give it a distinct id, or import it under the identity the stored row already carries.`;
1070
1097
  }
1071
- async function updateImportedEdge(backend, graphId, edge, props, windowFence) {
1098
+ async function updateImportedEdge(session, edge, props, windowFence) {
1072
1099
  try {
1073
- await backend.updateEdge({
1074
- graphId,
1075
- id: edge.id,
1076
- kind: edge.kind,
1077
- fromKind: edge.from.kind,
1078
- fromId: edge.from.id,
1079
- toKind: edge.to.kind,
1080
- toId: edge.to.id,
1081
- props,
1082
- ...windowFence,
1083
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1084
- });
1100
+ await session.reviseEdge(
1101
+ {
1102
+ id: edge.id,
1103
+ props,
1104
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1105
+ },
1106
+ {
1107
+ validityLowerBound: windowFence,
1108
+ // Import re-admits no row to a counted population — it never resurrects
1109
+ // and never clears an end — so it reads no stored `valid_to` and asserts
1110
+ // none. `{}` is the stated decision, not an omission.
1111
+ validityUpperBound: {},
1112
+ edgeIdentity: {
1113
+ kind: edge.kind,
1114
+ fromKind: edge.from.kind,
1115
+ fromId: edge.from.id,
1116
+ toKind: edge.to.kind,
1117
+ toId: edge.to.id
1118
+ }
1119
+ }
1120
+ );
1085
1121
  return void 0;
1086
1122
  } catch (error) {
1087
- if (!(error instanceof chunkMRDBBHIZ_cjs.DatabaseOperationError) || error.details.reason !== "no_row_returned") {
1123
+ if (!(error instanceof chunkX4GDXBOP_cjs.DatabaseOperationError) || error.details.reason !== "no_row_returned") {
1088
1124
  throw error;
1089
1125
  }
1090
1126
  return `${EDGE_IDENTITY_CONFLICT_CODE}: Edge "${edge.id}" of kind "${edge.kind}" from "${edge.from.kind}:${edge.from.id}" to "${edge.to.kind}:${edge.to.id}" was not updated: no live edge matching the identity and the validity bound this import checked remained when the write ran, so the row changed or was removed after it was checked. Re-export the source and retry.`;
@@ -1094,9 +1130,9 @@ function windowResultOf(assert) {
1094
1130
  try {
1095
1131
  return { ok: true, value: assert() };
1096
1132
  } catch (error) {
1097
- if (error instanceof chunkMRDBBHIZ_cjs.ValidationError) {
1133
+ if (error instanceof chunkX4GDXBOP_cjs.ValidationError) {
1098
1134
  const coded = error.details.issues.find(
1099
- (issue) => issue.code === chunkMRDBBHIZ_cjs.INVERTED_VALIDITY_WINDOW_CODE || issue.code === chunkMRDBBHIZ_cjs.IMMUTABLE_VALIDITY_LOWER_BOUND_CODE
1135
+ (issue) => issue.code === chunkX4GDXBOP_cjs.INVERTED_VALIDITY_WINDOW_CODE || issue.code === chunkX4GDXBOP_cjs.IMMUTABLE_VALIDITY_LOWER_BOUND_CODE
1100
1136
  );
1101
1137
  if (coded !== void 0) {
1102
1138
  return { ok: false, error: `${coded.code}: ${error.message}` };
@@ -1114,12 +1150,12 @@ function windowErrorOf(assert) {
1114
1150
  }
1115
1151
  function validateValidityWindow(entity) {
1116
1152
  return windowErrorOf(() => {
1117
- chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
1153
+ chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(
1118
1154
  entity.validFrom ?? void 0,
1119
1155
  "validFrom"
1120
1156
  );
1121
- chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(entity.validTo, "validTo");
1122
- chunkTQHGE7UC_cjs.assertOrderedValidityWindow(
1157
+ chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(entity.validTo, "validTo");
1158
+ chunkM5MSP3BI_cjs.assertOrderedValidityWindow(
1123
1159
  `${entity.kind} "${entity.id}"`,
1124
1160
  entity.validFrom ?? void 0,
1125
1161
  entity.validTo
@@ -1128,7 +1164,7 @@ function validateValidityWindow(entity) {
1128
1164
  }
1129
1165
  function validateUpdateValidityWindow(entity, storedValidFrom) {
1130
1166
  const verdict = windowResultOf(
1131
- () => chunkTQHGE7UC_cjs.assertWritableValidityWindow(
1167
+ () => chunkM5MSP3BI_cjs.assertWritableValidityWindow(
1132
1168
  `${entity.kind} "${entity.id}"`,
1133
1169
  entity.validFrom ?? void 0,
1134
1170
  {
@@ -1143,7 +1179,7 @@ function validateUpdateValidityWindow(entity, storedValidFrom) {
1143
1179
  );
1144
1180
  return verdict.ok ? { ok: true, value: verdict.value.storedLowerBoundFence } : verdict;
1145
1181
  }
1146
- async function processNode(backend, graphId, registry, node, schemas, options, lock) {
1182
+ async function processNode(frame, graphId, registry, node, schemas, options) {
1147
1183
  const schemaEntry = schemas.get(node.kind);
1148
1184
  if (!schemaEntry) {
1149
1185
  return { status: "error", error: `Unknown node kind: ${node.kind}` };
@@ -1162,12 +1198,11 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1162
1198
  }
1163
1199
  const { registration } = schemaEntry;
1164
1200
  const uniqueConstraints = registration.unique ?? [];
1165
- const writeContext = { graphId, registry, lock };
1166
- const existing = await backend.getNode(graphId, node.kind, node.id);
1201
+ const existing = await frame.target.getNode(graphId, node.kind, node.id);
1167
1202
  if (existing) {
1168
1203
  switch (options.onConflict) {
1169
1204
  case "skip": {
1170
- return { status: "skipped", liveTarget: chunk5PRKMB24_cjs.isLiveNodeRow(existing) };
1205
+ return { status: "skipped", liveTarget: chunkNUQ2YFFH_cjs.isLiveNodeRow(existing) };
1171
1206
  }
1172
1207
  case "error": {
1173
1208
  return {
@@ -1176,7 +1211,7 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1176
1211
  };
1177
1212
  }
1178
1213
  case "update": {
1179
- if (!chunk5PRKMB24_cjs.isLiveNodeRow(existing)) {
1214
+ if (!chunkNUQ2YFFH_cjs.isLiveNodeRow(existing)) {
1180
1215
  return { status: "skipped", liveTarget: false };
1181
1216
  }
1182
1217
  const updateWindow = validateUpdateValidityWindow(
@@ -1186,18 +1221,13 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1186
1221
  if (!updateWindow.ok) {
1187
1222
  return { status: "error", error: updateWindow.error };
1188
1223
  }
1189
- const updateError = await updateImportedNode(
1190
- writeContext,
1191
- backend,
1192
- node,
1193
- {
1194
- existing,
1195
- schema: registration.type.schema,
1196
- validatedProps: propsResult.data,
1197
- uniqueConstraints,
1198
- windowFence: updateWindow.value
1199
- }
1200
- );
1224
+ const updateError = await updateImportedNode(frame.session, node, {
1225
+ existing,
1226
+ schema: registration.type.schema,
1227
+ validatedProps: propsResult.data,
1228
+ uniqueConstraints,
1229
+ windowFence: updateWindow.value
1230
+ });
1201
1231
  if (updateError !== void 0) {
1202
1232
  return { status: "error", error: updateError };
1203
1233
  }
@@ -1205,45 +1235,34 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1205
1235
  }
1206
1236
  }
1207
1237
  }
1208
- const uniquenessResult = await catchUniquenessError(
1209
- () => chunk3KOY4FH3_cjs.checkUniquenessConstraints(
1210
- { graphId, registry, backend },
1238
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
1239
+ await chunk2CVDZCXH_cjs.checkUniquenessConstraints(
1240
+ { graphId, registry, backend: frame.target },
1211
1241
  node.kind,
1212
1242
  node.id,
1213
1243
  propsResult.data,
1214
1244
  uniqueConstraints
1215
- )
1216
- );
1217
- if (!uniquenessResult.ok) {
1218
- return { status: "error", error: uniquenessResult.error };
1219
- }
1220
- await backend.insertNode({
1221
- graphId,
1222
- kind: node.kind,
1223
- id: node.id,
1224
- props: propsResult.data,
1225
- ...node.validFrom !== void 0 && { validFrom: node.validFrom },
1226
- ...node.validTo !== void 0 && { validTo: node.validTo }
1245
+ );
1246
+ await chunk2KCTP3U2_cjs.checkDisjointnessConstraint(
1247
+ { graphId, registry, backend: frame.target },
1248
+ node.kind,
1249
+ node.id
1250
+ );
1227
1251
  });
1228
- await chunk3KOY4FH3_cjs.applyNodeInsertSideEffects(
1229
- writeContext,
1230
- {
1231
- kind: node.kind,
1232
- id: node.id,
1233
- schema: registration.type.schema,
1234
- props: propsResult.data,
1235
- uniqueConstraints
1236
- },
1237
- backend
1252
+ if (!constraintResult.ok) {
1253
+ return { status: "error", error: constraintResult.error };
1254
+ }
1255
+ await frame.session.createNode(
1256
+ importNodeInsertWork(graphId, node, registration, propsResult.data)
1238
1257
  );
1239
1258
  return { status: "created" };
1240
1259
  }
1241
- async function processEdges(backend, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1260
+ async function processEdges(frame, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1242
1261
  const batchSize = options.batchSize;
1243
1262
  for (let index = 0; index < edges.length; index += batchSize) {
1244
1263
  const batch = edges.slice(index, index + batchSize);
1245
1264
  await processEdgeSlice(
1246
- backend,
1265
+ frame,
1247
1266
  graphId,
1248
1267
  registry,
1249
1268
  batch,
@@ -1281,10 +1300,29 @@ function recordEdgeOutcome(edge, outcome, result, errors) {
1281
1300
  }
1282
1301
  }
1283
1302
  }
1284
- async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1303
+ function edgeInsertParamsOf(graphId, candidate) {
1304
+ const { edge, props } = candidate;
1305
+ return {
1306
+ graphId,
1307
+ id: edge.id,
1308
+ kind: edge.kind,
1309
+ fromKind: edge.from.kind,
1310
+ fromId: edge.from.id,
1311
+ toKind: edge.to.kind,
1312
+ toId: edge.to.id,
1313
+ props,
1314
+ ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1315
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1316
+ };
1317
+ }
1318
+ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1285
1319
  const record = (edge, outcome) => {
1286
1320
  recordEdgeOutcome(edge, outcome, result, errors);
1287
1321
  };
1322
+ const {
1323
+ backend: cardinalityValidationBackend,
1324
+ registerPendingEdgeForCardinality
1325
+ } = chunk2KCTP3U2_cjs.createEdgeBatchValidationBackend(frame.target);
1288
1326
  const candidates = [];
1289
1327
  const deferred = [];
1290
1328
  const seenIds = /* @__PURE__ */ new Set();
@@ -1311,7 +1349,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1311
1349
  });
1312
1350
  continue;
1313
1351
  }
1314
- const endpointError = chunkFQPEMEWX_cjs.validateEdgeEndpoints(
1352
+ const endpointError = chunkCRZ56SZU_cjs.validateEdgeEndpoints(
1315
1353
  edge.kind,
1316
1354
  edge.from.kind,
1317
1355
  edge.to.kind,
@@ -1345,7 +1383,12 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1345
1383
  }
1346
1384
  const liveEndpointKeys = /* @__PURE__ */ new Set();
1347
1385
  const checkedEndpointKeys = /* @__PURE__ */ new Set();
1348
- if (options.validateReferences && backend.getNodes !== void 0) {
1386
+ const boundGetNodesForEndpoints = chunkNUQ2YFFH_cjs.bindExtraIfReachable(
1387
+ frame.target,
1388
+ frame.batchPointRead.extras.getNodes,
1389
+ chunkNUQ2YFFH_cjs.BATCH_POINT_READ.id
1390
+ );
1391
+ if (options.validateReferences && boundGetNodesForEndpoints !== void 0) {
1349
1392
  const idsByKind = /* @__PURE__ */ new Map();
1350
1393
  for (const { edge } of candidates) {
1351
1394
  for (const endpoint of [edge.from, edge.to]) {
@@ -1358,9 +1401,11 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1358
1401
  }
1359
1402
  }
1360
1403
  for (const [kind, ids] of idsByKind) {
1361
- const rows = await backend.getNodes(graphId, kind, [...ids]);
1404
+ const rows = await boundGetNodesForEndpoints.getNodes(graphId, kind, [
1405
+ ...ids
1406
+ ]);
1362
1407
  for (const row of rows) {
1363
- if (chunk5PRKMB24_cjs.isLiveNodeRow(row)) {
1408
+ if (chunkNUQ2YFFH_cjs.isLiveNodeRow(row)) {
1364
1409
  liveEndpointKeys.add(makeNodeKey(kind, row.id));
1365
1410
  }
1366
1411
  }
@@ -1370,12 +1415,17 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1370
1415
  const key = makeNodeKey(endpoint.kind, endpoint.id);
1371
1416
  if (importedNodeIds.has(key)) return true;
1372
1417
  if (checkedEndpointKeys.has(key)) return liveEndpointKeys.has(key);
1373
- const row = await backend.getNode(graphId, endpoint.kind, endpoint.id);
1374
- return row !== void 0 && chunk5PRKMB24_cjs.isLiveNodeRow(row);
1418
+ const row = await frame.target.getNode(graphId, endpoint.kind, endpoint.id);
1419
+ return row !== void 0 && chunkNUQ2YFFH_cjs.isLiveNodeRow(row);
1375
1420
  };
1376
1421
  const existingById = /* @__PURE__ */ new Map();
1377
- if (candidates.length > 0 && backend.getEdges !== void 0) {
1378
- const rows = await backend.getEdges(
1422
+ const boundGetEdges = chunkNUQ2YFFH_cjs.bindExtraIfReachable(
1423
+ frame.target,
1424
+ frame.batchPointRead.extras.getEdges,
1425
+ chunkNUQ2YFFH_cjs.BATCH_POINT_READ.id
1426
+ );
1427
+ if (candidates.length > 0 && boundGetEdges !== void 0) {
1428
+ const rows = await boundGetEdges.getEdges(
1379
1429
  graphId,
1380
1430
  candidates.map((candidate) => candidate.edge.id)
1381
1431
  );
@@ -1405,7 +1455,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1405
1455
  continue;
1406
1456
  }
1407
1457
  }
1408
- const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await backend.getEdge(graphId, edge.id);
1458
+ const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await frame.target.getEdge(graphId, edge.id);
1409
1459
  if (existing) {
1410
1460
  const identityConflict = edgeIdentityConflict(edge, existing);
1411
1461
  if (identityConflict !== void 0) {
@@ -1441,8 +1491,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1441
1491
  break;
1442
1492
  }
1443
1493
  const updateError = await updateImportedEdge(
1444
- backend,
1445
- graphId,
1494
+ frame.session,
1446
1495
  edge,
1447
1496
  props,
1448
1497
  updateWindow.value
@@ -1457,28 +1506,37 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1457
1506
  }
1458
1507
  continue;
1459
1508
  }
1509
+ const insertParams = edgeInsertParamsOf(graphId, candidate);
1510
+ const cardinality = edgeSchemas.get(edge.kind)?.registration.cardinality ?? "many";
1511
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1512
+ () => chunk2KCTP3U2_cjs.checkCardinalityConstraint(
1513
+ { graphId, registry, backend: cardinalityValidationBackend },
1514
+ edge.kind,
1515
+ cardinality,
1516
+ edge.from.kind,
1517
+ edge.from.id,
1518
+ edge.to.kind,
1519
+ edge.to.id,
1520
+ edge.validTo
1521
+ )
1522
+ );
1523
+ if (!cardinalityResult.ok) {
1524
+ record(edge, { status: "error", error: cardinalityResult.error });
1525
+ continue;
1526
+ }
1527
+ registerPendingEdgeForCardinality(insertParams, cardinality);
1460
1528
  accepted.push(candidate);
1461
1529
  }
1462
1530
  if (accepted.length > 0) {
1463
- const insertParamsList = accepted.map(({ edge, props }) => ({
1464
- graphId,
1465
- id: edge.id,
1466
- kind: edge.kind,
1467
- fromKind: edge.from.kind,
1468
- fromId: edge.from.id,
1469
- toKind: edge.to.kind,
1470
- toId: edge.to.id,
1471
- props,
1472
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1473
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1474
- }));
1475
- if (backend.insertEdgesBatch === void 0) {
1476
- for (const params of insertParamsList) {
1477
- await backend.insertEdge(params);
1478
- }
1479
- } else {
1480
- await backend.insertEdgesBatch(insertParamsList);
1481
- }
1531
+ await frame.session.createEdgesNoReturn(
1532
+ accepted.map(
1533
+ (candidate) => importEdgeInsertWork(
1534
+ graphId,
1535
+ candidate,
1536
+ edgeSchemas.get(candidate.edge.kind)?.registration.cardinality ?? "many"
1537
+ )
1538
+ )
1539
+ );
1482
1540
  for (const candidate of accepted) {
1483
1541
  record(candidate.edge, { status: "created" });
1484
1542
  }
@@ -1487,7 +1545,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1487
1545
  record(
1488
1546
  edge,
1489
1547
  await processEdge(
1490
- backend,
1548
+ frame,
1491
1549
  graphId,
1492
1550
  registry,
1493
1551
  edge,
@@ -1499,7 +1557,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1499
1557
  );
1500
1558
  }
1501
1559
  }
1502
- async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1560
+ async function processEdge(frame, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1503
1561
  const schemaEntry = edgeSchemas.get(edge.kind);
1504
1562
  if (!schemaEntry) {
1505
1563
  return { status: "error", error: `Unknown edge kind: ${edge.kind}` };
@@ -1513,7 +1571,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1513
1571
  if (!nodeSchemas.has(edge.to.kind)) {
1514
1572
  return { status: "error", error: `Unknown to node kind: ${edge.to.kind}` };
1515
1573
  }
1516
- const endpointError = chunkFQPEMEWX_cjs.validateEdgeEndpoints(
1574
+ const endpointError = chunkCRZ56SZU_cjs.validateEdgeEndpoints(
1517
1575
  edge.kind,
1518
1576
  edge.from.kind,
1519
1577
  edge.to.kind,
@@ -1527,12 +1585,12 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1527
1585
  const fromKey = makeNodeKey(edge.from.kind, edge.from.id);
1528
1586
  const toKey = makeNodeKey(edge.to.kind, edge.to.id);
1529
1587
  if (!importedNodeIds.has(fromKey)) {
1530
- const fromExists = await backend.getNode(
1588
+ const fromExists = await frame.target.getNode(
1531
1589
  graphId,
1532
1590
  edge.from.kind,
1533
1591
  edge.from.id
1534
1592
  );
1535
- if (fromExists === void 0 || !chunk5PRKMB24_cjs.isLiveNodeRow(fromExists)) {
1593
+ if (fromExists === void 0 || !chunkNUQ2YFFH_cjs.isLiveNodeRow(fromExists)) {
1536
1594
  return {
1537
1595
  status: "error",
1538
1596
  error: `From node not found: ${edge.from.kind}:${edge.from.id}`
@@ -1540,8 +1598,12 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1540
1598
  }
1541
1599
  }
1542
1600
  if (!importedNodeIds.has(toKey)) {
1543
- const toExists = await backend.getNode(graphId, edge.to.kind, edge.to.id);
1544
- if (toExists === void 0 || !chunk5PRKMB24_cjs.isLiveNodeRow(toExists)) {
1601
+ const toExists = await frame.target.getNode(
1602
+ graphId,
1603
+ edge.to.kind,
1604
+ edge.to.id
1605
+ );
1606
+ if (toExists === void 0 || !chunkNUQ2YFFH_cjs.isLiveNodeRow(toExists)) {
1545
1607
  return {
1546
1608
  status: "error",
1547
1609
  error: `To node not found: ${edge.to.kind}:${edge.to.id}`
@@ -1561,7 +1623,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1561
1623
  if (validityError !== void 0) {
1562
1624
  return { status: "error", error: validityError };
1563
1625
  }
1564
- const existing = await backend.getEdge(graphId, edge.id);
1626
+ const existing = await frame.target.getEdge(graphId, edge.id);
1565
1627
  if (existing) {
1566
1628
  const identityConflict = edgeIdentityConflict(edge, existing);
1567
1629
  if (identityConflict !== void 0) {
@@ -1589,8 +1651,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1589
1651
  return { status: "error", error: updateWindow.error };
1590
1652
  }
1591
1653
  const updateError = await updateImportedEdge(
1592
- backend,
1593
- graphId,
1654
+ frame.session,
1594
1655
  edge,
1595
1656
  propsResult.data,
1596
1657
  updateWindow.value
@@ -1602,20 +1663,36 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1602
1663
  }
1603
1664
  }
1604
1665
  }
1605
- await backend.insertEdge({
1606
- graphId,
1607
- id: edge.id,
1608
- kind: edge.kind,
1609
- fromKind: edge.from.kind,
1610
- fromId: edge.from.id,
1611
- toKind: edge.to.kind,
1612
- toId: edge.to.id,
1613
- props: propsResult.data,
1614
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1615
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1616
- });
1666
+ const cardinality = schemaEntry.registration.cardinality ?? "many";
1667
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1668
+ () => chunk2KCTP3U2_cjs.checkCardinalityConstraint(
1669
+ { graphId, registry, backend: frame.target },
1670
+ edge.kind,
1671
+ cardinality,
1672
+ edge.from.kind,
1673
+ edge.from.id,
1674
+ edge.to.kind,
1675
+ edge.to.id,
1676
+ edge.validTo
1677
+ )
1678
+ );
1679
+ if (!cardinalityResult.ok) {
1680
+ return { status: "error", error: cardinalityResult.error };
1681
+ }
1682
+ await frame.session.createEdge(
1683
+ importEdgeInsertWork(
1684
+ graphId,
1685
+ { edge, props: propsResult.data },
1686
+ cardinality
1687
+ )
1688
+ );
1617
1689
  return { status: "created" };
1618
1690
  }
1691
+ function importEdgeInsertWork(graphId, candidate, cardinality) {
1692
+ const params = edgeInsertParamsOf(graphId, candidate);
1693
+ const claim = chunkFMMW3KX7_cjs.edgeCardinalityClaim(cardinality, params);
1694
+ return { params, ...claim === void 0 ? {} : { claim } };
1695
+ }
1619
1696
  function validateProperties(properties, schema, unknownStrategy) {
1620
1697
  try {
1621
1698
  const knownKeys = new Set(Object.keys(schema.shape));
@@ -1678,7 +1755,7 @@ function formatZodError(error) {
1678
1755
  }).join("; ");
1679
1756
  }
1680
1757
  function makeNodeKey(kind, id) {
1681
- return chunkEZEEWCFJ_cjs.encodeTupleKey([kind, id]);
1758
+ return chunkCRZ56SZU_cjs.encodeTupleKey([kind, id]);
1682
1759
  }
1683
1760
 
1684
1761
  // src/interchange/export.ts
@@ -1721,7 +1798,7 @@ async function exportGraph(store, options) {
1721
1798
  };
1722
1799
  }
1723
1800
  function exportGraphStream(store, options) {
1724
- const backend = chunk3KOY4FH3_cjs.storeBackend(store);
1801
+ const backend = chunk2CVDZCXH_cjs.storeBackend(store);
1725
1802
  return markExportStreamBackend(
1726
1803
  exportGraphStreamFromBackend(store, backend, options),
1727
1804
  backend
@@ -1732,7 +1809,7 @@ async function* exportGraphStreamFromBackend(store, backend, options) {
1732
1809
  const exportsIdentity = store.graph.identity !== void 0;
1733
1810
  const explicitlyDisabledTemporalFields = options?.includeTemporal === false;
1734
1811
  if (exportsIdentity && explicitlyDisabledTemporalFields) {
1735
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
1812
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
1736
1813
  "Identity export requires temporal endpoint fields.",
1737
1814
  {
1738
1815
  code: "IDENTITY_EXPORT_REQUIRES_TEMPORAL_FIELDS",
@@ -1766,7 +1843,7 @@ async function* exportGraphStreamFromBackend(store, backend, options) {
1766
1843
  idleTimer = void 0;
1767
1844
  unsubscribeFromSignal();
1768
1845
  channel.abort(
1769
- new chunkMRDBBHIZ_cjs.ExportStreamIdleTimeoutError(
1846
+ new chunkX4GDXBOP_cjs.ExportStreamIdleTimeoutError(
1770
1847
  store.graphId,
1771
1848
  idleTimeoutMs,
1772
1849
  backend.capabilities.transactions
@@ -1859,7 +1936,7 @@ function exportStreamCancelled(phase, graphId, signal, framed) {
1859
1936
  const message = phase === "before-open" ? "The graph export stream was aborted through its AbortSignal before it opened: no snapshot transaction was started and no database connection claimed." : framed ? "The graph export stream was aborted through its AbortSignal: its repeatable-read snapshot has been rolled back and the connection it held released." : "The graph export stream was aborted through its AbortSignal: its remaining reads were abandoned. This backend does not support transactions, so the export held no snapshot and no connection \u2014 and the chunks already delivered were never guaranteed to agree with one another.";
1860
1937
  const cause = signal?.reason;
1861
1938
  const suggestion = phase === "before-open" ? "Start a new export; the aborted one claimed nothing." : framed ? "Start a new export; the aborted one released its snapshot transaction and the connection it held." : "Start a new export; nothing was held, but discard the chunks already delivered unless partial, mutually-inconsistent data is acceptable.";
1862
- return new chunkMRDBBHIZ_cjs.ExportStreamCancelledError(
1939
+ return new chunkX4GDXBOP_cjs.ExportStreamCancelledError(
1863
1940
  message,
1864
1941
  { graphId },
1865
1942
  {
@@ -1869,7 +1946,7 @@ function exportStreamCancelled(phase, graphId, signal, framed) {
1869
1946
  );
1870
1947
  }
1871
1948
  function claimSnapshotExportLeaseOrRefuse(graphId, backend) {
1872
- const lease = chunkSIT26LAZ_cjs.acquireSerializedStreamLease(backend, "export-snapshot");
1949
+ const lease = chunkNLX5OWK7_cjs.acquireSerializedStreamLease(backend, "export-snapshot");
1873
1950
  if (!lease.acquired) {
1874
1951
  throw serializedStreamRefusal({
1875
1952
  graphId,
@@ -1881,14 +1958,14 @@ function claimSnapshotExportLeaseOrRefuse(graphId, backend) {
1881
1958
  }
1882
1959
  async function produceExportChunks(store, backend, options, emit) {
1883
1960
  const graphId = store.graphId;
1884
- const nodeKinds = options.nodeKinds ?? chunkBFUOME67_cjs.getNodeKinds(store.graph);
1885
- const edgeKinds = options.edgeKinds ?? chunkBFUOME67_cjs.getEdgeKinds(store.graph);
1961
+ const nodeKinds = options.nodeKinds ?? chunk7B7I7YAW_cjs.getNodeKinds(store.graph);
1962
+ const edgeKinds = options.edgeKinds ?? chunk7B7I7YAW_cjs.getEdgeKinds(store.graph);
1886
1963
  const schemaVersion = await backend.getActiveSchema(graphId);
1887
1964
  await emit({
1888
1965
  type: "header",
1889
1966
  header: {
1890
1967
  formatVersion: FORMAT_VERSION,
1891
- exportedAt: chunkTQHGE7UC_cjs.nowIso(),
1968
+ exportedAt: chunkM5MSP3BI_cjs.nowIso(),
1892
1969
  source: {
1893
1970
  type: "typegraph-export",
1894
1971
  graphId,
@@ -1925,7 +2002,7 @@ async function produceExportChunks(store, backend, options, emit) {
1925
2002
  if (store.graph.identity === void 0) return;
1926
2003
  let after;
1927
2004
  for (; ; ) {
1928
- const page = await chunk3KOY4FH3_cjs.storeRuntime(store).readIdentityAssertionPageAtTarget(
2005
+ const page = await chunk2CVDZCXH_cjs.storeRuntime(store).readIdentityAssertionPageAtTarget(
1929
2006
  backend,
1930
2007
  options.identityMode,
1931
2008
  {
@@ -2074,7 +2151,7 @@ async function* exportNodeChunks(backend, graphId, kind, options) {
2074
2151
  const node = {
2075
2152
  kind: row.kind,
2076
2153
  id: row.id,
2077
- properties: chunk5PRKMB24_cjs.rowPropsToObject(row.props)
2154
+ properties: chunkNUQ2YFFH_cjs.rowPropsToObject(row.props)
2078
2155
  };
2079
2156
  if (options.includeTemporal) {
2080
2157
  const validFrom = (
@@ -2124,7 +2201,7 @@ async function* exportEdgeChunks(backend, graphId, kind, options) {
2124
2201
  kind: row.to_kind,
2125
2202
  id: row.to_id
2126
2203
  },
2127
- properties: chunk5PRKMB24_cjs.rowPropsToObject(row.props)
2204
+ properties: chunkNUQ2YFFH_cjs.rowPropsToObject(row.props)
2128
2205
  };
2129
2206
  if (options.includeTemporal) {
2130
2207
  const validFrom = (
@@ -2175,5 +2252,5 @@ exports.importGraphStream = importGraphStream;
2175
2252
  exports.registerIngestionImportTarget = registerIngestionImportTarget;
2176
2253
  exports.serializedStreamRefusal = serializedStreamRefusal;
2177
2254
  exports.withImportStreamLease = withImportStreamLease;
2178
- //# sourceMappingURL=chunk-3G5W2U2L.cjs.map
2179
- //# sourceMappingURL=chunk-3G5W2U2L.cjs.map
2255
+ //# sourceMappingURL=chunk-KACEYDYV.cjs.map
2256
+ //# sourceMappingURL=chunk-KACEYDYV.cjs.map