@nicia-ai/typegraph 0.46.2 → 0.47.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 (294) hide show
  1. package/README.md +20 -1
  2. package/dist/backend/drizzle/indexes.cjs +9 -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 +5 -5
  6. package/dist/backend/index.cjs +50 -49
  7. package/dist/backend/index.d.cts +3 -3
  8. package/dist/backend/index.d.ts +3 -3
  9. package/dist/backend/index.js +11 -10
  10. package/dist/backend/postgres/index.cjs +27 -26
  11. package/dist/backend/postgres/index.d.cts +6 -6
  12. package/dist/backend/postgres/index.d.ts +6 -6
  13. package/dist/backend/postgres/index.js +14 -13
  14. package/dist/backend/postgres/pglite-store.cjs +34 -33
  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 +30 -29
  19. package/dist/backend/postgres/pglite-store.js.map +1 -1
  20. package/dist/backend/postgres/pglite.cjs +16 -15
  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 +15 -14
  24. package/dist/backend/sqlite/index.cjs +24 -23
  25. package/dist/backend/sqlite/index.d.cts +6 -6
  26. package/dist/backend/sqlite/index.d.ts +6 -6
  27. package/dist/backend/sqlite/index.js +12 -11
  28. package/dist/backend/sqlite/libsql.cjs +19 -18
  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 +14 -13
  33. package/dist/backend/sqlite/libsql.js.map +1 -1
  34. package/dist/backend/sqlite/local-store.cjs +35 -34
  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 +31 -30
  39. package/dist/backend/sqlite/local-store.js.map +1 -1
  40. package/dist/backend/sqlite/local.cjs +17 -16
  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 +15 -14
  44. package/dist/{chunk-TCT66A7N.cjs → chunk-26YKDNUD.cjs} +10 -10
  45. package/dist/{chunk-TCT66A7N.cjs.map → chunk-26YKDNUD.cjs.map} +1 -1
  46. package/dist/{chunk-QOJ2L2AD.js → chunk-3DMMGT6S.js} +3 -3
  47. package/dist/{chunk-QOJ2L2AD.js.map → chunk-3DMMGT6S.js.map} +1 -1
  48. package/dist/{chunk-ANKOXPCC.cjs → chunk-3HGRTCDU.cjs} +6 -4
  49. package/dist/chunk-3HGRTCDU.cjs.map +1 -0
  50. package/dist/{chunk-QU7QLJA4.cjs → chunk-3U5ABFDW.cjs} +26 -26
  51. package/dist/{chunk-QU7QLJA4.cjs.map → chunk-3U5ABFDW.cjs.map} +1 -1
  52. package/dist/{chunk-5PDSCELM.cjs → chunk-425IZOQ5.cjs} +11 -164
  53. package/dist/chunk-425IZOQ5.cjs.map +1 -0
  54. package/dist/{chunk-S7WIRFNS.cjs → chunk-5FBRVORR.cjs} +12 -12
  55. package/dist/{chunk-S7WIRFNS.cjs.map → chunk-5FBRVORR.cjs.map} +1 -1
  56. package/dist/{chunk-GWXXHOLU.js → chunk-5FT3TLPK.js} +11 -11
  57. package/dist/{chunk-GWXXHOLU.js.map → chunk-5FT3TLPK.js.map} +1 -1
  58. package/dist/{chunk-S3G5VLSW.js → chunk-5UMTUOM5.js} +6 -6
  59. package/dist/{chunk-S3G5VLSW.js.map → chunk-5UMTUOM5.js.map} +1 -1
  60. package/dist/{chunk-RFDEYLIK.js → chunk-6FWSNSRE.js} +7 -7
  61. package/dist/{chunk-RFDEYLIK.js.map → chunk-6FWSNSRE.js.map} +1 -1
  62. package/dist/{chunk-F36KZDFX.cjs → chunk-6JVZSOHQ.cjs} +91 -91
  63. package/dist/{chunk-F36KZDFX.cjs.map → chunk-6JVZSOHQ.cjs.map} +1 -1
  64. package/dist/chunk-6KFLYYOC.cjs +161 -0
  65. package/dist/chunk-6KFLYYOC.cjs.map +1 -0
  66. package/dist/{chunk-D6GCNNMK.cjs → chunk-6NGW27EO.cjs} +10 -10
  67. package/dist/{chunk-D6GCNNMK.cjs.map → chunk-6NGW27EO.cjs.map} +1 -1
  68. package/dist/{chunk-WHS2Y43J.js → chunk-6SWPJEYN.js} +5 -5
  69. package/dist/{chunk-WHS2Y43J.js.map → chunk-6SWPJEYN.js.map} +1 -1
  70. package/dist/{chunk-7TKNK32B.js → chunk-7SQSZN2J.js} +5 -5
  71. package/dist/{chunk-7TKNK32B.js.map → chunk-7SQSZN2J.js.map} +1 -1
  72. package/dist/{chunk-BEB4OFZF.cjs → chunk-AMMWA76F.cjs} +51 -59
  73. package/dist/chunk-AMMWA76F.cjs.map +1 -0
  74. package/dist/{chunk-PYKF7UIL.cjs → chunk-AOSSQDVO.cjs} +13 -13
  75. package/dist/{chunk-PYKF7UIL.cjs.map → chunk-AOSSQDVO.cjs.map} +1 -1
  76. package/dist/{chunk-EDHV4CBU.js → chunk-AVGUJWVX.js} +30 -10
  77. package/dist/chunk-AVGUJWVX.js.map +1 -0
  78. package/dist/{chunk-C2ZP5YS6.cjs → chunk-BCQ76AXA.cjs} +258 -153
  79. package/dist/chunk-BCQ76AXA.cjs.map +1 -0
  80. package/dist/{chunk-WA64ZSCA.cjs → chunk-BFUOME67.cjs} +11 -11
  81. package/dist/{chunk-WA64ZSCA.cjs.map → chunk-BFUOME67.cjs.map} +1 -1
  82. package/dist/{chunk-C6KE2HSQ.cjs → chunk-BR7SHKGM.cjs} +1611 -1382
  83. package/dist/chunk-BR7SHKGM.cjs.map +1 -0
  84. package/dist/{chunk-FCIZNUW5.js → chunk-CHAOFCHV.js} +3 -3
  85. package/dist/{chunk-FCIZNUW5.js.map → chunk-CHAOFCHV.js.map} +1 -1
  86. package/dist/chunk-CICO5GXD.cjs +12 -0
  87. package/dist/{chunk-73MWKDFK.cjs.map → chunk-CICO5GXD.cjs.map} +1 -1
  88. package/dist/{chunk-SXWLLQ3D.js → chunk-D5R42W5D.js} +4 -4
  89. package/dist/{chunk-SXWLLQ3D.js.map → chunk-D5R42W5D.js.map} +1 -1
  90. package/dist/{chunk-YQ4JONWE.js → chunk-DJZTXBWY.js} +342 -113
  91. package/dist/chunk-DJZTXBWY.js.map +1 -0
  92. package/dist/{chunk-BZZI7B43.cjs → chunk-DO7SAMEK.cjs} +47 -47
  93. package/dist/{chunk-BZZI7B43.cjs.map → chunk-DO7SAMEK.cjs.map} +1 -1
  94. package/dist/{chunk-2ZWM2RFH.cjs → chunk-EDN4Y4ZG.cjs} +9 -9
  95. package/dist/{chunk-2ZWM2RFH.cjs.map → chunk-EDN4Y4ZG.cjs.map} +1 -1
  96. package/dist/{chunk-E4OSGBCM.cjs → chunk-EMIB2RXD.cjs} +131 -131
  97. package/dist/{chunk-E4OSGBCM.cjs.map → chunk-EMIB2RXD.cjs.map} +1 -1
  98. package/dist/{chunk-GWUWRZXW.js → chunk-EP4RUYD6.js} +3 -3
  99. package/dist/{chunk-GWUWRZXW.js.map → chunk-EP4RUYD6.js.map} +1 -1
  100. package/dist/{chunk-LHYSY6SE.js → chunk-FNOMT74T.js} +10 -8
  101. package/dist/chunk-FNOMT74T.js.map +1 -0
  102. package/dist/{chunk-ZBVZ7HXD.cjs → chunk-FQPEMEWX.cjs} +12 -12
  103. package/dist/{chunk-ZBVZ7HXD.cjs.map → chunk-FQPEMEWX.cjs.map} +1 -1
  104. package/dist/{chunk-LNIWCQR4.js → chunk-GLHXM7C4.js} +3 -3
  105. package/dist/{chunk-LNIWCQR4.js.map → chunk-GLHXM7C4.js.map} +1 -1
  106. package/dist/{chunk-6BD6ZBKT.cjs → chunk-GYEG3ZLZ.cjs} +10 -10
  107. package/dist/{chunk-6BD6ZBKT.cjs.map → chunk-GYEG3ZLZ.cjs.map} +1 -1
  108. package/dist/{chunk-XBHRKLZU.cjs → chunk-GYUJZARH.cjs} +4 -4
  109. package/dist/{chunk-XBHRKLZU.cjs.map → chunk-GYUJZARH.cjs.map} +1 -1
  110. package/dist/{chunk-A7NMUYEL.cjs → chunk-HDL2ARHX.cjs} +27 -27
  111. package/dist/{chunk-A7NMUYEL.cjs.map → chunk-HDL2ARHX.cjs.map} +1 -1
  112. package/dist/{chunk-5ZJOB5YS.js → chunk-HEV35TGT.js} +4 -4
  113. package/dist/{chunk-5ZJOB5YS.js.map → chunk-HEV35TGT.js.map} +1 -1
  114. package/dist/{chunk-UTVQPZPN.cjs → chunk-I4G3SQPF.cjs} +20 -20
  115. package/dist/{chunk-UTVQPZPN.cjs.map → chunk-I4G3SQPF.cjs.map} +1 -1
  116. package/dist/{chunk-JCNTKRAK.js → chunk-JONXFAPO.js} +5 -5
  117. package/dist/{chunk-JCNTKRAK.js.map → chunk-JONXFAPO.js.map} +1 -1
  118. package/dist/{chunk-GVAMRRZR.cjs → chunk-JR6SX5RH.cjs} +4 -4
  119. package/dist/{chunk-GVAMRRZR.cjs.map → chunk-JR6SX5RH.cjs.map} +1 -1
  120. package/dist/{chunk-N3QTGPC7.cjs → chunk-KABFHAL7.cjs} +100 -99
  121. package/dist/chunk-KABFHAL7.cjs.map +1 -0
  122. package/dist/{chunk-KXSMF6PL.js → chunk-KH7XW7VV.js} +20 -12
  123. package/dist/chunk-KH7XW7VV.js.map +1 -0
  124. package/dist/{chunk-EDJDDY6H.js → chunk-KKBDXCLQ.js} +4 -4
  125. package/dist/{chunk-EDJDDY6H.js.map → chunk-KKBDXCLQ.js.map} +1 -1
  126. package/dist/{chunk-ZHOAZD7Q.cjs → chunk-L3LQNR34.cjs} +161 -161
  127. package/dist/{chunk-ZHOAZD7Q.cjs.map → chunk-L3LQNR34.cjs.map} +1 -1
  128. package/dist/{chunk-IHRDX7K6.js → chunk-LEWHMOUY.js} +46 -56
  129. package/dist/chunk-LEWHMOUY.js.map +1 -0
  130. package/dist/{chunk-AF3TWL5C.cjs → chunk-LRQKXRXO.cjs} +4 -4
  131. package/dist/{chunk-AF3TWL5C.cjs.map → chunk-LRQKXRXO.cjs.map} +1 -1
  132. package/dist/{chunk-WYFB7BN3.js → chunk-M35DF33T.js} +143 -38
  133. package/dist/chunk-M35DF33T.js.map +1 -0
  134. package/dist/{chunk-32UETY6S.cjs → chunk-MFZR4QKM.cjs} +30 -28
  135. package/dist/chunk-MFZR4QKM.cjs.map +1 -0
  136. package/dist/chunk-MKJ4KXL5.cjs +12 -0
  137. package/dist/{chunk-6LAXM4J2.cjs.map → chunk-MKJ4KXL5.cjs.map} +1 -1
  138. package/dist/{chunk-KCH7WQA5.cjs → chunk-MRDBBHIZ.cjs} +48 -2
  139. package/dist/chunk-MRDBBHIZ.cjs.map +1 -0
  140. package/dist/{chunk-QPOQX2DI.cjs → chunk-MX4DHSQP.cjs} +1023 -360
  141. package/dist/chunk-MX4DHSQP.cjs.map +1 -0
  142. package/dist/{chunk-FXNHZFZV.js → chunk-MYKHJI2J.js} +3 -3
  143. package/dist/{chunk-FXNHZFZV.js.map → chunk-MYKHJI2J.js.map} +1 -1
  144. package/dist/{chunk-DSAWGCMP.js → chunk-NAZ2RA4L.js} +3 -3
  145. package/dist/{chunk-DSAWGCMP.js.map → chunk-NAZ2RA4L.js.map} +1 -1
  146. package/dist/{chunk-R7EWHKID.js → chunk-NG2RB5WL.js} +4 -145
  147. package/dist/chunk-NG2RB5WL.js.map +1 -0
  148. package/dist/{chunk-A2LJG5GM.js → chunk-NNQ6A3RM.js} +803 -143
  149. package/dist/chunk-NNQ6A3RM.js.map +1 -0
  150. package/dist/{chunk-72WUT4GG.js → chunk-NVY5CJFP.js} +4 -4
  151. package/dist/{chunk-72WUT4GG.js.map → chunk-NVY5CJFP.js.map} +1 -1
  152. package/dist/{chunk-ZIH42CRX.cjs → chunk-OI2GQ25X.cjs} +7 -7
  153. package/dist/{chunk-ZIH42CRX.cjs.map → chunk-OI2GQ25X.cjs.map} +1 -1
  154. package/dist/{chunk-A4R3H7RU.cjs → chunk-OIFSOPSR.cjs} +259 -238
  155. package/dist/chunk-OIFSOPSR.cjs.map +1 -0
  156. package/dist/{chunk-AU3IJNNP.js → chunk-OMZ37BM2.js} +5 -5
  157. package/dist/{chunk-AU3IJNNP.js.map → chunk-OMZ37BM2.js.map} +1 -1
  158. package/dist/{chunk-C4DYN2SD.cjs → chunk-OORXGFL5.cjs} +48 -48
  159. package/dist/{chunk-C4DYN2SD.cjs.map → chunk-OORXGFL5.cjs.map} +1 -1
  160. package/dist/{chunk-BRN3RGD2.js → chunk-OVI7IXYX.js} +3 -3
  161. package/dist/{chunk-BRN3RGD2.js.map → chunk-OVI7IXYX.js.map} +1 -1
  162. package/dist/{chunk-WMKEGJG4.js → chunk-P6YLZTRE.js} +3 -3
  163. package/dist/{chunk-WMKEGJG4.js.map → chunk-P6YLZTRE.js.map} +1 -1
  164. package/dist/{chunk-AT3MLMJV.js → chunk-QS3NQZVC.js} +82 -16
  165. package/dist/chunk-QS3NQZVC.js.map +1 -0
  166. package/dist/{chunk-EJSYWAEV.js → chunk-QTD6HX4O.js} +5 -5
  167. package/dist/{chunk-EJSYWAEV.js.map → chunk-QTD6HX4O.js.map} +1 -1
  168. package/dist/{chunk-JL5UEBWT.cjs → chunk-ROR5ZR6A.cjs} +45 -45
  169. package/dist/{chunk-JL5UEBWT.cjs.map → chunk-ROR5ZR6A.cjs.map} +1 -1
  170. package/dist/{chunk-FSLTU57P.js → chunk-SDBBMD4N.js} +3 -3
  171. package/dist/{chunk-FSLTU57P.js.map → chunk-SDBBMD4N.js.map} +1 -1
  172. package/dist/{chunk-WEJHA7AD.js → chunk-SE6EGQSD.js} +78 -16
  173. package/dist/chunk-SE6EGQSD.js.map +1 -0
  174. package/dist/{chunk-36LIJXWC.js → chunk-SHFBB23Q.js} +4 -4
  175. package/dist/{chunk-36LIJXWC.js.map → chunk-SHFBB23Q.js.map} +1 -1
  176. package/dist/{chunk-FA6Z7B5L.js → chunk-SHSSRCFR.js} +5 -3
  177. package/dist/chunk-SHSSRCFR.js.map +1 -0
  178. package/dist/{chunk-KOAI3KIV.cjs → chunk-TZEGUG6D.cjs} +4 -4
  179. package/dist/{chunk-KOAI3KIV.cjs.map → chunk-TZEGUG6D.cjs.map} +1 -1
  180. package/dist/{chunk-HNYLMPQQ.cjs → chunk-U5EDAVOJ.cjs} +140 -74
  181. package/dist/chunk-U5EDAVOJ.cjs.map +1 -0
  182. package/dist/{chunk-RHDOAQCT.cjs → chunk-UPAJHMW3.cjs} +122 -114
  183. package/dist/chunk-UPAJHMW3.cjs.map +1 -0
  184. package/dist/{chunk-BQM5P2NO.cjs → chunk-WGX7JH7E.cjs} +235 -170
  185. package/dist/chunk-WGX7JH7E.cjs.map +1 -0
  186. package/dist/{chunk-DYPRZ53S.cjs → chunk-WODMN3Q2.cjs} +27 -27
  187. package/dist/{chunk-DYPRZ53S.cjs.map → chunk-WODMN3Q2.cjs.map} +1 -1
  188. package/dist/{chunk-OZJCH7ZS.js → chunk-XVWOYKIK.js} +3 -3
  189. package/dist/{chunk-OZJCH7ZS.js.map → chunk-XVWOYKIK.js.map} +1 -1
  190. package/dist/chunk-XY5OMOJD.js +147 -0
  191. package/dist/chunk-XY5OMOJD.js.map +1 -0
  192. package/dist/{chunk-KA4L2NZ3.js → chunk-XYBQI6LE.js} +14 -14
  193. package/dist/{chunk-KA4L2NZ3.js.map → chunk-XYBQI6LE.js.map} +1 -1
  194. package/dist/{chunk-EAMVXR5B.js → chunk-ZDKTPBGV.js} +4 -4
  195. package/dist/{chunk-EAMVXR5B.js.map → chunk-ZDKTPBGV.js.map} +1 -1
  196. package/dist/{chunk-Z43KWLZF.js → chunk-ZHNXLS3C.js} +9 -8
  197. package/dist/chunk-ZHNXLS3C.js.map +1 -0
  198. package/dist/{chunk-62ZXBMSD.js → chunk-ZLONH2UD.js} +46 -3
  199. package/dist/chunk-ZLONH2UD.js.map +1 -0
  200. package/dist/core/index.cjs +28 -27
  201. package/dist/core/index.d.cts +4 -4
  202. package/dist/core/index.d.ts +4 -4
  203. package/dist/core/index.js +8 -7
  204. package/dist/{ddl-opIn8DfX.d.ts → ddl-CprnMXJ-.d.ts} +3 -3
  205. package/dist/{ddl-mE07h_EM.d.cts → ddl-DJA7Lci5.d.cts} +3 -3
  206. package/dist/graph-extension/index.cjs +20 -20
  207. package/dist/graph-extension/index.d.cts +4 -4
  208. package/dist/graph-extension/index.d.ts +4 -4
  209. package/dist/graph-extension/index.js +4 -4
  210. package/dist/graph-merge/index.cjs +3204 -635
  211. package/dist/graph-merge/index.cjs.map +1 -1
  212. package/dist/graph-merge/index.d.cts +502 -60
  213. package/dist/graph-merge/index.d.ts +502 -60
  214. package/dist/graph-merge/index.js +2979 -427
  215. package/dist/graph-merge/index.js.map +1 -1
  216. package/dist/{index-Deyu8IXL.d.ts → index-CHTv4XMZ.d.cts} +47 -3
  217. package/dist/{index-DrRS51Ld.d.cts → index-CzoJ3MUw.d.ts} +47 -3
  218. package/dist/index.cjs +229 -216
  219. package/dist/index.cjs.map +1 -1
  220. package/dist/index.d.cts +11 -11
  221. package/dist/index.d.ts +11 -11
  222. package/dist/index.js +35 -34
  223. package/dist/index.js.map +1 -1
  224. package/dist/indexes/index.cjs +13 -13
  225. package/dist/indexes/index.d.cts +4 -4
  226. package/dist/indexes/index.d.ts +4 -4
  227. package/dist/indexes/index.js +6 -6
  228. package/dist/interchange/index.cjs +53 -52
  229. package/dist/interchange/index.cjs.map +1 -1
  230. package/dist/interchange/index.d.cts +17 -13
  231. package/dist/interchange/index.d.ts +17 -13
  232. package/dist/interchange/index.js +17 -16
  233. package/dist/interchange/index.js.map +1 -1
  234. package/dist/{manager-DX983gJ0.d.ts → manager-B6sOQzcQ.d.ts} +2 -2
  235. package/dist/{manager-ptr3JLRP.d.cts → manager-DlY1vlla.d.cts} +2 -2
  236. package/dist/{materialize-indexes-CpXoggWU.d.ts → materialize-indexes-DQL4xcpf.d.ts} +1 -1
  237. package/dist/{materialize-indexes-BXz77YqO.d.cts → materialize-indexes-sskhp-c_.d.cts} +1 -1
  238. package/dist/{postgres-DwgEXSPI.d.cts → postgres-B6YOUcaK.d.ts} +1 -1
  239. package/dist/{postgres-QdOMHTBz.d.ts → postgres-BXy_nyMs.d.cts} +1 -1
  240. package/dist/profiler/index.d.cts +9 -9
  241. package/dist/profiler/index.d.ts +9 -9
  242. package/dist/provenance/index.cjs +43 -42
  243. package/dist/provenance/index.cjs.map +1 -1
  244. package/dist/provenance/index.d.cts +7 -7
  245. package/dist/provenance/index.d.ts +7 -7
  246. package/dist/provenance/index.js +10 -9
  247. package/dist/provenance/index.js.map +1 -1
  248. package/dist/schema/index.cjs +45 -44
  249. package/dist/schema/index.d.cts +6 -6
  250. package/dist/schema/index.d.ts +6 -6
  251. package/dist/schema/index.js +18 -17
  252. package/dist/{searchable-BrUh0pdc.d.cts → searchable-0Cn_lY8U.d.cts} +1 -1
  253. package/dist/{searchable-BOUuA83f.d.ts → searchable-D9gMiwcS.d.ts} +1 -1
  254. package/dist/{sqlite-BfYcV61E.d.cts → sqlite-ClXuBYAj.d.ts} +1 -1
  255. package/dist/{sqlite-DK40XVR1.d.ts → sqlite-DioSxaPe.d.cts} +1 -1
  256. package/dist/{store-Bo1psfVZ.d.ts → store-5j-w5onJ.d.ts} +120 -71
  257. package/dist/{store-FTqBpuJD.d.cts → store-CFedKGU5.d.cts} +120 -71
  258. package/dist/{temporal-CXewwLTB.d.cts → temporal-Ce1pG0S1.d.cts} +1 -1
  259. package/dist/{temporal-DPtn0HOu.d.ts → temporal-CjO9FH1l.d.ts} +1 -1
  260. package/dist/{types-CeT7xM4M.d.ts → types-BrdOFu48.d.ts} +1 -1
  261. package/dist/{types-Du78EvpN.d.ts → types-DKkMJZjR.d.cts} +32 -6
  262. package/dist/{types-Du78EvpN.d.cts → types-DKkMJZjR.d.ts} +32 -6
  263. package/dist/{types-XR1nHERK.d.cts → types-oj_OGAaZ.d.cts} +1 -1
  264. package/dist/{where-CMbFiWwp.d.ts → where-C8w2627G.d.ts} +1 -1
  265. package/dist/{where-CJsp-YUf.d.cts → where-D1wKCJ4Q.d.cts} +1 -1
  266. package/package.json +1 -1
  267. package/dist/chunk-32UETY6S.cjs.map +0 -1
  268. package/dist/chunk-5PDSCELM.cjs.map +0 -1
  269. package/dist/chunk-62ZXBMSD.js.map +0 -1
  270. package/dist/chunk-6LAXM4J2.cjs +0 -12
  271. package/dist/chunk-73MWKDFK.cjs +0 -12
  272. package/dist/chunk-A2LJG5GM.js.map +0 -1
  273. package/dist/chunk-A4R3H7RU.cjs.map +0 -1
  274. package/dist/chunk-ANKOXPCC.cjs.map +0 -1
  275. package/dist/chunk-AT3MLMJV.js.map +0 -1
  276. package/dist/chunk-BEB4OFZF.cjs.map +0 -1
  277. package/dist/chunk-BQM5P2NO.cjs.map +0 -1
  278. package/dist/chunk-C2ZP5YS6.cjs.map +0 -1
  279. package/dist/chunk-C6KE2HSQ.cjs.map +0 -1
  280. package/dist/chunk-EDHV4CBU.js.map +0 -1
  281. package/dist/chunk-FA6Z7B5L.js.map +0 -1
  282. package/dist/chunk-HNYLMPQQ.cjs.map +0 -1
  283. package/dist/chunk-IHRDX7K6.js.map +0 -1
  284. package/dist/chunk-KCH7WQA5.cjs.map +0 -1
  285. package/dist/chunk-KXSMF6PL.js.map +0 -1
  286. package/dist/chunk-LHYSY6SE.js.map +0 -1
  287. package/dist/chunk-N3QTGPC7.cjs.map +0 -1
  288. package/dist/chunk-QPOQX2DI.cjs.map +0 -1
  289. package/dist/chunk-R7EWHKID.js.map +0 -1
  290. package/dist/chunk-RHDOAQCT.cjs.map +0 -1
  291. package/dist/chunk-WEJHA7AD.js.map +0 -1
  292. package/dist/chunk-WYFB7BN3.js.map +0 -1
  293. package/dist/chunk-YQ4JONWE.js.map +0 -1
  294. package/dist/chunk-Z43KWLZF.js.map +0 -1
