kintone-migrator 0.34.1 → 0.34.2

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
@@ -6724,12 +6724,26 @@ async function applyPlugin({ container }) {
6724
6724
  if (!result.exists) throw new ValidationError(ValidationErrorCode.InvalidInput, "Plugin config file not found");
6725
6725
  const config = parsePluginConfigText(container.configCodec, result.content);
6726
6726
  const current = await container.pluginConfigurator.getPlugins();
6727
- const currentIds = new Set(current.plugins.map((p) => p.id));
6728
- const missingIds = config.plugins.map((p) => p.id).filter((id) => !currentIds.has(id));
6729
- if (missingIds.length > 0) await container.pluginConfigurator.addPlugins({
6730
- ids: missingIds,
6727
+ const remoteById = new Map(current.plugins.map((p) => [p.id, p]));
6728
+ const idsToAdd = [];
6729
+ const skipped = [];
6730
+ for (const plugin of config.plugins) {
6731
+ const remote = remoteById.get(plugin.id);
6732
+ if (plugin.enabled) {
6733
+ if (remote === void 0) idsToAdd.push(plugin.id);
6734
+ } else if (remote === void 0 || remote.enabled) skipped.push({
6735
+ pluginId: plugin.id,
6736
+ reason: "disabled"
6737
+ });
6738
+ }
6739
+ if (idsToAdd.length > 0) await container.pluginConfigurator.addPlugins({
6740
+ ids: idsToAdd,
6731
6741
  revision: current.revision
6732
6742
  });
6743
+ return {
6744
+ addedPluginIds: idsToAdd,
6745
+ skipped
6746
+ };
6733
6747
  }
6734
6748
  //#endregion
6735
6749
  //#region src/core/domain/processManagement/services/configParser.ts
@@ -13783,6 +13797,11 @@ var apply_default$6 = createApplyCommand({
13783
13797
  successMessage: "Plugins applied successfully.",
13784
13798
  createContainer: createPluginCliContainer,
13785
13799
  applyFn: applyPlugin,
13800
+ onResult: (result) => {
13801
+ if (result.addedPluginIds.length > 0) p.log.info(`Added plugins: ${result.addedPluginIds.join(", ")}`);
13802
+ const disabled = result.skipped.map((s) => s.pluginId);
13803
+ if (disabled.length > 0) p.log.warn(`enabled: false is not supported by the kintone plugin API (add-only; cannot disable); handle in the kintone admin UI: ${disabled.join(", ")}`);
13804
+ },
13786
13805
  diffPreview: {
13787
13806
  detectDiff: detectPluginDiff,
13788
13807
  printResult: printPluginDiffResult