/** * SQLite 配置持久化层 * * 职责: * 1. 以单行 JSON 存储全量配置(settings 表 id=1) * 2. 提供 get/set/merge 三个同步接口,供 config.ts 调用 * 3. 首次启动时若无 DB 则返回空对象,由 config.ts 决定是否迁移 .env */ import type { BridgeSettings, WeixinAccountRow, DingtalkAccountRow } from './config-store-types.js'; declare class ConfigStore { private db; private readonly dbPath; constructor(); private initSchema; /** 读取全量配置,若数据库为空则返回 {} */ get(): BridgeSettings; /** 全量覆盖写入 */ set(settings: BridgeSettings): void; /** 部分合并写入(patch 语义) */ merge(partial: Partial): void; /** 判断是否已完成 .env 迁移 */ isMigrated(): boolean; /** 标记迁移完成 */ markMigrated(): void; /** 是否已完成或跳过首次安装引导 */ isOnboardingCompleted(): boolean; /** 设置引导完成标记(true=完成或跳过;false=重置以便重新展示) */ setOnboardingCompleted(completed: boolean): void; getDbPath(): string; /** 微信账号行类型 */ getWeixinAccounts(): WeixinAccountRow[]; getWeixinAccount(accountId: string): WeixinAccountRow | undefined; upsertWeixinAccount(params: { accountId: string; userId?: string; baseUrl?: string; cdnBaseUrl?: string; token: string; name?: string; enabled?: boolean; }): void; deleteWeixinAccount(accountId: string): boolean; setWeixinAccountEnabled(accountId: string, enabled: boolean): void; getWeixinContextToken(accountId: string, peerUserId: string): string | null; upsertWeixinContextToken(accountId: string, peerUserId: string, contextToken: string): void; getWeixinPollOffset(accountId: string): string; setWeixinPollOffset(accountId: string, offsetBuf: string): void; /** 获取所有钉钉账号 */ getDingtalkAccounts(): DingtalkAccountRow[]; /** 获取单个钉钉账号 */ getDingtalkAccount(accountId: string): DingtalkAccountRow | undefined; /** 插入或更新钉钉账号 */ upsertDingtalkAccount(params: { accountId: string; clientId: string; clientSecret: string; name?: string; enabled?: boolean; endpoint?: string; }): void; /** 删除钉钉账号 */ deleteDingtalkAccount(accountId: string): boolean; /** 设置钉钉账号启用状态 */ setDingtalkAccountEnabled(accountId: string, enabled: boolean): void; /** 获取缓存的 session webhook */ getDingtalkSessionWebhook(accountId: string, conversationId: string): { webhook: string; expiredTime: number; } | null; /** 缓存 session webhook */ upsertDingtalkSessionWebhook(accountId: string, conversationId: string, webhook: string, expiredTime: number): void; } export declare const configStore: ConfigStore; export type { BridgeSettings, WeixinAccountRow, DingtalkAccountRow } from './config-store-types.js'; //# sourceMappingURL=config-store.d.ts.map