/// <reference types="node" />
import { MergeInput } from "@alinex/data/lib/merge";
import * as compressor from "./compression";
import * as formatter from "./format";
interface Options {
    /**
     * Proxy <host>:<port> to be used for HTTP/HTTPS.
     */
    proxy?: string;
    /**
     * One of: get, delete, head, options, post, put, patch (default: get)
     */
    httpMethod?: string;
    /**
     * Additional HTTP/HTTPS header to send
     */
    httpHeader?: string[];
    /**
     * Additional data to be send as body within HTTP/HTTPS POST or PUT calls
     */
    httpData?: string;
    /**
     * Ignore response code and also go on if not code 2xx.
     */
    ignoreError?: boolean;
    /**
     * Private Open SSH Key used to access with SFTP protocol.
     */
    privateKey?: Buffer | string;
    /**
     * Passphrase for the private Open SSH Key.
     */
    passphrase?: string;
    /**
     * Maximum number of lines to read for file protocol.
     */
    tail?: number;
    /**
     * Search path for postgres queries
     */
    search?: string;
    /**
     * Compression method to use (autodetected from URL).
     */
    compression?: compressor.Compression;
    /**
     * Compression level 0 (no compression) to 9 (best compression, default).
     */
    compressionLevel?: number;
    /**
     * File format to be used (autodetected from URL).
     */
    format?: formatter.Format;
    /**
     * Pattern for text format to be split into pattern matches (Using named groups) for event logs.
     */
    pattern?: RegExp;
    /**
     * Flag to read the CSV, XLS or XLSX always as with records (only needed with less than 3 columns).
     */
    records?: boolean;
    /**
     * Character to be used as field separator in CSV data.
     */
    delimiter?: string;
    /**
     * Character used to quote field values in CSV data.
     */
    quote?: string;
    /**
     * Use module format in storing as JavaScript, so you can load it using normal require or import.
     */
    module?: boolean;
    /**
     * Define the root element name in formatting as XML.
     */
    rootName?: string;
}
/** Definition for MultiFile loading */
interface DataSource extends MergeInput {
    /** URL to load this structure. */
    source?: string;
    /** Additional settings. */
    options?: Options;
    /** Meta information set on loading. */
    meta?: any;
}
/**
 * DataStore can be used to load, save and access different data structures.
 */
declare class DataStore {
    /**
     * Real content, ready to be used.
     */
    data: any;
    /**
     * Options to be used for load/save and parsing of data formats.
     */
    options: Options;
    private _source;
    private _map;
    private _load;
    private changed;
    /**
     * Initialize a new data store.
     * @param input one or multiple data sources to later be used in load/save
     */
    constructor(...input: DataSource[]);
    /**
     * Create a new data store and load it from single source.
     * @param input one or multiple data sources
     */
    static load(...input: DataSource[]): Promise<DataStore>;
    /**
     * Create a new data store and load it from single source.
     * @param source URL to load
     * @param options options to load source
     */
    static url(source: string, options?: Options): Promise<DataStore>;
    /**
     * Create a new data store with preset data.
     * @param source data structure to be set
     */
    static data(data: any, source?: string): Promise<DataStore>;
    /**
     * Load from persistent storage and parse content.
     * @param input URL or list to read from
     * @return parsed data structure (same like ds.data)
     */
    load(...input: DataSource[]): Promise<any>;
    private multiload;
    /**
     * Reload and parse already existing content again.
     * @param time number of seconds to wait till reload
     * @return flag if reload was done (only if changed)
     */
    reload(time?: number): Promise<boolean>;
    /**
     * Save data structure to persistent store.
     * @param output URL to be stored to
     * @return true after storing
     */
    save(output?: DataSource): Promise<boolean>;
    /**
     * Only parse an olready loaded buffer into data structure.
     * @param uri URL specifying where the data is stored, also used to read the format from if not specified as option
     * @param buffer byte array buffer with the file to be parsed
     * @param options additional settings
     * @return parsed data structure (same like ds.data)
     */
    parse(uri: string, buffer: Buffer | string, options?: Options): Promise<any>;
    /**
     * Only format the data structure to be stored later.
     * @param uri URL specifying where the data is stored, also used to read the format from if not specified as option
     * @param options additional settings
     * @return byte array buffer with the file to be stored
     */
    format(uri: string, options?: Options): Promise<Buffer>;
    /**
     * Get the DataSource list or source URL.
     */
    get source(): DataSource[] | string | undefined;
    /**
     * Set the DataSource list or source URL.
     * @param data URL specifying where the data is/will be stored
     */
    set source(data: DataSource[] | string | undefined);
    /**
     * Get meta information from the DataSource list or source URL.
     */
    get meta(): any;
    /**
     * Get mapping of data elements to it's sources.
     */
    get map(): any;
    /**
     * Check the given path and return true if this element is defined else false.
     * @param command filter command to select elements
     */
    has(command?: string): boolean;
    /**
     * Get the element at the defined path.
     * @param command filter command to select elements
     * @param fallback default value to be used if not found
     */
    get(command?: string, fallback?: any): any;
    /**
     * Like get but return the result as new DataStore.
     * @param command filter command to select elements
     * @param fallback default value to be used if not found
     */
    filter(command?: string, fallback?: any): DataStore;
    /**
     * Set the value of an element by path specification.
     * @param path full way to the selected element in the data structure
     * @param value new content to be set
     * @param doNotReplace if set to true, only set if it is currently not set
     * @return value before or undefined if nothing was set
     */
    set(path: string | number, value: any, doNotReplace?: boolean): any;
    /**
     * Insert elements into array.
     * @param path full way to the selected element in the data structure
     * @param value content to be added
     * @param pos position in the array (0=first, 9999=last, -1=before last)
     */
    insert(path: string | number, value: any, pos?: number): void;
    /**
     * Add element to the end of the array.
     * @param path full way to the selected element in the data structure
     * @param values content to be added
     */
    push(path: string | number, ...values: any[]): void;
    /**
     * Keep the specified element but make it an empty array or object.
     * @param path full way to the selected element in the data structure
     * @return the value which was deleted
     */
    empty(path: string | number): any;
    /**
     * Removes a element from the data structure, it will be undefined afterwards.
     * @param path full way to the selected element in the data structure
     * @return the value which was deleted
     */
    delete(path: string | number): any;
}
declare const formats: string[];
declare const compressions: string[];
export { DataStore, formats, compressions, DataSource, Options };
export default DataStore;
//# sourceMappingURL=index.d.ts.map