@camunda8/cli 4.6.0-alpha.2 → 4.6.0-alpha.3

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.
@@ -147,6 +147,10 @@ c8ctl element-template update old.id process.bpmn --dry-run --json
147
147
  identically and not as Hidden, `report.skipped.unchecked` lists it and the
148
148
  migration counts as lossy. Without the source template's definition, every such
149
149
  value set on the element counts.
150
+ - A value whose field survives can still be lost. A Hidden target property that
151
+ resets an editable source value, and a move or set that overwrites a different
152
+ populated value, both list the old value in `dropped` with `cause` `hidden` or
153
+ `displaced`, and the migration counts as lossy.
150
154
  - All selected elements migrate in memory and the file is written once, only if
151
155
  every element succeeds. A dry run exits 1 when an element would fail to migrate or the write would
152
156
  need `--allow-lossy`. It does not serialize the BPMN. JSON output is one document:
@@ -11367,6 +11367,7 @@ function mergeFacts(all) {
11367
11367
  let moved = [];
11368
11368
  let set2 = [];
11369
11369
  let failedWrites = false;
11370
+ let snapshot;
11370
11371
  for (const facts of all) {
11371
11372
  const priorMoved = moved;
11372
11373
  const priorSet = set2;
@@ -11385,10 +11386,12 @@ function mergeFacts(all) {
11385
11386
  set2.push({ ...move.to, value: move.value ?? addition.value });
11386
11387
  } else {
11387
11388
  const prior = priorMoved.find((item) => sameField(item.to, move.from));
11389
+ const read = prior ? prior.read : snapshot && find2(snapshot, move.from.key, move.from.bindingType)?.value;
11388
11390
  moved.push({
11389
11391
  ...move,
11390
11392
  from: prior?.from ?? move.from,
11391
- transformed: Boolean(prior?.transformed) || move.transformed
11393
+ transformed: Boolean(prior?.transformed) || move.transformed,
11394
+ ...read === void 0 ? {} : { read }
11392
11395
  });
11393
11396
  }
11394
11397
  }
@@ -11406,6 +11409,7 @@ function mergeFacts(all) {
11406
11409
  failedWrites ||= moved.some((move) => !surviving(move.to, move.value)) || set2.some((write) => !surviving(write, write.value));
11407
11410
  moved = moved.filter((move) => surviving(move.to, move.value));
11408
11411
  set2 = set2.filter((write) => surviving(write, write.value));
11412
+ snapshot = after;
11409
11413
  }
11410
11414
  failedWrites ||= Boolean(facts.failedWrites);
11411
11415
  }
