UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

32 lines (31 loc) • 1.46 kB
//#region src/cron/delivery-target-validation.ts /** Returns whether a delivery plan names a concrete channel, recipient, thread, or account. */ function hasExplicitCronDeliveryTarget(e) { return Boolean(e.target || e.channel && e.channel !== "last" || e.to || e.threadId != null || e.accountId); } function assertNonBlankStringField(e, t) { if (t === void 0 || t === null) return; if (typeof t !== "string" || !t.trim()) { const t = e.slice(0, e.lastIndexOf(".")); throw new Error(`${e} must be a non-empty string; omit ${t} if unused, or supply a valid target. No changes were saved. Retry with corrected arguments; do not report success unless the retry succeeds. If you cannot retry, tell the user the reminder was not saved.`); } } function assertCronDeliveryInputNonBlankFields(e, t = "delivery") { if (!e || typeof e !== "object") return; const n = e; assertNonBlankStringField(`${t}.channel`, n.channel); assertNonBlankStringField(`${t}.to`, n.to); const r = n.failureDestination; if (r && typeof r === "object") { const e = r; assertNonBlankStringField(`${t}.failureDestination.channel`, e.channel); assertNonBlankStringField(`${t}.failureDestination.to`, e.to); } const i = n.completionDestination; if (i && typeof i === "object") { const e = i; assertNonBlankStringField(`${t}.completionDestination.to`, e.to); } } //#endregion export { hasExplicitCronDeliveryTarget as n, assertCronDeliveryInputNonBlankFields as t };