@lovrabet/cli 1.1.11 → 1.1.13

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 (55) hide show
  1. package/README.md +108 -0
  2. package/lib/add-page/input-page-router.js +1 -1
  3. package/lib/add-page/main.js +1 -1
  4. package/lib/add-page/select-page-template.js +1 -1
  5. package/lib/api/api-doc-ui.js +1 -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-datasets.js +1 -1
  9. package/lib/api/format-dataset.js +1 -1
  10. package/lib/api/generate-api-file.js +1 -1
  11. package/lib/api/main.js +1 -1
  12. package/lib/api/pull-silent.js +1 -1
  13. package/lib/api/pull.js +1 -1
  14. package/lib/auth/auth-server-ui.js +1 -1
  15. package/lib/auth/auth-server.js +1 -1
  16. package/lib/auth/constant.js +1 -1
  17. package/lib/auth/get-cookie.js +1 -1
  18. package/lib/auth/is-session-valid.js +1 -1
  19. package/lib/auth/logout.js +1 -1
  20. package/lib/cli.js +1 -1
  21. package/lib/cmd/build-watch.js +1 -1
  22. package/lib/cmd/build.js +1 -1
  23. package/lib/cmd/logs.js +1 -1
  24. package/lib/cmd/preview.js +1 -1
  25. package/lib/cmd/start.js +1 -1
  26. package/lib/config/config-help.js +1 -1
  27. package/lib/config/main.js +1 -1
  28. package/lib/constant/domain.js +1 -1
  29. package/lib/constant/env.js +1 -1
  30. package/lib/create-app/enhanced-guided-create.js +1 -1
  31. package/lib/create-app/format-elapsed.js +1 -1
  32. package/lib/create-app/main.js +1 -1
  33. package/lib/create-app/task-finished.js +1 -1
  34. package/lib/create-app/task-loading.js +1 -1
  35. package/lib/create-app/task-running.js +1 -1
  36. package/lib/create-app/task-time.js +1 -1
  37. package/lib/create-app/use-copy-project-template.js +1 -1
  38. package/lib/create-app/use-format-code.js +1 -1
  39. package/lib/create-app/use-install-dependencies.js +1 -1
  40. package/lib/help.js +1 -1
  41. package/lib/init/main.js +1 -0
  42. package/lib/utils/config.js +1 -1
  43. package/lib/utils/copy-directory.js +1 -1
  44. package/lib/utils/http-client.js +1 -1
  45. package/lib/utils/logger.js +1 -1
  46. package/lib/utils/router-updater.js +1 -1
  47. package/lib/utils/template-replacer.js +1 -1
  48. package/package.json +1 -1
  49. package/templates/projects/sub-app-react-demo/package-lock.json +18 -11
  50. package/templates/projects/sub-app-react-demo/package.json +1 -1
  51. package/templates/projects/sub-app-react-demo/src/layouts/MainLayout.tsx +1 -10
  52. package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +166 -2
  53. package/templates/projects/sub-app-react-demo/src/components/ApiUrlDisplay.tsx +0 -111
  54. package/templates/projects/sub-app-react-demo/src/pages/chart-fetch/index.tsx +0 -137
  55. package/templates/projects/sub-app-react-demo/src/pages/table-display.tsx +0 -130
package/README.md CHANGED
@@ -154,6 +154,24 @@ lovrabet add page
154
154
 
155
155
  ### 配置管理
156
156
 
157
+ #### `lovrabet init`
158
+
159
+ 在现有项目中初始化 Lovrabet 配置文件(v1.1.12+)
160
+
161
+ ```bash
162
+ lovrabet init # 交互式初始化
163
+ lovrabet init --appcode my-app-code # 直接指定 appcode
164
+ lovrabet init --appcode my-app --env daily # 指定环境
165
+ ```
166
+
167
+ - **交互式输入**: 支持交互式输入 appcode,带实时格式验证
168
+ - **智能验证**: 自动验证 appcode 格式(字母、数字、- 和 \_)
169
+ - **安全保护**: 检测并防止覆盖现有配置文件
170
+ - **配置继承**: 自动继承全局配置(如环境设置)
171
+ - **版本记录**: 生成的配置包含创建时间和 CLI 版本
172
+
173
+ **使用场景**:为已有的前端项目添加 Lovrabet 支持,无需重新创建项目。
174
+
157
175
  #### `lovrabet config`
158
176
 
159
177
  项目配置管理
@@ -232,6 +250,22 @@ lovrabet api pull --appcode your-app-code
232
250
  lovrabet start
233
251
  ```
234
252
 
253
+ ### 为现有项目添加 Lovrabet 支持(v1.1.12+)
254
+
255
+ ```bash
256
+ # 进入现有项目目录
257
+ cd existing-project
258
+
259
+ # 初始化 Lovrabet 配置
260
+ lovrabet init --appcode your-app-code
261
+
262
+ # 拉取 API 配置
263
+ lovrabet api pull
264
+
265
+ # 生成 API 文档
266
+ lovrabet api doc
267
+ ```
268
+
235
269
  ### 企业级应用开发
236
270
 
237
271
  ```bash
@@ -296,6 +330,72 @@ lovrabet logs --clear
296
330
 
297
331
  ## 📝 What's New
298
332
 
333
+ ### v1.1.12 (2025-10-17)
334
+
335
+ **新增功能 (New Features):**
336
+
337
+ - ✨ **新增 `lovrabet init` 命令** - 在现有项目中快速初始化配置
338
+
339
+ 为已有项目添加 Lovrabet 配置支持:
340
+
341
+ ```bash
342
+ # 交互式初始化
343
+ lovrabet init
344
+
345
+ # 直接指定 appcode
346
+ lovrabet init --appcode my-app-code
347
+
348
+ # 指定环境
349
+ lovrabet init --appcode my-app-code --env daily
350
+ ```
351
+
352
+ - 🔍 智能验证 appcode 格式(只允许字母、数字、- 和 \_)
353
+ - 🛡️ 自动检测并防止覆盖现有配置文件
354
+ - 🔄 继承全局配置,无需重复设置
355
+ - 📝 配置文件包含创建时间和 CLI 版本信息
356
+ - 💬 友好的交互式输入体验
357
+
358
+ - ✨ **`lovrabet api doc` 增强** - 支持按需生成和自定义参数
359
+
360
+ ```bash
361
+ # 只生成指定数据集的文档
362
+ lovrabet api doc --datasetcode ds_001
363
+
364
+ # 生成多个指定数据集的文档(用逗号分隔)
365
+ lovrabet api doc --datasetcode ds_001,ds_002,ds_003
366
+
367
+ # 传递额外参数到文档生成 API
368
+ lovrabet api doc --params '{"customField": "value"}'
369
+ ```
370
+
371
+ - 🎯 **按需生成文档** - 通过 `--datasetcode` 参数指定要生成的数据集
372
+ - ✅ **智能验证** - 自动检查指定的数据集代码是否存在
373
+ - 📊 **统计反馈** - 显示匹配的数据集数量和无效的代码
374
+ - 🔧 **自定义参数** - 支持通过 JSON 格式传递额外参数
375
+
376
+ **改进优化 (Improvements):**
377
+
378
+ - 📊 **优化文件命名策略** - 提高文件名唯一性
379
+ - 短代码从 4 位扩展到 6 位
380
+ - 减少文件名冲突的可能性
381
+
382
+ **使用场景:**
383
+
384
+ ```bash
385
+ # 场景1: 为现有项目添加 Lovrabet 支持
386
+ cd existing-project
387
+ lovrabet init --appcode my-app
388
+ lovrabet api pull
389
+
390
+ # 场景2: 只生成指定数据集的文档
391
+ lovrabet api doc --datasetcode dataset_abc123
392
+
393
+ # 场景3: 批量生成多个数据集的文档
394
+ lovrabet api doc --datasetcode dataset_abc123,dataset_def456,dataset_ghi789
395
+ ```
396
+
397
+ ---
398
+
299
399
  ### v1.1.11 (2025-10-16)
300
400
 
301
401
  **新增功能 (New Features):**
@@ -315,6 +415,11 @@ lovrabet logs --clear
315
415
 
316
416
  **改进优化 (Improvements):**
317
417
 
418
+ - 📦 **升级项目模板 SDK** - 提升开发体验和类型安全
419
+ - 项目模板中的 `@lovrabet/sdk` 升级至 v1.1.16
420
+ - 新增 `SortOrder` 类型支持,提供更好的类型提示
421
+ - 优化代码规范和格式,提升生成代码质量
422
+
318
423
  - 🔧 **数据集智能去重** - API 拉取更精准
319
424
  - 自动识别并过滤重复的数据集(相同 `tableName`)
320
425
  - 显示详细的去重统计信息
@@ -334,6 +439,9 @@ lovrabet logs --clear
334
439
  **使用示例:**
335
440
 
