@lovrabet/cli 1.1.22 → 1.1.25
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.
- package/lib/add-page/input-page-router.js +1 -1
- package/lib/add-page/main.js +1 -1
- package/lib/add-page/select-page-template.js +1 -1
- package/lib/api/api-doc-ui.js +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-pull-ui.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/main.js +1 -1
- package/lib/api/pull-silent.js +1 -1
- package/lib/app-menu/app-menu-sync-ui.js +1 -1
- package/lib/app-menu/create-menu.js +1 -1
- package/lib/app-menu/get-local-pages.js +1 -1
- package/lib/app-menu/get-online-menu-list.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/cmd/build-watch.js +1 -1
- package/lib/cmd/build.js +1 -1
- package/lib/cmd/logs.js +1 -1
- package/lib/cmd/preview.js +1 -1
- package/lib/cmd/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/task-finished.js +1 -1
- package/lib/create-app/task-loading.js +1 -1
- package/lib/create-app/task-running.js +1 -1
- package/lib/create-app/task-time.js +1 -1
- package/lib/create-app/use-copy-project-template.js +1 -1
- package/lib/create-app/use-format-code.js +1 -1
- package/lib/create-app/use-install-dependencies.js +1 -1
- package/lib/help.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/router-updater.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +1 -1
- package/templates/projects/sub-app-react-demo/package-lock.json +4 -4
- package/templates/projects/sub-app-react-demo/package.json +1 -1
- package/templates/rules/lovrabet_rules.mdc.tpl +181 -115
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x88e443,_0x2e4ee8){const _0x58d23c=a0_0x5950,_0x58980f=_0x88e443();while(!![]){try{const _0x4e81b7=-parseInt(_0x58d23c(0x12e))/0x1+parseInt(_0x58d23c(0x11d))/0x2+parseInt(_0x58d23c(0x121))/0x3+-parseInt(_0x58d23c(0x12c))/0x4*(parseInt(_0x58d23c(0x12a))/0x5)+-parseInt(_0x58d23c(0x11c))/0x6*(parseInt(_0x58d23c(0x118))/0x7)+-parseInt(_0x58d23c(0x116))/0x8*(parseInt(_0x58d23c(0x12f))/0x9)+parseInt(_0x58d23c(0x117))/0xa;if(_0x4e81b7===_0x2e4ee8)break;else _0x58980f['push'](_0x58980f['shift']());}catch(_0x465b3b){_0x58980f['push'](_0x58980f['shift']());}}}(a0_0x4976,0x8f659));import{jsx as a0_0x2eae5e,jsxs as a0_0x1ef935}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';function a0_0x5950(_0xd71865,_0xc0a50){const _0x4976ee=a0_0x4976();return a0_0x5950=function(_0x5950c1,_0x251502){_0x5950c1=_0x5950c1-0x111;let _0xc17bce=_0x4976ee[_0x5950c1];return _0xc17bce;},a0_0x5950(_0xd71865,_0xc0a50);}import a0_0x52b189 from'node:fs';export function InputProjectCode(_0x598e88){const _0x5ea525=a0_0x5950,{onSubmit:_0x3107a4,pagePath:_0x241fce}=_0x598e88,[_0x1d4f82,_0x4e3262]=useState(''),[_0x628784,_0x57ddc1]=useState(''),_0x5984a2='my-page';function _0x1e587d(_0x5ba49f){const _0x2f05c0=a0_0x5950;if(_0x5ba49f[_0x2f05c0(0x124)]>0x64)return{'valid':![],'message':_0x2f05c0(0x11f)};if(_0x5ba49f[_0x2f05c0(0x11a)]('/')||_0x5ba49f[_0x2f05c0(0x122)]('/'))return{'valid':![],'message':'路径不能以\x20/\x20开头或结尾'};if(_0x5ba49f[_0x2f05c0(0x127)]('//'))return{'valid':![],'message':'路径不能包含连续的\x20/'};const _0x26b977=_0x5ba49f[_0x2f05c0(0x114)]('/');for(const _0x2ef108 of _0x26b977){if(!_0x2ef108)continue;const _0x5b1588=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x5b1588[_0x2f05c0(0x11b)](_0x2ef108))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x5d3dd1,_0x3f9cb9)=>{const _0x46cfe2=a0_0x5950;if(_0x3f9cb9[_0x46cfe2(0x129)]){const _0x196f75=_0x1d4f82[_0x46cfe2(0x12d)]()||_0x5984a2;if(_0x628784)return;const _0x311998=_0x241fce+'/'+_0x196f75;if(a0_0x52b189[_0x46cfe2(0x119)](_0x311998)){_0x57ddc1(_0x46cfe2(0x126)+_0x196f75+'\x20已存在,请使用其他路径');return;}_0x3107a4(_0x196f75),_0x4e3262(''),_0x57ddc1('');}else _0x3f9cb9['backspace']||_0x3f9cb9[_0x46cfe2(0x125)]?_0x4e3262(_0x266a06=>{const _0x16310d=_0x46cfe2,_0x4ce00d=_0x266a06[_0x16310d(0x120)](0x0,-0x1),{valid:_0x164baf,message:_0x301625}=_0x1e587d(_0x4ce00d);return _0x57ddc1(_0x164baf?'':_0x301625||'页面路径不合法'),_0x4ce00d;}):_0x4e3262(_0x47ad6d=>{const _0x315cab=_0x46cfe2,_0x316968=_0x47ad6d+_0x5d3dd1,{valid:_0x4b1f06,message:_0x485628}=_0x1e587d(_0x316968);return _0x57ddc1(_0x4b1f06?'':_0x485628||_0x315cab(0x112)),_0x316968;});}),a0_0x1ef935(Box,{'flexDirection':_0x5ea525(0x113),'children':[a0_0x1ef935(Box,{'children':[a0_0x2eae5e(Text,{'color':_0x5ea525(0x115),'children':_0x5ea525(0x123)}),a0_0x2eae5e(Text,{'children':_0x5ea525(0x12b)}),_0x1d4f82?a0_0x2eae5e(Text,{'color':_0x5ea525(0x11e),'children':_0x1d4f82}):a0_0x2eae5e(Text,{'color':'gray','children':_0x5984a2}),_0x628784&&a0_0x1ef935(Text,{'color':_0x5ea525(0x130),'children':[_0x5ea525(0x128),_0x628784]})]}),!_0x628784&&!_0x1d4f82&&a0_0x2eae5e(Box,{'children':a0_0x2eae5e(Text,{'color':_0x5ea525(0x115),'children':_0x5ea525(0x111)})})]});}function a0_0x4976(){const _0x5e7a6d=['2761956eEbODz','endsWith','\x20Step2:\x20','length','delete','页面路径\x20','includes','\x20←\x20','return','10bFVUAd','页面路由地址:\x20','1757588gXkomh','trim','719169cYhCng','41841SRowtq','red','\x20直接回车确认,或输入自定义路由地址','页面路径不合法','column','split','gray','32lsfqLw','9454970gsaQIN','1163687QwLIBc','existsSync','startsWith','test','30WXXEeH','2337936CiqCYY','green','页面路径长度不能超过\x20100\x20个字符','slice'];a0_0x4976=function(){return _0x5e7a6d;};return a0_0x4976();}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x428504=a1_0x234f;(function(_0x15d344,_0x353e73){const _0x414ac4=a1_0x234f,_0x18f125=_0x15d344();while(!![]){try{const _0x2f4dfd=-parseInt(_0x414ac4(0x102))/0x1*(parseInt(_0x414ac4(0xf5))/0x2)+parseInt(_0x414ac4(0x104))/0x3*(parseInt(_0x414ac4(0x10d))/0x4)+parseInt(_0x414ac4(0x10a))/0x5+parseInt(_0x414ac4(0xfa))/0x6+parseInt(_0x414ac4(0xf3))/0x7+-parseInt(_0x414ac4(0x106))/0x8*(-parseInt(_0x414ac4(0x110))/0x9)+-parseInt(_0x414ac4(0x112))/0xa*(parseInt(_0x414ac4(0x10f))/0xb);if(_0x2f4dfd===_0x353e73)break;else _0x18f125['push'](_0x18f125['shift']());}catch(_0x1f51e8){_0x18f125['push'](_0x18f125['shift']());}}}(a1_0x366a,0x85420));import{jsx as a1_0x12b4f7,jsxs as a1_0x20d4ac,Fragment as a1_0x44c62b}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0xc97a30 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';function a1_0x234f(_0xa41ca3,_0x89a1e){const _0x366abc=a1_0x366a();return a1_0x234f=function(_0x234f5a,_0x299a2d){_0x234f5a=_0x234f5a-0xf0;let _0x1c977c=_0x366abc[_0x234f5a];return _0x1c977c;},a1_0x234f(_0xa41ca3,_0x89a1e);}import{InputProjectCode}from'./input-page-router.js';function a1_0x366a(){const _0x2412c0=['success','src','页面添加失败:\x20','4626084iJSLhg','finally','add-page','gray','\x20*\x20路由地址:\x20','正在创建页面,请稍候…','now','green','3DDVFIi','\x20*\x20页面创建成功!','30VRWqkD','message','57752ZQLdqW','\x20*\x20页面文件已创建,可直接通过路由访问','cyan','cwd','961910ifTLCS','processTemplate','catch','65344KJcJEk','dirname','1507XhRXDK','513SGByhh','setLogPath','42340kzACKT','\x20Step2:\x20','join','已选择页面模板\x20','2442629FBLlSD','pages','507536KSVrCF','resolve'];a1_0x366a=function(){return _0x2412c0;};return a1_0x366a();}import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0xc97a30[a1_0x428504(0x10e)](fileURLToPath(import.meta['url'])),pageTemplateDir=a1_0xc97a30[a1_0x428504(0xf6)](__dirname,'../../templates/pages'),projectDir=process[a1_0x428504(0x109)]();export const AddPage=()=>{const _0x541bf2=a1_0x428504,{exit:_0x5129e9}=useApp(),[_0x537ccb,_0x480ac2]=useState(''),[_0x4ed8d0,_0x287a89]=useState(''),[_0x598f7a,_0x3b2cc6]=useState(![]),[_0x762a7a,_0x4b193a]=useState(![]),_0x2dfc12=a1_0xc97a30['join'](projectDir,_0x541bf2(0xf8),_0x541bf2(0xf4)),_0x15f8fe=a1_0xc97a30[_0x541bf2(0xf1)](_0x2dfc12,_0x4ed8d0),_0x414523=a1_0xc97a30[_0x541bf2(0xf1)](_0x541bf2(0xf8),'pages',_0x4ed8d0);useEffect(()=>{const _0xb9a63a=_0x541bf2,_0x4f1093=a1_0xc97a30['resolve'](pageTemplateDir,_0x537ccb);if(_0x537ccb&&_0x4ed8d0){_0x3b2cc6(!![]),logger[_0xb9a63a(0x111)](process[_0xb9a63a(0x109)]());const _0x15bd5d=Date[_0xb9a63a(0x100)]();logger['info'](_0xb9a63a(0xfc),'开始添加页面:\x20'+_0x4ed8d0,{'template':_0x537ccb,'targetPath':_0x414523}),TemplateReplacer[_0xb9a63a(0x10b)](_0x4f1093,a1_0xc97a30[_0xb9a63a(0xf1)](_0x2dfc12,_0x4ed8d0),_0x4ed8d0,_0x537ccb)['then'](()=>{const _0x374a9b=_0xb9a63a,_0x257492=Date['now']()-_0x15bd5d;logger[_0x374a9b(0xf7)]('add-page','页面添加成功:\x20'+_0x4ed8d0,_0x257492,{'template':_0x537ccb,'targetPath':_0x414523,'routePath':_0x4ed8d0}),_0x4b193a(!![]);})[_0xb9a63a(0x10c)](_0x3d9b76=>{const _0x21b0cd=_0xb9a63a,_0x56f513=Date['now']()-_0x15bd5d;logger['error']('add-page',_0x21b0cd(0xf9)+_0x4ed8d0,{'template':_0x537ccb,'targetPath':_0x414523,'error':_0x3d9b76 instanceof Error?_0x3d9b76[_0x21b0cd(0x105)]:String(_0x3d9b76),'duration':_0x56f513});})[_0xb9a63a(0xfb)](()=>{_0x3b2cc6(![]);});}},[_0x537ccb,_0x4ed8d0]),useEffect(()=>{_0x762a7a&&setTimeout(()=>{_0x5129e9();});},[_0x762a7a]);if(_0x537ccb)return a1_0x20d4ac(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x20d4ac(Box,{'children':[a1_0x12b4f7(Text,{'color':'gray','children':'\x20Step1:\x20'}),a1_0x12b4f7(Text,{'children':_0x541bf2(0xf2)}),a1_0x12b4f7(Text,{'color':_0x541bf2(0x101),'children':_0x537ccb})]}),_0x4ed8d0?a1_0x20d4ac(Box,{'children':[a1_0x12b4f7(Text,{'color':_0x541bf2(0xfd),'children':_0x541bf2(0xf0)}),a1_0x12b4f7(Text,{'children':'已输入的页面路由\x20'}),a1_0x12b4f7(Text,{'color':_0x541bf2(0x101),'children':_0x4ed8d0})]}):a1_0x12b4f7(InputProjectCode,{'pagePath':_0x15f8fe,'onSubmit':_0x287a89}),_0x4ed8d0&&_0x598f7a?a1_0x20d4ac(Box,{'marginTop':0x1,'children':[a1_0x12b4f7(Box,{'width':'4'}),a1_0x12b4f7(Text,{'children':_0x541bf2(0xff)})]}):null,_0x762a7a?a1_0x20d4ac(a1_0x44c62b,{'children':[a1_0x12b4f7(Box,{'marginTop':0x1,'children':a1_0x12b4f7(Text,{'color':_0x541bf2(0xfd),'children':_0x541bf2(0x103)})}),a1_0x20d4ac(Box,{'children':[a1_0x12b4f7(Text,{'color':_0x541bf2(0xfd),'children':'\x20*\x20页面路径:\x20'}),a1_0x12b4f7(Text,{'color':_0x541bf2(0x101),'children':_0x414523})]}),a1_0x20d4ac(Box,{'children':[a1_0x12b4f7(Text,{'color':'gray','children':_0x541bf2(0xfe)}),a1_0x20d4ac(Text,{'color':_0x541bf2(0x101),'children':['/',_0x4ed8d0]})]}),a1_0x12b4f7(Box,{'marginTop':0x1,'children':a1_0x12b4f7(Text,{'color':_0x541bf2(0x108),'children':_0x541bf2(0x107)})})]}):null]});return a1_0x12b4f7(SelectPageTemplate,{'onSelect':_0x480ac2});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2a16fa,_0x3036f6){const _0x36013e=a2_0x31cf,_0x189484=_0x2a16fa();while(!![]){try{const _0x40d670=parseInt(_0x36013e(0xb5))/0x1+-parseInt(_0x36013e(0xca))/0x2*(-parseInt(_0x36013e(0xb3))/0x3)+-parseInt(_0x36013e(0xcb))/0x4+parseInt(_0x36013e(0xcf))/0x5+-parseInt(_0x36013e(0xbf))/0x6*(-parseInt(_0x36013e(0xc1))/0x7)+parseInt(_0x36013e(0xbd))/0x8*(-parseInt(_0x36013e(0xd0))/0x9)+-parseInt(_0x36013e(0xb8))/0xa;if(_0x40d670===_0x3036f6)break;else _0x189484['push'](_0x189484['shift']());}catch(_0x3ff0e3){_0x189484['push'](_0x189484['shift']());}}}(a2_0x457e,0x2f0e9));function a2_0x457e(){const _0xec32=['\x20\x20\x20\x20\x20\x20\x20\x20','18VmpCLt','map','340972OnzuNw','sort','\x20\x20\x20\x20\x20\x20>\x20','3913490MRLHYz','\x20Step1:\x20','column','../..','isDirectory','21304sNKnlw','localeCompare','708KBbpDU','length','1645zvMMbt','label','正在加载页面模板...','templates/pages','sdk-fetch','error','resolve','green','filter','86682RrgkjE','278236rdmSmi','blank','return','url','390825rxiGbx','180rKxAOI'];a2_0x457e=function(){return _0xec32;};return a2_0x457e();}import{jsx as a2_0x32dec3,jsxs as a2_0x35024d}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';function a2_0x31cf(_0x51c38e,_0x2d9175){const _0x457ebe=a2_0x457e();return a2_0x31cf=function(_0x31cf97,_0x1fab64){_0x31cf97=_0x31cf97-0xb3;let _0x227046=_0x457ebe[_0x31cf97];return _0x227046;},a2_0x31cf(_0x51c38e,_0x2d9175);}import a2_0x1f12d6 from'node:path';import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x46945f=a2_0x31cf;try{const _0x4064aa=fileURLToPath(import.meta[_0x46945f(0xce)]),_0x42757c=a2_0x1f12d6[_0x46945f(0xc7)](a2_0x1f12d6['dirname'](_0x4064aa),_0x46945f(0xbb)),_0x32219c=a2_0x1f12d6['join'](_0x42757c,_0x46945f(0xc4)),_0x4be4c5=await readdir(_0x32219c,{'withFileTypes':!![]}),_0x52d2ef=_0x4be4c5[_0x46945f(0xc9)](_0x329b9f=>_0x329b9f[_0x46945f(0xbc)]())[_0x46945f(0xb4)](_0x3cbf93=>({'label':_0x3cbf93['name']}))[_0x46945f(0xb6)]((_0x21148b,_0x223ddf)=>_0x21148b[_0x46945f(0xc2)][_0x46945f(0xbe)](_0x223ddf[_0x46945f(0xc2)]));return _0x52d2ef;}catch(_0x35e4e2){return console[_0x46945f(0xc6)]('获取模板列表失败:',_0x35e4e2),[{'label':_0x46945f(0xcc)},{'label':_0x46945f(0xc5)}];}}export function SelectPageTemplate(_0x2e5f76){const _0x6cce02=a2_0x31cf,[_0x49573a,_0x2ed60f]=useState(0x0),[_0x2ab2fe,_0x5d7530]=useState([]),[_0x5e1edd,_0xb0fee9]=useState(!![]);useEffect(()=>{async function _0x3a675c(){const _0x571521=await getTemplateList();_0x5d7530(_0x571521),_0xb0fee9(![]);}_0x3a675c();},[]),useInput((_0x506e44,_0x196f4c)=>{const _0x3bd569=a2_0x31cf;if(_0x5e1edd)return;if(_0x196f4c[_0x3bd569(0xcd)]){const _0x13ba88=_0x2ab2fe[_0x49573a];_0x13ba88&&_0x2e5f76['onSelect'](_0x13ba88[_0x3bd569(0xc2)]);}_0x196f4c['upArrow']&&_0x2ed60f(_0x5ef677=>_0x5ef677===0x0?_0x2ab2fe[_0x3bd569(0xc0)]-0x1:_0x5ef677-0x1),_0x196f4c['downArrow']&&_0x2ed60f(_0x33476e=>_0x33476e===_0x2ab2fe[_0x3bd569(0xc0)]-0x1?0x0:_0x33476e+0x1);});if(_0x5e1edd)return a2_0x32dec3(Box,{'flexDirection':_0x6cce02(0xba),'paddingY':0x1,'children':a2_0x35024d(Box,{'children':[a2_0x32dec3(Text,{'color':'gray','children':_0x6cce02(0xb9)}),a2_0x32dec3(Text,{'children':_0x6cce02(0xc3)})]})});return a2_0x35024d(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x35024d(Box,{'children':[a2_0x32dec3(Text,{'color':'gray','children':_0x6cce02(0xb9)}),a2_0x32dec3(Text,{'children':'请选择您要创建的页面模板'})]}),_0x2ab2fe[_0x6cce02(0xb4)]((_0x2ec7f7,_0x156b8a)=>{const _0x2e9a62=_0x6cce02,_0x3aaf19=_0x156b8a===_0x49573a,_0x5e0eb8=_0x3aaf19?_0x2e9a62(0xb7)+_0x2ec7f7['label']:_0x2e9a62(0xd1)+_0x2ec7f7[_0x2e9a62(0xc2)];return a2_0x32dec3(Box,{'children':a2_0x32dec3(Text,{'color':_0x3aaf19?_0x2e9a62(0xc8):undefined,'children':_0x5e0eb8})},_0x5e0eb8);})]});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x52c13e,_0xe54b03){const _0x2b12ef=a3_0x1e09,_0x256be8=_0x52c13e();while(!![]){try{const _0x31eedc=parseInt(_0x2b12ef(0x13e))/0x1*(-parseInt(_0x2b12ef(0x130))/0x2)+parseInt(_0x2b12ef(0x159))/0x3+-parseInt(_0x2b12ef(0x13a))/0x4+parseInt(_0x2b12ef(0x134))/0x5+-parseInt(_0x2b12ef(0x13f))/0x6+-parseInt(_0x2b12ef(0x14f))/0x7+parseInt(_0x2b12ef(0x14c))/0x8;if(_0x31eedc===_0xe54b03)break;else _0x256be8['push'](_0x256be8['shift']());}catch(_0x10e2db){_0x256be8['push'](_0x256be8['shift']());}}}(a3_0x144b,0x3c256));import{jsx as a3_0x141110,jsxs as a3_0x171d66,Fragment as a3_0x41c611}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a3_0x144b(){const _0x46622a=['37799lAlXXl','1779576rbHRRc','api-doc','env','filePath','column','cyan','join','*\x20共处理\x20','map','文档生成失败:\x20','正在生成\x20','指定的数据集代码都不存在:\x20','green','1034872VgolGP','\x1b[90m*\x20从\x20','length','1566523vdmkBI','setLogPath','√\x20文档生成完成!成功\x20','success','未提供应用AppCode,且配置中也没有默认值','\x1b[33m!\x20以下数据集代码不存在:\x20','yellow','🚀\x20','💡\x20请使用\x20','⚠️\x20以下数据集生成失败:','1314399QbPMEy','online','lovrabet\x20auth','未找到任何数据集','\x20-\x20','datasetCode','datasetName','includes','\x20个匹配的数据集\x1b[0m','gray','2cJJwHl','\x20个数据集','\x1b[0m','filter','1972035IDLHOg','red','使用配置的应用AppCode:\x20','log','error','dim','629428InBCXr','\x20个数据集中筛选出\x20','\x20个数据集的文档...','./docs'];a3_0x144b=function(){return _0x46622a;};return a3_0x144b();}import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';function a3_0x1e09(_0x48675a,_0x43c08c){const _0x144bca=a3_0x144b();return a3_0x1e09=function(_0x1e092c,_0x17f406){_0x1e092c=_0x1e092c-0x127;let _0x1d6b46=_0x144bca[_0x1e092c];return _0x1d6b46;},a3_0x1e09(_0x48675a,_0x43c08c);}export const ApiDocUI=({appCode:_0x26398a,env:_0x34b9d7,output:_0x374146,extraParams:_0x5bb76c,datasetCodes:_0x171548})=>{const _0x4094a6=a3_0x1e09,{exit:_0x1beb3b}=useApp(),[_0x42f044,_0x1fce8f]=useState(![]),[_0x47a19f,_0x344e3b]=useState(''),[_0x3d8321,_0x377d7a]=useState(![]),[_0x5ab449,_0x1c4c3d]=useState(null),[_0xcbd540,_0x3070ae]=useState(null),[_0xaf8456,_0x1eb406]=useState(0x0),_0x12d6cd=readConfig(),_0x16a19d=getConfigAppCode(),_0x50f593=_0x26398a||_0x16a19d,_0x3e7647=typeof _0x12d6cd?.[_0x4094a6(0x141)]==='string'?_0x12d6cd[_0x4094a6(0x141)]:undefined,_0xd10de5=_0x34b9d7||_0x3e7647||_0x4094a6(0x127);initEnv(_0xd10de5);const _0x25549a=_0x374146||_0x4094a6(0x13d),_0xb9b8eb=_0x26398a?'使用指定的应用AppCode:\x20'+_0x50f593:_0x4094a6(0x136)+_0x50f593;useEffect(()=>{_0x1fce8f(!![]),_0x41cc88();},[]),useEffect(()=>{(_0x3d8321||_0x5ab449)&&_0x1beb3b();},[_0x3d8321,_0x5ab449,_0x1beb3b]);async function _0x41cc88(){const _0x1442a4=_0x4094a6;if(!_0x50f593){_0x1c4c3d(_0x1442a4(0x153));return;}try{logger[_0x1442a4(0x150)](process['cwd']()),_0x344e3b('正在获取数据集列表...');const {configArray:_0x5dad0d}=await fetchModelList(_0x50f593);_0x1eb406(_0x5dad0d[_0x1442a4(0x14e)]);if(_0x5dad0d[_0x1442a4(0x14e)]===0x0){_0x1c4c3d(_0x1442a4(0x129));return;}let _0x3cb0c5=_0x5dad0d;if(_0x171548&&_0x171548[_0x1442a4(0x14e)]>0x0){_0x3cb0c5=_0x5dad0d[_0x1442a4(0x133)](_0x466818=>_0x171548[_0x1442a4(0x12d)](_0x466818[_0x1442a4(0x12b)]));const _0x2b3d2e=_0x3cb0c5['map'](_0x328b37=>_0x328b37[_0x1442a4(0x12b)]),_0x39b12b=_0x171548[_0x1442a4(0x133)](_0x36a7ff=>!_0x2b3d2e['includes'](_0x36a7ff));_0x39b12b['length']>0x0&&console[_0x1442a4(0x137)](_0x1442a4(0x154)+_0x39b12b['join'](',\x20')+_0x1442a4(0x132));if(_0x3cb0c5['length']===0x0){_0x1c4c3d(_0x1442a4(0x14a)+_0x171548[_0x1442a4(0x145)](',\x20'));return;}console[_0x1442a4(0x137)](_0x1442a4(0x14d)+_0x5dad0d[_0x1442a4(0x14e)]+_0x1442a4(0x13b)+_0x3cb0c5[_0x1442a4(0x14e)]+_0x1442a4(0x12e));}_0x344e3b(_0x1442a4(0x149)+_0x3cb0c5[_0x1442a4(0x14e)]+_0x1442a4(0x13c));const _0x5c0989=await generateDatasetDocs(_0x3cb0c5,_0x50f593,_0x25549a,(_0x105847,_0x344238,_0x213703)=>{const _0x6c7b80=_0x1442a4;_0x344e3b(_0x6c7b80(0x149)+_0x213703+'.md\x20('+_0x105847+'/'+_0x344238+')');},_0x5bb76c);_0x3070ae(_0x5c0989),_0x377d7a(!![]);const _0x519fed=_0x5c0989[_0x1442a4(0x133)](_0x5522fd=>_0x5522fd[_0x1442a4(0x152)])[_0x1442a4(0x14e)],_0x3a47b4=_0x5c0989[_0x1442a4(0x133)](_0x4d6671=>!_0x4d6671[_0x1442a4(0x152)])[_0x1442a4(0x14e)];logger[_0x1442a4(0x152)](_0x1442a4(0x140),'文档生成完成',undefined,{'totalCount':_0x5c0989[_0x1442a4(0x14e)],'successCount':_0x519fed,'failCount':_0x3a47b4,'outputDir':_0x25549a});}catch(_0x2270c8){const _0x340ea9=_0x2270c8 instanceof Error?_0x2270c8['message']:String(_0x2270c8);logger[_0x1442a4(0x138)](_0x1442a4(0x140),_0x1442a4(0x148)+_0x340ea9,{'appCode':_0x50f593,'outputDir':_0x25549a}),_0x1c4c3d('文档生成失败:\x20'+_0x340ea9);}finally{_0x1fce8f(![]);}}const _0x8cd601=_0xcbd540?.[_0x4094a6(0x133)](_0x5872b6=>_0x5872b6[_0x4094a6(0x152)])[_0x4094a6(0x14e)]||0x0,_0x4dc94f=_0xcbd540?.['filter'](_0x48ce1a=>!_0x48ce1a[_0x4094a6(0x152)])['length']||0x0;return a3_0x171d66(Box,{'flexDirection':'column','children':[(_0x42f044||_0x3d8321)&&a3_0x171d66(Box,{'children':[a3_0x141110(Text,{'color':'gray','children':'*\x20'}),a3_0x141110(Text,{'color':_0x26398a?'white':_0x4094a6(0x139),'children':_0xb9b8eb})]}),_0x42f044&&a3_0x141110(Box,{'children':a3_0x171d66(Text,{'children':[_0x4094a6(0x156),_0x47a19f,'\x20(环境:\x20',_0xd10de5,')']})}),_0x3d8321&&_0xcbd540&&a3_0x171d66(Box,{'flexDirection':_0x4094a6(0x143),'children':[a3_0x141110(Box,{'children':a3_0x171d66(Text,{'color':_0x4094a6(0x14b),'children':[_0x4094a6(0x151),_0x8cd601,'\x20个',_0x4dc94f>0x0&&',\x20失败\x20'+_0x4dc94f+'\x20个']})}),a3_0x141110(Box,{'marginTop':0x1,'children':a3_0x171d66(Text,{'color':_0x4094a6(0x12f),'children':[_0x4094a6(0x146),_0xaf8456,_0x4094a6(0x131)]})}),a3_0x171d66(Box,{'marginTop':0x1,'children':[a3_0x141110(Text,{'color':_0x4094a6(0x12f),'children':'*\x20输出目录:\x20'}),a3_0x141110(Text,{'color':_0x4094a6(0x144),'children':_0x25549a})]}),_0x8cd601>0x0&&a3_0x171d66(a3_0x41c611,{'children':[a3_0x141110(Box,{'marginTop':0x1,'children':a3_0x141110(Text,{'color':_0x4094a6(0x12f),'children':'*\x20生成的文档文件:'})}),_0xcbd540['filter'](_0x224e36=>_0x224e36['success'])[_0x4094a6(0x147)]((_0x2776e3,_0x2f100b)=>a3_0x171d66(Box,{'marginLeft':0x2,'children':[a3_0x171d66(Text,{'color':'cyan','children':['•\x20',_0x2776e3[_0x4094a6(0x142)]]}),a3_0x171d66(Text,{'color':'dim','children':[_0x4094a6(0x12a),_0x2776e3['datasetName']]})]},_0x2f100b))]}),_0x4dc94f>0x0&&a3_0x171d66(a3_0x41c611,{'children':[a3_0x141110(Box,{'marginTop':0x1,'children':a3_0x141110(Text,{'color':_0x4094a6(0x155),'children':_0x4094a6(0x158)})}),_0xcbd540[_0x4094a6(0x133)](_0x22723a=>!_0x22723a[_0x4094a6(0x152)])[_0x4094a6(0x147)]((_0x67158f,_0x3f432b)=>a3_0x171d66(Box,{'marginLeft':0x2,'flexDirection':_0x4094a6(0x143),'children':[a3_0x171d66(Text,{'color':_0x4094a6(0x135),'children':['•\x20',_0x67158f[_0x4094a6(0x12c)],'\x20(',_0x67158f[_0x4094a6(0x12b)],')']}),_0x67158f[_0x4094a6(0x138)]&&a3_0x141110(Box,{'marginLeft':0x2,'children':a3_0x141110(Text,{'color':_0x4094a6(0x139),'children':_0x67158f[_0x4094a6(0x138)]})})]},_0x3f432b))]})]}),_0x5ab449&&a3_0x171d66(Box,{'flexDirection':_0x4094a6(0x143),'children':[a3_0x141110(Box,{'children':a3_0x171d66(Text,{'color':_0x4094a6(0x135),'children':['❌\x20',_0x5ab449]})}),_0x5ab449['includes']('登录')&&a3_0x171d66(Box,{'marginTop':0x1,'children':[a3_0x141110(Text,{'color':'yellow','children':_0x4094a6(0x157)}),a3_0x141110(Text,{'color':_0x4094a6(0x144),'children':_0x4094a6(0x128)}),a3_0x141110(Text,{'color':_0x4094a6(0x155),'children':'\x20重新登录后再试'})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a4_0x3201(){const _0x3b014b=['POST','utf8','markdown','join','length','生成文档失败:\x20','success','✗\x20失败:\x20','1412073TLrVxV','api-doc','\x0a共有\x20','.md\x20(','push','status','1156567GIUcjy','2989789slgIKv','5017300NVBkWm','1776ZwVlBO','233996pnEWOe','stringify','获取文档失败\x20(','),HTTP状态码:\x20','/api/node-toolbox/api-doc-generator','data','33678imIlow','string','2nSwzIm','\x20个数据集需要生成文档\x0a','tableName','application/json','log','996652atcixv','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','等待\x203\x20秒...\x0a','error','✓\x20成功生成:\x20','name',']\x20正在生成:\x20','246WzXuGv','.md','180JKIoJU','datasetCode'];a4_0x3201=function(){return _0x3b014b;};return a4_0x3201();}(function(_0xc81e8a,_0x283a1f){const _0x1538b2=a4_0x22d2,_0x5f1ea3=_0xc81e8a();while(!![]){try{const _0x49b243=parseInt(_0x1538b2(0xd4))/0x1*(-parseInt(_0x1538b2(0xe0))/0x2)+parseInt(_0x1538b2(0xce))/0x3+-parseInt(_0x1538b2(0xe5))/0x4+-parseInt(_0x1538b2(0xd6))/0x5+parseInt(_0x1538b2(0xc2))/0x6*(-parseInt(_0x1538b2(0xd8))/0x7)+-parseInt(_0x1538b2(0xd7))/0x8*(parseInt(_0x1538b2(0xde))/0x9)+parseInt(_0x1538b2(0xc4))/0xa*(parseInt(_0x1538b2(0xd5))/0xb);if(_0x49b243===_0x283a1f)break;else _0x5f1ea3['push'](_0x5f1ea3['shift']());}catch(_0x43f079){_0x5f1ea3['push'](_0x5f1ea3['shift']());}}}(a4_0x3201,0xb7be3));function a4_0x22d2(_0x25dbe3,_0x47b1d3){const _0x320130=a4_0x3201();return a4_0x22d2=function(_0x22d28f,_0x32c9be){_0x22d28f=_0x22d28f-0xbf;let _0x2d6ff1=_0x320130[_0x22d28f];return _0x2d6ff1;},a4_0x22d2(_0x25dbe3,_0x47b1d3);}import{mkdirSync,writeFileSync}from'node:fs';import a4_0x3e71f8 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x36b4c7){const _0x5eed95=a4_0x22d2,{appCode:_0xb9d140,datasetCode:_0x42436e,datasetId:_0x464267,extraParams:_0x240524}=_0x36b4c7,_0x20f9db=getApiDomain(),_0x1d94cf=_0x20f9db+_0x5eed95(0xdc),_0x2b3cbe={'appCode':_0xb9d140,'datasetCode':_0x42436e,'datasetId':_0x464267,..._0x240524||{}},_0x21680c=await fetch(_0x1d94cf,{'method':_0x5eed95(0xc6),'headers':{'Content-Type':_0x5eed95(0xe3),'Cookie':getCookie()},'body':JSON[_0x5eed95(0xd9)](_0x2b3cbe)});if(!_0x21680c['ok']){if(_0x21680c['status']===0x191)throw new Error(_0x5eed95(0xe6));let _0x1784ce='';try{_0x1784ce=await _0x21680c['text']();}catch(_0x2b4565){}throw new Error(_0x5eed95(0xda)+_0x42436e+_0x5eed95(0xdb)+_0x21680c[_0x5eed95(0xd3)]+(_0x1784ce?'\x0a'+_0x1784ce:''));}const _0x25565f=await _0x21680c['json']();if(!_0x25565f[_0x5eed95(0xdd)]||typeof _0x25565f['data']['markdown']!==_0x5eed95(0xdf))throw new Error('响应数据格式错误\x20('+_0x42436e+'):缺少\x20data.markdown\x20字段');return _0x25565f['data'][_0x5eed95(0xc8)];}function delay(_0x387e7f){return new Promise(_0x12473b=>setTimeout(_0x12473b,_0x387e7f));}export async function generateDatasetDocs(_0x1181e3,_0xb42ed9,_0x4d1127='./docs',_0xa81949,_0x286094){const _0x46b0f4=a4_0x22d2;mkdirSync(_0x4d1127,{'recursive':!![]});const _0x4afb03=[],_0x28438b=_0x1181e3['length'];console[_0x46b0f4(0xe4)](_0x46b0f4(0xd0)+_0x28438b+_0x46b0f4(0xe1));for(let _0x4e37be=0x0;_0x4e37be<_0x1181e3[_0x46b0f4(0xca)];_0x4e37be++){const _0x34a3bb=_0x1181e3[_0x4e37be],_0x2aacfd=_0x4e37be+0x1,_0x3a85a3=_0x34a3bb[_0x46b0f4(0xe2)];try{console[_0x46b0f4(0xe4)]('['+_0x2aacfd+'/'+_0x28438b+_0x46b0f4(0xc1)+_0x3a85a3+_0x46b0f4(0xd1)+_0x34a3bb['name']+')');_0xa81949&&_0xa81949(_0x2aacfd,_0x28438b,_0x3a85a3);const _0x281121=await fetchDatasetDoc({'appCode':_0xb42ed9,'datasetCode':_0x34a3bb[_0x46b0f4(0xc5)],'datasetId':_0x34a3bb['id'],'enableAI':![],'extraParams':_0x286094}),_0x5498e6=a4_0x3e71f8[_0x46b0f4(0xc9)](_0x4d1127,_0x3a85a3+_0x46b0f4(0xc3));writeFileSync(_0x5498e6,_0x281121,{'encoding':_0x46b0f4(0xc7)}),console[_0x46b0f4(0xe4)](_0x46b0f4(0xbf)+_0x3a85a3+'.md'),logger[_0x46b0f4(0xcc)](_0x46b0f4(0xcf),'生成文档成功:\x20'+_0x3a85a3,undefined,{'datasetCode':_0x34a3bb[_0x46b0f4(0xc5)],'datasetName':_0x34a3bb[_0x46b0f4(0xc0)],'filePath':_0x5498e6,'progress':_0x2aacfd+'/'+_0x28438b}),_0x4afb03['push']({'datasetCode':_0x34a3bb[_0x46b0f4(0xc5)],'datasetName':_0x34a3bb[_0x46b0f4(0xc0)],'filePath':_0x5498e6,'success':!![]}),_0x2aacfd<_0x28438b&&await delay(0x1388);}catch(_0x4a035a){const _0x5f53d3=_0x4a035a instanceof Error?_0x4a035a['message']:String(_0x4a035a);console['log'](_0x46b0f4(0xcd)+_0x3a85a3+'.md\x20-\x20'+_0x5f53d3+'\x0a'),logger[_0x46b0f4(0xe8)](_0x46b0f4(0xcf),_0x46b0f4(0xcb)+_0x34a3bb['datasetCode'],{'datasetCode':_0x34a3bb[_0x46b0f4(0xc5)],'datasetName':_0x34a3bb['name'],'error':_0x5f53d3,'progress':_0x2aacfd+'/'+_0x28438b}),_0x4afb03[_0x46b0f4(0xd2)]({'datasetCode':_0x34a3bb[_0x46b0f4(0xc5)],'datasetName':_0x34a3bb['name'],'filePath':'','success':![],'error':_0x5f53d3}),_0x2aacfd<_0x28438b&&(console[_0x46b0f4(0xe4)](_0x46b0f4(0xe7)),await delay(0xbb8));}}return _0x4afb03;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2e0d2d,_0x2adc8e){const _0x1b0aa4=a5_0x11f0,_0x513db4=_0x2e0d2d();while(!![]){try{const _0x4c6a08=parseInt(_0x1b0aa4(0x161))/0x1*(parseInt(_0x1b0aa4(0x171))/0x2)+parseInt(_0x1b0aa4(0x156))/0x3*(parseInt(_0x1b0aa4(0x173))/0x4)+-parseInt(_0x1b0aa4(0x18a))/0x5+-parseInt(_0x1b0aa4(0x17e))/0x6*(-parseInt(_0x1b0aa4(0x155))/0x7)+-parseInt(_0x1b0aa4(0x16f))/0x8+-parseInt(_0x1b0aa4(0x163))/0x9*(-parseInt(_0x1b0aa4(0x15b))/0xa)+-parseInt(_0x1b0aa4(0x166))/0xb*(parseInt(_0x1b0aa4(0x15a))/0xc);if(_0x4c6a08===_0x2adc8e)break;else _0x513db4['push'](_0x513db4['shift']());}catch(_0x51d39b){_0x513db4['push'](_0x513db4['shift']());}}}(a5_0xf795,0x62e92));import{jsx as a5_0x421655,jsxs as a5_0x34b489}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a5_0x11f0(_0x466209,_0xb14059){const _0xf7952a=a5_0xf795();return a5_0x11f0=function(_0x11f0a5,_0x5c6378){_0x11f0a5=_0x11f0a5-0x153;let _0x44685d=_0xf7952a[_0x11f0a5];return _0x44685d;},a5_0x11f0(_0x466209,_0xb14059);}import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';function a5_0xf795(){const _0x5c6ded=['\x20-\x20客户端实例文件','\x20重新登录后再试','client','\x20from\x20\x27@/','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','datasetCount','\x20个,过滤重复','\x20个模型','yellow','white','cyan','1178390MNlZxh','使用配置的应用AppCode:\x20','error','2102191SWFCtC','1936914lJYjPM','message','💡\x20请使用\x20','api','204xbBAXS','1000qiNqOE','red','originalCount','./src/api/','{\x20lovrabetClient\x20}','import\x20','40646voNiAM','replace','38295ujdyLH','.ts','endsWith','567479wreWHB','gray','未提供应用AppCode,且配置中也没有默认值','\x20个模型)','string','拉取\x20API\x20配置失败:\x20','cwd','env','column','129648QBHJcB','dim','8bKMPXC','duplicateCount','4ibBoom','setLogPath','green','includes','-\x20模型配置文件\x20(','modelCount','*\x20导入方式:','-client','\x20个数据集,生成','slice','使用指定的应用AppCode:\x20','6DDTdjw'];a5_0xf795=function(){return _0x5c6ded;};return a5_0xf795();}import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x596684,env:_0x46869d,output:_0x49c8a6})=>{const _0x249f6b=a5_0x11f0,{exit:_0x4a3e43}=useApp(),[_0x40f72a,_0x25f2c5]=useState(![]),[_0x5c0cfc,_0x11f738]=useState(![]),[_0x2e93ad,_0xda4d85]=useState(null),[_0x4b570f,_0x582481]=useState(null),_0x5ba2e9=readConfig(),_0x5f2f2f=getConfigAppCode(),_0x311b64=_0x596684||_0x5f2f2f,_0x8babb2=typeof _0x5ba2e9?.[_0x249f6b(0x16d)]===_0x249f6b(0x16a)?_0x5ba2e9[_0x249f6b(0x16d)]:undefined,_0x547f07=_0x46869d||_0x8babb2||'online';initEnv(_0x547f07);const _0x186d01=_0x49c8a6||_0x249f6b(0x15e),_0x5f2dc1=_0x596684&&_0x596684[_0x249f6b(0x176)]('-')?_0x596684['split']('-')[_0x249f6b(0x17c)](0x1)['join']('-'):'',_0x4cdb3c=_0x596684?_0x249f6b(0x17d)+_0x311b64:_0x249f6b(0x153)+_0x311b64,_0x4f76c4=_0x5f2dc1?_0x5f2dc1+'-api':_0x249f6b(0x159),_0x33b4a2=_0x5f2dc1?_0x5f2dc1+_0x249f6b(0x17a):_0x249f6b(0x181);useEffect(()=>{_0x25f2c5(!![]),_0x77fc51();},[]),useEffect(()=>{(_0x5c0cfc||_0x2e93ad)&&_0x4a3e43();},[_0x5c0cfc,_0x2e93ad,_0x4a3e43]);async function _0x77fc51(){const _0xc68977=_0x249f6b;if(!_0x311b64){_0xda4d85(_0xc68977(0x168));return;}try{logger[_0xc68977(0x174)](process[_0xc68977(0x16c)]());const {configArray:_0x379fd4}=await fetchModelList(_0x311b64),_0x1f5f0b=_0x379fd4['length'],_0x397496=!_0x596684,_0x9b9223=await generateApiFile(_0x379fd4,_0x5f2dc1,_0x311b64,_0x397496,_0x547f07,_0x186d01),_0x3a2dbe=_0x186d01[_0xc68977(0x165)]('/')?_0x186d01:_0x186d01+'/';_0x582481({'api':''+_0x3a2dbe+_0x4f76c4+_0xc68977(0x164),'client':''+_0x3a2dbe+_0x33b4a2+_0xc68977(0x164),'modelCount':_0x9b9223['modelCount'],'datasetCount':_0x1f5f0b,'originalCount':_0x1f5f0b,'duplicateCount':0x0}),_0x11f738(!![]);}catch(_0x499bbf){const _0x1732e4=_0x499bbf instanceof Error?_0x499bbf[_0xc68977(0x157)]:String(_0x499bbf);logger[_0xc68977(0x154)]('api-pull',_0xc68977(0x16b)+_0x1732e4,{'appCode':_0x311b64,'error':_0x1732e4}),_0xda4d85(_0xc68977(0x16b)+_0x1732e4);}finally{_0x25f2c5(![]);}}return a5_0x34b489(Box,{'flexDirection':'column','children':[(_0x40f72a||_0x5c0cfc)&&a5_0x34b489(Box,{'children':[a5_0x421655(Text,{'color':_0x249f6b(0x167),'children':'*\x20'}),a5_0x421655(Text,{'color':_0x596684?_0x249f6b(0x188):_0x249f6b(0x170),'children':_0x4cdb3c})]}),_0x40f72a&&a5_0x421655(Box,{'children':a5_0x34b489(Text,{'children':[_0x249f6b(0x183),_0x547f07,')']})}),_0x5c0cfc&&_0x4b570f&&a5_0x34b489(Box,{'flexDirection':_0x249f6b(0x16e),'children':[a5_0x421655(Box,{'children':a5_0x34b489(Text,{'color':_0x249f6b(0x175),'children':['√\x20成功拉取\x20',_0x4b570f[_0x249f6b(0x184)],_0x249f6b(0x17b),'\x20',_0x4b570f[_0x249f6b(0x178)],_0x249f6b(0x186)]})}),_0x4b570f[_0x249f6b(0x172)]>0x0&&a5_0x421655(Box,{'marginTop':0x1,'children':a5_0x34b489(Text,{'color':'yellow','children':['!\x20原始数据集\x20',_0x4b570f[_0x249f6b(0x15d)],_0x249f6b(0x185),'\x20',_0x4b570f[_0x249f6b(0x172)],'\x20个']})}),a5_0x421655(Box,{'marginTop':0x1,'children':a5_0x421655(Text,{'color':_0x249f6b(0x167),'children':'*\x20已生成文件:'})}),a5_0x34b489(Box,{'marginLeft':0x2,'children':[a5_0x34b489(Text,{'color':_0x249f6b(0x189),'children':['•\x20',_0x4b570f[_0x249f6b(0x159)]]}),a5_0x34b489(Text,{'color':_0x249f6b(0x170),'children':['\x20',_0x249f6b(0x177),_0x4b570f[_0x249f6b(0x178)],_0x249f6b(0x169)]})]}),a5_0x34b489(Box,{'marginLeft':0x2,'children':[a5_0x34b489(Text,{'color':'cyan','children':['•\x20',_0x4b570f[_0x249f6b(0x181)]]}),a5_0x421655(Text,{'color':_0x249f6b(0x170),'children':_0x249f6b(0x17f)})]}),a5_0x421655(Box,{'marginTop':0x1,'children':a5_0x421655(Text,{'color':'gray','children':_0x249f6b(0x179)})}),a5_0x421655(Box,{'marginLeft':0x2,'children':a5_0x34b489(Text,{'color':_0x249f6b(0x187),'children':[_0x249f6b(0x160),_0x249f6b(0x15f),_0x249f6b(0x182),_0x4b570f['client'][_0x249f6b(0x162)](/^\.\//,'')[_0x249f6b(0x162)](_0x249f6b(0x164),''),'\x27']})})]}),_0x2e93ad&&a5_0x34b489(Box,{'flexDirection':_0x249f6b(0x16e),'children':[a5_0x421655(Box,{'children':a5_0x34b489(Text,{'color':_0x249f6b(0x15c),'children':['❌\x20',_0x2e93ad]})}),_0x2e93ad[_0x249f6b(0x176)]('登录')&&a5_0x34b489(Box,{'marginTop':0x1,'children':[a5_0x421655(Text,{'color':_0x249f6b(0x187),'children':_0x249f6b(0x158)}),a5_0x421655(Text,{'color':_0x249f6b(0x189),'children':'lovrabet\x20auth'}),a5_0x421655(Text,{'color':_0x249f6b(0x187),'children':_0x249f6b(0x180)})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a6_0x8931(_0x3d19b6,_0x526569){const _0x282345=a6_0x2823();return a6_0x8931=function(_0x893175,_0x37396a){_0x893175=_0x893175-0x1e8;let _0x1f1506=_0x282345[_0x893175];return _0x1f1506;},a6_0x8931(_0x3d19b6,_0x526569);}(function(_0x2afae7,_0x1d08ad){const _0x5943a5=a6_0x8931,_0x1d3a7=_0x2afae7();while(!![]){try{const _0x118740=parseInt(_0x5943a5(0x1fa))/0x1*(parseInt(_0x5943a5(0x1f2))/0x2)+parseInt(_0x5943a5(0x1ed))/0x3*(-parseInt(_0x5943a5(0x1e9))/0x4)+parseInt(_0x5943a5(0x1f7))/0x5*(parseInt(_0x5943a5(0x1ec))/0x6)+parseInt(_0x5943a5(0x1f3))/0x7+parseInt(_0x5943a5(0x1fd))/0x8*(-parseInt(_0x5943a5(0x1f1))/0x9)+parseInt(_0x5943a5(0x1fc))/0xa*(-parseInt(_0x5943a5(0x1e8))/0xb)+parseInt(_0x5943a5(0x1f9))/0xc;if(_0x118740===_0x1d08ad)break;else _0x1d3a7['push'](_0x1d3a7['shift']());}catch(_0x3bf012){_0x1d3a7['push'](_0x1d3a7['shift']());}}}(a6_0x2823,0xd0ea5));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';export async function fetchModelList(_0xb2851b){const _0x51c2d0=a6_0x8931,_0x39bb03=getEnv(),_0x29b24a=getApiDomain()+_0x51c2d0(0x1fe)+_0xb2851b+_0x51c2d0(0x1f5);logger[_0x51c2d0(0x1f8)](_0x51c2d0(0x1ee),_0x51c2d0(0x1f4)+_0x39bb03+')',{'apiUrl':_0x29b24a});const _0x2a2aca=await fetch(_0x29b24a,{'headers':{'Cookie':getCookie()}});if(!_0x2a2aca['ok']){if(_0x2a2aca['status']===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');throw new Error(_0x51c2d0(0x1ea)+_0x2a2aca['status']);}const _0x41e3d6=await _0x2a2aca['json']();if(!_0x41e3d6[_0x51c2d0(0x1eb)])throw new Error(_0x51c2d0(0x1f0)+(_0x41e3d6[_0x51c2d0(0x1fb)]||_0x51c2d0(0x1f6)));return{'configArray':_0x41e3d6['data'][_0x51c2d0(0x1ef)],'count':_0x41e3d6[_0x51c2d0(0x1ff)]['count']};}function a6_0x2823(){const _0x30b10e=['configArray','获取数据集失败:\x20','246699CYUfcA','661852Jsylan','10820439yOYnga','正在从服务器拉取模型列表...\x20(环境:\x20','&otype=array','未知错误','150695PNSmLu','info','3447984EiRyRA','1zOjcVr','message','265570LyQwRf','400IhfXdL','/api/node-toolbox/dataset/model-list?appcode=','data','341trnESU','8xNhDYI','获取数据集失败,HTTP状态码:\x20','success','306mSQtSZ','977385rzKxXp','fetch-model-list'];a6_0x2823=function(){return _0x30b10e;};return a6_0x2823();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x18dcaf=a7_0x456a;(function(_0x36e1f1,_0x2690a4){const _0x134e7a=a7_0x456a,_0x112709=_0x36e1f1();while(!![]){try{const _0x5ed1fa=parseInt(_0x134e7a(0x139))/0x1*(parseInt(_0x134e7a(0x164))/0x2)+-parseInt(_0x134e7a(0x15a))/0x3+parseInt(_0x134e7a(0x146))/0x4+parseInt(_0x134e7a(0x154))/0x5*(parseInt(_0x134e7a(0x160))/0x6)+parseInt(_0x134e7a(0x155))/0x7+-parseInt(_0x134e7a(0x14c))/0x8*(parseInt(_0x134e7a(0x13f))/0x9)+parseInt(_0x134e7a(0x161))/0xa*(parseInt(_0x134e7a(0x15c))/0xb);if(_0x5ed1fa===_0x2690a4)break;else _0x112709['push'](_0x112709['shift']());}catch(_0x561727){_0x112709['push'](_0x112709['shift']());}}}(a7_0x1dd2,0xa4699));import a7_0x402694 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x1111b4 from'node:path';function a7_0x456a(_0x38c3fd,_0x34d89b){const _0x1dd28e=a7_0x1dd2();return a7_0x456a=function(_0x456a27,_0x5be9a8){_0x456a27=_0x456a27-0x138;let _0x4a9c4d=_0x1dd28e[_0x456a27];return _0x4a9c4d;},a7_0x456a(_0x38c3fd,_0x34d89b);}import{fileURLToPath}from'node:url';function a7_0x1dd2(){const _0x79c3=['api','templates/generate-api','dirname','init-api','forEach','string','19780dHxZEb','1854398RHStoV','-client','keys','online','join','3299877kkOyZG','resolve','9119VulanR','app','typescript','success','798IvXjVR','10820HVASDF','api.ts.tpl','client','3238TeZbIq','utf8','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','29YzsMnj','../..','url','slice','tableName','env','423aPEwZm','.ts','\x22\x20}','replaceApiContent','format','endsWith','API\x20文件生成成功!','5113796xRoGRE','key','-api','./src/api/','client.ts.tpl',',\x20env:\x20\x22','211072IPPpxK','{\x20apiConfigName:\x20'];a7_0x1dd2=function(){return _0x79c3;};return a7_0x1dd2();}import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x49e818,_0x2e1186='',_0x57a54d,_0x467361=![],_0x354bbb,_0x306520=a7_0x18dcaf(0x149)){const _0x440624=a7_0x18dcaf,_0xbd372d=readConfig(),_0x6d2425=_0x57a54d||_0xbd372d?.[_0x440624(0x15d)];if(typeof _0x6d2425!=='string'||!_0x6d2425)throw new Error(_0x440624(0x138));const _0x21eaca=_0x467361?'CONFIG_NAMES.DEFAULT':'\x22'+_0x6d2425+'\x22',_0x5e0e4d=typeof _0xbd372d['env']===_0x440624(0x153)?_0xbd372d[_0x440624(0x13e)]:undefined,_0x25416a=_0x354bbb||_0x5e0e4d||_0x440624(0x158),_0x4911a3=_0x25416a!==_0x440624(0x158);let _0x29178e;if(_0x467361)_0x4911a3?_0x29178e=_0x440624(0x14d)+_0x21eaca+_0x440624(0x14b)+_0x25416a+_0x440624(0x141):_0x29178e='';else{const _0x195c39=_0x4911a3?_0x440624(0x14b)+_0x25416a+'\x22':'';_0x29178e='{\x20apiConfigName:\x20\x22'+_0x6d2425+'\x22'+_0x195c39+'\x20}';}const _0x54e29e=_0x2e1186?_0x2e1186+_0x440624(0x148):_0x440624(0x14e),_0x58d35b=_0x2e1186?_0x2e1186+_0x440624(0x156):_0x440624(0x163),_0x2b004f={};_0x49e818[_0x440624(0x152)](_0x23acb2=>{const _0x522934=_0x440624;_0x2b004f[_0x23acb2[_0x522934(0x147)]]={'tableName':_0x23acb2[_0x522934(0x13d)],'datasetCode':_0x23acb2['datasetCode'],'name':_0x23acb2['name']||''};});const _0x43f6b6=fileURLToPath(import.meta[_0x440624(0x13b)]),_0x1ace9a=a7_0x1111b4[_0x440624(0x15b)](a7_0x1111b4[_0x440624(0x150)](_0x43f6b6),_0x440624(0x13a)),_0x5c760f=a7_0x1111b4[_0x440624(0x159)](_0x1ace9a,_0x440624(0x14f)),_0x2a0fdc=a7_0x1111b4[_0x440624(0x159)](_0x5c760f,_0x440624(0x162)),_0x3d3e4e=a7_0x1111b4[_0x440624(0x159)](_0x5c760f,_0x440624(0x14a)),_0x4a6343=_0x306520[_0x440624(0x144)]('/')?_0x306520[_0x440624(0x13c)](0x0,-0x1):_0x306520;mkdirSync(_0x4a6343,{'recursive':!![]});const _0x374c8c=readFileSync(_0x2a0fdc,_0x440624(0x165)),_0x2bfcca=TemplateReplacer[_0x440624(0x142)](_0x374c8c,_0x6d2425,_0x2b004f,Object[_0x440624(0x157)](_0x2b004f)[0x0],_0x54e29e,_0x21eaca),_0x14c182=await a7_0x402694['format'](_0x2bfcca,{'parser':_0x440624(0x15e)}),_0x4ce24d=_0x4a6343+'/'+_0x54e29e+_0x440624(0x140);writeFileSync(_0x4ce24d,_0x14c182,{'encoding':_0x440624(0x165)});const _0x5dcd81=readFileSync(_0x3d3e4e,'utf8'),_0x4527d9=TemplateReplacer[_0x440624(0x142)](_0x5dcd81,_0x6d2425,_0x2b004f,Object[_0x440624(0x157)](_0x2b004f)[0x0],_0x54e29e,_0x21eaca,_0x29178e),_0x4bc715=await a7_0x402694[_0x440624(0x143)](_0x4527d9,{'parser':'typescript'}),_0x39d942=_0x4a6343+'/'+_0x58d35b+_0x440624(0x140);writeFileSync(_0x39d942,_0x4bc715,{'encoding':_0x440624(0x165)});const _0x41c26d=Object[_0x440624(0x157)](_0x2b004f)['length'];return logger[_0x440624(0x15f)](_0x440624(0x151),_0x440624(0x145),undefined,{'apiFile':_0x4ce24d,'clientFile':_0x39d942,'modelCount':_0x41c26d,'configName':_0x21eaca}),{'modelCount':_0x41c26d,'apiFilePath':_0x4ce24d,'clientFilePath':_0x39d942,'configName':_0x21eaca};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a8_0x1588(){const _0x14f900=['\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','Unknown\x20api\x20command:\x20','Available\x20commands:','797537OglNPZ','×\x20未配置\x20AppCode','请使用\x20--appcode\x20参数,例如:','input','error','appcode','\x20\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档','\x1b[90m*\x20仅生成指定数据集的文档:\x20','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','doc','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--datasetcode\x20<codes>\x20指定要生成文档的数据集代码(多个用逗号分隔,仅\x20doc\x20命令)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成所有数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20只生成指定数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20生成多个数据集的文档\x0a','env','5441190LVwjBj','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','\x1b[0m','7314608SkttPl','trim','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','object','split','279896hppRZw','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','15948HoEwPD','flags','map','join','length','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','log','\x20\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','309aTOYzY','2648191lIJbLV','×\x20--params\x20参数不是有效的\x20JSON\x20格式','4130508oLTyGp','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','output','\x1b[90m*\x20使用配置的应用AppCode:\x20','help','filter','string','params','exit','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','❌\x20错误:不再支持位置参数方式'];a8_0x1588=function(){return _0x14f900;};return a8_0x1588();}(function(_0x86403c,_0x3ca25a){const _0x21bde0=a8_0x3e90,_0x317529=_0x86403c();while(!![]){try{const _0x218fe5=parseInt(_0x21bde0(0x160))/0x1+-parseInt(_0x21bde0(0x175))/0x2+-parseInt(_0x21bde0(0x14e))/0x3*(parseInt(_0x21bde0(0x146))/0x4)+parseInt(_0x21bde0(0x16d))/0x5+parseInt(_0x21bde0(0x151))/0x6+-parseInt(_0x21bde0(0x14f))/0x7+-parseInt(_0x21bde0(0x170))/0x8;if(_0x218fe5===_0x3ca25a)break;else _0x317529['push'](_0x317529['shift']());}catch(_0x4eff27){_0x317529['push'](_0x317529['shift']());}}}(a8_0x1588,0xb2741));import{jsx as a8_0x1842e2}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';function a8_0x3e90(_0x238a75,_0x3e7ae7){const _0x1588b2=a8_0x1588();return a8_0x3e90=function(_0x3e9076,_0x92ee85){_0x3e9076=_0x3e9076-0x145;let _0x41e3dc=_0x1588b2[_0x3e9076];return _0x41e3dc;},a8_0x3e90(_0x238a75,_0x3e7ae7);}export async function apiCli(_0x56eaea){const _0x4a582b=a8_0x3e90,_0xd0643d=_0x56eaea['input'][0x1];if(_0x56eaea[_0x4a582b(0x147)][_0x4a582b(0x155)]){console[_0x4a582b(0x14c)](_0x4a582b(0x16b));return;}if(_0xd0643d==='pull'){_0x56eaea[_0x4a582b(0x163)][0x2]&&(console[_0x4a582b(0x164)](_0x4a582b(0x15c)),console['log'](_0x4a582b(0x162)),console[_0x4a582b(0x14c)](_0x4a582b(0x172)+_0x56eaea['input'][0x2]),process[_0x4a582b(0x159)](0x1));const _0x209a84=getConfigAppCode();let _0xbb0b8d=_0x56eaea['flags'][_0x4a582b(0x165)];const _0x437d3c=typeof _0x56eaea[_0x4a582b(0x147)]['env']==='string'?_0x56eaea[_0x4a582b(0x147)][_0x4a582b(0x16c)]:undefined,_0x1931e8=_0x56eaea['flags'][_0x4a582b(0x153)];!_0xbb0b8d&&!_0x209a84&&(console[_0x4a582b(0x164)]('×\x20未配置\x20AppCode'),console[_0x4a582b(0x14c)]('!\x20请使用以下方式之一:'),console[_0x4a582b(0x14c)](_0x4a582b(0x16e)),console[_0x4a582b(0x14c)](_0x4a582b(0x169)),process[_0x4a582b(0x159)](0x1)),_0xbb0b8d&&_0x209a84&&_0xbb0b8d===_0x209a84&&(console[_0x4a582b(0x14c)](_0x4a582b(0x154)+_0xbb0b8d+_0x4a582b(0x16f)),console[_0x4a582b(0x14c)](_0x4a582b(0x15a)),_0xbb0b8d=undefined),render(a8_0x1842e2(ApiPullUI,{'appCode':_0xbb0b8d,'env':_0x437d3c,'output':_0x1931e8}));}else{if(_0xd0643d===_0x4a582b(0x16a)){_0x56eaea['input'][0x2]&&(console['error'](_0x4a582b(0x15c)),console['log'](_0x4a582b(0x162)),console[_0x4a582b(0x14c)](_0x4a582b(0x14b)+_0x56eaea[_0x4a582b(0x163)][0x2]),process[_0x4a582b(0x159)](0x1));const _0x4bcd3b=getConfigAppCode();let _0x4721ec=_0x56eaea[_0x4a582b(0x147)]['appcode'];const _0x10bc91=typeof _0x56eaea[_0x4a582b(0x147)][_0x4a582b(0x16c)]===_0x4a582b(0x157)?_0x56eaea[_0x4a582b(0x147)][_0x4a582b(0x16c)]:undefined,_0x2030fa=_0x56eaea[_0x4a582b(0x147)][_0x4a582b(0x153)],_0x35eab0=_0x56eaea[_0x4a582b(0x147)][_0x4a582b(0x158)],_0x401293=_0x56eaea[_0x4a582b(0x147)]['datasetcode'];!_0x4721ec&&!_0x4bcd3b&&(console[_0x4a582b(0x164)](_0x4a582b(0x161)),console[_0x4a582b(0x14c)]('!\x20请使用以下方式之一:'),console['log']('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x4a582b(0x14c)](_0x4a582b(0x15d)),process[_0x4a582b(0x159)](0x1));_0x4721ec&&_0x4bcd3b&&_0x4721ec===_0x4bcd3b&&(console['log'](_0x4a582b(0x154)+_0x4721ec+_0x4a582b(0x16f)),_0x4721ec=undefined);let _0x444ed5;if(_0x35eab0)try{_0x444ed5=JSON['parse'](_0x35eab0),(typeof _0x444ed5!==_0x4a582b(0x173)||_0x444ed5===null||Array['isArray'](_0x444ed5))&&(console['error'](_0x4a582b(0x152)),process['exit'](0x1));}catch(_0x2f79bc){console[_0x4a582b(0x164)](_0x4a582b(0x150)),console[_0x4a582b(0x164)]('\x20\x20错误:\x20'+(_0x2f79bc instanceof Error?_0x2f79bc['message']:String(_0x2f79bc))),process['exit'](0x1);}let _0x1e2df3;_0x401293&&(_0x1e2df3=_0x401293[_0x4a582b(0x174)](',')[_0x4a582b(0x148)](_0x582b16=>_0x582b16[_0x4a582b(0x171)]())[_0x4a582b(0x156)](_0x41377c=>_0x41377c[_0x4a582b(0x14a)]>0x0),_0x1e2df3[_0x4a582b(0x14a)]===0x0&&(console['error']('×\x20--datasetcode\x20参数不能为空'),process[_0x4a582b(0x159)](0x1)),console[_0x4a582b(0x14c)](_0x4a582b(0x167)+_0x1e2df3[_0x4a582b(0x149)](',\x20')+_0x4a582b(0x16f))),render(a8_0x1842e2(ApiDocUI,{'appCode':_0x4721ec,'env':_0x10bc91,'output':_0x2030fa,'extraParams':_0x444ed5,'datasetCodes':_0x1e2df3}));}else console['error'](_0x4a582b(0x15e)+_0xd0643d),console[_0x4a582b(0x14c)](_0x4a582b(0x15f)),console['log'](_0x4a582b(0x14d)),console[_0x4a582b(0x14c)](_0x4a582b(0x176)),console[_0x4a582b(0x14c)](_0x4a582b(0x145)),console[_0x4a582b(0x14c)]('\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),console[_0x4a582b(0x14c)](''),console[_0x4a582b(0x14c)](_0x4a582b(0x166)),console[_0x4a582b(0x14c)](_0x4a582b(0x168)),console[_0x4a582b(0x14c)]('\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)'),console[_0x4a582b(0x14c)](_0x4a582b(0x15b)),process[_0x4a582b(0x159)](0x1);}}
|
package/lib/api/pull-silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a9_0x29c5(){const _0x1f736e=['*\x20开始生成\x20API\x20配置文件:','-api','√\x20成功拉取\x20','modelCount','710423haptau','create-api-pull','length','log','cwd','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','error','string','API\x20配置拉取异常:\x20','1965316IQOrUs','trim','2039598TaCxfJ','api','8FwCmCs','env','\x20个模型','861emXKlo','3506EFUCXf','\x20\x20\x20•\x20','314365mnyAdR','test','*\x20正在处理\x20','*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','-client','\x20个数据集...','\x20个数据集,生成\x20','chdir','.ts\x20-\x20模型配置文件','1075675dgpIgY','5446215UglKcC','client'];a9_0x29c5=function(){return _0x1f736e;};return a9_0x29c5();}function a9_0x1627(_0x9f0e9b,_0x4ef9b6){const _0x29c5ac=a9_0x29c5();return a9_0x1627=function(_0x16277a,_0x58d023){_0x16277a=_0x16277a-0xed;let _0x82594a=_0x29c5ac[_0x16277a];return _0x82594a;},a9_0x1627(_0x9f0e9b,_0x4ef9b6);}(function(_0x40f0d1,_0x5301bf){const _0x220830=a9_0x1627,_0x5aa67d=_0x40f0d1();while(!![]){try{const _0x367a0a=-parseInt(_0x220830(0x102))/0x1+-parseInt(_0x220830(0x100))/0x2*(parseInt(_0x220830(0xff))/0x3)+parseInt(_0x220830(0xf8))/0x4+parseInt(_0x220830(0x10b))/0x5+-parseInt(_0x220830(0xfa))/0x6+-parseInt(_0x220830(0xef))/0x7*(-parseInt(_0x220830(0xfc))/0x8)+parseInt(_0x220830(0x10c))/0x9;if(_0x367a0a===_0x5301bf)break;else _0x5aa67d['push'](_0x5aa67d['shift']());}catch(_0x4a43d5){_0x5aa67d['push'](_0x5aa67d['shift']());}}}(a9_0x29c5,0x3e6bf));import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x578302,_0x5b58a1,_0x171afd,_0x2131f6){const _0x3016ea=a9_0x1627;let _0x5cc5c6;try{const _0x2cfb4b=_0x5b58a1?.[_0x3016ea(0xf9)]()||'';if(_0x2cfb4b){const _0x4109ab=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x4109ab[_0x3016ea(0x103)](_0x2cfb4b))return console[_0x3016ea(0xf5)](_0x3016ea(0xf4)),![];}_0x171afd&&(_0x5cc5c6=process[_0x3016ea(0xf3)](),process[_0x3016ea(0x109)](_0x171afd));const _0x260155=readConfig(),_0x3db148=typeof _0x260155[_0x3016ea(0xfd)]===_0x3016ea(0xf6)?_0x260155[_0x3016ea(0xfd)]:undefined,_0x4703bc=_0x2131f6||_0x3db148||'online';initEnv(_0x4703bc),console[_0x3016ea(0xf2)](_0x3016ea(0x105)+_0x4703bc+')');const {configArray:_0x3d715a}=await fetchModelList(_0x578302),_0xeb6eff=_0x2cfb4b?_0x2cfb4b+_0x3016ea(0x10f):_0x3016ea(0xfb),_0x4aee01=_0x2cfb4b?_0x2cfb4b+_0x3016ea(0x106):_0x3016ea(0x10d);console['log'](_0x3016ea(0x10e)),console[_0x3016ea(0xf2)](_0x3016ea(0x101)+_0xeb6eff+_0x3016ea(0x10a)),console[_0x3016ea(0xf2)](_0x3016ea(0x101)+_0x4aee01+'.ts\x20-\x20客户端实例文件'),console[_0x3016ea(0xf2)](_0x3016ea(0x104)+_0x3d715a[_0x3016ea(0xf1)]+_0x3016ea(0x107));const _0x20acd1=await generateApiFile(_0x3d715a,_0x2cfb4b,_0x578302,!![],_0x4703bc);return console['log'](_0x3016ea(0xed)+_0x3d715a[_0x3016ea(0xf1)]+_0x3016ea(0x108)+_0x20acd1[_0x3016ea(0xee)]+_0x3016ea(0xfe)),_0x171afd&&logger['info'](_0x3016ea(0xf0),'API\x20配置拉取成功:\x20'+_0x578302,{'projectPath':_0x171afd,'appCode':_0x578302,'datasetCount':_0x3d715a[_0x3016ea(0xf1)],'filePrefix':_0x2cfb4b}),!![];}catch(_0x15750d){const _0x5b48b2=_0x15750d instanceof Error?_0x15750d['message']:String(_0x15750d);return console[_0x3016ea(0xf5)]('×\x20API\x20配置拉取异常:',_0x5b48b2),_0x171afd&&logger['error'](_0x3016ea(0xf0),_0x3016ea(0xf7)+_0x5b48b2,{'appCode':_0x578302,'projectPath':_0x171afd}),![];}finally{_0x5cc5c6&&process[_0x3016ea(0x109)](_0x5cc5c6);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a10_0x1dd982=a10_0x1cf9;(function(_0x1408de,_0x147ff5){const _0xed800=a10_0x1cf9,_0x121c9d=_0x1408de();while(!![]){try{const _0x18b030=-parseInt(_0xed800(0xbf))/0x1+-parseInt(_0xed800(0xe5))/0x2*(-parseInt(_0xed800(0xd2))/0x3)+-parseInt(_0xed800(0xbe))/0x4+parseInt(_0xed800(0xf3))/0x5+parseInt(_0xed800(0xb6))/0x6+-parseInt(_0xed800(0xd0))/0x7+parseInt(_0xed800(0xfc))/0x8;if(_0x18b030===_0x147ff5)break;else _0x121c9d['push'](_0x121c9d['shift']());}catch(_0x3d301e){_0x121c9d['push'](_0x121c9d['shift']());}}}(a10_0x1ae3,0x1a961));import{jsx as a10_0x3ed4a4,jsxs as a10_0x1c6962,Fragment as a10_0x42d9cd}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';function a10_0x1ae3(){const _0x38b268=['green','CSS\x20链接无法访问','[\x20]','test','slice','online','创建菜单失败','*\x20同步菜单到\x20Lovrabet\x20平台','join','√\x20菜单创建完成','white','selecting','then','27642GxPRvv','fill','return','[✓]','请输入有效的\x20CSS\x20https\x20链接','input-js','cyan','请至少选择一个菜单','*\x20正在创建菜单...','已选择菜单','CSS\x20链接','delete','Lovrabet平台','done','898520mNiQXD','\x20正在获取线上菜单列表...','includes','column','lovrabet\x20auth','creating','downArrow','has','提示:使用\x20','1087232CfVCcL','yellow','input-css','644406LHImgA','\x20输入项目的\x20CSS\x20资源链接(https://...)','backspace','trim','value','\x20输入项目的\x20JS\x20资源链接(https://...)','length','max','500424tneGcB','208517djLbnR','*\x20CSS\x20链接:\x20','red','*\x20请选择要同步的菜单:','add','upArrow','filter','path','gray','label','catch','!\x20未找到本地页面,请先创建页面','size','菜单名称','blue','请输入有效的\x20JS\x20https\x20链接','message','443905hRKXUY','JS\x20链接','18JULmdm','\x20命令重新登录','main','map','dots','\x20←\x20'];a10_0x1ae3=function(){return _0x38b268;};return a10_0x1ae3();}import{useEffect,useState}from'react';import a10_0x1cb42e from'ink-spinner';function a10_0x1cf9(_0x4a1e70,_0x70e7b5){const _0x1ae3eb=a10_0x1ae3();return a10_0x1cf9=function(_0x1cf94a,_0xa0785e){_0x1cf94a=_0x1cf94a-0xb4;let _0x1ea02b=_0x1ae3eb[_0x1cf94a];return _0x1ea02b;},a10_0x1cf9(_0x4a1e70,_0x70e7b5);}import{useGetOnlineMenuList}from'./get-online-menu-list.js';import{getLocalPages}from'./get-local-pages.js';import{createMenus}from'./create-menu.js';import{isUrlReachable,isValidCssHttpsUrl,isValidJsHttpsUrl}from'./valid-url.js';import.meta[a10_0x1dd982(0xd4)]&&render(a10_0x3ed4a4(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x551a7a=a10_0x1dd982,{exit:_0x48b9d4}=useApp(),{loading:_0x492cfb,menuList:_0xf34d31,error:_0x25fcc8}=useGetOnlineMenuList(),_0x2b64bc=getLocalPages(),_0x3ee8b0=_0xf34d31['map'](_0x5360b6=>_0x5360b6[_0x551a7a(0xc6)]),_0x5bb26e=['菜单名称',..._0x2b64bc[_0x551a7a(0xd5)](_0x1099f5=>_0x1099f5[_0x551a7a(0xc8)])],_0x4ed6f4=getStringWidth(getMaxWidth(_0x5bb26e,0x4)),_0x525c9c=getStringWidth(getMaxWidth([_0x551a7a(0xcc)])),[_0xbeb295,_0x5aba0b]=useState('selecting'),[_0x39d6ec,_0x2b7779]=useState(new Set()),[_0x22f7d4,_0x2ac4e0]=useState(0x0),[_0x59185c,_0x2cddea]=useState(''),[_0x445ce4,_0x1f54d3]=useState(''),[_0x58875e,_0x3925ce]=useState(''),[_0xff7e98,_0x873963]=useState(''),[_0xcfa06c,_0x2eedb9]=useState([]),_0x3db8ed=_0x2b64bc['map'](_0x55b4dc=>({'label':_0x55b4dc['label'],'path':_0x55b4dc[_0x551a7a(0xc6)],'local':!![],'online':_0x3ee8b0[_0x551a7a(0xf5)](_0x55b4dc[_0x551a7a(0xc6)])})),_0x3d05de=_0x2b64bc[_0x551a7a(0xc5)](_0x1a6837=>{const _0xee5223=_0x551a7a;return!_0x3ee8b0['includes'](_0x1a6837[_0xee5223(0xc6)]);});useEffect(()=>{const _0x1fb798=_0x551a7a;if(!_0x492cfb&&_0x2b64bc[_0x1fb798(0xbc)]>0x0&&_0x39d6ec[_0x1fb798(0xcb)]===0x0){const _0x12df03=new Set(_0x2b64bc[_0x1fb798(0xd5)]((_0x1d74a2,_0x4ddaa1)=>({'page':_0x1d74a2,'index':_0x4ddaa1}))[_0x1fb798(0xc5)](({page:_0x305586})=>!_0x3ee8b0[_0x1fb798(0xf5)](_0x305586[_0x1fb798(0xc6)]))['map'](({index:_0xc2adf1})=>_0xc2adf1));_0x2b7779(_0x12df03);}},[_0x492cfb,_0x2b64bc[_0x551a7a(0xbc)],_0x3ee8b0[_0x551a7a(0xbc)]]),useInput(async(_0x29acfa,_0x30e4ee)=>{const _0x5e7669=_0x551a7a;if(_0xbeb295===_0x5e7669(0xe3)){if(_0x30e4ee[_0x5e7669(0xc4)]){_0x2ac4e0(_0x566d8f=>_0x566d8f>0x0?_0x566d8f-0x1:_0x2b64bc[_0x5e7669(0xbc)]-0x1);return;}if(_0x30e4ee[_0x5e7669(0xf9)]){_0x2ac4e0(_0x3074d3=>_0x3074d3<_0x2b64bc[_0x5e7669(0xbc)]-0x1?_0x3074d3+0x1:0x0);return;}if(_0x29acfa==='\x20'){_0x2b7779(_0x3628bd=>{const _0x530937=_0x5e7669,_0x25e295=new Set(_0x3628bd);return _0x25e295['has'](_0x22f7d4)?_0x25e295[_0x530937(0xf0)](_0x22f7d4):_0x25e295['add'](_0x22f7d4),_0x25e295;});return;}if(_0x29acfa==='a'||_0x29acfa==='A'){const _0x1813b7=new Set(_0x2b64bc['map']((_0x1832da,_0x345bd6)=>_0x345bd6));_0x2b7779(_0x1813b7);return;}if(_0x29acfa==='i'||_0x29acfa==='I'||_0x29acfa==='r'||_0x29acfa==='R'){_0x2b7779(_0x1c5cb7=>{const _0x3043fb=_0x5e7669,_0x5b4adb=new Set();for(let _0x10a142=0x0;_0x10a142<_0x2b64bc['length'];_0x10a142++){!_0x1c5cb7[_0x3043fb(0xfa)](_0x10a142)&&_0x5b4adb[_0x3043fb(0xc3)](_0x10a142);}return _0x5b4adb;});return;}if(_0x29acfa==='q'||_0x29acfa==='Q'){_0x48b9d4();return;}if(_0x30e4ee[_0x5e7669(0xe7)]){if(_0x39d6ec[_0x5e7669(0xcb)]===0x0){_0x873963(_0x5e7669(0xec));return;}const _0x15bb3f=_0x2b64bc['filter']((_0x1b9b1a,_0x4a1cab)=>_0x39d6ec['has'](_0x4a1cab)),_0x47f200=_0x15bb3f[_0x5e7669(0xd5)](_0x48a313=>_0x48a313[_0x5e7669(0xc8)])['join'](',\x20');_0x2eedb9([{'label':_0x5e7669(0xee),'value':_0x39d6ec['size']+'\x20个'}]),_0x873963(''),_0x5aba0b(_0x5e7669(0xea));return;}return;}if(_0xbeb295===_0x5e7669(0xea)){if(_0x30e4ee[_0x5e7669(0xe7)]){const _0x49c428=_0x58875e[_0x5e7669(0xb9)]();if(_0x49c428==='')return;if(!isValidJsHttpsUrl(_0x49c428)){_0x873963(_0x5e7669(0xce));return;}if(!await isUrlReachable(_0x49c428)){_0x873963('JS\x20链接无法访问');return;}_0x2cddea(_0x49c428),_0x2eedb9(_0x3d8be5=>[..._0x3d8be5,{'label':_0x5e7669(0xd1),'value':_0x49c428}]),_0x3925ce(''),_0x873963(''),_0x5aba0b(_0x5e7669(0xb5));return;}if(_0x30e4ee[_0x5e7669(0xb8)]||_0x30e4ee[_0x5e7669(0xf0)]){_0x3925ce(_0x252b8d=>_0x252b8d[_0x5e7669(0xdc)](0x0,-0x1)),_0x873963('');return;}_0x3925ce(_0x387132=>_0x387132+_0x29acfa);return;}if(_0xbeb295===_0x5e7669(0xb5)){if(_0x30e4ee['return']){const _0x5b81d6=_0x58875e[_0x5e7669(0xb9)]();if(_0x5b81d6==='')return;if(!isValidCssHttpsUrl(_0x5b81d6)){_0x873963(_0x5e7669(0xe9));return;}if(!await isUrlReachable(_0x5b81d6)){_0x873963(_0x5e7669(0xd9));return;}_0x1f54d3(_0x5b81d6),_0x2eedb9(_0x2b99e9=>[..._0x2b99e9,{'label':_0x5e7669(0xef),'value':_0x5b81d6}]),_0x3925ce(''),_0x873963(''),_0x5aba0b(_0x5e7669(0xf8));const _0x4d10a6=_0x2b64bc[_0x5e7669(0xc5)]((_0xd33864,_0x48cc69)=>_0x39d6ec[_0x5e7669(0xfa)](_0x48cc69));createMenus(_0x4d10a6,[_0x59185c,_0x5b81d6])[_0x5e7669(0xe4)](()=>{_0x5aba0b('done'),setTimeout(()=>{_0x48b9d4();},0x3e8);})[_0x5e7669(0xc9)](_0x40ec09=>{const _0x1338fc=_0x5e7669;_0x873963(_0x40ec09[_0x1338fc(0xcf)]||_0x1338fc(0xde)),_0x5aba0b(_0x1338fc(0xe3));});return;}if(_0x30e4ee['backspace']||_0x30e4ee[_0x5e7669(0xf0)]){_0x3925ce(_0x2655c3=>_0x2655c3[_0x5e7669(0xdc)](0x0,-0x1)),_0x873963('');return;}_0x3925ce(_0x50b08d=>_0x50b08d+_0x29acfa);return;}});if(_0x492cfb)return a10_0x1c6962(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x3ed4a4(Text,{'children':'\x20\x20'}),a10_0x3ed4a4(a10_0x1cb42e,{'type':_0x551a7a(0xd6)}),a10_0x3ed4a4(Text,{'children':_0x551a7a(0xf4)})]});if(_0x25fcc8)return a10_0x1c6962(Box,{'flexDirection':_0x551a7a(0xf6),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x1c6962(Text,{'color':_0x551a7a(0xc1),'children':['✗\x20',_0x25fcc8]}),a10_0x1c6962(Box,{'marginTop':0x1,'children':[a10_0x3ed4a4(Text,{'color':_0x551a7a(0xc7),'children':_0x551a7a(0xfb)}),a10_0x3ed4a4(Text,{'color':_0x551a7a(0xeb),'children':_0x551a7a(0xf7)}),a10_0x3ed4a4(Text,{'color':_0x551a7a(0xc7),'children':_0x551a7a(0xd3)})]})]});if(_0x2b64bc[_0x551a7a(0xbc)]===0x0)return a10_0x3ed4a4(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x3ed4a4(Text,{'color':_0x551a7a(0xb4),'children':_0x551a7a(0xca)})});return a10_0x1c6962(Box,{'flexDirection':_0x551a7a(0xf6),'marginTop':0x1,'marginBottom':0x1,'children':[_0xbeb295===_0x551a7a(0xe3)&&a10_0x1c6962(a10_0x42d9cd,{'children':[a10_0x1c6962(Box,{'children':[a10_0x1c6962(Text,{'bold':!![],'children':['\x20\x20','菜单名称',getRemainingSpaces(_0x4ed6f4,_0x551a7a(0xcc))]}),a10_0x1c6962(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x525c9c,_0x551a7a(0xcc))]}),a10_0x1c6962(Text,{'bold':!![],'children':[_0x551a7a(0xf1),getRemainingSpaces(_0x525c9c,_0x551a7a(0xcc))]})]}),_0x3db8ed[_0x551a7a(0xd5)](_0x44401b=>a10_0x1c6962(Box,{'children':[a10_0x1c6962(Text,{'children':['\x20\x20',_0x44401b[_0x551a7a(0xc8)],getRemainingSpaces(_0x4ed6f4,_0x44401b['label'])]}),a10_0x1c6962(Text,{'color':_0x551a7a(0xd8),'children':[_0x44401b['local']?'✓':'✗',getRemainingSpaces(_0x525c9c,'✓')]}),a10_0x1c6962(Text,{'color':_0x44401b[_0x551a7a(0xdd)]?'green':'red','children':[_0x44401b[_0x551a7a(0xdd)]?'✓':'✗',getRemainingSpaces(_0x525c9c,'✓')]})]},_0x44401b['path']))]}),_0xbeb295===_0x551a7a(0xe3)&&_0xcfa06c[_0x551a7a(0xbc)]===0x0&&a10_0x3ed4a4(Box,{'marginTop':0x1,'children':a10_0x3ed4a4(Text,{'color':_0x551a7a(0xeb),'children':_0x551a7a(0xdf)})}),_0xcfa06c['map']((_0x35cc44,_0x4bc6a2)=>a10_0x1c6962(Box,{'children':[a10_0x1c6962(Text,{'color':_0x551a7a(0xd8),'children':['√\x20',_0x35cc44[_0x551a7a(0xc8)],':\x20']}),a10_0x3ed4a4(Text,{'color':'cyan','children':_0x35cc44[_0x551a7a(0xba)]})]},_0x4bc6a2)),_0xff7e98&&_0xbeb295==='selecting'&&a10_0x3ed4a4(Box,{'marginTop':0x1,'children':a10_0x1c6962(Text,{'color':_0x551a7a(0xc1),'children':['✗\x20',_0xff7e98]})}),_0xbeb295===_0x551a7a(0xe3)&&a10_0x3ed4a4(a10_0x42d9cd,{'children':a10_0x1c6962(Box,{'marginTop':_0xcfa06c['length']>0x0||_0xff7e98?0x1:0x0,'flexDirection':'column','children':[a10_0x3ed4a4(Text,{'bold':!![],'children':_0x551a7a(0xc2)}),_0x2b64bc[_0x551a7a(0xd5)]((_0x247204,_0x346716)=>{const _0x419a01=_0x551a7a,_0x894fdb=_0x22f7d4===_0x346716,_0x54fa7=_0x39d6ec[_0x419a01(0xfa)](_0x346716),_0x566fc1=_0x3ee8b0[_0x419a01(0xf5)](_0x247204[_0x419a01(0xc6)]),_0x5a9005=_0x566fc1?'更新':'新建';return a10_0x3ed4a4(Box,{'children':a10_0x1c6962(Text,{'backgroundColor':_0x894fdb?_0x419a01(0xcd):undefined,'color':_0x894fdb?_0x419a01(0xe2):undefined,'children':['\x20\x20',_0x54fa7?_0x419a01(0xe8):_0x419a01(0xda),'\x20',_0x247204[_0x419a01(0xc8)]]})},_0x247204[_0x419a01(0xc6)]);}),a10_0x3ed4a4(Box,{'marginTop':0x1,'children':a10_0x1c6962(Text,{'color':_0x551a7a(0xc7),'children':['\x20','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认']})})]})}),_0xbeb295===_0x551a7a(0xea)&&a10_0x1c6962(a10_0x42d9cd,{'children':[a10_0x1c6962(Box,{'children':[a10_0x3ed4a4(Text,{'children':'*\x20JS\x20链接:\x20'}),a10_0x3ed4a4(Text,{'color':'green','children':_0x58875e}),_0xff7e98&&a10_0x1c6962(Text,{'color':'red','children':[_0x551a7a(0xd7),_0xff7e98]})]}),!_0xff7e98&&a10_0x3ed4a4(Box,{'children':a10_0x3ed4a4(Text,{'color':_0x551a7a(0xc7),'children':_0x551a7a(0xbb)})})]}),_0xbeb295===_0x551a7a(0xb5)&&a10_0x1c6962(a10_0x42d9cd,{'children':[a10_0x1c6962(Box,{'children':[a10_0x3ed4a4(Text,{'children':_0x551a7a(0xc0)}),a10_0x3ed4a4(Text,{'color':'green','children':_0x58875e}),_0xff7e98&&a10_0x1c6962(Text,{'color':'red','children':[_0x551a7a(0xd7),_0xff7e98]})]}),!_0xff7e98&&a10_0x3ed4a4(Box,{'children':a10_0x3ed4a4(Text,{'color':_0x551a7a(0xc7),'children':_0x551a7a(0xb7)})})]}),_0xbeb295===_0x551a7a(0xf8)&&a10_0x3ed4a4(Box,{'children':a10_0x3ed4a4(Text,{'children':_0x551a7a(0xed)})}),_0xbeb295===_0x551a7a(0xf2)&&a10_0x3ed4a4(Box,{'children':a10_0x3ed4a4(Text,{'color':_0x551a7a(0xd8),'children':_0x551a7a(0xe1)})})]});}function getStringWidth(_0x10864b){const _0x557384=a10_0x1dd982;let _0x1acfd3=0x0;for(const _0x2bacde of _0x10864b){/[\u4e00-\u9fa5]/[_0x557384(0xdb)](_0x2bacde)?_0x1acfd3+=0x2:_0x1acfd3+=0x1;}return _0x1acfd3;}function getRemainingSpaces(_0x32d918,_0x794526){const _0x51eb1b=a10_0x1dd982,_0x4800a9=getStringWidth(_0x794526);return Array(Math[_0x51eb1b(0xbd)](0x0,_0x32d918-_0x4800a9))[_0x51eb1b(0xe6)]('\x20')[_0x51eb1b(0xe0)]('');}function getMaxWidth(_0x58aa70,_0x55128b=0x2){let _0x40758a='',_0x1da045=0x0;for(const _0x578e42 of _0x58aa70){const _0x30ed7e=getStringWidth(_0x578e42);_0x30ed7e>_0x1da045&&(_0x1da045=_0x30ed7e,_0x40758a=_0x578e42);}return _0x40758a+'\x20'['repeat'](_0x55128b);}
|
|
1
|
+
function a10_0x2947(_0x44c952,_0x56ba30){const _0x24590d=a10_0x2459();return a10_0x2947=function(_0x294780,_0x394ad8){_0x294780=_0x294780-0x15a;let _0x553649=_0x24590d[_0x294780];return _0x553649;},a10_0x2947(_0x44c952,_0x56ba30);}const a10_0xf8b73f=a10_0x2947;(function(_0x495c03,_0x1b7c54){const _0x507d16=a10_0x2947,_0x5a3a00=_0x495c03();while(!![]){try{const _0x12a309=parseInt(_0x507d16(0x17f))/0x1+-parseInt(_0x507d16(0x189))/0x2+-parseInt(_0x507d16(0x19e))/0x3+parseInt(_0x507d16(0x166))/0x4*(parseInt(_0x507d16(0x179))/0x5)+parseInt(_0x507d16(0x19a))/0x6*(parseInt(_0x507d16(0x18d))/0x7)+parseInt(_0x507d16(0x175))/0x8*(-parseInt(_0x507d16(0x183))/0x9)+-parseInt(_0x507d16(0x171))/0xa;if(_0x12a309===_0x1b7c54)break;else _0x5a3a00['push'](_0x5a3a00['shift']());}catch(_0x5f52a4){_0x5a3a00['push'](_0x5a3a00['shift']());}}}(a10_0x2459,0x35071));import{jsx as a10_0xaece53,jsxs as a10_0x1cbc0f,Fragment as a10_0x352ca0}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a10_0x1d7936 from'ink-spinner';import{useGetOnlineMenuList}from'./get-online-menu-list.js';import{getLocalPages}from'./get-local-pages.js';import{createMenus}from'./create-menu.js';function a10_0x2459(){const _0x46b62f=['[✓]','√\x20菜单创建完成','请输入有效的\x20JS\x20https\x20链接','创建菜单失败','472120kXWjnq','catch','JS\x20链接无法访问','yellow','424kZZEND','CSS\x20链接','filter','blue','1875715vJqDNp','join','delete','online','white','path','346543wWJGtE','map','size','red','3402NOskki','*\x20CSS\x20链接:\x20','includes','max','selecting','gray','633074epMxlt','请输入有效的\x20CSS\x20https\x20链接','main','!\x20未找到本地页面,请先创建页面','3101oVrFHk','green','trim','已选择菜单','message','upArrow','done','creating','菜单名称','*\x20请选择要同步的菜单:','test','*\x20正在创建菜单...','add','4164PlzqLZ','dots','input-js','return','1284432MpaGos','\x20输入项目的\x20JS\x20资源链接(https://...)','then','repeat','has','\x20←\x20','value','Lovrabet平台','label','slice','请至少选择一个菜单','input-css','cyan','4eHLPuR','length','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认','\x20输入项目的\x20CSS\x20资源链接(https://...)','column','backspace','fill'];a10_0x2459=function(){return _0x46b62f;};return a10_0x2459();}import{isUrlReachable,isValidCssHttpsUrl,isValidJsHttpsUrl}from'./valid-url.js';import.meta[a10_0xf8b73f(0x18b)]&&render(a10_0xaece53(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x2580d2=a10_0xf8b73f,{exit:_0x52cb68}=useApp(),{loading:_0x271643,menuList:_0x2adcbe,error:_0x6d2f81}=useGetOnlineMenuList(),_0x4f0acd=getLocalPages(),_0x508d87=_0x2adcbe[_0x2580d2(0x180)](_0xb4088=>_0xb4088[_0x2580d2(0x17e)]),_0xa47c0a=[_0x2580d2(0x195),..._0x4f0acd[_0x2580d2(0x180)](_0x48207c=>_0x48207c[_0x2580d2(0x161)])],_0xaf9eb9=getStringWidth(getMaxWidth(_0xa47c0a,0x4)),_0x22240e=getStringWidth(getMaxWidth([_0x2580d2(0x195)])),[_0x4a3ec3,_0x33ab47]=useState(_0x2580d2(0x187)),[_0x48b046,_0xba4179]=useState(new Set()),[_0x1dc259,_0x404ffb]=useState(0x0),[_0x272b35,_0x524327]=useState(''),[_0x23e01f,_0x4630cd]=useState(''),[_0x53b1da,_0x3191e7]=useState(''),[_0x8c07fd,_0x1b45f8]=useState(''),[_0x26696a,_0x3c2828]=useState([]),_0x409c93=_0x4f0acd[_0x2580d2(0x180)](_0x2a977c=>({'label':_0x2a977c[_0x2580d2(0x161)],'path':_0x2a977c[_0x2580d2(0x17e)],'local':!![],'online':_0x508d87['includes'](_0x2a977c['path'])})),_0x1c6bea=_0x4f0acd['filter'](_0x542765=>{const _0x5a1914=_0x2580d2;return!_0x508d87['includes'](_0x542765[_0x5a1914(0x17e)]);});useEffect(()=>{const _0x422359=_0x2580d2;if(!_0x271643&&_0x4f0acd[_0x422359(0x167)]>0x0&&_0x48b046['size']===0x0){const _0x4bba70=new Set(_0x4f0acd[_0x422359(0x180)]((_0x2d37b0,_0x3dbc03)=>({'page':_0x2d37b0,'index':_0x3dbc03}))[_0x422359(0x177)](({page:_0x56d7c7})=>!_0x508d87[_0x422359(0x185)](_0x56d7c7['path']))[_0x422359(0x180)](({index:_0x4acf8c})=>_0x4acf8c));_0xba4179(_0x4bba70);}},[_0x271643,_0x4f0acd[_0x2580d2(0x167)],_0x508d87['length']]),useInput(async(_0x220005,_0x4a3412)=>{const _0x4fbfca=_0x2580d2;if(_0x4a3ec3===_0x4fbfca(0x187)){if(_0x4a3412[_0x4fbfca(0x192)]){_0x404ffb(_0x23d1ee=>_0x23d1ee>0x0?_0x23d1ee-0x1:_0x4f0acd[_0x4fbfca(0x167)]-0x1);return;}if(_0x4a3412['downArrow']){_0x404ffb(_0x51fa54=>_0x51fa54<_0x4f0acd[_0x4fbfca(0x167)]-0x1?_0x51fa54+0x1:0x0);return;}if(_0x220005==='\x20'){_0xba4179(_0x3a3350=>{const _0xe62374=_0x4fbfca,_0x407eb3=new Set(_0x3a3350);return _0x407eb3[_0xe62374(0x15d)](_0x1dc259)?_0x407eb3[_0xe62374(0x17b)](_0x1dc259):_0x407eb3[_0xe62374(0x199)](_0x1dc259),_0x407eb3;});return;}if(_0x220005==='a'||_0x220005==='A'){const _0x21746b=new Set(_0x4f0acd[_0x4fbfca(0x180)]((_0x5cc2e7,_0x4fee07)=>_0x4fee07));_0xba4179(_0x21746b);return;}if(_0x220005==='i'||_0x220005==='I'||_0x220005==='r'||_0x220005==='R'){_0xba4179(_0x5269b1=>{const _0x4430c6=_0x4fbfca,_0x3328d5=new Set();for(let _0x97ca0d=0x0;_0x97ca0d<_0x4f0acd['length'];_0x97ca0d++){!_0x5269b1[_0x4430c6(0x15d)](_0x97ca0d)&&_0x3328d5[_0x4430c6(0x199)](_0x97ca0d);}return _0x3328d5;});return;}if(_0x220005==='q'||_0x220005==='Q'){_0x52cb68();return;}if(_0x4a3412['return']){if(_0x48b046[_0x4fbfca(0x181)]===0x0){_0x1b45f8(_0x4fbfca(0x163));return;}const _0x3719ee=_0x4f0acd['filter']((_0x49b9d7,_0x5c7b4e)=>_0x48b046['has'](_0x5c7b4e)),_0x4e3795=_0x3719ee[_0x4fbfca(0x180)](_0x581a7e=>_0x581a7e[_0x4fbfca(0x161)])[_0x4fbfca(0x17a)](',\x20');_0x3c2828([{'label':_0x4fbfca(0x190),'value':_0x48b046[_0x4fbfca(0x181)]+'\x20个'}]),_0x1b45f8(''),_0x33ab47(_0x4fbfca(0x19c));return;}return;}if(_0x4a3ec3===_0x4fbfca(0x19c)){if(_0x4a3412['return']){const _0x442bc1=_0x53b1da['trim']();if(_0x442bc1==='')return;if(!isValidJsHttpsUrl(_0x442bc1)){_0x1b45f8(_0x4fbfca(0x16f));return;}if(!await isUrlReachable(_0x442bc1)){_0x1b45f8(_0x4fbfca(0x173));return;}_0x524327(_0x442bc1),_0x3c2828(_0x51a511=>[..._0x51a511,{'label':'JS\x20链接','value':_0x442bc1}]),_0x3191e7(''),_0x1b45f8(''),_0x33ab47(_0x4fbfca(0x164));return;}if(_0x4a3412[_0x4fbfca(0x16b)]||_0x4a3412[_0x4fbfca(0x17b)]){_0x3191e7(_0x5f7ddc=>_0x5f7ddc[_0x4fbfca(0x162)](0x0,-0x1)),_0x1b45f8('');return;}_0x3191e7(_0x5e8be4=>_0x5e8be4+_0x220005);return;}if(_0x4a3ec3===_0x4fbfca(0x164)){if(_0x4a3412[_0x4fbfca(0x19d)]){const _0x2d5fbc=_0x53b1da[_0x4fbfca(0x18f)]();if(_0x2d5fbc==='')return;if(!isValidCssHttpsUrl(_0x2d5fbc)){_0x1b45f8(_0x4fbfca(0x18a));return;}if(!await isUrlReachable(_0x2d5fbc)){_0x1b45f8('CSS\x20链接无法访问');return;}_0x4630cd(_0x2d5fbc),_0x3c2828(_0x8d4c68=>[..._0x8d4c68,{'label':_0x4fbfca(0x176),'value':_0x2d5fbc}]),_0x3191e7(''),_0x1b45f8(''),_0x33ab47(_0x4fbfca(0x194));const _0xf7cdef=_0x4f0acd[_0x4fbfca(0x177)]((_0x226861,_0x867286)=>_0x48b046[_0x4fbfca(0x15d)](_0x867286));createMenus(_0xf7cdef,[_0x272b35,_0x2d5fbc])[_0x4fbfca(0x15b)](()=>{const _0x55551c=_0x4fbfca;_0x33ab47(_0x55551c(0x193)),setTimeout(()=>{_0x52cb68();},0x3e8);})[_0x4fbfca(0x172)](_0xe6f35d=>{const _0x56c2ac=_0x4fbfca;_0x1b45f8(_0xe6f35d[_0x56c2ac(0x191)]||_0x56c2ac(0x170)),_0x33ab47(_0x56c2ac(0x187));});return;}if(_0x4a3412[_0x4fbfca(0x16b)]||_0x4a3412[_0x4fbfca(0x17b)]){_0x3191e7(_0x42f6f0=>_0x42f6f0[_0x4fbfca(0x162)](0x0,-0x1)),_0x1b45f8('');return;}_0x3191e7(_0x25e72e=>_0x25e72e+_0x220005);return;}});if(_0x271643)return a10_0x1cbc0f(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0xaece53(Text,{'children':'\x20\x20'}),a10_0xaece53(a10_0x1d7936,{'type':_0x2580d2(0x19b)}),a10_0xaece53(Text,{'children':'\x20正在获取线上菜单列表...'})]});if(_0x6d2f81)return a10_0x1cbc0f(Box,{'flexDirection':_0x2580d2(0x16a),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x1cbc0f(Text,{'color':'red','children':['✗\x20',_0x6d2f81]}),a10_0x1cbc0f(Box,{'marginTop':0x1,'children':[a10_0xaece53(Text,{'color':_0x2580d2(0x188),'children':'提示:使用\x20'}),a10_0xaece53(Text,{'color':_0x2580d2(0x165),'children':'lovrabet\x20auth'}),a10_0xaece53(Text,{'color':'gray','children':'\x20命令重新登录'})]})]});if(_0x4f0acd[_0x2580d2(0x167)]===0x0)return a10_0xaece53(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0xaece53(Text,{'color':_0x2580d2(0x174),'children':_0x2580d2(0x18c)})});return a10_0x1cbc0f(Box,{'flexDirection':_0x2580d2(0x16a),'marginTop':0x1,'marginBottom':0x1,'children':[_0x4a3ec3===_0x2580d2(0x187)&&a10_0x1cbc0f(a10_0x352ca0,{'children':[a10_0x1cbc0f(Box,{'children':[a10_0x1cbc0f(Text,{'bold':!![],'children':['\x20\x20',_0x2580d2(0x195),getRemainingSpaces(_0xaf9eb9,'菜单名称')]}),a10_0x1cbc0f(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x22240e,_0x2580d2(0x195))]}),a10_0x1cbc0f(Text,{'bold':!![],'children':[_0x2580d2(0x160),getRemainingSpaces(_0x22240e,_0x2580d2(0x195))]})]}),_0x409c93[_0x2580d2(0x180)](_0x1c4610=>a10_0x1cbc0f(Box,{'children':[a10_0x1cbc0f(Text,{'children':['\x20\x20',_0x1c4610[_0x2580d2(0x161)],getRemainingSpaces(_0xaf9eb9,_0x1c4610[_0x2580d2(0x161)])]}),a10_0x1cbc0f(Text,{'color':_0x2580d2(0x18e),'children':[_0x1c4610['local']?'✓':'✗',getRemainingSpaces(_0x22240e,'✓')]}),a10_0x1cbc0f(Text,{'color':_0x1c4610[_0x2580d2(0x17c)]?'green':_0x2580d2(0x182),'children':[_0x1c4610['online']?'✓':'✗',getRemainingSpaces(_0x22240e,'✓')]})]},_0x1c4610['path']))]}),_0x4a3ec3===_0x2580d2(0x187)&&_0x26696a[_0x2580d2(0x167)]===0x0&&a10_0xaece53(Box,{'marginTop':0x1,'children':a10_0xaece53(Text,{'color':_0x2580d2(0x165),'children':'*\x20同步菜单到\x20Lovrabet\x20平台'})}),_0x26696a[_0x2580d2(0x180)]((_0x25fb83,_0x3abeee)=>a10_0x1cbc0f(Box,{'children':[a10_0x1cbc0f(Text,{'color':'green','children':['√\x20',_0x25fb83[_0x2580d2(0x161)],':\x20']}),a10_0xaece53(Text,{'color':_0x2580d2(0x165),'children':_0x25fb83[_0x2580d2(0x15f)]})]},_0x3abeee)),_0x8c07fd&&_0x4a3ec3===_0x2580d2(0x187)&&a10_0xaece53(Box,{'marginTop':0x1,'children':a10_0x1cbc0f(Text,{'color':_0x2580d2(0x182),'children':['✗\x20',_0x8c07fd]})}),_0x4a3ec3===_0x2580d2(0x187)&&a10_0xaece53(a10_0x352ca0,{'children':a10_0x1cbc0f(Box,{'marginTop':_0x26696a[_0x2580d2(0x167)]>0x0||_0x8c07fd?0x1:0x0,'flexDirection':_0x2580d2(0x16a),'children':[a10_0xaece53(Text,{'bold':!![],'children':_0x2580d2(0x196)}),_0x4f0acd[_0x2580d2(0x180)]((_0x220aee,_0x1190ee)=>{const _0xc74b99=_0x2580d2,_0x4c8640=_0x1dc259===_0x1190ee,_0x556cf8=_0x48b046[_0xc74b99(0x15d)](_0x1190ee),_0x2adf87=_0x508d87[_0xc74b99(0x185)](_0x220aee['path']),_0x2bbf60=_0x2adf87?'更新':'新建';return a10_0xaece53(Box,{'children':a10_0x1cbc0f(Text,{'backgroundColor':_0x4c8640?_0xc74b99(0x178):undefined,'color':_0x4c8640?_0xc74b99(0x17d):undefined,'children':['\x20\x20',_0x556cf8?_0xc74b99(0x16d):'[\x20]','\x20',_0x220aee[_0xc74b99(0x161)]]})},_0x220aee[_0xc74b99(0x17e)]);}),a10_0xaece53(Box,{'marginTop':0x1,'children':a10_0x1cbc0f(Text,{'color':'gray','children':['\x20',_0x2580d2(0x168)]})})]})}),_0x4a3ec3===_0x2580d2(0x19c)&&a10_0x1cbc0f(a10_0x352ca0,{'children':[a10_0x1cbc0f(Box,{'children':[a10_0xaece53(Text,{'children':'*\x20JS\x20链接:\x20'}),a10_0xaece53(Text,{'color':_0x2580d2(0x18e),'children':_0x53b1da}),_0x8c07fd&&a10_0x1cbc0f(Text,{'color':'red','children':[_0x2580d2(0x15e),_0x8c07fd]})]}),!_0x8c07fd&&a10_0xaece53(Box,{'children':a10_0xaece53(Text,{'color':_0x2580d2(0x188),'children':_0x2580d2(0x15a)})})]}),_0x4a3ec3==='input-css'&&a10_0x1cbc0f(a10_0x352ca0,{'children':[a10_0x1cbc0f(Box,{'children':[a10_0xaece53(Text,{'children':_0x2580d2(0x184)}),a10_0xaece53(Text,{'color':'green','children':_0x53b1da}),_0x8c07fd&&a10_0x1cbc0f(Text,{'color':_0x2580d2(0x182),'children':[_0x2580d2(0x15e),_0x8c07fd]})]}),!_0x8c07fd&&a10_0xaece53(Box,{'children':a10_0xaece53(Text,{'color':_0x2580d2(0x188),'children':_0x2580d2(0x169)})})]}),_0x4a3ec3===_0x2580d2(0x194)&&a10_0xaece53(Box,{'children':a10_0xaece53(Text,{'children':_0x2580d2(0x198)})}),_0x4a3ec3===_0x2580d2(0x193)&&a10_0xaece53(Box,{'children':a10_0xaece53(Text,{'color':_0x2580d2(0x18e),'children':_0x2580d2(0x16e)})})]});}function getStringWidth(_0x142e3f){const _0x383152=a10_0xf8b73f;let _0x5d9414=0x0;for(const _0x423941 of _0x142e3f){/[\u4e00-\u9fa5]/[_0x383152(0x197)](_0x423941)?_0x5d9414+=0x2:_0x5d9414+=0x1;}return _0x5d9414;}function getRemainingSpaces(_0x17c01a,_0x20d16e){const _0x353ba7=a10_0xf8b73f,_0x2da3bc=getStringWidth(_0x20d16e);return Array(Math[_0x353ba7(0x186)](0x0,_0x17c01a-_0x2da3bc))[_0x353ba7(0x16c)]('\x20')['join']('');}function getMaxWidth(_0xf87d46,_0x3dbb1f=0x2){const _0x540fa5=a10_0xf8b73f;let _0x297d13='',_0x1fd067=0x0;for(const _0x52aeba of _0xf87d46){const _0x35dd61=getStringWidth(_0x52aeba);_0x35dd61>_0x1fd067&&(_0x1fd067=_0x35dd61,_0x297d13=_0x52aeba);}return _0x297d13+'\x20'[_0x540fa5(0x15c)](_0x3dbb1f);}
|