kintone-migrator 0.35.6 → 0.35.8

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.
@@ -2834,11 +2846,32 @@ function printDiffResult(result) {
2834
2846
  });
2835
2847
  p.note(lines.join("\n"), "Diff Details", { format: (v) => v });
2836
2848
  }
2849
+ const plainThreeWayKeyStyle = {
2850
+ bracket: (text) => text,
2851
+ key: (text) => text
2852
+ };
2853
+ /**
2854
+ * Frames a 3-way entry's key (its display form, see `ThreeWayDiffEntry.key`)
2855
+ * as it appears on the 3-way diff line. Pull prompts reuse it so a conflict is
2856
+ * named exactly as its diff line names it.
2857
+ */
2858
+ function frameThreeWayKey(key, style = plainThreeWayKeyStyle) {
2859
+ return `${style.bracket("[")}${style.key(key)}${style.bracket("]")}`;
2860
+ }
2837
2861
  function formatThreeWayEntry(entry) {
2838
2862
  switch (entry.kind) {
2839
- case "localOnly": return `${pc.green("L")} ${pc.dim("[")}${pc.green(entry.key)}${pc.dim("]")} ${entry.label}${pc.dim(":")} local change`;
2840
- case "remoteOnly": return `${pc.yellow("R")} ${pc.dim("[")}${pc.yellow(entry.key)}${pc.dim("]")} ${entry.label}${pc.dim(":")} remote drift`;
2841
- case "conflict": return `${pc.red("C")} ${pc.dim("[")}${pc.red(entry.key)}${pc.dim("]")} ${entry.label}${pc.dim(":")} conflict`;
2863
+ case "localOnly": return `${pc.green("L")} ${frameThreeWayKey(entry.key, {
2864
+ bracket: pc.dim,
2865
+ key: pc.green
2866
+ })} ${entry.label}${pc.dim(":")} local change`;
2867
+ case "remoteOnly": return `${pc.yellow("R")} ${frameThreeWayKey(entry.key, {
2868
+ bracket: pc.dim,
2869
+ key: pc.yellow
2870
+ })} ${entry.label}${pc.dim(":")} remote drift`;
2871
+ case "conflict": return `${pc.red("C")} ${frameThreeWayKey(entry.key, {
2872
+ bracket: pc.dim,
2873
+ key: pc.red
2874
+ })} ${entry.label}${pc.dim(":")} conflict`;
2842
2875
  }
2843
2876
  }
