UNPKG

1.06 kBTypeScriptView Raw
1import { FetchResult, NextLink, Operation } from '../core';
2import { Observable } from '../../utilities';
3export declare type BatchHandler = (operations: Operation[], forward?: (NextLink | undefined)[]) => Observable<FetchResult[]> | null;
4export interface BatchableRequest {
5 operation: Operation;
6 forward?: NextLink;
7}
8export declare class OperationBatcher {
9 private batchesByKey;
10 private scheduledBatchTimer;
11 private batchDebounce?;
12 private batchInterval?;
13 private batchMax;
14 private batchHandler;
15 private batchKey;
16 constructor({ batchDebounce, batchInterval, batchMax, batchHandler, batchKey, }: {
17 batchDebounce?: boolean;
18 batchInterval?: number;
19 batchMax?: number;
20 batchHandler: BatchHandler;
21 batchKey?: (operation: Operation) => string;
22 });
23 enqueueRequest(request: BatchableRequest): Observable<FetchResult>;
24 consumeQueue(key?: string): (Observable<FetchResult> | undefined)[] | undefined;
25 private scheduleQueueConsumption;
26}
27//# sourceMappingURL=batching.d.ts.map
\No newline at end of file