//! 应用设置 KV API — IPC invoke 封装(localStorage → SQLite 迁移目标) //! //! 后端 4 个 command 读写 `app_settings` 表,value 在 SQLite 里永远是 JSON 字符串。 //! 本层只做透传(不解析 JSON),JSON.parse / JSON.stringify 由 store 层负责。 import { invoke } from '@tauri-apps/api/core' export const settingsApi = { /** 取单个 key 的原始值(JSON 字符串),不存在返回 null */ get(key: string): Promise { return invoke('settings_get', { key }) }, /** 写 key/value(`INSERT OR REPLACE`),成功返回 true */ set(key: string, value: string): Promise { return invoke('settings_set', { key, value }) }, /** 取全部 key/value(启动时一次性拉回恢复偏好) */ getAll(): Promise> { return invoke>('settings_get_all') }, /** 删除单个 key,成功返回 true */ delete(key: string): Promise { return invoke('settings_delete', { key }) }, }