openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.66 kB
JavaScript
import{xt as e}from"./openclaw-state-read-subsystem-Dwoo5bcz.mjs";import{o as t,v as n}from"./openclaw-state-read-sqlite-database-admission-CrkztOzk.mjs";import{a as r,i}from"./openclaw-state-read-kysely-sync-Bcu0Qb7F.mjs";import{o as a}from"./openclaw-state-read-openclaw-state-db-schema-helpers-QFZd8aJI.mjs";import{isMainThread as o}from"node:worker_threads";const s={name:`auth-profiles.rows`,read:t=>e(t)?t:void 0};function publishAuthProfileRowsChanged(e){n(e,s,{})}const c={name:`model-catalog.remote`,read:t=>e(t)?t:void 0},l={name:`state.tts-prefs-path`,read(t){if(!e(t))return;let n=t.row;if(n===void 0)return{row:void 0};if(e(n)&&typeof n.value_json==`string`&&typeof n.updated_at_ms==`number`)return{row:{value_json:n.value_json,updated_at_ms:n.updated_at_ms}}}};function publishConfigMachineStateRow(e,t,r){t===`tts.prefsPath`?n(e,l,{row:r}):t===`authProfiles.store`||t===`authProfiles.state`?publishAuthProfileRowsChanged(e):(t===`modelCatalog.remote.v3`||t===`modelCatalog.remote.v2`||t===`modelCatalog.remote`)&&n(e,c,{})}function normalizeConfigMachineStateKey(e){let t=e.trim();if(!t)throw Error(`config machine state key must not be empty`);return t}function readConfigMachineStateRowInDatabase(e,n){let s=normalizeConfigMachineStateKey(n),c=s===`tts.prefsPath`?t(e,l):void 0;if(c)return c.row;if(!a(e,`config_machine_state`))return;let u=r(e),d=i(e,u.selectFrom(`config_machine_state`).select([`value_json`,`updated_at_ms`]).where(`state_key`,`=`,s));return o&&s===`tts.prefsPath`&&publishConfigMachineStateRow(e,s,d),d}export{publishConfigMachineStateRow as n,readConfigMachineStateRowInDatabase as r,normalizeConfigMachineStateKey as t};