UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.2 kB
import{n as formatSqliteErrorCodeSuffix}from"../sqlite-error-diagnostics-ASl1MXPN.mjs";import{l as OPENCLAW_SQLITE_BUSY_TIMEOUT_MS}from"../openclaw-state-db-contract-G6fQNIi2.mjs"; //!src/state/openclaw-database-verify.worker.ts function formatVerifyError(e){return`${e instanceof Error?`${e.name}: ${e.message}`:String(e)}${formatSqliteErrorCodeSuffix(e)}`}async function verifyOpenClawDatabase(e){const[t,n]=await Promise.all([import(`../sqlite-integrity-CG1gVbL5.mjs`),import(`../sqlite-source-handle-SYluRDsu.mjs`)]);const failed=n=>({path:e.path,ok:false,error:formatVerifyError(n),terminal:n instanceof Error&&t.isTerminalSqliteIntegrityError(n)});let r={path:e.path,ok:true};try{n.withSqliteSourceReadDatabase(e.path,`source`,n=>{try{n.exec(`PRAGMA busy_timeout = ${OPENCLAW_SQLITE_BUSY_TIMEOUT_MS}; BEGIN;`);t.assertSqliteIntegrity(n,e.label,{check:e.check});n.exec(`ROLLBACK;`)}catch(e){r=failed(e)}})}catch(e){if(r.ok)r=failed(e)}return r}if(process.argv[2]===`--openclaw-database-verify-sync`&&process.argv[3]){const e=process.argv[3];verifyOpenClawDatabase({path:e,label:e,check:`full`}).then(e=>{process.exitCode=e.ok?0:1}).catch(()=>{process.exitCode=1})}export{verifyOpenClawDatabase};