@lovrabet/cli 1.1.6 → 1.1.8

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 (45) hide show
  1. package/LICENSE +45 -0
  2. package/README.md +85 -4
  3. package/lib/add-page/input-page-router.js +1 -1
  4. package/lib/add-page/main.js +1 -1
  5. package/lib/add-page/select-page-template.js +1 -1
  6. package/lib/api/api-pull-ui.js +1 -1
  7. package/lib/api/format-dataset.js +1 -1
  8. package/lib/api/generate-api-file.js +1 -1
  9. package/lib/api/main.js +1 -1
  10. package/lib/api/pull-silent.js +1 -1
  11. package/lib/api/pull.js +1 -1
  12. package/lib/auth/auth-server-ui.js +1 -1
  13. package/lib/auth/auth-server.js +1 -1
  14. package/lib/auth/constant.js +1 -1
  15. package/lib/auth/get-cookie.js +1 -1
  16. package/lib/auth/is-session-valid.js +1 -1
  17. package/lib/auth/logout.js +1 -1
  18. package/lib/cli.js +1 -1
  19. package/lib/cmd/build-watch.js +1 -1
  20. package/lib/cmd/build.js +1 -1
  21. package/lib/cmd/logs.js +1 -1
  22. package/lib/cmd/preview.js +1 -1
  23. package/lib/cmd/start.js +1 -1
  24. package/lib/config/config-help.js +1 -1
  25. package/lib/config/main.js +1 -1
  26. package/lib/constant/domain.js +1 -1
  27. package/lib/constant/env.js +1 -1
  28. package/lib/create-app/enhanced-guided-create.js +1 -1
  29. package/lib/create-app/format-elapsed.js +1 -1
  30. package/lib/create-app/main.js +1 -1
  31. package/lib/create-app/task-finished.js +1 -1
  32. package/lib/create-app/task-loading.js +1 -1
  33. package/lib/create-app/task-running.js +1 -1
  34. package/lib/create-app/task-time.js +1 -1
  35. package/lib/create-app/use-copy-project-template.js +1 -1
  36. package/lib/create-app/use-format-code.js +1 -1
  37. package/lib/create-app/use-install-dependencies.js +1 -1
  38. package/lib/help.js +1 -1
  39. package/lib/utils/config.js +1 -1
  40. package/lib/utils/copy-directory.js +1 -1
  41. package/lib/utils/http-client.js +1 -1
  42. package/lib/utils/logger.js +1 -1
  43. package/lib/utils/router-updater.js +1 -1
  44. package/lib/utils/template-replacer.js +1 -1
  45. package/package.json +2 -2
package/LICENSE ADDED
@@ -0,0 +1,45 @@
1
+ # Lovrabet CLI 软件许可协议
2
+
3
+ 版权所有 (c) 2024-2025 Lovrabet
4
+
5
+ ## 许可范围
6
+
7
+ 本软件("Lovrabet CLI")是专有软件,由 Lovrabet 开发和维护。
8
+
9
+ ### 允许的使用
10
+
11
+ 您被授予有限的、非独占的、不可转让的许可,可以:
12
+
13
+ 1. **安装和使用** - 通过 npm 安装并在您的开发环境中使用本软件
14
+ 2. **个人和商业用途** - 在个人项目或商业项目中使用本软件
15
+ 3. **生成内容** - 使用本软件生成的代码和项目文件归您所有
16
+
17
+ ### 限制条款
18
+
19
+ 您**不得**:
20
+
21
+ 1. ❌ **修改源代码** - 不得修改、反编译、逆向工程或反汇编本软件
22
+ 2. ❌ **再分发** - 不得复制、分发、出售或转让本软件
23
+ 3. ❌ **创建衍生作品** - 不得基于本软件创建衍生产品或竞争产品
24
+ 4. ❌ **移除版权声明** - 不得移除或修改任何版权声明或商标
25
+ 5. ❌ **公开源代码** - 本软件为闭源软件,源代码不公开
26
+
27
+ ## 免责声明
28
+
29
+ 本软件按"原样"提供,不提供任何明示或暗示的保证,包括但不限于对适销性、特定用途适用性和非侵权性的保证。
30
+
31
+ 在任何情况下,作者或版权持有人均不对任何索赔、损害或其他责任负责,无论是在合同诉讼、侵权行为还是其他方面。
32
+
33
+ ## 终止
34
+
35
+ 如果您违反本许可协议的任何条款,您使用本软件的权利将自动终止。
36
+
37
+ ## 联系方式
38
+
39
+ 如有疑问或需要商业授权,请联系:
40
+ - 网站:https://www.lovrabet.com
41
+ - 邮箱:support@lovrabet.com
42
+
43
+ ---
44
+
45
+ **本软件受著作权法和国际条约保护。未经授权的复制或分发可能导致严重的民事和刑事处罚。**
package/README.md CHANGED
@@ -65,7 +65,7 @@ lovrabet start
65
65
  如果在create的时候未选择自动更新API列表,或者API已经发生变化,可以手动根据应用的appcode自动生成 API 配置:
66
66
 
67
67
  ```bash
68
- lovrabet api pull [app-code]
68
+ lovrabet api pull --appcode <app-code>
69
69
  ```
70
70
 
71
71
  ### 5. 添加页面
@@ -126,13 +126,14 @@ lovrabet add page
126
126
 
127
127
  ### API 集成
128
128
 
129
- #### `lovrabet api pull [app-code]`
129
+ #### `lovrabet api pull`
130
130
 
131
131
  拉取并生成 API 配置文件
132
132
 
133
133
  - **自动发现**: 扫描应用数据集和接口
134
134
  - **类型生成**: 自动生成 TypeScript 类型定义
135
135
  - **配置生成**: 生成 SDK 配置文件
136
+ - **可用参数**: `--appcode`、`--output`、`--env`(v1.1.7+)
136
137
 
137
138
  ### 身份认证
138
139
 
