From 4b16ec84996f3f392ace6f9c37cf4aa116d79e79 Mon Sep 17 00:00:00 2001 From: xion Date: Sat, 22 Mar 2025 00:52:58 +0800 Subject: [PATCH] feat: add query-login --- .gitmodules | 3 + package.json | 9 +- pnpm-lock.yaml | 534 +++++++++++++++++++++---- pnpm-workspace.yaml | 2 + src/command/app/front-app/index.ts | 2 +- src/command/app/index.ts | 1 - src/command/app/micro-app/index.ts | 122 ------ src/command/deploy.ts | 8 +- src/command/login.ts | 101 +---- src/command/ls-token.ts | 44 +- src/command/npm.ts | 3 +- src/module/login/login-by-web.ts | 61 +-- src/module/query.ts | 25 +- src/route/system-config/cache-token.ts | 208 ---------- src/route/system-config/index.ts | 3 +- src/scripts/system-config.ts | 53 --- submodules/kevisual-query-login | 1 + 17 files changed, 530 insertions(+), 650 deletions(-) create mode 100644 .gitmodules create mode 100644 pnpm-workspace.yaml delete mode 100644 src/command/app/micro-app/index.ts delete mode 100644 src/route/system-config/cache-token.ts delete mode 100644 src/scripts/system-config.ts create mode 160000 submodules/kevisual-query-login diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3034161 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "submodules/kevisual-query-login"] + path = submodules/kevisual-query-login + url = git@git.xiongxiao.me:kevisual/kevisual-query-login.git diff --git a/package.json b/package.json index cf6328d..c4b15b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/envision-cli", - "version": "0.0.32", + "version": "0.0.33", "description": "envision command tools", "main": "dist/app.mjs", "type": "module", @@ -33,7 +33,8 @@ ], "author": "abearxiong", "devDependencies": { - "@kevisual/query": "0.0.9", + "@kevisual/query": "0.0.13", + "@kevisual/query-login": "workspace:*", "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-commonjs": "^28.0.3", "@rollup/plugin-json": "^6.1.0", @@ -42,7 +43,7 @@ "@rollup/plugin-typescript": "^12.1.2", "@types/crypto-js": "^4.2.2", "@types/jsonwebtoken": "^9.0.9", - "@types/node": "^22.13.10", + "@types/node": "^22.13.11", "chalk": "^5.4.1", "commander": "^13.1.0", "fast-glob": "^3.3.3", @@ -52,7 +53,7 @@ "inquirer": "^12.5.0", "rimraf": "^6.0.1", "rollup": "^4.36.0", - "rollup-plugin-dts": "^6.2.0", + "rollup-plugin-dts": "^6.2.1", "rollup-plugin-esbuild": "^6.2.1", "tar": "^7.4.3", "tslib": "^2.8.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac324d2..bda333a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,11 +34,14 @@ importers: version: 5.1.7 vite: specifier: ^6.2.2 - version: 6.2.2(@types/node@22.13.10) + version: 6.2.2(@types/node@22.13.11) devDependencies: '@kevisual/query': - specifier: 0.0.9 - version: 0.0.9(encoding@0.1.13)(ws@8.18.0) + specifier: 0.0.13 + version: 0.0.13(encoding@0.1.13)(ws@8.18.0) + '@kevisual/query-login': + specifier: workspace:* + version: link:submodules/kevisual-query-login '@rollup/plugin-alias': specifier: ^5.1.1 version: 5.1.1(rollup@4.36.0) @@ -64,8 +67,8 @@ importers: specifier: ^9.0.9 version: 9.0.9 '@types/node': - specifier: ^22.13.10 - version: 22.13.10 + specifier: ^22.13.11 + version: 22.13.11 chalk: specifier: ^5.4.1 version: 5.4.1 @@ -86,7 +89,7 @@ importers: version: 7.0.3 inquirer: specifier: ^12.5.0 - version: 12.5.0(@types/node@22.13.10) + version: 12.5.0(@types/node@22.13.11) rimraf: specifier: ^6.0.1 version: 6.0.1 @@ -94,8 +97,8 @@ importers: specifier: ^4.36.0 version: 4.36.0 rollup-plugin-dts: - specifier: ^6.2.0 - version: 6.2.0(rollup@4.36.0)(typescript@5.8.2) + specifier: ^6.2.1 + version: 6.2.1(rollup@4.36.0)(typescript@5.8.2) rollup-plugin-esbuild: specifier: ^6.2.1 version: 6.2.1(esbuild@0.25.0)(rollup@4.36.0) @@ -109,6 +112,25 @@ importers: specifier: ^5.8.2 version: 5.8.2 + submodules/kevisual-query-login: + dependencies: + '@kevisual/cache': + specifier: ^0.0.1 + version: 0.0.1(rollup@4.36.0)(tslib@2.8.1)(typescript@5.8.2) + '@kevisual/query': + specifier: ^0.0.12 + version: 0.0.12(encoding@0.1.13)(ws@8.18.0) + dotenv: + specifier: ^16.4.7 + version: 16.4.7 + devDependencies: + '@types/node': + specifier: ^22.13.11 + version: 22.13.11 + tsup: + specifier: ^8.4.0 + version: 8.4.0(postcss@8.5.3)(typescript@5.8.2) + packages: '@babel/code-frame@7.26.2': @@ -401,14 +423,35 @@ packages: resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} engines: {node: '>=18.0.0'} + '@jridgewell/gen-mapping@0.3.8': + resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==} + engines: {node: '>=6.0.0'} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/set-array@1.2.1': + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + '@jridgewell/trace-mapping@0.3.25': + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + + '@kevisual/cache@0.0.1': + resolution: {integrity: sha512-yjQJ47NdE3smtJahA3UMcEEBU86uI3V93WnQZHTgFP1S1L8iD0Abct1cFWkuPIlsow8uBxbn4z4iN58KrsQlpA==} + '@kevisual/load@0.0.6': resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==} - '@kevisual/query@0.0.9': - resolution: {integrity: sha512-b2rNhORKtyAY1Zo36Qum3JOuxKU76mYQJdWOxxX5+1jJSqv11Pa9RSu3FYWiaSP0+9djrjLg/nECr9sMkJxt8Q==} + '@kevisual/query@0.0.12': + resolution: {integrity: sha512-/1lZJhNCdcNG4a2Nncl55XC/nha5+GZiJPQdP77lufv2dnZfcssA7NHSZ2Ubh0Pm0HWV22IiGfQMiaYl2pkK1Q==} + + '@kevisual/query@0.0.13': + resolution: {integrity: sha512-gSEIDiCvwSaLLAFZv4vam4wSrMsaCuQ3VGjE3kwRwZ8urlVH1TOA+NUO908A22p9m1Iij7Y1Q/JlfSJi2QzuKQ==} '@kevisual/router@0.0.9': resolution: {integrity: sha512-qPyC2GVJ7iOIdJCCKNDsWMAKOQeSJW9HBpL5ZWKHTbi+t4jJBGTzIlXmjKeMHRd0lr/Qq1imQvlkSh4hlrbodA==} @@ -627,8 +670,8 @@ packages: '@types/node@18.19.80': resolution: {integrity: sha512-kEWeMwMeIvxYkeg1gTc01awpwLbfMRZXdIhwRcakd/KlK53jmRC26LqcbIt7fnAQTu5GzlnWmzA3H6+l1u6xxQ==} - '@types/node@22.13.10': - resolution: {integrity: sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==} + '@types/node@22.13.11': + resolution: {integrity: sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -675,6 +718,9 @@ packages: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} + any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + aproba@2.0.0: resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} @@ -714,6 +760,16 @@ packages: buffer@5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + bundle-require@5.1.0: + resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.18' + + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + cacache@15.3.0: resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==} engines: {node: '>= 10'} @@ -729,6 +785,10 @@ packages: chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + chokidar@4.0.3: + resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} + engines: {node: '>= 14.16.0'} + chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} @@ -767,12 +827,20 @@ packages: resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==} engines: {node: '>=18'} + commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + commondir@1.0.1: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + consola@3.4.2: + resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} + engines: {node: ^14.18.0 || >=16.10.0} + console-control-strings@1.1.0: resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} @@ -815,6 +883,10 @@ packages: resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} engines: {node: '>=8'} + dotenv@16.4.7: + resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} + engines: {node: '>=12'} + dottie@2.0.6: resolution: {integrity: sha512-iGCHkfUc5kFekGiqhe8B/mdaurD+lakO9txNnTvKtA6PISrw86LgqHvRzWYPyoE2Ph5aMIrCw9/uko6XHTKCwA==} @@ -904,6 +976,14 @@ packages: picomatch: optional: true + fdir@6.4.3: + resolution: {integrity: sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==} + peerDependencies: + picomatch: ^4 + peerDependenciesMeta: + picomatch: + optional: true + file-uri-to-path@1.0.0: resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} @@ -1028,6 +1108,9 @@ packages: resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} engines: {node: '>=0.10.0'} + idb-keyval@6.2.1: + resolution: {integrity: sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==} + ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} @@ -1112,6 +1195,10 @@ packages: resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==} engines: {node: 20 || >=22} + joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -1128,6 +1215,17 @@ packages: jws@3.2.2: resolution: {integrity: sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==} + lilconfig@3.1.3: + resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==} + engines: {node: '>=14'} + + lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + + load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + lodash.includes@4.3.0: resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} @@ -1149,6 +1247,9 @@ packages: lodash.once@4.1.1: resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==} + lodash.sortby@4.7.0: + resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} + lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} @@ -1277,6 +1378,9 @@ packages: resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} engines: {node: ^18.17.0 || >=20.5.0} + mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + nanoid@3.3.9: resolution: {integrity: sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -1328,6 +1432,10 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} deprecated: This package is no longer supported. + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} @@ -1394,6 +1502,28 @@ packages: resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} engines: {node: '>=12'} + pirates@4.0.6: + resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} + engines: {node: '>= 6'} + + postcss-load-config@6.0.1: + resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==} + engines: {node: '>= 18'} + peerDependencies: + jiti: '>=1.21.0' + postcss: '>=8.0.9' + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + jiti: + optional: true + postcss: + optional: true + tsx: + optional: true + yaml: + optional: true + postcss@8.5.3: resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} engines: {node: ^10 || ^12 || >=14} @@ -1418,6 +1548,10 @@ packages: pump@3.0.2: resolution: {integrity: sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==} + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -1429,6 +1563,14 @@ packages: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} engines: {node: '>= 6'} + readdirp@4.1.2: + resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} + engines: {node: '>= 14.18.0'} + + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + resolve-pkg-maps@1.0.0: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} @@ -1461,8 +1603,8 @@ packages: engines: {node: 20 || >=22} hasBin: true - rollup-plugin-dts@6.2.0: - resolution: {integrity: sha512-iciY+z46mUbN5nCxtJqVynwgrZZljM8of6k8Rg5rVAmu4VHDxexFPgoCa2wrJG5mMsHSGrJmjQPCM4vD0Oe3Lg==} + rollup-plugin-dts@6.2.1: + resolution: {integrity: sha512-sR3CxYUl7i2CHa0O7bA45mCrgADyAQ0tVtGSqi3yvH28M+eg1+g5d7kQ9hLvEz5dorK3XVsH5L2jwHLQf72DzA==} engines: {node: '>=16'} peerDependencies: rollup: ^3.29.4 || ^4 @@ -1582,6 +1724,10 @@ packages: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} + source-map@0.8.0-beta.0: + resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} + engines: {node: '>= 8'} + sprintf-js@1.1.3: resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} @@ -1615,6 +1761,11 @@ packages: resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} engines: {node: '>=0.10.0'} + sucrase@3.35.0: + resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} @@ -1634,6 +1785,20 @@ packages: resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==} engines: {node: '>=18'} + thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + + thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + + tinyglobby@0.2.12: + resolution: {integrity: sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==} + engines: {node: '>=12.0.0'} + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -1648,9 +1813,38 @@ packages: tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + tr46@1.0.1: + resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} + + tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + + ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tsup@8.4.0: + resolution: {integrity: sha512-b+eZbPCjz10fRryaAA7C8xlIHnf8VnsaRqydheLIqwG/Mcpfk8Z5zp3HayX7GaTygkigHl5cBUs+IhcySiIexQ==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7.36.0 + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.5.0' + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + tunnel-agent@0.6.0: resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} @@ -1740,9 +1934,15 @@ packages: webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + webidl-conversions@4.0.2: + resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + whatwg-url@7.1.0: + resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} + which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -1882,27 +2082,27 @@ snapshots: '@gar/promisify@1.1.3': optional: true - '@inquirer/checkbox@4.1.4(@types/node@22.13.10)': + '@inquirer/checkbox@4.1.4(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/type': 3.0.5(@types/node@22.13.11) ansi-escapes: 4.3.2 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/confirm@5.1.8(@types/node@22.13.10)': + '@inquirer/confirm@5.1.8(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) + '@inquirer/type': 3.0.5(@types/node@22.13.11) optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/core@10.1.9(@types/node@22.13.10)': + '@inquirer/core@10.1.9(@types/node@22.13.11)': dependencies: '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/type': 3.0.5(@types/node@22.13.11) ansi-escapes: 4.3.2 cli-width: 4.1.0 mute-stream: 2.0.0 @@ -1910,93 +2110,93 @@ snapshots: wrap-ansi: 6.2.0 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/editor@4.2.9(@types/node@22.13.10)': + '@inquirer/editor@4.2.9(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) + '@inquirer/type': 3.0.5(@types/node@22.13.11) external-editor: 3.1.0 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/expand@4.0.11(@types/node@22.13.10)': + '@inquirer/expand@4.0.11(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) + '@inquirer/type': 3.0.5(@types/node@22.13.11) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 '@inquirer/figures@1.0.11': {} - '@inquirer/input@4.1.8(@types/node@22.13.10)': + '@inquirer/input@4.1.8(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) + '@inquirer/type': 3.0.5(@types/node@22.13.11) optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/number@3.0.11(@types/node@22.13.10)': + '@inquirer/number@3.0.11(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) + '@inquirer/type': 3.0.5(@types/node@22.13.11) optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/password@4.0.11(@types/node@22.13.10)': + '@inquirer/password@4.0.11(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) + '@inquirer/type': 3.0.5(@types/node@22.13.11) ansi-escapes: 4.3.2 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/prompts@7.4.0(@types/node@22.13.10)': + '@inquirer/prompts@7.4.0(@types/node@22.13.11)': dependencies: - '@inquirer/checkbox': 4.1.4(@types/node@22.13.10) - '@inquirer/confirm': 5.1.8(@types/node@22.13.10) - '@inquirer/editor': 4.2.9(@types/node@22.13.10) - '@inquirer/expand': 4.0.11(@types/node@22.13.10) - '@inquirer/input': 4.1.8(@types/node@22.13.10) - '@inquirer/number': 3.0.11(@types/node@22.13.10) - '@inquirer/password': 4.0.11(@types/node@22.13.10) - '@inquirer/rawlist': 4.0.11(@types/node@22.13.10) - '@inquirer/search': 3.0.11(@types/node@22.13.10) - '@inquirer/select': 4.1.0(@types/node@22.13.10) + '@inquirer/checkbox': 4.1.4(@types/node@22.13.11) + '@inquirer/confirm': 5.1.8(@types/node@22.13.11) + '@inquirer/editor': 4.2.9(@types/node@22.13.11) + '@inquirer/expand': 4.0.11(@types/node@22.13.11) + '@inquirer/input': 4.1.8(@types/node@22.13.11) + '@inquirer/number': 3.0.11(@types/node@22.13.11) + '@inquirer/password': 4.0.11(@types/node@22.13.11) + '@inquirer/rawlist': 4.0.11(@types/node@22.13.11) + '@inquirer/search': 3.0.11(@types/node@22.13.11) + '@inquirer/select': 4.1.0(@types/node@22.13.11) optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/rawlist@4.0.11(@types/node@22.13.10)': + '@inquirer/rawlist@4.0.11(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) + '@inquirer/type': 3.0.5(@types/node@22.13.11) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/search@3.0.11(@types/node@22.13.10)': + '@inquirer/search@3.0.11(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/type': 3.0.5(@types/node@22.13.11) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/select@4.1.0(@types/node@22.13.10)': + '@inquirer/select@4.1.0(@types/node@22.13.11)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/type': 3.0.5(@types/node@22.13.11) ansi-escapes: 4.3.2 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 - '@inquirer/type@3.0.5(@types/node@22.13.10)': + '@inquirer/type@3.0.5(@types/node@22.13.11)': optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 '@isaacs/cliui@8.0.2': dependencies: @@ -2011,13 +2211,48 @@ snapshots: dependencies: minipass: 7.1.2 + '@jridgewell/gen-mapping@0.3.8': + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/set-array@1.2.1': {} + '@jridgewell/sourcemap-codec@1.5.0': {} + '@jridgewell/trace-mapping@0.3.25': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + + '@kevisual/cache@0.0.1(rollup@4.36.0)(tslib@2.8.1)(typescript@5.8.2)': + dependencies: + '@rollup/plugin-commonjs': 28.0.3(rollup@4.36.0) + '@rollup/plugin-node-resolve': 16.0.1(rollup@4.36.0) + '@rollup/plugin-typescript': 12.1.2(rollup@4.36.0)(tslib@2.8.1)(typescript@5.8.2) + idb-keyval: 6.2.1 + rollup-plugin-dts: 6.2.1(rollup@4.36.0)(typescript@5.8.2) + transitivePeerDependencies: + - rollup + - tslib + - typescript + '@kevisual/load@0.0.6': dependencies: eventemitter3: 5.0.1 - '@kevisual/query@0.0.9(encoding@0.1.13)(ws@8.18.0)': + '@kevisual/query@0.0.12(encoding@0.1.13)(ws@8.18.0)': + dependencies: + openai: 4.88.0(encoding@0.1.13)(ws@8.18.0) + transitivePeerDependencies: + - encoding + - ws + - zod + + '@kevisual/query@0.0.13(encoding@0.1.13)(ws@8.18.0)': dependencies: openai: 4.88.0(encoding@0.1.13)(ws@8.18.0) transitivePeerDependencies: @@ -2188,24 +2423,24 @@ snapshots: '@types/jsonwebtoken@9.0.9': dependencies: '@types/ms': 0.7.34 - '@types/node': 22.13.10 + '@types/node': 22.13.11 '@types/ms@0.7.34': {} '@types/node-fetch@2.6.12': dependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 form-data: 4.0.2 '@types/node-forge@1.3.11': dependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 '@types/node@18.19.80': dependencies: undici-types: 5.26.5 - '@types/node@22.13.10': + '@types/node@22.13.11': dependencies: undici-types: 6.20.0 @@ -2251,6 +2486,8 @@ snapshots: ansi-styles@6.2.1: {} + any-promise@1.3.0: {} + aproba@2.0.0: optional: true @@ -2297,6 +2534,13 @@ snapshots: base64-js: 1.5.1 ieee754: 1.2.1 + bundle-require@5.1.0(esbuild@0.25.0): + dependencies: + esbuild: 0.25.0 + load-tsconfig: 0.2.5 + + cac@6.7.14: {} + cacache@15.3.0: dependencies: '@npmcli/fs': 1.1.1 @@ -2330,6 +2574,10 @@ snapshots: chardet@0.7.0: {} + chokidar@4.0.3: + dependencies: + readdirp: 4.1.2 + chownr@1.1.4: {} chownr@2.0.0: {} @@ -2356,11 +2604,15 @@ snapshots: commander@13.1.0: {} + commander@4.1.1: {} + commondir@1.0.1: {} concat-map@0.0.1: optional: true + consola@3.4.2: {} + console-control-strings@1.1.0: optional: true @@ -2391,6 +2643,8 @@ snapshots: detect-libc@2.0.3: {} + dotenv@16.4.7: {} + dottie@2.0.6: {} dunder-proto@1.0.1: @@ -2499,6 +2753,10 @@ snapshots: optionalDependencies: picomatch: 4.0.2 + fdir@6.4.3(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 + file-uri-to-path@1.0.0: {} filesize@10.1.6: {} @@ -2659,6 +2917,8 @@ snapshots: safer-buffer: 2.1.2 optional: true + idb-keyval@6.2.1: {} + ieee754@1.2.1: {} ignore@7.0.3: {} @@ -2684,17 +2944,17 @@ snapshots: ini@1.3.8: {} - inquirer@12.5.0(@types/node@22.13.10): + inquirer@12.5.0(@types/node@22.13.11): dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.10) - '@inquirer/prompts': 7.4.0(@types/node@22.13.10) - '@inquirer/type': 3.0.5(@types/node@22.13.10) + '@inquirer/core': 10.1.9(@types/node@22.13.11) + '@inquirer/prompts': 7.4.0(@types/node@22.13.11) + '@inquirer/type': 3.0.5(@types/node@22.13.11) ansi-escapes: 4.3.2 mute-stream: 2.0.0 run-async: 3.0.0 rxjs: 7.8.2 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 ip-address@9.0.5: dependencies: @@ -2737,6 +2997,8 @@ snapshots: dependencies: '@isaacs/cliui': 8.0.2 + joycon@3.1.1: {} + js-tokens@4.0.0: optional: true @@ -2767,6 +3029,12 @@ snapshots: jwa: 1.4.1 safe-buffer: 5.2.1 + lilconfig@3.1.3: {} + + lines-and-columns@1.2.4: {} + + load-tsconfig@0.2.5: {} + lodash.includes@4.3.0: {} lodash.isboolean@3.0.3: {} @@ -2781,6 +3049,8 @@ snapshots: lodash.once@4.1.1: {} + lodash.sortby@4.7.0: {} + lodash@4.17.21: {} lru-cache@10.4.3: {} @@ -2918,6 +3188,12 @@ snapshots: mute-stream@2.0.0: {} + mz@2.7.0: + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + nanoid@3.3.9: {} napi-build-utils@2.0.0: {} @@ -2971,6 +3247,8 @@ snapshots: set-blocking: 2.0.0 optional: true + object-assign@4.1.1: {} + once@1.4.0: dependencies: wrappy: 1.0.2 @@ -3029,6 +3307,14 @@ snapshots: picomatch@4.0.2: {} + pirates@4.0.6: {} + + postcss-load-config@6.0.1(postcss@8.5.3): + dependencies: + lilconfig: 3.1.3 + optionalDependencies: + postcss: 8.5.3 + postcss@8.5.3: dependencies: nanoid: 3.3.9 @@ -3064,6 +3350,8 @@ snapshots: end-of-stream: 1.4.4 once: 1.4.0 + punycode@2.3.1: {} + queue-microtask@1.2.3: {} rc@1.2.8: @@ -3079,6 +3367,10 @@ snapshots: string_decoder: 1.3.0 util-deprecate: 1.0.2 + readdirp@4.1.2: {} + + resolve-from@5.0.0: {} + resolve-pkg-maps@1.0.0: {} resolve@1.22.8: @@ -3108,7 +3400,7 @@ snapshots: glob: 11.0.0 package-json-from-dist: 1.0.1 - rollup-plugin-dts@6.2.0(rollup@4.36.0)(typescript@5.8.2): + rollup-plugin-dts@6.2.1(rollup@4.36.0)(typescript@5.8.2): dependencies: magic-string: 0.30.17 rollup: 4.36.0 @@ -3241,6 +3533,10 @@ snapshots: source-map-js@1.2.1: {} + source-map@0.8.0-beta.0: + dependencies: + whatwg-url: 7.1.0 + sprintf-js@1.1.3: optional: true @@ -3287,6 +3583,16 @@ snapshots: strip-json-comments@2.0.1: {} + sucrase@3.35.0: + dependencies: + '@jridgewell/gen-mapping': 0.3.8 + commander: 4.1.1 + glob: 10.4.5 + lines-and-columns: 1.2.4 + mz: 2.7.0 + pirates: 4.0.6 + ts-interface-checker: 0.1.13 + supports-preserve-symlinks-flag@1.0.0: {} tar-fs@2.1.2: @@ -3322,6 +3628,21 @@ snapshots: mkdirp: 3.0.1 yallist: 5.0.0 + thenify-all@1.6.0: + dependencies: + thenify: 3.3.1 + + thenify@3.3.1: + dependencies: + any-promise: 1.3.0 + + tinyexec@0.3.2: {} + + tinyglobby@0.2.12: + dependencies: + fdir: 6.4.3(picomatch@4.0.2) + picomatch: 4.0.2 + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -3334,8 +3655,43 @@ snapshots: tr46@0.0.3: {} + tr46@1.0.1: + dependencies: + punycode: 2.3.1 + + tree-kill@1.2.2: {} + + ts-interface-checker@0.1.13: {} + tslib@2.8.1: {} + tsup@8.4.0(postcss@8.5.3)(typescript@5.8.2): + dependencies: + bundle-require: 5.1.0(esbuild@0.25.0) + cac: 6.7.14 + chokidar: 4.0.3 + consola: 3.4.2 + debug: 4.4.0 + esbuild: 0.25.0 + joycon: 3.1.1 + picocolors: 1.1.1 + postcss-load-config: 6.0.1(postcss@8.5.3) + resolve-from: 5.0.0 + rollup: 4.36.0 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.12 + tree-kill: 1.2.2 + optionalDependencies: + postcss: 8.5.3 + typescript: 5.8.2 + transitivePeerDependencies: + - jiti + - supports-color + - tsx + - yaml + tunnel-agent@0.6.0: dependencies: safe-buffer: 5.2.1 @@ -3371,24 +3727,32 @@ snapshots: validator@13.12.0: {} - vite@6.2.2(@types/node@22.13.10): + vite@6.2.2(@types/node@22.13.11): dependencies: esbuild: 0.25.0 postcss: 8.5.3 rollup: 4.36.0 optionalDependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 fsevents: 2.3.3 web-streams-polyfill@4.0.0-beta.3: {} webidl-conversions@3.0.1: {} + webidl-conversions@4.0.2: {} + whatwg-url@5.0.0: dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 + whatwg-url@7.1.0: + dependencies: + lodash.sortby: 4.7.0 + tr46: 1.0.1 + webidl-conversions: 4.0.2 + which@2.0.2: dependencies: isexe: 2.0.0 @@ -3400,7 +3764,7 @@ snapshots: wkx@0.5.0: dependencies: - '@types/node': 22.13.10 + '@types/node': 22.13.11 wrap-ansi@6.2.0: dependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..d7cf5d1 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - 'submodules/*' diff --git a/src/command/app/front-app/index.ts b/src/command/app/front-app/index.ts index a517d0b..cdda686 100644 --- a/src/command/app/front-app/index.ts +++ b/src/command/app/front-app/index.ts @@ -32,7 +32,7 @@ const downloadAppCommand = new Command('download') data.id = id; } const res = await queryApp(data); - let registry = 'https://kevisual.xiongxiao.me'; + let registry = 'https://kevisual.cn'; if (options?.registry) { registry = new URL(options.registry).origin; } diff --git a/src/command/app/index.ts b/src/command/app/index.ts index ea045b2..acfa528 100644 --- a/src/command/app/index.ts +++ b/src/command/app/index.ts @@ -1,2 +1 @@ -import './micro-app/index.ts'; import './front-app/index.ts'; diff --git a/src/command/app/micro-app/index.ts b/src/command/app/micro-app/index.ts deleted file mode 100644 index 239ca72..0000000 --- a/src/command/app/micro-app/index.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * 下载 app serve client的包的命令 - */ - -import { chalk } from '@/module/chalk.ts'; -import { program, Command } from '../../../program.ts'; -import fs from 'fs'; -import { Readable } from 'stream'; -import * as tar from 'tar'; -import path from 'path'; -import { fileIsExist } from '@/uitls/file.ts'; - -// Utility function to convert a web ReadableStream to a Node.js Readable stream -function nodeReadableStreamFromWeb(webStream: ReadableStream) { - const reader = webStream.getReader(); - return new Readable({ - async read() { - const { done, value } = await reader.read(); - if (done) { - this.push(null); - } else { - this.push(Buffer.from(value)); - } - }, - }); -} - -export const appCommand = new Command('micro-app').description('micro-app 命令').action(() => { - console.log('micro-app'); -}); - -program.addCommand(appCommand); - -// https://kevisual.xiongxiao.me/api/micro-app/download/file?notNeedToken=y&title=mark-0.0.2.tgz -const downloadAppCommand = new Command('download') - .description('下载 app serve client的包. \nmicro-app download -i mark-0.0.2.tgz -o test/mark.tgz -x test2') - .option('-i, --id ', '下载 app serve client的包, id 或者title, mark-0.0.2.tgz') - .option('-o, --output ', '下载 app serve client的包, 输出路径') - .option('-x, --extract ', '下载 app serve client的包, 解压, 默认解压到当前目录') - .option('-r, --registry ', '下载 app serve client的包, 使用私有源') - .action(async (options) => { - const id = options.id || ''; - if (!id) { - console.error(chalk.red('id is required')); - return; - } - let title = ''; - if (id.includes('.tgz')) { - title = id; - } - let registry = ''; - if (options?.registry) { - registry = new URL(options.registry).origin; - } else { - registry = 'https://kevisual.xiongxiao.me'; - } - let curlUrl = `${registry}/api/micro-app/download/${id}?notNeedToken=y`; - if (title) { - curlUrl = `${registry}/api/micro-app/download/file?notNeedToken=y&title=${title}`; - } - console.log(chalk.blue('下载地址:'), curlUrl); - fetch(curlUrl) - .then(async (res) => { - const contentDisposition = res.headers.get('content-disposition'); - let filename = ''; // Default filename - - if (contentDisposition) { - const match = contentDisposition.match(/filename="?(.+)"?/); - if (match && match[1]) { - filename = match[1].replace(/^"|"$/g, ''); - } - } - if (!filename) { - console.log(chalk.red('下载失败: 没有找到下载文件, 请检查下载地址是否正确,或手动下载')); - return; - } - const outputPath = options.output || filename; - if (!fileIsExist(outputPath)) { - fs.mkdirSync(path.dirname(outputPath), { recursive: true }); - } - const fileStream = fs.createWriteStream(outputPath); - - if (res.body) { - nodeReadableStreamFromWeb(res.body).pipe(fileStream); - - fileStream.on('finish', async () => { - console.log(chalk.green(`下载成功: ${outputPath}`)); - if (options.extract) { - console.log(chalk.green(`解压: ${outputPath}`)); - const extractPath = path.join(process.cwd(), options.extract || '.'); - if (!fileIsExist(extractPath)) { - fs.mkdirSync(extractPath, { recursive: true }); - } - const fileInput = path.join(process.cwd(), outputPath); - tar - .extract({ - file: fileInput, - cwd: extractPath, - }) - .then((res) => { - console.log(chalk.green(`解压成功: ${outputPath}`)); - }) - .catch((err) => { - console.error(chalk.red(`解压失败: ${outputPath}, 请手动解压, tar -xvf ${outputPath}`)); - }); - } - }); - - fileStream.on('error', (err) => { - console.error(chalk.red('文件写入错误:', err)); - fileStream.close(); // Ensure the stream is closed on error - }); - } else { - console.error(chalk.red('下载失败: 无法获取文件流')); - } - }) - .catch((err) => { - console.error(chalk.red('下载请求失败:', err)); - }); - }); - -appCommand.addCommand(downloadAppCommand); diff --git a/src/command/deploy.ts b/src/command/deploy.ts index 41c4a9e..f64fda5 100644 --- a/src/command/deploy.ts +++ b/src/command/deploy.ts @@ -3,13 +3,12 @@ import glob from 'fast-glob'; import path from 'path'; import fs from 'fs'; import FormData from 'form-data'; -import { getBaseURL, query } from '@/module/query.ts'; +import { getBaseURL, query, storage } from '@/module/query.ts'; import { getConfig } from '@/module/index.ts'; import inquirer from 'inquirer'; import { packLib, unpackLib } from './publish.ts'; import chalk from 'chalk'; import { installDeps } from '@/uitls/npm.ts'; - const command = new Command('deploy') .description('把前端文件传到服务器') .argument('', 'Path to the file to be uploaded, filepath or directory') // 定义文件路径参数 @@ -123,10 +122,11 @@ const uploadFiles = async ( if (username) { form.append('username', username); } - return new Promise((resolve) => { + return new Promise(async (resolve) => { const _baseURL = getBaseURL(); const url = new URL(_baseURL); console.log('upload url', url.hostname, url.protocol, url.port); + const token = await storage.getItem('token'); form.submit( { path: '/api/app/upload', @@ -135,7 +135,7 @@ const uploadFiles = async ( port: url.port, method: 'POST', headers: { - Authorization: 'Bearer ' + config.token, + Authorization: 'Bearer ' + token, ...form.getHeaders(), }, }, diff --git a/src/command/login.ts b/src/command/login.ts index 6e2ca7e..f6999c1 100644 --- a/src/command/login.ts +++ b/src/command/login.ts @@ -1,49 +1,12 @@ import { program, Command } from '@/program.ts'; -import { getConfig, writeConfig } from '@/module/get-config.ts'; -import { getBaseURL } from '@/module/query.ts'; -import { queryLogin, queryMe, switchOrg, switchMe } from '@/query/index.ts'; +import { getConfig } from '@/module/get-config.ts'; import inquirer from 'inquirer'; -import { runApp } from '../app-run.ts'; -import { chalk } from '@/module/chalk.ts'; import { loginInCommand } from '@/module/login/login-by-web.ts'; -export const saveToken = async (token: string) => { - const baseURL = getBaseURL(); - const config = getConfig(); - writeConfig({ ...config, token }); - const res = await runApp({ path: 'config', key: 'saveToken', payload: { baseURL, token } }); - if (res.code !== 200) { - console.log('Set token failed', res.message || ''); - } -}; -export const switchToken = async (baseURL: string) => { - const res = await runApp({ path: 'config', key: 'switchToken', payload: { baseURL } }); - if (res.code !== 200 && res.code !== 404) { - console.log('switch token failed', res.message || ''); - } - return res; -}; -export const deleteToken = async (baseURL: string) => { - const res = await runApp({ path: 'config', key: 'deleteToken', payload: { baseURL } }); - if (res.code !== 200) { - console.log('delete token failed', res.message || ''); - } - return res; -}; -export const getTokenList = async () => { - const res = await runApp({ path: 'config', key: 'getTokenList' }); - if (res.code !== 200) { - console.log('get token list failed', res.message || ''); - } - return res; -}; -export const setTokenList = async (data: any[]) => { - const res = await runApp({ path: 'config', key: 'setTokenList', payload: { data } }); - if (res.code !== 200) { - console.log('set token list failed', res.message || ''); - } - return res; -}; -// 定义login命令,支持 `-u` 和 `-p` 参数来输入用户名和密码 +import { queryLogin, storage } from '@/module/query.ts'; + +/** + * 定义login命令,支持 `-u` 和 `-p` 参数来输入用户名和密码 + */ const loginCommand = new Command('login') .description('Login to the application') .option('-u, --username ', 'Specify username') @@ -51,10 +14,9 @@ const loginCommand = new Command('login') .option('-f, --force', 'Force login') .option('-w, --web', 'Login on the web') .action(async (options) => { - const config = getConfig(); let { username, password } = options; if (options.web) { - await loginInCommand(saveToken); + await loginInCommand(); return; } // 如果没有传递参数,则通过交互式输入 @@ -77,7 +39,8 @@ const loginCommand = new Command('login') username = answers.username || username; password = answers.password || password; } - if (config.token) { + const token = storage.getItem('token'); + if (token) { const res = await showMe(false); if (res.code === 200) { const data = res.data; @@ -88,11 +51,11 @@ const loginCommand = new Command('login') } } - const res = await queryLogin(username, password); + const res = await queryLogin.login({ + username, + password, + }); if (res.code === 200) { - const { token } = res.data; - writeConfig({ ...config, token }); - saveToken(token); console.log('welcome', username); } else { console.log('登录失败', res.message || ''); @@ -102,47 +65,19 @@ const loginCommand = new Command('login') program.addCommand(loginCommand); const showMe = async (show = true) => { - const me = await queryMe(); + const me = await queryLogin.getMe(); if (show) { - // save me to config - const meSet = await runApp({ path: 'config', key: 'meSet', payload: { data: me.data } }); - if (me.code === 200) { - console.log('Me', me.data); - } else { - const config = getConfig(); - console.log('Show Me failed', me.message); - writeConfig({ ...config, token: '' }); - } + console.log('Me', me.data); } return me; }; const switchOrgCommand = new Command('switch').argument('', 'Switch to another organization or username').action(async (username) => { - const config = getConfig(); - if (!config.token) { - console.log('Please login first'); - return; - } - const meGet = await runApp({ path: 'config', key: 'meGet' }); - if (meGet.code !== 200) { - console.log('Please login first'); - return; - } - const me = meGet.data?.value || {}; - if (me?.username === username) { - // console.log('Already in', options); - console.log('success switch to', username); - return; - } - const res = await switchOrg(username); + const res = await queryLogin.switchUser(username); if (res.code === 200) { - const token = res.data.token; - writeConfig({ ...config, token }); - console.log(`Switch ${username} Success`); - saveToken(token); - await showMe(); + console.log('success switch to', username); } else { - console.log(`Switch ${username} Failed`, res.message || ''); + console.log('switch to', username, 'failed', res.message || ''); } }); diff --git a/src/command/ls-token.ts b/src/command/ls-token.ts index 2024a5c..c53f64d 100644 --- a/src/command/ls-token.ts +++ b/src/command/ls-token.ts @@ -1,42 +1,19 @@ import { program as app, Command } from '@/program.ts'; -import { getConfig, query, writeConfig } from '@/module/index.ts'; +import { getConfig, writeConfig } from '@/module/index.ts'; +import { queryLogin, storage } from '@/module/query.ts'; import inquirer from 'inquirer'; import util from 'util'; -import { saveToken, switchToken, deleteToken, getTokenList, setTokenList } from './login.ts'; const token = new Command('token').description('show token').action(async () => { - const config = getConfig(); - console.log('token', config.token); + const token = storage.getItem('token'); + console.log('token', token); }); const tokenList = new Command('list') .description('show token list') - .option('-r --remove ', 'remove token by number') + // .option('-r --remove ', 'remove token by number') .action(async (opts) => { - const res = await getTokenList(); - if (res.code !== 200) { - console.error('get token list failed', res.message || ''); - return; - } - console.log(util.inspect(res.data.value, { colors: true, depth: 4 })); - - const list = res.data.value || []; - if (opts.remove) { - const index = Number(opts.remove) - 1; - if (index < 0 || index >= list.length) { - console.log('index out of range'); - return; - } - const removeBase = list.splice(index, 1); - const baseURL = removeBase[0]; - if (baseURL.baseURL) { - const res = await deleteToken(baseURL?.baseURL); - if (res.code !== 200) { - return; - } - } - console.log('delete token success', 'delete', baseURL); - return; - } + const res = queryLogin.cache.cache.cacheData; + console.log(util.inspect(res, { colors: true, depth: 4 })); }); token.addCommand(tokenList); app.addCommand(token); @@ -101,7 +78,7 @@ const baseURL = new Command('baseURL') list = quineList(list); showList(list); writeConfig({ ...config, baseURLList: list }); - removeBase[0] && deleteToken(removeBase[0]); + removeBase[0]; return; } if (opts.set) { @@ -119,7 +96,6 @@ const baseURL = new Command('baseURL') } else { baseURL = opts.set; } - baseURL && switchToken(baseURL); return; } if (opts.list) { @@ -128,12 +104,11 @@ const baseURL = new Command('baseURL') } if (opts.clear) { writeConfig({ ...config, baseURLList: [] }); - setTokenList([]); return; } if (!config.baseURL) { config = getConfig(); - writeConfig({ ...config, baseURL: 'https://kevisual.xiongxiao.me' }); + writeConfig({ ...config, baseURL: 'https://kevisual.cn' }); config = getConfig(); } console.log('current baseURL:', config.baseURL); @@ -159,7 +134,6 @@ const setBaseURL = new Command('set') baseURL = answers.baseURL; } writeConfig({ ...config, baseURL }); - baseURL && switchToken(baseURL); }); baseURL.addCommand(setBaseURL); diff --git a/src/command/npm.ts b/src/command/npm.ts index dc48cea..01ae897 100644 --- a/src/command/npm.ts +++ b/src/command/npm.ts @@ -122,9 +122,8 @@ const npmrc = new Command('set') const npmrcContent = config?.npmrc || `//npm.xiongxiao.me/:_authToken=\${ME_NPM_TOKEN} -@abearxiong:registry=https://npm.pkg.github.com //registry.npmjs.org/:_authToken=\${NPM_TOKEN} -@kevisual:registry=https://npm.xiongxiao.me`; +`; const execPath = process.cwd(); const npmrcPath = path.resolve(execPath, '.npmrc'); let writeFlag = false; diff --git a/src/module/login/login-by-web.ts b/src/module/login/login-by-web.ts index 6ce9a97..b9a41f3 100644 --- a/src/module/login/login-by-web.ts +++ b/src/module/login/login-by-web.ts @@ -1,46 +1,26 @@ import MD5 from 'crypto-js/md5.js'; -import { getBaseURL, query } from '../query.ts'; +import { getBaseURL, queryLogin } from '../query.ts'; import { chalk } from '../chalk.ts'; import jsonwebtoken from 'jsonwebtoken'; import { BaseLoad } from '@kevisual/load'; -import { getConfig, writeConfig } from '../get-config.ts'; type LoginWithWebOptions = {}; export const loginWithWeb = async (opts?: LoginWithWebOptions) => { const baseURL = getBaseURL(); - const randomId = Math.random().toString(36).substring(2, 15); - const timestamp = Date.now(); - const tokenSecret = 'xiao' + randomId; - const sign = MD5(`${tokenSecret}${timestamp}`).toString(); - const token = jsonwebtoken.sign({ randomId, timestamp, sign }, tokenSecret, { - // 10分钟过期 - expiresIn: 60 * 10, // 10分钟 - }); - const config = await getConfig(); - const url = `${baseURL}/api/router?path=user&key=webLogin&p&loginToken=${token}&sign=${sign}&randomId=${randomId}`; - - console.log(chalk.blue(url)); - return { - url, - token, - tokenSecret, - }; + const res = queryLogin.loginWithWeb(baseURL, { MD5, jsonwebtoken }); + console.log(chalk.blue(res.url)); + return res; }; type PollLoginOptions = { tokenSecret: string; - saveToken?: any; }; export const pollLoginStatus = async (token: string, opts: PollLoginOptions) => { const load = new BaseLoad(); load.load( async () => { - const res = await query.post({ - path: 'user', - key: 'checkLoginStatus', - loginToken: token, - }); + const res = await queryLogin.checkLoginStatus(token); return res; }, { @@ -55,36 +35,21 @@ export const pollLoginStatus = async (token: string, opts: PollLoginOptions) => timeout: 60 * 3 * 1000, // 5分钟超时 }); if (res.code === 200 && res.data?.code === 200) { - const data = res.data?.data; try { - const payload = jsonwebtoken.verify(data, opts.tokenSecret) as UserPayload; - type UserPayload = { - userToken: { - token: string; - expireTime: number; - }; - user: { - id: string; - username: string; - }; - }; - const userToken = payload.userToken; - // console.log('token:\n\n', userToken); - console.log(chalk.green('网页登录成功', payload?.user?.username)); - console.log(chalk.green('token:', userToken.token)); - await opts?.saveToken(userToken.token); + console.log(chalk.green('网页登录成功')); return; } catch (error) { console.log(chalk.red('登录失败'), error); + return; } } console.log(chalk.red('登录失败'), res); }; -export const loginInCommand = async (saveToken: any) => { - const { url, token, tokenSecret } = await loginWithWeb(); - await pollLoginStatus(token, { tokenSecret, saveToken }); - return url; +export const loginInCommand = async () => { + const baseURL = getBaseURL(); + const res = queryLogin.loginWithWeb(baseURL, { MD5, jsonwebtoken }); + console.log(chalk.blue(res.url)); + await pollLoginStatus(res.token, { tokenSecret: res.tokenSecret }); + return res.url; }; - -// loginInCommand(); diff --git a/src/module/query.ts b/src/module/query.ts index 51180fc..b1095f0 100644 --- a/src/module/query.ts +++ b/src/module/query.ts @@ -1,7 +1,9 @@ import { Query } from '@kevisual/query/query'; import { getConfig } from './get-config.ts'; +import { QueryLoginNode, storage } from '@kevisual/query-login/node'; const config = getConfig(); -export const baseURL = config?.baseURL || 'https://envision.xiongxiao.me'; +export const baseURL = config?.baseURL || 'https://kevisual.cn'; +export { storage }; export const getBaseURL = () => { if (typeof config?.dev === 'undefined') { return baseURL; @@ -23,10 +25,29 @@ export const query = new Query({ query.beforeRequest = async (config) => { if (config.headers) { - const token = await getConfig()?.token; + const token = await storage.getItem('token'); if (token) { config.headers['Authorization'] = 'Bearer ' + token; } } return config; }; +query.afterResponse = async (response, ctx) => { + if (response.code === 401) { + if (query.stop) { + return { + code: 500, + message: '登录已过期', + }; + } + query.stop = true; + const res = await queryLogin.afterCheck401ToRefreshToken(response, ctx); + query.stop = false; + return res; + } + return response as any; +}; +export const queryLogin = new QueryLoginNode({ + query: query as any, + onLoad: async () => {}, +}); diff --git a/src/route/system-config/cache-token.ts b/src/route/system-config/cache-token.ts deleted file mode 100644 index 60d0623..0000000 --- a/src/route/system-config/cache-token.ts +++ /dev/null @@ -1,208 +0,0 @@ -import { app } from '@/app.ts'; -import { Config } from './model/config.ts'; -import { getConfig, writeConfig } from '@/module/get-config.ts'; -import { queryMe } from '@/query/index.ts'; -const cacheToken = 'tokenList'; -export type TokenCacheItem = { - baseURL?: string; - token?: string; - expireTime?: number; -}; - -app - .route({ - path: 'config', - key: 'getTokenList', - description: 'Get token list', - }) - .define(async (ctx) => { - const tokenList = await Config.findOne({ - where: { - key: cacheToken, - }, - logging: false, - }); - if (tokenList) { - ctx.body = tokenList; - return; - } - ctx.body = { - value: [], - }; - }) - .addTo(app); - -app - .route({ - path: 'config', - key: 'setTokenList', - description: 'Set token list', - }) - .define(async (ctx) => { - const { data } = ctx.query; - if (!data) { - ctx.throw(400, 'data is required'); - } - let config = await Config.findOne({ - where: { key: cacheToken }, // 自定义条件 - logging: false, - }); - - if (!config) { - config = await Config.create( - { - key: cacheToken, - value: data, - }, - { logging: false }, - ); - ctx.body = config; - return; - } else { - config.value = data; - await config.save(); - ctx.body = config; - } - }) - .addTo(app); - -app - .route({ - path: 'config', - key: 'clearToken', - description: 'Clear token list', - }) - .define(async (ctx) => { - const config = await Config.findOne({ - where: { key: cacheToken }, - logging: false, - }); - if (config) { - await config.destroy(); - } - ctx.body = 'success'; - }) - .addTo(app); - -app - .route({ - path: 'config', - key: 'saveToken', - description: 'Add token', - validator: { - baseURL: { - type: 'string', - required: true, - message: 'baseURL is required', - }, - token: { - type: 'string', - required: true, - message: 'token is required', - }, - }, - }) - .define(async (ctx) => { - const { baseURL, token } = ctx.query; - if (!baseURL || !token) { - ctx.throw(400, 'baseURL and token are required'); - } - const data: TokenCacheItem = { - baseURL, - token, - }; - const tokenRes = await ctx.call({ path: 'config', key: 'getTokenList' }); - if (tokenRes.code !== 200) { - ctx.throw(tokenRes.code, tokenRes.message || 'Failed to get token list'); - } - const tokenList: TokenCacheItem[] = tokenRes.body?.value || []; - // Check if the token already exists - const index = tokenList.findIndex((item) => item.baseURL === data.baseURL); - if (index > -1) { - tokenList[index] = data; - } else { - tokenList.push(data); - } - const res = await ctx.call({ path: 'config', key: 'setTokenList', payload: { data: tokenList } }); - if (res.code === 200) { - ctx.body = res.body?.value; - } else ctx.throw(res.code, res.message || 'Failed to add token'); - }) - .addTo(app); - -app - .route({ - path: 'config', - key: 'switchToken', - description: 'Switch token user', - validator: { - baseURL: { - type: 'string', - required: true, - message: 'baseURL is required', - }, - }, - }) - .define(async (ctx) => { - const { baseURL } = ctx.query; - const configRes = await ctx.call({ path: 'config', key: 'getTokenList' }); - if (configRes.code !== 200) { - ctx.throw(configRes.code, configRes.message || 'Failed to get token list'); - } - const tokenList: TokenCacheItem[] = configRes.body?.value || []; - const index = tokenList.findIndex((item) => item.baseURL === baseURL); - const token = index > -1 ? tokenList[index].token : ''; - if (token) { - const config = getConfig(); - const resMe = await queryMe(); - if (resMe.code !== 200) { - writeConfig({ ...config, token: '' }); - ctx.throw(resMe.code, resMe.message || 'cache token is invalid'); - } - writeConfig({ ...config, token: token }); - ctx.body = { - baseURL: baseURL, - token: tokenList[index].token, - }; - } else { - writeConfig({ ...getConfig(), token: '' }); - ctx.throw(404, 'Token not found'); - } - }) - .addTo(app); - -app - .route({ - path: 'config', - key: 'deleteToken', - description: 'Delete token', - validator: { - baseURL: { - type: 'string', - required: true, - message: 'baseURL is required', - }, - }, - }) - .define(async (ctx) => { - const { baseURL } = ctx.query; - const config = await ctx.call({ path: 'config', key: 'getTokenList' }); - if (config.code !== 200) { - ctx.throw(config.code, config.message || 'Failed to get token list'); - } - const tokenList: TokenCacheItem[] = config.body?.value || []; - const index = tokenList.findIndex((item) => item.baseURL === baseURL); - if (index > -1) { - tokenList.splice(index, 1); - const res = await ctx.call({ path: 'config', key: 'setTokenList', payload: { data: tokenList } }); - if (res.code === 200) { - ctx.body = res.body; - } else ctx.throw(res.code, res.message || 'Failed to delete token'); - } else { - console.log('not has token', baseURL); - ctx.body = { - value: tokenList, - }; - } - }) - .addTo(app); diff --git a/src/route/system-config/index.ts b/src/route/system-config/index.ts index 8239e05..9166f9d 100644 --- a/src/route/system-config/index.ts +++ b/src/route/system-config/index.ts @@ -1,2 +1 @@ -import './list.ts' -import './cache-token.ts' \ No newline at end of file +import './list.ts' \ No newline at end of file diff --git a/src/scripts/system-config.ts b/src/scripts/system-config.ts deleted file mode 100644 index 4c9811d..0000000 --- a/src/scripts/system-config.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { getConfig } from '../module/get-config.ts'; -import { runApp } from '../app-run.ts'; - -const getConfigList = async () => { - const res = await runApp({ - path: 'config', - key: 'getTokenList', - }); - console.log(res); -}; - -// getConfigList(); - -const setConfigList = async () => { - const config = getConfig(); - const { baseURL, token } = config; - console.log(baseURL, token); - - const res = await runApp({ - path: 'config', - key: 'saveToken', - payload: { - baseURL: 'abc32', - token, - }, - }); - console.log(res); -}; -// setConfigList(); - -const switchToken = async () => { - const res = await runApp({ - path: 'config', - key: 'switchToken', - payload: { - baseURL: 'abc2', - }, - }); - console.log(res); -}; -// switchToken(); - -const removeToken = async () => { - const res = await runApp({ - path: 'config', - key: 'deleteToken', - payload: { - baseURL: 'abc32', - }, - }); - console.log(res); -}; -removeToken(); diff --git a/submodules/kevisual-query-login b/submodules/kevisual-query-login new file mode 160000 index 0000000..af8ed90 --- /dev/null +++ b/submodules/kevisual-query-login @@ -0,0 +1 @@ +Subproject commit af8ed90ab3f5a0b558c410f5a0f40d5fb7eaa6d6