@lovrabet/cli 1.1.9 → 1.1.10

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 (49) hide show
  1. package/README.md +51 -0
  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 -0
  6. package/lib/api/api-doc.js +1 -0
  7. package/lib/api/api-pull-ui.js +1 -1
  8. package/lib/api/fetch-datasets.js +1 -0
  9. package/lib/api/format-dataset.js +1 -1
  10. package/lib/api/generate-api-file.js +1 -1
  11. package/lib/api/main.js +1 -1
  12. package/lib/api/pull-silent.js +1 -1
  13. package/lib/api/pull.js +1 -1
  14. package/lib/auth/auth-server-ui.js +1 -1
  15. package/lib/auth/auth-server.js +1 -1
  16. package/lib/auth/constant.js +1 -1
  17. package/lib/auth/get-cookie.js +1 -1
  18. package/lib/auth/is-session-valid.js +1 -1
  19. package/lib/auth/logout.js +1 -1
  20. package/lib/cli.js +1 -1
  21. package/lib/cmd/build-watch.js +1 -1
  22. package/lib/cmd/build.js +1 -1
  23. package/lib/cmd/logs.js +1 -1
  24. package/lib/cmd/preview.js +1 -1
  25. package/lib/cmd/start.js +1 -1
  26. package/lib/config/config-help.js +1 -1
  27. package/lib/config/main.js +1 -1
  28. package/lib/constant/domain.js +1 -1
  29. package/lib/constant/env.js +1 -1
  30. package/lib/create-app/enhanced-guided-create.js +1 -1
  31. package/lib/create-app/format-elapsed.js +1 -1
  32. package/lib/create-app/main.js +1 -1
  33. package/lib/create-app/task-finished.js +1 -1
  34. package/lib/create-app/task-loading.js +1 -1
  35. package/lib/create-app/task-running.js +1 -1
  36. package/lib/create-app/task-time.js +1 -1
  37. package/lib/create-app/use-copy-project-template.js +1 -1
  38. package/lib/create-app/use-format-code.js +1 -1
  39. package/lib/create-app/use-install-dependencies.js +1 -1
  40. package/lib/help.js +1 -1
  41. package/lib/utils/config.js +1 -1
  42. package/lib/utils/copy-directory.js +1 -1
  43. package/lib/utils/http-client.js +1 -1
  44. package/lib/utils/logger.js +1 -1
  45. package/lib/utils/router-updater.js +1 -1
  46. package/lib/utils/template-replacer.js +1 -1
  47. package/package.json +1 -1
  48. package/templates/pages/sdk-fetch/index.tsx.tpl +41 -52
  49. package/templates/projects/sub-app-react-demo/package.json +1 -1
package/README.md CHANGED
@@ -296,6 +296,56 @@ lovrabet logs --clear
296
296
 
297
297
  ## 📝 What's New
298
298
 
299
+ ### v1.1.10 (2025-10-16)
300
+
301
+ **新增功能 (New Features):**
302
+
303
+ - ✨ **API 文档自动生成** - 全新的文档生成工具,让 API 使用更清晰
304
+
305
+ 现在可以一键生成所有数据集的 API 使用文档(Markdown 格式):
306
+
307
+ ```bash
308
+ lovrabet api doc
309
+ ```
310
+
311
+ - 📚 自动生成完整的 API 使用说明
312
+ - 📊 包含数据字段、请求示例、响应格式等
313
+ - 🎯 支持批量生成,自动处理所有数据集
314
+ - 📁 输出为标准 Markdown 格式,便于团队共享
315
+
316
+ **改进优化 (Improvements):**
317
+
318
+ - 🔧 **数据集智能去重** - API 拉取更精准
319
+ - 自动识别并过滤重复的数据集(相同 `tableName`)
320
+ - 显示详细的去重统计信息
321
+ - 避免配置文件中出现重复项
322
+
323
+ - 🎨 **SDK 数据获取页面模板优化** - 生成的页面更简洁高效
324
+ - 精简 UI 组件代码,提升可维护性
325
+ - 增强表格数据处理能力
326
+ - 改进数据展示性能
327
+ - 优化代码结构和注释
328
+
329
+ - 🎯 **API 配置管理优化**
330
+ - 优化用户交互提示信息
331
+ - 改进错误处理和提示
332
+ - 提升整体用户体验
333
+
334
+ **使用示例:**
335
+
336
+ ```bash
337
+ # 生成 API 配置文件
338
+ lovrabet api pull --appcode my-app
339
+
340
+ # 生成 API 文档(新功能)
341
+ lovrabet api doc
342
+
343
+ # 查看详细日志
344
+ lovrabet logs
345
+ ```
346
+
347
+ ---
348
+
299
349
  ### v1.1.7 (2025-10-10)
300
350
 
301
351
  **重大变更 (Breaking Changes):**
@@ -371,6 +421,7 @@ lovrabet api pull my-app # 位置参数方式已废弃
371
421
  **专有软件(Proprietary)** - 详见 [LICENSE](./LICENSE) 文件
372
422
 
373
423
  本软件为 Lovrabet 开放平台的专有工具:
424
+
374
425
  - ✅ **允许使用** - 可以安装和使用本工具开发 Lovrabet 应用
375
426
  - ✅ **生成内容归您** - 使用本工具生成的代码和项目归您所有
376
427
  - ❌ **不得修改** - 不得修改、反编译或逆向工程
