UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.59 kB
import{t as readBackupEngine}from"../physical-store-Dt80uUi6.mjs";import{a as withDatabasePortPostgres,i as withDatabasePortConnection}from"../port-provider-CdqIxw1H.mjs";import{n as serveWorkerTasks}from"../worker-task-server-BeWxX5OH.mjs";import{c as pruneOrphanedPostgresCaptures,n as preparePostgresRestoreInWorker,o as discardPostgresNamespace,s as fingerprintPostgresDatabase,t as capturePostgresBackupInWorker}from"../database-backup.operations-C3IunZW3.mjs"; //!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`||e.operation===`prune`){const t=readBackupEngine(e.params.sourcePath);if(t.engine!==`postgres`)throw new Error(`PostgreSQL anchor disappeared.`);if(e.operation===`prune`){const{directoryPrefix:n}=e.params;return withDatabasePortConnection(e.params.config,e=>pruneOrphanedPostgresCaptures(e,{storeId:t.storeId,directoryPrefix:n}))}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}))});export{};