/** * Pure, dependency-free cron helpers: friendly preset (hourly / daily / weekly / * monthly) ↔ 5-field cron expression round-tripping, human-readable descriptions, * and a lightweight plausibility check. Originally built for the User Routines * editor; general-purpose for any schedule-editing UI. * * NOT a cron engine: for real validation, is-due checks, and next-occurrence math * use `CronExpressionHelper` in `@memberjunction/scheduling-engine` (parser-backed; * it can't live here without pulling cron-parser + core into MJGlobal). * {@link IsPlausibleCronExpression} is only a UI pre-filter, not validation. */ /** Which schedule preset a cron expression corresponds to (or 'advanced' when none). */ export type CronPresetKind = 'hourly' | 'daily' | 'weekly' | 'monthly' | 'advanced'; /** Structured schedule the editor binds to; converted to/from a cron expression. */ export interface CronSchedule { /** The preset in effect. 'advanced' means Raw is authoritative. */ Kind: CronPresetKind; /** Minute (0-59). Hourly: minute past each hour. Other presets: minute of the run time. */ Minute: number; /** Hour (0-23) for daily / weekly / monthly presets. */ Hour: number; /** Day of week (0-6, 0 = Sunday) for the weekly preset. */ DayOfWeek: number; /** Day of month (1-31) for the monthly preset. */ DayOfMonth: number; /** Raw cron expression — authoritative when Kind === 'advanced'. */ Raw: string; } /** Weekday display names indexed by cron day-of-week value (0 = Sunday). */ export declare const CRON_DAY_NAMES: readonly string[]; /** A fresh default schedule: daily at 9:00 AM. */ export declare function DefaultCronSchedule(): CronSchedule; /** Builds the cron expression for a structured schedule. */ export declare function BuildCronExpression(schedule: CronSchedule): string; /** * Parses a cron expression back into a structured schedule, detecting the friendly * presets the editor can render. Anything that doesn't match a preset shape comes * back as 'advanced' with Raw preserved (never lossy). */ export declare function ParseCronExpression(cron: string | null | undefined): CronSchedule; /** * Human-friendly description of a cron expression. Covers the editor presets plus a * couple of common step shapes; anything else falls back to the raw expression so the * UI never shows a wrong description. */ export declare function DescribeCronExpression(cron: string | null | undefined): string; /** Formats an hour/minute pair as a 12-hour clock time (e.g. "9:05 AM"). */ export declare function FormatTimeOfDay(hour: number, minute: number): string; /** English ordinal for a day-of-month (1 → "1st", 22 → "22nd"). */ export declare function Ordinal(n: number): string; /** Loose sanity check for a raw (advanced) cron expression: 5 or 6 whitespace-separated fields. */ export declare function IsPlausibleCronExpression(raw: string): boolean; //# sourceMappingURL=CronUtils.d.ts.map