@lovrabet/rabetbase-cli 2.0.2-beta.1 → 2.0.2-beta.2
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/ai-setup/config.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-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/app-menu-update-cdn/update-menu-cdn-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-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api.js +1 -1
- package/lib/commands/app.js +1 -1
- package/lib/commands/auth.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/new.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/build.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/config.js +1 -1
- package/lib/commands/create.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/links.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/init.js +1 -1
- package/lib/commands/logout.js +1 -1
- package/lib/commands/logs.js +1 -1
- package/lib/commands/mcp.js +1 -1
- package/lib/commands/menu.js +1 -1
- package/lib/commands/preview.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run.js +1 -1
- package/lib/commands/skill.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/sql-validator.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/non-interactive.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/errors.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/McpInstallUI.js +1 -1
- package/lib/mcp/claude.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/mcp/mcp-install-non-interactive.js +1 -1
- package/lib/mcp/mcp-installer.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/ui/IDESelector.js +1 -1
- package/lib/ui/useIDESelection.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +2 -3
package/lib/ai-setup/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a0_0x19e3(){const _0x55e388=['1227514lYvQOU','appcode','6564hlZXSg','\x20\x20\x20\x20\x20\x20\x20\x20\x22RABETBASE_ENV\x22:\x20\x22','Cursor','98626uBJYNU','\x22:\x20{','Other','Configuration:','161632sSCjTB','4539725ygIOcO','49uqJLUg','success','stringify','\x20\x20\x20\x20\x20\x20\x20\x20\x22RABETBASE_APP_CODE\x22:\x20\x22','Appcode\x20must\x20be\x20configured\x20first','map','1ASHDNv','claude','join','\x20\x20AppCode:\x20','.cursor','utf-8','info','cursor','Unsupported\x20MCP\x20IDE:\x20','env','Claude\x20Code','mcp-install','8637546yfoyDr','Cursor\x20MCP\x20configuration\x20failed','object','\x20\x20\x20\x20}','Configuration\x20guide\x20displayed','\x20-e\x20RABETBASE_APP_CODE=','\x20\x20\x22mcpServers\x22:\x20{','manual','app','\x0a📋\x20Run\x20the\x20following\x20command\x20to\x20configure\x20Claude\x20Code\x20MCP:\x0a','230wlHbgR','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','claude\x20mcp\x20add\x20','51abaInj','\x0a📋\x20Other\x20IDE\x20MCP\x20configuration:\x0a','\x20\x20Environment:\x20','message','error','Please\x20run:\x20','cwd','production','\x20\x20\x20\x20\x20\x20}','379017bzMNan','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','Claude\x20Code\x20MCP\x20command\x20generated','Written\x20.cursor/mcp.json','\x20\x20}','lovrabet-dataset','RABETBASE_ENV','mcpServers','log','1549640ZHkzde','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','parse','Cursor\x20MCP\x20configured\x20successfully'];a0_0x19e3=function(){return _0x55e388;};return a0_0x19e3();}const a0_0x30e07b=a0_0x19f0;(function(_0x39b412,_0x25752e){const _0x50372c=a0_0x19f0,_0x21ea62=_0x39b412();while(!![]){try{const _0x3992e3=parseInt(_0x50372c(0x1f0))/0x1*(-parseInt(_0x50372c(0x1df))/0x2)+-parseInt(_0x50372c(0x1c9))/0x3*(parseInt(_0x50372c(0x1e8))/0x4)+parseInt(_0x50372c(0x1e9))/0x5+-parseInt(_0x50372c(0x1fc))/0x6+-parseInt(_0x50372c(0x1ea))/0x7*(parseInt(_0x50372c(0x1db))/0x8)+-parseInt(_0x50372c(0x1d2))/0x9*(parseInt(_0x50372c(0x206))/0xa)+-parseInt(_0x50372c(0x1e4))/0xb*(-parseInt(_0x50372c(0x1e1))/0xc);if(_0x3992e3===_0x25752e)break;else _0x21ea62['push'](_0x21ea62['shift']());}catch(_0x2cdf5b){_0x21ea62['push'](_0x21ea62['shift']());}}}(a0_0x19e3,0xb6809));import{existsSync,mkdirSync,writeFileSync,readFileSync}from'node:fs';import{join}from'node:path';function a0_0x19f0(_0x1f0550,_0xd1e646){_0x1f0550=_0x1f0550-0x1c8;const _0x19e3a6=a0_0x19e3();let _0x19f079=_0x19e3a6[_0x1f0550];return _0x19f079;}import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';import{copyRulesToAgentsMd,copyRulesToCursor}from'../utils/rules-cdn.js';import{normalizeEnv}from'../constant/env.js';const MCP_SERVER_NAME=a0_0x30e07b(0x1d7),MCP_COMMAND='npx',MCP_ARGS=['@lovrabet/dataset-mcp-server@latest'];export function buildEnvConfig(_0x5196bf,_0x24be2a){const _0x563024=a0_0x30e07b,_0x1ecd94={'RABETBASE_APP_CODE':String(_0x5196bf)};return _0x24be2a!==_0x563024(0x1d0)&&(_0x1ecd94[_0x563024(0x1d8)]=String(_0x24be2a)),_0x1ecd94;}export async function configureCursorMcp(_0x1bfd65){const _0x440bbf=a0_0x30e07b,_0x535ed8=_0x1bfd65||process[_0x440bbf(0x1cf)](),_0x36413d=readConfig(_0x535ed8),_0x15b030=_0x36413d[_0x440bbf(0x1e0)]||_0x36413d[_0x440bbf(0x204)],_0x5a747c=normalizeEnv(_0x36413d[_0x440bbf(0x1f9)]||'production');if(!_0x15b030)return{'ide':_0x440bbf(0x1e3),'status':'error','message':_0x440bbf(0x1ee)};const _0x201faa=buildEnvConfig(_0x15b030,_0x5a747c),_0x1f5cbd={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x201faa},_0x68a219=join(_0x535ed8,_0x440bbf(0x1f4),'mcp.json'),_0x5c46dc=join(_0x535ed8,_0x440bbf(0x1f4));try{!existsSync(_0x5c46dc)&&mkdirSync(_0x5c46dc,{'recursive':!![]});let _0x131ff2={'mcpServers':{}};if(existsSync(_0x68a219)){const _0x57e403=readFileSync(_0x68a219,_0x440bbf(0x1f5));_0x131ff2=JSON[_0x440bbf(0x1dd)](_0x57e403);}return(!_0x131ff2[_0x440bbf(0x1d9)]||typeof _0x131ff2[_0x440bbf(0x1d9)]!==_0x440bbf(0x1fe))&&(_0x131ff2[_0x440bbf(0x1d9)]={}),_0x131ff2['mcpServers'][MCP_SERVER_NAME]=_0x1f5cbd,writeFileSync(_0x68a219,JSON[_0x440bbf(0x1ec)](_0x131ff2,null,0x2),_0x440bbf(0x1f5)),logger[_0x440bbf(0x1f6)](_0x440bbf(0x1fb),_0x440bbf(0x1de),{'appcode':_0x15b030,'env':_0x5a747c,'path':_0x68a219}),await copyRulesToCursor(_0x535ed8),{'ide':_0x440bbf(0x1e3),'status':_0x440bbf(0x1eb),'message':_0x440bbf(0x1d5)};}catch(_0x2a4e76){return logger[_0x440bbf(0x1cd)](_0x440bbf(0x1fb),_0x440bbf(0x1fd),{'error':_0x2a4e76 instanceof Error?_0x2a4e76['message']:String(_0x2a4e76)}),{'ide':_0x440bbf(0x1e3),'status':_0x440bbf(0x1cd),'message':_0x2a4e76 instanceof Error?_0x2a4e76[_0x440bbf(0x1cc)]:String(_0x2a4e76)};}}export async function configureClaudeMcp(_0x5edfcd){const _0x4843d3=a0_0x30e07b,_0xfc2aff=_0x5edfcd||process[_0x4843d3(0x1cf)](),_0x2ecfac=readConfig(_0xfc2aff),_0x1a2961=_0x2ecfac[_0x4843d3(0x1e0)]||_0x2ecfac['app'],_0x399e1c=normalizeEnv(_0x2ecfac[_0x4843d3(0x1f9)]||_0x4843d3(0x1d0));if(!_0x1a2961)return{'ide':'Claude\x20Code','status':'error','message':_0x4843d3(0x1ee)};let _0x3231c3=_0x4843d3(0x1c8)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0x4843d3(0x1f2)]('\x20')+_0x4843d3(0x201)+_0x1a2961;return _0x399e1c!==_0x4843d3(0x1d0)&&(_0x3231c3+='\x20-e\x20RABETBASE_ENV='+_0x399e1c),await copyRulesToAgentsMd(_0xfc2aff),logger['info'](_0x4843d3(0x1fb),_0x4843d3(0x1d4),{'command':_0x3231c3,'appcode':_0x1a2961,'env':_0x399e1c}),console[_0x4843d3(0x1da)](_0x4843d3(0x205)),console[_0x4843d3(0x1da)]('\x20\x20'+_0x3231c3+'\x0a'),console[_0x4843d3(0x1da)](_0x4843d3(0x1e7)),console[_0x4843d3(0x1da)](_0x4843d3(0x1f3)+_0x1a2961),_0x399e1c!==_0x4843d3(0x1d0)&&console[_0x4843d3(0x1da)](_0x4843d3(0x1cb)+_0x399e1c),console[_0x4843d3(0x1da)]('\x20\x20Restart\x20Claude\x20Code\x20to\x20take\x20effect\x0a'),{'ide':_0x4843d3(0x1fa),'status':_0x4843d3(0x203),'message':_0x4843d3(0x1ce)+_0x3231c3};}export async function showOtherGuide(_0x3ae4b5){const _0x538111=a0_0x30e07b,_0x300411=_0x3ae4b5||process[_0x538111(0x1cf)](),_0x38f0d6=readConfig(_0x300411),_0x7d1e06=_0x38f0d6[_0x538111(0x1e0)]||_0x38f0d6[_0x538111(0x204)],_0x25e75e=normalizeEnv(_0x38f0d6['env']||_0x538111(0x1d0));if(!_0x7d1e06)return{'ide':_0x538111(0x1e6),'status':_0x538111(0x1cd),'message':_0x538111(0x1ee)};return console[_0x538111(0x1da)](_0x538111(0x1ca)),console[_0x538111(0x1da)]('{'),console[_0x538111(0x1da)](_0x538111(0x202)),console['log']('\x20\x20\x20\x20\x22'+MCP_SERVER_NAME+_0x538111(0x1e5)),console[_0x538111(0x1da)](_0x538111(0x1d3)+MCP_COMMAND+'\x22,'),console[_0x538111(0x1da)](_0x538111(0x207)+MCP_ARGS[_0x538111(0x1ef)](_0x8667b7=>'\x22'+_0x8667b7+'\x22')['join'](',\x20')+'],'),console['log'](_0x538111(0x1dc)),console[_0x538111(0x1da)](_0x538111(0x1ed)+_0x7d1e06+'\x22,'),_0x25e75e!=='production'&&console[_0x538111(0x1da)](_0x538111(0x1e2)+_0x25e75e+'\x22,'),console[_0x538111(0x1da)](_0x538111(0x1d1)),console['log'](_0x538111(0x1ff)),console[_0x538111(0x1da)](_0x538111(0x1d6)),console[_0x538111(0x1da)]('}\x0a'),logger['info'](_0x538111(0x1fb),_0x538111(0x200),{'appcode':_0x7d1e06,'env':_0x25e75e}),{'ide':_0x538111(0x1e6),'status':_0x538111(0x203),'message':_0x538111(0x200)};}export async function configureMcp(_0x1c6e22,_0x416513){const _0x9343be=a0_0x30e07b;switch(_0x1c6e22){case _0x9343be(0x1f7):return await configureCursorMcp(_0x416513);case _0x9343be(0x1f1):return await configureClaudeMcp(_0x416513);default:throw new Error(_0x9343be(0x1f8)+_0x1c6e22);}}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x555a22,_0x1e90b1){const _0x2c430c=a1_0x335b,_0x59dcbb=_0x555a22();while(!![]){try{const _0x1fc8e5=parseInt(_0x2c430c(0x1f6))/0x1*(-parseInt(_0x2c430c(0x215))/0x2)+parseInt(_0x2c430c(0x1fa))/0x3+-parseInt(_0x2c430c(0x203))/0x4*(-parseInt(_0x2c430c(0x216))/0x5)+-parseInt(_0x2c430c(0x21a))/0x6+-parseInt(_0x2c430c(0x1f2))/0x7*(-parseInt(_0x2c430c(0x214))/0x8)+parseInt(_0x2c430c(0x213))/0x9*(-parseInt(_0x2c430c(0x220))/0xa)+parseInt(_0x2c430c(0x211))/0xb*(parseInt(_0x2c430c(0x204))/0xc);if(_0x1fc8e5===_0x1e90b1)break;else _0x59dcbb['push'](_0x59dcbb['shift']());}catch(_0x3ab740){_0x59dcbb['push'](_0x59dcbb['shift']());}}}(a1_0x3a6a,0x91d64));import{jsx as a1_0x12f9b0,jsxs as a1_0x459ca9,Fragment as a1_0x4dd5b7}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{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';function a1_0x3a6a(){const _0x2a8201=['env','\x1b[0m','cyan','6799272vSuQAy','Generating\x20','expired','.md\x20(','error','message','482040YSwXsM','column','filter','white','includes','./docs','filePath','datasetName','dim','map','setLogPath','\x20failed','3471202VAktht','join','red','\x20total\x1b[0m','638271wqiKuF','Generating\x20docs\x20for\x20','*\x20Output\x20directory:\x20','\x20succeeded','1826184iJcZbt','length','datasetCode','\x20datasets...','cwd','文档生成完成','rabetbase\x20auth','*\x20Generated\x20doc\x20files:','string','1668rNsqsp','12422532yUwsRY','api-doc','[ERROR]\x20','green','gray','All\x20specified\x20dataset\x20codes\x20do\x20not\x20exist:\x20','yellow','\x20datasets','Using\x20specified\x20AppCode:\x20','success','production','log','√\x20Doc\x20generation\x20complete!\x20','22BovTxp','\x20matching\x20datasets\x20from\x20','171VCxObJ','8LZOTxh','2NDiRVh','1315TmQcXq'];a1_0x3a6a=function(){return _0x2a8201;};return a1_0x3a6a();}import{logger}from'../utils/logger.js';function a1_0x335b(_0xfb5365,_0x349935){_0xfb5365=_0xfb5365-0x1e7;const _0x3a6ab7=a1_0x3a6a();let _0x335bea=_0x3a6ab7[_0xfb5365];return _0x335bea;}export const ApiDocUI=({appCode:_0x462760,env:_0x3aa1c4,output:_0x575b76,extraParams:_0x500a88,datasetCodes:_0x48400d})=>{const _0x581329=a1_0x335b,{exit:_0x1bc3a3}=useApp(),[_0x18364d,_0x40c478]=useState(![]),[_0x5f39b8,_0x1797fb]=useState(''),[_0x43bf58,_0x34231f]=useState(![]),[_0x92c93e,_0x3f14e0]=useState(null),[_0x3ea482,_0xe441e7]=useState(null),[_0x442732,_0x7e6660]=useState(0x0),_0xfd8a41=readConfig(),_0x57c985=getConfigAppCode(),_0x26aa89=_0x462760||_0x57c985,_0x1a5313=typeof _0xfd8a41?.[_0x581329(0x217)]===_0x581329(0x202)?_0xfd8a41['env']:undefined,_0x9644a3=_0x3aa1c4||_0x1a5313||_0x581329(0x20e);initEnv(_0x9644a3);const _0x21c5dc=_0x575b76||_0x581329(0x1eb),_0x19820c=_0x462760?_0x581329(0x20c)+_0x26aa89:'Using\x20configured\x20AppCode:\x20'+_0x26aa89;useEffect(()=>{_0x40c478(!![]),_0x241a4f();},[]),useEffect(()=>{(_0x43bf58||_0x92c93e)&&_0x1bc3a3();},[_0x43bf58,_0x92c93e,_0x1bc3a3]);async function _0x241a4f(){const _0x464481=_0x581329;if(!_0x26aa89){_0x3f14e0('No\x20AppCode\x20provided\x20and\x20no\x20default\x20configured');return;}try{logger[_0x464481(0x1f0)](process[_0x464481(0x1fe)]()),_0x1797fb('Fetching\x20dataset\x20list...');const {configArray:_0x406bfe}=await fetchModelList(_0x26aa89);_0x7e6660(_0x406bfe['length']);if(_0x406bfe[_0x464481(0x1fb)]===0x0){_0x3f14e0('No\x20datasets\x20found');return;}let _0x11def3=_0x406bfe;if(_0x48400d&&_0x48400d['length']>0x0){_0x11def3=_0x406bfe['filter'](_0x1a407f=>_0x48400d[_0x464481(0x1ea)](_0x1a407f[_0x464481(0x1fc)]));const _0x4032e9=_0x11def3[_0x464481(0x1ef)](_0x5cbdee=>_0x5cbdee[_0x464481(0x1fc)]),_0x224c3b=_0x48400d[_0x464481(0x1e8)](_0x3e6a44=>!_0x4032e9[_0x464481(0x1ea)](_0x3e6a44));_0x224c3b[_0x464481(0x1fb)]>0x0&&console[_0x464481(0x20f)]('\x1b[33m!\x20The\x20following\x20dataset\x20codes\x20do\x20not\x20exist:\x20'+_0x224c3b[_0x464481(0x1f3)](',\x20')+_0x464481(0x218));if(_0x11def3[_0x464481(0x1fb)]===0x0){_0x3f14e0(_0x464481(0x209)+_0x48400d[_0x464481(0x1f3)](',\x20'));return;}console[_0x464481(0x20f)]('\x1b[90m*\x20Filtered\x20'+_0x11def3[_0x464481(0x1fb)]+_0x464481(0x212)+_0x406bfe[_0x464481(0x1fb)]+_0x464481(0x1f5));}_0x1797fb(_0x464481(0x1f7)+_0x11def3['length']+_0x464481(0x1fd));const _0x578183=await generateDatasetDocs(_0x11def3,_0x26aa89,_0x21c5dc,(_0x229777,_0x39bea6,_0xef8023)=>{const _0xc3043e=_0x464481;_0x1797fb(_0xc3043e(0x21b)+_0xef8023+_0xc3043e(0x21d)+_0x229777+'/'+_0x39bea6+')');},_0x500a88);_0xe441e7(_0x578183),_0x34231f(!![]);const _0x2b4f1a=_0x578183['filter'](_0x124967=>_0x124967[_0x464481(0x20d)])[_0x464481(0x1fb)],_0x3031cf=_0x578183[_0x464481(0x1e8)](_0x2303b6=>!_0x2303b6[_0x464481(0x20d)])['length'];logger[_0x464481(0x20d)](_0x464481(0x205),_0x464481(0x1ff),undefined,{'totalCount':_0x578183[_0x464481(0x1fb)],'successCount':_0x2b4f1a,'failCount':_0x3031cf,'outputDir':_0x21c5dc});}catch(_0x38d6da){const _0x27d8f8=_0x38d6da instanceof Error?_0x38d6da[_0x464481(0x21f)]:String(_0x38d6da);logger[_0x464481(0x21e)](_0x464481(0x205),'文档生成失败:\x20'+_0x27d8f8,{'appCode':_0x26aa89,'outputDir':_0x21c5dc}),_0x3f14e0('Doc\x20generation\x20failed:\x20'+_0x27d8f8);}finally{_0x40c478(![]);}}const _0x5807e6=_0x3ea482?.[_0x581329(0x1e8)](_0x56efb1=>_0x56efb1[_0x581329(0x20d)])[_0x581329(0x1fb)]||0x0,_0x58fd1f=_0x3ea482?.[_0x581329(0x1e8)](_0xc71a82=>!_0xc71a82[_0x581329(0x20d)])[_0x581329(0x1fb)]||0x0;return a1_0x459ca9(Box,{'flexDirection':_0x581329(0x1e7),'children':[(_0x18364d||_0x43bf58)&&a1_0x459ca9(Box,{'children':[a1_0x12f9b0(Text,{'color':'gray','children':'*\x20'}),a1_0x12f9b0(Text,{'color':_0x462760?_0x581329(0x1e9):_0x581329(0x1ee),'children':_0x19820c})]}),_0x18364d&&a1_0x12f9b0(Box,{'children':a1_0x459ca9(Text,{'children':['*\x20',_0x5f39b8]})}),_0x43bf58&&_0x3ea482&&a1_0x459ca9(Box,{'flexDirection':_0x581329(0x1e7),'children':[a1_0x12f9b0(Box,{'children':a1_0x459ca9(Text,{'color':_0x581329(0x207),'children':[_0x581329(0x210)+_0x5807e6+_0x581329(0x1f9),_0x58fd1f>0x0?',\x20'+_0x58fd1f+_0x581329(0x1f1):'']})}),a1_0x12f9b0(Box,{'marginTop':0x1,'children':a1_0x12f9b0(Text,{'color':_0x581329(0x208),'children':'*\x20Processed\x20'+_0x442732+_0x581329(0x20b)})}),a1_0x459ca9(Box,{'marginTop':0x1,'children':[a1_0x12f9b0(Text,{'color':_0x581329(0x208),'children':_0x581329(0x1f8)}),a1_0x12f9b0(Text,{'color':'cyan','children':_0x21c5dc})]}),_0x5807e6>0x0&&a1_0x459ca9(a1_0x4dd5b7,{'children':[a1_0x12f9b0(Box,{'marginTop':0x1,'children':a1_0x12f9b0(Text,{'color':'gray','children':_0x581329(0x201)})}),_0x3ea482[_0x581329(0x1e8)](_0x56be12=>_0x56be12['success'])['map']((_0x4dbe8c,_0x41d778)=>a1_0x459ca9(Box,{'marginLeft':0x2,'children':[a1_0x459ca9(Text,{'color':_0x581329(0x219),'children':['•\x20',_0x4dbe8c[_0x581329(0x1ec)]]}),a1_0x459ca9(Text,{'color':'dim','children':['\x20-\x20',_0x4dbe8c[_0x581329(0x1ed)]]})]},_0x41d778))]}),_0x58fd1f>0x0&&a1_0x459ca9(a1_0x4dd5b7,{'children':[a1_0x12f9b0(Box,{'marginTop':0x1,'children':a1_0x12f9b0(Text,{'color':'yellow','children':'The\x20following\x20datasets\x20failed\x20to\x20generate:'})}),_0x3ea482[_0x581329(0x1e8)](_0x35a380=>!_0x35a380[_0x581329(0x20d)])[_0x581329(0x1ef)]((_0x7b463d,_0x2e794c)=>a1_0x459ca9(Box,{'marginLeft':0x2,'flexDirection':'column','children':[a1_0x459ca9(Text,{'color':_0x581329(0x1f4),'children':['•\x20',_0x7b463d['datasetName'],'\x20(',_0x7b463d['datasetCode'],')']}),_0x7b463d['error']&&a1_0x12f9b0(Box,{'marginLeft':0x2,'children':a1_0x12f9b0(Text,{'color':'dim','children':_0x7b463d[_0x581329(0x21e)]})})]},_0x2e794c))]})]}),_0x92c93e&&a1_0x459ca9(Box,{'flexDirection':_0x581329(0x1e7),'children':[a1_0x12f9b0(Box,{'children':a1_0x459ca9(Text,{'color':_0x581329(0x1f4),'children':[_0x581329(0x206),_0x92c93e]})}),(_0x92c93e[_0x581329(0x1ea)]('登录')||_0x92c93e['includes']('Authentication')||_0x92c93e[_0x581329(0x1ea)](_0x581329(0x21c)))&&a1_0x459ca9(Box,{'marginTop':0x1,'children':[a1_0x12f9b0(Text,{'color':'yellow','children':'*\x20'}),a1_0x12f9b0(Text,{'color':'cyan','children':_0x581329(0x200)}),a1_0x12f9b0(Text,{'color':_0x581329(0x20a),'children':'\x20login\x20again\x20and\x20retry'})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a2_0x5706(){const _0xf56fed=['1407687ygncVm','data','/api/node-toolbox/api-doc-generator','生成文档失败:\x20','12ahZjQd','✗\x20Failed:\x20',']\x20Generating:\x20','log','api-doc','✓\x20Generated:\x20','589680ZVkBMf','length','utf8','datasetCode','status','):\x20missing\x20data.markdown\x20field','Waiting\x203\x20seconds...\x0a','.md\x20(','error','./docs','.md','1552671pduxlC','3006508pkEcSo','join','),\x20HTTP\x20status:\x20','7662606LbtZmK','name','6681920SmorOu','application/json','38774944LSRRRH','tableName','Authentication\x20failed,\x20session\x20expired.\x20Please\x20use\x20rabetbase\x20auth\x20to\x20login\x20again','生成文档成功:\x20','\x20datasets\x20to\x20generate\x20docs\x20for\x0a','Invalid\x20response\x20format\x20(','push','stringify','json','text'];a2_0x5706=function(){return _0xf56fed;};return a2_0x5706();}function a2_0x5b07(_0x547718,_0x192061){_0x547718=_0x547718-0x12f;const _0x570683=a2_0x5706();let _0x5b0707=_0x570683[_0x547718];return _0x5b0707;}const a2_0x4f2ceb=a2_0x5b07;(function(_0x50bb27,_0x102948){const _0x4cead0=a2_0x5b07,_0x51a2d0=_0x50bb27();while(!![]){try{const _0x5d28cb=-parseInt(_0x4cead0(0x14e))/0x1+-parseInt(_0x4cead0(0x13d))/0x2+-parseInt(_0x4cead0(0x13c))/0x3*(parseInt(_0x4cead0(0x152))/0x4)+parseInt(_0x4cead0(0x131))/0x5+parseInt(_0x4cead0(0x140))/0x6+-parseInt(_0x4cead0(0x142))/0x7+parseInt(_0x4cead0(0x144))/0x8;if(_0x5d28cb===_0x102948)break;else _0x51a2d0['push'](_0x51a2d0['shift']());}catch(_0x1b41c3){_0x51a2d0['push'](_0x51a2d0['shift']());}}}(a2_0x5706,0xc91b5));import{mkdirSync,writeFileSync}from'node:fs';import a2_0x345033 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(_0x193c27){const _0x3fc315=a2_0x5b07,{appCode:_0x296d23,datasetCode:_0x2c85a5,datasetId:_0x5831c4,extraParams:_0xa22cc3}=_0x193c27,_0x5240d8=getApiDomain(),_0x50fcd1=_0x5240d8+_0x3fc315(0x150),_0xb221e3={'appCode':_0x296d23,'datasetCode':_0x2c85a5,'datasetId':_0x5831c4,..._0xa22cc3||{}},_0x421cc7=await fetch(_0x50fcd1,{'method':'POST','headers':{'Content-Type':_0x3fc315(0x143),'Cookie':getCookie()},'body':JSON[_0x3fc315(0x14b)](_0xb221e3)});if(!_0x421cc7['ok']){if(_0x421cc7[_0x3fc315(0x135)]===0x191)throw new Error(_0x3fc315(0x146));let _0x4c2eb4='';try{_0x4c2eb4=await _0x421cc7[_0x3fc315(0x14d)]();}catch(_0x50fea3){}throw new Error('Failed\x20to\x20fetch\x20doc\x20('+_0x2c85a5+_0x3fc315(0x13f)+_0x421cc7[_0x3fc315(0x135)]+(_0x4c2eb4?'\x0a'+_0x4c2eb4:''));}const _0x2964db=await _0x421cc7[_0x3fc315(0x14c)]();if(!_0x2964db['data']||typeof _0x2964db[_0x3fc315(0x14f)]['markdown']!=='string')throw new Error(_0x3fc315(0x149)+_0x2c85a5+_0x3fc315(0x136));return _0x2964db['data']['markdown'];}function delay(_0x365d78){return new Promise(_0x4054ba=>setTimeout(_0x4054ba,_0x365d78));}export async function generateDatasetDocs(_0x275460,_0x2f0011,_0x18f26a=a2_0x4f2ceb(0x13a),_0x38bbf1,_0x3af77b){const _0x94e099=a2_0x4f2ceb;mkdirSync(_0x18f26a,{'recursive':!![]});const _0x45030e=[],_0xf62461=_0x275460[_0x94e099(0x132)];console[_0x94e099(0x155)]('\x0a'+_0xf62461+_0x94e099(0x148));for(let _0x4e23f9=0x0;_0x4e23f9<_0x275460[_0x94e099(0x132)];_0x4e23f9++){const _0x4df7bd=_0x275460[_0x4e23f9],_0x124315=_0x4e23f9+0x1,_0x20fed1=_0x4df7bd[_0x94e099(0x145)];try{console[_0x94e099(0x155)]('['+_0x124315+'/'+_0xf62461+_0x94e099(0x154)+_0x20fed1+_0x94e099(0x138)+_0x4df7bd[_0x94e099(0x141)]+')');_0x38bbf1&&_0x38bbf1(_0x124315,_0xf62461,_0x20fed1);const _0x5b6a0a=await fetchDatasetDoc({'appCode':_0x2f0011,'datasetCode':_0x4df7bd[_0x94e099(0x134)],'datasetId':_0x4df7bd['id'],'enableAI':![],'extraParams':_0x3af77b}),_0x344e03=a2_0x345033[_0x94e099(0x13e)](_0x18f26a,_0x20fed1+'.md');writeFileSync(_0x344e03,_0x5b6a0a,{'encoding':_0x94e099(0x133)}),console[_0x94e099(0x155)](_0x94e099(0x130)+_0x20fed1+_0x94e099(0x13b)),logger['success'](_0x94e099(0x12f),_0x94e099(0x147)+_0x20fed1,undefined,{'datasetCode':_0x4df7bd[_0x94e099(0x134)],'datasetName':_0x4df7bd[_0x94e099(0x141)],'filePath':_0x344e03,'progress':_0x124315+'/'+_0xf62461}),_0x45030e[_0x94e099(0x14a)]({'datasetCode':_0x4df7bd['datasetCode'],'datasetName':_0x4df7bd['name'],'filePath':_0x344e03,'success':!![]}),_0x124315<_0xf62461&&await delay(0x1388);}catch(_0x53acc3){const _0x482017=_0x53acc3 instanceof Error?_0x53acc3['message']:String(_0x53acc3);console['log'](_0x94e099(0x153)+_0x20fed1+'.md\x20-\x20'+_0x482017),logger[_0x94e099(0x139)]('api-doc',_0x94e099(0x151)+_0x4df7bd[_0x94e099(0x134)],{'datasetCode':_0x4df7bd['datasetCode'],'datasetName':_0x4df7bd[_0x94e099(0x141)],'error':_0x482017,'progress':_0x124315+'/'+_0xf62461}),_0x45030e[_0x94e099(0x14a)]({'datasetCode':_0x4df7bd[_0x94e099(0x134)],'datasetName':_0x4df7bd[_0x94e099(0x141)],'filePath':'','success':![],'error':_0x482017}),_0x124315<_0xf62461&&(console[_0x94e099(0x155)](_0x94e099(0x137)),await delay(0xbb8));}}return _0x45030e;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x252f9a,_0x5b6ba2){const _0x499ff5=a3_0x5db9,_0x31d309=_0x252f9a();while(!![]){try{const _0x3dcf18=-parseInt(_0x499ff5(0x1c9))/0x1*(-parseInt(_0x499ff5(0x197))/0x2)+parseInt(_0x499ff5(0x1b3))/0x3*(parseInt(_0x499ff5(0x19a))/0x4)+-parseInt(_0x499ff5(0x1c1))/0x5+-parseInt(_0x499ff5(0x1be))/0x6*(-parseInt(_0x499ff5(0x1a9))/0x7)+-parseInt(_0x499ff5(0x1c6))/0x8*(parseInt(_0x499ff5(0x196))/0x9)+parseInt(_0x499ff5(0x1a6))/0xa*(parseInt(_0x499ff5(0x195))/0xb)+-parseInt(_0x499ff5(0x1ab))/0xc;if(_0x3dcf18===_0x5b6ba2)break;else _0x31d309['push'](_0x31d309['shift']());}catch(_0x5141c1){_0x31d309['push'](_0x31d309['shift']());}}}(a3_0x1c47,0x34a6f));function a3_0x5db9(_0x1fa2a7,_0x32f3f6){_0x1fa2a7=_0x1fa2a7-0x194;const _0x1c47c6=a3_0x1c47();let _0x5db93d=_0x1c47c6[_0x1fa2a7];return _0x5db93d;}import{jsx as a3_0x2b5599,jsxs as a3_0x2f5e4a}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';function a3_0x1c47(){const _0x5f48e2=['datasetCount','setLogPath','cyan','api','slice','1267401yopbru','apiDir','api-pull','duplicateCount','includes','gray','white','cwd','-client','\x20models','column','6xhIDAK','\x20models)','*\x20Import\x20usage:','313405kURlyF','green','yellow','env','Authentication','5648ZOCKjd','.ts','\x20login\x20again\x20and\x20retry','266879apKOKr','modelCount','{\x20lovrabetClient\x20}','error','6831uNxEGw','5202Kcysmo','2gDXUeT','string','client','4kwqHhp','split','replace','-\x20Model\x20config\x20(','Using\x20specified\x20AppCode:\x20','\x20duplicates','\x20-\x20Client\x20instance\x20file','import\x20','\x20from\x20\x27@/','\x20datasets,\x20filtered\x20','dim','rabetbase\x20auth','6110AgKOFj','拉取\x20API\x20配置失败:\x20','originalCount','2756481WrpONO','./src/api/','9313776jNVkXq','Using\x20configured\x20AppCode:\x20','join'];a3_0x1c47=function(){return _0x5f48e2;};return a3_0x1c47();}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x4fedb7,env:_0x2220a8,output:_0x44f5d9})=>{const _0x4ae521=a3_0x5db9,{exit:_0x127f42}=useApp(),[_0x58bc06,_0x569c5c]=useState(![]),[_0x585588,_0x29fe18]=useState(![]),[_0x5b8ae8,_0x16813d]=useState(null),[_0x24f2eb,_0x3323c7]=useState(null),_0x20ad97=readConfig(),_0x2ea238=getConfigAppCode(),_0x2b7d0e=_0x4fedb7||_0x2ea238,_0x5395cf=typeof _0x20ad97?.[_0x4ae521(0x1c4)]===_0x4ae521(0x198)?_0x20ad97['env']:undefined,_0xf435e6=_0x2220a8||_0x5395cf||'production';initEnv(_0xf435e6);const _0x433ec1=typeof _0x20ad97?.['apiDir']===_0x4ae521(0x198)?_0x20ad97[_0x4ae521(0x1b4)]:undefined,_0x4ee167=_0x44f5d9||_0x433ec1||_0x4ae521(0x1aa),_0x5df6b4=_0x4fedb7&&_0x4fedb7['includes']('-')?_0x4fedb7[_0x4ae521(0x19b)]('-')[_0x4ae521(0x1b2)](0x1)[_0x4ae521(0x1ad)]('-'):'',_0x4762fe=_0x4fedb7?_0x4ae521(0x19e)+_0x2b7d0e:_0x4ae521(0x1ac)+_0x2b7d0e,_0x366df1=_0x5df6b4?_0x5df6b4+'-api':_0x4ae521(0x1b1),_0xd393b9=_0x5df6b4?_0x5df6b4+_0x4ae521(0x1bb):_0x4ae521(0x199);useEffect(()=>{_0x569c5c(!![]),_0x59530d();},[]),useEffect(()=>{(_0x585588||_0x5b8ae8)&&_0x127f42();},[_0x585588,_0x5b8ae8,_0x127f42]);async function _0x59530d(){const _0xa0eba1=_0x4ae521;if(!_0x2b7d0e){_0x16813d('No\x20AppCode\x20provided\x20and\x20no\x20default\x20configured');return;}try{logger[_0xa0eba1(0x1af)](process[_0xa0eba1(0x1ba)]());const {configArray:_0x1e07ec}=await fetchModelList(_0x2b7d0e),_0x506788=_0x1e07ec['length'],_0x5413ab=!_0x4fedb7,_0x39c974=await generateApiFile(_0x1e07ec,_0x5df6b4,_0x2b7d0e,_0x5413ab,_0xf435e6,_0x4ee167),_0x22aa4c=_0x4ee167['endsWith']('/')?_0x4ee167:_0x4ee167+'/';_0x3323c7({'api':''+_0x22aa4c+_0x366df1+_0xa0eba1(0x1c7),'client':''+_0x22aa4c+_0xd393b9+_0xa0eba1(0x1c7),'modelCount':_0x39c974[_0xa0eba1(0x1ca)],'datasetCount':_0x506788,'originalCount':_0x506788,'duplicateCount':0x0}),_0x29fe18(!![]);}catch(_0x41e73e){const _0x47216c=_0x41e73e instanceof Error?_0x41e73e['message']:String(_0x41e73e);logger[_0xa0eba1(0x194)](_0xa0eba1(0x1b5),_0xa0eba1(0x1a7)+_0x47216c,{'appCode':_0x2b7d0e,'error':_0x47216c}),_0x16813d('Failed\x20to\x20pull\x20API\x20config:\x20'+_0x47216c);}finally{_0x569c5c(![]);}}return a3_0x2f5e4a(Box,{'flexDirection':_0x4ae521(0x1bd),'children':[(_0x58bc06||_0x585588)&&a3_0x2f5e4a(Box,{'children':[a3_0x2b5599(Text,{'color':_0x4ae521(0x1b8),'children':'*\x20'}),a3_0x2b5599(Text,{'color':_0x4fedb7?_0x4ae521(0x1b9):_0x4ae521(0x1a4),'children':_0x4762fe})]}),_0x58bc06&&a3_0x2b5599(Box,{'children':a3_0x2b5599(Text,{'children':'*\x20Pulling\x20API\x20config\x20from\x20server...\x20(env:\x20'+_0xf435e6+')'})}),_0x585588&&_0x24f2eb&&a3_0x2f5e4a(Box,{'flexDirection':'column','children':[a3_0x2b5599(Box,{'children':a3_0x2b5599(Text,{'color':_0x4ae521(0x1c2),'children':'√\x20Pulled\x20'+_0x24f2eb[_0x4ae521(0x1ae)]+'\x20datasets,\x20generated\x20'+_0x24f2eb[_0x4ae521(0x1ca)]+_0x4ae521(0x1bc)})}),_0x24f2eb[_0x4ae521(0x1b6)]>0x0&&a3_0x2b5599(Box,{'marginTop':0x1,'children':a3_0x2b5599(Text,{'color':'yellow','children':'!\x20Original\x20'+_0x24f2eb[_0x4ae521(0x1a8)]+_0x4ae521(0x1a3)+_0x24f2eb['duplicateCount']+_0x4ae521(0x19f)})}),a3_0x2b5599(Box,{'marginTop':0x1,'children':a3_0x2b5599(Text,{'color':_0x4ae521(0x1b8),'children':'*\x20Generated\x20files:'})}),a3_0x2f5e4a(Box,{'marginLeft':0x2,'children':[a3_0x2f5e4a(Text,{'color':'cyan','children':['•\x20',_0x24f2eb['api']]}),a3_0x2f5e4a(Text,{'color':_0x4ae521(0x1a4),'children':['\x20',_0x4ae521(0x19d)+_0x24f2eb[_0x4ae521(0x1ca)]+_0x4ae521(0x1bf)]})]}),a3_0x2f5e4a(Box,{'marginLeft':0x2,'children':[a3_0x2f5e4a(Text,{'color':'cyan','children':['•\x20',_0x24f2eb[_0x4ae521(0x199)]]}),a3_0x2b5599(Text,{'color':_0x4ae521(0x1a4),'children':_0x4ae521(0x1a0)})]}),a3_0x2b5599(Box,{'marginTop':0x1,'children':a3_0x2b5599(Text,{'color':_0x4ae521(0x1b8),'children':_0x4ae521(0x1c0)})}),a3_0x2b5599(Box,{'marginLeft':0x2,'children':a3_0x2f5e4a(Text,{'color':_0x4ae521(0x1c3),'children':[_0x4ae521(0x1a1),_0x4ae521(0x1cb),_0x4ae521(0x1a2),_0x24f2eb['client'][_0x4ae521(0x19c)](/^\.\//,'')[_0x4ae521(0x19c)]('.ts',''),'\x27']})})]}),_0x5b8ae8&&a3_0x2f5e4a(Box,{'flexDirection':'column','children':[a3_0x2b5599(Box,{'children':a3_0x2f5e4a(Text,{'color':'red','children':['[ERROR]\x20',_0x5b8ae8]})}),(_0x5b8ae8['includes']('登录')||_0x5b8ae8[_0x4ae521(0x1b7)](_0x4ae521(0x1c5))||_0x5b8ae8[_0x4ae521(0x1b7)]('expired'))&&a3_0x2f5e4a(Box,{'marginTop':0x1,'children':[a3_0x2b5599(Text,{'color':_0x4ae521(0x1c3),'children':'*\x20'}),a3_0x2b5599(Text,{'color':_0x4ae521(0x1b0),'children':_0x4ae521(0x1a5)}),a3_0x2b5599(Text,{'color':_0x4ae521(0x1c3),'children':_0x4ae521(0x1c8)})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5f0d19,_0x4255eb){const _0x26f503=a4_0x3a91,_0x190855=_0x5f0d19();while(!![]){try{const _0x1afbbc=-parseInt(_0x26f503(0xd8))/0x1+-parseInt(_0x26f503(0xe0))/0x2+parseInt(_0x26f503(0xf5))/0x3+-parseInt(_0x26f503(0xe6))/0x4*(-parseInt(_0x26f503(0xf7))/0x5)+parseInt(_0x26f503(0xe1))/0x6+parseInt(_0x26f503(0xf2))/0x7*(-parseInt(_0x26f503(0xdf))/0x8)+-parseInt(_0x26f503(0xdd))/0x9*(-parseInt(_0x26f503(0xf1))/0xa);if(_0x1afbbc===_0x4255eb)break;else _0x190855['push'](_0x190855['shift']());}catch(_0x4f2003){_0x190855['push'](_0x190855['shift']());}}}(a4_0x25db,0x49391));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 a4_0x25db(){const _0x29e3c7=['72820RZFpyX','info','errorCode','success','code','117693rCFCOO','Failed\x20to\x20fetch\x20datasets,\x20HTTP\x20status:\x20','8eCxdgo','965822rIoklk','2090220umJUts','errorMsg','error','json','Failed\x20to\x20fetch\x20datasets:\x20','1028fvYUod','Authentication\x20failed,\x20session\x20expired.\x20Please\x20use\x20rabetbase\x20auth\x20to\x20login\x20again','UNAUTHORIZED','401','status','fetch-model-list','map','includes','name','configArray','Unauthorized','210xkDSJi','199451qheGwg','正在从服务器拉取模型列表...\x20(环境:\x20','message','683244KycCPh','&otype=array','650cqiiWA'];a4_0x25db=function(){return _0x29e3c7;};return a4_0x25db();}function a4_0x3a91(_0x143ff5,_0x439bfe){_0x143ff5=_0x143ff5-0xd8;const _0x25db99=a4_0x25db();let _0x3a91ad=_0x25db99[_0x143ff5];return _0x3a91ad;}function cleanNewlines(_0x45bb11){return _0x45bb11['replace'](/[\r\n]+/g,'\x20')['trim']();}function cleanDatasetName(_0x433126){const _0x4a5f81=a4_0x3a91;if(!_0x433126[_0x4a5f81(0xee)])return _0x433126;return{..._0x433126,'name':cleanNewlines(_0x433126[_0x4a5f81(0xee)])};}function cleanDatasetNames(_0x4ab538){const _0x3e98e6=a4_0x3a91;return _0x4ab538[_0x3e98e6(0xec)](cleanDatasetName);}export async function fetchModelList(_0x432b10){const _0x1165c9=a4_0x3a91,_0x2e8c69=getEnv(),_0x385309=getApiDomain()+'/api/node-toolbox/dataset/model-list?appcode='+_0x432b10+_0x1165c9(0xf6);logger[_0x1165c9(0xd9)](_0x1165c9(0xeb),_0x1165c9(0xf3)+_0x2e8c69+')',{'apiUrl':_0x385309});const _0x363b12=await fetch(_0x385309,{'headers':{'Cookie':getCookie()}});if(!_0x363b12['ok']){if(_0x363b12[_0x1165c9(0xea)]===0x191)throw new Error('Authentication\x20failed,\x20session\x20expired.\x20Please\x20use\x20rabetbase\x20auth\x20to\x20login\x20again');throw new Error(_0x1165c9(0xde)+_0x363b12[_0x1165c9(0xea)]);}const _0x52c309=await _0x363b12[_0x1165c9(0xe4)]();if(!_0x52c309[_0x1165c9(0xdb)]){const _0x14b054=_0x52c309[_0x1165c9(0xe2)]||_0x52c309[_0x1165c9(0xf4)]||_0x52c309['data']?.[_0x1165c9(0xf4)]||_0x52c309['errorMessage']||_0x52c309[_0x1165c9(0xe3)]||'Unknown\x20error';if(_0x14b054[_0x1165c9(0xed)](_0x1165c9(0xe9))||_0x14b054[_0x1165c9(0xed)](_0x1165c9(0xf0))||_0x14b054[_0x1165c9(0xed)]('登录')||_0x14b054[_0x1165c9(0xed)]('认证')||_0x52c309[_0x1165c9(0xda)]===_0x1165c9(0xe8)||_0x52c309[_0x1165c9(0xdc)]===0x191||_0x52c309[_0x1165c9(0xdc)]==='401')throw new Error(_0x1165c9(0xe7));throw new Error(_0x1165c9(0xe5)+_0x14b054);}const _0x25ce58=cleanDatasetNames(_0x52c309['data'][_0x1165c9(0xef)]);return{'configArray':_0x25ce58,'count':_0x25ce58['length']};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a5_0x2e6cc5=a5_0x4596;function a5_0x160d(){const _0x196a49=['replaceApiContent','client','8452800VyxlsS','resolve','dirname','name','init-api','10330aXjNEx','client.ts.tpl','join','3207124aVsumb','9TeCUaI','key','1173620itJtHW','production','push','slice','api.ts.tpl','datasetCode','-api','19733uOdgvQ','318DZLXse','23981780FLJZFK','utf8','\x22\x20}','{\x20apiConfigName:\x20','../..','app','Please\x20configure\x20app\x20code\x20first\x20via\x20`rabetbase\x20config\x20set\x20app\x20<value>`','tableName','alias','597AJvEyl','env','948698zRSuAa','format',',\x20env:\x20\x22','forEach','api','./src/api/','string','endsWith'];a5_0x160d=function(){return _0x196a49;};return a5_0x160d();}(function(_0x245b2a,_0x158923){const _0x2dc0be=a5_0x4596,_0x41fb9f=_0x245b2a();while(!![]){try{const _0x188b0c=-parseInt(_0x2dc0be(0x145))/0x1+parseInt(_0x2dc0be(0x154))/0x2*(-parseInt(_0x2dc0be(0x143))/0x3)+-parseInt(_0x2dc0be(0x12e))/0x4+-parseInt(_0x2dc0be(0x131))/0x5+parseInt(_0x2dc0be(0x139))/0x6*(parseInt(_0x2dc0be(0x138))/0x7)+parseInt(_0x2dc0be(0x14f))/0x8+parseInt(_0x2dc0be(0x12f))/0x9*(parseInt(_0x2dc0be(0x13a))/0xa);if(_0x188b0c===_0x158923)break;else _0x41fb9f['push'](_0x41fb9f['shift']());}catch(_0x4d789d){_0x41fb9f['push'](_0x41fb9f['shift']());}}}(a5_0x160d,0x9052b));import a5_0x2fceb9 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';function a5_0x4596(_0xc6c1ec,_0x39a664){_0xc6c1ec=_0xc6c1ec-0x12e;const _0x160de2=a5_0x160d();let _0x459695=_0x160de2[_0xc6c1ec];return _0x459695;}import a5_0xac6ecc from'node:path';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(_0x9369f5,_0xcaa55a='',_0x2a0c04,_0x2a8b44=![],_0x927f6b,_0x5e6b26=a5_0x2e6cc5(0x14a)){const _0x32c1e1=a5_0x2e6cc5,_0x45256a=readConfig(),_0x5344ec=_0x2a0c04||_0x45256a?.[_0x32c1e1(0x13f)];if(typeof _0x5344ec!==_0x32c1e1(0x14b)||!_0x5344ec)throw new Error(_0x32c1e1(0x140));const _0x1eb6bc=_0x2a8b44?'CONFIG_NAMES.DEFAULT':'\x22'+_0x5344ec+'\x22',_0x437028=typeof _0x45256a['env']==='string'?_0x45256a[_0x32c1e1(0x144)]:undefined,_0x10b874=_0x927f6b||_0x437028||_0x32c1e1(0x132),_0x44eac7=_0x10b874!==_0x32c1e1(0x132);let _0x593813;if(_0x2a8b44)_0x44eac7?_0x593813=_0x32c1e1(0x13d)+_0x1eb6bc+_0x32c1e1(0x147)+_0x10b874+_0x32c1e1(0x13c):_0x593813='';else{const _0x2f82bd=_0x44eac7?',\x20env:\x20\x22'+_0x10b874+'\x22':'';_0x593813='{\x20apiConfigName:\x20\x22'+_0x5344ec+'\x22'+_0x2f82bd+'\x20}';}const _0x3e94d9=_0xcaa55a?_0xcaa55a+_0x32c1e1(0x137):_0x32c1e1(0x149),_0x3669e2=_0xcaa55a?_0xcaa55a+'-client':_0x32c1e1(0x14e),_0x345576=[];_0x9369f5[_0x32c1e1(0x148)](_0x7d0147=>{const _0x1dfb23=_0x32c1e1;_0x345576[_0x1dfb23(0x133)]({'datasetCode':_0x7d0147[_0x1dfb23(0x136)],'tableName':_0x7d0147[_0x1dfb23(0x141)],'name':_0x7d0147[_0x1dfb23(0x152)]||'','alias':_0x7d0147[_0x1dfb23(0x142)]||_0x7d0147[_0x1dfb23(0x130)]});});const _0x508abd=fileURLToPath(import.meta.url),_0x5bdce7=a5_0xac6ecc[_0x32c1e1(0x150)](a5_0xac6ecc[_0x32c1e1(0x151)](_0x508abd),_0x32c1e1(0x13e)),_0x4bfd6f=a5_0xac6ecc[_0x32c1e1(0x156)](_0x5bdce7,'templates/generate-api'),_0x1aeb2f=a5_0xac6ecc['join'](_0x4bfd6f,_0x32c1e1(0x135)),_0x181eff=a5_0xac6ecc[_0x32c1e1(0x156)](_0x4bfd6f,_0x32c1e1(0x155)),_0x20043a=_0x5e6b26[_0x32c1e1(0x14c)]('/')?_0x5e6b26[_0x32c1e1(0x134)](0x0,-0x1):_0x5e6b26;mkdirSync(_0x20043a,{'recursive':!![]});const _0x1e65f2=_0x345576[0x0]?.[_0x32c1e1(0x142)],_0x24aee7=readFileSync(_0x1aeb2f,_0x32c1e1(0x13b)),_0x7226db=TemplateReplacer[_0x32c1e1(0x14d)](_0x24aee7,_0x5344ec,_0x345576,_0x1e65f2,_0x3e94d9,_0x1eb6bc),_0x310119=await a5_0x2fceb9[_0x32c1e1(0x146)](_0x7226db,{'parser':'typescript'}),_0x8b094b=_0x20043a+'/'+_0x3e94d9+'.ts';writeFileSync(_0x8b094b,_0x310119,{'encoding':'utf8'});const _0x3f68fd=readFileSync(_0x181eff,_0x32c1e1(0x13b)),_0x18feff=TemplateReplacer[_0x32c1e1(0x14d)](_0x3f68fd,_0x5344ec,_0x345576,_0x1e65f2,_0x3e94d9,_0x1eb6bc,_0x593813),_0x36774a=await a5_0x2fceb9[_0x32c1e1(0x146)](_0x18feff,{'parser':'typescript'}),_0x1b1478=_0x20043a+'/'+_0x3669e2+'.ts';writeFileSync(_0x1b1478,_0x36774a,{'encoding':_0x32c1e1(0x13b)});const _0x57c1e8=_0x345576['length'];return logger['success'](_0x32c1e1(0x153),'API\x20文件生成成功!',undefined,{'apiFile':_0x8b094b,'clientFile':_0x1b1478,'modelCount':_0x57c1e8,'configName':_0x1eb6bc}),{'modelCount':_0x57c1e8,'apiFilePath':_0x8b094b,'clientFilePath':_0x1b1478,'configName':_0x1eb6bc};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a6_0x5a71(_0x5102cd,_0xf03313){_0x5102cd=_0x5102cd-0x181;const _0x3f5fac=a6_0x3f5f();let _0x5a7171=_0x3f5fac[_0x5102cd];return _0x5a7171;}(function(_0x3ecae2,_0x167b05){const _0x37cf3e=a6_0x5a71,_0x1a5f67=_0x3ecae2();while(!![]){try{const _0x47440f=-parseInt(_0x37cf3e(0x1b2))/0x1+parseInt(_0x37cf3e(0x18d))/0x2+-parseInt(_0x37cf3e(0x194))/0x3*(-parseInt(_0x37cf3e(0x19f))/0x4)+parseInt(_0x37cf3e(0x1b1))/0x5*(parseInt(_0x37cf3e(0x1a1))/0x6)+-parseInt(_0x37cf3e(0x18c))/0x7*(-parseInt(_0x37cf3e(0x1a0))/0x8)+parseInt(_0x37cf3e(0x181))/0x9+-parseInt(_0x37cf3e(0x1af))/0xa*(parseInt(_0x37cf3e(0x186))/0xb);if(_0x47440f===_0x167b05)break;else _0x1a5f67['push'](_0x1a5f67['shift']());}catch(_0x12772d){_0x1a5f67['push'](_0x1a5f67['shift']());}}}(a6_0x3f5f,0x8bb9b));import{jsx as a6_0x31dfc4}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(_0x52e085){const _0x3b4645=a6_0x5a71,_0x232b1b=_0x52e085[_0x3b4645(0x191)][0x1];if(_0x52e085[_0x3b4645(0x195)][_0x3b4645(0x18a)]){console['log'](_0x3b4645(0x19e));return;}if(_0x232b1b===_0x3b4645(0x19a)){_0x52e085['input'][0x2]&&(console[_0x3b4645(0x1aa)](_0x3b4645(0x18b)),console[_0x3b4645(0x192)](_0x3b4645(0x184)),console['log'](_0x3b4645(0x19c)+_0x52e085[_0x3b4645(0x191)][0x2]),process[_0x3b4645(0x185)](0x1));const _0x541b86=getConfigAppCode();let _0x34421d=_0x52e085[_0x3b4645(0x195)]['appcode'];const _0x321883=typeof _0x52e085[_0x3b4645(0x195)][_0x3b4645(0x19b)]===_0x3b4645(0x1a4)?_0x52e085['flags'][_0x3b4645(0x19b)]:undefined,_0x202d80=_0x52e085[_0x3b4645(0x195)][_0x3b4645(0x1a3)];!_0x34421d&&!_0x541b86&&(console[_0x3b4645(0x1aa)]('AppCode\x20not\x20configured'),console[_0x3b4645(0x192)](_0x3b4645(0x182)),console[_0x3b4645(0x192)](_0x3b4645(0x196)),console[_0x3b4645(0x192)]('\x20\x20\x202.\x20Use\x20flag:\x20rabetbase\x20api\x20pull\x20--appcode\x20<app-code>'),process['exit'](0x1)),_0x34421d&&_0x541b86&&_0x34421d===_0x541b86&&(console[_0x3b4645(0x192)]('\x1b[90m*\x20Using\x20configured\x20AppCode:\x20'+_0x34421d+'\x1b[0m'),console[_0x3b4645(0x192)](_0x3b4645(0x1ac)),_0x34421d=undefined),render(a6_0x31dfc4(ApiPullUI,{'appCode':_0x34421d,'env':_0x321883,'output':_0x202d80}));}else{if(_0x232b1b==='doc'){_0x52e085[_0x3b4645(0x191)][0x2]&&(console[_0x3b4645(0x1aa)](_0x3b4645(0x18b)),console[_0x3b4645(0x192)]('Please\x20use\x20the\x20--appcode\x20flag,\x20for\x20example:'),console[_0x3b4645(0x192)]('\x20\x20rabetbase\x20api\x20doc\x20--appcode\x20'+_0x52e085[_0x3b4645(0x191)][0x2]),process[_0x3b4645(0x185)](0x1));const _0x2f3274=getConfigAppCode();let _0x5eb252=_0x52e085[_0x3b4645(0x195)][_0x3b4645(0x1a2)];const _0x552e69=typeof _0x52e085['flags'][_0x3b4645(0x19b)]===_0x3b4645(0x1a4)?_0x52e085[_0x3b4645(0x195)][_0x3b4645(0x19b)]:undefined,_0x5d63ce=_0x52e085[_0x3b4645(0x195)][_0x3b4645(0x1a3)],_0x1560bc=_0x52e085[_0x3b4645(0x195)]['params'],_0x201726=_0x52e085[_0x3b4645(0x195)][_0x3b4645(0x1ab)];!_0x5eb252&&!_0x2f3274&&(console[_0x3b4645(0x1aa)](_0x3b4645(0x183)),console['log'](_0x3b4645(0x182)),console[_0x3b4645(0x192)](_0x3b4645(0x196)),console[_0x3b4645(0x192)](_0x3b4645(0x19d)),process[_0x3b4645(0x185)](0x1));_0x5eb252&&_0x2f3274&&_0x5eb252===_0x2f3274&&(console[_0x3b4645(0x192)](_0x3b4645(0x1a5)+_0x5eb252+_0x3b4645(0x197)),_0x5eb252=undefined);let _0x542aab;if(_0x1560bc)try{_0x542aab=JSON[_0x3b4645(0x1b4)](_0x1560bc),(typeof _0x542aab!==_0x3b4645(0x1ad)||_0x542aab===null||Array[_0x3b4645(0x1a8)](_0x542aab))&&(console[_0x3b4645(0x1aa)]('--params\x20must\x20be\x20a\x20valid\x20JSON\x20object'),process[_0x3b4645(0x185)](0x1));}catch(_0x10335f){console['error'](_0x3b4645(0x198)),console[_0x3b4645(0x1aa)]('\x20\x20Error:\x20'+(_0x10335f instanceof Error?_0x10335f[_0x3b4645(0x18f)]:String(_0x10335f))),process[_0x3b4645(0x185)](0x1);}let _0x25bc83;_0x201726&&(_0x25bc83=_0x201726[_0x3b4645(0x1b3)](',')[_0x3b4645(0x1a6)](_0x4c3bab=>_0x4c3bab['trim']())[_0x3b4645(0x1b5)](_0x3626b4=>_0x3626b4[_0x3b4645(0x193)]>0x0),_0x25bc83[_0x3b4645(0x193)]===0x0&&(console[_0x3b4645(0x1aa)]('--datasetcode\x20cannot\x20be\x20empty'),process[_0x3b4645(0x185)](0x1)),console[_0x3b4645(0x192)](_0x3b4645(0x188)+_0x25bc83[_0x3b4645(0x1b0)](',\x20')+_0x3b4645(0x197))),render(a6_0x31dfc4(ApiDocUI,{'appCode':_0x5eb252,'env':_0x552e69,'output':_0x5d63ce,'extraParams':_0x542aab,'datasetCodes':_0x25bc83}));}else console[_0x3b4645(0x1aa)](_0x3b4645(0x1a9)+_0x232b1b),console['log'](_0x3b4645(0x1ae)),console[_0x3b4645(0x192)]('\x20\x20rabetbase\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//\x20Pull\x20and\x20generate\x20API\x20config\x20files'),console['log'](_0x3b4645(0x190)),console[_0x3b4645(0x192)](_0x3b4645(0x199)),console[_0x3b4645(0x192)](_0x3b4645(0x189)),console[_0x3b4645(0x192)](''),console[_0x3b4645(0x192)]('\x20\x20rabetbase\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//\x20Generate\x20docs\x20for\x20all\x20datasets'),console['log'](_0x3b4645(0x1a7)),console[_0x3b4645(0x192)](_0x3b4645(0x18e)),console[_0x3b4645(0x192)](_0x3b4645(0x187)),process[_0x3b4645(0x185)](0x1);}}function a6_0x3f5f(){const _0x155d0e=['--params\x20is\x20not\x20valid\x20JSON\x20format','\x20\x20rabetbase\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20Specify\x20output\x20directory','pull','env','\x20\x20rabetbase\x20api\x20pull\x20--appcode\x20','\x20\x20\x202.\x20Use\x20flag:\x20rabetbase\x20api\x20doc\x20--appcode\x20<app-code>','\x0arabetbase\x20api\x20-\x20API\x20Operations\x0a\x0aUsage:\x0a\x20\x20$\x20rabetbase\x20api\x20pull\x20[options]\x0a\x20\x20$\x20rabetbase\x20api\x20doc\x20[options]\x0a\x0aOptions:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20Specify\x20app\x20code\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20Specify\x20output\x20directory\x20(pull:\x20./src/api/,\x20doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Specify\x20environment\x20(e.g.\x20daily,\x20production)\x0a\x20\x20--datasetcode\x20<codes>\x20Specify\x20dataset\x20codes\x20for\x20doc\x20generation\x20(comma-separated,\x20doc\x20command\x20only)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x0a\x0aExamples:\x0a\x20\x20$\x20rabetbase\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//\x20Pull\x20and\x20generate\x20API\x20config\x20files\x0a\x20\x20$\x20rabetbase\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20Use\x20specified\x20appcode\x0a\x20\x20$\x20rabetbase\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20Specify\x20output\x20directory\x0a\x20\x20$\x20rabetbase\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Pull\x20API\x20for\x20specified\x20environment\x0a\x0a\x20\x20$\x20rabetbase\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//\x20Generate\x20docs\x20for\x20all\x20datasets\x0a\x20\x20$\x20rabetbase\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Use\x20specified\x20appcode\x0a\x20\x20$\x20rabetbase\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Specify\x20doc\x20output\x20directory\x0a\x20\x20$\x20rabetbase\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//\x20Generate\x20docs\x20for\x20specified\x20environment\x0a\x20\x20$\x20rabetbase\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Generate\x20doc\x20for\x20specific\x20dataset\x20only\x0a\x20\x20$\x20rabetbase\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20Generate\x20docs\x20for\x20multiple\x20datasets\x0a','298612vvSxWA','414160uyDeYF','939480XwMTnj','appcode','output','string','\x1b[90m*\x20Using\x20configured\x20AppCode:\x20','map','\x20\x20rabetbase\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20Use\x20specified\x20appcode','isArray','Unknown\x20api\x20command:\x20','error','datasetcode','\x1b[90m\x20\x20(Note:\x20--appcode\x20flag\x20matches\x20config,\x20using\x20default\x20config)\x1b[0m','object','Available\x20commands:','4390MUNicA','join','10obtCqx','1024819sdSToE','split','parse','filter','2454021SaAYBM','Please\x20use\x20one\x20of\x20the\x20following:','AppCode\x20not\x20configured','Please\x20use\x20the\x20--appcode\x20flag,\x20for\x20example:','exit','4983VxZRLK','\x20\x20rabetbase\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Generate\x20docs\x20for\x20specified\x20environment','\x1b[90m*\x20Generating\x20docs\x20only\x20for\x20specified\x20datasets:\x20','\x20\x20rabetbase\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Pull\x20API\x20for\x20specified\x20environment','help','Error:\x20Positional\x20arguments\x20are\x20no\x20longer\x20supported','7bzmosv','77214LQNvZz','\x20\x20rabetbase\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Specify\x20doc\x20output\x20directory','message','\x20\x20rabetbase\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20Use\x20specified\x20appcode','input','log','length','45XktThY','flags','\x20\x20\x201.\x20Set\x20default:\x20rabetbase\x20config\x20set\x20appcode\x20<app-code>','\x1b[0m'];a6_0x3f5f=function(){return _0x155d0e;};return a6_0x3f5f();}
|
package/lib/api/pull-silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x16d7aa,_0x424d78){const _0x13b30b=a7_0x10af,_0x45673c=_0x16d7aa();while(!![]){try{const _0x14e5d0=parseInt(_0x13b30b(0xe2))/0x1+parseInt(_0x13b30b(0xcf))/0x2*(parseInt(_0x13b30b(0xcc))/0x3)+parseInt(_0x13b30b(0xd7))/0x4*(parseInt(_0x13b30b(0xdd))/0x5)+parseInt(_0x13b30b(0xc4))/0x6*(-parseInt(_0x13b30b(0xbe))/0x7)+parseInt(_0x13b30b(0xbf))/0x8+-parseInt(_0x13b30b(0xce))/0x9+parseInt(_0x13b30b(0xdb))/0xa*(-parseInt(_0x13b30b(0xe0))/0xb);if(_0x14e5d0===_0x424d78)break;else _0x45673c['push'](_0x45673c['shift']());}catch(_0x2ca40d){_0x45673c['push'](_0x45673c['shift']());}}}(a7_0x3649,0xbfe0c));import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a7_0x3649(){const _0x195207=['.ts\x20-\x20Client\x20instance\x20file','info','78aOnAaW','client','6600033qDfBpO','986fKDAOr','√\x20Pulled\x20','message','\x20datasets,\x20generated\x20','chdir','trim','API\x20配置拉取成功:\x20','cwd','456172oCEQlO','\x20datasets...','log','*\x20Pulling\x20API\x20config\x20from\x20server...\x20(env:\x20','113110sDpupe','×\x20Invalid\x20file\x20prefix.\x20Only\x20letters,\x20numbers,\x20hyphens\x20and\x20underscores\x20allowed,\x20must\x20start\x20with\x20a\x20letter.','55CdQuLk','\x20models','API\x20配置拉取异常:\x20','451GOHASP','*\x20Processing\x20','422247utQACO','\x20\x20\x20•\x20','error','49MLHAGb','9398200pWGgXL','production','length','-api','string','755394xcDsAE','test','modelCount','-client','apiDir','env'];a7_0x3649=function(){return _0x195207;};return a7_0x3649();}import{generateApiFile}from'./generate-api-file.js';function a7_0x10af(_0x126cf9,_0x2c90db){_0x126cf9=_0x126cf9-0xbc;const _0x364980=a7_0x3649();let _0x10afae=_0x364980[_0x126cf9];return _0x10afae;}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x79fad4,_0x585e7d,_0x1f3523,_0x459665){const _0x786e2e=a7_0x10af;let _0x1bdf48;try{const _0x32da47=_0x585e7d?.[_0x786e2e(0xd4)]()||'';if(_0x32da47){const _0x45b926=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x45b926[_0x786e2e(0xc5)](_0x32da47))return console['error'](_0x786e2e(0xdc)),![];}_0x1f3523&&(_0x1bdf48=process[_0x786e2e(0xd6)](),process['chdir'](_0x1f3523));const _0x1a554b=readConfig(),_0x41002e=typeof _0x1a554b[_0x786e2e(0xc9)]===_0x786e2e(0xc3)?_0x1a554b[_0x786e2e(0xc9)]:undefined,_0x42cdd8=_0x459665||_0x41002e||_0x786e2e(0xc0);initEnv(_0x42cdd8),console[_0x786e2e(0xd9)](_0x786e2e(0xda)+_0x42cdd8+')');const {configArray:_0x159b79}=await fetchModelList(_0x79fad4),_0x50b3a0=_0x32da47?_0x32da47+_0x786e2e(0xc2):'api',_0x162b80=_0x32da47?_0x32da47+_0x786e2e(0xc7):_0x786e2e(0xcd);console[_0x786e2e(0xd9)]('*\x20Generating\x20API\x20config\x20files:'),console[_0x786e2e(0xd9)](_0x786e2e(0xbc)+_0x50b3a0+'.ts\x20-\x20Model\x20config\x20file'),console[_0x786e2e(0xd9)](_0x786e2e(0xbc)+_0x162b80+_0x786e2e(0xca)),console['log'](_0x786e2e(0xe1)+_0x159b79[_0x786e2e(0xc1)]+_0x786e2e(0xd8));const _0x6d18b3=typeof _0x1a554b[_0x786e2e(0xc8)]===_0x786e2e(0xc3)?_0x1a554b[_0x786e2e(0xc8)]:undefined,_0x3678af=await generateApiFile(_0x159b79,_0x32da47,_0x79fad4,!![],_0x42cdd8,_0x6d18b3||'./src/api/');return console[_0x786e2e(0xd9)](_0x786e2e(0xd0)+_0x159b79[_0x786e2e(0xc1)]+_0x786e2e(0xd2)+_0x3678af[_0x786e2e(0xc6)]+_0x786e2e(0xde)),_0x1f3523&&logger[_0x786e2e(0xcb)]('create-api-pull',_0x786e2e(0xd5)+_0x79fad4,{'projectPath':_0x1f3523,'appCode':_0x79fad4,'datasetCount':_0x159b79['length'],'filePrefix':_0x32da47}),!![];}catch(_0x480928){const _0x134cbb=_0x480928 instanceof Error?_0x480928[_0x786e2e(0xd1)]:String(_0x480928);return console[_0x786e2e(0xbd)]('×\x20API\x20config\x20pull\x20failed:\x20'+_0x134cbb),_0x1f3523&&logger[_0x786e2e(0xbd)]('create-api-pull',_0x786e2e(0xdf)+_0x134cbb,{'appCode':_0x79fad4,'projectPath':_0x1f3523}),![];}finally{_0x1bdf48&&process[_0x786e2e(0xd3)](_0x1bdf48);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x5efb3a,_0x1ee91f){const _0x386d67=a8_0x136b,_0x528c49=_0x5efb3a();while(!![]){try{const _0x267381=-parseInt(_0x386d67(0x12d))/0x1*(parseInt(_0x386d67(0x12b))/0x2)+parseInt(_0x386d67(0x142))/0x3+-parseInt(_0x386d67(0x14c))/0x4+parseInt(_0x386d67(0x165))/0x5*(-parseInt(_0x386d67(0x159))/0x6)+-parseInt(_0x386d67(0x169))/0x7*(-parseInt(_0x386d67(0x14a))/0x8)+parseInt(_0x386d67(0x13f))/0x9+parseInt(_0x386d67(0x14f))/0xa;if(_0x267381===_0x1ee91f)break;else _0x528c49['push'](_0x528c49['shift']());}catch(_0x82e8f7){_0x528c49['push'](_0x528c49['shift']());}}}(a8_0x244e,0x7184d));import{jsx as a8_0x29aa4c,jsxs as a8_0x195ad6,Fragment as a8_0x352d22}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';function a8_0x244e(){const _0x473061=['Failed\x20to\x20create\x20menu','Hint:\x20use\x20','fill','upArrow','JS\x20URL','local','has','\x20command\x20to\x20re-login','\x20Enter\x20project\x20CSS\x20asset\x20URL\x20(https://...)','Please\x20select\x20at\x20least\x20one\x20menu','trim','selecting','column','yellow','input-js','3024801eUdfwf','filter','\x20items','1106718mwPuHV','gray','\x20←\x20','includes','map','CSS\x20URL','label','Menu\x20Name','104jVoMbW','√\x20Menu\x20creation\x20completed','1847796MraWxU','input-css','Selected\x20menus','8527510qLKlAu','online','backspace','test','delete','catch','size','repeat','Please\x20enter\x20a\x20valid\x20JS\x20https\x20URL','[\x20]','540lZtmpT','message','dots','slice','white','then','[✓]','creating','blue','green','Update','length','22535isdRhM','cyan','path','Create','231049OOrVLN','Lovrabet\x20Platform','add','max','value','join','return','red','261714seSLxJ','*\x20Select\x20menus\x20to\x20sync:','5npxnDa','done','Local'];a8_0x244e=function(){return _0x473061;};return a8_0x244e();}import a8_0xb82e28 from'ink-spinner';import{useGetOnlineMenuList}from'./use-get-online-menu-list.js';function a8_0x136b(_0xe1861e,_0x41ca27){_0xe1861e=_0xe1861e-0x126;const _0x244ebc=a8_0x244e();let _0x136b5d=_0x244ebc[_0xe1861e];return _0x136b5d;}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(a8_0x29aa4c(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x184960=a8_0x136b,{exit:_0xb7617a}=useApp(),{loading:_0x536907,menuList:_0xe6a22a,error:_0x41c18b}=useGetOnlineMenuList(),_0x267b60=getLocalPages(),_0x367a18=_0xe6a22a[_0x184960(0x146)](_0x5db56e=>_0x5db56e[_0x184960(0x167)]),_0x3f8c40=_0x184960(0x149),_0x573ac1=[_0x3f8c40,..._0x267b60[_0x184960(0x146)](_0xa8a16c=>_0xa8a16c['label'])],_0x2294f4=getStringWidth(getMaxWidth(_0x573ac1,0x4)),_0x5e3dce=getStringWidth(getMaxWidth([_0x3f8c40])),[_0x4d56ae,_0x58c3bc]=useState(_0x184960(0x13b)),[_0x1aa4e8,_0xc1ada4]=useState(new Set()),[_0x43f639,_0x47c91d]=useState(0x0),[_0x3e4623,_0x5ba1aa]=useState(''),[_0x239581,_0x18d564]=useState(''),[_0x290c0a,_0x1dd19f]=useState(''),[_0x385589,_0x567380]=useState(''),[_0x32fa48,_0x2ea9aa]=useState([]),_0x508391=_0x267b60[_0x184960(0x146)](_0x17e9f3=>({'label':_0x17e9f3[_0x184960(0x148)],'path':_0x17e9f3[_0x184960(0x167)],'local':!![],'online':_0x367a18['includes'](_0x17e9f3['path'])})),_0x12d742=_0x267b60['filter'](_0x5a14c1=>{return!_0x367a18['includes'](_0x5a14c1['path']);});useEffect(()=>{const _0x54227e=_0x184960;if(!_0x536907&&_0x267b60['length']>0x0&&_0x1aa4e8['size']===0x0){const _0x1572e3=new Set(_0x267b60[_0x54227e(0x146)]((_0xffd142,_0x367a23)=>({'page':_0xffd142,'index':_0x367a23}))[_0x54227e(0x140)](({page:_0x58caca})=>!_0x367a18[_0x54227e(0x145)](_0x58caca[_0x54227e(0x167)]))[_0x54227e(0x146)](({index:_0x1b886e})=>_0x1b886e));_0xc1ada4(_0x1572e3);}},[_0x536907,_0x267b60[_0x184960(0x164)],_0x367a18[_0x184960(0x164)]]),useInput(async(_0x3671b8,_0x20b858)=>{const _0x34de94=_0x184960;if(_0x4d56ae===_0x34de94(0x13b)){if(_0x20b858[_0x34de94(0x133)]){_0x47c91d(_0x2b6925=>_0x2b6925>0x0?_0x2b6925-0x1:_0x267b60['length']-0x1);return;}if(_0x20b858['downArrow']){_0x47c91d(_0x58d479=>_0x58d479<_0x267b60[_0x34de94(0x164)]-0x1?_0x58d479+0x1:0x0);return;}if(_0x3671b8==='\x20'){_0xc1ada4(_0x5cf21e=>{const _0x13176f=_0x34de94,_0x3713e6=new Set(_0x5cf21e);return _0x3713e6[_0x13176f(0x136)](_0x43f639)?_0x3713e6[_0x13176f(0x153)](_0x43f639):_0x3713e6['add'](_0x43f639),_0x3713e6;});return;}if(_0x3671b8==='a'||_0x3671b8==='A'){const _0x549985=new Set(_0x267b60['map']((_0x21f8da,_0x3b0d79)=>_0x3b0d79));_0xc1ada4(_0x549985);return;}if(_0x3671b8==='i'||_0x3671b8==='I'||_0x3671b8==='r'||_0x3671b8==='R'){_0xc1ada4(_0x4aa8be=>{const _0x11fbed=_0x34de94,_0x244b15=new Set();for(let _0x8208c7=0x0;_0x8208c7<_0x267b60[_0x11fbed(0x164)];_0x8208c7++){!_0x4aa8be['has'](_0x8208c7)&&_0x244b15[_0x11fbed(0x16b)](_0x8208c7);}return _0x244b15;});return;}if(_0x3671b8==='q'||_0x3671b8==='Q'){_0xb7617a();return;}if(_0x20b858[_0x34de94(0x129)]){if(_0x1aa4e8[_0x34de94(0x155)]===0x0){_0x567380(_0x34de94(0x139));return;}const _0x797531=_0x267b60['filter']((_0x18982c,_0x15aebf)=>_0x1aa4e8['has'](_0x15aebf)),_0x217527=_0x797531[_0x34de94(0x146)](_0x54b937=>_0x54b937['label'])[_0x34de94(0x128)](',\x20');_0x2ea9aa([{'label':_0x34de94(0x14e),'value':_0x1aa4e8[_0x34de94(0x155)]+_0x34de94(0x141)}]),_0x567380(''),_0x58c3bc(_0x34de94(0x13e));return;}return;}if(_0x4d56ae==='input-js'){if(_0x20b858[_0x34de94(0x129)]){const _0x1a8714=_0x290c0a[_0x34de94(0x13a)]();if(_0x1a8714==='')return;if(!isValidJsHttpsUrl(_0x1a8714)){_0x567380(_0x34de94(0x157));return;}if(!await isUrlReachable(_0x1a8714)){_0x567380('JS\x20URL\x20is\x20unreachable');return;}_0x5ba1aa(_0x1a8714),_0x2ea9aa(_0x3aecd0=>[..._0x3aecd0,{'label':_0x34de94(0x134),'value':_0x1a8714}]),_0x1dd19f(''),_0x567380(''),_0x58c3bc(_0x34de94(0x14d));return;}if(_0x20b858[_0x34de94(0x151)]||_0x20b858[_0x34de94(0x153)]){_0x1dd19f(_0x39c917=>_0x39c917[_0x34de94(0x15c)](0x0,-0x1)),_0x567380('');return;}_0x1dd19f(_0x53114c=>_0x53114c+_0x3671b8);return;}if(_0x4d56ae===_0x34de94(0x14d)){if(_0x20b858['return']){const _0x39dd57=_0x290c0a[_0x34de94(0x13a)]();if(_0x39dd57==='')return;if(!isValidCssHttpsUrl(_0x39dd57)){_0x567380('Please\x20enter\x20a\x20valid\x20CSS\x20https\x20URL');return;}if(!await isUrlReachable(_0x39dd57)){_0x567380('CSS\x20URL\x20is\x20unreachable');return;}_0x18d564(_0x39dd57),_0x2ea9aa(_0x5e217c=>[..._0x5e217c,{'label':_0x34de94(0x147),'value':_0x39dd57}]),_0x1dd19f(''),_0x567380(''),_0x58c3bc(_0x34de94(0x160));const _0xdf0d5=_0x267b60[_0x34de94(0x140)]((_0x4fa839,_0x4e7e7c)=>_0x1aa4e8['has'](_0x4e7e7c));createMenus(_0xdf0d5,[_0x3e4623,_0x39dd57])[_0x34de94(0x15e)](()=>{_0x58c3bc('done'),setTimeout(()=>{_0xb7617a();},0x3e8);})[_0x34de94(0x154)](_0x344c15=>{const _0x5e0998=_0x34de94;_0x567380(_0x344c15[_0x5e0998(0x15a)]||_0x5e0998(0x130)),_0x58c3bc(_0x5e0998(0x13b));});return;}if(_0x20b858['backspace']||_0x20b858['delete']){_0x1dd19f(_0x81449f=>_0x81449f[_0x34de94(0x15c)](0x0,-0x1)),_0x567380('');return;}_0x1dd19f(_0x4394cb=>_0x4394cb+_0x3671b8);return;}});if(_0x536907)return a8_0x195ad6(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a8_0x29aa4c(Text,{'children':'\x20\x20'}),a8_0x29aa4c(a8_0xb82e28,{'type':_0x184960(0x15b)}),a8_0x29aa4c(Text,{'children':'\x20Fetching\x20online\x20menu\x20list...'})]});if(_0x41c18b)return a8_0x195ad6(Box,{'flexDirection':_0x184960(0x13c),'marginTop':0x1,'marginBottom':0x1,'children':[a8_0x195ad6(Text,{'color':_0x184960(0x12a),'children':['✗\x20',_0x41c18b]}),a8_0x195ad6(Box,{'marginTop':0x1,'children':[a8_0x29aa4c(Text,{'color':'gray','children':_0x184960(0x131)}),a8_0x29aa4c(Text,{'color':_0x184960(0x166),'children':'rabetbase\x20auth'}),a8_0x29aa4c(Text,{'color':'gray','children':_0x184960(0x137)})]})]});if(_0x267b60[_0x184960(0x164)]===0x0)return a8_0x29aa4c(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a8_0x29aa4c(Text,{'color':_0x184960(0x13d),'children':'!\x20No\x20local\x20pages\x20found,\x20please\x20create\x20pages\x20first'})});return a8_0x195ad6(Box,{'flexDirection':_0x184960(0x13c),'marginTop':0x1,'marginBottom':0x1,'children':[_0x4d56ae==='selecting'&&a8_0x195ad6(a8_0x352d22,{'children':[a8_0x195ad6(Box,{'children':[a8_0x195ad6(Text,{'bold':!![],'children':['\x20\x20',_0x3f8c40,getRemainingSpaces(_0x2294f4,_0x3f8c40)]}),a8_0x195ad6(Text,{'bold':!![],'children':[_0x184960(0x12f),getRemainingSpaces(_0x5e3dce,_0x3f8c40)]}),a8_0x195ad6(Text,{'bold':!![],'children':[_0x184960(0x16a),getRemainingSpaces(_0x5e3dce,_0x3f8c40)]})]}),_0x508391[_0x184960(0x146)](_0x3ff01d=>a8_0x195ad6(Box,{'children':[a8_0x195ad6(Text,{'children':['\x20\x20',_0x3ff01d[_0x184960(0x148)],getRemainingSpaces(_0x2294f4,_0x3ff01d[_0x184960(0x148)])]}),a8_0x195ad6(Text,{'color':_0x184960(0x162),'children':[_0x3ff01d[_0x184960(0x135)]?'✓':'✗',getRemainingSpaces(_0x5e3dce,'✓')]}),a8_0x195ad6(Text,{'color':_0x3ff01d[_0x184960(0x150)]?_0x184960(0x162):_0x184960(0x12a),'children':[_0x3ff01d[_0x184960(0x150)]?'✓':'✗',getRemainingSpaces(_0x5e3dce,'✓')]})]},_0x3ff01d[_0x184960(0x167)]))]}),_0x4d56ae==='selecting'&&_0x32fa48[_0x184960(0x164)]===0x0&&a8_0x29aa4c(Box,{'marginTop':0x1,'children':a8_0x29aa4c(Text,{'color':_0x184960(0x166),'children':'*\x20Sync\x20menus\x20to\x20Lovrabet\x20platform'})}),_0x32fa48[_0x184960(0x146)]((_0x4615d5,_0x27dbd4)=>a8_0x195ad6(Box,{'children':[a8_0x195ad6(Text,{'color':_0x184960(0x162),'children':['√\x20',_0x4615d5[_0x184960(0x148)],':\x20']}),a8_0x29aa4c(Text,{'color':_0x184960(0x166),'children':_0x4615d5[_0x184960(0x127)]})]},_0x27dbd4)),_0x385589&&_0x4d56ae===_0x184960(0x13b)&&a8_0x29aa4c(Box,{'marginTop':0x1,'children':a8_0x195ad6(Text,{'color':_0x184960(0x12a),'children':['✗\x20',_0x385589]})}),_0x4d56ae===_0x184960(0x13b)&&a8_0x29aa4c(a8_0x352d22,{'children':a8_0x195ad6(Box,{'marginTop':_0x32fa48[_0x184960(0x164)]>0x0||_0x385589?0x1:0x0,'flexDirection':'column','children':[a8_0x29aa4c(Text,{'bold':!![],'children':_0x184960(0x12c)}),_0x267b60[_0x184960(0x146)]((_0x40f4fd,_0x48ac25)=>{const _0x4b06c3=_0x184960,_0x43627c=_0x43f639===_0x48ac25,_0x15f7c1=_0x1aa4e8[_0x4b06c3(0x136)](_0x48ac25),_0x30f87e=_0x367a18['includes'](_0x40f4fd['path']),_0x8df9a6=_0x30f87e?_0x4b06c3(0x163):_0x4b06c3(0x168);return a8_0x29aa4c(Box,{'children':a8_0x195ad6(Text,{'backgroundColor':_0x43627c?_0x4b06c3(0x161):undefined,'color':_0x43627c?_0x4b06c3(0x15d):undefined,'children':['\x20\x20',_0x15f7c1?_0x4b06c3(0x15f):_0x4b06c3(0x158),'\x20',_0x40f4fd['label']]})},_0x40f4fd[_0x4b06c3(0x167)]);}),a8_0x29aa4c(Box,{'marginTop':0x1,'children':a8_0x29aa4c(Text,{'color':_0x184960(0x143),'children':'\x20↑/↓:\x20Move\x20\x20Space:\x20Toggle\x20\x20a:\x20All\x20\x20i/r:\x20Invert\x20\x20Enter:\x20Confirm'})})]})}),_0x4d56ae==='input-js'&&a8_0x195ad6(a8_0x352d22,{'children':[a8_0x195ad6(Box,{'children':[a8_0x29aa4c(Text,{'children':'*\x20JS\x20URL:\x20'}),a8_0x29aa4c(Text,{'color':_0x184960(0x162),'children':_0x290c0a}),_0x385589&&a8_0x195ad6(Text,{'color':'red','children':[_0x184960(0x144),_0x385589]})]}),!_0x385589&&a8_0x29aa4c(Box,{'children':a8_0x29aa4c(Text,{'color':_0x184960(0x143),'children':'\x20Enter\x20project\x20JS\x20asset\x20URL\x20(https://...)'})})]}),_0x4d56ae===_0x184960(0x14d)&&a8_0x195ad6(a8_0x352d22,{'children':[a8_0x195ad6(Box,{'children':[a8_0x29aa4c(Text,{'children':'*\x20CSS\x20URL:\x20'}),a8_0x29aa4c(Text,{'color':_0x184960(0x162),'children':_0x290c0a}),_0x385589&&a8_0x195ad6(Text,{'color':_0x184960(0x12a),'children':[_0x184960(0x144),_0x385589]})]}),!_0x385589&&a8_0x29aa4c(Box,{'children':a8_0x29aa4c(Text,{'color':'gray','children':_0x184960(0x138)})})]}),_0x4d56ae===_0x184960(0x160)&&a8_0x29aa4c(Box,{'children':a8_0x29aa4c(Text,{'children':'*\x20Creating\x20menus...'})}),_0x4d56ae===_0x184960(0x12e)&&a8_0x29aa4c(Box,{'children':a8_0x29aa4c(Text,{'color':_0x184960(0x162),'children':_0x184960(0x14b)})})]});}function getStringWidth(_0x3d6175){const _0x3b1a45=a8_0x136b;let _0x7b670b=0x0;for(const _0x3a25ae of _0x3d6175){/[\u4e00-\u9fa5]/[_0x3b1a45(0x152)](_0x3a25ae)?_0x7b670b+=0x2:_0x7b670b+=0x1;}return _0x7b670b;}function getRemainingSpaces(_0xc2436a,_0x11f27a){const _0xd9ac0f=a8_0x136b,_0x4e5d3f=getStringWidth(_0x11f27a);return Array(Math[_0xd9ac0f(0x126)](0x0,_0xc2436a-_0x4e5d3f))[_0xd9ac0f(0x132)]('\x20')[_0xd9ac0f(0x128)]('');}function getMaxWidth(_0x38092f,_0x4fa959=0x2){const _0x5016ee=a8_0x136b;let _0x5df4a7='',_0x34fc9d=0x0;for(const _0x36ee68 of _0x38092f){const _0x3d1bf8=getStringWidth(_0x36ee68);_0x3d1bf8>_0x34fc9d&&(_0x34fc9d=_0x3d1bf8,_0x5df4a7=_0x36ee68);}return _0x5df4a7+'\x20'[_0x5016ee(0x156)](_0x4fa959);}
|
|
1
|
+
function a8_0xda03(_0x24a924,_0x308afd){_0x24a924=_0x24a924-0xa7;const _0x129540=a8_0x1295();let _0xda0380=_0x129540[_0x24a924];return _0xda0380;}(function(_0x194c30,_0x264fcb){const _0xa7ab67=a8_0xda03,_0xe71dee=_0x194c30();while(!![]){try{const _0x1060fc=parseInt(_0xa7ab67(0xea))/0x1*(-parseInt(_0xa7ab67(0xec))/0x2)+-parseInt(_0xa7ab67(0xb0))/0x3+parseInt(_0xa7ab67(0xde))/0x4+-parseInt(_0xa7ab67(0xc7))/0x5*(-parseInt(_0xa7ab67(0xe8))/0x6)+parseInt(_0xa7ab67(0xdf))/0x7+-parseInt(_0xa7ab67(0xbd))/0x8*(-parseInt(_0xa7ab67(0xc8))/0x9)+parseInt(_0xa7ab67(0xaa))/0xa*(-parseInt(_0xa7ab67(0xb1))/0xb);if(_0x1060fc===_0x264fcb)break;else _0xe71dee['push'](_0xe71dee['shift']());}catch(_0x51ec1a){_0xe71dee['push'](_0xe71dee['shift']());}}}(a8_0x1295,0x73235));import{jsx as a8_0x20a180,jsxs as a8_0x1cf8ea,Fragment as a8_0x12deb7}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a8_0x50f54b 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(a8_0x20a180(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x2b627a=a8_0xda03,{exit:_0x5b7149}=useApp(),{loading:_0x3b8d94,menuList:_0x31acae,error:_0x1e507b}=useGetOnlineMenuList(),_0x3b632b=getLocalPages(),_0x49e1b1=_0x31acae['map'](_0x1afbcd=>_0x1afbcd['path']),_0x50d079=_0x2b627a(0xd5),_0x5ec0d8=[_0x50d079,..._0x3b632b[_0x2b627a(0xba)](_0x3d6c4b=>_0x3d6c4b[_0x2b627a(0xc3)])],_0x42e75f=getStringWidth(getMaxWidth(_0x5ec0d8,0x4)),_0xccbde9=getStringWidth(getMaxWidth([_0x50d079])),[_0x21c611,_0x3b2992]=useState(_0x2b627a(0xa8)),[_0x1e419e,_0x432675]=useState(new Set()),[_0x4305c9,_0x27910f]=useState(0x0),[_0x4dc4b5,_0x2805d4]=useState(''),[_0x3f1bbf,_0x1501ec]=useState(''),[_0x5cf347,_0xaeb572]=useState(''),[_0x17cf53,_0x2bc092]=useState(''),[_0x333e9d,_0x14a7b2]=useState([]),_0x5641e1=_0x3b632b[_0x2b627a(0xba)](_0x275555=>({'label':_0x275555[_0x2b627a(0xc3)],'path':_0x275555[_0x2b627a(0xc4)],'local':!![],'online':_0x49e1b1['includes'](_0x275555[_0x2b627a(0xc4)])})),_0x234e81=_0x3b632b[_0x2b627a(0xd1)](_0x372618=>{const _0x4ac10a=_0x2b627a;return!_0x49e1b1[_0x4ac10a(0xb2)](_0x372618[_0x4ac10a(0xc4)]);});useEffect(()=>{const _0x1d5927=_0x2b627a;if(!_0x3b8d94&&_0x3b632b['length']>0x0&&_0x1e419e['size']===0x0){const _0x13fbfd=new Set(_0x3b632b[_0x1d5927(0xba)]((_0x5ca53c,_0x15a58e)=>({'page':_0x5ca53c,'index':_0x15a58e}))[_0x1d5927(0xd1)](({page:_0x220313})=>!_0x49e1b1[_0x1d5927(0xb2)](_0x220313[_0x1d5927(0xc4)]))[_0x1d5927(0xba)](({index:_0xf9b04f})=>_0xf9b04f));_0x432675(_0x13fbfd);}},[_0x3b8d94,_0x3b632b['length'],_0x49e1b1[_0x2b627a(0xeb)]]),useInput(async(_0xe698ea,_0x1f1a1d)=>{const _0x23e94f=_0x2b627a;if(_0x21c611===_0x23e94f(0xa8)){if(_0x1f1a1d[_0x23e94f(0xcb)]){_0x27910f(_0x243219=>_0x243219>0x0?_0x243219-0x1:_0x3b632b[_0x23e94f(0xeb)]-0x1);return;}if(_0x1f1a1d[_0x23e94f(0xdc)]){_0x27910f(_0x2ae5bb=>_0x2ae5bb<_0x3b632b[_0x23e94f(0xeb)]-0x1?_0x2ae5bb+0x1:0x0);return;}if(_0xe698ea==='\x20'){_0x432675(_0x1bfd23=>{const _0xdb4671=_0x23e94f,_0x50c013=new Set(_0x1bfd23);return _0x50c013[_0xdb4671(0xdd)](_0x4305c9)?_0x50c013['delete'](_0x4305c9):_0x50c013['add'](_0x4305c9),_0x50c013;});return;}if(_0xe698ea==='a'||_0xe698ea==='A'){const _0x3528d0=new Set(_0x3b632b['map']((_0x2f4d10,_0x59680d)=>_0x59680d));_0x432675(_0x3528d0);return;}if(_0xe698ea==='i'||_0xe698ea==='I'||_0xe698ea==='r'||_0xe698ea==='R'){_0x432675(_0x433c26=>{const _0x4eb87d=_0x23e94f,_0x186e5f=new Set();for(let _0x57ee67=0x0;_0x57ee67<_0x3b632b[_0x4eb87d(0xeb)];_0x57ee67++){!_0x433c26['has'](_0x57ee67)&&_0x186e5f['add'](_0x57ee67);}return _0x186e5f;});return;}if(_0xe698ea==='q'||_0xe698ea==='Q'){_0x5b7149();return;}if(_0x1f1a1d[_0x23e94f(0xb8)]){if(_0x1e419e['size']===0x0){_0x2bc092('Please\x20select\x20at\x20least\x20one\x20menu');return;}const _0x2e5f58=_0x3b632b['filter']((_0x41ad49,_0x510580)=>_0x1e419e[_0x23e94f(0xdd)](_0x510580)),_0x55bf3e=_0x2e5f58[_0x23e94f(0xba)](_0x2ee414=>_0x2ee414['label'])[_0x23e94f(0xa9)](',\x20');_0x14a7b2([{'label':_0x23e94f(0xb6),'value':_0x1e419e['size']+_0x23e94f(0xac)}]),_0x2bc092(''),_0x3b2992('input-js');return;}return;}if(_0x21c611===_0x23e94f(0xc2)){if(_0x1f1a1d['return']){const _0x14ce80=_0x5cf347[_0x23e94f(0xbb)]();if(_0x14ce80==='')return;if(!isValidJsHttpsUrl(_0x14ce80)){_0x2bc092(_0x23e94f(0xe5));return;}if(!await isUrlReachable(_0x14ce80)){_0x2bc092(_0x23e94f(0xe6));return;}_0x2805d4(_0x14ce80),_0x14a7b2(_0xd6798f=>[..._0xd6798f,{'label':_0x23e94f(0xda),'value':_0x14ce80}]),_0xaeb572(''),_0x2bc092(''),_0x3b2992('input-css');return;}if(_0x1f1a1d[_0x23e94f(0xce)]||_0x1f1a1d['delete']){_0xaeb572(_0x53ce3a=>_0x53ce3a[_0x23e94f(0xc1)](0x0,-0x1)),_0x2bc092('');return;}_0xaeb572(_0x32e0a4=>_0x32e0a4+_0xe698ea);return;}if(_0x21c611===_0x23e94f(0xad)){if(_0x1f1a1d[_0x23e94f(0xb8)]){const _0x5cb758=_0x5cf347[_0x23e94f(0xbb)]();if(_0x5cb758==='')return;if(!isValidCssHttpsUrl(_0x5cb758)){_0x2bc092(_0x23e94f(0xe2));return;}if(!await isUrlReachable(_0x5cb758)){_0x2bc092(_0x23e94f(0xe3));return;}_0x1501ec(_0x5cb758),_0x14a7b2(_0x165ccf=>[..._0x165ccf,{'label':_0x23e94f(0xe7),'value':_0x5cb758}]),_0xaeb572(''),_0x2bc092(''),_0x3b2992('creating');const _0x6f871f=_0x3b632b[_0x23e94f(0xd1)]((_0x49bcce,_0x329b9a)=>_0x1e419e[_0x23e94f(0xdd)](_0x329b9a));createMenus(_0x6f871f,[_0x4dc4b5,_0x5cb758])[_0x23e94f(0xcc)](()=>{const _0x5aa495=_0x23e94f;_0x3b2992(_0x5aa495(0xcd)),setTimeout(()=>{_0x5b7149();},0x3e8);})[_0x23e94f(0xd8)](_0x1fcbbe=>{const _0x4d9988=_0x23e94f;_0x2bc092(_0x1fcbbe['message']||_0x4d9988(0xb5)),_0x3b2992('selecting');});return;}if(_0x1f1a1d['backspace']||_0x1f1a1d['delete']){_0xaeb572(_0x13e7d6=>_0x13e7d6[_0x23e94f(0xc1)](0x0,-0x1)),_0x2bc092('');return;}_0xaeb572(_0x408e2a=>_0x408e2a+_0xe698ea);return;}});if(_0x3b8d94)return a8_0x1cf8ea(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a8_0x20a180(Text,{'children':'\x20\x20'}),a8_0x20a180(a8_0x50f54b,{'type':_0x2b627a(0xd6)}),a8_0x20a180(Text,{'children':'\x20Fetching\x20online\x20menu\x20list...'})]});if(_0x1e507b)return a8_0x1cf8ea(Box,{'flexDirection':_0x2b627a(0xab),'marginTop':0x1,'marginBottom':0x1,'children':[a8_0x1cf8ea(Text,{'color':_0x2b627a(0xc9),'children':['✗\x20',_0x1e507b]}),a8_0x1cf8ea(Box,{'marginTop':0x1,'children':[a8_0x20a180(Text,{'color':'gray','children':_0x2b627a(0xb9)}),a8_0x20a180(Text,{'color':_0x2b627a(0xef),'children':_0x2b627a(0xbf)}),a8_0x20a180(Text,{'color':_0x2b627a(0xd4),'children':_0x2b627a(0xe9)})]})]});if(_0x3b632b['length']===0x0)return a8_0x20a180(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a8_0x20a180(Text,{'color':_0x2b627a(0xd9),'children':_0x2b627a(0xe1)})});return a8_0x1cf8ea(Box,{'flexDirection':_0x2b627a(0xab),'marginTop':0x1,'marginBottom':0x1,'children':[_0x21c611===_0x2b627a(0xa8)&&a8_0x1cf8ea(a8_0x12deb7,{'children':[a8_0x1cf8ea(Box,{'children':[a8_0x1cf8ea(Text,{'bold':!![],'children':['\x20\x20',_0x50d079,getRemainingSpaces(_0x42e75f,_0x50d079)]}),a8_0x1cf8ea(Text,{'bold':!![],'children':[_0x2b627a(0xc0),getRemainingSpaces(_0xccbde9,_0x50d079)]}),a8_0x1cf8ea(Text,{'bold':!![],'children':['Lovrabet\x20Platform',getRemainingSpaces(_0xccbde9,_0x50d079)]})]}),_0x5641e1['map'](_0x3a3bc6=>a8_0x1cf8ea(Box,{'children':[a8_0x1cf8ea(Text,{'children':['\x20\x20',_0x3a3bc6[_0x2b627a(0xc3)],getRemainingSpaces(_0x42e75f,_0x3a3bc6['label'])]}),a8_0x1cf8ea(Text,{'color':'green','children':[_0x3a3bc6[_0x2b627a(0xc6)]?'✓':'✗',getRemainingSpaces(_0xccbde9,'✓')]}),a8_0x1cf8ea(Text,{'color':_0x3a3bc6['online']?_0x2b627a(0xe4):'red','children':[_0x3a3bc6[_0x2b627a(0xb7)]?'✓':'✗',getRemainingSpaces(_0xccbde9,'✓')]})]},_0x3a3bc6['path']))]}),_0x21c611==='selecting'&&_0x333e9d['length']===0x0&&a8_0x20a180(Box,{'marginTop':0x1,'children':a8_0x20a180(Text,{'color':_0x2b627a(0xef),'children':'*\x20Sync\x20menus\x20to\x20Lovrabet\x20platform'})}),_0x333e9d[_0x2b627a(0xba)]((_0xed7dc9,_0x50ea9e)=>a8_0x1cf8ea(Box,{'children':[a8_0x1cf8ea(Text,{'color':_0x2b627a(0xe4),'children':['√\x20',_0xed7dc9[_0x2b627a(0xc3)],':\x20']}),a8_0x20a180(Text,{'color':_0x2b627a(0xef),'children':_0xed7dc9[_0x2b627a(0xae)]})]},_0x50ea9e)),_0x17cf53&&_0x21c611==='selecting'&&a8_0x20a180(Box,{'marginTop':0x1,'children':a8_0x1cf8ea(Text,{'color':'red','children':['✗\x20',_0x17cf53]})}),_0x21c611===_0x2b627a(0xa8)&&a8_0x20a180(a8_0x12deb7,{'children':a8_0x1cf8ea(Box,{'marginTop':_0x333e9d[_0x2b627a(0xeb)]>0x0||_0x17cf53?0x1:0x0,'flexDirection':_0x2b627a(0xab),'children':[a8_0x20a180(Text,{'bold':!![],'children':'*\x20Select\x20menus\x20to\x20sync:'}),_0x3b632b['map']((_0x1666a8,_0x1cd77f)=>{const _0x41ae49=_0x2b627a,_0x18b7d8=_0x4305c9===_0x1cd77f,_0x28a24d=_0x1e419e[_0x41ae49(0xdd)](_0x1cd77f),_0x3d571c=_0x49e1b1['includes'](_0x1666a8['path']),_0x2284b8=_0x3d571c?_0x41ae49(0xe0):_0x41ae49(0xcf);return a8_0x20a180(Box,{'children':a8_0x1cf8ea(Text,{'backgroundColor':_0x18b7d8?_0x41ae49(0xbe):undefined,'color':_0x18b7d8?_0x41ae49(0xb4):undefined,'children':['\x20\x20',_0x28a24d?_0x41ae49(0xd3):_0x41ae49(0xaf),'\x20',_0x1666a8['label']]})},_0x1666a8['path']);}),a8_0x20a180(Box,{'marginTop':0x1,'children':a8_0x20a180(Text,{'color':'gray','children':_0x2b627a(0xbc)})})]})}),_0x21c611===_0x2b627a(0xc2)&&a8_0x1cf8ea(a8_0x12deb7,{'children':[a8_0x1cf8ea(Box,{'children':[a8_0x20a180(Text,{'children':_0x2b627a(0xb3)}),a8_0x20a180(Text,{'color':'green','children':_0x5cf347}),_0x17cf53&&a8_0x1cf8ea(Text,{'color':_0x2b627a(0xc9),'children':['\x20←\x20',_0x17cf53]})]}),!_0x17cf53&&a8_0x20a180(Box,{'children':a8_0x20a180(Text,{'color':'gray','children':'\x20Enter\x20project\x20JS\x20asset\x20URL\x20(https://...)'})})]}),_0x21c611===_0x2b627a(0xad)&&a8_0x1cf8ea(a8_0x12deb7,{'children':[a8_0x1cf8ea(Box,{'children':[a8_0x20a180(Text,{'children':_0x2b627a(0xca)}),a8_0x20a180(Text,{'color':_0x2b627a(0xe4),'children':_0x5cf347}),_0x17cf53&&a8_0x1cf8ea(Text,{'color':'red','children':[_0x2b627a(0xd2),_0x17cf53]})]}),!_0x17cf53&&a8_0x20a180(Box,{'children':a8_0x20a180(Text,{'color':_0x2b627a(0xd4),'children':_0x2b627a(0xed)})})]}),_0x21c611===_0x2b627a(0xc5)&&a8_0x20a180(Box,{'children':a8_0x20a180(Text,{'children':_0x2b627a(0xd7)})}),_0x21c611==='done'&&a8_0x20a180(Box,{'children':a8_0x20a180(Text,{'color':_0x2b627a(0xe4),'children':_0x2b627a(0xa7)})})]});}function getStringWidth(_0xe0b0a2){let _0x327253=0x0;for(const _0x38d949 of _0xe0b0a2){/[\u4e00-\u9fa5]/['test'](_0x38d949)?_0x327253+=0x2:_0x327253+=0x1;}return _0x327253;}function getRemainingSpaces(_0x5b5551,_0x40ae6e){const _0x579af8=a8_0xda03,_0x28225f=getStringWidth(_0x40ae6e);return Array(Math[_0x579af8(0xee)](0x0,_0x5b5551-_0x28225f))[_0x579af8(0xdb)]('\x20')['join']('');}function getMaxWidth(_0x26de91,_0x53d5ee=0x2){const _0x5a855e=a8_0xda03;let _0x1514f4='',_0x51c629=0x0;for(const _0x37d9a of _0x26de91){const _0x47c422=getStringWidth(_0x37d9a);_0x47c422>_0x51c629&&(_0x51c629=_0x47c422,_0x1514f4=_0x37d9a);}return _0x1514f4+'\x20'[_0x5a855e(0xd0)](_0x53d5ee);}function a8_0x1295(){const _0x5bd560=['done','backspace','Create','repeat','filter','\x20←\x20','[✓]','gray','Menu\x20Name','dots','*\x20Creating\x20menus...','catch','yellow','JS\x20URL','fill','downArrow','has','3458080DteBFZ','817075fEmCUb','Update','!\x20No\x20local\x20pages\x20found,\x20please\x20create\x20pages\x20first','Please\x20enter\x20a\x20valid\x20CSS\x20https\x20URL','CSS\x20URL\x20is\x20unreachable','green','Please\x20enter\x20a\x20valid\x20JS\x20https\x20URL','JS\x20URL\x20is\x20unreachable','CSS\x20URL','238968vblhJB','\x20command\x20to\x20re-login','1aFPepH','length','1377034TBDzdb','\x20Enter\x20project\x20CSS\x20asset\x20URL\x20(https://...)','max','cyan','√\x20Menu\x20creation\x20completed','selecting','join','18230ictqDQ','column','\x20items','input-css','value','[\x20]','2044044BOSvdF','2222VlpqxY','includes','*\x20JS\x20URL:\x20','white','Failed\x20to\x20create\x20menu','Selected\x20menus','online','return','Hint:\x20use\x20','map','trim','\x20↑/↓:\x20Move\x20\x20Space:\x20Toggle\x20\x20a:\x20All\x20\x20i/r:\x20Invert\x20\x20Enter:\x20Confirm','5048408kewPHi','blue','rabetbase\x20auth','Local','slice','input-js','label','path','creating','local','75qfbavT','9htolxT','red','*\x20CSS\x20URL:\x20','upArrow','then'];a8_0x1295=function(){return _0x5bd560;};return a8_0x1295();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x35cdf8,_0x23a783){const _0x5829d2=a9_0x3e7d,_0x3c0b38=_0x35cdf8();while(!![]){try{const _0x35f4f1=parseInt(_0x5829d2(0xd8))/0x1*(-parseInt(_0x5829d2(0xdf))/0x2)+parseInt(_0x5829d2(0xc6))/0x3+-parseInt(_0x5829d2(0xd1))/0x4*(parseInt(_0x5829d2(0xc7))/0x5)+parseInt(_0x5829d2(0xcc))/0x6*(parseInt(_0x5829d2(0xca))/0x7)+-parseInt(_0x5829d2(0xd2))/0x8*(-parseInt(_0x5829d2(0xe5))/0x9)+parseInt(_0x5829d2(0xe8))/0xa+parseInt(_0x5829d2(0xdb))/0xb*(-parseInt(_0x5829d2(0xec))/0xc);if(_0x35f4f1===_0x23a783)break;else _0x3c0b38['push'](_0x3c0b38['shift']());}catch(_0x82bf7a){_0x3c0b38['push'](_0x3c0b38['shift']());}}}(a9_0x28d8,0x51a56));function a9_0x3e7d(_0x52a8e6,_0x5907b4){_0x52a8e6=_0x52a8e6-0xc1;const _0x28d893=a9_0x28d8();let _0x3e7d5e=_0x28d893[_0x52a8e6];return _0x3e7d5e;}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';function a9_0x28d8(){const _0x5b9256=['success','length','8nPBKjD','5060680xwrJpJ','Error','label','Failed\x20to\x20create\x20menu:\x20','Auth\x20validation\x20failed.\x20Please\x20use\x20rabetbase\x20auth\x20to\x20login\x20again','resources','9359GXTQfO','stringify','Creating\x20menu:\x20','176DslFow','appcode','errorCode','Menu\x20created\x20successfully:','138jwRFmC','import','includes','0011','create-menu','status','9hoIiJu','\x20\x20\x201.\x20Specify\x20directly:\x20rabetbase\x20api\x20pull\x20<app-code>','error','5242660OlYfwL','json','Failed\x20to\x20create\x20menu,\x20HTTP\x20status:\x20','\x20\x20\x202.\x20Set\x20default:\x20rabetbase\x20config\x20set\x20app\x20<app-code>','262044yPxqHb','Authentication\x20failed,\x20session\x20expired.\x20Please\x20use\x20rabetbase\x20auth\x20to\x20login\x20again','log','procode','application/json','POST','/smartapi/menu/create','No\x20AppCode\x20provided\x20and\x20no\x20default\x20configured','1369407sutWts','764185TbkwOi','path','data','497RrYVeJ','all','1854ctlnWa','info','errorMsg'];a9_0x28d8=function(){return _0x5b9256;};return a9_0x28d8();}const config=readConfig();export async function createMenu(_0x5fd65c){const _0xbcb75a=a9_0x3e7d,_0x58ec93=config?.[_0xbcb75a(0xdc)];if(!_0x58ec93){const _0x4e1c90=_0xbcb75a(0xc5);logger[_0xbcb75a(0xe7)](_0xbcb75a(0xe3),_0x4e1c90),console[_0xbcb75a(0xe7)]('×\x20'+_0x4e1c90),console['log']('!\x20Please\x20use\x20one\x20of\x20the\x20following:'),console['log'](_0xbcb75a(0xe6)),console['log']('\x20\x20\x202.\x20Set\x20default:\x20rabetbase\x20config\x20set\x20app\x20<app-code>');return;}logger['info'](_0xbcb75a(0xe3),_0xbcb75a(0xda)+_0x5fd65c[_0xbcb75a(0xd4)]+'\x20('+_0x5fd65c[_0xbcb75a(0xc8)]+')');const _0x390c28={'appCode':_0x58ec93,'type':_0xbcb75a(0xc1),'sort':0x0,'extend':{'loadScriptMode':_0xbcb75a(0xe0),'resources':_0x5fd65c[_0xbcb75a(0xd7)]?JSON[_0xbcb75a(0xd9)](_0x5fd65c[_0xbcb75a(0xd7)]):undefined},..._0x5fd65c},_0xd92f1a=await fetch(getApiDomain()+_0xbcb75a(0xc4),{'method':'POST','body':JSON[_0xbcb75a(0xd9)](_0x390c28),'headers':{'Content-Type':_0xbcb75a(0xc2),'Cookie':getCookie()}});if(!_0xd92f1a['ok']){if(_0xd92f1a[_0xbcb75a(0xe4)]===0x191){const _0x50f817=_0xbcb75a(0xed);logger[_0xbcb75a(0xe7)](_0xbcb75a(0xe3),_0x50f817,{'status':_0xd92f1a['status'],'menu':_0x5fd65c['label']});throw new Error(_0x50f817);}const _0x106c0e=_0xbcb75a(0xea)+_0xd92f1a[_0xbcb75a(0xe4)];logger[_0xbcb75a(0xe7)](_0xbcb75a(0xe3),_0x106c0e,{'menu':_0x5fd65c[_0xbcb75a(0xd4)]});throw new Error(_0x106c0e);}const _0x2c95fd=await _0xd92f1a['json']();if(!_0x2c95fd[_0xbcb75a(0xcf)]){const _0x392043=_0xbcb75a(0xd5)+(_0x2c95fd['errorMsg']||_0xbcb75a(0xd3));logger[_0xbcb75a(0xe7)](_0xbcb75a(0xe3),_0x392043,{'errorCode':_0x2c95fd[_0xbcb75a(0xdd)],'errorMsg':_0x2c95fd[_0xbcb75a(0xce)],'menu':_0x5fd65c[_0xbcb75a(0xd4)]});throw new Error(_0x392043);}logger[_0xbcb75a(0xcd)](_0xbcb75a(0xe3),'Menu\x20created\x20successfully:'+_0x5fd65c['label'],_0x2c95fd[_0xbcb75a(0xc9)]),console[_0xbcb75a(0xee)](_0xbcb75a(0xde),_0x2c95fd[_0xbcb75a(0xc9)]);}async function _createMenu(_0x2f542a,_0x5dbe3d){const _0x53f94d=a9_0x3e7d,_0x11f9ba=config?.['appcode'];if(!_0x11f9ba){const _0x5e986c='No\x20AppCode\x20provided\x20and\x20no\x20default\x20configured';logger[_0x53f94d(0xe7)](_0x53f94d(0xe3),_0x5e986c),console[_0x53f94d(0xe7)]('×\x20'+_0x5e986c),console[_0x53f94d(0xee)]('!\x20Please\x20use\x20one\x20of\x20the\x20following:'),console[_0x53f94d(0xee)](_0x53f94d(0xe6)),console[_0x53f94d(0xee)](_0x53f94d(0xeb));return;}const _0x505c30={'appCode':_0x11f9ba,'type':_0x53f94d(0xc1),'sort':0x0,'extend':{'loadScriptMode':_0x53f94d(0xe0),'resources':_0x5dbe3d?JSON[_0x53f94d(0xd9)](_0x5dbe3d):undefined},'label':_0x2f542a[_0x53f94d(0xd4)],'path':_0x2f542a[_0x53f94d(0xc8)]},_0x2580dc=await fetch(getApiDomain()+_0x53f94d(0xc4),{'method':_0x53f94d(0xc3),'body':JSON['stringify'](_0x505c30),'headers':{'Content-Type':_0x53f94d(0xc2),'Cookie':getCookie()}});if(!_0x2580dc['ok']){if(_0x2580dc[_0x53f94d(0xe4)]===0x191){const _0x335723=_0x53f94d(0xed);logger[_0x53f94d(0xe7)]('create-menu',_0x335723,{'status':_0x2580dc[_0x53f94d(0xe4)],'menu':_0x2f542a[_0x53f94d(0xd4)]});throw new Error(_0x335723);}const _0x4dad2f=_0x53f94d(0xea)+_0x2580dc['status'];logger[_0x53f94d(0xe7)](_0x53f94d(0xe3),_0x4dad2f,{'menu':_0x2f542a[_0x53f94d(0xd4)]});throw new Error(_0x4dad2f);}const _0x1c011f=await _0x2580dc[_0x53f94d(0xe9)]();if(!_0x1c011f[_0x53f94d(0xcf)]){if(_0x1c011f[_0x53f94d(0xdd)]===_0x53f94d(0xe2)||_0x1c011f[_0x53f94d(0xce)]?.[_0x53f94d(0xe1)]('登录')){const _0x13f9ac=_0x53f94d(0xd6);logger['error'](_0x53f94d(0xe3),_0x13f9ac,{'errorCode':_0x1c011f['errorCode'],'errorMsg':_0x1c011f[_0x53f94d(0xce)],'menu':_0x2f542a[_0x53f94d(0xd4)]});throw new Error(_0x13f9ac);}const _0x3e509c=_0x53f94d(0xd5)+(_0x1c011f[_0x53f94d(0xce)]||_0x53f94d(0xd3));logger[_0x53f94d(0xe7)]('create-menu',_0x3e509c,{'errorCode':_0x1c011f[_0x53f94d(0xdd)],'errorMsg':_0x1c011f[_0x53f94d(0xce)],'menu':_0x2f542a[_0x53f94d(0xd4)]});throw new Error(_0x3e509c);}logger[_0x53f94d(0xcd)](_0x53f94d(0xe3),_0x53f94d(0xde)+_0x2f542a[_0x53f94d(0xd4)]);}export async function createMenus(_0x54a9d4,_0x30ff3c){const _0x14841f=a9_0x3e7d;logger[_0x14841f(0xcd)]('create-menus','Start\x20batch\x20menu\x20creation,\x20total\x20'+_0x54a9d4[_0x14841f(0xd0)]),await Promise[_0x14841f(0xcb)](_0x54a9d4['map'](async _0x4f4d85=>{await _createMenu(_0x4f4d85,_0x30ff3c);})),logger[_0x14841f(0xcd)]('create-menus','Batch\x20menu\x20creation\x20completed,\x20total\x20'+_0x54a9d4[_0x14841f(0xd0)]);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a10_0x5da6ac=a10_0x2de6;(function(_0x37bea1,_0x5f4ebe){const _0xd4a7c6=a10_0x2de6,_0x15413c=_0x37bea1();while(!![]){try{const _0x183853=-parseInt(_0xd4a7c6(0xc0))/0x1*(parseInt(_0xd4a7c6(0xb9))/0x2)+parseInt(_0xd4a7c6(0xbf))/0x3+parseInt(_0xd4a7c6(0xc2))/0x4+parseInt(_0xd4a7c6(0xbc))/0x5+-parseInt(_0xd4a7c6(0xb1))/0x6*(-parseInt(_0xd4a7c6(0xae))/0x7)+parseInt(_0xd4a7c6(0xb5))/0x8+-parseInt(_0xd4a7c6(0xaf))/0x9;if(_0x183853===_0x5f4ebe)break;else _0x15413c['push'](_0x15413c['shift']());}catch(_0x5970cb){_0x15413c['push'](_0x15413c['shift']());}}}(a10_0x2afa,0x77363));function a10_0x2de6(_0x2ba3c4,_0xf95e1a){_0x2ba3c4=_0x2ba3c4-0xae;const _0x2afa75=a10_0x2afa();let _0x2de6b1=_0x2afa75[_0x2ba3c4];return _0x2de6b1;}function a10_0x2afa(){const _0x293507=['forEach','63007dQCzUS','20282265hHfutE','utf-8','114nsTWic','src/pages','isDirectory','replace','4589096dqPXZW','slice','filter','index.tsx','1063586oEPtzR','endsWith','\x5c.displayName\x5cs*=\x5cs*[\x22\x27]([^\x22\x27]+)[\x22\x27]','3609840edoPjk','path','trim','2890155TlRJZd','1cPNuOf','match','3374640KLQwBY','.tsx'];a10_0x2afa=function(){return _0x293507;};return a10_0x2afa();}import{readdirSync,statSync,readFileSync}from'fs';import{join,relative,resolve}from'path';const pagesDir=resolve(process['cwd'](),a10_0x5da6ac(0xb2));export function extractTitleFromComment(_0x5d94c1){const _0x50f99a=a10_0x5da6ac;try{const _0x55598d=readFileSync(_0x5d94c1,_0x50f99a(0xb0)),_0x9e61df=_0x55598d[_0x50f99a(0xc1)](/^\s*\/\*\*?([\s\S]*?)\*\//);if(_0x9e61df&&_0x9e61df[0x1]){const _0x31429d=_0x9e61df[0x1],_0x181499=_0x31429d[_0x50f99a(0xc1)](/^\s*\*?\s*title\s*:\s*(.+)/im);if(_0x181499&&_0x181499[0x1])return _0x181499[0x1][_0x50f99a(0xbe)]();}let _0x549186=null;const _0x35b43c=_0x55598d[_0x50f99a(0xc1)](/export\s+default\s+([A-Z][a-zA-Z0-9]*)/);_0x35b43c&&_0x35b43c[0x1]&&(_0x549186=_0x35b43c[0x1]);if(!_0x549186){const _0x13694c=_0x55598d['match'](/export\s+default\s+function\s+([A-Z][a-zA-Z0-9]*)/);_0x13694c&&_0x13694c[0x1]&&(_0x549186=_0x13694c[0x1]);}if(_0x549186){const _0x3e51b9=new RegExp('\x5cb'+_0x549186+_0x50f99a(0xbb)),_0x524233=_0x55598d[_0x50f99a(0xc1)](_0x3e51b9);if(_0x524233&&_0x524233[0x1])return _0x524233[0x1];return _0x549186;}return null;}catch(_0x3ca79e){return null;}}export function getLocalPages(_0x2bcbd4=pagesDir,_0x95447c=pagesDir){const _0x5ceee6=a10_0x5da6ac;let _0x5ca8a5=[];const _0x39c4ae=readdirSync(_0x2bcbd4);return _0x39c4ae[_0x5ceee6(0xc4)](_0x3b094c=>{const _0x30e4b6=_0x5ceee6,_0x4b5cfd=join(_0x2bcbd4,_0x3b094c),_0x897702=statSync(_0x4b5cfd);if(_0x897702&&_0x897702[_0x30e4b6(0xb3)]())_0x5ca8a5=_0x5ca8a5['concat'](getLocalPages(_0x4b5cfd,_0x95447c));else{if(_0x3b094c[_0x30e4b6(0xba)](_0x30e4b6(0xc3))){let _0x5d6ef6=relative(_0x95447c,_0x4b5cfd);_0x5d6ef6[_0x30e4b6(0xba)](_0x30e4b6(0xb8))?_0x5d6ef6=_0x5d6ef6[_0x30e4b6(0xb4)](/index\.tsx$/,''):_0x5d6ef6=_0x5d6ef6[_0x30e4b6(0xb4)](/\.tsx$/,'');_0x5d6ef6[_0x30e4b6(0xba)]('/')&&(_0x5d6ef6=_0x5d6ef6[_0x30e4b6(0xb6)](0x0,-0x1));const _0x575b80=extractTitleFromComment(_0x4b5cfd),_0x8d681b=_0x575b80||_0x5d6ef6;_0x5ca8a5['push']({'path':_0x5d6ef6['replaceAll']('$',':'),'label':_0x8d681b});}}}),_0x5ca8a5[_0x5ceee6(0xb7)](_0x2353f5=>_0x2353f5[_0x5ceee6(0xbd)]!=='');}
|