alinea
Version:
Headless git-based CMS
36 lines (34 loc) • 882 B
JavaScript
import "../../chunks/chunk-NZLE2WMY.js";
// src/dashboard/boot/WorkerDB.ts
import { createId } from "alinea/core/Id";
import { getScope } from "alinea/core/Scope";
import { WriteableGraph } from "alinea/core/db/WriteableGraph";
var WorkerDB = class extends WriteableGraph {
constructor(config, worker, client, events) {
super();
this.config = config;
this.events = events;
this.#worker = worker;
this.#client = client;
}
#worker;
#client;
async mutate(mutations) {
const id = createId();
return { id, sha: await this.#worker.queue(id, mutations) };
}
resolve(query) {
const scope = getScope(this.config);
const body = scope.stringify(query);
return this.#worker.resolve(body);
}
sync() {
return this.#worker.sync();
}
prepareUpload(file) {
return this.#client.prepareUpload(file);
}
};
export {
WorkerDB
};