@nicia-ai/typegraph 0.34.0 → 0.36.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 (287) hide show
  1. package/dist/backend/postgres/index.cjs +29 -29
  2. package/dist/backend/postgres/index.d.cts +39 -7
  3. package/dist/backend/postgres/index.d.ts +39 -7
  4. package/dist/backend/postgres/index.js +16 -16
  5. package/dist/backend/postgres/pglite.cjs +21 -21
  6. package/dist/backend/postgres/pglite.d.cts +4 -4
  7. package/dist/backend/postgres/pglite.d.ts +4 -4
  8. package/dist/backend/postgres/pglite.js +16 -16
  9. package/dist/backend/sqlite/index.cjs +25 -26
  10. package/dist/backend/sqlite/index.d.cts +8 -8
  11. package/dist/backend/sqlite/index.d.ts +8 -8
  12. package/dist/backend/sqlite/index.js +13 -14
  13. package/dist/backend/sqlite/libsql.cjs +19 -19
  14. package/dist/backend/sqlite/libsql.d.cts +4 -4
  15. package/dist/backend/sqlite/libsql.d.ts +4 -4
  16. package/dist/backend/sqlite/libsql.js +15 -15
  17. package/dist/backend/sqlite/local.cjs +101 -21
  18. package/dist/backend/sqlite/local.cjs.map +1 -1
  19. package/dist/backend/sqlite/local.d.cts +95 -5
  20. package/dist/backend/sqlite/local.d.ts +95 -5
  21. package/dist/backend/sqlite/local.js +95 -16
  22. package/dist/backend/sqlite/local.js.map +1 -1
  23. package/dist/{chunk-T6SPUYLX.cjs → chunk-2THZ3TQI.cjs} +116 -10
  24. package/dist/chunk-2THZ3TQI.cjs.map +1 -0
  25. package/dist/{chunk-UJLOZYKT.cjs → chunk-456Z2U7Y.cjs} +441 -115
  26. package/dist/chunk-456Z2U7Y.cjs.map +1 -0
  27. package/dist/chunk-4BCU6VFZ.cjs +100 -0
  28. package/dist/chunk-4BCU6VFZ.cjs.map +1 -0
  29. package/dist/chunk-4BMPGT35.cjs +12 -0
  30. package/dist/{chunk-HMFK4BXR.cjs.map → chunk-4BMPGT35.cjs.map} +1 -1
  31. package/dist/chunk-4CAXEB2F.cjs +1366 -0
  32. package/dist/chunk-4CAXEB2F.cjs.map +1 -0
  33. package/dist/{chunk-RY2VIWAM.js → chunk-4GX2JJXS.js} +355 -32
  34. package/dist/chunk-4GX2JJXS.js.map +1 -0
  35. package/dist/{chunk-GQANNXXT.cjs → chunk-5A6FNS6N.cjs} +75 -20
  36. package/dist/chunk-5A6FNS6N.cjs.map +1 -0
  37. package/dist/{chunk-3Z6TW3CT.cjs → chunk-5AQIKK56.cjs} +65 -25
  38. package/dist/chunk-5AQIKK56.cjs.map +1 -0
  39. package/dist/{chunk-WLRIWYHQ.js → chunk-5DIPR3L3.js} +2145 -1937
  40. package/dist/chunk-5DIPR3L3.js.map +1 -0
  41. package/dist/{chunk-BVTWD66D.js → chunk-5SEGFTZX.js} +3 -3
  42. package/dist/{chunk-BVTWD66D.js.map → chunk-5SEGFTZX.js.map} +1 -1
  43. package/dist/{chunk-A7SZZFAG.js → chunk-5VTR2F2K.js} +452 -109
  44. package/dist/chunk-5VTR2F2K.js.map +1 -0
  45. package/dist/{chunk-JJRCLAUN.cjs → chunk-5W4L6DLF.cjs} +116 -10
  46. package/dist/chunk-5W4L6DLF.cjs.map +1 -0
  47. package/dist/{chunk-6GNSY7AV.js → chunk-6FR2MMS6.js} +7 -7
  48. package/dist/chunk-6FR2MMS6.js.map +1 -0
  49. package/dist/{chunk-3BRVBQQD.cjs → chunk-7BQLPXK6.cjs} +2648 -2440
  50. package/dist/chunk-7BQLPXK6.cjs.map +1 -0
  51. package/dist/chunk-7YSP4V4R.cjs +69 -0
  52. package/dist/chunk-7YSP4V4R.cjs.map +1 -0
  53. package/dist/chunk-A42GCBGX.cjs +28 -0
  54. package/dist/chunk-A42GCBGX.cjs.map +1 -0
  55. package/dist/{chunk-ZV5N4DBG.js → chunk-BJVEU3ZL.js} +300 -58
  56. package/dist/chunk-BJVEU3ZL.js.map +1 -0
  57. package/dist/chunk-BYPOGQWK.js +25 -0
  58. package/dist/chunk-BYPOGQWK.js.map +1 -0
  59. package/dist/chunk-CUHM5CWJ.cjs +12 -0
  60. package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
  61. package/dist/{chunk-2JXB3NYJ.cjs → chunk-D7ZEOS56.cjs} +25 -32
  62. package/dist/chunk-D7ZEOS56.cjs.map +1 -0
  63. package/dist/chunk-DFVLCOP6.js +10 -0
  64. package/dist/chunk-DFVLCOP6.js.map +1 -0
  65. package/dist/{chunk-JIEJCTDS.cjs → chunk-DIK74MXX.cjs} +37 -4
  66. package/dist/chunk-DIK74MXX.cjs.map +1 -0
  67. package/dist/chunk-DN5VP4JC.js +1343 -0
  68. package/dist/chunk-DN5VP4JC.js.map +1 -0
  69. package/dist/chunk-EOLERH7Y.cjs +40 -0
  70. package/dist/chunk-EOLERH7Y.cjs.map +1 -0
  71. package/dist/{chunk-TGJE22RM.cjs → chunk-FACJJWGF.cjs} +24 -6
  72. package/dist/chunk-FACJJWGF.cjs.map +1 -0
  73. package/dist/{chunk-WVC2Q2FD.cjs → chunk-FN35DLCN.cjs} +31 -9
  74. package/dist/chunk-FN35DLCN.cjs.map +1 -0
  75. package/dist/{chunk-KUTNI6SI.js → chunk-FPIZFYHE.js} +10 -18
  76. package/dist/chunk-FPIZFYHE.js.map +1 -0
  77. package/dist/{chunk-VCGO4V26.js → chunk-FRV5Q5IO.js} +64 -9
  78. package/dist/chunk-FRV5Q5IO.js.map +1 -0
  79. package/dist/{chunk-K5P5OZXS.js → chunk-G6Q5UM7U.js} +2 -2
  80. package/dist/{chunk-K5P5OZXS.js.map → chunk-G6Q5UM7U.js.map} +1 -1
  81. package/dist/{chunk-JQGIPGVL.cjs → chunk-H7YNSMA7.cjs} +43 -2
  82. package/dist/chunk-H7YNSMA7.cjs.map +1 -0
  83. package/dist/chunk-HW3LW7DH.cjs +1271 -0
  84. package/dist/chunk-HW3LW7DH.cjs.map +1 -0
  85. package/dist/{chunk-V3QNTB7Z.js → chunk-IU46OHVW.js} +194 -114
  86. package/dist/chunk-IU46OHVW.js.map +1 -0
  87. package/dist/{chunk-HK5SATYM.cjs → chunk-J3LEGNQB.cjs} +16 -109
  88. package/dist/chunk-J3LEGNQB.cjs.map +1 -0
  89. package/dist/{chunk-ZP5WHI4C.cjs → chunk-JFMEONLG.cjs} +358 -116
  90. package/dist/chunk-JFMEONLG.cjs.map +1 -0
  91. package/dist/{chunk-2MRAX3UE.js → chunk-JFUPDJXD.js} +47 -4
  92. package/dist/chunk-JFUPDJXD.js.map +1 -0
  93. package/dist/{chunk-Z5XBMDXU.js → chunk-KBGQIPRQ.js} +42 -3
  94. package/dist/chunk-KBGQIPRQ.js.map +1 -0
  95. package/dist/{chunk-K2TGS3EN.js → chunk-M75SUBFG.js} +138 -89
  96. package/dist/chunk-M75SUBFG.js.map +1 -0
  97. package/dist/chunk-OHMP6N2J.js +47 -0
  98. package/dist/chunk-OHMP6N2J.js.map +1 -0
  99. package/dist/{chunk-4DIBPQNJ.js → chunk-OR5ZA5WP.js} +135 -25
  100. package/dist/chunk-OR5ZA5WP.js.map +1 -0
  101. package/dist/{chunk-6HVOHZHS.cjs → chunk-PWGX5DF5.cjs} +213 -168
  102. package/dist/chunk-PWGX5DF5.cjs.map +1 -0
  103. package/dist/chunk-PZKNKG5M.js +1252 -0
  104. package/dist/chunk-PZKNKG5M.js.map +1 -0
  105. package/dist/{chunk-DEQFL35G.js → chunk-Q5TEXCTB.js} +61 -7
  106. package/dist/chunk-Q5TEXCTB.js.map +1 -0
  107. package/dist/{chunk-QV245VMN.js → chunk-RAXU3RMB.js} +100 -6
  108. package/dist/chunk-RAXU3RMB.js.map +1 -0
  109. package/dist/{chunk-RHZWOJVA.cjs → chunk-RSSQKPSZ.cjs} +52 -4
  110. package/dist/chunk-RSSQKPSZ.cjs.map +1 -0
  111. package/dist/{chunk-G6SOJEDI.cjs → chunk-S55OV6PW.cjs} +15 -15
  112. package/dist/chunk-S55OV6PW.cjs.map +1 -0
  113. package/dist/chunk-S5F7ZLP2.js +94 -0
  114. package/dist/chunk-S5F7ZLP2.js.map +1 -0
  115. package/dist/{chunk-3E7SNSIA.cjs → chunk-SJDMVITW.cjs} +4 -4
  116. package/dist/{chunk-3E7SNSIA.cjs.map → chunk-SJDMVITW.cjs.map} +1 -1
  117. package/dist/{chunk-CHXTTSC6.js → chunk-SKCOUWAX.js} +104 -5
  118. package/dist/chunk-SKCOUWAX.js.map +1 -0
  119. package/dist/{chunk-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
  120. package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
  121. package/dist/{chunk-ZURTTSCM.js → chunk-SXGE7ITL.js} +6 -94
  122. package/dist/chunk-SXGE7ITL.js.map +1 -0
  123. package/dist/{chunk-RBV7YCQD.js → chunk-T2WUSPDA.js} +49 -9
  124. package/dist/chunk-T2WUSPDA.js.map +1 -0
  125. package/dist/{chunk-KGC4LY5T.cjs → chunk-TCOCYN2P.cjs} +75 -21
  126. package/dist/chunk-TCOCYN2P.cjs.map +1 -0
  127. package/dist/{chunk-FLRCVI2G.cjs → chunk-TDXIBCGY.cjs} +2 -2
  128. package/dist/{chunk-FLRCVI2G.cjs.map → chunk-TDXIBCGY.cjs.map} +1 -1
  129. package/dist/{chunk-ZY4GXIVN.cjs → chunk-TEDRJXOG.cjs} +5 -5
  130. package/dist/{chunk-ZY4GXIVN.cjs.map → chunk-TEDRJXOG.cjs.map} +1 -1
  131. package/dist/{chunk-WL2SG7ZV.cjs → chunk-UMDVATGY.cjs} +6 -6
  132. package/dist/{chunk-WL2SG7ZV.cjs.map → chunk-UMDVATGY.cjs.map} +1 -1
  133. package/dist/chunk-UT3S4SEN.js +31 -0
  134. package/dist/chunk-UT3S4SEN.js.map +1 -0
  135. package/dist/{chunk-RRKQAKD6.cjs → chunk-UUT7UN2N.cjs} +149 -39
  136. package/dist/chunk-UUT7UN2N.cjs.map +1 -0
  137. package/dist/{chunk-SHLY4MCM.js → chunk-UZV3AZKF.js} +21 -3
  138. package/dist/chunk-UZV3AZKF.js.map +1 -0
  139. package/dist/{chunk-CYX2JTDG.js → chunk-VHMPG6UL.js} +29 -7
  140. package/dist/chunk-VHMPG6UL.js.map +1 -0
  141. package/dist/{chunk-LANHCOXB.js → chunk-VQEXF5D4.js} +485 -83
  142. package/dist/chunk-VQEXF5D4.js.map +1 -0
  143. package/dist/{chunk-K34OPSJK.js → chunk-W63OVYY4.js} +3 -3
  144. package/dist/{chunk-K34OPSJK.js.map → chunk-W63OVYY4.js.map} +1 -1
  145. package/dist/{chunk-TQOYM4LN.js → chunk-WI7ISNQF.js} +35 -5
  146. package/dist/chunk-WI7ISNQF.js.map +1 -0
  147. package/dist/{chunk-UNNPKQUG.cjs → chunk-X4JBT642.cjs} +246 -155
  148. package/dist/chunk-X4JBT642.cjs.map +1 -0
  149. package/dist/chunk-ZAMFOJ5P.cjs +1176 -0
  150. package/dist/chunk-ZAMFOJ5P.cjs.map +1 -0
  151. package/dist/{chunk-T46GR2VY.js → chunk-ZIGXMKQQ.js} +3 -3
  152. package/dist/{chunk-T46GR2VY.js.map → chunk-ZIGXMKQQ.js.map} +1 -1
  153. package/dist/{chunk-5IQIX7LU.cjs → chunk-ZUNQ5BEP.cjs} +518 -172
  154. package/dist/chunk-ZUNQ5BEP.cjs.map +1 -0
  155. package/dist/{ddl-BrmPg61z.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
  156. package/dist/{ddl-j1-sH6lE.d.cts → ddl-CZz7a0E8.d.cts} +4 -4
  157. package/dist/{extension-types-YGFJPrzK.d.cts → extension-types-ixRpJVUp.d.cts} +24 -1
  158. package/dist/{extension-types-YGFJPrzK.d.ts → extension-types-ixRpJVUp.d.ts} +24 -1
  159. package/dist/{types-DkNnF-7K.d.cts → fulltext-strategy-B57yvC5Q.d.ts} +2562 -2133
  160. package/dist/{types-D1Sqeyxy.d.ts → fulltext-strategy-CDkSSYhq.d.cts} +2562 -2133
  161. package/dist/graph-extension/index.cjs +20 -19
  162. package/dist/graph-extension/index.d.cts +4 -4
  163. package/dist/graph-extension/index.d.ts +4 -4
  164. package/dist/graph-extension/index.js +5 -4
  165. package/dist/graph-merge/index.cjs +255 -164
  166. package/dist/graph-merge/index.cjs.map +1 -1
  167. package/dist/graph-merge/index.d.cts +63 -33
  168. package/dist/graph-merge/index.d.ts +63 -33
  169. package/dist/graph-merge/index.js +135 -44
  170. package/dist/graph-merge/index.js.map +1 -1
  171. package/dist/{index-DGX6D9j1.d.ts → index-BFvdmBPV.d.ts} +301 -93
  172. package/dist/{index-SEvUHDA6.d.cts → index-BLtQWKRj.d.cts} +301 -93
  173. package/dist/index.cjs +216 -188
  174. package/dist/index.d.cts +11 -11
  175. package/dist/index.d.ts +11 -11
  176. package/dist/index.js +33 -33
  177. package/dist/indexes/index.cjs +19 -20
  178. package/dist/indexes/index.d.cts +5 -5
  179. package/dist/indexes/index.d.ts +5 -5
  180. package/dist/indexes/index.js +10 -11
  181. package/dist/interchange/index.cjs +48 -26
  182. package/dist/interchange/index.d.cts +126 -12
  183. package/dist/interchange/index.d.ts +126 -12
  184. package/dist/interchange/index.js +15 -13
  185. package/dist/{manager-ms9cKdc6.d.cts → manager-DwQi8eV0.d.cts} +9 -2
  186. package/dist/{manager-BZUeN_BU.d.ts → manager-ejUCB52T.d.ts} +9 -2
  187. package/dist/{materialize-indexes-D20xNluI.d.cts → materialize-indexes-B4e9360H.d.cts} +20 -4
  188. package/dist/{materialize-indexes-CAkIYFV-.d.ts → materialize-indexes-te9TPMMJ.d.ts} +20 -4
  189. package/dist/{postgres-BhpxGMC5.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
  190. package/dist/{postgres-CWHLwNl1.d.ts → postgres-DQ5R6rzV.d.ts} +152 -1
  191. package/dist/profiler/index.cjs +11 -11
  192. package/dist/profiler/index.d.cts +7 -7
  193. package/dist/profiler/index.d.ts +7 -7
  194. package/dist/profiler/index.js +4 -4
  195. package/dist/provenance/index.cjs +40 -41
  196. package/dist/provenance/index.cjs.map +1 -1
  197. package/dist/provenance/index.d.cts +5 -5
  198. package/dist/provenance/index.d.ts +5 -5
  199. package/dist/provenance/index.js +11 -12
  200. package/dist/provenance/index.js.map +1 -1
  201. package/dist/schema/index.cjs +53 -40
  202. package/dist/schema/index.cjs.map +1 -1
  203. package/dist/schema/index.d.cts +57 -57
  204. package/dist/schema/index.d.ts +57 -57
  205. package/dist/schema/index.js +28 -15
  206. package/dist/schema/index.js.map +1 -1
  207. package/dist/{sqlite-XrDxNaa7.d.cts → sqlite-D7zBinNR.d.cts} +92 -1
  208. package/dist/{sqlite-CGu5SLsw.d.ts → sqlite-DvQndLky.d.ts} +92 -1
  209. package/dist/{store-view-D09po4H6.d.cts → store-view-9KDOpZzF.d.cts} +643 -58
  210. package/dist/{store-view-BlgnhEYf.d.ts → store-view-DplHC3Nt.d.ts} +643 -58
  211. package/dist/{types-DiE1AO7p.d.cts → types-Bv9DcS_E.d.cts} +2 -2
  212. package/dist/{types-B1TbZJYS.d.ts → types-CoxuV7EJ.d.ts} +2 -2
  213. package/dist/{where-DKjuofPr.d.cts → where-7RKFOsXt.d.ts} +2 -2
  214. package/dist/{where-DrUIIWHb.d.ts → where-DdMIXOtH.d.cts} +2 -2
  215. package/package.json +14 -13
  216. package/dist/chunk-2EBMPJBO.js +0 -16
  217. package/dist/chunk-2EBMPJBO.js.map +0 -1
  218. package/dist/chunk-2JXB3NYJ.cjs.map +0 -1
  219. package/dist/chunk-2MRAX3UE.js.map +0 -1
  220. package/dist/chunk-3BRVBQQD.cjs.map +0 -1
  221. package/dist/chunk-3EUKJEQ3.js +0 -77
  222. package/dist/chunk-3EUKJEQ3.js.map +0 -1
  223. package/dist/chunk-3Z6TW3CT.cjs.map +0 -1
  224. package/dist/chunk-4DIBPQNJ.js.map +0 -1
  225. package/dist/chunk-4S2FXGBJ.js +0 -9
  226. package/dist/chunk-4S2FXGBJ.js.map +0 -1
  227. package/dist/chunk-5IQIX7LU.cjs.map +0 -1
  228. package/dist/chunk-6GNSY7AV.js.map +0 -1
  229. package/dist/chunk-6HVOHZHS.cjs.map +0 -1
  230. package/dist/chunk-6SCVW4AS.js +0 -20
  231. package/dist/chunk-6SCVW4AS.js.map +0 -1
  232. package/dist/chunk-A7SZZFAG.js.map +0 -1
  233. package/dist/chunk-CHXTTSC6.js.map +0 -1
  234. package/dist/chunk-CYX2JTDG.js.map +0 -1
  235. package/dist/chunk-DEQFL35G.js.map +0 -1
  236. package/dist/chunk-G6SOJEDI.cjs.map +0 -1
  237. package/dist/chunk-GQANNXXT.cjs.map +0 -1
  238. package/dist/chunk-GZCNZ7QW.js +0 -24
  239. package/dist/chunk-GZCNZ7QW.js.map +0 -1
  240. package/dist/chunk-HK5SATYM.cjs.map +0 -1
  241. package/dist/chunk-HMFK4BXR.cjs +0 -12
  242. package/dist/chunk-HTGDWIDE.cjs +0 -89
  243. package/dist/chunk-HTGDWIDE.cjs.map +0 -1
  244. package/dist/chunk-JIEJCTDS.cjs.map +0 -1
  245. package/dist/chunk-JJRCLAUN.cjs.map +0 -1
  246. package/dist/chunk-JQGIPGVL.cjs.map +0 -1
  247. package/dist/chunk-K2TGS3EN.js.map +0 -1
  248. package/dist/chunk-KGC4LY5T.cjs.map +0 -1
  249. package/dist/chunk-KNHYNQQ3.cjs +0 -663
  250. package/dist/chunk-KNHYNQQ3.cjs.map +0 -1
  251. package/dist/chunk-KUTNI6SI.js.map +0 -1
  252. package/dist/chunk-LANHCOXB.js.map +0 -1
  253. package/dist/chunk-N6WTUSBV.cjs +0 -23
  254. package/dist/chunk-N6WTUSBV.cjs.map +0 -1
  255. package/dist/chunk-NAUA4PW5.cjs +0 -28
  256. package/dist/chunk-NAUA4PW5.cjs.map +0 -1
  257. package/dist/chunk-QV245VMN.js.map +0 -1
  258. package/dist/chunk-RBV7YCQD.js.map +0 -1
  259. package/dist/chunk-RHZWOJVA.cjs.map +0 -1
  260. package/dist/chunk-RRKQAKD6.cjs.map +0 -1
  261. package/dist/chunk-RY2VIWAM.js.map +0 -1
  262. package/dist/chunk-SHLY4MCM.js.map +0 -1
  263. package/dist/chunk-T2DWPQNE.js +0 -649
  264. package/dist/chunk-T2DWPQNE.js.map +0 -1
  265. package/dist/chunk-T6SPUYLX.cjs.map +0 -1
  266. package/dist/chunk-TGJE22RM.cjs.map +0 -1
  267. package/dist/chunk-TOTPVGOG.cjs +0 -774
  268. package/dist/chunk-TOTPVGOG.cjs.map +0 -1
  269. package/dist/chunk-TQOYM4LN.js.map +0 -1
  270. package/dist/chunk-UJLOZYKT.cjs.map +0 -1
  271. package/dist/chunk-UNNPKQUG.cjs.map +0 -1
  272. package/dist/chunk-V3QNTB7Z.js.map +0 -1
  273. package/dist/chunk-VCGO4V26.js.map +0 -1
  274. package/dist/chunk-WLRIWYHQ.js.map +0 -1
  275. package/dist/chunk-WVC2Q2FD.cjs.map +0 -1
  276. package/dist/chunk-XXVEULWX.js +0 -39
  277. package/dist/chunk-XXVEULWX.js.map +0 -1
  278. package/dist/chunk-YAZE7QZR.cjs +0 -32
  279. package/dist/chunk-YAZE7QZR.cjs.map +0 -1
  280. package/dist/chunk-YC6PWTHY.cjs +0 -44
  281. package/dist/chunk-YC6PWTHY.cjs.map +0 -1
  282. package/dist/chunk-Z5HBYM7U.cjs +0 -11
  283. package/dist/chunk-Z5HBYM7U.cjs.map +0 -1
  284. package/dist/chunk-Z5XBMDXU.js.map +0 -1
  285. package/dist/chunk-ZP5WHI4C.cjs.map +0 -1
  286. package/dist/chunk-ZURTTSCM.js.map +0 -1
  287. package/dist/chunk-ZV5N4DBG.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import { G as GraphDef, t as NodeKinds, u as GetNodeType } from '../manager-ms9cKdc6.cjs';
2
- import { S as Store, N as Node, U as UniqueIntrospection } from '../store-view-D09po4H6.cjs';
3
- import { d as NodeId, N as NodeType, e as EdgeId, J as JsonValue, f as KindAnnotations, g as EdgeType, D as DeleteBehavior, T as TemporalMode, h as GraphExtensionVersion, i as ExtensionNodeDef, j as ExtensionEdgeDef, k as ExtensionOntologyRelation, l as ExtensionIndex } from '../extension-types-YGFJPrzK.cjs';
4
- import { T as TypeGraphError } from '../index-SEvUHDA6.cjs';
1
+ import { G as GraphDef, t as NodeKinds, u as GetNodeType } from '../manager-DwQi8eV0.cjs';
2
+ import { S as Store, N as Node, U as UniqueIntrospection } from '../store-view-9KDOpZzF.cjs';
3
+ import { d as NodeId, N as NodeType, e as EdgeId, J as JsonValue, f as KindAnnotations, g as EdgeType, D as DeleteBehavior, T as TemporalMode, h as GraphExtensionVersion, i as ExtensionNodeDef, j as ExtensionEdgeDef, k as ExtensionOntologyRelation, l as ExtensionIndex } from '../extension-types-ixRpJVUp.cjs';
4
+ import { T as TypeGraphError } from '../index-BLtQWKRj.cjs';
5
5
  import { R as Result } from '../result-DWo6mUVz.cjs';
6
6
  export { i as isErr, a as isOk, u as unwrap } from '../result-DWo6mUVz.cjs';
7
- import { G as GraphBackend, M as MetaEdge, I as IndexDeclaration } from '../types-DkNnF-7K.cjs';
7
+ import { G as GraphBackend, M as MetaEdge, I as IndexDeclaration } from '../fulltext-strategy-CDkSSYhq.cjs';
8
8
  import { z } from 'zod';
9
- import '../materialize-indexes-D20xNluI.cjs';
9
+ import '../materialize-indexes-B4e9360H.cjs';
10
10
  import 'drizzle-orm';
11
11
  import 'drizzle-orm/pg-core';
12
12
  import 'drizzle-orm/sqlite-core';
@@ -34,8 +34,10 @@ type BranchId = string & Readonly<{
34
34
  }>;
35
35
  /**
36
36
  * Opaque token identifying the immutable `base@V` a branch was forked from.
37
- * Combines a schema hash with a content fingerprint (computed in T3). Branded so
38
- * it cannot be confused with an arbitrary string.
37
+ * Combines a schema hash with a staleness component. Branded so it cannot be
38
+ * confused with an arbitrary string. The second component is a
39
+ * durable revision anchor for stores with revision tracking enabled and a
40
+ * compatibility content fingerprint otherwise.
39
41
  */
40
42
  type BaseVersion = string & Readonly<{
41
43
  readonly __brand: "BaseVersion";
@@ -486,7 +488,13 @@ type MergeReport<G extends GraphDef = GraphDef> = Readonly<{
486
488
  * This is content-addressed (the public `computeSchemaHash` deliberately
487
489
  * excludes the version number and `generatedAt`, so it is stable across
488
490
  * re-saves of the same schema).
489
- * 2. A **content fingerprint** — a SHA-256 digest (truncated to a fixed-width
491
+ * 2. A **revision anchor** when the Store has `revisionTracking` (or
492
+ * `history`) enabled — a durable random per-graph origin plus the
493
+ * monotonic revision clock. This is O(1) to read and changes after every
494
+ * successful Store write; the origin prevents independent stores with
495
+ * coincident timestamps from sharing an anchor.
496
+ * Stores without tracking retain the compatibility fallback: a
497
+ * **content fingerprint**, a SHA-256 digest (truncated to a fixed-width
490
498
  * hex string) of every LIVE node and edge over the base store (`id`,
491
499
  * `updated_at`, the bitemporal `valid_from`/`valid_to`, and canonicalized
492
500
  * `props`; edges also carry their endpoint ids), sorted by id, so two stores
@@ -501,17 +509,20 @@ type MergeReport<G extends GraphDef = GraphDef> = Readonly<{
501
509
  * fingerprint would not match its source. (See the working-copy fidelity note in
502
510
  * T4.)
503
511
  *
504
- * `computeBaseVersion` is async because schema hashing and live-content
505
- * enumeration go through async TypeGraph internals. The design's synchronous
506
- * illustrative signature does not survive contact with the real store surface.
512
+ * `computeBaseVersion` is async because schema hashing, revision reads, and the
513
+ * compatibility live-content enumeration go through async TypeGraph internals.
514
+ * The design's synchronous illustrative signature does not survive contact with
515
+ * the real store surface.
507
516
  */
508
517
 
509
518
  /**
510
519
  * Computes the immutable `base@V` token for a store. Combines the schema hash
511
- * with a live-content fingerprint into a single branded {@link BaseVersion}.
520
+ * with a durable revision anchor when tracking is enabled, otherwise with the
521
+ * compatibility live-content fingerprint.
512
522
  *
513
523
  * MUST be called on the ORIGINAL base store, not a clone (clones regenerate
514
- * timestamps and would fingerprint differently).
524
+ * timestamps and would fingerprint differently when the compatibility path is
525
+ * in use).
515
526
  */
516
527
  declare function computeBaseVersion<G extends GraphDef>(store: Store<G>): Promise<BaseVersion>;
517
528
 
@@ -590,12 +601,12 @@ declare class BaseVersionMismatchError extends MergeError {
590
601
  * Pluggable working-copy strategy: how `branch()` produces an isolated,
591
602
  * independently-mutable copy of a base store.
592
603
  *
593
- * The P0 default is a faithful CLONE via the public interchange API
594
- * ({@link cloneWorkingCopyStrategy}): `exportGraph` the base, then `importGraph`
595
- * into a fresh store on a caller-provided backend. IDs are preserved by
596
- * interchange, so the diff engine (T3) can key on stable ids across base and
597
- * fork. This leverages public entrypoints only, needs zero schema changes, and
598
- * behaves identically across SQLite and Postgres.
604
+ * The P0 default is a faithful CLONE via streamed public interchange
605
+ * ({@link cloneWorkingCopyStrategy}): `exportGraphStream` the base, then
606
+ * `importGraphStream` into a fresh store on a caller-provided backend. IDs are
607
+ * preserved by interchange, so the diff engine (T3) can key on stable ids across
608
+ * base and fork. This leverages public entrypoints only, needs zero schema
609
+ * changes, and behaves identically across SQLite and Postgres.
599
610
  *
600
611
  * INTERCHANGE FIDELITY LIMITATION (verified, design §13.x): the interchange
601
612
  * `meta` schema has no `deletedAt` field, so a base row that is already
@@ -609,6 +620,18 @@ declare class BaseVersionMismatchError extends MergeError {
609
620
  * only) as the immutable reference, never against the clone (clones regenerate
610
621
  * `created_at`/`updated_at`, which would otherwise destabilize `base@V`).
611
622
  *
623
+ * `includeTemporal: true` carries `validFrom`/`validTo` through unchanged,
624
+ * preserving the base's exact valid-time window on the clone: create-time
625
+ * paths default an omitted `validFrom` to the row's own creation instant
626
+ * (see #240), and export/import round-trip a still-open-left `valid_from`
627
+ * (e.g. a row that predates the #240 fix) as an explicit `null` rather than
628
+ * silently dropping it — see `InterchangeNodeSchema.validFrom`'s doc.
629
+ * Without either half of this, the clone's re-import would re-stamp the
630
+ * affected base rows to the CLONE's creation instant instead — narrowing
631
+ * their validity window and making `asOf` reads on the fork diverge from
632
+ * identical reads on the base for any instant between the row's real
633
+ * creation and the clone.
634
+ *
612
635
  * Logical-namespace (copy-on-write within one backend, no full data copy) is a
613
636
  * future strategy slot — see the `WorkingCopyStrategy` interface — deferred past
614
637
  * P0.
@@ -637,29 +660,35 @@ type WorkingCopyStrategy<G extends GraphDef> = Readonly<{
637
660
  * in-process Postgres engine) be constructed lazily at branch time.
638
661
  *
639
662
  * The returned backend MUST be EMPTY (no rows for the base graph): the clone
640
- * seeds it from the base via `importGraph` with `onConflict: "error"`, so a
663
+ * seeds it from the base via `importGraphStream` with `onConflict: "error"`, so a
641
664
  * pre-existing row is surfaced as a {@link BranchError} rather than silently
642
665
  * skipped (which would leave the working copy diverging from the base).
666
+ * When the source store uses `revisionTracking`, the backend must also satisfy
667
+ * that option's transactional revision-clock requirements because the clone
668
+ * preserves the source's branchability contract.
643
669
  */
644
670
  type MakeBackend = () => Promise<GraphBackend>;
645
671
  /**
646
- * The P0 default working-copy strategy: faithful clone via export/import.
672
+ * The P0 default working-copy strategy: faithful clone via streamed interchange.
647
673
  *
648
674
  * On each `create(baseStore)`:
649
- * 1. `exportGraph(baseStore, { includeMeta: true, includeDeleted: false })` —
650
- * `includeMeta: true` carries `created_at`/`updated_at`; `includeDeleted:
651
- * false` keeps the clone to LIVE rows only. Shipping soft-deleted rows is
652
- * unsafe: the meta schema has no `deletedAt`, so they would import as live and
653
- * resurrect on the fork's diff (see the fidelity note above). `branch()` only
654
- * needs the base's live state.
675
+ * 1. `exportGraphStream(baseStore, { includeMeta: true, includeTemporal: true,
676
+ * includeDeleted: false })` — `includeMeta: true` carries
677
+ * `created_at`/`updated_at`; `includeTemporal: true` carries
678
+ * `validFrom`/`validTo` so the clone's valid-time window matches the base's
679
+ * exactly (see the fidelity note above); `includeDeleted: false` keeps the
680
+ * clone to LIVE rows only. Shipping soft-deleted rows is unsafe: the meta
681
+ * schema has no `deletedAt`, so they would import as live and resurrect on
682
+ * the fork's diff (see the fidelity note above). `branch()` only needs the
683
+ * base's live state.
655
684
  * 2. Create a fresh store over the caller-provided backend with the SAME graph
656
685
  * definition via `createStoreWithSchema`.
657
- * 3. `importGraph(freshStore, data, { onConflict: "error", ... })` — ids are
686
+ * 3. `importGraphStream(freshStore, data, { onConflict: "error", ... })` — ids are
658
687
  * preserved so the diff engine can key on them. `onConflict: "error"`
659
688
  * requires the backend to be EMPTY: a pre-existing row is a contract
660
689
  * violation that must surface loudly, never be silently skipped (a skipped
661
690
  * row would leave the clone diverging from the base, so the fork's diff would
662
- * report phantom modifications/deletions). `importGraph` RETURNS
691
+ * report phantom modifications/deletions). `importGraphStream` RETURNS
663
692
  * `{ success, errors }` rather than throwing on a per-row rejection, so its
664
693
  * result is checked and any failure fails the branch.
665
694
  *
@@ -682,7 +711,8 @@ declare function cloneWorkingCopyStrategy<G extends GraphDef>(makeBackend: MakeB
682
711
  * branch's own backend seeded with the base's live state.
683
712
  *
684
713
  * The copy mechanism is pluggable behind {@link WorkingCopyStrategy}. The P0
685
- * default is the faithful export/import clone ({@link cloneWorkingCopyStrategy}),
714
+ * default is the faithful streamed-interchange clone
715
+ * ({@link cloneWorkingCopyStrategy}),
686
716
  * which keeps this primitive backend-agnostic: the caller supplies a
687
717
  * `makeBackend` factory, and `branch()` never names a concrete backend.
688
718
  */
@@ -697,7 +727,7 @@ declare function cloneWorkingCopyStrategy<G extends GraphDef>(makeBackend: MakeB
697
727
  * logical-namespace copy-on-write).
698
728
  *
699
729
  * Returns a {@link Result}: success yields the {@link GraphBranch}; any failure
700
- * (base-version stamping, backend construction, export/import) is wrapped in a
730
+ * (base-version stamping, backend construction, streamed interchange) is wrapped in a
701
731
  * {@link BranchError} with the underlying cause attached. Errors are returned,
702
732
  * never thrown — this is internal-logic surface (the caller converts to a thrown
703
733
  * error at the framework boundary).
@@ -814,7 +844,7 @@ type CandidatePair<K extends NodeType = NodeType> = Readonly<{
814
844
  *
815
845
  * 1. PRECONDITION — compute the target's `base@V` and reject any branch whose
816
846
  * `base` token does not match it (`BaseVersionMismatchError`). A branch
817
- * forked from a divergent schema or content fingerprint cannot be merged
847
+ * forked from a divergent schema or base revision cannot be merged
818
848
  * safely (design §5.2 / §13.6).
819
849
  * 2. STAGE — `stageBranches` (T7): the provenance-tagged UNION of every
820
850
  * branch's state-diff against the immutable base.
@@ -1,12 +1,12 @@
1
- import { G as GraphDef, t as NodeKinds, u as GetNodeType } from '../manager-BZUeN_BU.js';
2
- import { S as Store, N as Node, U as UniqueIntrospection } from '../store-view-BlgnhEYf.js';
3
- import { d as NodeId, N as NodeType, e as EdgeId, J as JsonValue, f as KindAnnotations, g as EdgeType, D as DeleteBehavior, T as TemporalMode, h as GraphExtensionVersion, i as ExtensionNodeDef, j as ExtensionEdgeDef, k as ExtensionOntologyRelation, l as ExtensionIndex } from '../extension-types-YGFJPrzK.js';
4
- import { T as TypeGraphError } from '../index-DGX6D9j1.js';
1
+ import { G as GraphDef, t as NodeKinds, u as GetNodeType } from '../manager-ejUCB52T.js';
2
+ import { S as Store, N as Node, U as UniqueIntrospection } from '../store-view-DplHC3Nt.js';
3
+ import { d as NodeId, N as NodeType, e as EdgeId, J as JsonValue, f as KindAnnotations, g as EdgeType, D as DeleteBehavior, T as TemporalMode, h as GraphExtensionVersion, i as ExtensionNodeDef, j as ExtensionEdgeDef, k as ExtensionOntologyRelation, l as ExtensionIndex } from '../extension-types-ixRpJVUp.js';
4
+ import { T as TypeGraphError } from '../index-BFvdmBPV.js';
5
5
  import { R as Result } from '../result-DWo6mUVz.js';
6
6
  export { i as isErr, a as isOk, u as unwrap } from '../result-DWo6mUVz.js';
7
- import { G as GraphBackend, M as MetaEdge, I as IndexDeclaration } from '../types-D1Sqeyxy.js';
7
+ import { G as GraphBackend, M as MetaEdge, I as IndexDeclaration } from '../fulltext-strategy-B57yvC5Q.js';
8
8
  import { z } from 'zod';
9
- import '../materialize-indexes-CAkIYFV-.js';
9
+ import '../materialize-indexes-te9TPMMJ.js';
10
10
  import 'drizzle-orm';
11
11
  import 'drizzle-orm/pg-core';
12
12
  import 'drizzle-orm/sqlite-core';
@@ -34,8 +34,10 @@ type BranchId = string & Readonly<{
34
34
  }>;
35
35
  /**
36
36
  * Opaque token identifying the immutable `base@V` a branch was forked from.
37
- * Combines a schema hash with a content fingerprint (computed in T3). Branded so
38
- * it cannot be confused with an arbitrary string.
37
+ * Combines a schema hash with a staleness component. Branded so it cannot be
38
+ * confused with an arbitrary string. The second component is a
39
+ * durable revision anchor for stores with revision tracking enabled and a
40
+ * compatibility content fingerprint otherwise.
39
41
  */
40
42
  type BaseVersion = string & Readonly<{
41
43
  readonly __brand: "BaseVersion";
@@ -486,7 +488,13 @@ type MergeReport<G extends GraphDef = GraphDef> = Readonly<{
486
488
  * This is content-addressed (the public `computeSchemaHash` deliberately
487
489
  * excludes the version number and `generatedAt`, so it is stable across
488
490
  * re-saves of the same schema).
489
- * 2. A **content fingerprint** — a SHA-256 digest (truncated to a fixed-width
491
+ * 2. A **revision anchor** when the Store has `revisionTracking` (or
492
+ * `history`) enabled — a durable random per-graph origin plus the
493
+ * monotonic revision clock. This is O(1) to read and changes after every
494
+ * successful Store write; the origin prevents independent stores with
495
+ * coincident timestamps from sharing an anchor.
496
+ * Stores without tracking retain the compatibility fallback: a
497
+ * **content fingerprint**, a SHA-256 digest (truncated to a fixed-width
490
498
  * hex string) of every LIVE node and edge over the base store (`id`,
491
499
  * `updated_at`, the bitemporal `valid_from`/`valid_to`, and canonicalized
492
500
  * `props`; edges also carry their endpoint ids), sorted by id, so two stores
@@ -501,17 +509,20 @@ type MergeReport<G extends GraphDef = GraphDef> = Readonly<{
501
509
  * fingerprint would not match its source. (See the working-copy fidelity note in
502
510
  * T4.)
503
511
  *
504
- * `computeBaseVersion` is async because schema hashing and live-content
505
- * enumeration go through async TypeGraph internals. The design's synchronous
506
- * illustrative signature does not survive contact with the real store surface.
512
+ * `computeBaseVersion` is async because schema hashing, revision reads, and the
513
+ * compatibility live-content enumeration go through async TypeGraph internals.
514
+ * The design's synchronous illustrative signature does not survive contact with
515
+ * the real store surface.
507
516
  */
508
517
 
509
518
  /**
510
519
  * Computes the immutable `base@V` token for a store. Combines the schema hash
511
- * with a live-content fingerprint into a single branded {@link BaseVersion}.
520
+ * with a durable revision anchor when tracking is enabled, otherwise with the
521
+ * compatibility live-content fingerprint.
512
522
  *
513
523
  * MUST be called on the ORIGINAL base store, not a clone (clones regenerate
514
- * timestamps and would fingerprint differently).
524
+ * timestamps and would fingerprint differently when the compatibility path is
525
+ * in use).
515
526
  */
516
527
  declare function computeBaseVersion<G extends GraphDef>(store: Store<G>): Promise<BaseVersion>;
517
528
 
@@ -590,12 +601,12 @@ declare class BaseVersionMismatchError extends MergeError {
590
601
  * Pluggable working-copy strategy: how `branch()` produces an isolated,
591
602
  * independently-mutable copy of a base store.
592
603
  *
593
- * The P0 default is a faithful CLONE via the public interchange API
594
- * ({@link cloneWorkingCopyStrategy}): `exportGraph` the base, then `importGraph`
595
- * into a fresh store on a caller-provided backend. IDs are preserved by
596
- * interchange, so the diff engine (T3) can key on stable ids across base and
597
- * fork. This leverages public entrypoints only, needs zero schema changes, and
598
- * behaves identically across SQLite and Postgres.
604
+ * The P0 default is a faithful CLONE via streamed public interchange
605
+ * ({@link cloneWorkingCopyStrategy}): `exportGraphStream` the base, then
606
+ * `importGraphStream` into a fresh store on a caller-provided backend. IDs are
607
+ * preserved by interchange, so the diff engine (T3) can key on stable ids across
608
+ * base and fork. This leverages public entrypoints only, needs zero schema
609
+ * changes, and behaves identically across SQLite and Postgres.
599
610
  *
600
611
  * INTERCHANGE FIDELITY LIMITATION (verified, design §13.x): the interchange
601
612
  * `meta` schema has no `deletedAt` field, so a base row that is already
@@ -609,6 +620,18 @@ declare class BaseVersionMismatchError extends MergeError {
609
620
  * only) as the immutable reference, never against the clone (clones regenerate
610
621
  * `created_at`/`updated_at`, which would otherwise destabilize `base@V`).
611
622
  *
623
+ * `includeTemporal: true` carries `validFrom`/`validTo` through unchanged,
624
+ * preserving the base's exact valid-time window on the clone: create-time
625
+ * paths default an omitted `validFrom` to the row's own creation instant
626
+ * (see #240), and export/import round-trip a still-open-left `valid_from`
627
+ * (e.g. a row that predates the #240 fix) as an explicit `null` rather than
628
+ * silently dropping it — see `InterchangeNodeSchema.validFrom`'s doc.
629
+ * Without either half of this, the clone's re-import would re-stamp the
630
+ * affected base rows to the CLONE's creation instant instead — narrowing
631
+ * their validity window and making `asOf` reads on the fork diverge from
632
+ * identical reads on the base for any instant between the row's real
633
+ * creation and the clone.
634
+ *
612
635
  * Logical-namespace (copy-on-write within one backend, no full data copy) is a
613
636
  * future strategy slot — see the `WorkingCopyStrategy` interface — deferred past
614
637
  * P0.
@@ -637,29 +660,35 @@ type WorkingCopyStrategy<G extends GraphDef> = Readonly<{
637
660
  * in-process Postgres engine) be constructed lazily at branch time.
638
661
  *
639
662
  * The returned backend MUST be EMPTY (no rows for the base graph): the clone
640
- * seeds it from the base via `importGraph` with `onConflict: "error"`, so a
663
+ * seeds it from the base via `importGraphStream` with `onConflict: "error"`, so a
641
664
  * pre-existing row is surfaced as a {@link BranchError} rather than silently
642
665
  * skipped (which would leave the working copy diverging from the base).
666
+ * When the source store uses `revisionTracking`, the backend must also satisfy
667
+ * that option's transactional revision-clock requirements because the clone
668
+ * preserves the source's branchability contract.
643
669
  */
644
670
  type MakeBackend = () => Promise<GraphBackend>;
645
671
  /**
646
- * The P0 default working-copy strategy: faithful clone via export/import.
672
+ * The P0 default working-copy strategy: faithful clone via streamed interchange.
647
673
  *
648
674
  * On each `create(baseStore)`:
649
- * 1. `exportGraph(baseStore, { includeMeta: true, includeDeleted: false })` —
650
- * `includeMeta: true` carries `created_at`/`updated_at`; `includeDeleted:
651
- * false` keeps the clone to LIVE rows only. Shipping soft-deleted rows is
652
- * unsafe: the meta schema has no `deletedAt`, so they would import as live and
653
- * resurrect on the fork's diff (see the fidelity note above). `branch()` only
654
- * needs the base's live state.
675
+ * 1. `exportGraphStream(baseStore, { includeMeta: true, includeTemporal: true,
676
+ * includeDeleted: false })` — `includeMeta: true` carries
677
+ * `created_at`/`updated_at`; `includeTemporal: true` carries
678
+ * `validFrom`/`validTo` so the clone's valid-time window matches the base's
679
+ * exactly (see the fidelity note above); `includeDeleted: false` keeps the
680
+ * clone to LIVE rows only. Shipping soft-deleted rows is unsafe: the meta
681
+ * schema has no `deletedAt`, so they would import as live and resurrect on
682
+ * the fork's diff (see the fidelity note above). `branch()` only needs the
683
+ * base's live state.
655
684
  * 2. Create a fresh store over the caller-provided backend with the SAME graph
656
685
  * definition via `createStoreWithSchema`.
657
- * 3. `importGraph(freshStore, data, { onConflict: "error", ... })` — ids are
686
+ * 3. `importGraphStream(freshStore, data, { onConflict: "error", ... })` — ids are
658
687
  * preserved so the diff engine can key on them. `onConflict: "error"`
659
688
  * requires the backend to be EMPTY: a pre-existing row is a contract
660
689
  * violation that must surface loudly, never be silently skipped (a skipped
661
690
  * row would leave the clone diverging from the base, so the fork's diff would
662
- * report phantom modifications/deletions). `importGraph` RETURNS
691
+ * report phantom modifications/deletions). `importGraphStream` RETURNS
663
692
  * `{ success, errors }` rather than throwing on a per-row rejection, so its
664
693
  * result is checked and any failure fails the branch.
665
694
  *
@@ -682,7 +711,8 @@ declare function cloneWorkingCopyStrategy<G extends GraphDef>(makeBackend: MakeB
682
711
  * branch's own backend seeded with the base's live state.
683
712
  *
684
713
  * The copy mechanism is pluggable behind {@link WorkingCopyStrategy}. The P0
685
- * default is the faithful export/import clone ({@link cloneWorkingCopyStrategy}),
714
+ * default is the faithful streamed-interchange clone
715
+ * ({@link cloneWorkingCopyStrategy}),
686
716
  * which keeps this primitive backend-agnostic: the caller supplies a
687
717
  * `makeBackend` factory, and `branch()` never names a concrete backend.
688
718
  */
@@ -697,7 +727,7 @@ declare function cloneWorkingCopyStrategy<G extends GraphDef>(makeBackend: MakeB
697
727
  * logical-namespace copy-on-write).
698
728
  *
699
729
  * Returns a {@link Result}: success yields the {@link GraphBranch}; any failure
700
- * (base-version stamping, backend construction, export/import) is wrapped in a
730
+ * (base-version stamping, backend construction, streamed interchange) is wrapped in a
701
731
  * {@link BranchError} with the underlying cause attached. Errors are returned,
702
732
  * never thrown — this is internal-logic surface (the caller converts to a thrown
703
733
  * error at the framework boundary).
@@ -814,7 +844,7 @@ type CandidatePair<K extends NodeType = NodeType> = Readonly<{
814
844
  *
815
845
  * 1. PRECONDITION — compute the target's `base@V` and reject any branch whose
816
846
  * `base` token does not match it (`BaseVersionMismatchError`). A branch
817
- * forked from a divergent schema or content fingerprint cannot be merged
847
+ * forked from a divergent schema or base revision cannot be merged
818
848
  * safely (design §5.2 / §13.6).
819
849
  * 2. STAGE — `stageBranches` (T7): the provenance-tagged UNION of every
820
850
  * branch's state-diff against the immutable base.
@@ -1,30 +1,29 @@
1
- import { createStoreWithSchema } from '../chunk-WLRIWYHQ.js';
2
- import '../chunk-3EUKJEQ3.js';
3
- import '../chunk-QV245VMN.js';
4
- import { exportGraph, importGraph } from '../chunk-T2DWPQNE.js';
5
- import '../chunk-6SCVW4AS.js';
6
- import { defineNode, computeSchemaHash, serializeSchema } from '../chunk-K2TGS3EN.js';
1
+ import { createStoreWithSchema } from '../chunk-5DIPR3L3.js';
2
+ import '../chunk-RAXU3RMB.js';
3
+ import { importGraphStream, exportGraphStream } from '../chunk-PZKNKG5M.js';
4
+ import '../chunk-DN5VP4JC.js';
5
+ import { defineNode, computeSchemaHash, serializeSchema } from '../chunk-M75SUBFG.js';
6
+ import { getNodeKinds, getEdgeKinds, defineGraph } from '../chunk-SKCOUWAX.js';
7
7
  import { sortedReplacer } from '../chunk-UR7W5YQK.js';
8
- import { getNodeKinds, getEdgeKinds, defineGraph } from '../chunk-CHXTTSC6.js';
9
- import '../chunk-SHLY4MCM.js';
10
- import '../chunk-KUTNI6SI.js';
11
- import '../chunk-4DIBPQNJ.js';
12
- import { sha256Hex } from '../chunk-K34OPSJK.js';
13
- import '../chunk-BVTWD66D.js';
14
- import { ok, err, isErr, computeTransitiveClosure, isReachable } from '../chunk-ZURTTSCM.js';
15
- export { isErr, isOk, unwrap } from '../chunk-ZURTTSCM.js';
16
- import { compareStrings } from '../chunk-4S2FXGBJ.js';
17
- import { generateId, computeUniqueKey } from '../chunk-A7SZZFAG.js';
18
- import '../chunk-V3QNTB7Z.js';
19
- import '../chunk-XXVEULWX.js';
20
- import '../chunk-2MRAX3UE.js';
21
- import '../chunk-GZCNZ7QW.js';
22
- import '../chunk-2EBMPJBO.js';
23
- import '../chunk-Z5XBMDXU.js';
24
- import '../chunk-XLUNB2TZ.js';
8
+ import '../chunk-UZV3AZKF.js';
9
+ import '../chunk-OR5ZA5WP.js';
10
+ import { sha256Hex } from '../chunk-W63OVYY4.js';
11
+ import '../chunk-FPIZFYHE.js';
12
+ import '../chunk-5SEGFTZX.js';
13
+ import { ok, err, isErr, computeTransitiveClosure, isReachable } from '../chunk-SXGE7ITL.js';
14
+ export { isErr, isOk, unwrap } from '../chunk-SXGE7ITL.js';
15
+ import '../chunk-S5F7ZLP2.js';
16
+ import { compareStrings } from '../chunk-BYPOGQWK.js';
17
+ import { generateId, computeUniqueKey, lockRecordedGraphWrite, readRevisionOrigin, readRecordedClock } from '../chunk-5VTR2F2K.js';
18
+ import '../chunk-UT3S4SEN.js';
19
+ import '../chunk-IU46OHVW.js';
20
+ import '../chunk-JFUPDJXD.js';
21
+ import '../chunk-OHMP6N2J.js';
22
+ import '../chunk-KBGQIPRQ.js';
23
+ import '../chunk-SNXVDZAJ.js';
25
24
  import '../chunk-ITE4IXAK.js';
26
- import { TypeGraphError } from '../chunk-TQOYM4LN.js';
27
- import '../chunk-K5P5OZXS.js';
25
+ import { TypeGraphError } from '../chunk-WI7ISNQF.js';
26
+ import '../chunk-G6Q5UM7U.js';
28
27
  import { z } from 'zod';
29
28
 
30
29
  // src/graph-merge/canonical-props.ts
@@ -46,10 +45,14 @@ function edgeStateSignature(edge) {
46
45
  }
47
46
  function parseRowProps(props) {
48
47
  let parsed;
49
- try {
50
- parsed = JSON.parse(props);
51
- } catch {
52
- return {};
48
+ if (typeof props === "string") {
49
+ try {
50
+ parsed = JSON.parse(props);
51
+ } catch {
52
+ return {};
53
+ }
54
+ } else {
55
+ parsed = props;
53
56
  }
54
57
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
55
58
  return {};
@@ -93,7 +96,7 @@ function compareMergeKeys(left, right) {
93
96
  var ENUMERATION_PAGE_SIZE = 1e3;
94
97
  async function enumerateAllNodes(backend, graphId, kind) {
95
98
  const collected = [];
96
- let after = void 0;
99
+ let after;
97
100
  for (; ; ) {
98
101
  const page = await backend.findNodesByKind({
99
102
  graphId,
@@ -115,7 +118,7 @@ async function enumerateAllNodes(backend, graphId, kind) {
115
118
  }
116
119
  async function enumerateAllEdges(backend, graphId, kind) {
117
120
  const collected = [];
118
- let after = void 0;
121
+ let after;
119
122
  for (; ; ) {
120
123
  const page = await backend.findEdgesByKind({
121
124
  graphId,
@@ -344,6 +347,9 @@ function asBaseVersion(value) {
344
347
 
345
348
  // src/graph-merge/base-version.ts
346
349
  var TOKEN_SEPARATOR = "\0";
350
+ var REVISION_COMPONENT_PREFIX = "revision:";
351
+ var REVISION_COMPONENT_SEPARATOR = ":";
352
+ var INITIAL_REVISION = "initial";
347
353
  var FALLBACK_SCHEMA_VERSION = 1;
348
354
  async function readActiveSchemaVersion(backend, graphId) {
349
355
  const active = await backend.getActiveSchema(graphId);
@@ -404,6 +410,16 @@ async function computeContentComponent(backend, graphId, graph) {
404
410
  );
405
411
  }
406
412
  async function computeBaseVersion(store) {
413
+ if (store.revisionTrackingEnabled) {
414
+ const [schemaComponent2, origin, revision] = await Promise.all([
415
+ computeSchemaComponent(store),
416
+ store.revisionOriginNow(),
417
+ store.revisionNow()
418
+ ]);
419
+ return asBaseVersion(
420
+ `${schemaComponent2}${TOKEN_SEPARATOR}${revisionComponent(origin, revision)}`
421
+ );
422
+ }
407
423
  const [schemaComponent, contentComponent] = await Promise.all([
408
424
  computeSchemaComponent(store),
409
425
  computeContentComponent(store.backend, store.graphId, store.graph)
@@ -412,6 +428,30 @@ async function computeBaseVersion(store) {
412
428
  `${schemaComponent}${TOKEN_SEPARATOR}${contentComponent}`
413
429
  );
414
430
  }
431
+ function revisionComponent(origin, revision) {
432
+ return `${REVISION_COMPONENT_PREFIX}${origin}${REVISION_COMPONENT_SEPARATOR}${revision ?? INITIAL_REVISION}`;
433
+ }
434
+ function hasRevisionAnchor(version) {
435
+ return contentComponentOf(version).startsWith(REVISION_COMPONENT_PREFIX);
436
+ }
437
+ function revisionAnchorOf(version) {
438
+ const revision = revisionPartsOf(version)?.revision;
439
+ return revision === void 0 || revision === INITIAL_REVISION ? void 0 : revision;
440
+ }
441
+ function revisionOriginOf(version) {
442
+ return revisionPartsOf(version)?.origin;
443
+ }
444
+ function revisionPartsOf(version) {
445
+ const component = contentComponentOf(version);
446
+ if (!component.startsWith(REVISION_COMPONENT_PREFIX)) return void 0;
447
+ const encoded = component.slice(REVISION_COMPONENT_PREFIX.length);
448
+ const separator = encoded.indexOf(REVISION_COMPONENT_SEPARATOR);
449
+ if (separator <= 0 || separator === encoded.length - 1) return void 0;
450
+ return {
451
+ origin: encoded.slice(0, separator),
452
+ revision: encoded.slice(separator + 1)
453
+ };
454
+ }
415
455
  function contentComponentOf(version) {
416
456
  const separatorIndex = version.indexOf(TOKEN_SEPARATOR);
417
457
  return separatorIndex === -1 ? version : version.slice(separatorIndex + 1);
@@ -486,22 +526,32 @@ var CLONE_IMPORT_BATCH_SIZE = 1e3;
486
526
  function cloneWorkingCopyStrategy(makeBackend) {
487
527
  return {
488
528
  create: async (baseStore) => {
489
- const data = await exportGraph(baseStore, {
490
- includeMeta: true,
491
- includeDeleted: false
492
- });
493
529
  const backend = await makeBackend();
494
530
  try {
495
531
  const [freshStore] = await createStoreWithSchema(
496
532
  baseStore.graph,
497
- backend
533
+ backend,
534
+ {
535
+ // Keep descendants branchable with the same O(1) anchor contract,
536
+ // but do not copy recorded-time history into the disposable fork.
537
+ revisionTracking: baseStore.revisionTrackingEnabled
538
+ }
539
+ );
540
+ const result = await importGraphStream(
541
+ freshStore,
542
+ exportGraphStream(baseStore, {
543
+ includeMeta: true,
544
+ includeTemporal: true,
545
+ includeDeleted: false,
546
+ batchSize: CLONE_IMPORT_BATCH_SIZE
547
+ }),
548
+ {
549
+ onConflict: "error",
550
+ onUnknownProperty: "error",
551
+ validateReferences: true,
552
+ batchSize: CLONE_IMPORT_BATCH_SIZE
553
+ }
498
554
  );
499
- const result = await importGraph(freshStore, data, {
500
- onConflict: "error",
501
- onUnknownProperty: "error",
502
- validateReferences: true,
503
- batchSize: CLONE_IMPORT_BATCH_SIZE
504
- });
505
555
  if (!result.success) {
506
556
  throw new BranchError(
507
557
  "Clone import failed: the working copy could not be seeded from the base store. The backend returned by makeBackend() must be empty.",
@@ -899,6 +949,7 @@ var UnionFind = class {
899
949
  constructor(compare) {
900
950
  this.compare = compare;
901
951
  }
952
+ compare;
902
953
  parent = /* @__PURE__ */ new Map();
903
954
  /** Adds `value` as its own singleton set if it is not already present. */
904
955
  add(value) {
@@ -3338,13 +3389,50 @@ async function commitPlan(target, plan, expectedBaseVersion) {
3338
3389
  tx.nodes,
3339
3390
  tx.edges
3340
3391
  );
3341
- }, MERGE_COMMIT_TX_OPTIONS)
3392
+ }, mergeCommitTransactionOptions(target))
3342
3393
  );
3343
3394
  }
3344
3395
  var MERGE_COMMIT_TX_OPTIONS = {
3345
3396
  isolationLevel: "serializable"
3346
3397
  };
3398
+ function mergeCommitTransactionOptions(target) {
3399
+ return target.historyEnabled ? void 0 : MERGE_COMMIT_TX_OPTIONS;
3400
+ }
3347
3401
  async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
3402
+ if (hasRevisionAnchor(expectedBaseVersion)) {
3403
+ await lockRecordedGraphWrite(txBackend, target.graphId);
3404
+ const expectedOrigin = revisionOriginOf(expectedBaseVersion);
3405
+ const liveOrigin = await readRevisionOrigin(
3406
+ txBackend,
3407
+ target.revisionSchema,
3408
+ target.graphId
3409
+ );
3410
+ if (liveOrigin !== expectedOrigin) {
3411
+ throw new BaseVersionMismatchError(
3412
+ "The merge branch was forked from a different revision-tracked store; the resolved plan was not applied.",
3413
+ {
3414
+ details: { expectedOrigin, liveOrigin },
3415
+ suggestion: "Merge the branch back into its original base store, or fork a new branch from this target."
3416
+ }
3417
+ );
3418
+ }
3419
+ const liveRevision = await readRecordedClock(
3420
+ txBackend,
3421
+ target.revisionSchema,
3422
+ target.graphId
3423
+ );
3424
+ const expectedRevision = revisionAnchorOf(expectedBaseVersion);
3425
+ if (liveRevision !== expectedRevision) {
3426
+ throw new BaseVersionMismatchError(
3427
+ "The merge target was modified between the revision-anchor check and the commit transaction; the resolved plan was not applied.",
3428
+ {
3429
+ details: { expectedRevision, liveRevision },
3430
+ suggestion: "Re-run the merge (and re-branch if the divergence is real), or route all graph writes through the revision-tracked Store."
3431
+ }
3432
+ );
3433
+ }
3434
+ return;
3435
+ }
3348
3436
  const liveContent = await computeContentComponent(
3349
3437
  txBackend,
3350
3438
  target.graphId,
@@ -4022,6 +4110,9 @@ async function commitIncrementalPlan(target, plan, guard) {
4022
4110
  }
4023
4111
  return withTxConflictRetry(
4024
4112
  () => target.transaction(async (tx) => {
4113
+ if (target.revisionTrackingEnabled) {
4114
+ await lockRecordedGraphWrite(tx.backend, target.graphId);
4115
+ }
4025
4116
  const nodesApi = tx.nodes;
4026
4117
  const edgesApi = tx.edges;
4027
4118
  await assertBaseResolutionStable(tx, guard);
@@ -4029,7 +4120,7 @@ async function commitIncrementalPlan(target, plan, guard) {
4029
4120
  await validateIncrementalNodeWrites(target, nodesApi, plan);
4030
4121
  await validateIncrementalEdgeWrites(target, edgesApi, plan);
4031
4122
  return applyMergePlan(plan, nodesApi, edgesApi);
4032
- }, MERGE_COMMIT_TX_OPTIONS)
4123
+ }, mergeCommitTransactionOptions(target))
4033
4124
  );
4034
4125
  }
4035
4126
  async function mergeIncremental(args) {