@nicia-ai/typegraph 0.32.0 → 0.34.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 (264) hide show
  1. package/README.md +51 -0
  2. package/dist/backend/postgres/index.cjs +36 -19
  3. package/dist/backend/postgres/index.d.cts +6 -6
  4. package/dist/backend/postgres/index.d.ts +6 -6
  5. package/dist/backend/postgres/index.js +14 -9
  6. package/dist/backend/postgres/pglite.cjs +18 -13
  7. package/dist/backend/postgres/pglite.cjs.map +1 -1
  8. package/dist/backend/postgres/pglite.d.cts +3 -3
  9. package/dist/backend/postgres/pglite.d.ts +3 -3
  10. package/dist/backend/postgres/pglite.js +14 -9
  11. package/dist/backend/postgres/pglite.js.map +1 -1
  12. package/dist/backend/sqlite/index.cjs +34 -17
  13. package/dist/backend/sqlite/index.d.cts +7 -7
  14. package/dist/backend/sqlite/index.d.ts +7 -7
  15. package/dist/backend/sqlite/index.js +13 -8
  16. package/dist/backend/sqlite/libsql.cjs +19 -14
  17. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  18. package/dist/backend/sqlite/libsql.d.cts +12 -5
  19. package/dist/backend/sqlite/libsql.d.ts +12 -5
  20. package/dist/backend/sqlite/libsql.js +15 -10
  21. package/dist/backend/sqlite/libsql.js.map +1 -1
  22. package/dist/backend/sqlite/local.cjs +19 -14
  23. package/dist/backend/sqlite/local.cjs.map +1 -1
  24. package/dist/backend/sqlite/local.d.cts +3 -3
  25. package/dist/backend/sqlite/local.d.ts +3 -3
  26. package/dist/backend/sqlite/local.js +14 -9
  27. package/dist/backend/sqlite/local.js.map +1 -1
  28. package/dist/chunk-2EBMPJBO.js +16 -0
  29. package/dist/chunk-2EBMPJBO.js.map +1 -0
  30. package/dist/{chunk-CFNT3ITG.cjs → chunk-2JXB3NYJ.cjs} +15 -35
  31. package/dist/chunk-2JXB3NYJ.cjs.map +1 -0
  32. package/dist/chunk-2MRAX3UE.js +105 -0
  33. package/dist/chunk-2MRAX3UE.js.map +1 -0
  34. package/dist/{chunk-2LAT5BIK.cjs → chunk-3BRVBQQD.cjs} +2328 -3131
  35. package/dist/chunk-3BRVBQQD.cjs.map +1 -0
  36. package/dist/chunk-3E7SNSIA.cjs +55 -0
  37. package/dist/chunk-3E7SNSIA.cjs.map +1 -0
  38. package/dist/{chunk-FDN43KXV.cjs → chunk-3Z6TW3CT.cjs} +20 -19
  39. package/dist/chunk-3Z6TW3CT.cjs.map +1 -0
  40. package/dist/{chunk-IJORSAC3.js → chunk-4DIBPQNJ.js} +6 -4
  41. package/dist/chunk-4DIBPQNJ.js.map +1 -0
  42. package/dist/chunk-4S2FXGBJ.js +9 -0
  43. package/dist/chunk-4S2FXGBJ.js.map +1 -0
  44. package/dist/chunk-5IQIX7LU.cjs +2070 -0
  45. package/dist/chunk-5IQIX7LU.cjs.map +1 -0
  46. package/dist/{chunk-CWFPJ3RC.js → chunk-6GNSY7AV.js} +3 -3
  47. package/dist/{chunk-CWFPJ3RC.js.map → chunk-6GNSY7AV.js.map} +1 -1
  48. package/dist/{chunk-LAZGHOZW.cjs → chunk-6HVOHZHS.cjs} +184 -117
  49. package/dist/chunk-6HVOHZHS.cjs.map +1 -0
  50. package/dist/chunk-6SCVW4AS.js +20 -0
  51. package/dist/chunk-6SCVW4AS.js.map +1 -0
  52. package/dist/chunk-A7SZZFAG.js +2010 -0
  53. package/dist/chunk-A7SZZFAG.js.map +1 -0
  54. package/dist/chunk-ACSVZPK7.cjs +21 -0
  55. package/dist/chunk-ACSVZPK7.cjs.map +1 -0
  56. package/dist/{chunk-MXE2U3EX.js → chunk-BVTWD66D.js} +4 -115
  57. package/dist/chunk-BVTWD66D.js.map +1 -0
  58. package/dist/{chunk-W4ZX2GCP.js → chunk-CHXTTSC6.js} +5 -39
  59. package/dist/chunk-CHXTTSC6.js.map +1 -0
  60. package/dist/{chunk-XQFAJVYW.js → chunk-CYX2JTDG.js} +124 -5
  61. package/dist/chunk-CYX2JTDG.js.map +1 -0
  62. package/dist/{chunk-PRMKPFN5.js → chunk-DEQFL35G.js} +4 -3
  63. package/dist/chunk-DEQFL35G.js.map +1 -0
  64. package/dist/chunk-DI74SMXS.cjs +29 -0
  65. package/dist/chunk-DI74SMXS.cjs.map +1 -0
  66. package/dist/{chunk-WWVV44DY.cjs → chunk-G6SOJEDI.cjs} +11 -11
  67. package/dist/{chunk-WWVV44DY.cjs.map → chunk-G6SOJEDI.cjs.map} +1 -1
  68. package/dist/{chunk-LM2IC4ZJ.cjs → chunk-GQANNXXT.cjs} +15 -14
  69. package/dist/chunk-GQANNXXT.cjs.map +1 -0
  70. package/dist/chunk-GZCNZ7QW.js +24 -0
  71. package/dist/chunk-GZCNZ7QW.js.map +1 -0
  72. package/dist/{chunk-KTIEB7VH.cjs → chunk-HK5SATYM.cjs} +35 -58
  73. package/dist/chunk-HK5SATYM.cjs.map +1 -0
  74. package/dist/chunk-HMFK4BXR.cjs +12 -0
  75. package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-HMFK4BXR.cjs.map} +1 -1
  76. package/dist/chunk-ITE4IXAK.js +25 -0
  77. package/dist/chunk-ITE4IXAK.js.map +1 -0
  78. package/dist/chunk-JJRCLAUN.cjs +155 -0
  79. package/dist/chunk-JJRCLAUN.cjs.map +1 -0
  80. package/dist/{chunk-ZFWNO3GE.cjs → chunk-JQGIPGVL.cjs} +66 -2
  81. package/dist/chunk-JQGIPGVL.cjs.map +1 -0
  82. package/dist/{chunk-2BVHPOIG.js → chunk-K2TGS3EN.js} +105 -38
  83. package/dist/chunk-K2TGS3EN.js.map +1 -0
  84. package/dist/chunk-K34OPSJK.js +29 -0
  85. package/dist/chunk-K34OPSJK.js.map +1 -0
  86. package/dist/{chunk-YW7GHMF4.cjs → chunk-KGC4LY5T.cjs} +18 -17
  87. package/dist/chunk-KGC4LY5T.cjs.map +1 -0
  88. package/dist/{chunk-SB65GJNY.cjs → chunk-KNHYNQQ3.cjs} +111 -72
  89. package/dist/chunk-KNHYNQQ3.cjs.map +1 -0
  90. package/dist/{chunk-C4C4Q7A6.js → chunk-KUTNI6SI.js} +6 -21
  91. package/dist/chunk-KUTNI6SI.js.map +1 -0
  92. package/dist/{chunk-NDM5PXEH.js → chunk-LANHCOXB.js} +44 -11
  93. package/dist/chunk-LANHCOXB.js.map +1 -0
  94. package/dist/chunk-N6WTUSBV.cjs +23 -0
  95. package/dist/chunk-N6WTUSBV.cjs.map +1 -0
  96. package/dist/{chunk-73KASJGO.cjs → chunk-NAUA4PW5.cjs} +4 -28
  97. package/dist/chunk-NAUA4PW5.cjs.map +1 -0
  98. package/dist/chunk-QV245VMN.js +145 -0
  99. package/dist/chunk-QV245VMN.js.map +1 -0
  100. package/dist/{chunk-CEF2QOTO.js → chunk-RBV7YCQD.js} +4 -3
  101. package/dist/chunk-RBV7YCQD.js.map +1 -0
  102. package/dist/chunk-RHZWOJVA.cjs +109 -0
  103. package/dist/chunk-RHZWOJVA.cjs.map +1 -0
  104. package/dist/{chunk-6RMLO5O4.cjs → chunk-RRKQAKD6.cjs} +13 -11
  105. package/dist/chunk-RRKQAKD6.cjs.map +1 -0
  106. package/dist/{chunk-TUA3MEJJ.js → chunk-RY2VIWAM.js} +612 -564
  107. package/dist/chunk-RY2VIWAM.js.map +1 -0
  108. package/dist/{chunk-PIHXFF73.js → chunk-SHLY4MCM.js} +3 -3
  109. package/dist/{chunk-PIHXFF73.js.map → chunk-SHLY4MCM.js.map} +1 -1
  110. package/dist/{chunk-HFBRAOF7.js → chunk-T2DWPQNE.js} +103 -64
  111. package/dist/chunk-T2DWPQNE.js.map +1 -0
  112. package/dist/{chunk-WYTUF3QO.js → chunk-T46GR2VY.js} +3 -3
  113. package/dist/{chunk-WYTUF3QO.js.map → chunk-T46GR2VY.js.map} +1 -1
  114. package/dist/{chunk-EEYV6UOE.cjs → chunk-T6SPUYLX.cjs} +5 -43
  115. package/dist/chunk-T6SPUYLX.cjs.map +1 -0
  116. package/dist/{chunk-3QRBXYT5.cjs → chunk-TGJE22RM.cjs} +6 -6
  117. package/dist/{chunk-3QRBXYT5.cjs.map → chunk-TGJE22RM.cjs.map} +1 -1
  118. package/dist/{chunk-YL4F3CMD.cjs → chunk-TOTPVGOG.cjs} +105 -72
  119. package/dist/chunk-TOTPVGOG.cjs.map +1 -0
  120. package/dist/{chunk-3HQDMOBK.cjs → chunk-UJLOZYKT.cjs} +680 -636
  121. package/dist/chunk-UJLOZYKT.cjs.map +1 -0
  122. package/dist/chunk-UNNPKQUG.cjs +1390 -0
  123. package/dist/chunk-UNNPKQUG.cjs.map +1 -0
  124. package/dist/chunk-UR7W5YQK.js +18 -0
  125. package/dist/chunk-UR7W5YQK.js.map +1 -0
  126. package/dist/chunk-V3QNTB7Z.js +1351 -0
  127. package/dist/chunk-V3QNTB7Z.js.map +1 -0
  128. package/dist/{chunk-XKNAK27R.js → chunk-VCGO4V26.js} +4 -3
  129. package/dist/chunk-VCGO4V26.js.map +1 -0
  130. package/dist/{chunk-YQGLVWB2.cjs → chunk-WL2SG7ZV.cjs} +6 -122
  131. package/dist/chunk-WL2SG7ZV.cjs.map +1 -0
  132. package/dist/{chunk-WNORITK6.js → chunk-WLRIWYHQ.js} +2041 -2834
  133. package/dist/chunk-WLRIWYHQ.js.map +1 -0
  134. package/dist/{chunk-JKRKIEVA.cjs → chunk-WVC2Q2FD.cjs} +128 -6
  135. package/dist/chunk-WVC2Q2FD.cjs.map +1 -0
  136. package/dist/chunk-XLUNB2TZ.js +53 -0
  137. package/dist/chunk-XLUNB2TZ.js.map +1 -0
  138. package/dist/chunk-XXVEULWX.js +39 -0
  139. package/dist/chunk-XXVEULWX.js.map +1 -0
  140. package/dist/chunk-YAZE7QZR.cjs +32 -0
  141. package/dist/chunk-YAZE7QZR.cjs.map +1 -0
  142. package/dist/chunk-YC6PWTHY.cjs +44 -0
  143. package/dist/chunk-YC6PWTHY.cjs.map +1 -0
  144. package/dist/chunk-Z5HBYM7U.cjs +11 -0
  145. package/dist/chunk-Z5HBYM7U.cjs.map +1 -0
  146. package/dist/{chunk-454I6GDF.js → chunk-Z5XBMDXU.js} +63 -3
  147. package/dist/chunk-Z5XBMDXU.js.map +1 -0
  148. package/dist/{chunk-CAMMC3E4.cjs → chunk-ZP5WHI4C.cjs} +109 -81
  149. package/dist/chunk-ZP5WHI4C.cjs.map +1 -0
  150. package/dist/{chunk-YCV72E6L.js → chunk-ZURTTSCM.js} +4 -25
  151. package/dist/chunk-ZURTTSCM.js.map +1 -0
  152. package/dist/{chunk-7WW3WL6E.js → chunk-ZV5N4DBG.js} +49 -21
  153. package/dist/chunk-ZV5N4DBG.js.map +1 -0
  154. package/dist/chunk-ZY4GXIVN.cjs +32 -0
  155. package/dist/chunk-ZY4GXIVN.cjs.map +1 -0
  156. package/dist/{ddl-C8e8zDAE.d.ts → ddl-BrmPg61z.d.ts} +3 -3
  157. package/dist/{ddl-CwyG4HoQ.d.cts → ddl-j1-sH6lE.d.cts} +3 -3
  158. package/dist/{extension-types-D1k0inWU.d.cts → extension-types-YGFJPrzK.d.cts} +1 -1
  159. package/dist/{extension-types-D1k0inWU.d.ts → extension-types-YGFJPrzK.d.ts} +1 -1
  160. package/dist/graph-extension/index.cjs +18 -17
  161. package/dist/graph-extension/index.d.cts +4 -4
  162. package/dist/graph-extension/index.d.ts +4 -4
  163. package/dist/graph-extension/index.js +3 -2
  164. package/dist/graph-merge/index.cjs +295 -146
  165. package/dist/graph-merge/index.cjs.map +1 -1
  166. package/dist/graph-merge/index.d.cts +6 -6
  167. package/dist/graph-merge/index.d.ts +6 -6
  168. package/dist/graph-merge/index.js +173 -24
  169. package/dist/graph-merge/index.js.map +1 -1
  170. package/dist/{index-BEK0VtNB.d.ts → index-DGX6D9j1.d.ts} +2 -2
  171. package/dist/{index-C8sSTErx.d.cts → index-SEvUHDA6.d.cts} +2 -2
  172. package/dist/index.cjs +206 -172
  173. package/dist/index.cjs.map +1 -1
  174. package/dist/index.d.cts +25 -55
  175. package/dist/index.d.ts +25 -55
  176. package/dist/index.js +32 -22
  177. package/dist/index.js.map +1 -1
  178. package/dist/indexes/index.cjs +28 -25
  179. package/dist/indexes/index.d.cts +5 -5
  180. package/dist/indexes/index.d.ts +5 -5
  181. package/dist/indexes/index.js +10 -7
  182. package/dist/interchange/index.cjs +25 -16
  183. package/dist/interchange/index.d.cts +5 -5
  184. package/dist/interchange/index.d.ts +5 -5
  185. package/dist/interchange/index.js +12 -3
  186. package/dist/{manager-8htmuGr-.d.ts → manager-BZUeN_BU.d.ts} +2 -2
  187. package/dist/{manager-aVgxbGt-.d.cts → manager-ms9cKdc6.d.cts} +2 -2
  188. package/dist/{materialize-indexes-CAGhqPHQ.d.ts → materialize-indexes-CAkIYFV-.d.ts} +1 -1
  189. package/dist/{materialize-indexes-DEYkU-wr.d.cts → materialize-indexes-D20xNluI.d.cts} +1 -1
  190. package/dist/{postgres-Dhom7iiX.d.ts → postgres-BhpxGMC5.d.cts} +2651 -596
  191. package/dist/{postgres-jgXmD45C.d.cts → postgres-CWHLwNl1.d.ts} +2651 -596
  192. package/dist/profiler/index.cjs +5 -4
  193. package/dist/profiler/index.cjs.map +1 -1
  194. package/dist/profiler/index.d.cts +7 -7
  195. package/dist/profiler/index.d.ts +7 -7
  196. package/dist/profiler/index.js +3 -2
  197. package/dist/profiler/index.js.map +1 -1
  198. package/dist/provenance/index.cjs +591 -0
  199. package/dist/provenance/index.cjs.map +1 -0
  200. package/dist/provenance/index.d.cts +73 -0
  201. package/dist/provenance/index.d.ts +73 -0
  202. package/dist/provenance/index.js +589 -0
  203. package/dist/provenance/index.js.map +1 -0
  204. package/dist/schema/index.cjs +37 -32
  205. package/dist/schema/index.cjs.map +1 -1
  206. package/dist/schema/index.d.cts +7 -7
  207. package/dist/schema/index.d.ts +7 -7
  208. package/dist/schema/index.js +14 -9
  209. package/dist/schema/index.js.map +1 -1
  210. package/dist/{sqlite-DcQ_BCUW.d.cts → sqlite-CGu5SLsw.d.ts} +2726 -455
  211. package/dist/{sqlite-BfLsCEqO.d.ts → sqlite-XrDxNaa7.d.cts} +2726 -455
  212. package/dist/{store-view-pBOUrQte.d.ts → store-view-BlgnhEYf.d.ts} +467 -131
  213. package/dist/{store-view-lTcb_cnp.d.cts → store-view-D09po4H6.d.cts} +467 -131
  214. package/dist/{types-DGDiXAYc.d.ts → types-B1TbZJYS.d.ts} +2 -2
  215. package/dist/{types-Dk8r09KY.d.ts → types-D1Sqeyxy.d.ts} +161 -26
  216. package/dist/{types-5RQwzWXx.d.cts → types-DiE1AO7p.d.cts} +2 -2
  217. package/dist/{types-Dvmn-eal.d.cts → types-DkNnF-7K.d.cts} +161 -26
  218. package/dist/{where-Cx_glEEB.d.cts → where-DKjuofPr.d.cts} +2 -2
  219. package/dist/{where-CHZFELX0.d.ts → where-DrUIIWHb.d.ts} +2 -2
  220. package/package.json +8 -2
  221. package/dist/chunk-2BVHPOIG.js.map +0 -1
  222. package/dist/chunk-2LAT5BIK.cjs.map +0 -1
  223. package/dist/chunk-2YMGNYXY.js +0 -40
  224. package/dist/chunk-2YMGNYXY.js.map +0 -1
  225. package/dist/chunk-3HQDMOBK.cjs.map +0 -1
  226. package/dist/chunk-454I6GDF.js.map +0 -1
  227. package/dist/chunk-6G35I3VW.cjs +0 -40
  228. package/dist/chunk-6G35I3VW.cjs.map +0 -1
  229. package/dist/chunk-6RMLO5O4.cjs.map +0 -1
  230. package/dist/chunk-6ZR4QC3O.cjs +0 -12
  231. package/dist/chunk-73KASJGO.cjs.map +0 -1
  232. package/dist/chunk-7WW3WL6E.js.map +0 -1
  233. package/dist/chunk-C4C4Q7A6.js.map +0 -1
  234. package/dist/chunk-CAMMC3E4.cjs.map +0 -1
  235. package/dist/chunk-CEF2QOTO.js.map +0 -1
  236. package/dist/chunk-CFNT3ITG.cjs.map +0 -1
  237. package/dist/chunk-EEYV6UOE.cjs.map +0 -1
  238. package/dist/chunk-FDN43KXV.cjs.map +0 -1
  239. package/dist/chunk-HFBRAOF7.js.map +0 -1
  240. package/dist/chunk-IJORSAC3.js.map +0 -1
  241. package/dist/chunk-JKRKIEVA.cjs.map +0 -1
  242. package/dist/chunk-KTIEB7VH.cjs.map +0 -1
  243. package/dist/chunk-LAZGHOZW.cjs.map +0 -1
  244. package/dist/chunk-LM2IC4ZJ.cjs.map +0 -1
  245. package/dist/chunk-M6OC455F.js +0 -65
  246. package/dist/chunk-M6OC455F.js.map +0 -1
  247. package/dist/chunk-MXE2U3EX.js.map +0 -1
  248. package/dist/chunk-NDM5PXEH.js.map +0 -1
  249. package/dist/chunk-PRMKPFN5.js.map +0 -1
  250. package/dist/chunk-RP7YITHX.cjs +0 -70
  251. package/dist/chunk-RP7YITHX.cjs.map +0 -1
  252. package/dist/chunk-SAJSMR2B.js +0 -35
  253. package/dist/chunk-SAJSMR2B.js.map +0 -1
  254. package/dist/chunk-SB65GJNY.cjs.map +0 -1
  255. package/dist/chunk-TUA3MEJJ.js.map +0 -1
  256. package/dist/chunk-W4ZX2GCP.js.map +0 -1
  257. package/dist/chunk-WNORITK6.js.map +0 -1
  258. package/dist/chunk-XKNAK27R.js.map +0 -1
  259. package/dist/chunk-XQFAJVYW.js.map +0 -1
  260. package/dist/chunk-YCV72E6L.js.map +0 -1
  261. package/dist/chunk-YL4F3CMD.cjs.map +0 -1
  262. package/dist/chunk-YQGLVWB2.cjs.map +0 -1
  263. package/dist/chunk-YW7GHMF4.cjs.map +0 -1
  264. package/dist/chunk-ZFWNO3GE.cjs.map +0 -1
