import type { ProcessorConfig, UserFunction, QueryKey, ConnectReason, SQLocalDriver } from './types.js'; import type { BatchMessage, ConfigMessage, DeleteMessage, DestroyMessage, ExportMessage, FunctionMessage, GetInfoMessage, ImportMessage, InputMessage, OutputMessage, QueryMessage, TransactionMessage, WorkerProxy } from './messages.js'; import { type Mutex } from './lib/create-mutex.js'; import { type DebouncedFunction } from './lib/debounce.js'; /** * The `SQLocal` client exchanges messages with a paired instance * of `SQLocalProcessor` to interact with databases. * @see {@link https://sqlocal.dev/guide/setup} */ export declare class SQLocalProcessor { protected driver: SQLocalDriver; protected config: ProcessorConfig; protected userFunctions: Map; protected initMutex: Mutex; protected transactionMutex: Mutex; protected transactionKey: QueryKey | null; protected proxy: WorkerProxy; protected dirtyTables: Set; protected effectsChannel?: BroadcastChannel; protected reinitChannel?: BroadcastChannel; /** * After an `InputMessage` has been processed, the resulting * `OutputMessage` is emitted to the function passed to `onmessage`. */ onmessage?: (message: OutputMessage, transfer: Transferable[]) => void; constructor(driver: SQLocalDriver); protected init: (reason: ConnectReason) => Promise; /** * To interact with a database, an `InputMessage` is passed to * `postMessage` for processing. */ postMessage: (event: InputMessage | MessageEvent, _transfer?: Transferable) => Promise; protected emitMessage: (message: OutputMessage, transfer?: Transferable[]) => void; protected emitEffects: () => void; protected emitEffectsDebounced: DebouncedFunction<() => void>; protected editConfig: (message: ConfigMessage) => void; protected exec: (message: QueryMessage | BatchMessage | TransactionMessage) => Promise; protected execInitStatements: () => Promise; protected getDatabaseInfo: (message: GetInfoMessage) => Promise; protected createUserFunction: (message: FunctionMessage) => Promise; protected initUserFunction: (fn: UserFunction) => Promise; protected importDb: (message: ImportMessage) => Promise; protected exportDb: (message: ExportMessage) => Promise; protected deleteDb: (message: DeleteMessage) => Promise; protected destroy: (message?: DestroyMessage) => Promise; }