/** * 配置查询 * @updatedAt 2025-12-03 10:33:00 */ import { Query } from '@kevisual/query'; type QueryConfigOpts = { query?: Query; }; export type Config = { id?: string; title?: string; key?: string; description?: string; data?: T; createdAt?: string; updatedAt?: string; }; export type UploadConfig = { key?: string; version?: string; }; type PostOpts = { token?: string; payload?: Record; }; export class QueryConfig { query: Query; constructor(opts?: QueryConfigOpts) { this.query = opts?.query || new Query(); } async post(data: any) { return this.query.post({ path: 'secret', ...data }); } async getItem({ id, key }: { id?: string; key?: string }, opts?: PostOpts) { return this.post({ key: 'get', data: { id, key, }, ...opts, }); } async updateItem(data: Config, opts?: PostOpts) { return this.post({ key: 'update', data, ...opts, }); } async deleteItem(data: { id?: string, key?: string }, opts?: PostOpts) { return this.post({ key: 'delete', data, }); } async listItems(opts?: PostOpts) { return this.post<{ list: Config[] }>({ key: 'list', ...opts, }); } }