@lovrabet/cli 1.1.18 → 1.1.19
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/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.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x426af0,_0x4d36e3){const _0x509968=a0_0x3b32,_0x298273=_0x426af0();while(!![]){try{const _0x59fd32=-parseInt(_0x509968(0x144))/0x1+parseInt(_0x509968(0x14e))/0x2+-parseInt(_0x509968(0x14d))/0x3+-parseInt(_0x509968(0x136))/0x4+-parseInt(_0x509968(0x147))/0x5+parseInt(_0x509968(0x13b))/0x6*(parseInt(_0x509968(0x146))/0x7)+parseInt(_0x509968(0x138))/0x8;if(_0x59fd32===_0x4d36e3)break;else _0x298273['push'](_0x298273['shift']());}catch(_0x28c88d){_0x298273['push'](_0x298273['shift']());}}}(a0_0x1055,0x657a2));import{jsx as a0_0x4a8bfa,jsxs as a0_0x42d306}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';function a0_0x1055(){const _0x1cea8f=['\x20←\x20','页面路由地址:\x20','\x20已存在,请使用其他路径','my-page','页面路径不合法','729623oriPnX','\x20Step2:\x20','21819dFvrhE','2343850JWgEQV','backspace','red','页面路径\x20','trim','return','1915314nMSsCg','1391872LWjTgx','endsWith','existsSync','startsWith','2832992yLAeMK','gray','17046096cwfMAd','includes','路径不能包含连续的\x20/','258eAwFMR','delete','slice','路径不能以\x20/\x20开头或结尾'];a0_0x1055=function(){return _0x1cea8f;};return a0_0x1055();}function a0_0x3b32(_0x23555b,_0xbfe4df){const _0x105546=a0_0x1055();return a0_0x3b32=function(_0x3b3265,_0x5f5589){_0x3b3265=_0x3b3265-0x134;let _0x12632c=_0x105546[_0x3b3265];return _0x12632c;},a0_0x3b32(_0x23555b,_0xbfe4df);}import a0_0xb1a2fc from'node:fs';export function InputProjectCode(_0x121162){const _0x207884=a0_0x3b32,{onSubmit:_0x37d60d,pagePath:_0x1ecabe}=_0x121162,[_0x5dabd1,_0x56497a]=useState(''),[_0x53a996,_0x3ed016]=useState(''),_0x304be3=_0x207884(0x142);function _0x3b11aa(_0x1b1074){const _0x107eec=_0x207884;if(_0x1b1074['length']>0x64)return{'valid':![],'message':'页面路径长度不能超过\x20100\x20个字符'};if(_0x1b1074[_0x107eec(0x135)]('/')||_0x1b1074[_0x107eec(0x14f)]('/'))return{'valid':![],'message':_0x107eec(0x13e)};if(_0x1b1074[_0x107eec(0x139)]('//'))return{'valid':![],'message':_0x107eec(0x13a)};const _0x3c2c1d=_0x1b1074['split']('/');for(const _0x285628 of _0x3c2c1d){if(!_0x285628)continue;const _0x5ae1bc=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x5ae1bc['test'](_0x285628))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x14b6e1,_0x1477fd)=>{const _0x5d1702=_0x207884;if(_0x1477fd[_0x5d1702(0x14c)]){const _0x32ad53=_0x5dabd1[_0x5d1702(0x14b)]()||_0x304be3;if(_0x53a996)return;const _0x287d3e=_0x1ecabe+'/'+_0x32ad53;if(a0_0xb1a2fc[_0x5d1702(0x134)](_0x287d3e)){_0x3ed016(_0x5d1702(0x14a)+_0x32ad53+_0x5d1702(0x141));return;}_0x37d60d(_0x32ad53),_0x56497a(''),_0x3ed016('');}else _0x1477fd[_0x5d1702(0x148)]||_0x1477fd[_0x5d1702(0x13c)]?_0x56497a(_0x227f9f=>{const _0x1de3f2=_0x5d1702,_0x3f8a7a=_0x227f9f[_0x1de3f2(0x13d)](0x0,-0x1),{valid:_0x393e2a,message:_0x14fbb7}=_0x3b11aa(_0x3f8a7a);return _0x3ed016(_0x393e2a?'':_0x14fbb7||_0x1de3f2(0x143)),_0x3f8a7a;}):_0x56497a(_0x3cd5a8=>{const _0x398028=_0x5d1702,_0x2bb9bb=_0x3cd5a8+_0x14b6e1,{valid:_0x18ed2c,message:_0x474f7b}=_0x3b11aa(_0x2bb9bb);return _0x3ed016(_0x18ed2c?'':_0x474f7b||_0x398028(0x143)),_0x2bb9bb;});}),a0_0x42d306(Box,{'flexDirection':'column','children':[a0_0x42d306(Box,{'children':[a0_0x4a8bfa(Text,{'color':'gray','children':_0x207884(0x145)}),a0_0x4a8bfa(Text,{'children':_0x207884(0x140)}),_0x5dabd1?a0_0x4a8bfa(Text,{'color':'green','children':_0x5dabd1}):a0_0x4a8bfa(Text,{'color':_0x207884(0x137),'children':_0x304be3}),_0x53a996&&a0_0x42d306(Text,{'color':_0x207884(0x149),'children':[_0x207884(0x13f),_0x53a996]})]}),!_0x53a996&&!_0x5dabd1&&a0_0x4a8bfa(Box,{'children':a0_0x4a8bfa(Text,{'color':_0x207884(0x137),'children':'\x20直接回车确认,或输入自定义路由地址'})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x45b705=a1_0x33c5;function a1_0x54f0(){const _0x403b46=['382182zkajup','processTemplate','\x20*\x20页面文件已创建,可直接通过路由访问','正在创建页面,请稍候…','10rRxMcE','201404kjCSIY','../../templates/pages','3015ajjAFR','cyan','then','页面添加失败:\x20','\x20Step2:\x20','\x20*\x20路由地址:\x20','now','104OFUnHm','pages','url','16232CYZEuR','119htxXoN','message','add-page','15395688cCzIUo','395884rodBgr','setLogPath','join','114500kntKiY','已输入的页面路由\x20','resolve','30xJdZgn','info','开始添加页面:\x20','cwd','页面添加成功:\x20','dirname','\x20*\x20页面路径:\x20','column','src','error','green','finally','4310053PYwqaH','gray'];a1_0x54f0=function(){return _0x403b46;};return a1_0x54f0();}(function(_0x5a9d94,_0x4fd0cb){const _0x3492c2=a1_0x33c5,_0x245189=_0x5a9d94();while(!![]){try{const _0xb6f480=parseInt(_0x3492c2(0x12b))/0x1+parseInt(_0x3492c2(0x144))/0x2*(-parseInt(_0x3492c2(0x131))/0x3)+parseInt(_0x3492c2(0x14d))/0x4*(parseInt(_0x3492c2(0x12e))/0x5)+parseInt(_0x3492c2(0x13f))/0x6*(parseInt(_0x3492c2(0x127))/0x7)+parseInt(_0x3492c2(0x126))/0x8*(parseInt(_0x3492c2(0x146))/0x9)+-parseInt(_0x3492c2(0x143))/0xa*(-parseInt(_0x3492c2(0x13d))/0xb)+-parseInt(_0x3492c2(0x12a))/0xc;if(_0xb6f480===_0x4fd0cb)break;else _0x245189['push'](_0x245189['shift']());}catch(_0x8040fc){_0x245189['push'](_0x245189['shift']());}}}(a1_0x54f0,0xd0e7d));import{jsx as a1_0x37e524,jsxs as a1_0x3094c4,Fragment as a1_0x4711e1}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x311a0e from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a1_0x33c5(_0x3c38a3,_0x20f146){const _0x54f0be=a1_0x54f0();return a1_0x33c5=function(_0x33c54f,_0x1b62c9){_0x33c54f=_0x33c54f-0x124;let _0x2d5c7d=_0x54f0be[_0x33c54f];return _0x2d5c7d;},a1_0x33c5(_0x3c38a3,_0x20f146);}import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x311a0e[a1_0x45b705(0x136)](fileURLToPath(import.meta[a1_0x45b705(0x125)])),pageTemplateDir=a1_0x311a0e[a1_0x45b705(0x130)](__dirname,a1_0x45b705(0x145)),projectDir=process[a1_0x45b705(0x134)]();export const AddPage=()=>{const _0x5a886e=a1_0x45b705,{exit:_0x12cd08}=useApp(),[_0x578570,_0x2eff6b]=useState(''),[_0x1f71e4,_0x8f6b26]=useState(''),[_0x6edd0d,_0x3c2fd8]=useState(![]),[_0x32a5e2,_0x28f055]=useState(![]),_0x1482e8=a1_0x311a0e[_0x5a886e(0x12d)](projectDir,_0x5a886e(0x139),_0x5a886e(0x124)),_0x430b8f=a1_0x311a0e[_0x5a886e(0x12d)](_0x1482e8,_0x1f71e4),_0x421e49=a1_0x311a0e[_0x5a886e(0x12d)](_0x5a886e(0x139),_0x5a886e(0x124),_0x1f71e4);useEffect(()=>{const _0x40be48=_0x5a886e,_0x702c45=a1_0x311a0e[_0x40be48(0x130)](pageTemplateDir,_0x578570);if(_0x578570&&_0x1f71e4){_0x3c2fd8(!![]),logger[_0x40be48(0x12c)](process[_0x40be48(0x134)]());const _0x4e3eff=Date[_0x40be48(0x14c)]();logger[_0x40be48(0x132)]('add-page',_0x40be48(0x133)+_0x1f71e4,{'template':_0x578570,'targetPath':_0x421e49}),TemplateReplacer[_0x40be48(0x140)](_0x702c45,a1_0x311a0e[_0x40be48(0x12d)](_0x1482e8,_0x1f71e4),_0x1f71e4,_0x578570)[_0x40be48(0x148)](()=>{const _0x93017d=_0x40be48,_0x277eac=Date['now']()-_0x4e3eff;logger['success']('add-page',_0x93017d(0x135)+_0x1f71e4,_0x277eac,{'template':_0x578570,'targetPath':_0x421e49,'routePath':_0x1f71e4}),_0x28f055(!![]);})['catch'](_0x524a90=>{const _0xdbe6bf=_0x40be48,_0x3b0138=Date[_0xdbe6bf(0x14c)]()-_0x4e3eff;logger[_0xdbe6bf(0x13a)](_0xdbe6bf(0x129),_0xdbe6bf(0x149)+_0x1f71e4,{'template':_0x578570,'targetPath':_0x421e49,'error':_0x524a90 instanceof Error?_0x524a90[_0xdbe6bf(0x128)]:String(_0x524a90),'duration':_0x3b0138});})[_0x40be48(0x13c)](()=>{_0x3c2fd8(![]);});}},[_0x578570,_0x1f71e4]),useEffect(()=>{_0x32a5e2&&setTimeout(()=>{_0x12cd08();});},[_0x32a5e2]);if(_0x578570)return a1_0x3094c4(Box,{'flexDirection':_0x5a886e(0x138),'paddingY':0x1,'children':[a1_0x3094c4(Box,{'children':[a1_0x37e524(Text,{'color':_0x5a886e(0x13e),'children':'\x20Step1:\x20'}),a1_0x37e524(Text,{'children':'已选择页面模板\x20'}),a1_0x37e524(Text,{'color':_0x5a886e(0x13b),'children':_0x578570})]}),_0x1f71e4?a1_0x3094c4(Box,{'children':[a1_0x37e524(Text,{'color':_0x5a886e(0x13e),'children':_0x5a886e(0x14a)}),a1_0x37e524(Text,{'children':_0x5a886e(0x12f)}),a1_0x37e524(Text,{'color':'green','children':_0x1f71e4})]}):a1_0x37e524(InputProjectCode,{'pagePath':_0x430b8f,'onSubmit':_0x8f6b26}),_0x1f71e4&&_0x6edd0d?a1_0x3094c4(Box,{'marginTop':0x1,'children':[a1_0x37e524(Box,{'width':'4'}),a1_0x37e524(Text,{'children':_0x5a886e(0x142)})]}):null,_0x32a5e2?a1_0x3094c4(a1_0x4711e1,{'children':[a1_0x37e524(Box,{'marginTop':0x1,'children':a1_0x37e524(Text,{'color':_0x5a886e(0x13e),'children':'\x20*\x20页面创建成功!'})}),a1_0x3094c4(Box,{'children':[a1_0x37e524(Text,{'color':_0x5a886e(0x13e),'children':_0x5a886e(0x137)}),a1_0x37e524(Text,{'color':_0x5a886e(0x13b),'children':_0x421e49})]}),a1_0x3094c4(Box,{'children':[a1_0x37e524(Text,{'color':_0x5a886e(0x13e),'children':_0x5a886e(0x14b)}),a1_0x3094c4(Text,{'color':_0x5a886e(0x13b),'children':['/',_0x1f71e4]})]}),a1_0x37e524(Box,{'marginTop':0x1,'children':a1_0x37e524(Text,{'color':_0x5a886e(0x147),'children':_0x5a886e(0x141)})})]}):null]});return a1_0x37e524(SelectPageTemplate,{'onSelect':_0x2eff6b});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a2_0x3793(){const _0x22cd81=['upArrow','3062830svFhVB','localeCompare','join','green','正在加载页面模板...','5054DMocac','sdk-fetch','请选择您要创建的页面模板','4320852keGhEH','334vZNNSX','label','url','resolve','templates/pages','error','获取模板列表失败:','column','144745KqzmIY','6658448wPeNxh','blank','63dxMuRS','\x20Step1:\x20','downArrow','\x20\x20\x20\x20\x20\x20\x20\x20','length','onSelect','\x20\x20\x20\x20\x20\x20>\x20','filter','236052SbiFhp','dirname','3490662pxBFzj','gray','8ItZXSj','map'];a2_0x3793=function(){return _0x22cd81;};return a2_0x3793();}(function(_0x44cafc,_0x28f71f){const _0x28f395=a2_0x229a,_0x3810f2=_0x44cafc();while(!![]){try{const _0x1025da=parseInt(_0x28f395(0x18e))/0x1*(-parseInt(_0x28f395(0x18a))/0x2)+-parseInt(_0x28f395(0x18d))/0x3+parseInt(_0x28f395(0x174))/0x4+-parseInt(_0x28f395(0x196))/0x5+-parseInt(_0x28f395(0x17e))/0x6+-parseInt(_0x28f395(0x180))/0x7*(parseInt(_0x28f395(0x182))/0x8)+parseInt(_0x28f395(0x176))/0x9*(parseInt(_0x28f395(0x185))/0xa);if(_0x1025da===_0x28f71f)break;else _0x3810f2['push'](_0x3810f2['shift']());}catch(_0xab07ae){_0x3810f2['push'](_0x3810f2['shift']());}}}(a2_0x3793,0xe9b96));import{jsx as a2_0x2a0362,jsxs as a2_0x2c81b6}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x33aa95 from'node:path';import{fileURLToPath}from'node:url';function a2_0x229a(_0x2ced4b,_0x25b63b){const _0x379371=a2_0x3793();return a2_0x229a=function(_0x229a32,_0x4b29a0){_0x229a32=_0x229a32-0x174;let _0x178bf2=_0x379371[_0x229a32];return _0x178bf2;},a2_0x229a(_0x2ced4b,_0x25b63b);}async function getTemplateList(){const _0x9826f1=a2_0x229a;try{const _0xfa9c66=fileURLToPath(import.meta[_0x9826f1(0x190)]),_0x15097a=a2_0x33aa95[_0x9826f1(0x191)](a2_0x33aa95[_0x9826f1(0x17f)](_0xfa9c66),'../..'),_0x1b6e7e=a2_0x33aa95[_0x9826f1(0x187)](_0x15097a,_0x9826f1(0x192)),_0x433446=await readdir(_0x1b6e7e,{'withFileTypes':!![]}),_0x315006=_0x433446[_0x9826f1(0x17d)](_0x2110bf=>_0x2110bf['isDirectory']())[_0x9826f1(0x183)](_0x2dacf1=>({'label':_0x2dacf1['name']}))['sort']((_0x23296f,_0x2e96b8)=>_0x23296f['label'][_0x9826f1(0x186)](_0x2e96b8[_0x9826f1(0x18f)]));return _0x315006;}catch(_0x4e698b){return console[_0x9826f1(0x193)](_0x9826f1(0x194),_0x4e698b),[{'label':_0x9826f1(0x175)},{'label':_0x9826f1(0x18b)}];}}export function SelectPageTemplate(_0x6bd916){const _0x5c08c9=a2_0x229a,[_0x3634d1,_0xd3e412]=useState(0x0),[_0x527cc0,_0x395998]=useState([]),[_0xe1ad06,_0x494f9e]=useState(!![]);useEffect(()=>{async function _0x1bd3aa(){const _0x55b3a3=await getTemplateList();_0x395998(_0x55b3a3),_0x494f9e(![]);}_0x1bd3aa();},[]),useInput((_0x45f77d,_0xba61ad)=>{const _0x5ada1c=a2_0x229a;if(_0xe1ad06)return;if(_0xba61ad['return']){const _0x21bf4a=_0x527cc0[_0x3634d1];_0x21bf4a&&_0x6bd916[_0x5ada1c(0x17b)](_0x21bf4a['label']);}_0xba61ad[_0x5ada1c(0x184)]&&_0xd3e412(_0x11a203=>_0x11a203===0x0?_0x527cc0[_0x5ada1c(0x17a)]-0x1:_0x11a203-0x1),_0xba61ad[_0x5ada1c(0x178)]&&_0xd3e412(_0x1330b1=>_0x1330b1===_0x527cc0[_0x5ada1c(0x17a)]-0x1?0x0:_0x1330b1+0x1);});if(_0xe1ad06)return a2_0x2a0362(Box,{'flexDirection':'column','paddingY':0x1,'children':a2_0x2c81b6(Box,{'children':[a2_0x2a0362(Text,{'color':_0x5c08c9(0x181),'children':_0x5c08c9(0x177)}),a2_0x2a0362(Text,{'children':_0x5c08c9(0x189)})]})});return a2_0x2c81b6(Box,{'flexDirection':_0x5c08c9(0x195),'paddingY':0x1,'children':[a2_0x2c81b6(Box,{'children':[a2_0x2a0362(Text,{'color':_0x5c08c9(0x181),'children':_0x5c08c9(0x177)}),a2_0x2a0362(Text,{'children':_0x5c08c9(0x18c)})]}),_0x527cc0['map']((_0x29f2e8,_0x18340e)=>{const _0x2fdc94=_0x5c08c9,_0x1cf6ae=_0x18340e===_0x3634d1,_0x8bc93f=_0x1cf6ae?_0x2fdc94(0x17c)+_0x29f2e8[_0x2fdc94(0x18f)]:_0x2fdc94(0x179)+_0x29f2e8['label'];return a2_0x2a0362(Box,{'children':a2_0x2a0362(Text,{'color':_0x1cf6ae?_0x2fdc94(0x188):undefined,'children':_0x8bc93f})},_0x8bc93f);})]});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a3_0x2a3a(){const _0x8ba7e4=['1171382sFGTeZ','√\x20文档生成完成!成功\x20','5019104jHkNNf','文档生成完成','success','84bOQOCe','未找到任何数据集','length','\x1b[33m!\x20以下数据集代码不存在:\x20','api-doc','725019UzWjqw','lovrabet\x20auth','error','239845GeszpG','datasetCode','gray','map','指定的数据集代码都不存在:\x20','\x20个数据集中筛选出\x20','cwd','使用配置的应用AppCode:\x20','\x20个匹配的数据集\x1b[0m','env','filter','white','\x20重新登录后再试','🚀\x20','正在生成\x20','20rGMnjt','3wvHwgK','includes','yellow','6881yXzHFv','文档生成失败:\x20','log','\x20个数据集','正在获取数据集列表...','102GpIgdg','dim','*\x20共处理\x20','setLogPath','\x1b[90m*\x20从\x20','\x1b[0m','93564XpVDdp','4310946tuqlPN','\x20-\x20','filePath','cyan','1914TZpHJZ','未提供应用AppCode,且配置中也没有默认值','join','.md\x20(','red','\x20个数据集的文档...'];a3_0x2a3a=function(){return _0x8ba7e4;};return a3_0x2a3a();}(function(_0x5b0d06,_0x52fe39){const _0x5dc113=a3_0x3393,_0x511378=_0x5b0d06();while(!![]){try{const _0x4a9b64=parseInt(_0x5dc113(0x1c6))/0x1+parseInt(_0x5dc113(0x1bc))/0x2*(-parseInt(_0x5dc113(0x1d9))/0x3)+-parseInt(_0x5dc113(0x1c1))/0x4*(parseInt(_0x5dc113(0x1c9))/0x5)+parseInt(_0x5dc113(0x1ab))/0x6*(-parseInt(_0x5dc113(0x1a6))/0x7)+-parseInt(_0x5dc113(0x1be))/0x8+-parseInt(_0x5dc113(0x1b2))/0x9*(-parseInt(_0x5dc113(0x1d8))/0xa)+-parseInt(_0x5dc113(0x1b6))/0xb*(-parseInt(_0x5dc113(0x1b1))/0xc);if(_0x4a9b64===_0x52fe39)break;else _0x511378['push'](_0x511378['shift']());}catch(_0x5dad98){_0x511378['push'](_0x511378['shift']());}}}(a3_0x2a3a,0xc3ef2));import{jsx as a3_0x1e4f56,jsxs as a3_0x3ff749,Fragment as a3_0x313fc4}from'react/jsx-runtime';function a3_0x3393(_0x37a7c3,_0x12f54f){const _0x2a3ad8=a3_0x2a3a();return a3_0x3393=function(_0x339321,_0x4c0048){_0x339321=_0x339321-0x1a4;let _0x3e3629=_0x2a3ad8[_0x339321];return _0x3e3629;},a3_0x3393(_0x37a7c3,_0x12f54f);}import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';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';export const ApiDocUI=({appCode:_0x8b91ce,env:_0x3e0334,output:_0x3f74db,extraParams:_0x51683d,datasetCodes:_0x470a74})=>{const _0x290a18=a3_0x3393,{exit:_0x3b6ce8}=useApp(),[_0x48e90c,_0x34feab]=useState(![]),[_0x594629,_0x4de7a9]=useState(''),[_0xb61a07,_0x4266d1]=useState(![]),[_0x20f940,_0x1bbb14]=useState(null),[_0x5246d0,_0x405421]=useState(null),[_0x36107f,_0x1d2f3d]=useState(0x0),_0x866167=readConfig(),_0x4fd282=getConfigAppCode(),_0x44c6ad=_0x8b91ce||_0x4fd282,_0x1004f8=typeof _0x866167?.['env']==='string'?_0x866167[_0x290a18(0x1d2)]:undefined,_0x2e0d03=_0x3e0334||_0x1004f8||'online';initEnv(_0x2e0d03);const _0x1381c5=_0x3f74db||'./docs',_0x4216ff=_0x8b91ce?'使用指定的应用AppCode:\x20'+_0x44c6ad:_0x290a18(0x1d0)+_0x44c6ad;useEffect(()=>{_0x34feab(!![]),_0x5f218b();},[]),useEffect(()=>{(_0xb61a07||_0x20f940)&&_0x3b6ce8();},[_0xb61a07,_0x20f940,_0x3b6ce8]);async function _0x5f218b(){const _0x4a2492=_0x290a18;if(!_0x44c6ad){_0x1bbb14(_0x4a2492(0x1b7));return;}try{logger[_0x4a2492(0x1ae)](process[_0x4a2492(0x1cf)]()),_0x4de7a9(_0x4a2492(0x1aa));const {configArray:_0xa88552}=await fetchModelList(_0x44c6ad);_0x1d2f3d(_0xa88552[_0x4a2492(0x1c3)]);if(_0xa88552[_0x4a2492(0x1c3)]===0x0){_0x1bbb14(_0x4a2492(0x1c2));return;}let _0x2b51b7=_0xa88552;if(_0x470a74&&_0x470a74[_0x4a2492(0x1c3)]>0x0){_0x2b51b7=_0xa88552[_0x4a2492(0x1d3)](_0x1a041d=>_0x470a74[_0x4a2492(0x1a4)](_0x1a041d[_0x4a2492(0x1ca)]));const _0xff554d=_0x2b51b7[_0x4a2492(0x1cc)](_0xd03079=>_0xd03079[_0x4a2492(0x1ca)]),_0x4da62e=_0x470a74[_0x4a2492(0x1d3)](_0x5577b1=>!_0xff554d[_0x4a2492(0x1a4)](_0x5577b1));_0x4da62e[_0x4a2492(0x1c3)]>0x0&&console[_0x4a2492(0x1a8)](_0x4a2492(0x1c4)+_0x4da62e[_0x4a2492(0x1b8)](',\x20')+_0x4a2492(0x1b0));if(_0x2b51b7['length']===0x0){_0x1bbb14(_0x4a2492(0x1cd)+_0x470a74[_0x4a2492(0x1b8)](',\x20'));return;}console[_0x4a2492(0x1a8)](_0x4a2492(0x1af)+_0xa88552['length']+_0x4a2492(0x1ce)+_0x2b51b7[_0x4a2492(0x1c3)]+_0x4a2492(0x1d1));}_0x4de7a9(_0x4a2492(0x1d7)+_0x2b51b7[_0x4a2492(0x1c3)]+_0x4a2492(0x1bb));const _0x1735a9=await generateDatasetDocs(_0x2b51b7,_0x44c6ad,_0x1381c5,(_0x37a771,_0x3ed995,_0x15a66a)=>{const _0x1d0601=_0x4a2492;_0x4de7a9('正在生成\x20'+_0x15a66a+_0x1d0601(0x1b9)+_0x37a771+'/'+_0x3ed995+')');},_0x51683d);_0x405421(_0x1735a9),_0x4266d1(!![]);const _0x1b595a=_0x1735a9['filter'](_0x3e5f77=>_0x3e5f77[_0x4a2492(0x1c0)])[_0x4a2492(0x1c3)],_0x46011b=_0x1735a9[_0x4a2492(0x1d3)](_0x5e307d=>!_0x5e307d['success'])['length'];logger[_0x4a2492(0x1c0)](_0x4a2492(0x1c5),_0x4a2492(0x1bf),undefined,{'totalCount':_0x1735a9[_0x4a2492(0x1c3)],'successCount':_0x1b595a,'failCount':_0x46011b,'outputDir':_0x1381c5});}catch(_0x1bf9fa){const _0x3afcff=_0x1bf9fa instanceof Error?_0x1bf9fa['message']:String(_0x1bf9fa);logger[_0x4a2492(0x1c8)]('api-doc',_0x4a2492(0x1a7)+_0x3afcff,{'appCode':_0x44c6ad,'outputDir':_0x1381c5}),_0x1bbb14(_0x4a2492(0x1a7)+_0x3afcff);}finally{_0x34feab(![]);}}const _0xebc9ae=_0x5246d0?.[_0x290a18(0x1d3)](_0x44b657=>_0x44b657[_0x290a18(0x1c0)])['length']||0x0,_0x46dfa2=_0x5246d0?.[_0x290a18(0x1d3)](_0x12abdd=>!_0x12abdd[_0x290a18(0x1c0)])[_0x290a18(0x1c3)]||0x0;return a3_0x3ff749(Box,{'flexDirection':'column','children':[(_0x48e90c||_0xb61a07)&&a3_0x3ff749(Box,{'children':[a3_0x1e4f56(Text,{'color':_0x290a18(0x1cb),'children':'*\x20'}),a3_0x1e4f56(Text,{'color':_0x8b91ce?_0x290a18(0x1d4):_0x290a18(0x1ac),'children':_0x4216ff})]}),_0x48e90c&&a3_0x1e4f56(Box,{'children':a3_0x3ff749(Text,{'children':[_0x290a18(0x1d6),_0x594629,'\x20(环境:\x20',_0x2e0d03,')']})}),_0xb61a07&&_0x5246d0&&a3_0x3ff749(Box,{'flexDirection':'column','children':[a3_0x1e4f56(Box,{'children':a3_0x3ff749(Text,{'color':'green','children':[_0x290a18(0x1bd),_0xebc9ae,'\x20个',_0x46dfa2>0x0&&',\x20失败\x20'+_0x46dfa2+'\x20个']})}),a3_0x1e4f56(Box,{'marginTop':0x1,'children':a3_0x3ff749(Text,{'color':'gray','children':[_0x290a18(0x1ad),_0x36107f,_0x290a18(0x1a9)]})}),a3_0x3ff749(Box,{'marginTop':0x1,'children':[a3_0x1e4f56(Text,{'color':'gray','children':'*\x20输出目录:\x20'}),a3_0x1e4f56(Text,{'color':_0x290a18(0x1b5),'children':_0x1381c5})]}),_0xebc9ae>0x0&&a3_0x3ff749(a3_0x313fc4,{'children':[a3_0x1e4f56(Box,{'marginTop':0x1,'children':a3_0x1e4f56(Text,{'color':'gray','children':'*\x20生成的文档文件:'})}),_0x5246d0[_0x290a18(0x1d3)](_0x59d838=>_0x59d838[_0x290a18(0x1c0)])[_0x290a18(0x1cc)]((_0x19aa81,_0xdd6d4c)=>a3_0x3ff749(Box,{'marginLeft':0x2,'children':[a3_0x3ff749(Text,{'color':_0x290a18(0x1b5),'children':['•\x20',_0x19aa81[_0x290a18(0x1b4)]]}),a3_0x3ff749(Text,{'color':_0x290a18(0x1ac),'children':[_0x290a18(0x1b3),_0x19aa81['datasetName']]})]},_0xdd6d4c))]}),_0x46dfa2>0x0&&a3_0x3ff749(a3_0x313fc4,{'children':[a3_0x1e4f56(Box,{'marginTop':0x1,'children':a3_0x1e4f56(Text,{'color':_0x290a18(0x1a5),'children':'⚠️\x20以下数据集生成失败:'})}),_0x5246d0[_0x290a18(0x1d3)](_0x1702d2=>!_0x1702d2[_0x290a18(0x1c0)])[_0x290a18(0x1cc)]((_0xa58901,_0xd0cc2a)=>a3_0x3ff749(Box,{'marginLeft':0x2,'flexDirection':'column','children':[a3_0x3ff749(Text,{'color':'red','children':['•\x20',_0xa58901['datasetName'],'\x20(',_0xa58901['datasetCode'],')']}),_0xa58901[_0x290a18(0x1c8)]&&a3_0x1e4f56(Box,{'marginLeft':0x2,'children':a3_0x1e4f56(Text,{'color':'dim','children':_0xa58901['error']})})]},_0xd0cc2a))]})]}),_0x20f940&&a3_0x3ff749(Box,{'flexDirection':'column','children':[a3_0x1e4f56(Box,{'children':a3_0x3ff749(Text,{'color':_0x290a18(0x1ba),'children':['❌\x20',_0x20f940]})}),_0x20f940[_0x290a18(0x1a4)]('登录')&&a3_0x3ff749(Box,{'marginTop':0x1,'children':[a3_0x1e4f56(Text,{'color':'yellow','children':'💡\x20请使用\x20'}),a3_0x1e4f56(Text,{'color':_0x290a18(0x1b5),'children':_0x290a18(0x1c7)}),a3_0x1e4f56(Text,{'color':_0x290a18(0x1a5),'children':_0x290a18(0x1d5)})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x332a54,_0x336795){const _0x4fabce=a4_0x2ae3,_0x27d18c=_0x332a54();while(!![]){try{const _0x363932=parseInt(_0x4fabce(0x68))/0x1*(-parseInt(_0x4fabce(0x8b))/0x2)+-parseInt(_0x4fabce(0x89))/0x3+-parseInt(_0x4fabce(0x8c))/0x4*(parseInt(_0x4fabce(0x7f))/0x5)+-parseInt(_0x4fabce(0x8f))/0x6+parseInt(_0x4fabce(0x80))/0x7+-parseInt(_0x4fabce(0x8e))/0x8*(-parseInt(_0x4fabce(0x8a))/0x9)+parseInt(_0x4fabce(0x83))/0xa;if(_0x363932===_0x336795)break;else _0x27d18c['push'](_0x27d18c['shift']());}catch(_0x51e8dc){_0x27d18c['push'](_0x27d18c['shift']());}}}(a4_0x391d,0x1de26));function a4_0x2ae3(_0x1cf9ef,_0x18a28f){const _0x391ddd=a4_0x391d();return a4_0x2ae3=function(_0x2ae384,_0x43e932){_0x2ae384=_0x2ae384-0x66;let _0x1729d0=_0x391ddd[_0x2ae384];return _0x1729d0;},a4_0x2ae3(_0x1cf9ef,_0x18a28f);}import{mkdirSync,writeFileSync}from'node:fs';import a4_0x28268f from'node:path';import{getCookie}from'../auth/get-cookie.js';function a4_0x391d(){const _0x344db7=['tableName','join','387678ZjMVmD','94644ayndwG','438322SkTyph','142892rJUwVe','datasetCode','64oxBhfX','225582DFCHEB','data','status','1xlAATt','application/json','生成文档成功:\x20',']\x20正在生成:\x20','.md\x20-\x20','push','json','):缺少\x20data.markdown\x20字段','/api/node-toolbox/api-doc-generator','log','name','.md','utf8','POST','success','error','stringify','✗\x20失败:\x20','响应数据格式错误\x20(','等待\x203\x20秒...\x0a','api-doc','.md\x20(','string','5kctSAs','978418qJHKCg','message','text','3202110rZpBsT','\x20个数据集需要生成文档\x0a','✓\x20成功生成:\x20','markdown'];a4_0x391d=function(){return _0x344db7;};return a4_0x391d();}import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x5dc734){const _0x3a1198=a4_0x2ae3,{appCode:_0x35685a,datasetCode:_0x336c76,datasetId:_0x183dd9,extraParams:_0x5060bb}=_0x5dc734,_0xd7932b=getApiDomain(),_0x52d9b1=_0xd7932b+_0x3a1198(0x70),_0x4b2d43={'appCode':_0x35685a,'datasetCode':_0x336c76,'datasetId':_0x183dd9,..._0x5060bb||{}},_0x1c212d=await fetch(_0x52d9b1,{'method':_0x3a1198(0x75),'headers':{'Content-Type':_0x3a1198(0x69),'Cookie':getCookie()},'body':JSON[_0x3a1198(0x78)](_0x4b2d43)});if(!_0x1c212d['ok']){if(_0x1c212d[_0x3a1198(0x67)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');let _0x2fa66f='';try{_0x2fa66f=await _0x1c212d[_0x3a1198(0x82)]();}catch(_0x110b31){}throw new Error('获取文档失败\x20('+_0x336c76+'),HTTP状态码:\x20'+_0x1c212d[_0x3a1198(0x67)]+(_0x2fa66f?'\x0a'+_0x2fa66f:''));}const _0x40ab15=await _0x1c212d[_0x3a1198(0x6e)]();if(!_0x40ab15[_0x3a1198(0x66)]||typeof _0x40ab15[_0x3a1198(0x66)][_0x3a1198(0x86)]!==_0x3a1198(0x7e))throw new Error(_0x3a1198(0x7a)+_0x336c76+_0x3a1198(0x6f));return _0x40ab15[_0x3a1198(0x66)][_0x3a1198(0x86)];}function delay(_0x254852){return new Promise(_0x3fc2f3=>setTimeout(_0x3fc2f3,_0x254852));}export async function generateDatasetDocs(_0x42dd53,_0x4edb8f,_0x482885='./docs',_0x32e2e0,_0x3f6a48){const _0x574cb0=a4_0x2ae3;mkdirSync(_0x482885,{'recursive':!![]});const _0xfad96e=[],_0x2f2726=_0x42dd53['length'];console[_0x574cb0(0x71)]('\x0a共有\x20'+_0x2f2726+_0x574cb0(0x84));for(let _0x30cf5b=0x0;_0x30cf5b<_0x42dd53['length'];_0x30cf5b++){const _0x15d9a0=_0x42dd53[_0x30cf5b],_0x5cc5d9=_0x30cf5b+0x1,_0x150580=_0x15d9a0[_0x574cb0(0x87)];try{console[_0x574cb0(0x71)]('['+_0x5cc5d9+'/'+_0x2f2726+_0x574cb0(0x6b)+_0x150580+_0x574cb0(0x7d)+_0x15d9a0[_0x574cb0(0x72)]+')');_0x32e2e0&&_0x32e2e0(_0x5cc5d9,_0x2f2726,_0x150580);const _0x52a2ae=await fetchDatasetDoc({'appCode':_0x4edb8f,'datasetCode':_0x15d9a0[_0x574cb0(0x8d)],'datasetId':_0x15d9a0['id'],'enableAI':![],'extraParams':_0x3f6a48}),_0x2f9454=a4_0x28268f[_0x574cb0(0x88)](_0x482885,_0x150580+'.md');writeFileSync(_0x2f9454,_0x52a2ae,{'encoding':_0x574cb0(0x74)}),console[_0x574cb0(0x71)](_0x574cb0(0x85)+_0x150580+_0x574cb0(0x73)),logger[_0x574cb0(0x76)](_0x574cb0(0x7c),_0x574cb0(0x6a)+_0x150580,undefined,{'datasetCode':_0x15d9a0['datasetCode'],'datasetName':_0x15d9a0[_0x574cb0(0x72)],'filePath':_0x2f9454,'progress':_0x5cc5d9+'/'+_0x2f2726}),_0xfad96e['push']({'datasetCode':_0x15d9a0[_0x574cb0(0x8d)],'datasetName':_0x15d9a0['name'],'filePath':_0x2f9454,'success':!![]}),_0x5cc5d9<_0x2f2726&&await delay(0x1388);}catch(_0x16d3a){const _0x87f4a8=_0x16d3a instanceof Error?_0x16d3a[_0x574cb0(0x81)]:String(_0x16d3a);console[_0x574cb0(0x71)](_0x574cb0(0x79)+_0x150580+_0x574cb0(0x6c)+_0x87f4a8+'\x0a'),logger[_0x574cb0(0x77)](_0x574cb0(0x7c),'生成文档失败:\x20'+_0x15d9a0[_0x574cb0(0x8d)],{'datasetCode':_0x15d9a0[_0x574cb0(0x8d)],'datasetName':_0x15d9a0[_0x574cb0(0x72)],'error':_0x87f4a8,'progress':_0x5cc5d9+'/'+_0x2f2726}),_0xfad96e[_0x574cb0(0x6d)]({'datasetCode':_0x15d9a0[_0x574cb0(0x8d)],'datasetName':_0x15d9a0[_0x574cb0(0x72)],'filePath':'','success':![],'error':_0x87f4a8}),_0x5cc5d9<_0x2f2726&&(console[_0x574cb0(0x71)](_0x574cb0(0x7b)),await delay(0xbb8));}}return _0xfad96e;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xb082aa,_0x43bc85){const _0x5b2e99=a5_0x3cd6,_0x4b7aca=_0xb082aa();while(!![]){try{const _0x2f6f14=-parseInt(_0x5b2e99(0xa8))/0x1+parseInt(_0x5b2e99(0x9f))/0x2*(-parseInt(_0x5b2e99(0xbe))/0x3)+-parseInt(_0x5b2e99(0xc0))/0x4+-parseInt(_0x5b2e99(0xa3))/0x5+parseInt(_0x5b2e99(0x9a))/0x6*(-parseInt(_0x5b2e99(0xcb))/0x7)+parseInt(_0x5b2e99(0xa4))/0x8+parseInt(_0x5b2e99(0xbd))/0x9*(parseInt(_0x5b2e99(0xc2))/0xa);if(_0x2f6f14===_0x43bc85)break;else _0x4b7aca['push'](_0x4b7aca['shift']());}catch(_0x53382d){_0x4b7aca['push'](_0x4b7aca['shift']());}}}(a5_0x290a,0x4e773));import{jsx as a5_0x2f3dba,jsxs as a5_0x547257}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a5_0x3cd6(_0x4bbbfd,_0x35a3cb){const _0x290af2=a5_0x290a();return a5_0x3cd6=function(_0x3cd6e9,_0x43bd6b){_0x3cd6e9=_0x3cd6e9-0x98;let _0x2fdc3b=_0x290af2[_0x3cd6e9];return _0x2fdc3b;},a5_0x3cd6(_0x4bbbfd,_0x35a3cb);}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x28d19a,env:_0x25f2a9,output:_0x96e37a})=>{const _0x57a99b=a5_0x3cd6,{exit:_0xf30bbb}=useApp(),[_0x21217b,_0x1c62dd]=useState(![]),[_0x5d0892,_0x3e222b]=useState(![]),[_0x67046d,_0x4a6ed1]=useState(null),[_0x3aceb5,_0x208f57]=useState(null),_0x1dac5=readConfig(),_0x50acef=getConfigAppCode(),_0x3d8059=_0x28d19a||_0x50acef,_0x2a31ea=typeof _0x1dac5?.[_0x57a99b(0xa0)]==='string'?_0x1dac5[_0x57a99b(0xa0)]:undefined,_0x3abef5=_0x25f2a9||_0x2a31ea||_0x57a99b(0x9e);initEnv(_0x3abef5);const _0x5a7f39=_0x96e37a||_0x57a99b(0xae),_0x3f7a77=_0x28d19a&&_0x28d19a[_0x57a99b(0xcc)]('-')?_0x28d19a[_0x57a99b(0xc1)]('-')[_0x57a99b(0x98)](0x1)[_0x57a99b(0xbb)]('-'):'',_0x35be72=_0x28d19a?_0x57a99b(0xb8)+_0x3d8059:'使用配置的应用AppCode:\x20'+_0x3d8059,_0x4ebd60=_0x3f7a77?_0x3f7a77+'-api':'api',_0xe77095=_0x3f7a77?_0x3f7a77+_0x57a99b(0xb2):'client';useEffect(()=>{_0x1c62dd(!![]),_0xbda2dd();},[]),useEffect(()=>{(_0x5d0892||_0x67046d)&&_0xf30bbb();},[_0x5d0892,_0x67046d,_0xf30bbb]);async function _0xbda2dd(){const _0x5d047c=_0x57a99b;if(!_0x3d8059){_0x4a6ed1(_0x5d047c(0xb6));return;}try{logger['setLogPath'](process[_0x5d047c(0xa6)]());const {configArray:_0x4c171f}=await fetchModelList(_0x3d8059),_0x4ea98a=_0x4c171f['length'],_0x45eb39=!_0x28d19a,_0x39ae80=await generateApiFile(_0x4c171f,_0x3f7a77,_0x3d8059,_0x45eb39,_0x3abef5,_0x5a7f39),_0x38acab=_0x5a7f39[_0x5d047c(0xb9)]('/')?_0x5a7f39:_0x5a7f39+'/';_0x208f57({'api':''+_0x38acab+_0x4ebd60+_0x5d047c(0xc8),'client':''+_0x38acab+_0xe77095+_0x5d047c(0xc8),'modelCount':_0x39ae80[_0x5d047c(0xaa)],'datasetCount':_0x4ea98a,'originalCount':_0x4ea98a,'duplicateCount':0x0}),_0x3e222b(!![]);}catch(_0x4b5602){const _0x156865=_0x4b5602 instanceof Error?_0x4b5602[_0x5d047c(0xc5)]:String(_0x4b5602);logger['error'](_0x5d047c(0xb4),'拉取\x20API\x20配置失败:\x20'+_0x156865,{'appCode':_0x3d8059,'error':_0x156865}),_0x4a6ed1(_0x5d047c(0xca)+_0x156865);}finally{_0x1c62dd(![]);}}return a5_0x547257(Box,{'flexDirection':_0x57a99b(0xac),'children':[(_0x21217b||_0x5d0892)&&a5_0x547257(Box,{'children':[a5_0x2f3dba(Text,{'color':_0x57a99b(0xb3),'children':'*\x20'}),a5_0x2f3dba(Text,{'color':_0x28d19a?'white':_0x57a99b(0x9c),'children':_0x35be72})]}),_0x21217b&&a5_0x2f3dba(Box,{'children':a5_0x547257(Text,{'children':[_0x57a99b(0x99),_0x3abef5,')']})}),_0x5d0892&&_0x3aceb5&&a5_0x547257(Box,{'flexDirection':_0x57a99b(0xac),'children':[a5_0x2f3dba(Box,{'children':a5_0x547257(Text,{'color':_0x57a99b(0xbf),'children':['√\x20成功拉取\x20',_0x3aceb5[_0x57a99b(0xb5)],'\x20个数据集,生成','\x20',_0x3aceb5[_0x57a99b(0xaa)],_0x57a99b(0xad)]})}),_0x3aceb5[_0x57a99b(0xb7)]>0x0&&a5_0x2f3dba(Box,{'marginTop':0x1,'children':a5_0x547257(Text,{'color':_0x57a99b(0xa2),'children':[_0x57a99b(0xc4),_0x3aceb5[_0x57a99b(0xc7)],_0x57a99b(0xa1),'\x20',_0x3aceb5['duplicateCount'],'\x20个']})}),a5_0x2f3dba(Box,{'marginTop':0x1,'children':a5_0x2f3dba(Text,{'color':_0x57a99b(0xb3),'children':_0x57a99b(0xbc)})}),a5_0x547257(Box,{'marginLeft':0x2,'children':[a5_0x547257(Text,{'color':'cyan','children':['•\x20',_0x3aceb5[_0x57a99b(0xaf)]]}),a5_0x547257(Text,{'color':_0x57a99b(0x9c),'children':['\x20',_0x57a99b(0xc9),_0x3aceb5['modelCount'],_0x57a99b(0xa5)]})]}),a5_0x547257(Box,{'marginLeft':0x2,'children':[a5_0x547257(Text,{'color':_0x57a99b(0x9d),'children':['•\x20',_0x3aceb5[_0x57a99b(0xc3)]]}),a5_0x2f3dba(Text,{'color':_0x57a99b(0x9c),'children':_0x57a99b(0xba)})]}),a5_0x2f3dba(Box,{'marginTop':0x1,'children':a5_0x2f3dba(Text,{'color':_0x57a99b(0xb3),'children':_0x57a99b(0xab)})}),a5_0x2f3dba(Box,{'marginLeft':0x2,'children':a5_0x547257(Text,{'color':'yellow','children':['import\x20','{\x20lovrabetClient\x20}',_0x57a99b(0xa7),_0x3aceb5[_0x57a99b(0xc3)]['replace'](/^\.\//,'')[_0x57a99b(0xc6)](_0x57a99b(0xc8),''),'\x27']})})]}),_0x67046d&&a5_0x547257(Box,{'flexDirection':_0x57a99b(0xac),'children':[a5_0x2f3dba(Box,{'children':a5_0x547257(Text,{'color':_0x57a99b(0xa9),'children':['❌\x20',_0x67046d]})}),_0x67046d[_0x57a99b(0xcc)]('登录')&&a5_0x547257(Box,{'marginTop':0x1,'children':[a5_0x2f3dba(Text,{'color':'yellow','children':_0x57a99b(0xb0)}),a5_0x2f3dba(Text,{'color':_0x57a99b(0x9d),'children':_0x57a99b(0x9b)}),a5_0x2f3dba(Text,{'color':_0x57a99b(0xa2),'children':_0x57a99b(0xb1)})]})]})]});};function a5_0x290a(){const _0xca5ee9=['17506yHVIME','env','\x20个,过滤重复','yellow','147670npjHyL','2925104hssFZr','\x20个模型)','cwd','\x20from\x20\x27@/','63135gMOeQe','red','modelCount','*\x20导入方式:','column','\x20个模型','./src/api/','api','💡\x20请使用\x20','\x20重新登录后再试','-client','gray','api-pull','datasetCount','未提供应用AppCode,且配置中也没有默认值','duplicateCount','使用指定的应用AppCode:\x20','endsWith','\x20-\x20客户端实例文件','join','*\x20已生成文件:','2151igRmjd','12Vhbntj','green','1824668lGXzsz','split','30690NAiBTB','client','!\x20原始数据集\x20','message','replace','originalCount','.ts','-\x20模型配置文件\x20(','拉取\x20API\x20配置失败:\x20','154gprQQL','includes','slice','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','52878QdsCtK','lovrabet\x20auth','dim','cyan','online'];a5_0x290a=function(){return _0xca5ee9;};return a5_0x290a();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4fbcca,_0x34b181){const _0x1a7810=a6_0x162d,_0x12133c=_0x4fbcca();while(!![]){try{const _0x5946cc=parseInt(_0x1a7810(0x17e))/0x1*(parseInt(_0x1a7810(0x177))/0x2)+-parseInt(_0x1a7810(0x170))/0x3*(-parseInt(_0x1a7810(0x16e))/0x4)+parseInt(_0x1a7810(0x17a))/0x5+parseInt(_0x1a7810(0x174))/0x6*(parseInt(_0x1a7810(0x179))/0x7)+parseInt(_0x1a7810(0x17b))/0x8*(-parseInt(_0x1a7810(0x186))/0x9)+-parseInt(_0x1a7810(0x172))/0xa+parseInt(_0x1a7810(0x173))/0xb*(-parseInt(_0x1a7810(0x183))/0xc);if(_0x5946cc===_0x34b181)break;else _0x12133c['push'](_0x12133c['shift']());}catch(_0x52999e){_0x12133c['push'](_0x12133c['shift']());}}}(a6_0x498f,0xcc1d5));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a6_0x162d(_0x2c3107,_0x33a588){const _0x498f49=a6_0x498f();return a6_0x162d=function(_0x162d81,_0x59f274){_0x162d81=_0x162d81-0x16e;let _0x4ac8b6=_0x498f49[_0x162d81];return _0x4ac8b6;},a6_0x162d(_0x2c3107,_0x33a588);}import{logger}from'../utils/logger.js';function a6_0x498f(){const _0x49e749=['24RMPYKq','info','configArray','33894SQcRkM','836Zedqdx','获取数据集失败:\x20','18351mtkpGW','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','14361310NJppcq','718531JkeXEg','12qUTTfn','json','正在从服务器拉取模型列表...\x20(环境:\x20','1168106VUgJtr','data','4231619GTvhXa','2776180KPyLtu','2600frSLiY','success','message','1YgMDWd','/api/node-toolbox/dataset/model-list?appcode=','count','status','未知错误'];a6_0x498f=function(){return _0x49e749;};return a6_0x498f();}import{getEnv}from'../constant/env.js';export async function fetchModelList(_0x5e4b76){const _0x3a3dcf=a6_0x162d,_0x321243=getEnv(),_0x373346=getApiDomain()+_0x3a3dcf(0x17f)+_0x5e4b76+'&otype=array';logger[_0x3a3dcf(0x184)]('fetch-model-list',_0x3a3dcf(0x176)+_0x321243+')',{'apiUrl':_0x373346});const _0x4464fa=await fetch(_0x373346,{'headers':{'Cookie':getCookie()}});if(!_0x4464fa['ok']){if(_0x4464fa[_0x3a3dcf(0x181)]===0x191)throw new Error(_0x3a3dcf(0x171));throw new Error('获取数据集失败,HTTP状态码:\x20'+_0x4464fa[_0x3a3dcf(0x181)]);}const _0x10af30=await _0x4464fa[_0x3a3dcf(0x175)]();if(!_0x10af30[_0x3a3dcf(0x17c)])throw new Error(_0x3a3dcf(0x16f)+(_0x10af30[_0x3a3dcf(0x17d)]||_0x3a3dcf(0x182)));return{'configArray':_0x10af30[_0x3a3dcf(0x178)][_0x3a3dcf(0x185)],'count':_0x10af30[_0x3a3dcf(0x178)][_0x3a3dcf(0x180)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x47121b,_0x378765){const _0x629c16=a7_0x4315,_0x57dd24=_0x47121b();while(!![]){try{const _0x257954=-parseInt(_0x629c16(0xc8))/0x1+-parseInt(_0x629c16(0xbe))/0x2*(-parseInt(_0x629c16(0xba))/0x3)+-parseInt(_0x629c16(0xa7))/0x4+parseInt(_0x629c16(0xc1))/0x5+-parseInt(_0x629c16(0xab))/0x6+-parseInt(_0x629c16(0xa5))/0x7*(-parseInt(_0x629c16(0xb8))/0x8)+parseInt(_0x629c16(0xb1))/0x9*(parseInt(_0x629c16(0xc7))/0xa);if(_0x257954===_0x378765)break;else _0x57dd24['push'](_0x57dd24['shift']());}catch(_0x59ac7b){_0x57dd24['push'](_0x57dd24['shift']());}}}(a7_0x3fad,0xa2bde));import a7_0x357941 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x3caea4 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';function a7_0x4315(_0x4dd598,_0x56fcc9){const _0x3fada2=a7_0x3fad();return a7_0x4315=function(_0x4315ce,_0x130442){_0x4315ce=_0x4315ce-0xa3;let _0xe93b67=_0x3fada2[_0x4315ce];return _0xe93b67;},a7_0x4315(_0x4dd598,_0x56fcc9);}function a7_0x3fad(){const _0x13c4b2=['endsWith','.ts','string','18lIIxLb','length','typescript','url','env','online','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','32dcpckG','{\x20apiConfigName:\x20\x22','344940oHKrnQ','dirname','api','api.ts.tpl','4Ralgib','success','replaceApiContent','6044955gjkzOP','join','name','CONFIG_NAMES.DEFAULT','forEach','slice','579210syZwkB','629701hrCTbR','utf8','templates/generate-api','format','app','2066554CROZat','client.ts.tpl','774504gjojDZ',',\x20env:\x20\x22','\x22\x20}','{\x20apiConfigName:\x20','7474584upTTGi','key','keys'];a7_0x3fad=function(){return _0x13c4b2;};return a7_0x3fad();}import{logger}from'../utils/logger.js';export async function generateApiFile(_0x315cc1,_0x3c53c5='',_0x17cb98,_0x50b0fd=![],_0x56498a,_0x59fa96='./src/api/'){const _0x32b5d9=a7_0x4315,_0x3e3a2e=readConfig(),_0x56e8eb=_0x17cb98||_0x3e3a2e?.[_0x32b5d9(0xa4)];if(typeof _0x56e8eb!==_0x32b5d9(0xb0)||!_0x56e8eb)throw new Error(_0x32b5d9(0xb7));const _0x1f3a30=_0x50b0fd?_0x32b5d9(0xc4):'\x22'+_0x56e8eb+'\x22',_0x57dd6f=typeof _0x3e3a2e['env']===_0x32b5d9(0xb0)?_0x3e3a2e[_0x32b5d9(0xb5)]:undefined,_0x7236d9=_0x56498a||_0x57dd6f||'online',_0x3c2bcb=_0x7236d9!==_0x32b5d9(0xb6);let _0x172f6c;if(_0x50b0fd)_0x3c2bcb?_0x172f6c=_0x32b5d9(0xaa)+_0x1f3a30+',\x20env:\x20\x22'+_0x7236d9+_0x32b5d9(0xa9):_0x172f6c='';else{const _0x5b5e84=_0x3c2bcb?_0x32b5d9(0xa8)+_0x7236d9+'\x22':'';_0x172f6c=_0x32b5d9(0xb9)+_0x56e8eb+'\x22'+_0x5b5e84+'\x20}';}const _0x63238a=_0x3c53c5?_0x3c53c5+'-api':_0x32b5d9(0xbc),_0x17118d=_0x3c53c5?_0x3c53c5+'-client':'client',_0xecefb6={};_0x315cc1[_0x32b5d9(0xc5)](_0xcf3f4a=>{const _0x104d1a=_0x32b5d9;_0xecefb6[_0xcf3f4a[_0x104d1a(0xac)]]={'tableName':_0xcf3f4a['tableName'],'datasetCode':_0xcf3f4a['datasetCode'],'name':_0xcf3f4a[_0x104d1a(0xc3)]||''};});const _0x2ffc3b=fileURLToPath(import.meta[_0x32b5d9(0xb4)]),_0x4893d3=a7_0x3caea4['resolve'](a7_0x3caea4[_0x32b5d9(0xbb)](_0x2ffc3b),'../..'),_0x1dd754=a7_0x3caea4[_0x32b5d9(0xc2)](_0x4893d3,_0x32b5d9(0xca)),_0x21c223=a7_0x3caea4[_0x32b5d9(0xc2)](_0x1dd754,_0x32b5d9(0xbd)),_0x28cffa=a7_0x3caea4['join'](_0x1dd754,_0x32b5d9(0xa6)),_0x2a917d=_0x59fa96[_0x32b5d9(0xae)]('/')?_0x59fa96[_0x32b5d9(0xc6)](0x0,-0x1):_0x59fa96;mkdirSync(_0x2a917d,{'recursive':!![]});const _0x53f9f8=readFileSync(_0x21c223,_0x32b5d9(0xc9)),_0x34ff89=TemplateReplacer[_0x32b5d9(0xc0)](_0x53f9f8,_0x56e8eb,_0xecefb6,Object[_0x32b5d9(0xad)](_0xecefb6)[0x0],_0x63238a,_0x1f3a30),_0x5bf714=await a7_0x357941[_0x32b5d9(0xa3)](_0x34ff89,{'parser':_0x32b5d9(0xb3)}),_0x8ecdfc=_0x2a917d+'/'+_0x63238a+_0x32b5d9(0xaf);writeFileSync(_0x8ecdfc,_0x5bf714,{'encoding':_0x32b5d9(0xc9)});const _0x59c6f7=readFileSync(_0x28cffa,_0x32b5d9(0xc9)),_0x165792=TemplateReplacer[_0x32b5d9(0xc0)](_0x59c6f7,_0x56e8eb,_0xecefb6,Object['keys'](_0xecefb6)[0x0],_0x63238a,_0x1f3a30,_0x172f6c),_0x5b67aa=await a7_0x357941[_0x32b5d9(0xa3)](_0x165792,{'parser':'typescript'}),_0x3f2ce2=_0x2a917d+'/'+_0x17118d+_0x32b5d9(0xaf);writeFileSync(_0x3f2ce2,_0x5b67aa,{'encoding':_0x32b5d9(0xc9)});const _0x233b0e=Object['keys'](_0xecefb6)[_0x32b5d9(0xb2)];return logger[_0x32b5d9(0xbf)]('init-api','API\x20文件生成成功!',undefined,{'apiFile':_0x8ecdfc,'clientFile':_0x3f2ce2,'modelCount':_0x233b0e,'configName':_0x1f3a30}),{'modelCount':_0x233b0e,'apiFilePath':_0x8ecdfc,'clientFilePath':_0x3f2ce2,'configName':_0x1f3a30};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a8_0x4b70(){const _0xca695b=['\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文档','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','split','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','isArray','map','appcode','1616XTLwUQ','×\x20未配置\x20AppCode','length','datasetcode','×\x20--datasetcode\x20参数不能为空','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x1b[90m*\x20使用配置的应用AppCode:\x20','21976848kbhrKo','\x1b[90m*\x20仅生成指定数据集的文档:\x20','\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','❌\x20错误:不再支持位置参数方式','185440epAwht','\x20\x20错误:\x20','env','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','output','327onyLzo','18bpktzC','doc','33931XhlhQE','\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配置文件','string','请使用\x20--appcode\x20参数,例如:','log','filter','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','Unknown\x20api\x20command:\x20','error','object','65628hCGhFv','join','message','×\x20--params\x20参数不是有效的\x20JSON\x20格式','pull','Available\x20commands:','exit','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','22lmCnnb','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','1367580mGIWMU','input','!\x20请使用以下方式之一:','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','11676910sGWwPN','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','\x1b[0m','flags','98KgnNDV','parse','trim','37652cuehsV'];a8_0x4b70=function(){return _0xca695b;};return a8_0x4b70();}function a8_0x3b67(_0x5004cc,_0x3db19e){const _0x4b70fb=a8_0x4b70();return a8_0x3b67=function(_0x3b67e7,_0x18b5b8){_0x3b67e7=_0x3b67e7-0x100;let _0x2ce9d6=_0x4b70fb[_0x3b67e7];return _0x2ce9d6;},a8_0x3b67(_0x5004cc,_0x3db19e);}(function(_0x101420,_0x59298f){const _0x2cb414=a8_0x3b67,_0x7bf798=_0x101420();while(!![]){try{const _0x356b9b=-parseInt(_0x2cb414(0x113))/0x1*(parseInt(_0x2cb414(0x12f))/0x2)+parseInt(_0x2cb414(0x110))/0x3*(parseInt(_0x2cb414(0x132))/0x4)+parseInt(_0x2cb414(0x10b))/0x5*(parseInt(_0x2cb414(0x111))/0x6)+-parseInt(_0x2cb414(0x12b))/0x7+parseInt(_0x2cb414(0x100))/0x8*(parseInt(_0x2cb414(0x11d))/0x9)+-parseInt(_0x2cb414(0x127))/0xa*(parseInt(_0x2cb414(0x125))/0xb)+parseInt(_0x2cb414(0x107))/0xc;if(_0x356b9b===_0x59298f)break;else _0x7bf798['push'](_0x7bf798['shift']());}catch(_0x3570fa){_0x7bf798['push'](_0x7bf798['shift']());}}}(a8_0x4b70,0xcc71c));import{jsx as a8_0x1d03f4}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';export async function apiCli(_0x1fcbc7){const _0x275d7b=a8_0x3b67,_0x42dbf8=_0x1fcbc7[_0x275d7b(0x128)][0x1];if(_0x1fcbc7[_0x275d7b(0x12e)]['help']){console['log'](_0x275d7b(0x109));return;}if(_0x42dbf8===_0x275d7b(0x121)){_0x1fcbc7['input'][0x2]&&(console[_0x275d7b(0x11b)](_0x275d7b(0x10a)),console[_0x275d7b(0x117)]('请使用\x20--appcode\x20参数,例如:'),console[_0x275d7b(0x117)]('\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20'+_0x1fcbc7[_0x275d7b(0x128)][0x2]),process[_0x275d7b(0x123)](0x1));const _0x47e85d=getConfigAppCode();let _0x4ce4ec=_0x1fcbc7[_0x275d7b(0x12e)]['appcode'];const _0x36c2ce=typeof _0x1fcbc7[_0x275d7b(0x12e)][_0x275d7b(0x10d)]===_0x275d7b(0x115)?_0x1fcbc7[_0x275d7b(0x12e)][_0x275d7b(0x10d)]:undefined,_0x5027f1=_0x1fcbc7[_0x275d7b(0x12e)][_0x275d7b(0x10f)];!_0x4ce4ec&&!_0x47e85d&&(console[_0x275d7b(0x11b)]('×\x20未配置\x20AppCode'),console[_0x275d7b(0x117)](_0x275d7b(0x129)),console[_0x275d7b(0x117)](_0x275d7b(0x136)),console[_0x275d7b(0x117)](_0x275d7b(0x124)),process[_0x275d7b(0x123)](0x1)),_0x4ce4ec&&_0x47e85d&&_0x4ce4ec===_0x47e85d&&(console[_0x275d7b(0x117)](_0x275d7b(0x106)+_0x4ce4ec+_0x275d7b(0x12d)),console[_0x275d7b(0x117)]('\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m'),_0x4ce4ec=undefined),render(a8_0x1d03f4(ApiPullUI,{'appCode':_0x4ce4ec,'env':_0x36c2ce,'output':_0x5027f1}));}else{if(_0x42dbf8===_0x275d7b(0x112)){_0x1fcbc7[_0x275d7b(0x128)][0x2]&&(console[_0x275d7b(0x11b)](_0x275d7b(0x10a)),console[_0x275d7b(0x117)](_0x275d7b(0x116)),console[_0x275d7b(0x117)](_0x275d7b(0x12c)+_0x1fcbc7['input'][0x2]),process[_0x275d7b(0x123)](0x1));const _0x38d33c=getConfigAppCode();let _0x36fe31=_0x1fcbc7[_0x275d7b(0x12e)][_0x275d7b(0x139)];const _0x37f42d=typeof _0x1fcbc7['flags'][_0x275d7b(0x10d)]===_0x275d7b(0x115)?_0x1fcbc7[_0x275d7b(0x12e)]['env']:undefined,_0x1eeed8=_0x1fcbc7[_0x275d7b(0x12e)]['output'],_0x5baedf=_0x1fcbc7[_0x275d7b(0x12e)]['params'],_0x313764=_0x1fcbc7['flags'][_0x275d7b(0x103)];!_0x36fe31&&!_0x38d33c&&(console[_0x275d7b(0x11b)](_0x275d7b(0x101)),console[_0x275d7b(0x117)]('!\x20请使用以下方式之一:'),console['log'](_0x275d7b(0x136)),console['log'](_0x275d7b(0x126)),process['exit'](0x1));_0x36fe31&&_0x38d33c&&_0x36fe31===_0x38d33c&&(console['log'](_0x275d7b(0x106)+_0x36fe31+_0x275d7b(0x12d)),_0x36fe31=undefined);let _0x243490;if(_0x5baedf)try{_0x243490=JSON[_0x275d7b(0x130)](_0x5baedf),(typeof _0x243490!==_0x275d7b(0x11c)||_0x243490===null||Array[_0x275d7b(0x137)](_0x243490))&&(console[_0x275d7b(0x11b)](_0x275d7b(0x119)),process[_0x275d7b(0x123)](0x1));}catch(_0x857718){console[_0x275d7b(0x11b)](_0x275d7b(0x120)),console[_0x275d7b(0x11b)](_0x275d7b(0x10c)+(_0x857718 instanceof Error?_0x857718[_0x275d7b(0x11f)]:String(_0x857718))),process[_0x275d7b(0x123)](0x1);}let _0x56d94c;_0x313764&&(_0x56d94c=_0x313764[_0x275d7b(0x135)](',')[_0x275d7b(0x138)](_0x1105e8=>_0x1105e8[_0x275d7b(0x131)]())[_0x275d7b(0x118)](_0x5b251d=>_0x5b251d['length']>0x0),_0x56d94c[_0x275d7b(0x102)]===0x0&&(console[_0x275d7b(0x11b)](_0x275d7b(0x104)),process[_0x275d7b(0x123)](0x1)),console['log'](_0x275d7b(0x108)+_0x56d94c[_0x275d7b(0x11e)](',\x20')+_0x275d7b(0x12d))),render(a8_0x1d03f4(ApiDocUI,{'appCode':_0x36fe31,'env':_0x37f42d,'output':_0x1eeed8,'extraParams':_0x243490,'datasetCodes':_0x56d94c}));}else console[_0x275d7b(0x11b)](_0x275d7b(0x11a)+_0x42dbf8),console[_0x275d7b(0x117)](_0x275d7b(0x122)),console['log'](_0x275d7b(0x114)),console[_0x275d7b(0x117)](_0x275d7b(0x105)),console[_0x275d7b(0x117)]('\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)'),console[_0x275d7b(0x117)](_0x275d7b(0x12a)),console[_0x275d7b(0x117)](''),console[_0x275d7b(0x117)](_0x275d7b(0x133)),console[_0x275d7b(0x117)](_0x275d7b(0x134)),console[_0x275d7b(0x117)]('\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)'),console[_0x275d7b(0x117)](_0x275d7b(0x10e)),process[_0x275d7b(0x123)](0x1);}}
|
package/lib/api/pull-silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a9_0x39ad(){const _0x3d4a23=['4ptBXsM','online','72SGQPtv','log','2289220vvHBSd','.ts\x20-\x20模型配置文件','\x20个数据集,生成\x20','8915pLAQFC','create-api-pull','275312khbfvR','length','message','×\x20API\x20配置拉取异常:','test','38867PIclRa','chdir','204193qtiMzc','env','\x20\x20\x20•\x20','-client','√\x20成功拉取\x20','14CIcMtZ','API\x20配置拉取成功:\x20','1004787ADDSZm','trim','-api','modelCount','error','API\x20配置拉取异常:\x20','client','192DGqOVV','399477nFsgAJ','9hzVnMx','api','\x20个模型','*\x20开始生成\x20API\x20配置文件:','cwd','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。'];a9_0x39ad=function(){return _0x3d4a23;};return a9_0x39ad();}(function(_0xc92bc7,_0x15c9c0){const _0xaec546=a9_0x3f00,_0x2265ca=_0xc92bc7();while(!![]){try{const _0x34b0e1=-parseInt(_0xaec546(0x19e))/0x1*(-parseInt(_0xaec546(0x1a5))/0x2)+parseInt(_0xaec546(0x1af))/0x3*(parseInt(_0xaec546(0x1b6))/0x4)+-parseInt(_0xaec546(0x1bd))/0x5*(parseInt(_0xaec546(0x1b8))/0x6)+-parseInt(_0xaec546(0x1a7))/0x7+-parseInt(_0xaec546(0x1bf))/0x8+-parseInt(_0xaec546(0x1b0))/0x9*(-parseInt(_0xaec546(0x1ba))/0xa)+-parseInt(_0xaec546(0x1a0))/0xb*(parseInt(_0xaec546(0x1ae))/0xc);if(_0x34b0e1===_0x15c9c0)break;else _0x2265ca['push'](_0x2265ca['shift']());}catch(_0x3394ac){_0x2265ca['push'](_0x2265ca['shift']());}}}(a9_0x39ad,0x21a3f));import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a9_0x3f00(_0x2ae41e,_0x18404a){const _0x39adee=a9_0x39ad();return a9_0x3f00=function(_0x3f002a,_0x414a66){_0x3f002a=_0x3f002a-0x19d;let _0x3d5abf=_0x39adee[_0x3f002a];return _0x3d5abf;},a9_0x3f00(_0x2ae41e,_0x18404a);}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x2fc891,_0x2d9622,_0x3869f4,_0x118898){const _0x3d01be=a9_0x3f00;let _0x51fb1a;try{const _0x2e700e=_0x2d9622?.[_0x3d01be(0x1a8)]()||'';if(_0x2e700e){const _0x233c92=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x233c92[_0x3d01be(0x19d)](_0x2e700e))return console['error'](_0x3d01be(0x1b5)),![];}_0x3869f4&&(_0x51fb1a=process[_0x3d01be(0x1b4)](),process[_0x3d01be(0x19f)](_0x3869f4));const _0x5aa370=readConfig(),_0x21ae3c=typeof _0x5aa370[_0x3d01be(0x1a1)]==='string'?_0x5aa370[_0x3d01be(0x1a1)]:undefined,_0x8f7efb=_0x118898||_0x21ae3c||_0x3d01be(0x1b7);initEnv(_0x8f7efb),console[_0x3d01be(0x1b9)]('*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20'+_0x8f7efb+')');const {configArray:_0x5dc417}=await fetchModelList(_0x2fc891),_0x42e386=_0x2e700e?_0x2e700e+_0x3d01be(0x1a9):_0x3d01be(0x1b1),_0x563a20=_0x2e700e?_0x2e700e+_0x3d01be(0x1a3):_0x3d01be(0x1ad);console['log'](_0x3d01be(0x1b3)),console[_0x3d01be(0x1b9)](_0x3d01be(0x1a2)+_0x42e386+_0x3d01be(0x1bb)),console[_0x3d01be(0x1b9)](_0x3d01be(0x1a2)+_0x563a20+'.ts\x20-\x20客户端实例文件'),console[_0x3d01be(0x1b9)]('*\x20正在处理\x20'+_0x5dc417[_0x3d01be(0x1c0)]+'\x20个数据集...');const _0x431def=await generateApiFile(_0x5dc417,_0x2e700e,_0x2fc891,!![],_0x8f7efb);return console[_0x3d01be(0x1b9)](_0x3d01be(0x1a4)+_0x5dc417[_0x3d01be(0x1c0)]+_0x3d01be(0x1bc)+_0x431def[_0x3d01be(0x1aa)]+_0x3d01be(0x1b2)),_0x3869f4&&logger['info'](_0x3d01be(0x1be),_0x3d01be(0x1a6)+_0x2fc891,{'projectPath':_0x3869f4,'appCode':_0x2fc891,'datasetCount':_0x5dc417[_0x3d01be(0x1c0)],'filePrefix':_0x2e700e}),!![];}catch(_0x1974fc){const _0x8ba80a=_0x1974fc instanceof Error?_0x1974fc[_0x3d01be(0x1c1)]:String(_0x1974fc);return console[_0x3d01be(0x1ab)](_0x3d01be(0x1c2),_0x8ba80a),_0x3869f4&&logger[_0x3d01be(0x1ab)](_0x3d01be(0x1be),_0x3d01be(0x1ac)+_0x8ba80a,{'appCode':_0x2fc891,'projectPath':_0x3869f4}),![];}finally{_0x51fb1a&&process[_0x3d01be(0x19f)](_0x51fb1a);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a10_0x4d9d0d=a10_0x26ac;(function(_0x2d8eea,_0x545660){const _0x460d37=a10_0x26ac,_0x4b9386=_0x2d8eea();while(!![]){try{const _0x693795=-parseInt(_0x460d37(0x1a0))/0x1+parseInt(_0x460d37(0x1c0))/0x2+-parseInt(_0x460d37(0x1c4))/0x3+-parseInt(_0x460d37(0x1c3))/0x4+parseInt(_0x460d37(0x1a9))/0x5+-parseInt(_0x460d37(0x19f))/0x6*(parseInt(_0x460d37(0x1cd))/0x7)+-parseInt(_0x460d37(0x1a7))/0x8*(-parseInt(_0x460d37(0x1bf))/0x9);if(_0x693795===_0x545660)break;else _0x4b9386['push'](_0x4b9386['shift']());}catch(_0x7221d6){_0x4b9386['push'](_0x4b9386['shift']());}}}(a10_0x5c53,0x4b572));function a10_0x26ac(_0x4a2b27,_0x1ff3f6){const _0x5c534f=a10_0x5c53();return a10_0x26ac=function(_0x26ac20,_0x469a61){_0x26ac20=_0x26ac20-0x196;let _0x229e8d=_0x5c534f[_0x26ac20];return _0x229e8d;},a10_0x26ac(_0x4a2b27,_0x1ff3f6);}import{jsx as a10_0x2f814a,jsxs as a10_0x1c1c75,Fragment as a10_0x103f0b}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a10_0x3f3e34 from'ink-spinner';import{useGetOnlineMenuList}from'./get-online-menu-list.js';function a10_0x5c53(){const _0x15e1c7=['[\x20]','trim','downArrow','*\x20请选择要同步的菜单:','has','54ogTzZS','187218Rlxwaq','*\x20正在创建菜单...','input-css','value','yellow','*\x20JS\x20链接:\x20','selecting','6328BVrpSJ','map','1394695wnIrIE','dots','creating','repeat','path','[✓]','join','online','菜单名称','test','upArrow','fill','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认','\x20输入项目的\x20JS\x20资源链接(https://...)','column','slice','label','filter','length','main','add','gray','15786AXYrcV','366oSqVKL','*\x20CSS\x20链接:\x20','blue','1318392gcRNbY','1434117wpQtZH','已选择菜单','√\x20菜单创建完成','local','then','red','cyan','delete','done','282401vZiMzy','Lovrabet平台','\x20正在获取线上菜单列表...','\x20←\x20','请输入有效的\x20CSS\x20https\x20链接','CSS\x20链接','size','JS\x20链接无法访问','return','!\x20未找到本地页面,请先创建页面','green','includes','input-js'];a10_0x5c53=function(){return _0x15e1c7;};return a10_0x5c53();}import{getLocalPages}from'./get-local-pages.js';import{createMenus}from'./create-menu.js';import{isUrlReachable,isValidCssHttpsUrl,isValidJsHttpsUrl}from'./valid-url.js';import.meta[a10_0x4d9d0d(0x1bc)]&&render(a10_0x2f814a(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x5d8a4b=a10_0x4d9d0d,{exit:_0x80d53d}=useApp(),{loading:_0x4c5f10,menuList:_0xe162af}=useGetOnlineMenuList(),_0xe9df5d=getLocalPages(),_0x13502c=_0xe162af[_0x5d8a4b(0x1a8)](_0x4e7d98=>_0x4e7d98[_0x5d8a4b(0x1ad)]),_0x12752c=[_0x5d8a4b(0x1b1),..._0xe9df5d[_0x5d8a4b(0x1a8)](_0x47d1c7=>_0x47d1c7[_0x5d8a4b(0x1b9)])],_0x3b681e=getStringWidth(getMaxWidth(_0x12752c,0x4)),_0x16905e=getStringWidth(getMaxWidth(['菜单名称'])),[_0x2d0e16,_0x216592]=useState(_0x5d8a4b(0x1a6)),[_0x4684e5,_0x6d4b2e]=useState(new Set()),[_0x1c6234,_0x3aabe5]=useState(0x0),[_0x15bb3e,_0x2dfd42]=useState(''),[_0x10c994,_0x25e6e4]=useState(''),[_0x503312,_0x15f173]=useState(''),[_0x1e569f,_0x230005]=useState(''),[_0x1940ed,_0x33d3a3]=useState([]),_0x493643=_0xe9df5d[_0x5d8a4b(0x1a8)](_0x3a4554=>({'label':_0x3a4554[_0x5d8a4b(0x1b9)],'path':_0x3a4554[_0x5d8a4b(0x1ad)],'local':!![],'online':_0x13502c[_0x5d8a4b(0x198)](_0x3a4554[_0x5d8a4b(0x1ad)])})),_0x16c4a0=_0xe9df5d[_0x5d8a4b(0x1ba)](_0x517595=>{const _0x366e1f=_0x5d8a4b;return!_0x13502c['includes'](_0x517595[_0x366e1f(0x1ad)]);});useEffect(()=>{const _0x2ee23d=_0x5d8a4b;if(!_0x4c5f10&&_0xe9df5d[_0x2ee23d(0x1bb)]>0x0&&_0x4684e5[_0x2ee23d(0x1d3)]===0x0){const _0x2f381e=new Set(_0xe9df5d[_0x2ee23d(0x1a8)]((_0x229d1d,_0x410c59)=>({'page':_0x229d1d,'index':_0x410c59}))[_0x2ee23d(0x1ba)](({page:_0xbae4aa})=>!_0x13502c[_0x2ee23d(0x198)](_0xbae4aa['path']))[_0x2ee23d(0x1a8)](({index:_0x5a601e})=>_0x5a601e));_0x6d4b2e(_0x2f381e);}},[_0x4c5f10,_0xe9df5d[_0x5d8a4b(0x1bb)],_0x13502c[_0x5d8a4b(0x1bb)]]),useInput(async(_0x4a7030,_0x2500ba)=>{const _0x15bc93=_0x5d8a4b;if(_0x2d0e16==='selecting'){if(_0x2500ba[_0x15bc93(0x1b3)]){_0x3aabe5(_0x16fe1f=>_0x16fe1f>0x0?_0x16fe1f-0x1:_0xe9df5d[_0x15bc93(0x1bb)]-0x1);return;}if(_0x2500ba[_0x15bc93(0x19c)]){_0x3aabe5(_0x5a814e=>_0x5a814e<_0xe9df5d[_0x15bc93(0x1bb)]-0x1?_0x5a814e+0x1:0x0);return;}if(_0x4a7030==='\x20'){_0x6d4b2e(_0x34d0d3=>{const _0x55aed7=_0x15bc93,_0x21ec42=new Set(_0x34d0d3);return _0x21ec42[_0x55aed7(0x19e)](_0x1c6234)?_0x21ec42['delete'](_0x1c6234):_0x21ec42['add'](_0x1c6234),_0x21ec42;});return;}if(_0x4a7030==='a'||_0x4a7030==='A'){const _0x1dbdbd=new Set(_0xe9df5d['map']((_0xe91244,_0x475b06)=>_0x475b06));_0x6d4b2e(_0x1dbdbd);return;}if(_0x4a7030==='i'||_0x4a7030==='I'||_0x4a7030==='r'||_0x4a7030==='R'){_0x6d4b2e(_0x2a0258=>{const _0x68f4e1=_0x15bc93,_0xb82490=new Set();for(let _0x16e219=0x0;_0x16e219<_0xe9df5d[_0x68f4e1(0x1bb)];_0x16e219++){!_0x2a0258['has'](_0x16e219)&&_0xb82490[_0x68f4e1(0x1bd)](_0x16e219);}return _0xb82490;});return;}if(_0x4a7030==='q'||_0x4a7030==='Q'){_0x80d53d();return;}if(_0x2500ba[_0x15bc93(0x1d5)]){if(_0x4684e5['size']===0x0){_0x230005('请至少选择一个菜单');return;}const _0x354117=_0xe9df5d[_0x15bc93(0x1ba)]((_0x15688f,_0xbe0823)=>_0x4684e5['has'](_0xbe0823)),_0x10c12e=_0x354117[_0x15bc93(0x1a8)](_0xe7b77b=>_0xe7b77b[_0x15bc93(0x1b9)])['join'](',\x20');_0x33d3a3([{'label':_0x15bc93(0x1c5),'value':_0x4684e5[_0x15bc93(0x1d3)]+'\x20个'}]),_0x230005(''),_0x216592('input-js');return;}return;}if(_0x2d0e16==='input-js'){if(_0x2500ba[_0x15bc93(0x1d5)]){const _0x43201d=_0x503312[_0x15bc93(0x19b)]();if(_0x43201d==='')return;if(!isValidJsHttpsUrl(_0x43201d)){_0x230005('请输入有效的\x20JS\x20https\x20链接');return;}if(!await isUrlReachable(_0x43201d)){_0x230005(_0x15bc93(0x1d4));return;}_0x2dfd42(_0x43201d),_0x33d3a3(_0x4efeaa=>[..._0x4efeaa,{'label':'JS\x20链接','value':_0x43201d}]),_0x15f173(''),_0x230005(''),_0x216592('input-css');return;}if(_0x2500ba['backspace']||_0x2500ba['delete']){_0x15f173(_0x4aadd9=>_0x4aadd9[_0x15bc93(0x1b8)](0x0,-0x1)),_0x230005('');return;}_0x15f173(_0x504ada=>_0x504ada+_0x4a7030);return;}if(_0x2d0e16===_0x15bc93(0x1a2)){if(_0x2500ba[_0x15bc93(0x1d5)]){const _0x3b0bfe=_0x503312['trim']();if(_0x3b0bfe==='')return;if(!isValidCssHttpsUrl(_0x3b0bfe)){_0x230005(_0x15bc93(0x1d1));return;}if(!await isUrlReachable(_0x3b0bfe)){_0x230005('CSS\x20链接无法访问');return;}_0x25e6e4(_0x3b0bfe),_0x33d3a3(_0x27a8a2=>[..._0x27a8a2,{'label':_0x15bc93(0x1d2),'value':_0x3b0bfe}]),_0x15f173(''),_0x230005(''),_0x216592(_0x15bc93(0x1ab));const _0x1f6915=_0xe9df5d[_0x15bc93(0x1ba)]((_0x590738,_0x41af4b)=>_0x4684e5[_0x15bc93(0x19e)](_0x41af4b));createMenus(_0x1f6915,[_0x15bb3e,_0x3b0bfe])[_0x15bc93(0x1c8)](()=>{_0x216592('done'),setTimeout(()=>{_0x80d53d();},0x3e8);});return;}if(_0x2500ba['backspace']||_0x2500ba[_0x15bc93(0x1cb)]){_0x15f173(_0x37e22e=>_0x37e22e[_0x15bc93(0x1b8)](0x0,-0x1)),_0x230005('');return;}_0x15f173(_0x126a6c=>_0x126a6c+_0x4a7030);return;}});if(_0x4c5f10)return a10_0x1c1c75(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x2f814a(Text,{'children':'\x20\x20'}),a10_0x2f814a(a10_0x3f3e34,{'type':_0x5d8a4b(0x1aa)}),a10_0x2f814a(Text,{'children':_0x5d8a4b(0x1cf)})]});if(_0xe9df5d[_0x5d8a4b(0x1bb)]===0x0)return a10_0x2f814a(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x2f814a(Text,{'color':_0x5d8a4b(0x1a4),'children':_0x5d8a4b(0x196)})});return a10_0x1c1c75(Box,{'flexDirection':_0x5d8a4b(0x1b7),'marginTop':0x1,'marginBottom':0x1,'children':[_0x2d0e16===_0x5d8a4b(0x1a6)&&a10_0x1c1c75(a10_0x103f0b,{'children':[a10_0x1c1c75(Box,{'children':[a10_0x1c1c75(Text,{'bold':!![],'children':['\x20\x20',_0x5d8a4b(0x1b1),getRemainingSpaces(_0x3b681e,_0x5d8a4b(0x1b1))]}),a10_0x1c1c75(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x16905e,'菜单名称')]}),a10_0x1c1c75(Text,{'bold':!![],'children':[_0x5d8a4b(0x1ce),getRemainingSpaces(_0x16905e,_0x5d8a4b(0x1b1))]})]}),_0x493643[_0x5d8a4b(0x1a8)](_0x1eba30=>a10_0x1c1c75(Box,{'children':[a10_0x1c1c75(Text,{'children':['\x20\x20',_0x1eba30[_0x5d8a4b(0x1b9)],getRemainingSpaces(_0x3b681e,_0x1eba30[_0x5d8a4b(0x1b9)])]}),a10_0x1c1c75(Text,{'color':'green','children':[_0x1eba30[_0x5d8a4b(0x1c7)]?'✓':'✗',getRemainingSpaces(_0x16905e,'✓')]}),a10_0x1c1c75(Text,{'color':_0x1eba30[_0x5d8a4b(0x1b0)]?_0x5d8a4b(0x197):_0x5d8a4b(0x1c9),'children':[_0x1eba30[_0x5d8a4b(0x1b0)]?'✓':'✗',getRemainingSpaces(_0x16905e,'✓')]})]},_0x1eba30[_0x5d8a4b(0x1ad)]))]}),_0x2d0e16===_0x5d8a4b(0x1a6)&&_0x1940ed['length']===0x0&&a10_0x2f814a(Box,{'marginTop':0x1,'children':a10_0x2f814a(Text,{'color':_0x5d8a4b(0x1ca),'children':'*\x20同步菜单到\x20Lovrabet\x20平台'})}),_0x1940ed['map']((_0x3d8dd2,_0x58f646)=>a10_0x1c1c75(Box,{'children':[a10_0x1c1c75(Text,{'color':'green','children':['√\x20',_0x3d8dd2[_0x5d8a4b(0x1b9)],':\x20']}),a10_0x2f814a(Text,{'color':_0x5d8a4b(0x1ca),'children':_0x3d8dd2[_0x5d8a4b(0x1a3)]})]},_0x58f646)),_0x2d0e16==='selecting'&&a10_0x1c1c75(a10_0x103f0b,{'children':[a10_0x1c1c75(Box,{'marginTop':_0x1940ed[_0x5d8a4b(0x1bb)]>0x0?0x1:0x0,'flexDirection':_0x5d8a4b(0x1b7),'children':[a10_0x2f814a(Text,{'bold':!![],'children':_0x5d8a4b(0x19d)}),_0xe9df5d[_0x5d8a4b(0x1a8)]((_0xb2d153,_0x1b252c)=>{const _0x5a61cc=_0x5d8a4b,_0x4a9558=_0x1c6234===_0x1b252c,_0x2025c2=_0x4684e5[_0x5a61cc(0x19e)](_0x1b252c),_0x276cff=_0x13502c['includes'](_0xb2d153[_0x5a61cc(0x1ad)]),_0x22e0e6=_0x276cff?'更新':'新建';return a10_0x2f814a(Box,{'children':a10_0x1c1c75(Text,{'backgroundColor':_0x4a9558?_0x5a61cc(0x1c2):undefined,'color':_0x4a9558?'white':undefined,'children':['\x20\x20',_0x2025c2?_0x5a61cc(0x1ae):_0x5a61cc(0x19a),'\x20',_0xb2d153[_0x5a61cc(0x1b9)]]})},_0xb2d153[_0x5a61cc(0x1ad)]);}),a10_0x2f814a(Box,{'marginTop':0x1,'children':a10_0x1c1c75(Text,{'color':'gray','children':['\x20',_0x5d8a4b(0x1b5)]})})]}),_0x1e569f&&a10_0x2f814a(Box,{'children':a10_0x1c1c75(Text,{'color':'red','children':['\x20←\x20',_0x1e569f]})})]}),_0x2d0e16===_0x5d8a4b(0x199)&&a10_0x1c1c75(a10_0x103f0b,{'children':[a10_0x1c1c75(Box,{'children':[a10_0x2f814a(Text,{'children':_0x5d8a4b(0x1a5)}),a10_0x2f814a(Text,{'color':_0x5d8a4b(0x197),'children':_0x503312}),_0x1e569f&&a10_0x1c1c75(Text,{'color':_0x5d8a4b(0x1c9),'children':[_0x5d8a4b(0x1d0),_0x1e569f]})]}),!_0x1e569f&&a10_0x2f814a(Box,{'children':a10_0x2f814a(Text,{'color':_0x5d8a4b(0x1be),'children':_0x5d8a4b(0x1b6)})})]}),_0x2d0e16===_0x5d8a4b(0x1a2)&&a10_0x1c1c75(a10_0x103f0b,{'children':[a10_0x1c1c75(Box,{'children':[a10_0x2f814a(Text,{'children':_0x5d8a4b(0x1c1)}),a10_0x2f814a(Text,{'color':_0x5d8a4b(0x197),'children':_0x503312}),_0x1e569f&&a10_0x1c1c75(Text,{'color':_0x5d8a4b(0x1c9),'children':[_0x5d8a4b(0x1d0),_0x1e569f]})]}),!_0x1e569f&&a10_0x2f814a(Box,{'children':a10_0x2f814a(Text,{'color':_0x5d8a4b(0x1be),'children':'\x20输入项目的\x20CSS\x20资源链接(https://...)'})})]}),_0x2d0e16===_0x5d8a4b(0x1ab)&&a10_0x2f814a(Box,{'children':a10_0x2f814a(Text,{'children':_0x5d8a4b(0x1a1)})}),_0x2d0e16===_0x5d8a4b(0x1cc)&&a10_0x2f814a(Box,{'children':a10_0x2f814a(Text,{'color':'green','children':_0x5d8a4b(0x1c6)})})]});}function getStringWidth(_0x501c20){const _0x319795=a10_0x4d9d0d;let _0x1fe43b=0x0;for(const _0x268e24 of _0x501c20){/[\u4e00-\u9fa5]/[_0x319795(0x1b2)](_0x268e24)?_0x1fe43b+=0x2:_0x1fe43b+=0x1;}return _0x1fe43b;}function getRemainingSpaces(_0x1be6b8,_0x209574){const _0x13da85=a10_0x4d9d0d,_0x161616=getStringWidth(_0x209574);return Array(Math['max'](0x0,_0x1be6b8-_0x161616))[_0x13da85(0x1b4)]('\x20')[_0x13da85(0x1af)]('');}function getMaxWidth(_0x2267c5,_0x93e0cf=0x2){const _0x20df06=a10_0x4d9d0d;let _0x48f73e='',_0x1ce46e=0x0;for(const _0x481216 of _0x2267c5){const _0x21a00d=getStringWidth(_0x481216);_0x21a00d>_0x1ce46e&&(_0x1ce46e=_0x21a00d,_0x48f73e=_0x481216);}return _0x48f73e+'\x20'[_0x20df06(0x1ac)](_0x93e0cf);}
|
|
1
|
+
const a10_0x3f35fc=a10_0x38fa;(function(_0x1ac45d,_0x426123){const _0x24ca24=a10_0x38fa,_0x128bc2=_0x1ac45d();while(!![]){try{const _0x56e59b=-parseInt(_0x24ca24(0x149))/0x1+-parseInt(_0x24ca24(0x150))/0x2*(-parseInt(_0x24ca24(0x163))/0x3)+parseInt(_0x24ca24(0x15e))/0x4+-parseInt(_0x24ca24(0x158))/0x5+parseInt(_0x24ca24(0x12f))/0x6*(parseInt(_0x24ca24(0x14a))/0x7)+-parseInt(_0x24ca24(0x120))/0x8+parseInt(_0x24ca24(0x140))/0x9*(parseInt(_0x24ca24(0x14c))/0xa);if(_0x56e59b===_0x426123)break;else _0x128bc2['push'](_0x128bc2['shift']());}catch(_0x413f70){_0x128bc2['push'](_0x128bc2['shift']());}}}(a10_0x46d0,0xf1593));import{jsx as a10_0x53d2ae,jsxs as a10_0x3c2bd0,Fragment as a10_0x67203c}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';function a10_0x38fa(_0x789255,_0x2612e5){const _0x46d026=a10_0x46d0();return a10_0x38fa=function(_0x38fa86,_0x5f26b5){_0x38fa86=_0x38fa86-0x11d;let _0x5e3a5d=_0x46d026[_0x38fa86];return _0x5e3a5d;},a10_0x38fa(_0x789255,_0x2612e5);}import a10_0x30d7c8 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_0x46d0(){const _0xae3d16=['已选择菜单','1564466MTuQjH','15323bngdTY','downArrow','11510aidqaw','请输入有效的\x20CSS\x20https\x20链接','创建菜单失败','菜单名称','210506pUiFgD','add','\x20输入项目的\x20CSS\x20资源链接(https://...)','max','green','path','dots','\x20←\x20','2335815LUMNUE','local','JS\x20链接','*\x20CSS\x20链接:\x20','提示:使用\x20','lovrabet\x20auth','875916AJOxaE','value','\x20输入项目的\x20JS\x20资源链接(https://...)','done','cyan','33COVkcl','*\x20JS\x20链接:\x20','input-js','return','slice','5188608qMmoyO','backspace','selecting','message','catch','column','*\x20请选择要同步的菜单:','!\x20未找到本地页面,请先创建页面','[✓]','\x20正在获取线上菜单列表...','Lovrabet平台','label','online','includes','CSS\x20链接无法访问','714PYkBjG','main','gray','yellow','length','delete','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认','red','input-css','\x20命令重新登录','JS\x20链接无法访问','trim','filter','size','map','upArrow','then','15885cKivrZ','√\x20菜单创建完成','join','creating','white','repeat','*\x20同步菜单到\x20Lovrabet\x20平台','has'];a10_0x46d0=function(){return _0xae3d16;};return a10_0x46d0();}import{isUrlReachable,isValidCssHttpsUrl,isValidJsHttpsUrl}from'./valid-url.js';import.meta[a10_0x3f35fc(0x130)]&&render(a10_0x53d2ae(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x3c56ad=a10_0x3f35fc,{exit:_0x4e68a0}=useApp(),{loading:_0x1d9143,menuList:_0x5b9ade,error:_0x35a4a8}=useGetOnlineMenuList(),_0x1a2c30=getLocalPages(),_0x110f38=_0x5b9ade['map'](_0x5b2199=>_0x5b2199['path']),_0x6bb0a0=['菜单名称',..._0x1a2c30[_0x3c56ad(0x13d)](_0x532b89=>_0x532b89[_0x3c56ad(0x12b)])],_0x37bee1=getStringWidth(getMaxWidth(_0x6bb0a0,0x4)),_0x270a9f=getStringWidth(getMaxWidth([_0x3c56ad(0x14f)])),[_0x3c7b32,_0x189723]=useState(_0x3c56ad(0x122)),[_0x5964ba,_0x6b689d]=useState(new Set()),[_0x2088e7,_0x128e79]=useState(0x0),[_0x27fb3b,_0x3719ed]=useState(''),[_0x11ad8e,_0x2fd691]=useState(''),[_0x46cf03,_0x50a287]=useState(''),[_0x241abd,_0x4d1b66]=useState(''),[_0x2d7885,_0x5a7e31]=useState([]),_0x5e4136=_0x1a2c30['map'](_0x18ca53=>({'label':_0x18ca53[_0x3c56ad(0x12b)],'path':_0x18ca53[_0x3c56ad(0x155)],'local':!![],'online':_0x110f38['includes'](_0x18ca53[_0x3c56ad(0x155)])})),_0x43e423=_0x1a2c30[_0x3c56ad(0x13b)](_0x2bafce=>{const _0x319666=_0x3c56ad;return!_0x110f38[_0x319666(0x12d)](_0x2bafce[_0x319666(0x155)]);});useEffect(()=>{const _0x4b6288=_0x3c56ad;if(!_0x1d9143&&_0x1a2c30[_0x4b6288(0x133)]>0x0&&_0x5964ba[_0x4b6288(0x13c)]===0x0){const _0x1c083a=new Set(_0x1a2c30[_0x4b6288(0x13d)]((_0x34d0f6,_0x2c9c2f)=>({'page':_0x34d0f6,'index':_0x2c9c2f}))['filter'](({page:_0x3dff34})=>!_0x110f38[_0x4b6288(0x12d)](_0x3dff34[_0x4b6288(0x155)]))[_0x4b6288(0x13d)](({index:_0xa810b8})=>_0xa810b8));_0x6b689d(_0x1c083a);}},[_0x1d9143,_0x1a2c30[_0x3c56ad(0x133)],_0x110f38[_0x3c56ad(0x133)]]),useInput(async(_0x36b12c,_0x2d571d)=>{const _0x4f537e=_0x3c56ad;if(_0x3c7b32===_0x4f537e(0x122)){if(_0x2d571d[_0x4f537e(0x13e)]){_0x128e79(_0x53e1d4=>_0x53e1d4>0x0?_0x53e1d4-0x1:_0x1a2c30[_0x4f537e(0x133)]-0x1);return;}if(_0x2d571d[_0x4f537e(0x14b)]){_0x128e79(_0x5f1091=>_0x5f1091<_0x1a2c30[_0x4f537e(0x133)]-0x1?_0x5f1091+0x1:0x0);return;}if(_0x36b12c==='\x20'){_0x6b689d(_0x303165=>{const _0x327d02=_0x4f537e,_0x19ee62=new Set(_0x303165);return _0x19ee62[_0x327d02(0x147)](_0x2088e7)?_0x19ee62[_0x327d02(0x134)](_0x2088e7):_0x19ee62[_0x327d02(0x151)](_0x2088e7),_0x19ee62;});return;}if(_0x36b12c==='a'||_0x36b12c==='A'){const _0x121dcf=new Set(_0x1a2c30[_0x4f537e(0x13d)]((_0xc5c66,_0x4e70bc)=>_0x4e70bc));_0x6b689d(_0x121dcf);return;}if(_0x36b12c==='i'||_0x36b12c==='I'||_0x36b12c==='r'||_0x36b12c==='R'){_0x6b689d(_0x23fbe6=>{const _0x2a326e=_0x4f537e,_0x22557a=new Set();for(let _0x2d1a0a=0x0;_0x2d1a0a<_0x1a2c30[_0x2a326e(0x133)];_0x2d1a0a++){!_0x23fbe6[_0x2a326e(0x147)](_0x2d1a0a)&&_0x22557a[_0x2a326e(0x151)](_0x2d1a0a);}return _0x22557a;});return;}if(_0x36b12c==='q'||_0x36b12c==='Q'){_0x4e68a0();return;}if(_0x2d571d['return']){if(_0x5964ba[_0x4f537e(0x13c)]===0x0){_0x4d1b66('请至少选择一个菜单');return;}const _0x35c844=_0x1a2c30['filter']((_0x4b0171,_0x2307aa)=>_0x5964ba[_0x4f537e(0x147)](_0x2307aa)),_0x5cdd49=_0x35c844[_0x4f537e(0x13d)](_0x59b598=>_0x59b598[_0x4f537e(0x12b)])[_0x4f537e(0x142)](',\x20');_0x5a7e31([{'label':_0x4f537e(0x148),'value':_0x5964ba[_0x4f537e(0x13c)]+'\x20个'}]),_0x4d1b66(''),_0x189723(_0x4f537e(0x11d));return;}return;}if(_0x3c7b32===_0x4f537e(0x11d)){if(_0x2d571d['return']){const _0x6cceb1=_0x46cf03[_0x4f537e(0x13a)]();if(_0x6cceb1==='')return;if(!isValidJsHttpsUrl(_0x6cceb1)){_0x4d1b66('请输入有效的\x20JS\x20https\x20链接');return;}if(!await isUrlReachable(_0x6cceb1)){_0x4d1b66(_0x4f537e(0x139));return;}_0x3719ed(_0x6cceb1),_0x5a7e31(_0x2f53db=>[..._0x2f53db,{'label':_0x4f537e(0x15a),'value':_0x6cceb1}]),_0x50a287(''),_0x4d1b66(''),_0x189723('input-css');return;}if(_0x2d571d['backspace']||_0x2d571d[_0x4f537e(0x134)]){_0x50a287(_0x5c435e=>_0x5c435e[_0x4f537e(0x11f)](0x0,-0x1)),_0x4d1b66('');return;}_0x50a287(_0x2b403d=>_0x2b403d+_0x36b12c);return;}if(_0x3c7b32===_0x4f537e(0x137)){if(_0x2d571d[_0x4f537e(0x11e)]){const _0xccf6db=_0x46cf03['trim']();if(_0xccf6db==='')return;if(!isValidCssHttpsUrl(_0xccf6db)){_0x4d1b66(_0x4f537e(0x14d));return;}if(!await isUrlReachable(_0xccf6db)){_0x4d1b66(_0x4f537e(0x12e));return;}_0x2fd691(_0xccf6db),_0x5a7e31(_0x52917e=>[..._0x52917e,{'label':'CSS\x20链接','value':_0xccf6db}]),_0x50a287(''),_0x4d1b66(''),_0x189723(_0x4f537e(0x143));const _0x1c2082=_0x1a2c30[_0x4f537e(0x13b)]((_0x49b693,_0x112826)=>_0x5964ba[_0x4f537e(0x147)](_0x112826));createMenus(_0x1c2082,[_0x27fb3b,_0xccf6db])[_0x4f537e(0x13f)](()=>{const _0x1e666d=_0x4f537e;_0x189723(_0x1e666d(0x161)),setTimeout(()=>{_0x4e68a0();},0x3e8);})[_0x4f537e(0x124)](_0x924ed5=>{const _0x219a20=_0x4f537e;_0x4d1b66(_0x924ed5[_0x219a20(0x123)]||_0x219a20(0x14e)),_0x189723(_0x219a20(0x122));});return;}if(_0x2d571d[_0x4f537e(0x121)]||_0x2d571d[_0x4f537e(0x134)]){_0x50a287(_0x34ce5c=>_0x34ce5c['slice'](0x0,-0x1)),_0x4d1b66('');return;}_0x50a287(_0x43a088=>_0x43a088+_0x36b12c);return;}});if(_0x1d9143)return a10_0x3c2bd0(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x53d2ae(Text,{'children':'\x20\x20'}),a10_0x53d2ae(a10_0x30d7c8,{'type':_0x3c56ad(0x156)}),a10_0x53d2ae(Text,{'children':_0x3c56ad(0x129)})]});if(_0x35a4a8)return a10_0x3c2bd0(Box,{'flexDirection':_0x3c56ad(0x125),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x3c2bd0(Text,{'color':'red','children':['✗\x20',_0x35a4a8]}),a10_0x3c2bd0(Box,{'marginTop':0x1,'children':[a10_0x53d2ae(Text,{'color':_0x3c56ad(0x131),'children':_0x3c56ad(0x15c)}),a10_0x53d2ae(Text,{'color':_0x3c56ad(0x162),'children':_0x3c56ad(0x15d)}),a10_0x53d2ae(Text,{'color':_0x3c56ad(0x131),'children':_0x3c56ad(0x138)})]})]});if(_0x1a2c30[_0x3c56ad(0x133)]===0x0)return a10_0x53d2ae(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x53d2ae(Text,{'color':_0x3c56ad(0x132),'children':_0x3c56ad(0x127)})});return a10_0x3c2bd0(Box,{'flexDirection':_0x3c56ad(0x125),'marginTop':0x1,'marginBottom':0x1,'children':[_0x3c7b32===_0x3c56ad(0x122)&&a10_0x3c2bd0(a10_0x67203c,{'children':[a10_0x3c2bd0(Box,{'children':[a10_0x3c2bd0(Text,{'bold':!![],'children':['\x20\x20',_0x3c56ad(0x14f),getRemainingSpaces(_0x37bee1,_0x3c56ad(0x14f))]}),a10_0x3c2bd0(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x270a9f,_0x3c56ad(0x14f))]}),a10_0x3c2bd0(Text,{'bold':!![],'children':[_0x3c56ad(0x12a),getRemainingSpaces(_0x270a9f,_0x3c56ad(0x14f))]})]}),_0x5e4136[_0x3c56ad(0x13d)](_0x12dd1b=>a10_0x3c2bd0(Box,{'children':[a10_0x3c2bd0(Text,{'children':['\x20\x20',_0x12dd1b[_0x3c56ad(0x12b)],getRemainingSpaces(_0x37bee1,_0x12dd1b[_0x3c56ad(0x12b)])]}),a10_0x3c2bd0(Text,{'color':_0x3c56ad(0x154),'children':[_0x12dd1b[_0x3c56ad(0x159)]?'✓':'✗',getRemainingSpaces(_0x270a9f,'✓')]}),a10_0x3c2bd0(Text,{'color':_0x12dd1b[_0x3c56ad(0x12c)]?'green':_0x3c56ad(0x136),'children':[_0x12dd1b[_0x3c56ad(0x12c)]?'✓':'✗',getRemainingSpaces(_0x270a9f,'✓')]})]},_0x12dd1b[_0x3c56ad(0x155)]))]}),_0x3c7b32==='selecting'&&_0x2d7885['length']===0x0&&a10_0x53d2ae(Box,{'marginTop':0x1,'children':a10_0x53d2ae(Text,{'color':_0x3c56ad(0x162),'children':_0x3c56ad(0x146)})}),_0x2d7885['map']((_0xa79477,_0x4f2ace)=>a10_0x3c2bd0(Box,{'children':[a10_0x3c2bd0(Text,{'color':_0x3c56ad(0x154),'children':['√\x20',_0xa79477['label'],':\x20']}),a10_0x53d2ae(Text,{'color':_0x3c56ad(0x162),'children':_0xa79477[_0x3c56ad(0x15f)]})]},_0x4f2ace)),_0x241abd&&_0x3c7b32===_0x3c56ad(0x122)&&a10_0x53d2ae(Box,{'marginTop':0x1,'children':a10_0x3c2bd0(Text,{'color':_0x3c56ad(0x136),'children':['✗\x20',_0x241abd]})}),_0x3c7b32==='selecting'&&a10_0x53d2ae(a10_0x67203c,{'children':a10_0x3c2bd0(Box,{'marginTop':_0x2d7885[_0x3c56ad(0x133)]>0x0||_0x241abd?0x1:0x0,'flexDirection':_0x3c56ad(0x125),'children':[a10_0x53d2ae(Text,{'bold':!![],'children':_0x3c56ad(0x126)}),_0x1a2c30[_0x3c56ad(0x13d)]((_0x3e4a3f,_0x1c8d98)=>{const _0x4d6322=_0x3c56ad,_0x2682d4=_0x2088e7===_0x1c8d98,_0x59ec1c=_0x5964ba[_0x4d6322(0x147)](_0x1c8d98),_0x4b2060=_0x110f38[_0x4d6322(0x12d)](_0x3e4a3f[_0x4d6322(0x155)]),_0x38271e=_0x4b2060?'更新':'新建';return a10_0x53d2ae(Box,{'children':a10_0x3c2bd0(Text,{'backgroundColor':_0x2682d4?'blue':undefined,'color':_0x2682d4?_0x4d6322(0x144):undefined,'children':['\x20\x20',_0x59ec1c?_0x4d6322(0x128):'[\x20]','\x20',_0x3e4a3f[_0x4d6322(0x12b)]]})},_0x3e4a3f['path']);}),a10_0x53d2ae(Box,{'marginTop':0x1,'children':a10_0x3c2bd0(Text,{'color':'gray','children':['\x20',_0x3c56ad(0x135)]})})]})}),_0x3c7b32===_0x3c56ad(0x11d)&&a10_0x3c2bd0(a10_0x67203c,{'children':[a10_0x3c2bd0(Box,{'children':[a10_0x53d2ae(Text,{'children':_0x3c56ad(0x164)}),a10_0x53d2ae(Text,{'color':_0x3c56ad(0x154),'children':_0x46cf03}),_0x241abd&&a10_0x3c2bd0(Text,{'color':_0x3c56ad(0x136),'children':[_0x3c56ad(0x157),_0x241abd]})]}),!_0x241abd&&a10_0x53d2ae(Box,{'children':a10_0x53d2ae(Text,{'color':_0x3c56ad(0x131),'children':_0x3c56ad(0x160)})})]}),_0x3c7b32===_0x3c56ad(0x137)&&a10_0x3c2bd0(a10_0x67203c,{'children':[a10_0x3c2bd0(Box,{'children':[a10_0x53d2ae(Text,{'children':_0x3c56ad(0x15b)}),a10_0x53d2ae(Text,{'color':'green','children':_0x46cf03}),_0x241abd&&a10_0x3c2bd0(Text,{'color':'red','children':[_0x3c56ad(0x157),_0x241abd]})]}),!_0x241abd&&a10_0x53d2ae(Box,{'children':a10_0x53d2ae(Text,{'color':_0x3c56ad(0x131),'children':_0x3c56ad(0x152)})})]}),_0x3c7b32===_0x3c56ad(0x143)&&a10_0x53d2ae(Box,{'children':a10_0x53d2ae(Text,{'children':'*\x20正在创建菜单...'})}),_0x3c7b32===_0x3c56ad(0x161)&&a10_0x53d2ae(Box,{'children':a10_0x53d2ae(Text,{'color':_0x3c56ad(0x154),'children':_0x3c56ad(0x141)})})]});}function getStringWidth(_0x1578c){let _0x157bf5=0x0;for(const _0x4eeffa of _0x1578c){/[\u4e00-\u9fa5]/['test'](_0x4eeffa)?_0x157bf5+=0x2:_0x157bf5+=0x1;}return _0x157bf5;}function getRemainingSpaces(_0x237821,_0x56e81b){const _0x2cfe28=a10_0x3f35fc,_0x3194c1=getStringWidth(_0x56e81b);return Array(Math[_0x2cfe28(0x153)](0x0,_0x237821-_0x3194c1))['fill']('\x20')[_0x2cfe28(0x142)]('');}function getMaxWidth(_0x5a74d3,_0x19b699=0x2){const _0x4c5e6e=a10_0x3f35fc;let _0x96a160='',_0x2befd4=0x0;for(const _0x29faad of _0x5a74d3){const _0x3987c5=getStringWidth(_0x29faad);_0x3987c5>_0x2befd4&&(_0x2befd4=_0x3987c5,_0x96a160=_0x29faad);}return _0x96a160+'\x20'[_0x4c5e6e(0x145)](_0x19b699);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a11_0xa60d(_0x5bd52b,_0x4230fc){const _0x3ec9b5=a11_0x3ec9();return a11_0xa60d=function(_0xa60df8,_0x596dc0){_0xa60df8=_0xa60df8-0xca;let _0x13e385=_0x3ec9b5[_0xa60df8];return _0x13e385;},a11_0xa60d(_0x5bd52b,_0x4230fc);}(function(_0x36f043,_0x181a58){const _0x49eb56=a11_0xa60d,_0x2713ed=_0x36f043();while(!![]){try{const _0x54b62d=-parseInt(_0x49eb56(0xd3))/0x1*(parseInt(_0x49eb56(0xeb))/0x2)+parseInt(_0x49eb56(0xde))/0x3*(parseInt(_0x49eb56(0xf8))/0x4)+parseInt(_0x49eb56(0xca))/0x5+-parseInt(_0x49eb56(0xf5))/0x6*(-parseInt(_0x49eb56(0xf0))/0x7)+-parseInt(_0x49eb56(0xd5))/0x8+-parseInt(_0x49eb56(0xed))/0x9+-parseInt(_0x49eb56(0xef))/0xa*(parseInt(_0x49eb56(0xf7))/0xb);if(_0x54b62d===_0x181a58)break;else _0x2713ed['push'](_0x2713ed['shift']());}catch(_0x12f931){_0x2713ed['push'](_0x2713ed['shift']());}}}(a11_0x3ec9,0x319e7));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';const config=readConfig();export async function createMenu(_0x3ce22b){const _0x2eb879=a11_0xa60d,_0x4ede59=config?.['appcode'];if(!_0x4ede59){const _0x1c0b46='未提供应用AppCode,且配置中也没有默认值';logger[_0x2eb879(0xe3)](_0x2eb879(0xdb),_0x1c0b46),console[_0x2eb879(0xe3)]('×\x20'+_0x1c0b46),console[_0x2eb879(0xdf)](_0x2eb879(0xd2)),console[_0x2eb879(0xdf)](_0x2eb879(0xd7)),console[_0x2eb879(0xdf)]('\x20\x20\x202.\x20配置默认值:\x20lovrabet\x20config\x20set\x20app\x20<app-code>');return;}logger[_0x2eb879(0xe8)]('create-menu','正在创建菜单:\x20'+_0x3ce22b[_0x2eb879(0xdd)]+'\x20('+_0x3ce22b[_0x2eb879(0xcf)]+')');const _0x13eb46={'appCode':_0x4ede59,'type':_0x2eb879(0xf1),'sort':0x0,'extend':{'loadScriptMode':'import','resources':_0x3ce22b[_0x2eb879(0xe5)]?JSON[_0x2eb879(0xee)](_0x3ce22b['resources']):undefined},..._0x3ce22b},_0x1bfe6a=await fetch(getApiDomain()+_0x2eb879(0xf6),{'method':_0x2eb879(0xe7),'body':JSON[_0x2eb879(0xee)](_0x13eb46),'headers':{'Content-Type':_0x2eb879(0xd9),'Cookie':getCookie()}});if(!_0x1bfe6a['ok']){if(_0x1bfe6a[_0x2eb879(0xce)]===0x191){const _0x2adf06=_0x2eb879(0xcc);logger[_0x2eb879(0xe3)](_0x2eb879(0xdb),_0x2adf06,{'status':_0x1bfe6a[_0x2eb879(0xce)],'menu':_0x3ce22b[_0x2eb879(0xdd)]});throw new Error(_0x2adf06);}const _0x1c75f8=_0x2eb879(0xcd)+_0x1bfe6a[_0x2eb879(0xce)];logger['error'](_0x2eb879(0xdb),_0x1c75f8,{'menu':_0x3ce22b[_0x2eb879(0xdd)]});throw new Error(_0x1c75f8);}const _0x5aca01=await _0x1bfe6a[_0x2eb879(0xdc)]();if(!_0x5aca01[_0x2eb879(0xd4)]){const _0x2b6548=_0x2eb879(0xe0)+(_0x5aca01['errorMsg']||_0x2eb879(0xe1));logger[_0x2eb879(0xe3)](_0x2eb879(0xdb),_0x2b6548,{'errorCode':_0x5aca01['errorCode'],'errorMsg':_0x5aca01[_0x2eb879(0xda)],'menu':_0x3ce22b[_0x2eb879(0xdd)]});throw new Error(_0x2b6548);}logger[_0x2eb879(0xe8)](_0x2eb879(0xdb),_0x2eb879(0xe4)+_0x3ce22b[_0x2eb879(0xdd)],_0x5aca01[_0x2eb879(0xd0)]),console[_0x2eb879(0xdf)](_0x2eb879(0xcb),_0x5aca01[_0x2eb879(0xd0)]);}async function _createMenu(_0x2ec5db,_0x42f462){const _0x1523b8=a11_0xa60d,_0x452e30=config?.['appcode'];if(!_0x452e30){const _0x1079b9=_0x1523b8(0xf4);logger[_0x1523b8(0xe3)](_0x1523b8(0xdb),_0x1079b9),console[_0x1523b8(0xe3)]('×\x20'+_0x1079b9),console['log'](_0x1523b8(0xd2)),console[_0x1523b8(0xdf)](_0x1523b8(0xd7)),console[_0x1523b8(0xdf)]('\x20\x20\x202.\x20配置默认值:\x20lovrabet\x20config\x20set\x20app\x20<app-code>');return;}const _0x3582ab={'appCode':_0x452e30,'type':_0x1523b8(0xf1),'sort':0x0,'extend':{'loadScriptMode':_0x1523b8(0xea),'resources':_0x42f462?JSON[_0x1523b8(0xee)](_0x42f462):undefined},'label':_0x2ec5db[_0x1523b8(0xdd)],'path':_0x2ec5db['path']},_0x9efbe9=await fetch(getApiDomain()+_0x1523b8(0xf6),{'method':_0x1523b8(0xe7),'body':JSON['stringify'](_0x3582ab),'headers':{'Content-Type':_0x1523b8(0xd9),'Cookie':getCookie()}});if(!_0x9efbe9['ok']){if(_0x9efbe9[_0x1523b8(0xce)]===0x191){const _0x413f94='登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录';logger[_0x1523b8(0xe3)](_0x1523b8(0xdb),_0x413f94,{'status':_0x9efbe9[_0x1523b8(0xce)],'menu':_0x2ec5db[_0x1523b8(0xdd)]});throw new Error(_0x413f94);}const _0xfd8235='创建菜单失败,HTTP状态码:\x20'+_0x9efbe9[_0x1523b8(0xce)];logger[_0x1523b8(0xe3)](_0x1523b8(0xdb),_0xfd8235,{'menu':_0x2ec5db[_0x1523b8(0xdd)]});throw new Error(_0xfd8235);}const _0x4e3ce8=await _0x9efbe9[_0x1523b8(0xdc)]();if(!_0x4e3ce8[_0x1523b8(0xd4)]){if(_0x4e3ce8[_0x1523b8(0xd8)]===_0x1523b8(0xd1)||_0x4e3ce8['errorMsg']?.[_0x1523b8(0xe6)]('登录')){const _0x26fc68=_0x1523b8(0xf3);logger[_0x1523b8(0xe3)](_0x1523b8(0xdb),_0x26fc68,{'errorCode':_0x4e3ce8['errorCode'],'errorMsg':_0x4e3ce8['errorMsg'],'menu':_0x2ec5db[_0x1523b8(0xdd)]});throw new Error(_0x26fc68);}const _0x134fd1=_0x1523b8(0xe0)+(_0x4e3ce8[_0x1523b8(0xda)]||_0x1523b8(0xe1));logger[_0x1523b8(0xe3)](_0x1523b8(0xdb),_0x134fd1,{'errorCode':_0x4e3ce8[_0x1523b8(0xd8)],'errorMsg':_0x4e3ce8['errorMsg'],'menu':_0x2ec5db[_0x1523b8(0xdd)]});throw new Error(_0x134fd1);}logger[_0x1523b8(0xe8)](_0x1523b8(0xdb),_0x1523b8(0xe4)+_0x2ec5db[_0x1523b8(0xdd)]);}function a11_0x3ec9(){const _0x327f58=['551955xuDood','创建菜单成功:','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','创建菜单失败,HTTP状态码:\x20','status','path','data','0011','!\x20请使用以下方式之一:','43LCAJAS','success','522248jtQhLW','批量创建菜单完成,共\x20','\x20\x20\x201.\x20直接指定:\x20lovrabet\x20api\x20pull\x20<app-code>','errorCode','application/json','errorMsg','create-menu','json','label','1013403DpsLuy','log','创建菜单失败:\x20','未知错误','create-menus','error','菜单创建成功:\x20','resources','includes','POST','info','map','import','7376EQmGLD','length','171882KGMmcN','stringify','877220zIQxaO','300062XPxQMB','procode','开始批量创建菜单,共\x20','登录态校验失败,请使用\x20lovrabet\x20auth\x20重新登录','未提供应用AppCode,且配置中也没有默认值','12jbWouZ','/smartapi/menu/create','11bpEGrq','4utyYJm'];a11_0x3ec9=function(){return _0x327f58;};return a11_0x3ec9();}export async function createMenus(_0x3d119a,_0xd665cc){const _0xdc8f61=a11_0xa60d;logger[_0xdc8f61(0xe8)](_0xdc8f61(0xe2),_0xdc8f61(0xf2)+_0x3d119a[_0xdc8f61(0xec)]+'\x20个'),await Promise['all'](_0x3d119a[_0xdc8f61(0xe9)](async _0x4501f6=>{await _createMenu(_0x4501f6,_0xd665cc);})),logger[_0xdc8f61(0xe8)](_0xdc8f61(0xe2),_0xdc8f61(0xd6)+_0x3d119a['length']+'\x20个');}
|