kintone-migrator 0.34.2 → 0.34.3

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
@@ -7442,6 +7442,7 @@ function buildPhases$1(args) {
7442
7442
  storageExists: async () => (await c.schema.schemaStorage.get()).exists,
7443
7443
  run: async () => {
7444
7444
  await executeMigration({ container: c.schema });
7445
+ return [];
7445
7446
  }
7446
7447
  }]
7447
7448
  },
@@ -7455,12 +7456,14 @@ function buildPhases$1(args) {
7455
7456
  container: c.customization,
7456
7457
  input: { basePath: args.customizeBasePath }
7457
7458
  });
7459
+ return [];
7458
7460
  }
7459
7461
  }, {
7460
7462
  domain: "view",
7461
7463
  storageExists: async () => (await c.view.viewStorage.get()).exists,
7462
7464
  run: async () => {
7463
7465
  await applyView({ container: c.view });
7466
+ return [];
7464
7467
  }
7465
7468
  }]
7466
7469
  },
@@ -7472,6 +7475,7 @@ function buildPhases$1(args) {
7472
7475
  storageExists: async () => (await c.fieldPermission.fieldPermissionStorage.get()).exists,
7473
7476
  run: async () => {
7474
7477
  await applyFieldPermission({ container: c.fieldPermission });
7478
+ return [];
7475
7479
  }
7476
7480
  },
7477
7481
  {
@@ -7479,6 +7483,7 @@ function buildPhases$1(args) {
7479
7483
  storageExists: async () => (await c.appPermission.appPermissionStorage.get()).exists,
7480
7484
  run: async () => {
7481
7485
  await applyAppPermission({ container: c.appPermission });
7486
+ return [];
7482
7487
  }
7483
7488
  },
7484
7489
  {
@@ -7486,6 +7491,7 @@ function buildPhases$1(args) {
7486
7491
  storageExists: async () => (await c.recordPermission.recordPermissionStorage.get()).exists,
7487
7492
  run: async () => {
7488
7493
  await applyRecordPermission({ container: c.recordPermission });
7494
+ return [];
7489
7495
  }
7490
7496
  }
7491
7497
  ]
@@ -7498,6 +7504,7 @@ function buildPhases$1(args) {
7498
7504
  storageExists: async () => (await c.settings.generalSettingsStorage.get()).exists,
7499
7505
  run: async () => {
7500
7506
  await applyGeneralSettings({ container: c.settings });
7507
+ return [];
7501
7508
  }
7502
7509
  },
7503
7510
  {
@@ -7505,6 +7512,7 @@ function buildPhases$1(args) {
7505
7512
  storageExists: async () => (await c.notification.notificationStorage.get()).exists,
7506
7513
  run: async () => {
7507
7514
  await applyNotification({ container: c.notification });
7515
+ return [];
7508
7516
  }
7509
7517
  },
7510
7518
  {
@@ -7512,6 +7520,7 @@ function buildPhases$1(args) {
7512
7520
  storageExists: async () => (await c.report.reportStorage.get()).exists,
7513
7521
  run: async () => {
7514
7522
  await applyReport({ container: c.report });
7523
+ return [];
7515
7524
  }
7516
7525
  },
7517
7526
  {
@@ -7519,6 +7528,7 @@ function buildPhases$1(args) {
7519
7528
  storageExists: async () => (await c.action.actionStorage.get()).exists,
7520
7529
  run: async () => {
7521
7530
  await applyAction({ container: c.action });
7531
+ return [];
7522
7532
  }
7523
7533
  },
7524
7534
  {
@@ -7526,6 +7536,7 @@ function buildPhases$1(args) {
7526
7536
  storageExists: async () => (await c.process.processManagementStorage.get()).exists,
7527
7537
  run: async () => {
7528
7538
  await applyProcessManagement({ container: c.process });
7539
+ return [];
7529
7540
  }
7530
7541
  },
7531
7542
  {
@@ -7533,13 +7544,19 @@ function buildPhases$1(args) {
7533
7544
  storageExists: async () => (await c.adminNotes.adminNotesStorage.get()).exists,
7534
7545
  run: async () => {
7535
7546
  await applyAdminNotes({ container: c.adminNotes });
7547
+ return [];
7536
7548
  }
7537
7549
  },
7538
7550
  {
7539
7551
  domain: "plugin",
7540
7552
  storageExists: async () => (await c.plugin.pluginStorage.get()).exists,
7541
7553
  run: async () => {
7542
- await applyPlugin({ container: c.plugin });
7554
+ const disabled = (await applyPlugin({ container: c.plugin })).skipped.map((s) => s.pluginId);
7555
+ if (disabled.length === 0) return [];
7556
+ return [{
7557
+ domain: "plugin",
7558
+ message: `enabled: false is not supported by the kintone plugin API (add-only; cannot disable); handle in the kintone admin UI: ${disabled.join(", ")}`
7559
+ }];
7543
7560
  }
7544
7561
  }
7545
7562
  ]
@@ -7554,6 +7571,7 @@ function buildPhases$1(args) {
7554
7571
  container: c.seed,
7555
7572
  input: {}
7556
7573
  });
7574
+ return [];
7557
7575
  }
7558
7576
  }]
7559
7577
  }
