@nicia-ai/typegraph 0.33.0 → 0.35.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.
- package/README.md +20 -0
- package/dist/backend/postgres/index.cjs +30 -26
- package/dist/backend/postgres/index.d.cts +39 -7
- package/dist/backend/postgres/index.d.ts +39 -7
- package/dist/backend/postgres/index.js +17 -13
- package/dist/backend/postgres/pglite.cjs +22 -18
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +4 -4
- package/dist/backend/postgres/pglite.d.ts +4 -4
- package/dist/backend/postgres/pglite.js +17 -13
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +26 -23
- package/dist/backend/sqlite/index.d.cts +8 -8
- package/dist/backend/sqlite/index.d.ts +8 -8
- package/dist/backend/sqlite/index.js +14 -11
- package/dist/backend/sqlite/libsql.cjs +21 -17
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +13 -6
- package/dist/backend/sqlite/libsql.d.ts +13 -6
- package/dist/backend/sqlite/libsql.js +17 -13
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +102 -18
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +95 -5
- package/dist/backend/sqlite/local.d.ts +95 -5
- package/dist/backend/sqlite/local.js +96 -13
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-JHOBXD7O.js → chunk-3TWF3SH4.js} +332 -64
- package/dist/chunk-3TWF3SH4.js.map +1 -0
- package/dist/chunk-4JEZZJ6S.cjs +1271 -0
- package/dist/chunk-4JEZZJ6S.cjs.map +1 -0
- package/dist/{chunk-I4W7MKVG.cjs → chunk-4TOD4LBZ.cjs} +249 -294
- package/dist/chunk-4TOD4LBZ.cjs.map +1 -0
- package/dist/chunk-55MZDDZV.js +239 -0
- package/dist/chunk-55MZDDZV.js.map +1 -0
- package/dist/{chunk-LM2IC4ZJ.cjs → chunk-5A6FNS6N.cjs} +75 -19
- package/dist/chunk-5A6FNS6N.cjs.map +1 -0
- package/dist/{chunk-FDN43KXV.cjs → chunk-5AQIKK56.cjs} +65 -24
- package/dist/chunk-5AQIKK56.cjs.map +1 -0
- package/dist/{chunk-IZ4PCL47.js → chunk-5SEGFTZX.js} +4 -66
- package/dist/chunk-5SEGFTZX.js.map +1 -0
- package/dist/{chunk-CWFPJ3RC.js → chunk-6FR2MMS6.js} +7 -7
- package/dist/chunk-6FR2MMS6.js.map +1 -0
- package/dist/chunk-7YSP4V4R.cjs +69 -0
- package/dist/chunk-7YSP4V4R.cjs.map +1 -0
- package/dist/chunk-A42GCBGX.cjs +28 -0
- package/dist/chunk-A42GCBGX.cjs.map +1 -0
- package/dist/chunk-ACSVZPK7.cjs +21 -0
- package/dist/chunk-ACSVZPK7.cjs.map +1 -0
- package/dist/{chunk-OIE2UPVG.cjs → chunk-BLZDPRXT.cjs} +52 -21
- package/dist/chunk-BLZDPRXT.cjs.map +1 -0
- package/dist/chunk-BYPOGQWK.js +25 -0
- package/dist/chunk-BYPOGQWK.js.map +1 -0
- package/dist/{chunk-NG5N7R45.cjs → chunk-CK5BVQOW.cjs} +325 -213
- package/dist/chunk-CK5BVQOW.cjs.map +1 -0
- package/dist/chunk-CTTSDJLY.cjs +261 -0
- package/dist/chunk-CTTSDJLY.cjs.map +1 -0
- package/dist/chunk-CUHM5CWJ.cjs +12 -0
- package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
- package/dist/chunk-CZQ3FO2Q.js +2320 -0
- package/dist/chunk-CZQ3FO2Q.js.map +1 -0
- package/dist/{chunk-CFNT3ITG.cjs → chunk-D7ZEOS56.cjs} +25 -52
- package/dist/chunk-D7ZEOS56.cjs.map +1 -0
- package/dist/chunk-DFVLCOP6.js +10 -0
- package/dist/chunk-DFVLCOP6.js.map +1 -0
- package/dist/chunk-DI74SMXS.cjs +29 -0
- package/dist/chunk-DI74SMXS.cjs.map +1 -0
- package/dist/{chunk-KY5SDVA7.cjs → chunk-EM3CWPND.cjs} +442 -113
- package/dist/chunk-EM3CWPND.cjs.map +1 -0
- package/dist/chunk-EMF62TZG.cjs +1176 -0
- package/dist/chunk-EMF62TZG.cjs.map +1 -0
- package/dist/chunk-EOLERH7Y.cjs +40 -0
- package/dist/chunk-EOLERH7Y.cjs.map +1 -0
- package/dist/{chunk-3QRBXYT5.cjs → chunk-FACJJWGF.cjs} +24 -6
- package/dist/chunk-FACJJWGF.cjs.map +1 -0
- package/dist/{chunk-KTIEB7VH.cjs → chunk-FL472AMI.cjs} +49 -165
- package/dist/chunk-FL472AMI.cjs.map +1 -0
- package/dist/{chunk-4RBAJVEC.cjs → chunk-FN35DLCN.cjs} +31 -9
- package/dist/chunk-FN35DLCN.cjs.map +1 -0
- package/dist/{chunk-C4C4Q7A6.js → chunk-FPIZFYHE.js} +12 -35
- package/dist/chunk-FPIZFYHE.js.map +1 -0
- package/dist/{chunk-XKNAK27R.js → chunk-FRV5Q5IO.js} +64 -8
- package/dist/chunk-FRV5Q5IO.js.map +1 -0
- package/dist/{chunk-K5P5OZXS.js → chunk-G6Q5UM7U.js} +2 -2
- package/dist/{chunk-K5P5OZXS.js.map → chunk-G6Q5UM7U.js.map} +1 -1
- package/dist/chunk-GSQ6NPH6.cjs +100 -0
- package/dist/chunk-GSQ6NPH6.cjs.map +1 -0
- package/dist/chunk-GUR2FNB5.cjs +12 -0
- package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-GUR2FNB5.cjs.map} +1 -1
- package/dist/{chunk-ZFWNO3GE.cjs → chunk-H7YNSMA7.cjs} +107 -2
- package/dist/chunk-H7YNSMA7.cjs.map +1 -0
- package/dist/{chunk-GYVBEZAO.js → chunk-I7ZUZKFD.js} +47 -19
- package/dist/chunk-I7ZUZKFD.js.map +1 -0
- package/dist/chunk-ITE4IXAK.js +25 -0
- package/dist/chunk-ITE4IXAK.js.map +1 -0
- package/dist/{chunk-D3EWZ67S.cjs → chunk-J7WFGBJR.cjs} +3372 -4970
- package/dist/chunk-J7WFGBJR.cjs.map +1 -0
- package/dist/{chunk-PYD3UCDU.js → chunk-JBTOYDMN.js} +202 -251
- package/dist/chunk-JBTOYDMN.js.map +1 -0
- package/dist/{chunk-XVUJY72M.js → chunk-K3PPLHY7.js} +234 -118
- package/dist/chunk-K3PPLHY7.js.map +1 -0
- package/dist/{chunk-454I6GDF.js → chunk-KBGQIPRQ.js} +102 -3
- package/dist/chunk-KBGQIPRQ.js.map +1 -0
- package/dist/chunk-KMI7LYAF.js +1252 -0
- package/dist/chunk-KMI7LYAF.js.map +1 -0
- package/dist/{chunk-JIEJCTDS.cjs → chunk-LGEALRC6.cjs} +21 -4
- package/dist/chunk-LGEALRC6.cjs.map +1 -0
- package/dist/{chunk-TQOYM4LN.js → chunk-MP2JQKSG.js} +21 -5
- package/dist/chunk-MP2JQKSG.js.map +1 -0
- package/dist/{chunk-3642VBVC.cjs → chunk-O7UN7OXA.cjs} +389 -121
- package/dist/chunk-O7UN7OXA.cjs.map +1 -0
- package/dist/chunk-OHMP6N2J.js +47 -0
- package/dist/chunk-OHMP6N2J.js.map +1 -0
- package/dist/{chunk-6NRFUHMS.js → chunk-OR5ZA5WP.js} +135 -24
- package/dist/chunk-OR5ZA5WP.js.map +1 -0
- package/dist/{chunk-PRMKPFN5.js → chunk-Q5TEXCTB.js} +61 -6
- package/dist/chunk-Q5TEXCTB.js.map +1 -0
- package/dist/chunk-QNKSQTKQ.js +1312 -0
- package/dist/chunk-QNKSQTKQ.js.map +1 -0
- package/dist/{chunk-YCV72E6L.js → chunk-QOTI55H7.js} +7 -116
- package/dist/chunk-QOTI55H7.js.map +1 -0
- package/dist/{chunk-QBYTJSAY.js → chunk-QWEUYILR.js} +99 -34
- package/dist/chunk-QWEUYILR.js.map +1 -0
- package/dist/{chunk-OS6KS3HV.js → chunk-RGP33ZJ5.js} +485 -82
- package/dist/chunk-RGP33ZJ5.js.map +1 -0
- package/dist/chunk-RGPG7EOJ.js +94 -0
- package/dist/chunk-RGPG7EOJ.js.map +1 -0
- package/dist/{chunk-WWVV44DY.cjs → chunk-S55OV6PW.cjs} +15 -15
- package/dist/chunk-S55OV6PW.cjs.map +1 -0
- package/dist/{chunk-3E7SNSIA.cjs → chunk-SJDMVITW.cjs} +4 -4
- package/dist/{chunk-3E7SNSIA.cjs.map → chunk-SJDMVITW.cjs.map} +1 -1
- package/dist/{chunk-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
- package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
- package/dist/{chunk-CEF2QOTO.js → chunk-T2WUSPDA.js} +49 -8
- package/dist/chunk-T2WUSPDA.js.map +1 -0
- package/dist/{chunk-YW7GHMF4.cjs → chunk-TCOCYN2P.cjs} +75 -20
- package/dist/chunk-TCOCYN2P.cjs.map +1 -0
- package/dist/{chunk-FLRCVI2G.cjs → chunk-TDXIBCGY.cjs} +2 -2
- package/dist/{chunk-FLRCVI2G.cjs.map → chunk-TDXIBCGY.cjs.map} +1 -1
- package/dist/chunk-TEDRJXOG.cjs +32 -0
- package/dist/chunk-TEDRJXOG.cjs.map +1 -0
- package/dist/{chunk-WLP6TKFB.js → chunk-UES55P7G.js} +2809 -4398
- package/dist/chunk-UES55P7G.js.map +1 -0
- package/dist/{chunk-EF3Z645U.cjs → chunk-UMDVATGY.cjs} +6 -72
- package/dist/chunk-UMDVATGY.cjs.map +1 -0
- package/dist/chunk-UR7W5YQK.js +18 -0
- package/dist/chunk-UR7W5YQK.js.map +1 -0
- package/dist/chunk-UT3S4SEN.js +31 -0
- package/dist/chunk-UT3S4SEN.js.map +1 -0
- package/dist/{chunk-3IR2GEMJ.cjs → chunk-UUT7UN2N.cjs} +149 -38
- package/dist/chunk-UUT7UN2N.cjs.map +1 -0
- package/dist/{chunk-PIHXFF73.js → chunk-UZV3AZKF.js} +21 -3
- package/dist/chunk-UZV3AZKF.js.map +1 -0
- package/dist/{chunk-DJYRRDHA.js → chunk-VHMPG6UL.js} +29 -7
- package/dist/chunk-VHMPG6UL.js.map +1 -0
- package/dist/{chunk-MBLXCV2Y.cjs → chunk-VPYHY3LJ.cjs} +111 -43
- package/dist/chunk-VPYHY3LJ.cjs.map +1 -0
- package/dist/{chunk-WYTUF3QO.js → chunk-VSPCZAXF.js} +3 -3
- package/dist/{chunk-WYTUF3QO.js.map → chunk-VSPCZAXF.js.map} +1 -1
- package/dist/chunk-W63OVYY4.js +29 -0
- package/dist/chunk-W63OVYY4.js.map +1 -0
- package/dist/{chunk-UPDMJEW6.js → chunk-WDBCBWC4.js} +356 -30
- package/dist/chunk-WDBCBWC4.js.map +1 -0
- package/dist/chunk-WJT7OU7E.cjs +1334 -0
- package/dist/chunk-WJT7OU7E.cjs.map +1 -0
- package/dist/chunk-XOX22WHL.cjs +2383 -0
- package/dist/chunk-XOX22WHL.cjs.map +1 -0
- package/dist/{ddl-CVnHJcar.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
- package/dist/{ddl-Dxt_fBHr.d.cts → ddl-CZz7a0E8.d.cts} +4 -4
- package/dist/{extension-types-YGFJPrzK.d.cts → extension-types-ixRpJVUp.d.cts} +24 -1
- package/dist/{extension-types-YGFJPrzK.d.ts → extension-types-ixRpJVUp.d.ts} +24 -1
- package/dist/{types-DGylBhWo.d.ts → fulltext-strategy-B57yvC5Q.d.ts} +2558 -2125
- package/dist/{types-C_UnQOQp.d.cts → fulltext-strategy-CDkSSYhq.d.cts} +2558 -2125
- package/dist/graph-extension/index.cjs +21 -19
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +6 -4
- package/dist/graph-merge/index.cjs +408 -169
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +63 -33
- package/dist/graph-merge/index.d.ts +63 -33
- package/dist/graph-merge/index.js +286 -47
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-DGX6D9j1.d.ts → index-6CSUAq-x.d.ts} +234 -93
- package/dist/{index-SEvUHDA6.d.cts → index-Bks_3HHK.d.cts} +234 -93
- package/dist/index.cjs +240 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +35 -27
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +28 -27
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +10 -9
- package/dist/interchange/index.cjs +47 -17
- package/dist/interchange/index.d.cts +126 -12
- package/dist/interchange/index.d.ts +126 -12
- package/dist/interchange/index.js +14 -4
- package/dist/{manager-BYl_zyZR.d.cts → manager-DwQi8eV0.d.cts} +9 -2
- package/dist/{manager-C0_r0ALf.d.ts → manager-ejUCB52T.d.ts} +9 -2
- package/dist/{materialize-indexes-D20xNluI.d.cts → materialize-indexes-B4e9360H.d.cts} +20 -4
- package/dist/{materialize-indexes-CAkIYFV-.d.ts → materialize-indexes-te9TPMMJ.d.ts} +20 -4
- package/dist/{postgres-_9psmVGm.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
- package/dist/{postgres-MzBPkYzq.d.ts → postgres-DQ5R6rzV.d.ts} +152 -1
- package/dist/profiler/index.cjs +11 -11
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +4 -4
- package/dist/provenance/index.cjs +590 -0
- package/dist/provenance/index.cjs.map +1 -0
- package/dist/provenance/index.d.cts +73 -0
- package/dist/provenance/index.d.ts +73 -0
- package/dist/provenance/index.js +588 -0
- package/dist/provenance/index.js.map +1 -0
- package/dist/schema/index.cjs +55 -38
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +57 -57
- package/dist/schema/index.d.ts +57 -57
- package/dist/schema/index.js +30 -13
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-gm44dShb.d.ts → sqlite-D7zBinNR.d.cts} +92 -1
- package/dist/{sqlite-BfksSb45.d.cts → sqlite-DvQndLky.d.ts} +92 -1
- package/dist/{store-view-FfE5_7eo.d.ts → store-view-BSpqvAxK.d.cts} +445 -46
- package/dist/{store-view-9jQ2rPum.d.cts → store-view-CKbHFRnn.d.ts} +445 -46
- package/dist/{types-B6mhrcLv.d.cts → types-Bv9DcS_E.d.cts} +2 -2
- package/dist/{types-CdWxK-nD.d.ts → types-CoxuV7EJ.d.ts} +2 -2
- package/dist/{where-Bpp2ul_z.d.cts → where-7RKFOsXt.d.ts} +2 -2
- package/dist/{where-BsEXraKW.d.ts → where-DdMIXOtH.d.cts} +2 -2
- package/package.json +21 -14
- package/dist/chunk-2YMGNYXY.js +0 -40
- package/dist/chunk-2YMGNYXY.js.map +0 -1
- package/dist/chunk-3642VBVC.cjs.map +0 -1
- package/dist/chunk-3EUKJEQ3.js +0 -77
- package/dist/chunk-3EUKJEQ3.js.map +0 -1
- package/dist/chunk-3IR2GEMJ.cjs.map +0 -1
- package/dist/chunk-3QRBXYT5.cjs.map +0 -1
- package/dist/chunk-454I6GDF.js.map +0 -1
- package/dist/chunk-4RBAJVEC.cjs.map +0 -1
- package/dist/chunk-6NRFUHMS.js.map +0 -1
- package/dist/chunk-6ZR4QC3O.cjs +0 -12
- package/dist/chunk-73KASJGO.cjs +0 -52
- package/dist/chunk-73KASJGO.cjs.map +0 -1
- package/dist/chunk-BF3ZDEUE.cjs +0 -773
- package/dist/chunk-BF3ZDEUE.cjs.map +0 -1
- package/dist/chunk-C4C4Q7A6.js.map +0 -1
- package/dist/chunk-CEF2QOTO.js.map +0 -1
- package/dist/chunk-CFNT3ITG.cjs.map +0 -1
- package/dist/chunk-CWFPJ3RC.js.map +0 -1
- package/dist/chunk-D3EWZ67S.cjs.map +0 -1
- package/dist/chunk-DJYRRDHA.js.map +0 -1
- package/dist/chunk-EF3Z645U.cjs.map +0 -1
- package/dist/chunk-FDN43KXV.cjs.map +0 -1
- package/dist/chunk-GYVBEZAO.js.map +0 -1
- package/dist/chunk-HTGDWIDE.cjs +0 -89
- package/dist/chunk-HTGDWIDE.cjs.map +0 -1
- package/dist/chunk-I4W7MKVG.cjs.map +0 -1
- package/dist/chunk-IZ4PCL47.js.map +0 -1
- package/dist/chunk-JHOBXD7O.js.map +0 -1
- package/dist/chunk-JIEJCTDS.cjs.map +0 -1
- package/dist/chunk-KTIEB7VH.cjs.map +0 -1
- package/dist/chunk-KY5SDVA7.cjs.map +0 -1
- package/dist/chunk-LM2IC4ZJ.cjs.map +0 -1
- package/dist/chunk-MBLXCV2Y.cjs.map +0 -1
- package/dist/chunk-NG5N7R45.cjs.map +0 -1
- package/dist/chunk-OIE2UPVG.cjs.map +0 -1
- package/dist/chunk-OS6KS3HV.js.map +0 -1
- package/dist/chunk-PIHXFF73.js.map +0 -1
- package/dist/chunk-PRMKPFN5.js.map +0 -1
- package/dist/chunk-PYD3UCDU.js.map +0 -1
- package/dist/chunk-QBYTJSAY.js.map +0 -1
- package/dist/chunk-SPT5JMME.js +0 -610
- package/dist/chunk-SPT5JMME.js.map +0 -1
- package/dist/chunk-SST7XDY6.cjs +0 -624
- package/dist/chunk-SST7XDY6.cjs.map +0 -1
- package/dist/chunk-TQOYM4LN.js.map +0 -1
- package/dist/chunk-UPDMJEW6.js.map +0 -1
- package/dist/chunk-WLP6TKFB.js.map +0 -1
- package/dist/chunk-WWVV44DY.cjs.map +0 -1
- package/dist/chunk-XKNAK27R.js.map +0 -1
- package/dist/chunk-XVUJY72M.js.map +0 -1
- package/dist/chunk-YCV72E6L.js.map +0 -1
- package/dist/chunk-YW7GHMF4.cjs.map +0 -1
- package/dist/chunk-ZFWNO3GE.cjs.map +0 -1
|
@@ -1,37 +1,59 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
require('../chunk-
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
11
|
-
require('../chunk-
|
|
12
|
-
var
|
|
13
|
-
require('../chunk-
|
|
14
|
-
|
|
15
|
-
require('../chunk-
|
|
16
|
-
|
|
17
|
-
require('../chunk-
|
|
18
|
-
var
|
|
19
|
-
require('../chunk-
|
|
3
|
+
var chunkJ7WFGBJR_cjs = require('../chunk-J7WFGBJR.cjs');
|
|
4
|
+
require('../chunk-CTTSDJLY.cjs');
|
|
5
|
+
var chunk4JEZZJ6S_cjs = require('../chunk-4JEZZJ6S.cjs');
|
|
6
|
+
require('../chunk-WJT7OU7E.cjs');
|
|
7
|
+
var chunkCK5BVQOW_cjs = require('../chunk-CK5BVQOW.cjs');
|
|
8
|
+
var chunkACSVZPK7_cjs = require('../chunk-ACSVZPK7.cjs');
|
|
9
|
+
var chunkVPYHY3LJ_cjs = require('../chunk-VPYHY3LJ.cjs');
|
|
10
|
+
require('../chunk-FACJJWGF.cjs');
|
|
11
|
+
require('../chunk-UUT7UN2N.cjs');
|
|
12
|
+
var chunkTEDRJXOG_cjs = require('../chunk-TEDRJXOG.cjs');
|
|
13
|
+
require('../chunk-D7ZEOS56.cjs');
|
|
14
|
+
require('../chunk-UMDVATGY.cjs');
|
|
15
|
+
var chunkFL472AMI_cjs = require('../chunk-FL472AMI.cjs');
|
|
16
|
+
require('../chunk-GSQ6NPH6.cjs');
|
|
17
|
+
var chunkA42GCBGX_cjs = require('../chunk-A42GCBGX.cjs');
|
|
18
|
+
var chunkXOX22WHL_cjs = require('../chunk-XOX22WHL.cjs');
|
|
19
|
+
require('../chunk-EOLERH7Y.cjs');
|
|
20
|
+
require('../chunk-4TOD4LBZ.cjs');
|
|
21
|
+
require('../chunk-BLZDPRXT.cjs');
|
|
22
|
+
require('../chunk-7YSP4V4R.cjs');
|
|
23
|
+
require('../chunk-H7YNSMA7.cjs');
|
|
24
|
+
require('../chunk-SJDMVITW.cjs');
|
|
25
|
+
require('../chunk-DI74SMXS.cjs');
|
|
26
|
+
var chunkLGEALRC6_cjs = require('../chunk-LGEALRC6.cjs');
|
|
27
|
+
require('../chunk-TDXIBCGY.cjs');
|
|
20
28
|
var zod = require('zod');
|
|
21
29
|
|
|
22
30
|
// src/graph-merge/canonical-props.ts
|
|
23
31
|
function canonicalizeProps(props) {
|
|
24
|
-
return JSON.stringify(props,
|
|
32
|
+
return JSON.stringify(props, chunkACSVZPK7_cjs.sortedReplacer);
|
|
25
33
|
}
|
|
26
34
|
function canonicalValueKey(value) {
|
|
27
|
-
return JSON.stringify(value,
|
|
35
|
+
return JSON.stringify(value, chunkACSVZPK7_cjs.sortedReplacer);
|
|
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
|
+
]);
|
|
28
46
|
}
|
|
29
47
|
function parseRowProps(props) {
|
|
30
48
|
let parsed;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
if (typeof props === "string") {
|
|
50
|
+
try {
|
|
51
|
+
parsed = JSON.parse(props);
|
|
52
|
+
} catch {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
parsed = props;
|
|
35
57
|
}
|
|
36
58
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
37
59
|
return {};
|
|
@@ -49,9 +71,6 @@ function mergeKey(kind, id) {
|
|
|
49
71
|
}
|
|
50
72
|
return `${kind}${SEPARATOR}${id}`;
|
|
51
73
|
}
|
|
52
|
-
function compareStrings(left, right) {
|
|
53
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
54
|
-
}
|
|
55
74
|
function mergeKeyOf(node) {
|
|
56
75
|
return mergeKey(node.kind, node.id);
|
|
57
76
|
}
|
|
@@ -78,7 +97,7 @@ function compareMergeKeys(left, right) {
|
|
|
78
97
|
var ENUMERATION_PAGE_SIZE = 1e3;
|
|
79
98
|
async function enumerateAllNodes(backend, graphId, kind) {
|
|
80
99
|
const collected = [];
|
|
81
|
-
let after
|
|
100
|
+
let after;
|
|
82
101
|
for (; ; ) {
|
|
83
102
|
const page = await backend.findNodesByKind({
|
|
84
103
|
graphId,
|
|
@@ -100,7 +119,7 @@ async function enumerateAllNodes(backend, graphId, kind) {
|
|
|
100
119
|
}
|
|
101
120
|
async function enumerateAllEdges(backend, graphId, kind) {
|
|
102
121
|
const collected = [];
|
|
103
|
-
let after
|
|
122
|
+
let after;
|
|
104
123
|
for (; ; ) {
|
|
105
124
|
const page = await backend.findEdgesByKind({
|
|
106
125
|
graphId,
|
|
@@ -225,15 +244,16 @@ function diffEdgeKind(kind, baseRows, forkRows) {
|
|
|
225
244
|
return { new: created, modified, deleted };
|
|
226
245
|
}
|
|
227
246
|
function byId(left, right) {
|
|
228
|
-
return compareStrings(left.id, right.id);
|
|
247
|
+
return chunkA42GCBGX_cjs.compareStrings(left.id, right.id);
|
|
229
248
|
}
|
|
230
|
-
async function diffAgainstBase(baseStore, forkStore) {
|
|
249
|
+
async function diffAgainstBase(baseStore, forkStore, captureForkState = true) {
|
|
231
250
|
const graph = baseStore.graph;
|
|
232
|
-
const nodeKinds =
|
|
233
|
-
const edgeKinds =
|
|
251
|
+
const nodeKinds = chunkVPYHY3LJ_cjs.getNodeKinds(graph);
|
|
252
|
+
const edgeKinds = chunkVPYHY3LJ_cjs.getEdgeKinds(graph);
|
|
234
253
|
const newNodes = [];
|
|
235
254
|
const modifiedNodes = [];
|
|
236
255
|
const deletedNodes = [];
|
|
256
|
+
const forkNodeVersions = /* @__PURE__ */ new Map();
|
|
237
257
|
for (const kind of nodeKinds) {
|
|
238
258
|
const baseRows = await enumerateAllNodes(
|
|
239
259
|
baseStore.backend,
|
|
@@ -245,6 +265,11 @@ async function diffAgainstBase(baseStore, forkStore) {
|
|
|
245
265
|
forkStore.graphId,
|
|
246
266
|
kind
|
|
247
267
|
);
|
|
268
|
+
if (captureForkState) {
|
|
269
|
+
for (const row of forkRows) {
|
|
270
|
+
forkNodeVersions.set(mergeKey(kind, row.id), row.version);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
248
273
|
const delta = diffNodeKind(kind, baseRows, forkRows);
|
|
249
274
|
for (const entry of delta.new) {
|
|
250
275
|
newNodes.push(entry);
|
|
@@ -259,6 +284,7 @@ async function diffAgainstBase(baseStore, forkStore) {
|
|
|
259
284
|
const newEdges = [];
|
|
260
285
|
const modifiedEdges = [];
|
|
261
286
|
const deletedEdges = [];
|
|
287
|
+
const forkEdgeSignatures = /* @__PURE__ */ new Map();
|
|
262
288
|
for (const kind of edgeKinds) {
|
|
263
289
|
const baseRows = await enumerateAllEdges(
|
|
264
290
|
baseStore.backend,
|
|
@@ -270,6 +296,21 @@ async function diffAgainstBase(baseStore, forkStore) {
|
|
|
270
296
|
forkStore.graphId,
|
|
271
297
|
kind
|
|
272
298
|
);
|
|
299
|
+
if (captureForkState) {
|
|
300
|
+
for (const row of forkRows) {
|
|
301
|
+
forkEdgeSignatures.set(
|
|
302
|
+
mergeKey(kind, row.id),
|
|
303
|
+
edgeStateSignature({
|
|
304
|
+
fromKind: row.from_kind,
|
|
305
|
+
fromId: row.from_id,
|
|
306
|
+
toKind: row.to_kind,
|
|
307
|
+
toId: row.to_id,
|
|
308
|
+
live: isLive(row),
|
|
309
|
+
props: parseRowProps(row.props)
|
|
310
|
+
})
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
273
314
|
const delta = diffEdgeKind(kind, baseRows, forkRows);
|
|
274
315
|
for (const entry of delta.new) {
|
|
275
316
|
newEdges.push(entry);
|
|
@@ -291,7 +332,9 @@ async function diffAgainstBase(baseStore, forkStore) {
|
|
|
291
332
|
new: newEdges.sort((left, right) => byId(left, right)),
|
|
292
333
|
modified: modifiedEdges.sort((left, right) => byId(left, right)),
|
|
293
334
|
deleted: deletedEdges.sort((left, right) => byId(left, right))
|
|
294
|
-
}
|
|
335
|
+
},
|
|
336
|
+
forkNodeVersions,
|
|
337
|
+
forkEdgeSignatures
|
|
295
338
|
};
|
|
296
339
|
}
|
|
297
340
|
|
|
@@ -305,6 +348,9 @@ function asBaseVersion(value) {
|
|
|
305
348
|
|
|
306
349
|
// src/graph-merge/base-version.ts
|
|
307
350
|
var TOKEN_SEPARATOR = "\0";
|
|
351
|
+
var REVISION_COMPONENT_PREFIX = "revision:";
|
|
352
|
+
var REVISION_COMPONENT_SEPARATOR = ":";
|
|
353
|
+
var INITIAL_REVISION = "initial";
|
|
308
354
|
var FALLBACK_SCHEMA_VERSION = 1;
|
|
309
355
|
async function readActiveSchemaVersion(backend, graphId) {
|
|
310
356
|
const active = await backend.getActiveSchema(graphId);
|
|
@@ -312,16 +358,16 @@ async function readActiveSchemaVersion(backend, graphId) {
|
|
|
312
358
|
}
|
|
313
359
|
async function computeSchemaComponent(store) {
|
|
314
360
|
const version = await readActiveSchemaVersion(store.backend, store.graphId);
|
|
315
|
-
return
|
|
361
|
+
return chunkCK5BVQOW_cjs.computeSchemaHash(chunkCK5BVQOW_cjs.serializeSchema(store.graph, version));
|
|
316
362
|
}
|
|
317
363
|
function byDigestEntry(left, right) {
|
|
318
|
-
const byKind = compareStrings(left.kind, right.kind);
|
|
319
|
-
return byKind === 0 ? compareStrings(left.id, right.id) : byKind;
|
|
364
|
+
const byKind = chunkA42GCBGX_cjs.compareStrings(left.kind, right.kind);
|
|
365
|
+
return byKind === 0 ? chunkA42GCBGX_cjs.compareStrings(left.id, right.id) : byKind;
|
|
320
366
|
}
|
|
321
367
|
var CONTENT_FINGERPRINT_BYTES = 16;
|
|
322
368
|
async function computeContentComponent(backend, graphId, graph) {
|
|
323
|
-
const nodeKinds =
|
|
324
|
-
const edgeKinds =
|
|
369
|
+
const nodeKinds = chunkVPYHY3LJ_cjs.getNodeKinds(graph);
|
|
370
|
+
const edgeKinds = chunkVPYHY3LJ_cjs.getEdgeKinds(graph);
|
|
325
371
|
const nodeDigest = [];
|
|
326
372
|
for (const kind of nodeKinds) {
|
|
327
373
|
const rows = await enumerateAllNodes(backend, graphId, kind);
|
|
@@ -356,7 +402,7 @@ async function computeContentComponent(backend, graphId, graph) {
|
|
|
356
402
|
}
|
|
357
403
|
}
|
|
358
404
|
}
|
|
359
|
-
return
|
|
405
|
+
return chunkTEDRJXOG_cjs.sha256Hex(
|
|
360
406
|
canonicalizeProps({
|
|
361
407
|
nodes: nodeDigest.sort((left, right) => byDigestEntry(left, right)),
|
|
362
408
|
edges: edgeDigest.sort((left, right) => byDigestEntry(left, right))
|
|
@@ -365,6 +411,16 @@ async function computeContentComponent(backend, graphId, graph) {
|
|
|
365
411
|
);
|
|
366
412
|
}
|
|
367
413
|
async function computeBaseVersion(store) {
|
|
414
|
+
if (store.revisionTrackingEnabled) {
|
|
415
|
+
const [schemaComponent2, origin, revision] = await Promise.all([
|
|
416
|
+
computeSchemaComponent(store),
|
|
417
|
+
store.revisionOriginNow(),
|
|
418
|
+
store.revisionNow()
|
|
419
|
+
]);
|
|
420
|
+
return asBaseVersion(
|
|
421
|
+
`${schemaComponent2}${TOKEN_SEPARATOR}${revisionComponent(origin, revision)}`
|
|
422
|
+
);
|
|
423
|
+
}
|
|
368
424
|
const [schemaComponent, contentComponent] = await Promise.all([
|
|
369
425
|
computeSchemaComponent(store),
|
|
370
426
|
computeContentComponent(store.backend, store.graphId, store.graph)
|
|
@@ -373,6 +429,30 @@ async function computeBaseVersion(store) {
|
|
|
373
429
|
`${schemaComponent}${TOKEN_SEPARATOR}${contentComponent}`
|
|
374
430
|
);
|
|
375
431
|
}
|
|
432
|
+
function revisionComponent(origin, revision) {
|
|
433
|
+
return `${REVISION_COMPONENT_PREFIX}${origin}${REVISION_COMPONENT_SEPARATOR}${revision ?? INITIAL_REVISION}`;
|
|
434
|
+
}
|
|
435
|
+
function hasRevisionAnchor(version) {
|
|
436
|
+
return contentComponentOf(version).startsWith(REVISION_COMPONENT_PREFIX);
|
|
437
|
+
}
|
|
438
|
+
function revisionAnchorOf(version) {
|
|
439
|
+
const revision = revisionPartsOf(version)?.revision;
|
|
440
|
+
return revision === void 0 || revision === INITIAL_REVISION ? void 0 : revision;
|
|
441
|
+
}
|
|
442
|
+
function revisionOriginOf(version) {
|
|
443
|
+
return revisionPartsOf(version)?.origin;
|
|
444
|
+
}
|
|
445
|
+
function revisionPartsOf(version) {
|
|
446
|
+
const component = contentComponentOf(version);
|
|
447
|
+
if (!component.startsWith(REVISION_COMPONENT_PREFIX)) return void 0;
|
|
448
|
+
const encoded = component.slice(REVISION_COMPONENT_PREFIX.length);
|
|
449
|
+
const separator = encoded.indexOf(REVISION_COMPONENT_SEPARATOR);
|
|
450
|
+
if (separator <= 0 || separator === encoded.length - 1) return void 0;
|
|
451
|
+
return {
|
|
452
|
+
origin: encoded.slice(0, separator),
|
|
453
|
+
revision: encoded.slice(separator + 1)
|
|
454
|
+
};
|
|
455
|
+
}
|
|
376
456
|
function contentComponentOf(version) {
|
|
377
457
|
const separatorIndex = version.indexOf(TOKEN_SEPARATOR);
|
|
378
458
|
return separatorIndex === -1 ? version : version.slice(separatorIndex + 1);
|
|
@@ -394,7 +474,7 @@ function toTypeGraphErrorOptions(category, options) {
|
|
|
394
474
|
...options.cause === void 0 ? {} : { cause: options.cause }
|
|
395
475
|
};
|
|
396
476
|
}
|
|
397
|
-
var MergeError = class extends
|
|
477
|
+
var MergeError = class extends chunkLGEALRC6_cjs.TypeGraphError {
|
|
398
478
|
constructor(message, options = {}) {
|
|
399
479
|
super(
|
|
400
480
|
message,
|
|
@@ -404,7 +484,7 @@ var MergeError = class extends chunkJIEJCTDS_cjs.TypeGraphError {
|
|
|
404
484
|
this.name = "MergeError";
|
|
405
485
|
}
|
|
406
486
|
};
|
|
407
|
-
var BranchError = class extends
|
|
487
|
+
var BranchError = class extends chunkLGEALRC6_cjs.TypeGraphError {
|
|
408
488
|
constructor(message, options = {}) {
|
|
409
489
|
super(
|
|
410
490
|
message,
|
|
@@ -447,22 +527,32 @@ var CLONE_IMPORT_BATCH_SIZE = 1e3;
|
|
|
447
527
|
function cloneWorkingCopyStrategy(makeBackend) {
|
|
448
528
|
return {
|
|
449
529
|
create: async (baseStore) => {
|
|
450
|
-
const data = await chunkSST7XDY6_cjs.exportGraph(baseStore, {
|
|
451
|
-
includeMeta: true,
|
|
452
|
-
includeDeleted: false
|
|
453
|
-
});
|
|
454
530
|
const backend = await makeBackend();
|
|
455
531
|
try {
|
|
456
|
-
const [freshStore] = await
|
|
532
|
+
const [freshStore] = await chunkJ7WFGBJR_cjs.createStoreWithSchema(
|
|
457
533
|
baseStore.graph,
|
|
458
|
-
backend
|
|
534
|
+
backend,
|
|
535
|
+
{
|
|
536
|
+
// Keep descendants branchable with the same O(1) anchor contract,
|
|
537
|
+
// but do not copy recorded-time history into the disposable fork.
|
|
538
|
+
revisionTracking: baseStore.revisionTrackingEnabled
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
const result = await chunk4JEZZJ6S_cjs.importGraphStream(
|
|
542
|
+
freshStore,
|
|
543
|
+
chunk4JEZZJ6S_cjs.exportGraphStream(baseStore, {
|
|
544
|
+
includeMeta: true,
|
|
545
|
+
includeTemporal: true,
|
|
546
|
+
includeDeleted: false,
|
|
547
|
+
batchSize: CLONE_IMPORT_BATCH_SIZE
|
|
548
|
+
}),
|
|
549
|
+
{
|
|
550
|
+
onConflict: "error",
|
|
551
|
+
onUnknownProperty: "error",
|
|
552
|
+
validateReferences: true,
|
|
553
|
+
batchSize: CLONE_IMPORT_BATCH_SIZE
|
|
554
|
+
}
|
|
459
555
|
);
|
|
460
|
-
const result = await chunkSST7XDY6_cjs.importGraph(freshStore, data, {
|
|
461
|
-
onConflict: "error",
|
|
462
|
-
onUnknownProperty: "error",
|
|
463
|
-
validateReferences: true,
|
|
464
|
-
batchSize: CLONE_IMPORT_BATCH_SIZE
|
|
465
|
-
});
|
|
466
556
|
if (!result.success) {
|
|
467
557
|
throw new BranchError(
|
|
468
558
|
"Clone import failed: the working copy could not be seeded from the base store. The backend returned by makeBackend() must be empty.",
|
|
@@ -485,12 +575,12 @@ function cloneWorkingCopyStrategy(makeBackend) {
|
|
|
485
575
|
async function branch(baseStore, makeBackend, options, strategy) {
|
|
486
576
|
try {
|
|
487
577
|
const base = await computeBaseVersion(baseStore);
|
|
488
|
-
const id = options?.id ?? asBranchId(
|
|
578
|
+
const id = options?.id ?? asBranchId(chunkXOX22WHL_cjs.generateId());
|
|
489
579
|
const workingCopyStrategy = strategy ?? cloneWorkingCopyStrategy(makeBackend);
|
|
490
580
|
const store = await workingCopyStrategy.create(baseStore);
|
|
491
|
-
return
|
|
581
|
+
return chunkFL472AMI_cjs.ok({ id, base, store });
|
|
492
582
|
} catch (error) {
|
|
493
|
-
return
|
|
583
|
+
return chunkFL472AMI_cjs.err(
|
|
494
584
|
new BranchError("Failed to create working-copy branch of base store", {
|
|
495
585
|
cause: error
|
|
496
586
|
})
|
|
@@ -514,7 +604,7 @@ function constraintSignature(node, constraint) {
|
|
|
514
604
|
return void 0;
|
|
515
605
|
}
|
|
516
606
|
}
|
|
517
|
-
return `${constraint.name}${KEY_PART_SEPARATOR}${
|
|
607
|
+
return `${constraint.name}${KEY_PART_SEPARATOR}${chunkXOX22WHL_cjs.computeUniqueKey(
|
|
518
608
|
props,
|
|
519
609
|
constraint.fields,
|
|
520
610
|
constraint.collation
|
|
@@ -551,12 +641,12 @@ function blockNodes(newNodes, resolveConfig, uniqueConstraints = []) {
|
|
|
551
641
|
}
|
|
552
642
|
}
|
|
553
643
|
const sortedKeys = [...buckets.keys()].sort(
|
|
554
|
-
(left, right) => compareStrings(left, right)
|
|
644
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)
|
|
555
645
|
);
|
|
556
646
|
const ordered = /* @__PURE__ */ new Map();
|
|
557
647
|
for (const key of sortedKeys) {
|
|
558
648
|
const members = [...buckets.get(key)].sort(
|
|
559
|
-
(left, right) => compareStrings(left.id, right.id)
|
|
649
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id)
|
|
560
650
|
);
|
|
561
651
|
ordered.set(key, members);
|
|
562
652
|
}
|
|
@@ -573,7 +663,7 @@ function buildBranchRank(branchOrder, allBranchIds) {
|
|
|
573
663
|
next += 1;
|
|
574
664
|
}
|
|
575
665
|
}
|
|
576
|
-
const remaining = allBranchIds.filter((branchId) => !rank.has(branchId)).sort((left, right) => compareStrings(left, right));
|
|
666
|
+
const remaining = allBranchIds.filter((branchId) => !rank.has(branchId)).sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right));
|
|
577
667
|
for (const branchId of remaining) {
|
|
578
668
|
if (!rank.has(branchId)) {
|
|
579
669
|
rank.set(branchId, next);
|
|
@@ -645,8 +735,8 @@ function collectConflictingValues(property, contributions) {
|
|
|
645
735
|
values.push({ branchId, value });
|
|
646
736
|
}
|
|
647
737
|
return [...values].sort((left, right) => {
|
|
648
|
-
const byBranch = compareStrings(left.branchId, right.branchId);
|
|
649
|
-
return byBranch === 0 ? compareStrings(
|
|
738
|
+
const byBranch = chunkA42GCBGX_cjs.compareStrings(left.branchId, right.branchId);
|
|
739
|
+
return byBranch === 0 ? chunkA42GCBGX_cjs.compareStrings(
|
|
650
740
|
canonicalValueKey(left.value),
|
|
651
741
|
canonicalValueKey(right.value)
|
|
652
742
|
) : byBranch;
|
|
@@ -773,7 +863,7 @@ function unionProperties(canonicalMember, members, context, baseContext, branchR
|
|
|
773
863
|
const props = {};
|
|
774
864
|
const conflicts = [];
|
|
775
865
|
for (const property of [...propertyNames].sort(
|
|
776
|
-
(left, right) => compareStrings(left, right)
|
|
866
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)
|
|
777
867
|
)) {
|
|
778
868
|
const values = collectConflictingValues(property, members);
|
|
779
869
|
if (values.length === 0) {
|
|
@@ -838,14 +928,14 @@ function canonicalizeCluster(cluster, members, policy, branchRank, weights, cano
|
|
|
838
928
|
);
|
|
839
929
|
const memberIds = [
|
|
840
930
|
...new Set(cluster.members.map((member) => idOf(member)))
|
|
841
|
-
].sort((left, right) => compareStrings(left, right));
|
|
931
|
+
].sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right));
|
|
842
932
|
const branchOrigins = [
|
|
843
933
|
...new Set(
|
|
844
934
|
members.map((member) => member.branchId).filter(
|
|
845
935
|
(branchId) => branchId !== BASE_PROVENANCE_BRANCH && branchId !== preferredBranchId
|
|
846
936
|
)
|
|
847
937
|
)
|
|
848
|
-
].sort((left, right) => compareStrings(left, right));
|
|
938
|
+
].sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right));
|
|
849
939
|
const resolution = {
|
|
850
940
|
canonicalId,
|
|
851
941
|
memberIds,
|
|
@@ -860,6 +950,7 @@ var UnionFind = class {
|
|
|
860
950
|
constructor(compare) {
|
|
861
951
|
this.compare = compare;
|
|
862
952
|
}
|
|
953
|
+
compare;
|
|
863
954
|
parent = /* @__PURE__ */ new Map();
|
|
864
955
|
/** Adds `value` as its own singleton set if it is not already present. */
|
|
865
956
|
add(value) {
|
|
@@ -905,7 +996,7 @@ var UnionFind = class {
|
|
|
905
996
|
var SUB_CLASS_OF_META_EDGE = "subClassOf";
|
|
906
997
|
var EQUIVALENT_TO_META_EDGE = "equivalentTo";
|
|
907
998
|
function buildSubClassClosure(ontology) {
|
|
908
|
-
const unionFind = new UnionFind(compareStrings);
|
|
999
|
+
const unionFind = new UnionFind(chunkA42GCBGX_cjs.compareStrings);
|
|
909
1000
|
for (const relation of ontology) {
|
|
910
1001
|
unionFind.add(relation.from);
|
|
911
1002
|
unionFind.add(relation.to);
|
|
@@ -936,7 +1027,7 @@ function buildSubClassClosure(ontology) {
|
|
|
936
1027
|
relations.push([child, parent]);
|
|
937
1028
|
}
|
|
938
1029
|
return {
|
|
939
|
-
closure:
|
|
1030
|
+
closure: chunkFL472AMI_cjs.computeTransitiveClosure(relations),
|
|
940
1031
|
canonicalOf
|
|
941
1032
|
};
|
|
942
1033
|
}
|
|
@@ -949,7 +1040,7 @@ function isReachable2(closure, from, to) {
|
|
|
949
1040
|
if (fromRep === toRep) {
|
|
950
1041
|
return from !== to;
|
|
951
1042
|
}
|
|
952
|
-
return
|
|
1043
|
+
return chunkFL472AMI_cjs.isReachable(closure.closure, fromRep, toRep);
|
|
953
1044
|
}
|
|
954
1045
|
|
|
955
1046
|
// src/graph-merge/similarity.ts
|
|
@@ -1132,37 +1223,37 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
1132
1223
|
switch (strategy.kind) {
|
|
1133
1224
|
case "custom": {
|
|
1134
1225
|
const raw = strategy.score(left.node, right.node);
|
|
1135
|
-
return
|
|
1226
|
+
return chunkFL472AMI_cjs.ok(clampScore(raw));
|
|
1136
1227
|
}
|
|
1137
1228
|
case "fulltext": {
|
|
1138
1229
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
1139
|
-
return
|
|
1230
|
+
return chunkFL472AMI_cjs.ok(NO_EVIDENCE_SCORE);
|
|
1140
1231
|
}
|
|
1141
|
-
return
|
|
1232
|
+
return chunkFL472AMI_cjs.ok(clampScore(diceFromMultisets(left.grams, right.grams)));
|
|
1142
1233
|
}
|
|
1143
1234
|
case "vector": {
|
|
1144
1235
|
if (ctx.embeddings === void 0) {
|
|
1145
|
-
return
|
|
1236
|
+
return chunkFL472AMI_cjs.err(embedderUnavailable("vector", ctx));
|
|
1146
1237
|
}
|
|
1147
1238
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
1148
|
-
return
|
|
1239
|
+
return chunkFL472AMI_cjs.ok(NO_EVIDENCE_SCORE);
|
|
1149
1240
|
}
|
|
1150
1241
|
const cosine = cosineFromLookup(ctx.embeddings, left.text, right.text);
|
|
1151
|
-
return
|
|
1242
|
+
return chunkFL472AMI_cjs.ok(clampScore(cosine));
|
|
1152
1243
|
}
|
|
1153
1244
|
case "hybrid": {
|
|
1154
1245
|
if (ctx.embeddings === void 0) {
|
|
1155
|
-
return
|
|
1246
|
+
return chunkFL472AMI_cjs.err(embedderUnavailable("hybrid", ctx));
|
|
1156
1247
|
}
|
|
1157
1248
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
1158
|
-
return
|
|
1249
|
+
return chunkFL472AMI_cjs.ok(NO_EVIDENCE_SCORE);
|
|
1159
1250
|
}
|
|
1160
1251
|
const vectorScore = clampScore(
|
|
1161
1252
|
cosineFromLookup(ctx.embeddings, left.text, right.text)
|
|
1162
1253
|
);
|
|
1163
1254
|
const fulltextScore = diceFromMultisets(left.grams, right.grams);
|
|
1164
1255
|
const weights = normalizeHybridWeights(strategy.weights);
|
|
1165
|
-
return
|
|
1256
|
+
return chunkFL472AMI_cjs.ok(
|
|
1166
1257
|
clampScore(
|
|
1167
1258
|
weights.vector * vectorScore + weights.fulltext * fulltextScore
|
|
1168
1259
|
)
|
|
@@ -1220,7 +1311,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
1220
1311
|
}
|
|
1221
1312
|
if (maxComparisonsPerKind !== void 0 && fuzzy.length > maxComparisonsPerKind) {
|
|
1222
1313
|
if (ceilingPolicy === "error") {
|
|
1223
|
-
return
|
|
1314
|
+
return chunkFL472AMI_cjs.err(
|
|
1224
1315
|
new MergeError(
|
|
1225
1316
|
`Comparison ceiling exceeded: ${fuzzy.length} candidate pairs > maxComparisonsPerKind ${maxComparisonsPerKind}.`,
|
|
1226
1317
|
{
|
|
@@ -1233,7 +1324,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
1233
1324
|
)
|
|
1234
1325
|
);
|
|
1235
1326
|
}
|
|
1236
|
-
return
|
|
1327
|
+
return chunkFL472AMI_cjs.ok({
|
|
1237
1328
|
edges: [...forced].sort(
|
|
1238
1329
|
(left, right) => compareCandidateEdges(left, right)
|
|
1239
1330
|
),
|
|
@@ -1251,14 +1342,14 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
1251
1342
|
const edges = [...forced];
|
|
1252
1343
|
for (const { left, right, a, b } of fuzzy) {
|
|
1253
1344
|
const scored = scorer(a, left, b, right);
|
|
1254
|
-
if (
|
|
1255
|
-
return
|
|
1345
|
+
if (chunkFL472AMI_cjs.isErr(scored)) {
|
|
1346
|
+
return chunkFL472AMI_cjs.err(scored.error);
|
|
1256
1347
|
}
|
|
1257
1348
|
if (scored.data >= threshold) {
|
|
1258
1349
|
edges.push({ a, b, score: scored.data });
|
|
1259
1350
|
}
|
|
1260
1351
|
}
|
|
1261
|
-
return
|
|
1352
|
+
return chunkFL472AMI_cjs.ok({
|
|
1262
1353
|
edges: edges.sort((left, right) => compareCandidateEdges(left, right)),
|
|
1263
1354
|
warnings: []
|
|
1264
1355
|
});
|
|
@@ -1468,7 +1559,7 @@ function pickHighestPriorityBranch(branchIds, branchRank) {
|
|
|
1468
1559
|
let chosenRank = branchRank.get(chosen) ?? Number.MAX_SAFE_INTEGER;
|
|
1469
1560
|
for (const candidate of branchIds.slice(1)) {
|
|
1470
1561
|
const candidateRank = branchRank.get(candidate) ?? Number.MAX_SAFE_INTEGER;
|
|
1471
|
-
if (candidateRank < chosenRank || candidateRank === chosenRank && compareStrings(candidate, chosen) < 0) {
|
|
1562
|
+
if (candidateRank < chosenRank || candidateRank === chosenRank && chunkA42GCBGX_cjs.compareStrings(candidate, chosen) < 0) {
|
|
1472
1563
|
chosen = candidate;
|
|
1473
1564
|
chosenRank = candidateRank;
|
|
1474
1565
|
}
|
|
@@ -1561,20 +1652,20 @@ function resolveDeleteModifyOver(modified, deleted, modifiedEntity, deletedEntit
|
|
|
1561
1652
|
}
|
|
1562
1653
|
return {
|
|
1563
1654
|
survivingModifications: [...survivingModifications].sort((left, right) => {
|
|
1564
|
-
const byId2 = compareStrings(
|
|
1655
|
+
const byId2 = chunkA42GCBGX_cjs.compareStrings(
|
|
1565
1656
|
modifiedEntity(left).id,
|
|
1566
1657
|
modifiedEntity(right).id
|
|
1567
1658
|
);
|
|
1568
|
-
return byId2 === 0 ? compareStrings(left.branchId, right.branchId) : byId2;
|
|
1659
|
+
return byId2 === 0 ? chunkA42GCBGX_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
1569
1660
|
}),
|
|
1570
1661
|
deletions: [...deletions].sort(
|
|
1571
|
-
(left, right) => compareStrings(left.id, right.id)
|
|
1662
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id)
|
|
1572
1663
|
),
|
|
1573
1664
|
conflicts: [...conflicts].sort(
|
|
1574
|
-
(left, right) => compareStrings(left.entityId, right.entityId)
|
|
1665
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left.entityId, right.entityId)
|
|
1575
1666
|
),
|
|
1576
1667
|
dropped: [...dropped].sort(
|
|
1577
|
-
(left, right) => compareStrings(left.id, right.id)
|
|
1668
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id)
|
|
1578
1669
|
)
|
|
1579
1670
|
};
|
|
1580
1671
|
}
|
|
@@ -1618,11 +1709,11 @@ function reconcileOver(survivingModifications, entityOf, rebuild, policy, branch
|
|
|
1618
1709
|
}
|
|
1619
1710
|
return {
|
|
1620
1711
|
survivingModifications: [...out].sort((left, right) => {
|
|
1621
|
-
const byId2 = compareStrings(entityOf(left).id, entityOf(right).id);
|
|
1622
|
-
return byId2 === 0 ? compareStrings(left.branchId, right.branchId) : byId2;
|
|
1712
|
+
const byId2 = chunkA42GCBGX_cjs.compareStrings(entityOf(left).id, entityOf(right).id);
|
|
1713
|
+
return byId2 === 0 ? chunkA42GCBGX_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
1623
1714
|
}),
|
|
1624
1715
|
conflicts: conflicts.sort(
|
|
1625
|
-
(left, right) => compareStrings(
|
|
1716
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(
|
|
1626
1717
|
`${left.entityId}|${left.property}`,
|
|
1627
1718
|
`${right.entityId}|${right.property}`
|
|
1628
1719
|
)
|
|
@@ -1656,7 +1747,7 @@ function threeWayMergeProps(entityId, kind, baseProps, contributions, context, b
|
|
|
1656
1747
|
propertyNames.add(name);
|
|
1657
1748
|
}
|
|
1658
1749
|
}
|
|
1659
|
-
for (const property of [...propertyNames].sort(compareStrings)) {
|
|
1750
|
+
for (const property of [...propertyNames].sort(chunkA42GCBGX_cjs.compareStrings)) {
|
|
1660
1751
|
const baseHas = property in baseProps;
|
|
1661
1752
|
const baseKey = baseHas ? canonicalValueKey(baseProps[property]) : void 0;
|
|
1662
1753
|
const changed = contributions.filter((contribution) => {
|
|
@@ -1793,7 +1884,7 @@ function unionEdgeProps(survivorId, kind, survivor, edges, context, branchRank,
|
|
|
1793
1884
|
const conflicts = [];
|
|
1794
1885
|
const contributions = edges.map((edge) => edge.staged);
|
|
1795
1886
|
for (const property of [...propertyNames].sort(
|
|
1796
|
-
(left, right) => compareStrings(left, right)
|
|
1887
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)
|
|
1797
1888
|
)) {
|
|
1798
1889
|
const values = collectConflictingValues(property, contributions);
|
|
1799
1890
|
if (values.length === 0) {
|
|
@@ -1862,7 +1953,7 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
1862
1953
|
const merged = [];
|
|
1863
1954
|
const conflicts = [];
|
|
1864
1955
|
const sortedGroups = [...dedupeKeyByGroup.keys()].sort(
|
|
1865
|
-
(left, right) => compareStrings(left, right)
|
|
1956
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)
|
|
1866
1957
|
);
|
|
1867
1958
|
for (const group of sortedGroups) {
|
|
1868
1959
|
const dedupeKeys = [...dedupeKeyByGroup.get(group)];
|
|
@@ -1874,7 +1965,7 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
1874
1965
|
}
|
|
1875
1966
|
const survivor = pickSurvivor(groupEdges, preferredBranchId);
|
|
1876
1967
|
const survivorId = survivor.staged.id;
|
|
1877
|
-
const mergedIds = [...groupEdges].map((edge) => edge.staged.id).sort((left, right) => compareStrings(left, right));
|
|
1968
|
+
const mergedIds = [...groupEdges].map((edge) => edge.staged.id).sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right));
|
|
1878
1969
|
const fromId = idOf(survivor.fromKey);
|
|
1879
1970
|
const fromKind = kindOf(survivor.fromKey);
|
|
1880
1971
|
const toId = idOf(survivor.toKey);
|
|
@@ -1923,12 +2014,12 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
1923
2014
|
mergeKey(edge.toKind, edge.toId),
|
|
1924
2015
|
edge.props
|
|
1925
2016
|
)
|
|
1926
|
-
})).sort((left, right) => compareStrings(left.sortKey, right.sortKey)).map(({ edge }) => edge);
|
|
2017
|
+
})).sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left.sortKey, right.sortKey)).map(({ edge }) => edge);
|
|
1927
2018
|
return {
|
|
1928
2019
|
edges: sortedEdges,
|
|
1929
|
-
dropped: dropped.sort((left, right) => compareStrings(left.id, right.id)),
|
|
2020
|
+
dropped: dropped.sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id)),
|
|
1930
2021
|
conflicts: conflicts.sort(
|
|
1931
|
-
(left, right) => compareStrings(
|
|
2022
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(
|
|
1932
2023
|
`${left.entityId}|${left.property}`,
|
|
1933
2024
|
`${right.entityId}|${right.property}`
|
|
1934
2025
|
)
|
|
@@ -2057,7 +2148,7 @@ function normalizeMergeOptions(options = {}) {
|
|
|
2057
2148
|
...provenanceWeights === void 0 ? {} : { provenanceWeights }
|
|
2058
2149
|
};
|
|
2059
2150
|
}
|
|
2060
|
-
var Provenance =
|
|
2151
|
+
var Provenance = chunkCK5BVQOW_cjs.defineNode("Provenance", {
|
|
2061
2152
|
schema: zod.z.object({
|
|
2062
2153
|
targetGraphId: zod.z.string(),
|
|
2063
2154
|
role: zod.z.enum(["node", "edge"]),
|
|
@@ -2071,14 +2162,14 @@ function provenanceGraphId(targetGraphId) {
|
|
|
2071
2162
|
return `${targetGraphId}::merge-provenance`;
|
|
2072
2163
|
}
|
|
2073
2164
|
function buildProvenanceGraph(targetGraphId) {
|
|
2074
|
-
return
|
|
2165
|
+
return chunkVPYHY3LJ_cjs.defineGraph({
|
|
2075
2166
|
id: provenanceGraphId(targetGraphId),
|
|
2076
2167
|
nodes: { Provenance: { type: Provenance } },
|
|
2077
2168
|
edges: {}
|
|
2078
2169
|
});
|
|
2079
2170
|
}
|
|
2080
2171
|
async function openProvenanceStore(backend, targetGraphId) {
|
|
2081
|
-
const [store] = await
|
|
2172
|
+
const [store] = await chunkJ7WFGBJR_cjs.createStoreWithSchema(
|
|
2082
2173
|
buildProvenanceGraph(targetGraphId),
|
|
2083
2174
|
backend
|
|
2084
2175
|
);
|
|
@@ -2098,7 +2189,7 @@ async function provenanceNodeId(targetGraphId, record) {
|
|
|
2098
2189
|
record.branchId,
|
|
2099
2190
|
record.sourceId
|
|
2100
2191
|
].join(ID_SEPARATOR);
|
|
2101
|
-
const digest = await
|
|
2192
|
+
const digest = await chunkTEDRJXOG_cjs.sha256Hex(tuple, ID_DIGEST_BYTES);
|
|
2102
2193
|
return `prov_${digest}`;
|
|
2103
2194
|
}
|
|
2104
2195
|
async function persistProvenanceRecords(store, targetGraphId, records) {
|
|
@@ -2125,7 +2216,7 @@ async function readProvenance(store, query = {}) {
|
|
|
2125
2216
|
const all = await store.nodes.Provenance.find();
|
|
2126
2217
|
return all.filter(
|
|
2127
2218
|
(node) => (query.branchId === void 0 || node.branchId === query.branchId) && (query.canonicalId === void 0 || node.canonicalId === query.canonicalId) && (query.role === void 0 || node.role === query.role)
|
|
2128
|
-
).sort((left, right) => compareStrings(left.id, right.id));
|
|
2219
|
+
).sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id));
|
|
2129
2220
|
}
|
|
2130
2221
|
|
|
2131
2222
|
// src/graph-merge/sources.ts
|
|
@@ -2135,10 +2226,10 @@ function orderEndpoints(left, right) {
|
|
|
2135
2226
|
return compareMergeKeys(leftKey, rightKey) <= 0 ? { a: leftKey, b: rightKey, left, right } : { a: rightKey, b: leftKey, left: right, right: left };
|
|
2136
2227
|
}
|
|
2137
2228
|
function sortMembersById(members) {
|
|
2138
|
-
return [...members].sort((left, right) => compareStrings(left.id, right.id));
|
|
2229
|
+
return [...members].sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id));
|
|
2139
2230
|
}
|
|
2140
2231
|
function sortedBucketKeys(blocks) {
|
|
2141
|
-
return [...blocks.keys()].sort((left, right) => compareStrings(left, right));
|
|
2232
|
+
return [...blocks.keys()].sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right));
|
|
2142
2233
|
}
|
|
2143
2234
|
var NODE_SYSTEM_FIELDS = /* @__PURE__ */ new Set(["id", "kind", "meta"]);
|
|
2144
2235
|
function nodeProps(node) {
|
|
@@ -2166,7 +2257,7 @@ function windowedPairs(members, config) {
|
|
|
2166
2257
|
key: fieldText(node, config.sortFields)
|
|
2167
2258
|
}));
|
|
2168
2259
|
keyed.sort(
|
|
2169
|
-
(left, right) => left.key === right.key ? compareStrings(left.node.id, right.node.id) : compareStrings(left.key, right.key)
|
|
2260
|
+
(left, right) => left.key === right.key ? chunkA42GCBGX_cjs.compareStrings(left.node.id, right.node.id) : chunkA42GCBGX_cjs.compareStrings(left.key, right.key)
|
|
2170
2261
|
);
|
|
2171
2262
|
const pairs = [];
|
|
2172
2263
|
for (let index = 0; index < keyed.length; index += 1) {
|
|
@@ -2224,7 +2315,7 @@ function ontologyRetypeEdges(stagedIdentities, isRetypeCompatible) {
|
|
|
2224
2315
|
}
|
|
2225
2316
|
}
|
|
2226
2317
|
const edges = [];
|
|
2227
|
-
for (const id of [...identitiesById.keys()].sort(compareStrings)) {
|
|
2318
|
+
for (const id of [...identitiesById.keys()].sort(chunkA42GCBGX_cjs.compareStrings)) {
|
|
2228
2319
|
const identities = [...new Set(identitiesById.get(id))].sort(
|
|
2229
2320
|
compareMergeKeys
|
|
2230
2321
|
);
|
|
@@ -2316,7 +2407,7 @@ var baseUniqueSource = {
|
|
|
2316
2407
|
const forcedEdges = [];
|
|
2317
2408
|
const baseMembers = /* @__PURE__ */ new Map();
|
|
2318
2409
|
const constraints = [...uniqueConstraints].sort(
|
|
2319
|
-
(left, right) => compareStrings(left.name, right.name)
|
|
2410
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left.name, right.name)
|
|
2320
2411
|
);
|
|
2321
2412
|
const items = nodes.map((node) => ({ props: nodeProps(node) }));
|
|
2322
2413
|
const matchesByConstraint = await Promise.all(
|
|
@@ -2359,7 +2450,7 @@ var baseUniqueSource = {
|
|
|
2359
2450
|
pairs: [],
|
|
2360
2451
|
forcedEdges,
|
|
2361
2452
|
baseMembers: [...baseMembers.values()].sort(
|
|
2362
|
-
(left, right) => compareStrings(left.id, right.id)
|
|
2453
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id)
|
|
2363
2454
|
)
|
|
2364
2455
|
};
|
|
2365
2456
|
}
|
|
@@ -2416,7 +2507,7 @@ var baseKeySource = {
|
|
|
2416
2507
|
pairs,
|
|
2417
2508
|
forcedEdges: [],
|
|
2418
2509
|
baseMembers: [...baseMembers.values()].sort(
|
|
2419
|
-
(left, right) => compareStrings(left.id, right.id)
|
|
2510
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id)
|
|
2420
2511
|
)
|
|
2421
2512
|
};
|
|
2422
2513
|
}
|
|
@@ -2428,16 +2519,16 @@ var CANDIDATE_SOURCES = [
|
|
|
2428
2519
|
|
|
2429
2520
|
// src/graph-merge/staging.ts
|
|
2430
2521
|
function compareByIdThenBranch(left, right) {
|
|
2431
|
-
const byId2 = compareStrings(left.id, right.id);
|
|
2432
|
-
return byId2 === 0 ? compareStrings(left.branchId, right.branchId) : byId2;
|
|
2522
|
+
const byId2 = chunkA42GCBGX_cjs.compareStrings(left.id, right.id);
|
|
2523
|
+
return byId2 === 0 ? chunkA42GCBGX_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
2433
2524
|
}
|
|
2434
2525
|
function compareByKindIdBranch(left, right) {
|
|
2435
|
-
const byKind = compareStrings(left.kind, right.kind);
|
|
2526
|
+
const byKind = chunkA42GCBGX_cjs.compareStrings(left.kind, right.kind);
|
|
2436
2527
|
if (byKind !== 0) {
|
|
2437
2528
|
return byKind;
|
|
2438
2529
|
}
|
|
2439
|
-
const byId2 = compareStrings(left.id, right.id);
|
|
2440
|
-
return byId2 === 0 ? compareStrings(left.branchId, right.branchId) : byId2;
|
|
2530
|
+
const byId2 = chunkA42GCBGX_cjs.compareStrings(left.id, right.id);
|
|
2531
|
+
return byId2 === 0 ? chunkA42GCBGX_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
2441
2532
|
}
|
|
2442
2533
|
function groupByKind(items) {
|
|
2443
2534
|
const buckets = /* @__PURE__ */ new Map();
|
|
@@ -2451,7 +2542,7 @@ function groupByKind(items) {
|
|
|
2451
2542
|
}
|
|
2452
2543
|
const ordered = /* @__PURE__ */ new Map();
|
|
2453
2544
|
for (const kind of [...buckets.keys()].sort(
|
|
2454
|
-
(left, right) => compareStrings(left, right)
|
|
2545
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)
|
|
2455
2546
|
)) {
|
|
2456
2547
|
ordered.set(
|
|
2457
2548
|
kind,
|
|
@@ -2462,16 +2553,26 @@ function groupByKind(items) {
|
|
|
2462
2553
|
}
|
|
2463
2554
|
return ordered;
|
|
2464
2555
|
}
|
|
2465
|
-
async function stageBranches(baseStore, branches) {
|
|
2556
|
+
async function stageBranches(baseStore, branches, captureTargetStateFor) {
|
|
2466
2557
|
const newNodes = [];
|
|
2467
2558
|
const modifiedNodes = [];
|
|
2468
2559
|
const deletedNodes = [];
|
|
2469
2560
|
const newEdges = [];
|
|
2470
2561
|
const modifiedEdges = [];
|
|
2471
2562
|
const deletedEdges = [];
|
|
2563
|
+
let targetNodeVersions = /* @__PURE__ */ new Map();
|
|
2564
|
+
let targetEdgeSignatures = /* @__PURE__ */ new Map();
|
|
2472
2565
|
for (const branch2 of branches) {
|
|
2473
|
-
const diff = await diffAgainstBase(baseStore, branch2.store);
|
|
2474
2566
|
const branchId = branch2.id;
|
|
2567
|
+
const diff = await diffAgainstBase(
|
|
2568
|
+
baseStore,
|
|
2569
|
+
branch2.store,
|
|
2570
|
+
branchId === captureTargetStateFor
|
|
2571
|
+
);
|
|
2572
|
+
if (branchId === captureTargetStateFor) {
|
|
2573
|
+
targetNodeVersions = diff.forkNodeVersions;
|
|
2574
|
+
targetEdgeSignatures = diff.forkEdgeSignatures;
|
|
2575
|
+
}
|
|
2475
2576
|
for (const node of diff.nodes.new) {
|
|
2476
2577
|
newNodes.push({ branchId, node, kind: node.kind, id: node.id });
|
|
2477
2578
|
}
|
|
@@ -2505,7 +2606,9 @@ async function stageBranches(baseStore, branches) {
|
|
|
2505
2606
|
),
|
|
2506
2607
|
deletedEdges: [...deletedEdges].sort(
|
|
2507
2608
|
(left, right) => compareByKindIdBranch(left, right)
|
|
2508
|
-
)
|
|
2609
|
+
),
|
|
2610
|
+
targetNodeVersions,
|
|
2611
|
+
targetEdgeSignatures
|
|
2509
2612
|
};
|
|
2510
2613
|
}
|
|
2511
2614
|
|
|
@@ -2554,7 +2657,7 @@ async function withTxConflictRetry(commit) {
|
|
|
2554
2657
|
// src/graph-merge/type-reconcile.ts
|
|
2555
2658
|
var INCOMPATIBLE_TYPES_FLAG_REASON = "type-reconcile:incompatible-kinds";
|
|
2556
2659
|
function distinctKinds(kinds) {
|
|
2557
|
-
return [...new Set(kinds)].sort((left, right) => compareStrings(left, right));
|
|
2660
|
+
return [...new Set(kinds)].sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right));
|
|
2558
2661
|
}
|
|
2559
2662
|
function areEquivalent(closure, left, right) {
|
|
2560
2663
|
return left !== right && isReachable2(closure, left, right) && isReachable2(closure, right, left);
|
|
@@ -2572,7 +2675,7 @@ function mostSpecificCommonKind(closure, kinds) {
|
|
|
2572
2675
|
if (qualifiers.length === 0) {
|
|
2573
2676
|
return void 0;
|
|
2574
2677
|
}
|
|
2575
|
-
return [...qualifiers].sort((left, right) => compareStrings(left, right))[0];
|
|
2678
|
+
return [...qualifiers].sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right))[0];
|
|
2576
2679
|
}
|
|
2577
2680
|
function reconcileTypes(clusters, closure, mode) {
|
|
2578
2681
|
if (mode === "off") {
|
|
@@ -2609,10 +2712,10 @@ function reconcileTypes(clusters, closure, mode) {
|
|
|
2609
2712
|
}
|
|
2610
2713
|
return {
|
|
2611
2714
|
reconciliations: reconciliations.sort(
|
|
2612
|
-
(left, right) => compareStrings(left.entityId, right.entityId)
|
|
2715
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left.entityId, right.entityId)
|
|
2613
2716
|
),
|
|
2614
2717
|
retypeMap,
|
|
2615
|
-
dropped: dropped.sort((left, right) => compareStrings(left.id, right.id))
|
|
2718
|
+
dropped: dropped.sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left.id, right.id))
|
|
2616
2719
|
};
|
|
2617
2720
|
}
|
|
2618
2721
|
|
|
@@ -2631,8 +2734,8 @@ function newNodesByKind(staging) {
|
|
|
2631
2734
|
ordered.set(
|
|
2632
2735
|
kind,
|
|
2633
2736
|
[...items].sort((left, right) => {
|
|
2634
|
-
const byId2 = compareStrings(left.node.id, right.node.id);
|
|
2635
|
-
return byId2 === 0 ? compareStrings(left.branchId, right.branchId) : byId2;
|
|
2737
|
+
const byId2 = chunkA42GCBGX_cjs.compareStrings(left.node.id, right.node.id);
|
|
2738
|
+
return byId2 === 0 ? chunkA42GCBGX_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
2636
2739
|
})
|
|
2637
2740
|
);
|
|
2638
2741
|
}
|
|
@@ -2664,7 +2767,7 @@ async function precomputeEmbeddings(byKind, resolve, embedder) {
|
|
|
2664
2767
|
return lookup;
|
|
2665
2768
|
}
|
|
2666
2769
|
const orderedTexts = [...texts].sort(
|
|
2667
|
-
(left, right) => compareStrings(left, right)
|
|
2770
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)
|
|
2668
2771
|
);
|
|
2669
2772
|
const vectors = await embedder(orderedTexts);
|
|
2670
2773
|
if (vectors.length !== orderedTexts.length) {
|
|
@@ -2700,7 +2803,7 @@ async function embedMissingPairTexts(base, pairs, strategy, embedder) {
|
|
|
2700
2803
|
return existing;
|
|
2701
2804
|
}
|
|
2702
2805
|
const orderedTexts = [...missing].sort(
|
|
2703
|
-
(left, right) => compareStrings(left, right)
|
|
2806
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)
|
|
2704
2807
|
);
|
|
2705
2808
|
const vectors = await embedder(orderedTexts);
|
|
2706
2809
|
if (vectors.length !== orderedTexts.length) {
|
|
@@ -2730,7 +2833,7 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
2730
2833
|
async ([kind, items]) => {
|
|
2731
2834
|
const resolveConfig = options.resolve[kind];
|
|
2732
2835
|
if (resolveConfig === void 0) {
|
|
2733
|
-
return
|
|
2836
|
+
return chunkFL472AMI_cjs.ok({ edges: [], warnings: [], baseMembers: [] });
|
|
2734
2837
|
}
|
|
2735
2838
|
const nodes = items.map((staged) => asNode(staged));
|
|
2736
2839
|
const uniqueConstraints = uniqueConstraintsFor(
|
|
@@ -2773,10 +2876,10 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
2773
2876
|
options.onComparisonCeiling,
|
|
2774
2877
|
options.maxComparisonsPerKind
|
|
2775
2878
|
);
|
|
2776
|
-
if (
|
|
2777
|
-
return
|
|
2879
|
+
if (chunkFL472AMI_cjs.isErr(scored)) {
|
|
2880
|
+
return chunkFL472AMI_cjs.err(scored.error);
|
|
2778
2881
|
}
|
|
2779
|
-
return
|
|
2882
|
+
return chunkFL472AMI_cjs.ok({
|
|
2780
2883
|
edges: scored.data.edges,
|
|
2781
2884
|
warnings: scored.data.warnings.map(
|
|
2782
2885
|
(warning) => `[${kind}] ${warning.message}`
|
|
@@ -2787,14 +2890,14 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
2787
2890
|
)
|
|
2788
2891
|
);
|
|
2789
2892
|
for (const result of perKind) {
|
|
2790
|
-
if (
|
|
2791
|
-
return
|
|
2893
|
+
if (chunkFL472AMI_cjs.isErr(result)) {
|
|
2894
|
+
return chunkFL472AMI_cjs.err(result.error);
|
|
2792
2895
|
}
|
|
2793
2896
|
allEdges.push(...result.data.edges);
|
|
2794
2897
|
warnings.push(...result.data.warnings);
|
|
2795
2898
|
baseMembers.push(...result.data.baseMembers);
|
|
2796
2899
|
}
|
|
2797
|
-
return
|
|
2900
|
+
return chunkFL472AMI_cjs.ok({
|
|
2798
2901
|
// The ONE shared `(a, b)` edge comparator (id-first `(kind, id)` order), so this
|
|
2799
2902
|
// stage emits edges in exactly the order clustering consumes them.
|
|
2800
2903
|
edges: allEdges.sort((left, right) => compareCandidateEdges(left, right)),
|
|
@@ -2897,9 +3000,9 @@ function buildProvenanceIndex(records) {
|
|
|
2897
3000
|
for (const [branchId, sets] of byBranch) {
|
|
2898
3001
|
frozen.set(branchId, {
|
|
2899
3002
|
nodeIds: [...sets.nodeIds].sort(
|
|
2900
|
-
(left, right) => compareStrings(left, right)
|
|
3003
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)
|
|
2901
3004
|
),
|
|
2902
|
-
edgeIds: [...sets.edgeIds].sort((left, right) => compareStrings(left, right)).map((id) => id)
|
|
3005
|
+
edgeIds: [...sets.edgeIds].sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right)).map((id) => id)
|
|
2903
3006
|
});
|
|
2904
3007
|
}
|
|
2905
3008
|
return {
|
|
@@ -3114,7 +3217,7 @@ function planMerge(staging, candidateEdges, candidateWarnings, baseMembers, opti
|
|
|
3114
3217
|
...repoint2.dropped,
|
|
3115
3218
|
...reconciliation.dropped
|
|
3116
3219
|
].sort(
|
|
3117
|
-
(left, right) => compareStrings(`${left.kind}|${left.id}`, `${right.kind}|${right.id}`)
|
|
3220
|
+
(left, right) => chunkA42GCBGX_cjs.compareStrings(`${left.kind}|${left.id}`, `${right.kind}|${right.id}`)
|
|
3118
3221
|
);
|
|
3119
3222
|
return {
|
|
3120
3223
|
canonicalEntities,
|
|
@@ -3147,7 +3250,7 @@ function planMerge(staging, candidateEdges, candidateWarnings, baseMembers, opti
|
|
|
3147
3250
|
mergeKey(left.kind, left.entityId),
|
|
3148
3251
|
mergeKey(right.kind, right.entityId)
|
|
3149
3252
|
);
|
|
3150
|
-
return byEntity === 0 ? compareStrings(left.property, right.property) : byEntity;
|
|
3253
|
+
return byEntity === 0 ? chunkA42GCBGX_cjs.compareStrings(left.property, right.property) : byEntity;
|
|
3151
3254
|
}
|
|
3152
3255
|
),
|
|
3153
3256
|
deleteModifyConflicts: [
|
|
@@ -3287,13 +3390,50 @@ async function commitPlan(target, plan, expectedBaseVersion) {
|
|
|
3287
3390
|
tx.nodes,
|
|
3288
3391
|
tx.edges
|
|
3289
3392
|
);
|
|
3290
|
-
},
|
|
3393
|
+
}, mergeCommitTransactionOptions(target))
|
|
3291
3394
|
);
|
|
3292
3395
|
}
|
|
3293
3396
|
var MERGE_COMMIT_TX_OPTIONS = {
|
|
3294
3397
|
isolationLevel: "serializable"
|
|
3295
3398
|
};
|
|
3399
|
+
function mergeCommitTransactionOptions(target) {
|
|
3400
|
+
return target.historyEnabled ? void 0 : MERGE_COMMIT_TX_OPTIONS;
|
|
3401
|
+
}
|
|
3296
3402
|
async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
3403
|
+
if (hasRevisionAnchor(expectedBaseVersion)) {
|
|
3404
|
+
await chunkXOX22WHL_cjs.lockRecordedGraphWrite(txBackend, target.graphId);
|
|
3405
|
+
const expectedOrigin = revisionOriginOf(expectedBaseVersion);
|
|
3406
|
+
const liveOrigin = await chunkXOX22WHL_cjs.readRevisionOrigin(
|
|
3407
|
+
txBackend,
|
|
3408
|
+
target.revisionSchema,
|
|
3409
|
+
target.graphId
|
|
3410
|
+
);
|
|
3411
|
+
if (liveOrigin !== expectedOrigin) {
|
|
3412
|
+
throw new BaseVersionMismatchError(
|
|
3413
|
+
"The merge branch was forked from a different revision-tracked store; the resolved plan was not applied.",
|
|
3414
|
+
{
|
|
3415
|
+
details: { expectedOrigin, liveOrigin },
|
|
3416
|
+
suggestion: "Merge the branch back into its original base store, or fork a new branch from this target."
|
|
3417
|
+
}
|
|
3418
|
+
);
|
|
3419
|
+
}
|
|
3420
|
+
const liveRevision = await chunkXOX22WHL_cjs.readRecordedClock(
|
|
3421
|
+
txBackend,
|
|
3422
|
+
target.revisionSchema,
|
|
3423
|
+
target.graphId
|
|
3424
|
+
);
|
|
3425
|
+
const expectedRevision = revisionAnchorOf(expectedBaseVersion);
|
|
3426
|
+
if (liveRevision !== expectedRevision) {
|
|
3427
|
+
throw new BaseVersionMismatchError(
|
|
3428
|
+
"The merge target was modified between the revision-anchor check and the commit transaction; the resolved plan was not applied.",
|
|
3429
|
+
{
|
|
3430
|
+
details: { expectedRevision, liveRevision },
|
|
3431
|
+
suggestion: "Re-run the merge (and re-branch if the divergence is real), or route all graph writes through the revision-tracked Store."
|
|
3432
|
+
}
|
|
3433
|
+
);
|
|
3434
|
+
}
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3297
3437
|
const liveContent = await computeContentComponent(
|
|
3298
3438
|
txBackend,
|
|
3299
3439
|
target.graphId,
|
|
@@ -3335,7 +3475,7 @@ async function validateBaseVersions(target, branches) {
|
|
|
3335
3475
|
const targetVersion = await computeBaseVersion(target);
|
|
3336
3476
|
for (const branch2 of branches) {
|
|
3337
3477
|
if (branch2.base !== targetVersion) {
|
|
3338
|
-
return
|
|
3478
|
+
return chunkFL472AMI_cjs.err(
|
|
3339
3479
|
new BaseVersionMismatchError(
|
|
3340
3480
|
`Branch "${branch2.id}" forked from base@V "${branch2.base}", which does not match the merge target's current base@V "${targetVersion}".`,
|
|
3341
3481
|
{
|
|
@@ -3349,20 +3489,20 @@ async function validateBaseVersions(target, branches) {
|
|
|
3349
3489
|
);
|
|
3350
3490
|
}
|
|
3351
3491
|
}
|
|
3352
|
-
return
|
|
3492
|
+
return chunkFL472AMI_cjs.ok(targetVersion);
|
|
3353
3493
|
}
|
|
3354
3494
|
function tryNormalize(optionsInput) {
|
|
3355
3495
|
try {
|
|
3356
|
-
return
|
|
3496
|
+
return chunkFL472AMI_cjs.ok(normalizeMergeOptions(optionsInput));
|
|
3357
3497
|
} catch (error) {
|
|
3358
|
-
return
|
|
3498
|
+
return chunkFL472AMI_cjs.err(new MergeError("Invalid merge options.", { cause: error }));
|
|
3359
3499
|
}
|
|
3360
3500
|
}
|
|
3361
3501
|
async function resolveMerge(store, target, branches, options, useBaseSources, incremental, expectedBaseVersion) {
|
|
3362
3502
|
let targetBranchSeen = false;
|
|
3363
3503
|
for (const branch2 of branches) {
|
|
3364
3504
|
if (branch2.id === BASE_PROVENANCE_BRANCH) {
|
|
3365
|
-
return
|
|
3505
|
+
return chunkFL472AMI_cjs.err(
|
|
3366
3506
|
new MergeError(
|
|
3367
3507
|
`Branch id "${BASE_PROVENANCE_BRANCH}" is reserved for committed-base provenance and cannot be used as a branch id.`,
|
|
3368
3508
|
{ details: { branchId: branch2.id } }
|
|
@@ -3371,7 +3511,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
3371
3511
|
}
|
|
3372
3512
|
if (branch2.id === COMMITTED_TARGET_BRANCH) {
|
|
3373
3513
|
if (incremental?.targetBranchId !== COMMITTED_TARGET_BRANCH || targetBranchSeen) {
|
|
3374
|
-
return
|
|
3514
|
+
return chunkFL472AMI_cjs.err(
|
|
3375
3515
|
new MergeError(
|
|
3376
3516
|
`Branch id "${COMMITTED_TARGET_BRANCH}" is reserved for the committed incremental target and cannot be used as a branch id.`,
|
|
3377
3517
|
{ details: { branchId: branch2.id } }
|
|
@@ -3382,8 +3522,8 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
3382
3522
|
}
|
|
3383
3523
|
}
|
|
3384
3524
|
try {
|
|
3385
|
-
const staging = await stageBranches(store, branches);
|
|
3386
3525
|
const preferredBranchId = incremental?.targetBranchId;
|
|
3526
|
+
const staging = await stageBranches(store, branches, preferredBranchId);
|
|
3387
3527
|
const branchIds = branches.map((branch2) => branch2.id);
|
|
3388
3528
|
const branchOrder = preferredBranchId === void 0 ? options.branchOrder ?? [] : [
|
|
3389
3529
|
preferredBranchId,
|
|
@@ -3416,8 +3556,8 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
3416
3556
|
useBaseSources,
|
|
3417
3557
|
options.embedder
|
|
3418
3558
|
);
|
|
3419
|
-
if (
|
|
3420
|
-
return
|
|
3559
|
+
if (chunkFL472AMI_cjs.isErr(candidates)) {
|
|
3560
|
+
return chunkFL472AMI_cjs.err(candidates.error);
|
|
3421
3561
|
}
|
|
3422
3562
|
const plan = planMerge(
|
|
3423
3563
|
staging,
|
|
@@ -3437,7 +3577,9 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
3437
3577
|
// anything NEW the in-tx re-probe surfaces is a window write.
|
|
3438
3578
|
plannedBaseMatchKeys: new Set(
|
|
3439
3579
|
candidates.data.baseMembers.map((member) => mergeKeyOf(member))
|
|
3440
|
-
)
|
|
3580
|
+
),
|
|
3581
|
+
targetNodeVersions: staging.targetNodeVersions,
|
|
3582
|
+
targetEdgeSignatures: staging.targetEdgeSignatures
|
|
3441
3583
|
});
|
|
3442
3584
|
const provenance = options.provenance ? buildProvenanceIndex(plan.provenanceRecords) : { byBranch: () => ({ nodeIds: [], edgeIds: [] }) };
|
|
3443
3585
|
const warnings = [...plan.warnings];
|
|
@@ -3475,12 +3617,12 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
3475
3617
|
warnings,
|
|
3476
3618
|
...provenancePersisted === void 0 ? {} : { provenancePersisted }
|
|
3477
3619
|
};
|
|
3478
|
-
return
|
|
3620
|
+
return chunkFL472AMI_cjs.ok(report);
|
|
3479
3621
|
} catch (error) {
|
|
3480
3622
|
if (error instanceof MergeError) {
|
|
3481
|
-
return
|
|
3623
|
+
return chunkFL472AMI_cjs.err(error);
|
|
3482
3624
|
}
|
|
3483
|
-
return
|
|
3625
|
+
return chunkFL472AMI_cjs.err(
|
|
3484
3626
|
new MergeError(
|
|
3485
3627
|
`Merge failed while staging or committing: ${describeCause(error)}`,
|
|
3486
3628
|
{ cause: error }
|
|
@@ -3490,14 +3632,14 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
3490
3632
|
}
|
|
3491
3633
|
async function merge(store, branches, optionsInput = {}) {
|
|
3492
3634
|
const normalized = tryNormalize(optionsInput);
|
|
3493
|
-
if (
|
|
3494
|
-
return
|
|
3635
|
+
if (chunkFL472AMI_cjs.isErr(normalized)) {
|
|
3636
|
+
return chunkFL472AMI_cjs.err(normalized.error);
|
|
3495
3637
|
}
|
|
3496
3638
|
const options = normalized.data;
|
|
3497
3639
|
const target = options.target ?? store;
|
|
3498
3640
|
const precondition = await validateBaseVersions(target, branches);
|
|
3499
|
-
if (
|
|
3500
|
-
return
|
|
3641
|
+
if (chunkFL472AMI_cjs.isErr(precondition)) {
|
|
3642
|
+
return chunkFL472AMI_cjs.err(precondition.error);
|
|
3501
3643
|
}
|
|
3502
3644
|
return resolveMerge(
|
|
3503
3645
|
store,
|
|
@@ -3513,7 +3655,7 @@ async function validateForkPointVersions(forkPoint, branches) {
|
|
|
3513
3655
|
const forkVersion = await computeBaseVersion(forkPoint);
|
|
3514
3656
|
for (const branch2 of branches) {
|
|
3515
3657
|
if (branch2.base !== forkVersion) {
|
|
3516
|
-
return
|
|
3658
|
+
return chunkFL472AMI_cjs.err(
|
|
3517
3659
|
new BaseVersionMismatchError(
|
|
3518
3660
|
`Branch "${branch2.id}" forked from base@V "${branch2.base}", which does not match the fork-point's base@V "${forkVersion}". mergeIncremental() requires every branch to have forked from the supplied forkPoint.`,
|
|
3519
3661
|
{
|
|
@@ -3527,7 +3669,7 @@ async function validateForkPointVersions(forkPoint, branches) {
|
|
|
3527
3669
|
);
|
|
3528
3670
|
}
|
|
3529
3671
|
}
|
|
3530
|
-
return
|
|
3672
|
+
return chunkFL472AMI_cjs.ok(forkVersion);
|
|
3531
3673
|
}
|
|
3532
3674
|
function nodeSchemaFor(target, kind) {
|
|
3533
3675
|
const registry = target.graph.nodes;
|
|
@@ -3738,7 +3880,7 @@ async function validateIncrementalEdgeWrites(target, edgesApi, plan) {
|
|
|
3738
3880
|
}
|
|
3739
3881
|
}
|
|
3740
3882
|
}
|
|
3741
|
-
const notFound = [...plannedKindById.keys()].filter((id) => !existingById.has(id)).sort((left, right) => compareStrings(left, right));
|
|
3883
|
+
const notFound = [...plannedKindById.keys()].filter((id) => !existingById.has(id)).sort((left, right) => chunkA42GCBGX_cjs.compareStrings(left, right));
|
|
3742
3884
|
if (notFound.length > 0) {
|
|
3743
3885
|
const crossKindById = /* @__PURE__ */ new Map();
|
|
3744
3886
|
for (const kind of Object.keys(target.graph.edges)) {
|
|
@@ -3867,6 +4009,99 @@ async function assertBaseResolutionStable(lookupStore, guard) {
|
|
|
3867
4009
|
}
|
|
3868
4010
|
);
|
|
3869
4011
|
}
|
|
4012
|
+
function bucketInheritedRefsByKind(refs, identities) {
|
|
4013
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4014
|
+
const idsByKind = /* @__PURE__ */ new Map();
|
|
4015
|
+
for (const ref of refs) {
|
|
4016
|
+
const identity = mergeKey(ref.kind, ref.id);
|
|
4017
|
+
if (!identities.has(identity) || seen.has(identity)) {
|
|
4018
|
+
continue;
|
|
4019
|
+
}
|
|
4020
|
+
seen.add(identity);
|
|
4021
|
+
const bucket = idsByKind.get(ref.kind) ?? [];
|
|
4022
|
+
bucket.push(ref.id);
|
|
4023
|
+
idsByKind.set(ref.kind, bucket);
|
|
4024
|
+
}
|
|
4025
|
+
return idsByKind;
|
|
4026
|
+
}
|
|
4027
|
+
async function assertInheritedUnchanged(args) {
|
|
4028
|
+
if (args.expected.size === 0) {
|
|
4029
|
+
return;
|
|
4030
|
+
}
|
|
4031
|
+
const idsByKind = bucketInheritedRefsByKind(args.refs, args.expected);
|
|
4032
|
+
for (const [kind, ids] of idsByKind) {
|
|
4033
|
+
const rows = await args.fetchRows(kind, ids);
|
|
4034
|
+
for (const [index, id] of ids.entries()) {
|
|
4035
|
+
const expected = args.expected.get(mergeKey(kind, id));
|
|
4036
|
+
const current = args.deriveValue(rows[index]);
|
|
4037
|
+
if (current === expected) {
|
|
4038
|
+
continue;
|
|
4039
|
+
}
|
|
4040
|
+
throw args.buildError(id, kind, expected, current);
|
|
4041
|
+
}
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
async function assertInheritedTargetUnchanged(nodesApi, edgesApi, guard, plan) {
|
|
4045
|
+
await Promise.all([
|
|
4046
|
+
assertInheritedNodesUnchanged(nodesApi, guard, plan),
|
|
4047
|
+
assertInheritedEdgesUnchanged(edgesApi, guard, plan)
|
|
4048
|
+
]);
|
|
4049
|
+
}
|
|
4050
|
+
async function assertInheritedNodesUnchanged(nodesApi, guard, plan) {
|
|
4051
|
+
const nodeRefs = plannedNodeWrites(plan).map(
|
|
4052
|
+
(write) => ({ kind: write.kind, id: write.id })
|
|
4053
|
+
);
|
|
4054
|
+
for (const [identity, kind] of plan.nodeDeletions) {
|
|
4055
|
+
nodeRefs.push({ kind, id: idOf(identity) });
|
|
4056
|
+
}
|
|
4057
|
+
await assertInheritedUnchanged({
|
|
4058
|
+
refs: nodeRefs,
|
|
4059
|
+
expected: guard.targetNodeVersions,
|
|
4060
|
+
fetchRows: (kind, ids) => nodeCollection(nodesApi, kind).getByIds(ids, INCLUDE_TOMBSTONES),
|
|
4061
|
+
deriveValue: (row) => row?.meta.version,
|
|
4062
|
+
buildError: (id, kind, expected, current) => new BaseVersionMismatchError(
|
|
4063
|
+
`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.`,
|
|
4064
|
+
{
|
|
4065
|
+
details: {
|
|
4066
|
+
id,
|
|
4067
|
+
kind,
|
|
4068
|
+
expectedVersion: expected,
|
|
4069
|
+
currentVersion: current
|
|
4070
|
+
},
|
|
4071
|
+
suggestion: "Re-run mergeIncremental(); the re-planned merge resolves the inherited modifications against the now-committed rows."
|
|
4072
|
+
}
|
|
4073
|
+
)
|
|
4074
|
+
});
|
|
4075
|
+
}
|
|
4076
|
+
async function assertInheritedEdgesUnchanged(edgesApi, guard, plan) {
|
|
4077
|
+
const edgeRefs = plan.mergedEdges.map((edge) => ({
|
|
4078
|
+
kind: edge.kind,
|
|
4079
|
+
id: edge.id
|
|
4080
|
+
}));
|
|
4081
|
+
for (const [identity, kind] of plan.edgeDeletions) {
|
|
4082
|
+
edgeRefs.push({ kind, id: idOf(identity) });
|
|
4083
|
+
}
|
|
4084
|
+
await assertInheritedUnchanged({
|
|
4085
|
+
refs: edgeRefs,
|
|
4086
|
+
expected: guard.targetEdgeSignatures,
|
|
4087
|
+
fetchRows: (kind, ids) => edgeCollection(edgesApi, kind).getByIds(ids, INCLUDE_TOMBSTONES),
|
|
4088
|
+
deriveValue: (row) => row === void 0 ? void 0 : edgeStateSignature({
|
|
4089
|
+
fromKind: row.fromKind,
|
|
4090
|
+
fromId: row.fromId,
|
|
4091
|
+
toKind: row.toKind,
|
|
4092
|
+
toId: row.toId,
|
|
4093
|
+
live: row.meta.deletedAt === void 0,
|
|
4094
|
+
props: edgeProps(row)
|
|
4095
|
+
}),
|
|
4096
|
+
buildError: (id, kind) => new BaseVersionMismatchError(
|
|
4097
|
+
`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.`,
|
|
4098
|
+
{
|
|
4099
|
+
details: { id, kind },
|
|
4100
|
+
suggestion: "Re-run mergeIncremental(); the re-planned merge resolves the inherited modifications against the now-committed rows."
|
|
4101
|
+
}
|
|
4102
|
+
)
|
|
4103
|
+
});
|
|
4104
|
+
}
|
|
3870
4105
|
async function commitIncrementalPlan(target, plan, guard) {
|
|
3871
4106
|
if (!target.backend.capabilities.transactions) {
|
|
3872
4107
|
throw new MergeError(
|
|
@@ -3876,24 +4111,28 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
3876
4111
|
}
|
|
3877
4112
|
return withTxConflictRetry(
|
|
3878
4113
|
() => target.transaction(async (tx) => {
|
|
4114
|
+
if (target.revisionTrackingEnabled) {
|
|
4115
|
+
await chunkXOX22WHL_cjs.lockRecordedGraphWrite(tx.backend, target.graphId);
|
|
4116
|
+
}
|
|
3879
4117
|
const nodesApi = tx.nodes;
|
|
3880
4118
|
const edgesApi = tx.edges;
|
|
3881
4119
|
await assertBaseResolutionStable(tx, guard);
|
|
4120
|
+
await assertInheritedTargetUnchanged(nodesApi, edgesApi, guard, plan);
|
|
3882
4121
|
await validateIncrementalNodeWrites(target, nodesApi, plan);
|
|
3883
4122
|
await validateIncrementalEdgeWrites(target, edgesApi, plan);
|
|
3884
4123
|
return applyMergePlan(plan, nodesApi, edgesApi);
|
|
3885
|
-
},
|
|
4124
|
+
}, mergeCommitTransactionOptions(target))
|
|
3886
4125
|
);
|
|
3887
4126
|
}
|
|
3888
4127
|
async function mergeIncremental(args) {
|
|
3889
4128
|
const { forkPoint, target, branches } = args;
|
|
3890
4129
|
const normalized = tryNormalize(args.options ?? {});
|
|
3891
|
-
if (
|
|
3892
|
-
return
|
|
4130
|
+
if (chunkFL472AMI_cjs.isErr(normalized)) {
|
|
4131
|
+
return chunkFL472AMI_cjs.err(normalized.error);
|
|
3893
4132
|
}
|
|
3894
4133
|
const options = normalized.data;
|
|
3895
4134
|
if (options.onBasePropertyConflict !== "flag") {
|
|
3896
|
-
return
|
|
4135
|
+
return chunkFL472AMI_cjs.err(
|
|
3897
4136
|
new MergeError(
|
|
3898
4137
|
'mergeIncremental() requires onBasePropertyConflict: "flag" (keep-base); a non-keep-base policy could overwrite a newer committed base value with a stale branch value.',
|
|
3899
4138
|
{ details: {} }
|
|
@@ -3901,8 +4140,8 @@ async function mergeIncremental(args) {
|
|
|
3901
4140
|
);
|
|
3902
4141
|
}
|
|
3903
4142
|
const forkPrecondition = await validateForkPointVersions(forkPoint, branches);
|
|
3904
|
-
if (
|
|
3905
|
-
return
|
|
4143
|
+
if (chunkFL472AMI_cjs.isErr(forkPrecondition)) {
|
|
4144
|
+
return chunkFL472AMI_cjs.err(forkPrecondition.error);
|
|
3906
4145
|
}
|
|
3907
4146
|
const forkVersion = forkPrecondition.data;
|
|
3908
4147
|
const [forkSchema, targetSchema] = await Promise.all([
|
|
@@ -3910,7 +4149,7 @@ async function mergeIncremental(args) {
|
|
|
3910
4149
|
computeSchemaComponent(target)
|
|
3911
4150
|
]);
|
|
3912
4151
|
if (forkSchema !== targetSchema) {
|
|
3913
|
-
return
|
|
4152
|
+
return chunkFL472AMI_cjs.err(
|
|
3914
4153
|
new MergeError(
|
|
3915
4154
|
"mergeIncremental() requires target and forkPoint to share a schema; schema drift is not supported (the target content may differ \u2014 only the schema must match).",
|
|
3916
4155
|
{ details: {} }
|
|
@@ -3934,15 +4173,15 @@ async function mergeIncremental(args) {
|
|
|
3934
4173
|
|
|
3935
4174
|
Object.defineProperty(exports, "isErr", {
|
|
3936
4175
|
enumerable: true,
|
|
3937
|
-
get: function () { return
|
|
4176
|
+
get: function () { return chunkFL472AMI_cjs.isErr; }
|
|
3938
4177
|
});
|
|
3939
4178
|
Object.defineProperty(exports, "isOk", {
|
|
3940
4179
|
enumerable: true,
|
|
3941
|
-
get: function () { return
|
|
4180
|
+
get: function () { return chunkFL472AMI_cjs.isOk; }
|
|
3942
4181
|
});
|
|
3943
4182
|
Object.defineProperty(exports, "unwrap", {
|
|
3944
4183
|
enumerable: true,
|
|
3945
|
-
get: function () { return
|
|
4184
|
+
get: function () { return chunkFL472AMI_cjs.unwrap; }
|
|
3946
4185
|
});
|
|
3947
4186
|
exports.BaseVersionMismatchError = BaseVersionMismatchError;
|
|
3948
4187
|
exports.BranchError = BranchError;
|