@lovrabet/cli 1.1.26 → 1.2.1-beta.4

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 (67) hide show
  1. package/lib/add-page/input-page-router.js +1 -1
  2. package/lib/add-page/main.js +1 -1
  3. package/lib/add-page/select-page-template.js +1 -1
  4. package/lib/api/api-doc-ui.js +1 -1
  5. package/lib/api/api-doc.js +1 -1
  6. package/lib/api/api-pull-ui.js +1 -1
  7. package/lib/api/fetch-model-list.js +1 -1
  8. package/lib/api/generate-api-file.js +1 -1
  9. package/lib/api/main.js +1 -1
  10. package/lib/api/pull-silent.js +1 -1
  11. package/lib/app-menu/app-menu-sync-ui.js +1 -1
  12. package/lib/app-menu/create-menu.js +1 -1
  13. package/lib/app-menu/get-local-pages.js +1 -1
  14. package/lib/app-menu/get-online-menu-list.js +1 -1
  15. package/lib/app-menu/use-get-online-menu-list.js +1 -1
  16. package/lib/app-menu/utils.js +1 -1
  17. package/lib/app-menu/valid-url.js +1 -1
  18. package/lib/app-menu-update-cdn/current-content.js +1 -1
  19. package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
  20. package/lib/app-menu-update-cdn/main.js +1 -1
  21. package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -0
  22. package/lib/auth/auth-server-ui.js +1 -1
  23. package/lib/auth/auth-server.js +1 -1
  24. package/lib/auth/constant.js +1 -1
  25. package/lib/auth/get-cookie.js +1 -1
  26. package/lib/auth/is-session-valid.js +1 -1
  27. package/lib/auth/logout.js +1 -1
  28. package/lib/cli.js +1 -1
  29. package/lib/cmd/build-watch.js +1 -1
  30. package/lib/cmd/build.js +1 -1
  31. package/lib/cmd/logs.js +1 -1
  32. package/lib/cmd/preview.js +1 -1
  33. package/lib/cmd/start.js +1 -1
  34. package/lib/config/config-help.js +1 -1
  35. package/lib/config/main.js +1 -1
  36. package/lib/constant/domain.js +1 -1
  37. package/lib/constant/env.js +1 -1
  38. package/lib/create-app/enhanced-guided-create.js +1 -1
  39. package/lib/create-app/format-elapsed.js +1 -1
  40. package/lib/create-app/main.js +1 -1
  41. package/lib/create-app/task-finished.js +1 -1
  42. package/lib/create-app/task-loading.js +1 -1
  43. package/lib/create-app/task-running.js +1 -1
  44. package/lib/create-app/task-time.js +1 -1
  45. package/lib/create-app/use-copy-project-template.js +1 -1
  46. package/lib/create-app/use-format-code.js +1 -1
  47. package/lib/create-app/use-install-dependencies.js +1 -1
  48. package/lib/help.js +1 -1
  49. package/lib/init/main.js +1 -1
  50. package/lib/mcp/cursor.js +1 -1
  51. package/lib/mcp/main.js +1 -1
  52. package/lib/types/index.js +1 -0
  53. package/lib/utils/check-sdk-version.js +1 -0
  54. package/lib/utils/config.js +1 -1
  55. package/lib/utils/copy-directory.js +1 -1
  56. package/lib/utils/http-client.js +1 -1
  57. package/lib/utils/logger.js +1 -1
  58. package/lib/utils/router-updater.js +1 -1
  59. package/lib/utils/sleep.js +1 -1
  60. package/lib/utils/template-replacer.js +1 -1
  61. package/package.json +3 -1
  62. package/templates/generate-api/api.ts.tpl +9 -4
  63. package/templates/rules/lovrabet_rules.mdc.tpl +90 -34
  64. package/lib/app-menu-cdn-version/app-menu-sync-cdn-version-ui.js +0 -1
  65. package/lib/app-menu-cdn-version/cdn-url-compare-table.js +0 -1
  66. package/lib/app-menu-cdn-version/update-menu-cdn-url.js +0 -1
  67. /package/lib/{app-menu-cdn-version → app-menu-update-cdn}/types.js +0 -0
