import { Dispatcher } from "dispatcher"; import { CommandDump, CommandInstance } from "command"; export type DispatcherOptionsType = { storage?: DispatcherStorageType; onInitialization?: (dispatcherInstance: Dispatcher) => void; onUpdateStorage?: (queueKey: string, data: DispatcherData) => void; onDeleteFromStorage?: (queueKey: string, data: DispatcherData) => void; onClearStorage?: (dispatcherInstance: Dispatcher) => void; }; // Values export type DispatcherDumpValueType = { requestId: string; commandDump: CommandDump; retries: number; timestamp: number; stopped: boolean; }; export type DispatcherData = { requests: DispatcherDumpValueType[]; stopped: boolean; }; // Storage export type DispatcherStorageType = { set: (key: string, data: DispatcherData) => void; get: (key: string) => DispatcherData | undefined; keys: () => string[] | IterableIterator; delete: (key: string) => void; clear: () => void; }; // Running export type RunningRequestValueType = { requestId: string; command: CommandInstance; };