import { EventEmitter } from 'events'; import { QueuedCommandJob } from '../models/queued-command'; export interface QueuedCommandRunnerEvents { 'error': (error: Error) => void; 'queueProcessed': (job: PendingJob) => void; 'startJob': (job: QueuedCommandJob) => void; 'finishJob': (job: QueuedCommandJob) => void; 'waitingForJobsToFinish': (pendingJobs: PendingJob[]) => void; 'doneWaitingForJobsToFinish': () => void; 'starting': () => void; 'started': () => void; 'stopping': () => void; 'stopped': () => void; 'cleaningUp': () => void; 'cleanedUp': () => void; } export declare interface QueuedCommandRunner { on(event: U, listener: QueuedCommandRunnerEvents[U]): this; emit(event: U, ...args: Parameters): boolean; } export declare class PendingJob { job: QueuedCommandJob; jobPromise: Promise; jobPromiseResolver: () => void; error: Error; constructor(job?: QueuedCommandJob, error?: Error, jobPromise?: Promise); } export interface QueuedCommandRunnerSettings { timeoutIdleMs: number; timeoutWorkingMs: number; autoStart: boolean; autoStopOnNoJobs: boolean; } export declare class QueuedCommandRunner extends EventEmitter { private queue; private concurrentQueue; private concurrentQueueProcessFn; private pendingJobs; private previouslyHandledJob; private processing; private jobHandler; settings: QueuedCommandRunnerSettings; constructor(settings?: QueuedCommandRunnerSettings); addJob(commandJob: QueuedCommandJob): void; start(): void; stop(): void; private handleJobs; private cleanup; private handleNextJob; private waitForPendingJobsToFinish; private startJobInQueue; private startJob; }