2844
2877
  function formatThreeWayExtra(extra) {
@@ -2885,7 +2918,7 @@ function printProcessDiffResult(result) {
2885
2918
  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
2919
  }
2887
2920
  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}`);
2921
+ printGenericDiffResult(result, "Record Permission Diff Details", (entry, colorize, prefix) => `${colorize(prefix)} ${pc.dim("[")}${colorize(describeRecordPermissionFilter(entry.filterCond))}${pc.dim("]:")} ${entry.details}`);
2889
2922
  }
2890
2923
  function printReportDiffResult(result) {
2891
2924
  printGenericDiffResult(result, "Report Diff Details", (entry, colorize, prefix) => `${colorize(prefix)} ${colorize(entry.reportName)}${pc.dim(":")} ${entry.details}`);
@@ -3555,41 +3588,42 @@ function resolveActionMerge(merge, resolution) {
3555
3588
  //#region src/core/application/threeWay/threeWayDiff.ts
3556
3589
  /**
3557
3590
  * Builds the three-way portion of a {@link ThreeWayDiffResult} from a
3558
- * record-keyed merge (view / report / action / plugin). The caller supplies a
3559
- * `label` extractor (e.g. the view's name) for display.
3591
+ * record-keyed merge (view / report / action / plugin / customization / field
3592
+ * permission / app permission / record permission). The caller supplies a
3593
+ * `label` extractor (e.g. the view's type) for display.
3560
3594
  */
3561
- function buildRecordThreeWayDiff(merge, label, extras = [], notes = []) {
3595
+ function buildRecordThreeWayDiff(merge, label, { describeKey = (key) => key, notes = [] } = {}) {
3562
3596
  const localChanges = [];
3563
3597
  const remoteDrift = [];
3564
3598
  const conflicts = [];
3565
3599
  for (const entry of merge.entries) switch (entry.change.kind) {
3566
3600
  case "localOnly":
3567
3601
  localChanges.push({
3568
- key: entry.key,
3602
+ key: describeKey(entry.key),
3569
3603
  label: label(entry),
3570
3604
  kind: "localOnly"
3571
3605
  });
3572
3606
  break;
3573
3607
  case "remoteOnly":
3574
3608
  remoteDrift.push({
3575
- key: entry.key,
3609
+ key: describeKey(entry.key),
3576
3610
  label: label(entry),
3577
3611
  kind: "remoteOnly"
3578
3612
  });
3579
3613
  break;
3580
3614
  case "conflict": conflicts.push({
3581
- key: entry.key,
3615
+ key: describeKey(entry.key),
3582
3616
  label: label(entry),
3583
3617
  kind: "conflict"
3584
3618
  });
3585
3619
  }
3586
- const isEmpty = localChanges.length === 0 && remoteDrift.length === 0 && conflicts.length === 0 && extras.length === 0;
3620
+ const isEmpty = localChanges.length === 0 && remoteDrift.length === 0 && conflicts.length === 0;
3587
3621
  return {
3588
3622
  mode: "three-way",
3589
3623
  localChanges,
3590
3624
  remoteDrift,
3591
3625
  conflicts,
3592
- extras,
3626
+ extras: [],
3593
3627
  ...notes.length > 0 ? { notes } : {},
3594
3628
  isEmpty
3595
3629
  };
@@ -3901,6 +3935,15 @@ async function applyPulledActionMerge({ container, input }) {
3901
3935
  //#endregion
3902
3936
  //#region src/cli/commands/pullCommandFactory.ts
3903
3937
  /**
3938
+ * Names a conflict as the 3-way diff line does ({@link frameThreeWayKey}), for
3939
+ * domains whose keys embed values quoted in display (see
3940
+ * `ThreeWayDiffEntry.key`): the display form carries its own quotes, so
3941
+ * wrapping it in more quotes would blur where it ends again.
3942
+ */
3943
+ function nameConflictAsDiffLine(describeKey) {
3944
+ return (key) => frameThreeWayKey(describeKey(key));
3945
+ }
3946
+ /**
3904
3947
  * Factory for `pull` commands.
3905
3948
  *
3906
3949
  * Absorbs the boilerplate shared by every config domain: the two-stage pull
@@ -3912,6 +3955,7 @@ async function applyPulledActionMerge({ container, input }) {
3912
3955
  * top-level pull dispatcher.
3913
3956
  */
3914
3957
  function createPullCommand(config) {
3958
+ const nameConflict = config.nameConflict ?? ((key) => `"${key}"`);
3915
3959
  const notSupportedAll = new ValidationError(ValidationErrorCode.InvalidInput, `${config.description} does not support --all yet. Use --app <name> or a single app.`);
3916
3960
  async function resolveConflicts(merge, options) {
3917
3961
  const resolution = /* @__PURE__ */ new Map();
@@ -3925,7 +3969,7 @@ function createPullCommand(config) {
3925
3969
  continue;
3926
3970
  }
3927
3971
  const selected = await p.select({
3928
- message: `Conflict on ${config.conflictNoun} "${conflict.key}". Keep which side?`,
3972
+ message: `Conflict on ${config.conflictNoun} ${nameConflict(conflict.key)}. Keep which side?`,
3929
3973
  options: [{
3930
3974
  value: "local",
3931
3975
  label: "local (ours)"
@@ -5716,7 +5760,7 @@ function describePropertiesChanges(before, after) {
5716
5760
  function describeChanges$1(before, after) {
5717
5761
  const changes = [];
5718
5762
  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}`);
