kintone-migrator 0.34.0 → 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 +27 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6537,6 +6537,8 @@ function isNotificationEntityType(value) {
|
|
|
6537
6537
|
}
|
|
6538
6538
|
//#endregion
|
|
6539
6539
|
//#region src/core/domain/notification/services/configParser.ts
|
|
6540
|
+
const REMINDER_OFFSET_MIN = -1e4;
|
|
6541
|
+
const REMINDER_OFFSET_MAX = 1e4;
|
|
6540
6542
|
function parseEntity$1(raw, context) {
|
|
6541
6543
|
if (!isRecord(raw)) throw new BusinessRuleError(NotificationErrorCode.NtInvalidConfigStructure, `${context}: entity must be an object`);
|
|
6542
6544
|
if (typeof raw.type !== "string" || !isNotificationEntityType(raw.type)) throw new BusinessRuleError(NotificationErrorCode.NtInvalidEntityType, `${context}: entity has invalid type: ${String(raw.type)}. Must be USER, GROUP, ORGANIZATION, or FIELD_ENTITY`);
|
|
@@ -6601,11 +6603,11 @@ function parseReminderNotification(raw, index) {
|
|
|
6601
6603
|
if (!Array.isArray(raw.targets)) throw new BusinessRuleError(NotificationErrorCode.NtInvalidConfigStructure, `Reminder notification at index ${index} must have a "targets" array`);
|
|
6602
6604
|
const targets = raw.targets.map((item, i) => parseTarget(item, i, "Reminder"));
|
|
6603
6605
|
if (typeof raw.daysLater !== "number") throw new BusinessRuleError(NotificationErrorCode.NtMissingRequiredField, `Reminder notification at index ${index} must have a "daysLater" property`);
|
|
6604
|
-
if (!Number.isInteger(raw.daysLater) || raw.daysLater <
|
|
6606
|
+
if (!Number.isInteger(raw.daysLater) || raw.daysLater < REMINDER_OFFSET_MIN || raw.daysLater > REMINDER_OFFSET_MAX) throw new BusinessRuleError(NotificationErrorCode.NtInvalidDaysLater, `Reminder notification at index ${index} has invalid "daysLater": ${raw.daysLater}. Must be an integer between ${REMINDER_OFFSET_MIN} and ${REMINDER_OFFSET_MAX}`);
|
|
6605
6607
|
const hasHoursLater = raw.hoursLater !== void 0 && raw.hoursLater !== null;
|
|
6606
6608
|
const hasTime = raw.time !== void 0 && raw.time !== null;
|
|
6607
6609
|
if (hasHoursLater && hasTime) throw new BusinessRuleError(NotificationErrorCode.NtConflictingTimingFields, `Reminder notification at index ${index} must not have both "hoursLater" and "time"`);
|
|
6608
|
-
if (hasHoursLater && (typeof raw.hoursLater !== "number" || !Number.isInteger(raw.hoursLater) || raw.hoursLater <
|
|
6610
|
+
if (hasHoursLater && (typeof raw.hoursLater !== "number" || !Number.isInteger(raw.hoursLater) || raw.hoursLater < REMINDER_OFFSET_MIN || raw.hoursLater > REMINDER_OFFSET_MAX)) throw new BusinessRuleError(NotificationErrorCode.NtInvalidHoursLater, `Reminder notification at index ${index} has invalid "hoursLater": ${String(raw.hoursLater)}. Must be an integer between ${REMINDER_OFFSET_MIN} and ${REMINDER_OFFSET_MAX}`);
|
|
6609
6611
|
if (hasTime && typeof raw.time !== "string") throw new BusinessRuleError(NotificationErrorCode.NtInvalidConfigStructure, `Reminder notification at index ${index} has non-string "time": ${String(raw.time)}`);
|
|
6610
6612
|
const result = {
|
|
6611
6613
|
code: raw.code,
|
|
@@ -6722,12 +6724,26 @@ async function applyPlugin({ container }) {
|
|
|
6722
6724
|
if (!result.exists) throw new ValidationError(ValidationErrorCode.InvalidInput, "Plugin config file not found");
|
|
6723
6725
|
const config = parsePluginConfigText(container.configCodec, result.content);
|
|
6724
6726
|
const current = await container.pluginConfigurator.getPlugins();
|
|
6725
|
-
const
|
|
6726
|
-
const
|
|
6727
|
-
|
|
6728
|
-
|
|
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,
|
|
6729
6741
|
revision: current.revision
|
|
6730
6742
|
});
|
|
6743
|
+
return {
|
|
6744
|
+
addedPluginIds: idsToAdd,
|
|
6745
|
+
skipped
|
|
6746
|
+
};
|
|
6731
6747
|
}
|
|
6732
6748
|
//#endregion
|
|
6733
6749
|
//#region src/core/domain/processManagement/services/configParser.ts
|
|
@@ -13781,6 +13797,11 @@ var apply_default$6 = createApplyCommand({
|
|
|
13781
13797
|
successMessage: "Plugins applied successfully.",
|
|
13782
13798
|
createContainer: createPluginCliContainer,
|
|
13783
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
|
+
},
|
|
13784
13805
|
diffPreview: {
|
|
13785
13806
|
detectDiff: detectPluginDiff,
|
|
13786
13807
|
printResult: printPluginDiffResult
|