@lovrabet/cli 1.1.26-beta.11 → 1.1.26-beta.14
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/use-get-online-menu-list.js +1 -1
- package/lib/app-menu/utils.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-cdn-version/app-menu-sync-cdn-version-ui.js +1 -1
- package/lib/app-menu-cdn-version/cdn-url-compare-table.js +1 -1
- package/lib/app-menu-cdn-version/update-menu-cdn-url.js +1 -1
- package/lib/app-menu-update-cdn/current-content.js +1 -1
- package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
- package/lib/app-menu-update-cdn/main.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
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a0_0x1f70(){const _0x4d18bf=['gray','test','\x20直接回车确认,或输入自定义路由地址','4114439gTHthG','includes','green','trim','2006024cOVKYq','939320eppKoX','473546ACyvtg','27geZdAF','split','column','页面路由地址:\x20','路径不能包含连续的\x20/','existsSync','delete','\x20已存在,请使用其他路径','页面路径长度不能超过\x20100\x20个字符','1965498DYLmdo','页面路径\x20','路径不能以\x20/\x20开头或结尾','页面路径不合法','endsWith','154096juiYSL','7758000DkYRIa','8CjfvZU','return'];a0_0x1f70=function(){return _0x4d18bf;};return a0_0x1f70();}(function(_0x3f9c31,_0x48f86c){const _0x1bb3af=a0_0xb5dd,_0x1a11fa=_0x3f9c31();while(!![]){try{const _0xbcdfba=parseInt(_0x1bb3af(0x183))/0x1+parseInt(_0x1bb3af(0x176))/0x2*(parseInt(_0x1bb3af(0x184))/0x3)+parseInt(_0x1bb3af(0x181))/0x4+-parseInt(_0x1bb3af(0x182))/0x5+parseInt(_0x1bb3af(0x18d))/0x6+-parseInt(_0x1bb3af(0x17d))/0x7*(parseInt(_0x1bb3af(0x178))/0x8)+-parseInt(_0x1bb3af(0x177))/0x9;if(_0xbcdfba===_0x48f86c)break;else _0x1a11fa['push'](_0x1a11fa['shift']());}catch(_0x5104e0){_0x1a11fa['push'](_0x1a11fa['shift']());}}}(a0_0x1f70,0x5781a));import{jsx as a0_0xa3fd21,jsxs as a0_0x6cd646}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';function a0_0xb5dd(_0x351016,_0x5ab0bd){_0x351016=_0x351016-0x176;const _0x1f7059=a0_0x1f70();let _0xb5dd8d=_0x1f7059[_0x351016];return _0xb5dd8d;}import a0_0xd5a7ed from'node:fs';export function InputProjectCode(_0x3c8539){const _0x21b363=a0_0xb5dd,{onSubmit:_0x592aa5,pagePath:_0x38d4aa}=_0x3c8539,[_0x16f671,_0x508d91]=useState(''),[_0x4a0d5d,_0x528a61]=useState(''),_0x2e2b03='my-page';function _0x53afc2(_0x4793b4){const _0x3427e7=a0_0xb5dd;if(_0x4793b4['length']>0x64)return{'valid':![],'message':_0x3427e7(0x18c)};if(_0x4793b4['startsWith']('/')||_0x4793b4[_0x3427e7(0x191)]('/'))return{'valid':![],'message':_0x3427e7(0x18f)};if(_0x4793b4[_0x3427e7(0x17e)]('//'))return{'valid':![],'message':_0x3427e7(0x188)};const _0x3925e1=_0x4793b4[_0x3427e7(0x185)]('/');for(const _0x57216d of _0x3925e1){if(!_0x57216d)continue;const _0x3504b=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x3504b[_0x3427e7(0x17b)](_0x57216d))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x194e57,_0xdff626)=>{const _0x2f0f6d=a0_0xb5dd;if(_0xdff626[_0x2f0f6d(0x179)]){const _0x286816=_0x16f671[_0x2f0f6d(0x180)]()||_0x2e2b03;if(_0x4a0d5d)return;const _0x406718=_0x38d4aa+'/'+_0x286816;if(a0_0xd5a7ed[_0x2f0f6d(0x189)](_0x406718)){_0x528a61(_0x2f0f6d(0x18e)+_0x286816+_0x2f0f6d(0x18b));return;}_0x592aa5(_0x286816),_0x508d91(''),_0x528a61('');}else _0xdff626['backspace']||_0xdff626[_0x2f0f6d(0x18a)]?_0x508d91(_0x268e2f=>{const _0x47d991=_0x268e2f['slice'](0x0,-0x1),{valid:_0x42195e,message:_0x1affc2}=_0x53afc2(_0x47d991);return _0x528a61(_0x42195e?'':_0x1affc2||'页面路径不合法'),_0x47d991;}):_0x508d91(_0x55b9c4=>{const _0x162c05=_0x2f0f6d,_0xd0a5f9=_0x55b9c4+_0x194e57,{valid:_0x50c04d,message:_0x1d7936}=_0x53afc2(_0xd0a5f9);return _0x528a61(_0x50c04d?'':_0x1d7936||_0x162c05(0x190)),_0xd0a5f9;});}),a0_0x6cd646(Box,{'flexDirection':_0x21b363(0x186),'children':[a0_0x6cd646(Box,{'children':[a0_0xa3fd21(Text,{'color':_0x21b363(0x17a),'children':'\x20Step2:\x20'}),a0_0xa3fd21(Text,{'children':_0x21b363(0x187)}),_0x16f671?a0_0xa3fd21(Text,{'color':_0x21b363(0x17f),'children':_0x16f671}):a0_0xa3fd21(Text,{'color':_0x21b363(0x17a),'children':_0x2e2b03}),_0x4a0d5d&&a0_0x6cd646(Text,{'color':'red','children':['\x20←\x20',_0x4a0d5d]})]}),!_0x4a0d5d&&!_0x16f671&&a0_0xa3fd21(Box,{'children':a0_0xa3fd21(Text,{'color':_0x21b363(0x17a),'children':_0x21b363(0x17c)})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a1_0x123b(){const _0x4a111d=['../../templates/pages','2411842tlDTPE','resolve','error','正在创建页面,请稍候…','1fDCzXe','cyan','success','3EjWggR','1728380FPLwMZ','1439260wGqyUa','now','\x20Step1:\x20','5025748ppyHJA','页面添加失败:\x20','28554471JxxwBF','页面添加成功:\x20','cwd','add-page','src','green','\x20Step2:\x20','gray','info','11207256HVZtut','dirname','已输入的页面路由\x20','pages','setLogPath','column','then','\x20*\x20页面文件已创建,可直接通过路由访问','5gUfWFu','join','5664054JuMrHg','已选择页面模板\x20','\x20*\x20页面创建成功!','\x20*\x20页面路径:\x20','27ywaKgY','catch'];a1_0x123b=function(){return _0x4a111d;};return a1_0x123b();}const a1_0x2ce4e2=a1_0x3aaa;(function(_0x1e27a5,_0x3f8ca1){const _0xc6c9c9=a1_0x3aaa,_0x1b59b8=_0x1e27a5();while(!![]){try{const _0x2ad283=parseInt(_0xc6c9c9(0xe0))/0x1*(-parseInt(_0xc6c9c9(0xdc))/0x2)+-parseInt(_0xc6c9c9(0xe3))/0x3*(parseInt(_0xc6c9c9(0xe5))/0x4)+parseInt(_0xc6c9c9(0xd3))/0x5*(parseInt(_0xc6c9c9(0xd5))/0x6)+parseInt(_0xc6c9c9(0xe8))/0x7+-parseInt(_0xc6c9c9(0xcb))/0x8+parseInt(_0xc6c9c9(0xd9))/0x9*(-parseInt(_0xc6c9c9(0xe4))/0xa)+parseInt(_0xc6c9c9(0xea))/0xb;if(_0x2ad283===_0x3f8ca1)break;else _0x1b59b8['push'](_0x1b59b8['shift']());}catch(_0x3a5b8c){_0x1b59b8['push'](_0x1b59b8['shift']());}}}(a1_0x123b,0xbca45));import{jsx as a1_0x589542,jsxs as a1_0x465e4e,Fragment as a1_0x5224dc}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0xd28303 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';function a1_0x3aaa(_0x1a689a,_0x23fe8d){_0x1a689a=_0x1a689a-0xcb;const _0x123b86=a1_0x123b();let _0x3aaa97=_0x123b86[_0x1a689a];return _0x3aaa97;}const __dirname=a1_0xd28303[a1_0x2ce4e2(0xcc)](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0xd28303[a1_0x2ce4e2(0xdd)](__dirname,a1_0x2ce4e2(0xdb)),projectDir=process[a1_0x2ce4e2(0xec)]();export const AddPage=()=>{const _0xe88591=a1_0x2ce4e2,{exit:_0x7f4a97}=useApp(),[_0x23f308,_0x396d96]=useState(''),[_0x44b3e0,_0x146eb3]=useState(''),[_0x5d2f81,_0x17c126]=useState(![]),[_0x5c89e6,_0x5df4c4]=useState(![]),_0x1888c9=a1_0xd28303[_0xe88591(0xd4)](projectDir,_0xe88591(0xee),_0xe88591(0xce)),_0x432686=a1_0xd28303['join'](_0x1888c9,_0x44b3e0),_0x1fda38=a1_0xd28303[_0xe88591(0xd4)]('src',_0xe88591(0xce),_0x44b3e0);useEffect(()=>{const _0x563b3b=_0xe88591,_0x26a011=a1_0xd28303[_0x563b3b(0xdd)](pageTemplateDir,_0x23f308);if(_0x23f308&&_0x44b3e0){_0x17c126(!![]),logger[_0x563b3b(0xcf)](process[_0x563b3b(0xec)]());const _0x183af5=Date[_0x563b3b(0xe6)]();logger[_0x563b3b(0xf2)]('add-page','开始添加页面:\x20'+_0x44b3e0,{'template':_0x23f308,'targetPath':_0x1fda38}),TemplateReplacer['processTemplate'](_0x26a011,a1_0xd28303[_0x563b3b(0xd4)](_0x1888c9,_0x44b3e0),_0x44b3e0,_0x23f308)[_0x563b3b(0xd1)](()=>{const _0x56f443=_0x563b3b,_0x1296be=Date['now']()-_0x183af5;logger[_0x56f443(0xe2)](_0x56f443(0xed),_0x56f443(0xeb)+_0x44b3e0,_0x1296be,{'template':_0x23f308,'targetPath':_0x1fda38,'routePath':_0x44b3e0}),_0x5df4c4(!![]);})[_0x563b3b(0xda)](_0x3eabfb=>{const _0x5172bb=_0x563b3b,_0x4c4ff1=Date[_0x5172bb(0xe6)]()-_0x183af5;logger[_0x5172bb(0xde)]('add-page',_0x5172bb(0xe9)+_0x44b3e0,{'template':_0x23f308,'targetPath':_0x1fda38,'error':_0x3eabfb instanceof Error?_0x3eabfb['message']:String(_0x3eabfb),'duration':_0x4c4ff1});})['finally'](()=>{_0x17c126(![]);});}},[_0x23f308,_0x44b3e0]),useEffect(()=>{_0x5c89e6&&setTimeout(()=>{_0x7f4a97();});},[_0x5c89e6]);if(_0x23f308)return a1_0x465e4e(Box,{'flexDirection':_0xe88591(0xd0),'paddingY':0x1,'children':[a1_0x465e4e(Box,{'children':[a1_0x589542(Text,{'color':_0xe88591(0xf1),'children':_0xe88591(0xe7)}),a1_0x589542(Text,{'children':_0xe88591(0xd6)}),a1_0x589542(Text,{'color':_0xe88591(0xef),'children':_0x23f308})]}),_0x44b3e0?a1_0x465e4e(Box,{'children':[a1_0x589542(Text,{'color':'gray','children':_0xe88591(0xf0)}),a1_0x589542(Text,{'children':_0xe88591(0xcd)}),a1_0x589542(Text,{'color':_0xe88591(0xef),'children':_0x44b3e0})]}):a1_0x589542(InputProjectCode,{'pagePath':_0x432686,'onSubmit':_0x146eb3}),_0x44b3e0&&_0x5d2f81?a1_0x465e4e(Box,{'marginTop':0x1,'children':[a1_0x589542(Box,{'width':'4'}),a1_0x589542(Text,{'children':_0xe88591(0xdf)})]}):null,_0x5c89e6?a1_0x465e4e(a1_0x5224dc,{'children':[a1_0x589542(Box,{'marginTop':0x1,'children':a1_0x589542(Text,{'color':'gray','children':_0xe88591(0xd7)})}),a1_0x465e4e(Box,{'children':[a1_0x589542(Text,{'color':_0xe88591(0xf1),'children':_0xe88591(0xd8)}),a1_0x589542(Text,{'color':'green','children':_0x1fda38})]}),a1_0x465e4e(Box,{'children':[a1_0x589542(Text,{'color':_0xe88591(0xf1),'children':'\x20*\x20路由地址:\x20'}),a1_0x465e4e(Text,{'color':_0xe88591(0xef),'children':['/',_0x44b3e0]})]}),a1_0x589542(Box,{'marginTop':0x1,'children':a1_0x589542(Text,{'color':_0xe88591(0xe1),'children':_0xe88591(0xd2)})})]}):null]});return a1_0x589542(SelectPageTemplate,{'onSelect':_0x396d96});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a2_0x38c8(_0x30b8b5,_0x2b5e84){_0x30b8b5=_0x30b8b5-0xf4;const _0x15bb3c=a2_0x15bb();let _0x38c85e=_0x15bb3c[_0x30b8b5];return _0x38c85e;}(function(_0x5da704,_0x1c62fa){const _0x339e11=a2_0x38c8,_0x57c185=_0x5da704();while(!![]){try{const _0x5921e3=-parseInt(_0x339e11(0xff))/0x1*(parseInt(_0x339e11(0x108))/0x2)+parseInt(_0x339e11(0xfc))/0x3+-parseInt(_0x339e11(0x10a))/0x4+parseInt(_0x339e11(0x10d))/0x5+parseInt(_0x339e11(0x10c))/0x6+-parseInt(_0x339e11(0xf4))/0x7*(-parseInt(_0x339e11(0xfe))/0x8)+-parseInt(_0x339e11(0x103))/0x9;if(_0x5921e3===_0x1c62fa)break;else _0x57c185['push'](_0x57c185['shift']());}catch(_0x4638e9){_0x57c185['push'](_0x57c185['shift']());}}}(a2_0x15bb,0xb0a3d));import{jsx as a2_0x359a72,jsxs as a2_0x264e75}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x396e92 from'node:path';import{fileURLToPath}from'node:url';function a2_0x15bb(){const _0x2687fe=['gray','请选择您要创建的页面模板','label','8812908cjOaHB','../..','downArrow','\x20Step1:\x20','join','14dNDVcp','upArrow','1283116pEgFpF','return','5552838UohkMy','1734020aeIfcL','dirname','templates/pages','获取模板列表失败:','sort','filter','\x20\x20\x20\x20\x20\x20>\x20','onSelect','map','7QDrZzI','正在加载页面模板...','name','error','length','sdk-fetch','resolve','column','1744815mjyJoZ','green','5151848uTUqBm','67765julDaR'];a2_0x15bb=function(){return _0x2687fe;};return a2_0x15bb();}async function getTemplateList(){const _0x487fde=a2_0x38c8;try{const _0x5ad8ac=fileURLToPath(import.meta.url),_0x22fc50=a2_0x396e92[_0x487fde(0xfa)](a2_0x396e92[_0x487fde(0x10e)](_0x5ad8ac),_0x487fde(0x104)),_0x3b7f3e=a2_0x396e92[_0x487fde(0x107)](_0x22fc50,_0x487fde(0x10f)),_0x4597e9=await readdir(_0x3b7f3e,{'withFileTypes':!![]}),_0x4ca320=_0x4597e9[_0x487fde(0x112)](_0x9f6747=>_0x9f6747['isDirectory']())[_0x487fde(0x115)](_0x268332=>({'label':_0x268332[_0x487fde(0xf6)]}))[_0x487fde(0x111)]((_0x460c7e,_0x4a2b3d)=>_0x460c7e['label']['localeCompare'](_0x4a2b3d[_0x487fde(0x102)]));return _0x4ca320;}catch(_0x741359){return console[_0x487fde(0xf7)](_0x487fde(0x110),_0x741359),[{'label':'blank'},{'label':_0x487fde(0xf9)}];}}export function SelectPageTemplate(_0x22b0b5){const _0x3b47d9=a2_0x38c8,[_0x2e5492,_0xe04e85]=useState(0x0),[_0x230e54,_0x5e9cb7]=useState([]),[_0x2b79d7,_0x452e1f]=useState(!![]);useEffect(()=>{async function _0x1ba6ab(){const _0x2d303a=await getTemplateList();_0x5e9cb7(_0x2d303a),_0x452e1f(![]);}_0x1ba6ab();},[]),useInput((_0x50502c,_0x3ce7b7)=>{const _0x3d57c9=a2_0x38c8;if(_0x2b79d7)return;if(_0x3ce7b7[_0x3d57c9(0x10b)]){const _0x2e391b=_0x230e54[_0x2e5492];_0x2e391b&&_0x22b0b5[_0x3d57c9(0x114)](_0x2e391b[_0x3d57c9(0x102)]);}_0x3ce7b7[_0x3d57c9(0x109)]&&_0xe04e85(_0x111a1c=>_0x111a1c===0x0?_0x230e54[_0x3d57c9(0xf8)]-0x1:_0x111a1c-0x1),_0x3ce7b7[_0x3d57c9(0x105)]&&_0xe04e85(_0x56ca0a=>_0x56ca0a===_0x230e54[_0x3d57c9(0xf8)]-0x1?0x0:_0x56ca0a+0x1);});if(_0x2b79d7)return a2_0x359a72(Box,{'flexDirection':_0x3b47d9(0xfb),'paddingY':0x1,'children':a2_0x264e75(Box,{'children':[a2_0x359a72(Text,{'color':_0x3b47d9(0x100),'children':_0x3b47d9(0x106)}),a2_0x359a72(Text,{'children':_0x3b47d9(0xf5)})]})});return a2_0x264e75(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x264e75(Box,{'children':[a2_0x359a72(Text,{'color':_0x3b47d9(0x100),'children':_0x3b47d9(0x106)}),a2_0x359a72(Text,{'children':_0x3b47d9(0x101)})]}),_0x230e54[_0x3b47d9(0x115)]((_0x3a6cf7,_0xaa81e)=>{const _0xa009ba=_0x3b47d9,_0xdc01a5=_0xaa81e===_0x2e5492,_0x3870f8=_0xdc01a5?_0xa009ba(0x113)+_0x3a6cf7['label']:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x3a6cf7['label'];return a2_0x359a72(Box,{'children':a2_0x359a72(Text,{'color':_0xdc01a5?_0xa009ba(0xfd):undefined,'children':_0x3870f8})},_0x3870f8);})]});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xeea6a9,_0x4fc13c){const _0x4e2beb=a3_0x3c28,_0x8281cc=_0xeea6a9();while(!![]){try{const _0x2dffe7=parseInt(_0x4e2beb(0x202))/0x1+parseInt(_0x4e2beb(0x1fe))/0x2+parseInt(_0x4e2beb(0x1f4))/0x3*(parseInt(_0x4e2beb(0x1cc))/0x4)+parseInt(_0x4e2beb(0x1e0))/0x5+parseInt(_0x4e2beb(0x200))/0x6*(-parseInt(_0x4e2beb(0x1d6))/0x7)+parseInt(_0x4e2beb(0x1cd))/0x8*(-parseInt(_0x4e2beb(0x1d9))/0x9)+-parseInt(_0x4e2beb(0x1f6))/0xa;if(_0x2dffe7===_0x4fc13c)break;else _0x8281cc['push'](_0x8281cc['shift']());}catch(_0xdcc5ea){_0x8281cc['push'](_0x8281cc['shift']());}}}(a3_0x1979,0x321c0));import{jsx as a3_0x41f96e,jsxs as a3_0x3c46c7,Fragment as a3_0x1e7447}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a3_0x1979(){const _0x48ad20=['正在获取数据集列表...','\x20-\x20','cwd','log','💡\x20请使用\x20','\x20个匹配的数据集\x1b[0m','includes','length','white','lovrabet\x20auth','文档生成失败:\x20',',\x20失败\x20','\x20(环境:\x20','771543LunJdn','string','1624040UMDUMo','\x1b[33m!\x20以下数据集代码不存在:\x20','dim','正在生成\x20','datasetName','map','message','error','196354vQVSaz','filter','585978ybpYkl','yellow','87655opdSTK','env','api-doc','🚀\x20','4HnNupn','8uswdqV','join','filePath','未提供应用AppCode,且配置中也没有默认值','.md\x20(','column','\x1b[90m*\x20从\x20','指定的数据集代码都不存在:\x20','gray','14GXOJJN','*\x20输出目录:\x20','文档生成完成','337482YkaufS','\x1b[0m','online','\x20重新登录后再试','red','green','使用指定的应用AppCode:\x20','787315JBKafV','*\x20生成的文档文件:','cyan','datasetCode','⚠️\x20以下数据集生成失败:','使用配置的应用AppCode:\x20','success'];a3_0x1979=function(){return _0x48ad20;};return a3_0x1979();}import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a3_0x3c28(_0x16a6fa,_0x4457d6){_0x16a6fa=_0x16a6fa-0x1c9;const _0x1979b6=a3_0x1979();let _0x3c288a=_0x1979b6[_0x16a6fa];return _0x3c288a;}import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x500672,env:_0x16f7d6,output:_0x41c957,extraParams:_0x1d8e67,datasetCodes:_0x2df6ed})=>{const _0x5d0c0e=a3_0x3c28,{exit:_0x225ab7}=useApp(),[_0x340ce6,_0x559e11]=useState(![]),[_0x2ffe11,_0x11d0c2]=useState(''),[_0x5d2473,_0x4ded25]=useState(![]),[_0x10b61a,_0x216044]=useState(null),[_0x1567e1,_0x3e4fca]=useState(null),[_0x44dad8,_0x5394b0]=useState(0x0),_0x5bc7e5=readConfig(),_0x327168=getConfigAppCode(),_0x538e4a=_0x500672||_0x327168,_0x48a681=typeof _0x5bc7e5?.[_0x5d0c0e(0x1c9)]===_0x5d0c0e(0x1f5)?_0x5bc7e5[_0x5d0c0e(0x1c9)]:undefined,_0xf25e64=_0x16f7d6||_0x48a681||_0x5d0c0e(0x1db);initEnv(_0xf25e64);const _0x39ee90=_0x41c957||'./docs',_0x2e3077=_0x500672?_0x5d0c0e(0x1df)+_0x538e4a:_0x5d0c0e(0x1e5)+_0x538e4a;useEffect(()=>{_0x559e11(!![]),_0x4195f2();},[]),useEffect(()=>{(_0x5d2473||_0x10b61a)&&_0x225ab7();},[_0x5d2473,_0x10b61a,_0x225ab7]);async function _0x4195f2(){const _0x593c29=_0x5d0c0e;if(!_0x538e4a){_0x216044(_0x593c29(0x1d0));return;}try{logger['setLogPath'](process[_0x593c29(0x1e9)]()),_0x11d0c2(_0x593c29(0x1e7));const {configArray:_0x3ae61d}=await fetchModelList(_0x538e4a);_0x5394b0(_0x3ae61d[_0x593c29(0x1ee)]);if(_0x3ae61d['length']===0x0){_0x216044('未找到任何数据集');return;}let _0x81831e=_0x3ae61d;if(_0x2df6ed&&_0x2df6ed['length']>0x0){_0x81831e=_0x3ae61d[_0x593c29(0x1ff)](_0x4f7f85=>_0x2df6ed[_0x593c29(0x1ed)](_0x4f7f85[_0x593c29(0x1e3)]));const _0x2e7c55=_0x81831e[_0x593c29(0x1fb)](_0x57d75c=>_0x57d75c[_0x593c29(0x1e3)]),_0x5e4103=_0x2df6ed[_0x593c29(0x1ff)](_0x35bba4=>!_0x2e7c55[_0x593c29(0x1ed)](_0x35bba4));_0x5e4103['length']>0x0&&console['log'](_0x593c29(0x1f7)+_0x5e4103[_0x593c29(0x1ce)](',\x20')+_0x593c29(0x1da));if(_0x81831e[_0x593c29(0x1ee)]===0x0){_0x216044(_0x593c29(0x1d4)+_0x2df6ed[_0x593c29(0x1ce)](',\x20'));return;}console[_0x593c29(0x1ea)](_0x593c29(0x1d3)+_0x3ae61d[_0x593c29(0x1ee)]+'\x20个数据集中筛选出\x20'+_0x81831e[_0x593c29(0x1ee)]+_0x593c29(0x1ec));}_0x11d0c2(_0x593c29(0x1f9)+_0x81831e[_0x593c29(0x1ee)]+'\x20个数据集的文档...');const _0x149978=await generateDatasetDocs(_0x81831e,_0x538e4a,_0x39ee90,(_0x31f42d,_0x481f31,_0x2ed438)=>{const _0x3f657b=_0x593c29;_0x11d0c2(_0x3f657b(0x1f9)+_0x2ed438+_0x3f657b(0x1d1)+_0x31f42d+'/'+_0x481f31+')');},_0x1d8e67);_0x3e4fca(_0x149978),_0x4ded25(!![]);const _0x3f80f7=_0x149978['filter'](_0x5bf5e6=>_0x5bf5e6[_0x593c29(0x1e6)])[_0x593c29(0x1ee)],_0x107819=_0x149978[_0x593c29(0x1ff)](_0x590684=>!_0x590684[_0x593c29(0x1e6)])[_0x593c29(0x1ee)];logger[_0x593c29(0x1e6)](_0x593c29(0x1ca),_0x593c29(0x1d8),undefined,{'totalCount':_0x149978[_0x593c29(0x1ee)],'successCount':_0x3f80f7,'failCount':_0x107819,'outputDir':_0x39ee90});}catch(_0x23e8d8){const _0x1ae14e=_0x23e8d8 instanceof Error?_0x23e8d8[_0x593c29(0x1fc)]:String(_0x23e8d8);logger[_0x593c29(0x1fd)](_0x593c29(0x1ca),_0x593c29(0x1f1)+_0x1ae14e,{'appCode':_0x538e4a,'outputDir':_0x39ee90}),_0x216044('文档生成失败:\x20'+_0x1ae14e);}finally{_0x559e11(![]);}}const _0x36f7cf=_0x1567e1?.[_0x5d0c0e(0x1ff)](_0x504be0=>_0x504be0[_0x5d0c0e(0x1e6)])[_0x5d0c0e(0x1ee)]||0x0,_0x5b9a07=_0x1567e1?.[_0x5d0c0e(0x1ff)](_0x3a5df7=>!_0x3a5df7['success'])[_0x5d0c0e(0x1ee)]||0x0;return a3_0x3c46c7(Box,{'flexDirection':_0x5d0c0e(0x1d2),'children':[(_0x340ce6||_0x5d2473)&&a3_0x3c46c7(Box,{'children':[a3_0x41f96e(Text,{'color':'gray','children':'*\x20'}),a3_0x41f96e(Text,{'color':_0x500672?_0x5d0c0e(0x1ef):_0x5d0c0e(0x1f8),'children':_0x2e3077})]}),_0x340ce6&&a3_0x41f96e(Box,{'children':a3_0x3c46c7(Text,{'children':[_0x5d0c0e(0x1cb),_0x2ffe11,_0x5d0c0e(0x1f3),_0xf25e64,')']})}),_0x5d2473&&_0x1567e1&&a3_0x3c46c7(Box,{'flexDirection':'column','children':[a3_0x41f96e(Box,{'children':a3_0x3c46c7(Text,{'color':_0x5d0c0e(0x1de),'children':['√\x20文档生成完成!成功\x20',_0x36f7cf,'\x20个',_0x5b9a07>0x0&&_0x5d0c0e(0x1f2)+_0x5b9a07+'\x20个']})}),a3_0x41f96e(Box,{'marginTop':0x1,'children':a3_0x3c46c7(Text,{'color':_0x5d0c0e(0x1d5),'children':['*\x20共处理\x20',_0x44dad8,'\x20个数据集']})}),a3_0x3c46c7(Box,{'marginTop':0x1,'children':[a3_0x41f96e(Text,{'color':_0x5d0c0e(0x1d5),'children':_0x5d0c0e(0x1d7)}),a3_0x41f96e(Text,{'color':_0x5d0c0e(0x1e2),'children':_0x39ee90})]}),_0x36f7cf>0x0&&a3_0x3c46c7(a3_0x1e7447,{'children':[a3_0x41f96e(Box,{'marginTop':0x1,'children':a3_0x41f96e(Text,{'color':_0x5d0c0e(0x1d5),'children':_0x5d0c0e(0x1e1)})}),_0x1567e1[_0x5d0c0e(0x1ff)](_0x56972a=>_0x56972a['success'])['map']((_0x47e44b,_0x17d176)=>a3_0x3c46c7(Box,{'marginLeft':0x2,'children':[a3_0x3c46c7(Text,{'color':'cyan','children':['•\x20',_0x47e44b[_0x5d0c0e(0x1cf)]]}),a3_0x3c46c7(Text,{'color':_0x5d0c0e(0x1f8),'children':[_0x5d0c0e(0x1e8),_0x47e44b[_0x5d0c0e(0x1fa)]]})]},_0x17d176))]}),_0x5b9a07>0x0&&a3_0x3c46c7(a3_0x1e7447,{'children':[a3_0x41f96e(Box,{'marginTop':0x1,'children':a3_0x41f96e(Text,{'color':_0x5d0c0e(0x201),'children':_0x5d0c0e(0x1e4)})}),_0x1567e1[_0x5d0c0e(0x1ff)](_0x11ec1a=>!_0x11ec1a['success'])['map']((_0x2685cd,_0x25660d)=>a3_0x3c46c7(Box,{'marginLeft':0x2,'flexDirection':'column','children':[a3_0x3c46c7(Text,{'color':_0x5d0c0e(0x1dd),'children':['•\x20',_0x2685cd['datasetName'],'\x20(',_0x2685cd['datasetCode'],')']}),_0x2685cd[_0x5d0c0e(0x1fd)]&&a3_0x41f96e(Box,{'marginLeft':0x2,'children':a3_0x41f96e(Text,{'color':_0x5d0c0e(0x1f8),'children':_0x2685cd[_0x5d0c0e(0x1fd)]})})]},_0x25660d))]})]}),_0x10b61a&&a3_0x3c46c7(Box,{'flexDirection':_0x5d0c0e(0x1d2),'children':[a3_0x41f96e(Box,{'children':a3_0x3c46c7(Text,{'color':'red','children':['❌\x20',_0x10b61a]})}),_0x10b61a['includes']('登录')&&a3_0x3c46c7(Box,{'marginTop':0x1,'children':[a3_0x41f96e(Text,{'color':'yellow','children':_0x5d0c0e(0x1eb)}),a3_0x41f96e(Text,{'color':_0x5d0c0e(0x1e2),'children':_0x5d0c0e(0x1f0)}),a3_0x41f96e(Text,{'color':'yellow','children':_0x5d0c0e(0x1dc)})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x281b60,_0x3ebd6f){const _0x395be0=a4_0x11c5,_0xb398e7=_0x281b60();while(!![]){try{const _0xa44ae7=parseInt(_0x395be0(0x15c))/0x1*(-parseInt(_0x395be0(0x162))/0x2)+-parseInt(_0x395be0(0x15d))/0x3+parseInt(_0x395be0(0x16a))/0x4*(parseInt(_0x395be0(0x178))/0x5)+parseInt(_0x395be0(0x173))/0x6+parseInt(_0x395be0(0x161))/0x7*(parseInt(_0x395be0(0x157))/0x8)+-parseInt(_0x395be0(0x169))/0x9*(parseInt(_0x395be0(0x163))/0xa)+-parseInt(_0x395be0(0x168))/0xb*(-parseInt(_0x395be0(0x179))/0xc);if(_0xa44ae7===_0x3ebd6f)break;else _0xb398e7['push'](_0xb398e7['shift']());}catch(_0x5ac879){_0xb398e7['push'](_0xb398e7['shift']());}}}(a4_0x331d,0xdf9c2));function a4_0x11c5(_0x31d0a9,_0x58f030){_0x31d0a9=_0x31d0a9-0x154;const _0x331dc9=a4_0x331d();let _0x11c5f6=_0x331dc9[_0x31d0a9];return _0x11c5f6;}function a4_0x331d(){const _0x35ea08=['261450DEmCdv','success','api-doc','.md\x20(','249893RebLlV','17642XKUrId','130inhLUS','text','datasetCode','error','.md','515020dtmKNE','131643umRQLt','12GEgpAW','/api/node-toolbox/api-doc-generator','),HTTP状态码:\x20','\x0a共有\x20','获取文档失败\x20(','message','push','length',']\x20正在生成:\x20','272364aSgkJG','):缺少\x20data.markdown\x20字段','log','data','join','489885huVAbR','156nNkxeH','name','✗\x20失败:\x20','json','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','136KTneVl','application/json','status','tableName','utf8','41SLuyzU'];a4_0x331d=function(){return _0x35ea08;};return a4_0x331d();}import{mkdirSync,writeFileSync}from'node:fs';import a4_0x5e5c2e 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(_0x122d3b){const _0x51c219=a4_0x11c5,{appCode:_0x2fdde7,datasetCode:_0x1eaf26,datasetId:_0x34f35f,extraParams:_0x373206}=_0x122d3b,_0x19a60e=getApiDomain(),_0x39226e=_0x19a60e+_0x51c219(0x16b),_0x3c634a={'appCode':_0x2fdde7,'datasetCode':_0x1eaf26,'datasetId':_0x34f35f,..._0x373206||{}},_0x30fc52=await fetch(_0x39226e,{'method':'POST','headers':{'Content-Type':_0x51c219(0x158),'Cookie':getCookie()},'body':JSON['stringify'](_0x3c634a)});if(!_0x30fc52['ok']){if(_0x30fc52[_0x51c219(0x159)]===0x191)throw new Error(_0x51c219(0x156));let _0x194194='';try{_0x194194=await _0x30fc52[_0x51c219(0x164)]();}catch(_0x57f6ad){}throw new Error(_0x51c219(0x16e)+_0x1eaf26+_0x51c219(0x16c)+_0x30fc52[_0x51c219(0x159)]+(_0x194194?'\x0a'+_0x194194:''));}const _0xcbf9f=await _0x30fc52[_0x51c219(0x155)]();if(!_0xcbf9f[_0x51c219(0x176)]||typeof _0xcbf9f['data']['markdown']!=='string')throw new Error('响应数据格式错误\x20('+_0x1eaf26+_0x51c219(0x174));return _0xcbf9f[_0x51c219(0x176)]['markdown'];}function delay(_0x5a3c44){return new Promise(_0x59dee3=>setTimeout(_0x59dee3,_0x5a3c44));}export async function generateDatasetDocs(_0x245e97,_0x305b24,_0x1dd897='./docs',_0x3ba667,_0x91ede3){const _0x1365b4=a4_0x11c5;mkdirSync(_0x1dd897,{'recursive':!![]});const _0x52b0cd=[],_0x33e739=_0x245e97[_0x1365b4(0x171)];console['log'](_0x1365b4(0x16d)+_0x33e739+'\x20个数据集需要生成文档\x0a');for(let _0x4d727b=0x0;_0x4d727b<_0x245e97[_0x1365b4(0x171)];_0x4d727b++){const _0x30da8a=_0x245e97[_0x4d727b],_0x3f5ec2=_0x4d727b+0x1,_0x5b7f6d=_0x30da8a[_0x1365b4(0x15a)];try{console[_0x1365b4(0x175)]('['+_0x3f5ec2+'/'+_0x33e739+_0x1365b4(0x172)+_0x5b7f6d+_0x1365b4(0x160)+_0x30da8a[_0x1365b4(0x17a)]+')');_0x3ba667&&_0x3ba667(_0x3f5ec2,_0x33e739,_0x5b7f6d);const _0x250675=await fetchDatasetDoc({'appCode':_0x305b24,'datasetCode':_0x30da8a['datasetCode'],'datasetId':_0x30da8a['id'],'enableAI':![],'extraParams':_0x91ede3}),_0x4cc53f=a4_0x5e5c2e[_0x1365b4(0x177)](_0x1dd897,_0x5b7f6d+'.md');writeFileSync(_0x4cc53f,_0x250675,{'encoding':_0x1365b4(0x15b)}),console[_0x1365b4(0x175)]('✓\x20成功生成:\x20'+_0x5b7f6d+_0x1365b4(0x167)),logger[_0x1365b4(0x15e)](_0x1365b4(0x15f),'生成文档成功:\x20'+_0x5b7f6d,undefined,{'datasetCode':_0x30da8a[_0x1365b4(0x165)],'datasetName':_0x30da8a[_0x1365b4(0x17a)],'filePath':_0x4cc53f,'progress':_0x3f5ec2+'/'+_0x33e739}),_0x52b0cd[_0x1365b4(0x170)]({'datasetCode':_0x30da8a[_0x1365b4(0x165)],'datasetName':_0x30da8a[_0x1365b4(0x17a)],'filePath':_0x4cc53f,'success':!![]}),_0x3f5ec2<_0x33e739&&await delay(0x1388);}catch(_0x200e56){const _0x3212e3=_0x200e56 instanceof Error?_0x200e56[_0x1365b4(0x16f)]:String(_0x200e56);console['log'](_0x1365b4(0x154)+_0x5b7f6d+'.md\x20-\x20'+_0x3212e3+'\x0a'),logger[_0x1365b4(0x166)](_0x1365b4(0x15f),'生成文档失败:\x20'+_0x30da8a['datasetCode'],{'datasetCode':_0x30da8a[_0x1365b4(0x165)],'datasetName':_0x30da8a['name'],'error':_0x3212e3,'progress':_0x3f5ec2+'/'+_0x33e739}),_0x52b0cd[_0x1365b4(0x170)]({'datasetCode':_0x30da8a['datasetCode'],'datasetName':_0x30da8a[_0x1365b4(0x17a)],'filePath':'','success':![],'error':_0x3212e3}),_0x3f5ec2<_0x33e739&&(console[_0x1365b4(0x175)]('等待\x203\x20秒...\x0a'),await delay(0xbb8));}}return _0x52b0cd;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1f4451,_0x2aae64){const _0x1e4a14=a5_0x45c5,_0x51afba=_0x1f4451();while(!![]){try{const _0x2038ff=parseInt(_0x1e4a14(0x201))/0x1*(-parseInt(_0x1e4a14(0x1fa))/0x2)+-parseInt(_0x1e4a14(0x1ef))/0x3*(parseInt(_0x1e4a14(0x1eb))/0x4)+-parseInt(_0x1e4a14(0x1de))/0x5*(parseInt(_0x1e4a14(0x209))/0x6)+parseInt(_0x1e4a14(0x1f4))/0x7*(-parseInt(_0x1e4a14(0x205))/0x8)+-parseInt(_0x1e4a14(0x1e7))/0x9+parseInt(_0x1e4a14(0x1ea))/0xa*(parseInt(_0x1e4a14(0x1d9))/0xb)+-parseInt(_0x1e4a14(0x1f2))/0xc*(-parseInt(_0x1e4a14(0x1ed))/0xd);if(_0x2038ff===_0x2aae64)break;else _0x51afba['push'](_0x51afba['shift']());}catch(_0x11c810){_0x51afba['push'](_0x51afba['shift']());}}}(a5_0x20fc,0x7f612));import{jsx as a5_0x202514,jsxs as a5_0x52d50f}from'react/jsx-runtime';function a5_0x45c5(_0x2b741a,_0x1276ae){_0x2b741a=_0x2b741a-0x1d7;const _0x20fc8d=a5_0x20fc();let _0x45c5fa=_0x20fc8d[_0x2b741a];return _0x45c5fa;}import{useEffect,useState}from'react';function a5_0x20fc(){const _0x177237=['originalCount','env','join','8sEreVZ','green','api','replace','332598jqQGra','\x20from\x20\x27@/','💡\x20请使用\x20','api-pull','client','modelCount','11loBQqg','!\x20原始数据集\x20','{\x20lovrabetClient\x20}','gray','√\x20成功拉取\x20','65tVWCyP','lovrabet\x20auth','duplicateCount','\x20-\x20客户端实例文件','string','./src/api/','split','-api','length','5593563UIArLz','未提供应用AppCode,且配置中也没有默认值','column','2471050nDjXEr','28JHMdGk','使用配置的应用AppCode:\x20','916942uvbOTF','online','94911sKZCSk','.ts','*\x20已生成文件:','480LbGSOU','white','1344203mFFNqj','*\x20导入方式:','includes','endsWith','dim','\x20个模型)','38590icRWkJ','cyan','拉取\x20API\x20配置失败:\x20','\x20个,过滤重复','使用指定的应用AppCode:\x20','cwd','yellow','41ATTpvI'];a5_0x20fc=function(){return _0x177237;};return a5_0x20fc();}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';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x40e88d,env:_0x3cb3ea,output:_0x286aa5})=>{const _0x186c0a=a5_0x45c5,{exit:_0x1c038a}=useApp(),[_0x2c4d78,_0x5a36c5]=useState(![]),[_0x38d442,_0x2f9e06]=useState(![]),[_0x1d15e3,_0x7b7a42]=useState(null),[_0x791560,_0x320fde]=useState(null),_0x5838ae=readConfig(),_0x1c62b7=getConfigAppCode(),_0x395480=_0x40e88d||_0x1c62b7,_0x3e5e6b=typeof _0x5838ae?.[_0x186c0a(0x203)]===_0x186c0a(0x1e2)?_0x5838ae['env']:undefined,_0x3b0b86=_0x3cb3ea||_0x3e5e6b||_0x186c0a(0x1ee);initEnv(_0x3b0b86);const _0x413753=_0x286aa5||_0x186c0a(0x1e3),_0x340d22=_0x40e88d&&_0x40e88d[_0x186c0a(0x1f6)]('-')?_0x40e88d[_0x186c0a(0x1e4)]('-')['slice'](0x1)[_0x186c0a(0x204)]('-'):'',_0x2165c4=_0x40e88d?_0x186c0a(0x1fe)+_0x395480:_0x186c0a(0x1ec)+_0x395480,_0x3eceaf=_0x340d22?_0x340d22+_0x186c0a(0x1e5):_0x186c0a(0x207),_0x1fccbb=_0x340d22?_0x340d22+'-client':_0x186c0a(0x1d7);useEffect(()=>{_0x5a36c5(!![]),_0x5b4480();},[]),useEffect(()=>{(_0x38d442||_0x1d15e3)&&_0x1c038a();},[_0x38d442,_0x1d15e3,_0x1c038a]);async function _0x5b4480(){const _0x26f321=_0x186c0a;if(!_0x395480){_0x7b7a42(_0x26f321(0x1e8));return;}try{logger['setLogPath'](process[_0x26f321(0x1ff)]());const {configArray:_0x2ff7c8}=await fetchModelList(_0x395480),_0x8874da=_0x2ff7c8[_0x26f321(0x1e6)],_0x3abdf4=!_0x40e88d,_0x25e2aa=await generateApiFile(_0x2ff7c8,_0x340d22,_0x395480,_0x3abdf4,_0x3b0b86,_0x413753),_0x267485=_0x413753[_0x26f321(0x1f7)]('/')?_0x413753:_0x413753+'/';_0x320fde({'api':''+_0x267485+_0x3eceaf+_0x26f321(0x1f0),'client':''+_0x267485+_0x1fccbb+_0x26f321(0x1f0),'modelCount':_0x25e2aa[_0x26f321(0x1d8)],'datasetCount':_0x8874da,'originalCount':_0x8874da,'duplicateCount':0x0}),_0x2f9e06(!![]);}catch(_0x2898b9){const _0xc11b4d=_0x2898b9 instanceof Error?_0x2898b9['message']:String(_0x2898b9);logger['error'](_0x26f321(0x20c),_0x26f321(0x1fc)+_0xc11b4d,{'appCode':_0x395480,'error':_0xc11b4d}),_0x7b7a42(_0x26f321(0x1fc)+_0xc11b4d);}finally{_0x5a36c5(![]);}}return a5_0x52d50f(Box,{'flexDirection':_0x186c0a(0x1e9),'children':[(_0x2c4d78||_0x38d442)&&a5_0x52d50f(Box,{'children':[a5_0x202514(Text,{'color':_0x186c0a(0x1dc),'children':'*\x20'}),a5_0x202514(Text,{'color':_0x40e88d?_0x186c0a(0x1f3):_0x186c0a(0x1f8),'children':_0x2165c4})]}),_0x2c4d78&&a5_0x202514(Box,{'children':a5_0x52d50f(Text,{'children':['🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20',_0x3b0b86,')']})}),_0x38d442&&_0x791560&&a5_0x52d50f(Box,{'flexDirection':'column','children':[a5_0x202514(Box,{'children':a5_0x52d50f(Text,{'color':_0x186c0a(0x206),'children':[_0x186c0a(0x1dd),_0x791560['datasetCount'],'\x20个数据集,生成','\x20',_0x791560[_0x186c0a(0x1d8)],'\x20个模型']})}),_0x791560[_0x186c0a(0x1e0)]>0x0&&a5_0x202514(Box,{'marginTop':0x1,'children':a5_0x52d50f(Text,{'color':_0x186c0a(0x200),'children':[_0x186c0a(0x1da),_0x791560[_0x186c0a(0x202)],_0x186c0a(0x1fd),'\x20',_0x791560['duplicateCount'],'\x20个']})}),a5_0x202514(Box,{'marginTop':0x1,'children':a5_0x202514(Text,{'color':_0x186c0a(0x1dc),'children':_0x186c0a(0x1f1)})}),a5_0x52d50f(Box,{'marginLeft':0x2,'children':[a5_0x52d50f(Text,{'color':_0x186c0a(0x1fb),'children':['•\x20',_0x791560[_0x186c0a(0x207)]]}),a5_0x52d50f(Text,{'color':_0x186c0a(0x1f8),'children':['\x20','-\x20模型配置文件\x20(',_0x791560[_0x186c0a(0x1d8)],_0x186c0a(0x1f9)]})]}),a5_0x52d50f(Box,{'marginLeft':0x2,'children':[a5_0x52d50f(Text,{'color':'cyan','children':['•\x20',_0x791560[_0x186c0a(0x1d7)]]}),a5_0x202514(Text,{'color':_0x186c0a(0x1f8),'children':_0x186c0a(0x1e1)})]}),a5_0x202514(Box,{'marginTop':0x1,'children':a5_0x202514(Text,{'color':_0x186c0a(0x1dc),'children':_0x186c0a(0x1f5)})}),a5_0x202514(Box,{'marginLeft':0x2,'children':a5_0x52d50f(Text,{'color':_0x186c0a(0x200),'children':['import\x20',_0x186c0a(0x1db),_0x186c0a(0x20a),_0x791560[_0x186c0a(0x1d7)][_0x186c0a(0x208)](/^\.\//,'')[_0x186c0a(0x208)]('.ts',''),'\x27']})})]}),_0x1d15e3&&a5_0x52d50f(Box,{'flexDirection':_0x186c0a(0x1e9),'children':[a5_0x202514(Box,{'children':a5_0x52d50f(Text,{'color':'red','children':['❌\x20',_0x1d15e3]})}),_0x1d15e3[_0x186c0a(0x1f6)]('登录')&&a5_0x52d50f(Box,{'marginTop':0x1,'children':[a5_0x202514(Text,{'color':'yellow','children':_0x186c0a(0x20b)}),a5_0x202514(Text,{'color':_0x186c0a(0x1fb),'children':_0x186c0a(0x1df)}),a5_0x202514(Text,{'color':_0x186c0a(0x200),'children':'\x20重新登录后再试'})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a6_0x5881(){const _0x1a65dc=['2079QkKWft','未知错误','data','message','count','1510926iElVaB','info','15632pYCykK','856720nOfuzZ','获取数据集失败:\x20','3250965aRZBZL','success','3598JPVkGq','129741dkbcRo','status','5099073aCUilu','configArray','fetch-model-list','5xBUxsC','&otype=array','获取数据集失败,HTTP状态码:\x20'];a6_0x5881=function(){return _0x1a65dc;};return a6_0x5881();}(function(_0x532579,_0x2cdab8){const _0x5528d1=a6_0x230a,_0x394faf=_0x532579();while(!![]){try{const _0x344808=parseInt(_0x5528d1(0x1e0))/0x1*(-parseInt(_0x5528d1(0x1ef))/0x2)+parseInt(_0x5528d1(0x1f0))/0x3+-parseInt(_0x5528d1(0x1eb))/0x4+parseInt(_0x5528d1(0x1ed))/0x5+parseInt(_0x5528d1(0x1e8))/0x6+-parseInt(_0x5528d1(0x1f2))/0x7+parseInt(_0x5528d1(0x1ea))/0x8*(parseInt(_0x5528d1(0x1e3))/0x9);if(_0x344808===_0x2cdab8)break;else _0x394faf['push'](_0x394faf['shift']());}catch(_0x1c2f75){_0x394faf['push'](_0x394faf['shift']());}}}(a6_0x5881,0x6ca5d));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';function a6_0x230a(_0x42521b,_0x4a675d){_0x42521b=_0x42521b-0x1df;const _0x588112=a6_0x5881();let _0x230aae=_0x588112[_0x42521b];return _0x230aae;}export async function fetchModelList(_0x3f91c3){const _0x22920e=a6_0x230a,_0x37fbd8=getEnv(),_0x41aa4c=getApiDomain()+'/api/node-toolbox/dataset/model-list?appcode='+_0x3f91c3+_0x22920e(0x1e1);logger[_0x22920e(0x1e9)](_0x22920e(0x1df),'正在从服务器拉取模型列表...\x20(环境:\x20'+_0x37fbd8+')',{'apiUrl':_0x41aa4c});const _0x20d40e=await fetch(_0x41aa4c,{'headers':{'Cookie':getCookie()}});if(!_0x20d40e['ok']){if(_0x20d40e[_0x22920e(0x1f1)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');throw new Error(_0x22920e(0x1e2)+_0x20d40e['status']);}const _0x3cbbd8=await _0x20d40e['json']();if(!_0x3cbbd8[_0x22920e(0x1ee)])throw new Error(_0x22920e(0x1ec)+(_0x3cbbd8[_0x22920e(0x1e6)]||_0x22920e(0x1e4)));return{'configArray':_0x3cbbd8[_0x22920e(0x1e5)][_0x22920e(0x1f3)],'count':_0x3cbbd8[_0x22920e(0x1e5)][_0x22920e(0x1e7)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a7_0x77827d=a7_0x1296;(function(_0xf9c09b,_0x2aa8f2){const _0x3fef00=a7_0x1296,_0x5cf453=_0xf9c09b();while(!![]){try{const _0x39b01c=-parseInt(_0x3fef00(0xf6))/0x1+parseInt(_0x3fef00(0xf0))/0x2+-parseInt(_0x3fef00(0xdd))/0x3*(-parseInt(_0x3fef00(0xe4))/0x4)+parseInt(_0x3fef00(0xfd))/0x5*(parseInt(_0x3fef00(0xf5))/0x6)+parseInt(_0x3fef00(0xf2))/0x7*(parseInt(_0x3fef00(0x101))/0x8)+-parseInt(_0x3fef00(0xef))/0x9*(parseInt(_0x3fef00(0xed))/0xa)+-parseInt(_0x3fef00(0xf3))/0xb;if(_0x39b01c===_0x2aa8f2)break;else _0x5cf453['push'](_0x5cf453['shift']());}catch(_0x21058f){_0x5cf453['push'](_0x5cf453['shift']());}}}(a7_0x517e,0xe97a8));import a7_0xf8672d from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x5b8516 from'node:path';function a7_0x517e(){const _0x51c331=['format','length','name','replaceApiContent','8393170WepgUu','init-api','online','client','3935968Iovcxn','api.ts.tpl','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','dirname','438LqwjaA','./src/api/','utf8','key',',\x20env:\x20\x22','{\x20apiConfigName:\x20','-client','41460Kkocpg','forEach','tableName','resolve','templates/generate-api','join','string','../..','typescript','6055600KeJJwg','.ts','9vPGTKU','725582OArWEk','keys','14qlMyrw','12260809epxcLK','endsWith','6hicMpD','1862200PeGfbu','success','-api'];a7_0x517e=function(){return _0x51c331;};return a7_0x517e();}function a7_0x1296(_0x1228c4,_0x415393){_0x1228c4=_0x1228c4-0xdd;const _0x517e61=a7_0x517e();let _0x1296d0=_0x517e61[_0x1228c4];return _0x1296d0;}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x2d33cc,_0x2a466c='',_0x201f73,_0x26b58f=![],_0x1c569d,_0x1a54d3=a7_0x77827d(0xde)){const _0x1269c4=a7_0x77827d,_0x236dcd=readConfig(),_0x8101a1=_0x201f73||_0x236dcd?.['app'];if(typeof _0x8101a1!==_0x1269c4(0xea)||!_0x8101a1)throw new Error(_0x1269c4(0x103));const _0x12db20=_0x26b58f?'CONFIG_NAMES.DEFAULT':'\x22'+_0x8101a1+'\x22',_0x277f01=typeof _0x236dcd['env']==='string'?_0x236dcd['env']:undefined,_0x318811=_0x1c569d||_0x277f01||'online',_0x1f284e=_0x318811!==_0x1269c4(0xff);let _0x577dfc;if(_0x26b58f)_0x1f284e?_0x577dfc=_0x1269c4(0xe2)+_0x12db20+_0x1269c4(0xe1)+_0x318811+'\x22\x20}':_0x577dfc='';else{const _0x18d558=_0x1f284e?_0x1269c4(0xe1)+_0x318811+'\x22':'';_0x577dfc='{\x20apiConfigName:\x20\x22'+_0x8101a1+'\x22'+_0x18d558+'\x20}';}const _0x203728=_0x2a466c?_0x2a466c+_0x1269c4(0xf8):'api',_0x1fce04=_0x2a466c?_0x2a466c+_0x1269c4(0xe3):_0x1269c4(0x100),_0xd795e={};_0x2d33cc[_0x1269c4(0xe5)](_0x4c5232=>{const _0x14d43f=_0x1269c4;_0xd795e[_0x4c5232[_0x14d43f(0xe0)]]={'tableName':_0x4c5232[_0x14d43f(0xe6)],'datasetCode':_0x4c5232['datasetCode'],'name':_0x4c5232[_0x14d43f(0xfb)]||''};});const _0x1e9929=fileURLToPath(import.meta.url),_0x382167=a7_0x5b8516[_0x1269c4(0xe7)](a7_0x5b8516[_0x1269c4(0x104)](_0x1e9929),_0x1269c4(0xeb)),_0x563701=a7_0x5b8516[_0x1269c4(0xe9)](_0x382167,_0x1269c4(0xe8)),_0xd77f37=a7_0x5b8516[_0x1269c4(0xe9)](_0x563701,_0x1269c4(0x102)),_0x180baf=a7_0x5b8516['join'](_0x563701,'client.ts.tpl'),_0x3d33c0=_0x1a54d3[_0x1269c4(0xf4)]('/')?_0x1a54d3['slice'](0x0,-0x1):_0x1a54d3;mkdirSync(_0x3d33c0,{'recursive':!![]});const _0x376a30=readFileSync(_0xd77f37,_0x1269c4(0xdf)),_0x289295=TemplateReplacer[_0x1269c4(0xfc)](_0x376a30,_0x8101a1,_0xd795e,Object[_0x1269c4(0xf1)](_0xd795e)[0x0],_0x203728,_0x12db20),_0x2e4f8b=await a7_0xf8672d[_0x1269c4(0xf9)](_0x289295,{'parser':_0x1269c4(0xec)}),_0x2af4cc=_0x3d33c0+'/'+_0x203728+'.ts';writeFileSync(_0x2af4cc,_0x2e4f8b,{'encoding':_0x1269c4(0xdf)});const _0x5db6ab=readFileSync(_0x180baf,'utf8'),_0xe60152=TemplateReplacer['replaceApiContent'](_0x5db6ab,_0x8101a1,_0xd795e,Object[_0x1269c4(0xf1)](_0xd795e)[0x0],_0x203728,_0x12db20,_0x577dfc),_0xe337ef=await a7_0xf8672d[_0x1269c4(0xf9)](_0xe60152,{'parser':_0x1269c4(0xec)}),_0xc5161=_0x3d33c0+'/'+_0x1fce04+_0x1269c4(0xee);writeFileSync(_0xc5161,_0xe337ef,{'encoding':'utf8'});const _0x4a166b=Object[_0x1269c4(0xf1)](_0xd795e)[_0x1269c4(0xfa)];return logger[_0x1269c4(0xf7)](_0x1269c4(0xfe),'API\x20文件生成成功!',undefined,{'apiFile':_0x2af4cc,'clientFile':_0xc5161,'modelCount':_0x4a166b,'configName':_0x12db20}),{'modelCount':_0x4a166b,'apiFilePath':_0x2af4cc,'clientFilePath':_0xc5161,'configName':_0x12db20};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a8_0x2532(_0x3d9996,_0x3ec14d){_0x3d9996=_0x3d9996-0xf9;const _0x18245b=a8_0x1824();let _0x25328b=_0x18245b[_0x3d9996];return _0x25328b;}function a8_0x1824(){const _0x6a22a2=['exit','params','\x1b[0m','254JsmnRx','string','8XWpcqb','13173kgtust','\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配置文件','1369718kHwHvg','8697870YrDJqg','join','请使用\x20--appcode\x20参数,例如:','split','\x1b[90m*\x20仅生成指定数据集的文档:\x20','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','trim','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','!\x20请使用以下方式之一:','3676140ROzraZ','8KfVMWN','906295fVNCRT','appcode','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','flags','output','map','datasetcode','Available\x20commands:','env','\x20\x20错误:\x20','isArray','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','parse','object','1103586PvamGc','❌\x20错误:不再支持位置参数方式','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','325308gmIgpY','\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文档','\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--datasetcode\x20参数不能为空','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','×\x20未配置\x20AppCode','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','Unknown\x20api\x20command:\x20','doc','length','help','log','input','error','filter','10YkVjqp','\x1b[90m*\x20使用配置的应用AppCode:\x20'];a8_0x1824=function(){return _0x6a22a2;};return a8_0x1824();}(function(_0x1bba68,_0x30536e){const _0x1f6c40=a8_0x2532,_0x49f7c8=_0x1bba68();while(!![]){try{const _0x17afc3=-parseInt(_0x1f6c40(0x104))/0x1+parseInt(_0x1f6c40(0x119))/0x2*(parseInt(_0x1f6c40(0x11c))/0x3)+parseInt(_0x1f6c40(0x11b))/0x4*(-parseInt(_0x1f6c40(0x12a))/0x5)+-parseInt(_0x1f6c40(0x128))/0x6+-parseInt(_0x1f6c40(0x11e))/0x7*(-parseInt(_0x1f6c40(0x129))/0x8)+-parseInt(_0x1f6c40(0x11f))/0x9*(-parseInt(_0x1f6c40(0x114))/0xa)+parseInt(_0x1f6c40(0x101))/0xb;if(_0x17afc3===_0x30536e)break;else _0x49f7c8['push'](_0x49f7c8['shift']());}catch(_0x474dea){_0x49f7c8['push'](_0x49f7c8['shift']());}}}(a8_0x1824,0x7ed93));import{jsx as a8_0x12744c}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(_0x5a517d){const _0x45df7a=a8_0x2532,_0x13e839=_0x5a517d[_0x45df7a(0x111)][0x1];if(_0x5a517d[_0x45df7a(0x12d)][_0x45df7a(0x10f)]){console[_0x45df7a(0x110)](_0x45df7a(0x106));return;}if(_0x13e839==='pull'){_0x5a517d['input'][0x2]&&(console[_0x45df7a(0x112)](_0x45df7a(0x102)),console[_0x45df7a(0x110)](_0x45df7a(0x121)),console[_0x45df7a(0x110)](_0x45df7a(0x108)+_0x5a517d[_0x45df7a(0x111)][0x2]),process[_0x45df7a(0x116)](0x1));const _0x44a821=getConfigAppCode();let _0xd9053f=_0x5a517d['flags'][_0x45df7a(0x12b)];const _0x39278e=typeof _0x5a517d[_0x45df7a(0x12d)][_0x45df7a(0xfb)]===_0x45df7a(0x11a)?_0x5a517d['flags'][_0x45df7a(0xfb)]:undefined,_0x5b8a4f=_0x5a517d[_0x45df7a(0x12d)][_0x45df7a(0x12e)];!_0xd9053f&&!_0x44a821&&(console[_0x45df7a(0x112)](_0x45df7a(0x109)),console[_0x45df7a(0x110)](_0x45df7a(0x127)),console[_0x45df7a(0x110)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x45df7a(0x110)]('\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>'),process[_0x45df7a(0x116)](0x1)),_0xd9053f&&_0x44a821&&_0xd9053f===_0x44a821&&(console[_0x45df7a(0x110)](_0x45df7a(0x115)+_0xd9053f+'\x1b[0m'),console[_0x45df7a(0x110)](_0x45df7a(0x10a)),_0xd9053f=undefined),render(a8_0x12744c(ApiPullUI,{'appCode':_0xd9053f,'env':_0x39278e,'output':_0x5b8a4f}));}else{if(_0x13e839===_0x45df7a(0x10d)){_0x5a517d[_0x45df7a(0x111)][0x2]&&(console[_0x45df7a(0x112)](_0x45df7a(0x102)),console[_0x45df7a(0x110)](_0x45df7a(0x121)),console[_0x45df7a(0x110)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20'+_0x5a517d[_0x45df7a(0x111)][0x2]),process[_0x45df7a(0x116)](0x1));const _0x4c43c8=getConfigAppCode();let _0x1501ef=_0x5a517d[_0x45df7a(0x12d)][_0x45df7a(0x12b)];const _0x237cc3=typeof _0x5a517d[_0x45df7a(0x12d)][_0x45df7a(0xfb)]==='string'?_0x5a517d[_0x45df7a(0x12d)][_0x45df7a(0xfb)]:undefined,_0x17ff24=_0x5a517d[_0x45df7a(0x12d)][_0x45df7a(0x12e)],_0x343121=_0x5a517d['flags'][_0x45df7a(0x117)],_0x12a4b0=_0x5a517d[_0x45df7a(0x12d)][_0x45df7a(0xf9)];!_0x1501ef&&!_0x4c43c8&&(console[_0x45df7a(0x112)]('×\x20未配置\x20AppCode'),console['log'](_0x45df7a(0x127)),console['log'](_0x45df7a(0x103)),console['log'](_0x45df7a(0x126)),process[_0x45df7a(0x116)](0x1));_0x1501ef&&_0x4c43c8&&_0x1501ef===_0x4c43c8&&(console[_0x45df7a(0x110)](_0x45df7a(0x115)+_0x1501ef+_0x45df7a(0x118)),_0x1501ef=undefined);let _0x3cfe39;if(_0x343121)try{_0x3cfe39=JSON[_0x45df7a(0xff)](_0x343121),(typeof _0x3cfe39!==_0x45df7a(0x100)||_0x3cfe39===null||Array[_0x45df7a(0xfd)](_0x3cfe39))&&(console[_0x45df7a(0x112)](_0x45df7a(0x10b)),process[_0x45df7a(0x116)](0x1));}catch(_0x546b55){console[_0x45df7a(0x112)]('×\x20--params\x20参数不是有效的\x20JSON\x20格式'),console[_0x45df7a(0x112)](_0x45df7a(0xfc)+(_0x546b55 instanceof Error?_0x546b55['message']:String(_0x546b55))),process['exit'](0x1);}let _0x3424b1;_0x12a4b0&&(_0x3424b1=_0x12a4b0[_0x45df7a(0x122)](',')[_0x45df7a(0x12f)](_0xb9cac9=>_0xb9cac9[_0x45df7a(0x125)]())[_0x45df7a(0x113)](_0x43aa6c=>_0x43aa6c[_0x45df7a(0x10e)]>0x0),_0x3424b1[_0x45df7a(0x10e)]===0x0&&(console[_0x45df7a(0x112)](_0x45df7a(0x107)),process[_0x45df7a(0x116)](0x1)),console['log'](_0x45df7a(0x123)+_0x3424b1[_0x45df7a(0x120)](',\x20')+_0x45df7a(0x118))),render(a8_0x12744c(ApiDocUI,{'appCode':_0x1501ef,'env':_0x237cc3,'output':_0x17ff24,'extraParams':_0x3cfe39,'datasetCodes':_0x3424b1}));}else console[_0x45df7a(0x112)](_0x45df7a(0x10c)+_0x13e839),console['log'](_0x45df7a(0xfa)),console[_0x45df7a(0x110)](_0x45df7a(0x11d)),console[_0x45df7a(0x110)]('\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode'),console[_0x45df7a(0x110)](_0x45df7a(0x12c)),console['log'](_0x45df7a(0xfe)),console['log'](''),console[_0x45df7a(0x110)](_0x45df7a(0x105)),console[_0x45df7a(0x110)](_0x45df7a(0x124)),console['log']('\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)'),console[_0x45df7a(0x110)]('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process[_0x45df7a(0x116)](0x1);}}
|
package/lib/api/pull-silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x46b107,_0x187542){const _0x5645df=a9_0x15f0,_0x28cc27=_0x46b107();while(!![]){try{const _0x469bca=parseInt(_0x5645df(0x194))/0x1+-parseInt(_0x5645df(0x193))/0x2*(parseInt(_0x5645df(0x1a9))/0x3)+parseInt(_0x5645df(0x1b2))/0x4*(parseInt(_0x5645df(0x1b4))/0x5)+parseInt(_0x5645df(0x192))/0x6*(parseInt(_0x5645df(0x197))/0x7)+parseInt(_0x5645df(0x1a4))/0x8*(-parseInt(_0x5645df(0x1a0))/0x9)+parseInt(_0x5645df(0x19c))/0xa+-parseInt(_0x5645df(0x1ac))/0xb*(-parseInt(_0x5645df(0x19d))/0xc);if(_0x469bca===_0x187542)break;else _0x28cc27['push'](_0x28cc27['shift']());}catch(_0x150e4d){_0x28cc27['push'](_0x28cc27['shift']());}}}(a9_0x5967,0x40c46));function a9_0x5967(){const _0x27d453=['49Azuxpk','client','log','√\x20成功拉取\x20','.ts\x20-\x20客户端实例文件','949520GbHfpT','36XpfSLe','test','api','225GwObKD','\x20个数据集,生成\x20','API\x20配置拉取异常:\x20','create-api-pull','46616bUlmbc','\x20个数据集...','API\x20配置拉取成功:\x20','online','cwd','1552674NLqpuZ','×\x20API\x20配置拉取异常:','length','1811942LewsKF','.ts\x20-\x20模型配置文件','-api','*\x20开始生成\x20API\x20配置文件:','string','message','4AHiflt','*\x20正在处理\x20','1232785OobgFj','chdir','trim','25038ywaRNn','2zTHChw','63633QdBMra','-client','error'];a9_0x5967=function(){return _0x27d453;};return a9_0x5967();}import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a9_0x15f0(_0x2fb817,_0xa20fa5){_0x2fb817=_0x2fb817-0x191;const _0x596750=a9_0x5967();let _0x15f036=_0x596750[_0x2fb817];return _0x15f036;}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x412873,_0x57d286,_0x39da49,_0x3d49c3){const _0x1641bb=a9_0x15f0;let _0x3d930f;try{const _0x1ab3e8=_0x57d286?.[_0x1641bb(0x191)]()||'';if(_0x1ab3e8){const _0x190e69=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x190e69[_0x1641bb(0x19e)](_0x1ab3e8))return console['error']('×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。'),![];}_0x39da49&&(_0x3d930f=process[_0x1641bb(0x1a8)](),process['chdir'](_0x39da49));const _0x549cdb=readConfig(),_0x589583=typeof _0x549cdb['env']===_0x1641bb(0x1b0)?_0x549cdb['env']:undefined,_0x4d9eb5=_0x3d49c3||_0x589583||_0x1641bb(0x1a7);initEnv(_0x4d9eb5),console['log']('*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20'+_0x4d9eb5+')');const {configArray:_0x5f1849}=await fetchModelList(_0x412873),_0x420c9c=_0x1ab3e8?_0x1ab3e8+_0x1641bb(0x1ae):_0x1641bb(0x19f),_0x5beb9d=_0x1ab3e8?_0x1ab3e8+_0x1641bb(0x195):_0x1641bb(0x198);console[_0x1641bb(0x199)](_0x1641bb(0x1af)),console[_0x1641bb(0x199)]('\x20\x20\x20•\x20'+_0x420c9c+_0x1641bb(0x1ad)),console[_0x1641bb(0x199)]('\x20\x20\x20•\x20'+_0x5beb9d+_0x1641bb(0x19b)),console[_0x1641bb(0x199)](_0x1641bb(0x1b3)+_0x5f1849[_0x1641bb(0x1ab)]+_0x1641bb(0x1a5));const _0x59f24b=await generateApiFile(_0x5f1849,_0x1ab3e8,_0x412873,!![],_0x4d9eb5);return console['log'](_0x1641bb(0x19a)+_0x5f1849[_0x1641bb(0x1ab)]+_0x1641bb(0x1a1)+_0x59f24b['modelCount']+'\x20个模型'),_0x39da49&&logger['info'](_0x1641bb(0x1a3),_0x1641bb(0x1a6)+_0x412873,{'projectPath':_0x39da49,'appCode':_0x412873,'datasetCount':_0x5f1849[_0x1641bb(0x1ab)],'filePrefix':_0x1ab3e8}),!![];}catch(_0x12277f){const _0x11229d=_0x12277f instanceof Error?_0x12277f[_0x1641bb(0x1b1)]:String(_0x12277f);return console[_0x1641bb(0x196)](_0x1641bb(0x1aa),_0x11229d),_0x39da49&&logger[_0x1641bb(0x196)]('create-api-pull',_0x1641bb(0x1a2)+_0x11229d,{'appCode':_0x412873,'projectPath':_0x39da49}),![];}finally{_0x3d930f&&process[_0x1641bb(0x1b5)](_0x3d930f);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x256ad8,_0x422855){const _0x461ae1=a10_0x2f18,_0x39c0e5=_0x256ad8();while(!![]){try{const _0x494cca=parseInt(_0x461ae1(0x122))/0x1+parseInt(_0x461ae1(0x13e))/0x2*(parseInt(_0x461ae1(0x139))/0x3)+parseInt(_0x461ae1(0x147))/0x4*(parseInt(_0x461ae1(0x10c))/0x5)+parseInt(_0x461ae1(0x107))/0x6+-parseInt(_0x461ae1(0x106))/0x7+-parseInt(_0x461ae1(0x10b))/0x8+parseInt(_0x461ae1(0x111))/0x9*(parseInt(_0x461ae1(0x12d))/0xa);if(_0x494cca===_0x422855)break;else _0x39c0e5['push'](_0x39c0e5['shift']());}catch(_0x167bf3){_0x39c0e5['push'](_0x39c0e5['shift']());}}}(a10_0x4cc7,0x9f518));import{jsx as a10_0x185bf1,jsxs as a10_0x16ebf0,Fragment as a10_0x14fa26}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';function a10_0x4cc7(){const _0x372cbc=['↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认','cyan','请输入有效的\x20JS\x20https\x20链接','lovrabet\x20auth','length','max','return','441124DZdqbT','delete','\x20←\x20','5269208MwPKDF','4311432Hwertj','*\x20正在创建菜单...','已选择菜单','green','3295680nrfpGR','15FtAbQT','online','message','has','*\x20CSS\x20链接:\x20','9hcYdHO','includes','done','path','creating','CSS\x20链接无法访问','test','dots','*\x20请选择要同步的菜单:','\x20正在获取线上菜单列表...','JS\x20链接无法访问','Lovrabet平台','yellow','创建菜单失败','gray','red','slice','684588doGqxf','filter','map','fill','add','input-css','trim','\x20输入项目的\x20JS\x20资源链接(https://...)','size','backspace','local','91190LjeneQ','downArrow','JS\x20链接','column','then','√\x20菜单创建完成','提示:使用\x20','菜单名称','white','value','[✓]','!\x20未找到本地页面,请先创建页面','22245JXzsSp','*\x20JS\x20链接:\x20','input-js','label','join','20cwlGGE','selecting'];a10_0x4cc7=function(){return _0x372cbc;};return a10_0x4cc7();}import{useEffect,useState}from'react';import a10_0x33f11e from'ink-spinner';import{useGetOnlineMenuList}from'./use-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';function a10_0x2f18(_0x3135ab,_0xeda0f8){_0x3135ab=_0x3135ab-0x106;const _0x4cc7e2=a10_0x4cc7();let _0x2f18c6=_0x4cc7e2[_0x3135ab];return _0x2f18c6;}import.meta.main&&render(a10_0x185bf1(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x246484=a10_0x2f18,{exit:_0x33b01d}=useApp(),{loading:_0x238458,menuList:_0x62bbfb,error:_0x33bae4}=useGetOnlineMenuList(),_0x4049bd=getLocalPages(),_0x1b175e=_0x62bbfb[_0x246484(0x124)](_0x567bfa=>_0x567bfa[_0x246484(0x114)]),_0x53f6f6=[_0x246484(0x134),..._0x4049bd['map'](_0x2d4bc9=>_0x2d4bc9['label'])],_0x214302=getStringWidth(getMaxWidth(_0x53f6f6,0x4)),_0x4623a2=getStringWidth(getMaxWidth([_0x246484(0x134)])),[_0xa9c231,_0x571736]=useState(_0x246484(0x13f)),[_0x476427,_0xe90cfd]=useState(new Set()),[_0x18baea,_0x3bbbdb]=useState(0x0),[_0x58d1e5,_0xee5f1a]=useState(''),[_0x12f2a4,_0x4687c5]=useState(''),[_0x1d41d9,_0x44ccb9]=useState(''),[_0x3b1757,_0x1d05ce]=useState(''),[_0x4032e5,_0xecbcbe]=useState([]),_0x543e3b=_0x4049bd[_0x246484(0x124)](_0x585c08=>({'label':_0x585c08['label'],'path':_0x585c08[_0x246484(0x114)],'local':!![],'online':_0x1b175e[_0x246484(0x112)](_0x585c08[_0x246484(0x114)])})),_0x59f467=_0x4049bd['filter'](_0x360c49=>{const _0x127226=_0x246484;return!_0x1b175e[_0x127226(0x112)](_0x360c49[_0x127226(0x114)]);});useEffect(()=>{const _0x44577b=_0x246484;if(!_0x238458&&_0x4049bd[_0x44577b(0x144)]>0x0&&_0x476427['size']===0x0){const _0x4b44f5=new Set(_0x4049bd['map']((_0x4b3734,_0x54a6db)=>({'page':_0x4b3734,'index':_0x54a6db}))[_0x44577b(0x123)](({page:_0x333db2})=>!_0x1b175e[_0x44577b(0x112)](_0x333db2[_0x44577b(0x114)]))[_0x44577b(0x124)](({index:_0x55ae5a})=>_0x55ae5a));_0xe90cfd(_0x4b44f5);}},[_0x238458,_0x4049bd['length'],_0x1b175e[_0x246484(0x144)]]),useInput(async(_0x36861b,_0x1c4d1d)=>{const _0x3ae3ee=_0x246484;if(_0xa9c231==='selecting'){if(_0x1c4d1d['upArrow']){_0x3bbbdb(_0x1be7ce=>_0x1be7ce>0x0?_0x1be7ce-0x1:_0x4049bd[_0x3ae3ee(0x144)]-0x1);return;}if(_0x1c4d1d[_0x3ae3ee(0x12e)]){_0x3bbbdb(_0x41aa5a=>_0x41aa5a<_0x4049bd[_0x3ae3ee(0x144)]-0x1?_0x41aa5a+0x1:0x0);return;}if(_0x36861b==='\x20'){_0xe90cfd(_0x56ddf3=>{const _0x15a279=_0x3ae3ee,_0x11f94a=new Set(_0x56ddf3);return _0x11f94a[_0x15a279(0x10f)](_0x18baea)?_0x11f94a['delete'](_0x18baea):_0x11f94a[_0x15a279(0x126)](_0x18baea),_0x11f94a;});return;}if(_0x36861b==='a'||_0x36861b==='A'){const _0x20822e=new Set(_0x4049bd['map']((_0x5bbcee,_0x478ccb)=>_0x478ccb));_0xe90cfd(_0x20822e);return;}if(_0x36861b==='i'||_0x36861b==='I'||_0x36861b==='r'||_0x36861b==='R'){_0xe90cfd(_0x35275f=>{const _0x5f4808=_0x3ae3ee,_0x249a7b=new Set();for(let _0x5e7311=0x0;_0x5e7311<_0x4049bd['length'];_0x5e7311++){!_0x35275f[_0x5f4808(0x10f)](_0x5e7311)&&_0x249a7b[_0x5f4808(0x126)](_0x5e7311);}return _0x249a7b;});return;}if(_0x36861b==='q'||_0x36861b==='Q'){_0x33b01d();return;}if(_0x1c4d1d['return']){if(_0x476427[_0x3ae3ee(0x12a)]===0x0){_0x1d05ce('请至少选择一个菜单');return;}const _0x5c9276=_0x4049bd['filter']((_0xa555d4,_0x5a2c56)=>_0x476427[_0x3ae3ee(0x10f)](_0x5a2c56)),_0xf6b21e=_0x5c9276[_0x3ae3ee(0x124)](_0x527842=>_0x527842[_0x3ae3ee(0x13c)])['join'](',\x20');_0xecbcbe([{'label':_0x3ae3ee(0x109),'value':_0x476427[_0x3ae3ee(0x12a)]+'\x20个'}]),_0x1d05ce(''),_0x571736(_0x3ae3ee(0x13b));return;}return;}if(_0xa9c231==='input-js'){if(_0x1c4d1d[_0x3ae3ee(0x146)]){const _0x24dab8=_0x1d41d9[_0x3ae3ee(0x128)]();if(_0x24dab8==='')return;if(!isValidJsHttpsUrl(_0x24dab8)){_0x1d05ce(_0x3ae3ee(0x142));return;}if(!await isUrlReachable(_0x24dab8)){_0x1d05ce(_0x3ae3ee(0x11b));return;}_0xee5f1a(_0x24dab8),_0xecbcbe(_0x301d45=>[..._0x301d45,{'label':_0x3ae3ee(0x12f),'value':_0x24dab8}]),_0x44ccb9(''),_0x1d05ce(''),_0x571736(_0x3ae3ee(0x127));return;}if(_0x1c4d1d['backspace']||_0x1c4d1d[_0x3ae3ee(0x148)]){_0x44ccb9(_0x2bf9db=>_0x2bf9db[_0x3ae3ee(0x121)](0x0,-0x1)),_0x1d05ce('');return;}_0x44ccb9(_0x17bf19=>_0x17bf19+_0x36861b);return;}if(_0xa9c231===_0x3ae3ee(0x127)){if(_0x1c4d1d[_0x3ae3ee(0x146)]){const _0xc88b82=_0x1d41d9[_0x3ae3ee(0x128)]();if(_0xc88b82==='')return;if(!isValidCssHttpsUrl(_0xc88b82)){_0x1d05ce('请输入有效的\x20CSS\x20https\x20链接');return;}if(!await isUrlReachable(_0xc88b82)){_0x1d05ce(_0x3ae3ee(0x116));return;}_0x4687c5(_0xc88b82),_0xecbcbe(_0x448844=>[..._0x448844,{'label':'CSS\x20链接','value':_0xc88b82}]),_0x44ccb9(''),_0x1d05ce(''),_0x571736(_0x3ae3ee(0x115));const _0x32ab84=_0x4049bd[_0x3ae3ee(0x123)]((_0x1328b3,_0x5c33c8)=>_0x476427['has'](_0x5c33c8));createMenus(_0x32ab84,[_0x58d1e5,_0xc88b82])[_0x3ae3ee(0x131)](()=>{_0x571736('done'),setTimeout(()=>{_0x33b01d();},0x3e8);})['catch'](_0x2d4b73=>{const _0x569bc3=_0x3ae3ee;_0x1d05ce(_0x2d4b73[_0x569bc3(0x10e)]||_0x569bc3(0x11e)),_0x571736(_0x569bc3(0x13f));});return;}if(_0x1c4d1d[_0x3ae3ee(0x12b)]||_0x1c4d1d[_0x3ae3ee(0x148)]){_0x44ccb9(_0xd4a20c=>_0xd4a20c[_0x3ae3ee(0x121)](0x0,-0x1)),_0x1d05ce('');return;}_0x44ccb9(_0x4e1eae=>_0x4e1eae+_0x36861b);return;}});if(_0x238458)return a10_0x16ebf0(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x185bf1(Text,{'children':'\x20\x20'}),a10_0x185bf1(a10_0x33f11e,{'type':_0x246484(0x118)}),a10_0x185bf1(Text,{'children':_0x246484(0x11a)})]});if(_0x33bae4)return a10_0x16ebf0(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[a10_0x16ebf0(Text,{'color':'red','children':['✗\x20',_0x33bae4]}),a10_0x16ebf0(Box,{'marginTop':0x1,'children':[a10_0x185bf1(Text,{'color':'gray','children':_0x246484(0x133)}),a10_0x185bf1(Text,{'color':_0x246484(0x141),'children':_0x246484(0x143)}),a10_0x185bf1(Text,{'color':'gray','children':'\x20命令重新登录'})]})]});if(_0x4049bd[_0x246484(0x144)]===0x0)return a10_0x185bf1(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x185bf1(Text,{'color':_0x246484(0x11d),'children':_0x246484(0x138)})});return a10_0x16ebf0(Box,{'flexDirection':_0x246484(0x130),'marginTop':0x1,'marginBottom':0x1,'children':[_0xa9c231==='selecting'&&a10_0x16ebf0(a10_0x14fa26,{'children':[a10_0x16ebf0(Box,{'children':[a10_0x16ebf0(Text,{'bold':!![],'children':['\x20\x20',_0x246484(0x134),getRemainingSpaces(_0x214302,_0x246484(0x134))]}),a10_0x16ebf0(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x4623a2,_0x246484(0x134))]}),a10_0x16ebf0(Text,{'bold':!![],'children':[_0x246484(0x11c),getRemainingSpaces(_0x4623a2,'菜单名称')]})]}),_0x543e3b[_0x246484(0x124)](_0x256daf=>a10_0x16ebf0(Box,{'children':[a10_0x16ebf0(Text,{'children':['\x20\x20',_0x256daf[_0x246484(0x13c)],getRemainingSpaces(_0x214302,_0x256daf[_0x246484(0x13c)])]}),a10_0x16ebf0(Text,{'color':_0x246484(0x10a),'children':[_0x256daf[_0x246484(0x12c)]?'✓':'✗',getRemainingSpaces(_0x4623a2,'✓')]}),a10_0x16ebf0(Text,{'color':_0x256daf[_0x246484(0x10d)]?'green':'red','children':[_0x256daf[_0x246484(0x10d)]?'✓':'✗',getRemainingSpaces(_0x4623a2,'✓')]})]},_0x256daf[_0x246484(0x114)]))]}),_0xa9c231===_0x246484(0x13f)&&_0x4032e5['length']===0x0&&a10_0x185bf1(Box,{'marginTop':0x1,'children':a10_0x185bf1(Text,{'color':_0x246484(0x141),'children':'*\x20同步菜单到\x20Lovrabet\x20平台'})}),_0x4032e5[_0x246484(0x124)]((_0x16b71e,_0x2e268c)=>a10_0x16ebf0(Box,{'children':[a10_0x16ebf0(Text,{'color':_0x246484(0x10a),'children':['√\x20',_0x16b71e[_0x246484(0x13c)],':\x20']}),a10_0x185bf1(Text,{'color':'cyan','children':_0x16b71e[_0x246484(0x136)]})]},_0x2e268c)),_0x3b1757&&_0xa9c231===_0x246484(0x13f)&&a10_0x185bf1(Box,{'marginTop':0x1,'children':a10_0x16ebf0(Text,{'color':_0x246484(0x120),'children':['✗\x20',_0x3b1757]})}),_0xa9c231===_0x246484(0x13f)&&a10_0x185bf1(a10_0x14fa26,{'children':a10_0x16ebf0(Box,{'marginTop':_0x4032e5[_0x246484(0x144)]>0x0||_0x3b1757?0x1:0x0,'flexDirection':_0x246484(0x130),'children':[a10_0x185bf1(Text,{'bold':!![],'children':_0x246484(0x119)}),_0x4049bd[_0x246484(0x124)]((_0x1b485c,_0x2bff7b)=>{const _0x49a71a=_0x246484,_0x18fa1a=_0x18baea===_0x2bff7b,_0x1ee33e=_0x476427[_0x49a71a(0x10f)](_0x2bff7b),_0x3f0704=_0x1b175e['includes'](_0x1b485c[_0x49a71a(0x114)]),_0x3a5f63=_0x3f0704?'更新':'新建';return a10_0x185bf1(Box,{'children':a10_0x16ebf0(Text,{'backgroundColor':_0x18fa1a?'blue':undefined,'color':_0x18fa1a?_0x49a71a(0x135):undefined,'children':['\x20\x20',_0x1ee33e?_0x49a71a(0x137):'[\x20]','\x20',_0x1b485c[_0x49a71a(0x13c)]]})},_0x1b485c['path']);}),a10_0x185bf1(Box,{'marginTop':0x1,'children':a10_0x16ebf0(Text,{'color':'gray','children':['\x20',_0x246484(0x140)]})})]})}),_0xa9c231==='input-js'&&a10_0x16ebf0(a10_0x14fa26,{'children':[a10_0x16ebf0(Box,{'children':[a10_0x185bf1(Text,{'children':_0x246484(0x13a)}),a10_0x185bf1(Text,{'color':_0x246484(0x10a),'children':_0x1d41d9}),_0x3b1757&&a10_0x16ebf0(Text,{'color':_0x246484(0x120),'children':['\x20←\x20',_0x3b1757]})]}),!_0x3b1757&&a10_0x185bf1(Box,{'children':a10_0x185bf1(Text,{'color':'gray','children':_0x246484(0x129)})})]}),_0xa9c231===_0x246484(0x127)&&a10_0x16ebf0(a10_0x14fa26,{'children':[a10_0x16ebf0(Box,{'children':[a10_0x185bf1(Text,{'children':_0x246484(0x110)}),a10_0x185bf1(Text,{'color':'green','children':_0x1d41d9}),_0x3b1757&&a10_0x16ebf0(Text,{'color':'red','children':[_0x246484(0x149),_0x3b1757]})]}),!_0x3b1757&&a10_0x185bf1(Box,{'children':a10_0x185bf1(Text,{'color':_0x246484(0x11f),'children':'\x20输入项目的\x20CSS\x20资源链接(https://...)'})})]}),_0xa9c231===_0x246484(0x115)&&a10_0x185bf1(Box,{'children':a10_0x185bf1(Text,{'children':_0x246484(0x108)})}),_0xa9c231===_0x246484(0x113)&&a10_0x185bf1(Box,{'children':a10_0x185bf1(Text,{'color':_0x246484(0x10a),'children':_0x246484(0x132)})})]});}function getStringWidth(_0x48f28b){const _0x4a9e7b=a10_0x2f18;let _0x459e11=0x0;for(const _0x299bdb of _0x48f28b){/[\u4e00-\u9fa5]/[_0x4a9e7b(0x117)](_0x299bdb)?_0x459e11+=0x2:_0x459e11+=0x1;}return _0x459e11;}function getRemainingSpaces(_0x8280cc,_0x3ac2bc){const _0x15c772=a10_0x2f18,_0x332e00=getStringWidth(_0x3ac2bc);return Array(Math[_0x15c772(0x145)](0x0,_0x8280cc-_0x332e00))[_0x15c772(0x125)]('\x20')[_0x15c772(0x13d)]('');}function getMaxWidth(_0x56eacb,_0x28fc38=0x2){let _0x34f5f8='',_0x15c079=0x0;for(const _0x3b2fff of _0x56eacb){const _0xe25bea=getStringWidth(_0x3b2fff);_0xe25bea>_0x15c079&&(_0x15c079=_0xe25bea,_0x34f5f8=_0x3b2fff);}return _0x34f5f8+'\x20'['repeat'](_0x28fc38);}
|
|
1
|
+
(function(_0x5d1405,_0x2e6e93){const _0x542a83=a10_0x5b0c,_0x41ee4b=_0x5d1405();while(!![]){try{const _0x39aaa1=-parseInt(_0x542a83(0x12b))/0x1+parseInt(_0x542a83(0x100))/0x2+parseInt(_0x542a83(0x10a))/0x3*(-parseInt(_0x542a83(0x11d))/0x4)+parseInt(_0x542a83(0x127))/0x5+-parseInt(_0x542a83(0xfd))/0x6*(-parseInt(_0x542a83(0x10c))/0x7)+parseInt(_0x542a83(0x114))/0x8+-parseInt(_0x542a83(0x123))/0x9*(parseInt(_0x542a83(0x103))/0xa);if(_0x39aaa1===_0x2e6e93)break;else _0x41ee4b['push'](_0x41ee4b['shift']());}catch(_0x264399){_0x41ee4b['push'](_0x41ee4b['shift']());}}}(a10_0x3cea,0x73d60));function a10_0x5b0c(_0x2a5688,_0x341429){_0x2a5688=_0x2a5688-0xf5;const _0x3cead5=a10_0x3cea();let _0x5b0cfa=_0x3cead5[_0x2a5688];return _0x5b0cfa;}import{jsx as a10_0x5df6e8,jsxs as a10_0x39a81a,Fragment as a10_0x3f6da1}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';function a10_0x3cea(){const _0x2d2cc3=['upArrow','JS\x20链接','创建菜单失败','\x20正在获取线上菜单列表...','!\x20未找到本地页面,请先创建页面','length','6UIGqON','repeat','message','950590scSPnE','backspace','请至少选择一个菜单','1710bPizQf','map','slice','value','blue','test','online','48gBpxxI','green','1889041jxAoUZ','join','gray','size','creating','includes','add','\x20命令重新登录','1404504eSBkJy','\x20输入项目的\x20CSS\x20资源链接(https://...)','\x20←\x20','column','\x20输入项目的\x20JS\x20资源链接(https://...)','lovrabet\x20auth','delete','red','return','180392xHpKtB','has','[\x20]','local','dots','*\x20请选择要同步的菜单:','4905KpCJBv','cyan','[✓]','done','4292350wRyClc','*\x20JS\x20链接:\x20','fill','请输入有效的\x20CSS\x20https\x20链接','489964WclCis','input-css','CSS\x20链接无法访问','white','JS\x20链接无法访问','selecting','菜单名称','label','filter','提示:使用\x20','请输入有效的\x20JS\x20https\x20链接','已选择菜单','√\x20菜单创建完成','input-js','Lovrabet平台','*\x20CSS\x20链接:\x20','path','catch'];a10_0x3cea=function(){return _0x2d2cc3;};return a10_0x3cea();}import{useEffect,useState}from'react';import a10_0x3f131a from'ink-spinner';import{useGetOnlineMenuList}from'./use-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.main&&render(a10_0x5df6e8(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x3fbf76=a10_0x5b0c,{exit:_0x1d1691}=useApp(),{loading:_0x27e79e,menuList:_0x2e03db,error:_0xd2f2d9}=useGetOnlineMenuList(),_0x41f651=getLocalPages(),_0x48c8bd=_0x2e03db[_0x3fbf76(0x104)](_0x5bed92=>_0x5bed92['path']),_0x5e3492=[_0x3fbf76(0x131),..._0x41f651['map'](_0x3f6a54=>_0x3f6a54[_0x3fbf76(0x132)])],_0x495196=getStringWidth(getMaxWidth(_0x5e3492,0x4)),_0x120c27=getStringWidth(getMaxWidth([_0x3fbf76(0x131)])),[_0x53c0de,_0x332fd8]=useState(_0x3fbf76(0x130)),[_0x130f9c,_0x5b83db]=useState(new Set()),[_0x1c0452,_0x38e8ef]=useState(0x0),[_0xdd25b3,_0x3b2731]=useState(''),[_0x57ea20,_0x13aec8]=useState(''),[_0x1cb673,_0x4b6af3]=useState(''),[_0x4c8ba3,_0x23352a]=useState(''),[_0x59f30c,_0x4cdf0f]=useState([]),_0xaf2dd0=_0x41f651['map'](_0x104432=>({'label':_0x104432[_0x3fbf76(0x132)],'path':_0x104432[_0x3fbf76(0xf5)],'local':!![],'online':_0x48c8bd[_0x3fbf76(0x111)](_0x104432[_0x3fbf76(0xf5)])})),_0x349d9a=_0x41f651[_0x3fbf76(0x133)](_0x2dbd2e=>{const _0xf87482=_0x3fbf76;return!_0x48c8bd[_0xf87482(0x111)](_0x2dbd2e[_0xf87482(0xf5)]);});useEffect(()=>{const _0x37bda0=_0x3fbf76;if(!_0x27e79e&&_0x41f651['length']>0x0&&_0x130f9c['size']===0x0){const _0x71e749=new Set(_0x41f651[_0x37bda0(0x104)]((_0x44baa7,_0x3a5cc1)=>({'page':_0x44baa7,'index':_0x3a5cc1}))['filter'](({page:_0x1b1e5a})=>!_0x48c8bd[_0x37bda0(0x111)](_0x1b1e5a['path']))['map'](({index:_0x36e25c})=>_0x36e25c));_0x5b83db(_0x71e749);}},[_0x27e79e,_0x41f651[_0x3fbf76(0xfc)],_0x48c8bd[_0x3fbf76(0xfc)]]),useInput(async(_0x5b1500,_0x3a3114)=>{const _0xbefae4=_0x3fbf76;if(_0x53c0de===_0xbefae4(0x130)){if(_0x3a3114[_0xbefae4(0xf7)]){_0x38e8ef(_0x466a2c=>_0x466a2c>0x0?_0x466a2c-0x1:_0x41f651[_0xbefae4(0xfc)]-0x1);return;}if(_0x3a3114['downArrow']){_0x38e8ef(_0x53910a=>_0x53910a<_0x41f651[_0xbefae4(0xfc)]-0x1?_0x53910a+0x1:0x0);return;}if(_0x5b1500==='\x20'){_0x5b83db(_0x498cb2=>{const _0x4716d3=_0xbefae4,_0x11b214=new Set(_0x498cb2);return _0x11b214[_0x4716d3(0x11e)](_0x1c0452)?_0x11b214[_0x4716d3(0x11a)](_0x1c0452):_0x11b214[_0x4716d3(0x112)](_0x1c0452),_0x11b214;});return;}if(_0x5b1500==='a'||_0x5b1500==='A'){const _0x357125=new Set(_0x41f651['map']((_0x5eb9ed,_0xbb628e)=>_0xbb628e));_0x5b83db(_0x357125);return;}if(_0x5b1500==='i'||_0x5b1500==='I'||_0x5b1500==='r'||_0x5b1500==='R'){_0x5b83db(_0x23dbbb=>{const _0x27c2e2=_0xbefae4,_0x3ad13c=new Set();for(let _0x36039a=0x0;_0x36039a<_0x41f651[_0x27c2e2(0xfc)];_0x36039a++){!_0x23dbbb[_0x27c2e2(0x11e)](_0x36039a)&&_0x3ad13c['add'](_0x36039a);}return _0x3ad13c;});return;}if(_0x5b1500==='q'||_0x5b1500==='Q'){_0x1d1691();return;}if(_0x3a3114['return']){if(_0x130f9c[_0xbefae4(0x10f)]===0x0){_0x23352a(_0xbefae4(0x102));return;}const _0x4f8562=_0x41f651['filter']((_0x3fc7cc,_0x1d8e06)=>_0x130f9c[_0xbefae4(0x11e)](_0x1d8e06)),_0x36f7a1=_0x4f8562[_0xbefae4(0x104)](_0x35a520=>_0x35a520[_0xbefae4(0x132)])[_0xbefae4(0x10d)](',\x20');_0x4cdf0f([{'label':_0xbefae4(0x136),'value':_0x130f9c['size']+'\x20个'}]),_0x23352a(''),_0x332fd8(_0xbefae4(0x138));return;}return;}if(_0x53c0de===_0xbefae4(0x138)){if(_0x3a3114[_0xbefae4(0x11c)]){const _0x45c987=_0x1cb673['trim']();if(_0x45c987==='')return;if(!isValidJsHttpsUrl(_0x45c987)){_0x23352a(_0xbefae4(0x135));return;}if(!await isUrlReachable(_0x45c987)){_0x23352a(_0xbefae4(0x12f));return;}_0x3b2731(_0x45c987),_0x4cdf0f(_0x1f1df3=>[..._0x1f1df3,{'label':_0xbefae4(0xf8),'value':_0x45c987}]),_0x4b6af3(''),_0x23352a(''),_0x332fd8('input-css');return;}if(_0x3a3114[_0xbefae4(0x101)]||_0x3a3114[_0xbefae4(0x11a)]){_0x4b6af3(_0x4a374a=>_0x4a374a['slice'](0x0,-0x1)),_0x23352a('');return;}_0x4b6af3(_0x19ae75=>_0x19ae75+_0x5b1500);return;}if(_0x53c0de==='input-css'){if(_0x3a3114[_0xbefae4(0x11c)]){const _0x38f2b0=_0x1cb673['trim']();if(_0x38f2b0==='')return;if(!isValidCssHttpsUrl(_0x38f2b0)){_0x23352a(_0xbefae4(0x12a));return;}if(!await isUrlReachable(_0x38f2b0)){_0x23352a(_0xbefae4(0x12d));return;}_0x13aec8(_0x38f2b0),_0x4cdf0f(_0x17f60b=>[..._0x17f60b,{'label':'CSS\x20链接','value':_0x38f2b0}]),_0x4b6af3(''),_0x23352a(''),_0x332fd8(_0xbefae4(0x110));const _0x314c21=_0x41f651[_0xbefae4(0x133)]((_0x386ef7,_0x1071e2)=>_0x130f9c[_0xbefae4(0x11e)](_0x1071e2));createMenus(_0x314c21,[_0xdd25b3,_0x38f2b0])['then'](()=>{_0x332fd8('done'),setTimeout(()=>{_0x1d1691();},0x3e8);})[_0xbefae4(0xf6)](_0x3a80f0=>{const _0x445a21=_0xbefae4;_0x23352a(_0x3a80f0[_0x445a21(0xff)]||_0x445a21(0xf9)),_0x332fd8('selecting');});return;}if(_0x3a3114[_0xbefae4(0x101)]||_0x3a3114[_0xbefae4(0x11a)]){_0x4b6af3(_0x1e42f4=>_0x1e42f4[_0xbefae4(0x105)](0x0,-0x1)),_0x23352a('');return;}_0x4b6af3(_0xae5352=>_0xae5352+_0x5b1500);return;}});if(_0x27e79e)return a10_0x39a81a(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x5df6e8(Text,{'children':'\x20\x20'}),a10_0x5df6e8(a10_0x3f131a,{'type':_0x3fbf76(0x121)}),a10_0x5df6e8(Text,{'children':_0x3fbf76(0xfa)})]});if(_0xd2f2d9)return a10_0x39a81a(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[a10_0x39a81a(Text,{'color':'red','children':['✗\x20',_0xd2f2d9]}),a10_0x39a81a(Box,{'marginTop':0x1,'children':[a10_0x5df6e8(Text,{'color':_0x3fbf76(0x10e),'children':_0x3fbf76(0x134)}),a10_0x5df6e8(Text,{'color':_0x3fbf76(0x124),'children':_0x3fbf76(0x119)}),a10_0x5df6e8(Text,{'color':_0x3fbf76(0x10e),'children':_0x3fbf76(0x113)})]})]});if(_0x41f651[_0x3fbf76(0xfc)]===0x0)return a10_0x5df6e8(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x5df6e8(Text,{'color':'yellow','children':_0x3fbf76(0xfb)})});return a10_0x39a81a(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[_0x53c0de===_0x3fbf76(0x130)&&a10_0x39a81a(a10_0x3f6da1,{'children':[a10_0x39a81a(Box,{'children':[a10_0x39a81a(Text,{'bold':!![],'children':['\x20\x20',_0x3fbf76(0x131),getRemainingSpaces(_0x495196,_0x3fbf76(0x131))]}),a10_0x39a81a(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x120c27,_0x3fbf76(0x131))]}),a10_0x39a81a(Text,{'bold':!![],'children':[_0x3fbf76(0x139),getRemainingSpaces(_0x120c27,'菜单名称')]})]}),_0xaf2dd0[_0x3fbf76(0x104)](_0x3233f6=>a10_0x39a81a(Box,{'children':[a10_0x39a81a(Text,{'children':['\x20\x20',_0x3233f6[_0x3fbf76(0x132)],getRemainingSpaces(_0x495196,_0x3233f6[_0x3fbf76(0x132)])]}),a10_0x39a81a(Text,{'color':'green','children':[_0x3233f6[_0x3fbf76(0x120)]?'✓':'✗',getRemainingSpaces(_0x120c27,'✓')]}),a10_0x39a81a(Text,{'color':_0x3233f6[_0x3fbf76(0x109)]?_0x3fbf76(0x10b):'red','children':[_0x3233f6['online']?'✓':'✗',getRemainingSpaces(_0x120c27,'✓')]})]},_0x3233f6[_0x3fbf76(0xf5)]))]}),_0x53c0de==='selecting'&&_0x59f30c['length']===0x0&&a10_0x5df6e8(Box,{'marginTop':0x1,'children':a10_0x5df6e8(Text,{'color':'cyan','children':'*\x20同步菜单到\x20Lovrabet\x20平台'})}),_0x59f30c['map']((_0x4381da,_0x50d68c)=>a10_0x39a81a(Box,{'children':[a10_0x39a81a(Text,{'color':_0x3fbf76(0x10b),'children':['√\x20',_0x4381da['label'],':\x20']}),a10_0x5df6e8(Text,{'color':_0x3fbf76(0x124),'children':_0x4381da[_0x3fbf76(0x106)]})]},_0x50d68c)),_0x4c8ba3&&_0x53c0de===_0x3fbf76(0x130)&&a10_0x5df6e8(Box,{'marginTop':0x1,'children':a10_0x39a81a(Text,{'color':_0x3fbf76(0x11b),'children':['✗\x20',_0x4c8ba3]})}),_0x53c0de===_0x3fbf76(0x130)&&a10_0x5df6e8(a10_0x3f6da1,{'children':a10_0x39a81a(Box,{'marginTop':_0x59f30c[_0x3fbf76(0xfc)]>0x0||_0x4c8ba3?0x1:0x0,'flexDirection':_0x3fbf76(0x117),'children':[a10_0x5df6e8(Text,{'bold':!![],'children':_0x3fbf76(0x122)}),_0x41f651['map']((_0x257b8b,_0x41e140)=>{const _0x4c9e96=_0x3fbf76,_0x1f2333=_0x1c0452===_0x41e140,_0x4c3c14=_0x130f9c[_0x4c9e96(0x11e)](_0x41e140),_0x5e5185=_0x48c8bd[_0x4c9e96(0x111)](_0x257b8b[_0x4c9e96(0xf5)]),_0x106d46=_0x5e5185?'更新':'新建';return a10_0x5df6e8(Box,{'children':a10_0x39a81a(Text,{'backgroundColor':_0x1f2333?_0x4c9e96(0x107):undefined,'color':_0x1f2333?_0x4c9e96(0x12e):undefined,'children':['\x20\x20',_0x4c3c14?_0x4c9e96(0x125):_0x4c9e96(0x11f),'\x20',_0x257b8b[_0x4c9e96(0x132)]]})},_0x257b8b['path']);}),a10_0x5df6e8(Box,{'marginTop':0x1,'children':a10_0x39a81a(Text,{'color':'gray','children':['\x20','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认']})})]})}),_0x53c0de==='input-js'&&a10_0x39a81a(a10_0x3f6da1,{'children':[a10_0x39a81a(Box,{'children':[a10_0x5df6e8(Text,{'children':_0x3fbf76(0x128)}),a10_0x5df6e8(Text,{'color':_0x3fbf76(0x10b),'children':_0x1cb673}),_0x4c8ba3&&a10_0x39a81a(Text,{'color':_0x3fbf76(0x11b),'children':[_0x3fbf76(0x116),_0x4c8ba3]})]}),!_0x4c8ba3&&a10_0x5df6e8(Box,{'children':a10_0x5df6e8(Text,{'color':'gray','children':_0x3fbf76(0x118)})})]}),_0x53c0de===_0x3fbf76(0x12c)&&a10_0x39a81a(a10_0x3f6da1,{'children':[a10_0x39a81a(Box,{'children':[a10_0x5df6e8(Text,{'children':_0x3fbf76(0x13a)}),a10_0x5df6e8(Text,{'color':_0x3fbf76(0x10b),'children':_0x1cb673}),_0x4c8ba3&&a10_0x39a81a(Text,{'color':_0x3fbf76(0x11b),'children':[_0x3fbf76(0x116),_0x4c8ba3]})]}),!_0x4c8ba3&&a10_0x5df6e8(Box,{'children':a10_0x5df6e8(Text,{'color':_0x3fbf76(0x10e),'children':_0x3fbf76(0x115)})})]}),_0x53c0de===_0x3fbf76(0x110)&&a10_0x5df6e8(Box,{'children':a10_0x5df6e8(Text,{'children':'*\x20正在创建菜单...'})}),_0x53c0de===_0x3fbf76(0x126)&&a10_0x5df6e8(Box,{'children':a10_0x5df6e8(Text,{'color':_0x3fbf76(0x10b),'children':_0x3fbf76(0x137)})})]});}function getStringWidth(_0x520f34){const _0x4c8805=a10_0x5b0c;let _0xf9b01e=0x0;for(const _0xbbaac8 of _0x520f34){/[\u4e00-\u9fa5]/[_0x4c8805(0x108)](_0xbbaac8)?_0xf9b01e+=0x2:_0xf9b01e+=0x1;}return _0xf9b01e;}function getRemainingSpaces(_0x1bde16,_0x49e0b6){const _0x4d407e=a10_0x5b0c,_0xdf1c5b=getStringWidth(_0x49e0b6);return Array(Math['max'](0x0,_0x1bde16-_0xdf1c5b))[_0x4d407e(0x129)]('\x20')[_0x4d407e(0x10d)]('');}function getMaxWidth(_0x36f5bf,_0x2c2022=0x2){const _0x168130=a10_0x5b0c;let _0x4fed8a='',_0x3f597a=0x0;for(const _0x589acd of _0x36f5bf){const _0x491e8f=getStringWidth(_0x589acd);_0x491e8f>_0x3f597a&&(_0x3f597a=_0x491e8f,_0x4fed8a=_0x589acd);}return _0x4fed8a+'\x20'[_0x168130(0xfe)](_0x2c2022);}
|