@camunda8/cli 4.6.0-alpha.5 → 4.6.0-alpha.6
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.
|
@@ -170,7 +170,8 @@ c8ctl element-template update old.id process.bpmn --dry-run --json
|
|
|
170
170
|
- Without `--in-place` the BPMN goes to stdout and the report to stderr.
|
|
171
171
|
- Lossy in-place writes and refused embedded-recipe fallbacks require `--allow-lossy`.
|
|
172
172
|
Preview with `--dry-run` first. Unusable explicit `--recipe` files always fail,
|
|
173
|
-
even with authorization; correct the source entry
|
|
173
|
+
even with authorization; correct the source entry. A floor that no compatible
|
|
174
|
+
source version reaches also fails, and `--allow-lossy` does not override it.
|
|
174
175
|
- In-place migrations take a sibling `.migration.lock` and check original input
|
|
175
176
|
contents before temporary-file preparation and again immediately before rename.
|
|
176
177
|
Changes observed during preparation are rejected. Replacement uses a sibling
|
|
@@ -224,7 +225,8 @@ values are carried over by binding identity and the rest is dropped; the report
|
|
|
224
225
|
lists each drop with its old value, subject to sensitivity redaction. Unusable
|
|
225
226
|
explicit recipes fail even with `--allow-lossy`; refused embedded recipes require
|
|
226
227
|
authorization except when previewing. Diagnostics distinguish malformed recipes,
|
|
227
|
-
coverage refusal
|
|
228
|
+
coverage refusal and wrong source IDs. A source-version floor that cannot be reached
|
|
229
|
+
fails the element instead (see below). Coverage
|
|
228
230
|
covers every step, including the change to another template: an entry that reads
|
|
229
231
|
a path the reached source version does not define refuses the recipe. Guard
|
|
230
232
|
paths count as reads, including `exists` and negated guards. An empty
|
|
@@ -282,9 +284,16 @@ values, including FEEL normalization, rather than claiming planner intent as suc
|
|
|
282
284
|
|
|
283
285
|
A source with `kind: "upgrade"` requires `toVersion` and the recipe owner's ID: an element climbs
|
|
284
286
|
each destination above its applied version in ascending order. A `kind: "change"` source must name
|
|
285
|
-
a different ID and may require `minSourceVersion`, a floor on the version
|
|
286
|
-
|
|
287
|
-
|
|
287
|
+
a different ID and may require `minSourceVersion`, a floor on the source version. When the element
|
|
288
|
+
is below the best floor, the plan adds one implicit version step, with no recipe
|
|
289
|
+
entries; values are carried by binding. The step lands on the lowest compatible version at or above the best floor. The best floor is the highest one at most the newest source
|
|
290
|
+
version compatible with the BPMN's `modeler:executionPlatformVersion`; the plan never goes above
|
|
291
|
+
it. An omitted floor is the fallback entry: it never causes a bump itself and applies only when no declared floor is reachable. When a declared floor is reachable, an element below it is bumped to that floor and the fallback entry is not used. The element fails (no file is
|
|
292
|
+
written, and `--allow-lossy` does not override it) when the newest compatible version is below
|
|
293
|
+
the lowest floor. The report marks
|
|
294
|
+
the step: `The element is on vA, which is too old for this recipe. Updating it to vN first.` (vN is the version landed on) in text and `implicit: true` on the
|
|
295
|
+
step in `report.steps` of `--json`. File recipes replace only the target recipe and follow the
|
|
296
|
+
same rules.
|
|
288
297
|
This revised dialect keeps `schemaVersion: 1` but rejects legacy `minVersion` recipes and requires
|
|
289
298
|
`kind` on every source. Older strict readers reject the new fields. See
|
|
290
299
|
[`migration/migrates-from.schema.json`](./migration/migrates-from.schema.json) for the full format.
|
|
@@ -10035,13 +10035,26 @@ function validateLocalTemplates(id, entries) {
|
|
|
10035
10035
|
const logger = c8ctl2.getLogger();
|
|
10036
10036
|
modeler.get("eventBus").on("elementTemplates.errors", (event) => {
|
|
10037
10037
|
const errors = isRecord(event) && Array.isArray(event.errors) ? event.errors : [];
|
|
10038
|
+
const duplicates = [];
|
|
10038
10039
|
for (const error3 of errors) {
|
|
10039
10040
|
const file = isRecord(error3) ? fileOf.get(error3.template) : void 0;
|
|
10040
10041
|
const message = error3 instanceof Error ? error3.message : String(error3);
|
|
10042
|
+
if (message.includes("already used")) {
|
|
10043
|
+
duplicates.push(isRecord(error3) ? error3.template : void 0);
|
|
10044
|
+
continue;
|
|
10045
|
+
}
|
|
10041
10046
|
logger.warn(
|
|
10042
10047
|
`Ignoring element template${file ? ` in ${file}` : ""}: ${message}`
|
|
10043
10048
|
);
|
|
10044
10049
|
}
|
|
10050
|
+
if (duplicates.length > 0) {
|
|
10051
|
+
const versions = duplicates.flatMap(
|
|
10052
|
+
(t) => isRecord(t) && t.version !== void 0 ? [String(t.version)] : []
|
|
10053
|
+
);
|
|
10054
|
+
logger.warn(
|
|
10055
|
+
`Ignoring ${duplicates.length} element template(s) for ${id} whose id and version are already used (${versions.join(", ")}); the nearest one wins.`
|
|
10056
|
+
);
|
|
10057
|
+
}
|
|
10045
10058
|
});
|
|
10046
10059
|
modeler.get("elementTemplatesLoader").setTemplates(entries.map((e) => e.template));
|
|
10047
10060
|
return modeler.get("elementTemplates").getAll(id) ?? [];
|
|
@@ -11421,11 +11434,18 @@ function mergeFacts(all) {
|
|
|
11421
11434
|
const after = facts.after;
|
|
11422
11435
|
const surviving = (field, value) => {
|
|
11423
11436
|
const actual = find2(after, field.key, field.bindingType);
|
|
11424
|
-
|
|
11437
|
+
const replaced = (facts.reset ?? []).some(
|
|
11438
|
+
(r) => sameField(r, field) && r.from === value
|
|
11439
|
+
);
|
|
11440
|
+
return actual !== void 0 && (value === void 0 || actual.value === value || actual.value === `=${value}` && !replaced);
|
|
11425
11441
|
};
|
|
11442
|
+
const stored = (field, value) => value === void 0 ? value : find2(after, field.key, field.bindingType)?.value ?? value;
|
|
11426
11443
|
failedWrites ||= moved.some((move) => !surviving(move.to, move.value)) || set2.some((write) => !surviving(write, write.value));
|
|
11427
|
-
moved = moved.filter((move) => surviving(move.to, move.value));
|
|
11428
|
-
set2 = set2.filter((write) => surviving(write, write.value))
|
|
11444
|
+
moved = moved.filter((move) => surviving(move.to, move.value)).map((move) => ({ ...move, value: stored(move.to, move.value) }));
|
|
11445
|
+
set2 = set2.filter((write) => surviving(write, write.value)).map((write) => ({
|
|
11446
|
+
...write,
|
|
11447
|
+
value: stored(write, write.value) ?? write.value
|
|
11448
|
+
}));
|
|
11429
11449
|
snapshot = after;
|
|
11430
11450
|
}
|
|
11431
11451
|
failedWrites ||= Boolean(facts.failedWrites);
|
|
@@ -11523,7 +11543,10 @@ function buildReport({
|
|
|
11523
11543
|
after,
|
|
11524
11544
|
facts,
|
|
11525
11545
|
usedRecipe,
|
|
11526
|
-
refusal
|
|
11546
|
+
refusal,
|
|
11547
|
+
steps = [],
|
|
11548
|
+
lostInImplicitSteps = [],
|
|
11549
|
+
implicitTemplates = []
|
|
11527
11550
|
}) {
|
|
11528
11551
|
const survivingMoves = facts.moved.filter((m) => {
|
|
11529
11552
|
const source = find2(before, m.from.key, m.from.bindingType);
|
|
@@ -11536,6 +11559,7 @@ function buildReport({
|
|
|
11536
11559
|
const addedSets = survivingSets.filter(
|
|
11537
11560
|
(s) => !find2(before, s.key, s.bindingType)
|
|
11538
11561
|
);
|
|
11562
|
+
const claimedByMap = (v) => survivingMoves.some((m) => m.map && sameTarget(v, m.from));
|
|
11539
11563
|
const claimedFrom = (v) => survivingMoves.some(
|
|
11540
11564
|
(m) => sameTarget(v, m.from) && (m.read === void 0 || m.read === v.value)
|
|
11541
11565
|
);
|
|
@@ -11577,19 +11601,24 @@ function buildReport({
|
|
|
11577
11601
|
const reset = hiddenIn(toTemplate, v, "some") || (facts.reset ?? []).some((r) => sameTarget(v, r) && r.from === v.value);
|
|
11578
11602
|
if (reset && !hiddenIn(fromTemplate, v, "every")) return "hidden";
|
|
11579
11603
|
};
|
|
11580
|
-
const
|
|
11604
|
+
const droppedValues = before.filter(
|
|
11605
|
+
(v) => v.value !== "" && (causeOf(v) || !claimedFrom(v) && !find2(after, v.key, v.bindingType) || lostBySource(v))
|
|
11606
|
+
);
|
|
11607
|
+
const dropped = [
|
|
11608
|
+
...droppedValues,
|
|
11609
|
+
...lostInImplicitSteps.filter(
|
|
11610
|
+
(v) => !find2(droppedValues, v.key, v.bindingType) && // A surviving map that carries the original value on is not a loss.
|
|
11611
|
+
!(claimedByMap(v) && find2(before, v.key, v.bindingType)?.value === v.value)
|
|
11612
|
+
)
|
|
11613
|
+
].map((v) => {
|
|
11581
11614
|
const cause = causeOf(v);
|
|
11582
|
-
if (!cause && (claimedFrom(v) || find2(after, v.key, v.bindingType)) && !lostBySource(v))
|
|
11583
|
-
return [];
|
|
11584
11615
|
const field = fieldOf(fromTemplate, v.key, v.bindingType);
|
|
11585
|
-
return
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
}
|
|
11592
|
-
];
|
|
11616
|
+
return {
|
|
11617
|
+
...field,
|
|
11618
|
+
value: v.value,
|
|
11619
|
+
...withNames(fromTemplate, field, v.value),
|
|
11620
|
+
...cause ? { cause } : {}
|
|
11621
|
+
};
|
|
11593
11622
|
});
|
|
11594
11623
|
const added = after.filter(
|
|
11595
11624
|
(v) => v.value !== "" && !find2(before, v.key, v.bindingType) && !isHidden(toTemplate, v.key, v.bindingType) && !claimedTo(v)
|
|
@@ -11638,13 +11667,18 @@ function buildReport({
|
|
|
11638
11667
|
template: facts.templateSkipped,
|
|
11639
11668
|
noMatch: facts.noMatch,
|
|
11640
11669
|
feel: facts.feelSkipped,
|
|
11641
|
-
unchecked: uncheckedFields(fromTemplate,
|
|
11670
|
+
unchecked: [...via, ...implicitTemplates].flatMap((template) => uncheckedFields(fromTemplate, [template])).filter(
|
|
11671
|
+
(f, i, all) => all.findIndex(
|
|
11672
|
+
(g) => g.key === f.key && g.bindingType === f.bindingType
|
|
11673
|
+
) === i
|
|
11674
|
+
)
|
|
11642
11675
|
};
|
|
11643
11676
|
return {
|
|
11644
11677
|
from: templateRef(fromTemplate),
|
|
11645
11678
|
to: templateRef(toTemplate),
|
|
11646
11679
|
usedRecipe,
|
|
11647
11680
|
refusal,
|
|
11681
|
+
steps,
|
|
11648
11682
|
dropped: inTemplateOrder(fromTemplate, dropped, (item) => item),
|
|
11649
11683
|
added: inTemplateOrder(toTemplate, added, (item) => item),
|
|
11650
11684
|
changed: inTemplateOrder(toTemplate, changed, (item) => item),
|
|
@@ -12096,13 +12130,42 @@ function reachableHop(recipe, sourceId, drainedVersion) {
|
|
|
12096
12130
|
}
|
|
12097
12131
|
return best;
|
|
12098
12132
|
}
|
|
12133
|
+
function implicitFloor({
|
|
12134
|
+
recipe,
|
|
12135
|
+
sourceId,
|
|
12136
|
+
reachedVersion,
|
|
12137
|
+
newest,
|
|
12138
|
+
engineVersion
|
|
12139
|
+
}) {
|
|
12140
|
+
const changes = recipeSourcesFor(recipe, sourceId).filter(
|
|
12141
|
+
(s) => s.kind === "change"
|
|
12142
|
+
);
|
|
12143
|
+
const floors = changes.flatMap(
|
|
12144
|
+
(s) => s.kind === "change" && s.minSourceVersion !== void 0 ? [s.minSourceVersion] : []
|
|
12145
|
+
);
|
|
12146
|
+
const reachable = floors.filter((f) => newest !== void 0 && f <= newest);
|
|
12147
|
+
if (reachable.length === 0) {
|
|
12148
|
+
const hasFallback = changes.length > floors.length;
|
|
12149
|
+
if (floors.length > 0 && !hasFallback && reachedVersion < Math.min(...floors)) {
|
|
12150
|
+
const camunda = engineVersion ? `Camunda ${engineVersion} (from the BPMN executionPlatformVersion)` : "the BPMN Camunda version";
|
|
12151
|
+
throw new Error(
|
|
12152
|
+
`Template '${sourceId}' v${Math.min(...floors)} or later is required, but ${newest === void 0 ? `no version compatible with ${camunda} is available` : `the newest version compatible with ${camunda} is v${newest}`}.`
|
|
12153
|
+
);
|
|
12154
|
+
}
|
|
12155
|
+
return void 0;
|
|
12156
|
+
}
|
|
12157
|
+
const best = Math.max(...reachable);
|
|
12158
|
+
return best > reachedVersion ? best : void 0;
|
|
12159
|
+
}
|
|
12099
12160
|
function resolveSteps({
|
|
12100
12161
|
appliedId,
|
|
12101
12162
|
appliedVersion,
|
|
12102
12163
|
appliedShapeKnown = true,
|
|
12103
12164
|
target,
|
|
12104
12165
|
templates,
|
|
12105
|
-
recipe
|
|
12166
|
+
recipe,
|
|
12167
|
+
engineVersion,
|
|
12168
|
+
isCompatible = () => true
|
|
12106
12169
|
}) {
|
|
12107
12170
|
templates = resolveCatalog(templates, [target]);
|
|
12108
12171
|
const sameId = target.id === appliedId;
|
|
@@ -12121,7 +12184,23 @@ function resolveSteps({
|
|
|
12121
12184
|
if (!sameId || rung.toVersion !== targetVersion)
|
|
12122
12185
|
loaded(templates, appliedId, rung.toVersion);
|
|
12123
12186
|
}
|
|
12124
|
-
|
|
12187
|
+
let reachedVersion = rungs.at(-1)?.toVersion ?? appliedVersion;
|
|
12188
|
+
const compatibleVersions = templates.filter(
|
|
12189
|
+
(t) => t.id === appliedId && isCompatible(t) && // A stand-in for an unavailable applied template has no real definition.
|
|
12190
|
+
(appliedShapeKnown || (versionOf(t) ?? 0) !== appliedVersion)
|
|
12191
|
+
).map((t) => versionOf(t) ?? 0).sort((a, b) => a - b);
|
|
12192
|
+
const floor = sameId ? void 0 : implicitFloor({
|
|
12193
|
+
recipe: targetRecipe,
|
|
12194
|
+
sourceId: appliedId,
|
|
12195
|
+
reachedVersion,
|
|
12196
|
+
newest: compatibleVersions.at(-1),
|
|
12197
|
+
engineVersion
|
|
12198
|
+
});
|
|
12199
|
+
if (floor !== void 0) {
|
|
12200
|
+
const landing = compatibleVersions.find((v) => v >= floor) ?? floor;
|
|
12201
|
+
rungs.push({ toVersion: landing, entries: [], implicit: true });
|
|
12202
|
+
reachedVersion = landing;
|
|
12203
|
+
}
|
|
12125
12204
|
const hop = sameId ? void 0 : reachableHop(targetRecipe, appliedId, reachedVersion);
|
|
12126
12205
|
const refusal = findCoverageGap(
|
|
12127
12206
|
rungs,
|
|
@@ -12138,7 +12217,8 @@ function resolveSteps({
|
|
|
12138
12217
|
kind: "version",
|
|
12139
12218
|
templateId: appliedId,
|
|
12140
12219
|
version: rung.toVersion,
|
|
12141
|
-
entries: rung.entries
|
|
12220
|
+
entries: rung.entries,
|
|
12221
|
+
...rung.implicit ? { implicit: true } : {}
|
|
12142
12222
|
}));
|
|
12143
12223
|
if (!sameId) {
|
|
12144
12224
|
if (hop) {
|
|
@@ -12149,15 +12229,9 @@ function resolveSteps({
|
|
|
12149
12229
|
entries: hop.entries
|
|
12150
12230
|
});
|
|
12151
12231
|
} else if (targetRecipe) {
|
|
12152
|
-
const sources = recipeSourcesFor(targetRecipe, appliedId).filter(
|
|
12153
|
-
(source) => source.kind === "change"
|
|
12154
|
-
);
|
|
12155
|
-
const floor = Math.min(
|
|
12156
|
-
...sources.map((source) => source.minSourceVersion ?? 0)
|
|
12157
|
-
);
|
|
12158
12232
|
return {
|
|
12159
12233
|
steps: [],
|
|
12160
|
-
refusal:
|
|
12234
|
+
refusal: `wrong source ID: the recipe has no change entry for "${appliedId}"`
|
|
12161
12235
|
};
|
|
12162
12236
|
}
|
|
12163
12237
|
} else if (targetRecipe && steps.length === 0 && targetVersion !== appliedVersion) {
|
|
@@ -12292,6 +12366,60 @@ function resolveMapWrites(maps, before, fromTemplate, target) {
|
|
|
12292
12366
|
}
|
|
12293
12367
|
return result;
|
|
12294
12368
|
}
|
|
12369
|
+
function advanceLineage(lineage, moved, after, implicit, reset = []) {
|
|
12370
|
+
const lost = [];
|
|
12371
|
+
for (const entry of lineage) {
|
|
12372
|
+
if (entry.places.length === 0) continue;
|
|
12373
|
+
const previous = entry.places;
|
|
12374
|
+
const candidates = [
|
|
12375
|
+
...previous,
|
|
12376
|
+
...moved.flatMap(
|
|
12377
|
+
(m) => previous.some(
|
|
12378
|
+
(p) => p.key === m.from.key && p.bindingType === m.from.bindingType
|
|
12379
|
+
) ? [
|
|
12380
|
+
{
|
|
12381
|
+
key: m.to.key,
|
|
12382
|
+
bindingType: m.to.bindingType,
|
|
12383
|
+
value: m.value ?? ""
|
|
12384
|
+
}
|
|
12385
|
+
] : []
|
|
12386
|
+
)
|
|
12387
|
+
];
|
|
12388
|
+
const survivors = [];
|
|
12389
|
+
const gone = [];
|
|
12390
|
+
for (const place of candidates) {
|
|
12391
|
+
const now = after.find(
|
|
12392
|
+
(a) => a.key === place.key && a.bindingType === place.bindingType
|
|
12393
|
+
);
|
|
12394
|
+
if (now && (place.value === "" || now.value === place.value || // A Hidden reset is a replacement, not normalization.
|
|
12395
|
+
now.value === `=${place.value}` && !reset.some(
|
|
12396
|
+
(r) => r.key === place.key && r.bindingType === place.bindingType && r.from === place.value
|
|
12397
|
+
))) {
|
|
12398
|
+
if (!survivors.some(
|
|
12399
|
+
(s) => s.key === now.key && s.bindingType === now.bindingType
|
|
12400
|
+
))
|
|
12401
|
+
survivors.push({
|
|
12402
|
+
key: now.key,
|
|
12403
|
+
bindingType: now.bindingType,
|
|
12404
|
+
value: now.value
|
|
12405
|
+
});
|
|
12406
|
+
} else if (previous.includes(place)) {
|
|
12407
|
+
gone.push(place);
|
|
12408
|
+
}
|
|
12409
|
+
}
|
|
12410
|
+
entry.places = survivors;
|
|
12411
|
+
if (implicit && survivors.length === 0) {
|
|
12412
|
+
lost.push(
|
|
12413
|
+
...gone.map((p) => ({
|
|
12414
|
+
...p,
|
|
12415
|
+
bindingType: p.bindingType ?? "",
|
|
12416
|
+
isFeel: false
|
|
12417
|
+
}))
|
|
12418
|
+
);
|
|
12419
|
+
}
|
|
12420
|
+
}
|
|
12421
|
+
return lost;
|
|
12422
|
+
}
|
|
12295
12423
|
function valuesOf(element) {
|
|
12296
12424
|
return enumerateElementValues(getExtensionElements(element.businessObject));
|
|
12297
12425
|
}
|
|
@@ -12355,7 +12483,11 @@ function applyApplication(modeler, catalog, element, application, mapWrites = []
|
|
|
12355
12483
|
current = modeler.elementTemplates.applyTemplate(current, clone) ?? current;
|
|
12356
12484
|
const after = valuesOf(current);
|
|
12357
12485
|
const reset = values.filter(
|
|
12358
|
-
(v) => v.value !== "" && !stepWrites.some((w) => sameTarget(v, w)) &&
|
|
12486
|
+
(v) => v.value !== "" && !stepWrites.some((w) => sameTarget(v, w)) && // An active editable property owns the field, so a Hidden duplicate
|
|
12487
|
+
// is a conditional alternative, not a reset.
|
|
12488
|
+
!findPropertiesByTarget(clone.properties, v.key, v.bindingType).some(
|
|
12489
|
+
(property) => property.type !== "Hidden" && active.has(property)
|
|
12490
|
+
) && findPropertiesByTarget(clone.properties, v.key, v.bindingType).some(
|
|
12359
12491
|
(property) => property.type === "Hidden"
|
|
12360
12492
|
) && !after.some((a) => sameTarget(a, v) && a.value === v.value)
|
|
12361
12493
|
).map(({ key, bindingType, value }) => ({ key, bindingType, from: value }));
|
|
@@ -12372,6 +12504,14 @@ function applyApplication(modeler, catalog, element, application, mapWrites = []
|
|
|
12372
12504
|
};
|
|
12373
12505
|
return {
|
|
12374
12506
|
element: current,
|
|
12507
|
+
activeTemplate: {
|
|
12508
|
+
...clone,
|
|
12509
|
+
// Unconditional properties are always active. A conditional one counts only
|
|
12510
|
+
// when a write reached it, so an unknown condition never hides a loss.
|
|
12511
|
+
properties: clone.properties.filter(
|
|
12512
|
+
(property) => active.has(property) || !("condition" in property && property.condition)
|
|
12513
|
+
)
|
|
12514
|
+
},
|
|
12375
12515
|
facts: {
|
|
12376
12516
|
...facts,
|
|
12377
12517
|
after,
|
|
@@ -12398,6 +12538,8 @@ function migrateElement({
|
|
|
12398
12538
|
target,
|
|
12399
12539
|
templates,
|
|
12400
12540
|
recipe,
|
|
12541
|
+
engineVersion,
|
|
12542
|
+
isCompatible,
|
|
12401
12543
|
maps = []
|
|
12402
12544
|
}) {
|
|
12403
12545
|
const applied = readAppliedTemplate(element.businessObject);
|
|
@@ -12413,7 +12555,9 @@ function migrateElement({
|
|
|
12413
12555
|
appliedShapeKnown: sourceKnown,
|
|
12414
12556
|
target,
|
|
12415
12557
|
templates,
|
|
12416
|
-
recipe
|
|
12558
|
+
recipe,
|
|
12559
|
+
engineVersion,
|
|
12560
|
+
isCompatible
|
|
12417
12561
|
});
|
|
12418
12562
|
const applications = resolveApplications(templates, steps, target);
|
|
12419
12563
|
for (const { step, template } of applications) {
|
|
@@ -12434,6 +12578,11 @@ function migrateElement({
|
|
|
12434
12578
|
};
|
|
12435
12579
|
const mapPlan = resolveMapWrites(maps, before, fromTemplate, target);
|
|
12436
12580
|
const allFacts = [];
|
|
12581
|
+
const lineage = before.filter((v) => v.value !== "" && !hiddenIn(fromTemplate, v, "every")).map((v) => ({
|
|
12582
|
+
places: [{ key: v.key, bindingType: v.bindingType, value: v.value }]
|
|
12583
|
+
}));
|
|
12584
|
+
const lostInImplicitSteps = [];
|
|
12585
|
+
const implicitTemplates = [];
|
|
12437
12586
|
let current = element;
|
|
12438
12587
|
let mapsApplied = false;
|
|
12439
12588
|
for (const [index, application] of applications.entries()) {
|
|
@@ -12449,6 +12598,17 @@ function migrateElement({
|
|
|
12449
12598
|
if (result) {
|
|
12450
12599
|
current = result.element;
|
|
12451
12600
|
allFacts.push(result.facts);
|
|
12601
|
+
if (application.step?.implicit)
|
|
12602
|
+
implicitTemplates.push(result.activeTemplate);
|
|
12603
|
+
lostInImplicitSteps.push(
|
|
12604
|
+
...advanceLineage(
|
|
12605
|
+
lineage,
|
|
12606
|
+
result.facts.moved,
|
|
12607
|
+
valuesOf(current),
|
|
12608
|
+
application.step?.implicit === true,
|
|
12609
|
+
result.facts.reset
|
|
12610
|
+
)
|
|
12611
|
+
);
|
|
12452
12612
|
mapsApplied ||= isFinal;
|
|
12453
12613
|
}
|
|
12454
12614
|
}
|
|
@@ -12481,10 +12641,27 @@ function migrateElement({
|
|
|
12481
12641
|
after: allFacts.at(-1)?.after ?? before,
|
|
12482
12642
|
facts,
|
|
12483
12643
|
usedRecipe: steps.length > 0,
|
|
12484
|
-
refusal
|
|
12644
|
+
refusal,
|
|
12645
|
+
lostInImplicitSteps,
|
|
12646
|
+
implicitTemplates,
|
|
12647
|
+
steps: reportSteps(steps, fromTemplate.version ?? 0)
|
|
12485
12648
|
});
|
|
12486
12649
|
return { element: current, report };
|
|
12487
12650
|
}
|
|
12651
|
+
function reportSteps(steps, appliedVersion) {
|
|
12652
|
+
let reached = appliedVersion;
|
|
12653
|
+
return steps.map((step) => {
|
|
12654
|
+
const reportStep = {
|
|
12655
|
+
kind: step.kind,
|
|
12656
|
+
templateId: step.templateId,
|
|
12657
|
+
fromVersion: reached,
|
|
12658
|
+
toVersion: step.version,
|
|
12659
|
+
...step.implicit ? { implicit: true } : {}
|
|
12660
|
+
};
|
|
12661
|
+
if (step.kind === "version") reached = step.version;
|
|
12662
|
+
return reportStep;
|
|
12663
|
+
});
|
|
12664
|
+
}
|
|
12488
12665
|
|
|
12489
12666
|
// src/core/config.ts
|
|
12490
12667
|
import { homedir, platform } from "node:os";
|
|
@@ -12989,6 +13166,13 @@ function renderReportText(report, {
|
|
|
12989
13166
|
} else {
|
|
12990
13167
|
lines.push(s.dim(" no recipe: values carried over by key"));
|
|
12991
13168
|
}
|
|
13169
|
+
for (const step of report.steps.filter((step2) => step2.implicit)) {
|
|
13170
|
+
lines.push(
|
|
13171
|
+
s.dim(
|
|
13172
|
+
` The element is on v${step.fromVersion}, which is too old for this recipe. Updating it to v${step.toVersion} first.`
|
|
13173
|
+
)
|
|
13174
|
+
);
|
|
13175
|
+
}
|
|
12992
13176
|
const { rows, dropped } = rowsOf(report, targetTemplate, s);
|
|
12993
13177
|
const all = [...rows, ...dropped];
|
|
12994
13178
|
const labelWidth = Math.min(
|
|
@@ -13138,6 +13322,7 @@ function reportToJson(report, {
|
|
|
13138
13322
|
kept: report.kept.length
|
|
13139
13323
|
},
|
|
13140
13324
|
report: {
|
|
13325
|
+
steps: report.steps,
|
|
13141
13326
|
moved: report.moved,
|
|
13142
13327
|
added: report.added,
|
|
13143
13328
|
changed: report.changed,
|
|
@@ -13496,9 +13681,18 @@ async function runMigrateInternal({ parsed, templateId, elementId, bpmnFilePath
|
|
|
13496
13681
|
});
|
|
13497
13682
|
redaction.templates = [...lineages([templateId, target.id]), target];
|
|
13498
13683
|
const targetRecipe = recipe ?? embeddedRecipe(target);
|
|
13499
|
-
const
|
|
13500
|
-
(s) => s.kind === "change" && s.sourceTemplateId === templateId
|
|
13684
|
+
const changes = (targetRecipe?.sources ?? []).filter(
|
|
13685
|
+
(s) => s.kind === "change" && s.sourceTemplateId === templateId
|
|
13686
|
+
);
|
|
13687
|
+
const floors = changes.flatMap(
|
|
13688
|
+
(s) => s.kind === "change" && s.minSourceVersion !== void 0 ? [s.minSourceVersion] : []
|
|
13501
13689
|
);
|
|
13690
|
+
const hasFallback = changes.length > floors.length;
|
|
13691
|
+
const localCompatibleVersions = compatibleTemplates(
|
|
13692
|
+
pool2.localOf(templateId),
|
|
13693
|
+
engineVersion
|
|
13694
|
+
).flatMap((t) => t.id === templateId ? [t.version ?? 0] : []);
|
|
13695
|
+
const newestLocal = Math.max(-1, ...localCompatibleVersions);
|
|
13502
13696
|
const localLatest = latestOf(
|
|
13503
13697
|
compatibleTemplates(pool2.localOf(templateId), engineVersion),
|
|
13504
13698
|
templateId
|
|
@@ -13518,7 +13712,7 @@ async function runMigrateInternal({ parsed, templateId, elementId, bpmnFilePath
|
|
|
13518
13712
|
const reached = reachedLocally(
|
|
13519
13713
|
readAppliedTemplate(element.businessObject)?.version ?? 0
|
|
13520
13714
|
);
|
|
13521
|
-
return floors.
|
|
13715
|
+
return !hasFallback && floors.some((floor) => floor > newestLocal && floor > reached);
|
|
13522
13716
|
})) {
|
|
13523
13717
|
pool2.cache();
|
|
13524
13718
|
}
|
|
@@ -13631,6 +13825,8 @@ async function runMigrateInternal({ parsed, templateId, elementId, bpmnFilePath
|
|
|
13631
13825
|
target,
|
|
13632
13826
|
templates,
|
|
13633
13827
|
recipe,
|
|
13828
|
+
engineVersion,
|
|
13829
|
+
isCompatible: (template) => isEngineCompatible(template, engineVersion),
|
|
13634
13830
|
maps
|
|
13635
13831
|
});
|
|
13636
13832
|
redaction.values = [
|
|
@@ -266,8 +266,12 @@ that moved.
|
|
|
266
266
|
- **Steps.** An element on an old version climbs the version steps of its own
|
|
267
267
|
template in order, then makes at most one hop onto a different template. A
|
|
268
268
|
source entry declares `kind: "upgrade"` with a destination `toVersion`, or
|
|
269
|
-
`kind: "change"` with an optional `minSourceVersion` floor.
|
|
270
|
-
|
|
269
|
+
`kind: "change"` with an optional `minSourceVersion` floor. A floor above
|
|
270
|
+
the reached version adds one implicit version step (no entries, values carried
|
|
271
|
+
by binding). The best floor is the highest one at most the newest source version
|
|
272
|
+
compatible with the BPMN's `modeler:executionPlatformVersion`; the step lands on
|
|
273
|
+
the lowest compatible version at or above it. An unreachable floor throws
|
|
274
|
+
rather than refusing, so it is never authorizable with `--allow-lossy`. The revised
|
|
271
275
|
dialect keeps schema version 1 and rejects legacy `minVersion` fields.
|
|
272
276
|
Owner-relative ID/version rules and duplicate markers are semantic checks.
|
|
273
277
|
Every selected intermediate template must exist before application; the supplied
|
|
@@ -321,8 +325,8 @@ that moved.
|
|
|
321
325
|
precedes a no-op return.
|
|
322
326
|
- **Authorization.** Lossy in-place migrations and refused embedded-recipe fallback
|
|
323
327
|
require `--allow-lossy`. Explicit unusable recipes cannot be authorized. Diagnostics
|
|
324
|
-
distinguish syntax, coverage (version steps
|
|
325
|
-
|
|
328
|
+
distinguish syntax, coverage (version steps, the implicit floor step and the
|
|
329
|
+
change hop) and source-ID refusal; unreachable floors fail the element; empty recipe
|
|
326
330
|
flags fail. Preview/authorized reports retain refusal and authorization status.
|
|
327
331
|
- **Sensitivity.** Rendering uses credential-like field identity and template
|
|
328
332
|
property/group metadata to redact report values. Known sensitive before/after,
|