@@ -1,14 +1,139 @@
1
- import { _ as NodeId, u as NodeType, $ as EdgeId, a0 as JsonValue, d as GraphDef, a1 as NodeKinds, a2 as GetNodeType, y as GraphBackend, a3 as KindAnnotations, a4 as MetaEdge, a5 as EdgeType, a6 as DeleteBehavior, T as TemporalMode, I as IndexDeclaration, a7 as GraphExtensionVersion, a8 as ExtensionNodeDef, a9 as ExtensionEdgeDef, aa as ExtensionOntologyRelation, ab as ExtensionIndex } from '../types-Du78EvpN.js';
2
- export { C as ContributionDiagnostic, a as ContributionDiagnosticState, b as ContributionRepairEntry, c as ContributionRepairResult } from '../types-Du78EvpN.js';
3
- import { a as Store, N as Node, m as UniqueIntrospection } from '../store-Bo1psfVZ.js';
4
- import { T as TypeGraphError, b as TypeGraphErrorOptions } from '../index-Deyu8IXL.js';
1
+ import { bf as NodeId, u as NodeType, b6 as JsonValue, aA as EdgeId, d as GraphDef, bg as NodeKinds, aR as GetNodeType, y as GraphBackend, b7 as KindAnnotations, bb as MetaEdge, a5 as EdgeType, aw as DeleteBehavior, T as TemporalMode, I as IndexDeclaration, aX as GraphExtensionVersion, cs as ExtensionNodeDef, ct as ExtensionEdgeDef, cu as ExtensionOntologyRelation, cv as ExtensionIndex } from '../types-DKkMJZjR.js';
2
+ export { C as ContributionDiagnostic, a as ContributionDiagnosticState, b as ContributionRepairEntry, c as ContributionRepairResult } from '../types-DKkMJZjR.js';
3
+ import { a as Store, aP as Node, ce as UniqueIntrospection } from '../store-5j-w5onJ.js';
4
+ import { aj as TypeGraphError, ak as TypeGraphErrorOptions } from '../index-CzoJ3MUw.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
7
  import { z } from 'zod';
