/** * Schedule helpers: extract schedules from IR and run scheduled commands. * * Spec: docs/spec/semantics.md ยง "Scheduled Commands" */ import type { IR, IRSchedule } from './ir'; /** * Extract all schedules from an IR. * Returns a map keyed by schedule name for convenient lookup. * * @param ir - The compiled IR * @returns Map of schedule name โ†’ IRSchedule */ export declare function getSchedulesFromIR(ir: IR): Map; /** * Determine whether a 5-field cron expression is due at the given instant. * * Fields: minute hour day-of-month month day-of-week. Evaluated in **UTC** so * the result is a pure function of the absolute instant (independent of the * host timezone) โ€” matching Vercel Cron, which runs in UTC. Day-of-month and * day-of-week follow the standard Vixie-cron OR rule: when BOTH are restricted * (neither is `*`), the day matches if EITHER matches; otherwise both must. * * Throws on a malformed expression (wrong field count, out-of-range value, bad * step/range) โ€” callers iterating schedules (the worker) isolate the throw. */ export declare function isCronDue(expression: string, date: Date): boolean; /** * Whether a cron expression is due at the given epoch millisecond timestamp. * Thin wrapper over {@link isCronDue}; matches to the minute in UTC. */ export declare function shouldRunCron(cronExpression: string, timestamp: number): boolean; /** * Determine if an interval schedule should run. * Simplified: checks if the time elapsed since the last run exceeds the interval. * For testing, use explicit runSchedule() calls instead. * * @param intervalExpression - Interval expression (e.g., "5m", "1h", "1 weeks") * @param now - Current timestamp (ms) * @param lastRunAt - Last run timestamp (ms), or 0 if never run * @returns true if the interval has elapsed */ export declare function shouldRunInterval(intervalExpression: string, now: number, lastRunAt: number): boolean; /** * Whether an interval/every schedule is due: true once the elapsed time since * its last run reaches `durationMs`. The IR carries the resolved millisecond * duration for both `interval` and `every` triggers, so this takes ms directly * (unlike {@link shouldRunInterval}, which parses a duration string). */ export declare function isIntervalDue(durationMs: number, now: number, lastRunAt: number): boolean; /** * Parse interval expression to milliseconds. * Supports: "5m" (minutes), "1h" (hours), "1 days" (days), "1 weeks" (weeks). * * @param expression - Interval expression * @returns Milliseconds, or -1 if unparseable */ export declare function parseIntervalExpression(expression: string): number; //# sourceMappingURL=runtime-schedule.d.ts.map