UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 1.21 kB
//!src/cron/delivery-target-validation.ts 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)}}export{hasExplicitCronDeliveryTarget as n,assertCronDeliveryInputNonBlankFields as t};