8
- import '../temporal-DPtn0HOu.js';
9
- import '../searchable-BOUuA83f.js';
10
- import '../manager-DX983gJ0.js';
11
- import '../materialize-indexes-CpXoggWU.js';
8
+ import '../temporal-CjO9FH1l.js';
9
+ import '../searchable-D9gMiwcS.js';
10
+ import '../manager-B6sOQzcQ.js';
11
+ import '../materialize-indexes-DQL4xcpf.js';
12
+
13
+ /**
14
+ * The composite MERGE IDENTITY key for a node: the pair `(kind, id)`.
15
+ *
16
+ * TypeGraph node identity is the PAIR `(kind, id)` — a bare id string is NOT unique
17
+ * on its own (a `Patient` and an `Encounter` may both carry the id "x" as two
18
+ * DISTINCT committed nodes; ids are caller-supplied). Every place the merge pipeline
19
+ * groups, clusters, de-dupes, repoints, retypes, or deletes BY NODE IDENTITY must
20
+ * key on this pair — never the bare id — or two different-kind nodes that happen to
21
+ * share an id string silently fuse into one cluster (wrong merge, dropped node,
22
+ * incoherent commit) and the §6.4-A base guard is bypassed.
23
+ *
24
+ * Represented as a NUL-joined string (a branded {@link MergeKey}) so it doubles as a
25
+ * `Map`/`Set` key and a deterministic ordering key. `kind` is a schema identifier
26
+ * (NUL-free), so the FIRST NUL unambiguously delimits kind from id even when a
27
+ * caller-supplied id itself contains a NUL byte. This matches the `(kind, id)`
28
+ * separator the commit-time write guard already uses.
29
+ *
30
+ * {@link compareMergeKeys} orders by the bare id FIRST (kind only breaks a same-id
31
+ * tie), so the merge's "minimum-id survivor" / id-sorted-members semantics are
32
+ * preserved unchanged for the common single-kind cluster — the composite key changes
33
+ * WHICH nodes share an identity, never the ordering among genuinely distinct ids.
34
+ */
35
+
36
+ /**
37
+ * A composite `(kind, id)` node-identity key. Branded so it cannot be confused with
38
+ * a bare {@link NodeId} at the type level — the whole point is that the two are NOT
39
+ * interchangeable as identities.
40
+ */
41
+ type MergeKey = string & {
42
+ readonly __mergeKey: unique symbol;
43
+ };
44
+
45
+ /** A complete graph-merge node identity. */
46
+ type EntityRef = Readonly<{
47
+ kind: string;
48
+ id: NodeId<NodeType>;
49
+ }>;
50
+ /** Structured attribution for one candidate-recall path. */
51
+ type MatchSource = Readonly<{
52
+ kind: "block";
53
+ sourceId: string;
54
+ }> | Readonly<{
55
+ kind: "unique";
56
+ sourceId: string;
57
+ constraintName: string;
58
+ }> | Readonly<{
59
+ kind: "baseUnique";
60
+ sourceId: string;
61
+ constraintName: string;
62
+ }> | Readonly<{
63
+ kind: "baseIndex";
64
+ sourceId: string;
65
+ indexName: string;
66
+ }> | Readonly<{
67
+ kind: "keyless";
68
+ sourceId: string;
69
+ }> | Readonly<{
70
+ kind: "retype";
71
+ sourceId: string;
72
+ }> | Readonly<{
73
+ kind: "custom";
74
+ sourceId: string;
75
+ metadata?: JsonValue | undefined;
76
+ }>;
77
+ /** JSON-safe description of the strategy that actually scored a pair. */
78
+ type MatchStrategy = Readonly<{
79
+ kind: "fulltext";
80
+ fields: readonly string[];
81
+ }> | Readonly<{
82
+ kind: "vector";
83
+ fields: readonly string[];
84
+ }> | Readonly<{
85
+ kind: "hybrid";
86
+ fields: readonly string[];
87
+ weights: Readonly<{
88
+ vector: number;
89
+ fulltext: number;
90
+ }>;
91
+ }> | Readonly<{
92
+ kind: "custom";
93
+ }>;
94
+ /** Serializable explanation for one accepted identity edge. */
95
+ type MatchEvidence = Readonly<{
96
+ a: EntityRef;
97
+ b: EntityRef;
98
+ sources: readonly MatchSource[];
99
+ decision: "definitional";
100
+ }> | Readonly<{
101
+ a: EntityRef;
102
+ b: EntityRef;
103
+ sources: readonly MatchSource[];
104
+ decision: "scored";
105
+ strategy: MatchStrategy;
106
+ score: number;
107
+ threshold: number;
108
+ }>;
109
+ /** One opt-in scorer observation, retained independently of cluster membership. */
110
+ type CandidateDiagnostic = Readonly<{
111
+ evidence: Extract<MatchEvidence, Readonly<{
112
+ decision: "scored";
113
+ }>>;
114
+ scoreDecision: "accepted" | "rejected";
115
+ reason?: "noComparableValues";
116
+ clusterDisposition?: "retained" | Readonly<{
117
+ kind: "excluded";
118
+ reason: "diameter" | "baseAmbiguity";
119
+ }>;
120
+ }> | Readonly<{
121
+ evidence: Extract<MatchEvidence, Readonly<{
122
+ decision: "definitional";
123
+ }>>;
124
+ scoreDecision: "accepted";
125
+ clusterDisposition: Readonly<{
126
+ kind: "excluded";
127
+ reason: "diameter" | "baseAmbiguity";
128
+ }>;
129
+ }>;
130
+ /** Bounded public diagnostic collection assembled by the merge planner. */
131
+ type CandidateDiagnostics = Readonly<{
132
+ entries: readonly CandidateDiagnostic[];
133
+ total: number;
134
+ limit: number;
135
+ truncated: boolean;
136
+ }>;
12
137
 
