@lovrabet/rabetbase-cli 2.0.4-beta.5 → 2.0.6
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/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.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/get-session-user.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/doc.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.js +1 -1
- package/lib/commands/auth/index.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/cli-update.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/common/app-selector.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.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/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/preview.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project-upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/skill/index.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/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/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/framework/types.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/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.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/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/platform.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/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/package.json +2 -2
package/lib/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a83_0xf9c073=a83_0x5c39;(function(_0x44e22a,_0x295414){const _0x43b189=a83_0x5c39,_0x16e337=_0x44e22a();while(!![]){try{const _0x50660e=parseInt(_0x43b189(0x182))/0x1+parseInt(_0x43b189(0x1a3))/0x2+-parseInt(_0x43b189(0x1a9))/0x3+-parseInt(_0x43b189(0x194))/0x4*(-parseInt(_0x43b189(0x18b))/0x5)+-parseInt(_0x43b189(0x1a0))/0x6+-parseInt(_0x43b189(0x18a))/0x7+-parseInt(_0x43b189(0x198))/0x8*(-parseInt(_0x43b189(0x17f))/0x9);if(_0x50660e===_0x295414)break;else _0x16e337['push'](_0x16e337['shift']());}catch(_0x329577){_0x16e337['push'](_0x16e337['shift']());}}}(a83_0x229a,0x30f00));function a83_0x5c39(_0x4fadfa,_0x197425){_0x4fadfa=_0x4fadfa-0x17b;const _0x229a93=a83_0x229a();let _0x5c391c=_0x229a93[_0x4fadfa];return _0x5c391c;}import{readFileSync,writeFileSync,existsSync,mkdirSync,renameSync,unlinkSync}from'node:fs';import{resolve,dirname}from'node:path';import{homedir}from'node:os';import{logger}from'./utils/logger.js';import{getIsSessionValid}from'./auth/is-session-valid.js';import{CliErrors}from'./errors.js';function a83_0x229a(){const _0x3bbf0d=['MAX_RISK','find','./src/api','filter','maxRisk','object','read','ACCESS_KEY','authRequired','utf8','entries','production','runtimeDomain','.rabetbase.json','-api.ts','appcode','defaultApp','1224297bYyepk','.lovrabetrc','length','126712hPeEFZ','trim','argv','keys','write','parse','apps','app','1924503vDlTya','1491240yovhzd','COOKIE','stringify','setLogPath','project','RISK_LEVEL','./utils/is-non-interactive.js','./constant/domain.js','en-US','4AXFGDV','apiDomain','env','FORMAT','40oxxQEz','userDomain','pageSize','accessKey','.tmp','string','cookie','format','2045790gihYxs','setRawCommand','join','58118xjuxEf','locale','cwd','./constant/env.js','slice','PAGE_SIZE','953526EhxjxJ','APP','true','apiDir','daily','riskLevel','APPCODE','VERBOSE'];a83_0x229a=function(){return _0x3bbf0d;};return a83_0x229a();}import{CLI_BIN_NAME}from'./constant/cli.js';import{isValidFormat}from'./framework/types.js';function env(_0xd0f67a){return process.env[`RABETBASE_${_0xd0f67a}`]||process.env[`LOVRABET_${_0xd0f67a}`]||undefined;}export const NEW_CONFIG_NAME=a83_0xf9c073(0x17b);export const CONFIG_NAMES=[a83_0xf9c073(0x17b),'.lovrabet.json',a83_0xf9c073(0x180)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a83_0xf9c073(0x1b4)](_0x1a3e22=>_0x1a3e22!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x41f5c7){for(const _0x4514b0 of CONFIG_NAMES){const _0x2d1d8a=resolve(_0x41f5c7,_0x4514b0);if(existsSync(_0x2d1d8a))return _0x2d1d8a;}return undefined;}export async function createContext(_0x406b41){const _0x582142=a83_0xf9c073,_0x43448a=readRawConfig(),_0x2d083f=buildConfig(_0x43448a,_0x406b41),{initEnv:_0x1b4f9a}=await import(_0x582142(0x1a6));if(_0x2d083f[_0x582142(0x196)])_0x1b4f9a(_0x2d083f[_0x582142(0x196)]);else _0x406b41[_0x582142(0x196)]&&typeof _0x406b41[_0x582142(0x196)]==='string'&&_0x1b4f9a(_0x406b41[_0x582142(0x196)]);const {initDomains:_0x3b3cea,getUserDomain:_0x68723f,getApiDomain:_0x3e712d}=await import(_0x582142(0x192));_0x3b3cea({'apiDomain':_0x43448a[_0x582142(0x195)]||undefined,'userDomain':_0x43448a[_0x582142(0x199)]||undefined,'runtimeDomain':_0x43448a[_0x582142(0x1bd)]||undefined});const _0x49e6dc={'apiDomain':_0x3e712d(),'userDomain':_0x68723f()},_0x345e0a=await buildAuth(_0x2d083f);logger[_0x582142(0x18e)](process[_0x582142(0x1a5)]());const _0x43e858=(CLI_BIN_NAME+'\x20'+process[_0x582142(0x184)][_0x582142(0x1a7)](0x2)[_0x582142(0x1a2)]('\x20'))[_0x582142(0x183)]();logger[_0x582142(0x1a1)](_0x43e858);const {isNonInteractive:_0xe93f55}=await import(_0x582142(0x191)),_0x4a0529=_0xe93f55(_0x406b41);return{'config':_0x2d083f,'auth':_0x345e0a,'logger':logger,'env':_0x49e6dc,'nonInteractive':_0x4a0529};}export function buildConfigFromFlags(_0xa69324){return buildConfig(readRawConfig(),_0xa69324);}export function getProjectConfigPath(){const _0x241c81=a83_0xf9c073;return resolveConfigPath(process[_0x241c81(0x1a5)]());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function readRawConfig(_0x150fb1){const _0x4757f1=a83_0xf9c073;let _0x20a5a5={},_0x537279={};try{const _0x41c488=resolveConfigPath(homedir());if(_0x41c488){const _0x188674=readFileSync(_0x41c488,{'encoding':'utf8'});if(_0x188674)_0x20a5a5=JSON['parse'](_0x188674);}}catch{}try{const _0x260e22=_0x150fb1||process[_0x4757f1(0x1a5)](),_0x1c9ed7=resolveConfigPath(_0x260e22);if(_0x1c9ed7){const _0x1df8d7=readFileSync(_0x1c9ed7,{'encoding':_0x4757f1(0x1ba)});if(_0x1df8d7)_0x537279=JSON[_0x4757f1(0x187)](_0x1df8d7);}}catch{}const _0xc769=_0x20a5a5[_0x4757f1(0x188)]&&typeof _0x20a5a5[_0x4757f1(0x188)]===_0x4757f1(0x1b6)?_0x20a5a5[_0x4757f1(0x188)]:{},_0x51b0d0=_0x537279[_0x4757f1(0x188)]&&typeof _0x537279['apps']==='object'?_0x537279[_0x4757f1(0x188)]:{},_0xd2079={..._0xc769,..._0x51b0d0},_0x283078={..._0x20a5a5,..._0x537279};Object[_0x4757f1(0x185)](_0xd2079)['length']>0x0&&(_0x283078['apps']=_0xd2079);if(_0x4757f1(0x17e)in _0x537279)_0x283078[_0x4757f1(0x17e)]=_0x537279['defaultApp'];else{if(_0x51b0d0&&Object[_0x4757f1(0x185)](_0x51b0d0)[_0x4757f1(0x181)]>0x0)_0x283078[_0x4757f1(0x17e)]=Object['keys'](_0x51b0d0)[0x0];else _0x20a5a5[_0x4757f1(0x17e)]&&(_0x283078[_0x4757f1(0x17e)]=_0x20a5a5[_0x4757f1(0x17e)]);}return _0x283078;}export function readConfigFile(_0x457215){const _0x4bfcd9=a83_0xf9c073;try{if(existsSync(_0x457215)){const _0x33fc4b=readFileSync(_0x457215,{'encoding':_0x4bfcd9(0x1ba)});if(_0x33fc4b)return JSON[_0x4bfcd9(0x187)](_0x33fc4b);}}catch{}return{};}export function writeConfigFile(_0x5463b3,_0x1faf78){const _0x3ebc7c=a83_0xf9c073,_0x8dbb37=dirname(_0x5463b3);!existsSync(_0x8dbb37)&&mkdirSync(_0x8dbb37,{'recursive':!![]});const _0xfd7fb=_0x5463b3+_0x3ebc7c(0x19c);try{writeFileSync(_0xfd7fb,JSON[_0x3ebc7c(0x18d)](_0x1faf78,null,0x2)+'\x0a',{'encoding':'utf8','mode':0x180}),renameSync(_0xfd7fb,_0x5463b3);}catch(_0x2765e3){try{unlinkSync(_0xfd7fb);}catch{}throw _0x2765e3;}}export function resolveWriteConfigPath(_0x95908c){const _0x5c8b84=a83_0xf9c073,_0x29d3ca=_0x95908c===_0x5c8b84(0x18f)?process[_0x5c8b84(0x1a5)]():homedir(),_0x3df9fc=resolveConfigPath(_0x29d3ca);return _0x3df9fc??resolve(_0x29d3ca,NEW_CONFIG_NAME);}function buildConfig(_0x3968c3,_0x500613){const _0x44ce19=a83_0xf9c073,_0x222ab9={};if(_0x3968c3[_0x44ce19(0x188)]&&typeof _0x3968c3[_0x44ce19(0x188)]===_0x44ce19(0x1b6))for(const [_0x5df38f,_0x5cd0a5]of Object[_0x44ce19(0x1bb)](_0x3968c3[_0x44ce19(0x188)])){_0x5cd0a5&&typeof _0x5cd0a5==='object'&&_0x5cd0a5[_0x44ce19(0x17d)]&&(_0x222ab9[_0x5df38f]=_0x5cd0a5);}const _0x240470=_0x3968c3['defaultApp']||undefined,_0x25d6e9=Object[_0x44ce19(0x185)](_0x222ab9)[_0x44ce19(0x181)]>0x0,_0x2e696b=_0x500613['app']||env(_0x44ce19(0x1aa))||undefined,_0x15f821=_0x2e696b||_0x240470||undefined,_0x115d1e=_0x500613['appcode']||env(_0x44ce19(0x1af))||undefined,_0x45db47=_0x115d1e?Object['entries'](_0x222ab9)[_0x44ce19(0x1b2)](([,_0x5038fc])=>_0x5038fc?.['appcode']===_0x115d1e):undefined,_0xd73e4b=_0x45db47?.[0x0],_0x205ac8=_0x45db47?.[0x1];let _0x47af09=_0x115d1e?_0xd73e4b:_0x15f821,_0x2bf039=_0x47af09&&_0x222ab9[_0x47af09]?_0x222ab9[_0x47af09]:undefined;_0x115d1e&&_0x205ac8&&(_0x2bf039=_0x205ac8);const _0x1898e7=_0x115d1e?_0x205ac8??_0x2bf039:_0x2bf039,_0x4c5a78=_0x2e696b||(_0x115d1e?_0xd73e4b:undefined),_0x4e60fd=_0x115d1e||_0x1898e7?.[_0x44ce19(0x17d)]||_0x3968c3[_0x44ce19(0x17d)]||_0x3968c3[_0x44ce19(0x189)]||undefined,_0x28e27a=_0x500613[_0x44ce19(0x196)]||env('ENV')||_0x1898e7?.[_0x44ce19(0x196)]||_0x3968c3[_0x44ce19(0x196)]||_0x44ce19(0x1bc),_0xa24d81=_0x1898e7?.[_0x44ce19(0x1a4)]||_0x3968c3[_0x44ce19(0x1a4)]||_0x44ce19(0x193),_0x2d6bf7=env(_0x44ce19(0x18c))||_0x1898e7?.[_0x44ce19(0x19e)]||_0x3968c3['cookie']||undefined,_0x5b1c19=env(_0x44ce19(0x1b8))||_0x1898e7?.[_0x44ce19(0x19b)]||_0x3968c3[_0x44ce19(0x19b)]||undefined,_0x2935d4=_0x500613[_0x44ce19(0x19f)]||env(_0x44ce19(0x197))||_0x1898e7?.[_0x44ce19(0x19f)]||_0x3968c3[_0x44ce19(0x19f)],_0x2be8c4=isValidFormat(_0x2935d4)?_0x2935d4:undefined,_0x529232=env(_0x44ce19(0x1a8))||_0x1898e7?.['pageSize']||_0x3968c3[_0x44ce19(0x19a)],_0x39c11d=_0x529232?Number(_0x529232)||undefined:undefined,_0x394f69=env(_0x44ce19(0x190))||env(_0x44ce19(0x1b1))||_0x1898e7?.[_0x44ce19(0x1ae)]||_0x3968c3[_0x44ce19(0x1ae)]||_0x3968c3[_0x44ce19(0x1b5)],_0x506b49=_0x394f69===_0x44ce19(0x1b7)||_0x394f69===_0x44ce19(0x186)?_0x394f69:'high-risk-write',_0x19bfc0=env(_0x44ce19(0x1b0)),_0xdcc101=_0x19bfc0==='1'||_0x19bfc0===_0x44ce19(0x1ab),_0xad1408=_0x1898e7?.[_0x44ce19(0x1ac)]||_0x3968c3[_0x44ce19(0x1ac)]||_0x44ce19(0x1b3);return{'appCode':typeof _0x4e60fd==='string'&&_0x4e60fd['trim']()?_0x4e60fd[_0x44ce19(0x183)]():undefined,'env':_0x28e27a==='online'?_0x44ce19(0x1bc):_0x28e27a===_0x44ce19(0x1ad)?_0x44ce19(0x1ad):_0x44ce19(0x1bc),'locale':_0xa24d81,'cookie':_0x2d6bf7,'accessKey':_0x5b1c19,'format':_0x2be8c4,'pageSize':_0x39c11d,'riskLevel':_0x506b49,'verbose':_0xdcc101,'apiDir':_0xad1408,'apps':_0x222ab9,'defaultApp':_0x240470,'currentApp':_0x25d6e9?_0x47af09:undefined,'explicitAppName':_0x4c5a78,'raw':_0x3968c3};}async function buildAuth(_0x5f4e61){const {getCookie:_0x54fe85}=await import('./auth/get-cookie.js'),_0x149492=_0x5f4e61['cookie']||_0x54fe85(),_0x3a6a53=_0x149492?await getIsSessionValid():![];return{'cookie':_0x149492,'isLoggedIn':_0x3a6a53,async 'getOrLogin'(){const _0x1e1df2=a83_0x5c39;if(_0x149492&&_0x3a6a53)return _0x149492;throw CliErrors[_0x1e1df2(0x1b9)]();}};}export function resolveApiFilePath(_0x2978f0,_0x15f3fe){const _0x4b3da6=a83_0xf9c073,_0xe7ee56=resolve(process['cwd'](),_0x2978f0),_0xd8fbbf=resolve(_0xe7ee56,'api.ts');if(!_0x15f3fe)return _0xd8fbbf;const _0x3abd22=readRawConfig(),_0x353ccd=_0x3abd22[_0x4b3da6(0x188)]&&typeof _0x3abd22['apps']===_0x4b3da6(0x1b6)?_0x3abd22[_0x4b3da6(0x188)]:{},_0x2001d1=Object[_0x4b3da6(0x1bb)](_0x353ccd)[_0x4b3da6(0x1b2)](([,_0x567239])=>_0x567239?.[_0x4b3da6(0x17d)]===_0x15f3fe);if(!_0x2001d1)return _0xd8fbbf;const [_0x1277e9,_0x5da18a]=_0x2001d1,_0x4abad6=typeof _0x3abd22[_0x4b3da6(0x17e)]===_0x4b3da6(0x19d)?_0x3abd22[_0x4b3da6(0x17e)]:undefined;if(_0x5da18a?.[_0x4b3da6(0x1ac)])return _0xd8fbbf;if(_0x4abad6&&_0x1277e9!==_0x4abad6)return resolve(_0xe7ee56,_0x1277e9+_0x4b3da6(0x17c));return _0xd8fbbf;}
|
|
1
|
+
const a83_0x582c9f=a83_0x12dc;(function(_0x434ee9,_0x385b20){const _0x4ab4a6=a83_0x12dc,_0x45708d=_0x434ee9();while(!![]){try{const _0x2149f5=parseInt(_0x4ab4a6(0x1a8))/0x1+parseInt(_0x4ab4a6(0x199))/0x2+-parseInt(_0x4ab4a6(0x1a0))/0x3*(parseInt(_0x4ab4a6(0x1bb))/0x4)+-parseInt(_0x4ab4a6(0x1b1))/0x5*(parseInt(_0x4ab4a6(0x1b0))/0x6)+-parseInt(_0x4ab4a6(0x1cb))/0x7*(parseInt(_0x4ab4a6(0x1a6))/0x8)+parseInt(_0x4ab4a6(0x1a1))/0x9+parseInt(_0x4ab4a6(0x1d3))/0xa*(-parseInt(_0x4ab4a6(0x1af))/0xb);if(_0x2149f5===_0x385b20)break;else _0x45708d['push'](_0x45708d['shift']());}catch(_0x165113){_0x45708d['push'](_0x45708d['shift']());}}}(a83_0x424b,0x893d4));function a83_0x424b(){const _0x3ddb6d=['string','.lovrabet.json','riskLevel','read','348106qeEMLA','348hePBxk','21515TvOUWt','apps','join','maxRisk','filter','find','./src/api','.rabetbase.json','stringify','env','4myAlNp','apiDomain','ENV','utf8','./constant/env.js','apiDir','entries','api.ts','FORMAT','daily','.tmp','VERBOSE','./utils/is-non-interactive.js','cookie','cwd','format','1359687tsjVGh','-api.ts','runtimeDomain','app','object','parse','setRawCommand','MAX_RISK','110vEnPdj','project','locale','ACCESS_KEY','defaultApp','slice','keys','126740IFsCzg','setLogPath','accessKey','length','appcode','COOKIE','PAGE_SIZE','612405WocMxl','10083564TpupMG','trim','argv','./auth/get-cookie.js','pageSize','24SPVtgW','en-US','762904KtVSeE','write','production'];a83_0x424b=function(){return _0x3ddb6d;};return a83_0x424b();}import{readFileSync,writeFileSync,existsSync,mkdirSync,renameSync,unlinkSync}from'node:fs';import{resolve,dirname}from'node:path';import{homedir}from'node:os';import{logger}from'./utils/logger.js';import{getIsSessionValid}from'./auth/is-session-valid.js';import{CliErrors}from'./errors.js';function a83_0x12dc(_0x42d831,_0x463932){_0x42d831=_0x42d831-0x198;const _0x424b9f=a83_0x424b();let _0x12dc82=_0x424b9f[_0x42d831];return _0x12dc82;}import{CLI_BIN_NAME}from'./constant/cli.js';import{isValidFormat}from'./framework/types.js';function env(_0x2e2343){return process.env[`RABETBASE_${_0x2e2343}`]||process.env[`LOVRABET_${_0x2e2343}`]||undefined;}export const NEW_CONFIG_NAME='.rabetbase.json';export const CONFIG_NAMES=[a83_0x582c9f(0x1b8),a83_0x582c9f(0x1ac),'.lovrabetrc'];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a83_0x582c9f(0x1b5)](_0x262bf1=>_0x262bf1!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x5e74d0){for(const _0x2c4120 of CONFIG_NAMES){const _0x17c3e8=resolve(_0x5e74d0,_0x2c4120);if(existsSync(_0x17c3e8))return _0x17c3e8;}return undefined;}export async function createContext(_0x4c455b){const _0x182d2c=a83_0x582c9f,_0x7b021b=readRawConfig(),_0x56dc4c=buildConfig(_0x7b021b,_0x4c455b),{initEnv:_0x2ffb03}=await import(_0x182d2c(0x1bf));if(_0x56dc4c['env'])_0x2ffb03(_0x56dc4c[_0x182d2c(0x1ba)]);else _0x4c455b[_0x182d2c(0x1ba)]&&typeof _0x4c455b[_0x182d2c(0x1ba)]===_0x182d2c(0x1ab)&&_0x2ffb03(_0x4c455b['env']);const {initDomains:_0x5defbf,getUserDomain:_0x243768,getApiDomain:_0x18739b}=await import('./constant/domain.js');_0x5defbf({'apiDomain':_0x7b021b[_0x182d2c(0x1bc)]||undefined,'userDomain':_0x7b021b['userDomain']||undefined,'runtimeDomain':_0x7b021b[_0x182d2c(0x1cd)]||undefined});const _0x48e39f={'apiDomain':_0x18739b(),'userDomain':_0x243768()},_0x22c8eb=await buildAuth(_0x56dc4c);logger[_0x182d2c(0x19a)](process[_0x182d2c(0x1c9)]());const _0x10259a=(CLI_BIN_NAME+'\x20'+process[_0x182d2c(0x1a3)][_0x182d2c(0x1d8)](0x2)[_0x182d2c(0x1b3)]('\x20'))[_0x182d2c(0x1a2)]();logger[_0x182d2c(0x1d1)](_0x10259a);const {isNonInteractive:_0x5b8dbc}=await import(_0x182d2c(0x1c7)),_0xbb3edb=_0x5b8dbc(_0x4c455b);return{'config':_0x56dc4c,'auth':_0x22c8eb,'logger':logger,'env':_0x48e39f,'nonInteractive':_0xbb3edb};}export function buildConfigFromFlags(_0x2aac7c){return buildConfig(readRawConfig(),_0x2aac7c);}export function getProjectConfigPath(){return resolveConfigPath(process['cwd']());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function readRawConfig(_0x130a44){const _0x476144=a83_0x582c9f;let _0x20850e={},_0x3e0f11={};try{const _0x31dee1=resolveConfigPath(homedir());if(_0x31dee1){const _0x1306fd=readFileSync(_0x31dee1,{'encoding':_0x476144(0x1be)});if(_0x1306fd)_0x20850e=JSON[_0x476144(0x1d0)](_0x1306fd);}}catch{}try{const _0x53bf5a=_0x130a44||process[_0x476144(0x1c9)](),_0xa61eca=resolveConfigPath(_0x53bf5a);if(_0xa61eca){const _0x3bf05=readFileSync(_0xa61eca,{'encoding':'utf8'});if(_0x3bf05)_0x3e0f11=JSON[_0x476144(0x1d0)](_0x3bf05);}}catch{}const _0xbd76c9=_0x20850e['apps']&&typeof _0x20850e['apps']===_0x476144(0x1cf)?_0x20850e[_0x476144(0x1b2)]:{},_0x32e366=_0x3e0f11[_0x476144(0x1b2)]&&typeof _0x3e0f11[_0x476144(0x1b2)]===_0x476144(0x1cf)?_0x3e0f11[_0x476144(0x1b2)]:{},_0x564b8d={..._0xbd76c9,..._0x32e366},_0x4f1e95={..._0x20850e,..._0x3e0f11};Object[_0x476144(0x198)](_0x564b8d)['length']>0x0&&(_0x4f1e95[_0x476144(0x1b2)]=_0x564b8d);if(_0x476144(0x1d7)in _0x3e0f11)_0x4f1e95[_0x476144(0x1d7)]=_0x3e0f11[_0x476144(0x1d7)];else{if(_0x32e366&&Object['keys'](_0x32e366)['length']>0x0)_0x4f1e95[_0x476144(0x1d7)]=Object[_0x476144(0x198)](_0x32e366)[0x0];else _0x20850e[_0x476144(0x1d7)]&&(_0x4f1e95[_0x476144(0x1d7)]=_0x20850e[_0x476144(0x1d7)]);}return _0x4f1e95;}export function readConfigFile(_0x248554){try{if(existsSync(_0x248554)){const _0xeb34aa=readFileSync(_0x248554,{'encoding':'utf8'});if(_0xeb34aa)return JSON['parse'](_0xeb34aa);}}catch{}return{};}export function writeConfigFile(_0x29a939,_0x71ac3){const _0x5963e7=a83_0x582c9f,_0x129ff5=dirname(_0x29a939);!existsSync(_0x129ff5)&&mkdirSync(_0x129ff5,{'recursive':!![]});const _0x190479=_0x29a939+_0x5963e7(0x1c5);try{writeFileSync(_0x190479,JSON[_0x5963e7(0x1b9)](_0x71ac3,null,0x2)+'\x0a',{'encoding':'utf8','mode':0x180}),renameSync(_0x190479,_0x29a939);}catch(_0x22eec0){try{unlinkSync(_0x190479);}catch{}throw _0x22eec0;}}export function resolveWriteConfigPath(_0x200ddb){const _0x56b423=a83_0x582c9f,_0x4dd664=_0x200ddb===_0x56b423(0x1d4)?process[_0x56b423(0x1c9)]():homedir(),_0x1c68dc=resolveConfigPath(_0x4dd664);return _0x1c68dc??resolve(_0x4dd664,NEW_CONFIG_NAME);}function buildConfig(_0x14e1dd,_0x2e221a){const _0x435e27=a83_0x582c9f,_0x5e19fd={};if(_0x14e1dd[_0x435e27(0x1b2)]&&typeof _0x14e1dd[_0x435e27(0x1b2)]===_0x435e27(0x1cf))for(const [_0x20601f,_0x3a6f7e]of Object[_0x435e27(0x1c1)](_0x14e1dd[_0x435e27(0x1b2)])){_0x3a6f7e&&typeof _0x3a6f7e===_0x435e27(0x1cf)&&_0x3a6f7e[_0x435e27(0x19d)]&&(_0x5e19fd[_0x20601f]=_0x3a6f7e);}const _0x546ae6=_0x14e1dd['defaultApp']||undefined,_0xd00142=Object[_0x435e27(0x198)](_0x5e19fd)[_0x435e27(0x19c)]>0x0,_0x4c161d=_0x2e221a[_0x435e27(0x1ce)]||env('APP')||undefined,_0x4baa9f=_0x4c161d||_0x546ae6||undefined,_0x2919ee=_0x2e221a[_0x435e27(0x19d)]||env('APPCODE')||undefined,_0xf80e1c=_0x2919ee?Object[_0x435e27(0x1c1)](_0x5e19fd)[_0x435e27(0x1b6)](([,_0x334410])=>_0x334410?.[_0x435e27(0x19d)]===_0x2919ee):undefined,_0xa692cd=_0xf80e1c?.[0x0],_0x1a640c=_0xf80e1c?.[0x1];let _0x550a69=_0x2919ee?_0xa692cd:_0x4baa9f,_0x48cf3d=_0x550a69&&_0x5e19fd[_0x550a69]?_0x5e19fd[_0x550a69]:undefined;_0x2919ee&&_0x1a640c&&(_0x48cf3d=_0x1a640c);const _0x144ca4=_0x2919ee?_0x1a640c??_0x48cf3d:_0x48cf3d,_0x2f685e=_0x4c161d||(_0x2919ee?_0xa692cd:undefined),_0x1a53e5=_0x2919ee||_0x144ca4?.[_0x435e27(0x19d)]||_0x14e1dd[_0x435e27(0x19d)]||_0x14e1dd[_0x435e27(0x1ce)]||undefined,_0x449397=_0x2e221a[_0x435e27(0x1ba)]||env(_0x435e27(0x1bd))||_0x144ca4?.[_0x435e27(0x1ba)]||_0x14e1dd['env']||_0x435e27(0x1aa),_0x5c5c9b=_0x144ca4?.[_0x435e27(0x1d5)]||_0x14e1dd[_0x435e27(0x1d5)]||_0x435e27(0x1a7),_0x5abd4d=env(_0x435e27(0x19e))||_0x144ca4?.[_0x435e27(0x1c8)]||_0x14e1dd[_0x435e27(0x1c8)]||undefined,_0x30b72a=env(_0x435e27(0x1d6))||_0x144ca4?.[_0x435e27(0x19b)]||_0x14e1dd['accessKey']||undefined,_0x444da6=_0x2e221a[_0x435e27(0x1ca)]||env(_0x435e27(0x1c3))||_0x144ca4?.[_0x435e27(0x1ca)]||_0x14e1dd['format'],_0x43dafb=isValidFormat(_0x444da6)?_0x444da6:undefined,_0x494a78=env(_0x435e27(0x19f))||_0x144ca4?.[_0x435e27(0x1a5)]||_0x14e1dd[_0x435e27(0x1a5)],_0x466feb=_0x494a78?Number(_0x494a78)||undefined:undefined,_0xf91f55=env('RISK_LEVEL')||env(_0x435e27(0x1d2))||_0x144ca4?.[_0x435e27(0x1ad)]||_0x14e1dd['riskLevel']||_0x14e1dd[_0x435e27(0x1b4)],_0x3e52ca=_0xf91f55===_0x435e27(0x1ae)||_0xf91f55===_0x435e27(0x1a9)?_0xf91f55:'high-risk-write',_0x3d6c8c=env(_0x435e27(0x1c6)),_0x4d40f9=_0x3d6c8c==='1'||_0x3d6c8c==='true',_0x1a1bad=_0x144ca4?.[_0x435e27(0x1c0)]||_0x14e1dd[_0x435e27(0x1c0)]||_0x435e27(0x1b7);return{'appCode':typeof _0x1a53e5===_0x435e27(0x1ab)&&_0x1a53e5[_0x435e27(0x1a2)]()?_0x1a53e5[_0x435e27(0x1a2)]():undefined,'env':_0x449397==='online'?_0x435e27(0x1aa):_0x449397===_0x435e27(0x1c4)?_0x435e27(0x1c4):_0x435e27(0x1aa),'locale':_0x5c5c9b,'cookie':_0x5abd4d,'accessKey':_0x30b72a,'format':_0x43dafb,'pageSize':_0x466feb,'riskLevel':_0x3e52ca,'verbose':_0x4d40f9,'apiDir':_0x1a1bad,'apps':_0x5e19fd,'defaultApp':_0x546ae6,'currentApp':_0xd00142?_0x550a69:undefined,'explicitAppName':_0x2f685e,'raw':_0x14e1dd};}async function buildAuth(_0x467953){const _0x3cc0d4=a83_0x582c9f,{getCookie:_0x5d201d}=await import(_0x3cc0d4(0x1a4)),_0xc69328=_0x467953[_0x3cc0d4(0x1c8)]||_0x5d201d(),_0x2beca4=_0xc69328?await getIsSessionValid():![];return{'cookie':_0xc69328,'isLoggedIn':_0x2beca4,async 'getOrLogin'(){if(_0xc69328&&_0x2beca4)return _0xc69328;throw CliErrors['authRequired']();}};}export function resolveApiFilePath(_0x2cbe20,_0x1d489d){const _0x289a68=a83_0x582c9f,_0xc7d3e0=resolve(process[_0x289a68(0x1c9)](),_0x2cbe20),_0x599cca=resolve(_0xc7d3e0,_0x289a68(0x1c2));if(!_0x1d489d)return _0x599cca;const _0x530844=readRawConfig(),_0x37abf2=_0x530844[_0x289a68(0x1b2)]&&typeof _0x530844[_0x289a68(0x1b2)]===_0x289a68(0x1cf)?_0x530844[_0x289a68(0x1b2)]:{},_0x389d25=Object['entries'](_0x37abf2)[_0x289a68(0x1b6)](([,_0x2d6d34])=>_0x2d6d34?.['appcode']===_0x1d489d);if(!_0x389d25)return _0x599cca;const [_0x3b7b0b,_0x1549ee]=_0x389d25,_0x575fdf=typeof _0x530844[_0x289a68(0x1d7)]==='string'?_0x530844[_0x289a68(0x1d7)]:undefined;if(_0x1549ee?.['apiDir'])return _0x599cca;if(_0x575fdf&&_0x3b7b0b!==_0x575fdf)return resolve(_0xc7d3e0,_0x3b7b0b+_0x289a68(0x1cc));return _0x599cca;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3d3445,_0x513122){const _0x31c683=a84_0x1377,_0x48aa0c=_0x3d3445();while(!![]){try{const _0xabe2ca=parseInt(_0x31c683(0x1ce))/0x1+-parseInt(_0x31c683(0x1c8))/0x2*(-parseInt(_0x31c683(0x1c5))/0x3)+parseInt(_0x31c683(0x1bf))/0x4*(parseInt(_0x31c683(0x1ca))/0x5)+parseInt(_0x31c683(0x1c4))/0x6*(parseInt(_0x31c683(0x1d1))/0x7)+parseInt(_0x31c683(0x1cb))/0x8+parseInt(_0x31c683(0x1c0))/0x9+-parseInt(_0x31c683(0x1d0))/0xa;if(_0xabe2ca===_0x513122)break;else _0x48aa0c['push'](_0x48aa0c['shift']());}catch(_0x1405e6){_0x48aa0c['push'](_0x48aa0c['shift']());}}}(a84_0x59e3,0xd868a));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';const cache=new Map();function a84_0x59e3(){const _0x463315=['cwd','524649jhZQeW','datasetCode','39786160xPeQgO','3164mtXkbi','295392ZQalGy','9059211KZzuMg','exec','alias','push','16014WsKxIj','744NtkKdG','api.ts','utf-8','9538dxlMZw','has','20azITdq','5194448vlrqHV','set'];a84_0x59e3=function(){return _0x463315;};return a84_0x59e3();}function a84_0x1377(_0xdd20ea,_0x271d97){_0xdd20ea=_0xdd20ea-0x1bf;const _0x59e3c0=a84_0x59e3();let _0x1377da=_0x59e3c0[_0xdd20ea];return _0x1377da;}function parseApiFile(_0x3d20ce){const _0x327c8d=a84_0x1377,_0x1dda18=[],_0x129c6f=/\{\s*datasetCode:\s*"([^"]+)"\s*,\s*tableName:\s*"([^"]+)"\s*,\s*name:\s*"([^"]*?)"\s*,\s*alias:\s*"([^"]+)"\s*,?\s*\}/g;let _0x5a96dc;while((_0x5a96dc=_0x129c6f[_0x327c8d(0x1c1)](_0x3d20ce))!==null){_0x1dda18[_0x327c8d(0x1c3)]({'datasetCode':_0x5a96dc[0x1],'tableName':_0x5a96dc[0x2],'name':_0x5a96dc[0x3],'alias':_0x5a96dc[0x4]});}return _0x1dda18;}export function loadAliasMap(_0x3b56b4,_0x3b6e95,_0x5a625e){const _0x3f12c8=a84_0x1377,_0x49ef4c=_0x5a625e??resolve(process[_0x3f12c8(0x1cd)](),_0x3b56b4,_0x3f12c8(0x1c6));if(cache[_0x3f12c8(0x1c9)](_0x49ef4c))return cache['get'](_0x49ef4c);if(!existsSync(_0x49ef4c))return cache[_0x3f12c8(0x1cc)](_0x49ef4c,[]),[];try{const _0x12389b=readFileSync(_0x49ef4c,_0x3f12c8(0x1c7)),_0x58c614=parseApiFile(_0x12389b);return cache[_0x3f12c8(0x1cc)](_0x49ef4c,_0x58c614),_0x58c614;}catch{return cache['set'](_0x49ef4c,[]),[];}}export function resolveAlias(_0x3fdd69,_0x43e111,_0x47282c,_0x2d794b){const _0x47dc87=a84_0x1377;if(!_0x43e111)return undefined;const _0xd56a2b=loadAliasMap(_0x3fdd69,_0x47282c,_0x2d794b),_0x5dc138=_0xd56a2b['find'](_0x1f5121=>_0x1f5121[_0x47dc87(0x1c2)]===_0x43e111);return _0x5dc138?.[_0x47dc87(0x1cf)];}export function listAliases(_0x594c63,_0x2048ed,_0xc9df87){return loadAliasMap(_0x594c63,_0x2048ed,_0xc9df87);}
|
package/lib/core/api-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x4bc779,_0xa57c5d){const _0x5e71bb=a85_0x5e1b,_0x33a39b=_0x4bc779();while(!![]){try{const _0x4c745d=-parseInt(_0x5e71bb(0x25a))/0x1*(parseInt(_0x5e71bb(0x210))/0x2)+-parseInt(_0x5e71bb(0x255))/0x3+parseInt(_0x5e71bb(0x253))/0x4+parseInt(_0x5e71bb(0x212))/0x5+-parseInt(_0x5e71bb(0x21f))/0x6+-parseInt(_0x5e71bb(0x230))/0x7*(-parseInt(_0x5e71bb(0x22b))/0x8)+parseInt(_0x5e71bb(0x23c))/0x9;if(_0x4c745d===_0xa57c5d)break;else _0x33a39b['push'](_0x33a39b['shift']());}catch(_0x28a087){_0x33a39b['push'](_0x33a39b['shift']());}}}(a85_0xc16c,0xb04c9));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain,getRuntimeDomain}from'../constant/domain.js';import{CliErrors}from'../errors.js';import{extractList,extractPaging}from'../framework/response.js';let _activeCookie;export function setActiveCookie(_0x323b92){_activeCookie=_0x323b92||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}function a85_0x5e1b(_0x1245b5,_0x49a0cd){_0x1245b5=_0x1245b5-0x1ec;const _0xc16ce3=a85_0xc16c();let _0x5e1b26=_0xc16ce3[_0x1245b5];return _0x5e1b26;}async function apiRequest(_0x1d5587,_0xa9ff16={}){const _0x442cd1=a85_0x5e1b,{method:method=_0x442cd1(0x20a),body:_0x150570,headers:headers={},timeout:timeout=0x7530,useRuntime:useRuntime=![]}=_0xa9ff16,_0x10a7e7=useRuntime?getRuntimeDomain():getApiDomain(),_0x1a929b=_activeCookie||getCookie(),_0x281c22=''+_0x10a7e7+_0x1d5587,_0x18807d=new AbortController(),_0x379ee2=setTimeout(()=>_0x18807d[_0x442cd1(0x201)](),timeout);try{const _0x21ffa4=await fetch(_0x281c22,{'method':method,'headers':{'Content-Type':'application/json','Cookie':_0x1a929b,'X-Invoke-Source':'cli:rabetbase',...headers},'body':_0x150570?JSON['stringify'](_0x150570):undefined,'signal':_0x18807d[_0x442cd1(0x227)]});let _0x591f37;try{_0x591f37=await _0x21ffa4[_0x442cd1(0x220)]();}catch{throw CliErrors[_0x442cd1(0x204)]('API\x20returned\x20non-JSON\x20response\x20(HTTP\x20'+_0x21ffa4[_0x442cd1(0x1fe)]+')',_0x21ffa4['status']>=0x190?_0x442cd1(0x244):undefined);}if(!_0x21ffa4['ok']||_0x591f37[_0x442cd1(0x25e)]===![])throw CliErrors[_0x442cd1(0x204)](_0x591f37[_0x442cd1(0x21a)]||_0x591f37['message']||_0x442cd1(0x224)+_0x21ffa4[_0x442cd1(0x1fe)],_0x591f37[_0x442cd1(0x203)]?'API\x20error\x20code:\x20'+_0x591f37[_0x442cd1(0x203)]:undefined);return _0x591f37;}catch(_0x251f8a){if(_0x251f8a instanceof Error&&_0x251f8a[_0x442cd1(0x1f3)]===_0x442cd1(0x243))throw CliErrors[_0x442cd1(0x204)]('Request\x20timeout:\x20'+_0x281c22);throw _0x251f8a;}finally{clearTimeout(_0x379ee2);}}function a85_0xc16c(){const _0x1e2c28=['const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','status','const\x20result\x20=\x20await\x20client.models.','stringify','abort','sqlCode','errorCode','apiError','\x20failed,\x20HTTP\x20','add','sqlName','tableName','object','GET','warn','functionName','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','\x20\x20});','join','314HPmyWA','\x20failed','6457575eJgfoG','401','totalCount','data','modelId','pageSize','//\x20','description','errorMsg','/smartapi/app/getList','validation','\x22\x20not\x20found\x20in\x20dataset\x20','scriptName','8024304ecmCPP','json','has','.filter({','map','API\x20error:\x20','authRequired','operations','signal','modelCode','/api/node-toolbox/sql/save','/smartapi/dataset/get-dataset-operation','4422392QeRqDE','delete','code','.remove(id);','isArray','14rhQEtA','filter','/smartapi/dataset/get-dataset-list','dataset_','type','method','\x20\x20\x20\x20sqlCode:\x20\x27','\x20\x20return\x20rows;','sdk','includes','requestFields','error','296118FpDEqy','\x20\x20pageSize:\x2020,','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','/smartapi/question/er-config','tableData','/api/management/library/scripts/statistics?appCode=','\x20\x20currentPage:\x201,','AbortError','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','/api/management/library/scripts/save','update','Dataset\x20not\x20found:\x20','&type=','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','target','Unauthorized','.create({\x20/*\x20fields\x20*/\x20});','create','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','UNAUTHORIZED','Warning:\x20showing\x20first\x20','3816764mApTNA','/api/management/library/scripts/info?id=','2823450stBhZS','toLowerCase','/api/custom/executeSql','operationName','\x20apps.\x20','2443cLDIrR','getOne','\x20\x20where:\x20{},','path','success','find','replace','test','push','(/*\x20params\x20*/);','message','POST','});','name','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{','dbtableConfig','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','label','body','.getOne(id);','responseFields','BFF\x20script\x20not\x20found:\x20id=','errorMessage'];a85_0xc16c=function(){return _0x1e2c28;};return a85_0xc16c();}function isAuthFailure(_0x11e168){const _0x1ac8df=a85_0x5e1b,_0x169f19=_0x11e168[_0x1ac8df(0x21a)]||_0x11e168['message']||_0x11e168[_0x1ac8df(0x215)]?.[_0x1ac8df(0x1f0)]||_0x11e168[_0x1ac8df(0x1fc)]||_0x11e168[_0x1ac8df(0x23b)]||'';return _0x11e168[_0x1ac8df(0x203)]===_0x1ac8df(0x251)||_0x11e168[_0x1ac8df(0x22d)]===0x191||_0x11e168['code']===_0x1ac8df(0x213)||_0x169f19['includes']('401')||_0x169f19[_0x1ac8df(0x239)](_0x1ac8df(0x24c))||_0x169f19['includes']('登录')||_0x169f19[_0x1ac8df(0x239)]('认证');}export async function platformFetch(_0x387022,_0x447de8){const _0x898eee=a85_0x5e1b,_0x45f1ce=await fetch(_0x387022,{'method':_0x447de8['method']??_0x898eee(0x20a),'headers':{'Content-Type':'application/json','Cookie':_0x447de8['cookie']},..._0x447de8[_0x898eee(0x1f8)]&&{'body':JSON[_0x898eee(0x200)](_0x447de8[_0x898eee(0x1f8)])}});if(!_0x45f1ce['ok']){if(_0x45f1ce[_0x898eee(0x1fe)]===0x191)throw CliErrors[_0x898eee(0x225)]();throw CliErrors['apiError'](_0x447de8[_0x898eee(0x1f7)]+_0x898eee(0x205)+_0x45f1ce[_0x898eee(0x1fe)]);}const _0x147ab2=await _0x45f1ce[_0x898eee(0x220)]();if(_0x147ab2['success']===![]){if(isAuthFailure(_0x147ab2))throw CliErrors[_0x898eee(0x225)]();throw CliErrors[_0x898eee(0x204)](_0x147ab2[_0x898eee(0x21a)]||_0x147ab2[_0x898eee(0x1f0)]||_0x447de8['label']+_0x898eee(0x211));}return _0x147ab2[_0x898eee(0x215)];}export async function listBffScripts(_0x4663a0,_0x39078c,_0x156ca6){const _0x3bc026=a85_0x5e1b;let _0xc303d6='/api/management/library/scripts/list?appCode='+_0x4663a0;if(_0x39078c)_0xc303d6+=_0x3bc026(0x249)+_0x39078c;const _0x5dc713=await apiRequest(_0xc303d6);let _0x60056=extractList(_0x5dc713[_0x3bc026(0x215)]);if(_0x156ca6?.[_0x3bc026(0x21e)]){const _0x4744eb=_0x156ca6[_0x3bc026(0x21e)][_0x3bc026(0x256)]();_0x60056=_0x60056[_0x3bc026(0x231)](_0x352034=>_0x352034[_0x3bc026(0x20c)]?.[_0x3bc026(0x256)]()[_0x3bc026(0x239)](_0x4744eb)||_0x352034[_0x3bc026(0x219)]?.['toLowerCase']()[_0x3bc026(0x239)](_0x4744eb));}return _0x60056;}export async function getBffScriptInfo(_0x48522e){const _0x3e08f2=a85_0x5e1b,_0x39abb9=await apiRequest(_0x3e08f2(0x254)+_0x48522e);if(!_0x39abb9[_0x3e08f2(0x215)])throw CliErrors[_0x3e08f2(0x21c)](_0x3e08f2(0x1fb)+_0x48522e);return _0x39abb9[_0x3e08f2(0x215)];}export async function saveBffScript(_0x1f0216){const _0xbbaa32=a85_0x5e1b,_0x41143d=await apiRequest(_0xbbaa32(0x246),{'method':_0xbbaa32(0x1f1),'body':_0x1f0216});return _0x41143d[_0xbbaa32(0x215)];}export async function deleteBffScript(_0x240e38){const _0xaa9ed9=a85_0x5e1b;await apiRequest('/api/management/library/scripts/delete',{'method':_0xaa9ed9(0x1f1),'body':{'id':_0x240e38}});}export async function getBffScriptStatistics(_0x56538f){const _0x3a486e=a85_0x5e1b,_0x2b1969=await apiRequest(_0x3a486e(0x241)+_0x56538f);return extractList(_0x2b1969['data']);}export async function listBffDatasetOperations(_0x39f9ee,_0xed539){const _0x251aef=a85_0x5e1b,_0x3725cc=await apiRequest(_0x251aef(0x22a),{'method':_0x251aef(0x1f1),'body':{'appCode':_0x39f9ee,'datasetId':_0xed539}});return _0x3725cc[_0x251aef(0x215)];}export async function listSqlQueries(_0xd5578c,_0x1ed77c){const _0x39f744=a85_0x5e1b,_0x56a5df=await apiRequest('/smartapi/custom/queryUserCustomSqlList',{'method':'POST','body':{'appCode':_0xd5578c,'currentPage':_0x1ed77c?.['currentPage']??0x1,'pageSize':_0x1ed77c?.[_0x39f744(0x217)]??0x32,'sqlCode':_0x1ed77c?.[_0x39f744(0x202)],'sqlName':_0x1ed77c?.[_0x39f744(0x207)]}});return _0x56a5df[_0x39f744(0x215)];}export async function getSqlQueryInfo(_0x223225,_0x3dc299){const _0x31ab2f=a85_0x5e1b,_0x19cbc9=await listSqlQueries(_0x223225,{'sqlCode':_0x3dc299}),_0x5d503b=_0x19cbc9[_0x31ab2f(0x240)]?.[0x0];if(!_0x5d503b)throw CliErrors[_0x31ab2f(0x21c)]('SQL\x20query\x20not\x20found:\x20'+_0x3dc299);return _0x5d503b;}export async function saveSqlQuery(_0x5615e5){const _0xf8ed13=a85_0x5e1b,_0x1ebbfc=await apiRequest(_0xf8ed13(0x229),{'method':'POST','body':_0x5615e5});return _0x1ebbfc[_0xf8ed13(0x215)];}export async function executeSql(_0x55cf0b,_0x16f5d3,_0x43c415){const _0x38a3a1=a85_0x5e1b,_0x28f5e2=await apiRequest(_0x38a3a1(0x257),{'method':'POST','body':{'appCode':_0x55cf0b,'sqlCode':_0x16f5d3,..._0x43c415&&{'params':_0x43c415}},'useRuntime':!![]});return _0x28f5e2['data'];}export async function listDatasets(_0x3cdc66,_0x77cda){const _0xc2861=a85_0x5e1b,_0x1e197f={'appCode':_0x3cdc66,'deleted':![]};if(_0x77cda?.[_0xc2861(0x22d)])_0x1e197f[_0xc2861(0x22d)]=_0x77cda[_0xc2861(0x22d)];if(_0x77cda?.[_0xc2861(0x1f3)])_0x1e197f['name']=_0x77cda[_0xc2861(0x1f3)];const _0x3bd80b=await apiRequest(_0xc2861(0x232),{'method':_0xc2861(0x1f1),'body':_0x1e197f});return extractList(_0x3bd80b['data']);}export async function searchDatasets(_0x42ad87,_0x12aa7e){const _0x297aea=a85_0x5e1b,_0x3d05e8=await listDatasets(_0x42ad87,{'name':_0x12aa7e}),_0x3f88af=_0x12aa7e[_0x297aea(0x256)](),_0x169e3b=new Set(_0x3d05e8[_0x297aea(0x223)](_0x10ab16=>_0x10ab16['id'])),_0x2ff0d3=_0x3d05e8['filter'](_0x59c828=>_0x59c828[_0x297aea(0x1f5)]?.[_0x297aea(0x208)]?.[_0x297aea(0x256)]()[_0x297aea(0x239)](_0x3f88af)||_0x59c828['description']?.[_0x297aea(0x256)]()[_0x297aea(0x239)](_0x3f88af)),_0x241b7c=await listDatasets(_0x42ad87,{'code':_0x12aa7e});for(const _0x2954d2 of _0x241b7c){!_0x169e3b[_0x297aea(0x221)](_0x2954d2['id'])&&(_0x3d05e8[_0x297aea(0x1ee)](_0x2954d2),_0x169e3b[_0x297aea(0x206)](_0x2954d2['id']));}return _0x3d05e8;}export function normalizeDatasetOperations(_0x2069aa){const _0x57bbdd=a85_0x5e1b;if(Array[_0x57bbdd(0x22f)](_0x2069aa))return _0x2069aa[_0x57bbdd(0x231)](_0xd7123c=>_0xd7123c!=null&&typeof _0xd7123c===_0x57bbdd(0x209));if(_0x2069aa&&typeof _0x2069aa===_0x57bbdd(0x209))return Object['entries'](_0x2069aa)[_0x57bbdd(0x231)](([,_0xe2f1db])=>_0xe2f1db!=null&&typeof _0xe2f1db===_0x57bbdd(0x209))['map'](([_0x36d974,_0x25636a])=>({..._0x25636a,'name':_0x25636a['name']??_0x25636a[_0x57bbdd(0x258)]??_0x36d974}));return[];}export async function getDatasetDetail(_0x3eb1fc){const _0x19d19f=a85_0x5e1b,_0x38896c=/^\d+$/[_0x19d19f(0x1ed)](_0x3eb1fc)?'id':_0x19d19f(0x22d),_0x467f38=await apiRequest('/smartapi/dataset/get-driven-data?'+_0x38896c+'='+_0x3eb1fc);return _0x467f38[_0x19d19f(0x215)];}export async function getDatasetOperations(_0x1f97ad){const _0x538a27=a85_0x5e1b,_0x10bced=await getDatasetDetail(_0x1f97ad),_0xb0b01f=normalizeDatasetOperations(_0x10bced[_0x538a27(0x226)])[_0x538a27(0x223)](_0x7f6203=>({'name':_0x7f6203[_0x538a27(0x1f3)]||_0x7f6203[_0x538a27(0x258)],'displayName':_0x7f6203['displayName']||_0x7f6203[_0x538a27(0x1f3)],'type':_0x7f6203[_0x538a27(0x234)],'method':_0x7f6203[_0x538a27(0x235)],'path':_0x7f6203[_0x538a27(0x25d)],'enabled':_0x7f6203['enabled']??!![],'requestFields':_0x7f6203[_0x538a27(0x23a)],'responseFields':_0x7f6203[_0x538a27(0x1fa)]}));return{'dataset':{'id':_0x10bced['id']??_0x10bced[_0x538a27(0x216)],'name':_0x10bced[_0x538a27(0x1f3)],'code':_0x10bced[_0x538a27(0x22d)]||_0x10bced[_0x538a27(0x228)],'tableName':_0x10bced[_0x538a27(0x208)]||_0x10bced[_0x538a27(0x1f5)]?.['tableName']},'operations':_0xb0b01f};}export async function getOperationDetail(_0x57906a,_0x6fa0c7,_0x50f257){const _0x39ad0f=a85_0x5e1b;let _0x4c2124=_0x6fa0c7;if(!/^\d+$/[_0x39ad0f(0x1ed)](_0x6fa0c7)){const _0x21d49e=await listDatasets(_0x57906a,{'code':_0x6fa0c7}),_0x3c9d95=_0x21d49e[_0x39ad0f(0x25f)](_0x4fe0d8=>_0x4fe0d8[_0x39ad0f(0x22d)]===_0x6fa0c7||String(_0x4fe0d8['id'])===_0x6fa0c7);if(!_0x3c9d95)throw CliErrors[_0x39ad0f(0x21c)](_0x39ad0f(0x248)+_0x6fa0c7);_0x4c2124=String(_0x3c9d95['id']);}const _0x4ddea1=await getDatasetDetail(_0x4c2124),_0x5eb5a2=normalizeDatasetOperations(_0x4ddea1[_0x39ad0f(0x226)])[_0x39ad0f(0x25f)](_0x5da412=>(_0x5da412[_0x39ad0f(0x1f3)]||_0x5da412[_0x39ad0f(0x258)])===_0x50f257);if(!_0x5eb5a2)throw CliErrors['validation']('Operation\x20\x22'+_0x50f257+_0x39ad0f(0x21d)+_0x6fa0c7);return{'dataset':{'id':_0x4ddea1['id']??_0x4ddea1[_0x39ad0f(0x216)],'name':_0x4ddea1[_0x39ad0f(0x1f3)],'code':_0x4ddea1[_0x39ad0f(0x22d)]||_0x4ddea1[_0x39ad0f(0x228)],'tableName':_0x4ddea1[_0x39ad0f(0x208)]||_0x4ddea1[_0x39ad0f(0x1f5)]?.[_0x39ad0f(0x208)]},'operation':_0x5eb5a2};}export function generateSdkCode(_0x4641b8,_0x574f60,_0x255460){const _0x1a6609=a85_0x5e1b,_0x177723=_0x255460?.['includeImports']??!![],_0x3adf0d=_0x1a6609(0x233)+_0x4641b8[_0x1a6609(0x22d)]?.[_0x1a6609(0x1ec)](/-/g,'_'),_0xc71888=_0x574f60[_0x1a6609(0x1f3)]||_0x574f60[_0x1a6609(0x258)]||_0x1a6609(0x231),_0x327d6b=[];_0x177723&&_0x327d6b[_0x1a6609(0x1ee)](_0x1a6609(0x24a),'',_0x1a6609(0x1fd),'');_0x327d6b[_0x1a6609(0x1ee)](_0x1a6609(0x218)+_0x4641b8[_0x1a6609(0x1f3)]+'\x20('+(_0x4641b8[_0x1a6609(0x208)]||'table')+')');if(_0xc71888===_0x1a6609(0x231))_0x327d6b[_0x1a6609(0x1ee)](_0x1a6609(0x1ff)+_0x3adf0d+_0x1a6609(0x222),_0x1a6609(0x25c),_0x1a6609(0x23d),_0x1a6609(0x242),_0x1a6609(0x1f2));else{if(_0xc71888===_0x1a6609(0x25b))_0x327d6b[_0x1a6609(0x1ee)](_0x1a6609(0x1ff)+_0x3adf0d+_0x1a6609(0x1f9));else{if(_0xc71888===_0x1a6609(0x24e))_0x327d6b[_0x1a6609(0x1ee)]('const\x20result\x20=\x20await\x20client.models.'+_0x3adf0d+_0x1a6609(0x24d));else{if(_0xc71888===_0x1a6609(0x247))_0x327d6b[_0x1a6609(0x1ee)](_0x1a6609(0x1ff)+_0x3adf0d+_0x1a6609(0x23e));else _0xc71888===_0x1a6609(0x22c)||_0xc71888==='remove'?_0x327d6b[_0x1a6609(0x1ee)](_0x1a6609(0x1ff)+_0x3adf0d+_0x1a6609(0x22e)):_0x327d6b[_0x1a6609(0x1ee)](_0x1a6609(0x1ff)+_0x3adf0d+'.'+_0xc71888+_0x1a6609(0x1ef));}}}return _0x327d6b[_0x1a6609(0x20f)]('\x0a');}export function generateSqlCodeTemplate(_0x1f9c3e,_0x48c729){const _0x4c0dc2=a85_0x5e1b,_0x3ef133=_0x48c729?.[_0x4c0dc2(0x24b)]??'sdk',_0x5ba0a6=_0x48c729?.['includeImports']??!![],_0x3a5b89=[];return _0x3a5b89[_0x4c0dc2(0x1ee)]('//\x20SQL:\x20'+_0x1f9c3e['sqlName']+'\x20('+_0x1f9c3e['sqlCode']+')'),_0x3ef133===_0x4c0dc2(0x238)?(_0x5ba0a6&&_0x3a5b89['push'](_0x4c0dc2(0x24a),'',_0x4c0dc2(0x1fd),''),_0x3a5b89[_0x4c0dc2(0x1ee)]('const\x20data\x20=\x20await\x20client.sql.execute({','\x20\x20sqlCode:\x20\x27'+_0x1f9c3e[_0x4c0dc2(0x202)]+'\x27,',_0x4c0dc2(0x24f),_0x4c0dc2(0x1f2),'if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','const\x20results\x20=\x20data.execResult\x20||\x20[];')):_0x3a5b89[_0x4c0dc2(0x1ee)](_0x4c0dc2(0x1f6),_0x4c0dc2(0x1f4),_0x4c0dc2(0x250),_0x4c0dc2(0x236)+_0x1f9c3e[_0x4c0dc2(0x202)]+'\x27,',_0x4c0dc2(0x245),_0x4c0dc2(0x20e),_0x4c0dc2(0x237),'}'),_0x3a5b89[_0x4c0dc2(0x20f)]('\x0a');}export async function getErConfig(_0x35f0d7,_0x581f92){const _0x1c7938=a85_0x5e1b,_0xa5f27c=await apiRequest(_0x1c7938(0x23f),{'method':_0x1c7938(0x1f1),'body':{'appCode':_0x35f0d7,'dblinkId':_0x581f92}});return _0xa5f27c[_0x1c7938(0x215)];}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x50f7ae=a85_0x5e1b,_0x1de04d=await apiRequest(_0x50f7ae(0x21b),{'method':_0x50f7ae(0x1f1),'body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x47403b=extractList(_0x1de04d[_0x50f7ae(0x215)]),_0x402b17=extractPaging(_0x1de04d[_0x50f7ae(0x215)]);return _0x402b17&&_0x402b17[_0x50f7ae(0x214)]>REMOTE_APP_PAGE_SIZE&&console[_0x50f7ae(0x20b)](_0x50f7ae(0x252)+REMOTE_APP_PAGE_SIZE+'\x20of\x20'+_0x402b17[_0x50f7ae(0x214)]+_0x50f7ae(0x259)+_0x50f7ae(0x20d)),_0x47403b;}
|
|
1
|
+
(function(_0x4e7e9c,_0x16fe33){const _0x36a1a3=a85_0x92f9,_0x334e36=_0x4e7e9c();while(!![]){try{const _0x1583d2=parseInt(_0x36a1a3(0xd1))/0x1*(-parseInt(_0x36a1a3(0xfc))/0x2)+parseInt(_0x36a1a3(0xad))/0x3*(-parseInt(_0x36a1a3(0xf9))/0x4)+parseInt(_0x36a1a3(0xc4))/0x5+parseInt(_0x36a1a3(0x10e))/0x6*(parseInt(_0x36a1a3(0x98))/0x7)+-parseInt(_0x36a1a3(0xf5))/0x8*(-parseInt(_0x36a1a3(0xb8))/0x9)+parseInt(_0x36a1a3(0xa8))/0xa+parseInt(_0x36a1a3(0xea))/0xb;if(_0x1583d2===_0x16fe33)break;else _0x334e36['push'](_0x334e36['shift']());}catch(_0x1424ec){_0x334e36['push'](_0x334e36['shift']());}}}(a85_0x194b,0xf1fe7));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain,getRuntimeDomain}from'../constant/domain.js';import{CliErrors}from'../errors.js';import{extractList,extractPaging}from'../framework/response.js';let _activeCookie;function a85_0x92f9(_0x5091eb,_0x385241){_0x5091eb=_0x5091eb-0x94;const _0x194b97=a85_0x194b();let _0x92f9b1=_0x194b97[_0x5091eb];return _0x92f9b1;}export function setActiveCookie(_0x4a5cd5){_activeCookie=_0x4a5cd5||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}function a85_0x194b(){const _0x402f18=['AbortError','enabled','.remove(id);','description','BFF\x20script\x20not\x20found:\x20id=','message','update','API\x20error:\x20','});','\x20\x20currentPage:\x201,','/api/management/library/scripts/delete','success','sqlCode','7768240EKzdlx','test','push','sqlName','SQL\x20query\x20not\x20found:\x20','97410griaZn','modelId','apiError','cookie','scriptName','Unauthorized','body','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','/smartapi/dataset/get-dataset-list','error','Warning:\x20showing\x20first\x20','5176107wwSPzd','errorMsg','UNAUTHORIZED','code','/api/management/library/scripts/list?appCode=','/smartapi/dataset/get-dataset-operation','/smartapi/question/er-config','(/*\x20params\x20*/);','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','.create({\x20/*\x20fields\x20*/\x20});','abort','const\x20data\x20=\x20await\x20client.sql.execute({','643980lyMhth','/smartapi/dataset/get-driven-data?','totalCount','has','/api/node-toolbox/sql/save','dataset_','join','toLowerCase','authRequired','\x20apps.\x20','replace','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','167946qZVFuQ','/smartapi/app/getList','cli:rabetbase','displayName','tableName','target','filter','\x20\x20sqlCode:\x20\x27','isArray','operationName','errorMessage','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','includes','\x20of\x20','/api/management/library/scripts/statistics?appCode=','\x20failed,\x20HTTP\x20','const\x20result\x20=\x20await\x20client.models.','application/json','/api/management/library/scripts/info?id=','GET','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','operations','object','status','25362315xgUwdw','data','name','table','label','add','&type=','Operation\x20\x22','errorCode','includeImports','Request\x20timeout:\x20','8yPWdbn','dbtableConfig','API\x20error\x20code:\x20','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','124yZkyBG','delete','getOne','22JJEIYO','validation','map','\x20\x20});','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','.filter({','json','\x20\x20return\x20rows;','\x20\x20where:\x20{},','signal','401','functionName','/api/custom/executeSql','find','type','modelCode','Dataset\x20not\x20found:\x20','create','30kXSIeU','POST','\x20\x20pageSize:\x2020,','/api/management/library/scripts/save','method','82285LEjysq','stringify','sdk'];a85_0x194b=function(){return _0x402f18;};return a85_0x194b();}async function apiRequest(_0x26bfb9,_0x2cf9dd={}){const _0x36e1b0=a85_0x92f9,{method:method=_0x36e1b0(0xe5),body:_0x5157a3,headers:headers={},timeout:timeout=0x7530,useRuntime:useRuntime=![]}=_0x2cf9dd,_0x23f578=useRuntime?getRuntimeDomain():getApiDomain(),_0x414daf=_activeCookie||getCookie(),_0x89a705=''+_0x23f578+_0x26bfb9,_0x540744=new AbortController(),_0x18beaa=setTimeout(()=>_0x540744[_0x36e1b0(0xc2)](),timeout);try{const _0x4efecb=await fetch(_0x89a705,{'method':method,'headers':{'Content-Type':_0x36e1b0(0xe3),'Cookie':_0x414daf,'X-Invoke-Source':_0x36e1b0(0xd3),...headers},'body':_0x5157a3?JSON[_0x36e1b0(0x99)](_0x5157a3):undefined,'signal':_0x540744[_0x36e1b0(0x105)]});let _0x559272;try{_0x559272=await _0x4efecb[_0x36e1b0(0x102)]();}catch{throw CliErrors[_0x36e1b0(0xaf)](_0x36e1b0(0xd0)+_0x4efecb[_0x36e1b0(0xe9)]+')',_0x4efecb['status']>=0x190?'Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.':undefined);}if(!_0x4efecb['ok']||_0x559272['success']===![])throw CliErrors[_0x36e1b0(0xaf)](_0x559272[_0x36e1b0(0xb9)]||_0x559272[_0x36e1b0(0xa0)]||_0x36e1b0(0xa2)+_0x4efecb['status'],_0x559272[_0x36e1b0(0xf2)]?_0x36e1b0(0xf7)+_0x559272[_0x36e1b0(0xf2)]:undefined);return _0x559272;}catch(_0x229235){if(_0x229235 instanceof Error&&_0x229235[_0x36e1b0(0xec)]===_0x36e1b0(0x9b))throw CliErrors[_0x36e1b0(0xaf)](_0x36e1b0(0xf4)+_0x89a705);throw _0x229235;}finally{clearTimeout(_0x18beaa);}}function isAuthFailure(_0x238ae2){const _0x37189f=a85_0x92f9,_0x300ff4=_0x238ae2['errorMsg']||_0x238ae2[_0x37189f(0xa0)]||_0x238ae2['data']?.['message']||_0x238ae2[_0x37189f(0xdb)]||_0x238ae2[_0x37189f(0xb6)]||'';return _0x238ae2['errorCode']===_0x37189f(0xba)||_0x238ae2[_0x37189f(0xbb)]===0x191||_0x238ae2[_0x37189f(0xbb)]==='401'||_0x300ff4['includes'](_0x37189f(0x106))||_0x300ff4[_0x37189f(0xde)](_0x37189f(0xb2))||_0x300ff4['includes']('登录')||_0x300ff4[_0x37189f(0xde)]('认证');}export async function platformFetch(_0xebf02b,_0x16af78){const _0x18d48d=a85_0x92f9,_0x463c2c=await fetch(_0xebf02b,{'method':_0x16af78[_0x18d48d(0x97)]??_0x18d48d(0xe5),'headers':{'Content-Type':'application/json','Cookie':_0x16af78[_0x18d48d(0xb0)]},..._0x16af78[_0x18d48d(0xb3)]&&{'body':JSON[_0x18d48d(0x99)](_0x16af78['body'])}});if(!_0x463c2c['ok']){if(_0x463c2c[_0x18d48d(0xe9)]===0x191)throw CliErrors[_0x18d48d(0xcc)]();throw CliErrors[_0x18d48d(0xaf)](_0x16af78[_0x18d48d(0xee)]+_0x18d48d(0xe1)+_0x463c2c[_0x18d48d(0xe9)]);}const _0xe74f25=await _0x463c2c[_0x18d48d(0x102)]();if(_0xe74f25[_0x18d48d(0xa6)]===![]){if(isAuthFailure(_0xe74f25))throw CliErrors[_0x18d48d(0xcc)]();throw CliErrors[_0x18d48d(0xaf)](_0xe74f25['errorMsg']||_0xe74f25['message']||_0x16af78[_0x18d48d(0xee)]+'\x20failed');}return _0xe74f25[_0x18d48d(0xeb)];}export async function listBffScripts(_0x325c85,_0x309c4c,_0x4bfca9){const _0x37a9ee=a85_0x92f9;let _0x129575=_0x37a9ee(0xbc)+_0x325c85;if(_0x309c4c)_0x129575+=_0x37a9ee(0xf0)+_0x309c4c;const _0x6efee0=await apiRequest(_0x129575);let _0x8f12d7=extractList(_0x6efee0[_0x37a9ee(0xeb)]);if(_0x4bfca9?.[_0x37a9ee(0xb1)]){const _0x32c340=_0x4bfca9[_0x37a9ee(0xb1)]['toLowerCase']();_0x8f12d7=_0x8f12d7['filter'](_0x571977=>_0x571977[_0x37a9ee(0x107)]?.[_0x37a9ee(0xcb)]()['includes'](_0x32c340)||_0x571977[_0x37a9ee(0x9e)]?.[_0x37a9ee(0xcb)]()[_0x37a9ee(0xde)](_0x32c340));}return _0x8f12d7;}export async function getBffScriptInfo(_0x35ca57){const _0x2c14d3=a85_0x92f9,_0xf455dd=await apiRequest(_0x2c14d3(0xe4)+_0x35ca57);if(!_0xf455dd[_0x2c14d3(0xeb)])throw CliErrors['validation'](_0x2c14d3(0x9f)+_0x35ca57);return _0xf455dd[_0x2c14d3(0xeb)];}export async function saveBffScript(_0x27483a){const _0xe8780b=a85_0x92f9,_0x30e383=await apiRequest(_0xe8780b(0x96),{'method':'POST','body':_0x27483a});return _0x30e383['data'];}export async function deleteBffScript(_0x264e11){const _0x18747e=a85_0x92f9;await apiRequest(_0x18747e(0xa5),{'method':'POST','body':{'id':_0x264e11}});}export async function getBffScriptStatistics(_0x1caac7){const _0x265f8d=a85_0x92f9,_0x44f2d4=await apiRequest(_0x265f8d(0xe0)+_0x1caac7);return extractList(_0x44f2d4[_0x265f8d(0xeb)]);}export async function listBffDatasetOperations(_0x1e0df0,_0x5d148d){const _0x330bc4=a85_0x92f9,_0x5b1b6f=await apiRequest(_0x330bc4(0xbd),{'method':_0x330bc4(0x94),'body':{'appCode':_0x1e0df0,'datasetId':_0x5d148d}});return _0x5b1b6f[_0x330bc4(0xeb)];}export async function listSqlQueries(_0x4760d0,_0x532ee6){const _0x229b81=a85_0x92f9,_0x3b6261=await apiRequest('/smartapi/custom/queryUserCustomSqlList',{'method':_0x229b81(0x94),'body':{'appCode':_0x4760d0,'currentPage':_0x532ee6?.['currentPage']??0x1,'pageSize':_0x532ee6?.['pageSize']??0x32,'sqlCode':_0x532ee6?.[_0x229b81(0xa7)],'sqlName':_0x532ee6?.['sqlName']}});return _0x3b6261[_0x229b81(0xeb)];}export async function getSqlQueryInfo(_0x9c603a,_0x3e98ef){const _0x2afe71=a85_0x92f9,_0x258036=await listSqlQueries(_0x9c603a,{'sqlCode':_0x3e98ef}),_0x2acf02=_0x258036['tableData']?.[0x0];if(!_0x2acf02)throw CliErrors['validation'](_0x2afe71(0xac)+_0x3e98ef);return _0x2acf02;}export async function saveSqlQuery(_0x198efd){const _0x4c394e=a85_0x92f9,_0x3342af=await apiRequest(_0x4c394e(0xc8),{'method':_0x4c394e(0x94),'body':_0x198efd});return _0x3342af[_0x4c394e(0xeb)];}export async function executeSql(_0x5d5e3b,_0x26e962,_0x9c3d54){const _0xfc2ee9=a85_0x92f9,_0x8a55eb=await apiRequest(_0xfc2ee9(0x108),{'method':_0xfc2ee9(0x94),'body':{'appCode':_0x5d5e3b,'sqlCode':_0x26e962,..._0x9c3d54&&{'params':_0x9c3d54}},'useRuntime':!![]});return _0x8a55eb['data'];}export async function listDatasets(_0x4c6868,_0x5c3806){const _0xd87b83=a85_0x92f9,_0x3e1692={'appCode':_0x4c6868,'deleted':![]};if(_0x5c3806?.['code'])_0x3e1692[_0xd87b83(0xbb)]=_0x5c3806['code'];if(_0x5c3806?.[_0xd87b83(0xec)])_0x3e1692[_0xd87b83(0xec)]=_0x5c3806[_0xd87b83(0xec)];const _0x483bfb=await apiRequest(_0xd87b83(0xb5),{'method':_0xd87b83(0x94),'body':_0x3e1692});return extractList(_0x483bfb['data']);}export async function searchDatasets(_0x5e43d8,_0x4ad999){const _0x183b6e=a85_0x92f9,_0x36cf24=await listDatasets(_0x5e43d8,{'name':_0x4ad999}),_0x182587=_0x4ad999['toLowerCase'](),_0x18a4e4=new Set(_0x36cf24['map'](_0x50b19f=>_0x50b19f['id'])),_0x1fd51e=_0x36cf24[_0x183b6e(0xd7)](_0x13528d=>_0x13528d[_0x183b6e(0xf6)]?.[_0x183b6e(0xd5)]?.[_0x183b6e(0xcb)]()[_0x183b6e(0xde)](_0x182587)||_0x13528d[_0x183b6e(0x9e)]?.[_0x183b6e(0xcb)]()[_0x183b6e(0xde)](_0x182587)),_0x144a26=await listDatasets(_0x5e43d8,{'code':_0x4ad999});for(const _0x1df799 of _0x144a26){!_0x18a4e4[_0x183b6e(0xc7)](_0x1df799['id'])&&(_0x36cf24['push'](_0x1df799),_0x18a4e4[_0x183b6e(0xef)](_0x1df799['id']));}return _0x36cf24;}export function normalizeDatasetOperations(_0x471ed1){const _0x247564=a85_0x92f9;if(Array[_0x247564(0xd9)](_0x471ed1))return _0x471ed1['filter'](_0x4fc56d=>_0x4fc56d!=null&&typeof _0x4fc56d==='object');if(_0x471ed1&&typeof _0x471ed1===_0x247564(0xe8))return Object['entries'](_0x471ed1)[_0x247564(0xd7)](([,_0x543f4b])=>_0x543f4b!=null&&typeof _0x543f4b===_0x247564(0xe8))[_0x247564(0xfe)](([_0x3cf2a2,_0x265af3])=>({..._0x265af3,'name':_0x265af3[_0x247564(0xec)]??_0x265af3[_0x247564(0xda)]??_0x3cf2a2}));return[];}export async function getDatasetDetail(_0xf9cfab){const _0x27b452=a85_0x92f9,_0x3ced68=/^\d+$/[_0x27b452(0xa9)](_0xf9cfab)?'id':_0x27b452(0xbb),_0x59156a=await apiRequest(_0x27b452(0xc5)+_0x3ced68+'='+_0xf9cfab);return _0x59156a[_0x27b452(0xeb)];}export async function getDatasetOperations(_0x3d3462){const _0x3c0505=a85_0x92f9,_0x31f126=await getDatasetDetail(_0x3d3462),_0x4bab8=normalizeDatasetOperations(_0x31f126['operations'])[_0x3c0505(0xfe)](_0x12b0b7=>({'name':_0x12b0b7[_0x3c0505(0xec)]||_0x12b0b7[_0x3c0505(0xda)],'displayName':_0x12b0b7[_0x3c0505(0xd4)]||_0x12b0b7[_0x3c0505(0xec)],'type':_0x12b0b7[_0x3c0505(0x10a)],'method':_0x12b0b7[_0x3c0505(0x97)],'path':_0x12b0b7['path'],'enabled':_0x12b0b7[_0x3c0505(0x9c)]??!![],'requestFields':_0x12b0b7['requestFields'],'responseFields':_0x12b0b7['responseFields']}));return{'dataset':{'id':_0x31f126['id']??_0x31f126[_0x3c0505(0xae)],'name':_0x31f126[_0x3c0505(0xec)],'code':_0x31f126[_0x3c0505(0xbb)]||_0x31f126[_0x3c0505(0x10b)],'tableName':_0x31f126[_0x3c0505(0xd5)]||_0x31f126['dbtableConfig']?.[_0x3c0505(0xd5)]},'operations':_0x4bab8};}export async function getOperationDetail(_0x47fe53,_0x2b0903,_0x51e19f){const _0xbd08f7=a85_0x92f9;let _0x30a636=_0x2b0903;if(!/^\d+$/[_0xbd08f7(0xa9)](_0x2b0903)){const _0x475fdf=await listDatasets(_0x47fe53,{'code':_0x2b0903}),_0x498824=_0x475fdf[_0xbd08f7(0x109)](_0x58b4a7=>_0x58b4a7['code']===_0x2b0903||String(_0x58b4a7['id'])===_0x2b0903);if(!_0x498824)throw CliErrors[_0xbd08f7(0xfd)](_0xbd08f7(0x10c)+_0x2b0903);_0x30a636=String(_0x498824['id']);}const _0x324325=await getDatasetDetail(_0x30a636),_0x50a45b=normalizeDatasetOperations(_0x324325[_0xbd08f7(0xe7)])[_0xbd08f7(0x109)](_0x189154=>(_0x189154[_0xbd08f7(0xec)]||_0x189154[_0xbd08f7(0xda)])===_0x51e19f);if(!_0x50a45b)throw CliErrors[_0xbd08f7(0xfd)](_0xbd08f7(0xf1)+_0x51e19f+'\x22\x20not\x20found\x20in\x20dataset\x20'+_0x2b0903);return{'dataset':{'id':_0x324325['id']??_0x324325[_0xbd08f7(0xae)],'name':_0x324325[_0xbd08f7(0xec)],'code':_0x324325['code']||_0x324325[_0xbd08f7(0x10b)],'tableName':_0x324325['tableName']||_0x324325[_0xbd08f7(0xf6)]?.[_0xbd08f7(0xd5)]},'operation':_0x50a45b};}export function generateSdkCode(_0x1ad361,_0x564a66,_0x372e11){const _0x172d60=a85_0x92f9,_0x201c36=_0x372e11?.[_0x172d60(0xf3)]??!![],_0x535d1f=_0x172d60(0xc9)+_0x1ad361[_0x172d60(0xbb)]?.[_0x172d60(0xce)](/-/g,'_'),_0x179617=_0x564a66[_0x172d60(0xec)]||_0x564a66[_0x172d60(0xda)]||'filter',_0x1ba992=[];_0x201c36&&_0x1ba992[_0x172d60(0xaa)](_0x172d60(0xdc),'',_0x172d60(0xb4),'');_0x1ba992[_0x172d60(0xaa)]('//\x20'+_0x1ad361[_0x172d60(0xec)]+'\x20('+(_0x1ad361['tableName']||_0x172d60(0xed))+')');if(_0x179617===_0x172d60(0xd7))_0x1ba992[_0x172d60(0xaa)](_0x172d60(0xe2)+_0x535d1f+_0x172d60(0x101),_0x172d60(0x104),_0x172d60(0x95),_0x172d60(0xa4),_0x172d60(0xa3));else{if(_0x179617===_0x172d60(0xfb))_0x1ba992[_0x172d60(0xaa)](_0x172d60(0xe2)+_0x535d1f+'.getOne(id);');else{if(_0x179617===_0x172d60(0x10d))_0x1ba992[_0x172d60(0xaa)](_0x172d60(0xe2)+_0x535d1f+_0x172d60(0xc1));else{if(_0x179617===_0x172d60(0xa1))_0x1ba992[_0x172d60(0xaa)](_0x172d60(0xe2)+_0x535d1f+_0x172d60(0xdd));else _0x179617===_0x172d60(0xfa)||_0x179617==='remove'?_0x1ba992[_0x172d60(0xaa)](_0x172d60(0xe2)+_0x535d1f+_0x172d60(0x9d)):_0x1ba992['push'](_0x172d60(0xe2)+_0x535d1f+'.'+_0x179617+_0x172d60(0xbf));}}}return _0x1ba992[_0x172d60(0xca)]('\x0a');}export function generateSqlCodeTemplate(_0x30f26d,_0x386098){const _0x1b86a4=a85_0x92f9,_0x41e7ed=_0x386098?.[_0x1b86a4(0xd6)]??_0x1b86a4(0x9a),_0x4516db=_0x386098?.[_0x1b86a4(0xf3)]??!![],_0x2aac52=[];return _0x2aac52[_0x1b86a4(0xaa)]('//\x20SQL:\x20'+_0x30f26d[_0x1b86a4(0xab)]+'\x20('+_0x30f26d['sqlCode']+')'),_0x41e7ed===_0x1b86a4(0x9a)?(_0x4516db&&_0x2aac52['push']('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x1b86a4(0xb4),''),_0x2aac52[_0x1b86a4(0xaa)](_0x1b86a4(0xc3),_0x1b86a4(0xd8)+_0x30f26d[_0x1b86a4(0xa7)]+'\x27,',_0x1b86a4(0xe6),_0x1b86a4(0xa3),'if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','const\x20results\x20=\x20data.execResult\x20||\x20[];')):_0x2aac52[_0x1b86a4(0xaa)](_0x1b86a4(0x100),'export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{',_0x1b86a4(0xf8),'\x20\x20\x20\x20sqlCode:\x20\x27'+_0x30f26d[_0x1b86a4(0xa7)]+'\x27,',_0x1b86a4(0xcf),_0x1b86a4(0xff),_0x1b86a4(0x103),'}'),_0x2aac52['join']('\x0a');}export async function getErConfig(_0x49201b,_0x452498){const _0x4f740c=a85_0x92f9,_0x557a5b=await apiRequest(_0x4f740c(0xbe),{'method':'POST','body':{'appCode':_0x49201b,'dblinkId':_0x452498}});return _0x557a5b['data'];}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x1bdefa=a85_0x92f9,_0x54c2fd=await apiRequest(_0x1bdefa(0xd2),{'method':_0x1bdefa(0x94),'body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x404633=extractList(_0x54c2fd[_0x1bdefa(0xeb)]),_0x234496=extractPaging(_0x54c2fd[_0x1bdefa(0xeb)]);return _0x234496&&_0x234496[_0x1bdefa(0xc6)]>REMOTE_APP_PAGE_SIZE&&console['warn'](_0x1bdefa(0xb7)+REMOTE_APP_PAGE_SIZE+_0x1bdefa(0xdf)+_0x234496[_0x1bdefa(0xc6)]+_0x1bdefa(0xcd)+_0x1bdefa(0xc0)),_0x404633;}
|
package/lib/core/bff/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a86_0x516b70=a86_0x2e38;(function(_0x907d96,_0x289d3b){const _0x2d1029=a86_0x2e38,_0x2b8e54=_0x907d96();while(!![]){try{const _0xbf7d63=parseInt(_0x2d1029(0x151))/0x1*(parseInt(_0x2d1029(0x155))/0x2)+parseInt(_0x2d1029(0x14c))/0x3+-parseInt(_0x2d1029(0x15c))/0x4+parseInt(_0x2d1029(0x152))/0x5*(parseInt(_0x2d1029(0x150))/0x6)+-parseInt(_0x2d1029(0x159))/0x7*(parseInt(_0x2d1029(0x15b))/0x8)+-parseInt(_0x2d1029(0x158))/0x9*(parseInt(_0x2d1029(0x157))/0xa)+parseInt(_0x2d1029(0x15a))/0xb*(parseInt(_0x2d1029(0x154))/0xc);if(_0xbf7d63===_0x289d3b)break;else _0x2b8e54['push'](_0x2b8e54['shift']());}catch(_0x182e53){_0x2b8e54['push'](_0x2b8e54['shift']());}}}(a86_0x1c14,0x85d8f));function a86_0x2e38(_0x2b0bd,_0x4dc66){_0x2b0bd=_0x2b0bd-0x14c;const _0x1c1460=a86_0x1c14();let _0x2e38ef=_0x1c1460[_0x2b0bd];return _0x2e38ef;}import{resolve}from'node:path';function a86_0x1c14(){const _0x3301d2=['5176JstCrt','3035376ZQiYxc','1399671ukmmzI','/bff','cwd','bff.lock.json','1698uLGlQQ','2wJfLXj','11240zRgCQO','.rabetbase','4616388qfPEPz','327938ujOmFs','bff-trash','90KcLbjv','1087209hnZJtO','6223AhaZih','44YPUCeE'];a86_0x1c14=function(){return _0x3301d2;};return a86_0x1c14();}const DOT_DIR=a86_0x516b70(0x153),LOCK_FILE_NAME=a86_0x516b70(0x14f),TRASH_DIR_NAME=a86_0x516b70(0x156);export function loadBffProjectConfig(_0x3e4137,_0x2173c8){const _0x228e33=a86_0x516b70,_0x393e19=resolve(_0x2173c8??process[_0x228e33(0x14e)]()),_0x1ce399=DOT_DIR+_0x228e33(0x14d),_0x2648df=_0x1ce399+'/'+_0x3e4137;return{'projectRoot':_0x393e19,'appCode':_0x3e4137,'scriptsBaseDir':DOT_DIR,'scriptsWorkspaceRoot':_0x1ce399,'scriptsRoot':_0x2648df,'scriptsRootDir':resolve(_0x393e19,DOT_DIR,'bff',_0x3e4137),'lockFilePath':resolve(_0x393e19,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x393e19,DOT_DIR,TRASH_DIR_NAME)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a87_0x4eca(_0x28eb29,_0x262506){_0x28eb29=_0x28eb29-0xe4;const _0x48ae0a=a87_0x48ae();let _0x4ecad9=_0x48ae0a[_0x28eb29];return _0x4ecad9;}const a87_0x2f3bb4=a87_0x4eca;(function(_0x4e3e2f,_0x2ab9fd){const _0x1df11e=a87_0x4eca,_0x590806=_0x4e3e2f();while(!![]){try{const _0x5dd9a0=parseInt(_0x1df11e(0xfc))/0x1*(parseInt(_0x1df11e(0xee))/0x2)+-parseInt(_0x1df11e(0xf8))/0x3*(parseInt(_0x1df11e(0x109))/0x4)+parseInt(_0x1df11e(0x10c))/0x5*(-parseInt(_0x1df11e(0x10a))/0x6)+-parseInt(_0x1df11e(0x108))/0x7+-parseInt(_0x1df11e(0xfd))/0x8*(parseInt(_0x1df11e(0xf6))/0x9)+parseInt(_0x1df11e(0x101))/0xa+-parseInt(_0x1df11e(0xe5))/0xb*(-parseInt(_0x1df11e(0x107))/0xc);if(_0x5dd9a0===_0x2ab9fd)break;else _0x590806['push'](_0x590806['shift']());}catch(_0x42e87d){_0x590806['push'](_0x590806['shift']());}}}(a87_0x48ae,0xcc547));import{access,mkdir,readdir,stat}from'node:fs/promises';import{constants}from'node:fs';import{dirname,join}from'node:path';import{findHookLocationByRemoteId,snakeToCamel}from'./utils.js';export const SUPPORTED_BFF_TYPES=['COMMON',a87_0x2f3bb4(0xf2),'HOOK'];export function normalizeBffType(_0x112d8b){const _0x589604=a87_0x2f3bb4;if(!_0x112d8b)return undefined;const _0x4fd39d=_0x112d8b[_0x589604(0xe7)]()[_0x589604(0xeb)]();return SUPPORTED_BFF_TYPES[_0x589604(0xf7)](_0x4fd39d)?_0x4fd39d:undefined;}async function scanJsFilesRecursively(_0xe3ab1c,_0xdda993){const _0x579fa0=a87_0x2f3bb4,_0x3f8cae=[];try{const _0x350703=await readdir(_0xe3ab1c,{'withFileTypes':!![]});for(const _0x29451c of _0x350703){const _0x53b577=join(_0xe3ab1c,_0x29451c[_0x579fa0(0x104)]);if(_0x29451c[_0x579fa0(0x10d)]())_0x3f8cae[_0x579fa0(0xf9)](...await scanJsFilesRecursively(_0x53b577,_0xdda993+'/'+_0x29451c[_0x579fa0(0x104)]));else _0x29451c[_0x579fa0(0x10e)]()&&_0x29451c[_0x579fa0(0x104)]['endsWith'](_0x579fa0(0xef))&&_0x3f8cae[_0x579fa0(0xf9)]({'lockKey':_0xdda993+'/'+_0x29451c[_0x579fa0(0x104)]['replace'](/\.js$/,''),'filePath':_0x53b577});}}catch(_0x5e2839){if(_0x5e2839['code']!==_0x579fa0(0x106))throw _0x5e2839;}return _0x3f8cae;}async function scanFlatFunctions(_0x55bcb1,_0x7653bc){const _0x2de1cd=a87_0x2f3bb4,_0x4b6d05=join(_0x55bcb1[_0x2de1cd(0xe8)],_0x7653bc),_0x230859=await scanJsFilesRecursively(_0x4b6d05,_0x7653bc);return _0x230859['map'](({lockKey:_0x5ac47a,filePath:_0x3a5282})=>({'type':_0x7653bc,'name':_0x5ac47a[_0x2de1cd(0x10b)]('/')['at'](-0x1)??'','filePath':_0x3a5282,'lockKey':_0x5ac47a}));}async function scanHookFunctions(_0x20e1c8){const _0x137369=a87_0x2f3bb4,_0x1295ac=join(_0x20e1c8[_0x137369(0xe8)],_0x137369(0xe4)),_0x514f63=[];try{const _0x61b4a1=await readdir(_0x1295ac,{'withFileTypes':!![]});for(const _0x2ab85e of _0x61b4a1){if(!_0x2ab85e[_0x137369(0x10d)]())continue;const _0x102c0d=_0x2ab85e[_0x137369(0x104)],_0x4f50bb=join(_0x1295ac,_0x102c0d),_0x475105=await readdir(_0x4f50bb,{'withFileTypes':!![]});for(const _0x1012a6 of _0x475105){if(!_0x1012a6[_0x137369(0x10d)]())continue;const _0x2524df=_0x1012a6[_0x137369(0x104)],_0x48abf1=join(_0x4f50bb,_0x2524df),_0x1e330f=await readdir(_0x48abf1,{'withFileTypes':!![]});for(const _0x4e1f46 of _0x1e330f){if(!_0x4e1f46[_0x137369(0x10d)]())continue;const _0xc824e6=_0x4e1f46[_0x137369(0x104)],_0xd92732=join(_0x48abf1,_0xc824e6),_0x1f51e0=await readdir(_0xd92732,{'withFileTypes':!![]});for(const _0x20cdac of _0x1f51e0){if(!_0x20cdac[_0x137369(0x10e)]()||!_0x20cdac['name'][_0x137369(0xf0)](_0x137369(0xef)))continue;const _0x2151af=_0x20cdac['name'][_0x137369(0xfe)](/\.js$/,'');_0x514f63[_0x137369(0xf9)]({'type':_0x137369(0xe4),'name':_0x2151af,'filePath':join(_0xd92732,_0x20cdac['name']),'lockKey':_0x137369(0xff)+_0x102c0d+'/'+_0x2524df+'/'+_0xc824e6+'/'+_0x2151af,'alias':_0x102c0d,'operationType':_0x2524df,'functionNode':_0xc824e6});}}}}}catch(_0x4cc570){if(_0x4cc570[_0x137369(0x103)]!==_0x137369(0x106))throw _0x4cc570;}return _0x514f63;}export async function scanLocalBffFunctions(_0x573b38,_0x3df928){const _0x25641b=a87_0x2f3bb4;if(_0x3df928==='COMMON'||_0x3df928===_0x25641b(0xf2))return scanFlatFunctions(_0x573b38,_0x3df928);if(_0x3df928==='HOOK')return scanHookFunctions(_0x573b38);const [_0x53c58a,_0x2d654a,_0x351649]=await Promise[_0x25641b(0x102)]([scanFlatFunctions(_0x573b38,'COMMON'),scanFlatFunctions(_0x573b38,'ENDPOINT'),scanHookFunctions(_0x573b38)]);return[..._0x53c58a,..._0x2d654a,..._0x351649];}export function resolveLocalFilePathFromLockKey(_0x6fc25b,_0x2b7deb){const _0x27c72c=a87_0x2f3bb4;return join(_0x6fc25b[_0x27c72c(0xe8)],..._0x2b7deb[_0x27c72c(0x10b)]('/'))+_0x27c72c(0xef);}export function createHookLocationMap(_0x4d083d){const _0x4787a8=a87_0x2f3bb4,_0x275ab9=new Map();for(const _0x25cc7c of _0x4d083d){_0x25cc7c[_0x4787a8(0xe6)]&&_0x275ab9[_0x4787a8(0xec)](_0x25cc7c[_0x4787a8(0xe6)],{'datasetCode':_0x25cc7c[_0x4787a8(0xf3)],'operationType':snakeToCamel(_0x25cc7c[_0x4787a8(0xf5)]),'functionNode':_0x4787a8(0xf4)}),_0x25cc7c[_0x4787a8(0xe9)]&&_0x275ab9['set'](_0x25cc7c['afterScriptId'],{'datasetCode':_0x25cc7c[_0x4787a8(0xf3)],'operationType':snakeToCamel(_0x25cc7c[_0x4787a8(0xf5)]),'functionNode':_0x4787a8(0xed)});}return _0x275ab9;}function a87_0x48ae(){const _0x433614=['279XIHLQD','includes','11793eelHlT','push','scriptType','functionNode','1427710LrRaCu','6456xKSKUW','replace','HOOK/','F_OK','6664210JrUJma','all','code','name','get','ENOENT','84zeRujm','441007jVfCeW','1124wdgVKn','6kxCFuu','split','5706990JvBNAT','isDirectory','isFile','HOOK','1692163fNTGlm','beforeScriptId','trim','scriptsRootDir','afterScriptId','alias','toUpperCase','set','after','2VJPZec','.js','endsWith','functionName','ENDPOINT','datasetCode','before','operationType'];a87_0x48ae=function(){return _0x433614;};return a87_0x48ae();}export function resolveRemoteScriptTarget(_0x5da2fb,_0x5f50ec,_0x33e26c,_0x2193fd,_0x508d4d){const _0x30b744=a87_0x2f3bb4,_0x32736a=normalizeBffType(_0x5f50ec[_0x30b744(0xfa)]);if(!_0x32736a||!_0x5f50ec[_0x30b744(0xf1)])return null;if(_0x32736a===_0x30b744(0xe4)){const _0x5cfcce=(_0x5f50ec['id']?_0x33e26c['get'](_0x5f50ec['id']):undefined)??findHookLocationByRemoteId(_0x2193fd,_0x5f50ec['id']);if(!_0x5cfcce)return null;const _0x3a9b14=_0x5cfcce[_0x30b744(0xea)]||_0x508d4d[_0x30b744(0x105)](_0x5cfcce['datasetCode']),_0x220ba6=_0x3a9b14??_0x5cfcce['datasetCode'],_0x4fd4fd={..._0x5cfcce,'alias':_0x3a9b14},_0x36d89a='HOOK/'+_0x220ba6+'/'+_0x4fd4fd['operationType']+'/'+_0x4fd4fd[_0x30b744(0xfb)]+'/'+_0x5f50ec[_0x30b744(0xf1)];return{'lockKey':_0x36d89a,'filePath':resolveLocalFilePathFromLockKey(_0x5da2fb,_0x36d89a),'type':_0x30b744(0xe4),'hookLocation':_0x4fd4fd};}const _0x59822c=_0x32736a+'/'+_0x5f50ec[_0x30b744(0xf1)];return{'lockKey':_0x59822c,'filePath':resolveLocalFilePathFromLockKey(_0x5da2fb,_0x59822c),'type':_0x32736a};}export async function ensureParentDirectory(_0x5ca9fb){await mkdir(dirname(_0x5ca9fb),{'recursive':!![]});}export async function fileExists(_0x1d627c){const _0x179cc8=a87_0x2f3bb4;try{return await access(_0x1d627c,constants[_0x179cc8(0x100)]),!![];}catch{return![];}}export async function directoryExists(_0x6b6c4f){const _0x3b0bff=a87_0x2f3bb4;try{const _0x47e5ef=await stat(_0x6b6c4f);return _0x47e5ef[_0x3b0bff(0x10d)]();}catch{return![];}}
|
package/lib/core/bff/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x18f153,_0x33bc9e){const _0x1cb472=a88_0x31ee,_0x29c5a3=_0x18f153();while(!![]){try{const _0x1371a3=parseInt(_0x1cb472(0x9c))/0x1+-parseInt(_0x1cb472(0x91))/0x2+parseInt(_0x1cb472(0x94))/0x3+parseInt(_0x1cb472(0x99))/0x4*(-parseInt(_0x1cb472(0x9f))/0x5)+parseInt(_0x1cb472(0x9b))/0x6+parseInt(_0x1cb472(0x9e))/0x7*(parseInt(_0x1cb472(0x9a))/0x8)+parseInt(_0x1cb472(0x95))/0x9*(parseInt(_0x1cb472(0x98))/0xa);if(_0x1371a3===_0x33bc9e)break;else _0x29c5a3['push'](_0x29c5a3['shift']());}catch(_0xe1386c){_0x29c5a3['push'](_0x29c5a3['shift']());}}}(a88_0x2629,0x1ec39));import{readFile}from'node:fs/promises';import a88_0x801c37 from'node:crypto';function a88_0x31ee(_0x18e5b9,_0x31fd46){_0x18e5b9=_0x18e5b9-0x91;const _0x2629d0=a88_0x2629();let _0x31eeca=_0x2629d0[_0x18e5b9];return _0x31eeca;}export function computeContentHash(_0x597f0b){const _0x2ba378=a88_0x31ee;return a88_0x801c37[_0x2ba378(0x97)](_0x2ba378(0x9d))[_0x2ba378(0x92)](_0x597f0b)[_0x2ba378(0xa0)](_0x2ba378(0x96));}function a88_0x2629(){const _0x147060=['hex','createHash','360950zcYkNY','6436Qtwlut','738952NhONQt','359004OugSOy','198542WqloRX','md5','7WRWmOe','510icDOAl','digest','404902HEfNpD','update','utf8','208929yHXkUd','18dqbnua'];a88_0x2629=function(){return _0x147060;};return a88_0x2629();}export async function computeFileHash(_0x1387a2){const _0x3ac330=a88_0x31ee,_0x3e84c3=await readFile(_0x1387a2,_0x3ac330(0x93));return computeContentHash(_0x3e84c3);}
|
package/lib/core/bff/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xde5634,_0x2e9b19){const _0x103af2=a89_0x41d7,_0x1ef40b=_0xde5634();while(!![]){try{const _0x2ead44=-parseInt(_0x103af2(0x1bb))/0x1*(-parseInt(_0x103af2(0x1b9))/0x2)+parseInt(_0x103af2(0x1bd))/0x3+parseInt(_0x103af2(0x1b7))/0x4+parseInt(_0x103af2(0x1b4))/0x5*(parseInt(_0x103af2(0x1b2))/0x6)+-parseInt(_0x103af2(0x1ba))/0x7*(-parseInt(_0x103af2(0x1ae))/0x8)+-parseInt(_0x103af2(0x1af))/0x9*(-parseInt(_0x103af2(0x1b6))/0xa)+-parseInt(_0x103af2(0x1c0))/0xb*(parseInt(_0x103af2(0x1c3))/0xc);if(_0x2ead44===_0x2e9b19)break;else _0x1ef40b['push'](_0x1ef40b['shift']());}catch(_0x416625){_0x1ef40b['push'](_0x1ef40b['shift']());}}}(a89_0x2dbc,0x7a611));import{mkdir,readFile,writeFile}from'node:fs/promises';function a89_0x2dbc(){const _0x397879=['6HRkjUv','stringify','2712295arZQBn','scriptsRoot','60EItgqo','1808028LFRFkk','Check\x20.rabetbase/bff.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','40120FiFeOm','2562455IbmIMO','46YrgFKR','parse','1493097wzpRRp','utf8','apps','70169pWTSrG','code','ENOENT','5124rMtdll','lastSync','8AOoVze','666162RJkIOw','object','functions'];a89_0x2dbc=function(){return _0x397879;};return a89_0x2dbc();}import{dirname}from'node:path';export function createEmptyBffLock(){return{'apps':{}};}function a89_0x41d7(_0x4596f5,_0x5729b4){_0x4596f5=_0x4596f5-0x1ad;const _0x2dbc3b=a89_0x2dbc();let _0x41d7f5=_0x2dbc3b[_0x4596f5];return _0x41d7f5;}export function ensureLockScope(_0x577414,_0x4fe92e,_0xd15f5,_0x55f107){const _0xebc8a8=a89_0x41d7,_0x2e8f45={'apps':_0x577414[_0xebc8a8(0x1bf)]&&typeof _0x577414['apps']===_0xebc8a8(0x1b0)?_0x577414[_0xebc8a8(0x1bf)]:{}};let _0x19c347=_0x2e8f45['apps'][_0x4fe92e];if(!_0x19c347)return _0x19c347={'scriptsRoot':_0xd15f5,'lastSync':'','functions':{}},_0x2e8f45['apps'][_0x4fe92e]=_0x19c347,{'lockData':_0x2e8f45,'appLock':_0x19c347};if(!_0x19c347[_0xebc8a8(0x1b5)])_0x19c347[_0xebc8a8(0x1b5)]=_0xd15f5;else{if(_0x19c347[_0xebc8a8(0x1b5)]!==_0xd15f5)throw new Error(_0x55f107+':\x20scriptsRoot\x20mismatch\x20—\x20'+('current\x20\x22'+_0xd15f5+'\x22\x20vs\x20lock\x20\x22'+_0x19c347[_0xebc8a8(0x1b5)]+'\x22.\x20')+_0xebc8a8(0x1b8));}return!_0x19c347[_0xebc8a8(0x1b1)]&&(_0x19c347['functions']={}),!_0x19c347[_0xebc8a8(0x1ad)]&&(_0x19c347[_0xebc8a8(0x1ad)]=''),{'lockData':_0x2e8f45,'appLock':_0x19c347};}export async function readBffLockFile(_0x580e13){const _0x30fdf7=a89_0x41d7;try{const _0x46ffbf=await readFile(_0x580e13,_0x30fdf7(0x1be)),_0x268725=JSON[_0x30fdf7(0x1bc)](_0x46ffbf);return{'apps':_0x268725[_0x30fdf7(0x1bf)]&&typeof _0x268725['apps']==='object'?_0x268725[_0x30fdf7(0x1bf)]:{}};}catch(_0x46e67e){if(_0x46e67e[_0x30fdf7(0x1c1)]===_0x30fdf7(0x1c2))return null;throw new Error('Failed\x20to\x20read\x20BFF\x20lock\x20file:\x20'+String(_0x46e67e));}}export async function writeBffLockFile(_0x8d7a9b,_0x25cb93){const _0x2cd37a=a89_0x41d7;await mkdir(dirname(_0x8d7a9b),{'recursive':!![]}),await writeFile(_0x8d7a9b,JSON[_0x2cd37a(0x1b3)](_0x25cb93,null,0x2),'utf8');}
|
package/lib/core/bff/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5924d9,_0x5024cb){const _0x40daca=a91_0x1e9e,_0x5e6c37=_0x5924d9();while(!![]){try{const _0x3a4f16=parseInt(_0x40daca(0x1d0))/0x1*(parseInt(_0x40daca(0x1c9))/0x2)+parseInt(_0x40daca(0x1c5))/0x3*(-parseInt(_0x40daca(0x1d2))/0x4)+parseInt(_0x40daca(0x1d3))/0x5*(parseInt(_0x40daca(0x1cf))/0x6)+-parseInt(_0x40daca(0x1d1))/0x7*(-parseInt(_0x40daca(0x1c1))/0x8)+parseInt(_0x40daca(0x1ce))/0x9+parseInt(_0x40daca(0x1d4))/0xa+-parseInt(_0x40daca(0x1c2))/0xb;if(_0x3a4f16===_0x5024cb)break;else _0x5e6c37['push'](_0x5e6c37['shift']());}catch(_0x18a529){_0x5e6c37['push'](_0x5e6c37['shift']());}}}(a91_0x510e,0x7d56a));export function snakeToCamel(_0x84b21f){const _0x2ed44f=a91_0x1e9e;return _0x84b21f[_0x2ed44f(0x1c3)]()['replace'](/_([a-z])/g,(_0x47fe0f,_0x4e587c)=>_0x4e587c[_0x2ed44f(0x1c7)]());}export function findHookLocationByRemoteId(_0x2e2c52,_0x22f081){const _0x1f01c7=a91_0x1e9e;if(!_0x22f081)return undefined;for(const _0x2a0b1e of Object[_0x1f01c7(0x1ca)](_0x2e2c52)){if(_0x2a0b1e['remoteId']===_0x22f081&&_0x2a0b1e[_0x1f01c7(0x1cb)]&&_0x2a0b1e[_0x1f01c7(0x1c8)]&&_0x2a0b1e[_0x1f01c7(0x1c0)])return{'datasetCode':_0x2a0b1e[_0x1f01c7(0x1cb)],'operationType':_0x2a0b1e['operationType'],'functionNode':_0x2a0b1e['functionNode']};}return undefined;}function a91_0x510e(){const _0x22bfb1=['35CpDDoz','133lzaWOQ','372boNTpZ','947875RYCuRc','1822720DeKefA','functionNode','204872iWMuDF','21916147gasgqH','toLowerCase','before','1023pMWfZg','after','toUpperCase','operationType','5354wBItvx','values','datasetCode','trim','match','7443567hRRuVL','30NROzAR'];a91_0x510e=function(){return _0x22bfb1;};return a91_0x510e();}export function extractScriptDescription(_0x10e3c9){const _0x1b44df=a91_0x1e9e,_0x3135b7=_0x10e3c9[_0x1b44df(0x1cd)](/\[\s*脚本描述\s*]\s*(.+)/);return _0x3135b7?.[0x1]?.[_0x1b44df(0x1cc)]()||undefined;}function a91_0x1e9e(_0x5d2a46,_0x408ef1){_0x5d2a46=_0x5d2a46-0x1c0;const _0x510ea7=a91_0x510e();let _0x1e9e96=_0x510ea7[_0x5d2a46];return _0x1e9e96;}export function isValidBffFunctionName(_0x5a2f79){return/^[A-Za-z_$][A-Za-z0-9_$]*$/['test'](_0x5a2f79);}export function normalizeHookFunctionNode(_0x565b08){const _0xe3937e=a91_0x1e9e;if(!_0x565b08)return undefined;const _0x4567c7=_0x565b08[_0xe3937e(0x1cc)]()[_0xe3937e(0x1c3)]();if(_0x4567c7===_0xe3937e(0x1c4)||_0x4567c7===_0xe3937e(0x1c6))return _0x4567c7;return undefined;}
|
package/lib/core/db-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a92_0x5228(){const _0x3b69a7=['15vKXjjI','1496608xdxgHq','dbName','join','find','map','has','set','Multiple\x20databases\x20found.\x20Specify\x20one\x20with\x20--db:\x20','1614692zcybUu','No\x20database\x20matching\x20\x22','77269OYQsoZ','db-','length','3483405ribXYn','1620582ZBLiZS','60eKCvsv','dbId','2684214gOzRgS','177884Qxbwmy','entries','\x22\x20matches\x20multiple\x20databases:\x20','8AAshjb','isNaN','get','toLowerCase'];a92_0x5228=function(){return _0x3b69a7;};return a92_0x5228();}(function(_0x16ef0a,_0x1a279e){const _0x395b9f=a92_0x4dde,_0x47d08c=_0x16ef0a();while(!![]){try{const _0xaaa382=parseInt(_0x395b9f(0x164))/0x1*(parseInt(_0x395b9f(0x16f))/0x2)+-parseInt(_0x395b9f(0x167))/0x3+parseInt(_0x395b9f(0x162))/0x4+parseInt(_0x395b9f(0x159))/0x5*(-parseInt(_0x395b9f(0x168))/0x6)+-parseInt(_0x395b9f(0x16c))/0x7+parseInt(_0x395b9f(0x15a))/0x8+parseInt(_0x395b9f(0x16b))/0x9*(parseInt(_0x395b9f(0x169))/0xa);if(_0xaaa382===_0x1a279e)break;else _0x47d08c['push'](_0x47d08c['shift']());}catch(_0x5ea80b){_0x47d08c['push'](_0x47d08c['shift']());}}}(a92_0x5228,0xa90ef));import{listDatasets}from'./api-client.js';const cache=new Map();export async function listDatabases(_0x150593){const _0x263b29=a92_0x4dde;if(cache[_0x263b29(0x15f)](_0x150593))return cache[_0x263b29(0x157)](_0x150593);const _0x2684cb=await listDatasets(_0x150593),_0x53baf9=new Map();for(const _0xdc0492 of _0x2684cb){const _0x558bee=_0xdc0492['dbtableConfig'];_0x558bee?.['dbId']!=null&&_0x53baf9[_0x263b29(0x160)](_0x558bee[_0x263b29(0x16a)],_0x558bee[_0x263b29(0x15b)]??_0x263b29(0x165)+_0x558bee[_0x263b29(0x16a)]);}const _0x5b7189=[..._0x53baf9[_0x263b29(0x16d)]()][_0x263b29(0x15e)](([_0x5b3dab,_0x2df87d])=>({'dbId':_0x5b3dab,'dbName':_0x2df87d}));return cache[_0x263b29(0x160)](_0x150593,_0x5b7189),_0x5b7189;}export async function resolveDb(_0x49dd45,_0x5b52cf){const _0x46a772=a92_0x4dde,_0x48cf6a=await listDatabases(_0x49dd45);if(_0x48cf6a[_0x46a772(0x166)]===0x0)return{'resolved':[],'error':'No\x20linked\x20databases\x20found\x20for\x20this\x20app.\x20Make\x20sure\x20datasets\x20have\x20been\x20created.'};if(!_0x5b52cf)return{'resolved':_0x48cf6a};const _0x3c2919=Number(_0x5b52cf);if(!Number[_0x46a772(0x156)](_0x3c2919)){const _0x57b0ce=_0x48cf6a['find'](_0x4448c8=>_0x4448c8[_0x46a772(0x16a)]===_0x3c2919);if(_0x57b0ce)return{'resolved':[_0x57b0ce]};}const _0x13851b=_0x5b52cf[_0x46a772(0x158)](),_0x44fb4c=_0x48cf6a['filter'](_0x336e01=>_0x336e01[_0x46a772(0x15b)][_0x46a772(0x158)]()['includes'](_0x13851b));if(_0x44fb4c[_0x46a772(0x166)]>0x0)return{'resolved':_0x44fb4c};const _0x190cb5=_0x48cf6a[_0x46a772(0x15e)](_0x58e6a2=>_0x58e6a2[_0x46a772(0x15b)]+'\x20('+_0x58e6a2[_0x46a772(0x16a)]+')')[_0x46a772(0x15c)](',\x20');return{'resolved':[],'error':_0x46a772(0x163)+_0x5b52cf+'\x22.\x20Available:\x20'+_0x190cb5};}export async function resolveOneDb(_0x366a40,_0x316ac){const _0x28b227=a92_0x4dde,{resolved:_0x91c4ae,error:_0x357b21}=await resolveDb(_0x366a40,_0x316ac);if(_0x357b21)return{'db':null,'error':_0x357b21};if(_0x91c4ae[_0x28b227(0x166)]===0x1)return{'db':_0x91c4ae[0x0]};if(!_0x316ac){const _0xb16853=_0x91c4ae[_0x28b227(0x15e)](_0x17bc56=>_0x17bc56['dbName']+'\x20('+_0x17bc56['dbId']+')')[_0x28b227(0x15c)](',\x20');return{'db':null,'error':_0x28b227(0x161)+_0xb16853};}const _0x5bbbde=_0x91c4ae[_0x28b227(0x15e)](_0x3d6c50=>_0x3d6c50['dbName']+'\x20('+_0x3d6c50[_0x28b227(0x16a)]+')')[_0x28b227(0x15c)](',\x20');return{'db':null,'error':'\x22'+_0x316ac+_0x28b227(0x16e)+_0x5bbbde+'.\x20Be\x20more\x20specific.'};}function a92_0x4dde(_0x4dcb05,_0x4e9554){_0x4dcb05=_0x4dcb05-0x156;const _0x5228ca=a92_0x5228();let _0x4dde7d=_0x5228ca[_0x4dcb05];return _0x4dde7d;}export async function getDbName(_0x31a95c,_0x3f6ecd){const _0x39a500=a92_0x4dde,_0x83acf5=await listDatabases(_0x31a95c);return _0x83acf5[_0x39a500(0x15d)](_0x4f94e4=>_0x4f94e4['dbId']===_0x3f6ecd)?.[_0x39a500(0x15b)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a93_0x2bb6(_0x533841,_0x19ca5c){_0x533841=_0x533841-0x1c5;const _0x22f691=a93_0x22f6();let _0x2bb63e=_0x22f691[_0x533841];return _0x2bb63e;}(function(_0x327479,_0x887e53){const _0x33555d=a93_0x2bb6,_0x36610e=_0x327479();while(!![]){try{const _0x198540=-parseInt(_0x33555d(0x1dc))/0x1*(parseInt(_0x33555d(0x1d5))/0x2)+parseInt(_0x33555d(0x1df))/0x3+-parseInt(_0x33555d(0x1d9))/0x4+-parseInt(_0x33555d(0x1c7))/0x5+parseInt(_0x33555d(0x1de))/0x6*(parseInt(_0x33555d(0x1dd))/0x7)+-parseInt(_0x33555d(0x1e3))/0x8*(parseInt(_0x33555d(0x1d4))/0x9)+-parseInt(_0x33555d(0x1d8))/0xa*(-parseInt(_0x33555d(0x1d0))/0xb);if(_0x198540===_0x887e53)break;else _0x36610e['push'](_0x36610e['shift']());}catch(_0x2026a2){_0x36610e['push'](_0x36610e['shift']());}}}(a93_0x22f6,0x95532));export function detectSqlType(_0x5231bf){const _0x2df21f=a93_0x2bb6;if(!_0x5231bf?.[_0x2df21f(0x1cb)]())return{'type':_0x2df21f(0x1d1),'isSelectOnly':![],'isDangerous':![],'reason':'SQL\x20content\x20is\x20empty'};const _0x1a10c6=_0x5231bf[_0x2df21f(0x1e6)](/#\{[^}]*\}/g,'?')['replace'](/\$\{[^}]*\}/g,'?')[_0x2df21f(0x1e6)](/@[^(\s]+(\([^)]*\))?/g,'')[_0x2df21f(0x1e6)](/\/\*[\s\S]*?\*\//g,'')[_0x2df21f(0x1cb)](),_0x293053=_0x1a10c6[_0x2df21f(0x1d3)]('\x0a');let _0x1ce82c='';for(const _0x552807 of _0x293053){const _0x3f5184=_0x552807['trim']();if(!_0x3f5184||_0x3f5184[_0x2df21f(0x1e8)]('--')||_0x3f5184[_0x2df21f(0x1e8)]('/*'))continue;_0x1ce82c=_0x3f5184;break;}const _0x5b20ab=_0x1ce82c[_0x2df21f(0x1db)]();if(_0x5b20ab[_0x2df21f(0x1e8)]('SELECT')||_0x5b20ab['startsWith'](_0x2df21f(0x1cd))){const _0x4b239f=/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i['test'](_0x1a10c6);return{'type':_0x2df21f(0x1e2),'isSelectOnly':!_0x4b239f,'isDangerous':_0x4b239f,'reason':_0x4b239f?'SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT':undefined};}if(_0x5b20ab[_0x2df21f(0x1e8)]('INSERT'))return{'type':_0x2df21f(0x1e4),'isSelectOnly':![],'isDangerous':![]};if(_0x5b20ab[_0x2df21f(0x1e8)]('UPDATE'))return{'type':_0x2df21f(0x1e5),'isSelectOnly':![],'isDangerous':![]};if(_0x5b20ab[_0x2df21f(0x1e8)](_0x2df21f(0x1c8)))return{'type':_0x2df21f(0x1c8),'isSelectOnly':![],'isDangerous':!![],'reason':_0x2df21f(0x1e1)};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i['test'](_0x5b20ab))return{'type':'DDL','isSelectOnly':![],'isDangerous':!![],'reason':_0x2df21f(0x1d7)};return{'type':_0x2df21f(0x1d1),'isSelectOnly':![],'isDangerous':![]};}function extractTables(_0x485951){const _0x4ac85c=a93_0x2bb6,_0x186072=_0x485951[_0x4ac85c(0x1e6)](/#\{[^}]*\}/g,'?')[_0x4ac85c(0x1e6)](/\$\{[^}]*\}/g,'?')[_0x4ac85c(0x1e6)](/'[^']*'/g,'\x27\x27')[_0x4ac85c(0x1e6)](/--.*$/gm,'')['replace'](/\/\*[\s\S]*?\*\//g,''),_0x1d540d=[],_0x2586be=_0x186072['match'](/FROM\s+([^\s,)(]+)/i);if(_0x2586be?.[0x1])_0x1d540d[_0x4ac85c(0x1ca)](_0x2586be[0x1][_0x4ac85c(0x1e6)](/[`"]/g,''));for(const _0x6a34a8 of _0x186072[_0x4ac85c(0x1c6)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){const _0x2d215e=_0x6a34a8[0x1]?.[_0x4ac85c(0x1e6)](/[`"]/g,'');if(_0x2d215e&&!_0x1d540d[_0x4ac85c(0x1e0)](_0x2d215e))_0x1d540d[_0x4ac85c(0x1ca)](_0x2d215e);}const _0x35038c=_0x186072[_0x4ac85c(0x1ce)](/INTO\s+([^\s(]+)/i);if(_0x35038c?.[0x1]){const _0x2eefbd=_0x35038c[0x1][_0x4ac85c(0x1e6)](/[`"]/g,'');if(!_0x1d540d[_0x4ac85c(0x1e0)](_0x2eefbd))_0x1d540d[_0x4ac85c(0x1ca)](_0x2eefbd);}const _0x5bfdb1=_0x186072['match'](/UPDATE\s+([^\s,)(]+)/i);if(_0x5bfdb1?.[0x1]){const _0x514b4c=_0x5bfdb1[0x1][_0x4ac85c(0x1e6)](/[`"]/g,'');if(!_0x1d540d[_0x4ac85c(0x1e0)](_0x514b4c))_0x1d540d[_0x4ac85c(0x1ca)](_0x514b4c);}return _0x1d540d;}function extractParameters(_0xa74aec){const _0x13f443=a93_0x2bb6,_0x128cff=new Set();for(const _0x5d3637 of _0xa74aec[_0x13f443(0x1c6)](/#\{(\w+)\}/g))if(_0x5d3637[0x1])_0x128cff[_0x13f443(0x1c9)](_0x5d3637[0x1]);for(const _0x3ef679 of _0xa74aec[_0x13f443(0x1c6)](/\$\{(\w+)\}/g))if(_0x3ef679[0x1])_0x128cff[_0x13f443(0x1c9)](_0x3ef679[0x1]);return Array[_0x13f443(0x1da)](_0x128cff);}function a93_0x22f6(){const _0x125281=['trim','unknown\x20table(s)','WITH','match','reason','77OLRVpm','UNKNOWN','length','split','4965453BPhRCD','426058SVWetr','\x20with\x20parameters:\x20','DDL\x20statements\x20are\x20blocked\x20from\x20auto-save','1616450pnAYwb','1293752ktYAPp','from','toUpperCase','3HecYzJ','7wUdhTP','4133334kNhrjY','2708880veigSk','includes','DELETE\x20statements\x20are\x20blocked\x20from\x20auto-save','SELECT','8bUNvog','INSERT','UPDATE','replace','join','startsWith','Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','type','\x20query\x20targeting\x20','matchAll','2987440VTNzkh','DELETE','add','push'];a93_0x22f6=function(){return _0x125281;};return a93_0x22f6();}export function validateSql(_0x3af908){const _0xc5314a=a93_0x2bb6,_0x282379=detectSqlType(_0x3af908),_0xd7cdfe=extractTables(_0x3af908),_0x4607a5=extractParameters(_0x3af908);if(_0x282379['isDangerous'])return{'valid':![],'sqlType':_0x282379,'tables':_0xd7cdfe,'parameters':_0x4607a5,'message':_0x282379[_0xc5314a(0x1cf)]||_0x282379[_0xc5314a(0x1ea)]+'\x20statements\x20cannot\x20be\x20auto-saved.\x20Please\x20operate\x20manually\x20on\x20the\x20platform.'};if(_0x282379['type']===_0xc5314a(0x1d1))return{'valid':![],'sqlType':_0x282379,'tables':_0xd7cdfe,'parameters':_0x4607a5,'message':_0xc5314a(0x1e9)};return{'valid':!![],'sqlType':_0x282379,'tables':_0xd7cdfe,'parameters':_0x4607a5,'message':_0x282379[_0xc5314a(0x1ea)]+_0xc5314a(0x1c5)+(_0xd7cdfe[_0xc5314a(0x1d2)]?_0xd7cdfe['join'](',\x20'):_0xc5314a(0x1cc))+(_0x4607a5[_0xc5314a(0x1d2)]?_0xc5314a(0x1d6)+_0x4607a5[_0xc5314a(0x1e7)](',\x20'):'')};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x268754,_0x54eefb){const _0x336795=a94_0x3d7c,_0x27e751=_0x268754();while(!![]){try{const _0x401919=-parseInt(_0x336795(0xd7))/0x1*(parseInt(_0x336795(0xd8))/0x2)+parseInt(_0x336795(0xdd))/0x3*(parseInt(_0x336795(0xe8))/0x4)+parseInt(_0x336795(0xe3))/0x5*(-parseInt(_0x336795(0xde))/0x6)+-parseInt(_0x336795(0xe0))/0x7+-parseInt(_0x336795(0xd5))/0x8+parseInt(_0x336795(0xed))/0x9*(parseInt(_0x336795(0xe1))/0xa)+parseInt(_0x336795(0xe2))/0xb;if(_0x401919===_0x54eefb)break;else _0x27e751['push'](_0x27e751['shift']());}catch(_0x4d638b){_0x27e751['push'](_0x27e751['shift']());}}}(a94_0x1ee1,0x574a0));import{existsSync}from'node:fs';import a94_0x11f310 from'node:path';import a94_0x48e8e1 from'chalk';import{input,confirm}from'@inquirer/prompts';import{getIsSessionValid}from'../auth/is-session-valid.js';function a94_0x3d7c(_0x10a715,_0x1d1c90){_0x10a715=_0x10a715-0xd4;const _0x1ee1e2=a94_0x1ee1();let _0x3d7c8e=_0x1ee1e2[_0x10a715];return _0x3d7c8e;}import{authServer}from'../auth/auth-server.js';function a94_0x1ee1(){const _0x23f645=['3044810gCAtYj','4881679KCmzjt','681850nezmSa','log','Must\x20start\x20with\x20a\x20letter/number\x20and\x20only\x20contain\x20letters,\x20numbers,\x20-\x20and\x20_','green','trim','4TXOpXY','cyan','length','Project\x20name\x20cannot\x20exceed\x2050\x20characters','Skipped','9scQuNl','cwd','Login\x20failed','Logged\x20in','√\x20Login\x20status:\x20','2293288IVbobT','string','214487KCGehx','4rDVnLr','No\x20valid\x20login\x20detected.\x20Login\x20first\x20to\x20pull\x20API\x20config?','resolve','env','production','1658697ebnBfz','6NyNtwY','Project\x20name:','641396JGyZTH'];a94_0x1ee1=function(){return _0x23f645;};return a94_0x1ee1();}import{readConfig}from'../utils/config.js';import{selectSingleAppcode}from'../commands/common/app-selector.js';export async function guidedCreateProject(_0x10f8e8,_0x19d0a1,_0x12de68){const _0x2e8150=a94_0x3d7c,_0xee7062='my-app',_0x168d6d=readConfig(),_0xd8b635=typeof _0x168d6d[_0x2e8150(0xdb)]===_0x2e8150(0xd6)?_0x168d6d[_0x2e8150(0xdb)]:undefined,_0x479c82=await input({'message':_0x2e8150(0xdf),'default':_0xee7062,'validate':_0x3b0182=>{const _0x5c207d=_0x2e8150,_0x4906b5=_0x3b0182[_0x5c207d(0xe7)]()||_0xee7062;if(_0x4906b5[_0x5c207d(0xea)]>0x32)return _0x5c207d(0xeb);const _0x529449=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(_0x4906b5&&!_0x529449['test'](_0x4906b5))return _0x5c207d(0xe5);const _0x24198b=a94_0x11f310[_0x5c207d(0xda)](process[_0x5c207d(0xee)](),_0x4906b5);if(existsSync(_0x24198b))return'Directory\x20\x22'+_0x4906b5+'\x22\x20already\x20exists';return!![];}});console['log'](a94_0x48e8e1[_0x2e8150(0xe6)]('√\x20Project\x20Name:\x20'+a94_0x48e8e1['cyan'](_0x479c82)));const _0x334beb=await selectSingleAppcode(_0x12de68);console[_0x2e8150(0xe4)](a94_0x48e8e1[_0x2e8150(0xe6)]('√\x20App\x20Code:\x20'+a94_0x48e8e1[_0x2e8150(0xe9)](_0x334beb||'Not\x20set')));if(_0x334beb){const _0x11dac2=await getIsSessionValid();if(!_0x11dac2){const _0x4521ab=await confirm({'message':_0x2e8150(0xd9),'default':!![]});if(_0x4521ab){const _0x4a7826=await authServer({'silent':!![]});console['log'](a94_0x48e8e1[_0x2e8150(0xe6)](_0x2e8150(0xd4)+a94_0x48e8e1[_0x2e8150(0xe9)](_0x4a7826?_0x2e8150(0xf0):_0x2e8150(0xef))));}else console[_0x2e8150(0xe4)](a94_0x48e8e1[_0x2e8150(0xe6)](_0x2e8150(0xd4)+a94_0x48e8e1[_0x2e8150(0xe9)](_0x2e8150(0xec))));}await _0x10f8e8({'projectName':_0x479c82,'appCode':_0x334beb,'env':_0x19d0a1||_0xd8b635||_0x2e8150(0xdc)});}else await _0x10f8e8({'projectName':_0x479c82,'env':_0x19d0a1||_0xd8b635||'production'});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a95_0x4764(_0x41f1c9,_0x36ff4f){_0x41f1c9=_0x41f1c9-0x19a;const _0x3ce9d4=a95_0x3ce9();let _0x47644e=_0x3ce9d4[_0x41f1c9];return _0x47644e;}function a95_0x3ce9(){const _0x59e570=['34180yyErNJ','732018IlEwAV','2099544nSaMCQ','70oFUpGJ','7SWpvff','67724JMevdi','168882ihDaVY','now','1136520oMnlAi','toFixed','318771jUstFz','3QZcKQk'];a95_0x3ce9=function(){return _0x59e570;};return a95_0x3ce9();}(function(_0x18ac37,_0x29825b){const _0x29b4bf=a95_0x4764,_0x17dff5=_0x18ac37();while(!![]){try{const _0x102908=-parseInt(_0x29b4bf(0x19d))/0x1+-parseInt(_0x29b4bf(0x19c))/0x2*(parseInt(_0x29b4bf(0x1a2))/0x3)+parseInt(_0x29b4bf(0x1a3))/0x4+parseInt(_0x29b4bf(0x19f))/0x5+parseInt(_0x29b4bf(0x1a4))/0x6+parseInt(_0x29b4bf(0x19b))/0x7*(parseInt(_0x29b4bf(0x1a5))/0x8)+parseInt(_0x29b4bf(0x1a1))/0x9*(-parseInt(_0x29b4bf(0x19a))/0xa);if(_0x102908===_0x29825b)break;else _0x17dff5['push'](_0x17dff5['shift']());}catch(_0x480a84){_0x17dff5['push'](_0x17dff5['shift']());}}}(a95_0x3ce9,0x29692));export function formatElapsed(_0x3b1d71){const _0x48baad=a95_0x4764,_0x5d794d=Date[_0x48baad(0x19e)]()-_0x3b1d71;if(_0x5d794d<0x3e8)return _0x5d794d+'ms';const _0x5b1bae=(_0x5d794d/0x3e8)[_0x48baad(0x1a0)](0x2),_0x293b36=_0x5b1bae['replace'](/\.?0+$/u,'');return _0x293b36+'s';}
|
package/lib/create-app/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2874cb,_0x376f7c){const _0x23c451=a96_0x2695,_0x5ec63c=_0x2874cb();while(!![]){try{const _0x2042b1=-parseInt(_0x23c451(0x1eb))/0x1*(parseInt(_0x23c451(0x1bd))/0x2)+-parseInt(_0x23c451(0x1e7))/0x3+parseInt(_0x23c451(0x1ea))/0x4+-parseInt(_0x23c451(0x1da))/0x5*(-parseInt(_0x23c451(0x1b9))/0x6)+parseInt(_0x23c451(0x1e2))/0x7*(-parseInt(_0x23c451(0x1e6))/0x8)+parseInt(_0x23c451(0x1ce))/0x9+parseInt(_0x23c451(0x1f6))/0xa*(parseInt(_0x23c451(0x1d0))/0xb);if(_0x2042b1===_0x376f7c)break;else _0x5ec63c['push'](_0x5ec63c['shift']());}catch(_0x18d92e){_0x5ec63c['push'](_0x5ec63c['shift']());}}}(a96_0x4d76,0x9ffaf));import a96_0x2bd65d from'path';import a96_0x197b5c from'fs';import{fileURLToPath}from'node:url';import a96_0x473159 from'chalk';import a96_0x4759a6 from'ora';function a96_0x4d76(){const _0x1b237b=['parse','\x20Generated\x20by\x20rabetbase\x20cli\x20','projectName','projectCode','750EtyUzv','\x20api\x20pull','Format\x20code','Invalid\x20characters\x20in\x20project\x20name.\x20Not\x20allowed:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20and\x20control\x20characters','330nXqeQV','清理项目目录失败:\x20','existsSync','stableVersion','cyan','repeat','package.json','dirname','gray','\x20model(s)','\x20\x202.\x20Pull\x20API\x20configuration:\x20','resolve','modelCount','√\x20Configuration\x20file\x20created,\x20AppCode:\x20','production','Cannot\x20create\x20project\x20in\x20current\x20directory,\x20please\x20check\x20directory\x20permissions','stop','7134750YHDcUY','W_OK','14839mNtgbN','cookie','utf8','log','green','rmSync','error','更新\x20package.json\x20失败','cd\x20','*\x20Configuring\x20AppCode\x20for\x20project\x20','7795PvlMcd','Project\x20name\x20cannot\x20be\x20empty','🚀\x20Next\x20Steps:','appCode','success','API\x20configuration\x20pulled:\x20','Install\x20dependencies','length','154guXdAA','项目创建失败:\x20','*\x20Cleaning\x20up\x20failed\x20project\x20directory:\x20','*\x20Pulling\x20API\x20configuration...','330352OXiIuZ','2906043wYIOmI','chdir','\x20\x201.\x20Start\x20project:\x20','719332JDgzXB','4359Lkjwup','version','../..','\x20|\x20AppCode:\x20','./src/api/','fail','start','stringify','needsUpgrade','更新\x20package.json\x20name','项目创建完成:\x20','15450RpYAwl','create','join','!\x20API\x20configuration\x20pull\x20error,\x20you\x20can\x20manually\x20run:\x20rabetbase\x20api\x20pull','toLocaleString','Copy\x20project\x20files','*\x20Updating\x20package.json\x20name\x20and\x20description\x20fields','Project\x20name\x20is\x20too\x20long,\x20maximum\x20100\x20characters','info','setLogPath','bold','\x20already\x20exists','constants','1.0.0','...','\x20dataset(s),\x20generated\x20','message','readFileSync','test','\x20&&\x20','env','cwd','\x20√\x20','Project\x20name:\x20','CLI\x20版本检查','trim','√\x20package.json\x20updated:\x20name='];a96_0x4d76=function(){return _0x1b237b;};return a96_0x4d76();}import{guidedCreateProject}from'./enhanced-guided-create.js';import{fetchModelList}from'../api/fetch-model-list.js';import{generateApiFile}from'../api/generate-api-file.js';import{initEnv}from'../constant/env.js';import{readConfig}from'../utils/config.js';import{CLI_BIN_NAME}from'../constant/cli.js';import{writeConfigFile,NEW_CONFIG_NAME}from'../context.js';import{copyProjectTemplate}from'./use-copy-project-template.js';import{installDependencies}from'./use-install-dependencies.js';import{formatProjectCode}from'./use-format-code.js';import{logger}from'../utils/logger.js';import{checkCliVersion,printCliUpgradeWarning}from'../utils/cli-version-check.js';import{selectSingleAppcode}from'../commands/common/app-selector.js';export async function createApp(_0x434535){const _0x3e663e=a96_0x2695,_0x25f87a=await checkCliVersion();_0x25f87a['needsUpgrade']&&(printCliUpgradeWarning(_0x25f87a),logger[_0x3e663e(0x1fe)](_0x3e663e(0x1f7),_0x3e663e(0x1b2),{'currentVersion':_0x25f87a['currentVersion'],'stableVersion':_0x25f87a[_0x3e663e(0x1c0)],'needsUpgrade':_0x25f87a[_0x3e663e(0x1f3)]}));if(_0x434535[_0x3e663e(0x1b8)]&&_0x434535['appCode'])await runCreate({'projectName':_0x434535['projectCode'],'appCode':_0x434535[_0x3e663e(0x1dd)],'env':_0x434535[_0x3e663e(0x20a)]},_0x434535);else{if(_0x434535[_0x3e663e(0x1b8)]){const _0x4d6040=await selectSingleAppcode(_0x434535[_0x3e663e(0x1d1)]);await runCreate({'projectName':_0x434535[_0x3e663e(0x1b8)],'appCode':_0x4d6040||undefined,'env':_0x434535[_0x3e663e(0x20a)]},_0x434535);}else await guidedCreateProject(_0x5e83bb=>runCreate(_0x5e83bb,_0x434535),_0x434535['env'],_0x434535[_0x3e663e(0x1d1)]);}}async function runCreate(_0xf2411f,_0xd273df){const _0x27aef6=a96_0x2695;if(!_0xf2411f[_0x27aef6(0x1b7)]||_0xf2411f['projectName'][_0x27aef6(0x1b3)]()==='')throw new Error(_0x27aef6(0x1db));const _0xf1916e=/[<>:"|?*\x00-\x1f\x7f]/;if(_0xf1916e[_0x27aef6(0x208)](_0xf2411f[_0x27aef6(0x1b7)]))throw new Error(_0x27aef6(0x1bc));if(_0xf2411f['projectName']['length']>0x64)throw new Error(_0x27aef6(0x1fd));const _0x33dbec=a96_0x2bd65d['resolve'](process[_0x27aef6(0x1af)](),_0xf2411f[_0x27aef6(0x1b7)]);if(a96_0x197b5c[_0x27aef6(0x1bf)](_0x33dbec))throw new Error('Project\x20directory\x20'+_0xf2411f['projectName']+_0x27aef6(0x201));try{a96_0x197b5c['accessSync'](a96_0x2bd65d[_0x27aef6(0x1c4)](_0x33dbec),a96_0x197b5c[_0x27aef6(0x202)][_0x27aef6(0x1cf)]);}catch{throw new Error(_0x27aef6(0x1cc));}logger[_0x27aef6(0x1ff)](_0x33dbec),logger[_0x27aef6(0x1fe)](_0x27aef6(0x1f7),'开始创建项目:\x20'+_0xf2411f[_0x27aef6(0x1b7)],{'projectDir':_0x33dbec,'appCode':_0xf2411f['appCode']}),console['log'](),console[_0x27aef6(0x1d3)](a96_0x473159[_0x27aef6(0x1d4)](_0x27aef6(0x1b0))+_0x27aef6(0x1b1)+a96_0x473159['green'](_0xf2411f[_0x27aef6(0x1b7)])+(_0xf2411f['appCode']?_0x27aef6(0x1ee)+a96_0x473159[_0x27aef6(0x1c1)](_0xf2411f[_0x27aef6(0x1dd)]):''));try{await runTask(_0x27aef6(0x1fb),()=>copyProjectTemplate(_0xf2411f[_0x27aef6(0x1b7)])),await updatePackageJsonName(_0xf2411f['projectName']),await runTask(_0x27aef6(0x1e0),()=>installDependencies(_0xf2411f['projectName'])),await runTask(_0x27aef6(0x1bb),()=>formatProjectCode(_0xf2411f[_0x27aef6(0x1b7)])),await configureAppCode(_0xf2411f[_0x27aef6(0x1b7)],_0xf2411f[_0x27aef6(0x1dd)]||'',_0xf2411f[_0x27aef6(0x20a)]);let _0x171f9b=![];if(_0xf2411f['appCode']){console[_0x27aef6(0x1d3)](_0x27aef6(0x1e5));const _0x35200e=process[_0x27aef6(0x1af)]();try{process[_0x27aef6(0x1e8)](_0x33dbec);const _0x4feb68=_0xf2411f[_0x27aef6(0x20a)]||_0x27aef6(0x1cb);initEnv(_0x4feb68);const {configArray:_0xf598dc}=await fetchModelList(_0xf2411f['appCode'],_0xd273df[_0x27aef6(0x1d1)]||''),_0x211e8e=_0x27aef6(0x1ef),_0x3c45db=await generateApiFile(_0xf598dc,'',_0xf2411f[_0x27aef6(0x1dd)],!![],_0x4feb68,_0x211e8e);console[_0x27aef6(0x1d3)]('√\x20Pulled\x20'+_0xf598dc[_0x27aef6(0x1e1)]+_0x27aef6(0x205)+_0x3c45db[_0x27aef6(0x1c9)]+_0x27aef6(0x1c6)),logger[_0x27aef6(0x1fe)]('create',_0x27aef6(0x1df)+_0xf2411f[_0x27aef6(0x1dd)]);}catch(_0x599171){_0x171f9b=!![],console[_0x27aef6(0x1d3)](_0x27aef6(0x1f9)),logger['warn']('create','API\x20配置拉取异常',{'error':_0x599171 instanceof Error?_0x599171[_0x27aef6(0x206)]:String(_0x599171)});}finally{process[_0x27aef6(0x1e8)](_0x35200e);}}logger[_0x27aef6(0x1de)](_0x27aef6(0x1f7),_0x27aef6(0x1f5)+_0xf2411f['projectName']),console[_0x27aef6(0x1d3)](),console[_0x27aef6(0x1d3)](a96_0x473159[_0x27aef6(0x1d4)]('─'[_0x27aef6(0x1c2)](0x3c))),console[_0x27aef6(0x1d3)](a96_0x473159[_0x27aef6(0x1c1)][_0x27aef6(0x200)](_0x27aef6(0x1dc))),console['log'](),console[_0x27aef6(0x1d3)](_0x27aef6(0x1e9)+a96_0x473159[_0x27aef6(0x1c1)][_0x27aef6(0x200)](_0x27aef6(0x1d8)+_0xf2411f['projectName']+_0x27aef6(0x209)+CLI_BIN_NAME+'\x20run\x20start')),_0x171f9b&&console[_0x27aef6(0x1d3)](_0x27aef6(0x1c7)+a96_0x473159['cyan'][_0x27aef6(0x200)](CLI_BIN_NAME+_0x27aef6(0x1ba))),console[_0x27aef6(0x1d3)](a96_0x473159[_0x27aef6(0x1d4)]('─'[_0x27aef6(0x1c2)](0x3c)));}catch(_0x201949){logger[_0x27aef6(0x1d6)](_0x27aef6(0x1f7),_0x27aef6(0x1e3)+_0xf2411f['projectName'],{'error':_0x201949 instanceof Error?_0x201949['message']:String(_0x201949)});try{a96_0x197b5c[_0x27aef6(0x1bf)](_0x33dbec)&&(console[_0x27aef6(0x1d3)](_0x27aef6(0x1e4)+_0x33dbec),a96_0x197b5c[_0x27aef6(0x1d5)](_0x33dbec,{'recursive':!![],'force':!![]}));}catch{logger['warn']('create',_0x27aef6(0x1be)+_0x33dbec);}throw _0x201949;}}async function runTask(_0x2da045,_0x4b1d24){const _0x17a6a6=a96_0x2695,_0x42eb40=a96_0x4759a6(_0x2da045+_0x17a6a6(0x204))[_0x17a6a6(0x1f1)]();try{const _0x887c98=await _0x4b1d24();_0x42eb40[_0x17a6a6(0x1cd)](),console[_0x17a6a6(0x1d3)](''+a96_0x473159['green'](_0x17a6a6(0x1b0))+_0x2da045+'\x20'+a96_0x473159[_0x17a6a6(0x1c5)]('['+_0x887c98+']'));}catch(_0xf39008){_0x42eb40[_0x17a6a6(0x1f0)](_0x2da045);throw _0xf39008;}}function a96_0x2695(_0x3ed6e5,_0xdd38a4){_0x3ed6e5=_0x3ed6e5-0x1af;const _0x4d760c=a96_0x4d76();let _0x2695a0=_0x4d760c[_0x3ed6e5];return _0x2695a0;}async function updatePackageJsonName(_0x4aaed9){const _0x439b4f=a96_0x2695,_0x2e5dd9=a96_0x2bd65d[_0x439b4f(0x1c8)](process[_0x439b4f(0x1af)](),_0x4aaed9),_0x1ce83f=a96_0x2bd65d[_0x439b4f(0x1f8)](_0x2e5dd9,_0x439b4f(0x1c3));try{console[_0x439b4f(0x1d3)](_0x439b4f(0x1fc));const _0x3eb2a5=fileURLToPath(import.meta.url),_0x5822b1=a96_0x2bd65d['resolve'](a96_0x2bd65d[_0x439b4f(0x1c4)](_0x3eb2a5),_0x439b4f(0x1ed)),_0x2c394c=a96_0x2bd65d[_0x439b4f(0x1f8)](_0x5822b1,_0x439b4f(0x1c3));let _0x3a221f='1.0.0';try{const _0x343680=JSON[_0x439b4f(0x1b5)](a96_0x197b5c['readFileSync'](_0x2c394c,'utf8'));_0x3a221f=_0x343680[_0x439b4f(0x1ec)]||'1.0.0';}catch{}const _0x28cbbd=a96_0x197b5c[_0x439b4f(0x207)](_0x1ce83f,_0x439b4f(0x1d2)),_0x3e1bfe=JSON[_0x439b4f(0x1b5)](_0x28cbbd);_0x3e1bfe['name']=_0x4aaed9,_0x3e1bfe['description']=_0x4aaed9+_0x439b4f(0x1b6)+_0x3a221f,a96_0x197b5c['writeFileSync'](_0x1ce83f,JSON[_0x439b4f(0x1f2)](_0x3e1bfe,null,0x2)+'\x0a',_0x439b4f(0x1d2)),console[_0x439b4f(0x1d3)](_0x439b4f(0x1b4)+_0x4aaed9),logger[_0x439b4f(0x1fe)](_0x439b4f(0x1f7),_0x439b4f(0x1f4));}catch(_0x5791e2){logger[_0x439b4f(0x1d6)](_0x439b4f(0x1f7),_0x439b4f(0x1d7));throw _0x5791e2;}}async function configureAppCode(_0x3cb04f,_0x4d93b6,_0x5f526e){const _0x118d87=a96_0x2695,_0x35d319=a96_0x2bd65d[_0x118d87(0x1c8)](process['cwd'](),_0x3cb04f),_0x2112e7=a96_0x2bd65d[_0x118d87(0x1f8)](_0x35d319,NEW_CONFIG_NAME);try{_0x4d93b6?console[_0x118d87(0x1d3)](_0x118d87(0x1d9)+_0x3cb04f+':\x20'+_0x4d93b6):console[_0x118d87(0x1d3)]('*\x20Creating\x20configuration\x20file\x20for\x20project\x20'+_0x3cb04f);const _0x59278d=fileURLToPath(import.meta.url),_0x14a095=a96_0x2bd65d['resolve'](a96_0x2bd65d['dirname'](_0x59278d),'../..'),_0x57e58f=a96_0x2bd65d[_0x118d87(0x1f8)](_0x14a095,_0x118d87(0x1c3));let _0x3ea5c6=_0x118d87(0x203);try{const _0x29fb56=JSON['parse'](a96_0x197b5c['readFileSync'](_0x57e58f,'utf8'));_0x3ea5c6=_0x29fb56[_0x118d87(0x1ec)]||'1.0.0';}catch{}const _0x5b7ba5=readConfig(),_0x19ad94=typeof _0x5b7ba5[_0x118d87(0x20a)]==='string'?_0x5b7ba5[_0x118d87(0x20a)]:undefined,{app:_0x12e53b,appcode:_0x47a666,..._0x847a64}=_0x5b7ba5,_0x511d32={..._0x847a64,'appcode':_0x4d93b6||'','env':_0x5f526e||_0x19ad94||_0x118d87(0x1cb),'createdAt':new Date()[_0x118d87(0x1fa)](),'version':_0x3ea5c6};writeConfigFile(_0x2112e7,_0x511d32),_0x4d93b6?console[_0x118d87(0x1d3)](_0x118d87(0x1ca)+_0x4d93b6):console['log']('√\x20Configuration\x20file\x20created,\x20you\x20can\x20configure\x20later\x20with\x20\x27'+CLI_BIN_NAME+'\x20config\x20set\x20appcode\x20<app-code>\x27'),logger[_0x118d87(0x1fe)](_0x118d87(0x1f7),'配置应用AppCode:\x20'+_0x4d93b6);}catch(_0x1ae39c){logger[_0x118d87(0x1d6)](_0x118d87(0x1f7),'配置应用AppCode失败');}}
|
|
1
|
+
(function(_0x37340d,_0xcb193d){const _0x3a3fb3=a96_0x5f3f,_0x4c8ed6=_0x37340d();while(!![]){try{const _0x521896=-parseInt(_0x3a3fb3(0x19a))/0x1*(parseInt(_0x3a3fb3(0x1d3))/0x2)+parseInt(_0x3a3fb3(0x17c))/0x3*(parseInt(_0x3a3fb3(0x1cb))/0x4)+-parseInt(_0x3a3fb3(0x187))/0x5+parseInt(_0x3a3fb3(0x1a5))/0x6*(parseInt(_0x3a3fb3(0x18b))/0x7)+parseInt(_0x3a3fb3(0x1ba))/0x8*(parseInt(_0x3a3fb3(0x1c9))/0x9)+-parseInt(_0x3a3fb3(0x1c7))/0xa*(-parseInt(_0x3a3fb3(0x1a6))/0xb)+-parseInt(_0x3a3fb3(0x192))/0xc;if(_0x521896===_0xcb193d)break;else _0x4c8ed6['push'](_0x4c8ed6['shift']());}catch(_0x936602){_0x4c8ed6['push'](_0x4c8ed6['shift']());}}}(a96_0x35cc,0x755eb));import a96_0x50f553 from'path';import a96_0x1a401b from'fs';function a96_0x35cc(){const _0xb34021=['!\x20API\x20configuration\x20pull\x20error,\x20you\x20can\x20manually\x20run:\x20rabetbase\x20api\x20pull','fail','chdir','\x20\x201.\x20Start\x20project:\x20','Project\x20name\x20is\x20too\x20long,\x20maximum\x20100\x20characters','\x20config\x20set\x20appcode\x20<app-code>\x27','success','bold','√\x20Pulled\x20','stop','create','repeat','\x20run\x20start','../..','Project\x20name\x20cannot\x20be\x20empty','\x20√\x20','message','Project\x20directory\x20','stringify','16XNaIxZ','appCode','√\x20Configuration\x20file\x20created,\x20AppCode:\x20','cwd','toLocaleString','constants','readFileSync','API\x20configuration\x20pulled:\x20','package.json','\x20&&\x20','项目创建失败:\x20','\x20already\x20exists','*\x20Pulling\x20API\x20configuration...','500GbFkcm','\x20api\x20pull','3845673HiwXor','name','16664buZUSP','join','🚀\x20Next\x20Steps:','modelCount','string','description','Invalid\x20characters\x20in\x20project\x20name.\x20Not\x20allowed:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20and\x20control\x20characters','projectCode','69240TbZSST','env','√\x20package.json\x20updated:\x20name=','更新\x20package.json\x20失败','dirname','./src/api/','384dLVWQB','...','\x20|\x20AppCode:\x20','cookie','cd\x20','resolve','info','更新\x20package.json\x20name','rmSync','length','*\x20Updating\x20package.json\x20name\x20and\x20description\x20fields','1634950XtXZbO','test','配置应用AppCode失败','projectName','6064135ewToiy','needsUpgrade','writeFileSync','\x20\x202.\x20Pull\x20API\x20configuration:\x20','cyan','W_OK','1.0.0','14794800elBPEe','√\x20Configuration\x20file\x20created,\x20you\x20can\x20configure\x20later\x20with\x20\x27','配置应用AppCode:\x20','CLI\x20版本检查','warn','*\x20Configuring\x20AppCode\x20for\x20project\x20','currentVersion','parse','23HYAYnJ','version','log','existsSync','Install\x20dependencies','Cannot\x20create\x20project\x20in\x20current\x20directory,\x20please\x20check\x20directory\x20permissions','*\x20Creating\x20configuration\x20file\x20for\x20project\x20','utf8','production','green','start','6ksIZQw','128205yPamaJ'];a96_0x35cc=function(){return _0xb34021;};return a96_0x35cc();}import{fileURLToPath}from'node:url';import a96_0xb26750 from'chalk';import a96_0x50843b from'ora';import{guidedCreateProject}from'./enhanced-guided-create.js';function a96_0x5f3f(_0x230c99,_0x5966ff){_0x230c99=_0x230c99-0x17b;const _0x35cc93=a96_0x35cc();let _0x5f3f6e=_0x35cc93[_0x230c99];return _0x5f3f6e;}import{fetchModelList}from'../api/fetch-model-list.js';import{generateApiFile}from'../api/generate-api-file.js';import{initEnv}from'../constant/env.js';import{readConfig}from'../utils/config.js';import{CLI_BIN_NAME}from'../constant/cli.js';import{writeConfigFile,NEW_CONFIG_NAME}from'../context.js';import{copyProjectTemplate}from'./use-copy-project-template.js';import{installDependencies}from'./use-install-dependencies.js';import{formatProjectCode}from'./use-format-code.js';import{logger}from'../utils/logger.js';import{checkCliVersion,printCliUpgradeWarning}from'../utils/cli-version-check.js';import{selectSingleAppcode}from'../commands/common/app-selector.js';export async function createApp(_0x4d5893){const _0x5e5790=a96_0x5f3f,_0x2fa5bb=await checkCliVersion();_0x2fa5bb[_0x5e5790(0x18c)]&&(printCliUpgradeWarning(_0x2fa5bb),logger[_0x5e5790(0x182)](_0x5e5790(0x1b1),_0x5e5790(0x195),{'currentVersion':_0x2fa5bb[_0x5e5790(0x198)],'stableVersion':_0x2fa5bb['stableVersion'],'needsUpgrade':_0x2fa5bb[_0x5e5790(0x18c)]}));if(_0x4d5893['projectCode']&&_0x4d5893['appCode'])await runCreate({'projectName':_0x4d5893[_0x5e5790(0x1d2)],'appCode':_0x4d5893['appCode'],'env':_0x4d5893[_0x5e5790(0x1d4)]},_0x4d5893);else{if(_0x4d5893[_0x5e5790(0x1d2)]){const _0x169647=await selectSingleAppcode(_0x4d5893[_0x5e5790(0x17f)]);await runCreate({'projectName':_0x4d5893[_0x5e5790(0x1d2)],'appCode':_0x169647||undefined,'env':_0x4d5893[_0x5e5790(0x1d4)]},_0x4d5893);}else await guidedCreateProject(_0x5912f5=>runCreate(_0x5912f5,_0x4d5893),_0x4d5893['env'],_0x4d5893[_0x5e5790(0x17f)]);}}async function runCreate(_0x4195e9,_0x2e238e){const _0x2f07b8=a96_0x5f3f;if(!_0x4195e9[_0x2f07b8(0x18a)]||_0x4195e9[_0x2f07b8(0x18a)]['trim']()==='')throw new Error(_0x2f07b8(0x1b5));const _0x386fbb=/[<>:"|?*\x00-\x1f\x7f]/;if(_0x386fbb[_0x2f07b8(0x188)](_0x4195e9[_0x2f07b8(0x18a)]))throw new Error(_0x2f07b8(0x1d1));if(_0x4195e9['projectName'][_0x2f07b8(0x185)]>0x64)throw new Error(_0x2f07b8(0x1ab));const _0x595d09=a96_0x50f553[_0x2f07b8(0x181)](process[_0x2f07b8(0x1bd)](),_0x4195e9[_0x2f07b8(0x18a)]);if(a96_0x1a401b[_0x2f07b8(0x19d)](_0x595d09))throw new Error(_0x2f07b8(0x1b8)+_0x4195e9[_0x2f07b8(0x18a)]+_0x2f07b8(0x1c5));try{a96_0x1a401b['accessSync'](a96_0x50f553[_0x2f07b8(0x1d7)](_0x595d09),a96_0x1a401b[_0x2f07b8(0x1bf)][_0x2f07b8(0x190)]);}catch{throw new Error(_0x2f07b8(0x19f));}logger['setLogPath'](_0x595d09),logger[_0x2f07b8(0x182)](_0x2f07b8(0x1b1),'开始创建项目:\x20'+_0x4195e9[_0x2f07b8(0x18a)],{'projectDir':_0x595d09,'appCode':_0x4195e9[_0x2f07b8(0x1bb)]}),console[_0x2f07b8(0x19c)](),console['log'](a96_0xb26750[_0x2f07b8(0x1a3)](_0x2f07b8(0x1b6))+'Project\x20name:\x20'+a96_0xb26750[_0x2f07b8(0x1a3)](_0x4195e9['projectName'])+(_0x4195e9['appCode']?_0x2f07b8(0x17e)+a96_0xb26750[_0x2f07b8(0x18f)](_0x4195e9[_0x2f07b8(0x1bb)]):''));try{await runTask('Copy\x20project\x20files',()=>copyProjectTemplate(_0x4195e9[_0x2f07b8(0x18a)])),await updatePackageJsonName(_0x4195e9[_0x2f07b8(0x18a)]),await runTask(_0x2f07b8(0x19e),()=>installDependencies(_0x4195e9[_0x2f07b8(0x18a)])),await runTask('Format\x20code',()=>formatProjectCode(_0x4195e9[_0x2f07b8(0x18a)])),await configureAppCode(_0x4195e9[_0x2f07b8(0x18a)],_0x4195e9[_0x2f07b8(0x1bb)]||'',_0x4195e9[_0x2f07b8(0x1d4)]);let _0x38abd9=![];if(_0x4195e9['appCode']){console['log'](_0x2f07b8(0x1c6));const _0xba2eae=process['cwd']();try{process['chdir'](_0x595d09);const _0x39eade=_0x4195e9[_0x2f07b8(0x1d4)]||_0x2f07b8(0x1a2);initEnv(_0x39eade);const {configArray:_0x2133f6}=await fetchModelList(_0x4195e9[_0x2f07b8(0x1bb)],_0x2e238e[_0x2f07b8(0x17f)]||''),_0x58bd18=_0x2f07b8(0x17b),_0x393245=await generateApiFile(_0x2133f6,'',_0x4195e9[_0x2f07b8(0x1bb)],!![],_0x39eade,_0x58bd18);console['log'](_0x2f07b8(0x1af)+_0x2133f6[_0x2f07b8(0x185)]+'\x20dataset(s),\x20generated\x20'+_0x393245[_0x2f07b8(0x1ce)]+'\x20model(s)'),logger[_0x2f07b8(0x182)](_0x2f07b8(0x1b1),_0x2f07b8(0x1c1)+_0x4195e9[_0x2f07b8(0x1bb)]);}catch(_0x272069){_0x38abd9=!![],console[_0x2f07b8(0x19c)](_0x2f07b8(0x1a7)),logger[_0x2f07b8(0x196)](_0x2f07b8(0x1b1),'API\x20配置拉取异常',{'error':_0x272069 instanceof Error?_0x272069[_0x2f07b8(0x1b7)]:String(_0x272069)});}finally{process[_0x2f07b8(0x1a9)](_0xba2eae);}}logger[_0x2f07b8(0x1ad)](_0x2f07b8(0x1b1),'项目创建完成:\x20'+_0x4195e9[_0x2f07b8(0x18a)]),console[_0x2f07b8(0x19c)](),console[_0x2f07b8(0x19c)](a96_0xb26750[_0x2f07b8(0x1a3)]('─'[_0x2f07b8(0x1b2)](0x3c))),console[_0x2f07b8(0x19c)](a96_0xb26750[_0x2f07b8(0x18f)][_0x2f07b8(0x1ae)](_0x2f07b8(0x1cd))),console[_0x2f07b8(0x19c)](),console[_0x2f07b8(0x19c)](_0x2f07b8(0x1aa)+a96_0xb26750[_0x2f07b8(0x18f)][_0x2f07b8(0x1ae)](_0x2f07b8(0x180)+_0x4195e9[_0x2f07b8(0x18a)]+_0x2f07b8(0x1c3)+CLI_BIN_NAME+_0x2f07b8(0x1b3))),_0x38abd9&&console[_0x2f07b8(0x19c)](_0x2f07b8(0x18e)+a96_0xb26750['cyan'][_0x2f07b8(0x1ae)](CLI_BIN_NAME+_0x2f07b8(0x1c8))),console[_0x2f07b8(0x19c)](a96_0xb26750[_0x2f07b8(0x1a3)]('─'[_0x2f07b8(0x1b2)](0x3c)));}catch(_0xfbcc4c){logger['error'](_0x2f07b8(0x1b1),_0x2f07b8(0x1c4)+_0x4195e9[_0x2f07b8(0x18a)],{'error':_0xfbcc4c instanceof Error?_0xfbcc4c[_0x2f07b8(0x1b7)]:String(_0xfbcc4c)});try{a96_0x1a401b[_0x2f07b8(0x19d)](_0x595d09)&&(console[_0x2f07b8(0x19c)]('*\x20Cleaning\x20up\x20failed\x20project\x20directory:\x20'+_0x595d09),a96_0x1a401b[_0x2f07b8(0x184)](_0x595d09,{'recursive':!![],'force':!![]}));}catch{logger[_0x2f07b8(0x196)](_0x2f07b8(0x1b1),'清理项目目录失败:\x20'+_0x595d09);}throw _0xfbcc4c;}}async function runTask(_0x3f29b7,_0x4b076e){const _0x2d5a2e=a96_0x5f3f,_0x37b838=a96_0x50843b(_0x3f29b7+_0x2d5a2e(0x17d))[_0x2d5a2e(0x1a4)]();try{const _0x2a3ed1=await _0x4b076e();_0x37b838[_0x2d5a2e(0x1b0)](),console[_0x2d5a2e(0x19c)](''+a96_0xb26750[_0x2d5a2e(0x1a3)](_0x2d5a2e(0x1b6))+_0x3f29b7+'\x20'+a96_0xb26750['gray']('['+_0x2a3ed1+']'));}catch(_0x502a6){_0x37b838[_0x2d5a2e(0x1a8)](_0x3f29b7);throw _0x502a6;}}async function updatePackageJsonName(_0x2e865b){const _0x1b813f=a96_0x5f3f,_0x541581=a96_0x50f553[_0x1b813f(0x181)](process[_0x1b813f(0x1bd)](),_0x2e865b),_0x469c2a=a96_0x50f553['join'](_0x541581,_0x1b813f(0x1c2));try{console['log'](_0x1b813f(0x186));const _0x2195a5=fileURLToPath(import.meta.url),_0xe42ec9=a96_0x50f553[_0x1b813f(0x181)](a96_0x50f553['dirname'](_0x2195a5),_0x1b813f(0x1b4)),_0x38de8e=a96_0x50f553[_0x1b813f(0x1cc)](_0xe42ec9,_0x1b813f(0x1c2));let _0x551879=_0x1b813f(0x191);try{const _0x5be00c=JSON[_0x1b813f(0x199)](a96_0x1a401b['readFileSync'](_0x38de8e,_0x1b813f(0x1a1)));_0x551879=_0x5be00c[_0x1b813f(0x19b)]||'1.0.0';}catch{}const _0x5de9da=a96_0x1a401b[_0x1b813f(0x1c0)](_0x469c2a,_0x1b813f(0x1a1)),_0x6401f7=JSON['parse'](_0x5de9da);_0x6401f7[_0x1b813f(0x1ca)]=_0x2e865b,_0x6401f7[_0x1b813f(0x1d0)]=_0x2e865b+'\x20Generated\x20by\x20rabetbase\x20cli\x20'+_0x551879,a96_0x1a401b[_0x1b813f(0x18d)](_0x469c2a,JSON[_0x1b813f(0x1b9)](_0x6401f7,null,0x2)+'\x0a',_0x1b813f(0x1a1)),console[_0x1b813f(0x19c)](_0x1b813f(0x1d5)+_0x2e865b),logger['info'](_0x1b813f(0x1b1),_0x1b813f(0x183));}catch(_0x4aa7fa){logger['error'](_0x1b813f(0x1b1),_0x1b813f(0x1d6));throw _0x4aa7fa;}}async function configureAppCode(_0x458565,_0x3f64d5,_0x2af81f){const _0x399b98=a96_0x5f3f,_0x4b04ed=a96_0x50f553[_0x399b98(0x181)](process[_0x399b98(0x1bd)](),_0x458565),_0x56876b=a96_0x50f553[_0x399b98(0x1cc)](_0x4b04ed,NEW_CONFIG_NAME);try{_0x3f64d5?console['log'](_0x399b98(0x197)+_0x458565+':\x20'+_0x3f64d5):console['log'](_0x399b98(0x1a0)+_0x458565);const _0x359c0f=fileURLToPath(import.meta.url),_0x4ad81e=a96_0x50f553[_0x399b98(0x181)](a96_0x50f553[_0x399b98(0x1d7)](_0x359c0f),_0x399b98(0x1b4)),_0x124d62=a96_0x50f553[_0x399b98(0x1cc)](_0x4ad81e,_0x399b98(0x1c2));let _0x3873f4=_0x399b98(0x191);try{const _0x1f3651=JSON[_0x399b98(0x199)](a96_0x1a401b[_0x399b98(0x1c0)](_0x124d62,_0x399b98(0x1a1)));_0x3873f4=_0x1f3651[_0x399b98(0x19b)]||'1.0.0';}catch{}const _0xa5780f=readConfig(),_0xf272fd=typeof _0xa5780f[_0x399b98(0x1d4)]===_0x399b98(0x1cf)?_0xa5780f[_0x399b98(0x1d4)]:undefined,{app:_0x308fdf,appcode:_0x3a9a89,..._0x285dd2}=_0xa5780f,_0x315328={..._0x285dd2,'appcode':_0x3f64d5||'','env':_0x2af81f||_0xf272fd||_0x399b98(0x1a2),'createdAt':new Date()[_0x399b98(0x1be)](),'version':_0x3873f4};writeConfigFile(_0x56876b,_0x315328),_0x3f64d5?console[_0x399b98(0x19c)](_0x399b98(0x1bc)+_0x3f64d5):console[_0x399b98(0x19c)](_0x399b98(0x193)+CLI_BIN_NAME+_0x399b98(0x1ac)),logger['info'](_0x399b98(0x1b1),_0x399b98(0x194)+_0x3f64d5);}catch(_0x6b4a7e){logger['error'](_0x399b98(0x1b1),_0x399b98(0x189));}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x38a640,_0x2dd765){const _0x1b31bb=a97_0x155c,_0x47e7a3=_0x38a640();while(!![]){try{const _0x1a9ca6=-parseInt(_0x1b31bb(0x92))/0x1*(parseInt(_0x1b31bb(0x9a))/0x2)+parseInt(_0x1b31bb(0x84))/0x3*(parseInt(_0x1b31bb(0xa8))/0x4)+parseInt(_0x1b31bb(0x93))/0x5*(parseInt(_0x1b31bb(0x7c))/0x6)+-parseInt(_0x1b31bb(0x76))/0x7+parseInt(_0x1b31bb(0x82))/0x8*(-parseInt(_0x1b31bb(0x7d))/0x9)+-parseInt(_0x1b31bb(0x99))/0xa*(-parseInt(_0x1b31bb(0x9f))/0xb)+-parseInt(_0x1b31bb(0x86))/0xc*(-parseInt(_0x1b31bb(0x9d))/0xd);if(_0x1a9ca6===_0x2dd765)break;else _0x47e7a3['push'](_0x47e7a3['shift']());}catch(_0x57348e){_0x47e7a3['push'](_0x47e7a3['shift']());}}}(a97_0x5b00,0x6fb55));import a97_0x2e5433 from'path';import{fileURLToPath}from'url';function a97_0x155c(_0xc26126,_0x1f1c32){_0xc26126=_0xc26126-0x71;const _0x5b0091=a97_0x5b00();let _0x155c13=_0x5b0091[_0xc26126];return _0x155c13;}import a97_0xf4b8cd from'fs/promises';import{existsSync}from'fs';import{CLI_BIN_NAME}from'../constant/cli.js';import{exec,execSync}from'child_process';import{copyDirectory}from'../utils/copy-directory.js';import{promisify}from'util';import{checkCliVersion,printCliUpgradeWarning}from'../utils/cli-version-check.js';import{writeConfigFile,NEW_CONFIG_NAME}from'../context.js';import{readConfig}from'../utils/config.js';import{getCliVersion}from'../utils/version.js';import{CliErrors}from'../errors.js';import{fetchModelList}from'../api/fetch-model-list.js';import{generateApiFile}from'../api/generate-api-file.js';import{initEnv}from'../constant/env.js';const execAsync=promisify(exec);function getTemplateDir(){const _0x7ec231=a97_0x155c,_0x54e5f3=fileURLToPath(import.meta.url),_0x4190b1=a97_0x2e5433[_0x7ec231(0x8c)](_0x54e5f3);return a97_0x2e5433[_0x7ec231(0xa1)](_0x4190b1,_0x7ec231(0x81));}export async function createProjectNonInteractive(_0x20649c,_0x5d2c67,_0x3508e9,_0x1a4823){const _0x5ecaa0=a97_0x155c,_0x71435d=await checkCliVersion();_0x71435d[_0x5ecaa0(0x7b)]&&printCliUpgradeWarning(_0x71435d);if(!_0x20649c||_0x20649c[_0x5ecaa0(0x79)]()==='')throw CliErrors[_0x5ecaa0(0xaa)]('Project\x20name\x20cannot\x20be\x20empty.');const _0x854245=/[<>:"|?*\x00-\x1f\x7f]/;if(_0x854245[_0x5ecaa0(0x7a)](_0x20649c))throw CliErrors[_0x5ecaa0(0xaa)](_0x5ecaa0(0x80),'Not\x20allowed:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20and\x20control\x20characters');if(_0x20649c[_0x5ecaa0(0xa3)]>0x64)throw CliErrors[_0x5ecaa0(0xaa)](_0x5ecaa0(0xad));const _0x25d125=a97_0x2e5433[_0x5ecaa0(0xa1)](process['cwd'](),_0x20649c);if(existsSync(_0x25d125))throw CliErrors[_0x5ecaa0(0xaa)]('Project\x20directory\x20\x22'+_0x20649c+_0x5ecaa0(0x8d),_0x5ecaa0(0x7e));try{const _0x3c1fd2=a97_0x2e5433[_0x5ecaa0(0x8c)](_0x25d125);await a97_0xf4b8cd[_0x5ecaa0(0x94)](_0x3c1fd2,a97_0xf4b8cd['constants'][_0x5ecaa0(0xa4)]);}catch{throw CliErrors[_0x5ecaa0(0xaa)](_0x5ecaa0(0x97),_0x5ecaa0(0xa6));}try{console[_0x5ecaa0(0x8a)]('*\x20Creating\x20project\x20'+_0x20649c+_0x5ecaa0(0xa9));const _0x2a6db6=getTemplateDir();await copyDirectory(_0x2a6db6,_0x25d125),console[_0x5ecaa0(0x8a)](_0x5ecaa0(0x95)),await updatePackageJsonName(_0x20649c),console[_0x5ecaa0(0x8a)](_0x5ecaa0(0x98)),console['log']('\x20\x20Installing\x20dependencies...'),console[_0x5ecaa0(0x8a)](_0x5ecaa0(0x85)),await formatCode(_0x25d125),console['log'](_0x5ecaa0(0xa7)),await configureProject(_0x20649c,_0x3508e9,_0x5d2c67),console[_0x5ecaa0(0x8a)](_0x5ecaa0(0x72)),_0x3508e9&&await pullApiConfig(_0x25d125,_0x3508e9,_0x5d2c67,_0x1a4823),console[_0x5ecaa0(0x8a)](_0x5ecaa0(0x87)+_0x20649c+_0x5ecaa0(0x8f)),console['log'](_0x5ecaa0(0x73)+_0x20649c),console['log'](_0x5ecaa0(0x75));}catch(_0x3a6d7c){try{existsSync(_0x25d125)&&await a97_0xf4b8cd['rm'](_0x25d125,{'recursive':!![],'force':!![]});}catch{}throw _0x3a6d7c;}}async function updatePackageJsonName(_0x59ef2c){const _0x141f32=a97_0x155c,_0xfdcdb4=a97_0x2e5433['resolve'](process[_0x141f32(0xac)](),_0x59ef2c),_0x37d965=a97_0x2e5433['join'](_0xfdcdb4,_0x141f32(0x96)),_0x33758e=await a97_0xf4b8cd[_0x141f32(0x7f)](_0x37d965,_0x141f32(0x9b)),_0x286cbf=JSON['parse'](_0x33758e);_0x286cbf[_0x141f32(0xab)]=_0x59ef2c,_0x286cbf['description']=_0x141f32(0xa2),await a97_0xf4b8cd[_0x141f32(0x91)](_0x37d965,JSON[_0x141f32(0xa5)](_0x286cbf,null,0x2)+'\x0a');}function detectPackageManager(){const _0x57daa1=a97_0x155c;try{return execSync('bun\x20--version',{'stdio':_0x57daa1(0x78)}),_0x57daa1(0x90);}catch{return _0x57daa1(0x77);}}async function formatCode(_0x5f008f){try{await execAsync('bun\x20run\x20format',{'cwd':_0x5f008f});}catch{}}async function configureProject(_0x59dd7b,_0x259cb4,_0x79884b){const _0x15586d=a97_0x155c,_0x2d69a1=a97_0x2e5433[_0x15586d(0xa1)](process[_0x15586d(0xac)](),_0x59dd7b),_0x13c14d=a97_0x2e5433[_0x15586d(0x88)](_0x2d69a1,NEW_CONFIG_NAME),_0x46bc2b=readConfig(),_0x2b58b8=typeof _0x46bc2b[_0x15586d(0x74)]===_0x15586d(0x71)?_0x46bc2b[_0x15586d(0x74)]:undefined,{app:_0x439b3d,appcode:_0x7c449e,..._0x319ed5}=_0x46bc2b,_0x4e2c83={..._0x319ed5,'appcode':_0x259cb4||'','env':_0x79884b||_0x2b58b8||_0x15586d(0x83),'createdAt':new Date()[_0x15586d(0x9c)](),'version':getCliVersion()};writeConfigFile(_0x13c14d,_0x4e2c83);}function a97_0x5b00(){const _0x2b633a=['1370674riZFqd','utf-8','toLocaleString','23101SlaMtw','\x20model(s)','4917SRsurQ','chdir','resolve','A\x20project\x20created\x20with\x20Lovrabet\x20CLI','length','W_OK','stringify','Check\x20directory\x20permissions.','\x20\x20√\x20Code\x20formatted','1764HRnNqd','...','validation','name','cwd','Project\x20name\x20is\x20too\x20long,\x20maximum\x20100\x20characters.','string','\x20\x20√\x20Configuration\x20file\x20created','\x0a\x20\x20cd\x20','env','\x20\x20rabetbase\x20run\x20start\x0a','3922317wjOZjQ','npm','ignore','trim','test','needsUpgrade','6ibNsAv','774QwsBWl','Use\x20a\x20different\x20project\x20name.','readFile','Project\x20name\x20contains\x20invalid\x20characters.','../../templates/projects/sub-app-react-demo','19064qDaFSF','production','3027egvNuV','\x20\x20√\x20Dependency\x20install\x20skipped\x20(non-interactive)','5688qJMZOC','\x0a√\x20Project\x20','join','modelCount','log','\x20\x20Pulling\x20API\x20configuration...','dirname','\x22\x20already\x20exists.','\x20\x20√\x20Pulled\x20','\x20created\x20successfully!','bun','writeFile','1CpNawC','1893110sVXVyy','access','\x20\x20√\x20Project\x20template\x20created','package.json','Cannot\x20create\x20project\x20in\x20current\x20directory.','\x20\x20√\x20package.json\x20updated','5420KYXicX'];a97_0x5b00=function(){return _0x2b633a;};return a97_0x5b00();}async function pullApiConfig(_0x39e03b,_0x2397c8,_0x258f72,_0x489a93){const _0x618221=a97_0x155c,_0x455d27=process[_0x618221(0xac)]();try{process[_0x618221(0xa0)](_0x39e03b);const _0x171396=_0x258f72||'production';initEnv(_0x171396),console['log'](_0x618221(0x8b));const {configArray:_0x42035f}=await fetchModelList(_0x2397c8,_0x489a93||''),_0x296914=await generateApiFile(_0x42035f,'',_0x2397c8,!![],_0x171396,'./src/api/');console[_0x618221(0x8a)](_0x618221(0x8e)+_0x42035f[_0x618221(0xa3)]+'\x20dataset(s),\x20generated\x20'+_0x296914[_0x618221(0x89)]+_0x618221(0x9e));}catch(_0x4bd798){console[_0x618221(0x8a)]('\x20\x20!\x20API\x20pull\x20failed,\x20run\x20`'+CLI_BIN_NAME+'\x20api\x20pull`\x20manually\x20later.');}finally{process['chdir'](_0x455d27);}}
|