@lovrabet/cli 1.1.10 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +109 -1
  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 +5 -4
  50. package/templates/projects/sub-app-react-demo/package.json +1 -1
  51. package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +42 -28
package/README.md CHANGED
@@ -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,7 +330,73 @@ lovrabet logs --clear
296
330
 
297
331
  ## 📝 What's New
298
332
 
299
- ### v1.1.10 (2025-10-16)
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
+
399
+ ### v1.1.11 (2025-10-16)
300
400
 
301
401
  **新增功能 (New Features):**
302
402
 
@@ -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(_0x47a98a,_0x2d7e54){const _0x3bee83=a0_0x5999,_0x141a4f=_0x47a98a();while(!![]){try{const _0x4b30ba=parseInt(_0x3bee83(0xa7))/0x1*(parseInt(_0x3bee83(0xa6))/0x2)+parseInt(_0x3bee83(0x98))/0x3+-parseInt(_0x3bee83(0x9e))/0x4*(parseInt(_0x3bee83(0xa4))/0x5)+-parseInt(_0x3bee83(0xa5))/0x6*(-parseInt(_0x3bee83(0xa8))/0x7)+parseInt(_0x3bee83(0x94))/0x8+parseInt(_0x3bee83(0x93))/0x9+-parseInt(_0x3bee83(0xae))/0xa;if(_0x4b30ba===_0x2d7e54)break;else _0x141a4f['push'](_0x141a4f['shift']());}catch(_0x1ee0cc){_0x141a4f['push'](_0x141a4f['shift']());}}}(a0_0x2570,0x97404));function a0_0x5999(_0x59a143,_0x585bf7){const _0x25708c=a0_0x2570();return a0_0x5999=function(_0x599988,_0x31aa85){_0x599988=_0x599988-0x90;let _0x103014=_0x25708c[_0x599988];return _0x103014;},a0_0x5999(_0x59a143,_0x585bf7);}import{jsx as a0_0x4c80bd,jsxs as a0_0xe4e329}from'react/jsx-runtime';import{useState}from'react';function a0_0x2570(){const _0x296bb9=['slice','8854281iiBPSQ','8581536QgsjuI','delete','路径不能以\x20/\x20开头或结尾','trim','3056178cXgBHs','backspace','includes','endsWith','页面路径长度不能超过\x20100\x20个字符','gray','812ZYvKfk','页面路径不合法','red','startsWith','green','\x20已存在,请使用其他路径','9205LSFLgy','46488nFYUtn','749032FHfwZc','2OqJKIq','651mMnqZK','页面路由地址:\x20','\x20直接回车确认,或输入自定义路由地址','\x20←\x20','existsSync','路径不能包含连续的\x20/','35515760IiGqjz','my-page','length'];a0_0x2570=function(){return _0x296bb9;};return a0_0x2570();}import{Text,Box,useInput}from'ink';import a0_0x374580 from'node:fs';export function InputProjectCode(_0x2abf64){const _0x3a0d56=a0_0x5999,{onSubmit:_0xab5d88,pagePath:_0x425f83}=_0x2abf64,[_0x3f8ca2,_0x7f9875]=useState(''),[_0x1517e8,_0x355b3a]=useState(''),_0x531d9d=_0x3a0d56(0x90);function _0x1a5eac(_0x17a7d9){const _0x5c0b58=_0x3a0d56;if(_0x17a7d9[_0x5c0b58(0x91)]>0x64)return{'valid':![],'message':_0x5c0b58(0x9c)};if(_0x17a7d9[_0x5c0b58(0xa1)]('/')||_0x17a7d9[_0x5c0b58(0x9b)]('/'))return{'valid':![],'message':_0x5c0b58(0x96)};if(_0x17a7d9[_0x5c0b58(0x9a)]('//'))return{'valid':![],'message':_0x5c0b58(0xad)};const _0x2df8d3=_0x17a7d9['split']('/');for(const _0x559979 of _0x2df8d3){if(!_0x559979)continue;const _0x4b87c9=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x4b87c9['test'](_0x559979))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x18e13a,_0x1e1db7)=>{const _0x3d98d4=_0x3a0d56;if(_0x1e1db7['return']){const _0x310ebc=_0x3f8ca2[_0x3d98d4(0x97)]()||_0x531d9d;if(_0x1517e8)return;const _0x35e60b=_0x425f83+'/'+_0x310ebc;if(a0_0x374580[_0x3d98d4(0xac)](_0x35e60b)){_0x355b3a('页面路径\x20'+_0x310ebc+_0x3d98d4(0xa3));return;}_0xab5d88(_0x310ebc),_0x7f9875(''),_0x355b3a('');}else _0x1e1db7[_0x3d98d4(0x99)]||_0x1e1db7[_0x3d98d4(0x95)]?_0x7f9875(_0x2b1510=>{const _0x2c541a=_0x3d98d4,_0x3e3d9c=_0x2b1510[_0x2c541a(0x92)](0x0,-0x1),{valid:_0xc0c9f5,message:_0x26c554}=_0x1a5eac(_0x3e3d9c);return _0x355b3a(_0xc0c9f5?'':_0x26c554||_0x2c541a(0x9f)),_0x3e3d9c;}):_0x7f9875(_0x4ac59e=>{const _0x45578a=_0x3d98d4,_0x4afef9=_0x4ac59e+_0x18e13a,{valid:_0x5e6312,message:_0x23d21a}=_0x1a5eac(_0x4afef9);return _0x355b3a(_0x5e6312?'':_0x23d21a||_0x45578a(0x9f)),_0x4afef9;});}),a0_0xe4e329(Box,{'flexDirection':'column','children':[a0_0xe4e329(Box,{'children':[a0_0x4c80bd(Text,{'color':_0x3a0d56(0x9d),'children':'\x20Step2:\x20'}),a0_0x4c80bd(Text,{'children':_0x3a0d56(0xa9)}),_0x3f8ca2?a0_0x4c80bd(Text,{'color':_0x3a0d56(0xa2),'children':_0x3f8ca2}):a0_0x4c80bd(Text,{'color':_0x3a0d56(0x9d),'children':_0x531d9d}),_0x1517e8&&a0_0xe4e329(Text,{'color':_0x3a0d56(0xa0),'children':[_0x3a0d56(0xab),_0x1517e8]})]}),!_0x1517e8&&!_0x3f8ca2&&a0_0x4c80bd(Box,{'children':a0_0x4c80bd(Text,{'color':'gray','children':_0x3a0d56(0xaa)})})]});}
1
+ (function(_0x19e63a,_0x23b7cf){const _0x454efa=a0_0x58a8,_0x47fb7f=_0x19e63a();while(!![]){try{const _0x1f8ccd=-parseInt(_0x454efa(0x167))/0x1+parseInt(_0x454efa(0x16b))/0x2*(parseInt(_0x454efa(0x16f))/0x3)+-parseInt(_0x454efa(0x163))/0x4+parseInt(_0x454efa(0x174))/0x5*(parseInt(_0x454efa(0x178))/0x6)+-parseInt(_0x454efa(0x17f))/0x7+-parseInt(_0x454efa(0x164))/0x8*(parseInt(_0x454efa(0x176))/0x9)+parseInt(_0x454efa(0x171))/0xa*(parseInt(_0x454efa(0x161))/0xb);if(_0x1f8ccd===_0x23b7cf)break;else _0x47fb7f['push'](_0x47fb7f['shift']());}catch(_0x345cc1){_0x47fb7f['push'](_0x47fb7f['shift']());}}}(a0_0x1248,0xdf3b4));import{jsx as a0_0x50566a,jsxs as a0_0x1ea0ab}from'react/jsx-runtime';function a0_0x58a8(_0x4c99d1,_0x3c5d73){const _0x124897=a0_0x1248();return a0_0x58a8=function(_0x58a81e,_0x4e744d){_0x58a81e=_0x58a81e-0x15e;let _0x1e4a39=_0x124897[_0x58a81e];return _0x1e4a39;},a0_0x58a8(_0x4c99d1,_0x3c5d73);}import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x2c74ab from'node:fs';function a0_0x1248(){const _0x142492=['gray','2193124uCyubW','8sufhNF','页面路由地址:\x20','路径不能包含连续的\x20/','486124jugTYW','slice','existsSync','startsWith','38pSMwVb','\x20Step2:\x20','red','return','244575LcgGaO','split','32899810ODDYtV','页面路径长度不能超过\x20100\x20个字符','trim','255JSrdBu','页面路径\x20','12797046eFsbAR','\x20直接回车确认,或输入自定义路由地址','14286HRZiKN','\x20←\x20','delete','length','endsWith','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','test','11128124HpRDnG','my-page','\x20已存在,请使用其他路径','路径不能以\x20/\x20开头或结尾','页面路径不合法','11ajKSHc'];a0_0x1248=function(){return _0x142492;};return a0_0x1248();}export function InputProjectCode(_0x59e1f5){const _0x25ea26=a0_0x58a8,{onSubmit:_0x54d3fa,pagePath:_0x5a7114}=_0x59e1f5,[_0x229ce8,_0x443e17]=useState(''),[_0x3cc50a,_0x502ba5]=useState(''),_0x47385a=_0x25ea26(0x180);function _0x3f2f13(_0x1129f5){const _0xc72aa4=_0x25ea26;if(_0x1129f5[_0xc72aa4(0x17b)]>0x64)return{'valid':![],'message':_0xc72aa4(0x172)};if(_0x1129f5[_0xc72aa4(0x16a)]('/')||_0x1129f5[_0xc72aa4(0x17c)]('/'))return{'valid':![],'message':_0xc72aa4(0x15f)};if(_0x1129f5['includes']('//'))return{'valid':![],'message':_0xc72aa4(0x166)};const _0x225573=_0x1129f5[_0xc72aa4(0x170)]('/');for(const _0x1480eb of _0x225573){if(!_0x1480eb)continue;const _0x57b597=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x57b597[_0xc72aa4(0x17e)](_0x1480eb))return{'valid':![],'message':_0xc72aa4(0x17d)};}return{'valid':!![]};}return useInput((_0x1a2517,_0x4f65b7)=>{const _0x90e582=_0x25ea26;if(_0x4f65b7[_0x90e582(0x16e)]){const _0x1195e2=_0x229ce8[_0x90e582(0x173)]()||_0x47385a;if(_0x3cc50a)return;const _0x4bb5b5=_0x5a7114+'/'+_0x1195e2;if(a0_0x2c74ab[_0x90e582(0x169)](_0x4bb5b5)){_0x502ba5(_0x90e582(0x175)+_0x1195e2+_0x90e582(0x15e));return;}_0x54d3fa(_0x1195e2),_0x443e17(''),_0x502ba5('');}else _0x4f65b7['backspace']||_0x4f65b7[_0x90e582(0x17a)]?_0x443e17(_0x36875b=>{const _0x1ab512=_0x90e582,_0x53208f=_0x36875b[_0x1ab512(0x168)](0x0,-0x1),{valid:_0x28cf2d,message:_0x2d8a54}=_0x3f2f13(_0x53208f);return _0x502ba5(_0x28cf2d?'':_0x2d8a54||_0x1ab512(0x160)),_0x53208f;}):_0x443e17(_0x5a3d6e=>{const _0x2855d9=_0x90e582,_0x47c834=_0x5a3d6e+_0x1a2517,{valid:_0x601bc4,message:_0x5d4ae2}=_0x3f2f13(_0x47c834);return _0x502ba5(_0x601bc4?'':_0x5d4ae2||_0x2855d9(0x160)),_0x47c834;});}),a0_0x1ea0ab(Box,{'flexDirection':'column','children':[a0_0x1ea0ab(Box,{'children':[a0_0x50566a(Text,{'color':_0x25ea26(0x162),'children':_0x25ea26(0x16c)}),a0_0x50566a(Text,{'children':_0x25ea26(0x165)}),_0x229ce8?a0_0x50566a(Text,{'color':'green','children':_0x229ce8}):a0_0x50566a(Text,{'color':_0x25ea26(0x162),'children':_0x47385a}),_0x3cc50a&&a0_0x1ea0ab(Text,{'color':_0x25ea26(0x16d),'children':[_0x25ea26(0x179),_0x3cc50a]})]}),!_0x3cc50a&&!_0x229ce8&&a0_0x50566a(Box,{'children':a0_0x50566a(Text,{'color':'gray','children':_0x25ea26(0x177)})})]});}
@@ -1 +1 @@
1
- const a1_0x14a584=a1_0x93ab;(function(_0x56b545,_0x4df72c){const _0x2d1006=a1_0x93ab,_0x585bb7=_0x56b545();while(!![]){try{const _0x51247c=parseInt(_0x2d1006(0x8b))/0x1*(parseInt(_0x2d1006(0x69))/0x2)+-parseInt(_0x2d1006(0x6d))/0x3*(parseInt(_0x2d1006(0x75))/0x4)+parseInt(_0x2d1006(0x81))/0x5*(-parseInt(_0x2d1006(0x66))/0x6)+-parseInt(_0x2d1006(0x71))/0x7*(-parseInt(_0x2d1006(0x88))/0x8)+-parseInt(_0x2d1006(0x6f))/0x9+-parseInt(_0x2d1006(0x89))/0xa*(parseInt(_0x2d1006(0x7f))/0xb)+parseInt(_0x2d1006(0x72))/0xc*(parseInt(_0x2d1006(0x65))/0xd);if(_0x51247c===_0x4df72c)break;else _0x585bb7['push'](_0x585bb7['shift']());}catch(_0x57ea78){_0x585bb7['push'](_0x585bb7['shift']());}}}(a1_0x2eab,0x4debe));import{jsx as a1_0x31e614,jsxs as a1_0x54942a,Fragment as a1_0x2c6d7b}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x3797ac from'node:path';function a1_0x2eab(){const _0x3042ba=['页面添加成功:\x20','info','12eJSOki','add-page','3366747gRuQgo','已选择页面模板\x20','49PVXZtt','192SmPxmX','\x20Step2:\x20','catch','359152NJNXmD','开始添加页面:\x20','green','column','setLogPath','join','url','\x20*\x20页面路径:\x20','src','success','253lYwXmR','now','65QdZxMK','正在创建页面,请稍候…','gray','pages','\x20*\x20路由地址:\x20','dirname','message','618032tFxquO','233300sqJJzm','resolve','18509FmPkim','824798DyNfpU','155586vJuLjv','cwd','../../templates/pages','40gwKgNU','\x20Step1:\x20'];a1_0x2eab=function(){return _0x3042ba;};return a1_0x2eab();}import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';function a1_0x93ab(_0xdfd2bb,_0x2bff1e){const _0x2eab41=a1_0x2eab();return a1_0x93ab=function(_0x93ab56,_0x27497e){_0x93ab56=_0x93ab56-0x65;let _0x3eec74=_0x2eab41[_0x93ab56];return _0x3eec74;},a1_0x93ab(_0xdfd2bb,_0x2bff1e);}import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x3797ac[a1_0x14a584(0x86)](fileURLToPath(import.meta[a1_0x14a584(0x7b)])),pageTemplateDir=a1_0x3797ac[a1_0x14a584(0x8a)](__dirname,a1_0x14a584(0x68)),projectDir=process[a1_0x14a584(0x67)]();export const AddPage=()=>{const _0x3b76df=a1_0x14a584,{exit:_0x1585e7}=useApp(),[_0x5cbede,_0x5dd85d]=useState(''),[_0x5b3db4,_0x562824]=useState(''),[_0x5c0835,_0x2fab80]=useState(![]),[_0x161639,_0x4c6979]=useState(![]),_0x4802ec=a1_0x3797ac[_0x3b76df(0x7a)](projectDir,_0x3b76df(0x7d),'pages'),_0x2d6be1=a1_0x3797ac['join'](_0x4802ec,_0x5b3db4),_0x5cfb08=a1_0x3797ac[_0x3b76df(0x7a)](_0x3b76df(0x7d),_0x3b76df(0x84),_0x5b3db4);useEffect(()=>{const _0x1b756b=_0x3b76df,_0x515a5c=a1_0x3797ac[_0x1b756b(0x8a)](pageTemplateDir,_0x5cbede);if(_0x5cbede&&_0x5b3db4){_0x2fab80(!![]),logger[_0x1b756b(0x79)](process[_0x1b756b(0x67)]());const _0x3e390d=Date[_0x1b756b(0x80)]();logger[_0x1b756b(0x6c)](_0x1b756b(0x6e),_0x1b756b(0x76)+_0x5b3db4,{'template':_0x5cbede,'targetPath':_0x5cfb08}),TemplateReplacer['processTemplate'](_0x515a5c,a1_0x3797ac[_0x1b756b(0x7a)](_0x4802ec,_0x5b3db4),_0x5b3db4,_0x5cbede)['then'](()=>{const _0x3a3f9f=_0x1b756b,_0x28e464=Date[_0x3a3f9f(0x80)]()-_0x3e390d;logger[_0x3a3f9f(0x7e)]('add-page',_0x3a3f9f(0x6b)+_0x5b3db4,_0x28e464,{'template':_0x5cbede,'targetPath':_0x5cfb08,'routePath':_0x5b3db4}),_0x4c6979(!![]);})[_0x1b756b(0x74)](_0x4143c5=>{const _0x254d36=_0x1b756b,_0x251ba9=Date[_0x254d36(0x80)]()-_0x3e390d;logger['error'](_0x254d36(0x6e),'页面添加失败:\x20'+_0x5b3db4,{'template':_0x5cbede,'targetPath':_0x5cfb08,'error':_0x4143c5 instanceof Error?_0x4143c5[_0x254d36(0x87)]:String(_0x4143c5),'duration':_0x251ba9});})['finally'](()=>{_0x2fab80(![]);});}},[_0x5cbede,_0x5b3db4]),useEffect(()=>{_0x161639&&setTimeout(()=>{_0x1585e7();});},[_0x161639]);if(_0x5cbede)return a1_0x54942a(Box,{'flexDirection':_0x3b76df(0x78),'paddingY':0x1,'children':[a1_0x54942a(Box,{'children':[a1_0x31e614(Text,{'color':_0x3b76df(0x83),'children':_0x3b76df(0x6a)}),a1_0x31e614(Text,{'children':_0x3b76df(0x70)}),a1_0x31e614(Text,{'color':_0x3b76df(0x77),'children':_0x5cbede})]}),_0x5b3db4?a1_0x54942a(Box,{'children':[a1_0x31e614(Text,{'color':_0x3b76df(0x83),'children':_0x3b76df(0x73)}),a1_0x31e614(Text,{'children':'已输入的页面路由\x20'}),a1_0x31e614(Text,{'color':'green','children':_0x5b3db4})]}):a1_0x31e614(InputProjectCode,{'pagePath':_0x2d6be1,'onSubmit':_0x562824}),_0x5b3db4&&_0x5c0835?a1_0x54942a(Box,{'marginTop':0x1,'children':[a1_0x31e614(Box,{'width':'4'}),a1_0x31e614(Text,{'children':_0x3b76df(0x82)})]}):null,_0x161639?a1_0x54942a(a1_0x2c6d7b,{'children':[a1_0x31e614(Box,{'marginTop':0x1,'children':a1_0x31e614(Text,{'color':'gray','children':'\x20*\x20页面创建成功!'})}),a1_0x54942a(Box,{'children':[a1_0x31e614(Text,{'color':_0x3b76df(0x83),'children':_0x3b76df(0x7c)}),a1_0x31e614(Text,{'color':'green','children':_0x5cfb08})]}),a1_0x54942a(Box,{'children':[a1_0x31e614(Text,{'color':_0x3b76df(0x83),'children':_0x3b76df(0x85)}),a1_0x54942a(Text,{'color':_0x3b76df(0x77),'children':['/',_0x5b3db4]})]}),a1_0x31e614(Box,{'marginTop':0x1,'children':a1_0x31e614(Text,{'color':'cyan','children':'\x20*\x20页面文件已创建,可直接通过路由访问'})})]}):null]});return a1_0x31e614(SelectPageTemplate,{'onSelect':_0x5dd85d});};
1
+ const a1_0x4a6e16=a1_0x4971;(function(_0x5e498f,_0x5a97b7){const _0x1068a0=a1_0x4971,_0x59f402=_0x5e498f();while(!![]){try{const _0x351eb2=parseInt(_0x1068a0(0x90))/0x1*(parseInt(_0x1068a0(0x94))/0x2)+-parseInt(_0x1068a0(0xb0))/0x3+-parseInt(_0x1068a0(0x9e))/0x4+parseInt(_0x1068a0(0xa9))/0x5*(-parseInt(_0x1068a0(0xa5))/0x6)+-parseInt(_0x1068a0(0xae))/0x7*(parseInt(_0x1068a0(0x95))/0x8)+-parseInt(_0x1068a0(0x97))/0x9+parseInt(_0x1068a0(0x98))/0xa;if(_0x351eb2===_0x5a97b7)break;else _0x59f402['push'](_0x59f402['shift']());}catch(_0x1525a0){_0x59f402['push'](_0x59f402['shift']());}}}(a1_0x370b,0x9c593));import{jsx as a1_0x524b9d,jsxs as a1_0x6aed03,Fragment as a1_0x486bfd}from'react/jsx-runtime';function a1_0x4971(_0x321923,_0x2a48f7){const _0x370b02=a1_0x370b();return a1_0x4971=function(_0x497194,_0x48cbc7){_0x497194=_0x497194-0x8f;let _0x131ac0=_0x370b02[_0x497194];return _0x131ac0;},a1_0x4971(_0x321923,_0x2a48f7);}import{fileURLToPath}from'node:url';import a1_0x4c4473 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';function a1_0x370b(){const _0x1ba7ed=['now','cyan','pages','1160392WItORo','已输入的页面路由\x20','add-page','\x20*\x20页面创建成功!','src','\x20*\x20页面文件已创建,可直接通过路由访问','error','6LOwwmd','green','已选择页面模板\x20','../../templates/pages','283810NYgyYG','resolve','页面添加失败:\x20','column','then','924knKMuP','gray','1056624rybLjg','cwd','9pLrEyt','开始添加页面:\x20','finally','\x20Step2:\x20','217178TCHLUB','8424cSXwzE','\x20*\x20路由地址:\x20','7701372hBStPb','13568740eofaJW','\x20*\x20页面路径:\x20','join'];a1_0x370b=function(){return _0x1ba7ed;};return a1_0x370b();}import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x4c4473['dirname'](fileURLToPath(import.meta['url'])),pageTemplateDir=a1_0x4c4473[a1_0x4a6e16(0xaa)](__dirname,a1_0x4a6e16(0xa8)),projectDir=process[a1_0x4a6e16(0x8f)]();export const AddPage=()=>{const _0x25a167=a1_0x4a6e16,{exit:_0x221e66}=useApp(),[_0x5d3048,_0x1f990e]=useState(''),[_0x4cdf2f,_0x3a9ec5]=useState(''),[_0x66f22c,_0x26e151]=useState(![]),[_0x402ce5,_0x22be95]=useState(![]),_0x73bb7a=a1_0x4c4473[_0x25a167(0x9a)](projectDir,_0x25a167(0xa2),'pages'),_0x3ba76a=a1_0x4c4473[_0x25a167(0x9a)](_0x73bb7a,_0x4cdf2f),_0x478bba=a1_0x4c4473[_0x25a167(0x9a)](_0x25a167(0xa2),_0x25a167(0x9d),_0x4cdf2f);useEffect(()=>{const _0x52ebb7=_0x25a167,_0x5522ab=a1_0x4c4473[_0x52ebb7(0xaa)](pageTemplateDir,_0x5d3048);if(_0x5d3048&&_0x4cdf2f){_0x26e151(!![]),logger['setLogPath'](process[_0x52ebb7(0x8f)]());const _0x3ec230=Date['now']();logger['info'](_0x52ebb7(0xa0),_0x52ebb7(0x91)+_0x4cdf2f,{'template':_0x5d3048,'targetPath':_0x478bba}),TemplateReplacer['processTemplate'](_0x5522ab,a1_0x4c4473[_0x52ebb7(0x9a)](_0x73bb7a,_0x4cdf2f),_0x4cdf2f,_0x5d3048)[_0x52ebb7(0xad)](()=>{const _0x2e0923=_0x52ebb7,_0x22efe9=Date[_0x2e0923(0x9b)]()-_0x3ec230;logger['success']('add-page','页面添加成功:\x20'+_0x4cdf2f,_0x22efe9,{'template':_0x5d3048,'targetPath':_0x478bba,'routePath':_0x4cdf2f}),_0x22be95(!![]);})['catch'](_0x5b4937=>{const _0x2452e1=_0x52ebb7,_0x128cf3=Date[_0x2452e1(0x9b)]()-_0x3ec230;logger[_0x2452e1(0xa4)]('add-page',_0x2452e1(0xab)+_0x4cdf2f,{'template':_0x5d3048,'targetPath':_0x478bba,'error':_0x5b4937 instanceof Error?_0x5b4937['message']:String(_0x5b4937),'duration':_0x128cf3});})[_0x52ebb7(0x92)](()=>{_0x26e151(![]);});}},[_0x5d3048,_0x4cdf2f]),useEffect(()=>{_0x402ce5&&setTimeout(()=>{_0x221e66();});},[_0x402ce5]);if(_0x5d3048)return a1_0x6aed03(Box,{'flexDirection':_0x25a167(0xac),'paddingY':0x1,'children':[a1_0x6aed03(Box,{'children':[a1_0x524b9d(Text,{'color':_0x25a167(0xaf),'children':'\x20Step1:\x20'}),a1_0x524b9d(Text,{'children':_0x25a167(0xa7)}),a1_0x524b9d(Text,{'color':_0x25a167(0xa6),'children':_0x5d3048})]}),_0x4cdf2f?a1_0x6aed03(Box,{'children':[a1_0x524b9d(Text,{'color':_0x25a167(0xaf),'children':_0x25a167(0x93)}),a1_0x524b9d(Text,{'children':_0x25a167(0x9f)}),a1_0x524b9d(Text,{'color':'green','children':_0x4cdf2f})]}):a1_0x524b9d(InputProjectCode,{'pagePath':_0x3ba76a,'onSubmit':_0x3a9ec5}),_0x4cdf2f&&_0x66f22c?a1_0x6aed03(Box,{'marginTop':0x1,'children':[a1_0x524b9d(Box,{'width':'4'}),a1_0x524b9d(Text,{'children':'正在创建页面,请稍候…'})]}):null,_0x402ce5?a1_0x6aed03(a1_0x486bfd,{'children':[a1_0x524b9d(Box,{'marginTop':0x1,'children':a1_0x524b9d(Text,{'color':_0x25a167(0xaf),'children':_0x25a167(0xa1)})}),a1_0x6aed03(Box,{'children':[a1_0x524b9d(Text,{'color':'gray','children':_0x25a167(0x99)}),a1_0x524b9d(Text,{'color':_0x25a167(0xa6),'children':_0x478bba})]}),a1_0x6aed03(Box,{'children':[a1_0x524b9d(Text,{'color':_0x25a167(0xaf),'children':_0x25a167(0x96)}),a1_0x6aed03(Text,{'color':_0x25a167(0xa6),'children':['/',_0x4cdf2f]})]}),a1_0x524b9d(Box,{'marginTop':0x1,'children':a1_0x524b9d(Text,{'color':_0x25a167(0x9c),'children':_0x25a167(0xa3)})})]}):null]});return a1_0x524b9d(SelectPageTemplate,{'onSelect':_0x1f990e});};
@@ -1 +1 @@
1
- (function(_0x296802,_0xb4d221){const _0x43fb87=a2_0x18ea,_0x3334b3=_0x296802();while(!![]){try{const _0x19946d=parseInt(_0x43fb87(0xa1))/0x1*(parseInt(_0x43fb87(0x92))/0x2)+-parseInt(_0x43fb87(0x91))/0x3+parseInt(_0x43fb87(0x99))/0x4+parseInt(_0x43fb87(0x94))/0x5+parseInt(_0x43fb87(0x88))/0x6*(-parseInt(_0x43fb87(0x8b))/0x7)+parseInt(_0x43fb87(0xa3))/0x8*(-parseInt(_0x43fb87(0x8d))/0x9)+-parseInt(_0x43fb87(0xa4))/0xa;if(_0x19946d===_0xb4d221)break;else _0x3334b3['push'](_0x3334b3['shift']());}catch(_0x3dd33e){_0x3334b3['push'](_0x3334b3['shift']());}}}(a2_0x56cd,0x6b7f8));import{jsx as a2_0x7e1ee1,jsxs as a2_0x5726eb}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x5d78be from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x152fb0=a2_0x18ea;try{const _0x9c6871=fileURLToPath(import.meta['url']),_0x21d189=a2_0x5d78be[_0x152fb0(0x93)](a2_0x5d78be['dirname'](_0x9c6871),_0x152fb0(0xa0)),_0x466038=a2_0x5d78be[_0x152fb0(0x97)](_0x21d189,'templates/pages'),_0x3e1975=await readdir(_0x466038,{'withFileTypes':!![]}),_0x5d660a=_0x3e1975['filter'](_0x7bfa51=>_0x7bfa51[_0x152fb0(0xa5)]())[_0x152fb0(0x95)](_0x46090f=>({'label':_0x46090f[_0x152fb0(0x9c)]}))[_0x152fb0(0x8e)]((_0x32f502,_0x45279b)=>_0x32f502[_0x152fb0(0x89)][_0x152fb0(0x8c)](_0x45279b['label']));return _0x5d660a;}catch(_0xf62589){return console[_0x152fb0(0x9e)](_0x152fb0(0x98),_0xf62589),[{'label':_0x152fb0(0x90)},{'label':'sdk-fetch'}];}}function a2_0x56cd(){const _0xe550fe=['downArrow','../..','49vASgTh','return','49512HJJHKr','2488160waTzED','isDirectory','正在加载页面模板...','gray','6rTgHGD','label','\x20Step1:\x20','575134MKZUzg','localeCompare','441dezWtn','sort','upArrow','blank','1486956TZkrER','19126CPOFsC','resolve','1415185IkCxNZ','map','\x20\x20\x20\x20\x20\x20\x20\x20','join','获取模板列表失败:','3274316BXVpmL','column','请选择您要创建的页面模板','name','green','error'];a2_0x56cd=function(){return _0xe550fe;};return a2_0x56cd();}function a2_0x18ea(_0x1ba14b,_0x3c0e89){const _0x56cdcf=a2_0x56cd();return a2_0x18ea=function(_0x18ea71,_0x7549fb){_0x18ea71=_0x18ea71-0x87;let _0x594605=_0x56cdcf[_0x18ea71];return _0x594605;},a2_0x18ea(_0x1ba14b,_0x3c0e89);}export function SelectPageTemplate(_0xca734){const _0x32b6db=a2_0x18ea,[_0x1274dc,_0x4798a4]=useState(0x0),[_0x3435f8,_0x57d70e]=useState([]),[_0x27468f,_0x399c44]=useState(!![]);useEffect(()=>{async function _0xb74fc5(){const _0xb8bdcb=await getTemplateList();_0x57d70e(_0xb8bdcb),_0x399c44(![]);}_0xb74fc5();},[]),useInput((_0xa02bd,_0x331c4f)=>{const _0x17f377=a2_0x18ea;if(_0x27468f)return;if(_0x331c4f[_0x17f377(0xa2)]){const _0x1b584c=_0x3435f8[_0x1274dc];_0x1b584c&&_0xca734['onSelect'](_0x1b584c[_0x17f377(0x89)]);}_0x331c4f[_0x17f377(0x8f)]&&_0x4798a4(_0x38b7c=>_0x38b7c===0x0?_0x3435f8['length']-0x1:_0x38b7c-0x1),_0x331c4f[_0x17f377(0x9f)]&&_0x4798a4(_0x377eb9=>_0x377eb9===_0x3435f8['length']-0x1?0x0:_0x377eb9+0x1);});if(_0x27468f)return a2_0x7e1ee1(Box,{'flexDirection':_0x32b6db(0x9a),'paddingY':0x1,'children':a2_0x5726eb(Box,{'children':[a2_0x7e1ee1(Text,{'color':_0x32b6db(0x87),'children':'\x20Step1:\x20'}),a2_0x7e1ee1(Text,{'children':_0x32b6db(0xa6)})]})});return a2_0x5726eb(Box,{'flexDirection':_0x32b6db(0x9a),'paddingY':0x1,'children':[a2_0x5726eb(Box,{'children':[a2_0x7e1ee1(Text,{'color':_0x32b6db(0x87),'children':_0x32b6db(0x8a)}),a2_0x7e1ee1(Text,{'children':_0x32b6db(0x9b)})]}),_0x3435f8['map']((_0xa9710a,_0x123d2f)=>{const _0x39a46c=_0x32b6db,_0x4a4c1e=_0x123d2f===_0x1274dc,_0x481196=_0x4a4c1e?'\x20\x20\x20\x20\x20\x20>\x20'+_0xa9710a[_0x39a46c(0x89)]:_0x39a46c(0x96)+_0xa9710a[_0x39a46c(0x89)];return a2_0x7e1ee1(Box,{'children':a2_0x7e1ee1(Text,{'color':_0x4a4c1e?_0x39a46c(0x9d):undefined,'children':_0x481196})},_0x481196);})]});}
1
+ function a2_0x1a7a(_0x57ac3b,_0x4b54d3){const _0x932419=a2_0x9324();return a2_0x1a7a=function(_0x1a7a66,_0x4f925a){_0x1a7a66=_0x1a7a66-0x15d;let _0x26068f=_0x932419[_0x1a7a66];return _0x26068f;},a2_0x1a7a(_0x57ac3b,_0x4b54d3);}(function(_0x5bce0e,_0x793ec2){const _0xc2a239=a2_0x1a7a,_0x7ad7de=_0x5bce0e();while(!![]){try{const _0x579ef6=-parseInt(_0xc2a239(0x164))/0x1*(parseInt(_0xc2a239(0x17f))/0x2)+-parseInt(_0xc2a239(0x167))/0x3*(-parseInt(_0xc2a239(0x16b))/0x4)+parseInt(_0xc2a239(0x166))/0x5+parseInt(_0xc2a239(0x161))/0x6+parseInt(_0xc2a239(0x174))/0x7+-parseInt(_0xc2a239(0x181))/0x8*(parseInt(_0xc2a239(0x160))/0x9)+-parseInt(_0xc2a239(0x15d))/0xa*(parseInt(_0xc2a239(0x16f))/0xb);if(_0x579ef6===_0x793ec2)break;else _0x7ad7de['push'](_0x7ad7de['shift']());}catch(_0xf010df){_0x7ad7de['push'](_0x7ad7de['shift']());}}}(a2_0x9324,0xead81));import{jsx as a2_0x4d96a7,jsxs as a2_0x27db4f}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';function a2_0x9324(){const _0x2ab027=['blank','8996695wAdzov','5389656JXxFsj','join','error','resolve','4kJjrXC','name','gray','onSelect','22ggjAfI','map','sort','dirname','请选择您要创建的页面模板','10751118ZgZBre','../..','downArrow','length','正在加载页面模板...','green','获取模板列表失败:','column','isDirectory','\x20\x20\x20\x20\x20\x20\x20\x20','templates/pages','194QAvblc','return','184ZMFDeh','17798020SqWEch','url','localeCompare','736254PdTulw','11093016uqaygK','label','\x20Step1:\x20','5954CVDmWc'];a2_0x9324=function(){return _0x2ab027;};return a2_0x9324();}import a2_0x529a3a from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x2c4e74=a2_0x1a7a;try{const _0x11010c=fileURLToPath(import.meta[_0x2c4e74(0x15e)]),_0x3a020c=a2_0x529a3a[_0x2c4e74(0x16a)](a2_0x529a3a[_0x2c4e74(0x172)](_0x11010c),_0x2c4e74(0x175)),_0x379b85=a2_0x529a3a[_0x2c4e74(0x168)](_0x3a020c,_0x2c4e74(0x17e)),_0x45e910=await readdir(_0x379b85,{'withFileTypes':!![]}),_0x7119b3=_0x45e910['filter'](_0x2cc85a=>_0x2cc85a[_0x2c4e74(0x17c)]())[_0x2c4e74(0x170)](_0x524b8d=>({'label':_0x524b8d[_0x2c4e74(0x16c)]}))[_0x2c4e74(0x171)]((_0x233925,_0x3fe5f0)=>_0x233925[_0x2c4e74(0x162)][_0x2c4e74(0x15f)](_0x3fe5f0[_0x2c4e74(0x162)]));return _0x7119b3;}catch(_0x54c524){return console[_0x2c4e74(0x169)](_0x2c4e74(0x17a),_0x54c524),[{'label':_0x2c4e74(0x165)},{'label':'sdk-fetch'}];}}export function SelectPageTemplate(_0x41f6d9){const _0x50260c=a2_0x1a7a,[_0x3b5caf,_0xcc210c]=useState(0x0),[_0x20cd1b,_0x4cd2d4]=useState([]),[_0x497ce0,_0x1aa78d]=useState(!![]);useEffect(()=>{async function _0x56dc19(){const _0x12873c=await getTemplateList();_0x4cd2d4(_0x12873c),_0x1aa78d(![]);}_0x56dc19();},[]),useInput((_0x4da256,_0x5f4ae1)=>{const _0x4fb895=a2_0x1a7a;if(_0x497ce0)return;if(_0x5f4ae1[_0x4fb895(0x180)]){const _0x3eb6da=_0x20cd1b[_0x3b5caf];_0x3eb6da&&_0x41f6d9[_0x4fb895(0x16e)](_0x3eb6da[_0x4fb895(0x162)]);}_0x5f4ae1['upArrow']&&_0xcc210c(_0x534a40=>_0x534a40===0x0?_0x20cd1b[_0x4fb895(0x177)]-0x1:_0x534a40-0x1),_0x5f4ae1[_0x4fb895(0x176)]&&_0xcc210c(_0x15fb4e=>_0x15fb4e===_0x20cd1b[_0x4fb895(0x177)]-0x1?0x0:_0x15fb4e+0x1);});if(_0x497ce0)return a2_0x4d96a7(Box,{'flexDirection':_0x50260c(0x17b),'paddingY':0x1,'children':a2_0x27db4f(Box,{'children':[a2_0x4d96a7(Text,{'color':'gray','children':_0x50260c(0x163)}),a2_0x4d96a7(Text,{'children':_0x50260c(0x178)})]})});return a2_0x27db4f(Box,{'flexDirection':_0x50260c(0x17b),'paddingY':0x1,'children':[a2_0x27db4f(Box,{'children':[a2_0x4d96a7(Text,{'color':_0x50260c(0x16d),'children':_0x50260c(0x163)}),a2_0x4d96a7(Text,{'children':_0x50260c(0x173)})]}),_0x20cd1b[_0x50260c(0x170)]((_0x12e997,_0x588773)=>{const _0x59dd05=_0x50260c,_0x4884ab=_0x588773===_0x3b5caf,_0x2a8510=_0x4884ab?'\x20\x20\x20\x20\x20\x20>\x20'+_0x12e997[_0x59dd05(0x162)]:_0x59dd05(0x17d)+_0x12e997[_0x59dd05(0x162)];return a2_0x4d96a7(Box,{'children':a2_0x4d96a7(Text,{'color':_0x4884ab?_0x59dd05(0x179):undefined,'children':_0x2a8510})},_0x2a8510);})]});}
@@ -1 +1 @@
1
- (function(_0x1f9201,_0x31c7ac){const _0x1fc8c0=a3_0xca46,_0xa8a426=_0x1f9201();while(!![]){try{const _0x5c2bd8=-parseInt(_0x1fc8c0(0x115))/0x1+-parseInt(_0x1fc8c0(0x116))/0x2+-parseInt(_0x1fc8c0(0x121))/0x3*(parseInt(_0x1fc8c0(0x120))/0x4)+parseInt(_0x1fc8c0(0x12f))/0x5+-parseInt(_0x1fc8c0(0x129))/0x6+parseInt(_0x1fc8c0(0x122))/0x7*(-parseInt(_0x1fc8c0(0x119))/0x8)+parseInt(_0x1fc8c0(0x128))/0x9*(parseInt(_0x1fc8c0(0x105))/0xa);if(_0x5c2bd8===_0x31c7ac)break;else _0xa8a426['push'](_0xa8a426['shift']());}catch(_0x59524f){_0xa8a426['push'](_0xa8a426['shift']());}}}(a3_0x275f,0x9de54));function a3_0x275f(){const _0x494bb3=['3872685QgtwcF','error','originalCount','red','未提供应用AppCode,且配置中也没有默认值','datasetName','lovrabet\x20auth','length','38106790qeKXyo','setLogPath','filePath','./docs','🚀\x20','map','success','yellow','env','datasetCode',',\x20失败\x20','dim','正在获取数据集列表...','green','cyan','api-doc','1146950ootLUf','821848jywfhb','使用指定的应用AppCode:\x20','未找到任何数据集','40FtCnMX','filter','!\x20原始数据集\x20','gray','white','duplicateCount','文档生成完成','8KQWBHV','1013217zffKVl','852131aHyZKz','column','正在生成\x20','*\x20输出目录:\x20','使用配置的应用AppCode:\x20','√\x20文档生成完成!成功\x20','9ugIpDV','6578754ZlBvWC','*\x20生成的文档文件:','message','\x20个,过滤重复','文档生成失败:\x20','\x20(环境:\x20'];a3_0x275f=function(){return _0x494bb3;};return a3_0x275f();}import{jsx as a3_0x3d1937,jsxs as a3_0x3063cd,Fragment as a3_0x102038}from'react/jsx-runtime';function a3_0xca46(_0x4722c3,_0x549554){const _0x275f68=a3_0x275f();return a3_0xca46=function(_0xca46e,_0x45f6eb){_0xca46e=_0xca46e-0x102;let _0x265d72=_0x275f68[_0xca46e];return _0x265d72;},a3_0xca46(_0x4722c3,_0x549554);}import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchDatasets}from'./fetch-datasets.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x512786,env:_0x10a2a9,output:_0x121972})=>{const _0xbb8a72=a3_0xca46,{exit:_0x239479}=useApp(),[_0x3da647,_0x24c583]=useState(![]),[_0x245581,_0x1353ae]=useState(''),[_0x42db59,_0x35641a]=useState(![]),[_0x157ed9,_0x5048de]=useState(null),[_0x502d5d,_0x4d38a0]=useState(null),[_0x55fe74,_0x116648]=useState(null),_0x55075f=readConfig(),_0x5c21ab=getConfigAppCode(),_0x584380=_0x512786||_0x5c21ab,_0x54fa6d=typeof _0x55075f?.['env']==='string'?_0x55075f[_0xbb8a72(0x10d)]:undefined,_0xd2fc4f=_0x10a2a9||_0x54fa6d||'online';initEnv(_0xd2fc4f);const _0x2a2db3=_0x121972||_0xbb8a72(0x108),_0x5457ae=_0x512786?_0xbb8a72(0x117)+_0x584380:_0xbb8a72(0x126)+_0x584380;useEffect(()=>{_0x24c583(!![]),_0x271e34();},[]),useEffect(()=>{(_0x42db59||_0x157ed9)&&_0x239479();},[_0x42db59,_0x157ed9,_0x239479]);async function _0x271e34(){const _0x482141=_0xbb8a72;if(!_0x584380){_0x5048de(_0x482141(0x133));return;}try{logger[_0x482141(0x106)](process['cwd']()),_0x1353ae(_0x482141(0x111));const {rawData:_0x55b319,originalCount:_0x87856e,filteredCount:_0x27398a,duplicateCount:_0xda7f65}=await fetchDatasets(_0x584380);_0x116648({'originalCount':_0x87856e,'filteredCount':_0x27398a,'duplicateCount':_0xda7f65});if(_0x55b319[_0x482141(0x104)]===0x0){_0x5048de(_0x482141(0x118));return;}_0x1353ae(_0x482141(0x124)+_0x55b319[_0x482141(0x104)]+'\x20个数据集的文档...');const _0x1b62a3=await generateDatasetDocs(_0x55b319,_0x584380,_0x2a2db3,(_0x348419,_0x17491a,_0x3d77a7)=>{_0x1353ae('正在生成\x20'+_0x3d77a7+'.md\x20('+_0x348419+'/'+_0x17491a+')');});_0x4d38a0(_0x1b62a3),_0x35641a(!![]);const _0x128dcb=_0x1b62a3[_0x482141(0x11a)](_0x10f86a=>_0x10f86a['success'])[_0x482141(0x104)],_0x28bb73=_0x1b62a3[_0x482141(0x11a)](_0x5a7d1f=>!_0x5a7d1f['success'])[_0x482141(0x104)];logger[_0x482141(0x10b)](_0x482141(0x114),_0x482141(0x11f),undefined,{'totalCount':_0x1b62a3[_0x482141(0x104)],'successCount':_0x128dcb,'failCount':_0x28bb73,'outputDir':_0x2a2db3});}catch(_0x28d3f5){const _0x55287e=_0x28d3f5 instanceof Error?_0x28d3f5[_0x482141(0x12b)]:String(_0x28d3f5);logger[_0x482141(0x130)](_0x482141(0x114),_0x482141(0x12d)+_0x55287e,{'appCode':_0x584380,'outputDir':_0x2a2db3}),_0x5048de(_0x482141(0x12d)+_0x55287e);}finally{_0x24c583(![]);}}const _0x100b2b=_0x502d5d?.[_0xbb8a72(0x11a)](_0x115e72=>_0x115e72[_0xbb8a72(0x10b)])[_0xbb8a72(0x104)]||0x0,_0x157e2a=_0x502d5d?.[_0xbb8a72(0x11a)](_0x4f53b4=>!_0x4f53b4[_0xbb8a72(0x10b)])[_0xbb8a72(0x104)]||0x0;return a3_0x3063cd(Box,{'flexDirection':'column','children':[(_0x3da647||_0x42db59)&&a3_0x3063cd(Box,{'children':[a3_0x3d1937(Text,{'color':_0xbb8a72(0x11c),'children':'*\x20'}),a3_0x3d1937(Text,{'color':_0x512786?_0xbb8a72(0x11d):_0xbb8a72(0x110),'children':_0x5457ae})]}),_0x3da647&&a3_0x3d1937(Box,{'children':a3_0x3063cd(Text,{'children':[_0xbb8a72(0x109),_0x245581,_0xbb8a72(0x12e),_0xd2fc4f,')']})}),_0x42db59&&_0x502d5d&&_0x55fe74&&a3_0x3063cd(Box,{'flexDirection':_0xbb8a72(0x123),'children':[a3_0x3d1937(Box,{'children':a3_0x3063cd(Text,{'color':_0xbb8a72(0x112),'children':[_0xbb8a72(0x127),_0x100b2b,'\x20个',_0x157e2a>0x0&&_0xbb8a72(0x10f)+_0x157e2a+'\x20个']})}),_0x55fe74[_0xbb8a72(0x11e)]>0x0&&a3_0x3d1937(Box,{'marginTop':0x1,'children':a3_0x3063cd(Text,{'color':_0xbb8a72(0x10c),'children':[_0xbb8a72(0x11b),_0x55fe74[_0xbb8a72(0x131)],_0xbb8a72(0x12c),'\x20',_0x55fe74[_0xbb8a72(0x11e)],'\x20个']})}),a3_0x3063cd(Box,{'marginTop':0x1,'children':[a3_0x3d1937(Text,{'color':'gray','children':_0xbb8a72(0x125)}),a3_0x3d1937(Text,{'color':'cyan','children':_0x2a2db3})]}),_0x100b2b>0x0&&a3_0x3063cd(a3_0x102038,{'children':[a3_0x3d1937(Box,{'marginTop':0x1,'children':a3_0x3d1937(Text,{'color':_0xbb8a72(0x11c),'children':_0xbb8a72(0x12a)})}),_0x502d5d[_0xbb8a72(0x11a)](_0x125fae=>_0x125fae[_0xbb8a72(0x10b)])[_0xbb8a72(0x10a)]((_0x3cef80,_0x1d17d9)=>a3_0x3063cd(Box,{'marginLeft':0x2,'children':[a3_0x3063cd(Text,{'color':'cyan','children':['•\x20',_0x3cef80[_0xbb8a72(0x107)]]}),a3_0x3063cd(Text,{'color':'dim','children':['\x20-\x20',_0x3cef80[_0xbb8a72(0x102)]]})]},_0x1d17d9))]}),_0x157e2a>0x0&&a3_0x3063cd(a3_0x102038,{'children':[a3_0x3d1937(Box,{'marginTop':0x1,'children':a3_0x3d1937(Text,{'color':'yellow','children':'⚠️\x20以下数据集生成失败:'})}),_0x502d5d[_0xbb8a72(0x11a)](_0x1b4a45=>!_0x1b4a45['success'])[_0xbb8a72(0x10a)]((_0x7223b5,_0x3c9c82)=>a3_0x3063cd(Box,{'marginLeft':0x2,'flexDirection':_0xbb8a72(0x123),'children':[a3_0x3063cd(Text,{'color':_0xbb8a72(0x132),'children':['•\x20',_0x7223b5[_0xbb8a72(0x102)],'\x20(',_0x7223b5[_0xbb8a72(0x10e)],')']}),_0x7223b5[_0xbb8a72(0x130)]&&a3_0x3d1937(Box,{'marginLeft':0x2,'children':a3_0x3d1937(Text,{'color':_0xbb8a72(0x110),'children':_0x7223b5['error']})})]},_0x3c9c82))]})]}),_0x157ed9&&a3_0x3063cd(Box,{'flexDirection':_0xbb8a72(0x123),'children':[a3_0x3d1937(Box,{'children':a3_0x3063cd(Text,{'color':_0xbb8a72(0x132),'children':['❌\x20',_0x157ed9]})}),_0x157ed9['includes']('登录')&&a3_0x3063cd(Box,{'marginTop':0x1,'children':[a3_0x3d1937(Text,{'color':_0xbb8a72(0x10c),'children':'💡\x20请使用\x20'}),a3_0x3d1937(Text,{'color':_0xbb8a72(0x113),'children':_0xbb8a72(0x103)}),a3_0x3d1937(Text,{'color':_0xbb8a72(0x10c),'children':'\x20重新登录后再试'})]})]})]});};
1
+ (function(_0x219835,_0x272440){const _0x197e3f=a3_0x12c2,_0xa91f27=_0x219835();while(!![]){try{const _0x5eb629=-parseInt(_0x197e3f(0xc0))/0x1+-parseInt(_0x197e3f(0xed))/0x2*(parseInt(_0x197e3f(0xcd))/0x3)+parseInt(_0x197e3f(0xe9))/0x4*(-parseInt(_0x197e3f(0xc1))/0x5)+parseInt(_0x197e3f(0xdb))/0x6+parseInt(_0x197e3f(0xf1))/0x7*(parseInt(_0x197e3f(0xe0))/0x8)+parseInt(_0x197e3f(0xc6))/0x9+parseInt(_0x197e3f(0xeb))/0xa*(parseInt(_0x197e3f(0xde))/0xb);if(_0x5eb629===_0x272440)break;else _0xa91f27['push'](_0xa91f27['shift']());}catch(_0xf0f112){_0xa91f27['push'](_0xa91f27['shift']());}}}(a3_0x3a48,0x51650));import{jsx as a3_0x184e34,jsxs as a3_0x32646d,Fragment as a3_0x22e0c5}from'react/jsx-runtime';function a3_0x3a48(){const _0x4dc8eb=['string','√\x20文档生成完成!成功\x20','white','dim','4964004AsvTOk',',\x20失败\x20','cyan','.md\x20(','map','join','includes','1345053BKfNub','未找到任何数据集','length','*\x20输出目录:\x20','\x1b[0m','datasetCode','success','env','🚀\x20','使用指定的应用AppCode:\x20','api-doc','red','未提供应用AppCode,且配置中也没有默认值','setLogPath','2526042ezsJAn','!\x20原始数据集\x20','\x1b[90m*\x20从\x20','684838uLxGXH','column','24DakhMA','\x20(环境:\x20','code','lovrabet\x20auth','log','💡\x20请使用\x20','online','filter','正在获取数据集列表...','5372FnrWeH','datasetName','130GPsGhL','\x1b[33m!\x20以下数据集代码不存在:\x20','2qIWAlu','正在生成\x20','error','文档生成失败:\x20','269598lTsGTq','message','gray','\x20个,过滤重复','cwd','*\x20生成的文档文件:','指定的数据集代码都不存在:\x20','\x20重新登录后再试','\x20个数据集中筛选出\x20','使用配置的应用AppCode:\x20','yellow','duplicateCount','⚠️\x20以下数据集生成失败:','534197GtMiFD','2165wHciVD'];a3_0x3a48=function(){return _0x4dc8eb;};return a3_0x3a48();}import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a3_0x12c2(_0x24ec03,_0x224a71){const _0x3a4803=a3_0x3a48();return a3_0x12c2=function(_0x12c266,_0x8a5d2d){_0x12c266=_0x12c266-0xb8;let _0x353d0a=_0x3a4803[_0x12c266];return _0x353d0a;},a3_0x12c2(_0x24ec03,_0x224a71);}import{initEnv}from'../constant/env.js';import{fetchDatasets}from'./fetch-datasets.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x5ba1f9,env:_0x4a9959,output:_0x2ecdba,extraParams:_0x224f4b,datasetCodes:_0x4983c0})=>{const _0x5e279e=a3_0x12c2,{exit:_0x51709a}=useApp(),[_0x4a8704,_0x4164de]=useState(![]),[_0x56a8df,_0x3c95ad]=useState(''),[_0x5c7731,_0x31f3a6]=useState(![]),[_0x5b4c4c,_0x23d1ce]=useState(null),[_0x129a53,_0x269f83]=useState(null),[_0x4f7456,_0x435598]=useState(null),_0x3c9e89=readConfig(),_0x1c4405=getConfigAppCode(),_0x218fc0=_0x5ba1f9||_0x1c4405,_0x29272a=typeof _0x3c9e89?.[_0x5e279e(0xd4)]===_0x5e279e(0xc2)?_0x3c9e89['env']:undefined,_0x2c6335=_0x4a9959||_0x29272a||_0x5e279e(0xe6);initEnv(_0x2c6335);const _0x2df1e1=_0x2ecdba||'./docs',_0x1a3416=_0x5ba1f9?_0x5e279e(0xd6)+_0x218fc0:_0x5e279e(0xbc)+_0x218fc0;useEffect(()=>{_0x4164de(!![]),_0x49270();},[]),useEffect(()=>{(_0x5c7731||_0x5b4c4c)&&_0x51709a();},[_0x5c7731,_0x5b4c4c,_0x51709a]);async function _0x49270(){const _0x32452a=_0x5e279e;if(!_0x218fc0){_0x23d1ce(_0x32452a(0xd9));return;}try{logger[_0x32452a(0xda)](process[_0x32452a(0xf5)]()),_0x3c95ad(_0x32452a(0xe8));const {rawData:_0x27f60e,originalCount:_0x11c8e2,filteredCount:_0x317d55,duplicateCount:_0x8e24d6}=await fetchDatasets(_0x218fc0);_0x435598({'originalCount':_0x11c8e2,'filteredCount':_0x317d55,'duplicateCount':_0x8e24d6});if(_0x27f60e[_0x32452a(0xcf)]===0x0){_0x23d1ce(_0x32452a(0xce));return;}let _0x130113=_0x27f60e;if(_0x4983c0&&_0x4983c0[_0x32452a(0xcf)]>0x0){_0x130113=_0x27f60e[_0x32452a(0xe7)](_0x1fbafc=>_0x4983c0[_0x32452a(0xcc)](_0x1fbafc[_0x32452a(0xe2)]));const _0x4ca561=_0x130113[_0x32452a(0xca)](_0x3bc836=>_0x3bc836[_0x32452a(0xe2)]),_0x253848=_0x4983c0['filter'](_0x2e387c=>!_0x4ca561[_0x32452a(0xcc)](_0x2e387c));_0x253848[_0x32452a(0xcf)]>0x0&&console[_0x32452a(0xe4)](_0x32452a(0xec)+_0x253848[_0x32452a(0xcb)](',\x20')+_0x32452a(0xd1));if(_0x130113['length']===0x0){_0x23d1ce(_0x32452a(0xb9)+_0x4983c0[_0x32452a(0xcb)](',\x20'));return;}console['log'](_0x32452a(0xdd)+_0x27f60e[_0x32452a(0xcf)]+_0x32452a(0xbb)+_0x130113[_0x32452a(0xcf)]+'\x20个匹配的数据集\x1b[0m');}_0x3c95ad(_0x32452a(0xee)+_0x130113['length']+'\x20个数据集的文档...');const _0x3a259c=await generateDatasetDocs(_0x130113,_0x218fc0,_0x2df1e1,(_0x17ca90,_0x280fe5,_0x4e068a)=>{const _0x433203=_0x32452a;_0x3c95ad(_0x433203(0xee)+_0x4e068a+_0x433203(0xc9)+_0x17ca90+'/'+_0x280fe5+')');},_0x224f4b);_0x269f83(_0x3a259c),_0x31f3a6(!![]);const _0xc25da7=_0x3a259c[_0x32452a(0xe7)](_0x223f71=>_0x223f71[_0x32452a(0xd3)])[_0x32452a(0xcf)],_0x244897=_0x3a259c[_0x32452a(0xe7)](_0x57dcef=>!_0x57dcef[_0x32452a(0xd3)])[_0x32452a(0xcf)];logger[_0x32452a(0xd3)]('api-doc','文档生成完成',undefined,{'totalCount':_0x3a259c[_0x32452a(0xcf)],'successCount':_0xc25da7,'failCount':_0x244897,'outputDir':_0x2df1e1});}catch(_0x1e93ed){const _0x4d8f6f=_0x1e93ed instanceof Error?_0x1e93ed[_0x32452a(0xf2)]:String(_0x1e93ed);logger[_0x32452a(0xef)](_0x32452a(0xd7),'文档生成失败:\x20'+_0x4d8f6f,{'appCode':_0x218fc0,'outputDir':_0x2df1e1}),_0x23d1ce(_0x32452a(0xf0)+_0x4d8f6f);}finally{_0x4164de(![]);}}const _0x573a53=_0x129a53?.['filter'](_0x1217ee=>_0x1217ee[_0x5e279e(0xd3)])[_0x5e279e(0xcf)]||0x0,_0x54e9b1=_0x129a53?.[_0x5e279e(0xe7)](_0x4eb50a=>!_0x4eb50a['success'])[_0x5e279e(0xcf)]||0x0;return a3_0x32646d(Box,{'flexDirection':_0x5e279e(0xdf),'children':[(_0x4a8704||_0x5c7731)&&a3_0x32646d(Box,{'children':[a3_0x184e34(Text,{'color':_0x5e279e(0xf3),'children':'*\x20'}),a3_0x184e34(Text,{'color':_0x5ba1f9?_0x5e279e(0xc4):'dim','children':_0x1a3416})]}),_0x4a8704&&a3_0x184e34(Box,{'children':a3_0x32646d(Text,{'children':[_0x5e279e(0xd5),_0x56a8df,_0x5e279e(0xe1),_0x2c6335,')']})}),_0x5c7731&&_0x129a53&&_0x4f7456&&a3_0x32646d(Box,{'flexDirection':'column','children':[a3_0x184e34(Box,{'children':a3_0x32646d(Text,{'color':'green','children':[_0x5e279e(0xc3),_0x573a53,'\x20个',_0x54e9b1>0x0&&_0x5e279e(0xc7)+_0x54e9b1+'\x20个']})}),_0x4f7456['duplicateCount']>0x0&&a3_0x184e34(Box,{'marginTop':0x1,'children':a3_0x32646d(Text,{'color':_0x5e279e(0xbd),'children':[_0x5e279e(0xdc),_0x4f7456['originalCount'],_0x5e279e(0xf4),'\x20',_0x4f7456[_0x5e279e(0xbe)],'\x20个']})}),a3_0x32646d(Box,{'marginTop':0x1,'children':[a3_0x184e34(Text,{'color':'gray','children':_0x5e279e(0xd0)}),a3_0x184e34(Text,{'color':'cyan','children':_0x2df1e1})]}),_0x573a53>0x0&&a3_0x32646d(a3_0x22e0c5,{'children':[a3_0x184e34(Box,{'marginTop':0x1,'children':a3_0x184e34(Text,{'color':_0x5e279e(0xf3),'children':_0x5e279e(0xb8)})}),_0x129a53[_0x5e279e(0xe7)](_0x251497=>_0x251497['success'])[_0x5e279e(0xca)]((_0x21a240,_0x2abd4d)=>a3_0x32646d(Box,{'marginLeft':0x2,'children':[a3_0x32646d(Text,{'color':_0x5e279e(0xc8),'children':['•\x20',_0x21a240['filePath']]}),a3_0x32646d(Text,{'color':_0x5e279e(0xc5),'children':['\x20-\x20',_0x21a240[_0x5e279e(0xea)]]})]},_0x2abd4d))]}),_0x54e9b1>0x0&&a3_0x32646d(a3_0x22e0c5,{'children':[a3_0x184e34(Box,{'marginTop':0x1,'children':a3_0x184e34(Text,{'color':_0x5e279e(0xbd),'children':_0x5e279e(0xbf)})}),_0x129a53['filter'](_0x23e281=>!_0x23e281[_0x5e279e(0xd3)])[_0x5e279e(0xca)]((_0x366601,_0x3d2577)=>a3_0x32646d(Box,{'marginLeft':0x2,'flexDirection':_0x5e279e(0xdf),'children':[a3_0x32646d(Text,{'color':_0x5e279e(0xd8),'children':['•\x20',_0x366601[_0x5e279e(0xea)],'\x20(',_0x366601[_0x5e279e(0xd2)],')']}),_0x366601[_0x5e279e(0xef)]&&a3_0x184e34(Box,{'marginLeft':0x2,'children':a3_0x184e34(Text,{'color':_0x5e279e(0xc5),'children':_0x366601['error']})})]},_0x3d2577))]})]}),_0x5b4c4c&&a3_0x32646d(Box,{'flexDirection':'column','children':[a3_0x184e34(Box,{'children':a3_0x32646d(Text,{'color':_0x5e279e(0xd8),'children':['❌\x20',_0x5b4c4c]})}),_0x5b4c4c[_0x5e279e(0xcc)]('登录')&&a3_0x32646d(Box,{'marginTop':0x1,'children':[a3_0x184e34(Text,{'color':_0x5e279e(0xbd),'children':_0x5e279e(0xe5)}),a3_0x184e34(Text,{'color':_0x5e279e(0xc8),'children':_0x5e279e(0xe3)}),a3_0x184e34(Text,{'color':_0x5e279e(0xbd),'children':_0x5e279e(0xba)})]})]})]});};
@@ -1 +1 @@
1
- const a4_0x41d9a9=a4_0x2b90;(function(_0x35c151,_0x31a96e){const _0x2ac990=a4_0x2b90,_0xad9001=_0x35c151();while(!![]){try{const _0x447f38=parseInt(_0x2ac990(0x12a))/0x1+parseInt(_0x2ac990(0x138))/0x2+parseInt(_0x2ac990(0x122))/0x3+-parseInt(_0x2ac990(0x134))/0x4*(-parseInt(_0x2ac990(0x11d))/0x5)+parseInt(_0x2ac990(0x11a))/0x6+parseInt(_0x2ac990(0x11f))/0x7+-parseInt(_0x2ac990(0x129))/0x8;if(_0x447f38===_0x31a96e)break;else _0xad9001['push'](_0xad9001['shift']());}catch(_0x53b269){_0xad9001['push'](_0xad9001['shift']());}}}(a4_0x1b89,0x39d2b));import{mkdirSync,writeFileSync}from'node:fs';import a4_0x41a502 from'node:path';function a4_0x1b89(){const _0x335ca5=['data','slice','.md','stringify','code','生成文档失败:\x20','4PZRThf','dbtableConfig','markdown','./docs','876714XPDcSn','),HTTP状态码:\x20','status','push','length','184728hTmiFT','响应数据格式错误\x20(',']\x20正在生成:\x20','1223890alITSi','✓\x20成功生成:\x20','3286388kjOFVZ','log','/api/node-toolbox/api-doc-generator','84246gOkImw','api-doc','✗\x20失败:\x20','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','.md\x20(','name','string','7807672VkOInf','1313qoGLeH','):缺少\x20data.markdown\x20字段','utf8','tableName'];a4_0x1b89=function(){return _0x335ca5;};return a4_0x1b89();}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a4_0x2b90(_0x57127b,_0x514be8){const _0x1b8993=a4_0x1b89();return a4_0x2b90=function(_0x2b90c1,_0x25ca83){_0x2b90c1=_0x2b90c1-0x119;let _0x1c12f6=_0x1b8993[_0x2b90c1];return _0x1c12f6;},a4_0x2b90(_0x57127b,_0x514be8);}import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0xb354ee){const _0x5c5f84=a4_0x2b90,{appCode:_0x16ea57,datasetCode:_0x1a103e,datasetId:_0x574f81}=_0xb354ee,_0x3b1233=getApiDomain(),_0x363ec0=_0x3b1233+_0x5c5f84(0x121),_0x436578=await fetch(_0x363ec0,{'method':'POST','headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON[_0x5c5f84(0x131)]({'appCode':_0x16ea57,'datasetCode':_0x1a103e,'datasetId':_0x574f81})});if(!_0x436578['ok']){if(_0x436578[_0x5c5f84(0x13a)]===0x191)throw new Error(_0x5c5f84(0x125));let _0x87f1f9='';try{_0x87f1f9=await _0x436578['text']();}catch(_0x1fa237){}throw new Error('获取文档失败\x20('+_0x1a103e+_0x5c5f84(0x139)+_0x436578[_0x5c5f84(0x13a)]+(_0x87f1f9?'\x0a'+_0x87f1f9:''));}const _0x22c166=await _0x436578['json']();if(!_0x22c166[_0x5c5f84(0x12e)]||typeof _0x22c166[_0x5c5f84(0x12e)][_0x5c5f84(0x136)]!==_0x5c5f84(0x128))throw new Error(_0x5c5f84(0x11b)+_0x1a103e+_0x5c5f84(0x12b));return _0x22c166[_0x5c5f84(0x12e)][_0x5c5f84(0x136)];}function delay(_0x9221cf){return new Promise(_0xc6bb63=>setTimeout(_0xc6bb63,_0x9221cf));}export async function generateDatasetDocs(_0x4cd581,_0x5ac5bf,_0x49e9ac=a4_0x41d9a9(0x137),_0x93d7b1){const _0x133717=a4_0x41d9a9;mkdirSync(_0x49e9ac,{'recursive':!![]});const _0x32a204=[],_0x25322f=_0x4cd581[_0x133717(0x119)];console[_0x133717(0x120)]('\x0a共有\x20'+_0x25322f+'\x20个数据集需要生成文档\x0a');for(let _0x1132a9=0x0;_0x1132a9<_0x4cd581[_0x133717(0x119)];_0x1132a9++){const _0x2071da=_0x4cd581[_0x1132a9],_0x5e54d7=_0x1132a9+0x1;let _0x486250;if(_0x2071da[_0x133717(0x135)]?.[_0x133717(0x12d)])_0x486250=_0x2071da[_0x133717(0x135)]['tableName'];else{const _0xe52d58=_0x2071da[_0x133717(0x132)][_0x133717(0x12f)](-0x4);_0x486250='dataset_'+_0xe52d58;}try{console['log']('['+_0x5e54d7+'/'+_0x25322f+_0x133717(0x11c)+_0x486250+_0x133717(0x126)+_0x2071da[_0x133717(0x127)]+')');_0x93d7b1&&_0x93d7b1(_0x5e54d7,_0x25322f,_0x486250);const _0x5bb7b9=await fetchDatasetDoc({'appCode':_0x5ac5bf,'datasetCode':_0x2071da[_0x133717(0x132)],'datasetId':_0x2071da['id'],'enableAI':![]}),_0x2757b6=a4_0x41a502['join'](_0x49e9ac,_0x486250+_0x133717(0x130));writeFileSync(_0x2757b6,_0x5bb7b9,{'encoding':_0x133717(0x12c)}),console['log'](_0x133717(0x11e)+_0x486250+_0x133717(0x130)),logger['success'](_0x133717(0x123),'生成文档成功:\x20'+_0x486250,undefined,{'datasetCode':_0x2071da[_0x133717(0x132)],'datasetName':_0x2071da['name'],'filePath':_0x2757b6,'progress':_0x5e54d7+'/'+_0x25322f}),_0x32a204[_0x133717(0x13b)]({'datasetCode':_0x2071da[_0x133717(0x132)],'datasetName':_0x2071da[_0x133717(0x127)],'filePath':_0x2757b6,'success':!![]}),_0x5e54d7<_0x25322f&&await delay(0xbb8);}catch(_0x375fee){const _0x5bb393=_0x375fee instanceof Error?_0x375fee['message']:String(_0x375fee);console['log'](_0x133717(0x124)+_0x486250+'.md\x20-\x20'+_0x5bb393+'\x0a'),logger['error'](_0x133717(0x123),_0x133717(0x133)+_0x2071da[_0x133717(0x132)],{'datasetCode':_0x2071da[_0x133717(0x132)],'datasetName':_0x2071da[_0x133717(0x127)],'error':_0x5bb393,'progress':_0x5e54d7+'/'+_0x25322f}),_0x32a204[_0x133717(0x13b)]({'datasetCode':_0x2071da[_0x133717(0x132)],'datasetName':_0x2071da['name'],'filePath':'','success':![],'error':_0x5bb393}),_0x5e54d7<_0x25322f&&(console[_0x133717(0x120)]('等待\x203\x20秒...\x0a'),await delay(0xbb8));}}return _0x32a204;}
1
+ const a4_0x2fee9f=a4_0x24d2;(function(_0x23860f,_0x5c460a){const _0x21f671=a4_0x24d2,_0x2adc60=_0x23860f();while(!![]){try{const _0x58e900=parseInt(_0x21f671(0x15c))/0x1+-parseInt(_0x21f671(0x15d))/0x2+parseInt(_0x21f671(0x139))/0x3+parseInt(_0x21f671(0x155))/0x4*(-parseInt(_0x21f671(0x13e))/0x5)+-parseInt(_0x21f671(0x152))/0x6*(parseInt(_0x21f671(0x147))/0x7)+parseInt(_0x21f671(0x141))/0x8*(-parseInt(_0x21f671(0x13a))/0x9)+-parseInt(_0x21f671(0x153))/0xa*(-parseInt(_0x21f671(0x14c))/0xb);if(_0x58e900===_0x5c460a)break;else _0x2adc60['push'](_0x2adc60['shift']());}catch(_0x2df896){_0x2adc60['push'](_0x2adc60['shift']());}}}(a4_0x131f,0xa84f9));import{mkdirSync,writeFileSync}from'node:fs';import a4_0x9fc4a1 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';function a4_0x24d2(_0x5efde6,_0x2f8d03){const _0x131f49=a4_0x131f();return a4_0x24d2=function(_0x24d23d,_0x5d0bf1){_0x24d23d=_0x24d23d-0x138;let _0x4224d9=_0x131f49[_0x24d23d];return _0x4224d9;},a4_0x24d2(_0x5efde6,_0x2f8d03);}export async function fetchDatasetDoc(_0x35cd6b){const _0x1d6762=a4_0x24d2,{appCode:_0x3189b5,datasetCode:_0x49fa4b,datasetId:_0x1a719b,extraParams:_0x5962af}=_0x35cd6b,_0xa20f54=getApiDomain(),_0x489e82=_0xa20f54+_0x1d6762(0x140),_0x457926={'appCode':_0x3189b5,'datasetCode':_0x49fa4b,'datasetId':_0x1a719b,..._0x5962af||{}},_0x112388=await fetch(_0x489e82,{'method':'POST','headers':{'Content-Type':_0x1d6762(0x13c),'Cookie':getCookie()},'body':JSON['stringify'](_0x457926)});if(!_0x112388['ok']){if(_0x112388[_0x1d6762(0x145)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');let _0x362e4b='';try{_0x362e4b=await _0x112388[_0x1d6762(0x159)]();}catch(_0x4eb60d){}throw new Error('获取文档失败\x20('+_0x49fa4b+_0x1d6762(0x14e)+_0x112388[_0x1d6762(0x145)]+(_0x362e4b?'\x0a'+_0x362e4b:''));}const _0x41fe47=await _0x112388[_0x1d6762(0x13f)]();if(!_0x41fe47[_0x1d6762(0x150)]||typeof _0x41fe47[_0x1d6762(0x150)][_0x1d6762(0x14a)]!==_0x1d6762(0x138))throw new Error(_0x1d6762(0x144)+_0x49fa4b+'):缺少\x20data.markdown\x20字段');return _0x41fe47[_0x1d6762(0x150)][_0x1d6762(0x14a)];}function delay(_0x2d3776){return new Promise(_0x142685=>setTimeout(_0x142685,_0x2d3776));}export async function generateDatasetDocs(_0x3cbf95,_0x1a9710,_0x1239e7=a4_0x2fee9f(0x15b),_0x15beb2,_0x4b73e2){const _0x552636=a4_0x2fee9f;mkdirSync(_0x1239e7,{'recursive':!![]});const _0x84ddf6=[],_0x2bccce=_0x3cbf95['length'];console[_0x552636(0x142)](_0x552636(0x146)+_0x2bccce+_0x552636(0x158));for(let _0x539d6f=0x0;_0x539d6f<_0x3cbf95[_0x552636(0x13d)];_0x539d6f++){const _0x1f38c8=_0x3cbf95[_0x539d6f],_0x27de1f=_0x539d6f+0x1;let _0x52c435;if(_0x1f38c8[_0x552636(0x148)]?.['tableName'])_0x52c435=_0x1f38c8[_0x552636(0x148)]['tableName'];else{const _0x4d22f8=_0x1f38c8[_0x552636(0x14d)]['slice'](-0x6)[_0x552636(0x15f)](0x6,'0');_0x52c435='dataset_'+_0x4d22f8;}try{console[_0x552636(0x142)]('['+_0x27de1f+'/'+_0x2bccce+_0x552636(0x161)+_0x52c435+_0x552636(0x154)+_0x1f38c8[_0x552636(0x14b)]+')');_0x15beb2&&_0x15beb2(_0x27de1f,_0x2bccce,_0x52c435);const _0xb4a911=await fetchDatasetDoc({'appCode':_0x1a9710,'datasetCode':_0x1f38c8['code'],'datasetId':_0x1f38c8['id'],'enableAI':![],'extraParams':_0x4b73e2}),_0x2091ac=a4_0x9fc4a1[_0x552636(0x162)](_0x1239e7,_0x52c435+'.md');writeFileSync(_0x2091ac,_0xb4a911,{'encoding':_0x552636(0x13b)}),console[_0x552636(0x142)]('✓\x20成功生成:\x20'+_0x52c435+_0x552636(0x15e)),logger[_0x552636(0x157)](_0x552636(0x149),_0x552636(0x143)+_0x52c435,undefined,{'datasetCode':_0x1f38c8[_0x552636(0x14d)],'datasetName':_0x1f38c8['name'],'filePath':_0x2091ac,'progress':_0x27de1f+'/'+_0x2bccce}),_0x84ddf6['push']({'datasetCode':_0x1f38c8[_0x552636(0x14d)],'datasetName':_0x1f38c8[_0x552636(0x14b)],'filePath':_0x2091ac,'success':!![]}),_0x27de1f<_0x2bccce&&await delay(0xbb8);}catch(_0x22bb57){const _0x4576a4=_0x22bb57 instanceof Error?_0x22bb57[_0x552636(0x151)]:String(_0x22bb57);console[_0x552636(0x142)](_0x552636(0x14f)+_0x52c435+'.md\x20-\x20'+_0x4576a4+'\x0a'),logger[_0x552636(0x156)](_0x552636(0x149),'生成文档失败:\x20'+_0x1f38c8['code'],{'datasetCode':_0x1f38c8[_0x552636(0x14d)],'datasetName':_0x1f38c8[_0x552636(0x14b)],'error':_0x4576a4,'progress':_0x27de1f+'/'+_0x2bccce}),_0x84ddf6[_0x552636(0x160)]({'datasetCode':_0x1f38c8[_0x552636(0x14d)],'datasetName':_0x1f38c8[_0x552636(0x14b)],'filePath':'','success':![],'error':_0x4576a4}),_0x27de1f<_0x2bccce&&(console['log'](_0x552636(0x15a)),await delay(0xbb8));}}return _0x84ddf6;}function a4_0x131f(){const _0x3cc9aa=['message','90KbiVJw','10FYuxnb','.md\x20(','64FpaSkE','error','success','\x20个数据集需要生成文档\x0a','text','等待\x203\x20秒...\x0a','./docs','637827VzTkvY','1128980joWUuV','.md','padStart','push',']\x20正在生成:\x20','join','string','1369959PwdzvP','26361ypXUaN','utf8','application/json','length','129585YQhDyz','json','/api/node-toolbox/api-doc-generator','2384jpVbUT','log','生成文档成功:\x20','响应数据格式错误\x20(','status','\x0a共有\x20','90874ysamxe','dbtableConfig','api-doc','markdown','name','18058205oSKnsR','code','),HTTP状态码:\x20','✗\x20失败:\x20','data'];a4_0x131f=function(){return _0x3cc9aa;};return a4_0x131f();}
@@ -1 +1 @@
1
- (function(_0x431aa9,_0x4be06d){const _0x30513d=a5_0x5c79,_0x3e6094=_0x431aa9();while(!![]){try{const _0x5392a9=parseInt(_0x30513d(0x10c))/0x1+parseInt(_0x30513d(0x117))/0x2*(parseInt(_0x30513d(0x10f))/0x3)+parseInt(_0x30513d(0x100))/0x4+-parseInt(_0x30513d(0x128))/0x5*(-parseInt(_0x30513d(0x10e))/0x6)+parseInt(_0x30513d(0xf5))/0x7+parseInt(_0x30513d(0xfd))/0x8+parseInt(_0x30513d(0x108))/0x9*(-parseInt(_0x30513d(0x111))/0xa);if(_0x5392a9===_0x4be06d)break;else _0x3e6094['push'](_0x3e6094['shift']());}catch(_0x116f28){_0x3e6094['push'](_0x3e6094['shift']());}}}(a5_0x2e2c,0x7364b));function a5_0x2e2c(){const _0x5e2926=['datasetCount','gray','590351MJYdzP','√\x20成功拉取\x20','6pPBerc','180027YOQjNX','\x20个,过滤重复','26110oLKtzz','未提供应用AppCode,且配置中也没有默认值','replace','includes','\x20from\x20\x27@/','string','2ArQKgD','modelCount','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','-api','\x20个模型)','online','\x20-\x20客户端实例文件','column','-client','env','error','-\x20模型配置文件\x20(','api','\x20个模型','split','cwd','setLogPath','4471385vpftuQ','duplicateCount','💡\x20请使用\x20','.ts','./src/api/','client','4472279ORLfZm','*\x20已生成文件:','*\x20导入方式:','\x20个数据集,生成','originalCount','join','api-pull','使用指定的应用AppCode:\x20','2012376wrcESs','slice','\x20重新登录后再试','1852756INNGsU','yellow','dim','拉取\x20API\x20配置失败:\x20','cyan','message','green','lovrabet\x20auth','8361ceIAGa','white'];a5_0x2e2c=function(){return _0x5e2926;};return a5_0x2e2c();}import{jsx as a5_0x52a211,jsxs as a5_0x2c23f4}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchDatasets}from'./fetch-datasets.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';function a5_0x5c79(_0x1870d5,_0x1d5840){const _0x2e2c37=a5_0x2e2c();return a5_0x5c79=function(_0x5c79bb,_0x56470b){_0x5c79bb=_0x5c79bb-0xf4;let _0xf21cda=_0x2e2c37[_0x5c79bb];return _0xf21cda;},a5_0x5c79(_0x1870d5,_0x1d5840);}export const ApiPullUI=({appCode:_0x2955ec,env:_0x20f4a3,output:_0x5d3aac})=>{const _0x4010c1=a5_0x5c79,{exit:_0x43ba0d}=useApp(),[_0x41acac,_0x11e837]=useState(![]),[_0x4ad07b,_0x4a0195]=useState(![]),[_0x42e431,_0x56cf7d]=useState(null),[_0x5ee914,_0x26725a]=useState(null),_0x4323dc=readConfig(),_0x53c0b9=getConfigAppCode(),_0x187de9=_0x2955ec||_0x53c0b9,_0x2007ae=typeof _0x4323dc?.[_0x4010c1(0x120)]===_0x4010c1(0x116)?_0x4323dc[_0x4010c1(0x120)]:undefined,_0x4004de=_0x20f4a3||_0x2007ae||_0x4010c1(0x11c);initEnv(_0x4004de);const _0x1470a9=_0x5d3aac||_0x4010c1(0x12c),_0x30ddda=_0x2955ec&&_0x2955ec['includes']('-')?_0x2955ec[_0x4010c1(0x125)]('-')[_0x4010c1(0xfe)](0x1)[_0x4010c1(0xfa)]('-'):'',_0x2122ec=_0x2955ec?_0x4010c1(0xfc)+_0x187de9:'使用配置的应用AppCode:\x20'+_0x187de9,_0x33223f=_0x30ddda?_0x30ddda+_0x4010c1(0x11a):_0x4010c1(0x123),_0x5d8c91=_0x30ddda?_0x30ddda+_0x4010c1(0x11f):'client';useEffect(()=>{_0x11e837(!![]),_0x3e1ac0();},[]),useEffect(()=>{(_0x4ad07b||_0x42e431)&&_0x43ba0d();},[_0x4ad07b,_0x42e431,_0x43ba0d]);async function _0x3e1ac0(){const _0xfe5bd0=_0x4010c1;if(!_0x187de9){_0x56cf7d(_0xfe5bd0(0x112));return;}try{logger[_0xfe5bd0(0x127)](process[_0xfe5bd0(0x126)]());const {rawData:_0x47a4d1,originalCount:_0x115dfb,filteredCount:_0x1e7106,duplicateCount:_0x6d8e49}=await fetchDatasets(_0x187de9),_0x118eb3=_0x1e7106,_0x2b84df=!_0x2955ec,_0x10191f=await generateApiFile(_0x47a4d1,_0x30ddda,_0x187de9,_0x2b84df,_0x4004de,_0x1470a9),_0xf0dd56=_0x1470a9['endsWith']('/')?_0x1470a9:_0x1470a9+'/';_0x26725a({'api':''+_0xf0dd56+_0x33223f+_0xfe5bd0(0x12b),'client':''+_0xf0dd56+_0x5d8c91+'.ts','modelCount':_0x10191f[_0xfe5bd0(0x118)],'datasetCount':_0x118eb3,'originalCount':_0x115dfb,'duplicateCount':_0x6d8e49}),_0x4a0195(!![]);}catch(_0x5342bf){const _0x58b1a9=_0x5342bf instanceof Error?_0x5342bf[_0xfe5bd0(0x105)]:String(_0x5342bf);logger[_0xfe5bd0(0x121)](_0xfe5bd0(0xfb),_0xfe5bd0(0x103)+_0x58b1a9,{'appCode':_0x187de9,'error':_0x58b1a9}),_0x56cf7d(_0xfe5bd0(0x103)+_0x58b1a9);}finally{_0x11e837(![]);}}return a5_0x2c23f4(Box,{'flexDirection':_0x4010c1(0x11e),'children':[(_0x41acac||_0x4ad07b)&&a5_0x2c23f4(Box,{'children':[a5_0x52a211(Text,{'color':_0x4010c1(0x10b),'children':'*\x20'}),a5_0x52a211(Text,{'color':_0x2955ec?_0x4010c1(0x109):_0x4010c1(0x102),'children':_0x2122ec})]}),_0x41acac&&a5_0x52a211(Box,{'children':a5_0x2c23f4(Text,{'children':[_0x4010c1(0x119),_0x4004de,')']})}),_0x4ad07b&&_0x5ee914&&a5_0x2c23f4(Box,{'flexDirection':_0x4010c1(0x11e),'children':[a5_0x52a211(Box,{'children':a5_0x2c23f4(Text,{'color':_0x4010c1(0x106),'children':[_0x4010c1(0x10d),_0x5ee914[_0x4010c1(0x10a)],_0x4010c1(0xf8),'\x20',_0x5ee914[_0x4010c1(0x118)],_0x4010c1(0x124)]})}),_0x5ee914['duplicateCount']>0x0&&a5_0x52a211(Box,{'marginTop':0x1,'children':a5_0x2c23f4(Text,{'color':'yellow','children':['!\x20原始数据集\x20',_0x5ee914[_0x4010c1(0xf9)],_0x4010c1(0x110),'\x20',_0x5ee914[_0x4010c1(0x129)],'\x20个']})}),a5_0x52a211(Box,{'marginTop':0x1,'children':a5_0x52a211(Text,{'color':_0x4010c1(0x10b),'children':_0x4010c1(0xf6)})}),a5_0x2c23f4(Box,{'marginLeft':0x2,'children':[a5_0x2c23f4(Text,{'color':_0x4010c1(0x104),'children':['•\x20',_0x5ee914[_0x4010c1(0x123)]]}),a5_0x2c23f4(Text,{'color':'dim','children':['\x20',_0x4010c1(0x122),_0x5ee914['modelCount'],_0x4010c1(0x11b)]})]}),a5_0x2c23f4(Box,{'marginLeft':0x2,'children':[a5_0x2c23f4(Text,{'color':_0x4010c1(0x104),'children':['•\x20',_0x5ee914['client']]}),a5_0x52a211(Text,{'color':_0x4010c1(0x102),'children':_0x4010c1(0x11d)})]}),a5_0x52a211(Box,{'marginTop':0x1,'children':a5_0x52a211(Text,{'color':'gray','children':_0x4010c1(0xf7)})}),a5_0x52a211(Box,{'marginLeft':0x2,'children':a5_0x2c23f4(Text,{'color':'yellow','children':['import\x20','{\x20lovrabetClient\x20}',_0x4010c1(0x115),_0x5ee914[_0x4010c1(0xf4)][_0x4010c1(0x113)](/^\.\//,'')[_0x4010c1(0x113)](_0x4010c1(0x12b),''),'\x27']})})]}),_0x42e431&&a5_0x2c23f4(Box,{'flexDirection':_0x4010c1(0x11e),'children':[a5_0x52a211(Box,{'children':a5_0x2c23f4(Text,{'color':'red','children':['❌\x20',_0x42e431]})}),_0x42e431[_0x4010c1(0x114)]('登录')&&a5_0x2c23f4(Box,{'marginTop':0x1,'children':[a5_0x52a211(Text,{'color':_0x4010c1(0x101),'children':_0x4010c1(0x12a)}),a5_0x52a211(Text,{'color':'cyan','children':_0x4010c1(0x107)}),a5_0x52a211(Text,{'color':_0x4010c1(0x101),'children':_0x4010c1(0xff)})]})]})]});};
1
+ (function(_0x4a1599,_0x129746){const _0x58a52d=a5_0x8c6d,_0x1747ab=_0x4a1599();while(!![]){try{const _0x338d27=-parseInt(_0x58a52d(0x129))/0x1+-parseInt(_0x58a52d(0x121))/0x2+parseInt(_0x58a52d(0x13d))/0x3*(parseInt(_0x58a52d(0x148))/0x4)+-parseInt(_0x58a52d(0x11c))/0x5*(-parseInt(_0x58a52d(0x135))/0x6)+-parseInt(_0x58a52d(0x14f))/0x7+parseInt(_0x58a52d(0x142))/0x8*(parseInt(_0x58a52d(0x137))/0x9)+-parseInt(_0x58a52d(0x125))/0xa*(-parseInt(_0x58a52d(0x14d))/0xb);if(_0x338d27===_0x129746)break;else _0x1747ab['push'](_0x1747ab['shift']());}catch(_0x336a36){_0x1747ab['push'](_0x1747ab['shift']());}}}(a5_0xbe0f,0xe9acb));import{jsx as a5_0x3595ac,jsxs as a5_0x32131b}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a5_0xbe0f(){const _0x286387=['🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','includes','./src/api/','-\x20模型配置文件\x20(','💡\x20请使用\x20','cyan','1023186EhbPIp','-api','52551IMVRgc','-client','*\x20已生成文件:','使用配置的应用AppCode:\x20','gray','error','580857ZehUVe','\x20个,过滤重复','拉取\x20API\x20配置失败:\x20','*\x20导入方式:','!\x20原始数据集\x20','1168cNdqTs','column','lovrabet\x20auth','red','datasetCount','endsWith','24wPGqQL','未提供应用AppCode,且配置中也没有默认值','replace','api','√\x20成功拉取\x20','451ReBbiL','.ts','8041355xNVJgb','white','25VrNiln','\x20个数据集,生成','\x20重新登录后再试','modelCount','yellow','572858FMNqAI','client','使用指定的应用AppCode:\x20','join','22450NsQBCw','string','slice','\x20-\x20客户端实例文件','566583AMroxo','\x20from\x20\x27@/','split','duplicateCount','dim','cwd'];a5_0xbe0f=function(){return _0x286387;};return a5_0xbe0f();}import{initEnv}from'../constant/env.js';import{fetchDatasets}from'./fetch-datasets.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';function a5_0x8c6d(_0x2b706e,_0x40cdbb){const _0xbe0f20=a5_0xbe0f();return a5_0x8c6d=function(_0x8c6dcd,_0x264131){_0x8c6dcd=_0x8c6dcd-0x11b;let _0x216695=_0xbe0f20[_0x8c6dcd];return _0x216695;},a5_0x8c6d(_0x2b706e,_0x40cdbb);}export const ApiPullUI=({appCode:_0x329a94,env:_0x4cfd06,output:_0x551f81})=>{const _0x17fb39=a5_0x8c6d,{exit:_0x3624a4}=useApp(),[_0x46454c,_0x42881e]=useState(![]),[_0x469e6c,_0x3180fa]=useState(![]),[_0x187159,_0x948177]=useState(null),[_0x24f489,_0xbdd081]=useState(null),_0x462881=readConfig(),_0x3c0c5d=getConfigAppCode(),_0x5c6110=_0x329a94||_0x3c0c5d,_0x18c76e=typeof _0x462881?.['env']===_0x17fb39(0x126)?_0x462881['env']:undefined,_0x39fb6a=_0x4cfd06||_0x18c76e||'online';initEnv(_0x39fb6a);const _0x59f29d=_0x551f81||_0x17fb39(0x131),_0x51dc59=_0x329a94&&_0x329a94[_0x17fb39(0x130)]('-')?_0x329a94[_0x17fb39(0x12b)]('-')[_0x17fb39(0x127)](0x1)[_0x17fb39(0x124)]('-'):'',_0x1c5a0a=_0x329a94?_0x17fb39(0x123)+_0x5c6110:_0x17fb39(0x13a)+_0x5c6110,_0x3a40d0=_0x51dc59?_0x51dc59+_0x17fb39(0x136):_0x17fb39(0x14b),_0x4547eb=_0x51dc59?_0x51dc59+_0x17fb39(0x138):_0x17fb39(0x122);useEffect(()=>{_0x42881e(!![]),_0x3d3b5e();},[]),useEffect(()=>{(_0x469e6c||_0x187159)&&_0x3624a4();},[_0x469e6c,_0x187159,_0x3624a4]);async function _0x3d3b5e(){const _0x2f2263=_0x17fb39;if(!_0x5c6110){_0x948177(_0x2f2263(0x149));return;}try{logger['setLogPath'](process[_0x2f2263(0x12e)]());const {rawData:_0x5abdc5,originalCount:_0x2c751a,filteredCount:_0x471571,duplicateCount:_0x30acea}=await fetchDatasets(_0x5c6110),_0x5d8ad1=_0x471571,_0x1df7f4=!_0x329a94,_0x418823=await generateApiFile(_0x5abdc5,_0x51dc59,_0x5c6110,_0x1df7f4,_0x39fb6a,_0x59f29d),_0x371580=_0x59f29d[_0x2f2263(0x147)]('/')?_0x59f29d:_0x59f29d+'/';_0xbdd081({'api':''+_0x371580+_0x3a40d0+_0x2f2263(0x14e),'client':''+_0x371580+_0x4547eb+_0x2f2263(0x14e),'modelCount':_0x418823['modelCount'],'datasetCount':_0x5d8ad1,'originalCount':_0x2c751a,'duplicateCount':_0x30acea}),_0x3180fa(!![]);}catch(_0x115556){const _0x769631=_0x115556 instanceof Error?_0x115556['message']:String(_0x115556);logger[_0x2f2263(0x13c)]('api-pull',_0x2f2263(0x13f)+_0x769631,{'appCode':_0x5c6110,'error':_0x769631}),_0x948177('拉取\x20API\x20配置失败:\x20'+_0x769631);}finally{_0x42881e(![]);}}return a5_0x32131b(Box,{'flexDirection':'column','children':[(_0x46454c||_0x469e6c)&&a5_0x32131b(Box,{'children':[a5_0x3595ac(Text,{'color':_0x17fb39(0x13b),'children':'*\x20'}),a5_0x3595ac(Text,{'color':_0x329a94?_0x17fb39(0x11b):_0x17fb39(0x12d),'children':_0x1c5a0a})]}),_0x46454c&&a5_0x3595ac(Box,{'children':a5_0x32131b(Text,{'children':[_0x17fb39(0x12f),_0x39fb6a,')']})}),_0x469e6c&&_0x24f489&&a5_0x32131b(Box,{'flexDirection':_0x17fb39(0x143),'children':[a5_0x3595ac(Box,{'children':a5_0x32131b(Text,{'color':'green','children':[_0x17fb39(0x14c),_0x24f489[_0x17fb39(0x146)],_0x17fb39(0x11d),'\x20',_0x24f489[_0x17fb39(0x11f)],'\x20个模型']})}),_0x24f489[_0x17fb39(0x12c)]>0x0&&a5_0x3595ac(Box,{'marginTop':0x1,'children':a5_0x32131b(Text,{'color':_0x17fb39(0x120),'children':[_0x17fb39(0x141),_0x24f489['originalCount'],_0x17fb39(0x13e),'\x20',_0x24f489[_0x17fb39(0x12c)],'\x20个']})}),a5_0x3595ac(Box,{'marginTop':0x1,'children':a5_0x3595ac(Text,{'color':_0x17fb39(0x13b),'children':_0x17fb39(0x139)})}),a5_0x32131b(Box,{'marginLeft':0x2,'children':[a5_0x32131b(Text,{'color':_0x17fb39(0x134),'children':['•\x20',_0x24f489['api']]}),a5_0x32131b(Text,{'color':_0x17fb39(0x12d),'children':['\x20',_0x17fb39(0x132),_0x24f489[_0x17fb39(0x11f)],'\x20个模型)']})]}),a5_0x32131b(Box,{'marginLeft':0x2,'children':[a5_0x32131b(Text,{'color':_0x17fb39(0x134),'children':['•\x20',_0x24f489['client']]}),a5_0x3595ac(Text,{'color':_0x17fb39(0x12d),'children':_0x17fb39(0x128)})]}),a5_0x3595ac(Box,{'marginTop':0x1,'children':a5_0x3595ac(Text,{'color':'gray','children':_0x17fb39(0x140)})}),a5_0x3595ac(Box,{'marginLeft':0x2,'children':a5_0x32131b(Text,{'color':_0x17fb39(0x120),'children':['import\x20','{\x20lovrabetClient\x20}',_0x17fb39(0x12a),_0x24f489['client'][_0x17fb39(0x14a)](/^\.\//,'')['replace'](_0x17fb39(0x14e),''),'\x27']})})]}),_0x187159&&a5_0x32131b(Box,{'flexDirection':_0x17fb39(0x143),'children':[a5_0x3595ac(Box,{'children':a5_0x32131b(Text,{'color':_0x17fb39(0x145),'children':['❌\x20',_0x187159]})}),_0x187159[_0x17fb39(0x130)]('登录')&&a5_0x32131b(Box,{'marginTop':0x1,'children':[a5_0x3595ac(Text,{'color':_0x17fb39(0x120),'children':_0x17fb39(0x133)}),a5_0x3595ac(Text,{'color':_0x17fb39(0x134),'children':_0x17fb39(0x144)}),a5_0x3595ac(Text,{'color':_0x17fb39(0x120),'children':_0x17fb39(0x11e)})]})]})]});};
@@ -1 +1 @@
1
- (function(_0x141cc4,_0x2452b7){const _0x578a0d=a6_0x3087,_0x32f131=_0x141cc4();while(!![]){try{const _0x184616=-parseInt(_0x578a0d(0xcc))/0x1*(parseInt(_0x578a0d(0xda))/0x2)+parseInt(_0x578a0d(0xe1))/0x3+-parseInt(_0x578a0d(0xd6))/0x4*(-parseInt(_0x578a0d(0xd0))/0x5)+parseInt(_0x578a0d(0xcf))/0x6*(parseInt(_0x578a0d(0xd9))/0x7)+parseInt(_0x578a0d(0xca))/0x8+parseInt(_0x578a0d(0xde))/0x9*(-parseInt(_0x578a0d(0xd8))/0xa)+parseInt(_0x578a0d(0xe0))/0xb;if(_0x184616===_0x2452b7)break;else _0x32f131['push'](_0x32f131['shift']());}catch(_0x1008b2){_0x32f131['push'](_0x32f131['shift']());}}}(a6_0x16ce,0xf0b87));import{getCookie}from'../auth/get-cookie.js';function a6_0x3087(_0x562d59,_0x37950b){const _0x16ceb4=a6_0x16ce();return a6_0x3087=function(_0x30873f,_0x48a355){_0x30873f=_0x30873f-0xc8;let _0xa84998=_0x16ceb4[_0x30873f];return _0xa84998;},a6_0x3087(_0x562d59,_0x37950b);}import{getApiDomain}from'../constant/domain.js';import{formatDataset}from'./format-dataset.js';export function filterDuplicateDatasets(_0x5f2a2c){const _0xb4bbaa=a6_0x3087,_0x7e64ff=_0x5f2a2c[_0xb4bbaa(0xdb)](_0xe21f09=>_0xe21f09[_0xb4bbaa(0xdd)]),_0x2e568d=_0x5f2a2c[_0xb4bbaa(0xdb)](_0x25eb04=>!_0x25eb04[_0xb4bbaa(0xdd)]),_0x4495d2=new Map();return _0x7e64ff[_0xb4bbaa(0xcd)](_0x307508=>{const _0x2886e7=_0xb4bbaa,_0x307eec=_0x307508[_0x2886e7(0xdd)][_0x2886e7(0xdf)],_0x1ec567=_0x4495d2['get'](_0x307eec);(!_0x1ec567||_0x307508['id']>_0x1ec567['id'])&&_0x4495d2['set'](_0x307eec,_0x307508);}),[...Array[_0xb4bbaa(0xd2)](_0x4495d2[_0xb4bbaa(0xc8)]()),..._0x2e568d];}export async function fetchDatasets(_0x2a926c){const _0x590324=a6_0x3087,_0x259601=await fetch(getApiDomain()+'/smartapi/dataset/getList?appCode='+_0x2a926c+_0x590324(0xd3),{'headers':{'Cookie':getCookie()}});if(!_0x259601['ok']){if(_0x259601[_0x590324(0xce)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');let _0x428725='';try{_0x428725=await _0x259601[_0x590324(0xd1)]();}catch(_0x5b1bf2){}throw new Error(_0x590324(0xd7)+_0x259601[_0x590324(0xce)]+(_0x428725?'\x0a'+_0x428725:''));}const _0x45652d=await _0x259601[_0x590324(0xd5)]();if(!_0x45652d[_0x590324(0xcb)])throw new Error('获取数据集失败:\x20'+(_0x45652d['message']||_0x590324(0xdc)));const _0x573ca2=_0x45652d[_0x590324(0xc9)][_0x590324(0xd4)],_0x14d124=_0x573ca2['length'],_0x188c58=filterDuplicateDatasets(_0x573ca2),_0x3923c1=_0x188c58['length'],_0xa541b1=_0x14d124-_0x3923c1,_0x5a214c=formatDataset(_0x188c58);return{'datasets':_0x5a214c,'rawData':_0x188c58,'originalCount':_0x14d124,'filteredCount':_0x3923c1,'duplicateCount':_0xa541b1};}function a6_0x16ce(){const _0x8a5e00=['dbtableConfig','61461DzYwxg','tableName','2424906tAeBno','119091WMmksQ','values','data','6738240mxlEun','success','1226HTlCyU','forEach','status','961458UqIvap','38635PiytMM','text','from','&pageSize=999&currentPage=1','tableData','json','956BkwZBi','获取数据集失败,HTTP状态码:\x20','2740XjOjwD','49vBobSd','1980KegYqj','filter','未知错误'];a6_0x16ce=function(){return _0x8a5e00;};return a6_0x16ce();}
1
+ function a6_0x58c7(_0x41a63b,_0x26f17b){const _0x2839ca=a6_0x2839();return a6_0x58c7=function(_0x58c70e,_0x4fc8b5){_0x58c70e=_0x58c70e-0x12b;let _0x51666d=_0x2839ca[_0x58c70e];return _0x51666d;},a6_0x58c7(_0x41a63b,_0x26f17b);}(function(_0x2c01f7,_0x4e76a3){const _0x101d77=a6_0x58c7,_0x2e9be1=_0x2c01f7();while(!![]){try{const _0x3dbdc8=-parseInt(_0x101d77(0x132))/0x1+-parseInt(_0x101d77(0x144))/0x2*(parseInt(_0x101d77(0x12d))/0x3)+-parseInt(_0x101d77(0x131))/0x4+parseInt(_0x101d77(0x138))/0x5*(parseInt(_0x101d77(0x133))/0x6)+-parseInt(_0x101d77(0x13a))/0x7+-parseInt(_0x101d77(0x13d))/0x8+parseInt(_0x101d77(0x134))/0x9*(parseInt(_0x101d77(0x12b))/0xa);if(_0x3dbdc8===_0x4e76a3)break;else _0x2e9be1['push'](_0x2e9be1['shift']());}catch(_0x2c35d7){_0x2e9be1['push'](_0x2e9be1['shift']());}}}(a6_0x2839,0x93a9e));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{formatDataset}from'./format-dataset.js';function a6_0x2839(){const _0x251f4f=['tableName','获取数据集失败,HTTP状态码:\x20','1645285IjtXnJ','set','6517252zHXGsJ','from','&pageSize=999&currentPage=1','7746736nvFIDe','length','get','/smartapi/dataset/getList?appCode=','未知错误','forEach','获取数据集失败:\x20','72MNsazT','16378410GmdlsU','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','93843pKJBbW','text','tableData','dbtableConfig','657652NYYnPF','468116wOXwRA','18dDHoRc','18lgQrvZ','status'];a6_0x2839=function(){return _0x251f4f;};return a6_0x2839();}export function filterDuplicateDatasets(_0x570f59){const _0x3f0247=a6_0x58c7,_0x38ee26=_0x570f59['filter'](_0x71c599=>_0x71c599[_0x3f0247(0x130)]),_0x481555=_0x570f59['filter'](_0x991140=>!_0x991140[_0x3f0247(0x130)]),_0x14c48e=new Map();return _0x38ee26[_0x3f0247(0x142)](_0x234e95=>{const _0x44a130=_0x3f0247,_0x330778=_0x234e95[_0x44a130(0x130)][_0x44a130(0x136)],_0x70bf47=_0x14c48e[_0x44a130(0x13f)](_0x330778);(!_0x70bf47||_0x234e95['id']>_0x70bf47['id'])&&_0x14c48e[_0x44a130(0x139)](_0x330778,_0x234e95);}),[...Array[_0x3f0247(0x13b)](_0x14c48e['values']()),..._0x481555];}export async function fetchDatasets(_0x241abb){const _0x5947a4=a6_0x58c7,_0x38b360=await fetch(getApiDomain()+_0x5947a4(0x140)+_0x241abb+_0x5947a4(0x13c),{'headers':{'Cookie':getCookie()}});if(!_0x38b360['ok']){if(_0x38b360[_0x5947a4(0x135)]===0x191)throw new Error(_0x5947a4(0x12c));let _0x246ccd='';try{_0x246ccd=await _0x38b360[_0x5947a4(0x12e)]();}catch(_0x21ab40){}throw new Error(_0x5947a4(0x137)+_0x38b360['status']+(_0x246ccd?'\x0a'+_0x246ccd:''));}const _0x2a8c02=await _0x38b360['json']();if(!_0x2a8c02['success'])throw new Error(_0x5947a4(0x143)+(_0x2a8c02['message']||_0x5947a4(0x141)));const _0x53ad3d=_0x2a8c02['data'][_0x5947a4(0x12f)],_0x470d2f=_0x53ad3d[_0x5947a4(0x13e)],_0x2f84f7=filterDuplicateDatasets(_0x53ad3d),_0x51bc40=_0x2f84f7['length'],_0x21f7da=_0x470d2f-_0x51bc40,_0x149532=formatDataset(_0x2f84f7);return{'datasets':_0x149532,'rawData':_0x2f84f7,'originalCount':_0x470d2f,'filteredCount':_0x51bc40,'duplicateCount':_0x21f7da};}
@@ -1 +1 @@
1
- function a7_0x5d46(){const _0x5de63c=['toUpperCase','set','pkField','get','131490OKatmw','30GpmZLM','5vEJewQ','replace','11vZgvjA','44930IxnsDt','dataset','map','values','6042416IRQsTv','code','slice','Api','tableName','3177392wEuhIk','36100188FHaFaw','name','allFields','filter','3RFtqmK','18VMeyFm','trim','1384943VrhcZg','3873666yNxChZ','dbtableConfig','forEach'];a7_0x5d46=function(){return _0x5de63c;};return a7_0x5d46();}(function(_0x261cfb,_0x54153d){const _0x3585c7=a7_0xcb6e,_0x44105a=_0x261cfb();while(!![]){try{const _0x428ffc=parseInt(_0x3585c7(0xaf))/0x1*(-parseInt(_0x3585c7(0xa1))/0x2)+-parseInt(_0x3585c7(0xb3))/0x3+parseInt(_0x3585c7(0xaa))/0x4*(parseInt(_0x3585c7(0x9e))/0x5)+parseInt(_0x3585c7(0x9d))/0x6*(-parseInt(_0x3585c7(0xb2))/0x7)+-parseInt(_0x3585c7(0xa5))/0x8+-parseInt(_0x3585c7(0xb0))/0x9*(parseInt(_0x3585c7(0x9c))/0xa)+-parseInt(_0x3585c7(0xa0))/0xb*(-parseInt(_0x3585c7(0xab))/0xc);if(_0x428ffc===_0x54153d)break;else _0x44105a['push'](_0x44105a['shift']());}catch(_0x4b7487){_0x44105a['push'](_0x44105a['shift']());}}}(a7_0x5d46,0xa45d3));export function formatDataset(_0x3ee8a0){const _0x524d71=a7_0xcb6e,_0xd8b979=_0x3ee8a0[_0x524d71(0xae)](_0x52e76b=>_0x52e76b[_0x524d71(0xb4)]),_0x1ef433=_0x3ee8a0[_0x524d71(0xae)](_0x2e6c1a=>!_0x2e6c1a['dbtableConfig']),_0x10d14e=new Map();_0xd8b979[_0x524d71(0xb5)](_0x25f653=>{const _0x421f4f=_0x524d71,_0x3e6a13=_0x25f653[_0x421f4f(0xb4)][_0x421f4f(0xa9)],_0x117cb4=_0x10d14e[_0x421f4f(0x9b)](_0x3e6a13);(!_0x117cb4||_0x25f653['id']>_0x117cb4['id'])&&_0x10d14e[_0x421f4f(0xb7)](_0x3e6a13,_0x25f653);});const _0x3e2550=Array['from'](_0x10d14e[_0x524d71(0xa4)]())[_0x524d71(0xa3)](_0x5e30d6=>{const _0x4b0b57=_0x524d71,_0x1a5cca=snakeToCamel(_0x5e30d6['dbtableConfig'][_0x4b0b57(0xa9)]);return{'id':_0x5e30d6['id'],'name':_0x5e30d6[_0x4b0b57(0xac)],'code':_0x5e30d6[_0x4b0b57(0xa6)],'tableName':_0x5e30d6[_0x4b0b57(0xb4)]['tableName'],'apiFucName':_0x1a5cca?_0x1a5cca+_0x4b0b57(0xa8):_0x4b0b57(0xa2)+_0x5e30d6[_0x4b0b57(0xa6)]+_0x4b0b57(0xa8),'pkField':_0x5e30d6[_0x4b0b57(0xb4)][_0x4b0b57(0x9a)],'allFields':_0x5e30d6[_0x4b0b57(0xb4)][_0x4b0b57(0xad)]['split'](',')};}),_0x527c9a=_0x1ef433[_0x524d71(0xa3)](_0x36815c=>{const _0x570f24=_0x524d71,_0xe047f2=_0x36815c[_0x570f24(0xa6)][_0x570f24(0xa7)](-0x6),_0x34ed6d='dataset_'+_0xe047f2,_0x4a9179=snakeToCamel(_0x34ed6d);return{'id':_0x36815c['id'],'name':_0x36815c[_0x570f24(0xac)],'code':_0x36815c[_0x570f24(0xa6)],'tableName':_0x34ed6d,'apiFucName':_0x4a9179?_0x4a9179+_0x570f24(0xa8):_0x570f24(0xa2)+_0xe047f2+_0x570f24(0xa8),'pkField':undefined,'allFields':[]};});return[..._0x3e2550,..._0x527c9a];}function a7_0xcb6e(_0x5659ee,_0x3ab747){const _0x5d4601=a7_0x5d46();return a7_0xcb6e=function(_0xcb6e96,_0x15d15b){_0xcb6e96=_0xcb6e96-0x9a;let _0x220946=_0x5d4601[_0xcb6e96];return _0x220946;},a7_0xcb6e(_0x5659ee,_0x3ab747);}function snakeToCamel(_0x400670){const _0x2319ff=a7_0xcb6e;if(!_0x400670)return _0x400670;const _0x3d0426=_0x400670[_0x2319ff(0xb1)]();return _0x3d0426[_0x2319ff(0x9f)](/_([a-zA-Z0-9])/g,(_0x43bfa3,_0x3139a)=>_0x3139a[_0x2319ff(0xb6)]());}
1
+ (function(_0x2da370,_0x31fa03){const _0x14183d=a7_0x359f,_0x4f5576=_0x2da370();while(!![]){try{const _0x17e9d2=-parseInt(_0x14183d(0x19b))/0x1+parseInt(_0x14183d(0x199))/0x2*(-parseInt(_0x14183d(0x1a4))/0x3)+-parseInt(_0x14183d(0x18f))/0x4*(parseInt(_0x14183d(0x1a6))/0x5)+-parseInt(_0x14183d(0x1a5))/0x6+-parseInt(_0x14183d(0x198))/0x7*(parseInt(_0x14183d(0x19d))/0x8)+-parseInt(_0x14183d(0x1a7))/0x9+-parseInt(_0x14183d(0x195))/0xa*(-parseInt(_0x14183d(0x196))/0xb);if(_0x17e9d2===_0x31fa03)break;else _0x4f5576['push'](_0x4f5576['shift']());}catch(_0x91266){_0x4f5576['push'](_0x4f5576['shift']());}}}(a7_0x2125,0x62c5b));function a7_0x359f(_0xaf063d,_0x9c32f4){const _0x212592=a7_0x2125();return a7_0x359f=function(_0x359fd8,_0x5767fb){_0x359fd8=_0x359fd8-0x18d;let _0x5082d8=_0x212592[_0x359fd8];return _0x5082d8;},a7_0x359f(_0xaf063d,_0x9c32f4);}export function formatDataset(_0x2d8f0b){const _0x45803d=a7_0x359f,_0x4492d7=_0x2d8f0b[_0x45803d(0x1a0)](_0x8da251=>_0x8da251[_0x45803d(0x192)]),_0x2c7f15=_0x2d8f0b['filter'](_0x56cb7f=>!_0x56cb7f[_0x45803d(0x192)]),_0x47e7ac=new Map();_0x4492d7[_0x45803d(0x1a2)](_0xa8d7a0=>{const _0x279945=_0x45803d,_0x2cae6f=_0xa8d7a0[_0x279945(0x192)][_0x279945(0x18e)],_0x48238e=_0x47e7ac['get'](_0x2cae6f);(!_0x48238e||_0xa8d7a0['id']>_0x48238e['id'])&&_0x47e7ac[_0x279945(0x18d)](_0x2cae6f,_0xa8d7a0);});const _0x160f4d=Array['from'](_0x47e7ac[_0x45803d(0x19e)]())[_0x45803d(0x19a)](_0x397285=>{const _0x1ddd47=_0x45803d,_0x142efc=snakeToCamel(_0x397285['dbtableConfig']['tableName']);return{'id':_0x397285['id'],'name':_0x397285[_0x1ddd47(0x193)],'code':_0x397285[_0x1ddd47(0x194)],'tableName':_0x397285['dbtableConfig'][_0x1ddd47(0x18e)],'apiFucName':_0x142efc?_0x142efc+_0x1ddd47(0x197):'dataset'+_0x397285['code']+'Api','pkField':_0x397285[_0x1ddd47(0x192)]['pkField'],'allFields':_0x397285[_0x1ddd47(0x192)][_0x1ddd47(0x1a3)]?_0x397285[_0x1ddd47(0x192)][_0x1ddd47(0x1a3)][_0x1ddd47(0x1a1)](','):[]};}),_0x31fa41=_0x2c7f15[_0x45803d(0x19a)](_0x670739=>{const _0x438f92=_0x45803d,_0x3b4c49=_0x670739[_0x438f92(0x194)]['slice'](-0x6),_0x15e109=_0x438f92(0x190)+_0x3b4c49,_0x334e3b=snakeToCamel(_0x15e109);return{'id':_0x670739['id'],'name':_0x670739[_0x438f92(0x193)],'code':_0x670739[_0x438f92(0x194)],'tableName':_0x15e109,'apiFucName':_0x334e3b?_0x334e3b+_0x438f92(0x197):'dataset'+_0x3b4c49+_0x438f92(0x197),'pkField':undefined,'allFields':[]};});return[..._0x160f4d,..._0x31fa41];}function a7_0x2125(){const _0x331b8e=['dbtableConfig','name','code','162220kQwhAr','2167AtxHNR','Api','98BUHFSm','848858mtlchi','map','570225gBaUvh','toUpperCase','187336EmwTdb','values','trim','filter','split','forEach','allFields','3BWkfiX','4748892QjTyJc','55vbxMPT','4845222kLTVqH','set','tableName','50484mqOVFH','dataset_','replace'];a7_0x2125=function(){return _0x331b8e;};return a7_0x2125();}function snakeToCamel(_0x304e05){const _0x3c9f52=a7_0x359f;if(!_0x304e05)return _0x304e05;const _0xaab6b2=_0x304e05[_0x3c9f52(0x19f)]();return _0xaab6b2[_0x3c9f52(0x191)](/_([a-zA-Z0-9])/g,(_0x4348b8,_0x17f9a7)=>_0x17f9a7[_0x3c9f52(0x19c)]());}
@@ -1 +1 @@
1
- (function(_0x3423cc,_0x33d100){const _0x5a37fe=a8_0x1ee0,_0x3c4f3c=_0x3423cc();while(!![]){try{const _0x34c25f=parseInt(_0x5a37fe(0x140))/0x1+-parseInt(_0x5a37fe(0x131))/0x2+-parseInt(_0x5a37fe(0x12d))/0x3*(-parseInt(_0x5a37fe(0x134))/0x4)+-parseInt(_0x5a37fe(0x128))/0x5*(parseInt(_0x5a37fe(0x10e))/0x6)+parseInt(_0x5a37fe(0x112))/0x7*(-parseInt(_0x5a37fe(0x110))/0x8)+parseInt(_0x5a37fe(0x135))/0x9*(-parseInt(_0x5a37fe(0x139))/0xa)+parseInt(_0x5a37fe(0x111))/0xb*(parseInt(_0x5a37fe(0x125))/0xc);if(_0x34c25f===_0x33d100)break;else _0x3c4f3c['push'](_0x3c4f3c['shift']());}catch(_0x53c621){_0x3c4f3c['push'](_0x3c4f3c['shift']());}}}(a8_0x1007,0x4d109));import a8_0x11cc23 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a8_0x2da0a9 from'node:path';function a8_0x1ee0(_0x314092,_0x285730){const _0x10079b=a8_0x1007();return a8_0x1ee0=function(_0x1ee069,_0x5e5055){_0x1ee069=_0x1ee069-0x10e;let _0x52658c=_0x10079b[_0x1ee069];return _0x52658c;},a8_0x1ee0(_0x314092,_0x285730);}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a8_0x1007(){const _0x24f70d=['join','code','1468508yREFDW','36Wxdfas','online','client','forEach','1262220qTlHyn','init-api','format','slice','utf8','\x22\x20}','apiFucName','347812RThAhV','222SFvyxD','tableName','240mqViwA','1967746QVwgjq','112686YGkdCM','app','success','endsWith','replaceApiContent','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','string','.ts','dirname','{\x20apiConfigName:\x20\x22','API\x20文件生成成功!','typescript','api','../..','toUpperCase','{\x20apiConfigName:\x20','url','api.ts.tpl','keys','72pguRMj',',\x20env:\x20\x22','resolve','25475vwfZVN','-api','-client','name','replace','3thNfHH','env','CONFIG_NAMES.DEFAULT','templates/generate-api','592510uYDKLK'];a8_0x1007=function(){return _0x24f70d;};return a8_0x1007();}import{formatDataset}from'./format-dataset.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x2273eb,_0x5cccef='',_0x3eb6f8,_0x2c95c0=![],_0x5083e5,_0xbe2aaa='./src/api/'){const _0x53b601=a8_0x1ee0,_0x55f454=readConfig(),_0x360f2b=_0x3eb6f8||_0x55f454?.[_0x53b601(0x113)];if(typeof _0x360f2b!==_0x53b601(0x118)||!_0x360f2b)throw new Error(_0x53b601(0x117));const _0x721c93=_0x2c95c0?_0x53b601(0x12f):'\x22'+_0x360f2b+'\x22',_0x4c044f=typeof _0x55f454[_0x53b601(0x12e)]===_0x53b601(0x118)?_0x55f454['env']:undefined,_0x41f0a1=_0x5083e5||_0x4c044f||_0x53b601(0x136),_0x16ce92=_0x41f0a1!==_0x53b601(0x136);let _0x467053;if(_0x2c95c0)_0x16ce92?_0x467053=_0x53b601(0x121)+_0x721c93+_0x53b601(0x126)+_0x41f0a1+_0x53b601(0x13e):_0x467053='';else{const _0x5df687=_0x16ce92?_0x53b601(0x126)+_0x41f0a1+'\x22':'';_0x467053=_0x53b601(0x11b)+_0x360f2b+'\x22'+_0x5df687+'\x20}';}const _0x50754c=_0x5cccef?_0x5cccef+_0x53b601(0x129):_0x53b601(0x11e),_0x4a0c2e=_0x5cccef?_0x5cccef+_0x53b601(0x12a):_0x53b601(0x137),_0xd12629=formatDataset(_0x2273eb),_0x1ed0e8={};_0xd12629[_0x53b601(0x138)](_0x39dbaa=>{const _0x1c0a98=_0x53b601,_0x104184=_0x39dbaa[_0x1c0a98(0x13f)][_0x1c0a98(0x12c)](/Api$/,''),_0x1fca8d=_0x104184['charAt'](0x0)[_0x1c0a98(0x120)]()+_0x104184[_0x1c0a98(0x13c)](0x1);_0x1ed0e8[_0x1fca8d]={'tableName':_0x39dbaa[_0x1c0a98(0x10f)],'datasetCode':_0x39dbaa[_0x1c0a98(0x133)],'name':_0x39dbaa[_0x1c0a98(0x12b)]||''};});const _0x4c2820=fileURLToPath(import.meta[_0x53b601(0x122)]),_0x536b13=a8_0x2da0a9[_0x53b601(0x127)](a8_0x2da0a9[_0x53b601(0x11a)](_0x4c2820),_0x53b601(0x11f)),_0x159695=a8_0x2da0a9['join'](_0x536b13,_0x53b601(0x130)),_0x4922f1=a8_0x2da0a9[_0x53b601(0x132)](_0x159695,_0x53b601(0x123)),_0x29bce9=a8_0x2da0a9[_0x53b601(0x132)](_0x159695,'client.ts.tpl'),_0x1f8e1f=_0xbe2aaa[_0x53b601(0x115)]('/')?_0xbe2aaa[_0x53b601(0x13c)](0x0,-0x1):_0xbe2aaa;mkdirSync(_0x1f8e1f,{'recursive':!![]});const _0x378455=readFileSync(_0x4922f1,'utf8'),_0x148ba7=TemplateReplacer[_0x53b601(0x116)](_0x378455,_0x360f2b,_0x1ed0e8,Object[_0x53b601(0x124)](_0x1ed0e8)[0x0],_0x50754c,_0x721c93),_0x3eb3ee=await a8_0x11cc23[_0x53b601(0x13b)](_0x148ba7,{'parser':_0x53b601(0x11d)}),_0x4a2489=_0x1f8e1f+'/'+_0x50754c+_0x53b601(0x119);writeFileSync(_0x4a2489,_0x3eb3ee,{'encoding':'utf8'});const _0x535b0c=readFileSync(_0x29bce9,_0x53b601(0x13d)),_0x3936de=TemplateReplacer['replaceApiContent'](_0x535b0c,_0x360f2b,_0x1ed0e8,Object['keys'](_0x1ed0e8)[0x0],_0x50754c,_0x721c93,_0x467053),_0x122692=await a8_0x11cc23[_0x53b601(0x13b)](_0x3936de,{'parser':_0x53b601(0x11d)}),_0x50c0f7=_0x1f8e1f+'/'+_0x4a0c2e+_0x53b601(0x119);writeFileSync(_0x50c0f7,_0x122692,{'encoding':_0x53b601(0x13d)});const _0x8a45b7=Object[_0x53b601(0x124)](_0x1ed0e8)['length'];return logger[_0x53b601(0x114)](_0x53b601(0x13a),_0x53b601(0x11c),undefined,{'apiFile':_0x4a2489,'clientFile':_0x50c0f7,'modelCount':_0x8a45b7,'configName':_0x721c93}),{'modelCount':_0x8a45b7,'apiFilePath':_0x4a2489,'clientFilePath':_0x50c0f7,'configName':_0x721c93};}
1
+ const a8_0x111314=a8_0x2f91;(function(_0xa1e56d,_0x36fe45){const _0x5348e2=a8_0x2f91,_0x4a5178=_0xa1e56d();while(!![]){try{const _0x10c8ce=-parseInt(_0x5348e2(0x11f))/0x1+-parseInt(_0x5348e2(0x10a))/0x2*(parseInt(_0x5348e2(0x112))/0x3)+-parseInt(_0x5348e2(0x10e))/0x4+-parseInt(_0x5348e2(0x100))/0x5*(-parseInt(_0x5348e2(0x117))/0x6)+-parseInt(_0x5348e2(0x127))/0x7*(-parseInt(_0x5348e2(0x104))/0x8)+parseInt(_0x5348e2(0x115))/0x9+parseInt(_0x5348e2(0x102))/0xa*(parseInt(_0x5348e2(0x10b))/0xb);if(_0x10c8ce===_0x36fe45)break;else _0x4a5178['push'](_0x4a5178['shift']());}catch(_0x92782f){_0x4a5178['push'](_0x4a5178['shift']());}}}(a8_0x283f,0xea2e1));function a8_0x283f(){const _0x1289c9=['api.ts.tpl','../..','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','app','92OIaGCp','78199qEADmg','\x22\x20}','apiFucName','496248xIpowb','join','length','-client','3117VJHgYS','resolve','./src/api/','4183731sQsevh','replace','11459238btRMdS','client','slice','utf8','client.ts.tpl','success','code','online','1912562vaNcMv','.ts','env','{\x20apiConfigName:\x20\x22','keys','name',',\x20env:\x20\x22','CONFIG_NAMES.DEFAULT','994TKPiCS','replaceApiContent','-api','api','string','init-api','url','5KKCSzh','format','390XwFJfl','{\x20apiConfigName:\x20','22064cdOPod','tableName'];a8_0x283f=function(){return _0x1289c9;};return a8_0x283f();}import a8_0x3ff686 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a8_0x74ce64 from'node:path';function a8_0x2f91(_0x4ebc8f,_0x5478b2){const _0x283f67=a8_0x283f();return a8_0x2f91=function(_0x2f9141,_0x5a4c6c){_0x2f9141=_0x2f9141-0xfd;let _0x2dcaf8=_0x283f67[_0x2f9141];return _0x2dcaf8;},a8_0x2f91(_0x4ebc8f,_0x5478b2);}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(_0x4cefd2,_0x405f7c='',_0x5755c2,_0x5a18a2=![],_0x5d7d6a,_0x14b014=a8_0x111314(0x114)){const _0x30e6bf=a8_0x111314,_0x5c7843=readConfig(),_0xcde37d=_0x5755c2||_0x5c7843?.[_0x30e6bf(0x109)];if(typeof _0xcde37d!=='string'||!_0xcde37d)throw new Error(_0x30e6bf(0x108));const _0x5eca50=_0x5a18a2?_0x30e6bf(0x126):'\x22'+_0xcde37d+'\x22',_0x20af71=typeof _0x5c7843[_0x30e6bf(0x121)]===_0x30e6bf(0xfd)?_0x5c7843[_0x30e6bf(0x121)]:undefined,_0x8dcb14=_0x5d7d6a||_0x20af71||_0x30e6bf(0x11e),_0x473e94=_0x8dcb14!=='online';let _0x30695d;if(_0x5a18a2)_0x473e94?_0x30695d=_0x30e6bf(0x103)+_0x5eca50+_0x30e6bf(0x125)+_0x8dcb14+_0x30e6bf(0x10c):_0x30695d='';else{const _0x47e1ce=_0x473e94?_0x30e6bf(0x125)+_0x8dcb14+'\x22':'';_0x30695d=_0x30e6bf(0x122)+_0xcde37d+'\x22'+_0x47e1ce+'\x20}';}const _0x2c5fea=_0x405f7c?_0x405f7c+_0x30e6bf(0x129):_0x30e6bf(0x12a),_0x16b62a=_0x405f7c?_0x405f7c+_0x30e6bf(0x111):_0x30e6bf(0x118),_0x38ea6c=formatDataset(_0x4cefd2),_0x72db94={};_0x38ea6c['forEach'](_0xd0c55a=>{const _0x16276c=_0x30e6bf,_0x5e8794=_0xd0c55a[_0x16276c(0x10d)][_0x16276c(0x116)](/Api$/,''),_0x5a8f57=_0x5e8794['charAt'](0x0)['toUpperCase']()+_0x5e8794[_0x16276c(0x119)](0x1);_0x72db94[_0x5a8f57]={'tableName':_0xd0c55a[_0x16276c(0x105)],'datasetCode':_0xd0c55a[_0x16276c(0x11d)],'name':_0xd0c55a[_0x16276c(0x124)]||''};});const _0x17a25e=fileURLToPath(import.meta[_0x30e6bf(0xff)]),_0xc5e21d=a8_0x74ce64[_0x30e6bf(0x113)](a8_0x74ce64['dirname'](_0x17a25e),_0x30e6bf(0x107)),_0x34f2de=a8_0x74ce64[_0x30e6bf(0x10f)](_0xc5e21d,'templates/generate-api'),_0x743f5b=a8_0x74ce64[_0x30e6bf(0x10f)](_0x34f2de,_0x30e6bf(0x106)),_0x461917=a8_0x74ce64[_0x30e6bf(0x10f)](_0x34f2de,_0x30e6bf(0x11b)),_0x276b84=_0x14b014['endsWith']('/')?_0x14b014['slice'](0x0,-0x1):_0x14b014;mkdirSync(_0x276b84,{'recursive':!![]});const _0x59e613=readFileSync(_0x743f5b,'utf8'),_0x261bed=TemplateReplacer[_0x30e6bf(0x128)](_0x59e613,_0xcde37d,_0x72db94,Object[_0x30e6bf(0x123)](_0x72db94)[0x0],_0x2c5fea,_0x5eca50),_0x5edd4e=await a8_0x3ff686[_0x30e6bf(0x101)](_0x261bed,{'parser':'typescript'}),_0x13962e=_0x276b84+'/'+_0x2c5fea+_0x30e6bf(0x120);writeFileSync(_0x13962e,_0x5edd4e,{'encoding':_0x30e6bf(0x11a)});const _0x3ac419=readFileSync(_0x461917,'utf8'),_0x5833ee=TemplateReplacer[_0x30e6bf(0x128)](_0x3ac419,_0xcde37d,_0x72db94,Object[_0x30e6bf(0x123)](_0x72db94)[0x0],_0x2c5fea,_0x5eca50,_0x30695d),_0x28939a=await a8_0x3ff686[_0x30e6bf(0x101)](_0x5833ee,{'parser':'typescript'}),_0xa5fc1c=_0x276b84+'/'+_0x16b62a+_0x30e6bf(0x120);writeFileSync(_0xa5fc1c,_0x28939a,{'encoding':_0x30e6bf(0x11a)});const _0x29b738=Object[_0x30e6bf(0x123)](_0x72db94)[_0x30e6bf(0x110)];return logger[_0x30e6bf(0x11c)](_0x30e6bf(0xfe),'API\x20文件生成成功!',undefined,{'apiFile':_0x13962e,'clientFile':_0xa5fc1c,'modelCount':_0x29b738,'configName':_0x5eca50}),{'modelCount':_0x29b738,'apiFilePath':_0x13962e,'clientFilePath':_0xa5fc1c,'configName':_0x5eca50};}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0x4206a4,_0x59e9f7){const _0x207ef3=a9_0x7775,_0xca6eca=_0x4206a4();while(!![]){try{const _0xa96f01=parseInt(_0x207ef3(0xdf))/0x1+-parseInt(_0x207ef3(0xe2))/0x2+-parseInt(_0x207ef3(0xec))/0x3+parseInt(_0x207ef3(0xd4))/0x4+parseInt(_0x207ef3(0xd1))/0x5+parseInt(_0x207ef3(0xd3))/0x6*(parseInt(_0x207ef3(0xe4))/0x7)+parseInt(_0x207ef3(0xea))/0x8;if(_0xa96f01===_0x59e9f7)break;else _0xca6eca['push'](_0xca6eca['shift']());}catch(_0x17642e){_0xca6eca['push'](_0xca6eca['shift']());}}}(a9_0xf4e3,0x5d7a0));function a9_0xf4e3(){const _0x365a68=['×\x20未配置\x20AppCode','input','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a','\x1b[0m','flags','\x20\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','200213RYYRbb','error','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','1362376fLdVcU','\x20\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档','7IBFdIE','\x1b[90m*\x20使用配置的应用AppCode:\x20','❌\x20错误:不再支持位置参数方式','exit','help','output','1711952YHLuVJ','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','2153073dkjfpk','log','请使用\x20--appcode\x20参数,例如:','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','1533355OHiNQs','pull','2011236GSFdWG','2902700ueGgiO','env','doc'];a9_0xf4e3=function(){return _0x365a68;};return a9_0xf4e3();}import{jsx as a9_0x5a569b}from'react/jsx-runtime';import{render}from'ink';function a9_0x7775(_0x455010,_0x381640){const _0xf4e371=a9_0xf4e3();return a9_0x7775=function(_0x77750f,_0x21857b){_0x77750f=_0x77750f-0xcf;let _0x6f511=_0xf4e371[_0x77750f];return _0x6f511;},a9_0x7775(_0x455010,_0x381640);}import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x29aa52){const _0x6075bd=a9_0x7775,_0x1f67ae=_0x29aa52[_0x6075bd(0xd8)][0x1];if(_0x29aa52[_0x6075bd(0xdb)][_0x6075bd(0xe8)]){console[_0x6075bd(0xed)](_0x6075bd(0xd9));return;}if(_0x1f67ae===_0x6075bd(0xd2)){_0x29aa52[_0x6075bd(0xd8)][0x2]&&(console[_0x6075bd(0xe0)](_0x6075bd(0xe6)),console[_0x6075bd(0xed)](_0x6075bd(0xee)),console['log'](_0x6075bd(0xf2)+_0x29aa52['input'][0x2]),process['exit'](0x1));const _0x570034=getConfigAppCode();let _0x1105cc=_0x29aa52[_0x6075bd(0xdb)]['appcode'];const _0x4b5d4a=typeof _0x29aa52['flags'][_0x6075bd(0xd5)]==='string'?_0x29aa52[_0x6075bd(0xdb)][_0x6075bd(0xd5)]:undefined,_0x2708a2=_0x29aa52['flags'][_0x6075bd(0xe9)];!_0x1105cc&&!_0x570034&&(console['error'](_0x6075bd(0xd7)),console[_0x6075bd(0xed)]('!\x20请使用以下方式之一:'),console[_0x6075bd(0xed)](_0x6075bd(0xd0)),console[_0x6075bd(0xed)](_0x6075bd(0xef)),process[_0x6075bd(0xe7)](0x1)),_0x1105cc&&_0x570034&&_0x1105cc===_0x570034&&(console[_0x6075bd(0xed)](_0x6075bd(0xe5)+_0x1105cc+_0x6075bd(0xda)),console[_0x6075bd(0xed)](_0x6075bd(0xeb)),_0x1105cc=undefined),render(a9_0x5a569b(ApiPullUI,{'appCode':_0x1105cc,'env':_0x4b5d4a,'output':_0x2708a2}));}else{if(_0x1f67ae===_0x6075bd(0xd6)){_0x29aa52['input'][0x2]&&(console[_0x6075bd(0xe0)](_0x6075bd(0xe6)),console[_0x6075bd(0xed)]('请使用\x20--appcode\x20参数,例如:'),console[_0x6075bd(0xed)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20'+_0x29aa52[_0x6075bd(0xd8)][0x2]),process[_0x6075bd(0xe7)](0x1));const _0x184b7d=getConfigAppCode();let _0x41c2a7=_0x29aa52['flags']['appcode'];const _0x593e96=typeof _0x29aa52['flags'][_0x6075bd(0xd5)]==='string'?_0x29aa52['flags']['env']:undefined,_0x249eb5=_0x29aa52[_0x6075bd(0xdb)]['output'];!_0x41c2a7&&!_0x184b7d&&(console[_0x6075bd(0xe0)](_0x6075bd(0xd7)),console['log']('!\x20请使用以下方式之一:'),console[_0x6075bd(0xed)](_0x6075bd(0xd0)),console[_0x6075bd(0xed)](_0x6075bd(0xf1)),process[_0x6075bd(0xe7)](0x1)),_0x41c2a7&&_0x184b7d&&_0x41c2a7===_0x184b7d&&(console[_0x6075bd(0xed)](_0x6075bd(0xe5)+_0x41c2a7+_0x6075bd(0xda)),_0x41c2a7=undefined),render(a9_0x5a569b(ApiDocUI,{'appCode':_0x41c2a7,'env':_0x593e96,'output':_0x249eb5}));}else console[_0x6075bd(0xe0)]('Unknown\x20api\x20command:\x20'+_0x1f67ae),console[_0x6075bd(0xed)]('Available\x20commands:'),console[_0x6075bd(0xed)](_0x6075bd(0xdc)),console[_0x6075bd(0xed)](_0x6075bd(0xde)),console[_0x6075bd(0xed)](_0x6075bd(0xe1)),console[_0x6075bd(0xed)](_0x6075bd(0xcf)),console[_0x6075bd(0xed)](''),console[_0x6075bd(0xed)](_0x6075bd(0xe3)),console['log'](_0x6075bd(0xf0)),console[_0x6075bd(0xed)](_0x6075bd(0xdd)),console[_0x6075bd(0xed)]('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process['exit'](0x1);}}
1
+ (function(_0x272083,_0x277ab6){const _0x1ea955=a9_0x40c6,_0x1015a2=_0x272083();while(!![]){try{const _0x382034=parseInt(_0x1ea955(0x14d))/0x1+parseInt(_0x1ea955(0x150))/0x2*(-parseInt(_0x1ea955(0x153))/0x3)+parseInt(_0x1ea955(0x148))/0x4+-parseInt(_0x1ea955(0x13d))/0x5+-parseInt(_0x1ea955(0x140))/0x6*(parseInt(_0x1ea955(0x12e))/0x7)+-parseInt(_0x1ea955(0x12a))/0x8+parseInt(_0x1ea955(0x13a))/0x9;if(_0x382034===_0x277ab6)break;else _0x1015a2['push'](_0x1015a2['shift']());}catch(_0x5f5411){_0x1015a2['push'](_0x1015a2['shift']());}}}(a9_0x5623,0xb1e83));import{jsx as a9_0x142ba0}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';function a9_0x40c6(_0xe8181b,_0x1e8577){const _0x562325=a9_0x5623();return a9_0x40c6=function(_0x40c68f,_0x3fb2fb){_0x40c68f=_0x40c68f-0x121;let _0x35329e=_0x562325[_0x40c68f];return _0x35329e;},a9_0x40c6(_0xe8181b,_0x1e8577);}import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x2b2eaf){const _0x446dab=a9_0x40c6,_0x2b65b7=_0x2b2eaf[_0x446dab(0x14b)][0x1];if(_0x2b2eaf[_0x446dab(0x14c)][_0x446dab(0x129)]){console[_0x446dab(0x134)](_0x446dab(0x128));return;}if(_0x2b65b7===_0x446dab(0x14e)){_0x2b2eaf[_0x446dab(0x14b)][0x2]&&(console[_0x446dab(0x126)](_0x446dab(0x14f)),console[_0x446dab(0x134)](_0x446dab(0x13e)),console[_0x446dab(0x134)]('\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20'+_0x2b2eaf['input'][0x2]),process[_0x446dab(0x149)](0x1));const _0x4a40aa=getConfigAppCode();let _0x36b85f=_0x2b2eaf[_0x446dab(0x14c)][_0x446dab(0x132)];const _0x4172c2=typeof _0x2b2eaf['flags'][_0x446dab(0x123)]===_0x446dab(0x144)?_0x2b2eaf[_0x446dab(0x14c)][_0x446dab(0x123)]:undefined,_0x2f8c50=_0x2b2eaf[_0x446dab(0x14c)][_0x446dab(0x141)];!_0x36b85f&&!_0x4a40aa&&(console[_0x446dab(0x126)](_0x446dab(0x13b)),console[_0x446dab(0x134)]('!\x20请使用以下方式之一:'),console[_0x446dab(0x134)](_0x446dab(0x12f)),console['log'](_0x446dab(0x13f)),process[_0x446dab(0x149)](0x1)),_0x36b85f&&_0x4a40aa&&_0x36b85f===_0x4a40aa&&(console[_0x446dab(0x134)](_0x446dab(0x130)+_0x36b85f+_0x446dab(0x127)),console[_0x446dab(0x134)](_0x446dab(0x12d)),_0x36b85f=undefined),render(a9_0x142ba0(ApiPullUI,{'appCode':_0x36b85f,'env':_0x4172c2,'output':_0x2f8c50}));}else{if(_0x2b65b7==='doc'){_0x2b2eaf[_0x446dab(0x14b)][0x2]&&(console[_0x446dab(0x126)](_0x446dab(0x14f)),console['log'](_0x446dab(0x13e)),console[_0x446dab(0x134)](_0x446dab(0x139)+_0x2b2eaf['input'][0x2]),process[_0x446dab(0x149)](0x1));const _0x2bc5d1=getConfigAppCode();let _0x43d776=_0x2b2eaf[_0x446dab(0x14c)][_0x446dab(0x132)];const _0x477b2a=typeof _0x2b2eaf[_0x446dab(0x14c)][_0x446dab(0x123)]===_0x446dab(0x144)?_0x2b2eaf[_0x446dab(0x14c)][_0x446dab(0x123)]:undefined,_0x5985fb=_0x2b2eaf['flags'][_0x446dab(0x141)],_0x486e33=_0x2b2eaf[_0x446dab(0x14c)]['params'],_0x5ac900=_0x2b2eaf[_0x446dab(0x14c)][_0x446dab(0x122)];!_0x43d776&&!_0x2bc5d1&&(console[_0x446dab(0x126)](_0x446dab(0x13b)),console[_0x446dab(0x134)](_0x446dab(0x125)),console[_0x446dab(0x134)](_0x446dab(0x12f)),console[_0x446dab(0x134)](_0x446dab(0x152)),process[_0x446dab(0x149)](0x1));_0x43d776&&_0x2bc5d1&&_0x43d776===_0x2bc5d1&&(console['log']('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0x43d776+_0x446dab(0x127)),_0x43d776=undefined);let _0x1a46ae;if(_0x486e33)try{_0x1a46ae=JSON[_0x446dab(0x12c)](_0x486e33),(typeof _0x1a46ae!==_0x446dab(0x136)||_0x1a46ae===null||Array[_0x446dab(0x146)](_0x1a46ae))&&(console[_0x446dab(0x126)](_0x446dab(0x137)),process[_0x446dab(0x149)](0x1));}catch(_0x280083){console[_0x446dab(0x126)]('×\x20--params\x20参数不是有效的\x20JSON\x20格式'),console[_0x446dab(0x126)](_0x446dab(0x151)+(_0x280083 instanceof Error?_0x280083['message']:String(_0x280083))),process['exit'](0x1);}let _0x390993;_0x5ac900&&(_0x390993=_0x5ac900[_0x446dab(0x121)](',')[_0x446dab(0x131)](_0x4e4247=>_0x4e4247[_0x446dab(0x154)]())[_0x446dab(0x133)](_0x344322=>_0x344322[_0x446dab(0x13c)]>0x0),_0x390993['length']===0x0&&(console[_0x446dab(0x126)](_0x446dab(0x124)),process['exit'](0x1)),console[_0x446dab(0x134)]('\x1b[90m*\x20仅生成指定数据集的文档:\x20'+_0x390993[_0x446dab(0x138)](',\x20')+_0x446dab(0x127))),render(a9_0x142ba0(ApiDocUI,{'appCode':_0x43d776,'env':_0x477b2a,'output':_0x5985fb,'extraParams':_0x1a46ae,'datasetCodes':_0x390993}));}else console['error'](_0x446dab(0x12b)+_0x2b65b7),console[_0x446dab(0x134)]('Available\x20commands:'),console[_0x446dab(0x134)](_0x446dab(0x145)),console[_0x446dab(0x134)](_0x446dab(0x135)),console[_0x446dab(0x134)](_0x446dab(0x147)),console[_0x446dab(0x134)](_0x446dab(0x143)),console[_0x446dab(0x134)](''),console['log']('\x20\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档'),console['log'](_0x446dab(0x14a)),console[_0x446dab(0x134)](_0x446dab(0x142)),console['log']('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process[_0x446dab(0x149)](0x1);}}function a9_0x5623(){const _0x1e772f=['string','\x20\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','isArray','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','2458028fWmZOY','exit','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','input','flags','286073arIzPv','pull','❌\x20错误:不再支持位置参数方式','226354mbnLeD','\x20\x20错误:\x20','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','6FjTCem','trim','split','datasetcode','env','×\x20--datasetcode\x20参数不能为空','!\x20请使用以下方式之一:','error','\x1b[0m','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--datasetcode\x20<codes>\x20指定要生成文档的数据集代码(多个用逗号分隔,仅\x20doc\x20命令)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成所有数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20只生成指定数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20生成多个数据集的文档\x0a','help','582128EtCZpM','Unknown\x20api\x20command:\x20','parse','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','1599941hjHiHk','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','\x1b[90m*\x20使用配置的应用AppCode:\x20','map','appcode','filter','log','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','object','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','join','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','9689535EGUZlN','×\x20未配置\x20AppCode','length','1318395MjgLzh','请使用\x20--appcode\x20参数,例如:','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','18KVzigq','output','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'];a9_0x5623=function(){return _0x1e772f;};return a9_0x5623();}