kintone-migrator 0.35.6 → 0.35.7

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
@@ -1494,6 +1494,12 @@ function readKintoneLookupList(value, fieldPath) {
1494
1494
  if (list === void 0) throw new SystemError(SystemErrorCode.ExternalApiError, `Expected array at ${fieldPath}, got ${typeof value}`);
1495
1495
  return list;
1496
1496
  }
1497
+ /** Reads a filter condition or sort order; a missing one is `""`. */
1498
+ function readKintoneQueryClause(value, fieldPath) {
1499
+ if (value === void 0) return "";
1500
+ assertString(value, fieldPath);
1501
+ return value;
1502
+ }
1497
1503
  function fromKintoneLookup(value, fieldPath) {
1498
1504
  assertRecord(value, fieldPath);
1499
1505
  assertRecord(value.relatedApp, `${fieldPath}.relatedApp`);
@@ -1513,16 +1519,13 @@ function fromKintoneLookup(value, fieldPath) {
1513
1519
  });
1514
1520
  const lookupPickerFields = readKintoneLookupList(value.lookupPickerFields, `${fieldPath}.lookupPickerFields`);
1515
1521
  assertStringArray(lookupPickerFields, `${fieldPath}.lookupPickerFields`);
1516
- const { filterCond, sort } = value;
1517
- if (filterCond !== void 0) assertString(filterCond, `${fieldPath}.filterCond`);
1518
- if (sort !== void 0) assertString(sort, `${fieldPath}.sort`);
1519
1522
  return {
1520
1523
  relatedApp: LookupRelatedApp.create(app, code),
1521
1524
  relatedKeyField: value.relatedKeyField,
1522
1525
  fieldMappings,
1523
1526
  lookupPickerFields,
1524
- ...filterCond !== void 0 ? { filterCond } : {},
1525
- ...sort !== void 0 ? { sort } : {}
1527
+ filterCond: readKintoneQueryClause(value.filterCond, `${fieldPath}.filterCond`),
1528
+ sort: readKintoneQueryClause(value.sort, `${fieldPath}.sort`)
1526
1529
  };
1527
1530
  }
1528
1531
  function fromKintoneProperty(prop) {
@@ -1566,9 +1569,9 @@ function fromKintoneProperty(prop) {
1566
1569
  field: FieldCode.create(condition.field),
1567
1570
  relatedField: FieldCode.create(condition.relatedField)
1568
1571
  },
1569
- ...rt.filterCond !== void 0 ? { filterCond: String(rt.filterCond) } : {},
1572
+ filterCond: readKintoneQueryClause(rt.filterCond, "REFERENCE_TABLE.referenceTable.filterCond"),
1570
1573
  displayFields,
1571
- ...rt.sort !== void 0 ? { sort: String(rt.sort) } : {},
1574
+ sort: readKintoneQueryClause(rt.sort, "REFERENCE_TABLE.referenceTable.sort"),
1572
1575
  ...rt.size !== void 0 ? { size: String(rt.size) } : {}
1573
1576
  } }
1574
1577
  };
@@ -1611,9 +1614,9 @@ function toKintoneProperty(field) {
1611
1614
  field: ref.condition.field,
1612
1615
  relatedField: ref.condition.relatedField
1613
1616
  },
1614
- ...ref.filterCond !== void 0 ? { filterCond: ref.filterCond } : {},
1617
+ filterCond: ref.filterCond,
1615
1618
  displayFields: ref.displayFields.map((f) => f),
1616
- ...ref.sort !== void 0 ? { sort: ref.sort } : {},
1619
+ sort: ref.sort,
1617
1620
  ...ref.size !== void 0 ? { size: ref.size } : {}
1618
1621
  }
1619
1622
  };
@@ -2621,6 +2624,15 @@ function resolveSingleApp(config, appName) {
2621
2624
  return { orderedApps: [entry] };
2622
2625
  }
2623
2626
  //#endregion
2627
+ //#region src/core/domain/recordPermission/valueObject.ts
2628
+ /**
2629
+ * Display form of a right's filterCond. filterCond is a query expression, so
2630
+ * it is quoted as a value; the empty condition targets all records.
2631
+ */
2632
+ function describeRecordPermissionFilter(filterCond) {
2633
+ return filterCond === "" ? "(all records)" : formatValue(filterCond);
2634
+ }
2635
+ //#endregion
2624
2636
  //#region src/cli/handleError.ts
