kintone-migrator 0.34.6 → 0.35.1

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
@@ -199,6 +199,7 @@ const ViewErrorCode = {
199
199
  * This error is thrown when domain logic determines that an operation cannot proceed.
200
200
  */
201
201
  var BusinessRuleError = class extends AnyError {
202
+ code;
202
203
  name = "BusinessRuleError";
203
204
  constructor(code, message, cause) {
204
205
  super(message, cause);
@@ -228,6 +229,7 @@ function wrapBusinessRuleError(fn) {
228
229
  }
229
230
  }
230
231
  var ApplicationError = class extends AnyError {
232
+ code;
231
233
  name = "ApplicationError";
232
234
  constructor(code, message, cause) {
233
235
  super(message, cause);
@@ -239,6 +241,7 @@ const NotFoundErrorCode = {
239
241
  AppNotFound: "APP_NOT_FOUND"
240
242
  };
241
243
  var NotFoundError = class extends ApplicationError {
244
+ code;
242
245
  name = "NotFoundError";
243
246
  constructor(code, message, cause) {
244
247
  super(code, message, cause);
@@ -250,9 +253,18 @@ function isNotFoundError(error) {
250
253
  }
251
254
  const ConflictErrorCode = {
252
255
  Conflict: "CONFLICT",
256
+ /**
257
+ * The remote config drifted from the base snapshot and the push was not
258
+ * forced (push-specific drift). Distinct from
259
+ * {@link Conflict}, which the kintone adapter uses for API optimistic-lock
260
+ * (409) conflicts, so the CLI can tell snapshot drift apart from TOCTOU
261
+ * conflicts by code rather than by message string. Shared by every config
262
+ * domain (schema, view, ...), not schema-specific.
263
+ */
253
264
  ConfigDrift: "CONFIG_DRIFT"
254
265
  };
255
266
  var ConflictError = class extends ApplicationError {
267
+ code;
256
268
  name = "ConflictError";
257
269
  constructor(code, message, cause) {
258
270
  super(code, message, cause);
@@ -267,6 +279,7 @@ const UnauthenticatedErrorCode = {
267
279
  InvalidCredentials: "INVALID_CREDENTIALS"
268
280
  };
269
281
  var UnauthenticatedError = class extends ApplicationError {
282
+ code;
270
283
  name = "UnauthenticatedError";
271
284
  constructor(code, message, cause) {
272
285
  super(code, message, cause);
@@ -278,6 +291,7 @@ function isUnauthenticatedError(error) {
278
291
  }
279
292
  const ForbiddenErrorCode = { InsufficientPermissions: "INSUFFICIENT_PERMISSIONS" };
280
293
  var ForbiddenError = class extends ApplicationError {
294
+ code;
281
295
  name = "ForbiddenError";
282
296
  constructor(code, message, cause) {
283
297
  super(code, message, cause);
@@ -289,6 +303,7 @@ function isForbiddenError(error) {
289
303
  }
290
304
  const ValidationErrorCode = { InvalidInput: "INVALID_INPUT" };
291
305
  var ValidationError = class extends ApplicationError {
306
+ code;
292
307
  name = "ValidationError";
293
308
  constructor(code, message, cause) {
294
309
  super(code, message, cause);
@@ -308,6 +323,7 @@ const SystemErrorCode = {
308
323
  ExecutionError: "EXECUTION_ERROR"
309
324
  };
310
325
  var SystemError = class extends ApplicationError {
326
+ code;
311
327
  name = "SystemError";
312
328
  constructor(code, message, cause) {
313
329
  super(code, message, cause);
@@ -420,11 +436,11 @@ function validateParsedConfig(parsed, invalidConfigStructure, domainLabel) {
420
436
  if (!isRecord(parsed)) throw new BusinessRuleError(invalidConfigStructure, `${domainLabel} config must be an object`);
421
437
  return parsed;
422
438
  }
423
- const VALID_SRC_TYPES = new Set(["FIELD", "RECORD_URL"]);
439
+ const VALID_SRC_TYPES = /* @__PURE__ */ new Set(["FIELD", "RECORD_URL"]);
424
440
  function isActionMappingSrcType(value) {
425
441
  return VALID_SRC_TYPES.has(value);
426
442
  }
427
- const VALID_ENTITY_TYPES$9 = new Set([
443
+ const VALID_ENTITY_TYPES$9 = /* @__PURE__ */ new Set([
428
444
  "USER",
429
445
  "GROUP",
430
446
  "ORGANIZATION"
@@ -702,7 +718,7 @@ function buildDiffResult(entries, warnings = []) {
702
718
  * (absence) compared to a defined value (presence) is always "changed".
703
719
  */
704
720
  function classifyThreeWay(base, local, remote, eq) {
705
- const keys = new Set([
721
+ const keys = /* @__PURE__ */ new Set([
706
722
  ...base.keys(),
707
723
  ...local.keys(),
708
724
  ...remote.keys()
@@ -948,6 +964,8 @@ function toKintoneAction$1(action) {
948
964
  };
949
965
  }
950
966
  var KintoneActionConfigurator = class {
967
+ client;
968
+ appId;
951
969
  constructor(client, appId) {
952
970
  this.client = client;
953
971
  this.appId = appId;
@@ -987,7 +1005,7 @@ var KintoneActionConfigurator = class {
987
1005
  };
988
1006
  //#endregion
989
1007
  //#region src/core/adapters/kintone/appDeployer.ts
990
- const VALID_DEPLOY_STATUSES = new Set([
1008
+ const VALID_DEPLOY_STATUSES = /* @__PURE__ */ new Set([
991
1009
  "PROCESSING",
992
1010
  "SUCCESS",
993
1011
  "FAIL",
@@ -999,6 +1017,8 @@ function isDeployStatus(value) {
999
1017
  const DEFAULT_POLL_INTERVAL_MS = 1e3;
1000
1018
  const DEFAULT_MAX_RETRIES = 180;
1001
1019
  var KintoneAppDeployer = class {
1020
+ client;
1021
+ appId;
1002
1022
  pollIntervalMs;
1003
1023
  maxRetries;
1004
1024
  constructor(client, appId, config) {
@@ -1062,6 +1082,8 @@ var KintoneAppDeployer = class {
1062
1082
  * so the `--all` early-skip compares like-with-like against the stored base.
1063
1083
  */
1064
1084
  var KintoneAppRevisionReader = class {
1085
+ client;
1086
+ appId;
1065
1087
  constructor(client, appId) {
1066
1088
  this.client = client;
1067
1089
  this.appId = appId;
@@ -1134,7 +1156,7 @@ const configCodec = {
1134
1156
  defaultStringType: "PLAIN"
1135
1157
  })
1136
1158
  };
1137
- const VALID_SCOPES = new Set([
1159
+ const VALID_SCOPES = /* @__PURE__ */ new Set([
1138
1160
  "ALL",
1139
1161
  "ADMIN",
1140
1162
  "NONE"
@@ -1142,7 +1164,7 @@ const VALID_SCOPES = new Set([
1142
1164
  function isCustomizationScope(value) {
1143
1165
  return VALID_SCOPES.has(value);
1144
1166
  }
1145
- const VALID_RESOURCE_TYPES = new Set(["FILE", "URL"]);
1167
+ const VALID_RESOURCE_TYPES = /* @__PURE__ */ new Set(["FILE", "URL"]);
1146
1168
  function isResourceType(value) {
1147
1169
  return VALID_RESOURCE_TYPES.has(value);
1148
1170
  }
@@ -1184,6 +1206,8 @@ function toKintoneResourceList(resources) {
1184
1206
  return resources.map(toKintoneResource);
1185
1207
  }
1186
1208
  var KintoneCustomizationConfigurator = class {
1209
+ client;
1210
+ appId;
1187
1211
  constructor(client, appId) {
1188
1212
  this.client = client;
1189
1213
  this.appId = appId;
@@ -1237,6 +1261,7 @@ var KintoneCustomizationConfigurator = class {
1237
1261
  //#endregion
1238
1262
  //#region src/core/adapters/kintone/fileDownloader.ts
1239
1263
  var KintoneFileDownloader = class {
1264
+ client;
1240
1265
  constructor(client) {
1241
1266
  this.client = client;
1242
1267
  }
@@ -1298,6 +1323,8 @@ function isSafePath(targetPath, baseDir) {
1298
1323
  //#endregion
1299
1324
  //#region src/core/adapters/kintone/fileUploader.ts
1300
1325
  var KintoneFileUploader = class {
1326
+ client;
1327
+ baseDir;
1301
1328
  constructor(client, baseDir) {
1302
1329
  this.client = client;
1303
1330
  this.baseDir = baseDir;
@@ -1324,6 +1351,10 @@ var KintoneFileUploader = class {
1324
1351
  */
1325
1352
  const SKIP_REVISION_CHECK = Symbol("skip-revision-check");
1326
1353
  //#endregion
1354
+ //#region src/core/domain/formSchema/ports/formReadTarget.ts
1355
+ /** The generation read when a caller does not specify a target. */
1356
+ const DEFAULT_FORM_READ_TARGET = "preview";
1357
+ //#endregion
1327
1358
  //#region src/lib/charValidation.ts
1328
1359
  /** Returns true if the string contains any control characters (0x00–0x1f or 0x7f). */
1329
1360
  function hasControlChars(s) {
@@ -1360,7 +1391,7 @@ const FieldCode = { create: (code) => {
1360
1391
  } };
1361
1392
  //#endregion
1362
1393
  //#region src/core/adapters/kintone/formConfigurator.ts
1363
- const KNOWN_FIELD_TYPES = new Set([
1394
+ const KNOWN_FIELD_TYPES = /* @__PURE__ */ new Set([
1364
1395
  "SINGLE_LINE_TEXT",
1365
1396
  "MULTI_LINE_TEXT",
1366
1397
  "RICH_TEXT",
@@ -1382,7 +1413,7 @@ const KNOWN_FIELD_TYPES = new Set([
1382
1413
  "SUBTABLE",
1383
1414
  "REFERENCE_TABLE"
1384
1415
  ]);
1385
- const SYSTEM_FIELD_TYPES$2 = new Set([
1416
+ const SYSTEM_FIELD_TYPES$2 = /* @__PURE__ */ new Set([
1386
1417
  "RECORD_NUMBER",
1387
1418
  "CREATOR",
1388
1419
  "CREATED_TIME",
@@ -1392,7 +1423,7 @@ const SYSTEM_FIELD_TYPES$2 = new Set([
1392
1423
  "STATUS",
1393
1424
  "STATUS_ASSIGNEE"
1394
1425
  ]);
1395
- const DECORATION_TYPES$1 = new Set([
1426
+ const DECORATION_TYPES$1 = /* @__PURE__ */ new Set([
1396
1427
  "LABEL",
1397
1428
  "SPACER",
1398
1429
  "HR"
@@ -1677,20 +1708,31 @@ function toKintoneLayoutItem(item) {
1677
1708
  default: throw new SystemError(SystemErrorCode.ExternalApiError, `Unknown layout item type: ${item.type}`);
1678
1709
  }
1679
1710
  }
1711
+ const GET_FIELDS_FAILURE_MESSAGES = {
1712
+ preview: "Failed to get form fields",
1713
+ published: "Failed to get published form fields (the app may not be deployed yet, or the credentials may not be allowed to read it)"
1714
+ };
1715
+ const GET_LAYOUT_FAILURE_MESSAGES = {
1716
+ preview: "Failed to get form layout",
1717
+ published: "Failed to get published form layout (the app may not be deployed yet, or the credentials may not be allowed to read it)"
1718
+ };
1680
1719
  var KintoneFormConfigurator = class {
1720
+ client;
1721
+ appId;
1681
1722
  revisionTracker;
1682
1723
  constructor(client, appId, revisionTracker) {
1683
1724
  this.client = client;
1684
1725
  this.appId = appId;
1685
1726
  this.revisionTracker = revisionTracker ?? new RevisionTracker();
1686
1727
  }
1687
- async getFields() {
1728
+ async getFields(target = DEFAULT_FORM_READ_TARGET) {
1729
+ const preview = target === "preview";
1688
1730
  try {
1689
1731
  const { properties, revision } = await this.client.app.getFormFields({
1690
1732
  app: this.appId,
1691
- preview: true
1733
+ preview
1692
1734
  });
1693
- if (revision) this.revisionTracker.track(revision);
1735
+ if (revision && target === "preview") this.revisionTracker.track(revision);
1694
1736
  const fields = /* @__PURE__ */ new Map();
1695
1737
  for (const [code, prop] of Object.entries(properties)) {
1696
1738
  const kintoneProp = prop;
@@ -1701,7 +1743,7 @@ var KintoneFormConfigurator = class {
1701
1743
  }
1702
1744
  return fields;
1703
1745
  } catch (error) {
1704
- throw wrapKintoneError(error, "Failed to get form fields");
1746
+ throw wrapKintoneError(error, GET_FIELDS_FAILURE_MESSAGES[target]);
1705
1747
  }
1706
1748
  }
1707
1749
  async getRevision() {
@@ -1764,16 +1806,17 @@ var KintoneFormConfigurator = class {
1764
1806
  throw wrapKintoneError(error, "Failed to delete form fields");
1765
1807
  }
1766
1808
  }
1767
- async getLayout() {
1809
+ async getLayout(target = DEFAULT_FORM_READ_TARGET) {
1810
+ const preview = target === "preview";
1768
1811
  try {
1769
1812
  const response = await this.client.app.getFormLayout({
1770
1813
  app: this.appId,
1771
- preview: true
1814
+ preview
1772
1815
  });
1773
- if (response.revision) this.revisionTracker.track(response.revision);
1816
+ if (response.revision && target === "preview") this.revisionTracker.track(response.revision);
1774
1817
  return response.layout.map(fromKintoneLayoutItem);
1775
1818
  } catch (error) {
1776
- throw wrapKintoneError(error, "Failed to get form layout");
1819
+ throw wrapKintoneError(error, GET_LAYOUT_FAILURE_MESSAGES[target]);
1777
1820
  }
1778
1821
  }
1779
1822
  async updateLayout(layout, expectedRevision) {
@@ -1793,7 +1836,7 @@ var KintoneFormConfigurator = class {
1793
1836
  };
1794
1837
  //#endregion
1795
1838
  //#region src/core/adapters/kintone/recordConverter.ts
1796
- const SYSTEM_FIELDS = new Set([
1839
+ const SYSTEM_FIELDS = /* @__PURE__ */ new Set([
1797
1840
  "$id",
1798
1841
  "$revision",
1799
1842
  "RECORD_NUMBER",
@@ -1805,7 +1848,7 @@ const SYSTEM_FIELDS = new Set([
1805
1848
  "STATUS_ASSIGNEE",
1806
1849
  "CATEGORY"
1807
1850
  ]);
1808
- const SYSTEM_FIELD_TYPES$1 = new Set([
1851
+ const SYSTEM_FIELD_TYPES$1 = /* @__PURE__ */ new Set([
1809
1852
  "RECORD_NUMBER",
1810
1853
  "__ID__",
1811
1854
  "__REVISION__",
@@ -1890,6 +1933,8 @@ function extractId(record) {
1890
1933
  return $id.value;
1891
1934
  }
1892
1935
  var KintoneRecordManager = class {
1936
+ client;
1937
+ appId;
1893
1938
  constructor(client, appId) {
1894
1939
  this.client = client;
1895
1940
  this.appId = appId;
@@ -1978,6 +2023,7 @@ var LocalFileContentReader = class {
1978
2023
  //#endregion
1979
2024
  //#region src/core/adapters/local/fileWriter.ts
1980
2025
  var LocalFileWriter = class {
2026
+ baseDir;
1981
2027
  constructor(baseDir = process.cwd()) {
1982
2028
  this.baseDir = baseDir;
1983
2029
  }
@@ -2028,9 +2074,10 @@ function createCliContainer(config) {
2028
2074
  };
2029
2075
  }
2030
2076
  function createSeedCliContainer(config) {
2077
+ const client = config.client ?? createKintoneClient(config);
2031
2078
  return {
2032
2079
  configCodec,
2033
- recordManager: new KintoneRecordManager(config.client ?? createKintoneClient(config), config.appId),
2080
+ recordManager: new KintoneRecordManager(client, config.appId),
2034
2081
  seedStorage: createLocalFileSeedStorage(config.seedFilePath)
2035
2082
  };
2036
2083
  }
@@ -2320,7 +2367,7 @@ async function executeMultiApp(plan, executor) {
2320
2367
  }
2321
2368
  //#endregion
2322
2369
  //#region src/core/domain/projectConfig/valueObject.ts
2323
- const INVALID_APP_NAME_CHARS = new Set([
2370
+ const INVALID_APP_NAME_CHARS = /* @__PURE__ */ new Set([
2324
2371
  "/",
2325
2372
  "\\",
2326
2373
  ":",
@@ -2706,6 +2753,13 @@ function printCustomizationDiffResult(result) {
2706
2753
  return `${colorize(prefix)} ${pc.dim("[")}${colorize(location)}${pc.dim("]")} ${entry.name}${pc.dim(":")} ${entry.details}`;
2707
2754
  });
2708
2755
  }
2756
+ function printSchemaDiffTarget(target) {
2757
+ if (target === "published") {
2758
+ p.log.info("Comparing against the published (deployed) form (2-way; base snapshot not used).");
2759
+ return;
2760
+ }
2761
+ p.log.info("Comparing against the preview (unpublished) form.");
2762
+ }
2709
2763
  function printDiffResult(result) {
2710
2764
  if (result.isEmpty) {
2711
2765
  p.log.info("No changes detected.");
@@ -2797,9 +2851,7 @@ function printMultiAppResult(result) {
2797
2851
  case "skipped":
2798
2852
  p.log.warn(` ${pc.dim("-")} Skipped: ${r.name}`);
2799
2853
  break;
2800
- default:
2801
- r.status;
2802
- break;
2854
+ default: r.status;
2803
2855
  }
2804
2856
  }
2805
2857
  async function confirmAndDeploy(containers, skipConfirm, successMessage = "Deployed to production.") {
@@ -3464,14 +3516,11 @@ function buildRecordThreeWayDiff(merge, label, extras = [], notes = []) {
3464
3516
  kind: "remoteOnly"
3465
3517
  });
3466
3518
  break;
3467
- case "conflict":
3468
- conflicts.push({
3469
- key: entry.key,
3470
- label: label(entry),
3471
- kind: "conflict"
3472
- });
3473
- break;
3474
- default: break;
3519
+ case "conflict": conflicts.push({
3520
+ key: entry.key,
3521
+ label: label(entry),
3522
+ kind: "conflict"
3523
+ });
3475
3524
  }
3476
3525
  const isEmpty = localChanges.length === 0 && remoteDrift.length === 0 && conflicts.length === 0 && extras.length === 0;
3477
3526
  return {
@@ -3510,13 +3559,10 @@ function buildSingleThreeWayDiff(merge, key) {
3510
3559
  kind: "remoteOnly"
3511
3560
  });
3512
3561
  break;
3513
- case "conflict":
3514
- conflicts.push({
3515
- ...entry,
3516
- kind: "conflict"
3517
- });
3518
- break;
3519
- default: break;
3562
+ case "conflict": conflicts.push({
3563
+ ...entry,
3564
+ kind: "conflict"
3565
+ });
3520
3566
  }
3521
3567
  return {
3522
3568
  mode: "three-way",
@@ -4107,6 +4153,22 @@ function createPushCommand(config) {
4107
4153
  });
4108
4154
  }
4109
4155
  //#endregion
4156
+ //#region src/cli/commands/action/push.ts
4157
+ var push_default$14 = createPushCommand({
4158
+ description: "Push the local action config to kintone (with drift detection)",
4159
+ args: actionArgs,
4160
+ subject: "action config",
4161
+ spinnerStopMessage: "Actions pushed to preview.",
4162
+ createContainer: createActionCliContainer,
4163
+ pushFn: pushAction,
4164
+ toctouMessage: "The remote changed while applying. Run `action pull` and retry.",
4165
+ onResult: (result) => {
4166
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
4167
+ },
4168
+ resolveContainerConfig: resolveActionContainerConfig,
4169
+ resolveAppContainerConfig: resolveActionAppContainerConfig
4170
+ });
4171
+ //#endregion
4110
4172
  //#region src/cli/commands/action/index.ts
4111
4173
  var action_default = define({
4112
4174
  name: "action",
@@ -4116,20 +4178,7 @@ var action_default = define({
4116
4178
  capture: capture_default$14,
4117
4179
  diff: diff_default$13,
4118
4180
  pull: pull_default$13,
4119
- push: createPushCommand({
4120
- description: "Push the local action config to kintone (with drift detection)",
4121
- args: actionArgs,
4122
- subject: "action config",
4123
- spinnerStopMessage: "Actions pushed to preview.",
4124
- createContainer: createActionCliContainer,
4125
- pushFn: pushAction,
4126
- toctouMessage: "The remote changed while applying. Run `action pull` and retry.",
4127
- onResult: (result) => {
4128
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
4129
- },
4130
- resolveContainerConfig: resolveActionContainerConfig,
4131
- resolveAppContainerConfig: resolveActionAppContainerConfig
4132
- })
4181
+ push: push_default$14
4133
4182
  },
4134
4183
  run: () => {}
4135
4184
  });
@@ -4204,6 +4253,8 @@ async function detectAdminNotesDiff({ container }) {
4204
4253
  //#endregion
4205
4254
  //#region src/core/adapters/kintone/adminNotesConfigurator.ts
4206
4255
  var KintoneAdminNotesConfigurator = class {
4256
+ client;
4257
+ appId;
4207
4258
  constructor(client, appId) {
4208
4259
  this.client = client;
4209
4260
  this.appId = appId;
@@ -4648,6 +4699,22 @@ async function pushAdminNotes({ container, input }) {
4648
4699
  };
4649
4700
  }
4650
4701
  //#endregion
4702
+ //#region src/cli/commands/admin-notes/push.ts
4703
+ var push_default$13 = createPushCommand({
4704
+ description: "Push the local admin notes config to kintone (with drift detection)",
4705
+ args: adminNotesArgs,
4706
+ subject: "admin notes config",
4707
+ spinnerStopMessage: "Admin notes pushed to preview.",
4708
+ createContainer: createAdminNotesCliContainer,
4709
+ pushFn: pushAdminNotes,
4710
+ toctouMessage: "The remote changed while applying. Run `admin-notes pull` and retry.",
4711
+ onResult: (result) => {
4712
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
4713
+ },
4714
+ resolveContainerConfig: resolveAdminNotesContainerConfig,
4715
+ resolveAppContainerConfig: resolveAdminNotesAppContainerConfig
4716
+ });
4717
+ //#endregion
4651
4718
  //#region src/cli/commands/admin-notes/index.ts
4652
4719
  var admin_notes_default = define({
4653
4720
  name: "admin-notes",
@@ -4657,26 +4724,13 @@ var admin_notes_default = define({
4657
4724
  capture: capture_default$13,
4658
4725
  diff: diff_default$12,
4659
4726
  pull: pull_default$12,
4660
- push: createPushCommand({
4661
- description: "Push the local admin notes config to kintone (with drift detection)",
4662
- args: adminNotesArgs,
4663
- subject: "admin notes config",
4664
- spinnerStopMessage: "Admin notes pushed to preview.",
4665
- createContainer: createAdminNotesCliContainer,
4666
- pushFn: pushAdminNotes,
4667
- toctouMessage: "The remote changed while applying. Run `admin-notes pull` and retry.",
4668
- onResult: (result) => {
4669
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
4670
- },
4671
- resolveContainerConfig: resolveAdminNotesContainerConfig,
4672
- resolveAppContainerConfig: resolveAdminNotesAppContainerConfig
4673
- })
4727
+ push: push_default$13
4674
4728
  },
4675
4729
  run: () => {}
4676
4730
  });
4677
4731
  //#endregion
4678
4732
  //#region src/core/domain/appPermission/services/configParser.ts
4679
- const VALID_ENTITY_TYPES$8 = new Set([
4733
+ const VALID_ENTITY_TYPES$8 = /* @__PURE__ */ new Set([
4680
4734
  "USER",
4681
4735
  "GROUP",
4682
4736
  "ORGANIZATION",
@@ -4801,7 +4855,7 @@ async function detectAppPermissionDiff({ container }) {
4801
4855
  }
4802
4856
  //#endregion
4803
4857
  //#region src/core/adapters/kintone/appPermissionConfigurator.ts
4804
- const VALID_ENTITY_TYPES$7 = new Set([
4858
+ const VALID_ENTITY_TYPES$7 = /* @__PURE__ */ new Set([
4805
4859
  "USER",
4806
4860
  "GROUP",
4807
4861
  "ORGANIZATION",
@@ -4848,6 +4902,8 @@ function toKintoneRight$2(right) {
4848
4902
  };
4849
4903
  }
4850
4904
  var KintoneAppPermissionConfigurator = class {
4905
+ client;
4906
+ appId;
4851
4907
  constructor(client, appId) {
4852
4908
  this.client = client;
4853
4909
  this.appId = appId;
@@ -5299,6 +5355,22 @@ async function pushAppPermission({ container, input }) {
5299
5355
  };
5300
5356
  }
5301
5357
  //#endregion
5358
+ //#region src/cli/commands/app-acl/push.ts
5359
+ var push_default$12 = createPushCommand({
5360
+ description: "Push the local app permission config to kintone (with drift detection)",
5361
+ args: appAclArgs,
5362
+ subject: "app permission config",
5363
+ spinnerStopMessage: "App permissions pushed to preview.",
5364
+ createContainer: createAppPermissionCliContainer,
5365
+ pushFn: pushAppPermission,
5366
+ toctouMessage: "The remote changed while applying. Run `app-acl pull` and retry.",
5367
+ onResult: (result) => {
5368
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
5369
+ },
5370
+ resolveContainerConfig: resolveAppAclContainerConfig,
5371
+ resolveAppContainerConfig: resolveAppAclAppContainerConfig
5372
+ });
5373
+ //#endregion
5302
5374
  //#region src/cli/commands/app-acl/index.ts
5303
5375
  var app_acl_default = define({
5304
5376
  name: "app-acl",
@@ -5308,20 +5380,7 @@ var app_acl_default = define({
5308
5380
  capture: capture_default$12,
5309
5381
  diff: diff_default$11,
5310
5382
  pull: pull_default$11,
5311
- push: createPushCommand({
5312
- description: "Push the local app permission config to kintone (with drift detection)",
5313
- args: appAclArgs,
5314
- subject: "app permission config",
5315
- spinnerStopMessage: "App permissions pushed to preview.",
5316
- createContainer: createAppPermissionCliContainer,
5317
- pushFn: pushAppPermission,
5318
- toctouMessage: "The remote changed while applying. Run `app-acl pull` and retry.",
5319
- onResult: (result) => {
5320
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
5321
- },
5322
- resolveContainerConfig: resolveAppAclContainerConfig,
5323
- resolveAppContainerConfig: resolveAppAclAppContainerConfig
5324
- })
5383
+ push: push_default$12
5325
5384
  },
5326
5385
  run: () => {}
5327
5386
  });
@@ -5463,12 +5522,12 @@ async function applyCustomization({ container, input }) {
5463
5522
  }
5464
5523
  //#endregion
5465
5524
  //#region src/core/domain/fieldPermission/services/configParser.ts
5466
- const VALID_ACCESSIBILITIES$1 = new Set([
5525
+ const VALID_ACCESSIBILITIES$1 = /* @__PURE__ */ new Set([
5467
5526
  "READ",
5468
5527
  "WRITE",
5469
5528
  "NONE"
5470
5529
  ]);
5471
- const VALID_ENTITY_TYPES$6 = new Set([
5530
+ const VALID_ENTITY_TYPES$6 = /* @__PURE__ */ new Set([
5472
5531
  "USER",
5473
5532
  "GROUP",
5474
5533
  "ORGANIZATION",
@@ -5587,7 +5646,7 @@ function describePropertiesChanges(before, after) {
5587
5646
  }
5588
5647
  const bProps = before.properties;
5589
5648
  const aProps = after.properties;
5590
- const allKeys = new Set([...Object.keys(bProps), ...Object.keys(aProps)]);
5649
+ const allKeys = /* @__PURE__ */ new Set([...Object.keys(bProps), ...Object.keys(aProps)]);
5591
5650
  const propChanges = [];
5592
5651
  for (const key of allKeys) if (!deepEqual(bProps[key], aProps[key])) propChanges.push(`${key}: ${formatValue(bProps[key])} -> ${formatValue(aProps[key])}`);
5593
5652
  return propChanges;
@@ -5772,19 +5831,19 @@ async function applySchemaChanges(schema, { container, expectedRevision }) {
5772
5831
  }
5773
5832
  //#endregion
5774
5833
  //#region src/core/domain/formSchema/services/schemaValidator.ts
5775
- const SELECTION_TYPES = new Set([
5834
+ const SELECTION_TYPES = /* @__PURE__ */ new Set([
5776
5835
  "CHECK_BOX",
5777
5836
  "RADIO_BUTTON",
5778
5837
  "MULTI_SELECT",
5779
5838
  "DROP_DOWN"
5780
5839
  ]);
5781
- const VALID_THUMBNAIL_SIZES = new Set([
5840
+ const VALID_THUMBNAIL_SIZES = /* @__PURE__ */ new Set([
5782
5841
  "50",
5783
5842
  "150",
5784
5843
  "250",
5785
5844
  "500"
5786
5845
  ]);
5787
- const VALID_REFERENCE_TABLE_SIZES = new Set([
5846
+ const VALID_REFERENCE_TABLE_SIZES = /* @__PURE__ */ new Set([
5788
5847
  "1",
5789
5848
  "3",
5790
5849
  "5",
@@ -5794,7 +5853,7 @@ const VALID_REFERENCE_TABLE_SIZES = new Set([
5794
5853
  "40",
5795
5854
  "50"
5796
5855
  ]);
5797
- const LOOKUP_FIELD_TYPES = new Set([
5856
+ const LOOKUP_FIELD_TYPES = /* @__PURE__ */ new Set([
5798
5857
  "SINGLE_LINE_TEXT",
5799
5858
  "NUMBER",
5800
5859
  "LINK"
@@ -5928,8 +5987,8 @@ const Schema = { create: (fields, layout) => {
5928
5987
  } };
5929
5988
  //#endregion
5930
5989
  //#region src/core/domain/formSchema/services/schemaParser.ts
5931
- const VALID_UNIT_POSITIONS = new Set(["BEFORE", "AFTER"]);
5932
- const VALID_CALC_FORMATS = new Set([
5990
+ const VALID_UNIT_POSITIONS = /* @__PURE__ */ new Set(["BEFORE", "AFTER"]);
5991
+ const VALID_CALC_FORMATS = /* @__PURE__ */ new Set([
5933
5992
  "NUMBER",
5934
5993
  "NUMBER_DIGIT",
5935
5994
  "DATE",
@@ -5938,8 +5997,8 @@ const VALID_CALC_FORMATS = new Set([
5938
5997
  "HOUR_MINUTE",
5939
5998
  "DAY_HOUR_MINUTE"
5940
5999
  ]);
5941
- const VALID_SELECTION_ALIGNS = new Set(["HORIZONTAL", "VERTICAL"]);
5942
- const VALID_LINK_PROTOCOLS = new Set([
6000
+ const VALID_SELECTION_ALIGNS = /* @__PURE__ */ new Set(["HORIZONTAL", "VERTICAL"]);
6001
+ const VALID_LINK_PROTOCOLS = /* @__PURE__ */ new Set([
5943
6002
  "WEB",
5944
6003
  "CALL",
5945
6004
  "MAIL"
@@ -5962,12 +6021,10 @@ function validateFieldProperties(code, fieldType, properties) {
5962
6021
  case "DROP_DOWN":
5963
6022
  validateEnumProperty(code, "align", properties.align, VALID_SELECTION_ALIGNS);
5964
6023
  break;
5965
- case "LINK":
5966
- validateEnumProperty(code, "protocol", properties.protocol, VALID_LINK_PROTOCOLS);
5967
- break;
6024
+ case "LINK": validateEnumProperty(code, "protocol", properties.protocol, VALID_LINK_PROTOCOLS);
5968
6025
  }
5969
6026
  }
5970
- const VALID_FIELD_TYPES = new Set([
6027
+ const VALID_FIELD_TYPES = /* @__PURE__ */ new Set([
5971
6028
  "SINGLE_LINE_TEXT",
5972
6029
  "MULTI_LINE_TEXT",
5973
6030
  "RICH_TEXT",
@@ -5989,12 +6046,12 @@ const VALID_FIELD_TYPES = new Set([
5989
6046
  "SUBTABLE",
5990
6047
  "REFERENCE_TABLE"
5991
6048
  ]);
5992
- const DECORATION_TYPES = new Set([
6049
+ const DECORATION_TYPES = /* @__PURE__ */ new Set([
5993
6050
  "LABEL",
5994
6051
  "SPACER",
5995
6052
  "HR"
5996
6053
  ]);
5997
- const SYSTEM_FIELD_TYPES = new Set([
6054
+ const SYSTEM_FIELD_TYPES = /* @__PURE__ */ new Set([
5998
6055
  "RECORD_NUMBER",
5999
6056
  "CREATOR",
6000
6057
  "CREATED_TIME",
@@ -6004,16 +6061,16 @@ const SYSTEM_FIELD_TYPES = new Set([
6004
6061
  "STATUS",
6005
6062
  "STATUS_ASSIGNEE"
6006
6063
  ]);
6007
- const BASE_ATTRIBUTES = new Set([
6064
+ const BASE_ATTRIBUTES = /* @__PURE__ */ new Set([
6008
6065
  "code",
6009
6066
  "type",
6010
6067
  "label",
6011
6068
  "noLabel"
6012
6069
  ]);
6013
- const LAYOUT_ATTRIBUTES = new Set(["size"]);
6014
- const DECORATION_ATTRIBUTES = new Set(["elementId"]);
6015
- const GROUP_ATTRIBUTES = new Set(["openGroup", "layout"]);
6016
- const SUBTABLE_ATTRIBUTES = new Set(["fields"]);
6070
+ const LAYOUT_ATTRIBUTES = /* @__PURE__ */ new Set(["size"]);
6071
+ const DECORATION_ATTRIBUTES = /* @__PURE__ */ new Set(["elementId"]);
6072
+ const GROUP_ATTRIBUTES = /* @__PURE__ */ new Set(["openGroup", "layout"]);
6073
+ const SUBTABLE_ATTRIBUTES = /* @__PURE__ */ new Set(["fields"]);
6017
6074
  /**
6018
6075
  * Parses a raw size object into an ElementSize.
6019
6076
  * Returns undefined when no size properties are present, treating an empty
@@ -6030,7 +6087,7 @@ function parseSize(raw) {
6030
6087
  ...obj.innerHeight !== void 0 ? { innerHeight: String(obj.innerHeight) } : {}
6031
6088
  };
6032
6089
  }
6033
- const BOOLEAN_PROPERTIES = new Set([
6090
+ const BOOLEAN_PROPERTIES = /* @__PURE__ */ new Set([
6034
6091
  "required",
6035
6092
  "unique",
6036
6093
  "digit",
@@ -6419,7 +6476,7 @@ function parseOptionalBoolean(parsed, fieldName) {
6419
6476
  if (value === void 0 || value === null) return void 0;
6420
6477
  return parseStrictBoolean(value, fieldName, "Config", GeneralSettingsErrorCode.GsInvalidBooleanField);
6421
6478
  }
6422
- const VALID_THEMES$1 = new Set([
6479
+ const VALID_THEMES$1 = /* @__PURE__ */ new Set([
6423
6480
  "WHITE",
6424
6481
  "RED",
6425
6482
  "GREEN",
@@ -6431,9 +6488,9 @@ const VALID_THEMES$1 = new Set([
6431
6488
  "PENCIL",
6432
6489
  "CLIPS"
6433
6490
  ]);
6434
- const VALID_ICON_TYPES$1 = new Set(["PRESET", "FILE"]);
6435
- const VALID_SELECTION_MODES$1 = new Set(["AUTO", "MANUAL"]);
6436
- const VALID_ROUNDING_MODES$1 = new Set([
6491
+ const VALID_ICON_TYPES$1 = /* @__PURE__ */ new Set(["PRESET", "FILE"]);
6492
+ const VALID_SELECTION_MODES$1 = /* @__PURE__ */ new Set(["AUTO", "MANUAL"]);
6493
+ const VALID_ROUNDING_MODES$1 = /* @__PURE__ */ new Set([
6437
6494
  "HALF_EVEN",
6438
6495
  "UP",
6439
6496
  "DOWN"
@@ -6534,7 +6591,7 @@ async function applyGeneralSettings({ container }) {
6534
6591
  notFoundMessage: "General settings config file not found"
6535
6592
  });
6536
6593
  }
6537
- const VALID_ENTITY_TYPES$5 = new Set([
6594
+ const VALID_ENTITY_TYPES$5 = /* @__PURE__ */ new Set([
6538
6595
  "USER",
6539
6596
  "GROUP",
6540
6597
  "ORGANIZATION",
@@ -6755,12 +6812,12 @@ async function applyPlugin({ container }) {
6755
6812
  }
6756
6813
  //#endregion
6757
6814
  //#region src/core/domain/processManagement/services/configParser.ts
6758
- const VALID_ASSIGNEE_TYPES$1 = new Set([
6815
+ const VALID_ASSIGNEE_TYPES$1 = /* @__PURE__ */ new Set([
6759
6816
  "ONE",
6760
6817
  "ALL",
6761
6818
  "ANY"
6762
6819
  ]);
6763
- const VALID_ENTITY_TYPES$4 = new Set([
6820
+ const VALID_ENTITY_TYPES$4 = /* @__PURE__ */ new Set([
6764
6821
  "USER",
6765
6822
  "GROUP",
6766
6823
  "ORGANIZATION",
@@ -6768,7 +6825,7 @@ const VALID_ENTITY_TYPES$4 = new Set([
6768
6825
  "CREATOR",
6769
6826
  "CUSTOM_FIELD"
6770
6827
  ]);
6771
- const VALID_ACTION_TYPES$1 = new Set(["PRIMARY", "SECONDARY"]);
6828
+ const VALID_ACTION_TYPES$1 = /* @__PURE__ */ new Set(["PRIMARY", "SECONDARY"]);
6772
6829
  function parseProcessEntity(raw, index) {
6773
6830
  if (!isRecord(raw)) throw new BusinessRuleError(ProcessManagementErrorCode.PmInvalidConfigStructure, `Entity at index ${index} must be an object`);
6774
6831
  const result = { type: parseEnum(raw.type, VALID_ENTITY_TYPES$4, ProcessManagementErrorCode.PmInvalidEntityType, `Entity at index ${index} has invalid type: ${String(raw.type)}. Must be USER, GROUP, ORGANIZATION, FIELD_ENTITY, CREATOR, or CUSTOM_FIELD`) };
@@ -6874,7 +6931,7 @@ async function applyProcessManagement({ container }) {
6874
6931
  }
6875
6932
  //#endregion
6876
6933
  //#region src/core/domain/recordPermission/services/configParser.ts
6877
- const VALID_ENTITY_TYPES$3 = new Set([
6934
+ const VALID_ENTITY_TYPES$3 = /* @__PURE__ */ new Set([
6878
6935
  "USER",
6879
6936
  "GROUP",
6880
6937
  "ORGANIZATION",
@@ -6944,7 +7001,7 @@ async function applyRecordPermission({ container }) {
6944
7001
  notFoundMessage: "Record permission config file not found"
6945
7002
  });
6946
7003
  }
6947
- const VALID_CHART_TYPES = new Set([
7004
+ const VALID_CHART_TYPES = /* @__PURE__ */ new Set([
6948
7005
  "BAR",
6949
7006
  "COLUMN",
6950
7007
  "PIE",
@@ -6958,7 +7015,7 @@ const VALID_CHART_TYPES = new Set([
6958
7015
  function isChartType(value) {
6959
7016
  return VALID_CHART_TYPES.has(value);
6960
7017
  }
6961
- const VALID_CHART_MODES = new Set([
7018
+ const VALID_CHART_MODES = /* @__PURE__ */ new Set([
6962
7019
  "NORMAL",
6963
7020
  "STACKED",
6964
7021
  "PERCENTAGE"
@@ -6966,7 +7023,7 @@ const VALID_CHART_MODES = new Set([
6966
7023
  function isChartMode(value) {
6967
7024
  return VALID_CHART_MODES.has(value);
6968
7025
  }
6969
- const VALID_GROUP_PERS = new Set([
7026
+ const VALID_GROUP_PERS = /* @__PURE__ */ new Set([
6970
7027
  "YEAR",
6971
7028
  "QUARTER",
6972
7029
  "MONTH",
@@ -6978,7 +7035,7 @@ const VALID_GROUP_PERS = new Set([
6978
7035
  function isGroupPer(value) {
6979
7036
  return VALID_GROUP_PERS.has(value);
6980
7037
  }
6981
- const VALID_AGGREGATION_TYPES = new Set([
7038
+ const VALID_AGGREGATION_TYPES = /* @__PURE__ */ new Set([
6982
7039
  "COUNT",
6983
7040
  "SUM",
6984
7041
  "AVERAGE",
@@ -6988,7 +7045,7 @@ const VALID_AGGREGATION_TYPES = new Set([
6988
7045
  function isAggregationType(value) {
6989
7046
  return VALID_AGGREGATION_TYPES.has(value);
6990
7047
  }
6991
- const VALID_SORT_BYS = new Set([
7048
+ const VALID_SORT_BYS = /* @__PURE__ */ new Set([
6992
7049
  "TOTAL",
6993
7050
  "GROUP1",
6994
7051
  "GROUP2",
@@ -6997,11 +7054,11 @@ const VALID_SORT_BYS = new Set([
6997
7054
  function isSortBy(value) {
6998
7055
  return VALID_SORT_BYS.has(value);
6999
7056
  }
7000
- const VALID_SORT_ORDERS = new Set(["ASC", "DESC"]);
7057
+ const VALID_SORT_ORDERS = /* @__PURE__ */ new Set(["ASC", "DESC"]);
7001
7058
  function isSortOrder(value) {
7002
7059
  return VALID_SORT_ORDERS.has(value);
7003
7060
  }
7004
- const VALID_PERIODIC_REPORT_EVERYS = new Set([
7061
+ const VALID_PERIODIC_REPORT_EVERYS = /* @__PURE__ */ new Set([
7005
7062
  "YEAR",
7006
7063
  "QUARTER",
7007
7064
  "MONTH",
@@ -7012,7 +7069,7 @@ const VALID_PERIODIC_REPORT_EVERYS = new Set([
7012
7069
  function isPeriodicReportEvery(value) {
7013
7070
  return VALID_PERIODIC_REPORT_EVERYS.has(value);
7014
7071
  }
7015
- const VALID_PERIODIC_REPORT_PATTERNS = new Set([
7072
+ const VALID_PERIODIC_REPORT_PATTERNS = /* @__PURE__ */ new Set([
7016
7073
  "JAN_APR_JUL_OCT",
7017
7074
  "FEB_MAY_AUG_NOV",
7018
7075
  "MAR_JUN_SEP_DEC"
@@ -7020,7 +7077,7 @@ const VALID_PERIODIC_REPORT_PATTERNS = new Set([
7020
7077
  function isPeriodicReportPattern(value) {
7021
7078
  return VALID_PERIODIC_REPORT_PATTERNS.has(value);
7022
7079
  }
7023
- const VALID_DAYS_OF_WEEK = new Set([
7080
+ const VALID_DAYS_OF_WEEK = /* @__PURE__ */ new Set([
7024
7081
  "SUNDAY",
7025
7082
  "MONDAY",
7026
7083
  "TUESDAY",
@@ -7341,7 +7398,7 @@ async function upsertSeed({ container, input }) {
7341
7398
  total: plan.toAdd.length + plan.toUpdate.length + plan.unchanged
7342
7399
  };
7343
7400
  }
7344
- const VALID_VIEW_TYPES = new Set([
7401
+ const VALID_VIEW_TYPES = /* @__PURE__ */ new Set([
7345
7402
  "LIST",
7346
7403
  "CALENDAR",
7347
7404
  "CUSTOM"
@@ -7349,7 +7406,7 @@ const VALID_VIEW_TYPES = new Set([
7349
7406
  function isViewType(value) {
7350
7407
  return VALID_VIEW_TYPES.has(value);
7351
7408
  }
7352
- const VALID_DEVICE_TYPES = new Set(["DESKTOP", "ANY"]);
7409
+ const VALID_DEVICE_TYPES = /* @__PURE__ */ new Set(["DESKTOP", "ANY"]);
7353
7410
  function isDeviceType(value) {
7354
7411
  return VALID_DEVICE_TYPES.has(value);
7355
7412
  }
@@ -7734,12 +7791,12 @@ async function applyAllForApp(args) {
7734
7791
  }
7735
7792
  //#endregion
7736
7793
  //#region src/core/adapters/kintone/fieldPermissionConfigurator.ts
7737
- const VALID_ACCESSIBILITIES = new Set([
7794
+ const VALID_ACCESSIBILITIES = /* @__PURE__ */ new Set([
7738
7795
  "READ",
7739
7796
  "WRITE",
7740
7797
  "NONE"
7741
7798
  ]);
7742
- const VALID_ENTITY_TYPES$2 = new Set([
7799
+ const VALID_ENTITY_TYPES$2 = /* @__PURE__ */ new Set([
7743
7800
  "USER",
7744
7801
  "GROUP",
7745
7802
  "ORGANIZATION",
@@ -7785,6 +7842,8 @@ function toKintoneRight$1(right) {
7785
7842
  };
7786
7843
  }
7787
7844
  var KintoneFieldPermissionConfigurator = class {
7845
+ client;
7846
+ appId;
7788
7847
  constructor(client, appId) {
7789
7848
  this.client = client;
7790
7849
  this.appId = appId;
@@ -7849,7 +7908,7 @@ function parseKintoneIntegerField(raw, fieldName) {
7849
7908
  }
7850
7909
  //#endregion
7851
7910
  //#region src/core/adapters/kintone/generalSettingsConfigurator.ts
7852
- const VALID_THEMES = new Set([
7911
+ const VALID_THEMES = /* @__PURE__ */ new Set([
7853
7912
  "WHITE",
7854
7913
  "RED",
7855
7914
  "GREEN",
@@ -7861,9 +7920,9 @@ const VALID_THEMES = new Set([
7861
7920
  "PENCIL",
7862
7921
  "CLIPS"
7863
7922
  ]);
7864
- const VALID_ICON_TYPES = new Set(["PRESET", "FILE"]);
7865
- const VALID_SELECTION_MODES = new Set(["AUTO", "MANUAL"]);
7866
- const VALID_ROUNDING_MODES = new Set([
7923
+ const VALID_ICON_TYPES = /* @__PURE__ */ new Set(["PRESET", "FILE"]);
7924
+ const VALID_SELECTION_MODES = /* @__PURE__ */ new Set(["AUTO", "MANUAL"]);
7925
+ const VALID_ROUNDING_MODES = /* @__PURE__ */ new Set([
7867
7926
  "HALF_EVEN",
7868
7927
  "UP",
7869
7928
  "DOWN"
@@ -7929,11 +7988,13 @@ function toKintoneSettings(config) {
7929
7988
  if (config.description !== void 0) result.description = config.description;
7930
7989
  if (config.icon !== void 0) result.icon = toKintoneIcon(config.icon);
7931
7990
  if (config.theme !== void 0) result.theme = config.theme;
7932
- if (config.titleField !== void 0) if (config.titleField.selectionMode === "MANUAL") result.titleField = {
7933
- selectionMode: "MANUAL",
7934
- code: config.titleField.code
7935
- };
7936
- else result.titleField = { selectionMode: "AUTO" };
7991
+ if (config.titleField !== void 0) {
7992
+ if (config.titleField.selectionMode === "MANUAL") result.titleField = {
7993
+ selectionMode: "MANUAL",
7994
+ code: config.titleField.code
7995
+ };
7996
+ else result.titleField = { selectionMode: "AUTO" };
7997
+ }
7937
7998
  if (config.enableThumbnails !== void 0) result.enableThumbnails = config.enableThumbnails;
7938
7999
  if (config.enableBulkDeletion !== void 0) result.enableBulkDeletion = config.enableBulkDeletion;
7939
8000
  if (config.enableComments !== void 0) result.enableComments = config.enableComments;
@@ -7948,6 +8009,8 @@ function toKintoneSettings(config) {
7948
8009
  return result;
7949
8010
  }
7950
8011
  var KintoneGeneralSettingsConfigurator = class {
8012
+ client;
8013
+ appId;
7951
8014
  constructor(client, appId) {
7952
8015
  this.client = client;
7953
8016
  this.appId = appId;
@@ -8110,6 +8173,8 @@ function toKintoneReminderNotification(notification) {
8110
8173
  };
8111
8174
  }
8112
8175
  var KintoneNotificationConfigurator = class {
8176
+ client;
8177
+ appId;
8113
8178
  constructor(client, appId) {
8114
8179
  this.client = client;
8115
8180
  this.appId = appId;
@@ -8226,6 +8291,8 @@ function createNotificationCliContainer(config) {
8226
8291
  //#endregion
8227
8292
  //#region src/core/adapters/kintone/pluginConfigurator.ts
8228
8293
  var KintonePluginConfigurator = class {
8294
+ client;
8295
+ appId;
8229
8296
  constructor(client, appId) {
8230
8297
  this.client = client;
8231
8298
  this.appId = appId;
@@ -8286,12 +8353,12 @@ function createPluginCliContainer(config) {
8286
8353
  }
8287
8354
  //#endregion
8288
8355
  //#region src/core/adapters/kintone/processManagementConfigurator.ts
8289
- const VALID_ASSIGNEE_TYPES = new Set([
8356
+ const VALID_ASSIGNEE_TYPES = /* @__PURE__ */ new Set([
8290
8357
  "ONE",
8291
8358
  "ALL",
8292
8359
  "ANY"
8293
8360
  ]);
8294
- const VALID_ENTITY_TYPES$1 = new Set([
8361
+ const VALID_ENTITY_TYPES$1 = /* @__PURE__ */ new Set([
8295
8362
  "USER",
8296
8363
  "GROUP",
8297
8364
  "ORGANIZATION",
@@ -8299,7 +8366,7 @@ const VALID_ENTITY_TYPES$1 = new Set([
8299
8366
  "CREATOR",
8300
8367
  "CUSTOM_FIELD"
8301
8368
  ]);
8302
- const VALID_ACTION_TYPES = new Set(["PRIMARY", "SECONDARY"]);
8369
+ const VALID_ACTION_TYPES = /* @__PURE__ */ new Set(["PRIMARY", "SECONDARY"]);
8303
8370
  function fromKintoneEntity$1(raw) {
8304
8371
  if (!VALID_ENTITY_TYPES$1.has(raw.entity.type)) throw new SystemError(SystemErrorCode.ExternalApiError, `Unexpected entity type from kintone API: ${raw.entity.type}`);
8305
8372
  const result = { type: raw.entity.type };
@@ -8372,6 +8439,8 @@ function toKintoneAction(action) {
8372
8439
  return result;
8373
8440
  }
8374
8441
  var KintoneProcessManagementConfigurator = class {
8442
+ client;
8443
+ appId;
8375
8444
  constructor(client, appId) {
8376
8445
  this.client = client;
8377
8446
  this.appId = appId;
@@ -8441,7 +8510,7 @@ function createProcessManagementCliContainer(config) {
8441
8510
  }
8442
8511
  //#endregion
8443
8512
  //#region src/core/adapters/kintone/recordPermissionConfigurator.ts
8444
- const VALID_ENTITY_TYPES = new Set([
8513
+ const VALID_ENTITY_TYPES = /* @__PURE__ */ new Set([
8445
8514
  "USER",
8446
8515
  "GROUP",
8447
8516
  "ORGANIZATION",
@@ -8485,6 +8554,8 @@ function toKintoneRight(right) {
8485
8554
  };
8486
8555
  }
8487
8556
  var KintoneRecordPermissionConfigurator = class {
8557
+ client;
8558
+ appId;
8488
8559
  constructor(client, appId) {
8489
8560
  this.client = client;
8490
8561
  this.appId = appId;
@@ -8574,11 +8645,13 @@ function fromKintonePeriodicReportPeriod(raw) {
8574
8645
  if (!isPeriodicReportEvery(raw.every)) throw new SystemError(SystemErrorCode.ExternalApiError, `Unexpected periodicReport every value from kintone API: ${raw.every}`);
8575
8646
  if (raw.pattern !== void 0 && !isPeriodicReportPattern(raw.pattern)) throw new SystemError(SystemErrorCode.ExternalApiError, `Unexpected periodicReport pattern value from kintone API: ${raw.pattern}`);
8576
8647
  let dayOfMonth;
8577
- if (raw.dayOfMonth !== void 0) if (String(raw.dayOfMonth) === "END_OF_MONTH") dayOfMonth = "END_OF_MONTH";
8578
- else {
8579
- const parsed = Number(raw.dayOfMonth);
8580
- if (!Number.isFinite(parsed) || !Number.isInteger(parsed)) throw new SystemError(SystemErrorCode.ExternalApiError, `Unexpected periodicReport dayOfMonth value from kintone API: ${String(raw.dayOfMonth)}`);
8581
- dayOfMonth = parsed;
8648
+ if (raw.dayOfMonth !== void 0) {
8649
+ if (String(raw.dayOfMonth) === "END_OF_MONTH") dayOfMonth = "END_OF_MONTH";
8650
+ else {
8651
+ const parsed = Number(raw.dayOfMonth);
8652
+ if (!Number.isFinite(parsed) || !Number.isInteger(parsed)) throw new SystemError(SystemErrorCode.ExternalApiError, `Unexpected periodicReport dayOfMonth value from kintone API: ${String(raw.dayOfMonth)}`);
8653
+ dayOfMonth = parsed;
8654
+ }
8582
8655
  }
8583
8656
  return {
8584
8657
  every: raw.every,
@@ -8673,6 +8746,8 @@ function toKintoneReportConfig(config) {
8673
8746
  return result;
8674
8747
  }
8675
8748
  var KintoneReportConfigurator = class {
8749
+ client;
8750
+ appId;
8676
8751
  constructor(client, appId) {
8677
8752
  this.client = client;
8678
8753
  this.appId = appId;
@@ -8775,6 +8850,8 @@ function toKintoneView(config) {
8775
8850
  return result;
8776
8851
  }
8777
8852
  var KintoneViewConfigurator = class {
8853
+ client;
8854
+ appId;
8778
8855
  constructor(client, appId) {
8779
8856
  this.client = client;
8780
8857
  this.appId = appId;
@@ -9172,11 +9249,12 @@ function toFieldDto(field) {
9172
9249
  properties: fieldPropertiesToDto(field)
9173
9250
  };
9174
9251
  }
9175
- async function detectDiff({ container }) {
9252
+ async function detectDiff({ container, input }) {
9253
+ const target = input?.target ?? "preview";
9176
9254
  const result = await container.schemaStorage.get();
9177
9255
  if (!result.exists) throw new ValidationError(ValidationErrorCode.InvalidInput, "Schema file not found");
9178
9256
  const schema = parseSchemaText(container.configCodec, result.content);
9179
- const [currentFields, currentLayout] = await Promise.all([container.formConfigurator.getFields(), container.formConfigurator.getLayout()]);
9257
+ const [currentFields, currentLayout] = await Promise.all([container.formConfigurator.getFields(target), container.formConfigurator.getLayout(target)]);
9180
9258
  const diff = DiffDetector.detect(schema, currentFields);
9181
9259
  const enrichedCurrentLayout = enrichLayoutWithFields(currentLayout, currentFields);
9182
9260
  const hasLayoutChanges = DiffDetector.detectLayoutChanges(schema.layout, enrichedCurrentLayout);
@@ -10094,10 +10172,7 @@ function printSuccessResult(result) {
10094
10172
  case "admin-notes":
10095
10173
  printAdminNotesDiffResult(result.result);
10096
10174
  break;
10097
- case "plugin":
10098
- printPluginDiffResult(result.result);
10099
- break;
10100
- default:
10175
+ case "plugin": printPluginDiffResult(result.result);
10101
10176
  }
10102
10177
  }
10103
10178
  function isResultEmpty(result) {
@@ -11983,7 +12058,7 @@ function difference(keys, digests) {
11983
12058
  return new Set([...keys].filter((key) => !digests.has(key)));
11984
12059
  }
11985
12060
  function union(a, b) {
11986
- return new Set([...a, ...b]);
12061
+ return /* @__PURE__ */ new Set([...a, ...b]);
11987
12062
  }
11988
12063
  function intersect(a, b) {
11989
12064
  const result = /* @__PURE__ */ new Set();
@@ -12720,6 +12795,40 @@ async function runPush(containerConfig, force, skipConfirm) {
12720
12795
  p.log.success("Push completed successfully.");
12721
12796
  await confirmAndDeploy([container], skipConfirm);
12722
12797
  }
12798
+ var push_default$11 = define({
12799
+ name: "push",
12800
+ description: "Push the local customization config to kintone (with drift detection)",
12801
+ args: {
12802
+ ...customizeArgs,
12803
+ ...confirmArgs,
12804
+ force: {
12805
+ type: "boolean",
12806
+ description: "Skip drift detection and overwrite remote"
12807
+ }
12808
+ },
12809
+ run: async (ctx) => {
12810
+ try {
12811
+ const values = ctx.values;
12812
+ const force = ctx.values.force === true;
12813
+ const skipConfirm = values.yes === true;
12814
+ const notSupportedAll = new ValidationError(ValidationErrorCode.InvalidInput, "customize push does not support --all yet. Use --app <name> or a single app.");
12815
+ if (values.all === true) throw notSupportedAll;
12816
+ await routeMultiApp(values, {
12817
+ singleLegacy: async () => {
12818
+ await runPush(resolveCustomizeConfig(values), force, skipConfirm);
12819
+ },
12820
+ singleApp: async (app, projectConfig) => {
12821
+ await runPush(resolveCustomizeAppConfig(app, projectConfig, values), force, skipConfirm);
12822
+ },
12823
+ multiApp: async () => {
12824
+ throw notSupportedAll;
12825
+ }
12826
+ });
12827
+ } catch (error) {
12828
+ handleCliError(error);
12829
+ }
12830
+ }
12831
+ });
12723
12832
  //#endregion
12724
12833
  //#region src/cli/commands/customize/index.ts
12725
12834
  var customize_default = define({
@@ -12730,40 +12839,7 @@ var customize_default = define({
12730
12839
  capture: capture_default$10,
12731
12840
  diff: diff_default$10,
12732
12841
  pull: pull_default$10,
12733
- push: define({
12734
- name: "push",
12735
- description: "Push the local customization config to kintone (with drift detection)",
12736
- args: {
12737
- ...customizeArgs,
12738
- ...confirmArgs,
12739
- force: {
12740
- type: "boolean",
12741
- description: "Skip drift detection and overwrite remote"
12742
- }
12743
- },
12744
- run: async (ctx) => {
12745
- try {
12746
- const values = ctx.values;
12747
- const force = ctx.values.force === true;
12748
- const skipConfirm = values.yes === true;
12749
- const notSupportedAll = new ValidationError(ValidationErrorCode.InvalidInput, "customize push does not support --all yet. Use --app <name> or a single app.");
12750
- if (values.all === true) throw notSupportedAll;
12751
- await routeMultiApp(values, {
12752
- singleLegacy: async () => {
12753
- await runPush(resolveCustomizeConfig(values), force, skipConfirm);
12754
- },
12755
- singleApp: async (app, projectConfig) => {
12756
- await runPush(resolveCustomizeAppConfig(app, projectConfig, values), force, skipConfirm);
12757
- },
12758
- multiApp: async () => {
12759
- throw notSupportedAll;
12760
- }
12761
- });
12762
- } catch (error) {
12763
- handleCliError(error);
12764
- }
12765
- }
12766
- })
12842
+ push: push_default$11
12767
12843
  },
12768
12844
  run: () => {}
12769
12845
  });
@@ -13279,6 +13355,22 @@ async function pushFieldPermission({ container, input }) {
13279
13355
  };
13280
13356
  }
13281
13357
  //#endregion
13358
+ //#region src/cli/commands/field-acl/push.ts
13359
+ var push_default$10 = createPushCommand({
13360
+ description: "Push the local field permission config to kintone (with drift detection)",
13361
+ args: fieldAclArgs,
13362
+ subject: "field permission config",
13363
+ spinnerStopMessage: "Field permissions pushed to preview.",
13364
+ createContainer: createFieldPermissionCliContainer,
13365
+ pushFn: pushFieldPermission,
13366
+ toctouMessage: "The remote changed while applying. Run `field-acl pull` and retry.",
13367
+ onResult: (result) => {
13368
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
13369
+ },
13370
+ resolveContainerConfig: resolveFieldAclContainerConfig,
13371
+ resolveAppContainerConfig: resolveFieldAclAppContainerConfig
13372
+ });
13373
+ //#endregion
13282
13374
  //#region src/cli/commands/field-acl/index.ts
13283
13375
  var field_acl_default = define({
13284
13376
  name: "field-acl",
@@ -13288,20 +13380,7 @@ var field_acl_default = define({
13288
13380
  capture: capture_default$9,
13289
13381
  diff: diff_default$8,
13290
13382
  pull: pull_default$9,
13291
- push: createPushCommand({
13292
- description: "Push the local field permission config to kintone (with drift detection)",
13293
- args: fieldAclArgs,
13294
- subject: "field permission config",
13295
- spinnerStopMessage: "Field permissions pushed to preview.",
13296
- createContainer: createFieldPermissionCliContainer,
13297
- pushFn: pushFieldPermission,
13298
- toctouMessage: "The remote changed while applying. Run `field-acl pull` and retry.",
13299
- onResult: (result) => {
13300
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
13301
- },
13302
- resolveContainerConfig: resolveFieldAclContainerConfig,
13303
- resolveAppContainerConfig: resolveFieldAclAppContainerConfig
13304
- })
13383
+ push: push_default$10
13305
13384
  },
13306
13385
  run: () => {}
13307
13386
  });
@@ -13310,6 +13389,7 @@ var field_acl_default = define({
13310
13389
  const PAGE_LIMIT = 100;
13311
13390
  const MAX_PAGES = 1e3;
13312
13391
  var KintoneAppLister = class {
13392
+ client;
13313
13393
  constructor(client) {
13314
13394
  this.client = client;
13315
13395
  }
@@ -13356,6 +13436,7 @@ var KintoneAppLister = class {
13356
13436
  * @see https://kintone.dev/en/docs/kintone/rest-api/spaces/get-space/
13357
13437
  */
13358
13438
  var KintoneSpaceReader = class {
13439
+ client;
13359
13440
  constructor(client) {
13360
13441
  this.client = client;
13361
13442
  }
@@ -13930,13 +14011,10 @@ function pushScalar(scalar, key, label, localChanges, remoteDrift, conflicts, ex
13930
14011
  kind: "conflict"
13931
14012
  });
13932
14013
  break;
13933
- case "bothSame":
13934
- extras.push({
13935
- key,
13936
- kind: "change"
13937
- });
13938
- break;
13939
- default: break;
14014
+ case "bothSame": extras.push({
14015
+ key,
14016
+ kind: "change"
14017
+ });
13940
14018
  }
13941
14019
  }
13942
14020
  function buildThreeWay(merge) {
@@ -13962,13 +14040,10 @@ function buildThreeWay(merge) {
13962
14040
  kind: "remoteOnly"
13963
14041
  });
13964
14042
  break;
13965
- case "conflict":
13966
- conflicts.push({
13967
- ...base,
13968
- kind: "conflict"
13969
- });
13970
- break;
13971
- default: break;
14043
+ case "conflict": conflicts.push({
14044
+ ...base,
14045
+ kind: "conflict"
14046
+ });
13972
14047
  }
13973
14048
  }
13974
14049
  pushScalar(merge.generalScalar, "general:notifyToCommenter", "notifyToCommenter", localChanges, remoteDrift, conflicts, extras);
@@ -14234,6 +14309,22 @@ async function pushNotification({ container, input }) {
14234
14309
  };
14235
14310
  }
14236
14311
  //#endregion
14312
+ //#region src/cli/commands/notification/push.ts
14313
+ var push_default$9 = createPushCommand({
14314
+ description: "Push the local notification config to kintone (with drift detection)",
14315
+ args: notificationArgs,
14316
+ subject: "notification config",
14317
+ spinnerStopMessage: "Notifications pushed to preview.",
14318
+ createContainer: createNotificationCliContainer,
14319
+ pushFn: pushNotification,
14320
+ toctouMessage: "The remote changed while applying. Run `notification pull` and retry.",
14321
+ onResult: (result) => {
14322
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
14323
+ },
14324
+ resolveContainerConfig: resolveNotificationContainerConfig,
14325
+ resolveAppContainerConfig: resolveNotificationAppContainerConfig
14326
+ });
14327
+ //#endregion
14237
14328
  //#region src/cli/commands/notification/index.ts
14238
14329
  var notification_default = define({
14239
14330
  name: "notification",
@@ -14243,20 +14334,7 @@ var notification_default = define({
14243
14334
  capture: capture_default$8,
14244
14335
  diff: diff_default$7,
14245
14336
  pull: pull_default$8,
14246
- push: createPushCommand({
14247
- description: "Push the local notification config to kintone (with drift detection)",
14248
- args: notificationArgs,
14249
- subject: "notification config",
14250
- spinnerStopMessage: "Notifications pushed to preview.",
14251
- createContainer: createNotificationCliContainer,
14252
- pushFn: pushNotification,
14253
- toctouMessage: "The remote changed while applying. Run `notification pull` and retry.",
14254
- onResult: (result) => {
14255
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
14256
- },
14257
- resolveContainerConfig: resolveNotificationContainerConfig,
14258
- resolveAppContainerConfig: resolveNotificationAppContainerConfig
14259
- })
14337
+ push: push_default$9
14260
14338
  },
14261
14339
  run: () => {}
14262
14340
  });
@@ -14595,12 +14673,13 @@ function partitionPushOps(local, remoteById, localById, remotePlugins) {
14595
14673
  const skipped = [];
14596
14674
  for (const localPlugin of local.plugins) {
14597
14675
  const remotePlugin = remoteById.get(localPlugin.id);
14598
- if (remotePlugin === void 0) if (localPlugin.enabled) idsToAdd.push(localPlugin.id);
14599
- else skipped.push({
14600
- pluginId: localPlugin.id,
14601
- reason: "add-disabled"
14602
- });
14603
- else if (remotePlugin.name !== localPlugin.name || remotePlugin.enabled !== localPlugin.enabled) skipped.push({
14676
+ if (remotePlugin === void 0) {
14677
+ if (localPlugin.enabled) idsToAdd.push(localPlugin.id);
14678
+ else skipped.push({
14679
+ pluginId: localPlugin.id,
14680
+ reason: "add-disabled"
14681
+ });
14682
+ } else if (remotePlugin.name !== localPlugin.name || remotePlugin.enabled !== localPlugin.enabled) skipped.push({
14604
14683
  pluginId: localPlugin.id,
14605
14684
  reason: "modify"
14606
14685
  });
@@ -14670,6 +14749,29 @@ async function pushPlugin({ container, input }) {
14670
14749
  };
14671
14750
  }
14672
14751
  //#endregion
14752
+ //#region src/cli/commands/plugin/push.ts
14753
+ var push_default$8 = createPushCommand({
14754
+ description: "Push the local plugin config to kintone (add-only, with drift detection)",
14755
+ args: pluginArgs,
14756
+ subject: "plugin config",
14757
+ spinnerStopMessage: "Plugins pushed to preview.",
14758
+ createContainer: createPluginCliContainer,
14759
+ pushFn: pushPlugin,
14760
+ toctouMessage: "The remote changed while applying. Run `plugin pull` and retry.",
14761
+ onResult: (result) => {
14762
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
14763
+ if (result.addedPluginIds.length > 0) p.log.info(`Added plugins: ${result.addedPluginIds.join(", ")}`);
14764
+ const deletions = result.skipped.filter((o) => o.reason === "delete").map((o) => o.pluginId);
14765
+ const modifications = result.skipped.filter((o) => o.reason === "modify").map((o) => o.pluginId);
14766
+ const addDisabled = result.skipped.filter((o) => o.reason === "add-disabled").map((o) => o.pluginId);
14767
+ if (deletions.length > 0) p.log.warn(`Cannot remove plugins via the kintone API (add-only); left on the app: ${deletions.join(", ")}`);
14768
+ if (modifications.length > 0) p.log.warn(`Cannot modify existing plugins (name/enabled) via the kintone API (add-only); unchanged: ${modifications.join(", ")}`);
14769
+ if (addDisabled.length > 0) p.log.warn(`Cannot add plugins in a disabled state via the kintone API (add-only; adding would force-enable them); not added — set enabled: false manually in the kintone admin UI: ${addDisabled.join(", ")}`);
14770
+ },
14771
+ resolveContainerConfig: resolvePluginContainerConfig,
14772
+ resolveAppContainerConfig: resolvePluginAppContainerConfig
14773
+ });
14774
+ //#endregion
14673
14775
  //#region src/cli/commands/plugin/index.ts
14674
14776
  var plugin_default = define({
14675
14777
  name: "plugin",
@@ -14679,27 +14781,7 @@ var plugin_default = define({
14679
14781
  capture: capture_default$7,
14680
14782
  diff: diff_default$6,
14681
14783
  pull: pull_default$7,
14682
- push: createPushCommand({
14683
- description: "Push the local plugin config to kintone (add-only, with drift detection)",
14684
- args: pluginArgs,
14685
- subject: "plugin config",
14686
- spinnerStopMessage: "Plugins pushed to preview.",
14687
- createContainer: createPluginCliContainer,
14688
- pushFn: pushPlugin,
14689
- toctouMessage: "The remote changed while applying. Run `plugin pull` and retry.",
14690
- onResult: (result) => {
14691
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
14692
- if (result.addedPluginIds.length > 0) p.log.info(`Added plugins: ${result.addedPluginIds.join(", ")}`);
14693
- const deletions = result.skipped.filter((o) => o.reason === "delete").map((o) => o.pluginId);
14694
- const modifications = result.skipped.filter((o) => o.reason === "modify").map((o) => o.pluginId);
14695
- const addDisabled = result.skipped.filter((o) => o.reason === "add-disabled").map((o) => o.pluginId);
14696
- if (deletions.length > 0) p.log.warn(`Cannot remove plugins via the kintone API (add-only); left on the app: ${deletions.join(", ")}`);
14697
- if (modifications.length > 0) p.log.warn(`Cannot modify existing plugins (name/enabled) via the kintone API (add-only); unchanged: ${modifications.join(", ")}`);
14698
- if (addDisabled.length > 0) p.log.warn(`Cannot add plugins in a disabled state via the kintone API (add-only; adding would force-enable them); not added — set enabled: false manually in the kintone admin UI: ${addDisabled.join(", ")}`);
14699
- },
14700
- resolveContainerConfig: resolvePluginContainerConfig,
14701
- resolveAppContainerConfig: resolvePluginAppContainerConfig
14702
- })
14784
+ push: push_default$8
14703
14785
  },
14704
14786
  run: () => {}
14705
14787
  });
@@ -15030,6 +15112,22 @@ async function pushProcessManagement({ container, input }) {
15030
15112
  };
15031
15113
  }
15032
15114
  //#endregion
15115
+ //#region src/cli/commands/process/push.ts
15116
+ var push_default$7 = createPushCommand({
15117
+ description: "Push the local process management config to kintone (with drift detection)",
15118
+ args: processArgs,
15119
+ subject: "process management config",
15120
+ spinnerStopMessage: "Process management pushed to preview.",
15121
+ createContainer: createProcessManagementCliContainer,
15122
+ pushFn: pushProcessManagement,
15123
+ toctouMessage: "The remote changed while applying. Run `process pull` and retry.",
15124
+ onResult: (result) => {
15125
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
15126
+ },
15127
+ resolveContainerConfig: resolveProcessContainerConfig,
15128
+ resolveAppContainerConfig: resolveProcessAppContainerConfig
15129
+ });
15130
+ //#endregion
15033
15131
  //#region src/cli/commands/process/index.ts
15034
15132
  var process_default = define({
15035
15133
  name: "process",
@@ -15039,20 +15137,7 @@ var process_default = define({
15039
15137
  capture: capture_default$6,
15040
15138
  diff: diff_default$5,
15041
15139
  pull: pull_default$6,
15042
- push: createPushCommand({
15043
- description: "Push the local process management config to kintone (with drift detection)",
15044
- args: processArgs,
15045
- subject: "process management config",
15046
- spinnerStopMessage: "Process management pushed to preview.",
15047
- createContainer: createProcessManagementCliContainer,
15048
- pushFn: pushProcessManagement,
15049
- toctouMessage: "The remote changed while applying. Run `process pull` and retry.",
15050
- onResult: (result) => {
15051
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
15052
- },
15053
- resolveContainerConfig: resolveProcessContainerConfig,
15054
- resolveAppContainerConfig: resolveProcessAppContainerConfig
15055
- })
15140
+ push: push_default$7
15056
15141
  },
15057
15142
  run: () => {}
15058
15143
  });
@@ -15100,11 +15185,12 @@ function computeThreeWayMerge(base, local, remote) {
15100
15185
  let layoutConflict = false;
15101
15186
  let mergedLayout;
15102
15187
  let layoutAutoSide;
15103
- if (layoutLocalChanged && layoutRemoteChanged) if (isLayoutEqual(enrichedLocalLayout, enrichedRemoteLayout)) {
15104
- mergedLayout = enrichedLocalLayout;
15105
- layoutAutoSide = "local";
15106
- } else layoutConflict = true;
15107
- else if (layoutLocalChanged) {
15188
+ if (layoutLocalChanged && layoutRemoteChanged) {
15189
+ if (isLayoutEqual(enrichedLocalLayout, enrichedRemoteLayout)) {
15190
+ mergedLayout = enrichedLocalLayout;
15191
+ layoutAutoSide = "local";
15192
+ } else layoutConflict = true;
15193
+ } else if (layoutLocalChanged) {
15108
15194
  mergedLayout = enrichedLocalLayout;
15109
15195
  layoutAutoSide = "local";
15110
15196
  } else if (layoutRemoteChanged) {
@@ -15205,9 +15291,7 @@ function collectLayoutFieldCodes(layout) {
15205
15291
  placed.add(item.code);
15206
15292
  collectElements(item.fields);
15207
15293
  break;
15208
- case "REFERENCE_TABLE":
15209
- placed.add(item.code);
15210
- break;
15294
+ case "REFERENCE_TABLE": placed.add(item.code);
15211
15295
  }
15212
15296
  return {
15213
15297
  placed,
@@ -17333,6 +17417,84 @@ async function runDiff$4(containerConfig) {
17333
17417
  s.stop("Comparison complete.");
17334
17418
  printThreeWayDiffResult(result, printRecordPermissionDiffResult);
17335
17419
  }
17420
+ var diff_default$4 = define({
17421
+ name: "diff",
17422
+ description: "Compare local record permission config with remote kintone app (3-way)",
17423
+ args: recordAclArgs,
17424
+ run: async (ctx) => {
17425
+ try {
17426
+ await routeMultiApp(ctx.values, {
17427
+ singleLegacy: async () => {
17428
+ await runDiff$4(resolveRecordAclContainerConfig(ctx.values));
17429
+ },
17430
+ singleApp: async (app, projectConfig) => {
17431
+ await runDiff$4(resolveRecordAclAppContainerConfig(app, projectConfig, ctx.values));
17432
+ },
17433
+ multiApp: async (plan, projectConfig) => {
17434
+ await runMultiAppWithFailCheck(plan, async (app) => {
17435
+ printAppHeader(app.name, app.appId);
17436
+ await runDiff$4(resolveRecordAclAppContainerConfig(app, projectConfig, ctx.values));
17437
+ }, "All record permission diffs completed successfully.");
17438
+ }
17439
+ });
17440
+ } catch (error) {
17441
+ handleCliError(error);
17442
+ }
17443
+ }
17444
+ });
17445
+ //#endregion
17446
+ //#region src/cli/commands/record-acl/pull.ts
17447
+ var pull_default$4 = createPullCommand({
17448
+ description: "Pull remote record permissions into the local record-acl config (3-way merge)",
17449
+ args: recordAclArgs,
17450
+ subject: "record permission config",
17451
+ conflictNoun: "record permission",
17452
+ createContainer: createRecordPermissionCliContainer,
17453
+ pullFn: async ({ container, input }) => {
17454
+ const result = await pullRecordPermission({
17455
+ container,
17456
+ input
17457
+ });
17458
+ if (result.mode === "merged") return {
17459
+ mode: "merged",
17460
+ merged: result
17461
+ };
17462
+ return { mode: result.mode };
17463
+ },
17464
+ getMergeView: (merged) => ({
17465
+ hasConflict: merged.merge.hasConflict,
17466
+ conflicts: merged.merge.conflicts
17467
+ }),
17468
+ applyMerge: async ({ container, merged, resolution }) => {
17469
+ await applyPulledRecordPermissionMerge({
17470
+ container,
17471
+ input: {
17472
+ merge: merged.merge,
17473
+ resolution,
17474
+ remoteConfig: merged.remoteConfig,
17475
+ remoteRevision: merged.remoteRevision
17476
+ }
17477
+ });
17478
+ },
17479
+ resolveContainerConfig: resolveRecordAclContainerConfig,
17480
+ resolveAppContainerConfig: resolveRecordAclAppContainerConfig
17481
+ });
17482
+ //#endregion
17483
+ //#region src/cli/commands/record-acl/push.ts
17484
+ var push_default$5 = createPushCommand({
17485
+ description: "Push the local record permission config to kintone (with drift detection)",
17486
+ args: recordAclArgs,
17487
+ subject: "record permission config",
17488
+ spinnerStopMessage: "Record permissions pushed to preview.",
17489
+ createContainer: createRecordPermissionCliContainer,
17490
+ pushFn: pushRecordPermission,
17491
+ toctouMessage: "The remote changed while applying. Run `record-acl pull` and retry.",
17492
+ onResult: (result) => {
17493
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
17494
+ },
17495
+ resolveContainerConfig: resolveRecordAclContainerConfig,
17496
+ resolveAppContainerConfig: resolveRecordAclAppContainerConfig
17497
+ });
17336
17498
  //#endregion
17337
17499
  //#region src/cli/commands/record-acl/index.ts
17338
17500
  var record_acl_default = define({
@@ -17341,80 +17503,9 @@ var record_acl_default = define({
17341
17503
  subCommands: {
17342
17504
  apply: apply_default$4,
17343
17505
  capture: capture_default$5,
17344
- diff: define({
17345
- name: "diff",
17346
- description: "Compare local record permission config with remote kintone app (3-way)",
17347
- args: recordAclArgs,
17348
- run: async (ctx) => {
17349
- try {
17350
- await routeMultiApp(ctx.values, {
17351
- singleLegacy: async () => {
17352
- await runDiff$4(resolveRecordAclContainerConfig(ctx.values));
17353
- },
17354
- singleApp: async (app, projectConfig) => {
17355
- await runDiff$4(resolveRecordAclAppContainerConfig(app, projectConfig, ctx.values));
17356
- },
17357
- multiApp: async (plan, projectConfig) => {
17358
- await runMultiAppWithFailCheck(plan, async (app) => {
17359
- printAppHeader(app.name, app.appId);
17360
- await runDiff$4(resolveRecordAclAppContainerConfig(app, projectConfig, ctx.values));
17361
- }, "All record permission diffs completed successfully.");
17362
- }
17363
- });
17364
- } catch (error) {
17365
- handleCliError(error);
17366
- }
17367
- }
17368
- }),
17369
- pull: createPullCommand({
17370
- description: "Pull remote record permissions into the local record-acl config (3-way merge)",
17371
- args: recordAclArgs,
17372
- subject: "record permission config",
17373
- conflictNoun: "record permission",
17374
- createContainer: createRecordPermissionCliContainer,
17375
- pullFn: async ({ container, input }) => {
17376
- const result = await pullRecordPermission({
17377
- container,
17378
- input
17379
- });
17380
- if (result.mode === "merged") return {
17381
- mode: "merged",
17382
- merged: result
17383
- };
17384
- return { mode: result.mode };
17385
- },
17386
- getMergeView: (merged) => ({
17387
- hasConflict: merged.merge.hasConflict,
17388
- conflicts: merged.merge.conflicts
17389
- }),
17390
- applyMerge: async ({ container, merged, resolution }) => {
17391
- await applyPulledRecordPermissionMerge({
17392
- container,
17393
- input: {
17394
- merge: merged.merge,
17395
- resolution,
17396
- remoteConfig: merged.remoteConfig,
17397
- remoteRevision: merged.remoteRevision
17398
- }
17399
- });
17400
- },
17401
- resolveContainerConfig: resolveRecordAclContainerConfig,
17402
- resolveAppContainerConfig: resolveRecordAclAppContainerConfig
17403
- }),
17404
- push: createPushCommand({
17405
- description: "Push the local record permission config to kintone (with drift detection)",
17406
- args: recordAclArgs,
17407
- subject: "record permission config",
17408
- spinnerStopMessage: "Record permissions pushed to preview.",
17409
- createContainer: createRecordPermissionCliContainer,
17410
- pushFn: pushRecordPermission,
17411
- toctouMessage: "The remote changed while applying. Run `record-acl pull` and retry.",
17412
- onResult: (result) => {
17413
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
17414
- },
17415
- resolveContainerConfig: resolveRecordAclContainerConfig,
17416
- resolveAppContainerConfig: resolveRecordAclAppContainerConfig
17417
- })
17506
+ diff: diff_default$4,
17507
+ pull: pull_default$4,
17508
+ push: push_default$5
17418
17509
  },
17419
17510
  run: () => {}
17420
17511
  });
@@ -17519,7 +17610,85 @@ async function runDiff$3(containerConfig) {
17519
17610
  s.stop("Comparison complete.");
17520
17611
  printThreeWayDiffResult(result, printReportDiffResult);
17521
17612
  }
17522
- //#endregion
17613
+ var diff_default$3 = define({
17614
+ name: "diff",
17615
+ description: "Compare local report config with remote kintone app (3-way)",
17616
+ args: reportArgs,
17617
+ run: async (ctx) => {
17618
+ try {
17619
+ await routeMultiApp(ctx.values, {
17620
+ singleLegacy: async () => {
17621
+ await runDiff$3(resolveReportContainerConfig(ctx.values));
17622
+ },
17623
+ singleApp: async (app, projectConfig) => {
17624
+ await runDiff$3(resolveReportAppContainerConfig(app, projectConfig, ctx.values));
17625
+ },
17626
+ multiApp: async (plan, projectConfig) => {
17627
+ await runMultiAppWithFailCheck(plan, async (app) => {
17628
+ printAppHeader(app.name, app.appId);
17629
+ await runDiff$3(resolveReportAppContainerConfig(app, projectConfig, ctx.values));
17630
+ }, "All report diffs completed successfully.");
17631
+ }
17632
+ });
17633
+ } catch (error) {
17634
+ handleCliError(error);
17635
+ }
17636
+ }
17637
+ });
17638
+ //#endregion
17639
+ //#region src/cli/commands/report/pull.ts
17640
+ var pull_default$3 = createPullCommand({
17641
+ description: "Pull remote reports into the local report config (3-way merge)",
17642
+ args: reportArgs,
17643
+ subject: "report config",
17644
+ conflictNoun: "report",
17645
+ createContainer: createReportCliContainer,
17646
+ pullFn: async ({ container, input }) => {
17647
+ const result = await pullReport({
17648
+ container,
17649
+ input
17650
+ });
17651
+ if (result.mode === "merged") return {
17652
+ mode: "merged",
17653
+ merged: result
17654
+ };
17655
+ return { mode: result.mode };
17656
+ },
17657
+ getMergeView: (merged) => ({
17658
+ hasConflict: merged.merge.hasConflict,
17659
+ conflicts: merged.merge.conflicts
17660
+ }),
17661
+ applyMerge: async ({ container, merged, resolution }) => {
17662
+ await applyPulledReportMerge({
17663
+ container,
17664
+ input: {
17665
+ merge: merged.merge,
17666
+ resolution,
17667
+ remoteConfig: merged.remoteConfig,
17668
+ remoteRevision: merged.remoteRevision
17669
+ }
17670
+ });
17671
+ },
17672
+ resolveContainerConfig: resolveReportContainerConfig,
17673
+ resolveAppContainerConfig: resolveReportAppContainerConfig
17674
+ });
17675
+ //#endregion
17676
+ //#region src/cli/commands/report/push.ts
17677
+ var push_default$4 = createPushCommand({
17678
+ description: "Push the local report config to kintone (with drift detection)",
17679
+ args: reportArgs,
17680
+ subject: "report config",
17681
+ spinnerStopMessage: "Reports pushed to preview.",
17682
+ createContainer: createReportCliContainer,
17683
+ pushFn: pushReport,
17684
+ toctouMessage: "The remote changed while applying. Run `report pull` and retry.",
17685
+ onResult: (result) => {
17686
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
17687
+ },
17688
+ resolveContainerConfig: resolveReportContainerConfig,
17689
+ resolveAppContainerConfig: resolveReportAppContainerConfig
17690
+ });
17691
+ //#endregion
17523
17692
  //#region src/cli/commands/report/index.ts
17524
17693
  var report_default = define({
17525
17694
  name: "report",
@@ -17527,80 +17696,9 @@ var report_default = define({
17527
17696
  subCommands: {
17528
17697
  apply: apply_default$3,
17529
17698
  capture: capture_default$4,
17530
- diff: define({
17531
- name: "diff",
17532
- description: "Compare local report config with remote kintone app (3-way)",
17533
- args: reportArgs,
17534
- run: async (ctx) => {
17535
- try {
17536
- await routeMultiApp(ctx.values, {
17537
- singleLegacy: async () => {
17538
- await runDiff$3(resolveReportContainerConfig(ctx.values));
17539
- },
17540
- singleApp: async (app, projectConfig) => {
17541
- await runDiff$3(resolveReportAppContainerConfig(app, projectConfig, ctx.values));
17542
- },
17543
- multiApp: async (plan, projectConfig) => {
17544
- await runMultiAppWithFailCheck(plan, async (app) => {
17545
- printAppHeader(app.name, app.appId);
17546
- await runDiff$3(resolveReportAppContainerConfig(app, projectConfig, ctx.values));
17547
- }, "All report diffs completed successfully.");
17548
- }
17549
- });
17550
- } catch (error) {
17551
- handleCliError(error);
17552
- }
17553
- }
17554
- }),
17555
- pull: createPullCommand({
17556
- description: "Pull remote reports into the local report config (3-way merge)",
17557
- args: reportArgs,
17558
- subject: "report config",
17559
- conflictNoun: "report",
17560
- createContainer: createReportCliContainer,
17561
- pullFn: async ({ container, input }) => {
17562
- const result = await pullReport({
17563
- container,
17564
- input
17565
- });
17566
- if (result.mode === "merged") return {
17567
- mode: "merged",
17568
- merged: result
17569
- };
17570
- return { mode: result.mode };
17571
- },
17572
- getMergeView: (merged) => ({
17573
- hasConflict: merged.merge.hasConflict,
17574
- conflicts: merged.merge.conflicts
17575
- }),
17576
- applyMerge: async ({ container, merged, resolution }) => {
17577
- await applyPulledReportMerge({
17578
- container,
17579
- input: {
17580
- merge: merged.merge,
17581
- resolution,
17582
- remoteConfig: merged.remoteConfig,
17583
- remoteRevision: merged.remoteRevision
17584
- }
17585
- });
17586
- },
17587
- resolveContainerConfig: resolveReportContainerConfig,
17588
- resolveAppContainerConfig: resolveReportAppContainerConfig
17589
- }),
17590
- push: createPushCommand({
17591
- description: "Push the local report config to kintone (with drift detection)",
17592
- args: reportArgs,
17593
- subject: "report config",
17594
- spinnerStopMessage: "Reports pushed to preview.",
17595
- createContainer: createReportCliContainer,
17596
- pushFn: pushReport,
17597
- toctouMessage: "The remote changed while applying. Run `report pull` and retry.",
17598
- onResult: (result) => {
17599
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
17600
- },
17601
- resolveContainerConfig: resolveReportContainerConfig,
17602
- resolveAppContainerConfig: resolveReportAppContainerConfig
17603
- })
17699
+ diff: diff_default$3,
17700
+ pull: pull_default$3,
17701
+ push: push_default$4
17604
17702
  },
17605
17703
  run: () => {}
17606
17704
  });
@@ -17693,14 +17791,11 @@ async function detectThreeWayDiff({ container }) {
17693
17791
  kind: "remoteOnly"
17694
17792
  });
17695
17793
  break;
17696
- case "conflict":
17697
- conflicts.push({
17698
- key: entry.key,
17699
- label,
17700
- kind: "conflict"
17701
- });
17702
- break;
17703
- default: break;
17794
+ case "conflict": conflicts.push({
17795
+ key: entry.key,
17796
+ label,
17797
+ kind: "conflict"
17798
+ });
17704
17799
  }
17705
17800
  }
17706
17801
  const enrichedBaseLayout = enrichLayoutWithFields(state.schema.layout, state.schema.fields);
@@ -17736,41 +17831,71 @@ function buildLayoutExtras(layoutConflict, layoutLocalChanged, layoutRemoteChang
17736
17831
  return [];
17737
17832
  }
17738
17833
  //#endregion
17834
+ //#region src/cli/commands/schema/formReadTarget.ts
17835
+ /**
17836
+ * Shared `--published` flag for the schema commands that read a form definition
17837
+ * (`dump` / `diff`). Kept next to its users rather than in `src/cli/config.ts`,
17838
+ * which holds only domain-agnostic connection/execution-mode options.
17839
+ */
17840
+ const formReadTargetArgs = { published: {
17841
+ type: "boolean",
17842
+ description: "Read the published (deployed) form instead of the preview (unpublished) one"
17843
+ } };
17844
+ function resolveFormReadTarget(values) {
17845
+ return values.published ? "published" : "preview";
17846
+ }
17847
+ //#endregion
17739
17848
  //#region src/cli/commands/schema/diff.ts
17740
- async function runDiff$2(container) {
17849
+ async function runDiff$2(container, target) {
17850
+ printSchemaDiffTarget(target);
17741
17851
  const s = p.spinner();
17742
17852
  s.start("Comparing schema...");
17743
17853
  let result;
17744
17854
  try {
17745
- result = await detectThreeWayDiff({ container });
17855
+ result = target === "published" ? {
17856
+ kind: "published",
17857
+ value: await detectDiff({
17858
+ container,
17859
+ input: { target }
17860
+ })
17861
+ } : {
17862
+ kind: "preview",
17863
+ value: await detectThreeWayDiff({ container })
17864
+ };
17746
17865
  } catch (error) {
17747
17866
  s.stop("Comparison failed.");
17748
17867
  throw error;
17749
17868
  }
17750
17869
  s.stop("Comparison complete.");
17751
- printThreeWayDiffResult(result, printDiffResult);
17870
+ if (result.kind === "published") {
17871
+ printDiffResult(result.value);
17872
+ return;
17873
+ }
17874
+ printThreeWayDiffResult(result.value, printDiffResult);
17752
17875
  }
17753
17876
  var diff_default$2 = define({
17754
17877
  name: "diff",
17755
17878
  description: "Detect differences between schema file and current kintone form",
17756
17879
  args: {
17757
17880
  ...kintoneArgs,
17758
- ...multiAppArgs
17881
+ ...multiAppArgs,
17882
+ ...formReadTargetArgs
17759
17883
  },
17760
17884
  run: async (ctx) => {
17761
17885
  try {
17886
+ const target = resolveFormReadTarget(ctx.values);
17762
17887
  await routeMultiApp(ctx.values, {
17763
17888
  singleLegacy: async () => {
17764
- await runDiff$2(createCliContainer(resolveConfig(ctx.values)));
17889
+ await runDiff$2(createCliContainer(resolveConfig(ctx.values)), target);
17765
17890
  },
17766
17891
  singleApp: async (app, projectConfig) => {
17767
- await runDiff$2(createCliContainer(resolveAppCliConfig(app, projectConfig, ctx.values)));
17892
+ await runDiff$2(createCliContainer(resolveAppCliConfig(app, projectConfig, ctx.values)), target);
17768
17893
  },
17769
17894
  multiApp: async (plan, projectConfig) => {
17770
17895
  await runMultiAppWithFailCheck(plan, async (app) => {
17771
17896
  const container = createCliContainer(resolveAppCliConfig(app, projectConfig, ctx.values));
17772
17897
  printAppHeader(app.name, app.appId);
17773
- await runDiff$2(container);
17898
+ await runDiff$2(container, target);
17774
17899
  }, "All schema diffs completed successfully.");
17775
17900
  }
17776
17901
  });
@@ -17781,32 +17906,41 @@ var diff_default$2 = define({
17781
17906
  });
17782
17907
  //#endregion
17783
17908
  //#region src/core/adapters/kintone/formDumpReader.ts
17909
+ const GET_RAW_FORM_DATA_FAILURE_MESSAGES = {
17910
+ preview: "Failed to fetch raw form data for dump",
17911
+ published: "Failed to fetch published raw form data for dump (the app may not be deployed yet, or the credentials may not be allowed to read it)"
17912
+ };
17784
17913
  var KintoneFormDumpReader = class {
17914
+ client;
17915
+ appId;
17785
17916
  constructor(client, appId) {
17786
17917
  this.client = client;
17787
17918
  this.appId = appId;
17788
17919
  }
17789
- async getRawFormData() {
17920
+ async getRawFormData(target = DEFAULT_FORM_READ_TARGET) {
17921
+ const preview = target === "preview";
17790
17922
  try {
17791
17923
  const [fields, layout] = await Promise.all([this.client.app.getFormFields({
17792
17924
  app: this.appId,
17793
- preview: true
17925
+ preview
17794
17926
  }), this.client.app.getFormLayout({
17795
17927
  app: this.appId,
17796
- preview: true
17928
+ preview
17797
17929
  })]);
17798
17930
  return {
17799
17931
  fields,
17800
17932
  layout
17801
17933
  };
17802
17934
  } catch (error) {
17803
- throw wrapKintoneError(error, "Failed to fetch raw form data for dump");
17935
+ throw wrapKintoneError(error, GET_RAW_FORM_DATA_FAILURE_MESSAGES[target]);
17804
17936
  }
17805
17937
  }
17806
17938
  };
17807
17939
  //#endregion
17808
17940
  //#region src/core/adapters/local/dumpStorage.ts
17809
17941
  var LocalFileDumpStorage = class {
17942
+ filePrefix;
17943
+ baseDir;
17810
17944
  constructor(filePrefix, baseDir = process.cwd()) {
17811
17945
  this.filePrefix = filePrefix;
17812
17946
  this.baseDir = baseDir;
@@ -17844,29 +17978,38 @@ function createDumpCliContainer(config) {
17844
17978
  }
17845
17979
  //#endregion
17846
17980
  //#region src/core/application/formSchema/dumpForm.ts
17847
- async function dumpForm({ container }) {
17848
- const rawData = await container.formDumpReader.getRawFormData();
17981
+ async function dumpForm({ container, input }) {
17982
+ const rawData = await container.formDumpReader.getRawFormData(input?.target ?? "preview");
17849
17983
  await Promise.all([container.dumpStorage.saveFields(JSON.stringify(rawData.fields, null, 2)), container.dumpStorage.saveLayout(JSON.stringify(rawData.layout, null, 2))]);
17850
17984
  }
17851
17985
  //#endregion
17852
17986
  //#region src/cli/commands/schema/dump.ts
17853
- async function runSingleDump(config) {
17854
- const container = createDumpCliContainer(config);
17987
+ async function runSingleDump(config, basePrefix, target) {
17988
+ const filePrefix = `${basePrefix}${target === "published" ? "published-" : ""}`;
17989
+ const container = createDumpCliContainer({
17990
+ ...config,
17991
+ filePrefix
17992
+ });
17855
17993
  const s = p.spinner();
17856
- s.start("Fetching form fields and layout...");
17857
- await dumpForm({ container });
17994
+ s.start(target === "published" ? "Fetching published form fields and layout..." : "Fetching form fields and layout...");
17995
+ await dumpForm({
17996
+ container,
17997
+ input: { target }
17998
+ });
17858
17999
  s.stop("Form data fetched.");
17859
- p.log.success(`Saved ${pc.cyan(`${config.filePrefix}fields.json`)} and ${pc.cyan(`${config.filePrefix}layout.json`)}`);
18000
+ p.log.success(`Saved ${pc.cyan(`${filePrefix}fields.json`)} and ${pc.cyan(`${filePrefix}layout.json`)}`);
17860
18001
  }
17861
18002
  var dump_default = define({
17862
18003
  name: "dump",
17863
18004
  description: "Dump current kintone form fields and layout as JSON",
17864
18005
  args: {
17865
18006
  ...kintoneArgs,
17866
- ...multiAppArgs
18007
+ ...multiAppArgs,
18008
+ ...formReadTargetArgs
17867
18009
  },
17868
18010
  run: async (ctx) => {
17869
18011
  try {
18012
+ const target = resolveFormReadTarget(ctx.values);
17870
18013
  await routeMultiApp(ctx.values, {
17871
18014
  singleLegacy: async () => {
17872
18015
  const config = resolveConfig(ctx.values);
@@ -17874,9 +18017,8 @@ var dump_default = define({
17874
18017
  baseUrl: config.baseUrl,
17875
18018
  auth: config.auth,
17876
18019
  appId: config.appId,
17877
- guestSpaceId: config.guestSpaceId,
17878
- filePrefix: ""
17879
- });
18020
+ guestSpaceId: config.guestSpaceId
18021
+ }, "", target);
17880
18022
  },
17881
18023
  singleApp: async (app, projectConfig) => {
17882
18024
  const config = resolveAppCliConfig(app, projectConfig, ctx.values);
@@ -17884,9 +18026,8 @@ var dump_default = define({
17884
18026
  baseUrl: config.baseUrl,
17885
18027
  auth: config.auth,
17886
18028
  appId: config.appId,
17887
- guestSpaceId: config.guestSpaceId,
17888
- filePrefix: `${app.name}-`
17889
- });
18029
+ guestSpaceId: config.guestSpaceId
18030
+ }, `${app.name}-`, target);
17890
18031
  },
17891
18032
  multiApp: async (plan, projectConfig) => {
17892
18033
  await runMultiAppWithFailCheck(plan, async (app) => {
@@ -17896,9 +18037,8 @@ var dump_default = define({
17896
18037
  baseUrl: config.baseUrl,
17897
18038
  auth: config.auth,
17898
18039
  appId: config.appId,
17899
- guestSpaceId: config.guestSpaceId,
17900
- filePrefix: `${app.name}-`
17901
- });
18040
+ guestSpaceId: config.guestSpaceId
18041
+ }, `${app.name}-`, target);
17902
18042
  }, "All dumps completed successfully.");
17903
18043
  }
17904
18044
  });
@@ -18221,21 +18361,23 @@ async function resolveConflicts(merge, options) {
18221
18361
  fields.set(conflict.key, choice);
18222
18362
  }
18223
18363
  let layout = "noConflict";
18224
- if (merge.layoutConflict) if (options.ours) layout = "local";
18225
- else if (options.theirs) layout = "remote";
18226
- else {
18227
- const selected = await p.select({
18228
- message: "Conflict on layout. Keep which side?",
18229
- options: [{
18230
- value: "local",
18231
- label: "local (ours)"
18232
- }, {
18233
- value: "remote",
18234
- label: "remote (theirs)"
18235
- }]
18236
- });
18237
- if (p.isCancel(selected)) return;
18238
- layout = selected;
18364
+ if (merge.layoutConflict) {
18365
+ if (options.ours) layout = "local";
18366
+ else if (options.theirs) layout = "remote";
18367
+ else {
18368
+ const selected = await p.select({
18369
+ message: "Conflict on layout. Keep which side?",
18370
+ options: [{
18371
+ value: "local",
18372
+ label: "local (ours)"
18373
+ }, {
18374
+ value: "remote",
18375
+ label: "remote (theirs)"
18376
+ }]
18377
+ });
18378
+ if (p.isCancel(selected)) return;
18379
+ layout = selected;
18380
+ }
18239
18381
  }
18240
18382
  return {
18241
18383
  fields,
@@ -18437,6 +18579,41 @@ async function runValidate(schemaFilePath) {
18437
18579
  function resolveSchemaFilePath(values, appSchemaFile) {
18438
18580
  return values["schema-file"] ?? process.env.SCHEMA_FILE_PATH ?? appSchemaFile ?? "schema.yaml";
18439
18581
  }
18582
+ var validate_default = define({
18583
+ name: "validate",
18584
+ description: "Validate schema file without connecting to kintone",
18585
+ args: validateArgs,
18586
+ run: async (ctx) => {
18587
+ try {
18588
+ const values = ctx.values;
18589
+ await routeMultiApp(values, {
18590
+ singleLegacy: async () => {
18591
+ if (!await runValidate(resolveSchemaFilePath(values))) {
18592
+ p.outro("Validation failed.");
18593
+ process.exit(1);
18594
+ }
18595
+ p.outro("Validation passed.");
18596
+ },
18597
+ singleApp: async (app) => {
18598
+ if (!await runValidate(resolveSchemaFilePath(values, app.schemaFile))) {
18599
+ p.outro("Validation failed.");
18600
+ process.exit(1);
18601
+ }
18602
+ p.outro("Validation passed.");
18603
+ },
18604
+ multiApp: async (plan) => {
18605
+ await runMultiAppWithFailCheck(plan, async (app) => {
18606
+ printAppHeader(app.name, app.appId);
18607
+ const schemaFilePath = resolveSchemaFilePath(values, app.schemaFile);
18608
+ if (!printValidationResult(await validateSchema({ container: createValidateCliContainer({ schemaFilePath }) }), schemaFilePath)) throw new ValidationError(ValidationErrorCode.InvalidInput, `Validation failed for app "${app.name}"`);
18609
+ }, "All validations passed.");
18610
+ }
18611
+ });
18612
+ } catch (error) {
18613
+ handleCliError(error);
18614
+ }
18615
+ }
18616
+ });
18440
18617
  //#endregion
18441
18618
  //#region src/cli/commands/schema/index.ts
18442
18619
  var schema_default = define({
@@ -18447,41 +18624,7 @@ var schema_default = define({
18447
18624
  migrate: migrate_default,
18448
18625
  override: override_default,
18449
18626
  capture: capture_default$3,
18450
- validate: define({
18451
- name: "validate",
18452
- description: "Validate schema file without connecting to kintone",
18453
- args: validateArgs,
18454
- run: async (ctx) => {
18455
- try {
18456
- const values = ctx.values;
18457
- await routeMultiApp(values, {
18458
- singleLegacy: async () => {
18459
- if (!await runValidate(resolveSchemaFilePath(values))) {
18460
- p.outro("Validation failed.");
18461
- process.exit(1);
18462
- }
18463
- p.outro("Validation passed.");
18464
- },
18465
- singleApp: async (app) => {
18466
- if (!await runValidate(resolveSchemaFilePath(values, app.schemaFile))) {
18467
- p.outro("Validation failed.");
18468
- process.exit(1);
18469
- }
18470
- p.outro("Validation passed.");
18471
- },
18472
- multiApp: async (plan) => {
18473
- await runMultiAppWithFailCheck(plan, async (app) => {
18474
- printAppHeader(app.name, app.appId);
18475
- const schemaFilePath = resolveSchemaFilePath(values, app.schemaFile);
18476
- if (!printValidationResult(await validateSchema({ container: createValidateCliContainer({ schemaFilePath }) }), schemaFilePath)) throw new ValidationError(ValidationErrorCode.InvalidInput, `Validation failed for app "${app.name}"`);
18477
- }, "All validations passed.");
18478
- }
18479
- });
18480
- } catch (error) {
18481
- handleCliError(error);
18482
- }
18483
- }
18484
- }),
18627
+ validate: validate_default,
18485
18628
  dump: dump_default,
18486
18629
  pull: pull_default$2,
18487
18630
  push: push_default$3
@@ -18641,6 +18784,34 @@ async function runSeedCapture(config, keyField) {
18641
18784
  if (!keyField) p.log.info("No key field specified. All records will be added on apply.");
18642
18785
  if (result.hasExistingSeed) p.log.warn("Existing seed file was overwritten.");
18643
18786
  }
18787
+ var capture_default$2 = define({
18788
+ name: "capture",
18789
+ description: "Capture records from kintone app to seed file",
18790
+ args: seedCaptureArgs,
18791
+ run: async (ctx) => {
18792
+ try {
18793
+ const values = ctx.values;
18794
+ const keyField = values["key-field"];
18795
+ await routeMultiApp(values, {
18796
+ singleLegacy: async () => {
18797
+ await runSeedCapture(resolveSeedConfig(values), keyField);
18798
+ },
18799
+ singleApp: async (app, projectConfig) => {
18800
+ await runSeedCapture(resolveSeedAppConfig(app, projectConfig, values), keyField);
18801
+ },
18802
+ multiApp: async (plan, projectConfig) => {
18803
+ await runMultiAppWithFailCheck(plan, async (app) => {
18804
+ const config = resolveSeedAppConfig(app, projectConfig, values);
18805
+ printAppHeader(app.name, app.appId);
18806
+ await runSeedCapture(config, keyField);
18807
+ }, "All captures completed successfully.");
18808
+ }
18809
+ });
18810
+ } catch (error) {
18811
+ handleCliError(error);
18812
+ }
18813
+ }
18814
+ });
18644
18815
  //#endregion
18645
18816
  //#region src/cli/commands/seed/index.ts
18646
18817
  var seed_default = define({
@@ -18649,34 +18820,7 @@ var seed_default = define({
18649
18820
  subCommands: {
18650
18821
  push: push_default$2,
18651
18822
  apply: apply_default$2,
18652
- capture: define({
18653
- name: "capture",
18654
- description: "Capture records from kintone app to seed file",
18655
- args: seedCaptureArgs,
18656
- run: async (ctx) => {
18657
- try {
18658
- const values = ctx.values;
18659
- const keyField = values["key-field"];
18660
- await routeMultiApp(values, {
18661
- singleLegacy: async () => {
18662
- await runSeedCapture(resolveSeedConfig(values), keyField);
18663
- },
18664
- singleApp: async (app, projectConfig) => {
18665
- await runSeedCapture(resolveSeedAppConfig(app, projectConfig, values), keyField);
18666
- },
18667
- multiApp: async (plan, projectConfig) => {
18668
- await runMultiAppWithFailCheck(plan, async (app) => {
18669
- const config = resolveSeedAppConfig(app, projectConfig, values);
18670
- printAppHeader(app.name, app.appId);
18671
- await runSeedCapture(config, keyField);
18672
- }, "All captures completed successfully.");
18673
- }
18674
- });
18675
- } catch (error) {
18676
- handleCliError(error);
18677
- }
18678
- }
18679
- })
18823
+ capture: capture_default$2
18680
18824
  },
18681
18825
  run: () => {}
18682
18826
  });
@@ -18810,6 +18954,57 @@ var diff_default$1 = define({
18810
18954
  //#region src/cli/commands/settings/pull.ts
18811
18955
  /** Fixed conflict key for the single (whole-entity) settings config. */
18812
18956
  const SETTINGS_CONFLICT_KEY = "settings";
18957
+ var pull_default$1 = createPullCommand({
18958
+ description: "Pull remote general settings into the local settings config (3-way merge)",
18959
+ args: settingsArgs,
18960
+ subject: "general settings config",
18961
+ conflictNoun: "settings",
18962
+ createContainer: createGeneralSettingsCliContainer,
18963
+ pullFn: async ({ container, input }) => {
18964
+ const result = await pullGeneralSettings({
18965
+ container,
18966
+ input
18967
+ });
18968
+ if (result.mode === "merged") return {
18969
+ mode: "merged",
18970
+ merged: result
18971
+ };
18972
+ return { mode: result.mode };
18973
+ },
18974
+ getMergeView: (merged) => ({
18975
+ hasConflict: merged.merge.hasConflict,
18976
+ conflicts: merged.merge.hasConflict ? [{ key: SETTINGS_CONFLICT_KEY }] : []
18977
+ }),
18978
+ applyMerge: async ({ container, merged, resolution }) => {
18979
+ await applyPulledGeneralSettingsMerge({
18980
+ container,
18981
+ input: {
18982
+ merge: merged.merge,
18983
+ resolution: resolution.get(SETTINGS_CONFLICT_KEY),
18984
+ remoteConfig: merged.remoteConfig,
18985
+ remoteRevision: merged.remoteRevision
18986
+ }
18987
+ });
18988
+ },
18989
+ resolveContainerConfig: resolveSettingsContainerConfig,
18990
+ resolveAppContainerConfig: resolveSettingsAppContainerConfig
18991
+ });
18992
+ //#endregion
18993
+ //#region src/cli/commands/settings/push.ts
18994
+ var push_default$1 = createPushCommand({
18995
+ description: "Push the local general settings config to kintone (with drift detection)",
18996
+ args: settingsArgs,
18997
+ subject: "general settings config",
18998
+ spinnerStopMessage: "General settings pushed to preview.",
18999
+ createContainer: createGeneralSettingsCliContainer,
19000
+ pushFn: pushGeneralSettings,
19001
+ toctouMessage: "The remote changed while applying. Run `settings pull` and retry.",
19002
+ onResult: (result) => {
19003
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
19004
+ },
19005
+ resolveContainerConfig: resolveSettingsContainerConfig,
19006
+ resolveAppContainerConfig: resolveSettingsAppContainerConfig
19007
+ });
18813
19008
  //#endregion
18814
19009
  //#region src/cli/commands/settings/index.ts
18815
19010
  var settings_default = define({
@@ -18819,55 +19014,8 @@ var settings_default = define({
18819
19014
  apply: apply_default$1,
18820
19015
  capture: capture_default$1,
18821
19016
  diff: diff_default$1,
18822
- pull: createPullCommand({
18823
- description: "Pull remote general settings into the local settings config (3-way merge)",
18824
- args: settingsArgs,
18825
- subject: "general settings config",
18826
- conflictNoun: "settings",
18827
- createContainer: createGeneralSettingsCliContainer,
18828
- pullFn: async ({ container, input }) => {
18829
- const result = await pullGeneralSettings({
18830
- container,
18831
- input
18832
- });
18833
- if (result.mode === "merged") return {
18834
- mode: "merged",
18835
- merged: result
18836
- };
18837
- return { mode: result.mode };
18838
- },
18839
- getMergeView: (merged) => ({
18840
- hasConflict: merged.merge.hasConflict,
18841
- conflicts: merged.merge.hasConflict ? [{ key: SETTINGS_CONFLICT_KEY }] : []
18842
- }),
18843
- applyMerge: async ({ container, merged, resolution }) => {
18844
- await applyPulledGeneralSettingsMerge({
18845
- container,
18846
- input: {
18847
- merge: merged.merge,
18848
- resolution: resolution.get(SETTINGS_CONFLICT_KEY),
18849
- remoteConfig: merged.remoteConfig,
18850
- remoteRevision: merged.remoteRevision
18851
- }
18852
- });
18853
- },
18854
- resolveContainerConfig: resolveSettingsContainerConfig,
18855
- resolveAppContainerConfig: resolveSettingsAppContainerConfig
18856
- }),
18857
- push: createPushCommand({
18858
- description: "Push the local general settings config to kintone (with drift detection)",
18859
- args: settingsArgs,
18860
- subject: "general settings config",
18861
- spinnerStopMessage: "General settings pushed to preview.",
18862
- createContainer: createGeneralSettingsCliContainer,
18863
- pushFn: pushGeneralSettings,
18864
- toctouMessage: "The remote changed while applying. Run `settings pull` and retry.",
18865
- onResult: (result) => {
18866
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
18867
- },
18868
- resolveContainerConfig: resolveSettingsContainerConfig,
18869
- resolveAppContainerConfig: resolveSettingsAppContainerConfig
18870
- })
19017
+ pull: pull_default$1,
19018
+ push: push_default$1
18871
19019
  },
18872
19020
  run: () => {}
18873
19021
  });
@@ -18975,6 +19123,85 @@ async function runDiff(containerConfig) {
18975
19123
  s.stop("Comparison complete.");
18976
19124
  printThreeWayDiffResult(result, printViewDiffResult);
18977
19125
  }
19126
+ var diff_default = define({
19127
+ name: "diff",
19128
+ description: "Compare local view config with remote kintone app (3-way)",
19129
+ args: viewArgs,
19130
+ run: async (ctx) => {
19131
+ try {
19132
+ await routeMultiApp(ctx.values, {
19133
+ singleLegacy: async () => {
19134
+ await runDiff(resolveViewContainerConfig(ctx.values));
19135
+ },
19136
+ singleApp: async (app, projectConfig) => {
19137
+ await runDiff(resolveViewAppContainerConfig(app, projectConfig, ctx.values));
19138
+ },
19139
+ multiApp: async (plan, projectConfig) => {
19140
+ await runMultiAppWithFailCheck(plan, async (app) => {
19141
+ printAppHeader(app.name, app.appId);
19142
+ await runDiff(resolveViewAppContainerConfig(app, projectConfig, ctx.values));
19143
+ }, "All view diffs completed successfully.");
19144
+ }
19145
+ });
19146
+ } catch (error) {
19147
+ handleCliError(error);
19148
+ }
19149
+ }
19150
+ });
19151
+ //#endregion
19152
+ //#region src/cli/commands/view/pull.ts
19153
+ var pull_default = createPullCommand({
19154
+ description: "Pull remote views into the local view config (3-way merge)",
19155
+ args: viewArgs,
19156
+ subject: "view config",
19157
+ conflictNoun: "view",
19158
+ createContainer: createViewCliContainer,
19159
+ pullFn: async ({ container, input }) => {
19160
+ const result = await pullView({
19161
+ container,
19162
+ input
19163
+ });
19164
+ if (result.mode === "merged") return {
19165
+ mode: "merged",
19166
+ merged: result
19167
+ };
19168
+ return { mode: result.mode };
19169
+ },
19170
+ getMergeView: (merged) => ({
19171
+ hasConflict: merged.merge.hasConflict,
19172
+ conflicts: merged.merge.conflicts
19173
+ }),
19174
+ applyMerge: async ({ container, merged, resolution }) => {
19175
+ await applyPulledViewMerge({
19176
+ container,
19177
+ input: {
19178
+ merge: merged.merge,
19179
+ resolution,
19180
+ remoteConfig: merged.remoteConfig,
19181
+ remoteRevision: merged.remoteRevision
19182
+ }
19183
+ });
19184
+ },
19185
+ resolveContainerConfig: resolveViewContainerConfig,
19186
+ resolveAppContainerConfig: resolveViewAppContainerConfig
19187
+ });
19188
+ //#endregion
19189
+ //#region src/cli/commands/view/push.ts
19190
+ var push_default = createPushCommand({
19191
+ description: "Push the local view config to kintone (with drift detection)",
19192
+ args: viewArgs,
19193
+ subject: "view config",
19194
+ spinnerStopMessage: "Views pushed to preview.",
19195
+ createContainer: createViewCliContainer,
19196
+ pushFn: pushView,
19197
+ toctouMessage: "The remote changed while applying. Run `view pull` and retry.",
19198
+ onResult: (result) => {
19199
+ if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
19200
+ if (result.skippedBuiltinViews.length > 0) p.log.warn(`Skipped builtin views (cannot be updated): ${result.skippedBuiltinViews.join(", ")}`);
19201
+ },
19202
+ resolveContainerConfig: resolveViewContainerConfig,
19203
+ resolveAppContainerConfig: resolveViewAppContainerConfig
19204
+ });
18978
19205
  //#endregion
18979
19206
  //#region src/cli/commands/view/index.ts
18980
19207
  var view_default = define({
@@ -18983,81 +19210,9 @@ var view_default = define({
18983
19210
  subCommands: {
18984
19211
  apply: apply_default,
18985
19212
  capture: capture_default,
18986
- diff: define({
18987
- name: "diff",
18988
- description: "Compare local view config with remote kintone app (3-way)",
18989
- args: viewArgs,
18990
- run: async (ctx) => {
18991
- try {
18992
- await routeMultiApp(ctx.values, {
18993
- singleLegacy: async () => {
18994
- await runDiff(resolveViewContainerConfig(ctx.values));
18995
- },
18996
- singleApp: async (app, projectConfig) => {
18997
- await runDiff(resolveViewAppContainerConfig(app, projectConfig, ctx.values));
18998
- },
18999
- multiApp: async (plan, projectConfig) => {
19000
- await runMultiAppWithFailCheck(plan, async (app) => {
19001
- printAppHeader(app.name, app.appId);
19002
- await runDiff(resolveViewAppContainerConfig(app, projectConfig, ctx.values));
19003
- }, "All view diffs completed successfully.");
19004
- }
19005
- });
19006
- } catch (error) {
19007
- handleCliError(error);
19008
- }
19009
- }
19010
- }),
19011
- pull: createPullCommand({
19012
- description: "Pull remote views into the local view config (3-way merge)",
19013
- args: viewArgs,
19014
- subject: "view config",
19015
- conflictNoun: "view",
19016
- createContainer: createViewCliContainer,
19017
- pullFn: async ({ container, input }) => {
19018
- const result = await pullView({
19019
- container,
19020
- input
19021
- });
19022
- if (result.mode === "merged") return {
19023
- mode: "merged",
19024
- merged: result
19025
- };
19026
- return { mode: result.mode };
19027
- },
19028
- getMergeView: (merged) => ({
19029
- hasConflict: merged.merge.hasConflict,
19030
- conflicts: merged.merge.conflicts
19031
- }),
19032
- applyMerge: async ({ container, merged, resolution }) => {
19033
- await applyPulledViewMerge({
19034
- container,
19035
- input: {
19036
- merge: merged.merge,
19037
- resolution,
19038
- remoteConfig: merged.remoteConfig,
19039
- remoteRevision: merged.remoteRevision
19040
- }
19041
- });
19042
- },
19043
- resolveContainerConfig: resolveViewContainerConfig,
19044
- resolveAppContainerConfig: resolveViewAppContainerConfig
19045
- }),
19046
- push: createPushCommand({
19047
- description: "Push the local view config to kintone (with drift detection)",
19048
- args: viewArgs,
19049
- subject: "view config",
19050
- spinnerStopMessage: "Views pushed to preview.",
19051
- createContainer: createViewCliContainer,
19052
- pushFn: pushView,
19053
- toctouMessage: "The remote changed while applying. Run `view pull` and retry.",
19054
- onResult: (result) => {
19055
- if (result.mode === "firstTime") p.log.warn("No base snapshot found. Applied without drift guard and initialized state.");
19056
- if (result.skippedBuiltinViews.length > 0) p.log.warn(`Skipped builtin views (cannot be updated): ${result.skippedBuiltinViews.join(", ")}`);
19057
- },
19058
- resolveContainerConfig: resolveViewContainerConfig,
19059
- resolveAppContainerConfig: resolveViewAppContainerConfig
19060
- })
19213
+ diff: diff_default,
19214
+ pull: pull_default,
19215
+ push: push_default
19061
19216
  },
19062
19217
  run: () => {}
19063
19218
  });