@@ -1,13 +1,13 @@
1
- import { G as GraphDef, t as NodeKinds, u as GetNodeType } from '../manager-aVgxbGt-.cjs';
2
- import { S as Store, N as Node, U as UniqueIntrospection } from '../store-view-lTcb_cnp.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-D1k0inWU.cjs';
4
- import { T as TypeGraphError } from '../index-C8sSTErx.cjs';
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';
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-Dvmn-eal.cjs';
7
+ import { G as GraphBackend, M as MetaEdge, I as IndexDeclaration } from '../types-DkNnF-7K.cjs';
8
8
  import { z } from 'zod';
9
+ import '../materialize-indexes-D20xNluI.cjs';
9
10
  import 'drizzle-orm';
10
- import '../materialize-indexes-DEYkU-wr.cjs';
11
11
  import 'drizzle-orm/pg-core';
12
12
  import 'drizzle-orm/sqlite-core';
13
13
 
@@ -1,13 +1,13 @@
1
- import { G as GraphDef, t as NodeKinds, u as GetNodeType } from '../manager-8htmuGr-.js';
2
- import { S as Store, N as Node, U as UniqueIntrospection } from '../store-view-pBOUrQte.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-D1k0inWU.js';
4
- import { T as TypeGraphError } from '../index-BEK0VtNB.js';
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';
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-Dk8r09KY.js';
7
+ import { G as GraphBackend, M as MetaEdge, I as IndexDeclaration } from '../types-D1Sqeyxy.js';
8
8
  import { z } from 'zod';
