kintone-migrator 0.34.2 → 0.34.4

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
@@ -16230,6 +16275,7 @@ function buildPhases(args) {
16230
16275
  container: c.schema,
16231
16276
  input: { force }
16232
16277
  });
16278
+ return [];
16233
16279
  }
16234
16280
  }]
16235
16281
  },
@@ -16246,6 +16292,7 @@ function buildPhases(args) {
16246
16292
  force
16247
16293
  }
16248
16294
  });
16295
+ return [];
16249
16296
  }
16250
16297
  }, {
16251
16298
  domain: "view",
@@ -16255,6 +16302,7 @@ function buildPhases(args) {
16255
16302
  container: c.view,
16256
16303
  input: { force }
16257
16304
  });
16305
+ return [];
16258
16306
  }
16259
16307
  }]
16260
16308
  },
@@ -16269,6 +16317,7 @@ function buildPhases(args) {
16269
16317
  container: c.fieldPermission,
16270
16318
  input: { force }
16271
16319
  });
16320
+ return [];
16272
16321
  }
16273
16322
  },
16274
16323
  {
@@ -16279,6 +16328,7 @@ function buildPhases(args) {
16279
16328
  container: c.appPermission,
16280
16329
  input: { force }
16281
16330
  });
16331
+ return [];
16282
16332
  }
16283
16333
  },
16284
16334
  {
@@ -16289,6 +16339,7 @@ function buildPhases(args) {
16289
16339
  container: c.recordPermission,
16290
16340
  input: { force }
16291
16341
  });
16342
+ return [];
16292
16343
  }
16293
16344
  }
16294
16345
  ]
@@ -16304,6 +16355,7 @@ function buildPhases(args) {
16304
16355
  container: c.settings,
16305
16356
  input: { force }
16306
16357
  });
16358
+ return [];
16307
16359
  }
16308
16360
  },
16309
16361
  {
@@ -16314,6 +16366,7 @@ function buildPhases(args) {
16314
16366
  container: c.notification,
16315
16367
  input: { force }
16316
16368
  });
16369
+ return [];
16317
16370
  }
16318
16371
  },
16319
16372
  {
@@ -16324,6 +16377,7 @@ function buildPhases(args) {
16324
16377
  container: c.report,
16325
16378
  input: { force }
16326
16379
  });
16380
+ return [];
16327
16381
  }
16328
16382
  },
16329
16383
  {
@@ -16334,6 +16388,7 @@ function buildPhases(args) {
16334
16388
  container: c.action,
16335
16389
  input: { force }
16336
16390
  });
16391
+ return [];
16337
16392
  }
16338
16393
  },
16339
16394
  {
@@ -16344,6 +16399,7 @@ function buildPhases(args) {
16344
16399
  container: c.process,
16345
16400
  input: { force }
16346
16401
  });
16402
+ return [];
16347
16403
  }
16348
16404
  },
16349
16405
  {
@@ -16354,16 +16410,34 @@ function buildPhases(args) {
16354
16410
  container: c.adminNotes,
16355
16411
  input: { force }
16356
16412
  });
16413
+ return [];
16357
16414
  }
16358
16415
  },
16359
16416
  {
16360
16417
  domain: "plugin",
16361
16418
  storageExists: async () => (await c.plugin.pluginStorage.get()).exists,
16362
16419
  run: async () => {
16363
- await pushPlugin({
16420
+ const result = await pushPlugin({
16364
16421
  container: c.plugin,
16365
16422
  input: { force }
16366
16423
  });
16424
+ const warnings = [];
16425
+ const deletions = result.skipped.filter((o) => o.reason === "delete").map((o) => o.pluginId);
16426
+ const modifications = result.skipped.filter((o) => o.reason === "modify").map((o) => o.pluginId);
16427
+ const addDisabled = result.skipped.filter((o) => o.reason === "add-disabled").map((o) => o.pluginId);
16428
+ if (deletions.length > 0) warnings.push({
16429
+ domain: "plugin",
16430
+ message: `Cannot remove plugins via the kintone API (add-only); left on the app: ${deletions.join(", ")}`
16431
+ });
16432
+ if (modifications.length > 0) warnings.push({
16433
+ domain: "plugin",
16434
+ message: `Cannot modify existing plugins (name/enabled) via the kintone API (add-only); unchanged: ${modifications.join(", ")}`
16435
+ });
16436
+ if (addDisabled.length > 0) warnings.push({
16437
+ domain: "plugin",
16438
+ message: `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(", ")}`
16439
+ });
16440
+ return warnings;
16367
16441
  }
16368
16442
  }
16369
16443
  ]
@@ -16403,11 +16477,12 @@ async function executeSchemaPhase(phase, containers, state) {
16403
16477
  continue;
16404
16478
  }
16405
16479
  try {
16406
- await task.run();
16480
+ const warnings = await task.run();
16407
16481
  await deployApp({ container: containers.schema });
16408
16482
  results.push({
16409
16483
  domain: task.domain,
16410
- success: true
16484
+ success: true,
16485
+ warnings
16411
16486
  });
16412
16487
  } catch (error) {
16413
16488
  const err = toError(error);
@@ -16454,10 +16529,11 @@ async function executeStandardPhase(phase, state) {
16454
16529
  continue;
16455
16530
  }
16456
16531
  try {
16457
- await task.run();
16532
+ const warnings = await task.run();
16458
16533
  results.push({
16459
16534
  domain: task.domain,
16460
- success: true
16535
+ success: true,
16536
+ warnings
16461
16537
  });
16462
16538
  } catch (error) {
16463
16539
  const err = toError(error);
@@ -16570,6 +16646,7 @@ function printPhaseResult(phaseResult) {
16570
16646
  for (const result of phaseResult.results) {
16571
16647
  p.log.message(formatTaskResult(result));
16572
16648
  if (!result.success && result.skipped === false) logError(result.error);
16649
+ if (result.success) for (const warning of result.warnings) p.log.warn(warning.message);
16573
16650
  }
16574
16651
  }
16575
16652
  function printPushAllResults(output) {