5763
+ if (before.label !== after.label) changes.push(`label: ${formatValue(before.label)} -> ${formatValue(after.label)}`);
5720
5764
  if ((before.noLabel ?? false) !== (after.noLabel ?? false)) changes.push(`noLabel: ${before.noLabel ?? false} -> ${after.noLabel ?? false}`);
5721
5765
  if (!isPropertiesEqual(before, after)) changes.push(...describePropertiesChanges(before, after));
5722
5766
  return changes.length > 0 ? changes.join("\n") : "no visible changes";
@@ -6277,6 +6321,13 @@ function invalidLookup(code, detail) {
6277
6321
  function optionalString(value) {
6278
6322
  return value === void 0 || value === null ? void 0 : String(value);
6279
6323
  }
6324
+ /**
6325
+ * Reads a filter condition or sort order; an omitted or valueless one is `""`,
6326
+ * the value kintone returns when it is unset.
6327
+ */
6328
+ function optionalQueryClause(value) {
6329
+ return optionalString(value) ?? "";
6330
+ }
6280
6331
  /** Reads a lookup list; an omitted or valueless list is the empty list. */
6281
6332
  function optionalLookupList(code, key, value) {
6282
6333
  if (value === void 0 || value === null) return [];
@@ -6296,15 +6347,13 @@ function parseLookup(code, raw) {
6296
6347
  relatedField: String(mapping.relatedField ?? "")
6297
6348
  };
6298
6349
  });
6299
- const filterCond = optionalString(raw.filterCond);
6300
- const sort = optionalString(raw.sort);
6301
6350
  return {
6302
6351
  relatedApp: LookupRelatedApp.create(String(raw.relatedApp.app ?? ""), optionalString(raw.relatedApp.code)),
6303
6352
  relatedKeyField: String(raw.relatedKeyField ?? ""),
6304
6353
  fieldMappings,
6305
6354
  lookupPickerFields,
6306
- ...filterCond !== void 0 ? { filterCond } : {},
6307
- ...sort !== void 0 ? { sort } : {}
6355
+ filterCond: optionalQueryClause(raw.filterCond),
6356
+ sort: optionalQueryClause(raw.sort)
6308
6357
  };
6309
6358
  }
6310
6359
  function parseReferenceTableField(raw, code, base) {
@@ -6318,6 +6367,7 @@ function parseReferenceTableField(raw, code, base) {
6318
6367
  const relatedApp = refTable.relatedApp;
6319
6368
  const conditionField = String(condition.field ?? "");
6320
6369
  const conditionRelatedField = String(condition.relatedField ?? "");
6370
+ const size = optionalString(refTable.size);
6321
6371
  if (conditionField.length === 0) throw new BusinessRuleError(FormSchemaErrorCode.FsInvalidSchemaStructure, `Field "${code}" of type REFERENCE_TABLE must have a non-empty "referenceTable.condition.field"`);
6322
6372
  if (conditionRelatedField.length === 0) throw new BusinessRuleError(FormSchemaErrorCode.FsInvalidSchemaStructure, `Field "${code}" of type REFERENCE_TABLE must have a non-empty "referenceTable.condition.relatedField"`);
6323
6373
  return {
@@ -6329,10 +6379,10 @@ function parseReferenceTableField(raw, code, base) {
6329
6379
  field: FieldCode.create(conditionField),
6330
6380
  relatedField: FieldCode.create(conditionRelatedField)
6331
6381
  },
6332
- ...refTable.filterCond !== void 0 ? { filterCond: String(refTable.filterCond) } : {},
6382
+ filterCond: optionalQueryClause(refTable.filterCond),
6333
6383
  displayFields,
6334
- ...refTable.sort !== void 0 ? { sort: String(refTable.sort) } : {},
6335
- ...refTable.size !== void 0 ? { size: String(refTable.size) } : {}
6384
+ sort: optionalQueryClause(refTable.sort),
6385
+ ...size !== void 0 ? { size } : {}
6336
6386
  } }
6337
6387
  };