13
138
  /**
14
139
  * Core type model for the graph-merge primitive.
@@ -226,6 +351,15 @@ type DeleteModifyPolicy = "deleteWins" | "modifyWins" | "flag";
226
351
  * and records a report warning.
227
352
  */
228
353
  type ComparisonCeilingPolicy = "error" | "mergeByIdOnly";
354
+ /**
355
+ * Opt-in retention policy for candidate-level scoring diagnostics. The limit is
356
+ * a deterministic global ceiling over the canonically ordered scored pairs;
357
+ * planning still evaluates candidates according to the normal comparison
358
+ * ceiling, then retains at most this many accepted/rejected decisions.
359
+ */
360
+ type CandidateDiagnosticsOptions = Readonly<{
361
+ limit: number;
362
+ }>;
229
363
  /**
230
364
  * Ontology type-reconciliation mode. `"off"` is a no-op (default); `"ontology"`
231
365
  * collapses compatible types to the most-specific via the public subClassOf
@@ -298,6 +432,11 @@ type MergeOptions<G extends GraphDef = GraphDef> = Readonly<{
298
432
  target?: Store<G>;
299
433
  /** Safety ceiling on candidate comparisons per kind. Default: unbounded. */
300
434
  maxComparisonsPerKind?: number;
435
+ /**
436
+ * Retain bounded accepted/rejected scored-pair diagnostics. Omitted by
437
+ * default so ordinary plans and reports contain only decisive evidence.
438
+ */
439
+ candidateDiagnostics?: CandidateDiagnosticsOptions;
301
440
  /**
302
441
  * Optional single-link diameter guard. When set, clusters whose pairwise
303
442
  * distance exceeds it are split by the deterministic drop-weakest rule (T8).
@@ -342,6 +481,8 @@ type EntityResolution = Readonly<{
342
481
  memberIds: readonly NodeId<NodeType>[];
343
482
  kind: string;
344
483
  branchOrigins: readonly BranchId[];
484
+ /** Deterministic minimal accepted-edge witness for this resolution. */
485
+ decisiveEdges: readonly MatchEvidence[];
345
486
  }>;
