/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { type Bytes, type CloneableStorage, type DataNamespace, FilesystemStorageDriver, type StorageDriver, StorageTransaction, type SupportedStorageTypes } from "@matter/general";
import type { DatabaseCreator, SafeUint8Array } from "./SqliteTypes.js";
import { SqliteTransaction as Transaction } from "./SqliteTypes.js";
/**
 * Type of Key-Value store table
 *
 * T means JSON or BLOB type
 */
type KVStoreType<T extends string | SafeUint8Array = string | SafeUint8Array> = {
    context: string;
    key: string;
    value_type: T extends string ? "json" : "blob";
    value_json: T extends string ? string : null;
    value_blob: T extends SafeUint8Array ? SafeUint8Array : null;
};
/**
 * SQLite implementation of `FileStorageDriver.ts`
 *
 * `DatabaseCreator` is need to use (sqlite).
 *
 * Supports `node:sqlite`, `bun:sqlite`. (maybe also `better-sqlite3` support)
 */
export declare class SqliteStorageDriver extends FilesystemStorageDriver implements CloneableStorage {
    #private;
    static readonly id = "sqlite";
    static readonly memoryPath = ":memory:";
    static readonly defaultTableName = "kvstore";
    /**
     * Create a SqliteStorageDriver for the given namespace using the platform-appropriate database.
     */
    static create(namespace: DataNamespace): Promise<SqliteStorageDriver>;
    protected isInitialized: boolean;
    protected readonly dbPath: string;
    protected readonly tableName: string;
    protected readonly clearOnInit: boolean;
    /**
     * Create sqlite-based disk storage.
     *
     * @param args.databaseCreator Optional database instance creator.  If omitted, resolved automatically during
     *   {@link initialize} via platform detection.
     * @param args.namespaceOrPath DataNamespace (derives path from root directory), string (direct path), or
     *   null/undefined for in-memory database
     * @param args.clear Clear on init
     * @param args.tableName table name
     */
    constructor(args?: {
        databaseCreator?: DatabaseCreator;
        namespaceOrPath?: DataNamespace | string | null;
        tableName?: string;
        clear?: boolean;
    });
    /**
     * Manual transaction control
     *
     * Use this for explicit transaction management across multiple operations.
     * Internal methods like `set()` will automatically detect and use external transactions.
     *
     * TODO: Sync transaction to native matter.js API
     */
    transaction(mode: Transaction): void;
    protected withAnyTransaction<T>(callback: () => T): T;
    get initialized(): boolean;
    initialize(): Promise<void>;
    clone(): StorageDriver;
    close(): Promise<void>;
    get<T extends SupportedStorageTypes>(contexts: string[], key: string): T | null | undefined;
    protected getRawAll(): KVStoreType<string | SafeUint8Array>[];
    set(contexts: string[], key: string, value: SupportedStorageTypes): void;
    set(contexts: string[], values: Record<string, SupportedStorageTypes>): void;
    /**
     * Set [contexts, key] to value
     * @param contexts Context
     * @param key Key
     * @param value Value
     * @returns
     */
    protected setValue(contexts: string[], key: string, value: string): void;
    /**
     * Set Raw data. (for copy)
     */
    protected setRaw(rawData: KVStoreType[]): void;
    delete(contexts: string[], key: string): void;
    keys(contexts: string[]): string[];
    values(contexts: string[]): Record<string, SupportedStorageTypes>;
    /**
     * Return sub contexts of context
     * (search nested depth, return 1 depth of them)
     * @param contexts context path
     * @returns sub contexts
     */
    contexts(contexts: string[]): string[];
    clearAll(contexts: string[]): void;
    has(contexts: string[], key: string): boolean;
    openBlob(contexts: string[], key: string): Blob;
    writeBlobFromStream(contexts: string[], key: string, stream: ReadableStream<Bytes>): Promise<void>;
    begin(): StorageTransaction;
}
export {};
//# sourceMappingURL=SqliteStorageDriver.d.ts.map