6338
6388
  }
@@ -9535,6 +9585,18 @@ function pairByKeyInOrder(local, remote, keyFn) {
9535
9585
  return pairs;
9536
9586
  }
9537
9587
  //#endregion
9588
+ //#region src/core/domain/notification/entity.ts
9589
+ /**
9590
+ * Display name of a per-record notification: the title as a name, otherwise
9591
+ * the filterCond quoted as a value so that it is distinguishable from a title
9592
+ * and its extent is readable.
9593
+ */
9594
+ function describePerRecordNotification(notif) {
9595
+ if (notif.title !== "") return notif.title;
9596
+ if (notif.filterCond !== "") return formatValue(notif.filterCond);
9597
+ return "(empty filter)";
9598
+ }
9599
+ //#endregion
9538
9600
  //#region src/core/domain/notification/services/diffDetector.ts
9539
9601
  function serializeEntity$1(entity) {
9540
9602
  return `${entity.type}:${entity.code}`;
@@ -9588,9 +9650,6 @@ function compareGeneralSection(local, remote) {
9588
9650
  });
9589
9651
  return entries;
9590
9652
  }
9591
- function perRecordLabel(notif) {
9592
- return notif.title || notif.filterCond || "(empty filter)";
9593
- }
9594
9653
  function describePerRecordChanges(local, remote) {
9595
9654
  const diffs = [];
9596
9655
  if (local.title !== remote.title) diffs.push(`title: ${formatValue(remote.title)} -> ${formatValue(local.title)}`);
@@ -9614,7 +9673,7 @@ function comparePerRecordSection(local, remote) {
9614
9673
  entries.push({
9615
9674
  type: "added",
9616
9675
  section: "perRecord",
9617
- name: perRecordLabel(pair.local),
9676
+ name: describePerRecordNotification(pair.local),
9618
9677
  details: "new notification"
9619
9678
  });
9620
9679
  break;
@@ -9622,14 +9681,14 @@ function comparePerRecordSection(local, remote) {
9622
9681
  entries.push({
9623
9682
  type: "deleted",
9624
9683
  section: "perRecord",
9625
- name: perRecordLabel(pair.remote),
9684
+ name: describePerRecordNotification(pair.remote),
9626
9685
  details: "removed"
9627
9686
  });
9628
9687
  break;
9629
9688
  case "both": if (!deepEqual(pair.local, pair.remote)) entries.push({
9630
9689
  type: "modified",
9631
9690
  section: "perRecord",
9632
- name: perRecordLabel(pair.local),
9691
+ name: describePerRecordNotification(pair.local),
9633
9692
  details: describePerRecordChanges(pair.local, pair.remote)
9634
9693
  });
9635
9694
  }
@@ -11196,9 +11255,9 @@ function serializeFlatField(field, size) {
11196
11255
  field: ref.condition.field,
11197
11256
  relatedField: ref.condition.relatedField
11198
11257
  },
11199
- ...ref.filterCond !== void 0 ? { filterCond: ref.filterCond } : {},
11258
+ filterCond: ref.filterCond,
11200
11259
  displayFields: ref.displayFields.map((f) => f),
11201
- ...ref.sort !== void 0 ? { sort: ref.sort } : {},
11260
+ sort: ref.sort,
11202
11261
  ...ref.size !== void 0 ? { size: ref.size } : {}
11203
11262
  };
11204
11263
  return result;
@@ -12449,7 +12508,7 @@ async function detectCustomizationThreeWayDiff({ container, input }) {
12449
12508
  remote,
12450
12509
  basePath: input.basePath
12451
12510
  });