2625
2637
  /**
2626
2638
  * Log error details without terminating the process.
@@ -2885,7 +2897,7 @@ function printProcessDiffResult(result) {
2885
2897
  printGenericDiffResult(result, "Process Management Diff Details", (entry, colorize, prefix) => `${colorize(prefix)} ${pc.dim("[")}${colorize(entry.category)}${pc.dim("]")} ${entry.name}${pc.dim(":")} ${entry.details}`);
2886
2898
  }
2887
2899
  function printRecordPermissionDiffResult(result) {
2888
- printGenericDiffResult(result, "Record Permission Diff Details", (entry, colorize, prefix) => `${colorize(prefix)} ${pc.dim("[")}${colorize(entry.filterCond === "" ? "(all records)" : entry.filterCond)}${pc.dim("]:")} ${entry.details}`);
2900
+ printGenericDiffResult(result, "Record Permission Diff Details", (entry, colorize, prefix) => `${colorize(prefix)} ${pc.dim("[")}${colorize(describeRecordPermissionFilter(entry.filterCond))}${pc.dim("]:")} ${entry.details}`);
2889
2901
  }
2890
2902
  function printReportDiffResult(result) {
2891
2903
  printGenericDiffResult(result, "Report Diff Details", (entry, colorize, prefix) => `${colorize(prefix)} ${colorize(entry.reportName)}${pc.dim(":")} ${entry.details}`);
@@ -5716,7 +5728,7 @@ function describePropertiesChanges(before, after) {
5716
5728
  function describeChanges$1(before, after) {
5717
5729
  const changes = [];
5718
5730
  if (before.type !== after.type) changes.push(`type: ${before.type} -> ${after.type}`);
5719
- if (before.label !== after.label) changes.push(`label: ${before.label} -> ${after.label}`);
5731
+ if (before.label !== after.label) changes.push(`label: ${formatValue(before.label)} -> ${formatValue(after.label)}`);
5720
5732
  if ((before.noLabel ?? false) !== (after.noLabel ?? false)) changes.push(`noLabel: ${before.noLabel ?? false} -> ${after.noLabel ?? false}`);
5721
5733
  if (!isPropertiesEqual(before, after)) changes.push(...describePropertiesChanges(before, after));
5722
5734
  return changes.length > 0 ? changes.join("\n") : "no visible changes";
@@ -6277,6 +6289,13 @@ function invalidLookup(code, detail) {
6277
6289
  function optionalString(value) {
6278
6290
  return value === void 0 || value === null ? void 0 : String(value);
6279
6291
  }
6292
+ /**
6293
+ * Reads a filter condition or sort order; an omitted or valueless one is `""`,
6294
+ * the value kintone returns when it is unset.
6295
+ */
6296
+ function optionalQueryClause(value) {
6297
+ return optionalString(value) ?? "";
6298
+ }
6280
6299
  /** Reads a lookup list; an omitted or valueless list is the empty list. */
6281
6300
  function optionalLookupList(code, key, value) {
6282
6301
  if (value === void 0 || value === null) return [];
@@ -6296,15 +6315,13 @@ function parseLookup(code, raw) {
6296
6315
  relatedField: String(mapping.relatedField ?? "")
6297
6316
  };
6298
6317
  });
6299
- const filterCond = optionalString(raw.filterCond);
6300
- const sort = optionalString(raw.sort);
6301
6318
  return {
6302
6319
  relatedApp: LookupRelatedApp.create(String(raw.relatedApp.app ?? ""), optionalString(raw.relatedApp.code)),
6303
6320
  relatedKeyField: String(raw.relatedKeyField ?? ""),
6304
6321
  fieldMappings,
6305
6322
  lookupPickerFields,
6306
- ...filterCond !== void 0 ? { filterCond } : {},
6307
- ...sort !== void 0 ? { sort } : {}
6323
+ filterCond: optionalQueryClause(raw.filterCond),
6324
+ sort: optionalQueryClause(raw.sort)
6308
6325
  };
6309
6326
  }