@@ -227,7 +228,7 @@ module.exports = {
227
228
  ```bash
228
229
  lovrabet create prototype-app
229
230
  cd prototype-app
230
- lovrabet api pull your-app-code
231
+ lovrabet api pull --appcode your-app-code
231
232
  lovrabet start
232
233
  ```
233
234
 
@@ -266,7 +267,7 @@ lovrabet auth
266
267
  A: 检查应用代码是否正确,确认您有该应用的访问权限:
267
268
 
268
269
  ```bash
269
- lovrabet api pull correct-app-code
270
+ lovrabet api pull --appcode correct-app-code
270
271
  ```
271
272
 
272
273
  **Q: 构建错误?**
@@ -293,10 +294,90 @@ lovrabet logs
293
294
  lovrabet logs --clear
294
295
  ```
295
296
 
297
+ ## 📝 What's New
298
+
299
+ ### v1.1.7 (2025-10-10)
300
+
301
+ **重大变更 (Breaking Changes):**
302
+
303
+ - 🔴 **`lovrabet api pull` 命令参数调整**
304
+ - ❌ **不再支持**位置参数方式(如 `lovrabet api pull my-app-code`)
305
+ - ✅ **改用** `--appcode` 参数(如 `lovrabet api pull --appcode my-app-code`)
306
+ - 迁移指南:将 `lovrabet api pull <app-code>` 改为 `lovrabet api pull --appcode <app-code>`
307
+
308
+ **新增功能 (New Features):**
309
+
310
+ - ✨ **新增 `--output` 参数** - 支持自定义 API 文件输出目录
311
+ ```bash
312
+ lovrabet api pull --output ./lib/api
313
+ ```
314
+ - ✨ **新增 `--env` 参数** - 支持指定环境拉取 API(内部使用)
315
+ ```bash
316
+ lovrabet api pull --env <env>
317
+ ```
318
+
319
+ **改进 (Improvements):**
320
+
321
+ - 📚 优化命令行帮助信息,参数说明更加清晰
322
+ - 🔧 统一命令行参数风格,所有参数均使用 `--` 前缀
323
+ - 📖 更新文档,添加版本标识和迁移说明
324
+
325
+ **使用示例:**
326
+
327
+ ```bash
328
+ # ✅ 推荐用法
329
+ lovrabet api pull # 使用配置的 appcode
330
+ lovrabet api pull --appcode my-app # 指定 appcode
331
+ lovrabet api pull --output ./lib/api # 自定义输出目录
332
+ lovrabet api pull --appcode my-app --output ./api # 组合使用
333
+
334
+ # ❌ 不再支持
335
+ lovrabet api pull my-app # 位置参数方式已废弃
336
+ ```
337
+
338
+ ---
339
+
340
+ ### v1.1.6 (2025-09-30)
341
+
342
+ **改进 (Improvements):**
343
+
344
+ - 📦 **升级模板 SDK** - 项目模板中的 SDK 升级到最新版本,支持更多特性
345
+
346
+ ---
347
+
348
+ ### v1.1.4 (2025-09-27)
349
+
350
+ **重大变更 (Breaking Changes):**
351
+
352
+ - 🔴 **统一模型配置字段命名** - 重构模型配置字段命名规范(可能影响现有配置)
353
+ - 请查阅文档更新配置文件中的字段名称
354
+
355
+ ---
356
+
296
357
  ## 📖 更多资源
297
358
 
298
359
  - [Lovrabet SDK 使用指南](https://www.npmjs.com/package/@lovrabet/sdk)
299
360
  - [示例项目](https://github.com/lovrabet-ai/sub-app-react-demo)
361
+ - [完整文档](https://docs.lovrabet.com)
362
+
363
+ ---
364
+
365
+ ## 🤝 反馈
366
+
367
+ 如遇到问题或有功能建议,欢迎提交 Issue!
368
+
369
+ ## 📄 许可证
370
+
371
+ **专有软件(Proprietary)** - 详见 [LICENSE](./LICENSE) 文件
372
+
373
+ 本软件为 Lovrabet 开放平台的专有工具:
374
+ - ✅ **允许使用** - 可以安装和使用本工具开发 Lovrabet 应用
375
+ - ✅ **生成内容归您** - 使用本工具生成的代码和项目归您所有
376
+ - ❌ **不得修改** - 不得修改、反编译或逆向工程
377
+ - ❌ **不得再分发** - 不得复制或分发本软件
378
+ - ❌ **源代码不公开** - 本软件为闭源软件
379
+
380
+ 如需商业授权或有疑问,请访问 [lovrabet.com](https://www.lovrabet.com)
300
381
 
301
382
  ---
302
383
 
@@ -1 +1 @@
1
- (function(_0x52c994,_0x107fce){const _0x2f36a7=a0_0x2567,_0x1fb418=_0x52c994();while(!![]){try{const _0x1f7dfe=parseInt(_0x2f36a7(0xe1))/0x1*(-parseInt(_0x2f36a7(0xd1))/0x2)+-parseInt(_0x2f36a7(0xd7))/0x3*(-parseInt(_0x2f36a7(0xdf))/0x4)+-parseInt(_0x2f36a7(0xda))/0x5*(-parseInt(_0x2f36a7(0xc8))/0x6)+-parseInt(_0x2f36a7(0xc7))/0x7+parseInt(_0x2f36a7(0xca))/0x8+parseInt(_0x2f36a7(0xce))/0x9+parseInt(_0x2f36a7(0xd8))/0xa;if(_0x1f7dfe===_0x107fce)break;else _0x1fb418['push'](_0x1fb418['shift']());}catch(_0x44d4aa){_0x1fb418['push'](_0x1fb418['shift']());}}}(a0_0x491e,0x2fec9));import{jsx as a0_0x42f6fe,jsxs as a0_0x3cc92e}from'react/jsx-runtime';function a0_0x2567(_0x105e07,_0x20b811){const _0x491e2b=a0_0x491e();return a0_0x2567=function(_0x256708,_0x1677e5){_0x256708=_0x256708-0xc5;let _0x43b575=_0x491e2b[_0x256708];return _0x43b575;},a0_0x2567(_0x105e07,_0x20b811);}import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x58ceb3 from'node:fs';export function InputProjectCode(_0x25cd4d){const _0x1775f4=a0_0x2567,{onSubmit:_0x6e4a9f,pagePath:_0x165251}=_0x25cd4d,[_0x42578b,_0x3cbeb9]=useState(''),[_0x5ff665,_0x453deb]=useState(''),_0x5a4471=_0x1775f4(0xc9);function _0x38c177(_0xb0e558){const _0x11c6cc=_0x1775f4;if(_0xb0e558[_0x11c6cc(0xc5)]>0x64)return{'valid':![],'message':'页面路径长度不能超过\x20100\x20个字符'};if(_0xb0e558[_0x11c6cc(0xcc)]('/')||_0xb0e558[_0x11c6cc(0xd5)]('/'))return{'valid':![],'message':_0x11c6cc(0xcd)};if(_0xb0e558[_0x11c6cc(0xcb)]('//'))return{'valid':![],'message':_0x11c6cc(0xd0)};const _0x105eac=_0xb0e558['split']('/');for(const _0xf3c095 of _0x105eac){if(!_0xf3c095)continue;const _0x13facc=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x13facc[_0x11c6cc(0xdb)](_0xf3c095))return{'valid':![],'message':_0x11c6cc(0xcf)};}return{'valid':!![]};}return useInput((_0x1e3ecd,_0x20d378)=>{const _0x13dc4d=_0x1775f4;if(_0x20d378[_0x13dc4d(0xd3)]){const _0x19f7f1=_0x42578b[_0x13dc4d(0xdd)]()||_0x5a4471;if(_0x5ff665)return;const _0x29fa93=_0x165251+'/'+_0x19f7f1;if(a0_0x58ceb3[_0x13dc4d(0xc6)](_0x29fa93)){_0x453deb(_0x13dc4d(0xd6)+_0x19f7f1+_0x13dc4d(0xe0));return;}_0x6e4a9f(_0x19f7f1),_0x3cbeb9(''),_0x453deb('');}else _0x20d378['backspace']||_0x20d378[_0x13dc4d(0xd4)]?_0x3cbeb9(_0x5a45a8=>{const _0x5bea32=_0x13dc4d,_0xbaa9b1=_0x5a45a8[_0x5bea32(0xe2)](0x0,-0x1),{valid:_0x2ada3a,message:_0x58f6cf}=_0x38c177(_0xbaa9b1);return _0x453deb(_0x2ada3a?'':_0x58f6cf||_0x5bea32(0xd9)),_0xbaa9b1;}):_0x3cbeb9(_0x1efdff=>{const _0x3fae8d=_0x13dc4d,_0x20b5f9=_0x1efdff+_0x1e3ecd,{valid:_0x20943a,message:_0x245f49}=_0x38c177(_0x20b5f9);return _0x453deb(_0x20943a?'':_0x245f49||_0x3fae8d(0xd9)),_0x20b5f9;});}),a0_0x3cc92e(Box,{'flexDirection':'column','children':[a0_0x3cc92e(Box,{'children':[a0_0x42f6fe(Text,{'color':_0x1775f4(0xdc),'children':'\x20Step2:\x20'}),a0_0x42f6fe(Text,{'children':_0x1775f4(0xd2)}),_0x42578b?a0_0x42f6fe(Text,{'color':'green','children':_0x42578b}):a0_0x42f6fe(Text,{'color':_0x1775f4(0xdc),'children':_0x5a4471}),_0x5ff665&&a0_0x3cc92e(Text,{'color':'red','children':[_0x1775f4(0xde),_0x5ff665]})]}),!_0x5ff665&&!_0x42578b&&a0_0x42f6fe(Box,{'children':a0_0x42f6fe(Text,{'color':_0x1775f4(0xdc),'children':'\x20直接回车确认,或输入自定义路由地址'})})]});}function a0_0x491e(){const _0x26e826=['trim','\x20←\x20','16itRryK','\x20已存在,请使用其他路径','372317eQxtAX','slice','length','existsSync','2587809tBHGBu','1122IlNevS','my-page','2317120AvHVrx','includes','startsWith','路径不能以\x20/\x20开头或结尾','1136601IfeDYz','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','路径不能包含连续的\x20/','2rVXGLu','页面路由地址:\x20','return','delete','endsWith','页面路径\x20','55263aWKQCG','584190UlpBZA','页面路径不合法','10435aASDkC','test','gray'];a0_0x491e=function(){return _0x26e826;};return a0_0x491e();}
1
+ (function(_0x2d9927,_0x922dcb){const _0x32993c=a0_0x3522,_0x2836ef=_0x2d9927();while(!![]){try{const _0x401f41=-parseInt(_0x32993c(0x9d))/0x1+parseInt(_0x32993c(0xa9))/0x2+parseInt(_0x32993c(0xa8))/0x3+-parseInt(_0x32993c(0x9b))/0x4+parseInt(_0x32993c(0xa7))/0x5+-parseInt(_0x32993c(0xaa))/0x6+-parseInt(_0x32993c(0x9e))/0x7*(-parseInt(_0x32993c(0xa6))/0x8);if(_0x401f41===_0x922dcb)break;else _0x2836ef['push'](_0x2836ef['shift']());}catch(_0x2d88f7){_0x2836ef['push'](_0x2836ef['shift']());}}}(a0_0x29c3,0x2bcac));import{jsx as a0_0x82848e,jsxs as a0_0x50db1b}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x44b443 from'node:fs';function a0_0x3522(_0x341bfb,_0x182aab){const _0x29c32f=a0_0x29c3();return a0_0x3522=function(_0x352285,_0x4193c6){_0x352285=_0x352285-0x94;let _0x507d4f=_0x29c32f[_0x352285];return _0x507d4f;},a0_0x3522(_0x341bfb,_0x182aab);}export function InputProjectCode(_0x3bebfb){const _0x3ae20a=a0_0x3522,{onSubmit:_0x126f22,pagePath:_0x4a6a21}=_0x3bebfb,[_0x23ae17,_0x5b3e25]=useState(''),[_0x2c54b6,_0x4ae6cc]=useState(''),_0x23997c='my-page';function _0x93f8b8(_0x4d4088){const _0x7bb17f=a0_0x3522;if(_0x4d4088['length']>0x64)return{'valid':![],'message':_0x7bb17f(0xa5)};if(_0x4d4088[_0x7bb17f(0xab)]('/')||_0x4d4088[_0x7bb17f(0xa4)]('/'))return{'valid':![],'message':_0x7bb17f(0xac)};if(_0x4d4088[_0x7bb17f(0xa3)]('//'))return{'valid':![],'message':_0x7bb17f(0x9a)};const _0x1c2bd2=_0x4d4088[_0x7bb17f(0xa2)]('/');for(const _0x3ce1f3 of _0x1c2bd2){if(!_0x3ce1f3)continue;const _0x5c0602=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x5c0602[_0x7bb17f(0x99)](_0x3ce1f3))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x342a8d,_0x518331)=>{const _0x1cd92e=a0_0x3522;if(_0x518331['return']){const _0x5a5cdc=_0x23ae17[_0x1cd92e(0xa0)]()||_0x23997c;if(_0x2c54b6)return;const _0xabdbf0=_0x4a6a21+'/'+_0x5a5cdc;if(a0_0x44b443[_0x1cd92e(0xaf)](_0xabdbf0)){_0x4ae6cc('页面路径\x20'+_0x5a5cdc+_0x1cd92e(0xae));return;}_0x126f22(_0x5a5cdc),_0x5b3e25(''),_0x4ae6cc('');}else _0x518331[_0x1cd92e(0x98)]||_0x518331[_0x1cd92e(0x94)]?_0x5b3e25(_0x2702ce=>{const _0xb7371d=_0x1cd92e,_0xdcaacc=_0x2702ce[_0xb7371d(0xad)](0x0,-0x1),{valid:_0x755181,message:_0x28c686}=_0x93f8b8(_0xdcaacc);return _0x4ae6cc(_0x755181?'':_0x28c686||_0xb7371d(0x97)),_0xdcaacc;}):_0x5b3e25(_0x72268c=>{const _0x134470=_0x72268c+_0x342a8d,{valid:_0x275619,message:_0xa0d330}=_0x93f8b8(_0x134470);return _0x4ae6cc(_0x275619?'':_0xa0d330||'页面路径不合法'),_0x134470;});}),a0_0x50db1b(Box,{'flexDirection':_0x3ae20a(0x96),'children':[a0_0x50db1b(Box,{'children':[a0_0x82848e(Text,{'color':_0x3ae20a(0x9f),'children':_0x3ae20a(0xa1)}),a0_0x82848e(Text,{'children':'页面路由地址:\x20'}),_0x23ae17?a0_0x82848e(Text,{'color':'green','children':_0x23ae17}):a0_0x82848e(Text,{'color':_0x3ae20a(0x9f),'children':_0x23997c}),_0x2c54b6&&a0_0x50db1b(Text,{'color':_0x3ae20a(0x95),'children':[_0x3ae20a(0x9c),_0x2c54b6]})]}),!_0x2c54b6&&!_0x23ae17&&a0_0x82848e(Box,{'children':a0_0x82848e(Text,{'color':'gray','children':'\x20直接回车确认,或输入自定义路由地址'})})]});}function a0_0x29c3(){const _0x3bf32c=['existsSync','delete','red','column','页面路径不合法','backspace','test','路径不能包含连续的\x20/','2468mwLQDK','\x20←\x20','278683KXSCDl','2396359sMefXZ','gray','trim','\x20Step2:\x20','split','includes','endsWith','页面路径长度不能超过\x20100\x20个字符','8wIFokk','87520HhVupi','71184iCaaBe','707482oPhJxR','1671828ZkfVXN','startsWith','路径不能以\x20/\x20开头或结尾','slice','\x20已存在,请使用其他路径'];a0_0x29c3=function(){return _0x3bf32c;};return a0_0x29c3();}
@@ -1 +1 @@
1
- const a1_0x420915=a1_0x4ec5;(function(_0x181056,_0x5d292d){const _0x480478=a1_0x4ec5,_0x1fe931=_0x181056();while(!![]){try{const _0x3380e2=-parseInt(_0x480478(0x183))/0x1+parseInt(_0x480478(0x17c))/0x2+parseInt(_0x480478(0x17e))/0x3+parseInt(_0x480478(0x188))/0x4+-parseInt(_0x480478(0x18c))/0x5*(parseInt(_0x480478(0x182))/0x6)+-parseInt(_0x480478(0x18d))/0x7+parseInt(_0x480478(0x187))/0x8;if(_0x3380e2===_0x5d292d)break;else _0x1fe931['push'](_0x1fe931['shift']());}catch(_0x21769b){_0x1fe931['push'](_0x1fe931['shift']());}}}(a1_0x3063,0xef726));import{jsx as a1_0x426fdf,jsxs as a1_0x3339cc,Fragment as a1_0x8e25ae}from'react/jsx-runtime';function a1_0x4ec5(_0x17b326,_0x214132){const _0x306340=a1_0x3063();return a1_0x4ec5=function(_0x4ec5cf,_0x371900){_0x4ec5cf=_0x4ec5cf-0x16d;let _0x2b1aa3=_0x306340[_0x4ec5cf];return _0x2b1aa3;},a1_0x4ec5(_0x17b326,_0x214132);}import{fileURLToPath}from'node:url';import a1_0x4835f0 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';function a1_0x3063(){const _0x3f6de2=['now','正在创建页面,请稍候…','../../templates/pages','18150856sGVGwN','5266292aXSwOR','已选择页面模板\x20','finally','src','1722590zfWzRd','13197366JZtGpQ','info','dirname','\x20*\x20页面文件已创建,可直接通过路由访问','gray','setLogPath','已输入的页面路由\x20','\x20*\x20页面路径:\x20','url','add-page','processTemplate','\x20Step2:\x20','cyan','join','\x20Step1:\x20','页面添加失败:\x20','pages','486174qdIrRx','开始添加页面:\x20','1590942qHbLaQ','页面添加成功:\x20','green','column','12dWIJAR','803683SQCudK'];a1_0x3063=function(){return _0x3f6de2;};return a1_0x3063();}import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x4835f0[a1_0x420915(0x16d)](fileURLToPath(import.meta[a1_0x420915(0x173)])),pageTemplateDir=a1_0x4835f0['resolve'](__dirname,a1_0x420915(0x186)),projectDir=process['cwd']();export const AddPage=()=>{const _0x1da9ec=a1_0x420915,{exit:_0x4aef54}=useApp(),[_0x38d218,_0xef5c3e]=useState(''),[_0x359ad1,_0x13bcb1]=useState(''),[_0x30c92a,_0x3fc62a]=useState(![]),[_0x28272c,_0x5d957c]=useState(![]),_0x5df2d1=a1_0x4835f0[_0x1da9ec(0x178)](projectDir,_0x1da9ec(0x18b),_0x1da9ec(0x17b)),_0x2b1d23=a1_0x4835f0[_0x1da9ec(0x178)](_0x5df2d1,_0x359ad1),_0xdfc9f3=a1_0x4835f0['join']('src',_0x1da9ec(0x17b),_0x359ad1);useEffect(()=>{const _0x5729ea=_0x1da9ec,_0x4bb0e3=a1_0x4835f0['resolve'](pageTemplateDir,_0x38d218);if(_0x38d218&&_0x359ad1){_0x3fc62a(!![]),logger[_0x5729ea(0x170)](process['cwd']());const _0x4c1fc9=Date[_0x5729ea(0x184)]();logger[_0x5729ea(0x18e)]('add-page',_0x5729ea(0x17d)+_0x359ad1,{'template':_0x38d218,'targetPath':_0xdfc9f3}),TemplateReplacer[_0x5729ea(0x175)](_0x4bb0e3,a1_0x4835f0[_0x5729ea(0x178)](_0x5df2d1,_0x359ad1),_0x359ad1,_0x38d218)['then'](()=>{const _0x137c3c=_0x5729ea,_0x2d305f=Date[_0x137c3c(0x184)]()-_0x4c1fc9;logger['success']('add-page',_0x137c3c(0x17f)+_0x359ad1,_0x2d305f,{'template':_0x38d218,'targetPath':_0xdfc9f3,'routePath':_0x359ad1}),_0x5d957c(!![]);})['catch'](_0x565d8d=>{const _0xff61ec=_0x5729ea,_0x5c131e=Date[_0xff61ec(0x184)]()-_0x4c1fc9;logger['error'](_0xff61ec(0x174),_0xff61ec(0x17a)+_0x359ad1,{'template':_0x38d218,'targetPath':_0xdfc9f3,'error':_0x565d8d instanceof Error?_0x565d8d['message']:String(_0x565d8d),'duration':_0x5c131e});})[_0x5729ea(0x18a)](()=>{_0x3fc62a(![]);});}},[_0x38d218,_0x359ad1]),useEffect(()=>{_0x28272c&&setTimeout(()=>{_0x4aef54();});},[_0x28272c]);if(_0x38d218)return a1_0x3339cc(Box,{'flexDirection':_0x1da9ec(0x181),'paddingY':0x1,'children':[a1_0x3339cc(Box,{'children':[a1_0x426fdf(Text,{'color':'gray','children':_0x1da9ec(0x179)}),a1_0x426fdf(Text,{'children':_0x1da9ec(0x189)}),a1_0x426fdf(Text,{'color':_0x1da9ec(0x180),'children':_0x38d218})]}),_0x359ad1?a1_0x3339cc(Box,{'children':[a1_0x426fdf(Text,{'color':'gray','children':_0x1da9ec(0x176)}),a1_0x426fdf(Text,{'children':_0x1da9ec(0x171)}),a1_0x426fdf(Text,{'color':'green','children':_0x359ad1})]}):a1_0x426fdf(InputProjectCode,{'pagePath':_0x2b1d23,'onSubmit':_0x13bcb1}),_0x359ad1&&_0x30c92a?a1_0x3339cc(Box,{'marginTop':0x1,'children':[a1_0x426fdf(Box,{'width':'4'}),a1_0x426fdf(Text,{'children':_0x1da9ec(0x185)})]}):null,_0x28272c?a1_0x3339cc(a1_0x8e25ae,{'children':[a1_0x426fdf(Box,{'marginTop':0x1,'children':a1_0x426fdf(Text,{'color':'gray','children':'\x20*\x20页面创建成功!'})}),a1_0x3339cc(Box,{'children':[a1_0x426fdf(Text,{'color':'gray','children':_0x1da9ec(0x172)}),a1_0x426fdf(Text,{'color':'green','children':_0xdfc9f3})]}),a1_0x3339cc(Box,{'children':[a1_0x426fdf(Text,{'color':_0x1da9ec(0x16f),'children':'\x20*\x20路由地址:\x20'}),a1_0x3339cc(Text,{'color':_0x1da9ec(0x180),'children':['/',_0x359ad1]})]}),a1_0x426fdf(Box,{'marginTop':0x1,'children':a1_0x426fdf(Text,{'color':_0x1da9ec(0x177),'children':_0x1da9ec(0x16e)})})]}):null]});return a1_0x426fdf(SelectPageTemplate,{'onSelect':_0xef5c3e});};
1
+ const a1_0x598a23=a1_0x2015;(function(_0x14a8bf,_0x244b41){const _0x179c8a=a1_0x2015,_0x15e9aa=_0x14a8bf();while(!![]){try{const _0x1e6209=parseInt(_0x179c8a(0x184))/0x1+parseInt(_0x179c8a(0x181))/0x2*(parseInt(_0x179c8a(0x189))/0x3)+parseInt(_0x179c8a(0x197))/0x4*(parseInt(_0x179c8a(0x196))/0x5)+-parseInt(_0x179c8a(0x180))/0x6*(parseInt(_0x179c8a(0x183))/0x7)+parseInt(_0x179c8a(0x195))/0x8+parseInt(_0x179c8a(0x18c))/0x9+parseInt(_0x179c8a(0x19b))/0xa*(-parseInt(_0x179c8a(0x190))/0xb);if(_0x1e6209===_0x244b41)break;else _0x15e9aa['push'](_0x15e9aa['shift']());}catch(_0x4e91a1){_0x15e9aa['push'](_0x15e9aa['shift']());}}}(a1_0x76f4,0xb60d7));import{jsx as a1_0x29c919,jsxs as a1_0xc7d44c,Fragment as a1_0x126c0e}from'react/jsx-runtime';function a1_0x2015(_0x52786f,_0x827f6b){const _0x76f435=a1_0x76f4();return a1_0x2015=function(_0x20158e,_0x2f9ceb){_0x20158e=_0x20158e-0x176;let _0x447216=_0x76f435[_0x20158e];return _0x447216;},a1_0x2015(_0x52786f,_0x827f6b);}import{fileURLToPath}from'node:url';import a1_0x5ca495 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';function a1_0x76f4(){const _0x5508e3=['success','30MwameO','processTemplate','pages','7976826uMtOsZ','\x20*\x20页面文件已创建,可直接通过路由访问','url','\x20*\x20页面创建成功!','52657WBSdOp','已输入的页面路由\x20','cyan','src','gray','1274744UmDkmc','15ealYLV','628244DZmGYy','catch','join','resolve','1600KjzeiP','then','\x20Step1:\x20','setLogPath','cwd','\x20*\x20页面路径:\x20','dirname','green','error','now','正在创建页面,请稍候…','\x20Step2:\x20','info','6WBTobp','60952xERktm','已选择页面模板\x20','9241099qfcabv','1010164WMLPrP','finally','add-page','开始添加页面:\x20'];a1_0x76f4=function(){return _0x5508e3;};return a1_0x76f4();}import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x5ca495[a1_0x598a23(0x179)](fileURLToPath(import.meta[a1_0x598a23(0x18e)])),pageTemplateDir=a1_0x5ca495[a1_0x598a23(0x19a)](__dirname,'../../templates/pages'),projectDir=process[a1_0x598a23(0x177)]();export const AddPage=()=>{const _0x31b3bd=a1_0x598a23,{exit:_0x1bf321}=useApp(),[_0x1804bc,_0x1ced09]=useState(''),[_0x5bc1b8,_0x2fed51]=useState(''),[_0xf9f204,_0x4758c7]=useState(![]),[_0x4a513e,_0x5d0ef0]=useState(![]),_0x4e4109=a1_0x5ca495['join'](projectDir,'src','pages'),_0x49d363=a1_0x5ca495[_0x31b3bd(0x199)](_0x4e4109,_0x5bc1b8),_0x591956=a1_0x5ca495[_0x31b3bd(0x199)](_0x31b3bd(0x193),_0x31b3bd(0x18b),_0x5bc1b8);useEffect(()=>{const _0x48b771=_0x31b3bd,_0x3d859d=a1_0x5ca495[_0x48b771(0x19a)](pageTemplateDir,_0x1804bc);if(_0x1804bc&&_0x5bc1b8){_0x4758c7(!![]),logger[_0x48b771(0x176)](process['cwd']());const _0x70fd8d=Date[_0x48b771(0x17c)]();logger[_0x48b771(0x17f)](_0x48b771(0x186),_0x48b771(0x187)+_0x5bc1b8,{'template':_0x1804bc,'targetPath':_0x591956}),TemplateReplacer[_0x48b771(0x18a)](_0x3d859d,a1_0x5ca495[_0x48b771(0x199)](_0x4e4109,_0x5bc1b8),_0x5bc1b8,_0x1804bc)[_0x48b771(0x19c)](()=>{const _0x25a5e7=_0x48b771,_0x573783=Date[_0x25a5e7(0x17c)]()-_0x70fd8d;logger[_0x25a5e7(0x188)](_0x25a5e7(0x186),'页面添加成功:\x20'+_0x5bc1b8,_0x573783,{'template':_0x1804bc,'targetPath':_0x591956,'routePath':_0x5bc1b8}),_0x5d0ef0(!![]);})[_0x48b771(0x198)](_0x15f190=>{const _0x2a387a=_0x48b771,_0x3eb106=Date[_0x2a387a(0x17c)]()-_0x70fd8d;logger[_0x2a387a(0x17b)]('add-page','页面添加失败:\x20'+_0x5bc1b8,{'template':_0x1804bc,'targetPath':_0x591956,'error':_0x15f190 instanceof Error?_0x15f190['message']:String(_0x15f190),'duration':_0x3eb106});})[_0x48b771(0x185)](()=>{_0x4758c7(![]);});}},[_0x1804bc,_0x5bc1b8]),useEffect(()=>{_0x4a513e&&setTimeout(()=>{_0x1bf321();});},[_0x4a513e]);if(_0x1804bc)return a1_0xc7d44c(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0xc7d44c(Box,{'children':[a1_0x29c919(Text,{'color':_0x31b3bd(0x194),'children':_0x31b3bd(0x19d)}),a1_0x29c919(Text,{'children':_0x31b3bd(0x182)}),a1_0x29c919(Text,{'color':'green','children':_0x1804bc})]}),_0x5bc1b8?a1_0xc7d44c(Box,{'children':[a1_0x29c919(Text,{'color':'gray','children':_0x31b3bd(0x17e)}),a1_0x29c919(Text,{'children':_0x31b3bd(0x191)}),a1_0x29c919(Text,{'color':'green','children':_0x5bc1b8})]}):a1_0x29c919(InputProjectCode,{'pagePath':_0x49d363,'onSubmit':_0x2fed51}),_0x5bc1b8&&_0xf9f204?a1_0xc7d44c(Box,{'marginTop':0x1,'children':[a1_0x29c919(Box,{'width':'4'}),a1_0x29c919(Text,{'children':_0x31b3bd(0x17d)})]}):null,_0x4a513e?a1_0xc7d44c(a1_0x126c0e,{'children':[a1_0x29c919(Box,{'marginTop':0x1,'children':a1_0x29c919(Text,{'color':_0x31b3bd(0x194),'children':_0x31b3bd(0x18f)})}),a1_0xc7d44c(Box,{'children':[a1_0x29c919(Text,{'color':_0x31b3bd(0x194),'children':_0x31b3bd(0x178)}),a1_0x29c919(Text,{'color':_0x31b3bd(0x17a),'children':_0x591956})]}),a1_0xc7d44c(Box,{'children':[a1_0x29c919(Text,{'color':'gray','children':'\x20*\x20路由地址:\x20'}),a1_0xc7d44c(Text,{'color':'green','children':['/',_0x5bc1b8]})]}),a1_0x29c919(Box,{'marginTop':0x1,'children':a1_0x29c919(Text,{'color':_0x31b3bd(0x192),'children':_0x31b3bd(0x18d)})})]}):null]});return a1_0x29c919(SelectPageTemplate,{'onSelect':_0x1ced09});};
@@ -1 +1 @@
1
- (function(_0x165ef6,_0xee9407){const _0x533c04=a2_0xb34b,_0x7f5ca6=_0x165ef6();while(!![]){try{const _0x5415a6=-parseInt(_0x533c04(0xa8))/0x1*(parseInt(_0x533c04(0xa1))/0x2)+parseInt(_0x533c04(0x9a))/0x3+parseInt(_0x533c04(0xa5))/0x4+-parseInt(_0x533c04(0x9f))/0x5*(parseInt(_0x533c04(0xa4))/0x6)+parseInt(_0x533c04(0x98))/0x7+-parseInt(_0x533c04(0x99))/0x8+parseInt(_0x533c04(0xaa))/0x9*(parseInt(_0x533c04(0xb1))/0xa);if(_0x5415a6===_0xee9407)break;else _0x7f5ca6['push'](_0x7f5ca6['shift']());}catch(_0x15917b){_0x7f5ca6['push'](_0x7f5ca6['shift']());}}}(a2_0x2367,0x8fca6));import{jsx as a2_0x50d0a4,jsxs as a2_0x320352}from'react/jsx-runtime';function a2_0xb34b(_0x4d1b45,_0x20d945){const _0x23673b=a2_0x2367();return a2_0xb34b=function(_0xb34b0e,_0x1293c6){_0xb34b0e=_0xb34b0e-0x97;let _0x3fc16f=_0x23673b[_0xb34b0e];return _0x3fc16f;},a2_0xb34b(_0x4d1b45,_0x20d945);}import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';function a2_0x2367(){const _0xf32c92=['error','localeCompare','\x20\x20\x20\x20\x20\x20>\x20','blank','resolve','3184314mypOrr','6530440bGzDCy','2075340vlImwt','sdk-fetch','gray','\x20\x20\x20\x20\x20\x20\x20\x20','label','947225FkmHYm','获取模板列表失败:','2iYcWAu','url','isDirectory','6WLZqij','974516iRLnhJ','downArrow','onSelect','203956Ioizla','templates/pages','3675249IbmDBX','length','green','map','join','filter','dirname','10HJodeC','return','\x20Step1:\x20'];a2_0x2367=function(){return _0xf32c92;};return a2_0x2367();}import{readdir}from'node:fs/promises';import a2_0x37889b from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x5e3050=a2_0xb34b;try{const _0x4bb3e0=fileURLToPath(import.meta[_0x5e3050(0xa2)]),_0x66cc13=a2_0x37889b[_0x5e3050(0x97)](a2_0x37889b[_0x5e3050(0xb0)](_0x4bb3e0),'../..'),_0x3459a2=a2_0x37889b[_0x5e3050(0xae)](_0x66cc13,_0x5e3050(0xa9)),_0x56f648=await readdir(_0x3459a2,{'withFileTypes':!![]}),_0x5de7ee=_0x56f648[_0x5e3050(0xaf)](_0x1a8861=>_0x1a8861[_0x5e3050(0xa3)]())[_0x5e3050(0xad)](_0x4d14c2=>({'label':_0x4d14c2['name']}))['sort']((_0x1181ae,_0x5e78a7)=>_0x1181ae[_0x5e3050(0x9e)][_0x5e3050(0xb5)](_0x5e78a7[_0x5e3050(0x9e)]));return _0x5de7ee;}catch(_0x4d64e2){return console[_0x5e3050(0xb4)](_0x5e3050(0xa0),_0x4d64e2),[{'label':_0x5e3050(0xb7)},{'label':_0x5e3050(0x9b)}];}}export function SelectPageTemplate(_0x607a6b){const _0x13f3a2=a2_0xb34b,[_0x5e736f,_0x4e3d79]=useState(0x0),[_0x20a94a,_0x3d6fdd]=useState([]),[_0x557a84,_0x44bd73]=useState(!![]);useEffect(()=>{async function _0xb00b8b(){const _0x476451=await getTemplateList();_0x3d6fdd(_0x476451),_0x44bd73(![]);}_0xb00b8b();},[]),useInput((_0x3bb38c,_0x1b1f6a)=>{const _0x5d216b=a2_0xb34b;if(_0x557a84)return;if(_0x1b1f6a[_0x5d216b(0xb2)]){const _0x30467a=_0x20a94a[_0x5e736f];_0x30467a&&_0x607a6b[_0x5d216b(0xa7)](_0x30467a[_0x5d216b(0x9e)]);}_0x1b1f6a['upArrow']&&_0x4e3d79(_0xead3b1=>_0xead3b1===0x0?_0x20a94a[_0x5d216b(0xab)]-0x1:_0xead3b1-0x1),_0x1b1f6a[_0x5d216b(0xa6)]&&_0x4e3d79(_0x2b98cd=>_0x2b98cd===_0x20a94a[_0x5d216b(0xab)]-0x1?0x0:_0x2b98cd+0x1);});if(_0x557a84)return a2_0x50d0a4(Box,{'flexDirection':'column','paddingY':0x1,'children':a2_0x320352(Box,{'children':[a2_0x50d0a4(Text,{'color':_0x13f3a2(0x9c),'children':_0x13f3a2(0xb3)}),a2_0x50d0a4(Text,{'children':'正在加载页面模板...'})]})});return a2_0x320352(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x320352(Box,{'children':[a2_0x50d0a4(Text,{'color':_0x13f3a2(0x9c),'children':_0x13f3a2(0xb3)}),a2_0x50d0a4(Text,{'children':'请选择您要创建的页面模板'})]}),_0x20a94a[_0x13f3a2(0xad)]((_0x50f4eb,_0x2d904)=>{const _0xbcce74=_0x13f3a2,_0x3bc0eb=_0x2d904===_0x5e736f,_0x14865c=_0x3bc0eb?_0xbcce74(0xb6)+_0x50f4eb[_0xbcce74(0x9e)]:_0xbcce74(0x9d)+_0x50f4eb[_0xbcce74(0x9e)];return a2_0x50d0a4(Box,{'children':a2_0x50d0a4(Text,{'color':_0x3bc0eb?_0xbcce74(0xac):undefined,'children':_0x14865c})},_0x14865c);})]});}
1
+ function a2_0x38b2(){const _0x48eace=['blank','42RZQply','resolve','322662WRdiuQ','label','isDirectory','484588YBUqOO','7582120avcbwb','column','正在加载页面模板...','803446JBLanE','10396449vuClzl','join','sort','dirname','3949365JOufaV','gray','\x20Step1:\x20','map','downArrow','14wXtzdJ','请选择您要创建的页面模板','1544132pdmJAA','length','templates/pages','url'];a2_0x38b2=function(){return _0x48eace;};return a2_0x38b2();}(function(_0x54e65d,_0x6e906a){const _0x5afba7=a2_0x32f1,_0x55ed53=_0x54e65d();while(!![]){try{const _0x8bc6c8=-parseInt(_0x5afba7(0x9d))/0x1+parseInt(_0x5afba7(0x91))/0x2*(-parseInt(_0x5afba7(0x9a))/0x3)+-parseInt(_0x5afba7(0x93))/0x4+-parseInt(_0x5afba7(0x8c))/0x5+-parseInt(_0x5afba7(0x98))/0x6*(-parseInt(_0x5afba7(0x87))/0x7)+parseInt(_0x5afba7(0x9e))/0x8+parseInt(_0x5afba7(0x88))/0x9;if(_0x8bc6c8===_0x6e906a)break;else _0x55ed53['push'](_0x55ed53['shift']());}catch(_0x28ec0a){_0x55ed53['push'](_0x55ed53['shift']());}}}(a2_0x38b2,0x785c8));import{jsx as a2_0x4a4b8a,jsxs as a2_0x42faa1}from'react/jsx-runtime';import{useState,useEffect}from'react';function a2_0x32f1(_0x2011f7,_0x5bfe99){const _0x38b29f=a2_0x38b2();return a2_0x32f1=function(_0x32f181,_0x5984cd){_0x32f181=_0x32f181-0x87;let _0x25c52b=_0x38b29f[_0x32f181];return _0x25c52b;},a2_0x32f1(_0x2011f7,_0x5bfe99);}import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x122cca from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x1caff1=a2_0x32f1;try{const _0x279a67=fileURLToPath(import.meta[_0x1caff1(0x96)]),_0x615297=a2_0x122cca[_0x1caff1(0x99)](a2_0x122cca[_0x1caff1(0x8b)](_0x279a67),'../..'),_0x4e78d5=a2_0x122cca[_0x1caff1(0x89)](_0x615297,_0x1caff1(0x95)),_0x1ee479=await readdir(_0x4e78d5,{'withFileTypes':!![]}),_0x1b097b=_0x1ee479['filter'](_0x291c88=>_0x291c88[_0x1caff1(0x9c)]())[_0x1caff1(0x8f)](_0x500900=>({'label':_0x500900['name']}))[_0x1caff1(0x8a)]((_0x4132b0,_0x4090c7)=>_0x4132b0[_0x1caff1(0x9b)]['localeCompare'](_0x4090c7[_0x1caff1(0x9b)]));return _0x1b097b;}catch(_0x3b3a5a){return console['error']('获取模板列表失败:',_0x3b3a5a),[{'label':_0x1caff1(0x97)},{'label':'sdk-fetch'}];}}export function SelectPageTemplate(_0x4536cd){const _0x2ab132=a2_0x32f1,[_0x5a3337,_0x4f0248]=useState(0x0),[_0x59e0db,_0x551b1c]=useState([]),[_0x5f0d79,_0x29be37]=useState(!![]);useEffect(()=>{async function _0x30ea6a(){const _0x38ef5f=await getTemplateList();_0x551b1c(_0x38ef5f),_0x29be37(![]);}_0x30ea6a();},[]),useInput((_0x2bbe88,_0x126dbc)=>{const _0x50c4c3=a2_0x32f1;if(_0x5f0d79)return;if(_0x126dbc['return']){const _0x453466=_0x59e0db[_0x5a3337];_0x453466&&_0x4536cd['onSelect'](_0x453466[_0x50c4c3(0x9b)]);}_0x126dbc['upArrow']&&_0x4f0248(_0xaba88f=>_0xaba88f===0x0?_0x59e0db[_0x50c4c3(0x94)]-0x1:_0xaba88f-0x1),_0x126dbc[_0x50c4c3(0x90)]&&_0x4f0248(_0x119082=>_0x119082===_0x59e0db[_0x50c4c3(0x94)]-0x1?0x0:_0x119082+0x1);});if(_0x5f0d79)return a2_0x4a4b8a(Box,{'flexDirection':_0x2ab132(0x9f),'paddingY':0x1,'children':a2_0x42faa1(Box,{'children':[a2_0x4a4b8a(Text,{'color':_0x2ab132(0x8d),'children':_0x2ab132(0x8e)}),a2_0x4a4b8a(Text,{'children':_0x2ab132(0xa0)})]})});return a2_0x42faa1(Box,{'flexDirection':_0x2ab132(0x9f),'paddingY':0x1,'children':[a2_0x42faa1(Box,{'children':[a2_0x4a4b8a(Text,{'color':_0x2ab132(0x8d),'children':_0x2ab132(0x8e)}),a2_0x4a4b8a(Text,{'children':_0x2ab132(0x92)})]}),_0x59e0db[_0x2ab132(0x8f)]((_0x23e954,_0x2fc5c8)=>{const _0x4b4066=_0x2ab132,_0x5673f3=_0x2fc5c8===_0x5a3337,_0x18877f=_0x5673f3?'\x20\x20\x20\x20\x20\x20>\x20'+_0x23e954[_0x4b4066(0x9b)]:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x23e954[_0x4b4066(0x9b)];return a2_0x4a4b8a(Box,{'children':a2_0x4a4b8a(Text,{'color':_0x5673f3?'green':undefined,'children':_0x18877f})},_0x18877f);})]});}
@@ -1 +1 @@
1
- (function(_0x2c99d6,_0x1f8d12){const _0x6ec581=a3_0x4cbd,_0x41a2db=_0x2c99d6();while(!![]){try{const _0x82edfa=parseInt(_0x6ec581(0x93))/0x1+parseInt(_0x6ec581(0xbc))/0x2+-parseInt(_0x6ec581(0xa1))/0x3*(parseInt(_0x6ec581(0xaf))/0x4)+-parseInt(_0x6ec581(0xca))/0x5+-parseInt(_0x6ec581(0x9d))/0x6+-parseInt(_0x6ec581(0xa2))/0x7*(parseInt(_0x6ec581(0xaa))/0x8)+parseInt(_0x6ec581(0x94))/0x9*(parseInt(_0x6ec581(0x9c))/0xa);if(_0x82edfa===_0x1f8d12)break;else _0x41a2db['push'](_0x41a2db['shift']());}catch(_0xd03f33){_0x41a2db['push'](_0x41a2db['shift']());}}}(a3_0x28c9,0x92948));import{jsx as a3_0x20400e,jsxs as a3_0x1adda2}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';function a3_0x4cbd(_0x28db94,_0x3b5db2){const _0x28c902=a3_0x28c9();return a3_0x4cbd=function(_0x4cbdc6,_0x130d67){_0x4cbdc6=_0x4cbdc6-0x8f;let _0x50921b=_0x28c902[_0x4cbdc6];return _0x50921b;},a3_0x4cbd(_0x28db94,_0x3b5db2);}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0x387cd1,env:_0x4a489c})=>{const _0x479262=a3_0x4cbd,{exit:_0x4a132e}=useApp(),[_0x25bac6,_0x507c40]=useState(![]),[_0x3b64f7,_0x2bc541]=useState(![]),[_0x268c5c,_0x59f12b]=useState(null),[_0x1e9236,_0x47bdd7]=useState(null),_0xb8d8c7=readConfig(),_0x340cfb=_0x387cd1||_0xb8d8c7?.[_0x479262(0xba)],_0x503589=typeof _0xb8d8c7?.['env']===_0x479262(0xa5)?_0xb8d8c7[_0x479262(0xc9)]:undefined,_0x3e4271=_0x4a489c||_0x503589||_0x479262(0xa9);initEnv(_0x3e4271);const _0x42ecc2=_0x387cd1&&_0x387cd1[_0x479262(0xb4)]('-')?_0x387cd1[_0x479262(0x9a)]('-')[_0x479262(0xa7)](0x1)[_0x479262(0xb8)]('-'):'',_0x7fbf52=_0x387cd1?_0x479262(0x96)+_0x340cfb:'使用配置的应用AppCode:\x20'+_0x340cfb,_0x38c265=_0x42ecc2?_0x42ecc2+_0x479262(0x90):_0x479262(0xbd),_0x138ac6=_0x42ecc2?_0x42ecc2+_0x479262(0xb5):_0x479262(0x99);useEffect(()=>{_0x507c40(!![]),_0x48efd5();},[]),useEffect(()=>{(_0x3b64f7||_0x268c5c)&&_0x4a132e();},[_0x3b64f7,_0x268c5c,_0x4a132e]);async function _0x48efd5(){const _0x4f855e=_0x479262;if(!_0x340cfb){_0x59f12b(_0x4f855e(0xb2));return;}try{logger[_0x4f855e(0xc8)](process[_0x4f855e(0x9b)]());const _0x923426=await fetch(getApiDomain()+_0x4f855e(0xbf)+_0x340cfb+_0x4f855e(0xc1),{'headers':{'Cookie':getCookie()}});if(_0x923426['ok']){const _0x2bcab1=await _0x923426[_0x4f855e(0xa3)]();if(_0x2bcab1[_0x4f855e(0xbb)]){const _0x3004f8=!_0x387cd1;await generateApiFile(_0x2bcab1[_0x4f855e(0xb6)]['tableData'],_0x42ecc2,_0x340cfb,_0x3004f8,_0x3e4271),_0x47bdd7({'api':_0x4f855e(0x9e)+_0x38c265+_0x4f855e(0xb0),'client':_0x4f855e(0x9e)+_0x138ac6+_0x4f855e(0xb0)}),_0x2bc541(!![]);}}else{if(_0x923426['status']===0x191){const _0x16c632=_0x4f855e(0xa6);logger[_0x4f855e(0xa4)](_0x4f855e(0x98),_0x16c632,{'status':_0x923426['status'],'appCode':_0x340cfb,'url':_0x923426[_0x4f855e(0xb3)]}),_0x59f12b(_0x16c632);}else{const _0x4f02c6=_0x4f855e(0x91)+_0x923426[_0x4f855e(0xc6)];try{const _0xb0ff1e=await _0x923426['text']();_0xb0ff1e?logger[_0x4f855e(0xa4)](_0x4f855e(0x98),_0x4f02c6,{'status':_0x923426[_0x4f855e(0xc6)],'appCode':_0x340cfb,'url':_0x923426['url'],'errorBody':_0xb0ff1e}):logger[_0x4f855e(0xa4)]('api-pull',_0x4f02c6,{'status':_0x923426[_0x4f855e(0xc6)],'appCode':_0x340cfb,'url':_0x923426[_0x4f855e(0xb3)]});}catch(_0x2733eb){logger[_0x4f855e(0xa4)](_0x4f855e(0x98),_0x4f02c6+_0x4f855e(0xc5),{'status':_0x923426[_0x4f855e(0xc6)],'appCode':_0x340cfb,'url':_0x923426[_0x4f855e(0xb3)],'readError':_0x2733eb instanceof Error?_0x2733eb['message']:String(_0x2733eb)});}_0x59f12b(_0x4f02c6);}}}catch(_0x399f43){const _0x1b32bf=_0x399f43 instanceof Error?_0x399f43['message']:String(_0x399f43);_0x59f12b(_0x4f855e(0xc2)+_0x1b32bf);}finally{_0x507c40(![]);}}return a3_0x1adda2(Box,{'flexDirection':_0x479262(0x8f),'children':[a3_0x1adda2(Box,{'children':[a3_0x20400e(Text,{'color':_0x479262(0xa0),'children':'*\x20'}),a3_0x20400e(Text,{'color':_0x387cd1?_0x479262(0xbe):_0x479262(0x9f),'children':_0x7fbf52})]}),a3_0x1adda2(Box,{'children':[a3_0x20400e(Text,{'color':_0x479262(0xa0),'children':_0x479262(0x97)}),a3_0x1adda2(Text,{'color':_0x479262(0xac),'children':[_0x38c265,'.ts']}),a3_0x20400e(Text,{'color':_0x479262(0x9f),'children':_0x479262(0xb9)}),a3_0x1adda2(Text,{'color':_0x479262(0xac),'children':[_0x138ac6,_0x479262(0xb0)]})]}),_0x25bac6&&a3_0x20400e(Box,{'children':a3_0x1adda2(Text,{'children':[_0x479262(0xc4),_0x3e4271,')']})}),_0x3b64f7&&_0x1e9236&&a3_0x1adda2(Box,{'flexDirection':_0x479262(0x8f),'children':[a3_0x20400e(Box,{'children':a3_0x20400e(Text,{'color':_0x479262(0xad),'children':'√\x20API\x20文件生成成功!'})}),a3_0x20400e(Box,{'marginTop':0x1,'children':a3_0x20400e(Text,{'color':_0x479262(0xa0),'children':_0x479262(0xa8)})}),a3_0x1adda2(Box,{'marginLeft':0x2,'children':[a3_0x1adda2(Text,{'color':_0x479262(0xac),'children':['•\x20',_0x1e9236[_0x479262(0xbd)]]}),a3_0x20400e(Text,{'color':'dim','children':_0x479262(0xc3)})]}),a3_0x1adda2(Box,{'marginLeft':0x2,'children':[a3_0x1adda2(Text,{'color':'cyan','children':['•\x20',_0x1e9236[_0x479262(0x99)]]}),a3_0x20400e(Text,{'color':_0x479262(0x9f),'children':'\x20-\x20客户端实例文件'})]}),a3_0x20400e(Box,{'marginTop':0x1,'children':a3_0x20400e(Text,{'color':_0x479262(0xa0),'children':_0x479262(0x92)})}),a3_0x20400e(Box,{'marginLeft':0x2,'children':a3_0x1adda2(Text,{'color':_0x479262(0xb7),'children':[_0x479262(0xae),'{\x20lovrabetClient\x20}',_0x479262(0xb1),_0x1e9236[_0x479262(0x99)][_0x479262(0xc7)](_0x479262(0x9e),'')['replace'](_0x479262(0xb0),''),'\x27']})})]}),_0x268c5c&&a3_0x1adda2(Box,{'flexDirection':_0x479262(0x8f),'children':[a3_0x20400e(Box,{'children':a3_0x1adda2(Text,{'color':_0x479262(0x95),'children':['❌\x20',_0x268c5c]})}),_0x268c5c[_0x479262(0xb4)]('登录')&&a3_0x1adda2(Box,{'marginTop':0x1,'children':[a3_0x20400e(Text,{'color':_0x479262(0xb7),'children':_0x479262(0xab)}),a3_0x20400e(Text,{'color':_0x479262(0xac),'children':'lovrabet\x20auth'}),a3_0x20400e(Text,{'color':_0x479262(0xb7),'children':_0x479262(0xc0)})]})]})]});};function a3_0x28c9(){const _0x3180a5=['green','import\x20','3410680LjfBnC','.ts','\x20from\x20\x27@/api/','未提供应用AppCode,且配置中也没有默认值','url','includes','-client','data','yellow','join','\x20和\x20','app','success','557126VLPSqU','api','white','/smartapi/dataset/getList?appCode=','\x20重新登录后再试','&pageSize=999&currentPage=1','拉取\x20API\x20配置失败:\x20','\x20-\x20模型配置文件','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20',',且无法读取错误响应内容','status','replace','setLogPath','env','1348510HSCQmY','column','-api','获取数据集失败,HTTP状态码:\x20','*\x20导入方式:','1098038xzxsRe','108nrKTsc','red','使用指定的应用AppCode:\x20','*\x20将生成文件:\x20','api-pull','client','split','cwd','1361370uCTZJD','7086780yvXwUf','src/api/','dim','gray','3lRZtsJ','49WgKMsX','json','error','string','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','slice','*\x20已生成文件:','online','121544VlGRUc','💡\x20请使用\x20','cyan'];a3_0x28c9=function(){return _0x3180a5;};return a3_0x28c9();}
1
+ (function(_0x3a325c,_0x342490){const _0x297f27=a3_0x2a43,_0x1ec1df=_0x3a325c();while(!![]){try{const _0x21b86a=parseInt(_0x297f27(0x135))/0x1*(-parseInt(_0x297f27(0x12c))/0x2)+parseInt(_0x297f27(0x111))/0x3+-parseInt(_0x297f27(0x107))/0x4*(-parseInt(_0x297f27(0x11b))/0x5)+parseInt(_0x297f27(0x100))/0x6*(parseInt(_0x297f27(0x118))/0x7)+parseInt(_0x297f27(0x10f))/0x8*(parseInt(_0x297f27(0x129))/0x9)+-parseInt(_0x297f27(0x128))/0xa+parseInt(_0x297f27(0x10e))/0xb*(-parseInt(_0x297f27(0x113))/0xc);if(_0x21b86a===_0x342490)break;else _0x1ec1df['push'](_0x1ec1df['shift']());}catch(_0x432974){_0x1ec1df['push'](_0x1ec1df['shift']());}}}(a3_0x5af5,0xaa865));import{jsx as a3_0x1122bb,jsxs as a3_0x5dfdb2}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig}from'../utils/config.js';function a3_0x2a43(_0x245445,_0x3d0a65){const _0x5af56b=a3_0x5af5();return a3_0x2a43=function(_0x2a437d,_0x273a7c){_0x2a437d=_0x2a437d-0xfe;let _0x2338e9=_0x5af56b[_0x2a437d];return _0x2338e9;},a3_0x2a43(_0x245445,_0x3d0a65);}function a3_0x5af5(){const _0x1e3c65=['*\x20已生成文件:','6yPrApD','拉取\x20API\x20配置失败:\x20','status','setLogPath','includes','error','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','8gkEhuW','column','./src/api/','√\x20API\x20文件生成成功!','\x20-\x20模型配置文件','gray','json','1331XuWRbb','104wHWbLb','replace','899154YUntwE','-api','205188gURpun','red','dim',',且无法读取错误响应内容','data','9425136qZZsMr','green','api-pull','2342350LmhenL','client','\x20重新登录后再试','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','cyan','import\x20','message','lovrabet\x20auth','endsWith','split','使用指定的应用AppCode:\x20','join','string','6400510cSfLTb','612162bxNcaM','yellow','-client','366aeZFoV','success','\x20from\x20\x27@/','url','white','tableData','*\x20导入方式:','.ts','💡\x20请使用\x20','327OnFxbW','未提供应用AppCode,且配置中也没有默认值','env','api'];a3_0x5af5=function(){return _0x1e3c65;};return a3_0x5af5();}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0x285624,env:_0x2e1329,output:_0x1dfc73})=>{const _0x4756e0=a3_0x2a43,{exit:_0x4d4fb9}=useApp(),[_0x30d3ca,_0xe22220]=useState(![]),[_0x49b027,_0x20a620]=useState(![]),[_0x42ca94,_0x44ca0c]=useState(null),[_0x5c048a,_0x1195d2]=useState(null),_0x1267fc=readConfig(),_0x4bf246=_0x285624||_0x1267fc?.['app'],_0x4456da=typeof _0x1267fc?.[_0x4756e0(0x137)]===_0x4756e0(0x127)?_0x1267fc[_0x4756e0(0x137)]:undefined,_0x318064=_0x2e1329||_0x4456da||'online';initEnv(_0x318064);const _0x1b2b2a=_0x1dfc73||_0x4756e0(0x109),_0x43e15b=_0x285624&&_0x285624[_0x4756e0(0x104)]('-')?_0x285624[_0x4756e0(0x124)]('-')['slice'](0x1)[_0x4756e0(0x126)]('-'):'',_0x49dd4e=_0x285624?_0x4756e0(0x125)+_0x4bf246:'使用配置的应用AppCode:\x20'+_0x4bf246,_0x2cd643=_0x43e15b?_0x43e15b+_0x4756e0(0x112):_0x4756e0(0xfe),_0xa3937b=_0x43e15b?_0x43e15b+_0x4756e0(0x12b):_0x4756e0(0x11c);useEffect(()=>{_0xe22220(!![]),_0x42db15();},[]),useEffect(()=>{(_0x49b027||_0x42ca94)&&_0x4d4fb9();},[_0x49b027,_0x42ca94,_0x4d4fb9]);async function _0x42db15(){const _0x40c670=_0x4756e0;if(!_0x4bf246){_0x44ca0c(_0x40c670(0x136));return;}try{logger[_0x40c670(0x103)](process['cwd']());const _0x8f2673=await fetch(getApiDomain()+'/smartapi/dataset/getList?appCode='+_0x4bf246+'&pageSize=999&currentPage=1',{'headers':{'Cookie':getCookie()}});if(_0x8f2673['ok']){const _0x1fc34f=await _0x8f2673[_0x40c670(0x10d)]();if(_0x1fc34f[_0x40c670(0x12d)]){const _0x494703=!_0x285624;await generateApiFile(_0x1fc34f[_0x40c670(0x117)][_0x40c670(0x131)],_0x43e15b,_0x4bf246,_0x494703,_0x318064,_0x1b2b2a);const _0x411a6b=_0x1b2b2a[_0x40c670(0x123)]('/')?_0x1b2b2a:_0x1b2b2a+'/';_0x1195d2({'api':''+_0x411a6b+_0x2cd643+_0x40c670(0x133),'client':''+_0x411a6b+_0xa3937b+_0x40c670(0x133)}),_0x20a620(!![]);}}else{if(_0x8f2673[_0x40c670(0x102)]===0x191){const _0x58182e=_0x40c670(0x11e);logger[_0x40c670(0x105)](_0x40c670(0x11a),_0x58182e,{'status':_0x8f2673[_0x40c670(0x102)],'appCode':_0x4bf246,'url':_0x8f2673[_0x40c670(0x12f)]}),_0x44ca0c(_0x58182e);}else{const _0x3f5534='获取数据集失败,HTTP状态码:\x20'+_0x8f2673[_0x40c670(0x102)];try{const _0x206fad=await _0x8f2673['text']();_0x206fad?logger[_0x40c670(0x105)](_0x40c670(0x11a),_0x3f5534,{'status':_0x8f2673[_0x40c670(0x102)],'appCode':_0x4bf246,'url':_0x8f2673[_0x40c670(0x12f)],'errorBody':_0x206fad}):logger['error']('api-pull',_0x3f5534,{'status':_0x8f2673[_0x40c670(0x102)],'appCode':_0x4bf246,'url':_0x8f2673['url']});}catch(_0x1fad36){logger[_0x40c670(0x105)](_0x40c670(0x11a),_0x3f5534+_0x40c670(0x116),{'status':_0x8f2673[_0x40c670(0x102)],'appCode':_0x4bf246,'url':_0x8f2673[_0x40c670(0x12f)],'readError':_0x1fad36 instanceof Error?_0x1fad36[_0x40c670(0x121)]:String(_0x1fad36)});}_0x44ca0c(_0x3f5534);}}}catch(_0x1414db){const _0x53186c=_0x1414db instanceof Error?_0x1414db[_0x40c670(0x121)]:String(_0x1414db);_0x44ca0c(_0x40c670(0x101)+_0x53186c);}finally{_0xe22220(![]);}}return a3_0x5dfdb2(Box,{'flexDirection':_0x4756e0(0x108),'children':[a3_0x5dfdb2(Box,{'children':[a3_0x1122bb(Text,{'color':_0x4756e0(0x10c),'children':'*\x20'}),a3_0x1122bb(Text,{'color':_0x285624?_0x4756e0(0x130):_0x4756e0(0x115),'children':_0x49dd4e})]}),a3_0x5dfdb2(Box,{'children':[a3_0x1122bb(Text,{'color':_0x4756e0(0x10c),'children':'*\x20将生成文件:\x20'}),a3_0x5dfdb2(Text,{'color':'cyan','children':[_0x2cd643,'.ts']}),a3_0x1122bb(Text,{'color':_0x4756e0(0x115),'children':'\x20和\x20'}),a3_0x5dfdb2(Text,{'color':_0x4756e0(0x11f),'children':[_0xa3937b,'.ts']})]}),_0x30d3ca&&a3_0x1122bb(Box,{'children':a3_0x5dfdb2(Text,{'children':[_0x4756e0(0x106),_0x318064,')']})}),_0x49b027&&_0x5c048a&&a3_0x5dfdb2(Box,{'flexDirection':_0x4756e0(0x108),'children':[a3_0x1122bb(Box,{'children':a3_0x1122bb(Text,{'color':_0x4756e0(0x119),'children':_0x4756e0(0x10a)})}),a3_0x1122bb(Box,{'marginTop':0x1,'children':a3_0x1122bb(Text,{'color':_0x4756e0(0x10c),'children':_0x4756e0(0xff)})}),a3_0x5dfdb2(Box,{'marginLeft':0x2,'children':[a3_0x5dfdb2(Text,{'color':_0x4756e0(0x11f),'children':['•\x20',_0x5c048a['api']]}),a3_0x1122bb(Text,{'color':_0x4756e0(0x115),'children':_0x4756e0(0x10b)})]}),a3_0x5dfdb2(Box,{'marginLeft':0x2,'children':[a3_0x5dfdb2(Text,{'color':_0x4756e0(0x11f),'children':['•\x20',_0x5c048a[_0x4756e0(0x11c)]]}),a3_0x1122bb(Text,{'color':_0x4756e0(0x115),'children':'\x20-\x20客户端实例文件'})]}),a3_0x1122bb(Box,{'marginTop':0x1,'children':a3_0x1122bb(Text,{'color':'gray','children':_0x4756e0(0x132)})}),a3_0x1122bb(Box,{'marginLeft':0x2,'children':a3_0x5dfdb2(Text,{'color':_0x4756e0(0x12a),'children':[_0x4756e0(0x120),'{\x20lovrabetClient\x20}',_0x4756e0(0x12e),_0x5c048a[_0x4756e0(0x11c)][_0x4756e0(0x110)](/^\.\//,'')['replace'](/^src\//,'')[_0x4756e0(0x110)](_0x4756e0(0x133),''),'\x27']})})]}),_0x42ca94&&a3_0x5dfdb2(Box,{'flexDirection':'column','children':[a3_0x1122bb(Box,{'children':a3_0x5dfdb2(Text,{'color':_0x4756e0(0x114),'children':['❌\x20',_0x42ca94]})}),_0x42ca94[_0x4756e0(0x104)]('登录')&&a3_0x5dfdb2(Box,{'marginTop':0x1,'children':[a3_0x1122bb(Text,{'color':_0x4756e0(0x12a),'children':_0x4756e0(0x134)}),a3_0x1122bb(Text,{'color':'cyan','children':_0x4756e0(0x122)}),a3_0x1122bb(Text,{'color':_0x4756e0(0x12a),'children':_0x4756e0(0x11d)})]})]})]});};
@@ -1 +1 @@
1
- (function(_0x3a3c84,_0x2ae912){const _0x1b62ad=a4_0x1f28,_0x26843e=_0x3a3c84();while(!![]){try{const _0x159a1f=-parseInt(_0x1b62ad(0xe7))/0x1*(parseInt(_0x1b62ad(0xdb))/0x2)+-parseInt(_0x1b62ad(0xe1))/0x3*(parseInt(_0x1b62ad(0xe2))/0x4)+parseInt(_0x1b62ad(0xd7))/0x5*(-parseInt(_0x1b62ad(0xea))/0x6)+parseInt(_0x1b62ad(0xe6))/0x7*(-parseInt(_0x1b62ad(0xe8))/0x8)+parseInt(_0x1b62ad(0xe5))/0x9+parseInt(_0x1b62ad(0xd6))/0xa+parseInt(_0x1b62ad(0xdc))/0xb;if(_0x159a1f===_0x2ae912)break;else _0x26843e['push'](_0x26843e['shift']());}catch(_0x1cf66e){_0x26843e['push'](_0x26843e['shift']());}}}(a4_0x5154,0x82df5));export function formatDataset(_0x325ff1){const _0x3b6fc5=a4_0x1f28,_0x3dabf5=_0x325ff1['filter'](_0x99a721=>_0x99a721[_0x3b6fc5(0xe4)]),_0x53f153=_0x325ff1['filter'](_0x5e292b=>!_0x5e292b[_0x3b6fc5(0xe4)]),_0x47582a=new Map();_0x3dabf5[_0x3b6fc5(0xd5)](_0x31f687=>{const _0x495cc3=_0x3b6fc5,_0x98a045=_0x31f687[_0x495cc3(0xe4)][_0x495cc3(0xd3)],_0x11e5c0=_0x47582a[_0x495cc3(0xd8)](_0x98a045);(!_0x11e5c0||_0x31f687['id']>_0x11e5c0['id'])&&_0x47582a['set'](_0x98a045,_0x31f687);});const _0x1a8f3c=Array[_0x3b6fc5(0xd4)](_0x47582a[_0x3b6fc5(0xda)]())['map'](_0x454f22=>{const _0x9f30c1=_0x3b6fc5,_0x39e849=snakeToCamel(_0x454f22['dbtableConfig']['tableName']);return{'id':_0x454f22['id'],'name':_0x454f22['name'],'code':_0x454f22[_0x9f30c1(0xe0)],'tableName':_0x454f22['dbtableConfig'][_0x9f30c1(0xd3)],'apiFucName':_0x39e849?_0x39e849+_0x9f30c1(0xde):_0x9f30c1(0xe9)+_0x454f22[_0x9f30c1(0xe0)]+_0x9f30c1(0xde),'pkField':_0x454f22[_0x9f30c1(0xe4)][_0x9f30c1(0xd9)],'allFields':_0x454f22['dbtableConfig'][_0x9f30c1(0xd2)][_0x9f30c1(0xdd)](',')};}),_0x4abacd=_0x53f153['map'](_0x2b2a8d=>{const _0x159544=_0x3b6fc5,_0x4ef329=_0x159544(0xeb)+_0x2b2a8d['code'],_0x4c9b8b=snakeToCamel(_0x4ef329);return{'id':_0x2b2a8d['id'],'name':_0x2b2a8d[_0x159544(0xe3)],'code':_0x2b2a8d[_0x159544(0xe0)],'tableName':_0x4ef329,'apiFucName':_0x4c9b8b?_0x4c9b8b+_0x159544(0xde):_0x159544(0xe9)+_0x2b2a8d[_0x159544(0xe0)]+_0x159544(0xde),'pkField':undefined,'allFields':[]};});return[..._0x1a8f3c,..._0x4abacd];}function a4_0x1f28(_0x2ade01,_0x16f725){const _0x515428=a4_0x5154();return a4_0x1f28=function(_0x1f28d5,_0x2f6320){_0x1f28d5=_0x1f28d5-0xd2;let _0x16f604=_0x515428[_0x1f28d5];return _0x16f604;},a4_0x1f28(_0x2ade01,_0x16f725);}function a4_0x5154(){const _0x2279eb=['649634grUPQK','18018891OZCJkN','split','Api','toUpperCase','code','6YowsPM','1597924baqiFj','name','dbtableConfig','8551206ACSxxe','35TGQVzZ','2mkiDMm','690416ddXkEc','dataset','12JoWjCW','dataset_','allFields','tableName','from','forEach','4933800cZvFKB','1663590oiDhIe','get','pkField','values'];a4_0x5154=function(){return _0x2279eb;};return a4_0x5154();}function snakeToCamel(_0x5baf7e){const _0x4c2030=a4_0x1f28;if(!_0x5baf7e)return _0x5baf7e;const _0xcc896=_0x5baf7e['trim']();return _0xcc896['replace'](/_([a-zA-Z0-9])/g,(_0x1fef86,_0x175182)=>_0x175182[_0x4c2030(0xdf)]());}
1
+ (function(_0x3084b8,_0x5e5690){const _0x5dbaa4=a4_0x4bb0,_0xff40e5=_0x3084b8();while(!![]){try{const _0x4aec91=parseInt(_0x5dbaa4(0x94))/0x1+-parseInt(_0x5dbaa4(0x9a))/0x2+-parseInt(_0x5dbaa4(0xa7))/0x3*(parseInt(_0x5dbaa4(0xa0))/0x4)+parseInt(_0x5dbaa4(0x99))/0x5*(-parseInt(_0x5dbaa4(0x8d))/0x6)+parseInt(_0x5dbaa4(0xa3))/0x7+parseInt(_0x5dbaa4(0x97))/0x8*(-parseInt(_0x5dbaa4(0xa6))/0x9)+parseInt(_0x5dbaa4(0x90))/0xa*(parseInt(_0x5dbaa4(0x9e))/0xb);if(_0x4aec91===_0x5e5690)break;else _0xff40e5['push'](_0xff40e5['shift']());}catch(_0x2bea06){_0xff40e5['push'](_0xff40e5['shift']());}}}(a4_0x4a33,0xbe1dd));function a4_0x4bb0(_0x36a66d,_0x16ad64){const _0x4a3314=a4_0x4a33();return a4_0x4bb0=function(_0x4bb0a8,_0x2e6b8e){_0x4bb0a8=_0x4bb0a8-0x8d;let _0x1fc4cf=_0x4a3314[_0x4bb0a8];return _0x1fc4cf;},a4_0x4bb0(_0x36a66d,_0x16ad64);}function a4_0x4a33(){const _0x4d54ed=['2782794uKJEVD','dbtableConfig','get','469143TLbsyr','186TxPvuK','137892ynyXLm','tableName','from','548190JqXLno','dataset_','dataset','values','1002009bHkEoP','map','name','216OwgnWn','replace','245vOcThU','1774000SqVLJy','pkField','code','Api','847XtLDJR','trim','91700Qxphwu','filter','allFields'];a4_0x4a33=function(){return _0x4d54ed;};return a4_0x4a33();}export function formatDataset(_0x3e0c68){const _0x346f56=a4_0x4bb0,_0x32ebdc=_0x3e0c68[_0x346f56(0xa1)](_0x2c7356=>_0x2c7356['dbtableConfig']),_0x571ac1=_0x3e0c68['filter'](_0x3f16bb=>!_0x3f16bb['dbtableConfig']),_0x30064c=new Map();_0x32ebdc['forEach'](_0x4cfa40=>{const _0x234d87=_0x346f56,_0x5f1e59=_0x4cfa40[_0x234d87(0xa4)][_0x234d87(0x8e)],_0x34732b=_0x30064c[_0x234d87(0xa5)](_0x5f1e59);(!_0x34732b||_0x4cfa40['id']>_0x34732b['id'])&&_0x30064c['set'](_0x5f1e59,_0x4cfa40);});const _0x17d8b1=Array[_0x346f56(0x8f)](_0x30064c[_0x346f56(0x93)]())[_0x346f56(0x95)](_0x32607f=>{const _0x31815e=_0x346f56,_0x3fdc16=snakeToCamel(_0x32607f['dbtableConfig'][_0x31815e(0x8e)]);return{'id':_0x32607f['id'],'name':_0x32607f[_0x31815e(0x96)],'code':_0x32607f[_0x31815e(0x9c)],'tableName':_0x32607f[_0x31815e(0xa4)][_0x31815e(0x8e)],'apiFucName':_0x3fdc16?_0x3fdc16+'Api':_0x31815e(0x92)+_0x32607f[_0x31815e(0x9c)]+'Api','pkField':_0x32607f['dbtableConfig'][_0x31815e(0x9b)],'allFields':_0x32607f[_0x31815e(0xa4)][_0x31815e(0xa2)]['split'](',')};}),_0x2f0991=_0x571ac1['map'](_0x5b8fc0=>{const _0x34dccb=_0x346f56,_0x19c3c0=_0x34dccb(0x91)+_0x5b8fc0[_0x34dccb(0x9c)],_0x4b05f2=snakeToCamel(_0x19c3c0);return{'id':_0x5b8fc0['id'],'name':_0x5b8fc0[_0x34dccb(0x96)],'code':_0x5b8fc0[_0x34dccb(0x9c)],'tableName':_0x19c3c0,'apiFucName':_0x4b05f2?_0x4b05f2+_0x34dccb(0x9d):'dataset'+_0x5b8fc0[_0x34dccb(0x9c)]+'Api','pkField':undefined,'allFields':[]};});return[..._0x17d8b1,..._0x2f0991];}function snakeToCamel(_0x35e58f){const _0x5b618f=a4_0x4bb0;if(!_0x35e58f)return _0x35e58f;const _0xdcf788=_0x35e58f[_0x5b618f(0x9f)]();return _0xdcf788[_0x5b618f(0x98)](/_([a-zA-Z0-9])/g,(_0x272323,_0x3b7b9b)=>_0x3b7b9b['toUpperCase']());}
@@ -1 +1 @@
1
- (function(_0x32c28b,_0x4fcfe9){const _0x517332=a5_0x2bc3,_0x5822e5=_0x32c28b();while(!![]){try{const _0x458c3c=parseInt(_0x517332(0x106))/0x1*(parseInt(_0x517332(0x10a))/0x2)+-parseInt(_0x517332(0xdb))/0x3+parseInt(_0x517332(0x107))/0x4*(-parseInt(_0x517332(0xeb))/0x5)+-parseInt(_0x517332(0xf9))/0x6+-parseInt(_0x517332(0xda))/0x7+parseInt(_0x517332(0xd8))/0x8*(-parseInt(_0x517332(0xef))/0x9)+parseInt(_0x517332(0x101))/0xa*(parseInt(_0x517332(0xfd))/0xb);if(_0x458c3c===_0x4fcfe9)break;else _0x5822e5['push'](_0x5822e5['shift']());}catch(_0x12fac4){_0x5822e5['push'](_0x5822e5['shift']());}}}(a5_0x2249,0x614b8));import a5_0x5285ea from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a5_0x266496 from'node:path';function a5_0x2bc3(_0x114358,_0x4f931e){const _0x2249e8=a5_0x2249();return a5_0x2bc3=function(_0x2bc3ec,_0x17f257){_0x2bc3ec=_0x2bc3ec-0xd6;let _0xfe168a=_0x2249e8[_0x2bc3ec];return _0xfe168a;},a5_0x2bc3(_0x114358,_0x4f931e);}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a5_0x2249(){const _0x513404=['CONFIG_NAMES.DEFAULT','4216730Evunap','2261289LtrVIu','{\x20apiConfigName:\x20','slice','join','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','toUpperCase','api.ts.tpl','success','tableName','log','\x20-\x20模型配置文件\x20(','forEach','\x20\x20\x20•\x20','-client','src/api','-api','5yAlgCX','client.ts.tpl','*\x20API配置\x20apiConfigName\x20:\x20','apiFucName','7002lWOIdl','format','client','\x20个模型)','charAt','code',',\x20env:\x20\x22','replaceApiContent','resolve','env','3778806PTqrwd','\x20-\x20客户端实例文件','{\x20apiConfigName:\x20\x22','\x22\x20}','29172517mzNnML','templates/generate-api','init-api','app','10dogHrd','API\x20文件生成成功!','dirname','*\x20已生成文件:','api','793691pPmDAq','1571848CAvanJ','replace','src/api/','2dIKvNW','length','typescript','keys','string','.ts','utf8','6872FXSZPD'];a5_0x2249=function(){return _0x513404;};return a5_0x2249();}import{formatDataset}from'./format-dataset.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x17e197,_0x11afdd='',_0x38c804,_0x30bf95=![],_0x3f36af){const _0x3f6b0a=a5_0x2bc3,_0x56017f=readConfig(),_0x3b9a48=_0x38c804||_0x56017f?.[_0x3f6b0a(0x100)];if(typeof _0x3b9a48!==_0x3f6b0a(0x10e)||!_0x3b9a48)throw new Error(_0x3f6b0a(0xdf));const _0x1f2742=_0x30bf95?_0x3f6b0a(0xd9):'\x22'+_0x3b9a48+'\x22',_0x31ad8f=typeof _0x56017f['env']===_0x3f6b0a(0x10e)?_0x56017f[_0x3f6b0a(0xf8)]:undefined,_0x4bf9a6=_0x3f36af||_0x31ad8f||'online',_0x4bedae=_0x4bf9a6!=='online';let _0x31a55b;if(_0x30bf95)_0x4bedae?_0x31a55b=_0x3f6b0a(0xdc)+_0x1f2742+',\x20env:\x20\x22'+_0x4bf9a6+_0x3f6b0a(0xfc):_0x31a55b='';else{const _0x5ce9bd=_0x4bedae?_0x3f6b0a(0xf5)+_0x4bf9a6+'\x22':'';_0x31a55b=_0x3f6b0a(0xfb)+_0x3b9a48+'\x22'+_0x5ce9bd+'\x20}';}const _0x116b52=_0x11afdd?_0x11afdd+_0x3f6b0a(0xea):_0x3f6b0a(0x105),_0x55036a=_0x11afdd?_0x11afdd+_0x3f6b0a(0xe8):_0x3f6b0a(0xf1),_0x24e19b=formatDataset(_0x17e197),_0xb91acc={};_0x24e19b[_0x3f6b0a(0xe6)](_0x9e98e9=>{const _0x4219bc=_0x3f6b0a,_0x424cc4=_0x9e98e9[_0x4219bc(0xee)][_0x4219bc(0x108)](/Api$/,''),_0x1ca00c=_0x424cc4[_0x4219bc(0xf3)](0x0)[_0x4219bc(0xe0)]()+_0x424cc4[_0x4219bc(0xdd)](0x1);_0xb91acc[_0x1ca00c]={'tableName':_0x9e98e9[_0x4219bc(0xe3)],'datasetCode':_0x9e98e9[_0x4219bc(0xf4)]};});const _0x1c73cd=fileURLToPath(import.meta['url']),_0x20db84=a5_0x266496[_0x3f6b0a(0xf7)](a5_0x266496[_0x3f6b0a(0x103)](_0x1c73cd),'../..'),_0x23db68=a5_0x266496['join'](_0x20db84,_0x3f6b0a(0xfe)),_0x5a47c1=a5_0x266496[_0x3f6b0a(0xde)](_0x23db68,_0x3f6b0a(0xe1)),_0x286f7c=a5_0x266496['join'](_0x23db68,_0x3f6b0a(0xec));mkdirSync(_0x3f6b0a(0xe9),{'recursive':!![]});const _0x1fa1f8=readFileSync(_0x5a47c1,_0x3f6b0a(0xd7)),_0x15f7dc=TemplateReplacer[_0x3f6b0a(0xf6)](_0x1fa1f8,_0x3b9a48,_0xb91acc,Object[_0x3f6b0a(0x10d)](_0xb91acc)[0x0],_0x116b52,_0x1f2742),_0x20dcdc=await a5_0x5285ea[_0x3f6b0a(0xf0)](_0x15f7dc,{'parser':_0x3f6b0a(0x10c)}),_0x3e00a1=_0x3f6b0a(0x109)+_0x116b52+_0x3f6b0a(0xd6);writeFileSync(_0x3e00a1,_0x20dcdc,{'encoding':_0x3f6b0a(0xd7)});const _0x2c39c1=readFileSync(_0x286f7c,_0x3f6b0a(0xd7)),_0x37ea1b=TemplateReplacer[_0x3f6b0a(0xf6)](_0x2c39c1,_0x3b9a48,_0xb91acc,Object[_0x3f6b0a(0x10d)](_0xb91acc)[0x0],_0x116b52,_0x1f2742,_0x31a55b),_0x268dd9=await a5_0x5285ea[_0x3f6b0a(0xf0)](_0x37ea1b,{'parser':_0x3f6b0a(0x10c)}),_0x267a7e=_0x3f6b0a(0x109)+_0x55036a+_0x3f6b0a(0xd6);writeFileSync(_0x267a7e,_0x268dd9,{'encoding':_0x3f6b0a(0xd7)}),logger[_0x3f6b0a(0xe2)](_0x3f6b0a(0xff),_0x3f6b0a(0x102)),console[_0x3f6b0a(0xe4)](_0x3f6b0a(0x104)),console[_0x3f6b0a(0xe4)](_0x3f6b0a(0xe7)+_0x3e00a1+_0x3f6b0a(0xe5)+Object[_0x3f6b0a(0x10d)](_0xb91acc)[_0x3f6b0a(0x10b)]+_0x3f6b0a(0xf2)),console[_0x3f6b0a(0xe4)](_0x3f6b0a(0xe7)+_0x267a7e+_0x3f6b0a(0xfa)),console['log'](_0x3f6b0a(0xed)+_0x1f2742),console[_0x3f6b0a(0xe4)]('*\x20可以开始使用:\x20import\x20{\x20lovrabetClient\x20}\x20from\x20\x27@/api/'+_0x55036a+'\x27');}
1
+ function a5_0x5799(){const _0x14eeeb=['\x20\x20\x20•\x20','*\x20API配置\x20apiConfigName\x20:\x20','init-api',',\x20env:\x20\x22','client.ts.tpl','client','1194242keecaV','code','log','1954458YaViIB','env','dirname','string','1228221VEonCQ','37315PJPTlB','207847COVwPg','API\x20文件生成成功!','replaceApiContent','app','*\x20可以开始使用:\x20import\x20{\x20lovrabetClient\x20}\x20from\x20\x27@/','CONFIG_NAMES.DEFAULT','6605352xvZIfA','6NEtvGU','{\x20apiConfigName:\x20\x22','templates/generate-api','slice','replace','online','resolve','length','api.ts.tpl','api','{\x20apiConfigName:\x20','toUpperCase','format','utf8','apiFucName','join','typescript','.ts','604OvyKwX','\x20-\x20客户端实例文件','\x22\x20}','1813746vhlxFT','30tBmKHZ','../..','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','tableName','keys','*\x20已生成文件:'];a5_0x5799=function(){return _0x14eeeb;};return a5_0x5799();}(function(_0x78c4da,_0x4ba294){const _0x3e6e18=a5_0x2a1b,_0x3a72cb=_0x78c4da();while(!![]){try{const _0xc419c4=parseInt(_0x3e6e18(0x1db))/0x1*(-parseInt(_0x3e6e18(0x1e2))/0x2)+parseInt(_0x3e6e18(0x1d5))/0x3+-parseInt(_0x3e6e18(0x1f4))/0x4*(parseInt(_0x3e6e18(0x1da))/0x5)+parseInt(_0x3e6e18(0x1f7))/0x6+parseInt(_0x3e6e18(0x1d2))/0x7+parseInt(_0x3e6e18(0x1e1))/0x8+parseInt(_0x3e6e18(0x1d9))/0x9*(parseInt(_0x3e6e18(0x1f8))/0xa);if(_0xc419c4===_0x4ba294)break;else _0x3a72cb['push'](_0x3a72cb['shift']());}catch(_0x128db5){_0x3a72cb['push'](_0x3a72cb['shift']());}}}(a5_0x5799,0x94aed));import a5_0x10a6d0 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a5_0x3e1008 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{formatDataset}from'./format-dataset.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';function a5_0x2a1b(_0x58f316,_0x3568b2){const _0x5799d3=a5_0x5799();return a5_0x2a1b=function(_0x2a1b6d,_0x21d44d){_0x2a1b6d=_0x2a1b6d-0x1d2;let _0x3d616d=_0x5799d3[_0x2a1b6d];return _0x3d616d;},a5_0x2a1b(_0x58f316,_0x3568b2);}export async function generateApiFile(_0x2d8a00,_0x8a5e50='',_0x3bf8fa,_0x53cac0=![],_0xba449c,_0x555aa3='./src/api/'){const _0x3ecc21=a5_0x2a1b,_0x7ad4cf=readConfig(),_0x532233=_0x3bf8fa||_0x7ad4cf?.[_0x3ecc21(0x1de)];if(typeof _0x532233!==_0x3ecc21(0x1d8)||!_0x532233)throw new Error(_0x3ecc21(0x1fa));const _0x262581=_0x53cac0?_0x3ecc21(0x1e0):'\x22'+_0x532233+'\x22',_0xe1acd7=typeof _0x7ad4cf[_0x3ecc21(0x1d6)]===_0x3ecc21(0x1d8)?_0x7ad4cf[_0x3ecc21(0x1d6)]:undefined,_0x90fbad=_0xba449c||_0xe1acd7||_0x3ecc21(0x1e7),_0x355764=_0x90fbad!=='online';let _0x34aaae;if(_0x53cac0)_0x355764?_0x34aaae=_0x3ecc21(0x1ec)+_0x262581+_0x3ecc21(0x201)+_0x90fbad+_0x3ecc21(0x1f6):_0x34aaae='';else{const _0x249dfa=_0x355764?_0x3ecc21(0x201)+_0x90fbad+'\x22':'';_0x34aaae=_0x3ecc21(0x1e3)+_0x532233+'\x22'+_0x249dfa+'\x20}';}const _0x182a68=_0x8a5e50?_0x8a5e50+'-api':_0x3ecc21(0x1eb),_0x272643=_0x8a5e50?_0x8a5e50+'-client':_0x3ecc21(0x203),_0x3fff97=formatDataset(_0x2d8a00),_0x2ddf38={};_0x3fff97['forEach'](_0x2d8bac=>{const _0x4f6e04=_0x3ecc21,_0x313bd0=_0x2d8bac[_0x4f6e04(0x1f0)]['replace'](/Api$/,''),_0x4f6214=_0x313bd0['charAt'](0x0)[_0x4f6e04(0x1ed)]()+_0x313bd0[_0x4f6e04(0x1e5)](0x1);_0x2ddf38[_0x4f6214]={'tableName':_0x2d8bac[_0x4f6e04(0x1fb)],'datasetCode':_0x2d8bac[_0x4f6e04(0x1d3)]};});const _0xcd1394=fileURLToPath(import.meta['url']),_0x9ac6da=a5_0x3e1008[_0x3ecc21(0x1e8)](a5_0x3e1008[_0x3ecc21(0x1d7)](_0xcd1394),_0x3ecc21(0x1f9)),_0xc879d=a5_0x3e1008[_0x3ecc21(0x1f1)](_0x9ac6da,_0x3ecc21(0x1e4)),_0x5428d1=a5_0x3e1008[_0x3ecc21(0x1f1)](_0xc879d,_0x3ecc21(0x1ea)),_0x33b543=a5_0x3e1008[_0x3ecc21(0x1f1)](_0xc879d,_0x3ecc21(0x202)),_0x265f6b=_0x555aa3['endsWith']('/')?_0x555aa3['slice'](0x0,-0x1):_0x555aa3;mkdirSync(_0x265f6b,{'recursive':!![]});const _0x1693d0=readFileSync(_0x5428d1,_0x3ecc21(0x1ef)),_0x5dd704=TemplateReplacer['replaceApiContent'](_0x1693d0,_0x532233,_0x2ddf38,Object[_0x3ecc21(0x1fc)](_0x2ddf38)[0x0],_0x182a68,_0x262581),_0x44431e=await a5_0x10a6d0[_0x3ecc21(0x1ee)](_0x5dd704,{'parser':_0x3ecc21(0x1f2)}),_0x33332a=_0x265f6b+'/'+_0x182a68+_0x3ecc21(0x1f3);writeFileSync(_0x33332a,_0x44431e,{'encoding':'utf8'});const _0x3bd38e=readFileSync(_0x33b543,_0x3ecc21(0x1ef)),_0x19954e=TemplateReplacer[_0x3ecc21(0x1dd)](_0x3bd38e,_0x532233,_0x2ddf38,Object[_0x3ecc21(0x1fc)](_0x2ddf38)[0x0],_0x182a68,_0x262581,_0x34aaae),_0x87db8d=await a5_0x10a6d0[_0x3ecc21(0x1ee)](_0x19954e,{'parser':_0x3ecc21(0x1f2)}),_0x235d1d=_0x265f6b+'/'+_0x272643+_0x3ecc21(0x1f3);writeFileSync(_0x235d1d,_0x87db8d,{'encoding':_0x3ecc21(0x1ef)}),logger['success'](_0x3ecc21(0x200),_0x3ecc21(0x1dc)),console[_0x3ecc21(0x1d4)](_0x3ecc21(0x1fd)),console[_0x3ecc21(0x1d4)](_0x3ecc21(0x1fe)+_0x33332a+'\x20-\x20模型配置文件\x20('+Object[_0x3ecc21(0x1fc)](_0x2ddf38)[_0x3ecc21(0x1e9)]+'\x20个模型)'),console[_0x3ecc21(0x1d4)](_0x3ecc21(0x1fe)+_0x235d1d+_0x3ecc21(0x1f5)),console[_0x3ecc21(0x1d4)](_0x3ecc21(0x1ff)+_0x262581);const _0x3b016c=_0x265f6b['replace'](/^\.\//,'')[_0x3ecc21(0x1e6)](/\/$/,'');console['log'](_0x3ecc21(0x1df)+_0x3b016c+'/'+_0x272643+'\x27');}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0x359a86,_0x2eaf3e){const _0x13a7b9=a6_0x34dd,_0x318bd4=_0x359a86();while(!![]){try{const _0x544957=parseInt(_0x13a7b9(0x129))/0x1+-parseInt(_0x13a7b9(0x12d))/0x2*(parseInt(_0x13a7b9(0x139))/0x3)+parseInt(_0x13a7b9(0x128))/0x4*(parseInt(_0x13a7b9(0x135))/0x5)+parseInt(_0x13a7b9(0x12c))/0x6+parseInt(_0x13a7b9(0x137))/0x7+-parseInt(_0x13a7b9(0x12b))/0x8*(-parseInt(_0x13a7b9(0x12f))/0x9)+-parseInt(_0x13a7b9(0x126))/0xa;if(_0x544957===_0x2eaf3e)break;else _0x318bd4['push'](_0x318bd4['shift']());}catch(_0x5ebb33){_0x318bd4['push'](_0x318bd4['shift']());}}}(a6_0x2d7b,0x6d7b8));function a6_0x2d7b(){const _0x36e064=['string','6489QRyHFx','Unknown\x20api\x20command:\x20','\x20\x20\x20\x20app-code:\x20可选的应用AppCode,不指定则使用配置的默认值','input','\x20\x20lovrabet\x20api\x20pull\x20[app-code]\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','flags','719980rkPVYI','Available\x20commands:','2580445Zqsjur','error','138279CPLGlR','log','11498040tcQUIR','exit','16lzmxmV','795614ymfPIE','pull','1592QacZxg','3541794hdoQPV','38zCejLH'];a6_0x2d7b=function(){return _0x36e064;};return a6_0x2d7b();}function a6_0x34dd(_0x58da92,_0x37c553){const _0x2d7b59=a6_0x2d7b();return a6_0x34dd=function(_0x34dd41,_0x1bc77e){_0x34dd41=_0x34dd41-0x125;let _0x2cf351=_0x2d7b59[_0x34dd41];return _0x2cf351;},a6_0x34dd(_0x58da92,_0x37c553);}import{jsx as a6_0x29c739}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';export async function apiCli(_0x52cbb6){const _0x1e2d62=a6_0x34dd,_0x4b6426=_0x52cbb6[_0x1e2d62(0x132)][0x1];if(_0x4b6426===_0x1e2d62(0x12a)){const _0x4437d7=_0x52cbb6[_0x1e2d62(0x132)][0x2],_0x486b5b=typeof _0x52cbb6[_0x1e2d62(0x134)]['env']===_0x1e2d62(0x12e)?_0x52cbb6[_0x1e2d62(0x134)]['env']:undefined;render(a6_0x29c739(ApiPullUI,{'appCode':_0x4437d7,'env':_0x486b5b}));}else console[_0x1e2d62(0x138)](_0x1e2d62(0x130)+_0x4b6426),console[_0x1e2d62(0x125)](_0x1e2d62(0x136)),console['log'](_0x1e2d62(0x133)),console[_0x1e2d62(0x125)](_0x1e2d62(0x131)),process[_0x1e2d62(0x127)](0x1);}
1
+ (function(_0xf91ed7,_0x3d0b06){const _0x7ae519=a6_0xd871,_0x462874=_0xf91ed7();while(!![]){try{const _0x5bc0c2=-parseInt(_0x7ae519(0x1d7))/0x1*(parseInt(_0x7ae519(0x1cd))/0x2)+-parseInt(_0x7ae519(0x1c8))/0x3*(parseInt(_0x7ae519(0x1c6))/0x4)+parseInt(_0x7ae519(0x1c7))/0x5+parseInt(_0x7ae519(0x1c4))/0x6*(-parseInt(_0x7ae519(0x1db))/0x7)+parseInt(_0x7ae519(0x1d3))/0x8+-parseInt(_0x7ae519(0x1c5))/0x9+parseInt(_0x7ae519(0x1d9))/0xa;if(_0x5bc0c2===_0x3d0b06)break;else _0x462874['push'](_0x462874['shift']());}catch(_0x38bbdc){_0x462874['push'](_0x462874['shift']());}}}(a6_0x4422,0x4ad24));import{jsx as a6_0x3e465d}from'react/jsx-runtime';function a6_0xd871(_0xe7406f,_0xde077d){const _0x4422e5=a6_0x4422();return a6_0xd871=function(_0xd871c7,_0x879a5a){_0xd871c7=_0xd871c7-0x1c4;let _0x2e2e97=_0x4422e5[_0xd871c7];return _0x2e2e97;},a6_0xd871(_0xe7406f,_0xde077d);}function a6_0x4422(){const _0x16862c=['Unknown\x20api\x20command:\x20','input','3826LNFqyS','error','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','exit','Available\x20commands:','env','2024376mUvNfb','output','log','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','199wBcLkQ','\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配置文件','16524320vHygms','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','30604rLHAME','786rycmnr','5327541GFtOpc','550524XenzVO','419940RqJiLz','3USYtKq','flags','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20指定输出目录(默认:./src/api/)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20--env\x20daily\x20--output\x20./api\x0a'];a6_0x4422=function(){return _0x16862c;};return a6_0x4422();}import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';export async function apiCli(_0x59a072){const _0xf85b04=a6_0xd871,_0x471ddf=_0x59a072[_0xf85b04(0x1cc)][0x1];if(_0x59a072[_0xf85b04(0x1c9)]['help']){console[_0xf85b04(0x1d5)](_0xf85b04(0x1ca));return;}if(_0x471ddf==='pull'){_0x59a072['input'][0x2]&&(console['error']('❌\x20错误:不再支持位置参数方式'),console[_0xf85b04(0x1d5)]('请使用\x20--appcode\x20参数,例如:'),console['log'](_0xf85b04(0x1cf)+_0x59a072[_0xf85b04(0x1cc)][0x2]),process[_0xf85b04(0x1d0)](0x1));const _0x3c2359=_0x59a072[_0xf85b04(0x1c9)]['appcode'],_0x139a81=typeof _0x59a072['flags']['env']==='string'?_0x59a072[_0xf85b04(0x1c9)][_0xf85b04(0x1d2)]:undefined,_0x1b71dd=_0x59a072[_0xf85b04(0x1c9)][_0xf85b04(0x1d4)];render(a6_0x3e465d(ApiPullUI,{'appCode':_0x3c2359,'env':_0x139a81,'output':_0x1b71dd}));}else console[_0xf85b04(0x1ce)](_0xf85b04(0x1cb)+_0x471ddf),console[_0xf85b04(0x1d5)](_0xf85b04(0x1d1)),console[_0xf85b04(0x1d5)](_0xf85b04(0x1d8)),console[_0xf85b04(0x1d5)](_0xf85b04(0x1da)),console[_0xf85b04(0x1d5)]('\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)'),console[_0xf85b04(0x1d5)](_0xf85b04(0x1d6)),process[_0xf85b04(0x1d0)](0x1);}
@@ -1 +1 @@
1
- (function(_0x12c8e6,_0x2b1306){const _0x587176=a7_0x2192,_0x3f5995=_0x12c8e6();while(!![]){try{const _0x1a335f=parseInt(_0x587176(0x151))/0x1+parseInt(_0x587176(0x14d))/0x2+-parseInt(_0x587176(0x166))/0x3*(parseInt(_0x587176(0x143))/0x4)+-parseInt(_0x587176(0x15a))/0x5*(-parseInt(_0x587176(0x13e))/0x6)+parseInt(_0x587176(0x150))/0x7+-parseInt(_0x587176(0x148))/0x8+parseInt(_0x587176(0x159))/0x9*(-parseInt(_0x587176(0x144))/0xa);if(_0x1a335f===_0x2b1306)break;else _0x3f5995['push'](_0x3f5995['shift']());}catch(_0x10a7eb){_0x3f5995['push'](_0x3f5995['shift']());}}}(a7_0x1274,0x82a06));import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';function a7_0x2192(_0x481854,_0x1062a8){const _0x127430=a7_0x1274();return a7_0x2192=function(_0x21925c,_0x45ae04){_0x21925c=_0x21925c-0x139;let _0x334955=_0x127430[_0x21925c];return _0x334955;},a7_0x2192(_0x481854,_0x1062a8);}import{httpRequest}from'../utils/http-client.js';function a7_0x1274(){const _0x5b74db=['1000479TThPuZ','string','create-api-pull','url','.ts\x20-\x20模型配置文件','data','30wdFTXL','info','api','×\x20API\x20配置拉取异常:','text','4YpQoHx','130SUgpmJ','status','success','online','659168gmzADx','.ts\x20-\x20客户端实例文件','env','trim','log','1618972jecHte','message','*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','4513194IasKVg','905205YhEjzy','tableData','*\x20正在处理\x20','test','error','\x20\x20\x20•\x20','获取数据集失败,HTTP状态码:\x20','API\x20配置拉取异常:\x20','1324539XJdWGe','504725EoricC','-client','length','未知错误','×\x20无法读取错误响应内容','√\x20API\x20配置文件生成完成','\x20个数据集...','×\x20错误详情:','chdir','&pageSize=999&currentPage=1','/smartapi/dataset/getList?appCode=','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。'];a7_0x1274=function(){return _0x5b74db;};return a7_0x1274();}export async function pullApiSilent(_0x372661,_0x514a58,_0x1f1879,_0x414d22){const _0x2be26b=a7_0x2192;let _0x3f93e7;try{const _0x537f55=_0x514a58?.[_0x2be26b(0x14b)]()||'';if(_0x537f55){const _0x5c6553=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x5c6553[_0x2be26b(0x154)](_0x537f55))return console[_0x2be26b(0x155)](_0x2be26b(0x165)),![];}_0x1f1879&&(_0x3f93e7=process['cwd'](),process['chdir'](_0x1f1879));const _0x4aebbc=readConfig(),_0x1ca81d=typeof _0x4aebbc[_0x2be26b(0x14a)]===_0x2be26b(0x139)?_0x4aebbc[_0x2be26b(0x14a)]:undefined,_0x1815c2=_0x414d22||_0x1ca81d||_0x2be26b(0x147);initEnv(_0x1815c2),console[_0x2be26b(0x14c)](_0x2be26b(0x14f)+_0x1815c2+')');const _0x3fd610=getApiDomain()+_0x2be26b(0x164)+_0x372661+_0x2be26b(0x163),_0x1d67e0=await httpRequest(_0x3fd610,{'headers':{'Cookie':getCookie()},'timeout':0xea60,'retries':0x2});if(_0x1d67e0['ok']){const _0x319311=_0x1d67e0['data'];if(_0x319311[_0x2be26b(0x146)]){const _0x388d41=_0x537f55?_0x537f55+'-api':_0x2be26b(0x140),_0x1ab23e=_0x537f55?_0x537f55+_0x2be26b(0x15b):'client';return console[_0x2be26b(0x14c)]('*\x20开始生成\x20API\x20配置文件:'),console['log'](_0x2be26b(0x156)+_0x388d41+_0x2be26b(0x13c)),console['log'](_0x2be26b(0x156)+_0x1ab23e+_0x2be26b(0x149)),console[_0x2be26b(0x14c)](_0x2be26b(0x153)+_0x319311[_0x2be26b(0x13d)][_0x2be26b(0x152)][_0x2be26b(0x15c)]+_0x2be26b(0x160)),await generateApiFile(_0x319311[_0x2be26b(0x13d)][_0x2be26b(0x152)],_0x537f55,_0x372661,!![],_0x1815c2),console[_0x2be26b(0x14c)](_0x2be26b(0x15f)),_0x1f1879&&logger[_0x2be26b(0x13f)](_0x2be26b(0x13a),'API\x20配置拉取成功:\x20'+_0x372661,{'projectPath':_0x1f1879,'appCode':_0x372661,'datasetCount':_0x319311[_0x2be26b(0x13d)][_0x2be26b(0x152)][_0x2be26b(0x15c)],'filePrefix':_0x537f55}),!![];}else return console[_0x2be26b(0x155)]('×\x20服务器返回错误:',_0x319311[_0x2be26b(0x14e)]||_0x2be26b(0x15d)),_0x1f1879&&logger[_0x2be26b(0x155)](_0x2be26b(0x13a),'API\x20配置拉取失败:\x20'+(_0x319311[_0x2be26b(0x14e)]||_0x2be26b(0x15d)),{'projectPath':_0x1f1879,'appCode':_0x372661}),![];}else{if(_0x1d67e0[_0x2be26b(0x145)]===0x191){const _0xb4584='获取数据集失败,原因:登录鉴权失败,登录已过期';console[_0x2be26b(0x155)]('×\x20'+_0xb4584),_0x1f1879&&logger[_0x2be26b(0x155)](_0x2be26b(0x13a),_0xb4584,{'status':_0x1d67e0[_0x2be26b(0x145)],'appCode':_0x372661,'url':_0x1d67e0['url'],'projectPath':_0x1f1879});}else{const _0x5253e2=_0x2be26b(0x157)+_0x1d67e0[_0x2be26b(0x145)];console[_0x2be26b(0x155)]('×\x20'+_0x5253e2);try{const _0x4126fd=await _0x1d67e0[_0x2be26b(0x142)]();_0x4126fd&&console['error'](_0x2be26b(0x161),_0x4126fd),_0x1f1879&&logger[_0x2be26b(0x155)](_0x2be26b(0x13a),_0x5253e2,{'status':_0x1d67e0['status'],'appCode':_0x372661,'url':_0x1d67e0[_0x2be26b(0x13b)],'errorBody':_0x4126fd,'projectPath':_0x1f1879});}catch(_0x1934c2){console[_0x2be26b(0x155)](_0x2be26b(0x15e)),_0x1f1879&&logger['error'](_0x2be26b(0x13a),_0x5253e2+',且无法读取错误响应内容',{'status':_0x1d67e0['status'],'appCode':_0x372661,'url':_0x1d67e0['url'],'readError':_0x1934c2 instanceof Error?_0x1934c2[_0x2be26b(0x14e)]:String(_0x1934c2),'projectPath':_0x1f1879});}}return![];}}catch(_0x229418){const _0x45fbc0=_0x229418 instanceof Error?_0x229418[_0x2be26b(0x14e)]:String(_0x229418);return console[_0x2be26b(0x155)](_0x2be26b(0x141),_0x45fbc0),_0x1f1879&&logger[_0x2be26b(0x155)](_0x2be26b(0x13a),_0x2be26b(0x158)+_0x45fbc0,{'appCode':_0x372661,'projectPath':_0x1f1879}),![];}finally{_0x3f93e7&&process[_0x2be26b(0x162)](_0x3f93e7);}}
1
+ (function(_0x5e3972,_0x4d9c87){const _0x5c29b7=a7_0x12c3,_0x5ebf8e=_0x5e3972();while(!![]){try{const _0x21027b=-parseInt(_0x5c29b7(0x1a6))/0x1*(parseInt(_0x5c29b7(0x1b8))/0x2)+parseInt(_0x5c29b7(0x19b))/0x3+-parseInt(_0x5c29b7(0x192))/0x4*(-parseInt(_0x5c29b7(0x195))/0x5)+-parseInt(_0x5c29b7(0x194))/0x6*(parseInt(_0x5c29b7(0x19f))/0x7)+parseInt(_0x5c29b7(0x1ab))/0x8*(parseInt(_0x5c29b7(0x19d))/0x9)+-parseInt(_0x5c29b7(0x18f))/0xa+parseInt(_0x5c29b7(0x1a5))/0xb;if(_0x21027b===_0x4d9c87)break;else _0x5ebf8e['push'](_0x5ebf8e['shift']());}catch(_0xb81c79){_0x5ebf8e['push'](_0x5ebf8e['shift']());}}}(a7_0x99c8,0xc364c));import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';function a7_0x12c3(_0x4223a0,_0x1294e8){const _0x99c89a=a7_0x99c8();return a7_0x12c3=function(_0x12c390,_0x327432){_0x12c390=_0x12c390-0x18e;let _0x427608=_0x99c89a[_0x12c390];return _0x427608;},a7_0x12c3(_0x4223a0,_0x1294e8);}import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';function a7_0x99c8(){const _0x3ad075=['6147784HmQFuL','status','api','string','-api','-client','API\x20配置拉取成功:\x20','tableData','/smartapi/dataset/getList?appCode=','success','log','data','cwd','2286990HWhbVu','√\x20API\x20配置文件生成完成','test','未知错误','1681230tZatbt','url','create-api-pull','572maKhCI','获取数据集失败,HTTP状态码:\x20','41646WZswfB','7475JvYyIF','获取数据集失败,原因:登录鉴权失败,登录已过期','×\x20API\x20配置拉取异常:','env','text','chdir','3818379KYnoUi','error','9ifGubd','API\x20配置拉取失败:\x20','273ovpWVt','info','×\x20错误详情:','message',',且无法读取错误响应内容','length','1403578HHLleP','1lqJgwx','client','.ts\x20-\x20客户端实例文件','\x20\x20\x20•\x20','×\x20服务器返回错误:'];a7_0x99c8=function(){return _0x3ad075;};return a7_0x99c8();}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{httpRequest}from'../utils/http-client.js';export async function pullApiSilent(_0x2efd51,_0xf51efc,_0x1bcc57,_0x51830d){const _0x5e8b28=a7_0x12c3;let _0x1e122b;try{const _0x4a435f=_0xf51efc?.['trim']()||'';if(_0x4a435f){const _0x4df62d=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x4df62d[_0x5e8b28(0x1ba)](_0x4a435f))return console[_0x5e8b28(0x19c)]('×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。'),![];}_0x1bcc57&&(_0x1e122b=process[_0x5e8b28(0x1b7)](),process[_0x5e8b28(0x19a)](_0x1bcc57));const _0x5786c4=readConfig(),_0x233013=typeof _0x5786c4[_0x5e8b28(0x198)]===_0x5e8b28(0x1ae)?_0x5786c4[_0x5e8b28(0x198)]:undefined,_0x1c1e62=_0x51830d||_0x233013||'online';initEnv(_0x1c1e62),console['log']('*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20'+_0x1c1e62+')');const _0x59a2d2=getApiDomain()+_0x5e8b28(0x1b3)+_0x2efd51+'&pageSize=999&currentPage=1',_0x56c19c=await httpRequest(_0x59a2d2,{'headers':{'Cookie':getCookie()},'timeout':0xea60,'retries':0x2});if(_0x56c19c['ok']){const _0x360cae=_0x56c19c[_0x5e8b28(0x1b6)];if(_0x360cae[_0x5e8b28(0x1b4)]){const _0x5cd6bc=_0x4a435f?_0x4a435f+_0x5e8b28(0x1af):_0x5e8b28(0x1ad),_0x23dab3=_0x4a435f?_0x4a435f+_0x5e8b28(0x1b0):_0x5e8b28(0x1a7);return console[_0x5e8b28(0x1b5)]('*\x20开始生成\x20API\x20配置文件:'),console[_0x5e8b28(0x1b5)](_0x5e8b28(0x1a9)+_0x5cd6bc+'.ts\x20-\x20模型配置文件'),console[_0x5e8b28(0x1b5)](_0x5e8b28(0x1a9)+_0x23dab3+_0x5e8b28(0x1a8)),console[_0x5e8b28(0x1b5)]('*\x20正在处理\x20'+_0x360cae['data'][_0x5e8b28(0x1b2)][_0x5e8b28(0x1a4)]+'\x20个数据集...'),await generateApiFile(_0x360cae[_0x5e8b28(0x1b6)][_0x5e8b28(0x1b2)],_0x4a435f,_0x2efd51,!![],_0x1c1e62),console[_0x5e8b28(0x1b5)](_0x5e8b28(0x1b9)),_0x1bcc57&&logger[_0x5e8b28(0x1a0)](_0x5e8b28(0x191),_0x5e8b28(0x1b1)+_0x2efd51,{'projectPath':_0x1bcc57,'appCode':_0x2efd51,'datasetCount':_0x360cae['data'][_0x5e8b28(0x1b2)][_0x5e8b28(0x1a4)],'filePrefix':_0x4a435f}),!![];}else return console[_0x5e8b28(0x19c)](_0x5e8b28(0x1aa),_0x360cae[_0x5e8b28(0x1a2)]||_0x5e8b28(0x18e)),_0x1bcc57&&logger[_0x5e8b28(0x19c)](_0x5e8b28(0x191),_0x5e8b28(0x19e)+(_0x360cae[_0x5e8b28(0x1a2)]||_0x5e8b28(0x18e)),{'projectPath':_0x1bcc57,'appCode':_0x2efd51}),![];}else{if(_0x56c19c[_0x5e8b28(0x1ac)]===0x191){const _0x2a5da9=_0x5e8b28(0x196);console[_0x5e8b28(0x19c)]('×\x20'+_0x2a5da9),_0x1bcc57&&logger['error'](_0x5e8b28(0x191),_0x2a5da9,{'status':_0x56c19c['status'],'appCode':_0x2efd51,'url':_0x56c19c[_0x5e8b28(0x190)],'projectPath':_0x1bcc57});}else{const _0xdb544a=_0x5e8b28(0x193)+_0x56c19c[_0x5e8b28(0x1ac)];console[_0x5e8b28(0x19c)]('×\x20'+_0xdb544a);try{const _0x4b274f=await _0x56c19c[_0x5e8b28(0x199)]();_0x4b274f&&console[_0x5e8b28(0x19c)](_0x5e8b28(0x1a1),_0x4b274f),_0x1bcc57&&logger[_0x5e8b28(0x19c)](_0x5e8b28(0x191),_0xdb544a,{'status':_0x56c19c[_0x5e8b28(0x1ac)],'appCode':_0x2efd51,'url':_0x56c19c['url'],'errorBody':_0x4b274f,'projectPath':_0x1bcc57});}catch(_0x2166d6){console[_0x5e8b28(0x19c)]('×\x20无法读取错误响应内容'),_0x1bcc57&&logger['error'](_0x5e8b28(0x191),_0xdb544a+_0x5e8b28(0x1a3),{'status':_0x56c19c[_0x5e8b28(0x1ac)],'appCode':_0x2efd51,'url':_0x56c19c[_0x5e8b28(0x190)],'readError':_0x2166d6 instanceof Error?_0x2166d6[_0x5e8b28(0x1a2)]:String(_0x2166d6),'projectPath':_0x1bcc57});}}return![];}}catch(_0xacda30){const _0x1b4930=_0xacda30 instanceof Error?_0xacda30[_0x5e8b28(0x1a2)]:String(_0xacda30);return console[_0x5e8b28(0x19c)](_0x5e8b28(0x197),_0x1b4930),_0x1bcc57&&logger[_0x5e8b28(0x19c)](_0x5e8b28(0x191),'API\x20配置拉取异常:\x20'+_0x1b4930,{'appCode':_0x2efd51,'projectPath':_0x1bcc57}),![];}finally{_0x1e122b&&process[_0x5e8b28(0x19a)](_0x1e122b);}}
package/lib/api/pull.js CHANGED
@@ -1 +1 @@
1
- function a8_0x4a37(){const _0x29ccad=['client','×\x20无法读取错误响应内容','json','exit','获取数据集失败,原因:登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录后再尝试','15469030mmmhGF','.ts\x20-\x20模型配置文件','stdin','data','close','*\x20开始生成\x20API\x20配置文件:','log','trim','1XXQoao','!\x20请使用以下方式之一:','api','api-pull','-api','85iIforn','\x20\x20\x20•\x20','*\x20正在处理\x20','tableData','string','env','1112qYQmyJ',',且无法读取错误响应内容','error','2076738juSFJe','stdout','3254640ypWDqu','\x20\x20\x201.\x20直接指定:\x20lovrabet\x20api\x20pull\x20<app-code>','test','\x22\x20无效','/smartapi/dataset/getList?appCode=','23643LsHdSE','message','app','1292002xyLrIG','url','获取数据集失败,HTTP状态码:\x20','\x20\x20\x202.\x20配置默认值:\x20lovrabet\x20config\x20set\x20app\x20<app-code>','!\x20请输入文件前缀\x20\x1b[90m[留空表示无前缀]\x1b[0m:\x20','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','success','length','status','\x20个数据集...','5230225UlZyZu','93364XnDHmg','\x0a*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','*\x20使用指定的应用AppCode:\x20','×\x20未提供应用AppCode,且配置中也没有默认值','-client','online'];a8_0x4a37=function(){return _0x29ccad;};return a8_0x4a37();}(function(_0x2451e3,_0x2de2cd){const _0x3e351b=a8_0x4b70,_0x22ff26=_0x2451e3();while(!![]){try{const _0x33fd1e=-parseInt(_0x3e351b(0x18e))/0x1*(-parseInt(_0x3e351b(0x170))/0x2)+parseInt(_0x3e351b(0x19e))/0x3+parseInt(_0x3e351b(0x17b))/0x4*(-parseInt(_0x3e351b(0x193))/0x5)+-parseInt(_0x3e351b(0x19c))/0x6+parseInt(_0x3e351b(0x17a))/0x7+-parseInt(_0x3e351b(0x199))/0x8*(-parseInt(_0x3e351b(0x16d))/0x9)+-parseInt(_0x3e351b(0x186))/0xa;if(_0x33fd1e===_0x2de2cd)break;else _0x22ff26['push'](_0x22ff26['shift']());}catch(_0x161e31){_0x22ff26['push'](_0x22ff26['shift']());}}}(a8_0x4a37,0x871aa));function a8_0x4b70(_0x209bc0,_0x15a61c){const _0x4a375e=a8_0x4a37();return a8_0x4b70=function(_0x4b70e5,_0xc55cd3){_0x4b70e5=_0x4b70e5-0x16d;let _0x768847=_0x4a375e[_0x4b70e5];return _0x768847;},a8_0x4b70(_0x209bc0,_0x15a61c);}import{createInterface}from'node:readline/promises';import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export async function initApi(_0x337f1c,_0xce614b){const _0x4ca24d=a8_0x4b70,_0x2fbacf=readConfig(),_0xc2b655=_0x337f1c||_0x2fbacf?.[_0x4ca24d(0x16f)],_0x4d0310=typeof _0x2fbacf[_0x4ca24d(0x198)]===_0x4ca24d(0x197)?_0x2fbacf[_0x4ca24d(0x198)]:undefined,_0x49dd75=_0xce614b||_0x4d0310||_0x4ca24d(0x180);initEnv(_0x49dd75);(typeof _0xc2b655!==_0x4ca24d(0x197)||!_0xc2b655)&&(_0x337f1c?console['error']('×\x20提供的应用AppCode\x20\x22'+_0x337f1c+_0x4ca24d(0x1a1)):(console[_0x4ca24d(0x19b)](_0x4ca24d(0x17e)),console[_0x4ca24d(0x18c)](_0x4ca24d(0x18f)),console['log'](_0x4ca24d(0x19f)),console['log'](_0x4ca24d(0x173))),process[_0x4ca24d(0x184)](0x1));_0x337f1c?console[_0x4ca24d(0x18c)](_0x4ca24d(0x17d)+_0xc2b655):console[_0x4ca24d(0x18c)]('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0xc2b655+'\x1b[0m');const _0x5d1ddb=createInterface({'input':process[_0x4ca24d(0x188)],'output':process[_0x4ca24d(0x19d)]});let _0x30cf37;try{const _0x202064=await _0x5d1ddb['question'](_0x4ca24d(0x174));_0x30cf37=_0x202064[_0x4ca24d(0x18d)]();if(_0x30cf37){const _0x4094c7=/^[a-zA-Z][a-zA-Z0-9_-]*$/;!_0x4094c7[_0x4ca24d(0x1a0)](_0x30cf37)&&(console[_0x4ca24d(0x19b)](_0x4ca24d(0x175)),process[_0x4ca24d(0x184)](0x1));}}finally{_0x5d1ddb[_0x4ca24d(0x18a)]();}console[_0x4ca24d(0x18c)](_0x4ca24d(0x17c)+_0x49dd75+')');const _0x1af311=await fetch(getApiDomain()+_0x4ca24d(0x1a2)+_0xc2b655+'&pageSize=999&currentPage=1',{'headers':{'Cookie':getCookie()}});if(_0x1af311['ok']){const _0x1cf0e8=await _0x1af311[_0x4ca24d(0x183)]();if(_0x1cf0e8[_0x4ca24d(0x176)]){const _0x3ac09c=_0x30cf37?_0x30cf37+_0x4ca24d(0x192):_0x4ca24d(0x190),_0x21d18c=_0x30cf37?_0x30cf37+_0x4ca24d(0x17f):_0x4ca24d(0x181);console[_0x4ca24d(0x18c)](_0x4ca24d(0x18b)),console[_0x4ca24d(0x18c)](_0x4ca24d(0x194)+_0x3ac09c+_0x4ca24d(0x187)),console['log'](_0x4ca24d(0x194)+_0x21d18c+'.ts\x20-\x20客户端实例文件'),console[_0x4ca24d(0x18c)](_0x4ca24d(0x195)+_0x1cf0e8[_0x4ca24d(0x189)]['tableData'][_0x4ca24d(0x177)]+_0x4ca24d(0x179));const _0x31ae9c=!_0x337f1c;await generateApiFile(_0x1cf0e8[_0x4ca24d(0x189)][_0x4ca24d(0x196)],_0x30cf37,_0xc2b655,_0x31ae9c,_0x49dd75);}}else{if(_0x1af311[_0x4ca24d(0x178)]===0x191){const _0x1a812e=_0x4ca24d(0x185);console['error']('×\x20'+_0x1a812e),logger[_0x4ca24d(0x19b)]('api-pull',_0x1a812e,{'status':_0x1af311['status'],'appCode':_0xc2b655,'url':_0x1af311['url']});}else{const _0x38ea7f=_0x4ca24d(0x172)+_0x1af311[_0x4ca24d(0x178)];console[_0x4ca24d(0x19b)]('×\x20'+_0x38ea7f);try{const _0x4d4bb6=await _0x1af311['text']();_0x4d4bb6?(console[_0x4ca24d(0x19b)]('×\x20错误详情:',_0x4d4bb6),logger['error'](_0x4ca24d(0x191),_0x38ea7f,{'status':_0x1af311['status'],'appCode':_0xc2b655,'url':_0x1af311['url'],'errorBody':_0x4d4bb6})):logger[_0x4ca24d(0x19b)]('api-pull',_0x38ea7f,{'status':_0x1af311['status'],'appCode':_0xc2b655,'url':_0x1af311[_0x4ca24d(0x171)]});}catch(_0x2abd2d){console['error'](_0x4ca24d(0x182)),logger['error'](_0x4ca24d(0x191),_0x38ea7f+_0x4ca24d(0x19a),{'status':_0x1af311[_0x4ca24d(0x178)],'appCode':_0xc2b655,'url':_0x1af311[_0x4ca24d(0x171)],'readError':_0x2abd2d instanceof Error?_0x2abd2d[_0x4ca24d(0x16e)]:String(_0x2abd2d)});}}process[_0x4ca24d(0x184)](0x1);}}
1
+ function a8_0xad0d(_0xb12953,_0x3e6100){const _0x38a178=a8_0x38a1();return a8_0xad0d=function(_0xad0daa,_0x33db13){_0xad0daa=_0xad0daa-0x84;let _0x18eaa2=_0x38a178[_0xad0daa];return _0x18eaa2;},a8_0xad0d(_0xb12953,_0x3e6100);}(function(_0x275600,_0x62cb7e){const _0x8c7877=a8_0xad0d,_0x4c7623=_0x275600();while(!![]){try{const _0x38715e=parseInt(_0x8c7877(0x94))/0x1*(parseInt(_0x8c7877(0xa0))/0x2)+-parseInt(_0x8c7877(0x9d))/0x3+-parseInt(_0x8c7877(0xb1))/0x4+-parseInt(_0x8c7877(0x99))/0x5*(parseInt(_0x8c7877(0xa2))/0x6)+-parseInt(_0x8c7877(0xa7))/0x7+parseInt(_0x8c7877(0xac))/0x8+parseInt(_0x8c7877(0xb3))/0x9;if(_0x38715e===_0x62cb7e)break;else _0x4c7623['push'](_0x4c7623['shift']());}catch(_0x3ec835){_0x4c7623['push'](_0x4c7623['shift']());}}}(a8_0x38a1,0x4dd1e));import{createInterface}from'node:readline/promises';import{readConfig}from'../utils/config.js';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a8_0x38a1(){const _0x305fb3=['.ts\x20-\x20模型配置文件','message','question','1886405Tzzgld','trim','!\x20请输入文件前缀\x20\x1b[90m[留空表示无前缀]\x1b[0m:\x20','exit','675018uanUBl','获取数据集失败,原因:登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录后再尝试','×\x20未提供应用AppCode,且配置中也没有默认值','3368ubbtbw','online','6wQQkJR','!\x20请使用以下方式之一:','close','*\x20开始生成\x20API\x20配置文件:','api','4174513IVDlwv','test','\x1b[90m*\x20使用配置的应用AppCode:\x20',',且无法读取错误响应内容','&pageSize=999&currentPage=1','2798080GQFKxM','×\x20错误详情:','data','env','获取数据集失败,HTTP状态码:\x20','2498472eCBjhE','log','12705030EFFqYC','*\x20使用指定的应用AppCode:\x20','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','\x0a*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','api-pull','\x20\x20\x202.\x20配置默认值:\x20lovrabet\x20config\x20set\x20app\x20<app-code>','\x1b[0m','client','tableData','error','stdout','stdin','-api','\x20\x20\x20•\x20','string','/smartapi/dataset/getList?appCode=','\x20\x20\x201.\x20直接指定:\x20lovrabet\x20api\x20pull\x20<app-code>','status','226GZEdCm','url'];a8_0x38a1=function(){return _0x305fb3;};return a8_0x38a1();}import{logger}from'../utils/logger.js';export async function initApi(_0x23fce0,_0x2de2a7){const _0x1b1dc9=a8_0xad0d,_0x1fb6bf=readConfig(),_0x2f4b42=_0x23fce0||_0x1fb6bf?.['app'],_0xcea3d0=typeof _0x1fb6bf[_0x1b1dc9(0xaf)]===_0x1b1dc9(0x90)?_0x1fb6bf[_0x1b1dc9(0xaf)]:undefined,_0x44bffe=_0x2de2a7||_0xcea3d0||_0x1b1dc9(0xa1);initEnv(_0x44bffe);(typeof _0x2f4b42!==_0x1b1dc9(0x90)||!_0x2f4b42)&&(_0x23fce0?console['error']('×\x20提供的应用AppCode\x20\x22'+_0x23fce0+'\x22\x20无效'):(console[_0x1b1dc9(0x8b)](_0x1b1dc9(0x9f)),console[_0x1b1dc9(0xb2)](_0x1b1dc9(0xa3)),console[_0x1b1dc9(0xb2)](_0x1b1dc9(0x92)),console[_0x1b1dc9(0xb2)](_0x1b1dc9(0x87))),process[_0x1b1dc9(0x9c)](0x1));_0x23fce0?console['log'](_0x1b1dc9(0xb4)+_0x2f4b42):console[_0x1b1dc9(0xb2)](_0x1b1dc9(0xa9)+_0x2f4b42+_0x1b1dc9(0x88));const _0x8da4e0=createInterface({'input':process[_0x1b1dc9(0x8d)],'output':process[_0x1b1dc9(0x8c)]});let _0x1a6f24;try{const _0x314d75=await _0x8da4e0[_0x1b1dc9(0x98)](_0x1b1dc9(0x9b));_0x1a6f24=_0x314d75[_0x1b1dc9(0x9a)]();if(_0x1a6f24){const _0x49de60=/^[a-zA-Z][a-zA-Z0-9_-]*$/;!_0x49de60[_0x1b1dc9(0xa8)](_0x1a6f24)&&(console['error'](_0x1b1dc9(0x84)),process[_0x1b1dc9(0x9c)](0x1));}}finally{_0x8da4e0[_0x1b1dc9(0xa4)]();}console[_0x1b1dc9(0xb2)](_0x1b1dc9(0x85)+_0x44bffe+')');const _0x3f088f=await fetch(getApiDomain()+_0x1b1dc9(0x91)+_0x2f4b42+_0x1b1dc9(0xab),{'headers':{'Cookie':getCookie()}});if(_0x3f088f['ok']){const _0x39192d=await _0x3f088f['json']();if(_0x39192d['success']){const _0x228dbc=_0x1a6f24?_0x1a6f24+_0x1b1dc9(0x8e):_0x1b1dc9(0xa6),_0x42ef75=_0x1a6f24?_0x1a6f24+'-client':_0x1b1dc9(0x89);console[_0x1b1dc9(0xb2)](_0x1b1dc9(0xa5)),console[_0x1b1dc9(0xb2)](_0x1b1dc9(0x8f)+_0x228dbc+_0x1b1dc9(0x96)),console[_0x1b1dc9(0xb2)](_0x1b1dc9(0x8f)+_0x42ef75+'.ts\x20-\x20客户端实例文件'),console[_0x1b1dc9(0xb2)]('*\x20正在处理\x20'+_0x39192d[_0x1b1dc9(0xae)][_0x1b1dc9(0x8a)]['length']+'\x20个数据集...');const _0xcc0232=!_0x23fce0;await generateApiFile(_0x39192d[_0x1b1dc9(0xae)][_0x1b1dc9(0x8a)],_0x1a6f24,_0x2f4b42,_0xcc0232,_0x44bffe);}}else{if(_0x3f088f[_0x1b1dc9(0x93)]===0x191){const _0x3ed1d2=_0x1b1dc9(0x9e);console[_0x1b1dc9(0x8b)]('×\x20'+_0x3ed1d2),logger['error'](_0x1b1dc9(0x86),_0x3ed1d2,{'status':_0x3f088f[_0x1b1dc9(0x93)],'appCode':_0x2f4b42,'url':_0x3f088f['url']});}else{const _0x1dcc60=_0x1b1dc9(0xb0)+_0x3f088f['status'];console[_0x1b1dc9(0x8b)]('×\x20'+_0x1dcc60);try{const _0x50c598=await _0x3f088f['text']();_0x50c598?(console[_0x1b1dc9(0x8b)](_0x1b1dc9(0xad),_0x50c598),logger['error'](_0x1b1dc9(0x86),_0x1dcc60,{'status':_0x3f088f[_0x1b1dc9(0x93)],'appCode':_0x2f4b42,'url':_0x3f088f[_0x1b1dc9(0x95)],'errorBody':_0x50c598})):logger['error'](_0x1b1dc9(0x86),_0x1dcc60,{'status':_0x3f088f[_0x1b1dc9(0x93)],'appCode':_0x2f4b42,'url':_0x3f088f['url']});}catch(_0x1eff7c){console[_0x1b1dc9(0x8b)]('×\x20无法读取错误响应内容'),logger[_0x1b1dc9(0x8b)](_0x1b1dc9(0x86),_0x1dcc60+_0x1b1dc9(0xaa),{'status':_0x3f088f[_0x1b1dc9(0x93)],'appCode':_0x2f4b42,'url':_0x3f088f[_0x1b1dc9(0x95)],'readError':_0x1eff7c instanceof Error?_0x1eff7c[_0x1b1dc9(0x97)]:String(_0x1eff7c)});}}process[_0x1b1dc9(0x9c)](0x1);}}
@@ -1 +1 @@
1
- (function(_0x336ca7,_0xfa073a){const _0x319cc1=a10_0x599e,_0x57b75d=_0x336ca7();while(!![]){try{const _0x20698c=-parseInt(_0x319cc1(0x1e0))/0x1+parseInt(_0x319cc1(0x1d5))/0x2*(parseInt(_0x319cc1(0x1dd))/0x3)+-parseInt(_0x319cc1(0x1d2))/0x4*(-parseInt(_0x319cc1(0x1d9))/0x5)+-parseInt(_0x319cc1(0x1d3))/0x6*(parseInt(_0x319cc1(0x1e5))/0x7)+parseInt(_0x319cc1(0x1d4))/0x8*(-parseInt(_0x319cc1(0x1e3))/0x9)+-parseInt(_0x319cc1(0x1d6))/0xa*(parseInt(_0x319cc1(0x1e7))/0xb)+parseInt(_0x319cc1(0x1d1))/0xc*(parseInt(_0x319cc1(0x1d8))/0xd);if(_0x20698c===_0xfa073a)break;else _0x57b75d['push'](_0x57b75d['shift']());}catch(_0x2d4b77){_0x57b75d['push'](_0x57b75d['shift']());}}}(a10_0x32a7,0xd6087));import{jsx as a10_0x5d61ea,jsxs as a10_0x1dfed4}from'react/jsx-runtime';import{Text,Box,useInput,useApp}from'ink';import{useEffect,useState}from'react';import{getIsSessionValid}from'./is-session-valid.js';import{authServer}from'./auth-server.js';function a10_0x599e(_0x21d3e3,_0x1cbba2){const _0x32a791=a10_0x32a7();return a10_0x599e=function(_0x599ee4,_0x227561){_0x599ee4=_0x599ee4-0x1d0;let _0x5085d0=_0x32a791[_0x599ee4];return _0x5085d0;},a10_0x599e(_0x21d3e3,_0x1cbba2);}import a10_0x478f75 from'ink-spinner';export function AuthServer(){const _0x24ecd3=a10_0x599e,{exit:_0x100c09}=useApp(),[_0x2a8334,_0x343433]=useState(![]),[_0x5c5d44,_0x3e0b08]=useState(!![]),[_0xca7371,_0x355729]=useState(![]),[_0x5228d1,_0x6ebc02]=useState(![]);useEffect(()=>{const _0x20562c=a10_0x599e;getIsSessionValid()[_0x20562c(0x1e2)](_0x343433)[_0x20562c(0x1df)](()=>_0x3e0b08(![]));},[]),useEffect(()=>{const _0x4633a3=a10_0x599e;!_0x5c5d44&&_0x2a8334&&(console[_0x4633a3(0x1de)](_0x4633a3(0x1e4)),_0x100c09());},[_0x5c5d44,_0x2a8334,_0x100c09]),useEffect(()=>{const _0x233037=a10_0x599e;_0x5228d1&&(console[_0x233037(0x1de)](_0x233037(0x1e6)),_0x100c09());},[_0x5228d1,_0x100c09]),useInput((_0x15d354,_0x4387a9)=>{_0x4387a9['return']&&(_0x355729(!![]),authServer({'silent':!![]})['then'](_0x121dec=>{_0x6ebc02(_0x121dec);})),_0x15d354==='q'&&_0x100c09();});if(_0x5c5d44)return null;if(_0x2a8334||_0x5228d1)return null;return a10_0x5d61ea(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':_0xca7371?a10_0x1dfed4(Box,{'children':[a10_0x5d61ea(Box,{'width':'1'}),a10_0x1dfed4(Text,{'color':_0x24ecd3(0x1e1),'children':[a10_0x5d61ea(a10_0x478f75,{'type':_0x24ecd3(0x1db)}),'\x20\x20']}),a10_0x5d61ea(Text,{'children':_0x24ecd3(0x1d0)}),a10_0x5d61ea(Text,{'color':_0x24ecd3(0x1dc),'children':_0x24ecd3(0x1da)})]}):a10_0x1dfed4(Box,{'children':[a10_0x5d61ea(Box,{'width':'1'}),a10_0x5d61ea(Text,{'children':'*\x20按回车开始登录。'}),a10_0x5d61ea(Text,{'color':_0x24ecd3(0x1dc),'children':_0x24ecd3(0x1d7)})]})});}function a10_0x32a7(){const _0x644f2e=['75558ljPqBX','324024DBBdGF','337646COXCSv','71210ysIqcM','按\x20“q”\x20退出。','13SAGCOa','40wFsEjE','请前往浏览器完成登录。','dots','gray','15wHXoNv','log','finally','680559ptgAQn','green','then','333doDzYm','√\x20当前为有效会话,无需重新登录。','707zPaaWw','*\x20登录成功!','143ZcOGZD','正在登录...\x20','26821152PPjYLa','670552HFemkB'];a10_0x32a7=function(){return _0x644f2e;};return a10_0x32a7();}
1
+ (function(_0x3fb5fa,_0x5e6df6){const _0x38d2bb=a10_0x20b0,_0x592c9c=_0x3fb5fa();while(!![]){try{const _0x22b42e=parseInt(_0x38d2bb(0xaf))/0x1+parseInt(_0x38d2bb(0xb5))/0x2*(parseInt(_0x38d2bb(0xa7))/0x3)+parseInt(_0x38d2bb(0xad))/0x4+-parseInt(_0x38d2bb(0xa6))/0x5*(parseInt(_0x38d2bb(0xb1))/0x6)+-parseInt(_0x38d2bb(0xa2))/0x7*(parseInt(_0x38d2bb(0xaa))/0x8)+parseInt(_0x38d2bb(0xae))/0x9*(-parseInt(_0x38d2bb(0xa1))/0xa)+parseInt(_0x38d2bb(0xa9))/0xb;if(_0x22b42e===_0x5e6df6)break;else _0x592c9c['push'](_0x592c9c['shift']());}catch(_0x35e632){_0x592c9c['push'](_0x592c9c['shift']());}}}(a10_0x4857,0x2957a));function a10_0x4857(){const _0x56efd1=['gray','按\x20“q”\x20退出。','2FLEMbo','dots','10bXoaVB','113981tnGkIY','column','*\x20按回车开始登录。','√\x20当前为有效会话,无需重新登录。','73630GBIDKv','172281SzyNnS','finally','925320SqlhTE','8yHonbS','请前往浏览器完成登录。','*\x20登录成功!','412600jmyrrv','3046239sydDpy','294121dThkev','then','6UNYxmu','green'];a10_0x4857=function(){return _0x56efd1;};return a10_0x4857();}import{jsx as a10_0x198728,jsxs as a10_0x7d7d19}from'react/jsx-runtime';import{Text,Box,useInput,useApp}from'ink';import{useEffect,useState}from'react';import{getIsSessionValid}from'./is-session-valid.js';import{authServer}from'./auth-server.js';function a10_0x20b0(_0x760ea5,_0x1d17c5){const _0x485706=a10_0x4857();return a10_0x20b0=function(_0x20b07e,_0xf51387){_0x20b07e=_0x20b07e-0xa0;let _0x3a4e13=_0x485706[_0x20b07e];return _0x3a4e13;},a10_0x20b0(_0x760ea5,_0x1d17c5);}import a10_0x5e6286 from'ink-spinner';export function AuthServer(){const _0x12a6eb=a10_0x20b0,{exit:_0x7412de}=useApp(),[_0xba297c,_0x3d8a8d]=useState(![]),[_0x4a6751,_0x44210e]=useState(!![]),[_0x48c498,_0x79fa88]=useState(![]),[_0x2680c3,_0x15f429]=useState(![]);useEffect(()=>{const _0x2c5734=a10_0x20b0;getIsSessionValid()['then'](_0x3d8a8d)[_0x2c5734(0xa8)](()=>_0x44210e(![]));},[]),useEffect(()=>{const _0x49c8eb=a10_0x20b0;!_0x4a6751&&_0xba297c&&(console['log'](_0x49c8eb(0xa5)),_0x7412de());},[_0x4a6751,_0xba297c,_0x7412de]),useEffect(()=>{const _0x1f15f4=a10_0x20b0;_0x2680c3&&(console['log'](_0x1f15f4(0xac)),_0x7412de());},[_0x2680c3,_0x7412de]),useInput((_0x76c96a,_0x4acad2)=>{const _0x4ee66e=a10_0x20b0;_0x4acad2['return']&&(_0x79fa88(!![]),authServer({'silent':!![]})[_0x4ee66e(0xb0)](_0x3ff599=>{_0x15f429(_0x3ff599);})),_0x76c96a==='q'&&_0x7412de();});if(_0x4a6751)return null;if(_0xba297c||_0x2680c3)return null;return a10_0x198728(Box,{'flexDirection':_0x12a6eb(0xa3),'marginTop':0x1,'marginBottom':0x1,'children':_0x48c498?a10_0x7d7d19(Box,{'children':[a10_0x198728(Box,{'width':'1'}),a10_0x7d7d19(Text,{'color':_0x12a6eb(0xb2),'children':[a10_0x198728(a10_0x5e6286,{'type':_0x12a6eb(0xa0)}),'\x20\x20']}),a10_0x198728(Text,{'children':'正在登录...\x20'}),a10_0x198728(Text,{'color':_0x12a6eb(0xb3),'children':_0x12a6eb(0xab)})]}):a10_0x7d7d19(Box,{'children':[a10_0x198728(Box,{'width':'1'}),a10_0x198728(Text,{'children':_0x12a6eb(0xa4)}),a10_0x198728(Text,{'color':'gray','children':_0x12a6eb(0xb4)})]})});}