12452
- return buildRecordThreeWayDiff(merge, (entry) => entry.key, [], buildNotes(estimatedKeys, unreadableLocalKeys, new Set(merge.entries.filter((entry) => entry.change.kind === "localOnly" || entry.change.kind === "remoteOnly" || entry.change.kind === "conflict").map((entry) => entry.key))));
12511
+ return buildRecordThreeWayDiff(merge, (entry) => entry.key, { notes: buildNotes(estimatedKeys, unreadableLocalKeys, new Set(merge.entries.filter((entry) => entry.change.kind === "localOnly" || entry.change.kind === "remoteOnly" || entry.change.kind === "conflict").map((entry) => entry.key))) });
12453
12512
  }
12454
12513
  //#endregion
12455
12514
  //#region src/cli/commands/customize/diff.ts
@@ -13944,6 +14003,26 @@ var capture_default$8 = createCaptureCommand({
13944
14003
  resolveAppContainerConfig: resolveNotificationAppContainerConfig
13945
14004
  });
13946
14005
  //#endregion
14006
+ //#region src/core/domain/services/filterCondKey.ts
14007
+ /**
14008
+ * Merge key of the `index`-th entry among the entries sharing `filterCond`
14009
+ * (record permission rights, perRecord notifications). The index suffix comes
14010
+ * after the full filterCond, so the last `#` always starts the index even when
14011
+ * the filterCond itself contains `#`.
14012
+ */
14013
+ function filterCondKey(filterCond, index) {
14014
+ return `${filterCond}#${index}`;
14015
+ }
14016
+ /**
14017
+ * Display form of a {@link filterCondKey}: the filterCond quoted as a value,
14018
+ * then the index (`"status = \"A\""#0`). Quoting keeps a `]`, `#`, `"` or
14019
+ * newline in the filterCond from blurring where the key ends.
14020
+ */
14021
+ function describeFilterCondKey(key) {
14022
+ const indexStart = key.lastIndexOf("#");
14023
+ return `${formatValue(key.slice(0, indexStart))}${key.slice(indexStart)}`;
14024
+ }
14025
+ //#endregion
13947
14026
  //#region src/core/domain/notification/services/notificationMerge.ts
13948
14027
  /**
13949
14028
  * 3-way merge for the notification domain (general / perRecord / reminder).
@@ -13960,22 +14039,36 @@ var capture_default$8 = createCaptureCommand({
13960
14039
  * reminder map). Plus the `timezone` scalar as a single whole-entity 3-way
13961
14040
  * when the local config manages it (sets a timezone).
13962
14041
  * - **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.
14042
+ * (`filterCond#i` composite key — `comparePerRecordSection`).
14043
+ * `describePerRecordNotification` is display-only and is NOT used as a match
14044
+ * key.
13965
14045
  * - **general** = entity (`type:code`) keyed list (`compareGeneralSection`) plus
13966
14046
  * the `notifyToCommenter` scalar as a single whole-entity 3-way, so the scalar
13967
14047
  * is never dropped from the 3-way.
13968
14048
  */
13969
- const GENERAL_SCALAR_KEY = "general:notifyToCommenter";
13970
- const REMINDER_TIMEZONE_KEY = "reminder:timezone";
14049
+ const GENERAL_KEY_PREFIX = "general:";
14050
+ const PER_RECORD_KEY_PREFIX = "perRecord:";
14051
+ const REMINDER_KEY_PREFIX = "reminder:";
14052
+ const GENERAL_SCALAR_KEY = `${GENERAL_KEY_PREFIX}notifyToCommenter`;
14053
+ const REMINDER_TIMEZONE_KEY = `${REMINDER_KEY_PREFIX}timezone`;
13971
14054
  function generalEntityKey(notif) {
13972
- return `general:${notif.entity.type}:${notif.entity.code}`;
14055
+ return `${GENERAL_KEY_PREFIX}${notif.entity.type}:${notif.entity.code}`;
13973
14056
  }
