import type { Queryable } from 'mysql2-async'; export interface SchedulerOpts { /** * Minimum number of minutes that need to go by before the task will be run again. * * For instance, if you set this to 30, the task will run approximately every 30 minutes. * * If there is downtime, the task will likely run immediately after startup. */ minutesBetween?: number; /** * Task will only execute during the given hour, if it has been long enough * since the last execution to satisfy minutesBetween. * * Hour is in the API container's time zone, be sure to set it appropriately with the * TZ environment variable. * * Starts with 0 (12am-1am), ends at 23 (11pm-12am) * * For a nightly task that should only execute once, set this to the desired hour * and minutesBetween > 60. Smaller minutesBetween will mean more executions during * that hour. */ duringHour?: number; /** * Task will only execute during the given day of the week. * * 1 is Monday and 7 is Sunday * * Best used with duringHour or with minutesBetween > 24 * 60 - note that if * minutesBetween is small, the task will execute many times on the given day. */ duringDayOfWeek?: DayOfWeek; /** * Task will only execute during the given day of the month. * * Starts with 1 * * Best used with duringHour or with minutesBetween > 24 * 60 - note that if * minutesBetween is small, the task will execute many times on the given day. */ duringDayOfMonth?: number; } export type SchedulerJob = () => Promise | void; export declare enum DayOfWeek { MONDAY = 1, TUESDAY = 2, WEDNESDAY = 3, THURSDAY = 4, FRIDAY = 5, SATURDAY = 6, SUNDAY = 7 } export declare class Scheduler { protected jobs: Map; protected started: boolean; schedule(jobname: string, job: SchedulerJob, opts: SchedulerOpts): Promise; start(): Promise; static createTable(db: Queryable): Promise; } export declare const scheduler: Scheduler;