export type IndexedDbFactory = IDBFactory | undefined;
export type Primitive = string | number | boolean | null | undefined | Date;
export interface DbIndexDefinition {
    columns: string[];
    unique?: boolean;
}
export interface DbStructure {
    keys: Record<string, DbIndexDefinition>;
    fields: Record<string, Record<string, unknown>>;
    version?: number;
}
export interface DbStructures {
    [database: string]: {
        [store: string]: DbStructure;
    };
}
export type WhereObject = Record<string, unknown> | null;
export type OrderClause = unknown;
export type DbCommand = {
    id: number;
    database: string;
    method: string;
    args: unknown[];
};
export interface DbApi {
    lastErr: any;
    get dbName(): string;
    lastError(): unknown;
    close(): void;
    insert(table: string, data: Record<string, unknown> | Record<string, unknown>[]): Promise<number>;
    update(table: string, data: Record<string, unknown>, where: WhereObject, replace?: boolean): Promise<number>;
    delete(table: string, where: Record<string, unknown>): Promise<number>;
    selectOne(table: string, field: string, where?: unknown, order?: OrderClause, start?: number, limit?: number): Promise<unknown>;
    select(table: string, fields?: string[], where?: unknown, order?: OrderClause, start?: number): Promise<unknown>;
    selectAll(table: string, fields?: string[], where?: unknown, order?: OrderClause, start?: number, limit?: number | null): Promise<unknown>;
    getColumnValues(table: string, field: string, where?: unknown, order?: OrderClause, start?: number, limit?: number | null): Promise<unknown>;
    count(table: string, where?: unknown): Promise<number>;
    copyTable(target: string, table: string, fields?: string[], where?: unknown, order?: OrderClause, start?: number, limit?: number | null): Promise<number>;
    deleteTable(table: string): Promise<boolean>;
}
export interface DbManager {
    ok: boolean;
    open(name: string, version?: number): Promise<DbApi>;
    add(database: string, name: string, structure: DbStructure): Promise<boolean>;
    remove(database: string, name: string): Promise<void>;
    importStructure(database: string, structure: Record<string, DbStructure>): Promise<void>;
    close(database: string): void;
}
export interface DbManagerInternal extends DbManager {
    _structures: DbStructures;
    _connections: Record<string, IDBDatabase>;
    _objects: Record<string, DbApi>;
    _stores: Record<string, unknown>;
    updateStructure(storeName: string, structure: DbStructure, database: IDBDatabase): void;
    reopenWithUpgrade(name: string): Promise<DbApi>;
    getExistingVersion(name: string): Promise<number>;
}
