1 | import { Stream, Writable } from 'stream';
|
2 |
|
3 | import { RecordResult } from './record-result';
|
4 | import { Record } from './record';
|
5 |
|
6 | export interface BatchInfo {
|
7 | id: string;
|
8 | jobId: string;
|
9 | state: string;
|
10 | stateMessage: string;
|
11 | numberRecordsProcessed: string;
|
12 | numberRecordsFailed: string;
|
13 | totalProcessingTime: string;
|
14 | }
|
15 |
|
16 | export interface BatchResultInfo {
|
17 | id: string;
|
18 | batchId?: string;
|
19 | jobId?: string;
|
20 | success?: boolean;
|
21 | errors?: string[];
|
22 | }
|
23 |
|
24 | export class Batch extends Writable {
|
25 | check(callback?: (batchInfo: BatchInfo) => void): Promise<BatchInfo>;
|
26 | execute(input?: Record[] | Stream | string, callback?: (err: Error, result: RecordResult[] | BatchResultInfo[]) => void): Batch;
|
27 | poll(interval: number, timeout: number): void;
|
28 | retrieve(callback?: (batchInfo: BatchInfo) => void): Promise<RecordResult[] | BatchResultInfo[]>;
|
29 | then(): Promise<any>;
|
30 | thenAll(callback: (data: any) => void): void;
|
31 | }
|