@lovrabet/cli 1.2.1-beta.4 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +33 -17
  2. package/lib/add-page/input-page-router.js +1 -1
  3. package/lib/add-page/main.js +1 -1
  4. package/lib/add-page/select-page-template.js +1 -1
  5. package/lib/api/api-doc-ui.js +1 -1
  6. package/lib/api/api-doc.js +1 -1
  7. package/lib/api/api-pull-ui.js +1 -1
  8. package/lib/api/fetch-model-list.js +1 -1
  9. package/lib/api/generate-api-file.js +1 -1
  10. package/lib/api/main.js +1 -1
  11. package/lib/api/pull-silent.js +1 -1
  12. package/lib/app-menu/app-menu-sync-ui.js +1 -1
  13. package/lib/app-menu/create-menu.js +1 -1
  14. package/lib/app-menu/get-local-pages.js +1 -1
  15. package/lib/app-menu/get-online-menu-list.js +1 -1
  16. package/lib/app-menu/use-get-online-menu-list.js +1 -1
  17. package/lib/app-menu/utils.js +1 -1
  18. package/lib/app-menu/valid-url.js +1 -1
  19. package/lib/app-menu-update-cdn/current-content.js +1 -1
  20. package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
  21. package/lib/app-menu-update-cdn/main.js +1 -1
  22. package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
  23. package/lib/auth/auth-server-ui.js +1 -1
  24. package/lib/auth/auth-server.js +1 -1
  25. package/lib/auth/constant.js +1 -1
  26. package/lib/auth/get-cookie.js +1 -1
  27. package/lib/auth/is-session-valid.js +1 -1
  28. package/lib/auth/logout.js +1 -1
  29. package/lib/cli.js +1 -1
  30. package/lib/cmd/build-watch.js +1 -1
  31. package/lib/cmd/build.js +1 -1
  32. package/lib/cmd/logs.js +1 -1
  33. package/lib/cmd/preview.js +1 -1
  34. package/lib/cmd/start.js +1 -1
  35. package/lib/config/config-help.js +1 -1
  36. package/lib/config/main.js +1 -1
  37. package/lib/constant/domain.js +1 -1
  38. package/lib/constant/env.js +1 -1
  39. package/lib/create-app/enhanced-guided-create.js +1 -1
  40. package/lib/create-app/format-elapsed.js +1 -1
  41. package/lib/create-app/main.js +1 -1
  42. package/lib/create-app/task-finished.js +1 -1
  43. package/lib/create-app/task-loading.js +1 -1
  44. package/lib/create-app/task-running.js +1 -1
  45. package/lib/create-app/task-time.js +1 -1
  46. package/lib/create-app/use-copy-project-template.js +1 -1
  47. package/lib/create-app/use-format-code.js +1 -1
  48. package/lib/create-app/use-install-dependencies.js +1 -1
  49. package/lib/help.js +1 -1
  50. package/lib/init/main.js +1 -1
  51. package/lib/mcp/cursor.js +1 -1
  52. package/lib/mcp/main.js +1 -1
  53. package/lib/utils/check-sdk-version.js +1 -1
  54. package/lib/utils/config.js +1 -1
  55. package/lib/utils/copy-directory.js +1 -1
  56. package/lib/utils/http-client.js +1 -1
  57. package/lib/utils/logger.js +1 -1
  58. package/lib/utils/router-updater.js +1 -1
  59. package/lib/utils/sleep.js +1 -1
  60. package/lib/utils/template-replacer.js +1 -1
  61. package/package.json +3 -3
  62. package/templates/projects/sub-app-react-demo/package.json +2 -2
  63. package/templates/projects/sub-app-react-demo/src/api/api.ts +42 -25
  64. package/templates/projects/sub-app-react-demo/src/api/client.ts +11 -10
  65. package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +72 -19
  66. package/templates/projects/sub-app-react-demo/package-lock.json +0 -4062
package/README.md CHANGED
@@ -235,29 +235,45 @@ your-project/
235
235
  ├── package.json # 项目配置
236
236
  ├── vite.config.ts # 构建配置
237
237
  ├── tsconfig.json # TypeScript 配置
238
- └── lovrabet.config.js # Lovrabet 配置
238
+ └── .lovrabetrc # Lovrabet CLI 配置
239
239
  ```
240
240
 
241
241
  ## ⚙️ 配置文件
242
242
 
243
- ### `lovrabet.config.js`
244
-
245
- 项目根目录的配置文件,用于配置应用信息和 API:
246
-
247
- ```javascript
248
- module.exports = {
249
- appCode: "your-app-code",
250
- env: "online", // 或 "daily"
251
- models: {
252
- Users: {
253
- tableName: "users",
254
- datasetCode: "your-dataset-code",
255
- },
256
- // 更多模型配置...
257
- },
258
- };
243
+ ### `.lovrabetrc`
244
+
245
+ 项目根目录的配置文件(JSON 格式),用于配置应用基本信息:
246
+
247
+ ```json
248
+ {
249
+ "appcode": "your-app-code",
250
+ "env": "online",
251
+ "createdAt": "2025/1/5 10:30:00",
252
+ "version": "1.1.15"
253
+ }
254
+ ```
255
+
256
+ **配置说明:**
257
+
258
+ | 字段 | 说明 | 可选值 |
259
+ |------|------|--------|
260
+ | `appcode` | 应用代码,用于标识您的应用 | 字母、数字、`-` 和 `_` |
261
+ | `env` | 运行环境 | `"online"` 或 `"daily"` |
262
+ | `createdAt` | 配置创建时间(自动生成) | - |
263
+ | `version` | CLI 版本(自动生成) | - |
264
+
265
+ **生成方式:**
266
+
267
+ ```bash
268
+ # 通过 init 命令生成
269
+ lovrabet init --appcode your-app-code
270
+
271
+ # 或通过 create 命令自动生成
272
+ lovrabet create
259
273
  ```
260
274
 
275
+ > 💡 **注意**:`.lovrabetrc` 是 CLI 工具的配置文件。SDK 的 API 配置(models)由 `lovrabet api pull` 命令自动生成到 `src/api/` 目录。
276
+
261
277
  ## 🔧 环境要求
262
278
 
263
279
  - **Node.js**: >= 20.0.0
