@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
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkH5IJSROF_cjs = require('./chunk-H5IJSROF.cjs');
4
+
5
+ // src/query/dialect/vector/pagination.ts
6
+ function vectorPageClause(limit, offset) {
7
+ return offset === void 0 || offset === 0 ? chunkH5IJSROF_cjs.sql`LIMIT ${limit}` : chunkH5IJSROF_cjs.sql`LIMIT ${limit} OFFSET ${offset}`;
8
+ }
9
+
10
+ exports.vectorPageClause = vectorPageClause;
11
+ //# sourceMappingURL=chunk-UYKDYE5D.cjs.map
12
+ //# sourceMappingURL=chunk-UYKDYE5D.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/query/dialect/vector/pagination.ts"],"names":["sql"],"mappings":";;;;;AAcO,SAAS,gBAAA,CAAiB,OAAe,MAAA,EAA8B;AAC5E,EAAA,OAAO,MAAA,KAAW,MAAA,IAAa,MAAA,KAAW,CAAA,GACtCA,qBAAA,CAAA,MAAA,EAAY,KAAK,CAAA,CAAA,GACjBA,qBAAA,CAAA,MAAA,EAAY,KAAK,CAAA,QAAA,EAAW,MAAM,CAAA,CAAA;AACxC","file":"chunk-CICO5GXD.cjs","sourcesContent":["/**\n * Shared vector-search pagination clause.\n *\n * Every vector strategy pages its ordered relevance scan the same way: emit a\n * bare `LIMIT` for the first page (`offset` unset or `0`), and `LIMIT … OFFSET`\n * only when a non-zero offset must discard the leading rows. The three engines'\n * `buildSearch` methods each repeated this ternary verbatim; it lives here once\n * so the emitted clause can never drift between dialects.\n *\n * `limit` and `offset` ride as bound parameters (never interpolated), so the\n * clause — string and bound values alike — is identical across engines.\n */\nimport { sql, type SqlFragment } from \"../../sql-fragment\";\n\nexport function vectorPageClause(limit: number, offset?: number): SqlFragment {\n return offset === undefined || offset === 0 ?\n sql`LIMIT ${limit}`\n : sql`LIMIT ${limit} OFFSET ${offset}`;\n}\n"]}
1
+ {"version":3,"sources":["../src/query/dialect/vector/pagination.ts"],"names":["sql"],"mappings":";;;;;AAcO,SAAS,gBAAA,CAAiB,OAAe,MAAA,EAA8B;AAC5E,EAAA,OAAO,MAAA,KAAW,MAAA,IAAa,MAAA,KAAW,CAAA,GACtCA,qBAAA,CAAA,MAAA,EAAY,KAAK,CAAA,CAAA,GACjBA,qBAAA,CAAA,MAAA,EAAY,KAAK,CAAA,QAAA,EAAW,MAAM,CAAA,CAAA;AACxC","file":"chunk-UYKDYE5D.cjs","sourcesContent":["/**\n * Shared vector-search pagination clause.\n *\n * Every vector strategy pages its ordered relevance scan the same way: emit a\n * bare `LIMIT` for the first page (`offset` unset or `0`), and `LIMIT … OFFSET`\n * only when a non-zero offset must discard the leading rows. The three engines'\n * `buildSearch` methods each repeated this ternary verbatim; it lives here once\n * so the emitted clause can never drift between dialects.\n *\n * `limit` and `offset` ride as bound parameters (never interpolated), so the\n * clause — string and bound values alike — is identical across engines.\n */\nimport { sql, type SqlFragment } from \"../../sql-fragment\";\n\nexport function vectorPageClause(limit: number, offset?: number): SqlFragment {\n return offset === undefined || offset === 0 ?\n sql`LIMIT ${limit}`\n : sql`LIMIT ${limit} OFFSET ${offset}`;\n}\n"]}
@@ -1,11 +1,12 @@
1
- import { withRecordedRelationsPrecondition, projectGraphBackend, deriveBackend, groupBy, chunk } from './chunk-UGHG7PGX.js';
2
- import { createSqlSchema } from './chunk-NVY5CJFP.js';
3
- import { rowPropsToJsonText } from './chunk-6LN7FIVU.js';
4
- import { optionalRecordedInstantParts, createRecordedInstant, parseRecordedInstant, RECORDED_MAX_REVISION } from './chunk-DZAICA5J.js';
5
- import { nowIso, canonicalizeDatabaseTimestamp } from './chunk-5K2BKEBD.js';
6
- import { sql, asCompiledRowsSql, likeEscapeClause, asCompiledStatementSql, LIKE_ESCAPE_CHARACTER } from './chunk-3DMMGT6S.js';
1
+ import { withRecordedRelationsPrecondition, projectGraphBackend, deriveBackend, groupBy, chunk } from './chunk-QG5VEOKX.js';
2
+ import { statementExecutionVerdict, recordedRevisionOriginsVerdict, assertRecursiveTraversal, batchPointReadVerdict } from './chunk-XORONCV3.js';
3
+ import { resolveWriteFencePlan, requireWriteFence, recordedRevisionOriginsMembers, bindExtraIfReachable, BATCH_POINT_READ, runOptionallyInTransaction, createSqlSchema, rowPropsToJsonText } from './chunk-LKZDQ2B4.js';
4
+ import { optionalRecordedInstantParts, createRecordedInstant, parseRecordedInstant, RECORDED_MAX_REVISION } from './chunk-6NKSE5AU.js';
5
+ import { nowIso, canonicalizeDatabaseTimestamp } from './chunk-K46SDNQD.js';
6
+ import { likeEscapeClause, LIKE_ESCAPE_CHARACTER } from './chunk-4QKOZYMV.js';
7
+ import { sql, asCompiledRowsSql, asCompiledStatementSql } from './chunk-7QFRK6PU.js';
7
8
  import { resolveFieldTypeInfoAtJsonPointer } from './chunk-W6OG3HDG.js';
