openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
48 lines (47 loc) • 1.85 kB
JavaScript
import { t as listDatabaseEngineStores } from "../registry-Dd7FIY0t.mjs";
import { a as withDatabaseEngineSelection } from "../context-DE59wyBs.mjs";
import { p as resolvePluginMetadataSnapshot } from "../plugin-metadata-snapshot-By9ySblt.mjs";
import { n as resolveDatabaseEngineSelection } from "../config-1gpCgiFx.mjs";
import { n as statePortProvider } from "../state-port-CH03zZ8f.mjs";
import { n as serveWorkerTasks } from "../worker-task-server-J1vG-XRl.mjs";
import { t as resolveActivatedPluginBackupInventory } from "../manifest-backup-resources-8yQB3nRq.mjs";
import { r as discoverBackupDatabasePaths } from "../backup-sqlite-snapshot-D5T0ii_w.mjs";
import path from "node:path";
//#region src/infra/backup-database-discovery.worker.ts
serveWorkerTasks(async (e) => {
const t = await resolveDatabaseEngineSelection(e.config, {
...process.env,
...e.env
});
return withDatabaseEngineSelection(t, async () => {
const t = await discoverBackupDatabasePaths(e);
const n = resolvePluginMetadataSnapshot(e);
const r = new Set(listDatabaseEngineStores().filter((e) => e.postgres).map((e) => e.id));
const i = Object.fromEntries(n.plugins.map(({ id: e, rootDir: t, source: n, origin: r }) => [e, {
id: e,
rootDir: t,
source: n,
origin: r
}]));
return {
paths: t,
resources: n.plugins.flatMap((t) => (t.backupResources ?? []).flatMap((n) => {
const i = n.databaseFamily ?? t.id;
return n.scope === "state" && n.disposition === "include" && r.has(i) ? [{
path: path.resolve(e.stateDir, n.relativePath),
family: i,
pluginId: t.id
}] : [];
})),
stateRoots: await statePortProvider.resolveRoots({
...e,
env: e.env ?? process.env,
plugins: n
}),
pluginOwners: i,
pluginInventory: resolveActivatedPluginBackupInventory(e)
};
});
});
//#endregion
export {};