UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.57 kB
import{a as e}from"./sqlite-readonly-sqlite-readonly-location-CKoGOncu.mjs";import{Jn as t,Wn as n,t as r,wt as i}from"./sqlite-readonly-node-sqlite-u3RAlsBE.mjs";import{t as a}from"./sqlite-readonly-usingCtx-03vOGQ3v.mjs";import{g as o,m as s}from"./sqlite-readonly-worker-cpu-COshMrit.mjs";import{n as c}from"./sqlite-readonly-open-Ckj0ooaA.mjs";import{t as l}from"./sqlite-readonly-sqlite-readonly-inspection-C0Nurf6b.mjs";function readBackupEngineImage(e,t){try{var n=a();return readEngineAnchorIdentity(n.u(r(e,{readOnly:!0})),t)}catch(e){n.e=e}finally{n.d()}}function readEngineAnchorIdentity(e,t){let n=c(e);if(!n)return{engine:`sqlite`};let r=n[0];if(n.length!==1||r?.engine!==`postgres`||typeof r.store_id!=`string`||typeof r.schema!=`string`||!/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(r.schema))throw Error(`Invalid PostgreSQL anchor: ${t}. Restore its matched backup.`);return{engine:`postgres`,storeId:r.store_id,namespace:r.schema}}async function readBackupEngineInProcess(e,t=!1){return inspectPhysicalStoreInProcess(e,t,t=>readEngineAnchorIdentity(t,e))}async function inspectPhysicalStoreInProcess(c,u,d){if(!u)try{let e=l(c,d);if(e)return e.value}catch(e){if(!(e instanceof s)&&!(e instanceof o)&&!i(e))throw e}let f=await e(c);return t({release(){if(!f.cleanup())throw new n(`SQLite engine inspection cleanup failed: ${c}`)}},`SQLite engine inspection`,()=>{try{var e=a();return d(e.u(r(f.location,{readOnly:!0})))}catch(t){e.e=t}finally{e.d()}})}export{inspectPhysicalStoreInProcess,readBackupEngineImage,readBackupEngineInProcess,readEngineAnchorIdentity};