@@ -1 +1 @@
1
- (function(_0xd0a3a1,_0x4f7354){const _0xd0a705=a0_0x6397,_0x4ea7c3=_0xd0a3a1();while(!![]){try{const _0x3ad818=-parseInt(_0xd0a705(0xb3))/0x1*(parseInt(_0xd0a705(0xb0))/0x2)+-parseInt(_0xd0a705(0xc4))/0x3+parseInt(_0xd0a705(0xba))/0x4+-parseInt(_0xd0a705(0xb6))/0x5*(-parseInt(_0xd0a705(0xc6))/0x6)+parseInt(_0xd0a705(0xbe))/0x7+-parseInt(_0xd0a705(0xb1))/0x8+parseInt(_0xd0a705(0xbd))/0x9;if(_0x3ad818===_0x4f7354)break;else _0x4ea7c3['push'](_0x4ea7c3['shift']());}catch(_0x5e4c50){_0x4ea7c3['push'](_0x4ea7c3['shift']());}}}(a0_0x1ee4,0xdb914));function a0_0x1ee4(){const _0x4a868a=['8151EfGLgP','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','green','586120FmizuD','\x20Step2:\x20','existsSync','my-page','2043056FuIZvq','backspace','return','27343278MYVDiC','1310218WiVLNq','页面路径不合法','页面路由地址:\x20','\x20←\x20','\x20已存在,请使用其他路径','gray','4457520PAQLiM','页面路径\x20','48hIBFxf','includes','test','red','路径不能以\x20/\x20开头或结尾','delete','路径不能包含连续的\x20/','218QIxWpq','11201800EXvXQQ','length'];a0_0x1ee4=function(){return _0x4a868a;};return a0_0x1ee4();}import{jsx as a0_0xf68e8,jsxs as a0_0x4fbbf5}from'react/jsx-runtime';function a0_0x6397(_0x5839a8,_0x1a6321){_0x5839a8=_0x5839a8-0xaf;const _0x1ee49a=a0_0x1ee4();let _0x63978c=_0x1ee49a[_0x5839a8];return _0x63978c;}import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x46ee8f from'node:fs';export function InputProjectCode(_0x350c2f){const _0x4c9e86=a0_0x6397,{onSubmit:_0x336c4b,pagePath:_0x5a6d41}=_0x350c2f,[_0x37db15,_0x14c367]=useState(''),[_0xf4358f,_0x107108]=useState(''),_0x87e7cb=_0x4c9e86(0xb9);function _0x20db1b(_0x59a9bd){const _0x2c5530=_0x4c9e86;if(_0x59a9bd[_0x2c5530(0xb2)]>0x64)return{'valid':![],'message':'页面路径长度不能超过\x20100\x20个字符'};if(_0x59a9bd['startsWith']('/')||_0x59a9bd['endsWith']('/'))return{'valid':![],'message':_0x2c5530(0xca)};if(_0x59a9bd[_0x2c5530(0xc7)]('//'))return{'valid':![],'message':_0x2c5530(0xaf)};const _0x34f485=_0x59a9bd['split']('/');for(const _0x423f6d of _0x34f485){if(!_0x423f6d)continue;const _0x5ecc51=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x5ecc51[_0x2c5530(0xc8)](_0x423f6d))return{'valid':![],'message':_0x2c5530(0xb4)};}return{'valid':!![]};}return useInput((_0x172179,_0x28ec39)=>{const _0x4c58f5=_0x4c9e86;if(_0x28ec39[_0x4c58f5(0xbc)]){const _0x2d5be0=_0x37db15['trim']()||_0x87e7cb;if(_0xf4358f)return;const _0x37a600=_0x5a6d41+'/'+_0x2d5be0;if(a0_0x46ee8f[_0x4c58f5(0xb8)](_0x37a600)){_0x107108(_0x4c58f5(0xc5)+_0x2d5be0+_0x4c58f5(0xc2));return;}_0x336c4b(_0x2d5be0),_0x14c367(''),_0x107108('');}else _0x28ec39[_0x4c58f5(0xbb)]||_0x28ec39[_0x4c58f5(0xcb)]?_0x14c367(_0x274a0c=>{const _0x54d73f=_0x4c58f5,_0x2fc315=_0x274a0c['slice'](0x0,-0x1),{valid:_0x5edbfc,message:_0x5be162}=_0x20db1b(_0x2fc315);return _0x107108(_0x5edbfc?'':_0x5be162||_0x54d73f(0xbf)),_0x2fc315;}):_0x14c367(_0x3d8a06=>{const _0x128c62=_0x4c58f5,_0x519d97=_0x3d8a06+_0x172179,{valid:_0x3e1580,message:_0x12e50f}=_0x20db1b(_0x519d97);return _0x107108(_0x3e1580?'':_0x12e50f||_0x128c62(0xbf)),_0x519d97;});}),a0_0x4fbbf5(Box,{'flexDirection':'column','children':[a0_0x4fbbf5(Box,{'children':[a0_0xf68e8(Text,{'color':'gray','children':_0x4c9e86(0xb7)}),a0_0xf68e8(Text,{'children':_0x4c9e86(0xc0)}),_0x37db15?a0_0xf68e8(Text,{'color':_0x4c9e86(0xb5),'children':_0x37db15}):a0_0xf68e8(Text,{'color':_0x4c9e86(0xc3),'children':_0x87e7cb}),_0xf4358f&&a0_0x4fbbf5(Text,{'color':_0x4c9e86(0xc9),'children':[_0x4c9e86(0xc1),_0xf4358f]})]}),!_0xf4358f&&!_0x37db15&&a0_0xf68e8(Box,{'children':a0_0xf68e8(Text,{'color':_0x4c9e86(0xc3),'children':'\x20直接回车确认,或输入自定义路由地址'})})]});}
1
+ (function(_0x4edc16,_0x35f824){const _0xc25586=a0_0x2b84,_0x42a9f1=_0x4edc16();while(!![]){try{const _0x36701a=-parseInt(_0xc25586(0xe9))/0x1*(parseInt(_0xc25586(0xde))/0x2)+parseInt(_0xc25586(0xe3))/0x3*(parseInt(_0xc25586(0xdc))/0x4)+parseInt(_0xc25586(0xe1))/0x5+parseInt(_0xc25586(0xec))/0x6+-parseInt(_0xc25586(0xe0))/0x7*(-parseInt(_0xc25586(0xe6))/0x8)+-parseInt(_0xc25586(0xf1))/0x9*(parseInt(_0xc25586(0xf2))/0xa)+-parseInt(_0xc25586(0xd7))/0xb;if(_0x36701a===_0x35f824)break;else _0x42a9f1['push'](_0x42a9f1['shift']());}catch(_0x41bf5e){_0x42a9f1['push'](_0x42a9f1['shift']());}}}(a0_0x18b4,0x23f22));import{jsx as a0_0x471ee2,jsxs as a0_0x38df4f}from'react/jsx-runtime';function a0_0x2b84(_0x2bc294,_0x626aac){_0x2bc294=_0x2bc294-0xd7;const _0x18b4e6=a0_0x18b4();let _0x2b84ce=_0x18b4e6[_0x2bc294];return _0x2b84ce;}function a0_0x18b4(){const _0x2c9a19=['11787INlsov','length','endsWith','8XsIGhR','页面路径不合法','startsWith','4139zVKrVz','页面路径长度不能超过\x20100\x20个字符','split','639792kIWoAe','\x20←\x20','delete','existsSync','路径不能包含连续的\x20/','178344dPJVQG','70mQipNm','页面路径\x20','gray','2264966UNvIhi','return','trim','\x20直接回车确认,或输入自定义路由地址','slice','248hXmVAt','路径不能以\x20/\x20开头或结尾','86IqeElq','backspace','992747wAQOlD','888890PdCoKb','\x20已存在,请使用其他路径'];a0_0x18b4=function(){return _0x2c9a19;};return a0_0x18b4();}import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x320dee from'node:fs';export function InputProjectCode(_0x5a0a62){const _0x2d786e=a0_0x2b84,{onSubmit:_0x10c6e2,pagePath:_0x476751}=_0x5a0a62,[_0x32eef1,_0x2c545f]=useState(''),[_0x17226f,_0x468614]=useState(''),_0x186028='my-page';function _0x45b9f0(_0xe721d4){const _0x3dd8c2=a0_0x2b84;if(_0xe721d4[_0x3dd8c2(0xe4)]>0x64)return{'valid':![],'message':_0x3dd8c2(0xea)};if(_0xe721d4[_0x3dd8c2(0xe8)]('/')||_0xe721d4[_0x3dd8c2(0xe5)]('/'))return{'valid':![],'message':_0x3dd8c2(0xdd)};if(_0xe721d4['includes']('//'))return{'valid':![],'message':_0x3dd8c2(0xf0)};const _0x164b33=_0xe721d4[_0x3dd8c2(0xeb)]('/');for(const _0x28ccad of _0x164b33){if(!_0x28ccad)continue;const _0x76cd86=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x76cd86['test'](_0x28ccad))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x188b66,_0x4b61b4)=>{const _0x5e80ea=a0_0x2b84;if(_0x4b61b4[_0x5e80ea(0xd8)]){const _0xd042ae=_0x32eef1[_0x5e80ea(0xd9)]()||_0x186028;if(_0x17226f)return;const _0x330a2e=_0x476751+'/'+_0xd042ae;if(a0_0x320dee[_0x5e80ea(0xef)](_0x330a2e)){_0x468614(_0x5e80ea(0xf3)+_0xd042ae+_0x5e80ea(0xe2));return;}_0x10c6e2(_0xd042ae),_0x2c545f(''),_0x468614('');}else _0x4b61b4[_0x5e80ea(0xdf)]||_0x4b61b4[_0x5e80ea(0xee)]?_0x2c545f(_0x511ada=>{const _0x18bd4d=_0x5e80ea,_0xb6a114=_0x511ada[_0x18bd4d(0xdb)](0x0,-0x1),{valid:_0x4a9977,message:_0x4ab2d8}=_0x45b9f0(_0xb6a114);return _0x468614(_0x4a9977?'':_0x4ab2d8||_0x18bd4d(0xe7)),_0xb6a114;}):_0x2c545f(_0x430f07=>{const _0x14d3d7=_0x5e80ea,_0x589a67=_0x430f07+_0x188b66,{valid:_0x15e81c,message:_0x1caa5a}=_0x45b9f0(_0x589a67);return _0x468614(_0x15e81c?'':_0x1caa5a||_0x14d3d7(0xe7)),_0x589a67;});}),a0_0x38df4f(Box,{'flexDirection':'column','children':[a0_0x38df4f(Box,{'children':[a0_0x471ee2(Text,{'color':_0x2d786e(0xf4),'children':'\x20Step2:\x20'}),a0_0x471ee2(Text,{'children':'页面路由地址:\x20'}),_0x32eef1?a0_0x471ee2(Text,{'color':'green','children':_0x32eef1}):a0_0x471ee2(Text,{'color':'gray','children':_0x186028}),_0x17226f&&a0_0x38df4f(Text,{'color':'red','children':[_0x2d786e(0xed),_0x17226f]})]}),!_0x17226f&&!_0x32eef1&&a0_0x471ee2(Box,{'children':a0_0x471ee2(Text,{'color':_0x2d786e(0xf4),'children':_0x2d786e(0xda)})})]});}
@@ -1 +1 @@
1
- const a1_0x1e8901=a1_0x57b7;(function(_0x6ac0df,_0x5ed4cd){const _0x3f5019=a1_0x57b7,_0x1213e8=_0x6ac0df();while(!![]){try{const _0x4217c9=-parseInt(_0x3f5019(0x162))/0x1*(parseInt(_0x3f5019(0x163))/0x2)+parseInt(_0x3f5019(0x15c))/0x3*(parseInt(_0x3f5019(0x15e))/0x4)+parseInt(_0x3f5019(0x16b))/0x5+-parseInt(_0x3f5019(0x179))/0x6*(parseInt(_0x3f5019(0x177))/0x7)+parseInt(_0x3f5019(0x16a))/0x8*(-parseInt(_0x3f5019(0x168))/0x9)+-parseInt(_0x3f5019(0x164))/0xa*(-parseInt(_0x3f5019(0x16e))/0xb)+-parseInt(_0x3f5019(0x16d))/0xc*(parseInt(_0x3f5019(0x176))/0xd);if(_0x4217c9===_0x5ed4cd)break;else _0x1213e8['push'](_0x1213e8['shift']());}catch(_0x38098f){_0x1213e8['push'](_0x1213e8['shift']());}}}(a1_0x3208,0xb2adc));import{jsx as a1_0x3d0d88,jsxs as a1_0x4d9e70,Fragment as a1_0x2ba8ce}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x3eb56b from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';function a1_0x57b7(_0x3bf60e,_0x15acba){_0x3bf60e=_0x3bf60e-0x15a;const _0x32087f=a1_0x3208();let _0x57b7bd=_0x32087f[_0x3bf60e];return _0x57b7bd;}import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';function a1_0x3208(){const _0x185bba=['cwd','src','91hJtltT','147KiywQf','\x20*\x20页面路径:\x20','172218UTzjsT','页面添加成功:\x20','\x20Step2:\x20','processTemplate','gray','error','success','then','开始添加页面:\x20','\x20*\x20页面创建成功!','\x20*\x20页面文件已创建,可直接通过路由访问','1975737asXohI','\x20Step1:\x20','4dGrPEU','message','join','正在创建页面,请稍候…','29GEGnCK','23602nuyJcf','30eyrTCd','已输入的页面路由\x20','页面添加失败:\x20','add-page','45urdcBb','green','13264WqbJeT','432470jVsHKo','setLogPath','436068ymugNW','4379650juINes','now','已选择页面模板\x20','dirname','resolve','cyan'];a1_0x3208=function(){return _0x185bba;};return a1_0x3208();}const __dirname=a1_0x3eb56b[a1_0x1e8901(0x171)](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x3eb56b['resolve'](__dirname,'../../templates/pages'),projectDir=process[a1_0x1e8901(0x174)]();export const AddPage=()=>{const _0x3b0e3d=a1_0x1e8901,{exit:_0x136241}=useApp(),[_0x266767,_0x3ee077]=useState(''),[_0x5d4cea,_0x5c262c]=useState(''),[_0x38df6c,_0x2a6db6]=useState(![]),[_0x3b23a7,_0xba0db6]=useState(![]),_0x2edc7c=a1_0x3eb56b[_0x3b0e3d(0x160)](projectDir,'src','pages'),_0x1328b4=a1_0x3eb56b['join'](_0x2edc7c,_0x5d4cea),_0x2cdd15=a1_0x3eb56b[_0x3b0e3d(0x160)](_0x3b0e3d(0x175),'pages',_0x5d4cea);useEffect(()=>{const _0x374205=_0x3b0e3d,_0x235171=a1_0x3eb56b[_0x374205(0x172)](pageTemplateDir,_0x266767);if(_0x266767&&_0x5d4cea){_0x2a6db6(!![]),logger[_0x374205(0x16c)](process['cwd']());const _0x18f629=Date['now']();logger['info'](_0x374205(0x167),_0x374205(0x181)+_0x5d4cea,{'template':_0x266767,'targetPath':_0x2cdd15}),TemplateReplacer[_0x374205(0x17c)](_0x235171,a1_0x3eb56b[_0x374205(0x160)](_0x2edc7c,_0x5d4cea),_0x5d4cea,_0x266767)[_0x374205(0x180)](()=>{const _0x2d7c30=_0x374205,_0x4588f1=Date[_0x2d7c30(0x16f)]()-_0x18f629;logger[_0x2d7c30(0x17f)]('add-page',_0x2d7c30(0x17a)+_0x5d4cea,_0x4588f1,{'template':_0x266767,'targetPath':_0x2cdd15,'routePath':_0x5d4cea}),_0xba0db6(!![]);})['catch'](_0x11c8c4=>{const _0x555b10=_0x374205,_0x4728e1=Date[_0x555b10(0x16f)]()-_0x18f629;logger[_0x555b10(0x17e)](_0x555b10(0x167),_0x555b10(0x166)+_0x5d4cea,{'template':_0x266767,'targetPath':_0x2cdd15,'error':_0x11c8c4 instanceof Error?_0x11c8c4[_0x555b10(0x15f)]:String(_0x11c8c4),'duration':_0x4728e1});})['finally'](()=>{_0x2a6db6(![]);});}},[_0x266767,_0x5d4cea]),useEffect(()=>{_0x3b23a7&&setTimeout(()=>{_0x136241();});},[_0x3b23a7]);if(_0x266767)return a1_0x4d9e70(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x4d9e70(Box,{'children':[a1_0x3d0d88(Text,{'color':_0x3b0e3d(0x17d),'children':_0x3b0e3d(0x15d)}),a1_0x3d0d88(Text,{'children':_0x3b0e3d(0x170)}),a1_0x3d0d88(Text,{'color':'green','children':_0x266767})]}),_0x5d4cea?a1_0x4d9e70(Box,{'children':[a1_0x3d0d88(Text,{'color':_0x3b0e3d(0x17d),'children':_0x3b0e3d(0x17b)}),a1_0x3d0d88(Text,{'children':_0x3b0e3d(0x165)}),a1_0x3d0d88(Text,{'color':'green','children':_0x5d4cea})]}):a1_0x3d0d88(InputProjectCode,{'pagePath':_0x1328b4,'onSubmit':_0x5c262c}),_0x5d4cea&&_0x38df6c?a1_0x4d9e70(Box,{'marginTop':0x1,'children':[a1_0x3d0d88(Box,{'width':'4'}),a1_0x3d0d88(Text,{'children':_0x3b0e3d(0x161)})]}):null,_0x3b23a7?a1_0x4d9e70(a1_0x2ba8ce,{'children':[a1_0x3d0d88(Box,{'marginTop':0x1,'children':a1_0x3d0d88(Text,{'color':_0x3b0e3d(0x17d),'children':_0x3b0e3d(0x15a)})}),a1_0x4d9e70(Box,{'children':[a1_0x3d0d88(Text,{'color':_0x3b0e3d(0x17d),'children':_0x3b0e3d(0x178)}),a1_0x3d0d88(Text,{'color':'green','children':_0x2cdd15})]}),a1_0x4d9e70(Box,{'children':[a1_0x3d0d88(Text,{'color':'gray','children':'\x20*\x20路由地址:\x20'}),a1_0x4d9e70(Text,{'color':_0x3b0e3d(0x169),'children':['/',_0x5d4cea]})]}),a1_0x3d0d88(Box,{'marginTop':0x1,'children':a1_0x3d0d88(Text,{'color':_0x3b0e3d(0x173),'children':_0x3b0e3d(0x15b)})})]}):null]});return a1_0x3d0d88(SelectPageTemplate,{'onSelect':_0x3ee077});};
1
+ const a1_0x374147=a1_0x52ad;(function(_0x3d3343,_0x1f9ad5){const _0x2c6c75=a1_0x52ad,_0x185934=_0x3d3343();while(!![]){try{const _0x2ccafa=parseInt(_0x2c6c75(0x130))/0x1+-parseInt(_0x2c6c75(0x116))/0x2+-parseInt(_0x2c6c75(0x114))/0x3+parseInt(_0x2c6c75(0x133))/0x4+parseInt(_0x2c6c75(0x12d))/0x5*(-parseInt(_0x2c6c75(0x12e))/0x6)+parseInt(_0x2c6c75(0x117))/0x7*(parseInt(_0x2c6c75(0x128))/0x8)+-parseInt(_0x2c6c75(0x123))/0x9*(parseInt(_0x2c6c75(0x115))/0xa);if(_0x2ccafa===_0x1f9ad5)break;else _0x185934['push'](_0x185934['shift']());}catch(_0x4790e3){_0x185934['push'](_0x185934['shift']());}}}(a1_0x3a3b,0xadc28));import{jsx as a1_0x31648f,jsxs as a1_0x212338,Fragment as a1_0x56e961}from'react/jsx-runtime';import{fileURLToPath}from'node:url';function a1_0x3a3b(){const _0x544169=['success','\x20Step2:\x20','页面添加成功:\x20','\x20*\x20路由地址:\x20','column','1217277gQVGya','209830DpDGgm','2283900YZRqGP','1433663QRungQ','join','error','now','resolve','finally','已选择页面模板\x20','add-page','\x20Step1:\x20','message','info','setLogPath','18DmxOBP','src','pages','\x20*\x20页面文件已创建,可直接通过路由访问','页面添加失败:\x20','40hmhVJX','gray','已输入的页面路由\x20','正在创建页面,请稍候…','开始添加页面:\x20','5194995atBdzS','6jjyOcQ','cwd','1050219EiWLmX','green','then','5064520LLyOFJ','processTemplate'];a1_0x3a3b=function(){return _0x544169;};return a1_0x3a3b();}import a1_0x40d250 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';function a1_0x52ad(_0x53915d,_0x90d572){_0x53915d=_0x53915d-0x110;const _0x3a3bf0=a1_0x3a3b();let _0x52adaf=_0x3a3bf0[_0x53915d];return _0x52adaf;}import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x40d250['dirname'](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x40d250[a1_0x374147(0x11b)](__dirname,'../../templates/pages'),projectDir=process[a1_0x374147(0x12f)]();export const AddPage=()=>{const _0x407db2=a1_0x374147,{exit:_0x5a2d4d}=useApp(),[_0x3b1d6f,_0x181d99]=useState(''),[_0x5b1a1f,_0x3b38b9]=useState(''),[_0x2c660b,_0x383f31]=useState(![]),[_0x14e249,_0xbb7f64]=useState(![]),_0x12f8d6=a1_0x40d250[_0x407db2(0x118)](projectDir,_0x407db2(0x124),_0x407db2(0x125)),_0xed99c9=a1_0x40d250[_0x407db2(0x118)](_0x12f8d6,_0x5b1a1f),_0x2fbf30=a1_0x40d250[_0x407db2(0x118)]('src',_0x407db2(0x125),_0x5b1a1f);useEffect(()=>{const _0x3825fe=_0x407db2,_0x317989=a1_0x40d250[_0x3825fe(0x11b)](pageTemplateDir,_0x3b1d6f);if(_0x3b1d6f&&_0x5b1a1f){_0x383f31(!![]),logger[_0x3825fe(0x122)](process[_0x3825fe(0x12f)]());const _0x4af4e1=Date[_0x3825fe(0x11a)]();logger[_0x3825fe(0x121)](_0x3825fe(0x11e),_0x3825fe(0x12c)+_0x5b1a1f,{'template':_0x3b1d6f,'targetPath':_0x2fbf30}),TemplateReplacer[_0x3825fe(0x134)](_0x317989,a1_0x40d250['join'](_0x12f8d6,_0x5b1a1f),_0x5b1a1f,_0x3b1d6f)[_0x3825fe(0x132)](()=>{const _0x4517a1=_0x3825fe,_0x24231a=Date[_0x4517a1(0x11a)]()-_0x4af4e1;logger[_0x4517a1(0x135)]('add-page',_0x4517a1(0x111)+_0x5b1a1f,_0x24231a,{'template':_0x3b1d6f,'targetPath':_0x2fbf30,'routePath':_0x5b1a1f}),_0xbb7f64(!![]);})['catch'](_0x312194=>{const _0x2968b9=_0x3825fe,_0x22ac48=Date['now']()-_0x4af4e1;logger[_0x2968b9(0x119)](_0x2968b9(0x11e),_0x2968b9(0x127)+_0x5b1a1f,{'template':_0x3b1d6f,'targetPath':_0x2fbf30,'error':_0x312194 instanceof Error?_0x312194[_0x2968b9(0x120)]:String(_0x312194),'duration':_0x22ac48});})[_0x3825fe(0x11c)](()=>{_0x383f31(![]);});}},[_0x3b1d6f,_0x5b1a1f]),useEffect(()=>{_0x14e249&&setTimeout(()=>{_0x5a2d4d();});},[_0x14e249]);if(_0x3b1d6f)return a1_0x212338(Box,{'flexDirection':_0x407db2(0x113),'paddingY':0x1,'children':[a1_0x212338(Box,{'children':[a1_0x31648f(Text,{'color':_0x407db2(0x129),'children':_0x407db2(0x11f)}),a1_0x31648f(Text,{'children':_0x407db2(0x11d)}),a1_0x31648f(Text,{'color':_0x407db2(0x131),'children':_0x3b1d6f})]}),_0x5b1a1f?a1_0x212338(Box,{'children':[a1_0x31648f(Text,{'color':_0x407db2(0x129),'children':_0x407db2(0x110)}),a1_0x31648f(Text,{'children':_0x407db2(0x12a)}),a1_0x31648f(Text,{'color':_0x407db2(0x131),'children':_0x5b1a1f})]}):a1_0x31648f(InputProjectCode,{'pagePath':_0xed99c9,'onSubmit':_0x3b38b9}),_0x5b1a1f&&_0x2c660b?a1_0x212338(Box,{'marginTop':0x1,'children':[a1_0x31648f(Box,{'width':'4'}),a1_0x31648f(Text,{'children':_0x407db2(0x12b)})]}):null,_0x14e249?a1_0x212338(a1_0x56e961,{'children':[a1_0x31648f(Box,{'marginTop':0x1,'children':a1_0x31648f(Text,{'color':_0x407db2(0x129),'children':'\x20*\x20页面创建成功!'})}),a1_0x212338(Box,{'children':[a1_0x31648f(Text,{'color':'gray','children':'\x20*\x20页面路径:\x20'}),a1_0x31648f(Text,{'color':_0x407db2(0x131),'children':_0x2fbf30})]}),a1_0x212338(Box,{'children':[a1_0x31648f(Text,{'color':_0x407db2(0x129),'children':_0x407db2(0x112)}),a1_0x212338(Text,{'color':'green','children':['/',_0x5b1a1f]})]}),a1_0x31648f(Box,{'marginTop':0x1,'children':a1_0x31648f(Text,{'color':'cyan','children':_0x407db2(0x126)})})]}):null]});return a1_0x31648f(SelectPageTemplate,{'onSelect':_0x181d99});};
@@ -1 +1 @@
1
- function a2_0x5b6e(){const _0x153ba1=['获取模板列表失败:','请选择您要创建的页面模板','templates/pages','\x20Step1:\x20','385394IkhUvo','column','200tsbrCO','name','217690xoQctu','downArrow','gray','return','green','upArrow','\x20\x20\x20\x20\x20\x20>\x20','\x20\x20\x20\x20\x20\x20\x20\x20','sdk-fetch','label','1954GFoKPm','753XGGlVz','error','sort','2165250HnsQhL','filter','833uzpFlZ','772828pPWqXV','56358rqDExi','resolve','localeCompare','50pYRWQl','onSelect','map','dirname','12006DJcjRe','../..','join'];a2_0x5b6e=function(){return _0x153ba1;};return a2_0x5b6e();}(function(_0x5ddf28,_0x5dd3ea){const _0x331422=a2_0x30ea,_0x5f836c=_0x5ddf28();while(!![]){try{const _0x235443=parseInt(_0x331422(0x10a))/0x1+-parseInt(_0x331422(0xf4))/0x2*(-parseInt(_0x331422(0xf5))/0x3)+-parseInt(_0x331422(0xfb))/0x4+-parseInt(_0x331422(0xf8))/0x5+-parseInt(_0x331422(0x103))/0x6*(-parseInt(_0x331422(0xfa))/0x7)+-parseInt(_0x331422(0xe8))/0x8*(-parseInt(_0x331422(0xfc))/0x9)+-parseInt(_0x331422(0xff))/0xa*(parseInt(_0x331422(0xea))/0xb);if(_0x235443===_0x5dd3ea)break;else _0x5f836c['push'](_0x5f836c['shift']());}catch(_0x2b324c){_0x5f836c['push'](_0x5f836c['shift']());}}}(a2_0x5b6e,0x49433));import{jsx as a2_0x1ad7a1,jsxs as a2_0xa2a73}from'react/jsx-runtime';import{useState,useEffect}from'react';function a2_0x30ea(_0xfda303,_0x24107a){_0xfda303=_0xfda303-0xe8;const _0x5b6ec4=a2_0x5b6e();let _0x30ea49=_0x5b6ec4[_0xfda303];return _0x30ea49;}import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x1a99c7 from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x671ed1=a2_0x30ea;try{const _0x56088c=fileURLToPath(import.meta.url),_0x36d223=a2_0x1a99c7[_0x671ed1(0xfd)](a2_0x1a99c7[_0x671ed1(0x102)](_0x56088c),_0x671ed1(0x104)),_0x4a1fbb=a2_0x1a99c7[_0x671ed1(0x105)](_0x36d223,_0x671ed1(0x108)),_0x3d6b5e=await readdir(_0x4a1fbb,{'withFileTypes':!![]}),_0x5d15e8=_0x3d6b5e[_0x671ed1(0xf9)](_0x239496=>_0x239496['isDirectory']())['map'](_0x5cf543=>({'label':_0x5cf543[_0x671ed1(0xe9)]}))[_0x671ed1(0xf7)]((_0x24e540,_0x38ce68)=>_0x24e540['label'][_0x671ed1(0xfe)](_0x38ce68['label']));return _0x5d15e8;}catch(_0x32b4af){return console[_0x671ed1(0xf6)](_0x671ed1(0x106),_0x32b4af),[{'label':'blank'},{'label':_0x671ed1(0xf2)}];}}export function SelectPageTemplate(_0x356262){const _0x34955d=a2_0x30ea,[_0x1fa3a6,_0x5e6e5c]=useState(0x0),[_0x4815f4,_0x12d935]=useState([]),[_0x58d543,_0x1a0f96]=useState(!![]);useEffect(()=>{async function _0x359ff1(){const _0xe09500=await getTemplateList();_0x12d935(_0xe09500),_0x1a0f96(![]);}_0x359ff1();},[]),useInput((_0x5aec49,_0x5b3d0d)=>{const _0x638fa2=a2_0x30ea;if(_0x58d543)return;if(_0x5b3d0d[_0x638fa2(0xed)]){const _0x7bb462=_0x4815f4[_0x1fa3a6];_0x7bb462&&_0x356262[_0x638fa2(0x100)](_0x7bb462['label']);}_0x5b3d0d[_0x638fa2(0xef)]&&_0x5e6e5c(_0x501b05=>_0x501b05===0x0?_0x4815f4['length']-0x1:_0x501b05-0x1),_0x5b3d0d[_0x638fa2(0xeb)]&&_0x5e6e5c(_0x17e170=>_0x17e170===_0x4815f4['length']-0x1?0x0:_0x17e170+0x1);});if(_0x58d543)return a2_0x1ad7a1(Box,{'flexDirection':_0x34955d(0x10b),'paddingY':0x1,'children':a2_0xa2a73(Box,{'children':[a2_0x1ad7a1(Text,{'color':_0x34955d(0xec),'children':_0x34955d(0x109)}),a2_0x1ad7a1(Text,{'children':'正在加载页面模板...'})]})});return a2_0xa2a73(Box,{'flexDirection':_0x34955d(0x10b),'paddingY':0x1,'children':[a2_0xa2a73(Box,{'children':[a2_0x1ad7a1(Text,{'color':'gray','children':_0x34955d(0x109)}),a2_0x1ad7a1(Text,{'children':_0x34955d(0x107)})]}),_0x4815f4[_0x34955d(0x101)]((_0x271e24,_0x10c02a)=>{const _0x15250b=_0x34955d,_0x10e7f2=_0x10c02a===_0x1fa3a6,_0x286bb2=_0x10e7f2?_0x15250b(0xf0)+_0x271e24[_0x15250b(0xf3)]:_0x15250b(0xf1)+_0x271e24[_0x15250b(0xf3)];return a2_0x1ad7a1(Box,{'children':a2_0x1ad7a1(Text,{'color':_0x10e7f2?_0x15250b(0xee):undefined,'children':_0x286bb2})},_0x286bb2);})]});}
1
+ (function(_0x38a798,_0x58ca1a){const _0x106551=a2_0x35fe,_0xbb9dc0=_0x38a798();while(!![]){try{const _0x5ec0f3=-parseInt(_0x106551(0x106))/0x1+-parseInt(_0x106551(0xf9))/0x2*(parseInt(_0x106551(0xfb))/0x3)+parseInt(_0x106551(0x10d))/0x4+parseInt(_0x106551(0xff))/0x5+parseInt(_0x106551(0x104))/0x6+parseInt(_0x106551(0x113))/0x7+-parseInt(_0x106551(0x103))/0x8*(parseInt(_0x106551(0x101))/0x9);if(_0x5ec0f3===_0x58ca1a)break;else _0xbb9dc0['push'](_0xbb9dc0['shift']());}catch(_0x2ed272){_0xbb9dc0['push'](_0xbb9dc0['shift']());}}}(a2_0x2227,0xc7e0b));import{jsx as a2_0xce3898,jsxs as a2_0x36231a}from'react/jsx-runtime';function a2_0x2227(){const _0x396301=['localeCompare','1290968udofdV','6662748pojnUR','name','570886bUWzFD','\x20Step1:\x20','return','isDirectory','templates/pages','green','join','2634876BxkpKT','error','downArrow','gray','\x20\x20\x20\x20\x20\x20>\x20','column','6699420JyBGAS','\x20\x20\x20\x20\x20\x20\x20\x20','onSelect','sort','map','resolve','获取模板列表失败:','442UwvoVC','正在加载页面模板...','22191EslLSK','length','blank','label','3104135Ndvbcg','../..','18cCCpLt'];a2_0x2227=function(){return _0x396301;};return a2_0x2227();}import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';function a2_0x35fe(_0x9eafcf,_0x3b5a76){_0x9eafcf=_0x9eafcf-0xf7;const _0x22270e=a2_0x2227();let _0x35fe33=_0x22270e[_0x9eafcf];return _0x35fe33;}import a2_0x22e0ef from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x285799=a2_0x35fe;try{const _0x3e6db7=fileURLToPath(import.meta.url),_0x43e8d7=a2_0x22e0ef[_0x285799(0xf7)](a2_0x22e0ef['dirname'](_0x3e6db7),_0x285799(0x100)),_0x3c2663=a2_0x22e0ef[_0x285799(0x10c)](_0x43e8d7,_0x285799(0x10a)),_0x1c2cc1=await readdir(_0x3c2663,{'withFileTypes':!![]}),_0x20aab0=_0x1c2cc1['filter'](_0x2c399f=>_0x2c399f[_0x285799(0x109)]())[_0x285799(0x117)](_0x594fae=>({'label':_0x594fae[_0x285799(0x105)]}))[_0x285799(0x116)]((_0x78c87f,_0x5ebc71)=>_0x78c87f[_0x285799(0xfe)][_0x285799(0x102)](_0x5ebc71[_0x285799(0xfe)]));return _0x20aab0;}catch(_0x3f06a0){return console[_0x285799(0x10e)](_0x285799(0xf8),_0x3f06a0),[{'label':_0x285799(0xfd)},{'label':'sdk-fetch'}];}}export function SelectPageTemplate(_0x126e3d){const _0x482c50=a2_0x35fe,[_0x5dc5df,_0x1fd9d8]=useState(0x0),[_0x1352e1,_0x3c6903]=useState([]),[_0x25a1b9,_0xb741c7]=useState(!![]);useEffect(()=>{async function _0x309f51(){const _0xbf19c4=await getTemplateList();_0x3c6903(_0xbf19c4),_0xb741c7(![]);}_0x309f51();},[]),useInput((_0xb2433f,_0x3a7e42)=>{const _0x432b21=a2_0x35fe;if(_0x25a1b9)return;if(_0x3a7e42[_0x432b21(0x108)]){const _0x342837=_0x1352e1[_0x5dc5df];_0x342837&&_0x126e3d[_0x432b21(0x115)](_0x342837['label']);}_0x3a7e42['upArrow']&&_0x1fd9d8(_0x2da048=>_0x2da048===0x0?_0x1352e1['length']-0x1:_0x2da048-0x1),_0x3a7e42[_0x432b21(0x10f)]&&_0x1fd9d8(_0x5c5c49=>_0x5c5c49===_0x1352e1[_0x432b21(0xfc)]-0x1?0x0:_0x5c5c49+0x1);});if(_0x25a1b9)return a2_0xce3898(Box,{'flexDirection':_0x482c50(0x112),'paddingY':0x1,'children':a2_0x36231a(Box,{'children':[a2_0xce3898(Text,{'color':'gray','children':_0x482c50(0x107)}),a2_0xce3898(Text,{'children':_0x482c50(0xfa)})]})});return a2_0x36231a(Box,{'flexDirection':_0x482c50(0x112),'paddingY':0x1,'children':[a2_0x36231a(Box,{'children':[a2_0xce3898(Text,{'color':_0x482c50(0x110),'children':_0x482c50(0x107)}),a2_0xce3898(Text,{'children':'请选择您要创建的页面模板'})]}),_0x1352e1[_0x482c50(0x117)]((_0xc9c7bf,_0xa8057f)=>{const _0x355e9c=_0x482c50,_0x291109=_0xa8057f===_0x5dc5df,_0x23ff71=_0x291109?_0x355e9c(0x111)+_0xc9c7bf['label']:_0x355e9c(0x114)+_0xc9c7bf[_0x355e9c(0xfe)];return a2_0xce3898(Box,{'children':a2_0xce3898(Text,{'color':_0x291109?_0x355e9c(0x10b):undefined,'children':_0x23ff71})},_0x23ff71);})]});}
@@ -1 +1 @@
1
- (function(_0x4da37e,_0x4cb8de){const _0x3c6e92=a3_0x47da,_0x488704=_0x4da37e();while(!![]){try{const _0x47da60=-parseInt(_0x3c6e92(0x179))/0x1+-parseInt(_0x3c6e92(0x172))/0x2+parseInt(_0x3c6e92(0x174))/0x3*(-parseInt(_0x3c6e92(0x186))/0x4)+parseInt(_0x3c6e92(0x19a))/0x5*(parseInt(_0x3c6e92(0x176))/0x6)+parseInt(_0x3c6e92(0x18d))/0x7*(parseInt(_0x3c6e92(0x166))/0x8)+-parseInt(_0x3c6e92(0x18f))/0x9+-parseInt(_0x3c6e92(0x16e))/0xa*(-parseInt(_0x3c6e92(0x198))/0xb);if(_0x47da60===_0x4cb8de)break;else _0x488704['push'](_0x488704['shift']());}catch(_0x7ca084){_0x488704['push'](_0x488704['shift']());}}}(a3_0x1701,0xc9133));import{jsx as a3_0x509f6a,jsxs as a3_0x4a0583,Fragment as a3_0x3dc7ea}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';function a3_0x47da(_0x5b0882,_0x45b7c1){_0x5b0882=_0x5b0882-0x160;const _0x170196=a3_0x1701();let _0x47daa1=_0x170196[_0x5b0882];return _0x47daa1;}import{generateDatasetDocs}from'./api-doc.js';function a3_0x1701(){const _0x21710f=['./docs','cyan','cwd','文档生成失败:\x20','未提供应用AppCode,且配置中也没有默认值','column','message','\x20个数据集','332DeGXfm','正在获取数据集列表...','\x1b[33m!\x20以下数据集代码不存在:\x20','log','red','正在生成\x20','datasetCode','7XWFidF','online','4972167xfFftu','\x1b[0m','datasetName','💡\x20请使用\x20','文档生成完成','\x20个匹配的数据集\x1b[0m','setLogPath','lovrabet\x20auth','white','11MXCXtT','includes','935245DkrdxC','\x20(环境:\x20','join','\x20-\x20','success','length','gray','*\x20输出目录:\x20','1387192VhpcNH','green','\x20个数据集的文档...','yellow','*\x20生成的文档文件:','🚀\x20','dim','√\x20文档生成完成!成功\x20','28640120ogdjfq','\x20重新登录后再试','使用指定的应用AppCode:\x20','error','2184002EJCEAS','\x1b[90m*\x20从\x20','12642CEnWHQ','filePath','12SJiWBp','api-doc','filter','593680wAftxh','map','指定的数据集代码都不存在:\x20','使用配置的应用AppCode:\x20','⚠️\x20以下数据集生成失败:'];a3_0x1701=function(){return _0x21710f;};return a3_0x1701();}import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x305179,env:_0x4cbce3,output:_0x2b7779,extraParams:_0x288f4a,datasetCodes:_0x3cf7b6})=>{const _0x382f83=a3_0x47da,{exit:_0x578176}=useApp(),[_0x31f342,_0x2013ba]=useState(![]),[_0x627c70,_0x227794]=useState(''),[_0x114c8a,_0x3679dc]=useState(![]),[_0x386800,_0x309466]=useState(null),[_0x42fba7,_0x40cb5c]=useState(null),[_0x5546b0,_0x4c597f]=useState(0x0),_0x785096=readConfig(),_0x3bdc8b=getConfigAppCode(),_0x28ff37=_0x305179||_0x3bdc8b,_0x3d9756=typeof _0x785096?.['env']==='string'?_0x785096['env']:undefined,_0x54df0a=_0x4cbce3||_0x3d9756||_0x382f83(0x18e);initEnv(_0x54df0a);const _0xee83a=_0x2b7779||_0x382f83(0x17e),_0x26334b=_0x305179?_0x382f83(0x170)+_0x28ff37:_0x382f83(0x17c)+_0x28ff37;useEffect(()=>{_0x2013ba(!![]),_0x18bf54();},[]),useEffect(()=>{(_0x114c8a||_0x386800)&&_0x578176();},[_0x114c8a,_0x386800,_0x578176]);async function _0x18bf54(){const _0x2f7bdf=_0x382f83;if(!_0x28ff37){_0x309466(_0x2f7bdf(0x182));return;}try{logger[_0x2f7bdf(0x195)](process[_0x2f7bdf(0x180)]()),_0x227794(_0x2f7bdf(0x187));const {configArray:_0x57f8e4}=await fetchModelList(_0x28ff37);_0x4c597f(_0x57f8e4['length']);if(_0x57f8e4[_0x2f7bdf(0x163)]===0x0){_0x309466('未找到任何数据集');return;}let _0x565a94=_0x57f8e4;if(_0x3cf7b6&&_0x3cf7b6[_0x2f7bdf(0x163)]>0x0){_0x565a94=_0x57f8e4[_0x2f7bdf(0x178)](_0x35d43d=>_0x3cf7b6[_0x2f7bdf(0x199)](_0x35d43d[_0x2f7bdf(0x18c)]));const _0x48761c=_0x565a94[_0x2f7bdf(0x17a)](_0x4fc837=>_0x4fc837[_0x2f7bdf(0x18c)]),_0x2ba17b=_0x3cf7b6['filter'](_0x3b0906=>!_0x48761c[_0x2f7bdf(0x199)](_0x3b0906));_0x2ba17b[_0x2f7bdf(0x163)]>0x0&&console[_0x2f7bdf(0x189)](_0x2f7bdf(0x188)+_0x2ba17b[_0x2f7bdf(0x160)](',\x20')+_0x2f7bdf(0x190));if(_0x565a94[_0x2f7bdf(0x163)]===0x0){_0x309466(_0x2f7bdf(0x17b)+_0x3cf7b6[_0x2f7bdf(0x160)](',\x20'));return;}console[_0x2f7bdf(0x189)](_0x2f7bdf(0x173)+_0x57f8e4[_0x2f7bdf(0x163)]+'\x20个数据集中筛选出\x20'+_0x565a94['length']+_0x2f7bdf(0x194));}_0x227794(_0x2f7bdf(0x18b)+_0x565a94[_0x2f7bdf(0x163)]+_0x2f7bdf(0x168));const _0x36b818=await generateDatasetDocs(_0x565a94,_0x28ff37,_0xee83a,(_0x2e176b,_0x56cb13,_0x5a9c6e)=>{const _0x425031=_0x2f7bdf;_0x227794(_0x425031(0x18b)+_0x5a9c6e+'.md\x20('+_0x2e176b+'/'+_0x56cb13+')');},_0x288f4a);_0x40cb5c(_0x36b818),_0x3679dc(!![]);const _0xd13e84=_0x36b818[_0x2f7bdf(0x178)](_0x42f129=>_0x42f129['success'])[_0x2f7bdf(0x163)],_0x144807=_0x36b818[_0x2f7bdf(0x178)](_0x33f1a5=>!_0x33f1a5['success'])[_0x2f7bdf(0x163)];logger[_0x2f7bdf(0x162)](_0x2f7bdf(0x177),_0x2f7bdf(0x193),undefined,{'totalCount':_0x36b818[_0x2f7bdf(0x163)],'successCount':_0xd13e84,'failCount':_0x144807,'outputDir':_0xee83a});}catch(_0x485f35){const _0x3aec49=_0x485f35 instanceof Error?_0x485f35[_0x2f7bdf(0x184)]:String(_0x485f35);logger[_0x2f7bdf(0x171)]('api-doc',_0x2f7bdf(0x181)+_0x3aec49,{'appCode':_0x28ff37,'outputDir':_0xee83a}),_0x309466(_0x2f7bdf(0x181)+_0x3aec49);}finally{_0x2013ba(![]);}}const _0x2aa961=_0x42fba7?.[_0x382f83(0x178)](_0x4182af=>_0x4182af['success'])['length']||0x0,_0x44192b=_0x42fba7?.[_0x382f83(0x178)](_0x1acc5e=>!_0x1acc5e['success'])[_0x382f83(0x163)]||0x0;return a3_0x4a0583(Box,{'flexDirection':_0x382f83(0x183),'children':[(_0x31f342||_0x114c8a)&&a3_0x4a0583(Box,{'children':[a3_0x509f6a(Text,{'color':_0x382f83(0x164),'children':'*\x20'}),a3_0x509f6a(Text,{'color':_0x305179?_0x382f83(0x197):_0x382f83(0x16c),'children':_0x26334b})]}),_0x31f342&&a3_0x509f6a(Box,{'children':a3_0x4a0583(Text,{'children':[_0x382f83(0x16b),_0x627c70,_0x382f83(0x19b),_0x54df0a,')']})}),_0x114c8a&&_0x42fba7&&a3_0x4a0583(Box,{'flexDirection':_0x382f83(0x183),'children':[a3_0x509f6a(Box,{'children':a3_0x4a0583(Text,{'color':_0x382f83(0x167),'children':[_0x382f83(0x16d),_0x2aa961,'\x20个',_0x44192b>0x0&&',\x20失败\x20'+_0x44192b+'\x20个']})}),a3_0x509f6a(Box,{'marginTop':0x1,'children':a3_0x4a0583(Text,{'color':'gray','children':['*\x20共处理\x20',_0x5546b0,_0x382f83(0x185)]})}),a3_0x4a0583(Box,{'marginTop':0x1,'children':[a3_0x509f6a(Text,{'color':_0x382f83(0x164),'children':_0x382f83(0x165)}),a3_0x509f6a(Text,{'color':_0x382f83(0x17f),'children':_0xee83a})]}),_0x2aa961>0x0&&a3_0x4a0583(a3_0x3dc7ea,{'children':[a3_0x509f6a(Box,{'marginTop':0x1,'children':a3_0x509f6a(Text,{'color':_0x382f83(0x164),'children':_0x382f83(0x16a)})}),_0x42fba7[_0x382f83(0x178)](_0x20ac01=>_0x20ac01[_0x382f83(0x162)])[_0x382f83(0x17a)]((_0x11eb5b,_0x165c16)=>a3_0x4a0583(Box,{'marginLeft':0x2,'children':[a3_0x4a0583(Text,{'color':'cyan','children':['•\x20',_0x11eb5b[_0x382f83(0x175)]]}),a3_0x4a0583(Text,{'color':_0x382f83(0x16c),'children':[_0x382f83(0x161),_0x11eb5b['datasetName']]})]},_0x165c16))]}),_0x44192b>0x0&&a3_0x4a0583(a3_0x3dc7ea,{'children':[a3_0x509f6a(Box,{'marginTop':0x1,'children':a3_0x509f6a(Text,{'color':_0x382f83(0x169),'children':_0x382f83(0x17d)})}),_0x42fba7[_0x382f83(0x178)](_0x2034b0=>!_0x2034b0[_0x382f83(0x162)])['map']((_0x220f70,_0x16536f)=>a3_0x4a0583(Box,{'marginLeft':0x2,'flexDirection':_0x382f83(0x183),'children':[a3_0x4a0583(Text,{'color':_0x382f83(0x18a),'children':['•\x20',_0x220f70[_0x382f83(0x191)],'\x20(',_0x220f70[_0x382f83(0x18c)],')']}),_0x220f70['error']&&a3_0x509f6a(Box,{'marginLeft':0x2,'children':a3_0x509f6a(Text,{'color':'dim','children':_0x220f70[_0x382f83(0x171)]})})]},_0x16536f))]})]}),_0x386800&&a3_0x4a0583(Box,{'flexDirection':'column','children':[a3_0x509f6a(Box,{'children':a3_0x4a0583(Text,{'color':_0x382f83(0x18a),'children':['❌\x20',_0x386800]})}),_0x386800[_0x382f83(0x199)]('登录')&&a3_0x4a0583(Box,{'marginTop':0x1,'children':[a3_0x509f6a(Text,{'color':_0x382f83(0x169),'children':_0x382f83(0x192)}),a3_0x509f6a(Text,{'color':_0x382f83(0x17f),'children':_0x382f83(0x196)}),a3_0x509f6a(Text,{'color':_0x382f83(0x169),'children':_0x382f83(0x16f)})]})]})]});};
1
+ (function(_0x4f109e,_0xd4882d){const _0x3b0b69=a3_0x2f23,_0x360bab=_0x4f109e();while(!![]){try{const _0x3ea34a=parseInt(_0x3b0b69(0x144))/0x1*(parseInt(_0x3b0b69(0x16d))/0x2)+parseInt(_0x3b0b69(0x155))/0x3+-parseInt(_0x3b0b69(0x13e))/0x4+-parseInt(_0x3b0b69(0x14b))/0x5*(parseInt(_0x3b0b69(0x14e))/0x6)+-parseInt(_0x3b0b69(0x148))/0x7+parseInt(_0x3b0b69(0x147))/0x8+parseInt(_0x3b0b69(0x151))/0x9*(-parseInt(_0x3b0b69(0x176))/0xa);if(_0x3ea34a===_0xd4882d)break;else _0x360bab['push'](_0x360bab['shift']());}catch(_0x2a7349){_0x360bab['push'](_0x360bab['shift']());}}}(a3_0x2af8,0x2a444));import{jsx as a3_0x1019c7,jsxs as a3_0x583f5b,Fragment as a3_0x15a049}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';function a3_0x2f23(_0x3fe2f6,_0xfa576c){_0x3fe2f6=_0x3fe2f6-0x13d;const _0x2af8c0=a3_0x2af8();let _0x2f2357=_0x2af8c0[_0x3fe2f6];return _0x2f2357;}import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';function a3_0x2af8(){const _0x4f680d=['🚀\x20','env','online','./docs','\x20个匹配的数据集\x1b[0m','log',',\x20失败\x20','red','文档生成完成','includes','使用配置的应用AppCode:\x20','未找到任何数据集','\x1b[33m!\x20以下数据集代码不存在:\x20','gray','文档生成失败:\x20','\x20-\x20','datasetName','💡\x20请使用\x20','*\x20共处理\x20','join','327458kmrBHV','dim','未提供应用AppCode,且配置中也没有默认值','√\x20文档生成完成!成功\x20','\x20个数据集中筛选出\x20','\x20重新登录后再试','green','.md\x20(','cwd','100610SdXTNP','success','825756zRHGJC','string','filter','lovrabet\x20auth','使用指定的应用AppCode:\x20','\x20个数据集','2XHJsHl','\x1b[0m','yellow','2254904LJdzBW','265314Uktcin','length','filePath','5YhsPCM','error','正在获取数据集列表...','973194brJUOn','datasetCode','map','243CMvSBu','white','cyan','\x20个数据集的文档...','725970hqmzxI','指定的数据集代码都不存在:\x20','column','api-doc'];a3_0x2af8=function(){return _0x4f680d;};return a3_0x2af8();}export const ApiDocUI=({appCode:_0x5ac28c,env:_0x3441c0,output:_0x135192,extraParams:_0x19099d,datasetCodes:_0x20aa5d})=>{const _0x336dfd=a3_0x2f23,{exit:_0x8a2d0c}=useApp(),[_0xe356f4,_0x11a68b]=useState(![]),[_0x479979,_0x373688]=useState(''),[_0x66cc35,_0xf8cae6]=useState(![]),[_0x249682,_0x8f8c15]=useState(null),[_0x5ba6fe,_0x11f395]=useState(null),[_0x7f7e00,_0x568f3d]=useState(0x0),_0x2a72a6=readConfig(),_0x5cfec0=getConfigAppCode(),_0x493d43=_0x5ac28c||_0x5cfec0,_0x56fdc7=typeof _0x2a72a6?.[_0x336dfd(0x15a)]===_0x336dfd(0x13f)?_0x2a72a6[_0x336dfd(0x15a)]:undefined,_0x556913=_0x3441c0||_0x56fdc7||_0x336dfd(0x15b);initEnv(_0x556913);const _0x36a134=_0x135192||_0x336dfd(0x15c),_0xb1cc57=_0x5ac28c?_0x336dfd(0x142)+_0x493d43:_0x336dfd(0x163)+_0x493d43;useEffect(()=>{_0x11a68b(!![]),_0x5b11bc();},[]),useEffect(()=>{(_0x66cc35||_0x249682)&&_0x8a2d0c();},[_0x66cc35,_0x249682,_0x8a2d0c]);async function _0x5b11bc(){const _0xb57054=_0x336dfd;if(!_0x493d43){_0x8f8c15(_0xb57054(0x16f));return;}try{logger['setLogPath'](process[_0xb57054(0x175)]()),_0x373688(_0xb57054(0x14d));const {configArray:_0x484d97}=await fetchModelList(_0x493d43);_0x568f3d(_0x484d97[_0xb57054(0x149)]);if(_0x484d97[_0xb57054(0x149)]===0x0){_0x8f8c15(_0xb57054(0x164));return;}let _0x3d5b68=_0x484d97;if(_0x20aa5d&&_0x20aa5d[_0xb57054(0x149)]>0x0){_0x3d5b68=_0x484d97['filter'](_0x1e268a=>_0x20aa5d[_0xb57054(0x162)](_0x1e268a[_0xb57054(0x14f)]));const _0x455e7b=_0x3d5b68['map'](_0x125805=>_0x125805['datasetCode']),_0x436032=_0x20aa5d[_0xb57054(0x140)](_0x4afd9b=>!_0x455e7b[_0xb57054(0x162)](_0x4afd9b));_0x436032[_0xb57054(0x149)]>0x0&&console[_0xb57054(0x15e)](_0xb57054(0x165)+_0x436032[_0xb57054(0x16c)](',\x20')+_0xb57054(0x145));if(_0x3d5b68['length']===0x0){_0x8f8c15(_0xb57054(0x156)+_0x20aa5d[_0xb57054(0x16c)](',\x20'));return;}console[_0xb57054(0x15e)]('\x1b[90m*\x20从\x20'+_0x484d97[_0xb57054(0x149)]+_0xb57054(0x171)+_0x3d5b68[_0xb57054(0x149)]+_0xb57054(0x15d));}_0x373688('正在生成\x20'+_0x3d5b68[_0xb57054(0x149)]+_0xb57054(0x154));const _0x307c8=await generateDatasetDocs(_0x3d5b68,_0x493d43,_0x36a134,(_0x5880dc,_0x5c476c,_0x1e2368)=>{const _0x15dd3c=_0xb57054;_0x373688('正在生成\x20'+_0x1e2368+_0x15dd3c(0x174)+_0x5880dc+'/'+_0x5c476c+')');},_0x19099d);_0x11f395(_0x307c8),_0xf8cae6(!![]);const _0x1827a6=_0x307c8[_0xb57054(0x140)](_0x1782d1=>_0x1782d1['success'])['length'],_0x33f0ba=_0x307c8[_0xb57054(0x140)](_0x18b0fa=>!_0x18b0fa[_0xb57054(0x13d)])[_0xb57054(0x149)];logger['success'](_0xb57054(0x158),_0xb57054(0x161),undefined,{'totalCount':_0x307c8[_0xb57054(0x149)],'successCount':_0x1827a6,'failCount':_0x33f0ba,'outputDir':_0x36a134});}catch(_0x35ff09){const _0x58365e=_0x35ff09 instanceof Error?_0x35ff09['message']:String(_0x35ff09);logger[_0xb57054(0x14c)]('api-doc',_0xb57054(0x167)+_0x58365e,{'appCode':_0x493d43,'outputDir':_0x36a134}),_0x8f8c15(_0xb57054(0x167)+_0x58365e);}finally{_0x11a68b(![]);}}const _0x389eeb=_0x5ba6fe?.[_0x336dfd(0x140)](_0x2853ce=>_0x2853ce[_0x336dfd(0x13d)])[_0x336dfd(0x149)]||0x0,_0x4aa955=_0x5ba6fe?.[_0x336dfd(0x140)](_0x4a3d60=>!_0x4a3d60[_0x336dfd(0x13d)])[_0x336dfd(0x149)]||0x0;return a3_0x583f5b(Box,{'flexDirection':_0x336dfd(0x157),'children':[(_0xe356f4||_0x66cc35)&&a3_0x583f5b(Box,{'children':[a3_0x1019c7(Text,{'color':_0x336dfd(0x166),'children':'*\x20'}),a3_0x1019c7(Text,{'color':_0x5ac28c?_0x336dfd(0x152):'dim','children':_0xb1cc57})]}),_0xe356f4&&a3_0x1019c7(Box,{'children':a3_0x583f5b(Text,{'children':[_0x336dfd(0x159),_0x479979,'\x20(环境:\x20',_0x556913,')']})}),_0x66cc35&&_0x5ba6fe&&a3_0x583f5b(Box,{'flexDirection':_0x336dfd(0x157),'children':[a3_0x1019c7(Box,{'children':a3_0x583f5b(Text,{'color':_0x336dfd(0x173),'children':[_0x336dfd(0x170),_0x389eeb,'\x20个',_0x4aa955>0x0&&_0x336dfd(0x15f)+_0x4aa955+'\x20个']})}),a3_0x1019c7(Box,{'marginTop':0x1,'children':a3_0x583f5b(Text,{'color':_0x336dfd(0x166),'children':[_0x336dfd(0x16b),_0x7f7e00,_0x336dfd(0x143)]})}),a3_0x583f5b(Box,{'marginTop':0x1,'children':[a3_0x1019c7(Text,{'color':_0x336dfd(0x166),'children':'*\x20输出目录:\x20'}),a3_0x1019c7(Text,{'color':'cyan','children':_0x36a134})]}),_0x389eeb>0x0&&a3_0x583f5b(a3_0x15a049,{'children':[a3_0x1019c7(Box,{'marginTop':0x1,'children':a3_0x1019c7(Text,{'color':_0x336dfd(0x166),'children':'*\x20生成的文档文件:'})}),_0x5ba6fe['filter'](_0x5e8603=>_0x5e8603[_0x336dfd(0x13d)])['map']((_0x19245f,_0x3fc8d9)=>a3_0x583f5b(Box,{'marginLeft':0x2,'children':[a3_0x583f5b(Text,{'color':_0x336dfd(0x153),'children':['•\x20',_0x19245f[_0x336dfd(0x14a)]]}),a3_0x583f5b(Text,{'color':_0x336dfd(0x16e),'children':[_0x336dfd(0x168),_0x19245f[_0x336dfd(0x169)]]})]},_0x3fc8d9))]}),_0x4aa955>0x0&&a3_0x583f5b(a3_0x15a049,{'children':[a3_0x1019c7(Box,{'marginTop':0x1,'children':a3_0x1019c7(Text,{'color':_0x336dfd(0x146),'children':'⚠️\x20以下数据集生成失败:'})}),_0x5ba6fe[_0x336dfd(0x140)](_0x1a5130=>!_0x1a5130[_0x336dfd(0x13d)])[_0x336dfd(0x150)]((_0x18a29a,_0x195623)=>a3_0x583f5b(Box,{'marginLeft':0x2,'flexDirection':_0x336dfd(0x157),'children':[a3_0x583f5b(Text,{'color':_0x336dfd(0x160),'children':['•\x20',_0x18a29a[_0x336dfd(0x169)],'\x20(',_0x18a29a[_0x336dfd(0x14f)],')']}),_0x18a29a[_0x336dfd(0x14c)]&&a3_0x1019c7(Box,{'marginLeft':0x2,'children':a3_0x1019c7(Text,{'color':'dim','children':_0x18a29a['error']})})]},_0x195623))]})]}),_0x249682&&a3_0x583f5b(Box,{'flexDirection':_0x336dfd(0x157),'children':[a3_0x1019c7(Box,{'children':a3_0x583f5b(Text,{'color':'red','children':['❌\x20',_0x249682]})}),_0x249682[_0x336dfd(0x162)]('登录')&&a3_0x583f5b(Box,{'marginTop':0x1,'children':[a3_0x1019c7(Text,{'color':'yellow','children':_0x336dfd(0x16a)}),a3_0x1019c7(Text,{'color':'cyan','children':_0x336dfd(0x141)}),a3_0x1019c7(Text,{'color':_0x336dfd(0x146),'children':_0x336dfd(0x172)})]})]})]});};
@@ -1 +1 @@
1
- const a4_0x2f87cd=a4_0x3554;(function(_0x1ed4e7,_0x30c2d8){const _0x176767=a4_0x3554,_0x3c6bdb=_0x1ed4e7();while(!![]){try{const _0xa3951a=parseInt(_0x176767(0x99))/0x1*(parseInt(_0x176767(0x9e))/0x2)+-parseInt(_0x176767(0x93))/0x3*(parseInt(_0x176767(0x91))/0x4)+parseInt(_0x176767(0x8f))/0x5+parseInt(_0x176767(0x88))/0x6*(-parseInt(_0x176767(0x7f))/0x7)+parseInt(_0x176767(0x7c))/0x8+-parseInt(_0x176767(0x9d))/0x9*(-parseInt(_0x176767(0x86))/0xa)+-parseInt(_0x176767(0x7a))/0xb*(parseInt(_0x176767(0x80))/0xc);if(_0xa3951a===_0x30c2d8)break;else _0x3c6bdb['push'](_0x3c6bdb['shift']());}catch(_0x543916){_0x3c6bdb['push'](_0x3c6bdb['shift']());}}}(a4_0x3934,0xa0ccb));import{mkdirSync,writeFileSync}from'node:fs';import a4_0x5befce from'node:path';import{getCookie}from'../auth/get-cookie.js';function a4_0x3554(_0x2642a5,_0x5af38a){_0x2642a5=_0x2642a5-0x76;const _0x39346b=a4_0x3934();let _0x3554d2=_0x39346b[_0x2642a5];return _0x3554d2;}import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0xa2c3e0){const _0x2c0738=a4_0x3554,{appCode:_0x3446c1,datasetCode:_0x5ba858,datasetId:_0x96133,extraParams:_0x3519e7}=_0xa2c3e0,_0x1f1265=getApiDomain(),_0x29f768=_0x1f1265+_0x2c0738(0x7b),_0x5d3a26={'appCode':_0x3446c1,'datasetCode':_0x5ba858,'datasetId':_0x96133,..._0x3519e7||{}},_0x2c65c9=await fetch(_0x29f768,{'method':_0x2c0738(0x8c),'headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON[_0x2c0738(0x7e)](_0x5d3a26)});if(!_0x2c65c9['ok']){if(_0x2c65c9[_0x2c0738(0x81)]===0x191)throw new Error(_0x2c0738(0x89));let _0x49c259='';try{_0x49c259=await _0x2c65c9[_0x2c0738(0x84)]();}catch(_0x3ffc33){}throw new Error(_0x2c0738(0x85)+_0x5ba858+'),HTTP状态码:\x20'+_0x2c65c9[_0x2c0738(0x81)]+(_0x49c259?'\x0a'+_0x49c259:''));}const _0x467753=await _0x2c65c9['json']();if(!_0x467753[_0x2c0738(0x8a)]||typeof _0x467753[_0x2c0738(0x8a)][_0x2c0738(0x8e)]!==_0x2c0738(0x78))throw new Error('响应数据格式错误\x20('+_0x5ba858+'):缺少\x20data.markdown\x20字段');return _0x467753[_0x2c0738(0x8a)][_0x2c0738(0x8e)];}function delay(_0x2d4c60){return new Promise(_0x240061=>setTimeout(_0x240061,_0x2d4c60));}export async function generateDatasetDocs(_0x5a1099,_0x1d7471,_0x15ed7f=a4_0x2f87cd(0x9a),_0x453c10,_0x4890c3){const _0x6e9a98=a4_0x2f87cd;mkdirSync(_0x15ed7f,{'recursive':!![]});const _0x2a2cd2=[],_0x54675c=_0x5a1099[_0x6e9a98(0x79)];console[_0x6e9a98(0x98)](_0x6e9a98(0x87)+_0x54675c+_0x6e9a98(0xa1));for(let _0x29b694=0x0;_0x29b694<_0x5a1099[_0x6e9a98(0x79)];_0x29b694++){const _0x3570e5=_0x5a1099[_0x29b694],_0x560618=_0x29b694+0x1,_0x1f9112=_0x3570e5[_0x6e9a98(0xa0)];try{console[_0x6e9a98(0x98)]('['+_0x560618+'/'+_0x54675c+_0x6e9a98(0x95)+_0x1f9112+_0x6e9a98(0x8b)+_0x3570e5[_0x6e9a98(0x7d)]+')');_0x453c10&&_0x453c10(_0x560618,_0x54675c,_0x1f9112);const _0xc4d1c7=await fetchDatasetDoc({'appCode':_0x1d7471,'datasetCode':_0x3570e5[_0x6e9a98(0xa2)],'datasetId':_0x3570e5['id'],'enableAI':![],'extraParams':_0x4890c3}),_0x52db75=a4_0x5befce[_0x6e9a98(0x76)](_0x15ed7f,_0x1f9112+_0x6e9a98(0x9b));writeFileSync(_0x52db75,_0xc4d1c7,{'encoding':_0x6e9a98(0x9c)}),console['log'](_0x6e9a98(0x9f)+_0x1f9112+'.md'),logger[_0x6e9a98(0x92)](_0x6e9a98(0x97),_0x6e9a98(0x83)+_0x1f9112,undefined,{'datasetCode':_0x3570e5[_0x6e9a98(0xa2)],'datasetName':_0x3570e5['name'],'filePath':_0x52db75,'progress':_0x560618+'/'+_0x54675c}),_0x2a2cd2['push']({'datasetCode':_0x3570e5['datasetCode'],'datasetName':_0x3570e5[_0x6e9a98(0x7d)],'filePath':_0x52db75,'success':!![]}),_0x560618<_0x54675c&&await delay(0x1388);}catch(_0x10931f){const _0x9cc224=_0x10931f instanceof Error?_0x10931f[_0x6e9a98(0xa3)]:String(_0x10931f);console[_0x6e9a98(0x98)](_0x6e9a98(0x77)+_0x1f9112+_0x6e9a98(0x94)+_0x9cc224+'\x0a'),logger[_0x6e9a98(0x90)]('api-doc',_0x6e9a98(0x96)+_0x3570e5[_0x6e9a98(0xa2)],{'datasetCode':_0x3570e5['datasetCode'],'datasetName':_0x3570e5[_0x6e9a98(0x7d)],'error':_0x9cc224,'progress':_0x560618+'/'+_0x54675c}),_0x2a2cd2[_0x6e9a98(0x8d)]({'datasetCode':_0x3570e5[_0x6e9a98(0xa2)],'datasetName':_0x3570e5['name'],'filePath':'','success':![],'error':_0x9cc224}),_0x560618<_0x54675c&&(console['log'](_0x6e9a98(0x82)),await delay(0xbb8));}}return _0x2a2cd2;}function a4_0x3934(){const _0xe4e6b=['796426uYigAA','✓\x20成功生成:\x20','tableName','\x20个数据集需要生成文档\x0a','datasetCode','message','join','✗\x20失败:\x20','string','length','88BwtQUe','/api/node-toolbox/api-doc-generator','9700128delArX','name','stringify','3409lmWjHw','296268gedCCv','status','等待\x203\x20秒...\x0a','生成文档成功:\x20','text','获取文档失败\x20(','10TnBDRl','\x0a共有\x20','11856ikMeTH','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','data','.md\x20(','POST','push','markdown','2438850jhtjIk','error','26916akZnXt','success','435eSavzR','.md\x20-\x20',']\x20正在生成:\x20','生成文档失败:\x20','api-doc','log','1UVgFkI','./docs','.md','utf8','6260985VZfuwB'];a4_0x3934=function(){return _0xe4e6b;};return a4_0x3934();}
1
+ const a4_0x3f42b0=a4_0x251e;(function(_0x25ada9,_0x3d2a2e){const _0x45dd3c=a4_0x251e,_0x24e1dd=_0x25ada9();while(!![]){try{const _0x5a4f1b=parseInt(_0x45dd3c(0xc5))/0x1+-parseInt(_0x45dd3c(0xb5))/0x2+-parseInt(_0x45dd3c(0xc0))/0x3*(parseInt(_0x45dd3c(0xc8))/0x4)+-parseInt(_0x45dd3c(0xcc))/0x5+parseInt(_0x45dd3c(0xb6))/0x6+parseInt(_0x45dd3c(0xbb))/0x7+parseInt(_0x45dd3c(0xaf))/0x8*(parseInt(_0x45dd3c(0xaa))/0x9);if(_0x5a4f1b===_0x3d2a2e)break;else _0x24e1dd['push'](_0x24e1dd['shift']());}catch(_0x194e92){_0x24e1dd['push'](_0x24e1dd['shift']());}}}(a4_0x3c53,0x883c7));import{mkdirSync,writeFileSync}from'node:fs';function a4_0x251e(_0x34554f,_0x2f5749){_0x34554f=_0x34554f-0xa8;const _0x3c531f=a4_0x3c53();let _0x251e12=_0x3c531f[_0x34554f];return _0x251e12;}import a4_0x5041a2 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x327780){const _0x54ef77=a4_0x251e,{appCode:_0x305093,datasetCode:_0x15f556,datasetId:_0x501c22,extraParams:_0x42d026}=_0x327780,_0x2f9be6=getApiDomain(),_0x5b2d8f=_0x2f9be6+_0x54ef77(0xd0),_0x38ca2f={'appCode':_0x305093,'datasetCode':_0x15f556,'datasetId':_0x501c22,..._0x42d026||{}},_0x5d946b=await fetch(_0x5b2d8f,{'method':'POST','headers':{'Content-Type':_0x54ef77(0xce),'Cookie':getCookie()},'body':JSON[_0x54ef77(0xab)](_0x38ca2f)});if(!_0x5d946b['ok']){if(_0x5d946b[_0x54ef77(0xc9)]===0x191)throw new Error(_0x54ef77(0xc3));let _0x2868ca='';try{_0x2868ca=await _0x5d946b[_0x54ef77(0xbf)]();}catch(_0x7914e9){}throw new Error(_0x54ef77(0xc4)+_0x15f556+_0x54ef77(0xae)+_0x5d946b[_0x54ef77(0xc9)]+(_0x2868ca?'\x0a'+_0x2868ca:''));}const _0x2a50e5=await _0x5d946b[_0x54ef77(0xb9)]();if(!_0x2a50e5['data']||typeof _0x2a50e5[_0x54ef77(0xcd)][_0x54ef77(0xc1)]!=='string')throw new Error(_0x54ef77(0xc7)+_0x15f556+_0x54ef77(0xa8));return _0x2a50e5['data'][_0x54ef77(0xc1)];}function delay(_0x30158b){return new Promise(_0x1f5da1=>setTimeout(_0x1f5da1,_0x30158b));}export async function generateDatasetDocs(_0x40d619,_0x31871a,_0x5d50a8=a4_0x3f42b0(0xca),_0x3d7963,_0x49b925){const _0x505176=a4_0x3f42b0;mkdirSync(_0x5d50a8,{'recursive':!![]});const _0x5b2d38=[],_0x2bf6af=_0x40d619[_0x505176(0xba)];console['log'](_0x505176(0xac)+_0x2bf6af+'\x20个数据集需要生成文档\x0a');for(let _0x2a7ed5=0x0;_0x2a7ed5<_0x40d619[_0x505176(0xba)];_0x2a7ed5++){const _0x300dc6=_0x40d619[_0x2a7ed5],_0x5eefb3=_0x2a7ed5+0x1,_0x4bfc69=_0x300dc6[_0x505176(0xcb)];try{console['log']('['+_0x5eefb3+'/'+_0x2bf6af+_0x505176(0xb4)+_0x4bfc69+'.md\x20('+_0x300dc6[_0x505176(0xad)]+')');_0x3d7963&&_0x3d7963(_0x5eefb3,_0x2bf6af,_0x4bfc69);const _0x2a481f=await fetchDatasetDoc({'appCode':_0x31871a,'datasetCode':_0x300dc6[_0x505176(0xb3)],'datasetId':_0x300dc6['id'],'enableAI':![],'extraParams':_0x49b925}),_0x5870d1=a4_0x5041a2[_0x505176(0xb0)](_0x5d50a8,_0x4bfc69+_0x505176(0xcf));writeFileSync(_0x5870d1,_0x2a481f,{'encoding':_0x505176(0xb1)}),console[_0x505176(0xc2)](_0x505176(0xbd)+_0x4bfc69+'.md'),logger[_0x505176(0xc6)](_0x505176(0xb7),_0x505176(0xbc)+_0x4bfc69,undefined,{'datasetCode':_0x300dc6[_0x505176(0xb3)],'datasetName':_0x300dc6[_0x505176(0xad)],'filePath':_0x5870d1,'progress':_0x5eefb3+'/'+_0x2bf6af}),_0x5b2d38[_0x505176(0xbe)]({'datasetCode':_0x300dc6['datasetCode'],'datasetName':_0x300dc6[_0x505176(0xad)],'filePath':_0x5870d1,'success':!![]}),_0x5eefb3<_0x2bf6af&&await delay(0x1388);}catch(_0x2ce8bc){const _0x15025a=_0x2ce8bc instanceof Error?_0x2ce8bc['message']:String(_0x2ce8bc);console[_0x505176(0xc2)]('✗\x20失败:\x20'+_0x4bfc69+'.md\x20-\x20'+_0x15025a+'\x0a'),logger[_0x505176(0xa9)](_0x505176(0xb7),_0x505176(0xb8)+_0x300dc6[_0x505176(0xb3)],{'datasetCode':_0x300dc6['datasetCode'],'datasetName':_0x300dc6[_0x505176(0xad)],'error':_0x15025a,'progress':_0x5eefb3+'/'+_0x2bf6af}),_0x5b2d38[_0x505176(0xbe)]({'datasetCode':_0x300dc6[_0x505176(0xb3)],'datasetName':_0x300dc6['name'],'filePath':'','success':![],'error':_0x15025a}),_0x5eefb3<_0x2bf6af&&(console[_0x505176(0xc2)](_0x505176(0xb2)),await delay(0xbb8));}}return _0x5b2d38;}function a4_0x3c53(){const _0x4d043f=['markdown','log','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','获取文档失败\x20(','888393iNdXhm','success','响应数据格式错误\x20(','4VyLwNz','status','./docs','tableName','117655UpLmZd','data','application/json','.md','/api/node-toolbox/api-doc-generator','):缺少\x20data.markdown\x20字段','error','36mCSwcr','stringify','\x0a共有\x20','name','),HTTP状态码:\x20','559600xJNyqf','join','utf8','等待\x203\x20秒...\x0a','datasetCode',']\x20正在生成:\x20','1610312kVpISa','2181714xnNqcb','api-doc','生成文档失败:\x20','json','length','6717753heMvWd','生成文档成功:\x20','✓\x20成功生成:\x20','push','text','3314343PPgIuH'];a4_0x3c53=function(){return _0x4d043f;};return a4_0x3c53();}
@@ -1 +1 @@
1
- function a5_0x1d47(_0x1b86fb,_0x283a68){_0x1b86fb=_0x1b86fb-0x1b7;const _0x150636=a5_0x1506();let _0x1d4711=_0x150636[_0x1b86fb];return _0x1d4711;}(function(_0x1a4c3b,_0x1e8112){const _0x2834d2=a5_0x1d47,_0x4bb38d=_0x1a4c3b();while(!![]){try{const _0x374771=parseInt(_0x2834d2(0x1e8))/0x1+-parseInt(_0x2834d2(0x1e0))/0x2*(-parseInt(_0x2834d2(0x1c9))/0x3)+parseInt(_0x2834d2(0x1bd))/0x4+parseInt(_0x2834d2(0x1b8))/0x5*(-parseInt(_0x2834d2(0x1d5))/0x6)+parseInt(_0x2834d2(0x1c2))/0x7+parseInt(_0x2834d2(0x1ed))/0x8+-parseInt(_0x2834d2(0x1ea))/0x9*(parseInt(_0x2834d2(0x1d3))/0xa);if(_0x374771===_0x1e8112)break;else _0x4bb38d['push'](_0x4bb38d['shift']());}catch(_0x4e3ada){_0x4bb38d['push'](_0x4bb38d['shift']());}}}(a5_0x1506,0x7a816));import{jsx as a5_0x50ae97,jsxs as a5_0x5337fc}from'react/jsx-runtime';import{useEffect,useState}from'react';function a5_0x1506(){const _0x2f961b=['client','originalCount','拉取\x20API\x20配置失败:\x20','api-pull','6TKAwuN','string','green','-client','length','duplicateCount','*\x20导入方式:','\x20个模型','lovrabet\x20auth','replace','10IkDeYA','\x20个模型)','164244tlSFMO','gray','import\x20','\x20重新登录后再试','cyan','√\x20成功拉取\x20','datasetCount','setLogPath','*\x20已生成文件:','env','api','267724lUlFfJ','red','\x20-\x20客户端实例文件','dim','column','.ts','-\x20模型配置文件\x20(','endsWith','666175vzFdsR','join','11755323HvvXKF','使用指定的应用AppCode:\x20','\x20个,过滤重复','734400oKprvX','modelCount','{\x20lovrabetClient\x20}','white','\x20个数据集,生成','5LIeFxZ','./src/api/','online','未提供应用AppCode,且配置中也没有默认值','使用配置的应用AppCode:\x20','1286616WaYKFL','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','!\x20原始数据集\x20','includes','message','3415650jVIKKd','error','split'];a5_0x1506=function(){return _0x2f961b;};return a5_0x1506();}import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x4d6d78,env:_0x4d648b,output:_0x1b4f25})=>{const _0x1d8e1f=a5_0x1d47,{exit:_0xe131a3}=useApp(),[_0x5eaad9,_0x341ec8]=useState(![]),[_0x6fdb56,_0x2d496a]=useState(![]),[_0x2da05f,_0x52bfad]=useState(null),[_0x1b7b49,_0x223414]=useState(null),_0x420b7b=readConfig(),_0x34610e=getConfigAppCode(),_0x54e9ef=_0x4d6d78||_0x34610e,_0x38be39=typeof _0x420b7b?.[_0x1d8e1f(0x1de)]===_0x1d8e1f(0x1ca)?_0x420b7b[_0x1d8e1f(0x1de)]:undefined,_0x44e1a7=_0x4d648b||_0x38be39||_0x1d8e1f(0x1ba);initEnv(_0x44e1a7);const _0x557f97=_0x1b4f25||_0x1d8e1f(0x1b9),_0x2f3dde=_0x4d6d78&&_0x4d6d78[_0x1d8e1f(0x1c0)]('-')?_0x4d6d78[_0x1d8e1f(0x1c4)]('-')['slice'](0x1)[_0x1d8e1f(0x1e9)]('-'):'',_0x3e8fbd=_0x4d6d78?_0x1d8e1f(0x1eb)+_0x54e9ef:_0x1d8e1f(0x1bc)+_0x54e9ef,_0x3363ab=_0x2f3dde?_0x2f3dde+'-api':_0x1d8e1f(0x1df),_0x2af79b=_0x2f3dde?_0x2f3dde+_0x1d8e1f(0x1cc):_0x1d8e1f(0x1c5);useEffect(()=>{_0x341ec8(!![]),_0x4a856e();},[]),useEffect(()=>{(_0x6fdb56||_0x2da05f)&&_0xe131a3();},[_0x6fdb56,_0x2da05f,_0xe131a3]);async function _0x4a856e(){const _0xb66bd9=_0x1d8e1f;if(!_0x54e9ef){_0x52bfad(_0xb66bd9(0x1bb));return;}try{logger[_0xb66bd9(0x1dc)](process['cwd']());const {configArray:_0x24751b}=await fetchModelList(_0x54e9ef),_0x498ce2=_0x24751b[_0xb66bd9(0x1cd)],_0x13b249=!_0x4d6d78,_0x3c1a25=await generateApiFile(_0x24751b,_0x2f3dde,_0x54e9ef,_0x13b249,_0x44e1a7,_0x557f97),_0x338256=_0x557f97[_0xb66bd9(0x1e7)]('/')?_0x557f97:_0x557f97+'/';_0x223414({'api':''+_0x338256+_0x3363ab+_0xb66bd9(0x1e5),'client':''+_0x338256+_0x2af79b+'.ts','modelCount':_0x3c1a25['modelCount'],'datasetCount':_0x498ce2,'originalCount':_0x498ce2,'duplicateCount':0x0}),_0x2d496a(!![]);}catch(_0x23579a){const _0x12ca4e=_0x23579a instanceof Error?_0x23579a[_0xb66bd9(0x1c1)]:String(_0x23579a);logger[_0xb66bd9(0x1c3)](_0xb66bd9(0x1c8),_0xb66bd9(0x1c7)+_0x12ca4e,{'appCode':_0x54e9ef,'error':_0x12ca4e}),_0x52bfad(_0xb66bd9(0x1c7)+_0x12ca4e);}finally{_0x341ec8(![]);}}return a5_0x5337fc(Box,{'flexDirection':_0x1d8e1f(0x1e4),'children':[(_0x5eaad9||_0x6fdb56)&&a5_0x5337fc(Box,{'children':[a5_0x50ae97(Text,{'color':_0x1d8e1f(0x1d6),'children':'*\x20'}),a5_0x50ae97(Text,{'color':_0x4d6d78?_0x1d8e1f(0x1f0):_0x1d8e1f(0x1e3),'children':_0x3e8fbd})]}),_0x5eaad9&&a5_0x50ae97(Box,{'children':a5_0x5337fc(Text,{'children':[_0x1d8e1f(0x1be),_0x44e1a7,')']})}),_0x6fdb56&&_0x1b7b49&&a5_0x5337fc(Box,{'flexDirection':'column','children':[a5_0x50ae97(Box,{'children':a5_0x5337fc(Text,{'color':_0x1d8e1f(0x1cb),'children':[_0x1d8e1f(0x1da),_0x1b7b49[_0x1d8e1f(0x1db)],_0x1d8e1f(0x1b7),'\x20',_0x1b7b49[_0x1d8e1f(0x1ee)],_0x1d8e1f(0x1d0)]})}),_0x1b7b49[_0x1d8e1f(0x1ce)]>0x0&&a5_0x50ae97(Box,{'marginTop':0x1,'children':a5_0x5337fc(Text,{'color':'yellow','children':[_0x1d8e1f(0x1bf),_0x1b7b49[_0x1d8e1f(0x1c6)],_0x1d8e1f(0x1ec),'\x20',_0x1b7b49[_0x1d8e1f(0x1ce)],'\x20个']})}),a5_0x50ae97(Box,{'marginTop':0x1,'children':a5_0x50ae97(Text,{'color':_0x1d8e1f(0x1d6),'children':_0x1d8e1f(0x1dd)})}),a5_0x5337fc(Box,{'marginLeft':0x2,'children':[a5_0x5337fc(Text,{'color':'cyan','children':['•\x20',_0x1b7b49[_0x1d8e1f(0x1df)]]}),a5_0x5337fc(Text,{'color':_0x1d8e1f(0x1e3),'children':['\x20',_0x1d8e1f(0x1e6),_0x1b7b49[_0x1d8e1f(0x1ee)],_0x1d8e1f(0x1d4)]})]}),a5_0x5337fc(Box,{'marginLeft':0x2,'children':[a5_0x5337fc(Text,{'color':'cyan','children':['•\x20',_0x1b7b49[_0x1d8e1f(0x1c5)]]}),a5_0x50ae97(Text,{'color':'dim','children':_0x1d8e1f(0x1e2)})]}),a5_0x50ae97(Box,{'marginTop':0x1,'children':a5_0x50ae97(Text,{'color':_0x1d8e1f(0x1d6),'children':_0x1d8e1f(0x1cf)})}),a5_0x50ae97(Box,{'marginLeft':0x2,'children':a5_0x5337fc(Text,{'color':'yellow','children':[_0x1d8e1f(0x1d7),_0x1d8e1f(0x1ef),'\x20from\x20\x27@/',_0x1b7b49['client'][_0x1d8e1f(0x1d2)](/^\.\//,'')['replace'](_0x1d8e1f(0x1e5),''),'\x27']})})]}),_0x2da05f&&a5_0x5337fc(Box,{'flexDirection':_0x1d8e1f(0x1e4),'children':[a5_0x50ae97(Box,{'children':a5_0x5337fc(Text,{'color':_0x1d8e1f(0x1e1),'children':['❌\x20',_0x2da05f]})}),_0x2da05f[_0x1d8e1f(0x1c0)]('登录')&&a5_0x5337fc(Box,{'marginTop':0x1,'children':[a5_0x50ae97(Text,{'color':'yellow','children':'💡\x20请使用\x20'}),a5_0x50ae97(Text,{'color':_0x1d8e1f(0x1d9),'children':_0x1d8e1f(0x1d1)}),a5_0x50ae97(Text,{'color':'yellow','children':_0x1d8e1f(0x1d8)})]})]})]});};
1
+ (function(_0x10a683,_0x79fb07){const _0x4fce99=a5_0x3688,_0xaa6d4=_0x10a683();while(!![]){try{const _0x5997a0=parseInt(_0x4fce99(0x190))/0x1+parseInt(_0x4fce99(0x178))/0x2*(-parseInt(_0x4fce99(0x187))/0x3)+parseInt(_0x4fce99(0x17a))/0x4*(-parseInt(_0x4fce99(0x18e))/0x5)+parseInt(_0x4fce99(0x193))/0x6*(parseInt(_0x4fce99(0x197))/0x7)+parseInt(_0x4fce99(0x161))/0x8+-parseInt(_0x4fce99(0x18f))/0x9+-parseInt(_0x4fce99(0x182))/0xa*(parseInt(_0x4fce99(0x172))/0xb);if(_0x5997a0===_0x79fb07)break;else _0xaa6d4['push'](_0xaa6d4['shift']());}catch(_0x2e9e5c){_0xaa6d4['push'](_0xaa6d4['shift']());}}}(a5_0x2791,0x53e5c));function a5_0x2791(){const _0x512d2e=['originalCount','2622ljjwus','column','api','.ts','2317QjjfPo','yellow','split','4772224tPusdQ','*\x20已生成文件:','\x20个模型)','includes','./src/api/','endsWith','replace','\x20个数据集,生成','import\x20','{\x20lovrabetClient\x20}','red','online','setLogPath','\x20-\x20客户端实例文件','拉取\x20API\x20配置失败:\x20','\x20个模型','\x20个,过滤重复','44cdlfhc','string','datasetCount','未提供应用AppCode,且配置中也没有默认值','client','api-pull','2PvFkLy','join','4laYDcZ','dim','green','gray','-api','-\x20模型配置文件\x20(','slice','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','749390foKZJc','*\x20导入方式:','message','duplicateCount','使用配置的应用AppCode:\x20','783312adhhPs','√\x20成功拉取\x20','\x20from\x20\x27@/','env','modelCount','💡\x20请使用\x20','error','577800EjvGZP','2523528DpooRY','559281HVYnlJ','cyan'];a5_0x2791=function(){return _0x512d2e;};return a5_0x2791();}import{jsx as a5_0x14cde5,jsxs as a5_0x3d8bcc}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a5_0x3688(_0x3697e6,_0x480778){_0x3697e6=_0x3697e6-0x161;const _0x279114=a5_0x2791();let _0x368842=_0x279114[_0x3697e6];return _0x368842;}import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x3ab490,env:_0x1dc9e5,output:_0x58ac03})=>{const _0x24f070=a5_0x3688,{exit:_0xe50f3c}=useApp(),[_0x5ab35f,_0x280f65]=useState(![]),[_0x20e729,_0x3f1890]=useState(![]),[_0x2dc68c,_0xb99463]=useState(null),[_0x4e706b,_0x43d803]=useState(null),_0x46db0c=readConfig(),_0x33aeea=getConfigAppCode(),_0x4bb84c=_0x3ab490||_0x33aeea,_0x3b3cd5=typeof _0x46db0c?.[_0x24f070(0x18a)]===_0x24f070(0x173)?_0x46db0c[_0x24f070(0x18a)]:undefined,_0x1092e0=_0x1dc9e5||_0x3b3cd5||_0x24f070(0x16c);initEnv(_0x1092e0);const _0x14bcc6=_0x58ac03||_0x24f070(0x165),_0x27c5fd=_0x3ab490&&_0x3ab490[_0x24f070(0x164)]('-')?_0x3ab490[_0x24f070(0x199)]('-')[_0x24f070(0x180)](0x1)[_0x24f070(0x179)]('-'):'',_0xcf5fae=_0x3ab490?'使用指定的应用AppCode:\x20'+_0x4bb84c:_0x24f070(0x186)+_0x4bb84c,_0x5c2856=_0x27c5fd?_0x27c5fd+_0x24f070(0x17e):_0x24f070(0x195),_0x175df5=_0x27c5fd?_0x27c5fd+'-client':_0x24f070(0x176);useEffect(()=>{_0x280f65(!![]),_0x59e3a1();},[]),useEffect(()=>{(_0x20e729||_0x2dc68c)&&_0xe50f3c();},[_0x20e729,_0x2dc68c,_0xe50f3c]);async function _0x59e3a1(){const _0x34926f=_0x24f070;if(!_0x4bb84c){_0xb99463(_0x34926f(0x175));return;}try{logger[_0x34926f(0x16d)](process['cwd']());const {configArray:_0x4bab8b}=await fetchModelList(_0x4bb84c),_0x493a53=_0x4bab8b['length'],_0x55bcc7=!_0x3ab490,_0x35a678=await generateApiFile(_0x4bab8b,_0x27c5fd,_0x4bb84c,_0x55bcc7,_0x1092e0,_0x14bcc6),_0x1e73e7=_0x14bcc6[_0x34926f(0x166)]('/')?_0x14bcc6:_0x14bcc6+'/';_0x43d803({'api':''+_0x1e73e7+_0x5c2856+_0x34926f(0x196),'client':''+_0x1e73e7+_0x175df5+_0x34926f(0x196),'modelCount':_0x35a678[_0x34926f(0x18b)],'datasetCount':_0x493a53,'originalCount':_0x493a53,'duplicateCount':0x0}),_0x3f1890(!![]);}catch(_0x508c15){const _0xa3c36a=_0x508c15 instanceof Error?_0x508c15[_0x34926f(0x184)]:String(_0x508c15);logger[_0x34926f(0x18d)](_0x34926f(0x177),_0x34926f(0x16f)+_0xa3c36a,{'appCode':_0x4bb84c,'error':_0xa3c36a}),_0xb99463(_0x34926f(0x16f)+_0xa3c36a);}finally{_0x280f65(![]);}}return a5_0x3d8bcc(Box,{'flexDirection':_0x24f070(0x194),'children':[(_0x5ab35f||_0x20e729)&&a5_0x3d8bcc(Box,{'children':[a5_0x14cde5(Text,{'color':'gray','children':'*\x20'}),a5_0x14cde5(Text,{'color':_0x3ab490?'white':'dim','children':_0xcf5fae})]}),_0x5ab35f&&a5_0x14cde5(Box,{'children':a5_0x3d8bcc(Text,{'children':[_0x24f070(0x181),_0x1092e0,')']})}),_0x20e729&&_0x4e706b&&a5_0x3d8bcc(Box,{'flexDirection':_0x24f070(0x194),'children':[a5_0x14cde5(Box,{'children':a5_0x3d8bcc(Text,{'color':_0x24f070(0x17c),'children':[_0x24f070(0x188),_0x4e706b[_0x24f070(0x174)],_0x24f070(0x168),'\x20',_0x4e706b[_0x24f070(0x18b)],_0x24f070(0x170)]})}),_0x4e706b[_0x24f070(0x185)]>0x0&&a5_0x14cde5(Box,{'marginTop':0x1,'children':a5_0x3d8bcc(Text,{'color':_0x24f070(0x198),'children':['!\x20原始数据集\x20',_0x4e706b[_0x24f070(0x192)],_0x24f070(0x171),'\x20',_0x4e706b[_0x24f070(0x185)],'\x20个']})}),a5_0x14cde5(Box,{'marginTop':0x1,'children':a5_0x14cde5(Text,{'color':_0x24f070(0x17d),'children':_0x24f070(0x162)})}),a5_0x3d8bcc(Box,{'marginLeft':0x2,'children':[a5_0x3d8bcc(Text,{'color':_0x24f070(0x191),'children':['•\x20',_0x4e706b[_0x24f070(0x195)]]}),a5_0x3d8bcc(Text,{'color':'dim','children':['\x20',_0x24f070(0x17f),_0x4e706b[_0x24f070(0x18b)],_0x24f070(0x163)]})]}),a5_0x3d8bcc(Box,{'marginLeft':0x2,'children':[a5_0x3d8bcc(Text,{'color':_0x24f070(0x191),'children':['•\x20',_0x4e706b[_0x24f070(0x176)]]}),a5_0x14cde5(Text,{'color':_0x24f070(0x17b),'children':_0x24f070(0x16e)})]}),a5_0x14cde5(Box,{'marginTop':0x1,'children':a5_0x14cde5(Text,{'color':_0x24f070(0x17d),'children':_0x24f070(0x183)})}),a5_0x14cde5(Box,{'marginLeft':0x2,'children':a5_0x3d8bcc(Text,{'color':'yellow','children':[_0x24f070(0x169),_0x24f070(0x16a),_0x24f070(0x189),_0x4e706b['client'][_0x24f070(0x167)](/^\.\//,'')[_0x24f070(0x167)](_0x24f070(0x196),''),'\x27']})})]}),_0x2dc68c&&a5_0x3d8bcc(Box,{'flexDirection':_0x24f070(0x194),'children':[a5_0x14cde5(Box,{'children':a5_0x3d8bcc(Text,{'color':_0x24f070(0x16b),'children':['❌\x20',_0x2dc68c]})}),_0x2dc68c['includes']('登录')&&a5_0x3d8bcc(Box,{'marginTop':0x1,'children':[a5_0x14cde5(Text,{'color':'yellow','children':_0x24f070(0x18c)}),a5_0x14cde5(Text,{'color':_0x24f070(0x191),'children':'lovrabet\x20auth'}),a5_0x14cde5(Text,{'color':_0x24f070(0x198),'children':'\x20重新登录后再试'})]})]})]});};
@@ -1 +1 @@
1
- function a6_0xe36b(_0x17efb9,_0x184b0c){_0x17efb9=_0x17efb9-0x1bc;const _0xfb390=a6_0xfb39();let _0xe36b4d=_0xfb390[_0x17efb9];return _0xe36b4d;}(function(_0xd6fe97,_0x423e06){const _0x1e25d8=a6_0xe36b,_0x2112f0=_0xd6fe97();while(!![]){try{const _0x1053c6=parseInt(_0x1e25d8(0x1cb))/0x1+-parseInt(_0x1e25d8(0x1c7))/0x2*(parseInt(_0x1e25d8(0x1c6))/0x3)+-parseInt(_0x1e25d8(0x1ca))/0x4*(parseInt(_0x1e25d8(0x1c8))/0x5)+parseInt(_0x1e25d8(0x1c0))/0x6+parseInt(_0x1e25d8(0x1cc))/0x7+-parseInt(_0x1e25d8(0x1cf))/0x8+parseInt(_0x1e25d8(0x1bc))/0x9*(parseInt(_0x1e25d8(0x1ce))/0xa);if(_0x1053c6===_0x423e06)break;else _0x2112f0['push'](_0x2112f0['shift']());}catch(_0x395ee9){_0x2112f0['push'](_0x2112f0['shift']());}}}(a6_0xfb39,0xd448f));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';function a6_0xfb39(){const _0x4cb7dd=['data','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','info','3728166xUKDKL','2DjJJzt','971430iiaHsu','fetch-model-list','16ySNZqs','52284gYpPhk','11940936rfYuBt','&otype=array','100rXDluu','13611240tilfVa','status','2125539PSonJu','json','未知错误','configArray','2825688pefCYb','message','获取数据集失败,HTTP状态码:\x20'];a6_0xfb39=function(){return _0x4cb7dd;};return a6_0xfb39();}export async function fetchModelList(_0x361c35){const _0x466bfd=a6_0xe36b,_0x2f9c2b=getEnv(),_0x513d1b=getApiDomain()+'/api/node-toolbox/dataset/model-list?appcode='+_0x361c35+_0x466bfd(0x1cd);logger[_0x466bfd(0x1c5)](_0x466bfd(0x1c9),'正在从服务器拉取模型列表...\x20(环境:\x20'+_0x2f9c2b+')',{'apiUrl':_0x513d1b});const _0x18b739=await fetch(_0x513d1b,{'headers':{'Cookie':getCookie()}});if(!_0x18b739['ok']){if(_0x18b739[_0x466bfd(0x1d0)]===0x191)throw new Error(_0x466bfd(0x1c4));throw new Error(_0x466bfd(0x1c2)+_0x18b739['status']);}const _0x50d634=await _0x18b739[_0x466bfd(0x1bd)]();if(!_0x50d634['success'])throw new Error('获取数据集失败:\x20'+(_0x50d634[_0x466bfd(0x1c1)]||_0x466bfd(0x1be)));return{'configArray':_0x50d634[_0x466bfd(0x1c3)][_0x466bfd(0x1bf)],'count':_0x50d634[_0x466bfd(0x1c3)]['count']};}
1
+ function a6_0x1cee(){const _0x40e7a4=['data','401','json','1csLffP','正在从服务器拉取模型列表...\x20(环境:\x20','code','errorCode','812858qAlrZF','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','12yuPhoV','success','108660qeThVd','&otype=array','3vJkuQf','status','116163lAmaaq','517xlXYWe','error','count','2926859UVmaap','Unauthorized','errorMsg','/api/node-toolbox/dataset/model-list?appcode=','56zZWMZd','UNAUTHORIZED','未知错误','1592744MIpdoC','170KBcxox','获取数据集失败:\x20','7AsfBAx','configArray','获取数据集失败,HTTP状态码:\x20','1035784BXDRmB','errorMessage','includes','595860nenYJK'];a6_0x1cee=function(){return _0x40e7a4;};return a6_0x1cee();}function a6_0x1e74(_0x3373d4,_0x4b2e78){_0x3373d4=_0x3373d4-0x175;const _0x1cee13=a6_0x1cee();let _0x1e746f=_0x1cee13[_0x3373d4];return _0x1e746f;}(function(_0x16dc6b,_0x94f81a){const _0x2b452e=a6_0x1e74,_0x8c05e8=_0x16dc6b();while(!![]){try{const _0x296172=parseInt(_0x2b452e(0x187))/0x1*(-parseInt(_0x2b452e(0x18b))/0x2)+-parseInt(_0x2b452e(0x191))/0x3*(parseInt(_0x2b452e(0x17a))/0x4)+parseInt(_0x2b452e(0x183))/0x5*(parseInt(_0x2b452e(0x18d))/0x6)+parseInt(_0x2b452e(0x17d))/0x7*(parseInt(_0x2b452e(0x180))/0x8)+-parseInt(_0x2b452e(0x193))/0x9*(-parseInt(_0x2b452e(0x17b))/0xa)+parseInt(_0x2b452e(0x194))/0xb*(-parseInt(_0x2b452e(0x18f))/0xc)+parseInt(_0x2b452e(0x197))/0xd*(parseInt(_0x2b452e(0x177))/0xe);if(_0x296172===_0x94f81a)break;else _0x8c05e8['push'](_0x8c05e8['shift']());}catch(_0x28ca0b){_0x8c05e8['push'](_0x8c05e8['shift']());}}}(a6_0x1cee,0x3ee48));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';export async function fetchModelList(_0x1278e2){const _0x142082=a6_0x1e74,_0x178d98=getEnv(),_0x168632=getApiDomain()+_0x142082(0x176)+_0x1278e2+_0x142082(0x190);logger['info']('fetch-model-list',_0x142082(0x188)+_0x178d98+')',{'apiUrl':_0x168632});const _0x226455=await fetch(_0x168632,{'headers':{'Cookie':getCookie()}});if(!_0x226455['ok']){if(_0x226455[_0x142082(0x192)]===0x191)throw new Error(_0x142082(0x18c));throw new Error(_0x142082(0x17f)+_0x226455[_0x142082(0x192)]);}const _0x3960b0=await _0x226455[_0x142082(0x186)]();if(!_0x3960b0[_0x142082(0x18e)]){const _0x15f655=_0x3960b0[_0x142082(0x175)]||_0x3960b0['message']||_0x3960b0['data']?.['message']||_0x3960b0[_0x142082(0x181)]||_0x3960b0[_0x142082(0x195)]||_0x142082(0x179);if(_0x15f655[_0x142082(0x182)](_0x142082(0x185))||_0x15f655[_0x142082(0x182)](_0x142082(0x198))||_0x15f655[_0x142082(0x182)]('登录')||_0x15f655[_0x142082(0x182)]('认证')||_0x3960b0[_0x142082(0x18a)]===_0x142082(0x178)||_0x3960b0[_0x142082(0x189)]===0x191||_0x3960b0['code']===_0x142082(0x185))throw new Error(_0x142082(0x18c));throw new Error(_0x142082(0x17c)+_0x15f655);}return{'configArray':_0x3960b0[_0x142082(0x184)][_0x142082(0x17e)],'count':_0x3960b0[_0x142082(0x184)][_0x142082(0x196)]};}
@@ -1 +1 @@
1
- const a7_0x458b82=a7_0x126b;(function(_0x3c8f59,_0x51daf5){const _0x17f8c7=a7_0x126b,_0x2c0def=_0x3c8f59();while(!![]){try{const _0x4ad07a=parseInt(_0x17f8c7(0x1d9))/0x1*(-parseInt(_0x17f8c7(0x1f3))/0x2)+-parseInt(_0x17f8c7(0x1e7))/0x3+-parseInt(_0x17f8c7(0x1f8))/0x4+-parseInt(_0x17f8c7(0x1e2))/0x5+-parseInt(_0x17f8c7(0x1ec))/0x6+-parseInt(_0x17f8c7(0x1f4))/0x7+parseInt(_0x17f8c7(0x1f0))/0x8*(parseInt(_0x17f8c7(0x1fe))/0x9);if(_0x4ad07a===_0x51daf5)break;else _0x2c0def['push'](_0x2c0def['shift']());}catch(_0x528370){_0x2c0def['push'](_0x2c0def['shift']());}}}(a7_0x4f7f,0x8391f));import a7_0x4880d3 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x4ebfad from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0xd60cda,_0x8bee5d='',_0x1613c9,_0x54871c=![],_0x4815b5,_0x355abd=a7_0x458b82(0x1d7)){const _0x58d1ec=a7_0x458b82,_0x43aaef=readConfig(),_0x48b415=_0x1613c9||_0x43aaef?.[_0x58d1ec(0x1de)];if(typeof _0x48b415!==_0x58d1ec(0x1d8)||!_0x48b415)throw new Error(_0x58d1ec(0x1e3));const _0x5c9a11=_0x54871c?_0x58d1ec(0x1f6):'\x22'+_0x48b415+'\x22',_0x19ac26=typeof _0x43aaef[_0x58d1ec(0x1eb)]===_0x58d1ec(0x1d8)?_0x43aaef[_0x58d1ec(0x1eb)]:undefined,_0x1c34cb=_0x4815b5||_0x19ac26||_0x58d1ec(0x1e5),_0x9940af=_0x1c34cb!=='online';let _0x42e794;if(_0x54871c)_0x9940af?_0x42e794=_0x58d1ec(0x1ea)+_0x5c9a11+_0x58d1ec(0x1fa)+_0x1c34cb+'\x22\x20}':_0x42e794='';else{const _0x5387f8=_0x9940af?_0x58d1ec(0x1fa)+_0x1c34cb+'\x22':'';_0x42e794=_0x58d1ec(0x1f2)+_0x48b415+'\x22'+_0x5387f8+'\x20}';}const _0x183ee4=_0x8bee5d?_0x8bee5d+_0x58d1ec(0x1e0):_0x58d1ec(0x1e1),_0x34d3d0=_0x8bee5d?_0x8bee5d+'-client':_0x58d1ec(0x1ee),_0x1d2972=[];_0xd60cda['forEach'](_0x182405=>{const _0x113f80=_0x58d1ec;_0x1d2972['push']({'datasetCode':_0x182405[_0x113f80(0x1da)],'tableName':_0x182405[_0x113f80(0x1fd)],'name':_0x182405[_0x113f80(0x1ed)]||'','alias':_0x182405[_0x113f80(0x1f7)]||_0x182405['key']});});const _0x4d6f6a=fileURLToPath(import.meta.url),_0x1cdc9f=a7_0x4ebfad[_0x58d1ec(0x1fc)](a7_0x4ebfad[_0x58d1ec(0x1e4)](_0x4d6f6a),_0x58d1ec(0x1e8)),_0x874c31=a7_0x4ebfad[_0x58d1ec(0x1df)](_0x1cdc9f,_0x58d1ec(0x1dd)),_0x377984=a7_0x4ebfad[_0x58d1ec(0x1df)](_0x874c31,'api.ts.tpl'),_0x3a0e97=a7_0x4ebfad[_0x58d1ec(0x1df)](_0x874c31,'client.ts.tpl'),_0x6e0e4e=_0x355abd[_0x58d1ec(0x1f9)]('/')?_0x355abd['slice'](0x0,-0x1):_0x355abd;mkdirSync(_0x6e0e4e,{'recursive':!![]});const _0x5602cf=_0x1d2972[0x0]?.[_0x58d1ec(0x1f7)],_0x566fa1=readFileSync(_0x377984,_0x58d1ec(0x1e9)),_0x103e57=TemplateReplacer[_0x58d1ec(0x1ef)](_0x566fa1,_0x48b415,_0x1d2972,_0x5602cf,_0x183ee4,_0x5c9a11),_0x4d9259=await a7_0x4880d3[_0x58d1ec(0x1e6)](_0x103e57,{'parser':'typescript'}),_0x96a49f=_0x6e0e4e+'/'+_0x183ee4+'.ts';writeFileSync(_0x96a49f,_0x4d9259,{'encoding':_0x58d1ec(0x1e9)});const _0x56e6f2=readFileSync(_0x3a0e97,'utf8'),_0x3bef4d=TemplateReplacer[_0x58d1ec(0x1ef)](_0x56e6f2,_0x48b415,_0x1d2972,_0x5602cf,_0x183ee4,_0x5c9a11,_0x42e794),_0x7331d3=await a7_0x4880d3['format'](_0x3bef4d,{'parser':'typescript'}),_0x2faef0=_0x6e0e4e+'/'+_0x34d3d0+_0x58d1ec(0x1dc);writeFileSync(_0x2faef0,_0x7331d3,{'encoding':_0x58d1ec(0x1e9)});const _0x141634=_0x1d2972[_0x58d1ec(0x1fb)];return logger[_0x58d1ec(0x1f5)](_0x58d1ec(0x1f1),_0x58d1ec(0x1db),undefined,{'apiFile':_0x96a49f,'clientFile':_0x2faef0,'modelCount':_0x141634,'configName':_0x5c9a11}),{'modelCount':_0x141634,'apiFilePath':_0x96a49f,'clientFilePath':_0x2faef0,'configName':_0x5c9a11};}function a7_0x126b(_0x5395fe,_0x3a7bc3){_0x5395fe=_0x5395fe-0x1d7;const _0x4f7f14=a7_0x4f7f();let _0x126bfd=_0x4f7f14[_0x5395fe];return _0x126bfd;}function a7_0x4f7f(){const _0x18592e=['datasetCode','API\x20文件生成成功!','.ts','templates/generate-api','app','join','-api','api','758165rAkaip','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','dirname','online','format','197475mLQAJK','../..','utf8','{\x20apiConfigName:\x20','env','3400200YvnbWB','name','client','replaceApiContent','112fBBTQy','init-api','{\x20apiConfigName:\x20\x22','34214CjUIvG','1756587POVTil','success','CONFIG_NAMES.DEFAULT','alias','3556004TJLVrg','endsWith',',\x20env:\x20\x22','length','resolve','tableName','1946277ikpEAk','./src/api/','string','33hzkPVd'];a7_0x4f7f=function(){return _0x18592e;};return a7_0x4f7f();}
1
+ function a7_0x31cd(_0x3873eb,_0x5c79e2){_0x3873eb=_0x3873eb-0xa5;const _0x5438d3=a7_0x5438();let _0x31cdae=_0x5438d3[_0x3873eb];return _0x31cdae;}(function(_0x3045b0,_0x2c39a6){const _0x57baad=a7_0x31cd,_0x2440a8=_0x3045b0();while(!![]){try{const _0x485532=parseInt(_0x57baad(0xc3))/0x1+parseInt(_0x57baad(0xbc))/0x2*(-parseInt(_0x57baad(0xc7))/0x3)+parseInt(_0x57baad(0xb5))/0x4+parseInt(_0x57baad(0xaa))/0x5*(-parseInt(_0x57baad(0xb4))/0x6)+parseInt(_0x57baad(0xaf))/0x7*(-parseInt(_0x57baad(0xb7))/0x8)+parseInt(_0x57baad(0xca))/0x9*(parseInt(_0x57baad(0xad))/0xa)+parseInt(_0x57baad(0xa7))/0xb;if(_0x485532===_0x2c39a6)break;else _0x2440a8['push'](_0x2440a8['shift']());}catch(_0x56c750){_0x2440a8['push'](_0x2440a8['shift']());}}}(a7_0x5438,0xdb2c9));import a7_0x485df1 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x152a09 from'node:path';function a7_0x5438(){const _0x11e0bf=['90BgWnWs','202004evHuRQ','resolve','696xgWNdD','slice','client','name','endsWith','2180482zavJDK','forEach','key','success',',\x20env:\x20\x22','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','../..','891939YYxYEP','api.ts.tpl','env','\x22\x20}','3TAhEgn','tableName','.ts','18AmlgUE','dirname','-api','join','API\x20文件生成成功!','format','{\x20apiConfigName:\x20','length','10662564wrDijm','online','typescript','403945nkzqay','replaceApiContent','push','6652090bsmoJp','utf8','3409QNwVps','string','alias','templates/generate-api','datasetCode'];a7_0x5438=function(){return _0x11e0bf;};return a7_0x5438();}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x188258,_0x26dc2b='',_0x3dcc52,_0x5579c4=![],_0x236097,_0x3c1a1e='./src/api/'){const _0x167dd4=a7_0x31cd,_0x1188b6=readConfig(),_0x33989f=_0x3dcc52||_0x1188b6?.['app'];if(typeof _0x33989f!==_0x167dd4(0xb0)||!_0x33989f)throw new Error(_0x167dd4(0xc1));const _0x4d4a59=_0x5579c4?'CONFIG_NAMES.DEFAULT':'\x22'+_0x33989f+'\x22',_0x1b5216=typeof _0x1188b6['env']===_0x167dd4(0xb0)?_0x1188b6[_0x167dd4(0xc5)]:undefined,_0x27a5d9=_0x236097||_0x1b5216||_0x167dd4(0xa8),_0x36131b=_0x27a5d9!==_0x167dd4(0xa8);let _0x669f6c;if(_0x5579c4)_0x36131b?_0x669f6c=_0x167dd4(0xa5)+_0x4d4a59+_0x167dd4(0xc0)+_0x27a5d9+_0x167dd4(0xc6):_0x669f6c='';else{const _0x1615ee=_0x36131b?_0x167dd4(0xc0)+_0x27a5d9+'\x22':'';_0x669f6c='{\x20apiConfigName:\x20\x22'+_0x33989f+'\x22'+_0x1615ee+'\x20}';}const _0x765a2f=_0x26dc2b?_0x26dc2b+_0x167dd4(0xcc):'api',_0x18fb7b=_0x26dc2b?_0x26dc2b+'-client':_0x167dd4(0xb9),_0xf9148f=[];_0x188258[_0x167dd4(0xbd)](_0x2c5d6e=>{const _0x3c5e34=_0x167dd4;_0xf9148f[_0x3c5e34(0xac)]({'datasetCode':_0x2c5d6e[_0x3c5e34(0xb3)],'tableName':_0x2c5d6e[_0x3c5e34(0xc8)],'name':_0x2c5d6e[_0x3c5e34(0xba)]||'','alias':_0x2c5d6e[_0x3c5e34(0xb1)]||_0x2c5d6e[_0x3c5e34(0xbe)]});});const _0x34b632=fileURLToPath(import.meta.url),_0x47bcf8=a7_0x152a09[_0x167dd4(0xb6)](a7_0x152a09[_0x167dd4(0xcb)](_0x34b632),_0x167dd4(0xc2)),_0x2201f3=a7_0x152a09[_0x167dd4(0xcd)](_0x47bcf8,_0x167dd4(0xb2)),_0x23507c=a7_0x152a09[_0x167dd4(0xcd)](_0x2201f3,_0x167dd4(0xc4)),_0x39e8cc=a7_0x152a09[_0x167dd4(0xcd)](_0x2201f3,'client.ts.tpl'),_0x2014b9=_0x3c1a1e[_0x167dd4(0xbb)]('/')?_0x3c1a1e[_0x167dd4(0xb8)](0x0,-0x1):_0x3c1a1e;mkdirSync(_0x2014b9,{'recursive':!![]});const _0x3554ac=_0xf9148f[0x0]?.[_0x167dd4(0xb1)],_0x29ecf5=readFileSync(_0x23507c,'utf8'),_0x428423=TemplateReplacer['replaceApiContent'](_0x29ecf5,_0x33989f,_0xf9148f,_0x3554ac,_0x765a2f,_0x4d4a59),_0x52b0e8=await a7_0x485df1[_0x167dd4(0xcf)](_0x428423,{'parser':_0x167dd4(0xa9)}),_0x2e93db=_0x2014b9+'/'+_0x765a2f+'.ts';writeFileSync(_0x2e93db,_0x52b0e8,{'encoding':_0x167dd4(0xae)});const _0x345480=readFileSync(_0x39e8cc,_0x167dd4(0xae)),_0xa2bfa3=TemplateReplacer[_0x167dd4(0xab)](_0x345480,_0x33989f,_0xf9148f,_0x3554ac,_0x765a2f,_0x4d4a59,_0x669f6c),_0x360601=await a7_0x485df1[_0x167dd4(0xcf)](_0xa2bfa3,{'parser':_0x167dd4(0xa9)}),_0x534a84=_0x2014b9+'/'+_0x18fb7b+_0x167dd4(0xc9);writeFileSync(_0x534a84,_0x360601,{'encoding':_0x167dd4(0xae)});const _0x4f34cf=_0xf9148f[_0x167dd4(0xa6)];return logger[_0x167dd4(0xbf)]('init-api',_0x167dd4(0xce),undefined,{'apiFile':_0x2e93db,'clientFile':_0x534a84,'modelCount':_0x4f34cf,'configName':_0x4d4a59}),{'modelCount':_0x4f34cf,'apiFilePath':_0x2e93db,'clientFilePath':_0x534a84,'configName':_0x4d4a59};}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0x35e390,_0x3f5f0d){const _0x2666c8=a8_0x4b76,_0x30f5ab=_0x35e390();while(!![]){try{const _0x4be38b=parseInt(_0x2666c8(0x188))/0x1*(-parseInt(_0x2666c8(0x193))/0x2)+-parseInt(_0x2666c8(0x171))/0x3+parseInt(_0x2666c8(0x17c))/0x4*(-parseInt(_0x2666c8(0x18c))/0x5)+parseInt(_0x2666c8(0x180))/0x6*(parseInt(_0x2666c8(0x1a4))/0x7)+parseInt(_0x2666c8(0x170))/0x8*(-parseInt(_0x2666c8(0x185))/0x9)+parseInt(_0x2666c8(0x1a1))/0xa*(parseInt(_0x2666c8(0x198))/0xb)+parseInt(_0x2666c8(0x199))/0xc*(parseInt(_0x2666c8(0x183))/0xd);if(_0x4be38b===_0x3f5f0d)break;else _0x30f5ab['push'](_0x30f5ab['shift']());}catch(_0x256682){_0x30f5ab['push'](_0x30f5ab['shift']());}}}(a8_0x5534,0xc4c02));import{jsx as a8_0x20d7cd}from'react/jsx-runtime';import{render}from'ink';function a8_0x5534(){const _0x230bba=['length','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','flags','7540BsqWXR','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','map','7bgQQNG','\x20\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--datasetcode\x20<codes>\x20指定要生成文档的数据集代码(多个用逗号分隔,仅\x20doc\x20命令)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成所有数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20只生成指定数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20生成多个数据集的文档\x0a','\x1b[90m*\x20仅生成指定数据集的文档:\x20','\x20\x20错误:\x20','91984YijSFj','2051151xvHskb','isArray','exit','log','×\x20未配置\x20AppCode','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','\x1b[90m*\x20使用配置的应用AppCode:\x20','Unknown\x20api\x20command:\x20','env','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','\x20\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','152jeUAmv','datasetcode','output','message','8942754rqTDgw','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','Available\x20commands:','351ZInVHA','error','990efaDvO','string','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','213tmTxKG','help','❌\x20错误:不再支持位置参数方式','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','106465uKgGCt','filter','join','请使用\x20--appcode\x20参数,例如:','×\x20--params\x20参数不是有效的\x20JSON\x20格式','split','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','1514iGNmcj','input','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','appcode','\x1b[0m','10252nKqWWW','680700airQgf','!\x20请使用以下方式之一:','object','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'];a8_0x5534=function(){return _0x230bba;};return a8_0x5534();}import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';function a8_0x4b76(_0x3599b7,_0x5ebcd5){_0x3599b7=_0x3599b7-0x16d;const _0x553456=a8_0x5534();let _0x4b76ee=_0x553456[_0x3599b7];return _0x4b76ee;}import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x2d4d13){const _0x21ed63=a8_0x4b76,_0x49b700=_0x2d4d13['input'][0x1];if(_0x2d4d13[_0x21ed63(0x1a0)][_0x21ed63(0x189)]){console[_0x21ed63(0x174)](_0x21ed63(0x16d));return;}if(_0x49b700==='pull'){_0x2d4d13[_0x21ed63(0x194)][0x2]&&(console[_0x21ed63(0x184)](_0x21ed63(0x18a)),console['log'](_0x21ed63(0x18f)),console[_0x21ed63(0x174)](_0x21ed63(0x176)+_0x2d4d13[_0x21ed63(0x194)][0x2]),process[_0x21ed63(0x173)](0x1));const _0x3096ea=getConfigAppCode();let _0x92286d=_0x2d4d13['flags']['appcode'];const _0x253908=typeof _0x2d4d13[_0x21ed63(0x1a0)][_0x21ed63(0x179)]===_0x21ed63(0x186)?_0x2d4d13[_0x21ed63(0x1a0)][_0x21ed63(0x179)]:undefined,_0x5cbaae=_0x2d4d13[_0x21ed63(0x1a0)]['output'];!_0x92286d&&!_0x3096ea&&(console[_0x21ed63(0x184)](_0x21ed63(0x175)),console[_0x21ed63(0x174)](_0x21ed63(0x19a)),console['log'](_0x21ed63(0x19c)),console[_0x21ed63(0x174)](_0x21ed63(0x192)),process['exit'](0x1)),_0x92286d&&_0x3096ea&&_0x92286d===_0x3096ea&&(console[_0x21ed63(0x174)](_0x21ed63(0x177)+_0x92286d+_0x21ed63(0x197)),console['log'](_0x21ed63(0x19f)),_0x92286d=undefined),render(a8_0x20d7cd(ApiPullUI,{'appCode':_0x92286d,'env':_0x253908,'output':_0x5cbaae}));}else{if(_0x49b700==='doc'){_0x2d4d13['input'][0x2]&&(console[_0x21ed63(0x184)](_0x21ed63(0x18a)),console[_0x21ed63(0x174)](_0x21ed63(0x18f)),console[_0x21ed63(0x174)](_0x21ed63(0x17a)+_0x2d4d13[_0x21ed63(0x194)][0x2]),process[_0x21ed63(0x173)](0x1));const _0x1a9bc7=getConfigAppCode();let _0x9f704e=_0x2d4d13[_0x21ed63(0x1a0)][_0x21ed63(0x196)];const _0x420ee9=typeof _0x2d4d13[_0x21ed63(0x1a0)][_0x21ed63(0x179)]===_0x21ed63(0x186)?_0x2d4d13[_0x21ed63(0x1a0)]['env']:undefined,_0x21906f=_0x2d4d13[_0x21ed63(0x1a0)][_0x21ed63(0x17e)],_0x5f87b3=_0x2d4d13['flags']['params'],_0x2a79d5=_0x2d4d13['flags'][_0x21ed63(0x17d)];!_0x9f704e&&!_0x1a9bc7&&(console['error'](_0x21ed63(0x175)),console[_0x21ed63(0x174)](_0x21ed63(0x19a)),console[_0x21ed63(0x174)](_0x21ed63(0x19c)),console[_0x21ed63(0x174)](_0x21ed63(0x19e)),process[_0x21ed63(0x173)](0x1));_0x9f704e&&_0x1a9bc7&&_0x9f704e===_0x1a9bc7&&(console[_0x21ed63(0x174)](_0x21ed63(0x177)+_0x9f704e+'\x1b[0m'),_0x9f704e=undefined);let _0x388cc3;if(_0x5f87b3)try{_0x388cc3=JSON['parse'](_0x5f87b3),(typeof _0x388cc3!==_0x21ed63(0x19b)||_0x388cc3===null||Array[_0x21ed63(0x172)](_0x388cc3))&&(console['error'](_0x21ed63(0x195)),process[_0x21ed63(0x173)](0x1));}catch(_0xf3183f){console[_0x21ed63(0x184)](_0x21ed63(0x190)),console[_0x21ed63(0x184)](_0x21ed63(0x16f)+(_0xf3183f instanceof Error?_0xf3183f[_0x21ed63(0x17f)]:String(_0xf3183f))),process[_0x21ed63(0x173)](0x1);}let _0x149ae0;_0x2a79d5&&(_0x149ae0=_0x2a79d5[_0x21ed63(0x191)](',')[_0x21ed63(0x1a3)](_0x3506b1=>_0x3506b1['trim']())[_0x21ed63(0x18d)](_0x4ea6a5=>_0x4ea6a5[_0x21ed63(0x19d)]>0x0),_0x149ae0[_0x21ed63(0x19d)]===0x0&&(console[_0x21ed63(0x184)]('×\x20--datasetcode\x20参数不能为空'),process[_0x21ed63(0x173)](0x1)),console[_0x21ed63(0x174)](_0x21ed63(0x16e)+_0x149ae0[_0x21ed63(0x18e)](',\x20')+_0x21ed63(0x197))),render(a8_0x20d7cd(ApiDocUI,{'appCode':_0x9f704e,'env':_0x420ee9,'output':_0x21906f,'extraParams':_0x388cc3,'datasetCodes':_0x149ae0}));}else console[_0x21ed63(0x184)](_0x21ed63(0x178)+_0x49b700),console[_0x21ed63(0x174)](_0x21ed63(0x182)),console[_0x21ed63(0x174)](_0x21ed63(0x17b)),console[_0x21ed63(0x174)](_0x21ed63(0x1a6)),console['log'](_0x21ed63(0x18b)),console['log']('\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),console[_0x21ed63(0x174)](''),console[_0x21ed63(0x174)](_0x21ed63(0x1a5)),console[_0x21ed63(0x174)](_0x21ed63(0x187)),console['log'](_0x21ed63(0x1a2)),console[_0x21ed63(0x174)](_0x21ed63(0x181)),process[_0x21ed63(0x173)](0x1);}}
1
+ function a8_0x2371(){const _0x321f3d=['\x1b[90m*\x20使用配置的应用AppCode:\x20','trim','isArray','appcode','message','1248424fpqKHr','\x20\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档','input','pull','!\x20请使用以下方式之一:','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','\x20\x20错误:\x20','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--datasetcode\x20<codes>\x20指定要生成文档的数据集代码(多个用逗号分隔,仅\x20doc\x20命令)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成所有数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20只生成指定数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20生成多个数据集的文档\x0a','\x1b[90m*\x20仅生成指定数据集的文档:\x20','96163HeRAlE','flags','split','string','doc','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','❌\x20错误:不再支持位置参数方式','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','join','\x20\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','map','datasetcode','filter','6282KvMGja','env','1494010dWqvUe','object','1826616KHcEbO','parse','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','Unknown\x20api\x20command:\x20','length','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','525WDQxSb','414588HDOEGN','error','×\x20未配置\x20AppCode','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','Available\x20commands:','×\x20--params\x20参数不是有效的\x20JSON\x20格式','output','\x1b[0m','exit','log','×\x20--datasetcode\x20参数不能为空','1195101xdvbUA','请使用\x20--appcode\x20参数,例如:','8CAiIhU'];a8_0x2371=function(){return _0x321f3d;};return a8_0x2371();}(function(_0x11efba,_0x4b0455){const _0x3342aa=a8_0x1ad9,_0x3b3316=_0x11efba();while(!![]){try{const _0x567b26=-parseInt(_0x3342aa(0xb4))/0x1*(-parseInt(_0x3342aa(0xa5))/0x2)+parseInt(_0x3342aa(0x98))/0x3+-parseInt(_0x3342aa(0xab))/0x4+-parseInt(_0x3342aa(0x8e))/0x5+parseInt(_0x3342aa(0x8c))/0x6*(-parseInt(_0x3342aa(0x97))/0x7)+parseInt(_0x3342aa(0x90))/0x8+parseInt(_0x3342aa(0xa3))/0x9;if(_0x567b26===_0x4b0455)break;else _0x3b3316['push'](_0x3b3316['shift']());}catch(_0x4fbc81){_0x3b3316['push'](_0x3b3316['shift']());}}}(a8_0x2371,0x2f7e3));import{jsx as a8_0x337b36}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';function a8_0x1ad9(_0x435dad,_0x52a386){_0x435dad=_0x435dad-0x88;const _0x2371c4=a8_0x2371();let _0x1ad94e=_0x2371c4[_0x435dad];return _0x1ad94e;}import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x51f610){const _0x13eaf6=a8_0x1ad9,_0x1f0201=_0x51f610[_0x13eaf6(0xad)][0x1];if(_0x51f610['flags']['help']){console[_0x13eaf6(0xa1)](_0x13eaf6(0xb2));return;}if(_0x1f0201===_0x13eaf6(0xae)){_0x51f610['input'][0x2]&&(console[_0x13eaf6(0x99)](_0x13eaf6(0xba)),console['log'](_0x13eaf6(0xa4)),console[_0x13eaf6(0xa1)](_0x13eaf6(0xbb)+_0x51f610['input'][0x2]),process[_0x13eaf6(0xa0)](0x1));const _0x3a2c91=getConfigAppCode();let _0x5165d2=_0x51f610[_0x13eaf6(0xb5)]['appcode'];const _0x325fc=typeof _0x51f610[_0x13eaf6(0xb5)][_0x13eaf6(0x8d)]==='string'?_0x51f610[_0x13eaf6(0xb5)][_0x13eaf6(0x8d)]:undefined,_0x15e85f=_0x51f610[_0x13eaf6(0xb5)][_0x13eaf6(0x9e)];!_0x5165d2&&!_0x3a2c91&&(console[_0x13eaf6(0x99)](_0x13eaf6(0x9a)),console[_0x13eaf6(0xa1)](_0x13eaf6(0xaf)),console[_0x13eaf6(0xa1)](_0x13eaf6(0x96)),console['log'](_0x13eaf6(0xbc)),process[_0x13eaf6(0xa0)](0x1)),_0x5165d2&&_0x3a2c91&&_0x5165d2===_0x3a2c91&&(console[_0x13eaf6(0xa1)]('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0x5165d2+'\x1b[0m'),console['log'](_0x13eaf6(0x92)),_0x5165d2=undefined),render(a8_0x337b36(ApiPullUI,{'appCode':_0x5165d2,'env':_0x325fc,'output':_0x15e85f}));}else{if(_0x1f0201===_0x13eaf6(0xb8)){_0x51f610[_0x13eaf6(0xad)][0x2]&&(console[_0x13eaf6(0x99)]('❌\x20错误:不再支持位置参数方式'),console[_0x13eaf6(0xa1)](_0x13eaf6(0xa4)),console[_0x13eaf6(0xa1)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20'+_0x51f610[_0x13eaf6(0xad)][0x2]),process['exit'](0x1));const _0x5b158a=getConfigAppCode();let _0x3d527d=_0x51f610[_0x13eaf6(0xb5)][_0x13eaf6(0xa9)];const _0x2a140f=typeof _0x51f610[_0x13eaf6(0xb5)][_0x13eaf6(0x8d)]===_0x13eaf6(0xb7)?_0x51f610[_0x13eaf6(0xb5)][_0x13eaf6(0x8d)]:undefined,_0x42e3f5=_0x51f610[_0x13eaf6(0xb5)][_0x13eaf6(0x9e)],_0x3d28d5=_0x51f610[_0x13eaf6(0xb5)]['params'],_0x14aaab=_0x51f610[_0x13eaf6(0xb5)][_0x13eaf6(0x8a)];!_0x3d527d&&!_0x5b158a&&(console[_0x13eaf6(0x99)](_0x13eaf6(0x9a)),console[_0x13eaf6(0xa1)](_0x13eaf6(0xaf)),console['log']('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x13eaf6(0xa1)](_0x13eaf6(0xb9)),process[_0x13eaf6(0xa0)](0x1));_0x3d527d&&_0x5b158a&&_0x3d527d===_0x5b158a&&(console[_0x13eaf6(0xa1)](_0x13eaf6(0xa6)+_0x3d527d+_0x13eaf6(0x9f)),_0x3d527d=undefined);let _0x41d0a6;if(_0x3d28d5)try{_0x41d0a6=JSON[_0x13eaf6(0x91)](_0x3d28d5),(typeof _0x41d0a6!==_0x13eaf6(0x8f)||_0x41d0a6===null||Array[_0x13eaf6(0xa8)](_0x41d0a6))&&(console[_0x13eaf6(0x99)]('×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象'),process['exit'](0x1));}catch(_0x3df21a){console[_0x13eaf6(0x99)](_0x13eaf6(0x9d)),console[_0x13eaf6(0x99)](_0x13eaf6(0xb1)+(_0x3df21a instanceof Error?_0x3df21a[_0x13eaf6(0xaa)]:String(_0x3df21a))),process[_0x13eaf6(0xa0)](0x1);}let _0x916e1d;_0x14aaab&&(_0x916e1d=_0x14aaab[_0x13eaf6(0xb6)](',')[_0x13eaf6(0x89)](_0x31893f=>_0x31893f[_0x13eaf6(0xa7)]())[_0x13eaf6(0x8b)](_0x1a0011=>_0x1a0011['length']>0x0),_0x916e1d[_0x13eaf6(0x95)]===0x0&&(console[_0x13eaf6(0x99)](_0x13eaf6(0xa2)),process[_0x13eaf6(0xa0)](0x1)),console[_0x13eaf6(0xa1)](_0x13eaf6(0xb3)+_0x916e1d[_0x13eaf6(0xbe)](',\x20')+_0x13eaf6(0x9f))),render(a8_0x337b36(ApiDocUI,{'appCode':_0x3d527d,'env':_0x2a140f,'output':_0x42e3f5,'extraParams':_0x41d0a6,'datasetCodes':_0x916e1d}));}else console[_0x13eaf6(0x99)](_0x13eaf6(0x94)+_0x1f0201),console[_0x13eaf6(0xa1)](_0x13eaf6(0x9c)),console['log'](_0x13eaf6(0x88)),console[_0x13eaf6(0xa1)]('\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode'),console[_0x13eaf6(0xa1)](_0x13eaf6(0xb0)),console[_0x13eaf6(0xa1)](_0x13eaf6(0x9b)),console[_0x13eaf6(0xa1)](''),console['log'](_0x13eaf6(0xac)),console[_0x13eaf6(0xa1)](_0x13eaf6(0x93)),console['log'](_0x13eaf6(0xbd)),console['log']('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process[_0x13eaf6(0xa0)](0x1);}}
@@ -1 +1 @@
1
- function a9_0x1b7a(_0x312a63,_0x17da21){_0x312a63=_0x312a63-0x16f;const _0x56ce52=a9_0x56ce();let _0x1b7ac5=_0x56ce52[_0x312a63];return _0x1b7ac5;}(function(_0x8e4a6b,_0x2edb3e){const _0x54e25a=a9_0x1b7a,_0x47ccf6=_0x8e4a6b();while(!![]){try{const _0x1fb9fd=-parseInt(_0x54e25a(0x187))/0x1*(-parseInt(_0x54e25a(0x17f))/0x2)+parseInt(_0x54e25a(0x172))/0x3+parseInt(_0x54e25a(0x182))/0x4+-parseInt(_0x54e25a(0x180))/0x5+-parseInt(_0x54e25a(0x18e))/0x6+-parseInt(_0x54e25a(0x184))/0x7*(-parseInt(_0x54e25a(0x17a))/0x8)+parseInt(_0x54e25a(0x188))/0x9;if(_0x1fb9fd===_0x2edb3e)break;else _0x47ccf6['push'](_0x47ccf6['shift']());}catch(_0x4d7183){_0x47ccf6['push'](_0x47ccf6['shift']());}}}(a9_0x56ce,0x505ef));import{readConfig}from'../utils/config.js';function a9_0x56ce(){const _0x41ad1b=['length','API\x20配置拉取成功:\x20','-api','test','3752976bfrPjS','.ts\x20-\x20客户端实例文件','online','env','info','*\x20正在处理\x20','API\x20配置拉取异常:\x20','864138tlBBDq','client','√\x20成功拉取\x20','create-api-pull','trim','cwd','\x20个数据集...','\x20个模型','1254272QVyUtV','\x20\x20\x20•\x20','string','log','chdir','308WUxZPp','1854395VznBSm','message','1157192fcGAHz','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','21HjYorK','modelCount','*\x20开始生成\x20API\x20配置文件:','491uphbVE','1820376PutbnP','error'];a9_0x56ce=function(){return _0x41ad1b;};return a9_0x56ce();}import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x4c99be,_0x2ffa6e,_0x391cd8,_0x462b0b){const _0x310165=a9_0x1b7a;let _0x1fd8f4;try{const _0x558bd3=_0x2ffa6e?.[_0x310165(0x176)]()||'';if(_0x558bd3){const _0x4d7299=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x4d7299[_0x310165(0x18d)](_0x558bd3))return console['error'](_0x310165(0x183)),![];}_0x391cd8&&(_0x1fd8f4=process[_0x310165(0x177)](),process[_0x310165(0x17e)](_0x391cd8));const _0x2f5919=readConfig(),_0x30f55b=typeof _0x2f5919[_0x310165(0x191)]===_0x310165(0x17c)?_0x2f5919[_0x310165(0x191)]:undefined,_0x2ce264=_0x462b0b||_0x30f55b||_0x310165(0x190);initEnv(_0x2ce264),console[_0x310165(0x17d)]('*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20'+_0x2ce264+')');const {configArray:_0xb38fdd}=await fetchModelList(_0x4c99be),_0x28d1f0=_0x558bd3?_0x558bd3+_0x310165(0x18c):'api',_0x2ecf29=_0x558bd3?_0x558bd3+'-client':_0x310165(0x173);console[_0x310165(0x17d)](_0x310165(0x186)),console['log'](_0x310165(0x17b)+_0x28d1f0+'.ts\x20-\x20模型配置文件'),console[_0x310165(0x17d)](_0x310165(0x17b)+_0x2ecf29+_0x310165(0x18f)),console[_0x310165(0x17d)](_0x310165(0x170)+_0xb38fdd[_0x310165(0x18a)]+_0x310165(0x178));const _0x24ae39=await generateApiFile(_0xb38fdd,_0x558bd3,_0x4c99be,!![],_0x2ce264);return console['log'](_0x310165(0x174)+_0xb38fdd[_0x310165(0x18a)]+'\x20个数据集,生成\x20'+_0x24ae39[_0x310165(0x185)]+_0x310165(0x179)),_0x391cd8&&logger[_0x310165(0x16f)](_0x310165(0x175),_0x310165(0x18b)+_0x4c99be,{'projectPath':_0x391cd8,'appCode':_0x4c99be,'datasetCount':_0xb38fdd[_0x310165(0x18a)],'filePrefix':_0x558bd3}),!![];}catch(_0x525860){const _0x2811ee=_0x525860 instanceof Error?_0x525860[_0x310165(0x181)]:String(_0x525860);return console[_0x310165(0x189)]('×\x20API\x20配置拉取异常:',_0x2811ee),_0x391cd8&&logger[_0x310165(0x189)](_0x310165(0x175),_0x310165(0x171)+_0x2811ee,{'appCode':_0x4c99be,'projectPath':_0x391cd8}),![];}finally{_0x1fd8f4&&process[_0x310165(0x17e)](_0x1fd8f4);}}
1
+ function a9_0x40b4(_0x2f5f05,_0x37df26){_0x2f5f05=_0x2f5f05-0x1af;const _0x251ea3=a9_0x251e();let _0x40b465=_0x251ea3[_0x2f5f05];return _0x40b465;}(function(_0x261f8e,_0x58291f){const _0xe6b460=a9_0x40b4,_0xc01f3c=_0x261f8e();while(!![]){try{const _0x27bf8c=-parseInt(_0xe6b460(0x1c1))/0x1+-parseInt(_0xe6b460(0x1b6))/0x2*(parseInt(_0xe6b460(0x1d6))/0x3)+-parseInt(_0xe6b460(0x1c3))/0x4*(parseInt(_0xe6b460(0x1c0))/0x5)+parseInt(_0xe6b460(0x1d7))/0x6*(parseInt(_0xe6b460(0x1b3))/0x7)+-parseInt(_0xe6b460(0x1c4))/0x8+-parseInt(_0xe6b460(0x1b8))/0x9*(parseInt(_0xe6b460(0x1b5))/0xa)+-parseInt(_0xe6b460(0x1bc))/0xb*(-parseInt(_0xe6b460(0x1b2))/0xc);if(_0x27bf8c===_0x58291f)break;else _0xc01f3c['push'](_0xc01f3c['shift']());}catch(_0x2d7844){_0xc01f3c['push'](_0xc01f3c['shift']());}}}(a9_0x251e,0x382af));function a9_0x251e(){const _0x334661=['28266IuSWsK','√\x20成功拉取\x20','*\x20正在处理\x20','test','message','482892jgkQQl','623aVpusY','\x20个数据集,生成\x20','3189430pnmjGM','14OzxtzI','\x20\x20\x20•\x20','9ZHCrud','×\x20API\x20配置拉取异常:','.ts\x20-\x20模型配置文件','client','209yWfqKg','create-api-pull','\x20个模型','*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','10qBJCJT','73641lDQdvf','API\x20配置拉取异常:\x20','538768Sbbetp','521504wrpQhc','chdir','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','-client','modelCount','string','API\x20配置拉取成功:\x20','env','*\x20开始生成\x20API\x20配置文件:','.ts\x20-\x20客户端实例文件','cwd','\x20个数据集...','info','api','error','log','length','online','97131hUUknK'];a9_0x251e=function(){return _0x334661;};return a9_0x251e();}import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x34d8c0,_0x7e3a75,_0x2172d0,_0x1ec051){const _0x20a735=a9_0x40b4;let _0x5a05eb;try{const _0x2d63a6=_0x7e3a75?.['trim']()||'';if(_0x2d63a6){const _0x1897e5=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x1897e5[_0x20a735(0x1b0)](_0x2d63a6))return console[_0x20a735(0x1d2)](_0x20a735(0x1c6)),![];}_0x2172d0&&(_0x5a05eb=process[_0x20a735(0x1ce)](),process['chdir'](_0x2172d0));const _0x4c55f8=readConfig(),_0x2346ce=typeof _0x4c55f8[_0x20a735(0x1cb)]===_0x20a735(0x1c9)?_0x4c55f8['env']:undefined,_0x354a2a=_0x1ec051||_0x2346ce||_0x20a735(0x1d5);initEnv(_0x354a2a),console['log'](_0x20a735(0x1bf)+_0x354a2a+')');const {configArray:_0x36d356}=await fetchModelList(_0x34d8c0),_0x3944bd=_0x2d63a6?_0x2d63a6+'-api':_0x20a735(0x1d1),_0x5b4d83=_0x2d63a6?_0x2d63a6+_0x20a735(0x1c7):_0x20a735(0x1bb);console[_0x20a735(0x1d3)](_0x20a735(0x1cc)),console['log'](_0x20a735(0x1b7)+_0x3944bd+_0x20a735(0x1ba)),console[_0x20a735(0x1d3)](_0x20a735(0x1b7)+_0x5b4d83+_0x20a735(0x1cd)),console[_0x20a735(0x1d3)](_0x20a735(0x1af)+_0x36d356['length']+_0x20a735(0x1cf));const _0x437a9d=await generateApiFile(_0x36d356,_0x2d63a6,_0x34d8c0,!![],_0x354a2a);return console[_0x20a735(0x1d3)](_0x20a735(0x1d8)+_0x36d356[_0x20a735(0x1d4)]+_0x20a735(0x1b4)+_0x437a9d[_0x20a735(0x1c8)]+_0x20a735(0x1be)),_0x2172d0&&logger[_0x20a735(0x1d0)](_0x20a735(0x1bd),_0x20a735(0x1ca)+_0x34d8c0,{'projectPath':_0x2172d0,'appCode':_0x34d8c0,'datasetCount':_0x36d356[_0x20a735(0x1d4)],'filePrefix':_0x2d63a6}),!![];}catch(_0xe5e42){const _0x204173=_0xe5e42 instanceof Error?_0xe5e42[_0x20a735(0x1b1)]:String(_0xe5e42);return console[_0x20a735(0x1d2)](_0x20a735(0x1b9),_0x204173),_0x2172d0&&logger[_0x20a735(0x1d2)]('create-api-pull',_0x20a735(0x1c2)+_0x204173,{'appCode':_0x34d8c0,'projectPath':_0x2172d0}),![];}finally{_0x5a05eb&&process[_0x20a735(0x1c5)](_0x5a05eb);}}