@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,21 +1,29 @@
|
|
|
1
|
-
import { createStoreWithSchema
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import '../chunk-
|
|
9
|
-
import '../chunk-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import '../chunk-
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
import
|
|
16
|
-
import '../chunk-
|
|
17
|
-
import {
|
|
18
|
-
import '../chunk-
|
|
1
|
+
import { createStoreWithSchema } from '../chunk-UES55P7G.js';
|
|
2
|
+
import '../chunk-55MZDDZV.js';
|
|
3
|
+
import { importGraphStream, exportGraphStream } from '../chunk-KMI7LYAF.js';
|
|
4
|
+
import '../chunk-QNKSQTKQ.js';
|
|
5
|
+
import { defineNode, computeSchemaHash, serializeSchema } from '../chunk-K3PPLHY7.js';
|
|
6
|
+
import { sortedReplacer } from '../chunk-UR7W5YQK.js';
|
|
7
|
+
import { getNodeKinds, getEdgeKinds, defineGraph } from '../chunk-QWEUYILR.js';
|
|
8
|
+
import '../chunk-UZV3AZKF.js';
|
|
9
|
+
import '../chunk-OR5ZA5WP.js';
|
|
10
|
+
import { sha256Hex } from '../chunk-W63OVYY4.js';
|
|
11
|
+
import '../chunk-FPIZFYHE.js';
|
|
12
|
+
import '../chunk-5SEGFTZX.js';
|
|
13
|
+
import { ok, err, isErr, computeTransitiveClosure, isReachable } from '../chunk-QOTI55H7.js';
|
|
14
|
+
export { isErr, isOk, unwrap } from '../chunk-QOTI55H7.js';
|
|
15
|
+
import '../chunk-RGPG7EOJ.js';
|
|
16
|
+
import { compareStrings } from '../chunk-BYPOGQWK.js';
|
|
17
|
+
import { generateId, computeUniqueKey, lockRecordedGraphWrite, readRevisionOrigin, readRecordedClock } from '../chunk-CZQ3FO2Q.js';
|
|
18
|
+
import '../chunk-UT3S4SEN.js';
|
|
19
|
+
import '../chunk-JBTOYDMN.js';
|
|
20
|
+
import '../chunk-I7ZUZKFD.js';
|
|
21
|
+
import '../chunk-OHMP6N2J.js';
|
|
22
|
+
import '../chunk-KBGQIPRQ.js';
|
|
23
|
+
import '../chunk-SNXVDZAJ.js';
|
|
24
|
+
import '../chunk-ITE4IXAK.js';
|
|
25
|
+
import { TypeGraphError } from '../chunk-MP2JQKSG.js';
|
|
26
|
+
import '../chunk-G6Q5UM7U.js';
|
|
19
27
|
import { z } from 'zod';
|
|
20
28
|
|
|
21
29
|
// src/graph-merge/canonical-props.ts
|
|
@@ -25,12 +33,26 @@ function canonicalizeProps(props) {
|
|
|
25
33
|
function canonicalValueKey(value) {
|
|
26
34
|
return JSON.stringify(value, sortedReplacer);
|
|
27
35
|
}
|
|
36
|
+
function edgeStateSignature(edge) {
|
|
37
|
+
return JSON.stringify([
|
|
38
|
+
edge.fromKind,
|
|
39
|
+
edge.fromId,
|
|
40
|
+
edge.toKind,
|
|
41
|
+
edge.toId,
|
|
42
|
+
edge.live,
|
|
43
|
+
canonicalizeProps(edge.props)
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
28
46
|
function parseRowProps(props) {
|
|
29
47
|
let parsed;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
if (typeof props === "string") {
|
|
49
|
+
try {
|
|
50
|
+
parsed = JSON.parse(props);
|
|
51
|
+
} catch {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
parsed = props;
|
|
34
56
|
}
|
|
35
57
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
36
58
|
return {};
|
|
@@ -48,9 +70,6 @@ function mergeKey(kind, id) {
|
|
|
48
70
|
}
|
|
49
71
|
return `${kind}${SEPARATOR}${id}`;
|
|
50
72
|
}
|
|
51
|
-
function compareStrings(left, right) {
|
|
52
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
53
|
-
}
|
|
54
73
|
function mergeKeyOf(node) {
|
|
55
74
|
return mergeKey(node.kind, node.id);
|
|
56
75
|
}
|
|
@@ -77,7 +96,7 @@ function compareMergeKeys(left, right) {
|
|
|
77
96
|
var ENUMERATION_PAGE_SIZE = 1e3;
|
|
78
97
|
async function enumerateAllNodes(backend, graphId, kind) {
|
|
79
98
|
const collected = [];
|
|
80
|
-
let after
|
|
99
|
+
let after;
|
|
81
100
|
for (; ; ) {
|
|
82
101
|
const page = await backend.findNodesByKind({
|
|
83
102
|
graphId,
|
|
@@ -99,7 +118,7 @@ async function enumerateAllNodes(backend, graphId, kind) {
|
|
|
99
118
|
}
|
|
100
119
|
async function enumerateAllEdges(backend, graphId, kind) {
|
|
101
120
|
const collected = [];
|
|
102
|
-
let after
|
|
121
|
+
let after;
|
|
103
122
|
for (; ; ) {
|
|
104
123
|
const page = await backend.findEdgesByKind({
|
|
105
124
|
graphId,
|
|
@@ -226,13 +245,14 @@ function diffEdgeKind(kind, baseRows, forkRows) {
|
|
|
226
245
|
function byId(left, right) {
|
|
227
246
|
return compareStrings(left.id, right.id);
|
|
228
247
|
}
|
|
229
|
-
async function diffAgainstBase(baseStore, forkStore) {
|
|
248
|
+
async function diffAgainstBase(baseStore, forkStore, captureForkState = true) {
|
|
230
249
|
const graph = baseStore.graph;
|
|
231
250
|
const nodeKinds = getNodeKinds(graph);
|
|
232
251
|
const edgeKinds = getEdgeKinds(graph);
|
|
233
252
|
const newNodes = [];
|
|
234
253
|
const modifiedNodes = [];
|
|
235
254
|
const deletedNodes = [];
|
|
255
|
+
const forkNodeVersions = /* @__PURE__ */ new Map();
|
|
236
256
|
for (const kind of nodeKinds) {
|
|
237
257
|
const baseRows = await enumerateAllNodes(
|
|
238
258
|
baseStore.backend,
|
|
@@ -244,6 +264,11 @@ async function diffAgainstBase(baseStore, forkStore) {
|
|
|
244
264
|
forkStore.graphId,
|
|
245
265
|
kind
|
|
246
266
|
);
|
|
267
|
+
if (captureForkState) {
|
|
268
|
+
for (const row of forkRows) {
|
|
269
|
+
forkNodeVersions.set(mergeKey(kind, row.id), row.version);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
247
272
|
const delta = diffNodeKind(kind, baseRows, forkRows);
|
|
248
273
|
for (const entry of delta.new) {
|
|
249
274
|
newNodes.push(entry);
|
|
@@ -258,6 +283,7 @@ async function diffAgainstBase(baseStore, forkStore) {
|
|
|
258
283
|
const newEdges = [];
|
|
259
284
|
const modifiedEdges = [];
|
|
260
285
|
const deletedEdges = [];
|
|
286
|
+
const forkEdgeSignatures = /* @__PURE__ */ new Map();
|
|
261
287
|
for (const kind of edgeKinds) {
|
|
262
288
|
const baseRows = await enumerateAllEdges(
|
|
263
289
|
baseStore.backend,
|
|
@@ -269,6 +295,21 @@ async function diffAgainstBase(baseStore, forkStore) {
|
|
|
269
295
|
forkStore.graphId,
|
|
270
296
|
kind
|
|
271
297
|
);
|
|
298
|
+
if (captureForkState) {
|
|
299
|
+
for (const row of forkRows) {
|
|
300
|
+
forkEdgeSignatures.set(
|
|
301
|
+
mergeKey(kind, row.id),
|
|
302
|
+
edgeStateSignature({
|
|
303
|
+
fromKind: row.from_kind,
|
|
304
|
+
fromId: row.from_id,
|
|
305
|
+
toKind: row.to_kind,
|
|
306
|
+
toId: row.to_id,
|
|
307
|
+
live: isLive(row),
|
|
308
|
+
props: parseRowProps(row.props)
|
|
309
|
+
})
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
272
313
|
const delta = diffEdgeKind(kind, baseRows, forkRows);
|
|
273
314
|
for (const entry of delta.new) {
|
|
274
315
|
newEdges.push(entry);
|
|
@@ -290,7 +331,9 @@ async function diffAgainstBase(baseStore, forkStore) {
|
|
|
290
331
|
new: newEdges.sort((left, right) => byId(left, right)),
|
|
291
332
|
modified: modifiedEdges.sort((left, right) => byId(left, right)),
|
|
292
333
|
deleted: deletedEdges.sort((left, right) => byId(left, right))
|
|
293
|
-
}
|
|
334
|
+
},
|
|
335
|
+
forkNodeVersions,
|
|
336
|
+
forkEdgeSignatures
|
|
294
337
|
};
|
|
295
338
|
}
|
|
296
339
|
|
|
@@ -304,6 +347,9 @@ function asBaseVersion(value) {
|
|
|
304
347
|
|
|
305
348
|
// src/graph-merge/base-version.ts
|
|
306
349
|
var TOKEN_SEPARATOR = "\0";
|
|
350
|
+
var REVISION_COMPONENT_PREFIX = "revision:";
|
|
351
|
+
var REVISION_COMPONENT_SEPARATOR = ":";
|
|
352
|
+
var INITIAL_REVISION = "initial";
|
|
307
353
|
var FALLBACK_SCHEMA_VERSION = 1;
|
|
308
354
|
async function readActiveSchemaVersion(backend, graphId) {
|
|
309
355
|
const active = await backend.getActiveSchema(graphId);
|
|
@@ -364,6 +410,16 @@ async function computeContentComponent(backend, graphId, graph) {
|
|
|
364
410
|
);
|
|
365
411
|
}
|
|
366
412
|
async function computeBaseVersion(store) {
|
|
413
|
+
if (store.revisionTrackingEnabled) {
|
|
414
|
+
const [schemaComponent2, origin, revision] = await Promise.all([
|
|
415
|
+
computeSchemaComponent(store),
|
|
416
|
+
store.revisionOriginNow(),
|
|
417
|
+
store.revisionNow()
|
|
418
|
+
]);
|
|
419
|
+
return asBaseVersion(
|
|
420
|
+
`${schemaComponent2}${TOKEN_SEPARATOR}${revisionComponent(origin, revision)}`
|
|
421
|
+
);
|
|
422
|
+
}
|
|
367
423
|
const [schemaComponent, contentComponent] = await Promise.all([
|
|
368
424
|
computeSchemaComponent(store),
|
|
369
425
|
computeContentComponent(store.backend, store.graphId, store.graph)
|
|
@@ -372,6 +428,30 @@ async function computeBaseVersion(store) {
|
|
|
372
428
|
`${schemaComponent}${TOKEN_SEPARATOR}${contentComponent}`
|
|
373
429
|
);
|
|
374
430
|
}
|
|
431
|
+
function revisionComponent(origin, revision) {
|
|
432
|
+
return `${REVISION_COMPONENT_PREFIX}${origin}${REVISION_COMPONENT_SEPARATOR}${revision ?? INITIAL_REVISION}`;
|
|
433
|
+
}
|
|
434
|
+
function hasRevisionAnchor(version) {
|
|
435
|
+
return contentComponentOf(version).startsWith(REVISION_COMPONENT_PREFIX);
|
|
436
|
+
}
|
|
437
|
+
function revisionAnchorOf(version) {
|
|
438
|
+
const revision = revisionPartsOf(version)?.revision;
|
|
439
|
+
return revision === void 0 || revision === INITIAL_REVISION ? void 0 : revision;
|
|
440
|
+
}
|
|
441
|
+
function revisionOriginOf(version) {
|
|
442
|
+
return revisionPartsOf(version)?.origin;
|
|
443
|
+
}
|
|
444
|
+
function revisionPartsOf(version) {
|
|
445
|
+
const component = contentComponentOf(version);
|
|
446
|
+
if (!component.startsWith(REVISION_COMPONENT_PREFIX)) return void 0;
|
|
447
|
+
const encoded = component.slice(REVISION_COMPONENT_PREFIX.length);
|
|
448
|
+
const separator = encoded.indexOf(REVISION_COMPONENT_SEPARATOR);
|
|
449
|
+
if (separator <= 0 || separator === encoded.length - 1) return void 0;
|
|
450
|
+
return {
|
|
451
|
+
origin: encoded.slice(0, separator),
|
|
452
|
+
revision: encoded.slice(separator + 1)
|
|
453
|
+
};
|
|
454
|
+
}
|
|
375
455
|
function contentComponentOf(version) {
|
|
376
456
|
const separatorIndex = version.indexOf(TOKEN_SEPARATOR);
|
|
377
457
|
return separatorIndex === -1 ? version : version.slice(separatorIndex + 1);
|
|
@@ -446,22 +526,32 @@ var CLONE_IMPORT_BATCH_SIZE = 1e3;
|
|
|
446
526
|
function cloneWorkingCopyStrategy(makeBackend) {
|
|
447
527
|
return {
|
|
448
528
|
create: async (baseStore) => {
|
|
449
|
-
const data = await exportGraph(baseStore, {
|
|
450
|
-
includeMeta: true,
|
|
451
|
-
includeDeleted: false
|
|
452
|
-
});
|
|
453
529
|
const backend = await makeBackend();
|
|
454
530
|
try {
|
|
455
531
|
const [freshStore] = await createStoreWithSchema(
|
|
456
532
|
baseStore.graph,
|
|
457
|
-
backend
|
|
533
|
+
backend,
|
|
534
|
+
{
|
|
535
|
+
// Keep descendants branchable with the same O(1) anchor contract,
|
|
536
|
+
// but do not copy recorded-time history into the disposable fork.
|
|
537
|
+
revisionTracking: baseStore.revisionTrackingEnabled
|
|
538
|
+
}
|
|
539
|
+
);
|
|
540
|
+
const result = await importGraphStream(
|
|
541
|
+
freshStore,
|
|
542
|
+
exportGraphStream(baseStore, {
|
|
543
|
+
includeMeta: true,
|
|
544
|
+
includeTemporal: true,
|
|
545
|
+
includeDeleted: false,
|
|
546
|
+
batchSize: CLONE_IMPORT_BATCH_SIZE
|
|
547
|
+
}),
|
|
548
|
+
{
|
|
549
|
+
onConflict: "error",
|
|
550
|
+
onUnknownProperty: "error",
|
|
551
|
+
validateReferences: true,
|
|
552
|
+
batchSize: CLONE_IMPORT_BATCH_SIZE
|
|
553
|
+
}
|
|
458
554
|
);
|
|
459
|
-
const result = await importGraph(freshStore, data, {
|
|
460
|
-
onConflict: "error",
|
|
461
|
-
onUnknownProperty: "error",
|
|
462
|
-
validateReferences: true,
|
|
463
|
-
batchSize: CLONE_IMPORT_BATCH_SIZE
|
|
464
|
-
});
|
|
465
555
|
if (!result.success) {
|
|
466
556
|
throw new BranchError(
|
|
467
557
|
"Clone import failed: the working copy could not be seeded from the base store. The backend returned by makeBackend() must be empty.",
|
|
@@ -859,6 +949,7 @@ var UnionFind = class {
|
|
|
859
949
|
constructor(compare) {
|
|
860
950
|
this.compare = compare;
|
|
861
951
|
}
|
|
952
|
+
compare;
|
|
862
953
|
parent = /* @__PURE__ */ new Map();
|
|
863
954
|
/** Adds `value` as its own singleton set if it is not already present. */
|
|
864
955
|
add(value) {
|
|
@@ -2461,16 +2552,26 @@ function groupByKind(items) {
|
|
|
2461
2552
|
}
|
|
2462
2553
|
return ordered;
|
|
2463
2554
|
}
|
|
2464
|
-
async function stageBranches(baseStore, branches) {
|
|
2555
|
+
async function stageBranches(baseStore, branches, captureTargetStateFor) {
|
|
2465
2556
|
const newNodes = [];
|
|
2466
2557
|
const modifiedNodes = [];
|
|
2467
2558
|
const deletedNodes = [];
|
|
2468
2559
|
const newEdges = [];
|
|
2469
2560
|
const modifiedEdges = [];
|
|
2470
2561
|
const deletedEdges = [];
|
|
2562
|
+
let targetNodeVersions = /* @__PURE__ */ new Map();
|
|
2563
|
+
let targetEdgeSignatures = /* @__PURE__ */ new Map();
|
|
2471
2564
|
for (const branch2 of branches) {
|
|
2472
|
-
const diff = await diffAgainstBase(baseStore, branch2.store);
|
|
2473
2565
|
const branchId = branch2.id;
|
|
2566
|
+
const diff = await diffAgainstBase(
|
|
2567
|
+
baseStore,
|
|
2568
|
+
branch2.store,
|
|
2569
|
+
branchId === captureTargetStateFor
|
|
2570
|
+
);
|
|
2571
|
+
if (branchId === captureTargetStateFor) {
|
|
2572
|
+
targetNodeVersions = diff.forkNodeVersions;
|
|
2573
|
+
targetEdgeSignatures = diff.forkEdgeSignatures;
|
|
2574
|
+
}
|
|
2474
2575
|
for (const node of diff.nodes.new) {
|
|
2475
2576
|
newNodes.push({ branchId, node, kind: node.kind, id: node.id });
|
|
2476
2577
|
}
|
|
@@ -2504,7 +2605,9 @@ async function stageBranches(baseStore, branches) {
|
|
|
2504
2605
|
),
|
|
2505
2606
|
deletedEdges: [...deletedEdges].sort(
|
|
2506
2607
|
(left, right) => compareByKindIdBranch(left, right)
|
|
2507
|
-
)
|
|
2608
|
+
),
|
|
2609
|
+
targetNodeVersions,
|
|
2610
|
+
targetEdgeSignatures
|
|
2508
2611
|
};
|
|
2509
2612
|
}
|
|
2510
2613
|
|
|
@@ -3286,13 +3389,50 @@ async function commitPlan(target, plan, expectedBaseVersion) {
|
|
|
3286
3389
|
tx.nodes,
|
|
3287
3390
|
tx.edges
|
|
3288
3391
|
);
|
|
3289
|
-
},
|
|
3392
|
+
}, mergeCommitTransactionOptions(target))
|
|
3290
3393
|
);
|
|
3291
3394
|
}
|
|
3292
3395
|
var MERGE_COMMIT_TX_OPTIONS = {
|
|
3293
3396
|
isolationLevel: "serializable"
|
|
3294
3397
|
};
|
|
3398
|
+
function mergeCommitTransactionOptions(target) {
|
|
3399
|
+
return target.historyEnabled ? void 0 : MERGE_COMMIT_TX_OPTIONS;
|
|
3400
|
+
}
|
|
3295
3401
|
async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
3402
|
+
if (hasRevisionAnchor(expectedBaseVersion)) {
|
|
3403
|
+
await lockRecordedGraphWrite(txBackend, target.graphId);
|
|
3404
|
+
const expectedOrigin = revisionOriginOf(expectedBaseVersion);
|
|
3405
|
+
const liveOrigin = await readRevisionOrigin(
|
|
3406
|
+
txBackend,
|
|
3407
|
+
target.revisionSchema,
|
|
3408
|
+
target.graphId
|
|
3409
|
+
);
|
|
3410
|
+
if (liveOrigin !== expectedOrigin) {
|
|
3411
|
+
throw new BaseVersionMismatchError(
|
|
3412
|
+
"The merge branch was forked from a different revision-tracked store; the resolved plan was not applied.",
|
|
3413
|
+
{
|
|
3414
|
+
details: { expectedOrigin, liveOrigin },
|
|
3415
|
+
suggestion: "Merge the branch back into its original base store, or fork a new branch from this target."
|
|
3416
|
+
}
|
|
3417
|
+
);
|
|
3418
|
+
}
|
|
3419
|
+
const liveRevision = await readRecordedClock(
|
|
3420
|
+
txBackend,
|
|
3421
|
+
target.revisionSchema,
|
|
3422
|
+
target.graphId
|
|
3423
|
+
);
|
|
3424
|
+
const expectedRevision = revisionAnchorOf(expectedBaseVersion);
|
|
3425
|
+
if (liveRevision !== expectedRevision) {
|
|
3426
|
+
throw new BaseVersionMismatchError(
|
|
3427
|
+
"The merge target was modified between the revision-anchor check and the commit transaction; the resolved plan was not applied.",
|
|
3428
|
+
{
|
|
3429
|
+
details: { expectedRevision, liveRevision },
|
|
3430
|
+
suggestion: "Re-run the merge (and re-branch if the divergence is real), or route all graph writes through the revision-tracked Store."
|
|
3431
|
+
}
|
|
3432
|
+
);
|
|
3433
|
+
}
|
|
3434
|
+
return;
|
|
3435
|
+
}
|
|
3296
3436
|
const liveContent = await computeContentComponent(
|
|
3297
3437
|
txBackend,
|
|
3298
3438
|
target.graphId,
|
|
@@ -3381,8 +3521,8 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
3381
3521
|
}
|
|
3382
3522
|
}
|
|
3383
3523
|
try {
|
|
3384
|
-
const staging = await stageBranches(store, branches);
|
|
3385
3524
|
const preferredBranchId = incremental?.targetBranchId;
|
|
3525
|
+
const staging = await stageBranches(store, branches, preferredBranchId);
|
|
3386
3526
|
const branchIds = branches.map((branch2) => branch2.id);
|
|
3387
3527
|
const branchOrder = preferredBranchId === void 0 ? options.branchOrder ?? [] : [
|
|
3388
3528
|
preferredBranchId,
|
|
@@ -3436,7 +3576,9 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
3436
3576
|
// anything NEW the in-tx re-probe surfaces is a window write.
|
|
3437
3577
|
plannedBaseMatchKeys: new Set(
|
|
3438
3578
|
candidates.data.baseMembers.map((member) => mergeKeyOf(member))
|
|
3439
|
-
)
|
|
3579
|
+
),
|
|
3580
|
+
targetNodeVersions: staging.targetNodeVersions,
|
|
3581
|
+
targetEdgeSignatures: staging.targetEdgeSignatures
|
|
3440
3582
|
});
|
|
3441
3583
|
const provenance = options.provenance ? buildProvenanceIndex(plan.provenanceRecords) : { byBranch: () => ({ nodeIds: [], edgeIds: [] }) };
|
|
3442
3584
|
const warnings = [...plan.warnings];
|
|
@@ -3866,6 +4008,99 @@ async function assertBaseResolutionStable(lookupStore, guard) {
|
|
|
3866
4008
|
}
|
|
3867
4009
|
);
|
|
3868
4010
|
}
|
|
4011
|
+
function bucketInheritedRefsByKind(refs, identities) {
|
|
4012
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4013
|
+
const idsByKind = /* @__PURE__ */ new Map();
|
|
4014
|
+
for (const ref of refs) {
|
|
4015
|
+
const identity = mergeKey(ref.kind, ref.id);
|
|
4016
|
+
if (!identities.has(identity) || seen.has(identity)) {
|
|
4017
|
+
continue;
|
|
4018
|
+
}
|
|
4019
|
+
seen.add(identity);
|
|
4020
|
+
const bucket = idsByKind.get(ref.kind) ?? [];
|
|
4021
|
+
bucket.push(ref.id);
|
|
4022
|
+
idsByKind.set(ref.kind, bucket);
|
|
4023
|
+
}
|
|
4024
|
+
return idsByKind;
|
|
4025
|
+
}
|
|
4026
|
+
async function assertInheritedUnchanged(args) {
|
|
4027
|
+
if (args.expected.size === 0) {
|
|
4028
|
+
return;
|
|
4029
|
+
}
|
|
4030
|
+
const idsByKind = bucketInheritedRefsByKind(args.refs, args.expected);
|
|
4031
|
+
for (const [kind, ids] of idsByKind) {
|
|
4032
|
+
const rows = await args.fetchRows(kind, ids);
|
|
4033
|
+
for (const [index, id] of ids.entries()) {
|
|
4034
|
+
const expected = args.expected.get(mergeKey(kind, id));
|
|
4035
|
+
const current = args.deriveValue(rows[index]);
|
|
4036
|
+
if (current === expected) {
|
|
4037
|
+
continue;
|
|
4038
|
+
}
|
|
4039
|
+
throw args.buildError(id, kind, expected, current);
|
|
4040
|
+
}
|
|
4041
|
+
}
|
|
4042
|
+
}
|
|
4043
|
+
async function assertInheritedTargetUnchanged(nodesApi, edgesApi, guard, plan) {
|
|
4044
|
+
await Promise.all([
|
|
4045
|
+
assertInheritedNodesUnchanged(nodesApi, guard, plan),
|
|
4046
|
+
assertInheritedEdgesUnchanged(edgesApi, guard, plan)
|
|
4047
|
+
]);
|
|
4048
|
+
}
|
|
4049
|
+
async function assertInheritedNodesUnchanged(nodesApi, guard, plan) {
|
|
4050
|
+
const nodeRefs = plannedNodeWrites(plan).map(
|
|
4051
|
+
(write) => ({ kind: write.kind, id: write.id })
|
|
4052
|
+
);
|
|
4053
|
+
for (const [identity, kind] of plan.nodeDeletions) {
|
|
4054
|
+
nodeRefs.push({ kind, id: idOf(identity) });
|
|
4055
|
+
}
|
|
4056
|
+
await assertInheritedUnchanged({
|
|
4057
|
+
refs: nodeRefs,
|
|
4058
|
+
expected: guard.targetNodeVersions,
|
|
4059
|
+
fetchRows: (kind, ids) => nodeCollection(nodesApi, kind).getByIds(ids, INCLUDE_TOMBSTONES),
|
|
4060
|
+
deriveValue: (row) => row?.meta.version,
|
|
4061
|
+
buildError: (id, kind, expected, current) => new BaseVersionMismatchError(
|
|
4062
|
+
`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.`,
|
|
4063
|
+
{
|
|
4064
|
+
details: {
|
|
4065
|
+
id,
|
|
4066
|
+
kind,
|
|
4067
|
+
expectedVersion: expected,
|
|
4068
|
+
currentVersion: current
|
|
4069
|
+
},
|
|
4070
|
+
suggestion: "Re-run mergeIncremental(); the re-planned merge resolves the inherited modifications against the now-committed rows."
|
|
4071
|
+
}
|
|
4072
|
+
)
|
|
4073
|
+
});
|
|
4074
|
+
}
|
|
4075
|
+
async function assertInheritedEdgesUnchanged(edgesApi, guard, plan) {
|
|
4076
|
+
const edgeRefs = plan.mergedEdges.map((edge) => ({
|
|
4077
|
+
kind: edge.kind,
|
|
4078
|
+
id: edge.id
|
|
4079
|
+
}));
|
|
4080
|
+
for (const [identity, kind] of plan.edgeDeletions) {
|
|
4081
|
+
edgeRefs.push({ kind, id: idOf(identity) });
|
|
4082
|
+
}
|
|
4083
|
+
await assertInheritedUnchanged({
|
|
4084
|
+
refs: edgeRefs,
|
|
4085
|
+
expected: guard.targetEdgeSignatures,
|
|
4086
|
+
fetchRows: (kind, ids) => edgeCollection(edgesApi, kind).getByIds(ids, INCLUDE_TOMBSTONES),
|
|
4087
|
+
deriveValue: (row) => row === void 0 ? void 0 : edgeStateSignature({
|
|
4088
|
+
fromKind: row.fromKind,
|
|
4089
|
+
fromId: row.fromId,
|
|
4090
|
+
toKind: row.toKind,
|
|
4091
|
+
toId: row.toId,
|
|
4092
|
+
live: row.meta.deletedAt === void 0,
|
|
4093
|
+
props: edgeProps(row)
|
|
4094
|
+
}),
|
|
4095
|
+
buildError: (id, kind) => new BaseVersionMismatchError(
|
|
4096
|
+
`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.`,
|
|
4097
|
+
{
|
|
4098
|
+
details: { id, kind },
|
|
4099
|
+
suggestion: "Re-run mergeIncremental(); the re-planned merge resolves the inherited modifications against the now-committed rows."
|
|
4100
|
+
}
|
|
4101
|
+
)
|
|
4102
|
+
});
|
|
4103
|
+
}
|
|
3869
4104
|
async function commitIncrementalPlan(target, plan, guard) {
|
|
3870
4105
|
if (!target.backend.capabilities.transactions) {
|
|
3871
4106
|
throw new MergeError(
|
|
@@ -3875,13 +4110,17 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
3875
4110
|
}
|
|
3876
4111
|
return withTxConflictRetry(
|
|
3877
4112
|
() => target.transaction(async (tx) => {
|
|
4113
|
+
if (target.revisionTrackingEnabled) {
|
|
4114
|
+
await lockRecordedGraphWrite(tx.backend, target.graphId);
|
|
4115
|
+
}
|
|
3878
4116
|
const nodesApi = tx.nodes;
|
|
3879
4117
|
const edgesApi = tx.edges;
|
|
3880
4118
|
await assertBaseResolutionStable(tx, guard);
|
|
4119
|
+
await assertInheritedTargetUnchanged(nodesApi, edgesApi, guard, plan);
|
|
3881
4120
|
await validateIncrementalNodeWrites(target, nodesApi, plan);
|
|
3882
4121
|
await validateIncrementalEdgeWrites(target, edgesApi, plan);
|
|
3883
4122
|
return applyMergePlan(plan, nodesApi, edgesApi);
|
|
3884
|
-
},
|
|
4123
|
+
}, mergeCommitTransactionOptions(target))
|
|
3885
4124
|
);
|
|
3886
4125
|
}
|
|
3887
4126
|
async function mergeIncremental(args) {
|