diff --git a/package.json b/package.json index 5e28fd8..f38b7ea 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "unstorage": "^1.17.4" }, "devDependencies": { - "@kevisual/api": "^0.0.55", + "@kevisual/api": "^0.0.57", "@kevisual/cnb": "^0.0.28", "@kevisual/dts": "^0.0.4", "@kevisual/load": "^0.0.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3776c3f..d467da3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,8 +58,8 @@ importers: version: 1.17.4(idb-keyval@6.2.2)(ioredis@5.9.3(supports-color@10.2.2)) devDependencies: '@kevisual/api': - specifier: ^0.0.55 - version: 0.0.55(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4) + specifier: ^0.0.57 + version: 0.0.57(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4) '@kevisual/cnb': specifier: ^0.0.28 version: 0.0.28(dotenv@17.3.1)(idb-keyval@6.2.2)(ioredis@5.9.3) @@ -1290,9 +1290,6 @@ packages: '@kevisual/api@0.0.28': resolution: {integrity: sha512-WQluRlu2qGM1qktIhPLODie8x382a6jEMfFOcay/rnkCgXK0BRpnqOKwlX7IMLdMqka7GY/BD69kSMnK1Exf5g==} - '@kevisual/api@0.0.55': - resolution: {integrity: sha512-ylWpX12tzAULuvxJHhvt7N21SmVOiIV2eVbKSdJ51soo9XO2J7rGNrLcczQ1vPdaSHzCq+9RlAUyd0ogleGJCA==} - '@kevisual/api@0.0.57': resolution: {integrity: sha512-U2nz+ckWZ4XGASC08xJT6WKQajhFQDd1iDb9tU1dHZECsvNvIzpHLG7RHFN1vahG1MdbQtppPmHgVTF2Zw7RWg==} @@ -6612,27 +6609,6 @@ snapshots: fuse.js: 7.1.0 nanoid: 5.1.6 - '@kevisual/api@0.0.55(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)': - dependencies: - '@kevisual/context': 0.0.8 - '@kevisual/js-filter': 0.0.5 - '@kevisual/load': 0.0.6 - '@paralleldrive/cuid2': 3.3.0 - es-toolkit: 1.44.0 - eventemitter3: 5.0.4 - fuse.js: 7.1.0 - nanoid: 5.1.6 - path-browserify-esm: 1.0.6 - sonner: 2.0.7(react-dom@19.2.4(react@19.2.4))(react@19.2.4) - spark-md5: 3.0.2 - zustand: 5.0.11(@types/react@19.2.10)(react@19.2.4) - transitivePeerDependencies: - - '@types/react' - - immer - - react - - react-dom - - use-sync-external-store - '@kevisual/api@0.0.57(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)': dependencies: '@kevisual/context': 0.0.8 diff --git a/src/command/config-remote.ts b/src/command/config-remote.ts index fea11bd..b3b9414 100644 --- a/src/command/config-remote.ts +++ b/src/command/config-remote.ts @@ -1,6 +1,6 @@ import { program, Command } from '@/program.ts'; import { query } from '@/module/query.ts'; -import { QueryConfig } from '@/query/query-config/query-config.ts'; +import { QueryConfig } from '@kevisual/api/query-config'; import { showMore } from '@/uitls/show-more.ts'; import fs from 'node:fs'; import path from 'node:path'; diff --git a/src/command/config-secret-remote.ts b/src/command/config-secret-remote.ts index 9a34073..1acd0b5 100644 --- a/src/command/config-secret-remote.ts +++ b/src/command/config-secret-remote.ts @@ -1,6 +1,6 @@ import { program, Command } from '@/program.ts'; import { query } from '@/module/query.ts'; -import { QueryConfig } from '@/query/query-secret/query-secret.ts'; +import { QueryConfig } from '@kevisual/api/query-secret'; import { showMore } from '@/uitls/show-more.ts'; import fs from 'node:fs'; import path from 'node:path'; diff --git a/src/index.ts b/src/index.ts index ee55c3b..2d2d9b3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,7 @@ import './command/app/index.ts'; import './command/gist/index.ts'; import './command/config-remote.ts'; import './command/config-secret-remote.ts'; -import './command/ai.ts'; +// import './command/ai.ts'; import './command/coding-plan/cc.ts' import './command/coding-plan/oc.ts' import './command/docker.ts'; diff --git a/src/module/query.ts b/src/module/query.ts index 57f3de9..31547a4 100644 --- a/src/module/query.ts +++ b/src/module/query.ts @@ -4,6 +4,7 @@ import { QueryLoginNode, StorageNode } from '@kevisual/api/login-node'; const config = getConfig(); export const baseURL = config?.baseURL || 'https://kevisual.cn'; export const storage = new StorageNode({ load: true }); + export const getBaseURL = () => { return baseURL; }; diff --git a/src/query/query-config/query-config.ts b/src/query/query-config/query-config.ts deleted file mode 100644 index dab86a8..0000000 --- a/src/query/query-config/query-config.ts +++ /dev/null @@ -1,121 +0,0 @@ -/** - * 配置查询 - * @updatedAt 2025-12-03 10:33:00 - */ -import { Query } from '@kevisual/query'; -import type { Result } from '@kevisual/query/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 const defaultConfigKeys = ['upload.json', 'workspace.json', 'ai.json', 'user.json', 'life.json'] as const; -type DefaultConfigKey = (typeof defaultConfigKeys)[number]; - -export class QueryConfig { - query: Query; - constructor(opts?: QueryConfigOpts) { - this.query = opts?.query || new Query(); - } - async post(data: any) { - return this.query.post({ path: 'config', ...data }); - } - async getConfig({ id, key }: { id?: string; key?: string }, opts?: PostOpts) { - return this.post({ - key: 'get', - data: { - id, - key, - }, - ...opts, - }); - } - async updateConfig(data: Config, opts?: PostOpts) { - return this.post({ - key: 'update', - data, - ...opts, - }); - } - async deleteConfig(data: { id?: string, key?: string }, opts?: PostOpts) { - console.log('Delete Config Params:', data); - return this.post({ - key: 'delete', - data, - }); - } - async listConfig(opts?: PostOpts) { - return this.post<{ list: Config[] }>({ - key: 'list', - ...opts, - }); - } - /** - * 获取上传配置 - * @returns - */ - async getUploadConfig(opts?: PostOpts) { - return this.post>>({ - key: 'getUploadConfig', - ...opts, - }); - } - /** - * 更新上传配置 - * @param data - * @returns - */ - async updateUploadConfig(data: Config, opts?: PostOpts) { - return this.post>>({ - key: 'updateUploadConfig', - data, - ...opts, - }); - } - - /** - * 检测配置是否存在 - * @param id - * @returns - */ - async detectConfig(opts?: PostOpts) { - return this.post<{ updateList: Config[] }>({ - key: 'detect', - ...opts, - }); - } - /** - * 获取配置, 获取默认的配置项 - * @param key - * @returns - */ - async getConfigByKey(key: DefaultConfigKey, opts?: PostOpts) { - return this.post>({ - key: 'defaultConfig', - configKey: key, - ...opts, - }); - } - async getByKey(key: string, opts?: PostOpts) { - return this.post>>({ - key: 'get', - ...opts, - data: { key }, - }); - } -} \ No newline at end of file diff --git a/src/query/query-secret/query-secret.ts b/src/query/query-secret/query-secret.ts deleted file mode 100644 index 237e82e..0000000 --- a/src/query/query-secret/query-secret.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 配置查询 - * @updatedAt 2025-12-03 10:33:00 - */ -import { Query } from '@kevisual/query'; -import type { Result } from '@kevisual/query/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, - }); - } -} \ No newline at end of file