kintone-migrator 0.34.0 → 0.34.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
@@ -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 < 0) throw new BusinessRuleError(NotificationErrorCode.NtInvalidDaysLater, `Reminder notification at index ${index} has invalid "daysLater": ${raw.daysLater}. Must be a non-negative integer`);
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 < 0)) throw new BusinessRuleError(NotificationErrorCode.NtInvalidHoursLater, `Reminder notification at index ${index} has invalid "hoursLater": ${String(raw.hoursLater)}. Must be a non-negative integer`);
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,