import type { CallbackUserFunction, QueryKey, RawResultData, Sqlite3Method, ScalarUserFunction, Statement, DatabaseInfo, ClientConfig, StatementInput, Transaction, DatabasePath, AggregateUserFunction, ReactiveQuery, SqlTag, TransactionHandle, WindowUserFunction, UserFunction } from './types.js';
import type { BatchMessage, BroadcastMessage, DeleteMessage, DestroyMessage, ExportMessage, FunctionMessage, GetInfoMessage, ImportMessage, OmitQueryKey, OutputMessage, QueryMessage, TransactionMessage, WorkerProxy } from './messages.js';
import { SQLocalProcessor } from './processor.js';
/**
 * This class is your entry point for connecting to and
 * interacting with an on-device SQLite database in the browser.
 * @see {@link https://sqlocal.dev/guide/setup}
 */
export declare class SQLocal {
    protected config: ClientConfig;
    protected clientKey: QueryKey;
    protected processor: SQLocalProcessor | Worker;
    protected isDestroyed: boolean;
    protected bypassMutationLock: boolean;
    protected transactionQueryKeyQueue: QueryKey[];
    protected userCallbacks: Map<string, CallbackUserFunction['func']>;
    protected queriesInProgress: Map<QueryKey, [
        resolve: (message: OutputMessage) => void,
        reject: (error: unknown) => void
    ]>;
    protected proxy: WorkerProxy;
    protected reinitChannel: BroadcastChannel;
    protected effectsChannel?: BroadcastChannel;
    constructor(databasePath: DatabasePath);
    constructor(config: ClientConfig);
    protected processMessageEvent: (event: OutputMessage | MessageEvent<OutputMessage>) => void;
    protected createQuery: (message: OmitQueryKey<QueryMessage | BatchMessage | TransactionMessage | FunctionMessage | GetInfoMessage | ImportMessage | ExportMessage | DeleteMessage | DestroyMessage>) => Promise<OutputMessage>;
    protected broadcast: (message: BroadcastMessage) => void;
    /** @internal */
    exec: (sql: string, params: unknown[], method?: Sqlite3Method, transactionKey?: QueryKey) => Promise<RawResultData>;
    protected execBatch: (statements: Statement[], transactionKey?: QueryKey) => Promise<RawResultData[]>;
    /**
     * Execute SQL queries against the database.
     * @see {@link https://sqlocal.dev/api/sql}
     */
    sql: <Result extends Record<string, any>>(queryTemplate: TemplateStringsArray | string, ...params: unknown[]) => Promise<Result[]>;
    /**
     * Execute a batch of SQL queries against the database in an atomic way.
     * @see {@link https://sqlocal.dev/api/batch}
     */
    batch: <Result extends Record<string, any>>(passStatements: (sql: SqlTag) => Statement[]) => Promise<Result[][]>;
    /** @internal */
    beginTransaction: () => Promise<Transaction>;
    /**
     * Execute SQL transactions against the database.
     * @see {@link https://sqlocal.dev/api/transaction}
     */
    transaction: <Result>(transaction: (tx: TransactionHandle) => Promise<Result>) => Promise<Result>;
    /**
     * Subscribe to a SQL query and receive the latest results
     * whenever the read tables change.
     * @see {@link https://sqlocal.dev/api/reactivequery}
     */
    reactiveQuery: <Result extends Record<string, any>>(passStatement: StatementInput<Result>) => ReactiveQuery<Result>;
    protected createFunction: (fn: UserFunction) => Promise<void>;
    /**
     * Create a SQL function that can be called from queries to
     * trigger a JavaScript callback.
     * @see {@link https://sqlocal.dev/api/createcallbackfunction}
     */
    createCallbackFunction: (funcName: string, func: CallbackUserFunction["func"]) => Promise<void>;
    /**
     * Create a SQL function that can be called from queries to
     * transform column values or to filter rows.
     * @see {@link https://sqlocal.dev/api/createscalarfunction}
     */
    createScalarFunction: (funcName: string, func: ScalarUserFunction["func"]) => Promise<void>;
    /**
     * Create a SQL function that can be called from queries to
     * combine multiple rows into a single result row.
     * @see {@link https://sqlocal.dev/api/createaggregatefunction}
     */
    createAggregateFunction: (funcName: string, func: AggregateUserFunction["func"]) => Promise<void>;
    /**
     * Create a SQL function that can be called from queries to
     * perform calculations for rows using data from related rows.
     * @see {@link https://sqlocal.dev/api/createwindowfunction}
     */
    createWindowFunction: (funcName: string, func: WindowUserFunction["func"]) => Promise<void>;
    /**
     * Retrieve information about the SQLite database file.
     * @see {@link https://sqlocal.dev/api/getdatabaseinfo}
     */
    getDatabaseInfo: () => Promise<DatabaseInfo>;
    /**
     * Access the SQLite database file so that it can be uploaded
     * to the server or allowed to be downloaded by the user.
     * @see {@link https://sqlocal.dev/api/getdatabasefile}
     */
    getDatabaseFile: () => Promise<File>;
    /**
     * Replace the contents of the SQLite database file.
     * @see {@link https://sqlocal.dev/api/overwritedatabasefile}
     */
    overwriteDatabaseFile: (databaseFile: File | Blob | ArrayBuffer | Uint8Array<ArrayBuffer> | ReadableStream<Uint8Array<ArrayBuffer>>, beforeUnlock?: () => void | Promise<void>) => Promise<void>;
    /**
     * Delete the SQLite database file.
     * @see {@link https://sqlocal.dev/api/deletedatabasefile}
     */
    deleteDatabaseFile: (beforeUnlock?: () => void | Promise<void>, destroy?: boolean) => Promise<void>;
    /**
     * Disconnect this SQLocal client from the database and terminate
     * its worker thread.
     * @see {@link https://sqlocal.dev/api/destroy}
     */
    destroy: (skipOptimize?: boolean) => Promise<void>;
    /**
     * Handles cleaning up the SQLocal client with JavaScript
     * Explicit Resource Management (`using`).
     * @internal
     */
    [Symbol.dispose]: () => void;
    /**
     * Handles cleaning up the SQLocal client with JavaScript
     * Explicit Resource Management (`await using`).
     * @internal
     */
    [Symbol.asyncDispose]: () => Promise<void>;
}
