UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

44 lines (43 loc) • 1.9 kB
import { s as resolveOpenClawStateSqlitePath } from "./openclaw-state-db.paths-R3ArRCcz.mjs"; import { r as cloneEnvWithPlatformSemantics } from "./config-env-vars-ByeGN-9N.mjs"; import { r as captureOpenClawStateWorkerContext } from "./openclaw-state-worker-context-DAKL_dnZ.mjs"; import { n as HostedCatalogSignedFeedMonotonicityError } from "./official-external-plugin-catalog-source-4o5oPhVN.mjs"; //#region src/plugins/official-external-plugin-catalog-snapshot-store.ts /** Persists hosted official plugin catalog snapshots through the shared-state worker. */ function resolveDatabaseOptions(e) { const t = cloneEnvWithPlatformSemantics(e.env ?? process.env); if (e.stateDir) t.OPENCLAW_STATE_DIR = e.stateDir; return { env: t, path: e.stateDatabasePath || resolveOpenClawStateSqlitePath(t) }; } /** Creates a snapshot store backed by the shared `state/openclaw.sqlite` database. */ function createSqliteHostedOfficialExternalPluginCatalogSnapshotStore(e = {}) { return { async read(t) { const n = resolveDatabaseOptions(e); const r = captureOpenClawStateWorkerContext(n); const { runOpenClawStateWorkerOperation: i } = await import("./openclaw-state-worker-store-BURqchns.mjs"); return await i(r, (e) => e.execute({ type: "plugins.catalogSnapshot.read", input: { url: t } }), { existingOnly: true }) ?? null; }, async write(t) { const n = Date.now(); const r = captureOpenClawStateWorkerContext(resolveDatabaseOptions(e)); const { runOpenClawStateWorkerOperation: i } = await import("./openclaw-state-worker-store-BURqchns.mjs"); const a = await i(r, (e) => e.execute({ type: "plugins.catalogSnapshot.write", input: { snapshot: t, now: n } })); if (!a.ok) throw new HostedCatalogSignedFeedMonotonicityError(a.message); } }; } //#endregion export { createSqliteHostedOfficialExternalPluginCatalogSnapshotStore };