@lovrabet/cli 1.1.9 → 1.1.11

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 (51) 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-lock.json +5 -4
  50. package/templates/projects/sub-app-react-demo/package.json +1 -1
  51. package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +42 -28
package/README.md CHANGED
@@ -296,6 +296,56 @@ lovrabet logs --clear
296
296
 
297
297
  ## 📝 What's New
298
298
 
299
+ ### v1.1.11 (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 a0_0x37c9(){const _0x351bd7=['test','\x20直接回车确认,或输入自定义路由地址','22817fUGSJM','12fenaOh','return','length','3457448fXQuQf','111387VHxwiC','green','页面路由地址:\x20','red','页面路径不合法','\x20Step2:\x20','4981020hfRFwU','startsWith','265YtutZo','路径不能包含连续的\x20/','387cisPZw','gray','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','路径不能以\x20/\x20开头或结尾','existsSync','16UowJmH','739224BYgIFV','页面路径长度不能超过\x20100\x20个字符','slice','114138ehibaC','backspace','my-page','trim','split','endsWith','21730GlZOCG','21fzvXVP'];a0_0x37c9=function(){return _0x351bd7;};return a0_0x37c9();}(function(_0x1547a5,_0x5c6973){const _0x3c5c82=a0_0x3102,_0x53cabe=_0x1547a5();while(!![]){try{const _0x430c74=-parseInt(_0x3c5c82(0x133))/0x1+-parseInt(_0x3c5c82(0x125))/0x2*(parseInt(_0x3c5c82(0x138))/0x3)+-parseInt(_0x3c5c82(0x137))/0x4+parseInt(_0x3c5c82(0x11e))/0x5*(parseInt(_0x3c5c82(0x129))/0x6)+-parseInt(_0x3c5c82(0x130))/0x7*(-parseInt(_0x3c5c82(0x126))/0x8)+-parseInt(_0x3c5c82(0x120))/0x9*(-parseInt(_0x3c5c82(0x12f))/0xa)+-parseInt(_0x3c5c82(0x11c))/0xb*(-parseInt(_0x3c5c82(0x134))/0xc);if(_0x430c74===_0x5c6973)break;else _0x53cabe['push'](_0x53cabe['shift']());}catch(_0x37caa2){_0x53cabe['push'](_0x53cabe['shift']());}}}(a0_0x37c9,0x9e134));import{jsx as a0_0x1f7cdc,jsxs as a0_0x50e5c0}from'react/jsx-runtime';import{useState}from'react';function a0_0x3102(_0x18c0e6,_0x26b101){const _0x37c9dc=a0_0x37c9();return a0_0x3102=function(_0x310202,_0x19de5a){_0x310202=_0x310202-0x119;let _0x15ca71=_0x37c9dc[_0x310202];return _0x15ca71;},a0_0x3102(_0x18c0e6,_0x26b101);}import{Text,Box,useInput}from'ink';import a0_0x4ca0de from'node:fs';export function InputProjectCode(_0x41d770){const _0x4557ea=a0_0x3102,{onSubmit:_0x4a57f0,pagePath:_0x2d7d37}=_0x41d770,[_0x3ff6c7,_0x1e19c6]=useState(''),[_0x21f6d7,_0x218c5d]=useState(''),_0x560067=_0x4557ea(0x12b);function _0x3f3135(_0x21f7ae){const _0x37766c=_0x4557ea;if(_0x21f7ae[_0x37766c(0x136)]>0x64)return{'valid':![],'message':_0x37766c(0x127)};if(_0x21f7ae[_0x37766c(0x11d)]('/')||_0x21f7ae[_0x37766c(0x12e)]('/'))return{'valid':![],'message':_0x37766c(0x123)};if(_0x21f7ae['includes']('//'))return{'valid':![],'message':_0x37766c(0x11f)};const _0x5a60ec=_0x21f7ae[_0x37766c(0x12d)]('/');for(const _0x51e443 of _0x5a60ec){if(!_0x51e443)continue;const _0x36f200=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x36f200[_0x37766c(0x131)](_0x51e443))return{'valid':![],'message':_0x37766c(0x122)};}return{'valid':!![]};}return useInput((_0x361b9d,_0x1f0dc4)=>{const _0x43480e=_0x4557ea;if(_0x1f0dc4[_0x43480e(0x135)]){const _0x3519de=_0x3ff6c7[_0x43480e(0x12c)]()||_0x560067;if(_0x21f6d7)return;const _0x2de37a=_0x2d7d37+'/'+_0x3519de;if(a0_0x4ca0de[_0x43480e(0x124)](_0x2de37a)){_0x218c5d('页面路径\x20'+_0x3519de+'\x20已存在,请使用其他路径');return;}_0x4a57f0(_0x3519de),_0x1e19c6(''),_0x218c5d('');}else _0x1f0dc4[_0x43480e(0x12a)]||_0x1f0dc4['delete']?_0x1e19c6(_0x4fb593=>{const _0x49fff8=_0x43480e,_0x1b802a=_0x4fb593[_0x49fff8(0x128)](0x0,-0x1),{valid:_0x5b985b,message:_0x562814}=_0x3f3135(_0x1b802a);return _0x218c5d(_0x5b985b?'':_0x562814||'页面路径不合法'),_0x1b802a;}):_0x1e19c6(_0x422f5a=>{const _0x124599=_0x43480e,_0x372c9f=_0x422f5a+_0x361b9d,{valid:_0x3e20c8,message:_0x19d55d}=_0x3f3135(_0x372c9f);return _0x218c5d(_0x3e20c8?'':_0x19d55d||_0x124599(0x11a)),_0x372c9f;});}),a0_0x50e5c0(Box,{'flexDirection':'column','children':[a0_0x50e5c0(Box,{'children':[a0_0x1f7cdc(Text,{'color':_0x4557ea(0x121),'children':_0x4557ea(0x11b)}),a0_0x1f7cdc(Text,{'children':_0x4557ea(0x13a)}),_0x3ff6c7?a0_0x1f7cdc(Text,{'color':_0x4557ea(0x139),'children':_0x3ff6c7}):a0_0x1f7cdc(Text,{'color':'gray','children':_0x560067}),_0x21f6d7&&a0_0x50e5c0(Text,{'color':_0x4557ea(0x119),'children':['\x20←\x20',_0x21f6d7]})]}),!_0x21f6d7&&!_0x3ff6c7&&a0_0x1f7cdc(Box,{'children':a0_0x1f7cdc(Text,{'color':'gray','children':_0x4557ea(0x132)})})]});}
@@ -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_0x464f2f=a1_0x1f7c;(function(_0x217b38,_0x73a99f){const _0xb38022=a1_0x1f7c,_0x58c294=_0x217b38();while(!![]){try{const _0x98fab9=-parseInt(_0xb38022(0xe0))/0x1+-parseInt(_0xb38022(0xdf))/0x2*(parseInt(_0xb38022(0xfa))/0x3)+-parseInt(_0xb38022(0xd7))/0x4+parseInt(_0xb38022(0xde))/0x5*(-parseInt(_0xb38022(0xed))/0x6)+parseInt(_0xb38022(0xea))/0x7*(-parseInt(_0xb38022(0xf2))/0x8)+parseInt(_0xb38022(0xef))/0x9+parseInt(_0xb38022(0xeb))/0xa*(parseInt(_0xb38022(0xdd))/0xb);if(_0x98fab9===_0x73a99f)break;else _0x58c294['push'](_0x58c294['shift']());}catch(_0x57405b){_0x58c294['push'](_0x58c294['shift']());}}}(a1_0x2f3f,0xcf864));import{jsx as a1_0x5bfbe5,jsxs as a1_0x1d998e,Fragment as a1_0x3b5593}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x17471d from'node:path';function a1_0x2f3f(){const _0x1f8471=['130042UtNQWw','985763YYHXwk','setLogPath','error','cyan','页面添加失败:\x20','info','开始添加页面:\x20','\x20*\x20页面路径:\x20','column','catch','868868ZcoLfQ','1568860KoYARy','\x20Step1:\x20','6nwzoAc','已输入的页面路由\x20','4364748LKkjZY','green','pages','24fbiitQ','\x20*\x20页面文件已创建,可直接通过路由访问','\x20*\x20路由地址:\x20','dirname','success','join','now','已选择页面模板\x20','57DlMXkq','../../templates/pages','cwd','resolve','gray','message','\x20*\x20页面创建成功!','5566992dQZxdl','then','url','processTemplate','src','add-page','374lDXioa','4918970BjEsCc'];a1_0x2f3f=function(){return _0x1f8471;};return a1_0x2f3f();}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_0x1f7c(_0x2b10fe,_0x4c3800){const _0x2f3fc1=a1_0x2f3f();return a1_0x1f7c=function(_0x1f7c5b,_0x26ad23){_0x1f7c5b=_0x1f7c5b-0xd4;let _0x45f280=_0x2f3fc1[_0x1f7c5b];return _0x45f280;},a1_0x1f7c(_0x2b10fe,_0x4c3800);}import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x17471d[a1_0x464f2f(0xf5)](fileURLToPath(import.meta[a1_0x464f2f(0xd9)])),pageTemplateDir=a1_0x17471d['resolve'](__dirname,a1_0x464f2f(0xfb)),projectDir=process[a1_0x464f2f(0xfc)]();export const AddPage=()=>{const _0x5d2415=a1_0x464f2f,{exit:_0x2270a7}=useApp(),[_0x56953a,_0x4ad5f0]=useState(''),[_0x2013a8,_0x5a5bfc]=useState(''),[_0xfec86a,_0x3e650e]=useState(![]),[_0x149c43,_0x25725c]=useState(![]),_0x14e60d=a1_0x17471d[_0x5d2415(0xf7)](projectDir,_0x5d2415(0xdb),_0x5d2415(0xf1)),_0x2c5971=a1_0x17471d[_0x5d2415(0xf7)](_0x14e60d,_0x2013a8),_0x2ee9a2=a1_0x17471d[_0x5d2415(0xf7)](_0x5d2415(0xdb),'pages',_0x2013a8);useEffect(()=>{const _0x4290f3=_0x5d2415,_0x21d2fb=a1_0x17471d[_0x4290f3(0xfd)](pageTemplateDir,_0x56953a);if(_0x56953a&&_0x2013a8){_0x3e650e(!![]),logger[_0x4290f3(0xe1)](process['cwd']());const _0x47261c=Date['now']();logger[_0x4290f3(0xe5)]('add-page',_0x4290f3(0xe6)+_0x2013a8,{'template':_0x56953a,'targetPath':_0x2ee9a2}),TemplateReplacer[_0x4290f3(0xda)](_0x21d2fb,a1_0x17471d[_0x4290f3(0xf7)](_0x14e60d,_0x2013a8),_0x2013a8,_0x56953a)[_0x4290f3(0xd8)](()=>{const _0x2c9d4f=_0x4290f3,_0x33b71=Date[_0x2c9d4f(0xf8)]()-_0x47261c;logger[_0x2c9d4f(0xf6)](_0x2c9d4f(0xdc),'页面添加成功:\x20'+_0x2013a8,_0x33b71,{'template':_0x56953a,'targetPath':_0x2ee9a2,'routePath':_0x2013a8}),_0x25725c(!![]);})[_0x4290f3(0xe9)](_0x1bbdfe=>{const _0x5edf8a=_0x4290f3,_0xf37615=Date[_0x5edf8a(0xf8)]()-_0x47261c;logger[_0x5edf8a(0xe2)](_0x5edf8a(0xdc),_0x5edf8a(0xe4)+_0x2013a8,{'template':_0x56953a,'targetPath':_0x2ee9a2,'error':_0x1bbdfe instanceof Error?_0x1bbdfe[_0x5edf8a(0xd5)]:String(_0x1bbdfe),'duration':_0xf37615});})['finally'](()=>{_0x3e650e(![]);});}},[_0x56953a,_0x2013a8]),useEffect(()=>{_0x149c43&&setTimeout(()=>{_0x2270a7();});},[_0x149c43]);if(_0x56953a)return a1_0x1d998e(Box,{'flexDirection':_0x5d2415(0xe8),'paddingY':0x1,'children':[a1_0x1d998e(Box,{'children':[a1_0x5bfbe5(Text,{'color':_0x5d2415(0xd4),'children':_0x5d2415(0xec)}),a1_0x5bfbe5(Text,{'children':_0x5d2415(0xf9)}),a1_0x5bfbe5(Text,{'color':_0x5d2415(0xf0),'children':_0x56953a})]}),_0x2013a8?a1_0x1d998e(Box,{'children':[a1_0x5bfbe5(Text,{'color':_0x5d2415(0xd4),'children':'\x20Step2:\x20'}),a1_0x5bfbe5(Text,{'children':_0x5d2415(0xee)}),a1_0x5bfbe5(Text,{'color':_0x5d2415(0xf0),'children':_0x2013a8})]}):a1_0x5bfbe5(InputProjectCode,{'pagePath':_0x2c5971,'onSubmit':_0x5a5bfc}),_0x2013a8&&_0xfec86a?a1_0x1d998e(Box,{'marginTop':0x1,'children':[a1_0x5bfbe5(Box,{'width':'4'}),a1_0x5bfbe5(Text,{'children':'正在创建页面,请稍候…'})]}):null,_0x149c43?a1_0x1d998e(a1_0x3b5593,{'children':[a1_0x5bfbe5(Box,{'marginTop':0x1,'children':a1_0x5bfbe5(Text,{'color':'gray','children':_0x5d2415(0xd6)})}),a1_0x1d998e(Box,{'children':[a1_0x5bfbe5(Text,{'color':'gray','children':_0x5d2415(0xe7)}),a1_0x5bfbe5(Text,{'color':_0x5d2415(0xf0),'children':_0x2ee9a2})]}),a1_0x1d998e(Box,{'children':[a1_0x5bfbe5(Text,{'color':_0x5d2415(0xd4),'children':_0x5d2415(0xf4)}),a1_0x1d998e(Text,{'color':_0x5d2415(0xf0),'children':['/',_0x2013a8]})]}),a1_0x5bfbe5(Box,{'marginTop':0x1,'children':a1_0x5bfbe5(Text,{'color':_0x5d2415(0xe3),'children':_0x5d2415(0xf3)})})]}):null]});return a1_0x5bfbe5(SelectPageTemplate,{'onSelect':_0x4ad5f0});};
@@ -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(_0x3857bd,_0x23c5ec){const _0x293ad4=a2_0x4427,_0x4e70aa=_0x3857bd();while(!![]){try{const _0xab83c5=-parseInt(_0x293ad4(0x19b))/0x1+-parseInt(_0x293ad4(0x19f))/0x2+parseInt(_0x293ad4(0x198))/0x3*(-parseInt(_0x293ad4(0x18a))/0x4)+parseInt(_0x293ad4(0x18b))/0x5+-parseInt(_0x293ad4(0x1a3))/0x6+-parseInt(_0x293ad4(0x1a6))/0x7+-parseInt(_0x293ad4(0x18c))/0x8*(-parseInt(_0x293ad4(0x197))/0x9);if(_0xab83c5===_0x23c5ec)break;else _0x4e70aa['push'](_0x4e70aa['shift']());}catch(_0x548ee0){_0x4e70aa['push'](_0x4e70aa['shift']());}}}(a2_0x190b,0x97069));function a2_0x190b(){const _0x2646d2=['return','label','dirname','\x20\x20\x20\x20\x20\x20\x20\x20','upArrow','\x20\x20\x20\x20\x20\x20>\x20','9yAiGSF','3091218YdPrPu','map','length','1187104xprIfl','sort','请选择您要创建的页面模板','blank','908602ZNemJX','downArrow','isDirectory','url','5922900YECgNr','localeCompare','gray','221543WSTFfj','templates/pages','column','error','4jcZxzm','4597560xOMwfS','27117592RhZfUl','../..','sdk-fetch','获取模板列表失败:','\x20Step1:\x20'];a2_0x190b=function(){return _0x2646d2;};return a2_0x190b();}import{jsx as a2_0x16a56d,jsxs as a2_0x3ba1b8}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x493f95 from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x4b5b33=a2_0x4427;try{const _0x21ae90=fileURLToPath(import.meta[_0x4b5b33(0x1a2)]),_0x15ad59=a2_0x493f95['resolve'](a2_0x493f95[_0x4b5b33(0x193)](_0x21ae90),_0x4b5b33(0x18d)),_0x5bdbc0=a2_0x493f95['join'](_0x15ad59,_0x4b5b33(0x1a7)),_0x2869fd=await readdir(_0x5bdbc0,{'withFileTypes':!![]}),_0x212e84=_0x2869fd['filter'](_0x33b6c5=>_0x33b6c5[_0x4b5b33(0x1a1)]())[_0x4b5b33(0x199)](_0x5e824c=>({'label':_0x5e824c['name']}))[_0x4b5b33(0x19c)]((_0x3408d3,_0x3cbded)=>_0x3408d3['label'][_0x4b5b33(0x1a4)](_0x3cbded[_0x4b5b33(0x192)]));return _0x212e84;}catch(_0x3e70b9){return console[_0x4b5b33(0x1a9)](_0x4b5b33(0x18f),_0x3e70b9),[{'label':_0x4b5b33(0x19e)},{'label':_0x4b5b33(0x18e)}];}}function a2_0x4427(_0x12108f,_0x11d868){const _0x190bc3=a2_0x190b();return a2_0x4427=function(_0x4427d7,_0x1314d3){_0x4427d7=_0x4427d7-0x18a;let _0x45e96f=_0x190bc3[_0x4427d7];return _0x45e96f;},a2_0x4427(_0x12108f,_0x11d868);}export function SelectPageTemplate(_0x5060dd){const _0x369936=a2_0x4427,[_0x57e7db,_0x44aadf]=useState(0x0),[_0x5b1f75,_0x10cd2d]=useState([]),[_0x241a98,_0x4a7bc5]=useState(!![]);useEffect(()=>{async function _0xbcf67a(){const _0x39e6db=await getTemplateList();_0x10cd2d(_0x39e6db),_0x4a7bc5(![]);}_0xbcf67a();},[]),useInput((_0x13f42d,_0x5e0645)=>{const _0x221a62=a2_0x4427;if(_0x241a98)return;if(_0x5e0645[_0x221a62(0x191)]){const _0x1be309=_0x5b1f75[_0x57e7db];_0x1be309&&_0x5060dd['onSelect'](_0x1be309['label']);}_0x5e0645[_0x221a62(0x195)]&&_0x44aadf(_0x44d455=>_0x44d455===0x0?_0x5b1f75['length']-0x1:_0x44d455-0x1),_0x5e0645[_0x221a62(0x1a0)]&&_0x44aadf(_0x359a04=>_0x359a04===_0x5b1f75[_0x221a62(0x19a)]-0x1?0x0:_0x359a04+0x1);});if(_0x241a98)return a2_0x16a56d(Box,{'flexDirection':_0x369936(0x1a8),'paddingY':0x1,'children':a2_0x3ba1b8(Box,{'children':[a2_0x16a56d(Text,{'color':_0x369936(0x1a5),'children':_0x369936(0x190)}),a2_0x16a56d(Text,{'children':'正在加载页面模板...'})]})});return a2_0x3ba1b8(Box,{'flexDirection':_0x369936(0x1a8),'paddingY':0x1,'children':[a2_0x3ba1b8(Box,{'children':[a2_0x16a56d(Text,{'color':'gray','children':'\x20Step1:\x20'}),a2_0x16a56d(Text,{'children':_0x369936(0x19d)})]}),_0x5b1f75['map']((_0x12cf86,_0xd68b23)=>{const _0x1a0d73=_0x369936,_0x21d891=_0xd68b23===_0x57e7db,_0x33e017=_0x21d891?_0x1a0d73(0x196)+_0x12cf86[_0x1a0d73(0x192)]:_0x1a0d73(0x194)+_0x12cf86[_0x1a0d73(0x192)];return a2_0x16a56d(Box,{'children':a2_0x16a56d(Text,{'color':_0x21d891?'green':undefined,'children':_0x33e017})},_0x33e017);})]});}
@@ -0,0 +1 @@
1
+ (function(_0x34d731,_0x5c1870){const _0x49cdff=a3_0x96d3,_0x13eb97=_0x34d731();while(!![]){try{const _0x4e5a4=parseInt(_0x49cdff(0x1d0))/0x1*(-parseInt(_0x49cdff(0x1d8))/0x2)+-parseInt(_0x49cdff(0x1db))/0x3*(parseInt(_0x49cdff(0x1d3))/0x4)+parseInt(_0x49cdff(0x1b9))/0x5*(parseInt(_0x49cdff(0x1e4))/0x6)+-parseInt(_0x49cdff(0x1cb))/0x7+-parseInt(_0x49cdff(0x1d2))/0x8+-parseInt(_0x49cdff(0x1d7))/0x9+parseInt(_0x49cdff(0x1d1))/0xa*(parseInt(_0x49cdff(0x1c1))/0xb);if(_0x4e5a4===_0x5c1870)break;else _0x13eb97['push'](_0x13eb97['shift']());}catch(_0x2af5b3){_0x13eb97['push'](_0x13eb97['shift']());}}}(a3_0x15d1,0x5284f));import{jsx as a3_0x38b145,jsxs as a3_0x2f3ac8,Fragment as a3_0x2dfbec}from'react/jsx-runtime';import{useEffect,useState}from'react';function a3_0x15d1(){const _0x381dfd=['duplicateCount','23963kNByCI','10uzNPJZ','4197104bSALon','4ofCTvS','filter','error','使用指定的应用AppCode:\x20','2660679eOeauh','50iXnLOG','datasetCode','dim','475815edNaGX','正在生成\x20','文档生成失败:\x20','cyan','\x20个数据集的文档...','⚠️\x20以下数据集生成失败:','api-doc','使用配置的应用AppCode:\x20','originalCount','1226298LKQlCV','未提供应用AppCode,且配置中也没有默认值','lovrabet\x20auth','\x20重新登录后再试','column','!\x20原始数据集\x20','15sMyRye','map','env','yellow','未找到任何数据集',',\x20失败\x20','length','filePath','18119145vRQICG','正在获取数据集列表...','\x20(环境:\x20','green','setLogPath','./docs','💡\x20请使用\x20','datasetName','online','gray','2410772yFqKrh','.md\x20(','white','success'];a3_0x15d1=function(){return _0x381dfd;};return a3_0x15d1();}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';function a3_0x96d3(_0x498a2f,_0x242a58){const _0x15d1e8=a3_0x15d1();return a3_0x96d3=function(_0x96d302,_0x4177fa){_0x96d302=_0x96d302-0x1b5;let _0x1b2d05=_0x15d1e8[_0x96d302];return _0x1b2d05;},a3_0x96d3(_0x498a2f,_0x242a58);}export const ApiDocUI=({appCode:_0x5efed0,env:_0x20ee92,output:_0x36d64f})=>{const _0x170586=a3_0x96d3,{exit:_0x1315cf}=useApp(),[_0x20669a,_0x552137]=useState(![]),[_0x2903a3,_0xafad47]=useState(''),[_0x2917f4,_0x94aa5a]=useState(![]),[_0x199b92,_0x263181]=useState(null),[_0x3712f8,_0x5116fd]=useState(null),[_0x5937c1,_0x47a637]=useState(null),_0x392988=readConfig(),_0x1a9e2b=getConfigAppCode(),_0x220305=_0x5efed0||_0x1a9e2b,_0x4ed6c5=typeof _0x392988?.[_0x170586(0x1bb)]==='string'?_0x392988['env']:undefined,_0x14eb73=_0x20ee92||_0x4ed6c5||_0x170586(0x1c9);initEnv(_0x14eb73);const _0x4df3d4=_0x36d64f||_0x170586(0x1c6),_0x53cd54=_0x5efed0?_0x170586(0x1d6)+_0x220305:_0x170586(0x1e2)+_0x220305;useEffect(()=>{_0x552137(!![]),_0xa3ec9e();},[]),useEffect(()=>{(_0x2917f4||_0x199b92)&&_0x1315cf();},[_0x2917f4,_0x199b92,_0x1315cf]);async function _0xa3ec9e(){const _0x58fdc3=_0x170586;if(!_0x220305){_0x263181(_0x58fdc3(0x1e5));return;}try{logger[_0x58fdc3(0x1c5)](process['cwd']()),_0xafad47(_0x58fdc3(0x1c2));const {rawData:_0x22ef0d,originalCount:_0x2cd626,filteredCount:_0x11c392,duplicateCount:_0x4c334a}=await fetchDatasets(_0x220305);_0x47a637({'originalCount':_0x2cd626,'filteredCount':_0x11c392,'duplicateCount':_0x4c334a});if(_0x22ef0d[_0x58fdc3(0x1bf)]===0x0){_0x263181(_0x58fdc3(0x1bd));return;}_0xafad47(_0x58fdc3(0x1dc)+_0x22ef0d[_0x58fdc3(0x1bf)]+_0x58fdc3(0x1df));const _0x4d0a66=await generateDatasetDocs(_0x22ef0d,_0x220305,_0x4df3d4,(_0x55b2d0,_0x47d3a2,_0x3498d5)=>{const _0x475089=_0x58fdc3;_0xafad47('正在生成\x20'+_0x3498d5+_0x475089(0x1cc)+_0x55b2d0+'/'+_0x47d3a2+')');});_0x5116fd(_0x4d0a66),_0x94aa5a(!![]);const _0x5e750d=_0x4d0a66[_0x58fdc3(0x1d4)](_0x2ec64d=>_0x2ec64d[_0x58fdc3(0x1ce)])[_0x58fdc3(0x1bf)],_0x4de707=_0x4d0a66[_0x58fdc3(0x1d4)](_0x4cedca=>!_0x4cedca[_0x58fdc3(0x1ce)])[_0x58fdc3(0x1bf)];logger[_0x58fdc3(0x1ce)](_0x58fdc3(0x1e1),'文档生成完成',undefined,{'totalCount':_0x4d0a66[_0x58fdc3(0x1bf)],'successCount':_0x5e750d,'failCount':_0x4de707,'outputDir':_0x4df3d4});}catch(_0x258030){const _0x38c4fb=_0x258030 instanceof Error?_0x258030['message']:String(_0x258030);logger[_0x58fdc3(0x1d5)](_0x58fdc3(0x1e1),_0x58fdc3(0x1dd)+_0x38c4fb,{'appCode':_0x220305,'outputDir':_0x4df3d4}),_0x263181(_0x58fdc3(0x1dd)+_0x38c4fb);}finally{_0x552137(![]);}}const _0x599da1=_0x3712f8?.[_0x170586(0x1d4)](_0x17ba0d=>_0x17ba0d['success'])[_0x170586(0x1bf)]||0x0,_0x1293b2=_0x3712f8?.[_0x170586(0x1d4)](_0x33a6ce=>!_0x33a6ce['success'])[_0x170586(0x1bf)]||0x0;return a3_0x2f3ac8(Box,{'flexDirection':_0x170586(0x1b7),'children':[(_0x20669a||_0x2917f4)&&a3_0x2f3ac8(Box,{'children':[a3_0x38b145(Text,{'color':_0x170586(0x1ca),'children':'*\x20'}),a3_0x38b145(Text,{'color':_0x5efed0?_0x170586(0x1cd):_0x170586(0x1da),'children':_0x53cd54})]}),_0x20669a&&a3_0x38b145(Box,{'children':a3_0x2f3ac8(Text,{'children':['🚀\x20',_0x2903a3,_0x170586(0x1c3),_0x14eb73,')']})}),_0x2917f4&&_0x3712f8&&_0x5937c1&&a3_0x2f3ac8(Box,{'flexDirection':_0x170586(0x1b7),'children':[a3_0x38b145(Box,{'children':a3_0x2f3ac8(Text,{'color':_0x170586(0x1c4),'children':['√\x20文档生成完成!成功\x20',_0x599da1,'\x20个',_0x1293b2>0x0&&_0x170586(0x1be)+_0x1293b2+'\x20个']})}),_0x5937c1[_0x170586(0x1cf)]>0x0&&a3_0x38b145(Box,{'marginTop':0x1,'children':a3_0x2f3ac8(Text,{'color':_0x170586(0x1bc),'children':[_0x170586(0x1b8),_0x5937c1[_0x170586(0x1e3)],'\x20个,过滤重复','\x20',_0x5937c1[_0x170586(0x1cf)],'\x20个']})}),a3_0x2f3ac8(Box,{'marginTop':0x1,'children':[a3_0x38b145(Text,{'color':_0x170586(0x1ca),'children':'*\x20输出目录:\x20'}),a3_0x38b145(Text,{'color':'cyan','children':_0x4df3d4})]}),_0x599da1>0x0&&a3_0x2f3ac8(a3_0x2dfbec,{'children':[a3_0x38b145(Box,{'marginTop':0x1,'children':a3_0x38b145(Text,{'color':_0x170586(0x1ca),'children':'*\x20生成的文档文件:'})}),_0x3712f8[_0x170586(0x1d4)](_0x251dc2=>_0x251dc2[_0x170586(0x1ce)])[_0x170586(0x1ba)]((_0x39ec12,_0x6c4dfd)=>a3_0x2f3ac8(Box,{'marginLeft':0x2,'children':[a3_0x2f3ac8(Text,{'color':_0x170586(0x1de),'children':['•\x20',_0x39ec12[_0x170586(0x1c0)]]}),a3_0x2f3ac8(Text,{'color':_0x170586(0x1da),'children':['\x20-\x20',_0x39ec12[_0x170586(0x1c8)]]})]},_0x6c4dfd))]}),_0x1293b2>0x0&&a3_0x2f3ac8(a3_0x2dfbec,{'children':[a3_0x38b145(Box,{'marginTop':0x1,'children':a3_0x38b145(Text,{'color':_0x170586(0x1bc),'children':_0x170586(0x1e0)})}),_0x3712f8[_0x170586(0x1d4)](_0x592b34=>!_0x592b34[_0x170586(0x1ce)])['map']((_0x1818f4,_0x3c50a5)=>a3_0x2f3ac8(Box,{'marginLeft':0x2,'flexDirection':_0x170586(0x1b7),'children':[a3_0x2f3ac8(Text,{'color':'red','children':['•\x20',_0x1818f4['datasetName'],'\x20(',_0x1818f4[_0x170586(0x1d9)],')']}),_0x1818f4['error']&&a3_0x38b145(Box,{'marginLeft':0x2,'children':a3_0x38b145(Text,{'color':_0x170586(0x1da),'children':_0x1818f4[_0x170586(0x1d5)]})})]},_0x3c50a5))]})]}),_0x199b92&&a3_0x2f3ac8(Box,{'flexDirection':_0x170586(0x1b7),'children':[a3_0x38b145(Box,{'children':a3_0x2f3ac8(Text,{'color':'red','children':['❌\x20',_0x199b92]})}),_0x199b92['includes']('登录')&&a3_0x2f3ac8(Box,{'marginTop':0x1,'children':[a3_0x38b145(Text,{'color':_0x170586(0x1bc),'children':_0x170586(0x1c7)}),a3_0x38b145(Text,{'color':'cyan','children':_0x170586(0x1b5)}),a3_0x38b145(Text,{'color':_0x170586(0x1bc),'children':_0x170586(0x1b6)})]})]})]});};
@@ -0,0 +1 @@
1
+ const a4_0xab036b=a4_0x2201;function a4_0x506f(){const _0xd7b122=['6252cHAkDp','name','获取文档失败\x20(','./docs','text','message','length','等待\x203\x20秒...\x0a','),HTTP状态码:\x20','72OdnjiG','):缺少\x20data.markdown\x20字段','success','3157630VXZQAr','3nTmmAb','log','dataset_',']\x20正在生成:\x20','\x0a共有\x20','140449sWVDcO','4sYWxCE','push','tableName','592220SNqsYC','2472uQRkLd','string','markdown','json','1727vNgjJu','api-doc','utf8','1753376sCVekh','application/json','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','.md\x20-\x20','status','✓\x20成功生成:\x20','4705GtRWEB','88533tiAWLr','data','code','error'];a4_0x506f=function(){return _0xd7b122;};return a4_0x506f();}(function(_0x3b62b8,_0x54cba5){const _0x95d599=a4_0x2201,_0x4d7dfd=_0x3b62b8();while(!![]){try{const _0x42a08d=-parseInt(_0x95d599(0xce))/0x1*(parseInt(_0x95d599(0xcf))/0x2)+-parseInt(_0x95d599(0xc9))/0x3*(-parseInt(_0x95d599(0xda))/0x4)+-parseInt(_0x95d599(0xe0))/0x5*(parseInt(_0x95d599(0xd3))/0x6)+parseInt(_0x95d599(0xc8))/0x7+parseInt(_0x95d599(0xc5))/0x8*(-parseInt(_0x95d599(0xe1))/0x9)+parseInt(_0x95d599(0xd2))/0xa+parseInt(_0x95d599(0xd7))/0xb*(parseInt(_0x95d599(0xe5))/0xc);if(_0x42a08d===_0x54cba5)break;else _0x4d7dfd['push'](_0x4d7dfd['shift']());}catch(_0x5f56b6){_0x4d7dfd['push'](_0x4d7dfd['shift']());}}}(a4_0x506f,0x42bb2));import{mkdirSync,writeFileSync}from'node:fs';import a4_0xa8ebe2 from'node:path';function a4_0x2201(_0xcc8191,_0x203703){const _0x506fe0=a4_0x506f();return a4_0x2201=function(_0x220132,_0x517622){_0x220132=_0x220132-0xbf;let _0x556bd5=_0x506fe0[_0x220132];return _0x556bd5;},a4_0x2201(_0xcc8191,_0x203703);}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x194ddc){const _0x30a055=a4_0x2201,{appCode:_0x11509d,datasetCode:_0xf13949,datasetId:_0x26d5d1}=_0x194ddc,_0x4a6cd5=getApiDomain(),_0x58666d=_0x4a6cd5+'/api/node-toolbox/api-doc-generator',_0x2c44e4=await fetch(_0x58666d,{'method':'POST','headers':{'Content-Type':_0x30a055(0xdb),'Cookie':getCookie()},'body':JSON['stringify']({'appCode':_0x11509d,'datasetCode':_0xf13949,'datasetId':_0x26d5d1})});if(!_0x2c44e4['ok']){if(_0x2c44e4['status']===0x191)throw new Error(_0x30a055(0xdc));let _0x3140cf='';try{_0x3140cf=await _0x2c44e4[_0x30a055(0xc0)]();}catch(_0x4c10ed){}throw new Error(_0x30a055(0xe7)+_0xf13949+_0x30a055(0xc4)+_0x2c44e4[_0x30a055(0xde)]+(_0x3140cf?'\x0a'+_0x3140cf:''));}const _0x57e929=await _0x2c44e4[_0x30a055(0xd6)]();if(!_0x57e929[_0x30a055(0xe2)]||typeof _0x57e929[_0x30a055(0xe2)][_0x30a055(0xd5)]!==_0x30a055(0xd4))throw new Error('响应数据格式错误\x20('+_0xf13949+_0x30a055(0xc6));return _0x57e929[_0x30a055(0xe2)][_0x30a055(0xd5)];}function delay(_0x3d8b60){return new Promise(_0x474b3b=>setTimeout(_0x474b3b,_0x3d8b60));}export async function generateDatasetDocs(_0x1a65b3,_0x8baee7,_0xd11298=a4_0xab036b(0xbf),_0x2be190){const _0x4cd70a=a4_0xab036b;mkdirSync(_0xd11298,{'recursive':!![]});const _0x355501=[],_0x5c6430=_0x1a65b3['length'];console[_0x4cd70a(0xca)](_0x4cd70a(0xcd)+_0x5c6430+'\x20个数据集需要生成文档\x0a');for(let _0x2ddb30=0x0;_0x2ddb30<_0x1a65b3[_0x4cd70a(0xc2)];_0x2ddb30++){const _0x26f0e2=_0x1a65b3[_0x2ddb30],_0x153ca5=_0x2ddb30+0x1;let _0x33754e;if(_0x26f0e2['dbtableConfig']?.[_0x4cd70a(0xd1)])_0x33754e=_0x26f0e2['dbtableConfig']['tableName'];else{const _0xdf09d2=_0x26f0e2['code']['slice'](-0x4);_0x33754e=_0x4cd70a(0xcb)+_0xdf09d2;}try{console[_0x4cd70a(0xca)]('['+_0x153ca5+'/'+_0x5c6430+_0x4cd70a(0xcc)+_0x33754e+'.md\x20('+_0x26f0e2['name']+')');_0x2be190&&_0x2be190(_0x153ca5,_0x5c6430,_0x33754e);const _0x5b4499=await fetchDatasetDoc({'appCode':_0x8baee7,'datasetCode':_0x26f0e2['code'],'datasetId':_0x26f0e2['id'],'enableAI':![]}),_0x126a8c=a4_0xa8ebe2['join'](_0xd11298,_0x33754e+'.md');writeFileSync(_0x126a8c,_0x5b4499,{'encoding':_0x4cd70a(0xd9)}),console[_0x4cd70a(0xca)](_0x4cd70a(0xdf)+_0x33754e+'.md'),logger[_0x4cd70a(0xc7)](_0x4cd70a(0xd8),'生成文档成功:\x20'+_0x33754e,undefined,{'datasetCode':_0x26f0e2[_0x4cd70a(0xe3)],'datasetName':_0x26f0e2[_0x4cd70a(0xe6)],'filePath':_0x126a8c,'progress':_0x153ca5+'/'+_0x5c6430}),_0x355501[_0x4cd70a(0xd0)]({'datasetCode':_0x26f0e2['code'],'datasetName':_0x26f0e2[_0x4cd70a(0xe6)],'filePath':_0x126a8c,'success':!![]}),_0x153ca5<_0x5c6430&&await delay(0xbb8);}catch(_0x5ee4bf){const _0x5f12d4=_0x5ee4bf instanceof Error?_0x5ee4bf[_0x4cd70a(0xc1)]:String(_0x5ee4bf);console[_0x4cd70a(0xca)]('✗\x20失败:\x20'+_0x33754e+_0x4cd70a(0xdd)+_0x5f12d4+'\x0a'),logger[_0x4cd70a(0xe4)](_0x4cd70a(0xd8),'生成文档失败:\x20'+_0x26f0e2['code'],{'datasetCode':_0x26f0e2[_0x4cd70a(0xe3)],'datasetName':_0x26f0e2[_0x4cd70a(0xe6)],'error':_0x5f12d4,'progress':_0x153ca5+'/'+_0x5c6430}),_0x355501[_0x4cd70a(0xd0)]({'datasetCode':_0x26f0e2[_0x4cd70a(0xe3)],'datasetName':_0x26f0e2['name'],'filePath':'','success':![],'error':_0x5f12d4}),_0x153ca5<_0x5c6430&&(console['log'](_0x4cd70a(0xc3)),await delay(0xbb8));}}return _0x355501;}
@@ -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(_0x2dc870,_0x3b4846){const _0x1ed1a7=a5_0xc5ac,_0x3dca04=_0x2dc870();while(!![]){try{const _0x11fcc3=parseInt(_0x1ed1a7(0x164))/0x1+parseInt(_0x1ed1a7(0x152))/0x2+-parseInt(_0x1ed1a7(0x161))/0x3*(-parseInt(_0x1ed1a7(0x15e))/0x4)+parseInt(_0x1ed1a7(0x159))/0x5+-parseInt(_0x1ed1a7(0x157))/0x6+parseInt(_0x1ed1a7(0x17a))/0x7*(-parseInt(_0x1ed1a7(0x186))/0x8)+parseInt(_0x1ed1a7(0x177))/0x9;if(_0x11fcc3===_0x3b4846)break;else _0x3dca04['push'](_0x3dca04['shift']());}catch(_0x3334b8){_0x3dca04['push'](_0x3dca04['shift']());}}}(a5_0x4d1a,0x3f0e1));import{jsx as a5_0x227a5b,jsxs as a5_0x3a635b}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a5_0x4d1a(){const _0x1c4dda=['endsWith','red','datasetCount','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','{\x20lovrabetClient\x20}','lovrabet\x20auth','api','!\x20原始数据集\x20','./src/api/','💡\x20请使用\x20','2081512zgSPIz','api-pull','58636jGrdBi','cyan','-api','join','string','252678xsqhUT','env','411285EdEbjn','.ts','-client','\x20from\x20\x27@/','使用指定的应用AppCode:\x20','12YnTMrW','*\x20已生成文件:','拉取\x20API\x20配置失败:\x20','158097bDnEGN','column','replace','49864zcXQQZ','\x20-\x20客户端实例文件','未提供应用AppCode,且配置中也没有默认值','modelCount','cwd','\x20个模型','*\x20导入方式:','-\x20模型配置文件\x20(','green','yellow','\x20重新登录后再试','error','split','\x20个模型)','\x20个数据集,生成','使用配置的应用AppCode:\x20','includes','online','dim','2169351WgtRcE','client','\x20个,过滤重复','7wBODoO','gray'];a5_0x4d1a=function(){return _0x1c4dda;};return a5_0x4d1a();}import{initEnv}from'../constant/env.js';function a5_0xc5ac(_0x31e37c,_0x5b6904){const _0x4d1ad5=a5_0x4d1a();return a5_0xc5ac=function(_0xc5acde,_0x59e302){_0xc5acde=_0xc5acde-0x151;let _0x4bb07b=_0x4d1ad5[_0xc5acde];return _0x4bb07b;},a5_0xc5ac(_0x31e37c,_0x5b6904);}import{fetchDatasets}from'./fetch-datasets.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0xdf2384,env:_0x48fa7c,output:_0x3c7e68})=>{const _0x5cd369=a5_0xc5ac,{exit:_0x853ea5}=useApp(),[_0x325ec1,_0x28e421]=useState(![]),[_0x43766a,_0x35f518]=useState(![]),[_0x5b3739,_0x3f09a0]=useState(null),[_0x36ae40,_0x1ef4b8]=useState(null),_0x1586c7=readConfig(),_0x5c270f=getConfigAppCode(),_0x5beae4=_0xdf2384||_0x5c270f,_0x48722c=typeof _0x1586c7?.['env']===_0x5cd369(0x156)?_0x1586c7[_0x5cd369(0x158)]:undefined,_0x4644da=_0x48fa7c||_0x48722c||_0x5cd369(0x175);initEnv(_0x4644da);const _0x4a55e3=_0x3c7e68||_0x5cd369(0x184),_0x5d0f98=_0xdf2384&&_0xdf2384[_0x5cd369(0x174)]('-')?_0xdf2384[_0x5cd369(0x170)]('-')['slice'](0x1)[_0x5cd369(0x155)]('-'):'',_0x50bd78=_0xdf2384?_0x5cd369(0x15d)+_0x5beae4:_0x5cd369(0x173)+_0x5beae4,_0x4d1cc6=_0x5d0f98?_0x5d0f98+_0x5cd369(0x154):_0x5cd369(0x182),_0x45f8a5=_0x5d0f98?_0x5d0f98+_0x5cd369(0x15b):_0x5cd369(0x178);useEffect(()=>{_0x28e421(!![]),_0x36bbbd();},[]),useEffect(()=>{(_0x43766a||_0x5b3739)&&_0x853ea5();},[_0x43766a,_0x5b3739,_0x853ea5]);async function _0x36bbbd(){const _0x1dc146=_0x5cd369;if(!_0x5beae4){_0x3f09a0(_0x1dc146(0x166));return;}try{logger['setLogPath'](process[_0x1dc146(0x168)]());const {rawData:_0x56d38d,originalCount:_0x1511b9,filteredCount:_0x51777c,duplicateCount:_0x553665}=await fetchDatasets(_0x5beae4),_0x37e907=_0x51777c,_0x4730fe=!_0xdf2384,_0x4dbb45=await generateApiFile(_0x56d38d,_0x5d0f98,_0x5beae4,_0x4730fe,_0x4644da,_0x4a55e3),_0x5dd6b0=_0x4a55e3[_0x1dc146(0x17c)]('/')?_0x4a55e3:_0x4a55e3+'/';_0x1ef4b8({'api':''+_0x5dd6b0+_0x4d1cc6+_0x1dc146(0x15a),'client':''+_0x5dd6b0+_0x45f8a5+_0x1dc146(0x15a),'modelCount':_0x4dbb45[_0x1dc146(0x167)],'datasetCount':_0x37e907,'originalCount':_0x1511b9,'duplicateCount':_0x553665}),_0x35f518(!![]);}catch(_0x25134d){const _0xef3c2c=_0x25134d instanceof Error?_0x25134d['message']:String(_0x25134d);logger[_0x1dc146(0x16f)](_0x1dc146(0x151),_0x1dc146(0x160)+_0xef3c2c,{'appCode':_0x5beae4,'error':_0xef3c2c}),_0x3f09a0(_0x1dc146(0x160)+_0xef3c2c);}finally{_0x28e421(![]);}}return a5_0x3a635b(Box,{'flexDirection':_0x5cd369(0x162),'children':[(_0x325ec1||_0x43766a)&&a5_0x3a635b(Box,{'children':[a5_0x227a5b(Text,{'color':'gray','children':'*\x20'}),a5_0x227a5b(Text,{'color':_0xdf2384?'white':'dim','children':_0x50bd78})]}),_0x325ec1&&a5_0x227a5b(Box,{'children':a5_0x3a635b(Text,{'children':[_0x5cd369(0x17f),_0x4644da,')']})}),_0x43766a&&_0x36ae40&&a5_0x3a635b(Box,{'flexDirection':'column','children':[a5_0x227a5b(Box,{'children':a5_0x3a635b(Text,{'color':_0x5cd369(0x16c),'children':['√\x20成功拉取\x20',_0x36ae40[_0x5cd369(0x17e)],_0x5cd369(0x172),'\x20',_0x36ae40[_0x5cd369(0x167)],_0x5cd369(0x169)]})}),_0x36ae40['duplicateCount']>0x0&&a5_0x227a5b(Box,{'marginTop':0x1,'children':a5_0x3a635b(Text,{'color':'yellow','children':[_0x5cd369(0x183),_0x36ae40['originalCount'],_0x5cd369(0x179),'\x20',_0x36ae40['duplicateCount'],'\x20个']})}),a5_0x227a5b(Box,{'marginTop':0x1,'children':a5_0x227a5b(Text,{'color':_0x5cd369(0x17b),'children':_0x5cd369(0x15f)})}),a5_0x3a635b(Box,{'marginLeft':0x2,'children':[a5_0x3a635b(Text,{'color':'cyan','children':['•\x20',_0x36ae40[_0x5cd369(0x182)]]}),a5_0x3a635b(Text,{'color':_0x5cd369(0x176),'children':['\x20',_0x5cd369(0x16b),_0x36ae40[_0x5cd369(0x167)],_0x5cd369(0x171)]})]}),a5_0x3a635b(Box,{'marginLeft':0x2,'children':[a5_0x3a635b(Text,{'color':'cyan','children':['•\x20',_0x36ae40[_0x5cd369(0x178)]]}),a5_0x227a5b(Text,{'color':_0x5cd369(0x176),'children':_0x5cd369(0x165)})]}),a5_0x227a5b(Box,{'marginTop':0x1,'children':a5_0x227a5b(Text,{'color':_0x5cd369(0x17b),'children':_0x5cd369(0x16a)})}),a5_0x227a5b(Box,{'marginLeft':0x2,'children':a5_0x3a635b(Text,{'color':_0x5cd369(0x16d),'children':['import\x20',_0x5cd369(0x180),_0x5cd369(0x15c),_0x36ae40[_0x5cd369(0x178)][_0x5cd369(0x163)](/^\.\//,'')[_0x5cd369(0x163)](_0x5cd369(0x15a),''),'\x27']})})]}),_0x5b3739&&a5_0x3a635b(Box,{'flexDirection':_0x5cd369(0x162),'children':[a5_0x227a5b(Box,{'children':a5_0x3a635b(Text,{'color':_0x5cd369(0x17d),'children':['❌\x20',_0x5b3739]})}),_0x5b3739[_0x5cd369(0x174)]('登录')&&a5_0x3a635b(Box,{'marginTop':0x1,'children':[a5_0x227a5b(Text,{'color':_0x5cd369(0x16d),'children':_0x5cd369(0x185)}),a5_0x227a5b(Text,{'color':_0x5cd369(0x153),'children':_0x5cd369(0x181)}),a5_0x227a5b(Text,{'color':_0x5cd369(0x16d),'children':_0x5cd369(0x16e)})]})]})]});};
@@ -0,0 +1 @@
1
+ (function(_0x518b50,_0x54eabe){const _0x2a9ae7=a6_0x5f59,_0x38c8c8=_0x518b50();while(!![]){try{const _0x535d6c=parseInt(_0x2a9ae7(0x1e8))/0x1+parseInt(_0x2a9ae7(0x1f3))/0x2*(parseInt(_0x2a9ae7(0x1de))/0x3)+-parseInt(_0x2a9ae7(0x1d9))/0x4+parseInt(_0x2a9ae7(0x1f2))/0x5+parseInt(_0x2a9ae7(0x1db))/0x6*(parseInt(_0x2a9ae7(0x1df))/0x7)+-parseInt(_0x2a9ae7(0x1f5))/0x8+parseInt(_0x2a9ae7(0x1e7))/0x9*(-parseInt(_0x2a9ae7(0x1ea))/0xa);if(_0x535d6c===_0x54eabe)break;else _0x38c8c8['push'](_0x38c8c8['shift']());}catch(_0x1519ba){_0x38c8c8['push'](_0x38c8c8['shift']());}}}(a6_0x51a6,0x57ca4));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{formatDataset}from'./format-dataset.js';function a6_0x5f59(_0x32e925,_0xbc907b){const _0x51a644=a6_0x51a6();return a6_0x5f59=function(_0x5f5974,_0x59971e){_0x5f5974=_0x5f5974-0x1d9;let _0x4f559f=_0x51a644[_0x5f5974];return _0x4f559f;},a6_0x5f59(_0x32e925,_0xbc907b);}export function filterDuplicateDatasets(_0x31d06c){const _0x57a6e3=a6_0x5f59,_0x388335=_0x31d06c[_0x57a6e3(0x1f0)](_0x2b6211=>_0x2b6211[_0x57a6e3(0x1ec)]),_0x4dcff8=_0x31d06c['filter'](_0x3dd783=>!_0x3dd783[_0x57a6e3(0x1ec)]),_0x39de87=new Map();return _0x388335[_0x57a6e3(0x1e1)](_0x33c619=>{const _0x5b265f=_0x57a6e3,_0x336bc6=_0x33c619[_0x5b265f(0x1ec)][_0x5b265f(0x1f7)],_0x1fbfa8=_0x39de87[_0x5b265f(0x1ee)](_0x336bc6);(!_0x1fbfa8||_0x33c619['id']>_0x1fbfa8['id'])&&_0x39de87[_0x5b265f(0x1eb)](_0x336bc6,_0x33c619);}),[...Array[_0x57a6e3(0x1dc)](_0x39de87[_0x57a6e3(0x1e3)]()),..._0x4dcff8];}function a6_0x51a6(){const _0x323ec2=['4hmGcrx','/smartapi/dataset/getList?appCode=','5468040dHytOH','success','tableName','371544dVvVvQ','data','30hgZlhe','from','length','803628NvxzYq','552650GJvfuU','未知错误','forEach','tableData','values','获取数据集失败:\x20','status','message','27WEqrZt','545147SeRpVv','&pageSize=999&currentPage=1','1320860QAsaHI','set','dbtableConfig','text','get','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','filter','json','282940JPRTnB'];a6_0x51a6=function(){return _0x323ec2;};return a6_0x51a6();}export async function fetchDatasets(_0x6117d3){const _0x51d4a0=a6_0x5f59,_0x3b3bc8=await fetch(getApiDomain()+_0x51d4a0(0x1f4)+_0x6117d3+_0x51d4a0(0x1e9),{'headers':{'Cookie':getCookie()}});if(!_0x3b3bc8['ok']){if(_0x3b3bc8[_0x51d4a0(0x1e5)]===0x191)throw new Error(_0x51d4a0(0x1ef));let _0x562a6d='';try{_0x562a6d=await _0x3b3bc8[_0x51d4a0(0x1ed)]();}catch(_0x25145c){}throw new Error('获取数据集失败,HTTP状态码:\x20'+_0x3b3bc8[_0x51d4a0(0x1e5)]+(_0x562a6d?'\x0a'+_0x562a6d:''));}const _0x1f1b45=await _0x3b3bc8[_0x51d4a0(0x1f1)]();if(!_0x1f1b45[_0x51d4a0(0x1f6)])throw new Error(_0x51d4a0(0x1e4)+(_0x1f1b45[_0x51d4a0(0x1e6)]||_0x51d4a0(0x1e0)));const _0x3941f0=_0x1f1b45[_0x51d4a0(0x1da)][_0x51d4a0(0x1e2)],_0x51ec0e=_0x3941f0[_0x51d4a0(0x1dd)],_0x2d2752=filterDuplicateDatasets(_0x3941f0),_0x507c22=_0x2d2752['length'],_0x7bb620=_0x51ec0e-_0x507c22,_0x35c172=formatDataset(_0x2d2752);return{'datasets':_0x35c172,'rawData':_0x2d2752,'originalCount':_0x51ec0e,'filteredCount':_0x507c22,'duplicateCount':_0x7bb620};}
@@ -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_0x4321(_0x1a4f11,_0x34bf7c){const _0x1271fb=a7_0x1271();return a7_0x4321=function(_0x432101,_0x29ba5c){_0x432101=_0x432101-0x1a1;let _0x4cc3c0=_0x1271fb[_0x432101];return _0x4cc3c0;},a7_0x4321(_0x1a4f11,_0x34bf7c);}(function(_0x41283e,_0x26c810){const _0x2a9bc3=a7_0x4321,_0x59495a=_0x41283e();while(!![]){try{const _0x4d1ab1=parseInt(_0x2a9bc3(0x1a6))/0x1+parseInt(_0x2a9bc3(0x1bb))/0x2*(-parseInt(_0x2a9bc3(0x1b3))/0x3)+-parseInt(_0x2a9bc3(0x1a8))/0x4+parseInt(_0x2a9bc3(0x1b1))/0x5*(-parseInt(_0x2a9bc3(0x1bd))/0x6)+-parseInt(_0x2a9bc3(0x1b0))/0x7*(parseInt(_0x2a9bc3(0x1b5))/0x8)+parseInt(_0x2a9bc3(0x1b6))/0x9*(parseInt(_0x2a9bc3(0x1ae))/0xa)+-parseInt(_0x2a9bc3(0x1b8))/0xb*(-parseInt(_0x2a9bc3(0x1be))/0xc);if(_0x4d1ab1===_0x26c810)break;else _0x59495a['push'](_0x59495a['shift']());}catch(_0x55d62b){_0x59495a['push'](_0x59495a['shift']());}}}(a7_0x1271,0x2a820));export function formatDataset(_0x4b3263){const _0x47a546=a7_0x4321,_0x37ea57=_0x4b3263[_0x47a546(0x1a3)](_0x53ec2b=>_0x53ec2b[_0x47a546(0x1ab)]),_0x19c247=_0x4b3263[_0x47a546(0x1a3)](_0x1a3fa5=>!_0x1a3fa5[_0x47a546(0x1ab)]),_0x525bff=new Map();_0x37ea57[_0x47a546(0x1af)](_0x368fa7=>{const _0x171e39=_0x47a546,_0x20978b=_0x368fa7[_0x171e39(0x1ab)][_0x171e39(0x1b2)],_0x5520c1=_0x525bff[_0x171e39(0x1a2)](_0x20978b);(!_0x5520c1||_0x368fa7['id']>_0x5520c1['id'])&&_0x525bff[_0x171e39(0x1a9)](_0x20978b,_0x368fa7);});const _0x32c329=Array[_0x47a546(0x1ad)](_0x525bff[_0x47a546(0x1a5)]())[_0x47a546(0x1c1)](_0x2cd7ff=>{const _0x1900ea=_0x47a546,_0x3b2a17=snakeToCamel(_0x2cd7ff['dbtableConfig'][_0x1900ea(0x1b2)]);return{'id':_0x2cd7ff['id'],'name':_0x2cd7ff[_0x1900ea(0x1b7)],'code':_0x2cd7ff[_0x1900ea(0x1ba)],'tableName':_0x2cd7ff['dbtableConfig'][_0x1900ea(0x1b2)],'apiFucName':_0x3b2a17?_0x3b2a17+_0x1900ea(0x1bc):_0x1900ea(0x1a7)+_0x2cd7ff['code']+'Api','pkField':_0x2cd7ff['dbtableConfig'][_0x1900ea(0x1a1)],'allFields':_0x2cd7ff[_0x1900ea(0x1ab)][_0x1900ea(0x1bf)][_0x1900ea(0x1aa)](',')};}),_0x45c1b9=_0x19c247['map'](_0x15aadb=>{const _0x44dbd9=_0x47a546,_0x2c2e45=_0x15aadb['code'][_0x44dbd9(0x1c0)](-0x6),_0x49cb62=_0x44dbd9(0x1ac)+_0x2c2e45,_0xafeb5=snakeToCamel(_0x49cb62);return{'id':_0x15aadb['id'],'name':_0x15aadb['name'],'code':_0x15aadb[_0x44dbd9(0x1ba)],'tableName':_0x49cb62,'apiFucName':_0xafeb5?_0xafeb5+_0x44dbd9(0x1bc):_0x44dbd9(0x1a7)+_0x2c2e45+_0x44dbd9(0x1bc),'pkField':undefined,'allFields':[]};});return[..._0x32c329,..._0x45c1b9];}function a7_0x1271(){const _0x275f79=['trim','248HarYXl','274842lBQwvX','name','2321ApUkvD','toUpperCase','code','523122VxEVNp','Api','42oyCrlF','33132sESTDz','allFields','slice','map','pkField','get','filter','replace','values','230610JHgtwe','dataset','861140SnqENu','set','split','dbtableConfig','dataset_','from','10joDKiU','forEach','36967IJpztX','20750KFpsXG','tableName','3bkddDy'];a7_0x1271=function(){return _0x275f79;};return a7_0x1271();}function snakeToCamel(_0x16e541){const _0x1f7cda=a7_0x4321;if(!_0x16e541)return _0x16e541;const _0x129ddf=_0x16e541[_0x1f7cda(0x1b4)]();return _0x129ddf[_0x1f7cda(0x1a4)](/_([a-zA-Z0-9])/g,(_0x2cf472,_0x568cb7)=>_0x568cb7[_0x1f7cda(0x1b9)]());}
@@ -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
+ const a8_0x515f57=a8_0x3879;(function(_0x2236a1,_0x9129a5){const _0x4aa662=a8_0x3879,_0x5f32bc=_0x2236a1();while(!![]){try{const _0x4a7262=-parseInt(_0x4aa662(0x196))/0x1*(parseInt(_0x4aa662(0x1a4))/0x2)+parseInt(_0x4aa662(0x19a))/0x3*(-parseInt(_0x4aa662(0x1ad))/0x4)+parseInt(_0x4aa662(0x1a5))/0x5+-parseInt(_0x4aa662(0x19d))/0x6*(parseInt(_0x4aa662(0x1c0))/0x7)+-parseInt(_0x4aa662(0x195))/0x8*(parseInt(_0x4aa662(0x1be))/0x9)+-parseInt(_0x4aa662(0x1b8))/0xa+-parseInt(_0x4aa662(0x1a2))/0xb*(-parseInt(_0x4aa662(0x1b6))/0xc);if(_0x4a7262===_0x9129a5)break;else _0x5f32bc['push'](_0x5f32bc['shift']());}catch(_0x520966){_0x5f32bc['push'](_0x5f32bc['shift']());}}}(a8_0x4595,0x2450f));function a8_0x4595(){const _0x25677a=['string','\x22\x20}','init-api','charAt','typescript','12SJJJap','code','1728560ovSunU','url','online','tableName','toUpperCase','-api','689922oymSop','./src/api/','85582INbINk','name','16AKNSgD','136063ukljSw','apiFucName','length','api.ts.tpl','3ULKSjk','templates/generate-api','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','30RIlnbo','utf8','forEach','success','endsWith','8878661YWynnm','../..','4XjJrua','1324240WCFoJT','keys','replaceApiContent','format','{\x20apiConfigName:\x20','dirname','slice','join','1055280fecSdA','.ts','env',',\x20env:\x20\x22'];a8_0x4595=function(){return _0x25677a;};return a8_0x4595();}import a8_0x260d0f from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a8_0x52c6d3 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{formatDataset}from'./format-dataset.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';function a8_0x3879(_0x28542e,_0x2a82cf){const _0x459559=a8_0x4595();return a8_0x3879=function(_0x387955,_0x419518){_0x387955=_0x387955-0x195;let _0x5f3f6d=_0x459559[_0x387955];return _0x5f3f6d;},a8_0x3879(_0x28542e,_0x2a82cf);}export async function generateApiFile(_0x466fc1,_0x4a49f4='',_0x3bddee,_0x32fe57=![],_0xbaf196,_0x5adc4a=a8_0x515f57(0x1bf)){const _0x2e7925=a8_0x515f57,_0x1abd37=readConfig(),_0x4baa3f=_0x3bddee||_0x1abd37?.['app'];if(typeof _0x4baa3f!==_0x2e7925(0x1b1)||!_0x4baa3f)throw new Error(_0x2e7925(0x19c));const _0x4b8862=_0x32fe57?'CONFIG_NAMES.DEFAULT':'\x22'+_0x4baa3f+'\x22',_0x2c1781=typeof _0x1abd37[_0x2e7925(0x1af)]===_0x2e7925(0x1b1)?_0x1abd37[_0x2e7925(0x1af)]:undefined,_0x16a7de=_0xbaf196||_0x2c1781||'online',_0x14a754=_0x16a7de!==_0x2e7925(0x1ba);let _0x39eb29;if(_0x32fe57)_0x14a754?_0x39eb29=_0x2e7925(0x1a9)+_0x4b8862+_0x2e7925(0x1b0)+_0x16a7de+_0x2e7925(0x1b2):_0x39eb29='';else{const _0x3b60cd=_0x14a754?_0x2e7925(0x1b0)+_0x16a7de+'\x22':'';_0x39eb29='{\x20apiConfigName:\x20\x22'+_0x4baa3f+'\x22'+_0x3b60cd+'\x20}';}const _0x14d821=_0x4a49f4?_0x4a49f4+_0x2e7925(0x1bd):'api',_0x93495b=_0x4a49f4?_0x4a49f4+'-client':'client',_0x13d37f=formatDataset(_0x466fc1),_0x50b8d5={};_0x13d37f[_0x2e7925(0x19f)](_0x3aa9f6=>{const _0x551fcc=_0x2e7925,_0x46ade2=_0x3aa9f6[_0x551fcc(0x197)]['replace'](/Api$/,''),_0x2d3bee=_0x46ade2[_0x551fcc(0x1b4)](0x0)[_0x551fcc(0x1bc)]()+_0x46ade2[_0x551fcc(0x1ab)](0x1);_0x50b8d5[_0x2d3bee]={'tableName':_0x3aa9f6[_0x551fcc(0x1bb)],'datasetCode':_0x3aa9f6[_0x551fcc(0x1b7)],'name':_0x3aa9f6[_0x551fcc(0x1c1)]||''};});const _0x2bd806=fileURLToPath(import.meta[_0x2e7925(0x1b9)]),_0x5d3edb=a8_0x52c6d3['resolve'](a8_0x52c6d3[_0x2e7925(0x1aa)](_0x2bd806),_0x2e7925(0x1a3)),_0x5affc4=a8_0x52c6d3['join'](_0x5d3edb,_0x2e7925(0x19b)),_0x446503=a8_0x52c6d3[_0x2e7925(0x1ac)](_0x5affc4,_0x2e7925(0x199)),_0xcd9d45=a8_0x52c6d3[_0x2e7925(0x1ac)](_0x5affc4,'client.ts.tpl'),_0x2cde98=_0x5adc4a[_0x2e7925(0x1a1)]('/')?_0x5adc4a[_0x2e7925(0x1ab)](0x0,-0x1):_0x5adc4a;mkdirSync(_0x2cde98,{'recursive':!![]});const _0x25f7a5=readFileSync(_0x446503,'utf8'),_0x373567=TemplateReplacer['replaceApiContent'](_0x25f7a5,_0x4baa3f,_0x50b8d5,Object[_0x2e7925(0x1a6)](_0x50b8d5)[0x0],_0x14d821,_0x4b8862),_0x34c859=await a8_0x260d0f[_0x2e7925(0x1a8)](_0x373567,{'parser':_0x2e7925(0x1b5)}),_0x1e5be3=_0x2cde98+'/'+_0x14d821+_0x2e7925(0x1ae);writeFileSync(_0x1e5be3,_0x34c859,{'encoding':'utf8'});const _0x34d673=readFileSync(_0xcd9d45,_0x2e7925(0x19e)),_0x21e960=TemplateReplacer[_0x2e7925(0x1a7)](_0x34d673,_0x4baa3f,_0x50b8d5,Object['keys'](_0x50b8d5)[0x0],_0x14d821,_0x4b8862,_0x39eb29),_0x4931ff=await a8_0x260d0f[_0x2e7925(0x1a8)](_0x21e960,{'parser':_0x2e7925(0x1b5)}),_0x1c8979=_0x2cde98+'/'+_0x93495b+_0x2e7925(0x1ae);writeFileSync(_0x1c8979,_0x4931ff,{'encoding':_0x2e7925(0x19e)});const _0x4a2633=Object['keys'](_0x50b8d5)[_0x2e7925(0x198)];return logger[_0x2e7925(0x1a0)](_0x2e7925(0x1b3),'API\x20文件生成成功!',undefined,{'apiFile':_0x1e5be3,'clientFile':_0x1c8979,'modelCount':_0x4a2633,'configName':_0x4b8862}),{'modelCount':_0x4a2633,'apiFilePath':_0x1e5be3,'clientFilePath':_0x1c8979,'configName':_0x4b8862};}
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(_0x30af35,_0x27d078){const _0x4d03c5=a9_0x1df3,_0x164865=_0x30af35();while(!![]){try{const _0x4b188c=parseInt(_0x4d03c5(0x107))/0x1+-parseInt(_0x4d03c5(0x10a))/0x2+-parseInt(_0x4d03c5(0x11b))/0x3+parseInt(_0x4d03c5(0x11a))/0x4*(-parseInt(_0x4d03c5(0x103))/0x5)+parseInt(_0x4d03c5(0x121))/0x6*(-parseInt(_0x4d03c5(0x117))/0x7)+parseInt(_0x4d03c5(0x102))/0x8+-parseInt(_0x4d03c5(0x109))/0x9*(-parseInt(_0x4d03c5(0x115))/0xa);if(_0x4b188c===_0x27d078)break;else _0x164865['push'](_0x164865['shift']());}catch(_0xb092c0){_0x164865['push'](_0x164865['shift']());}}}(a9_0x28e8,0xbaebd));import{jsx as a9_0x1c5ab5}from'react/jsx-runtime';import{render}from'ink';function a9_0x28e8(){const _0x318ab6=['\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','flags','exit','165090lBUVMN','error','154etXFza','请使用\x20--appcode\x20参数,例如:','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','2044024OqBLNc','3301200JrdxKf','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','string','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','input','114876oUCAPh','help','❌\x20错误:不再支持位置参数方式','log','\x1b[90m*\x20使用配置的应用AppCode:\x20','\x1b[0m','6301336HtvgxJ','5ovFtuo','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','env','\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','406362mZsZQZ','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','1206UGxwhj','1215976kndAWm','appcode','\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文档','output','!\x20请使用以下方式之一:','×\x20未配置\x20AppCode','doc'];a9_0x28e8=function(){return _0x318ab6;};return a9_0x28e8();}import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';function a9_0x1df3(_0x475950,_0x38ecb7){const _0x28e854=a9_0x28e8();return a9_0x1df3=function(_0x1df360,_0x126a63){_0x1df360=_0x1df360-0x101;let _0x43d308=_0x28e854[_0x1df360];return _0x43d308;},a9_0x1df3(_0x475950,_0x38ecb7);}export async function apiCli(_0x46a812){const _0x31f45d=a9_0x1df3,_0x533436=_0x46a812[_0x31f45d(0x120)][0x1];if(_0x46a812[_0x31f45d(0x113)][_0x31f45d(0x122)]){console['log'](_0x31f45d(0x106));return;}if(_0x533436==='pull'){_0x46a812[_0x31f45d(0x120)][0x2]&&(console[_0x31f45d(0x116)](_0x31f45d(0x123)),console['log'](_0x31f45d(0x118)),console[_0x31f45d(0x124)](_0x31f45d(0x119)+_0x46a812[_0x31f45d(0x120)][0x2]),process[_0x31f45d(0x114)](0x1));const _0x4d6f93=getConfigAppCode();let _0x2b445d=_0x46a812[_0x31f45d(0x113)][_0x31f45d(0x10b)];const _0x18cc6d=typeof _0x46a812[_0x31f45d(0x113)]['env']===_0x31f45d(0x11e)?_0x46a812['flags']['env']:undefined,_0x23d383=_0x46a812['flags'][_0x31f45d(0x10d)];!_0x2b445d&&!_0x4d6f93&&(console[_0x31f45d(0x116)](_0x31f45d(0x10f)),console[_0x31f45d(0x124)](_0x31f45d(0x10e)),console[_0x31f45d(0x124)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console['log'](_0x31f45d(0x108)),process[_0x31f45d(0x114)](0x1)),_0x2b445d&&_0x4d6f93&&_0x2b445d===_0x4d6f93&&(console[_0x31f45d(0x124)](_0x31f45d(0x125)+_0x2b445d+_0x31f45d(0x101)),console['log'](_0x31f45d(0x11d)),_0x2b445d=undefined),render(a9_0x1c5ab5(ApiPullUI,{'appCode':_0x2b445d,'env':_0x18cc6d,'output':_0x23d383}));}else{if(_0x533436===_0x31f45d(0x110)){_0x46a812[_0x31f45d(0x120)][0x2]&&(console[_0x31f45d(0x116)](_0x31f45d(0x123)),console[_0x31f45d(0x124)](_0x31f45d(0x118)),console[_0x31f45d(0x124)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20'+_0x46a812[_0x31f45d(0x120)][0x2]),process[_0x31f45d(0x114)](0x1));const _0x24dd74=getConfigAppCode();let _0x471ec1=_0x46a812[_0x31f45d(0x113)][_0x31f45d(0x10b)];const _0x18c1fb=typeof _0x46a812[_0x31f45d(0x113)]['env']===_0x31f45d(0x11e)?_0x46a812[_0x31f45d(0x113)][_0x31f45d(0x105)]:undefined,_0x3d6aaf=_0x46a812[_0x31f45d(0x113)]['output'];!_0x471ec1&&!_0x24dd74&&(console[_0x31f45d(0x116)](_0x31f45d(0x10f)),console[_0x31f45d(0x124)](_0x31f45d(0x10e)),console[_0x31f45d(0x124)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x31f45d(0x124)]('\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>'),process['exit'](0x1)),_0x471ec1&&_0x24dd74&&_0x471ec1===_0x24dd74&&(console[_0x31f45d(0x124)](_0x31f45d(0x125)+_0x471ec1+_0x31f45d(0x101)),_0x471ec1=undefined),render(a9_0x1c5ab5(ApiDocUI,{'appCode':_0x471ec1,'env':_0x18c1fb,'output':_0x3d6aaf}));}else console[_0x31f45d(0x116)]('Unknown\x20api\x20command:\x20'+_0x533436),console[_0x31f45d(0x124)]('Available\x20commands:'),console['log']('\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配置文件'),console[_0x31f45d(0x124)](_0x31f45d(0x111)),console[_0x31f45d(0x124)](_0x31f45d(0x11c)),console[_0x31f45d(0x124)](_0x31f45d(0x112)),console['log'](''),console['log'](_0x31f45d(0x10c)),console[_0x31f45d(0x124)](_0x31f45d(0x11f)),console[_0x31f45d(0x124)](_0x31f45d(0x104)),console[_0x31f45d(0x124)]('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process[_0x31f45d(0x114)](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(_0x46e021,_0x5dcebe){const _0x277721=a10_0x4b82,_0x3add8f=_0x46e021();while(!![]){try{const _0x448b99=-parseInt(_0x277721(0xc9))/0x1+parseInt(_0x277721(0xd1))/0x2*(parseInt(_0x277721(0xd5))/0x3)+parseInt(_0x277721(0xd8))/0x4*(parseInt(_0x277721(0xc2))/0x5)+parseInt(_0x277721(0xc1))/0x6+-parseInt(_0x277721(0xc4))/0x7*(-parseInt(_0x277721(0xcc))/0x8)+-parseInt(_0x277721(0xe1))/0x9*(-parseInt(_0x277721(0xcf))/0xa)+parseInt(_0x277721(0xdf))/0xb;if(_0x448b99===_0x5dcebe)break;else _0x3add8f['push'](_0x3add8f['shift']());}catch(_0x331ed0){_0x3add8f['push'](_0x3add8f['shift']());}}}(a10_0x59dd,0xa54ca));function a10_0x59dd(){const _0x4b3feb=['*\x20开始生成\x20API\x20配置文件:','\x20个模型','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','未知错误','×\x20错误详情:','trim','api','\x20\x20\x20•\x20','data',',且无法读取错误响应内容','×\x20无法读取错误响应内容','643620qMXQjL','15YqGIPW','env','238gRZmjX','create-api-pull','text','\x20个数据集,生成\x20','&pageSize=999&currentPage=1','908827UlsvQE','×\x20服务器返回错误:','chdir','68968PWHaJK','tableData','\x20个数据集...','1910mwTrNp','status','4762NVpSXG','message','/smartapi/dataset/getList?appCode=','error','81HDLXCA','success','cwd','98008XjBRVr','API\x20配置拉取成功:\x20','url','获取数据集失败,HTTP状态码:\x20','modelCount','online','log','6110599WoZILi','client','23193kxjMPM','×\x20API\x20配置拉取异常:','√\x20成功拉取\x20','length'];a10_0x59dd=function(){return _0x4b3feb;};return a10_0x59dd();}import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a10_0x4b82(_0x136134,_0xac94c9){const _0x59dd6e=a10_0x59dd();return a10_0x4b82=function(_0x4b825c,_0x186200){_0x4b825c=_0x4b825c-0xb8;let _0x2791ac=_0x59dd6e[_0x4b825c];return _0x2791ac;},a10_0x4b82(_0x136134,_0xac94c9);}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(_0x1c9abb,_0x3f0a2f,_0x23ef78,_0x41775f){const _0xcbe406=a10_0x4b82;let _0x74638f;try{const _0x325fde=_0x3f0a2f?.[_0xcbe406(0xbb)]()||'';if(_0x325fde){const _0x3f68bd=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x3f68bd['test'](_0x325fde))return console['error'](_0xcbe406(0xb8)),![];}_0x23ef78&&(_0x74638f=process[_0xcbe406(0xd7)](),process[_0xcbe406(0xcb)](_0x23ef78));const _0x32d319=readConfig(),_0x4fd1e7=typeof _0x32d319[_0xcbe406(0xc3)]==='string'?_0x32d319[_0xcbe406(0xc3)]:undefined,_0x3cc284=_0x41775f||_0x4fd1e7||_0xcbe406(0xdd);initEnv(_0x3cc284),console[_0xcbe406(0xde)]('*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20'+_0x3cc284+')');const _0x1212fd=getApiDomain()+_0xcbe406(0xd3)+_0x1c9abb+_0xcbe406(0xc8),_0x258f4b=await httpRequest(_0x1212fd,{'headers':{'Cookie':getCookie()},'timeout':0xea60,'retries':0x2});if(_0x258f4b['ok']){const _0x25f923=_0x258f4b[_0xcbe406(0xbe)];if(_0x25f923[_0xcbe406(0xd6)]){const _0x47e209=_0x325fde?_0x325fde+'-api':_0xcbe406(0xbc),_0x259300=_0x325fde?_0x325fde+'-client':_0xcbe406(0xe0);console[_0xcbe406(0xde)](_0xcbe406(0xe5)),console[_0xcbe406(0xde)]('\x20\x20\x20•\x20'+_0x47e209+'.ts\x20-\x20模型配置文件'),console[_0xcbe406(0xde)](_0xcbe406(0xbd)+_0x259300+'.ts\x20-\x20客户端实例文件'),console[_0xcbe406(0xde)]('*\x20正在处理\x20'+_0x25f923[_0xcbe406(0xbe)]['tableData'][_0xcbe406(0xe4)]+_0xcbe406(0xce));const _0x195482=await generateApiFile(_0x25f923[_0xcbe406(0xbe)][_0xcbe406(0xcd)],_0x325fde,_0x1c9abb,!![],_0x3cc284);return console[_0xcbe406(0xde)](_0xcbe406(0xe3)+_0x25f923[_0xcbe406(0xbe)][_0xcbe406(0xcd)]['length']+_0xcbe406(0xc7)+_0x195482[_0xcbe406(0xdc)]+_0xcbe406(0xe6)),_0x23ef78&&logger['info']('create-api-pull',_0xcbe406(0xd9)+_0x1c9abb,{'projectPath':_0x23ef78,'appCode':_0x1c9abb,'datasetCount':_0x25f923[_0xcbe406(0xbe)][_0xcbe406(0xcd)][_0xcbe406(0xe4)],'filePrefix':_0x325fde}),!![];}else return console[_0xcbe406(0xd4)](_0xcbe406(0xca),_0x25f923[_0xcbe406(0xd2)]||_0xcbe406(0xb9)),_0x23ef78&&logger['error'](_0xcbe406(0xc5),'API\x20配置拉取失败:\x20'+(_0x25f923[_0xcbe406(0xd2)]||_0xcbe406(0xb9)),{'projectPath':_0x23ef78,'appCode':_0x1c9abb}),![];}else{if(_0x258f4b[_0xcbe406(0xd0)]===0x191){const _0x17edd0='获取数据集失败,原因:登录鉴权失败,登录已过期';console[_0xcbe406(0xd4)]('×\x20'+_0x17edd0),_0x23ef78&&logger[_0xcbe406(0xd4)](_0xcbe406(0xc5),_0x17edd0,{'status':_0x258f4b[_0xcbe406(0xd0)],'appCode':_0x1c9abb,'url':_0x258f4b[_0xcbe406(0xda)],'projectPath':_0x23ef78});}else{const _0x2032f6=_0xcbe406(0xdb)+_0x258f4b[_0xcbe406(0xd0)];console[_0xcbe406(0xd4)]('×\x20'+_0x2032f6);try{const _0x196505=await _0x258f4b[_0xcbe406(0xc6)]();_0x196505&&console['error'](_0xcbe406(0xba),_0x196505),_0x23ef78&&logger[_0xcbe406(0xd4)](_0xcbe406(0xc5),_0x2032f6,{'status':_0x258f4b['status'],'appCode':_0x1c9abb,'url':_0x258f4b[_0xcbe406(0xda)],'errorBody':_0x196505,'projectPath':_0x23ef78});}catch(_0xba9faf){console[_0xcbe406(0xd4)](_0xcbe406(0xc0)),_0x23ef78&&logger[_0xcbe406(0xd4)](_0xcbe406(0xc5),_0x2032f6+_0xcbe406(0xbf),{'status':_0x258f4b[_0xcbe406(0xd0)],'appCode':_0x1c9abb,'url':_0x258f4b[_0xcbe406(0xda)],'readError':_0xba9faf instanceof Error?_0xba9faf[_0xcbe406(0xd2)]:String(_0xba9faf),'projectPath':_0x23ef78});}}return![];}}catch(_0x5cd7ab){const _0x4eff89=_0x5cd7ab instanceof Error?_0x5cd7ab[_0xcbe406(0xd2)]:String(_0x5cd7ab);return console[_0xcbe406(0xd4)](_0xcbe406(0xe2),_0x4eff89),_0x23ef78&&logger[_0xcbe406(0xd4)](_0xcbe406(0xc5),'API\x20配置拉取异常:\x20'+_0x4eff89,{'appCode':_0x1c9abb,'projectPath':_0x23ef78}),![];}finally{_0x74638f&&process[_0xcbe406(0xcb)](_0x74638f);}}
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(_0x5a21f3,_0x210449){const _0x59ab94=a11_0x1da2,_0x145ada=_0x5a21f3();while(!![]){try{const _0xfef7a6=-parseInt(_0x59ab94(0x1b7))/0x1*(-parseInt(_0x59ab94(0x1a7))/0x2)+-parseInt(_0x59ab94(0x1b0))/0x3+parseInt(_0x59ab94(0x1a5))/0x4*(-parseInt(_0x59ab94(0x1bc))/0x5)+parseInt(_0x59ab94(0x1c2))/0x6+parseInt(_0x59ab94(0x1a2))/0x7+parseInt(_0x59ab94(0x1b3))/0x8*(-parseInt(_0x59ab94(0x1a3))/0x9)+-parseInt(_0x59ab94(0x1b5))/0xa;if(_0xfef7a6===_0x210449)break;else _0x145ada['push'](_0x145ada['shift']());}catch(_0x42ea81){_0x145ada['push'](_0x145ada['shift']());}}}(a11_0xd9ab,0x9ae9a));import{createInterface}from'node:readline/promises';function a11_0xd9ab(){const _0x11f9c4=['\x1b[0m','\x20\x20\x20•\x20','success','1998927YCsRYy','string','*\x20使用指定的应用AppCode:\x20','8424BFIglE','*\x20正在处理\x20','6563760DENXjt','×\x20提供的应用AppCode\x20\x22','82294fdDVPG','-api','tableData','test','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','120MMaAoG','stdin','env','!\x20请使用以下方式之一:','.ts\x20-\x20客户端实例文件','text','7358940NEjEQN','error','exit','length','url','\x22\x20无效','\x20\x20\x201.\x20直接指定:\x20lovrabet\x20api\x20pull\x20<app-code>','×\x20未提供应用AppCode,且配置中也没有默认值','×\x20错误详情:','*\x20开始生成\x20API\x20配置文件:','获取数据集失败,HTTP状态码:\x20','close','client','获取数据集失败,原因:登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录后再尝试','.ts\x20-\x20模型配置文件','json','654444Hkpecs','1809mYOxZS','question','36824fTJZRU','message','26OGedyT','&pageSize=999&currentPage=1','api-pull','log','status','api'];a11_0xd9ab=function(){return _0x11f9c4;};return a11_0xd9ab();}import{readConfig}from'../utils/config.js';function a11_0x1da2(_0x2aad57,_0x3ea0b0){const _0xd9abbc=a11_0xd9ab();return a11_0x1da2=function(_0x1da27b,_0x2d9578){_0x1da27b=_0x1da27b-0x19f;let _0xe0d01f=_0xd9abbc[_0x1da27b];return _0xe0d01f;},a11_0x1da2(_0x2aad57,_0x3ea0b0);}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';import{logger}from'../utils/logger.js';export async function initApi(_0x26081a,_0x3d4d98){const _0x3055f3=a11_0x1da2,_0x2e0e99=readConfig(),_0x5c3bfd=_0x26081a||_0x2e0e99?.['app'],_0x6db771=typeof _0x2e0e99[_0x3055f3(0x1be)]===_0x3055f3(0x1b1)?_0x2e0e99[_0x3055f3(0x1be)]:undefined,_0x3dafef=_0x3d4d98||_0x6db771||'online';initEnv(_0x3dafef);(typeof _0x5c3bfd!==_0x3055f3(0x1b1)||!_0x5c3bfd)&&(_0x26081a?console[_0x3055f3(0x1c3)](_0x3055f3(0x1b6)+_0x26081a+_0x3055f3(0x1c7)):(console['error'](_0x3055f3(0x1c9)),console[_0x3055f3(0x1aa)](_0x3055f3(0x1bf)),console['log'](_0x3055f3(0x1c8)),console[_0x3055f3(0x1aa)]('\x20\x20\x202.\x20配置默认值:\x20lovrabet\x20config\x20set\x20app\x20<app-code>')),process[_0x3055f3(0x1c4)](0x1));_0x26081a?console[_0x3055f3(0x1aa)](_0x3055f3(0x1b2)+_0x5c3bfd):console[_0x3055f3(0x1aa)]('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0x5c3bfd+_0x3055f3(0x1ad));const _0x48f898=createInterface({'input':process[_0x3055f3(0x1bd)],'output':process['stdout']});let _0x343f02;try{const _0x44c410=await _0x48f898[_0x3055f3(0x1a4)]('!\x20请输入文件前缀\x20\x1b[90m[留空表示无前缀]\x1b[0m:\x20');_0x343f02=_0x44c410['trim']();if(_0x343f02){const _0x10fcc2=/^[a-zA-Z][a-zA-Z0-9_-]*$/;!_0x10fcc2[_0x3055f3(0x1ba)](_0x343f02)&&(console[_0x3055f3(0x1c3)](_0x3055f3(0x1bb)),process['exit'](0x1));}}finally{_0x48f898[_0x3055f3(0x1cd)]();}console[_0x3055f3(0x1aa)]('\x0a*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20'+_0x3dafef+')');const _0x5a5438=await fetch(getApiDomain()+'/smartapi/dataset/getList?appCode='+_0x5c3bfd+_0x3055f3(0x1a8),{'headers':{'Cookie':getCookie()}});if(_0x5a5438['ok']){const _0x9808d0=await _0x5a5438[_0x3055f3(0x1a1)]();if(_0x9808d0[_0x3055f3(0x1af)]){const _0x222833=_0x343f02?_0x343f02+_0x3055f3(0x1b8):_0x3055f3(0x1ac),_0x3919af=_0x343f02?_0x343f02+'-client':_0x3055f3(0x1ce);console['log'](_0x3055f3(0x1cb)),console[_0x3055f3(0x1aa)]('\x20\x20\x20•\x20'+_0x222833+_0x3055f3(0x1a0)),console[_0x3055f3(0x1aa)](_0x3055f3(0x1ae)+_0x3919af+_0x3055f3(0x1c0)),console[_0x3055f3(0x1aa)](_0x3055f3(0x1b4)+_0x9808d0['data'][_0x3055f3(0x1b9)][_0x3055f3(0x1c5)]+'\x20个数据集...');const _0x1e104e=!_0x26081a;await generateApiFile(_0x9808d0['data'][_0x3055f3(0x1b9)],_0x343f02,_0x5c3bfd,_0x1e104e,_0x3dafef);}}else{if(_0x5a5438[_0x3055f3(0x1ab)]===0x191){const _0x2e08c8=_0x3055f3(0x19f);console['error']('×\x20'+_0x2e08c8),logger['error'](_0x3055f3(0x1a9),_0x2e08c8,{'status':_0x5a5438[_0x3055f3(0x1ab)],'appCode':_0x5c3bfd,'url':_0x5a5438[_0x3055f3(0x1c6)]});}else{const _0x32bdab=_0x3055f3(0x1cc)+_0x5a5438[_0x3055f3(0x1ab)];console[_0x3055f3(0x1c3)]('×\x20'+_0x32bdab);try{const _0x38c9f8=await _0x5a5438[_0x3055f3(0x1c1)]();_0x38c9f8?(console[_0x3055f3(0x1c3)](_0x3055f3(0x1ca),_0x38c9f8),logger[_0x3055f3(0x1c3)]('api-pull',_0x32bdab,{'status':_0x5a5438[_0x3055f3(0x1ab)],'appCode':_0x5c3bfd,'url':_0x5a5438[_0x3055f3(0x1c6)],'errorBody':_0x38c9f8})):logger['error'](_0x3055f3(0x1a9),_0x32bdab,{'status':_0x5a5438[_0x3055f3(0x1ab)],'appCode':_0x5c3bfd,'url':_0x5a5438[_0x3055f3(0x1c6)]});}catch(_0xe158b1){console[_0x3055f3(0x1c3)]('×\x20无法读取错误响应内容'),logger['error'](_0x3055f3(0x1a9),_0x32bdab+',且无法读取错误响应内容',{'status':_0x5a5438[_0x3055f3(0x1ab)],'appCode':_0x5c3bfd,'url':_0x5a5438[_0x3055f3(0x1c6)],'readError':_0xe158b1 instanceof Error?_0xe158b1[_0x3055f3(0x1a6)]:String(_0xe158b1)});}}process['exit'](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(_0x3ce078,_0x1622af){const _0x3b6e31=a13_0x2de5,_0x57202a=_0x3ce078();while(!![]){try{const _0x2cfb86=-parseInt(_0x3b6e31(0x71))/0x1*(-parseInt(_0x3b6e31(0x7c))/0x2)+-parseInt(_0x3b6e31(0x83))/0x3*(parseInt(_0x3b6e31(0x80))/0x4)+-parseInt(_0x3b6e31(0x84))/0x5+-parseInt(_0x3b6e31(0x77))/0x6+-parseInt(_0x3b6e31(0x76))/0x7+parseInt(_0x3b6e31(0x72))/0x8*(parseInt(_0x3b6e31(0x75))/0x9)+parseInt(_0x3b6e31(0x7a))/0xa*(parseInt(_0x3b6e31(0x78))/0xb);if(_0x2cfb86===_0x1622af)break;else _0x57202a['push'](_0x57202a['shift']());}catch(_0x3f53bd){_0x57202a['push'](_0x57202a['shift']());}}}(a13_0x3008,0x7ea75));import{jsx as a13_0x4ed4ba,jsxs as a13_0x3b634f}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 a13_0x4e274b from'ink-spinner';function a13_0x2de5(_0x36af0f,_0x5871c7){const _0x30080d=a13_0x3008();return a13_0x2de5=function(_0x2de50f,_0x4fe6ea){_0x2de50f=_0x2de50f-0x70;let _0x11dd94=_0x30080d[_0x2de50f];return _0x11dd94;},a13_0x2de5(_0x36af0f,_0x5871c7);}export function AuthServer(){const _0x5487fc=a13_0x2de5,{exit:_0x5a9adb}=useApp(),[_0x50c341,_0x486dbd]=useState(![]),[_0x570bf2,_0x4faaad]=useState(!![]),[_0x585510,_0x225311]=useState(![]),[_0x4a219d,_0x4afc83]=useState(![]);useEffect(()=>{const _0x41b2e1=a13_0x2de5;getIsSessionValid()[_0x41b2e1(0x73)](_0x486dbd)[_0x41b2e1(0x7d)](()=>_0x4faaad(![]));},[]),useEffect(()=>{!_0x570bf2&&_0x50c341&&(console['log']('√\x20当前为有效会话,无需重新登录。'),_0x5a9adb());},[_0x570bf2,_0x50c341,_0x5a9adb]),useEffect(()=>{const _0x1a19f2=a13_0x2de5;_0x4a219d&&(console[_0x1a19f2(0x7e)]('*\x20登录成功!'),_0x5a9adb());},[_0x4a219d,_0x5a9adb]),useInput((_0x1945c6,_0x498531)=>{const _0x147832=a13_0x2de5;_0x498531['return']&&(_0x225311(!![]),authServer({'silent':!![]})[_0x147832(0x73)](_0x5484b5=>{_0x4afc83(_0x5484b5);})),_0x1945c6==='q'&&_0x5a9adb();});if(_0x570bf2)return null;if(_0x50c341||_0x4a219d)return null;return a13_0x4ed4ba(Box,{'flexDirection':_0x5487fc(0x82),'marginTop':0x1,'marginBottom':0x1,'children':_0x585510?a13_0x3b634f(Box,{'children':[a13_0x4ed4ba(Box,{'width':'1'}),a13_0x3b634f(Text,{'color':_0x5487fc(0x79),'children':[a13_0x4ed4ba(a13_0x4e274b,{'type':'dots'}),'\x20\x20']}),a13_0x4ed4ba(Text,{'children':_0x5487fc(0x81)}),a13_0x4ed4ba(Text,{'color':_0x5487fc(0x70),'children':_0x5487fc(0x74)})]}):a13_0x3b634f(Box,{'children':[a13_0x4ed4ba(Box,{'width':'1'}),a13_0x4ed4ba(Text,{'children':_0x5487fc(0x7b)}),a13_0x4ed4ba(Text,{'color':_0x5487fc(0x70),'children':_0x5487fc(0x7f)})]})});}function a13_0x3008(){const _0x3ee38d=['9914460cbyBWU','*\x20按回车开始登录。','463262qNgGdV','finally','log','按\x20“q”\x20退出。','90296dgvljR','正在登录...\x20','column','54LaFqRB','4341420JMUsoi','gray','1cvYsOl','280thXlxS','then','请前往浏览器完成登录。','117027SVqBPK','5950805MZqNAi','156744XXbfYD','22QbzLJi','green'];a13_0x3008=function(){return _0x3ee38d;};return a13_0x3008();}