@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,13 +1,15 @@
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-TYEYRCXL.js';
2
+ import { storeBackend, storeRuntime, checkUniquenessConstraints } from './chunk-4DKY6RIU.js';
3
+ import { edgeCardinalityClaim } from './chunk-NGQDGL5X.js';
4
+ import { IDENTITY_IMPORT_PROGRESS, IDENTITY_IMPORT_FAILED_ASSERTION } from './chunk-WFSYYU4W.js';
5
+ import { constraintFenceRefusal } from './chunk-VAAC7L57.js';
6
+ import { acquireSerializedStreamLease, snapshotExportContention } from './chunk-QG5VEOKX.js';
7
+ import { batchPointReadVerdict, uniqueSidecarBatchVerdict, createClaimsVerdictThunk } from './chunk-XORONCV3.js';
8
+ import { isLiveNodeRow, rowPropsToObject, bindExtraIfReachable, BATCH_POINT_READ } from './chunk-LKZDQ2B4.js';
9
+ import { getNodeKinds, getEdgeKinds } from './chunk-M3VTS3F6.js';
10
+ import { encodeTupleKey, validateEdgeEndpoints } from './chunk-RVUL2HXY.js';
11
+ import { isCanonicalIsoDate, nowIso, assertWritableValidityWindow, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow } from './chunk-K46SDNQD.js';
12
+ 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
13
  import { requireDefined, createDataKeyedBag, hasOwnKey } from './chunk-DYATYRY4.js';
12
14
  import { z } from 'zod';
13
15
 