346
487
  /**
347
488
  * One candidate value contributing to a property conflict, tagged by its origin
@@ -384,6 +525,8 @@ type TypeReconciliation = Readonly<{
384
525
  entityId: NodeId<NodeType>;
385
526
  fromTypes: readonly string[];
386
527
  toType: string;
528
+ /** Accepted ontology-retype witness, when emitted by graph merge. */
529
+ decisiveEdges?: readonly MatchEvidence[];
387
530
  }>;
388
531
  /**
389
532
  * An item omitted from the merged result (e.g. an edge whose endpoint was
@@ -414,9 +557,9 @@ type DroppedItem = Readonly<{
414
557
  */
415
558
  declare const VALIDITY_END_TARGET_PRECEDENCE: "target";
416
559
  /**
417
- * One inherited row whose end-of-validity the merge RESOLVED: the instant that
418
- * stands and every branch that claimed an end for the row (including the ones whose
419
- * claim lost the least-claim tie-break).
560
+ * One inherited row whose end-of-validity the merge RESOLVED: the explicit set or
561
+ * clear that stands and every branch that claimed a change for the row (including
562
+ * the ones whose claim lost arbitration).
420
563
  *
421
564
  * `id` is bare because `entity` + `kind` already disambiguate it — a node and an
422
565
  * edge, or two kinds, that share an id string are distinct entries.
@@ -425,26 +568,28 @@ type ValidityEndResolution = Readonly<{
425
568
  entity: "node" | "edge";
426
569
  kind: string;
427
570
  id: string;
428
- /**
429
- * The row's end-of-validity as a canonical UTC ISO 8601 string: the instant the
430
- * commit WROTE, or — under {@link VALIDITY_END_TARGET_PRECEDENCE} — the instant
431
- * the target already held and the merge left alone.
432
- */
433
- validTo: string;
434
- /** Every branch that claimed an end, sorted; length > 1 means arbitration. */
571
+ /** Every branch that claimed a change, sorted; length > 1 means arbitration. */
435
572
  claimedBy: readonly BranchId[];
436
573
  /**
437
574
  * Present only as {@link VALIDITY_END_TARGET_PRECEDENCE}, marking an entry the
438
- * merge did NOT decide: the incremental target had already moved this end, so
439
- * `validTo` is the target's own committed instant, every claim in `claimedBy` was
440
- * discarded, and nothing was written or credited for the row.
575
+ * merge did NOT decide: the incremental target had already changed this end, so
576
+ * the set/clear fields describe the target's own committed state, every claim in
577
+ * `claimedBy` was discarded, and nothing was written or credited for the row.
441
578
  *
442
- * ABSENT means the merge decided the end — `validTo` is the instant it wrote and
443
- * `claimedBy` names the claims it arbitrated between. A consumer that ignores the
444
- * field therefore keeps reading the entries it always read.
579
+ * ABSENT means the merge decided the change — `validTo` or `clearValidTo` names
580
+ * what it wrote and `claimedBy` names the claims it arbitrated between. A consumer
581
+ * that ignores the field therefore keeps reading the entries it always read.
445
582
  */
446
583
  precedence?: typeof VALIDITY_END_TARGET_PRECEDENCE;
447
- }>;
584
+ }> & (Readonly<{
585
+ /** The canonical instant the merge set, or the target already held. */
586
+ validTo: string;
587
+ clearValidTo?: never;
588
+ }> | Readonly<{
589
+ /** Marks a resolution that reopened the row by clearing its upper bound. */
590
+ clearValidTo: true;
591
+ validTo?: never;
592
+ }>);
448
593
  /**
449
594
  * A `(kind, id)` node identity as surfaced in the merge report. Node identity is the
450
595
  * PAIR, never the bare id (a `Doctor` and a `SpecialistDoctor` can share an id string),
@@ -531,8 +676,9 @@ type MergeReport<G extends GraphDef = GraphDef> = Readonly<{
531
676
  typeReconciliations: readonly TypeReconciliation[];
532
677
  dropped: readonly DroppedItem[];
533
678
  /**
534
- * Every inherited row whose END-OF-VALIDITY the merge resolved, with the instant
535
- * that stands and the branches that claimed an end.
679
+ * Every inherited row whose END-OF-VALIDITY the merge resolved, with the end
680
+ * update that stands and the branches that claimed it. A set carries `validTo`;
681
+ * a reopening carries `clearValidTo: true`.
536
682
  *
537
683
  * Reported because the resolution is silent by design: two branches ending the
538
684
  * same row at different instants are not in conflict (an ending is a monotone
@@ -557,6 +703,8 @@ type MergeReport<G extends GraphDef = GraphDef> = Readonly<{
557
703
  * graph still committed). Empty on a clean merge.
558
704
  */
559
705
  warnings: readonly string[];