9
+ import '../materialize-indexes-CAkIYFV-.js';
9
10
  import 'drizzle-orm';
10
- import '../materialize-indexes-CAGhqPHQ.js';
11
11
  import 'drizzle-orm/pg-core';
12
12
  import 'drizzle-orm/sqlite-core';
13
13
 
@@ -1,18 +1,28 @@
1
- import { createStoreWithSchema, generateId, computeUniqueKey } from '../chunk-WNORITK6.js';
1
+ import { createStoreWithSchema } from '../chunk-WLRIWYHQ.js';
2
2
  import '../chunk-3EUKJEQ3.js';
3
- import { exportGraph, importGraph } from '../chunk-HFBRAOF7.js';
4
- import { defineNode, computeSchemaHash, serializeSchema } from '../chunk-2BVHPOIG.js';
5
- import { getNodeKinds, getEdgeKinds, defineGraph } from '../chunk-W4ZX2GCP.js';
6
- import '../chunk-PIHXFF73.js';
7
- import '../chunk-IJORSAC3.js';
8
- import '../chunk-MXE2U3EX.js';
9
- import '../chunk-454I6GDF.js';
10
- import { ok, err, isErr, computeTransitiveClosure, isReachable } from '../chunk-YCV72E6L.js';
11
- export { isErr, isOk, unwrap } from '../chunk-YCV72E6L.js';
12
- import '../chunk-SAJSMR2B.js';
13
- import { sortedReplacer } from '../chunk-M6OC455F.js';
14
- import '../chunk-C4C4Q7A6.js';
15
- import { sha256Hex } from '../chunk-2YMGNYXY.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';
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';
25
+ import '../chunk-ITE4IXAK.js';
16
26
  import { TypeGraphError } from '../chunk-TQOYM4LN.js';
