@lovrabet/cli 1.1.1 → 1.1.3

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/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
  44. package/templates/pages/sdk-fetch/index.tsx.tpl +14 -5
  45. package/templates/projects/sub-app-react-demo/package.json +1 -1
package/README.md CHANGED
@@ -1,28 +1,303 @@
1
- # lovrabet
1
+ # Lovrabet CLI
2
2
 
3
- ## 内部体验试用
3
+ 一个强大的前端开发脚手架工具,专为 [Lovrabet](https://www.lovrabet.com) 开放平台应用开发而设计。提供项目创建、页面生成、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(_0x8f5dc0,_0x54d381){const _0x21beb1=a0_0x2b3c,_0x1c1f94=_0x8f5dc0();while(!![]){try{const _0x113493=parseInt(_0x21beb1(0x13f))/0x1+parseInt(_0x21beb1(0x147))/0x2+-parseInt(_0x21beb1(0x144))/0x3*(-parseInt(_0x21beb1(0x148))/0x4)+-parseInt(_0x21beb1(0x153))/0x5+parseInt(_0x21beb1(0x137))/0x6*(-parseInt(_0x21beb1(0x156))/0x7)+-parseInt(_0x21beb1(0x136))/0x8*(parseInt(_0x21beb1(0x14a))/0x9)+parseInt(_0x21beb1(0x150))/0xa*(parseInt(_0x21beb1(0x13d))/0xb);if(_0x113493===_0x54d381)break;else _0x1c1f94['push'](_0x1c1f94['shift']());}catch(_0x675cd){_0x1c1f94['push'](_0x1c1f94['shift']());}}}(a0_0x296b,0x21ce6));function a0_0x296b(){const _0x2e941f=['my-page','endsWith','364705OMYFhP','green','251735nbbNgy','split','startsWith','页面路径不合法','\x20已存在,请使用其他路径','354738XRlgll','路径不能包含连续的\x20/','red','153054ndGVvw','8edaNOZ','delete','324099ILbzaC','includes','test','existsSync','backspace','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','50uffSzJ','\x20←\x20','\x20直接回车确认,或输入自定义路由地址','704770IzWwMg','gray','页面路由地址:\x20','948675jsHUXK','40sLqpvO','12ayZNft','\x20Step2:\x20','length','路径不能以\x20/\x20开头或结尾'];a0_0x296b=function(){return _0x2e941f;};return a0_0x296b();}import{jsx as a0_0x4190e3,jsxs as a0_0x32133c}from'react/jsx-runtime';function a0_0x2b3c(_0x3bc293,_0x5f50a2){const _0x296b0a=a0_0x296b();return a0_0x2b3c=function(_0x2b3cfd,_0x8b15d5){_0x2b3cfd=_0x2b3cfd-0x136;let _0x2c244b=_0x296b0a[_0x2b3cfd];return _0x2c244b;},a0_0x2b3c(_0x3bc293,_0x5f50a2);}import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x230913 from'node:fs';export function InputProjectCode(_0x1fc0ab){const _0x1e23c6=a0_0x2b3c,{onSubmit:_0x1f0677,pagePath:_0x2a6fc6}=_0x1fc0ab,[_0x578dd6,_0x1e3ef9]=useState(''),[_0x10b1dd,_0x58e4d5]=useState(''),_0x36925c=_0x1e23c6(0x13b);function _0x1ed2cb(_0x444520){const _0x50a7ba=_0x1e23c6;if(_0x444520[_0x50a7ba(0x139)]>0x64)return{'valid':![],'message':'页面路径长度不能超过\x20100\x20个字符'};if(_0x444520[_0x50a7ba(0x141)]('/')||_0x444520[_0x50a7ba(0x13c)]('/'))return{'valid':![],'message':_0x50a7ba(0x13a)};if(_0x444520[_0x50a7ba(0x14b)]('//'))return{'valid':![],'message':_0x50a7ba(0x145)};const _0x199742=_0x444520[_0x50a7ba(0x140)]('/');for(const _0x4bb67d of _0x199742){if(!_0x4bb67d)continue;const _0x5dab6=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x5dab6[_0x50a7ba(0x14c)](_0x4bb67d))return{'valid':![],'message':_0x50a7ba(0x14f)};}return{'valid':!![]};}return useInput((_0x50bfcb,_0x3ba158)=>{const _0x136881=_0x1e23c6;if(_0x3ba158['return']){const _0x3e9ea0=_0x578dd6['trim']()||_0x36925c;if(_0x10b1dd)return;const _0x4fa738=_0x2a6fc6+'/'+_0x3e9ea0;if(a0_0x230913[_0x136881(0x14d)](_0x4fa738)){_0x58e4d5('页面路径\x20'+_0x3e9ea0+_0x136881(0x143));return;}_0x1f0677(_0x3e9ea0),_0x1e3ef9(''),_0x58e4d5('');}else _0x3ba158[_0x136881(0x14e)]||_0x3ba158[_0x136881(0x149)]?_0x1e3ef9(_0x61baf3=>{const _0xab16d=_0x136881,_0x2fee01=_0x61baf3['slice'](0x0,-0x1),{valid:_0x44dad4,message:_0x3da8c8}=_0x1ed2cb(_0x2fee01);return _0x58e4d5(_0x44dad4?'':_0x3da8c8||_0xab16d(0x142)),_0x2fee01;}):_0x1e3ef9(_0x5da27d=>{const _0x3fd207=_0x5da27d+_0x50bfcb,{valid:_0x57f2b9,message:_0x446280}=_0x1ed2cb(_0x3fd207);return _0x58e4d5(_0x57f2b9?'':_0x446280||'页面路径不合法'),_0x3fd207;});}),a0_0x32133c(Box,{'flexDirection':'column','children':[a0_0x32133c(Box,{'children':[a0_0x4190e3(Text,{'color':_0x1e23c6(0x154),'children':_0x1e23c6(0x138)}),a0_0x4190e3(Text,{'children':_0x1e23c6(0x155)}),_0x578dd6?a0_0x4190e3(Text,{'color':_0x1e23c6(0x13e),'children':_0x578dd6}):a0_0x4190e3(Text,{'color':_0x1e23c6(0x154),'children':_0x36925c}),_0x10b1dd&&a0_0x32133c(Text,{'color':_0x1e23c6(0x146),'children':[_0x1e23c6(0x151),_0x10b1dd]})]}),!_0x10b1dd&&!_0x578dd6&&a0_0x4190e3(Box,{'children':a0_0x4190e3(Text,{'color':_0x1e23c6(0x154),'children':_0x1e23c6(0x152)})})]});}
1
+ (function(_0x2e461f,_0x62dfbd){const _0x132572=a0_0x1b32,_0x76f3c8=_0x2e461f();while(!![]){try{const _0x3e8db0=parseInt(_0x132572(0x1fd))/0x1+parseInt(_0x132572(0x1ea))/0x2+parseInt(_0x132572(0x1eb))/0x3+-parseInt(_0x132572(0x1ec))/0x4+-parseInt(_0x132572(0x1e9))/0x5*(parseInt(_0x132572(0x1f6))/0x6)+parseInt(_0x132572(0x1fe))/0x7+-parseInt(_0x132572(0x1f7))/0x8;if(_0x3e8db0===_0x62dfbd)break;else _0x76f3c8['push'](_0x76f3c8['shift']());}catch(_0x784424){_0x76f3c8['push'](_0x76f3c8['shift']());}}}(a0_0x45a9,0xba6f3));import{jsx as a0_0x255896,jsxs as a0_0x177f52}from'react/jsx-runtime';function a0_0x45a9(){const _0x5f3b30=['页面路径\x20','delete','\x20Step2:\x20','my-page','页面路径不合法','existsSync','17838cfTQeL','11962600QYKvoy','test','页面路径长度不能超过\x20100\x20个字符','gray','split','length','484524lhNAtB','7505575qKoGGJ','return','green','trim','includes','路径不能包含连续的\x20/','startsWith','2435XyOQZj','2061576ovPJFH','4366623JVBsOR','1345068HTnwpM','column','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','red'];a0_0x45a9=function(){return _0x5f3b30;};return a0_0x45a9();}function a0_0x1b32(_0x240bf7,_0x23c528){const _0x45a9c7=a0_0x45a9();return a0_0x1b32=function(_0x1b3270,_0x35d55e){_0x1b3270=_0x1b3270-0x1e5;let _0x25d5a6=_0x45a9c7[_0x1b3270];return _0x25d5a6;},a0_0x1b32(_0x240bf7,_0x23c528);}import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x350198 from'node:fs';export function InputProjectCode(_0x54ae11){const _0x18927e=a0_0x1b32,{onSubmit:_0x5a69d0,pagePath:_0x360cd5}=_0x54ae11,[_0x6cc17e,_0x40689b]=useState(''),[_0x360f7d,_0x436ba3]=useState(''),_0x30dc01=_0x18927e(0x1f3);function _0x23ed8f(_0x52371e){const _0x36c547=_0x18927e;if(_0x52371e[_0x36c547(0x1fc)]>0x64)return{'valid':![],'message':_0x36c547(0x1f9)};if(_0x52371e[_0x36c547(0x1e8)]('/')||_0x52371e['endsWith']('/'))return{'valid':![],'message':'路径不能以\x20/\x20开头或结尾'};if(_0x52371e[_0x36c547(0x1e6)]('//'))return{'valid':![],'message':_0x36c547(0x1e7)};const _0x5d25da=_0x52371e[_0x36c547(0x1fb)]('/');for(const _0x1547dc of _0x5d25da){if(!_0x1547dc)continue;const _0x3679ff=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x3679ff[_0x36c547(0x1f8)](_0x1547dc))return{'valid':![],'message':_0x36c547(0x1ee)};}return{'valid':!![]};}return useInput((_0x4c59c2,_0x213f8d)=>{const _0x549c6d=_0x18927e;if(_0x213f8d[_0x549c6d(0x1ff)]){const _0x52d1e3=_0x6cc17e[_0x549c6d(0x1e5)]()||_0x30dc01;if(_0x360f7d)return;const _0x3336c1=_0x360cd5+'/'+_0x52d1e3;if(a0_0x350198[_0x549c6d(0x1f5)](_0x3336c1)){_0x436ba3(_0x549c6d(0x1f0)+_0x52d1e3+'\x20已存在,请使用其他路径');return;}_0x5a69d0(_0x52d1e3),_0x40689b(''),_0x436ba3('');}else _0x213f8d['backspace']||_0x213f8d[_0x549c6d(0x1f1)]?_0x40689b(_0x8b571c=>{const _0x36ea0f=_0x549c6d,_0x15255d=_0x8b571c['slice'](0x0,-0x1),{valid:_0xcc278c,message:_0x23be3f}=_0x23ed8f(_0x15255d);return _0x436ba3(_0xcc278c?'':_0x23be3f||_0x36ea0f(0x1f4)),_0x15255d;}):_0x40689b(_0x1d2697=>{const _0xab34c6=_0x549c6d,_0x55c03c=_0x1d2697+_0x4c59c2,{valid:_0x572b6c,message:_0x45b8b3}=_0x23ed8f(_0x55c03c);return _0x436ba3(_0x572b6c?'':_0x45b8b3||_0xab34c6(0x1f4)),_0x55c03c;});}),a0_0x177f52(Box,{'flexDirection':_0x18927e(0x1ed),'children':[a0_0x177f52(Box,{'children':[a0_0x255896(Text,{'color':_0x18927e(0x1fa),'children':_0x18927e(0x1f2)}),a0_0x255896(Text,{'children':'页面路由地址:\x20'}),_0x6cc17e?a0_0x255896(Text,{'color':_0x18927e(0x200),'children':_0x6cc17e}):a0_0x255896(Text,{'color':_0x18927e(0x1fa),'children':_0x30dc01}),_0x360f7d&&a0_0x177f52(Text,{'color':_0x18927e(0x1ef),'children':['\x20←\x20',_0x360f7d]})]}),!_0x360f7d&&!_0x6cc17e&&a0_0x255896(Box,{'children':a0_0x255896(Text,{'color':'gray','children':'\x20直接回车确认,或输入自定义路由地址'})})]});}
@@ -1 +1 @@
1
- const a1_0x3144e0=a1_0xcce0;function a1_0x1857(){const _0x120770=['pages','catch','join','\x20*\x20路由地址:\x20','then','now','1453527UWnpgg','27996IHHpnF','15zmWvzU','36VfKsuO','finally','1130856VyodKX','src','processTemplate','success','\x20Step1:\x20','url','6138457LhNXzu','add-page','gray','\x20Step2:\x20','\x20*\x20页面文件已创建,可直接通过路由访问','\x20*\x20页面路径:\x20','error','3zFloXi','开始添加页面:\x20','已输入的页面路由\x20','5398790DQTdTa','页面添加成功:\x20','resolve','33gWiJRB','cyan','column','green','204814kIpzIp','setLogPath','正在创建页面,请稍候…','1267rCwTEi','341200ASCUKh','36jsKBmP'];a1_0x1857=function(){return _0x120770;};return a1_0x1857();}(function(_0x504466,_0x3f05be){const _0x3adb68=a1_0xcce0,_0x1f8989=_0x504466();while(!![]){try{const _0x1e3da7=-parseInt(_0x3adb68(0x146))/0x1*(parseInt(_0x3adb68(0x150))/0x2)+-parseInt(_0x3adb68(0x15c))/0x3+-parseInt(_0x3adb68(0x161))/0x4*(-parseInt(_0x3adb68(0x15e))/0x5)+-parseInt(_0x3adb68(0x15d))/0x6*(-parseInt(_0x3adb68(0x153))/0x7)+-parseInt(_0x3adb68(0x154))/0x8*(-parseInt(_0x3adb68(0x155))/0x9)+-parseInt(_0x3adb68(0x149))/0xa*(parseInt(_0x3adb68(0x14c))/0xb)+-parseInt(_0x3adb68(0x15f))/0xc*(-parseInt(_0x3adb68(0x13f))/0xd);if(_0x1e3da7===_0x3f05be)break;else _0x1f8989['push'](_0x1f8989['shift']());}catch(_0x3bb5e3){_0x1f8989['push'](_0x1f8989['shift']());}}}(a1_0x1857,0xd4088));import{jsx as a1_0x3d73f8,jsxs as a1_0x11339f,Fragment as a1_0x448153}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x25a9ef from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a1_0xcce0(_0x4abc18,_0x558175){const _0x185770=a1_0x1857();return a1_0xcce0=function(_0xcce09e,_0x5be689){_0xcce09e=_0xcce09e-0x13c;let _0x20429f=_0x185770[_0xcce09e];return _0x20429f;},a1_0xcce0(_0x4abc18,_0x558175);}import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x25a9ef['dirname'](fileURLToPath(import.meta[a1_0x3144e0(0x13e)])),pageTemplateDir=a1_0x25a9ef[a1_0x3144e0(0x14b)](__dirname,'../../templates/pages'),projectDir=process['cwd']();export const AddPage=()=>{const _0x566a7d=a1_0x3144e0,{exit:_0x350242}=useApp(),[_0x27c846,_0x7828fc]=useState(''),[_0x197895,_0xfc4d39]=useState(''),[_0x4974f6,_0x5ce08c]=useState(![]),[_0x20aaf0,_0x417bdd]=useState(![]),_0x529769=a1_0x25a9ef[_0x566a7d(0x158)](projectDir,_0x566a7d(0x162),_0x566a7d(0x156)),_0x155988=a1_0x25a9ef['join'](_0x529769,_0x197895),_0x8192b4=a1_0x25a9ef['join']('src',_0x566a7d(0x156),_0x197895);useEffect(()=>{const _0x30a24c=_0x566a7d,_0x40425b=a1_0x25a9ef['resolve'](pageTemplateDir,_0x27c846);if(_0x27c846&&_0x197895){_0x5ce08c(!![]),logger[_0x30a24c(0x151)](process['cwd']());const _0x28c9dc=Date[_0x30a24c(0x15b)]();logger['info'](_0x30a24c(0x140),_0x30a24c(0x147)+_0x197895,{'template':_0x27c846,'targetPath':_0x8192b4}),TemplateReplacer[_0x30a24c(0x163)](_0x40425b,a1_0x25a9ef['join'](_0x529769,_0x197895),_0x197895,_0x27c846)[_0x30a24c(0x15a)](()=>{const _0x23a720=_0x30a24c,_0x784493=Date['now']()-_0x28c9dc;logger[_0x23a720(0x13c)](_0x23a720(0x140),_0x23a720(0x14a)+_0x197895,_0x784493,{'template':_0x27c846,'targetPath':_0x8192b4,'routePath':_0x197895}),_0x417bdd(!![]);})[_0x30a24c(0x157)](_0x213ee3=>{const _0x17def8=_0x30a24c,_0x1e7fef=Date['now']()-_0x28c9dc;logger[_0x17def8(0x145)](_0x17def8(0x140),'页面添加失败:\x20'+_0x197895,{'template':_0x27c846,'targetPath':_0x8192b4,'error':_0x213ee3 instanceof Error?_0x213ee3['message']:String(_0x213ee3),'duration':_0x1e7fef});})[_0x30a24c(0x160)](()=>{_0x5ce08c(![]);});}},[_0x27c846,_0x197895]),useEffect(()=>{_0x20aaf0&&setTimeout(()=>{_0x350242();});},[_0x20aaf0]);if(_0x27c846)return a1_0x11339f(Box,{'flexDirection':_0x566a7d(0x14e),'paddingY':0x1,'children':[a1_0x11339f(Box,{'children':[a1_0x3d73f8(Text,{'color':'gray','children':_0x566a7d(0x13d)}),a1_0x3d73f8(Text,{'children':'已选择页面模板\x20'}),a1_0x3d73f8(Text,{'color':_0x566a7d(0x14f),'children':_0x27c846})]}),_0x197895?a1_0x11339f(Box,{'children':[a1_0x3d73f8(Text,{'color':_0x566a7d(0x141),'children':_0x566a7d(0x142)}),a1_0x3d73f8(Text,{'children':_0x566a7d(0x148)}),a1_0x3d73f8(Text,{'color':'green','children':_0x197895})]}):a1_0x3d73f8(InputProjectCode,{'pagePath':_0x155988,'onSubmit':_0xfc4d39}),_0x197895&&_0x4974f6?a1_0x11339f(Box,{'marginTop':0x1,'children':[a1_0x3d73f8(Box,{'width':'4'}),a1_0x3d73f8(Text,{'children':_0x566a7d(0x152)})]}):null,_0x20aaf0?a1_0x11339f(a1_0x448153,{'children':[a1_0x3d73f8(Box,{'marginTop':0x1,'children':a1_0x3d73f8(Text,{'color':_0x566a7d(0x141),'children':'\x20*\x20页面创建成功!'})}),a1_0x11339f(Box,{'children':[a1_0x3d73f8(Text,{'color':'gray','children':_0x566a7d(0x144)}),a1_0x3d73f8(Text,{'color':'green','children':_0x8192b4})]}),a1_0x11339f(Box,{'children':[a1_0x3d73f8(Text,{'color':_0x566a7d(0x141),'children':_0x566a7d(0x159)}),a1_0x11339f(Text,{'color':_0x566a7d(0x14f),'children':['/',_0x197895]})]}),a1_0x3d73f8(Box,{'marginTop':0x1,'children':a1_0x3d73f8(Text,{'color':_0x566a7d(0x14d),'children':_0x566a7d(0x143)})})]}):null]});return a1_0x3d73f8(SelectPageTemplate,{'onSelect':_0x7828fc});};
1
+ function a1_0x229f(){const _0x27fbb6=['\x20*\x20页面路径:\x20','正在创建页面,请稍候…','24pTmfnO','144xPYoeI','125ThCKrs','已输入的页面路由\x20','join','green','页面添加失败:\x20','页面添加成功:\x20','add-page','cwd','131305HtZUFr','29490108AFuhBz','src','now','info','resolve','../../templates/pages','\x20*\x20页面创建成功!','then','7515541mOEYMf','message','10kYLQvT','48537KIntAo','13dgdXnd','49tAXMvl','setLogPath','gray','dirname','\x20Step2:\x20','540312ddJYRx','1148934SPeout','21652PtldiM','pages','\x20Step1:\x20'];a1_0x229f=function(){return _0x27fbb6;};return a1_0x229f();}const a1_0x3bd643=a1_0x4603;(function(_0x49e910,_0x4e2a6b){const _0x4ac08e=a1_0x4603,_0x409c2f=_0x49e910();while(!![]){try{const _0x1539c2=-parseInt(_0x4ac08e(0xf1))/0x1*(-parseInt(_0x4ac08e(0x10b))/0x2)+-parseInt(_0x4ac08e(0x104))/0x3+-parseInt(_0x4ac08e(0x106))/0x4*(parseInt(_0x4ac08e(0x10d))/0x5)+-parseInt(_0x4ac08e(0x105))/0x6*(-parseInt(_0x4ac08e(0xff))/0x7)+parseInt(_0x4ac08e(0x10c))/0x8*(parseInt(_0x4ac08e(0xfd))/0x9)+-parseInt(_0x4ac08e(0xfc))/0xa*(-parseInt(_0x4ac08e(0xfa))/0xb)+-parseInt(_0x4ac08e(0xf2))/0xc*(parseInt(_0x4ac08e(0xfe))/0xd);if(_0x1539c2===_0x4e2a6b)break;else _0x409c2f['push'](_0x409c2f['shift']());}catch(_0xbcd175){_0x409c2f['push'](_0x409c2f['shift']());}}}(a1_0x229f,0xe173a));import{jsx as a1_0x545af1,jsxs as a1_0x25eecd,Fragment as a1_0x1413db}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x3ad482 from'node:path';import{useEffect,useState}from'react';function a1_0x4603(_0xee0d76,_0x4c5387){const _0x229fc3=a1_0x229f();return a1_0x4603=function(_0x460326,_0x572149){_0x460326=_0x460326-0xeb;let _0x21f2bf=_0x229fc3[_0x460326];return _0x21f2bf;},a1_0x4603(_0xee0d76,_0x4c5387);}import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x3ad482[a1_0x3bd643(0x102)](fileURLToPath(import.meta['url'])),pageTemplateDir=a1_0x3ad482[a1_0x3bd643(0xf6)](__dirname,a1_0x3bd643(0xf7)),projectDir=process[a1_0x3bd643(0xf0)]();export const AddPage=()=>{const _0x83fc25=a1_0x3bd643,{exit:_0x902d0c}=useApp(),[_0x3c8fcb,_0xb5fae3]=useState(''),[_0x88daa1,_0x315a2c]=useState(''),[_0x38cbde,_0x5d4136]=useState(![]),[_0x435aa4,_0x257141]=useState(![]),_0x141d9b=a1_0x3ad482[_0x83fc25(0xeb)](projectDir,'src',_0x83fc25(0x107)),_0x1c5147=a1_0x3ad482[_0x83fc25(0xeb)](_0x141d9b,_0x88daa1),_0x374035=a1_0x3ad482[_0x83fc25(0xeb)](_0x83fc25(0xf3),_0x83fc25(0x107),_0x88daa1);useEffect(()=>{const _0x578381=_0x83fc25,_0x3ec014=a1_0x3ad482['resolve'](pageTemplateDir,_0x3c8fcb);if(_0x3c8fcb&&_0x88daa1){_0x5d4136(!![]),logger[_0x578381(0x100)](process[_0x578381(0xf0)]());const _0xb5cba1=Date[_0x578381(0xf4)]();logger[_0x578381(0xf5)](_0x578381(0xef),'开始添加页面:\x20'+_0x88daa1,{'template':_0x3c8fcb,'targetPath':_0x374035}),TemplateReplacer['processTemplate'](_0x3ec014,a1_0x3ad482[_0x578381(0xeb)](_0x141d9b,_0x88daa1),_0x88daa1,_0x3c8fcb)[_0x578381(0xf9)](()=>{const _0x525fed=_0x578381,_0x373aea=Date[_0x525fed(0xf4)]()-_0xb5cba1;logger['success'](_0x525fed(0xef),_0x525fed(0xee)+_0x88daa1,_0x373aea,{'template':_0x3c8fcb,'targetPath':_0x374035,'routePath':_0x88daa1}),_0x257141(!![]);})['catch'](_0x3c9cea=>{const _0x5c694d=_0x578381,_0x5f24bd=Date['now']()-_0xb5cba1;logger['error'](_0x5c694d(0xef),_0x5c694d(0xed)+_0x88daa1,{'template':_0x3c8fcb,'targetPath':_0x374035,'error':_0x3c9cea instanceof Error?_0x3c9cea[_0x5c694d(0xfb)]:String(_0x3c9cea),'duration':_0x5f24bd});})['finally'](()=>{_0x5d4136(![]);});}},[_0x3c8fcb,_0x88daa1]),useEffect(()=>{_0x435aa4&&setTimeout(()=>{_0x902d0c();});},[_0x435aa4]);if(_0x3c8fcb)return a1_0x25eecd(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x25eecd(Box,{'children':[a1_0x545af1(Text,{'color':'gray','children':_0x83fc25(0x108)}),a1_0x545af1(Text,{'children':'已选择页面模板\x20'}),a1_0x545af1(Text,{'color':_0x83fc25(0xec),'children':_0x3c8fcb})]}),_0x88daa1?a1_0x25eecd(Box,{'children':[a1_0x545af1(Text,{'color':_0x83fc25(0x101),'children':_0x83fc25(0x103)}),a1_0x545af1(Text,{'children':_0x83fc25(0x10e)}),a1_0x545af1(Text,{'color':_0x83fc25(0xec),'children':_0x88daa1})]}):a1_0x545af1(InputProjectCode,{'pagePath':_0x1c5147,'onSubmit':_0x315a2c}),_0x88daa1&&_0x38cbde?a1_0x25eecd(Box,{'marginTop':0x1,'children':[a1_0x545af1(Box,{'width':'4'}),a1_0x545af1(Text,{'children':_0x83fc25(0x10a)})]}):null,_0x435aa4?a1_0x25eecd(a1_0x1413db,{'children':[a1_0x545af1(Box,{'marginTop':0x1,'children':a1_0x545af1(Text,{'color':_0x83fc25(0x101),'children':_0x83fc25(0xf8)})}),a1_0x25eecd(Box,{'children':[a1_0x545af1(Text,{'color':_0x83fc25(0x101),'children':_0x83fc25(0x109)}),a1_0x545af1(Text,{'color':_0x83fc25(0xec),'children':_0x374035})]}),a1_0x25eecd(Box,{'children':[a1_0x545af1(Text,{'color':_0x83fc25(0x101),'children':'\x20*\x20路由地址:\x20'}),a1_0x25eecd(Text,{'color':_0x83fc25(0xec),'children':['/',_0x88daa1]})]}),a1_0x545af1(Box,{'marginTop':0x1,'children':a1_0x545af1(Text,{'color':'cyan','children':'\x20*\x20页面文件已创建,可直接通过路由访问'})})]}):null]});return a1_0x545af1(SelectPageTemplate,{'onSelect':_0xb5fae3});};
@@ -1 +1 @@
1
- function a2_0x331e(){const _0x4d4e61=['sdk-fetch','\x20\x20\x20\x20\x20\x20>\x20','2431920ELMHQm','1627302RQyxFU','270YhJDUv','label','正在加载页面模板...','length','\x20Step1:\x20','downArrow','isDirectory','328MwGHOH','5660388LTlnua','join','column','map','upArrow','gray','green','请选择您要创建的页面模板','3927558sfaDKI','name','url','861SRmPRw','获取模板列表失败:','error','sort','5XWBqCG','templates/pages','13872663CcJJwz','9045oAIhCf'];a2_0x331e=function(){return _0x4d4e61;};return a2_0x331e();}(function(_0x3d0a80,_0x571446){const _0x3c167d=a2_0x30db,_0x128a71=_0x3d0a80();while(!![]){try{const _0x20c4ba=parseInt(_0x3c167d(0x8c))/0x1+parseInt(_0x3c167d(0x8d))/0x2*(-parseInt(_0x3c167d(0xa7))/0x3)+-parseInt(_0x3c167d(0x95))/0x4+-parseInt(_0x3c167d(0xa4))/0x5*(parseInt(_0x3c167d(0x9d))/0x6)+parseInt(_0x3c167d(0xa0))/0x7*(parseInt(_0x3c167d(0x94))/0x8)+parseInt(_0x3c167d(0xa6))/0x9+parseInt(_0x3c167d(0xaa))/0xa;if(_0x20c4ba===_0x571446)break;else _0x128a71['push'](_0x128a71['shift']());}catch(_0xa21978){_0x128a71['push'](_0x128a71['shift']());}}}(a2_0x331e,0xe58c5));import{jsx as a2_0x344ef5,jsxs as a2_0x33fce1}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x56c8c2 from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x2e2e76=a2_0x30db;try{const _0x18731=fileURLToPath(import.meta[_0x2e2e76(0x9f)]),_0x495176=a2_0x56c8c2['resolve'](a2_0x56c8c2['dirname'](_0x18731),'../..'),_0x2acf32=a2_0x56c8c2[_0x2e2e76(0x96)](_0x495176,_0x2e2e76(0xa5)),_0x4c219e=await readdir(_0x2acf32,{'withFileTypes':!![]}),_0x51b788=_0x4c219e['filter'](_0x5c7b1f=>_0x5c7b1f[_0x2e2e76(0x93)]())[_0x2e2e76(0x98)](_0x4290a6=>({'label':_0x4290a6[_0x2e2e76(0x9e)]}))[_0x2e2e76(0xa3)]((_0x5d2924,_0x283e6b)=>_0x5d2924['label']['localeCompare'](_0x283e6b[_0x2e2e76(0x8e)]));return _0x51b788;}catch(_0x3d2bda){return console[_0x2e2e76(0xa2)](_0x2e2e76(0xa1),_0x3d2bda),[{'label':'blank'},{'label':_0x2e2e76(0xa8)}];}}function a2_0x30db(_0x25bb07,_0x3b4bfa){const _0x331e6f=a2_0x331e();return a2_0x30db=function(_0x30db57,_0x4fff4f){_0x30db57=_0x30db57-0x8c;let _0x4aef2c=_0x331e6f[_0x30db57];return _0x4aef2c;},a2_0x30db(_0x25bb07,_0x3b4bfa);}export function SelectPageTemplate(_0x59f090){const _0x42afae=a2_0x30db,[_0x53859d,_0x29bcf5]=useState(0x0),[_0x598342,_0x1083bd]=useState([]),[_0x3d432c,_0x7ea53b]=useState(!![]);useEffect(()=>{async function _0xc50639(){const _0x5c4d3f=await getTemplateList();_0x1083bd(_0x5c4d3f),_0x7ea53b(![]);}_0xc50639();},[]),useInput((_0x115eee,_0x258843)=>{const _0x449294=a2_0x30db;if(_0x3d432c)return;if(_0x258843['return']){const _0x3e101d=_0x598342[_0x53859d];_0x3e101d&&_0x59f090['onSelect'](_0x3e101d[_0x449294(0x8e)]);}_0x258843[_0x449294(0x99)]&&_0x29bcf5(_0x5d2814=>_0x5d2814===0x0?_0x598342[_0x449294(0x90)]-0x1:_0x5d2814-0x1),_0x258843[_0x449294(0x92)]&&_0x29bcf5(_0x3bcb4b=>_0x3bcb4b===_0x598342[_0x449294(0x90)]-0x1?0x0:_0x3bcb4b+0x1);});if(_0x3d432c)return a2_0x344ef5(Box,{'flexDirection':'column','paddingY':0x1,'children':a2_0x33fce1(Box,{'children':[a2_0x344ef5(Text,{'color':_0x42afae(0x9a),'children':_0x42afae(0x91)}),a2_0x344ef5(Text,{'children':_0x42afae(0x8f)})]})});return a2_0x33fce1(Box,{'flexDirection':_0x42afae(0x97),'paddingY':0x1,'children':[a2_0x33fce1(Box,{'children':[a2_0x344ef5(Text,{'color':_0x42afae(0x9a),'children':'\x20Step1:\x20'}),a2_0x344ef5(Text,{'children':_0x42afae(0x9c)})]}),_0x598342[_0x42afae(0x98)]((_0x22db37,_0x3f4cc7)=>{const _0x2572da=_0x42afae,_0x1ba3b3=_0x3f4cc7===_0x53859d,_0x14265c=_0x1ba3b3?_0x2572da(0xa9)+_0x22db37[_0x2572da(0x8e)]:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x22db37[_0x2572da(0x8e)];return a2_0x344ef5(Box,{'children':a2_0x344ef5(Text,{'color':_0x1ba3b3?_0x2572da(0x9b):undefined,'children':_0x14265c})},_0x14265c);})]});}
1
+ (function(_0x349bd6,_0x183824){const _0x248ff9=a2_0x1e4d,_0x4e5aab=_0x349bd6();while(!![]){try{const _0x129e38=parseInt(_0x248ff9(0x103))/0x1+-parseInt(_0x248ff9(0x104))/0x2+-parseInt(_0x248ff9(0x112))/0x3*(-parseInt(_0x248ff9(0x10e))/0x4)+-parseInt(_0x248ff9(0x100))/0x5+parseInt(_0x248ff9(0xfe))/0x6+parseInt(_0x248ff9(0x107))/0x7+-parseInt(_0x248ff9(0xfd))/0x8;if(_0x129e38===_0x183824)break;else _0x4e5aab['push'](_0x4e5aab['shift']());}catch(_0x5f5247){_0x4e5aab['push'](_0x4e5aab['shift']());}}}(a2_0x506e,0xcb394));import{jsx as a2_0x41c266,jsxs as a2_0x48d44d}from'react/jsx-runtime';import{useState,useEffect}from'react';function a2_0x506e(){const _0x540a73=['dirname','localeCompare','filter','green','gray','18962280SaoMpp','1927848wKRIgZ','../..','4205470AYJijc','upArrow','map','1303213vyRRtj','950686Mlhdrs','onSelect','请选择您要创建的页面模板','10663492BPiLJr','url','column','sort','templates/pages','\x20\x20\x20\x20\x20\x20>\x20','\x20Step1:\x20','32076NosUnf','isDirectory','label','name','513SELMor'];a2_0x506e=function(){return _0x540a73;};return a2_0x506e();}function a2_0x1e4d(_0x51cfa3,_0x58e821){const _0x506e50=a2_0x506e();return a2_0x1e4d=function(_0x1e4d92,_0x1ed53e){_0x1e4d92=_0x1e4d92-0xfc;let _0x3e3ad0=_0x506e50[_0x1e4d92];return _0x3e3ad0;},a2_0x1e4d(_0x51cfa3,_0x58e821);}import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x1c489b from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x135c90=a2_0x1e4d;try{const _0x2b6b50=fileURLToPath(import.meta[_0x135c90(0x108)]),_0x218da9=a2_0x1c489b['resolve'](a2_0x1c489b[_0x135c90(0x113)](_0x2b6b50),_0x135c90(0xff)),_0x5cbd3b=a2_0x1c489b['join'](_0x218da9,_0x135c90(0x10b)),_0x1efd5e=await readdir(_0x5cbd3b,{'withFileTypes':!![]}),_0xe17355=_0x1efd5e[_0x135c90(0x115)](_0x7751e7=>_0x7751e7[_0x135c90(0x10f)]())[_0x135c90(0x102)](_0x1aad8e=>({'label':_0x1aad8e[_0x135c90(0x111)]}))[_0x135c90(0x10a)]((_0x2e2650,_0x537d9b)=>_0x2e2650[_0x135c90(0x110)][_0x135c90(0x114)](_0x537d9b[_0x135c90(0x110)]));return _0xe17355;}catch(_0x3a3611){return console['error']('获取模板列表失败:',_0x3a3611),[{'label':'blank'},{'label':'sdk-fetch'}];}}export function SelectPageTemplate(_0x1193cd){const _0x295d7f=a2_0x1e4d,[_0x4008fe,_0x17373c]=useState(0x0),[_0x2dd00b,_0x37767f]=useState([]),[_0x5f3f8a,_0x579051]=useState(!![]);useEffect(()=>{async function _0x504e6d(){const _0xf5c1bf=await getTemplateList();_0x37767f(_0xf5c1bf),_0x579051(![]);}_0x504e6d();},[]),useInput((_0x1dbb73,_0xea06f9)=>{const _0x3361ba=a2_0x1e4d;if(_0x5f3f8a)return;if(_0xea06f9['return']){const _0x48faf7=_0x2dd00b[_0x4008fe];_0x48faf7&&_0x1193cd[_0x3361ba(0x105)](_0x48faf7[_0x3361ba(0x110)]);}_0xea06f9[_0x3361ba(0x101)]&&_0x17373c(_0x1880a6=>_0x1880a6===0x0?_0x2dd00b['length']-0x1:_0x1880a6-0x1),_0xea06f9['downArrow']&&_0x17373c(_0x1bc9fd=>_0x1bc9fd===_0x2dd00b['length']-0x1?0x0:_0x1bc9fd+0x1);});if(_0x5f3f8a)return a2_0x41c266(Box,{'flexDirection':_0x295d7f(0x109),'paddingY':0x1,'children':a2_0x48d44d(Box,{'children':[a2_0x41c266(Text,{'color':_0x295d7f(0xfc),'children':'\x20Step1:\x20'}),a2_0x41c266(Text,{'children':'正在加载页面模板...'})]})});return a2_0x48d44d(Box,{'flexDirection':_0x295d7f(0x109),'paddingY':0x1,'children':[a2_0x48d44d(Box,{'children':[a2_0x41c266(Text,{'color':_0x295d7f(0xfc),'children':_0x295d7f(0x10d)}),a2_0x41c266(Text,{'children':_0x295d7f(0x106)})]}),_0x2dd00b[_0x295d7f(0x102)]((_0x4b1578,_0x4a9c60)=>{const _0x36d438=_0x295d7f,_0x48a0a8=_0x4a9c60===_0x4008fe,_0x3eefc1=_0x48a0a8?_0x36d438(0x10c)+_0x4b1578[_0x36d438(0x110)]:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x4b1578[_0x36d438(0x110)];return a2_0x41c266(Box,{'children':a2_0x41c266(Text,{'color':_0x48a0a8?_0x36d438(0x116):undefined,'children':_0x3eefc1})},_0x3eefc1);})]});}
@@ -1 +1 @@
1
- (function(_0x4dd0e1,_0x5074ea){const _0xc71cf5=a3_0x9bf8,_0x4d5e67=_0x4dd0e1();while(!![]){try{const _0x4b7a7c=parseInt(_0xc71cf5(0x1f8))/0x1+parseInt(_0xc71cf5(0x207))/0x2*(parseInt(_0xc71cf5(0x202))/0x3)+parseInt(_0xc71cf5(0x209))/0x4+-parseInt(_0xc71cf5(0x1e8))/0x5*(-parseInt(_0xc71cf5(0x1f9))/0x6)+parseInt(_0xc71cf5(0x200))/0x7*(-parseInt(_0xc71cf5(0x1ef))/0x8)+-parseInt(_0xc71cf5(0x1dc))/0x9+-parseInt(_0xc71cf5(0x204))/0xa;if(_0x4b7a7c===_0x5074ea)break;else _0x4d5e67['push'](_0x4d5e67['shift']());}catch(_0x3f9325){_0x4d5e67['push'](_0x4d5e67['shift']());}}}(a3_0x2d73,0x584eb));import{jsx as a3_0x9d7a52,jsxs as a3_0x4d2d86}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig}from'../utils/config.js';function a3_0x2d73(){const _0xfe92e6=['json','setLogPath','gray','slice','dim','api-pull','*\x20将生成文件:\x20','api','552938FseIez','374100xlsaiF','💡\x20请使用\x20','success','\x20重新登录后再试','src/api/','column','url','200389qkCqSE','&pageSize=999&currentPage=1','1547016FDLmaA','includes','10592720eiZRhM','status','\x20-\x20模型配置文件','2XUXyuv','*\x20导入方式:','1624544ksXBTO','*\x20已生成文件:','tableData','🚀\x20正在从服务器拉取\x20API\x20配置...','red','使用指定的应用AppCode:\x20','cwd','import\x20','-api','app','1348560bSMdMx','client','cyan','white','error','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','{\x20lovrabetClient\x20}','拉取\x20API\x20配置失败:\x20',',且无法读取错误响应内容','获取数据集失败,HTTP状态码:\x20','yellow','replace','10sHqUTT','green','.ts','-client','split','message','lovrabet\x20auth','8tCLzVF'];a3_0x2d73=function(){return _0xfe92e6;};return a3_0x2d73();}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a3_0x9bf8(_0xace1c3,_0x40779b){const _0x2d737c=a3_0x2d73();return a3_0x9bf8=function(_0x9bf8c6,_0x42214d){_0x9bf8c6=_0x9bf8c6-0x1d3;let _0x4d08a9=_0x2d737c[_0x9bf8c6];return _0x4d08a9;},a3_0x9bf8(_0xace1c3,_0x40779b);}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0x41db6d})=>{const _0x40ef1e=a3_0x9bf8,{exit:_0x5bf4dc}=useApp(),[_0x5217ff,_0x3c1c1f]=useState(![]),[_0x1bdb62,_0x516754]=useState(![]),[_0xd5a609,_0x4ab400]=useState(null),[_0x1831dc,_0x386c18]=useState(null),_0x508637=readConfig(),_0x5a58b8=_0x41db6d||_0x508637?.[_0x40ef1e(0x1db)],_0xcb152f=_0x41db6d&&_0x41db6d[_0x40ef1e(0x203)]('-')?_0x41db6d[_0x40ef1e(0x1ec)]('-')[_0x40ef1e(0x1f3)](0x1)['join']('-'):'',_0x22c600=_0x41db6d?_0x40ef1e(0x1d7)+_0x5a58b8:'使用配置的应用AppCode:\x20'+_0x5a58b8,_0x56d972=_0xcb152f?_0xcb152f+_0x40ef1e(0x1da):_0x40ef1e(0x1f7),_0x1988e4=_0xcb152f?_0xcb152f+_0x40ef1e(0x1eb):_0x40ef1e(0x1dd);useEffect(()=>{_0x3c1c1f(!![]),_0x261d24();},[]),useEffect(()=>{(_0x1bdb62||_0xd5a609)&&_0x5bf4dc();},[_0x1bdb62,_0xd5a609,_0x5bf4dc]);async function _0x261d24(){const _0x23e227=_0x40ef1e;if(!_0x5a58b8){_0x4ab400('未提供应用AppCode,且配置中也没有默认值');return;}try{logger[_0x23e227(0x1f1)](process[_0x23e227(0x1d8)]());const _0x517c3d=await fetch(getApiDomain()+'/smartapi/dataset/getList?appCode='+_0x5a58b8+_0x23e227(0x201),{'headers':{'Cookie':getCookie()}});if(_0x517c3d['ok']){const _0x330fb1=await _0x517c3d[_0x23e227(0x1f0)]();if(_0x330fb1[_0x23e227(0x1fb)]){const _0x51c5d5=!_0x41db6d;await generateApiFile(_0x330fb1['data'][_0x23e227(0x1d4)],_0xcb152f,_0x5a58b8,_0x51c5d5),_0x386c18({'api':_0x23e227(0x1fd)+_0x56d972+'.ts','client':_0x23e227(0x1fd)+_0x1988e4+_0x23e227(0x1ea)}),_0x516754(!![]);}}else{if(_0x517c3d[_0x23e227(0x205)]===0x191){const _0x5eb43c=_0x23e227(0x1e1);logger[_0x23e227(0x1e0)](_0x23e227(0x1f5),_0x5eb43c,{'status':_0x517c3d[_0x23e227(0x205)],'appCode':_0x5a58b8,'url':_0x517c3d[_0x23e227(0x1ff)]}),_0x4ab400(_0x5eb43c);}else{const _0x47e241=_0x23e227(0x1e5)+_0x517c3d['status'];try{const _0x2acc8d=await _0x517c3d['text']();_0x2acc8d?logger['error'](_0x23e227(0x1f5),_0x47e241,{'status':_0x517c3d[_0x23e227(0x205)],'appCode':_0x5a58b8,'url':_0x517c3d[_0x23e227(0x1ff)],'errorBody':_0x2acc8d}):logger[_0x23e227(0x1e0)]('api-pull',_0x47e241,{'status':_0x517c3d[_0x23e227(0x205)],'appCode':_0x5a58b8,'url':_0x517c3d['url']});}catch(_0x1c092c){logger[_0x23e227(0x1e0)](_0x23e227(0x1f5),_0x47e241+_0x23e227(0x1e4),{'status':_0x517c3d[_0x23e227(0x205)],'appCode':_0x5a58b8,'url':_0x517c3d[_0x23e227(0x1ff)],'readError':_0x1c092c instanceof Error?_0x1c092c['message']:String(_0x1c092c)});}_0x4ab400(_0x47e241);}}}catch(_0x3c9abe){const _0x39c76c=_0x3c9abe instanceof Error?_0x3c9abe[_0x23e227(0x1ed)]:String(_0x3c9abe);_0x4ab400(_0x23e227(0x1e3)+_0x39c76c);}finally{_0x3c1c1f(![]);}}return a3_0x4d2d86(Box,{'flexDirection':'column','children':[a3_0x4d2d86(Box,{'children':[a3_0x9d7a52(Text,{'color':_0x40ef1e(0x1f2),'children':'*\x20'}),a3_0x9d7a52(Text,{'color':_0x41db6d?_0x40ef1e(0x1df):_0x40ef1e(0x1f4),'children':_0x22c600})]}),a3_0x4d2d86(Box,{'children':[a3_0x9d7a52(Text,{'color':'gray','children':_0x40ef1e(0x1f6)}),a3_0x4d2d86(Text,{'color':'cyan','children':[_0x56d972,_0x40ef1e(0x1ea)]}),a3_0x9d7a52(Text,{'color':'dim','children':'\x20和\x20'}),a3_0x4d2d86(Text,{'color':_0x40ef1e(0x1de),'children':[_0x1988e4,_0x40ef1e(0x1ea)]})]}),_0x5217ff&&a3_0x9d7a52(Box,{'children':a3_0x9d7a52(Text,{'children':_0x40ef1e(0x1d5)})}),_0x1bdb62&&_0x1831dc&&a3_0x4d2d86(Box,{'flexDirection':'column','children':[a3_0x9d7a52(Box,{'children':a3_0x9d7a52(Text,{'color':_0x40ef1e(0x1e9),'children':'√\x20API\x20文件生成成功!'})}),a3_0x9d7a52(Box,{'marginTop':0x1,'children':a3_0x9d7a52(Text,{'color':_0x40ef1e(0x1f2),'children':_0x40ef1e(0x1d3)})}),a3_0x4d2d86(Box,{'marginLeft':0x2,'children':[a3_0x4d2d86(Text,{'color':_0x40ef1e(0x1de),'children':['•\x20',_0x1831dc['api']]}),a3_0x9d7a52(Text,{'color':_0x40ef1e(0x1f4),'children':_0x40ef1e(0x206)})]}),a3_0x4d2d86(Box,{'marginLeft':0x2,'children':[a3_0x4d2d86(Text,{'color':_0x40ef1e(0x1de),'children':['•\x20',_0x1831dc['client']]}),a3_0x9d7a52(Text,{'color':'dim','children':'\x20-\x20客户端实例文件'})]}),a3_0x9d7a52(Box,{'marginTop':0x1,'children':a3_0x9d7a52(Text,{'color':_0x40ef1e(0x1f2),'children':_0x40ef1e(0x208)})}),a3_0x9d7a52(Box,{'marginLeft':0x2,'children':a3_0x4d2d86(Text,{'color':_0x40ef1e(0x1e6),'children':[_0x40ef1e(0x1d9),_0x40ef1e(0x1e2),'\x20from\x20\x27@/api/',_0x1831dc['client']['replace'](_0x40ef1e(0x1fd),'')[_0x40ef1e(0x1e7)]('.ts',''),'\x27']})})]}),_0xd5a609&&a3_0x4d2d86(Box,{'flexDirection':_0x40ef1e(0x1fe),'children':[a3_0x9d7a52(Box,{'children':a3_0x4d2d86(Text,{'color':_0x40ef1e(0x1d6),'children':['❌\x20',_0xd5a609]})}),_0xd5a609[_0x40ef1e(0x203)]('登录')&&a3_0x4d2d86(Box,{'marginTop':0x1,'children':[a3_0x9d7a52(Text,{'color':'yellow','children':_0x40ef1e(0x1fa)}),a3_0x9d7a52(Text,{'color':_0x40ef1e(0x1de),'children':_0x40ef1e(0x1ee)}),a3_0x9d7a52(Text,{'color':_0x40ef1e(0x1e6),'children':_0x40ef1e(0x1fc)})]})]})]});};
1
+ (function(_0x3e51d9,_0x292591){const _0x26da7f=a3_0x57fd,_0x4cf0cd=_0x3e51d9();while(!![]){try{const _0x507b0e=parseInt(_0x26da7f(0x1a6))/0x1+-parseInt(_0x26da7f(0x194))/0x2+parseInt(_0x26da7f(0x193))/0x3*(-parseInt(_0x26da7f(0x18c))/0x4)+parseInt(_0x26da7f(0x1b4))/0x5*(parseInt(_0x26da7f(0x1a4))/0x6)+-parseInt(_0x26da7f(0x1be))/0x7+-parseInt(_0x26da7f(0x1bb))/0x8*(parseInt(_0x26da7f(0x1a3))/0x9)+parseInt(_0x26da7f(0x1a0))/0xa;if(_0x507b0e===_0x292591)break;else _0x4cf0cd['push'](_0x4cf0cd['shift']());}catch(_0x188f9a){_0x4cf0cd['push'](_0x4cf0cd['shift']());}}}(a3_0x3b05,0x7d988));import{jsx as a3_0x21fe80,jsxs as a3_0x40f07a}from'react/jsx-runtime';function a3_0x57fd(_0x449937,_0x22c2cd){const _0x3b0516=a3_0x3b05();return a3_0x57fd=function(_0x57fd46,_0x453da2){_0x57fd46=_0x57fd46-0x189;let _0x4e0197=_0x3b0516[_0x57fd46];return _0x4e0197;},a3_0x57fd(_0x449937,_0x22c2cd);}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';import{logger}from'../utils/logger.js';export const ApiPullUI=({appCode:_0x4f4930})=>{const _0x4b66cf=a3_0x57fd,{exit:_0x1cbd26}=useApp(),[_0x1d4152,_0x33a6d0]=useState(![]),[_0x4452e7,_0x16cd99]=useState(![]),[_0x1abec5,_0x106752]=useState(null),[_0x36a0ee,_0x367ea2]=useState(null),_0x438f84=readConfig(),_0xe5972e=_0x4f4930||_0x438f84?.[_0x4b66cf(0x199)],_0x243f3b=_0x4f4930&&_0x4f4930[_0x4b66cf(0x195)]('-')?_0x4f4930[_0x4b66cf(0x192)]('-')[_0x4b66cf(0x1bd)](0x1)[_0x4b66cf(0x1b2)]('-'):'',_0x566b27=_0x4f4930?_0x4b66cf(0x1a2)+_0xe5972e:_0x4b66cf(0x1af)+_0xe5972e,_0x1c508e=_0x243f3b?_0x243f3b+_0x4b66cf(0x18f):_0x4b66cf(0x198),_0xfe1eca=_0x243f3b?_0x243f3b+'-client':_0x4b66cf(0x191);useEffect(()=>{_0x33a6d0(!![]),_0x13d013();},[]),useEffect(()=>{(_0x4452e7||_0x1abec5)&&_0x1cbd26();},[_0x4452e7,_0x1abec5,_0x1cbd26]);async function _0x13d013(){const _0x47c81b=_0x4b66cf;if(!_0xe5972e){_0x106752('未提供应用AppCode,且配置中也没有默认值');return;}try{logger[_0x47c81b(0x190)](process['cwd']());const _0xdf4b93=await fetch(getApiDomain()+'/smartapi/dataset/getList?appCode='+_0xe5972e+_0x47c81b(0x19a),{'headers':{'Cookie':getCookie()}});if(_0xdf4b93['ok']){const _0x5d8576=await _0xdf4b93[_0x47c81b(0x1ae)]();if(_0x5d8576[_0x47c81b(0x1a5)]){const _0x137a3c=!_0x4f4930;await generateApiFile(_0x5d8576[_0x47c81b(0x1b6)][_0x47c81b(0x1b1)],_0x243f3b,_0xe5972e,_0x137a3c),_0x367ea2({'api':'src/api/'+_0x1c508e+_0x47c81b(0x18a),'client':_0x47c81b(0x1b9)+_0xfe1eca+_0x47c81b(0x18a)}),_0x16cd99(!![]);}}else{if(_0xdf4b93[_0x47c81b(0x18d)]===0x191){const _0x1022d0=_0x47c81b(0x1ba);logger[_0x47c81b(0x1b5)](_0x47c81b(0x1ad),_0x1022d0,{'status':_0xdf4b93['status'],'appCode':_0xe5972e,'url':_0xdf4b93[_0x47c81b(0x1b3)]}),_0x106752(_0x1022d0);}else{const _0x4ea052=_0x47c81b(0x1c1)+_0xdf4b93['status'];try{const _0x203c2d=await _0xdf4b93[_0x47c81b(0x1a9)]();_0x203c2d?logger[_0x47c81b(0x1b5)]('api-pull',_0x4ea052,{'status':_0xdf4b93[_0x47c81b(0x18d)],'appCode':_0xe5972e,'url':_0xdf4b93[_0x47c81b(0x1b3)],'errorBody':_0x203c2d}):logger[_0x47c81b(0x1b5)](_0x47c81b(0x1ad),_0x4ea052,{'status':_0xdf4b93[_0x47c81b(0x18d)],'appCode':_0xe5972e,'url':_0xdf4b93[_0x47c81b(0x1b3)]});}catch(_0x46f901){logger['error'](_0x47c81b(0x1ad),_0x4ea052+_0x47c81b(0x1a1),{'status':_0xdf4b93[_0x47c81b(0x18d)],'appCode':_0xe5972e,'url':_0xdf4b93[_0x47c81b(0x1b3)],'readError':_0x46f901 instanceof Error?_0x46f901[_0x47c81b(0x19d)]:String(_0x46f901)});}_0x106752(_0x4ea052);}}}catch(_0x5e47e7){const _0x305f20=_0x5e47e7 instanceof Error?_0x5e47e7[_0x47c81b(0x19d)]:String(_0x5e47e7);_0x106752(_0x47c81b(0x1bf)+_0x305f20);}finally{_0x33a6d0(![]);}}return a3_0x40f07a(Box,{'flexDirection':'column','children':[a3_0x40f07a(Box,{'children':[a3_0x21fe80(Text,{'color':_0x4b66cf(0x1aa),'children':'*\x20'}),a3_0x21fe80(Text,{'color':_0x4f4930?'white':_0x4b66cf(0x1b7),'children':_0x566b27})]}),a3_0x40f07a(Box,{'children':[a3_0x21fe80(Text,{'color':_0x4b66cf(0x1aa),'children':_0x4b66cf(0x1b0)}),a3_0x40f07a(Text,{'color':'cyan','children':[_0x1c508e,_0x4b66cf(0x18a)]}),a3_0x21fe80(Text,{'color':'dim','children':_0x4b66cf(0x19c)}),a3_0x40f07a(Text,{'color':_0x4b66cf(0x196),'children':[_0xfe1eca,_0x4b66cf(0x18a)]})]}),_0x1d4152&&a3_0x21fe80(Box,{'children':a3_0x21fe80(Text,{'children':_0x4b66cf(0x1bc)})}),_0x4452e7&&_0x36a0ee&&a3_0x40f07a(Box,{'flexDirection':_0x4b66cf(0x1a7),'children':[a3_0x21fe80(Box,{'children':a3_0x21fe80(Text,{'color':_0x4b66cf(0x19e),'children':'√\x20API\x20文件生成成功!'})}),a3_0x21fe80(Box,{'marginTop':0x1,'children':a3_0x21fe80(Text,{'color':_0x4b66cf(0x1aa),'children':_0x4b66cf(0x189)})}),a3_0x40f07a(Box,{'marginLeft':0x2,'children':[a3_0x40f07a(Text,{'color':'cyan','children':['•\x20',_0x36a0ee[_0x4b66cf(0x198)]]}),a3_0x21fe80(Text,{'color':_0x4b66cf(0x1b7),'children':_0x4b66cf(0x19f)})]}),a3_0x40f07a(Box,{'marginLeft':0x2,'children':[a3_0x40f07a(Text,{'color':_0x4b66cf(0x196),'children':['•\x20',_0x36a0ee[_0x4b66cf(0x191)]]}),a3_0x21fe80(Text,{'color':_0x4b66cf(0x1b7),'children':_0x4b66cf(0x1c2)})]}),a3_0x21fe80(Box,{'marginTop':0x1,'children':a3_0x21fe80(Text,{'color':_0x4b66cf(0x1aa),'children':_0x4b66cf(0x1ac)})}),a3_0x21fe80(Box,{'marginLeft':0x2,'children':a3_0x40f07a(Text,{'color':'yellow','children':[_0x4b66cf(0x18b),_0x4b66cf(0x1b8),_0x4b66cf(0x197),_0x36a0ee[_0x4b66cf(0x191)]['replace'](_0x4b66cf(0x1b9),'')[_0x4b66cf(0x19b)]('.ts',''),'\x27']})})]}),_0x1abec5&&a3_0x40f07a(Box,{'flexDirection':_0x4b66cf(0x1a7),'children':[a3_0x21fe80(Box,{'children':a3_0x40f07a(Text,{'color':_0x4b66cf(0x1a8),'children':['❌\x20',_0x1abec5]})}),_0x1abec5[_0x4b66cf(0x195)]('登录')&&a3_0x40f07a(Box,{'marginTop':0x1,'children':[a3_0x21fe80(Text,{'color':_0x4b66cf(0x18e),'children':_0x4b66cf(0x1ab)}),a3_0x21fe80(Text,{'color':_0x4b66cf(0x196),'children':_0x4b66cf(0x1c0)}),a3_0x21fe80(Text,{'color':_0x4b66cf(0x18e),'children':'\x20重新登录后再试'})]})]})]});};function a3_0x3b05(){const _0x1e92e0=['4376CVoOQZ','🚀\x20正在从服务器拉取\x20API\x20配置...','slice','2679334lYeAKe','拉取\x20API\x20配置失败:\x20','lovrabet\x20auth','获取数据集失败,HTTP状态码:\x20','\x20-\x20客户端实例文件','*\x20已生成文件:','.ts','import\x20','52BUTuYA','status','yellow','-api','setLogPath','client','split','88218NHGhSH','1402048XEldQG','includes','cyan','\x20from\x20\x27@/api/','api','app','&pageSize=999&currentPage=1','replace','\x20和\x20','message','green','\x20-\x20模型配置文件','15923490xjreKK',',且无法读取错误响应内容','使用指定的应用AppCode:\x20','3420ANdHOu','735294ehPRXP','success','350917rurSfB','column','red','text','gray','💡\x20请使用\x20','*\x20导入方式:','api-pull','json','使用配置的应用AppCode:\x20','*\x20将生成文件:\x20','tableData','join','url','10kNiYYf','error','data','dim','{\x20lovrabetClient\x20}','src/api/','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录'];a3_0x3b05=function(){return _0x1e92e0;};return a3_0x3b05();}
@@ -1 +1 @@
1
- function a4_0x250a(){const _0x49c497=['15592tvmxro','1159217PtcDlC','2124ZOngjL','forEach','8693570CRxIYZ','Api','1316qPukKh','map','code','from','dataset','114969dXOXai','2165388DbrMMT','filter','set','dbtableConfig','96ePPhhp','dataset_','5314770txTaxt','pkField','get','28236bOsRGS','tableName'];a4_0x250a=function(){return _0x49c497;};return a4_0x250a();}function a4_0x1ff3(_0x534ac1,_0x27b8aa){const _0x250a40=a4_0x250a();return a4_0x1ff3=function(_0x1ff303,_0x2c65ee){_0x1ff303=_0x1ff303-0x1b8;let _0x55e0c8=_0x250a40[_0x1ff303];return _0x55e0c8;},a4_0x1ff3(_0x534ac1,_0x27b8aa);}(function(_0x526dcf,_0x4f408d){const _0x1bad73=a4_0x1ff3,_0x371be9=_0x526dcf();while(!![]){try{const _0x1bceac=parseInt(_0x1bad73(0x1b8))/0x1+parseInt(_0x1bad73(0x1c3))/0x2+parseInt(_0x1bad73(0x1c2))/0x3*(-parseInt(_0x1bad73(0x1c7))/0x4)+-parseInt(_0x1bad73(0x1c9))/0x5+-parseInt(_0x1bad73(0x1cc))/0x6*(parseInt(_0x1bad73(0x1bd))/0x7)+-parseInt(_0x1bad73(0x1ce))/0x8*(-parseInt(_0x1bad73(0x1b9))/0x9)+parseInt(_0x1bad73(0x1bb))/0xa;if(_0x1bceac===_0x4f408d)break;else _0x371be9['push'](_0x371be9['shift']());}catch(_0x852cd7){_0x371be9['push'](_0x371be9['shift']());}}}(a4_0x250a,0xabd36));export function formatDataset(_0x220d5a){const _0x2585dd=a4_0x1ff3,_0x42cc9e=_0x220d5a[_0x2585dd(0x1c4)](_0x2f9361=>_0x2f9361['dbtableConfig']),_0x3673a6=_0x220d5a[_0x2585dd(0x1c4)](_0x2907e7=>!_0x2907e7[_0x2585dd(0x1c6)]),_0x45c35d=new Map();_0x42cc9e[_0x2585dd(0x1ba)](_0x914715=>{const _0x4d0399=_0x2585dd,_0x1cac89=_0x914715['dbtableConfig'][_0x4d0399(0x1cd)],_0x3d8b69=_0x45c35d[_0x4d0399(0x1cb)](_0x1cac89);(!_0x3d8b69||_0x914715['id']>_0x3d8b69['id'])&&_0x45c35d[_0x4d0399(0x1c5)](_0x1cac89,_0x914715);});const _0x585c45=Array[_0x2585dd(0x1c0)](_0x45c35d['values']())[_0x2585dd(0x1be)](_0x4da365=>{const _0x48824f=_0x2585dd,_0x3557a6=snakeToCamel(_0x4da365[_0x48824f(0x1c6)][_0x48824f(0x1cd)]);return{'id':_0x4da365['id'],'name':_0x4da365['name'],'code':_0x4da365[_0x48824f(0x1bf)],'tableName':_0x4da365[_0x48824f(0x1c6)]['tableName'],'apiFucName':_0x3557a6?_0x3557a6+_0x48824f(0x1bc):_0x48824f(0x1c1)+_0x4da365[_0x48824f(0x1bf)]+_0x48824f(0x1bc),'pkField':_0x4da365['dbtableConfig'][_0x48824f(0x1ca)],'allFields':_0x4da365['dbtableConfig']['allFields']['split'](',')};}),_0x57f121=_0x3673a6[_0x2585dd(0x1be)](_0x5d42d3=>{const _0x44d022=_0x2585dd,_0x19ff7a=_0x44d022(0x1c8)+_0x5d42d3['code'],_0x1646b7=snakeToCamel(_0x19ff7a);return{'id':_0x5d42d3['id'],'name':_0x5d42d3['name'],'code':_0x5d42d3[_0x44d022(0x1bf)],'tableName':_0x19ff7a,'apiFucName':_0x1646b7?_0x1646b7+_0x44d022(0x1bc):_0x44d022(0x1c1)+_0x5d42d3[_0x44d022(0x1bf)]+_0x44d022(0x1bc),'pkField':undefined,'allFields':[]};});return[..._0x585c45,..._0x57f121];}function snakeToCamel(_0xd0776e){if(!_0xd0776e)return _0xd0776e;const _0x34095d=_0xd0776e['trim']();return _0x34095d['replace'](/_([a-zA-Z0-9])/g,(_0x10a327,_0x159ad3)=>_0x159ad3['toUpperCase']());}
1
+ (function(_0x3db2bc,_0x234080){const _0x55c1b1=a4_0x29bb,_0x5a9dea=_0x3db2bc();while(!![]){try{const _0x51fd75=parseInt(_0x55c1b1(0x1f5))/0x1+-parseInt(_0x55c1b1(0x1f3))/0x2*(parseInt(_0x55c1b1(0x1ed))/0x3)+parseInt(_0x55c1b1(0x1ff))/0x4*(-parseInt(_0x55c1b1(0x1f7))/0x5)+-parseInt(_0x55c1b1(0x1ee))/0x6+-parseInt(_0x55c1b1(0x1fb))/0x7+-parseInt(_0x55c1b1(0x201))/0x8+-parseInt(_0x55c1b1(0x1f0))/0x9*(-parseInt(_0x55c1b1(0x1ea))/0xa);if(_0x51fd75===_0x234080)break;else _0x5a9dea['push'](_0x5a9dea['shift']());}catch(_0x507a5f){_0x5a9dea['push'](_0x5a9dea['shift']());}}}(a4_0xb856,0x746b2));function a4_0x29bb(_0x2c517d,_0x2c188a){const _0xb85620=a4_0xb856();return a4_0x29bb=function(_0x29bb5a,_0x1f689c){_0x29bb5a=_0x29bb5a-0x1ea;let _0x14efe4=_0xb85620[_0x29bb5a];return _0x14efe4;},a4_0x29bb(_0x2c517d,_0x2c188a);}function a4_0xb856(){const _0x5ab3bd=['name','227685hgIecX','split','115UBGwwX','Api','pkField','set','5484815svNDUE','code','dbtableConfig','filter','4204eoHSHa','map','474424IubOPE','dataset','dataset_','values','464980JZOqpc','replace','tableName','129933ZGqvgN','2853684JGURDx','from','459BVeOgb','forEach','trim','36EGhyqe'];a4_0xb856=function(){return _0x5ab3bd;};return a4_0xb856();}export function formatDataset(_0x367cd6){const _0xb26408=a4_0x29bb,_0x47e674=_0x367cd6[_0xb26408(0x1fe)](_0x5b6169=>_0x5b6169['dbtableConfig']),_0x123699=_0x367cd6[_0xb26408(0x1fe)](_0x1713e7=>!_0x1713e7['dbtableConfig']),_0x169f4d=new Map();_0x47e674[_0xb26408(0x1f1)](_0x440c8e=>{const _0x253221=_0xb26408,_0x2fde45=_0x440c8e['dbtableConfig']['tableName'],_0xa599ab=_0x169f4d['get'](_0x2fde45);(!_0xa599ab||_0x440c8e['id']>_0xa599ab['id'])&&_0x169f4d[_0x253221(0x1fa)](_0x2fde45,_0x440c8e);});const _0xf6d0a9=Array[_0xb26408(0x1ef)](_0x169f4d[_0xb26408(0x204)]())['map'](_0x339b27=>{const _0x5e7651=_0xb26408,_0x252c1f=snakeToCamel(_0x339b27['dbtableConfig']['tableName']);return{'id':_0x339b27['id'],'name':_0x339b27[_0x5e7651(0x1f4)],'code':_0x339b27[_0x5e7651(0x1fc)],'tableName':_0x339b27['dbtableConfig'][_0x5e7651(0x1ec)],'apiFucName':_0x252c1f?_0x252c1f+_0x5e7651(0x1f8):_0x5e7651(0x202)+_0x339b27['code']+_0x5e7651(0x1f8),'pkField':_0x339b27[_0x5e7651(0x1fd)][_0x5e7651(0x1f9)],'allFields':_0x339b27[_0x5e7651(0x1fd)]['allFields'][_0x5e7651(0x1f6)](',')};}),_0x2959d1=_0x123699[_0xb26408(0x200)](_0x50be3=>{const _0x1d6dd0=_0xb26408,_0x2a51ca=_0x1d6dd0(0x203)+_0x50be3[_0x1d6dd0(0x1fc)],_0x27ecef=snakeToCamel(_0x2a51ca);return{'id':_0x50be3['id'],'name':_0x50be3[_0x1d6dd0(0x1f4)],'code':_0x50be3[_0x1d6dd0(0x1fc)],'tableName':_0x2a51ca,'apiFucName':_0x27ecef?_0x27ecef+'Api':_0x1d6dd0(0x202)+_0x50be3[_0x1d6dd0(0x1fc)]+'Api','pkField':undefined,'allFields':[]};});return[..._0xf6d0a9,..._0x2959d1];}function snakeToCamel(_0x4acf35){const _0x1b2158=a4_0x29bb;if(!_0x4acf35)return _0x4acf35;const _0x1ae856=_0x4acf35[_0x1b2158(0x1f2)]();return _0x1ae856[_0x1b2158(0x1eb)](/_([a-zA-Z0-9])/g,(_0x32f1ef,_0x381dfc)=>_0x381dfc['toUpperCase']());}
@@ -1 +1 @@
1
- function a5_0x36ff(){const _0x3a1a47=['keys','forEach','1120091hPDxZQ','string','resolve','\x20-\x20模型配置文件\x20(','573186SBJWco','\x20-\x20客户端实例文件','code','toUpperCase','384AxSIFd','apiFucName','slice','url','utf8','*\x20可以开始使用:\x20import\x20{\x20lovrabetClient\x20}\x20from\x20\x27@/api/','client','success','typescript','templates/generate-api','40860zftKcC','app','12AWhAZf','13647lBlBCS','api','8MygQhn','join','CONFIG_NAMES.DEFAULT','src/api','format','charAt','src/api/','log','-api','replaceApiContent','\x20\x20\x20•\x20','41976laBNWR','length','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','replace','56OOljsS','2093826KfaJQI','.ts','dirname','../..','140290KjZYVl','*\x20已生成文件:','init-api','client.ts.tpl','API\x20文件生成成功!','-client','63EcnHIZ'];a5_0x36ff=function(){return _0x3a1a47;};return a5_0x36ff();}(function(_0x37bb58,_0x3496ea){const _0x400b47=a5_0xcbcc,_0x5050d4=_0x37bb58();while(!![]){try{const _0x54d23e=parseInt(_0x400b47(0xd1))/0x1*(-parseInt(_0x400b47(0xae))/0x2)+parseInt(_0x400b47(0xc0))/0x3+-parseInt(_0x400b47(0xd0))/0x4*(parseInt(_0x400b47(0xce))/0x5)+parseInt(_0x400b47(0xaf))/0x6+parseInt(_0x400b47(0xbc))/0x7*(-parseInt(_0x400b47(0xd3))/0x8)+-parseInt(_0x400b47(0xb9))/0x9*(-parseInt(_0x400b47(0xb3))/0xa)+-parseInt(_0x400b47(0xaa))/0xb*(-parseInt(_0x400b47(0xc4))/0xc);if(_0x54d23e===_0x3496ea)break;else _0x5050d4['push'](_0x5050d4['shift']());}catch(_0x566da4){_0x5050d4['push'](_0x5050d4['shift']());}}}(a5_0x36ff,0x2f4a7));import a5_0x59fb24 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a5_0x3bd789 from'node:path';import{fileURLToPath}from'node:url';function a5_0xcbcc(_0x4cb465,_0x10b35b){const _0x36ff4e=a5_0x36ff();return a5_0xcbcc=function(_0xcbcc55,_0x1bd060){_0xcbcc55=_0xcbcc55-0xa7;let _0x152ed4=_0x36ff4e[_0xcbcc55];return _0x152ed4;},a5_0xcbcc(_0x4cb465,_0x10b35b);}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(_0x364585,_0x2e92d7='',_0x303524,_0x172be1=![]){const _0x28326f=a5_0xcbcc,_0x3446cb=readConfig(),_0x1b671a=_0x303524||_0x3446cb?.[_0x28326f(0xcf)];if(typeof _0x1b671a!==_0x28326f(0xbd)||!_0x1b671a)throw new Error(_0x28326f(0xac));const _0x587930=_0x172be1?_0x28326f(0xd5):'\x22'+_0x1b671a+'\x22',_0x3d4088=_0x172be1?'':'\x22'+_0x1b671a+'\x22',_0x59a495=_0x2e92d7?_0x2e92d7+_0x28326f(0xa7):_0x28326f(0xd2),_0x176abe=_0x2e92d7?_0x2e92d7+_0x28326f(0xb8):_0x28326f(0xca),_0x4a6c92=formatDataset(_0x364585),_0xbd509c={};_0x4a6c92[_0x28326f(0xbb)](_0x1e5022=>{const _0xbe68ea=_0x28326f,_0x1aa218=_0x1e5022[_0xbe68ea(0xc5)][_0xbe68ea(0xad)](/Api$/,''),_0x3d44b8=_0x1aa218[_0xbe68ea(0xd8)](0x0)[_0xbe68ea(0xc3)]()+_0x1aa218[_0xbe68ea(0xc6)](0x1);_0xbd509c[_0x3d44b8]={'tableName':_0x1e5022['tableName'],'datasetId':_0x1e5022[_0xbe68ea(0xc2)]};});const _0x301217=fileURLToPath(import.meta[_0x28326f(0xc7)]),_0x30b2a8=a5_0x3bd789[_0x28326f(0xbe)](a5_0x3bd789[_0x28326f(0xb1)](_0x301217),_0x28326f(0xb2)),_0x552825=a5_0x3bd789[_0x28326f(0xd4)](_0x30b2a8,_0x28326f(0xcd)),_0x266ea6=a5_0x3bd789[_0x28326f(0xd4)](_0x552825,'api.ts.tpl'),_0x56c658=a5_0x3bd789[_0x28326f(0xd4)](_0x552825,_0x28326f(0xb6));mkdirSync(_0x28326f(0xd6),{'recursive':!![]});const _0x4f4067=readFileSync(_0x266ea6,_0x28326f(0xc8)),_0x49e9a3=TemplateReplacer['replaceApiContent'](_0x4f4067,_0x1b671a,_0xbd509c,Object[_0x28326f(0xba)](_0xbd509c)[0x0],_0x59a495,_0x587930),_0x5549b8=await a5_0x59fb24['format'](_0x49e9a3,{'parser':_0x28326f(0xcc)}),_0x3ae3ad=_0x28326f(0xd9)+_0x59a495+'.ts';writeFileSync(_0x3ae3ad,_0x5549b8,{'encoding':_0x28326f(0xc8)});const _0xb1aa10=readFileSync(_0x56c658,_0x28326f(0xc8)),_0x1171b6=TemplateReplacer[_0x28326f(0xa8)](_0xb1aa10,_0x1b671a,_0xbd509c,Object[_0x28326f(0xba)](_0xbd509c)[0x0],_0x59a495,_0x587930,_0x3d4088),_0x4a45c5=await a5_0x59fb24[_0x28326f(0xd7)](_0x1171b6,{'parser':_0x28326f(0xcc)}),_0x1038f1=_0x28326f(0xd9)+_0x176abe+_0x28326f(0xb0);writeFileSync(_0x1038f1,_0x4a45c5,{'encoding':_0x28326f(0xc8)}),logger[_0x28326f(0xcb)](_0x28326f(0xb5),_0x28326f(0xb7)),console[_0x28326f(0xda)](_0x28326f(0xb4)),console['log'](_0x28326f(0xa9)+_0x3ae3ad+_0x28326f(0xbf)+Object[_0x28326f(0xba)](_0xbd509c)[_0x28326f(0xab)]+'\x20个模型)'),console[_0x28326f(0xda)](_0x28326f(0xa9)+_0x1038f1+_0x28326f(0xc1)),console['log']('*\x20API配置\x20apiConfigName\x20:\x20'+_0x587930),console['log'](_0x28326f(0xc9)+_0x176abe+'\x27');}
1
+ function a5_0x5b4c(){const _0x469896=['apiFucName','1409170GGxwrX','app','5333727DBxyze','slice','toUpperCase','utf8','templates/generate-api','forEach','CONFIG_NAMES.DEFAULT','length','116144uNXihE','replace','log','*\x20可以开始使用:\x20import\x20{\x20lovrabetClient\x20}\x20from\x20\x27@/api/','init-api','6179022aSHzxb','resolve','keys','12XkXiIT','*\x20API配置\x20apiConfigName\x20:\x20','replaceApiContent','1eohByt','\x20\x20\x20•\x20','api.ts.tpl','success','typescript','string','*\x20已生成文件:','src/api','.ts','5457930nTXskn','join','api','-api','code','2466783Hzotfh','format','396220duQcxn','src/api/'];a5_0x5b4c=function(){return _0x469896;};return a5_0x5b4c();}function a5_0x22b1(_0xab5aaa,_0x4b2f21){const _0x5b4c6f=a5_0x5b4c();return a5_0x22b1=function(_0x22b168,_0x54a666){_0x22b168=_0x22b168-0x1d4;let _0x5ec80f=_0x5b4c6f[_0x22b168];return _0x5ec80f;},a5_0x22b1(_0xab5aaa,_0x4b2f21);}(function(_0x551a9e,_0x334417){const _0x16854c=a5_0x22b1,_0x17ac5c=_0x551a9e();while(!![]){try{const _0x93630d=-parseInt(_0x16854c(0x1d9))/0x1*(-parseInt(_0x16854c(0x1ec))/0x2)+-parseInt(_0x16854c(0x1e7))/0x3+-parseInt(_0x16854c(0x1d6))/0x4*(parseInt(_0x16854c(0x1e9))/0x5)+parseInt(_0x16854c(0x1e2))/0x6+parseInt(_0x16854c(0x1ee))/0x7+-parseInt(_0x16854c(0x1f6))/0x8+-parseInt(_0x16854c(0x1fb))/0x9;if(_0x93630d===_0x334417)break;else _0x17ac5c['push'](_0x17ac5c['shift']());}catch(_0x3d2d24){_0x17ac5c['push'](_0x17ac5c['shift']());}}}(a5_0x5b4c,0x962dc));import a5_0x2a9447 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a5_0x4cbabb 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(_0x11813d,_0x253e62='',_0x35bcd2,_0x223ce6=![]){const _0x105c7a=a5_0x22b1,_0x483df6=readConfig(),_0x320ddc=_0x35bcd2||_0x483df6?.[_0x105c7a(0x1ed)];if(typeof _0x320ddc!==_0x105c7a(0x1de)||!_0x320ddc)throw new Error('请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code');const _0x31f99f=_0x223ce6?_0x105c7a(0x1f4):'\x22'+_0x320ddc+'\x22',_0xe66ce8=_0x223ce6?'':'\x22'+_0x320ddc+'\x22',_0x27a85f=_0x253e62?_0x253e62+_0x105c7a(0x1e5):_0x105c7a(0x1e4),_0x431b47=_0x253e62?_0x253e62+'-client':'client',_0x3e3009=formatDataset(_0x11813d),_0x584c={};_0x3e3009[_0x105c7a(0x1f3)](_0x3ca7ba=>{const _0x508f39=_0x105c7a,_0x49255f=_0x3ca7ba[_0x508f39(0x1eb)][_0x508f39(0x1f7)](/Api$/,''),_0x356e76=_0x49255f['charAt'](0x0)[_0x508f39(0x1f0)]()+_0x49255f[_0x508f39(0x1ef)](0x1);_0x584c[_0x356e76]={'tableName':_0x3ca7ba['tableName'],'datasetId':_0x3ca7ba[_0x508f39(0x1e6)]};});const _0x1a29f1=fileURLToPath(import.meta['url']),_0x30b12c=a5_0x4cbabb[_0x105c7a(0x1d4)](a5_0x4cbabb['dirname'](_0x1a29f1),'../..'),_0x3e2454=a5_0x4cbabb['join'](_0x30b12c,_0x105c7a(0x1f2)),_0x2c4f48=a5_0x4cbabb[_0x105c7a(0x1e3)](_0x3e2454,_0x105c7a(0x1db)),_0x4a4b96=a5_0x4cbabb[_0x105c7a(0x1e3)](_0x3e2454,'client.ts.tpl');mkdirSync(_0x105c7a(0x1e0),{'recursive':!![]});const _0x37860e=readFileSync(_0x2c4f48,_0x105c7a(0x1f1)),_0x304814=TemplateReplacer[_0x105c7a(0x1d8)](_0x37860e,_0x320ddc,_0x584c,Object[_0x105c7a(0x1d5)](_0x584c)[0x0],_0x27a85f,_0x31f99f),_0x49c3d8=await a5_0x2a9447['format'](_0x304814,{'parser':'typescript'}),_0x5e058a=_0x105c7a(0x1ea)+_0x27a85f+_0x105c7a(0x1e1);writeFileSync(_0x5e058a,_0x49c3d8,{'encoding':'utf8'});const _0x293ab8=readFileSync(_0x4a4b96,_0x105c7a(0x1f1)),_0x4be92b=TemplateReplacer[_0x105c7a(0x1d8)](_0x293ab8,_0x320ddc,_0x584c,Object[_0x105c7a(0x1d5)](_0x584c)[0x0],_0x27a85f,_0x31f99f,_0xe66ce8),_0x180c8d=await a5_0x2a9447[_0x105c7a(0x1e8)](_0x4be92b,{'parser':_0x105c7a(0x1dd)}),_0x3ebd36=_0x105c7a(0x1ea)+_0x431b47+'.ts';writeFileSync(_0x3ebd36,_0x180c8d,{'encoding':_0x105c7a(0x1f1)}),logger[_0x105c7a(0x1dc)](_0x105c7a(0x1fa),'API\x20文件生成成功!'),console[_0x105c7a(0x1f8)](_0x105c7a(0x1df)),console[_0x105c7a(0x1f8)]('\x20\x20\x20•\x20'+_0x5e058a+'\x20-\x20模型配置文件\x20('+Object[_0x105c7a(0x1d5)](_0x584c)[_0x105c7a(0x1f5)]+'\x20个模型)'),console['log'](_0x105c7a(0x1da)+_0x3ebd36+'\x20-\x20客户端实例文件'),console['log'](_0x105c7a(0x1d7)+_0x31f99f),console['log'](_0x105c7a(0x1f9)+_0x431b47+'\x27');}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- function a6_0xb52a(){const _0x1e0092=['18njkvkg','979088lOgPwZ','2741630OkeSbV','1993971snxNTr','error','log','10FwiVwZ','\x20\x20lovrabet\x20api\x20pull\x20[app-code]\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','36060497QcRRCR','input','pull','exit','78BHtpiU','111572TWvhaU','30dPAhid','\x20\x20\x20\x20app-code:\x20可选的应用AppCode,不指定则使用配置的默认值','621052qgmNij','9558384NUlJGV'];a6_0xb52a=function(){return _0x1e0092;};return a6_0xb52a();}(function(_0x1fa10f,_0x502908){const _0x547290=a6_0x394a,_0x571991=_0x1fa10f();while(!![]){try{const _0x4eb067=-parseInt(_0x547290(0x10c))/0x1+-parseInt(_0x547290(0x11b))/0x2*(parseInt(_0x547290(0x11a))/0x3)+parseInt(_0x547290(0x10f))/0x4*(parseInt(_0x547290(0x114))/0x5)+parseInt(_0x547290(0x11c))/0x6*(-parseInt(_0x547290(0x111))/0x7)+parseInt(_0x547290(0x10d))/0x8+-parseInt(_0x547290(0x10e))/0x9*(parseInt(_0x547290(0x110))/0xa)+parseInt(_0x547290(0x116))/0xb;if(_0x4eb067===_0x502908)break;else _0x571991['push'](_0x571991['shift']());}catch(_0x442f56){_0x571991['push'](_0x571991['shift']());}}}(a6_0xb52a,0xe03da));import{jsx as a6_0x4d9a97}from'react/jsx-runtime';function a6_0x394a(_0xbd75cb,_0x285058){const _0xb52a75=a6_0xb52a();return a6_0x394a=function(_0x394acd,_0x463a3c){_0x394acd=_0x394acd-0x10b;let _0x4fd36b=_0xb52a75[_0x394acd];return _0x4fd36b;},a6_0x394a(_0xbd75cb,_0x285058);}import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';export async function apiCli(_0x425870){const _0x5040da=a6_0x394a,_0x2a8f54=_0x425870[_0x5040da(0x117)][0x1];if(_0x2a8f54===_0x5040da(0x118)){const _0xb82787=_0x425870[_0x5040da(0x117)][0x2];render(a6_0x4d9a97(ApiPullUI,{'appCode':_0xb82787}));}else console[_0x5040da(0x112)]('Unknown\x20api\x20command:\x20'+_0x2a8f54),console[_0x5040da(0x113)]('Available\x20commands:'),console[_0x5040da(0x113)](_0x5040da(0x115)),console[_0x5040da(0x113)](_0x5040da(0x10b)),process[_0x5040da(0x119)](0x1);}
1
+ (function(_0x3bff70,_0x13a622){const _0x414350=a6_0x160b,_0x30192b=_0x3bff70();while(!![]){try{const _0x27c970=-parseInt(_0x414350(0xe5))/0x1+-parseInt(_0x414350(0xec))/0x2+parseInt(_0x414350(0xe3))/0x3*(-parseInt(_0x414350(0xe7))/0x4)+parseInt(_0x414350(0xeb))/0x5+parseInt(_0x414350(0xef))/0x6+-parseInt(_0x414350(0xf2))/0x7*(-parseInt(_0x414350(0xee))/0x8)+-parseInt(_0x414350(0xe8))/0x9*(-parseInt(_0x414350(0xe9))/0xa);if(_0x27c970===_0x13a622)break;else _0x30192b['push'](_0x30192b['shift']());}catch(_0x40cccd){_0x30192b['push'](_0x30192b['shift']());}}}(a6_0xacc1,0x5aa67));import{jsx as a6_0x1be234}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';export async function apiCli(_0x4ed099){const _0x26c33d=a6_0x160b,_0x3c93e9=_0x4ed099[_0x26c33d(0xea)][0x1];if(_0x3c93e9===_0x26c33d(0xe4)){const _0x36e7bb=_0x4ed099[_0x26c33d(0xea)][0x2];render(a6_0x1be234(ApiPullUI,{'appCode':_0x36e7bb}));}else console[_0x26c33d(0xf1)](_0x26c33d(0xf3)+_0x3c93e9),console[_0x26c33d(0xe2)](_0x26c33d(0xe6)),console[_0x26c33d(0xe2)](_0x26c33d(0xf0)),console[_0x26c33d(0xe2)](_0x26c33d(0xed)),process['exit'](0x1);}function a6_0x160b(_0x19bfb9,_0x2d9ea3){const _0xacc1e6=a6_0xacc1();return a6_0x160b=function(_0x160bb8,_0xaaa5e){_0x160bb8=_0x160bb8-0xe2;let _0x550656=_0xacc1e6[_0x160bb8];return _0x550656;},a6_0x160b(_0x19bfb9,_0x2d9ea3);}function a6_0xacc1(){const _0x6c40c5=['593991rxkKBr','30nEZeRs','input','1824085VayFSQ','646124BfhmDH','\x20\x20\x20\x20app-code:\x20可选的应用AppCode,不指定则使用配置的默认值','205168rJbosC','3210444Xckyxt','\x20\x20lovrabet\x20api\x20pull\x20[app-code]\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','error','126SxMran','Unknown\x20api\x20command:\x20','log','2222742UHpBaS','pull','124237HHsKmx','Available\x20commands:','4yiCgtA'];a6_0xacc1=function(){return _0x6c40c5;};return a6_0xacc1();}
@@ -1 +1 @@
1
- (function(_0x54d152,_0x8f7494){const _0x1b48af=a7_0xff85,_0x763c98=_0x54d152();while(!![]){try{const _0x3b9f3c=-parseInt(_0x1b48af(0xab))/0x1+-parseInt(_0x1b48af(0xbf))/0x2*(-parseInt(_0x1b48af(0xbc))/0x3)+parseInt(_0x1b48af(0xc0))/0x4*(-parseInt(_0x1b48af(0xb9))/0x5)+parseInt(_0x1b48af(0xc8))/0x6+-parseInt(_0x1b48af(0xcb))/0x7+-parseInt(_0x1b48af(0xc1))/0x8*(parseInt(_0x1b48af(0xb1))/0x9)+parseInt(_0x1b48af(0xc5))/0xa;if(_0x3b9f3c===_0x8f7494)break;else _0x763c98['push'](_0x763c98['shift']());}catch(_0x269df6){_0x763c98['push'](_0x763c98['shift']());}}}(a7_0x1e79,0x8c0ea));function a7_0x1e79(){const _0x30e760=['*\x20正在处理\x20','url','length','27ZqEhzO','√\x20API\x20配置文件生成完成','success','chdir','tableData','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','API\x20配置拉取异常:\x20','-api','532705MNPQNA','&pageSize=999&currentPage=1','*\x20正在从服务器拉取\x20API\x20配置...','3087VxOwZV','log','\x20\x20\x20•\x20','162DjfTSX','40vandLl','874392lbtxhM','\x20个数据集...','/smartapi/dataset/getList?appCode=','获取数据集失败,原因:登录鉴权失败,登录已过期','34335630aInTKY','data','获取数据集失败,HTTP状态码:\x20','861558ZbfmJg','message','API\x20配置拉取成功:\x20','6102516PDwGDl','×\x20错误详情:','text','create-api-pull','error','status','×\x20无法读取错误响应内容','trim','×\x20服务器返回错误:','821736ydHqhp','*\x20开始生成\x20API\x20配置文件:','×\x20API\x20配置拉取异常:'];a7_0x1e79=function(){return _0x30e760;};return a7_0x1e79();}import{getCookie}from'../auth/get-cookie.js';function a7_0xff85(_0x408fc3,_0x592111){const _0x1e7995=a7_0x1e79();return a7_0xff85=function(_0xff8560,_0xc0007b){_0xff8560=_0xff8560-0xa9;let _0x466566=_0x1e7995[_0xff8560];return _0x466566;},a7_0xff85(_0x408fc3,_0x592111);}import{getApiDomain}from'../constant/domain.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export async function pullApiSilent(_0xf1978,_0x2e10ee,_0x1d50fe){const _0x3c1af8=a7_0xff85;let _0x4b1786;try{const _0xe7f65d=_0x2e10ee?.[_0x3c1af8(0xa9)]()||'';if(_0xe7f65d){const _0x329dab=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x329dab['test'](_0xe7f65d))return console[_0x3c1af8(0xcf)](_0x3c1af8(0xb6)),![];}_0x1d50fe&&(_0x4b1786=process['cwd'](),process[_0x3c1af8(0xb4)](_0x1d50fe));console['log'](_0x3c1af8(0xbb));const _0x2097d6=await fetch(getApiDomain()+_0x3c1af8(0xc3)+_0xf1978+_0x3c1af8(0xba),{'headers':{'Cookie':getCookie()}});if(_0x2097d6['ok']){const _0x55e3b1=await _0x2097d6['json']();if(_0x55e3b1[_0x3c1af8(0xb3)]){const _0x4d0dc9=_0xe7f65d?_0xe7f65d+_0x3c1af8(0xb8):'api',_0x4b814e=_0xe7f65d?_0xe7f65d+'-client':'client';return console[_0x3c1af8(0xbd)](_0x3c1af8(0xac)),console[_0x3c1af8(0xbd)](_0x3c1af8(0xbe)+_0x4d0dc9+'.ts\x20-\x20模型配置文件'),console[_0x3c1af8(0xbd)](_0x3c1af8(0xbe)+_0x4b814e+'.ts\x20-\x20客户端实例文件'),console[_0x3c1af8(0xbd)](_0x3c1af8(0xae)+_0x55e3b1['data'][_0x3c1af8(0xb5)][_0x3c1af8(0xb0)]+_0x3c1af8(0xc2)),await generateApiFile(_0x55e3b1[_0x3c1af8(0xc6)]['tableData'],_0xe7f65d,_0xf1978,!![]),console[_0x3c1af8(0xbd)](_0x3c1af8(0xb2)),_0x1d50fe&&logger['info']('create-api-pull',_0x3c1af8(0xca)+_0xf1978,{'projectPath':_0x1d50fe,'appCode':_0xf1978,'datasetCount':_0x55e3b1[_0x3c1af8(0xc6)][_0x3c1af8(0xb5)]['length'],'filePrefix':_0xe7f65d}),!![];}else return console['error'](_0x3c1af8(0xaa),_0x55e3b1[_0x3c1af8(0xc9)]||'未知错误'),_0x1d50fe&&logger[_0x3c1af8(0xcf)](_0x3c1af8(0xce),'API\x20配置拉取失败:\x20'+(_0x55e3b1['message']||'未知错误'),{'projectPath':_0x1d50fe,'appCode':_0xf1978}),![];}else{if(_0x2097d6['status']===0x191){const _0x26e8de=_0x3c1af8(0xc4);console[_0x3c1af8(0xcf)]('×\x20'+_0x26e8de),_0x1d50fe&&logger[_0x3c1af8(0xcf)](_0x3c1af8(0xce),_0x26e8de,{'status':_0x2097d6['status'],'appCode':_0xf1978,'url':_0x2097d6[_0x3c1af8(0xaf)],'projectPath':_0x1d50fe});}else{const _0x2858b5=_0x3c1af8(0xc7)+_0x2097d6[_0x3c1af8(0xd0)];console[_0x3c1af8(0xcf)]('×\x20'+_0x2858b5);try{const _0x2b0f9b=await _0x2097d6[_0x3c1af8(0xcd)]();_0x2b0f9b&&console[_0x3c1af8(0xcf)](_0x3c1af8(0xcc),_0x2b0f9b),_0x1d50fe&&logger['error']('create-api-pull',_0x2858b5,{'status':_0x2097d6[_0x3c1af8(0xd0)],'appCode':_0xf1978,'url':_0x2097d6['url'],'errorBody':_0x2b0f9b,'projectPath':_0x1d50fe});}catch(_0x570100){console['error'](_0x3c1af8(0xd1)),_0x1d50fe&&logger[_0x3c1af8(0xcf)](_0x3c1af8(0xce),_0x2858b5+',且无法读取错误响应内容',{'status':_0x2097d6[_0x3c1af8(0xd0)],'appCode':_0xf1978,'url':_0x2097d6[_0x3c1af8(0xaf)],'readError':_0x570100 instanceof Error?_0x570100[_0x3c1af8(0xc9)]:String(_0x570100),'projectPath':_0x1d50fe});}}return![];}}catch(_0x51e461){const _0x50343c=_0x51e461 instanceof Error?_0x51e461['message']:String(_0x51e461);return console['error'](_0x3c1af8(0xad),_0x50343c),_0x1d50fe&&logger[_0x3c1af8(0xcf)]('create-api-pull',_0x3c1af8(0xb7)+_0x50343c,{'appCode':_0xf1978,'projectPath':_0x1d50fe}),![];}finally{_0x4b1786&&process[_0x3c1af8(0xb4)](_0x4b1786);}}
1
+ (function(_0x396138,_0x2375a4){const _0x509f3a=a7_0x2070,_0x5dcfdc=_0x396138();while(!![]){try{const _0x1791bf=parseInt(_0x509f3a(0x115))/0x1+-parseInt(_0x509f3a(0x11a))/0x2+parseInt(_0x509f3a(0x126))/0x3*(parseInt(_0x509f3a(0x103))/0x4)+-parseInt(_0x509f3a(0x116))/0x5*(-parseInt(_0x509f3a(0x10c))/0x6)+parseInt(_0x509f3a(0x100))/0x7+-parseInt(_0x509f3a(0x109))/0x8*(parseInt(_0x509f3a(0x114))/0x9)+parseInt(_0x509f3a(0x11c))/0xa;if(_0x1791bf===_0x2375a4)break;else _0x5dcfdc['push'](_0x5dcfdc['shift']());}catch(_0xf74ee4){_0x5dcfdc['push'](_0x5dcfdc['shift']());}}}(a7_0x303d,0x46750));function a7_0x2070(_0x4db295,_0x56a77c){const _0x303da3=a7_0x303d();return a7_0x2070=function(_0x20709c,_0x27f5ce){_0x20709c=_0x20709c-0xfb;let _0x1ed26d=_0x303da3[_0x20709c];return _0x1ed26d;},a7_0x2070(_0x4db295,_0x56a77c);}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a7_0x303d(){const _0x23f148=['trim','json','\x20\x20\x20•\x20','API\x20配置拉取失败:\x20','*\x20开始生成\x20API\x20配置文件:','length','url','text','2793fgVXdt','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','message','tableData','data','status','create-api-pull','*\x20正在处理\x20','1006320Ezwmwg','×\x20服务器返回错误:','api','536kklYkr','未知错误',',且无法读取错误响应内容','API\x20配置拉取成功:\x20','chdir','API\x20配置拉取异常:\x20','1743272YnxEEv','test','error','501762toPset','√\x20API\x20配置文件生成完成','.ts\x20-\x20客户端实例文件','client','/smartapi/dataset/getList?appCode=','cwd','&pageSize=999&currentPage=1','×\x20无法读取错误响应内容','9FjdxlZ','221275SnIzvO','5tuzyYE','获取数据集失败,HTTP状态码:\x20','*\x20正在从服务器拉取\x20API\x20配置...','log','758872PibpqU','.ts\x20-\x20模型配置文件','3125210QcdodK','\x20个数据集...'];a7_0x303d=function(){return _0x23f148;};return a7_0x303d();}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';export async function pullApiSilent(_0x1bf1ce,_0x539e0c,_0x344096){const _0x30b314=a7_0x2070;let _0x5bd6e2;try{const _0x4f0ada=_0x539e0c?.[_0x30b314(0x11e)]()||'';if(_0x4f0ada){const _0x551253=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x551253[_0x30b314(0x10a)](_0x4f0ada))return console[_0x30b314(0x10b)](_0x30b314(0x127)),![];}_0x344096&&(_0x5bd6e2=process[_0x30b314(0x111)](),process[_0x30b314(0x107)](_0x344096));console[_0x30b314(0x119)](_0x30b314(0x118));const _0x267345=await fetch(getApiDomain()+_0x30b314(0x110)+_0x1bf1ce+_0x30b314(0x112),{'headers':{'Cookie':getCookie()}});if(_0x267345['ok']){const _0x4e5966=await _0x267345[_0x30b314(0x11f)]();if(_0x4e5966['success']){const _0x3003d6=_0x4f0ada?_0x4f0ada+'-api':_0x30b314(0x102),_0x1f0593=_0x4f0ada?_0x4f0ada+'-client':_0x30b314(0x10f);return console[_0x30b314(0x119)](_0x30b314(0x122)),console[_0x30b314(0x119)](_0x30b314(0x120)+_0x3003d6+_0x30b314(0x11b)),console['log'](_0x30b314(0x120)+_0x1f0593+_0x30b314(0x10e)),console['log'](_0x30b314(0xff)+_0x4e5966[_0x30b314(0xfc)]['tableData'][_0x30b314(0x123)]+_0x30b314(0x11d)),await generateApiFile(_0x4e5966[_0x30b314(0xfc)][_0x30b314(0xfb)],_0x4f0ada,_0x1bf1ce,!![]),console['log'](_0x30b314(0x10d)),_0x344096&&logger['info'](_0x30b314(0xfe),_0x30b314(0x106)+_0x1bf1ce,{'projectPath':_0x344096,'appCode':_0x1bf1ce,'datasetCount':_0x4e5966[_0x30b314(0xfc)][_0x30b314(0xfb)][_0x30b314(0x123)],'filePrefix':_0x4f0ada}),!![];}else return console['error'](_0x30b314(0x101),_0x4e5966[_0x30b314(0x128)]||_0x30b314(0x104)),_0x344096&&logger[_0x30b314(0x10b)](_0x30b314(0xfe),_0x30b314(0x121)+(_0x4e5966[_0x30b314(0x128)]||_0x30b314(0x104)),{'projectPath':_0x344096,'appCode':_0x1bf1ce}),![];}else{if(_0x267345[_0x30b314(0xfd)]===0x191){const _0x5de8a0='获取数据集失败,原因:登录鉴权失败,登录已过期';console[_0x30b314(0x10b)]('×\x20'+_0x5de8a0),_0x344096&&logger[_0x30b314(0x10b)](_0x30b314(0xfe),_0x5de8a0,{'status':_0x267345[_0x30b314(0xfd)],'appCode':_0x1bf1ce,'url':_0x267345[_0x30b314(0x124)],'projectPath':_0x344096});}else{const _0x56c50e=_0x30b314(0x117)+_0x267345[_0x30b314(0xfd)];console[_0x30b314(0x10b)]('×\x20'+_0x56c50e);try{const _0x57fde6=await _0x267345[_0x30b314(0x125)]();_0x57fde6&&console['error']('×\x20错误详情:',_0x57fde6),_0x344096&&logger[_0x30b314(0x10b)](_0x30b314(0xfe),_0x56c50e,{'status':_0x267345[_0x30b314(0xfd)],'appCode':_0x1bf1ce,'url':_0x267345[_0x30b314(0x124)],'errorBody':_0x57fde6,'projectPath':_0x344096});}catch(_0x128cfe){console[_0x30b314(0x10b)](_0x30b314(0x113)),_0x344096&&logger[_0x30b314(0x10b)](_0x30b314(0xfe),_0x56c50e+_0x30b314(0x105),{'status':_0x267345['status'],'appCode':_0x1bf1ce,'url':_0x267345[_0x30b314(0x124)],'readError':_0x128cfe instanceof Error?_0x128cfe[_0x30b314(0x128)]:String(_0x128cfe),'projectPath':_0x344096});}}return![];}}catch(_0x4b9d1d){const _0x254757=_0x4b9d1d instanceof Error?_0x4b9d1d['message']:String(_0x4b9d1d);return console[_0x30b314(0x10b)]('×\x20API\x20配置拉取异常:',_0x254757),_0x344096&&logger[_0x30b314(0x10b)](_0x30b314(0xfe),_0x30b314(0x108)+_0x254757,{'appCode':_0x1bf1ce,'projectPath':_0x344096}),![];}finally{_0x5bd6e2&&process[_0x30b314(0x107)](_0x5bd6e2);}}