706
+ /** Bounded accepted/rejected scored-pair diagnostics when explicitly enabled. */
707
+ candidateDiagnostics?: CandidateDiagnostics;
560
708
  /**
561
709
  * Present only when `persistProvenance` ran and SUCCEEDED: the sidecar provenance
562
710
  * graph id and how many `{branch, sourceId}` rows were upserted. Absent when
@@ -638,8 +786,20 @@ declare const MERGE_ERROR_CODES: {
638
786
  readonly branch: "GRAPH_MERGE_BRANCH_ERROR";
639
787
  readonly similarityUnavailable: "GRAPH_MERGE_SIMILARITY_UNAVAILABLE";
640
788
  readonly conflict: "GRAPH_MERGE_CONFLICT";
789
+ readonly constraintConflict: "GRAPH_MERGE_CONSTRAINT_CONFLICT";
641
790
  readonly identityConflict: "GRAPH_MERGE_IDENTITY_CONFLICT";
642
791
  readonly baseVersionMismatch: "GRAPH_MERGE_BASE_VERSION_MISMATCH";
792
+ readonly planCapability: "GRAPH_MERGE_PLAN_CAPABILITY";
793
+ readonly planInvalid: "GRAPH_MERGE_PLAN_INVALID";
794
+ readonly planVersionUnsupported: "GRAPH_MERGE_PLAN_VERSION_UNSUPPORTED";
795
+ readonly planDigestMismatch: "GRAPH_MERGE_PLAN_DIGEST_MISMATCH";
796
+ readonly planTargetMismatch: "GRAPH_MERGE_PLAN_TARGET_MISMATCH";
797
+ readonly planSchemaMismatch: "GRAPH_MERGE_PLAN_SCHEMA_MISMATCH";
798
+ readonly planOriginMismatch: "GRAPH_MERGE_PLAN_ORIGIN_MISMATCH";
799
+ readonly planStale: "GRAPH_MERGE_PLAN_STALE";
800
+ readonly planningStale: "GRAPH_MERGE_PLANNING_STALE";
801
+ readonly candidateSource: "GRAPH_MERGE_CANDIDATE_SOURCE";
802
+ readonly evidence: "GRAPH_MERGE_EVIDENCE";
643
803
  };
644
804
  /**
645
805
  * Options shared by every merge error. Mirrors the relevant subset of
@@ -690,6 +850,25 @@ declare class MergeConflictError extends MergeError {
690
850
  readonly code: "GRAPH_MERGE_CONFLICT";
691
851
  constructor(message: string, options?: MergeErrorOptions);
692
852
  }
853
+ /** Details copied from the deterministic store constraint that refused commit. */
854
+ type MergeConstraintConflictErrorDetails = Readonly<{
855
+ /** Stable code of the underlying store constraint error. */
856
+ constraintCode: string;
857
+ /** Class name of the underlying store constraint error. */
858
+ constraintErrorName: string;
859
+ /** Constraint-specific fields, also copied onto this details object. */
860
+ constraintDetails: Readonly<Record<string, unknown>>;
861
+ [key: string]: unknown;
862
+ }>;
863
+ /** Raised when a resolved merge would commit a graph that violates a constraint. */
864
+ declare class MergeConstraintConflictError extends MergeError {
865
+ protected static readonly errorCategory = "constraint";
866
+ readonly code: "GRAPH_MERGE_CONSTRAINT_CONFLICT";
867
+ readonly category: "constraint";
868
+ readonly cause: TypeGraphError;
869
+ readonly details: MergeConstraintConflictErrorDetails;
870
+ constructor(cause: TypeGraphError);
871
+ }
693
872
  /** Raised when identity branches contain opposing or retract/reassert truth. */
694
873
  declare class IdentityMergeConflictError extends MergeError {
695
874
  readonly code: "GRAPH_MERGE_IDENTITY_CONFLICT";
@@ -704,6 +883,63 @@ declare class BaseVersionMismatchError extends MergeError {
704
883
  readonly code: "GRAPH_MERGE_BASE_VERSION_MISMATCH";
705
884
  constructor(message: string, options?: MergeErrorOptions);
706
885
  }
886
+ /** Raised when a target cannot provide the durable plan/apply guarantees. */
887
+ declare class MergePlanCapabilityError extends MergeError {
888
+ protected static readonly errorCategory = "user";
889
+ readonly code: "GRAPH_MERGE_PLAN_CAPABILITY";
890
+ constructor(message: string, options?: MergeErrorOptions);
891
+ }
892
+ /** Raised when a serialized plan is structurally or semantically malformed. */
893
+ declare class InvalidMergePlanError extends MergeError {
894
+ protected static readonly errorCategory = "user";
895
+ readonly code: string;
896
+ constructor(message: string, options?: MergeErrorOptions);
897
+ }
898
+ /** Raised when a plan uses a wire format this library version cannot read. */
899
+ declare class UnsupportedMergePlanVersionError extends InvalidMergePlanError {
900
+ readonly code: "GRAPH_MERGE_PLAN_VERSION_UNSUPPORTED";
901
+ constructor(message: string, options?: MergeErrorOptions);
902
+ }
903
+ /** Raised when a plan's canonical content no longer matches its digest. */
904
+ declare class MergePlanDigestMismatchError extends InvalidMergePlanError {
905
+ readonly code: "GRAPH_MERGE_PLAN_DIGEST_MISMATCH";
906
+ constructor(message: string, options?: MergeErrorOptions);
907
+ }
908
+ /** Raised when a plan names a different target graph. */
909
+ declare class MergePlanTargetMismatchError extends InvalidMergePlanError {
910
+ readonly code: "GRAPH_MERGE_PLAN_TARGET_MISMATCH";
911
+ constructor(message: string, options?: MergeErrorOptions);
912
+ }
913
+ /** Raised when a plan was produced for another active schema. */
914
+ declare class MergePlanSchemaMismatchError extends InvalidMergePlanError {
915
+ readonly code: "GRAPH_MERGE_PLAN_SCHEMA_MISMATCH";
916
+ constructor(message: string, options?: MergeErrorOptions);
917
+ }
918
+ /** Raised when a plan belongs to an independently-created revision clock. */
919
+ declare class MergePlanOriginMismatchError extends InvalidMergePlanError {
920
+ readonly code: "GRAPH_MERGE_PLAN_ORIGIN_MISMATCH";
921
+ constructor(message: string, options?: MergeErrorOptions);
922
+ }
923
+ /** Raised when the target revision no longer equals the plan's fence. */
924
+ declare class StaleMergePlanError extends MergeError {
925
+ readonly code: string;
926
+ constructor(message: string, options?: MergeErrorOptions);
927
+ }
928
+ /** Raised when the target moved while a plan was being computed. */
929
+ declare class MergePlanningStaleError extends StaleMergePlanError {
930
+ readonly code: "GRAPH_MERGE_PLANNING_STALE";
931
+ constructor(message: string, options?: MergeErrorOptions);
932
+ }
933
+ /** Raised when a built-in candidate source cannot produce attributed output. */
934
+ declare class CandidateSourceError extends MergeError {
935
+ readonly code: "GRAPH_MERGE_CANDIDATE_SOURCE";
936
+ constructor(message: string, options?: MergeErrorOptions);
937
+ }
938
+ /** Raised when match evidence is invalid or contains a non-finite score. */
939
+ declare class MatchEvidenceError extends MergeError {
940
+ readonly code: "GRAPH_MERGE_EVIDENCE";
941
+ constructor(message: string, options?: MergeErrorOptions);
942
+ }
707
943
 
708
944
  /**
709
945
  * Pluggable working-copy strategy: how `branch()` produces an isolated,
@@ -849,38 +1085,6 @@ declare function cloneWorkingCopyStrategy<G extends GraphDef>(makeBackend: MakeB
849
1085
  */
850
1086
  declare function branch<G extends GraphDef>(baseStore: GraphBranch<G>["store"], makeBackend: MakeBackend, options?: BranchOptions, strategy?: WorkingCopyStrategy<G>): Promise<Result<GraphBranch<G>, BranchError>>;
851
1087
 
852
- /**
853
- * The composite MERGE IDENTITY key for a node: the pair `(kind, id)`.
854
- *
855
- * TypeGraph node identity is the PAIR `(kind, id)` — a bare id string is NOT unique
856
- * on its own (a `Patient` and an `Encounter` may both carry the id "x" as two
857
- * DISTINCT committed nodes; ids are caller-supplied). Every place the merge pipeline
858
- * groups, clusters, de-dupes, repoints, retypes, or deletes BY NODE IDENTITY must
859
- * key on this pair — never the bare id — or two different-kind nodes that happen to
860
- * share an id string silently fuse into one cluster (wrong merge, dropped node,
861
- * incoherent commit) and the §6.4-A base guard is bypassed.
862
- *
863
- * Represented as a NUL-joined string (a branded {@link MergeKey}) so it doubles as a
864
- * `Map`/`Set` key and a deterministic ordering key. `kind` is a schema identifier
865
- * (NUL-free), so the FIRST NUL unambiguously delimits kind from id even when a
866
- * caller-supplied id itself contains a NUL byte. This matches the `(kind, id)`
867
- * separator the commit-time write guard already uses.
868
- *
869
- * {@link compareMergeKeys} orders by the bare id FIRST (kind only breaks a same-id
870
- * tie), so the merge's "minimum-id survivor" / id-sorted-members semantics are
871
- * preserved unchanged for the common single-kind cluster — the composite key changes
872
- * WHICH nodes share an identity, never the ordering among genuinely distinct ids.
873
- */
874
-
875
- /**
876
- * A composite `(kind, id)` node-identity key. Branded so it cannot be confused with
877
- * a bare {@link NodeId} at the type level — the whole point is that the two are NOT
878
- * interchangeable as identities.
879
- */
880
- type MergeKey = string & {
881
- readonly __mergeKey: unique symbol;
882
- };
883
-
884
1088
  /**
885
1089
  * The shared SCORING stage (design §4, the single match-decision point).
886
1090
  *
@@ -929,7 +1133,9 @@ type MergeKey = string & {
929
1133
  type CandidateEdge = Readonly<{
930
1134
  a: MergeKey;
931
1135
  b: MergeKey;
1136
+ /** Internal drop-weakest rank. Definitional 1 is never copied to evidence. */
932
1137
  score: number;
1138
+ evidence: MatchEvidence;
933
1139
  }>;
