import { ILogger } from '@powersync/common'; import { ConcurrentSqliteConnection } from './ConcurrentConnection.js'; import { RawQueryResult } from './RawSqliteConnection.js'; export interface DatabaseServerOptions { inner: ConcurrentSqliteConnection; onClose: () => void; logger: ILogger; } /** * Access to a WA-sqlite connection that can be shared with multiple clients sending queries over an RPC protocol built * with the Comlink package. */ export declare class DatabaseServer { #private; constructor(options: DatabaseServerOptions); /** * Called by clients when they wish to connect to this database. * * @param lockName A lock that is currently held by the client. When the lock is returned, we know the client is gone * and that we need to clean up resources. */ connect(lockName?: string): Promise; forceClose(): Promise; } export interface ClientConnectionView { close(): Promise; /** * Only used for testing purposes. */ debugIsAutoCommit(): Promise; /** * Requests exclusive access to this database connection. * * Returns a token that can be used with the query methods. It must be returned with {@link completeAccess} to * give other clients access to the database afterwards. */ requestAccess(write: boolean, timeoutMs?: number): Promise; execute(token: string, sql: string, params: any[] | undefined): Promise; executeBatch(token: string, sql: string, params: any[][]): Promise; completeAccess(token: string): Promise; /** * Sends update notifications to the given message port. * * Update notifications are posted as a `string[]` message. */ setUpdateListener(listener: MessagePort): Promise; }