@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,31 +1,33 @@
1
- import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG, normalizeRowTimestamp, normalizeRequiredRowTimestamp } from './chunk-YIURNGXI.js';
2
- import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDeleteBatch, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdateWhere, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, assertValidityEndMutation, assertClearValidToSupported, edgeWriteNeedsConstraintFence, withAlreadyExistsTranslation, rowToNodeMeta, rowToEdgeMeta, validityEndAfterMutation, checkCardinalityConstraint } from './chunk-KF6K7TGH.js';
3
- import { storeRuntime, STORE_RUNTIME, applyResolvedNodeUniqueness, createUniquenessContext, TRANSACTION_RUNTIME, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, getEmbeddingFields, computeFulltextContent } from './chunk-I4GAZH5Z.js';
4
- import { loadAndMergeGraphExtensionDocument, serializeSchema, buildKindRegistry, ensureIdentitySchemaStorage, loadAndVerifyGraph, identitySchemaCommitPreflight, getSchemaChanges, requiresMigration, mergeGraphExtension, commitNewSchemaVersion, commitNewSchemaVersionWithPreflight, planRemovals, stripGraphExtension, applyDeprecatedKinds, identityKindCascadeNeeded, ensureSchema, loadActiveSchemaWithBootstrap, parseSerializedSchema, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, commitNewSchemaVersionIfKindsEmpty, serializeIndexDeclaration } from './chunk-2TYSSBU5.js';
5
- import { getTypeName } from './chunk-SHFBB23Q.js';
6
- import { rebuildIdentityClosureForContext, loadCurrentStructuralClasses, loadAssertionsByIds, toTransferAssertion, liveNodeKindsSharingIds, createIdentityFacade, createIdentityReadFacade, runInWriteTransaction, validateIdentityForContext, removeIdentityKindsForContext, readIdentityAssertionsForInterchange, readIdentityAssertionPageAtTarget, lockIdentityGraph, foldIdentityForCreatedNodes, importIdentityAssertionsIntoTarget, assertAffectedIdentityClassesConsistent, applyIdentityChangesForContext, withWriteTransactionSession, lockSchemaVersionForStoreWrite, refKey, requireNodeValidityEndCompatible, detachIdentityForNode, validateEdgeProps, runHookedWriteOperation } from './chunk-ZFMCDJGB.js';
7
- import { isParameterRef, resolveParameterValueType, fieldRef, compareStrings, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, CURRENT_READ_INSTANT_PLACEHOLDER, withPinnedReadInstant, compareCodePoints, assertRevisionTrackableBackend, createRecordedBackend, createRecordedTransactionScope, readRecordedClock, ensureRevisionOrigin, withRecordedFlushObserver, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, lockRecordedGraphWrite, generateId, assertCurrentRecordedSchema, baseField, objectField, arrayField, dateField, numberField, advanceRevisionClock, runInsertBatch, edgeInsertDispatch, runInsertBatchReturning, sqlValueList, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, encodeTupleKey, runInsertNoReturn, currentReadInstant, compileTemporalFilter, closeRecordedHardDeletedKind, buildPredicateIndex, historicalIdentityPeerClassQuery, IDENTITY_PEER_CLASS_COLUMNS, compileFieldValue, recordedBindParamBudget, extractVectorSimilarityPredicates, extractFulltextMatchPredicates, currentReadInstantFor, extractTemporalOptions, compilePredicateExpression, getPredicatesForAlias, getFieldPointer, getNodeKindsForAlias, getHybridTargetAlias, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, compilePredicateClauses } from './chunk-S5TERQVW.js';
8
- import { canonicalEqual, sortedReplacer } from './chunk-JBQQ7THH.js';
9
- import { withRecordedRelationsPrecondition, projectGraphBackend, deriveBackend, projectBackend, chunk, postgresReadWriteRefusedSqlState, isMissingTableError, groupBy, postgresTemporaryTableUnavailableSqlState, isPostgresConcurrentDdlRaceError } from './chunk-UGHG7PGX.js';
10
- import { createSqlSchema, requireSqlSchema, DEFAULT_SQL_SCHEMA, recordedReadSchemaFor, requireExternalRecordedReadSource, createRecordedReadBinding, vectorSlotKey, recordedReadSqlSchema, requireRecordedReadBinding, ALIAS_CTE_PREFIX, EMBEDDINGS_CTE_ALIAS, FULLTEXT_CTE_ALIAS, HYBRID_CANDIDATES_CTE_ALIAS } from './chunk-NVY5CJFP.js';
11
- import { runOptionallyInTransaction, createTransactionReadBackend, rowPropsToObject, INTERNAL_TEMPORARY_WRITES } from './chunk-6LN7FIVU.js';
12
- import { isKnownKind } from './chunk-HEV35TGT.js';
13
- import { validateEdgeEndpoints } from './chunk-GLHXM7C4.js';
14
- import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, recordedInstantWallTime, asRecordedInstant, assertValidRecordedInstant, optionalRecordedInstantParts } from './chunk-DZAICA5J.js';
15
- import { nowIso, validityWindowContainsInstant, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, preservesImmutableLowerBound, assertWritableValidityWindow, isCanonicalIsoDate, statedBoundMatchesStored } from './chunk-5K2BKEBD.js';
16
- import { generateIndexDDL } from './chunk-KKBDXCLQ.js';
17
- import { SYSTEM_INDEX_DECLARATIONS, resolveSystemIndexTableName, systemIndexName, resolveSystemIndexNames, generateSystemIndexDDL } from './chunk-SDBBMD4N.js';
18
- import { NODE_META_KEYS, EDGE_META_KEYS } from './chunk-P6YLZTRE.js';
1
+ import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG, normalizeRowTimestamp, normalizeRequiredRowTimestamp, buildHardDeleteEdgeClaimsByNodeKind, buildHardDeleteUniquesByConcreteKind, buildHardDeleteEdgeClaimsByEdgeKind } from './chunk-VUQZNUHU.js';
2
+ import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDeleteBatch, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdateWhere, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, assertValidityEndMutation, assertClearValidToSupported, runHookedWritePlan, edgeWritePlan, runWritePlan, edgeWriteNeedsConstraintFence, withAlreadyExistsTranslation, createEdgeBatchValidationBackend, rowToNodeMeta, rowToEdgeMeta, unfencedTarget, validityEndAfterMutation, checkCardinalityConstraint, assertsStoredWindowState } from './chunk-TYEYRCXL.js';
3
+ import { storeRuntime, STORE_RUNTIME, applyResolvedNodeClaims, TRANSACTION_RUNTIME, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, getEmbeddingFields, computeFulltextContent } from './chunk-4DKY6RIU.js';
4
+ import { edgeCardinalityClaimTarget, edgeCardinalityClaim } from './chunk-NGQDGL5X.js';
5
+ import { loadAndMergeGraphExtensionDocument, serializeSchema, buildKindRegistry, ensureIdentitySchemaStorage, loadAndVerifyGraph, identitySchemaCommitPreflight, getSchemaChanges, requiresMigration, mergeGraphExtension, commitNewSchemaVersion, commitNewSchemaVersionWithPreflight, parseSerializedSchema, planRemovals, stripGraphExtension, applyDeprecatedKinds, identityKindCascadeNeeded, ensureSchema, loadActiveSchemaWithBootstrap, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, commitNewSchemaVersionIfKindsEmpty, serializeIndexDeclaration } from './chunk-YT2IVFAI.js';
6
+ import { getTypeName } from './chunk-LI4K2KEJ.js';
7
+ import { rebuildIdentityClosureForContext, loadCurrentStructuralClasses, loadAssertionsByIds, toTransferAssertion, liveNodeKindsSharingIds, createIdentityFacade, createIdentityReadFacade, validateIdentityForContext, removeIdentityKindsForContext, readIdentityAssertionsForInterchange, readIdentityAssertionPageAtTarget, lockIdentityGraph, foldIdentityForCreatedNodes, importIdentityAssertionsIntoTarget, assertAffectedIdentityClassesConsistent, applyIdentityChangesForContext, refKey, requireNodeValidityEndCompatible, detachIdentityForNode } from './chunk-WFSYYU4W.js';
8
+ import { isParameterRef, resolveParameterValueType, fieldRef, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, CURRENT_READ_INSTANT_PLACEHOLDER, withPinnedReadInstant, assertRevisionTrackableBackend, createRecordedBackend, lockRecordedGraphWrite, runInWriteTransaction, createRecordedTransactionScope, readRecordedClock, ensureRevisionOrigin, withRecordedFlushObserver, withWriteTransactionSession, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, lockSchemaVersionForStoreWrite, generateId, assertCurrentRecordedSchema, assertRecursiveTraversalSupported, baseField, objectField, arrayField, dateField, numberField, advanceRevisionClock, validateEdgeProps, sqlValueList, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, currentReadInstant, compileTemporalFilter, closeRecordedHardDeletedKind, buildPredicateIndex, requireRecursiveTraversalVerdict, historicalIdentityPeerClassQuery, IDENTITY_PEER_CLASS_COLUMNS, compileFieldValue, recordedBindParamBudget, extractVectorSimilarityPredicates, extractFulltextMatchPredicates, currentReadInstantFor, extractTemporalOptions, compilePredicateExpression, getPredicatesForAlias, getFieldPointer, getNodeKindsForAlias, getHybridTargetAlias, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, compilePredicateClauses } from './chunk-VAAC7L57.js';
9
+ import { withRecordedRelationsPrecondition, projectGraphBackend, deriveBackend, canonicalEqual, sortedReplacer, projectBackend, chunk, postgresReadWriteRefusedSqlState, isMissingTableError, groupBy, postgresTemporaryTableUnavailableSqlState, isPostgresConcurrentDdlRaceError } from './chunk-QG5VEOKX.js';
10
+ import { assumeRecursiveTraversalSupported, batchPointReadVerdict, resolveRecursiveTraversal, statementExecutionVerdict, createClaimsVerdictThunk, uniqueSidecarBatchVerdict, contributionHealthVerdict, recordedRevisionOriginsVerdict, requireExtras, assertRecursiveTraversal } from './chunk-XORONCV3.js';
11
+ import { createSqlSchema, requireSqlSchema, DEFAULT_SQL_SCHEMA, recordedReadSchemaFor, resolveWriteFencePlan, refuseUnfencedOperationalIdentity, refuseUnfencedClockAllocation, requireExternalRecordedReadSource, createRecordedReadBinding, runOptionallyInTransaction, createTransactionReadBackend, bindExtraIfReachable, BATCH_POINT_READ, CONTRIBUTION_HEALTH, bindExtra, vectorSlotKey, recordedReadSqlSchema, requireRecordedReadBinding, rowPropsToObject, INTERNAL_TEMPORARY_WRITES, ALIAS_CTE_PREFIX, EMBEDDINGS_CTE_ALIAS, FULLTEXT_CTE_ALIAS, HYBRID_CANDIDATES_CTE_ALIAS } from './chunk-LKZDQ2B4.js';
12
+ import { isKnownKind } from './chunk-M3VTS3F6.js';
13
+ import { compareClaimTargets, encodeTupleKey, uniquenessClaimTarget, subClassComponent, isSameClaimOwner, DISJOINT_CONSTRAINT_NAME, disjointnessClaimAxis, validateEdgeEndpoints } from './chunk-RVUL2HXY.js';
14
+ import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, recordedInstantWallTime, asRecordedInstant, assertValidRecordedInstant, optionalRecordedInstantParts } from './chunk-6NKSE5AU.js';
15
+ import { nowIso, validityWindowContainsInstant, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, preservesImmutableLowerBound, assertWritableValidityWindow, isCanonicalIsoDate, statedBoundMatchesStored } from './chunk-K46SDNQD.js';
16
+ import { generateIndexDDL } from './chunk-6NLYIMJO.js';
17
+ import { SYSTEM_INDEX_DECLARATIONS, resolveSystemIndexTableName, systemIndexName, resolveSystemIndexNames, generateSystemIndexDDL } from './chunk-36VYWVQU.js';
18
+ import { NODE_META_KEYS, EDGE_META_KEYS } from './chunk-LZMQ3SFK.js';
19
19
  import { sha256Hex, fnv1aBase36 } from './chunk-K34OPSJK.js';
20
+ import { getDialect } from './chunk-7G5IYROL.js';
20
21
  import { DEFAULT_PAGINATION_LIMIT, DEFAULT_STREAM_BATCH_SIZE, SQLITE_PATH_DELIMITER, PG_ARRAY_START, PG_ARRAY_END, PG_PATH_ELEMENT_SEPARATOR, MAX_PG_IDENTIFIER_LENGTH } from './chunk-2EBMPJBO.js';
21
- import { getDialect, assertVectorMinScore, assertApproximateMetricSupported, vectorScoreExpression, vectorMinScoreCondition } from './chunk-ZDKTPBGV.js';
22
- import { isSqlPlaceholder, bindSqlValue, markAnnIndexScan, asCompiledSelectSql, isRawExecutable, renderSql, annIndexScanTypes, sql, asCompiledRowsSql, markForceCustomPlan, asCompiledStatementSql, asCompiledTemporaryStatementSql } from './chunk-3DMMGT6S.js';
22
+ import { assertVectorMinScore, assertApproximateMetricSupported, vectorScoreExpression, vectorMinScoreCondition } from './chunk-PC5NGH5A.js';
23
+ import { isSqlPlaceholder, bindSqlValue, markAnnIndexScan, asCompiledSelectSql, isRawExecutable, renderSql, annIndexScanTypes, sql, asCompiledRowsSql, markForceCustomPlan, asCompiledStatementSql, asCompiledTemporaryStatementSql } from './chunk-7QFRK6PU.js';
23
24
  import { createSchemaIntrospector } from './chunk-AMKPPFUO.js';