336
441
  ```bash
442
+ # 创建新项目(自动使用最新模板)
443
+ lovrabet create my-app
444
+
337
445
  # 生成 API 配置文件
338
446
  lovrabet api pull --appcode my-app
339
447
 
@@ -1 +1 @@
1
- function a0_0x37c9(){const _0x351bd7=['test','\x20直接回车确认,或输入自定义路由地址','22817fUGSJM','12fenaOh','return','length','3457448fXQuQf','111387VHxwiC','green','页面路由地址:\x20','red','页面路径不合法','\x20Step2:\x20','4981020hfRFwU','startsWith','265YtutZo','路径不能包含连续的\x20/','387cisPZw','gray','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','路径不能以\x20/\x20开头或结尾','existsSync','16UowJmH','739224BYgIFV','页面路径长度不能超过\x20100\x20个字符','slice','114138ehibaC','backspace','my-page','trim','split','endsWith','21730GlZOCG','21fzvXVP'];a0_0x37c9=function(){return _0x351bd7;};return a0_0x37c9();}(function(_0x1547a5,_0x5c6973){const _0x3c5c82=a0_0x3102,_0x53cabe=_0x1547a5();while(!![]){try{const _0x430c74=-parseInt(_0x3c5c82(0x133))/0x1+-parseInt(_0x3c5c82(0x125))/0x2*(parseInt(_0x3c5c82(0x138))/0x3)+-parseInt(_0x3c5c82(0x137))/0x4+parseInt(_0x3c5c82(0x11e))/0x5*(parseInt(_0x3c5c82(0x129))/0x6)+-parseInt(_0x3c5c82(0x130))/0x7*(-parseInt(_0x3c5c82(0x126))/0x8)+-parseInt(_0x3c5c82(0x120))/0x9*(-parseInt(_0x3c5c82(0x12f))/0xa)+-parseInt(_0x3c5c82(0x11c))/0xb*(-parseInt(_0x3c5c82(0x134))/0xc);if(_0x430c74===_0x5c6973)break;else _0x53cabe['push'](_0x53cabe['shift']());}catch(_0x37caa2){_0x53cabe['push'](_0x53cabe['shift']());}}}(a0_0x37c9,0x9e134));import{jsx as a0_0x1f7cdc,jsxs as a0_0x50e5c0}from'react/jsx-runtime';import{useState}from'react';function a0_0x3102(_0x18c0e6,_0x26b101){const _0x37c9dc=a0_0x37c9();return a0_0x3102=function(_0x310202,_0x19de5a){_0x310202=_0x310202-0x119;let _0x15ca71=_0x37c9dc[_0x310202];return _0x15ca71;},a0_0x3102(_0x18c0e6,_0x26b101);}import{Text,Box,useInput}from'ink';import a0_0x4ca0de from'node:fs';export function InputProjectCode(_0x41d770){const _0x4557ea=a0_0x3102,{onSubmit:_0x4a57f0,pagePath:_0x2d7d37}=_0x41d770,[_0x3ff6c7,_0x1e19c6]=useState(''),[_0x21f6d7,_0x218c5d]=useState(''),_0x560067=_0x4557ea(0x12b);function _0x3f3135(_0x21f7ae){const _0x37766c=_0x4557ea;if(_0x21f7ae[_0x37766c(0x136)]>0x64)return{'valid':![],'message':_0x37766c(0x127)};if(_0x21f7ae[_0x37766c(0x11d)]('/')||_0x21f7ae[_0x37766c(0x12e)]('/'))return{'valid':![],'message':_0x37766c(0x123)};if(_0x21f7ae['includes']('//'))return{'valid':![],'message':_0x37766c(0x11f)};const _0x5a60ec=_0x21f7ae[_0x37766c(0x12d)]('/');for(const _0x51e443 of _0x5a60ec){if(!_0x51e443)continue;const _0x36f200=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x36f200[_0x37766c(0x131)](_0x51e443))return{'valid':![],'message':_0x37766c(0x122)};}return{'valid':!![]};}return useInput((_0x361b9d,_0x1f0dc4)=>{const _0x43480e=_0x4557ea;if(_0x1f0dc4[_0x43480e(0x135)]){const _0x3519de=_0x3ff6c7[_0x43480e(0x12c)]()||_0x560067;if(_0x21f6d7)return;const _0x2de37a=_0x2d7d37+'/'+_0x3519de;if(a0_0x4ca0de[_0x43480e(0x124)](_0x2de37a)){_0x218c5d('页面路径\x20'+_0x3519de+'\x20已存在,请使用其他路径');return;}_0x4a57f0(_0x3519de),_0x1e19c6(''),_0x218c5d('');}else _0x1f0dc4[_0x43480e(0x12a)]||_0x1f0dc4['delete']?_0x1e19c6(_0x4fb593=>{const _0x49fff8=_0x43480e,_0x1b802a=_0x4fb593[_0x49fff8(0x128)](0x0,-0x1),{valid:_0x5b985b,message:_0x562814}=_0x3f3135(_0x1b802a);return _0x218c5d(_0x5b985b?'':_0x562814||'页面路径不合法'),_0x1b802a;}):_0x1e19c6(_0x422f5a=>{const _0x124599=_0x43480e,_0x372c9f=_0x422f5a+_0x361b9d,{valid:_0x3e20c8,message:_0x19d55d}=_0x3f3135(_0x372c9f);return _0x218c5d(_0x3e20c8?'':_0x19d55d||_0x124599(0x11a)),_0x372c9f;});}),a0_0x50e5c0(Box,{'flexDirection':'column','children':[a0_0x50e5c0(Box,{'children':[a0_0x1f7cdc(Text,{'color':_0x4557ea(0x121),'children':_0x4557ea(0x11b)}),a0_0x1f7cdc(Text,{'children':_0x4557ea(0x13a)}),_0x3ff6c7?a0_0x1f7cdc(Text,{'color':_0x4557ea(0x139),'children':_0x3ff6c7}):a0_0x1f7cdc(Text,{'color':'gray','children':_0x560067}),_0x21f6d7&&a0_0x50e5c0(Text,{'color':_0x4557ea(0x119),'children':['\x20←\x20',_0x21f6d7]})]}),!_0x21f6d7&&!_0x3ff6c7&&a0_0x1f7cdc(Box,{'children':a0_0x1f7cdc(Text,{'color':'gray','children':_0x4557ea(0x132)})})]});}
1
+ (function(_0x5235e9,_0xa1c5c4){const _0xd0afe4=a0_0xeaf6,_0x48dcdd=_0x5235e9();while(!![]){try{const _0x13d782=-parseInt(_0xd0afe4(0xe6))/0x1+parseInt(_0xd0afe4(0xee))/0x2*(parseInt(_0xd0afe4(0xf3))/0x3)+parseInt(_0xd0afe4(0xf0))/0x4*(-parseInt(_0xd0afe4(0xf6))/0x5)+parseInt(_0xd0afe4(0xed))/0x6+parseInt(_0xd0afe4(0xde))/0x7+parseInt(_0xd0afe4(0xe9))/0x8+parseInt(_0xd0afe4(0xe1))/0x9*(-parseInt(_0xd0afe4(0xf1))/0xa);if(_0x13d782===_0xa1c5c4)break;else _0x48dcdd['push'](_0x48dcdd['shift']());}catch(_0x38a02f){_0x48dcdd['push'](_0x48dcdd['shift']());}}}(a0_0x13c5,0x34fe4));import{jsx as a0_0x3f1160,jsxs as a0_0x36a705}from'react/jsx-runtime';function a0_0xeaf6(_0xd91bcb,_0x2ea65f){const _0x13c5be=a0_0x13c5();return a0_0xeaf6=function(_0xeaf6fe,_0x385de8){_0xeaf6fe=_0xeaf6fe-0xd8;let _0x121e0e=_0x13c5be[_0xeaf6fe];return _0x121e0e;},a0_0xeaf6(_0xd91bcb,_0x2ea65f);}import{useState}from'react';import{Text,Box,useInput}from'ink';function a0_0x13c5(){const _0xbaf06e=['\x20Step2:\x20','页面路由地址:\x20','slice','页面路径长度不能超过\x20100\x20个字符','2076522zEvVMl','test','column','45zmcLtR','路径不能包含连续的\x20/','页面路径不合法','backspace','delete','206870vEcsiC','includes','trim','1273712pWNzuF','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','length','split','1605810NRlGpe','180242opOmEC','页面路径\x20','4NgpJPf','627710wYpmMZ','my-page','3jCZECn','\x20已存在,请使用其他路径','gray','379155ANrVVk','startsWith','endsWith','return','\x20直接回车确认,或输入自定义路由地址','red'];a0_0x13c5=function(){return _0xbaf06e;};return a0_0x13c5();}import a0_0x5bec3f from'node:fs';export function InputProjectCode(_0x639177){const _0x3d9bc1=a0_0xeaf6,{onSubmit:_0x35a935,pagePath:_0x2a28dd}=_0x639177,[_0x635b46,_0x5b9807]=useState(''),[_0xe0ef5b,_0x51be0a]=useState(''),_0x4c3c69=_0x3d9bc1(0xf2);function _0x303e8a(_0x190881){const _0x5d9518=_0x3d9bc1;if(_0x190881[_0x5d9518(0xeb)]>0x64)return{'valid':![],'message':_0x5d9518(0xdd)};if(_0x190881[_0x5d9518(0xf7)]('/')||_0x190881[_0x5d9518(0xf8)]('/'))return{'valid':![],'message':'路径不能以\x20/\x20开头或结尾'};if(_0x190881[_0x5d9518(0xe7)]('//'))return{'valid':![],'message':_0x5d9518(0xe2)};const _0x5e1212=_0x190881[_0x5d9518(0xec)]('/');for(const _0x403e37 of _0x5e1212){if(!_0x403e37)continue;const _0x411381=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x411381[_0x5d9518(0xdf)](_0x403e37))return{'valid':![],'message':_0x5d9518(0xea)};}return{'valid':!![]};}return useInput((_0x509109,_0x293ee7)=>{const _0x2c2313=_0x3d9bc1;if(_0x293ee7[_0x2c2313(0xf9)]){const _0x5cba8e=_0x635b46[_0x2c2313(0xe8)]()||_0x4c3c69;if(_0xe0ef5b)return;const _0x465e2f=_0x2a28dd+'/'+_0x5cba8e;if(a0_0x5bec3f['existsSync'](_0x465e2f)){_0x51be0a(_0x2c2313(0xef)+_0x5cba8e+_0x2c2313(0xf4));return;}_0x35a935(_0x5cba8e),_0x5b9807(''),_0x51be0a('');}else _0x293ee7[_0x2c2313(0xe4)]||_0x293ee7[_0x2c2313(0xe5)]?_0x5b9807(_0x393c0e=>{const _0x50e1bc=_0x2c2313,_0x2775d9=_0x393c0e[_0x50e1bc(0xdc)](0x0,-0x1),{valid:_0x2744e7,message:_0x2d08cf}=_0x303e8a(_0x2775d9);return _0x51be0a(_0x2744e7?'':_0x2d08cf||'页面路径不合法'),_0x2775d9;}):_0x5b9807(_0x548157=>{const _0x23177b=_0x2c2313,_0x4d90ec=_0x548157+_0x509109,{valid:_0x43c54f,message:_0x371417}=_0x303e8a(_0x4d90ec);return _0x51be0a(_0x43c54f?'':_0x371417||_0x23177b(0xe3)),_0x4d90ec;});}),a0_0x36a705(Box,{'flexDirection':_0x3d9bc1(0xe0),'children':[a0_0x36a705(Box,{'children':[a0_0x3f1160(Text,{'color':_0x3d9bc1(0xf5),'children':_0x3d9bc1(0xda)}),a0_0x3f1160(Text,{'children':_0x3d9bc1(0xdb)}),_0x635b46?a0_0x3f1160(Text,{'color':'green','children':_0x635b46}):a0_0x3f1160(Text,{'color':_0x3d9bc1(0xf5),'children':_0x4c3c69}),_0xe0ef5b&&a0_0x36a705(Text,{'color':_0x3d9bc1(0xd9),'children':['\x20←\x20',_0xe0ef5b]})]}),!_0xe0ef5b&&!_0x635b46&&a0_0x3f1160(Box,{'children':a0_0x3f1160(Text,{'color':'gray','children':_0x3d9bc1(0xd8)})})]});}
@@ -1 +1 @@
1
- const a1_0x464f2f=a1_0x1f7c;(function(_0x217b38,_0x73a99f){const _0xb38022=a1_0x1f7c,_0x58c294=_0x217b38();while(!![]){try{const _0x98fab9=-parseInt(_0xb38022(0xe0))/0x1+-parseInt(_0xb38022(0xdf))/0x2*(parseInt(_0xb38022(0xfa))/0x3)+-parseInt(_0xb38022(0xd7))/0x4+parseInt(_0xb38022(0xde))/0x5*(-parseInt(_0xb38022(0xed))/0x6)+parseInt(_0xb38022(0xea))/0x7*(-parseInt(_0xb38022(0xf2))/0x8)+parseInt(_0xb38022(0xef))/0x9+parseInt(_0xb38022(0xeb))/0xa*(parseInt(_0xb38022(0xdd))/0xb);if(_0x98fab9===_0x73a99f)break;else _0x58c294['push'](_0x58c294['shift']());}catch(_0x57405b){_0x58c294['push'](_0x58c294['shift']());}}}(a1_0x2f3f,0xcf864));import{jsx as a1_0x5bfbe5,jsxs as a1_0x1d998e,Fragment as a1_0x3b5593}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x17471d from'node:path';function a1_0x2f3f(){const _0x1f8471=['130042UtNQWw','985763YYHXwk','setLogPath','error','cyan','页面添加失败:\x20','info','开始添加页面:\x20','\x20*\x20页面路径:\x20','column','catch','868868ZcoLfQ','1568860KoYARy','\x20Step1:\x20','6nwzoAc','已输入的页面路由\x20','4364748LKkjZY','green','pages','24fbiitQ','\x20*\x20页面文件已创建,可直接通过路由访问','\x20*\x20路由地址:\x20','dirname','success','join','now','已选择页面模板\x20','57DlMXkq','../../templates/pages','cwd','resolve','gray','message','\x20*\x20页面创建成功!','5566992dQZxdl','then','url','processTemplate','src','add-page','374lDXioa','4918970BjEsCc'];a1_0x2f3f=function(){return _0x1f8471;};return a1_0x2f3f();}import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';function a1_0x1f7c(_0x2b10fe,_0x4c3800){const _0x2f3fc1=a1_0x2f3f();return a1_0x1f7c=function(_0x1f7c5b,_0x26ad23){_0x1f7c5b=_0x1f7c5b-0xd4;let _0x45f280=_0x2f3fc1[_0x1f7c5b];return _0x45f280;},a1_0x1f7c(_0x2b10fe,_0x4c3800);}import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x17471d[a1_0x464f2f(0xf5)](fileURLToPath(import.meta[a1_0x464f2f(0xd9)])),pageTemplateDir=a1_0x17471d['resolve'](__dirname,a1_0x464f2f(0xfb)),projectDir=process[a1_0x464f2f(0xfc)]();export const AddPage=()=>{const _0x5d2415=a1_0x464f2f,{exit:_0x2270a7}=useApp(),[_0x56953a,_0x4ad5f0]=useState(''),[_0x2013a8,_0x5a5bfc]=useState(''),[_0xfec86a,_0x3e650e]=useState(![]),[_0x149c43,_0x25725c]=useState(![]),_0x14e60d=a1_0x17471d[_0x5d2415(0xf7)](projectDir,_0x5d2415(0xdb),_0x5d2415(0xf1)),_0x2c5971=a1_0x17471d[_0x5d2415(0xf7)](_0x14e60d,_0x2013a8),_0x2ee9a2=a1_0x17471d[_0x5d2415(0xf7)](_0x5d2415(0xdb),'pages',_0x2013a8);useEffect(()=>{const _0x4290f3=_0x5d2415,_0x21d2fb=a1_0x17471d[_0x4290f3(0xfd)](pageTemplateDir,_0x56953a);if(_0x56953a&&_0x2013a8){_0x3e650e(!![]),logger[_0x4290f3(0xe1)](process['cwd']());const _0x47261c=Date['now']();logger[_0x4290f3(0xe5)]('add-page',_0x4290f3(0xe6)+_0x2013a8,{'template':_0x56953a,'targetPath':_0x2ee9a2}),TemplateReplacer[_0x4290f3(0xda)](_0x21d2fb,a1_0x17471d[_0x4290f3(0xf7)](_0x14e60d,_0x2013a8),_0x2013a8,_0x56953a)[_0x4290f3(0xd8)](()=>{const _0x2c9d4f=_0x4290f3,_0x33b71=Date[_0x2c9d4f(0xf8)]()-_0x47261c;logger[_0x2c9d4f(0xf6)](_0x2c9d4f(0xdc),'页面添加成功:\x20'+_0x2013a8,_0x33b71,{'template':_0x56953a,'targetPath':_0x2ee9a2,'routePath':_0x2013a8}),_0x25725c(!![]);})[_0x4290f3(0xe9)](_0x1bbdfe=>{const _0x5edf8a=_0x4290f3,_0xf37615=Date[_0x5edf8a(0xf8)]()-_0x47261c;logger[_0x5edf8a(0xe2)](_0x5edf8a(0xdc),_0x5edf8a(0xe4)+_0x2013a8,{'template':_0x56953a,'targetPath':_0x2ee9a2,'error':_0x1bbdfe instanceof Error?_0x1bbdfe[_0x5edf8a(0xd5)]:String(_0x1bbdfe),'duration':_0xf37615});})['finally'](()=>{_0x3e650e(![]);});}},[_0x56953a,_0x2013a8]),useEffect(()=>{_0x149c43&&setTimeout(()=>{_0x2270a7();});},[_0x149c43]);if(_0x56953a)return a1_0x1d998e(Box,{'flexDirection':_0x5d2415(0xe8),'paddingY':0x1,'children':[a1_0x1d998e(Box,{'children':[a1_0x5bfbe5(Text,{'color':_0x5d2415(0xd4),'children':_0x5d2415(0xec)}),a1_0x5bfbe5(Text,{'children':_0x5d2415(0xf9)}),a1_0x5bfbe5(Text,{'color':_0x5d2415(0xf0),'children':_0x56953a})]}),_0x2013a8?a1_0x1d998e(Box,{'children':[a1_0x5bfbe5(Text,{'color':_0x5d2415(0xd4),'children':'\x20Step2:\x20'}),a1_0x5bfbe5(Text,{'children':_0x5d2415(0xee)}),a1_0x5bfbe5(Text,{'color':_0x5d2415(0xf0),'children':_0x2013a8})]}):a1_0x5bfbe5(InputProjectCode,{'pagePath':_0x2c5971,'onSubmit':_0x5a5bfc}),_0x2013a8&&_0xfec86a?a1_0x1d998e(Box,{'marginTop':0x1,'children':[a1_0x5bfbe5(Box,{'width':'4'}),a1_0x5bfbe5(Text,{'children':'正在创建页面,请稍候…'})]}):null,_0x149c43?a1_0x1d998e(a1_0x3b5593,{'children':[a1_0x5bfbe5(Box,{'marginTop':0x1,'children':a1_0x5bfbe5(Text,{'color':'gray','children':_0x5d2415(0xd6)})}),a1_0x1d998e(Box,{'children':[a1_0x5bfbe5(Text,{'color':'gray','children':_0x5d2415(0xe7)}),a1_0x5bfbe5(Text,{'color':_0x5d2415(0xf0),'children':_0x2ee9a2})]}),a1_0x1d998e(Box,{'children':[a1_0x5bfbe5(Text,{'color':_0x5d2415(0xd4),'children':_0x5d2415(0xf4)}),a1_0x1d998e(Text,{'color':_0x5d2415(0xf0),'children':['/',_0x2013a8]})]}),a1_0x5bfbe5(Box,{'marginTop':0x1,'children':a1_0x5bfbe5(Text,{'color':_0x5d2415(0xe3),'children':_0x5d2415(0xf3)})})]}):null]});return a1_0x5bfbe5(SelectPageTemplate,{'onSelect':_0x4ad5f0});};
1
+ const a1_0x1a5819=a1_0xd114;(function(_0x44ca56,_0x35a706){const _0x74cdcc=a1_0xd114,_0x2b270d=_0x44ca56();while(!![]){try{const _0x4755b6=parseInt(_0x74cdcc(0x7b))/0x1*(parseInt(_0x74cdcc(0x82))/0x2)+-parseInt(_0x74cdcc(0x7f))/0x3+-parseInt(_0x74cdcc(0x94))/0x4*(-parseInt(_0x74cdcc(0x87))/0x5)+parseInt(_0x74cdcc(0x88))/0x6+parseInt(_0x74cdcc(0x8d))/0x7+-parseInt(_0x74cdcc(0x92))/0x8*(-parseInt(_0x74cdcc(0x77))/0x9)+-parseInt(_0x74cdcc(0x76))/0xa;if(_0x4755b6===_0x35a706)break;else _0x2b270d['push'](_0x2b270d['shift']());}catch(_0x1846a0){_0x2b270d['push'](_0x2b270d['shift']());}}}(a1_0xdba8,0xd8524));function a1_0xdba8(){const _0x56d307=['\x20*\x20页面创建成功!','finally','processTemplate','1822689kPFHdg','join','src','133662xNLfnb','pages','页面添加失败:\x20','add-page','then','102980YWRpGj','9928050MGUIff','setLogPath','已输入的页面路由\x20','\x20*\x20路由地址:\x20','cyan','5990166YoLOVw','\x20*\x20页面路径:\x20','green','\x20*\x20页面文件已创建,可直接通过路由访问','message','31240rTTdaO','now','20jxXsmY','info','cwd','column','开始添加页面:\x20','resolve','success','url','26094760lcavrm','1431WfSMiX','error','gray','正在创建页面,请稍候…','13dIBydv'];a1_0xdba8=function(){return _0x56d307;};return a1_0xdba8();}import{jsx as a1_0x264336,jsxs as a1_0x3cab27,Fragment as a1_0xbb3259}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x5f989b from'node:path';import{useEffect,useState}from'react';function a1_0xd114(_0x40af9c,_0x2e4580){const _0xdba8b6=a1_0xdba8();return a1_0xd114=function(_0xd11428,_0x35a65e){_0xd11428=_0xd11428-0x73;let _0x5c0d8b=_0xdba8b6[_0xd11428];return _0x5c0d8b;},a1_0xd114(_0x40af9c,_0x2e4580);}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_0x5f989b['dirname'](fileURLToPath(import.meta[a1_0x1a5819(0x75)])),pageTemplateDir=a1_0x5f989b[a1_0x1a5819(0x73)](__dirname,'../../templates/pages'),projectDir=process[a1_0x1a5819(0x96)]();export const AddPage=()=>{const _0x50e1de=a1_0x1a5819,{exit:_0x1a7aa4}=useApp(),[_0x33b633,_0x4e57ba]=useState(''),[_0x295544,_0x504257]=useState(''),[_0x5488a5,_0x2a5672]=useState(![]),[_0x245407,_0x38f8fd]=useState(![]),_0x3f50b2=a1_0x5f989b[_0x50e1de(0x80)](projectDir,_0x50e1de(0x81),_0x50e1de(0x83)),_0xe5fe96=a1_0x5f989b['join'](_0x3f50b2,_0x295544),_0x19d039=a1_0x5f989b[_0x50e1de(0x80)](_0x50e1de(0x81),_0x50e1de(0x83),_0x295544);useEffect(()=>{const _0x310703=_0x50e1de,_0x178ece=a1_0x5f989b[_0x310703(0x73)](pageTemplateDir,_0x33b633);if(_0x33b633&&_0x295544){_0x2a5672(!![]),logger[_0x310703(0x89)](process[_0x310703(0x96)]());const _0x9ea070=Date['now']();logger[_0x310703(0x95)](_0x310703(0x85),_0x310703(0x98)+_0x295544,{'template':_0x33b633,'targetPath':_0x19d039}),TemplateReplacer[_0x310703(0x7e)](_0x178ece,a1_0x5f989b[_0x310703(0x80)](_0x3f50b2,_0x295544),_0x295544,_0x33b633)[_0x310703(0x86)](()=>{const _0x5cf90f=_0x310703,_0x4f8ad2=Date[_0x5cf90f(0x93)]()-_0x9ea070;logger[_0x5cf90f(0x74)](_0x5cf90f(0x85),'页面添加成功:\x20'+_0x295544,_0x4f8ad2,{'template':_0x33b633,'targetPath':_0x19d039,'routePath':_0x295544}),_0x38f8fd(!![]);})['catch'](_0x216338=>{const _0x289668=_0x310703,_0x4a8442=Date[_0x289668(0x93)]()-_0x9ea070;logger[_0x289668(0x78)](_0x289668(0x85),_0x289668(0x84)+_0x295544,{'template':_0x33b633,'targetPath':_0x19d039,'error':_0x216338 instanceof Error?_0x216338[_0x289668(0x91)]:String(_0x216338),'duration':_0x4a8442});})[_0x310703(0x7d)](()=>{_0x2a5672(![]);});}},[_0x33b633,_0x295544]),useEffect(()=>{_0x245407&&setTimeout(()=>{_0x1a7aa4();});},[_0x245407]);if(_0x33b633)return a1_0x3cab27(Box,{'flexDirection':_0x50e1de(0x97),'paddingY':0x1,'children':[a1_0x3cab27(Box,{'children':[a1_0x264336(Text,{'color':_0x50e1de(0x79),'children':'\x20Step1:\x20'}),a1_0x264336(Text,{'children':'已选择页面模板\x20'}),a1_0x264336(Text,{'color':_0x50e1de(0x8f),'children':_0x33b633})]}),_0x295544?a1_0x3cab27(Box,{'children':[a1_0x264336(Text,{'color':'gray','children':'\x20Step2:\x20'}),a1_0x264336(Text,{'children':_0x50e1de(0x8a)}),a1_0x264336(Text,{'color':_0x50e1de(0x8f),'children':_0x295544})]}):a1_0x264336(InputProjectCode,{'pagePath':_0xe5fe96,'onSubmit':_0x504257}),_0x295544&&_0x5488a5?a1_0x3cab27(Box,{'marginTop':0x1,'children':[a1_0x264336(Box,{'width':'4'}),a1_0x264336(Text,{'children':_0x50e1de(0x7a)})]}):null,_0x245407?a1_0x3cab27(a1_0xbb3259,{'children':[a1_0x264336(Box,{'marginTop':0x1,'children':a1_0x264336(Text,{'color':_0x50e1de(0x79),'children':_0x50e1de(0x7c)})}),a1_0x3cab27(Box,{'children':[a1_0x264336(Text,{'color':_0x50e1de(0x79),'children':_0x50e1de(0x8e)}),a1_0x264336(Text,{'color':_0x50e1de(0x8f),'children':_0x19d039})]}),a1_0x3cab27(Box,{'children':[a1_0x264336(Text,{'color':_0x50e1de(0x79),'children':_0x50e1de(0x8b)}),a1_0x3cab27(Text,{'color':_0x50e1de(0x8f),'children':['/',_0x295544]})]}),a1_0x264336(Box,{'marginTop':0x1,'children':a1_0x264336(Text,{'color':_0x50e1de(0x8c),'children':_0x50e1de(0x90)})})]}):null]});return a1_0x264336(SelectPageTemplate,{'onSelect':_0x4e57ba});};
@@ -1 +1 @@
1
- (function(_0x3857bd,_0x23c5ec){const _0x293ad4=a2_0x4427,_0x4e70aa=_0x3857bd();while(!![]){try{const _0xab83c5=-parseInt(_0x293ad4(0x19b))/0x1+-parseInt(_0x293ad4(0x19f))/0x2+parseInt(_0x293ad4(0x198))/0x3*(-parseInt(_0x293ad4(0x18a))/0x4)+parseInt(_0x293ad4(0x18b))/0x5+-parseInt(_0x293ad4(0x1a3))/0x6+-parseInt(_0x293ad4(0x1a6))/0x7+-parseInt(_0x293ad4(0x18c))/0x8*(-parseInt(_0x293ad4(0x197))/0x9);if(_0xab83c5===_0x23c5ec)break;else _0x4e70aa['push'](_0x4e70aa['shift']());}catch(_0x548ee0){_0x4e70aa['push'](_0x4e70aa['shift']());}}}(a2_0x190b,0x97069));function a2_0x190b(){const _0x2646d2=['return','label','dirname','\x20\x20\x20\x20\x20\x20\x20\x20','upArrow','\x20\x20\x20\x20\x20\x20>\x20','9yAiGSF','3091218YdPrPu','map','length','1187104xprIfl','sort','请选择您要创建的页面模板','blank','908602ZNemJX','downArrow','isDirectory','url','5922900YECgNr','localeCompare','gray','221543WSTFfj','templates/pages','column','error','4jcZxzm','4597560xOMwfS','27117592RhZfUl','../..','sdk-fetch','获取模板列表失败:','\x20Step1:\x20'];a2_0x190b=function(){return _0x2646d2;};return a2_0x190b();}import{jsx as a2_0x16a56d,jsxs as a2_0x3ba1b8}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x493f95 from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x4b5b33=a2_0x4427;try{const _0x21ae90=fileURLToPath(import.meta[_0x4b5b33(0x1a2)]),_0x15ad59=a2_0x493f95['resolve'](a2_0x493f95[_0x4b5b33(0x193)](_0x21ae90),_0x4b5b33(0x18d)),_0x5bdbc0=a2_0x493f95['join'](_0x15ad59,_0x4b5b33(0x1a7)),_0x2869fd=await readdir(_0x5bdbc0,{'withFileTypes':!![]}),_0x212e84=_0x2869fd['filter'](_0x33b6c5=>_0x33b6c5[_0x4b5b33(0x1a1)]())[_0x4b5b33(0x199)](_0x5e824c=>({'label':_0x5e824c['name']}))[_0x4b5b33(0x19c)]((_0x3408d3,_0x3cbded)=>_0x3408d3['label'][_0x4b5b33(0x1a4)](_0x3cbded[_0x4b5b33(0x192)]));return _0x212e84;}catch(_0x3e70b9){return console[_0x4b5b33(0x1a9)](_0x4b5b33(0x18f),_0x3e70b9),[{'label':_0x4b5b33(0x19e)},{'label':_0x4b5b33(0x18e)}];}}function a2_0x4427(_0x12108f,_0x11d868){const _0x190bc3=a2_0x190b();return a2_0x4427=function(_0x4427d7,_0x1314d3){_0x4427d7=_0x4427d7-0x18a;let _0x45e96f=_0x190bc3[_0x4427d7];return _0x45e96f;},a2_0x4427(_0x12108f,_0x11d868);}export function SelectPageTemplate(_0x5060dd){const _0x369936=a2_0x4427,[_0x57e7db,_0x44aadf]=useState(0x0),[_0x5b1f75,_0x10cd2d]=useState([]),[_0x241a98,_0x4a7bc5]=useState(!![]);useEffect(()=>{async function _0xbcf67a(){const _0x39e6db=await getTemplateList();_0x10cd2d(_0x39e6db),_0x4a7bc5(![]);}_0xbcf67a();},[]),useInput((_0x13f42d,_0x5e0645)=>{const _0x221a62=a2_0x4427;if(_0x241a98)return;if(_0x5e0645[_0x221a62(0x191)]){const _0x1be309=_0x5b1f75[_0x57e7db];_0x1be309&&_0x5060dd['onSelect'](_0x1be309['label']);}_0x5e0645[_0x221a62(0x195)]&&_0x44aadf(_0x44d455=>_0x44d455===0x0?_0x5b1f75['length']-0x1:_0x44d455-0x1),_0x5e0645[_0x221a62(0x1a0)]&&_0x44aadf(_0x359a04=>_0x359a04===_0x5b1f75[_0x221a62(0x19a)]-0x1?0x0:_0x359a04+0x1);});if(_0x241a98)return a2_0x16a56d(Box,{'flexDirection':_0x369936(0x1a8),'paddingY':0x1,'children':a2_0x3ba1b8(Box,{'children':[a2_0x16a56d(Text,{'color':_0x369936(0x1a5),'children':_0x369936(0x190)}),a2_0x16a56d(Text,{'children':'正在加载页面模板...'})]})});return a2_0x3ba1b8(Box,{'flexDirection':_0x369936(0x1a8),'paddingY':0x1,'children':[a2_0x3ba1b8(Box,{'children':[a2_0x16a56d(Text,{'color':'gray','children':'\x20Step1:\x20'}),a2_0x16a56d(Text,{'children':_0x369936(0x19d)})]}),_0x5b1f75['map']((_0x12cf86,_0xd68b23)=>{const _0x1a0d73=_0x369936,_0x21d891=_0xd68b23===_0x57e7db,_0x33e017=_0x21d891?_0x1a0d73(0x196)+_0x12cf86[_0x1a0d73(0x192)]:_0x1a0d73(0x194)+_0x12cf86[_0x1a0d73(0x192)];return a2_0x16a56d(Box,{'children':a2_0x16a56d(Text,{'color':_0x21d891?'green':undefined,'children':_0x33e017})},_0x33e017);})]});}
1
+ (function(_0x293a04,_0x2345c1){const _0x4bba37=a2_0x21df,_0x39ec3e=_0x293a04();while(!![]){try{const _0x3560e3=-parseInt(_0x4bba37(0x1f5))/0x1+parseInt(_0x4bba37(0x1f4))/0x2+parseInt(_0x4bba37(0x200))/0x3*(-parseInt(_0x4bba37(0x205))/0x4)+-parseInt(_0x4bba37(0x1f3))/0x5+-parseInt(_0x4bba37(0x1fe))/0x6+parseInt(_0x4bba37(0x1fb))/0x7*(parseInt(_0x4bba37(0x209))/0x8)+parseInt(_0x4bba37(0x20e))/0x9;if(_0x3560e3===_0x2345c1)break;else _0x39ec3e['push'](_0x39ec3e['shift']());}catch(_0x4c0b89){_0x39ec3e['push'](_0x39ec3e['shift']());}}}(a2_0x7cc4,0x4bc23));import{jsx as a2_0x561a11,jsxs as a2_0x4c25d2}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';function a2_0x7cc4(){const _0x421c32=['filter','return','../..','2672820IBZtQm','url','name','column','\x20\x20\x20\x20\x20\x20>\x20','resolve','blank','1115990lJqIJd','1219350NOaqtn','64444JkQvEG','isDirectory','label','length','downArrow','onSelect','1299515IpmyNy','upArrow','green','2718018WxoNwo','dirname','3cGppQT','\x20Step1:\x20','获取模板列表失败:','join','sort','165392uULwnP','gray','请选择您要创建的页面模板','sdk-fetch','8aFoykh','map'];a2_0x7cc4=function(){return _0x421c32;};return a2_0x7cc4();}import a2_0x16b5ad from'node:path';function a2_0x21df(_0xf7789,_0x247307){const _0x7cc495=a2_0x7cc4();return a2_0x21df=function(_0x21dfce,_0x314c71){_0x21dfce=_0x21dfce-0x1ee;let _0x506b84=_0x7cc495[_0x21dfce];return _0x506b84;},a2_0x21df(_0xf7789,_0x247307);}import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x425c2a=a2_0x21df;try{const _0x36ab91=fileURLToPath(import.meta[_0x425c2a(0x20f)]),_0x502713=a2_0x16b5ad[_0x425c2a(0x1f1)](a2_0x16b5ad[_0x425c2a(0x1ff)](_0x36ab91),_0x425c2a(0x20d)),_0x583bed=a2_0x16b5ad[_0x425c2a(0x203)](_0x502713,'templates/pages'),_0xe98cd8=await readdir(_0x583bed,{'withFileTypes':!![]}),_0x4f97f0=_0xe98cd8[_0x425c2a(0x20b)](_0x66d7b3=>_0x66d7b3[_0x425c2a(0x1f6)]())[_0x425c2a(0x20a)](_0x58bcdb=>({'label':_0x58bcdb[_0x425c2a(0x1ee)]}))[_0x425c2a(0x204)]((_0x46a14c,_0x1d6b4a)=>_0x46a14c[_0x425c2a(0x1f7)]['localeCompare'](_0x1d6b4a[_0x425c2a(0x1f7)]));return _0x4f97f0;}catch(_0x2d07c3){return console['error'](_0x425c2a(0x202),_0x2d07c3),[{'label':_0x425c2a(0x1f2)},{'label':_0x425c2a(0x208)}];}}export function SelectPageTemplate(_0x217c35){const _0x45e96c=a2_0x21df,[_0x1f54f9,_0x40ee3a]=useState(0x0),[_0x382322,_0x23b5ea]=useState([]),[_0x529bb2,_0xc36969]=useState(!![]);useEffect(()=>{async function _0x5aa3ac(){const _0x209a86=await getTemplateList();_0x23b5ea(_0x209a86),_0xc36969(![]);}_0x5aa3ac();},[]),useInput((_0x1777d0,_0x178930)=>{const _0x2705ef=a2_0x21df;if(_0x529bb2)return;if(_0x178930[_0x2705ef(0x20c)]){const _0x13d4e4=_0x382322[_0x1f54f9];_0x13d4e4&&_0x217c35[_0x2705ef(0x1fa)](_0x13d4e4[_0x2705ef(0x1f7)]);}_0x178930[_0x2705ef(0x1fc)]&&_0x40ee3a(_0x4afa3b=>_0x4afa3b===0x0?_0x382322[_0x2705ef(0x1f8)]-0x1:_0x4afa3b-0x1),_0x178930[_0x2705ef(0x1f9)]&&_0x40ee3a(_0x19a0a5=>_0x19a0a5===_0x382322['length']-0x1?0x0:_0x19a0a5+0x1);});if(_0x529bb2)return a2_0x561a11(Box,{'flexDirection':_0x45e96c(0x1ef),'paddingY':0x1,'children':a2_0x4c25d2(Box,{'children':[a2_0x561a11(Text,{'color':_0x45e96c(0x206),'children':_0x45e96c(0x201)}),a2_0x561a11(Text,{'children':'正在加载页面模板...'})]})});return a2_0x4c25d2(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x4c25d2(Box,{'children':[a2_0x561a11(Text,{'color':_0x45e96c(0x206),'children':_0x45e96c(0x201)}),a2_0x561a11(Text,{'children':_0x45e96c(0x207)})]}),_0x382322[_0x45e96c(0x20a)]((_0x41e9e4,_0x25c026)=>{const _0x4ee1b8=_0x45e96c,_0x501a78=_0x25c026===_0x1f54f9,_0x48d9ea=_0x501a78?_0x4ee1b8(0x1f0)+_0x41e9e4[_0x4ee1b8(0x1f7)]:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x41e9e4['label'];return a2_0x561a11(Box,{'children':a2_0x561a11(Text,{'color':_0x501a78?_0x4ee1b8(0x1fd):undefined,'children':_0x48d9ea})},_0x48d9ea);})]});}
@@ -1 +1 @@
1
- (function(_0x34d731,_0x5c1870){const _0x49cdff=a3_0x96d3,_0x13eb97=_0x34d731();while(!![]){try{const _0x4e5a4=parseInt(_0x49cdff(0x1d0))/0x1*(-parseInt(_0x49cdff(0x1d8))/0x2)+-parseInt(_0x49cdff(0x1db))/0x3*(parseInt(_0x49cdff(0x1d3))/0x4)+parseInt(_0x49cdff(0x1b9))/0x5*(parseInt(_0x49cdff(0x1e4))/0x6)+-parseInt(_0x49cdff(0x1cb))/0x7+-parseInt(_0x49cdff(0x1d2))/0x8+-parseInt(_0x49cdff(0x1d7))/0x9+parseInt(_0x49cdff(0x1d1))/0xa*(parseInt(_0x49cdff(0x1c1))/0xb);if(_0x4e5a4===_0x5c1870)break;else _0x13eb97['push'](_0x13eb97['shift']());}catch(_0x2af5b3){_0x13eb97['push'](_0x13eb97['shift']());}}}(a3_0x15d1,0x5284f));import{jsx as a3_0x38b145,jsxs as a3_0x2f3ac8,Fragment as a3_0x2dfbec}from'react/jsx-runtime';import{useEffect,useState}from'react';function a3_0x15d1(){const _0x381dfd=['duplicateCount','23963kNByCI','10uzNPJZ','4197104bSALon','4ofCTvS','filter','error','使用指定的应用AppCode:\x20','2660679eOeauh','50iXnLOG','datasetCode','dim','475815edNaGX','正在生成\x20','文档生成失败:\x20','cyan','\x20个数据集的文档...','⚠️\x20以下数据集生成失败:','api-doc','使用配置的应用AppCode:\x20','originalCount','1226298LKQlCV','未提供应用AppCode,且配置中也没有默认值','lovrabet\x20auth','\x20重新登录后再试','column','!\x20原始数据集\x20','15sMyRye','map','env','yellow','未找到任何数据集',',\x20失败\x20','length','filePath','18119145vRQICG','正在获取数据集列表...','\x20(环境:\x20','green','setLogPath','./docs','💡\x20请使用\x20','datasetName','online','gray','2410772yFqKrh','.md\x20(','white','success'];a3_0x15d1=function(){return _0x381dfd;};return a3_0x15d1();}import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchDatasets}from'./fetch-datasets.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';function a3_0x96d3(_0x498a2f,_0x242a58){const _0x15d1e8=a3_0x15d1();return a3_0x96d3=function(_0x96d302,_0x4177fa){_0x96d302=_0x96d302-0x1b5;let _0x1b2d05=_0x15d1e8[_0x96d302];return _0x1b2d05;},a3_0x96d3(_0x498a2f,_0x242a58);}export const ApiDocUI=({appCode:_0x5efed0,env:_0x20ee92,output:_0x36d64f})=>{const _0x170586=a3_0x96d3,{exit:_0x1315cf}=useApp(),[_0x20669a,_0x552137]=useState(![]),[_0x2903a3,_0xafad47]=useState(''),[_0x2917f4,_0x94aa5a]=useState(![]),[_0x199b92,_0x263181]=useState(null),[_0x3712f8,_0x5116fd]=useState(null),[_0x5937c1,_0x47a637]=useState(null),_0x392988=readConfig(),_0x1a9e2b=getConfigAppCode(),_0x220305=_0x5efed0||_0x1a9e2b,_0x4ed6c5=typeof _0x392988?.[_0x170586(0x1bb)]==='string'?_0x392988['env']:undefined,_0x14eb73=_0x20ee92||_0x4ed6c5||_0x170586(0x1c9);initEnv(_0x14eb73);const _0x4df3d4=_0x36d64f||_0x170586(0x1c6),_0x53cd54=_0x5efed0?_0x170586(0x1d6)+_0x220305:_0x170586(0x1e2)+_0x220305;useEffect(()=>{_0x552137(!![]),_0xa3ec9e();},[]),useEffect(()=>{(_0x2917f4||_0x199b92)&&_0x1315cf();},[_0x2917f4,_0x199b92,_0x1315cf]);async function _0xa3ec9e(){const _0x58fdc3=_0x170586;if(!_0x220305){_0x263181(_0x58fdc3(0x1e5));return;}try{logger[_0x58fdc3(0x1c5)](process['cwd']()),_0xafad47(_0x58fdc3(0x1c2));const {rawData:_0x22ef0d,originalCount:_0x2cd626,filteredCount:_0x11c392,duplicateCount:_0x4c334a}=await fetchDatasets(_0x220305);_0x47a637({'originalCount':_0x2cd626,'filteredCount':_0x11c392,'duplicateCount':_0x4c334a});if(_0x22ef0d[_0x58fdc3(0x1bf)]===0x0){_0x263181(_0x58fdc3(0x1bd));return;}_0xafad47(_0x58fdc3(0x1dc)+_0x22ef0d[_0x58fdc3(0x1bf)]+_0x58fdc3(0x1df));const _0x4d0a66=await generateDatasetDocs(_0x22ef0d,_0x220305,_0x4df3d4,(_0x55b2d0,_0x47d3a2,_0x3498d5)=>{const _0x475089=_0x58fdc3;_0xafad47('正在生成\x20'+_0x3498d5+_0x475089(0x1cc)+_0x55b2d0+'/'+_0x47d3a2+')');});_0x5116fd(_0x4d0a66),_0x94aa5a(!![]);const _0x5e750d=_0x4d0a66[_0x58fdc3(0x1d4)](_0x2ec64d=>_0x2ec64d[_0x58fdc3(0x1ce)])[_0x58fdc3(0x1bf)],_0x4de707=_0x4d0a66[_0x58fdc3(0x1d4)](_0x4cedca=>!_0x4cedca[_0x58fdc3(0x1ce)])[_0x58fdc3(0x1bf)];logger[_0x58fdc3(0x1ce)](_0x58fdc3(0x1e1),'文档生成完成',undefined,{'totalCount':_0x4d0a66[_0x58fdc3(0x1bf)],'successCount':_0x5e750d,'failCount':_0x4de707,'outputDir':_0x4df3d4});}catch(_0x258030){const _0x38c4fb=_0x258030 instanceof Error?_0x258030['message']:String(_0x258030);logger[_0x58fdc3(0x1d5)](_0x58fdc3(0x1e1),_0x58fdc3(0x1dd)+_0x38c4fb,{'appCode':_0x220305,'outputDir':_0x4df3d4}),_0x263181(_0x58fdc3(0x1dd)+_0x38c4fb);}finally{_0x552137(![]);}}const _0x599da1=_0x3712f8?.[_0x170586(0x1d4)](_0x17ba0d=>_0x17ba0d['success'])[_0x170586(0x1bf)]||0x0,_0x1293b2=_0x3712f8?.[_0x170586(0x1d4)](_0x33a6ce=>!_0x33a6ce['success'])[_0x170586(0x1bf)]||0x0;return a3_0x2f3ac8(Box,{'flexDirection':_0x170586(0x1b7),'children':[(_0x20669a||_0x2917f4)&&a3_0x2f3ac8(Box,{'children':[a3_0x38b145(Text,{'color':_0x170586(0x1ca),'children':'*\x20'}),a3_0x38b145(Text,{'color':_0x5efed0?_0x170586(0x1cd):_0x170586(0x1da),'children':_0x53cd54})]}),_0x20669a&&a3_0x38b145(Box,{'children':a3_0x2f3ac8(Text,{'children':['🚀\x20',_0x2903a3,_0x170586(0x1c3),_0x14eb73,')']})}),_0x2917f4&&_0x3712f8&&_0x5937c1&&a3_0x2f3ac8(Box,{'flexDirection':_0x170586(0x1b7),'children':[a3_0x38b145(Box,{'children':a3_0x2f3ac8(Text,{'color':_0x170586(0x1c4),'children':['√\x20文档生成完成!成功\x20',_0x599da1,'\x20个',_0x1293b2>0x0&&_0x170586(0x1be)+_0x1293b2+'\x20个']})}),_0x5937c1[_0x170586(0x1cf)]>0x0&&a3_0x38b145(Box,{'marginTop':0x1,'children':a3_0x2f3ac8(Text,{'color':_0x170586(0x1bc),'children':[_0x170586(0x1b8),_0x5937c1[_0x170586(0x1e3)],'\x20个,过滤重复','\x20',_0x5937c1[_0x170586(0x1cf)],'\x20个']})}),a3_0x2f3ac8(Box,{'marginTop':0x1,'children':[a3_0x38b145(Text,{'color':_0x170586(0x1ca),'children':'*\x20输出目录:\x20'}),a3_0x38b145(Text,{'color':'cyan','children':_0x4df3d4})]}),_0x599da1>0x0&&a3_0x2f3ac8(a3_0x2dfbec,{'children':[a3_0x38b145(Box,{'marginTop':0x1,'children':a3_0x38b145(Text,{'color':_0x170586(0x1ca),'children':'*\x20生成的文档文件:'})}),_0x3712f8[_0x170586(0x1d4)](_0x251dc2=>_0x251dc2[_0x170586(0x1ce)])[_0x170586(0x1ba)]((_0x39ec12,_0x6c4dfd)=>a3_0x2f3ac8(Box,{'marginLeft':0x2,'children':[a3_0x2f3ac8(Text,{'color':_0x170586(0x1de),'children':['•\x20',_0x39ec12[_0x170586(0x1c0)]]}),a3_0x2f3ac8(Text,{'color':_0x170586(0x1da),'children':['\x20-\x20',_0x39ec12[_0x170586(0x1c8)]]})]},_0x6c4dfd))]}),_0x1293b2>0x0&&a3_0x2f3ac8(a3_0x2dfbec,{'children':[a3_0x38b145(Box,{'marginTop':0x1,'children':a3_0x38b145(Text,{'color':_0x170586(0x1bc),'children':_0x170586(0x1e0)})}),_0x3712f8[_0x170586(0x1d4)](_0x592b34=>!_0x592b34[_0x170586(0x1ce)])['map']((_0x1818f4,_0x3c50a5)=>a3_0x2f3ac8(Box,{'marginLeft':0x2,'flexDirection':_0x170586(0x1b7),'children':[a3_0x2f3ac8(Text,{'color':'red','children':['•\x20',_0x1818f4['datasetName'],'\x20(',_0x1818f4[_0x170586(0x1d9)],')']}),_0x1818f4['error']&&a3_0x38b145(Box,{'marginLeft':0x2,'children':a3_0x38b145(Text,{'color':_0x170586(0x1da),'children':_0x1818f4[_0x170586(0x1d5)]})})]},_0x3c50a5))]})]}),_0x199b92&&a3_0x2f3ac8(Box,{'flexDirection':_0x170586(0x1b7),'children':[a3_0x38b145(Box,{'children':a3_0x2f3ac8(Text,{'color':'red','children':['❌\x20',_0x199b92]})}),_0x199b92['includes']('登录')&&a3_0x2f3ac8(Box,{'marginTop':0x1,'children':[a3_0x38b145(Text,{'color':_0x170586(0x1bc),'children':_0x170586(0x1c7)}),a3_0x38b145(Text,{'color':'cyan','children':_0x170586(0x1b5)}),a3_0x38b145(Text,{'color':_0x170586(0x1bc),'children':_0x170586(0x1b6)})]})]})]});};
1
+ function a3_0xcec3(_0x40396b,_0x130c57){const _0x18e3a6=a3_0x18e3();return a3_0xcec3=function(_0xcec37d,_0x4aa52d){_0xcec37d=_0xcec37d-0x111;let _0x5df8d3=_0x18e3a6[_0xcec37d];return _0x5df8d3;},a3_0xcec3(_0x40396b,_0x130c57);}(function(_0x55428f,_0x1efe9f){const _0x3dd7ce=a3_0xcec3,_0x2b3371=_0x55428f();while(!![]){try{const _0x6a5b61=-parseInt(_0x3dd7ce(0x13d))/0x1+parseInt(_0x3dd7ce(0x119))/0x2*(parseInt(_0x3dd7ce(0x149))/0x3)+parseInt(_0x3dd7ce(0x139))/0x4+-parseInt(_0x3dd7ce(0x13e))/0x5*(-parseInt(_0x3dd7ce(0x148))/0x6)+parseInt(_0x3dd7ce(0x11d))/0x7*(parseInt(_0x3dd7ce(0x133))/0x8)+-parseInt(_0x3dd7ce(0x127))/0x9*(-parseInt(_0x3dd7ce(0x115))/0xa)+-parseInt(_0x3dd7ce(0x12c))/0xb;if(_0x6a5b61===_0x1efe9f)break;else _0x2b3371['push'](_0x2b3371['shift']());}catch(_0x493c2d){_0x2b3371['push'](_0x2b3371['shift']());}}}(a3_0x18e3,0x548e5));import{jsx as a3_0x3874d6,jsxs as a3_0x551b59,Fragment as a3_0xd97120}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchDatasets}from'./fetch-datasets.js';function a3_0x18e3(){const _0x504968=['\x20-\x20','未提供应用AppCode,且配置中也没有默认值','.md\x20(','\x20个匹配的数据集\x1b[0m','\x20个,过滤重复','⚠️\x20以下数据集生成失败:','正在获取数据集列表...','27YEgYMu','gray','\x20个数据集中筛选出\x20','!\x20原始数据集\x20','join','9501833FpJNcu','文档生成完成','./docs','\x1b[33m!\x20以下数据集代码不存在:\x20','red','未找到任何数据集','white','36464DfhQnU','code','string','💡\x20请使用\x20','duplicateCount','lovrabet\x20auth','2596400VmSfsb','column','dim','\x1b[90m*\x20从\x20','233409kxwZYd','4055JUpexG','log','filter','cyan','*\x20生成的文档文件:','includes','success','\x1b[0m','\x20(环境:\x20','\x20个数据集的文档...','378LVlFJm','10197ErXodJ','green','文档生成失败:\x20','env','originalCount','setLogPath','正在生成\x20','1052070wabobS','filePath','map','datasetName','190acOLsw','🚀\x20','yellow','length','161XdCKeN',',\x20失败\x20','api-doc'];a3_0x18e3=function(){return _0x504968;};return a3_0x18e3();}import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x2586c5,env:_0x47c1c1,output:_0x43fada,extraParams:_0x352ed5,datasetCodes:_0x367678})=>{const _0x215f52=a3_0xcec3,{exit:_0x338d8f}=useApp(),[_0x4eb67c,_0x123229]=useState(![]),[_0x51cda8,_0xa68017]=useState(''),[_0x5cc09f,_0x130717]=useState(![]),[_0x373193,_0x1271a0]=useState(null),[_0x168323,_0x130cce]=useState(null),[_0x339bed,_0x41b23f]=useState(null),_0x45f965=readConfig(),_0x176362=getConfigAppCode(),_0x1d6c3d=_0x2586c5||_0x176362,_0x51a3fc=typeof _0x45f965?.[_0x215f52(0x111)]===_0x215f52(0x135)?_0x45f965[_0x215f52(0x111)]:undefined,_0x4bdc86=_0x47c1c1||_0x51a3fc||'online';initEnv(_0x4bdc86);const _0x42edfd=_0x43fada||_0x215f52(0x12e),_0x549d39=_0x2586c5?'使用指定的应用AppCode:\x20'+_0x1d6c3d:'使用配置的应用AppCode:\x20'+_0x1d6c3d;useEffect(()=>{_0x123229(!![]),_0x4ac1f7();},[]),useEffect(()=>{(_0x5cc09f||_0x373193)&&_0x338d8f();},[_0x5cc09f,_0x373193,_0x338d8f]);async function _0x4ac1f7(){const _0x5f1356=_0x215f52;if(!_0x1d6c3d){_0x1271a0(_0x5f1356(0x121));return;}try{logger[_0x5f1356(0x113)](process['cwd']()),_0xa68017(_0x5f1356(0x126));const {rawData:_0x2acccc,originalCount:_0x1d8c18,filteredCount:_0x17f22a,duplicateCount:_0x113ab9}=await fetchDatasets(_0x1d6c3d);_0x41b23f({'originalCount':_0x1d8c18,'filteredCount':_0x17f22a,'duplicateCount':_0x113ab9});if(_0x2acccc[_0x5f1356(0x11c)]===0x0){_0x1271a0(_0x5f1356(0x131));return;}let _0x3c93f5=_0x2acccc;if(_0x367678&&_0x367678[_0x5f1356(0x11c)]>0x0){_0x3c93f5=_0x2acccc[_0x5f1356(0x140)](_0x1f3852=>_0x367678[_0x5f1356(0x143)](_0x1f3852['code']));const _0x33d32b=_0x3c93f5['map'](_0x942674=>_0x942674[_0x5f1356(0x134)]),_0x31ad05=_0x367678[_0x5f1356(0x140)](_0x26850a=>!_0x33d32b[_0x5f1356(0x143)](_0x26850a));_0x31ad05[_0x5f1356(0x11c)]>0x0&&console[_0x5f1356(0x13f)](_0x5f1356(0x12f)+_0x31ad05['join'](',\x20')+_0x5f1356(0x145));if(_0x3c93f5[_0x5f1356(0x11c)]===0x0){_0x1271a0('指定的数据集代码都不存在:\x20'+_0x367678[_0x5f1356(0x12b)](',\x20'));return;}console[_0x5f1356(0x13f)](_0x5f1356(0x13c)+_0x2acccc[_0x5f1356(0x11c)]+_0x5f1356(0x129)+_0x3c93f5[_0x5f1356(0x11c)]+_0x5f1356(0x123));}_0xa68017(_0x5f1356(0x114)+_0x3c93f5[_0x5f1356(0x11c)]+_0x5f1356(0x147));const _0xcb3fbd=await generateDatasetDocs(_0x3c93f5,_0x1d6c3d,_0x42edfd,(_0x47994f,_0x269589,_0x270aa2)=>{const _0x2f3dc5=_0x5f1356;_0xa68017(_0x2f3dc5(0x114)+_0x270aa2+_0x2f3dc5(0x122)+_0x47994f+'/'+_0x269589+')');},_0x352ed5);_0x130cce(_0xcb3fbd),_0x130717(!![]);const _0x3ea876=_0xcb3fbd[_0x5f1356(0x140)](_0x49bdc0=>_0x49bdc0[_0x5f1356(0x144)])[_0x5f1356(0x11c)],_0x32c2e4=_0xcb3fbd[_0x5f1356(0x140)](_0x50d3b6=>!_0x50d3b6['success'])['length'];logger[_0x5f1356(0x144)](_0x5f1356(0x11f),_0x5f1356(0x12d),undefined,{'totalCount':_0xcb3fbd[_0x5f1356(0x11c)],'successCount':_0x3ea876,'failCount':_0x32c2e4,'outputDir':_0x42edfd});}catch(_0x17e637){const _0x16a0c0=_0x17e637 instanceof Error?_0x17e637['message']:String(_0x17e637);logger['error'](_0x5f1356(0x11f),_0x5f1356(0x14b)+_0x16a0c0,{'appCode':_0x1d6c3d,'outputDir':_0x42edfd}),_0x1271a0(_0x5f1356(0x14b)+_0x16a0c0);}finally{_0x123229(![]);}}const _0x340e13=_0x168323?.[_0x215f52(0x140)](_0x3aa53d=>_0x3aa53d[_0x215f52(0x144)])[_0x215f52(0x11c)]||0x0,_0x51ae9f=_0x168323?.[_0x215f52(0x140)](_0x3c1242=>!_0x3c1242[_0x215f52(0x144)])[_0x215f52(0x11c)]||0x0;return a3_0x551b59(Box,{'flexDirection':_0x215f52(0x13a),'children':[(_0x4eb67c||_0x5cc09f)&&a3_0x551b59(Box,{'children':[a3_0x3874d6(Text,{'color':_0x215f52(0x128),'children':'*\x20'}),a3_0x3874d6(Text,{'color':_0x2586c5?_0x215f52(0x132):_0x215f52(0x13b),'children':_0x549d39})]}),_0x4eb67c&&a3_0x3874d6(Box,{'children':a3_0x551b59(Text,{'children':[_0x215f52(0x11a),_0x51cda8,_0x215f52(0x146),_0x4bdc86,')']})}),_0x5cc09f&&_0x168323&&_0x339bed&&a3_0x551b59(Box,{'flexDirection':_0x215f52(0x13a),'children':[a3_0x3874d6(Box,{'children':a3_0x551b59(Text,{'color':_0x215f52(0x14a),'children':['√\x20文档生成完成!成功\x20',_0x340e13,'\x20个',_0x51ae9f>0x0&&_0x215f52(0x11e)+_0x51ae9f+'\x20个']})}),_0x339bed[_0x215f52(0x137)]>0x0&&a3_0x3874d6(Box,{'marginTop':0x1,'children':a3_0x551b59(Text,{'color':_0x215f52(0x11b),'children':[_0x215f52(0x12a),_0x339bed[_0x215f52(0x112)],_0x215f52(0x124),'\x20',_0x339bed[_0x215f52(0x137)],'\x20个']})}),a3_0x551b59(Box,{'marginTop':0x1,'children':[a3_0x3874d6(Text,{'color':_0x215f52(0x128),'children':'*\x20输出目录:\x20'}),a3_0x3874d6(Text,{'color':'cyan','children':_0x42edfd})]}),_0x340e13>0x0&&a3_0x551b59(a3_0xd97120,{'children':[a3_0x3874d6(Box,{'marginTop':0x1,'children':a3_0x3874d6(Text,{'color':_0x215f52(0x128),'children':_0x215f52(0x142)})}),_0x168323[_0x215f52(0x140)](_0x593e30=>_0x593e30[_0x215f52(0x144)])[_0x215f52(0x117)]((_0x45fb16,_0x5404e2)=>a3_0x551b59(Box,{'marginLeft':0x2,'children':[a3_0x551b59(Text,{'color':_0x215f52(0x141),'children':['•\x20',_0x45fb16[_0x215f52(0x116)]]}),a3_0x551b59(Text,{'color':_0x215f52(0x13b),'children':[_0x215f52(0x120),_0x45fb16[_0x215f52(0x118)]]})]},_0x5404e2))]}),_0x51ae9f>0x0&&a3_0x551b59(a3_0xd97120,{'children':[a3_0x3874d6(Box,{'marginTop':0x1,'children':a3_0x3874d6(Text,{'color':_0x215f52(0x11b),'children':_0x215f52(0x125)})}),_0x168323[_0x215f52(0x140)](_0x571308=>!_0x571308[_0x215f52(0x144)])['map']((_0x5b2133,_0x3bdd6c)=>a3_0x551b59(Box,{'marginLeft':0x2,'flexDirection':_0x215f52(0x13a),'children':[a3_0x551b59(Text,{'color':'red','children':['•\x20',_0x5b2133[_0x215f52(0x118)],'\x20(',_0x5b2133['datasetCode'],')']}),_0x5b2133['error']&&a3_0x3874d6(Box,{'marginLeft':0x2,'children':a3_0x3874d6(Text,{'color':'dim','children':_0x5b2133['error']})})]},_0x3bdd6c))]})]}),_0x373193&&a3_0x551b59(Box,{'flexDirection':'column','children':[a3_0x3874d6(Box,{'children':a3_0x551b59(Text,{'color':_0x215f52(0x130),'children':['❌\x20',_0x373193]})}),_0x373193[_0x215f52(0x143)]('登录')&&a3_0x551b59(Box,{'marginTop':0x1,'children':[a3_0x3874d6(Text,{'color':_0x215f52(0x11b),'children':_0x215f52(0x136)}),a3_0x3874d6(Text,{'color':_0x215f52(0x141),'children':_0x215f52(0x138)}),a3_0x3874d6(Text,{'color':'yellow','children':'\x20重新登录后再试'})]})]})]});};
@@ -1 +1 @@
1
- const a4_0xab036b=a4_0x2201;function a4_0x506f(){const _0xd7b122=['6252cHAkDp','name','获取文档失败\x20(','./docs','text','message','length','等待\x203\x20秒...\x0a','),HTTP状态码:\x20','72OdnjiG','):缺少\x20data.markdown\x20字段','success','3157630VXZQAr','3nTmmAb','log','dataset_',']\x20正在生成:\x20','\x0a共有\x20','140449sWVDcO','4sYWxCE','push','tableName','592220SNqsYC','2472uQRkLd','string','markdown','json','1727vNgjJu','api-doc','utf8','1753376sCVekh','application/json','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','.md\x20-\x20','status','✓\x20成功生成:\x20','4705GtRWEB','88533tiAWLr','data','code','error'];a4_0x506f=function(){return _0xd7b122;};return a4_0x506f();}(function(_0x3b62b8,_0x54cba5){const _0x95d599=a4_0x2201,_0x4d7dfd=_0x3b62b8();while(!![]){try{const _0x42a08d=-parseInt(_0x95d599(0xce))/0x1*(parseInt(_0x95d599(0xcf))/0x2)+-parseInt(_0x95d599(0xc9))/0x3*(-parseInt(_0x95d599(0xda))/0x4)+-parseInt(_0x95d599(0xe0))/0x5*(parseInt(_0x95d599(0xd3))/0x6)+parseInt(_0x95d599(0xc8))/0x7+parseInt(_0x95d599(0xc5))/0x8*(-parseInt(_0x95d599(0xe1))/0x9)+parseInt(_0x95d599(0xd2))/0xa+parseInt(_0x95d599(0xd7))/0xb*(parseInt(_0x95d599(0xe5))/0xc);if(_0x42a08d===_0x54cba5)break;else _0x4d7dfd['push'](_0x4d7dfd['shift']());}catch(_0x5f56b6){_0x4d7dfd['push'](_0x4d7dfd['shift']());}}}(a4_0x506f,0x42bb2));import{mkdirSync,writeFileSync}from'node:fs';import a4_0xa8ebe2 from'node:path';function a4_0x2201(_0xcc8191,_0x203703){const _0x506fe0=a4_0x506f();return a4_0x2201=function(_0x220132,_0x517622){_0x220132=_0x220132-0xbf;let _0x556bd5=_0x506fe0[_0x220132];return _0x556bd5;},a4_0x2201(_0xcc8191,_0x203703);}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x194ddc){const _0x30a055=a4_0x2201,{appCode:_0x11509d,datasetCode:_0xf13949,datasetId:_0x26d5d1}=_0x194ddc,_0x4a6cd5=getApiDomain(),_0x58666d=_0x4a6cd5+'/api/node-toolbox/api-doc-generator',_0x2c44e4=await fetch(_0x58666d,{'method':'POST','headers':{'Content-Type':_0x30a055(0xdb),'Cookie':getCookie()},'body':JSON['stringify']({'appCode':_0x11509d,'datasetCode':_0xf13949,'datasetId':_0x26d5d1})});if(!_0x2c44e4['ok']){if(_0x2c44e4['status']===0x191)throw new Error(_0x30a055(0xdc));let _0x3140cf='';try{_0x3140cf=await _0x2c44e4[_0x30a055(0xc0)]();}catch(_0x4c10ed){}throw new Error(_0x30a055(0xe7)+_0xf13949+_0x30a055(0xc4)+_0x2c44e4[_0x30a055(0xde)]+(_0x3140cf?'\x0a'+_0x3140cf:''));}const _0x57e929=await _0x2c44e4[_0x30a055(0xd6)]();if(!_0x57e929[_0x30a055(0xe2)]||typeof _0x57e929[_0x30a055(0xe2)][_0x30a055(0xd5)]!==_0x30a055(0xd4))throw new Error('响应数据格式错误\x20('+_0xf13949+_0x30a055(0xc6));return _0x57e929[_0x30a055(0xe2)][_0x30a055(0xd5)];}function delay(_0x3d8b60){return new Promise(_0x474b3b=>setTimeout(_0x474b3b,_0x3d8b60));}export async function generateDatasetDocs(_0x1a65b3,_0x8baee7,_0xd11298=a4_0xab036b(0xbf),_0x2be190){const _0x4cd70a=a4_0xab036b;mkdirSync(_0xd11298,{'recursive':!![]});const _0x355501=[],_0x5c6430=_0x1a65b3['length'];console[_0x4cd70a(0xca)](_0x4cd70a(0xcd)+_0x5c6430+'\x20个数据集需要生成文档\x0a');for(let _0x2ddb30=0x0;_0x2ddb30<_0x1a65b3[_0x4cd70a(0xc2)];_0x2ddb30++){const _0x26f0e2=_0x1a65b3[_0x2ddb30],_0x153ca5=_0x2ddb30+0x1;let _0x33754e;if(_0x26f0e2['dbtableConfig']?.[_0x4cd70a(0xd1)])_0x33754e=_0x26f0e2['dbtableConfig']['tableName'];else{const _0xdf09d2=_0x26f0e2['code']['slice'](-0x4);_0x33754e=_0x4cd70a(0xcb)+_0xdf09d2;}try{console[_0x4cd70a(0xca)]('['+_0x153ca5+'/'+_0x5c6430+_0x4cd70a(0xcc)+_0x33754e+'.md\x20('+_0x26f0e2['name']+')');_0x2be190&&_0x2be190(_0x153ca5,_0x5c6430,_0x33754e);const _0x5b4499=await fetchDatasetDoc({'appCode':_0x8baee7,'datasetCode':_0x26f0e2['code'],'datasetId':_0x26f0e2['id'],'enableAI':![]}),_0x126a8c=a4_0xa8ebe2['join'](_0xd11298,_0x33754e+'.md');writeFileSync(_0x126a8c,_0x5b4499,{'encoding':_0x4cd70a(0xd9)}),console[_0x4cd70a(0xca)](_0x4cd70a(0xdf)+_0x33754e+'.md'),logger[_0x4cd70a(0xc7)](_0x4cd70a(0xd8),'生成文档成功:\x20'+_0x33754e,undefined,{'datasetCode':_0x26f0e2[_0x4cd70a(0xe3)],'datasetName':_0x26f0e2[_0x4cd70a(0xe6)],'filePath':_0x126a8c,'progress':_0x153ca5+'/'+_0x5c6430}),_0x355501[_0x4cd70a(0xd0)]({'datasetCode':_0x26f0e2['code'],'datasetName':_0x26f0e2[_0x4cd70a(0xe6)],'filePath':_0x126a8c,'success':!![]}),_0x153ca5<_0x5c6430&&await delay(0xbb8);}catch(_0x5ee4bf){const _0x5f12d4=_0x5ee4bf instanceof Error?_0x5ee4bf[_0x4cd70a(0xc1)]:String(_0x5ee4bf);console[_0x4cd70a(0xca)]('✗\x20失败:\x20'+_0x33754e+_0x4cd70a(0xdd)+_0x5f12d4+'\x0a'),logger[_0x4cd70a(0xe4)](_0x4cd70a(0xd8),'生成文档失败:\x20'+_0x26f0e2['code'],{'datasetCode':_0x26f0e2[_0x4cd70a(0xe3)],'datasetName':_0x26f0e2[_0x4cd70a(0xe6)],'error':_0x5f12d4,'progress':_0x153ca5+'/'+_0x5c6430}),_0x355501[_0x4cd70a(0xd0)]({'datasetCode':_0x26f0e2[_0x4cd70a(0xe3)],'datasetName':_0x26f0e2['name'],'filePath':'','success':![],'error':_0x5f12d4}),_0x153ca5<_0x5c6430&&(console['log'](_0x4cd70a(0xc3)),await delay(0xbb8));}}return _0x355501;}
1
+ function a4_0x48c7(_0x1aeca6,_0x261e4d){const _0x5f5d3f=a4_0x5f5d();return a4_0x48c7=function(_0x48c782,_0x3778db){_0x48c782=_0x48c782-0x11c;let _0x2f89b1=_0x5f5d3f[_0x48c782];return _0x2f89b1;},a4_0x48c7(_0x1aeca6,_0x261e4d);}const a4_0x5563bb=a4_0x48c7;(function(_0x1b672b,_0xd5dc7){const _0x19a8fc=a4_0x48c7,_0x3fc434=_0x1b672b();while(!![]){try{const _0x4a05e0=parseInt(_0x19a8fc(0x12c))/0x1+-parseInt(_0x19a8fc(0x147))/0x2+-parseInt(_0x19a8fc(0x12f))/0x3+parseInt(_0x19a8fc(0x13e))/0x4*(-parseInt(_0x19a8fc(0x11e))/0x5)+parseInt(_0x19a8fc(0x145))/0x6*(parseInt(_0x19a8fc(0x14a))/0x7)+-parseInt(_0x19a8fc(0x120))/0x8*(parseInt(_0x19a8fc(0x13c))/0x9)+parseInt(_0x19a8fc(0x11d))/0xa;if(_0x4a05e0===_0xd5dc7)break;else _0x3fc434['push'](_0x3fc434['shift']());}catch(_0x354f81){_0x3fc434['push'](_0x3fc434['shift']());}}}(a4_0x5f5d,0xb6ed6));import{mkdirSync,writeFileSync}from'node:fs';import a4_0x4ff368 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x3b512c){const _0x96d7=a4_0x48c7,{appCode:_0x335b7e,datasetCode:_0x5cd684,datasetId:_0x13da51,extraParams:_0xdfdad9}=_0x3b512c,_0x581e58=getApiDomain(),_0x23afff=_0x581e58+_0x96d7(0x131),_0x214fbf={'appCode':_0x335b7e,'datasetCode':_0x5cd684,'datasetId':_0x13da51,..._0xdfdad9||{}},_0x1a2609=await fetch(_0x23afff,{'method':_0x96d7(0x137),'headers':{'Content-Type':_0x96d7(0x136),'Cookie':getCookie()},'body':JSON['stringify'](_0x214fbf)});if(!_0x1a2609['ok']){if(_0x1a2609[_0x96d7(0x127)]===0x191)throw new Error(_0x96d7(0x129));let _0x6628e4='';try{_0x6628e4=await _0x1a2609[_0x96d7(0x130)]();}catch(_0x2f6fb3){}throw new Error(_0x96d7(0x125)+_0x5cd684+_0x96d7(0x132)+_0x1a2609[_0x96d7(0x127)]+(_0x6628e4?'\x0a'+_0x6628e4:''));}const _0x4ff86f=await _0x1a2609[_0x96d7(0x13d)]();if(!_0x4ff86f[_0x96d7(0x133)]||typeof _0x4ff86f[_0x96d7(0x133)][_0x96d7(0x149)]!=='string')throw new Error(_0x96d7(0x123)+_0x5cd684+_0x96d7(0x124));return _0x4ff86f[_0x96d7(0x133)][_0x96d7(0x149)];}function a4_0x5f5d(){const _0x32d5d9=[']\x20正在生成:\x20','420hIfqiV','code','1211818uSPijn','api-doc','markdown','4228gLrPka','slice','43283550Ueezuz','5YBiOQw','name','4424zcxGUr','.md\x20-\x20','dataset_','响应数据格式错误\x20(','):缺少\x20data.markdown\x20字段','获取文档失败\x20(','push','status','log','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','success','✗\x20失败:\x20','97077QiRuOm','.md','等待\x203\x20秒...\x0a','3656001NtdoPI','text','/api/node-toolbox/api-doc-generator','),HTTP状态码:\x20','data','error','\x20个数据集需要生成文档\x0a','application/json','POST','utf8','length','./docs','dbtableConfig','20133ErHeUT','json','2627220LNVHcy','message','\x0a共有\x20','✓\x20成功生成:\x20','生成文档失败:\x20','.md\x20('];a4_0x5f5d=function(){return _0x32d5d9;};return a4_0x5f5d();}function delay(_0x151619){return new Promise(_0x107bca=>setTimeout(_0x107bca,_0x151619));}export async function generateDatasetDocs(_0x230259,_0x2cfab1,_0x42f099=a4_0x5563bb(0x13a),_0x4d3fb6,_0x40bccc){const _0x4fad97=a4_0x5563bb;mkdirSync(_0x42f099,{'recursive':!![]});const _0x52cf24=[],_0x24d16c=_0x230259[_0x4fad97(0x139)];console[_0x4fad97(0x128)](_0x4fad97(0x140)+_0x24d16c+_0x4fad97(0x135));for(let _0x342202=0x0;_0x342202<_0x230259[_0x4fad97(0x139)];_0x342202++){const _0x4abb3a=_0x230259[_0x342202],_0x1e0cd9=_0x342202+0x1;let _0x49547e;if(_0x4abb3a[_0x4fad97(0x13b)]?.['tableName'])_0x49547e=_0x4abb3a[_0x4fad97(0x13b)]['tableName'];else{const _0x213dd6=_0x4abb3a[_0x4fad97(0x146)][_0x4fad97(0x11c)](-0x6)['padStart'](0x6,'0');_0x49547e=_0x4fad97(0x122)+_0x213dd6;}try{console[_0x4fad97(0x128)]('['+_0x1e0cd9+'/'+_0x24d16c+_0x4fad97(0x144)+_0x49547e+_0x4fad97(0x143)+_0x4abb3a[_0x4fad97(0x11f)]+')');_0x4d3fb6&&_0x4d3fb6(_0x1e0cd9,_0x24d16c,_0x49547e);const _0x3847cc=await fetchDatasetDoc({'appCode':_0x2cfab1,'datasetCode':_0x4abb3a[_0x4fad97(0x146)],'datasetId':_0x4abb3a['id'],'enableAI':![],'extraParams':_0x40bccc}),_0x59ed40=a4_0x4ff368['join'](_0x42f099,_0x49547e+_0x4fad97(0x12d));writeFileSync(_0x59ed40,_0x3847cc,{'encoding':_0x4fad97(0x138)}),console[_0x4fad97(0x128)](_0x4fad97(0x141)+_0x49547e+_0x4fad97(0x12d)),logger[_0x4fad97(0x12a)](_0x4fad97(0x148),'生成文档成功:\x20'+_0x49547e,undefined,{'datasetCode':_0x4abb3a['code'],'datasetName':_0x4abb3a[_0x4fad97(0x11f)],'filePath':_0x59ed40,'progress':_0x1e0cd9+'/'+_0x24d16c}),_0x52cf24[_0x4fad97(0x126)]({'datasetCode':_0x4abb3a[_0x4fad97(0x146)],'datasetName':_0x4abb3a['name'],'filePath':_0x59ed40,'success':!![]});}catch(_0x46fcbc){const _0x378c1c=_0x46fcbc instanceof Error?_0x46fcbc[_0x4fad97(0x13f)]:String(_0x46fcbc);console[_0x4fad97(0x128)](_0x4fad97(0x12b)+_0x49547e+_0x4fad97(0x121)+_0x378c1c+'\x0a'),logger[_0x4fad97(0x134)](_0x4fad97(0x148),_0x4fad97(0x142)+_0x4abb3a[_0x4fad97(0x146)],{'datasetCode':_0x4abb3a[_0x4fad97(0x146)],'datasetName':_0x4abb3a[_0x4fad97(0x11f)],'error':_0x378c1c,'progress':_0x1e0cd9+'/'+_0x24d16c}),_0x52cf24[_0x4fad97(0x126)]({'datasetCode':_0x4abb3a[_0x4fad97(0x146)],'datasetName':_0x4abb3a['name'],'filePath':'','success':![],'error':_0x378c1c}),_0x1e0cd9<_0x24d16c&&(console[_0x4fad97(0x128)](_0x4fad97(0x12e)),await delay(0xbb8));}}return _0x52cf24;}
@@ -1 +1 @@
1
- (function(_0x2dc870,_0x3b4846){const _0x1ed1a7=a5_0xc5ac,_0x3dca04=_0x2dc870();while(!![]){try{const _0x11fcc3=parseInt(_0x1ed1a7(0x164))/0x1+parseInt(_0x1ed1a7(0x152))/0x2+-parseInt(_0x1ed1a7(0x161))/0x3*(-parseInt(_0x1ed1a7(0x15e))/0x4)+parseInt(_0x1ed1a7(0x159))/0x5+-parseInt(_0x1ed1a7(0x157))/0x6+parseInt(_0x1ed1a7(0x17a))/0x7*(-parseInt(_0x1ed1a7(0x186))/0x8)+parseInt(_0x1ed1a7(0x177))/0x9;if(_0x11fcc3===_0x3b4846)break;else _0x3dca04['push'](_0x3dca04['shift']());}catch(_0x3334b8){_0x3dca04['push'](_0x3dca04['shift']());}}}(a5_0x4d1a,0x3f0e1));import{jsx as a5_0x227a5b,jsxs as a5_0x3a635b}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a5_0x4d1a(){const _0x1c4dda=['endsWith','red','datasetCount','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','{\x20lovrabetClient\x20}','lovrabet\x20auth','api','!\x20原始数据集\x20','./src/api/','💡\x20请使用\x20','2081512zgSPIz','api-pull','58636jGrdBi','cyan','-api','join','string','252678xsqhUT','env','411285EdEbjn','.ts','-client','\x20from\x20\x27@/','使用指定的应用AppCode:\x20','12YnTMrW','*\x20已生成文件:','拉取\x20API\x20配置失败:\x20','158097bDnEGN','column','replace','49864zcXQQZ','\x20-\x20客户端实例文件','未提供应用AppCode,且配置中也没有默认值','modelCount','cwd','\x20个模型','*\x20导入方式:','-\x20模型配置文件\x20(','green','yellow','\x20重新登录后再试','error','split','\x20个模型)','\x20个数据集,生成','使用配置的应用AppCode:\x20','includes','online','dim','2169351WgtRcE','client','\x20个,过滤重复','7wBODoO','gray'];a5_0x4d1a=function(){return _0x1c4dda;};return a5_0x4d1a();}import{initEnv}from'../constant/env.js';function a5_0xc5ac(_0x31e37c,_0x5b6904){const _0x4d1ad5=a5_0x4d1a();return a5_0xc5ac=function(_0xc5acde,_0x59e302){_0xc5acde=_0xc5acde-0x151;let _0x4bb07b=_0x4d1ad5[_0xc5acde];return _0x4bb07b;},a5_0xc5ac(_0x31e37c,_0x5b6904);}import{fetchDatasets}from'./fetch-datasets.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0xdf2384,env:_0x48fa7c,output:_0x3c7e68})=>{const _0x5cd369=a5_0xc5ac,{exit:_0x853ea5}=useApp(),[_0x325ec1,_0x28e421]=useState(![]),[_0x43766a,_0x35f518]=useState(![]),[_0x5b3739,_0x3f09a0]=useState(null),[_0x36ae40,_0x1ef4b8]=useState(null),_0x1586c7=readConfig(),_0x5c270f=getConfigAppCode(),_0x5beae4=_0xdf2384||_0x5c270f,_0x48722c=typeof _0x1586c7?.['env']===_0x5cd369(0x156)?_0x1586c7[_0x5cd369(0x158)]:undefined,_0x4644da=_0x48fa7c||_0x48722c||_0x5cd369(0x175);initEnv(_0x4644da);const _0x4a55e3=_0x3c7e68||_0x5cd369(0x184),_0x5d0f98=_0xdf2384&&_0xdf2384[_0x5cd369(0x174)]('-')?_0xdf2384[_0x5cd369(0x170)]('-')['slice'](0x1)[_0x5cd369(0x155)]('-'):'',_0x50bd78=_0xdf2384?_0x5cd369(0x15d)+_0x5beae4:_0x5cd369(0x173)+_0x5beae4,_0x4d1cc6=_0x5d0f98?_0x5d0f98+_0x5cd369(0x154):_0x5cd369(0x182),_0x45f8a5=_0x5d0f98?_0x5d0f98+_0x5cd369(0x15b):_0x5cd369(0x178);useEffect(()=>{_0x28e421(!![]),_0x36bbbd();},[]),useEffect(()=>{(_0x43766a||_0x5b3739)&&_0x853ea5();},[_0x43766a,_0x5b3739,_0x853ea5]);async function _0x36bbbd(){const _0x1dc146=_0x5cd369;if(!_0x5beae4){_0x3f09a0(_0x1dc146(0x166));return;}try{logger['setLogPath'](process[_0x1dc146(0x168)]());const {rawData:_0x56d38d,originalCount:_0x1511b9,filteredCount:_0x51777c,duplicateCount:_0x553665}=await fetchDatasets(_0x5beae4),_0x37e907=_0x51777c,_0x4730fe=!_0xdf2384,_0x4dbb45=await generateApiFile(_0x56d38d,_0x5d0f98,_0x5beae4,_0x4730fe,_0x4644da,_0x4a55e3),_0x5dd6b0=_0x4a55e3[_0x1dc146(0x17c)]('/')?_0x4a55e3:_0x4a55e3+'/';_0x1ef4b8({'api':''+_0x5dd6b0+_0x4d1cc6+_0x1dc146(0x15a),'client':''+_0x5dd6b0+_0x45f8a5+_0x1dc146(0x15a),'modelCount':_0x4dbb45[_0x1dc146(0x167)],'datasetCount':_0x37e907,'originalCount':_0x1511b9,'duplicateCount':_0x553665}),_0x35f518(!![]);}catch(_0x25134d){const _0xef3c2c=_0x25134d instanceof Error?_0x25134d['message']:String(_0x25134d);logger[_0x1dc146(0x16f)](_0x1dc146(0x151),_0x1dc146(0x160)+_0xef3c2c,{'appCode':_0x5beae4,'error':_0xef3c2c}),_0x3f09a0(_0x1dc146(0x160)+_0xef3c2c);}finally{_0x28e421(![]);}}return a5_0x3a635b(Box,{'flexDirection':_0x5cd369(0x162),'children':[(_0x325ec1||_0x43766a)&&a5_0x3a635b(Box,{'children':[a5_0x227a5b(Text,{'color':'gray','children':'*\x20'}),a5_0x227a5b(Text,{'color':_0xdf2384?'white':'dim','children':_0x50bd78})]}),_0x325ec1&&a5_0x227a5b(Box,{'children':a5_0x3a635b(Text,{'children':[_0x5cd369(0x17f),_0x4644da,')']})}),_0x43766a&&_0x36ae40&&a5_0x3a635b(Box,{'flexDirection':'column','children':[a5_0x227a5b(Box,{'children':a5_0x3a635b(Text,{'color':_0x5cd369(0x16c),'children':['√\x20成功拉取\x20',_0x36ae40[_0x5cd369(0x17e)],_0x5cd369(0x172),'\x20',_0x36ae40[_0x5cd369(0x167)],_0x5cd369(0x169)]})}),_0x36ae40['duplicateCount']>0x0&&a5_0x227a5b(Box,{'marginTop':0x1,'children':a5_0x3a635b(Text,{'color':'yellow','children':[_0x5cd369(0x183),_0x36ae40['originalCount'],_0x5cd369(0x179),'\x20',_0x36ae40['duplicateCount'],'\x20个']})}),a5_0x227a5b(Box,{'marginTop':0x1,'children':a5_0x227a5b(Text,{'color':_0x5cd369(0x17b),'children':_0x5cd369(0x15f)})}),a5_0x3a635b(Box,{'marginLeft':0x2,'children':[a5_0x3a635b(Text,{'color':'cyan','children':['•\x20',_0x36ae40[_0x5cd369(0x182)]]}),a5_0x3a635b(Text,{'color':_0x5cd369(0x176),'children':['\x20',_0x5cd369(0x16b),_0x36ae40[_0x5cd369(0x167)],_0x5cd369(0x171)]})]}),a5_0x3a635b(Box,{'marginLeft':0x2,'children':[a5_0x3a635b(Text,{'color':'cyan','children':['•\x20',_0x36ae40[_0x5cd369(0x178)]]}),a5_0x227a5b(Text,{'color':_0x5cd369(0x176),'children':_0x5cd369(0x165)})]}),a5_0x227a5b(Box,{'marginTop':0x1,'children':a5_0x227a5b(Text,{'color':_0x5cd369(0x17b),'children':_0x5cd369(0x16a)})}),a5_0x227a5b(Box,{'marginLeft':0x2,'children':a5_0x3a635b(Text,{'color':_0x5cd369(0x16d),'children':['import\x20',_0x5cd369(0x180),_0x5cd369(0x15c),_0x36ae40[_0x5cd369(0x178)][_0x5cd369(0x163)](/^\.\//,'')[_0x5cd369(0x163)](_0x5cd369(0x15a),''),'\x27']})})]}),_0x5b3739&&a5_0x3a635b(Box,{'flexDirection':_0x5cd369(0x162),'children':[a5_0x227a5b(Box,{'children':a5_0x3a635b(Text,{'color':_0x5cd369(0x17d),'children':['❌\x20',_0x5b3739]})}),_0x5b3739[_0x5cd369(0x174)]('登录')&&a5_0x3a635b(Box,{'marginTop':0x1,'children':[a5_0x227a5b(Text,{'color':_0x5cd369(0x16d),'children':_0x5cd369(0x185)}),a5_0x227a5b(Text,{'color':_0x5cd369(0x153),'children':_0x5cd369(0x181)}),a5_0x227a5b(Text,{'color':_0x5cd369(0x16d),'children':_0x5cd369(0x16e)})]})]})]});};
1
+ (function(_0x4a534f,_0x5a08ef){const _0x5a7782=a5_0x2afc,_0xa5c50b=_0x4a534f();while(!![]){try{const _0x35eca2=parseInt(_0x5a7782(0x132))/0x1*(-parseInt(_0x5a7782(0x124))/0x2)+-parseInt(_0x5a7782(0x13c))/0x3+-parseInt(_0x5a7782(0x147))/0x4+parseInt(_0x5a7782(0x136))/0x5+parseInt(_0x5a7782(0x133))/0x6+-parseInt(_0x5a7782(0x128))/0x7+parseInt(_0x5a7782(0x130))/0x8*(parseInt(_0x5a7782(0x12d))/0x9);if(_0x35eca2===_0x5a08ef)break;else _0xa5c50b['push'](_0xa5c50b['shift']());}catch(_0x282d3c){_0xa5c50b['push'](_0xa5c50b['shift']());}}}(a5_0x31dd,0x1e859));import{jsx as a5_0x256cc1,jsxs as a5_0x187dd7}from'react/jsx-runtime';import{useEffect,useState}from'react';function a5_0x31dd(){const _0x1bda15=['env','\x20重新登录后再试','slice','online','import\x20','131760ZFkZpd','💡\x20请使用\x20','\x20个模型','red','\x20个,过滤重复','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','\x20-\x20客户端实例文件','setLogPath','api','√\x20成功拉取\x20','cyan','690668WxEcHQ','lovrabet\x20auth','*\x20导入方式:','拉取\x20API\x20配置失败:\x20','{\x20lovrabetClient\x20}','white','*\x20已生成文件:','column','gray','.ts','\x20from\x20\x27@/','client','modelCount','yellow','split','duplicateCount','green','使用指定的应用AppCode:\x20','1282gnAOhH','-client','dim','originalCount','1151290cXIOSl','\x20个模型)','api-pull','使用配置的应用AppCode:\x20','未提供应用AppCode,且配置中也没有默认值','3436020BvJgaj','\x20个数据集,生成','replace','8STJopZ','datasetCount','362CuCcKR','1201170kFuQXm','-\x20模型配置文件\x20(','includes','780705BYucsC'];a5_0x31dd=function(){return _0x1bda15;};return a5_0x31dd();}import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a5_0x2afc(_0x5d6315,_0x4b07ab){const _0x31ddfa=a5_0x31dd();return a5_0x2afc=function(_0x2afcfe,_0x1a4cfd){_0x2afcfe=_0x2afcfe-0x118;let _0x5ae9fa=_0x31ddfa[_0x2afcfe];return _0x5ae9fa;},a5_0x2afc(_0x5d6315,_0x4b07ab);}import{initEnv}from'../constant/env.js';import{fetchDatasets}from'./fetch-datasets.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0x4a8fb9,env:_0x3a6146,output:_0x51e5ee})=>{const _0x3a61b7=a5_0x2afc,{exit:_0x2c95d7}=useApp(),[_0x380fe0,_0x33ef0d]=useState(![]),[_0x191d04,_0x25dd46]=useState(![]),[_0x4bb3a3,_0x3ae341]=useState(null),[_0x4c9891,_0x1d6296]=useState(null),_0x5518d5=readConfig(),_0x32ab23=getConfigAppCode(),_0x186c32=_0x4a8fb9||_0x32ab23,_0x5a54ad=typeof _0x5518d5?.[_0x3a61b7(0x137)]==='string'?_0x5518d5['env']:undefined,_0x287d00=_0x3a6146||_0x5a54ad||_0x3a61b7(0x13a);initEnv(_0x287d00);const _0x2294bb=_0x51e5ee||'./src/api/',_0x46fa88=_0x4a8fb9&&_0x4a8fb9[_0x3a61b7(0x135)]('-')?_0x4a8fb9[_0x3a61b7(0x120)]('-')[_0x3a61b7(0x139)](0x1)['join']('-'):'',_0x2022bb=_0x4a8fb9?_0x3a61b7(0x123)+_0x186c32:_0x3a61b7(0x12b)+_0x186c32,_0x387bee=_0x46fa88?_0x46fa88+'-api':_0x3a61b7(0x144),_0x5542a6=_0x46fa88?_0x46fa88+_0x3a61b7(0x125):_0x3a61b7(0x11d);useEffect(()=>{_0x33ef0d(!![]),_0x505301();},[]),useEffect(()=>{(_0x191d04||_0x4bb3a3)&&_0x2c95d7();},[_0x191d04,_0x4bb3a3,_0x2c95d7]);async function _0x505301(){const _0x45e41f=_0x3a61b7;if(!_0x186c32){_0x3ae341(_0x45e41f(0x12c));return;}try{logger[_0x45e41f(0x143)](process['cwd']());const {rawData:_0x1a96de,originalCount:_0x4abc26,filteredCount:_0x15d30c,duplicateCount:_0x197ca6}=await fetchDatasets(_0x186c32),_0xbea49e=_0x15d30c,_0x36099b=!_0x4a8fb9,_0x98f242=await generateApiFile(_0x1a96de,_0x46fa88,_0x186c32,_0x36099b,_0x287d00,_0x2294bb),_0x61ddbf=_0x2294bb['endsWith']('/')?_0x2294bb:_0x2294bb+'/';_0x1d6296({'api':''+_0x61ddbf+_0x387bee+'.ts','client':''+_0x61ddbf+_0x5542a6+_0x45e41f(0x11b),'modelCount':_0x98f242[_0x45e41f(0x11e)],'datasetCount':_0xbea49e,'originalCount':_0x4abc26,'duplicateCount':_0x197ca6}),_0x25dd46(!![]);}catch(_0xd91730){const _0x3a8263=_0xd91730 instanceof Error?_0xd91730['message']:String(_0xd91730);logger['error'](_0x45e41f(0x12a),_0x45e41f(0x14a)+_0x3a8263,{'appCode':_0x186c32,'error':_0x3a8263}),_0x3ae341(_0x45e41f(0x14a)+_0x3a8263);}finally{_0x33ef0d(![]);}}return a5_0x187dd7(Box,{'flexDirection':_0x3a61b7(0x119),'children':[(_0x380fe0||_0x191d04)&&a5_0x187dd7(Box,{'children':[a5_0x256cc1(Text,{'color':_0x3a61b7(0x11a),'children':'*\x20'}),a5_0x256cc1(Text,{'color':_0x4a8fb9?_0x3a61b7(0x14c):_0x3a61b7(0x126),'children':_0x2022bb})]}),_0x380fe0&&a5_0x256cc1(Box,{'children':a5_0x187dd7(Text,{'children':[_0x3a61b7(0x141),_0x287d00,')']})}),_0x191d04&&_0x4c9891&&a5_0x187dd7(Box,{'flexDirection':_0x3a61b7(0x119),'children':[a5_0x256cc1(Box,{'children':a5_0x187dd7(Text,{'color':_0x3a61b7(0x122),'children':[_0x3a61b7(0x145),_0x4c9891[_0x3a61b7(0x131)],_0x3a61b7(0x12e),'\x20',_0x4c9891[_0x3a61b7(0x11e)],_0x3a61b7(0x13e)]})}),_0x4c9891[_0x3a61b7(0x121)]>0x0&&a5_0x256cc1(Box,{'marginTop':0x1,'children':a5_0x187dd7(Text,{'color':_0x3a61b7(0x11f),'children':['!\x20原始数据集\x20',_0x4c9891[_0x3a61b7(0x127)],_0x3a61b7(0x140),'\x20',_0x4c9891['duplicateCount'],'\x20个']})}),a5_0x256cc1(Box,{'marginTop':0x1,'children':a5_0x256cc1(Text,{'color':'gray','children':_0x3a61b7(0x118)})}),a5_0x187dd7(Box,{'marginLeft':0x2,'children':[a5_0x187dd7(Text,{'color':_0x3a61b7(0x146),'children':['•\x20',_0x4c9891[_0x3a61b7(0x144)]]}),a5_0x187dd7(Text,{'color':'dim','children':['\x20',_0x3a61b7(0x134),_0x4c9891['modelCount'],_0x3a61b7(0x129)]})]}),a5_0x187dd7(Box,{'marginLeft':0x2,'children':[a5_0x187dd7(Text,{'color':_0x3a61b7(0x146),'children':['•\x20',_0x4c9891[_0x3a61b7(0x11d)]]}),a5_0x256cc1(Text,{'color':_0x3a61b7(0x126),'children':_0x3a61b7(0x142)})]}),a5_0x256cc1(Box,{'marginTop':0x1,'children':a5_0x256cc1(Text,{'color':_0x3a61b7(0x11a),'children':_0x3a61b7(0x149)})}),a5_0x256cc1(Box,{'marginLeft':0x2,'children':a5_0x187dd7(Text,{'color':_0x3a61b7(0x11f),'children':[_0x3a61b7(0x13b),_0x3a61b7(0x14b),_0x3a61b7(0x11c),_0x4c9891['client'][_0x3a61b7(0x12f)](/^\.\//,'')[_0x3a61b7(0x12f)](_0x3a61b7(0x11b),''),'\x27']})})]}),_0x4bb3a3&&a5_0x187dd7(Box,{'flexDirection':_0x3a61b7(0x119),'children':[a5_0x256cc1(Box,{'children':a5_0x187dd7(Text,{'color':_0x3a61b7(0x13f),'children':['❌\x20',_0x4bb3a3]})}),_0x4bb3a3[_0x3a61b7(0x135)]('登录')&&a5_0x187dd7(Box,{'marginTop':0x1,'children':[a5_0x256cc1(Text,{'color':'yellow','children':_0x3a61b7(0x13d)}),a5_0x256cc1(Text,{'color':'cyan','children':_0x3a61b7(0x148)}),a5_0x256cc1(Text,{'color':_0x3a61b7(0x11f),'children':_0x3a61b7(0x138)})]})]})]});};
@@ -1 +1 @@
1
- (function(_0x518b50,_0x54eabe){const _0x2a9ae7=a6_0x5f59,_0x38c8c8=_0x518b50();while(!![]){try{const _0x535d6c=parseInt(_0x2a9ae7(0x1e8))/0x1+parseInt(_0x2a9ae7(0x1f3))/0x2*(parseInt(_0x2a9ae7(0x1de))/0x3)+-parseInt(_0x2a9ae7(0x1d9))/0x4+parseInt(_0x2a9ae7(0x1f2))/0x5+parseInt(_0x2a9ae7(0x1db))/0x6*(parseInt(_0x2a9ae7(0x1df))/0x7)+-parseInt(_0x2a9ae7(0x1f5))/0x8+parseInt(_0x2a9ae7(0x1e7))/0x9*(-parseInt(_0x2a9ae7(0x1ea))/0xa);if(_0x535d6c===_0x54eabe)break;else _0x38c8c8['push'](_0x38c8c8['shift']());}catch(_0x1519ba){_0x38c8c8['push'](_0x38c8c8['shift']());}}}(a6_0x51a6,0x57ca4));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{formatDataset}from'./format-dataset.js';function a6_0x5f59(_0x32e925,_0xbc907b){const _0x51a644=a6_0x51a6();return a6_0x5f59=function(_0x5f5974,_0x59971e){_0x5f5974=_0x5f5974-0x1d9;let _0x4f559f=_0x51a644[_0x5f5974];return _0x4f559f;},a6_0x5f59(_0x32e925,_0xbc907b);}export function filterDuplicateDatasets(_0x31d06c){const _0x57a6e3=a6_0x5f59,_0x388335=_0x31d06c[_0x57a6e3(0x1f0)](_0x2b6211=>_0x2b6211[_0x57a6e3(0x1ec)]),_0x4dcff8=_0x31d06c['filter'](_0x3dd783=>!_0x3dd783[_0x57a6e3(0x1ec)]),_0x39de87=new Map();return _0x388335[_0x57a6e3(0x1e1)](_0x33c619=>{const _0x5b265f=_0x57a6e3,_0x336bc6=_0x33c619[_0x5b265f(0x1ec)][_0x5b265f(0x1f7)],_0x1fbfa8=_0x39de87[_0x5b265f(0x1ee)](_0x336bc6);(!_0x1fbfa8||_0x33c619['id']>_0x1fbfa8['id'])&&_0x39de87[_0x5b265f(0x1eb)](_0x336bc6,_0x33c619);}),[...Array[_0x57a6e3(0x1dc)](_0x39de87[_0x57a6e3(0x1e3)]()),..._0x4dcff8];}function a6_0x51a6(){const _0x323ec2=['4hmGcrx','/smartapi/dataset/getList?appCode=','5468040dHytOH','success','tableName','371544dVvVvQ','data','30hgZlhe','from','length','803628NvxzYq','552650GJvfuU','未知错误','forEach','tableData','values','获取数据集失败:\x20','status','message','27WEqrZt','545147SeRpVv','&pageSize=999&currentPage=1','1320860QAsaHI','set','dbtableConfig','text','get','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','filter','json','282940JPRTnB'];a6_0x51a6=function(){return _0x323ec2;};return a6_0x51a6();}export async function fetchDatasets(_0x6117d3){const _0x51d4a0=a6_0x5f59,_0x3b3bc8=await fetch(getApiDomain()+_0x51d4a0(0x1f4)+_0x6117d3+_0x51d4a0(0x1e9),{'headers':{'Cookie':getCookie()}});if(!_0x3b3bc8['ok']){if(_0x3b3bc8[_0x51d4a0(0x1e5)]===0x191)throw new Error(_0x51d4a0(0x1ef));let _0x562a6d='';try{_0x562a6d=await _0x3b3bc8[_0x51d4a0(0x1ed)]();}catch(_0x25145c){}throw new Error('获取数据集失败,HTTP状态码:\x20'+_0x3b3bc8[_0x51d4a0(0x1e5)]+(_0x562a6d?'\x0a'+_0x562a6d:''));}const _0x1f1b45=await _0x3b3bc8[_0x51d4a0(0x1f1)]();if(!_0x1f1b45[_0x51d4a0(0x1f6)])throw new Error(_0x51d4a0(0x1e4)+(_0x1f1b45[_0x51d4a0(0x1e6)]||_0x51d4a0(0x1e0)));const _0x3941f0=_0x1f1b45[_0x51d4a0(0x1da)][_0x51d4a0(0x1e2)],_0x51ec0e=_0x3941f0[_0x51d4a0(0x1dd)],_0x2d2752=filterDuplicateDatasets(_0x3941f0),_0x507c22=_0x2d2752['length'],_0x7bb620=_0x51ec0e-_0x507c22,_0x35c172=formatDataset(_0x2d2752);return{'datasets':_0x35c172,'rawData':_0x2d2752,'originalCount':_0x51ec0e,'filteredCount':_0x507c22,'duplicateCount':_0x7bb620};}
1
+ (function(_0x2836ff,_0x8a402b){const _0x56dccc=a6_0x396b,_0x20ba41=_0x2836ff();while(!![]){try{const _0x2ec9cb=-parseInt(_0x56dccc(0x1f7))/0x1+parseInt(_0x56dccc(0x1fd))/0x2*(-parseInt(_0x56dccc(0x201))/0x3)+parseInt(_0x56dccc(0x1f9))/0x4+parseInt(_0x56dccc(0x1ee))/0x5*(-parseInt(_0x56dccc(0x206))/0x6)+-parseInt(_0x56dccc(0x209))/0x7*(parseInt(_0x56dccc(0x1f5))/0x8)+-parseInt(_0x56dccc(0x1fa))/0x9*(parseInt(_0x56dccc(0x207))/0xa)+parseInt(_0x56dccc(0x20a))/0xb;if(_0x2ec9cb===_0x8a402b)break;else _0x20ba41['push'](_0x20ba41['shift']());}catch(_0x4cb5f2){_0x20ba41['push'](_0x20ba41['shift']());}}}(a6_0x321e,0xb7a14));function a6_0x321e(){const _0x43efb4=['set','8aSPUqQ','/smartapi/dataset/getList?appCode=','154983WwfhVG','text','788632SSmbVH','27cHFMjz','获取数据集失败,HTTP状态码:\x20','获取数据集失败:\x20','15494AIOZeL','from','dbtableConfig','get','381AIIPDU','未知错误','data','&pageSize=999&currentPage=1','success','1158DyRZEC','3148670bFxSxX','forEach','9648184NJVzWe','46751012nsoVjd','6045qbCWBh','tableName','status','tableData','message','length'];a6_0x321e=function(){return _0x43efb4;};return a6_0x321e();}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{formatDataset}from'./format-dataset.js';export function filterDuplicateDatasets(_0x36235a){const _0x300f3d=a6_0x396b,_0x265756=_0x36235a['filter'](_0x24fa1e=>_0x24fa1e[_0x300f3d(0x1ff)]),_0x4f36cb=_0x36235a['filter'](_0x69ceef=>!_0x69ceef[_0x300f3d(0x1ff)]),_0x29c7ac=new Map();return _0x265756[_0x300f3d(0x208)](_0x485a79=>{const _0x351646=_0x300f3d,_0x2f8481=_0x485a79[_0x351646(0x1ff)][_0x351646(0x1ef)],_0x4a51ea=_0x29c7ac[_0x351646(0x200)](_0x2f8481);(!_0x4a51ea||_0x485a79['id']>_0x4a51ea['id'])&&_0x29c7ac[_0x351646(0x1f4)](_0x2f8481,_0x485a79);}),[...Array[_0x300f3d(0x1fe)](_0x29c7ac['values']()),..._0x4f36cb];}function a6_0x396b(_0x101806,_0x23dc8c){const _0x321e37=a6_0x321e();return a6_0x396b=function(_0x396b60,_0x243d4b){_0x396b60=_0x396b60-0x1ee;let _0x466b9d=_0x321e37[_0x396b60];return _0x466b9d;},a6_0x396b(_0x101806,_0x23dc8c);}export async function fetchDatasets(_0x254d45){const _0xe33703=a6_0x396b,_0x159153=await fetch(getApiDomain()+_0xe33703(0x1f6)+_0x254d45+_0xe33703(0x204),{'headers':{'Cookie':getCookie()}});if(!_0x159153['ok']){if(_0x159153[_0xe33703(0x1f0)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');let _0x37978c='';try{_0x37978c=await _0x159153[_0xe33703(0x1f8)]();}catch(_0x373235){}throw new Error(_0xe33703(0x1fb)+_0x159153[_0xe33703(0x1f0)]+(_0x37978c?'\x0a'+_0x37978c:''));}const _0x3d5b1e=await _0x159153['json']();if(!_0x3d5b1e[_0xe33703(0x205)])throw new Error(_0xe33703(0x1fc)+(_0x3d5b1e[_0xe33703(0x1f2)]||_0xe33703(0x202)));const _0x46efc6=_0x3d5b1e[_0xe33703(0x203)][_0xe33703(0x1f1)],_0x43cec4=_0x46efc6[_0xe33703(0x1f3)],_0x5632cd=filterDuplicateDatasets(_0x46efc6),_0x4437f1=_0x5632cd['length'],_0x12f9c6=_0x43cec4-_0x4437f1,_0x907b07=formatDataset(_0x5632cd);return{'datasets':_0x907b07,'rawData':_0x5632cd,'originalCount':_0x43cec4,'filteredCount':_0x4437f1,'duplicateCount':_0x12f9c6};}
@@ -1 +1 @@
1
- function a7_0x4321(_0x1a4f11,_0x34bf7c){const _0x1271fb=a7_0x1271();return a7_0x4321=function(_0x432101,_0x29ba5c){_0x432101=_0x432101-0x1a1;let _0x4cc3c0=_0x1271fb[_0x432101];return _0x4cc3c0;},a7_0x4321(_0x1a4f11,_0x34bf7c);}(function(_0x41283e,_0x26c810){const _0x2a9bc3=a7_0x4321,_0x59495a=_0x41283e();while(!![]){try{const _0x4d1ab1=parseInt(_0x2a9bc3(0x1a6))/0x1+parseInt(_0x2a9bc3(0x1bb))/0x2*(-parseInt(_0x2a9bc3(0x1b3))/0x3)+-parseInt(_0x2a9bc3(0x1a8))/0x4+parseInt(_0x2a9bc3(0x1b1))/0x5*(-parseInt(_0x2a9bc3(0x1bd))/0x6)+-parseInt(_0x2a9bc3(0x1b0))/0x7*(parseInt(_0x2a9bc3(0x1b5))/0x8)+parseInt(_0x2a9bc3(0x1b6))/0x9*(parseInt(_0x2a9bc3(0x1ae))/0xa)+-parseInt(_0x2a9bc3(0x1b8))/0xb*(-parseInt(_0x2a9bc3(0x1be))/0xc);if(_0x4d1ab1===_0x26c810)break;else _0x59495a['push'](_0x59495a['shift']());}catch(_0x55d62b){_0x59495a['push'](_0x59495a['shift']());}}}(a7_0x1271,0x2a820));export function formatDataset(_0x4b3263){const _0x47a546=a7_0x4321,_0x37ea57=_0x4b3263[_0x47a546(0x1a3)](_0x53ec2b=>_0x53ec2b[_0x47a546(0x1ab)]),_0x19c247=_0x4b3263[_0x47a546(0x1a3)](_0x1a3fa5=>!_0x1a3fa5[_0x47a546(0x1ab)]),_0x525bff=new Map();_0x37ea57[_0x47a546(0x1af)](_0x368fa7=>{const _0x171e39=_0x47a546,_0x20978b=_0x368fa7[_0x171e39(0x1ab)][_0x171e39(0x1b2)],_0x5520c1=_0x525bff[_0x171e39(0x1a2)](_0x20978b);(!_0x5520c1||_0x368fa7['id']>_0x5520c1['id'])&&_0x525bff[_0x171e39(0x1a9)](_0x20978b,_0x368fa7);});const _0x32c329=Array[_0x47a546(0x1ad)](_0x525bff[_0x47a546(0x1a5)]())[_0x47a546(0x1c1)](_0x2cd7ff=>{const _0x1900ea=_0x47a546,_0x3b2a17=snakeToCamel(_0x2cd7ff['dbtableConfig'][_0x1900ea(0x1b2)]);return{'id':_0x2cd7ff['id'],'name':_0x2cd7ff[_0x1900ea(0x1b7)],'code':_0x2cd7ff[_0x1900ea(0x1ba)],'tableName':_0x2cd7ff['dbtableConfig'][_0x1900ea(0x1b2)],'apiFucName':_0x3b2a17?_0x3b2a17+_0x1900ea(0x1bc):_0x1900ea(0x1a7)+_0x2cd7ff['code']+'Api','pkField':_0x2cd7ff['dbtableConfig'][_0x1900ea(0x1a1)],'allFields':_0x2cd7ff[_0x1900ea(0x1ab)][_0x1900ea(0x1bf)][_0x1900ea(0x1aa)](',')};}),_0x45c1b9=_0x19c247['map'](_0x15aadb=>{const _0x44dbd9=_0x47a546,_0x2c2e45=_0x15aadb['code'][_0x44dbd9(0x1c0)](-0x6),_0x49cb62=_0x44dbd9(0x1ac)+_0x2c2e45,_0xafeb5=snakeToCamel(_0x49cb62);return{'id':_0x15aadb['id'],'name':_0x15aadb['name'],'code':_0x15aadb[_0x44dbd9(0x1ba)],'tableName':_0x49cb62,'apiFucName':_0xafeb5?_0xafeb5+_0x44dbd9(0x1bc):_0x44dbd9(0x1a7)+_0x2c2e45+_0x44dbd9(0x1bc),'pkField':undefined,'allFields':[]};});return[..._0x32c329,..._0x45c1b9];}function a7_0x1271(){const _0x275f79=['trim','248HarYXl','274842lBQwvX','name','2321ApUkvD','toUpperCase','code','523122VxEVNp','Api','42oyCrlF','33132sESTDz','allFields','slice','map','pkField','get','filter','replace','values','230610JHgtwe','dataset','861140SnqENu','set','split','dbtableConfig','dataset_','from','10joDKiU','forEach','36967IJpztX','20750KFpsXG','tableName','3bkddDy'];a7_0x1271=function(){return _0x275f79;};return a7_0x1271();}function snakeToCamel(_0x16e541){const _0x1f7cda=a7_0x4321;if(!_0x16e541)return _0x16e541;const _0x129ddf=_0x16e541[_0x1f7cda(0x1b4)]();return _0x129ddf[_0x1f7cda(0x1a4)](/_([a-zA-Z0-9])/g,(_0x2cf472,_0x568cb7)=>_0x568cb7[_0x1f7cda(0x1b9)]());}
1
+ function a7_0x1afa(){const _0x34a804=['pkField','7635xklwxg','map','Api','2422030TSiKKC','split','12MKRnni','dbtableConfig','allFields','replace','set','659187fSaNda','984MpPgCL','code','260622pHIOaV','trim','tableName','660930Trhspg','name','forEach','dataset','287312YVeVXp','1096QLZYSs','16919kSeEah','filter'];a7_0x1afa=function(){return _0x34a804;};return a7_0x1afa();}(function(_0x5732c3,_0x48dfdb){const _0x2c2b0e=a7_0x5b82,_0x46efa1=_0x5732c3();while(!![]){try{const _0x299e06=-parseInt(_0x2c2b0e(0x80))/0x1+parseInt(_0x2c2b0e(0x83))/0x2+-parseInt(_0x2c2b0e(0x78))/0x3*(parseInt(_0x2c2b0e(0x87))/0x4)+-parseInt(_0x2c2b0e(0x8c))/0x5*(parseInt(_0x2c2b0e(0x7e))/0x6)+parseInt(_0x2c2b0e(0x89))/0x7*(parseInt(_0x2c2b0e(0x88))/0x8)+parseInt(_0x2c2b0e(0x7d))/0x9+parseInt(_0x2c2b0e(0x76))/0xa;if(_0x299e06===_0x48dfdb)break;else _0x46efa1['push'](_0x46efa1['shift']());}catch(_0x40f6ca){_0x46efa1['push'](_0x46efa1['shift']());}}}(a7_0x1afa,0x2b9f6));function a7_0x5b82(_0x4ecc83,_0x1af7bf){const _0x1afa17=a7_0x1afa();return a7_0x5b82=function(_0x5b8285,_0x4dab3d){_0x5b8285=_0x5b8285-0x76;let _0x3d910d=_0x1afa17[_0x5b8285];return _0x3d910d;},a7_0x5b82(_0x4ecc83,_0x1af7bf);}export function formatDataset(_0x512b0a){const _0x20fa97=a7_0x5b82,_0x4912b9=_0x512b0a[_0x20fa97(0x8a)](_0x369dc=>_0x369dc[_0x20fa97(0x79)]),_0x1346c4=_0x512b0a[_0x20fa97(0x8a)](_0x2104be=>!_0x2104be[_0x20fa97(0x79)]),_0x2af2fb=new Map();_0x4912b9[_0x20fa97(0x85)](_0x46389d=>{const _0x85aeb7=_0x20fa97,_0x2fce1c=_0x46389d['dbtableConfig'][_0x85aeb7(0x82)],_0x4d7d8f=_0x2af2fb['get'](_0x2fce1c);(!_0x4d7d8f||_0x46389d['id']>_0x4d7d8f['id'])&&_0x2af2fb[_0x85aeb7(0x7c)](_0x2fce1c,_0x46389d);});const _0x49f06d=Array['from'](_0x2af2fb['values']())[_0x20fa97(0x8d)](_0x224a67=>{const _0x531727=_0x20fa97,_0x5bb32a=snakeToCamel(_0x224a67[_0x531727(0x79)][_0x531727(0x82)]);return{'id':_0x224a67['id'],'name':_0x224a67[_0x531727(0x84)],'code':_0x224a67[_0x531727(0x7f)],'tableName':_0x224a67[_0x531727(0x79)]['tableName'],'apiFucName':_0x5bb32a?_0x5bb32a+_0x531727(0x8e):_0x531727(0x86)+_0x224a67[_0x531727(0x7f)]+_0x531727(0x8e),'modelName':_0x5bb32a||_0x531727(0x86)+_0x224a67[_0x531727(0x7f)],'pkField':_0x224a67[_0x531727(0x79)][_0x531727(0x8b)],'allFields':_0x224a67[_0x531727(0x79)][_0x531727(0x7a)]?_0x224a67[_0x531727(0x79)][_0x531727(0x7a)][_0x531727(0x77)](','):[]};}),_0x50239e=_0x1346c4[_0x20fa97(0x8d)](_0x2f18d1=>{const _0x3340b0=_0x20fa97,_0x2db2cb=_0x2f18d1[_0x3340b0(0x7f)]['slice'](-0x6),_0x2a0789='dataset_'+_0x2db2cb,_0x4b93d8=snakeToCamel(_0x2a0789);return{'id':_0x2f18d1['id'],'name':_0x2f18d1['name'],'code':_0x2f18d1['code'],'tableName':_0x2a0789,'apiFucName':_0x4b93d8?_0x4b93d8+_0x3340b0(0x8e):_0x3340b0(0x86)+_0x2db2cb+_0x3340b0(0x8e),'modelName':_0x4b93d8||'dataset'+_0x2db2cb,'pkField':undefined,'allFields':[]};});return[..._0x49f06d,..._0x50239e];}function snakeToCamel(_0x271e33){const _0x44ffd4=a7_0x5b82;if(!_0x271e33)return _0x271e33;const _0x3f46b4=_0x271e33[_0x44ffd4(0x81)]();return _0x3f46b4[_0x44ffd4(0x7b)](/_([a-zA-Z0-9])/g,(_0x96635b,_0x209008)=>_0x209008['toUpperCase']());}
@@ -1 +1 @@
1
- const a8_0x515f57=a8_0x3879;(function(_0x2236a1,_0x9129a5){const _0x4aa662=a8_0x3879,_0x5f32bc=_0x2236a1();while(!![]){try{const _0x4a7262=-parseInt(_0x4aa662(0x196))/0x1*(parseInt(_0x4aa662(0x1a4))/0x2)+parseInt(_0x4aa662(0x19a))/0x3*(-parseInt(_0x4aa662(0x1ad))/0x4)+parseInt(_0x4aa662(0x1a5))/0x5+-parseInt(_0x4aa662(0x19d))/0x6*(parseInt(_0x4aa662(0x1c0))/0x7)+-parseInt(_0x4aa662(0x195))/0x8*(parseInt(_0x4aa662(0x1be))/0x9)+-parseInt(_0x4aa662(0x1b8))/0xa+-parseInt(_0x4aa662(0x1a2))/0xb*(-parseInt(_0x4aa662(0x1b6))/0xc);if(_0x4a7262===_0x9129a5)break;else _0x5f32bc['push'](_0x5f32bc['shift']());}catch(_0x520966){_0x5f32bc['push'](_0x5f32bc['shift']());}}}(a8_0x4595,0x2450f));function a8_0x4595(){const _0x25677a=['string','\x22\x20}','init-api','charAt','typescript','12SJJJap','code','1728560ovSunU','url','online','tableName','toUpperCase','-api','689922oymSop','./src/api/','85582INbINk','name','16AKNSgD','136063ukljSw','apiFucName','length','api.ts.tpl','3ULKSjk','templates/generate-api','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','30RIlnbo','utf8','forEach','success','endsWith','8878661YWynnm','../..','4XjJrua','1324240WCFoJT','keys','replaceApiContent','format','{\x20apiConfigName:\x20','dirname','slice','join','1055280fecSdA','.ts','env',',\x20env:\x20\x22'];a8_0x4595=function(){return _0x25677a;};return a8_0x4595();}import a8_0x260d0f from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a8_0x52c6d3 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{formatDataset}from'./format-dataset.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';function a8_0x3879(_0x28542e,_0x2a82cf){const _0x459559=a8_0x4595();return a8_0x3879=function(_0x387955,_0x419518){_0x387955=_0x387955-0x195;let _0x5f3f6d=_0x459559[_0x387955];return _0x5f3f6d;},a8_0x3879(_0x28542e,_0x2a82cf);}export async function generateApiFile(_0x466fc1,_0x4a49f4='',_0x3bddee,_0x32fe57=![],_0xbaf196,_0x5adc4a=a8_0x515f57(0x1bf)){const _0x2e7925=a8_0x515f57,_0x1abd37=readConfig(),_0x4baa3f=_0x3bddee||_0x1abd37?.['app'];if(typeof _0x4baa3f!==_0x2e7925(0x1b1)||!_0x4baa3f)throw new Error(_0x2e7925(0x19c));const _0x4b8862=_0x32fe57?'CONFIG_NAMES.DEFAULT':'\x22'+_0x4baa3f+'\x22',_0x2c1781=typeof _0x1abd37[_0x2e7925(0x1af)]===_0x2e7925(0x1b1)?_0x1abd37[_0x2e7925(0x1af)]:undefined,_0x16a7de=_0xbaf196||_0x2c1781||'online',_0x14a754=_0x16a7de!==_0x2e7925(0x1ba);let _0x39eb29;if(_0x32fe57)_0x14a754?_0x39eb29=_0x2e7925(0x1a9)+_0x4b8862+_0x2e7925(0x1b0)+_0x16a7de+_0x2e7925(0x1b2):_0x39eb29='';else{const _0x3b60cd=_0x14a754?_0x2e7925(0x1b0)+_0x16a7de+'\x22':'';_0x39eb29='{\x20apiConfigName:\x20\x22'+_0x4baa3f+'\x22'+_0x3b60cd+'\x20}';}const _0x14d821=_0x4a49f4?_0x4a49f4+_0x2e7925(0x1bd):'api',_0x93495b=_0x4a49f4?_0x4a49f4+'-client':'client',_0x13d37f=formatDataset(_0x466fc1),_0x50b8d5={};_0x13d37f[_0x2e7925(0x19f)](_0x3aa9f6=>{const _0x551fcc=_0x2e7925,_0x46ade2=_0x3aa9f6[_0x551fcc(0x197)]['replace'](/Api$/,''),_0x2d3bee=_0x46ade2[_0x551fcc(0x1b4)](0x0)[_0x551fcc(0x1bc)]()+_0x46ade2[_0x551fcc(0x1ab)](0x1);_0x50b8d5[_0x2d3bee]={'tableName':_0x3aa9f6[_0x551fcc(0x1bb)],'datasetCode':_0x3aa9f6[_0x551fcc(0x1b7)],'name':_0x3aa9f6[_0x551fcc(0x1c1)]||''};});const _0x2bd806=fileURLToPath(import.meta[_0x2e7925(0x1b9)]),_0x5d3edb=a8_0x52c6d3['resolve'](a8_0x52c6d3[_0x2e7925(0x1aa)](_0x2bd806),_0x2e7925(0x1a3)),_0x5affc4=a8_0x52c6d3['join'](_0x5d3edb,_0x2e7925(0x19b)),_0x446503=a8_0x52c6d3[_0x2e7925(0x1ac)](_0x5affc4,_0x2e7925(0x199)),_0xcd9d45=a8_0x52c6d3[_0x2e7925(0x1ac)](_0x5affc4,'client.ts.tpl'),_0x2cde98=_0x5adc4a[_0x2e7925(0x1a1)]('/')?_0x5adc4a[_0x2e7925(0x1ab)](0x0,-0x1):_0x5adc4a;mkdirSync(_0x2cde98,{'recursive':!![]});const _0x25f7a5=readFileSync(_0x446503,'utf8'),_0x373567=TemplateReplacer['replaceApiContent'](_0x25f7a5,_0x4baa3f,_0x50b8d5,Object[_0x2e7925(0x1a6)](_0x50b8d5)[0x0],_0x14d821,_0x4b8862),_0x34c859=await a8_0x260d0f[_0x2e7925(0x1a8)](_0x373567,{'parser':_0x2e7925(0x1b5)}),_0x1e5be3=_0x2cde98+'/'+_0x14d821+_0x2e7925(0x1ae);writeFileSync(_0x1e5be3,_0x34c859,{'encoding':'utf8'});const _0x34d673=readFileSync(_0xcd9d45,_0x2e7925(0x19e)),_0x21e960=TemplateReplacer[_0x2e7925(0x1a7)](_0x34d673,_0x4baa3f,_0x50b8d5,Object['keys'](_0x50b8d5)[0x0],_0x14d821,_0x4b8862,_0x39eb29),_0x4931ff=await a8_0x260d0f[_0x2e7925(0x1a8)](_0x21e960,{'parser':_0x2e7925(0x1b5)}),_0x1c8979=_0x2cde98+'/'+_0x93495b+_0x2e7925(0x1ae);writeFileSync(_0x1c8979,_0x4931ff,{'encoding':_0x2e7925(0x19e)});const _0x4a2633=Object['keys'](_0x50b8d5)[_0x2e7925(0x198)];return logger[_0x2e7925(0x1a0)](_0x2e7925(0x1b3),'API\x20文件生成成功!',undefined,{'apiFile':_0x1e5be3,'clientFile':_0x1c8979,'modelCount':_0x4a2633,'configName':_0x4b8862}),{'modelCount':_0x4a2633,'apiFilePath':_0x1e5be3,'clientFilePath':_0x1c8979,'configName':_0x4b8862};}
1
+ const a8_0xfc8274=a8_0xea92;function a8_0x1040(){const _0x1e37e1=['endsWith','551625AOAQxj','utf8','186696zNdisY','string','length','tableName','3QtTski','app','-client','env','181386mSsmZZ','{\x20apiConfigName:\x20\x22','676406IgrbmZ','6rEeMyO',',\x20env:\x20\x22','templates/generate-api','code','-api','5510953dAOQja','{\x20apiConfigName:\x20','typescript','online','11WvWItx','modelName','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','slice','API\x20文件生成成功!','join','dirname','70RzVfID','init-api','url','forEach','keys','130XNkrjS','10856532jXssjl','CONFIG_NAMES.DEFAULT','.ts','./src/api/','api','replaceApiContent','4499152eGtufr'];a8_0x1040=function(){return _0x1e37e1;};return a8_0x1040();}function a8_0xea92(_0x58fcb9,_0x4a1bcf){const _0x104041=a8_0x1040();return a8_0xea92=function(_0xea92f4,_0x3673ff){_0xea92f4=_0xea92f4-0x82;let _0x11bf99=_0x104041[_0xea92f4];return _0x11bf99;},a8_0xea92(_0x58fcb9,_0x4a1bcf);}(function(_0x3a91d9,_0x3107ae){const _0x1b6d6a=a8_0xea92,_0x3995cc=_0x3a91d9();while(!![]){try{const _0x1e92f7=parseInt(_0x1b6d6a(0xa8))/0x1+parseInt(_0x1b6d6a(0x89))/0x2*(-parseInt(_0x1b6d6a(0x83))/0x3)+-parseInt(_0x1b6d6a(0xaa))/0x4*(parseInt(_0x1b6d6a(0x9a))/0x5)+parseInt(_0x1b6d6a(0x8a))/0x6*(parseInt(_0x1b6d6a(0x8f))/0x7)+-parseInt(_0x1b6d6a(0xa6))/0x8+-parseInt(_0x1b6d6a(0x87))/0x9*(parseInt(_0x1b6d6a(0x9f))/0xa)+parseInt(_0x1b6d6a(0x93))/0xb*(parseInt(_0x1b6d6a(0xa0))/0xc);if(_0x1e92f7===_0x3107ae)break;else _0x3995cc['push'](_0x3995cc['shift']());}catch(_0x4bfaa0){_0x3995cc['push'](_0x3995cc['shift']());}}}(a8_0x1040,0x6863c));import a8_0x2e34de from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a8_0x3cf416 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{formatDataset}from'./format-dataset.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x5b0fd3,_0x228f0c='',_0x4f7e5b,_0x246960=![],_0x188618,_0x2e949a=a8_0xfc8274(0xa3)){const _0x32bc03=a8_0xfc8274,_0x13ddc6=readConfig(),_0x4836e7=_0x4f7e5b||_0x13ddc6?.[_0x32bc03(0x84)];if(typeof _0x4836e7!==_0x32bc03(0xab)||!_0x4836e7)throw new Error(_0x32bc03(0x95));const _0x183ae7=_0x246960?_0x32bc03(0xa1):'\x22'+_0x4836e7+'\x22',_0x4a30f8=typeof _0x13ddc6['env']==='string'?_0x13ddc6[_0x32bc03(0x86)]:undefined,_0x510034=_0x188618||_0x4a30f8||_0x32bc03(0x92),_0xecf25e=_0x510034!==_0x32bc03(0x92);let _0x3853b4;if(_0x246960)_0xecf25e?_0x3853b4=_0x32bc03(0x90)+_0x183ae7+_0x32bc03(0x8b)+_0x510034+'\x22\x20}':_0x3853b4='';else{const _0x4f1cdd=_0xecf25e?_0x32bc03(0x8b)+_0x510034+'\x22':'';_0x3853b4=_0x32bc03(0x88)+_0x4836e7+'\x22'+_0x4f1cdd+'\x20}';}const _0x3729fa=_0x228f0c?_0x228f0c+_0x32bc03(0x8e):_0x32bc03(0xa4),_0x2f0de3=_0x228f0c?_0x228f0c+_0x32bc03(0x85):'client',_0x3d5595=formatDataset(_0x5b0fd3),_0x1ba2f1={};_0x3d5595[_0x32bc03(0x9d)](_0x22bf3f=>{const _0x4451f7=_0x32bc03;_0x1ba2f1[_0x22bf3f[_0x4451f7(0x94)]]={'tableName':_0x22bf3f[_0x4451f7(0x82)],'datasetCode':_0x22bf3f[_0x4451f7(0x8d)],'name':_0x22bf3f['name']||''};});const _0x2ca6db=fileURLToPath(import.meta[_0x32bc03(0x9c)]),_0x162496=a8_0x3cf416['resolve'](a8_0x3cf416[_0x32bc03(0x99)](_0x2ca6db),'../..'),_0x3c6aab=a8_0x3cf416[_0x32bc03(0x98)](_0x162496,_0x32bc03(0x8c)),_0xa6973b=a8_0x3cf416[_0x32bc03(0x98)](_0x3c6aab,'api.ts.tpl'),_0x343294=a8_0x3cf416['join'](_0x3c6aab,'client.ts.tpl'),_0x84c387=_0x2e949a[_0x32bc03(0xa7)]('/')?_0x2e949a[_0x32bc03(0x96)](0x0,-0x1):_0x2e949a;mkdirSync(_0x84c387,{'recursive':!![]});const _0x473e72=readFileSync(_0xa6973b,'utf8'),_0x45c312=TemplateReplacer[_0x32bc03(0xa5)](_0x473e72,_0x4836e7,_0x1ba2f1,Object[_0x32bc03(0x9e)](_0x1ba2f1)[0x0],_0x3729fa,_0x183ae7),_0x331b98=await a8_0x2e34de['format'](_0x45c312,{'parser':_0x32bc03(0x91)}),_0x2d3a16=_0x84c387+'/'+_0x3729fa+_0x32bc03(0xa2);writeFileSync(_0x2d3a16,_0x331b98,{'encoding':_0x32bc03(0xa9)});const _0x5df24f=readFileSync(_0x343294,_0x32bc03(0xa9)),_0x178252=TemplateReplacer[_0x32bc03(0xa5)](_0x5df24f,_0x4836e7,_0x1ba2f1,Object[_0x32bc03(0x9e)](_0x1ba2f1)[0x0],_0x3729fa,_0x183ae7,_0x3853b4),_0x364c57=await a8_0x2e34de['format'](_0x178252,{'parser':_0x32bc03(0x91)}),_0x1acea5=_0x84c387+'/'+_0x2f0de3+'.ts';writeFileSync(_0x1acea5,_0x364c57,{'encoding':'utf8'});const _0x590c13=Object[_0x32bc03(0x9e)](_0x1ba2f1)[_0x32bc03(0xac)];return logger['success'](_0x32bc03(0x9b),_0x32bc03(0x97),undefined,{'apiFile':_0x2d3a16,'clientFile':_0x1acea5,'modelCount':_0x590c13,'configName':_0x183ae7}),{'modelCount':_0x590c13,'apiFilePath':_0x2d3a16,'clientFilePath':_0x1acea5,'configName':_0x183ae7};}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0x30af35,_0x27d078){const _0x4d03c5=a9_0x1df3,_0x164865=_0x30af35();while(!![]){try{const _0x4b188c=parseInt(_0x4d03c5(0x107))/0x1+-parseInt(_0x4d03c5(0x10a))/0x2+-parseInt(_0x4d03c5(0x11b))/0x3+parseInt(_0x4d03c5(0x11a))/0x4*(-parseInt(_0x4d03c5(0x103))/0x5)+parseInt(_0x4d03c5(0x121))/0x6*(-parseInt(_0x4d03c5(0x117))/0x7)+parseInt(_0x4d03c5(0x102))/0x8+-parseInt(_0x4d03c5(0x109))/0x9*(-parseInt(_0x4d03c5(0x115))/0xa);if(_0x4b188c===_0x27d078)break;else _0x164865['push'](_0x164865['shift']());}catch(_0xb092c0){_0x164865['push'](_0x164865['shift']());}}}(a9_0x28e8,0xbaebd));import{jsx as a9_0x1c5ab5}from'react/jsx-runtime';import{render}from'ink';function a9_0x28e8(){const _0x318ab6=['\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','flags','exit','165090lBUVMN','error','154etXFza','请使用\x20--appcode\x20参数,例如:','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','2044024OqBLNc','3301200JrdxKf','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','string','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','input','114876oUCAPh','help','❌\x20错误:不再支持位置参数方式','log','\x1b[90m*\x20使用配置的应用AppCode:\x20','\x1b[0m','6301336HtvgxJ','5ovFtuo','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','env','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a','406362mZsZQZ','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','1206UGxwhj','1215976kndAWm','appcode','\x20\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档','output','!\x20请使用以下方式之一:','×\x20未配置\x20AppCode','doc'];a9_0x28e8=function(){return _0x318ab6;};return a9_0x28e8();}import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';function a9_0x1df3(_0x475950,_0x38ecb7){const _0x28e854=a9_0x28e8();return a9_0x1df3=function(_0x1df360,_0x126a63){_0x1df360=_0x1df360-0x101;let _0x43d308=_0x28e854[_0x1df360];return _0x43d308;},a9_0x1df3(_0x475950,_0x38ecb7);}export async function apiCli(_0x46a812){const _0x31f45d=a9_0x1df3,_0x533436=_0x46a812[_0x31f45d(0x120)][0x1];if(_0x46a812[_0x31f45d(0x113)][_0x31f45d(0x122)]){console['log'](_0x31f45d(0x106));return;}if(_0x533436==='pull'){_0x46a812[_0x31f45d(0x120)][0x2]&&(console[_0x31f45d(0x116)](_0x31f45d(0x123)),console['log'](_0x31f45d(0x118)),console[_0x31f45d(0x124)](_0x31f45d(0x119)+_0x46a812[_0x31f45d(0x120)][0x2]),process[_0x31f45d(0x114)](0x1));const _0x4d6f93=getConfigAppCode();let _0x2b445d=_0x46a812[_0x31f45d(0x113)][_0x31f45d(0x10b)];const _0x18cc6d=typeof _0x46a812[_0x31f45d(0x113)]['env']===_0x31f45d(0x11e)?_0x46a812['flags']['env']:undefined,_0x23d383=_0x46a812['flags'][_0x31f45d(0x10d)];!_0x2b445d&&!_0x4d6f93&&(console[_0x31f45d(0x116)](_0x31f45d(0x10f)),console[_0x31f45d(0x124)](_0x31f45d(0x10e)),console[_0x31f45d(0x124)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console['log'](_0x31f45d(0x108)),process[_0x31f45d(0x114)](0x1)),_0x2b445d&&_0x4d6f93&&_0x2b445d===_0x4d6f93&&(console[_0x31f45d(0x124)](_0x31f45d(0x125)+_0x2b445d+_0x31f45d(0x101)),console['log'](_0x31f45d(0x11d)),_0x2b445d=undefined),render(a9_0x1c5ab5(ApiPullUI,{'appCode':_0x2b445d,'env':_0x18cc6d,'output':_0x23d383}));}else{if(_0x533436===_0x31f45d(0x110)){_0x46a812[_0x31f45d(0x120)][0x2]&&(console[_0x31f45d(0x116)](_0x31f45d(0x123)),console[_0x31f45d(0x124)](_0x31f45d(0x118)),console[_0x31f45d(0x124)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20'+_0x46a812[_0x31f45d(0x120)][0x2]),process[_0x31f45d(0x114)](0x1));const _0x24dd74=getConfigAppCode();let _0x471ec1=_0x46a812[_0x31f45d(0x113)][_0x31f45d(0x10b)];const _0x18c1fb=typeof _0x46a812[_0x31f45d(0x113)]['env']===_0x31f45d(0x11e)?_0x46a812[_0x31f45d(0x113)][_0x31f45d(0x105)]:undefined,_0x3d6aaf=_0x46a812[_0x31f45d(0x113)]['output'];!_0x471ec1&&!_0x24dd74&&(console[_0x31f45d(0x116)](_0x31f45d(0x10f)),console[_0x31f45d(0x124)](_0x31f45d(0x10e)),console[_0x31f45d(0x124)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x31f45d(0x124)]('\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>'),process['exit'](0x1)),_0x471ec1&&_0x24dd74&&_0x471ec1===_0x24dd74&&(console[_0x31f45d(0x124)](_0x31f45d(0x125)+_0x471ec1+_0x31f45d(0x101)),_0x471ec1=undefined),render(a9_0x1c5ab5(ApiDocUI,{'appCode':_0x471ec1,'env':_0x18c1fb,'output':_0x3d6aaf}));}else console[_0x31f45d(0x116)]('Unknown\x20api\x20command:\x20'+_0x533436),console[_0x31f45d(0x124)]('Available\x20commands:'),console['log']('\x20\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件'),console[_0x31f45d(0x124)](_0x31f45d(0x111)),console[_0x31f45d(0x124)](_0x31f45d(0x11c)),console[_0x31f45d(0x124)](_0x31f45d(0x112)),console['log'](''),console['log'](_0x31f45d(0x10c)),console[_0x31f45d(0x124)](_0x31f45d(0x11f)),console[_0x31f45d(0x124)](_0x31f45d(0x104)),console[_0x31f45d(0x124)]('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process[_0x31f45d(0x114)](0x1);}}
1
+ function a9_0xd432(_0x4c09c8,_0x3b55da){const _0x14796a=a9_0x1479();return a9_0xd432=function(_0xd43221,_0xcc7b0d){_0xd43221=_0xd43221-0xaf;let _0x5a704d=_0x14796a[_0xd43221];return _0x5a704d;},a9_0xd432(_0x4c09c8,_0x3b55da);}(function(_0x26f6a8,_0x19cd37){const _0x4e2731=a9_0xd432,_0x30820f=_0x26f6a8();while(!![]){try{const _0xf80d3f=parseInt(_0x4e2731(0xd8))/0x1+-parseInt(_0x4e2731(0xe1))/0x2*(-parseInt(_0x4e2731(0xc6))/0x3)+parseInt(_0x4e2731(0xbd))/0x4*(parseInt(_0x4e2731(0xd6))/0x5)+-parseInt(_0x4e2731(0xb3))/0x6*(-parseInt(_0x4e2731(0xb7))/0x7)+parseInt(_0x4e2731(0xcd))/0x8+parseInt(_0x4e2731(0xd2))/0x9*(-parseInt(_0x4e2731(0xc7))/0xa)+-parseInt(_0x4e2731(0xc3))/0xb;if(_0xf80d3f===_0x19cd37)break;else _0x30820f['push'](_0x30820f['shift']());}catch(_0x35fda6){_0x30820f['push'](_0x30820f['shift']());}}}(a9_0x1479,0xcf646));import{jsx as a9_0x3e22cb}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x26ce8f){const _0x5c4148=a9_0xd432,_0x461c5f=_0x26ce8f[_0x5c4148(0xc4)][0x1];if(_0x26ce8f['flags']['help']){console[_0x5c4148(0xb6)](_0x5c4148(0xd7));return;}if(_0x461c5f===_0x5c4148(0xb1)){_0x26ce8f[_0x5c4148(0xc4)][0x2]&&(console[_0x5c4148(0xe0)](_0x5c4148(0xdf)),console['log'](_0x5c4148(0xc2)),console[_0x5c4148(0xb6)](_0x5c4148(0xb0)+_0x26ce8f[_0x5c4148(0xc4)][0x2]),process[_0x5c4148(0xba)](0x1));const _0x1f03b8=getConfigAppCode();let _0x2f191b=_0x26ce8f[_0x5c4148(0xd3)]['appcode'];const _0x4bb4ab=typeof _0x26ce8f[_0x5c4148(0xd3)][_0x5c4148(0xda)]===_0x5c4148(0xce)?_0x26ce8f[_0x5c4148(0xd3)]['env']:undefined,_0x5c0769=_0x26ce8f[_0x5c4148(0xd3)]['output'];!_0x2f191b&&!_0x1f03b8&&(console[_0x5c4148(0xe0)]('×\x20未配置\x20AppCode'),console[_0x5c4148(0xb6)](_0x5c4148(0xc5)),console[_0x5c4148(0xb6)](_0x5c4148(0xcf)),console[_0x5c4148(0xb6)]('\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>'),process['exit'](0x1)),_0x2f191b&&_0x1f03b8&&_0x2f191b===_0x1f03b8&&(console[_0x5c4148(0xb6)](_0x5c4148(0xde)+_0x2f191b+_0x5c4148(0xb9)),console[_0x5c4148(0xb6)](_0x5c4148(0xbf)),_0x2f191b=undefined),render(a9_0x3e22cb(ApiPullUI,{'appCode':_0x2f191b,'env':_0x4bb4ab,'output':_0x5c0769}));}else{if(_0x461c5f==='doc'){_0x26ce8f[_0x5c4148(0xc4)][0x2]&&(console[_0x5c4148(0xe0)](_0x5c4148(0xdf)),console[_0x5c4148(0xb6)]('请使用\x20--appcode\x20参数,例如:'),console['log'](_0x5c4148(0xdc)+_0x26ce8f[_0x5c4148(0xc4)][0x2]),process[_0x5c4148(0xba)](0x1));const _0x353ca3=getConfigAppCode();let _0x272b42=_0x26ce8f[_0x5c4148(0xd3)][_0x5c4148(0xd1)];const _0x273984=typeof _0x26ce8f[_0x5c4148(0xd3)][_0x5c4148(0xda)]===_0x5c4148(0xce)?_0x26ce8f[_0x5c4148(0xd3)][_0x5c4148(0xda)]:undefined,_0x455aa9=_0x26ce8f[_0x5c4148(0xd3)]['output'],_0x409e11=_0x26ce8f[_0x5c4148(0xd3)][_0x5c4148(0xd0)],_0x103c9b=_0x26ce8f[_0x5c4148(0xd3)]['datasetcode'];!_0x272b42&&!_0x353ca3&&(console[_0x5c4148(0xe0)]('×\x20未配置\x20AppCode'),console[_0x5c4148(0xb6)](_0x5c4148(0xc5)),console[_0x5c4148(0xb6)](_0x5c4148(0xcf)),console[_0x5c4148(0xb6)](_0x5c4148(0xd5)),process[_0x5c4148(0xba)](0x1));_0x272b42&&_0x353ca3&&_0x272b42===_0x353ca3&&(console[_0x5c4148(0xb6)](_0x5c4148(0xde)+_0x272b42+_0x5c4148(0xb9)),_0x272b42=undefined);let _0x14c9a9;if(_0x409e11)try{_0x14c9a9=JSON[_0x5c4148(0xbc)](_0x409e11),(typeof _0x14c9a9!==_0x5c4148(0xaf)||_0x14c9a9===null||Array[_0x5c4148(0xb4)](_0x14c9a9))&&(console[_0x5c4148(0xe0)](_0x5c4148(0xb2)),process['exit'](0x1));}catch(_0x2624cc){console[_0x5c4148(0xe0)]('×\x20--params\x20参数不是有效的\x20JSON\x20格式'),console[_0x5c4148(0xe0)](_0x5c4148(0xc1)+(_0x2624cc instanceof Error?_0x2624cc[_0x5c4148(0xbe)]:String(_0x2624cc))),process['exit'](0x1);}let _0x38ce1b;_0x103c9b&&(_0x38ce1b=_0x103c9b['split'](',')[_0x5c4148(0xbb)](_0x2611f2=>_0x2611f2['trim']())[_0x5c4148(0xc9)](_0x7a94dd=>_0x7a94dd[_0x5c4148(0xb5)]>0x0),_0x38ce1b[_0x5c4148(0xb5)]===0x0&&(console['error'](_0x5c4148(0xdd)),process['exit'](0x1)),console[_0x5c4148(0xb6)](_0x5c4148(0xc8)+_0x38ce1b[_0x5c4148(0xcb)](',\x20')+'\x1b[0m')),render(a9_0x3e22cb(ApiDocUI,{'appCode':_0x272b42,'env':_0x273984,'output':_0x455aa9,'extraParams':_0x14c9a9,'datasetCodes':_0x38ce1b}));}else console[_0x5c4148(0xe0)]('Unknown\x20api\x20command:\x20'+_0x461c5f),console[_0x5c4148(0xb6)](_0x5c4148(0xd4)),console[_0x5c4148(0xb6)](_0x5c4148(0xd9)),console[_0x5c4148(0xb6)](_0x5c4148(0xdb)),console[_0x5c4148(0xb6)](_0x5c4148(0xc0)),console[_0x5c4148(0xb6)](_0x5c4148(0xe2)),console[_0x5c4148(0xb6)](''),console[_0x5c4148(0xb6)](_0x5c4148(0xca)),console[_0x5c4148(0xb6)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode'),console[_0x5c4148(0xb6)](_0x5c4148(0xcc)),console[_0x5c4148(0xb6)](_0x5c4148(0xb8)),process[_0x5c4148(0xba)](0x1);}}function a9_0x1479(){const _0x5a6988=['env','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','×\x20--datasetcode\x20参数不能为空','\x1b[90m*\x20使用配置的应用AppCode:\x20','❌\x20错误:不再支持位置参数方式','error','2HGTVQz','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','object','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','pull','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','12woHIWg','isArray','length','log','2275301blLZDR','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','\x1b[0m','exit','map','parse','6652PBDpLK','message','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','\x20\x20错误:\x20','请使用\x20--appcode\x20参数,例如:','34490808dTLhNA','input','!\x20请使用以下方式之一:','1640805cxTAUV','10573670PYlOuS','\x1b[90m*\x20仅生成指定数据集的文档:\x20','filter','\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文档','join','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','13323560cvpDSt','string','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','params','appcode','9uXraxO','flags','Available\x20commands:','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','4315QowAEA','\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','744738MKIIwk','\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配置文件'];a9_0x1479=function(){return _0x5a6988;};return a9_0x1479();}