import { ExternallyResolveablePromise } from "../externalPromise";
export interface BatchEntry<CallArgs extends any[], CallResult> {
    args: CallArgs;
    promise: ExternallyResolveablePromise<CallResult>;
    index: number;
}
export interface AddCallParams<BatchArgs, CallArgs extends any[]> {
    batchArgs: BatchArgs | undefined;
    index: number;
    args: CallArgs;
}
export interface CreateBatcherParams<CallArgs extends any[], CallResult, BatchArgs, BatchResult> {
    waitTime: number;
    allowParallelBatches?: boolean;
    prepareBatch?(batchEntries: BatchEntry<CallArgs, CallResult>[]): BatchEntry<CallArgs, CallResult>[];
    addCall(args: AddCallParams<BatchArgs, CallArgs>): BatchArgs;
    createCallResult(batchResult: BatchResult, index: number): CallResult;
    processBatch(args: BatchArgs): Promise<BatchResult>;
    finishCall?(batchEntry: BatchEntry<CallArgs, CallResult>, error: Error | undefined, callResult: CallResult | undefined): void;
}
export declare const createBatcher: <CallArgs extends any[], CallResult, BatchArgs, BatchResult>(params: CreateBatcherParams<CallArgs, CallResult, BatchArgs, BatchResult>) => (...args: CallArgs) => Promise<CallResult>;
