@lovrabet/cli 1.2.3 → 1.2.5-beta.1

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 (89) hide show
  1. package/README.md +33 -17
  2. package/lib/add-page/input-page-router.js +1 -1
  3. package/lib/add-page/main.js +1 -1
  4. package/lib/add-page/select-page-template.js +1 -1
  5. package/lib/api/api-doc-ui.js +1 -1
  6. package/lib/api/api-doc.js +1 -1
  7. package/lib/api/api-pull-ui.js +1 -1
  8. package/lib/api/fetch-model-list.js +1 -1
  9. package/lib/api/generate-api-file.js +1 -1
  10. package/lib/api/main.js +1 -1
  11. package/lib/api/pull-silent.js +1 -1
  12. package/lib/app-menu/app-menu-sync-ui.js +1 -1
  13. package/lib/app-menu/create-menu.js +1 -1
  14. package/lib/app-menu/get-local-pages.js +1 -1
  15. package/lib/app-menu/get-online-menu-list.js +1 -1
  16. package/lib/app-menu/use-get-online-menu-list.js +1 -1
  17. package/lib/app-menu/utils.js +1 -1
  18. package/lib/app-menu/valid-url.js +1 -1
  19. package/lib/app-menu-update-cdn/current-content.js +1 -1
  20. package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
  21. package/lib/app-menu-update-cdn/main.js +1 -1
  22. package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
  23. package/lib/auth/auth-server-ui.js +1 -1
  24. package/lib/auth/auth-server.js +1 -1
  25. package/lib/auth/constant.js +1 -1
  26. package/lib/auth/get-cookie.js +1 -1
  27. package/lib/auth/is-session-valid.js +1 -1
  28. package/lib/auth/logout.js +1 -1
  29. package/lib/cli.js +1 -1
  30. package/lib/cmd/build-watch.js +1 -1
  31. package/lib/cmd/build.js +1 -1
  32. package/lib/cmd/logs.js +1 -1
  33. package/lib/cmd/preview.js +1 -1
  34. package/lib/cmd/start.js +1 -1
  35. package/lib/config/config-help.js +1 -1
  36. package/lib/config/main.js +1 -1
  37. package/lib/constant/domain.js +1 -1
  38. package/lib/constant/env.js +1 -1
  39. package/lib/create-app/enhanced-guided-create.js +1 -1
  40. package/lib/create-app/format-elapsed.js +1 -1
  41. package/lib/create-app/main.js +1 -1
  42. package/lib/create-app/task-finished.js +1 -1
  43. package/lib/create-app/task-loading.js +1 -1
  44. package/lib/create-app/task-running.js +1 -1
  45. package/lib/create-app/task-time.js +1 -1
  46. package/lib/create-app/use-copy-project-template.js +1 -1
  47. package/lib/create-app/use-format-code.js +1 -1
  48. package/lib/create-app/use-install-dependencies.js +1 -1
  49. package/lib/help.js +1 -1
  50. package/lib/init/main.js +1 -1
  51. package/lib/mcp/claude.js +1 -0
  52. package/lib/mcp/cursor.js +1 -1
  53. package/lib/mcp/main.js +1 -1
  54. package/lib/skills/main.js +1 -0
  55. package/lib/utils/check-sdk-version.js +1 -1
  56. package/lib/utils/config.js +1 -1
  57. package/lib/utils/copy-directory.js +1 -1
  58. package/lib/utils/http-client.js +1 -1
  59. package/lib/utils/logger.js +1 -1
  60. package/lib/utils/router-updater.js +1 -1
  61. package/lib/utils/sleep.js +1 -1
  62. package/lib/utils/template-replacer.js +1 -1
  63. package/package.json +1 -1
  64. package/templates/projects/sub-app-react-demo/index.html +22 -34
  65. package/templates/projects/sub-app-react-demo/public/logo.svg +1 -0
  66. package/templates/projects/sub-app-react-demo/src/api/api.ts +1 -1
  67. package/templates/projects/sub-app-react-demo/src/api/client.ts +1 -1
  68. package/templates/projects/sub-app-react-demo/src/layouts/MainLayout.tsx +44 -71
  69. package/templates/projects/sub-app-react-demo/src/pages/index.tsx +387 -927
  70. package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +1 -1
  71. package/templates/projects/sub-app-react-demo/src/pages/workbench/index.module.css +293 -0
  72. package/templates/projects/sub-app-react-demo/src/pages/workbench/index.tsx +100 -414
  73. package/templates/projects/sub-app-react-demo/src/style.css +21 -15
  74. package/templates/projects/sub-app-react-demo/vite.config.ts +18 -13
  75. package/templates/rules/lovrabet_rules.mdc.tpl +636 -43
  76. package/templates/skills/.claude/skills/lovrabet/SKILL.md +257 -0
  77. package/templates/skills/.cursor/commands/lovrabet.md +247 -0
  78. package/templates/skills/.cursorrules +109 -0
  79. package/templates/skills/.shared/README.md +45 -0
  80. package/templates/skills/.shared/guides/01-filter-query/guide.md +300 -0
  81. package/templates/skills/.shared/guides/02-mcp-sql-workflow/guide.md +272 -0
  82. package/templates/skills/.shared/guides/03-antd-style/guide.md +227 -0
  83. package/templates/skills/.shared/guides/04-troubleshooting/guide.md +426 -0
  84. package/templates/skills/.shared/guides/05-api-integration/guide.md +327 -0
  85. package/templates/skills/.shared/guides/06-menu-management/guide.md +305 -0
  86. package/templates/skills/.windsurf/workflows/lovrabet.md +256 -0
  87. package/templates/projects/sub-app-react-demo/.vscode/extensions.json +0 -3
  88. package/templates/projects/sub-app-react-demo/.vscode/settings.json +0 -57
  89. package/templates/projects/sub-app-react-demo/src/pages/intro/index.tsx +0 -560
package/README.md CHANGED
@@ -235,29 +235,45 @@ your-project/
235
235
  ├── package.json # 项目配置
236
236
  ├── vite.config.ts # 构建配置
237
237
  ├── tsconfig.json # TypeScript 配置
238
- └── lovrabet.config.js # Lovrabet 配置
238
+ └── .lovrabetrc # Lovrabet CLI 配置
239
239
  ```
240
240
 
241
241
  ## ⚙️ 配置文件
242
242
 
243
- ### `lovrabet.config.js`
244
-
245
- 项目根目录的配置文件,用于配置应用信息和 API:
246
-
247
- ```javascript
248
- module.exports = {
249
- appCode: "your-app-code",
250
- env: "online", // 或 "daily"
251
- models: {
252
- Users: {
253
- tableName: "users",
254
- datasetCode: "your-dataset-code",
255
- },
256
- // 更多模型配置...
257
- },
258
- };
243
+ ### `.lovrabetrc`
244
+
245
+ 项目根目录的配置文件(JSON 格式),用于配置应用基本信息:
246
+
247
+ ```json
248
+ {
249
+ "appcode": "your-app-code",
250
+ "env": "online",
251
+ "createdAt": "2025/1/5 10:30:00",
252
+ "version": "1.1.15"
253
+ }
254
+ ```
255
+
256
+ **配置说明:**
257
+
258
+ | 字段 | 说明 | 可选值 |
259
+ |------|------|--------|
260
+ | `appcode` | 应用代码,用于标识您的应用 | 字母、数字、`-` 和 `_` |
261
+ | `env` | 运行环境 | `"online"` 或 `"daily"` |
262
+ | `createdAt` | 配置创建时间(自动生成) | - |
263
+ | `version` | CLI 版本(自动生成) | - |
264
+
265
+ **生成方式:**
266
+
267
+ ```bash
268
+ # 通过 init 命令生成
269
+ lovrabet init --appcode your-app-code
270
+
271
+ # 或通过 create 命令自动生成
272
+ lovrabet create
259
273
  ```
260
274
 
275
+ > 💡 **注意**:`.lovrabetrc` 是 CLI 工具的配置文件。SDK 的 API 配置(models)由 `lovrabet api pull` 命令自动生成到 `src/api/` 目录。
276
+
261
277
  ## 🔧 环境要求
262
278
 
263
279
  - **Node.js**: >= 20.0.0