17
27
  import '../chunk-K5P5OZXS.js';
18
28
  import { z } from 'zod';
@@ -24,6 +34,16 @@ function canonicalizeProps(props) {
24
34
  function canonicalValueKey(value) {
25
35
  return JSON.stringify(value, sortedReplacer);
26
36
  }
37
+ function edgeStateSignature(edge) {
38
+ return JSON.stringify([
39
+ edge.fromKind,
40
+ edge.fromId,
41
+ edge.toKind,
42
+ edge.toId,
43
+ edge.live,
44
+ canonicalizeProps(edge.props)
45
+ ]);
46
+ }
27
47
  function parseRowProps(props) {
28
48
  let parsed;
29
49
  try {
@@ -47,9 +67,6 @@ function mergeKey(kind, id) {
47
67
  }
48
68
  return `${kind}${SEPARATOR}${id}`;
49
69
  }
50
- function compareStrings(left, right) {
51
- return left < right ? -1 : left > right ? 1 : 0;
52
- }
53
70
  function mergeKeyOf(node) {
54
71
  return mergeKey(node.kind, node.id);
55
72
  }
@@ -225,13 +242,14 @@ function diffEdgeKind(kind, baseRows, forkRows) {
225
242
  function byId(left, right) {
226
243
  return compareStrings(left.id, right.id);
227
244
  }
228
- async function diffAgainstBase(baseStore, forkStore) {
245
+ async function diffAgainstBase(baseStore, forkStore, captureForkState = true) {
229
246
  const graph = baseStore.graph;
230
247
  const nodeKinds = getNodeKinds(graph);
231
248
  const edgeKinds = getEdgeKinds(graph);
232
249
  const newNodes = [];
233
250
  const modifiedNodes = [];
234
251
  const deletedNodes = [];
252
+ const forkNodeVersions = /* @__PURE__ */ new Map();
235
253
  for (const kind of nodeKinds) {
236
254
  const baseRows = await enumerateAllNodes(
237
255
  baseStore.backend,
@@ -243,6 +261,11 @@ async function diffAgainstBase(baseStore, forkStore) {
243
261
  forkStore.graphId,
244
262
  kind
245
263
  );
264
+ if (captureForkState) {
265
+ for (const row of forkRows) {
266
+ forkNodeVersions.set(mergeKey(kind, row.id), row.version);
267
+ }
268
+ }
246
269
  const delta = diffNodeKind(kind, baseRows, forkRows);
247
270
  for (const entry of delta.new) {
248
271
  newNodes.push(entry);
@@ -257,6 +280,7 @@ async function diffAgainstBase(baseStore, forkStore) {
257
280
  const newEdges = [];
258
281
  const modifiedEdges = [];
259
282
  const deletedEdges = [];
283
+ const forkEdgeSignatures = /* @__PURE__ */ new Map();
260
284
  for (const kind of edgeKinds) {
261
285
  const baseRows = await enumerateAllEdges(
262
286
  baseStore.backend,
@@ -268,6 +292,21 @@ async function diffAgainstBase(baseStore, forkStore) {
268
292
  forkStore.graphId,
269
293
  kind
270
294
  );
295
+ if (captureForkState) {
296
+ for (const row of forkRows) {
297
+ forkEdgeSignatures.set(
298
+ mergeKey(kind, row.id),
299
+ edgeStateSignature({
300
+ fromKind: row.from_kind,
301
+ fromId: row.from_id,
302
+ toKind: row.to_kind,
303
+ toId: row.to_id,
304
+ live: isLive(row),
305
+ props: parseRowProps(row.props)
306
+ })
307
+ );
308
+ }
309
+ }
271
310
  const delta = diffEdgeKind(kind, baseRows, forkRows);
272
311
  for (const entry of delta.new) {
273
312
  newEdges.push(entry);
@@ -289,7 +328,9 @@ async function diffAgainstBase(baseStore, forkStore) {
289
328
  new: newEdges.sort((left, right) => byId(left, right)),
290
329
  modified: modifiedEdges.sort((left, right) => byId(left, right)),
291
330
  deleted: deletedEdges.sort((left, right) => byId(left, right))
292
- }
331
+ },
332
+ forkNodeVersions,
333
+ forkEdgeSignatures
293
334
  };
294
335
  }
295
336
 
@@ -2460,16 +2501,26 @@ function groupByKind(items) {
2460
2501
  }
2461
2502
  return ordered;
2462
2503
  }
2463
- async function stageBranches(baseStore, branches) {
2504
+ async function stageBranches(baseStore, branches, captureTargetStateFor) {
2464
2505
  const newNodes = [];
2465
2506
  const modifiedNodes = [];
2466
2507
  const deletedNodes = [];
2467
2508
  const newEdges = [];
2468
2509
  const modifiedEdges = [];
2469
2510
  const deletedEdges = [];
2511
+ let targetNodeVersions = /* @__PURE__ */ new Map();
2512
+ let targetEdgeSignatures = /* @__PURE__ */ new Map();
2470
2513
  for (const branch2 of branches) {
2471
- const diff = await diffAgainstBase(baseStore, branch2.store);
2472
2514
  const branchId = branch2.id;
2515
+ const diff = await diffAgainstBase(
2516
+ baseStore,
2517
+ branch2.store,
2518
+ branchId === captureTargetStateFor
2519
+ );
2520
+ if (branchId === captureTargetStateFor) {
2521
+ targetNodeVersions = diff.forkNodeVersions;
2522
+ targetEdgeSignatures = diff.forkEdgeSignatures;
2523
+ }
2473
2524
  for (const node of diff.nodes.new) {
2474
2525
  newNodes.push({ branchId, node, kind: node.kind, id: node.id });
2475
2526
  }
@@ -2503,7 +2554,9 @@ async function stageBranches(baseStore, branches) {
2503
2554
  ),
2504
2555
  deletedEdges: [...deletedEdges].sort(
2505
2556
  (left, right) => compareByKindIdBranch(left, right)
2506
- )
2557
+ ),
2558
+ targetNodeVersions,
2559
+ targetEdgeSignatures
2507
2560
  };
2508
2561
  }
2509
2562
 
@@ -3380,8 +3433,8 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
3380
3433
  }
3381
3434
  }
3382
3435
  try {
3383
- const staging = await stageBranches(store, branches);
3384
3436
  const preferredBranchId = incremental?.targetBranchId;
3437
+ const staging = await stageBranches(store, branches, preferredBranchId);
3385
3438
  const branchIds = branches.map((branch2) => branch2.id);
3386
3439
  const branchOrder = preferredBranchId === void 0 ? options.branchOrder ?? [] : [
3387
3440
  preferredBranchId,
@@ -3435,7 +3488,9 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
3435
3488
  // anything NEW the in-tx re-probe surfaces is a window write.
3436
3489
  plannedBaseMatchKeys: new Set(
3437
3490
  candidates.data.baseMembers.map((member) => mergeKeyOf(member))
3438
- )
3491
+ ),
3492
+ targetNodeVersions: staging.targetNodeVersions,
3493
+ targetEdgeSignatures: staging.targetEdgeSignatures
3439
3494
  });
3440
3495
  const provenance = options.provenance ? buildProvenanceIndex(plan.provenanceRecords) : { byBranch: () => ({ nodeIds: [], edgeIds: [] }) };
3441
3496
  const warnings = [...plan.warnings];
@@ -3865,6 +3920,99 @@ async function assertBaseResolutionStable(lookupStore, guard) {
3865
3920
  }
3866
3921
  );
3867
3922
  }
3923
+ function bucketInheritedRefsByKind(refs, identities) {
3924
+ const seen = /* @__PURE__ */ new Set();
3925
+ const idsByKind = /* @__PURE__ */ new Map();
3926
+ for (const ref of refs) {
3927
+ const identity = mergeKey(ref.kind, ref.id);
3928
+ if (!identities.has(identity) || seen.has(identity)) {
3929
+ continue;
3930
+ }
3931
+ seen.add(identity);
3932
+ const bucket = idsByKind.get(ref.kind) ?? [];
3933
+ bucket.push(ref.id);
3934
+ idsByKind.set(ref.kind, bucket);
3935
+ }
3936
+ return idsByKind;
3937
+ }
3938
+ async function assertInheritedUnchanged(args) {
3939
+ if (args.expected.size === 0) {
3940
+ return;
3941
+ }
3942
+ const idsByKind = bucketInheritedRefsByKind(args.refs, args.expected);
3943
+ for (const [kind, ids] of idsByKind) {
3944
+ const rows = await args.fetchRows(kind, ids);
3945
+ for (const [index, id] of ids.entries()) {
3946
+ const expected = args.expected.get(mergeKey(kind, id));
3947
+ const current = args.deriveValue(rows[index]);
3948
+ if (current === expected) {
3949
+ continue;
3950
+ }
3951
+ throw args.buildError(id, kind, expected, current);
3952
+ }
3953
+ }
3954
+ }
3955
+ async function assertInheritedTargetUnchanged(nodesApi, edgesApi, guard, plan) {
3956
+ await Promise.all([
3957
+ assertInheritedNodesUnchanged(nodesApi, guard, plan),
3958
+ assertInheritedEdgesUnchanged(edgesApi, guard, plan)
3959
+ ]);
3960
+ }
3961
+ async function assertInheritedNodesUnchanged(nodesApi, guard, plan) {
3962
+ const nodeRefs = plannedNodeWrites(plan).map(
3963
+ (write) => ({ kind: write.kind, id: write.id })
3964
+ );
3965
+ for (const [identity, kind] of plan.nodeDeletions) {
3966
+ nodeRefs.push({ kind, id: idOf(identity) });
3967
+ }
3968
+ await assertInheritedUnchanged({
3969
+ refs: nodeRefs,
3970
+ expected: guard.targetNodeVersions,
3971
+ fetchRows: (kind, ids) => nodeCollection(nodesApi, kind).getByIds(ids, INCLUDE_TOMBSTONES),
3972
+ deriveValue: (row) => row?.meta.version,
3973
+ buildError: (id, kind, expected, current) => new BaseVersionMismatchError(
3974
+ `mergeIncremental() observed committed node "${id}" (kind "${kind}") at version ${expected} while planning, but it changed before the commit transaction; the resolved plan no longer describes the live target and was not applied.`,
3975
+ {
3976
+ details: {
3977
+ id,
3978
+ kind,
3979
+ expectedVersion: expected,
3980
+ currentVersion: current
3981
+ },
3982
+ suggestion: "Re-run mergeIncremental(); the re-planned merge resolves the inherited modifications against the now-committed rows."
3983
+ }
3984
+ )
3985
+ });
3986
+ }
3987
+ async function assertInheritedEdgesUnchanged(edgesApi, guard, plan) {
3988
+ const edgeRefs = plan.mergedEdges.map((edge) => ({
3989
+ kind: edge.kind,
3990
+ id: edge.id
3991
+ }));
3992
+ for (const [identity, kind] of plan.edgeDeletions) {
3993
+ edgeRefs.push({ kind, id: idOf(identity) });
3994
+ }
3995
+ await assertInheritedUnchanged({
3996
+ refs: edgeRefs,
3997
+ expected: guard.targetEdgeSignatures,
3998
+ fetchRows: (kind, ids) => edgeCollection(edgesApi, kind).getByIds(ids, INCLUDE_TOMBSTONES),
3999
+ deriveValue: (row) => row === void 0 ? void 0 : edgeStateSignature({
4000
+ fromKind: row.fromKind,
4001
+ fromId: row.fromId,
4002
+ toKind: row.toKind,
4003
+ toId: row.toId,
4004
+ live: row.meta.deletedAt === void 0,
4005
+ props: edgeProps(row)
4006
+ }),
4007
+ buildError: (id, kind) => new BaseVersionMismatchError(
4008
+ `mergeIncremental() observed committed edge "${id}" (kind "${kind}") while planning, but its endpoints, liveness, or props changed before the commit transaction; the resolved plan no longer describes the live target and was not applied.`,
4009
+ {
4010
+ details: { id, kind },
4011
+ suggestion: "Re-run mergeIncremental(); the re-planned merge resolves the inherited modifications against the now-committed rows."
4012
+ }
4013
+ )
4014
+ });
4015
+ }
3868
4016
  async function commitIncrementalPlan(target, plan, guard) {
3869
4017
  if (!target.backend.capabilities.transactions) {
3870
4018
  throw new MergeError(
@@ -3877,6 +4025,7 @@ async function commitIncrementalPlan(target, plan, guard) {
3877
4025
  const nodesApi = tx.nodes;
3878
4026
  const edgesApi = tx.edges;
3879
4027
  await assertBaseResolutionStable(tx, guard);
4028
+ await assertInheritedTargetUnchanged(nodesApi, edgesApi, guard, plan);
3880
4029
  await validateIncrementalNodeWrites(target, nodesApi, plan);
3881
4030
  await validateIncrementalEdgeWrites(target, edgesApi, plan);
3882
4031
  return applyMergePlan(plan, nodesApi, edgesApi);