24
25
  import { resolveEmbeddingFields, resolveGraphVectorSlots, resolveDeclaredFulltextLanguage, getSearchableFields } from './chunk-PC2UBAUB.js';
25
- import { IncompatibleChangeError } from './chunk-D5R42W5D.js';
26
+ import { IncompatibleChangeError } from './chunk-XZW2CTNO.js';
26
27
  import { META_EDGE_DISJOINT_WITH, META_EDGE_EQUIVALENT_TO, META_EDGE_SAME_AS, META_EDGE_SUB_CLASS_OF } from './chunk-JXXDZTMN.js';
27
- import { validateProjectionField } from './chunk-XVWOYKIK.js';
28
- import { ConfigurationError, UnsupportedPredicateError, ValidationError, KindNotFoundError, EndpointError, EagerMaterializationError, ContributionRebuildUnsupportedError, CompilerInvariantError, CardinalityError, DatabaseOperationError, EdgeNotFoundError, MigrationError, EDGE_IDENTITY_MISMATCH_CODE, UnsupportedBackendCapabilityError, EndpointNotFoundError, GraphAlgorithmConvergenceError, InvalidEdgeWeightError } from './chunk-ZLONH2UD.js';
28
+ import { validateProjectionField } from './chunk-FZHF5UWR.js';
29
+ import { compareStrings, compareCodePoints } from './chunk-HZUB5CON.js';
30
+ import { ConfigurationError, UnsupportedPredicateError, ValidationError, KindNotFoundError, EndpointError, EagerMaterializationError, ContributionRebuildUnsupportedError, CompilerInvariantError, CardinalityError, DatabaseOperationError, EdgeNotFoundError, MigrationError, EDGE_IDENTITY_MISMATCH_CODE, UnsupportedBackendCapabilityError, EndpointNotFoundError, GraphAlgorithmConvergenceError, InvalidEdgeWeightError } from './chunk-YDEJQWOL.js';
29
31
  import { jsonPointer, parseJsonPointer, resolveJsonPointer } from './chunk-FWJKWH6U.js';
30
32
  import { readOwnProperty, requireDefined, createDataKeyedBag, isInteropProbeKey, hasOwnKey, isPresent } from './chunk-DYATYRY4.js';
31
33
 
