@lovrabet/cli 1.1.0 → 1.1.2

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 (43) hide show
  1. package/README.md +289 -14
  2. package/lib/add-page/input-page-router.js +1 -1
  3. package/lib/add-page/main.js +1 -1
  4. package/lib/add-page/select-page-template.js +1 -1
  5. package/lib/api/api-pull-ui.js +1 -1
  6. package/lib/api/format-dataset.js +1 -1
  7. package/lib/api/generate-api-file.js +1 -1
  8. package/lib/api/main.js +1 -1
  9. package/lib/api/pull-silent.js +1 -1
  10. package/lib/api/pull.js +1 -1
  11. package/lib/auth/auth-server-ui.js +1 -1
  12. package/lib/auth/auth-server.js +1 -1
  13. package/lib/auth/constant.js +1 -1
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/is-session-valid.js +1 -1
  16. package/lib/auth/logout.js +1 -1
  17. package/lib/cli.js +1 -1
  18. package/lib/cmd/build-watch.js +1 -1
  19. package/lib/cmd/build.js +1 -1
  20. package/lib/cmd/logs.js +1 -1
  21. package/lib/cmd/preview.js +1 -1
  22. package/lib/cmd/start.js +1 -1
  23. package/lib/config/config-help.js +1 -1
  24. package/lib/config/main.js +1 -1
  25. package/lib/constant/domain.js +1 -1
  26. package/lib/constant/env.js +1 -1
  27. package/lib/create-app/enhanced-guided-create.js +1 -1
  28. package/lib/create-app/format-elapsed.js +1 -1
  29. package/lib/create-app/main.js +1 -1
  30. package/lib/create-app/task-finished.js +1 -1
  31. package/lib/create-app/task-loading.js +1 -1
  32. package/lib/create-app/task-running.js +1 -1
  33. package/lib/create-app/task-time.js +1 -1
  34. package/lib/create-app/use-copy-project-template.js +1 -1
  35. package/lib/create-app/use-format-code.js +1 -1
  36. package/lib/create-app/use-install-dependencies.js +1 -1
  37. package/lib/help.js +1 -1
  38. package/lib/utils/config.js +1 -1
  39. package/lib/utils/copy-directory.js +1 -1
  40. package/lib/utils/logger.js +1 -1
  41. package/lib/utils/router-updater.js +1 -1
  42. package/lib/utils/template-replacer.js +1 -1
  43. package/package.json +1 -1
package/README.md CHANGED
@@ -1,28 +1,303 @@
1
- # lovrabet
1
+ # Lovrabet CLI
2
2
 
3
- ## 内部体验试用
3
+ 一个强大的前端开发脚手架工具,专为 Lovrabet 数据平台应用开发而设计。提供项目创建、页面生成、API 集成、开发调试等全套开发工具链。
4
4
 
5
- ### 安装
5
+ ## ✨ 特性
6
+
7
+ - 🚀 **快速创建项目** - 基于模板快速生成完整的前端应用项目
8
+ - 📄 **智能页面生成** - 自动生成页面组件和路由配置
9
+ - 🔐 **统一身份认证** - 集成 Lovrabet 平台登录和权限管理
10
+ - 🌐 **API 自动生成** - 根据数据集自动生成 API 配置文件
11
+ - ⚡ **开发服务器** - 内置热更新开发服务器
12
+ - 🏗️ **智能构建** - 优化的生产环境构建配置
13
+ - 📦 **模板管理** - 丰富的项目模板和组件模板
14
+ - 📝 **日志管理** - 完整的开发日志记录和查看
15
+
16
+ ## 📦 安装
17
+
18
+ ### 全局安装(推荐)
6
19
 
7
20
  ```bash
8
- $ bun install --global @lovrabet/cli
21
+ # 使用 npm
22
+ npm install -g @lovrabet/cli
23
+
24
+ # 使用 bun(推荐)
25
+ bun install -g @lovrabet/cli
9
26
  ```
10
27
 
11
-
28
+ ### 验证安装
12
29
 
13
30
  ```bash
14
- $ npm install --global @lovrabet/cli
31
+ lovrabet --help
32
+ ```
33
+
34
+ ## 🚀 快速上手
35
+
36
+ ### 1. 登录认证
15
37
 
38
+ 首先需要登录 Lovrabet 平台获取访问权限:
39
+
40
+ ```bash
41
+ lovrabet auth
16
42
  ```
17
43
 
18
- ## 查看命令帮助
44
+ 这会打开浏览器登录页面,完成登录后 CLI 会自动保存认证信息。
19
45
 
