import { StandardError, StandardErrorCallback, StandardPromise } from "../types";
import { IRouterClient } from "./routerClient";
export declare type ListenerFunction<T = any> = (err: StandardError, response: {
    field: string;
    value: T;
}) => void;
export declare type DispatchListenerFunction = (any: any) => void;
export declare type FieldOnlyParam = {
    field: string;
};
export declare type ListenerParam = {
    field: string;
    listener: ListenerFunction;
};
export declare type RemoveListenersType = ListenerParam | ListenerParam[];
export declare type Mappings = Record<string, any>;
export declare type RemoveStoreCallback = (params: {
    store: string;
    global?: boolean;
}, cb?: StandardErrorCallback<boolean>) => StandardPromise<boolean>;
export declare class StoreModel {
    /**
     * @ignore
     */
    routerClient: IRouterClient;
    /**
     * @ignore
     */
    removeStoreCallback: RemoveStoreCallback;
    /**
     * @ignore
     */
    isGlobal: boolean;
    /**
     * @ignore
     */
    values: Record<string, any>;
    /**
     * @ignore
     */
    listeners: Record<string, ListenerFunction[]>;
    /**
     * @ignore
     * @deprecated
     */
    registeredDispatchListeners: DispatchListenerFunction[];
    /**
     * @ignore
     */
    mapping: Mappings;
    /**
     * Prevents multiple listener requests on the same field from being sent to the DistributedStoreService
     * @ignore
     */
    subs: Record<string, boolean>;
    /**
     * @ignore
     */
    name: string;
    /**
     * @ignore
     */
    constructor(params: {
        global?: boolean;
        name: string;
        values?: Record<string, any>;
    }, routerClient: IRouterClient, removeStoreCallback: RemoveStoreCallback);
    /** This is the Flux dispatcher. It can be used dispatch actions across stores. These action are not caught inside of the global store service. For more information, you can read the [Flux documentation](https://facebook.github.io/flux/docs/overview.html).
     *
     * Example:
     * ```
     * store.Dispatcher.register(function(action){
     * 	if(action.actionType === "ACTION1") {
     * 		// Do something with the action here.
     * 	}
     * })
     * ```
     * @ignore
     */
    Dispatcher: {
        register: (fn: (update: any) => void) => void;
        dispatch: (data: any) => void;
    };
    /**
     * @param {*} err
     * @param {*} message
     * @ignore
     */
    handleDispatchedMessages(err: StandardError, message?: {
        data: any;
    }): void;
    /**
     * Set a value in the store. Two events will be triggered with topics of: store and field.
     *
     * ```JavaScript
     * store.setValue({ field:'field1', value:"new value" });
     * ```
     * @param {String} params.field The name of the field where data will be stored
     * @param {String} params.value Value to be stored
     * @param {function} cb callback
     */
    setValue(params: {
        field: string;
        value: any;
    }, cb?: StandardErrorCallback<void>): void;
    /**
     * Handles changes to the store. Will publish from the field that was changed and back.
     * @private Do not call this function directly. It will be converted to private member in a future release
     * @ignore
     */
    publishObjectUpdates(startField: string, mappings: Mappings): void;
    /**
     * Send items that are no longer mapped or had their map change. If a value is remapped we'll send out the new value.
     * @private Do not call this function directly. It will be converted to private member in a future release
     * @ignore
     */
    sendRemovals(removals: string[]): void;
    /**
     * This will set multiple values in the store.
     *
     * ```JavaScript
     * store.setValues([{ field:'field1', value:"new value" }]);
     * ```
     * @param {function} cb callback
     * @param {Array<{ field : string, value : any}>} fields An array where each element is like the object below.
     */
    setValues(fields: {
        field: string;
        value: any;
    }[], cb?: StandardErrorCallback<void>): void;
    /**
     * Get a value from the store. If global is not set, we'll check local first then we'll check global. Returns the value of the field. If no callback is given and the value is local, this will run synchronously.
     *
     * Be very careful not to `await` this function as it is not promisified. Use `await getGlobalValue` instead.
     *
     * ```JavaScript
     * store.getValue({ field: 'field1' }, function(err,value){});
     * store.getValue('field1', function(err,value){});
     * ```
     * @param {object|string} params The field where the value is stored.
     * @param {String} params.field The field where the value is stored.
     * @param {StandardCallback} cb Will return the value if found.
     * @returns any Don't use the return statement. Always use the cb.
     */
    getValue<T = any>(params: {
        field: string;
    } | string, cb?: StandardErrorCallback<T>): T | any;
    /**
     * Get the entire store.
     *
     * @param { Function} cb Will return the value if found
     * @returns object | void - The store in key/value form if it's a local store - otherwise void
     * @ignore
     */
    getAll(cb: StandardErrorCallback<Record<string, any>>): any;
    /**
     * Get multiple values from the store. Returns an object of with the fields as keys.If no callback is given and the value is local, this will run synchronously. Returns an object of with the fields as keys.If no callback is given and the value is local, this will run synchronous
     *
     * ```JavaScript
     * store.getValues([{ field:'field1' }, { field:'field2' }], function(err,values){});
     * store.getValues(['field1', 'field2'], function(err,values){});
     * ```
     * @param {Array.<object>|Array.<String>} fields An Array of field objects. If there are no fields provided, or value is null, all values in the store are returned.
     * @param {string} fields.field The field where the value is stored.
     * @param {Function} [cb] Will return the value if found.
     * @returns {Object} - returns an object of with the fields as keys.If no callback is given and the value is local, this will run synchronous
     */
    getValues(fields: {
        field: string;
    }[] | string[], cb?: StandardErrorCallback<any>): any;
    /**
     * Get a single value from a *global* store. This function is promisifed.
     *
     * @param {string} field The field to fetch
     * @param {(err, data) => void} [cb] Optional callback to receive value. `err` will be string if an error occurred. `data` will contain the returned value or be undefined.
     * @return {Promise<{err, data}} `err` will be string if an error occurred. `data` will contain the returned value or be undefined.
     */
    getGlobalValue<T = any>(field: string, cb?: StandardErrorCallback<T>): StandardPromise<T>;
    /**
     * Get values from the global store.
     * @private Do not call this function directly. It will be converted to private member in a future release
     * @ignore
     */
    getGlobalValues(params: {
        field: string;
    }[] | string[] | null, cb?: StandardErrorCallback<Record<string, any>>): void;
    /**
     * Remove a value from the store.
     *
     * ```JavaScript
     * store.removeValue({ field: 'field1' }, function(err,bool){});
     * ```
     * @param {Object | String} params - Either an object (`{ field: string }`) or string
     * @param {String} param.field The name of the field
     * @param {Function} cb returns an error if there is one
     */
    removeValue(params: string | {
        field: string;
    }, cb?: StandardErrorCallback<void>): void;
    /**
     * Removes multiple values from the store.
     *
     * ```JavaScript
     * store.removeValues([{ field: 'field1' }], function(err,bool){});
     * ```
     * @param {Object[] | String[]} params - An Array of field objects
     * @param {String} params.field - The name of the field
     * @param {Function} cb -  returns an error if there is one.
     */
    removeValues(params: string[] | {
        field: string;
    }[], cb: any): any;
    /**
     * Destroys the store.
     * @param {Function} cb Function to be invoked after the store is destroyed.
     */
    destroy(cb?: StandardErrorCallback<boolean>): void;
    /**
     * Adds a subscription for the desired dynamic store changes
     * @ignore
     */
    changeSub(change: string): void;
    /**
     * Add a listener to the store at either the store or field level. If no field is given, the store level is used. You can also listen to nested object (e.g., field1.nestedField).
     *
     * ```JavaScript
     * var myFunction = function(err,data) {
     * }
     * store.addListener({ field:'field1' }, myFunction, cb);
     * ```
     * @param {String} params.field The piece of data that you want to listen on. If this is empty it listens to all changes of the store.
     * @param {Function} fn the function to call when the data changes
     * @param {Function} cb callback to be invoked
     */
    addListener(params: {
        field?: string;
    }, fn: ListenerFunction, cb?: () => void): void;
    /**
     * Add an array of listeners as  objects or strings. If using strings, you must provide a function callback.
     *
     * ```JavaScript
     * var myFunction = function(err,data){
     * }
     * store.addListeners([{
     * 	field: 'field1',
     * 	listener: myFunction
     * },
     * {
     * 	field:'field2',
     * 	listener: myFunction
     * }],
     * null, cb);
     * store.addListeners([{ field: 'field1' },{ field: 'field2', listener: myFunction }], myFunction, cb);
     * store.addListeners(['field1','field2'], myFunction, cb);
     * ```
     * @param {String} params.field The piece of data that you want listen on. If this is empty it listen to all changes of the store.
     * @param {String} params.listener The function to call when the piece of data is modified. If this is empty, fn is used.
     * @param {function} fn The function to call when the piece of data is modified.
     * @param {function} cb callback to be invoked when the listeners are added.
     */
    addListeners(params: {
        field: string;
        listener: ListenerFunction;
    } | {
        field: string;
        listener: ListenerFunction;
    }[] | string[], fn: ListenerFunction, cb?: () => void): void;
    /**
     * Remove a listener from store. If no field is given, we look for a store listener
     * @param {String} params.field - The data field with the listener that you want to remove.
     * @param {function} fn The handler passed into `addListener` or `addListeners`.
     * @param {function} cb returns true if it was successful in removing the listener.
     *
     * ```JavaScript
     * var myFunction = function(err,data){}
     * store.removeListener({ field: 'field1' }, MyFunction, function(bool){});
     * ```
     */
    removeListener(params: {
        field?: string;
    }, fn: ListenerFunction, cb?: StandardErrorCallback<boolean>): void;
    /**
     * Remove an array of listeners from the store
     * @param {String} params.field The data field with the listener that you want to remove.
     * @param {String} params.listener The handler passed into `addListener` or `addListeners`.
     * @param {function} fn The handler passed into `addListener` or `addListeners`.
     * @param {function} cb returns true if it was successful in removing the listener.
     *
     * ```JavaScript
     * var myFunction = function(err,data){}
     * store.removeListeners({ field: 'field1' }, MyFunction, function(bool){});
     * store.removeListeners([{ field: 'field1', listener: MyFunction}], function(bool){});
     * store.removeListeners(['field1'], MyFunction, function(bool){});
     * ```
     */
    removeListeners(params: RemoveListenersType, fn?: ListenerFunction<any>, cb?: StandardErrorCallback<boolean>): void;
    /**
     * Handles all changes coming in from the service.
     * @private Do not call this function directly. It will be converted to private member in a future release
     * @ignore
     */
    handleChanges: (err: StandardError, response: {
        data: {
            store: string;
            storeData: any;
            field: string;
            value: any;
        };
    }) => void;
    /**
     * Trigger any function that is listening for changes
     * @private Do not call this function directly. It will be converted to private member in a future release
     * @ignore
     */
    triggerListeners(listenerKey: string, data: any): void;
}
export default StoreModel;
//# sourceMappingURL=StoreModel.d.ts.map