@@ -1104,11 +1106,16 @@ function compileIdentityClassCte(input) {
1104
1106
  if (!expandsIdentity) return void 0;
1105
1107
  const coordinate = historicalCoordinate({ ast, temporalFilterPass });
1106
1108
  if (coordinate === void 0) return void 0;
1109
+ const recursiveTraversal = requireRecursiveTraversalVerdict(
1110
+ ctx,
1111
+ "historical identity expansion"
1112
+ );
1107
1113
  const peerClasses = historicalIdentityPeerClassQuery({
1108
1114
  schema: ctx.schema,
1109
1115
  graphId,
1110
1116
  coordinate,
1111
- sameIdAcrossKinds: ctx.identitySameIdAcrossKinds ?? "fold"
1117
+ sameIdAcrossKinds: ctx.identitySameIdAcrossKinds ?? "fold",
1118
+ recursiveTraversal
1112
1119
  });
1113
1120
  return sql`
1114
1121
  ${sql.identifier(IDENTITY_CLASS_CTE_ALIAS)}(${IDENTITY_PEER_CLASS_COLUMNS}) AS MATERIALIZED (
@@ -2907,6 +2914,7 @@ function runRecursiveQueryPassPipeline(ast, graphId, ctx) {
2907
2914
  return state;
2908
2915
  }
2909
2916
  function compileVariableLengthQuery(ast, graphId, ctx) {
2917
+ assertRecursiveTraversalSupported(ctx, "variable-length traversal");
2910
2918
  const strategy = ctx.dialect.capabilities.recursiveQueryStrategy;
2911
2919
  const handler = RECURSIVE_QUERY_STRATEGY_HANDLERS[strategy];
2912
2920
  return handler(ast, graphId, ctx);
@@ -3412,6 +3420,7 @@ function decodeByValueType(value, valueType) {
3412
3420
 
3413
3421
  // src/store/recursive-cte.ts
3414
3422
  function buildReachableCte(options) {
3423
+ assertRecursiveTraversal(options.recursiveTraversal, options.operation);
3415
3424
  const trackPath = options.cyclePolicy === "prevent" || options.includePath;
3416
3425
  const edgeKindFilter = compileKindFilter(
3417
3426
  sql.raw("e.kind"),
@@ -3608,7 +3617,9 @@ async function executeSubgraph(params) {
3608
3617
  dialect: ctx.dialect,
3609
3618
  // Base schema: buildReachableCte derives the recorded swap from recordedAsOf.
3610
3619
  schema: baseSchema,
3611
- ...ctx.recordedReadBinding === void 0 ? {} : { recordedReadBinding: ctx.recordedReadBinding }
3620
+ ...ctx.recordedReadBinding === void 0 ? {} : { recordedReadBinding: ctx.recordedReadBinding },
3621
+ recursiveTraversal: resolveRecursiveTraversal(params.backend.capabilities),
3622
+ operation: "subgraph"
3612
3623
  });
3613
3624
  const includedIdsCte = buildIncludedIdsCte(ctx);
3614
3625
  let membership;
@@ -4495,6 +4506,7 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
4495
4506
  }
4496
4507
 
4497
4508
  // src/query/compiler/index.ts
4509
+ var COMPILER_DEFAULT_RECURSIVE_TRAVERSAL = assumeRecursiveTraversalSupported("compileQuery called without a backend");
4498
4510
  function compileQuery(ast, graphId, options = "sqlite") {
4499
4511
  const options_ = typeof options === "string" ? { dialect: options } : options;
4500
4512
  const dialect = options_.dialect ?? "sqlite";
@@ -4520,6 +4532,7 @@ function compileQuery(ast, graphId, options = "sqlite") {
4520
4532
  ),
4521
4533
  ...options_.vectorStrategy === void 0 ? {} : { vectorStrategy: options_.vectorStrategy },
4522
4534
  windowFunctions: options_.windowFunctions ?? true,
4535
+ recursiveTraversal: options_.recursiveTraversal ?? COMPILER_DEFAULT_RECURSIVE_TRAVERSAL,
4523
4536
  ...options_.vectorSlots === void 0 ? {} : { vectorSlots: options_.vectorSlots },
4524
4537
  ...options_.fulltextLanguages === void 0 ? {} : { fulltextLanguages: options_.fulltextLanguages }
4525
4538
  };
@@ -4619,6 +4632,7 @@ function propagateOptions(options_) {
4619
4632
  ...options_.fulltextStrategy === void 0 ? {} : { fulltextStrategy: options_.fulltextStrategy },
4620
4633
  ...options_.vectorStrategy === void 0 ? {} : { vectorStrategy: options_.vectorStrategy },
4621
4634
  windowFunctions: options_.windowFunctions ?? true,
4635
+ recursiveTraversal: options_.recursiveTraversal ?? COMPILER_DEFAULT_RECURSIVE_TRAVERSAL,
4622
4636
  ...options_.vectorSlots === void 0 ? {} : { vectorSlots: options_.vectorSlots },
4623
4637
  ...options_.fulltextLanguages === void 0 ? {} : { fulltextLanguages: options_.fulltextLanguages },
4624
4638
  ...options_.recordedReadBinding === void 0 ? {} : { recordedReadBinding: options_.recordedReadBinding },
@@ -7023,6 +7037,7 @@ function buildCompileOptions(config) {
7023
7037
  dialect: config.dialect ?? "sqlite",
7024
7038
  schema: config.schema,
7025
7039
  windowFunctions: config.backend?.capabilities.windowFunctions ?? true,
7040
+ recursiveTraversal: config.backend === void 0 ? COMPILER_DEFAULT_RECURSIVE_TRAVERSAL : resolveRecursiveTraversal(config.backend.capabilities),
7026
7041
  identitySameIdAcrossKinds: config.identitySameIdAcrossKinds,
7027
7042
  ...fulltextStrategy === void 0 ? {} : {
7028
7043
  fulltextStrategy,
@@ -10134,7 +10149,7 @@ function searchNodeKey(kind, nodeId) {
10134
10149
  function scoreDescending(metric) {
10135
10150
  return metric === "cosine";
10136
10151
  }
10137
- async function fetchNodesForRows(backend, graphId, rows) {
10152
+ async function fetchNodesForRows(backend, batchPointRead, graphId, rows) {
10138
10153
  const idsByKind = /* @__PURE__ */ new Map();
10139
10154
  for (const row of rows) {
10140
10155
  const ids = idsByKind.get(row.kind) ?? /* @__PURE__ */ new Set();
@@ -10144,7 +10159,13 @@ async function fetchNodesForRows(backend, graphId, rows) {
10144
10159
  const map = /* @__PURE__ */ new Map();
10145
10160
  await Promise.all(
10146
10161
  [...idsByKind].map(async ([kind, ids]) => {
10147
- const kindMap = await fetchNodesByIds(backend, graphId, kind, [...ids]);
10162
+ const kindMap = await fetchNodesByIds(
10163
+ backend,
10164
+ batchPointRead,
10165
+ graphId,
10166
+ kind,
10167
+ [...ids]
10168
+ );
10148
10169
  for (const [id, node] of kindMap) {
10149
10170
  map.set(searchNodeKey(kind, id), node);
10150
10171
  }
@@ -10224,7 +10245,12 @@ async function executeFulltextSearch(ctx, nodeKind, options) {
10224
10245
  (a, b) => b.score - a.score || compareCodePoints(a.kind, b.kind) || compareCodePoints(a.nodeId, b.nodeId)
10225
10246
  ).slice(offset, offset + options.limit);
10226
10247
  if (merged.length === 0) return [];
10227
- const nodeMap = await fetchNodesForRows(backend, graphId, merged);
10248
+ const nodeMap = await fetchNodesForRows(
10249
+ backend,
10250
+ requireDefined(ctx.batchPointRead),
10251
+ graphId,
10252
+ merged
10253
+ );
10228
10254
  const hits = [];
10229
10255
  let rank = 1;
10230
10256
  for (const row of merged) {
@@ -10315,7 +10341,12 @@ async function executeVectorSearch(ctx, nodeKind, options) {
10315
10341
  offset + options.limit
10316
10342
  );
10317
10343
  if (merged.length === 0) return [];
10318
- const nodeMap = await fetchNodesForRows(backend, graphId, merged);
10344
+ const nodeMap = await fetchNodesForRows(
10345
+ backend,
10346
+ requireDefined(ctx.batchPointRead),
10347
+ graphId,
10348
+ merged
10349
+ );
10319
10350
  const hits = [];
10320
10351
  let rank = 1;
10321
10352
  for (const row of merged) {
@@ -10582,6 +10613,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
10582
10613
  ).slice(offset, offset + options.limit);
10583
10614
  const nodeMap = await fetchNodesForRows(
10584
10615
  backend,
10616
+ requireDefined(ctx.batchPointRead),
10585
10617
  graphId,
10586
10618
  ranked.map((entry2) => ({
10587
10619
  kind: entry2.kind,
@@ -10722,11 +10754,16 @@ function warnIfLanguageNotAdvertised(dialect, capabilities, language) {
10722
10754
  `[typegraph] fulltext language "${language}" is not in the advertised list for dialect "${dialect}" (${capabilities.languages.join(", ")}). If your backend has this language installed this warning is safe to ignore.`
10723
10755
  );
10724
10756
  }
10725
- async function fetchNodesByIds(backend, graphId, nodeKind, ids) {
10757
+ async function fetchNodesByIds(backend, batchPointRead, graphId, nodeKind, ids) {
10726
10758
  if (ids.length === 0) return /* @__PURE__ */ new Map();
10727
10759
  const map = /* @__PURE__ */ new Map();
10728
- if (backend.getNodes) {
10729
- const rows = await backend.getNodes(graphId, nodeKind, ids);
10760
+ const bound = bindExtraIfReachable(
10761
+ backend,
10762
+ batchPointRead.extras.getNodes,
10763
+ BATCH_POINT_READ.id
10764
+ );
10765
+ if (bound !== void 0) {
10766
+ const rows = await bound.getNodes(graphId, nodeKind, ids);
10730
10767
  for (const row of rows) {
10731
10768
  if (row.deleted_at !== void 0) continue;
10732
10769
  map.set(row.id, rowToNode(row));
@@ -10744,7 +10781,10 @@ async function fetchNodesByIds(backend, graphId, nodeKind, ids) {
10744
10781
  var StoreSearch = class {
10745
10782
  #context;
10746
10783
  constructor(context) {
10747
- this.#context = context;
10784
+ this.#context = {
10785
+ ...context,
10786
+ batchPointRead: context.batchPointRead ?? batchPointReadVerdict(context.backend)
10787
+ };
10748
10788
  }
10749
10789
  /**
10750
10790
  * Runs a fulltext search against nodes of the given kind.
@@ -10852,6 +10892,20 @@ function asRawBackend(backend) {
10852
10892
  return backend;
10853
10893
  }
10854
10894
 
10895
+ // src/backend/capabilities/recorded-time-ownership.ts
10896
+ function resolveRecordedTimeOwnership(capabilities) {
10897
+ return capabilities.recordedTimeOwnership ?? "typegraph-relations";
10898
+ }
10899
+ function refuseEngineNativeRecordedTimeNotYetImplemented() {
10900
+ throw new ConfigurationError(
10901
+ 'This backend declares `recordedTimeOwnership: "engine-native"`, but TypeGraph still allocates its own recorded clock for `history` / `revisionTracking`; the engine-native path lands with a later release. Construct the store without `history` / `revisionTracking`, or declare `recordedTimeOwnership: "typegraph-relations"` and let TypeGraph own the clock.',
10902
+ { code: "ENGINE_NATIVE_RECORDED_TIME_NOT_IMPLEMENTED" },
10903
+ {
10904
+ suggestion: 'Construct the store without `history`/`revisionTracking`, or declare `recordedTimeOwnership: "typegraph-relations"`.'
10905
+ }
10906
+ );
10907
+ }
10908
+
10855
10909
  // src/graph-extension/classify.ts
10856
10910
  function classifyModifications(existing, next) {
10857
10911
  const incompatible = [];
@@ -11658,9 +11712,13 @@ async function reduceExpandedWorkingSet(operation, workingSet, direction, reduce
11658
11712
  function nodeIdentityKey(node) {
11659
11713
  return `${node.kind}\0${node.id}`;
11660
11714
  }
11661
- function nodeIdentityKeyFromRow(id, kind) {
11715
+ function nodeIdentityFromRow(id, kind) {
11662
11716
  if (typeof id !== "string" || typeof kind !== "string") return void 0;
11663
- return nodeIdentityKey({ id, kind });
11717
+ return { id, kind };
11718
+ }
11719
+ function nodeIdentityKeyFromRow(id, kind) {
11720
+ const node = nodeIdentityFromRow(id, kind);
11721
+ return node === void 0 ? void 0 : nodeIdentityKey(node);
11664
11722
  }
11665
11723
  function compareNodeIdentity(left, right) {
11666
11724
  return compareCodePoints(left.id, right.id) || compareCodePoints(left.kind, right.kind);
@@ -13517,7 +13575,10 @@ async function findWeightedShortestPathInWorkingTable(ctx, sourceId, targetId, m
13517
13575
  return state.frontierCount === 0;
13518
13576
  },
13519
13577
  async extractResult(context) {
13520
- return extractPathFromWorkingTable(context, targetId, maxIterations);
13578
+ const recursiveTraversal = resolveRecursiveTraversal(
13579
+ ctx.backend.capabilities
13580
+ );
13581
+ return recursiveTraversal.supported ? extractPathFromWorkingTable(context, targetId, maxIterations) : extractPathByPredecessorWalk(context, targetId, maxIterations);
13521
13582
  }
13522
13583
  });
13523
13584
  }
@@ -13639,23 +13700,13 @@ async function relaxFrontierRound(context, targetId, iteration, roundBound) {
13639
13700
  return { frontierCount, bestTargetDistance };
13640
13701
  }
13641
13702
  async function extractPathFromWorkingTable(context, targetId, maxIterations) {
13642
- const { operation, workingTable, graphId, runId } = context;
13643
- const { dialect } = operation.ctx;
13703
+ const { workingTable, graphId, runId } = context;
13644
13704
  const rows = await context.backend.execute(
13645
13705
  asCompiledRowsSql(sql`
13646
13706
  WITH RECURSIVE chain AS (
13647
13707
  SELECT best.node_id, best.node_kind, best.distance, best.hops,
13648
13708
  best.predecessor_id, best.predecessor_kind, 0 AS position
13649
- FROM (
13650
- SELECT node_id, node_kind, distance, hops,
13651
- predecessor_id, predecessor_kind
13652
- FROM ${workingTable}
13653
- WHERE graph_id = ${graphId}
13654
- AND run_id = ${runId}
13655
- AND node_id = ${targetId}
13656
- ORDER BY distance ASC, ${dialect.binaryText(sql`node_kind`)}
13657
- LIMIT 1
13658
- ) best
13709
+ FROM (${selectCheapestTargetRowSql(context, targetId)}) best
13659
13710
  UNION ALL
13660
13711
  SELECT w.node_id, w.node_kind, w.distance, w.hops,
13661
13712
  w.predecessor_id, w.predecessor_kind, c.position + 1
@@ -13680,6 +13731,65 @@ async function extractPathFromWorkingTable(context, targetId, maxIterations) {
13680
13731
  totalWeight: Number(target.distance)
13681
13732
  };
13682
13733
  }
13734
+ function selectCheapestTargetRowSql(context, targetId) {
13735
+ const { operation, workingTable, graphId, runId } = context;
13736
+ const { dialect } = operation.ctx;
13737
+ return sql`
13738
+ SELECT node_id, node_kind, distance, hops,
13739
+ predecessor_id, predecessor_kind
13740
+ FROM ${workingTable}
13741
+ WHERE graph_id = ${graphId}
13742
+ AND run_id = ${runId}
13743
+ AND node_id = ${targetId}
13744
+ ORDER BY distance ASC, ${dialect.binaryText(sql`node_kind`)}
13745
+ LIMIT 1
13746
+ `;
13747
+ }
13748
+ async function collectPredecessorChain(first, readPredecessor, maxIterations) {
13749
+ const chain = [first];
13750
+ let current = first;
13751
+ for (let position = 0; position <= maxIterations; position++) {
13752
+ const predecessor = nodeIdentityFromRow(
13753
+ current.predecessor_id,
13754
+ current.predecessor_kind
13755
+ );
13756
+ if (predecessor === void 0) break;
13757
+ const predecessorRow = await readPredecessor(predecessor);
13758
+ if (predecessorRow === void 0) break;
13759
+ chain.push(predecessorRow);
13760
+ current = predecessorRow;
13761
+ }
13762
+ return chain;
13763
+ }
13764
+ async function extractPathByPredecessorWalk(context, targetId, maxIterations) {
13765
+ const rows = await context.backend.execute(
13766
+ asCompiledRowsSql(selectCheapestTargetRowSql(context, targetId))
13767
+ );
13768
+ const first = rows[0];
13769
+ if (first === void 0) return void 0;
13770
+ const { workingTable, graphId, runId } = context;
13771
+ const chain = await collectPredecessorChain(
13772
+ first,
13773
+ async (predecessor) => {
13774
+ const predecessorRows = await context.backend.execute(
13775
+ asCompiledRowsSql(sql`
13776
+ SELECT node_id, node_kind, distance, hops,
13777
+ predecessor_id, predecessor_kind
13778
+ FROM ${workingTable}
13779
+ WHERE graph_id = ${graphId} AND run_id = ${runId}
13780
+ AND node_kind = ${predecessor.kind} AND node_id = ${predecessor.id}
13781
+ `)
13782
+ );
13783
+ return predecessorRows[0];
13784
+ },
13785
+ maxIterations
13786
+ );
13787
+ return {
13788
+ nodes: chain.map((row) => ({ id: row.node_id, kind: row.node_kind })).toReversed(),
13789
+ depth: Number(first.hops),
13790
+ totalWeight: Number(first.distance)
13791
+ };
13792
+ }
13683
13793
  async function findWeightedSelfPath(ctx, nodeId, options) {
13684
13794
  return withInlineIterativeGraphOperation(ctx, options, async (operation) => {
13685
13795
  await assertValidEdgeWeights(
@@ -13918,6 +14028,155 @@ function createGraphAlgorithms(params) {
13918
14028
  };
13919
14029
  }
13920
14030
 
14031
+ // src/store/claims/verify.ts
14032
+ function uniquenessAxisGroups(graph, registry) {
14033
+ const groups = /* @__PURE__ */ new Map();
14034
+ for (const [kind, registration] of Object.entries(graph.nodes)) {
14035
+ for (const constraint of registration.unique ?? []) {
14036
+ const target = uniquenessClaimTarget(kind, constraint.scope, registry);
14037
+ const coveredKinds = constraint.scope === "kind" ? [kind] : subClassComponent(kind, registry);
14038
+ const identity = `${constraint.name}\0${target.axis}`;
14039
+ const existing = groups.get(identity);
14040
+ groups.set(identity, {
14041
+ constraintName: constraint.name,
14042
+ axis: target.axis,
14043
+ coveredKinds: /* @__PURE__ */ new Set([
14044
+ ...existing?.coveredKinds ?? [],
14045
+ ...coveredKinds
14046
+ ])
14047
+ });
14048
+ }
14049
+ }
14050
+ return [...groups.values()];
14051
+ }
14052
+ function uniquenessAxisFor(row, groups) {
14053
+ const covering = groups.filter(
14054
+ (group) => group.constraintName === row.constraintName && group.coveredKinds.has(row.nodeKind)
14055
+ ).toSorted(
14056
+ (left, right) => right.coveredKinds.size - left.coveredKinds.size || compareStrings(left.axis, right.axis)
14057
+ );
14058
+ return covering[0]?.axis ?? row.nodeKind;
14059
+ }
14060
+ function sortedOwners(owners) {
14061
+ return owners.toSorted(
14062
+ (left, right) => compareStrings(left.concreteKind, right.concreteKind) || compareStrings(left.nodeId, right.nodeId)
14063
+ );
14064
+ }
14065
+ function targetIdentity(target) {
14066
+ return [
14067
+ target.relation,
14068
+ target.axis,
14069
+ target.constraintName ?? "",
14070
+ target.key
14071
+ ].join("\0");
14072
+ }
14073
+ function uniquenessViolations(rows, groups, graphId) {
14074
+ const byAxis = /* @__PURE__ */ new Map();
14075
+ for (const row of rows) {
14076
+ const target = {
14077
+ relation: "uniques",
14078
+ graphId,
14079
+ axis: uniquenessAxisFor(row, groups),
14080
+ constraintName: row.constraintName,
14081
+ key: row.key
14082
+ };
14083
+ const identity = targetIdentity(target);
14084
+ const entry2 = byAxis.get(identity) ?? { target, owners: [] };
14085
+ const owner = {
14086
+ concreteKind: row.concreteKind,
14087
+ nodeId: row.nodeId
14088
+ };
14089
+ if (!entry2.owners.some((held) => isSameClaimOwner(held, owner)))
14090
+ entry2.owners.push(owner);
14091
+ byAxis.set(identity, entry2);
14092
+ }
14093
+ return [...byAxis.values()].filter((entry2) => entry2.owners.length > 1).map((entry2) => ({
14094
+ family: "nodeUniqueness",
14095
+ target: entry2.target,
14096
+ owners: sortedOwners(entry2.owners)
14097
+ }));
14098
+ }
14099
+ function disjointnessViolations(overlaps, registry, graphId) {
14100
+ return overlaps.map((overlap) => ({
14101
+ family: "nodeDisjointness",
14102
+ target: {
14103
+ relation: "uniques",
14104
+ graphId,
14105
+ axis: disjointnessClaimAxis(overlap.kinds[0], overlap.kinds[1], registry),
14106
+ constraintName: DISJOINT_CONSTRAINT_NAME,
14107
+ key: overlap.nodeId
14108
+ },
14109
+ owners: sortedOwners([
14110
+ { concreteKind: overlap.kinds[0], nodeId: overlap.nodeId },
14111
+ { concreteKind: overlap.kinds[1], nodeId: overlap.nodeId }
14112
+ ])
14113
+ }));
14114
+ }
14115
+ function edgeCardinalityViolations(rows, graphId) {
14116
+ const byAxis = /* @__PURE__ */ new Map();
14117
+ for (const row of rows) {
14118
+ const target = edgeCardinalityClaimTarget({ ...row, graphId });
14119
+ const identity = targetIdentity(target);
14120
+ const entry2 = byAxis.get(identity) ?? { target, edgeIds: [] };
14121
+ entry2.edgeIds.push(row.edgeId);
14122
+ byAxis.set(identity, entry2);
14123
+ }
14124
+ return [...byAxis.values()].filter((entry2) => entry2.edgeIds.length > 1).map((entry2) => ({
14125
+ family: "edgeCardinality",
14126
+ target: entry2.target,
14127
+ edgeIds: entry2.edgeIds.toSorted(
14128
+ (left, right) => compareStrings(left, right)
14129
+ )
14130
+ }));
14131
+ }
14132
+ function fenceDeclarations(graph, registry, graphId) {
14133
+ const uniqueConstraintNames = new Set(
14134
+ Object.values(graph.nodes).flatMap(
14135
+ (registration) => (registration.unique ?? []).map((constraint) => constraint.name)
14136
+ )
14137
+ );
14138
+ const edgeCardinalities = Object.entries(graph.edges).flatMap(
14139
+ ([edgeKind, registration]) => {
14140
+ const cardinality = registration.cardinality ?? "many";
14141
+ return cardinality === "many" ? [] : [{ edgeKind, cardinality }];
14142
+ }
14143
+ );
14144
+ return {
14145
+ graphId,
14146
+ uniqueConstraintNames: [...uniqueConstraintNames],
14147
+ disjointKindPairs: registry.disjointKindPairs(),
14148
+ edgeCardinalities
14149
+ };
14150
+ }
14151
+ async function verifyConstraintFences(context) {
14152
+ const audit = context.backend.readConstraintFenceViolations;
14153
+ if (audit === void 0) {
14154
+ throw new ConfigurationError(
14155
+ "This backend cannot audit constraint fences: it does not implement `readConstraintFenceViolations`.",
14156
+ { code: "CONSTRAINT_FENCE_AUDIT_UNSUPPORTED" },
14157
+ {
14158
+ suggestion: "Run the audit through a backend built by `createSqliteBackend` or `createPostgresBackend`, or implement the member."
14159
+ }
14160
+ );
14161
+ }
14162
+ const declarations = fenceDeclarations(
14163
+ context.graph,
14164
+ context.registry,
14165
+ context.graphId
14166
+ );
14167
+ const rows = await audit(declarations);
14168
+ const groups = uniquenessAxisGroups(context.graph, context.registry);
14169
+ return [
14170
+ ...uniquenessViolations(rows.contendedUniqueRows, groups, context.graphId),
14171
+ ...disjointnessViolations(
14172
+ rows.disjointOverlaps,
14173
+ context.registry,
14174
+ context.graphId
14175
+ ),
14176
+ ...edgeCardinalityViolations(rows.contendedEdgeRows, context.graphId)
14177
+ ].toSorted((left, right) => compareClaimTargets(left.target, right.target));
14178
+ }
14179
+
13921
14180
  // src/store/operations/edge-identity.ts
13922
14181
  function edgeIdentityFromRow(row) {
13923
14182
  return {
@@ -14093,6 +14352,7 @@ function createEdgeCollection(config) {
14093
14352
  graphId,
14094
14353
  kind,
14095
14354
  backend,
14355
+ batchPointRead,
14096
14356
  defaultTemporalMode,
14097
14357
  rowToEdge: rowToEdge2,
14098
14358
  executeCreate: executeEdgeCreate2,
@@ -14198,7 +14458,12 @@ function createEdgeCollection(config) {
14198
14458
  },
14199
14459
  async getByIds(ids, options) {
14200
14460
  if (ids.length === 0) return [];
14201
- const rowsById = await getEdgeRowsByIds(backend, graphId, ids);
14461
+ const rowsById = await getEdgeRowsByIds(
14462
+ backend,
14463
+ batchPointRead,
14464
+ graphId,
14465
+ ids
14466
+ );
14202
14467
  const matches = temporalRowMatcher(options);
14203
14468
  return ids.map((id) => {
14204
14469
  const row = rowsById.get(id);
@@ -14316,7 +14581,12 @@ function createEdgeCollection(config) {
14316
14581
  }
14317
14582
  const upsertAll = async (target) => {
14318
14583
  const ids = items.map((item) => item.id);
14319
- const existingMap = await getEdgeRowsByIds(target, graphId, ids);
14584
+ const existingMap = await getEdgeRowsByIds(
14585
+ target,
14586
+ batchPointRead,
14587
+ graphId,
14588
+ ids
14589
+ );
14320
14590
  const results2 = Array.from({ length: items.length });
14321
14591
  const toCreate = [];
14322
14592
  const toUpdate = [];
@@ -14635,6 +14905,7 @@ function createNodeCollection(config) {
14635
14905
  graphId,
14636
14906
  kind,
14637
14907
  backend,
14908
+ batchPointRead,
14638
14909
  defaultTemporalMode,
14639
14910
  rowToNode: rowToNode2,
14640
14911
  executeCreate: executeNodeCreate2,
@@ -14673,7 +14944,13 @@ function createNodeCollection(config) {
14673
14944
  },
14674
14945
  async getByIds(ids, options) {
14675
14946
  if (ids.length === 0) return [];
14676
- const rowsById = await getNodeRowsByIds(backend, graphId, kind, ids);
14947
+ const rowsById = await getNodeRowsByIds(
14948
+ backend,
14949
+ batchPointRead,
14950
+ graphId,
14951
+ kind,
14952
+ ids
14953
+ );
14677
14954
  const matches = temporalRowMatcher(options);
14678
14955
  return ids.map((id) => {
14679
14956
  const row = rowsById.get(id);
@@ -14884,7 +15161,12 @@ function createNodeCollection(config) {
14884
15161
  const upsertAll = async (target) => {
14885
15162
  const ids = items.map((item) => item.id);
14886
15163
  const existingMap = /* @__PURE__ */ new Map();
14887
- if (target.getNodes === void 0) {
15164
+ const boundGetNodes = bindExtraIfReachable(
15165
+ target,
15166
+ batchPointRead.extras.getNodes,
15167
+ BATCH_POINT_READ.id
15168
+ );
15169
+ if (boundGetNodes === void 0) {
14888
15170
  const rows = await Promise.all(
14889
15171
  ids.map((id) => target.getNode(graphId, kind, id))
14890
15172
  );
@@ -14892,7 +15174,7 @@ function createNodeCollection(config) {
14892
15174
  if (row !== void 0) existingMap.set(row.id, row);
14893
15175
  }
14894
15176
  } else {
14895
- const rows = await target.getNodes(graphId, kind, ids);
15177
+ const rows = await boundGetNodes.getNodes(graphId, kind, ids);
14896
15178
  for (const row of rows) {
14897
15179
  existingMap.set(row.id, row);
14898
15180
  }
@@ -15081,7 +15363,7 @@ function createNodeCollection(config) {
15081
15363
  }
15082
15364
 
15083
15365
  // src/store/collection-factory.ts
15084
- function createNodeCollectionsProxy(graph, graphId, registry, backend, operations) {
15366
+ function createNodeCollectionsProxy(graph, graphId, registry, backend, batchPointRead, operations) {
15085
15367
  const collectionCache = /* @__PURE__ */ new Map();
15086
15368
  return new Proxy({}, {
15087
15369
  get: (_, kind) => {
@@ -15096,6 +15378,7 @@ function createNodeCollectionsProxy(graph, graphId, registry, backend, operation
15096
15378
  graphId,
15097
15379
  kind,
15098
15380
  backend,
15381
+ batchPointRead,
15099
15382
  ...operations
15100
15383
  });
15101
15384
  collectionCache.set(kind, collection);
@@ -15103,7 +15386,7 @@ function createNodeCollectionsProxy(graph, graphId, registry, backend, operation
15103
15386
  }
15104
15387
  });
15105
15388
  }
15106
- function createEdgeCollectionsProxy(graph, graphId, registry, backend, operations) {
15389
+ function createEdgeCollectionsProxy(graph, graphId, registry, backend, batchPointRead, operations) {
15107
15390
  const collectionCache = /* @__PURE__ */ new Map();
15108
15391
  return new Proxy({}, {
15109
15392
  get: (_, kind) => {
@@ -15118,6 +15401,7 @@ function createEdgeCollectionsProxy(graph, graphId, registry, backend, operation
15118
15401
  graphId,
15119
15402
  kind,
15120
15403
  backend,
15404
+ batchPointRead,
15121
15405
  ...operations
15122
15406
  });
15123
15407
  collectionCache.set(kind, collection);
@@ -15135,6 +15419,12 @@ var HISTORY_STORE_BACKEND_KEYS = [
15135
15419
  "capabilities",
15136
15420
  "checkUnique",
15137
15421
  "checkUniqueBatch",
15422
+ // The edge cardinality fence. Both members write only the claim relation —
15423
+ // a reservation whose holder is a graph row, never a graph row itself — so
15424
+ // neither can bypass a capture flush, and a history-enabled store that could
15425
+ // not reach them would write constrained edges unfenced.
15426
+ "claimEdgeCardinality",
15427
+ "claimEdgeCardinalityBatch",
15138
15428
  "claimIndexMaterialization",
15139
15429
  "close",
15140
15430
  "commitSchemaVersion",
@@ -15159,12 +15449,19 @@ var HISTORY_STORE_BACKEND_KEYS = [
15159
15449
  "dropVectorIndex",
15160
15450
  "edgeExistsBetween",
15161
15451
  "ensureContributionMaterializationsTable",
15452
+ // Installs a database-global extension — and `ensureTrigramExtension` is the
15453
+ // same operation under its deprecated `pg_trgm`-only name, so the two are
15454
+ // classified together or not at all. Like the `ensure*Table` members they sit
15455
+ // beside, they create storage-level scaffolding and write no graph row, so
15456
+ // neither can bypass a capture flush.
15457
+ "ensureExtension",
15162
15458
  "ensureFulltextTable",
15163
15459
  "ensureIndexMaterializationsTable",
15164
15460
  "ensureKindRemovalsTable",
15165
15461
  "ensureReconciliationMarkersTable",
15166
15462
  "ensureRevisionOriginsTable",
15167
15463
  "ensureRuntimeContributions",
15464
+ "ensureTrigramExtension",
15168
15465
  "ensureVectorSlotContribution",
15169
15466
  "ensureVectorSlotContributions",
15170
15467
  "execute",
@@ -15191,6 +15488,10 @@ var HISTORY_STORE_BACKEND_KEYS = [
15191
15488
  "hardDeleteEdge",
15192
15489
  "hardDeleteEdgesBatch",
15193
15490
  "hardDeleteNode",
15491
+ // Reaps the claims a removed kind's nodes own. Like the sibling
15492
+ // `hardDeleteUniquesByNodeIds` beside it, it clears sidecar rows whose
15493
+ // entity rows are already gone, so it cannot bypass a capture flush.
15494
+ "hardDeleteUniquesByConcreteKind",
15194
15495
  "hardDeleteUniquesByNodeIds",
15195
15496
  "hybridSearch",
15196
15497
  "insertEdge",
@@ -15204,6 +15505,13 @@ var HISTORY_STORE_BACKEND_KEYS = [
15204
15505
  "insertUnique",
15205
15506
  "insertUniqueBatch",
15206
15507
  "probeContributions",
15508
+ // Housekeeping for the relation above: drops claim rows whose holders are
15509
+ // already gone. Writes no graph row.
15510
+ "purgeEdgeClaims",
15511
+ // Read-only fence audit. Writes nothing at all, so it can bypass no capture
15512
+ // flush, and a history-enabled store that could not reach it would have no
15513
+ // way to report which declared constraint its data already violates.
15514
+ "readConstraintFenceViolations",
15207
15515
  "recordContributionMaterialization",
15208
15516
  "recordIndexMaterialization",
15209
15517
  "recordKindRemoval",
@@ -15348,6 +15656,10 @@ function delay(ms) {
15348
15656
  });
15349
15657
  }
15350
15658
  async function ensureTrigramExtension(backend) {
15659
+ if (backend.ensureExtension !== void 0) {
15660
+ await backend.ensureExtension("pg_trgm");
15661
+ return;
15662
+ }
15351
15663
  if (backend.ensureTrigramExtension !== void 0) {
15352
15664
  await backend.ensureTrigramExtension();
15353
15665
  return;
@@ -16073,6 +16385,7 @@ async function materializeRemovals(context, options = {}) {
16073
16385
  const edgesTable = tableNames?.edges ?? "typegraph_edges";
16074
16386
  const fulltextTable = tableNames?.fulltext ?? "typegraph_node_fulltext";
16075
16387
  const uniquesTable = tableNames?.uniques ?? "typegraph_node_uniques";
16388
+ const edgeClaimsTable = tableNames?.edgeClaims ?? "typegraph_edge_claims";
16076
16389
  const captureRecordedRemovals = context.captureRecordedRemovals === true;
16077
16390
  const ctx = {
16078
16391
  backend,
@@ -16081,6 +16394,7 @@ async function materializeRemovals(context, options = {}) {
16081
16394
  edgesTable,
16082
16395
  fulltextTable,
16083
16396
  uniquesTable,
16397
+ edgeClaimsTable,
16084
16398
  captureRecordedRemovals,
16085
16399
  recordedSchema: captureRecordedRemovals ? context.recordedSchema ?? createSqlSchema(backend.tableNames) : void 0
16086
16400
  };
@@ -16236,7 +16550,12 @@ async function materializeOne2(row, ctx) {
16236
16550
  }
16237
16551
  }
16238
16552
  async function closeRecordedAndDeleteLiveRows(ctx, row, target) {
16239
- const deleteStatements = buildRemovedKindLiveDeleteStatements(ctx, row);
16553
+ const reapsEdgeClaims = await target.tableExists(ctx.edgeClaimsTable);
16554
+ const deleteStatements = buildRemovedKindLiveDeleteStatements(
16555
+ ctx,
16556
+ row,
16557
+ reapsEdgeClaims
16558
+ );
16240
16559
  if (!ctx.captureRecordedRemovals || ctx.recordedSchema === void 0) {
16241
16560
  await executeDeleteStatements(target, deleteStatements);
16242
16561
  return;
@@ -16263,24 +16582,54 @@ async function closeRecordedAndDeleteLiveRows(ctx, row, target) {
16263
16582
  );
16264
16583
  await executeDeleteStatements(target, deleteStatements);
16265
16584
  }
16266
- function buildRemovedKindLiveDeleteStatements(ctx, row) {
16585
+ function buildRemovedKindLiveDeleteStatements(ctx, row, reapsEdgeClaims) {
16267
16586
  const graphLit = literal(ctx.graphId);
16268
16587
  const kindLit = literal(row.kindName);
16269
16588
  if (row.entity === "node") {
16270
16589
  return [
16271
- `DELETE FROM ${quote(ctx.nodesTable)} WHERE graph_id = ${graphLit} AND kind = ${kindLit}`,
16272
- `DELETE FROM ${quote(ctx.edgesTable)} WHERE graph_id = ${graphLit} AND (from_kind = ${kindLit} OR to_kind = ${kindLit})`,
16273
- `DELETE FROM ${quote(ctx.fulltextTable)} WHERE graph_id = ${graphLit} AND node_kind = ${kindLit}`,
16274
- `DELETE FROM ${quote(ctx.uniquesTable)} WHERE graph_id = ${graphLit} AND node_kind = ${kindLit}`
16590
+ // Must precede the edge delete: ownership is discovered by selecting the
16591
+ // connected edge ids, which no longer exist afterward.
16592
+ ...reapsEdgeClaims ? [
16593
+ buildHardDeleteEdgeClaimsByNodeKind(
16594
+ ctx.edgeClaimsTable,
16595
+ ctx.edgesTable,
16596
+ { graphId: ctx.graphId, nodeKind: row.kindName }
16597
+ )
16598
+ ] : [],
16599
+ sql.raw(
16600
+ `DELETE FROM ${quote(ctx.nodesTable)} WHERE graph_id = ${graphLit} AND kind = ${kindLit}`
16601
+ ),
16602
+ sql.raw(
16603
+ `DELETE FROM ${quote(ctx.edgesTable)} WHERE graph_id = ${graphLit} AND (from_kind = ${kindLit} OR to_kind = ${kindLit})`
16604
+ ),
16605
+ sql.raw(
16606
+ `DELETE FROM ${quote(ctx.fulltextTable)} WHERE graph_id = ${graphLit} AND node_kind = ${kindLit}`
16607
+ ),
16608
+ buildHardDeleteUniquesByConcreteKind(ctx.uniquesTable, {
16609
+ graphId: ctx.graphId,
16610
+ concreteKind: row.kindName
16611
+ })
16275
16612
  ];
16276
16613
  }
16277
16614
  return [
16278
- `DELETE FROM ${quote(ctx.edgesTable)} WHERE graph_id = ${graphLit} AND kind = ${kindLit}`
16615
+ sql.raw(
16616
+ `DELETE FROM ${quote(ctx.edgesTable)} WHERE graph_id = ${graphLit} AND kind = ${kindLit}`
16617
+ ),
16618
+ // Housekeeping, on the same one-owner terms as the uniqueness reap: the
16619
+ // rows this kind's edges held are takeable the moment those edges are gone,
16620
+ // but nothing would ever reap them, so the relation would grow by one row
16621
+ // per removed constrained kind forever.
16622
+ ...reapsEdgeClaims ? [
16623
+ buildHardDeleteEdgeClaimsByEdgeKind(ctx.edgeClaimsTable, {
16624
+ graphId: ctx.graphId,
16625
+ edgeKind: row.kindName
16626
+ })
16627
+ ] : []
16279
16628
  ];
16280
16629
  }
16281
16630
  async function executeDeleteStatements(target, statements) {
16282
16631
  for (const statement of statements) {
16283
- await target.executeStatement(asCompiledStatementSql(sql.raw(statement)));
16632
+ await target.executeStatement(asCompiledStatementSql(statement));
16284
16633
  }
16285
16634
  }
16286
16635
  async function dropEmbeddingTableStorage(ctx, row, target) {
@@ -16443,6 +16792,39 @@ function literal(value) {
16443
16792
  return `'${value.replaceAll("'", "''")}'`;
16444
16793
  }
16445
16794
 
16795
+ // src/store/operations/edge-write-fences.ts
16796
+ var EdgeUpdateTargetMoved = class extends Error {
16797
+ constructor(kind, id) {
16798
+ super(
16799
+ `The ${kind} edge "${id}" was replaced between this update's read and its write; re-resolving it. This is internal and is never returned to a caller.`
16800
+ );
16801
+ this.name = "EdgeUpdateTargetMoved";
16802
+ }
16803
+ };
16804
+ function isEdgeUpdateNoRowError(error) {
16805
+ return error instanceof DatabaseOperationError && error.details.operation === "update" && error.details.entity === "edge" && error.details.reason === "no_row_returned";
16806
+ }
16807
+ async function withUnmatchedEdgeUpdateRefusal(graphId, target, id, expected, assertedValidFrom, write) {
16808
+ try {
16809
+ return await write();
16810
+ } catch (error) {
16811
+ if (!isEdgeUpdateNoRowError(error)) throw error;
16812
+ const current = await target.getEdge(graphId, id);
16813
+ if (current !== void 0) {
16814
+ assertEdgeIdentityMatches(
16815
+ id,
16816
+ expected,
16817
+ edgeIdentityFromRow(current),
16818
+ "update"
16819
+ );
16820
+ if (assertedValidFrom && current.deleted_at === void 0) {
16821
+ throw new EdgeUpdateTargetMoved(expected.kind, id);
16822
+ }
16823
+ }
16824
+ throw new EdgeNotFoundError(expected.kind, id);
16825
+ }
16826
+ }
16827
+
16446
16828
  // src/store/operations/edge-operations.ts
16447
16829
  function getEdgeRegistration(graph, kind) {
16448
16830
  if (!hasOwnKey(graph.edges, kind)) throw new KindNotFoundError(kind, "edge");
@@ -16450,24 +16832,15 @@ function getEdgeRegistration(graph, kind) {
16450
16832
  if (registration === void 0) throw new KindNotFoundError(kind, "edge");
16451
16833
  return registration;
16452
16834
  }
16453
- function buildEdgeEndpointCacheKey(graphId, kind, id) {
16454
- return encodeTupleKey([graphId, kind, id]);
16455
- }
16456
- function buildEdgeFromCacheKey(graphId, edgeKind, fromKind, fromId) {
16457
- return encodeTupleKey([graphId, edgeKind, fromKind, fromId]);
16458
- }
16459
- function buildEdgeBetweenCacheKey(graphId, edgeKind, fromKind, fromId, toKind, toId) {
16460
- return encodeTupleKey([graphId, edgeKind, fromKind, fromId, toKind, toId]);
16461
- }
16462
- function buildCountEdgesFromCacheKey(params) {
16463
- const activeOnly = params.activeOnly === true ? "1" : "0";
16464
- return encodeTupleKey([
16465
- params.graphId,
16466
- params.edgeKind,
16467
- params.fromKind,
16468
- params.fromId,
16469
- activeOnly
16470
- ]);
16835
+ function edgeInsertWork(prepared) {
16836
+ const claim = edgeCardinalityClaim(
16837
+ prepared.cardinality,
16838
+ prepared.insertParams
16839
+ );
16840
+ return {
16841
+ params: prepared.insertParams,
16842
+ ...claim === void 0 ? {} : { claim }
16843
+ };
16471
16844
  }
16472
16845
  function buildInsertEdgeParams(graphId, id, kind, fromKind, fromId, toKind, toId, props, validFrom, validTo) {
16473
16846
  const insertParams = {
@@ -16484,106 +16857,6 @@ function buildInsertEdgeParams(graphId, id, kind, fromKind, fromId, toKind, toId
16484
16857
  if (validTo !== void 0) insertParams.validTo = validTo;
16485
16858
  return insertParams;
16486
16859
  }
16487
- function incrementPendingCount(counts, key) {
16488
- const previous = counts.get(key) ?? 0;
16489
- counts.set(key, previous + 1);
16490
- }
16491
- function createEdgeBatchValidationBackend(backend) {
16492
- const endpointCache = /* @__PURE__ */ new Map();
16493
- const countEdgesFromCache = /* @__PURE__ */ new Map();
16494
- const edgeExistsCache = /* @__PURE__ */ new Map();
16495
- const pendingOneCounts = /* @__PURE__ */ new Map();
16496
- const pendingOneActiveCounts = /* @__PURE__ */ new Map();
16497
- const pendingUniquePairs = /* @__PURE__ */ new Set();
16498
- async function getNodeCached(graphId, kind, id) {
16499
- const cacheKey = buildEdgeEndpointCacheKey(graphId, kind, id);
16500
- if (endpointCache.has(cacheKey)) {
16501
- return endpointCache.get(cacheKey);
16502
- }
16503
- const node = await backend.getNode(graphId, kind, id);
16504
- endpointCache.set(cacheKey, node);
16505
- return node;
16506
- }
16507
- function seedEndpointRow(graphId, kind, id, row) {
16508
- const cacheKey = buildEdgeEndpointCacheKey(graphId, kind, id);
16509
- if (endpointCache.has(cacheKey)) return;
16510
- endpointCache.set(cacheKey, row);
16511
- }
16512
- async function countEdgesFromCached(params) {
16513
- const cacheKey = buildCountEdgesFromCacheKey(params);
16514
- let baseCount = countEdgesFromCache.get(cacheKey);
16515
- if (baseCount === void 0) {
16516
- baseCount = await backend.countEdgesFrom(params);
16517
- countEdgesFromCache.set(cacheKey, baseCount);
16518
- }
16519
- const pendingKey = buildEdgeFromCacheKey(
16520
- params.graphId,
16521
- params.edgeKind,
16522
- params.fromKind,
16523
- params.fromId
16524
- );
16525
- const pendingCount = params.activeOnly === true ? pendingOneActiveCounts.get(pendingKey) ?? 0 : pendingOneCounts.get(pendingKey) ?? 0;
16526
- return baseCount + pendingCount;
16527
- }
16528
- async function edgeExistsBetweenCached(params) {
16529
- const cacheKey = buildEdgeBetweenCacheKey(
16530
- params.graphId,
16531
- params.edgeKind,
16532
- params.fromKind,
16533
- params.fromId,
16534
- params.toKind,
16535
- params.toId
16536
- );
16537
- if (pendingUniquePairs.has(cacheKey)) {
16538
- return true;
16539
- }
16540
- if (edgeExistsCache.has(cacheKey)) {
16541
- return edgeExistsCache.get(cacheKey) ?? false;
16542
- }
16543
- const exists = await backend.edgeExistsBetween(params);
16544
- edgeExistsCache.set(cacheKey, exists);
16545
- return exists;
16546
- }
16547
- function registerPendingEdgeForCardinality(insertParams, cardinality) {
16548
- const fromCacheKey = buildEdgeFromCacheKey(
16549
- insertParams.graphId,
16550
- insertParams.kind,
16551
- insertParams.fromKind,
16552
- insertParams.fromId
16553
- );
16554
- if (cardinality === "one") {
16555
- incrementPendingCount(pendingOneCounts, fromCacheKey);
16556
- return;
16557
- }
16558
- if (cardinality === "oneActive") {
16559
- if (insertParams.validTo === void 0) {
16560
- incrementPendingCount(pendingOneActiveCounts, fromCacheKey);
16561
- }
16562
- return;
16563
- }
16564
- if (cardinality === "unique") {
16565
- const uniqueCacheKey = buildEdgeBetweenCacheKey(
16566
- insertParams.graphId,
16567
- insertParams.kind,
16568
- insertParams.fromKind,
16569
- insertParams.fromId,
16570
- insertParams.toKind,
16571
- insertParams.toId
16572
- );
16573
- pendingUniquePairs.add(uniqueCacheKey);
16574
- }
16575
- }
16576
- const validationBackend = deriveBackend(backend, {
16577
- getNode: getNodeCached,
16578
- countEdgesFrom: countEdgesFromCached,
16579
- edgeExistsBetween: edgeExistsBetweenCached
16580
- });
16581
- return {
16582
- backend: validationBackend,
16583
- registerPendingEdgeForCardinality,
16584
- seedEndpointRow
16585
- };
16586
- }
16587
16860
  async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
16588
16861
  const kind = input.kind;
16589
16862
  const fromKind = input.fromKind;
@@ -16676,11 +16949,17 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
16676
16949
  const opContext = ctx.createOperationContext("create", "edge", kind, id);
16677
16950
  const shouldReturnRow = options?.returnRow ?? true;
16678
16951
  const convergeOn = options?.convergeOn;
16679
- return runHookedWriteOperation(
16952
+ return runHookedWritePlan(
16680
16953
  ctx,
16681
16954
  opContext,
16955
+ // A create that runs a cardinality probe, or one converging on a match
16956
+ // key, decides something the write must not have invalidated. A plain
16957
+ // `many` create decides nothing and takes no lock.
16958
+ edgeWritePlan(
16959
+ convergeOn === void 0 ? edgeWriteNeedsConstraintFence(edgeCardinality(ctx, kind)) : "edgeMatchKeyConvergence"
16960
+ ),
16682
16961
  backend,
16683
- async (target) => {
16962
+ async (session, target) => {
16684
16963
  if (convergeOn !== void 0) {
16685
16964
  const candidateRows = await target.findEdgesByKind({
16686
16965
  graphId: ctx.graphId,
@@ -16707,21 +16986,13 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
16707
16986
  id,
16708
16987
  target
16709
16988
  );
16989
+ const work = edgeInsertWork(prepared);
16710
16990
  const row = await withAlreadyExistsTranslation("edge", async () => {
16711
- if (shouldReturnRow) return target.insertEdge(prepared.insertParams);
16712
- await runInsertNoReturn(
16713
- edgeInsertDispatch(target),
16714
- prepared.insertParams
16715
- );
16991
+ if (shouldReturnRow) return session.createEdge(work);
16992
+ await session.createEdgeNoReturn(work);
16716
16993
  return;
16717
16994
  });
16718
16995
  return row === void 0 ? void 0 : rowToEdge(row);
16719
- },
16720
- {
16721
- // A create that runs a cardinality probe, or one converging on a match
16722
- // key, decides something the write must not have invalidated. A plain
16723
- // `many` create decides nothing and takes no lock.
16724
- fencesConstraintProbe: convergeOn === void 0 ? edgeWriteNeedsConstraintFence(edgeCardinality(ctx, kind)) : "edgeMatchKeyConvergence"
16725
16996
  }
16726
16997
  );
16727
16998
  }
@@ -16738,7 +17009,12 @@ async function executeEdgeCreate(ctx, input, backend) {
16738
17009
  return edge;
16739
17010
  }
16740
17011
  async function primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointRow) {
16741
- if (backend.getNodes === void 0) return;
17012
+ const bound = bindExtraIfReachable(
17013
+ backend,
17014
+ ctx.batchPointRead.extras.getNodes,
17015
+ BATCH_POINT_READ.id
17016
+ );
17017
+ if (bound === void 0) return;
16742
17018
  const idsByKind = /* @__PURE__ */ new Map();
16743
17019
  const addEndpoint = (kind, id) => {
16744
17020
  const ids = idsByKind.get(kind) ?? /* @__PURE__ */ new Set();
@@ -16751,7 +17027,7 @@ async function primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointR
16751
17027
  }
16752
17028
  for (const [kind, ids] of idsByKind) {
16753
17029
  const orderedIds = [...ids];
16754
- const rows = await backend.getNodes(ctx.graphId, kind, orderedIds);
17030
+ const rows = await bound.getNodes(ctx.graphId, kind, orderedIds);
16755
17031
  const rowsById = new Map(rows.map((row) => [row.id, row]));
16756
17032
  for (const id of orderedIds) {
16757
17033
  seedEndpointRow(ctx.graphId, kind, id, rowsById.get(id));
@@ -16780,52 +17056,52 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
16780
17056
  prepared.cardinality
16781
17057
  );
16782
17058
  }
16783
- const batchInsertParams = preparedCreates.map(
16784
- (prepared) => prepared.insertParams
17059
+ const batchInsertWork = preparedCreates.map(
17060
+ (prepared) => edgeInsertWork(prepared)
16785
17061
  );
16786
- return { preparedCreates, batchInsertParams };
17062
+ return { preparedCreates, batchInsertWork };
16787
17063
  }
16788
17064
  async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
16789
17065
  if (inputs.length === 0) {
16790
17066
  return;
16791
17067
  }
16792
- await runInWriteTransaction(
17068
+ await runWritePlan(
16793
17069
  ctx,
17070
+ edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
16794
17071
  backend,
16795
- async (target) => {
16796
- const { batchInsertParams } = await prepareEdgeBatchCreates(
17072
+ async (session, target) => {
17073
+ const { batchInsertWork } = await prepareEdgeBatchCreates(
16797
17074
  ctx,
16798
17075
  inputs,
16799
17076
  target
16800
17077
  );
16801
17078
  await withAlreadyExistsTranslation(
16802
17079
  "edge",
16803
- () => runInsertBatch(edgeInsertDispatch(target), batchInsertParams)
17080
+ () => session.createEdgesNoReturn(batchInsertWork)
16804
17081
  );
16805
- },
16806
- { fencesConstraintProbe: batchFencesConstraintProbe(ctx, inputs) }
17082
+ }
16807
17083
  );
16808
17084
  }
16809
17085
  async function executeEdgeCreateBatch(ctx, inputs, backend) {
16810
17086
  if (inputs.length === 0) {
16811
17087
  return [];
16812
17088
  }
16813
- return runInWriteTransaction(
17089
+ return runWritePlan(
16814
17090
  ctx,
17091
+ edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
16815
17092
  backend,
16816
- async (target) => {
16817
- const { batchInsertParams } = await prepareEdgeBatchCreates(
17093
+ async (session, target) => {
17094
+ const { batchInsertWork } = await prepareEdgeBatchCreates(
16818
17095
  ctx,
16819
17096
  inputs,
16820
17097
  target
16821
17098
  );
16822
17099
  const rows = await withAlreadyExistsTranslation(
16823
17100
  "edge",
16824
- () => runInsertBatchReturning(edgeInsertDispatch(target), batchInsertParams)
17101
+ () => session.createEdges(batchInsertWork)
16825
17102
  );
16826
17103
  return rows.map((row) => rowToEdge(row));
16827
- },
16828
- { fencesConstraintProbe: batchFencesConstraintProbe(ctx, inputs) }
17104
+ }
16829
17105
  );
16830
17106
  }
16831
17107
  function batchFencesConstraintProbe(ctx, inputs) {
@@ -16869,7 +17145,7 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
16869
17145
  unchanged: canonicalEqual(validatedProps, existingProps)
16870
17146
  };
16871
17147
  }
16872
- async function performEdgeUpdate(ctx, input, target, options) {
17148
+ async function performEdgeUpdate(ctx, input, session, target, options) {
16873
17149
  const id = input.id;
16874
17150
  assertValidityEndMutation(input, {
16875
17151
  entityType: "edge",
@@ -16900,6 +17176,7 @@ async function performEdgeUpdate(ctx, input, target, options) {
16900
17176
  );
16901
17177
  const cardinality = edgeCardinality(ctx, input.identity.kind);
16902
17178
  const reentersLivePopulation = options?.clearDeleted === true && existing.deleted_at !== void 0;
17179
+ let reentryClaim;
16903
17180
  const reentersActivePopulation = cardinality === "oneActive" && effectiveValidTo === void 0 && (existing.deleted_at !== void 0 || existing.valid_to !== void 0);
16904
17181
  if (reentersLivePopulation || reentersActivePopulation) {
16905
17182
  await checkCardinalityConstraint(
@@ -16916,6 +17193,16 @@ async function performEdgeUpdate(ctx, input, target, options) {
16916
17193
  existing.to_id,
16917
17194
  effectiveValidTo
16918
17195
  );
17196
+ reentryClaim = edgeCardinalityClaim(cardinality, {
17197
+ graphId: ctx.graphId,
17198
+ id,
17199
+ kind: input.identity.kind,
17200
+ fromKind: existing.from_kind,
17201
+ fromId: existing.from_id,
17202
+ toKind: existing.to_kind,
17203
+ toId: existing.to_id,
17204
+ ...effectiveValidTo === void 0 ? {} : { validTo: effectiveValidTo }
17205
+ });
16919
17206
  }
16920
17207
  const windowVerdict = assertWritableValidityWindow(
16921
17208
  `edge "${id}"`,
@@ -16930,85 +17217,39 @@ async function performEdgeUpdate(ctx, input, target, options) {
16930
17217
  },
16931
17218
  validTo
16932
17219
  );
16933
- const updateParams = {
16934
- graphId: ctx.graphId,
17220
+ const fences = {
17221
+ validityLowerBound: windowVerdict.storedLowerBoundFence,
17222
+ validityUpperBound: reentersActivePopulation && existing.valid_to !== void 0 ? { expectedValidTo: existing.valid_to } : {},
17223
+ edgeIdentity: input.identity
17224
+ };
17225
+ const work = {
16935
17226
  id,
16936
- kind: input.identity.kind,
16937
17227
  props: validatedProps,
16938
- // The bound the window verdict above READ, carried into the same `WHERE` as
16939
- // the identity components and on exactly the same terms: present only when
16940
- // the verdict consulted it, because a component the caller made no claim
16941
- // about must not become a predicate that refuses legitimate writes.
16942
- ...windowVerdict.storedLowerBoundFence
17228
+ ...appliedValidFrom !== void 0 && { validFrom: appliedValidFrom },
17229
+ // `validTo` and `clearValidTo` are mutually exclusive in the params, so the
17230
+ // work states exactly one of them.
17231
+ ...input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo },
17232
+ ...options?.clearDeleted === true && { clearDeleted: true },
17233
+ ...reentryClaim === void 0 ? {} : { claim: reentryClaim }
16943
17234
  };
16944
- if (input.identity.fromKind !== void 0) {
16945
- updateParams.fromKind = input.identity.fromKind;
16946
- }
16947
- if (input.identity.fromId !== void 0) {
16948
- updateParams.fromId = input.identity.fromId;
16949
- }
16950
- if (input.identity.toKind !== void 0) {
16951
- updateParams.toKind = input.identity.toKind;
16952
- }
16953
- if (input.identity.toId !== void 0) {
16954
- updateParams.toId = input.identity.toId;
16955
- }
16956
- if (appliedValidFrom !== void 0) {
16957
- updateParams.validFrom = appliedValidFrom;
16958
- }
16959
- if (reentersActivePopulation && existing.valid_to !== void 0) {
16960
- updateParams.expectedValidTo = existing.valid_to;
16961
- }
16962
- if (options?.clearDeleted) updateParams.clearDeleted = true;
16963
17235
  const row = await withUnmatchedEdgeUpdateRefusal(
16964
- ctx,
17236
+ ctx.graphId,
16965
17237
  target,
16966
17238
  id,
16967
17239
  input.identity,
16968
- updateParams.expectedValidFrom !== void 0 || updateParams.expectedValidTo !== void 0,
16969
- () => target.updateEdge({
16970
- ...updateParams,
16971
- ...input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo }
16972
- })
17240
+ // "Did this write assert any window state?" is one predicate with one
17241
+ // owner, consulted here and by the fence appliers that carry it, rather
17242
+ // than re-derived from the params the diagnosis never sees.
17243
+ assertsStoredWindowState(fences),
17244
+ () => session.reviseEdge(work, fences)
16973
17245
  );
16974
17246
  return rowToEdge(row);
16975
17247
  }
16976
- function isEdgeUpdateNoRowError(error) {
16977
- return error instanceof DatabaseOperationError && error.details.operation === "update" && error.details.entity === "edge" && error.details.reason === "no_row_returned";
16978
- }
16979
- async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, assertedWindowState, write) {
16980
- try {
16981
- return await write();
16982
- } catch (error) {
16983
- if (!isEdgeUpdateNoRowError(error)) throw error;
16984
- const current = await target.getEdge(ctx.graphId, id);
16985
- if (current !== void 0) {
16986
- assertEdgeIdentityMatches(
16987
- id,
16988
- expected,
16989
- edgeIdentityFromRow(current),
16990
- "update"
16991
- );
16992
- if (assertedWindowState && current.deleted_at === void 0) {
16993
- throw new EdgeUpdateTargetMoved(expected.kind, id);
16994
- }
16995
- }
16996
- throw new EdgeNotFoundError(expected.kind, id);
16997
- }
16998
- }
16999
- var EdgeUpdateTargetMoved = class extends Error {
17000
- constructor(kind, id) {
17001
- super(
17002
- `The ${kind} edge "${id}" was replaced between this update's read and its write; re-resolving it. This is internal and is never returned to a caller.`
17003
- );
17004
- this.name = "EdgeUpdateTargetMoved";
17005
- }
17006
- };
17007
17248
  var EDGE_UPDATE_ATTEMPTS = 2;
17008
- async function performEdgeUpdateConverging(ctx, input, target, options) {
17249
+ async function performEdgeUpdateConverging(ctx, input, session, target, options) {
17009
17250
  for (let attempt = 1; attempt <= EDGE_UPDATE_ATTEMPTS; attempt += 1) {
17010
17251
  try {
17011
- return await performEdgeUpdate(ctx, input, target, options);
17252
+ return await performEdgeUpdate(ctx, input, session, target, options);
17012
17253
  } catch (error) {
17013
17254
  if (!(error instanceof EdgeUpdateTargetMoved)) throw error;
17014
17255
  if (attempt === EDGE_UPDATE_ATTEMPTS) {
@@ -17035,29 +17276,38 @@ async function executeEdgeUpdate(ctx, input, backend) {
17035
17276
  "update"
17036
17277
  );
17037
17278
  const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
17038
- return runHookedWriteOperation(
17279
+ if (input.clearValidTo === true) {
17280
+ assertClearValidToSupported(backend, "edge");
17281
+ }
17282
+ return runHookedWritePlan(
17039
17283
  ctx,
17040
17284
  opContext,
17285
+ // An in-place props update on a live edge re-derives no constraint verdict.
17286
+ // Clearing an `oneActive` edge's end DOES: it re-admits the row to the
17287
+ // counted active population.
17288
+ edgeWritePlan(
17289
+ input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? edgeWriteNeedsConstraintFence("oneActive") : void 0
17290
+ ),
17041
17291
  backend,
17042
- (target) => {
17043
- if (input.clearValidTo === true) {
17044
- assertClearValidToSupported(backend, "edge");
17045
- }
17046
- return performEdgeUpdateConverging(ctx, input, target);
17047
- },
17048
- {
17049
- fencesConstraintProbe: input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? edgeWriteNeedsConstraintFence("oneActive") : void 0
17050
- }
17292
+ (session, target) => performEdgeUpdateConverging(ctx, input, session, target)
17051
17293
  );
17052
17294
  }
17053
17295
  async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
17054
17296
  if (input.clearValidTo === true) {
17055
17297
  assertClearValidToSupported(backend, "edge");
17056
17298
  }
17057
- return runInWriteTransaction(
17299
+ return runWritePlan(
17058
17300
  ctx,
17301
+ // An in-place props update re-derives no constraint verdict: endpoints
17302
+ // are immutable, so cardinality cannot change under it. A coalescing upsert
17303
+ // converges on a match key no database key backs; a resurrect or a cleared
17304
+ // end re-admits the row to the counted population its cardinality
17305
+ // constrains.
17306
+ edgeWritePlan(
17307
+ options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? edgeWriteNeedsConstraintFence(edgeCardinality(ctx, input.identity.kind)) : void 0
17308
+ ),
17059
17309
  backend,
17060
- async (target) => {
17310
+ async (session, target) => {
17061
17311
  if (options?.coalesceUnchanged === true && !options.clearDeleted) {
17062
17312
  const existing = options.coalesceCandidate ?? await target.getEdge(ctx.graphId, input.id);
17063
17313
  if (existing !== void 0 && existing.deleted_at === void 0) {
@@ -17082,17 +17332,13 @@ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options)
17082
17332
  const edge = await performEdgeUpdateConverging(
17083
17333
  ctx,
17084
17334
  input,
17335
+ session,
17085
17336
  target,
17086
17337
  options
17087
17338
  );
17088
17339
  return { edge, wrote: true };
17089
17340
  },
17090
17341
  {
17091
- // An in-place props update re-derives no constraint verdict: endpoints
17092
- // are immutable, so cardinality cannot change under it.
17093
- fencesConstraintProbe: options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? edgeWriteNeedsConstraintFence(
17094
- edgeCardinality(ctx, input.identity.kind)
17095
- ) : void 0,
17096
17342
  didWrite: (outcome) => outcome.wrote
17097
17343
  }
17098
17344
  );
@@ -17117,19 +17363,23 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
17117
17363
  );
17118
17364
  if (gate.deleted_at) return;
17119
17365
  const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
17120
- return runHookedWriteOperation(ctx, opContext, backend, async (target) => {
17121
- await target.deleteEdge({
17122
- graphId: ctx.graphId,
17123
- id,
17124
- kind: expectedKind
17125
- });
17126
- });
17366
+ return runHookedWritePlan(
17367
+ ctx,
17368
+ opContext,
17369
+ // A soft delete decides nothing a concurrent write could invalidate.
17370
+ edgeWritePlan(void 0),
17371
+ backend,
17372
+ async (session) => {
17373
+ await session.retireEdge({ id, kind: expectedKind });
17374
+ }
17375
+ );
17127
17376
  }
17128
17377
  async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
17129
- await runInWriteTransaction(
17378
+ await runWritePlan(
17130
17379
  ctx,
17380
+ edgeWritePlan(void 0),
17131
17381
  backend,
17132
- async (target) => {
17382
+ async (session, target) => {
17133
17383
  let affectedCount = 0;
17134
17384
  for (const id of ids) {
17135
17385
  const current = await target.getEdge(ctx.graphId, id);
@@ -17141,11 +17391,7 @@ async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
17141
17391
  "delete"
17142
17392
  );
17143
17393
  if (current.deleted_at) continue;
17144
- await target.deleteEdge({
17145
- graphId: ctx.graphId,
17146
- id,
17147
- kind: expectedKind
17148
- });
17394
+ await session.retireEdge({ id, kind: expectedKind });
17149
17395
  affectedCount += 1;
17150
17396
  }
17151
17397
  return affectedCount;
@@ -17163,13 +17409,24 @@ async function executeEdgeHardDelete(ctx, expectedKind, id, backend) {
17163
17409
  "hardDelete"
17164
17410
  );
17165
17411
  const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
17166
- return runHookedWriteOperation(ctx, opContext, backend, async (target) => {
17167
- await target.hardDeleteEdge({
17168
- graphId: ctx.graphId,
17169
- id,
17170
- kind: expectedKind
17171
- });
17172
- });
17412
+ return runHookedWritePlan(
17413
+ ctx,
17414
+ opContext,
17415
+ edgeWritePlan(void 0),
17416
+ backend,
17417
+ async (session) => {
17418
+ await session.purgeEdge({
17419
+ id,
17420
+ kind: expectedKind,
17421
+ // Housekeeping, not a fence: this edge's claim is already takeable — its
17422
+ // liveness predicate reads a row that no longer exists — so dropping the
17423
+ // row only keeps the relation from growing by one row per hard-deleted
17424
+ // constrained edge. An unconstrained kind holds no claim and pays no
17425
+ // statement for one, the same rule its create follows.
17426
+ holdsCardinalityClaim: edgeCardinality(ctx, expectedKind) !== "many"
17427
+ });
17428
+ }
17429
+ );
17173
17430
  }
17174
17431
  var UNDEFINED_SENTINEL = "";
17175
17432
  function validateMatchOnFields(schema, matchOn, edgeKind) {
@@ -17638,10 +17895,15 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17638
17895
  }
17639
17896
  }
17640
17897
  function runBatch() {
17641
- return runInWriteTransaction(
17898
+ return runWritePlan(
17642
17899
  ctx,
17900
+ // A bulk getOrCreate always converges on a match key no database key
17901
+ // backs, whatever its cardinality — the same reason the single-item path
17902
+ // fences unconditionally.
17903
+ edgeWritePlan("edgeMatchKeyConvergence"),
17643
17904
  backend,
17644
- async (target) => {
17905
+ async (session, target) => {
17906
+ const rawTarget = unfencedTarget(target);
17645
17907
  const { toCreate, toFetch, duplicateOf } = partitionEntries(
17646
17908
  await fetchRowsByEndpoint(target)
17647
17909
  );
@@ -17652,7 +17914,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17652
17914
  const createdEdges = await executeEdgeCreateBatch(
17653
17915
  ctx,
17654
17916
  createInputs,
17655
- target
17917
+ rawTarget
17656
17918
  );
17657
17919
  for (const [batchIndex, entry2] of toCreate.entries()) {
17658
17920
  results[entry2.index] = {
@@ -17687,7 +17949,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17687
17949
  onImmutableLowerBound: entry2.onImmutableLowerBound
17688
17950
  }
17689
17951
  },
17690
- target,
17952
+ rawTarget,
17691
17953
  { clearDeleted: true }
17692
17954
  );
17693
17955
  results[entry2.index] = { edge, action: "resurrected" };
@@ -17716,7 +17978,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17716
17978
  onImmutableLowerBound: entry2.onImmutableLowerBound
17717
17979
  }
17718
17980
  },
17719
- target,
17981
+ rawTarget,
17720
17982
  {
17721
17983
  coalesceUnchanged: ctx.coalesceUnchangedUpsertsEnabled,
17722
17984
  coalesceCandidate: entry2.row
@@ -17748,13 +18010,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17748
18010
  }
17749
18011
  return { results, writes };
17750
18012
  },
17751
- // A bulk getOrCreate always converges on a match key no database key
17752
- // backs, whatever its cardinality — the same reason the single-item path
17753
- // fences unconditionally.
17754
- {
17755
- fencesConstraintProbe: "edgeMatchKeyConvergence",
17756
- didWrite: (outcome) => outcome.writes > 0
17757
- }
18013
+ { didWrite: (outcome) => outcome.writes > 0 }
17758
18014
  );
17759
18015
  }
17760
18016
  async function runBatchResults() {
@@ -18418,6 +18674,32 @@ var StoreImplementation = class _StoreImplementation {
18418
18674
  */
18419
18675
  #baseBackend;
18420
18676
  #backend;
18677
+ /**
18678
+ * The `claims` bundle's memoized, at-most-once verdict thunk (ruling B7
18679
+ * refinement 2), minted from `#backend` — the same object every claimed
18680
+ * write actually executes through — once, here, and threaded into every
18681
+ * node/edge operation context this Store builds. Never resolved eagerly:
18682
+ * only the thunk's own first call may reach the bidirectional cross-check's
18683
+ * throw.
18684
+ */
18685
+ #claimsVerdict;
18686
+ /**
18687
+ * Resolved EAGERLY, once, immediately after `#claimsVerdict` — unlike
18688
+ * `claims`, no pilot bundle below has a `crossCheck`, so `resolveBundle`
18689
+ * cannot throw on construction and the thunk's lazy-resolution rationale
18690
+ * does not apply (ruling B8 spec item 2). `batchPointRead` and
18691
+ * `uniqueSidecarBatch` resolve against `#backend`, the object every graph
18692
+ * write and read actually executes through.
18693
+ */
18694
+ #batchPointRead;
18695
+ #uniqueSidecarBatch;
18696
+ /**
18697
+ * The contribution-health methods and `ensureRevisionOrigin` read
18698
+ * `#baseBackend`, not `#backend` (recorded capture never wraps them), so
18699
+ * their verdicts are resolved against `#baseBackend` too.
18700
+ */
18701
+ #contributionHealth;
18702
+ #recordedRevisionOrigins;
18421
18703
  #adapterBackend;
18422
18704
  #captureEnabled;
18423
18705
  #revisionTrackingEnabled;
@@ -18440,24 +18722,35 @@ var StoreImplementation = class _StoreImplementation {
18440
18722
  #search;
18441
18723
  constructor(graph, backend, options, schemaMetadata, adapterBackend) {
18442
18724
  this.#graph = graph;
18443
- if (graph.identity !== void 0 && (!backend.capabilities.transactions || backend.executeStatement === void 0)) {
18725
+ const statementExecution = statementExecutionVerdict(backend);
18726
+ if (graph.identity !== void 0 && (!backend.capabilities.transactions || !statementExecution.supported)) {
18444
18727
  throw new ConfigurationError(
18445
18728
  "Operational Identity requires an atomic transactional backend with statement execution support.",
18446
18729
  {
18447
18730
  code: "IDENTITY_REQUIRES_ATOMIC_BACKEND",
18448
18731
  transactions: backend.capabilities.transactions,
18449
- statementExecution: backend.executeStatement !== void 0
18732
+ statementExecution: statementExecution.supported
18450
18733
  },
18451
18734
  {
18452
18735
  suggestion: "Use a transactional SQLite or PostgreSQL driver; Cloudflare D1 and neon-http cannot host identity closure maintenance."
18453
18736
  }
18454
18737
  );
18455
18738
  }
18739
+ if (graph.identity !== void 0 && resolveWriteFencePlan(backend).kind === "unfenced") {
18740
+ refuseUnfencedOperationalIdentity(backend.dialect);
18741
+ }
18456
18742
  this.#baseBackend = asRawBackend(backend);
18457
18743
  this.#adapterBackend = adapterBackend;
18458
18744
  this.#captureEnabled = options?.history === true;
18459
18745
  this.#revisionTrackingEnabled = this.#captureEnabled || options?.revisionTracking === true;
18460
18746
  if (this.#revisionTrackingEnabled) {
18747
+ const ownership = resolveRecordedTimeOwnership(backend.capabilities);
18748
+ if (ownership === "engine-native") {
18749
+ refuseEngineNativeRecordedTimeNotYetImplemented();
18750
+ }
18751
+ if (resolveWriteFencePlan(backend).kind === "unfenced") {
18752
+ refuseUnfencedClockAllocation(backend.dialect);
18753
+ }
18461
18754
  assertRevisionTrackableBackend(backend);
18462
18755
  }
18463
18756
  const explicitSchema = options?.schema === void 0 ? void 0 : requireSqlSchema(options.schema, "store schema");
@@ -18477,6 +18770,13 @@ var StoreImplementation = class _StoreImplementation {
18477
18770
  );
18478
18771
  this.#recordedReadBinding = this.#captureEnabled ? createRecordedReadBinding(readSchema) : externalRecordedRead;
18479
18772
  this.#backend = this.#captureEnabled ? asGraphWriteBackend(createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
18773
+ this.#claimsVerdict = createClaimsVerdictThunk(this.#backend);
18774
+ this.#batchPointRead = batchPointReadVerdict(this.#backend);
18775
+ this.#uniqueSidecarBatch = uniqueSidecarBatchVerdict(this.#backend);
18776
+ this.#contributionHealth = contributionHealthVerdict(this.#baseBackend);
18777
+ this.#recordedRevisionOrigins = recordedRevisionOriginsVerdict(
18778
+ this.#baseBackend
18779
+ );
18480
18780
  this.#schema = resolvedSchema;
18481
18781
  const rowMapperConfig = rowMapperConfigFor(this.#backend);
18482
18782
  this.#recordedReads = createRecordedReadService({
@@ -18493,6 +18793,7 @@ var StoreImplementation = class _StoreImplementation {
18493
18793
  this.#schemaMetadata = schemaMetadata ?? UNKNOWN_SCHEMA_METADATA;
18494
18794
  this[STORE_RUNTIME] = {
18495
18795
  backend: this.#backend,
18796
+ uniqueSidecarBatch: this.#uniqueSidecarBatch,
18496
18797
  // The query path's own construction, not a second spelling of it: a
18497
18798
  // caller that could only rebuild this object could not observe the one
18498
18799
  // the queries actually run on.
@@ -18543,8 +18844,16 @@ var StoreImplementation = class _StoreImplementation {
18543
18844
  if (upserts.every((upsert) => upsert.constraints.length === 0) && releases.length === 0) {
18544
18845
  return apply();
18545
18846
  }
18546
- return applyResolvedNodeUniqueness(
18547
- createUniquenessContext(this.graphId, this.#registry, target),
18847
+ const lock = await lockRecordedGraphWrite(target, this.graphId);
18848
+ return applyResolvedNodeClaims(
18849
+ {
18850
+ graphId: this.graphId,
18851
+ registry: this.#registry,
18852
+ lock,
18853
+ claimsVerdict: this.#claimsVerdict,
18854
+ uniqueSidecarBatch: this.#uniqueSidecarBatch
18855
+ },
18856
+ target,
18548
18857
  upserts,
18549
18858
  releases,
18550
18859
  apply
@@ -18716,6 +19025,7 @@ var StoreImplementation = class _StoreImplementation {
18716
19025
  }
18717
19026
  const scope = createRecordedTransactionScope(
18718
19027
  target,
19028
+ this.#batchPointRead,
18719
19029
  this.#sqlSchema(),
18720
19030
  target.dialect === "sqlite"
18721
19031
  );
@@ -18791,7 +19101,11 @@ var StoreImplementation = class _StoreImplementation {
18791
19101
  );
18792
19102
  }
18793
19103
  return importIdentityAssertionsIntoTarget(
18794
- this.#identityContext(target),
19104
+ // The slice the coordinator reads — graph, registry, schema, folding
19105
+ // mode — none of which depend on the target. The target it writes
19106
+ // through is the parameter beside it, which is why this method can take
19107
+ // the narrow statement projection an import frame is able to offer.
19108
+ this.#identityContext(this.#baseBackend),
18795
19109
  target,
18796
19110
  assertions,
18797
19111
  mode
@@ -18915,6 +19229,7 @@ var StoreImplementation = class _StoreImplementation {
18915
19229
  this.graphId,
18916
19230
  this.#registry,
18917
19231
  this.#backend,
19232
+ this.#batchPointRead,
18918
19233
  this.#nodeOperations
18919
19234
  );
18920
19235
  }
@@ -18943,6 +19258,7 @@ var StoreImplementation = class _StoreImplementation {
18943
19258
  this.graphId,
18944
19259
  this.#registry,
18945
19260
  this.#backend,
19261
+ this.#batchPointRead,
18946
19262
  this.#edgeOperations
18947
19263
  );
18948
19264
  }
@@ -19492,7 +19808,12 @@ var StoreImplementation = class _StoreImplementation {
19492
19808
  { code: "REVISION_ORIGIN_REQUIRES_TRACKING" }
19493
19809
  );
19494
19810
  }
19495
- const pendingOrigin = this.#revisionOrigin ?? ensureRevisionOrigin(this.#baseBackend, this.#sqlSchema(), this.graphId);
19811
+ const pendingOrigin = this.#revisionOrigin ?? ensureRevisionOrigin(
19812
+ this.#baseBackend,
19813
+ this.#recordedRevisionOrigins,
19814
+ this.#sqlSchema(),
19815
+ this.graphId
19816
+ );
19496
19817
  this.#revisionOrigin = pendingOrigin;
19497
19818
  try {
19498
19819
  return await pendingOrigin;
@@ -19574,7 +19895,8 @@ var StoreImplementation = class _StoreImplementation {
19574
19895
  graphId: this.graphId,
19575
19896
  backend: this.#backend,
19576
19897
  registry: this.#registry,
19577
- createQuery: () => this.query()
19898
+ createQuery: () => this.query(),
19899
+ batchPointRead: this.#batchPointRead
19578
19900
  });
19579
19901
  }
19580
19902
  return this.#search;
@@ -20064,7 +20386,11 @@ var StoreImplementation = class _StoreImplementation {
20064
20386
  txBackend
20065
20387
  );
20066
20388
  }
20067
- const scope = this.#captureEnabled ? createRecordedTransactionScope(txBackend, this.#sqlSchema()) : {
20389
+ const scope = this.#captureEnabled ? createRecordedTransactionScope(
20390
+ txBackend,
20391
+ this.#batchPointRead,
20392
+ this.#sqlSchema()
20393
+ ) : {
20068
20394
  backend: txBackend,
20069
20395
  flush: () => Promise.resolve(EMPTY_RECORDED_FLUSH_INSTANTS)
20070
20396
  };
@@ -20158,6 +20484,7 @@ var StoreImplementation = class _StoreImplementation {
20158
20484
  this.graphId,
20159
20485
  this.#registry,
20160
20486
  txBackend,
20487
+ this.#batchPointRead,
20161
20488
  txNodeOperations
20162
20489
  );
20163
20490
  let edges = createEdgeCollectionsProxy(
@@ -20165,6 +20492,7 @@ var StoreImplementation = class _StoreImplementation {
20165
20492
  this.graphId,
20166
20493
  this.#registry,
20167
20494
  txBackend,
20495
+ this.#batchPointRead,
20168
20496
  txEdgeOperations
20169
20497
  );
20170
20498
  if (receiptRecorder !== void 0) {
@@ -20254,9 +20582,14 @@ var StoreImplementation = class _StoreImplementation {
20254
20582
  }
20255
20583
  return;
20256
20584
  }
20257
- const rows = backend.getNodes === void 0 ? await Promise.all(
20585
+ const boundGetNodes = bindExtraIfReachable(
20586
+ backend,
20587
+ this.#batchPointRead.extras.getNodes,
20588
+ BATCH_POINT_READ.id
20589
+ );
20590
+ const rows = boundGetNodes === void 0 ? await Promise.all(
20258
20591
  ids.map((id) => backend.getNode(this.graphId, kind, id))
20259
- ) : await backend.getNodes(this.graphId, kind, ids);
20592
+ ) : await boundGetNodes.getNodes(this.graphId, kind, ids);
20260
20593
  const includeTombstoned = coordinate?.valid.mode === "includeTombstones";
20261
20594
  for (const row of rows) {
20262
20595
  if (row === void 0) continue;
@@ -20808,20 +21141,64 @@ var StoreImplementation = class _StoreImplementation {
20808
21141
  */
20809
21142
  async verifyContributions() {
20810
21143
  const backend = this.#baseBackend;
20811
- const verify = backend.verifyContributions;
20812
- if (verify === void 0) {
20813
- throw new ConfigurationError(
20814
- "verifyContributions requires a backend that can probe its catalog for contribution tables.",
20815
- {
20816
- backend: backend.dialect,
20817
- capability: "contributions",
20818
- operation: "verify"
20819
- }
20820
- );
20821
- }
21144
+ requireExtras(
21145
+ CONTRIBUTION_HEALTH,
21146
+ this.#contributionHealth,
21147
+ "contribution verify",
21148
+ () => {
21149
+ throw new ConfigurationError(
21150
+ "verifyContributions requires a backend that can probe its catalog for contribution tables.",
21151
+ {
21152
+ backend: backend.dialect,
21153
+ capability: "contributions",
21154
+ operation: "verify"
21155
+ }
21156
+ );
21157
+ }
21158
+ );
21159
+ const { verifyContributions: verify } = bindExtra(
21160
+ backend,
21161
+ this.#contributionHealth.extras.verifyContributions,
21162
+ CONTRIBUTION_HEALTH.id
21163
+ );
20822
21164
  const vectorSlots = backend.capabilities.vector?.supported === true ? resolveGraphVectorSlots(this.#graph) : [];
20823
21165
  return verify(this.graphId, vectorSlots);
20824
21166
  }
21167
+ /**
21168
+ * Read-only diagnostic: every claim axis this graph's data ALREADY contends
21169
+ * for — a scoped unique key two live nodes hold, an id live under both kinds
21170
+ * of a `disjointWith` pair, or a declared edge cardinality two live edges
21171
+ * exceed.
21172
+ *
21173
+ * The claim relations refuse a second claimant from the first write after
21174
+ * upgrade onward, but they repair nothing that predates them: a database that
21175
+ * carried a violation keeps carrying it until a write touches that axis, and
21176
+ * is then refused with the ordinary typed error naming the incumbent. This is
21177
+ * how an operator sees that state before a user does.
21178
+ *
21179
+ * Reports; never repairs. Which of two live claimants keeps the axis is a
21180
+ * data-loss decision that belongs to the operator.
21181
+ *
21182
+ * Declarations are resolved from the active persisted schema, not this
21183
+ * Store's construction-time graph snapshot. A Store left stale by another
21184
+ * instance's `evolve()` therefore audits the constraints that currently
21185
+ * govern the database instead of returning a false clean report.
21186
+ *
21187
+ * @throws {ConfigurationError} `CONSTRAINT_FENCE_AUDIT_UNSUPPORTED` when the
21188
+ * backend cannot run the audit — an empty report from a backend that never
21189
+ * looked is indistinguishable from a clean database.
21190
+ */
21191
+ async verifyConstraintFences() {
21192
+ const activeRow = await this.#baseBackend.getActiveSchema(this.graphId);
21193
+ const graph = activeRow === void 0 ? this.#graph : this.#catchUpToStored(parseSerializedSchema(activeRow.schema_doc));
21194
+ const registry = graph === this.#graph ? this.#registry : buildKindRegistry(graph);
21195
+ return verifyConstraintFences({
21196
+ graph,
21197
+ registry,
21198
+ graphId: this.graphId,
21199
+ backend: this.#baseBackend
21200
+ });
21201
+ }
20825
21202
  /**
20826
21203
  * Non-destructively repairs contribution states whose physical storage can
20827
21204
  * be preserved: `missing-marker` and `failed-materialization`.
@@ -20840,17 +21217,26 @@ var StoreImplementation = class _StoreImplementation {
20840
21217
  */
20841
21218
  async repairContributions() {
20842
21219
  const backend = this.#baseBackend;
20843
- const repair = backend.repairContributions;
20844
- if (repair === void 0) {
20845
- throw new ConfigurationError(
20846
- "repairContributions requires a backend that can probe and repair strategy-owned contribution tables.",
20847
- {
20848
- backend: backend.dialect,
20849
- capability: "contributions",
20850
- operation: "repair"
20851
- }
20852
- );
20853
- }
21220
+ requireExtras(
21221
+ CONTRIBUTION_HEALTH,
21222
+ this.#contributionHealth,
21223
+ "contribution repair",
21224
+ () => {
21225
+ throw new ConfigurationError(
21226
+ "repairContributions requires a backend that can probe and repair strategy-owned contribution tables.",
21227
+ {
21228
+ backend: backend.dialect,
21229
+ capability: "contributions",
21230
+ operation: "repair"
21231
+ }
21232
+ );
21233
+ }
21234
+ );
21235
+ const { repairContributions: repair } = bindExtra(
21236
+ backend,
21237
+ this.#contributionHealth.extras.repairContributions,
21238
+ CONTRIBUTION_HEALTH.id
21239
+ );
20854
21240
  const { baseline } = await this.#loadCaughtUp("repair");
20855
21241
  const vectorSlots = backend.capabilities.vector?.supported === true ? resolveGraphVectorSlots(baseline) : [];
20856
21242
  return repair(this.graphId, vectorSlots);
@@ -20890,8 +21276,8 @@ var StoreImplementation = class _StoreImplementation {
20890
21276
  */
20891
21277
  async probeContributions() {
20892
21278
  const backend = this.#baseBackend;
20893
- const probe = backend.probeContributions;
20894
- if (probe === void 0) {
21279
+ const probeVerdict = this.#contributionHealth.extras.probeContributions;
21280
+ if (!probeVerdict.present) {
20895
21281
  if (backend.capabilities.contributions?.supported !== true) {
20896
21282
  return { entries: [] };
20897
21283
  }
@@ -20904,6 +21290,11 @@ var StoreImplementation = class _StoreImplementation {
20904
21290
  }
20905
21291
  );
20906
21292
  }
21293
+ const { probeContributions: probe } = bindExtra(
21294
+ backend,
21295
+ probeVerdict,
21296
+ CONTRIBUTION_HEALTH.id
21297
+ );
20907
21298
  const vectorSlots = backend.capabilities.vector?.supported === true ? resolveGraphVectorSlots(this.#graph) : [];
20908
21299
  const entries = await probe(this.graphId, vectorSlots);
20909
21300
  const revision = await this.revisionNow();
@@ -20985,17 +21376,26 @@ var StoreImplementation = class _StoreImplementation {
20985
21376
  */
20986
21377
  async rebuildContribution(scope, options) {
20987
21378
  const backend = this.#baseBackend;
20988
- const rebuild = backend.rebuildContribution;
20989
- if (rebuild === void 0) {
20990
- throw new ConfigurationError(
20991
- "rebuildContribution requires a backend that can drop, recreate, and re-stamp strategy-owned contribution tables.",
20992
- {
20993
- backend: backend.dialect,
20994
- capability: "contributions",
20995
- operation: "rebuild"
20996
- }
20997
- );
20998
- }
21379
+ requireExtras(
21380
+ CONTRIBUTION_HEALTH,
21381
+ this.#contributionHealth,
21382
+ "contribution rebuild",
21383
+ () => {
21384
+ throw new ConfigurationError(
21385
+ "rebuildContribution requires a backend that can drop, recreate, and re-stamp strategy-owned contribution tables.",
21386
+ {
21387
+ backend: backend.dialect,
21388
+ capability: "contributions",
21389
+ operation: "rebuild"
21390
+ }
21391
+ );
21392
+ }
21393
+ );
21394
+ const { rebuildContribution: rebuild } = bindExtra(
21395
+ backend,
21396
+ this.#contributionHealth.extras.rebuildContribution,
21397
+ CONTRIBUTION_HEALTH.id
21398
+ );
20999
21399
  await this.#loadCaughtUp("rebuild");
21000
21400
  const registry = this.#registry;
21001
21401
  const graphId = this.graphId;
@@ -21316,6 +21716,9 @@ var StoreImplementation = class _StoreImplementation {
21316
21716
  coalesceUnchangedUpsertsEnabled: this.#coalescesUnchangedUpserts(),
21317
21717
  revisionSchema: this.#sqlSchema(),
21318
21718
  registry: this.#registry,
21719
+ claimsVerdict: this.#claimsVerdict,
21720
+ batchPointRead: this.#batchPointRead,
21721
+ uniqueSidecarBatch: this.#uniqueSidecarBatch,
21319
21722
  ...identityConfig === void 0 ? {} : {
21320
21723
  identity: {
21321
21724
  lock: (target) => lockIdentityGraph(target, this.graphId),
@@ -21371,6 +21774,9 @@ var StoreImplementation = class _StoreImplementation {
21371
21774
  coalesceUnchangedUpsertsEnabled: this.#coalescesUnchangedUpserts(),
21372
21775
  revisionSchema: this.#sqlSchema(),
21373
21776
  registry: this.#registry,
21777
+ claimsVerdict: this.#claimsVerdict,
21778
+ batchPointRead: this.#batchPointRead,
21779
+ uniqueSidecarBatch: this.#uniqueSidecarBatch,
21374
21780
  createOperationContext: (operation, entity, kind, id) => this.#createOperationContext(operation, entity, kind, id),
21375
21781
  withOperationHooks: runHooks
21376
21782
  };
@@ -21988,5 +22394,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
21988
22394
  }
21989
22395
 
21990
22396
  export { ExecutableAggregateQuery, ExecutableQuery, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, PreparedQuery, QueryBuilder, RecordedStoreView, StoreSearch, StoreView, UnionableQuery, avg, composeFragments, count, countDistinct, countDistinctEdges, countEdges, createAdapterStore, createAdapterStoreWithSchema, createFragment, createQueryBuilder, createStore, createStoreWithSchema, createVerifiedAdapterStore, createVerifiedStore, defineSubgraphProject, field, having, havingEq, havingGt, havingGte, havingLt, havingLte, limitFragment, max, min, offsetFragment, orderByFragment, sum };
21991
- //# sourceMappingURL=chunk-BRRP76WO.js.map
21992
- //# sourceMappingURL=chunk-BRRP76WO.js.map
22397
+ //# sourceMappingURL=chunk-RCBG6YMT.js.map
22398
+ //# sourceMappingURL=chunk-RCBG6YMT.js.map