13974
14057
  function perRecordCompositeKey(filterCond, index) {
13975
- return `perRecord:${filterCond}#${index}`;
14058
+ return `${PER_RECORD_KEY_PREFIX}${filterCondKey(filterCond, index)}`;
13976
14059
  }
13977
14060
  function reminderKey(notif) {
13978
- return `reminder:${notif.code}`;
14061
+ return `${REMINDER_KEY_PREFIX}${notif.code}`;
14062
+ }
14063
+ /**
14064
+ * Display form of a merge key. A perRecord key carries a filterCond, which is
14065
+ * quoted ({@link describeFilterCondKey}); the other keys are built from names
14066
+ * and are shown as they are.
14067
+ */
14068
+ function describeNotificationMergeKey(key) {
14069
+ if (!key.startsWith(PER_RECORD_KEY_PREFIX)) return key;
14070
+ const filterCondPart = key.slice(10);
14071
+ return `${PER_RECORD_KEY_PREFIX}${describeFilterCondKey(filterCondPart)}`;
13979
14072
  }
13980
14073
  /**
13981
14074
  * General notification equality, matching `compareGeneralNotification`:
@@ -14051,7 +14144,7 @@ function resolveEntryValue(entry, resolution) {
14051
14144
  function collectGeneralNotifications(entries, resolution) {
14052
14145
  const result = [];
14053
14146
  for (const entry of entries) {
14054
- if (!entry.key.startsWith("general:") || entry.key === GENERAL_SCALAR_KEY) continue;
14147
+ if (!entry.key.startsWith(GENERAL_KEY_PREFIX) || entry.key === GENERAL_SCALAR_KEY) continue;
14055
14148
  const value = resolveEntryValue(entry, resolution);
14056
14149
  if (value !== void 0) result.push(value);
14057
14150
  }
@@ -14060,7 +14153,7 @@ function collectGeneralNotifications(entries, resolution) {
14060
14153
  function collectPerRecordNotifications(entries, resolution) {
14061
14154
  const result = [];
14062
14155
  for (const entry of entries) {
14063
- if (!entry.key.startsWith("perRecord:")) continue;
14156
+ if (!entry.key.startsWith(PER_RECORD_KEY_PREFIX)) continue;
14064
14157
  const value = resolveEntryValue(entry, resolution);
14065
14158
  if (value !== void 0) result.push(value);
14066
14159
  }
@@ -14069,7 +14162,7 @@ function collectPerRecordNotifications(entries, resolution) {
14069
14162
  function collectReminderNotifications(entries, resolution) {
14070
14163
  const result = [];
14071
14164
  for (const entry of entries) {
14072
- if (!entry.key.startsWith("reminder:") || entry.key === REMINDER_TIMEZONE_KEY) continue;
14165
+ if (!entry.key.startsWith(REMINDER_KEY_PREFIX) || entry.key === REMINDER_TIMEZONE_KEY) continue;
14073
14166
  const value = resolveEntryValue(entry, resolution);
14074
14167
  if (value !== void 0) result.push(value);
14075
14168
  }
@@ -14140,14 +14233,15 @@ async function loadNotificationThreeWayInputs(container) {
14140
14233
  //#region src/core/application/notification/detectNotificationThreeWayDiff.ts
14141
14234
  /**
14142
14235
  * 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.
14236
+ * (`describePerRecordNotification` for perRecord, the title or else the
14237
+ * `code` for reminder, the entity key for general) without affecting the
14238
+ * match key.
14145
14239
  */