934
1140
  /**
935
1141
  * An unscored candidate pair a source proposes for scoring: the canonical
@@ -943,8 +1149,241 @@ type CandidatePair<K extends NodeType = NodeType> = Readonly<{
943
1149
  b: MergeKey;
944
1150
  left: Node<K>;
945
1151
  right: Node<K>;
1152
+ sources: readonly MatchSource[];
1153
+ }>;
1154
+
1155
+ declare const MERGE_PLAN_FORMAT_VERSION: 1;
1156
+ declare const MERGE_PLAN_DIGEST_ALGORITHM: "sha256";
1157
+ type MergePlanEntityRef = Readonly<{
1158
+ kind: string;
1159
+ id: string;
1160
+ }>;
1161
+ type MergePlanSchemaFence = Readonly<{
1162
+ managed: boolean;
1163
+ version: number;
1164
+ hash: string;
1165
+ }>;
1166
+ type MergePlanRevisionFence = Readonly<{
1167
+ origin: string;
1168
+ revision: string | null;
1169
+ }>;
1170
+ type MergePlanTargetFence = Readonly<{
1171
+ graphId: string;
1172
+ schema: MergePlanSchemaFence;
1173
+ revision: MergePlanRevisionFence;
1174
+ }>;
1175
+ type MergePlanBranchAnchor = Readonly<{
1176
+ branchId: string;
1177
+ baseVersion: string;
1178
+ }>;
1179
+ type MergePlanAnchors = Readonly<{
1180
+ kind: "snapshot";
1181
+ base: Readonly<{
1182
+ graphId: string;
1183
+ baseVersion: string;
1184
+ }>;
1185
+ branches: readonly MergePlanBranchAnchor[];
1186
+ }> | Readonly<{
1187
+ kind: "incremental";
1188
+ forkPoint: Readonly<{
1189
+ graphId: string;
1190
+ baseVersion: string;
1191
+ schema: MergePlanSchemaFence;
1192
+ }>;
1193
+ branches: readonly MergePlanBranchAnchor[];
1194
+ }>;
1195
+ type MergePlanNodeDelete = MergePlanEntityRef;
1196
+ type MergePlanNodeUpsert = Readonly<{
1197
+ kind: string;
1198
+ id: string;
1199
+ setProps: Readonly<Record<string, JsonValue>>;
1200
+ unsetProps: readonly string[];
1201
+ validFrom?: string | undefined;
1202
+ validTo?: string | undefined;
1203
+ }>;
1204
+ type MergePlanEdgeDelete = MergePlanEntityRef;
1205
+ type MergePlanEdgeUpsert = Readonly<{
1206
+ kind: string;
1207
+ id: string;
1208
+ from: MergePlanEntityRef;
1209
+ to: MergePlanEntityRef;
1210
+ setProps: Readonly<Record<string, JsonValue>>;
1211
+ unsetProps: readonly string[];
1212
+ validFrom?: string | undefined;
1213
+ validTo?: string | undefined;
1214
+ }>;
1215
+ type MergePlanIdentityAssertion = Readonly<{
1216
+ id: string;
1217
+ relation: "same" | "different";
1218
+ a: MergePlanEntityRef;
1219
+ b: MergePlanEntityRef;
1220
+ validFrom: string;
1221
+ validTo?: string | undefined;
1222
+ endedBy?: MergePlanEntityRef | undefined;
1223
+ }>;
1224
+ type MergePlanWrites = Readonly<{
1225
+ nodeDeletes: readonly MergePlanNodeDelete[];
1226
+ nodeUpserts: readonly MergePlanNodeUpsert[];
1227
+ edgeDeletes: readonly MergePlanEdgeDelete[];
1228
+ edgeUpserts: readonly MergePlanEdgeUpsert[];
1229
+ identityAssertions: readonly MergePlanIdentityAssertion[];
1230
+ identityRetractions: readonly MergePlanIdentityAssertion[];
1231
+ }>;
1232
+ type MergePlanProposedSummary = Readonly<{
1233
+ nodes: Readonly<{
1234
+ upserts: number;
1235
+ deletions: number;
1236
+ }>;
1237
+ edges: Readonly<{
1238
+ upserts: number;
1239
+ deletions: number;
1240
+ }>;
1241
+ identity: Readonly<{
1242
+ assertions: number;
1243
+ retractions: number;
1244
+ }>;
1245
+ }>;
1246
+ type MergePlanCanonicalMapping = Readonly<{
1247
+ member: MergePlanEntityRef;
1248
+ canonical: MergePlanEntityRef;
1249
+ }>;
1250
+ type MergePlanRetype = Readonly<{
1251
+ entity: MergePlanEntityRef;
1252
+ toKind: string;
1253
+ }>;
1254
+ type MergePlanGuards = Readonly<{
1255
+ canonicalMappings: readonly MergePlanCanonicalMapping[];
1256
+ retypes: readonly MergePlanRetype[];
1257
+ deletedNodes: readonly MergePlanEntityRef[];
1258
+ incremental?: Readonly<{
1259
+ tombstoneResurrection: "refuse";
1260
+ lossyUpdates: "refuse";
1261
+ edgeIdentity: "preserve";
1262
+ }>;
1263
+ }>;
1264
+ type MergePlanMatchSource = Readonly<{
1265
+ kind: "block";
1266
+ sourceId: string;
1267
+ }> | Readonly<{
1268
+ kind: "unique";
1269
+ sourceId: string;
1270
+ constraintName: string;
1271
+ }> | Readonly<{
1272
+ kind: "baseUnique";
1273
+ sourceId: string;
1274
+ constraintName: string;
1275
+ }> | Readonly<{
1276
+ kind: "baseIndex";
1277
+ sourceId: string;
1278
+ indexName: string;
1279
+ }> | Readonly<{
1280
+ kind: "keyless";
1281
+ sourceId: string;
1282
+ }> | Readonly<{
1283
+ kind: "retype";
1284
+ sourceId: string;
1285
+ }> | Readonly<{
1286
+ kind: "custom";
1287
+ sourceId: string;
1288
+ metadata?: JsonValue | undefined;
1289
+ }>;
1290
+ type MergePlanSimilarityStrategy = Readonly<{
1291
+ kind: "fulltext" | "vector";
1292
+ fields: readonly string[];
1293
+ }> | Readonly<{
1294
+ kind: "hybrid";
1295
+ fields: readonly string[];
1296
+ weights: Readonly<{
1297
+ vector: number;
1298
+ fulltext: number;
1299
+ }>;
1300
+ }> | Readonly<{
1301
+ kind: "custom";
1302
+ }>;
1303
+ type MergePlanMatchEvidence = Readonly<{
1304
+ a: MergePlanEntityRef;
1305
+ b: MergePlanEntityRef;
1306
+ sources: readonly MergePlanMatchSource[];
1307
+ decision: "definitional";
1308
+ }> | Readonly<{
1309
+ a: MergePlanEntityRef;
1310
+ b: MergePlanEntityRef;
1311
+ sources: readonly MergePlanMatchSource[];
1312
+ decision: "scored";
1313
+ strategy: MergePlanSimilarityStrategy;
1314
+ score: number;
1315
+ threshold: number;
1316
+ }>;
1317
+ type MergePlanEntityResolution = Readonly<{
1318
+ canonicalId: string;
1319
+ memberIds: readonly string[];
1320
+ kind: string;
1321
+ branchOrigins: readonly string[];
1322
+ decisiveEdges: readonly MergePlanMatchEvidence[];
1323
+ }>;
1324
+ type MergePlanCandidateDiagnostic = Readonly<{
1325
+ evidence: MergePlanMatchEvidence;
1326
+ scoreDecision: "accepted" | "rejected";
1327
+ reason?: "noComparableValues" | undefined;
1328
+ clusterDisposition?: "retained" | Readonly<{
1329
+ kind: "excluded";
1330
+ reason: "diameter" | "baseAmbiguity";
1331
+ }> | undefined;
1332
+ }>;
1333
+ type MergePlanDiagnostics = Readonly<{
1334
+ entries: readonly MergePlanCandidateDiagnostic[];
1335
+ total: number;
1336
+ limit: number;
1337
+ truncated: boolean;
1338
+ }>;
1339
+ type MergePlanTypeReconciliation = Readonly<{
1340
+ entityId: string;
1341
+ fromTypes: readonly string[];
1342
+ toType: string;
1343
+ decisiveEdges?: readonly MergePlanMatchEvidence[] | undefined;
1344
+ }>;
1345
+ type MergePlanReview = Readonly<{
1346
+ resolutions: readonly MergePlanEntityResolution[];
1347
+ conflicts: readonly JsonValue[];
1348
+ deleteModifyConflicts: readonly JsonValue[];
1349
+ typeReconciliations: readonly MergePlanTypeReconciliation[];
1350
+ dropped: readonly JsonValue[];
1351
+ validityEnds: readonly JsonValue[];
1352
+ baseAmbiguities: readonly JsonValue[];
1353
+ provenanceRecords: readonly JsonValue[];
1354
+ warnings: readonly string[];
1355
+ diagnostics?: MergePlanDiagnostics | undefined;
1356
+ }>;
1357
+ type MergePlanProvenanceOptions = Readonly<{
1358
+ includeInReport: boolean;
1359
+ persist: boolean;
1360
+ }>;
1361
+ type MergePlanDigest = Readonly<{
1362
+ algorithm: typeof MERGE_PLAN_DIGEST_ALGORITHM;
1363
+ value: string;
1364
+ }>;
1365
+ type MergePlanArtifactV1 = Readonly<{
1366
+ formatVersion: typeof MERGE_PLAN_FORMAT_VERSION;
1367
+ digest: MergePlanDigest;
1368
+ mode: "snapshot" | "incremental";
1369
+ target: MergePlanTargetFence;
1370
+ anchors: MergePlanAnchors;
1371
+ proposed: MergePlanProposedSummary;
1372
+ writes: MergePlanWrites;
1373
+ guards: MergePlanGuards;
1374
+ review: MergePlanReview;
1375
+ provenance: MergePlanProvenanceOptions;
946
1376
  }>;
1377
+ /** Current public merge-plan artifact type. */
1378
+ type MergePlanArtifact = MergePlanArtifactV1;
1379
+ type MergePlanArtifactV1Input = Omit<MergePlanArtifactV1, "digest">;
947
1380
 