package/lib/mcp/cursor.js CHANGED
@@ -1 +1 @@
1
- (function(_0x5298e4,_0x1742d2){const _0x3f57ab=a53_0x35a8,_0x3f8755=_0x5298e4();while(!![]){try{const _0x5c71b5=-parseInt(_0x3f57ab(0x15e))/0x1*(-parseInt(_0x3f57ab(0x16f))/0x2)+-parseInt(_0x3f57ab(0x16d))/0x3+parseInt(_0x3f57ab(0x173))/0x4+-parseInt(_0x3f57ab(0x18a))/0x5*(parseInt(_0x3f57ab(0x16c))/0x6)+parseInt(_0x3f57ab(0x184))/0x7*(parseInt(_0x3f57ab(0x158))/0x8)+parseInt(_0x3f57ab(0x16b))/0x9+-parseInt(_0x3f57ab(0x161))/0xa;if(_0x5c71b5===_0x1742d2)break;else _0x3f8755['push'](_0x3f8755['shift']());}catch(_0x1f68c6){_0x3f8755['push'](_0x3f8755['shift']());}}}(a53_0x3166,0xa6e6a));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{resolve,dirname}from'node:path';function a53_0x35a8(_0x29a6d6,_0x3fb2bb){_0x29a6d6=_0x29a6d6-0x156;const _0x316624=a53_0x3166();let _0x35a811=_0x316624[_0x29a6d6];return _0x35a811;}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';function a53_0x3166(){const _0x4df10e=['创建\x20.cursor/rules\x20目录','错误:\x20解析现有\x20mcp.json\x20失败:\x20','4993312tBkIyR','env','lovrabet-dataset','.cursor','npx','复制\x20Cursor\x20Rules\x20文件失败','warn','创建\x20.cursor\x20目录','rules','更新现有\x20mcp.json\x20配置','stringify','✓\x20创建\x20.cursor\x20目录:\x20','mcp-cursor','创建新的\x20mcp.json\x20配置','utf8','appcode','未找到\x20appcode\x20配置','133ccGbXn','parse','✓\x20更新\x20mcp.json\x20配置','exit','\x20\x20-\x20配置文件:\x20','@lovrabet/dataset-mcp-server','709015urmKeT','\x20\x20-\x20环境:\x20','online','配置\x20Cursor\x20MCP\x20成功','555400yoFHWu','mcp.json','\x20\x20-\x20AppCode:\x20','message','\x0a现在您可以在\x20Cursor\x20中使用\x20Lovrabet\x20数据集\x20MCP\x20工具了。','错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置','17pjIcqH','log','info','17972590fdBrKJ','请重启\x20Cursor\x20以加载新的\x20MCP\x20配置。','lovrabet_rules.mdc','../../templates/rules/lovrabet_rules.mdc.tpl','Cursor\x20Rules\x20模板文件不存在','✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc','Cursor\x20Rules\x20文件已存在,跳过','app','!\x20Cursor\x20Rules\x20文件已存在,跳过创建,如需重新创建,请删除\x20.cursor/rules/lovrabet_rules.mdc\x20文件','mcpServers','10425780KLzJYE','42WIxqYu','2945667ZRkfug','error','85832ERkiVL','\x0a✓\x20Cursor\x20MCP\x20配置成功!'];a53_0x3166=function(){return _0x4df10e;};return a53_0x3166();}export async function configureCursorMcp(){const _0x3473b1=a53_0x35a8;try{const _0x47092e=process['cwd'](),_0x10fb3b=resolve(_0x47092e,_0x3473b1(0x176)),_0x5a4afc=resolve(_0x10fb3b,_0x3473b1(0x159)),_0x5a8c0e=readConfig(),_0x2a3a4c=_0x5a8c0e[_0x3473b1(0x182)]||_0x5a8c0e[_0x3473b1(0x168)],_0x3aa184=_0x5a8c0e[_0x3473b1(0x174)]||_0x3473b1(0x156);!_0x2a3a4c&&(console[_0x3473b1(0x16e)](_0x3473b1(0x15d)),logger[_0x3473b1(0x16e)](_0x3473b1(0x17f),_0x3473b1(0x183)),process[_0x3473b1(0x187)](0x1));!existsSync(_0x10fb3b)&&(mkdirSync(_0x10fb3b,{'recursive':!![]}),logger[_0x3473b1(0x160)](_0x3473b1(0x17f),_0x3473b1(0x17a),{'path':_0x10fb3b}),console[_0x3473b1(0x15f)](_0x3473b1(0x17e)+_0x10fb3b));const _0x345c40={'command':_0x3473b1(0x177),'args':['-y',_0x3473b1(0x189)],'env':{'LOVRABET_APP_CODE':String(_0x2a3a4c),'LOVRABET_ENV':String(_0x3aa184)}};let _0x2e90eb;if(existsSync(_0x5a4afc))try{const _0x1a2627=readFileSync(_0x5a4afc,_0x3473b1(0x181));_0x2e90eb=JSON[_0x3473b1(0x185)](_0x1a2627),!_0x2e90eb[_0x3473b1(0x16a)]&&(_0x2e90eb[_0x3473b1(0x16a)]={}),_0x2e90eb[_0x3473b1(0x16a)][_0x3473b1(0x175)]=_0x345c40,logger[_0x3473b1(0x160)](_0x3473b1(0x17f),_0x3473b1(0x17c),{'path':_0x5a4afc,'appcode':_0x2a3a4c,'env':_0x3aa184}),console[_0x3473b1(0x15f)](_0x3473b1(0x186));}catch(_0xca39c8){logger[_0x3473b1(0x16e)](_0x3473b1(0x17f),'解析现有\x20mcp.json\x20失败',{'error':_0xca39c8 instanceof Error?_0xca39c8['message']:String(_0xca39c8)}),console[_0x3473b1(0x16e)](_0x3473b1(0x172)+(_0xca39c8 instanceof Error?_0xca39c8[_0x3473b1(0x15b)]:String(_0xca39c8))),process[_0x3473b1(0x187)](0x1);}else _0x2e90eb={'mcpServers':{'lovrabet-dataset':_0x345c40}},logger['info'](_0x3473b1(0x17f),_0x3473b1(0x180),{'path':_0x5a4afc,'appcode':_0x2a3a4c,'env':_0x3aa184}),console['log']('✓\x20创建\x20mcp.json\x20配置文件');writeFileSync(_0x5a4afc,JSON[_0x3473b1(0x17d)](_0x2e90eb,null,0x2),{'encoding':_0x3473b1(0x181)});const _0x4abdff=resolve(_0x10fb3b,_0x3473b1(0x17b)),_0x57373e=resolve(_0x4abdff,_0x3473b1(0x163));if(!existsSync(_0x57373e))try{!existsSync(_0x4abdff)&&(mkdirSync(_0x4abdff,{'recursive':!![]}),logger['info']('mcp-cursor',_0x3473b1(0x171),{'path':_0x4abdff}));const _0x4d657a=fileURLToPath(import.meta.url),_0x32c7f0=dirname(_0x4d657a),_0xeda35=resolve(_0x32c7f0,_0x3473b1(0x164));existsSync(_0xeda35)?(copyFileSync(_0xeda35,_0x57373e),logger[_0x3473b1(0x160)](_0x3473b1(0x17f),'复制\x20Cursor\x20Rules\x20文件',{'from':_0xeda35,'to':_0x57373e}),console[_0x3473b1(0x15f)](_0x3473b1(0x166))):logger[_0x3473b1(0x179)](_0x3473b1(0x17f),_0x3473b1(0x165),{'templatePath':_0xeda35});}catch(_0x2a6bc3){logger[_0x3473b1(0x16e)](_0x3473b1(0x17f),_0x3473b1(0x178),{'error':_0x2a6bc3 instanceof Error?_0x2a6bc3[_0x3473b1(0x15b)]:String(_0x2a6bc3)}),console[_0x3473b1(0x179)]('警告:\x20复制\x20Cursor\x20Rules\x20文件失败:\x20'+(_0x2a6bc3 instanceof Error?_0x2a6bc3[_0x3473b1(0x15b)]:String(_0x2a6bc3)));}else console['log'](_0x3473b1(0x169)),logger[_0x3473b1(0x160)](_0x3473b1(0x17f),_0x3473b1(0x167),{'path':_0x57373e});console[_0x3473b1(0x15f)](_0x3473b1(0x170)),console['log']('\x0a配置信息:'),console['log'](_0x3473b1(0x15a)+_0x2a3a4c),console[_0x3473b1(0x15f)](_0x3473b1(0x18b)+_0x3aa184),console[_0x3473b1(0x15f)](_0x3473b1(0x188)+_0x5a4afc),console[_0x3473b1(0x15f)](_0x3473b1(0x15c)),console['log'](_0x3473b1(0x162)),logger[_0x3473b1(0x160)]('mcp-cursor',_0x3473b1(0x157),{'appcode':_0x2a3a4c,'env':_0x3aa184,'configPath':_0x5a4afc}),process[_0x3473b1(0x187)](0x0);}catch(_0x50ae2e){logger[_0x3473b1(0x16e)](_0x3473b1(0x17f),'配置\x20Cursor\x20MCP\x20失败',{'error':_0x50ae2e instanceof Error?_0x50ae2e[_0x3473b1(0x15b)]:String(_0x50ae2e)}),console[_0x3473b1(0x16e)]('错误:\x20配置失败:\x20'+(_0x50ae2e instanceof Error?_0x50ae2e[_0x3473b1(0x15b)]:String(_0x50ae2e))),process[_0x3473b1(0x187)](0x1);}}
1
+ (function(_0x52d065,_0x1bbace){const _0x5a2556=a51_0x51df,_0x304114=_0x52d065();while(!![]){try{const _0x513b40=parseInt(_0x5a2556(0xf8))/0x1+parseInt(_0x5a2556(0xd6))/0x2+parseInt(_0x5a2556(0xd8))/0x3*(parseInt(_0x5a2556(0xfd))/0x4)+parseInt(_0x5a2556(0x105))/0x5+parseInt(_0x5a2556(0xe7))/0x6*(parseInt(_0x5a2556(0xed))/0x7)+parseInt(_0x5a2556(0x107))/0x8+-parseInt(_0x5a2556(0xfa))/0x9*(parseInt(_0x5a2556(0xe2))/0xa);if(_0x513b40===_0x1bbace)break;else _0x304114['push'](_0x304114['shift']());}catch(_0x498c1d){_0x304114['push'](_0x304114['shift']());}}}(a51_0x5a83,0x7a009));function a51_0x5a83(){const _0xdf798c=['复制\x20Cursor\x20Rules\x20文件失败','env','错误:\x20配置失败:\x20','创建新的\x20mcp.json\x20配置','配置\x20Cursor\x20MCP\x20成功','622416HuPLSc','lovrabet-dataset','261SZKuyH','配置\x20Cursor\x20MCP\x20失败','../../templates/rules/lovrabet_rules.mdc.tpl','184TeHwnA','error','.cursor','警告:\x20复制\x20Cursor\x20Rules\x20文件失败:\x20','app','\x20\x20-\x20配置文件:\x20','错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置','warn','242460WBEyAI','npx','6897232MuzcIz','online','1637418xazlqu','解析现有\x20mcp.json\x20失败','33105iqKedV','✓\x20更新\x20mcp.json\x20配置','utf8','!\x20Cursor\x20Rules\x20文件已存在,跳过创建,如需重新创建,请删除\x20.cursor/rules/lovrabet_rules.mdc\x20文件','parse','lovrabet_rules.mdc','错误:\x20解析现有\x20mcp.json\x20失败:\x20','message','log','\x0a✓\x20Cursor\x20MCP\x20配置成功!','1056070YKyOTS','Cursor\x20Rules\x20文件已存在,跳过','info','exit','rules','4217658xGacTB','未找到\x20appcode\x20配置','更新现有\x20mcp.json\x20配置','\x0a现在您可以在\x20Cursor\x20中使用\x20Lovrabet\x20数据集\x20MCP\x20工具了。','stringify','\x20\x20-\x20环境:\x20','7JjLOad','mcpServers','mcp.json','mcp-cursor','@lovrabet/dataset-mcp-server','appcode'];a51_0x5a83=function(){return _0xdf798c;};return a51_0x5a83();}import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';function a51_0x51df(_0x27a85e,_0x40ab44){_0x27a85e=_0x27a85e-0xd6;const _0x5a83bf=a51_0x5a83();let _0x51dfa4=_0x5a83bf[_0x27a85e];return _0x51dfa4;}export async function configureCursorMcp(){const _0x113a4f=a51_0x51df;try{const _0x45ac82=process['cwd'](),_0x23dc27=resolve(_0x45ac82,_0x113a4f(0xff)),_0x3c74b1=resolve(_0x23dc27,_0x113a4f(0xef)),_0x2ba695=readConfig(),_0x3ff866=_0x2ba695[_0x113a4f(0xf2)]||_0x2ba695[_0x113a4f(0x101)],_0x567b1a=_0x2ba695[_0x113a4f(0xf4)]||_0x113a4f(0x108);!_0x3ff866&&(console[_0x113a4f(0xfe)](_0x113a4f(0x103)),logger[_0x113a4f(0xfe)](_0x113a4f(0xf0),_0x113a4f(0xe8)),process[_0x113a4f(0xe5)](0x1));!existsSync(_0x23dc27)&&(mkdirSync(_0x23dc27,{'recursive':!![]}),logger['info']('mcp-cursor','创建\x20.cursor\x20目录',{'path':_0x23dc27}),console[_0x113a4f(0xe0)]('✓\x20创建\x20.cursor\x20目录:\x20'+_0x23dc27));const _0x4ee1ca={'command':_0x113a4f(0x106),'args':['-y',_0x113a4f(0xf1)],'env':{'LOVRABET_APP_CODE':String(_0x3ff866),'LOVRABET_ENV':String(_0x567b1a)}};let _0x5790c1;if(existsSync(_0x3c74b1))try{const _0x3ab350=readFileSync(_0x3c74b1,'utf8');_0x5790c1=JSON[_0x113a4f(0xdc)](_0x3ab350),!_0x5790c1[_0x113a4f(0xee)]&&(_0x5790c1[_0x113a4f(0xee)]={}),_0x5790c1[_0x113a4f(0xee)][_0x113a4f(0xf9)]=_0x4ee1ca,logger[_0x113a4f(0xe4)]('mcp-cursor',_0x113a4f(0xe9),{'path':_0x3c74b1,'appcode':_0x3ff866,'env':_0x567b1a}),console['log'](_0x113a4f(0xd9));}catch(_0x5937f7){logger[_0x113a4f(0xfe)](_0x113a4f(0xf0),_0x113a4f(0xd7),{'error':_0x5937f7 instanceof Error?_0x5937f7['message']:String(_0x5937f7)}),console[_0x113a4f(0xfe)](_0x113a4f(0xde)+(_0x5937f7 instanceof Error?_0x5937f7['message']:String(_0x5937f7))),process['exit'](0x1);}else _0x5790c1={'mcpServers':{'lovrabet-dataset':_0x4ee1ca}},logger['info'](_0x113a4f(0xf0),_0x113a4f(0xf6),{'path':_0x3c74b1,'appcode':_0x3ff866,'env':_0x567b1a}),console['log']('✓\x20创建\x20mcp.json\x20配置文件');writeFileSync(_0x3c74b1,JSON[_0x113a4f(0xeb)](_0x5790c1,null,0x2),{'encoding':_0x113a4f(0xda)});const _0x2c91d6=resolve(_0x23dc27,_0x113a4f(0xe6)),_0x4e9677=resolve(_0x2c91d6,_0x113a4f(0xdd));if(!existsSync(_0x4e9677))try{!existsSync(_0x2c91d6)&&(mkdirSync(_0x2c91d6,{'recursive':!![]}),logger['info'](_0x113a4f(0xf0),'创建\x20.cursor/rules\x20目录',{'path':_0x2c91d6}));const _0x52acc3=fileURLToPath(import.meta.url),_0x3c1ac3=dirname(_0x52acc3),_0x31b9cc=resolve(_0x3c1ac3,_0x113a4f(0xfc));existsSync(_0x31b9cc)?(copyFileSync(_0x31b9cc,_0x4e9677),logger[_0x113a4f(0xe4)](_0x113a4f(0xf0),'复制\x20Cursor\x20Rules\x20文件',{'from':_0x31b9cc,'to':_0x4e9677}),console[_0x113a4f(0xe0)]('✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc')):logger[_0x113a4f(0x104)](_0x113a4f(0xf0),'Cursor\x20Rules\x20模板文件不存在',{'templatePath':_0x31b9cc});}catch(_0x358acf){logger[_0x113a4f(0xfe)]('mcp-cursor',_0x113a4f(0xf3),{'error':_0x358acf instanceof Error?_0x358acf[_0x113a4f(0xdf)]:String(_0x358acf)}),console[_0x113a4f(0x104)](_0x113a4f(0x100)+(_0x358acf instanceof Error?_0x358acf[_0x113a4f(0xdf)]:String(_0x358acf)));}else console[_0x113a4f(0xe0)](_0x113a4f(0xdb)),logger['info'](_0x113a4f(0xf0),_0x113a4f(0xe3),{'path':_0x4e9677});console[_0x113a4f(0xe0)](_0x113a4f(0xe1)),console[_0x113a4f(0xe0)]('\x0a配置信息:'),console[_0x113a4f(0xe0)]('\x20\x20-\x20AppCode:\x20'+_0x3ff866),console['log'](_0x113a4f(0xec)+_0x567b1a),console[_0x113a4f(0xe0)](_0x113a4f(0x102)+_0x3c74b1),console['log'](_0x113a4f(0xea)),console[_0x113a4f(0xe0)]('请重启\x20Cursor\x20以加载新的\x20MCP\x20配置。'),logger[_0x113a4f(0xe4)]('mcp-cursor',_0x113a4f(0xf7),{'appcode':_0x3ff866,'env':_0x567b1a,'configPath':_0x3c74b1}),process[_0x113a4f(0xe5)](0x0);}catch(_0x582f73){logger['error'](_0x113a4f(0xf0),_0x113a4f(0xfb),{'error':_0x582f73 instanceof Error?_0x582f73[_0x113a4f(0xdf)]:String(_0x582f73)}),console[_0x113a4f(0xfe)](_0x113a4f(0xf5)+(_0x582f73 instanceof Error?_0x582f73[_0x113a4f(0xdf)]:String(_0x582f73))),process[_0x113a4f(0xe5)](0x1);}}
package/lib/mcp/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0xc779a6,_0x10b224){var _0x2058a4=a54_0x5b52,_0x209c82=_0xc779a6();while(!![]){try{var _0x411a77=-parseInt(_0x2058a4(0x16e))/0x1+parseInt(_0x2058a4(0x170))/0x2*(-parseInt(_0x2058a4(0x171))/0x3)+-parseInt(_0x2058a4(0x163))/0x4+parseInt(_0x2058a4(0x165))/0x5+-parseInt(_0x2058a4(0x172))/0x6+-parseInt(_0x2058a4(0x166))/0x7+parseInt(_0x2058a4(0x16d))/0x8;if(_0x411a77===_0x10b224)break;else _0x209c82['push'](_0x209c82['shift']());}catch(_0x1dc5d2){_0x209c82['push'](_0x209c82['shift']());}}}(a54_0x20a8,0xb7c4b));import{configureCursorMcp}from'./cursor.js';import{logger}from'../utils/logger.js';function a54_0x5b52(_0x36bb6b,_0x1bdfb0){_0x36bb6b=_0x36bb6b-0x15b;var _0x20a8b3=a54_0x20a8();var _0x5b52aa=_0x20a8b3[_0x36bb6b];return _0x5b52aa;}function a54_0x20a8(){var _0x196097=['\x20\x20-\x20cursor','错误:\x20请指定\x20IDE\x20类型','25216432OslkPR','696136ObLSDW','setLogPath','2rdmoPW','864471ggazhn','5102184AZjUgI','toLowerCase','mcp','\x0a使用方法:','\x20\x20lovrabet\x20mcp\x20cursor\x20\x20\x20\x20配置\x20Cursor\x20的\x20MCP','cursor','log','\x0a示例:','执行配置\x20Cursor\x20MCP\x20命令','885988oRGqgD','\x0a当前支持的\x20IDE:','1784085dOWDcz','4900014AnPDlF','error','错误:\x20不支持的\x20IDE\x20类型:\x20','cwd','exit'];a54_0x20a8=function(){return _0x196097;};return a54_0x20a8();}export async function mcpCommand(_0xcdc4ec){var _0x55b8cb=a54_0x5b52;logger[_0x55b8cb(0x16f)](process[_0x55b8cb(0x169)]());if(!_0xcdc4ec){console['error'](_0x55b8cb(0x16c)),console[_0x55b8cb(0x160)](_0x55b8cb(0x15d)),console[_0x55b8cb(0x160)](_0x55b8cb(0x15e)),console['log'](_0x55b8cb(0x161)),console[_0x55b8cb(0x160)]('\x20\x20lovrabet\x20mcp\x20cursor'),logger['error'](_0x55b8cb(0x15c),'未指定\x20IDE\x20类型'),process['exit'](0x1);return;}switch(_0xcdc4ec[_0x55b8cb(0x15b)]()){case _0x55b8cb(0x15f):logger['info']('mcp',_0x55b8cb(0x162)),await configureCursorMcp();break;default:console['error'](_0x55b8cb(0x168)+_0xcdc4ec),console[_0x55b8cb(0x160)](_0x55b8cb(0x164)),console['log'](_0x55b8cb(0x16b)),logger[_0x55b8cb(0x167)]('mcp','不支持的\x20IDE\x20类型:\x20'+_0xcdc4ec),process[_0x55b8cb(0x16a)](0x1);break;}}
1
+ (function(_0x120b04,_0x227d39){var _0x4640dc=a52_0x4a8f,_0x105c0e=_0x120b04();while(!![]){try{var _0x4a4171=-parseInt(_0x4640dc(0x18c))/0x1+-parseInt(_0x4640dc(0x198))/0x2*(parseInt(_0x4640dc(0x18e))/0x3)+parseInt(_0x4640dc(0x192))/0x4+-parseInt(_0x4640dc(0x194))/0x5+-parseInt(_0x4640dc(0x19b))/0x6+parseInt(_0x4640dc(0x19a))/0x7*(-parseInt(_0x4640dc(0x1a3))/0x8)+parseInt(_0x4640dc(0x1a1))/0x9;if(_0x4a4171===_0x227d39)break;else _0x105c0e['push'](_0x105c0e['shift']());}catch(_0x4f7c37){_0x105c0e['push'](_0x105c0e['shift']());}}}(a52_0x2803,0x89bd8));function a52_0x4a8f(_0xcf110f,_0xe5a8aa){_0xcf110f=_0xcf110f-0x18b;var _0x28034a=a52_0x2803();var _0x4a8f42=_0x28034a[_0xcf110f];return _0x4a8f42;}import{configureCursorMcp}from'./cursor.js';function a52_0x2803(){var _0x30a48e=['error','info','\x0a当前支持的\x20IDE:','未指定\x20IDE\x20类型','mcp','33791832mJGrzG','\x0a示例:','48WlcDTR','toLowerCase','787500oXyoTg','\x20\x20lovrabet\x20mcp\x20cursor\x20\x20\x20\x20配置\x20Cursor\x20的\x20MCP','821823TbvhDi','log','exit','cwd','100476mtGcHg','执行配置\x20Cursor\x20MCP\x20命令','1157780mMeWEs','\x20\x20lovrabet\x20mcp\x20cursor','cursor','不支持的\x20IDE\x20类型:\x20','6PpvkDL','\x0a使用方法:','988043jiWFKZ','3166860LmPnwZ'];a52_0x2803=function(){return _0x30a48e;};return a52_0x2803();}import{logger}from'../utils/logger.js';export async function mcpCommand(_0x59badc){var _0x5483d2=a52_0x4a8f;logger['setLogPath'](process[_0x5483d2(0x191)]());if(!_0x59badc){console[_0x5483d2(0x19c)]('错误:\x20请指定\x20IDE\x20类型'),console['log'](_0x5483d2(0x199)),console[_0x5483d2(0x18f)](_0x5483d2(0x18d)),console[_0x5483d2(0x18f)](_0x5483d2(0x1a2)),console[_0x5483d2(0x18f)](_0x5483d2(0x195)),logger[_0x5483d2(0x19c)](_0x5483d2(0x1a0),_0x5483d2(0x19f)),process[_0x5483d2(0x190)](0x1);return;}switch(_0x59badc[_0x5483d2(0x18b)]()){case _0x5483d2(0x196):logger[_0x5483d2(0x19d)](_0x5483d2(0x1a0),_0x5483d2(0x193)),await configureCursorMcp();break;default:console[_0x5483d2(0x19c)]('错误:\x20不支持的\x20IDE\x20类型:\x20'+_0x59badc),console[_0x5483d2(0x18f)](_0x5483d2(0x19e)),console[_0x5483d2(0x18f)]('\x20\x20-\x20cursor'),logger[_0x5483d2(0x19c)](_0x5483d2(0x1a0),_0x5483d2(0x197)+_0x59badc),process[_0x5483d2(0x190)](0x1);break;}}
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1 @@
1
+ const a54_0x3614f6=a54_0x5854;(function(_0x5bfeb5,_0x5954b8){const _0xaf1da1=a54_0x5854,_0x32740f=_0x5bfeb5();while(!![]){try{const _0x2a9c9b=parseInt(_0xaf1da1(0x187))/0x1+parseInt(_0xaf1da1(0x179))/0x2*(parseInt(_0xaf1da1(0x192))/0x3)+-parseInt(_0xaf1da1(0x194))/0x4+-parseInt(_0xaf1da1(0x18d))/0x5*(parseInt(_0xaf1da1(0x183))/0x6)+-parseInt(_0xaf1da1(0x180))/0x7+-parseInt(_0xaf1da1(0x195))/0x8*(parseInt(_0xaf1da1(0x18c))/0x9)+-parseInt(_0xaf1da1(0x178))/0xa*(-parseInt(_0xaf1da1(0x177))/0xb);if(_0x2a9c9b===_0x5954b8)break;else _0x32740f['push'](_0x32740f['shift']());}catch(_0x205962){_0x32740f['push'](_0x32740f['shift']());}}}(a54_0x5ad1,0x62eac));import a54_0x16e228 from'node:fs';function a54_0x5854(_0x3b8e76,_0x46e109){_0x3b8e76=_0x3b8e76-0x177;const _0x5ad135=a54_0x5ad1();let _0x58545e=_0x5ad135[_0x3b8e76];return _0x58545e;}import a54_0x4a8a38 from'node:path';import a54_0x462b61 from'semver';function a54_0x5ad1(){const _0x5bb55f=['9330992xJEfRY','10REZGyL','98xLsAxg','⚠️\x20\x20SDK\x20版本不兼容','minVersion','\x1b[33m','1.2.0','needsUpgrade','\x20\x20\x20查看最新版本:\x20https://www.npmjs.com/package/@lovrabet/sdk','2404150GvKBzh','\x1b[1m','parse','2130SqTPUy','@lovrabet/sdk','package.json','version','82899BfRLQj','readFileSync','\x20\x20\x20当前\x20CLI\x20版本已升级模型注册协议,但检测到您的\x20@lovrabet/sdk\x20版本\x20','\x1b[0m','utf8','59337oxOIvQ','890eAIlky','dependencies','devDependencies','join','log','26124FQuuKS','\x20不支持新协议。','2078748tUdDER','32xqTqWR'];a54_0x5ad1=function(){return _0x5bb55f;};return a54_0x5ad1();}const MIN_SDK_VERSION=a54_0x3614f6(0x17d);export function checkSdkVersion(_0x272c19){const _0x2d7ecf=a54_0x3614f6,_0x55f12a=a54_0x4a8a38[_0x2d7ecf(0x190)](_0x272c19,_0x2d7ecf(0x185));if(!a54_0x16e228['existsSync'](_0x55f12a))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};try{const _0x3cc1f9=JSON[_0x2d7ecf(0x182)](a54_0x16e228[_0x2d7ecf(0x188)](_0x55f12a,_0x2d7ecf(0x18b))),_0x27dfb0=_0x3cc1f9[_0x2d7ecf(0x18e)]||{},_0x537bf7=_0x3cc1f9[_0x2d7ecf(0x18f)]||{},_0x563f19=_0x27dfb0['@lovrabet/sdk']||_0x537bf7[_0x2d7ecf(0x184)];if(!_0x563f19)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};const _0x480359=a54_0x462b61['coerce'](_0x563f19),_0x1fade4=_0x480359?a54_0x462b61['lt'](_0x480359,MIN_SDK_VERSION):![];return{'installed':!![],'version':_0x563f19,'needsUpgrade':_0x1fade4,'minVersion':MIN_SDK_VERSION};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};}}export function printSdkUpgradeWarning(_0x121f14){const _0x457ea3=a54_0x3614f6;if(!_0x121f14[_0x457ea3(0x17e)])return;const _0x2972d0=_0x457ea3(0x17c),_0x45b9c5=_0x457ea3(0x18a),_0x4217bd=_0x457ea3(0x181);console['log'](),console[_0x457ea3(0x191)](''+_0x2972d0+_0x4217bd+_0x457ea3(0x17a)+_0x45b9c5),console[_0x457ea3(0x191)](_0x2972d0+_0x457ea3(0x189)+_0x121f14[_0x457ea3(0x186)]+_0x457ea3(0x193)+_0x45b9c5),console[_0x457ea3(0x191)](_0x2972d0+'\x20\x20\x20请升级\x20SDK\x20至\x20'+_0x121f14[_0x457ea3(0x17b)]+'\x20或更高版本:'+_0x45b9c5),console[_0x457ea3(0x191)](_0x2972d0+'\x20\x20\x20npm\x20install\x20@lovrabet/sdk@latest'+_0x45b9c5),console[_0x457ea3(0x191)](_0x2972d0+_0x457ea3(0x17f)+_0x45b9c5),console[_0x457ea3(0x191)]();}
@@ -1 +1 @@
1
- const a55_0x5c4024=a55_0x5f1f;(function(_0xbce278,_0x3353a6){const _0xe7654a=a55_0x5f1f,_0x516ddd=_0xbce278();while(!![]){try{const _0x2618ce=-parseInt(_0xe7654a(0x162))/0x1+-parseInt(_0xe7654a(0x167))/0x2+parseInt(_0xe7654a(0x16a))/0x3+-parseInt(_0xe7654a(0x161))/0x4*(-parseInt(_0xe7654a(0x168))/0x5)+parseInt(_0xe7654a(0x15d))/0x6+-parseInt(_0xe7654a(0x15e))/0x7*(-parseInt(_0xe7654a(0x16d))/0x8)+-parseInt(_0xe7654a(0x160))/0x9;if(_0x2618ce===_0x3353a6)break;else _0x516ddd['push'](_0x516ddd['shift']());}catch(_0x138463){_0x516ddd['push'](_0x516ddd['shift']());}}}(a55_0x2eab,0xcca31));function a55_0x2eab(){const _0x588488=['2719338BAyjod','appcode','trim','5743336gUBFKG','9996822GgYjLC','14WEizcA','.lovrabetrc','33088581oaEZIb','572MieoRA','108443sgBsRe','parse','string','utf8','cwd','1496410tOLxZl','47655pTfzmt','app'];a55_0x2eab=function(){return _0x588488;};return a55_0x2eab();}function a55_0x5f1f(_0x2cfabf,_0x5b8fd3){_0x2cfabf=_0x2cfabf-0x15d;const _0x2eabe7=a55_0x2eab();let _0x5f1f53=_0x2eabe7[_0x2cfabf];return _0x5f1f53;}import{existsSync,readFileSync}from'node:fs';import{resolve}from'node:path';import{homedir}from'node:os';export const projectConfigPath=resolve(process[a55_0x5c4024(0x166)](),a55_0x5c4024(0x15f));export const globalConfigPath=resolve(homedir(),a55_0x5c4024(0x15f));export function readConfig(){const _0x42c106=a55_0x5c4024;let _0x52fe02={};try{if(existsSync(globalConfigPath)){const _0x4e8388=readFileSync(globalConfigPath,{'encoding':_0x42c106(0x165)});_0x4e8388&&(_0x52fe02=JSON[_0x42c106(0x163)](_0x4e8388));}}catch(_0x5e94f0){}try{if(existsSync(projectConfigPath)){const _0x1cc181=readFileSync(projectConfigPath,{'encoding':_0x42c106(0x165)});if(_0x1cc181){const _0x34465a=JSON['parse'](_0x1cc181);_0x52fe02={..._0x52fe02,..._0x34465a};}}}catch(_0x40e10a){}return _0x52fe02;}export function getConfigAppCode(){const _0x3606c0=a55_0x5c4024;let _0x534bb8={},_0x56606c={};try{if(existsSync(globalConfigPath)){const _0x499f01=readFileSync(globalConfigPath,{'encoding':'utf8'});_0x499f01&&(_0x56606c=JSON['parse'](_0x499f01));}}catch(_0x3f777a){}try{if(existsSync(projectConfigPath)){const _0x3f107b=readFileSync(projectConfigPath,{'encoding':_0x3606c0(0x165)});_0x3f107b&&(_0x534bb8=JSON[_0x3606c0(0x163)](_0x3f107b));}}catch(_0x22c0bc){}let _0x476353;if(_0x3606c0(0x16b)in _0x534bb8)_0x476353=_0x534bb8[_0x3606c0(0x16b)];else{if('app'in _0x534bb8)_0x476353=_0x534bb8[_0x3606c0(0x169)];else{if(_0x3606c0(0x16b)in _0x56606c)_0x476353=_0x56606c[_0x3606c0(0x16b)];else _0x3606c0(0x169)in _0x56606c&&(_0x476353=_0x56606c[_0x3606c0(0x169)]);}}if(typeof _0x476353!==_0x3606c0(0x164)||_0x476353[_0x3606c0(0x16c)]()==='')return undefined;return _0x476353;}export function isInProject(){return existsSync(projectConfigPath);}
1
+ const a55_0x2efdbe=a55_0x2b5f;(function(_0x157429,_0x1e1b0c){const _0xc4032f=a55_0x2b5f,_0x3c35fa=_0x157429();while(!![]){try{const _0x43e39c=parseInt(_0xc4032f(0x1ef))/0x1+parseInt(_0xc4032f(0x1ee))/0x2*(parseInt(_0xc4032f(0x1f0))/0x3)+parseInt(_0xc4032f(0x1eb))/0x4+parseInt(_0xc4032f(0x1e4))/0x5+-parseInt(_0xc4032f(0x1ec))/0x6+-parseInt(_0xc4032f(0x1e7))/0x7*(parseInt(_0xc4032f(0x1e2))/0x8)+-parseInt(_0xc4032f(0x1ea))/0x9*(parseInt(_0xc4032f(0x1f1))/0xa);if(_0x43e39c===_0x1e1b0c)break;else _0x3c35fa['push'](_0x3c35fa['shift']());}catch(_0x206346){_0x3c35fa['push'](_0x3c35fa['shift']());}}}(a55_0x30b2,0xc262f));import{existsSync,readFileSync}from'node:fs';import{resolve}from'node:path';import{homedir}from'node:os';export const projectConfigPath=resolve(process[a55_0x2efdbe(0x1f3)](),'.lovrabetrc');export const globalConfigPath=resolve(homedir(),a55_0x2efdbe(0x1f2));export function readConfig(){const _0x4149c2=a55_0x2efdbe;let _0xe34012={};try{if(existsSync(globalConfigPath)){const _0x1b4db7=readFileSync(globalConfigPath,{'encoding':_0x4149c2(0x1e3)});_0x1b4db7&&(_0xe34012=JSON[_0x4149c2(0x1e8)](_0x1b4db7));}}catch(_0x2f8cb5){}try{if(existsSync(projectConfigPath)){const _0x1dcdfe=readFileSync(projectConfigPath,{'encoding':'utf8'});if(_0x1dcdfe){const _0x69b420=JSON[_0x4149c2(0x1e8)](_0x1dcdfe);_0xe34012={..._0xe34012,..._0x69b420};}}}catch(_0x36f408){}return _0xe34012;}function a55_0x2b5f(_0x409e28,_0x291789){_0x409e28=_0x409e28-0x1e2;const _0x30b2ff=a55_0x30b2();let _0x2b5fe6=_0x30b2ff[_0x409e28];return _0x2b5fe6;}function a55_0x30b2(){const _0x492267=['parse','appcode','771354duYyZB','1111232GOOogM','2868702PERxzr','app','52zGtvlW','586764WxxugM','34677ciibNe','50AxTCDx','.lovrabetrc','cwd','73384SbBrhy','utf8','3514310QNaoMU','trim','string','126ZkpfPT'];a55_0x30b2=function(){return _0x492267;};return a55_0x30b2();}export function getConfigAppCode(){const _0x112a77=a55_0x2efdbe;let _0x2566ab={},_0x25866f={};try{if(existsSync(globalConfigPath)){const _0x1760ae=readFileSync(globalConfigPath,{'encoding':_0x112a77(0x1e3)});_0x1760ae&&(_0x25866f=JSON[_0x112a77(0x1e8)](_0x1760ae));}}catch(_0x7f0a32){}try{if(existsSync(projectConfigPath)){const _0x295456=readFileSync(projectConfigPath,{'encoding':'utf8'});_0x295456&&(_0x2566ab=JSON['parse'](_0x295456));}}catch(_0x4137e5){}let _0x15f74b;if(_0x112a77(0x1e9)in _0x2566ab)_0x15f74b=_0x2566ab[_0x112a77(0x1e9)];else{if(_0x112a77(0x1ed)in _0x2566ab)_0x15f74b=_0x2566ab[_0x112a77(0x1ed)];else{if('appcode'in _0x25866f)_0x15f74b=_0x25866f['appcode'];else _0x112a77(0x1ed)in _0x25866f&&(_0x15f74b=_0x25866f[_0x112a77(0x1ed)]);}}if(typeof _0x15f74b!==_0x112a77(0x1e6)||_0x15f74b[_0x112a77(0x1e5)]()==='')return undefined;return _0x15f74b;}export function isInProject(){return existsSync(projectConfigPath);}
@@ -1 +1 @@
1
- (function(_0x53c933,_0x101871){const _0x1dd7a2=a56_0x2321,_0x3764a8=_0x53c933();while(!![]){try{const _0x5468f5=-parseInt(_0x1dd7a2(0xac))/0x1*(-parseInt(_0x1dd7a2(0xa5))/0x2)+parseInt(_0x1dd7a2(0xa7))/0x3*(-parseInt(_0x1dd7a2(0x9f))/0x4)+-parseInt(_0x1dd7a2(0xa6))/0x5*(-parseInt(_0x1dd7a2(0xa3))/0x6)+-parseInt(_0x1dd7a2(0xa0))/0x7*(parseInt(_0x1dd7a2(0x9d))/0x8)+-parseInt(_0x1dd7a2(0xa9))/0x9*(-parseInt(_0x1dd7a2(0x9c))/0xa)+-parseInt(_0x1dd7a2(0xab))/0xb+-parseInt(_0x1dd7a2(0xa8))/0xc;if(_0x5468f5===_0x101871)break;else _0x3764a8['push'](_0x3764a8['shift']());}catch(_0x4d9a5e){_0x3764a8['push'](_0x3764a8['shift']());}}}(a56_0x2cf9,0x4e4c9));import a56_0x38720f from'node:path';function a56_0x2cf9(){const _0x3569eb=['2992794vLuMtC','复制目录时出错:','copyFileSync','84PmhJQN','name','6sxEQKO','7675bTGILk','178749aRpJyi','1395588KfXutW','111114TxqlRP','join','698676XMrQgy','179986nVluTw','error','readdirSync','490pUsDcz','8XPsphQ','isDirectory','16NJVuNV'];a56_0x2cf9=function(){return _0x3569eb;};return a56_0x2cf9();}function a56_0x2321(_0x27d6f7,_0xd5ffce){_0x27d6f7=_0x27d6f7-0x9c;const _0x2cf9dd=a56_0x2cf9();let _0x23210f=_0x2cf9dd[_0x27d6f7];return _0x23210f;}import a56_0x3ee209 from'node:fs';export async function copyDirectory(_0x222e83,_0x2a00a2){const _0x2f8f6f=a56_0x2321;try{const _0x27c28e=a56_0x3ee209[_0x2f8f6f(0xae)](_0x222e83,{'withFileTypes':!![]});a56_0x3ee209['mkdirSync'](_0x2a00a2,{'recursive':!![]});for(const _0x5a4801 of _0x27c28e){const _0x5a917a=a56_0x38720f[_0x2f8f6f(0xaa)](_0x222e83,_0x5a4801['name']),_0x227e34=a56_0x38720f[_0x2f8f6f(0xaa)](_0x2a00a2,_0x5a4801[_0x2f8f6f(0xa4)]);_0x5a4801[_0x2f8f6f(0x9e)]()?await copyDirectory(_0x5a917a,_0x227e34):a56_0x3ee209[_0x2f8f6f(0xa2)](_0x5a917a,_0x227e34);}}catch(_0x4694a2){console[_0x2f8f6f(0xad)](_0x2f8f6f(0xa1),_0x4694a2);}}
1
+ function a56_0x30ad(){const _0x852030=['3795390KRaBPv','20OWBEsl','1315529hlQWug','163968BQGuAM','5177528CMnIwh','isDirectory','7266216PkeheH','2028670paZRjB','copyFileSync','48422nSJTOw','name','36kJDdMj','复制目录时出错:','readdirSync','7lOiBTY'];a56_0x30ad=function(){return _0x852030;};return a56_0x30ad();}(function(_0x303bb1,_0x1e98e1){const _0x3b9445=a56_0x526b,_0x2ac182=_0x303bb1();while(!![]){try{const _0x2aa6f4=parseInt(_0x3b9445(0x17d))/0x1+parseInt(_0x3b9445(0x175))/0x2*(parseInt(_0x3b9445(0x177))/0x3)+parseInt(_0x3b9445(0x17f))/0x4+-parseInt(_0x3b9445(0x182))/0x5+parseInt(_0x3b9445(0x17e))/0x6+parseInt(_0x3b9445(0x17a))/0x7*(-parseInt(_0x3b9445(0x181))/0x8)+parseInt(_0x3b9445(0x17b))/0x9*(-parseInt(_0x3b9445(0x17c))/0xa);if(_0x2aa6f4===_0x1e98e1)break;else _0x2ac182['push'](_0x2ac182['shift']());}catch(_0x1b782d){_0x2ac182['push'](_0x2ac182['shift']());}}}(a56_0x30ad,0xbc124));import a56_0x131899 from'node:path';function a56_0x526b(_0x3b6a37,_0x5e2f64){_0x3b6a37=_0x3b6a37-0x175;const _0x30ad12=a56_0x30ad();let _0x526b27=_0x30ad12[_0x3b6a37];return _0x526b27;}import a56_0x2c9b0d from'node:fs';export async function copyDirectory(_0x22d9c3,_0x4aaf16){const _0x4c8487=a56_0x526b;try{const _0x4a0e83=a56_0x2c9b0d[_0x4c8487(0x179)](_0x22d9c3,{'withFileTypes':!![]});a56_0x2c9b0d['mkdirSync'](_0x4aaf16,{'recursive':!![]});for(const _0x1a5369 of _0x4a0e83){const _0x2024a1=a56_0x131899['join'](_0x22d9c3,_0x1a5369[_0x4c8487(0x176)]),_0x57caba=a56_0x131899['join'](_0x4aaf16,_0x1a5369[_0x4c8487(0x176)]);_0x1a5369[_0x4c8487(0x180)]()?await copyDirectory(_0x2024a1,_0x57caba):a56_0x2c9b0d[_0x4c8487(0x183)](_0x2024a1,_0x57caba);}}catch(_0x52baf8){console['error'](_0x4c8487(0x178),_0x52baf8);}}
@@ -1 +1 @@
1
- (function(_0x3de174,_0x16f3a6){const _0x5ba4ef=a57_0x5b0b,_0x35f827=_0x3de174();while(!![]){try{const _0x44154b=parseInt(_0x5ba4ef(0x16d))/0x1+-parseInt(_0x5ba4ef(0x173))/0x2+parseInt(_0x5ba4ef(0x160))/0x3+parseInt(_0x5ba4ef(0x174))/0x4+-parseInt(_0x5ba4ef(0x16f))/0x5+-parseInt(_0x5ba4ef(0x167))/0x6*(-parseInt(_0x5ba4ef(0x165))/0x7)+-parseInt(_0x5ba4ef(0x15a))/0x8*(parseInt(_0x5ba4ef(0x177))/0x9);if(_0x44154b===_0x16f3a6)break;else _0x35f827['push'](_0x35f827['shift']());}catch(_0x4c2062){_0x35f827['push'](_0x35f827['shift']());}}}(a57_0x19e3,0x8988f));export async function httpRequest(_0x205858,_0x1fbe88={}){const _0x576432=a57_0x5b0b,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x1fbe88;let _0x6f4d89=null;for(let _0x47f194=0x0;_0x47f194<=retries;_0x47f194++){try{const _0x27492d=new AbortController(),_0x534946=setTimeout(()=>_0x27492d[_0x576432(0x16a)](),timeout),_0x32bfc1=await fetch(_0x205858,{'headers':headers,'signal':_0x27492d[_0x576432(0x162)]});clearTimeout(_0x534946);let _0x152805;const _0x33e070=_0x32bfc1[_0x576432(0x163)][_0x576432(0x172)](_0x576432(0x15e));return _0x33e070?.[_0x576432(0x170)](_0x576432(0x178))?_0x152805=await _0x32bfc1[_0x576432(0x16c)]():_0x152805=await _0x32bfc1[_0x576432(0x171)](),{'ok':_0x32bfc1['ok'],'status':_0x32bfc1[_0x576432(0x164)],'statusText':_0x32bfc1[_0x576432(0x16e)],'data':_0x152805,'headers':_0x32bfc1[_0x576432(0x163)],'url':_0x32bfc1[_0x576432(0x166)],'text':()=>_0x32bfc1['text']()};}catch(_0x2442eb){_0x6f4d89=_0x2442eb instanceof Error?_0x2442eb:new Error(String(_0x2442eb));if(_0x47f194===retries)break;if(shouldRetry(_0x2442eb)){console[_0x576432(0x15f)](_0x576432(0x16b)+retryDelay+'ms\x20后进行第\x20'+(_0x47f194+0x1)+_0x576432(0x15c)),await sleep(retryDelay);continue;}else break;}}throw _0x6f4d89||new Error(_0x576432(0x168));}function a57_0x19e3(){const _0x12f266=['get','1362016woFsAs','747364PzTKFx','TypeError','fetch','3216249YlCjgy','application/json','16PBtGcp','AbortError','\x20次重试...','name','content-type','log','2334336ZmUPGq','ECONNRESET','signal','headers','status','42yRJeAe','url','829698kCigVT','Request\x20failed','message','abort','*\x20请求失败,','json','1039508vGVTvG','statusText','4375430tlpIgH','includes','text'];a57_0x19e3=function(){return _0x12f266;};return a57_0x19e3();}function a57_0x5b0b(_0xba4fd2,_0x1383eb){_0xba4fd2=_0xba4fd2-0x15a;const _0x19e355=a57_0x19e3();let _0x5b0bb1=_0x19e355[_0xba4fd2];return _0x5b0bb1;}function shouldRetry(_0x4148b7){const _0x765b4b=a57_0x5b0b;if(_0x4148b7 instanceof Error){if(_0x4148b7[_0x765b4b(0x15d)]===_0x765b4b(0x15b))return![];if(_0x4148b7[_0x765b4b(0x15d)]===_0x765b4b(0x175)&&_0x4148b7[_0x765b4b(0x169)][_0x765b4b(0x170)](_0x765b4b(0x176)))return!![];if(_0x4148b7[_0x765b4b(0x169)][_0x765b4b(0x170)](_0x765b4b(0x161)))return!![];if(_0x4148b7['message']['includes']('ENOTFOUND'))return![];}return![];}function sleep(_0x54cf8e){return new Promise(_0x255563=>setTimeout(_0x255563,_0x54cf8e));}export function validateUrl(_0x292f73){try{return new URL(_0x292f73),!![];}catch{return![];}}
1
+ (function(_0x4df7e4,_0x2a0e57){const _0x36232b=a57_0x1642,_0x5a8254=_0x4df7e4();while(!![]){try{const _0x35bb5b=-parseInt(_0x36232b(0xb6))/0x1*(parseInt(_0x36232b(0xc0))/0x2)+parseInt(_0x36232b(0xb1))/0x3*(-parseInt(_0x36232b(0xad))/0x4)+-parseInt(_0x36232b(0xb2))/0x5*(parseInt(_0x36232b(0xbe))/0x6)+parseInt(_0x36232b(0xb8))/0x7+parseInt(_0x36232b(0xaf))/0x8+-parseInt(_0x36232b(0xb4))/0x9+parseInt(_0x36232b(0xc7))/0xa;if(_0x35bb5b===_0x2a0e57)break;else _0x5a8254['push'](_0x5a8254['shift']());}catch(_0x4c8017){_0x5a8254['push'](_0x5a8254['shift']());}}}(a57_0x3664,0x36e26));export async function httpRequest(_0x205565,_0x18703e={}){const _0x1f9b31=a57_0x1642,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x18703e;let _0x8c299f=null;for(let _0x446255=0x0;_0x446255<=retries;_0x446255++){try{const _0x18c3ba=new AbortController(),_0x24df53=setTimeout(()=>_0x18c3ba[_0x1f9b31(0xc1)](),timeout),_0x2a1bfd=await fetch(_0x205565,{'headers':headers,'signal':_0x18c3ba[_0x1f9b31(0xcb)]});clearTimeout(_0x24df53);let _0x2cd8e0;const _0x2f3e82=_0x2a1bfd['headers'][_0x1f9b31(0xc6)](_0x1f9b31(0xac));return _0x2f3e82?.[_0x1f9b31(0xbf)](_0x1f9b31(0xbb))?_0x2cd8e0=await _0x2a1bfd[_0x1f9b31(0xb5)]():_0x2cd8e0=await _0x2a1bfd['text'](),{'ok':_0x2a1bfd['ok'],'status':_0x2a1bfd[_0x1f9b31(0xc4)],'statusText':_0x2a1bfd[_0x1f9b31(0xb0)],'data':_0x2cd8e0,'headers':_0x2a1bfd[_0x1f9b31(0xc5)],'url':_0x2a1bfd[_0x1f9b31(0xb3)],'text':()=>_0x2a1bfd[_0x1f9b31(0xc8)]()};}catch(_0x3adc95){_0x8c299f=_0x3adc95 instanceof Error?_0x3adc95:new Error(String(_0x3adc95));if(_0x446255===retries)break;if(shouldRetry(_0x3adc95)){console[_0x1f9b31(0xb9)](_0x1f9b31(0xc2)+retryDelay+_0x1f9b31(0xca)+(_0x446255+0x1)+_0x1f9b31(0xc3)),await sleep(retryDelay);continue;}else break;}}throw _0x8c299f||new Error('Request\x20failed');}function shouldRetry(_0x3b63db){const _0x40c512=a57_0x1642;if(_0x3b63db instanceof Error){if(_0x3b63db['name']===_0x40c512(0xc9))return![];if(_0x3b63db[_0x40c512(0xae)]===_0x40c512(0xba)&&_0x3b63db['message'][_0x40c512(0xbf)](_0x40c512(0xbc)))return!![];if(_0x3b63db['message'][_0x40c512(0xbf)](_0x40c512(0xbd)))return!![];if(_0x3b63db[_0x40c512(0xb7)]['includes']('ENOTFOUND'))return![];}return![];}function a57_0x1642(_0x356c54,_0x5d7624){_0x356c54=_0x356c54-0xac;const _0x36644a=a57_0x3664();let _0x1642d4=_0x36644a[_0x356c54];return _0x1642d4;}function a57_0x3664(){const _0x579d99=['includes','114vAugrj','abort','*\x20请求失败,','\x20次重试...','status','headers','get','9315510nCWrBQ','text','AbortError','ms\x20后进行第\x20','signal','content-type','8RMomLS','name','784976VxXdpX','statusText','168261toOAUI','965ewOWwG','url','1004229ulOGDO','json','7448UXJvLD','message','1604617yfayOm','log','TypeError','application/json','fetch','ECONNRESET','11994XWuEFu'];a57_0x3664=function(){return _0x579d99;};return a57_0x3664();}function sleep(_0x45176e){return new Promise(_0x2b2c6f=>setTimeout(_0x2b2c6f,_0x45176e));}export function validateUrl(_0x3e6a4a){try{return new URL(_0x3e6a4a),!![];}catch{return![];}}
@@ -1 +1 @@
1
- function a58_0x1d0d(){const _0x2eee49=['12932944iRDnog','readLogs','timestamp','error','File','warn','2298bnPUNW','toISOString','clear','transports','2334812yyemCL','stringify','Failed\x20to\x20clear\x20logs:','now','blue','existsSync','yellow','success','level','winstonLogger','errors','filter','format','2620770IrzLnY','rawCommand','utf8','Failed\x20to\x20read\x20logs:','clearLogs','createLogger','logFilePath','.lovrabet.log','duration','info','unknown','logTask','initWinstonLogger','mkdirSync','printf','red','setRawCommand','9935JFInGF','green','2yNZgUa','parse','split','215089ZDukrr','addColors','currentRawCommand','combine','message','6066263HCOpwS','5629275ZGxxIi'];a58_0x1d0d=function(){return _0x2eee49;};return a58_0x1d0d();}const a58_0x953178=a58_0x2394;(function(_0x124e55,_0x4f41d3){const _0x1a646e=a58_0x2394,_0x5f2430=_0x124e55();while(!![]){try{const _0xc8af0e=parseInt(_0x1a646e(0x101))/0x1+-parseInt(_0x1a646e(0xfe))/0x2*(parseInt(_0x1a646e(0xeb))/0x3)+parseInt(_0x1a646e(0xde))/0x4+parseInt(_0x1a646e(0xfc))/0x5*(parseInt(_0x1a646e(0xda))/0x6)+-parseInt(_0x1a646e(0x106))/0x7+parseInt(_0x1a646e(0x108))/0x8+-parseInt(_0x1a646e(0x107))/0x9;if(_0xc8af0e===_0x4f41d3)break;else _0x5f2430['push'](_0x5f2430['shift']());}catch(_0x2e5b68){_0x5f2430['push'](_0x5f2430['shift']());}}}(a58_0x1d0d,0xc5f05));import a58_0x7b3a29 from'winston';function a58_0x2394(_0x20bb12,_0x68ff40){_0x20bb12=_0x20bb12-0xd5;const _0x1d0de9=a58_0x1d0d();let _0x239425=_0x1d0de9[_0x20bb12];return _0x239425;}import a58_0x5584da from'node:fs';import a58_0x1135e9 from'node:path';class Logger{[a58_0x953178(0xe7)];[a58_0x953178(0xf1)];['currentRawCommand']='';constructor(){const _0x59380e=a58_0x953178;this[_0x59380e(0xf1)]='';}[a58_0x953178(0xfb)](_0x1ea822){const _0x4f970d=a58_0x953178;this[_0x4f970d(0x103)]=_0x1ea822;}['initWinstonLogger'](){const _0x486c82=a58_0x953178,_0x400b56=a58_0x1135e9['dirname'](this[_0x486c82(0xf1)]);!a58_0x5584da['existsSync'](_0x400b56)&&a58_0x5584da[_0x486c82(0xf8)](_0x400b56,{'recursive':!![]});const _0x5325b3=a58_0x7b3a29[_0x486c82(0xea)][_0x486c82(0x104)](a58_0x7b3a29[_0x486c82(0xea)][_0x486c82(0xd6)](),a58_0x7b3a29[_0x486c82(0xea)][_0x486c82(0xe8)]({'stack':!![]}),a58_0x7b3a29['format'][_0x486c82(0xf9)](_0x371550=>{const _0x21c73e=_0x486c82,_0x4b70d0={'timestamp':_0x371550['timestamp']||new Date()[_0x21c73e(0xdb)](),'level':_0x371550[_0x21c73e(0xe6)]||_0x21c73e(0xf4),'command':_0x371550['command']||_0x21c73e(0xf5),'rawCommand':_0x371550[_0x21c73e(0xec)]||this[_0x21c73e(0x103)]||undefined,'message':_0x371550[_0x21c73e(0x105)]||'','duration':_0x371550[_0x21c73e(0xf3)]||undefined,'details':_0x371550['details']||undefined};return JSON[_0x21c73e(0xdf)](_0x4b70d0);}));this['winstonLogger']=a58_0x7b3a29[_0x486c82(0xf0)]({'level':_0x486c82(0xf4),'format':_0x5325b3,'transports':[new a58_0x7b3a29[(_0x486c82(0xdd))][(_0x486c82(0xd8))]({'filename':this[_0x486c82(0xf1)],'level':_0x486c82(0xf4)})],'silent':![]}),a58_0x7b3a29[_0x486c82(0x102)]({'success':_0x486c82(0xfd),'error':_0x486c82(0xfa),'warn':_0x486c82(0xe4),'info':_0x486c82(0xe2)});}['setLogPath'](_0x1b8246){const _0x382ece=a58_0x953178;this[_0x382ece(0xf1)]=a58_0x1135e9['join'](_0x1b8246,_0x382ece(0xf2)),this['winstonLogger']&&this[_0x382ece(0xe7)][_0x382ece(0xdc)](),this[_0x382ece(0xf7)]();}[a58_0x953178(0xf4)](_0x165340,_0x5d471c,_0x432800){const _0x5a28bc=a58_0x953178;if(!this[_0x5a28bc(0xf1)]||!this[_0x5a28bc(0xe7)])return;this[_0x5a28bc(0xe7)][_0x5a28bc(0xf4)](_0x5d471c,{'command':_0x165340,'details':_0x432800});}[a58_0x953178(0xe5)](_0x1031bd,_0x1ce318,_0x5ac448,_0x154ce5){const _0x2c680f=a58_0x953178;if(!this['logFilePath']||!this[_0x2c680f(0xe7)])return;this[_0x2c680f(0xe7)]['log'](_0x2c680f(0xf4),_0x1ce318,{'level':_0x2c680f(0xe5),'command':_0x1031bd,'duration':_0x5ac448,'details':_0x154ce5});}[a58_0x953178(0xd7)](_0x25153d,_0x51cb73,_0x4ae6c4){const _0x30cc47=a58_0x953178;if(!this['logFilePath']||!this['winstonLogger'])return;this[_0x30cc47(0xe7)]['error'](_0x51cb73,{'command':_0x25153d,'details':_0x4ae6c4});}[a58_0x953178(0xd9)](_0x31a036,_0x5d0ecf,_0x5d8f46){const _0x52b765=a58_0x953178;if(!this['logFilePath']||!this[_0x52b765(0xe7)])return;this['winstonLogger']['warn'](_0x5d0ecf,{'command':_0x31a036,'details':_0x5d8f46});}async[a58_0x953178(0xf6)](_0x52d520,_0x1a9249,_0x59f5da){const _0xbef1b9=a58_0x953178,_0xc6eb77=Date[_0xbef1b9(0xe1)]();this[_0xbef1b9(0xf4)](_0x52d520,'开始执行:\x20'+_0x1a9249);try{const _0x36c04a=await _0x59f5da(),_0x21b55f=Date[_0xbef1b9(0xe1)]()-_0xc6eb77;return this[_0xbef1b9(0xe5)](_0x52d520,'完成:\x20'+_0x1a9249,_0x21b55f),_0x36c04a;}catch(_0x1c773c){const _0x46fdb5=Date['now']()-_0xc6eb77;this[_0xbef1b9(0xd7)](_0x52d520,'失败:\x20'+_0x1a9249,{'error':_0x1c773c instanceof Error?_0x1c773c[_0xbef1b9(0x105)]:String(_0x1c773c),'duration':_0x46fdb5});throw _0x1c773c;}}[a58_0x953178(0xd5)](){const _0xacb5d=a58_0x953178;try{if(!a58_0x5584da['existsSync'](this['logFilePath']))return[];const _0x48a592=a58_0x5584da['readFileSync'](this[_0xacb5d(0xf1)],'utf8');return _0x48a592[_0xacb5d(0x100)]('\x0a')[_0xacb5d(0xe9)](_0x5e1078=>_0x5e1078['trim']())['map'](_0x58fe40=>JSON[_0xacb5d(0xff)](_0x58fe40));}catch(_0x394915){return console['warn'](_0xacb5d(0xee),_0x394915),[];}}[a58_0x953178(0xef)](){const _0x2ddec5=a58_0x953178;try{a58_0x5584da[_0x2ddec5(0xe3)](this['logFilePath'])&&a58_0x5584da['writeFileSync'](this[_0x2ddec5(0xf1)],'',_0x2ddec5(0xed));}catch(_0x5231ce){console[_0x2ddec5(0xd9)](_0x2ddec5(0xe0),_0x5231ce);}}['getWinstonInstance'](){const _0x3394c4=a58_0x953178;return this[_0x3394c4(0xe7)];}}export const logger=new Logger();
1
+ const a58_0x51a0ff=a58_0x4e64;function a58_0x26af(){const _0xc40c5=['existsSync','details','initWinstonLogger','parse','16374RYvNht','49AkELfp','clear','logTask','clearLogs','addColors','logFilePath','setRawCommand','message','Failed\x20to\x20clear\x20logs:','mkdirSync','join','utf8','timestamp','Failed\x20to\x20read\x20logs:','toISOString','开始执行:\x20','log','writeFileSync','完成:\x20','command','blue','790860frdDUu','396bekoys','errors','stringify','6720525EFFwXm','success','error','green','info','52410879HuuUxA','readFileSync','1579024KBTvyc','filter','rawCommand','format','unknown','readLogs','transports','2242314DQyVGN','10NTNhCt','trim','winstonLogger','currentRawCommand','map','now','.lovrabet.log','red','level','warn','195700vxhmkA'];a58_0x26af=function(){return _0xc40c5;};return a58_0x26af();}(function(_0x42304a,_0x2d764b){const _0x2bb5cc=a58_0x4e64,_0x50b9a0=_0x42304a();while(!![]){try{const _0x5f1322=-parseInt(_0x2bb5cc(0xc1))/0x1+parseInt(_0x2bb5cc(0xab))/0x2*(-parseInt(_0x2bb5cc(0xc2))/0x3)+parseInt(_0x2bb5cc(0xa6))/0x4+-parseInt(_0x2bb5cc(0xc5))/0x5+-parseInt(_0x2bb5cc(0xd3))/0x6+parseInt(_0x2bb5cc(0xac))/0x7*(-parseInt(_0x2bb5cc(0xcc))/0x8)+-parseInt(_0x2bb5cc(0xca))/0x9*(-parseInt(_0x2bb5cc(0xd4))/0xa);if(_0x5f1322===_0x2d764b)break;else _0x50b9a0['push'](_0x50b9a0['shift']());}catch(_0x32f710){_0x50b9a0['push'](_0x50b9a0['shift']());}}}(a58_0x26af,0xdc0de));import a58_0x2d6691 from'winston';import a58_0x2ba5f2 from'node:fs';import a58_0x2dbf15 from'node:path';function a58_0x4e64(_0x2dd866,_0x2137a3){_0x2dd866=_0x2dd866-0xa6;const _0x26af2e=a58_0x26af();let _0x4e64ae=_0x26af2e[_0x2dd866];return _0x4e64ae;}class Logger{[a58_0x51a0ff(0xd6)];[a58_0x51a0ff(0xb1)];[a58_0x51a0ff(0xd7)]='';constructor(){const _0x2f8aca=a58_0x51a0ff;this[_0x2f8aca(0xb1)]='';}[a58_0x51a0ff(0xb2)](_0x334c85){const _0x19edd5=a58_0x51a0ff;this[_0x19edd5(0xd7)]=_0x334c85;}[a58_0x51a0ff(0xa9)](){const _0x37175f=a58_0x51a0ff,_0xb1d58b=a58_0x2dbf15['dirname'](this[_0x37175f(0xb1)]);!a58_0x2ba5f2[_0x37175f(0xa7)](_0xb1d58b)&&a58_0x2ba5f2[_0x37175f(0xb5)](_0xb1d58b,{'recursive':!![]});const _0x266820=a58_0x2d6691[_0x37175f(0xcf)]['combine'](a58_0x2d6691[_0x37175f(0xcf)][_0x37175f(0xb8)](),a58_0x2d6691[_0x37175f(0xcf)][_0x37175f(0xc3)]({'stack':!![]}),a58_0x2d6691[_0x37175f(0xcf)]['printf'](_0x18b0cb=>{const _0x281676=_0x37175f,_0x5e399a={'timestamp':_0x18b0cb[_0x281676(0xb8)]||new Date()[_0x281676(0xba)](),'level':_0x18b0cb[_0x281676(0xdc)]||'info','command':_0x18b0cb[_0x281676(0xbf)]||_0x281676(0xd0),'rawCommand':_0x18b0cb[_0x281676(0xce)]||this['currentRawCommand']||undefined,'message':_0x18b0cb[_0x281676(0xb3)]||'','duration':_0x18b0cb['duration']||undefined,'details':_0x18b0cb[_0x281676(0xa8)]||undefined};return JSON[_0x281676(0xc4)](_0x5e399a);}));this[_0x37175f(0xd6)]=a58_0x2d6691['createLogger']({'level':_0x37175f(0xc9),'format':_0x266820,'transports':[new a58_0x2d6691[(_0x37175f(0xd2))]['File']({'filename':this['logFilePath'],'level':'info'})],'silent':![]}),a58_0x2d6691[_0x37175f(0xb0)]({'success':_0x37175f(0xc8),'error':_0x37175f(0xdb),'warn':'yellow','info':_0x37175f(0xc0)});}['setLogPath'](_0x2ed224){const _0x16546d=a58_0x51a0ff;this[_0x16546d(0xb1)]=a58_0x2dbf15[_0x16546d(0xb6)](_0x2ed224,_0x16546d(0xda)),this[_0x16546d(0xd6)]&&this['winstonLogger'][_0x16546d(0xad)](),this[_0x16546d(0xa9)]();}[a58_0x51a0ff(0xc9)](_0x2e3f19,_0x2bb197,_0x36b01d){const _0x9ea903=a58_0x51a0ff;if(!this[_0x9ea903(0xb1)]||!this[_0x9ea903(0xd6)])return;this[_0x9ea903(0xd6)][_0x9ea903(0xc9)](_0x2bb197,{'command':_0x2e3f19,'details':_0x36b01d});}['success'](_0x283ca0,_0x54c2c2,_0x2c1108,_0x2f81ed){const _0x1a9fd4=a58_0x51a0ff;if(!this[_0x1a9fd4(0xb1)]||!this[_0x1a9fd4(0xd6)])return;this[_0x1a9fd4(0xd6)][_0x1a9fd4(0xbc)](_0x1a9fd4(0xc9),_0x54c2c2,{'level':_0x1a9fd4(0xc6),'command':_0x283ca0,'duration':_0x2c1108,'details':_0x2f81ed});}[a58_0x51a0ff(0xc7)](_0x8a0c62,_0x4f16de,_0x38689f){const _0x14a0a4=a58_0x51a0ff;if(!this['logFilePath']||!this[_0x14a0a4(0xd6)])return;this[_0x14a0a4(0xd6)][_0x14a0a4(0xc7)](_0x4f16de,{'command':_0x8a0c62,'details':_0x38689f});}[a58_0x51a0ff(0xdd)](_0x2769a0,_0x13c0c8,_0x1226c6){const _0x3e3c2b=a58_0x51a0ff;if(!this[_0x3e3c2b(0xb1)]||!this[_0x3e3c2b(0xd6)])return;this['winstonLogger'][_0x3e3c2b(0xdd)](_0x13c0c8,{'command':_0x2769a0,'details':_0x1226c6});}async[a58_0x51a0ff(0xae)](_0x32e76d,_0x5aa709,_0x187be4){const _0x1be019=a58_0x51a0ff,_0x496479=Date[_0x1be019(0xd9)]();this[_0x1be019(0xc9)](_0x32e76d,_0x1be019(0xbb)+_0x5aa709);try{const _0x43c931=await _0x187be4(),_0x5047a0=Date['now']()-_0x496479;return this[_0x1be019(0xc6)](_0x32e76d,_0x1be019(0xbe)+_0x5aa709,_0x5047a0),_0x43c931;}catch(_0x3a0c6c){const _0x30b4e2=Date[_0x1be019(0xd9)]()-_0x496479;this[_0x1be019(0xc7)](_0x32e76d,'失败:\x20'+_0x5aa709,{'error':_0x3a0c6c instanceof Error?_0x3a0c6c[_0x1be019(0xb3)]:String(_0x3a0c6c),'duration':_0x30b4e2});throw _0x3a0c6c;}}[a58_0x51a0ff(0xd1)](){const _0x56e526=a58_0x51a0ff;try{if(!a58_0x2ba5f2[_0x56e526(0xa7)](this[_0x56e526(0xb1)]))return[];const _0x34dc81=a58_0x2ba5f2[_0x56e526(0xcb)](this['logFilePath'],_0x56e526(0xb7));return _0x34dc81['split']('\x0a')[_0x56e526(0xcd)](_0x1a5548=>_0x1a5548[_0x56e526(0xd5)]())[_0x56e526(0xd8)](_0x4e1cfc=>JSON[_0x56e526(0xaa)](_0x4e1cfc));}catch(_0x286211){return console[_0x56e526(0xdd)](_0x56e526(0xb9),_0x286211),[];}}[a58_0x51a0ff(0xaf)](){const _0x9695b1=a58_0x51a0ff;try{a58_0x2ba5f2[_0x9695b1(0xa7)](this[_0x9695b1(0xb1)])&&a58_0x2ba5f2[_0x9695b1(0xbd)](this[_0x9695b1(0xb1)],'',_0x9695b1(0xb7));}catch(_0x2a5488){console[_0x9695b1(0xdd)](_0x9695b1(0xb4),_0x2a5488);}}['getWinstonInstance'](){return this['winstonLogger'];}}export const logger=new Logger();
@@ -1 +1 @@
1
- const a59_0x41f042=a59_0x9b4e;(function(_0x5fc06a,_0x500537){const _0x420abb=a59_0x9b4e,_0x4ef3e0=_0x5fc06a();while(!![]){try{const _0x5d14d6=-parseInt(_0x420abb(0x1a4))/0x1+parseInt(_0x420abb(0x1c8))/0x2*(parseInt(_0x420abb(0x1c4))/0x3)+parseInt(_0x420abb(0x1bc))/0x4+parseInt(_0x420abb(0x1b6))/0x5*(-parseInt(_0x420abb(0x1b2))/0x6)+parseInt(_0x420abb(0x1aa))/0x7*(-parseInt(_0x420abb(0x1a9))/0x8)+parseInt(_0x420abb(0x1ac))/0x9*(parseInt(_0x420abb(0x1b4))/0xa)+-parseInt(_0x420abb(0x1ad))/0xb*(-parseInt(_0x420abb(0x1a5))/0xc);if(_0x5d14d6===_0x500537)break;else _0x4ef3e0['push'](_0x4ef3e0['shift']());}catch(_0x4e525c){_0x4ef3e0['push'](_0x4ef3e0['shift']());}}}(a59_0x453f,0x28c88));function a59_0x9b4e(_0x3694bf,_0x3dcd30){_0x3694bf=_0x3694bf-0x19e;const _0x453f41=a59_0x453f();let _0x9b4e15=_0x453f41[_0x3694bf];return _0x9b4e15;}import a59_0x28bed2 from'node:fs';function a59_0x453f(){const _0x4bba51=['index.tsx','path:\x20\x22','toComponentName','charAt','indexOf','146888QyZSnr','3852aGNTlP','utf8','promises','开始更新路由配置','344VgehxI','2863QpYPDj','readFile','10305uNodsM','1804KxyuZE','lastIndexOf','map','router','import\x20','6kTIHxb','includes','2330THgERO','existsSync','529145wAXgfN','match','routerFilePath','addPageRoute','info','addRoute','414212wIrdJt','\x20from\x20\x22../pages/','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','路由文件不存在:\x20','length','slice','split','join','6fByYXK','index','error','previewChanges','14370ZQMbpm','未找到路由配置的\x20children\x20数组','now','addImport'];a59_0x453f=function(){return _0x4bba51;};return a59_0x453f();}import a59_0x58b2c7 from'node:path';import{logger}from'./logger.js';export class RouterUpdater{[a59_0x41f042(0x1b8)];constructor(_0x437c42){const _0x3c49e8=a59_0x41f042;this[_0x3c49e8(0x1b8)]=a59_0x58b2c7['join'](_0x437c42,'src','router',_0x3c49e8(0x19f));}async[a59_0x41f042(0x1b9)](_0x2e49cb,_0x17167c){const _0x21d59a=a59_0x41f042;if(!a59_0x28bed2[_0x21d59a(0x1b5)](this[_0x21d59a(0x1b8)]))throw new Error('路由文件不存在:\x20'+this[_0x21d59a(0x1b8)]);const _0x1dfd7f=Date[_0x21d59a(0x1ca)]();logger[_0x21d59a(0x1ba)](_0x21d59a(0x1b0),_0x21d59a(0x1a8),{'pageName':_0x2e49cb,'routePath':_0x17167c,'file':this[_0x21d59a(0x1b8)]});try{const _0x343a81=await a59_0x28bed2[_0x21d59a(0x1a7)][_0x21d59a(0x1ab)](this[_0x21d59a(0x1b8)],_0x21d59a(0x1a6)),_0x59a424=this[_0x21d59a(0x1a1)](_0x2e49cb),_0x31d6b4=this[_0x21d59a(0x19e)](_0x343a81,_0x59a424,_0x2e49cb),_0x1a6290=this[_0x21d59a(0x1bb)](_0x31d6b4,_0x17167c,_0x59a424);await a59_0x28bed2[_0x21d59a(0x1a7)]['writeFile'](this[_0x21d59a(0x1b8)],_0x1a6290,_0x21d59a(0x1a6));const _0xc89b1e=Date[_0x21d59a(0x1ca)]()-_0x1dfd7f;logger['success'](_0x21d59a(0x1b0),'路由配置更新完成',_0xc89b1e,{'pageName':_0x2e49cb,'routePath':_0x17167c,'componentName':_0x59a424});}catch(_0x419a76){const _0x1ebb63=Date['now']()-_0x1dfd7f;logger[_0x21d59a(0x1c6)](_0x21d59a(0x1b0),'路由配置更新失败',{'pageName':_0x2e49cb,'routePath':_0x17167c,'error':_0x419a76 instanceof Error?_0x419a76['message']:String(_0x419a76),'duration':_0x1ebb63});throw _0x419a76;}}[a59_0x41f042(0x1a1)](_0x4c22cd){const _0x366f26=a59_0x41f042;return _0x4c22cd[_0x366f26(0x1c2)]('-')[_0x366f26(0x1af)](_0x5af8a6=>_0x5af8a6[_0x366f26(0x1a2)](0x0)['toUpperCase']()+_0x5af8a6[_0x366f26(0x1c1)](0x1)['toLowerCase']())[_0x366f26(0x1c3)]('');}[a59_0x41f042(0x19e)](_0x183622,_0x3370df,_0xf8dd9e){const _0x400391=a59_0x41f042,_0x538360=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x3f9419=_0x183622['match'](_0x538360)||[],_0x5bf19a=_0x400391(0x1b1)+_0x3370df+_0x400391(0x1bd)+_0xf8dd9e+'\x22;';if(_0x183622['includes'](_0x5bf19a))return _0x183622;if(_0x3f9419[_0x400391(0x1c0)]>0x0){const _0x4c2361=_0x3f9419[_0x3f9419[_0x400391(0x1c0)]-0x1];if(_0x4c2361){const _0xa94818=_0x183622['lastIndexOf'](_0x4c2361),_0x35302a=_0xa94818+_0x4c2361[_0x400391(0x1c0)];return _0x183622[_0x400391(0x1c1)](0x0,_0x35302a)+_0x5bf19a+'\x0a'+_0x183622['slice'](_0x35302a);}}const _0x50779b=_0x183622[_0x400391(0x1b7)](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x50779b&&_0x50779b[_0x400391(0x1c5)]!==undefined){const _0x27c17f=_0x50779b['index']+_0x50779b[0x0][_0x400391(0x1c0)];return _0x183622['slice'](0x0,_0x27c17f)+_0x5bf19a+'\x0a'+_0x183622[_0x400391(0x1c1)](_0x27c17f);}return _0x183622;}['addRoute'](_0x4191fe,_0x299d1e,_0x3871ed){const _0x279dda=a59_0x41f042,_0x1b45e6='\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22'+_0x299d1e+_0x279dda(0x1be)+_0x3871ed+'\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},';if(_0x4191fe[_0x279dda(0x1b3)](_0x279dda(0x1a0)+_0x299d1e+'\x22'))return _0x4191fe;const _0x54edb8=/children:\s*\[([\s\S]*?)\]/,_0x157e60=_0x4191fe[_0x279dda(0x1b7)](_0x54edb8);if(!_0x157e60||_0x157e60[_0x279dda(0x1c5)]===undefined)throw new Error(_0x279dda(0x1c9));const _0x31d323=_0x157e60[0x1],_0x5a8643=_0x157e60['index']+_0x157e60[0x0][_0x279dda(0x1a3)]('[')+0x1,_0x12a4e8=_0x31d323?.[_0x279dda(0x1b7)](/\{[\s\S]*?\},/g)||[];if(_0x12a4e8[_0x279dda(0x1c0)]>0x0){const _0x956e27=_0x12a4e8[_0x12a4e8[_0x279dda(0x1c0)]-0x1];if(_0x956e27){const _0x3da0cd=_0x4191fe[_0x279dda(0x1ae)](_0x956e27),_0x15e307=_0x3da0cd+_0x956e27[_0x279dda(0x1c0)];return _0x4191fe[_0x279dda(0x1c1)](0x0,_0x15e307)+'\x0a'+_0x1b45e6+_0x4191fe[_0x279dda(0x1c1)](_0x15e307);}}return _0x4191fe['slice'](0x0,_0x5a8643)+'\x0a'+_0x1b45e6+_0x4191fe['slice'](_0x5a8643);}async[a59_0x41f042(0x1c7)](_0xd40fa9,_0x4b210d){const _0x5edeba=a59_0x41f042;if(!a59_0x28bed2['existsSync'](this[_0x5edeba(0x1b8)]))throw new Error(_0x5edeba(0x1bf)+this[_0x5edeba(0x1b8)]);const _0x1ad5e0=await a59_0x28bed2[_0x5edeba(0x1a7)][_0x5edeba(0x1ab)](this['routerFilePath'],_0x5edeba(0x1a6)),_0x3e0e14=this[_0x5edeba(0x1a1)](_0xd40fa9);let _0x5df666=this[_0x5edeba(0x19e)](_0x1ad5e0,_0x3e0e14,_0xd40fa9);return _0x5df666=this['addRoute'](_0x5df666,_0x4b210d,_0x3e0e14),_0x5df666;}}
1
+ const a59_0x4eaa72=a59_0x4f39;(function(_0x10b5b6,_0x3cb5b1){const _0x1c778f=a59_0x4f39,_0x4826d2=_0x10b5b6();while(!![]){try{const _0x44313f=parseInt(_0x1c778f(0x131))/0x1*(-parseInt(_0x1c778f(0x111))/0x2)+-parseInt(_0x1c778f(0x134))/0x3*(-parseInt(_0x1c778f(0x12b))/0x4)+parseInt(_0x1c778f(0x11c))/0x5*(parseInt(_0x1c778f(0x108))/0x6)+parseInt(_0x1c778f(0x123))/0x7*(parseInt(_0x1c778f(0x11d))/0x8)+parseInt(_0x1c778f(0x10a))/0x9+-parseInt(_0x1c778f(0x10c))/0xa+-parseInt(_0x1c778f(0x12c))/0xb*(parseInt(_0x1c778f(0x118))/0xc);if(_0x44313f===_0x3cb5b1)break;else _0x4826d2['push'](_0x4826d2['shift']());}catch(_0x1305a1){_0x4826d2['push'](_0x4826d2['shift']());}}}(a59_0x3faf,0x88eba));import a59_0x1b1004 from'node:fs';function a59_0x3faf(){const _0x57020a=['4658950ieXtaw','\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},','charAt','toLowerCase','split','790882XFleIj','info','indexOf','previewChanges','error','readFile','路由配置更新完成','34717008RkOuqr','existsSync','import\x20','路由配置更新失败','1525fGiTBQ','8917624jEEMmg','promises','\x20from\x20\x22../pages/','path:\x20\x22','writeFile','\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22','7NFLEeY','success','未找到路由配置的\x20children\x20数组','router','lastIndexOf','message','now','slice','24576TPZbIx','11rKNcka','map','addRoute','match','src','1qOXyWd','addPageRoute','index','492hnCOTc','routerFilePath','toComponentName','join','addImport','路由文件不存在:\x20','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','index.tsx','21462NDQpvj','length','9917478mFgEOx','utf8'];a59_0x3faf=function(){return _0x57020a;};return a59_0x3faf();}function a59_0x4f39(_0x5aeab8,_0x4452f2){_0x5aeab8=_0x5aeab8-0x105;const _0x3faff3=a59_0x3faf();let _0x4f39a3=_0x3faff3[_0x5aeab8];return _0x4f39a3;}import a59_0x7bc5af from'node:path';import{logger}from'./logger.js';export class RouterUpdater{[a59_0x4eaa72(0x135)];constructor(_0x5ba225){const _0x52eeb1=a59_0x4eaa72;this['routerFilePath']=a59_0x7bc5af[_0x52eeb1(0x137)](_0x5ba225,_0x52eeb1(0x130),_0x52eeb1(0x126),_0x52eeb1(0x107));}async[a59_0x4eaa72(0x132)](_0x51ea4e,_0x47213d){const _0x3c2d76=a59_0x4eaa72;if(!a59_0x1b1004[_0x3c2d76(0x119)](this[_0x3c2d76(0x135)]))throw new Error(_0x3c2d76(0x105)+this[_0x3c2d76(0x135)]);const _0x510a7c=Date['now']();logger[_0x3c2d76(0x112)](_0x3c2d76(0x126),'开始更新路由配置',{'pageName':_0x51ea4e,'routePath':_0x47213d,'file':this[_0x3c2d76(0x135)]});try{const _0x1eba44=await a59_0x1b1004['promises'][_0x3c2d76(0x116)](this[_0x3c2d76(0x135)],_0x3c2d76(0x10b)),_0x38b478=this['toComponentName'](_0x51ea4e),_0x1b68b8=this[_0x3c2d76(0x138)](_0x1eba44,_0x38b478,_0x51ea4e),_0x335249=this[_0x3c2d76(0x12e)](_0x1b68b8,_0x47213d,_0x38b478);await a59_0x1b1004[_0x3c2d76(0x11e)][_0x3c2d76(0x121)](this[_0x3c2d76(0x135)],_0x335249,'utf8');const _0x2e4fa2=Date[_0x3c2d76(0x129)]()-_0x510a7c;logger[_0x3c2d76(0x124)](_0x3c2d76(0x126),_0x3c2d76(0x117),_0x2e4fa2,{'pageName':_0x51ea4e,'routePath':_0x47213d,'componentName':_0x38b478});}catch(_0x5e4361){const _0x994ad8=Date['now']()-_0x510a7c;logger[_0x3c2d76(0x115)](_0x3c2d76(0x126),_0x3c2d76(0x11b),{'pageName':_0x51ea4e,'routePath':_0x47213d,'error':_0x5e4361 instanceof Error?_0x5e4361[_0x3c2d76(0x128)]:String(_0x5e4361),'duration':_0x994ad8});throw _0x5e4361;}}[a59_0x4eaa72(0x136)](_0x5a0687){const _0x524d6b=a59_0x4eaa72;return _0x5a0687[_0x524d6b(0x110)]('-')[_0x524d6b(0x12d)](_0x4ada2a=>_0x4ada2a[_0x524d6b(0x10e)](0x0)['toUpperCase']()+_0x4ada2a[_0x524d6b(0x12a)](0x1)[_0x524d6b(0x10f)]())['join']('');}[a59_0x4eaa72(0x138)](_0x18f245,_0x43ece7,_0x234455){const _0x3d2329=a59_0x4eaa72,_0x464ee0=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x14d525=_0x18f245[_0x3d2329(0x12f)](_0x464ee0)||[],_0x4c18f9=_0x3d2329(0x11a)+_0x43ece7+_0x3d2329(0x11f)+_0x234455+'\x22;';if(_0x18f245['includes'](_0x4c18f9))return _0x18f245;if(_0x14d525[_0x3d2329(0x109)]>0x0){const _0x291d47=_0x14d525[_0x14d525[_0x3d2329(0x109)]-0x1];if(_0x291d47){const _0x36a729=_0x18f245[_0x3d2329(0x127)](_0x291d47),_0x1170be=_0x36a729+_0x291d47[_0x3d2329(0x109)];return _0x18f245['slice'](0x0,_0x1170be)+_0x4c18f9+'\x0a'+_0x18f245[_0x3d2329(0x12a)](_0x1170be);}}const _0x55e386=_0x18f245[_0x3d2329(0x12f)](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x55e386&&_0x55e386[_0x3d2329(0x133)]!==undefined){const _0x33bc46=_0x55e386[_0x3d2329(0x133)]+_0x55e386[0x0][_0x3d2329(0x109)];return _0x18f245[_0x3d2329(0x12a)](0x0,_0x33bc46)+_0x4c18f9+'\x0a'+_0x18f245[_0x3d2329(0x12a)](_0x33bc46);}return _0x18f245;}[a59_0x4eaa72(0x12e)](_0x35f63e,_0x332b25,_0x49b46a){const _0x4c8642=a59_0x4eaa72,_0x37da2d=_0x4c8642(0x122)+_0x332b25+_0x4c8642(0x106)+_0x49b46a+_0x4c8642(0x10d);if(_0x35f63e['includes'](_0x4c8642(0x120)+_0x332b25+'\x22'))return _0x35f63e;const _0x12c26a=/children:\s*\[([\s\S]*?)\]/,_0x5d1e04=_0x35f63e[_0x4c8642(0x12f)](_0x12c26a);if(!_0x5d1e04||_0x5d1e04[_0x4c8642(0x133)]===undefined)throw new Error(_0x4c8642(0x125));const _0x27e26c=_0x5d1e04[0x1],_0x4889c9=_0x5d1e04[_0x4c8642(0x133)]+_0x5d1e04[0x0][_0x4c8642(0x113)]('[')+0x1,_0x3d6575=_0x27e26c?.[_0x4c8642(0x12f)](/\{[\s\S]*?\},/g)||[];if(_0x3d6575['length']>0x0){const _0x294bb5=_0x3d6575[_0x3d6575['length']-0x1];if(_0x294bb5){const _0x13546b=_0x35f63e['lastIndexOf'](_0x294bb5),_0x33707a=_0x13546b+_0x294bb5[_0x4c8642(0x109)];return _0x35f63e[_0x4c8642(0x12a)](0x0,_0x33707a)+'\x0a'+_0x37da2d+_0x35f63e['slice'](_0x33707a);}}return _0x35f63e[_0x4c8642(0x12a)](0x0,_0x4889c9)+'\x0a'+_0x37da2d+_0x35f63e[_0x4c8642(0x12a)](_0x4889c9);}async[a59_0x4eaa72(0x114)](_0x41710d,_0x1b9c59){const _0x4f0f13=a59_0x4eaa72;if(!a59_0x1b1004[_0x4f0f13(0x119)](this[_0x4f0f13(0x135)]))throw new Error(_0x4f0f13(0x105)+this[_0x4f0f13(0x135)]);const _0x349a70=await a59_0x1b1004[_0x4f0f13(0x11e)]['readFile'](this[_0x4f0f13(0x135)],'utf8'),_0x53e2dc=this[_0x4f0f13(0x136)](_0x41710d);let _0xb0a517=this['addImport'](_0x349a70,_0x53e2dc,_0x41710d);return _0xb0a517=this['addRoute'](_0xb0a517,_0x1b9c59,_0x53e2dc),_0xb0a517;}}
@@ -1 +1 @@
1
- export function sleep(_0x4e0c91){return new Promise(_0x56f103=>setTimeout(_0x56f103,_0x4e0c91));}
1
+ export function sleep(_0x5833bf){return new Promise(_0x1da612=>setTimeout(_0x1da612,_0x5833bf));}
@@ -1 +1 @@
1
- const a61_0x4ec784=a61_0x4b0b;(function(_0x4510b9,_0x15adc2){const _0x51e0d1=a61_0x4b0b,_0x1bcaa8=_0x4510b9();while(!![]){try{const _0x3f3544=parseInt(_0x51e0d1(0x1fc))/0x1*(-parseInt(_0x51e0d1(0x1cc))/0x2)+parseInt(_0x51e0d1(0x1f4))/0x3+-parseInt(_0x51e0d1(0x1ef))/0x4+parseInt(_0x51e0d1(0x1ec))/0x5*(parseInt(_0x51e0d1(0x202))/0x6)+parseInt(_0x51e0d1(0x1d6))/0x7+parseInt(_0x51e0d1(0x205))/0x8*(-parseInt(_0x51e0d1(0x1f3))/0x9)+-parseInt(_0x51e0d1(0x1ed))/0xa*(-parseInt(_0x51e0d1(0x1d1))/0xb);if(_0x3f3544===_0x15adc2)break;else _0x1bcaa8['push'](_0x1bcaa8['shift']());}catch(_0x4e7758){_0x1bcaa8['push'](_0x1bcaa8['shift']());}}}(a61_0x6a65,0xa6dbc));import a61_0x3a1d2f from'node:fs';function a61_0x4b0b(_0x507da3,_0x47fa97){_0x507da3=_0x507da3-0x1cc;const _0x6a6532=a61_0x6a65();let _0x4b0b66=_0x6a6532[_0x507da3];return _0x4b0b66;}import a61_0x423fc8 from'node:path';function a61_0x6a65(){const _0x250f19=['endsWith','now','toLocaleDateString','error','mkdir','.ts','.jsx','numeric','map','pop','.tpl','extname','开始处理模板内容替换','replaceContent','join','toComponentName','processDirectory','promises','2646305BZBUvb','570ljDlEw','.scss','518284mfHfUh','.js','template','isFile','203382SzwYKi','2689521usEUTG','utf8','.tsx','api','toDisplayTitle','message','info','charAt','490558oYXFLk','readdir','toLowerCase','replace','processTemplate','toISOString','6dYxLXM','.json','processFile','80lEjQMP','4cKGBRw','stringify','2-digit','name','slice','12419OCbxwR','copyFile','replaceApiContent','readFile','isDirectory','3709986OkXoWd','split','includes','toUpperCase'];a61_0x6a65=function(){return _0x250f19;};return a61_0x6a65();}import{logger}from'./logger.js';export class TemplateReplacer{static[a61_0x4ec784(0x1e9)](_0x596544){const _0x92a19a=a61_0x4ec784,_0x24fded=_0x596544[_0x92a19a(0x1d7)]('/')['pop']()||_0x596544;return _0x24fded['split']('-')[_0x92a19a(0x1e2)](_0x5b5a65=>_0x5b5a65[_0x92a19a(0x1fb)](0x0)[_0x92a19a(0x1d9)]()+_0x5b5a65['slice'](0x1)[_0x92a19a(0x1fe)]())[_0x92a19a(0x1e8)]('');}static['toDisplayTitle'](_0x2431bc){const _0x16b32e=a61_0x4ec784,_0x2ed14e=_0x2431bc[_0x16b32e(0x1d7)]('/')[_0x16b32e(0x1e3)]()||_0x2431bc;return _0x2ed14e[_0x16b32e(0x1d7)]('-')[_0x16b32e(0x1e2)](_0x2d700f=>_0x2d700f['charAt'](0x0)[_0x16b32e(0x1d9)]()+_0x2d700f[_0x16b32e(0x1d0)](0x1)['toLowerCase']())['join']('\x20');}static[a61_0x4ec784(0x1e7)](_0x140777,_0x2f73d8,_0x54bdb8){const _0x2e7b76=a61_0x4ec784,_0x4cc83a=this['toComponentName'](_0x2f73d8),_0x44d40e=this[_0x2e7b76(0x1f8)](_0x2f73d8),_0x5ac308=new Date(),_0x312e0c=_0x5ac308['toLocaleString'](undefined,{'year':_0x2e7b76(0x1e1),'month':'2-digit','day':'2-digit','hour':_0x2e7b76(0x1ce),'minute':_0x2e7b76(0x1ce),'second':_0x2e7b76(0x1ce),'hour12':![]})['replace'](/\//g,'-'),_0x365cca=_0x5ac308[_0x2e7b76(0x1dc)](undefined,{'year':_0x2e7b76(0x1e1),'month':_0x2e7b76(0x1ce),'day':_0x2e7b76(0x1ce)})[_0x2e7b76(0x1ff)](/\//g,'-'),_0x397f2b=_0x5ac308['toLocaleTimeString'](undefined,{'hour12':![]});let _0x41f245=_0x140777[_0x2e7b76(0x1ff)](/\{ComponentName\}/g,_0x4cc83a)[_0x2e7b76(0x1ff)](/\{DisplayTitle\}/g,_0x44d40e)[_0x2e7b76(0x1ff)](/\{PageName\}/g,_0x2f73d8)[_0x2e7b76(0x1ff)](/\{TemplateName\}/g,_0x54bdb8)['replace'](/\{CreatedAt\}/g,_0x312e0c)['replace'](/\{CreatedDate\}/g,_0x365cca)[_0x2e7b76(0x1ff)](/\{CreatedTime\}/g,_0x397f2b);return _0x41f245;}static[a61_0x4ec784(0x1d3)](_0x5b2a0a,_0x323a08,_0x243c7a,_0xa7046,_0x5c6411,_0x4d03c2,_0x59cb6d){const _0x24c247=a61_0x4ec784,_0x1b7398=new Date(),_0x5c439d=_0x1b7398[_0x24c247(0x201)](),_0x8671c0=JSON[_0x24c247(0x1cd)](_0x243c7a,null,0x2)[_0x24c247(0x1d7)]('\x0a')[_0x24c247(0x1d0)](0x1,-0x1)['map'](_0x50b290=>_0x50b290[_0x24c247(0x1ff)](/^ /,'\x20\x20\x20\x20'))['join']('\x0a'),_0xe6a53a=_0xa7046||Object['keys'](_0x243c7a)[0x0]||'YourModel';let _0xb330f6=_0x5b2a0a['replace'](/\{AppCode\}/g,_0x323a08)['replace'](/\{ModelConfigs\}/g,_0x8671c0)['replace'](/\{ExampleModelName\}/g,_0xe6a53a)[_0x24c247(0x1ff)](/\{ApiFileName\}/g,_0x5c6411||_0x24c247(0x1f7))[_0x24c247(0x1ff)](/\{ConfigName\}/g,_0x4d03c2||'default')['replace'](/\{ClientConfigParam\}/g,_0x59cb6d||'')[_0x24c247(0x1ff)](/\{CreatedAt\}/g,_0x5c439d);return _0xb330f6;}static async[a61_0x4ec784(0x200)](_0x3f2138,_0x35be8c,_0x1458b4,_0x533cca,_0xfc1d46=!![]){const _0x4c1d0c=a61_0x4ec784,_0x4442a5=Date[_0x4c1d0c(0x1db)]();try{_0xfc1d46&&logger[_0x4c1d0c(0x1fa)]('template',_0x4c1d0c(0x1e6),{'templatePath':_0x3f2138,'targetPath':_0x35be8c,'pageName':_0x1458b4,'templateName':_0x533cca});await a61_0x3a1d2f[_0x4c1d0c(0x1eb)][_0x4c1d0c(0x1de)](_0x35be8c,{'recursive':!![]}),await this[_0x4c1d0c(0x1ea)](_0x3f2138,_0x35be8c,_0x1458b4,_0x533cca);if(_0xfc1d46){const _0x7e91b5=Date[_0x4c1d0c(0x1db)]()-_0x4442a5;logger['success'](_0x4c1d0c(0x1f1),'模板内容替换完成',_0x7e91b5,{'pageName':_0x1458b4,'templateName':_0x533cca});}}catch(_0x57ff9a){if(_0xfc1d46){const _0x16ef3f=Date[_0x4c1d0c(0x1db)]()-_0x4442a5;logger[_0x4c1d0c(0x1dd)](_0x4c1d0c(0x1f1),'模板内容替换失败',{'templatePath':_0x3f2138,'targetPath':_0x35be8c,'pageName':_0x1458b4,'templateName':_0x533cca,'error':_0x57ff9a instanceof Error?_0x57ff9a[_0x4c1d0c(0x1f9)]:String(_0x57ff9a),'duration':_0x16ef3f});}throw _0x57ff9a;}}static async[a61_0x4ec784(0x1ea)](_0x55945c,_0x17fa40,_0x56923a,_0xda387c){const _0x50edb5=a61_0x4ec784,_0x42de76=await a61_0x3a1d2f[_0x50edb5(0x1eb)][_0x50edb5(0x1fd)](_0x55945c,{'withFileTypes':!![]});for(const _0x3552a6 of _0x42de76){const _0x578527=a61_0x423fc8[_0x50edb5(0x1e8)](_0x55945c,_0x3552a6[_0x50edb5(0x1cf)]);let _0x136381=a61_0x423fc8[_0x50edb5(0x1e8)](_0x17fa40,_0x3552a6[_0x50edb5(0x1cf)]);_0x3552a6['name'][_0x50edb5(0x1da)](_0x50edb5(0x1e4))&&(_0x136381=a61_0x423fc8[_0x50edb5(0x1e8)](_0x17fa40,_0x3552a6[_0x50edb5(0x1cf)][_0x50edb5(0x1ff)](/\.tpl$/,'')));if(_0x3552a6[_0x50edb5(0x1d5)]())await a61_0x3a1d2f[_0x50edb5(0x1eb)]['mkdir'](_0x136381,{'recursive':!![]}),await this[_0x50edb5(0x1ea)](_0x578527,_0x136381,_0x56923a,_0xda387c);else _0x3552a6[_0x50edb5(0x1f2)]()&&await this[_0x50edb5(0x204)](_0x578527,_0x136381,_0x56923a,_0xda387c);}}static async['processFile'](_0x3b9bc8,_0x3849e0,_0xecdd0f,_0x5105fa){const _0x45626d=a61_0x4ec784,_0xb3f945=a61_0x423fc8[_0x45626d(0x1e5)](_0x3b9bc8)[_0x45626d(0x1fe)]();_0x3b9bc8[_0x45626d(0x1da)](_0x45626d(0x1e4))&&(_0x3849e0=_0x3849e0[_0x45626d(0x1ff)](/\.tpl$/,''));const _0x5edeed=[_0x45626d(0x1f6),_0x45626d(0x1df),_0x45626d(0x1e0),_0x45626d(0x1f0),_0x45626d(0x203),'.md','.css',_0x45626d(0x1ee),_0x45626d(0x1e4)];if(_0x5edeed[_0x45626d(0x1d8)](_0xb3f945)||_0x3b9bc8[_0x45626d(0x1da)](_0x45626d(0x1e4))){const _0x18972a=await a61_0x3a1d2f[_0x45626d(0x1eb)][_0x45626d(0x1d4)](_0x3b9bc8,_0x45626d(0x1f5)),_0x1bba86=this[_0x45626d(0x1e7)](_0x18972a,_0xecdd0f,_0x5105fa);await a61_0x3a1d2f[_0x45626d(0x1eb)]['writeFile'](_0x3849e0,_0x1bba86,'utf8');}else await a61_0x3a1d2f[_0x45626d(0x1eb)][_0x45626d(0x1d2)](_0x3b9bc8,_0x3849e0);}}
1
+ const a61_0x3f88ec=a61_0x15e0;(function(_0x446378,_0x517609){const _0xa1375=a61_0x15e0,_0x2d0df3=_0x446378();while(!![]){try{const _0x269f00=-parseInt(_0xa1375(0x12c))/0x1+-parseInt(_0xa1375(0x149))/0x2+parseInt(_0xa1375(0x144))/0x3+-parseInt(_0xa1375(0x135))/0x4+-parseInt(_0xa1375(0x156))/0x5+parseInt(_0xa1375(0x169))/0x6*(-parseInt(_0xa1375(0x14f))/0x7)+parseInt(_0xa1375(0x13c))/0x8;if(_0x269f00===_0x517609)break;else _0x2d0df3['push'](_0x2d0df3['shift']());}catch(_0x2917f8){_0x2d0df3['push'](_0x2d0df3['shift']());}}}(a61_0x3f8a,0x95b4f));function a61_0x15e0(_0x123da7,_0x51a41b){_0x123da7=_0x123da7-0x129;const _0x3f8a84=a61_0x3f8a();let _0x15e09e=_0x3f8a84[_0x123da7];return _0x15e09e;}import a61_0x236b12 from'node:fs';import a61_0x1d9dcd from'node:path';import{logger}from'./logger.js';function a61_0x3f8a(){const _0x5b91a3=['.ts','datasetCode:\x20\x22','toUpperCase','extname','2271195rrufEN','toDisplayTitle','api','split','2-digit','name','now','.js','copyFile','slice','template','.jsx','processDirectory','.css','endsWith','push','tableName','mkdir','.tpl','30BxrbCb','\x0a\x20\x20\x20\x20{\x20','toComponentName','info','.md','1057223lvsnTQ','.json','map','toLowerCase','alias','readFile','readdir','toISOString','utf8','505492WLtHwN','replaceContent','pop','isFile','charAt','default','toLocaleTimeString','22724256iYAFFf','includes','writeFile','toLocaleDateString','name:\x20\x22','YourModel','promises','replace','3655326eKwtCv','alias:\x20\x22','模板内容替换完成','processTemplate','numeric','2440250mjdnZH','isDirectory','tableName:\x20\x22','replaceApiContent','\x20},','message','822941siniHl','join','.scss'];a61_0x3f8a=function(){return _0x5b91a3;};return a61_0x3f8a();}export class TemplateReplacer{static[a61_0x3f88ec(0x129)](_0x20a093){const _0x3496ec=a61_0x3f88ec,_0x178099=_0x20a093[_0x3496ec(0x159)]('/')[_0x3496ec(0x137)]()||_0x20a093;return _0x178099[_0x3496ec(0x159)]('-')[_0x3496ec(0x12e)](_0x3ceebe=>_0x3ceebe[_0x3496ec(0x139)](0x0)[_0x3496ec(0x154)]()+_0x3ceebe['slice'](0x1)[_0x3496ec(0x12f)]())[_0x3496ec(0x150)]('');}static['toDisplayTitle'](_0x29ab1f){const _0x14041b=a61_0x3f88ec,_0x526c26=_0x29ab1f[_0x14041b(0x159)]('/')[_0x14041b(0x137)]()||_0x29ab1f;return _0x526c26[_0x14041b(0x159)]('-')[_0x14041b(0x12e)](_0x3c6d5b=>_0x3c6d5b[_0x14041b(0x139)](0x0)['toUpperCase']()+_0x3c6d5b[_0x14041b(0x15f)](0x1)[_0x14041b(0x12f)]())['join']('\x20');}static[a61_0x3f88ec(0x136)](_0x237b98,_0x1e6cf6,_0x5de7b1){const _0x593c7f=a61_0x3f88ec,_0x193084=this[_0x593c7f(0x129)](_0x1e6cf6),_0x37b6aa=this[_0x593c7f(0x157)](_0x1e6cf6),_0x30434d=new Date(),_0x2042a5=_0x30434d['toLocaleString'](undefined,{'year':_0x593c7f(0x148),'month':_0x593c7f(0x15a),'day':_0x593c7f(0x15a),'hour':_0x593c7f(0x15a),'minute':_0x593c7f(0x15a),'second':_0x593c7f(0x15a),'hour12':![]})[_0x593c7f(0x143)](/\//g,'-'),_0x1442cf=_0x30434d[_0x593c7f(0x13f)](undefined,{'year':_0x593c7f(0x148),'month':_0x593c7f(0x15a),'day':_0x593c7f(0x15a)})['replace'](/\//g,'-'),_0x1b18a0=_0x30434d[_0x593c7f(0x13b)](undefined,{'hour12':![]});let _0x5299d2=_0x237b98[_0x593c7f(0x143)](/\{ComponentName\}/g,_0x193084)['replace'](/\{DisplayTitle\}/g,_0x37b6aa)['replace'](/\{PageName\}/g,_0x1e6cf6)['replace'](/\{TemplateName\}/g,_0x5de7b1)[_0x593c7f(0x143)](/\{CreatedAt\}/g,_0x2042a5)[_0x593c7f(0x143)](/\{CreatedDate\}/g,_0x1442cf)[_0x593c7f(0x143)](/\{CreatedTime\}/g,_0x1b18a0);return _0x5299d2;}static[a61_0x3f88ec(0x14c)](_0x51fa68,_0x368528,_0x110031,_0x2b2b0e,_0x5af683,_0x54ab9b,_0x539924){const _0x1077c1=a61_0x3f88ec,_0x32b86d=new Date(),_0x17ec22=_0x32b86d[_0x1077c1(0x133)](),_0xa447c1=_0x110031[_0x1077c1(0x12e)](_0x1eaae8=>{const _0xcf0261=_0x1077c1,_0x344300=[_0xcf0261(0x153)+_0x1eaae8['datasetCode']+'\x22',_0xcf0261(0x14b)+_0x1eaae8[_0xcf0261(0x166)]+'\x22',_0xcf0261(0x140)+_0x1eaae8[_0xcf0261(0x15b)]+'\x22'];return _0x1eaae8[_0xcf0261(0x130)]&&_0x344300[_0xcf0261(0x165)](_0xcf0261(0x145)+_0x1eaae8[_0xcf0261(0x130)]+'\x22'),_0xcf0261(0x16a)+_0x344300['join'](',\x20')+_0xcf0261(0x14d);})[_0x1077c1(0x150)](''),_0x4eae98=_0x2b2b0e||_0x110031[0x0]?.[_0x1077c1(0x130)]||_0x1077c1(0x141);let _0x463c26=_0x51fa68[_0x1077c1(0x143)](/\{AppCode\}/g,_0x368528)[_0x1077c1(0x143)](/\{ModelConfigs\}/g,_0xa447c1)['replace'](/\{ExampleModelName\}/g,_0x4eae98)[_0x1077c1(0x143)](/\{ApiFileName\}/g,_0x5af683||_0x1077c1(0x158))[_0x1077c1(0x143)](/\{ConfigName\}/g,_0x54ab9b||_0x1077c1(0x13a))['replace'](/\{ClientConfigParam\}/g,_0x539924||'')[_0x1077c1(0x143)](/\{CreatedAt\}/g,_0x17ec22);return _0x463c26;}static async[a61_0x3f88ec(0x147)](_0x1d9db6,_0x22cd82,_0x773e14,_0x5b01f4,_0x175862=!![]){const _0x40dde6=a61_0x3f88ec,_0x5939f2=Date[_0x40dde6(0x15c)]();try{_0x175862&&logger[_0x40dde6(0x12a)](_0x40dde6(0x160),'开始处理模板内容替换',{'templatePath':_0x1d9db6,'targetPath':_0x22cd82,'pageName':_0x773e14,'templateName':_0x5b01f4});await a61_0x236b12['promises'][_0x40dde6(0x167)](_0x22cd82,{'recursive':!![]}),await this[_0x40dde6(0x162)](_0x1d9db6,_0x22cd82,_0x773e14,_0x5b01f4);if(_0x175862){const _0x1b569f=Date[_0x40dde6(0x15c)]()-_0x5939f2;logger['success'](_0x40dde6(0x160),_0x40dde6(0x146),_0x1b569f,{'pageName':_0x773e14,'templateName':_0x5b01f4});}}catch(_0x34d9fa){if(_0x175862){const _0x3b30c3=Date['now']()-_0x5939f2;logger['error']('template','模板内容替换失败',{'templatePath':_0x1d9db6,'targetPath':_0x22cd82,'pageName':_0x773e14,'templateName':_0x5b01f4,'error':_0x34d9fa instanceof Error?_0x34d9fa[_0x40dde6(0x14e)]:String(_0x34d9fa),'duration':_0x3b30c3});}throw _0x34d9fa;}}static async[a61_0x3f88ec(0x162)](_0x5f5247,_0x861e1e,_0x38bd1a,_0x5d5bfd){const _0x3e5778=a61_0x3f88ec,_0x3efc3c=await a61_0x236b12[_0x3e5778(0x142)][_0x3e5778(0x132)](_0x5f5247,{'withFileTypes':!![]});for(const _0x52db2a of _0x3efc3c){const _0xbc3917=a61_0x1d9dcd[_0x3e5778(0x150)](_0x5f5247,_0x52db2a[_0x3e5778(0x15b)]);let _0x1d2f5f=a61_0x1d9dcd[_0x3e5778(0x150)](_0x861e1e,_0x52db2a[_0x3e5778(0x15b)]);_0x52db2a[_0x3e5778(0x15b)][_0x3e5778(0x164)](_0x3e5778(0x168))&&(_0x1d2f5f=a61_0x1d9dcd[_0x3e5778(0x150)](_0x861e1e,_0x52db2a[_0x3e5778(0x15b)][_0x3e5778(0x143)](/\.tpl$/,'')));if(_0x52db2a[_0x3e5778(0x14a)]())await a61_0x236b12['promises'][_0x3e5778(0x167)](_0x1d2f5f,{'recursive':!![]}),await this['processDirectory'](_0xbc3917,_0x1d2f5f,_0x38bd1a,_0x5d5bfd);else _0x52db2a[_0x3e5778(0x138)]()&&await this['processFile'](_0xbc3917,_0x1d2f5f,_0x38bd1a,_0x5d5bfd);}}static async['processFile'](_0x18d1ac,_0x2c1ad5,_0x3e5998,_0x26fdb2){const _0x17a627=a61_0x3f88ec,_0x3de55a=a61_0x1d9dcd[_0x17a627(0x155)](_0x18d1ac)[_0x17a627(0x12f)]();_0x18d1ac[_0x17a627(0x164)](_0x17a627(0x168))&&(_0x2c1ad5=_0x2c1ad5['replace'](/\.tpl$/,''));const _0x29ec97=['.tsx',_0x17a627(0x152),_0x17a627(0x161),_0x17a627(0x15d),_0x17a627(0x12d),_0x17a627(0x12b),_0x17a627(0x163),_0x17a627(0x151),_0x17a627(0x168)];if(_0x29ec97[_0x17a627(0x13d)](_0x3de55a)||_0x18d1ac[_0x17a627(0x164)](_0x17a627(0x168))){const _0x80f78f=await a61_0x236b12[_0x17a627(0x142)][_0x17a627(0x131)](_0x18d1ac,_0x17a627(0x134)),_0x4b1a3a=this[_0x17a627(0x136)](_0x80f78f,_0x3e5998,_0x26fdb2);await a61_0x236b12['promises'][_0x17a627(0x13e)](_0x2c1ad5,_0x4b1a3a,'utf8');}else await a61_0x236b12[_0x17a627(0x142)][_0x17a627(0x15e)](_0x18d1ac,_0x2c1ad5);}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovrabet/cli",
3
- "version": "1.1.26",
3
+ "version": "1.2.1-beta.4",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "bin": {
6
6
  "lovrabet": "lib/cli.js"
@@ -44,12 +44,14 @@
44
44
  "meow": "^13.2.0",
45
45
  "prettier": "^3.6.2",
46
46
  "react": "^19.1.1",
47
+ "semver": "^7.7.3",
47
48
  "winston": "^3.17.0"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@types/listr": "^0.14.9",
51
52
  "@types/node": "^24.5.2",
52
53
  "@types/react": "^19.1.12",
54
+ "@types/semver": "^7.7.1",
53
55
  "@vitest/coverage-v8": "^3.2.4",
54
56
  "@vitest/ui": "^3.2.4",
55
57
  "c8": "^10.1.3",
@@ -12,11 +12,16 @@ export const LOVRABET_APP_CODE = "{AppCode}";
12
12
 
13
13
  /**
14
14
  * 项目的模型配置
15
- * 包含所有数据表的映射关系
15
+ * 使用数组格式,每个模型包含 datasetCode、tableName、name 和可选的 alias
16
+ *
17
+ * 访问方式:
18
+ * - 标准访问:client.models.dataset_[datasetCode]
19
+ * - 别名访问:client.models.[alias](如果配置了 alias)
16
20
  */
17
21
  export const LOVRABET_MODELS_CONFIG: ModelsConfig = {
18
22
  appCode: LOVRABET_APP_CODE,
19
- models: {{ModelConfigs}}
23
+ models: [{ModelConfigs}
24
+ ]
20
25
  } as const;
21
26
 
22
27
  /**
@@ -31,12 +36,12 @@ registerModels(LOVRABET_MODELS_CONFIG, {ConfigName});
31
36
  * // 开发环境配置
32
37
  * registerModels({
33
38
  * appCode: 'app-dev-123',
34
- * models: { ... }
39
+ * models: [...]
35
40
  * }, 'dev');
36
41
  *
37
42
  * // 其他项目配置
38
43
  * registerModels({
39
44
  * appCode: 'other-project',
40
- * models: { ... }
45
+ * models: [...]
41
46
  * }, 'project-b');
42
47
  */
@@ -83,23 +83,90 @@ const response = await client.models.<modelName>.getOne(<id>);
83
83
  if (response.success) { ... } // 错误!成功时只返回 data 内容
84
84
  ```
85
85
 
86
- ### 3. 数据模型操作
86
+ ### 3. SDK 调用注释规范(人类友好)
87
87
 
88
- **重要提示:强烈建议使用 `filter()` 而不是 `getList()`**
88
+ **重要**:每次调用 SDK 方法时,必须在代码前添加注释说明正在调用的数据集和数据表,便于代码阅读和维护。
89
89
 
90
- `filter()` 方法在 v1.1.22+ 已支持 **OpenAPI 和 WebAPI 两种模式**,强烈建议优先使用:
91
- - 更强大的查询能力(支持复杂条件、范围查询、模糊匹配)
92
- - 更好的性能(通过 `select` 参数只返回需要的字段)
93
- - 更简洁的返回结构(直接返回 `{ tableData, total }`)
90
+ ```typescript
91
+ // 正确:添加数据集和数据表注释
92
+ // 数据集: 项目成员 | 数据表: project_members
93
+ const members = await client.models.projectMembers.filter({
94
+ where: { status: { $eq: 'active' } },
95
+ });
96
+
97
+ // 数据集: 用户信息 | 数据表: users
98
+ const user = await client.models.users.getOne(userId);
99
+
100
+ // 错误:缺少注释,不清楚在操作什么数据
101
+ const members = await client.models.projectMembers.filter({ ... });
102
+ ```
103
+
104
+ **注释格式**:`// 数据集: <数据集名称> | 数据表: <表名>`
105
+
106
+ 无论使用标准方式(`dataset_xxx`)还是别名方式(`projectMembers`),都应添加此注释。
107
+
108
+ ### 3.1 模型访问方式与别名规范
109
+
110
+ **⚠️ SDK 版本要求**:
111
+ - `dataset_[code]` 标准模式和 alias 别名模式需要 `@lovrabet/sdk >= 1.2.0`
112
+ - 如果用户的 SDK 版本 < 1.2.0,只能使用 `createClient` 或 `registerModels` 中配置的 key
113
+ - **编写代码前,请先检查用户 `package.json` 中的 `@lovrabet/sdk` 版本**
114
+
115
+ SDK 支持两种模型访问方式(需 SDK >= 1.2.0):
116
+
117
+ **1. 标准方式(默认推荐)**:使用 `dataset_[完整datasetCode]` 格式,稳定可靠,无需额外配置。
118
+
119
+ **2. 别名方式**:使用用户在 `createClient` 或 `registerModels` 中配置的 alias。
120
+
121
+ **重要规则**:
122
+ - 如果用户代码中已配置自定义 alias,**必须使用用户定义的 alias**
123
+ - 不要假设 alias 是默认的 camelCase 表名,先检查用户的 SDK 初始化代码
124
+
125
+ ```typescript
126
+ // 方式1:在 createClient 时定义 alias
127
+ const client = createClient({
128
+ appCode: '<appcode>',
129
+ models: {
130
+ // 用户自定义 alias 为 'members',而非默认的 'projectMembers'
131
+ members: {
132
+ tableName: 'project_members',
133
+ datasetCode: '<dataset-code>',
134
+ },
135
+ },
136
+ });
137
+
138
+ // 方式2:通过 registerModels 动态注册 alias
139
+ client.registerModels({
140
+ tasks: {
141
+ tableName: 'project_tasks',
142
+ datasetCode: '<dataset-code>',
143
+ },
144
+ });
145
+
146
+ // 正确:使用用户定义的 alias
147
+ const result = await client.models.members.filter({...});
148
+ const tasks = await client.models.tasks.filter({...});
149
+
150
+ // 错误:使用默认 alias,但用户配置的是 'members'
151
+ const result = await client.models.projectMembers.filter({...});
152
+ ```
153
+
154
+ **编写代码前,请先检查用户的 `createClient` 和 `registerModels` 代码,确认使用的是用户定义的 alias。**
155
+
156
+ ### 4. 数据模型操作
157
+
158
+ #### 列表查询:使用 `filter()` 方法
159
+
160
+ `filter()` 方法支持 **OpenAPI 和 WebAPI 两种模式**:
161
+ - 强大的查询能力(支持复杂条件、范围查询、模糊匹配)
162
+ - 高性能(通过 `select` 参数只返回需要的字段)
163
+ - 简洁的返回结构(直接返回 `{ tableData, total }`)
94
164
  - 支持 11 种条件操作符和 `$and`/`$or` 逻辑组合
95
165
  - 支持的操作符(11 种):
96
166
  - $eq, $ne, $gte ($gteq), $lte ($lteq), $in, $contain, $startWith, $endWith
97
167
  - 逻辑操作符:$and, $or(支持嵌套)
98
168
 
99
- #### 高级过滤查询(v1.1.22+,OpenAPI 和 WebAPI 都支持,强烈推荐!)
100
-
101
169
  ```typescript
102
- // 强烈推荐:filter 功能强大,性能更好,两种模式都支持
103
170
  const result = await client.models.<modelName>.filter({
104
171
  where: {
105
172
  $and: [
@@ -226,19 +293,16 @@ const options = await client.models.<modelName>.getSelectOptions({
226
293
  });
227
294
  ```
228
295
 
229
- ### 4. 认证模式支持(v1.1.22+ 更新)
296
+ ### 5. 认证模式支持
230
297
 
231
298
  **OpenAPI 模式(accessKey/token)**:
232
- - 支持:getList, getOne, create, update
233
- - 支持:**filter**(v1.1.22+ 新增)
299
+ - 支持:filter, getOne, create, update
234
300
  - 支持:executeSql
235
- - 不支持:user.getList
236
301
  - 不支持:delete(暂不支持)
237
302
  - 不支持:getSelectOptions(暂不支持)
238
303
 
239
304
  **WebAPI 模式(Cookie)**:
240
- - 支持:getList, getOne, create, update
241
- - 支持:filter
305
+ - 支持:filter, getOne, create, update
242
306
  - 支持:delete
243
307
  - 支持:getSelectOptions
244
308
  - 支持:executeSql
@@ -298,18 +362,12 @@ await client.models.<modelName>.create({
298
362
  ### 1. 减少 API 调用和数据传输
299
363
 
300
364
  ```typescript
301
- // 推荐:使用 filter + select 只返回需要的字段
365
+ // 使用 filter + select 只返回需要的字段
302
366
  const result = await client.models.<modelName>.filter({
303
367
  where: { <field>: <value> },
304
368
  select: ['<field1>', '<field2>', '<field3>'], // 只返回3个字段,减少数据传输
305
369
  });
306
370
 
307
- // 不推荐:getList 返回所有字段,浪费带宽
308
- const response = await client.models.<modelName>.getList({
309
- <field>: <value>,
310
- pageSize: 20,
311
- }); // 返回所有字段,无法筛选
312
-
313
371
  // 批量操作,避免循环
314
372
  const items = await Promise.all(
315
373
  ids.map(id => client.models.<modelName>.getOne(id))
@@ -377,8 +435,8 @@ const [loading, setLoading] = useState(false);
377
435
  async function loadData() {
378
436
  setLoading(true);
379
437
  try {
380
- const response = await client.models.<modelName>.getList({ pageSize: 20 });
381
- setData(response.tableData);
438
+ const result = await client.models.<modelName>.filter({ pageSize: 20 });
439
+ setData(result.tableData);
382
440
  } catch (error) {
383
441
  alert('加载失败');
384
442
  } finally {
@@ -401,9 +459,9 @@ interface DataType {
401
459
  <field2>: number;
402
460
  }
403
461
 
404
- const response = await client.models.<modelName>.getList<DataType>({ pageSize: 20 });
462
+ const result = await client.models.<modelName>.filter<DataType>({ pageSize: 20 });
405
463
 
406
- response.tableData.forEach(item => {
464
+ result.tableData.forEach(item => {
407
465
  console.log(item.<field1>); // 类型安全
408
466
  console.log(item.unknownField); // 编译错误
409
467
  });
@@ -420,9 +478,8 @@ response.tableData.forEach(item => {
420
478
  5. **不要假设返回值结构** - 注意不同方法返回值的差异
421
479
  6. **不要在循环中调用 API** - 使用 Promise.all 批量处理
422
480
  7. **不要在每次渲染时调用 API** - 使用 useEffect 控制
423
- 8. **不要使用 getList** - 应该使用功能更强大的 `filter()`(v1.1.22+ 两种模式都支持)
424
- 9. **不要忘记检查 execSuccess** - executeSql 返回的数据必须检查 `execSuccess` 状态
425
- 10. **不要假设 executeSql 返回数组** - 返回的是 `{ execSuccess, execResult }` 对象
481
+ 8. **不要忘记检查 execSuccess** - executeSql 返回的数据必须检查 `execSuccess` 状态
482
+ 9. **不要假设 executeSql 返回数组** - 返回的是 `{ execSuccess, execResult }` 对象
426
483
 
427
484
 
428
485
 
@@ -432,14 +489,13 @@ response.tableData.forEach(item => {
432
489
 
433
490
  | 方法 | 返回结构 | 认证限制 |
434
491
  |------|----------|----------|
435
- | `filter()` (推荐) | `{ tableData, total }` | **OpenAPI + WebAPI**(v1.1.22+)|
436
- | `getList()` | `{ paging, tableData, tableColumns }` | OpenAPI + WebAPI |
437
- | `executeSql()` | `{ execSuccess, execResult }` | OpenAPI + WebAPI |
438
- | `user.getList()` | `User[]` | OpenAPI + WebAPI |
492
+ | `filter()` | `{ tableData, total }` | OpenAPI + WebAPI |
439
493
  | `getOne()` | 单个对象 | OpenAPI + WebAPI |
440
494
  | `create/update()` | 操作结果对象 | OpenAPI + WebAPI |
441
495
  | `delete()` | 删除结果 | 仅 WebAPI |
442
496
  | `getSelectOptions()` | `[{ label, value }]` | 仅 WebAPI |
497
+ | `executeSql()` | `{ execSuccess, execResult }` | OpenAPI + WebAPI |
498
+ | `user.getList()` | `User[]` | 仅 WebAPI |
443
499
 
444
500
  ### 记住
445
501
 
@@ -448,7 +504,7 @@ response.tableData.forEach(item => {
448
504
  - **所有调用**:必须用 `try-catch` 包裹
449
505
  - **先获取元数据**:使用 MCP 确认字段存在
450
506
  - **注意参数名**:`select`(不是 `fields`),`orderBy`(不是 `sortList`)
451
- - **强烈推荐 filter**:两种模式都支持,用 `filter()` 而不是 `getList()`(v1.1.22+)
507
+ - **列表查询用 filter**:使用 `filter()` 方法进行列表查询
452
508
  - **executeSql 检查状态**:应用层必须检查 `execSuccess` 状态
453
509
  - **用户列表**:使用 `client.api.user.getList()` 获取平台用户
454
510