kintone-migrator 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -669,6 +669,11 @@ function buildDiffResult(entries, warnings = []) {
669
669
  };
670
670
  }
671
671
  //#endregion
672
+ //#region src/core/domain/services/formatValue.ts
673
+ function formatValue(v) {
674
+ return v === void 0 ? "(none)" : JSON.stringify(v);
675
+ }
676
+ //#endregion
672
677
  //#region src/core/domain/services/recordDiffDetector.ts
673
678
  function detectRecordDiff(localRecord, remoteRecord, callbacks) {
674
679
  const entries = [];
@@ -685,11 +690,10 @@ function detectRecordDiff(localRecord, remoteRecord, callbacks) {
685
690
  function compareActions$1(local, remote) {
686
691
  const diffs = [];
687
692
  if (local.index !== remote.index) diffs.push(`index: ${remote.index} -> ${local.index}`);
688
- if (!deepEqual(local.destApp, remote.destApp)) diffs.push("destApp changed");
689
- if (local.filterCond !== remote.filterCond) diffs.push("filterCond changed");
690
- if (!deepEqual(local.mappings, remote.mappings)) if (local.mappings.length !== remote.mappings.length) diffs.push(`mappings: ${remote.mappings.length} -> ${local.mappings.length}`);
691
- else diffs.push("mappings changed");
692
- if (!deepEqual(local.entities, remote.entities)) diffs.push("entities changed");
693
+ if (!deepEqual(local.destApp, remote.destApp)) diffs.push(`destApp: ${formatValue(remote.destApp)} -> ${formatValue(local.destApp)}`);
694
+ if (local.filterCond !== remote.filterCond) diffs.push(`filterCond: "${remote.filterCond}" -> "${local.filterCond}"`);
695
+ if (!deepEqual(local.mappings, remote.mappings)) diffs.push(`mappings: ${formatValue(remote.mappings)} -> ${formatValue(local.mappings)}`);
696
+ if (!deepEqual(local.entities, remote.entities)) diffs.push(`entities: ${formatValue(remote.entities)} -> ${formatValue(local.entities)}`);
693
697
  return diffs;
694
698
  }
695
699
  function destAppLabel(action) {
@@ -5643,7 +5647,7 @@ const FieldPermissionDiffDetector = { detect: (local, remote) => {
5643
5647
  else if (!isEntitiesEqual$1(localRight, remoteRight)) entries.push({
5644
5648
  type: "modified",
5645
5649
  fieldCode: code,
5646
- details: `entities: ${describeEntities(localRight.entities)}`
5650
+ details: `entities: ${describeEntities(remoteRight.entities)} -> ${describeEntities(localRight.entities)}`
5647
5651
  });
5648
5652
  }
5649
5653
  for (const [code, remoteRight] of remoteMap) if (!localMap.has(code)) entries.push({
@@ -5746,12 +5750,40 @@ function isFieldEqual(a, b) {
5746
5750
  if ((a.noLabel ?? false) !== (b.noLabel ?? false)) return false;
5747
5751
  return isPropertiesEqual(a, b);
5748
5752
  }
5753
+ function describePropertiesChanges(before, after) {
5754
+ if (before.type !== after.type) return [];
5755
+ if (before.type === "SUBTABLE" && after.type === "SUBTABLE") {
5756
+ const beforeObj = Object.fromEntries(Array.from(before.properties.fields.entries()));
5757
+ const afterObj = Object.fromEntries(Array.from(after.properties.fields.entries()));
5758
+ return [`fields: ${formatValue(beforeObj)} -> ${formatValue(afterObj)}`];
5759
+ }
5760
+ if (before.type === "REFERENCE_TABLE" && after.type === "REFERENCE_TABLE") {
5761
+ const bRef = before.properties.referenceTable;
5762
+ const aRef = after.properties.referenceTable;
5763
+ const subChanges = [];
5764
+ for (const key of [
5765
+ "relatedApp",
5766
+ "condition",
5767
+ "filterCond",
5768
+ "displayFields",
5769
+ "sort",
5770
+ "size"
5771
+ ]) if (!deepEqual(bRef[key], aRef[key])) subChanges.push(`referenceTable.${key}: ${formatValue(bRef[key])} -> ${formatValue(aRef[key])}`);
5772
+ return subChanges.length > 0 ? subChanges : ["referenceTable changed"];
5773
+ }
5774
+ const bProps = before.properties;
5775
+ const aProps = after.properties;
5776
+ const allKeys = new Set([...Object.keys(bProps), ...Object.keys(aProps)]);
5777
+ const propChanges = [];
5778
+ for (const key of allKeys) if (!deepEqual(bProps[key], aProps[key])) propChanges.push(`${key}: ${formatValue(bProps[key])} -> ${formatValue(aProps[key])}`);
5779
+ return propChanges;
5780
+ }
5749
5781
  function describeChanges$1(before, after) {
5750
5782
  const changes = [];
5751
5783
  if (before.type !== after.type) changes.push(`type: ${before.type} -> ${after.type}`);
5752
5784
  if (before.label !== after.label) changes.push(`label: ${before.label} -> ${after.label}`);
5753
5785
  if ((before.noLabel ?? false) !== (after.noLabel ?? false)) changes.push(`noLabel: ${before.noLabel ?? false} -> ${after.noLabel ?? false}`);
5754
- if (!isPropertiesEqual(before, after)) changes.push("properties changed");
5786
+ if (!isPropertiesEqual(before, after)) changes.push(...describePropertiesChanges(before, after));
5755
5787
  return changes.length > 0 ? changes.join(", ") : "no visible changes";
5756
5788
  }
5757
5789
  function isLayoutEqual(a, b) {
@@ -6412,9 +6444,6 @@ function compareConfigs$1(local, remote) {
6412
6444
  details: `${rv} -> ${lv}`
6413
6445
  });
6414
6446
  }
6415
- function formatValue(v) {
6416
- return v === void 0 ? "(none)" : JSON.stringify(v);
6417
- }
6418
6447
  function compareDeepEqual(field, l, r) {
6419
6448
  if (!deepEqual(l, r)) entries.push({
6420
6449
  type: "modified",
@@ -6639,18 +6668,18 @@ function perRecordLabel(notif) {
6639
6668
  }
6640
6669
  function describePerRecordChanges(local, remote) {
6641
6670
  const diffs = [];
6642
- if (local.title !== remote.title) diffs.push("title changed");
6643
- if (!deepEqual(local.targets, remote.targets)) diffs.push("targets changed");
6671
+ if (local.title !== remote.title) diffs.push(`title: "${remote.title}" -> "${local.title}"`);
6672
+ if (!deepEqual(local.targets, remote.targets)) diffs.push(`targets: ${formatValue(remote.targets)} -> ${formatValue(local.targets)}`);
6644
6673
  return diffs.length > 0 ? diffs.join(", ") : "changed";
6645
6674
  }
6646
6675
  function describeReminderChanges(local, remote) {
6647
6676
  const diffs = [];
6648
- if (local.title !== remote.title) diffs.push("title changed");
6649
- if (local.daysLater !== remote.daysLater) diffs.push("daysLater changed");
6650
- if ((local.hoursLater ?? 0) !== (remote.hoursLater ?? 0)) diffs.push("hoursLater changed");
6651
- if ((local.time ?? "") !== (remote.time ?? "")) diffs.push("time changed");
6652
- if (local.filterCond !== remote.filterCond) diffs.push("filterCond changed");
6653
- if (!deepEqual(local.targets, remote.targets)) diffs.push("targets changed");
6677
+ if (local.title !== remote.title) diffs.push(`title: "${remote.title}" -> "${local.title}"`);
6678
+ if (local.daysLater !== remote.daysLater) diffs.push(`daysLater: ${remote.daysLater} -> ${local.daysLater}`);
6679
+ if ((local.hoursLater ?? 0) !== (remote.hoursLater ?? 0)) diffs.push(`hoursLater: ${remote.hoursLater ?? 0} -> ${local.hoursLater ?? 0}`);
6680
+ if ((local.time ?? "") !== (remote.time ?? "")) diffs.push(`time: "${remote.time ?? ""}" -> "${local.time ?? ""}"`);
6681
+ if (local.filterCond !== remote.filterCond) diffs.push(`filterCond: "${remote.filterCond}" -> "${local.filterCond}"`);
6682
+ if (!deepEqual(local.targets, remote.targets)) diffs.push(`targets: ${formatValue(remote.targets)} -> ${formatValue(local.targets)}`);
6654
6683
  return diffs.length > 0 ? diffs.join(", ") : "changed";
6655
6684
  }
6656
6685
  function comparePerRecordSection(local, remote) {
@@ -6992,7 +7021,7 @@ function compareActions(localAction, remoteAction) {
6992
7021
  if (localAction.to !== remoteAction.to) diffs.push(`to: ${remoteAction.to} -> ${localAction.to}`);
6993
7022
  if (localAction.filterCond !== remoteAction.filterCond) diffs.push(`filterCond: "${remoteAction.filterCond}" -> "${localAction.filterCond}"`);
6994
7023
  if (localAction.type !== remoteAction.type) diffs.push(`type: ${remoteAction.type} -> ${localAction.type}`);
6995
- if (!isExecutableUserEqual(localAction.executableUser, remoteAction.executableUser)) diffs.push("executableUser changed");
7024
+ if (!isExecutableUserEqual(localAction.executableUser, remoteAction.executableUser)) diffs.push(`executableUser: ${formatValue(remoteAction.executableUser)} -> ${formatValue(localAction.executableUser)}`);
6996
7025
  return diffs;
6997
7026
  }
6998
7027
  function compareStates(local, remote, entries) {
@@ -7010,7 +7039,7 @@ function compareStates(local, remote, entries) {
7010
7039
  const stateDiffs = [];
7011
7040
  if (localState.index !== remoteState.index) stateDiffs.push(`index: ${remoteState.index} -> ${localState.index}`);
7012
7041
  if (localState.assignee.type !== remoteState.assignee.type) stateDiffs.push(`assignee.type: ${remoteState.assignee.type} -> ${localState.assignee.type}`);
7013
- if (!isEntitiesEqual(localState.assignee.entities, remoteState.assignee.entities)) stateDiffs.push("assignee.entities changed");
7042
+ if (!isEntitiesEqual(localState.assignee.entities, remoteState.assignee.entities)) stateDiffs.push(`assignee.entities: ${formatValue(remoteState.assignee.entities)} -> ${formatValue(localState.assignee.entities)}`);
7014
7043
  if (stateDiffs.length > 0) entries.push({
7015
7044
  type: "modified",
7016
7045
  category: "state",
@@ -7228,7 +7257,7 @@ function compareRightsForFilter(filterCond, localRights, remoteRights, entries)
7228
7257
  });
7229
7258
  else if (localRight && remoteRight) {
7230
7259
  if (!isRightEqual(localRight, remoteRight)) {
7231
- const detail = localRight.entities.length !== remoteRight.entities.length ? `entities: ${remoteRight.entities.length} -> ${localRight.entities.length}` : `entities: ${describeRight(localRight)}`;
7260
+ const detail = localRight.entities.length !== remoteRight.entities.length ? `entities: ${remoteRight.entities.length} -> ${localRight.entities.length}` : `entities: ${describeRight(remoteRight)} -> ${describeRight(localRight)}`;
7232
7261
  entries.push({
7233
7262
  type: "modified",
7234
7263
  filterCond,
@@ -7325,11 +7354,11 @@ function compareReports(local, remote) {
7325
7354
  if (local.chartType !== remote.chartType) diffs.push(`chartType: ${remote.chartType} -> ${local.chartType}`);
7326
7355
  if ((local.chartMode ?? "") !== (remote.chartMode ?? "")) diffs.push(`chartMode: ${remote.chartMode ?? "(unset)"} -> ${local.chartMode ?? "(unset)"}`);
7327
7356
  if (local.index !== remote.index) diffs.push(`index: ${remote.index} -> ${local.index}`);
7328
- if (local.filterCond !== remote.filterCond) diffs.push("filterCond changed");
7329
- if (!deepEqual(local.groups, remote.groups)) diffs.push("groups changed");
7330
- if (!deepEqual(local.aggregations, remote.aggregations)) diffs.push("aggregations changed");
7331
- if (!deepEqual(local.sorts, remote.sorts)) diffs.push("sorts changed");
7332
- if (!deepEqual(local.periodicReport ?? null, remote.periodicReport ?? null)) diffs.push("periodicReport changed");
7357
+ if (local.filterCond !== remote.filterCond) diffs.push(`filterCond: "${remote.filterCond}" -> "${local.filterCond}"`);
7358
+ if (!deepEqual(local.groups, remote.groups)) diffs.push(`groups: ${formatValue(remote.groups)} -> ${formatValue(local.groups)}`);
7359
+ if (!deepEqual(local.aggregations, remote.aggregations)) diffs.push(`aggregations: ${formatValue(remote.aggregations)} -> ${formatValue(local.aggregations)}`);
7360
+ if (!deepEqual(local.sorts, remote.sorts)) diffs.push(`sorts: ${formatValue(remote.sorts)} -> ${formatValue(local.sorts)}`);
7361
+ if (!deepEqual(local.periodicReport ?? null, remote.periodicReport ?? null)) diffs.push(`periodicReport: ${formatValue(remote.periodicReport ?? null)} -> ${formatValue(local.periodicReport ?? null)}`);
7333
7362
  return diffs;
7334
7363
  }
7335
7364
  const ReportDiffDetector = { detect: (local, remote) => {
@@ -7515,7 +7544,7 @@ async function detectReportDiff({ container }) {
7515
7544
  //#endregion
7516
7545
  //#region src/core/domain/view/services/diffDetector.ts
7517
7546
  function checkOptionalStringChange(changes, field, localVal, remoteVal) {
7518
- if ((localVal ?? "") !== (remoteVal ?? "")) changes.push(`${field} changed`);
7547
+ if ((localVal ?? "") !== (remoteVal ?? "")) changes.push(`${field}: "${remoteVal ?? ""}" -> "${localVal ?? ""}"`);
7519
7548
  }
7520
7549
  function describeChanges(local, remote) {
7521
7550
  const changes = [];
@@ -7529,7 +7558,7 @@ function describeChanges(local, remote) {
7529
7558
  checkOptionalStringChange(changes, "html", local.html, remote.html);
7530
7559
  if ((local.pager ?? false) !== (remote.pager ?? false)) changes.push(`pager: ${String(remote.pager ?? false)} -> ${String(local.pager ?? false)}`);
7531
7560
  checkOptionalStringChange(changes, "device", local.device, remote.device);
7532
- if (!deepEqual(local.fields ?? [], remote.fields ?? [])) changes.push("fields changed");
7561
+ if (!deepEqual(local.fields ?? [], remote.fields ?? [])) changes.push(`fields: ${formatValue(remote.fields ?? [])} -> ${formatValue(local.fields ?? [])}`);
7533
7562
  return changes;
7534
7563
  }
7535
7564
  const ViewDiffDetector = { detect: (localViews, remoteViews) => {