export type BatchItemResult<TData> = {
    ok: true;
    data: TData;
} | {
    ok: false;
    error: {
        code: string;
        message: string;
    };
};
export declare function stableSerialize(value: unknown): string;
export type Microbatcher<TRequest extends {
    id: string;
}, TData> = {
    getOrEnqueue: (key: string, makeRequest: (id: string) => TRequest) => Promise<TData>;
};
export declare function createMicrobatcher<TRequest extends {
    id: string;
}, TData>(options: {
    maxBatchSize: number;
    runBatch: (requests: TRequest[]) => Promise<Record<string, BatchItemResult<TData>>>;
    schedule?: (fn: () => void) => void;
}): Microbatcher<TRequest, TData>;