20
- lovrabet --help
46
+ ### 2. 创建项目
47
+
48
+ ```bash
49
+ lovrabet create
50
+ ```
51
+
52
+ CLI 会引导您选择项目模板并创建完整的项目结构。
53
+
54
+ ### 3. 启动开发
55
+
56
+ 进入项目目录并启动开发服务器:
57
+
58
+ ```bash
59
+ cd your-project
60
+ lovrabet start
61
+ ```
62
+
63
+ ### 4. 生成 API 配置[可选]
64
+
65
+ 如果在create的时候未选择自动更新API列表,或者API已经发生变化,可以手动根据应用的appcode自动生成 API 配置:
66
+
67
+ ```bash
68
+ lovrabet api pull [app-code]
69
+ ```
70
+
71
+ ### 5. 添加页面
72
+
73
+ 在项目中快速添加新页面:
74
+
75
+ ```bash
76
+ lovrabet add page
77
+ ```
78
+
79
+ ## 📚 命令详解
80
+
81
+ ### 项目管理
82
+
83
+ #### `lovrabet create [项目名]`
84
+
85
+ 创建新的前端应用项目
86
+
87
+ - **功能**: 基于预设模板创建完整的项目结构
88
+ - **模板类型**:
89
+ - React 单页应用
90
+ - 多页面应用
91
+ - 组件库项目
92
+ - **自动配置**: 路由、状态管理、API 集成、构建配置
93
+
94
+ #### `lovrabet add page`
95
+
96
+ 添加新页面到当前项目
97
+
98
+ - **功能**: 自动生成页面组件、样式文件和路由配置
99
+ - **支持**: 嵌套路由、动态路由、页面模板选择
100
+ - **自动更新**: 路由配置文件和导航菜单
101
+
102
+ ### 开发调试
103
+
104
+ #### `lovrabet start`
105
+
106
+ 启动开发服务器
107
+
108
+ - **热更新**: 文件变化自动刷新
109
+ - **代理配置**: 自动配置 API 代理
110
+ - **错误提示**: 友好的错误信息和调试提示
111
+
112
+ #### `lovrabet build`
113
+
114
+ 构建生产版本
115
+
116
+ - **代码压缩**: 自动压缩 JS、CSS、HTML
117
+ - **资源优化**: 图片压缩、字体子集化
118
+ - **缓存优化**: 文件名哈希、分包策略
119
+
120
+ #### `lovrabet preview [--watch]`
121
+
122
+ 预览构建结果
123
+
124
+ - **本地服务**: 启动本地预览服务器
125
+ - **监听模式**: `--watch` 参数自动重新构建
126
+
127
+ ### API 集成
128
+
129
+ #### `lovrabet api pull [app-code]`
130
+
131
+ 拉取并生成 API 配置文件
132
+
133
+ - **自动发现**: 扫描应用数据集和接口
134
+ - **类型生成**: 自动生成 TypeScript 类型定义
135
+ - **配置生成**: 生成 SDK 配置文件
136
+
137
+ ### 身份认证
138
+
139
+ #### `lovrabet auth`
140
+
141
+ 登录 Lovrabet 平台
142
+
143
+ - **浏览器登录**: 打开浏览器进行 OAuth 登录
144
+ - **令牌管理**: 自动保存和刷新访问令牌
145
+ - **权限验证**: 验证项目访问权限
146
+
147
+ #### `lovrabet logout`
148
+
149
+ 退出登录
150
+
151
+ - **清理令牌**: 清除本地保存的认证信息
152
+ - **安全退出**: 通知服务器撤销令牌
153
+
154
+ ### 配置管理
155
+
156
+ #### `lovrabet config`
157
+
158
+ 项目配置管理
159
+
160
+ - **应用绑定**: 绑定 Lovrabet 应用
161
+ - **环境配置**: 开发/生产环境切换
162
+ - **API 配置**: 数据集和接口配置
163
+
164
+ ### 日志管理
165
+
166
+ #### `lovrabet logs`
167
+
168
+ 查看开发日志
169
+
170
+ ```bash
171
+ lovrabet logs # 查看最新日志
172
+ lovrabet logs --clear # 清空日志记录
173
+ ```
174
+
175
+ ## 🏗️ 项目结构
176
+
177
+ CLI 创建的项目具有以下标准结构:
178
+
179
+ ```
180
+ your-project/
181
+ ├── src/
182
+ │ ├── components/ # 公共组件
183
+ │ ├── pages/ # 页面组件
184
+ │ ├── layouts/ # 布局组件
185
+ │ ├── api/ # API 配置
186
+ │ ├── utils/ # 工具函数
187
+ │ ├── router/ # 路由配置
188
+ │ └── main.tsx # 入口文件
189
+ ├── public/ # 静态资源
190
+ ├── docs/ # 项目文档
191
+ ├── package.json # 项目配置
192
+ ├── vite.config.ts # 构建配置
193
+ ├── tsconfig.json # TypeScript 配置
194
+ └── lovrabet.config.js # Lovrabet 配置
195
+ ```
196
+
197
+ ## ⚙️ 配置文件
198
+
199
+ ### `lovrabet.config.js`
200
+
201
+ 项目根目录的配置文件,用于配置应用信息和 API:
202
+
203
+ ```javascript
204
+ module.exports = {
205
+ appCode: "your-app-code",
206
+ env: "online", // 或 "daily"
207
+ models: {
208
+ Users: {
209
+ tableName: "users",
210
+ datasetId: "your-dataset-id",
211
+ },
212
+ // 更多模型配置...
213
+ },
214
+ };
215
+ ```
216
+
217
+ ## 🔧 环境要求
218
+
219
+ - **Node.js**: >= 20.0.0
220
+ - **包管理器**: npm、yarn 或 bun
221
+ - **浏览器**: Chrome、Firefox、Safari、Edge 等现代浏览器
222
+
223
+ ## 🎯 使用场景
224
+
225
+ ### 快速原型开发
226
+
227
+ ```bash
228
+ lovrabet create prototype-app
229
+ cd prototype-app
230
+ lovrabet api pull your-app-code
231
+ lovrabet start
232
+ ```
233
+
234
+ ### 企业级应用开发
235
+
236
+ ```bash
237
+ lovrabet create enterprise-app
238
+ cd enterprise-app
239
+ lovrabet config # 配置生产环境
240
+ lovrabet add page # 添加业务页面
241
+ lovrabet build # 构建生产版本
242
+ ```
243
+
244
+ ### 组件库开发
245
+
246
+ ```bash
247
+ lovrabet create component-library
248
+ cd component-library
249
+ # 开发和测试组件...
250
+ lovrabet build
251
+ ```
252
+
253
+ ## 🆘 故障排除
254
+
255
+ ### 常见问题
256
+
257
+ **Q: 登录失败或权限不足?**
258
+ A: 确保您有 Lovrabet 平台的访问权限,尝试重新登录:
259
+
260
+ ```bash
261
+ lovrabet logout
262
+ lovrabet auth
263
+ ```
264
+
265
+ **Q: API 拉取失败?**
266
+ A: 检查应用代码是否正确,确认您有该应用的访问权限:
267
+
268
+ ```bash
269
+ lovrabet api pull correct-app-code
270
+ ```
271
+
272
+ **Q: 构建错误?**
273
+ A: 查看详细错误信息:
274
+
275
+ ```bash
276
+ lovrabet logs
277
+ ```
278
+
279
+ **Q: 开发服务器启动失败?**
280
+ A: 检查端口是否被占用,或指定其他端口。
281
+
282
+ ### 日志和调试
283
+
284
+ 查看详细的操作日志:
285
+
286
+ ```bash
287
+ lovrabet logs
288
+ ```
289
+
290
+ 清空日志记录:
291
+
292
+ ```bash
293
+ lovrabet logs --clear
294
+ ```
295
+
296
+ ## 📖 更多资源
297
+
298
+ - [Lovrabet SDK 使用指南](https://www.npmjs.com/package/@lovrabet/sdk)
299
+ - [示例项目](https://github.com/lovrabet-ai/sub-app-react-demo)
21
300
 
22
- ## 试用目标
301
+ ---
23
302
 
24
- 1. 创建一个项目
25
- 2. 创建一个页面
26
- 3. 登录鉴权
27
- 4. 绑定应用
28
- 5. 生成数据集 api 文件
303
+ **开始您的 Lovrabet 应用开发之旅!** 🎉
@@ -1 +1 @@
1
- (function(_0x1e5230,_0x562407){const _0x32411a=a0_0x467e,_0x22ae19=_0x1e5230();while(!![]){try{const _0xb12019=parseInt(_0x32411a(0x7a))/0x1*(parseInt(_0x32411a(0x75))/0x2)+-parseInt(_0x32411a(0x74))/0x3*(parseInt(_0x32411a(0x73))/0x4)+-parseInt(_0x32411a(0x72))/0x5+-parseInt(_0x32411a(0x7f))/0x6+-parseInt(_0x32411a(0x7d))/0x7*(-parseInt(_0x32411a(0x7c))/0x8)+parseInt(_0x32411a(0x8a))/0x9*(parseInt(_0x32411a(0x84))/0xa)+-parseInt(_0x32411a(0x76))/0xb;if(_0xb12019===_0x562407)break;else _0x22ae19['push'](_0x22ae19['shift']());}catch(_0x47f191){_0x22ae19['push'](_0x22ae19['shift']());}}}(a0_0x22f0,0x3f34b));function a0_0x22f0(){const _0x5f5b84=['页面路径不合法','gray','startsWith','371830MVymqO','24YoucZQ','167307UleieO','743092xvsNSt','1210033JHIrVu','\x20直接回车确认,或输入自定义路由地址','red','column','1yzyzxr','split','2824952ofUTNd','7oihqLD','green','2712312zuslWf','路径不能包含连续的\x20/','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','delete','页面路径长度不能超过\x20100\x20个字符','5052610JWwAnv','页面路由地址:\x20','\x20已存在,请使用其他路径','includes','my-page','existsSync','9vPLmRZ','路径不能以\x20/\x20开头或结尾'];a0_0x22f0=function(){return _0x5f5b84;};return a0_0x22f0();}function a0_0x467e(_0xa377dd,_0x4040f8){const _0x22f042=a0_0x22f0();return a0_0x467e=function(_0x467e07,_0x5c1d99){_0x467e07=_0x467e07-0x72;let _0x3f0f00=_0x22f042[_0x467e07];return _0x3f0f00;},a0_0x467e(_0xa377dd,_0x4040f8);}import{jsx as a0_0x5f1b17,jsxs as a0_0xb51a28}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0xd35c4b from'node:fs';export function InputProjectCode(_0x179559){const _0x3421cb=a0_0x467e,{onSubmit:_0x35f247,pagePath:_0x452cda}=_0x179559,[_0x332c93,_0x125bb4]=useState(''),[_0x1389db,_0x454b2a]=useState(''),_0x178711=_0x3421cb(0x88);function _0x25faf5(_0x272b34){const _0x5d1222=_0x3421cb;if(_0x272b34['length']>0x64)return{'valid':![],'message':_0x5d1222(0x83)};if(_0x272b34[_0x5d1222(0x8e)]('/')||_0x272b34['endsWith']('/'))return{'valid':![],'message':_0x5d1222(0x8b)};if(_0x272b34[_0x5d1222(0x87)]('//'))return{'valid':![],'message':_0x5d1222(0x80)};const _0x528081=_0x272b34[_0x5d1222(0x7b)]('/');for(const _0x402bbf of _0x528081){if(!_0x402bbf)continue;const _0xb8db0c=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0xb8db0c['test'](_0x402bbf))return{'valid':![],'message':_0x5d1222(0x81)};}return{'valid':!![]};}return useInput((_0x1e06c0,_0xcf9287)=>{const _0x3d3563=_0x3421cb;if(_0xcf9287['return']){const _0x5db97d=_0x332c93['trim']()||_0x178711;if(_0x1389db)return;const _0x4ad7f9=_0x452cda+'/'+_0x5db97d;if(a0_0xd35c4b[_0x3d3563(0x89)](_0x4ad7f9)){_0x454b2a('页面路径\x20'+_0x5db97d+_0x3d3563(0x86));return;}_0x35f247(_0x5db97d),_0x125bb4(''),_0x454b2a('');}else _0xcf9287['backspace']||_0xcf9287[_0x3d3563(0x82)]?_0x125bb4(_0xee6eeb=>{const _0x11b0c2=_0xee6eeb['slice'](0x0,-0x1),{valid:_0x3dd5e2,message:_0xad4f05}=_0x25faf5(_0x11b0c2);return _0x454b2a(_0x3dd5e2?'':_0xad4f05||'页面路径不合法'),_0x11b0c2;}):_0x125bb4(_0x36927f=>{const _0x275c1b=_0x3d3563,_0x19866c=_0x36927f+_0x1e06c0,{valid:_0x26d626,message:_0x49b3c0}=_0x25faf5(_0x19866c);return _0x454b2a(_0x26d626?'':_0x49b3c0||_0x275c1b(0x8c)),_0x19866c;});}),a0_0xb51a28(Box,{'flexDirection':_0x3421cb(0x79),'children':[a0_0xb51a28(Box,{'children':[a0_0x5f1b17(Text,{'color':'gray','children':'\x20Step2:\x20'}),a0_0x5f1b17(Text,{'children':_0x3421cb(0x85)}),_0x332c93?a0_0x5f1b17(Text,{'color':_0x3421cb(0x7e),'children':_0x332c93}):a0_0x5f1b17(Text,{'color':'gray','children':_0x178711}),_0x1389db&&a0_0xb51a28(Text,{'color':_0x3421cb(0x78),'children':['\x20←\x20',_0x1389db]})]}),!_0x1389db&&!_0x332c93&&a0_0x5f1b17(Box,{'children':a0_0x5f1b17(Text,{'color':_0x3421cb(0x8d),'children':_0x3421cb(0x77)})})]});}
1
+ (function(_0x56d18f,_0x36917f){const _0x287e4b=a0_0x3359,_0x238a4e=_0x56d18f();while(!![]){try{const _0x4aa739=parseInt(_0x287e4b(0x16a))/0x1*(parseInt(_0x287e4b(0x159))/0x2)+-parseInt(_0x287e4b(0x16e))/0x3+-parseInt(_0x287e4b(0x166))/0x4*(-parseInt(_0x287e4b(0x16b))/0x5)+parseInt(_0x287e4b(0x167))/0x6+-parseInt(_0x287e4b(0x16f))/0x7+-parseInt(_0x287e4b(0x15c))/0x8+parseInt(_0x287e4b(0x172))/0x9;if(_0x4aa739===_0x36917f)break;else _0x238a4e['push'](_0x238a4e['shift']());}catch(_0x449cf1){_0x238a4e['push'](_0x238a4e['shift']());}}}(a0_0x25ab,0x810a8));function a0_0x3359(_0x5a5eb8,_0xee0ea0){const _0x25abc1=a0_0x25ab();return a0_0x3359=function(_0x335990,_0x173a3a){_0x335990=_0x335990-0x159;let _0x56c78a=_0x25abc1[_0x335990];return _0x56c78a;},a0_0x3359(_0x5a5eb8,_0xee0ea0);}import{jsx as a0_0x33b031,jsxs as a0_0x59d093}from'react/jsx-runtime';import{useState}from'react';function a0_0x25ab(){const _0x37a14c=['startsWith','4562136suGrIV','split','路径不能以\x20/\x20开头或结尾','trim','test','\x20直接回车确认,或输入自定义路由地址','\x20已存在,请使用其他路径','length','my-page','existsSync','407384NyzMSv','4729548RNqsms','green','gray','53962DjbKYc','5JTLLUL','delete','\x20Step2:\x20','2330790OzAOhC','5473580banseg','endsWith','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','14451291lNyTrt','\x20←\x20','页面路径不合法','includes','6begXby','red'];a0_0x25ab=function(){return _0x37a14c;};return a0_0x25ab();}import{Text,Box,useInput}from'ink';import a0_0x57dd1f from'node:fs';export function InputProjectCode(_0x390ee6){const _0x7786e9=a0_0x3359,{onSubmit:_0x797a67,pagePath:_0x8db58c}=_0x390ee6,[_0x45d697,_0x1cc0f0]=useState(''),[_0x175db1,_0x313900]=useState(''),_0xf69051=_0x7786e9(0x164);function _0x2096b5(_0x1df182){const _0x554a00=_0x7786e9;if(_0x1df182[_0x554a00(0x163)]>0x64)return{'valid':![],'message':'页面路径长度不能超过\x20100\x20个字符'};if(_0x1df182[_0x554a00(0x15b)]('/')||_0x1df182[_0x554a00(0x170)]('/'))return{'valid':![],'message':_0x554a00(0x15e)};if(_0x1df182[_0x554a00(0x175)]('//'))return{'valid':![],'message':'路径不能包含连续的\x20/'};const _0xfdde9b=_0x1df182[_0x554a00(0x15d)]('/');for(const _0x5a2236 of _0xfdde9b){if(!_0x5a2236)continue;const _0x3b62ca=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x3b62ca[_0x554a00(0x160)](_0x5a2236))return{'valid':![],'message':_0x554a00(0x171)};}return{'valid':!![]};}return useInput((_0x5df5d3,_0x1ffe83)=>{const _0x4188e6=_0x7786e9;if(_0x1ffe83['return']){const _0x1e5535=_0x45d697[_0x4188e6(0x15f)]()||_0xf69051;if(_0x175db1)return;const _0x509080=_0x8db58c+'/'+_0x1e5535;if(a0_0x57dd1f[_0x4188e6(0x165)](_0x509080)){_0x313900('页面路径\x20'+_0x1e5535+_0x4188e6(0x162));return;}_0x797a67(_0x1e5535),_0x1cc0f0(''),_0x313900('');}else _0x1ffe83['backspace']||_0x1ffe83[_0x4188e6(0x16c)]?_0x1cc0f0(_0x5f1276=>{const _0x578b37=_0x4188e6,_0xc0c9ec=_0x5f1276['slice'](0x0,-0x1),{valid:_0x2b0ea7,message:_0x5c3ce0}=_0x2096b5(_0xc0c9ec);return _0x313900(_0x2b0ea7?'':_0x5c3ce0||_0x578b37(0x174)),_0xc0c9ec;}):_0x1cc0f0(_0x35b418=>{const _0xc50aad=_0x4188e6,_0x2ada3c=_0x35b418+_0x5df5d3,{valid:_0x450a2e,message:_0x4aaa9a}=_0x2096b5(_0x2ada3c);return _0x313900(_0x450a2e?'':_0x4aaa9a||_0xc50aad(0x174)),_0x2ada3c;});}),a0_0x59d093(Box,{'flexDirection':'column','children':[a0_0x59d093(Box,{'children':[a0_0x33b031(Text,{'color':_0x7786e9(0x169),'children':_0x7786e9(0x16d)}),a0_0x33b031(Text,{'children':'页面路由地址:\x20'}),_0x45d697?a0_0x33b031(Text,{'color':_0x7786e9(0x168),'children':_0x45d697}):a0_0x33b031(Text,{'color':'gray','children':_0xf69051}),_0x175db1&&a0_0x59d093(Text,{'color':_0x7786e9(0x15a),'children':[_0x7786e9(0x173),_0x175db1]})]}),!_0x175db1&&!_0x45d697&&a0_0x33b031(Box,{'children':a0_0x33b031(Text,{'color':_0x7786e9(0x169),'children':_0x7786e9(0x161)})})]});}
@@ -1 +1 @@
1
- function a1_0x2a81(_0x57531e,_0x5a06db){const _0x20ab3c=a1_0x20ab();return a1_0x2a81=function(_0x2a81c9,_0x412d67){_0x2a81c9=_0x2a81c9-0xce;let _0x12ce35=_0x20ab3c[_0x2a81c9];return _0x12ce35;},a1_0x2a81(_0x57531e,_0x5a06db);}const a1_0x200adb=a1_0x2a81;(function(_0x5be83c,_0x47748b){const _0x5941c1=a1_0x2a81,_0x31c686=_0x5be83c();while(!![]){try{const _0x20678a=parseInt(_0x5941c1(0xd9))/0x1*(-parseInt(_0x5941c1(0xe2))/0x2)+parseInt(_0x5941c1(0xe3))/0x3+-parseInt(_0x5941c1(0xf0))/0x4+-parseInt(_0x5941c1(0xec))/0x5+parseInt(_0x5941c1(0xf6))/0x6*(parseInt(_0x5941c1(0xdd))/0x7)+parseInt(_0x5941c1(0xe6))/0x8*(parseInt(_0x5941c1(0xd5))/0x9)+-parseInt(_0x5941c1(0xdc))/0xa*(-parseInt(_0x5941c1(0xf2))/0xb);if(_0x20678a===_0x47748b)break;else _0x31c686['push'](_0x31c686['shift']());}catch(_0x2a4f3a){_0x31c686['push'](_0x31c686['shift']());}}}(a1_0x20ab,0x1fe78));import{jsx as a1_0x511d2d,jsxs as a1_0x4d86a7,Fragment as a1_0x4bc256}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x403b54 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';function a1_0x20ab(){const _0x13c331=['\x20Step1:\x20','页面添加失败:\x20','\x20*\x20页面创建成功!','72CRTqcR','join','dirname','add-page','951KTRRDS','finally','\x20*\x20页面路径:\x20','10TMrCqI','1460641mRgbyz','cwd','processTemplate','\x20Step2:\x20','green','482IynfYt','343248EQrqgH','src','开始添加页面:\x20','89104dcHijn','resolve','gray','setLogPath','url','then','765205mJLeHe','cyan','now','success','296032iJlJtN','info','1922107rJJKkW','message','pages','\x20*\x20路由地址:\x20','6eZaCVB','catch','已选择页面模板\x20','已输入的页面路由\x20','error'];a1_0x20ab=function(){return _0x13c331;};return a1_0x20ab();}import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x403b54[a1_0x200adb(0xd7)](fileURLToPath(import.meta[a1_0x200adb(0xea)])),pageTemplateDir=a1_0x403b54[a1_0x200adb(0xe7)](__dirname,'../../templates/pages'),projectDir=process[a1_0x200adb(0xde)]();export const AddPage=()=>{const _0x2ccbd8=a1_0x200adb,{exit:_0x12b119}=useApp(),[_0xbb903b,_0x409d4d]=useState(''),[_0x3c9124,_0x539738]=useState(''),[_0xf393e0,_0x1a5fdb]=useState(![]),[_0xa3a0a6,_0x56f87e]=useState(![]),_0x3a020c=a1_0x403b54[_0x2ccbd8(0xd6)](projectDir,_0x2ccbd8(0xe4),_0x2ccbd8(0xf4)),_0x1b3f0c=a1_0x403b54[_0x2ccbd8(0xd6)](_0x3a020c,_0x3c9124),_0x3627dd=a1_0x403b54['join'](_0x2ccbd8(0xe4),_0x2ccbd8(0xf4),_0x3c9124);useEffect(()=>{const _0x35a2ea=_0x2ccbd8,_0x124d6a=a1_0x403b54[_0x35a2ea(0xe7)](pageTemplateDir,_0xbb903b);if(_0xbb903b&&_0x3c9124){_0x1a5fdb(!![]),logger[_0x35a2ea(0xe9)](process[_0x35a2ea(0xde)]());const _0x11d0b4=Date['now']();logger[_0x35a2ea(0xf1)](_0x35a2ea(0xd8),_0x35a2ea(0xe5)+_0x3c9124,{'template':_0xbb903b,'targetPath':_0x3627dd}),TemplateReplacer[_0x35a2ea(0xdf)](_0x124d6a,a1_0x403b54[_0x35a2ea(0xd6)](_0x3a020c,_0x3c9124),_0x3c9124,_0xbb903b)[_0x35a2ea(0xeb)](()=>{const _0x44b4a4=_0x35a2ea,_0x2befd1=Date[_0x44b4a4(0xee)]()-_0x11d0b4;logger[_0x44b4a4(0xef)]('add-page','页面添加成功:\x20'+_0x3c9124,_0x2befd1,{'template':_0xbb903b,'targetPath':_0x3627dd,'routePath':_0x3c9124}),_0x56f87e(!![]);})[_0x35a2ea(0xce)](_0x3740c1=>{const _0x5024fc=_0x35a2ea,_0x1152c3=Date[_0x5024fc(0xee)]()-_0x11d0b4;logger[_0x5024fc(0xd1)](_0x5024fc(0xd8),_0x5024fc(0xd3)+_0x3c9124,{'template':_0xbb903b,'targetPath':_0x3627dd,'error':_0x3740c1 instanceof Error?_0x3740c1[_0x5024fc(0xf3)]:String(_0x3740c1),'duration':_0x1152c3});})[_0x35a2ea(0xda)](()=>{_0x1a5fdb(![]);});}},[_0xbb903b,_0x3c9124]),useEffect(()=>{_0xa3a0a6&&setTimeout(()=>{_0x12b119();});},[_0xa3a0a6]);if(_0xbb903b)return a1_0x4d86a7(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x4d86a7(Box,{'children':[a1_0x511d2d(Text,{'color':_0x2ccbd8(0xe8),'children':_0x2ccbd8(0xd2)}),a1_0x511d2d(Text,{'children':_0x2ccbd8(0xcf)}),a1_0x511d2d(Text,{'color':_0x2ccbd8(0xe1),'children':_0xbb903b})]}),_0x3c9124?a1_0x4d86a7(Box,{'children':[a1_0x511d2d(Text,{'color':_0x2ccbd8(0xe8),'children':_0x2ccbd8(0xe0)}),a1_0x511d2d(Text,{'children':_0x2ccbd8(0xd0)}),a1_0x511d2d(Text,{'color':'green','children':_0x3c9124})]}):a1_0x511d2d(InputProjectCode,{'pagePath':_0x1b3f0c,'onSubmit':_0x539738}),_0x3c9124&&_0xf393e0?a1_0x4d86a7(Box,{'marginTop':0x1,'children':[a1_0x511d2d(Box,{'width':'4'}),a1_0x511d2d(Text,{'children':'正在创建页面,请稍候…'})]}):null,_0xa3a0a6?a1_0x4d86a7(a1_0x4bc256,{'children':[a1_0x511d2d(Box,{'marginTop':0x1,'children':a1_0x511d2d(Text,{'color':_0x2ccbd8(0xe8),'children':_0x2ccbd8(0xd4)})}),a1_0x4d86a7(Box,{'children':[a1_0x511d2d(Text,{'color':_0x2ccbd8(0xe8),'children':_0x2ccbd8(0xdb)}),a1_0x511d2d(Text,{'color':_0x2ccbd8(0xe1),'children':_0x3627dd})]}),a1_0x4d86a7(Box,{'children':[a1_0x511d2d(Text,{'color':_0x2ccbd8(0xe8),'children':_0x2ccbd8(0xf5)}),a1_0x4d86a7(Text,{'color':_0x2ccbd8(0xe1),'children':['/',_0x3c9124]})]}),a1_0x511d2d(Box,{'marginTop':0x1,'children':a1_0x511d2d(Text,{'color':_0x2ccbd8(0xed),'children':'\x20*\x20页面文件已创建,可直接通过路由访问'})})]}):null]});return a1_0x511d2d(SelectPageTemplate,{'onSelect':_0x409d4d});};
1
+ const a1_0x3b126c=a1_0x25c4;(function(_0x1b1455,_0x3543e2){const _0x23bf24=a1_0x25c4,_0x36ad3b=_0x1b1455();while(!![]){try{const _0x2380f0=-parseInt(_0x23bf24(0xae))/0x1+parseInt(_0x23bf24(0xb2))/0x2*(parseInt(_0x23bf24(0xaf))/0x3)+-parseInt(_0x23bf24(0xb8))/0x4+parseInt(_0x23bf24(0xcc))/0x5+parseInt(_0x23bf24(0xcb))/0x6+-parseInt(_0x23bf24(0xc2))/0x7*(parseInt(_0x23bf24(0xb0))/0x8)+parseInt(_0x23bf24(0xaa))/0x9;if(_0x2380f0===_0x3543e2)break;else _0x36ad3b['push'](_0x36ad3b['shift']());}catch(_0x4f3847){_0x36ad3b['push'](_0x36ad3b['shift']());}}}(a1_0x2477,0xf253a));import{jsx as a1_0x120f66,jsxs as a1_0x45e025,Fragment as a1_0x30cb8a}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x2e5c32 from'node:path';import{useEffect,useState}from'react';function a1_0x2477(){const _0x18154a=['1110013MXAixk','4971hIHUSi','8136784feYZpm','success','686YGKUYE','cwd','message','setLogPath','column','pages','5196712wltDHi','\x20Step1:\x20','now','then','dirname','join','\x20*\x20路由地址:\x20','\x20*\x20页面创建成功!','\x20Step2:\x20','src','7eYmMvH','error','processTemplate','gray','catch','cyan','页面添加失败:\x20','add-page','已选择页面模板\x20','894342IhLcqv','7346045uLoxlo','开始添加页面:\x20','resolve','\x20*\x20页面文件已创建,可直接通过路由访问','info','正在创建页面,请稍候…','20090178rnUhME','green','../../templates/pages','url'];a1_0x2477=function(){return _0x18154a;};return a1_0x2477();}import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';function a1_0x25c4(_0x4af222,_0x177186){const _0x24770c=a1_0x2477();return a1_0x25c4=function(_0x25c47e,_0x12b0b0){_0x25c47e=_0x25c47e-0xaa;let _0xf963c6=_0x24770c[_0x25c47e];return _0xf963c6;},a1_0x25c4(_0x4af222,_0x177186);}import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x2e5c32[a1_0x3b126c(0xbc)](fileURLToPath(import.meta[a1_0x3b126c(0xad)])),pageTemplateDir=a1_0x2e5c32[a1_0x3b126c(0xce)](__dirname,a1_0x3b126c(0xac)),projectDir=process['cwd']();export const AddPage=()=>{const _0x36e214=a1_0x3b126c,{exit:_0x4efd94}=useApp(),[_0x3df3f5,_0x2faf6f]=useState(''),[_0x3d3c39,_0x301d01]=useState(''),[_0x38a08e,_0x36b863]=useState(![]),[_0xe4f263,_0x3bc2b0]=useState(![]),_0x5f363a=a1_0x2e5c32[_0x36e214(0xbd)](projectDir,_0x36e214(0xc1),_0x36e214(0xb7)),_0x556f9c=a1_0x2e5c32[_0x36e214(0xbd)](_0x5f363a,_0x3d3c39),_0x43be0d=a1_0x2e5c32[_0x36e214(0xbd)](_0x36e214(0xc1),_0x36e214(0xb7),_0x3d3c39);useEffect(()=>{const _0x461597=_0x36e214,_0x101bb8=a1_0x2e5c32[_0x461597(0xce)](pageTemplateDir,_0x3df3f5);if(_0x3df3f5&&_0x3d3c39){_0x36b863(!![]),logger[_0x461597(0xb5)](process[_0x461597(0xb3)]());const _0xf2270c=Date['now']();logger[_0x461597(0xd0)](_0x461597(0xc9),_0x461597(0xcd)+_0x3d3c39,{'template':_0x3df3f5,'targetPath':_0x43be0d}),TemplateReplacer[_0x461597(0xc4)](_0x101bb8,a1_0x2e5c32['join'](_0x5f363a,_0x3d3c39),_0x3d3c39,_0x3df3f5)[_0x461597(0xbb)](()=>{const _0x4134a7=_0x461597,_0x308caa=Date[_0x4134a7(0xba)]()-_0xf2270c;logger[_0x4134a7(0xb1)](_0x4134a7(0xc9),'页面添加成功:\x20'+_0x3d3c39,_0x308caa,{'template':_0x3df3f5,'targetPath':_0x43be0d,'routePath':_0x3d3c39}),_0x3bc2b0(!![]);})[_0x461597(0xc6)](_0x3a022a=>{const _0x2fe285=_0x461597,_0x511a26=Date[_0x2fe285(0xba)]()-_0xf2270c;logger[_0x2fe285(0xc3)]('add-page',_0x2fe285(0xc8)+_0x3d3c39,{'template':_0x3df3f5,'targetPath':_0x43be0d,'error':_0x3a022a instanceof Error?_0x3a022a[_0x2fe285(0xb4)]:String(_0x3a022a),'duration':_0x511a26});})['finally'](()=>{_0x36b863(![]);});}},[_0x3df3f5,_0x3d3c39]),useEffect(()=>{_0xe4f263&&setTimeout(()=>{_0x4efd94();});},[_0xe4f263]);if(_0x3df3f5)return a1_0x45e025(Box,{'flexDirection':_0x36e214(0xb6),'paddingY':0x1,'children':[a1_0x45e025(Box,{'children':[a1_0x120f66(Text,{'color':_0x36e214(0xc5),'children':_0x36e214(0xb9)}),a1_0x120f66(Text,{'children':_0x36e214(0xca)}),a1_0x120f66(Text,{'color':_0x36e214(0xab),'children':_0x3df3f5})]}),_0x3d3c39?a1_0x45e025(Box,{'children':[a1_0x120f66(Text,{'color':'gray','children':_0x36e214(0xc0)}),a1_0x120f66(Text,{'children':'已输入的页面路由\x20'}),a1_0x120f66(Text,{'color':'green','children':_0x3d3c39})]}):a1_0x120f66(InputProjectCode,{'pagePath':_0x556f9c,'onSubmit':_0x301d01}),_0x3d3c39&&_0x38a08e?a1_0x45e025(Box,{'marginTop':0x1,'children':[a1_0x120f66(Box,{'width':'4'}),a1_0x120f66(Text,{'children':_0x36e214(0xd1)})]}):null,_0xe4f263?a1_0x45e025(a1_0x30cb8a,{'children':[a1_0x120f66(Box,{'marginTop':0x1,'children':a1_0x120f66(Text,{'color':_0x36e214(0xc5),'children':_0x36e214(0xbf)})}),a1_0x45e025(Box,{'children':[a1_0x120f66(Text,{'color':_0x36e214(0xc5),'children':'\x20*\x20页面路径:\x20'}),a1_0x120f66(Text,{'color':_0x36e214(0xab),'children':_0x43be0d})]}),a1_0x45e025(Box,{'children':[a1_0x120f66(Text,{'color':'gray','children':_0x36e214(0xbe)}),a1_0x45e025(Text,{'color':_0x36e214(0xab),'children':['/',_0x3d3c39]})]}),a1_0x120f66(Box,{'marginTop':0x1,'children':a1_0x120f66(Text,{'color':_0x36e214(0xc7),'children':_0x36e214(0xcf)})})]}):null]});return a1_0x120f66(SelectPageTemplate,{'onSelect':_0x2faf6f});};
@@ -1 +1 @@
1
- (function(_0x16fa14,_0x3154ce){const _0x59033a=a2_0x5d7d,_0x293aea=_0x16fa14();while(!![]){try{const _0x58f667=-parseInt(_0x59033a(0x157))/0x1+-parseInt(_0x59033a(0x153))/0x2+-parseInt(_0x59033a(0x148))/0x3+-parseInt(_0x59033a(0x154))/0x4*(-parseInt(_0x59033a(0x152))/0x5)+-parseInt(_0x59033a(0x15d))/0x6*(-parseInt(_0x59033a(0x149))/0x7)+parseInt(_0x59033a(0x162))/0x8+-parseInt(_0x59033a(0x144))/0x9;if(_0x58f667===_0x3154ce)break;else _0x293aea['push'](_0x293aea['shift']());}catch(_0x24a20e){_0x293aea['push'](_0x293aea['shift']());}}}(a2_0x526d,0xcb21b));function a2_0x5d7d(_0x33c30b,_0x9fb3b6){const _0x526d23=a2_0x526d();return a2_0x5d7d=function(_0x5d7df8,_0x577a54){_0x5d7df8=_0x5d7df8-0x143;let _0xbcdc7d=_0x526d23[_0x5d7df8];return _0xbcdc7d;},a2_0x5d7d(_0x33c30b,_0x9fb3b6);}import{jsx as a2_0x21c279,jsxs as a2_0x30c003}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x52488f from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x206c2c=a2_0x5d7d;try{const _0x14f921=fileURLToPath(import.meta[_0x206c2c(0x15b)]),_0x1fb033=a2_0x52488f[_0x206c2c(0x15c)](a2_0x52488f[_0x206c2c(0x15f)](_0x14f921),_0x206c2c(0x14d)),_0x913662=a2_0x52488f[_0x206c2c(0x14a)](_0x1fb033,_0x206c2c(0x15e)),_0x4d0e14=await readdir(_0x913662,{'withFileTypes':!![]}),_0x34cc44=_0x4d0e14['filter'](_0x2a50db=>_0x2a50db[_0x206c2c(0x151)]())[_0x206c2c(0x14c)](_0x59dd0d=>({'label':_0x59dd0d[_0x206c2c(0x145)]}))['sort']((_0x7cb155,_0x49fe9d)=>_0x7cb155['label']['localeCompare'](_0x49fe9d[_0x206c2c(0x155)]));return _0x34cc44;}catch(_0x14b07b){return console[_0x206c2c(0x160)](_0x206c2c(0x158),_0x14b07b),[{'label':_0x206c2c(0x15a)},{'label':_0x206c2c(0x147)}];}}export function SelectPageTemplate(_0x461fea){const _0x43dc75=a2_0x5d7d,[_0x4e53b9,_0x3bd1db]=useState(0x0),[_0xe0c482,_0x36a3d0]=useState([]),[_0x3b0a06,_0x2c4bb8]=useState(!![]);useEffect(()=>{async function _0x80fcc2(){const _0x232a7b=await getTemplateList();_0x36a3d0(_0x232a7b),_0x2c4bb8(![]);}_0x80fcc2();},[]),useInput((_0x39e591,_0x19771c)=>{const _0x4c559d=a2_0x5d7d;if(_0x3b0a06)return;if(_0x19771c[_0x4c559d(0x150)]){const _0x2671c8=_0xe0c482[_0x4e53b9];_0x2671c8&&_0x461fea[_0x4c559d(0x143)](_0x2671c8[_0x4c559d(0x155)]);}_0x19771c[_0x4c559d(0x161)]&&_0x3bd1db(_0x5bee51=>_0x5bee51===0x0?_0xe0c482['length']-0x1:_0x5bee51-0x1),_0x19771c[_0x4c559d(0x156)]&&_0x3bd1db(_0x17a9cb=>_0x17a9cb===_0xe0c482['length']-0x1?0x0:_0x17a9cb+0x1);});if(_0x3b0a06)return a2_0x21c279(Box,{'flexDirection':_0x43dc75(0x14f),'paddingY':0x1,'children':a2_0x30c003(Box,{'children':[a2_0x21c279(Text,{'color':'gray','children':'\x20Step1:\x20'}),a2_0x21c279(Text,{'children':_0x43dc75(0x14b)})]})});return a2_0x30c003(Box,{'flexDirection':_0x43dc75(0x14f),'paddingY':0x1,'children':[a2_0x30c003(Box,{'children':[a2_0x21c279(Text,{'color':_0x43dc75(0x159),'children':'\x20Step1:\x20'}),a2_0x21c279(Text,{'children':'请选择您要创建的页面模板'})]}),_0xe0c482[_0x43dc75(0x14c)]((_0xf3113f,_0x5f4e9c)=>{const _0x3b1286=_0x43dc75,_0x456b19=_0x5f4e9c===_0x4e53b9,_0x1c7c39=_0x456b19?_0x3b1286(0x146)+_0xf3113f[_0x3b1286(0x155)]:_0x3b1286(0x14e)+_0xf3113f[_0x3b1286(0x155)];return a2_0x21c279(Box,{'children':a2_0x21c279(Text,{'color':_0x456b19?'green':undefined,'children':_0x1c7c39})},_0x1c7c39);})]});}function a2_0x526d(){const _0x75e28=['url','resolve','18QgPOvu','templates/pages','dirname','error','upArrow','9312488JJLEGd','onSelect','3888864XDrOhw','name','\x20\x20\x20\x20\x20\x20>\x20','sdk-fetch','193011ckwOAU','3097283yxCUfS','join','正在加载页面模板...','map','../..','\x20\x20\x20\x20\x20\x20\x20\x20','column','return','isDirectory','144665qMAqYD','943018ukpUXE','92axlydb','label','downArrow','1356958ZdqEaT','获取模板列表失败:','gray','blank'];a2_0x526d=function(){return _0x75e28;};return a2_0x526d();}
1
+ function a2_0x4c74(_0x23d20b,_0x27917a){const _0x14b239=a2_0x14b2();return a2_0x4c74=function(_0x4c74dc,_0x51f9eb){_0x4c74dc=_0x4c74dc-0x91;let _0x1a379c=_0x14b239[_0x4c74dc];return _0x1a379c;},a2_0x4c74(_0x23d20b,_0x27917a);}(function(_0x29b899,_0x179bbb){const _0x461542=a2_0x4c74,_0x2d0139=_0x29b899();while(!![]){try{const _0x4275a3=parseInt(_0x461542(0x94))/0x1*(-parseInt(_0x461542(0xa1))/0x2)+-parseInt(_0x461542(0x91))/0x3*(parseInt(_0x461542(0xae))/0x4)+parseInt(_0x461542(0x9f))/0x5*(-parseInt(_0x461542(0xab))/0x6)+-parseInt(_0x461542(0x98))/0x7+-parseInt(_0x461542(0xac))/0x8+parseInt(_0x461542(0xa2))/0x9*(parseInt(_0x461542(0x95))/0xa)+parseInt(_0x461542(0x9a))/0xb;if(_0x4275a3===_0x179bbb)break;else _0x2d0139['push'](_0x2d0139['shift']());}catch(_0x111dc6){_0x2d0139['push'](_0x2d0139['shift']());}}}(a2_0x14b2,0x70120));import{jsx as a2_0x4c3f1a,jsxs as a2_0x1fccb0}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0xbd6f9c from'node:path';function a2_0x14b2(){const _0x409b2f=['402XiMfGH','label','return','28703aKghPK','25140EHynMS','length','gray','4116168tAHLoB','name','23993684ehLgSa','\x20Step1:\x20','请选择您要创建的页面模板','blank','localeCompare','5ekKpYk','column','58fhfUiR','1134YHIAYg','\x20\x20\x20\x20\x20\x20>\x20','获取模板列表失败:','isDirectory','dirname','onSelect','url','正在加载页面模板...','map','1340796wggkqm','2664392GTEJEj','green','1852LtxyXn'];a2_0x14b2=function(){return _0x409b2f;};return a2_0x14b2();}import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x2fdc59=a2_0x4c74;try{const _0x1b49de=fileURLToPath(import.meta[_0x2fdc59(0xa8)]),_0x333a2a=a2_0xbd6f9c['resolve'](a2_0xbd6f9c[_0x2fdc59(0xa6)](_0x1b49de),'../..'),_0xcf8082=a2_0xbd6f9c['join'](_0x333a2a,'templates/pages'),_0x5a14e7=await readdir(_0xcf8082,{'withFileTypes':!![]}),_0x1b0bbd=_0x5a14e7['filter'](_0x3d10c5=>_0x3d10c5[_0x2fdc59(0xa5)]())[_0x2fdc59(0xaa)](_0x20ce99=>({'label':_0x20ce99[_0x2fdc59(0x99)]}))['sort']((_0x46695a,_0x5acc63)=>_0x46695a[_0x2fdc59(0x92)][_0x2fdc59(0x9e)](_0x5acc63[_0x2fdc59(0x92)]));return _0x1b0bbd;}catch(_0x838049){return console['error'](_0x2fdc59(0xa4),_0x838049),[{'label':_0x2fdc59(0x9d)},{'label':'sdk-fetch'}];}}export function SelectPageTemplate(_0x197a6c){const _0x4df371=a2_0x4c74,[_0x58ca59,_0x32f8d1]=useState(0x0),[_0x333965,_0x314e97]=useState([]),[_0x52bdbd,_0x331612]=useState(!![]);useEffect(()=>{async function _0x1c915d(){const _0x68f719=await getTemplateList();_0x314e97(_0x68f719),_0x331612(![]);}_0x1c915d();},[]),useInput((_0x931bce,_0x56cffc)=>{const _0x44cdd3=a2_0x4c74;if(_0x52bdbd)return;if(_0x56cffc[_0x44cdd3(0x93)]){const _0x33460e=_0x333965[_0x58ca59];_0x33460e&&_0x197a6c[_0x44cdd3(0xa7)](_0x33460e[_0x44cdd3(0x92)]);}_0x56cffc['upArrow']&&_0x32f8d1(_0x18f882=>_0x18f882===0x0?_0x333965['length']-0x1:_0x18f882-0x1),_0x56cffc['downArrow']&&_0x32f8d1(_0x47ec8a=>_0x47ec8a===_0x333965[_0x44cdd3(0x96)]-0x1?0x0:_0x47ec8a+0x1);});if(_0x52bdbd)return a2_0x4c3f1a(Box,{'flexDirection':_0x4df371(0xa0),'paddingY':0x1,'children':a2_0x1fccb0(Box,{'children':[a2_0x4c3f1a(Text,{'color':_0x4df371(0x97),'children':'\x20Step1:\x20'}),a2_0x4c3f1a(Text,{'children':_0x4df371(0xa9)})]})});return a2_0x1fccb0(Box,{'flexDirection':_0x4df371(0xa0),'paddingY':0x1,'children':[a2_0x1fccb0(Box,{'children':[a2_0x4c3f1a(Text,{'color':_0x4df371(0x97),'children':_0x4df371(0x9b)}),a2_0x4c3f1a(Text,{'children':_0x4df371(0x9c)})]}),_0x333965[_0x4df371(0xaa)]((_0x24fec3,_0x2a73cd)=>{const _0x44e685=_0x4df371,_0x49e0a3=_0x2a73cd===_0x58ca59,_0x3d6fcf=_0x49e0a3?_0x44e685(0xa3)+_0x24fec3[_0x44e685(0x92)]:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x24fec3[_0x44e685(0x92)];return a2_0x4c3f1a(Box,{'children':a2_0x4c3f1a(Text,{'color':_0x49e0a3?_0x44e685(0xad):undefined,'children':_0x3d6fcf})},_0x3d6fcf);})]});}
@@ -1 +1 @@
1
- (function(_0x4b9e76,_0x5dccd8){const _0x4c0a8f=a3_0x108a,_0x44474e=_0x4b9e76();while(!![]){try{const _0x1e89af=parseInt(_0x4c0a8f(0x178))/0x1+-parseInt(_0x4c0a8f(0x188))/0x2*(parseInt(_0x4c0a8f(0x176))/0x3)+-parseInt(_0x4c0a8f(0x195))/0x4*(parseInt(_0x4c0a8f(0x19a))/0x5)+-parseInt(_0x4c0a8f(0x180))/0x6*(parseInt(_0x4c0a8f(0x18d))/0x7)+-parseInt(_0x4c0a8f(0x182))/0x8*(parseInt(_0x4c0a8f(0x186))/0x9)+parseInt(_0x4c0a8f(0x196))/0xa*(parseInt(_0x4c0a8f(0x1ac))/0xb)+parseInt(_0x4c0a8f(0x192))/0xc*(parseInt(_0x4c0a8f(0x171))/0xd);if(_0x1e89af===_0x5dccd8)break;else _0x44474e['push'](_0x44474e['shift']());}catch(_0x5423d0){_0x44474e['push'](_0x44474e['shift']());}}}(a3_0xd038,0x2a26c));import{jsx as a3_0x11d652,jsxs as a3_0x4b62ba}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';function a3_0x108a(_0x3cea62,_0x3ff26d){const _0xd0389c=a3_0xd038();return a3_0x108a=function(_0x108a2a,_0x43277d){_0x108a2a=_0x108a2a-0x16d;let _0x5c4a46=_0xd0389c[_0x108a2a];return _0x5c4a46;},a3_0x108a(_0x3cea62,_0x3ff26d);}import{getApiDomain}from'../constant/domain.js';function a3_0xd038(){const _0x3c1447=['\x20-\x20客户端实例文件','1071aqPdXK','import\x20','message','√\x20API\x20文件生成成功!','text','336eNodIl','error','&pageSize=999&currentPage=1','12oGrbbn','10mgmJqh','src/api/','gray','cyan','384760yWCkxo','\x20from\x20\x27@/api/','yellow','dim','.ts','💡\x20请使用\x20','\x20-\x20模型配置文件','api','api-pull','white','app','-api','*\x20将生成文件:\x20','{\x20lovrabetClient\x20}','cwd','使用配置的应用AppCode:\x20','/smartapi/dataset/getList?appCode=','status','345081dOxRlV',',且无法读取错误响应内容','includes','使用指定的应用AppCode:\x20','json','success','413101JpNkda','setLogPath','join','\x20重新登录后再试','replace','1821MpoZIU','green','33023kuMSkd','client','🚀\x20正在从服务器拉取\x20API\x20配置...','slice','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','拉取\x20API\x20配置失败:\x20','column','red','12606pnVnat','未提供应用AppCode,且配置中也没有默认值','580664APiFcs','获取数据集失败,HTTP状态码:\x20','*\x20导入方式:','data','9qDfpuK','lovrabet\x20auth','516orpBBr','url','tableData','-client'];a3_0xd038=function(){return _0x3c1447;};return a3_0xd038();}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0x4f53c9})=>{const _0x3afa64=a3_0x108a,{exit:_0x2dfd8c}=useApp(),[_0x4619d0,_0x395460]=useState(![]),[_0x521af4,_0x3be2de]=useState(![]),[_0x106cfe,_0x26be5c]=useState(null),[_0x31c455,_0x3bbbe7]=useState(null),_0x584744=readConfig(),_0x264e14=_0x4f53c9||_0x584744?.[_0x3afa64(0x1a4)],_0x2a6fef=_0x4f53c9&&_0x4f53c9[_0x3afa64(0x16d)]('-')?_0x4f53c9['split']('-')[_0x3afa64(0x17b)](0x1)[_0x3afa64(0x173)]('-'):'',_0x5c5c0f=_0x4f53c9?_0x3afa64(0x16e)+_0x264e14:_0x3afa64(0x1a9)+_0x264e14,_0x1ca6c8=_0x2a6fef?_0x2a6fef+_0x3afa64(0x1a5):_0x3afa64(0x1a1),_0x49963c=_0x2a6fef?_0x2a6fef+_0x3afa64(0x18b):_0x3afa64(0x179);useEffect(()=>{_0x395460(!![]),_0x35f3b2();},[]),useEffect(()=>{(_0x521af4||_0x106cfe)&&_0x2dfd8c();},[_0x521af4,_0x106cfe,_0x2dfd8c]);async function _0x35f3b2(){const _0x1a9750=_0x3afa64;if(!_0x264e14){_0x26be5c(_0x1a9750(0x181));return;}try{logger[_0x1a9750(0x172)](process[_0x1a9750(0x1a8)]());const _0xbde337=await fetch(getApiDomain()+_0x1a9750(0x1aa)+_0x264e14+_0x1a9750(0x194),{'headers':{'Cookie':getCookie()}});if(_0xbde337['ok']){const _0x2e2536=await _0xbde337[_0x1a9750(0x16f)]();if(_0x2e2536[_0x1a9750(0x170)]){const _0x85902c=!_0x4f53c9;await generateApiFile(_0x2e2536[_0x1a9750(0x185)][_0x1a9750(0x18a)],_0x2a6fef,_0x264e14,_0x85902c),_0x3bbbe7({'api':'src/api/'+_0x1ca6c8+_0x1a9750(0x19e),'client':'src/api/'+_0x49963c+'.ts'}),_0x3be2de(!![]);}}else{if(_0xbde337['status']===0x191){const _0x6b8573=_0x1a9750(0x17c);logger[_0x1a9750(0x193)](_0x1a9750(0x1a2),_0x6b8573,{'status':_0xbde337['status'],'appCode':_0x264e14,'url':_0xbde337[_0x1a9750(0x189)]}),_0x26be5c(_0x6b8573);}else{const _0x1fd4c9=_0x1a9750(0x183)+_0xbde337[_0x1a9750(0x1ab)];try{const _0x875417=await _0xbde337[_0x1a9750(0x191)]();_0x875417?logger['error'](_0x1a9750(0x1a2),_0x1fd4c9,{'status':_0xbde337[_0x1a9750(0x1ab)],'appCode':_0x264e14,'url':_0xbde337[_0x1a9750(0x189)],'errorBody':_0x875417}):logger[_0x1a9750(0x193)](_0x1a9750(0x1a2),_0x1fd4c9,{'status':_0xbde337['status'],'appCode':_0x264e14,'url':_0xbde337[_0x1a9750(0x189)]});}catch(_0x5b1e09){logger[_0x1a9750(0x193)](_0x1a9750(0x1a2),_0x1fd4c9+_0x1a9750(0x1ad),{'status':_0xbde337[_0x1a9750(0x1ab)],'appCode':_0x264e14,'url':_0xbde337[_0x1a9750(0x189)],'readError':_0x5b1e09 instanceof Error?_0x5b1e09[_0x1a9750(0x18f)]:String(_0x5b1e09)});}_0x26be5c(_0x1fd4c9);}}}catch(_0x122cd6){const _0x3157a1=_0x122cd6 instanceof Error?_0x122cd6['message']:String(_0x122cd6);_0x26be5c(_0x1a9750(0x17d)+_0x3157a1);}finally{_0x395460(![]);}}return a3_0x4b62ba(Box,{'flexDirection':_0x3afa64(0x17e),'children':[a3_0x4b62ba(Box,{'children':[a3_0x11d652(Text,{'color':'gray','children':'*\x20'}),a3_0x11d652(Text,{'color':_0x4f53c9?_0x3afa64(0x1a3):_0x3afa64(0x19d),'children':_0x5c5c0f})]}),a3_0x4b62ba(Box,{'children':[a3_0x11d652(Text,{'color':_0x3afa64(0x198),'children':_0x3afa64(0x1a6)}),a3_0x4b62ba(Text,{'color':'cyan','children':[_0x1ca6c8,_0x3afa64(0x19e)]}),a3_0x11d652(Text,{'color':_0x3afa64(0x19d),'children':'\x20和\x20'}),a3_0x4b62ba(Text,{'color':_0x3afa64(0x199),'children':[_0x49963c,_0x3afa64(0x19e)]})]}),_0x4619d0&&a3_0x11d652(Box,{'children':a3_0x11d652(Text,{'children':_0x3afa64(0x17a)})}),_0x521af4&&_0x31c455&&a3_0x4b62ba(Box,{'flexDirection':'column','children':[a3_0x11d652(Box,{'children':a3_0x11d652(Text,{'color':_0x3afa64(0x177),'children':_0x3afa64(0x190)})}),a3_0x11d652(Box,{'marginTop':0x1,'children':a3_0x11d652(Text,{'color':_0x3afa64(0x198),'children':'*\x20已生成文件:'})}),a3_0x4b62ba(Box,{'marginLeft':0x2,'children':[a3_0x4b62ba(Text,{'color':_0x3afa64(0x199),'children':['•\x20',_0x31c455['api']]}),a3_0x11d652(Text,{'color':_0x3afa64(0x19d),'children':_0x3afa64(0x1a0)})]}),a3_0x4b62ba(Box,{'marginLeft':0x2,'children':[a3_0x4b62ba(Text,{'color':_0x3afa64(0x199),'children':['•\x20',_0x31c455[_0x3afa64(0x179)]]}),a3_0x11d652(Text,{'color':_0x3afa64(0x19d),'children':_0x3afa64(0x18c)})]}),a3_0x11d652(Box,{'marginTop':0x1,'children':a3_0x11d652(Text,{'color':_0x3afa64(0x198),'children':_0x3afa64(0x184)})}),a3_0x11d652(Box,{'marginLeft':0x2,'children':a3_0x4b62ba(Text,{'color':_0x3afa64(0x19c),'children':[_0x3afa64(0x18e),_0x3afa64(0x1a7),_0x3afa64(0x19b),_0x31c455['client'][_0x3afa64(0x175)](_0x3afa64(0x197),'')[_0x3afa64(0x175)](_0x3afa64(0x19e),''),'\x27']})})]}),_0x106cfe&&a3_0x4b62ba(Box,{'flexDirection':_0x3afa64(0x17e),'children':[a3_0x11d652(Box,{'children':a3_0x4b62ba(Text,{'color':_0x3afa64(0x17f),'children':['❌\x20',_0x106cfe]})}),_0x106cfe[_0x3afa64(0x16d)]('登录')&&a3_0x4b62ba(Box,{'marginTop':0x1,'children':[a3_0x11d652(Text,{'color':_0x3afa64(0x19c),'children':_0x3afa64(0x19f)}),a3_0x11d652(Text,{'color':'cyan','children':_0x3afa64(0x187)}),a3_0x11d652(Text,{'color':_0x3afa64(0x19c),'children':_0x3afa64(0x174)})]})]})]});};
1
+ (function(_0x4801f7,_0x277726){const _0x162b77=a3_0x5332,_0x3cfaec=_0x4801f7();while(!![]){try{const _0x39c819=parseInt(_0x162b77(0x1f7))/0x1*(-parseInt(_0x162b77(0x1e5))/0x2)+-parseInt(_0x162b77(0x1d3))/0x3+-parseInt(_0x162b77(0x1d7))/0x4*(-parseInt(_0x162b77(0x1f5))/0x5)+-parseInt(_0x162b77(0x1f9))/0x6+parseInt(_0x162b77(0x1e0))/0x7*(-parseInt(_0x162b77(0x1e1))/0x8)+-parseInt(_0x162b77(0x1f0))/0x9*(parseInt(_0x162b77(0x1c1))/0xa)+parseInt(_0x162b77(0x1e9))/0xb*(parseInt(_0x162b77(0x1d0))/0xc);if(_0x39c819===_0x277726)break;else _0x3cfaec['push'](_0x3cfaec['shift']());}catch(_0x5d80f5){_0x3cfaec['push'](_0x3cfaec['shift']());}}}(a3_0x394d,0xdaa5b));import{jsx as a3_0x46b730,jsxs as a3_0x1ecaca}from'react/jsx-runtime';function a3_0x394d(){const _0x5b1307=['status','5822766NETjkS','6326730MtLkcU','未提供应用AppCode,且配置中也没有默认值','{\x20lovrabetClient\x20}','使用配置的应用AppCode:\x20','client','-client','json','join','success','yellow','import\x20','data','url','message','includes','3254568sbitjp','获取数据集失败,HTTP状态码:\x20','tableData','4103541FTOVqI','split','cyan','gray','4PVbJGp','💡\x20请使用\x20','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','\x20重新登录后再试','\x20-\x20客户端实例文件','white','replace','拉取\x20API\x20配置失败:\x20','*\x20导入方式:','42077iYoZUR','664lZbBya','.ts','src/api/','\x20-\x20模型配置文件','2276HrfZEk','slice','-api','/smartapi/dataset/getList?appCode=','121mLdCLP','api-pull','setLogPath','column','green','\x20和\x20','app','9OOAgPH','red','cwd','error','dim','7377175agkqRc','√\x20API\x20文件生成成功!','82LkNRev'];a3_0x394d=function(){return _0x5b1307;};return a3_0x394d();}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{generateApiFile}from'./generate-api-file.js';function a3_0x5332(_0x3c4c34,_0x1c03c7){const _0x394d51=a3_0x394d();return a3_0x5332=function(_0x533292,_0xbf221d){_0x533292=_0x533292-0x1c1;let _0x13986d=_0x394d51[_0x533292];return _0x13986d;},a3_0x5332(_0x3c4c34,_0x1c03c7);}import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0x17b78a})=>{const _0x3310ac=a3_0x5332,{exit:_0x1cad31}=useApp(),[_0x4eceed,_0x509d4b]=useState(![]),[_0x48e487,_0x58bacb]=useState(![]),[_0x56c7f5,_0x5e8f31]=useState(null),[_0x530ea2,_0x3fe961]=useState(null),_0x17c31c=readConfig(),_0xb4903c=_0x17b78a||_0x17c31c?.[_0x3310ac(0x1ef)],_0x33b3b5=_0x17b78a&&_0x17b78a['includes']('-')?_0x17b78a[_0x3310ac(0x1d4)]('-')[_0x3310ac(0x1e6)](0x1)[_0x3310ac(0x1c8)]('-'):'',_0x4c6de3=_0x17b78a?'使用指定的应用AppCode:\x20'+_0xb4903c:_0x3310ac(0x1c4)+_0xb4903c,_0x384868=_0x33b3b5?_0x33b3b5+_0x3310ac(0x1e7):'api',_0x533179=_0x33b3b5?_0x33b3b5+_0x3310ac(0x1c6):_0x3310ac(0x1c5);useEffect(()=>{_0x509d4b(!![]),_0x2fdae5();},[]),useEffect(()=>{(_0x48e487||_0x56c7f5)&&_0x1cad31();},[_0x48e487,_0x56c7f5,_0x1cad31]);async function _0x2fdae5(){const _0x2688fc=_0x3310ac;if(!_0xb4903c){_0x5e8f31(_0x2688fc(0x1c2));return;}try{logger[_0x2688fc(0x1eb)](process[_0x2688fc(0x1f2)]());const _0x53fb25=await fetch(getApiDomain()+_0x2688fc(0x1e8)+_0xb4903c+'&pageSize=999&currentPage=1',{'headers':{'Cookie':getCookie()}});if(_0x53fb25['ok']){const _0x3dae44=await _0x53fb25[_0x2688fc(0x1c7)]();if(_0x3dae44[_0x2688fc(0x1c9)]){const _0x2ae3ca=!_0x17b78a;await generateApiFile(_0x3dae44[_0x2688fc(0x1cc)][_0x2688fc(0x1d2)],_0x33b3b5,_0xb4903c,_0x2ae3ca),_0x3fe961({'api':'src/api/'+_0x384868+_0x2688fc(0x1e2),'client':_0x2688fc(0x1e3)+_0x533179+_0x2688fc(0x1e2)}),_0x58bacb(!![]);}}else{if(_0x53fb25[_0x2688fc(0x1f8)]===0x191){const _0x1ab6ff=_0x2688fc(0x1d9);logger[_0x2688fc(0x1f3)]('api-pull',_0x1ab6ff,{'status':_0x53fb25[_0x2688fc(0x1f8)],'appCode':_0xb4903c,'url':_0x53fb25['url']}),_0x5e8f31(_0x1ab6ff);}else{const _0x4f8b18=_0x2688fc(0x1d1)+_0x53fb25[_0x2688fc(0x1f8)];try{const _0x308ee1=await _0x53fb25['text']();_0x308ee1?logger['error'](_0x2688fc(0x1ea),_0x4f8b18,{'status':_0x53fb25['status'],'appCode':_0xb4903c,'url':_0x53fb25[_0x2688fc(0x1cd)],'errorBody':_0x308ee1}):logger[_0x2688fc(0x1f3)]('api-pull',_0x4f8b18,{'status':_0x53fb25[_0x2688fc(0x1f8)],'appCode':_0xb4903c,'url':_0x53fb25[_0x2688fc(0x1cd)]});}catch(_0x45e564){logger[_0x2688fc(0x1f3)]('api-pull',_0x4f8b18+',且无法读取错误响应内容',{'status':_0x53fb25[_0x2688fc(0x1f8)],'appCode':_0xb4903c,'url':_0x53fb25[_0x2688fc(0x1cd)],'readError':_0x45e564 instanceof Error?_0x45e564[_0x2688fc(0x1ce)]:String(_0x45e564)});}_0x5e8f31(_0x4f8b18);}}}catch(_0x1bdca8){const _0x5e72b7=_0x1bdca8 instanceof Error?_0x1bdca8[_0x2688fc(0x1ce)]:String(_0x1bdca8);_0x5e8f31(_0x2688fc(0x1de)+_0x5e72b7);}finally{_0x509d4b(![]);}}return a3_0x1ecaca(Box,{'flexDirection':_0x3310ac(0x1ec),'children':[a3_0x1ecaca(Box,{'children':[a3_0x46b730(Text,{'color':_0x3310ac(0x1d6),'children':'*\x20'}),a3_0x46b730(Text,{'color':_0x17b78a?_0x3310ac(0x1dc):_0x3310ac(0x1f4),'children':_0x4c6de3})]}),a3_0x1ecaca(Box,{'children':[a3_0x46b730(Text,{'color':_0x3310ac(0x1d6),'children':'*\x20将生成文件:\x20'}),a3_0x1ecaca(Text,{'color':_0x3310ac(0x1d5),'children':[_0x384868,_0x3310ac(0x1e2)]}),a3_0x46b730(Text,{'color':_0x3310ac(0x1f4),'children':_0x3310ac(0x1ee)}),a3_0x1ecaca(Text,{'color':_0x3310ac(0x1d5),'children':[_0x533179,_0x3310ac(0x1e2)]})]}),_0x4eceed&&a3_0x46b730(Box,{'children':a3_0x46b730(Text,{'children':'🚀\x20正在从服务器拉取\x20API\x20配置...'})}),_0x48e487&&_0x530ea2&&a3_0x1ecaca(Box,{'flexDirection':_0x3310ac(0x1ec),'children':[a3_0x46b730(Box,{'children':a3_0x46b730(Text,{'color':_0x3310ac(0x1ed),'children':_0x3310ac(0x1f6)})}),a3_0x46b730(Box,{'marginTop':0x1,'children':a3_0x46b730(Text,{'color':_0x3310ac(0x1d6),'children':'*\x20已生成文件:'})}),a3_0x1ecaca(Box,{'marginLeft':0x2,'children':[a3_0x1ecaca(Text,{'color':_0x3310ac(0x1d5),'children':['•\x20',_0x530ea2['api']]}),a3_0x46b730(Text,{'color':'dim','children':_0x3310ac(0x1e4)})]}),a3_0x1ecaca(Box,{'marginLeft':0x2,'children':[a3_0x1ecaca(Text,{'color':_0x3310ac(0x1d5),'children':['•\x20',_0x530ea2['client']]}),a3_0x46b730(Text,{'color':_0x3310ac(0x1f4),'children':_0x3310ac(0x1db)})]}),a3_0x46b730(Box,{'marginTop':0x1,'children':a3_0x46b730(Text,{'color':_0x3310ac(0x1d6),'children':_0x3310ac(0x1df)})}),a3_0x46b730(Box,{'marginLeft':0x2,'children':a3_0x1ecaca(Text,{'color':_0x3310ac(0x1ca),'children':[_0x3310ac(0x1cb),_0x3310ac(0x1c3),'\x20from\x20\x27@/api/',_0x530ea2[_0x3310ac(0x1c5)][_0x3310ac(0x1dd)](_0x3310ac(0x1e3),'')[_0x3310ac(0x1dd)]('.ts',''),'\x27']})})]}),_0x56c7f5&&a3_0x1ecaca(Box,{'flexDirection':_0x3310ac(0x1ec),'children':[a3_0x46b730(Box,{'children':a3_0x1ecaca(Text,{'color':_0x3310ac(0x1f1),'children':['❌\x20',_0x56c7f5]})}),_0x56c7f5[_0x3310ac(0x1cf)]('登录')&&a3_0x1ecaca(Box,{'marginTop':0x1,'children':[a3_0x46b730(Text,{'color':'yellow','children':_0x3310ac(0x1d8)}),a3_0x46b730(Text,{'color':_0x3310ac(0x1d5),'children':'lovrabet\x20auth'}),a3_0x46b730(Text,{'color':'yellow','children':_0x3310ac(0x1da)})]})]})]});};
@@ -1 +1 @@
1
- (function(_0x20a520,_0x549d0e){const _0x111624=a4_0x532d,_0x28c4cb=_0x20a520();while(!![]){try{const _0x1001f2=-parseInt(_0x111624(0x98))/0x1+parseInt(_0x111624(0x9d))/0x2*(parseInt(_0x111624(0x9e))/0x3)+-parseInt(_0x111624(0xab))/0x4*(-parseInt(_0x111624(0x97))/0x5)+parseInt(_0x111624(0xac))/0x6+parseInt(_0x111624(0xa9))/0x7*(-parseInt(_0x111624(0x99))/0x8)+-parseInt(_0x111624(0xa8))/0x9*(-parseInt(_0x111624(0x96))/0xa)+-parseInt(_0x111624(0xa7))/0xb*(parseInt(_0x111624(0x95))/0xc);if(_0x1001f2===_0x549d0e)break;else _0x28c4cb['push'](_0x28c4cb['shift']());}catch(_0x1327a5){_0x28c4cb['push'](_0x28c4cb['shift']());}}}(a4_0x27c1,0xc9d54));export function formatDataset(_0x58eb16){const _0x10d746=a4_0x532d,_0x15514c=_0x58eb16['filter'](_0x59e1b0=>_0x59e1b0[_0x10d746(0x9a)]),_0x291337=_0x58eb16['filter'](_0x1a1ac9=>!_0x1a1ac9[_0x10d746(0x9a)]),_0x456f88=new Map();_0x15514c[_0x10d746(0x9b)](_0x4f9687=>{const _0x4ddc07=_0x10d746,_0x124386=_0x4f9687['dbtableConfig'][_0x4ddc07(0xa1)],_0x50a290=_0x456f88[_0x4ddc07(0xad)](_0x124386);(!_0x50a290||_0x4f9687['id']>_0x50a290['id'])&&_0x456f88[_0x4ddc07(0xb0)](_0x124386,_0x4f9687);});const _0x328dbe=Array[_0x10d746(0xaa)](_0x456f88['values']())[_0x10d746(0xa4)](_0x460029=>{const _0x299f1d=_0x10d746,_0x35ee0b=snakeToCamel(_0x460029[_0x299f1d(0x9a)][_0x299f1d(0xa1)]);return{'id':_0x460029['id'],'name':_0x460029[_0x299f1d(0xae)],'code':_0x460029[_0x299f1d(0xa2)],'tableName':_0x460029[_0x299f1d(0x9a)][_0x299f1d(0xa1)],'apiFucName':_0x35ee0b?_0x35ee0b+_0x299f1d(0xa0):'dataset'+_0x460029[_0x299f1d(0xa2)]+'Api','pkField':_0x460029[_0x299f1d(0x9a)][_0x299f1d(0xa6)],'allFields':_0x460029[_0x299f1d(0x9a)][_0x299f1d(0xa3)][_0x299f1d(0xa5)](',')};}),_0x1005a4=_0x291337[_0x10d746(0xa4)](_0x1cccea=>{const _0x3d172e=_0x10d746,_0x3c9aeb=_0x3d172e(0x9c)+_0x1cccea[_0x3d172e(0xa2)],_0x22942b=snakeToCamel(_0x3c9aeb);return{'id':_0x1cccea['id'],'name':_0x1cccea[_0x3d172e(0xae)],'code':_0x1cccea[_0x3d172e(0xa2)],'tableName':_0x3c9aeb,'apiFucName':_0x22942b?_0x22942b+'Api':_0x3d172e(0xaf)+_0x1cccea[_0x3d172e(0xa2)]+'Api','pkField':undefined,'allFields':[]};});return[..._0x328dbe,..._0x1005a4];}function a4_0x532d(_0x4171c4,_0x3a7cd5){const _0x27c1bd=a4_0x27c1();return a4_0x532d=function(_0x532d91,_0x515b06){_0x532d91=_0x532d91-0x95;let _0x1f5ca1=_0x27c1bd[_0x532d91];return _0x1f5ca1;},a4_0x532d(_0x4171c4,_0x3a7cd5);}function a4_0x27c1(){const _0xb76743=['code','allFields','map','split','pkField','3275261fjeXax','3413655QrKgZQ','189AVYRoC','from','56812nPnzRD','9051570lBtIAF','get','name','dataset','set','132YVfQty','40ZusHvQ','230dtiPAH','760192IllHoW','63272NisyIm','dbtableConfig','forEach','dataset_','3046wROpET','2751KMJIig','trim','Api','tableName'];a4_0x27c1=function(){return _0xb76743;};return a4_0x27c1();}function snakeToCamel(_0x5d178e){const _0x5757ec=a4_0x532d;if(!_0x5d178e)return _0x5d178e;const _0x18952f=_0x5d178e[_0x5757ec(0x9f)]();return _0x18952f['replace'](/_([a-zA-Z0-9])/g,(_0x2047f7,_0x36d6ff)=>_0x36d6ff['toUpperCase']());}
1
+ (function(_0x274a09,_0x5a2ff1){const _0x3a63ec=a4_0x2c03,_0x2bad73=_0x274a09();while(!![]){try{const _0x40ec34=parseInt(_0x3a63ec(0xeb))/0x1*(-parseInt(_0x3a63ec(0xdd))/0x2)+parseInt(_0x3a63ec(0xd2))/0x3+-parseInt(_0x3a63ec(0xdc))/0x4*(parseInt(_0x3a63ec(0xd9))/0x5)+parseInt(_0x3a63ec(0xdb))/0x6*(parseInt(_0x3a63ec(0xe6))/0x7)+-parseInt(_0x3a63ec(0xd1))/0x8*(-parseInt(_0x3a63ec(0xd6))/0x9)+-parseInt(_0x3a63ec(0xd0))/0xa+parseInt(_0x3a63ec(0xe9))/0xb;if(_0x40ec34===_0x5a2ff1)break;else _0x2bad73['push'](_0x2bad73['shift']());}catch(_0x2ddfae){_0x2bad73['push'](_0x2bad73['shift']());}}}(a4_0x11f2,0xa2f9a));function a4_0x11f2(){const _0x3d54a3=['values','replace','code','21DiYSPE','dataset_','filter','17107013mYmSJe','name','614683rhFNgA','12885710Bnrbzo','8whUYNd','2796588FSWUaq','trim','Api','set','7817436oRZcpP','dbtableConfig','map','4075985YTATgG','dataset','1289394CtChiQ','4POWhAg','4zpHzhV','allFields','tableName','forEach','split','pkField'];a4_0x11f2=function(){return _0x3d54a3;};return a4_0x11f2();}function a4_0x2c03(_0x11593a,_0x15e510){const _0x11f25b=a4_0x11f2();return a4_0x2c03=function(_0x2c0338,_0x4e02c8){_0x2c0338=_0x2c0338-0xd0;let _0x3fd674=_0x11f25b[_0x2c0338];return _0x3fd674;},a4_0x2c03(_0x11593a,_0x15e510);}export function formatDataset(_0x248581){const _0x286b91=a4_0x2c03,_0x37a3e6=_0x248581[_0x286b91(0xe8)](_0x5dc6f6=>_0x5dc6f6[_0x286b91(0xd7)]),_0x1be928=_0x248581[_0x286b91(0xe8)](_0x11a100=>!_0x11a100[_0x286b91(0xd7)]),_0x521efe=new Map();_0x37a3e6[_0x286b91(0xe0)](_0x493bdc=>{const _0x260958=_0x286b91,_0x76b1a7=_0x493bdc[_0x260958(0xd7)][_0x260958(0xdf)],_0x503efc=_0x521efe['get'](_0x76b1a7);(!_0x503efc||_0x493bdc['id']>_0x503efc['id'])&&_0x521efe[_0x260958(0xd5)](_0x76b1a7,_0x493bdc);});const _0x411fa0=Array['from'](_0x521efe[_0x286b91(0xe3)]())['map'](_0x263852=>{const _0x110645=_0x286b91,_0x342618=snakeToCamel(_0x263852['dbtableConfig'][_0x110645(0xdf)]);return{'id':_0x263852['id'],'name':_0x263852[_0x110645(0xea)],'code':_0x263852['code'],'tableName':_0x263852['dbtableConfig'][_0x110645(0xdf)],'apiFucName':_0x342618?_0x342618+'Api':_0x110645(0xda)+_0x263852[_0x110645(0xe5)]+_0x110645(0xd4),'pkField':_0x263852[_0x110645(0xd7)][_0x110645(0xe2)],'allFields':_0x263852[_0x110645(0xd7)][_0x110645(0xde)][_0x110645(0xe1)](',')};}),_0x531545=_0x1be928[_0x286b91(0xd8)](_0x2da737=>{const _0x5dd7b1=_0x286b91,_0x31613e=_0x5dd7b1(0xe7)+_0x2da737[_0x5dd7b1(0xe5)],_0x46b9ff=snakeToCamel(_0x31613e);return{'id':_0x2da737['id'],'name':_0x2da737[_0x5dd7b1(0xea)],'code':_0x2da737[_0x5dd7b1(0xe5)],'tableName':_0x31613e,'apiFucName':_0x46b9ff?_0x46b9ff+_0x5dd7b1(0xd4):_0x5dd7b1(0xda)+_0x2da737[_0x5dd7b1(0xe5)]+_0x5dd7b1(0xd4),'pkField':undefined,'allFields':[]};});return[..._0x411fa0,..._0x531545];}function snakeToCamel(_0x305f5f){const _0x577c1f=a4_0x2c03;if(!_0x305f5f)return _0x305f5f;const _0x253280=_0x305f5f[_0x577c1f(0xd3)]();return _0x253280[_0x577c1f(0xe4)](/_([a-zA-Z0-9])/g,(_0x62258f,_0x47c83b)=>_0x47c83b['toUpperCase']());}
@@ -1 +1 @@
1
- (function(_0x4ba014,_0x270288){const _0x2be778=a5_0xbbad,_0x2480fa=_0x4ba014();while(!![]){try{const _0x261313=-parseInt(_0x2be778(0xb7))/0x1*(-parseInt(_0x2be778(0x92))/0x2)+-parseInt(_0x2be778(0x90))/0x3+parseInt(_0x2be778(0xbc))/0x4*(parseInt(_0x2be778(0x9b))/0x5)+-parseInt(_0x2be778(0xb8))/0x6+-parseInt(_0x2be778(0x97))/0x7+-parseInt(_0x2be778(0xab))/0x8*(parseInt(_0x2be778(0x98))/0x9)+parseInt(_0x2be778(0xb5))/0xa;if(_0x261313===_0x270288)break;else _0x2480fa['push'](_0x2480fa['shift']());}catch(_0x17bb17){_0x2480fa['push'](_0x2480fa['shift']());}}}(a5_0x5e56,0x4dea0));function a5_0xbbad(_0x68d0b8,_0x1c2064){const _0x5e56ef=a5_0x5e56();return a5_0xbbad=function(_0xbbad0b,_0x1a8fd5){_0xbbad0b=_0xbbad0b-0x8f;let _0x3af880=_0x5e56ef[_0xbbad0b];return _0x3af880;},a5_0xbbad(_0x68d0b8,_0x1c2064);}import a5_0x5981b9 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';function a5_0x5e56(){const _0x43cd58=['utf8','src/api/','url','23124Vaduoc','dirname','919113qzySRa','*\x20已生成文件:','1266GpAnLw','*\x20API配置\x20apiConfigName\x20:\x20','CONFIG_NAMES.DEFAULT','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','success','2141034cACTDT','423PDOcJz','typescript','\x20\x20\x20•\x20','60qeFiMw','length','charAt','\x20-\x20模型配置文件\x20(','tableName','toUpperCase','keys','src/api','replace','log','client','format','replaceApiContent','app','../..','slice','79952xtRMMw','forEach','resolve','templates/generate-api','.ts','\x20个模型)','*\x20可以开始使用:\x20import\x20{\x20lovrabetClient\x20}\x20from\x20\x27@/api/','init-api','join','-client','11961240GgkErk','api','656NGGNGY','1677942hXnbYn'];a5_0x5e56=function(){return _0x43cd58;};return a5_0x5e56();}import a5_0x478809 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{formatDataset}from'./format-dataset.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x467efe,_0x1b8d4a='',_0x48bae1,_0xac6723=![]){const _0x2a5752=a5_0xbbad,_0x483544=readConfig(),_0x59c78e=_0x48bae1||_0x483544?.[_0x2a5752(0xa8)];if(typeof _0x59c78e!=='string'||!_0x59c78e)throw new Error(_0x2a5752(0x95));const _0x5eab6b=_0xac6723?_0x2a5752(0x94):'\x22'+_0x59c78e+'\x22',_0xaa38d6=_0xac6723?'':'\x22'+_0x59c78e+'\x22',_0x1fd12c=_0x1b8d4a?_0x1b8d4a+'-api':_0x2a5752(0xb6),_0x36ffc5=_0x1b8d4a?_0x1b8d4a+_0x2a5752(0xb4):_0x2a5752(0xa5),_0x4f7f76=formatDataset(_0x467efe),_0x40ca65={};_0x4f7f76[_0x2a5752(0xac)](_0x235fac=>{const _0x3d4d2b=_0x2a5752,_0x3a0ebc=_0x235fac['apiFucName'][_0x3d4d2b(0xa3)](/Api$/,''),_0x486b23=_0x3a0ebc[_0x3d4d2b(0x9d)](0x0)[_0x3d4d2b(0xa0)]()+_0x3a0ebc[_0x3d4d2b(0xaa)](0x1);_0x40ca65[_0x486b23]={'tableName':_0x235fac[_0x3d4d2b(0x9f)],'datasetId':_0x235fac['code']};});const _0x9ecfef=fileURLToPath(import.meta[_0x2a5752(0xbb)]),_0x21c3a8=a5_0x478809[_0x2a5752(0xad)](a5_0x478809[_0x2a5752(0x8f)](_0x9ecfef),_0x2a5752(0xa9)),_0x3fa488=a5_0x478809[_0x2a5752(0xb3)](_0x21c3a8,_0x2a5752(0xae)),_0x18fd17=a5_0x478809[_0x2a5752(0xb3)](_0x3fa488,'api.ts.tpl'),_0x33bec3=a5_0x478809['join'](_0x3fa488,'client.ts.tpl');mkdirSync(_0x2a5752(0xa2),{'recursive':!![]});const _0x1e75cb=readFileSync(_0x18fd17,_0x2a5752(0xb9)),_0x9b40eb=TemplateReplacer[_0x2a5752(0xa7)](_0x1e75cb,_0x59c78e,_0x40ca65,Object['keys'](_0x40ca65)[0x0],_0x1fd12c,_0x5eab6b),_0x1cd61c=await a5_0x5981b9[_0x2a5752(0xa6)](_0x9b40eb,{'parser':_0x2a5752(0x99)}),_0x33aad4='src/api/'+_0x1fd12c+_0x2a5752(0xaf);writeFileSync(_0x33aad4,_0x1cd61c,{'encoding':_0x2a5752(0xb9)});const _0x3787a2=readFileSync(_0x33bec3,_0x2a5752(0xb9)),_0x1457cb=TemplateReplacer[_0x2a5752(0xa7)](_0x3787a2,_0x59c78e,_0x40ca65,Object[_0x2a5752(0xa1)](_0x40ca65)[0x0],_0x1fd12c,_0x5eab6b,_0xaa38d6),_0x43bcc5=await a5_0x5981b9['format'](_0x1457cb,{'parser':_0x2a5752(0x99)}),_0x390326=_0x2a5752(0xba)+_0x36ffc5+_0x2a5752(0xaf);writeFileSync(_0x390326,_0x43bcc5,{'encoding':'utf8'}),logger[_0x2a5752(0x96)](_0x2a5752(0xb2),'API\x20文件生成成功!'),console[_0x2a5752(0xa4)](_0x2a5752(0x91)),console[_0x2a5752(0xa4)]('\x20\x20\x20•\x20'+_0x33aad4+_0x2a5752(0x9e)+Object['keys'](_0x40ca65)[_0x2a5752(0x9c)]+_0x2a5752(0xb0)),console[_0x2a5752(0xa4)](_0x2a5752(0x9a)+_0x390326+'\x20-\x20客户端实例文件'),console['log'](_0x2a5752(0x93)+_0x5eab6b),console[_0x2a5752(0xa4)](_0x2a5752(0xb1)+_0x36ffc5+'\x27');}
1
+ (function(_0x2643b3,_0xaa1196){const _0x2730fc=a5_0x53ff,_0x13e465=_0x2643b3();while(!![]){try{const _0x14e29c=parseInt(_0x2730fc(0x197))/0x1+-parseInt(_0x2730fc(0x19c))/0x2*(parseInt(_0x2730fc(0x1a9))/0x3)+-parseInt(_0x2730fc(0x1aa))/0x4+-parseInt(_0x2730fc(0x185))/0x5+parseInt(_0x2730fc(0x1a5))/0x6+-parseInt(_0x2730fc(0x196))/0x7+parseInt(_0x2730fc(0x1a2))/0x8*(parseInt(_0x2730fc(0x1a6))/0x9);if(_0x14e29c===_0xaa1196)break;else _0x13e465['push'](_0x13e465['shift']());}catch(_0x53b705){_0x13e465['push'](_0x13e465['shift']());}}}(a5_0x5b4a,0xf2219));import a5_0x311b8b from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a5_0x3a2e0a from'node:path';import{fileURLToPath}from'node:url';function a5_0x53ff(_0xad6412,_0x288315){const _0x5b4a62=a5_0x5b4a();return a5_0x53ff=function(_0x53ff4f,_0x2652a4){_0x53ff4f=_0x53ff4f-0x184;let _0x1fbe57=_0x5b4a62[_0x53ff4f];return _0x1fbe57;},a5_0x53ff(_0xad6412,_0x288315);}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_0x5b4a(){const _0xb24c28=['dirname','\x20-\x20客户端实例文件','keys','app','src/api/','4376850sPUmXy','*\x20已生成文件:','join','replaceApiContent','*\x20API配置\x20apiConfigName\x20:\x20','init-api','log','.ts','\x20\x20\x20•\x20','\x20个模型)','string','length','format','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','forEach','typescript','resolve','12498773RCuVRB','1377412HEUPyr','replace','url','-api','utf8','12biOSxo','src/api','-client','api','success','toUpperCase','8nOEoUr','templates/generate-api','charAt','8955486RUDJED','13010283FRnoUr','tableName','api.ts.tpl','212976JgkdOr','947800hZaOzQ'];a5_0x5b4a=function(){return _0xb24c28;};return a5_0x5b4a();}export async function generateApiFile(_0x263702,_0xf422d1='',_0x2a1e6e,_0x4ad875=![]){const _0x48fd3d=a5_0x53ff,_0x1c3b93=readConfig(),_0x5f151c=_0x2a1e6e||_0x1c3b93?.[_0x48fd3d(0x1ae)];if(typeof _0x5f151c!==_0x48fd3d(0x18f)||!_0x5f151c)throw new Error(_0x48fd3d(0x192));const _0x5e471a=_0x4ad875?'CONFIG_NAMES.DEFAULT':'\x22'+_0x5f151c+'\x22',_0x4e4019=_0x4ad875?'':'\x22'+_0x5f151c+'\x22',_0x4181f0=_0xf422d1?_0xf422d1+_0x48fd3d(0x19a):_0x48fd3d(0x19f),_0x3f0854=_0xf422d1?_0xf422d1+_0x48fd3d(0x19e):'client',_0x42dc12=formatDataset(_0x263702),_0x13b55d={};_0x42dc12[_0x48fd3d(0x193)](_0x4de0fd=>{const _0x1c1b75=_0x48fd3d,_0x57e653=_0x4de0fd['apiFucName'][_0x1c1b75(0x198)](/Api$/,''),_0x187f1f=_0x57e653[_0x1c1b75(0x1a4)](0x0)[_0x1c1b75(0x1a1)]()+_0x57e653['slice'](0x1);_0x13b55d[_0x187f1f]={'tableName':_0x4de0fd[_0x1c1b75(0x1a7)],'datasetId':_0x4de0fd['code']};});const _0x373245=fileURLToPath(import.meta[_0x48fd3d(0x199)]),_0xbb2e35=a5_0x3a2e0a[_0x48fd3d(0x195)](a5_0x3a2e0a[_0x48fd3d(0x1ab)](_0x373245),'../..'),_0x2c7299=a5_0x3a2e0a[_0x48fd3d(0x187)](_0xbb2e35,_0x48fd3d(0x1a3)),_0x46db65=a5_0x3a2e0a['join'](_0x2c7299,_0x48fd3d(0x1a8)),_0x1024e=a5_0x3a2e0a[_0x48fd3d(0x187)](_0x2c7299,'client.ts.tpl');mkdirSync(_0x48fd3d(0x19d),{'recursive':!![]});const _0x5963d6=readFileSync(_0x46db65,_0x48fd3d(0x19b)),_0x121ba3=TemplateReplacer[_0x48fd3d(0x188)](_0x5963d6,_0x5f151c,_0x13b55d,Object[_0x48fd3d(0x1ad)](_0x13b55d)[0x0],_0x4181f0,_0x5e471a),_0x5e29ed=await a5_0x311b8b[_0x48fd3d(0x191)](_0x121ba3,{'parser':'typescript'}),_0x33c823='src/api/'+_0x4181f0+_0x48fd3d(0x18c);writeFileSync(_0x33c823,_0x5e29ed,{'encoding':'utf8'});const _0x2e66a7=readFileSync(_0x1024e,_0x48fd3d(0x19b)),_0x3a1a30=TemplateReplacer['replaceApiContent'](_0x2e66a7,_0x5f151c,_0x13b55d,Object[_0x48fd3d(0x1ad)](_0x13b55d)[0x0],_0x4181f0,_0x5e471a,_0x4e4019),_0x1499f0=await a5_0x311b8b[_0x48fd3d(0x191)](_0x3a1a30,{'parser':_0x48fd3d(0x194)}),_0x2b0dca=_0x48fd3d(0x184)+_0x3f0854+_0x48fd3d(0x18c);writeFileSync(_0x2b0dca,_0x1499f0,{'encoding':_0x48fd3d(0x19b)}),logger[_0x48fd3d(0x1a0)](_0x48fd3d(0x18a),'API\x20文件生成成功!'),console[_0x48fd3d(0x18b)](_0x48fd3d(0x186)),console[_0x48fd3d(0x18b)](_0x48fd3d(0x18d)+_0x33c823+'\x20-\x20模型配置文件\x20('+Object[_0x48fd3d(0x1ad)](_0x13b55d)[_0x48fd3d(0x190)]+_0x48fd3d(0x18e)),console[_0x48fd3d(0x18b)](_0x48fd3d(0x18d)+_0x2b0dca+_0x48fd3d(0x1ac)),console[_0x48fd3d(0x18b)](_0x48fd3d(0x189)+_0x5e471a),console[_0x48fd3d(0x18b)]('*\x20可以开始使用:\x20import\x20{\x20lovrabetClient\x20}\x20from\x20\x27@/api/'+_0x3f0854+'\x27');}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0x5eb058,_0x175b0e){const _0x2188d4=a6_0x4073,_0x58b11f=_0x5eb058();while(!![]){try{const _0x20e15c=parseInt(_0x2188d4(0x18f))/0x1*(-parseInt(_0x2188d4(0x19a))/0x2)+parseInt(_0x2188d4(0x198))/0x3+-parseInt(_0x2188d4(0x192))/0x4*(-parseInt(_0x2188d4(0x18d))/0x5)+-parseInt(_0x2188d4(0x199))/0x6+parseInt(_0x2188d4(0x18c))/0x7+parseInt(_0x2188d4(0x190))/0x8+-parseInt(_0x2188d4(0x195))/0x9*(parseInt(_0x2188d4(0x18e))/0xa);if(_0x20e15c===_0x175b0e)break;else _0x58b11f['push'](_0x58b11f['shift']());}catch(_0x246a53){_0x58b11f['push'](_0x58b11f['shift']());}}}(a6_0x6f48,0x73ec8));import{jsx as a6_0x33f040}from'react/jsx-runtime';function a6_0x4073(_0x3209f0,_0x1f7230){const _0x6f485c=a6_0x6f48();return a6_0x4073=function(_0x40738c,_0x19a72f){_0x40738c=_0x40738c-0x18b;let _0x463e8f=_0x6f485c[_0x40738c];return _0x463e8f;},a6_0x4073(_0x3209f0,_0x1f7230);}import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';function a6_0x6f48(){const _0x5c0d8d=['119576BzALWa','\x20\x20lovrabet\x20api\x20pull\x20[app-code]\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','6414877JYiGSR','222895BqTaLP','10623480XnWvCQ','7bXuvRo','1819744lPNmjj','input','64oacbmk','pull','\x20\x20\x20\x20app-code:\x20可选的应用AppCode,不指定则使用配置的默认值','9XIGFrN','exit','log','1352622jzDhus','2113974dUHWYs'];a6_0x6f48=function(){return _0x5c0d8d;};return a6_0x6f48();}export async function apiCli(_0x269840){const _0x3730fa=a6_0x4073,_0x387b92=_0x269840[_0x3730fa(0x191)][0x1];if(_0x387b92===_0x3730fa(0x193)){const _0x55e2a2=_0x269840['input'][0x2];render(a6_0x33f040(ApiPullUI,{'appCode':_0x55e2a2}));}else console['error']('Unknown\x20api\x20command:\x20'+_0x387b92),console[_0x3730fa(0x197)]('Available\x20commands:'),console[_0x3730fa(0x197)](_0x3730fa(0x18b)),console[_0x3730fa(0x197)](_0x3730fa(0x194)),process[_0x3730fa(0x196)](0x1);}
1
+ (function(_0x279ae0,_0x3e93b5){const _0x2b4128=a6_0x49ba,_0x1f5394=_0x279ae0();while(!![]){try{const _0x74a2da=-parseInt(_0x2b4128(0x1d5))/0x1+-parseInt(_0x2b4128(0x1ce))/0x2+-parseInt(_0x2b4128(0x1c7))/0x3*(-parseInt(_0x2b4128(0x1c8))/0x4)+parseInt(_0x2b4128(0x1c5))/0x5*(-parseInt(_0x2b4128(0x1d0))/0x6)+-parseInt(_0x2b4128(0x1cc))/0x7+parseInt(_0x2b4128(0x1cd))/0x8+-parseInt(_0x2b4128(0x1d1))/0x9*(-parseInt(_0x2b4128(0x1cb))/0xa);if(_0x74a2da===_0x3e93b5)break;else _0x1f5394['push'](_0x1f5394['shift']());}catch(_0x37fcb4){_0x1f5394['push'](_0x1f5394['shift']());}}}(a6_0x1c0b,0xb7b9c));import{jsx as a6_0x1ca228}from'react/jsx-runtime';import{render}from'ink';function a6_0x49ba(_0x59ac6a,_0x351d32){const _0x1c0b33=a6_0x1c0b();return a6_0x49ba=function(_0x49badb,_0x1377ac){_0x49badb=_0x49badb-0x1c5;let _0x125bf5=_0x1c0b33[_0x49badb];return _0x125bf5;},a6_0x49ba(_0x59ac6a,_0x351d32);}import{ApiPullUI}from'./api-pull-ui.js';export async function apiCli(_0xf29757){const _0x2f21ed=a6_0x49ba,_0x2e421f=_0xf29757[_0x2f21ed(0x1d4)][0x1];if(_0x2e421f===_0x2f21ed(0x1d2)){const _0x5ccf98=_0xf29757[_0x2f21ed(0x1d4)][0x2];render(a6_0x1ca228(ApiPullUI,{'appCode':_0x5ccf98}));}else console[_0x2f21ed(0x1c9)](_0x2f21ed(0x1ca)+_0x2e421f),console[_0x2f21ed(0x1d6)](_0x2f21ed(0x1c6)),console[_0x2f21ed(0x1d6)](_0x2f21ed(0x1d3)),console['log']('\x20\x20\x20\x20app-code:\x20可选的应用AppCode,不指定则使用配置的默认值'),process[_0x2f21ed(0x1cf)](0x1);}function a6_0x1c0b(){const _0x39a34a=['\x20\x20lovrabet\x20api\x20pull\x20[app-code]\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','input','757641SDnURm','log','1085dAlooX','Available\x20commands:','3xukFWJ','1155256ZcXKoV','error','Unknown\x20api\x20command:\x20','16807890tXRJqj','4511255qOKqcO','11232552fUfpIq','221614tMtgis','exit','30642PlEKms','9wwSXGN','pull'];a6_0x1c0b=function(){return _0x39a34a;};return a6_0x1c0b();}
@@ -1 +1 @@
1
- (function(_0x43a5e7,_0x26148a){const _0x56322f=a7_0x2365,_0x638905=_0x43a5e7();while(!![]){try{const _0x38c656=parseInt(_0x56322f(0xf9))/0x1+-parseInt(_0x56322f(0xfb))/0x2*(-parseInt(_0x56322f(0xee))/0x3)+parseInt(_0x56322f(0xed))/0x4+-parseInt(_0x56322f(0xf2))/0x5+parseInt(_0x56322f(0xd6))/0x6*(parseInt(_0x56322f(0xdd))/0x7)+-parseInt(_0x56322f(0xe8))/0x8*(-parseInt(_0x56322f(0xe3))/0x9)+parseInt(_0x56322f(0xdf))/0xa*(-parseInt(_0x56322f(0xe4))/0xb);if(_0x38c656===_0x26148a)break;else _0x638905['push'](_0x638905['shift']());}catch(_0x44c805){_0x638905['push'](_0x638905['shift']());}}}(a7_0xd9ff,0x64f9e));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{generateApiFile}from'./generate-api-file.js';function a7_0xd9ff(){const _0x12e2c1=['success','*\x20正在从服务器拉取\x20API\x20配置...','cwd','773010KoyEsv','error','54AgAXzh','*\x20正在处理\x20','×\x20服务器返回错误:','API\x20配置拉取异常:\x20','API\x20配置拉取成功:\x20',',且无法读取错误响应内容','data','8430vZYapp','未知错误','获取数据集失败,HTTP状态码:\x20','*\x20开始生成\x20API\x20配置文件:','client','\x20\x20\x20•\x20','create-api-pull','3262npMwfq','/smartapi/dataset/getList?appCode=','7607780Vtjfet','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','message','-client','36HnDjbz','22qdpNpd','status','.ts\x20-\x20模型配置文件','获取数据集失败,原因:登录鉴权失败,登录已过期','552208KELgRj','length','-api','chdir','json','822120GMPptb','6012nQgTqs','log','info','url','141640EybFWH','tableData','×\x20API\x20配置拉取异常:','&pageSize=999&currentPage=1'];a7_0xd9ff=function(){return _0x12e2c1;};return a7_0xd9ff();}import{logger}from'../utils/logger.js';function a7_0x2365(_0x309d2f,_0x5b7158){const _0xd9ff05=a7_0xd9ff();return a7_0x2365=function(_0x236514,_0x427a9f){_0x236514=_0x236514-0xd1;let _0x494db1=_0xd9ff05[_0x236514];return _0x494db1;},a7_0x2365(_0x309d2f,_0x5b7158);}export async function pullApiSilent(_0x3eef91,_0x4d2a0d,_0x4ab7df){const _0x4aa770=a7_0x2365;let _0x3f4d1d;try{const _0x34ced9=_0x4d2a0d?.['trim']()||'';if(_0x34ced9){const _0x143990=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x143990['test'](_0x34ced9))return console[_0x4aa770(0xfa)](_0x4aa770(0xe0)),![];}_0x4ab7df&&(_0x3f4d1d=process[_0x4aa770(0xf8)](),process[_0x4aa770(0xeb)](_0x4ab7df));console[_0x4aa770(0xef)](_0x4aa770(0xf7));const _0x5c167b=await fetch(getApiDomain()+_0x4aa770(0xde)+_0x3eef91+_0x4aa770(0xf5),{'headers':{'Cookie':getCookie()}});if(_0x5c167b['ok']){const _0x452e9b=await _0x5c167b[_0x4aa770(0xec)]();if(_0x452e9b[_0x4aa770(0xf6)]){const _0x394860=_0x34ced9?_0x34ced9+_0x4aa770(0xea):'api',_0x335e36=_0x34ced9?_0x34ced9+_0x4aa770(0xe2):_0x4aa770(0xda);return console[_0x4aa770(0xef)](_0x4aa770(0xd9)),console[_0x4aa770(0xef)](_0x4aa770(0xdb)+_0x394860+_0x4aa770(0xe6)),console[_0x4aa770(0xef)](_0x4aa770(0xdb)+_0x335e36+'.ts\x20-\x20客户端实例文件'),console[_0x4aa770(0xef)](_0x4aa770(0xfc)+_0x452e9b[_0x4aa770(0xd5)][_0x4aa770(0xf3)]['length']+'\x20个数据集...'),await generateApiFile(_0x452e9b[_0x4aa770(0xd5)][_0x4aa770(0xf3)],_0x34ced9,_0x3eef91,!![]),console['log']('√\x20API\x20配置文件生成完成'),_0x4ab7df&&logger[_0x4aa770(0xf0)](_0x4aa770(0xdc),_0x4aa770(0xd3)+_0x3eef91,{'projectPath':_0x4ab7df,'appCode':_0x3eef91,'datasetCount':_0x452e9b['data'][_0x4aa770(0xf3)][_0x4aa770(0xe9)],'filePrefix':_0x34ced9}),!![];}else return console['error'](_0x4aa770(0xd1),_0x452e9b['message']||_0x4aa770(0xd7)),_0x4ab7df&&logger[_0x4aa770(0xfa)](_0x4aa770(0xdc),'API\x20配置拉取失败:\x20'+(_0x452e9b['message']||_0x4aa770(0xd7)),{'projectPath':_0x4ab7df,'appCode':_0x3eef91}),![];}else{if(_0x5c167b[_0x4aa770(0xe5)]===0x191){const _0x3bea3e=_0x4aa770(0xe7);console[_0x4aa770(0xfa)]('×\x20'+_0x3bea3e),_0x4ab7df&&logger[_0x4aa770(0xfa)](_0x4aa770(0xdc),_0x3bea3e,{'status':_0x5c167b[_0x4aa770(0xe5)],'appCode':_0x3eef91,'url':_0x5c167b[_0x4aa770(0xf1)],'projectPath':_0x4ab7df});}else{const _0x438424=_0x4aa770(0xd8)+_0x5c167b['status'];console[_0x4aa770(0xfa)]('×\x20'+_0x438424);try{const _0x2413bd=await _0x5c167b['text']();_0x2413bd&&console[_0x4aa770(0xfa)]('×\x20错误详情:',_0x2413bd),_0x4ab7df&&logger[_0x4aa770(0xfa)](_0x4aa770(0xdc),_0x438424,{'status':_0x5c167b[_0x4aa770(0xe5)],'appCode':_0x3eef91,'url':_0x5c167b[_0x4aa770(0xf1)],'errorBody':_0x2413bd,'projectPath':_0x4ab7df});}catch(_0x3929e6){console[_0x4aa770(0xfa)]('×\x20无法读取错误响应内容'),_0x4ab7df&&logger[_0x4aa770(0xfa)](_0x4aa770(0xdc),_0x438424+_0x4aa770(0xd4),{'status':_0x5c167b[_0x4aa770(0xe5)],'appCode':_0x3eef91,'url':_0x5c167b[_0x4aa770(0xf1)],'readError':_0x3929e6 instanceof Error?_0x3929e6['message']:String(_0x3929e6),'projectPath':_0x4ab7df});}}return![];}}catch(_0x2ab089){const _0xd353b0=_0x2ab089 instanceof Error?_0x2ab089[_0x4aa770(0xe1)]:String(_0x2ab089);return console[_0x4aa770(0xfa)](_0x4aa770(0xf4),_0xd353b0),_0x4ab7df&&logger[_0x4aa770(0xfa)](_0x4aa770(0xdc),_0x4aa770(0xd2)+_0xd353b0,{'appCode':_0x3eef91,'projectPath':_0x4ab7df}),![];}finally{_0x3f4d1d&&process['chdir'](_0x3f4d1d);}}
1
+ (function(_0x41283d,_0x3f87b5){const _0x5024fb=a7_0x326c,_0x2c8cbc=_0x41283d();while(!![]){try{const _0x1c3ca8=-parseInt(_0x5024fb(0x1ea))/0x1*(-parseInt(_0x5024fb(0x1d3))/0x2)+-parseInt(_0x5024fb(0x1d9))/0x3*(parseInt(_0x5024fb(0x1ee))/0x4)+-parseInt(_0x5024fb(0x1e0))/0x5+-parseInt(_0x5024fb(0x1e9))/0x6+-parseInt(_0x5024fb(0x1e7))/0x7*(parseInt(_0x5024fb(0x1ec))/0x8)+parseInt(_0x5024fb(0x1f3))/0x9+-parseInt(_0x5024fb(0x1cd))/0xa*(-parseInt(_0x5024fb(0x1da))/0xb);if(_0x1c3ca8===_0x3f87b5)break;else _0x2c8cbc['push'](_0x2c8cbc['shift']());}catch(_0x207616){_0x2c8cbc['push'](_0x2c8cbc['shift']());}}}(a7_0x297a,0x442f9));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{generateApiFile}from'./generate-api-file.js';function a7_0x326c(_0x379fcd,_0x289638){const _0x297a7c=a7_0x297a();return a7_0x326c=function(_0x326cc5,_0x3d79e7){_0x326cc5=_0x326cc5-0x1cc;let _0x173171=_0x297a7c[_0x326cc5];return _0x173171;},a7_0x326c(_0x379fcd,_0x289638);}function a7_0x297a(){const _0x2bd12f=[',且无法读取错误响应内容','create-api-pull','data','2201202FYBEeP','message','status','-client','trim','×\x20API\x20配置拉取异常:','4089110gDupQI','.ts\x20-\x20客户端实例文件','error','/smartapi/dataset/getList?appCode=','*\x20正在处理\x20','tableData','82978MFyKRy','.ts\x20-\x20模型配置文件','length','×\x20错误详情:','*\x20正在从服务器拉取\x20API\x20配置...','API\x20配置拉取异常:\x20','1273746oFtzRm','22CztgOw','API\x20配置拉取成功:\x20','log','未知错误','cwd','chdir','1898330EQEUfQ','url','api','test','×\x20无法读取错误响应内容','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','json','427889EYGXZN','info','633258ZlMxOs','6zCaVSk','\x20\x20\x20•\x20','16uhlpTv','×\x20服务器返回错误:','4ZdgAAH','-api'];a7_0x297a=function(){return _0x2bd12f;};return a7_0x297a();}import{logger}from'../utils/logger.js';export async function pullApiSilent(_0x4da5e5,_0xf31f32,_0x5adf71){const _0x801ebd=a7_0x326c;let _0x1977e6;try{const _0x4d59d2=_0xf31f32?.[_0x801ebd(0x1f7)]()||'';if(_0x4d59d2){const _0x25f1d9=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x25f1d9[_0x801ebd(0x1e3)](_0x4d59d2))return console[_0x801ebd(0x1cf)](_0x801ebd(0x1e5)),![];}_0x5adf71&&(_0x1977e6=process[_0x801ebd(0x1de)](),process['chdir'](_0x5adf71));console[_0x801ebd(0x1dc)](_0x801ebd(0x1d7));const _0x1686e1=await fetch(getApiDomain()+_0x801ebd(0x1d0)+_0x4da5e5+'&pageSize=999&currentPage=1',{'headers':{'Cookie':getCookie()}});if(_0x1686e1['ok']){const _0x5960ee=await _0x1686e1[_0x801ebd(0x1e6)]();if(_0x5960ee['success']){const _0x3b7f15=_0x4d59d2?_0x4d59d2+_0x801ebd(0x1ef):_0x801ebd(0x1e2),_0x43b86e=_0x4d59d2?_0x4d59d2+_0x801ebd(0x1f6):'client';return console['log']('*\x20开始生成\x20API\x20配置文件:'),console[_0x801ebd(0x1dc)](_0x801ebd(0x1eb)+_0x3b7f15+_0x801ebd(0x1d4)),console[_0x801ebd(0x1dc)](_0x801ebd(0x1eb)+_0x43b86e+_0x801ebd(0x1ce)),console[_0x801ebd(0x1dc)](_0x801ebd(0x1d1)+_0x5960ee['data'][_0x801ebd(0x1d2)][_0x801ebd(0x1d5)]+'\x20个数据集...'),await generateApiFile(_0x5960ee[_0x801ebd(0x1f2)]['tableData'],_0x4d59d2,_0x4da5e5,!![]),console[_0x801ebd(0x1dc)]('√\x20API\x20配置文件生成完成'),_0x5adf71&&logger[_0x801ebd(0x1e8)](_0x801ebd(0x1f1),_0x801ebd(0x1db)+_0x4da5e5,{'projectPath':_0x5adf71,'appCode':_0x4da5e5,'datasetCount':_0x5960ee[_0x801ebd(0x1f2)][_0x801ebd(0x1d2)][_0x801ebd(0x1d5)],'filePrefix':_0x4d59d2}),!![];}else return console[_0x801ebd(0x1cf)](_0x801ebd(0x1ed),_0x5960ee[_0x801ebd(0x1f4)]||_0x801ebd(0x1dd)),_0x5adf71&&logger[_0x801ebd(0x1cf)]('create-api-pull','API\x20配置拉取失败:\x20'+(_0x5960ee[_0x801ebd(0x1f4)]||_0x801ebd(0x1dd)),{'projectPath':_0x5adf71,'appCode':_0x4da5e5}),![];}else{if(_0x1686e1['status']===0x191){const _0x5527ee='获取数据集失败,原因:登录鉴权失败,登录已过期';console['error']('×\x20'+_0x5527ee),_0x5adf71&&logger[_0x801ebd(0x1cf)](_0x801ebd(0x1f1),_0x5527ee,{'status':_0x1686e1[_0x801ebd(0x1f5)],'appCode':_0x4da5e5,'url':_0x1686e1['url'],'projectPath':_0x5adf71});}else{const _0x2aa08c='获取数据集失败,HTTP状态码:\x20'+_0x1686e1['status'];console[_0x801ebd(0x1cf)]('×\x20'+_0x2aa08c);try{const _0x22fae6=await _0x1686e1['text']();_0x22fae6&&console[_0x801ebd(0x1cf)](_0x801ebd(0x1d6),_0x22fae6),_0x5adf71&&logger[_0x801ebd(0x1cf)](_0x801ebd(0x1f1),_0x2aa08c,{'status':_0x1686e1[_0x801ebd(0x1f5)],'appCode':_0x4da5e5,'url':_0x1686e1['url'],'errorBody':_0x22fae6,'projectPath':_0x5adf71});}catch(_0x5ed5e9){console[_0x801ebd(0x1cf)](_0x801ebd(0x1e4)),_0x5adf71&&logger[_0x801ebd(0x1cf)](_0x801ebd(0x1f1),_0x2aa08c+_0x801ebd(0x1f0),{'status':_0x1686e1[_0x801ebd(0x1f5)],'appCode':_0x4da5e5,'url':_0x1686e1[_0x801ebd(0x1e1)],'readError':_0x5ed5e9 instanceof Error?_0x5ed5e9['message']:String(_0x5ed5e9),'projectPath':_0x5adf71});}}return![];}}catch(_0x374da9){const _0x2af458=_0x374da9 instanceof Error?_0x374da9['message']:String(_0x374da9);return console['error'](_0x801ebd(0x1cc),_0x2af458),_0x5adf71&&logger[_0x801ebd(0x1cf)](_0x801ebd(0x1f1),_0x801ebd(0x1d8)+_0x2af458,{'appCode':_0x4da5e5,'projectPath':_0x5adf71}),![];}finally{_0x1977e6&&process[_0x801ebd(0x1df)](_0x1977e6);}}