1381
+ /** Builds a durable, reviewable snapshot merge plan without mutating the target. */
1382
+ declare function planMerge<G extends GraphDef>(store: Store<G>, branches: readonly GraphBranch<G>[], optionsInput?: MergeOptions<G>): Promise<Result<MergePlanArtifact, MergeError>>;
1383
+ /** Builds a durable, reviewable incremental merge plan without mutating the target. */
1384
+ declare function planMergeIncremental<G extends GraphDef>(args: MergeIncrementalArgs<G>): Promise<Result<MergePlanArtifact, MergeError>>;
1385
+ /** Validates and atomically applies an approved serialized merge plan. */
1386
+ declare function applyMergePlan<G extends GraphDef>(target: Store<G>, input: MergePlanArtifact): Promise<Result<MergeReport<G>, MergeError>>;
948
1387
  /**
949
1388
  * Merges a set of branches back into a target store (design §7.2).
950
1389
  *
@@ -1042,6 +1481,7 @@ type NormalizedMergeOptions<G extends GraphDef = GraphDef> = Readonly<{
1042
1481
  target?: MergeOptions<G>["target"];
1043
1482
  maxComparisonsPerKind?: number;
1044
1483
  clusterMaxDiameter?: number;
1484
+ candidateDiagnostics?: CandidateDiagnosticsOptions;
1045
1485
  branchOrder?: readonly BranchId[];
1046
1486
  provenanceWeights?: ReadonlyMap<BranchId, number>;
1047
1487
  }>;
@@ -1196,6 +1636,8 @@ type BaseMember = Readonly<{
1196
1636
  kind: string;
1197
1637
  props: Readonly<Record<string, JsonValue>>;
1198
1638
  origin: "base";
1639
+ validFrom?: string;
1640
+ validTo?: string;
1199
1641
  }>;
1200
1642
  /**
1201
1643
  * What a candidate source emits for one kind: fuzzy `pairs` to score, FORCED
@@ -1280,4 +1722,4 @@ type KeylessConfig = Readonly<{
1280
1722
  sortFields: readonly string[];
1281
1723
  }>;
1282
1724
 
1283
- export { type BaseAmbiguity, type BaseNodeLookup, type BaseVersion, BaseVersionMismatchError, BranchError, type BranchId, type BranchOptions, type BranchProvenance, type CandidateSource, type ComparisonCeilingPolicy, type ConflictingValue, type DeleteModifyConflict, type DeleteModifyPolicy, type DroppedItem, type Embedder, type EntityResolution, type GraphBranch, IdentityMergeConflictError, InvalidMergeOptionsError, type KeylessConfig, MERGE_ERROR_CODES, MERGE_OPTION_DEFAULTS, type MakeBackend, MergeConflictError, MergeError, type MergeIncrementalArgs, type MergeOptions, type MergeReport, type MergedCounts, type NormalizedMergeOptions, type PropertyConflict, type PropertyConflictPolicy, type ProvenanceGraph, type ProvenanceIndex, type ProvenanceNode, type ProvenanceQuery, type ProvenanceRecord, type ReconcileTypesMode, type ResolveConfig, type ResolveMap, type ResolvedCluster, Result, type SimilarityStrategy, SimilarityUnavailableError, type SourceScope, type TypeReconciliation, VALIDITY_END_TARGET_PRECEDENCE, type ValidityEndResolution, type WorkingCopyStrategy, asBaseVersion, asBranchId, branch, cloneWorkingCopyStrategy, computeBaseVersion, merge, mergeIncremental, normalizeMergeOptions, openProvenanceStore, persistProvenanceRecords, provenanceGraphId, readProvenance };
1725
+ export { type BaseAmbiguity, type BaseNodeLookup, type BaseVersion, BaseVersionMismatchError, BranchError, type BranchId, type BranchOptions, type BranchProvenance, type CandidateDiagnostic, type CandidateDiagnostics, type CandidateDiagnosticsOptions, type CandidateSource, CandidateSourceError, type ComparisonCeilingPolicy, type ConflictingValue, type DeleteModifyConflict, type DeleteModifyPolicy, type DroppedItem, type Embedder, type EntityRef, type EntityResolution, type GraphBranch, IdentityMergeConflictError, InvalidMergeOptionsError, InvalidMergePlanError, type KeylessConfig, MERGE_ERROR_CODES, MERGE_OPTION_DEFAULTS, MERGE_PLAN_DIGEST_ALGORITHM, MERGE_PLAN_FORMAT_VERSION, type MakeBackend, type MatchEvidence, MatchEvidenceError, type MatchSource, type MatchStrategy, MergeConflictError, MergeConstraintConflictError, type MergeConstraintConflictErrorDetails, MergeError, type MergeIncrementalArgs, type MergeOptions, type MergePlanAnchors, type MergePlanArtifact, type MergePlanArtifactV1, type MergePlanArtifactV1Input, type MergePlanBranchAnchor, type MergePlanCandidateDiagnostic, type MergePlanCanonicalMapping, MergePlanCapabilityError, type MergePlanDiagnostics, type MergePlanDigest, MergePlanDigestMismatchError, type MergePlanEdgeDelete, type MergePlanEdgeUpsert, type MergePlanEntityRef, type MergePlanEntityResolution, type MergePlanGuards, type MergePlanIdentityAssertion, type MergePlanMatchEvidence, type MergePlanMatchSource, type MergePlanNodeDelete, type MergePlanNodeUpsert, MergePlanOriginMismatchError, type MergePlanProposedSummary, type MergePlanProvenanceOptions, type MergePlanRetype, type MergePlanReview, type MergePlanRevisionFence, type MergePlanSchemaFence, MergePlanSchemaMismatchError, type MergePlanSimilarityStrategy, type MergePlanTargetFence, MergePlanTargetMismatchError, type MergePlanTypeReconciliation, type MergePlanWrites, MergePlanningStaleError, type MergeReport, type MergedCounts, type NormalizedMergeOptions, type PropertyConflict, type PropertyConflictPolicy, type ProvenanceGraph, type ProvenanceIndex, type ProvenanceNode, type ProvenanceQuery, type ProvenanceRecord, type ReconcileTypesMode, type ResolveConfig, type ResolveMap, type ResolvedCluster, Result, type SimilarityStrategy, SimilarityUnavailableError, type SourceScope, StaleMergePlanError, type TypeReconciliation, UnsupportedMergePlanVersionError, VALIDITY_END_TARGET_PRECEDENCE, type ValidityEndResolution, type WorkingCopyStrategy, applyMergePlan, asBaseVersion, asBranchId, branch, cloneWorkingCopyStrategy, computeBaseVersion, merge, mergeIncremental, normalizeMergeOptions, openProvenanceStore, persistProvenanceRecords, planMerge, planMergeIncremental, provenanceGraphId, readProvenance };