import { ICloseableConnection } from "@intelligentgraphics/igd.core";
export interface IConnection {
    [key: string]: any;
}
export interface ConnectionManager {
    /**
     * Ensures the existance of a connection. Callback will only be called, if a connection is not yet registered and not being initialized
     *
     * @template T
     * @param {string} type
     * @param {string} id
     * @param {() => Promise<T>} createConnection
     * @returns {Promise<T>}
     */
    ensureConnection<T extends object | ICloseableConnection>(type: string, id: string, createConnection: () => Promise<T>): Promise<T>;
    /**
     * Registers a connection. Will override registered connection for type and id
     *
     * @param {string} type
     * @param {string} id
     * @param {(object | ICloseableConnection)} connection
     */
    registerConnection(type: string, id: string, connection: object | ICloseableConnection): void;
    /**
     * Retrieves all registered connection ids
     *
     * @param {string} type
     * @returns {string[]}
     */
    getConnectionIds(type: string): string[];
    /**
     * Retrieves the registered connection for type and id
     *
     * @param {string} type
     * @param {string} id
     * @returns {(object | ICloseableConnection)}
     */
    getConnection(type: string, id: string): object | ICloseableConnection;
    /**
     * Closes all connections that implement ICloseableConnection
     *
     * @returns {Promise<void>}
     */
    closeAllConnections(): Promise<void>;
}
