///
///
import { UUID } from "node:crypto";
import { PassThrough, Readable } from "node:stream";
import { JSONObject, KDocumentContentGeneric, KHit, SearchResult, User } from "kuzzle";
import { EngineContent } from "kuzzle-plugin-commons";
import { DeviceManagerPlugin, InternalCollection } from "../../plugin";
export interface ExporterOption {
/**
* Expiration time of export in seconds before being invalid
*/
expireTime: number;
}
export interface ExportParams {
query: JSONObject;
sort?: JSONObject;
lang?: "elasticsearch" | "koncorde";
}
export interface Column {
header: string;
path: string;
isMeasure?: boolean;
isIsoDate?: boolean;
}
export declare abstract class AbstractExporter
{
protected plugin: DeviceManagerPlugin;
protected target: InternalCollection;
protected config: ExporterOption;
constructor(plugin: DeviceManagerPlugin, target: InternalCollection, config?: Partial);
protected get sdk(): import("kuzzle").EmbeddedSDK;
protected get ms(): any;
protected get log(): {
debug: (message: any) => void;
error: (message: any) => void;
info: (message: any) => void;
silly: (message: any) => void;
verbose: (message: any) => void;
warn: (message: any) => void;
};
protected getEngine(engineId: string): Promise;
protected abstract exportRedisKey(engineId: string, exportId: string): string;
protected abstract getLink(engineId: string, exportId: UUID, params: P): string;
/**
* Retrieve a prepared export and write each document as a CSV in the stream
*
* This method never returns a rejected promise, but write potential error in
* the stream.
*/
abstract sendExport(engineId: string, exportId: string): Promise;
prepareExport(engineId: string, user: User, params: P): Promise;
protected formatHit(columns: Column[], hit: KHit): string[];
getExport(engineId: string, exportId: string): Promise;
getExportStream(request: SearchResult>, columns: Column[]): Promise;
}