import type { TaskClass, TaskLaunchOptions } from '../task-launcher/index.js'; import type { SchedulerOptions } from './scheduler-options.js'; import { ExecutionMode } from './execution-mode.js'; /** * Orchestrates the scheduling and execution of tasks according to a specified or default configuration. * Listens for changes to the configuration file to reload and apply new settings automatically. */ export declare class Scheduler { #private; /** * Initializes a new Scheduler instance with either an array of TaskClass instances and an optional * verbose flag, or SchedulerOptions. * @param options Configuration options for the scheduler or an array of task classes. * @param verbose Optional flag indicating whether verbose logging should be enabled. */ constructor(options: SchedulerOptions); constructor(tasks: TaskClass[], verbose?: boolean); /** * Checks for the existence of the scheduler's configuration file. * @returns A promise that resolves to true if the configuration file exists, false otherwise. */ configExists(): Promise; /** * Generates a new configuration file or saves the provided configuration for the scheduler. * @param configuration Optional configuration object to be saved. If not provided, a default * configuration is generated based on the tasks. * @returns A promise that resolves once the configuration has been generated or saved. */ generate(configuration?: TaskLaunchOptions): Promise; /** * Begins executing the scheduled tasks according to the configuration file. * Sets up a watcher on the configuration file to dynamically apply changes. * @throws Error if the scheduler is already running. */ execute(): Promise; /** * Executes specified tasks immediately, either in serial or parallel execution mode. This method filters tasks by their names if provided, otherwise attempts to execute all configured tasks. * In serial mode, tasks are executed one after the other, waiting for each task to complete before starting the next. * In parallel mode, all filtered tasks are started at the same time, and the method waits for all to complete. * If no tasks match the provided names, an error is thrown. * @param mode The execution mode: 'serial' or 'parallel'. Determines how tasks are executed relative to each other. * @param names Optional names of tasks to execute. If no names are provided, all tasks are executed. * @throws Error if no tasks are found that match the provided names or if the mode is invalid. */ executeNow(mode: ExecutionMode, ...names: string[]): Promise; /** * Gracefully aborts all running tasks and stops the scheduler. */ abort(): Promise; }