@nicia-ai/typegraph 0.73.0 → 0.73.1
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/CHANGELOG.md +15 -0
- package/dist/backend/postgres/pglite-store.cjs +1 -1
- package/dist/backend/postgres/pglite-store.js +1 -1
- package/dist/backend/postgres/working-copy.cjs +85 -85
- package/dist/backend/postgres/working-copy.js +4 -4
- package/dist/backend/sqlite/local-store.cjs +1 -1
- package/dist/backend/sqlite/local-store.js +1 -1
- package/dist/{chunk-7QQ3ICAZ.cjs → chunk-BZ5EXHZX.cjs} +11 -11
- package/dist/{chunk-7QQ3ICAZ.cjs.map → chunk-BZ5EXHZX.cjs.map} +1 -1
- package/dist/{chunk-ZN24TFVZ.cjs → chunk-GLDGT3L3.cjs} +6 -3
- package/dist/chunk-GLDGT3L3.cjs.map +1 -0
- package/dist/{chunk-ORTKLAAU.js → chunk-LJG2TYCN.js} +3 -3
- package/dist/{chunk-ORTKLAAU.js.map → chunk-LJG2TYCN.js.map} +1 -1
- package/dist/{chunk-VKMLQTXP.cjs → chunk-MPCF5XBW.cjs} +159 -159
- package/dist/{chunk-VKMLQTXP.cjs.map → chunk-MPCF5XBW.cjs.map} +1 -1
- package/dist/{chunk-5RTWCMBC.js → chunk-OA4PF2QI.js} +6 -3
- package/dist/chunk-OA4PF2QI.js.map +1 -0
- package/dist/{chunk-XGYVKBI5.cjs → chunk-P52FOZSI.cjs} +8 -8
- package/dist/{chunk-XGYVKBI5.cjs.map → chunk-P52FOZSI.cjs.map} +1 -1
- package/dist/{chunk-KI7VMCOG.cjs → chunk-QJGQ3FN2.cjs} +16 -16
- package/dist/{chunk-KI7VMCOG.cjs.map → chunk-QJGQ3FN2.cjs.map} +1 -1
- package/dist/{chunk-MSUUUG5B.js → chunk-TI2O2U4G.js} +4 -4
- package/dist/{chunk-MSUUUG5B.js.map → chunk-TI2O2U4G.js.map} +1 -1
- package/dist/{chunk-FC7INRDS.js → chunk-WX7BQELV.js} +4 -4
- package/dist/{chunk-FC7INRDS.js.map → chunk-WX7BQELV.js.map} +1 -1
- package/dist/{chunk-NMLLXBGF.js → chunk-XIFBU27X.js} +3 -3
- package/dist/{chunk-NMLLXBGF.js.map → chunk-XIFBU27X.js.map} +1 -1
- package/dist/graph-merge/index.cjs +531 -531
- package/dist/graph-merge/index.js +6 -6
- package/dist/index.cjs +43 -43
- package/dist/index.js +2 -2
- package/dist/interchange/index.cjs +26 -26
- package/dist/interchange/index.js +3 -3
- package/dist/{local-store-impl-ALYCG7CX.js → local-store-impl-HPNBERU4.js} +4 -4
- package/dist/{local-store-impl-ALYCG7CX.js.map → local-store-impl-HPNBERU4.js.map} +1 -1
- package/dist/{local-store-impl-2HTGPM6A.cjs → local-store-impl-WIVQ5HDM.cjs} +5 -5
- package/dist/{local-store-impl-2HTGPM6A.cjs.map → local-store-impl-WIVQ5HDM.cjs.map} +1 -1
- package/dist/{pglite-store-impl-F2WHYIM7.cjs → pglite-store-impl-IXKIXLH6.cjs} +5 -5
- package/dist/{pglite-store-impl-F2WHYIM7.cjs.map → pglite-store-impl-IXKIXLH6.cjs.map} +1 -1
- package/dist/{pglite-store-impl-3UUTJLGP.js → pglite-store-impl-U3TW3Z4C.js} +4 -4
- package/dist/{pglite-store-impl-3UUTJLGP.js.map → pglite-store-impl-U3TW3Z4C.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-5RTWCMBC.js.map +0 -1
- package/dist/chunk-ZN24TFVZ.cjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkBZ5EXHZX_cjs = require('../chunk-BZ5EXHZX.cjs');
|
|
4
|
+
var chunkMPCF5XBW_cjs = require('../chunk-MPCF5XBW.cjs');
|
|
5
5
|
var chunkGZBI2EQM_cjs = require('../chunk-GZBI2EQM.cjs');
|
|
6
6
|
require('../chunk-B5C2V2LN.cjs');
|
|
7
|
-
require('../chunk-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
7
|
+
require('../chunk-P52FOZSI.cjs');
|
|
8
|
+
var chunkQJGQ3FN2_cjs = require('../chunk-QJGQ3FN2.cjs');
|
|
9
|
+
var chunkGLDGT3L3_cjs = require('../chunk-GLDGT3L3.cjs');
|
|
10
10
|
require('../chunk-7USI4E2O.cjs');
|
|
11
11
|
require('../chunk-BJCI4W4M.cjs');
|
|
12
12
|
var chunkTHCONLOL_cjs = require('../chunk-THCONLOL.cjs');
|
|
@@ -53,7 +53,7 @@ var zod = require('zod');
|
|
|
53
53
|
function evolutionPlanningTarget(store, plan) {
|
|
54
54
|
const planningTarget = chunkQV6LL3PK_cjs.storeRuntime(store).evolutionPlanningTarget;
|
|
55
55
|
if (planningTarget === void 0) {
|
|
56
|
-
throw new
|
|
56
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
57
57
|
"This Store cannot construct a resulting-schema merge planning view.",
|
|
58
58
|
{ details: { capability: "evolutionPlanningTarget" } }
|
|
59
59
|
);
|
|
@@ -84,15 +84,15 @@ async function ingestionBranch(baseStore, makeBackend, options) {
|
|
|
84
84
|
}
|
|
85
85
|
async function ingestionBranchWithStrategy(baseStore, makeBackend, options, strategy) {
|
|
86
86
|
try {
|
|
87
|
-
const created = await
|
|
87
|
+
const created = await chunkBZ5EXHZX_cjs.branch(
|
|
88
88
|
baseStore,
|
|
89
89
|
makeBackend,
|
|
90
90
|
options,
|
|
91
|
-
strategy ??
|
|
91
|
+
strategy ?? chunkBZ5EXHZX_cjs.cloneIngestionWorkingCopyStrategy(makeBackend)
|
|
92
92
|
);
|
|
93
93
|
if (chunkPAHLRNPI_cjs.isErr(created)) {
|
|
94
94
|
return chunkPAHLRNPI_cjs.err(
|
|
95
|
-
new
|
|
95
|
+
new chunkBZ5EXHZX_cjs.BranchError("Failed to create constraint-aware ingestion branch", {
|
|
96
96
|
cause: created.error
|
|
97
97
|
})
|
|
98
98
|
);
|
|
@@ -110,14 +110,14 @@ async function ingestionBranchWithStrategy(baseStore, makeBackend, options, stra
|
|
|
110
110
|
nodes: store.nodes,
|
|
111
111
|
edges: store.edges,
|
|
112
112
|
...identityAccess,
|
|
113
|
-
close:
|
|
113
|
+
close: chunkBZ5EXHZX_cjs.coalescedWorkingCopyClose(store)
|
|
114
114
|
});
|
|
115
115
|
PRIVATE_BRANCHES.set(handle, privateBranch);
|
|
116
|
-
|
|
116
|
+
chunkQJGQ3FN2_cjs.registerIngestionImportTarget(handle, store);
|
|
117
117
|
return chunkPAHLRNPI_cjs.ok(handle);
|
|
118
118
|
} catch (error) {
|
|
119
119
|
return chunkPAHLRNPI_cjs.err(
|
|
120
|
-
new
|
|
120
|
+
new chunkBZ5EXHZX_cjs.BranchError("Failed to create constraint-aware ingestion branch", {
|
|
121
121
|
cause: error
|
|
122
122
|
})
|
|
123
123
|
);
|
|
@@ -137,7 +137,7 @@ function unwrapMergeBranches(inputs) {
|
|
|
137
137
|
// src/graph-merge/adopted-transaction.ts
|
|
138
138
|
async function assertMergeTransactionPristine(target, txBackend) {
|
|
139
139
|
if (chunkQV6LL3PK_cjs.hasPendingRecordedGraphWrites(txBackend, target.graphId) || chunkQV6LL3PK_cjs.hasPendingWriteTransactionRevision(txBackend)) {
|
|
140
|
-
throw new
|
|
140
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
141
141
|
"Apply the merge plan before writing to its target graph in this transaction.",
|
|
142
142
|
{ details: { capability: "mergeTransactionPristine" } }
|
|
143
143
|
);
|
|
@@ -145,7 +145,7 @@ async function assertMergeTransactionPristine(target, txBackend) {
|
|
|
145
145
|
if (chunkKT5UIJ3J_cjs.resolveWriteFencePlan(txBackend).kind !== "engine-serialized") return;
|
|
146
146
|
const statements = chunkQTP3A3FC_cjs.statementExecutionVerdict(chunkQV6LL3PK_cjs.storeBackend(target));
|
|
147
147
|
if (!statements.supported) {
|
|
148
|
-
throw new
|
|
148
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
149
149
|
"Adopted merge application requires transaction-scoped statement execution to acquire the engine writer slot.",
|
|
150
150
|
{ details: { capability: "mergeTransactionWriterSlot" } }
|
|
151
151
|
);
|
|
@@ -159,8 +159,8 @@ async function assertMergeTransactionPristine(target, txBackend) {
|
|
|
159
159
|
|
|
160
160
|
// src/graph-merge/apply-callbacks.ts
|
|
161
161
|
var NODE_READ_NAMES = [
|
|
162
|
-
...
|
|
163
|
-
...
|
|
162
|
+
...chunkMPCF5XBW_cjs.NODE_TEMPORAL_READ_NAMES,
|
|
163
|
+
...chunkMPCF5XBW_cjs.CURRENT_ONLY_READ_NAMES
|
|
164
164
|
];
|
|
165
165
|
function pickReadMethods(source, names) {
|
|
166
166
|
return Object.fromEntries(names.map((name) => [name, source[name]]));
|
|
@@ -178,18 +178,18 @@ function mergePlanReadContext(tx, graph) {
|
|
|
178
178
|
kind,
|
|
179
179
|
pickReadMethods(
|
|
180
180
|
chunkBXHAPCQG_cjs.requireDefined(tx.edges[kind]),
|
|
181
|
-
|
|
181
|
+
chunkMPCF5XBW_cjs.EDGE_TEMPORAL_READ_NAMES
|
|
182
182
|
)
|
|
183
183
|
])
|
|
184
184
|
),
|
|
185
185
|
..."identity" in tx ? {
|
|
186
|
-
identity: pickReadMethods(tx.identity,
|
|
186
|
+
identity: pickReadMethods(tx.identity, chunkMPCF5XBW_cjs.IDENTITY_READ_NAMES)
|
|
187
187
|
} : {}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
function assertMergeCallbackResult(result, callback) {
|
|
191
191
|
if (result !== void 0) {
|
|
192
|
-
throw new
|
|
192
|
+
throw new chunkBZ5EXHZX_cjs.InvalidMergeOptionsError(
|
|
193
193
|
`${callback} must resolve without a return value; throw or reject to abort merge application.`,
|
|
194
194
|
{ cause: result, details: { callback } }
|
|
195
195
|
);
|
|
@@ -296,7 +296,7 @@ function pickByPriority(values, branchRank) {
|
|
|
296
296
|
if (candidateRank < chosenRank) {
|
|
297
297
|
chosen = candidate;
|
|
298
298
|
chosenRank = candidateRank;
|
|
299
|
-
} else if (candidateRank === chosenRank &&
|
|
299
|
+
} else if (candidateRank === chosenRank && chunkBZ5EXHZX_cjs.canonicalValueKey(candidate.value) < chunkBZ5EXHZX_cjs.canonicalValueKey(chosen.value)) {
|
|
300
300
|
chosen = candidate;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
@@ -319,7 +319,7 @@ function pickByWeight(values, weights, branchRank) {
|
|
|
319
319
|
if (candidateRank < chosenRank) {
|
|
320
320
|
chosen = candidate;
|
|
321
321
|
chosenRank = candidateRank;
|
|
322
|
-
} else if (candidateRank === chosenRank &&
|
|
322
|
+
} else if (candidateRank === chosenRank && chunkBZ5EXHZX_cjs.canonicalValueKey(candidate.value) < chunkBZ5EXHZX_cjs.canonicalValueKey(chosen.value)) {
|
|
323
323
|
chosen = candidate;
|
|
324
324
|
}
|
|
325
325
|
}
|
|
@@ -330,9 +330,9 @@ function allValuesEqual(values) {
|
|
|
330
330
|
if (values.length <= 1) {
|
|
331
331
|
return true;
|
|
332
332
|
}
|
|
333
|
-
const first =
|
|
333
|
+
const first = chunkBZ5EXHZX_cjs.canonicalValueKey(chunkBXHAPCQG_cjs.requireDefined(values[0]).value);
|
|
334
334
|
return values.every(
|
|
335
|
-
(candidate) =>
|
|
335
|
+
(candidate) => chunkBZ5EXHZX_cjs.canonicalValueKey(candidate.value) === first
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
function collectConflictingValues(property, contributions) {
|
|
@@ -343,7 +343,7 @@ function collectConflictingValues(property, contributions) {
|
|
|
343
343
|
continue;
|
|
344
344
|
}
|
|
345
345
|
const value = props[property];
|
|
346
|
-
const dedupeKey2 = `${branchId}\0${
|
|
346
|
+
const dedupeKey2 = `${branchId}\0${chunkBZ5EXHZX_cjs.canonicalValueKey(value)}`;
|
|
347
347
|
if (seen.has(dedupeKey2)) {
|
|
348
348
|
continue;
|
|
349
349
|
}
|
|
@@ -353,8 +353,8 @@ function collectConflictingValues(property, contributions) {
|
|
|
353
353
|
return [...values].sort((left, right) => {
|
|
354
354
|
const byBranch = chunkDUN24DFZ_cjs.compareStrings(left.branchId, right.branchId);
|
|
355
355
|
return byBranch === 0 ? chunkDUN24DFZ_cjs.compareStrings(
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
chunkBZ5EXHZX_cjs.canonicalValueKey(left.value),
|
|
357
|
+
chunkBZ5EXHZX_cjs.canonicalValueKey(right.value)
|
|
358
358
|
) : byBranch;
|
|
359
359
|
});
|
|
360
360
|
}
|
|
@@ -411,12 +411,12 @@ function resolvePropertyUnion(input, context, branchRank) {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
// src/graph-merge/canonicalize.ts
|
|
414
|
-
var BASE_PROVENANCE_BRANCH =
|
|
415
|
-
var COMMITTED_TARGET_BRANCH =
|
|
414
|
+
var BASE_PROVENANCE_BRANCH = chunkBZ5EXHZX_cjs.asBranchId("__committed_base__");
|
|
415
|
+
var COMMITTED_TARGET_BRANCH = chunkBZ5EXHZX_cjs.asBranchId(
|
|
416
416
|
"__committed_target__"
|
|
417
417
|
);
|
|
418
418
|
function pickClusterSurvivor(members, cluster, canonicalOverride, preferKind) {
|
|
419
|
-
const byKey = (left, right) =>
|
|
419
|
+
const byKey = (left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(chunkBZ5EXHZX_cjs.mergeKeyOf(left), chunkBZ5EXHZX_cjs.mergeKeyOf(right));
|
|
420
420
|
const baseMembers = members.filter((member) => member.origin === "base").sort(byKey);
|
|
421
421
|
if (baseMembers.length > 0) {
|
|
422
422
|
return chunkBXHAPCQG_cjs.requireDefined(baseMembers[0]);
|
|
@@ -427,16 +427,16 @@ function pickClusterSurvivor(members, cluster, canonicalOverride, preferKind) {
|
|
|
427
427
|
}
|
|
428
428
|
let canonicalId;
|
|
429
429
|
if (canonicalOverride !== void 0) {
|
|
430
|
-
const chosen = canonicalOverride({ members: cluster.members.map(
|
|
430
|
+
const chosen = canonicalOverride({ members: cluster.members.map(chunkBZ5EXHZX_cjs.idOf) });
|
|
431
431
|
if (members.some((member) => member.id === chosen)) {
|
|
432
432
|
canonicalId = chosen;
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
if (canonicalId === void 0) {
|
|
436
436
|
const minIdentity = [...cluster.members].sort(
|
|
437
|
-
(left, right) =>
|
|
437
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right)
|
|
438
438
|
)[0];
|
|
439
|
-
canonicalId = minIdentity === void 0 ? chunkBXHAPCQG_cjs.requireDefined(members[0]).id :
|
|
439
|
+
canonicalId = minIdentity === void 0 ? chunkBXHAPCQG_cjs.requireDefined(members[0]).id : chunkBZ5EXHZX_cjs.idOf(minIdentity);
|
|
440
440
|
}
|
|
441
441
|
const membersAtId = members.filter((member) => member.id === canonicalId);
|
|
442
442
|
if (membersAtId.length === 0) {
|
|
@@ -550,7 +550,7 @@ function canonicalizeCluster(cluster, members, policy, branchRank, weights, cano
|
|
|
550
550
|
preferredBranchId
|
|
551
551
|
);
|
|
552
552
|
const memberIds = [
|
|
553
|
-
...new Set(cluster.members.map((member) =>
|
|
553
|
+
...new Set(cluster.members.map((member) => chunkBZ5EXHZX_cjs.idOf(member)))
|
|
554
554
|
].sort((left, right) => chunkDUN24DFZ_cjs.compareStrings(left, right));
|
|
555
555
|
const branchOrigins = [
|
|
556
556
|
...new Set(
|
|
@@ -687,7 +687,7 @@ function isReachable2(closure, from, to) {
|
|
|
687
687
|
|
|
688
688
|
// src/graph-merge/evidence.ts
|
|
689
689
|
function entityRef(key) {
|
|
690
|
-
return { kind:
|
|
690
|
+
return { kind: chunkBZ5EXHZX_cjs.kindOf(key), id: chunkBZ5EXHZX_cjs.idOf(key) };
|
|
691
691
|
}
|
|
692
692
|
var SOURCE_KIND_ORDER = {
|
|
693
693
|
block: 0,
|
|
@@ -724,7 +724,7 @@ function sourceKey(source) {
|
|
|
724
724
|
return JSON.stringify([
|
|
725
725
|
SOURCE_KIND_ORDER.custom,
|
|
726
726
|
source.sourceId,
|
|
727
|
-
source.metadata === void 0 ? "" :
|
|
727
|
+
source.metadata === void 0 ? "" : chunkBZ5EXHZX_cjs.canonicalValueKey(source.metadata)
|
|
728
728
|
]);
|
|
729
729
|
}
|
|
730
730
|
default: {
|
|
@@ -737,9 +737,9 @@ function compareMatchSources(left, right) {
|
|
|
737
737
|
return chunkDUN24DFZ_cjs.compareStrings(sourceKey(left), sourceKey(right));
|
|
738
738
|
}
|
|
739
739
|
function compareEntityRefs(left, right) {
|
|
740
|
-
return
|
|
741
|
-
|
|
742
|
-
|
|
740
|
+
return chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
741
|
+
chunkBZ5EXHZX_cjs.mergeKey(left.kind, left.id),
|
|
742
|
+
chunkBZ5EXHZX_cjs.mergeKey(right.kind, right.id)
|
|
743
743
|
);
|
|
744
744
|
}
|
|
745
745
|
function normalizeMatchSources(sources) {
|
|
@@ -819,7 +819,7 @@ function stringifyFieldValue(value) {
|
|
|
819
819
|
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
820
820
|
return String(value);
|
|
821
821
|
}
|
|
822
|
-
return
|
|
822
|
+
return chunkBZ5EXHZX_cjs.canonicalValueKey(value);
|
|
823
823
|
}
|
|
824
824
|
function trigramMultiset(text) {
|
|
825
825
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -925,7 +925,7 @@ function normalizeHybridWeights(weights) {
|
|
|
925
925
|
return { vector: vector / total, fulltext: fulltext / total };
|
|
926
926
|
}
|
|
927
927
|
function embedderUnavailable(kind, ctx) {
|
|
928
|
-
return new
|
|
928
|
+
return new chunkBZ5EXHZX_cjs.SimilarityUnavailableError(
|
|
929
929
|
`Similarity strategy "${kind}" requires a configured embedder (MergeOptions.embedder); none was provided.`,
|
|
930
930
|
{ details: { strategy: kind, dialect: ctx.backend.dialect } }
|
|
931
931
|
);
|
|
@@ -964,7 +964,7 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
964
964
|
raw = strategy.score(left.node, right.node);
|
|
965
965
|
} catch (error) {
|
|
966
966
|
return chunkPAHLRNPI_cjs.err(
|
|
967
|
-
new
|
|
967
|
+
new chunkBZ5EXHZX_cjs.MatchEvidenceError("Custom similarity scorer failed.", {
|
|
968
968
|
details: {
|
|
969
969
|
kind: left.node.kind,
|
|
970
970
|
sourceId: "similarity:custom",
|
|
@@ -976,7 +976,7 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
976
976
|
}
|
|
977
977
|
if (!Number.isFinite(raw)) {
|
|
978
978
|
return chunkPAHLRNPI_cjs.err(
|
|
979
|
-
new
|
|
979
|
+
new chunkBZ5EXHZX_cjs.MatchEvidenceError(
|
|
980
980
|
"Custom similarity scorer returned a non-finite score.",
|
|
981
981
|
{
|
|
982
982
|
details: {
|
|
@@ -1050,8 +1050,8 @@ function createPairScorer(strategy, ctx) {
|
|
|
1050
1050
|
// src/graph-merge/scoring.ts
|
|
1051
1051
|
var FORCED_MATCH_SCORE = 1;
|
|
1052
1052
|
function compareCandidateEdges(left, right) {
|
|
1053
|
-
const byA =
|
|
1054
|
-
return byA === 0 ?
|
|
1053
|
+
const byA = chunkBZ5EXHZX_cjs.compareMergeKeys(left.a, right.a);
|
|
1054
|
+
return byA === 0 ? chunkBZ5EXHZX_cjs.compareMergeKeys(left.b, right.b) : byA;
|
|
1055
1055
|
}
|
|
1056
1056
|
function endpointKey(a, b) {
|
|
1057
1057
|
return JSON.stringify([a, b]);
|
|
@@ -1098,13 +1098,13 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
1098
1098
|
}
|
|
1099
1099
|
const forced = [...forcedByKey.values()];
|
|
1100
1100
|
const fuzzy = [...fuzzyByKey.values()].sort((left, right) => {
|
|
1101
|
-
const byA =
|
|
1102
|
-
return byA === 0 ?
|
|
1101
|
+
const byA = chunkBZ5EXHZX_cjs.compareMergeKeys(left.a, right.a);
|
|
1102
|
+
return byA === 0 ? chunkBZ5EXHZX_cjs.compareMergeKeys(left.b, right.b) : byA;
|
|
1103
1103
|
});
|
|
1104
1104
|
if (maxComparisonsPerKind !== void 0 && fuzzy.length > maxComparisonsPerKind) {
|
|
1105
1105
|
if (ceilingPolicy === "error") {
|
|
1106
1106
|
return chunkPAHLRNPI_cjs.err(
|
|
1107
|
-
new
|
|
1107
|
+
new chunkBZ5EXHZX_cjs.MergeError(
|
|
1108
1108
|
`Comparison ceiling exceeded: ${fuzzy.length} candidate pairs > maxComparisonsPerKind ${maxComparisonsPerKind}.`,
|
|
1109
1109
|
{
|
|
1110
1110
|
details: {
|
|
@@ -1139,9 +1139,9 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
1139
1139
|
for (const { left, right, a, b, sources } of fuzzy) {
|
|
1140
1140
|
const scored = scorer(a, left, b, right);
|
|
1141
1141
|
if (chunkPAHLRNPI_cjs.isErr(scored)) {
|
|
1142
|
-
if (similarity.kind === "custom" && scored.error instanceof
|
|
1142
|
+
if (similarity.kind === "custom" && scored.error instanceof chunkBZ5EXHZX_cjs.MatchEvidenceError) {
|
|
1143
1143
|
return chunkPAHLRNPI_cjs.err(
|
|
1144
|
-
new
|
|
1144
|
+
new chunkBZ5EXHZX_cjs.MatchEvidenceError(scored.error.message, {
|
|
1145
1145
|
cause: scored.error,
|
|
1146
1146
|
details: {
|
|
1147
1147
|
kind: left.kind,
|
|
@@ -1158,7 +1158,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
1158
1158
|
}
|
|
1159
1159
|
if (!Number.isFinite(scored.data)) {
|
|
1160
1160
|
return chunkPAHLRNPI_cjs.err(
|
|
1161
|
-
new
|
|
1161
|
+
new chunkBZ5EXHZX_cjs.MatchEvidenceError(
|
|
1162
1162
|
"Similarity scorer returned a non-finite score.",
|
|
1163
1163
|
{
|
|
1164
1164
|
details: {
|
|
@@ -1207,7 +1207,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
1207
1207
|
|
|
1208
1208
|
// src/graph-merge/clustering.ts
|
|
1209
1209
|
function buildComponents(edges, nodeIds, edgesSorted = false) {
|
|
1210
|
-
const forest = new UnionFind(
|
|
1210
|
+
const forest = new UnionFind(chunkBZ5EXHZX_cjs.compareMergeKeys);
|
|
1211
1211
|
const seed = new Set(nodeIds);
|
|
1212
1212
|
for (const id of nodeIds) {
|
|
1213
1213
|
forest.add(id);
|
|
@@ -1233,12 +1233,12 @@ function buildComponents(edges, nodeIds, edgesSorted = false) {
|
|
|
1233
1233
|
for (const members of byRoot.values()) {
|
|
1234
1234
|
clusters.push({
|
|
1235
1235
|
members: [...members].sort(
|
|
1236
|
-
(left, right) =>
|
|
1236
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right)
|
|
1237
1237
|
)
|
|
1238
1238
|
});
|
|
1239
1239
|
}
|
|
1240
1240
|
clusters.sort(
|
|
1241
|
-
(left, right) =>
|
|
1241
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
1242
1242
|
chunkBXHAPCQG_cjs.requireDefined(left.members[0]),
|
|
1243
1243
|
chunkBXHAPCQG_cjs.requireDefined(right.members[0])
|
|
1244
1244
|
)
|
|
@@ -1375,7 +1375,7 @@ function enforceDiameterWithEdges(clusters, candidateEdges, clusterMaxDiameter)
|
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
1377
1377
|
guarded.sort(
|
|
1378
|
-
(left, right) =>
|
|
1378
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
1379
1379
|
chunkBXHAPCQG_cjs.requireDefined(left.members[0]),
|
|
1380
1380
|
chunkBXHAPCQG_cjs.requireDefined(right.members[0])
|
|
1381
1381
|
)
|
|
@@ -1421,10 +1421,10 @@ function enforceBaseGuard(clusters, candidateEdges, baseIds) {
|
|
|
1421
1421
|
}
|
|
1422
1422
|
events.push({
|
|
1423
1423
|
baseIds: [...clusterBaseIds].sort(
|
|
1424
|
-
(left, right) =>
|
|
1424
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right)
|
|
1425
1425
|
),
|
|
1426
1426
|
memberIds: [...cluster.members].sort(
|
|
1427
|
-
(left, right) =>
|
|
1427
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right)
|
|
1428
1428
|
)
|
|
1429
1429
|
});
|
|
1430
1430
|
const split = splitByBaseMultiplicity(
|
|
@@ -1448,7 +1448,7 @@ function enforceBaseGuard(clusters, candidateEdges, baseIds) {
|
|
|
1448
1448
|
);
|
|
1449
1449
|
}
|
|
1450
1450
|
result.sort(
|
|
1451
|
-
(left, right) =>
|
|
1451
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
1452
1452
|
chunkBXHAPCQG_cjs.requireDefined(left.members[0]),
|
|
1453
1453
|
chunkBXHAPCQG_cjs.requireDefined(right.members[0])
|
|
1454
1454
|
)
|
|
@@ -1457,7 +1457,7 @@ function enforceBaseGuard(clusters, candidateEdges, baseIds) {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
function decisiveEdgesForCluster(cluster, survivingEdges) {
|
|
1459
1459
|
const members = new Set(cluster.members);
|
|
1460
|
-
const forest = new UnionFind(
|
|
1460
|
+
const forest = new UnionFind(chunkBZ5EXHZX_cjs.compareMergeKeys);
|
|
1461
1461
|
for (const member of cluster.members) forest.add(member);
|
|
1462
1462
|
const decisive = [];
|
|
1463
1463
|
for (const edge of internalEdges(cluster.members, survivingEdges)) {
|
|
@@ -1498,7 +1498,7 @@ function groupByEntity(items, entityOf) {
|
|
|
1498
1498
|
const grouped = /* @__PURE__ */ new Map();
|
|
1499
1499
|
for (const item of items) {
|
|
1500
1500
|
const entity = entityOf(item);
|
|
1501
|
-
const key =
|
|
1501
|
+
const key = chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.id);
|
|
1502
1502
|
const bucket = grouped.get(key);
|
|
1503
1503
|
if (bucket === void 0) {
|
|
1504
1504
|
grouped.set(key, [item]);
|
|
@@ -1666,13 +1666,13 @@ function threeWayMergeProps(entityId, kind, baseProps, contributions, context, b
|
|
|
1666
1666
|
}
|
|
1667
1667
|
for (const property of [...propertyNames].sort(chunkDUN24DFZ_cjs.compareStrings)) {
|
|
1668
1668
|
const baseHas = chunkBXHAPCQG_cjs.hasOwnKey(baseProps, property);
|
|
1669
|
-
const baseKey = baseHas ?
|
|
1669
|
+
const baseKey = baseHas ? chunkBZ5EXHZX_cjs.canonicalValueKey(chunkBXHAPCQG_cjs.requireDefined(baseProps[property])) : void 0;
|
|
1670
1670
|
const changed = contributions.filter((contribution) => {
|
|
1671
1671
|
if (!chunkBXHAPCQG_cjs.hasOwnKey(contribution.forkProps, property)) {
|
|
1672
1672
|
return false;
|
|
1673
1673
|
}
|
|
1674
1674
|
const value2 = contribution.forkProps[property];
|
|
1675
|
-
return !baseHas ||
|
|
1675
|
+
return !baseHas || chunkBZ5EXHZX_cjs.canonicalValueKey(value2) !== baseKey;
|
|
1676
1676
|
}).map((contribution) => ({
|
|
1677
1677
|
branchId: contribution.branchId,
|
|
1678
1678
|
props: contribution.forkProps
|
|
@@ -1688,7 +1688,7 @@ function threeWayMergeProps(entityId, kind, baseProps, contributions, context, b
|
|
|
1688
1688
|
continue;
|
|
1689
1689
|
}
|
|
1690
1690
|
const distinctValues = new Set(
|
|
1691
|
-
values.map((candidate) =>
|
|
1691
|
+
values.map((candidate) => chunkBZ5EXHZX_cjs.canonicalValueKey(candidate.value))
|
|
1692
1692
|
);
|
|
1693
1693
|
if (distinctValues.size === 1) {
|
|
1694
1694
|
merged[property] = chunkBXHAPCQG_cjs.requireDefined(values[0]).value;
|
|
@@ -1799,7 +1799,7 @@ function classifyDelta(base, fork) {
|
|
|
1799
1799
|
function resolvePopulation(entity, deltas, deletions, preferredBranchId, dropItem) {
|
|
1800
1800
|
const byIdentity = /* @__PURE__ */ new Map();
|
|
1801
1801
|
for (const delta of deltas) {
|
|
1802
|
-
const identity =
|
|
1802
|
+
const identity = chunkBZ5EXHZX_cjs.mergeKey(delta.kind, delta.id);
|
|
1803
1803
|
if (deletions.has(identity)) {
|
|
1804
1804
|
continue;
|
|
1805
1805
|
}
|
|
@@ -1844,7 +1844,7 @@ function resolvePopulation(entity, deltas, deletions, preferredBranchId, dropIte
|
|
|
1844
1844
|
id: first.id,
|
|
1845
1845
|
...targetEnd.kind === "set" ? { validTo: targetEnd.validTo } : { clearValidTo: true },
|
|
1846
1846
|
claimedBy: claimingBranches(claims),
|
|
1847
|
-
precedence:
|
|
1847
|
+
precedence: chunkBZ5EXHZX_cjs.VALIDITY_END_TARGET_PRECEDENCE
|
|
1848
1848
|
});
|
|
1849
1849
|
}
|
|
1850
1850
|
continue;
|
|
@@ -1872,9 +1872,9 @@ function resolvePopulation(entity, deltas, deletions, preferredBranchId, dropIte
|
|
|
1872
1872
|
ends,
|
|
1873
1873
|
credits,
|
|
1874
1874
|
resolutions: resolutions.sort(
|
|
1875
|
-
(left, right) =>
|
|
1876
|
-
|
|
1877
|
-
|
|
1875
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
1876
|
+
chunkBZ5EXHZX_cjs.mergeKey(left.kind, left.id),
|
|
1877
|
+
chunkBZ5EXHZX_cjs.mergeKey(right.kind, right.id)
|
|
1878
1878
|
)
|
|
1879
1879
|
),
|
|
1880
1880
|
dropped: dropped.sort((left, right) => chunkDUN24DFZ_cjs.compareStrings(left.id, right.id))
|
|
@@ -1943,7 +1943,7 @@ function repoint(key, canonicalOf) {
|
|
|
1943
1943
|
return canonicalOf.get(key) ?? key;
|
|
1944
1944
|
}
|
|
1945
1945
|
function dedupeKey(fromKey, type, toKey, props) {
|
|
1946
|
-
return JSON.stringify([fromKey, type, toKey,
|
|
1946
|
+
return JSON.stringify([fromKey, type, toKey, chunkBZ5EXHZX_cjs.canonicalizeProps(props)]);
|
|
1947
1947
|
}
|
|
1948
1948
|
function groupKey(fromKey, type, toKey) {
|
|
1949
1949
|
return JSON.stringify([fromKey, type, toKey]);
|
|
@@ -2028,14 +2028,14 @@ function authoredProperty(edge, property) {
|
|
|
2028
2028
|
if (baseProps === void 0 || !chunkBXHAPCQG_cjs.hasOwnKey(baseProps, property)) {
|
|
2029
2029
|
return true;
|
|
2030
2030
|
}
|
|
2031
|
-
return
|
|
2031
|
+
return chunkBZ5EXHZX_cjs.canonicalValueKey(props[property]) !== chunkBZ5EXHZX_cjs.canonicalValueKey(baseProps[property]);
|
|
2032
2032
|
}
|
|
2033
2033
|
function unauthoredValue(property, edges) {
|
|
2034
2034
|
const carriers = edges.filter((edge) => chunkBXHAPCQG_cjs.hasOwnKey(edge.staged.props, property)).sort((left, right) => {
|
|
2035
2035
|
const byId = chunkDUN24DFZ_cjs.compareStrings(left.staged.id, right.staged.id);
|
|
2036
2036
|
return byId === 0 ? chunkDUN24DFZ_cjs.compareStrings(
|
|
2037
|
-
|
|
2038
|
-
|
|
2037
|
+
chunkBZ5EXHZX_cjs.canonicalValueKey(left.staged.props[property]),
|
|
2038
|
+
chunkBZ5EXHZX_cjs.canonicalValueKey(right.staged.props[property])
|
|
2039
2039
|
) : byId;
|
|
2040
2040
|
});
|
|
2041
2041
|
return chunkBXHAPCQG_cjs.requireDefined(carriers[0]).staged.props[property];
|
|
@@ -2084,10 +2084,10 @@ function foldEdgeSet(foldSet, context, branchRank, preferredBranchId) {
|
|
|
2084
2084
|
const survivor = pickSurvivor(foldSet, preferredBranchId);
|
|
2085
2085
|
const survivorId = survivor.staged.id;
|
|
2086
2086
|
const mergedIds = foldSet.map((edge) => edge.staged.id).sort((left, right) => chunkDUN24DFZ_cjs.compareStrings(left, right));
|
|
2087
|
-
const fromId =
|
|
2088
|
-
const fromKind =
|
|
2089
|
-
const toId =
|
|
2090
|
-
const toKind =
|
|
2087
|
+
const fromId = chunkBZ5EXHZX_cjs.idOf(survivor.fromKey);
|
|
2088
|
+
const fromKind = chunkBZ5EXHZX_cjs.kindOf(survivor.fromKey);
|
|
2089
|
+
const toId = chunkBZ5EXHZX_cjs.idOf(survivor.toKey);
|
|
2090
|
+
const toKind = chunkBZ5EXHZX_cjs.kindOf(survivor.toKey);
|
|
2091
2091
|
const preferredSurvivorEnd = survivor.staged.branchId === preferredBranchId ? typeof survivor.staged.validTo === "string" ? { kind: "set", validTo: survivor.staged.validTo } : survivor.staged.clearValidTo === true ? { kind: "clear" } : void 0 : void 0;
|
|
2092
2092
|
const foldedEnd = preferredSurvivorEnd ?? resolveEndClaims(
|
|
2093
2093
|
foldSet.filter(
|
|
@@ -2147,8 +2147,8 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
2147
2147
|
const dropped = [];
|
|
2148
2148
|
const liveByGroup = /* @__PURE__ */ new Map();
|
|
2149
2149
|
for (const staged of stagedEdges) {
|
|
2150
|
-
const sourceFromKey =
|
|
2151
|
-
const sourceToKey =
|
|
2150
|
+
const sourceFromKey = chunkBZ5EXHZX_cjs.mergeKey(staged.fromKind, staged.fromId);
|
|
2151
|
+
const sourceToKey = chunkBZ5EXHZX_cjs.mergeKey(staged.toKind, staged.toId);
|
|
2152
2152
|
const fromKey = repoint(sourceFromKey, canonicalOf);
|
|
2153
2153
|
const toKey = repoint(sourceToKey, canonicalOf);
|
|
2154
2154
|
if (deletedNodeIds.has(fromKey) || deletedNodeIds.has(toKey)) {
|
|
@@ -2202,9 +2202,9 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
2202
2202
|
edge,
|
|
2203
2203
|
sortKey: JSON.stringify([
|
|
2204
2204
|
dedupeKey(
|
|
2205
|
-
|
|
2205
|
+
chunkBZ5EXHZX_cjs.mergeKey(edge.fromKind, edge.fromId),
|
|
2206
2206
|
edge.kind,
|
|
2207
|
-
|
|
2207
|
+
chunkBZ5EXHZX_cjs.mergeKey(edge.toKind, edge.toId),
|
|
2208
2208
|
edge.props
|
|
2209
2209
|
),
|
|
2210
2210
|
edge.id
|
|
@@ -3148,7 +3148,7 @@ async function openProvenanceStore(...args) {
|
|
|
3148
3148
|
throw provenanceGraphIdCollision(graph.id, targetGraphId, claim.reason);
|
|
3149
3149
|
}
|
|
3150
3150
|
}
|
|
3151
|
-
const [store] = await
|
|
3151
|
+
const [store] = await chunkMPCF5XBW_cjs.createStoreWithSchema(graph, backend);
|
|
3152
3152
|
return store;
|
|
3153
3153
|
}
|
|
3154
3154
|
async function claimSidecarOwnership(backend, graph, targetGraphId) {
|
|
@@ -3292,7 +3292,7 @@ function provenanceClaimUnfenced(graphId, targetGraphId) {
|
|
|
3292
3292
|
function isOwnedMarkerRow(row, targetGraphId) {
|
|
3293
3293
|
if (row.id !== PROVENANCE_OWNER_ID) return false;
|
|
3294
3294
|
if (row.deleted_at !== void 0) return false;
|
|
3295
|
-
const parsed = ProvenanceOwner.schema.safeParse(
|
|
3295
|
+
const parsed = ProvenanceOwner.schema.safeParse(chunkBZ5EXHZX_cjs.parseRowProps(row.props));
|
|
3296
3296
|
return parsed.success && parsed.data.targetGraphId === targetGraphId;
|
|
3297
3297
|
}
|
|
3298
3298
|
async function inspectOwnerMarker(port, graphId, targetGraphId) {
|
|
@@ -3386,7 +3386,7 @@ async function inspectSidecarContents(port, graphId, targetGraphId) {
|
|
|
3386
3386
|
}
|
|
3387
3387
|
async function isOwnedProvenanceRow(row, targetGraphId) {
|
|
3388
3388
|
if (row.deleted_at !== void 0) return false;
|
|
3389
|
-
const parsed = Provenance.schema.safeParse(
|
|
3389
|
+
const parsed = Provenance.schema.safeParse(chunkBZ5EXHZX_cjs.parseRowProps(row.props));
|
|
3390
3390
|
if (!parsed.success || parsed.data.targetGraphId !== targetGraphId) {
|
|
3391
3391
|
return false;
|
|
3392
3392
|
}
|
|
@@ -3394,7 +3394,7 @@ async function isOwnedProvenanceRow(row, targetGraphId) {
|
|
|
3394
3394
|
role: parsed.data.role,
|
|
3395
3395
|
canonicalId: parsed.data.canonicalId,
|
|
3396
3396
|
canonicalKind: parsed.data.canonicalKind,
|
|
3397
|
-
branchId:
|
|
3397
|
+
branchId: chunkBZ5EXHZX_cjs.asBranchId(parsed.data.branchId),
|
|
3398
3398
|
sourceId: parsed.data.sourceId
|
|
3399
3399
|
});
|
|
3400
3400
|
return row.id === expectedId;
|
|
@@ -3459,9 +3459,9 @@ async function readProvenance(store, query = {}) {
|
|
|
3459
3459
|
|
|
3460
3460
|
// src/graph-merge/sources.ts
|
|
3461
3461
|
function orderEndpoints(left, right, sources) {
|
|
3462
|
-
const leftKey =
|
|
3463
|
-
const rightKey =
|
|
3464
|
-
return
|
|
3462
|
+
const leftKey = chunkBZ5EXHZX_cjs.mergeKeyOf(left);
|
|
3463
|
+
const rightKey = chunkBZ5EXHZX_cjs.mergeKeyOf(right);
|
|
3464
|
+
return chunkBZ5EXHZX_cjs.compareMergeKeys(leftKey, rightKey) <= 0 ? { a: leftKey, b: rightKey, left, right, sources } : { a: rightKey, b: leftKey, left: right, right: left, sources };
|
|
3465
3465
|
}
|
|
3466
3466
|
function sortMembersById(members) {
|
|
3467
3467
|
return [...members].sort((left, right) => chunkDUN24DFZ_cjs.compareStrings(left.id, right.id));
|
|
@@ -3560,7 +3560,7 @@ function forcedEdgesFromBlocks(blocks) {
|
|
|
3560
3560
|
const members = sortMembersById(blocks.get(bucketKey) ?? []);
|
|
3561
3561
|
const constraintName = uniqueConstraintNameForBucket(bucketKey);
|
|
3562
3562
|
if (constraintName === void 0) {
|
|
3563
|
-
throw new
|
|
3563
|
+
throw new chunkBZ5EXHZX_cjs.CandidateSourceError(
|
|
3564
3564
|
"Unique candidate bucket has no constraint name.",
|
|
3565
3565
|
{
|
|
3566
3566
|
details: {
|
|
@@ -3597,7 +3597,7 @@ function forcedEdgesFromBlocks(blocks) {
|
|
|
3597
3597
|
function ontologyRetypeEdges(stagedIdentities, isRetypeCompatible) {
|
|
3598
3598
|
const identitiesById = /* @__PURE__ */ new Map();
|
|
3599
3599
|
for (const identity of stagedIdentities) {
|
|
3600
|
-
const id =
|
|
3600
|
+
const id = chunkBZ5EXHZX_cjs.idOf(identity);
|
|
3601
3601
|
const bucket = identitiesById.get(id);
|
|
3602
3602
|
if (bucket === void 0) {
|
|
3603
3603
|
identitiesById.set(id, [identity]);
|
|
@@ -3608,14 +3608,14 @@ function ontologyRetypeEdges(stagedIdentities, isRetypeCompatible) {
|
|
|
3608
3608
|
const edges = [];
|
|
3609
3609
|
for (const id of [...identitiesById.keys()].sort(chunkDUN24DFZ_cjs.compareStrings)) {
|
|
3610
3610
|
const identities = [...new Set(identitiesById.get(id))].sort(
|
|
3611
|
-
|
|
3611
|
+
chunkBZ5EXHZX_cjs.compareMergeKeys
|
|
3612
3612
|
);
|
|
3613
3613
|
if (identities.length < 2) {
|
|
3614
3614
|
continue;
|
|
3615
3615
|
}
|
|
3616
3616
|
const group = unionByCompatibility(identities, isRetypeCompatible);
|
|
3617
3617
|
for (const members of groupsOf(identities, group)) {
|
|
3618
|
-
if (members.length < 2 || !isRetypeCompatible(members.map((identity) =>
|
|
3618
|
+
if (members.length < 2 || !isRetypeCompatible(members.map((identity) => chunkBZ5EXHZX_cjs.kindOf(identity)))) {
|
|
3619
3619
|
continue;
|
|
3620
3620
|
}
|
|
3621
3621
|
for (let index = 1; index < members.length; index += 1) {
|
|
@@ -3636,15 +3636,15 @@ function ontologyRetypeEdges(stagedIdentities, isRetypeCompatible) {
|
|
|
3636
3636
|
return edges;
|
|
3637
3637
|
}
|
|
3638
3638
|
function unionByCompatibility(identities, isRetypeCompatible) {
|
|
3639
|
-
const forest = new UnionFind(
|
|
3639
|
+
const forest = new UnionFind(chunkBZ5EXHZX_cjs.compareMergeKeys);
|
|
3640
3640
|
for (const identity of identities) {
|
|
3641
3641
|
forest.add(identity);
|
|
3642
3642
|
}
|
|
3643
3643
|
for (let index = 0; index < identities.length; index += 1) {
|
|
3644
3644
|
for (let index_ = index + 1; index_ < identities.length; index_ += 1) {
|
|
3645
3645
|
if (isRetypeCompatible([
|
|
3646
|
-
|
|
3647
|
-
|
|
3646
|
+
chunkBZ5EXHZX_cjs.kindOf(chunkBXHAPCQG_cjs.requireDefined(identities[index])),
|
|
3647
|
+
chunkBZ5EXHZX_cjs.kindOf(chunkBXHAPCQG_cjs.requireDefined(identities[index_]))
|
|
3648
3648
|
])) {
|
|
3649
3649
|
forest.union(
|
|
3650
3650
|
chunkBXHAPCQG_cjs.requireDefined(identities[index]),
|
|
@@ -3668,7 +3668,7 @@ function groupsOf(identities, representativeOf) {
|
|
|
3668
3668
|
bucket.push(identity);
|
|
3669
3669
|
}
|
|
3670
3670
|
}
|
|
3671
|
-
return [...byRoot.values()].map((group) => [...group].sort(
|
|
3671
|
+
return [...byRoot.values()].map((group) => [...group].sort(chunkBZ5EXHZX_cjs.compareMergeKeys));
|
|
3672
3672
|
}
|
|
3673
3673
|
var exactKeySource = {
|
|
3674
3674
|
id: "exactKey",
|
|
@@ -3695,7 +3695,7 @@ var baseUniqueSource = {
|
|
|
3695
3695
|
async generate(scope) {
|
|
3696
3696
|
const { kind, nodes, uniqueConstraints, store } = scope;
|
|
3697
3697
|
if (nodes === void 0 || uniqueConstraints === void 0 || store === void 0) {
|
|
3698
|
-
throw new
|
|
3698
|
+
throw new chunkBZ5EXHZX_cjs.CandidateSourceError(
|
|
3699
3699
|
"baseUniqueSource requires nodes, uniqueConstraints, and store in the source scope.",
|
|
3700
3700
|
{
|
|
3701
3701
|
details: {
|
|
@@ -3722,7 +3722,7 @@ var baseUniqueSource = {
|
|
|
3722
3722
|
try {
|
|
3723
3723
|
return await collection.bulkFindByConstraint(constraint.name, items);
|
|
3724
3724
|
} catch (error) {
|
|
3725
|
-
throw new
|
|
3725
|
+
throw new chunkBZ5EXHZX_cjs.CandidateSourceError(
|
|
3726
3726
|
`baseUniqueSource: new-vs-base lookup for constraint "${constraint.name}" on kind "${kind}" failed \u2014 a staged node's props could not be validated against the kind's schema for constraint-key computation.`,
|
|
3727
3727
|
{
|
|
3728
3728
|
details: {
|
|
@@ -3745,8 +3745,8 @@ var baseUniqueSource = {
|
|
|
3745
3745
|
continue;
|
|
3746
3746
|
}
|
|
3747
3747
|
const stagedNode = node;
|
|
3748
|
-
const stagedKey =
|
|
3749
|
-
const baseKey =
|
|
3748
|
+
const stagedKey = chunkBZ5EXHZX_cjs.mergeKey(stagedNode.kind, stagedNode.id);
|
|
3749
|
+
const baseKey = chunkBZ5EXHZX_cjs.mergeKey(base.kind, base.id);
|
|
3750
3750
|
if (!baseMembers.has(baseKey)) {
|
|
3751
3751
|
baseMembers.set(baseKey, {
|
|
3752
3752
|
origin: "base",
|
|
@@ -3760,7 +3760,7 @@ var baseUniqueSource = {
|
|
|
3760
3760
|
if (stagedKey === baseKey) {
|
|
3761
3761
|
continue;
|
|
3762
3762
|
}
|
|
3763
|
-
const { a, b } =
|
|
3763
|
+
const { a, b } = chunkBZ5EXHZX_cjs.compareMergeKeys(stagedKey, baseKey) <= 0 ? { a: stagedKey, b: baseKey } : { a: baseKey, b: stagedKey };
|
|
3764
3764
|
forcedEdges.push({
|
|
3765
3765
|
a,
|
|
3766
3766
|
b,
|
|
@@ -3797,7 +3797,7 @@ var baseKeySource = {
|
|
|
3797
3797
|
return { pairs: [], forcedEdges: [], baseMembers: [] };
|
|
3798
3798
|
}
|
|
3799
3799
|
if (nodes === void 0 || store === void 0) {
|
|
3800
|
-
throw new
|
|
3800
|
+
throw new chunkBZ5EXHZX_cjs.CandidateSourceError(
|
|
3801
3801
|
"baseKeySource requires nodes and store in the source scope.",
|
|
3802
3802
|
{
|
|
3803
3803
|
details: {
|
|
@@ -3818,7 +3818,7 @@ var baseKeySource = {
|
|
|
3818
3818
|
try {
|
|
3819
3819
|
matchesByNode = await collection.bulkFindByIndex(blockIndex, items);
|
|
3820
3820
|
} catch (error) {
|
|
3821
|
-
throw new
|
|
3821
|
+
throw new chunkBZ5EXHZX_cjs.CandidateSourceError(
|
|
3822
3822
|
`baseKeySource: new-vs-base lookup on index "${blockIndex}" for kind "${kind}" failed \u2014 the index is undeclared or a staged node's props are incompatible with its indexed fields.`,
|
|
3823
3823
|
{
|
|
3824
3824
|
details: {
|
|
@@ -3835,9 +3835,9 @@ var baseKeySource = {
|
|
|
3835
3835
|
const baseMembers = /* @__PURE__ */ new Map();
|
|
3836
3836
|
for (const [index, node] of nodes.entries()) {
|
|
3837
3837
|
const stagedNode = node;
|
|
3838
|
-
const stagedKey =
|
|
3838
|
+
const stagedKey = chunkBZ5EXHZX_cjs.mergeKey(stagedNode.kind, stagedNode.id);
|
|
3839
3839
|
for (const base of matchesByNode[index] ?? []) {
|
|
3840
|
-
const baseKey =
|
|
3840
|
+
const baseKey = chunkBZ5EXHZX_cjs.mergeKey(base.kind, base.id);
|
|
3841
3841
|
if (!baseMembers.has(baseKey)) {
|
|
3842
3842
|
baseMembers.set(baseKey, {
|
|
3843
3843
|
origin: "base",
|
|
@@ -3911,7 +3911,7 @@ function groupByKind(items) {
|
|
|
3911
3911
|
function dedupeEntityKeys(keys) {
|
|
3912
3912
|
const byMergeKey = /* @__PURE__ */ new Map();
|
|
3913
3913
|
for (const key of keys) {
|
|
3914
|
-
byMergeKey.set(
|
|
3914
|
+
byMergeKey.set(chunkBZ5EXHZX_cjs.mergeKey(key.kind, key.id), key);
|
|
3915
3915
|
}
|
|
3916
3916
|
return [...byMergeKey.values()];
|
|
3917
3917
|
}
|
|
@@ -3929,7 +3929,7 @@ async function branchPruneTo(baseStore, branch2) {
|
|
|
3929
3929
|
);
|
|
3930
3930
|
if (forkDelta?.kind !== "keys") return void 0;
|
|
3931
3931
|
const baseDelta = await safeLineageDelta(
|
|
3932
|
-
() =>
|
|
3932
|
+
() => chunkBZ5EXHZX_cjs.lineageDeltaSinceAnchor(baseStore, branch2.base)
|
|
3933
3933
|
);
|
|
3934
3934
|
if (baseDelta?.kind !== "keys") return void 0;
|
|
3935
3935
|
return {
|
|
@@ -3942,7 +3942,7 @@ async function branchPruneFromRecordedAncestor(branch2) {
|
|
|
3942
3942
|
const forkRevision = branch2.forkRevision;
|
|
3943
3943
|
if (forkRevision === void 0) {
|
|
3944
3944
|
const delta2 = await safeLineageDelta(
|
|
3945
|
-
() =>
|
|
3945
|
+
() => chunkBZ5EXHZX_cjs.lineageDeltaSinceAnchor(branch2.store, branch2.base)
|
|
3946
3946
|
);
|
|
3947
3947
|
return delta2?.kind === "keys" ? delta2 : void 0;
|
|
3948
3948
|
}
|
|
@@ -3981,7 +3981,7 @@ async function stageBranches(baseStore, branches, captureTargetStateFor, baseRea
|
|
|
3981
3981
|
for (const branch2 of branches) {
|
|
3982
3982
|
const branchId = branch2.id;
|
|
3983
3983
|
const pruneTo = explicitPruneTo?.get(branchId) ?? (baseReader === void 0 ? await branchPruneTo(baseStore, branch2) : await branchPruneFromRecordedAncestor(branch2));
|
|
3984
|
-
const diff = await
|
|
3984
|
+
const diff = await chunkBZ5EXHZX_cjs.diffAgainstBase(baseStore, branch2.store, {
|
|
3985
3985
|
captureForkState: branchId === captureTargetStateFor,
|
|
3986
3986
|
pruneTo,
|
|
3987
3987
|
baseReader,
|
|
@@ -4106,7 +4106,7 @@ function reconcileTypes(clusters, closure, mode) {
|
|
|
4106
4106
|
if (kinds.length <= 1) {
|
|
4107
4107
|
continue;
|
|
4108
4108
|
}
|
|
4109
|
-
const entityId =
|
|
4109
|
+
const entityId = chunkBZ5EXHZX_cjs.idOf(cluster.canonicalId);
|
|
4110
4110
|
const toType = mostSpecificCommonKind(closure, kinds);
|
|
4111
4111
|
if (toType === void 0) {
|
|
4112
4112
|
dropped.push({
|
|
@@ -4154,7 +4154,7 @@ async function lockMergeTargetWrite(txBackend, input) {
|
|
|
4154
4154
|
lock.coordination
|
|
4155
4155
|
);
|
|
4156
4156
|
if (isolation !== "read_committed") {
|
|
4157
|
-
throw new
|
|
4157
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
4158
4158
|
"Composed merge application requires observed read-committed isolation so reads observe the target after acquiring its graph lock.",
|
|
4159
4159
|
{ details: { capability: "mergeCallbackIsolation", isolation } }
|
|
4160
4160
|
);
|
|
@@ -4216,7 +4216,7 @@ async function embedSortedTexts(texts, embedder) {
|
|
|
4216
4216
|
);
|
|
4217
4217
|
const vectors = await embedder(orderedTexts);
|
|
4218
4218
|
if (vectors.length !== orderedTexts.length) {
|
|
4219
|
-
throw new
|
|
4219
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
4220
4220
|
`Embedder returned ${vectors.length} vectors for ${orderedTexts.length} texts; expected exactly one per text.`,
|
|
4221
4221
|
{
|
|
4222
4222
|
details: { texts: orderedTexts.length, vectors: vectors.length },
|
|
@@ -4353,7 +4353,7 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
4353
4353
|
// Total order over the composite `(kind, id)` identity (two same-id/different-kind
|
|
4354
4354
|
// base members would tie under a bare-id compare).
|
|
4355
4355
|
baseMembers: baseMembers.sort(
|
|
4356
|
-
(left, right) =>
|
|
4356
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(chunkBZ5EXHZX_cjs.mergeKeyOf(left), chunkBZ5EXHZX_cjs.mergeKeyOf(right))
|
|
4357
4357
|
),
|
|
4358
4358
|
diagnostics,
|
|
4359
4359
|
diagnosticsTotal
|
|
@@ -4392,7 +4392,7 @@ function indexNewNodesById(staging) {
|
|
|
4392
4392
|
const index = /* @__PURE__ */ new Map();
|
|
4393
4393
|
for (const items of staging.newNodesByKind.values()) {
|
|
4394
4394
|
for (const staged of items) {
|
|
4395
|
-
const key =
|
|
4395
|
+
const key = chunkBZ5EXHZX_cjs.mergeKeyOf(staged.node);
|
|
4396
4396
|
const bucket = index.get(key);
|
|
4397
4397
|
if (bucket === void 0) {
|
|
4398
4398
|
index.set(key, [staged]);
|
|
@@ -4413,7 +4413,7 @@ function buildStagedEdges(staging, modifiedEdges, edgeValidityEnds, edgeDeletion
|
|
|
4413
4413
|
}
|
|
4414
4414
|
}
|
|
4415
4415
|
for (const item of modifiedEdges) {
|
|
4416
|
-
const identity =
|
|
4416
|
+
const identity = chunkBZ5EXHZX_cjs.mergeKeyOf(item.edge);
|
|
4417
4417
|
stagedIdentities.add(identity);
|
|
4418
4418
|
const validToChange = edgeValidityEnds.get(identity);
|
|
4419
4419
|
staged.push({
|
|
@@ -4431,7 +4431,7 @@ function buildStagedEdges(staging, modifiedEdges, edgeValidityEnds, edgeDeletion
|
|
|
4431
4431
|
});
|
|
4432
4432
|
}
|
|
4433
4433
|
for (const item of staging.windowedEdges) {
|
|
4434
|
-
const identity =
|
|
4434
|
+
const identity = chunkBZ5EXHZX_cjs.mergeKeyOf(item.edge);
|
|
4435
4435
|
const validToChange = edgeValidityEnds.get(identity);
|
|
4436
4436
|
if (validToChange === void 0 || stagedIdentities.has(identity) || edgeDeletions.has(identity)) {
|
|
4437
4437
|
continue;
|
|
@@ -4498,7 +4498,7 @@ function buildProvenanceIndex(records) {
|
|
|
4498
4498
|
}
|
|
4499
4499
|
var EMPTY_WEIGHTS = /* @__PURE__ */ new Map();
|
|
4500
4500
|
function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, candidateDiagnostics, candidateDiagnosticsTotal, baseMembers, options, branchRank, subClassClosure, identityContext, storedIdentityRowsById, targetPeers, preferredBranchId) {
|
|
4501
|
-
const identity =
|
|
4501
|
+
const identity = chunkBZ5EXHZX_cjs.planIdentityChanges(staging, storedIdentityRowsById);
|
|
4502
4502
|
const provenanceRecords = [];
|
|
4503
4503
|
const recordedContributions = /* @__PURE__ */ new Set();
|
|
4504
4504
|
const weights = options.provenanceWeights ?? EMPTY_WEIGHTS;
|
|
@@ -4528,7 +4528,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4528
4528
|
}
|
|
4529
4529
|
const baseMembersById = /* @__PURE__ */ new Map();
|
|
4530
4530
|
for (const member of baseMembers) {
|
|
4531
|
-
const key =
|
|
4531
|
+
const key = chunkBZ5EXHZX_cjs.mergeKeyOf(member);
|
|
4532
4532
|
if (acceptedEndpointKeys.has(key) || newNodesById.has(key)) {
|
|
4533
4533
|
baseMembersById.set(key, member);
|
|
4534
4534
|
}
|
|
@@ -4576,8 +4576,8 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4576
4576
|
const diagnosticsWithDisposition = candidateDiagnostics.map((diagnostic) => {
|
|
4577
4577
|
if (diagnostic.evidence.decision === "definitional") return diagnostic;
|
|
4578
4578
|
if (diagnostic.scoreDecision === "rejected") return diagnostic;
|
|
4579
|
-
const a =
|
|
4580
|
-
const b =
|
|
4579
|
+
const a = chunkBZ5EXHZX_cjs.mergeKey(diagnostic.evidence.a.kind, diagnostic.evidence.a.id);
|
|
4580
|
+
const b = chunkBZ5EXHZX_cjs.mergeKey(diagnostic.evidence.b.kind, diagnostic.evidence.b.id);
|
|
4581
4581
|
const reason = excludedByEndpoints.get(JSON.stringify([a, b]));
|
|
4582
4582
|
return {
|
|
4583
4583
|
...diagnostic,
|
|
@@ -4600,10 +4600,10 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4600
4600
|
...definitionalExclusions
|
|
4601
4601
|
].sort((left, right) => compareMatchEvidence(left.evidence, right.evidence));
|
|
4602
4602
|
const baseAmbiguities = guard.events.map((event) => ({
|
|
4603
|
-
baseIds: event.baseIds.map((key) => ({ kind:
|
|
4603
|
+
baseIds: event.baseIds.map((key) => ({ kind: chunkBZ5EXHZX_cjs.kindOf(key), id: chunkBZ5EXHZX_cjs.idOf(key) })),
|
|
4604
4604
|
memberIds: event.memberIds.map((key) => ({
|
|
4605
|
-
kind:
|
|
4606
|
-
id:
|
|
4605
|
+
kind: chunkBZ5EXHZX_cjs.kindOf(key),
|
|
4606
|
+
id: chunkBZ5EXHZX_cjs.idOf(key)
|
|
4607
4607
|
}))
|
|
4608
4608
|
}));
|
|
4609
4609
|
const canonicalEntities = [];
|
|
@@ -4629,15 +4629,15 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4629
4629
|
);
|
|
4630
4630
|
canonicalEntities.push(entity);
|
|
4631
4631
|
clusterByCanonicalIdentity.set(
|
|
4632
|
-
|
|
4632
|
+
chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.canonicalId),
|
|
4633
4633
|
cluster
|
|
4634
4634
|
);
|
|
4635
4635
|
reconcileInputs.push({
|
|
4636
|
-
canonicalId:
|
|
4636
|
+
canonicalId: chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.canonicalId),
|
|
4637
4637
|
memberKinds: members.map((member) => member.kind)
|
|
4638
4638
|
});
|
|
4639
4639
|
const distinctMergedIds = new Set(
|
|
4640
|
-
cluster.members.map((member) =>
|
|
4640
|
+
cluster.members.map((member) => chunkBZ5EXHZX_cjs.idOf(member))
|
|
4641
4641
|
);
|
|
4642
4642
|
if (distinctMergedIds.size > 1) {
|
|
4643
4643
|
resolutions.push({
|
|
@@ -4666,10 +4666,10 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4666
4666
|
);
|
|
4667
4667
|
const nodeDeletions = /* @__PURE__ */ new Map();
|
|
4668
4668
|
for (const deletion of deleteModify.nodeDeletions) {
|
|
4669
|
-
nodeDeletions.set(
|
|
4669
|
+
nodeDeletions.set(chunkBZ5EXHZX_cjs.mergeKey(deletion.kind, deletion.id), deletion.kind);
|
|
4670
4670
|
}
|
|
4671
4671
|
const anyDeletionOverruled = staging.deletedNodes.some(
|
|
4672
|
-
(deletion) => !nodeDeletions.has(
|
|
4672
|
+
(deletion) => !nodeDeletions.has(chunkBZ5EXHZX_cjs.mergeKey(deletion.node.kind, deletion.node.id))
|
|
4673
4673
|
);
|
|
4674
4674
|
const stagedRetractionsById = /* @__PURE__ */ new Map();
|
|
4675
4675
|
for (const staged of staging.retractedIdentityAssertions) {
|
|
@@ -4682,7 +4682,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4682
4682
|
const contributions = stagedRetractionsById.get(retraction.id) ?? [];
|
|
4683
4683
|
const everyContributionOverruled = contributions.length > 0 && contributions.every(
|
|
4684
4684
|
(staged) => staged.cause.kind === "cascade" && !nodeDeletions.has(
|
|
4685
|
-
|
|
4685
|
+
chunkBZ5EXHZX_cjs.mergeKey(
|
|
4686
4686
|
staged.cause.deletedNode.kind,
|
|
4687
4687
|
staged.cause.deletedNode.id
|
|
4688
4688
|
)
|
|
@@ -4692,7 +4692,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4692
4692
|
overruledRetractionDrops.push({
|
|
4693
4693
|
kind: "identity",
|
|
4694
4694
|
id: retraction.id,
|
|
4695
|
-
reason:
|
|
4695
|
+
reason: chunkBZ5EXHZX_cjs.RETRACTION_DELETION_OVERRULED_DROP_REASON
|
|
4696
4696
|
});
|
|
4697
4697
|
return false;
|
|
4698
4698
|
}) : identity.retractions;
|
|
@@ -4723,7 +4723,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4723
4723
|
);
|
|
4724
4724
|
const edgeDeletions = /* @__PURE__ */ new Map();
|
|
4725
4725
|
for (const deletion of edgeDeleteModify.edgeDeletions) {
|
|
4726
|
-
edgeDeletions.set(
|
|
4726
|
+
edgeDeletions.set(chunkBZ5EXHZX_cjs.mergeKey(deletion.kind, deletion.id), deletion.kind);
|
|
4727
4727
|
}
|
|
4728
4728
|
for (const modification of edgeDeleteModify.survivingModifications) {
|
|
4729
4729
|
recordProvenance(
|
|
@@ -4755,7 +4755,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4755
4755
|
if (record.role !== "node" || record.sourceId !== record.canonicalId) {
|
|
4756
4756
|
continue;
|
|
4757
4757
|
}
|
|
4758
|
-
const identity2 =
|
|
4758
|
+
const identity2 = chunkBZ5EXHZX_cjs.mergeKey(record.canonicalKind, record.canonicalId);
|
|
4759
4759
|
const credited = creditedNodeIdentities.get(identity2) ?? /* @__PURE__ */ new Set();
|
|
4760
4760
|
credited.add(record.branchId);
|
|
4761
4761
|
creditedNodeIdentities.set(identity2, credited);
|
|
@@ -4765,8 +4765,8 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4765
4765
|
if (creditedNodeIdentities.get(identity2)?.has(branchId) === true) {
|
|
4766
4766
|
continue;
|
|
4767
4767
|
}
|
|
4768
|
-
const id =
|
|
4769
|
-
recordProvenance("node", branchId, id,
|
|
4768
|
+
const id = chunkBZ5EXHZX_cjs.idOf(identity2);
|
|
4769
|
+
recordProvenance("node", branchId, id, chunkBZ5EXHZX_cjs.kindOf(identity2), id);
|
|
4770
4770
|
}
|
|
4771
4771
|
}
|
|
4772
4772
|
const reconciliation = reconcileTypes(
|
|
@@ -4776,7 +4776,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4776
4776
|
);
|
|
4777
4777
|
const reconciledClusterByEntityId = /* @__PURE__ */ new Map();
|
|
4778
4778
|
for (const identity2 of reconciliation.retypeMap.keys()) {
|
|
4779
|
-
const entityId =
|
|
4779
|
+
const entityId = chunkBZ5EXHZX_cjs.idOf(identity2);
|
|
4780
4780
|
const cluster = clusterByCanonicalIdentity.get(identity2);
|
|
4781
4781
|
if (cluster !== void 0 && !reconciledClusterByEntityId.has(entityId)) {
|
|
4782
4782
|
reconciledClusterByEntityId.set(entityId, cluster);
|
|
@@ -4791,7 +4791,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4791
4791
|
});
|
|
4792
4792
|
const entityByIdentity = /* @__PURE__ */ new Map();
|
|
4793
4793
|
for (const entity of canonicalEntities) {
|
|
4794
|
-
entityByIdentity.set(
|
|
4794
|
+
entityByIdentity.set(chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.canonicalId), entity);
|
|
4795
4795
|
}
|
|
4796
4796
|
const canonicalOf = buildCanonicalMap(
|
|
4797
4797
|
clusters,
|
|
@@ -4802,39 +4802,39 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4802
4802
|
if (entity.endpointValidFrom === void 0 && entity.endpointValidTo === void 0) {
|
|
4803
4803
|
continue;
|
|
4804
4804
|
}
|
|
4805
|
-
const sourceKey2 =
|
|
4805
|
+
const sourceKey2 = chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.canonicalId);
|
|
4806
4806
|
const finalKind = reconciliation.retypeMap.get(sourceKey2) ?? entity.kind;
|
|
4807
|
-
canonicalEndpointWindows.set(
|
|
4807
|
+
canonicalEndpointWindows.set(chunkBZ5EXHZX_cjs.mergeKey(finalKind, entity.canonicalId), {
|
|
4808
4808
|
...entity.endpointValidFrom === void 0 ? {} : { validFrom: entity.endpointValidFrom },
|
|
4809
4809
|
...entity.endpointValidTo === void 0 ? {} : { validTo: entity.endpointValidTo }
|
|
4810
4810
|
});
|
|
4811
4811
|
}
|
|
4812
|
-
const identityRemap =
|
|
4812
|
+
const identityRemap = chunkBZ5EXHZX_cjs.remapIdentityAssertionEndpoints(
|
|
4813
4813
|
identity.assertions,
|
|
4814
4814
|
canonicalOf,
|
|
4815
4815
|
reconciliation.retypeMap,
|
|
4816
4816
|
storedIdentityRowsById,
|
|
4817
4817
|
canonicalEndpointWindows
|
|
4818
4818
|
);
|
|
4819
|
-
|
|
4819
|
+
chunkBZ5EXHZX_cjs.assertIdentityEndpointsNotDeleted(
|
|
4820
4820
|
identityRemap.assertions,
|
|
4821
4821
|
nodeDeletions,
|
|
4822
4822
|
reconciliation.retypeMap
|
|
4823
4823
|
);
|
|
4824
4824
|
const identityNodeUniverse = [
|
|
4825
4825
|
...canonicalEntities.filter(
|
|
4826
|
-
(entity) => !nodeDeletions.has(
|
|
4826
|
+
(entity) => !nodeDeletions.has(chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.canonicalId))
|
|
4827
4827
|
).map((entity) => ({
|
|
4828
4828
|
kind: reconciliation.retypeMap.get(
|
|
4829
|
-
|
|
4829
|
+
chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.canonicalId)
|
|
4830
4830
|
) ?? entity.kind,
|
|
4831
4831
|
id: entity.canonicalId
|
|
4832
4832
|
})),
|
|
4833
4833
|
...targetPeers.filter(
|
|
4834
|
-
(node) => !nodeDeletions.has(
|
|
4834
|
+
(node) => !nodeDeletions.has(chunkBZ5EXHZX_cjs.mergeKey(node.kind, node.id))
|
|
4835
4835
|
)
|
|
4836
4836
|
];
|
|
4837
|
-
|
|
4837
|
+
chunkBZ5EXHZX_cjs.assertNoContradictoryIdentityClosure(
|
|
4838
4838
|
identityRemap.assertions,
|
|
4839
4839
|
survivingRetractions.map((retraction) => retraction.id),
|
|
4840
4840
|
staging.baseIdentityAssertions,
|
|
@@ -4852,7 +4852,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4852
4852
|
);
|
|
4853
4853
|
const stagedEdgeBranches = /* @__PURE__ */ new Map();
|
|
4854
4854
|
for (const staged of stagedEdges) {
|
|
4855
|
-
const identity2 =
|
|
4855
|
+
const identity2 = chunkBZ5EXHZX_cjs.mergeKeyOf(staged);
|
|
4856
4856
|
const branches = stagedEdgeBranches.get(staged.id) ?? /* @__PURE__ */ new Set();
|
|
4857
4857
|
if (!windowOnlyCarried.has(identity2)) {
|
|
4858
4858
|
branches.add(staged.branchId);
|
|
@@ -4915,16 +4915,16 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4915
4915
|
// returned order would depend on stable-sort + insertion order and break the
|
|
4916
4916
|
// order-independence the whole subsystem guarantees.
|
|
4917
4917
|
resolutions: resolutions.sort(
|
|
4918
|
-
(left, right) =>
|
|
4919
|
-
|
|
4920
|
-
|
|
4918
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
4919
|
+
chunkBZ5EXHZX_cjs.mergeKey(left.kind, left.canonicalId),
|
|
4920
|
+
chunkBZ5EXHZX_cjs.mergeKey(right.kind, right.canonicalId)
|
|
4921
4921
|
)
|
|
4922
4922
|
),
|
|
4923
4923
|
propertyConflicts: [...propertyConflicts, ...repoint2.conflicts].sort(
|
|
4924
4924
|
(left, right) => {
|
|
4925
|
-
const byEntity =
|
|
4926
|
-
|
|
4927
|
-
|
|
4925
|
+
const byEntity = chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
4926
|
+
chunkBZ5EXHZX_cjs.mergeKey(left.kind, left.entityId),
|
|
4927
|
+
chunkBZ5EXHZX_cjs.mergeKey(right.kind, right.entityId)
|
|
4928
4928
|
);
|
|
4929
4929
|
return byEntity === 0 ? chunkDUN24DFZ_cjs.compareStrings(left.property, right.property) : byEntity;
|
|
4930
4930
|
}
|
|
@@ -4933,20 +4933,20 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
4933
4933
|
...deleteModify.conflicts,
|
|
4934
4934
|
...edgeDeleteModify.conflicts
|
|
4935
4935
|
].sort(
|
|
4936
|
-
(left, right) =>
|
|
4937
|
-
|
|
4938
|
-
|
|
4936
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
4937
|
+
chunkBZ5EXHZX_cjs.mergeKey(left.kind, left.entityId),
|
|
4938
|
+
chunkBZ5EXHZX_cjs.mergeKey(right.kind, right.entityId)
|
|
4939
4939
|
)
|
|
4940
4940
|
),
|
|
4941
4941
|
typeReconciliations,
|
|
4942
4942
|
dropped,
|
|
4943
4943
|
baseAmbiguities: baseAmbiguities.sort(
|
|
4944
|
-
(left, right) =>
|
|
4945
|
-
|
|
4944
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(
|
|
4945
|
+
chunkBZ5EXHZX_cjs.mergeKey(
|
|
4946
4946
|
chunkBXHAPCQG_cjs.requireDefined(left.baseIds[0]).kind,
|
|
4947
4947
|
chunkBXHAPCQG_cjs.requireDefined(left.baseIds[0]).id
|
|
4948
4948
|
),
|
|
4949
|
-
|
|
4949
|
+
chunkBZ5EXHZX_cjs.mergeKey(
|
|
4950
4950
|
chunkBXHAPCQG_cjs.requireDefined(right.baseIds[0]).kind,
|
|
4951
4951
|
chunkBXHAPCQG_cjs.requireDefined(right.baseIds[0]).id
|
|
4952
4952
|
)
|
|
@@ -4975,9 +4975,9 @@ function pickClusterCanonical(cluster, entityByIdentity) {
|
|
|
4975
4975
|
return member;
|
|
4976
4976
|
}
|
|
4977
4977
|
}
|
|
4978
|
-
throw new
|
|
4978
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
4979
4979
|
"Internal invariant: cluster has no canonical entity in pickClusterCanonical.",
|
|
4980
|
-
{ details: { members: cluster.members.map((member) =>
|
|
4980
|
+
{ details: { members: cluster.members.map((member) => chunkBZ5EXHZX_cjs.idOf(member)) } }
|
|
4981
4981
|
);
|
|
4982
4982
|
}
|
|
4983
4983
|
function commitModificationProps(baseProps, forkProps) {
|
|
@@ -4993,24 +4993,24 @@ function commitModificationProps(baseProps, forkProps) {
|
|
|
4993
4993
|
return props;
|
|
4994
4994
|
}
|
|
4995
4995
|
function finalEdgeEndpoint(plan, kind, id) {
|
|
4996
|
-
return { kind: plan.retypeMap.get(
|
|
4996
|
+
return { kind: plan.retypeMap.get(chunkBZ5EXHZX_cjs.mergeKey(kind, id)) ?? kind, id };
|
|
4997
4997
|
}
|
|
4998
4998
|
function plannedNodeWrites(plan) {
|
|
4999
4999
|
const canonicalIdentities = /* @__PURE__ */ new Set();
|
|
5000
5000
|
for (const entity of plan.canonicalEntities) {
|
|
5001
|
-
canonicalIdentities.add(
|
|
5001
|
+
canonicalIdentities.add(chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.canonicalId));
|
|
5002
5002
|
}
|
|
5003
5003
|
const modificationsByIdentity = /* @__PURE__ */ new Map();
|
|
5004
5004
|
for (const modification of plan.survivingModifications) {
|
|
5005
5005
|
modificationsByIdentity.set(
|
|
5006
|
-
|
|
5006
|
+
chunkBZ5EXHZX_cjs.mergeKeyOf(modification.node),
|
|
5007
5007
|
modification.node
|
|
5008
5008
|
);
|
|
5009
5009
|
}
|
|
5010
5010
|
const writes = [];
|
|
5011
5011
|
const written = /* @__PURE__ */ new Set();
|
|
5012
5012
|
for (const modification of plan.survivingModifications) {
|
|
5013
|
-
const identity =
|
|
5013
|
+
const identity = chunkBZ5EXHZX_cjs.mergeKeyOf(modification.node);
|
|
5014
5014
|
if (plan.nodeDeletions.has(identity) || canonicalIdentities.has(identity)) {
|
|
5015
5015
|
continue;
|
|
5016
5016
|
}
|
|
@@ -5025,7 +5025,7 @@ function plannedNodeWrites(plan) {
|
|
|
5025
5025
|
});
|
|
5026
5026
|
}
|
|
5027
5027
|
for (const entity of plan.canonicalEntities) {
|
|
5028
|
-
const sourceIdentity =
|
|
5028
|
+
const sourceIdentity = chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.canonicalId);
|
|
5029
5029
|
if (plan.nodeDeletions.has(sourceIdentity)) {
|
|
5030
5030
|
continue;
|
|
5031
5031
|
}
|
|
@@ -5034,7 +5034,7 @@ function plannedNodeWrites(plan) {
|
|
|
5034
5034
|
written.add(sourceIdentity);
|
|
5035
5035
|
const validToChange = plan.nodeValidityEnds.get(sourceIdentity);
|
|
5036
5036
|
writes.push({
|
|
5037
|
-
identity:
|
|
5037
|
+
identity: chunkBZ5EXHZX_cjs.mergeKey(kind, entity.canonicalId),
|
|
5038
5038
|
kind,
|
|
5039
5039
|
id: entity.canonicalId,
|
|
5040
5040
|
entity,
|
|
@@ -5044,17 +5044,17 @@ function plannedNodeWrites(plan) {
|
|
|
5044
5044
|
});
|
|
5045
5045
|
}
|
|
5046
5046
|
for (const identity of [...plan.nodeValidityEnds.keys()].sort(
|
|
5047
|
-
(left, right) =>
|
|
5047
|
+
(left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right)
|
|
5048
5048
|
)) {
|
|
5049
5049
|
if (written.has(identity) || plan.nodeDeletions.has(identity)) {
|
|
5050
5050
|
continue;
|
|
5051
5051
|
}
|
|
5052
|
-
const kind = plan.retypeMap.get(identity) ??
|
|
5052
|
+
const kind = plan.retypeMap.get(identity) ?? chunkBZ5EXHZX_cjs.kindOf(identity);
|
|
5053
5053
|
const validToChange = chunkBXHAPCQG_cjs.requireDefined(plan.nodeValidityEnds.get(identity));
|
|
5054
5054
|
writes.push({
|
|
5055
|
-
identity:
|
|
5055
|
+
identity: chunkBZ5EXHZX_cjs.mergeKey(kind, chunkBZ5EXHZX_cjs.idOf(identity)),
|
|
5056
5056
|
kind,
|
|
5057
|
-
id:
|
|
5057
|
+
id: chunkBZ5EXHZX_cjs.idOf(identity),
|
|
5058
5058
|
...validToChange.kind === "set" ? { validTo: validToChange.validTo } : { clearValidTo: true }
|
|
5059
5059
|
});
|
|
5060
5060
|
}
|
|
@@ -5106,7 +5106,7 @@ async function applyNodeRows(target, txBackend, nodesApi, deletions, upserts) {
|
|
|
5106
5106
|
for (const [key, value] of Object.entries(item.props)) {
|
|
5107
5107
|
if (value !== void 0) props[key] = value;
|
|
5108
5108
|
}
|
|
5109
|
-
afterImages.set(
|
|
5109
|
+
afterImages.set(chunkBZ5EXHZX_cjs.mergeKey(kind, item.id), props);
|
|
5110
5110
|
}
|
|
5111
5111
|
}
|
|
5112
5112
|
return chunkQV6LL3PK_cjs.storeRuntime(target).applyResolvedNodeUniqueness(
|
|
@@ -5116,7 +5116,7 @@ async function applyNodeRows(target, txBackend, nodesApi, deletions, upserts) {
|
|
|
5116
5116
|
kind: upsert.kind,
|
|
5117
5117
|
id: upsert.id,
|
|
5118
5118
|
props: chunkBXHAPCQG_cjs.requireDefined(
|
|
5119
|
-
afterImages.get(
|
|
5119
|
+
afterImages.get(chunkBZ5EXHZX_cjs.mergeKey(upsert.kind, upsert.id))
|
|
5120
5120
|
)
|
|
5121
5121
|
})),
|
|
5122
5122
|
releases: deletions
|
|
@@ -5132,7 +5132,7 @@ async function applyNodeRows(target, txBackend, nodesApi, deletions, upserts) {
|
|
|
5132
5132
|
upsert.props,
|
|
5133
5133
|
nodeWriteWindowOptions(upsert)
|
|
5134
5134
|
);
|
|
5135
|
-
committed.add(
|
|
5135
|
+
committed.add(chunkBZ5EXHZX_cjs.mergeKey(upsert.kind, upsert.id));
|
|
5136
5136
|
}
|
|
5137
5137
|
return committed.size;
|
|
5138
5138
|
}
|
|
@@ -5165,13 +5165,13 @@ async function applyIdentityRows(target, txBackend, assertions, retractions, ass
|
|
|
5165
5165
|
if (assertConsistent !== void 0) await assertConsistent();
|
|
5166
5166
|
return { asserted: applied.created, retracted: applied.retracted };
|
|
5167
5167
|
} catch (error) {
|
|
5168
|
-
throw
|
|
5168
|
+
throw chunkBZ5EXHZX_cjs.translateIdentityCommitError(error);
|
|
5169
5169
|
}
|
|
5170
5170
|
}
|
|
5171
5171
|
async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBackend) {
|
|
5172
5172
|
const nodeDeletions = [...plan.nodeDeletions].map(([identity, kind]) => ({
|
|
5173
5173
|
kind,
|
|
5174
|
-
id:
|
|
5174
|
+
id: chunkBZ5EXHZX_cjs.idOf(identity)
|
|
5175
5175
|
}));
|
|
5176
5176
|
const nodeUpserts = plannedNodeWrites(plan).map((write) => ({
|
|
5177
5177
|
kind: write.kind,
|
|
@@ -5184,10 +5184,10 @@ async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBacken
|
|
|
5184
5184
|
...write.clearValidTo === true ? { clearValidTo: true } : write.validTo === void 0 ? {} : { validTo: write.validTo }
|
|
5185
5185
|
}));
|
|
5186
5186
|
const validityEndedNodes = new Set(
|
|
5187
|
-
nodeUpserts.filter((write) => "validTo" in write).map((write) =>
|
|
5187
|
+
nodeUpserts.filter((write) => "validTo" in write).map((write) => chunkBZ5EXHZX_cjs.mergeKey(write.kind, write.id))
|
|
5188
5188
|
);
|
|
5189
5189
|
const earlyIdentityRetractions = plan.identityRetractions.filter(
|
|
5190
|
-
(retraction) => validityEndedNodes.has(
|
|
5190
|
+
(retraction) => validityEndedNodes.has(chunkBZ5EXHZX_cjs.mergeKeyOf(retraction.a)) || validityEndedNodes.has(chunkBZ5EXHZX_cjs.mergeKeyOf(retraction.b))
|
|
5191
5191
|
);
|
|
5192
5192
|
const earlyIdentity = await applyIdentityRows(
|
|
5193
5193
|
target,
|
|
@@ -5205,11 +5205,11 @@ async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBacken
|
|
|
5205
5205
|
nodeUpserts
|
|
5206
5206
|
);
|
|
5207
5207
|
} catch (error) {
|
|
5208
|
-
throw error instanceof chunk7XYPLAPL_cjs.IdentityEndpointValidityError ?
|
|
5208
|
+
throw error instanceof chunk7XYPLAPL_cjs.IdentityEndpointValidityError ? chunkBZ5EXHZX_cjs.translateIdentityCommitError(error) : error;
|
|
5209
5209
|
}
|
|
5210
5210
|
const edgeDeletions = [...plan.edgeDeletions].map(([identity, kind]) => ({
|
|
5211
5211
|
kind,
|
|
5212
|
-
id:
|
|
5212
|
+
id: chunkBZ5EXHZX_cjs.idOf(identity)
|
|
5213
5213
|
}));
|
|
5214
5214
|
const edgeUpserts = [];
|
|
5215
5215
|
for (const edge of plan.mergedEdges) {
|
|
@@ -5237,7 +5237,7 @@ async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBacken
|
|
|
5237
5237
|
txBackend,
|
|
5238
5238
|
plan.identityAssertions,
|
|
5239
5239
|
plan.identityRetractions,
|
|
5240
|
-
() =>
|
|
5240
|
+
() => chunkBZ5EXHZX_cjs.assertMergedIdentityClassesConsistent(target, txBackend, plan)
|
|
5241
5241
|
);
|
|
5242
5242
|
return {
|
|
5243
5243
|
nodes: committedNodes,
|
|
@@ -5256,14 +5256,14 @@ async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBacken
|
|
|
5256
5256
|
}
|
|
5257
5257
|
var MERGE_COMMIT_ATTEMPTS = 3;
|
|
5258
5258
|
async function commitPlan(target, plan, expectedBaseVersion) {
|
|
5259
|
-
if (expectedBaseVersion !== void 0 &&
|
|
5260
|
-
throw new
|
|
5259
|
+
if (expectedBaseVersion !== void 0 && chunkBZ5EXHZX_cjs.engineAnchorOf(expectedBaseVersion) !== void 0) {
|
|
5260
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
5261
5261
|
"Engine-anchored base versions are retired because their lineage delta cannot fence identity-only writes or commit-time graph reads. Re-branch and re-plan using a current base version.",
|
|
5262
5262
|
{ details: { expectedBaseVersion } }
|
|
5263
5263
|
);
|
|
5264
5264
|
}
|
|
5265
5265
|
if (!chunkQV6LL3PK_cjs.storeBackend(target).capabilities.execution.interactiveTransactions) {
|
|
5266
|
-
throw new
|
|
5266
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
5267
5267
|
"merge() requires a transaction-capable target backend. The merged plan (canonical upserts, soft-deletes, edge upserts) must commit atomically; a non-transactional fallback would leave a partially-merged graph on a mid-commit failure. (mergeIncremental() enforces the same requirement.)",
|
|
5268
5268
|
{ details: { capability: "execution.interactiveTransactions" } }
|
|
5269
5269
|
);
|
|
@@ -5283,7 +5283,7 @@ async function commitPlan(target, plan, expectedBaseVersion) {
|
|
|
5283
5283
|
expectedBaseVersion
|
|
5284
5284
|
);
|
|
5285
5285
|
}
|
|
5286
|
-
await
|
|
5286
|
+
await chunkBZ5EXHZX_cjs.assertPlannedIdentityIdsFresh(
|
|
5287
5287
|
target,
|
|
5288
5288
|
chunkQV6LL3PK_cjs.transactionBackend(tx),
|
|
5289
5289
|
plan
|
|
@@ -5303,7 +5303,7 @@ async function runMergeCommit(commit) {
|
|
|
5303
5303
|
try {
|
|
5304
5304
|
return await commit();
|
|
5305
5305
|
} catch (error) {
|
|
5306
|
-
throw
|
|
5306
|
+
throw chunkBZ5EXHZX_cjs.translateMergeCommitError(error);
|
|
5307
5307
|
}
|
|
5308
5308
|
}
|
|
5309
5309
|
var MERGE_COMMIT_TX_OPTIONS = {
|
|
@@ -5313,18 +5313,18 @@ function mergeCommitTransactionOptions(target) {
|
|
|
5313
5313
|
return chunkQV6LL3PK_cjs.storeCaptureEnabled(target) ? void 0 : MERGE_COMMIT_TX_OPTIONS;
|
|
5314
5314
|
}
|
|
5315
5315
|
async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
5316
|
-
if (
|
|
5316
|
+
if (chunkBZ5EXHZX_cjs.hasRevisionAnchor(expectedBaseVersion)) {
|
|
5317
5317
|
await lockMergeTargetWrite(txBackend, {
|
|
5318
5318
|
graphId: target.graphId,
|
|
5319
5319
|
schemaVersion: target.introspect().schemaVersion,
|
|
5320
5320
|
graphLock: "required",
|
|
5321
|
-
staleSchemaError: (cause) => new
|
|
5321
|
+
staleSchemaError: (cause) => new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
5322
5322
|
"The merge target schema changed before the commit transaction; the resolved plan was not applied.",
|
|
5323
5323
|
{ cause }
|
|
5324
5324
|
)
|
|
5325
5325
|
});
|
|
5326
5326
|
}
|
|
5327
|
-
const comparison = await
|
|
5327
|
+
const comparison = await chunkBZ5EXHZX_cjs.compareBaseVersionAtTarget(
|
|
5328
5328
|
target,
|
|
5329
5329
|
txBackend,
|
|
5330
5330
|
expectedBaseVersion
|
|
@@ -5332,7 +5332,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
5332
5332
|
if (comparison.matches) return;
|
|
5333
5333
|
switch (comparison.kind) {
|
|
5334
5334
|
case "schema": {
|
|
5335
|
-
throw new
|
|
5335
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
5336
5336
|
"The merge target schema version changed before the commit transaction; the resolved plan was not applied.",
|
|
5337
5337
|
{
|
|
5338
5338
|
details: {
|
|
@@ -5343,7 +5343,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
5343
5343
|
);
|
|
5344
5344
|
}
|
|
5345
5345
|
case "revision-origin": {
|
|
5346
|
-
throw new
|
|
5346
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
5347
5347
|
"The merge branch was forked from a different revision-tracked store; the resolved plan was not applied.",
|
|
5348
5348
|
{
|
|
5349
5349
|
details: {
|
|
@@ -5355,7 +5355,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
5355
5355
|
);
|
|
5356
5356
|
}
|
|
5357
5357
|
case "revision": {
|
|
5358
|
-
throw new
|
|
5358
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
5359
5359
|
"The merge target was modified between the revision-anchor check and the commit transaction; the resolved plan was not applied.",
|
|
5360
5360
|
{
|
|
5361
5361
|
details: {
|
|
@@ -5367,7 +5367,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
5367
5367
|
);
|
|
5368
5368
|
}
|
|
5369
5369
|
case "content-origin": {
|
|
5370
|
-
throw new
|
|
5370
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
5371
5371
|
"The merge target's durable origin changed before the commit transaction; the resolved plan was not applied.",
|
|
5372
5372
|
{
|
|
5373
5373
|
details: {
|
|
@@ -5378,7 +5378,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
5378
5378
|
);
|
|
5379
5379
|
}
|
|
5380
5380
|
case "content": {
|
|
5381
|
-
throw new
|
|
5381
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
5382
5382
|
"The merge target was modified between the base@V check and the commit transaction; the resolved plan no longer describes the live target and was not applied.",
|
|
5383
5383
|
{
|
|
5384
5384
|
details: {
|
|
@@ -5394,7 +5394,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
5394
5394
|
function nodeCollection(nodes, kind) {
|
|
5395
5395
|
const collection = nodes[kind];
|
|
5396
5396
|
if (collection === void 0) {
|
|
5397
|
-
throw new
|
|
5397
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(`No node collection for kind "${kind}".`, {
|
|
5398
5398
|
details: { kind }
|
|
5399
5399
|
});
|
|
5400
5400
|
}
|
|
@@ -5403,14 +5403,14 @@ function nodeCollection(nodes, kind) {
|
|
|
5403
5403
|
function edgeCollection(edges, kind) {
|
|
5404
5404
|
const collection = edges[kind];
|
|
5405
5405
|
if (collection === void 0) {
|
|
5406
|
-
throw new
|
|
5406
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(`No edge collection for kind "${kind}".`, {
|
|
5407
5407
|
details: { kind }
|
|
5408
5408
|
});
|
|
5409
5409
|
}
|
|
5410
5410
|
return collection;
|
|
5411
5411
|
}
|
|
5412
5412
|
async function validateBaseVersions(target, branches) {
|
|
5413
|
-
const targetVersion = await
|
|
5413
|
+
const targetVersion = await chunkBZ5EXHZX_cjs.computeBaseVersion(target);
|
|
5414
5414
|
for (const branch2 of branches) {
|
|
5415
5415
|
if (branch2.base === targetVersion) continue;
|
|
5416
5416
|
return chunkPAHLRNPI_cjs.err(
|
|
@@ -5424,15 +5424,15 @@ async function validateBaseVersions(target, branches) {
|
|
|
5424
5424
|
return chunkPAHLRNPI_cjs.ok(targetVersion);
|
|
5425
5425
|
}
|
|
5426
5426
|
function branchBaseMismatchError(branch2, message, details) {
|
|
5427
|
-
const legacy =
|
|
5428
|
-
return new
|
|
5427
|
+
const legacy = chunkBZ5EXHZX_cjs.isLegacyBaseVersion(branch2.base);
|
|
5428
|
+
return new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(message, {
|
|
5429
5429
|
details: {
|
|
5430
5430
|
branchId: branch2.id,
|
|
5431
5431
|
branchBase: branch2.base,
|
|
5432
5432
|
...details,
|
|
5433
|
-
...legacy ? { reason:
|
|
5433
|
+
...legacy ? { reason: chunkBZ5EXHZX_cjs.LEGACY_BASE_VERSION_REFUSAL.reason } : {}
|
|
5434
5434
|
},
|
|
5435
|
-
...legacy ? { suggestion:
|
|
5435
|
+
...legacy ? { suggestion: chunkBZ5EXHZX_cjs.LEGACY_BASE_VERSION_REFUSAL.suggestion } : {}
|
|
5436
5436
|
});
|
|
5437
5437
|
}
|
|
5438
5438
|
function tryNormalize(optionsInput, refusedOptions = []) {
|
|
@@ -5441,7 +5441,7 @@ function tryNormalize(optionsInput, refusedOptions = []) {
|
|
|
5441
5441
|
);
|
|
5442
5442
|
if (refusedOption !== void 0) {
|
|
5443
5443
|
return chunkPAHLRNPI_cjs.err(
|
|
5444
|
-
new
|
|
5444
|
+
new chunkBZ5EXHZX_cjs.InvalidMergeOptionsError(
|
|
5445
5445
|
`This merge operation does not accept options.${refusedOption}.`,
|
|
5446
5446
|
{ details: { option: refusedOption } }
|
|
5447
5447
|
)
|
|
@@ -5451,7 +5451,7 @@ function tryNormalize(optionsInput, refusedOptions = []) {
|
|
|
5451
5451
|
return chunkPAHLRNPI_cjs.ok(normalizeMergeOptions(optionsInput));
|
|
5452
5452
|
} catch (error) {
|
|
5453
5453
|
return chunkPAHLRNPI_cjs.err(
|
|
5454
|
-
new
|
|
5454
|
+
new chunkBZ5EXHZX_cjs.InvalidMergeOptionsError("Invalid merge options.", { cause: error })
|
|
5455
5455
|
);
|
|
5456
5456
|
}
|
|
5457
5457
|
}
|
|
@@ -5466,21 +5466,21 @@ async function tryOpenProvenanceStore(target) {
|
|
|
5466
5466
|
targetGraphId: target.graphId,
|
|
5467
5467
|
...typeof code === "string" ? { provenanceErrorCode: code } : {}
|
|
5468
5468
|
};
|
|
5469
|
-
const message = `options.persistProvenance was requested but the merge-provenance sidecar cannot be opened: ${
|
|
5469
|
+
const message = `options.persistProvenance was requested but the merge-provenance sidecar cannot be opened: ${chunkBZ5EXHZX_cjs.describeCause(error)}`;
|
|
5470
5470
|
return chunkPAHLRNPI_cjs.err(
|
|
5471
|
-
code === "GRAPH_MERGE_PROVENANCE_ID_COLLISION" || code === "GRAPH_MERGE_PROVENANCE_CLAIM_UNFENCED" ? new
|
|
5471
|
+
code === "GRAPH_MERGE_PROVENANCE_ID_COLLISION" || code === "GRAPH_MERGE_PROVENANCE_CLAIM_UNFENCED" ? new chunkBZ5EXHZX_cjs.InvalidMergeOptionsError(message, { details, cause: error }) : new chunkBZ5EXHZX_cjs.MergeError(message, { details, cause: error })
|
|
5472
5472
|
);
|
|
5473
5473
|
}
|
|
5474
5474
|
}
|
|
5475
5475
|
function assertPublicPlanCapability(target) {
|
|
5476
5476
|
if (!chunkQV6LL3PK_cjs.storeBackend(target).capabilities.execution.interactiveTransactions) {
|
|
5477
|
-
throw new
|
|
5477
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
5478
5478
|
"Public merge plans require a transaction-capable target backend.",
|
|
5479
5479
|
{ details: { capability: "execution.interactiveTransactions" } }
|
|
5480
5480
|
);
|
|
5481
5481
|
}
|
|
5482
5482
|
if (!target.revisionTrackingEnabled) {
|
|
5483
|
-
throw new
|
|
5483
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
5484
5484
|
"Public merge plans require durable target revision tracking.",
|
|
5485
5485
|
{
|
|
5486
5486
|
details: { capability: "revisionTracking" },
|
|
@@ -5493,7 +5493,7 @@ async function captureMergePlanTargetFence(target) {
|
|
|
5493
5493
|
assertPublicPlanCapability(target);
|
|
5494
5494
|
const [activeSchema, schemaHash, origin, revision] = await Promise.all([
|
|
5495
5495
|
chunkQV6LL3PK_cjs.storeBackend(target).getActiveSchema(target.graphId),
|
|
5496
|
-
|
|
5496
|
+
chunkBZ5EXHZX_cjs.computeSchemaComponent(target),
|
|
5497
5497
|
target.revisionOriginNow(),
|
|
5498
5498
|
target.revisionNow()
|
|
5499
5499
|
]);
|
|
@@ -5526,7 +5526,7 @@ function evolutionResultingFence(evolutionPlan, baselineFence) {
|
|
|
5526
5526
|
async function assertPlanningFenceUnchanged(target, startingFence) {
|
|
5527
5527
|
const endingFence = await captureMergePlanTargetFence(target);
|
|
5528
5528
|
if (sameMergePlanTargetFence(startingFence, endingFence)) return;
|
|
5529
|
-
throw new
|
|
5529
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanningStaleError(
|
|
5530
5530
|
"The merge target changed while the plan was being computed; no reviewable plan was produced.",
|
|
5531
5531
|
{ details: { startingFence, endingFence } }
|
|
5532
5532
|
);
|
|
@@ -5598,27 +5598,27 @@ async function resolvedMergeArtifact(resolved, mode, targetFence, anchors) {
|
|
|
5598
5598
|
},
|
|
5599
5599
|
writes: {
|
|
5600
5600
|
nodeDeletes: [...plan.nodeDeletions].map(
|
|
5601
|
-
([identity, kind]) => wireEntityRef(kind,
|
|
5601
|
+
([identity, kind]) => wireEntityRef(kind, chunkBZ5EXHZX_cjs.idOf(identity))
|
|
5602
5602
|
),
|
|
5603
5603
|
nodeUpserts,
|
|
5604
5604
|
edgeDeletes: [...plan.edgeDeletions].map(
|
|
5605
|
-
([identity, kind]) => wireEntityRef(kind,
|
|
5605
|
+
([identity, kind]) => wireEntityRef(kind, chunkBZ5EXHZX_cjs.idOf(identity))
|
|
5606
5606
|
),
|
|
5607
5607
|
edgeUpserts,
|
|
5608
5608
|
identityAssertions: plan.identityAssertions,
|
|
5609
5609
|
identityRetractions: plan.identityRetractions
|
|
5610
5610
|
},
|
|
5611
5611
|
guards: {
|
|
5612
|
-
canonicalMappings: [...plan.canonicalOf].sort(([left], [right]) =>
|
|
5613
|
-
member: wireEntityRef(
|
|
5614
|
-
canonical: wireEntityRef(
|
|
5612
|
+
canonicalMappings: [...plan.canonicalOf].sort(([left], [right]) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right)).map(([member, canonical]) => ({
|
|
5613
|
+
member: wireEntityRef(chunkBZ5EXHZX_cjs.kindOf(member), chunkBZ5EXHZX_cjs.idOf(member)),
|
|
5614
|
+
canonical: wireEntityRef(chunkBZ5EXHZX_cjs.kindOf(canonical), chunkBZ5EXHZX_cjs.idOf(canonical))
|
|
5615
5615
|
})),
|
|
5616
|
-
retypes: [...plan.retypeMap].sort(([left], [right]) =>
|
|
5617
|
-
entity: wireEntityRef(
|
|
5616
|
+
retypes: [...plan.retypeMap].sort(([left], [right]) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right)).map(([entity, toKind]) => ({
|
|
5617
|
+
entity: wireEntityRef(chunkBZ5EXHZX_cjs.kindOf(entity), chunkBZ5EXHZX_cjs.idOf(entity)),
|
|
5618
5618
|
toKind
|
|
5619
5619
|
})),
|
|
5620
5620
|
deletedNodes: [...plan.nodeDeletions].map(
|
|
5621
|
-
([identity, kind]) => wireEntityRef(kind,
|
|
5621
|
+
([identity, kind]) => wireEntityRef(kind, chunkBZ5EXHZX_cjs.idOf(identity))
|
|
5622
5622
|
),
|
|
5623
5623
|
...resolved.incrementalGuard === void 0 ? {} : {
|
|
5624
5624
|
incremental: {
|
|
@@ -5652,7 +5652,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5652
5652
|
for (const branch2 of branches) {
|
|
5653
5653
|
if (branch2.id === BASE_PROVENANCE_BRANCH) {
|
|
5654
5654
|
return chunkPAHLRNPI_cjs.err(
|
|
5655
|
-
new
|
|
5655
|
+
new chunkBZ5EXHZX_cjs.MergeError(
|
|
5656
5656
|
`Branch id "${BASE_PROVENANCE_BRANCH}" is reserved for committed-base provenance and cannot be used as a branch id.`,
|
|
5657
5657
|
{ details: { branchId: branch2.id } }
|
|
5658
5658
|
)
|
|
@@ -5661,7 +5661,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5661
5661
|
if (branch2.id === COMMITTED_TARGET_BRANCH) {
|
|
5662
5662
|
if (incremental?.targetBranchId !== COMMITTED_TARGET_BRANCH || targetBranchSeen) {
|
|
5663
5663
|
return chunkPAHLRNPI_cjs.err(
|
|
5664
|
-
new
|
|
5664
|
+
new chunkBZ5EXHZX_cjs.MergeError(
|
|
5665
5665
|
`Branch id "${COMMITTED_TARGET_BRANCH}" is reserved for the committed incremental target and cannot be used as a branch id.`,
|
|
5666
5666
|
{ details: { branchId: branch2.id } }
|
|
5667
5667
|
)
|
|
@@ -5686,7 +5686,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5686
5686
|
}
|
|
5687
5687
|
if (drifted) {
|
|
5688
5688
|
return chunkPAHLRNPI_cjs.err(
|
|
5689
|
-
new
|
|
5689
|
+
new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
5690
5690
|
`Branch "${branch2.id}"'s store has a committed schema different from its at-fork state \u2014 a schema operation ran on the branch after forking. Merge carries data changes only; apply the schema change to the target first (or re-fork), then merge.`,
|
|
5691
5691
|
{
|
|
5692
5692
|
details: {
|
|
@@ -5768,7 +5768,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5768
5768
|
)
|
|
5769
5769
|
])
|
|
5770
5770
|
];
|
|
5771
|
-
const storedIdentityRowsById = stagedIdentityIds.length === 0 || target.graph.identity === void 0 ?
|
|
5771
|
+
const storedIdentityRowsById = stagedIdentityIds.length === 0 || target.graph.identity === void 0 ? chunkBZ5EXHZX_cjs.NO_STORED_ASSERTIONS : await chunkQV6LL3PK_cjs.storeRuntime(target).identityAssertionRowsByIds(
|
|
5772
5772
|
stagedIdentityIds
|
|
5773
5773
|
);
|
|
5774
5774
|
const identityContext = {
|
|
@@ -5791,7 +5791,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5791
5791
|
preferredBranchId
|
|
5792
5792
|
);
|
|
5793
5793
|
if (plan.identityAssertions.length > 0) {
|
|
5794
|
-
|
|
5794
|
+
chunkBZ5EXHZX_cjs.assertOneIdOneTruth(
|
|
5795
5795
|
plan.identityAssertions,
|
|
5796
5796
|
await chunkQV6LL3PK_cjs.storeRuntime(target).identityAssertionRowsByIds(
|
|
5797
5797
|
plan.identityAssertions.map((assertion) => assertion.id)
|
|
@@ -5801,7 +5801,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5801
5801
|
let identityGuard;
|
|
5802
5802
|
if (identityProbeIds !== void 0 && incremental !== void 0) {
|
|
5803
5803
|
const freshPeers = await chunkQV6LL3PK_cjs.storeRuntime(target).liveNodesSharingIds(identityProbeIds);
|
|
5804
|
-
const built = await
|
|
5804
|
+
const built = await chunkBZ5EXHZX_cjs.buildIdentityPeerProbe(
|
|
5805
5805
|
target,
|
|
5806
5806
|
identityProbeIds,
|
|
5807
5807
|
freshPeers,
|
|
@@ -5809,7 +5809,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5809
5809
|
target.graph.identity?.sameIdAcrossKinds ?? "ignore"
|
|
5810
5810
|
);
|
|
5811
5811
|
const canonicalIdentityOf = plan.canonicalOf;
|
|
5812
|
-
|
|
5812
|
+
chunkBZ5EXHZX_cjs.assertNoContradictoryIdentityClosure(
|
|
5813
5813
|
plan.identityAssertions,
|
|
5814
5814
|
plan.identityRetractions.map((retraction) => retraction.id),
|
|
5815
5815
|
// The FRESH target ledger, not the pre-planning staging capture —
|
|
@@ -5844,7 +5844,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5844
5844
|
forkPoint: incremental.forkPoint,
|
|
5845
5845
|
...identityGuard === void 0 ? {} : { identityPeerProbe: identityGuard },
|
|
5846
5846
|
plannedBaseMatchKeys: new Set(
|
|
5847
|
-
candidates.data.baseMembers.map((member) =>
|
|
5847
|
+
candidates.data.baseMembers.map((member) => chunkBZ5EXHZX_cjs.mergeKeyOf(member))
|
|
5848
5848
|
),
|
|
5849
5849
|
targetNodeVersions: inheritedBaselines?.nodes ?? staging.targetNodeVersions,
|
|
5850
5850
|
targetEdgeSignatures: inheritedBaselines?.edges ?? staging.targetEdgeSignatures
|
|
@@ -5859,12 +5859,12 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
5859
5859
|
})
|
|
5860
5860
|
);
|
|
5861
5861
|
} catch (error) {
|
|
5862
|
-
if (error instanceof
|
|
5862
|
+
if (error instanceof chunkBZ5EXHZX_cjs.MergeError) {
|
|
5863
5863
|
return chunkPAHLRNPI_cjs.err(error);
|
|
5864
5864
|
}
|
|
5865
5865
|
return chunkPAHLRNPI_cjs.err(
|
|
5866
|
-
new
|
|
5867
|
-
`Merge failed while staging or committing: ${
|
|
5866
|
+
new chunkBZ5EXHZX_cjs.MergeError(
|
|
5867
|
+
`Merge failed while staging or committing: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
5868
5868
|
{ cause: error }
|
|
5869
5869
|
)
|
|
5870
5870
|
);
|
|
@@ -5913,7 +5913,7 @@ async function commitResolvedMerge(resolved) {
|
|
|
5913
5913
|
};
|
|
5914
5914
|
}
|
|
5915
5915
|
function incrementalBaseConflictPolicyError(options) {
|
|
5916
|
-
return new
|
|
5916
|
+
return new chunkBZ5EXHZX_cjs.InvalidMergeOptionsError(
|
|
5917
5917
|
'mergeIncremental() requires onBasePropertyConflict: "flag" (keep-base); a non-keep-base policy could overwrite a newer committed base value with a stale branch value.',
|
|
5918
5918
|
{
|
|
5919
5919
|
details: {
|
|
@@ -5925,7 +5925,7 @@ function incrementalBaseConflictPolicyError(options) {
|
|
|
5925
5925
|
);
|
|
5926
5926
|
}
|
|
5927
5927
|
function incrementalSchemaError() {
|
|
5928
|
-
return new
|
|
5928
|
+
return new chunkBZ5EXHZX_cjs.MergeError(
|
|
5929
5929
|
"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).",
|
|
5930
5930
|
{ details: {} }
|
|
5931
5931
|
);
|
|
@@ -5941,8 +5941,8 @@ async function planMerge(store, branchInputs, optionsInput = {}) {
|
|
|
5941
5941
|
targetFence = await captureMergePlanTargetFence(target);
|
|
5942
5942
|
} catch (error) {
|
|
5943
5943
|
return chunkPAHLRNPI_cjs.err(
|
|
5944
|
-
error instanceof
|
|
5945
|
-
`Unable to capture the target's durable plan fence: ${
|
|
5944
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
5945
|
+
`Unable to capture the target's durable plan fence: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
5946
5946
|
{ cause: error }
|
|
5947
5947
|
)
|
|
5948
5948
|
);
|
|
@@ -5978,7 +5978,7 @@ async function planMergeForEvolution(store, evolutionPlan, branchInputs, options
|
|
|
5978
5978
|
const options = normalized.data;
|
|
5979
5979
|
if (options.target !== void 0 && options.target !== store) {
|
|
5980
5980
|
return chunkPAHLRNPI_cjs.err(
|
|
5981
|
-
new
|
|
5981
|
+
new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
5982
5982
|
"Evolution merge planning must use the Store that owns the evolution plan.",
|
|
5983
5983
|
{ details: { capability: "evolutionPlanTarget" } }
|
|
5984
5984
|
)
|
|
@@ -5991,15 +5991,15 @@ async function planMergeForEvolution(store, evolutionPlan, branchInputs, options
|
|
|
5991
5991
|
baselineFence = await captureMergePlanTargetFence(store);
|
|
5992
5992
|
} catch (error) {
|
|
5993
5993
|
return chunkPAHLRNPI_cjs.err(
|
|
5994
|
-
error instanceof
|
|
5995
|
-
`Unable to prepare an evolution merge target: ${
|
|
5994
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
5995
|
+
`Unable to prepare an evolution merge target: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
5996
5996
|
{ cause: error, details: { capability: "evolutionPlanningTarget" } }
|
|
5997
5997
|
)
|
|
5998
5998
|
);
|
|
5999
5999
|
}
|
|
6000
6000
|
if (!evolutionPlanMatchesPlanningFence(evolutionPlan, baselineFence)) {
|
|
6001
6001
|
return chunkPAHLRNPI_cjs.err(
|
|
6002
|
-
new
|
|
6002
|
+
new chunkBZ5EXHZX_cjs.MergePlanningStaleError(
|
|
6003
6003
|
"The evolution plan baseline no longer matches the active merge target schema.",
|
|
6004
6004
|
{ details: { startingFence: baselineFence } }
|
|
6005
6005
|
)
|
|
@@ -6048,15 +6048,15 @@ async function planMergeIncrementalForEvolution(store, evolutionPlan, branchInpu
|
|
|
6048
6048
|
baselineFence = startingFence ?? await captureMergePlanTargetFence(store);
|
|
6049
6049
|
} catch (error) {
|
|
6050
6050
|
return chunkPAHLRNPI_cjs.err(
|
|
6051
|
-
error instanceof
|
|
6052
|
-
`Unable to prepare an evolution merge target: ${
|
|
6051
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6052
|
+
`Unable to prepare an evolution merge target: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
6053
6053
|
{ cause: error, details: { capability: "evolutionPlanningTarget" } }
|
|
6054
6054
|
)
|
|
6055
6055
|
);
|
|
6056
6056
|
}
|
|
6057
6057
|
if (!evolutionPlanMatchesPlanningFence(evolutionPlan, baselineFence)) {
|
|
6058
6058
|
return chunkPAHLRNPI_cjs.err(
|
|
6059
|
-
new
|
|
6059
|
+
new chunkBZ5EXHZX_cjs.MergePlanningStaleError(
|
|
6060
6060
|
"The evolution plan baseline no longer matches the active merge target schema.",
|
|
6061
6061
|
{ details: { startingFence: baselineFence } }
|
|
6062
6062
|
)
|
|
@@ -6066,8 +6066,8 @@ async function planMergeIncrementalForEvolution(store, evolutionPlan, branchInpu
|
|
|
6066
6066
|
await assertPlanningFenceUnchanged(store, baselineFence);
|
|
6067
6067
|
} catch (error) {
|
|
6068
6068
|
return chunkPAHLRNPI_cjs.err(
|
|
6069
|
-
error instanceof
|
|
6070
|
-
`Unable to verify the evolution merge planning fence: ${
|
|
6069
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergeError(
|
|
6070
|
+
`Unable to verify the evolution merge planning fence: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
6071
6071
|
{ cause: error }
|
|
6072
6072
|
)
|
|
6073
6073
|
);
|
|
@@ -6078,8 +6078,8 @@ async function planMergeIncrementalForEvolution(store, evolutionPlan, branchInpu
|
|
|
6078
6078
|
await assertPlanningFenceUnchanged(store, baselineFence);
|
|
6079
6079
|
} catch (error) {
|
|
6080
6080
|
return chunkPAHLRNPI_cjs.err(
|
|
6081
|
-
error instanceof
|
|
6082
|
-
`Unable to verify the evolution merge planning fence: ${
|
|
6081
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergeError(
|
|
6082
|
+
`Unable to verify the evolution merge planning fence: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
6083
6083
|
{ cause: error }
|
|
6084
6084
|
)
|
|
6085
6085
|
);
|
|
@@ -6087,7 +6087,7 @@ async function planMergeIncrementalForEvolution(store, evolutionPlan, branchInpu
|
|
|
6087
6087
|
return chunkPAHLRNPI_cjs.err(forkPrecondition.error);
|
|
6088
6088
|
}
|
|
6089
6089
|
const forkVersion = forkPrecondition.data;
|
|
6090
|
-
const forkSchema = await
|
|
6090
|
+
const forkSchema = await chunkBZ5EXHZX_cjs.computeSchemaComponent(target);
|
|
6091
6091
|
if (forkSchema !== evolutionPlan.result.hash) {
|
|
6092
6092
|
return chunkPAHLRNPI_cjs.err(incrementalSchemaError());
|
|
6093
6093
|
}
|
|
@@ -6138,7 +6138,7 @@ async function planMergeIncremental(args) {
|
|
|
6138
6138
|
async function planMergeIncrementalWithCandidateKeys(args, candidateKeys2, scopedIdentity) {
|
|
6139
6139
|
if (args.forkPoint !== args.target) {
|
|
6140
6140
|
return chunkPAHLRNPI_cjs.err(
|
|
6141
|
-
new
|
|
6141
|
+
new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6142
6142
|
"Bounded candidate planning requires the live target as its fork point and exact candidate keys."
|
|
6143
6143
|
)
|
|
6144
6144
|
);
|
|
@@ -6146,7 +6146,7 @@ async function planMergeIncrementalWithCandidateKeys(args, candidateKeys2, scope
|
|
|
6146
6146
|
const branch2 = args.branches[0];
|
|
6147
6147
|
if (branch2 === void 0 || args.branches.length !== 1) {
|
|
6148
6148
|
return chunkPAHLRNPI_cjs.err(
|
|
6149
|
-
new
|
|
6149
|
+
new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6150
6150
|
"Bounded candidate planning requires exactly one candidate source."
|
|
6151
6151
|
)
|
|
6152
6152
|
);
|
|
@@ -6174,8 +6174,8 @@ async function planMergeIncrementalWithPruning(args, explicitPruneTo, scopedIden
|
|
|
6174
6174
|
targetFence = await captureMergePlanTargetFence(target);
|
|
6175
6175
|
} catch (error) {
|
|
6176
6176
|
return chunkPAHLRNPI_cjs.err(
|
|
6177
|
-
error instanceof
|
|
6178
|
-
`Unable to capture the target's durable plan fence: ${
|
|
6177
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6178
|
+
`Unable to capture the target's durable plan fence: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
6179
6179
|
{ cause: error }
|
|
6180
6180
|
)
|
|
6181
6181
|
);
|
|
@@ -6188,8 +6188,8 @@ async function planMergeIncrementalWithPruning(args, explicitPruneTo, scopedIden
|
|
|
6188
6188
|
if (chunkPAHLRNPI_cjs.isErr(prepared)) return chunkPAHLRNPI_cjs.err(prepared.error);
|
|
6189
6189
|
const { store: forkStore, version: forkVersion } = prepared.data;
|
|
6190
6190
|
const [forkSchema, targetSchema] = await Promise.all([
|
|
6191
|
-
|
|
6192
|
-
|
|
6191
|
+
chunkBZ5EXHZX_cjs.computeSchemaComponent(forkStore),
|
|
6192
|
+
chunkBZ5EXHZX_cjs.computeSchemaComponent(target)
|
|
6193
6193
|
]);
|
|
6194
6194
|
if (forkSchema !== targetSchema) return chunkPAHLRNPI_cjs.err(incrementalSchemaError());
|
|
6195
6195
|
const forkActiveSchema = await chunkQV6LL3PK_cjs.storeBackend(forkStore).getActiveSchema(
|
|
@@ -6252,19 +6252,19 @@ async function planMergeIncrementalWithPruning(args, explicitPruneTo, scopedIden
|
|
|
6252
6252
|
function mergePlanValidationError(failure) {
|
|
6253
6253
|
switch (failure.kind) {
|
|
6254
6254
|
case "unsupported-version": {
|
|
6255
|
-
return new
|
|
6255
|
+
return new chunkBZ5EXHZX_cjs.UnsupportedMergePlanVersionError(
|
|
6256
6256
|
`Unsupported merge plan format version ${String(failure.received)}.`,
|
|
6257
6257
|
{ details: { received: failure.received } }
|
|
6258
6258
|
);
|
|
6259
6259
|
}
|
|
6260
6260
|
case "digest-mismatch": {
|
|
6261
|
-
return new
|
|
6261
|
+
return new chunkBZ5EXHZX_cjs.MergePlanDigestMismatchError(
|
|
6262
6262
|
"The merge plan digest does not match its canonical content.",
|
|
6263
6263
|
{ details: { expected: failure.expected, received: failure.received } }
|
|
6264
6264
|
);
|
|
6265
6265
|
}
|
|
6266
6266
|
case "malformed": {
|
|
6267
|
-
return new
|
|
6267
|
+
return new chunkBZ5EXHZX_cjs.InvalidMergePlanError("The merge plan is malformed.", {
|
|
6268
6268
|
details: { issues: failure.issues }
|
|
6269
6269
|
});
|
|
6270
6270
|
}
|
|
@@ -6290,7 +6290,7 @@ function resolvedWireProps(current, setProps, unsetProps) {
|
|
|
6290
6290
|
return props;
|
|
6291
6291
|
}
|
|
6292
6292
|
function invalidPlanForTarget(message, details) {
|
|
6293
|
-
return new
|
|
6293
|
+
return new chunkBZ5EXHZX_cjs.InvalidMergePlanError(message, { details });
|
|
6294
6294
|
}
|
|
6295
6295
|
async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
6296
6296
|
const graphNodes = target.graph.nodes;
|
|
@@ -6340,17 +6340,17 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
6340
6340
|
}
|
|
6341
6341
|
const plannedNodes = new Set(
|
|
6342
6342
|
artifact.writes.nodeUpserts.map(
|
|
6343
|
-
(upsert) =>
|
|
6343
|
+
(upsert) => chunkBZ5EXHZX_cjs.mergeKey(upsert.kind, upsert.id)
|
|
6344
6344
|
)
|
|
6345
6345
|
);
|
|
6346
6346
|
const deletedNodes = new Set(
|
|
6347
6347
|
artifact.writes.nodeDeletes.map(
|
|
6348
|
-
(deletion) =>
|
|
6348
|
+
(deletion) => chunkBZ5EXHZX_cjs.mergeKey(deletion.kind, deletion.id)
|
|
6349
6349
|
)
|
|
6350
6350
|
);
|
|
6351
6351
|
const endpointRows = /* @__PURE__ */ new Map();
|
|
6352
6352
|
const readEndpoint = async (endpoint) => {
|
|
6353
|
-
const key =
|
|
6353
|
+
const key = chunkBZ5EXHZX_cjs.mergeKey(endpoint.kind, endpoint.id);
|
|
6354
6354
|
if (endpointRows.has(key)) return endpointRows.get(key);
|
|
6355
6355
|
const row = (await nodeCollection(nodesApi, endpoint.kind).getByIds(
|
|
6356
6356
|
[endpoint.id],
|
|
@@ -6373,14 +6373,14 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
6373
6373
|
);
|
|
6374
6374
|
for (const [index, upsert] of upserts.entries()) {
|
|
6375
6375
|
const row = rows[index];
|
|
6376
|
-
const identity =
|
|
6376
|
+
const identity = chunkBZ5EXHZX_cjs.mergeKey(kind, upsert.id);
|
|
6377
6377
|
currentNodesByIdentity.set(identity, row);
|
|
6378
6378
|
endpointRows.set(identity, row);
|
|
6379
6379
|
}
|
|
6380
6380
|
}
|
|
6381
6381
|
for (const upsert of artifact.writes.nodeUpserts) {
|
|
6382
6382
|
const current = currentNodesByIdentity.get(
|
|
6383
|
-
|
|
6383
|
+
chunkBZ5EXHZX_cjs.mergeKey(upsert.kind, upsert.id)
|
|
6384
6384
|
);
|
|
6385
6385
|
if (artifact.guards.incremental !== void 0 && current?.meta.deletedAt !== void 0) {
|
|
6386
6386
|
throw invalidPlanForTarget(
|
|
@@ -6434,7 +6434,7 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
6434
6434
|
);
|
|
6435
6435
|
for (const [index, upsert] of upserts.entries()) {
|
|
6436
6436
|
const row = rows[index];
|
|
6437
|
-
currentEdgesByIdentity.set(
|
|
6437
|
+
currentEdgesByIdentity.set(chunkBZ5EXHZX_cjs.mergeKey(kind, upsert.id), row);
|
|
6438
6438
|
if (row !== void 0) currentEdgeIds.add(upsert.id);
|
|
6439
6439
|
}
|
|
6440
6440
|
}
|
|
@@ -6456,7 +6456,7 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
6456
6456
|
}
|
|
6457
6457
|
for (const endpoint of [upsert.from, upsert.to]) {
|
|
6458
6458
|
assertNodeKind(endpoint.kind);
|
|
6459
|
-
const key =
|
|
6459
|
+
const key = chunkBZ5EXHZX_cjs.mergeKey(endpoint.kind, endpoint.id);
|
|
6460
6460
|
if (deletedNodes.has(key)) {
|
|
6461
6461
|
throw invalidPlanForTarget(
|
|
6462
6462
|
`The merge plan deletes an endpoint required by edge "${upsert.id}".`,
|
|
@@ -6473,7 +6473,7 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
6473
6473
|
}
|
|
6474
6474
|
}
|
|
6475
6475
|
const current = currentEdgesByIdentity.get(
|
|
6476
|
-
|
|
6476
|
+
chunkBZ5EXHZX_cjs.mergeKey(upsert.kind, upsert.id)
|
|
6477
6477
|
);
|
|
6478
6478
|
if (artifact.guards.incremental !== void 0 && current?.meta.deletedAt !== void 0) {
|
|
6479
6479
|
throw invalidPlanForTarget(
|
|
@@ -6548,7 +6548,7 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
6548
6548
|
schemaVersion: artifact.target.schema.managed ? artifact.target.schema.version : void 0,
|
|
6549
6549
|
graphLock: "required",
|
|
6550
6550
|
requireFreshSnapshot,
|
|
6551
|
-
staleSchemaError: (cause) => new
|
|
6551
|
+
staleSchemaError: (cause) => new chunkBZ5EXHZX_cjs.MergePlanSchemaMismatchError(
|
|
6552
6552
|
"The target's active schema no longer matches the merge plan.",
|
|
6553
6553
|
{ cause, details: { expected: artifact.target.schema } }
|
|
6554
6554
|
)
|
|
@@ -6557,10 +6557,10 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
6557
6557
|
const liveSchema = {
|
|
6558
6558
|
managed: activeSchema !== void 0,
|
|
6559
6559
|
version: activeSchema?.version ?? 1,
|
|
6560
|
-
hash: activeSchema?.schema_hash ?? await
|
|
6560
|
+
hash: activeSchema?.schema_hash ?? await chunkBZ5EXHZX_cjs.computeSchemaComponent(target)
|
|
6561
6561
|
};
|
|
6562
6562
|
if (liveSchema.managed !== artifact.target.schema.managed || liveSchema.version !== artifact.target.schema.version || liveSchema.hash !== artifact.target.schema.hash) {
|
|
6563
|
-
throw new
|
|
6563
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanSchemaMismatchError(
|
|
6564
6564
|
"The target's active schema no longer matches the merge plan.",
|
|
6565
6565
|
{ details: { expected: artifact.target.schema, live: liveSchema } }
|
|
6566
6566
|
);
|
|
@@ -6571,7 +6571,7 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
6571
6571
|
target.graphId
|
|
6572
6572
|
);
|
|
6573
6573
|
if (liveOrigin !== artifact.target.revision.origin) {
|
|
6574
|
-
throw new
|
|
6574
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanOriginMismatchError(
|
|
6575
6575
|
"The merge plan belongs to a different target revision origin.",
|
|
6576
6576
|
{
|
|
6577
6577
|
details: {
|
|
@@ -6587,7 +6587,7 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
6587
6587
|
target.graphId
|
|
6588
6588
|
) ?? null;
|
|
6589
6589
|
if (liveRevision !== artifact.target.revision.revision) {
|
|
6590
|
-
throw new
|
|
6590
|
+
throw new chunkBZ5EXHZX_cjs.StaleMergePlanError(
|
|
6591
6591
|
"The target revision changed after this merge plan was created; the plan was not applied.",
|
|
6592
6592
|
{
|
|
6593
6593
|
details: {
|
|
@@ -6601,12 +6601,12 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
6601
6601
|
function identityConsistencySeeds(artifact, profile) {
|
|
6602
6602
|
const deleted = new Set(
|
|
6603
6603
|
artifact.writes.nodeDeletes.map(
|
|
6604
|
-
(entity) =>
|
|
6604
|
+
(entity) => chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.id)
|
|
6605
6605
|
)
|
|
6606
6606
|
);
|
|
6607
6607
|
const byIdentity = /* @__PURE__ */ new Map();
|
|
6608
6608
|
const add = (entity) => {
|
|
6609
|
-
const identity =
|
|
6609
|
+
const identity = chunkBZ5EXHZX_cjs.mergeKey(entity.kind, entity.id);
|
|
6610
6610
|
if (!deleted.has(identity)) byIdentity.set(identity, entity);
|
|
6611
6611
|
};
|
|
6612
6612
|
for (const assertion of [
|
|
@@ -6619,7 +6619,7 @@ function identityConsistencySeeds(artifact, profile) {
|
|
|
6619
6619
|
if (profile === "fold") {
|
|
6620
6620
|
for (const upsert of artifact.writes.nodeUpserts) add(upsert);
|
|
6621
6621
|
}
|
|
6622
|
-
return [...byIdentity].sort(([left], [right]) =>
|
|
6622
|
+
return [...byIdentity].sort(([left], [right]) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right)).map(([, entity]) => entity);
|
|
6623
6623
|
}
|
|
6624
6624
|
async function applyWireMergeWrites(target, nodesApi, edgesApi, txBackend, artifact) {
|
|
6625
6625
|
const committedNodes = await applyNodeRows(
|
|
@@ -6706,15 +6706,15 @@ async function validateMergePlanForTarget(target, input) {
|
|
|
6706
6706
|
try {
|
|
6707
6707
|
validation = await validateMergePlanArtifact(input);
|
|
6708
6708
|
} catch (error) {
|
|
6709
|
-
throw new
|
|
6710
|
-
`Merge plan validation failed: ${
|
|
6709
|
+
throw new chunkBZ5EXHZX_cjs.InvalidMergePlanError(
|
|
6710
|
+
`Merge plan validation failed: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
6711
6711
|
{ cause: error }
|
|
6712
6712
|
);
|
|
6713
6713
|
}
|
|
6714
6714
|
if (!validation.success) throw mergePlanValidationError(validation.error);
|
|
6715
6715
|
const artifact = validation.artifact;
|
|
6716
6716
|
if (artifact.target.graphId !== target.graphId) {
|
|
6717
|
-
throw new
|
|
6717
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanTargetMismatchError(
|
|
6718
6718
|
"The merge plan names a different target graph.",
|
|
6719
6719
|
{
|
|
6720
6720
|
details: {
|
|
@@ -6747,7 +6747,7 @@ async function applyValidatedMergePlanInTransaction(target, tx, artifact, option
|
|
|
6747
6747
|
tx.edges,
|
|
6748
6748
|
artifact
|
|
6749
6749
|
);
|
|
6750
|
-
await
|
|
6750
|
+
await chunkBZ5EXHZX_cjs.assertPlannedIdentityIdsFresh(target, txBackend, {
|
|
6751
6751
|
identityAssertions: artifact.writes.identityAssertions,
|
|
6752
6752
|
identityRetractions: artifact.writes.identityRetractions
|
|
6753
6753
|
});
|
|
@@ -6772,8 +6772,8 @@ async function applyMergePlan(target, input, options = {}) {
|
|
|
6772
6772
|
artifact = await validateMergePlanForTarget(target, input);
|
|
6773
6773
|
} catch (error) {
|
|
6774
6774
|
return chunkPAHLRNPI_cjs.err(
|
|
6775
|
-
error instanceof
|
|
6776
|
-
`Merge plan validation failed: ${
|
|
6775
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.InvalidMergePlanError(
|
|
6776
|
+
`Merge plan validation failed: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
6777
6777
|
{ cause: error }
|
|
6778
6778
|
)
|
|
6779
6779
|
);
|
|
@@ -6820,7 +6820,7 @@ async function applyMergePlan(target, input, options = {}) {
|
|
|
6820
6820
|
};
|
|
6821
6821
|
} catch (error) {
|
|
6822
6822
|
warnings.push(
|
|
6823
|
-
"provenance persistence failed (graph committed; provenance not persisted): " +
|
|
6823
|
+
"provenance persistence failed (graph committed; provenance not persisted): " + chunkBZ5EXHZX_cjs.describeCause(error)
|
|
6824
6824
|
);
|
|
6825
6825
|
}
|
|
6826
6826
|
}
|
|
@@ -6828,10 +6828,10 @@ async function applyMergePlan(target, input, options = {}) {
|
|
|
6828
6828
|
reportFromArtifact(artifact, merged, warnings, provenancePersisted)
|
|
6829
6829
|
);
|
|
6830
6830
|
} catch (error) {
|
|
6831
|
-
const translated =
|
|
6831
|
+
const translated = chunkBZ5EXHZX_cjs.translateMergeCommitError(error);
|
|
6832
6832
|
return chunkPAHLRNPI_cjs.err(
|
|
6833
|
-
translated instanceof
|
|
6834
|
-
`Merge plan apply failed: ${
|
|
6833
|
+
translated instanceof chunkBZ5EXHZX_cjs.MergeError ? translated : new chunkBZ5EXHZX_cjs.MergeError(
|
|
6834
|
+
`Merge plan apply failed: ${chunkBZ5EXHZX_cjs.describeCause(translated)}`,
|
|
6835
6835
|
{
|
|
6836
6836
|
cause: translated
|
|
6837
6837
|
}
|
|
@@ -6845,7 +6845,7 @@ async function applyMergePlanInTransaction(target, tx, input) {
|
|
|
6845
6845
|
try {
|
|
6846
6846
|
effectiveTarget = chunkQV6LL3PK_cjs.resolveEvolvedTransactionStore(tx, target);
|
|
6847
6847
|
} catch (error) {
|
|
6848
|
-
throw new
|
|
6848
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6849
6849
|
"The merge transaction must belong to an active callback of the target Store.",
|
|
6850
6850
|
{ cause: error, details: { capability: "mergeTransactionStore" } }
|
|
6851
6851
|
);
|
|
@@ -6853,7 +6853,7 @@ async function applyMergePlanInTransaction(target, tx, input) {
|
|
|
6853
6853
|
const artifact = await validateMergePlanForTarget(effectiveTarget, input);
|
|
6854
6854
|
assertPublicPlanCapability(effectiveTarget);
|
|
6855
6855
|
if (artifact.provenance.persist) {
|
|
6856
|
-
throw new
|
|
6856
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6857
6857
|
"A caller-owned merge transaction cannot persist merge provenance atomically.",
|
|
6858
6858
|
{
|
|
6859
6859
|
details: { capability: "adoptedMergeProvenance" },
|
|
@@ -6872,9 +6872,9 @@ async function applyMergePlanInTransaction(target, tx, input) {
|
|
|
6872
6872
|
);
|
|
6873
6873
|
return reportFromArtifact(artifact, merged, artifact.review.warnings);
|
|
6874
6874
|
} catch (error) {
|
|
6875
|
-
const translated =
|
|
6876
|
-
throw translated instanceof
|
|
6877
|
-
`Merge plan apply failed: ${
|
|
6875
|
+
const translated = chunkBZ5EXHZX_cjs.translateMergeCommitError(error);
|
|
6876
|
+
throw translated instanceof chunkBZ5EXHZX_cjs.MergeError ? translated : new chunkBZ5EXHZX_cjs.MergeError(
|
|
6877
|
+
`Merge plan apply failed: ${chunkBZ5EXHZX_cjs.describeCause(translated)}`,
|
|
6878
6878
|
{ cause: translated }
|
|
6879
6879
|
);
|
|
6880
6880
|
}
|
|
@@ -6903,7 +6903,7 @@ async function merge(store, branchInputs, optionsInput = {}) {
|
|
|
6903
6903
|
);
|
|
6904
6904
|
}
|
|
6905
6905
|
async function validateForkPointVersions(forkPoint, branches) {
|
|
6906
|
-
const forkVersion = await
|
|
6906
|
+
const forkVersion = await chunkBZ5EXHZX_cjs.computeBaseVersion(forkPoint);
|
|
6907
6907
|
for (const branch2 of branches) {
|
|
6908
6908
|
if (branch2.base === forkVersion) continue;
|
|
6909
6909
|
return chunkPAHLRNPI_cjs.err(
|
|
@@ -6921,38 +6921,38 @@ function isRecordedForkPoint(forkPoint) {
|
|
|
6921
6921
|
}
|
|
6922
6922
|
async function assertRecordedForkPointAvailable(target, point) {
|
|
6923
6923
|
if (!target.historyEnabled || target.recordedTimeOwnership !== "typegraph-relations") {
|
|
6924
|
-
throw new
|
|
6924
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6925
6925
|
"A recorded fork point requires TypeGraph-owned history on the merge target.",
|
|
6926
6926
|
{ details: { capability: "recordedForkPoint" } }
|
|
6927
6927
|
);
|
|
6928
6928
|
}
|
|
6929
|
-
if (
|
|
6930
|
-
throw new
|
|
6929
|
+
if (chunkBZ5EXHZX_cjs.isLegacyBaseVersion(point.base)) {
|
|
6930
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
6931
6931
|
"The recorded fork point's base@V token was minted in a retired format.",
|
|
6932
6932
|
{
|
|
6933
6933
|
details: {
|
|
6934
6934
|
forkPointBase: point.base,
|
|
6935
|
-
reason:
|
|
6935
|
+
reason: chunkBZ5EXHZX_cjs.LEGACY_BASE_VERSION_REFUSAL.reason
|
|
6936
6936
|
},
|
|
6937
|
-
suggestion:
|
|
6937
|
+
suggestion: chunkBZ5EXHZX_cjs.LEGACY_BASE_VERSION_REFUSAL.suggestion
|
|
6938
6938
|
}
|
|
6939
6939
|
);
|
|
6940
6940
|
}
|
|
6941
6941
|
const parts = chunk66A2O6HX_cjs.parseRecordedInstant(point.recorded, "forkPoint.recorded");
|
|
6942
|
-
if (parts.kind !== "typegraph" || !
|
|
6943
|
-
throw new
|
|
6942
|
+
if (parts.kind !== "typegraph" || !chunkBZ5EXHZX_cjs.hasRevisionAnchor(point.base)) {
|
|
6943
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6944
6944
|
"A recorded fork point requires a TypeGraph-owned revision anchor.",
|
|
6945
6945
|
{ details: { capability: "recordedForkPoint" } }
|
|
6946
6946
|
);
|
|
6947
6947
|
}
|
|
6948
6948
|
const [currentBase, origin, currentRecorded] = await Promise.all([
|
|
6949
|
-
|
|
6949
|
+
chunkBZ5EXHZX_cjs.computeBaseVersion(target),
|
|
6950
6950
|
target.revisionOriginNow(),
|
|
6951
6951
|
target.recordedNow()
|
|
6952
6952
|
]);
|
|
6953
6953
|
const currentParts = currentRecorded === void 0 ? void 0 : chunk66A2O6HX_cjs.parseRecordedInstant(currentRecorded);
|
|
6954
|
-
if (
|
|
6955
|
-
throw new
|
|
6954
|
+
if (chunkBZ5EXHZX_cjs.revisionAnchorOf(point.base) !== point.recorded || chunkBZ5EXHZX_cjs.revisionOriginOf(point.base) !== origin || chunkBZ5EXHZX_cjs.schemaComponentOf(point.base) !== chunkBZ5EXHZX_cjs.schemaComponentOf(currentBase) || currentParts?.kind !== "typegraph" || currentParts.revision < parts.revision) {
|
|
6955
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
6956
6956
|
"The recorded fork point no longer identifies a retained revision of this graph under its current origin and schema.",
|
|
6957
6957
|
{
|
|
6958
6958
|
details: { forkPointBase: point.base, targetBase: currentBase }
|
|
@@ -6975,7 +6975,7 @@ async function prepareIncrementalForkPoint(forkPoint, target, branches) {
|
|
|
6975
6975
|
for (const branch2 of branches) {
|
|
6976
6976
|
if (branch2.base === forkPoint.base) continue;
|
|
6977
6977
|
return chunkPAHLRNPI_cjs.err(
|
|
6978
|
-
new
|
|
6978
|
+
new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
6979
6979
|
`Branch "${branch2.id}" did not fork from the supplied recorded fork point.`,
|
|
6980
6980
|
{
|
|
6981
6981
|
details: {
|
|
@@ -6995,8 +6995,8 @@ async function prepareIncrementalForkPoint(forkPoint, target, branches) {
|
|
|
6995
6995
|
});
|
|
6996
6996
|
} catch (error) {
|
|
6997
6997
|
return chunkPAHLRNPI_cjs.err(
|
|
6998
|
-
error instanceof
|
|
6999
|
-
`Unable to read the recorded fork point: ${
|
|
6998
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
6999
|
+
`Unable to read the recorded fork point: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
7000
7000
|
{ cause: error, details: { capability: "recordedForkPoint" } }
|
|
7001
7001
|
)
|
|
7002
7002
|
);
|
|
@@ -7013,7 +7013,7 @@ function edgeSchemaFor(target, kind) {
|
|
|
7013
7013
|
function analyzeRevalidatingWrite(schema, current, planned) {
|
|
7014
7014
|
const merged = { ...current, ...planned };
|
|
7015
7015
|
if (schema === void 0) {
|
|
7016
|
-
const storageWouldChange =
|
|
7016
|
+
const storageWouldChange = chunkBZ5EXHZX_cjs.canonicalizeProps(merged) !== chunkBZ5EXHZX_cjs.canonicalizeProps(current);
|
|
7017
7017
|
return {
|
|
7018
7018
|
status: "valid",
|
|
7019
7019
|
storageWouldChange,
|
|
@@ -7030,9 +7030,9 @@ function analyzeRevalidatingWrite(schema, current, planned) {
|
|
|
7030
7030
|
const normalizedMerged = mergedParsed.data;
|
|
7031
7031
|
return {
|
|
7032
7032
|
status: "valid",
|
|
7033
|
-
storageWouldChange:
|
|
7034
|
-
schemaWouldChange:
|
|
7035
|
-
stripsCurrentProps:
|
|
7033
|
+
storageWouldChange: chunkBZ5EXHZX_cjs.canonicalizeProps(normalizedMerged) !== chunkBZ5EXHZX_cjs.canonicalizeProps(current),
|
|
7034
|
+
schemaWouldChange: chunkBZ5EXHZX_cjs.canonicalizeProps(normalizedMerged) !== chunkBZ5EXHZX_cjs.canonicalizeProps(normalizedCurrent),
|
|
7035
|
+
stripsCurrentProps: chunkBZ5EXHZX_cjs.canonicalizeProps(normalizedCurrent) !== chunkBZ5EXHZX_cjs.canonicalizeProps(current)
|
|
7036
7036
|
};
|
|
7037
7037
|
}
|
|
7038
7038
|
function nodeProps2(node) {
|
|
@@ -7056,7 +7056,7 @@ function edgeProps(edge) {
|
|
|
7056
7056
|
var INCLUDE_TOMBSTONES = { temporalMode: "includeTombstones" };
|
|
7057
7057
|
function assertValidRevalidatingWrite(analysis, message, details) {
|
|
7058
7058
|
if (analysis.status === "invalid") {
|
|
7059
|
-
throw new
|
|
7059
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(message, { details });
|
|
7060
7060
|
}
|
|
7061
7061
|
}
|
|
7062
7062
|
function edgeWriteSignature(edge, plan) {
|
|
@@ -7068,7 +7068,7 @@ function edgeWriteSignature(edge, plan) {
|
|
|
7068
7068
|
from.id,
|
|
7069
7069
|
to.kind,
|
|
7070
7070
|
to.id,
|
|
7071
|
-
|
|
7071
|
+
chunkBZ5EXHZX_cjs.canonicalizeProps(edge.props)
|
|
7072
7072
|
]);
|
|
7073
7073
|
}
|
|
7074
7074
|
async function validateIncrementalNodeWrites(target, nodesApi, plan) {
|
|
@@ -7086,7 +7086,7 @@ async function validateIncrementalNodeWrites(target, nodesApi, plan) {
|
|
|
7086
7086
|
INCLUDE_TOMBSTONES
|
|
7087
7087
|
);
|
|
7088
7088
|
for (const [index, id] of ids.entries()) {
|
|
7089
|
-
currentByIdentity.set(
|
|
7089
|
+
currentByIdentity.set(chunkBZ5EXHZX_cjs.mergeKey(kind, id), rows[index]);
|
|
7090
7090
|
}
|
|
7091
7091
|
}
|
|
7092
7092
|
for (const write of writes) {
|
|
@@ -7095,7 +7095,7 @@ async function validateIncrementalNodeWrites(target, nodesApi, plan) {
|
|
|
7095
7095
|
continue;
|
|
7096
7096
|
}
|
|
7097
7097
|
if (current.meta.deletedAt !== void 0) {
|
|
7098
|
-
throw new
|
|
7098
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7099
7099
|
`mergeIncremental() would resurrect soft-deleted committed node "${write.id}" (kind "${write.kind}").`,
|
|
7100
7100
|
{ details: { id: write.id, kind: write.kind } }
|
|
7101
7101
|
);
|
|
@@ -7111,7 +7111,7 @@ async function validateIncrementalNodeWrites(target, nodesApi, plan) {
|
|
|
7111
7111
|
{ id: write.id, kind: write.kind }
|
|
7112
7112
|
);
|
|
7113
7113
|
if (analysis.stripsCurrentProps && analysis.schemaWouldChange) {
|
|
7114
|
-
throw new
|
|
7114
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7115
7115
|
`mergeIncremental() would update committed node "${write.id}" (kind "${write.kind}") but the write would strip existing props outside the active schema (lossy base update).`,
|
|
7116
7116
|
{ details: { id: write.id, kind: write.kind } }
|
|
7117
7117
|
);
|
|
@@ -7124,7 +7124,7 @@ async function validateIncrementalEdgeWrites(target, edgesApi, plan) {
|
|
|
7124
7124
|
const signature = edgeWriteSignature(edge, plan);
|
|
7125
7125
|
const existing = signatureById.get(edge.id);
|
|
7126
7126
|
if (existing !== void 0 && existing !== signature) {
|
|
7127
|
-
throw new
|
|
7127
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7128
7128
|
`mergeIncremental() would overwrite committed edge "${edge.id}" with multiple planned endpoint/prop shapes (edge.id collision).`,
|
|
7129
7129
|
{ details: { id: edge.id } }
|
|
7130
7130
|
);
|
|
@@ -7176,12 +7176,12 @@ async function validateIncrementalEdgeWrites(target, edgesApi, plan) {
|
|
|
7176
7176
|
continue;
|
|
7177
7177
|
}
|
|
7178
7178
|
if (row.meta.deletedAt !== void 0) {
|
|
7179
|
-
throw new
|
|
7179
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7180
7180
|
`mergeIncremental() would resurrect soft-deleted committed edge "${id}" (kind "${row.kind}").`,
|
|
7181
7181
|
{ details: { id, committedKind: row.kind } }
|
|
7182
7182
|
);
|
|
7183
7183
|
}
|
|
7184
|
-
throw new
|
|
7184
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7185
7185
|
`mergeIncremental() would overwrite committed edge "${id}" (kind "${row.kind}") with a different-kind edge "${chunkBXHAPCQG_cjs.requireDefined(plannedKindById.get(id))}" of the same id.`,
|
|
7186
7186
|
{
|
|
7187
7187
|
details: {
|
|
@@ -7199,7 +7199,7 @@ async function validateIncrementalEdgeWrites(target, edgesApi, plan) {
|
|
|
7199
7199
|
continue;
|
|
7200
7200
|
}
|
|
7201
7201
|
if (current.meta.deletedAt !== void 0) {
|
|
7202
|
-
throw new
|
|
7202
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7203
7203
|
`mergeIncremental() would resurrect soft-deleted committed edge "${edge.id}" (kind "${current.kind}").`,
|
|
7204
7204
|
{ details: { id: edge.id, committedKind: current.kind } }
|
|
7205
7205
|
);
|
|
@@ -7207,7 +7207,7 @@ async function validateIncrementalEdgeWrites(target, edgesApi, plan) {
|
|
|
7207
7207
|
const from = finalEdgeEndpoint(plan, edge.fromKind, edge.fromId);
|
|
7208
7208
|
const to = finalEdgeEndpoint(plan, edge.toKind, edge.toId);
|
|
7209
7209
|
if (current.fromId !== from.id || current.fromKind !== from.kind || current.toId !== to.id || current.toKind !== to.kind) {
|
|
7210
|
-
throw new
|
|
7210
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7211
7211
|
`mergeIncremental() would overwrite committed edge "${edge.id}" (kind "${edge.kind}") with different endpoints.`,
|
|
7212
7212
|
{ details: { id: edge.id, kind: edge.kind } }
|
|
7213
7213
|
);
|
|
@@ -7223,7 +7223,7 @@ async function validateIncrementalEdgeWrites(target, edgesApi, plan) {
|
|
|
7223
7223
|
{ id: edge.id, kind: edge.kind }
|
|
7224
7224
|
);
|
|
7225
7225
|
if (analysis.stripsCurrentProps && analysis.schemaWouldChange) {
|
|
7226
|
-
throw new
|
|
7226
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7227
7227
|
`mergeIncremental() would update committed edge "${edge.id}" (kind "${edge.kind}") but the write would strip existing props outside the active schema.`,
|
|
7228
7228
|
{ details: { id: edge.id, kind: edge.kind } }
|
|
7229
7229
|
);
|
|
@@ -7252,7 +7252,7 @@ async function collectBaseMatchKeys(lookupStore, guard) {
|
|
|
7252
7252
|
);
|
|
7253
7253
|
for (const base of matches) {
|
|
7254
7254
|
if (base !== void 0) {
|
|
7255
|
-
matched.add(
|
|
7255
|
+
matched.add(chunkBZ5EXHZX_cjs.mergeKeyOf(base));
|
|
7256
7256
|
}
|
|
7257
7257
|
}
|
|
7258
7258
|
}
|
|
@@ -7263,7 +7263,7 @@ async function collectBaseMatchKeys(lookupStore, guard) {
|
|
|
7263
7263
|
);
|
|
7264
7264
|
for (const perItem of matchesByItem) {
|
|
7265
7265
|
for (const base of perItem) {
|
|
7266
|
-
matched.add(
|
|
7266
|
+
matched.add(chunkBZ5EXHZX_cjs.mergeKeyOf(base));
|
|
7267
7267
|
}
|
|
7268
7268
|
}
|
|
7269
7269
|
}
|
|
@@ -7272,11 +7272,11 @@ async function collectBaseMatchKeys(lookupStore, guard) {
|
|
|
7272
7272
|
}
|
|
7273
7273
|
async function assertBaseResolutionStable(lookupStore, guard) {
|
|
7274
7274
|
const liveKeys = await collectBaseMatchKeys(lookupStore, guard);
|
|
7275
|
-
const appeared = [...liveKeys].filter((key) => !guard.plannedBaseMatchKeys.has(key)).sort((left, right) =>
|
|
7275
|
+
const appeared = [...liveKeys].filter((key) => !guard.plannedBaseMatchKeys.has(key)).sort((left, right) => chunkBZ5EXHZX_cjs.compareMergeKeys(left, right));
|
|
7276
7276
|
if (appeared.length === 0) {
|
|
7277
7277
|
return;
|
|
7278
7278
|
}
|
|
7279
|
-
throw new
|
|
7279
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
7280
7280
|
`mergeIncremental() resolved its branch additions against the target as of planning, but ${appeared.length} committed row(s) matching a branch addition's identity key (a unique constraint or block index) were inserted before the commit transaction. Committing the plan would create duplicate entities the base-source resolution would otherwise have collapsed.`,
|
|
7281
7281
|
{
|
|
7282
7282
|
details: { appeared },
|
|
@@ -7292,7 +7292,7 @@ function plannedNodeRefs(plan) {
|
|
|
7292
7292
|
})),
|
|
7293
7293
|
...[...plan.nodeDeletions].map(([identity, kind]) => ({
|
|
7294
7294
|
kind,
|
|
7295
|
-
id:
|
|
7295
|
+
id: chunkBZ5EXHZX_cjs.idOf(identity)
|
|
7296
7296
|
}))
|
|
7297
7297
|
];
|
|
7298
7298
|
}
|
|
@@ -7301,7 +7301,7 @@ function plannedEdgeRefs(plan) {
|
|
|
7301
7301
|
...plan.mergedEdges.map((edge) => ({ kind: edge.kind, id: edge.id })),
|
|
7302
7302
|
...[...plan.edgeDeletions].map(([identity, kind]) => ({
|
|
7303
7303
|
kind,
|
|
7304
|
-
id:
|
|
7304
|
+
id: chunkBZ5EXHZX_cjs.idOf(identity)
|
|
7305
7305
|
}))
|
|
7306
7306
|
];
|
|
7307
7307
|
}
|
|
@@ -7320,7 +7320,7 @@ async function capturePlannedTargetBaselines(target, plan, staged) {
|
|
|
7320
7320
|
);
|
|
7321
7321
|
for (const [index, id] of ids.entries()) {
|
|
7322
7322
|
const version = rows[index]?.meta.version;
|
|
7323
|
-
if (version !== void 0) nodes.set(
|
|
7323
|
+
if (version !== void 0) nodes.set(chunkBZ5EXHZX_cjs.mergeKey(kind, id), version);
|
|
7324
7324
|
}
|
|
7325
7325
|
}
|
|
7326
7326
|
for (const [kind, ids] of bucketMissingRefsByKind(
|
|
@@ -7335,8 +7335,8 @@ async function capturePlannedTargetBaselines(target, plan, staged) {
|
|
|
7335
7335
|
const row = rows[index];
|
|
7336
7336
|
if (row === void 0) continue;
|
|
7337
7337
|
edges.set(
|
|
7338
|
-
|
|
7339
|
-
|
|
7338
|
+
chunkBZ5EXHZX_cjs.mergeKey(kind, id),
|
|
7339
|
+
chunkBZ5EXHZX_cjs.edgeStateSignature({
|
|
7340
7340
|
fromKind: row.fromKind,
|
|
7341
7341
|
fromId: row.fromId,
|
|
7342
7342
|
toKind: row.toKind,
|
|
@@ -7353,7 +7353,7 @@ function bucketMissingRefsByKind(refs, present) {
|
|
|
7353
7353
|
const missing = /* @__PURE__ */ new Map();
|
|
7354
7354
|
const seen = /* @__PURE__ */ new Set();
|
|
7355
7355
|
for (const ref of refs) {
|
|
7356
|
-
const key =
|
|
7356
|
+
const key = chunkBZ5EXHZX_cjs.mergeKey(ref.kind, ref.id);
|
|
7357
7357
|
if (present.has(key) || seen.has(key)) continue;
|
|
7358
7358
|
seen.add(key);
|
|
7359
7359
|
const ids = missing.get(ref.kind) ?? [];
|
|
@@ -7366,7 +7366,7 @@ function bucketInheritedRefsByKind(refs, identities) {
|
|
|
7366
7366
|
const seen = /* @__PURE__ */ new Set();
|
|
7367
7367
|
const idsByKind = /* @__PURE__ */ new Map();
|
|
7368
7368
|
for (const ref of refs) {
|
|
7369
|
-
const identity =
|
|
7369
|
+
const identity = chunkBZ5EXHZX_cjs.mergeKey(ref.kind, ref.id);
|
|
7370
7370
|
if (!identities.has(identity) || seen.has(identity)) {
|
|
7371
7371
|
continue;
|
|
7372
7372
|
}
|
|
@@ -7385,7 +7385,7 @@ async function assertInheritedUnchanged(args) {
|
|
|
7385
7385
|
for (const [kind, ids] of idsByKind) {
|
|
7386
7386
|
const rows = await args.fetchRows(kind, ids);
|
|
7387
7387
|
for (const [index, id] of ids.entries()) {
|
|
7388
|
-
const expected = chunkBXHAPCQG_cjs.requireDefined(args.expected.get(
|
|
7388
|
+
const expected = chunkBXHAPCQG_cjs.requireDefined(args.expected.get(chunkBZ5EXHZX_cjs.mergeKey(kind, id)));
|
|
7389
7389
|
const current = args.deriveValue(rows[index]);
|
|
7390
7390
|
if (current === expected) {
|
|
7391
7391
|
continue;
|
|
@@ -7406,7 +7406,7 @@ async function assertInheritedNodesUnchanged(nodesApi, guard, plan) {
|
|
|
7406
7406
|
expected: guard.targetNodeVersions,
|
|
7407
7407
|
fetchRows: (kind, ids) => nodeCollection(nodesApi, kind).getByIds(ids, INCLUDE_TOMBSTONES),
|
|
7408
7408
|
deriveValue: (row) => row?.meta.version,
|
|
7409
|
-
buildError: (id, kind, expected, current) => new
|
|
7409
|
+
buildError: (id, kind, expected, current) => new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
7410
7410
|
`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.`,
|
|
7411
7411
|
{
|
|
7412
7412
|
details: {
|
|
@@ -7425,7 +7425,7 @@ async function assertInheritedEdgesUnchanged(edgesApi, guard, plan) {
|
|
|
7425
7425
|
refs: plannedEdgeRefs(plan),
|
|
7426
7426
|
expected: guard.targetEdgeSignatures,
|
|
7427
7427
|
fetchRows: (kind, ids) => edgeCollection(edgesApi, kind).getByIds(ids, INCLUDE_TOMBSTONES),
|
|
7428
|
-
deriveValue: (row) => row === void 0 ? void 0 :
|
|
7428
|
+
deriveValue: (row) => row === void 0 ? void 0 : chunkBZ5EXHZX_cjs.edgeStateSignature({
|
|
7429
7429
|
fromKind: row.fromKind,
|
|
7430
7430
|
fromId: row.fromId,
|
|
7431
7431
|
toKind: row.toKind,
|
|
@@ -7433,7 +7433,7 @@ async function assertInheritedEdgesUnchanged(edgesApi, guard, plan) {
|
|
|
7433
7433
|
live: row.meta.deletedAt === void 0,
|
|
7434
7434
|
props: edgeProps(row)
|
|
7435
7435
|
}),
|
|
7436
|
-
buildError: (id, kind) => new
|
|
7436
|
+
buildError: (id, kind) => new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
7437
7437
|
`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.`,
|
|
7438
7438
|
{
|
|
7439
7439
|
details: { id, kind },
|
|
@@ -7454,12 +7454,12 @@ async function assertForkPointUnchanged(precondition, session) {
|
|
|
7454
7454
|
const [origin, recorded, version] = await Promise.all([
|
|
7455
7455
|
chunkQV6LL3PK_cjs.readRevisionOrigin(session, target.revisionSchema, target.graphId),
|
|
7456
7456
|
chunkQV6LL3PK_cjs.readRecordedClock(session, target.revisionSchema, target.graphId),
|
|
7457
|
-
|
|
7457
|
+
chunkBZ5EXHZX_cjs.readActiveSchemaVersion(session, target.graphId)
|
|
7458
7458
|
]);
|
|
7459
7459
|
const pointParts = chunk66A2O6HX_cjs.parseRecordedInstant(point.recorded);
|
|
7460
7460
|
const recordedParts = recorded === void 0 ? void 0 : chunk66A2O6HX_cjs.parseRecordedInstant(recorded);
|
|
7461
|
-
if (pointParts.kind !== "typegraph" || recordedParts?.kind !== "typegraph" || recordedParts.revision < pointParts.revision || origin !==
|
|
7462
|
-
throw new
|
|
7461
|
+
if (pointParts.kind !== "typegraph" || recordedParts?.kind !== "typegraph" || recordedParts.revision < pointParts.revision || origin !== chunkBZ5EXHZX_cjs.revisionOriginOf(point.base) || version !== chunkBZ5EXHZX_cjs.schemaActiveVersionOf(point.base)) {
|
|
7462
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
7463
7463
|
"The recorded fork point is unavailable on the merge transaction's graph session.",
|
|
7464
7464
|
{ details: { forkPointBase: point.base } }
|
|
7465
7465
|
);
|
|
@@ -7467,9 +7467,9 @@ async function assertForkPointUnchanged(precondition, session) {
|
|
|
7467
7467
|
}
|
|
7468
7468
|
return;
|
|
7469
7469
|
}
|
|
7470
|
-
const liveVersion = await
|
|
7470
|
+
const liveVersion = await chunkBZ5EXHZX_cjs.computeBaseVersion(precondition.store);
|
|
7471
7471
|
if (liveVersion === precondition.version) return;
|
|
7472
|
-
throw new
|
|
7472
|
+
throw new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
7473
7473
|
"The mergeIncremental() fork point was modified between the fork-point precondition and the commit transaction; every branch diff was computed against the previous fork-point state, so the resolved plan was not applied.",
|
|
7474
7474
|
{
|
|
7475
7475
|
details: {
|
|
@@ -7482,7 +7482,7 @@ async function assertForkPointUnchanged(precondition, session) {
|
|
|
7482
7482
|
}
|
|
7483
7483
|
async function commitIncrementalPlan(target, plan, guard) {
|
|
7484
7484
|
if (!chunkQV6LL3PK_cjs.storeBackend(target).capabilities.execution.interactiveTransactions) {
|
|
7485
|
-
throw new
|
|
7485
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
7486
7486
|
"mergeIncremental() requires a transaction-capable target backend. Incremental writes must preflight existing rows and commit atomically; non-transactional fallback would allow partial graph writes.",
|
|
7487
7487
|
{ details: { capability: "execution.interactiveTransactions" } }
|
|
7488
7488
|
);
|
|
@@ -7499,7 +7499,7 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
7499
7499
|
graphId: target.graphId,
|
|
7500
7500
|
schemaVersion: target.introspect().schemaVersion,
|
|
7501
7501
|
graphLock: target.revisionTrackingEnabled ? "required" : "not-required",
|
|
7502
|
-
staleSchemaError: (cause) => new
|
|
7502
|
+
staleSchemaError: (cause) => new chunkBZ5EXHZX_cjs.BaseVersionMismatchError(
|
|
7503
7503
|
"The merge target schema changed before the incremental commit transaction; the resolved plan was not applied.",
|
|
7504
7504
|
{ cause }
|
|
7505
7505
|
)
|
|
@@ -7514,12 +7514,12 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
7514
7514
|
tx,
|
|
7515
7515
|
guard
|
|
7516
7516
|
);
|
|
7517
|
-
await
|
|
7517
|
+
await chunkBZ5EXHZX_cjs.assertPlannedIdentityIdsFresh(
|
|
7518
7518
|
target,
|
|
7519
7519
|
chunkQV6LL3PK_cjs.transactionBackend(tx),
|
|
7520
7520
|
plan
|
|
7521
7521
|
);
|
|
7522
|
-
await
|
|
7522
|
+
await chunkBZ5EXHZX_cjs.assertIdentityPeersStable(
|
|
7523
7523
|
target,
|
|
7524
7524
|
chunkQV6LL3PK_cjs.transactionBackend(tx),
|
|
7525
7525
|
guard.identityPeerProbe,
|
|
@@ -7556,8 +7556,8 @@ async function mergeIncremental(args) {
|
|
|
7556
7556
|
targetFence = await captureMergePlanTargetFence(target);
|
|
7557
7557
|
} catch (error) {
|
|
7558
7558
|
return chunkPAHLRNPI_cjs.err(
|
|
7559
|
-
error instanceof
|
|
7560
|
-
`Unable to capture the target's durable planning fence: ${
|
|
7559
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
7560
|
+
`Unable to capture the target's durable planning fence: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
7561
7561
|
{ cause: error }
|
|
7562
7562
|
)
|
|
7563
7563
|
);
|
|
@@ -7573,8 +7573,8 @@ async function mergeIncremental(args) {
|
|
|
7573
7573
|
}
|
|
7574
7574
|
const { store: forkStore, version: forkVersion } = prepared.data;
|
|
7575
7575
|
const [forkSchema, targetSchema] = await Promise.all([
|
|
7576
|
-
|
|
7577
|
-
|
|
7576
|
+
chunkBZ5EXHZX_cjs.computeSchemaComponent(forkStore),
|
|
7577
|
+
chunkBZ5EXHZX_cjs.computeSchemaComponent(target)
|
|
7578
7578
|
]);
|
|
7579
7579
|
if (forkSchema !== targetSchema) {
|
|
7580
7580
|
return chunkPAHLRNPI_cjs.err(incrementalSchemaError());
|
|
@@ -7616,7 +7616,7 @@ async function mergeIncremental(args) {
|
|
|
7616
7616
|
async function readCandidateIdentityClosure(store, target, input) {
|
|
7617
7617
|
const runtime = chunkQV6LL3PK_cjs.storeRuntime(store);
|
|
7618
7618
|
if (!chunkQV6LL3PK_cjs.hasScopedIdentityReads(runtime)) {
|
|
7619
|
-
throw new
|
|
7619
|
+
throw new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
7620
7620
|
"Candidate identity closure requires endpoint and assertion-ID scoped runtime reads.",
|
|
7621
7621
|
{ details: { reason: "scoped-identity-reads-unavailable" } }
|
|
7622
7622
|
);
|
|
@@ -7703,7 +7703,7 @@ async function readCandidateIdentityClosure(store, target, input) {
|
|
|
7703
7703
|
async function readStateIdentityProjection(store, target, initialReferences, assertionIds, includeDeletedEndpoints) {
|
|
7704
7704
|
const runtime = chunkQV6LL3PK_cjs.storeRuntime(store);
|
|
7705
7705
|
if (!chunkQV6LL3PK_cjs.hasScopedIdentityReads(runtime)) {
|
|
7706
|
-
throw new
|
|
7706
|
+
throw new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
7707
7707
|
"Candidate identity closure requires endpoint and assertion-ID scoped runtime reads.",
|
|
7708
7708
|
{ details: { reason: "scoped-identity-reads-unavailable" } }
|
|
7709
7709
|
);
|
|
@@ -7785,13 +7785,13 @@ async function readCandidateMatchIdentityOwners(target, writeSet) {
|
|
|
7785
7785
|
for (const edge of writeSet.edges) {
|
|
7786
7786
|
const registration = target.graph.edges[edge.kind];
|
|
7787
7787
|
if (registration === void 0) return void 0;
|
|
7788
|
-
const validatedProperties =
|
|
7788
|
+
const validatedProperties = chunkQJGQ3FN2_cjs.validateImportProperties(
|
|
7789
7789
|
edge.properties,
|
|
7790
7790
|
registration.type.schema,
|
|
7791
7791
|
"allow"
|
|
7792
7792
|
);
|
|
7793
7793
|
if (!validatedProperties.success) return void 0;
|
|
7794
|
-
const identity =
|
|
7794
|
+
const identity = chunkGLDGT3L3_cjs.resolveEdgeMatchIdentityStorage(
|
|
7795
7795
|
registration.matchIdentity,
|
|
7796
7796
|
{
|
|
7797
7797
|
fromKind: edge.from.kind,
|
|
@@ -7827,7 +7827,7 @@ function referenceKey(reference) {
|
|
|
7827
7827
|
function canonicalTimestamp(value) {
|
|
7828
7828
|
const timestamp = chunk3XJGYE66_cjs.canonicalizeDatabaseTimestamp(value);
|
|
7829
7829
|
if (timestamp === void 0) {
|
|
7830
|
-
throw new
|
|
7830
|
+
throw new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
7831
7831
|
"A committed candidate peer has an invalid stored timestamp."
|
|
7832
7832
|
);
|
|
7833
7833
|
}
|
|
@@ -7902,7 +7902,7 @@ async function sparseBaseDocument(target, writeSet, matchIdentityOwners) {
|
|
|
7902
7902
|
const readActive = backend.findActiveEdgesBySourceV1;
|
|
7903
7903
|
if (readActive === void 0) {
|
|
7904
7904
|
if (activeReads.size > 0)
|
|
7905
|
-
throw new
|
|
7905
|
+
throw new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
7906
7906
|
"Bounded oneActive planning requires an active-only source read."
|
|
7907
7907
|
);
|
|
7908
7908
|
} else {
|
|
@@ -7969,7 +7969,7 @@ async function sparseBaseDocument(target, writeSet, matchIdentityOwners) {
|
|
|
7969
7969
|
nodes.push({
|
|
7970
7970
|
kind: row.kind,
|
|
7971
7971
|
id: row.id,
|
|
7972
|
-
properties:
|
|
7972
|
+
properties: chunkBZ5EXHZX_cjs.parseRowProps(row.props),
|
|
7973
7973
|
validFrom: row.valid_from === void 0 ? null : canonicalTimestamp(row.valid_from),
|
|
7974
7974
|
...row.valid_to === void 0 ? {} : { validTo: canonicalTimestamp(row.valid_to) },
|
|
7975
7975
|
meta: {
|
|
@@ -7988,7 +7988,7 @@ async function sparseBaseDocument(target, writeSet, matchIdentityOwners) {
|
|
|
7988
7988
|
id: row.id,
|
|
7989
7989
|
from: { kind: row.from_kind, id: row.from_id },
|
|
7990
7990
|
to: { kind: row.to_kind, id: row.to_id },
|
|
7991
|
-
properties:
|
|
7991
|
+
properties: chunkBZ5EXHZX_cjs.parseRowProps(row.props),
|
|
7992
7992
|
validFrom: row.valid_from === void 0 ? null : canonicalTimestamp(row.valid_from),
|
|
7993
7993
|
...row.valid_to === void 0 ? {} : { validTo: canonicalTimestamp(row.valid_to) },
|
|
7994
7994
|
meta: {
|
|
@@ -8022,7 +8022,7 @@ async function sparseBaseDocument(target, writeSet, matchIdentityOwners) {
|
|
|
8022
8022
|
}
|
|
8023
8023
|
function assertIndependentBackend(targetBackend, candidateBackend) {
|
|
8024
8024
|
if (targetBackend === candidateBackend || chunkKT5UIJ3J_cjs.isBackendDerivedFrom(targetBackend, candidateBackend) || chunkKT5UIJ3J_cjs.isBackendDerivedFrom(candidateBackend, targetBackend) || chunkKT5UIJ3J_cjs.sharesSerializedTransactionResource(targetBackend, candidateBackend)) {
|
|
8025
|
-
throw new
|
|
8025
|
+
throw new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8026
8026
|
"The transient candidate backend must be independent of the target backend."
|
|
8027
8027
|
);
|
|
8028
8028
|
}
|
|
@@ -8041,22 +8041,22 @@ function sparseCandidateWorkingCopyStrategy(writeSet, makeBackend, matchIdentity
|
|
|
8041
8041
|
const backend = await makeBackend();
|
|
8042
8042
|
assertIndependentBackend(chunkQV6LL3PK_cjs.storeBackend(target), backend);
|
|
8043
8043
|
try {
|
|
8044
|
-
const [store] = await
|
|
8045
|
-
|
|
8044
|
+
const [store] = await chunkMPCF5XBW_cjs.createStoreWithSchema(
|
|
8045
|
+
chunkBZ5EXHZX_cjs.graphWithoutNodeUniqueness(target.graph),
|
|
8046
8046
|
backend,
|
|
8047
8047
|
{
|
|
8048
8048
|
revisionTracking: target.revisionTrackingEnabled,
|
|
8049
8049
|
revisionJournal: false
|
|
8050
8050
|
}
|
|
8051
8051
|
);
|
|
8052
|
-
const imported = await
|
|
8052
|
+
const imported = await chunkQJGQ3FN2_cjs.importGraph(store, document, {
|
|
8053
8053
|
onConflict: "error",
|
|
8054
8054
|
onUnknownProperty: "allow",
|
|
8055
8055
|
validateReferences: true,
|
|
8056
8056
|
refreshStatistics: false
|
|
8057
8057
|
});
|
|
8058
8058
|
if (!imported.success) {
|
|
8059
|
-
throw new
|
|
8059
|
+
throw new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8060
8060
|
"Unable to seed candidate peers into the transient staging store.",
|
|
8061
8061
|
{ details: { errors: imported.errors } }
|
|
8062
8062
|
);
|
|
@@ -8116,7 +8116,7 @@ var CandidateWriteSetSchema = zod.z.object({
|
|
|
8116
8116
|
target: CandidateWriteSetTargetSchema,
|
|
8117
8117
|
nodes: zod.z.array(candidateNodeSchema),
|
|
8118
8118
|
edges: zod.z.array(candidateEdgeSchema),
|
|
8119
|
-
identity:
|
|
8119
|
+
identity: chunkQJGQ3FN2_cjs.InterchangeIdentitySchema.optional()
|
|
8120
8120
|
});
|
|
8121
8121
|
async function captureCandidateWriteSetTarget(target) {
|
|
8122
8122
|
const activeSchema = await chunkQV6LL3PK_cjs.storeBackend(target).getActiveSchema(
|
|
@@ -8125,7 +8125,7 @@ async function captureCandidateWriteSetTarget(target) {
|
|
|
8125
8125
|
return {
|
|
8126
8126
|
graphId: target.graphId,
|
|
8127
8127
|
schemaVersion: activeSchema?.version ?? target.introspect().schemaVersion ?? 1,
|
|
8128
|
-
schemaHash: await
|
|
8128
|
+
schemaHash: await chunkBZ5EXHZX_cjs.computeSchemaComponent(target)
|
|
8129
8129
|
};
|
|
8130
8130
|
}
|
|
8131
8131
|
function captureCandidateWriteSetTargetForEvolution(target, evolutionPlan) {
|
|
@@ -8158,7 +8158,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8158
8158
|
const parsed = CandidateWriteSetSchema.safeParse(args.writeSet);
|
|
8159
8159
|
if (!parsed.success) {
|
|
8160
8160
|
return chunkPAHLRNPI_cjs.err(
|
|
8161
|
-
new
|
|
8161
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError("The candidate write set is malformed.", {
|
|
8162
8162
|
details: { issues: parsed.error.issues }
|
|
8163
8163
|
})
|
|
8164
8164
|
);
|
|
@@ -8169,7 +8169,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8169
8169
|
currentTarget = await captureCandidateWriteSetTarget(args.target);
|
|
8170
8170
|
} catch (error) {
|
|
8171
8171
|
return chunkPAHLRNPI_cjs.err(
|
|
8172
|
-
new
|
|
8172
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8173
8173
|
"Unable to capture the candidate target schema.",
|
|
8174
8174
|
{ cause: error }
|
|
8175
8175
|
)
|
|
@@ -8177,7 +8177,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8177
8177
|
}
|
|
8178
8178
|
if (!sameCandidateTarget(writeSet.target, currentTarget)) {
|
|
8179
8179
|
return chunkPAHLRNPI_cjs.err(
|
|
8180
|
-
new
|
|
8180
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8181
8181
|
"The candidate write set targets a different graph schema.",
|
|
8182
8182
|
{
|
|
8183
8183
|
details: { expected: currentTarget, received: writeSet.target },
|
|
@@ -8204,7 +8204,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8204
8204
|
}
|
|
8205
8205
|
} catch (error) {
|
|
8206
8206
|
return chunkPAHLRNPI_cjs.err(
|
|
8207
|
-
new
|
|
8207
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8208
8208
|
"Unable to read exact durable edge identity owners for candidate planning.",
|
|
8209
8209
|
{ cause: error }
|
|
8210
8210
|
)
|
|
@@ -8221,13 +8221,13 @@ async function planCandidateWriteSet(args) {
|
|
|
8221
8221
|
args.target,
|
|
8222
8222
|
args.makeBackend,
|
|
8223
8223
|
{
|
|
8224
|
-
id:
|
|
8224
|
+
id: chunkBZ5EXHZX_cjs.asBranchId(writeSet.sourceId)
|
|
8225
8225
|
},
|
|
8226
8226
|
sparse?.strategy
|
|
8227
8227
|
);
|
|
8228
8228
|
} catch (error) {
|
|
8229
8229
|
return chunkPAHLRNPI_cjs.err(
|
|
8230
|
-
new
|
|
8230
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8231
8231
|
"Unable to create the transient candidate staging store.",
|
|
8232
8232
|
{ cause: error }
|
|
8233
8233
|
)
|
|
@@ -8235,7 +8235,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8235
8235
|
}
|
|
8236
8236
|
if (chunkPAHLRNPI_cjs.isErr(created)) {
|
|
8237
8237
|
return chunkPAHLRNPI_cjs.err(
|
|
8238
|
-
new
|
|
8238
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8239
8239
|
"Unable to create the transient candidate staging store.",
|
|
8240
8240
|
{ cause: created.error }
|
|
8241
8241
|
)
|
|
@@ -8243,7 +8243,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8243
8243
|
}
|
|
8244
8244
|
const candidate = created.data;
|
|
8245
8245
|
try {
|
|
8246
|
-
const imported = await
|
|
8246
|
+
const imported = await chunkQJGQ3FN2_cjs.importGraph(
|
|
8247
8247
|
candidate,
|
|
8248
8248
|
interchangeDocument(writeSet),
|
|
8249
8249
|
{
|
|
@@ -8255,7 +8255,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8255
8255
|
);
|
|
8256
8256
|
if (!imported.success) {
|
|
8257
8257
|
return chunkPAHLRNPI_cjs.err(
|
|
8258
|
-
new
|
|
8258
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8259
8259
|
"The candidate write set could not be staged against the active schema.",
|
|
8260
8260
|
{ details: { errors: imported.errors } }
|
|
8261
8261
|
)
|
|
@@ -8270,7 +8270,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8270
8270
|
const identityScope = sparse?.identityScope();
|
|
8271
8271
|
if (bounded && args.target.graph.identity !== void 0 && identityScope === void 0) {
|
|
8272
8272
|
return chunkPAHLRNPI_cjs.err(
|
|
8273
|
-
new
|
|
8273
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8274
8274
|
"The bounded identity baseline was not captured."
|
|
8275
8275
|
)
|
|
8276
8276
|
);
|
|
@@ -8283,7 +8283,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8283
8283
|
if (boundedFence !== void 0 && planned.success) {
|
|
8284
8284
|
await assertPlanningFenceUnchanged(args.target, boundedFence);
|
|
8285
8285
|
if (!sameMergePlanTargetFence(boundedFence, planned.data.target)) {
|
|
8286
|
-
throw new
|
|
8286
|
+
throw new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8287
8287
|
"The bounded candidate baseline does not match the merge plan target fence."
|
|
8288
8288
|
);
|
|
8289
8289
|
}
|
|
@@ -8291,7 +8291,7 @@ async function planCandidateWriteSet(args) {
|
|
|
8291
8291
|
return planned;
|
|
8292
8292
|
} catch (error) {
|
|
8293
8293
|
return chunkPAHLRNPI_cjs.err(
|
|
8294
|
-
error instanceof
|
|
8294
|
+
error instanceof chunkBZ5EXHZX_cjs.CandidateWriteSetError || error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8295
8295
|
"Candidate write-set staging or planning failed.",
|
|
8296
8296
|
{ cause: error }
|
|
8297
8297
|
)
|
|
@@ -8307,7 +8307,7 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
8307
8307
|
const parsed = CandidateWriteSetSchema.safeParse(args.writeSet);
|
|
8308
8308
|
if (!parsed.success) {
|
|
8309
8309
|
return chunkPAHLRNPI_cjs.err(
|
|
8310
|
-
new
|
|
8310
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError("The candidate write set is malformed.", {
|
|
8311
8311
|
details: { issues: parsed.error.issues }
|
|
8312
8312
|
})
|
|
8313
8313
|
);
|
|
@@ -8325,7 +8325,7 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
8325
8325
|
planningFence = await captureMergePlanTargetFence(args.target);
|
|
8326
8326
|
} catch (error) {
|
|
8327
8327
|
return chunkPAHLRNPI_cjs.err(
|
|
8328
|
-
error instanceof
|
|
8328
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8329
8329
|
"Unable to prepare the planned evolution target schema.",
|
|
8330
8330
|
{ cause: error }
|
|
8331
8331
|
)
|
|
@@ -8333,7 +8333,7 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
8333
8333
|
}
|
|
8334
8334
|
if (!sameCandidateTarget(writeSet.target, expectedTarget)) {
|
|
8335
8335
|
return chunkPAHLRNPI_cjs.err(
|
|
8336
|
-
new
|
|
8336
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8337
8337
|
"The candidate write set targets a different planned evolution schema.",
|
|
8338
8338
|
{
|
|
8339
8339
|
details: { expected: expectedTarget, received: writeSet.target },
|
|
@@ -8345,11 +8345,11 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
8345
8345
|
let created;
|
|
8346
8346
|
try {
|
|
8347
8347
|
created = await ingestionBranch(resultingTarget, args.makeBackend, {
|
|
8348
|
-
id:
|
|
8348
|
+
id: chunkBZ5EXHZX_cjs.asBranchId(writeSet.sourceId)
|
|
8349
8349
|
});
|
|
8350
8350
|
} catch (error) {
|
|
8351
8351
|
return chunkPAHLRNPI_cjs.err(
|
|
8352
|
-
new
|
|
8352
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8353
8353
|
"Unable to create the transient candidate staging store.",
|
|
8354
8354
|
{ cause: error }
|
|
8355
8355
|
)
|
|
@@ -8357,7 +8357,7 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
8357
8357
|
}
|
|
8358
8358
|
if (chunkPAHLRNPI_cjs.isErr(created)) {
|
|
8359
8359
|
return chunkPAHLRNPI_cjs.err(
|
|
8360
|
-
new
|
|
8360
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8361
8361
|
"Unable to create the transient candidate staging store.",
|
|
8362
8362
|
{ cause: created.error }
|
|
8363
8363
|
)
|
|
@@ -8365,7 +8365,7 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
8365
8365
|
}
|
|
8366
8366
|
const candidate = created.data;
|
|
8367
8367
|
try {
|
|
8368
|
-
const imported = await
|
|
8368
|
+
const imported = await chunkQJGQ3FN2_cjs.importGraph(
|
|
8369
8369
|
candidate,
|
|
8370
8370
|
interchangeDocument(writeSet),
|
|
8371
8371
|
{
|
|
@@ -8377,7 +8377,7 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
8377
8377
|
);
|
|
8378
8378
|
if (!imported.success) {
|
|
8379
8379
|
return chunkPAHLRNPI_cjs.err(
|
|
8380
|
-
new
|
|
8380
|
+
new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8381
8381
|
"The candidate write set could not be staged against the planned evolution schema.",
|
|
8382
8382
|
{ details: { errors: imported.errors } }
|
|
8383
8383
|
)
|
|
@@ -8392,7 +8392,7 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
8392
8392
|
);
|
|
8393
8393
|
} catch (error) {
|
|
8394
8394
|
return chunkPAHLRNPI_cjs.err(
|
|
8395
|
-
error instanceof
|
|
8395
|
+
error instanceof chunkBZ5EXHZX_cjs.CandidateWriteSetError || error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.CandidateWriteSetError(
|
|
8396
8396
|
"Candidate write-set staging or evolution planning failed.",
|
|
8397
8397
|
{ cause: error }
|
|
8398
8398
|
)
|
|
@@ -8425,7 +8425,7 @@ function encodeOption(value, ancestors) {
|
|
|
8425
8425
|
if (typeof value === "number" && Number.isFinite(value))
|
|
8426
8426
|
return ["number", value];
|
|
8427
8427
|
if (typeof value !== "object" || ancestors.has(value)) {
|
|
8428
|
-
throw new
|
|
8428
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8429
8429
|
"Merge options contain unsupported or cyclic review evidence."
|
|
8430
8430
|
);
|
|
8431
8431
|
}
|
|
@@ -8449,7 +8449,7 @@ function encodeOption(value, ancestors) {
|
|
|
8449
8449
|
return ["map", entries];
|
|
8450
8450
|
}
|
|
8451
8451
|
if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {
|
|
8452
|
-
throw new
|
|
8452
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8453
8453
|
"Merge options contain a non-JSON object without a review representation."
|
|
8454
8454
|
);
|
|
8455
8455
|
}
|
|
@@ -8466,7 +8466,7 @@ function reviewRowKey(row) {
|
|
|
8466
8466
|
async function captureReviewBaseline(target) {
|
|
8467
8467
|
const backend = chunkQV6LL3PK_cjs.storeBackend(target);
|
|
8468
8468
|
const rows = [];
|
|
8469
|
-
const readNodes =
|
|
8469
|
+
const readNodes = chunkBZ5EXHZX_cjs.createGraphNodeKindReader(
|
|
8470
8470
|
backend,
|
|
8471
8471
|
target.graphId,
|
|
8472
8472
|
chunkOFN5YLUJ_cjs.getNodeKinds(target.graph)
|
|
@@ -8477,11 +8477,11 @@ async function captureReviewBaseline(target) {
|
|
|
8477
8477
|
role: "node",
|
|
8478
8478
|
kind,
|
|
8479
8479
|
id: row.id,
|
|
8480
|
-
digest: await reviewDigest({ ...row, props:
|
|
8480
|
+
digest: await reviewDigest({ ...row, props: chunkBZ5EXHZX_cjs.parseRowProps(row.props) })
|
|
8481
8481
|
});
|
|
8482
8482
|
}
|
|
8483
8483
|
}
|
|
8484
|
-
const readEdges =
|
|
8484
|
+
const readEdges = chunkBZ5EXHZX_cjs.createGraphEdgeKindReader(
|
|
8485
8485
|
backend,
|
|
8486
8486
|
target.graphId,
|
|
8487
8487
|
chunkOFN5YLUJ_cjs.getEdgeKinds(target.graph)
|
|
@@ -8492,7 +8492,7 @@ async function captureReviewBaseline(target) {
|
|
|
8492
8492
|
role: "edge",
|
|
8493
8493
|
kind,
|
|
8494
8494
|
id: row.id,
|
|
8495
|
-
digest: await reviewDigest({ ...row, props:
|
|
8495
|
+
digest: await reviewDigest({ ...row, props: chunkBZ5EXHZX_cjs.parseRowProps(row.props) })
|
|
8496
8496
|
});
|
|
8497
8497
|
}
|
|
8498
8498
|
}
|
|
@@ -8557,7 +8557,7 @@ async function captureReferencedReviewBaseline(target, rowReferences, identityRe
|
|
|
8557
8557
|
...reference,
|
|
8558
8558
|
digest: await reviewDigest({
|
|
8559
8559
|
...row,
|
|
8560
|
-
props:
|
|
8560
|
+
props: chunkBZ5EXHZX_cjs.parseRowProps(row.props)
|
|
8561
8561
|
})
|
|
8562
8562
|
}
|
|
8563
8563
|
);
|
|
@@ -8578,7 +8578,7 @@ async function captureReferencedReviewBaseline(target, rowReferences, identityRe
|
|
|
8578
8578
|
...reference,
|
|
8579
8579
|
digest: await reviewDigest({
|
|
8580
8580
|
...row,
|
|
8581
|
-
props:
|
|
8581
|
+
props: chunkBZ5EXHZX_cjs.parseRowProps(row.props)
|
|
8582
8582
|
})
|
|
8583
8583
|
} : reference
|
|
8584
8584
|
);
|
|
@@ -8619,7 +8619,7 @@ async function readReviewIdentityClosure(target, seedReferences, assertionIds) {
|
|
|
8619
8619
|
for (const reference of seedReferences) addReference(reference);
|
|
8620
8620
|
if (!chunkQV6LL3PK_cjs.hasScopedIdentityReads(runtime)) {
|
|
8621
8621
|
if (target.graph.identity !== void 0) {
|
|
8622
|
-
throw new
|
|
8622
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8623
8623
|
"Candidate-scoped identity review requires endpoint and assertion-ID scoped runtime reads.",
|
|
8624
8624
|
{ details: { reason: "scoped-identity-reads-unavailable" } }
|
|
8625
8625
|
);
|
|
@@ -8807,7 +8807,7 @@ async function planCandidateWriteSetReview(args) {
|
|
|
8807
8807
|
try {
|
|
8808
8808
|
const reviewScope = args.reviewScope;
|
|
8809
8809
|
if (reviewScope !== void 0 && reviewScope !== "candidate") {
|
|
8810
|
-
throw new
|
|
8810
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError("Unsupported candidate review scope.", {
|
|
8811
8811
|
details: { reviewScope }
|
|
8812
8812
|
});
|
|
8813
8813
|
}
|
|
@@ -8817,7 +8817,7 @@ async function planCandidateWriteSetReview(args) {
|
|
|
8817
8817
|
const startingFence = await captureMergePlanTargetFence(args.target);
|
|
8818
8818
|
const candidateScope = args.reviewScope === "candidate";
|
|
8819
8819
|
if (candidateScope && !canUseSparseCandidatePlanning(args.target)) {
|
|
8820
|
-
throw new
|
|
8820
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8821
8821
|
"Candidate-scoped review requires a revision-tracked target without unsupported cross-row constraints.",
|
|
8822
8822
|
{ details: { reason: "candidate-scope-ineligible" } }
|
|
8823
8823
|
);
|
|
@@ -8847,7 +8847,7 @@ async function planCandidateWriteSetReview(args) {
|
|
|
8847
8847
|
]
|
|
8848
8848
|
) : baselineBeforePlan;
|
|
8849
8849
|
if (baseline === void 0)
|
|
8850
|
-
throw new
|
|
8850
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError("Missing V1 review baseline.");
|
|
8851
8851
|
assertReviewPlanFence(startingFence, planned.data);
|
|
8852
8852
|
await assertPlanningFenceUnchanged(args.target, startingFence);
|
|
8853
8853
|
assertOptionsUnchanged(options, reviewOptionEvidence(args.options));
|
|
@@ -8882,14 +8882,14 @@ async function revalidateCandidateWriteSetReview(args) {
|
|
|
8882
8882
|
const options = reviewOptionEvidence(args.options);
|
|
8883
8883
|
const reviewedEvidenceMode = review.formatVersion === MERGE_REVIEW_FORMAT_VERSION_V1 ? "v1" : "v2";
|
|
8884
8884
|
if (reviewedEvidenceMode === "v2" && args.target.graph.identity !== void 0 && review.baseline.identityReferences === void 0) {
|
|
8885
|
-
throw new
|
|
8885
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8886
8886
|
"Identity-enabled V2 review evidence is missing its retained identity scope.",
|
|
8887
8887
|
{ details: { reason: "missing-identity-scope" } }
|
|
8888
8888
|
);
|
|
8889
8889
|
}
|
|
8890
8890
|
const startingFence = await captureMergePlanTargetFence(args.target);
|
|
8891
8891
|
if (review.formatVersion === MERGE_REVIEW_FORMAT_VERSION_V2 && startingFence.revision.revision === null) {
|
|
8892
|
-
throw new
|
|
8892
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8893
8893
|
"Candidate-scoped V2 review evidence requires revision tracking for exact revalidation.",
|
|
8894
8894
|
{ details: { reason: "revision-tracking-required" } }
|
|
8895
8895
|
);
|
|
@@ -8910,7 +8910,7 @@ async function revalidateCandidateWriteSetReview(args) {
|
|
|
8910
8910
|
review.plan,
|
|
8911
8911
|
args.target.graph
|
|
8912
8912
|
).rows.length !== review.baseline.rows.length) {
|
|
8913
|
-
throw new
|
|
8913
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8914
8914
|
"The merge review is missing required baseline evidence.",
|
|
8915
8915
|
{ details: { reason: "incomplete-baseline" } }
|
|
8916
8916
|
);
|
|
@@ -8927,7 +8927,7 @@ async function revalidateCandidateWriteSetReview(args) {
|
|
|
8927
8927
|
differences: policyDifferences
|
|
8928
8928
|
});
|
|
8929
8929
|
if (review.baseline.scope === "referenced" && !canUseSparseCandidatePlanning(args.target)) {
|
|
8930
|
-
throw new
|
|
8930
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8931
8931
|
"Scoped review evidence requires a revision-tracked graph without unsupported cross-row constraints.",
|
|
8932
8932
|
{ details: { reason: "candidate-scope-ineligible" } }
|
|
8933
8933
|
);
|
|
@@ -8988,13 +8988,13 @@ async function revalidateCandidateWriteSetReview(args) {
|
|
|
8988
8988
|
async function validateReview(input) {
|
|
8989
8989
|
const review = mergeReviewArtifactSchema.parse(input);
|
|
8990
8990
|
if (review.formatVersion === 1 && review.baseline.scope !== void 0 || review.formatVersion === MERGE_REVIEW_FORMAT_VERSION_V2 && review.baseline.scope !== "referenced") {
|
|
8991
|
-
throw new
|
|
8991
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8992
8992
|
"The review baseline scope does not match its format version.",
|
|
8993
8993
|
{ details: { reason: "invalid-baseline-scope" } }
|
|
8994
8994
|
);
|
|
8995
8995
|
}
|
|
8996
8996
|
if (reviewJson(input) !== reviewJson(review)) {
|
|
8997
|
-
throw new
|
|
8997
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
8998
8998
|
"Stored merge review evidence must not require normalization.",
|
|
8999
8999
|
{
|
|
9000
9000
|
details: { reason: "noncanonical-shape" }
|
|
@@ -9003,31 +9003,31 @@ async function validateReview(input) {
|
|
|
9003
9003
|
}
|
|
9004
9004
|
const { digest, ...content } = review;
|
|
9005
9005
|
if (digest.value !== await reviewDigest(content)) {
|
|
9006
|
-
throw new
|
|
9006
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
9007
9007
|
"The merge review digest does not match its content.",
|
|
9008
9008
|
{ details: { reason: "digest-mismatch" } }
|
|
9009
9009
|
);
|
|
9010
9010
|
}
|
|
9011
9011
|
const plan = await validateMergePlanArtifact(review.plan);
|
|
9012
9012
|
if (!plan.success)
|
|
9013
|
-
throw new
|
|
9013
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError("The reviewed execution plan is invalid.", {
|
|
9014
9014
|
details: { reason: "invalid-plan", error: plan.error }
|
|
9015
9015
|
});
|
|
9016
9016
|
const anchors = plan.artifact.anchors;
|
|
9017
9017
|
if (plan.artifact.mode !== "incremental" || anchors.kind !== "incremental" || anchors.forkPoint.graphId !== review.writeSet.target.graphId || plan.artifact.target.graphId !== review.writeSet.target.graphId || plan.artifact.target.schema.version !== review.writeSet.target.schemaVersion || plan.artifact.target.schema.hash !== review.writeSet.target.schemaHash || reviewJson(anchors.forkPoint.schema) !== reviewJson(plan.artifact.target.schema) || anchors.branches.length !== 1 || anchors.branches[0]?.branchId !== review.writeSet.sourceId || anchors.branches[0].baseVersion !== anchors.forkPoint.baseVersion) {
|
|
9018
|
-
throw new
|
|
9018
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
9019
9019
|
"The reviewed plan does not describe the retained candidate source and target.",
|
|
9020
9020
|
{ details: { reason: "incompatible-plan" } }
|
|
9021
9021
|
);
|
|
9022
9022
|
}
|
|
9023
9023
|
if (new Set(review.baseline.rows.map((row) => reviewRowKey(row))).size !== review.baseline.rows.length) {
|
|
9024
|
-
throw new
|
|
9024
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
9025
9025
|
"The merge review contains duplicate baseline references.",
|
|
9026
9026
|
{ details: { reason: "duplicate-baseline" } }
|
|
9027
9027
|
);
|
|
9028
9028
|
}
|
|
9029
9029
|
if (review.formatVersion === MERGE_REVIEW_FORMAT_VERSION_V2 && (review.baseline.scope !== "referenced" || review.baseline.identityReferences === void 0 !== (review.baseline.identityAssertionIds === void 0)) || review.formatVersion === MERGE_REVIEW_FORMAT_VERSION_V1 && (review.baseline.scope !== void 0 || review.baseline.identityReferences !== void 0 || review.baseline.identityAssertionIds !== void 0)) {
|
|
9030
|
-
throw new
|
|
9030
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError("The merge review identity scope is invalid.", {
|
|
9031
9031
|
details: { reason: "invalid-identity-scope" }
|
|
9032
9032
|
});
|
|
9033
9033
|
}
|
|
@@ -9035,14 +9035,14 @@ async function validateReview(input) {
|
|
|
9035
9035
|
}
|
|
9036
9036
|
function assertReviewPlanFence(fence, plan) {
|
|
9037
9037
|
if (!sameMergePlanTargetFence(fence, plan.target)) {
|
|
9038
|
-
throw new
|
|
9038
|
+
throw new chunkBZ5EXHZX_cjs.MergePlanningStaleError(
|
|
9039
9039
|
"The target changed between review evidence capture and planning."
|
|
9040
9040
|
);
|
|
9041
9041
|
}
|
|
9042
9042
|
}
|
|
9043
9043
|
function assertOptionsUnchanged(before, after) {
|
|
9044
9044
|
if (reviewJson(before) !== reviewJson(after))
|
|
9045
|
-
throw new
|
|
9045
|
+
throw new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
9046
9046
|
"Merge options changed while review evidence was being captured."
|
|
9047
9047
|
);
|
|
9048
9048
|
}
|
|
@@ -9074,7 +9074,7 @@ function compareFields(category, reviewed, current) {
|
|
|
9074
9074
|
return [.../* @__PURE__ */ new Set([...Object.keys(reviewed), ...Object.keys(current)])].sort().filter((key) => reviewJson(reviewed[key]) !== reviewJson(current[key])).map((key) => ({ category, path: `${category}.${key}` }));
|
|
9075
9075
|
}
|
|
9076
9076
|
function asReviewError(error) {
|
|
9077
|
-
return error instanceof
|
|
9077
|
+
return error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergeReviewError(
|
|
9078
9078
|
"Unable to validate or capture merge review evidence.",
|
|
9079
9079
|
{ cause: error }
|
|
9080
9080
|
);
|
|
@@ -9086,21 +9086,21 @@ async function applyDurableMergePlan(args) {
|
|
|
9086
9086
|
const options = args.options ?? {};
|
|
9087
9087
|
if ("merge" in strategy && strategy.merge !== void 0) {
|
|
9088
9088
|
return chunkPAHLRNPI_cjs.err(
|
|
9089
|
-
new
|
|
9089
|
+
new chunkBZ5EXHZX_cjs.MergeError(
|
|
9090
9090
|
"DurableWorkingCopyStrategy.merge is retired. Remove it and apply the plan through the target Store transaction."
|
|
9091
9091
|
)
|
|
9092
9092
|
);
|
|
9093
9093
|
}
|
|
9094
|
-
const refusal =
|
|
9094
|
+
const refusal = chunkBZ5EXHZX_cjs.durableDescriptorRefusal(descriptor, strategy);
|
|
9095
9095
|
if (refusal !== void 0) {
|
|
9096
9096
|
return chunkPAHLRNPI_cjs.err(
|
|
9097
|
-
new
|
|
9097
|
+
new chunkBZ5EXHZX_cjs.MergeError("Durable merge descriptor validation failed.", {
|
|
9098
9098
|
cause: refusal
|
|
9099
9099
|
})
|
|
9100
9100
|
);
|
|
9101
9101
|
}
|
|
9102
9102
|
let artifact;
|
|
9103
|
-
const descriptorOrigin =
|
|
9103
|
+
const descriptorOrigin = chunkBZ5EXHZX_cjs.durableOriginOfDescriptor(descriptor);
|
|
9104
9104
|
try {
|
|
9105
9105
|
artifact = await validateMergePlanForTarget(target, plan);
|
|
9106
9106
|
const branchOrigin = {
|
|
@@ -9113,8 +9113,8 @@ async function applyDurableMergePlan(args) {
|
|
|
9113
9113
|
forkRevision: branch2.forkRevision,
|
|
9114
9114
|
...branch2.recordedForkPoint === void 0 ? {} : { recordedForkPoint: branch2.recordedForkPoint }
|
|
9115
9115
|
};
|
|
9116
|
-
if (!
|
|
9117
|
-
throw new
|
|
9116
|
+
if (!chunkBZ5EXHZX_cjs.durableOriginsEqual(branchOrigin, descriptorOrigin)) {
|
|
9117
|
+
throw new chunkBZ5EXHZX_cjs.MergeError(
|
|
9118
9118
|
"The durable branch handle does not match the descriptor supplied for merge.",
|
|
9119
9119
|
{
|
|
9120
9120
|
details: {
|
|
@@ -9126,8 +9126,8 @@ async function applyDurableMergePlan(args) {
|
|
|
9126
9126
|
}
|
|
9127
9127
|
} catch (error) {
|
|
9128
9128
|
return chunkPAHLRNPI_cjs.err(
|
|
9129
|
-
error instanceof
|
|
9130
|
-
`Durable merge validation failed: ${
|
|
9129
|
+
error instanceof chunkBZ5EXHZX_cjs.MergeError ? error : new chunkBZ5EXHZX_cjs.MergeError(
|
|
9130
|
+
`Durable merge validation failed: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
9131
9131
|
{ cause: error }
|
|
9132
9132
|
)
|
|
9133
9133
|
);
|
|
@@ -9140,37 +9140,37 @@ var DURABLE_OPERATION_SCAN_DEFAULT_LIMIT = 100;
|
|
|
9140
9140
|
var DURABLE_OPERATION_SCAN_MAX_LIMIT = 1e3;
|
|
9141
9141
|
var OPERATION_DIGEST_BYTE_LENGTH = 16;
|
|
9142
9142
|
async function computeDurableOperationDigest(request) {
|
|
9143
|
-
const canonical =
|
|
9143
|
+
const canonical = chunkBZ5EXHZX_cjs.canonicalValueKey({
|
|
9144
9144
|
metadata: request.metadata,
|
|
9145
9145
|
mutation: request.mutation
|
|
9146
9146
|
});
|
|
9147
9147
|
return chunkZY4GXIVN_cjs.sha256Hex(canonical, OPERATION_DIGEST_BYTE_LENGTH);
|
|
9148
9148
|
}
|
|
9149
9149
|
function requireDescriptorOwner(descriptor, strategy) {
|
|
9150
|
-
const refusal =
|
|
9150
|
+
const refusal = chunkBZ5EXHZX_cjs.durableDescriptorRefusal(descriptor, strategy);
|
|
9151
9151
|
if (refusal !== void 0) {
|
|
9152
9152
|
return {
|
|
9153
9153
|
ok: false,
|
|
9154
|
-
error: new
|
|
9154
|
+
error: new chunkBZ5EXHZX_cjs.DurableOperationRequestError(
|
|
9155
9155
|
"Durable operation descriptor validation failed.",
|
|
9156
9156
|
{ cause: refusal }
|
|
9157
9157
|
)
|
|
9158
9158
|
};
|
|
9159
9159
|
}
|
|
9160
|
-
return { ok: true, origin:
|
|
9160
|
+
return { ok: true, origin: chunkBZ5EXHZX_cjs.durableOriginOfDescriptor(descriptor) };
|
|
9161
9161
|
}
|
|
9162
9162
|
async function normalizeOperationRequest(request) {
|
|
9163
9163
|
const rawRequest = request;
|
|
9164
9164
|
if (typeof rawRequest !== "object" || rawRequest === null || Array.isArray(rawRequest)) {
|
|
9165
9165
|
return chunkPAHLRNPI_cjs.err(
|
|
9166
|
-
new
|
|
9166
|
+
new chunkBZ5EXHZX_cjs.DurableOperationRequestError(
|
|
9167
9167
|
"Durable operation request must be a JSON object."
|
|
9168
9168
|
)
|
|
9169
9169
|
);
|
|
9170
9170
|
}
|
|
9171
9171
|
if (typeof request.idempotencyKey !== "string" || request.idempotencyKey.length === 0) {
|
|
9172
9172
|
return chunkPAHLRNPI_cjs.err(
|
|
9173
|
-
new
|
|
9173
|
+
new chunkBZ5EXHZX_cjs.DurableOperationRequestError(
|
|
9174
9174
|
"Durable operation request is malformed: idempotencyKey must be a non-empty string.",
|
|
9175
9175
|
{ details: { idempotencyKey: request.idempotencyKey } }
|
|
9176
9176
|
)
|
|
@@ -9181,8 +9181,8 @@ async function normalizeOperationRequest(request) {
|
|
|
9181
9181
|
chunkOFN5YLUJ_cjs.assertJsonValue(request.mutation, "mutation", "Durable operation");
|
|
9182
9182
|
} catch (error) {
|
|
9183
9183
|
return chunkPAHLRNPI_cjs.err(
|
|
9184
|
-
new
|
|
9185
|
-
`Durable operation request is not JSON-safe: ${
|
|
9184
|
+
new chunkBZ5EXHZX_cjs.DurableOperationRequestError(
|
|
9185
|
+
`Durable operation request is not JSON-safe: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
9186
9186
|
{ cause: error, details: { idempotencyKey: request.idempotencyKey } }
|
|
9187
9187
|
)
|
|
9188
9188
|
);
|
|
@@ -9197,7 +9197,7 @@ async function normalizeOperationRequest(request) {
|
|
|
9197
9197
|
async function normalizeStoredEvidence(evidence, expectedIdempotencyKey) {
|
|
9198
9198
|
if (typeof evidence !== "object" || evidence === null || Array.isArray(evidence)) {
|
|
9199
9199
|
return chunkPAHLRNPI_cjs.err(
|
|
9200
|
-
new
|
|
9200
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9201
9201
|
"Durable operation evidence must be a JSON object.",
|
|
9202
9202
|
{ details: { idempotencyKey: expectedIdempotencyKey } }
|
|
9203
9203
|
)
|
|
@@ -9206,7 +9206,7 @@ async function normalizeStoredEvidence(evidence, expectedIdempotencyKey) {
|
|
|
9206
9206
|
const record = evidence;
|
|
9207
9207
|
if (typeof record["idempotencyKey"] !== "string" || record["idempotencyKey"].length === 0) {
|
|
9208
9208
|
return chunkPAHLRNPI_cjs.err(
|
|
9209
|
-
new
|
|
9209
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9210
9210
|
"Durable operation evidence needs a non-empty idempotency key.",
|
|
9211
9211
|
{ details: { expectedKey: expectedIdempotencyKey } }
|
|
9212
9212
|
)
|
|
@@ -9214,7 +9214,7 @@ async function normalizeStoredEvidence(evidence, expectedIdempotencyKey) {
|
|
|
9214
9214
|
}
|
|
9215
9215
|
if (expectedIdempotencyKey !== void 0 && record["idempotencyKey"] !== expectedIdempotencyKey) {
|
|
9216
9216
|
return chunkPAHLRNPI_cjs.err(
|
|
9217
|
-
new
|
|
9217
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9218
9218
|
"Durable operation evidence does not carry the requested idempotency key.",
|
|
9219
9219
|
{
|
|
9220
9220
|
details: {
|
|
@@ -9227,7 +9227,7 @@ async function normalizeStoredEvidence(evidence, expectedIdempotencyKey) {
|
|
|
9227
9227
|
}
|
|
9228
9228
|
if (typeof record["operationDigest"] !== "string" || record["operationDigest"].length === 0) {
|
|
9229
9229
|
return chunkPAHLRNPI_cjs.err(
|
|
9230
|
-
new
|
|
9230
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9231
9231
|
"Durable operation evidence needs a non-empty operation digest.",
|
|
9232
9232
|
{ details: { idempotencyKey: record["idempotencyKey"] } }
|
|
9233
9233
|
)
|
|
@@ -9246,13 +9246,13 @@ async function normalizeStoredEvidence(evidence, expectedIdempotencyKey) {
|
|
|
9246
9246
|
);
|
|
9247
9247
|
} catch (error) {
|
|
9248
9248
|
return chunkPAHLRNPI_cjs.err(
|
|
9249
|
-
new
|
|
9250
|
-
`Durable operation evidence content is not JSON-safe: ${
|
|
9249
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9250
|
+
`Durable operation evidence content is not JSON-safe: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
9251
9251
|
{ cause: error, details: { idempotencyKey: record["idempotencyKey"] } }
|
|
9252
9252
|
)
|
|
9253
9253
|
);
|
|
9254
9254
|
}
|
|
9255
|
-
const refusal = validateCoordinates(record["before"], record, "before") ?? validateCoordinates(record["after"], record, "after") ?? (typeof record["delivered"] === "boolean" ? void 0 : new
|
|
9255
|
+
const refusal = validateCoordinates(record["before"], record, "before") ?? validateCoordinates(record["after"], record, "after") ?? (typeof record["delivered"] === "boolean" ? void 0 : new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9256
9256
|
"Durable operation evidence is missing its delivered flag.",
|
|
9257
9257
|
{ details: { idempotencyKey: record["idempotencyKey"] } }
|
|
9258
9258
|
));
|
|
@@ -9261,7 +9261,7 @@ async function normalizeStoredEvidence(evidence, expectedIdempotencyKey) {
|
|
|
9261
9261
|
const canonicalDigest = await computeDurableOperationDigest(normalized);
|
|
9262
9262
|
if (normalized.operationDigest !== canonicalDigest) {
|
|
9263
9263
|
return chunkPAHLRNPI_cjs.err(
|
|
9264
|
-
new
|
|
9264
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9265
9265
|
"Durable operation evidence digest disagrees with its canonical content.",
|
|
9266
9266
|
{
|
|
9267
9267
|
details: {
|
|
@@ -9283,7 +9283,7 @@ async function validateEvidenceForOperation(evidence, expected) {
|
|
|
9283
9283
|
if (chunkPAHLRNPI_cjs.isErr(normalized)) return normalized;
|
|
9284
9284
|
if (normalized.data.operationDigest !== expected.operationDigest) {
|
|
9285
9285
|
return chunkPAHLRNPI_cjs.err(
|
|
9286
|
-
new
|
|
9286
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9287
9287
|
"Durable operation evidence digest disagrees with the canonical request digest.",
|
|
9288
9288
|
{
|
|
9289
9289
|
details: {
|
|
@@ -9295,9 +9295,9 @@ async function validateEvidenceForOperation(evidence, expected) {
|
|
|
9295
9295
|
)
|
|
9296
9296
|
);
|
|
9297
9297
|
}
|
|
9298
|
-
if (
|
|
9298
|
+
if (chunkBZ5EXHZX_cjs.canonicalValueKey(normalized.data.metadata) !== chunkBZ5EXHZX_cjs.canonicalValueKey(expected.metadata) || chunkBZ5EXHZX_cjs.canonicalValueKey(normalized.data.mutation) !== chunkBZ5EXHZX_cjs.canonicalValueKey(expected.mutation)) {
|
|
9299
9299
|
return chunkPAHLRNPI_cjs.err(
|
|
9300
|
-
new
|
|
9300
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9301
9301
|
"Durable operation evidence does not echo the canonical request content.",
|
|
9302
9302
|
{ details: { idempotencyKey: expected.idempotencyKey } }
|
|
9303
9303
|
)
|
|
@@ -9318,7 +9318,7 @@ function isDurableOperationUnsupportedDimension(value) {
|
|
|
9318
9318
|
async function normalizeOperationOutcome(outcome, expected) {
|
|
9319
9319
|
if (typeof outcome !== "object" || outcome === null || Array.isArray(outcome)) {
|
|
9320
9320
|
return chunkPAHLRNPI_cjs.err(
|
|
9321
|
-
new
|
|
9321
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9322
9322
|
"Durable operation host returned a malformed outcome envelope.",
|
|
9323
9323
|
{ details: { idempotencyKey: expected.idempotencyKey } }
|
|
9324
9324
|
)
|
|
@@ -9334,7 +9334,7 @@ async function normalizeOperationOutcome(outcome, expected) {
|
|
|
9334
9334
|
const [firstDimension, ...remainingDimensions] = normalizedDimensions;
|
|
9335
9335
|
if (!Array.isArray(dimensions) || firstDimension === void 0 || normalizedDimensions.length !== dimensions.length || new Set(normalizedDimensions).size !== normalizedDimensions.length) {
|
|
9336
9336
|
return chunkPAHLRNPI_cjs.err(
|
|
9337
|
-
new
|
|
9337
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9338
9338
|
"Durable operation host returned malformed unsupported dimensions.",
|
|
9339
9339
|
{ details: { idempotencyKey: expected.idempotencyKey } }
|
|
9340
9340
|
)
|
|
@@ -9347,7 +9347,7 @@ async function normalizeOperationOutcome(outcome, expected) {
|
|
|
9347
9347
|
}
|
|
9348
9348
|
if (outcomeKind !== "applied" && outcomeKind !== "replayed") {
|
|
9349
9349
|
return chunkPAHLRNPI_cjs.err(
|
|
9350
|
-
new
|
|
9350
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9351
9351
|
"Durable operation host returned an unknown outcome.",
|
|
9352
9352
|
{
|
|
9353
9353
|
details: {
|
|
@@ -9365,7 +9365,7 @@ async function normalizeOperationOutcome(outcome, expected) {
|
|
|
9365
9365
|
if (chunkPAHLRNPI_cjs.isErr(evidence)) return evidence;
|
|
9366
9366
|
if (outcomeKind === "applied" && evidence.data.delivered) {
|
|
9367
9367
|
return chunkPAHLRNPI_cjs.err(
|
|
9368
|
-
new
|
|
9368
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9369
9369
|
"Newly applied durable operation evidence must be undelivered.",
|
|
9370
9370
|
{ details: { idempotencyKey: expected.idempotencyKey } }
|
|
9371
9371
|
)
|
|
@@ -9376,20 +9376,20 @@ async function normalizeOperationOutcome(outcome, expected) {
|
|
|
9376
9376
|
function validateCoordinates(coordinates, evidence, side) {
|
|
9377
9377
|
const idempotencyKey = evidence["idempotencyKey"];
|
|
9378
9378
|
if (typeof coordinates !== "object" || coordinates === null || Array.isArray(coordinates)) {
|
|
9379
|
-
return new
|
|
9379
|
+
return new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9380
9380
|
`Durable operation evidence ${side} coordinates are malformed.`,
|
|
9381
9381
|
{ details: { idempotencyKey, side } }
|
|
9382
9382
|
);
|
|
9383
9383
|
}
|
|
9384
9384
|
const record = coordinates;
|
|
9385
9385
|
if (typeof record["base"] !== "string" || record["base"].length === 0) {
|
|
9386
|
-
return new
|
|
9386
|
+
return new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9387
9387
|
`Durable operation evidence ${side} coordinates need a non-empty base.`,
|
|
9388
9388
|
{ details: { idempotencyKey, side } }
|
|
9389
9389
|
);
|
|
9390
9390
|
}
|
|
9391
9391
|
if (record["revision"] !== void 0 && (typeof record["revision"] !== "string" || record["revision"].length === 0)) {
|
|
9392
|
-
return new
|
|
9392
|
+
return new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9393
9393
|
`Durable operation evidence ${side} coordinates revision must be a non-empty string.`,
|
|
9394
9394
|
{ details: { idempotencyKey, side } }
|
|
9395
9395
|
);
|
|
@@ -9397,7 +9397,7 @@ function validateCoordinates(coordinates, evidence, side) {
|
|
|
9397
9397
|
return void 0;
|
|
9398
9398
|
}
|
|
9399
9399
|
function unsupportedError(member, strategyType) {
|
|
9400
|
-
return new
|
|
9400
|
+
return new chunkBZ5EXHZX_cjs.DurableOperationUnsupportedError(
|
|
9401
9401
|
`Durable strategy "${strategyType}" does not provide the "${member}" operation capability.`,
|
|
9402
9402
|
{
|
|
9403
9403
|
details: { strategyType, member },
|
|
@@ -9426,8 +9426,8 @@ async function operateDurableBranch(descriptor, strategy, request) {
|
|
|
9426
9426
|
return await normalizeOperationOutcome(outcome, normalized.data);
|
|
9427
9427
|
} catch (error) {
|
|
9428
9428
|
return chunkPAHLRNPI_cjs.err(
|
|
9429
|
-
error instanceof
|
|
9430
|
-
`Durable operation failed: ${
|
|
9429
|
+
error instanceof chunkBZ5EXHZX_cjs.DurableOperationError ? error : new chunkBZ5EXHZX_cjs.DurableOperationError(
|
|
9430
|
+
`Durable operation failed: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
9431
9431
|
{
|
|
9432
9432
|
cause: error,
|
|
9433
9433
|
details: { idempotencyKey: request.idempotencyKey }
|
|
@@ -9453,8 +9453,8 @@ async function getDurableOperation(descriptor, strategy, idempotencyKey) {
|
|
|
9453
9453
|
return await normalizeStoredEvidence(evidence, idempotencyKey);
|
|
9454
9454
|
} catch (error) {
|
|
9455
9455
|
return chunkPAHLRNPI_cjs.err(
|
|
9456
|
-
error instanceof
|
|
9457
|
-
`Failed to read durable operation "${idempotencyKey}": ${
|
|
9456
|
+
error instanceof chunkBZ5EXHZX_cjs.DurableOperationError ? error : new chunkBZ5EXHZX_cjs.DurableOperationError(
|
|
9457
|
+
`Failed to read durable operation "${idempotencyKey}": ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
9458
9458
|
{ cause: error, details: { idempotencyKey } }
|
|
9459
9459
|
)
|
|
9460
9460
|
);
|
|
@@ -9466,7 +9466,7 @@ async function scanDurableOperations(descriptor, strategy, options = {}) {
|
|
|
9466
9466
|
const limit = options.limit ?? DURABLE_OPERATION_SCAN_DEFAULT_LIMIT;
|
|
9467
9467
|
if (!Number.isInteger(limit) || limit < 1) {
|
|
9468
9468
|
return chunkPAHLRNPI_cjs.err(
|
|
9469
|
-
new
|
|
9469
|
+
new chunkBZ5EXHZX_cjs.DurableOperationRequestError(
|
|
9470
9470
|
"Durable operation scan limit must be a positive integer.",
|
|
9471
9471
|
{ details: { limit } }
|
|
9472
9472
|
)
|
|
@@ -9474,7 +9474,7 @@ async function scanDurableOperations(descriptor, strategy, options = {}) {
|
|
|
9474
9474
|
}
|
|
9475
9475
|
if (limit > DURABLE_OPERATION_SCAN_MAX_LIMIT) {
|
|
9476
9476
|
return chunkPAHLRNPI_cjs.err(
|
|
9477
|
-
new
|
|
9477
|
+
new chunkBZ5EXHZX_cjs.DurableOperationRequestError(
|
|
9478
9478
|
`Durable operation scan limit ${limit} exceeds the maximum of ${DURABLE_OPERATION_SCAN_MAX_LIMIT}.`,
|
|
9479
9479
|
{
|
|
9480
9480
|
details: { limit, max: DURABLE_OPERATION_SCAN_MAX_LIMIT },
|
|
@@ -9496,7 +9496,7 @@ async function scanDurableOperations(descriptor, strategy, options = {}) {
|
|
|
9496
9496
|
});
|
|
9497
9497
|
if (typeof rawPage !== "object" || rawPage === null || Array.isArray(rawPage)) {
|
|
9498
9498
|
return chunkPAHLRNPI_cjs.err(
|
|
9499
|
-
new
|
|
9499
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9500
9500
|
"Durable operation scan returned a malformed page.",
|
|
9501
9501
|
{ details: { limit } }
|
|
9502
9502
|
)
|
|
@@ -9508,7 +9508,7 @@ async function scanDurableOperations(descriptor, strategy, options = {}) {
|
|
|
9508
9508
|
const hasMore = page["hasMore"];
|
|
9509
9509
|
if (!Array.isArray(rawOperations) || rawOperations.length > limit || typeof hasMore !== "boolean" || hasMore && (rawOperations.length === 0 || cursor === void 0) || rawOperations.length > 0 && cursor === void 0 || rawOperations.length > 0 && cursor === options.after || rawOperations.length === 0 && cursor !== options.after || cursor !== void 0 && (typeof cursor !== "string" || cursor.length === 0)) {
|
|
9510
9510
|
return chunkPAHLRNPI_cjs.err(
|
|
9511
|
-
new
|
|
9511
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9512
9512
|
"Durable operation scan returned a malformed page.",
|
|
9513
9513
|
{ details: { limit } }
|
|
9514
9514
|
)
|
|
@@ -9525,8 +9525,8 @@ async function scanDurableOperations(descriptor, strategy, options = {}) {
|
|
|
9525
9525
|
);
|
|
9526
9526
|
} catch (error) {
|
|
9527
9527
|
return chunkPAHLRNPI_cjs.err(
|
|
9528
|
-
error instanceof
|
|
9529
|
-
`Failed to scan durable operations: ${
|
|
9528
|
+
error instanceof chunkBZ5EXHZX_cjs.DurableOperationError ? error : new chunkBZ5EXHZX_cjs.DurableOperationError(
|
|
9529
|
+
`Failed to scan durable operations: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
9530
9530
|
{ cause: error, details: { limit } }
|
|
9531
9531
|
)
|
|
9532
9532
|
);
|
|
@@ -9550,7 +9550,7 @@ async function markDurableOperationDelivered(descriptor, strategy, idempotencyKe
|
|
|
9550
9550
|
if (chunkPAHLRNPI_cjs.isErr(normalized)) return normalized;
|
|
9551
9551
|
if (!normalized.data.delivered) {
|
|
9552
9552
|
return chunkPAHLRNPI_cjs.err(
|
|
9553
|
-
new
|
|
9553
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9554
9554
|
"Durable operation delivery marking returned undelivered evidence.",
|
|
9555
9555
|
{ details: { idempotencyKey } }
|
|
9556
9556
|
)
|
|
@@ -9559,8 +9559,8 @@ async function markDurableOperationDelivered(descriptor, strategy, idempotencyKe
|
|
|
9559
9559
|
return normalized;
|
|
9560
9560
|
} catch (error) {
|
|
9561
9561
|
return chunkPAHLRNPI_cjs.err(
|
|
9562
|
-
error instanceof
|
|
9563
|
-
`Failed to mark durable operation "${idempotencyKey}" delivered: ${
|
|
9562
|
+
error instanceof chunkBZ5EXHZX_cjs.DurableOperationError ? error : new chunkBZ5EXHZX_cjs.DurableOperationError(
|
|
9563
|
+
`Failed to mark durable operation "${idempotencyKey}" delivered: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
9564
9564
|
{ cause: error, details: { idempotencyKey } }
|
|
9565
9565
|
)
|
|
9566
9566
|
);
|
|
@@ -9579,14 +9579,14 @@ async function durableBranchHasUndeliveredEvidence(descriptor, strategy) {
|
|
|
9579
9579
|
expectedOrigin: owner.origin
|
|
9580
9580
|
});
|
|
9581
9581
|
return typeof hasUndelivered === "boolean" ? chunkPAHLRNPI_cjs.ok(hasUndelivered) : chunkPAHLRNPI_cjs.err(
|
|
9582
|
-
new
|
|
9582
|
+
new chunkBZ5EXHZX_cjs.DurableOperationEvidenceError(
|
|
9583
9583
|
"Durable operation undelivered query returned a non-boolean value."
|
|
9584
9584
|
)
|
|
9585
9585
|
);
|
|
9586
9586
|
} catch (error) {
|
|
9587
9587
|
return chunkPAHLRNPI_cjs.err(
|
|
9588
|
-
error instanceof
|
|
9589
|
-
`Failed to query undelivered durable evidence: ${
|
|
9588
|
+
error instanceof chunkBZ5EXHZX_cjs.DurableOperationError ? error : new chunkBZ5EXHZX_cjs.DurableOperationError(
|
|
9589
|
+
`Failed to query undelivered durable evidence: ${chunkBZ5EXHZX_cjs.describeCause(error)}`,
|
|
9590
9590
|
{ cause: error }
|
|
9591
9591
|
)
|
|
9592
9592
|
);
|
|
@@ -9597,13 +9597,13 @@ async function durableBranchHasUndeliveredEvidence(descriptor, strategy) {
|
|
|
9597
9597
|
async function branchForEvolution(store, plan, makeBackend, options) {
|
|
9598
9598
|
try {
|
|
9599
9599
|
const candidate = evolutionPlanningTarget(store, plan);
|
|
9600
|
-
const strategy = options?.revisionJournal === false ?
|
|
9601
|
-
const result = await
|
|
9600
|
+
const strategy = options?.revisionJournal === false ? chunkBZ5EXHZX_cjs.cloneWorkingCopyStrategy(makeBackend, { revisionJournal: false }) : void 0;
|
|
9601
|
+
const result = await chunkBZ5EXHZX_cjs.branch(candidate, makeBackend, options, strategy);
|
|
9602
9602
|
return result;
|
|
9603
9603
|
} catch (error) {
|
|
9604
|
-
if (error instanceof
|
|
9604
|
+
if (error instanceof chunkBZ5EXHZX_cjs.MergePlanCapabilityError) return chunkPAHLRNPI_cjs.err(error);
|
|
9605
9605
|
return chunkPAHLRNPI_cjs.err(
|
|
9606
|
-
new
|
|
9606
|
+
new chunkBZ5EXHZX_cjs.MergePlanCapabilityError(
|
|
9607
9607
|
"Could not fork a resulting-schema branch.",
|
|
9608
9608
|
{ cause: error, details: { capability: "evolutionBranch" } }
|
|
9609
9609
|
)
|
|
@@ -9639,7 +9639,7 @@ function vectorStorageOf(backend) {
|
|
|
9639
9639
|
function assertDefaultTables(backend) {
|
|
9640
9640
|
const fulltextStrategy = backend.fulltextStrategy;
|
|
9641
9641
|
if (backend.dialect !== "postgres" || vectorStorageOf(backend) === "custom" || fulltextStrategy !== void 0 && fulltextStrategy !== chunkBB4B6AJK_cjs.tsvectorStrategy) {
|
|
9642
|
-
throw new
|
|
9642
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9643
9643
|
"Namespace fork supports bundled PostgreSQL tables with the bundled pgvector and tsvector storage only."
|
|
9644
9644
|
);
|
|
9645
9645
|
}
|
|
@@ -9655,7 +9655,7 @@ function assertMatchingVectorStorage(graph, sourceBackend, targetBackend) {
|
|
|
9655
9655
|
const source = vectorStorageOf(sourceBackend);
|
|
9656
9656
|
const target = vectorStorageOf(targetBackend);
|
|
9657
9657
|
if (source !== target) {
|
|
9658
|
-
throw new
|
|
9658
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9659
9659
|
`Namespace fork needs the same vector storage on source and target for this graph's embedding fields; the source has ${source} and the target has ${target}.`
|
|
9660
9660
|
);
|
|
9661
9661
|
}
|
|
@@ -9664,7 +9664,7 @@ function assertMatchingFulltextStorage(sourceBackend, targetBackend) {
|
|
|
9664
9664
|
const source = hasFulltextStorage(sourceBackend);
|
|
9665
9665
|
const target = hasFulltextStorage(targetBackend);
|
|
9666
9666
|
if (source !== target) {
|
|
9667
|
-
throw new
|
|
9667
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9668
9668
|
`Namespace fork needs the same fulltext storage on source and target; the source has fulltext ${source ? "enabled" : "disabled"} and the target has it ${target ? "enabled" : "disabled"}.`
|
|
9669
9669
|
);
|
|
9670
9670
|
}
|
|
@@ -9693,7 +9693,7 @@ function assertDefaultNameMap(names) {
|
|
|
9693
9693
|
const expectedByKey = new Map(Object.entries(chunkCPKUXFVW_cjs.defaultPostgresTableNames));
|
|
9694
9694
|
for (const [key, actual] of Object.entries(names)) {
|
|
9695
9695
|
if (actual !== expectedByKey.get(key)) {
|
|
9696
|
-
throw new
|
|
9696
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9697
9697
|
`Namespace fork cannot copy custom table mapping ${key}.`
|
|
9698
9698
|
);
|
|
9699
9699
|
}
|
|
@@ -9705,7 +9705,7 @@ async function columns(session, table) {
|
|
|
9705
9705
|
chunkXPSPDFKO_cjs.sql`SELECT column_name FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = ${table} AND is_generated = 'NEVER' ORDER BY ordinal_position`
|
|
9706
9706
|
);
|
|
9707
9707
|
if (rows.length === 0)
|
|
9708
|
-
throw new
|
|
9708
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9709
9709
|
`Namespace fork requires relation ${table} in the bundled PostgreSQL schema.`
|
|
9710
9710
|
);
|
|
9711
9711
|
return rows.map((row) => row.column_name);
|
|
@@ -9739,7 +9739,7 @@ async function digestGraph(session, graph, relationTables) {
|
|
|
9739
9739
|
return chunkZY4GXIVN_cjs.sha256Hex(JSON.stringify(digests), 32);
|
|
9740
9740
|
}
|
|
9741
9741
|
function vectorIndexSlot(declaration, graphId) {
|
|
9742
|
-
const { concurrent: _concurrent, ...slot } =
|
|
9742
|
+
const { concurrent: _concurrent, ...slot } = chunkMPCF5XBW_cjs.vectorIndexParams(
|
|
9743
9743
|
declaration,
|
|
9744
9744
|
graphId,
|
|
9745
9745
|
false
|
|
@@ -9749,7 +9749,7 @@ function vectorIndexSlot(declaration, graphId) {
|
|
|
9749
9749
|
function declarationsByStatusKey(graph) {
|
|
9750
9750
|
return new Map(
|
|
9751
9751
|
(graph.indexes ?? []).map((declaration) => [
|
|
9752
|
-
|
|
9752
|
+
chunkMPCF5XBW_cjs.indexMaterializationStatusKey(declaration, graph.id),
|
|
9753
9753
|
declaration
|
|
9754
9754
|
])
|
|
9755
9755
|
);
|
|
@@ -9772,7 +9772,7 @@ function materializedIndexes(graph, rows) {
|
|
|
9772
9772
|
const statusKey = row["index_name"];
|
|
9773
9773
|
const declaration = typeof statusKey === "string" ? declarations.get(statusKey) : void 0;
|
|
9774
9774
|
if (declaration === void 0)
|
|
9775
|
-
throw new
|
|
9775
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9776
9776
|
`Namespace fork cannot resolve materialized index ${String(statusKey)} against this graph's declarations.`
|
|
9777
9777
|
);
|
|
9778
9778
|
return {
|
|
@@ -9789,7 +9789,7 @@ async function assertPhysicalIndexes(session, graph, rows) {
|
|
|
9789
9789
|
const present = new Set(physical.map((row) => row.indexname));
|
|
9790
9790
|
for (const { physicalName } of materializedIndexes(graph, rows)) {
|
|
9791
9791
|
if (!present.has(physicalName)) {
|
|
9792
|
-
throw new
|
|
9792
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9793
9793
|
`Target database lacks materialized graph index ${physicalName}; prepare it with prepareNamespaceForkTarget.`
|
|
9794
9794
|
);
|
|
9795
9795
|
}
|
|
@@ -9807,7 +9807,7 @@ async function assertSupportedContributions(targetSession, graph, rows) {
|
|
|
9807
9807
|
const vectorTables = vectorRelations(graph);
|
|
9808
9808
|
for (const row of rows) {
|
|
9809
9809
|
if (!isForkableContribution(row, vectorTables)) {
|
|
9810
|
-
throw new
|
|
9810
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9811
9811
|
"Namespace fork can copy only bundled tsvector and pgvector contribution tables."
|
|
9812
9812
|
);
|
|
9813
9813
|
}
|
|
@@ -9816,7 +9816,7 @@ async function assertSupportedContributions(targetSession, graph, rows) {
|
|
|
9816
9816
|
const present = await presentRelations(targetSession, required);
|
|
9817
9817
|
for (const table of required) {
|
|
9818
9818
|
if (!present.has(table))
|
|
9819
|
-
throw new
|
|
9819
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9820
9820
|
`Target database lacks contribution table ${table}; prepare it with prepareNamespaceForkTarget.`
|
|
9821
9821
|
);
|
|
9822
9822
|
}
|
|
@@ -9832,7 +9832,7 @@ async function assertEmpty(session, graph, relationTables) {
|
|
|
9832
9832
|
chunkXPSPDFKO_cjs.sql`SELECT EXISTS(SELECT 1 FROM ${chunkXPSPDFKO_cjs.sql.identifier(table)} WHERE graph_id = ${graph.id}) AS present`
|
|
9833
9833
|
);
|
|
9834
9834
|
if (rows[0]?.present !== false)
|
|
9835
|
-
throw new
|
|
9835
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9836
9836
|
"Namespace fork target already contains this graph; use the same operation key to retry."
|
|
9837
9837
|
);
|
|
9838
9838
|
}
|
|
@@ -9841,7 +9841,7 @@ async function insertRows(session, table, rows) {
|
|
|
9841
9841
|
if (rows.length === 0) return;
|
|
9842
9842
|
const names = await columns(session, table);
|
|
9843
9843
|
if (!names.includes("graph_id"))
|
|
9844
|
-
throw new
|
|
9844
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9845
9845
|
`Namespace fork relation ${table} is not graph-scoped.`
|
|
9846
9846
|
);
|
|
9847
9847
|
const selected = chunkXPSPDFKO_cjs.sql.join(
|
|
@@ -9861,13 +9861,13 @@ function proofFromLedger(row, operationKey) {
|
|
|
9861
9861
|
try {
|
|
9862
9862
|
decodedBase = JSON.parse(row.source_base);
|
|
9863
9863
|
} catch (error) {
|
|
9864
|
-
throw new
|
|
9864
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9865
9865
|
"Namespace fork operation ledger contains an invalid base token.",
|
|
9866
9866
|
{ cause: error }
|
|
9867
9867
|
);
|
|
9868
9868
|
}
|
|
9869
9869
|
if (typeof decodedBase !== "string") {
|
|
9870
|
-
throw new
|
|
9870
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9871
9871
|
"Namespace fork operation ledger contains an invalid base token."
|
|
9872
9872
|
);
|
|
9873
9873
|
}
|
|
@@ -9887,10 +9887,10 @@ async function assertRecordedAnchor(session, store, expectedBase, message) {
|
|
|
9887
9887
|
const [origin, revision, activeVersion] = await Promise.all([
|
|
9888
9888
|
chunkQV6LL3PK_cjs.readRevisionOrigin(session, store.revisionSchema, store.graphId),
|
|
9889
9889
|
chunkQV6LL3PK_cjs.readRecordedClock(session, store.revisionSchema, store.graphId),
|
|
9890
|
-
|
|
9890
|
+
chunkBZ5EXHZX_cjs.readActiveSchemaVersion(session, store.graphId)
|
|
9891
9891
|
]);
|
|
9892
|
-
if (origin !==
|
|
9893
|
-
throw new
|
|
9892
|
+
if (origin !== chunkBZ5EXHZX_cjs.revisionOriginOf(expectedBase) || revision !== chunkBZ5EXHZX_cjs.revisionAnchorOf(expectedBase) || activeVersion !== chunkBZ5EXHZX_cjs.schemaActiveVersionOf(expectedBase)) {
|
|
9893
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(message);
|
|
9894
9894
|
}
|
|
9895
9895
|
}
|
|
9896
9896
|
function namespaceForkResult(store, targetBackend, proof) {
|
|
@@ -9910,7 +9910,7 @@ function namespaceForkResult(store, targetBackend, proof) {
|
|
|
9910
9910
|
}
|
|
9911
9911
|
const ledgerProof = proofFromLedger(ledger[0], proof.operationKey);
|
|
9912
9912
|
if (ledger[0].graph_id !== proof.graphId || ledgerProof.sourceBase !== proof.sourceBase || ledger[0].content_digest !== proof.contentDigest || await digestGraph(targetTx, store.graph, relationTables) !== proof.contentDigest) {
|
|
9913
|
-
throw new
|
|
9913
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9914
9914
|
"Namespace fork abort found a changed target namespace."
|
|
9915
9915
|
);
|
|
9916
9916
|
}
|
|
@@ -9955,7 +9955,7 @@ async function assertIndependentDatabase(sourceTx, targetBackend, graphId) {
|
|
|
9955
9955
|
chunkXPSPDFKO_cjs.sql`SELECT pg_try_advisory_xact_lock(hashtext(${graphId}), hashtext(${aliasKey})) AS acquired`
|
|
9956
9956
|
);
|
|
9957
9957
|
if (aliasProbe[0]?.acquired !== true) {
|
|
9958
|
-
throw new
|
|
9958
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9959
9959
|
"Namespace fork target connects to the source database; allocate an independent database."
|
|
9960
9960
|
);
|
|
9961
9961
|
}
|
|
@@ -9971,7 +9971,7 @@ async function prepareNamespaceForkTarget(source, targetBackend) {
|
|
|
9971
9971
|
assertMatchingFulltextStorage(sourceBackend, targetBackend);
|
|
9972
9972
|
const executeDdl = targetBackend.executeDdl;
|
|
9973
9973
|
if (executeDdl === void 0)
|
|
9974
|
-
throw new
|
|
9974
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
9975
9975
|
"Namespace fork target does not support owner-side provisioning."
|
|
9976
9976
|
);
|
|
9977
9977
|
await executeDdl(`CREATE TABLE IF NOT EXISTS ${FORK_LEDGER} (
|
|
@@ -9998,12 +9998,12 @@ async function prepareNamespaceForkTarget(source, targetBackend) {
|
|
|
9998
9998
|
continue;
|
|
9999
9999
|
}
|
|
10000
10000
|
if (declaration.method === "trigram")
|
|
10001
|
-
await
|
|
10001
|
+
await chunkMPCF5XBW_cjs.ensureTrigramExtension(targetBackend);
|
|
10002
10002
|
await executeDdl(
|
|
10003
10003
|
chunkDZZVOKL7_cjs.generateIndexDDL(
|
|
10004
10004
|
declaration,
|
|
10005
10005
|
targetBackend.dialect,
|
|
10006
|
-
|
|
10006
|
+
chunkMPCF5XBW_cjs.relationalIndexDdlOptions(targetBackend, false)
|
|
10007
10007
|
)
|
|
10008
10008
|
);
|
|
10009
10009
|
}
|
|
@@ -10014,15 +10014,15 @@ async function assertForkLedgerInstalled(targetBackend) {
|
|
|
10014
10014
|
chunkXPSPDFKO_cjs.sql`SELECT to_regclass(${FORK_LEDGER}) IS NOT NULL AS present`
|
|
10015
10015
|
);
|
|
10016
10016
|
if (rows[0]?.present !== true)
|
|
10017
|
-
throw new
|
|
10017
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10018
10018
|
"Namespace fork retry ledger is missing; prepare the target with prepareNamespaceForkTarget before runtime use."
|
|
10019
10019
|
);
|
|
10020
10020
|
}
|
|
10021
10021
|
async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
10022
10022
|
if (operationKey.length === 0)
|
|
10023
|
-
throw new
|
|
10023
|
+
throw new chunkBZ5EXHZX_cjs.BranchError("Namespace fork operation key must be nonempty.");
|
|
10024
10024
|
if (!source.historyEnabled || !source.revisionTrackingEnabled) {
|
|
10025
|
-
throw new
|
|
10025
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10026
10026
|
"Namespace fork requires a history-enabled source store with revision tracking."
|
|
10027
10027
|
);
|
|
10028
10028
|
}
|
|
@@ -10035,17 +10035,17 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
10035
10035
|
assertMatchingFulltextStorage(sourceBackend, targetBackend);
|
|
10036
10036
|
assertDefaultNameMap(source.revisionSchema.tables);
|
|
10037
10037
|
const relationTables = forkRelationTables(sourceBackend);
|
|
10038
|
-
const targetStore =
|
|
10038
|
+
const targetStore = chunkMPCF5XBW_cjs.createStore(
|
|
10039
10039
|
source.graph,
|
|
10040
10040
|
targetBackend,
|
|
10041
10041
|
targetStoreOptions(source)
|
|
10042
10042
|
);
|
|
10043
10043
|
if (sourceBackend === targetBackend)
|
|
10044
|
-
throw new
|
|
10044
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10045
10045
|
"Namespace fork target must be an independent backend."
|
|
10046
10046
|
);
|
|
10047
10047
|
if (chunkKT5UIJ3J_cjs.isBackendDerivedFrom(sourceBackend, targetBackend) || chunkKT5UIJ3J_cjs.isBackendDerivedFrom(targetBackend, sourceBackend) || chunkKT5UIJ3J_cjs.sharesSerializedTransactionResource(sourceBackend, targetBackend)) {
|
|
10048
|
-
throw new
|
|
10048
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10049
10049
|
"Namespace fork source and target share one backend transaction resource."
|
|
10050
10050
|
);
|
|
10051
10051
|
}
|
|
@@ -10067,7 +10067,7 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
10067
10067
|
);
|
|
10068
10068
|
const row = locked[0];
|
|
10069
10069
|
if (row?.graph_id !== source.graphId)
|
|
10070
|
-
throw new
|
|
10070
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10071
10071
|
"Namespace fork operation key no longer belongs to this graph."
|
|
10072
10072
|
);
|
|
10073
10073
|
const proof2 = proofFromLedger(row, operationKey);
|
|
@@ -10078,7 +10078,7 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
10078
10078
|
"Namespace fork retry found an invalid source base token on target."
|
|
10079
10079
|
);
|
|
10080
10080
|
if (await digestGraph(targetTx, source.graph, relationTables) !== proof2.contentDigest)
|
|
10081
|
-
throw new
|
|
10081
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10082
10082
|
"Namespace fork retry found a changed target namespace."
|
|
10083
10083
|
);
|
|
10084
10084
|
return proof2;
|
|
@@ -10088,7 +10088,7 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
10088
10088
|
const result = namespaceForkResult(targetStore, targetBackend, ledgerProof);
|
|
10089
10089
|
return result;
|
|
10090
10090
|
}
|
|
10091
|
-
const stampedBase = await
|
|
10091
|
+
const stampedBase = await chunkBZ5EXHZX_cjs.computeBaseVersion(source);
|
|
10092
10092
|
const proof = await sourceBackend.transaction(
|
|
10093
10093
|
async (sourceTx) => {
|
|
10094
10094
|
const isolation = await queryRows(
|
|
@@ -10096,7 +10096,7 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
10096
10096
|
chunkXPSPDFKO_cjs.sql`SHOW transaction_isolation`
|
|
10097
10097
|
);
|
|
10098
10098
|
if (isolation[0]?.transaction_isolation !== "repeatable read" && isolation[0]?.transaction_isolation !== "serializable") {
|
|
10099
|
-
throw new
|
|
10099
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10100
10100
|
"Namespace fork source transaction did not obtain repeatable-read isolation."
|
|
10101
10101
|
);
|
|
10102
10102
|
}
|
|
@@ -10157,7 +10157,7 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
10157
10157
|
relationTables
|
|
10158
10158
|
);
|
|
10159
10159
|
if (targetDigest !== snapshotDigest)
|
|
10160
|
-
throw new
|
|
10160
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10161
10161
|
"Namespace fork target validation disagrees with the source snapshot."
|
|
10162
10162
|
);
|
|
10163
10163
|
const copied = await queryRows(
|
|
@@ -10166,7 +10166,7 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
10166
10166
|
);
|
|
10167
10167
|
const entry = copied[0];
|
|
10168
10168
|
if (entry === void 0)
|
|
10169
|
-
throw new
|
|
10169
|
+
throw new chunkBZ5EXHZX_cjs.BranchError(
|
|
10170
10170
|
"Namespace fork operation ledger did not return its proof."
|
|
10171
10171
|
);
|
|
10172
10172
|
return proofFromLedger(entry, operationKey);
|
|
@@ -10179,167 +10179,167 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
10179
10179
|
|
|
10180
10180
|
Object.defineProperty(exports, "BaseVersionMismatchError", {
|
|
10181
10181
|
enumerable: true,
|
|
10182
|
-
get: function () { return
|
|
10182
|
+
get: function () { return chunkBZ5EXHZX_cjs.BaseVersionMismatchError; }
|
|
10183
10183
|
});
|
|
10184
10184
|
Object.defineProperty(exports, "BranchError", {
|
|
10185
10185
|
enumerable: true,
|
|
10186
|
-
get: function () { return
|
|
10186
|
+
get: function () { return chunkBZ5EXHZX_cjs.BranchError; }
|
|
10187
10187
|
});
|
|
10188
10188
|
Object.defineProperty(exports, "CandidateSourceError", {
|
|
10189
10189
|
enumerable: true,
|
|
10190
|
-
get: function () { return
|
|
10190
|
+
get: function () { return chunkBZ5EXHZX_cjs.CandidateSourceError; }
|
|
10191
10191
|
});
|
|
10192
10192
|
Object.defineProperty(exports, "CandidateWriteSetError", {
|
|
10193
10193
|
enumerable: true,
|
|
10194
|
-
get: function () { return
|
|
10194
|
+
get: function () { return chunkBZ5EXHZX_cjs.CandidateWriteSetError; }
|
|
10195
10195
|
});
|
|
10196
10196
|
Object.defineProperty(exports, "DurableEvidenceUndeliveredError", {
|
|
10197
10197
|
enumerable: true,
|
|
10198
|
-
get: function () { return
|
|
10198
|
+
get: function () { return chunkBZ5EXHZX_cjs.DurableEvidenceUndeliveredError; }
|
|
10199
10199
|
});
|
|
10200
10200
|
Object.defineProperty(exports, "DurableOperationConflictError", {
|
|
10201
10201
|
enumerable: true,
|
|
10202
|
-
get: function () { return
|
|
10202
|
+
get: function () { return chunkBZ5EXHZX_cjs.DurableOperationConflictError; }
|
|
10203
10203
|
});
|
|
10204
10204
|
Object.defineProperty(exports, "DurableOperationError", {
|
|
10205
10205
|
enumerable: true,
|
|
10206
|
-
get: function () { return
|
|
10206
|
+
get: function () { return chunkBZ5EXHZX_cjs.DurableOperationError; }
|
|
10207
10207
|
});
|
|
10208
10208
|
Object.defineProperty(exports, "DurableOperationEvidenceError", {
|
|
10209
10209
|
enumerable: true,
|
|
10210
|
-
get: function () { return
|
|
10210
|
+
get: function () { return chunkBZ5EXHZX_cjs.DurableOperationEvidenceError; }
|
|
10211
10211
|
});
|
|
10212
10212
|
Object.defineProperty(exports, "DurableOperationRequestError", {
|
|
10213
10213
|
enumerable: true,
|
|
10214
|
-
get: function () { return
|
|
10214
|
+
get: function () { return chunkBZ5EXHZX_cjs.DurableOperationRequestError; }
|
|
10215
10215
|
});
|
|
10216
10216
|
Object.defineProperty(exports, "DurableOperationUnsupportedError", {
|
|
10217
10217
|
enumerable: true,
|
|
10218
|
-
get: function () { return
|
|
10218
|
+
get: function () { return chunkBZ5EXHZX_cjs.DurableOperationUnsupportedError; }
|
|
10219
10219
|
});
|
|
10220
10220
|
Object.defineProperty(exports, "IdentityMergeConflictError", {
|
|
10221
10221
|
enumerable: true,
|
|
10222
|
-
get: function () { return
|
|
10222
|
+
get: function () { return chunkBZ5EXHZX_cjs.IdentityMergeConflictError; }
|
|
10223
10223
|
});
|
|
10224
10224
|
Object.defineProperty(exports, "InvalidMergeOptionsError", {
|
|
10225
10225
|
enumerable: true,
|
|
10226
|
-
get: function () { return
|
|
10226
|
+
get: function () { return chunkBZ5EXHZX_cjs.InvalidMergeOptionsError; }
|
|
10227
10227
|
});
|
|
10228
10228
|
Object.defineProperty(exports, "InvalidMergePlanError", {
|
|
10229
10229
|
enumerable: true,
|
|
10230
|
-
get: function () { return
|
|
10230
|
+
get: function () { return chunkBZ5EXHZX_cjs.InvalidMergePlanError; }
|
|
10231
10231
|
});
|
|
10232
10232
|
Object.defineProperty(exports, "MERGE_ERROR_CODES", {
|
|
10233
10233
|
enumerable: true,
|
|
10234
|
-
get: function () { return
|
|
10234
|
+
get: function () { return chunkBZ5EXHZX_cjs.MERGE_ERROR_CODES; }
|
|
10235
10235
|
});
|
|
10236
10236
|
Object.defineProperty(exports, "MatchEvidenceError", {
|
|
10237
10237
|
enumerable: true,
|
|
10238
|
-
get: function () { return
|
|
10238
|
+
get: function () { return chunkBZ5EXHZX_cjs.MatchEvidenceError; }
|
|
10239
10239
|
});
|
|
10240
10240
|
Object.defineProperty(exports, "MergeConflictError", {
|
|
10241
10241
|
enumerable: true,
|
|
10242
|
-
get: function () { return
|
|
10242
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergeConflictError; }
|
|
10243
10243
|
});
|
|
10244
10244
|
Object.defineProperty(exports, "MergeConstraintConflictError", {
|
|
10245
10245
|
enumerable: true,
|
|
10246
|
-
get: function () { return
|
|
10246
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergeConstraintConflictError; }
|
|
10247
10247
|
});
|
|
10248
10248
|
Object.defineProperty(exports, "MergeError", {
|
|
10249
10249
|
enumerable: true,
|
|
10250
|
-
get: function () { return
|
|
10250
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergeError; }
|
|
10251
10251
|
});
|
|
10252
10252
|
Object.defineProperty(exports, "MergePlanCapabilityError", {
|
|
10253
10253
|
enumerable: true,
|
|
10254
|
-
get: function () { return
|
|
10254
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergePlanCapabilityError; }
|
|
10255
10255
|
});
|
|
10256
10256
|
Object.defineProperty(exports, "MergePlanDigestMismatchError", {
|
|
10257
10257
|
enumerable: true,
|
|
10258
|
-
get: function () { return
|
|
10258
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergePlanDigestMismatchError; }
|
|
10259
10259
|
});
|
|
10260
10260
|
Object.defineProperty(exports, "MergePlanOriginMismatchError", {
|
|
10261
10261
|
enumerable: true,
|
|
10262
|
-
get: function () { return
|
|
10262
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergePlanOriginMismatchError; }
|
|
10263
10263
|
});
|
|
10264
10264
|
Object.defineProperty(exports, "MergePlanSchemaMismatchError", {
|
|
10265
10265
|
enumerable: true,
|
|
10266
|
-
get: function () { return
|
|
10266
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergePlanSchemaMismatchError; }
|
|
10267
10267
|
});
|
|
10268
10268
|
Object.defineProperty(exports, "MergePlanTargetMismatchError", {
|
|
10269
10269
|
enumerable: true,
|
|
10270
|
-
get: function () { return
|
|
10270
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergePlanTargetMismatchError; }
|
|
10271
10271
|
});
|
|
10272
10272
|
Object.defineProperty(exports, "MergePlanningStaleError", {
|
|
10273
10273
|
enumerable: true,
|
|
10274
|
-
get: function () { return
|
|
10274
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergePlanningStaleError; }
|
|
10275
10275
|
});
|
|
10276
10276
|
Object.defineProperty(exports, "MergeReviewError", {
|
|
10277
10277
|
enumerable: true,
|
|
10278
|
-
get: function () { return
|
|
10278
|
+
get: function () { return chunkBZ5EXHZX_cjs.MergeReviewError; }
|
|
10279
10279
|
});
|
|
10280
10280
|
Object.defineProperty(exports, "SimilarityUnavailableError", {
|
|
10281
10281
|
enumerable: true,
|
|
10282
|
-
get: function () { return
|
|
10282
|
+
get: function () { return chunkBZ5EXHZX_cjs.SimilarityUnavailableError; }
|
|
10283
10283
|
});
|
|
10284
10284
|
Object.defineProperty(exports, "StaleMergePlanError", {
|
|
10285
10285
|
enumerable: true,
|
|
10286
|
-
get: function () { return
|
|
10286
|
+
get: function () { return chunkBZ5EXHZX_cjs.StaleMergePlanError; }
|
|
10287
10287
|
});
|
|
10288
10288
|
Object.defineProperty(exports, "UnsupportedMergePlanVersionError", {
|
|
10289
10289
|
enumerable: true,
|
|
10290
|
-
get: function () { return
|
|
10290
|
+
get: function () { return chunkBZ5EXHZX_cjs.UnsupportedMergePlanVersionError; }
|
|
10291
10291
|
});
|
|
10292
10292
|
Object.defineProperty(exports, "VALIDITY_END_TARGET_PRECEDENCE", {
|
|
10293
10293
|
enumerable: true,
|
|
10294
|
-
get: function () { return
|
|
10294
|
+
get: function () { return chunkBZ5EXHZX_cjs.VALIDITY_END_TARGET_PRECEDENCE; }
|
|
10295
10295
|
});
|
|
10296
10296
|
Object.defineProperty(exports, "asBaseVersion", {
|
|
10297
10297
|
enumerable: true,
|
|
10298
|
-
get: function () { return
|
|
10298
|
+
get: function () { return chunkBZ5EXHZX_cjs.asBaseVersion; }
|
|
10299
10299
|
});
|
|
10300
10300
|
Object.defineProperty(exports, "asBranchId", {
|
|
10301
10301
|
enumerable: true,
|
|
10302
|
-
get: function () { return
|
|
10302
|
+
get: function () { return chunkBZ5EXHZX_cjs.asBranchId; }
|
|
10303
10303
|
});
|
|
10304
10304
|
Object.defineProperty(exports, "branch", {
|
|
10305
10305
|
enumerable: true,
|
|
10306
|
-
get: function () { return
|
|
10306
|
+
get: function () { return chunkBZ5EXHZX_cjs.branch; }
|
|
10307
10307
|
});
|
|
10308
10308
|
Object.defineProperty(exports, "branchDurable", {
|
|
10309
10309
|
enumerable: true,
|
|
10310
|
-
get: function () { return
|
|
10310
|
+
get: function () { return chunkBZ5EXHZX_cjs.branchDurable; }
|
|
10311
10311
|
});
|
|
10312
10312
|
Object.defineProperty(exports, "cloneWorkingCopyStrategy", {
|
|
10313
10313
|
enumerable: true,
|
|
10314
|
-
get: function () { return
|
|
10314
|
+
get: function () { return chunkBZ5EXHZX_cjs.cloneWorkingCopyStrategy; }
|
|
10315
10315
|
});
|
|
10316
10316
|
Object.defineProperty(exports, "computeBaseVersion", {
|
|
10317
10317
|
enumerable: true,
|
|
10318
|
-
get: function () { return
|
|
10318
|
+
get: function () { return chunkBZ5EXHZX_cjs.computeBaseVersion; }
|
|
10319
10319
|
});
|
|
10320
10320
|
Object.defineProperty(exports, "destroyDurableBranch", {
|
|
10321
10321
|
enumerable: true,
|
|
10322
|
-
get: function () { return
|
|
10322
|
+
get: function () { return chunkBZ5EXHZX_cjs.destroyDurableBranch; }
|
|
10323
10323
|
});
|
|
10324
10324
|
Object.defineProperty(exports, "durableDescriptorRefusal", {
|
|
10325
10325
|
enumerable: true,
|
|
10326
|
-
get: function () { return
|
|
10326
|
+
get: function () { return chunkBZ5EXHZX_cjs.durableDescriptorRefusal; }
|
|
10327
10327
|
});
|
|
10328
10328
|
Object.defineProperty(exports, "durableOriginOfDescriptor", {
|
|
10329
10329
|
enumerable: true,
|
|
10330
|
-
get: function () { return
|
|
10330
|
+
get: function () { return chunkBZ5EXHZX_cjs.durableOriginOfDescriptor; }
|
|
10331
10331
|
});
|
|
10332
10332
|
Object.defineProperty(exports, "durableOriginsEqual", {
|
|
10333
10333
|
enumerable: true,
|
|
10334
|
-
get: function () { return
|
|
10334
|
+
get: function () { return chunkBZ5EXHZX_cjs.durableOriginsEqual; }
|
|
10335
10335
|
});
|
|
10336
10336
|
Object.defineProperty(exports, "forkedWorkingCopyStrategy", {
|
|
10337
10337
|
enumerable: true,
|
|
10338
|
-
get: function () { return
|
|
10338
|
+
get: function () { return chunkBZ5EXHZX_cjs.forkedWorkingCopyStrategy; }
|
|
10339
10339
|
});
|
|
10340
10340
|
Object.defineProperty(exports, "reopenDurableBranch", {
|
|
10341
10341
|
enumerable: true,
|
|
10342
|
-
get: function () { return
|
|
10342
|
+
get: function () { return chunkBZ5EXHZX_cjs.reopenDurableBranch; }
|
|
10343
10343
|
});
|
|
10344
10344
|
Object.defineProperty(exports, "isErr", {
|
|
10345
10345
|
enumerable: true,
|