8
- import { ConfigurationError, UnsupportedPredicateError, CompilerInvariantError } from './chunk-ZLONH2UD.js';
9
+ import { ConfigurationError, UnsupportedPredicateError, CompilerInvariantError, ValidationError } from './chunk-YDEJQWOL.js';
9
10
  import { normalizeJsonPointer, joinJsonPointers, jsonPointer } from './chunk-FWJKWH6U.js';
10
11
  import { requireDefined, isPresent } from './chunk-DYATYRY4.js';
11
12
  import { nanoid } from 'nanoid';
@@ -780,7 +781,7 @@ function assertCapturableBackend(backend) {
780
781
  }
781
782
  );
782
783
  }
783
- if (backend.executeStatement === void 0) {
784
+ if (!statementExecutionVerdict(backend).supported) {
784
785
  throw new ConfigurationError(
785
786
  "history: true requires a backend that supports executeStatement.",
786
787
  { dialect: backend.dialect },
@@ -818,7 +819,7 @@ function assertRevisionTrackableBackend(backend) {
818
819
  }
819
820
  );
820
821
  }
821
- if (backend.executeStatement === void 0) {
822
+ if (!statementExecutionVerdict(backend).supported) {
822
823
  throw new ConfigurationError(
823
824
  "revisionTracking: true requires a backend that supports executeStatement.",
824
825
  { dialect: backend.dialect },
@@ -836,7 +837,7 @@ function assertRevisionTrackableBackend(backend) {
836
837
  }
837
838
  );
838
839
  }
839
- if (backend.ensureRevisionOriginsTable === void 0) {
840
+ if (!recordedRevisionOriginsVerdict(backend).supported) {
840
841
  throw new ConfigurationError(
841
842
  "revisionTracking: true requires a backend that can bootstrap revision origins.",
842
843
  { dialect: backend.dialect },
@@ -852,10 +853,6 @@ var RECORDED_MIN_REVISION = 0;
852
853
  var RECORDED_MIN_TIME = "1970-01-01T00:00:00.000Z";
853
854
  var RECORDED_CLOCK_ADVISORY_LOCK_NAMESPACE = "typegraph:recorded-clock";
854
855
  var RECORDED_GRAPH_WRITE_ADVISORY_LOCK_NAMESPACE = "typegraph:recorded-graph-write";
855
- var USES_RECORDED_GRAPH_ADVISORY_LOCK = {
856
- postgres: true,
857
- sqlite: false
858
- };
859
856
  function graphAdvisoryLockSql(namespace, graphId) {
860
857
  return sql`
861
858
  SELECT pg_advisory_xact_lock(
@@ -893,8 +890,16 @@ async function acquireRecordedGraphWriteLock(target, graphId) {
893
890
  );
894
891
  }
895
892
  async function lockRecordedGraphWrite(target, graphId, memo) {
896
- if (!USES_RECORDED_GRAPH_ADVISORY_LOCK[target.dialect]) {
897
- return graphWriteLockEvidence();
893
+ const plan = resolveWriteFencePlan(target);
894
+ const fence = requireWriteFence(
895
+ plan,
896
+ "recorded graph write",
897
+ "advisory-lock"
898
+ );
899
+ switch (fence.kind) {
900
+ case "engine-serialized": {
901
+ return graphWriteLockEvidence();
902
+ }
898
903
  }
899
904
  const effectiveMemo = memo ?? recordedGraphLockMemos.get(target);
900
905
  if (effectiveMemo === void 0) {
@@ -989,9 +994,8 @@ async function readRevisionOrigin(target, schema, graphId) {
989
994
  }
990
995
  return first.origin;
991
996
  }
992
- async function ensureRevisionOrigin(target, schema, graphId) {
993
- const ensureTable = target.ensureRevisionOriginsTable;
994
- if (ensureTable === void 0) {
997
+ async function ensureRevisionOrigin(target, verdict, schema, graphId) {
998
+ if (!verdict.supported) {
995
999
  throw new ConfigurationError(
996
1000
  "Revision tracking requires a backend that can bootstrap revision origins.",
997
1001
  { dialect: target.dialect },
@@ -1000,6 +1004,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
1000
1004
  }
1001
1005
  );
1002
1006
  }
1007
+ const { ensureRevisionOriginsTable: ensureTable } = recordedRevisionOriginsMembers(target, verdict);
1003
1008
  await ensureTable();
1004
1009
  const existing = await readRevisionOrigin(target, schema, graphId);
1005
1010
  if (existing !== void 0) return existing;
@@ -1042,14 +1047,20 @@ async function assertRecordedClockAdvanced(target, schema, graphId, revision) {
1042
1047
  );
1043
1048
  }
1044
1049
  async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
1045
- switch (target.dialect) {
1046
- case "postgres": {
1050
+ const plan = resolveWriteFencePlan(target);
1051
+ const fence = requireWriteFence(
1052
+ plan,
1053
+ "recorded clock allocation",
1054
+ "advisory-lock"
1055
+ );
1056
+ switch (fence.kind) {
1057
+ case "lock": {
1047
1058
  await target.execute(
1048
1059
  asCompiledRowsSql(recordedClockAdvisoryLockSql(graphId))
1049
1060
  );
1050
1061
  return;
1051
1062
  }
1052
- case "sqlite": {
1063
+ case "engine-serialized": {
1053
1064
  if (ownsWriteLock) return;
1054
1065
  await executeStatement(
1055
1066
  target,
@@ -1061,9 +1072,6 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
1061
1072
  );
1062
1073
  return;
1063
1074
  }
1064
- default: {
1065
- target.dialect;
1066
- }
1067
1075
  }
1068
1076
  }
1069
1077
  async function allocateRecordedCommit(target, schema, graphId, ownsWriteLock, previousRevision) {
@@ -1241,6 +1249,10 @@ function identityAssertionSnapshotSource(schema, graphId, coordinate, relation)
1241
1249
  `;
1242
1250
  }
1243
1251
  function historicalIdentityReconstructionCtes(input) {
1252
+ assertRecursiveTraversal(
1253
+ input.recursiveTraversal,
1254
+ "historical identity class read"
1255
+ );
1244
1256
  const nodes = identityNodeSnapshotSource(
1245
1257
  input.schema,
1246
1258
  input.graphId,
@@ -1297,6 +1309,10 @@ var IDENTITY_PEER_CLASS_COLUMNS = sql.raw(
1297
1309
  ["seed_kind", "seed_id", "kind", "id"].join(", ")
1298
1310
  );
1299
1311
  function historicalIdentityPeerClassQuery(input) {
1312
+ assertRecursiveTraversal(
1313
+ input.recursiveTraversal,
1314
+ "historical identity expansion"
1315
+ );
1300
1316
  const reconstruction = historicalIdentityReconstructionCtes({
1301
1317
  ...input,
1302
1318
  seedSource: sql`SELECT DISTINCT a_kind, a_id FROM identity_edges`
@@ -1514,6 +1530,22 @@ function compileParameterizedStringPattern(op, parameter) {
1514
1530
  }
1515
1531
  }
1516
1532
  }
1533
+ function requireRecursiveTraversalVerdict(ctx, operation) {
1534
+ const verdict = ctx.recursiveTraversal;
1535
+ if (verdict === void 0) {
1536
+ throw new CompilerInvariantError(
1537
+ "recursive traversal verdict missing from compiler context",
1538
+ { operation }
1539
+ );
1540
+ }
1541
+ return verdict;
1542
+ }
1543
+ function assertRecursiveTraversalSupported(ctx, operation) {
1544
+ assertRecursiveTraversal(
1545
+ requireRecursiveTraversalVerdict(ctx, operation),
1546
+ operation
1547
+ );
1548
+ }
1517
1549
  function compilePredicateExpression(expr, ctx) {
1518
1550
  const { dialect } = ctx;
1519
1551
  const cteColumnPrefix = ctx.cteColumnPrefix;
@@ -2032,17 +2064,27 @@ async function getRowsByIds(ids, policy) {
2032
2064
  }
2033
2065
 
2034
2066
  // src/store/edge-fetch.ts
2035
- async function getEdgeRowsByIds(backend, graphId, ids) {
2067
+ async function getEdgeRowsByIds(backend, verdict, graphId, ids) {
2068
+ const bound = bindExtraIfReachable(
2069
+ backend,
2070
+ verdict.extras.getEdges,
2071
+ BATCH_POINT_READ.id
2072
+ );
2036
2073
  return getRowsByIds(ids, {
2037
- batch: backend.getEdges === void 0 ? void 0 : (batchIds) => requireDefined(backend.getEdges)(graphId, batchIds),
2074
+ batch: bound === void 0 ? void 0 : ((batchIds) => bound.getEdges(graphId, batchIds)),
2038
2075
  one: (id) => backend.getEdge(graphId, id)
2039
2076
  });
2040
2077
  }
2041
2078
 
2042
2079
  // src/store/node-fetch.ts
2043
- async function getNodeRowsByIds(backend, graphId, kind, ids) {
2080
+ async function getNodeRowsByIds(backend, verdict, graphId, kind, ids) {
2081
+ const bound = bindExtraIfReachable(
2082
+ backend,
2083
+ verdict.extras.getNodes,
2084
+ BATCH_POINT_READ.id
2085
+ );
2044
2086
  return getRowsByIds(ids, {
2045
- batch: backend.getNodes === void 0 ? void 0 : (batchIds) => requireDefined(backend.getNodes)(graphId, kind, batchIds),
2087
+ batch: bound === void 0 ? void 0 : ((batchIds) => bound.getNodes(graphId, kind, batchIds)),
2046
2088
  one: (id) => backend.getNode(graphId, kind, id)
2047
2089
  });
2048
2090
  }
@@ -2320,7 +2362,7 @@ function recordedInsertsFor(afterById, closed) {
2320
2362
  operation: recordedOp(closed.has(row.id), closed.get(row.id) ?? false, row)
2321
2363
  }));
2322
2364
  }
2323
- async function flushNodes(target, schema, graphId, entities, recordedRevision) {
2365
+ async function flushNodes(target, batchPointRead, schema, graphId, entities, recordedRevision) {
2324
2366
  const chunkSize = recordedNodeChunkSize(target);
2325
2367
  for (const [kind, group] of groupNodesByKind(entities)) {
2326
2368
  for (const entityChunk of chunk(group, chunkSize)) {
@@ -2335,7 +2377,7 @@ async function flushNodes(target, schema, graphId, entities, recordedRevision) {
2335
2377
  );
2336
2378
  const afterById = await resolveAfterImages(
2337
2379
  entityChunk,
2338
- (missing) => getNodeRowsByIds(target, graphId, kind, missing)
2380
+ (missing) => getNodeRowsByIds(target, batchPointRead, graphId, kind, missing)
2339
2381
  );
2340
2382
  await insertRecordedNodeRows(
2341
2383
  target,
@@ -2346,7 +2388,7 @@ async function flushNodes(target, schema, graphId, entities, recordedRevision) {
2346
2388
  }
2347
2389
  }
2348
2390
  }
2349
- async function flushEdges(target, schema, graphId, entities, recordedRevision) {
2391
+ async function flushEdges(target, batchPointRead, schema, graphId, entities, recordedRevision) {
2350
2392
  const chunkSize = recordedEdgeChunkSize(target);
2351
2393
  for (const entityChunk of chunk(entities, chunkSize)) {
2352
2394
  const ids = entityChunk.map((entity) => entity.id);
@@ -2359,7 +2401,7 @@ async function flushEdges(target, schema, graphId, entities, recordedRevision) {
2359
2401
  );
2360
2402
  const afterById = await resolveAfterImages(
2361
2403
  entityChunk,
2362
- (missing) => getEdgeRowsByIds(target, graphId, missing)
2404
+ (missing) => getEdgeRowsByIds(target, batchPointRead, graphId, missing)
2363
2405
  );
2364
2406
  await insertRecordedEdgeRows(
2365
2407
  target,
@@ -2675,7 +2717,7 @@ function createRecordedCaptureSession() {
2675
2717
  if (sealed) throw recordedCaptureSealedError({ graphId });
2676
2718
  forcedGraphRevisions.add(graphId);
2677
2719
  },
2678
- async flush(target, schema, ownsWriteLock) {
2720
+ async flush(target, batchPointRead, schema, ownsWriteLock) {
2679
2721
  if (sealed) {
2680
2722
  throw new ConfigurationError(
2681
2723
  "Recorded-time capture session was already flushed.",
@@ -2712,6 +2754,7 @@ function createRecordedCaptureSession() {
2712
2754
  );
2713
2755
  await flushNodes(
2714
2756
  target,
2757
+ batchPointRead,
2715
2758
  schema,
2716
2759
  graphId,
2717
2760
  nodes,
@@ -2719,6 +2762,7 @@ function createRecordedCaptureSession() {
2719
2762
  );
2720
2763
  await flushEdges(
2721
2764
  target,
2765
+ batchPointRead,
2722
2766
  schema,
2723
2767
  graphId,
2724
2768
  edges,
@@ -2947,7 +2991,7 @@ function createRecordedTransactionBackend(target, session, schema) {
2947
2991
  recordedRevisionBindings.set(overlay, session);
2948
2992
  return overlay;
2949
2993
  }
2950
- function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
2994
+ function createRecordedTransactionScope(target, batchPointRead, schema, ownsWriteLock = false) {
2951
2995
  requireCaptureStatements(target);
2952
2996
  const session = createRecordedCaptureSession();
2953
2997
  const resolvedSchema = schema ?? requireRecordedSchema(target);
@@ -2955,17 +2999,22 @@ function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
2955
2999
  backend: createRecordedTransactionBackend(target, session, resolvedSchema),
2956
3000
  async flush() {
2957
3001
  return withRecordedRelationsPrecondition(
2958
- session.flush(target, resolvedSchema, ownsWriteLock),
3002
+ session.flush(target, batchPointRead, resolvedSchema, ownsWriteLock),
2959
3003
  { dialect: target.dialect, surface: "capture-flush" }
2960
3004
  );
2961
3005
  }
2962
3006
  };
2963
3007
  }
2964
- async function runCapturedAutocommit(backend, schema, fn, options) {
3008
+ async function runCapturedAutocommit(backend, schema, batchPointRead, fn, options) {
2965
3009
  assertRequestedRecordedIsolation(backend, options);
2966
3010
  return backend.transaction(async (target) => {
2967
3011
  await assertRecordedCaptureTransactionIsolation(target);
2968
- const scope = createRecordedTransactionScope(target, schema, true);
3012
+ const scope = createRecordedTransactionScope(
3013
+ target,
3014
+ batchPointRead,
3015
+ schema,
3016
+ true
3017
+ );
2969
3018
  const result = await fn(scope.backend);
2970
3019
  await scope.flush();
2971
3020
  return result;
@@ -2973,7 +3022,8 @@ async function runCapturedAutocommit(backend, schema, fn, options) {
2973
3022
  }
2974
3023
  function createRecordedBackend(backend, schema) {
2975
3024
  assertCapturableBackend(backend);
2976
- const capture = (fn) => runCapturedAutocommit(backend, schema, fn);
3025
+ const batchPointRead = batchPointReadVerdict(backend);
3026
+ const capture = (fn) => runCapturedAutocommit(backend, schema, batchPointRead, fn);
2977
3027
  const projectedBackend = projectGraphBackend(backend);
2978
3028
  return deriveBackend(projectedBackend, {
2979
3029
  ...rawWriteGuards(backend, "backend"),
@@ -3078,7 +3128,12 @@ function createRecordedBackend(backend, schema) {
3078
3128
  return backend.transaction(async (target) => {
3079
3129
  await assertRecordedCaptureTransactionIsolation(target, backendOptions);
3080
3130
  const readOnly = backendOptions?.accessMode === "read_only";
3081
- const scope = createRecordedTransactionScope(target, schema, !readOnly);
3131
+ const scope = createRecordedTransactionScope(
3132
+ target,
3133
+ batchPointRead,
3134
+ schema,
3135
+ !readOnly
3136
+ );
3082
3137
  const result = await fn(scope.backend);
3083
3138
  const instants = await scope.flush();
3084
3139
  observer?.(instants);
@@ -3088,33 +3143,196 @@ function createRecordedBackend(backend, schema) {
3088
3143
  });
3089
3144
  }
3090
3145
 
3091
- // src/utils/compare.ts
3092
- function compareStrings(left, right) {
3093
- if (left < right) return -1;
3094
- return left > right ? 1 : 0;
3095
- }
3096
- function compareCodePoints(left, right) {
3097
- if (left === right) return 0;
3098
- let leftIndex = 0;
3099
- let rightIndex = 0;
3100
- while (leftIndex < left.length && rightIndex < right.length) {
3101
- const leftPoint = requireDefined(left.codePointAt(leftIndex));
3102
- const rightPoint = requireDefined(right.codePointAt(rightIndex));
3103
- if (leftPoint !== rightPoint) return leftPoint < rightPoint ? -1 : 1;
3104
- leftIndex += leftPoint > 65535 ? 2 : 1;
3105
- rightIndex += rightPoint > 65535 ? 2 : 1;
3106
- }
3107
- const leftExhausted = leftIndex >= left.length;
3108
- const rightExhausted = rightIndex >= right.length;
3109
- if (leftExhausted && rightExhausted) return 0;
3110
- return leftExhausted ? -1 : 1;
3146
+ // src/errors/validation.ts
3147
+ function zodIssuesToValidationIssues(error) {
3148
+ return error.issues.map((issue) => ({
3149
+ path: issue.path.join("."),
3150
+ message: issue.message,
3151
+ code: issue.code
3152
+ }));
3153
+ }
3154
+ function buildLocationString(context) {
3155
+ if (context.id) {
3156
+ return `${context.kind}/${context.id}`;
3157
+ }
3158
+ return `new ${context.kind}`;
3159
+ }
3160
+ function validateProps(schema, props, context) {
3161
+ const result = schema.safeParse(props);
3162
+ if (result.success) {
3163
+ return result.data;
3164
+ }
3165
+ const issues = zodIssuesToValidationIssues(result.error);
3166
+ const location = buildLocationString(context);
3167
+ throw new ValidationError(
3168
+ `Invalid ${context.entityType} props for ${location}: ${result.error.message}`,
3169
+ {
3170
+ entityType: context.entityType,
3171
+ kind: context.kind,
3172
+ operation: context.operation,
3173
+ ...context.id !== void 0 && { id: context.id },
3174
+ issues
3175
+ },
3176
+ { cause: result.error }
3177
+ );
3178
+ }
3179
+ function validateNodeProps(schema, props, context) {
3180
+ return validateProps(schema, props, {
3181
+ entityType: "node",
3182
+ ...context
3183
+ });
3184
+ }
3185
+ function validateEdgeProps(schema, props, context) {
3186
+ return validateProps(schema, props, {
3187
+ entityType: "edge",
3188
+ ...context
3189
+ });
3190
+ }
3191
+ function wrapZodError(error, context) {
3192
+ const issues = zodIssuesToValidationIssues(error);
3193
+ const location = buildLocationString(context);
3194
+ return new ValidationError(
3195
+ `Validation failed for ${context.entityType} ${location}: ${error.message}`,
3196
+ {
3197
+ entityType: context.entityType,
3198
+ kind: context.kind,
3199
+ operation: context.operation,
3200
+ ...context.id !== void 0 && { id: context.id },
3201
+ issues
3202
+ },
3203
+ { cause: error }
3204
+ );
3205
+ }
3206
+ function createValidationError(message, issues, context) {
3207
+ return new ValidationError(message, {
3208
+ ...context?.entityType !== void 0 && {
3209
+ entityType: context.entityType
3210
+ },
3211
+ ...context?.kind !== void 0 && { kind: context.kind },
3212
+ ...context?.operation !== void 0 && { operation: context.operation },
3213
+ ...context?.id !== void 0 && { id: context.id },
3214
+ issues
3215
+ });
3111
3216
  }
3112
3217
 
3113
- // src/utils/tuple-key.ts
3114
- function encodeTupleKey(values) {
3115
- return JSON.stringify(values);
3218
+ // src/store/operations/write-transaction.ts
3219
+ var writeTransactionSessions = /* @__PURE__ */ new WeakMap();
3220
+ function forceWriteTransactionRevision(target) {
3221
+ const session = writeTransactionSessions.get(target);
3222
+ if (session === void 0) return false;
3223
+ session.wrote = true;
3224
+ return true;
3225
+ }
3226
+ var heldGraphWriteLocks = /* @__PURE__ */ new WeakMap();
3227
+ async function withWriteTransactionSession(target, ctx, fn) {
3228
+ const session = {
3229
+ lock: void 0,
3230
+ wrote: false
3231
+ };
3232
+ writeTransactionSessions.set(target, session);
3233
+ try {
3234
+ const result = await fn();
3235
+ if (session.wrote && ctx.revisionTrackingEnabled && !ctx.historyEnabled) {
3236
+ await advanceRevisionClock(target, ctx.revisionSchema, ctx.graphId, true);
3237
+ }
3238
+ return result;
3239
+ } finally {
3240
+ writeTransactionSessions.delete(target);
3241
+ }
3242
+ }
3243
+ async function lockSchemaVersionForStoreWrite(ctx, backend) {
3244
+ const expectedVersion = ctx.schemaVersion;
3245
+ if (expectedVersion === void 0) return;
3246
+ if ("transaction" in backend && !backend.capabilities.transactions) {
3247
+ throw new ConfigurationError(
3248
+ "Schema-managed Store writes require a transactional backend so schema changes and entity writes can share one fence.",
3249
+ {
3250
+ code: "SCHEMA_WRITE_FENCE_UNSUPPORTED",
3251
+ graphId: ctx.graphId
3252
+ }
3253
+ );
3254
+ }
3255
+ const lockSchemaVersionForWrite = backend.lockSchemaVersionForWrite;
3256
+ if (lockSchemaVersionForWrite === void 0) {
3257
+ throw new ConfigurationError(
3258
+ "This backend cannot fence schema-managed Store writes against a concurrent schema change.",
3259
+ {
3260
+ code: "SCHEMA_WRITE_FENCE_UNSUPPORTED",
3261
+ graphId: ctx.graphId
3262
+ }
3263
+ );
3264
+ }
3265
+ await lockSchemaVersionForWrite({
3266
+ graphId: ctx.graphId,
3267
+ expectedVersion
3268
+ });
3269
+ }
3270
+ var CONSTRAINT_FENCE_ADVICE = {
3271
+ edgeCardinality: 'declare the edge `cardinality: "many"` and enforce the limit in application code',
3272
+ edgeMatchKeyConvergence: "use `create` with a caller-chosen id, whose uniqueness the edges primary key enforces, instead of `getOrCreateByEndpoints`",
3273
+ nodeDisjointness: "drop the `disjointWith` axiom and keep ids distinct across those kinds yourself",
3274
+ nodeUniquenessClaim: "drop the unique constraint \u2014 its reservation row and the node row must commit or roll back together",
3275
+ nodeUniquenessScope: 'scope the unique constraint to `"kind"`, which the uniques primary key enforces on its own'
3276
+ };
3277
+ function constraintFenceRefusal(ctx, backend, reason) {
3278
+ if (!("transaction" in backend) || backend.capabilities.transactions) {
3279
+ return void 0;
3280
+ }
3281
+ return new ConfigurationError(
3282
+ "This backend cannot fence a constrained write: enforcing a declared constraint requires a transaction \u2014 to scope the per-graph write lock to, and to commit a reservation row together with the row it gates \u2014 and this backend has no transactions.",
3283
+ {
3284
+ code: "CONSTRAINT_WRITE_FENCE_UNSUPPORTED",
3285
+ graphId: ctx.graphId,
3286
+ constraint: reason
3287
+ },
3288
+ {
3289
+ suggestion: `Use a transactional backend, or ${CONSTRAINT_FENCE_ADVICE[reason]}. Unconstrained writes need no fence and keep working on this backend.`
3290
+ }
3291
+ );
3292
+ }
3293
+ function runInWriteTransaction(ctx, backend, fn, options) {
3294
+ const ownsWriteLock = "transaction" in backend && backend.capabilities.transactions;
3295
+ const fenceReason = options?.fencesConstraintProbe;
3296
+ const refusal = fenceReason === void 0 ? void 0 : constraintFenceRefusal(ctx, backend, fenceReason);
3297
+ if (refusal !== void 0) return Promise.reject(refusal);
3298
+ const needsGraphWriteLock = ctx.historyEnabled || ctx.revisionTrackingEnabled || fenceReason !== void 0;
3299
+ return runOptionallyInTransaction(backend, async (target) => {
3300
+ await lockSchemaVersionForStoreWrite(ctx, target);
3301
+ const session = needsGraphWriteLock ? writeTransactionSessions.get(target) : void 0;
3302
+ const held = heldGraphWriteLocks.get(target) ?? /* @__PURE__ */ new Set();
3303
+ heldGraphWriteLocks.set(target, held);
3304
+ const acquiresLock = needsGraphWriteLock && session?.lock === void 0 && !held.has(ctx.graphId);
3305
+ if (acquiresLock) held.add(ctx.graphId);
3306
+ const lock = acquiresLock ? await lockRecordedGraphWrite(target, ctx.graphId).catch(
3307
+ (error) => {
3308
+ held.delete(ctx.graphId);
3309
+ throw error;
3310
+ }
3311
+ ) : session?.lock ?? uncapturedGraphWriteLock();
3312
+ if (session !== void 0) session.lock = lock;
3313
+ const result = await (acquiresLock ? fn(target, lock).finally(() => held.delete(ctx.graphId)) : fn(target, lock));
3314
+ if (session !== void 0) {
3315
+ session.wrote ||= options?.didWrite?.(result) ?? true;
3316
+ return result;
3317
+ }
3318
+ if (ctx.revisionTrackingEnabled && !ctx.historyEnabled && (options?.didWrite?.(result) ?? true)) {
3319
+ await advanceRevisionClock(
3320
+ target,
3321
+ ctx.revisionSchema,
3322
+ ctx.graphId,
3323
+ ownsWriteLock
3324
+ );
3325
+ }
3326
+ return result;
3327
+ });
3328
+ }
3329
+ function runHookedWriteOperation(ctx, opContext, backend, body, options) {
3330
+ return ctx.withOperationHooks(
3331
+ opContext,
3332
+ () => runInWriteTransaction(ctx, backend, body, options)
3333
+ );
3116
3334
  }
3117
3335
 
3118
- export { CURRENT_READ_INSTANT_PLACEHOLDER, IDENTITY_ASSERTION_COLUMNS, IDENTITY_PEER_CLASS_COLUMNS, advanceRevisionClock, arrayField, assertCurrentRecordedSchema, assertRecordedCaptureTransactionIsolation, assertRevisionTrackableBackend, baseField, buildFieldBuilderForTypeInfo, buildPredicateIndex, closeRecordedHardDeletedKind, compareCodePoints, compareStrings, compileFieldValue, compileKindFilter, compilePredicateClauses, compilePredicateExpression, compileTemporalFilter, createFulltextAccessor, createRecordedBackend, createRecordedTransactionScope, currentReadInstant, currentReadInstantFor, dateField, edgeInsertDispatch, encodeTupleKey, ensureRevisionOrigin, exists, extractFulltextMatchPredicates, extractTemporalOptions, extractVectorSimilarityPredicates, fieldRef, forceRecordedGraphRevision, generateId, getEdgeRowsByIds, getFieldPointer, getHybridTargetAlias, getNodeKindsForAlias, getNodeRowsByIds, getPredicatesForAlias, historicalIdentityPeerClassQuery, historicalIdentityReconstructionCtes, identityAssertionSnapshotSource, identityNodeSnapshotSource, identityNodeVisibilitySql, identitySqlCoordinate, inSubquery, isParameterRef, lockRecordedGraphWrite, nodeInsertDispatch, notExists, notInSubquery, numberField, objectField, param, readRecordedClock, readRevisionOrigin, recordedBindParamBudget, recordedCaptureRequiresCallbackTransactionError, resolveParameterValueType, runInsertBatch, runInsertBatchReturning, runInsertNoReturn, sqlValueList, stringField, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, uncapturedGraphWriteLock, withPinnedReadInstant, withRecordedFlushObserver, withRecordedIdentityMutationTarget };
3119
- //# sourceMappingURL=chunk-S5TERQVW.js.map
3120
- //# sourceMappingURL=chunk-S5TERQVW.js.map
3336
+ export { CURRENT_READ_INSTANT_PLACEHOLDER, IDENTITY_ASSERTION_COLUMNS, IDENTITY_PEER_CLASS_COLUMNS, advanceRevisionClock, arrayField, assertCurrentRecordedSchema, assertRecordedCaptureTransactionIsolation, assertRecursiveTraversalSupported, assertRevisionTrackableBackend, baseField, buildFieldBuilderForTypeInfo, buildPredicateIndex, closeRecordedHardDeletedKind, compileFieldValue, compileKindFilter, compilePredicateClauses, compilePredicateExpression, compileTemporalFilter, constraintFenceRefusal, createFulltextAccessor, createRecordedBackend, createRecordedTransactionScope, createValidationError, currentReadInstant, currentReadInstantFor, dateField, edgeInsertDispatch, ensureRevisionOrigin, exists, extractFulltextMatchPredicates, extractTemporalOptions, extractVectorSimilarityPredicates, fieldRef, forceRecordedGraphRevision, forceWriteTransactionRevision, generateId, getEdgeRowsByIds, getFieldPointer, getHybridTargetAlias, getNodeKindsForAlias, getNodeRowsByIds, getPredicatesForAlias, historicalIdentityPeerClassQuery, historicalIdentityReconstructionCtes, identityAssertionSnapshotSource, identityNodeSnapshotSource, identityNodeVisibilitySql, identitySqlCoordinate, inSubquery, isParameterRef, lockRecordedGraphWrite, lockSchemaVersionForStoreWrite, nodeInsertDispatch, notExists, notInSubquery, numberField, objectField, param, readRecordedClock, readRevisionOrigin, recordedBindParamBudget, recordedCaptureRequiresCallbackTransactionError, requireRecursiveTraversalVerdict, resolveParameterValueType, runHookedWriteOperation, runInWriteTransaction, runInsertBatch, runInsertBatchReturning, runInsertNoReturn, sqlValueList, stringField, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, validateEdgeProps, validateNodeProps, validateProps, withPinnedReadInstant, withRecordedFlushObserver, withRecordedIdentityMutationTarget, withWriteTransactionSession, wrapZodError };
3337
+ //# sourceMappingURL=chunk-VAAC7L57.js.map
3338
+ //# sourceMappingURL=chunk-VAAC7L57.js.map