openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.49 kB
JavaScript
import{s as resolveOpenClawStateSqlitePath}from"./openclaw-state-db.paths-BAgG4Sc_.mjs";import{n as cloneEnvWithPlatformSemantics}from"./config-env-vars-DC4WV43c.mjs";import{r as captureOpenClawStateWorkerContext}from"./openclaw-state-worker-context-CKgYzLgM.mjs";import{n as HostedCatalogSignedFeedMonotonicityError}from"./official-external-plugin-catalog-source-nSZUCd66.mjs";
//!src/plugins/official-external-plugin-catalog-snapshot-store.ts
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)}}function createSqliteHostedOfficialExternalPluginCatalogSnapshotStore(e={}){return{async read(t){const n=resolveDatabaseOptions(e);const r=captureOpenClawStateWorkerContext(n);const{runOpenClawStateWorkerOperation:i}=await import(`./openclaw-state-worker-store-D6m81neC.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-D6m81neC.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)}}}export{createSqliteHostedOfficialExternalPluginCatalogSnapshotStore};