import type { BlobRef, SyncAuthLeaseIssueRequest, SyncOperation } from '@syncular/core';
import type { CreateSyncularDatabaseOptions, SyncularApplyYjsEnvelopeToPayloadArgs, SyncularApplyYjsTextUpdatesArgs, SyncularApplyYjsTextUpdatesResult, SyncularAuthHeaders, SyncularAuthLeaseRecord, SyncularBlobCacheStats, SyncularBlobEncryptionConfig, SyncularBlobStoreOptions, SyncularBlobUploadQueueProcessOptions, SyncularBlobUploadQueueStats, SyncularBuildYjsTextUpdateArgs, SyncularBuildYjsTextUpdateResult, SyncularClientEventSink, SyncularClientEventType, SyncularConflictResolution, SyncularConflictSummary, SyncularConnectionState, SyncularCrdtDocumentSnapshot, SyncularCrdtFieldCompactionReceipt, SyncularCrdtFieldCompactionRequest, SyncularCrdtFieldDescriptor, SyncularCrdtFieldMaterialization, SyncularCrdtFieldRequest, SyncularCrdtFieldTextRequest, SyncularCrdtFieldWriteReceipt, SyncularCrdtFieldYjsUpdateRequest, SyncularCrdtUpdateLogEntry, SyncularDiagnosticSink, SyncularDiagnosticSnapshot, SyncularEncryptedCrdtConfig, SyncularEncryptionHelperMethod, SyncularFieldEncryptionConfig, SyncularLifecycleState, SyncularLiveQueryDependencyHint, SyncularLiveQueryDiagnostics, SyncularLiveQueryEvent, SyncularLiveQuerySnapshot, SyncularLocalHealthRepairReport, SyncularLocalHealthRepairRequest, SyncularLocalHealthReport, SyncularLocalSupportBundle, SyncularLocalSupportBundleImportReport, SyncularLocalSyncResetReport, SyncularLocalSyncResetRequest, SyncularNetworkStatusSource, SyncularPresenceEntry, SyncularPresenceSink, SyncularRealtimeOptions, SyncularRowsChangedSink, SyncularRuntimeClient, SyncularRuntimeInfo, SyncularSchemaState, SyncularSqlResult, SyncularStorageCompactionOptions, SyncularStorageCompactionReport, SyncularStorageFallbackInfo, SyncularSubscriptionSpec, SyncularSyncRequestOptions, SyncularSyncResult, SyncularTransportStats } from './types';
import type { SyncularWorkerErrorPayload } from './worker-protocol';
export declare function createSyncularWorkerClient(options: CreateSyncularDatabaseOptions): Promise<SyncularWorkerClient>;
export declare function getDefaultSyncularWorkerUrl(): URL;
export declare function createDefaultSyncularWorker(): Worker;
export declare class SyncularWorkerError extends Error {
    readonly code: SyncularWorkerErrorPayload['code'];
    readonly category: SyncularWorkerErrorPayload['category'];
    readonly retryable: boolean;
    readonly recommendedAction: SyncularWorkerErrorPayload['recommendedAction'];
    readonly details: unknown;
    constructor(payload: SyncularWorkerErrorPayload);
}
export declare class SyncularWorkerClient implements SyncularRuntimeClient {
    #private;
    private readonly worker;
    constructor(worker: Worker, options: {
        ownsWorker: boolean;
        requestTimeoutMs?: CreateSyncularDatabaseOptions['requestTimeoutMs'];
        getHeaders?: CreateSyncularDatabaseOptions['getHeaders'];
        authLifecycle?: CreateSyncularDatabaseOptions['authLifecycle'];
        diagnostics?: SyncularDiagnosticSink;
        rowsChangedDebounceMs?: number | false;
        network?: SyncularNetworkStatusSource;
        blobLimits?: CreateSyncularDatabaseOptions['blobLimits'];
    });
    private readonly ownsWorker;
    open(config: CreateSyncularDatabaseOptions['config'], runtime?: CreateSyncularDatabaseOptions['runtime']): Promise<void>;
    setAuthHeaders(headers: SyncularAuthHeaders): Promise<void>;
    issueAuthLease(request: SyncAuthLeaseIssueRequest): Promise<SyncularAuthLeaseRecord>;
    upsertAuthLease(lease: SyncularAuthLeaseRecord): Promise<void>;
    authLease(leaseId: string): Promise<SyncularAuthLeaseRecord | null>;
    activeAuthLeases(actorId?: string | null, nowMs?: number): Promise<SyncularAuthLeaseRecord[]>;
    setFieldEncryption(config: SyncularFieldEncryptionConfig | null): Promise<void>;
    setEncryptedCrdt(config: SyncularEncryptedCrdtConfig | null): Promise<void>;
    setBlobEncryption(config: SyncularBlobEncryptionConfig | null): Promise<void>;
    startRealtime(options?: boolean | SyncularRealtimeOptions): Promise<void>;
    stopRealtime(): Promise<void>;
    setSubscriptions(subscriptions: readonly SyncularSubscriptionSpec[]): Promise<void>;
    forceSubscriptionsBootstrap(subscriptionIds?: readonly string[]): Promise<number>;
    executeSql<Row extends Record<string, unknown> = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<SyncularSqlResult<Row>>;
    executeUnsafeSql<Row extends Record<string, unknown> = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<SyncularSqlResult<Row>>;
    subscribeQuery<Row extends Record<string, unknown> = Record<string, unknown>>(sql: string, params: readonly unknown[], tables: readonly string[], hints?: readonly SyncularLiveQueryDependencyHint[]): Promise<SyncularLiveQuerySnapshot<Row>>;
    unsubscribeQuery(id: string): Promise<void>;
    drainLiveQueryEvents<Row extends Record<string, unknown> = Record<string, unknown>>(): Promise<Array<SyncularLiveQueryEvent<Row>>>;
    liveQueryDiagnostics(): Promise<SyncularLiveQueryDiagnostics>;
    applyMutation(operation: SyncOperation, localRow?: unknown): Promise<string>;
    applyLeasedMutation(operation: SyncOperation, localRow?: unknown): Promise<string>;
    applyMutationsBatch(operations: Array<{
        operation: SyncOperation;
        localRow?: unknown | null;
    }>): Promise<string[]>;
    applyMutationsCommit(operations: Array<{
        operation: SyncOperation;
        localRow?: unknown | null;
    }>): Promise<string>;
    applyLeasedMutationsCommit(operations: Array<{
        operation: SyncOperation;
        localRow?: unknown | null;
    }>): Promise<string>;
    syncPull(options?: SyncularSyncRequestOptions): Promise<SyncularSyncResult>;
    syncPush(options?: SyncularSyncRequestOptions): Promise<SyncularSyncResult>;
    syncOnce(options?: SyncularSyncRequestOptions): Promise<SyncularSyncResult>;
    resumeFromBackground(options?: SyncularSyncRequestOptions): Promise<SyncularSyncResult>;
    transportStats(): Promise<SyncularTransportStats>;
    resetTransportStats(): Promise<void>;
    conflictSummaries(): Promise<SyncularConflictSummary[]>;
    retryConflictKeepLocal(id: string): Promise<string>;
    resolveConflict(id: string, resolution: SyncularConflictResolution): Promise<void>;
    listTable<Row extends Record<string, unknown> = Record<string, unknown>>(table: string): Promise<Row[]>;
    storeBlob(data: Uint8Array, options?: SyncularBlobStoreOptions): Promise<BlobRef>;
    retrieveBlob(ref: BlobRef): Promise<Uint8Array>;
    isBlobLocal(hash: string): Promise<boolean>;
    processBlobUploadQueue(options?: SyncularBlobUploadQueueProcessOptions): Promise<{
        uploaded: number;
        failed: number;
    }>;
    blobUploadQueueStats(): Promise<SyncularBlobUploadQueueStats>;
    blobCacheStats(): Promise<SyncularBlobCacheStats>;
    pruneBlobCache(maxBytes?: number): Promise<number>;
    clearBlobCache(): Promise<void>;
    compactStorage(options?: SyncularStorageCompactionOptions): Promise<SyncularStorageCompactionReport>;
    generatedSchemaState(): Promise<SyncularSchemaState>;
    localHealthCheck(): Promise<SyncularLocalHealthReport>;
    exportLocalSupportBundle(): Promise<SyncularLocalSupportBundle>;
    importLocalSupportBundle(bundle: SyncularLocalSupportBundle | string): Promise<SyncularLocalSupportBundleImportReport>;
    repairLocalHealth(request: SyncularLocalHealthRepairRequest): Promise<SyncularLocalHealthRepairReport>;
    resetLocalSyncState(request?: SyncularLocalSyncResetRequest): Promise<SyncularLocalSyncResetReport>;
    buildYjsTextUpdate(args: SyncularBuildYjsTextUpdateArgs): Promise<SyncularBuildYjsTextUpdateResult>;
    applyYjsTextUpdates(args: SyncularApplyYjsTextUpdatesArgs): Promise<SyncularApplyYjsTextUpdatesResult>;
    applyYjsEnvelopeToPayload(args: SyncularApplyYjsEnvelopeToPayloadArgs): Promise<Record<string, unknown>>;
    openCrdtField(request: SyncularCrdtFieldRequest): Promise<SyncularCrdtFieldDescriptor>;
    applyCrdtFieldText(request: SyncularCrdtFieldTextRequest): Promise<SyncularCrdtFieldWriteReceipt>;
    applyCrdtFieldYjsUpdate(request: SyncularCrdtFieldYjsUpdateRequest): Promise<SyncularCrdtFieldWriteReceipt>;
    materializeCrdtField(request: SyncularCrdtFieldRequest): Promise<SyncularCrdtFieldMaterialization>;
    crdtDocumentSnapshot(request: SyncularCrdtFieldRequest): Promise<SyncularCrdtDocumentSnapshot>;
    crdtUpdateLog(request: SyncularCrdtFieldRequest & {
        limit?: number;
    }): Promise<SyncularCrdtUpdateLogEntry[]>;
    snapshotCrdtFieldStateVector(request: SyncularCrdtFieldRequest): Promise<{
        stateVectorBase64: string;
    }>;
    compactCrdtField(request: SyncularCrdtFieldCompactionRequest): Promise<SyncularCrdtFieldCompactionReceipt>;
    encryptionHelper(method: SyncularEncryptionHelperMethod, args?: unknown): Promise<unknown>;
    runtimeInfo(): Promise<SyncularRuntimeInfo>;
    connectionState(): SyncularConnectionState;
    lifecycleState(): SyncularLifecycleState;
    diagnosticSnapshot(): Promise<SyncularDiagnosticSnapshot>;
    setStorageFallback(fallback: SyncularStorageFallbackInfo): void;
    addDiagnosticListener(listener: SyncularDiagnosticSink): () => void;
    addEventListener<T extends SyncularClientEventType>(event: T, listener: SyncularClientEventSink<T>): () => void;
    addRowsChangedListener(listener: SyncularRowsChangedSink): () => void;
    getPresence<TMetadata = Record<string, unknown>>(scopeKey: string): SyncularPresenceEntry<TMetadata>[];
    joinPresence(scopeKey: string, metadata?: Record<string, unknown>): void;
    leavePresence(scopeKey: string): void;
    updatePresenceMetadata(scopeKey: string, metadata: Record<string, unknown>): void;
    addPresenceListener<TMetadata = Record<string, unknown>>(listener: SyncularPresenceSink<TMetadata>): () => void;
    addLiveQueryListener(queryId: string, listener: (event: SyncularLiveQueryEvent<Record<string, unknown>>) => void): void;
    removeLiveQueryListener(queryId: string): void;
    close(): Promise<void>;
}
//# sourceMappingURL=worker-client.d.ts.map