openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.99 kB
JavaScript
import{Kt as e,dt as t,m as n,n as r}from"./openclaw-state-read-sqlite-database-admission-CrkztOzk.mjs";import{u as i}from"./openclaw-state-read-kysely-sync-cache-state-C7JSbWq6.mjs";import{r as a}from"./openclaw-state-read-sqlite-busy-timeout-B0rAL9T0.mjs";import{a as o}from"./openclaw-state-read-sqlite-reader-lifecycle-CcWh6s9c.mjs";import{g as s}from"./openclaw-state-read-sqlite-schema-facts-Dtolu7-X.mjs";import c from"node:path";import{pathToFileURL as l}from"node:url";let u=!1;function resolveSqliteFilesystemPath(e){return process.platform===`win32`?c.toNamespacedPath(c.resolve(e)):e}function resolveNodeSqliteLocation(e){return e===``||e===`:memory:`||e.startsWith(`file:`)?e:resolveSqliteFilesystemPath(e)}function resolveSqliteFileUriPath(e,t){if(t===`win32`){let t=c.win32.toNamespacedPath(c.win32.resolve(e));return`file:${encodeURIComponent(t)}`}return l(c.resolve(e)).href}function resolveReadOnlyShmSqliteFileUri(e,t=process.platform){return`${resolveSqliteFileUriPath(e,t)}?mode=ro&readonly_shm=1`}function resolveExistingSqliteFileUri(e,t=process.platform){return`${resolveSqliteFileUriPath(e,t)}?mode=rw`}function resolveImmutableSqliteFileUri(e,t=process.platform){return`${resolveSqliteFileUriPath(e,t)}?mode=ro&immutable=1`}function openNodeSqliteDatabase(c,l){let d=t(),f=resolveNodeSqliteLocation(c),p=l?.open===!1?void 0:n(f,{create:l?.readOnly!==!0}),m=new d.DatabaseSync(f,l??{});if(m.isOpen)try{r(m,p)}catch(e){throw m.close(),e}return m.open=()=>{let e=n(f,{create:l?.readOnly!==!0});d.DatabaseSync.prototype.open.call(m);try{r(m,e)}catch(e){throw m.close(),e}},s(m,{DatabaseSync:d.DatabaseSync,StatementSync:d.StatementSync},l?.readOnly!==!0),m.isOpen&&l?.timeout!==void 0&&a(m,Math.max(0,l.timeout)),e().explicitSqliteCloseReleasesNativeResources||i(m,()=>{u=!0}),o(m),m}export{resolveReadOnlyShmSqliteFileUri as a,resolveImmutableSqliteFileUri as i,openNodeSqliteDatabase as n,resolveSqliteFilesystemPath as o,resolveExistingSqliteFileUri as r,u as t};