@@ -1 +1 @@
1
- function a0_0x4e8c(_0xd50599,_0x566223){const _0x531f20=a0_0x531f();return a0_0x4e8c=function(_0x4e8cd0,_0x3d8f38){_0x4e8cd0=_0x4e8cd0-0xd9;let _0xdc4305=_0x531f20[_0x4e8cd0];return _0xdc4305;},a0_0x4e8c(_0xd50599,_0x566223);}function a0_0x531f(){const _0x23cad4=['delete','71821UMtUPx','length','7mKZsYW','split','页面路径\x20','gray','1725714DMauFX','my-page','10LtttIl','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','\x20Step2:\x20','4153448hHnhSU','2uJysHa','页面路径不合法','column','路径不能以\x20/\x20开头或结尾','endsWith','页面路径长度不能超过\x20100\x20个字符','980832EFltkn','existsSync','2002670KzHZAn','458128kETycN','页面路由地址:\x20','\x20直接回车确认,或输入自定义路由地址','464583RUELTX','test','\x20←\x20','路径不能包含连续的\x20/','red'];a0_0x531f=function(){return _0x23cad4;};return a0_0x531f();}(function(_0x5b1d47,_0x3c3c8){const _0x2a75ae=a0_0x4e8c,_0x495dce=_0x5b1d47();while(!![]){try{const _0xb48e59=parseInt(_0x2a75ae(0xde))/0x1*(-parseInt(_0x2a75ae(0xea))/0x2)+parseInt(_0x2a75ae(0xf6))/0x3+parseInt(_0x2a75ae(0xf3))/0x4+-parseInt(_0x2a75ae(0xf2))/0x5+parseInt(_0x2a75ae(0xf0))/0x6+-parseInt(_0x2a75ae(0xe0))/0x7*(-parseInt(_0x2a75ae(0xe9))/0x8)+-parseInt(_0x2a75ae(0xe4))/0x9*(parseInt(_0x2a75ae(0xe6))/0xa);if(_0xb48e59===_0x3c3c8)break;else _0x495dce['push'](_0x495dce['shift']());}catch(_0x26ca47){_0x495dce['push'](_0x495dce['shift']());}}}(a0_0x531f,0x464c9));import{jsx as a0_0x26ea40,jsxs as a0_0x185837}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x20a90e from'node:fs';export function InputProjectCode(_0x4fb1f8){const _0x2c5c55=a0_0x4e8c,{onSubmit:_0x104cb3,pagePath:_0x3a1c46}=_0x4fb1f8,[_0xa82e58,_0x41de3f]=useState(''),[_0x406031,_0x29ac9f]=useState(''),_0x164cb2=_0x2c5c55(0xe5);function _0x47fbbf(_0x772e10){const _0x2b96b1=_0x2c5c55;if(_0x772e10[_0x2b96b1(0xdf)]>0x64)return{'valid':![],'message':_0x2b96b1(0xef)};if(_0x772e10['startsWith']('/')||_0x772e10[_0x2b96b1(0xee)]('/'))return{'valid':![],'message':_0x2b96b1(0xed)};if(_0x772e10['includes']('//'))return{'valid':![],'message':_0x2b96b1(0xdb)};const _0x16c930=_0x772e10[_0x2b96b1(0xe1)]('/');for(const _0x1955f0 of _0x16c930){if(!_0x1955f0)continue;const _0x57660d=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x57660d[_0x2b96b1(0xd9)](_0x1955f0))return{'valid':![],'message':_0x2b96b1(0xe7)};}return{'valid':!![]};}return useInput((_0x57ac71,_0x28f544)=>{const _0x569e17=_0x2c5c55;if(_0x28f544['return']){const _0x4b3a2e=_0xa82e58['trim']()||_0x164cb2;if(_0x406031)return;const _0x454678=_0x3a1c46+'/'+_0x4b3a2e;if(a0_0x20a90e[_0x569e17(0xf1)](_0x454678)){_0x29ac9f(_0x569e17(0xe2)+_0x4b3a2e+'\x20已存在,请使用其他路径');return;}_0x104cb3(_0x4b3a2e),_0x41de3f(''),_0x29ac9f('');}else _0x28f544['backspace']||_0x28f544[_0x569e17(0xdd)]?_0x41de3f(_0x3b9c2e=>{const _0x7f00ab=_0x569e17,_0x20bd01=_0x3b9c2e['slice'](0x0,-0x1),{valid:_0x5b4cd3,message:_0x1cfbce}=_0x47fbbf(_0x20bd01);return _0x29ac9f(_0x5b4cd3?'':_0x1cfbce||_0x7f00ab(0xeb)),_0x20bd01;}):_0x41de3f(_0x55d665=>{const _0x267fdc=_0x569e17,_0x5354b5=_0x55d665+_0x57ac71,{valid:_0x37c6b1,message:_0x1444ad}=_0x47fbbf(_0x5354b5);return _0x29ac9f(_0x37c6b1?'':_0x1444ad||_0x267fdc(0xeb)),_0x5354b5;});}),a0_0x185837(Box,{'flexDirection':_0x2c5c55(0xec),'children':[a0_0x185837(Box,{'children':[a0_0x26ea40(Text,{'color':_0x2c5c55(0xe3),'children':_0x2c5c55(0xe8)}),a0_0x26ea40(Text,{'children':_0x2c5c55(0xf4)}),_0xa82e58?a0_0x26ea40(Text,{'color':'green','children':_0xa82e58}):a0_0x26ea40(Text,{'color':_0x2c5c55(0xe3),'children':_0x164cb2}),_0x406031&&a0_0x185837(Text,{'color':_0x2c5c55(0xdc),'children':[_0x2c5c55(0xda),_0x406031]})]}),!_0x406031&&!_0xa82e58&&a0_0x26ea40(Box,{'children':a0_0x26ea40(Text,{'color':_0x2c5c55(0xe3),'children':_0x2c5c55(0xf5)})})]});}
1
+ (function(_0x47a98a,_0x2d7e54){const _0x3bee83=a0_0x5999,_0x141a4f=_0x47a98a();while(!![]){try{const _0x4b30ba=parseInt(_0x3bee83(0xa7))/0x1*(parseInt(_0x3bee83(0xa6))/0x2)+parseInt(_0x3bee83(0x98))/0x3+-parseInt(_0x3bee83(0x9e))/0x4*(parseInt(_0x3bee83(0xa4))/0x5)+-parseInt(_0x3bee83(0xa5))/0x6*(-parseInt(_0x3bee83(0xa8))/0x7)+parseInt(_0x3bee83(0x94))/0x8+parseInt(_0x3bee83(0x93))/0x9+-parseInt(_0x3bee83(0xae))/0xa;if(_0x4b30ba===_0x2d7e54)break;else _0x141a4f['push'](_0x141a4f['shift']());}catch(_0x1ee0cc){_0x141a4f['push'](_0x141a4f['shift']());}}}(a0_0x2570,0x97404));function a0_0x5999(_0x59a143,_0x585bf7){const _0x25708c=a0_0x2570();return a0_0x5999=function(_0x599988,_0x31aa85){_0x599988=_0x599988-0x90;let _0x103014=_0x25708c[_0x599988];return _0x103014;},a0_0x5999(_0x59a143,_0x585bf7);}import{jsx as a0_0x4c80bd,jsxs as a0_0xe4e329}from'react/jsx-runtime';import{useState}from'react';function a0_0x2570(){const _0x296bb9=['slice','8854281iiBPSQ','8581536QgsjuI','delete','路径不能以\x20/\x20开头或结尾','trim','3056178cXgBHs','backspace','includes','endsWith','页面路径长度不能超过\x20100\x20个字符','gray','812ZYvKfk','页面路径不合法','red','startsWith','green','\x20已存在,请使用其他路径','9205LSFLgy','46488nFYUtn','749032FHfwZc','2OqJKIq','651mMnqZK','页面路由地址:\x20','\x20直接回车确认,或输入自定义路由地址','\x20←\x20','existsSync','路径不能包含连续的\x20/','35515760IiGqjz','my-page','length'];a0_0x2570=function(){return _0x296bb9;};return a0_0x2570();}import{Text,Box,useInput}from'ink';import a0_0x374580 from'node:fs';export function InputProjectCode(_0x2abf64){const _0x3a0d56=a0_0x5999,{onSubmit:_0xab5d88,pagePath:_0x425f83}=_0x2abf64,[_0x3f8ca2,_0x7f9875]=useState(''),[_0x1517e8,_0x355b3a]=useState(''),_0x531d9d=_0x3a0d56(0x90);function _0x1a5eac(_0x17a7d9){const _0x5c0b58=_0x3a0d56;if(_0x17a7d9[_0x5c0b58(0x91)]>0x64)return{'valid':![],'message':_0x5c0b58(0x9c)};if(_0x17a7d9[_0x5c0b58(0xa1)]('/')||_0x17a7d9[_0x5c0b58(0x9b)]('/'))return{'valid':![],'message':_0x5c0b58(0x96)};if(_0x17a7d9[_0x5c0b58(0x9a)]('//'))return{'valid':![],'message':_0x5c0b58(0xad)};const _0x2df8d3=_0x17a7d9['split']('/');for(const _0x559979 of _0x2df8d3){if(!_0x559979)continue;const _0x4b87c9=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x4b87c9['test'](_0x559979))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x18e13a,_0x1e1db7)=>{const _0x3d98d4=_0x3a0d56;if(_0x1e1db7['return']){const _0x310ebc=_0x3f8ca2[_0x3d98d4(0x97)]()||_0x531d9d;if(_0x1517e8)return;const _0x35e60b=_0x425f83+'/'+_0x310ebc;if(a0_0x374580[_0x3d98d4(0xac)](_0x35e60b)){_0x355b3a('页面路径\x20'+_0x310ebc+_0x3d98d4(0xa3));return;}_0xab5d88(_0x310ebc),_0x7f9875(''),_0x355b3a('');}else _0x1e1db7[_0x3d98d4(0x99)]||_0x1e1db7[_0x3d98d4(0x95)]?_0x7f9875(_0x2b1510=>{const _0x2c541a=_0x3d98d4,_0x3e3d9c=_0x2b1510[_0x2c541a(0x92)](0x0,-0x1),{valid:_0xc0c9f5,message:_0x26c554}=_0x1a5eac(_0x3e3d9c);return _0x355b3a(_0xc0c9f5?'':_0x26c554||_0x2c541a(0x9f)),_0x3e3d9c;}):_0x7f9875(_0x4ac59e=>{const _0x45578a=_0x3d98d4,_0x4afef9=_0x4ac59e+_0x18e13a,{valid:_0x5e6312,message:_0x23d21a}=_0x1a5eac(_0x4afef9);return _0x355b3a(_0x5e6312?'':_0x23d21a||_0x45578a(0x9f)),_0x4afef9;});}),a0_0xe4e329(Box,{'flexDirection':'column','children':[a0_0xe4e329(Box,{'children':[a0_0x4c80bd(Text,{'color':_0x3a0d56(0x9d),'children':'\x20Step2:\x20'}),a0_0x4c80bd(Text,{'children':_0x3a0d56(0xa9)}),_0x3f8ca2?a0_0x4c80bd(Text,{'color':_0x3a0d56(0xa2),'children':_0x3f8ca2}):a0_0x4c80bd(Text,{'color':_0x3a0d56(0x9d),'children':_0x531d9d}),_0x1517e8&&a0_0xe4e329(Text,{'color':_0x3a0d56(0xa0),'children':[_0x3a0d56(0xab),_0x1517e8]})]}),!_0x1517e8&&!_0x3f8ca2&&a0_0x4c80bd(Box,{'children':a0_0x4c80bd(Text,{'color':'gray','children':_0x3a0d56(0xaa)})})]});}
@@ -1 +1 @@
1
- const a1_0x14a6c6=a1_0xcff5;(function(_0x3413a8,_0xc853c2){const _0x41f596=a1_0xcff5,_0x6d6e67=_0x3413a8();while(!![]){try{const _0x9b55e1=parseInt(_0x41f596(0x1bb))/0x1*(parseInt(_0x41f596(0x1af))/0x2)+-parseInt(_0x41f596(0x1b5))/0x3*(-parseInt(_0x41f596(0x1b9))/0x4)+-parseInt(_0x41f596(0x1a3))/0x5+-parseInt(_0x41f596(0x1b7))/0x6*(-parseInt(_0x41f596(0x1b2))/0x7)+parseInt(_0x41f596(0x1bf))/0x8*(parseInt(_0x41f596(0x1bd))/0x9)+-parseInt(_0x41f596(0x1a7))/0xa+-parseInt(_0x41f596(0x1b6))/0xb;if(_0x9b55e1===_0xc853c2)break;else _0x6d6e67['push'](_0x6d6e67['shift']());}catch(_0x5c6722){_0x6d6e67['push'](_0x6d6e67['shift']());}}}(a1_0x3e9c,0xed852));import{jsx as a1_0x5e70c2,jsxs as a1_0x347187,Fragment as a1_0x47a434}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x4897bf 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';import{logger}from'../utils/logger.js';function a1_0xcff5(_0x48e8c9,_0x3bc752){const _0x3e9c22=a1_0x3e9c();return a1_0xcff5=function(_0xcff527,_0x1108e6){_0xcff527=_0xcff527-0x1a2;let _0x22aeed=_0x3e9c22[_0xcff527];return _0x22aeed;},a1_0xcff5(_0x48e8c9,_0x3bc752);}import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x4897bf['dirname'](fileURLToPath(import.meta[a1_0x14a6c6(0x1a5)])),pageTemplateDir=a1_0x4897bf[a1_0x14a6c6(0x1b1)](__dirname,a1_0x14a6c6(0x1b8)),projectDir=process[a1_0x14a6c6(0x1be)]();function a1_0x3e9c(){const _0x84ed40=['error','6094170CGmMKp','\x20Step2:\x20','url','src','2519410nLhxbo','\x20*\x20路由地址:\x20','正在创建页面,请稍候…','页面添加成功:\x20','catch','\x20*\x20页面文件已创建,可直接通过路由访问','success','then','2GZtkgm','gray','resolve','2359XaexBi','join','now','6izbamg','16716172VGoiWj','7926PiAaPx','../../templates/pages','510604tryuXb','column','1639679shjaqR','info','14608359oIjbXR','cwd','8nZIqdY','green','\x20*\x20页面创建成功!','processTemplate','开始添加页面:\x20','setLogPath','add-page','pages'];a1_0x3e9c=function(){return _0x84ed40;};return a1_0x3e9c();}export const AddPage=()=>{const _0x1ba9a4=a1_0x14a6c6,{exit:_0x476ff6}=useApp(),[_0x39de59,_0x4b20a5]=useState(''),[_0x5a33ae,_0x47bfad]=useState(''),[_0x3a869e,_0x1ae624]=useState(![]),[_0x353286,_0x20808c]=useState(![]),_0x111c01=a1_0x4897bf[_0x1ba9a4(0x1b3)](projectDir,_0x1ba9a4(0x1a6),_0x1ba9a4(0x1c6)),_0x1dee9c=a1_0x4897bf[_0x1ba9a4(0x1b3)](_0x111c01,_0x5a33ae),_0x174a1f=a1_0x4897bf[_0x1ba9a4(0x1b3)](_0x1ba9a4(0x1a6),'pages',_0x5a33ae);useEffect(()=>{const _0x14d266=_0x1ba9a4,_0x5e9bef=a1_0x4897bf['resolve'](pageTemplateDir,_0x39de59);if(_0x39de59&&_0x5a33ae){_0x1ae624(!![]),logger[_0x14d266(0x1c4)](process[_0x14d266(0x1be)]());const _0x1cfc40=Date['now']();logger[_0x14d266(0x1bc)](_0x14d266(0x1c5),_0x14d266(0x1c3)+_0x5a33ae,{'template':_0x39de59,'targetPath':_0x174a1f}),TemplateReplacer[_0x14d266(0x1c2)](_0x5e9bef,a1_0x4897bf[_0x14d266(0x1b3)](_0x111c01,_0x5a33ae),_0x5a33ae,_0x39de59)[_0x14d266(0x1ae)](()=>{const _0x521bc6=_0x14d266,_0x5e43d3=Date[_0x521bc6(0x1b4)]()-_0x1cfc40;logger[_0x521bc6(0x1ad)]('add-page',_0x521bc6(0x1aa)+_0x5a33ae,_0x5e43d3,{'template':_0x39de59,'targetPath':_0x174a1f,'routePath':_0x5a33ae}),_0x20808c(!![]);})[_0x14d266(0x1ab)](_0x11cc2f=>{const _0x311084=_0x14d266,_0x121c9d=Date[_0x311084(0x1b4)]()-_0x1cfc40;logger[_0x311084(0x1a2)](_0x311084(0x1c5),'页面添加失败:\x20'+_0x5a33ae,{'template':_0x39de59,'targetPath':_0x174a1f,'error':_0x11cc2f instanceof Error?_0x11cc2f['message']:String(_0x11cc2f),'duration':_0x121c9d});})['finally'](()=>{_0x1ae624(![]);});}},[_0x39de59,_0x5a33ae]),useEffect(()=>{_0x353286&&setTimeout(()=>{_0x476ff6();});},[_0x353286]);if(_0x39de59)return a1_0x347187(Box,{'flexDirection':_0x1ba9a4(0x1ba),'paddingY':0x1,'children':[a1_0x347187(Box,{'children':[a1_0x5e70c2(Text,{'color':_0x1ba9a4(0x1b0),'children':'\x20Step1:\x20'}),a1_0x5e70c2(Text,{'children':'已选择页面模板\x20'}),a1_0x5e70c2(Text,{'color':_0x1ba9a4(0x1c0),'children':_0x39de59})]}),_0x5a33ae?a1_0x347187(Box,{'children':[a1_0x5e70c2(Text,{'color':_0x1ba9a4(0x1b0),'children':_0x1ba9a4(0x1a4)}),a1_0x5e70c2(Text,{'children':'已输入的页面路由\x20'}),a1_0x5e70c2(Text,{'color':_0x1ba9a4(0x1c0),'children':_0x5a33ae})]}):a1_0x5e70c2(InputProjectCode,{'pagePath':_0x1dee9c,'onSubmit':_0x47bfad}),_0x5a33ae&&_0x3a869e?a1_0x347187(Box,{'marginTop':0x1,'children':[a1_0x5e70c2(Box,{'width':'4'}),a1_0x5e70c2(Text,{'children':_0x1ba9a4(0x1a9)})]}):null,_0x353286?a1_0x347187(a1_0x47a434,{'children':[a1_0x5e70c2(Box,{'marginTop':0x1,'children':a1_0x5e70c2(Text,{'color':_0x1ba9a4(0x1b0),'children':_0x1ba9a4(0x1c1)})}),a1_0x347187(Box,{'children':[a1_0x5e70c2(Text,{'color':'gray','children':'\x20*\x20页面路径:\x20'}),a1_0x5e70c2(Text,{'color':_0x1ba9a4(0x1c0),'children':_0x174a1f})]}),a1_0x347187(Box,{'children':[a1_0x5e70c2(Text,{'color':_0x1ba9a4(0x1b0),'children':_0x1ba9a4(0x1a8)}),a1_0x347187(Text,{'color':_0x1ba9a4(0x1c0),'children':['/',_0x5a33ae]})]}),a1_0x5e70c2(Box,{'marginTop':0x1,'children':a1_0x5e70c2(Text,{'color':'cyan','children':_0x1ba9a4(0x1ac)})})]}):null]});return a1_0x5e70c2(SelectPageTemplate,{'onSelect':_0x4b20a5});};
1
+ const a1_0x14a584=a1_0x93ab;(function(_0x56b545,_0x4df72c){const _0x2d1006=a1_0x93ab,_0x585bb7=_0x56b545();while(!![]){try{const _0x51247c=parseInt(_0x2d1006(0x8b))/0x1*(parseInt(_0x2d1006(0x69))/0x2)+-parseInt(_0x2d1006(0x6d))/0x3*(parseInt(_0x2d1006(0x75))/0x4)+parseInt(_0x2d1006(0x81))/0x5*(-parseInt(_0x2d1006(0x66))/0x6)+-parseInt(_0x2d1006(0x71))/0x7*(-parseInt(_0x2d1006(0x88))/0x8)+-parseInt(_0x2d1006(0x6f))/0x9+-parseInt(_0x2d1006(0x89))/0xa*(parseInt(_0x2d1006(0x7f))/0xb)+parseInt(_0x2d1006(0x72))/0xc*(parseInt(_0x2d1006(0x65))/0xd);if(_0x51247c===_0x4df72c)break;else _0x585bb7['push'](_0x585bb7['shift']());}catch(_0x57ea78){_0x585bb7['push'](_0x585bb7['shift']());}}}(a1_0x2eab,0x4debe));import{jsx as a1_0x31e614,jsxs as a1_0x54942a,Fragment as a1_0x2c6d7b}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x3797ac from'node:path';function a1_0x2eab(){const _0x3042ba=['页面添加成功:\x20','info','12eJSOki','add-page','3366747gRuQgo','已选择页面模板\x20','49PVXZtt','192SmPxmX','\x20Step2:\x20','catch','359152NJNXmD','开始添加页面:\x20','green','column','setLogPath','join','url','\x20*\x20页面路径:\x20','src','success','253lYwXmR','now','65QdZxMK','正在创建页面,请稍候…','gray','pages','\x20*\x20路由地址:\x20','dirname','message','618032tFxquO','233300sqJJzm','resolve','18509FmPkim','824798DyNfpU','155586vJuLjv','cwd','../../templates/pages','40gwKgNU','\x20Step1:\x20'];a1_0x2eab=function(){return _0x3042ba;};return a1_0x2eab();}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';import{logger}from'../utils/logger.js';function a1_0x93ab(_0xdfd2bb,_0x2bff1e){const _0x2eab41=a1_0x2eab();return a1_0x93ab=function(_0x93ab56,_0x27497e){_0x93ab56=_0x93ab56-0x65;let _0x3eec74=_0x2eab41[_0x93ab56];return _0x3eec74;},a1_0x93ab(_0xdfd2bb,_0x2bff1e);}import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x3797ac[a1_0x14a584(0x86)](fileURLToPath(import.meta[a1_0x14a584(0x7b)])),pageTemplateDir=a1_0x3797ac[a1_0x14a584(0x8a)](__dirname,a1_0x14a584(0x68)),projectDir=process[a1_0x14a584(0x67)]();export const AddPage=()=>{const _0x3b76df=a1_0x14a584,{exit:_0x1585e7}=useApp(),[_0x5cbede,_0x5dd85d]=useState(''),[_0x5b3db4,_0x562824]=useState(''),[_0x5c0835,_0x2fab80]=useState(![]),[_0x161639,_0x4c6979]=useState(![]),_0x4802ec=a1_0x3797ac[_0x3b76df(0x7a)](projectDir,_0x3b76df(0x7d),'pages'),_0x2d6be1=a1_0x3797ac['join'](_0x4802ec,_0x5b3db4),_0x5cfb08=a1_0x3797ac[_0x3b76df(0x7a)](_0x3b76df(0x7d),_0x3b76df(0x84),_0x5b3db4);useEffect(()=>{const _0x1b756b=_0x3b76df,_0x515a5c=a1_0x3797ac[_0x1b756b(0x8a)](pageTemplateDir,_0x5cbede);if(_0x5cbede&&_0x5b3db4){_0x2fab80(!![]),logger[_0x1b756b(0x79)](process[_0x1b756b(0x67)]());const _0x3e390d=Date[_0x1b756b(0x80)]();logger[_0x1b756b(0x6c)](_0x1b756b(0x6e),_0x1b756b(0x76)+_0x5b3db4,{'template':_0x5cbede,'targetPath':_0x5cfb08}),TemplateReplacer['processTemplate'](_0x515a5c,a1_0x3797ac[_0x1b756b(0x7a)](_0x4802ec,_0x5b3db4),_0x5b3db4,_0x5cbede)['then'](()=>{const _0x3a3f9f=_0x1b756b,_0x28e464=Date[_0x3a3f9f(0x80)]()-_0x3e390d;logger[_0x3a3f9f(0x7e)]('add-page',_0x3a3f9f(0x6b)+_0x5b3db4,_0x28e464,{'template':_0x5cbede,'targetPath':_0x5cfb08,'routePath':_0x5b3db4}),_0x4c6979(!![]);})[_0x1b756b(0x74)](_0x4143c5=>{const _0x254d36=_0x1b756b,_0x251ba9=Date[_0x254d36(0x80)]()-_0x3e390d;logger['error'](_0x254d36(0x6e),'页面添加失败:\x20'+_0x5b3db4,{'template':_0x5cbede,'targetPath':_0x5cfb08,'error':_0x4143c5 instanceof Error?_0x4143c5[_0x254d36(0x87)]:String(_0x4143c5),'duration':_0x251ba9});})['finally'](()=>{_0x2fab80(![]);});}},[_0x5cbede,_0x5b3db4]),useEffect(()=>{_0x161639&&setTimeout(()=>{_0x1585e7();});},[_0x161639]);if(_0x5cbede)return a1_0x54942a(Box,{'flexDirection':_0x3b76df(0x78),'paddingY':0x1,'children':[a1_0x54942a(Box,{'children':[a1_0x31e614(Text,{'color':_0x3b76df(0x83),'children':_0x3b76df(0x6a)}),a1_0x31e614(Text,{'children':_0x3b76df(0x70)}),a1_0x31e614(Text,{'color':_0x3b76df(0x77),'children':_0x5cbede})]}),_0x5b3db4?a1_0x54942a(Box,{'children':[a1_0x31e614(Text,{'color':_0x3b76df(0x83),'children':_0x3b76df(0x73)}),a1_0x31e614(Text,{'children':'已输入的页面路由\x20'}),a1_0x31e614(Text,{'color':'green','children':_0x5b3db4})]}):a1_0x31e614(InputProjectCode,{'pagePath':_0x2d6be1,'onSubmit':_0x562824}),_0x5b3db4&&_0x5c0835?a1_0x54942a(Box,{'marginTop':0x1,'children':[a1_0x31e614(Box,{'width':'4'}),a1_0x31e614(Text,{'children':_0x3b76df(0x82)})]}):null,_0x161639?a1_0x54942a(a1_0x2c6d7b,{'children':[a1_0x31e614(Box,{'marginTop':0x1,'children':a1_0x31e614(Text,{'color':'gray','children':'\x20*\x20页面创建成功!'})}),a1_0x54942a(Box,{'children':[a1_0x31e614(Text,{'color':_0x3b76df(0x83),'children':_0x3b76df(0x7c)}),a1_0x31e614(Text,{'color':'green','children':_0x5cfb08})]}),a1_0x54942a(Box,{'children':[a1_0x31e614(Text,{'color':_0x3b76df(0x83),'children':_0x3b76df(0x85)}),a1_0x54942a(Text,{'color':_0x3b76df(0x77),'children':['/',_0x5b3db4]})]}),a1_0x31e614(Box,{'marginTop':0x1,'children':a1_0x31e614(Text,{'color':'cyan','children':'\x20*\x20页面文件已创建,可直接通过路由访问'})})]}):null]});return a1_0x31e614(SelectPageTemplate,{'onSelect':_0x5dd85d});};
@@ -1 +1 @@
1
- function a2_0x5a18(_0x44248e,_0x6c2d05){const _0x40a0a5=a2_0x40a0();return a2_0x5a18=function(_0x5a1830,_0x2d4511){_0x5a1830=_0x5a1830-0x17a;let _0x3793a5=_0x40a0a5[_0x5a1830];return _0x3793a5;},a2_0x5a18(_0x44248e,_0x6c2d05);}(function(_0x1816aa,_0x3b16b0){const _0x1b5bc6=a2_0x5a18,_0x2c049c=_0x1816aa();while(!![]){try{const _0x438bad=parseInt(_0x1b5bc6(0x187))/0x1*(parseInt(_0x1b5bc6(0x19c))/0x2)+-parseInt(_0x1b5bc6(0x191))/0x3+parseInt(_0x1b5bc6(0x186))/0x4*(-parseInt(_0x1b5bc6(0x18c))/0x5)+parseInt(_0x1b5bc6(0x17f))/0x6+parseInt(_0x1b5bc6(0x194))/0x7*(parseInt(_0x1b5bc6(0x197))/0x8)+-parseInt(_0x1b5bc6(0x192))/0x9+parseInt(_0x1b5bc6(0x193))/0xa;if(_0x438bad===_0x3b16b0)break;else _0x2c049c['push'](_0x2c049c['shift']());}catch(_0x58ca8b){_0x2c049c['push'](_0x2c049c['shift']());}}}(a2_0x40a0,0x3fc65));import{jsx as a2_0x280047,jsxs as a2_0x2bc691}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x306911 from'node:path';import{fileURLToPath}from'node:url';function a2_0x40a0(){const _0x100526=['label','gray','length','585882kekacg','2212605klsJTQ','3905800QloZnM','410893mxKrqJ','resolve','正在加载页面模板...','56gggMOE','isDirectory','url','sdk-fetch','获取模板列表失败:','99406ciYznk','../..','filter','column','templates/pages','sort','1834500tPtWHx','map','dirname','name','请选择您要创建的页面模板','onSelect','green','2017076ipEmDE','2wWTqkD','\x20\x20\x20\x20\x20\x20>\x20','\x20Step1:\x20','downArrow','return','5fTxnMM','blank'];a2_0x40a0=function(){return _0x100526;};return a2_0x40a0();}async function getTemplateList(){const _0x204bb2=a2_0x5a18;try{const _0x294a31=fileURLToPath(import.meta[_0x204bb2(0x199)]),_0x4ba8ac=a2_0x306911[_0x204bb2(0x195)](a2_0x306911[_0x204bb2(0x181)](_0x294a31),_0x204bb2(0x17a)),_0x2a7354=a2_0x306911['join'](_0x4ba8ac,_0x204bb2(0x17d)),_0x2ec324=await readdir(_0x2a7354,{'withFileTypes':!![]}),_0x4d4feb=_0x2ec324[_0x204bb2(0x17b)](_0x1bea8d=>_0x1bea8d[_0x204bb2(0x198)]())[_0x204bb2(0x180)](_0x2083ef=>({'label':_0x2083ef[_0x204bb2(0x182)]}))[_0x204bb2(0x17e)]((_0x16a754,_0x4d3c52)=>_0x16a754[_0x204bb2(0x18e)]['localeCompare'](_0x4d3c52[_0x204bb2(0x18e)]));return _0x4d4feb;}catch(_0x17e73a){return console['error'](_0x204bb2(0x19b),_0x17e73a),[{'label':_0x204bb2(0x18d)},{'label':_0x204bb2(0x19a)}];}}export function SelectPageTemplate(_0x34fcd3){const _0x4130d4=a2_0x5a18,[_0x457a76,_0x487cc5]=useState(0x0),[_0x54b3a3,_0x435237]=useState([]),[_0x597e4b,_0x3579fc]=useState(!![]);useEffect(()=>{async function _0x5cb910(){const _0xccf7d2=await getTemplateList();_0x435237(_0xccf7d2),_0x3579fc(![]);}_0x5cb910();},[]),useInput((_0x2dd2f9,_0x1ffa6d)=>{const _0x150057=a2_0x5a18;if(_0x597e4b)return;if(_0x1ffa6d[_0x150057(0x18b)]){const _0x9b32c6=_0x54b3a3[_0x457a76];_0x9b32c6&&_0x34fcd3[_0x150057(0x184)](_0x9b32c6['label']);}_0x1ffa6d['upArrow']&&_0x487cc5(_0x4be6ac=>_0x4be6ac===0x0?_0x54b3a3[_0x150057(0x190)]-0x1:_0x4be6ac-0x1),_0x1ffa6d[_0x150057(0x18a)]&&_0x487cc5(_0x40b07e=>_0x40b07e===_0x54b3a3['length']-0x1?0x0:_0x40b07e+0x1);});if(_0x597e4b)return a2_0x280047(Box,{'flexDirection':_0x4130d4(0x17c),'paddingY':0x1,'children':a2_0x2bc691(Box,{'children':[a2_0x280047(Text,{'color':_0x4130d4(0x18f),'children':_0x4130d4(0x189)}),a2_0x280047(Text,{'children':_0x4130d4(0x196)})]})});return a2_0x2bc691(Box,{'flexDirection':_0x4130d4(0x17c),'paddingY':0x1,'children':[a2_0x2bc691(Box,{'children':[a2_0x280047(Text,{'color':_0x4130d4(0x18f),'children':_0x4130d4(0x189)}),a2_0x280047(Text,{'children':_0x4130d4(0x183)})]}),_0x54b3a3[_0x4130d4(0x180)]((_0xc3df1a,_0x42c643)=>{const _0x3e09ee=_0x4130d4,_0x1cf9af=_0x42c643===_0x457a76,_0x2738a3=_0x1cf9af?_0x3e09ee(0x188)+_0xc3df1a['label']:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0xc3df1a[_0x3e09ee(0x18e)];return a2_0x280047(Box,{'children':a2_0x280047(Text,{'color':_0x1cf9af?_0x3e09ee(0x185):undefined,'children':_0x2738a3})},_0x2738a3);})]});}
1
+ (function(_0x296802,_0xb4d221){const _0x43fb87=a2_0x18ea,_0x3334b3=_0x296802();while(!![]){try{const _0x19946d=parseInt(_0x43fb87(0xa1))/0x1*(parseInt(_0x43fb87(0x92))/0x2)+-parseInt(_0x43fb87(0x91))/0x3+parseInt(_0x43fb87(0x99))/0x4+parseInt(_0x43fb87(0x94))/0x5+parseInt(_0x43fb87(0x88))/0x6*(-parseInt(_0x43fb87(0x8b))/0x7)+parseInt(_0x43fb87(0xa3))/0x8*(-parseInt(_0x43fb87(0x8d))/0x9)+-parseInt(_0x43fb87(0xa4))/0xa;if(_0x19946d===_0xb4d221)break;else _0x3334b3['push'](_0x3334b3['shift']());}catch(_0x3dd33e){_0x3334b3['push'](_0x3334b3['shift']());}}}(a2_0x56cd,0x6b7f8));import{jsx as a2_0x7e1ee1,jsxs as a2_0x5726eb}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x5d78be from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x152fb0=a2_0x18ea;try{const _0x9c6871=fileURLToPath(import.meta['url']),_0x21d189=a2_0x5d78be[_0x152fb0(0x93)](a2_0x5d78be['dirname'](_0x9c6871),_0x152fb0(0xa0)),_0x466038=a2_0x5d78be[_0x152fb0(0x97)](_0x21d189,'templates/pages'),_0x3e1975=await readdir(_0x466038,{'withFileTypes':!![]}),_0x5d660a=_0x3e1975['filter'](_0x7bfa51=>_0x7bfa51[_0x152fb0(0xa5)]())[_0x152fb0(0x95)](_0x46090f=>({'label':_0x46090f[_0x152fb0(0x9c)]}))[_0x152fb0(0x8e)]((_0x32f502,_0x45279b)=>_0x32f502[_0x152fb0(0x89)][_0x152fb0(0x8c)](_0x45279b['label']));return _0x5d660a;}catch(_0xf62589){return console[_0x152fb0(0x9e)](_0x152fb0(0x98),_0xf62589),[{'label':_0x152fb0(0x90)},{'label':'sdk-fetch'}];}}function a2_0x56cd(){const _0xe550fe=['downArrow','../..','49vASgTh','return','49512HJJHKr','2488160waTzED','isDirectory','正在加载页面模板...','gray','6rTgHGD','label','\x20Step1:\x20','575134MKZUzg','localeCompare','441dezWtn','sort','upArrow','blank','1486956TZkrER','19126CPOFsC','resolve','1415185IkCxNZ','map','\x20\x20\x20\x20\x20\x20\x20\x20','join','获取模板列表失败:','3274316BXVpmL','column','请选择您要创建的页面模板','name','green','error'];a2_0x56cd=function(){return _0xe550fe;};return a2_0x56cd();}function a2_0x18ea(_0x1ba14b,_0x3c0e89){const _0x56cdcf=a2_0x56cd();return a2_0x18ea=function(_0x18ea71,_0x7549fb){_0x18ea71=_0x18ea71-0x87;let _0x594605=_0x56cdcf[_0x18ea71];return _0x594605;},a2_0x18ea(_0x1ba14b,_0x3c0e89);}export function SelectPageTemplate(_0xca734){const _0x32b6db=a2_0x18ea,[_0x1274dc,_0x4798a4]=useState(0x0),[_0x3435f8,_0x57d70e]=useState([]),[_0x27468f,_0x399c44]=useState(!![]);useEffect(()=>{async function _0xb74fc5(){const _0xb8bdcb=await getTemplateList();_0x57d70e(_0xb8bdcb),_0x399c44(![]);}_0xb74fc5();},[]),useInput((_0xa02bd,_0x331c4f)=>{const _0x17f377=a2_0x18ea;if(_0x27468f)return;if(_0x331c4f[_0x17f377(0xa2)]){const _0x1b584c=_0x3435f8[_0x1274dc];_0x1b584c&&_0xca734['onSelect'](_0x1b584c[_0x17f377(0x89)]);}_0x331c4f[_0x17f377(0x8f)]&&_0x4798a4(_0x38b7c=>_0x38b7c===0x0?_0x3435f8['length']-0x1:_0x38b7c-0x1),_0x331c4f[_0x17f377(0x9f)]&&_0x4798a4(_0x377eb9=>_0x377eb9===_0x3435f8['length']-0x1?0x0:_0x377eb9+0x1);});if(_0x27468f)return a2_0x7e1ee1(Box,{'flexDirection':_0x32b6db(0x9a),'paddingY':0x1,'children':a2_0x5726eb(Box,{'children':[a2_0x7e1ee1(Text,{'color':_0x32b6db(0x87),'children':'\x20Step1:\x20'}),a2_0x7e1ee1(Text,{'children':_0x32b6db(0xa6)})]})});return a2_0x5726eb(Box,{'flexDirection':_0x32b6db(0x9a),'paddingY':0x1,'children':[a2_0x5726eb(Box,{'children':[a2_0x7e1ee1(Text,{'color':_0x32b6db(0x87),'children':_0x32b6db(0x8a)}),a2_0x7e1ee1(Text,{'children':_0x32b6db(0x9b)})]}),_0x3435f8['map']((_0xa9710a,_0x123d2f)=>{const _0x39a46c=_0x32b6db,_0x4a4c1e=_0x123d2f===_0x1274dc,_0x481196=_0x4a4c1e?'\x20\x20\x20\x20\x20\x20>\x20'+_0xa9710a[_0x39a46c(0x89)]:_0x39a46c(0x96)+_0xa9710a[_0x39a46c(0x89)];return a2_0x7e1ee1(Box,{'children':a2_0x7e1ee1(Text,{'color':_0x4a4c1e?_0x39a46c(0x9d):undefined,'children':_0x481196})},_0x481196);})]});}
@@ -0,0 +1 @@
1
+ (function(_0x1f9201,_0x31c7ac){const _0x1fc8c0=a3_0xca46,_0xa8a426=_0x1f9201();while(!![]){try{const _0x5c2bd8=-parseInt(_0x1fc8c0(0x115))/0x1+-parseInt(_0x1fc8c0(0x116))/0x2+-parseInt(_0x1fc8c0(0x121))/0x3*(parseInt(_0x1fc8c0(0x120))/0x4)+parseInt(_0x1fc8c0(0x12f))/0x5+-parseInt(_0x1fc8c0(0x129))/0x6+parseInt(_0x1fc8c0(0x122))/0x7*(-parseInt(_0x1fc8c0(0x119))/0x8)+parseInt(_0x1fc8c0(0x128))/0x9*(parseInt(_0x1fc8c0(0x105))/0xa);if(_0x5c2bd8===_0x31c7ac)break;else _0xa8a426['push'](_0xa8a426['shift']());}catch(_0x59524f){_0xa8a426['push'](_0xa8a426['shift']());}}}(a3_0x275f,0x9de54));function a3_0x275f(){const _0x494bb3=['3872685QgtwcF','error','originalCount','red','未提供应用AppCode,且配置中也没有默认值','datasetName','lovrabet\x20auth','length','38106790qeKXyo','setLogPath','filePath','./docs','🚀\x20','map','success','yellow','env','datasetCode',',\x20失败\x20','dim','正在获取数据集列表...','green','cyan','api-doc','1146950ootLUf','821848jywfhb','使用指定的应用AppCode:\x20','未找到任何数据集','40FtCnMX','filter','!\x20原始数据集\x20','gray','white','duplicateCount','文档生成完成','8KQWBHV','1013217zffKVl','852131aHyZKz','column','正在生成\x20','*\x20输出目录:\x20','使用配置的应用AppCode:\x20','√\x20文档生成完成!成功\x20','9ugIpDV','6578754ZlBvWC','*\x20生成的文档文件:','message','\x20个,过滤重复','文档生成失败:\x20','\x20(环境:\x20'];a3_0x275f=function(){return _0x494bb3;};return a3_0x275f();}import{jsx as a3_0x3d1937,jsxs as a3_0x3063cd,Fragment as a3_0x102038}from'react/jsx-runtime';function a3_0xca46(_0x4722c3,_0x549554){const _0x275f68=a3_0x275f();return a3_0xca46=function(_0xca46e,_0x45f6eb){_0xca46e=_0xca46e-0x102;let _0x265d72=_0x275f68[_0xca46e];return _0x265d72;},a3_0xca46(_0x4722c3,_0x549554);}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{fetchDatasets}from'./fetch-datasets.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x512786,env:_0x10a2a9,output:_0x121972})=>{const _0xbb8a72=a3_0xca46,{exit:_0x239479}=useApp(),[_0x3da647,_0x24c583]=useState(![]),[_0x245581,_0x1353ae]=useState(''),[_0x42db59,_0x35641a]=useState(![]),[_0x157ed9,_0x5048de]=useState(null),[_0x502d5d,_0x4d38a0]=useState(null),[_0x55fe74,_0x116648]=useState(null),_0x55075f=readConfig(),_0x5c21ab=getConfigAppCode(),_0x584380=_0x512786||_0x5c21ab,_0x54fa6d=typeof _0x55075f?.['env']==='string'?_0x55075f[_0xbb8a72(0x10d)]:undefined,_0xd2fc4f=_0x10a2a9||_0x54fa6d||'online';initEnv(_0xd2fc4f);const _0x2a2db3=_0x121972||_0xbb8a72(0x108),_0x5457ae=_0x512786?_0xbb8a72(0x117)+_0x584380:_0xbb8a72(0x126)+_0x584380;useEffect(()=>{_0x24c583(!![]),_0x271e34();},[]),useEffect(()=>{(_0x42db59||_0x157ed9)&&_0x239479();},[_0x42db59,_0x157ed9,_0x239479]);async function _0x271e34(){const _0x482141=_0xbb8a72;if(!_0x584380){_0x5048de(_0x482141(0x133));return;}try{logger[_0x482141(0x106)](process['cwd']()),_0x1353ae(_0x482141(0x111));const {rawData:_0x55b319,originalCount:_0x87856e,filteredCount:_0x27398a,duplicateCount:_0xda7f65}=await fetchDatasets(_0x584380);_0x116648({'originalCount':_0x87856e,'filteredCount':_0x27398a,'duplicateCount':_0xda7f65});if(_0x55b319[_0x482141(0x104)]===0x0){_0x5048de(_0x482141(0x118));return;}_0x1353ae(_0x482141(0x124)+_0x55b319[_0x482141(0x104)]+'\x20个数据集的文档...');const _0x1b62a3=await generateDatasetDocs(_0x55b319,_0x584380,_0x2a2db3,(_0x348419,_0x17491a,_0x3d77a7)=>{_0x1353ae('正在生成\x20'+_0x3d77a7+'.md\x20('+_0x348419+'/'+_0x17491a+')');});_0x4d38a0(_0x1b62a3),_0x35641a(!![]);const _0x128dcb=_0x1b62a3[_0x482141(0x11a)](_0x10f86a=>_0x10f86a['success'])[_0x482141(0x104)],_0x28bb73=_0x1b62a3[_0x482141(0x11a)](_0x5a7d1f=>!_0x5a7d1f['success'])[_0x482141(0x104)];logger[_0x482141(0x10b)](_0x482141(0x114),_0x482141(0x11f),undefined,{'totalCount':_0x1b62a3[_0x482141(0x104)],'successCount':_0x128dcb,'failCount':_0x28bb73,'outputDir':_0x2a2db3});}catch(_0x28d3f5){const _0x55287e=_0x28d3f5 instanceof Error?_0x28d3f5[_0x482141(0x12b)]:String(_0x28d3f5);logger[_0x482141(0x130)](_0x482141(0x114),_0x482141(0x12d)+_0x55287e,{'appCode':_0x584380,'outputDir':_0x2a2db3}),_0x5048de(_0x482141(0x12d)+_0x55287e);}finally{_0x24c583(![]);}}const _0x100b2b=_0x502d5d?.[_0xbb8a72(0x11a)](_0x115e72=>_0x115e72[_0xbb8a72(0x10b)])[_0xbb8a72(0x104)]||0x0,_0x157e2a=_0x502d5d?.[_0xbb8a72(0x11a)](_0x4f53b4=>!_0x4f53b4[_0xbb8a72(0x10b)])[_0xbb8a72(0x104)]||0x0;return a3_0x3063cd(Box,{'flexDirection':'column','children':[(_0x3da647||_0x42db59)&&a3_0x3063cd(Box,{'children':[a3_0x3d1937(Text,{'color':_0xbb8a72(0x11c),'children':'*\x20'}),a3_0x3d1937(Text,{'color':_0x512786?_0xbb8a72(0x11d):_0xbb8a72(0x110),'children':_0x5457ae})]}),_0x3da647&&a3_0x3d1937(Box,{'children':a3_0x3063cd(Text,{'children':[_0xbb8a72(0x109),_0x245581,_0xbb8a72(0x12e),_0xd2fc4f,')']})}),_0x42db59&&_0x502d5d&&_0x55fe74&&a3_0x3063cd(Box,{'flexDirection':_0xbb8a72(0x123),'children':[a3_0x3d1937(Box,{'children':a3_0x3063cd(Text,{'color':_0xbb8a72(0x112),'children':[_0xbb8a72(0x127),_0x100b2b,'\x20个',_0x157e2a>0x0&&_0xbb8a72(0x10f)+_0x157e2a+'\x20个']})}),_0x55fe74[_0xbb8a72(0x11e)]>0x0&&a3_0x3d1937(Box,{'marginTop':0x1,'children':a3_0x3063cd(Text,{'color':_0xbb8a72(0x10c),'children':[_0xbb8a72(0x11b),_0x55fe74[_0xbb8a72(0x131)],_0xbb8a72(0x12c),'\x20',_0x55fe74[_0xbb8a72(0x11e)],'\x20个']})}),a3_0x3063cd(Box,{'marginTop':0x1,'children':[a3_0x3d1937(Text,{'color':'gray','children':_0xbb8a72(0x125)}),a3_0x3d1937(Text,{'color':'cyan','children':_0x2a2db3})]}),_0x100b2b>0x0&&a3_0x3063cd(a3_0x102038,{'children':[a3_0x3d1937(Box,{'marginTop':0x1,'children':a3_0x3d1937(Text,{'color':_0xbb8a72(0x11c),'children':_0xbb8a72(0x12a)})}),_0x502d5d[_0xbb8a72(0x11a)](_0x125fae=>_0x125fae[_0xbb8a72(0x10b)])[_0xbb8a72(0x10a)]((_0x3cef80,_0x1d17d9)=>a3_0x3063cd(Box,{'marginLeft':0x2,'children':[a3_0x3063cd(Text,{'color':'cyan','children':['•\x20',_0x3cef80[_0xbb8a72(0x107)]]}),a3_0x3063cd(Text,{'color':'dim','children':['\x20-\x20',_0x3cef80[_0xbb8a72(0x102)]]})]},_0x1d17d9))]}),_0x157e2a>0x0&&a3_0x3063cd(a3_0x102038,{'children':[a3_0x3d1937(Box,{'marginTop':0x1,'children':a3_0x3d1937(Text,{'color':'yellow','children':'⚠️\x20以下数据集生成失败:'})}),_0x502d5d[_0xbb8a72(0x11a)](_0x1b4a45=>!_0x1b4a45['success'])[_0xbb8a72(0x10a)]((_0x7223b5,_0x3c9c82)=>a3_0x3063cd(Box,{'marginLeft':0x2,'flexDirection':_0xbb8a72(0x123),'children':[a3_0x3063cd(Text,{'color':_0xbb8a72(0x132),'children':['•\x20',_0x7223b5[_0xbb8a72(0x102)],'\x20(',_0x7223b5[_0xbb8a72(0x10e)],')']}),_0x7223b5[_0xbb8a72(0x130)]&&a3_0x3d1937(Box,{'marginLeft':0x2,'children':a3_0x3d1937(Text,{'color':_0xbb8a72(0x110),'children':_0x7223b5['error']})})]},_0x3c9c82))]})]}),_0x157ed9&&a3_0x3063cd(Box,{'flexDirection':_0xbb8a72(0x123),'children':[a3_0x3d1937(Box,{'children':a3_0x3063cd(Text,{'color':_0xbb8a72(0x132),'children':['❌\x20',_0x157ed9]})}),_0x157ed9['includes']('登录')&&a3_0x3063cd(Box,{'marginTop':0x1,'children':[a3_0x3d1937(Text,{'color':_0xbb8a72(0x10c),'children':'💡\x20请使用\x20'}),a3_0x3d1937(Text,{'color':_0xbb8a72(0x113),'children':_0xbb8a72(0x103)}),a3_0x3d1937(Text,{'color':_0xbb8a72(0x10c),'children':'\x20重新登录后再试'})]})]})]});};
@@ -0,0 +1 @@
1
+ const a4_0x41d9a9=a4_0x2b90;(function(_0x35c151,_0x31a96e){const _0x2ac990=a4_0x2b90,_0xad9001=_0x35c151();while(!![]){try{const _0x447f38=parseInt(_0x2ac990(0x12a))/0x1+parseInt(_0x2ac990(0x138))/0x2+parseInt(_0x2ac990(0x122))/0x3+-parseInt(_0x2ac990(0x134))/0x4*(-parseInt(_0x2ac990(0x11d))/0x5)+parseInt(_0x2ac990(0x11a))/0x6+parseInt(_0x2ac990(0x11f))/0x7+-parseInt(_0x2ac990(0x129))/0x8;if(_0x447f38===_0x31a96e)break;else _0xad9001['push'](_0xad9001['shift']());}catch(_0x53b269){_0xad9001['push'](_0xad9001['shift']());}}}(a4_0x1b89,0x39d2b));import{mkdirSync,writeFileSync}from'node:fs';import a4_0x41a502 from'node:path';function a4_0x1b89(){const _0x335ca5=['data','slice','.md','stringify','code','生成文档失败:\x20','4PZRThf','dbtableConfig','markdown','./docs','876714XPDcSn','),HTTP状态码:\x20','status','push','length','184728hTmiFT','响应数据格式错误\x20(',']\x20正在生成:\x20','1223890alITSi','✓\x20成功生成:\x20','3286388kjOFVZ','log','/api/node-toolbox/api-doc-generator','84246gOkImw','api-doc','✗\x20失败:\x20','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','.md\x20(','name','string','7807672VkOInf','1313qoGLeH','):缺少\x20data.markdown\x20字段','utf8','tableName'];a4_0x1b89=function(){return _0x335ca5;};return a4_0x1b89();}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a4_0x2b90(_0x57127b,_0x514be8){const _0x1b8993=a4_0x1b89();return a4_0x2b90=function(_0x2b90c1,_0x25ca83){_0x2b90c1=_0x2b90c1-0x119;let _0x1c12f6=_0x1b8993[_0x2b90c1];return _0x1c12f6;},a4_0x2b90(_0x57127b,_0x514be8);}import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0xb354ee){const _0x5c5f84=a4_0x2b90,{appCode:_0x16ea57,datasetCode:_0x1a103e,datasetId:_0x574f81}=_0xb354ee,_0x3b1233=getApiDomain(),_0x363ec0=_0x3b1233+_0x5c5f84(0x121),_0x436578=await fetch(_0x363ec0,{'method':'POST','headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON[_0x5c5f84(0x131)]({'appCode':_0x16ea57,'datasetCode':_0x1a103e,'datasetId':_0x574f81})});if(!_0x436578['ok']){if(_0x436578[_0x5c5f84(0x13a)]===0x191)throw new Error(_0x5c5f84(0x125));let _0x87f1f9='';try{_0x87f1f9=await _0x436578['text']();}catch(_0x1fa237){}throw new Error('获取文档失败\x20('+_0x1a103e+_0x5c5f84(0x139)+_0x436578[_0x5c5f84(0x13a)]+(_0x87f1f9?'\x0a'+_0x87f1f9:''));}const _0x22c166=await _0x436578['json']();if(!_0x22c166[_0x5c5f84(0x12e)]||typeof _0x22c166[_0x5c5f84(0x12e)][_0x5c5f84(0x136)]!==_0x5c5f84(0x128))throw new Error(_0x5c5f84(0x11b)+_0x1a103e+_0x5c5f84(0x12b));return _0x22c166[_0x5c5f84(0x12e)][_0x5c5f84(0x136)];}function delay(_0x9221cf){return new Promise(_0xc6bb63=>setTimeout(_0xc6bb63,_0x9221cf));}export async function generateDatasetDocs(_0x4cd581,_0x5ac5bf,_0x49e9ac=a4_0x41d9a9(0x137),_0x93d7b1){const _0x133717=a4_0x41d9a9;mkdirSync(_0x49e9ac,{'recursive':!![]});const _0x32a204=[],_0x25322f=_0x4cd581[_0x133717(0x119)];console[_0x133717(0x120)]('\x0a共有\x20'+_0x25322f+'\x20个数据集需要生成文档\x0a');for(let _0x1132a9=0x0;_0x1132a9<_0x4cd581[_0x133717(0x119)];_0x1132a9++){const _0x2071da=_0x4cd581[_0x1132a9],_0x5e54d7=_0x1132a9+0x1;let _0x486250;if(_0x2071da[_0x133717(0x135)]?.[_0x133717(0x12d)])_0x486250=_0x2071da[_0x133717(0x135)]['tableName'];else{const _0xe52d58=_0x2071da[_0x133717(0x132)][_0x133717(0x12f)](-0x4);_0x486250='dataset_'+_0xe52d58;}try{console['log']('['+_0x5e54d7+'/'+_0x25322f+_0x133717(0x11c)+_0x486250+_0x133717(0x126)+_0x2071da[_0x133717(0x127)]+')');_0x93d7b1&&_0x93d7b1(_0x5e54d7,_0x25322f,_0x486250);const _0x5bb7b9=await fetchDatasetDoc({'appCode':_0x5ac5bf,'datasetCode':_0x2071da[_0x133717(0x132)],'datasetId':_0x2071da['id'],'enableAI':![]}),_0x2757b6=a4_0x41a502['join'](_0x49e9ac,_0x486250+_0x133717(0x130));writeFileSync(_0x2757b6,_0x5bb7b9,{'encoding':_0x133717(0x12c)}),console['log'](_0x133717(0x11e)+_0x486250+_0x133717(0x130)),logger['success'](_0x133717(0x123),'生成文档成功:\x20'+_0x486250,undefined,{'datasetCode':_0x2071da[_0x133717(0x132)],'datasetName':_0x2071da['name'],'filePath':_0x2757b6,'progress':_0x5e54d7+'/'+_0x25322f}),_0x32a204[_0x133717(0x13b)]({'datasetCode':_0x2071da[_0x133717(0x132)],'datasetName':_0x2071da[_0x133717(0x127)],'filePath':_0x2757b6,'success':!![]}),_0x5e54d7<_0x25322f&&await delay(0xbb8);}catch(_0x375fee){const _0x5bb393=_0x375fee instanceof Error?_0x375fee['message']:String(_0x375fee);console['log'](_0x133717(0x124)+_0x486250+'.md\x20-\x20'+_0x5bb393+'\x0a'),logger['error'](_0x133717(0x123),_0x133717(0x133)+_0x2071da[_0x133717(0x132)],{'datasetCode':_0x2071da[_0x133717(0x132)],'datasetName':_0x2071da[_0x133717(0x127)],'error':_0x5bb393,'progress':_0x5e54d7+'/'+_0x25322f}),_0x32a204[_0x133717(0x13b)]({'datasetCode':_0x2071da[_0x133717(0x132)],'datasetName':_0x2071da['name'],'filePath':'','success':![],'error':_0x5bb393}),_0x5e54d7<_0x25322f&&(console[_0x133717(0x120)]('等待\x203\x20秒...\x0a'),await delay(0xbb8));}}return _0x32a204;}
@@ -1 +1 @@
1
- (function(_0x3de300,_0x5b7d20){const _0x1f06af=a3_0xf095,_0x6a04e5=_0x3de300();while(!![]){try{const _0x258521=parseInt(_0x1f06af(0x14d))/0x1+parseInt(_0x1f06af(0x169))/0x2+parseInt(_0x1f06af(0x177))/0x3+-parseInt(_0x1f06af(0x15f))/0x4*(-parseInt(_0x1f06af(0x14b))/0x5)+-parseInt(_0x1f06af(0x147))/0x6*(parseInt(_0x1f06af(0x168))/0x7)+parseInt(_0x1f06af(0x164))/0x8+-parseInt(_0x1f06af(0x157))/0x9*(parseInt(_0x1f06af(0x15d))/0xa);if(_0x258521===_0x5b7d20)break;else _0x6a04e5['push'](_0x6a04e5['shift']());}catch(_0x31fb58){_0x6a04e5['push'](_0x6a04e5['shift']());}}}(a3_0x4302,0xf0968));import{jsx as a3_0x239839,jsxs as a3_0x2c8b61}from'react/jsx-runtime';import{useEffect,useState}from'react';function a3_0x4302(){const _0x560483=['29784663uMMxqu','api-pull','success','green','拉取\x20API\x20配置失败:\x20','cyan','10OFgXzA','使用指定的应用AppCode:\x20','1535188YwGowy','status',',且无法读取错误响应内容','string','replace','1057160IdmdWQ','slice','.ts','message','5572021SaZAAK','3761592Drwszk','💡\x20请使用\x20','data','white','split','env','\x20-\x20客户端实例文件','tableData','未提供应用AppCode,且配置中也没有默认值','url','dim','api','yellow','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','3133935uptdzw','-client','setLogPath','\x20和\x20','\x20-\x20模型配置文件','-api','includes','import\x20','12sJeDOE','red','\x20重新登录后再试','client','25hkywhz','√\x20API\x20文件生成成功!','910290szWblG','&pageSize=999&currentPage=1','gray','error','lovrabet\x20auth','online','获取数据集失败,HTTP状态码:\x20','/smartapi/dataset/getList?appCode=','app','column'];a3_0x4302=function(){return _0x560483;};return a3_0x4302();}import{Box,Text,useApp}from'ink';import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';function a3_0xf095(_0x59a2a4,_0x3a331f){const _0x430237=a3_0x4302();return a3_0xf095=function(_0xf09505,_0x4402ab){_0xf09505=_0xf09505-0x147;let _0x262626=_0x430237[_0xf09505];return _0x262626;},a3_0xf095(_0x59a2a4,_0x3a331f);}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0x4c33c6,env:_0x2e9dcb,output:_0x5f03f1})=>{const _0x31547c=a3_0xf095,{exit:_0x22e97c}=useApp(),[_0xdcf659,_0x52c032]=useState(![]),[_0x51fa5d,_0x495b07]=useState(![]),[_0xe13024,_0x22819b]=useState(null),[_0x26bcca,_0x32a584]=useState(null),_0x22e576=readConfig(),_0x458797=_0x4c33c6||_0x22e576?.[_0x31547c(0x155)],_0x48aa9b=typeof _0x22e576?.[_0x31547c(0x16e)]===_0x31547c(0x162)?_0x22e576[_0x31547c(0x16e)]:undefined,_0x755727=_0x2e9dcb||_0x48aa9b||_0x31547c(0x152);initEnv(_0x755727);const _0x411917=_0x5f03f1||'./src/api/',_0x3c10e5=_0x4c33c6&&_0x4c33c6[_0x31547c(0x17d)]('-')?_0x4c33c6[_0x31547c(0x16d)]('-')[_0x31547c(0x165)](0x1)['join']('-'):'',_0x3dc67f=_0x4c33c6?_0x31547c(0x15e)+_0x458797:'使用配置的应用AppCode:\x20'+_0x458797,_0x14484=_0x3c10e5?_0x3c10e5+_0x31547c(0x17c):_0x31547c(0x174),_0x4b3550=_0x3c10e5?_0x3c10e5+_0x31547c(0x178):'client';useEffect(()=>{_0x52c032(!![]),_0x2af923();},[]),useEffect(()=>{(_0x51fa5d||_0xe13024)&&_0x22e97c();},[_0x51fa5d,_0xe13024,_0x22e97c]);async function _0x2af923(){const _0x2e71d1=_0x31547c;if(!_0x458797){_0x22819b(_0x2e71d1(0x171));return;}try{logger[_0x2e71d1(0x179)](process['cwd']());const _0x25258f=await fetch(getApiDomain()+_0x2e71d1(0x154)+_0x458797+_0x2e71d1(0x14e),{'headers':{'Cookie':getCookie()}});if(_0x25258f['ok']){const _0x473a56=await _0x25258f['json']();if(_0x473a56[_0x2e71d1(0x159)]){const _0x2d1c6c=!_0x4c33c6;await generateApiFile(_0x473a56[_0x2e71d1(0x16b)][_0x2e71d1(0x170)],_0x3c10e5,_0x458797,_0x2d1c6c,_0x755727,_0x411917);const _0x3e9c33=_0x411917['endsWith']('/')?_0x411917:_0x411917+'/';_0x32a584({'api':''+_0x3e9c33+_0x14484+'.ts','client':''+_0x3e9c33+_0x4b3550+_0x2e71d1(0x166)}),_0x495b07(!![]);}}else{if(_0x25258f[_0x2e71d1(0x160)]===0x191){const _0x424b9b='登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录';logger[_0x2e71d1(0x150)](_0x2e71d1(0x158),_0x424b9b,{'status':_0x25258f[_0x2e71d1(0x160)],'appCode':_0x458797,'url':_0x25258f[_0x2e71d1(0x172)]}),_0x22819b(_0x424b9b);}else{const _0x2e1e1=_0x2e71d1(0x153)+_0x25258f[_0x2e71d1(0x160)];try{const _0x57c04f=await _0x25258f['text']();_0x57c04f?logger[_0x2e71d1(0x150)](_0x2e71d1(0x158),_0x2e1e1,{'status':_0x25258f['status'],'appCode':_0x458797,'url':_0x25258f[_0x2e71d1(0x172)],'errorBody':_0x57c04f}):logger[_0x2e71d1(0x150)](_0x2e71d1(0x158),_0x2e1e1,{'status':_0x25258f[_0x2e71d1(0x160)],'appCode':_0x458797,'url':_0x25258f[_0x2e71d1(0x172)]});}catch(_0x35b19f){logger[_0x2e71d1(0x150)](_0x2e71d1(0x158),_0x2e1e1+_0x2e71d1(0x161),{'status':_0x25258f[_0x2e71d1(0x160)],'appCode':_0x458797,'url':_0x25258f[_0x2e71d1(0x172)],'readError':_0x35b19f instanceof Error?_0x35b19f[_0x2e71d1(0x167)]:String(_0x35b19f)});}_0x22819b(_0x2e1e1);}}}catch(_0x37fac8){const _0x1ceb65=_0x37fac8 instanceof Error?_0x37fac8[_0x2e71d1(0x167)]:String(_0x37fac8);_0x22819b(_0x2e71d1(0x15b)+_0x1ceb65);}finally{_0x52c032(![]);}}return a3_0x2c8b61(Box,{'flexDirection':_0x31547c(0x156),'children':[a3_0x2c8b61(Box,{'children':[a3_0x239839(Text,{'color':_0x31547c(0x14f),'children':'*\x20'}),a3_0x239839(Text,{'color':_0x4c33c6?_0x31547c(0x16c):_0x31547c(0x173),'children':_0x3dc67f})]}),a3_0x2c8b61(Box,{'children':[a3_0x239839(Text,{'color':_0x31547c(0x14f),'children':'*\x20将生成文件:\x20'}),a3_0x2c8b61(Text,{'color':'cyan','children':[_0x14484,_0x31547c(0x166)]}),a3_0x239839(Text,{'color':'dim','children':_0x31547c(0x17a)}),a3_0x2c8b61(Text,{'color':_0x31547c(0x15c),'children':[_0x4b3550,_0x31547c(0x166)]})]}),_0xdcf659&&a3_0x239839(Box,{'children':a3_0x2c8b61(Text,{'children':[_0x31547c(0x176),_0x755727,')']})}),_0x51fa5d&&_0x26bcca&&a3_0x2c8b61(Box,{'flexDirection':'column','children':[a3_0x239839(Box,{'children':a3_0x239839(Text,{'color':_0x31547c(0x15a),'children':_0x31547c(0x14c)})}),a3_0x239839(Box,{'marginTop':0x1,'children':a3_0x239839(Text,{'color':'gray','children':'*\x20已生成文件:'})}),a3_0x2c8b61(Box,{'marginLeft':0x2,'children':[a3_0x2c8b61(Text,{'color':_0x31547c(0x15c),'children':['•\x20',_0x26bcca['api']]}),a3_0x239839(Text,{'color':_0x31547c(0x173),'children':_0x31547c(0x17b)})]}),a3_0x2c8b61(Box,{'marginLeft':0x2,'children':[a3_0x2c8b61(Text,{'color':_0x31547c(0x15c),'children':['•\x20',_0x26bcca[_0x31547c(0x14a)]]}),a3_0x239839(Text,{'color':_0x31547c(0x173),'children':_0x31547c(0x16f)})]}),a3_0x239839(Box,{'marginTop':0x1,'children':a3_0x239839(Text,{'color':_0x31547c(0x14f),'children':'*\x20导入方式:'})}),a3_0x239839(Box,{'marginLeft':0x2,'children':a3_0x2c8b61(Text,{'color':_0x31547c(0x175),'children':[_0x31547c(0x17e),'{\x20lovrabetClient\x20}','\x20from\x20\x27@/',_0x26bcca[_0x31547c(0x14a)][_0x31547c(0x163)](/^\.\//,'')[_0x31547c(0x163)](/^src\//,'')['replace'](_0x31547c(0x166),''),'\x27']})})]}),_0xe13024&&a3_0x2c8b61(Box,{'flexDirection':_0x31547c(0x156),'children':[a3_0x239839(Box,{'children':a3_0x2c8b61(Text,{'color':_0x31547c(0x148),'children':['❌\x20',_0xe13024]})}),_0xe13024['includes']('登录')&&a3_0x2c8b61(Box,{'marginTop':0x1,'children':[a3_0x239839(Text,{'color':_0x31547c(0x175),'children':_0x31547c(0x16a)}),a3_0x239839(Text,{'color':_0x31547c(0x15c),'children':_0x31547c(0x151)}),a3_0x239839(Text,{'color':_0x31547c(0x175),'children':_0x31547c(0x149)})]})]})]});};
1
+ (function(_0x431aa9,_0x4be06d){const _0x30513d=a5_0x5c79,_0x3e6094=_0x431aa9();while(!![]){try{const _0x5392a9=parseInt(_0x30513d(0x10c))/0x1+parseInt(_0x30513d(0x117))/0x2*(parseInt(_0x30513d(0x10f))/0x3)+parseInt(_0x30513d(0x100))/0x4+-parseInt(_0x30513d(0x128))/0x5*(-parseInt(_0x30513d(0x10e))/0x6)+parseInt(_0x30513d(0xf5))/0x7+parseInt(_0x30513d(0xfd))/0x8+parseInt(_0x30513d(0x108))/0x9*(-parseInt(_0x30513d(0x111))/0xa);if(_0x5392a9===_0x4be06d)break;else _0x3e6094['push'](_0x3e6094['shift']());}catch(_0x116f28){_0x3e6094['push'](_0x3e6094['shift']());}}}(a5_0x2e2c,0x7364b));function a5_0x2e2c(){const _0x5e2926=['datasetCount','gray','590351MJYdzP','√\x20成功拉取\x20','6pPBerc','180027YOQjNX','\x20个,过滤重复','26110oLKtzz','未提供应用AppCode,且配置中也没有默认值','replace','includes','\x20from\x20\x27@/','string','2ArQKgD','modelCount','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','-api','\x20个模型)','online','\x20-\x20客户端实例文件','column','-client','env','error','-\x20模型配置文件\x20(','api','\x20个模型','split','cwd','setLogPath','4471385vpftuQ','duplicateCount','💡\x20请使用\x20','.ts','./src/api/','client','4472279ORLfZm','*\x20已生成文件:','*\x20导入方式:','\x20个数据集,生成','originalCount','join','api-pull','使用指定的应用AppCode:\x20','2012376wrcESs','slice','\x20重新登录后再试','1852756INNGsU','yellow','dim','拉取\x20API\x20配置失败:\x20','cyan','message','green','lovrabet\x20auth','8361ceIAGa','white'];a5_0x2e2c=function(){return _0x5e2926;};return a5_0x2e2c();}import{jsx as a5_0x52a211,jsxs as a5_0x2c23f4}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{fetchDatasets}from'./fetch-datasets.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';function a5_0x5c79(_0x1870d5,_0x1d5840){const _0x2e2c37=a5_0x2e2c();return a5_0x5c79=function(_0x5c79bb,_0x56470b){_0x5c79bb=_0x5c79bb-0xf4;let _0xf21cda=_0x2e2c37[_0x5c79bb];return _0xf21cda;},a5_0x5c79(_0x1870d5,_0x1d5840);}export const ApiPullUI=({appCode:_0x2955ec,env:_0x20f4a3,output:_0x5d3aac})=>{const _0x4010c1=a5_0x5c79,{exit:_0x43ba0d}=useApp(),[_0x41acac,_0x11e837]=useState(![]),[_0x4ad07b,_0x4a0195]=useState(![]),[_0x42e431,_0x56cf7d]=useState(null),[_0x5ee914,_0x26725a]=useState(null),_0x4323dc=readConfig(),_0x53c0b9=getConfigAppCode(),_0x187de9=_0x2955ec||_0x53c0b9,_0x2007ae=typeof _0x4323dc?.[_0x4010c1(0x120)]===_0x4010c1(0x116)?_0x4323dc[_0x4010c1(0x120)]:undefined,_0x4004de=_0x20f4a3||_0x2007ae||_0x4010c1(0x11c);initEnv(_0x4004de);const _0x1470a9=_0x5d3aac||_0x4010c1(0x12c),_0x30ddda=_0x2955ec&&_0x2955ec['includes']('-')?_0x2955ec[_0x4010c1(0x125)]('-')[_0x4010c1(0xfe)](0x1)[_0x4010c1(0xfa)]('-'):'',_0x2122ec=_0x2955ec?_0x4010c1(0xfc)+_0x187de9:'使用配置的应用AppCode:\x20'+_0x187de9,_0x33223f=_0x30ddda?_0x30ddda+_0x4010c1(0x11a):_0x4010c1(0x123),_0x5d8c91=_0x30ddda?_0x30ddda+_0x4010c1(0x11f):'client';useEffect(()=>{_0x11e837(!![]),_0x3e1ac0();},[]),useEffect(()=>{(_0x4ad07b||_0x42e431)&&_0x43ba0d();},[_0x4ad07b,_0x42e431,_0x43ba0d]);async function _0x3e1ac0(){const _0xfe5bd0=_0x4010c1;if(!_0x187de9){_0x56cf7d(_0xfe5bd0(0x112));return;}try{logger[_0xfe5bd0(0x127)](process[_0xfe5bd0(0x126)]());const {rawData:_0x47a4d1,originalCount:_0x115dfb,filteredCount:_0x1e7106,duplicateCount:_0x6d8e49}=await fetchDatasets(_0x187de9),_0x118eb3=_0x1e7106,_0x2b84df=!_0x2955ec,_0x10191f=await generateApiFile(_0x47a4d1,_0x30ddda,_0x187de9,_0x2b84df,_0x4004de,_0x1470a9),_0xf0dd56=_0x1470a9['endsWith']('/')?_0x1470a9:_0x1470a9+'/';_0x26725a({'api':''+_0xf0dd56+_0x33223f+_0xfe5bd0(0x12b),'client':''+_0xf0dd56+_0x5d8c91+'.ts','modelCount':_0x10191f[_0xfe5bd0(0x118)],'datasetCount':_0x118eb3,'originalCount':_0x115dfb,'duplicateCount':_0x6d8e49}),_0x4a0195(!![]);}catch(_0x5342bf){const _0x58b1a9=_0x5342bf instanceof Error?_0x5342bf[_0xfe5bd0(0x105)]:String(_0x5342bf);logger[_0xfe5bd0(0x121)](_0xfe5bd0(0xfb),_0xfe5bd0(0x103)+_0x58b1a9,{'appCode':_0x187de9,'error':_0x58b1a9}),_0x56cf7d(_0xfe5bd0(0x103)+_0x58b1a9);}finally{_0x11e837(![]);}}return a5_0x2c23f4(Box,{'flexDirection':_0x4010c1(0x11e),'children':[(_0x41acac||_0x4ad07b)&&a5_0x2c23f4(Box,{'children':[a5_0x52a211(Text,{'color':_0x4010c1(0x10b),'children':'*\x20'}),a5_0x52a211(Text,{'color':_0x2955ec?_0x4010c1(0x109):_0x4010c1(0x102),'children':_0x2122ec})]}),_0x41acac&&a5_0x52a211(Box,{'children':a5_0x2c23f4(Text,{'children':[_0x4010c1(0x119),_0x4004de,')']})}),_0x4ad07b&&_0x5ee914&&a5_0x2c23f4(Box,{'flexDirection':_0x4010c1(0x11e),'children':[a5_0x52a211(Box,{'children':a5_0x2c23f4(Text,{'color':_0x4010c1(0x106),'children':[_0x4010c1(0x10d),_0x5ee914[_0x4010c1(0x10a)],_0x4010c1(0xf8),'\x20',_0x5ee914[_0x4010c1(0x118)],_0x4010c1(0x124)]})}),_0x5ee914['duplicateCount']>0x0&&a5_0x52a211(Box,{'marginTop':0x1,'children':a5_0x2c23f4(Text,{'color':'yellow','children':['!\x20原始数据集\x20',_0x5ee914[_0x4010c1(0xf9)],_0x4010c1(0x110),'\x20',_0x5ee914[_0x4010c1(0x129)],'\x20个']})}),a5_0x52a211(Box,{'marginTop':0x1,'children':a5_0x52a211(Text,{'color':_0x4010c1(0x10b),'children':_0x4010c1(0xf6)})}),a5_0x2c23f4(Box,{'marginLeft':0x2,'children':[a5_0x2c23f4(Text,{'color':_0x4010c1(0x104),'children':['•\x20',_0x5ee914[_0x4010c1(0x123)]]}),a5_0x2c23f4(Text,{'color':'dim','children':['\x20',_0x4010c1(0x122),_0x5ee914['modelCount'],_0x4010c1(0x11b)]})]}),a5_0x2c23f4(Box,{'marginLeft':0x2,'children':[a5_0x2c23f4(Text,{'color':_0x4010c1(0x104),'children':['•\x20',_0x5ee914['client']]}),a5_0x52a211(Text,{'color':_0x4010c1(0x102),'children':_0x4010c1(0x11d)})]}),a5_0x52a211(Box,{'marginTop':0x1,'children':a5_0x52a211(Text,{'color':'gray','children':_0x4010c1(0xf7)})}),a5_0x52a211(Box,{'marginLeft':0x2,'children':a5_0x2c23f4(Text,{'color':'yellow','children':['import\x20','{\x20lovrabetClient\x20}',_0x4010c1(0x115),_0x5ee914[_0x4010c1(0xf4)][_0x4010c1(0x113)](/^\.\//,'')[_0x4010c1(0x113)](_0x4010c1(0x12b),''),'\x27']})})]}),_0x42e431&&a5_0x2c23f4(Box,{'flexDirection':_0x4010c1(0x11e),'children':[a5_0x52a211(Box,{'children':a5_0x2c23f4(Text,{'color':'red','children':['❌\x20',_0x42e431]})}),_0x42e431[_0x4010c1(0x114)]('登录')&&a5_0x2c23f4(Box,{'marginTop':0x1,'children':[a5_0x52a211(Text,{'color':_0x4010c1(0x101),'children':_0x4010c1(0x12a)}),a5_0x52a211(Text,{'color':'cyan','children':_0x4010c1(0x107)}),a5_0x52a211(Text,{'color':_0x4010c1(0x101),'children':_0x4010c1(0xff)})]})]})]});};
@@ -0,0 +1 @@
1
+ (function(_0x141cc4,_0x2452b7){const _0x578a0d=a6_0x3087,_0x32f131=_0x141cc4();while(!![]){try{const _0x184616=-parseInt(_0x578a0d(0xcc))/0x1*(parseInt(_0x578a0d(0xda))/0x2)+parseInt(_0x578a0d(0xe1))/0x3+-parseInt(_0x578a0d(0xd6))/0x4*(-parseInt(_0x578a0d(0xd0))/0x5)+parseInt(_0x578a0d(0xcf))/0x6*(parseInt(_0x578a0d(0xd9))/0x7)+parseInt(_0x578a0d(0xca))/0x8+parseInt(_0x578a0d(0xde))/0x9*(-parseInt(_0x578a0d(0xd8))/0xa)+parseInt(_0x578a0d(0xe0))/0xb;if(_0x184616===_0x2452b7)break;else _0x32f131['push'](_0x32f131['shift']());}catch(_0x1008b2){_0x32f131['push'](_0x32f131['shift']());}}}(a6_0x16ce,0xf0b87));import{getCookie}from'../auth/get-cookie.js';function a6_0x3087(_0x562d59,_0x37950b){const _0x16ceb4=a6_0x16ce();return a6_0x3087=function(_0x30873f,_0x48a355){_0x30873f=_0x30873f-0xc8;let _0xa84998=_0x16ceb4[_0x30873f];return _0xa84998;},a6_0x3087(_0x562d59,_0x37950b);}import{getApiDomain}from'../constant/domain.js';import{formatDataset}from'./format-dataset.js';export function filterDuplicateDatasets(_0x5f2a2c){const _0xb4bbaa=a6_0x3087,_0x7e64ff=_0x5f2a2c[_0xb4bbaa(0xdb)](_0xe21f09=>_0xe21f09[_0xb4bbaa(0xdd)]),_0x2e568d=_0x5f2a2c[_0xb4bbaa(0xdb)](_0x25eb04=>!_0x25eb04[_0xb4bbaa(0xdd)]),_0x4495d2=new Map();return _0x7e64ff[_0xb4bbaa(0xcd)](_0x307508=>{const _0x2886e7=_0xb4bbaa,_0x307eec=_0x307508[_0x2886e7(0xdd)][_0x2886e7(0xdf)],_0x1ec567=_0x4495d2['get'](_0x307eec);(!_0x1ec567||_0x307508['id']>_0x1ec567['id'])&&_0x4495d2['set'](_0x307eec,_0x307508);}),[...Array[_0xb4bbaa(0xd2)](_0x4495d2[_0xb4bbaa(0xc8)]()),..._0x2e568d];}export async function fetchDatasets(_0x2a926c){const _0x590324=a6_0x3087,_0x259601=await fetch(getApiDomain()+'/smartapi/dataset/getList?appCode='+_0x2a926c+_0x590324(0xd3),{'headers':{'Cookie':getCookie()}});if(!_0x259601['ok']){if(_0x259601[_0x590324(0xce)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');let _0x428725='';try{_0x428725=await _0x259601[_0x590324(0xd1)]();}catch(_0x5b1bf2){}throw new Error(_0x590324(0xd7)+_0x259601[_0x590324(0xce)]+(_0x428725?'\x0a'+_0x428725:''));}const _0x45652d=await _0x259601[_0x590324(0xd5)]();if(!_0x45652d[_0x590324(0xcb)])throw new Error('获取数据集失败:\x20'+(_0x45652d['message']||_0x590324(0xdc)));const _0x573ca2=_0x45652d[_0x590324(0xc9)][_0x590324(0xd4)],_0x14d124=_0x573ca2['length'],_0x188c58=filterDuplicateDatasets(_0x573ca2),_0x3923c1=_0x188c58['length'],_0xa541b1=_0x14d124-_0x3923c1,_0x5a214c=formatDataset(_0x188c58);return{'datasets':_0x5a214c,'rawData':_0x188c58,'originalCount':_0x14d124,'filteredCount':_0x3923c1,'duplicateCount':_0xa541b1};}function a6_0x16ce(){const _0x8a5e00=['dbtableConfig','61461DzYwxg','tableName','2424906tAeBno','119091WMmksQ','values','data','6738240mxlEun','success','1226HTlCyU','forEach','status','961458UqIvap','38635PiytMM','text','from','&pageSize=999&currentPage=1','tableData','json','956BkwZBi','获取数据集失败,HTTP状态码:\x20','2740XjOjwD','49vBobSd','1980KegYqj','filter','未知错误'];a6_0x16ce=function(){return _0x8a5e00;};return a6_0x16ce();}
@@ -1 +1 @@
1
- (function(_0x4f8d33,_0x3e20c4){const _0x15b885=a4_0x3651,_0x2d3c76=_0x4f8d33();while(!![]){try{const _0x343edb=-parseInt(_0x15b885(0x1b8))/0x1+-parseInt(_0x15b885(0x1a8))/0x2*(-parseInt(_0x15b885(0x1b9))/0x3)+parseInt(_0x15b885(0x1b1))/0x4*(-parseInt(_0x15b885(0x1b5))/0x5)+parseInt(_0x15b885(0x1ae))/0x6+parseInt(_0x15b885(0x1c2))/0x7*(-parseInt(_0x15b885(0x1ac))/0x8)+parseInt(_0x15b885(0x1a9))/0x9+parseInt(_0x15b885(0x1b6))/0xa;if(_0x343edb===_0x3e20c4)break;else _0x2d3c76['push'](_0x2d3c76['shift']());}catch(_0xb69836){_0x2d3c76['push'](_0x2d3c76['shift']());}}}(a4_0x54cd,0xa8985));function a4_0x3651(_0x2a6a2b,_0x47cd1d){const _0x54cdf9=a4_0x54cd();return a4_0x3651=function(_0x36511b,_0x33fcae){_0x36511b=_0x36511b-0x1a6;let _0x5231f6=_0x54cdf9[_0x36511b];return _0x5231f6;},a4_0x3651(_0x2a6a2b,_0x47cd1d);}export function formatDataset(_0xdc08e7){const _0x198e0c=a4_0x3651,_0x383404=_0xdc08e7[_0x198e0c(0x1ad)](_0x2d12a5=>_0x2d12a5[_0x198e0c(0x1bc)]),_0x155f69=_0xdc08e7[_0x198e0c(0x1ad)](_0x440c7c=>!_0x440c7c['dbtableConfig']),_0x92fbd1=new Map();_0x383404[_0x198e0c(0x1b7)](_0x44879e=>{const _0x378b92=_0x198e0c,_0x1c019c=_0x44879e[_0x378b92(0x1bc)][_0x378b92(0x1c1)],_0x36fb8c=_0x92fbd1[_0x378b92(0x1b2)](_0x1c019c);(!_0x36fb8c||_0x44879e['id']>_0x36fb8c['id'])&&_0x92fbd1[_0x378b92(0x1bd)](_0x1c019c,_0x44879e);});const _0x3b225d=Array['from'](_0x92fbd1[_0x198e0c(0x1a6)]())[_0x198e0c(0x1b0)](_0x236564=>{const _0x5e35de=_0x198e0c,_0x2091d3=snakeToCamel(_0x236564[_0x5e35de(0x1bc)][_0x5e35de(0x1c1)]);return{'id':_0x236564['id'],'name':_0x236564[_0x5e35de(0x1aa)],'code':_0x236564[_0x5e35de(0x1af)],'tableName':_0x236564['dbtableConfig'][_0x5e35de(0x1c1)],'apiFucName':_0x2091d3?_0x2091d3+_0x5e35de(0x1bf):'dataset'+_0x236564[_0x5e35de(0x1af)]+_0x5e35de(0x1bf),'pkField':_0x236564[_0x5e35de(0x1bc)][_0x5e35de(0x1b4)],'allFields':_0x236564['dbtableConfig'][_0x5e35de(0x1b3)][_0x5e35de(0x1a7)](',')};}),_0x192f62=_0x155f69['map'](_0x242778=>{const _0x67e39c=_0x198e0c,_0x5bbcd5=_0x67e39c(0x1ba)+_0x242778[_0x67e39c(0x1af)],_0x2efd2e=snakeToCamel(_0x5bbcd5);return{'id':_0x242778['id'],'name':_0x242778[_0x67e39c(0x1aa)],'code':_0x242778[_0x67e39c(0x1af)],'tableName':_0x5bbcd5,'apiFucName':_0x2efd2e?_0x2efd2e+_0x67e39c(0x1bf):_0x67e39c(0x1bb)+_0x242778['code']+_0x67e39c(0x1bf),'pkField':undefined,'allFields':[]};});return[..._0x3b225d,..._0x192f62];}function a4_0x54cd(){const _0x232221=['toUpperCase','tableName','648683MFDREC','values','split','4kpokRv','2225484NRPkry','name','trim','24ZXNKKx','filter','549426UoKhnn','code','map','2620172dpnCWN','get','allFields','pkField','5DUdiCF','18812460TRZVBm','forEach','851224VYMhwb','382119sTQOvF','dataset_','dataset','dbtableConfig','set','replace','Api'];a4_0x54cd=function(){return _0x232221;};return a4_0x54cd();}function snakeToCamel(_0x3ce49f){const _0xc7fa22=a4_0x3651;if(!_0x3ce49f)return _0x3ce49f;const _0x574fd5=_0x3ce49f[_0xc7fa22(0x1ab)]();return _0x574fd5[_0xc7fa22(0x1be)](/_([a-zA-Z0-9])/g,(_0x4fa6cd,_0x1b96cf)=>_0x1b96cf[_0xc7fa22(0x1c0)]());}
1
+ function a7_0x5d46(){const _0x5de63c=['toUpperCase','set','pkField','get','131490OKatmw','30GpmZLM','5vEJewQ','replace','11vZgvjA','44930IxnsDt','dataset','map','values','6042416IRQsTv','code','slice','Api','tableName','3177392wEuhIk','36100188FHaFaw','name','allFields','filter','3RFtqmK','18VMeyFm','trim','1384943VrhcZg','3873666yNxChZ','dbtableConfig','forEach'];a7_0x5d46=function(){return _0x5de63c;};return a7_0x5d46();}(function(_0x261cfb,_0x54153d){const _0x3585c7=a7_0xcb6e,_0x44105a=_0x261cfb();while(!![]){try{const _0x428ffc=parseInt(_0x3585c7(0xaf))/0x1*(-parseInt(_0x3585c7(0xa1))/0x2)+-parseInt(_0x3585c7(0xb3))/0x3+parseInt(_0x3585c7(0xaa))/0x4*(parseInt(_0x3585c7(0x9e))/0x5)+parseInt(_0x3585c7(0x9d))/0x6*(-parseInt(_0x3585c7(0xb2))/0x7)+-parseInt(_0x3585c7(0xa5))/0x8+-parseInt(_0x3585c7(0xb0))/0x9*(parseInt(_0x3585c7(0x9c))/0xa)+-parseInt(_0x3585c7(0xa0))/0xb*(-parseInt(_0x3585c7(0xab))/0xc);if(_0x428ffc===_0x54153d)break;else _0x44105a['push'](_0x44105a['shift']());}catch(_0x4b7487){_0x44105a['push'](_0x44105a['shift']());}}}(a7_0x5d46,0xa45d3));export function formatDataset(_0x3ee8a0){const _0x524d71=a7_0xcb6e,_0xd8b979=_0x3ee8a0[_0x524d71(0xae)](_0x52e76b=>_0x52e76b[_0x524d71(0xb4)]),_0x1ef433=_0x3ee8a0[_0x524d71(0xae)](_0x2e6c1a=>!_0x2e6c1a['dbtableConfig']),_0x10d14e=new Map();_0xd8b979[_0x524d71(0xb5)](_0x25f653=>{const _0x421f4f=_0x524d71,_0x3e6a13=_0x25f653[_0x421f4f(0xb4)][_0x421f4f(0xa9)],_0x117cb4=_0x10d14e[_0x421f4f(0x9b)](_0x3e6a13);(!_0x117cb4||_0x25f653['id']>_0x117cb4['id'])&&_0x10d14e[_0x421f4f(0xb7)](_0x3e6a13,_0x25f653);});const _0x3e2550=Array['from'](_0x10d14e[_0x524d71(0xa4)]())[_0x524d71(0xa3)](_0x5e30d6=>{const _0x4b0b57=_0x524d71,_0x1a5cca=snakeToCamel(_0x5e30d6['dbtableConfig'][_0x4b0b57(0xa9)]);return{'id':_0x5e30d6['id'],'name':_0x5e30d6[_0x4b0b57(0xac)],'code':_0x5e30d6[_0x4b0b57(0xa6)],'tableName':_0x5e30d6[_0x4b0b57(0xb4)]['tableName'],'apiFucName':_0x1a5cca?_0x1a5cca+_0x4b0b57(0xa8):_0x4b0b57(0xa2)+_0x5e30d6[_0x4b0b57(0xa6)]+_0x4b0b57(0xa8),'pkField':_0x5e30d6[_0x4b0b57(0xb4)][_0x4b0b57(0x9a)],'allFields':_0x5e30d6[_0x4b0b57(0xb4)][_0x4b0b57(0xad)]['split'](',')};}),_0x527c9a=_0x1ef433[_0x524d71(0xa3)](_0x36815c=>{const _0x570f24=_0x524d71,_0xe047f2=_0x36815c[_0x570f24(0xa6)][_0x570f24(0xa7)](-0x6),_0x34ed6d='dataset_'+_0xe047f2,_0x4a9179=snakeToCamel(_0x34ed6d);return{'id':_0x36815c['id'],'name':_0x36815c[_0x570f24(0xac)],'code':_0x36815c[_0x570f24(0xa6)],'tableName':_0x34ed6d,'apiFucName':_0x4a9179?_0x4a9179+_0x570f24(0xa8):_0x570f24(0xa2)+_0xe047f2+_0x570f24(0xa8),'pkField':undefined,'allFields':[]};});return[..._0x3e2550,..._0x527c9a];}function a7_0xcb6e(_0x5659ee,_0x3ab747){const _0x5d4601=a7_0x5d46();return a7_0xcb6e=function(_0xcb6e96,_0x15d15b){_0xcb6e96=_0xcb6e96-0x9a;let _0x220946=_0x5d4601[_0xcb6e96];return _0x220946;},a7_0xcb6e(_0x5659ee,_0x3ab747);}function snakeToCamel(_0x400670){const _0x2319ff=a7_0xcb6e;if(!_0x400670)return _0x400670;const _0x3d0426=_0x400670[_0x2319ff(0xb1)]();return _0x3d0426[_0x2319ff(0x9f)](/_([a-zA-Z0-9])/g,(_0x43bfa3,_0x3139a)=>_0x3139a[_0x2319ff(0xb6)]());}
@@ -1 +1 @@
1
- const a5_0x1e34e2=a5_0x41f5;(function(_0x1438d0,_0x3aef82){const _0x2d8239=a5_0x41f5,_0x25a755=_0x1438d0();while(!![]){try{const _0x3d3712=parseInt(_0x2d8239(0x15b))/0x1+parseInt(_0x2d8239(0x15c))/0x2+-parseInt(_0x2d8239(0x14b))/0x3+-parseInt(_0x2d8239(0x141))/0x4*(-parseInt(_0x2d8239(0x140))/0x5)+parseInt(_0x2d8239(0x164))/0x6*(-parseInt(_0x2d8239(0x168))/0x7)+-parseInt(_0x2d8239(0x165))/0x8+-parseInt(_0x2d8239(0x166))/0x9;if(_0x3d3712===_0x3aef82)break;else _0x25a755['push'](_0x25a755['shift']());}catch(_0x1a466b){_0x25a755['push'](_0x25a755['shift']());}}}(a5_0x19d6,0xf3fdd));import a5_0x163c1e from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a5_0x4e0317 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{formatDataset}from'./format-dataset.js';function a5_0x41f5(_0x2afff8,_0x40e673){const _0x19d69d=a5_0x19d6();return a5_0x41f5=function(_0x41f534,_0x30d88d){_0x41f534=_0x41f534-0x140;let _0x5c4d82=_0x19d69d[_0x41f534];return _0x5c4d82;},a5_0x41f5(_0x2afff8,_0x40e673);}import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';function a5_0x19d6(){const _0xe6eb2f=['.ts','{\x20apiConfigName:\x20','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','env','templates/generate-api','client.ts.tpl','-client','667270efFUJA','1778610ZQuMxP','string','client','replace','code','slice','\x20-\x20模型配置文件\x20(','\x20个模型)','208668IpemYX','6782848XdPvXW','9101511bdhNpG','\x20\x20\x20•\x20','7aSPjDb','tableName','6809555fJUzGV','4zyIRqJ','success','init-api','\x20-\x20客户端实例文件','CONFIG_NAMES.DEFAULT','log','API\x20文件生成成功!','./src/api/','online','typescript','75552iBRbMu','join',',\x20env:\x20\x22','../..','forEach','keys','utf8','replaceApiContent','charAt'];a5_0x19d6=function(){return _0xe6eb2f;};return a5_0x19d6();}export async function generateApiFile(_0x258630,_0x40014e='',_0x485c25,_0x5be7f8=![],_0x422e2e,_0x62c4d4=a5_0x1e34e2(0x148)){const _0x206e4a=a5_0x1e34e2,_0x4a91d4=readConfig(),_0x55ca08=_0x485c25||_0x4a91d4?.['app'];if(typeof _0x55ca08!==_0x206e4a(0x15d)||!_0x55ca08)throw new Error(_0x206e4a(0x156));const _0x47e587=_0x5be7f8?_0x206e4a(0x145):'\x22'+_0x55ca08+'\x22',_0x36f80a=typeof _0x4a91d4[_0x206e4a(0x157)]==='string'?_0x4a91d4[_0x206e4a(0x157)]:undefined,_0x367274=_0x422e2e||_0x36f80a||_0x206e4a(0x149),_0x1517f0=_0x367274!=='online';let _0x269b18;if(_0x5be7f8)_0x1517f0?_0x269b18=_0x206e4a(0x155)+_0x47e587+',\x20env:\x20\x22'+_0x367274+'\x22\x20}':_0x269b18='';else{const _0x376228=_0x1517f0?_0x206e4a(0x14d)+_0x367274+'\x22':'';_0x269b18='{\x20apiConfigName:\x20\x22'+_0x55ca08+'\x22'+_0x376228+'\x20}';}const _0x460eb1=_0x40014e?_0x40014e+'-api':'api',_0x4ecb98=_0x40014e?_0x40014e+_0x206e4a(0x15a):_0x206e4a(0x15e),_0xa06d69=formatDataset(_0x258630),_0x4822a9={};_0xa06d69[_0x206e4a(0x14f)](_0x35ece7=>{const _0x4552d5=_0x206e4a,_0x5b4c3c=_0x35ece7['apiFucName'][_0x4552d5(0x15f)](/Api$/,''),_0x5248cd=_0x5b4c3c[_0x4552d5(0x153)](0x0)['toUpperCase']()+_0x5b4c3c[_0x4552d5(0x161)](0x1);_0x4822a9[_0x5248cd]={'tableName':_0x35ece7[_0x4552d5(0x169)],'datasetCode':_0x35ece7[_0x4552d5(0x160)]};});const _0x48188f=fileURLToPath(import.meta['url']),_0x3ffd0a=a5_0x4e0317['resolve'](a5_0x4e0317['dirname'](_0x48188f),_0x206e4a(0x14e)),_0x440b57=a5_0x4e0317[_0x206e4a(0x14c)](_0x3ffd0a,_0x206e4a(0x158)),_0x1141da=a5_0x4e0317[_0x206e4a(0x14c)](_0x440b57,'api.ts.tpl'),_0x225898=a5_0x4e0317[_0x206e4a(0x14c)](_0x440b57,_0x206e4a(0x159)),_0xc3eb9b=_0x62c4d4['endsWith']('/')?_0x62c4d4[_0x206e4a(0x161)](0x0,-0x1):_0x62c4d4;mkdirSync(_0xc3eb9b,{'recursive':!![]});const _0x1830e1=readFileSync(_0x1141da,_0x206e4a(0x151)),_0x1e1e3a=TemplateReplacer[_0x206e4a(0x152)](_0x1830e1,_0x55ca08,_0x4822a9,Object[_0x206e4a(0x150)](_0x4822a9)[0x0],_0x460eb1,_0x47e587),_0x1f7801=await a5_0x163c1e['format'](_0x1e1e3a,{'parser':_0x206e4a(0x14a)}),_0x5709a1=_0xc3eb9b+'/'+_0x460eb1+_0x206e4a(0x154);writeFileSync(_0x5709a1,_0x1f7801,{'encoding':_0x206e4a(0x151)});const _0x3222e0=readFileSync(_0x225898,_0x206e4a(0x151)),_0x4fcb14=TemplateReplacer[_0x206e4a(0x152)](_0x3222e0,_0x55ca08,_0x4822a9,Object[_0x206e4a(0x150)](_0x4822a9)[0x0],_0x460eb1,_0x47e587,_0x269b18),_0x1765d4=await a5_0x163c1e['format'](_0x4fcb14,{'parser':'typescript'}),_0x1389bf=_0xc3eb9b+'/'+_0x4ecb98+'.ts';writeFileSync(_0x1389bf,_0x1765d4,{'encoding':_0x206e4a(0x151)}),logger[_0x206e4a(0x142)](_0x206e4a(0x143),_0x206e4a(0x147)),console[_0x206e4a(0x146)]('*\x20已生成文件:'),console[_0x206e4a(0x146)](_0x206e4a(0x167)+_0x5709a1+_0x206e4a(0x162)+Object[_0x206e4a(0x150)](_0x4822a9)['length']+_0x206e4a(0x163)),console[_0x206e4a(0x146)](_0x206e4a(0x167)+_0x1389bf+_0x206e4a(0x144)),console[_0x206e4a(0x146)]('*\x20API配置\x20apiConfigName\x20:\x20'+_0x47e587);const _0x581969=_0xc3eb9b[_0x206e4a(0x15f)](/^\.\//,'')[_0x206e4a(0x15f)](/\/$/,'');console['log']('*\x20可以开始使用:\x20import\x20{\x20lovrabetClient\x20}\x20from\x20\x27@/'+_0x581969+'/'+_0x4ecb98+'\x27');}
1
+ (function(_0x3423cc,_0x33d100){const _0x5a37fe=a8_0x1ee0,_0x3c4f3c=_0x3423cc();while(!![]){try{const _0x34c25f=parseInt(_0x5a37fe(0x140))/0x1+-parseInt(_0x5a37fe(0x131))/0x2+-parseInt(_0x5a37fe(0x12d))/0x3*(-parseInt(_0x5a37fe(0x134))/0x4)+-parseInt(_0x5a37fe(0x128))/0x5*(parseInt(_0x5a37fe(0x10e))/0x6)+parseInt(_0x5a37fe(0x112))/0x7*(-parseInt(_0x5a37fe(0x110))/0x8)+parseInt(_0x5a37fe(0x135))/0x9*(-parseInt(_0x5a37fe(0x139))/0xa)+parseInt(_0x5a37fe(0x111))/0xb*(parseInt(_0x5a37fe(0x125))/0xc);if(_0x34c25f===_0x33d100)break;else _0x3c4f3c['push'](_0x3c4f3c['shift']());}catch(_0x53c621){_0x3c4f3c['push'](_0x3c4f3c['shift']());}}}(a8_0x1007,0x4d109));import a8_0x11cc23 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a8_0x2da0a9 from'node:path';function a8_0x1ee0(_0x314092,_0x285730){const _0x10079b=a8_0x1007();return a8_0x1ee0=function(_0x1ee069,_0x5e5055){_0x1ee069=_0x1ee069-0x10e;let _0x52658c=_0x10079b[_0x1ee069];return _0x52658c;},a8_0x1ee0(_0x314092,_0x285730);}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a8_0x1007(){const _0x24f70d=['join','code','1468508yREFDW','36Wxdfas','online','client','forEach','1262220qTlHyn','init-api','format','slice','utf8','\x22\x20}','apiFucName','347812RThAhV','222SFvyxD','tableName','240mqViwA','1967746QVwgjq','112686YGkdCM','app','success','endsWith','replaceApiContent','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','string','.ts','dirname','{\x20apiConfigName:\x20\x22','API\x20文件生成成功!','typescript','api','../..','toUpperCase','{\x20apiConfigName:\x20','url','api.ts.tpl','keys','72pguRMj',',\x20env:\x20\x22','resolve','25475vwfZVN','-api','-client','name','replace','3thNfHH','env','CONFIG_NAMES.DEFAULT','templates/generate-api','592510uYDKLK'];a8_0x1007=function(){return _0x24f70d;};return a8_0x1007();}import{formatDataset}from'./format-dataset.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x2273eb,_0x5cccef='',_0x3eb6f8,_0x2c95c0=![],_0x5083e5,_0xbe2aaa='./src/api/'){const _0x53b601=a8_0x1ee0,_0x55f454=readConfig(),_0x360f2b=_0x3eb6f8||_0x55f454?.[_0x53b601(0x113)];if(typeof _0x360f2b!==_0x53b601(0x118)||!_0x360f2b)throw new Error(_0x53b601(0x117));const _0x721c93=_0x2c95c0?_0x53b601(0x12f):'\x22'+_0x360f2b+'\x22',_0x4c044f=typeof _0x55f454[_0x53b601(0x12e)]===_0x53b601(0x118)?_0x55f454['env']:undefined,_0x41f0a1=_0x5083e5||_0x4c044f||_0x53b601(0x136),_0x16ce92=_0x41f0a1!==_0x53b601(0x136);let _0x467053;if(_0x2c95c0)_0x16ce92?_0x467053=_0x53b601(0x121)+_0x721c93+_0x53b601(0x126)+_0x41f0a1+_0x53b601(0x13e):_0x467053='';else{const _0x5df687=_0x16ce92?_0x53b601(0x126)+_0x41f0a1+'\x22':'';_0x467053=_0x53b601(0x11b)+_0x360f2b+'\x22'+_0x5df687+'\x20}';}const _0x50754c=_0x5cccef?_0x5cccef+_0x53b601(0x129):_0x53b601(0x11e),_0x4a0c2e=_0x5cccef?_0x5cccef+_0x53b601(0x12a):_0x53b601(0x137),_0xd12629=formatDataset(_0x2273eb),_0x1ed0e8={};_0xd12629[_0x53b601(0x138)](_0x39dbaa=>{const _0x1c0a98=_0x53b601,_0x104184=_0x39dbaa[_0x1c0a98(0x13f)][_0x1c0a98(0x12c)](/Api$/,''),_0x1fca8d=_0x104184['charAt'](0x0)[_0x1c0a98(0x120)]()+_0x104184[_0x1c0a98(0x13c)](0x1);_0x1ed0e8[_0x1fca8d]={'tableName':_0x39dbaa[_0x1c0a98(0x10f)],'datasetCode':_0x39dbaa[_0x1c0a98(0x133)],'name':_0x39dbaa[_0x1c0a98(0x12b)]||''};});const _0x4c2820=fileURLToPath(import.meta[_0x53b601(0x122)]),_0x536b13=a8_0x2da0a9[_0x53b601(0x127)](a8_0x2da0a9[_0x53b601(0x11a)](_0x4c2820),_0x53b601(0x11f)),_0x159695=a8_0x2da0a9['join'](_0x536b13,_0x53b601(0x130)),_0x4922f1=a8_0x2da0a9[_0x53b601(0x132)](_0x159695,_0x53b601(0x123)),_0x29bce9=a8_0x2da0a9[_0x53b601(0x132)](_0x159695,'client.ts.tpl'),_0x1f8e1f=_0xbe2aaa[_0x53b601(0x115)]('/')?_0xbe2aaa[_0x53b601(0x13c)](0x0,-0x1):_0xbe2aaa;mkdirSync(_0x1f8e1f,{'recursive':!![]});const _0x378455=readFileSync(_0x4922f1,'utf8'),_0x148ba7=TemplateReplacer[_0x53b601(0x116)](_0x378455,_0x360f2b,_0x1ed0e8,Object[_0x53b601(0x124)](_0x1ed0e8)[0x0],_0x50754c,_0x721c93),_0x3eb3ee=await a8_0x11cc23[_0x53b601(0x13b)](_0x148ba7,{'parser':_0x53b601(0x11d)}),_0x4a2489=_0x1f8e1f+'/'+_0x50754c+_0x53b601(0x119);writeFileSync(_0x4a2489,_0x3eb3ee,{'encoding':'utf8'});const _0x535b0c=readFileSync(_0x29bce9,_0x53b601(0x13d)),_0x3936de=TemplateReplacer['replaceApiContent'](_0x535b0c,_0x360f2b,_0x1ed0e8,Object['keys'](_0x1ed0e8)[0x0],_0x50754c,_0x721c93,_0x467053),_0x122692=await a8_0x11cc23[_0x53b601(0x13b)](_0x3936de,{'parser':_0x53b601(0x11d)}),_0x50c0f7=_0x1f8e1f+'/'+_0x4a0c2e+_0x53b601(0x119);writeFileSync(_0x50c0f7,_0x122692,{'encoding':_0x53b601(0x13d)});const _0x8a45b7=Object[_0x53b601(0x124)](_0x1ed0e8)['length'];return logger[_0x53b601(0x114)](_0x53b601(0x13a),_0x53b601(0x11c),undefined,{'apiFile':_0x4a2489,'clientFile':_0x50c0f7,'modelCount':_0x8a45b7,'configName':_0x721c93}),{'modelCount':_0x8a45b7,'apiFilePath':_0x4a2489,'clientFilePath':_0x50c0f7,'configName':_0x721c93};}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0x5ecaa3,_0x4e238d){const _0x3cd966=a6_0x4d0c,_0x2e6479=_0x5ecaa3();while(!![]){try{const _0x1fca95=-parseInt(_0x3cd966(0x65))/0x1*(-parseInt(_0x3cd966(0x7c))/0x2)+parseInt(_0x3cd966(0x80))/0x3+-parseInt(_0x3cd966(0x69))/0x4+-parseInt(_0x3cd966(0x78))/0x5+parseInt(_0x3cd966(0x81))/0x6*(-parseInt(_0x3cd966(0x72))/0x7)+-parseInt(_0x3cd966(0x77))/0x8+parseInt(_0x3cd966(0x75))/0x9*(parseInt(_0x3cd966(0x73))/0xa);if(_0x1fca95===_0x4e238d)break;else _0x2e6479['push'](_0x2e6479['shift']());}catch(_0x2cb869){_0x2e6479['push'](_0x2e6479['shift']());}}}(a6_0x1978,0x7d86a));import{jsx as a6_0x3819f8}from'react/jsx-runtime';function a6_0x4d0c(_0x423fdc,_0x45df98){const _0x1978e3=a6_0x1978();return a6_0x4d0c=function(_0x4d0c56,_0x4d20da){_0x4d0c56=_0x4d0c56-0x64;let _0x295d26=_0x1978e3[_0x4d0c56];return _0x295d26;},a6_0x4d0c(_0x423fdc,_0x45df98);}function a6_0x1978(){const _0x565157=['\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20指定输出目录(默认:./src/api/)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--help\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\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20--env\x20daily\x20--output\x20./api\x0a','\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配置文件','appcode','2140240sevEUl','\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\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','env','help','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','Unknown\x20api\x20command:\x20','input','7zzaSvq','8675690VenDbU','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','18CkDPCf','❌\x20错误:不再支持位置参数方式','4209344iqPBph','1726490UnZOzE','请使用\x20--appcode\x20参数,例如:','string','pull','514pCaNGj','flags','log','error','553338nCuxjP','3701934QsfZPL','exit','2405JDmHrn'];a6_0x1978=function(){return _0x565157;};return a6_0x1978();}import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';export async function apiCli(_0x1d16d6){const _0xcca91c=a6_0x4d0c,_0x300bcf=_0x1d16d6[_0xcca91c(0x71)][0x1];if(_0x1d16d6['flags'][_0xcca91c(0x6e)]){console[_0xcca91c(0x7e)](_0xcca91c(0x66));return;}if(_0x300bcf===_0xcca91c(0x7b)){_0x1d16d6[_0xcca91c(0x71)][0x2]&&(console[_0xcca91c(0x7f)](_0xcca91c(0x76)),console[_0xcca91c(0x7e)](_0xcca91c(0x79)),console[_0xcca91c(0x7e)](_0xcca91c(0x74)+_0x1d16d6['input'][0x2]),process[_0xcca91c(0x64)](0x1));const _0x50f4be=_0x1d16d6[_0xcca91c(0x7d)][_0xcca91c(0x68)],_0x59099d=typeof _0x1d16d6[_0xcca91c(0x7d)]['env']===_0xcca91c(0x7a)?_0x1d16d6[_0xcca91c(0x7d)][_0xcca91c(0x6d)]:undefined,_0x22994c=_0x1d16d6[_0xcca91c(0x7d)]['output'];render(a6_0x3819f8(ApiPullUI,{'appCode':_0x50f4be,'env':_0x59099d,'output':_0x22994c}));}else console[_0xcca91c(0x7f)](_0xcca91c(0x70)+_0x300bcf),console[_0xcca91c(0x7e)](_0xcca91c(0x6b)),console[_0xcca91c(0x7e)](_0xcca91c(0x67)),console[_0xcca91c(0x7e)](_0xcca91c(0x6f)),console['log'](_0xcca91c(0x6c)),console[_0xcca91c(0x7e)](_0xcca91c(0x6a)),process[_0xcca91c(0x64)](0x1);}
1
+ (function(_0x4206a4,_0x59e9f7){const _0x207ef3=a9_0x7775,_0xca6eca=_0x4206a4();while(!![]){try{const _0xa96f01=parseInt(_0x207ef3(0xdf))/0x1+-parseInt(_0x207ef3(0xe2))/0x2+-parseInt(_0x207ef3(0xec))/0x3+parseInt(_0x207ef3(0xd4))/0x4+parseInt(_0x207ef3(0xd1))/0x5+parseInt(_0x207ef3(0xd3))/0x6*(parseInt(_0x207ef3(0xe4))/0x7)+parseInt(_0x207ef3(0xea))/0x8;if(_0xa96f01===_0x59e9f7)break;else _0xca6eca['push'](_0xca6eca['shift']());}catch(_0x17642e){_0xca6eca['push'](_0xca6eca['shift']());}}}(a9_0xf4e3,0x5d7a0));function a9_0xf4e3(){const _0x365a68=['×\x20未配置\x20AppCode','input','\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指定应用代码\x0a\x20\x20--output\x20<dir>\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指定环境(如:daily、online)\x0a\x20\x20--help\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生成\x20API\x20文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\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指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a','\x1b[0m','flags','\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配置文件','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','200213RYYRbb','error','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','1362376fLdVcU','\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文档','7IBFdIE','\x1b[90m*\x20使用配置的应用AppCode:\x20','❌\x20错误:不再支持位置参数方式','exit','help','output','1711952YHLuVJ','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','2153073dkjfpk','log','请使用\x20--appcode\x20参数,例如:','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','1533355OHiNQs','pull','2011236GSFdWG','2902700ueGgiO','env','doc'];a9_0xf4e3=function(){return _0x365a68;};return a9_0xf4e3();}import{jsx as a9_0x5a569b}from'react/jsx-runtime';import{render}from'ink';function a9_0x7775(_0x455010,_0x381640){const _0xf4e371=a9_0xf4e3();return a9_0x7775=function(_0x77750f,_0x21857b){_0x77750f=_0x77750f-0xcf;let _0x6f511=_0xf4e371[_0x77750f];return _0x6f511;},a9_0x7775(_0x455010,_0x381640);}import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x29aa52){const _0x6075bd=a9_0x7775,_0x1f67ae=_0x29aa52[_0x6075bd(0xd8)][0x1];if(_0x29aa52[_0x6075bd(0xdb)][_0x6075bd(0xe8)]){console[_0x6075bd(0xed)](_0x6075bd(0xd9));return;}if(_0x1f67ae===_0x6075bd(0xd2)){_0x29aa52[_0x6075bd(0xd8)][0x2]&&(console[_0x6075bd(0xe0)](_0x6075bd(0xe6)),console[_0x6075bd(0xed)](_0x6075bd(0xee)),console['log'](_0x6075bd(0xf2)+_0x29aa52['input'][0x2]),process['exit'](0x1));const _0x570034=getConfigAppCode();let _0x1105cc=_0x29aa52[_0x6075bd(0xdb)]['appcode'];const _0x4b5d4a=typeof _0x29aa52['flags'][_0x6075bd(0xd5)]==='string'?_0x29aa52[_0x6075bd(0xdb)][_0x6075bd(0xd5)]:undefined,_0x2708a2=_0x29aa52['flags'][_0x6075bd(0xe9)];!_0x1105cc&&!_0x570034&&(console['error'](_0x6075bd(0xd7)),console[_0x6075bd(0xed)]('!\x20请使用以下方式之一:'),console[_0x6075bd(0xed)](_0x6075bd(0xd0)),console[_0x6075bd(0xed)](_0x6075bd(0xef)),process[_0x6075bd(0xe7)](0x1)),_0x1105cc&&_0x570034&&_0x1105cc===_0x570034&&(console[_0x6075bd(0xed)](_0x6075bd(0xe5)+_0x1105cc+_0x6075bd(0xda)),console[_0x6075bd(0xed)](_0x6075bd(0xeb)),_0x1105cc=undefined),render(a9_0x5a569b(ApiPullUI,{'appCode':_0x1105cc,'env':_0x4b5d4a,'output':_0x2708a2}));}else{if(_0x1f67ae===_0x6075bd(0xd6)){_0x29aa52['input'][0x2]&&(console[_0x6075bd(0xe0)](_0x6075bd(0xe6)),console[_0x6075bd(0xed)]('请使用\x20--appcode\x20参数,例如:'),console[_0x6075bd(0xed)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20'+_0x29aa52[_0x6075bd(0xd8)][0x2]),process[_0x6075bd(0xe7)](0x1));const _0x184b7d=getConfigAppCode();let _0x41c2a7=_0x29aa52['flags']['appcode'];const _0x593e96=typeof _0x29aa52['flags'][_0x6075bd(0xd5)]==='string'?_0x29aa52['flags']['env']:undefined,_0x249eb5=_0x29aa52[_0x6075bd(0xdb)]['output'];!_0x41c2a7&&!_0x184b7d&&(console[_0x6075bd(0xe0)](_0x6075bd(0xd7)),console['log']('!\x20请使用以下方式之一:'),console[_0x6075bd(0xed)](_0x6075bd(0xd0)),console[_0x6075bd(0xed)](_0x6075bd(0xf1)),process[_0x6075bd(0xe7)](0x1)),_0x41c2a7&&_0x184b7d&&_0x41c2a7===_0x184b7d&&(console[_0x6075bd(0xed)](_0x6075bd(0xe5)+_0x41c2a7+_0x6075bd(0xda)),_0x41c2a7=undefined),render(a9_0x5a569b(ApiDocUI,{'appCode':_0x41c2a7,'env':_0x593e96,'output':_0x249eb5}));}else console[_0x6075bd(0xe0)]('Unknown\x20api\x20command:\x20'+_0x1f67ae),console[_0x6075bd(0xed)]('Available\x20commands:'),console[_0x6075bd(0xed)](_0x6075bd(0xdc)),console[_0x6075bd(0xed)](_0x6075bd(0xde)),console[_0x6075bd(0xed)](_0x6075bd(0xe1)),console[_0x6075bd(0xed)](_0x6075bd(0xcf)),console[_0x6075bd(0xed)](''),console[_0x6075bd(0xed)](_0x6075bd(0xe3)),console['log'](_0x6075bd(0xf0)),console[_0x6075bd(0xed)](_0x6075bd(0xdd)),console[_0x6075bd(0xed)]('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process['exit'](0x1);}}
@@ -1 +1 @@
1
- (function(_0x11c922,_0x52c266){const _0x210493=a7_0x4769,_0x1dbc99=_0x11c922();while(!![]){try{const _0x20ad43=-parseInt(_0x210493(0x205))/0x1+parseInt(_0x210493(0x1ed))/0x2+-parseInt(_0x210493(0x21b))/0x3+-parseInt(_0x210493(0x1f9))/0x4+-parseInt(_0x210493(0x1f0))/0x5+parseInt(_0x210493(0x1fd))/0x6*(-parseInt(_0x210493(0x206))/0x7)+parseInt(_0x210493(0x1fc))/0x8;if(_0x20ad43===_0x52c266)break;else _0x1dbc99['push'](_0x1dbc99['shift']());}catch(_0x1126dd){_0x1dbc99['push'](_0x1dbc99['shift']());}}}(a7_0x8fe1,0x21c32));import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';function a7_0x4769(_0x1aa63d,_0x2ddc93){const _0x8fe16a=a7_0x8fe1();return a7_0x4769=function(_0x476965,_0x56dee6){_0x476965=_0x476965-0x1ed;let _0x5ce299=_0x8fe16a[_0x476965];return _0x5ce299;},a7_0x4769(_0x1aa63d,_0x2ddc93);}import{getApiDomain}from'../constant/domain.js';function a7_0x8fe1(){const _0x1cd028=['*\x20开始生成\x20API\x20配置文件:','-client','未知错误','.ts\x20-\x20模型配置文件','&pageSize=999&currentPage=1','status','api','460348GrHOWC','API\x20配置拉取失败:\x20','获取数据集失败,HTTP状态码:\x20','5934072qGzKCt','4146lDkEqP','client','tableData','/smartapi/dataset/getList?appCode=','url','*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','API\x20配置拉取成功:\x20',',且无法读取错误响应内容','118303mCXTWV','2611bZLbYq','create-api-pull','data','-api','×\x20错误详情:','log','string','text','chdir','length','*\x20正在处理\x20','info','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','message','cwd','\x20\x20\x20•\x20','×\x20服务器返回错误:','×\x20API\x20配置拉取异常:','error','获取数据集失败,原因:登录鉴权失败,登录已过期','online','701037wrQikp','env','365434KjVWKr','×\x20无法读取错误响应内容','trim','306870GBtiYa','API\x20配置拉取异常:\x20'];a7_0x8fe1=function(){return _0x1cd028;};return a7_0x8fe1();}import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{httpRequest}from'../utils/http-client.js';export async function pullApiSilent(_0x57f9f8,_0x5ae705,_0x22b0e5,_0x414f6b){const _0x36ff85=a7_0x4769;let _0x584872;try{const _0x58d892=_0x5ae705?.[_0x36ff85(0x1ef)]()||'';if(_0x58d892){const _0x5d37e8=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x5d37e8['test'](_0x58d892))return console['error'](_0x36ff85(0x212)),![];}_0x22b0e5&&(_0x584872=process[_0x36ff85(0x214)](),process[_0x36ff85(0x20e)](_0x22b0e5));const _0xf28bb8=readConfig(),_0x27ad53=typeof _0xf28bb8[_0x36ff85(0x21c)]===_0x36ff85(0x20c)?_0xf28bb8[_0x36ff85(0x21c)]:undefined,_0x5575c2=_0x414f6b||_0x27ad53||_0x36ff85(0x21a);initEnv(_0x5575c2),console[_0x36ff85(0x20b)](_0x36ff85(0x202)+_0x5575c2+')');const _0x560ffb=getApiDomain()+_0x36ff85(0x200)+_0x57f9f8+_0x36ff85(0x1f6),_0x1460b8=await httpRequest(_0x560ffb,{'headers':{'Cookie':getCookie()},'timeout':0xea60,'retries':0x2});if(_0x1460b8['ok']){const _0x580321=_0x1460b8['data'];if(_0x580321['success']){const _0xbed659=_0x58d892?_0x58d892+_0x36ff85(0x209):_0x36ff85(0x1f8),_0x470711=_0x58d892?_0x58d892+_0x36ff85(0x1f3):_0x36ff85(0x1fe);return console[_0x36ff85(0x20b)](_0x36ff85(0x1f2)),console['log'](_0x36ff85(0x215)+_0xbed659+_0x36ff85(0x1f5)),console[_0x36ff85(0x20b)](_0x36ff85(0x215)+_0x470711+'.ts\x20-\x20客户端实例文件'),console[_0x36ff85(0x20b)](_0x36ff85(0x210)+_0x580321['data'][_0x36ff85(0x1ff)][_0x36ff85(0x20f)]+'\x20个数据集...'),await generateApiFile(_0x580321[_0x36ff85(0x208)][_0x36ff85(0x1ff)],_0x58d892,_0x57f9f8,!![],_0x5575c2),console[_0x36ff85(0x20b)]('√\x20API\x20配置文件生成完成'),_0x22b0e5&&logger[_0x36ff85(0x211)](_0x36ff85(0x207),_0x36ff85(0x203)+_0x57f9f8,{'projectPath':_0x22b0e5,'appCode':_0x57f9f8,'datasetCount':_0x580321['data'][_0x36ff85(0x1ff)][_0x36ff85(0x20f)],'filePrefix':_0x58d892}),!![];}else return console['error'](_0x36ff85(0x216),_0x580321[_0x36ff85(0x213)]||_0x36ff85(0x1f4)),_0x22b0e5&&logger[_0x36ff85(0x218)](_0x36ff85(0x207),_0x36ff85(0x1fa)+(_0x580321[_0x36ff85(0x213)]||_0x36ff85(0x1f4)),{'projectPath':_0x22b0e5,'appCode':_0x57f9f8}),![];}else{if(_0x1460b8['status']===0x191){const _0x3d1a48=_0x36ff85(0x219);console[_0x36ff85(0x218)]('×\x20'+_0x3d1a48),_0x22b0e5&&logger['error'](_0x36ff85(0x207),_0x3d1a48,{'status':_0x1460b8[_0x36ff85(0x1f7)],'appCode':_0x57f9f8,'url':_0x1460b8[_0x36ff85(0x201)],'projectPath':_0x22b0e5});}else{const _0x4842cf=_0x36ff85(0x1fb)+_0x1460b8[_0x36ff85(0x1f7)];console[_0x36ff85(0x218)]('×\x20'+_0x4842cf);try{const _0x4ac4ea=await _0x1460b8[_0x36ff85(0x20d)]();_0x4ac4ea&&console[_0x36ff85(0x218)](_0x36ff85(0x20a),_0x4ac4ea),_0x22b0e5&&logger['error']('create-api-pull',_0x4842cf,{'status':_0x1460b8[_0x36ff85(0x1f7)],'appCode':_0x57f9f8,'url':_0x1460b8[_0x36ff85(0x201)],'errorBody':_0x4ac4ea,'projectPath':_0x22b0e5});}catch(_0x341c9d){console[_0x36ff85(0x218)](_0x36ff85(0x1ee)),_0x22b0e5&&logger[_0x36ff85(0x218)](_0x36ff85(0x207),_0x4842cf+_0x36ff85(0x204),{'status':_0x1460b8['status'],'appCode':_0x57f9f8,'url':_0x1460b8[_0x36ff85(0x201)],'readError':_0x341c9d instanceof Error?_0x341c9d[_0x36ff85(0x213)]:String(_0x341c9d),'projectPath':_0x22b0e5});}}return![];}}catch(_0x1af6af){const _0x28c372=_0x1af6af instanceof Error?_0x1af6af[_0x36ff85(0x213)]:String(_0x1af6af);return console[_0x36ff85(0x218)](_0x36ff85(0x217),_0x28c372),_0x22b0e5&&logger[_0x36ff85(0x218)](_0x36ff85(0x207),_0x36ff85(0x1f1)+_0x28c372,{'appCode':_0x57f9f8,'projectPath':_0x22b0e5}),![];}finally{_0x584872&&process[_0x36ff85(0x20e)](_0x584872);}}
1
+ (function(_0x20539e,_0x717927){const _0x4d0eac=a10_0x3041,_0x48db5e=_0x20539e();while(!![]){try{const _0x3f8b95=parseInt(_0x4d0eac(0x1cf))/0x1*(parseInt(_0x4d0eac(0x1cd))/0x2)+-parseInt(_0x4d0eac(0x1ca))/0x3*(-parseInt(_0x4d0eac(0x1d4))/0x4)+parseInt(_0x4d0eac(0x1b6))/0x5+parseInt(_0x4d0eac(0x1b3))/0x6*(parseInt(_0x4d0eac(0x1ab))/0x7)+-parseInt(_0x4d0eac(0x1cc))/0x8*(-parseInt(_0x4d0eac(0x1b0))/0x9)+parseInt(_0x4d0eac(0x1b1))/0xa+parseInt(_0x4d0eac(0x1c2))/0xb*(-parseInt(_0x4d0eac(0x1c1))/0xc);if(_0x3f8b95===_0x717927)break;else _0x48db5e['push'](_0x48db5e['shift']());}catch(_0x408156){_0x48db5e['push'](_0x48db5e['shift']());}}}(a10_0x98d5,0xa7d8f));import{readConfig}from'../utils/config.js';function a10_0x3041(_0x2790e7,_0x3d9094){const _0x98d5b3=a10_0x98d5();return a10_0x3041=function(_0x304166,_0x51e11b){_0x304166=_0x304166-0x1ab;let _0x1908be=_0x98d5b3[_0x304166];return _0x1908be;},a10_0x3041(_0x2790e7,_0x3d9094);}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a10_0x98d5(){const _0xdc5993=[',且无法读取错误响应内容','\x20个数据集...','cwd','6415788Hdhhzn','77oJDqbw','create-api-pull','modelCount','API\x20配置拉取失败:\x20','×\x20无法读取错误响应内容','message','text','length','3883023Gtxxlu','&pageSize=999&currentPage=1','919208FJNSoD','54OZIqDl','*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','7255gpjNHV','√\x20成功拉取\x20','获取数据集失败,原因:登录鉴权失败,登录已过期','-client','tableData','4bDvBym','chdir','status','\x20\x20\x20•\x20','url','742KqIxyJ','-api','env','×\x20错误详情:','data','81dFuUPx','181690dgyNrG','test','51006PCwooB','\x20个模型','API\x20配置拉取异常:\x20','4932180mFMnMp','log','trim','online','success','未知错误','.ts\x20-\x20客户端实例文件','error'];a10_0x98d5=function(){return _0xdc5993;};return a10_0x98d5();}import{logger}from'../utils/logger.js';import{httpRequest}from'../utils/http-client.js';export async function pullApiSilent(_0x49aaa7,_0x54289d,_0x1a0528,_0x2ca8e1){const _0x157c12=a10_0x3041;let _0x1a6718;try{const _0x3fdd4a=_0x54289d?.[_0x157c12(0x1b8)]()||'';if(_0x3fdd4a){const _0x6c35=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x6c35[_0x157c12(0x1b2)](_0x3fdd4a))return console[_0x157c12(0x1bd)]('×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。'),![];}_0x1a0528&&(_0x1a6718=process[_0x157c12(0x1c0)](),process[_0x157c12(0x1d5)](_0x1a0528));const _0x2a8d1e=readConfig(),_0x128251=typeof _0x2a8d1e[_0x157c12(0x1ad)]==='string'?_0x2a8d1e[_0x157c12(0x1ad)]:undefined,_0x151b03=_0x2ca8e1||_0x128251||_0x157c12(0x1b9);initEnv(_0x151b03),console[_0x157c12(0x1b7)](_0x157c12(0x1ce)+_0x151b03+')');const _0x162038=getApiDomain()+'/smartapi/dataset/getList?appCode='+_0x49aaa7+_0x157c12(0x1cb),_0x4228e3=await httpRequest(_0x162038,{'headers':{'Cookie':getCookie()},'timeout':0xea60,'retries':0x2});if(_0x4228e3['ok']){const _0x56dc36=_0x4228e3[_0x157c12(0x1af)];if(_0x56dc36[_0x157c12(0x1ba)]){const _0x14faba=_0x3fdd4a?_0x3fdd4a+_0x157c12(0x1ac):'api',_0x495dc1=_0x3fdd4a?_0x3fdd4a+_0x157c12(0x1d2):'client';console[_0x157c12(0x1b7)]('*\x20开始生成\x20API\x20配置文件:'),console['log'](_0x157c12(0x1d7)+_0x14faba+'.ts\x20-\x20模型配置文件'),console[_0x157c12(0x1b7)](_0x157c12(0x1d7)+_0x495dc1+_0x157c12(0x1bc)),console[_0x157c12(0x1b7)]('*\x20正在处理\x20'+_0x56dc36[_0x157c12(0x1af)][_0x157c12(0x1d3)][_0x157c12(0x1c9)]+_0x157c12(0x1bf));const _0x18f0b3=await generateApiFile(_0x56dc36[_0x157c12(0x1af)][_0x157c12(0x1d3)],_0x3fdd4a,_0x49aaa7,!![],_0x151b03);return console['log'](_0x157c12(0x1d0)+_0x56dc36[_0x157c12(0x1af)][_0x157c12(0x1d3)][_0x157c12(0x1c9)]+'\x20个数据集,生成\x20'+_0x18f0b3[_0x157c12(0x1c4)]+_0x157c12(0x1b4)),_0x1a0528&&logger['info'](_0x157c12(0x1c3),'API\x20配置拉取成功:\x20'+_0x49aaa7,{'projectPath':_0x1a0528,'appCode':_0x49aaa7,'datasetCount':_0x56dc36[_0x157c12(0x1af)]['tableData']['length'],'filePrefix':_0x3fdd4a}),!![];}else return console[_0x157c12(0x1bd)]('×\x20服务器返回错误:',_0x56dc36[_0x157c12(0x1c7)]||'未知错误'),_0x1a0528&&logger[_0x157c12(0x1bd)]('create-api-pull',_0x157c12(0x1c5)+(_0x56dc36[_0x157c12(0x1c7)]||_0x157c12(0x1bb)),{'projectPath':_0x1a0528,'appCode':_0x49aaa7}),![];}else{if(_0x4228e3['status']===0x191){const _0x39e789=_0x157c12(0x1d1);console[_0x157c12(0x1bd)]('×\x20'+_0x39e789),_0x1a0528&&logger[_0x157c12(0x1bd)](_0x157c12(0x1c3),_0x39e789,{'status':_0x4228e3[_0x157c12(0x1d6)],'appCode':_0x49aaa7,'url':_0x4228e3[_0x157c12(0x1d8)],'projectPath':_0x1a0528});}else{const _0x20b691='获取数据集失败,HTTP状态码:\x20'+_0x4228e3[_0x157c12(0x1d6)];console[_0x157c12(0x1bd)]('×\x20'+_0x20b691);try{const _0x3d08f6=await _0x4228e3[_0x157c12(0x1c8)]();_0x3d08f6&&console[_0x157c12(0x1bd)](_0x157c12(0x1ae),_0x3d08f6),_0x1a0528&&logger[_0x157c12(0x1bd)](_0x157c12(0x1c3),_0x20b691,{'status':_0x4228e3[_0x157c12(0x1d6)],'appCode':_0x49aaa7,'url':_0x4228e3[_0x157c12(0x1d8)],'errorBody':_0x3d08f6,'projectPath':_0x1a0528});}catch(_0x456b18){console[_0x157c12(0x1bd)](_0x157c12(0x1c6)),_0x1a0528&&logger[_0x157c12(0x1bd)](_0x157c12(0x1c3),_0x20b691+_0x157c12(0x1be),{'status':_0x4228e3[_0x157c12(0x1d6)],'appCode':_0x49aaa7,'url':_0x4228e3[_0x157c12(0x1d8)],'readError':_0x456b18 instanceof Error?_0x456b18['message']:String(_0x456b18),'projectPath':_0x1a0528});}}return![];}}catch(_0x3541c0){const _0x1bfb50=_0x3541c0 instanceof Error?_0x3541c0[_0x157c12(0x1c7)]:String(_0x3541c0);return console[_0x157c12(0x1bd)]('×\x20API\x20配置拉取异常:',_0x1bfb50),_0x1a0528&&logger[_0x157c12(0x1bd)](_0x157c12(0x1c3),_0x157c12(0x1b5)+_0x1bfb50,{'appCode':_0x49aaa7,'projectPath':_0x1a0528}),![];}finally{_0x1a6718&&process[_0x157c12(0x1d5)](_0x1a6718);}}
package/lib/api/pull.js CHANGED
@@ -1 +1 @@
1
- (function(_0x250f72,_0x5609c4){const _0x35b850=a8_0x4142,_0x52161a=_0x250f72();while(!![]){try{const _0x56acb6=-parseInt(_0x35b850(0x127))/0x1*(parseInt(_0x35b850(0x137))/0x2)+-parseInt(_0x35b850(0x10f))/0x3+parseInt(_0x35b850(0x13d))/0x4+-parseInt(_0x35b850(0x10d))/0x5*(parseInt(_0x35b850(0x122))/0x6)+parseInt(_0x35b850(0x124))/0x7*(parseInt(_0x35b850(0x120))/0x8)+parseInt(_0x35b850(0x10a))/0x9+parseInt(_0x35b850(0x128))/0xa;if(_0x56acb6===_0x5609c4)break;else _0x52161a['push'](_0x52161a['shift']());}catch(_0x35d1b2){_0x52161a['push'](_0x52161a['shift']());}}}(a8_0x364a,0x562a3));import{createInterface}from'node:readline/promises';import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a8_0x364a(){const _0x34856e=['获取数据集失败,HTTP状态码:\x20','-api','获取数据集失败,原因:登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录后再尝试','*\x20开始生成\x20API\x20配置文件:','\x1b[0m','message','error','api-pull','data','env','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','url','\x20个数据集...','\x0a*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','2bBIBiP','×\x20无法读取错误响应内容','stdout','test','text','\x20\x20\x20•\x20','2039424WuDHpd','json','×\x20未提供应用AppCode,且配置中也没有默认值','2404134lWmAwP','.ts\x20-\x20模型配置文件','success','649795BUHznR','question','1972395DMCxNA','×\x20提供的应用AppCode\x20\x22','exit','trim','*\x20使用指定的应用AppCode:\x20','.ts\x20-\x20客户端实例文件','stdin','×\x20错误详情:','api','tableData','-client','\x20\x20\x201.\x20直接指定:\x20lovrabet\x20api\x20pull\x20<app-code>','!\x20请使用以下方式之一:','string','log','&pageSize=999&currentPage=1',',且无法读取错误响应内容','66304pKWdFM','/smartapi/dataset/getList?appCode=','6eKBtuo','\x20\x20\x202.\x20配置默认值:\x20lovrabet\x20config\x20set\x20app\x20<app-code>','7LbqHsC','*\x20正在处理\x20','status','665748qnVQEX','10208330qNHbZm'];a8_0x364a=function(){return _0x34856e;};return a8_0x364a();}import{logger}from'../utils/logger.js';function a8_0x4142(_0x3af225,_0x582773){const _0x364a8e=a8_0x364a();return a8_0x4142=function(_0x414281,_0x51f8ea){_0x414281=_0x414281-0x108;let _0x3186cd=_0x364a8e[_0x414281];return _0x3186cd;},a8_0x4142(_0x3af225,_0x582773);}export async function initApi(_0x91e62e,_0x31a2bb){const _0x164a3d=a8_0x4142,_0x1884df=readConfig(),_0x4f4bd0=_0x91e62e||_0x1884df?.['app'],_0x5b779e=typeof _0x1884df['env']===_0x164a3d(0x11c)?_0x1884df[_0x164a3d(0x132)]:undefined,_0x262d34=_0x31a2bb||_0x5b779e||'online';initEnv(_0x262d34);(typeof _0x4f4bd0!==_0x164a3d(0x11c)||!_0x4f4bd0)&&(_0x91e62e?console['error'](_0x164a3d(0x110)+_0x91e62e+'\x22\x20无效'):(console[_0x164a3d(0x12f)](_0x164a3d(0x109)),console[_0x164a3d(0x11d)](_0x164a3d(0x11b)),console['log'](_0x164a3d(0x11a)),console[_0x164a3d(0x11d)](_0x164a3d(0x123))),process['exit'](0x1));_0x91e62e?console[_0x164a3d(0x11d)](_0x164a3d(0x113)+_0x4f4bd0):console[_0x164a3d(0x11d)]('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0x4f4bd0+_0x164a3d(0x12d));const _0x59063c=createInterface({'input':process[_0x164a3d(0x115)],'output':process[_0x164a3d(0x139)]});let _0x1f2f28;try{const _0x2d11da=await _0x59063c[_0x164a3d(0x10e)]('!\x20请输入文件前缀\x20\x1b[90m[留空表示无前缀]\x1b[0m:\x20');_0x1f2f28=_0x2d11da[_0x164a3d(0x112)]();if(_0x1f2f28){const _0x550fc3=/^[a-zA-Z][a-zA-Z0-9_-]*$/;!_0x550fc3[_0x164a3d(0x13a)](_0x1f2f28)&&(console[_0x164a3d(0x12f)](_0x164a3d(0x133)),process['exit'](0x1));}}finally{_0x59063c['close']();}console[_0x164a3d(0x11d)](_0x164a3d(0x136)+_0x262d34+')');const _0x31c2f2=await fetch(getApiDomain()+_0x164a3d(0x121)+_0x4f4bd0+_0x164a3d(0x11e),{'headers':{'Cookie':getCookie()}});if(_0x31c2f2['ok']){const _0x3ef205=await _0x31c2f2[_0x164a3d(0x108)]();if(_0x3ef205[_0x164a3d(0x10c)]){const _0x1e2288=_0x1f2f28?_0x1f2f28+_0x164a3d(0x12a):_0x164a3d(0x117),_0x4d8e8d=_0x1f2f28?_0x1f2f28+_0x164a3d(0x119):'client';console['log'](_0x164a3d(0x12c)),console[_0x164a3d(0x11d)]('\x20\x20\x20•\x20'+_0x1e2288+_0x164a3d(0x10b)),console[_0x164a3d(0x11d)](_0x164a3d(0x13c)+_0x4d8e8d+_0x164a3d(0x114)),console[_0x164a3d(0x11d)](_0x164a3d(0x125)+_0x3ef205['data']['tableData']['length']+_0x164a3d(0x135));const _0x172f96=!_0x91e62e;await generateApiFile(_0x3ef205[_0x164a3d(0x131)][_0x164a3d(0x118)],_0x1f2f28,_0x4f4bd0,_0x172f96,_0x262d34);}}else{if(_0x31c2f2[_0x164a3d(0x126)]===0x191){const _0x2ac4a8=_0x164a3d(0x12b);console['error']('×\x20'+_0x2ac4a8),logger['error'](_0x164a3d(0x130),_0x2ac4a8,{'status':_0x31c2f2[_0x164a3d(0x126)],'appCode':_0x4f4bd0,'url':_0x31c2f2[_0x164a3d(0x134)]});}else{const _0x35b74a=_0x164a3d(0x129)+_0x31c2f2[_0x164a3d(0x126)];console[_0x164a3d(0x12f)]('×\x20'+_0x35b74a);try{const _0x583fbb=await _0x31c2f2[_0x164a3d(0x13b)]();_0x583fbb?(console['error'](_0x164a3d(0x116),_0x583fbb),logger[_0x164a3d(0x12f)](_0x164a3d(0x130),_0x35b74a,{'status':_0x31c2f2[_0x164a3d(0x126)],'appCode':_0x4f4bd0,'url':_0x31c2f2[_0x164a3d(0x134)],'errorBody':_0x583fbb})):logger['error'](_0x164a3d(0x130),_0x35b74a,{'status':_0x31c2f2[_0x164a3d(0x126)],'appCode':_0x4f4bd0,'url':_0x31c2f2[_0x164a3d(0x134)]});}catch(_0x175e25){console[_0x164a3d(0x12f)](_0x164a3d(0x138)),logger[_0x164a3d(0x12f)](_0x164a3d(0x130),_0x35b74a+_0x164a3d(0x11f),{'status':_0x31c2f2[_0x164a3d(0x126)],'appCode':_0x4f4bd0,'url':_0x31c2f2['url'],'readError':_0x175e25 instanceof Error?_0x175e25[_0x164a3d(0x12e)]:String(_0x175e25)});}}process[_0x164a3d(0x111)](0x1);}}
1
+ (function(_0x2844ec,_0x355504){const _0x194f86=a11_0x28a3,_0x3611f4=_0x2844ec();while(!![]){try{const _0x1d5a57=parseInt(_0x194f86(0x1e4))/0x1+parseInt(_0x194f86(0x1d2))/0x2*(-parseInt(_0x194f86(0x1e1))/0x3)+-parseInt(_0x194f86(0x1ec))/0x4+-parseInt(_0x194f86(0x1ca))/0x5+parseInt(_0x194f86(0x1d1))/0x6+parseInt(_0x194f86(0x1c5))/0x7*(-parseInt(_0x194f86(0x1bb))/0x8)+-parseInt(_0x194f86(0x1dc))/0x9*(-parseInt(_0x194f86(0x1c2))/0xa);if(_0x1d5a57===_0x355504)break;else _0x3611f4['push'](_0x3611f4['shift']());}catch(_0x4242a0){_0x3611f4['push'](_0x3611f4['shift']());}}}(a11_0x124e,0x1ebd8));import{createInterface}from'node:readline/promises';function a11_0x28a3(_0x22b736,_0x37ddde){const _0x124ea5=a11_0x124e();return a11_0x28a3=function(_0x28a3b6,_0x3b6f4e){_0x28a3b6=_0x28a3b6-0x1b8;let _0x5cb722=_0x124ea5[_0x28a3b6];return _0x5cb722;},a11_0x28a3(_0x22b736,_0x37ddde);}import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a11_0x124e(){const _0x36a1fb=['message','1076844nOQQuX','7996eJaGSx','\x20个数据集...','length','exit','success','&pageSize=999&currentPage=1','online','api','*\x20使用指定的应用AppCode:\x20','env','207pdVuRs','\x20\x20\x202.\x20配置默认值:\x20lovrabet\x20config\x20set\x20app\x20<app-code>','!\x20请使用以下方式之一:','\x20\x20\x201.\x20直接指定:\x20lovrabet\x20api\x20pull\x20<app-code>','*\x20正在处理\x20','102FsvsUU',',且无法读取错误响应内容','text','199154PUQATW','error','app','status','\x0a*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','close','api-pull','×\x20错误详情:','668892JVMXrQ','string','×\x20未提供应用AppCode,且配置中也没有默认值','data','url','455720hekEYu','\x1b[90m*\x20使用配置的应用AppCode:\x20','question','\x20\x20\x20•\x20','stdout','/smartapi/dataset/getList?appCode=','.ts\x20-\x20模型配置文件','85290YYcTCI','log','获取数据集失败,HTTP状态码:\x20','7DTdDxT','获取数据集失败,原因:登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录后再尝试','!\x20请输入文件前缀\x20\x1b[90m[留空表示无前缀]\x1b[0m:\x20','tableData','*\x20开始生成\x20API\x20配置文件:','443815hEdyMH','stdin','client','test','\x1b[0m','json'];a11_0x124e=function(){return _0x36a1fb;};return a11_0x124e();}import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export async function initApi(_0x102b29,_0x3bdba){const _0x4adfb5=a11_0x28a3,_0x350e81=readConfig(),_0x2a1e7d=_0x102b29||_0x350e81?.[_0x4adfb5(0x1e6)],_0x302de0=typeof _0x350e81[_0x4adfb5(0x1db)]===_0x4adfb5(0x1ed)?_0x350e81[_0x4adfb5(0x1db)]:undefined,_0x1d144e=_0x3bdba||_0x302de0||_0x4adfb5(0x1d8);initEnv(_0x1d144e);(typeof _0x2a1e7d!=='string'||!_0x2a1e7d)&&(_0x102b29?console['error']('×\x20提供的应用AppCode\x20\x22'+_0x102b29+'\x22\x20无效'):(console[_0x4adfb5(0x1e5)](_0x4adfb5(0x1b8)),console[_0x4adfb5(0x1c3)](_0x4adfb5(0x1de)),console[_0x4adfb5(0x1c3)](_0x4adfb5(0x1df)),console[_0x4adfb5(0x1c3)](_0x4adfb5(0x1dd))),process['exit'](0x1));_0x102b29?console[_0x4adfb5(0x1c3)](_0x4adfb5(0x1da)+_0x2a1e7d):console[_0x4adfb5(0x1c3)](_0x4adfb5(0x1bc)+_0x2a1e7d+_0x4adfb5(0x1ce));const _0x5014c8=createInterface({'input':process[_0x4adfb5(0x1cb)],'output':process[_0x4adfb5(0x1bf)]});let _0x324bbb;try{const _0x16f69b=await _0x5014c8[_0x4adfb5(0x1bd)](_0x4adfb5(0x1c7));_0x324bbb=_0x16f69b['trim']();if(_0x324bbb){const _0x44e628=/^[a-zA-Z][a-zA-Z0-9_-]*$/;!_0x44e628[_0x4adfb5(0x1cd)](_0x324bbb)&&(console[_0x4adfb5(0x1e5)]('×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。'),process[_0x4adfb5(0x1d5)](0x1));}}finally{_0x5014c8[_0x4adfb5(0x1e9)]();}console['log'](_0x4adfb5(0x1e8)+_0x1d144e+')');const _0x52def3=await fetch(getApiDomain()+_0x4adfb5(0x1c0)+_0x2a1e7d+_0x4adfb5(0x1d7),{'headers':{'Cookie':getCookie()}});if(_0x52def3['ok']){const _0x54d222=await _0x52def3[_0x4adfb5(0x1cf)]();if(_0x54d222[_0x4adfb5(0x1d6)]){const _0x27ef9d=_0x324bbb?_0x324bbb+'-api':_0x4adfb5(0x1d9),_0x399fb7=_0x324bbb?_0x324bbb+'-client':_0x4adfb5(0x1cc);console[_0x4adfb5(0x1c3)](_0x4adfb5(0x1c9)),console[_0x4adfb5(0x1c3)](_0x4adfb5(0x1be)+_0x27ef9d+_0x4adfb5(0x1c1)),console[_0x4adfb5(0x1c3)]('\x20\x20\x20•\x20'+_0x399fb7+'.ts\x20-\x20客户端实例文件'),console[_0x4adfb5(0x1c3)](_0x4adfb5(0x1e0)+_0x54d222[_0x4adfb5(0x1b9)][_0x4adfb5(0x1c8)][_0x4adfb5(0x1d4)]+_0x4adfb5(0x1d3));const _0x35bf57=!_0x102b29;await generateApiFile(_0x54d222[_0x4adfb5(0x1b9)][_0x4adfb5(0x1c8)],_0x324bbb,_0x2a1e7d,_0x35bf57,_0x1d144e);}}else{if(_0x52def3['status']===0x191){const _0x5266b4=_0x4adfb5(0x1c6);console[_0x4adfb5(0x1e5)]('×\x20'+_0x5266b4),logger[_0x4adfb5(0x1e5)](_0x4adfb5(0x1ea),_0x5266b4,{'status':_0x52def3[_0x4adfb5(0x1e7)],'appCode':_0x2a1e7d,'url':_0x52def3[_0x4adfb5(0x1ba)]});}else{const _0x33cc57=_0x4adfb5(0x1c4)+_0x52def3[_0x4adfb5(0x1e7)];console['error']('×\x20'+_0x33cc57);try{const _0x46a4ba=await _0x52def3[_0x4adfb5(0x1e3)]();_0x46a4ba?(console[_0x4adfb5(0x1e5)](_0x4adfb5(0x1eb),_0x46a4ba),logger[_0x4adfb5(0x1e5)](_0x4adfb5(0x1ea),_0x33cc57,{'status':_0x52def3['status'],'appCode':_0x2a1e7d,'url':_0x52def3[_0x4adfb5(0x1ba)],'errorBody':_0x46a4ba})):logger['error']('api-pull',_0x33cc57,{'status':_0x52def3['status'],'appCode':_0x2a1e7d,'url':_0x52def3[_0x4adfb5(0x1ba)]});}catch(_0x41cf78){console[_0x4adfb5(0x1e5)]('×\x20无法读取错误响应内容'),logger[_0x4adfb5(0x1e5)](_0x4adfb5(0x1ea),_0x33cc57+_0x4adfb5(0x1e2),{'status':_0x52def3[_0x4adfb5(0x1e7)],'appCode':_0x2a1e7d,'url':_0x52def3[_0x4adfb5(0x1ba)],'readError':_0x41cf78 instanceof Error?_0x41cf78[_0x4adfb5(0x1d0)]:String(_0x41cf78)});}}process[_0x4adfb5(0x1d5)](0x1);}}
@@ -1 +1 @@
1
- function a10_0x22e3(){const _0x2d482b=['127105hvPmGi','111923nBSoNr','184vTuWQW','按\x20“q”\x20退出。','请前往浏览器完成登录。','*\x20按回车开始登录。','15785890ZBPImj','gray','return','finally','then','√\x20当前为有效会话,无需重新登录。','831123sGrCVJ','*\x20登录成功!','dots','5943906QZJcyR','116487XuyFrg','log','column','78gReczU','40GENzak','1109824oVzCFI'];a10_0x22e3=function(){return _0x2d482b;};return a10_0x22e3();}(function(_0xdcdd0,_0x28e78d){const _0x411cea=a10_0x5d90,_0x23983c=_0xdcdd0();while(!![]){try{const _0x422ebc=parseInt(_0x411cea(0x1c6))/0x1+-parseInt(_0x411cea(0x1ce))/0x2*(parseInt(_0x411cea(0x1ca))/0x3)+parseInt(_0x411cea(0x1cf))/0x4+-parseInt(_0x411cea(0x1ba))/0x5*(parseInt(_0x411cea(0x1cd))/0x6)+parseInt(_0x411cea(0x1bb))/0x7*(-parseInt(_0x411cea(0x1bc))/0x8)+-parseInt(_0x411cea(0x1c9))/0x9+parseInt(_0x411cea(0x1c0))/0xa;if(_0x422ebc===_0x28e78d)break;else _0x23983c['push'](_0x23983c['shift']());}catch(_0x21f68c){_0x23983c['push'](_0x23983c['shift']());}}}(a10_0x22e3,0x86bfe));function a10_0x5d90(_0x2ab4d8,_0x1258d0){const _0x22e35b=a10_0x22e3();return a10_0x5d90=function(_0x5d90e,_0x4a4490){_0x5d90e=_0x5d90e-0x1ba;let _0x248ec3=_0x22e35b[_0x5d90e];return _0x248ec3;},a10_0x5d90(_0x2ab4d8,_0x1258d0);}import{jsx as a10_0x415a53,jsxs as a10_0x4c45d0}from'react/jsx-runtime';import{Text,Box,useInput,useApp}from'ink';import{useEffect,useState}from'react';import{getIsSessionValid}from'./is-session-valid.js';import{authServer}from'./auth-server.js';import a10_0xd183f2 from'ink-spinner';export function AuthServer(){const _0x237e7d=a10_0x5d90,{exit:_0x544bde}=useApp(),[_0x321d57,_0x1f91b6]=useState(![]),[_0x2125f0,_0x3044d0]=useState(!![]),[_0x19876a,_0x1a3d34]=useState(![]),[_0x202b95,_0x530ed7]=useState(![]);useEffect(()=>{const _0x3c6971=a10_0x5d90;getIsSessionValid()['then'](_0x1f91b6)[_0x3c6971(0x1c3)](()=>_0x3044d0(![]));},[]),useEffect(()=>{const _0x150033=a10_0x5d90;!_0x2125f0&&_0x321d57&&(console[_0x150033(0x1cb)](_0x150033(0x1c5)),_0x544bde());},[_0x2125f0,_0x321d57,_0x544bde]),useEffect(()=>{const _0x14b14c=a10_0x5d90;_0x202b95&&(console[_0x14b14c(0x1cb)](_0x14b14c(0x1c7)),_0x544bde());},[_0x202b95,_0x544bde]),useInput((_0xb971aa,_0x140f3f)=>{const _0x40a323=a10_0x5d90;_0x140f3f[_0x40a323(0x1c2)]&&(_0x1a3d34(!![]),authServer({'silent':!![]})[_0x40a323(0x1c4)](_0x3c00f2=>{_0x530ed7(_0x3c00f2);})),_0xb971aa==='q'&&_0x544bde();});if(_0x2125f0)return null;if(_0x321d57||_0x202b95)return null;return a10_0x415a53(Box,{'flexDirection':_0x237e7d(0x1cc),'marginTop':0x1,'marginBottom':0x1,'children':_0x19876a?a10_0x4c45d0(Box,{'children':[a10_0x415a53(Box,{'width':'1'}),a10_0x4c45d0(Text,{'color':'green','children':[a10_0x415a53(a10_0xd183f2,{'type':_0x237e7d(0x1c8)}),'\x20\x20']}),a10_0x415a53(Text,{'children':'正在登录...\x20'}),a10_0x415a53(Text,{'color':'gray','children':_0x237e7d(0x1be)})]}):a10_0x4c45d0(Box,{'children':[a10_0x415a53(Box,{'width':'1'}),a10_0x415a53(Text,{'children':_0x237e7d(0x1bf)}),a10_0x415a53(Text,{'color':_0x237e7d(0x1c1),'children':_0x237e7d(0x1bd)})]})});}
1
+ (function(_0x15fb9f,_0x4b5df8){const _0x361d0e=a13_0x57a8,_0x4637e7=_0x15fb9f();while(!![]){try{const _0xee9eb3=-parseInt(_0x361d0e(0x1ab))/0x1*(-parseInt(_0x361d0e(0x19d))/0x2)+parseInt(_0x361d0e(0x19b))/0x3*(-parseInt(_0x361d0e(0x1ac))/0x4)+-parseInt(_0x361d0e(0x19c))/0x5*(parseInt(_0x361d0e(0x1a8))/0x6)+-parseInt(_0x361d0e(0x1a5))/0x7+parseInt(_0x361d0e(0x1a4))/0x8*(-parseInt(_0x361d0e(0x1a3))/0x9)+parseInt(_0x361d0e(0x1ad))/0xa+-parseInt(_0x361d0e(0x1a7))/0xb*(-parseInt(_0x361d0e(0x1a2))/0xc);if(_0xee9eb3===_0x4b5df8)break;else _0x4637e7['push'](_0x4637e7['shift']());}catch(_0x53a556){_0x4637e7['push'](_0x4637e7['shift']());}}}(a13_0x50a2,0x89565));import{jsx as a13_0x211f79,jsxs as a13_0x4c4784}from'react/jsx-runtime';import{Text,Box,useInput,useApp}from'ink';import{useEffect,useState}from'react';function a13_0x57a8(_0x103935,_0x591ec2){const _0x50a2ad=a13_0x50a2();return a13_0x57a8=function(_0x57a89d,_0x1d9a17){_0x57a89d=_0x57a89d-0x19a;let _0x2b8fd0=_0x50a2ad[_0x57a89d];return _0x2b8fd0;},a13_0x57a8(_0x103935,_0x591ec2);}import{getIsSessionValid}from'./is-session-valid.js';import{authServer}from'./auth-server.js';import a13_0x3e0341 from'ink-spinner';function a13_0x50a2(){const _0x418a4d=['196637FeuqNv','*\x20登录成功!','33zYUaen','262326TYhyMw','finally','√\x20当前为有效会话,无需重新登录。','1iczzkD','4204ihtQpM','10977170JyzBux','then','2949PtwmCG','85mEzfrS','1073122vmPWks','log','gray','*\x20按回车开始登录。','按\x20“q”\x20退出。','7349028alTHQl','99hjyEqo','803288XjkiLN'];a13_0x50a2=function(){return _0x418a4d;};return a13_0x50a2();}export function AuthServer(){const _0x1bf719=a13_0x57a8,{exit:_0x27af02}=useApp(),[_0x2e88c2,_0x46b2da]=useState(![]),[_0x48bf02,_0x2d4cd2]=useState(!![]),[_0x188938,_0x478fa1]=useState(![]),[_0x1b9ecc,_0x36cd59]=useState(![]);useEffect(()=>{const _0x487665=a13_0x57a8;getIsSessionValid()[_0x487665(0x19a)](_0x46b2da)[_0x487665(0x1a9)](()=>_0x2d4cd2(![]));},[]),useEffect(()=>{const _0x5eb0fc=a13_0x57a8;!_0x48bf02&&_0x2e88c2&&(console[_0x5eb0fc(0x19e)](_0x5eb0fc(0x1aa)),_0x27af02());},[_0x48bf02,_0x2e88c2,_0x27af02]),useEffect(()=>{const _0x2699c1=a13_0x57a8;_0x1b9ecc&&(console[_0x2699c1(0x19e)](_0x2699c1(0x1a6)),_0x27af02());},[_0x1b9ecc,_0x27af02]),useInput((_0x2962c8,_0x326938)=>{_0x326938['return']&&(_0x478fa1(!![]),authServer({'silent':!![]})['then'](_0x3632c2=>{_0x36cd59(_0x3632c2);})),_0x2962c8==='q'&&_0x27af02();});if(_0x48bf02)return null;if(_0x2e88c2||_0x1b9ecc)return null;return a13_0x211f79(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':_0x188938?a13_0x4c4784(Box,{'children':[a13_0x211f79(Box,{'width':'1'}),a13_0x4c4784(Text,{'color':'green','children':[a13_0x211f79(a13_0x3e0341,{'type':'dots'}),'\x20\x20']}),a13_0x211f79(Text,{'children':'正在登录...\x20'}),a13_0x211f79(Text,{'color':_0x1bf719(0x19f),'children':'请前往浏览器完成登录。'})]}):a13_0x4c4784(Box,{'children':[a13_0x211f79(Box,{'width':'1'}),a13_0x211f79(Text,{'children':_0x1bf719(0x1a0)}),a13_0x211f79(Text,{'color':_0x1bf719(0x19f),'children':_0x1bf719(0x1a1)})]})});}