@@ -308,22 +310,48 @@ async function importGraphData(store, data, options) {
308
310
  const backend = storeBackend(store);
309
311
  const runtime = storeRuntime(store);
310
312
  const registry = store.registry;
313
+ const batchPointRead = batchPointReadVerdict(backend);
314
+ const uniqueSidecarBatch = uniqueSidecarBatchVerdict(backend);
315
+ const owedClaimReason = graphOwesClaims(graph, registry);
316
+ const claimRefusal = owedClaimReason === void 0 ? void 0 : constraintFenceRefusal({ graphId }, backend, owedClaimReason);
317
+ if (claimRefusal !== void 0) throw claimRefusal;
311
318
  const nodeSchemas = buildNodeSchemaMap(graph);
312
319
  const edgeSchemas = buildEdgeSchemaMap(graph);
313
320
  const importedNodeIds = /* @__PURE__ */ new Set();
314
- await runInWriteTransaction(
321
+ await runWritePlan(
315
322
  {
316
323
  graphId,
324
+ registry,
325
+ // Interning (`createClaimsVerdictThunk`'s `WeakMap`) makes this the SAME
326
+ // thunk object the store's own operations use for this backend — a
327
+ // second, independent memoization for the same backend is exactly what
328
+ // interning exists to rule out.
329
+ claimsVerdict: createClaimsVerdictThunk(backend),
330
+ uniqueSidecarBatch,
317
331
  schemaVersion: store.introspect().schemaVersion,
318
332
  historyEnabled: store.historyEnabled,
319
333
  revisionTrackingEnabled: store.revisionTrackingEnabled,
320
- revisionSchema: store.revisionSchema
334
+ revisionSchema: store.revisionSchema,
335
+ // HOW this caller takes position 3. `lockIdentityImportTarget` is
336
+ // `lockIdentityGraph` on an identity graph and a no-op otherwise, so the
337
+ // participation below is unconditional and the acquirer owns the
338
+ // "identity is configured" test, exactly as before the migration.
339
+ identityLock: (target) => runtime.lockIdentityImportTarget(target)
321
340
  },
341
+ // An import writes node rows AND edge rows in one frame, so it declares the
342
+ // mixed family explicitly instead of receiving either narrower session.
343
+ mixedWritePlan(void 0, true),
322
344
  backend,
323
- async (target, lock) => {
324
- await runtime.lockIdentityImportTarget(target);
325
- await processNodes(
345
+ async (session, target, overlaidSession) => {
346
+ const frame = {
347
+ session,
326
348
  target,
349
+ overlaidSession,
350
+ batchPointRead,
351
+ uniqueSidecarBatch
352
+ };
353
+ await processNodes(
354
+ frame,
327
355
  graphId,
328
356
  registry,
329
357
  data.nodes,
@@ -331,8 +359,7 @@ async function importGraphData(store, data, options) {
331
359
  options,
332
360
  result,
333
361
  errors,
334
- importedNodeIds,
335
- lock
362
+ importedNodeIds
336
363
  );
337
364
  await runtime.foldImportedIdentityNodes(
338
365
  target,
@@ -341,7 +368,7 @@ async function importGraphData(store, data, options) {
341
368
  ).map((node) => ({ kind: node.kind, id: node.id }))
342
369
  );
343
370
  await processEdges(
344
- target,
371
+ frame,
345
372
  graphId,
346
373
  registry,
347
374
  data.edges,
@@ -752,12 +779,12 @@ function buildEdgeSchemaMap(graph) {
752
779
  }
753
780
  return map;
754
781
  }
755
- async function processNodes(backend, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds, lock) {
782
+ async function processNodes(frame, graphId, registry, nodes, schemas, options, result, errors, importedNodeIds) {
756
783
  const batchSize = options.batchSize;
757
784
  for (let index = 0; index < nodes.length; index += batchSize) {
758
785
  const batch = nodes.slice(index, index + batchSize);
759
786
  await processNodeSlice(
760
- backend,
787
+ frame,
761
788
  graphId,
762
789
  registry,
763
790
  batch,
@@ -765,8 +792,7 @@ async function processNodes(backend, graphId, registry, nodes, schemas, options,
765
792
  options,
766
793
  result,
767
794
  errors,
768
- importedNodeIds,
769
- lock
795
+ importedNodeIds
770
796
  );
771
797
  }
772
798
  }
@@ -800,7 +826,7 @@ function recordNodeOutcome(node, outcome, result, errors, importedNodeIds) {
800
826
  }
801
827
  }
802
828
  }
803
- async function processNodeSlice(backend, graphId, registry, batch, schemas, options, result, errors, importedNodeIds, lock) {
829
+ async function processNodeSlice(frame, graphId, registry, batch, schemas, options, result, errors, importedNodeIds) {
804
830
  const record = (node, outcome) => {
805
831
  recordNodeOutcome(node, outcome, result, errors, importedNodeIds);
806
832
  };
@@ -859,20 +885,26 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
859
885
  });
860
886
  }
861
887
  const {
862
- backend: validationBackend,
888
+ reads,
889
+ reader: validationBackend,
863
890
  registerPendingNode,
864
891
  registerPendingUniqueEntries,
865
892
  registerAppliedNodeUpdate,
866
893
  seedNodeRow,
867
894
  seedUniqueRow
868
- } = createNodeBatchValidationBackend(graphId, registry, backend);
895
+ } = createNodeBatchValidationSeams(graphId, registry, frame.target);
869
896
  await primeBatchValidationCaches(
870
- { graphId, registry },
897
+ {
898
+ graphId,
899
+ registry,
900
+ batchPointRead: frame.batchPointRead,
901
+ uniqueSidecarBatch: frame.uniqueSidecarBatch
902
+ },
871
903
  candidates.map((candidate) => candidate.draft),
872
- backend,
904
+ frame.target,
873
905
  { seedNodeRow, seedUniqueRow }
874
906
  );
875
- const writeContext = { graphId, registry, lock };
907
+ const overlaidSession = frame.overlaidSession(reads);
876
908
  const accepted = [];
877
909
  for (const candidate of candidates) {
878
910
  const { node, schemaEntry, props } = candidate;
@@ -911,25 +943,13 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
911
943
  record(node, { status: "error", error: updateWindow.error });
912
944
  break;
913
945
  }
914
- const updateError = await updateImportedNode(
915
- writeContext,
916
- // The pending-aware overlay, not the raw backend: the update's
917
- // uniqueness pre-check must see a unique value already reserved by
918
- // an unflushed create EARLIER in this slice, so it degrades to a
919
- // per-row error exactly as the sequential path does — rather than
920
- // claiming the key on the real backend and colliding with that
921
- // create at flush (which would throw and roll back the whole
922
- // import). Writes still delegate to the real backend.
923
- validationBackend,
924
- node,
925
- {
926
- existing,
927
- schema: schemaEntry.registration.type.schema,
928
- validatedProps: props,
929
- uniqueConstraints,
930
- windowFence: updateWindow.value
931
- }
932
- );
946
+ const updateError = await updateImportedNode(overlaidSession, node, {
947
+ existing,
948
+ schema: schemaEntry.registration.type.schema,
949
+ validatedProps: props,
950
+ uniqueConstraints,
951
+ windowFence: updateWindow.value
952
+ });
933
953
  if (updateError === void 0) {
934
954
  registerAppliedNodeUpdate(
935
955
  node.kind,
@@ -948,44 +968,38 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
948
968
  }
949
969
  continue;
950
970
  }
951
- const uniquenessResult = await catchUniquenessError(
952
- () => checkUniquenessConstraints(
971
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
972
+ await checkUniquenessConstraints(
953
973
  { graphId, registry, backend: validationBackend },
954
974
  node.kind,
955
975
  node.id,
956
976
  props,
957
977
  uniqueConstraints
958
- )
959
- );
960
- if (!uniquenessResult.ok) {
961
- record(node, { status: "error", error: uniquenessResult.error });
978
+ );
979
+ await checkDisjointnessConstraint(
980
+ { graphId, registry, backend: validationBackend },
981
+ node.kind,
982
+ node.id
983
+ );
984
+ });
985
+ if (!constraintResult.ok) {
986
+ record(node, { status: "error", error: constraintResult.error });
962
987
  continue;
963
988
  }
964
- registerPendingNode(buildImportInsertParams(graphId, candidate));
989
+ registerPendingNode(buildImportInsertParams(graphId, node, props));
965
990
  registerPendingUniqueEntries(node.kind, node.id, props, uniqueConstraints);
966
991
  accepted.push(candidate);
967
992
  }
968
993
  if (accepted.length > 0) {
969
- const insertParamsList = accepted.map(
970
- (candidate) => buildImportInsertParams(graphId, candidate)
971
- );
972
- if (backend.insertNodesBatch === void 0) {
973
- for (const params of insertParamsList) {
974
- await backend.insertNode(params);
975
- }
976
- } else {
977
- await backend.insertNodesBatch(insertParamsList);
978
- }
979
- await applyNodeInsertSideEffectsBatch(
980
- writeContext,
981
- accepted.map((candidate) => ({
982
- kind: candidate.node.kind,
983
- id: candidate.node.id,
984
- schema: candidate.schemaEntry.registration.type.schema,
985
- props: candidate.props,
986
- uniqueConstraints: candidate.schemaEntry.registration.unique ?? []
987
- })),
988
- backend
994
+ await frame.session.createNodesNoReturn(
995
+ accepted.map(
996
+ (candidate) => importNodeInsertWork(
997
+ graphId,
998
+ candidate.node,
999
+ candidate.schemaEntry.registration,
1000
+ candidate.props
1001
+ )
1002
+ )
989
1003
  );
990
1004
  for (const candidate of accepted) {
991
1005
  record(candidate.node, { status: "created" });
@@ -994,20 +1008,11 @@ async function processNodeSlice(backend, graphId, registry, batch, schemas, opti
994
1008
  for (const node of deferred) {
995
1009
  record(
996
1010
  node,
997
- await processNode(
998
- backend,
999
- graphId,
1000
- registry,
1001
- node,
1002
- schemas,
1003
- options,
1004
- lock
1005
- )
1011
+ await processNode(frame, graphId, registry, node, schemas, options)
1006
1012
  );
1007
1013
  }
1008
1014
  }
1009
- function buildImportInsertParams(graphId, candidate) {
1010
- const { node, props } = candidate;
1015
+ function buildImportInsertParams(graphId, node, props) {
1011
1016
  return {
1012
1017
  graphId,
1013
1018
  kind: node.kind,
@@ -1017,31 +1022,53 @@ function buildImportInsertParams(graphId, candidate) {
1017
1022
  ...node.validTo !== void 0 && { validTo: node.validTo }
1018
1023
  };
1019
1024
  }
1020
- async function catchUniquenessError(fn) {
1025
+ function importNodeInsertWork(graphId, node, registration, props) {
1026
+ return {
1027
+ params: buildImportInsertParams(graphId, node, props),
1028
+ claim: {
1029
+ kind: node.kind,
1030
+ id: node.id,
1031
+ props,
1032
+ constraints: registration.unique ?? []
1033
+ },
1034
+ sideEffects: {
1035
+ kind: node.kind,
1036
+ id: node.id,
1037
+ schema: registration.type.schema,
1038
+ props,
1039
+ uniqueConstraints: registration.unique ?? []
1040
+ }
1041
+ };
1042
+ }
1043
+ async function catchDeclaredConstraintRefusal(fn) {
1021
1044
  try {
1022
1045
  return { ok: true, value: await fn() };
1023
1046
  } catch (error) {
1024
- if (error instanceof UniquenessError) {
1047
+ if (error instanceof UniquenessError || error instanceof DisjointError || error instanceof CardinalityError) {
1025
1048
  return { ok: false, error: error.message };
1026
1049
  }
1027
1050
  throw error;
1028
1051
  }
1029
1052
  }
1030
1053
  var NODE_UPDATE_TARGET_CHANGED_CODE = "INTERCHANGE_NODE_UPDATE_TARGET_CHANGED";
1031
- async function updateImportedNode(writeContext, backend, node, args) {
1054
+ async function updateImportedNode(session, node, args) {
1032
1055
  try {
1033
- const result = await catchUniquenessError(
1034
- () => applyNodeUpdate(
1035
- writeContext,
1036
- {
1037
- existing: args.existing,
1038
- schema: args.schema,
1039
- validatedProps: args.validatedProps,
1040
- uniqueConstraints: args.uniqueConstraints,
1041
- ...args.windowFence,
1042
- ...node.validTo !== void 0 && { validTo: node.validTo }
1043
- },
1044
- backend
1056
+ const result = await catchDeclaredConstraintRefusal(
1057
+ () => (
1058
+ // The fence is an ARGUMENT the method requires, not a spread the call
1059
+ // site may forget: the guard's verdict travels to the statement that
1060
+ // honors it, and an empty fence (`{}`) is the stated decision to assert
1061
+ // nothing rather than an omission.
1062
+ session.reviseNode(
1063
+ {
1064
+ existing: args.existing,
1065
+ schema: args.schema,
1066
+ validatedProps: args.validatedProps,
1067
+ uniqueConstraints: args.uniqueConstraints,
1068
+ ...node.validTo !== void 0 && { validTo: node.validTo }
1069
+ },
1070
+ { validityLowerBound: args.windowFence }
1071
+ )
1045
1072
  )
1046
1073
  );
1047
1074
  return result.ok ? void 0 : result.error;
@@ -1066,20 +1093,29 @@ function edgeIdentityConflict(edge, existing) {
1066
1093
  if (differences.length === 0) return void 0;
1067
1094
  return `${EDGE_IDENTITY_CONFLICT_CODE}: Edge "${edge.id}" already exists with a different immutable identity \u2014 ${differences.join("; ")}. Edge ids are unique per graph, so the incoming edge can neither update nor be created under that id. Give it a distinct id, or import it under the identity the stored row already carries.`;
1068
1095
  }
1069
- async function updateImportedEdge(backend, graphId, edge, props, windowFence) {
1096
+ async function updateImportedEdge(session, edge, props, windowFence) {
1070
1097
  try {
1071
- await backend.updateEdge({
1072
- graphId,
1073
- id: edge.id,
1074
- kind: edge.kind,
1075
- fromKind: edge.from.kind,
1076
- fromId: edge.from.id,
1077
- toKind: edge.to.kind,
1078
- toId: edge.to.id,
1079
- props,
1080
- ...windowFence,
1081
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1082
- });
1098
+ await session.reviseEdge(
1099
+ {
1100
+ id: edge.id,
1101
+ props,
1102
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1103
+ },
1104
+ {
1105
+ validityLowerBound: windowFence,
1106
+ // Import re-admits no row to a counted population — it never resurrects
1107
+ // and never clears an end — so it reads no stored `valid_to` and asserts
1108
+ // none. `{}` is the stated decision, not an omission.
1109
+ validityUpperBound: {},
1110
+ edgeIdentity: {
1111
+ kind: edge.kind,
1112
+ fromKind: edge.from.kind,
1113
+ fromId: edge.from.id,
1114
+ toKind: edge.to.kind,
1115
+ toId: edge.to.id
1116
+ }
1117
+ }
1118
+ );
1083
1119
  return void 0;
1084
1120
  } catch (error) {
1085
1121
  if (!(error instanceof DatabaseOperationError) || error.details.reason !== "no_row_returned") {
@@ -1141,7 +1177,7 @@ function validateUpdateValidityWindow(entity, storedValidFrom) {
1141
1177
  );
1142
1178
  return verdict.ok ? { ok: true, value: verdict.value.storedLowerBoundFence } : verdict;
1143
1179
  }
1144
- async function processNode(backend, graphId, registry, node, schemas, options, lock) {
1180
+ async function processNode(frame, graphId, registry, node, schemas, options) {
1145
1181
  const schemaEntry = schemas.get(node.kind);
1146
1182
  if (!schemaEntry) {
1147
1183
  return { status: "error", error: `Unknown node kind: ${node.kind}` };
@@ -1160,8 +1196,7 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1160
1196
  }
1161
1197
  const { registration } = schemaEntry;
1162
1198
  const uniqueConstraints = registration.unique ?? [];
1163
- const writeContext = { graphId, registry, lock };
1164
- const existing = await backend.getNode(graphId, node.kind, node.id);
1199
+ const existing = await frame.target.getNode(graphId, node.kind, node.id);
1165
1200
  if (existing) {
1166
1201
  switch (options.onConflict) {
1167
1202
  case "skip": {
@@ -1184,18 +1219,13 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1184
1219
  if (!updateWindow.ok) {
1185
1220
  return { status: "error", error: updateWindow.error };
1186
1221
  }
1187
- const updateError = await updateImportedNode(
1188
- writeContext,
1189
- backend,
1190
- node,
1191
- {
1192
- existing,
1193
- schema: registration.type.schema,
1194
- validatedProps: propsResult.data,
1195
- uniqueConstraints,
1196
- windowFence: updateWindow.value
1197
- }
1198
- );
1222
+ const updateError = await updateImportedNode(frame.session, node, {
1223
+ existing,
1224
+ schema: registration.type.schema,
1225
+ validatedProps: propsResult.data,
1226
+ uniqueConstraints,
1227
+ windowFence: updateWindow.value
1228
+ });
1199
1229
  if (updateError !== void 0) {
1200
1230
  return { status: "error", error: updateError };
1201
1231
  }
@@ -1203,45 +1233,34 @@ async function processNode(backend, graphId, registry, node, schemas, options, l
1203
1233
  }
1204
1234
  }
1205
1235
  }
1206
- const uniquenessResult = await catchUniquenessError(
1207
- () => checkUniquenessConstraints(
1208
- { graphId, registry, backend },
1236
+ const constraintResult = await catchDeclaredConstraintRefusal(async () => {
1237
+ await checkUniquenessConstraints(
1238
+ { graphId, registry, backend: frame.target },
1209
1239
  node.kind,
1210
1240
  node.id,
1211
1241
  propsResult.data,
1212
1242
  uniqueConstraints
1213
- )
1214
- );
1215
- if (!uniquenessResult.ok) {
1216
- return { status: "error", error: uniquenessResult.error };
1217
- }
1218
- await backend.insertNode({
1219
- graphId,
1220
- kind: node.kind,
1221
- id: node.id,
1222
- props: propsResult.data,
1223
- ...node.validFrom !== void 0 && { validFrom: node.validFrom },
1224
- ...node.validTo !== void 0 && { validTo: node.validTo }
1243
+ );
1244
+ await checkDisjointnessConstraint(
1245
+ { graphId, registry, backend: frame.target },
1246
+ node.kind,
1247
+ node.id
1248
+ );
1225
1249
  });
1226
- await applyNodeInsertSideEffects(
1227
- writeContext,
1228
- {
1229
- kind: node.kind,
1230
- id: node.id,
1231
- schema: registration.type.schema,
1232
- props: propsResult.data,
1233
- uniqueConstraints
1234
- },
1235
- backend
1250
+ if (!constraintResult.ok) {
1251
+ return { status: "error", error: constraintResult.error };
1252
+ }
1253
+ await frame.session.createNode(
1254
+ importNodeInsertWork(graphId, node, registration, propsResult.data)
1236
1255
  );
1237
1256
  return { status: "created" };
1238
1257
  }
1239
- async function processEdges(backend, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1258
+ async function processEdges(frame, graphId, registry, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1240
1259
  const batchSize = options.batchSize;
1241
1260
  for (let index = 0; index < edges.length; index += batchSize) {
1242
1261
  const batch = edges.slice(index, index + batchSize);
1243
1262
  await processEdgeSlice(
1244
- backend,
1263
+ frame,
1245
1264
  graphId,
1246
1265
  registry,
1247
1266
  batch,
@@ -1279,10 +1298,29 @@ function recordEdgeOutcome(edge, outcome, result, errors) {
1279
1298
  }
1280
1299
  }
1281
1300
  }
1282
- async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1301
+ function edgeInsertParamsOf(graphId, candidate) {
1302
+ const { edge, props } = candidate;
1303
+ return {
1304
+ graphId,
1305
+ id: edge.id,
1306
+ kind: edge.kind,
1307
+ fromKind: edge.from.kind,
1308
+ fromId: edge.from.id,
1309
+ toKind: edge.to.kind,
1310
+ toId: edge.to.id,
1311
+ props,
1312
+ ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1313
+ ...edge.validTo !== void 0 && { validTo: edge.validTo }
1314
+ };
1315
+ }
1316
+ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
1283
1317
  const record = (edge, outcome) => {
1284
1318
  recordEdgeOutcome(edge, outcome, result, errors);
1285
1319
  };
1320
+ const {
1321
+ backend: cardinalityValidationBackend,
1322
+ registerPendingEdgeForCardinality
1323
+ } = createEdgeBatchValidationBackend(frame.target);
1286
1324
  const candidates = [];
1287
1325
  const deferred = [];
1288
1326
  const seenIds = /* @__PURE__ */ new Set();
@@ -1343,7 +1381,12 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1343
1381
  }
1344
1382
  const liveEndpointKeys = /* @__PURE__ */ new Set();
1345
1383
  const checkedEndpointKeys = /* @__PURE__ */ new Set();
1346
- if (options.validateReferences && backend.getNodes !== void 0) {
1384
+ const boundGetNodesForEndpoints = bindExtraIfReachable(
1385
+ frame.target,
1386
+ frame.batchPointRead.extras.getNodes,
1387
+ BATCH_POINT_READ.id
1388
+ );
1389
+ if (options.validateReferences && boundGetNodesForEndpoints !== void 0) {
1347
1390
  const idsByKind = /* @__PURE__ */ new Map();
1348
1391
  for (const { edge } of candidates) {
1349
1392
  for (const endpoint of [edge.from, edge.to]) {
@@ -1356,7 +1399,9 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1356
1399
  }
1357
1400
  }
1358
1401
  for (const [kind, ids] of idsByKind) {
1359
- const rows = await backend.getNodes(graphId, kind, [...ids]);
1402
+ const rows = await boundGetNodesForEndpoints.getNodes(graphId, kind, [
1403
+ ...ids
1404
+ ]);
1360
1405
  for (const row of rows) {
1361
1406
  if (isLiveNodeRow(row)) {
1362
1407
  liveEndpointKeys.add(makeNodeKey(kind, row.id));
@@ -1368,12 +1413,17 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1368
1413
  const key = makeNodeKey(endpoint.kind, endpoint.id);
1369
1414
  if (importedNodeIds.has(key)) return true;
1370
1415
  if (checkedEndpointKeys.has(key)) return liveEndpointKeys.has(key);
1371
- const row = await backend.getNode(graphId, endpoint.kind, endpoint.id);
1416
+ const row = await frame.target.getNode(graphId, endpoint.kind, endpoint.id);
1372
1417
  return row !== void 0 && isLiveNodeRow(row);
1373
1418
  };
1374
1419
  const existingById = /* @__PURE__ */ new Map();
1375
- if (candidates.length > 0 && backend.getEdges !== void 0) {
1376
- const rows = await backend.getEdges(
1420
+ const boundGetEdges = bindExtraIfReachable(
1421
+ frame.target,
1422
+ frame.batchPointRead.extras.getEdges,
1423
+ BATCH_POINT_READ.id
1424
+ );
1425
+ if (candidates.length > 0 && boundGetEdges !== void 0) {
1426
+ const rows = await boundGetEdges.getEdges(
1377
1427
  graphId,
1378
1428
  candidates.map((candidate) => candidate.edge.id)
1379
1429
  );
@@ -1403,7 +1453,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1403
1453
  continue;
1404
1454
  }
1405
1455
  }
1406
- const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await backend.getEdge(graphId, edge.id);
1456
+ const existing = existingById.has(edge.id) ? existingById.get(edge.id) : await frame.target.getEdge(graphId, edge.id);
1407
1457
  if (existing) {
1408
1458
  const identityConflict = edgeIdentityConflict(edge, existing);
1409
1459
  if (identityConflict !== void 0) {
@@ -1439,8 +1489,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1439
1489
  break;
1440
1490
  }
1441
1491
  const updateError = await updateImportedEdge(
1442
- backend,
1443
- graphId,
1492
+ frame.session,
1444
1493
  edge,
1445
1494
  props,
1446
1495
  updateWindow.value
@@ -1455,28 +1504,37 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1455
1504
  }
1456
1505
  continue;
1457
1506
  }
1507
+ const insertParams = edgeInsertParamsOf(graphId, candidate);
1508
+ const cardinality = edgeSchemas.get(edge.kind)?.registration.cardinality ?? "many";
1509
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1510
+ () => checkCardinalityConstraint(
1511
+ { graphId, registry, backend: cardinalityValidationBackend },
1512
+ edge.kind,
1513
+ cardinality,
1514
+ edge.from.kind,
1515
+ edge.from.id,
1516
+ edge.to.kind,
1517
+ edge.to.id,
1518
+ edge.validTo
1519
+ )
1520
+ );
1521
+ if (!cardinalityResult.ok) {
1522
+ record(edge, { status: "error", error: cardinalityResult.error });
1523
+ continue;
1524
+ }
1525
+ registerPendingEdgeForCardinality(insertParams, cardinality);
1458
1526
  accepted.push(candidate);
1459
1527
  }
1460
1528
  if (accepted.length > 0) {
1461
- const insertParamsList = accepted.map(({ edge, props }) => ({
1462
- graphId,
1463
- id: edge.id,
1464
- kind: edge.kind,
1465
- fromKind: edge.from.kind,
1466
- fromId: edge.from.id,
1467
- toKind: edge.to.kind,
1468
- toId: edge.to.id,
1469
- props,
1470
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1471
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1472
- }));
1473
- if (backend.insertEdgesBatch === void 0) {
1474
- for (const params of insertParamsList) {
1475
- await backend.insertEdge(params);
1476
- }
1477
- } else {
1478
- await backend.insertEdgesBatch(insertParamsList);
1479
- }
1529
+ await frame.session.createEdgesNoReturn(
1530
+ accepted.map(
1531
+ (candidate) => importEdgeInsertWork(
1532
+ graphId,
1533
+ candidate,
1534
+ edgeSchemas.get(candidate.edge.kind)?.registration.cardinality ?? "many"
1535
+ )
1536
+ )
1537
+ );
1480
1538
  for (const candidate of accepted) {
1481
1539
  record(candidate.edge, { status: "created" });
1482
1540
  }
@@ -1485,7 +1543,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1485
1543
  record(
1486
1544
  edge,
1487
1545
  await processEdge(
1488
- backend,
1546
+ frame,
1489
1547
  graphId,
1490
1548
  registry,
1491
1549
  edge,
@@ -1497,7 +1555,7 @@ async function processEdgeSlice(backend, graphId, registry, batch, edgeSchemas,
1497
1555
  );
1498
1556
  }
1499
1557
  }
1500
- async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1558
+ async function processEdge(frame, graphId, registry, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
1501
1559
  const schemaEntry = edgeSchemas.get(edge.kind);
1502
1560
  if (!schemaEntry) {
1503
1561
  return { status: "error", error: `Unknown edge kind: ${edge.kind}` };
@@ -1525,7 +1583,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1525
1583
  const fromKey = makeNodeKey(edge.from.kind, edge.from.id);
1526
1584
  const toKey = makeNodeKey(edge.to.kind, edge.to.id);
1527
1585
  if (!importedNodeIds.has(fromKey)) {
1528
- const fromExists = await backend.getNode(
1586
+ const fromExists = await frame.target.getNode(
1529
1587
  graphId,
1530
1588
  edge.from.kind,
1531
1589
  edge.from.id
@@ -1538,7 +1596,11 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1538
1596
  }
1539
1597
  }
1540
1598
  if (!importedNodeIds.has(toKey)) {
1541
- const toExists = await backend.getNode(graphId, edge.to.kind, edge.to.id);
1599
+ const toExists = await frame.target.getNode(
1600
+ graphId,
1601
+ edge.to.kind,
1602
+ edge.to.id
1603
+ );
1542
1604
  if (toExists === void 0 || !isLiveNodeRow(toExists)) {
1543
1605
  return {
1544
1606
  status: "error",
@@ -1559,7 +1621,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1559
1621
  if (validityError !== void 0) {
1560
1622
  return { status: "error", error: validityError };
1561
1623
  }
1562
- const existing = await backend.getEdge(graphId, edge.id);
1624
+ const existing = await frame.target.getEdge(graphId, edge.id);
1563
1625
  if (existing) {
1564
1626
  const identityConflict = edgeIdentityConflict(edge, existing);
1565
1627
  if (identityConflict !== void 0) {
@@ -1587,8 +1649,7 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1587
1649
  return { status: "error", error: updateWindow.error };
1588
1650
  }
1589
1651
  const updateError = await updateImportedEdge(
1590
- backend,
1591
- graphId,
1652
+ frame.session,
1592
1653
  edge,
1593
1654
  propsResult.data,
1594
1655
  updateWindow.value
@@ -1600,20 +1661,36 @@ async function processEdge(backend, graphId, registry, edge, edgeSchemas, nodeSc
1600
1661
  }
1601
1662
  }
1602
1663
  }
1603
- await backend.insertEdge({
1604
- graphId,
1605
- id: edge.id,
1606
- kind: edge.kind,
1607
- fromKind: edge.from.kind,
1608
- fromId: edge.from.id,
1609
- toKind: edge.to.kind,
1610
- toId: edge.to.id,
1611
- props: propsResult.data,
1612
- ...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
1613
- ...edge.validTo !== void 0 && { validTo: edge.validTo }
1614
- });
1664
+ const cardinality = schemaEntry.registration.cardinality ?? "many";
1665
+ const cardinalityResult = await catchDeclaredConstraintRefusal(
1666
+ () => checkCardinalityConstraint(
1667
+ { graphId, registry, backend: frame.target },
1668
+ edge.kind,
1669
+ cardinality,
1670
+ edge.from.kind,
1671
+ edge.from.id,
1672
+ edge.to.kind,
1673
+ edge.to.id,
1674
+ edge.validTo
1675
+ )
1676
+ );
1677
+ if (!cardinalityResult.ok) {
1678
+ return { status: "error", error: cardinalityResult.error };
1679
+ }
1680
+ await frame.session.createEdge(
1681
+ importEdgeInsertWork(
1682
+ graphId,
1683
+ { edge, props: propsResult.data },
1684
+ cardinality
1685
+ )
1686
+ );
1615
1687
  return { status: "created" };
1616
1688
  }
1689
+ function importEdgeInsertWork(graphId, candidate, cardinality) {
1690
+ const params = edgeInsertParamsOf(graphId, candidate);
1691
+ const claim = edgeCardinalityClaim(cardinality, params);
1692
+ return { params, ...claim === void 0 ? {} : { claim } };
1693
+ }
1617
1694
  function validateProperties(properties, schema, unknownStrategy) {
1618
1695
  try {
1619
1696
  const knownKeys = new Set(Object.keys(schema.shape));
@@ -2149,5 +2226,5 @@ async function* exportEdgeChunks(backend, graphId, kind, options) {
2149
2226
  }
2150
2227
 
2151
2228
  export { ConflictStrategySchema, ExportOptionsSchema, ExportStreamOptionsSchema, FORMAT_VERSION, GraphDataHeaderSchema, GraphDataSchema, GraphDataSourceSchema, GraphInterchangeChunkSchema, IdentityInterchangeModeSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, exportStreamBackend, importGraph, importGraphStream, registerIngestionImportTarget, serializedStreamRefusal, withImportStreamLease };
2152
- //# sourceMappingURL=chunk-LTXQOEIC.js.map
2153
- //# sourceMappingURL=chunk-LTXQOEIC.js.map
2229
+ //# sourceMappingURL=chunk-RI7RJH4G.js.map
2230
+ //# sourceMappingURL=chunk-RI7RJH4G.js.map