@@ -11413,6 +11417,12 @@ function mergeFacts(all) {
11413
11417
  moved,
11414
11418
  set: set2,
11415
11419
  failedWrites,
11420
+ written: all.flatMap((f) => [
11421
+ ...f.written ?? [],
11422
+ ...f.moved.map((move) => move.to),
11423
+ ...f.set.map(({ key, bindingType }) => ({ key, bindingType }))
11424
+ ]),
11425
+ reset: all.flatMap((f) => f.reset ?? []),
11416
11426
  notes: all.flatMap((f) => f.notes),
11417
11427
  guardSkipped: all.flatMap((f) => f.guardSkipped),
11418
11428
  templateSkipped: all.flatMap((f) => f.templateSkipped),
@@ -11476,6 +11486,14 @@ function find2(values, key, bindingType) {
11476
11486
  function isHidden(template, key, bindingType) {
11477
11487
  return propertyFor(template, key, bindingType)?.type === "Hidden";
11478
11488
  }
11489
+ function hiddenIn(template, v, match) {
11490
+ const properties = findPropertiesByTarget(
11491
+ template.properties,
11492
+ v.key,
11493
+ v.bindingType
11494
+ );
11495
+ return properties.length > 0 && properties[match]((property) => property.type === "Hidden");
11496
+ }
11479
11497
  function withNames(template, field, value) {
11480
11498
  const name2 = choiceName(template, field, value);
11481
11499
  return name2 ? { valueName: name2 } : {};
@@ -11500,7 +11518,9 @@ function buildReport({
11500
11518
  const addedSets = survivingSets.filter(
11501
11519
  (s) => !find2(before, s.key, s.bindingType)
11502
11520
  );
11503
- const claimedFrom = (v) => survivingMoves.some((m) => sameTarget(v, m.from));
11521
+ const claimedFrom = (v) => survivingMoves.some(
11522
+ (m) => sameTarget(v, m.from) && (m.read === void 0 || m.read === v.value)
11523
+ );
11504
11524
  const claimedTo = (v) => survivingMoves.some((m) => sameTarget(v, m.to)) || addedSets.some((s) => sameTarget(v, s));
11505
11525
  const moved = survivingMoves.map((m) => {
11506
11526
  const from = fieldOf(fromTemplate, m.from.key, m.from.bindingType);
@@ -11527,15 +11547,31 @@ function buildReport({
11527
11547
  const lostBySource = (v) => facts.moved.some(
11528
11548
  (m) => !survivingMoves.includes(m) && sameTarget(v, m.from) && find2(after, m.to.key, m.to.bindingType) === void 0
11529
11549
  );
11530
- const dropped = before.filter(
11531
- (v) => v.value !== "" && (!claimedFrom(v) && !find2(after, v.key, v.bindingType) || lostBySource(v))
11532
- ).map((v) => {
11550
+ const written = [
11551
+ ...facts.written ?? [],
11552
+ ...facts.moved.map((m) => m.to),
11553
+ ...facts.set
11554
+ ];
11555
+ const causeOf = (v) => {
11556
+ const actual = find2(after, v.key, v.bindingType);
11557
+ if (!actual || actual.value === v.value || claimedFrom(v)) return;
11558
+ if (written.some((w) => sameTarget(v, w))) return "displaced";
11559
+ const reset = hiddenIn(toTemplate, v, "some") || (facts.reset ?? []).some((r) => sameTarget(v, r) && r.from === v.value);
11560
+ if (reset && !hiddenIn(fromTemplate, v, "every")) return "hidden";
11561
+ };
11562
+ const dropped = before.filter((v) => v.value !== "").flatMap((v) => {
11563
+ const cause = causeOf(v);
11564
+ if (!cause && (claimedFrom(v) || find2(after, v.key, v.bindingType)) && !lostBySource(v))
11565
+ return [];
11533
11566
  const field = fieldOf(fromTemplate, v.key, v.bindingType);
11534
- return {
11535
- ...field,
11536
- value: v.value,
11537
- ...withNames(fromTemplate, field, v.value)
11538
- };
11567
+ return [
11568
+ {
11569
+ ...field,
11570
+ value: v.value,
11571
+ ...withNames(fromTemplate, field, v.value),
11572
+ ...cause ? { cause } : {}
11573
+ }
11574
+ ];
11539
11575
  });
11540
11576
  const added = after.filter(
11541
11577
  (v) => v.value !== "" && !find2(before, v.key, v.bindingType) && !isHidden(toTemplate, v.key, v.bindingType) && !claimedTo(v)
@@ -12295,6 +12331,12 @@ function applyApplication(modeler, catalog, element, application, mapWrites = []
12295
12331
  }
12296
12332
  }
12297
12333
  current = modeler.elementTemplates.applyTemplate(current, clone) ?? current;
12334
+ const after = valuesOf(current);
12335
+ const reset = values.filter(
12336
+ (v) => v.value !== "" && !stepWrites.some((w) => sameTarget(v, w)) && findPropertiesByTarget(clone.properties, v.key, v.bindingType).some(
12337
+ (property) => property.type === "Hidden"
12338
+ ) && !after.some((a) => sameTarget(a, v) && a.value === v.value)
12339
+ ).map(({ key, bindingType, value }) => ({ key, bindingType, from: value }));
12298
12340
  const resolvedValue = (key, bindingType) => {
12299
12341
  const write = writes.find(
12300
12342
  (w) => w.key === key && w.bindingType === bindingType
@@ -12310,7 +12352,8 @@ function applyApplication(modeler, catalog, element, application, mapWrites = []
12310
12352
  element: current,
12311
12353
  facts: {
12312
12354
  ...facts,
12313
- after: valuesOf(current),
12355
+ after,
12356
+ reset,
12314
12357
  moved: facts.moved.map((move) => ({
12315
12358
  ...move,
12316
12359
  value: resolvedValue(move.to.key, move.to.bindingType)
@@ -12879,7 +12922,7 @@ function rowsOf(report, targetTemplate, s) {
12879
12922
  marker: "-",
12880
12923
  label: `${group ? `${group} \u203A ` : ""}${fieldLabel(d)}`,
12881
12924
  value: [[shown(d.value, d.valueName, false), s.red]],
12882
- source: ""
12925
+ source: d.cause === "hidden" ? "replaced by fixed template value" : d.cause === "displaced" ? "overwritten" : ""
12883
12926
  };
12884
12927
  });
12885
12928
  return { rows, dropped };
@@ -276,6 +276,16 @@ that moved.
276
276
  the engine cannot read are not diffed; an editable source field under one is
277
277
  reported as unchecked, and the report is lossy, unless the target binds it
278
278
  identically and not as Hidden, which is the case where the Modeler keeps it.
279
+ A field that survives can still lose its value: a Hidden target property
280
+ resetting an editable source value, or a move or set overwriting a different
281
+ populated value, is reported as dropped with a `cause`, and the report is lossy.
282
+ A destination that is itself moved away (a swap or chain) is not displaced.
283
+ A field written in any recipe step counts, also when a later step moves the
284
+ value on. Conditions are not evaluated here: a target counts as Hidden when any
285
+ duplicate for the binding is Hidden, a source only when every duplicate is.
286
+ Each step records the values its Hidden properties reset, so a reset in an
287
+ intermediate version counts, even when the final template binds the field as
288
+ editable again or a later step moves the reset value on.
279
289
  - **Read/write identity.** Unqualified rename, guard and interpolation reads fail
280
290
  when several binding types match. Qualification selects a binding type; duplicate
281
291
  backing identities or extension containers are rejected rather than selecting an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda8/cli",
3
- "version": "4.6.0-alpha.2",
3
+ "version": "4.6.0-alpha.3",
4
4
  "description": "Camunda 8 CLI - minimal-dependency CLI for Camunda 8 operations",
5
5
  "type": "module",
6
6
  "engines": {