6310
6327
  function parseReferenceTableField(raw, code, base) {
@@ -6318,6 +6335,7 @@ function parseReferenceTableField(raw, code, base) {
6318
6335
  const relatedApp = refTable.relatedApp;
6319
6336
  const conditionField = String(condition.field ?? "");
6320
6337
  const conditionRelatedField = String(condition.relatedField ?? "");
6338
+ const size = optionalString(refTable.size);
6321
6339
  if (conditionField.length === 0) throw new BusinessRuleError(FormSchemaErrorCode.FsInvalidSchemaStructure, `Field "${code}" of type REFERENCE_TABLE must have a non-empty "referenceTable.condition.field"`);
6322
6340
  if (conditionRelatedField.length === 0) throw new BusinessRuleError(FormSchemaErrorCode.FsInvalidSchemaStructure, `Field "${code}" of type REFERENCE_TABLE must have a non-empty "referenceTable.condition.relatedField"`);
6323
6341
  return {
@@ -6329,10 +6347,10 @@ function parseReferenceTableField(raw, code, base) {
6329
6347
  field: FieldCode.create(conditionField),
6330
6348
  relatedField: FieldCode.create(conditionRelatedField)
6331
6349
  },
6332
- ...refTable.filterCond !== void 0 ? { filterCond: String(refTable.filterCond) } : {},
6350
+ filterCond: optionalQueryClause(refTable.filterCond),
6333
6351
  displayFields,
6334
- ...refTable.sort !== void 0 ? { sort: String(refTable.sort) } : {},
6335
- ...refTable.size !== void 0 ? { size: String(refTable.size) } : {}
6352
+ sort: optionalQueryClause(refTable.sort),
6353
+ ...size !== void 0 ? { size } : {}
6336
6354
  } }
6337
6355
  };
6338
6356
  }
@@ -9535,6 +9553,18 @@ function pairByKeyInOrder(local, remote, keyFn) {
9535
9553
  return pairs;
9536
9554
  }
9537
9555
  //#endregion
9556
+ //#region src/core/domain/notification/entity.ts
9557
+ /**
9558
+ * Display name of a per-record notification: the title as a name, otherwise
9559
+ * the filterCond quoted as a value so that it is distinguishable from a title
9560
+ * and its extent is readable.
9561
+ */
9562
+ function describePerRecordNotification(notif) {
9563
+ if (notif.title !== "") return notif.title;
9564
+ if (notif.filterCond !== "") return formatValue(notif.filterCond);
9565
+ return "(empty filter)";
9566
+ }
9567
+ //#endregion
9538
9568
  //#region src/core/domain/notification/services/diffDetector.ts
9539
9569
  function serializeEntity$1(entity) {
9540
9570
  return `${entity.type}:${entity.code}`;
@@ -9588,9 +9618,6 @@ function compareGeneralSection(local, remote) {
9588
9618
  });
9589
9619
  return entries;
9590
9620
  }
