@lovrabet/cli 1.1.26 → 1.2.1-beta.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 (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 a51_0x58e7(){const _0x541b04=['请重启\x20Cursor\x20以加载新的\x20MCP\x20配置。','复制\x20Cursor\x20Rules\x20文件','lovrabet-dataset','\x0a✓\x20Cursor\x20MCP\x20配置成功!','online','配置\x20Cursor\x20MCP\x20成功','utf8','创建新的\x20mcp.json\x20配置','9909330VuuXPt','4332318wZeqxI','✓\x20创建\x20.cursor\x20目录:\x20','mcp-cursor','log','✓\x20创建\x20mcp.json\x20配置文件','\x20\x20-\x20环境:\x20','exit','Cursor\x20Rules\x20文件已存在,跳过','stringify','npx','error','1581905ZWNYut','错误:\x20解析现有\x20mcp.json\x20失败:\x20','5479280SFfXxu','配置\x20Cursor\x20MCP\x20失败','\x0a现在您可以在\x20Cursor\x20中使用\x20Lovrabet\x20数据集\x20MCP\x20工具了。','message','mcpServers','9356102DJOanI','创建\x20.cursor\x20目录','1lyKYWG','cwd','错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置','创建\x20.cursor/rules\x20目录','303274CgWFcd','\x20\x20-\x20AppCode:\x20','2731228Xiwzqt','✓\x20更新\x20mcp.json\x20配置','.cursor','复制\x20Cursor\x20Rules\x20文件失败','app','警告:\x20复制\x20Cursor\x20Rules\x20文件失败:\x20','info','!\x20Cursor\x20Rules\x20文件已存在,跳过创建,如需重新创建,请删除\x20.cursor/rules/lovrabet_rules.mdc\x20文件','lovrabet_rules.mdc','更新现有\x20mcp.json\x20配置','warn','\x0a配置信息:'];a51_0x58e7=function(){return _0x541b04;};return a51_0x58e7();}(function(_0x2a8886,_0x71719f){const _0x27da31=a51_0x5420,_0x36e2ab=_0x2a8886();while(!![]){try{const _0x41cb87=-parseInt(_0x27da31(0x173))/0x1*(-parseInt(_0x27da31(0x148))/0x2)+parseInt(_0x27da31(0x15f))/0x3+-parseInt(_0x27da31(0x14a))/0x4+parseInt(_0x27da31(0x16a))/0x5+parseInt(_0x27da31(0x15e))/0x6+-parseInt(_0x27da31(0x171))/0x7+-parseInt(_0x27da31(0x16c))/0x8;if(_0x41cb87===_0x71719f)break;else _0x36e2ab['push'](_0x36e2ab['shift']());}catch(_0x49437c){_0x36e2ab['push'](_0x36e2ab['shift']());}}}(a51_0x58e7,0xd1cf0));function a51_0x5420(_0x1a9cb1,_0x1ce972){_0x1a9cb1=_0x1a9cb1-0x147;const _0x58e737=a51_0x58e7();let _0x542099=_0x58e737[_0x1a9cb1];return _0x542099;}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';export async function configureCursorMcp(){const _0x255bd9=a51_0x5420;try{const _0x32cd8c=process[_0x255bd9(0x174)](),_0x1c1f91=resolve(_0x32cd8c,_0x255bd9(0x14c)),_0x31297a=resolve(_0x1c1f91,'mcp.json'),_0x16a4d0=readConfig(),_0x469726=_0x16a4d0['appcode']||_0x16a4d0[_0x255bd9(0x14e)],_0x148978=_0x16a4d0['env']||_0x255bd9(0x15a);!_0x469726&&(console[_0x255bd9(0x169)](_0x255bd9(0x175)),logger[_0x255bd9(0x169)]('mcp-cursor','未找到\x20appcode\x20配置'),process[_0x255bd9(0x165)](0x1));!existsSync(_0x1c1f91)&&(mkdirSync(_0x1c1f91,{'recursive':!![]}),logger[_0x255bd9(0x150)](_0x255bd9(0x161),_0x255bd9(0x172),{'path':_0x1c1f91}),console[_0x255bd9(0x162)](_0x255bd9(0x160)+_0x1c1f91));const _0x5be5e8={'command':_0x255bd9(0x168),'args':['-y','@lovrabet/dataset-mcp-server'],'env':{'LOVRABET_APP_CODE':String(_0x469726),'LOVRABET_ENV':String(_0x148978)}};let _0x248989;if(existsSync(_0x31297a))try{const _0x365bee=readFileSync(_0x31297a,'utf8');_0x248989=JSON['parse'](_0x365bee),!_0x248989['mcpServers']&&(_0x248989[_0x255bd9(0x170)]={}),_0x248989[_0x255bd9(0x170)][_0x255bd9(0x158)]=_0x5be5e8,logger[_0x255bd9(0x150)](_0x255bd9(0x161),_0x255bd9(0x153),{'path':_0x31297a,'appcode':_0x469726,'env':_0x148978}),console['log'](_0x255bd9(0x14b));}catch(_0x3619e7){logger[_0x255bd9(0x169)](_0x255bd9(0x161),'解析现有\x20mcp.json\x20失败',{'error':_0x3619e7 instanceof Error?_0x3619e7[_0x255bd9(0x16f)]:String(_0x3619e7)}),console[_0x255bd9(0x169)](_0x255bd9(0x16b)+(_0x3619e7 instanceof Error?_0x3619e7[_0x255bd9(0x16f)]:String(_0x3619e7))),process[_0x255bd9(0x165)](0x1);}else _0x248989={'mcpServers':{'lovrabet-dataset':_0x5be5e8}},logger[_0x255bd9(0x150)](_0x255bd9(0x161),_0x255bd9(0x15d),{'path':_0x31297a,'appcode':_0x469726,'env':_0x148978}),console['log'](_0x255bd9(0x163));writeFileSync(_0x31297a,JSON[_0x255bd9(0x167)](_0x248989,null,0x2),{'encoding':_0x255bd9(0x15c)});const _0x276d81=resolve(_0x1c1f91,'rules'),_0x2896ce=resolve(_0x276d81,_0x255bd9(0x152));if(!existsSync(_0x2896ce))try{!existsSync(_0x276d81)&&(mkdirSync(_0x276d81,{'recursive':!![]}),logger[_0x255bd9(0x150)](_0x255bd9(0x161),_0x255bd9(0x147),{'path':_0x276d81}));const _0x287955=fileURLToPath(import.meta.url),_0x5e5207=dirname(_0x287955),_0x16c6a2=resolve(_0x5e5207,'../../templates/rules/lovrabet_rules.mdc.tpl');existsSync(_0x16c6a2)?(copyFileSync(_0x16c6a2,_0x2896ce),logger[_0x255bd9(0x150)](_0x255bd9(0x161),_0x255bd9(0x157),{'from':_0x16c6a2,'to':_0x2896ce}),console[_0x255bd9(0x162)]('✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc')):logger[_0x255bd9(0x154)](_0x255bd9(0x161),'Cursor\x20Rules\x20模板文件不存在',{'templatePath':_0x16c6a2});}catch(_0xe0a568){logger['error'](_0x255bd9(0x161),_0x255bd9(0x14d),{'error':_0xe0a568 instanceof Error?_0xe0a568[_0x255bd9(0x16f)]:String(_0xe0a568)}),console[_0x255bd9(0x154)](_0x255bd9(0x14f)+(_0xe0a568 instanceof Error?_0xe0a568['message']:String(_0xe0a568)));}else console['log'](_0x255bd9(0x151)),logger['info'](_0x255bd9(0x161),_0x255bd9(0x166),{'path':_0x2896ce});console[_0x255bd9(0x162)](_0x255bd9(0x159)),console[_0x255bd9(0x162)](_0x255bd9(0x155)),console[_0x255bd9(0x162)](_0x255bd9(0x149)+_0x469726),console[_0x255bd9(0x162)](_0x255bd9(0x164)+_0x148978),console[_0x255bd9(0x162)]('\x20\x20-\x20配置文件:\x20'+_0x31297a),console['log'](_0x255bd9(0x16e)),console[_0x255bd9(0x162)](_0x255bd9(0x156)),logger[_0x255bd9(0x150)](_0x255bd9(0x161),_0x255bd9(0x15b),{'appcode':_0x469726,'env':_0x148978,'configPath':_0x31297a}),process['exit'](0x0);}catch(_0xd5c64f){logger[_0x255bd9(0x169)](_0x255bd9(0x161),_0x255bd9(0x16d),{'error':_0xd5c64f instanceof Error?_0xd5c64f[_0x255bd9(0x16f)]:String(_0xd5c64f)}),console[_0x255bd9(0x169)]('错误:\x20配置失败:\x20'+(_0xd5c64f instanceof Error?_0xd5c64f[_0x255bd9(0x16f)]:String(_0xd5c64f))),process[_0x255bd9(0x165)](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(_0x5f0395,_0x2fb262){var _0x2173ee=a52_0x2a73,_0x202374=_0x5f0395();while(!![]){try{var _0x133ffc=-parseInt(_0x2173ee(0x6e))/0x1*(-parseInt(_0x2173ee(0x71))/0x2)+parseInt(_0x2173ee(0x7a))/0x3+parseInt(_0x2173ee(0x72))/0x4+-parseInt(_0x2173ee(0x78))/0x5*(-parseInt(_0x2173ee(0x6f))/0x6)+-parseInt(_0x2173ee(0x77))/0x7+-parseInt(_0x2173ee(0x81))/0x8*(-parseInt(_0x2173ee(0x70))/0x9)+parseInt(_0x2173ee(0x74))/0xa*(-parseInt(_0x2173ee(0x7e))/0xb);if(_0x133ffc===_0x2fb262)break;else _0x202374['push'](_0x202374['shift']());}catch(_0x353d13){_0x202374['push'](_0x202374['shift']());}}}(a52_0x2858,0xbfe6f));import{configureCursorMcp}from'./cursor.js';import{logger}from'../utils/logger.js';function a52_0x2a73(_0x4ce2ac,_0x37a174){_0x4ce2ac=_0x4ce2ac-0x6d;var _0x285806=a52_0x2858();var _0x2a73d3=_0x285806[_0x4ce2ac];return _0x2a73d3;}export async function mcpCommand(_0x418af2){var _0x2de01c=a52_0x2a73;logger['setLogPath'](process[_0x2de01c(0x7c)]());if(!_0x418af2){console[_0x2de01c(0x6d)]('错误:\x20请指定\x20IDE\x20类型'),console[_0x2de01c(0x7b)]('\x0a使用方法:'),console[_0x2de01c(0x7b)]('\x20\x20lovrabet\x20mcp\x20cursor\x20\x20\x20\x20配置\x20Cursor\x20的\x20MCP'),console[_0x2de01c(0x7b)](_0x2de01c(0x79)),console['log']('\x20\x20lovrabet\x20mcp\x20cursor'),logger[_0x2de01c(0x6d)](_0x2de01c(0x7f),_0x2de01c(0x82)),process['exit'](0x1);return;}switch(_0x418af2[_0x2de01c(0x83)]()){case _0x2de01c(0x75):logger[_0x2de01c(0x76)](_0x2de01c(0x7f),'执行配置\x20Cursor\x20MCP\x20命令'),await configureCursorMcp();break;default:console['error']('错误:\x20不支持的\x20IDE\x20类型:\x20'+_0x418af2),console[_0x2de01c(0x7b)](_0x2de01c(0x80)),console[_0x2de01c(0x7b)]('\x20\x20-\x20cursor'),logger[_0x2de01c(0x6d)](_0x2de01c(0x7f),_0x2de01c(0x7d)+_0x418af2),process[_0x2de01c(0x73)](0x1);break;}}function a52_0x2858(){var _0x5750a4=['2003uKKTiX','2239788wzfpCF','12113604xtJOhH','398dSRxil','4625984MmUbQl','exit','1560xfbGqJ','cursor','info','8120651rsyHhd','15LxAEdK','\x0a示例:','3693399NzojBI','log','cwd','不支持的\x20IDE\x20类型:\x20','233112wKjVaY','mcp','\x0a当前支持的\x20IDE:','8ilyMMp','未指定\x20IDE\x20类型','toLowerCase','error'];a52_0x2858=function(){return _0x5750a4;};return a52_0x2858();}
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1 @@
1
+ const a54_0x39d9e7=a54_0x7248;function a54_0x7248(_0x31c9ae,_0x4741c7){_0x31c9ae=_0x31c9ae-0x8c;const _0x22146b=a54_0x2214();let _0x7248df=_0x22146b[_0x31c9ae];return _0x7248df;}(function(_0x426a7a,_0x3498c3){const _0x5345c1=a54_0x7248,_0xfe4abf=_0x426a7a();while(!![]){try{const _0xb43e92=parseInt(_0x5345c1(0x9b))/0x1*(parseInt(_0x5345c1(0xa6))/0x2)+-parseInt(_0x5345c1(0xa5))/0x3*(parseInt(_0x5345c1(0x9e))/0x4)+-parseInt(_0x5345c1(0x93))/0x5*(-parseInt(_0x5345c1(0xa9))/0x6)+parseInt(_0x5345c1(0xa7))/0x7+parseInt(_0x5345c1(0x91))/0x8+-parseInt(_0x5345c1(0x8f))/0x9*(-parseInt(_0x5345c1(0x94))/0xa)+-parseInt(_0x5345c1(0x9d))/0xb;if(_0xb43e92===_0x3498c3)break;else _0xfe4abf['push'](_0xfe4abf['shift']());}catch(_0x414f98){_0xfe4abf['push'](_0xfe4abf['shift']());}}}(a54_0x2214,0xd83bf));import a54_0x1fe313 from'node:fs';import a54_0x182787 from'node:path';function a54_0x2214(){const _0x22da34=['2158452OOMQCz','coerce','6808896Zdvqbc','join','41555TkdjDN','10mAdNeg','@lovrabet/sdk','\x1b[1m','\x20\x20\x20当前\x20CLI\x20版本已升级模型注册协议,但检测到您的\x20@lovrabet/sdk\x20版本\x20','\x1b[33m','\x1b[0m','readFileSync','132287StYLui','\x20或更高版本:','12731686QJdNkI','30252OSMEMh','\x20不支持新协议。','parse','log','\x20\x20\x20npm\x20install\x20@lovrabet/sdk@latest','⚠️\x20\x20SDK\x20版本不兼容','utf8','207qUpsKt','2LPboeJ','6599691uTfdIm','minVersion','288yVpjpU','\x20\x20\x20查看最新版本:\x20https://www.npmjs.com/package/@lovrabet/sdk','1.2.0','package.json','version'];a54_0x2214=function(){return _0x22da34;};return a54_0x2214();}import a54_0x4932b4 from'semver';const MIN_SDK_VERSION=a54_0x39d9e7(0x8c);export function checkSdkVersion(_0x25f189){const _0x5194c4=a54_0x39d9e7,_0x290967=a54_0x182787[_0x5194c4(0x92)](_0x25f189,_0x5194c4(0x8d));if(!a54_0x1fe313['existsSync'](_0x290967))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};try{const _0x3bc01c=JSON[_0x5194c4(0xa0)](a54_0x1fe313[_0x5194c4(0x9a)](_0x290967,_0x5194c4(0xa4))),_0x2aadaa=_0x3bc01c['dependencies']||{},_0x200849=_0x3bc01c['devDependencies']||{},_0x101532=_0x2aadaa['@lovrabet/sdk']||_0x200849[_0x5194c4(0x95)];if(!_0x101532)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};const _0x3645ae=a54_0x4932b4[_0x5194c4(0x90)](_0x101532),_0x269ef1=_0x3645ae?a54_0x4932b4['lt'](_0x3645ae,MIN_SDK_VERSION):![];return{'installed':!![],'version':_0x101532,'needsUpgrade':_0x269ef1,'minVersion':MIN_SDK_VERSION};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};}}export function printSdkUpgradeWarning(_0x1b3410){const _0x3d46e6=a54_0x39d9e7;if(!_0x1b3410['needsUpgrade'])return;const _0x44f064=_0x3d46e6(0x98),_0x180a28=_0x3d46e6(0x99),_0x109e09=_0x3d46e6(0x96);console[_0x3d46e6(0xa1)](),console[_0x3d46e6(0xa1)](''+_0x44f064+_0x109e09+_0x3d46e6(0xa3)+_0x180a28),console[_0x3d46e6(0xa1)](_0x44f064+_0x3d46e6(0x97)+_0x1b3410[_0x3d46e6(0x8e)]+_0x3d46e6(0x9f)+_0x180a28),console[_0x3d46e6(0xa1)](_0x44f064+'\x20\x20\x20请升级\x20SDK\x20至\x20'+_0x1b3410[_0x3d46e6(0xa8)]+_0x3d46e6(0x9c)+_0x180a28),console[_0x3d46e6(0xa1)](_0x44f064+_0x3d46e6(0xa2)+_0x180a28),console[_0x3d46e6(0xa1)](_0x44f064+_0x3d46e6(0xaa)+_0x180a28),console[_0x3d46e6(0xa1)]();}
@@ -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_0x2b3111=a55_0x68aa;(function(_0x3a1fc1,_0x365917){const _0x54f898=a55_0x68aa,_0x82369f=_0x3a1fc1();while(!![]){try{const _0x222136=parseInt(_0x54f898(0x18b))/0x1*(parseInt(_0x54f898(0x183))/0x2)+parseInt(_0x54f898(0x188))/0x3*(parseInt(_0x54f898(0x187))/0x4)+parseInt(_0x54f898(0x184))/0x5+-parseInt(_0x54f898(0x17f))/0x6*(-parseInt(_0x54f898(0x185))/0x7)+-parseInt(_0x54f898(0x181))/0x8+parseInt(_0x54f898(0x17e))/0x9*(parseInt(_0x54f898(0x17b))/0xa)+-parseInt(_0x54f898(0x180))/0xb;if(_0x222136===_0x365917)break;else _0x82369f['push'](_0x82369f['shift']());}catch(_0xfa3075){_0x82369f['push'](_0x82369f['shift']());}}}(a55_0x2bb6,0x648e5));import{existsSync,readFileSync}from'node:fs';function a55_0x68aa(_0x5efb66,_0x1de5d3){_0x5efb66=_0x5efb66-0x17b;const _0x2bb6f3=a55_0x2bb6();let _0x68aa0f=_0x2bb6f3[_0x5efb66];return _0x68aa0f;}import{resolve}from'node:path';import{homedir}from'node:os';export const projectConfigPath=resolve(process['cwd'](),a55_0x2b3111(0x182));export const globalConfigPath=resolve(homedir(),a55_0x2b3111(0x182));export function readConfig(){const _0x42cd20=a55_0x2b3111;let _0x95b6f5={};try{if(existsSync(globalConfigPath)){const _0x3238f0=readFileSync(globalConfigPath,{'encoding':_0x42cd20(0x18a)});_0x3238f0&&(_0x95b6f5=JSON[_0x42cd20(0x17d)](_0x3238f0));}}catch(_0x18c779){}try{if(existsSync(projectConfigPath)){const _0x1038d0=readFileSync(projectConfigPath,{'encoding':'utf8'});if(_0x1038d0){const _0x2ad0dd=JSON[_0x42cd20(0x17d)](_0x1038d0);_0x95b6f5={..._0x95b6f5,..._0x2ad0dd};}}}catch(_0x3ed847){}return _0x95b6f5;}export function getConfigAppCode(){const _0x3400bf=a55_0x2b3111;let _0x36e05d={},_0x3b1401={};try{if(existsSync(globalConfigPath)){const _0x32deb3=readFileSync(globalConfigPath,{'encoding':'utf8'});_0x32deb3&&(_0x3b1401=JSON[_0x3400bf(0x17d)](_0x32deb3));}}catch(_0x2c85c0){}try{if(existsSync(projectConfigPath)){const _0x4dffdb=readFileSync(projectConfigPath,{'encoding':_0x3400bf(0x18a)});_0x4dffdb&&(_0x36e05d=JSON[_0x3400bf(0x17d)](_0x4dffdb));}}catch(_0x5b39ca){}let _0x5090bf;if('appcode'in _0x36e05d)_0x5090bf=_0x36e05d[_0x3400bf(0x18c)];else{if(_0x3400bf(0x17c)in _0x36e05d)_0x5090bf=_0x36e05d['app'];else{if(_0x3400bf(0x18c)in _0x3b1401)_0x5090bf=_0x3b1401['appcode'];else'app'in _0x3b1401&&(_0x5090bf=_0x3b1401[_0x3400bf(0x17c)]);}}if(typeof _0x5090bf!==_0x3400bf(0x189)||_0x5090bf[_0x3400bf(0x186)]()==='')return undefined;return _0x5090bf;}export function isInProject(){return existsSync(projectConfigPath);}function a55_0x2bb6(){const _0x5e4370=['app','parse','1579077OFYxYj','17250hNXdST','18653426ZXCRzl','5303664erbOLL','.lovrabetrc','65700joEHJr','2455625UfiFWg','1358twxiVn','trim','3162892EvSNmp','3yJqgPR','string','utf8','23KfrQNQ','appcode','10hCjZZp'];a55_0x2bb6=function(){return _0x5e4370;};return a55_0x2bb6();}
@@ -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_0x36b9(){const _0x4b29a7=['365490TKVqWe','4735440OLEVTg','215931qfpveW','511280vVvzUR','23720upuPCo','40TqNJmO','join','copyFileSync','isDirectory','name','1122dETXPL','4852iwpmZn','readdirSync','error','4612338WoGbho','1183pLbIJA'];a56_0x36b9=function(){return _0x4b29a7;};return a56_0x36b9();}(function(_0x537358,_0x1b7110){const _0x4b4be1=a56_0x1f34,_0x16235f=_0x537358();while(!![]){try{const _0x16a8ca=parseInt(_0x4b4be1(0x84))/0x1+parseInt(_0x4b4be1(0x7d))/0x2*(parseInt(_0x4b4be1(0x7c))/0x3)+-parseInt(_0x4b4be1(0x87))/0x4*(parseInt(_0x4b4be1(0x85))/0x5)+parseInt(_0x4b4be1(0x82))/0x6+-parseInt(_0x4b4be1(0x81))/0x7*(-parseInt(_0x4b4be1(0x86))/0x8)+parseInt(_0x4b4be1(0x80))/0x9+-parseInt(_0x4b4be1(0x83))/0xa;if(_0x16a8ca===_0x1b7110)break;else _0x16235f['push'](_0x16235f['shift']());}catch(_0x5e6beb){_0x16235f['push'](_0x16235f['shift']());}}}(a56_0x36b9,0xab4c1));function a56_0x1f34(_0x35e738,_0x2a4e73){_0x35e738=_0x35e738-0x7c;const _0x36b9c8=a56_0x36b9();let _0x1f3450=_0x36b9c8[_0x35e738];return _0x1f3450;}import a56_0xcbb85a from'node:path';import a56_0x739597 from'node:fs';export async function copyDirectory(_0x503fbc,_0x22494c){const _0x4770d4=a56_0x1f34;try{const _0x45ce86=a56_0x739597[_0x4770d4(0x7e)](_0x503fbc,{'withFileTypes':!![]});a56_0x739597['mkdirSync'](_0x22494c,{'recursive':!![]});for(const _0x45187c of _0x45ce86){const _0x41d686=a56_0xcbb85a[_0x4770d4(0x88)](_0x503fbc,_0x45187c[_0x4770d4(0x8b)]),_0x2d8984=a56_0xcbb85a['join'](_0x22494c,_0x45187c[_0x4770d4(0x8b)]);_0x45187c[_0x4770d4(0x8a)]()?await copyDirectory(_0x41d686,_0x2d8984):a56_0x739597[_0x4770d4(0x89)](_0x41d686,_0x2d8984);}}catch(_0x17c2d7){console[_0x4770d4(0x7f)]('复制目录时出错:',_0x17c2d7);}}
@@ -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(_0xb529ac,_0x7dbdd5){const _0x4ee4b2=a57_0x3e20,_0x28c3f4=_0xb529ac();while(!![]){try{const _0x42074b=parseInt(_0x4ee4b2(0xa6))/0x1+-parseInt(_0x4ee4b2(0xab))/0x2+parseInt(_0x4ee4b2(0xa0))/0x3*(parseInt(_0x4ee4b2(0x9c))/0x4)+parseInt(_0x4ee4b2(0x9a))/0x5+-parseInt(_0x4ee4b2(0x96))/0x6*(parseInt(_0x4ee4b2(0xa4))/0x7)+-parseInt(_0x4ee4b2(0xaa))/0x8+parseInt(_0x4ee4b2(0x9d))/0x9;if(_0x42074b===_0x7dbdd5)break;else _0x28c3f4['push'](_0x28c3f4['shift']());}catch(_0x23d5d9){_0x28c3f4['push'](_0x28c3f4['shift']());}}}(a57_0x13b3,0x50a15));export async function httpRequest(_0xb7bfc5,_0x244120={}){const _0x4246c4=a57_0x3e20,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x244120;let _0x5a31e4=null;for(let _0x26be9c=0x0;_0x26be9c<=retries;_0x26be9c++){try{const _0x2e8a86=new AbortController(),_0x59b7df=setTimeout(()=>_0x2e8a86[_0x4246c4(0xad)](),timeout),_0x4dad5b=await fetch(_0xb7bfc5,{'headers':headers,'signal':_0x2e8a86[_0x4246c4(0xa2)]});clearTimeout(_0x59b7df);let _0x5998f1;const _0x305a3d=_0x4dad5b[_0x4246c4(0xac)][_0x4246c4(0x98)]('content-type');return _0x305a3d?.[_0x4246c4(0xa9)](_0x4246c4(0x9b))?_0x5998f1=await _0x4dad5b[_0x4246c4(0xae)]():_0x5998f1=await _0x4dad5b[_0x4246c4(0x97)](),{'ok':_0x4dad5b['ok'],'status':_0x4dad5b[_0x4246c4(0x94)],'statusText':_0x4dad5b['statusText'],'data':_0x5998f1,'headers':_0x4dad5b['headers'],'url':_0x4dad5b['url'],'text':()=>_0x4dad5b[_0x4246c4(0x97)]()};}catch(_0x3a51a5){_0x5a31e4=_0x3a51a5 instanceof Error?_0x3a51a5:new Error(String(_0x3a51a5));if(_0x26be9c===retries)break;if(shouldRetry(_0x3a51a5)){console[_0x4246c4(0xa7)](_0x4246c4(0x9e)+retryDelay+_0x4246c4(0xa8)+(_0x26be9c+0x1)+_0x4246c4(0x9f)),await sleep(retryDelay);continue;}else break;}}throw _0x5a31e4||new Error('Request\x20failed');}function shouldRetry(_0x361c61){const _0x2f64bd=a57_0x3e20;if(_0x361c61 instanceof Error){if(_0x361c61[_0x2f64bd(0xa5)]==='AbortError')return![];if(_0x361c61[_0x2f64bd(0xa5)]===_0x2f64bd(0xa3)&&_0x361c61[_0x2f64bd(0x99)][_0x2f64bd(0xa9)](_0x2f64bd(0xa1)))return!![];if(_0x361c61[_0x2f64bd(0x99)][_0x2f64bd(0xa9)](_0x2f64bd(0x95)))return!![];if(_0x361c61[_0x2f64bd(0x99)][_0x2f64bd(0xa9)]('ENOTFOUND'))return![];}return![];}function a57_0x3e20(_0x48e6b2,_0xebb905){_0x48e6b2=_0x48e6b2-0x94;const _0x13b373=a57_0x13b3();let _0x3e2097=_0x13b373[_0x48e6b2];return _0x3e2097;}function sleep(_0x44a0f3){return new Promise(_0x2b6f09=>setTimeout(_0x2b6f09,_0x44a0f3));}export function validateUrl(_0x421110){try{return new URL(_0x421110),!![];}catch{return![];}}function a57_0x13b3(){const _0x5483a4=['status','ECONNRESET','1267902WQFCnK','text','get','message','393945eLjxUV','application/json','596MqXSmH','2529477hGtEJG','*\x20请求失败,','\x20次重试...','5697axKytu','fetch','signal','TypeError','21HhjhSr','name','529322WhJURF','log','ms\x20后进行第\x20','includes','581200dwaVTq','270506PxZmfk','headers','abort','json'];a57_0x13b3=function(){return _0x5483a4;};return a57_0x13b3();}
@@ -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
+ function a58_0x3a32(){const _0x5cd369=['currentRawCommand','createLogger','split','now','rawCommand','filter','green','mkdirSync','.lovrabet.log','existsSync','details','error','winstonLogger','errors','7Nouczp','combine','level','red','2FtoRmU','539899kEidkk','6409341xPVWCQ','3000380CVfQTs','Failed\x20to\x20clear\x20logs:','parse','readLogs','2169670JrLfgc','blue','unknown','trim','logTask','14468700YFUhHa','timestamp','transports','readFileSync','utf8','2026230QJLxkR','logFilePath','printf','map','command','yellow','失败:\x20','success','toISOString','message','开始执行:\x20','warn','log','addColors','duration','6hafSmU','join','format','getWinstonInstance','initWinstonLogger','753952fJUszW','clear','info'];a58_0x3a32=function(){return _0x5cd369;};return a58_0x3a32();}const a58_0x5f3a53=a58_0x2699;(function(_0x1c27af,_0x1b84f0){const _0x32779c=a58_0x2699,_0x118e04=_0x1c27af();while(!![]){try{const _0x5a1ef8=-parseInt(_0x32779c(0x10c))/0x1*(-parseInt(_0x32779c(0x10b))/0x2)+-parseInt(_0x32779c(0x11c))/0x3+parseInt(_0x32779c(0x10e))/0x4+-parseInt(_0x32779c(0x112))/0x5*(-parseInt(_0x32779c(0x12b))/0x6)+-parseInt(_0x32779c(0x107))/0x7*(-parseInt(_0x32779c(0x130))/0x8)+parseInt(_0x32779c(0x10d))/0x9+-parseInt(_0x32779c(0x117))/0xa;if(_0x5a1ef8===_0x1b84f0)break;else _0x118e04['push'](_0x118e04['shift']());}catch(_0x124ee9){_0x118e04['push'](_0x118e04['shift']());}}}(a58_0x3a32,0x639e9));import a58_0x180002 from'winston';import a58_0x3ef3d1 from'node:fs';import a58_0x3a5c2d from'node:path';class Logger{[a58_0x5f3a53(0x105)];[a58_0x5f3a53(0x11d)];[a58_0x5f3a53(0x133)]='';constructor(){const _0x2ccb72=a58_0x5f3a53;this[_0x2ccb72(0x11d)]='';}['setRawCommand'](_0x1baa3a){this['currentRawCommand']=_0x1baa3a;}[a58_0x5f3a53(0x12f)](){const _0x1e8d3f=a58_0x5f3a53,_0x1a5a05=a58_0x3a5c2d['dirname'](this[_0x1e8d3f(0x11d)]);!a58_0x3ef3d1['existsSync'](_0x1a5a05)&&a58_0x3ef3d1[_0x1e8d3f(0x100)](_0x1a5a05,{'recursive':!![]});const _0x64f09f=a58_0x180002[_0x1e8d3f(0x12d)][_0x1e8d3f(0x108)](a58_0x180002[_0x1e8d3f(0x12d)][_0x1e8d3f(0x118)](),a58_0x180002['format'][_0x1e8d3f(0x106)]({'stack':!![]}),a58_0x180002['format'][_0x1e8d3f(0x11e)](_0x4080fa=>{const _0x3cc28e=_0x1e8d3f,_0x27dd66={'timestamp':_0x4080fa['timestamp']||new Date()[_0x3cc28e(0x124)](),'level':_0x4080fa[_0x3cc28e(0x109)]||'info','command':_0x4080fa[_0x3cc28e(0x120)]||_0x3cc28e(0x114),'rawCommand':_0x4080fa[_0x3cc28e(0xfd)]||this['currentRawCommand']||undefined,'message':_0x4080fa[_0x3cc28e(0x125)]||'','duration':_0x4080fa[_0x3cc28e(0x12a)]||undefined,'details':_0x4080fa[_0x3cc28e(0x103)]||undefined};return JSON['stringify'](_0x27dd66);}));this['winstonLogger']=a58_0x180002[_0x1e8d3f(0x134)]({'level':'info','format':_0x64f09f,'transports':[new a58_0x180002[(_0x1e8d3f(0x119))]['File']({'filename':this[_0x1e8d3f(0x11d)],'level':'info'})],'silent':![]}),a58_0x180002[_0x1e8d3f(0x129)]({'success':_0x1e8d3f(0xff),'error':_0x1e8d3f(0x10a),'warn':_0x1e8d3f(0x121),'info':_0x1e8d3f(0x113)});}['setLogPath'](_0x3f89b2){const _0x40e42e=a58_0x5f3a53;this[_0x40e42e(0x11d)]=a58_0x3a5c2d[_0x40e42e(0x12c)](_0x3f89b2,_0x40e42e(0x101)),this[_0x40e42e(0x105)]&&this[_0x40e42e(0x105)][_0x40e42e(0x131)](),this['initWinstonLogger']();}[a58_0x5f3a53(0x132)](_0x345d59,_0x6139b3,_0x50cb75){const _0x50b295=a58_0x5f3a53;if(!this[_0x50b295(0x11d)]||!this[_0x50b295(0x105)])return;this[_0x50b295(0x105)]['info'](_0x6139b3,{'command':_0x345d59,'details':_0x50cb75});}[a58_0x5f3a53(0x123)](_0x14e786,_0x3c063e,_0xd90664,_0x611fa0){const _0x595e68=a58_0x5f3a53;if(!this[_0x595e68(0x11d)]||!this[_0x595e68(0x105)])return;this[_0x595e68(0x105)][_0x595e68(0x128)](_0x595e68(0x132),_0x3c063e,{'level':_0x595e68(0x123),'command':_0x14e786,'duration':_0xd90664,'details':_0x611fa0});}['error'](_0x490530,_0x28858d,_0xb055){const _0x6a62cb=a58_0x5f3a53;if(!this[_0x6a62cb(0x11d)]||!this[_0x6a62cb(0x105)])return;this[_0x6a62cb(0x105)][_0x6a62cb(0x104)](_0x28858d,{'command':_0x490530,'details':_0xb055});}[a58_0x5f3a53(0x127)](_0x5b6459,_0x40b27f,_0x5df843){const _0x8e46cc=a58_0x5f3a53;if(!this[_0x8e46cc(0x11d)]||!this[_0x8e46cc(0x105)])return;this[_0x8e46cc(0x105)]['warn'](_0x40b27f,{'command':_0x5b6459,'details':_0x5df843});}async[a58_0x5f3a53(0x116)](_0x1176d9,_0x4aa8b0,_0x46dd50){const _0x4a59a3=a58_0x5f3a53,_0x1e13dd=Date[_0x4a59a3(0xfc)]();this[_0x4a59a3(0x132)](_0x1176d9,_0x4a59a3(0x126)+_0x4aa8b0);try{const _0x14e6e7=await _0x46dd50(),_0x34e1f8=Date['now']()-_0x1e13dd;return this[_0x4a59a3(0x123)](_0x1176d9,'完成:\x20'+_0x4aa8b0,_0x34e1f8),_0x14e6e7;}catch(_0x19aaf4){const _0x33be44=Date[_0x4a59a3(0xfc)]()-_0x1e13dd;this[_0x4a59a3(0x104)](_0x1176d9,_0x4a59a3(0x122)+_0x4aa8b0,{'error':_0x19aaf4 instanceof Error?_0x19aaf4[_0x4a59a3(0x125)]:String(_0x19aaf4),'duration':_0x33be44});throw _0x19aaf4;}}[a58_0x5f3a53(0x111)](){const _0x3946b3=a58_0x5f3a53;try{if(!a58_0x3ef3d1[_0x3946b3(0x102)](this[_0x3946b3(0x11d)]))return[];const _0x2ed9ae=a58_0x3ef3d1[_0x3946b3(0x11a)](this[_0x3946b3(0x11d)],_0x3946b3(0x11b));return _0x2ed9ae[_0x3946b3(0x135)]('\x0a')[_0x3946b3(0xfe)](_0x9f2df3=>_0x9f2df3[_0x3946b3(0x115)]())[_0x3946b3(0x11f)](_0x1369e6=>JSON[_0x3946b3(0x110)](_0x1369e6));}catch(_0x4fa0e5){return console['warn']('Failed\x20to\x20read\x20logs:',_0x4fa0e5),[];}}['clearLogs'](){const _0x15ce35=a58_0x5f3a53;try{a58_0x3ef3d1['existsSync'](this[_0x15ce35(0x11d)])&&a58_0x3ef3d1['writeFileSync'](this[_0x15ce35(0x11d)],'',_0x15ce35(0x11b));}catch(_0x47e3f6){console[_0x15ce35(0x127)](_0x15ce35(0x10f),_0x47e3f6);}}[a58_0x5f3a53(0x12e)](){const _0x14c53e=a58_0x5f3a53;return this[_0x14c53e(0x105)];}}function a58_0x2699(_0x4a0ec5,_0x113198){_0x4a0ec5=_0x4a0ec5-0xfc;const _0x3a32a6=a58_0x3a32();let _0x269914=_0x3a32a6[_0x4a0ec5];return _0x269914;}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
+ function a59_0x1fc0(){const _0xfcc70a=['path:\x20\x22','187422bZfDEF','promises','utf8','includes','1972491qEzWzN','join','1488236gBBadh','开始更新路由配置','addImport','\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22','message','src','router','未找到路由配置的\x20children\x20数组','20nidUxG','info','32704OqQTDI','9mqZMuc','addRoute','index','toComponentName','indexOf','\x20from\x20\x22../pages/','charAt','347287Omqklf','2WKlhnU','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','4044210eoGGvN','735evJfMV','2897807qAddhL','routerFilePath','now','路由配置更新失败','success','lastIndexOf','import\x20','index.tsx','map','readFile','\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},','length','路由配置更新完成','previewChanges','match','路由文件不存在:\x20','addPageRoute','split','slice'];a59_0x1fc0=function(){return _0xfcc70a;};return a59_0x1fc0();}function a59_0x3caf(_0x1616ec,_0x1c692a){_0x1616ec=_0x1616ec-0xff;const _0x1fc0f1=a59_0x1fc0();let _0x3caf16=_0x1fc0f1[_0x1616ec];return _0x3caf16;}const a59_0x348a1c=a59_0x3caf;(function(_0x9412ea,_0x3d9739){const _0xab1243=a59_0x3caf,_0x30b763=_0x9412ea();while(!![]){try{const _0x1160f9=-parseInt(_0xab1243(0x110))/0x1+parseInt(_0xab1243(0x111))/0x2*(-parseInt(_0xab1243(0x12d))/0x3)+parseInt(_0xab1243(0x12f))/0x4+parseInt(_0xab1243(0x106))/0x5*(-parseInt(_0xab1243(0x129))/0x6)+-parseInt(_0xab1243(0x114))/0x7*(-parseInt(_0xab1243(0x108))/0x8)+parseInt(_0xab1243(0x109))/0x9*(parseInt(_0xab1243(0x113))/0xa)+parseInt(_0xab1243(0x115))/0xb;if(_0x1160f9===_0x3d9739)break;else _0x30b763['push'](_0x30b763['shift']());}catch(_0x54638c){_0x30b763['push'](_0x30b763['shift']());}}}(a59_0x1fc0,0x52de1));import a59_0x619160 from'node:fs';import a59_0x3cbd46 from'node:path';import{logger}from'./logger.js';export class RouterUpdater{[a59_0x348a1c(0x116)];constructor(_0x4ef82e){const _0x4f0881=a59_0x348a1c;this[_0x4f0881(0x116)]=a59_0x3cbd46[_0x4f0881(0x12e)](_0x4ef82e,_0x4f0881(0x103),'router',_0x4f0881(0x11c));}async[a59_0x348a1c(0x125)](_0x315f5f,_0x32c660){const _0x53a1b0=a59_0x348a1c;if(!a59_0x619160['existsSync'](this['routerFilePath']))throw new Error(_0x53a1b0(0x124)+this['routerFilePath']);const _0x5653b6=Date['now']();logger[_0x53a1b0(0x107)](_0x53a1b0(0x104),_0x53a1b0(0xff),{'pageName':_0x315f5f,'routePath':_0x32c660,'file':this[_0x53a1b0(0x116)]});try{const _0x35747f=await a59_0x619160[_0x53a1b0(0x12a)]['readFile'](this[_0x53a1b0(0x116)],_0x53a1b0(0x12b)),_0xae0449=this[_0x53a1b0(0x10c)](_0x315f5f),_0x1368cf=this['addImport'](_0x35747f,_0xae0449,_0x315f5f),_0x89dd5b=this[_0x53a1b0(0x10a)](_0x1368cf,_0x32c660,_0xae0449);await a59_0x619160['promises']['writeFile'](this[_0x53a1b0(0x116)],_0x89dd5b,_0x53a1b0(0x12b));const _0x422817=Date[_0x53a1b0(0x117)]()-_0x5653b6;logger[_0x53a1b0(0x119)](_0x53a1b0(0x104),_0x53a1b0(0x121),_0x422817,{'pageName':_0x315f5f,'routePath':_0x32c660,'componentName':_0xae0449});}catch(_0x4b22b5){const _0x39c682=Date['now']()-_0x5653b6;logger['error']('router',_0x53a1b0(0x118),{'pageName':_0x315f5f,'routePath':_0x32c660,'error':_0x4b22b5 instanceof Error?_0x4b22b5[_0x53a1b0(0x102)]:String(_0x4b22b5),'duration':_0x39c682});throw _0x4b22b5;}}[a59_0x348a1c(0x10c)](_0x3b3c8b){const _0x4a6483=a59_0x348a1c;return _0x3b3c8b[_0x4a6483(0x126)]('-')[_0x4a6483(0x11d)](_0x24c474=>_0x24c474[_0x4a6483(0x10f)](0x0)['toUpperCase']()+_0x24c474['slice'](0x1)['toLowerCase']())[_0x4a6483(0x12e)]('');}[a59_0x348a1c(0x100)](_0x191ad4,_0xbd8716,_0x43861b){const _0x418e5d=a59_0x348a1c,_0x3448e6=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x3af816=_0x191ad4[_0x418e5d(0x123)](_0x3448e6)||[],_0x730a93=_0x418e5d(0x11b)+_0xbd8716+_0x418e5d(0x10e)+_0x43861b+'\x22;';if(_0x191ad4[_0x418e5d(0x12c)](_0x730a93))return _0x191ad4;if(_0x3af816[_0x418e5d(0x120)]>0x0){const _0x5453bd=_0x3af816[_0x3af816[_0x418e5d(0x120)]-0x1];if(_0x5453bd){const _0x5c6b21=_0x191ad4[_0x418e5d(0x11a)](_0x5453bd),_0xf8004c=_0x5c6b21+_0x5453bd[_0x418e5d(0x120)];return _0x191ad4[_0x418e5d(0x127)](0x0,_0xf8004c)+_0x730a93+'\x0a'+_0x191ad4[_0x418e5d(0x127)](_0xf8004c);}}const _0x4c611c=_0x191ad4[_0x418e5d(0x123)](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x4c611c&&_0x4c611c['index']!==undefined){const _0x153ff5=_0x4c611c[_0x418e5d(0x10b)]+_0x4c611c[0x0][_0x418e5d(0x120)];return _0x191ad4[_0x418e5d(0x127)](0x0,_0x153ff5)+_0x730a93+'\x0a'+_0x191ad4[_0x418e5d(0x127)](_0x153ff5);}return _0x191ad4;}[a59_0x348a1c(0x10a)](_0x50ccb3,_0x2decde,_0x262e73){const _0x527039=a59_0x348a1c,_0xd3ff07=_0x527039(0x101)+_0x2decde+_0x527039(0x112)+_0x262e73+_0x527039(0x11f);if(_0x50ccb3['includes'](_0x527039(0x128)+_0x2decde+'\x22'))return _0x50ccb3;const _0x208db2=/children:\s*\[([\s\S]*?)\]/,_0x433406=_0x50ccb3[_0x527039(0x123)](_0x208db2);if(!_0x433406||_0x433406[_0x527039(0x10b)]===undefined)throw new Error(_0x527039(0x105));const _0x3ffb1f=_0x433406[0x1],_0x38ada4=_0x433406[_0x527039(0x10b)]+_0x433406[0x0][_0x527039(0x10d)]('[')+0x1,_0x7422fa=_0x3ffb1f?.[_0x527039(0x123)](/\{[\s\S]*?\},/g)||[];if(_0x7422fa[_0x527039(0x120)]>0x0){const _0x7397d7=_0x7422fa[_0x7422fa[_0x527039(0x120)]-0x1];if(_0x7397d7){const _0x35ea59=_0x50ccb3[_0x527039(0x11a)](_0x7397d7),_0x1172bc=_0x35ea59+_0x7397d7[_0x527039(0x120)];return _0x50ccb3[_0x527039(0x127)](0x0,_0x1172bc)+'\x0a'+_0xd3ff07+_0x50ccb3['slice'](_0x1172bc);}}return _0x50ccb3[_0x527039(0x127)](0x0,_0x38ada4)+'\x0a'+_0xd3ff07+_0x50ccb3[_0x527039(0x127)](_0x38ada4);}async[a59_0x348a1c(0x122)](_0x47afdd,_0x214b34){const _0x14fea7=a59_0x348a1c;if(!a59_0x619160['existsSync'](this[_0x14fea7(0x116)]))throw new Error('路由文件不存在:\x20'+this['routerFilePath']);const _0x25e22d=await a59_0x619160['promises'][_0x14fea7(0x11e)](this[_0x14fea7(0x116)],_0x14fea7(0x12b)),_0x55fb1d=this[_0x14fea7(0x10c)](_0x47afdd);let _0x3f908d=this[_0x14fea7(0x100)](_0x25e22d,_0x55fb1d,_0x47afdd);return _0x3f908d=this[_0x14fea7(0x10a)](_0x3f908d,_0x214b34,_0x55fb1d),_0x3f908d;}}
@@ -1 +1 @@
1
- export function sleep(_0x4e0c91){return new Promise(_0x56f103=>setTimeout(_0x56f103,_0x4e0c91));}
1
+ export function sleep(_0x58abdb){return new Promise(_0x2d5459=>setTimeout(_0x2d5459,_0x58abdb));}
@@ -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_0x25e3a7=a61_0x3af9;function a61_0x3af9(_0x2775cf,_0x14c408){_0x2775cf=_0x2775cf-0x1a8;const _0x1fdb36=a61_0x1fdb();let _0x3af912=_0x1fdb36[_0x2775cf];return _0x3af912;}(function(_0x498f44,_0x2d17a8){const _0x54b128=a61_0x3af9,_0xd2e899=_0x498f44();while(!![]){try{const _0x95c4f5=-parseInt(_0x54b128(0x1e2))/0x1*(parseInt(_0x54b128(0x1b2))/0x2)+parseInt(_0x54b128(0x1b6))/0x3+parseInt(_0x54b128(0x1d9))/0x4*(parseInt(_0x54b128(0x1dc))/0x5)+parseInt(_0x54b128(0x1b7))/0x6+parseInt(_0x54b128(0x1ad))/0x7+parseInt(_0x54b128(0x1e3))/0x8+-parseInt(_0x54b128(0x1b4))/0x9*(parseInt(_0x54b128(0x1df))/0xa);if(_0x95c4f5===_0x2d17a8)break;else _0xd2e899['push'](_0xd2e899['shift']());}catch(_0x549726){_0xd2e899['push'](_0xd2e899['shift']());}}}(a61_0x1fdb,0x61fe1));import a61_0x2fee1a from'node:fs';function a61_0x1fdb(){const _0xde54da=['toLocaleDateString','2dPXVwo','4547848oYnSmb','writeFile','includes','toUpperCase','slice','numeric','alias','push','\x20},','.tpl','datasetCode:\x20\x22','error','message','1929746lLHeek','.tsx','name','.md','mkdir','38566FyusHZ','2-digit','1764ZWGpcm','toComponentName','2083932WoAxBA','484620atHqbg','replace','promises','alias:\x20\x22','YourModel','utf8','success','\x0a\x20\x20\x20\x20{\x20','name:\x20\x22','pop','.scss','tableName:\x20\x22','processTemplate','.json','replaceContent','charAt','map','模板内容替换完成','toDisplayTitle','now','开始处理模板内容替换','info','toISOString','processFile','toLowerCase','processDirectory','.ts','endsWith','.jsx','.css','readFile','.js','split','template','24cEtnlS','tableName','datasetCode','140055VDYZOx','toLocaleString','replaceApiContent','68760DvufRW','join'];a61_0x1fdb=function(){return _0xde54da;};return a61_0x1fdb();}import a61_0x24a344 from'node:path';import{logger}from'./logger.js';export class TemplateReplacer{static['toComponentName'](_0x1e14b3){const _0x2b9d32=a61_0x3af9,_0x3d4dcb=_0x1e14b3[_0x2b9d32(0x1d7)]('/')['pop']()||_0x1e14b3;return _0x3d4dcb[_0x2b9d32(0x1d7)]('-')[_0x2b9d32(0x1c7)](_0x20e8d5=>_0x20e8d5['charAt'](0x0)[_0x2b9d32(0x1e6)]()+_0x20e8d5[_0x2b9d32(0x1e7)](0x1)[_0x2b9d32(0x1cf)]())[_0x2b9d32(0x1e0)]('');}static[a61_0x25e3a7(0x1c9)](_0x2d4583){const _0x5a1b7c=a61_0x25e3a7,_0x3bfaa1=_0x2d4583[_0x5a1b7c(0x1d7)]('/')[_0x5a1b7c(0x1c0)]()||_0x2d4583;return _0x3bfaa1[_0x5a1b7c(0x1d7)]('-')['map'](_0x3ed427=>_0x3ed427[_0x5a1b7c(0x1c6)](0x0)[_0x5a1b7c(0x1e6)]()+_0x3ed427[_0x5a1b7c(0x1e7)](0x1)[_0x5a1b7c(0x1cf)]())[_0x5a1b7c(0x1e0)]('\x20');}static[a61_0x25e3a7(0x1c5)](_0x4bc5de,_0x1736e1,_0x232820){const _0x59207f=a61_0x25e3a7,_0x305f53=this[_0x59207f(0x1b5)](_0x1736e1),_0x494372=this[_0x59207f(0x1c9)](_0x1736e1),_0x119f2a=new Date(),_0x115dd2=_0x119f2a[_0x59207f(0x1dd)](undefined,{'year':_0x59207f(0x1e8),'month':'2-digit','day':_0x59207f(0x1b3),'hour':_0x59207f(0x1b3),'minute':_0x59207f(0x1b3),'second':'2-digit','hour12':![]})[_0x59207f(0x1b8)](/\//g,'-'),_0x206fa9=_0x119f2a[_0x59207f(0x1e1)](undefined,{'year':_0x59207f(0x1e8),'month':'2-digit','day':_0x59207f(0x1b3)})['replace'](/\//g,'-'),_0xe270b5=_0x119f2a['toLocaleTimeString'](undefined,{'hour12':![]});let _0x104761=_0x4bc5de[_0x59207f(0x1b8)](/\{ComponentName\}/g,_0x305f53)[_0x59207f(0x1b8)](/\{DisplayTitle\}/g,_0x494372)[_0x59207f(0x1b8)](/\{PageName\}/g,_0x1736e1)[_0x59207f(0x1b8)](/\{TemplateName\}/g,_0x232820)[_0x59207f(0x1b8)](/\{CreatedAt\}/g,_0x115dd2)[_0x59207f(0x1b8)](/\{CreatedDate\}/g,_0x206fa9)[_0x59207f(0x1b8)](/\{CreatedTime\}/g,_0xe270b5);return _0x104761;}static[a61_0x25e3a7(0x1de)](_0x5065bc,_0x5a113f,_0xafb80a,_0xa64009,_0x527c58,_0x245673,_0x28b0e2){const _0x23d98f=a61_0x25e3a7,_0x5c7416=new Date(),_0x44a28a=_0x5c7416[_0x23d98f(0x1cd)](),_0xde054d=_0xafb80a[_0x23d98f(0x1c7)](_0x3df37c=>{const _0x215c9f=_0x23d98f,_0x1c08ea=[_0x215c9f(0x1aa)+_0x3df37c[_0x215c9f(0x1db)]+'\x22',_0x215c9f(0x1c2)+_0x3df37c[_0x215c9f(0x1da)]+'\x22',_0x215c9f(0x1bf)+_0x3df37c[_0x215c9f(0x1af)]+'\x22'];return _0x3df37c['alias']&&_0x1c08ea[_0x215c9f(0x1ea)](_0x215c9f(0x1ba)+_0x3df37c[_0x215c9f(0x1e9)]+'\x22'),_0x215c9f(0x1be)+_0x1c08ea[_0x215c9f(0x1e0)](',\x20')+_0x215c9f(0x1a8);})[_0x23d98f(0x1e0)](''),_0x54d1d3=_0xa64009||_0xafb80a[0x0]?.[_0x23d98f(0x1e9)]||_0x23d98f(0x1bb);let _0x45fdbb=_0x5065bc[_0x23d98f(0x1b8)](/\{AppCode\}/g,_0x5a113f)[_0x23d98f(0x1b8)](/\{ModelConfigs\}/g,_0xde054d)[_0x23d98f(0x1b8)](/\{ExampleModelName\}/g,_0x54d1d3)['replace'](/\{ApiFileName\}/g,_0x527c58||'api')[_0x23d98f(0x1b8)](/\{ConfigName\}/g,_0x245673||'default')[_0x23d98f(0x1b8)](/\{ClientConfigParam\}/g,_0x28b0e2||'')[_0x23d98f(0x1b8)](/\{CreatedAt\}/g,_0x44a28a);return _0x45fdbb;}static async[a61_0x25e3a7(0x1c3)](_0xa43e3,_0x53743b,_0x3c4381,_0xf2042e,_0x5e7ed1=!![]){const _0xe2ff2d=a61_0x25e3a7,_0x2b603b=Date[_0xe2ff2d(0x1ca)]();try{_0x5e7ed1&&logger[_0xe2ff2d(0x1cc)](_0xe2ff2d(0x1d8),_0xe2ff2d(0x1cb),{'templatePath':_0xa43e3,'targetPath':_0x53743b,'pageName':_0x3c4381,'templateName':_0xf2042e});await a61_0x2fee1a[_0xe2ff2d(0x1b9)]['mkdir'](_0x53743b,{'recursive':!![]}),await this[_0xe2ff2d(0x1d0)](_0xa43e3,_0x53743b,_0x3c4381,_0xf2042e);if(_0x5e7ed1){const _0xede5a2=Date[_0xe2ff2d(0x1ca)]()-_0x2b603b;logger[_0xe2ff2d(0x1bd)](_0xe2ff2d(0x1d8),_0xe2ff2d(0x1c8),_0xede5a2,{'pageName':_0x3c4381,'templateName':_0xf2042e});}}catch(_0x451627){if(_0x5e7ed1){const _0x19c0cf=Date[_0xe2ff2d(0x1ca)]()-_0x2b603b;logger[_0xe2ff2d(0x1ab)](_0xe2ff2d(0x1d8),'模板内容替换失败',{'templatePath':_0xa43e3,'targetPath':_0x53743b,'pageName':_0x3c4381,'templateName':_0xf2042e,'error':_0x451627 instanceof Error?_0x451627[_0xe2ff2d(0x1ac)]:String(_0x451627),'duration':_0x19c0cf});}throw _0x451627;}}static async['processDirectory'](_0x1ae37b,_0x50649d,_0x35276b,_0x2e9b3f){const _0x3473c3=a61_0x25e3a7,_0x56c7c3=await a61_0x2fee1a['promises']['readdir'](_0x1ae37b,{'withFileTypes':!![]});for(const _0x1583af of _0x56c7c3){const _0x3a47cf=a61_0x24a344[_0x3473c3(0x1e0)](_0x1ae37b,_0x1583af['name']);let _0x525a8c=a61_0x24a344[_0x3473c3(0x1e0)](_0x50649d,_0x1583af[_0x3473c3(0x1af)]);_0x1583af[_0x3473c3(0x1af)][_0x3473c3(0x1d2)]('.tpl')&&(_0x525a8c=a61_0x24a344[_0x3473c3(0x1e0)](_0x50649d,_0x1583af[_0x3473c3(0x1af)][_0x3473c3(0x1b8)](/\.tpl$/,'')));if(_0x1583af['isDirectory']())await a61_0x2fee1a[_0x3473c3(0x1b9)][_0x3473c3(0x1b1)](_0x525a8c,{'recursive':!![]}),await this[_0x3473c3(0x1d0)](_0x3a47cf,_0x525a8c,_0x35276b,_0x2e9b3f);else _0x1583af['isFile']()&&await this[_0x3473c3(0x1ce)](_0x3a47cf,_0x525a8c,_0x35276b,_0x2e9b3f);}}static async['processFile'](_0x21efc3,_0x2cb40c,_0x5ac83d,_0x30b11f){const _0x2fc4=a61_0x25e3a7,_0x19fcde=a61_0x24a344['extname'](_0x21efc3)['toLowerCase']();_0x21efc3['endsWith']('.tpl')&&(_0x2cb40c=_0x2cb40c['replace'](/\.tpl$/,''));const _0x34807b=[_0x2fc4(0x1ae),_0x2fc4(0x1d1),_0x2fc4(0x1d3),_0x2fc4(0x1d6),_0x2fc4(0x1c4),_0x2fc4(0x1b0),_0x2fc4(0x1d4),_0x2fc4(0x1c1),_0x2fc4(0x1a9)];if(_0x34807b[_0x2fc4(0x1e5)](_0x19fcde)||_0x21efc3['endsWith']('.tpl')){const _0x4b82d0=await a61_0x2fee1a[_0x2fc4(0x1b9)][_0x2fc4(0x1d5)](_0x21efc3,_0x2fc4(0x1bc)),_0x2c41a6=this[_0x2fc4(0x1c5)](_0x4b82d0,_0x5ac83d,_0x30b11f);await a61_0x2fee1a[_0x2fc4(0x1b9)][_0x2fc4(0x1e4)](_0x2cb40c,_0x2c41a6,'utf8');}else await a61_0x2fee1a[_0x2fc4(0x1b9)]['copyFile'](_0x21efc3,_0x2cb40c);}}
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.3",
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