UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

32 lines (31 loc) • 1.52 kB
import { t as readBackupEngine } from "../physical-store-BRXG56Jw.mjs"; import { a as withDatabasePortPostgres, i as withDatabasePortConnection } from "../port-provider-CZISFP-d.mjs"; import { n as serveWorkerTasks } from "../worker-task-server-J1vG-XRl.mjs"; import { n as preparePostgresRestoreInWorker, o as discardPostgresNamespace, s as fingerprintPostgresDatabase, t as capturePostgresBackupInWorker } from "../database-backup.operations-BNuRDpZK.mjs"; //#region src/snapshot/database-backup.worker.ts serveWorkerTasks((e, t, n) => { if (e.operation === "discard") return n.runNativeSection(() => withDatabasePortConnection(e.params.config, async (t) => { for (const r of e.params.namespaces) { n.throwIfCancelled(); await discardPostgresNamespace(t, r); } })); if (e.operation === "fingerprint" || e.operation === "family") { const t = readBackupEngine(e.params.sourcePath); if (t.engine !== "postgres") throw new Error("PostgreSQL anchor disappeared."); if (e.operation === "fingerprint") return withDatabasePortConnection(e.params.config, (e) => fingerprintPostgresDatabase({ client: e, anchor: t })); return withDatabasePortPostgres(e.params.config, t, (e, t) => Promise.resolve(t.id), e.params.pluginOwners); } return n.runNativeSection(() => e.operation === "capture" ? capturePostgresBackupInWorker({ ...e.params, assertCurrent: n.throwIfCancelled }) : preparePostgresRestoreInWorker({ ...e.params, assertCurrent: n.throwIfCancelled })); }); //#endregion export {};