9591
- function perRecordLabel(notif) {
9592
- return notif.title || notif.filterCond || "(empty filter)";
9593
- }
9594
9621
  function describePerRecordChanges(local, remote) {
9595
9622
  const diffs = [];
9596
9623
  if (local.title !== remote.title) diffs.push(`title: ${formatValue(remote.title)} -> ${formatValue(local.title)}`);
@@ -9614,7 +9641,7 @@ function comparePerRecordSection(local, remote) {
9614
9641
  entries.push({
9615
9642
  type: "added",
9616
9643
  section: "perRecord",
9617
- name: perRecordLabel(pair.local),
9644
+ name: describePerRecordNotification(pair.local),
9618
9645
  details: "new notification"
9619
9646
  });
9620
9647
  break;
@@ -9622,14 +9649,14 @@ function comparePerRecordSection(local, remote) {
9622
9649
  entries.push({
9623
9650
  type: "deleted",
9624
9651
  section: "perRecord",
9625
- name: perRecordLabel(pair.remote),
9652
+ name: describePerRecordNotification(pair.remote),
9626
9653
  details: "removed"
9627
9654
  });
9628
9655
  break;
9629
9656
  case "both": if (!deepEqual(pair.local, pair.remote)) entries.push({
9630
9657
  type: "modified",
9631
9658
  section: "perRecord",
9632
- name: perRecordLabel(pair.local),
9659
+ name: describePerRecordNotification(pair.local),
9633
9660
  details: describePerRecordChanges(pair.local, pair.remote)
9634
9661
  });
9635
9662
  }
@@ -11196,9 +11223,9 @@ function serializeFlatField(field, size) {
11196
11223
  field: ref.condition.field,
11197
11224
  relatedField: ref.condition.relatedField
11198
11225
  },
11199
- ...ref.filterCond !== void 0 ? { filterCond: ref.filterCond } : {},
11226
+ filterCond: ref.filterCond,
11200
11227
  displayFields: ref.displayFields.map((f) => f),
11201
- ...ref.sort !== void 0 ? { sort: ref.sort } : {},
11228
+ sort: ref.sort,
11202
11229
  ...ref.size !== void 0 ? { size: ref.size } : {}
11203
11230
  };
11204
11231
  return result;
@@ -13960,8 +13987,9 @@ var capture_default$8 = createCaptureCommand({
13960
13987
  * reminder map). Plus the `timezone` scalar as a single whole-entity 3-way
13961
13988
  * when the local config manages it (sets a timezone).
13962
13989
  * - **perRecord** = group by `filterCond`, then within a group match by index
13963
- * (`filterCond#i` composite key — `comparePerRecordSection`). `perRecordLabel`
13964
- * is display-only and is NOT used as a match key.
13990
+ * (`filterCond#i` composite key — `comparePerRecordSection`).
13991
+ * `describePerRecordNotification` is display-only and is NOT used as a match
13992
+ * key.
13965
13993
  * - **general** = entity (`type:code`) keyed list (`compareGeneralSection`) plus
13966
13994
  * the `notifyToCommenter` scalar as a single whole-entity 3-way, so the scalar
13967
13995
  * is never dropped from the 3-way.
@@ -14140,14 +14168,15 @@ async function loadNotificationThreeWayInputs(container) {
14140
14168
  //#region src/core/application/notification/detectNotificationThreeWayDiff.ts
14141
14169
  /**
14142
14170
  * Human label for a merge entry. Uses the section-appropriate display value
14143
- * (`perRecordLabel` semantics for perRecord, `code`/title for reminder, the
14144
- * entity key for general) without affecting the match key.
14171
+ * (`describePerRecordNotification` for perRecord, the title or else the
14172
+ * `code` for reminder, the entity key for general) without affecting the
14173
+ * match key.
14145
14174
  */
14146
14175
  function entryLabel(entry) {
14147
14176
  const value = entry.local ?? entry.remote ?? entry.base;
14148
14177
  if (entry.key.startsWith("perRecord:")) {
14149
14178
  const n = value;
14150
- return n ? n.title || n.filterCond || "(empty filter)" : entry.key;
14179
+ return n ? describePerRecordNotification(n) : entry.key;
14151
14180
  }
14152
14181
  if (entry.key.startsWith("reminder:")) {
14153
14182
  const n = value;
@@ -15802,9 +15831,9 @@ async function applyPulledGeneralSettingsMerge({ container, input }) {
15802
15831
  * mirrors that key strategy exactly — group by `filterCond`, then key each entry
15803
15832
  * by its group-local index (`filterCond#i`) — so it is record-keyed (not a
15804
15833
  * coarse ordered-list merge) and the per-entry granularity of `record-acl diff`
15805
- * is preserved (one entry change = one conflict). The `perRecordLabel`-style
15806
- * positional matching means a reordering within a filterCond is seen as content
15807
- * changes at those indices, matching the existing 2-way detector.
15834
+ * is preserved (one entry change = one conflict). The positional matching
15835
+ * means a reordering within a filterCond is seen as content changes at those
15836
+ * indices, matching the existing 2-way detector.
15808
15837
  */
15809
15838
  function compositeKey(filterCond, index) {
15810
15839
  return `${filterCond}#${index}`;
@@ -17571,7 +17600,8 @@ async function detectRecordPermissionThreeWayDiff({ container }) {
17571
17600
  diff: await detectRecordPermissionDiff({ container })
17572
17601
  };
17573
17602
  return buildRecordThreeWayDiff(computeRecordPermissionThreeWayMerge(state, local, remote.config), (entry) => {
17574
- return (entry.local ?? entry.remote ?? entry.base)?.filterCond ?? entry.key;
17603
+ const right = entry.local ?? entry.remote ?? entry.base;
17604
+ return right ? describeRecordPermissionFilter(right.filterCond) : entry.key;
17575
17605
  });
17576
17606
  }
17577
17607
  //#endregion