@@ -1 +1 @@
1
- (function(_0x20693c,_0x2eb089){const _0x5a4ec8=a0_0x48fb,_0x24fc86=_0x20693c();while(!![]){try{const _0x59195b=parseInt(_0x5a4ec8(0xc5))/0x1+parseInt(_0x5a4ec8(0xbe))/0x2+-parseInt(_0x5a4ec8(0xb8))/0x3+-parseInt(_0x5a4ec8(0xb3))/0x4*(parseInt(_0x5a4ec8(0xb0))/0x5)+parseInt(_0x5a4ec8(0xac))/0x6+-parseInt(_0x5a4ec8(0xc6))/0x7+parseInt(_0x5a4ec8(0xc1))/0x8*(parseInt(_0x5a4ec8(0xae))/0x9);if(_0x59195b===_0x2eb089)break;else _0x24fc86['push'](_0x24fc86['shift']());}catch(_0x4b9f2c){_0x24fc86['push'](_0x24fc86['shift']());}}}(a0_0x126b,0xc9744));import{jsx as a0_0x5031ed,jsxs as a0_0x2cd054}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x3a2438 from'node:fs';function a0_0x48fb(_0x585e0e,_0x23ee2e){_0x585e0e=_0x585e0e-0xac;const _0x126b7f=a0_0x126b();let _0x48fb11=_0x126b7f[_0x585e0e];return _0x48fb11;}export function InputProjectCode(_0x1e4550){const _0x321873=a0_0x48fb,{onSubmit:_0x597fba,pagePath:_0x2c06c2}=_0x1e4550,[_0x36c228,_0x2e1c87]=useState(''),[_0x29ebdc,_0x364fbe]=useState(''),_0x2e907e=_0x321873(0xbb);function _0x5cf640(_0x220cf6){const _0x34dd2b=_0x321873;if(_0x220cf6[_0x34dd2b(0xc7)]>0x64)return{'valid':![],'message':_0x34dd2b(0xb4)};if(_0x220cf6[_0x34dd2b(0xc9)]('/')||_0x220cf6[_0x34dd2b(0xb6)]('/'))return{'valid':![],'message':'路径不能以\x20/\x20开头或结尾'};if(_0x220cf6[_0x34dd2b(0xbc)]('//'))return{'valid':![],'message':_0x34dd2b(0xaf)};const _0x52ce67=_0x220cf6['split']('/');for(const _0x546d88 of _0x52ce67){if(!_0x546d88)continue;const _0x4352dd=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x4352dd[_0x34dd2b(0xb2)](_0x546d88))return{'valid':![],'message':_0x34dd2b(0xc2)};}return{'valid':!![]};}return useInput((_0x449c5e,_0x1a07da)=>{const _0x351921=_0x321873;if(_0x1a07da[_0x351921(0xc0)]){const _0x145c45=_0x36c228[_0x351921(0xb9)]()||_0x2e907e;if(_0x29ebdc)return;const _0x29ef65=_0x2c06c2+'/'+_0x145c45;if(a0_0x3a2438[_0x351921(0xbd)](_0x29ef65)){_0x364fbe(_0x351921(0xc8)+_0x145c45+_0x351921(0xc3));return;}_0x597fba(_0x145c45),_0x2e1c87(''),_0x364fbe('');}else _0x1a07da[_0x351921(0xb7)]||_0x1a07da[_0x351921(0xad)]?_0x2e1c87(_0x5bfcb6=>{const _0x2bed01=_0x351921,_0x106677=_0x5bfcb6[_0x2bed01(0xcb)](0x0,-0x1),{valid:_0x42bbe6,message:_0x3fde34}=_0x5cf640(_0x106677);return _0x364fbe(_0x42bbe6?'':_0x3fde34||_0x2bed01(0xba)),_0x106677;}):_0x2e1c87(_0x1d13f1=>{const _0x2ce617=_0x1d13f1+_0x449c5e,{valid:_0x4add5f,message:_0x1b9800}=_0x5cf640(_0x2ce617);return _0x364fbe(_0x4add5f?'':_0x1b9800||'页面路径不合法'),_0x2ce617;});}),a0_0x2cd054(Box,{'flexDirection':'column','children':[a0_0x2cd054(Box,{'children':[a0_0x5031ed(Text,{'color':'gray','children':'\x20Step2:\x20'}),a0_0x5031ed(Text,{'children':_0x321873(0xb1)}),_0x36c228?a0_0x5031ed(Text,{'color':_0x321873(0xbf),'children':_0x36c228}):a0_0x5031ed(Text,{'color':_0x321873(0xca),'children':_0x2e907e}),_0x29ebdc&&a0_0x2cd054(Text,{'color':'red','children':[_0x321873(0xb5),_0x29ebdc]})]}),!_0x29ebdc&&!_0x36c228&&a0_0x5031ed(Box,{'children':a0_0x5031ed(Text,{'color':'gray','children':_0x321873(0xc4)})})]});}function a0_0x126b(){const _0x28b114=['backspace','3744879HWzLgX','trim','页面路径不合法','my-page','includes','existsSync','2098846YsVpAC','green','return','104yGZZrf','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','\x20已存在,请使用其他路径','\x20直接回车确认,或输入自定义路由地址','1101371yNbepQ','8997079KKStTk','length','页面路径\x20','startsWith','gray','slice','411198MLjdTF','delete','1592559ATbMcQ','路径不能包含连续的\x20/','725590YVfauP','页面路由地址:\x20','test','32HKQFqB','页面路径长度不能超过\x20100\x20个字符','\x20←\x20','endsWith'];a0_0x126b=function(){return _0x28b114;};return a0_0x126b();}
1
+ (function(_0x31c52c,_0x442cb2){const _0x15f8ef=a0_0x2d5f,_0x568e80=_0x31c52c();while(!![]){try{const _0x1c78ea=-parseInt(_0x15f8ef(0x99))/0x1*(parseInt(_0x15f8ef(0x91))/0x2)+parseInt(_0x15f8ef(0x90))/0x3+-parseInt(_0x15f8ef(0xa4))/0x4+-parseInt(_0x15f8ef(0xa1))/0x5+parseInt(_0x15f8ef(0x8e))/0x6+-parseInt(_0x15f8ef(0x8a))/0x7+-parseInt(_0x15f8ef(0xa7))/0x8*(-parseInt(_0x15f8ef(0x98))/0x9);if(_0x1c78ea===_0x442cb2)break;else _0x568e80['push'](_0x568e80['shift']());}catch(_0x481d04){_0x568e80['push'](_0x568e80['shift']());}}}(a0_0x39c9,0x350ce));function a0_0x2d5f(_0x1bfd4b,_0x57ee8b){_0x1bfd4b=_0x1bfd4b-0x89;const _0x39c9f6=a0_0x39c9();let _0x2d5f2a=_0x39c9f6[_0x1bfd4b];return _0x2d5f2a;}import{jsx as a0_0x43e64f,jsxs as a0_0x1813ed}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x1711aa from'node:fs';export function InputProjectCode(_0x19aba4){const _0xd80925=a0_0x2d5f,{onSubmit:_0x23143f,pagePath:_0x604d00}=_0x19aba4,[_0x9767fc,_0x567b1c]=useState(''),[_0x280996,_0xf78fd]=useState(''),_0x1b9289=_0xd80925(0x9b);function _0x17be88(_0x4ed20f){const _0x4bb894=_0xd80925;if(_0x4ed20f[_0x4bb894(0x8f)]>0x64)return{'valid':![],'message':_0x4bb894(0xa0)};if(_0x4ed20f[_0x4bb894(0x97)]('/')||_0x4ed20f[_0x4bb894(0xa5)]('/'))return{'valid':![],'message':_0x4bb894(0xa2)};if(_0x4ed20f[_0x4bb894(0x8c)]('//'))return{'valid':![],'message':'路径不能包含连续的\x20/'};const _0x150475=_0x4ed20f[_0x4bb894(0x93)]('/');for(const _0x3dc8de of _0x150475){if(!_0x3dc8de)continue;const _0x5360cf=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x5360cf[_0x4bb894(0x8d)](_0x3dc8de))return{'valid':![],'message':_0x4bb894(0x96)};}return{'valid':!![]};}return useInput((_0x28e5e8,_0xd6db44)=>{const _0x2e6e8e=_0xd80925;if(_0xd6db44['return']){const _0x201156=_0x9767fc['trim']()||_0x1b9289;if(_0x280996)return;const _0x371598=_0x604d00+'/'+_0x201156;if(a0_0x1711aa[_0x2e6e8e(0x89)](_0x371598)){_0xf78fd(_0x2e6e8e(0x9f)+_0x201156+'\x20已存在,请使用其他路径');return;}_0x23143f(_0x201156),_0x567b1c(''),_0xf78fd('');}else _0xd6db44['backspace']||_0xd6db44[_0x2e6e8e(0x9e)]?_0x567b1c(_0x3795a5=>{const _0x4e9885=_0x2e6e8e,_0xde7b=_0x3795a5[_0x4e9885(0x9a)](0x0,-0x1),{valid:_0x3a956b,message:_0x5752e6}=_0x17be88(_0xde7b);return _0xf78fd(_0x3a956b?'':_0x5752e6||_0x4e9885(0xa6)),_0xde7b;}):_0x567b1c(_0x44cd94=>{const _0x293d26=_0x44cd94+_0x28e5e8,{valid:_0x29d66f,message:_0x5a617b}=_0x17be88(_0x293d26);return _0xf78fd(_0x29d66f?'':_0x5a617b||'页面路径不合法'),_0x293d26;});}),a0_0x1813ed(Box,{'flexDirection':_0xd80925(0x9c),'children':[a0_0x1813ed(Box,{'children':[a0_0x43e64f(Text,{'color':'gray','children':_0xd80925(0x92)}),a0_0x43e64f(Text,{'children':_0xd80925(0x8b)}),_0x9767fc?a0_0x43e64f(Text,{'color':_0xd80925(0x95),'children':_0x9767fc}):a0_0x43e64f(Text,{'color':_0xd80925(0xa3),'children':_0x1b9289}),_0x280996&&a0_0x1813ed(Text,{'color':_0xd80925(0x94),'children':[_0xd80925(0x9d),_0x280996]})]}),!_0x280996&&!_0x9767fc&&a0_0x43e64f(Box,{'children':a0_0x43e64f(Text,{'color':'gray','children':'\x20直接回车确认,或输入自定义路由地址'})})]});}function a0_0x39c9(){const _0x4070e5=['existsSync','1129065auZnLX','页面路由地址:\x20','includes','test','1034004OvOkwq','length','1001460VlkUci','10MvFaep','\x20Step2:\x20','split','red','green','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','startsWith','531ySBRND','67323rXASfi','slice','my-page','column','\x20←\x20','delete','页面路径\x20','页面路径长度不能超过\x20100\x20个字符','1069240BrnBJx','路径不能以\x20/\x20开头或结尾','gray','631592BaWjNZ','endsWith','页面路径不合法','78752qjFerQ'];a0_0x39c9=function(){return _0x4070e5;};return a0_0x39c9();}
@@ -1 +1 @@
1
- const a1_0x26742a=a1_0x5e12;(function(_0xfc64f6,_0x5a9c5b){const _0x55af79=a1_0x5e12,_0x29b3c1=_0xfc64f6();while(!![]){try{const _0x3a524b=-parseInt(_0x55af79(0xe7))/0x1*(parseInt(_0x55af79(0xe9))/0x2)+parseInt(_0x55af79(0xed))/0x3+-parseInt(_0x55af79(0xf9))/0x4+-parseInt(_0x55af79(0xfd))/0x5*(parseInt(_0x55af79(0xf0))/0x6)+parseInt(_0x55af79(0xf3))/0x7+parseInt(_0x55af79(0xe5))/0x8+parseInt(_0x55af79(0xf1))/0x9;if(_0x3a524b===_0x5a9c5b)break;else _0x29b3c1['push'](_0x29b3c1['shift']());}catch(_0x4a0db8){_0x29b3c1['push'](_0x29b3c1['shift']());}}}(a1_0x30e9,0x9f7a4));function a1_0x5e12(_0x540e6c,_0x51fef3){_0x540e6c=_0x540e6c-0xdd;const _0x30e9d3=a1_0x30e9();let _0x5e127c=_0x30e9d3[_0x540e6c];return _0x5e127c;}import{jsx as a1_0x2b6d69,jsxs as a1_0x2c75c0,Fragment as a1_0x2a5c65}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x2c6168 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';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x2c6168['dirname'](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x2c6168['resolve'](__dirname,a1_0x26742a(0xe8)),projectDir=process['cwd']();export const AddPage=()=>{const _0x5e0dce=a1_0x26742a,{exit:_0x5bf6dc}=useApp(),[_0x1093dc,_0x293254]=useState(''),[_0xb4d079,_0x502d06]=useState(''),[_0x133c50,_0x3075c0]=useState(![]),[_0x2b826b,_0x15f9de]=useState(![]),_0x23ffa3=a1_0x2c6168['join'](projectDir,_0x5e0dce(0xec),_0x5e0dce(0xf5)),_0x4c81f5=a1_0x2c6168[_0x5e0dce(0xfb)](_0x23ffa3,_0xb4d079),_0x41ef7c=a1_0x2c6168[_0x5e0dce(0xfb)](_0x5e0dce(0xec),_0x5e0dce(0xf5),_0xb4d079);useEffect(()=>{const _0x46e56b=_0x5e0dce,_0x21644e=a1_0x2c6168[_0x46e56b(0xdd)](pageTemplateDir,_0x1093dc);if(_0x1093dc&&_0xb4d079){_0x3075c0(!![]),logger[_0x46e56b(0xe6)](process['cwd']());const _0x1883f7=Date[_0x46e56b(0xee)]();logger[_0x46e56b(0xe0)](_0x46e56b(0xf6),_0x46e56b(0xf8)+_0xb4d079,{'template':_0x1093dc,'targetPath':_0x41ef7c}),TemplateReplacer['processTemplate'](_0x21644e,a1_0x2c6168[_0x46e56b(0xfb)](_0x23ffa3,_0xb4d079),_0xb4d079,_0x1093dc)[_0x46e56b(0xfc)](()=>{const _0x4c7302=_0x46e56b,_0x2e72a7=Date[_0x4c7302(0xee)]()-_0x1883f7;logger['success'](_0x4c7302(0xf6),_0x4c7302(0xeb)+_0xb4d079,_0x2e72a7,{'template':_0x1093dc,'targetPath':_0x41ef7c,'routePath':_0xb4d079}),_0x15f9de(!![]);})[_0x46e56b(0xef)](_0x1e92c3=>{const _0x107b4e=_0x46e56b,_0x31c7a9=Date[_0x107b4e(0xee)]()-_0x1883f7;logger['error'](_0x107b4e(0xf6),'页面添加失败:\x20'+_0xb4d079,{'template':_0x1093dc,'targetPath':_0x41ef7c,'error':_0x1e92c3 instanceof Error?_0x1e92c3[_0x107b4e(0xf7)]:String(_0x1e92c3),'duration':_0x31c7a9});})[_0x46e56b(0xdf)](()=>{_0x3075c0(![]);});}},[_0x1093dc,_0xb4d079]),useEffect(()=>{_0x2b826b&&setTimeout(()=>{_0x5bf6dc();});},[_0x2b826b]);if(_0x1093dc)return a1_0x2c75c0(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x2c75c0(Box,{'children':[a1_0x2b6d69(Text,{'color':'gray','children':_0x5e0dce(0xde)}),a1_0x2b6d69(Text,{'children':_0x5e0dce(0xe2)}),a1_0x2b6d69(Text,{'color':_0x5e0dce(0xe4),'children':_0x1093dc})]}),_0xb4d079?a1_0x2c75c0(Box,{'children':[a1_0x2b6d69(Text,{'color':_0x5e0dce(0xea),'children':_0x5e0dce(0xfa)}),a1_0x2b6d69(Text,{'children':'已输入的页面路由\x20'}),a1_0x2b6d69(Text,{'color':'green','children':_0xb4d079})]}):a1_0x2b6d69(InputProjectCode,{'pagePath':_0x4c81f5,'onSubmit':_0x502d06}),_0xb4d079&&_0x133c50?a1_0x2c75c0(Box,{'marginTop':0x1,'children':[a1_0x2b6d69(Box,{'width':'4'}),a1_0x2b6d69(Text,{'children':'正在创建页面,请稍候…'})]}):null,_0x2b826b?a1_0x2c75c0(a1_0x2a5c65,{'children':[a1_0x2b6d69(Box,{'marginTop':0x1,'children':a1_0x2b6d69(Text,{'color':_0x5e0dce(0xea),'children':'\x20*\x20页面创建成功!'})}),a1_0x2c75c0(Box,{'children':[a1_0x2b6d69(Text,{'color':_0x5e0dce(0xea),'children':_0x5e0dce(0xf2)}),a1_0x2b6d69(Text,{'color':'green','children':_0x41ef7c})]}),a1_0x2c75c0(Box,{'children':[a1_0x2b6d69(Text,{'color':_0x5e0dce(0xea),'children':_0x5e0dce(0xe3)}),a1_0x2c75c0(Text,{'color':_0x5e0dce(0xe4),'children':['/',_0xb4d079]})]}),a1_0x2b6d69(Box,{'marginTop':0x1,'children':a1_0x2b6d69(Text,{'color':_0x5e0dce(0xe1),'children':_0x5e0dce(0xf4)})})]}):null]});return a1_0x2b6d69(SelectPageTemplate,{'onSelect':_0x293254});};function a1_0x30e9(){const _0x4508bd=['已选择页面模板\x20','\x20*\x20路由地址:\x20','green','2169968RZyVPJ','setLogPath','37NsYmZH','../../templates/pages','41514KcjWcC','gray','页面添加成功:\x20','src','2582307uuHCMn','now','catch','90KTVUFc','13555791dFJfGU','\x20*\x20页面路径:\x20','2819789rPyuzQ','\x20*\x20页面文件已创建,可直接通过路由访问','pages','add-page','message','开始添加页面:\x20','2824468ZTaPTD','\x20Step2:\x20','join','then','304565UFMQfd','resolve','\x20Step1:\x20','finally','info','cyan'];a1_0x30e9=function(){return _0x4508bd;};return a1_0x30e9();}
1
+ const a1_0x37681e=a1_0x3eab;(function(_0x52b606,_0x164e64){const _0x3be899=a1_0x3eab,_0x2381bc=_0x52b606();while(!![]){try{const _0xa8df6=parseInt(_0x3be899(0x8b))/0x1*(parseInt(_0x3be899(0x9a))/0x2)+parseInt(_0x3be899(0x82))/0x3*(parseInt(_0x3be899(0x8e))/0x4)+-parseInt(_0x3be899(0xa7))/0x5+-parseInt(_0x3be899(0x91))/0x6*(parseInt(_0x3be899(0x8f))/0x7)+parseInt(_0x3be899(0x8a))/0x8*(-parseInt(_0x3be899(0x88))/0x9)+parseInt(_0x3be899(0xa0))/0xa*(-parseInt(_0x3be899(0x98))/0xb)+parseInt(_0x3be899(0x96))/0xc;if(_0xa8df6===_0x164e64)break;else _0x2381bc['push'](_0x2381bc['shift']());}catch(_0x1c677a){_0x2381bc['push'](_0x2381bc['shift']());}}}(a1_0x5b0a,0x45dce));function a1_0x3eab(_0x4e6bc2,_0x40fb70){_0x4e6bc2=_0x4e6bc2-0x7f;const _0x5b0a8e=a1_0x5b0a();let _0x3eab71=_0x5b0a8e[_0x4e6bc2];return _0x3eab71;}import{jsx as a1_0x6fc5a4,jsxs as a1_0x9e3676,Fragment as a1_0x355342}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x490b78 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';function a1_0x5b0a(){const _0x4e6425=['../../templates/pages','resolve','\x20Step2:\x20','10rjRPcv','now','pages','cwd','catch','join','src','123635ztwwzT','dirname','\x20*\x20路由地址:\x20','已选择页面模板\x20','178284xRJaRV','cyan','green','已输入的页面路由\x20','gray','message','2484dGqzeA','finally','1568LFykMS','8kPUdxx','error','\x20*\x20页面文件已创建,可直接通过路由访问','32ZFzzKr','14EnQipk','setLogPath','597078PYxIwb','页面添加失败:\x20','开始添加页面:\x20','\x20Step1:\x20','页面添加成功:\x20','2304660ENeUFP','正在创建页面,请稍候…','5082088AooCnf','\x20*\x20页面创建成功!','89634rkIHmt','processTemplate','add-page'];a1_0x5b0a=function(){return _0x4e6425;};return a1_0x5b0a();}import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x490b78[a1_0x37681e(0x7f)](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x490b78[a1_0x37681e(0x9e)](__dirname,a1_0x37681e(0x9d)),projectDir=process[a1_0x37681e(0xa3)]();export const AddPage=()=>{const _0x2b5cf0=a1_0x37681e,{exit:_0x31816d}=useApp(),[_0x10ca6d,_0x370907]=useState(''),[_0x10b8ab,_0x137a61]=useState(''),[_0x18b765,_0x998fb]=useState(![]),[_0x2b30fb,_0x5cb46b]=useState(![]),_0x3d22d6=a1_0x490b78[_0x2b5cf0(0xa5)](projectDir,_0x2b5cf0(0xa6),_0x2b5cf0(0xa2)),_0x55ef22=a1_0x490b78['join'](_0x3d22d6,_0x10b8ab),_0x3d2fd3=a1_0x490b78[_0x2b5cf0(0xa5)](_0x2b5cf0(0xa6),_0x2b5cf0(0xa2),_0x10b8ab);useEffect(()=>{const _0x48cca1=_0x2b5cf0,_0x8c74c=a1_0x490b78[_0x48cca1(0x9e)](pageTemplateDir,_0x10ca6d);if(_0x10ca6d&&_0x10b8ab){_0x998fb(!![]),logger[_0x48cca1(0x90)](process[_0x48cca1(0xa3)]());const _0x64bada=Date[_0x48cca1(0xa1)]();logger['info'](_0x48cca1(0x9c),_0x48cca1(0x93)+_0x10b8ab,{'template':_0x10ca6d,'targetPath':_0x3d2fd3}),TemplateReplacer[_0x48cca1(0x9b)](_0x8c74c,a1_0x490b78[_0x48cca1(0xa5)](_0x3d22d6,_0x10b8ab),_0x10b8ab,_0x10ca6d)['then'](()=>{const _0x36200f=_0x48cca1,_0x113136=Date[_0x36200f(0xa1)]()-_0x64bada;logger['success'](_0x36200f(0x9c),_0x36200f(0x95)+_0x10b8ab,_0x113136,{'template':_0x10ca6d,'targetPath':_0x3d2fd3,'routePath':_0x10b8ab}),_0x5cb46b(!![]);})[_0x48cca1(0xa4)](_0x14499b=>{const _0x51f5ec=_0x48cca1,_0x19ce7e=Date['now']()-_0x64bada;logger[_0x51f5ec(0x8c)](_0x51f5ec(0x9c),_0x51f5ec(0x92)+_0x10b8ab,{'template':_0x10ca6d,'targetPath':_0x3d2fd3,'error':_0x14499b instanceof Error?_0x14499b[_0x51f5ec(0x87)]:String(_0x14499b),'duration':_0x19ce7e});})[_0x48cca1(0x89)](()=>{_0x998fb(![]);});}},[_0x10ca6d,_0x10b8ab]),useEffect(()=>{_0x2b30fb&&setTimeout(()=>{_0x31816d();});},[_0x2b30fb]);if(_0x10ca6d)return a1_0x9e3676(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x9e3676(Box,{'children':[a1_0x6fc5a4(Text,{'color':_0x2b5cf0(0x86),'children':_0x2b5cf0(0x94)}),a1_0x6fc5a4(Text,{'children':_0x2b5cf0(0x81)}),a1_0x6fc5a4(Text,{'color':'green','children':_0x10ca6d})]}),_0x10b8ab?a1_0x9e3676(Box,{'children':[a1_0x6fc5a4(Text,{'color':_0x2b5cf0(0x86),'children':_0x2b5cf0(0x9f)}),a1_0x6fc5a4(Text,{'children':_0x2b5cf0(0x85)}),a1_0x6fc5a4(Text,{'color':_0x2b5cf0(0x84),'children':_0x10b8ab})]}):a1_0x6fc5a4(InputProjectCode,{'pagePath':_0x55ef22,'onSubmit':_0x137a61}),_0x10b8ab&&_0x18b765?a1_0x9e3676(Box,{'marginTop':0x1,'children':[a1_0x6fc5a4(Box,{'width':'4'}),a1_0x6fc5a4(Text,{'children':_0x2b5cf0(0x97)})]}):null,_0x2b30fb?a1_0x9e3676(a1_0x355342,{'children':[a1_0x6fc5a4(Box,{'marginTop':0x1,'children':a1_0x6fc5a4(Text,{'color':_0x2b5cf0(0x86),'children':_0x2b5cf0(0x99)})}),a1_0x9e3676(Box,{'children':[a1_0x6fc5a4(Text,{'color':_0x2b5cf0(0x86),'children':'\x20*\x20页面路径:\x20'}),a1_0x6fc5a4(Text,{'color':'green','children':_0x3d2fd3})]}),a1_0x9e3676(Box,{'children':[a1_0x6fc5a4(Text,{'color':_0x2b5cf0(0x86),'children':_0x2b5cf0(0x80)}),a1_0x9e3676(Text,{'color':_0x2b5cf0(0x84),'children':['/',_0x10b8ab]})]}),a1_0x6fc5a4(Box,{'marginTop':0x1,'children':a1_0x6fc5a4(Text,{'color':_0x2b5cf0(0x83),'children':_0x2b5cf0(0x8d)})})]}):null]});return a1_0x6fc5a4(SelectPageTemplate,{'onSelect':_0x370907});};
@@ -1 +1 @@
1
- function a2_0x382a(_0x4544b5,_0x1c5554){_0x4544b5=_0x4544b5-0x1f0;const _0x301e36=a2_0x301e();let _0x382aa8=_0x301e36[_0x4544b5];return _0x382aa8;}(function(_0x18d8a6,_0x3514f3){const _0x5bf608=a2_0x382a,_0xac3dff=_0x18d8a6();while(!![]){try{const _0x6d7fb=-parseInt(_0x5bf608(0x1f0))/0x1+-parseInt(_0x5bf608(0x20c))/0x2+parseInt(_0x5bf608(0x20a))/0x3+parseInt(_0x5bf608(0x20f))/0x4*(-parseInt(_0x5bf608(0x1f6))/0x5)+-parseInt(_0x5bf608(0x207))/0x6*(-parseInt(_0x5bf608(0x206))/0x7)+parseInt(_0x5bf608(0x1fc))/0x8+parseInt(_0x5bf608(0x203))/0x9*(-parseInt(_0x5bf608(0x205))/0xa);if(_0x6d7fb===_0x3514f3)break;else _0xac3dff['push'](_0xac3dff['shift']());}catch(_0x2ab9e3){_0xac3dff['push'](_0xac3dff['shift']());}}}(a2_0x301e,0x1caba));import{jsx as a2_0x36cc34,jsxs as a2_0x494086}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x4ef157 from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x15442c=a2_0x382a;try{const _0x5c90a4=fileURLToPath(import.meta.url),_0x4f85d0=a2_0x4ef157[_0x15442c(0x1f8)](a2_0x4ef157[_0x15442c(0x1f7)](_0x5c90a4),'../..'),_0x3738b6=a2_0x4ef157[_0x15442c(0x20b)](_0x4f85d0,'templates/pages'),_0x2f23cc=await readdir(_0x3738b6,{'withFileTypes':!![]}),_0x3ef325=_0x2f23cc[_0x15442c(0x201)](_0x4ece46=>_0x4ece46[_0x15442c(0x209)]())[_0x15442c(0x202)](_0x3d40d2=>({'label':_0x3d40d2[_0x15442c(0x1ff)]}))[_0x15442c(0x20e)]((_0x39a885,_0xe9ccd0)=>_0x39a885[_0x15442c(0x210)][_0x15442c(0x204)](_0xe9ccd0['label']));return _0x3ef325;}catch(_0x5a7a1c){return console[_0x15442c(0x1f9)]('获取模板列表失败:',_0x5a7a1c),[{'label':_0x15442c(0x1f1)},{'label':_0x15442c(0x1fb)}];}}function a2_0x301e(){const _0x7b8ab6=['196801gtJXLy','blank','\x20Step1:\x20','green','正在加载页面模板...','length','573715caImQr','dirname','resolve','error','\x20\x20\x20\x20\x20\x20>\x20','sdk-fetch','1505352VWfxtO','upArrow','column','name','\x20\x20\x20\x20\x20\x20\x20\x20','filter','map','81EBNmPc','localeCompare','37340NtINEu','196AsSMqt','27954vBMXAR','downArrow','isDirectory','456105DXkvYB','join','16144rFVYrY','gray','sort','4ZYRREu','label'];a2_0x301e=function(){return _0x7b8ab6;};return a2_0x301e();}export function SelectPageTemplate(_0x2261d2){const _0x32ba42=a2_0x382a,[_0x37e744,_0x28cc68]=useState(0x0),[_0x598aa7,_0x248125]=useState([]),[_0x339fea,_0x593266]=useState(!![]);useEffect(()=>{async function _0x597dd9(){const _0x22a78e=await getTemplateList();_0x248125(_0x22a78e),_0x593266(![]);}_0x597dd9();},[]),useInput((_0x9906d9,_0x194c24)=>{const _0x38e7a2=a2_0x382a;if(_0x339fea)return;if(_0x194c24['return']){const _0x9e43e4=_0x598aa7[_0x37e744];_0x9e43e4&&_0x2261d2['onSelect'](_0x9e43e4['label']);}_0x194c24[_0x38e7a2(0x1fd)]&&_0x28cc68(_0x2f7bd8=>_0x2f7bd8===0x0?_0x598aa7[_0x38e7a2(0x1f5)]-0x1:_0x2f7bd8-0x1),_0x194c24[_0x38e7a2(0x208)]&&_0x28cc68(_0x23083c=>_0x23083c===_0x598aa7[_0x38e7a2(0x1f5)]-0x1?0x0:_0x23083c+0x1);});if(_0x339fea)return a2_0x36cc34(Box,{'flexDirection':_0x32ba42(0x1fe),'paddingY':0x1,'children':a2_0x494086(Box,{'children':[a2_0x36cc34(Text,{'color':_0x32ba42(0x20d),'children':_0x32ba42(0x1f2)}),a2_0x36cc34(Text,{'children':_0x32ba42(0x1f4)})]})});return a2_0x494086(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x494086(Box,{'children':[a2_0x36cc34(Text,{'color':_0x32ba42(0x20d),'children':_0x32ba42(0x1f2)}),a2_0x36cc34(Text,{'children':'请选择您要创建的页面模板'})]}),_0x598aa7[_0x32ba42(0x202)]((_0x1b3852,_0x4f420f)=>{const _0x44318b=_0x32ba42,_0x258a9e=_0x4f420f===_0x37e744,_0x317844=_0x258a9e?_0x44318b(0x1fa)+_0x1b3852['label']:_0x44318b(0x200)+_0x1b3852[_0x44318b(0x210)];return a2_0x36cc34(Box,{'children':a2_0x36cc34(Text,{'color':_0x258a9e?_0x44318b(0x1f3):undefined,'children':_0x317844})},_0x317844);})]});}
1
+ function a2_0x59dd(){const _0x3a48ec=['2774456iksrEf','upArrow','column','localeCompare','resolve','map','12cTqugY','正在加载页面模板...','\x20Step1:\x20','isDirectory','dirname','filter','236RoObIS','12frasTS','9BZkHkv','6834560EeNlqT','sort','blank','gray','13428eNdmYY','59628qeaPKH','18012423fHQNCw','name','length','238PqzMrw','error','green','label','获取模板列表失败:','1038280ChlagA','111927OSIhIw','return','downArrow','../..'];a2_0x59dd=function(){return _0x3a48ec;};return a2_0x59dd();}(function(_0x3ae0fe,_0x183f6d){const _0x3b3cd2=a2_0x2082,_0x3d7ee4=_0x3ae0fe();while(!![]){try{const _0x375e91=parseInt(_0x3b3cd2(0xd5))/0x1*(parseInt(_0x3b3cd2(0xf0))/0x2)+-parseInt(_0x3b3cd2(0xe0))/0x3*(-parseInt(_0x3b3cd2(0xea))/0x4)+parseInt(_0x3b3cd2(0xf3))/0x5+parseInt(_0x3b3cd2(0xd6))/0x6*(-parseInt(_0x3b3cd2(0xda))/0x7)+parseInt(_0x3b3cd2(0xe4))/0x8*(-parseInt(_0x3b3cd2(0xf2))/0x9)+parseInt(_0x3b3cd2(0xdf))/0xa+parseInt(_0x3b3cd2(0xd7))/0xb*(-parseInt(_0x3b3cd2(0xf1))/0xc);if(_0x375e91===_0x183f6d)break;else _0x3d7ee4['push'](_0x3d7ee4['shift']());}catch(_0x2998bb){_0x3d7ee4['push'](_0x3d7ee4['shift']());}}}(a2_0x59dd,0xce4b3));import{jsx as a2_0xd8dedf,jsxs as a2_0x50eaff}from'react/jsx-runtime';function a2_0x2082(_0x218799,_0x207107){_0x218799=_0x218799-0xd2;const _0x59dd5c=a2_0x59dd();let _0x208204=_0x59dd5c[_0x218799];return _0x208204;}import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x120169 from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x18bca0=a2_0x2082;try{const _0x45d9d6=fileURLToPath(import.meta.url),_0x348240=a2_0x120169[_0x18bca0(0xe8)](a2_0x120169[_0x18bca0(0xee)](_0x45d9d6),_0x18bca0(0xe3)),_0x1e08f6=a2_0x120169['join'](_0x348240,'templates/pages'),_0x43e9be=await readdir(_0x1e08f6,{'withFileTypes':!![]}),_0x564ea6=_0x43e9be[_0x18bca0(0xef)](_0x101293=>_0x101293[_0x18bca0(0xed)]())[_0x18bca0(0xe9)](_0x45eec4=>({'label':_0x45eec4[_0x18bca0(0xd8)]}))[_0x18bca0(0xd2)]((_0x215583,_0x150227)=>_0x215583['label'][_0x18bca0(0xe7)](_0x150227[_0x18bca0(0xdd)]));return _0x564ea6;}catch(_0x4b3130){return console[_0x18bca0(0xdb)](_0x18bca0(0xde),_0x4b3130),[{'label':_0x18bca0(0xd3)},{'label':'sdk-fetch'}];}}export function SelectPageTemplate(_0x194b3e){const _0x2c2274=a2_0x2082,[_0x19c8fe,_0x51f894]=useState(0x0),[_0x5bc2b9,_0x3659bc]=useState([]),[_0x52fa17,_0x56dd6f]=useState(!![]);useEffect(()=>{async function _0x1b19de(){const _0x2211c6=await getTemplateList();_0x3659bc(_0x2211c6),_0x56dd6f(![]);}_0x1b19de();},[]),useInput((_0x2fab33,_0x3ebda5)=>{const _0x3183f0=a2_0x2082;if(_0x52fa17)return;if(_0x3ebda5[_0x3183f0(0xe1)]){const _0xe44361=_0x5bc2b9[_0x19c8fe];_0xe44361&&_0x194b3e['onSelect'](_0xe44361['label']);}_0x3ebda5[_0x3183f0(0xe5)]&&_0x51f894(_0x32de82=>_0x32de82===0x0?_0x5bc2b9[_0x3183f0(0xd9)]-0x1:_0x32de82-0x1),_0x3ebda5[_0x3183f0(0xe2)]&&_0x51f894(_0x2a0a1e=>_0x2a0a1e===_0x5bc2b9[_0x3183f0(0xd9)]-0x1?0x0:_0x2a0a1e+0x1);});if(_0x52fa17)return a2_0xd8dedf(Box,{'flexDirection':_0x2c2274(0xe6),'paddingY':0x1,'children':a2_0x50eaff(Box,{'children':[a2_0xd8dedf(Text,{'color':_0x2c2274(0xd4),'children':_0x2c2274(0xec)}),a2_0xd8dedf(Text,{'children':_0x2c2274(0xeb)})]})});return a2_0x50eaff(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x50eaff(Box,{'children':[a2_0xd8dedf(Text,{'color':'gray','children':_0x2c2274(0xec)}),a2_0xd8dedf(Text,{'children':'请选择您要创建的页面模板'})]}),_0x5bc2b9[_0x2c2274(0xe9)]((_0x559ec1,_0x1697fd)=>{const _0x24cb1a=_0x2c2274,_0x1c7d89=_0x1697fd===_0x19c8fe,_0x467907=_0x1c7d89?'\x20\x20\x20\x20\x20\x20>\x20'+_0x559ec1['label']:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x559ec1[_0x24cb1a(0xdd)];return a2_0xd8dedf(Box,{'children':a2_0xd8dedf(Text,{'color':_0x1c7d89?_0x24cb1a(0xdc):undefined,'children':_0x467907})},_0x467907);})]});}
@@ -1 +1 @@
1
- (function(_0x437a77,_0x38d0ec){const _0x1dd06e=a3_0x276a,_0x58f70f=_0x437a77();while(!![]){try{const _0x3b5220=parseInt(_0x1dd06e(0xe0))/0x1+parseInt(_0x1dd06e(0xb6))/0x2+parseInt(_0x1dd06e(0xe4))/0x3*(parseInt(_0x1dd06e(0xe7))/0x4)+-parseInt(_0x1dd06e(0xb4))/0x5*(parseInt(_0x1dd06e(0xe2))/0x6)+-parseInt(_0x1dd06e(0xcb))/0x7*(-parseInt(_0x1dd06e(0xb2))/0x8)+-parseInt(_0x1dd06e(0xb9))/0x9*(parseInt(_0x1dd06e(0xca))/0xa)+-parseInt(_0x1dd06e(0xdd))/0xb*(parseInt(_0x1dd06e(0xe9))/0xc);if(_0x3b5220===_0x38d0ec)break;else _0x58f70f['push'](_0x58f70f['shift']());}catch(_0x383063){_0x58f70f['push'](_0x58f70f['shift']());}}}(a3_0x2b69,0x26e21));import{jsx as a3_0x16eadc,jsxs as a3_0x525331,Fragment as a3_0x5a7847}from'react/jsx-runtime';function a3_0x2b69(){const _0x152496=['log','\x20个匹配的数据集\x1b[0m','589699bZogKC','文档生成完成','map','112003nhAAhq',',\x20失败\x20','48kAFWBD','column','6mdbhpV','api-doc','cyan','385772WEHWBk','setLogPath','12HYKoTf','💡\x20请使用\x20','\x20个数据集中筛选出\x20','join','\x1b[33m!\x20以下数据集代码不存在:\x20','8SQzkkc','cwd','146915sOTMbp','*\x20输出目录:\x20','200426jjSEBC','gray','white','261qyarQo','使用配置的应用AppCode:\x20','filter','使用指定的应用AppCode:\x20','√\x20文档生成完成!成功\x20','filePath','.md\x20(','string','未提供应用AppCode,且配置中也没有默认值','message','\x20个数据集','\x20(环境:\x20','dim','\x1b[0m','\x1b[90m*\x20从\x20','./docs','未找到任何数据集','34130DVXfTC','992691XIpaGn','lovrabet\x20auth','正在生成\x20','length','\x20-\x20','yellow','datasetName','文档生成失败:\x20','datasetCode','success','*\x20共处理\x20','*\x20生成的文档文件:','指定的数据集代码都不存在:\x20','error','includes','🚀\x20'];a3_0x2b69=function(){return _0x152496;};return a3_0x2b69();}import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';function a3_0x276a(_0x15c36c,_0x3c3167){_0x15c36c=_0x15c36c-0xb1;const _0x2b6979=a3_0x2b69();let _0x276a4d=_0x2b6979[_0x15c36c];return _0x276a4d;}import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x4af946,env:_0x230091,output:_0x29c5ac,extraParams:_0x5329e1,datasetCodes:_0x2a2dba})=>{const _0x5b1ef4=a3_0x276a,{exit:_0x46fc66}=useApp(),[_0x2d9152,_0x22a36e]=useState(![]),[_0x3bb0b3,_0x49c44e]=useState(''),[_0x485e0e,_0x3f5cef]=useState(![]),[_0x3a4aeb,_0xaa03f2]=useState(null),[_0x29180a,_0x27580f]=useState(null),[_0x1ce184,_0x3955c8]=useState(0x0),_0x5a7757=readConfig(),_0x45c7bf=getConfigAppCode(),_0x5153a5=_0x4af946||_0x45c7bf,_0x261518=typeof _0x5a7757?.['env']===_0x5b1ef4(0xc0)?_0x5a7757['env']:undefined,_0x336cff=_0x230091||_0x261518||'online';initEnv(_0x336cff);const _0x5171a7=_0x29c5ac||_0x5b1ef4(0xc8),_0x3ddb0d=_0x4af946?_0x5b1ef4(0xbc)+_0x5153a5:_0x5b1ef4(0xba)+_0x5153a5;useEffect(()=>{_0x22a36e(!![]),_0xf0b53b();},[]),useEffect(()=>{(_0x485e0e||_0x3a4aeb)&&_0x46fc66();},[_0x485e0e,_0x3a4aeb,_0x46fc66]);async function _0xf0b53b(){const _0x189944=_0x5b1ef4;if(!_0x5153a5){_0xaa03f2(_0x189944(0xc1));return;}try{logger[_0x189944(0xe8)](process[_0x189944(0xb3)]()),_0x49c44e('正在获取数据集列表...');const {configArray:_0x3cbd95}=await fetchModelList(_0x5153a5);_0x3955c8(_0x3cbd95[_0x189944(0xce)]);if(_0x3cbd95[_0x189944(0xce)]===0x0){_0xaa03f2(_0x189944(0xc9));return;}let _0x4c383d=_0x3cbd95;if(_0x2a2dba&&_0x2a2dba[_0x189944(0xce)]>0x0){_0x4c383d=_0x3cbd95[_0x189944(0xbb)](_0x477d90=>_0x2a2dba[_0x189944(0xd9)](_0x477d90[_0x189944(0xd3)]));const _0x7db333=_0x4c383d[_0x189944(0xdf)](_0x30b0ff=>_0x30b0ff[_0x189944(0xd3)]),_0x2fce1b=_0x2a2dba[_0x189944(0xbb)](_0xb791bd=>!_0x7db333[_0x189944(0xd9)](_0xb791bd));_0x2fce1b[_0x189944(0xce)]>0x0&&console['log'](_0x189944(0xb1)+_0x2fce1b['join'](',\x20')+_0x189944(0xc6));if(_0x4c383d[_0x189944(0xce)]===0x0){_0xaa03f2(_0x189944(0xd7)+_0x2a2dba[_0x189944(0xec)](',\x20'));return;}console[_0x189944(0xdb)](_0x189944(0xc7)+_0x3cbd95[_0x189944(0xce)]+_0x189944(0xeb)+_0x4c383d[_0x189944(0xce)]+_0x189944(0xdc));}_0x49c44e(_0x189944(0xcd)+_0x4c383d[_0x189944(0xce)]+'\x20个数据集的文档...');const _0x98d50b=await generateDatasetDocs(_0x4c383d,_0x5153a5,_0x5171a7,(_0x4c8087,_0x253201,_0x56c12b)=>{const _0x381bf8=_0x189944;_0x49c44e(_0x381bf8(0xcd)+_0x56c12b+_0x381bf8(0xbf)+_0x4c8087+'/'+_0x253201+')');},_0x5329e1);_0x27580f(_0x98d50b),_0x3f5cef(!![]);const _0x12f57b=_0x98d50b[_0x189944(0xbb)](_0x10ce46=>_0x10ce46['success'])[_0x189944(0xce)],_0x2713a9=_0x98d50b['filter'](_0x2aa44a=>!_0x2aa44a[_0x189944(0xd4)])['length'];logger[_0x189944(0xd4)](_0x189944(0xe5),_0x189944(0xde),undefined,{'totalCount':_0x98d50b[_0x189944(0xce)],'successCount':_0x12f57b,'failCount':_0x2713a9,'outputDir':_0x5171a7});}catch(_0x2d7f73){const _0x13d76f=_0x2d7f73 instanceof Error?_0x2d7f73[_0x189944(0xc2)]:String(_0x2d7f73);logger[_0x189944(0xd8)](_0x189944(0xe5),_0x189944(0xd2)+_0x13d76f,{'appCode':_0x5153a5,'outputDir':_0x5171a7}),_0xaa03f2(_0x189944(0xd2)+_0x13d76f);}finally{_0x22a36e(![]);}}const _0x4ffb46=_0x29180a?.[_0x5b1ef4(0xbb)](_0x818cb9=>_0x818cb9['success'])['length']||0x0,_0x2ad7fe=_0x29180a?.[_0x5b1ef4(0xbb)](_0x5eef8c=>!_0x5eef8c[_0x5b1ef4(0xd4)])['length']||0x0;return a3_0x525331(Box,{'flexDirection':_0x5b1ef4(0xe3),'children':[(_0x2d9152||_0x485e0e)&&a3_0x525331(Box,{'children':[a3_0x16eadc(Text,{'color':_0x5b1ef4(0xb7),'children':'*\x20'}),a3_0x16eadc(Text,{'color':_0x4af946?_0x5b1ef4(0xb8):_0x5b1ef4(0xc5),'children':_0x3ddb0d})]}),_0x2d9152&&a3_0x16eadc(Box,{'children':a3_0x525331(Text,{'children':[_0x5b1ef4(0xda),_0x3bb0b3,_0x5b1ef4(0xc4),_0x336cff,')']})}),_0x485e0e&&_0x29180a&&a3_0x525331(Box,{'flexDirection':_0x5b1ef4(0xe3),'children':[a3_0x16eadc(Box,{'children':a3_0x525331(Text,{'color':'green','children':[_0x5b1ef4(0xbd),_0x4ffb46,'\x20个',_0x2ad7fe>0x0&&_0x5b1ef4(0xe1)+_0x2ad7fe+'\x20个']})}),a3_0x16eadc(Box,{'marginTop':0x1,'children':a3_0x525331(Text,{'color':_0x5b1ef4(0xb7),'children':[_0x5b1ef4(0xd5),_0x1ce184,_0x5b1ef4(0xc3)]})}),a3_0x525331(Box,{'marginTop':0x1,'children':[a3_0x16eadc(Text,{'color':'gray','children':_0x5b1ef4(0xb5)}),a3_0x16eadc(Text,{'color':_0x5b1ef4(0xe6),'children':_0x5171a7})]}),_0x4ffb46>0x0&&a3_0x525331(a3_0x5a7847,{'children':[a3_0x16eadc(Box,{'marginTop':0x1,'children':a3_0x16eadc(Text,{'color':_0x5b1ef4(0xb7),'children':_0x5b1ef4(0xd6)})}),_0x29180a['filter'](_0x189663=>_0x189663[_0x5b1ef4(0xd4)])[_0x5b1ef4(0xdf)]((_0x249e6b,_0x69a65)=>a3_0x525331(Box,{'marginLeft':0x2,'children':[a3_0x525331(Text,{'color':_0x5b1ef4(0xe6),'children':['•\x20',_0x249e6b[_0x5b1ef4(0xbe)]]}),a3_0x525331(Text,{'color':_0x5b1ef4(0xc5),'children':[_0x5b1ef4(0xcf),_0x249e6b[_0x5b1ef4(0xd1)]]})]},_0x69a65))]}),_0x2ad7fe>0x0&&a3_0x525331(a3_0x5a7847,{'children':[a3_0x16eadc(Box,{'marginTop':0x1,'children':a3_0x16eadc(Text,{'color':_0x5b1ef4(0xd0),'children':'⚠️\x20以下数据集生成失败:'})}),_0x29180a['filter'](_0x24f49d=>!_0x24f49d[_0x5b1ef4(0xd4)])[_0x5b1ef4(0xdf)]((_0x8ea86e,_0x4353e1)=>a3_0x525331(Box,{'marginLeft':0x2,'flexDirection':_0x5b1ef4(0xe3),'children':[a3_0x525331(Text,{'color':'red','children':['•\x20',_0x8ea86e[_0x5b1ef4(0xd1)],'\x20(',_0x8ea86e[_0x5b1ef4(0xd3)],')']}),_0x8ea86e[_0x5b1ef4(0xd8)]&&a3_0x16eadc(Box,{'marginLeft':0x2,'children':a3_0x16eadc(Text,{'color':_0x5b1ef4(0xc5),'children':_0x8ea86e[_0x5b1ef4(0xd8)]})})]},_0x4353e1))]})]}),_0x3a4aeb&&a3_0x525331(Box,{'flexDirection':_0x5b1ef4(0xe3),'children':[a3_0x16eadc(Box,{'children':a3_0x525331(Text,{'color':'red','children':['❌\x20',_0x3a4aeb]})}),_0x3a4aeb[_0x5b1ef4(0xd9)]('登录')&&a3_0x525331(Box,{'marginTop':0x1,'children':[a3_0x16eadc(Text,{'color':_0x5b1ef4(0xd0),'children':_0x5b1ef4(0xea)}),a3_0x16eadc(Text,{'color':_0x5b1ef4(0xe6),'children':_0x5b1ef4(0xcc)}),a3_0x16eadc(Text,{'color':_0x5b1ef4(0xd0),'children':'\x20重新登录后再试'})]})]})]});};
1
+ (function(_0x362ab4,_0x66b0e9){const _0x26a547=a3_0x3380,_0x5d24c7=_0x362ab4();while(!![]){try{const _0x54e893=-parseInt(_0x26a547(0x19a))/0x1*(-parseInt(_0x26a547(0x1a1))/0x2)+-parseInt(_0x26a547(0x1b3))/0x3+parseInt(_0x26a547(0x191))/0x4*(parseInt(_0x26a547(0x194))/0x5)+parseInt(_0x26a547(0x1a7))/0x6+parseInt(_0x26a547(0x1a3))/0x7+parseInt(_0x26a547(0x1ae))/0x8*(parseInt(_0x26a547(0x1ad))/0x9)+-parseInt(_0x26a547(0x1c0))/0xa;if(_0x54e893===_0x66b0e9)break;else _0x5d24c7['push'](_0x5d24c7['shift']());}catch(_0x2ebc48){_0x5d24c7['push'](_0x5d24c7['shift']());}}}(a3_0x3ec5,0x22daf));function a3_0x3ec5(){const _0x19630f=['💡\x20请使用\x20','\x20(环境:\x20','column','\x20重新登录后再试','52coRJJE','\x20-\x20','891786XmRclw','*\x20生成的文档文件:','red','api-doc','653148KLwEBj','log','length','\x1b[0m','指定的数据集代码都不存在:\x20','\x20个匹配的数据集\x1b[0m','9HWdDsn','80048yCkQAr','⚠️\x20以下数据集生成失败:','\x20个数据集中筛选出\x20','map','\x1b[90m*\x20从\x20','342768ZGIlny','gray','message','green','error','\x20个数据集','filter','正在获取数据集列表...','cyan','includes','.md\x20(','white','使用指定的应用AppCode:\x20','4373140fEBakm','yellow','正在生成\x20','join','dim','lovrabet\x20auth','setLogPath','12JAadtc','未找到任何数据集','env','434965tDVEaJ','./docs',',\x20失败\x20','datasetName','filePath','success','7196iUfJJP','使用配置的应用AppCode:\x20','datasetCode'];a3_0x3ec5=function(){return _0x19630f;};return a3_0x3ec5();}import{jsx as a3_0x311a75,jsxs as a3_0x382f83,Fragment as a3_0x5f3d96}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';function a3_0x3380(_0x4bd6f6,_0x31f309){_0x4bd6f6=_0x4bd6f6-0x18e;const _0x3ec5ba=a3_0x3ec5();let _0x33806d=_0x3ec5ba[_0x4bd6f6];return _0x33806d;}import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x426e51,env:_0x1733cd,output:_0x3a3fea,extraParams:_0x5a4bb6,datasetCodes:_0x5f3466})=>{const _0x2564ab=a3_0x3380,{exit:_0x2e423d}=useApp(),[_0x5d6e93,_0x2aef52]=useState(![]),[_0xbce765,_0x8b4b25]=useState(''),[_0x401f49,_0x2b0ca0]=useState(![]),[_0x54d2c4,_0x1f40fa]=useState(null),[_0x553d2f,_0x570e1a]=useState(null),[_0x26211c,_0x457a2c]=useState(0x0),_0x52e065=readConfig(),_0x4ec53a=getConfigAppCode(),_0x179374=_0x426e51||_0x4ec53a,_0x38539f=typeof _0x52e065?.[_0x2564ab(0x193)]==='string'?_0x52e065[_0x2564ab(0x193)]:undefined,_0x15affe=_0x1733cd||_0x38539f||'online';initEnv(_0x15affe);const _0x443c40=_0x3a3fea||_0x2564ab(0x195),_0x5206b5=_0x426e51?_0x2564ab(0x1bf)+_0x179374:_0x2564ab(0x19b)+_0x179374;useEffect(()=>{_0x2aef52(!![]),_0xf75901();},[]),useEffect(()=>{(_0x401f49||_0x54d2c4)&&_0x2e423d();},[_0x401f49,_0x54d2c4,_0x2e423d]);async function _0xf75901(){const _0xe5b147=_0x2564ab;if(!_0x179374){_0x1f40fa('未提供应用AppCode,且配置中也没有默认值');return;}try{logger[_0xe5b147(0x190)](process['cwd']()),_0x8b4b25(_0xe5b147(0x1ba));const {configArray:_0x377d7c}=await fetchModelList(_0x179374);_0x457a2c(_0x377d7c[_0xe5b147(0x1a9)]);if(_0x377d7c[_0xe5b147(0x1a9)]===0x0){_0x1f40fa(_0xe5b147(0x192));return;}let _0x418920=_0x377d7c;if(_0x5f3466&&_0x5f3466[_0xe5b147(0x1a9)]>0x0){_0x418920=_0x377d7c[_0xe5b147(0x1b9)](_0x228e3b=>_0x5f3466[_0xe5b147(0x1bc)](_0x228e3b[_0xe5b147(0x19c)]));const _0x2119fd=_0x418920[_0xe5b147(0x1b1)](_0x3d0c2e=>_0x3d0c2e[_0xe5b147(0x19c)]),_0x265a32=_0x5f3466[_0xe5b147(0x1b9)](_0x2e418f=>!_0x2119fd[_0xe5b147(0x1bc)](_0x2e418f));_0x265a32[_0xe5b147(0x1a9)]>0x0&&console[_0xe5b147(0x1a8)]('\x1b[33m!\x20以下数据集代码不存在:\x20'+_0x265a32[_0xe5b147(0x1c3)](',\x20')+_0xe5b147(0x1aa));if(_0x418920[_0xe5b147(0x1a9)]===0x0){_0x1f40fa(_0xe5b147(0x1ab)+_0x5f3466[_0xe5b147(0x1c3)](',\x20'));return;}console[_0xe5b147(0x1a8)](_0xe5b147(0x1b2)+_0x377d7c[_0xe5b147(0x1a9)]+_0xe5b147(0x1b0)+_0x418920[_0xe5b147(0x1a9)]+_0xe5b147(0x1ac));}_0x8b4b25(_0xe5b147(0x1c2)+_0x418920[_0xe5b147(0x1a9)]+'\x20个数据集的文档...');const _0x499a75=await generateDatasetDocs(_0x418920,_0x179374,_0x443c40,(_0x3721ef,_0x3ca4f4,_0x13b9c4)=>{const _0x252764=_0xe5b147;_0x8b4b25('正在生成\x20'+_0x13b9c4+_0x252764(0x1bd)+_0x3721ef+'/'+_0x3ca4f4+')');},_0x5a4bb6);_0x570e1a(_0x499a75),_0x2b0ca0(!![]);const _0x254f5d=_0x499a75[_0xe5b147(0x1b9)](_0x5d61b7=>_0x5d61b7[_0xe5b147(0x199)])['length'],_0x28661e=_0x499a75[_0xe5b147(0x1b9)](_0x4ad1db=>!_0x4ad1db[_0xe5b147(0x199)])[_0xe5b147(0x1a9)];logger[_0xe5b147(0x199)]('api-doc','文档生成完成',undefined,{'totalCount':_0x499a75['length'],'successCount':_0x254f5d,'failCount':_0x28661e,'outputDir':_0x443c40});}catch(_0x2d4a1b){const _0x10abb1=_0x2d4a1b instanceof Error?_0x2d4a1b[_0xe5b147(0x1b5)]:String(_0x2d4a1b);logger[_0xe5b147(0x1b7)](_0xe5b147(0x1a6),'文档生成失败:\x20'+_0x10abb1,{'appCode':_0x179374,'outputDir':_0x443c40}),_0x1f40fa('文档生成失败:\x20'+_0x10abb1);}finally{_0x2aef52(![]);}}const _0x2bde7a=_0x553d2f?.['filter'](_0x25fa23=>_0x25fa23[_0x2564ab(0x199)])[_0x2564ab(0x1a9)]||0x0,_0x53b3f4=_0x553d2f?.[_0x2564ab(0x1b9)](_0x3415fb=>!_0x3415fb[_0x2564ab(0x199)])['length']||0x0;return a3_0x382f83(Box,{'flexDirection':_0x2564ab(0x19f),'children':[(_0x5d6e93||_0x401f49)&&a3_0x382f83(Box,{'children':[a3_0x311a75(Text,{'color':_0x2564ab(0x1b4),'children':'*\x20'}),a3_0x311a75(Text,{'color':_0x426e51?_0x2564ab(0x1be):'dim','children':_0x5206b5})]}),_0x5d6e93&&a3_0x311a75(Box,{'children':a3_0x382f83(Text,{'children':['🚀\x20',_0xbce765,_0x2564ab(0x19e),_0x15affe,')']})}),_0x401f49&&_0x553d2f&&a3_0x382f83(Box,{'flexDirection':_0x2564ab(0x19f),'children':[a3_0x311a75(Box,{'children':a3_0x382f83(Text,{'color':_0x2564ab(0x1b6),'children':['√\x20文档生成完成!成功\x20',_0x2bde7a,'\x20个',_0x53b3f4>0x0&&_0x2564ab(0x196)+_0x53b3f4+'\x20个']})}),a3_0x311a75(Box,{'marginTop':0x1,'children':a3_0x382f83(Text,{'color':_0x2564ab(0x1b4),'children':['*\x20共处理\x20',_0x26211c,_0x2564ab(0x1b8)]})}),a3_0x382f83(Box,{'marginTop':0x1,'children':[a3_0x311a75(Text,{'color':_0x2564ab(0x1b4),'children':'*\x20输出目录:\x20'}),a3_0x311a75(Text,{'color':_0x2564ab(0x1bb),'children':_0x443c40})]}),_0x2bde7a>0x0&&a3_0x382f83(a3_0x5f3d96,{'children':[a3_0x311a75(Box,{'marginTop':0x1,'children':a3_0x311a75(Text,{'color':_0x2564ab(0x1b4),'children':_0x2564ab(0x1a4)})}),_0x553d2f[_0x2564ab(0x1b9)](_0x345045=>_0x345045[_0x2564ab(0x199)])['map']((_0x25ce33,_0x4a3f3e)=>a3_0x382f83(Box,{'marginLeft':0x2,'children':[a3_0x382f83(Text,{'color':_0x2564ab(0x1bb),'children':['•\x20',_0x25ce33[_0x2564ab(0x198)]]}),a3_0x382f83(Text,{'color':'dim','children':[_0x2564ab(0x1a2),_0x25ce33[_0x2564ab(0x197)]]})]},_0x4a3f3e))]}),_0x53b3f4>0x0&&a3_0x382f83(a3_0x5f3d96,{'children':[a3_0x311a75(Box,{'marginTop':0x1,'children':a3_0x311a75(Text,{'color':_0x2564ab(0x1c1),'children':_0x2564ab(0x1af)})}),_0x553d2f[_0x2564ab(0x1b9)](_0x50b2cc=>!_0x50b2cc[_0x2564ab(0x199)])['map']((_0x4f3245,_0x37014b)=>a3_0x382f83(Box,{'marginLeft':0x2,'flexDirection':_0x2564ab(0x19f),'children':[a3_0x382f83(Text,{'color':_0x2564ab(0x1a5),'children':['•\x20',_0x4f3245[_0x2564ab(0x197)],'\x20(',_0x4f3245[_0x2564ab(0x19c)],')']}),_0x4f3245[_0x2564ab(0x1b7)]&&a3_0x311a75(Box,{'marginLeft':0x2,'children':a3_0x311a75(Text,{'color':_0x2564ab(0x18e),'children':_0x4f3245[_0x2564ab(0x1b7)]})})]},_0x37014b))]})]}),_0x54d2c4&&a3_0x382f83(Box,{'flexDirection':'column','children':[a3_0x311a75(Box,{'children':a3_0x382f83(Text,{'color':_0x2564ab(0x1a5),'children':['❌\x20',_0x54d2c4]})}),_0x54d2c4[_0x2564ab(0x1bc)]('登录')&&a3_0x382f83(Box,{'marginTop':0x1,'children':[a3_0x311a75(Text,{'color':'yellow','children':_0x2564ab(0x19d)}),a3_0x311a75(Text,{'color':'cyan','children':_0x2564ab(0x18f)}),a3_0x311a75(Text,{'color':_0x2564ab(0x1c1),'children':_0x2564ab(0x1a0)})]})]})]});};
@@ -1 +1 @@
1
- function a4_0x4ff9(){const _0x174f3f=['登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','40995xHXguY','5614085DIvyju','.md','530KjsXzB','name','datasetCode','POST','data','markdown','6VNeBhq','✓\x20成功生成:\x20','4501488jSkAbv','获取文档失败\x20(','stringify','.md\x20(','log','string','生成文档成功:\x20','json','253588ibWkvq','join','length','\x20个数据集需要生成文档\x0a','5936612zPanme','✗\x20失败:\x20','status','/api/node-toolbox/api-doc-generator','1281wfuivU','等待\x203\x20秒...\x0a','push','api-doc','19320COyUCT','4cvbJsw','message',']\x20正在生成:\x20','437331uHbQkI','15QvKwsC','./docs','):缺少\x20data.markdown\x20字段'];a4_0x4ff9=function(){return _0x174f3f;};return a4_0x4ff9();}const a4_0x5c3066=a4_0x26a5;(function(_0x2495c1,_0x42b1d6){const _0xdde389=a4_0x26a5,_0x5cf4de=_0x2495c1();while(!![]){try{const _0xef80b3=-parseInt(_0xdde389(0x80))/0x1*(parseInt(_0xdde389(0x7d))/0x2)+-parseInt(_0xdde389(0x81))/0x3*(-parseInt(_0xdde389(0x70))/0x4)+-parseInt(_0xdde389(0x86))/0x5*(-parseInt(_0xdde389(0x8e))/0x6)+parseInt(_0xdde389(0x78))/0x7*(parseInt(_0xdde389(0x7c))/0x8)+-parseInt(_0xdde389(0x85))/0x9*(parseInt(_0xdde389(0x88))/0xa)+-parseInt(_0xdde389(0x74))/0xb+parseInt(_0xdde389(0x90))/0xc;if(_0xef80b3===_0x42b1d6)break;else _0x5cf4de['push'](_0x5cf4de['shift']());}catch(_0x31061f){_0x5cf4de['push'](_0x5cf4de['shift']());}}}(a4_0x4ff9,0x92c0e));import{mkdirSync,writeFileSync}from'node:fs';import a4_0x347b94 from'node:path';import{getCookie}from'../auth/get-cookie.js';function a4_0x26a5(_0x2575a9,_0x18f3e4){_0x2575a9=_0x2575a9-0x70;const _0x4ff9c3=a4_0x4ff9();let _0x26a5f0=_0x4ff9c3[_0x2575a9];return _0x26a5f0;}import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x5d9c5e){const _0x3322d7=a4_0x26a5,{appCode:_0x101467,datasetCode:_0xa0ecea,datasetId:_0x2e8780,extraParams:_0x1b468a}=_0x5d9c5e,_0x3a1872=getApiDomain(),_0x2dd786=_0x3a1872+_0x3322d7(0x77),_0x13d014={'appCode':_0x101467,'datasetCode':_0xa0ecea,'datasetId':_0x2e8780,..._0x1b468a||{}},_0x5947cf=await fetch(_0x2dd786,{'method':_0x3322d7(0x8b),'headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON[_0x3322d7(0x92)](_0x13d014)});if(!_0x5947cf['ok']){if(_0x5947cf[_0x3322d7(0x76)]===0x191)throw new Error(_0x3322d7(0x84));let _0x96d280='';try{_0x96d280=await _0x5947cf['text']();}catch(_0x3cb91d){}throw new Error(_0x3322d7(0x91)+_0xa0ecea+'),HTTP状态码:\x20'+_0x5947cf[_0x3322d7(0x76)]+(_0x96d280?'\x0a'+_0x96d280:''));}const _0x6074ea=await _0x5947cf[_0x3322d7(0x97)]();if(!_0x6074ea[_0x3322d7(0x8c)]||typeof _0x6074ea[_0x3322d7(0x8c)][_0x3322d7(0x8d)]!==_0x3322d7(0x95))throw new Error('响应数据格式错误\x20('+_0xa0ecea+_0x3322d7(0x83));return _0x6074ea['data']['markdown'];}function delay(_0x503e9e){return new Promise(_0x17a383=>setTimeout(_0x17a383,_0x503e9e));}export async function generateDatasetDocs(_0x204cee,_0xcacbae,_0x1fcb58=a4_0x5c3066(0x82),_0x46a778,_0x1fff1f){const _0x2557b4=a4_0x5c3066;mkdirSync(_0x1fcb58,{'recursive':!![]});const _0x2e6d54=[],_0x5837a6=_0x204cee[_0x2557b4(0x72)];console[_0x2557b4(0x94)]('\x0a共有\x20'+_0x5837a6+_0x2557b4(0x73));for(let _0x22a1f1=0x0;_0x22a1f1<_0x204cee[_0x2557b4(0x72)];_0x22a1f1++){const _0x23d793=_0x204cee[_0x22a1f1],_0x16330a=_0x22a1f1+0x1,_0x1f96e9=_0x23d793['tableName'];try{console[_0x2557b4(0x94)]('['+_0x16330a+'/'+_0x5837a6+_0x2557b4(0x7f)+_0x1f96e9+_0x2557b4(0x93)+_0x23d793[_0x2557b4(0x89)]+')');_0x46a778&&_0x46a778(_0x16330a,_0x5837a6,_0x1f96e9);const _0x3b4820=await fetchDatasetDoc({'appCode':_0xcacbae,'datasetCode':_0x23d793[_0x2557b4(0x8a)],'datasetId':_0x23d793['id'],'enableAI':![],'extraParams':_0x1fff1f}),_0x116e46=a4_0x347b94[_0x2557b4(0x71)](_0x1fcb58,_0x1f96e9+'.md');writeFileSync(_0x116e46,_0x3b4820,{'encoding':'utf8'}),console[_0x2557b4(0x94)](_0x2557b4(0x8f)+_0x1f96e9+_0x2557b4(0x87)),logger['success']('api-doc',_0x2557b4(0x96)+_0x1f96e9,undefined,{'datasetCode':_0x23d793['datasetCode'],'datasetName':_0x23d793[_0x2557b4(0x89)],'filePath':_0x116e46,'progress':_0x16330a+'/'+_0x5837a6}),_0x2e6d54[_0x2557b4(0x7a)]({'datasetCode':_0x23d793['datasetCode'],'datasetName':_0x23d793[_0x2557b4(0x89)],'filePath':_0x116e46,'success':!![]}),_0x16330a<_0x5837a6&&await delay(0x1388);}catch(_0x40408a){const _0x57e163=_0x40408a instanceof Error?_0x40408a[_0x2557b4(0x7e)]:String(_0x40408a);console['log'](_0x2557b4(0x75)+_0x1f96e9+'.md\x20-\x20'+_0x57e163+'\x0a'),logger['error'](_0x2557b4(0x7b),'生成文档失败:\x20'+_0x23d793[_0x2557b4(0x8a)],{'datasetCode':_0x23d793[_0x2557b4(0x8a)],'datasetName':_0x23d793[_0x2557b4(0x89)],'error':_0x57e163,'progress':_0x16330a+'/'+_0x5837a6}),_0x2e6d54[_0x2557b4(0x7a)]({'datasetCode':_0x23d793[_0x2557b4(0x8a)],'datasetName':_0x23d793[_0x2557b4(0x89)],'filePath':'','success':![],'error':_0x57e163}),_0x16330a<_0x5837a6&&(console['log'](_0x2557b4(0x79)),await delay(0xbb8));}}return _0x2e6d54;}
1
+ const a4_0x4ed629=a4_0x2928;(function(_0x16c8c5,_0xa9b347){const _0x33ee57=a4_0x2928,_0x15ffd0=_0x16c8c5();while(!![]){try{const _0x4f8654=parseInt(_0x33ee57(0x19e))/0x1+parseInt(_0x33ee57(0x18b))/0x2*(parseInt(_0x33ee57(0x199))/0x3)+-parseInt(_0x33ee57(0x1a4))/0x4+parseInt(_0x33ee57(0x19f))/0x5*(parseInt(_0x33ee57(0x18e))/0x6)+-parseInt(_0x33ee57(0x192))/0x7+-parseInt(_0x33ee57(0x19b))/0x8+parseInt(_0x33ee57(0x19a))/0x9;if(_0x4f8654===_0xa9b347)break;else _0x15ffd0['push'](_0x15ffd0['shift']());}catch(_0x34fb82){_0x15ffd0['push'](_0x15ffd0['shift']());}}}(a4_0x4aaf,0xd7e7b));import{mkdirSync,writeFileSync}from'node:fs';import a4_0x54501a from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a4_0x4aaf(){const _0x26713c=['),HTTP状态码:\x20','tableName','4277294nkrfbC','application/json','获取文档失败\x20(','.md\x20(','stringify','✗\x20失败:\x20','status','177FDalYL','12627063HqZJmQ','11750120XkngcG','name','success','1508255otMusM','10mLmQMs','./docs','json','生成文档失败:\x20','):缺少\x20data.markdown\x20字段','3099580DAlOMi','length','log','datasetCode','message','push','join','data','api-doc','text','/api/node-toolbox/api-doc-generator','等待\x203\x20秒...\x0a','error','markdown','utf8','响应数据格式错误\x20(','生成文档成功:\x20','POST','3490HuMxoz',']\x20正在生成:\x20','string','2174496AJtsRm','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录'];a4_0x4aaf=function(){return _0x26713c;};return a4_0x4aaf();}import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x389bb7){const _0xe43d80=a4_0x2928,{appCode:_0x57223f,datasetCode:_0x309454,datasetId:_0x249edd,extraParams:_0x4fa99e}=_0x389bb7,_0x5f0d7b=getApiDomain(),_0x36ab37=_0x5f0d7b+_0xe43d80(0x1ae),_0x160b53={'appCode':_0x57223f,'datasetCode':_0x309454,'datasetId':_0x249edd,..._0x4fa99e||{}},_0x50eee0=await fetch(_0x36ab37,{'method':_0xe43d80(0x18a),'headers':{'Content-Type':_0xe43d80(0x193),'Cookie':getCookie()},'body':JSON[_0xe43d80(0x196)](_0x160b53)});if(!_0x50eee0['ok']){if(_0x50eee0[_0xe43d80(0x198)]===0x191)throw new Error(_0xe43d80(0x18f));let _0x26491b='';try{_0x26491b=await _0x50eee0[_0xe43d80(0x1ad)]();}catch(_0x4ee100){}throw new Error(_0xe43d80(0x194)+_0x309454+_0xe43d80(0x190)+_0x50eee0[_0xe43d80(0x198)]+(_0x26491b?'\x0a'+_0x26491b:''));}const _0x49586d=await _0x50eee0[_0xe43d80(0x1a1)]();if(!_0x49586d[_0xe43d80(0x1ab)]||typeof _0x49586d[_0xe43d80(0x1ab)][_0xe43d80(0x186)]!==_0xe43d80(0x18d))throw new Error(_0xe43d80(0x188)+_0x309454+_0xe43d80(0x1a3));return _0x49586d['data'][_0xe43d80(0x186)];}function a4_0x2928(_0x264f10,_0x360c36){_0x264f10=_0x264f10-0x185;const _0x4aaf6c=a4_0x4aaf();let _0x29287f=_0x4aaf6c[_0x264f10];return _0x29287f;}function delay(_0x1bb178){return new Promise(_0x49c127=>setTimeout(_0x49c127,_0x1bb178));}export async function generateDatasetDocs(_0x566b2b,_0x15553e,_0x58b2e3=a4_0x4ed629(0x1a0),_0x4c4785,_0x3171d1){const _0x282d18=a4_0x4ed629;mkdirSync(_0x58b2e3,{'recursive':!![]});const _0x107eb7=[],_0x671ba0=_0x566b2b[_0x282d18(0x1a5)];console[_0x282d18(0x1a6)]('\x0a共有\x20'+_0x671ba0+'\x20个数据集需要生成文档\x0a');for(let _0xbe3395=0x0;_0xbe3395<_0x566b2b[_0x282d18(0x1a5)];_0xbe3395++){const _0x16d72b=_0x566b2b[_0xbe3395],_0x4d67bc=_0xbe3395+0x1,_0x4205e0=_0x16d72b[_0x282d18(0x191)];try{console[_0x282d18(0x1a6)]('['+_0x4d67bc+'/'+_0x671ba0+_0x282d18(0x18c)+_0x4205e0+_0x282d18(0x195)+_0x16d72b[_0x282d18(0x19c)]+')');_0x4c4785&&_0x4c4785(_0x4d67bc,_0x671ba0,_0x4205e0);const _0x3c0ebb=await fetchDatasetDoc({'appCode':_0x15553e,'datasetCode':_0x16d72b[_0x282d18(0x1a7)],'datasetId':_0x16d72b['id'],'enableAI':![],'extraParams':_0x3171d1}),_0x51c3f6=a4_0x54501a[_0x282d18(0x1aa)](_0x58b2e3,_0x4205e0+'.md');writeFileSync(_0x51c3f6,_0x3c0ebb,{'encoding':_0x282d18(0x187)}),console[_0x282d18(0x1a6)]('✓\x20成功生成:\x20'+_0x4205e0+'.md'),logger[_0x282d18(0x19d)]('api-doc',_0x282d18(0x189)+_0x4205e0,undefined,{'datasetCode':_0x16d72b[_0x282d18(0x1a7)],'datasetName':_0x16d72b[_0x282d18(0x19c)],'filePath':_0x51c3f6,'progress':_0x4d67bc+'/'+_0x671ba0}),_0x107eb7[_0x282d18(0x1a9)]({'datasetCode':_0x16d72b[_0x282d18(0x1a7)],'datasetName':_0x16d72b['name'],'filePath':_0x51c3f6,'success':!![]}),_0x4d67bc<_0x671ba0&&await delay(0x1388);}catch(_0x1c109a){const _0x455c07=_0x1c109a instanceof Error?_0x1c109a[_0x282d18(0x1a8)]:String(_0x1c109a);console[_0x282d18(0x1a6)](_0x282d18(0x197)+_0x4205e0+'.md\x20-\x20'+_0x455c07+'\x0a'),logger[_0x282d18(0x185)](_0x282d18(0x1ac),_0x282d18(0x1a2)+_0x16d72b['datasetCode'],{'datasetCode':_0x16d72b['datasetCode'],'datasetName':_0x16d72b[_0x282d18(0x19c)],'error':_0x455c07,'progress':_0x4d67bc+'/'+_0x671ba0}),_0x107eb7[_0x282d18(0x1a9)]({'datasetCode':_0x16d72b[_0x282d18(0x1a7)],'datasetName':_0x16d72b[_0x282d18(0x19c)],'filePath':'','success':![],'error':_0x455c07}),_0x4d67bc<_0x671ba0&&(console['log'](_0x282d18(0x1af)),await delay(0xbb8));}}return _0x107eb7;}
@@ -1 +1 @@
1
- (function(_0x285ec1,_0x16916f){const _0x6f5c2a=a5_0x2886,_0x3def2d=_0x285ec1();while(!![]){try{const _0x26d128=-parseInt(_0x6f5c2a(0x215))/0x1+parseInt(_0x6f5c2a(0x202))/0x2*(parseInt(_0x6f5c2a(0x203))/0x3)+-parseInt(_0x6f5c2a(0x207))/0x4*(-parseInt(_0x6f5c2a(0x1e5))/0x5)+parseInt(_0x6f5c2a(0x1ed))/0x6+parseInt(_0x6f5c2a(0x1e4))/0x7+-parseInt(_0x6f5c2a(0x1f6))/0x8+-parseInt(_0x6f5c2a(0x1f1))/0x9;if(_0x26d128===_0x16916f)break;else _0x3def2d['push'](_0x3def2d['shift']());}catch(_0xba47c8){_0x3def2d['push'](_0x3def2d['shift']());}}}(a5_0x4c65,0xa1835));import{jsx as a5_0x9a267b,jsxs as a5_0x519fea}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a5_0x4c65(){const _0x356b00=['5520508KUpDcW','905hZNzZB','./src/api/','api-pull','*\x20导入方式:','includes','\x20个模型)','api','-client','6839088GxlkrT','\x20个模型','length','-\x20模型配置文件\x20(','22041000IWIwYJ','env','💡\x20请使用\x20','√\x20成功拉取\x20','datasetCount','5187368GJOzsW','red','dim','!\x20原始数据集\x20','endsWith','使用指定的应用AppCode:\x20','cyan','\x20个数据集,生成','yellow','gray','column','lovrabet\x20auth','112612vyhjpz','66AUsauQ','online','replace','拉取\x20API\x20配置失败:\x20','17288EloiAD','message','\x20个,过滤重复','*\x20已生成文件:','setLogPath','client','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','\x20重新登录后再试','\x20from\x20\x27@/','\x20-\x20客户端实例文件','originalCount','join','.ts','modelCount','190528UCTBKV','white'];a5_0x4c65=function(){return _0x356b00;};return a5_0x4c65();}import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a5_0x2886(_0x1f78cf,_0x19fa9a){_0x1f78cf=_0x1f78cf-0x1e3;const _0x4c6577=a5_0x4c65();let _0x2886da=_0x4c6577[_0x1f78cf];return _0x2886da;}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x1b36c4,env:_0x31c4b7,output:_0x4c234f})=>{const _0x321ef6=a5_0x2886,{exit:_0x55a27e}=useApp(),[_0x15df25,_0x1cddaa]=useState(![]),[_0x3d0b54,_0x5defac]=useState(![]),[_0x121c2e,_0x383155]=useState(null),[_0xed771f,_0x509c68]=useState(null),_0x288fa5=readConfig(),_0x16a6b8=getConfigAppCode(),_0x5e59f2=_0x1b36c4||_0x16a6b8,_0x2a1780=typeof _0x288fa5?.['env']==='string'?_0x288fa5[_0x321ef6(0x1f2)]:undefined,_0x34fd20=_0x31c4b7||_0x2a1780||_0x321ef6(0x204);initEnv(_0x34fd20);const _0x4462b0=_0x4c234f||_0x321ef6(0x1e6),_0x5f1703=_0x1b36c4&&_0x1b36c4[_0x321ef6(0x1e9)]('-')?_0x1b36c4['split']('-')['slice'](0x1)[_0x321ef6(0x212)]('-'):'',_0x694533=_0x1b36c4?_0x321ef6(0x1fb)+_0x5e59f2:'使用配置的应用AppCode:\x20'+_0x5e59f2,_0x3d4d7f=_0x5f1703?_0x5f1703+'-api':_0x321ef6(0x1eb),_0x13c16a=_0x5f1703?_0x5f1703+_0x321ef6(0x1ec):_0x321ef6(0x20c);useEffect(()=>{_0x1cddaa(!![]),_0x5a6f5f();},[]),useEffect(()=>{(_0x3d0b54||_0x121c2e)&&_0x55a27e();},[_0x3d0b54,_0x121c2e,_0x55a27e]);async function _0x5a6f5f(){const _0x54b13d=_0x321ef6;if(!_0x5e59f2){_0x383155('未提供应用AppCode,且配置中也没有默认值');return;}try{logger[_0x54b13d(0x20b)](process['cwd']());const {configArray:_0x11dc3b}=await fetchModelList(_0x5e59f2),_0x4ca3ad=_0x11dc3b[_0x54b13d(0x1ef)],_0x49812c=!_0x1b36c4,_0x13721a=await generateApiFile(_0x11dc3b,_0x5f1703,_0x5e59f2,_0x49812c,_0x34fd20,_0x4462b0),_0x48739a=_0x4462b0[_0x54b13d(0x1fa)]('/')?_0x4462b0:_0x4462b0+'/';_0x509c68({'api':''+_0x48739a+_0x3d4d7f+_0x54b13d(0x213),'client':''+_0x48739a+_0x13c16a+'.ts','modelCount':_0x13721a['modelCount'],'datasetCount':_0x4ca3ad,'originalCount':_0x4ca3ad,'duplicateCount':0x0}),_0x5defac(!![]);}catch(_0x5b2951){const _0x53b52a=_0x5b2951 instanceof Error?_0x5b2951[_0x54b13d(0x208)]:String(_0x5b2951);logger['error'](_0x54b13d(0x1e7),'拉取\x20API\x20配置失败:\x20'+_0x53b52a,{'appCode':_0x5e59f2,'error':_0x53b52a}),_0x383155(_0x54b13d(0x206)+_0x53b52a);}finally{_0x1cddaa(![]);}}return a5_0x519fea(Box,{'flexDirection':_0x321ef6(0x200),'children':[(_0x15df25||_0x3d0b54)&&a5_0x519fea(Box,{'children':[a5_0x9a267b(Text,{'color':_0x321ef6(0x1ff),'children':'*\x20'}),a5_0x9a267b(Text,{'color':_0x1b36c4?_0x321ef6(0x1e3):_0x321ef6(0x1f8),'children':_0x694533})]}),_0x15df25&&a5_0x9a267b(Box,{'children':a5_0x519fea(Text,{'children':[_0x321ef6(0x20d),_0x34fd20,')']})}),_0x3d0b54&&_0xed771f&&a5_0x519fea(Box,{'flexDirection':_0x321ef6(0x200),'children':[a5_0x9a267b(Box,{'children':a5_0x519fea(Text,{'color':'green','children':[_0x321ef6(0x1f4),_0xed771f[_0x321ef6(0x1f5)],_0x321ef6(0x1fd),'\x20',_0xed771f['modelCount'],_0x321ef6(0x1ee)]})}),_0xed771f['duplicateCount']>0x0&&a5_0x9a267b(Box,{'marginTop':0x1,'children':a5_0x519fea(Text,{'color':_0x321ef6(0x1fe),'children':[_0x321ef6(0x1f9),_0xed771f[_0x321ef6(0x211)],_0x321ef6(0x209),'\x20',_0xed771f['duplicateCount'],'\x20个']})}),a5_0x9a267b(Box,{'marginTop':0x1,'children':a5_0x9a267b(Text,{'color':_0x321ef6(0x1ff),'children':_0x321ef6(0x20a)})}),a5_0x519fea(Box,{'marginLeft':0x2,'children':[a5_0x519fea(Text,{'color':_0x321ef6(0x1fc),'children':['•\x20',_0xed771f[_0x321ef6(0x1eb)]]}),a5_0x519fea(Text,{'color':_0x321ef6(0x1f8),'children':['\x20',_0x321ef6(0x1f0),_0xed771f[_0x321ef6(0x214)],_0x321ef6(0x1ea)]})]}),a5_0x519fea(Box,{'marginLeft':0x2,'children':[a5_0x519fea(Text,{'color':_0x321ef6(0x1fc),'children':['•\x20',_0xed771f[_0x321ef6(0x20c)]]}),a5_0x9a267b(Text,{'color':_0x321ef6(0x1f8),'children':_0x321ef6(0x210)})]}),a5_0x9a267b(Box,{'marginTop':0x1,'children':a5_0x9a267b(Text,{'color':'gray','children':_0x321ef6(0x1e8)})}),a5_0x9a267b(Box,{'marginLeft':0x2,'children':a5_0x519fea(Text,{'color':_0x321ef6(0x1fe),'children':['import\x20','{\x20lovrabetClient\x20}',_0x321ef6(0x20f),_0xed771f[_0x321ef6(0x20c)][_0x321ef6(0x205)](/^\.\//,'')[_0x321ef6(0x205)]('.ts',''),'\x27']})})]}),_0x121c2e&&a5_0x519fea(Box,{'flexDirection':_0x321ef6(0x200),'children':[a5_0x9a267b(Box,{'children':a5_0x519fea(Text,{'color':_0x321ef6(0x1f7),'children':['❌\x20',_0x121c2e]})}),_0x121c2e[_0x321ef6(0x1e9)]('登录')&&a5_0x519fea(Box,{'marginTop':0x1,'children':[a5_0x9a267b(Text,{'color':_0x321ef6(0x1fe),'children':_0x321ef6(0x1f3)}),a5_0x9a267b(Text,{'color':_0x321ef6(0x1fc),'children':_0x321ef6(0x201)}),a5_0x9a267b(Text,{'color':'yellow','children':_0x321ef6(0x20e)})]})]})]});};
1
+ (function(_0x58f5e4,_0x34f2fc){const _0x65823b=a5_0x3d65,_0x5d9f52=_0x58f5e4();while(!![]){try{const _0x1c3bd9=-parseInt(_0x65823b(0x164))/0x1+-parseInt(_0x65823b(0x13e))/0x2+-parseInt(_0x65823b(0x162))/0x3+-parseInt(_0x65823b(0x146))/0x4*(parseInt(_0x65823b(0x142))/0x5)+parseInt(_0x65823b(0x148))/0x6*(parseInt(_0x65823b(0x158))/0x7)+parseInt(_0x65823b(0x149))/0x8*(-parseInt(_0x65823b(0x156))/0x9)+parseInt(_0x65823b(0x165))/0xa;if(_0x1c3bd9===_0x34f2fc)break;else _0x5d9f52['push'](_0x5d9f52['shift']());}catch(_0x1275ee){_0x5d9f52['push'](_0x5d9f52['shift']());}}}(a5_0x26c5,0xb88e5));import{jsx as a5_0x59013c,jsxs as a5_0xe5e94a}from'react/jsx-runtime';function a5_0x26c5(){const _0x5b3dfd=['-api','lovrabet\x20auth','split','online','cwd','-client','gray','💡\x20请使用\x20','replace','endsWith','557116WVqZZT','white','未提供应用AppCode,且配置中也没有默认值','使用指定的应用AppCode:\x20','10GbqjCZ','\x20个模型)','拉取\x20API\x20配置失败:\x20','api','560440caBgXK','{\x20lovrabetClient\x20}','6daiEVU','20872KXjRHH','green','yellow','\x20-\x20客户端实例文件','includes','-\x20模型配置文件\x20(','setLogPath','dim','api-pull','\x20个模型','cyan','modelCount','\x20个,过滤重复','2853msIwZI','*\x20导入方式:','1336055reVvVA','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','env','import\x20','column','join','red','client','\x20重新登录后再试','duplicateCount','1050228olZqJh','message','968344FfMIeO','32693270UYfuWT','.ts','*\x20已生成文件:','datasetCount','slice','\x20个数据集,生成','√\x20成功拉取\x20'];a5_0x26c5=function(){return _0x5b3dfd;};return a5_0x26c5();}import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a5_0x3d65(_0x2176c9,_0x5bc510){_0x2176c9=_0x2176c9-0x13b;const _0x26c5b1=a5_0x26c5();let _0x3d650e=_0x26c5b1[_0x2176c9];return _0x3d650e;}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x41c458,env:_0x267722,output:_0x3a6c83})=>{const _0x3aa4a2=a5_0x3d65,{exit:_0x2e1b93}=useApp(),[_0x96d232,_0x368317]=useState(![]),[_0x5e400e,_0x17eb5d]=useState(![]),[_0x594458,_0x3530ec]=useState(null),[_0x2deea0,_0x3abf16]=useState(null),_0x139eff=readConfig(),_0x3fb1e4=getConfigAppCode(),_0x3a4adb=_0x41c458||_0x3fb1e4,_0x4469d7=typeof _0x139eff?.[_0x3aa4a2(0x15a)]==='string'?_0x139eff[_0x3aa4a2(0x15a)]:undefined,_0x4b74b9=_0x267722||_0x4469d7||_0x3aa4a2(0x16f);initEnv(_0x4b74b9);const _0x4846f7=_0x3a6c83||'./src/api/',_0x50e351=_0x41c458&&_0x41c458[_0x3aa4a2(0x14d)]('-')?_0x41c458[_0x3aa4a2(0x16e)]('-')[_0x3aa4a2(0x169)](0x1)[_0x3aa4a2(0x15d)]('-'):'',_0x3dfae5=_0x41c458?_0x3aa4a2(0x141)+_0x3a4adb:'使用配置的应用AppCode:\x20'+_0x3a4adb,_0x44b7b8=_0x50e351?_0x50e351+_0x3aa4a2(0x16c):_0x3aa4a2(0x145),_0x453c51=_0x50e351?_0x50e351+_0x3aa4a2(0x171):_0x3aa4a2(0x15f);useEffect(()=>{_0x368317(!![]),_0x4f7d1d();},[]),useEffect(()=>{(_0x5e400e||_0x594458)&&_0x2e1b93();},[_0x5e400e,_0x594458,_0x2e1b93]);async function _0x4f7d1d(){const _0x4200f0=_0x3aa4a2;if(!_0x3a4adb){_0x3530ec(_0x4200f0(0x140));return;}try{logger[_0x4200f0(0x14f)](process[_0x4200f0(0x170)]());const {configArray:_0x877f35}=await fetchModelList(_0x3a4adb),_0x5984df=_0x877f35['length'],_0x4087f4=!_0x41c458,_0x361a5b=await generateApiFile(_0x877f35,_0x50e351,_0x3a4adb,_0x4087f4,_0x4b74b9,_0x4846f7),_0x26a10d=_0x4846f7[_0x4200f0(0x13d)]('/')?_0x4846f7:_0x4846f7+'/';_0x3abf16({'api':''+_0x26a10d+_0x44b7b8+_0x4200f0(0x166),'client':''+_0x26a10d+_0x453c51+_0x4200f0(0x166),'modelCount':_0x361a5b['modelCount'],'datasetCount':_0x5984df,'originalCount':_0x5984df,'duplicateCount':0x0}),_0x17eb5d(!![]);}catch(_0x43e577){const _0x1c4102=_0x43e577 instanceof Error?_0x43e577[_0x4200f0(0x163)]:String(_0x43e577);logger['error'](_0x4200f0(0x151),'拉取\x20API\x20配置失败:\x20'+_0x1c4102,{'appCode':_0x3a4adb,'error':_0x1c4102}),_0x3530ec(_0x4200f0(0x144)+_0x1c4102);}finally{_0x368317(![]);}}return a5_0xe5e94a(Box,{'flexDirection':_0x3aa4a2(0x15c),'children':[(_0x96d232||_0x5e400e)&&a5_0xe5e94a(Box,{'children':[a5_0x59013c(Text,{'color':_0x3aa4a2(0x172),'children':'*\x20'}),a5_0x59013c(Text,{'color':_0x41c458?_0x3aa4a2(0x13f):'dim','children':_0x3dfae5})]}),_0x96d232&&a5_0x59013c(Box,{'children':a5_0xe5e94a(Text,{'children':[_0x3aa4a2(0x159),_0x4b74b9,')']})}),_0x5e400e&&_0x2deea0&&a5_0xe5e94a(Box,{'flexDirection':_0x3aa4a2(0x15c),'children':[a5_0x59013c(Box,{'children':a5_0xe5e94a(Text,{'color':_0x3aa4a2(0x14a),'children':[_0x3aa4a2(0x16b),_0x2deea0[_0x3aa4a2(0x168)],_0x3aa4a2(0x16a),'\x20',_0x2deea0[_0x3aa4a2(0x154)],_0x3aa4a2(0x152)]})}),_0x2deea0['duplicateCount']>0x0&&a5_0x59013c(Box,{'marginTop':0x1,'children':a5_0xe5e94a(Text,{'color':'yellow','children':['!\x20原始数据集\x20',_0x2deea0['originalCount'],_0x3aa4a2(0x155),'\x20',_0x2deea0[_0x3aa4a2(0x161)],'\x20个']})}),a5_0x59013c(Box,{'marginTop':0x1,'children':a5_0x59013c(Text,{'color':_0x3aa4a2(0x172),'children':_0x3aa4a2(0x167)})}),a5_0xe5e94a(Box,{'marginLeft':0x2,'children':[a5_0xe5e94a(Text,{'color':_0x3aa4a2(0x153),'children':['•\x20',_0x2deea0[_0x3aa4a2(0x145)]]}),a5_0xe5e94a(Text,{'color':'dim','children':['\x20',_0x3aa4a2(0x14e),_0x2deea0['modelCount'],_0x3aa4a2(0x143)]})]}),a5_0xe5e94a(Box,{'marginLeft':0x2,'children':[a5_0xe5e94a(Text,{'color':'cyan','children':['•\x20',_0x2deea0['client']]}),a5_0x59013c(Text,{'color':_0x3aa4a2(0x150),'children':_0x3aa4a2(0x14c)})]}),a5_0x59013c(Box,{'marginTop':0x1,'children':a5_0x59013c(Text,{'color':_0x3aa4a2(0x172),'children':_0x3aa4a2(0x157)})}),a5_0x59013c(Box,{'marginLeft':0x2,'children':a5_0xe5e94a(Text,{'color':_0x3aa4a2(0x14b),'children':[_0x3aa4a2(0x15b),_0x3aa4a2(0x147),'\x20from\x20\x27@/',_0x2deea0['client'][_0x3aa4a2(0x13c)](/^\.\//,'')[_0x3aa4a2(0x13c)](_0x3aa4a2(0x166),''),'\x27']})})]}),_0x594458&&a5_0xe5e94a(Box,{'flexDirection':_0x3aa4a2(0x15c),'children':[a5_0x59013c(Box,{'children':a5_0xe5e94a(Text,{'color':_0x3aa4a2(0x15e),'children':['❌\x20',_0x594458]})}),_0x594458['includes']('登录')&&a5_0xe5e94a(Box,{'marginTop':0x1,'children':[a5_0x59013c(Text,{'color':_0x3aa4a2(0x14b),'children':_0x3aa4a2(0x13b)}),a5_0x59013c(Text,{'color':_0x3aa4a2(0x153),'children':_0x3aa4a2(0x16d)}),a5_0x59013c(Text,{'color':_0x3aa4a2(0x14b),'children':_0x3aa4a2(0x160)})]})]})]});};
@@ -1 +1 @@
1
- (function(_0x46b89b,_0x618040){const _0x2d6127=a6_0x3266,_0x17878d=_0x46b89b();while(!![]){try{const _0x50db9a=parseInt(_0x2d6127(0x174))/0x1*(-parseInt(_0x2d6127(0x172))/0x2)+-parseInt(_0x2d6127(0x178))/0x3*(-parseInt(_0x2d6127(0x17e))/0x4)+parseInt(_0x2d6127(0x171))/0x5+-parseInt(_0x2d6127(0x17a))/0x6*(parseInt(_0x2d6127(0x17c))/0x7)+-parseInt(_0x2d6127(0x181))/0x8+parseInt(_0x2d6127(0x16d))/0x9+parseInt(_0x2d6127(0x179))/0xa;if(_0x50db9a===_0x618040)break;else _0x17878d['push'](_0x17878d['shift']());}catch(_0x7bd81e){_0x17878d['push'](_0x17878d['shift']());}}}(a6_0x45d5,0x7c6b5));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a6_0x45d5(){const _0x246658=['32254esmucY','json','7UhpHIF','&otype=array','configArray','获取数据集失败,HTTP状态码:\x20','9szYole','8098720LyQAQO','6mhWneQ','success','752759ryzMlh','status','81404oELslQ','count','data','5775208MGwxTy','fetch-model-list','554778eZjLrR','获取数据集失败:\x20','message','/api/node-toolbox/dataset/model-list?appcode=','2596905fRdHUn'];a6_0x45d5=function(){return _0x246658;};return a6_0x45d5();}import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';function a6_0x3266(_0x20c650,_0x278bc9){_0x20c650=_0x20c650-0x16c;const _0x45d59d=a6_0x45d5();let _0x32660b=_0x45d59d[_0x20c650];return _0x32660b;}export async function fetchModelList(_0x4dc35e){const _0x494612=a6_0x3266,_0x247614=getEnv(),_0x4c0377=getApiDomain()+_0x494612(0x170)+_0x4dc35e+_0x494612(0x175);logger['info'](_0x494612(0x16c),'正在从服务器拉取模型列表...\x20(环境:\x20'+_0x247614+')',{'apiUrl':_0x4c0377});const _0x23e795=await fetch(_0x4c0377,{'headers':{'Cookie':getCookie()}});if(!_0x23e795['ok']){if(_0x23e795[_0x494612(0x17d)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');throw new Error(_0x494612(0x177)+_0x23e795[_0x494612(0x17d)]);}const _0xaa3394=await _0x23e795[_0x494612(0x173)]();if(!_0xaa3394[_0x494612(0x17b)])throw new Error(_0x494612(0x16e)+(_0xaa3394[_0x494612(0x16f)]||'未知错误'));return{'configArray':_0xaa3394[_0x494612(0x180)][_0x494612(0x176)],'count':_0xaa3394[_0x494612(0x180)][_0x494612(0x17f)]};}
1
+ (function(_0x1056a0,_0x2f5f4e){const _0x4ef780=a6_0x2ec2,_0x1024ee=_0x1056a0();while(!![]){try{const _0x2b4200=-parseInt(_0x4ef780(0x154))/0x1+parseInt(_0x4ef780(0x148))/0x2*(parseInt(_0x4ef780(0x15b))/0x3)+parseInt(_0x4ef780(0x157))/0x4+parseInt(_0x4ef780(0x14a))/0x5+parseInt(_0x4ef780(0x14d))/0x6+parseInt(_0x4ef780(0x151))/0x7*(-parseInt(_0x4ef780(0x159))/0x8)+parseInt(_0x4ef780(0x140))/0x9*(parseInt(_0x4ef780(0x13f))/0xa);if(_0x2b4200===_0x2f5f4e)break;else _0x1024ee['push'](_0x1024ee['shift']());}catch(_0x3c9bcf){_0x1024ee['push'](_0x1024ee['shift']());}}}(a6_0xb495,0x4e71e));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a6_0x2ec2(_0x30e03a,_0x7c561f){_0x30e03a=_0x30e03a-0x13f;const _0xb4953e=a6_0xb495();let _0x2ec201=_0xb4953e[_0x30e03a];return _0x2ec201;}function a6_0xb495(){const _0x482ff9=['fetch-model-list','errorMsg','1451412vEeueH','获取数据集失败,HTTP状态码:\x20','code','info','8911dalyjU','count','configArray','313329iLIlwW','includes','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','444244vVtefk','error','2800NdGnYq','success','3rkSAJw','UNAUTHORIZED','190jRgOpW','248895ShdkDN','status','正在从服务器拉取模型列表...\x20(环境:\x20','/api/node-toolbox/dataset/model-list?appcode=','401','data','Unauthorized','errorMessage','186812oKEzgd','message','541875pHTNxo'];a6_0xb495=function(){return _0x482ff9;};return a6_0xb495();}import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';export async function fetchModelList(_0x49cf2a){const _0x4ba4db=a6_0x2ec2,_0x652287=getEnv(),_0x384dc2=getApiDomain()+_0x4ba4db(0x143)+_0x49cf2a+'&otype=array';logger[_0x4ba4db(0x150)](_0x4ba4db(0x14b),_0x4ba4db(0x142)+_0x652287+')',{'apiUrl':_0x384dc2});const _0x43a007=await fetch(_0x384dc2,{'headers':{'Cookie':getCookie()}});if(!_0x43a007['ok']){if(_0x43a007['status']===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');throw new Error(_0x4ba4db(0x14e)+_0x43a007[_0x4ba4db(0x141)]);}const _0x2bb6ac=await _0x43a007['json']();if(!_0x2bb6ac[_0x4ba4db(0x15a)]){const _0x32f00c=_0x2bb6ac[_0x4ba4db(0x14c)]||_0x2bb6ac['message']||_0x2bb6ac[_0x4ba4db(0x145)]?.[_0x4ba4db(0x149)]||_0x2bb6ac[_0x4ba4db(0x147)]||_0x2bb6ac[_0x4ba4db(0x158)]||'未知错误';if(_0x32f00c[_0x4ba4db(0x155)](_0x4ba4db(0x144))||_0x32f00c[_0x4ba4db(0x155)](_0x4ba4db(0x146))||_0x32f00c[_0x4ba4db(0x155)]('登录')||_0x32f00c[_0x4ba4db(0x155)]('认证')||_0x2bb6ac['errorCode']===_0x4ba4db(0x15c)||_0x2bb6ac[_0x4ba4db(0x14f)]===0x191||_0x2bb6ac['code']===_0x4ba4db(0x144))throw new Error(_0x4ba4db(0x156));throw new Error('获取数据集失败:\x20'+_0x32f00c);}return{'configArray':_0x2bb6ac[_0x4ba4db(0x145)][_0x4ba4db(0x153)],'count':_0x2bb6ac[_0x4ba4db(0x145)][_0x4ba4db(0x152)]};}
@@ -1 +1 @@
1
- function a7_0xc9f5(_0x420b19,_0xc3f0b0){_0x420b19=_0x420b19-0xb2;const _0x5a86a5=a7_0x5a86();let _0xc9f5cc=_0x5a86a5[_0x420b19];return _0xc9f5cc;}const a7_0x50cfe8=a7_0xc9f5;(function(_0x4072f1,_0x31a015){const _0x2378fc=a7_0xc9f5,_0x42a5b3=_0x4072f1();while(!![]){try{const _0xd92b5=-parseInt(_0x2378fc(0xc2))/0x1+-parseInt(_0x2378fc(0xca))/0x2+parseInt(_0x2378fc(0xd1))/0x3+-parseInt(_0x2378fc(0xd3))/0x4*(-parseInt(_0x2378fc(0xcd))/0x5)+-parseInt(_0x2378fc(0xc9))/0x6*(-parseInt(_0x2378fc(0xd5))/0x7)+parseInt(_0x2378fc(0xc0))/0x8*(parseInt(_0x2378fc(0xd4))/0x9)+-parseInt(_0x2378fc(0xc3))/0xa;if(_0xd92b5===_0x31a015)break;else _0x42a5b3['push'](_0x42a5b3['shift']());}catch(_0x1e3e08){_0x42a5b3['push'](_0x42a5b3['shift']());}}}(a7_0x5a86,0xbfb85));import a7_0x10c932 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x295cfe from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a7_0x5a86(){const _0x23902f=['replaceApiContent','client.ts.tpl','string','24fpaRut','success','893582nZyAMF','21139930ZHolhJ','env',',\x20env:\x20\x22','datasetCode','-api','forEach','72GSXUxs','2052746OkALGm','.ts','alias','3295mIXXix','format','utf8','CONFIG_NAMES.DEFAULT','3530514TKOaaw','client','4528GazLnO','4403169aGvYUV','833399kZSnyu','./src/api/','endsWith','typescript','api.ts.tpl','app','{\x20apiConfigName:\x20','api','resolve','-client','API\x20文件生成成功!','join','../..','online','init-api','tableName'];a7_0x5a86=function(){return _0x23902f;};return a7_0x5a86();}import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x4271d7,_0x53bcb1='',_0x3bdb4b,_0x58ee5d=![],_0x6e4fbd,_0x1a578d=a7_0x50cfe8(0xd6)){const _0x1c3217=a7_0x50cfe8,_0x1c2b40=readConfig(),_0x2058ad=_0x3bdb4b||_0x1c2b40?.[_0x1c3217(0xb2)];if(typeof _0x2058ad!==_0x1c3217(0xbf)||!_0x2058ad)throw new Error('请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code');const _0x490304=_0x58ee5d?_0x1c3217(0xd0):'\x22'+_0x2058ad+'\x22',_0xac0dee=typeof _0x1c2b40['env']===_0x1c3217(0xbf)?_0x1c2b40[_0x1c3217(0xc4)]:undefined,_0x221bf3=_0x6e4fbd||_0xac0dee||_0x1c3217(0xba),_0x4c404b=_0x221bf3!=='online';let _0x2a02f1;if(_0x58ee5d)_0x4c404b?_0x2a02f1=_0x1c3217(0xb3)+_0x490304+',\x20env:\x20\x22'+_0x221bf3+'\x22\x20}':_0x2a02f1='';else{const _0x26d7fc=_0x4c404b?_0x1c3217(0xc5)+_0x221bf3+'\x22':'';_0x2a02f1='{\x20apiConfigName:\x20\x22'+_0x2058ad+'\x22'+_0x26d7fc+'\x20}';}const _0x464f5b=_0x53bcb1?_0x53bcb1+_0x1c3217(0xc7):_0x1c3217(0xb4),_0x5b00e3=_0x53bcb1?_0x53bcb1+_0x1c3217(0xb6):_0x1c3217(0xd2),_0x1287e3=[];_0x4271d7[_0x1c3217(0xc8)](_0x31b1a3=>{const _0x25b3a4=_0x1c3217;_0x1287e3['push']({'datasetCode':_0x31b1a3[_0x25b3a4(0xc6)],'tableName':_0x31b1a3[_0x25b3a4(0xbc)],'name':_0x31b1a3['name']||'','alias':_0x31b1a3[_0x25b3a4(0xcc)]||_0x31b1a3['key']});});const _0x1ec834=fileURLToPath(import.meta.url),_0x1cfc3a=a7_0x295cfe[_0x1c3217(0xb5)](a7_0x295cfe['dirname'](_0x1ec834),_0x1c3217(0xb9)),_0x9d57aa=a7_0x295cfe[_0x1c3217(0xb8)](_0x1cfc3a,'templates/generate-api'),_0x8965b3=a7_0x295cfe[_0x1c3217(0xb8)](_0x9d57aa,_0x1c3217(0xd9)),_0x327bb4=a7_0x295cfe[_0x1c3217(0xb8)](_0x9d57aa,_0x1c3217(0xbe)),_0x2ee6bd=_0x1a578d[_0x1c3217(0xd7)]('/')?_0x1a578d['slice'](0x0,-0x1):_0x1a578d;mkdirSync(_0x2ee6bd,{'recursive':!![]});const _0x3944b3=_0x1287e3[0x0]?.['alias'],_0x466288=readFileSync(_0x8965b3,_0x1c3217(0xcf)),_0x20ef5a=TemplateReplacer[_0x1c3217(0xbd)](_0x466288,_0x2058ad,_0x1287e3,_0x3944b3,_0x464f5b,_0x490304),_0x2d843e=await a7_0x10c932[_0x1c3217(0xce)](_0x20ef5a,{'parser':'typescript'}),_0x1debf8=_0x2ee6bd+'/'+_0x464f5b+_0x1c3217(0xcb);writeFileSync(_0x1debf8,_0x2d843e,{'encoding':_0x1c3217(0xcf)});const _0xa0400=readFileSync(_0x327bb4,_0x1c3217(0xcf)),_0x190782=TemplateReplacer[_0x1c3217(0xbd)](_0xa0400,_0x2058ad,_0x1287e3,_0x3944b3,_0x464f5b,_0x490304,_0x2a02f1),_0x599b08=await a7_0x10c932[_0x1c3217(0xce)](_0x190782,{'parser':_0x1c3217(0xd8)}),_0x3486ed=_0x2ee6bd+'/'+_0x5b00e3+_0x1c3217(0xcb);writeFileSync(_0x3486ed,_0x599b08,{'encoding':'utf8'});const _0x4c2d8d=_0x1287e3['length'];return logger[_0x1c3217(0xc1)](_0x1c3217(0xbb),_0x1c3217(0xb7),undefined,{'apiFile':_0x1debf8,'clientFile':_0x3486ed,'modelCount':_0x4c2d8d,'configName':_0x490304}),{'modelCount':_0x4c2d8d,'apiFilePath':_0x1debf8,'clientFilePath':_0x3486ed,'configName':_0x490304};}
1
+ const a7_0xf613ee=a7_0x3824;(function(_0xc0b040,_0xa1930a){const _0x9cc191=a7_0x3824,_0x4f8c0d=_0xc0b040();while(!![]){try{const _0x4f8f08=parseInt(_0x9cc191(0x149))/0x1*(-parseInt(_0x9cc191(0x138))/0x2)+-parseInt(_0x9cc191(0x151))/0x3*(parseInt(_0x9cc191(0x133))/0x4)+parseInt(_0x9cc191(0x148))/0x5+-parseInt(_0x9cc191(0x12f))/0x6+-parseInt(_0x9cc191(0x14a))/0x7+parseInt(_0x9cc191(0x141))/0x8+parseInt(_0x9cc191(0x145))/0x9;if(_0x4f8f08===_0xa1930a)break;else _0x4f8c0d['push'](_0x4f8c0d['shift']());}catch(_0x2c3aca){_0x4f8c0d['push'](_0x4f8c0d['shift']());}}}(a7_0x2039,0x24a02));import a7_0x9f1c77 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x4ea615 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a7_0x2039(){const _0x11e3ec=['client.ts.tpl','client','dirname','utf8','\x22\x20}','794856RuYqpK','./src/api/','app','join','6460137iiiCst','init-api','format','310155vSVUYH','58513IDTYyo','741048heLyVp','length','key','alias','forEach','{\x20apiConfigName:\x20','online','27CfUCFf','resolve','-api','typescript','templates/generate-api','name','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','1436700XJtQIB','.ts','push','tableName','118588fNTpKR','endsWith','success','replaceApiContent','slice','4MSvMlF','string',',\x20env:\x20\x22','env'];a7_0x2039=function(){return _0x11e3ec;};return a7_0x2039();}import{TemplateReplacer}from'../utils/template-replacer.js';function a7_0x3824(_0x505222,_0x291fde){_0x505222=_0x505222-0x12d;const _0x203962=a7_0x2039();let _0x38242f=_0x203962[_0x505222];return _0x38242f;}import{logger}from'../utils/logger.js';export async function generateApiFile(_0x5edc0d,_0x69b61='',_0x2e4b18,_0x104c19=![],_0x58cb78,_0x321f91=a7_0xf613ee(0x142)){const _0x19c277=a7_0xf613ee,_0x431499=readConfig(),_0x167bae=_0x2e4b18||_0x431499?.[_0x19c277(0x143)];if(typeof _0x167bae!==_0x19c277(0x139)||!_0x167bae)throw new Error(_0x19c277(0x12e));const _0x425376=_0x104c19?'CONFIG_NAMES.DEFAULT':'\x22'+_0x167bae+'\x22',_0x28bae3=typeof _0x431499['env']===_0x19c277(0x139)?_0x431499[_0x19c277(0x13b)]:undefined,_0x28ee81=_0x58cb78||_0x28bae3||_0x19c277(0x150),_0x42a703=_0x28ee81!=='online';let _0x308e66;if(_0x104c19)_0x42a703?_0x308e66=_0x19c277(0x14f)+_0x425376+_0x19c277(0x13a)+_0x28ee81+_0x19c277(0x140):_0x308e66='';else{const _0x1211fe=_0x42a703?_0x19c277(0x13a)+_0x28ee81+'\x22':'';_0x308e66='{\x20apiConfigName:\x20\x22'+_0x167bae+'\x22'+_0x1211fe+'\x20}';}const _0x3e636a=_0x69b61?_0x69b61+_0x19c277(0x153):'api',_0x3c03c6=_0x69b61?_0x69b61+'-client':_0x19c277(0x13d),_0x112409=[];_0x5edc0d[_0x19c277(0x14e)](_0x45adb4=>{const _0x5dbec5=_0x19c277;_0x112409[_0x5dbec5(0x131)]({'datasetCode':_0x45adb4['datasetCode'],'tableName':_0x45adb4[_0x5dbec5(0x132)],'name':_0x45adb4[_0x5dbec5(0x12d)]||'','alias':_0x45adb4[_0x5dbec5(0x14d)]||_0x45adb4[_0x5dbec5(0x14c)]});});const _0x440ca1=fileURLToPath(import.meta.url),_0x1c6d73=a7_0x4ea615[_0x19c277(0x152)](a7_0x4ea615[_0x19c277(0x13e)](_0x440ca1),'../..'),_0x4d58b8=a7_0x4ea615[_0x19c277(0x144)](_0x1c6d73,_0x19c277(0x155)),_0x2de126=a7_0x4ea615['join'](_0x4d58b8,'api.ts.tpl'),_0x4021a4=a7_0x4ea615['join'](_0x4d58b8,_0x19c277(0x13c)),_0x5c05b3=_0x321f91[_0x19c277(0x134)]('/')?_0x321f91[_0x19c277(0x137)](0x0,-0x1):_0x321f91;mkdirSync(_0x5c05b3,{'recursive':!![]});const _0x18e920=_0x112409[0x0]?.['alias'],_0x1bed9d=readFileSync(_0x2de126,_0x19c277(0x13f)),_0x495759=TemplateReplacer[_0x19c277(0x136)](_0x1bed9d,_0x167bae,_0x112409,_0x18e920,_0x3e636a,_0x425376),_0x55a6e6=await a7_0x9f1c77[_0x19c277(0x147)](_0x495759,{'parser':_0x19c277(0x154)}),_0x52bb37=_0x5c05b3+'/'+_0x3e636a+_0x19c277(0x130);writeFileSync(_0x52bb37,_0x55a6e6,{'encoding':_0x19c277(0x13f)});const _0x257c1f=readFileSync(_0x4021a4,_0x19c277(0x13f)),_0x5a3e19=TemplateReplacer[_0x19c277(0x136)](_0x257c1f,_0x167bae,_0x112409,_0x18e920,_0x3e636a,_0x425376,_0x308e66),_0x1a8a60=await a7_0x9f1c77[_0x19c277(0x147)](_0x5a3e19,{'parser':_0x19c277(0x154)}),_0x5077b4=_0x5c05b3+'/'+_0x3c03c6+_0x19c277(0x130);writeFileSync(_0x5077b4,_0x1a8a60,{'encoding':'utf8'});const _0x3cddb3=_0x112409[_0x19c277(0x14b)];return logger[_0x19c277(0x135)](_0x19c277(0x146),'API\x20文件生成成功!',undefined,{'apiFile':_0x52bb37,'clientFile':_0x5077b4,'modelCount':_0x3cddb3,'configName':_0x425376}),{'modelCount':_0x3cddb3,'apiFilePath':_0x52bb37,'clientFilePath':_0x5077b4,'configName':_0x425376};}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0x352bd3,_0x14aadf){const _0x2b1b04=a8_0x54ca,_0x374676=_0x352bd3();while(!![]){try{const _0x7e65a9=-parseInt(_0x2b1b04(0x1af))/0x1+-parseInt(_0x2b1b04(0x19b))/0x2+-parseInt(_0x2b1b04(0x1ad))/0x3*(-parseInt(_0x2b1b04(0x199))/0x4)+parseInt(_0x2b1b04(0x1a8))/0x5*(-parseInt(_0x2b1b04(0x1b3))/0x6)+parseInt(_0x2b1b04(0x1a5))/0x7*(parseInt(_0x2b1b04(0x18a))/0x8)+-parseInt(_0x2b1b04(0x19c))/0x9+parseInt(_0x2b1b04(0x194))/0xa;if(_0x7e65a9===_0x14aadf)break;else _0x374676['push'](_0x374676['shift']());}catch(_0x3f8fc3){_0x374676['push'](_0x374676['shift']());}}}(a8_0x4114,0x5af66));import{jsx as a8_0x3574e5}from'react/jsx-runtime';function a8_0x4114(){const _0x3aead9=['\x20\x20错误:\x20','×\x20未配置\x20AppCode','657336UxripQ','input','message','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','请使用\x20--appcode\x20参数,例如:','pull','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','appcode','map','filter','11936090mcQFxJ','error','split','\x1b[90m*\x20使用配置的应用AppCode:\x20','object','114508ToOSrO','\x1b[0m','1324858CzaVPD','3519045xdavUh','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','string','\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配置文件','flags','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','×\x20--params\x20参数不是有效的\x20JSON\x20格式','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','42NOfmYX','doc','trim','90890WzYDIT','\x1b[90m*\x20仅生成指定数据集的文档:\x20','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','Unknown\x20api\x20command:\x20','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','27qLlrdy','isArray','500060GXouwL','log','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','output','6UmUcbb','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','❌\x20错误:不再支持位置参数方式','exit','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--datasetcode\x20<codes>\x20指定要生成文档的数据集代码(多个用逗号分隔,仅\x20doc\x20命令)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成所有数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20只生成指定数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20生成多个数据集的文档\x0a','help','length','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','env'];a8_0x4114=function(){return _0x3aead9;};return a8_0x4114();}import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';function a8_0x54ca(_0x351710,_0x202062){_0x351710=_0x351710-0x180;const _0x411458=a8_0x4114();let _0x54ca7a=_0x411458[_0x351710];return _0x54ca7a;}import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x4ea689){const _0x23f3d5=a8_0x54ca,_0x116fb0=_0x4ea689[_0x23f3d5(0x18b)][0x1];if(_0x4ea689[_0x23f3d5(0x1a1)][_0x23f3d5(0x184)]){console[_0x23f3d5(0x1b0)](_0x23f3d5(0x183));return;}if(_0x116fb0===_0x23f3d5(0x18f)){_0x4ea689[_0x23f3d5(0x18b)][0x2]&&(console['error'](_0x23f3d5(0x181)),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x18e)),console['log'](_0x23f3d5(0x190)+_0x4ea689[_0x23f3d5(0x18b)][0x2]),process['exit'](0x1));const _0x5561ff=getConfigAppCode();let _0x2be7f1=_0x4ea689['flags']['appcode'];const _0x14150b=typeof _0x4ea689['flags'][_0x23f3d5(0x187)]===_0x23f3d5(0x19f)?_0x4ea689['flags'][_0x23f3d5(0x187)]:undefined,_0x18f5c2=_0x4ea689['flags']['output'];!_0x2be7f1&&!_0x5561ff&&(console[_0x23f3d5(0x195)](_0x23f3d5(0x189)),console[_0x23f3d5(0x1b0)]('!\x20请使用以下方式之一:'),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x1ac)),console['log'](_0x23f3d5(0x18d)),process[_0x23f3d5(0x182)](0x1)),_0x2be7f1&&_0x5561ff&&_0x2be7f1===_0x5561ff&&(console[_0x23f3d5(0x1b0)]('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0x2be7f1+_0x23f3d5(0x19a)),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x186)),_0x2be7f1=undefined),render(a8_0x3574e5(ApiPullUI,{'appCode':_0x2be7f1,'env':_0x14150b,'output':_0x18f5c2}));}else{if(_0x116fb0===_0x23f3d5(0x1a6)){_0x4ea689[_0x23f3d5(0x18b)][0x2]&&(console[_0x23f3d5(0x195)](_0x23f3d5(0x181)),console[_0x23f3d5(0x1b0)]('请使用\x20--appcode\x20参数,例如:'),console['log'](_0x23f3d5(0x1b1)+_0x4ea689[_0x23f3d5(0x18b)][0x2]),process['exit'](0x1));const _0x3832e0=getConfigAppCode();let _0x234dbc=_0x4ea689[_0x23f3d5(0x1a1)][_0x23f3d5(0x191)];const _0x43afba=typeof _0x4ea689[_0x23f3d5(0x1a1)][_0x23f3d5(0x187)]===_0x23f3d5(0x19f)?_0x4ea689[_0x23f3d5(0x1a1)][_0x23f3d5(0x187)]:undefined,_0x460703=_0x4ea689[_0x23f3d5(0x1a1)][_0x23f3d5(0x1b2)],_0x272ec5=_0x4ea689[_0x23f3d5(0x1a1)]['params'],_0x431391=_0x4ea689['flags']['datasetcode'];!_0x234dbc&&!_0x3832e0&&(console[_0x23f3d5(0x195)](_0x23f3d5(0x189)),console['log']('!\x20请使用以下方式之一:'),console[_0x23f3d5(0x1b0)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x19d)),process['exit'](0x1));_0x234dbc&&_0x3832e0&&_0x234dbc===_0x3832e0&&(console[_0x23f3d5(0x1b0)](_0x23f3d5(0x197)+_0x234dbc+_0x23f3d5(0x19a)),_0x234dbc=undefined);let _0x5bc04e;if(_0x272ec5)try{_0x5bc04e=JSON['parse'](_0x272ec5),(typeof _0x5bc04e!==_0x23f3d5(0x198)||_0x5bc04e===null||Array[_0x23f3d5(0x1ae)](_0x5bc04e))&&(console['error']('×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象'),process[_0x23f3d5(0x182)](0x1));}catch(_0x53ec3d){console[_0x23f3d5(0x195)](_0x23f3d5(0x1a3)),console[_0x23f3d5(0x195)](_0x23f3d5(0x188)+(_0x53ec3d instanceof Error?_0x53ec3d[_0x23f3d5(0x18c)]:String(_0x53ec3d))),process[_0x23f3d5(0x182)](0x1);}let _0x5c1794;_0x431391&&(_0x5c1794=_0x431391[_0x23f3d5(0x196)](',')[_0x23f3d5(0x192)](_0x1fb61b=>_0x1fb61b[_0x23f3d5(0x1a7)]())[_0x23f3d5(0x193)](_0x4244a6=>_0x4244a6[_0x23f3d5(0x185)]>0x0),_0x5c1794[_0x23f3d5(0x185)]===0x0&&(console[_0x23f3d5(0x195)]('×\x20--datasetcode\x20参数不能为空'),process[_0x23f3d5(0x182)](0x1)),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x1a9)+_0x5c1794['join'](',\x20')+_0x23f3d5(0x19a))),render(a8_0x3574e5(ApiDocUI,{'appCode':_0x234dbc,'env':_0x43afba,'output':_0x460703,'extraParams':_0x5bc04e,'datasetCodes':_0x5c1794}));}else console['error'](_0x23f3d5(0x1ab)+_0x116fb0),console[_0x23f3d5(0x1b0)]('Available\x20commands:'),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x1a0)),console['log'](_0x23f3d5(0x180)),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x1aa)),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x19e)),console[_0x23f3d5(0x1b0)](''),console[_0x23f3d5(0x1b0)]('\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文档'),console['log'](_0x23f3d5(0x1a4)),console[_0x23f3d5(0x1b0)](_0x23f3d5(0x1a2)),console[_0x23f3d5(0x1b0)]('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process[_0x23f3d5(0x182)](0x1);}}
1
+ function a8_0x5d35(_0x49c680,_0x140c73){_0x49c680=_0x49c680-0x182;const _0x12ff4d=a8_0x12ff();let _0x5d354b=_0x12ff4d[_0x49c680];return _0x5d354b;}(function(_0x3ac2a0,_0x4d6ac1){const _0x4a9bf3=a8_0x5d35,_0x45cf68=_0x3ac2a0();while(!![]){try{const _0x583f93=-parseInt(_0x4a9bf3(0x199))/0x1+-parseInt(_0x4a9bf3(0x1ac))/0x2+-parseInt(_0x4a9bf3(0x19b))/0x3+-parseInt(_0x4a9bf3(0x1ae))/0x4*(parseInt(_0x4a9bf3(0x1a9))/0x5)+parseInt(_0x4a9bf3(0x194))/0x6*(-parseInt(_0x4a9bf3(0x1a8))/0x7)+-parseInt(_0x4a9bf3(0x191))/0x8+parseInt(_0x4a9bf3(0x19c))/0x9*(parseInt(_0x4a9bf3(0x195))/0xa);if(_0x583f93===_0x4d6ac1)break;else _0x45cf68['push'](_0x45cf68['shift']());}catch(_0x3693eb){_0x45cf68['push'](_0x45cf68['shift']());}}}(a8_0x12ff,0x4ab30));import{jsx as a8_0x475a5d}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';function a8_0x12ff(){const _0x44432c=['output','!\x20请使用以下方式之一:','map','filter','请使用\x20--appcode\x20参数,例如:','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','object','flags','params','input','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--datasetcode\x20<codes>\x20指定要生成文档的数据集代码(多个用逗号分隔,仅\x20doc\x20命令)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成所有数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20只生成指定数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20生成多个数据集的文档\x0a','log','isArray','env','2583352FUUXFn','Unknown\x20api\x20command:\x20','string','2043354ABejUh','130SyEnYu','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','split','86581SUpzLR','error','336216IjgPli','1522629mLEbTu','\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配置文件','datasetcode','×\x20--params\x20参数不是有效的\x20JSON\x20格式','parse','appcode','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','\x1b[0m','doc','trim','×\x20--datasetcode\x20参数不能为空','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','7vHXpTH','5CbAgTl','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','996580AoLSgQ','help','2131856qinjcB','length','❌\x20错误:不再支持位置参数方式','exit','\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文档','\x1b[90m*\x20使用配置的应用AppCode:\x20','message','join'];a8_0x12ff=function(){return _0x44432c;};return a8_0x12ff();}import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x36670c){const _0x18a53c=a8_0x5d35,_0x46d58b=_0x36670c[_0x18a53c(0x18c)][0x1];if(_0x36670c[_0x18a53c(0x18a)][_0x18a53c(0x1ad)]){console[_0x18a53c(0x18e)](_0x18a53c(0x18d));return;}if(_0x46d58b==='pull'){_0x36670c[_0x18a53c(0x18c)][0x2]&&(console['error'](_0x18a53c(0x1b0)),console['log'](_0x18a53c(0x186)),console[_0x18a53c(0x18e)]('\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20'+_0x36670c['input'][0x2]),process[_0x18a53c(0x1b1)](0x1));const _0x277e2b=getConfigAppCode();let _0x4abf91=_0x36670c[_0x18a53c(0x18a)][_0x18a53c(0x1a1)];const _0xc477ba=typeof _0x36670c[_0x18a53c(0x18a)]['env']===_0x18a53c(0x193)?_0x36670c['flags'][_0x18a53c(0x190)]:undefined,_0x120348=_0x36670c['flags']['output'];!_0x4abf91&&!_0x277e2b&&(console['error']('×\x20未配置\x20AppCode'),console['log'](_0x18a53c(0x183)),console[_0x18a53c(0x18e)](_0x18a53c(0x187)),console[_0x18a53c(0x18e)](_0x18a53c(0x196)),process[_0x18a53c(0x1b1)](0x1)),_0x4abf91&&_0x277e2b&&_0x4abf91===_0x277e2b&&(console[_0x18a53c(0x18e)](_0x18a53c(0x1b3)+_0x4abf91+'\x1b[0m'),console[_0x18a53c(0x18e)](_0x18a53c(0x197)),_0x4abf91=undefined),render(a8_0x475a5d(ApiPullUI,{'appCode':_0x4abf91,'env':_0xc477ba,'output':_0x120348}));}else{if(_0x46d58b===_0x18a53c(0x1a4)){_0x36670c[_0x18a53c(0x18c)][0x2]&&(console[_0x18a53c(0x19a)](_0x18a53c(0x1b0)),console['log'](_0x18a53c(0x186)),console['log'](_0x18a53c(0x1a2)+_0x36670c['input'][0x2]),process[_0x18a53c(0x1b1)](0x1));const _0x59f253=getConfigAppCode();let _0x586794=_0x36670c[_0x18a53c(0x18a)]['appcode'];const _0x3634e8=typeof _0x36670c['flags']['env']===_0x18a53c(0x193)?_0x36670c['flags'][_0x18a53c(0x190)]:undefined,_0x313b86=_0x36670c[_0x18a53c(0x18a)][_0x18a53c(0x182)],_0xa8088e=_0x36670c[_0x18a53c(0x18a)][_0x18a53c(0x18b)],_0x1e023a=_0x36670c[_0x18a53c(0x18a)][_0x18a53c(0x19e)];!_0x586794&&!_0x59f253&&(console[_0x18a53c(0x19a)]('×\x20未配置\x20AppCode'),console[_0x18a53c(0x18e)](_0x18a53c(0x183)),console[_0x18a53c(0x18e)](_0x18a53c(0x187)),console[_0x18a53c(0x18e)](_0x18a53c(0x188)),process['exit'](0x1));_0x586794&&_0x59f253&&_0x586794===_0x59f253&&(console[_0x18a53c(0x18e)]('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0x586794+_0x18a53c(0x1a3)),_0x586794=undefined);let _0x255433;if(_0xa8088e)try{_0x255433=JSON[_0x18a53c(0x1a0)](_0xa8088e),(typeof _0x255433!==_0x18a53c(0x189)||_0x255433===null||Array[_0x18a53c(0x18f)](_0x255433))&&(console[_0x18a53c(0x19a)]('×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象'),process['exit'](0x1));}catch(_0x229f2c){console[_0x18a53c(0x19a)](_0x18a53c(0x19f)),console[_0x18a53c(0x19a)]('\x20\x20错误:\x20'+(_0x229f2c instanceof Error?_0x229f2c[_0x18a53c(0x1b4)]:String(_0x229f2c))),process[_0x18a53c(0x1b1)](0x1);}let _0x531f33;_0x1e023a&&(_0x531f33=_0x1e023a[_0x18a53c(0x198)](',')[_0x18a53c(0x184)](_0x19f95f=>_0x19f95f[_0x18a53c(0x1a5)]())[_0x18a53c(0x185)](_0x58ebb9=>_0x58ebb9[_0x18a53c(0x1af)]>0x0),_0x531f33[_0x18a53c(0x1af)]===0x0&&(console[_0x18a53c(0x19a)](_0x18a53c(0x1a6)),process[_0x18a53c(0x1b1)](0x1)),console['log']('\x1b[90m*\x20仅生成指定数据集的文档:\x20'+_0x531f33[_0x18a53c(0x1b5)](',\x20')+'\x1b[0m')),render(a8_0x475a5d(ApiDocUI,{'appCode':_0x586794,'env':_0x3634e8,'output':_0x313b86,'extraParams':_0x255433,'datasetCodes':_0x531f33}));}else console['error'](_0x18a53c(0x192)+_0x46d58b),console[_0x18a53c(0x18e)]('Available\x20commands:'),console['log'](_0x18a53c(0x19d)),console['log']('\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode'),console['log']('\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)'),console[_0x18a53c(0x18e)]('\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),console['log'](''),console[_0x18a53c(0x18e)](_0x18a53c(0x1b2)),console[_0x18a53c(0x18e)](_0x18a53c(0x1ab)),console[_0x18a53c(0x18e)](_0x18a53c(0x1aa)),console[_0x18a53c(0x18e)](_0x18a53c(0x1a7)),process['exit'](0x1);}}
@@ -1 +1 @@
1
- (function(_0x42aec5,_0x249823){const _0x4d3690=a9_0x289f,_0x55906d=_0x42aec5();while(!![]){try{const _0x15bf83=-parseInt(_0x4d3690(0x114))/0x1+-parseInt(_0x4d3690(0x11b))/0x2+-parseInt(_0x4d3690(0x100))/0x3*(parseInt(_0x4d3690(0x116))/0x4)+parseInt(_0x4d3690(0x115))/0x5+parseInt(_0x4d3690(0xfe))/0x6*(parseInt(_0x4d3690(0x102))/0x7)+-parseInt(_0x4d3690(0x112))/0x8*(-parseInt(_0x4d3690(0x10d))/0x9)+-parseInt(_0x4d3690(0x120))/0xa;if(_0x15bf83===_0x249823)break;else _0x55906d['push'](_0x55906d['shift']());}catch(_0x318461){_0x55906d['push'](_0x55906d['shift']());}}}(a9_0x5db0,0xa27fb));import{readConfig}from'../utils/config.js';function a9_0x289f(_0x2affe0,_0x46d29b){_0x2affe0=_0x2affe0-0xfe;const _0x5db0f3=a9_0x5db0();let _0x289f9c=_0x5db0f3[_0x2affe0];return _0x289f9c;}import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a9_0x5db0(){const _0x3b7d0e=['message','1030648DqLUQJ','\x20个模型','371487bHMtbr','4490105yszgaG','461212zInode','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','API\x20配置拉取成功:\x20','client','.ts\x20-\x20模型配置文件','242756IxVQRJ','info','trim','error','*\x20开始生成\x20API\x20配置文件:','1903360iYhRrC','×\x20API\x20配置拉取异常:','103902HXlhNA','api','27CRuKQR','-api','133euTUmA','.ts\x20-\x20客户端实例文件','*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','cwd','-client','chdir','length','√\x20成功拉取\x20','log','*\x20正在处理\x20','\x20个数据集,生成\x20','81PAnaCv','\x20\x20\x20•\x20','env','create-api-pull'];a9_0x5db0=function(){return _0x3b7d0e;};return a9_0x5db0();}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x559273,_0x27b9b3,_0x2b6479,_0x2672b4){const _0x3948ca=a9_0x289f;let _0x1723b6;try{const _0x74f8d7=_0x27b9b3?.[_0x3948ca(0x11d)]()||'';if(_0x74f8d7){const _0x2d15d4=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x2d15d4['test'](_0x74f8d7))return console[_0x3948ca(0x11e)](_0x3948ca(0x117)),![];}_0x2b6479&&(_0x1723b6=process[_0x3948ca(0x105)](),process[_0x3948ca(0x107)](_0x2b6479));const _0x34f917=readConfig(),_0x136f4e=typeof _0x34f917[_0x3948ca(0x10f)]==='string'?_0x34f917[_0x3948ca(0x10f)]:undefined,_0x2351cb=_0x2672b4||_0x136f4e||'online';initEnv(_0x2351cb),console['log'](_0x3948ca(0x104)+_0x2351cb+')');const {configArray:_0x4d03ec}=await fetchModelList(_0x559273),_0x467363=_0x74f8d7?_0x74f8d7+_0x3948ca(0x101):_0x3948ca(0xff),_0x45e7dc=_0x74f8d7?_0x74f8d7+_0x3948ca(0x106):_0x3948ca(0x119);console['log'](_0x3948ca(0x11f)),console[_0x3948ca(0x10a)]('\x20\x20\x20•\x20'+_0x467363+_0x3948ca(0x11a)),console[_0x3948ca(0x10a)](_0x3948ca(0x10e)+_0x45e7dc+_0x3948ca(0x103)),console['log'](_0x3948ca(0x10b)+_0x4d03ec['length']+'\x20个数据集...');const _0x2a8147=await generateApiFile(_0x4d03ec,_0x74f8d7,_0x559273,!![],_0x2351cb);return console[_0x3948ca(0x10a)](_0x3948ca(0x109)+_0x4d03ec['length']+_0x3948ca(0x10c)+_0x2a8147['modelCount']+_0x3948ca(0x113)),_0x2b6479&&logger[_0x3948ca(0x11c)]('create-api-pull',_0x3948ca(0x118)+_0x559273,{'projectPath':_0x2b6479,'appCode':_0x559273,'datasetCount':_0x4d03ec[_0x3948ca(0x108)],'filePrefix':_0x74f8d7}),!![];}catch(_0x54041d){const _0x3a0a34=_0x54041d instanceof Error?_0x54041d[_0x3948ca(0x111)]:String(_0x54041d);return console[_0x3948ca(0x11e)](_0x3948ca(0x121),_0x3a0a34),_0x2b6479&&logger[_0x3948ca(0x11e)](_0x3948ca(0x110),'API\x20配置拉取异常:\x20'+_0x3a0a34,{'appCode':_0x559273,'projectPath':_0x2b6479}),![];}finally{_0x1723b6&&process[_0x3948ca(0x107)](_0x1723b6);}}
1
+ (function(_0x19ddbe,_0x4e8227){const _0x48ba45=a9_0x5dfb,_0x54c0ae=_0x19ddbe();while(!![]){try{const _0x464869=-parseInt(_0x48ba45(0x1d0))/0x1*(parseInt(_0x48ba45(0x1cb))/0x2)+-parseInt(_0x48ba45(0x1cc))/0x3+parseInt(_0x48ba45(0x1c3))/0x4*(parseInt(_0x48ba45(0x1d5))/0x5)+parseInt(_0x48ba45(0x1d3))/0x6+parseInt(_0x48ba45(0x1db))/0x7+-parseInt(_0x48ba45(0x1c8))/0x8+parseInt(_0x48ba45(0x1c6))/0x9;if(_0x464869===_0x4e8227)break;else _0x54c0ae['push'](_0x54c0ae['shift']());}catch(_0x9eedb0){_0x54c0ae['push'](_0x54c0ae['shift']());}}}(a9_0x338b,0x9e08b));function a9_0x338b(){const _0x6f5f22=['*\x20正在处理\x20','length','7136379rybSej','API\x20配置拉取成功:\x20','9736184mZzMrl','-api','.ts\x20-\x20模型配置文件','2JBndop','1020648gMLlgo','\x20\x20\x20•\x20','env','api','82139VFwVNS','create-api-pull','\x20个数据集,生成\x20','7643142nLjjnh','message','50YPWsnX','-client','trim','API\x20配置拉取异常:\x20','\x20个数据集...','log','98119AumXPn','*\x20开始生成\x20API\x20配置文件:','error','client','test','×\x20API\x20配置拉取异常:','string','√\x20成功拉取\x20','\x20个模型','82352dhnxKL'];a9_0x338b=function(){return _0x6f5f22;};return a9_0x338b();}function a9_0x5dfb(_0x11a9ce,_0x530b39){_0x11a9ce=_0x11a9ce-0x1c0;const _0x338baf=a9_0x338b();let _0x5dfbf1=_0x338baf[_0x11a9ce];return _0x5dfbf1;}import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x665b97,_0x4002ee,_0x452fa3,_0x6258bc){const _0x4c7fc6=a9_0x5dfb;let _0xee62c4;try{const _0x885fec=_0x4002ee?.[_0x4c7fc6(0x1d7)]()||'';if(_0x885fec){const _0x5ef045=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x5ef045[_0x4c7fc6(0x1df)](_0x885fec))return console[_0x4c7fc6(0x1dd)]('×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。'),![];}_0x452fa3&&(_0xee62c4=process['cwd'](),process['chdir'](_0x452fa3));const _0x69bf6=readConfig(),_0x8ab2a1=typeof _0x69bf6['env']===_0x4c7fc6(0x1c0)?_0x69bf6[_0x4c7fc6(0x1ce)]:undefined,_0x106a8b=_0x6258bc||_0x8ab2a1||'online';initEnv(_0x106a8b),console['log']('*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20'+_0x106a8b+')');const {configArray:_0x5dc474}=await fetchModelList(_0x665b97),_0x3f27f6=_0x885fec?_0x885fec+_0x4c7fc6(0x1c9):_0x4c7fc6(0x1cf),_0x9d75fc=_0x885fec?_0x885fec+_0x4c7fc6(0x1d6):_0x4c7fc6(0x1de);console[_0x4c7fc6(0x1da)](_0x4c7fc6(0x1dc)),console[_0x4c7fc6(0x1da)](_0x4c7fc6(0x1cd)+_0x3f27f6+_0x4c7fc6(0x1ca)),console[_0x4c7fc6(0x1da)](_0x4c7fc6(0x1cd)+_0x9d75fc+'.ts\x20-\x20客户端实例文件'),console[_0x4c7fc6(0x1da)](_0x4c7fc6(0x1c4)+_0x5dc474[_0x4c7fc6(0x1c5)]+_0x4c7fc6(0x1d9));const _0x5e6476=await generateApiFile(_0x5dc474,_0x885fec,_0x665b97,!![],_0x106a8b);return console['log'](_0x4c7fc6(0x1c1)+_0x5dc474[_0x4c7fc6(0x1c5)]+_0x4c7fc6(0x1d2)+_0x5e6476['modelCount']+_0x4c7fc6(0x1c2)),_0x452fa3&&logger['info']('create-api-pull',_0x4c7fc6(0x1c7)+_0x665b97,{'projectPath':_0x452fa3,'appCode':_0x665b97,'datasetCount':_0x5dc474[_0x4c7fc6(0x1c5)],'filePrefix':_0x885fec}),!![];}catch(_0x25ecb6){const _0x30715a=_0x25ecb6 instanceof Error?_0x25ecb6[_0x4c7fc6(0x1d4)]:String(_0x25ecb6);return console[_0x4c7fc6(0x1dd)](_0x4c7fc6(0x1e0),_0x30715a),_0x452fa3&&logger[_0x4c7fc6(0x1dd)](_0x4c7fc6(0x1d1),_0x4c7fc6(0x1d8)+_0x30715a,{'appCode':_0x665b97,'projectPath':_0x452fa3}),![];}finally{_0xee62c4&&process['chdir'](_0xee62c4);}}