import { SharedWorkerThread } from "../../bindings/base/SharedWorkerThread.js";
import { HttpClientIdbDatabase } from "./HttpClientIdbDatabase.js";
/**
 * A logic running in the shared worker that accesses datastore for API Client.
 */
export class IdbThread extends SharedWorkerThread {
    constructor() {
        super(...arguments);
        this.store = new HttpClientIdbDatabase();
        this.wsHistory = {
            add: (url) => this.store.wsHistory.add(url),
            query: (query) => this.store.wsHistory.query(query),
            delete: (url) => this.store.wsHistory.delete(url),
            clear: () => this.store.wsHistory.clear(),
        };
        this.urlHistory = {
            add: (url) => this.store.urlHistory.add(url),
            query: (query) => this.store.urlHistory.query(query),
            delete: (url) => this.store.urlHistory.delete(url),
            clear: () => this.store.urlHistory.clear(),
        };
        this.projectUi = {
            clear: (key) => this.store.projectUi.clear(key),
            set: (pid, key, meta) => this.store.projectUi.set(pid, key, meta),
            get: (pid, key) => this.store.projectUi.get(pid, key),
            getBulk: (pid, keys) => this.store.projectUi.getBulk(pid, keys),
            delete: (pid, key) => this.store.projectUi.delete(pid, key),
        };
    }
    async initializeStore() {
        await this.store.initialize();
    }
}
// Probably this should go to a separate file...
const instance = new IdbThread();
instance.initialize();
//# sourceMappingURL=IdbThread.js.map