kintone-migrator 0.35.5 → 0.35.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.
package/dist/index.mjs CHANGED
@@ -9858,35 +9858,71 @@ function actionLabel(action, index) {
9858
9858
  const label = describeProcessAction(action);
9859
9859
  return index === 0 ? label : `${label} #${index + 1}`;
9860
9860
  }
9861
+ function withPositions(actions) {
9862
+ return actions.map((action, position) => ({
9863
+ action,
9864
+ position
9865
+ }));
9866
+ }
9867
+ /**
9868
+ * The record screen shows the actions available from the current state as
9869
+ * buttons in `actions` order, so only the relative order of actions sharing a
9870
+ * `from` is observable. Compares that order over the actions present on both
9871
+ * sides; added and deleted actions are reported by their own entries.
9872
+ */
9873
+ function compareActionOrder(localActions, matched, entries) {
9874
+ const localOrders = groupByKey([...matched].sort((a, b) => a.localPosition - b.localPosition), (m) => m.from);
9875
+ for (const from of new Set(localActions.map((a) => a.from))) {
9876
+ const localOrder = localOrders.get(from) ?? [];
9877
+ const remoteOrder = [...localOrder].sort((a, b) => a.remotePosition - b.remotePosition);
9878
+ if (remoteOrder.every((m, i) => m === localOrder[i])) continue;
9879
+ const labels = (order) => order.map((m) => m.label).join(", ");
9880
+ entries.push({
9881
+ type: "modified",
9882
+ category: "actionOrder",
9883
+ name: from,
9884
+ details: `${labels(remoteOrder)} -> ${labels(localOrder)}`
9885
+ });
9886
+ }
9887
+ }
9861
9888
  function compareActionEntries(local, remote, entries) {
9862
- for (const pair of pairByKeyInOrder(local.actions, remote.actions, transitionKey)) switch (pair.kind) {
9889
+ const matched = [];
9890
+ for (const pair of pairByKeyInOrder(withPositions(local.actions), withPositions(remote.actions), (p) => transitionKey(p.action))) switch (pair.kind) {
9863
9891
  case "localOnly":
9864
9892
  entries.push({
9865
9893
  type: "added",
9866
9894
  category: "action",
9867
- name: actionLabel(pair.local, pair.index),
9868
- details: `filterCond: ${formatValue(pair.local.filterCond)}`
9895
+ name: actionLabel(pair.local.action, pair.index),
9896
+ details: `filterCond: ${formatValue(pair.local.action.filterCond)}`
9869
9897
  });
9870
9898
  break;
9871
9899
  case "remoteOnly":
9872
9900
  entries.push({
9873
9901
  type: "deleted",
9874
9902
  category: "action",
9875
- name: actionLabel(pair.remote, pair.index),
9876
- details: `filterCond: ${formatValue(pair.remote.filterCond)}`
9903
+ name: actionLabel(pair.remote.action, pair.index),
9904
+ details: `filterCond: ${formatValue(pair.remote.action.filterCond)}`
9877
9905
  });
9878
9906
  break;
9879
9907
  case "both": {
9880
- const actionDiffs = compareActions(pair.local, pair.remote);
9908
+ const label = actionLabel(pair.local.action, pair.index);
9909
+ const actionDiffs = compareActions(pair.local.action, pair.remote.action);
9881
9910
  if (actionDiffs.length > 0) entries.push({
9882
9911
  type: "modified",
9883
9912
  category: "action",
9884
- name: actionLabel(pair.local, pair.index),
9913
+ name: label,
9885
9914
  details: actionDiffs.join("\n")
9886
9915
  });
9916
+ matched.push({
9917
+ from: pair.local.action.from,
9918
+ label,
9919
+ localPosition: pair.local.position,
9920
+ remotePosition: pair.remote.position
9921
+ });
9887
9922
  break;
9888
9923
  }
9889
9924
  }
9925
+ compareActionOrder(local.actions, matched, entries);
9890
9926
  }
9891
9927
  function compareConfigs(local, remote) {
9892
9928
  const entries = [];
@@ -14994,14 +15030,15 @@ var capture_default$6 = createCaptureCommand({
14994
15030
  /**
14995
15031
  * Equality for two {@link ProcessManagementConfig} values, reusing the 2-way
14996
15032
  * diffDetector's "no changes" semantics (`enable` + order-sensitive entity
14997
- * comparison for states/actions). Two configs are equal exactly when the
14998
- * detector reports no differences, so the whole-entity 3-way merge granularity
14999
- * matches `process diff`.
15033
+ * comparison for states/actions + the order of actions sharing a `from`).
15034
+ * Two configs are equal exactly when the detector reports no differences, so
15035
+ * the whole-entity 3-way merge granularity matches `process diff`.
15000
15036
  *
15001
15037
  * Note: `ProcessManagementDiffDetector.detect` is not symmetric in its output
15002
15038
  * text, but it IS symmetric in `isEmpty` — it enumerates added/modified/deleted
15003
- * over the union of state/action keys, so `detect(a, b).isEmpty` is true iff
15004
- * every key matches, regardless of argument order.
15039
+ * over the union of state/action keys and compares the order of the actions
15040
+ * present on both sides, so `detect(a, b).isEmpty` is true iff every key and
15041
+ * that order match, regardless of argument order.
15005
15042
  */
15006
15043
  function isProcessManagementConfigEqual(a, b) {
15007
15044
  return ProcessManagementDiffDetector.detect(a, b).isEmpty;