UNPKG

kuzzle-sdk

Version:
43 lines (42 loc) 1.19 kB
import { JSONObject } from "../../types"; import { InstrumentablePromise } from "../InstrumentablePromise"; /** * @internal */ export type DocumentsBuffer = { documents: Array<{ _id: string; body: JSONObject; }>; promise: InstrumentablePromise; options: JSONObject; }; /** * Map of index and collections with documents, options and associated promise * * Map<index, Map<collection, DocumentsBuffer>> * * @internal */ export type IndexBuffer = Map<string, Map<string, DocumentsBuffer>>; /** * @internal */ export declare class BatchBuffer { indexes: IndexBuffer; /** * Add a document to the buffer of a specific collection * * @param index Index name * @param collection Collection name * @param body Document content * @param _id Document ID * @param options Option object passed to the m* action * * @returns An object containing the result index in the array of results and a promise resolving to the array of results */ add(index: string, collection: string, body: JSONObject, _id?: string, options?: JSONObject): { idx: number; promise: InstrumentablePromise; }; }