import { DeferredPromise } from "@vlocode/util"; export interface WorkItemResult { status: 'fulfilled' | 'rejected'; value: T; reason?: any | Error; } /** * Deferred work processor class which queues work items and returns an awaitable deferred promise. This class supports bulkification * of otherwise singular work items. A processor function/delegate is passed which will process all queue items in bulk. Optionally a chunk size can be * specified which determines the size of the chunks passed to the processor delegate. */ export declare class DeferredWorkQueue { /** Time to wait until executing the queued lookups */ private readonly processWaitTime; /** Size of the chunks */ private readonly chunkSize; /** Processor fn */ private readonly processor; /** Queue with items that are going to be worked upon */ private readonly requestQueue; /** Used to keep track of work items */ private requestIdRef; /** Set of items that is currently being processed */ private processingQueue; private queueTimer?; private processing; constructor(processor: (requests: TRequest[]) => Promise>>, thisArg?: any, /** Time to wait until executing the queued lookups */ processWaitTime?: number, /** Size of the chunks */ chunkSize?: number | undefined); /** * Enqueue a work item ro be picked up * @param workItem work item to enqueue */ enqueue(workItem: TRequest): DeferredPromise; /** * Find the first item that matches the predicate and returns the associated promise; use this to avoid enqueued ing the same item multiple items */ getQueuedWork(predicate: (item: TRequest) => any | boolean): DeferredPromise | undefined; private processQueue; private enqueueProcessing; } //# sourceMappingURL=deferredWorkQueue.d.ts.map