14146
14240
  function entryLabel(entry) {
14147
14241
  const value = entry.local ?? entry.remote ?? entry.base;
14148
14242
  if (entry.key.startsWith("perRecord:")) {
14149
14243
  const n = value;
14150
- return n ? n.title || n.filterCond || "(empty filter)" : entry.key;
14244
+ return n ? describePerRecordNotification(n) : entry.key;
14151
14245
  }
14152
14246
  if (entry.key.startsWith("reminder:")) {
14153
14247
  const n = value;
@@ -14193,7 +14287,7 @@ function buildThreeWay(merge) {
14193
14287
  const extras = [];
14194
14288
  for (const entry of merge.entries) {
14195
14289
  const base = {
14196
- key: entry.key,
14290
+ key: describeNotificationMergeKey(entry.key),
14197
14291
  label: entryLabel(entry)
14198
14292
  };
14199
14293
  switch (entry.change.kind) {
@@ -14366,6 +14460,7 @@ var pull_default$8 = createPullCommand({
14366
14460
  args: notificationArgs,
14367
14461
  subject: "notification config",
14368
14462
  conflictNoun: "notification",
14463
+ nameConflict: nameConflictAsDiffLine(describeNotificationMergeKey),
14369
14464
  createContainer: createNotificationCliContainer,
14370
14465
  pullFn: async ({ container, input }) => {
14371
14466
  const result = await pullNotification({
@@ -15802,19 +15897,20 @@ async function applyPulledGeneralSettingsMerge({ container, input }) {
15802
15897
  * mirrors that key strategy exactly — group by `filterCond`, then key each entry
15803
15898
  * by its group-local index (`filterCond#i`) — so it is record-keyed (not a
15804
15899
  * 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.
15900
+ * is preserved (one entry change = one conflict). The positional matching
15901
+ * means a reordering within a filterCond is seen as content changes at those
15902
+ * indices, matching the existing 2-way detector.
15808
15903
  */
15809
- function compositeKey(filterCond, index) {
15810
- return `${filterCond}#${index}`;
15904
+ /** Display form of a merge key, with its filterCond quoted. */
15905
+ function describeRecordPermissionMergeKey(key) {
15906
+ return describeFilterCondKey(key);
15811
15907
  }
15812
15908
  /** Converts the ordered `rights` list into a record keyed by `filterCond#i`. */
15813
15909
  function toRecord(config) {
15814
15910
  const record = {};
15815
15911
  const grouped = groupByKey(config.rights, (r) => r.filterCond);
15816
15912
  for (const [filterCond, group] of grouped) group.forEach((right, i) => {
15817
- record[compositeKey(filterCond, i)] = right;
15913
+ record[filterCondKey(filterCond, i)] = right;
15818
15914
  });
15819
15915
  return record;
15820
15916
  }
@@ -17571,8 +17667,9 @@ async function detectRecordPermissionThreeWayDiff({ container }) {
17571
17667
  diff: await detectRecordPermissionDiff({ container })
17572
17668
  };
17573
17669
  return buildRecordThreeWayDiff(computeRecordPermissionThreeWayMerge(state, local, remote.config), (entry) => {
17574
- return (entry.local ?? entry.remote ?? entry.base)?.filterCond ?? entry.key;
17575
- });
17670
+ const right = entry.local ?? entry.remote ?? entry.base;
17671
+ return right ? describeRecordPermissionFilter(right.filterCond) : entry.key;
17672
+ }, { describeKey: describeRecordPermissionMergeKey });
17576
17673
  }
17577
17674
  //#endregion
17578
17675
  //#region src/cli/commands/record-acl/diff.ts
@@ -17622,6 +17719,7 @@ var pull_default$4 = createPullCommand({
17622
17719
  args: recordAclArgs,
17623
17720
  subject: "record permission config",
17624
17721
  conflictNoun: "record permission",
17722
+ nameConflict: nameConflictAsDiffLine(describeRecordPermissionMergeKey),
17625
17723
  createContainer: createRecordPermissionCliContainer,
17626
17724
  pullFn: async ({ container, input }) => {
17627
17725
  const result = await pullRecordPermission({