@@ -7589,11 +7607,12 @@ async function executeSchemaPhase$1(phase, containers, state) {
7589
7607
  continue;
7590
7608
  }
7591
7609
  try {
7592
- await task.run();
7610
+ const warnings = await task.run();
7593
7611
  await deployApp({ container: containers.schema });
7594
7612
  results.push({
7595
7613
  domain: task.domain,
7596
- success: true
7614
+ success: true,
7615
+ warnings
7597
7616
  });
7598
7617
  } catch (error) {
7599
7618
  const err = toError$2(error);
@@ -7634,10 +7653,11 @@ async function executeStandardPhase$1(phase, state) {
7634
7653
  continue;
7635
7654
  }
7636
7655
  try {
7637
- await task.run();
7656
+ const warnings = await task.run();
7638
7657
  results.push({
7639
7658
  domain: task.domain,
7640
- success: true
7659
+ success: true,
7660
+ warnings
7641
7661
  });
7642
7662
  } catch (error) {
7643
7663
  const err = toError$2(error);
@@ -9988,6 +10008,7 @@ function printPhaseResult$1(phaseResult) {
9988
10008
  for (const result of phaseResult.results) {
9989
10009
  p.log.message(formatTaskResult$2(result));
9990
10010
  if (!result.success && !result.skipped) logError(result.error);
10011
+ if (result.success) for (const warning of result.warnings) p.log.warn(warning.message);
9991
10012
  }
9992
10013
  }
9993
10014
  function printApplyAllResults(output) {
@@ -14083,18 +14104,52 @@ var pull_default$7 = createPullCommand({
14083
14104
  /** Pull command name surfaced in the drift hint message. */
14084
14105
  const PLUGIN_PULL_COMMAND = "plugin pull";
14085
14106
  /**
14107
+ * Splits the local→remote diff into the ids that can actually be added
14108
+ * (`enabled: true`, missing on the remote) and the inexpressible ops surfaced
14109
+ * as `skipped`: `add-disabled` (`enabled: false`, missing), `delete` (remote
14110
+ * plugin absent locally), and `modify` (existing plugin with name/enabled
14111
+ * change).
14112
+ */
14113
+ function partitionPushOps(local, remoteById, localById, remotePlugins) {
14114
+ const idsToAdd = [];
14115
+ const skipped = [];
14116
+ for (const localPlugin of local.plugins) {
14117
+ const remotePlugin = remoteById.get(localPlugin.id);
14118
+ if (remotePlugin === void 0) if (localPlugin.enabled) idsToAdd.push(localPlugin.id);
14119
+ else skipped.push({
14120
+ pluginId: localPlugin.id,
14121
+ reason: "add-disabled"
14122
+ });
14123
+ else if (remotePlugin.name !== localPlugin.name || remotePlugin.enabled !== localPlugin.enabled) skipped.push({
14124
+ pluginId: localPlugin.id,
14125
+ reason: "modify"
14126
+ });
14127
+ }
14128
+ for (const remotePlugin of remotePlugins) if (!localById.has(remotePlugin.id)) skipped.push({
14129
+ pluginId: remotePlugin.id,
14130
+ reason: "delete"
14131
+ });
14132
+ return {
14133
+ idsToAdd,
14134
+ skipped
14135
+ };
14136
+ }
14137
+ /**
14086
14138
  * Applies the local plugin config to the remote with drift detection.
14087
14139
  *
14088
14140
  * The plugin API is **add-only**: `addPlugins` can only install a plugin id
14089
14141
  * that is not yet on the app. It has no remove API and cannot control the
14090
- * `enabled` flag (MEMORY: plugin-enabled-no-disable-api). So this push:
14142
+ * `enabled` flag. So this push:
14091
14143
  *
14092
14144
  * - Loads base/local/remote and rejects on drift (remoteOnly / conflict) unless
14093
14145
  * `--force`.
14094
- * - Adds only the plugin ids that are present locally but missing on the remote.
14095
- * - Surfaces every requested-but-inexpressible operation (a local deletion of a
14096
- * remote plugin, or a name/enabled change to an existing plugin) as a
14097
- * `skipped` warning instead of applying it the only inexpressible case.
14146
+ * - Adds only the `enabled: true` plugin ids that are present locally but
14147
+ * missing on the remote.
14148
+ * - Surfaces every requested-but-inexpressible operation as a `skipped` warning
14149
+ * instead of applying it: a local deletion of a remote plugin (`delete`), a
14150
+ * name/enabled change to an existing plugin (`modify`), and an `enabled: false`
14151
+ * plugin missing on the remote (`add-disabled`, since `addPlugins` would
14152
+ * force-enable it).
14098
14153
  *
14099
14154
  * The expected revision (the observed remote revision) is sent to `addPlugins`
14100
14155
  * as a TOCTOU guard on a normal push; `--force` / first run omit it. When there is nothing to add, the remote is not touched but
@@ -14114,19 +14169,7 @@ async function pushPlugin({ container, input }) {
14114
14169
  }
14115
14170
  const remoteById = new Map(remote.config.plugins.map((p) => [p.id, p]));
14116
14171
  const localById = new Map(local.plugins.map((p) => [p.id, p]));
14117
- const idsToAdd = local.plugins.filter((p) => !remoteById.has(p.id)).map((p) => p.id);
14118
- const skipped = [];
14119
- for (const remotePlugin of remote.config.plugins) if (!localById.has(remotePlugin.id)) skipped.push({
14120
- pluginId: remotePlugin.id,
14121
- reason: "delete"
14122
- });
14123
- for (const localPlugin of local.plugins) {
14124
- const remotePlugin = remoteById.get(localPlugin.id);
14125
- if (remotePlugin !== void 0 && (remotePlugin.name !== localPlugin.name || remotePlugin.enabled !== localPlugin.enabled)) skipped.push({
14126
- pluginId: localPlugin.id,
14127
- reason: "modify"
14128
- });
14129
- }
14172
+ const { idsToAdd, skipped } = partitionPushOps(local, remoteById, localById, remote.config.plugins);
14130
14173
  let newRevision = remote.revision;
14131
14174
  if (idsToAdd.length > 0) {
14132
14175
  const expectedRevision = input.force || firstTime ? void 0 : remote.revision;
@@ -14169,8 +14212,10 @@ var plugin_default = define({
14169
14212
  if (result.addedPluginIds.length > 0) p.log.info(`Added plugins: ${result.addedPluginIds.join(", ")}`);
14170
14213
  const deletions = result.skipped.filter((o) => o.reason === "delete").map((o) => o.pluginId);
14171
14214
  const modifications = result.skipped.filter((o) => o.reason === "modify").map((o) => o.pluginId);
14215
+ const addDisabled = result.skipped.filter((o) => o.reason === "add-disabled").map((o) => o.pluginId);
14172
14216
  if (deletions.length > 0) p.log.warn(`Cannot remove plugins via the kintone API (add-only); left on the app: ${deletions.join(", ")}`);
14173
14217
  if (modifications.length > 0) p.log.warn(`Cannot modify existing plugins (name/enabled) via the kintone API (add-only); unchanged: ${modifications.join(", ")}`);
14218
+ 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(", ")}`);
14174
14219
  },
14175
14220
  resolveContainerConfig: resolvePluginContainerConfig,
14176
14221
  resolveAppContainerConfig: resolvePluginAppContainerConfig