@lovrabet/rabetbase-cli 2.1.3-beta.0 → 2.1.5
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/login-success-html.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/generate.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/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.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/create.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/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.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/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.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/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.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/schema.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.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/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.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/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.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-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.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/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/apply-jq-filter.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/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.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/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/templates/skill/SKILL.md.tpl +1 -1
package/lib/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a124_0x20e439=a124_0x33fe;(function(_0x59cb5e,_0x1c5f79){const _0x49bad7=a124_0x33fe,_0x13f666=_0x59cb5e();while(!![]){try{const _0x113efe=parseInt(_0x49bad7(0x101))/0x1+parseInt(_0x49bad7(0x10b))/0x2*(-parseInt(_0x49bad7(0x127))/0x3)+-parseInt(_0x49bad7(0x123))/0x4+parseInt(_0x49bad7(0x10c))/0x5+parseInt(_0x49bad7(0x136))/0x6*(parseInt(_0x49bad7(0x124))/0x7)+parseInt(_0x49bad7(0x10f))/0x8*(parseInt(_0x49bad7(0x14a))/0x9)+-parseInt(_0x49bad7(0x132))/0xa*(parseInt(_0x49bad7(0x142))/0xb);if(_0x113efe===_0x1c5f79)break;else _0x13f666['push'](_0x13f666['shift']());}catch(_0x10b999){_0x13f666['push'](_0x13f666['shift']());}}}(a124_0x11ed,0x6e945));import{readFileSync,writeFileSync,existsSync,mkdirSync,renameSync,unlinkSync}from'node:fs';import{resolve,dirname,parse}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';import{CLI_BIN_NAME}from'./constant/cli.js';import{DEFAULT_CONFIG_VALUES}from'./constant/defaults.js';import{normalizeEnv,isDaily}from'./constant/env.js';import{normalizeLegacyOutputFormat}from'./framework/types.js';function env(_0x3372f8){return process.env[`RABETBASE_${_0x3372f8}`]||process.env[`LOVRABET_${_0x3372f8}`]||undefined;}export const NEW_CONFIG_NAME='.rabetbase.json';export const CONFIG_NAMES=['.rabetbase.json',a124_0x20e439(0x130),a124_0x20e439(0x10d)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a124_0x20e439(0x119)](_0x33fe66=>_0x33fe66!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x22a43d){for(const _0x2b6c8f of CONFIG_NAMES){const _0x4cd68e=resolve(_0x22a43d,_0x2b6c8f);if(existsSync(_0x4cd68e))return _0x4cd68e;}return undefined;}export function findProjectRootDirectory(_0x56faf3=process[a124_0x20e439(0x105)]()){let _0x26a40d=resolve(_0x56faf3);const {root:_0x50c23a}=parse(_0x26a40d),_0x3a989f=homedir();while(!![]){if(resolveConfigPath(_0x26a40d)){if(_0x26a40d===_0x3a989f)break;return _0x26a40d;}if(_0x26a40d===_0x50c23a||_0x26a40d===_0x3a989f)break;const _0x4aec17=dirname(_0x26a40d);if(_0x4aec17===_0x26a40d)break;_0x26a40d=_0x4aec17;}return resolve(_0x56faf3);}export async function createContext(_0x1770eb){const _0x4411ef=a124_0x20e439,_0x44dad4=readRawConfig(),_0xa2ca00=buildConfig(_0x44dad4,_0x1770eb),{initEnv:_0x11939d}=await import('./constant/env.js');if(_0xa2ca00[_0x4411ef(0xf3)])_0x11939d(_0xa2ca00[_0x4411ef(0xf3)]);else _0x1770eb[_0x4411ef(0xf3)]&&typeof _0x1770eb[_0x4411ef(0xf3)]===_0x4411ef(0x13a)&&_0x11939d(_0x1770eb[_0x4411ef(0xf3)]);const {initDomains:_0x3746cc,getUserDomain:_0x20d802,getApiDomain:_0x22273c}=await import(_0x4411ef(0x12b));_0x3746cc({'apiDomain':_0x44dad4[_0x4411ef(0x118)]||undefined,'userDomain':_0x44dad4[_0x4411ef(0x13f)]||undefined,'runtimeDomain':_0x44dad4[_0x4411ef(0x114)]||undefined});const _0x18cce4={'apiDomain':_0x22273c(),'userDomain':_0x20d802()},_0x22ab5e=await buildAuth(_0xa2ca00);logger[_0x4411ef(0x146)](process['cwd']());const _0xbb01df=(CLI_BIN_NAME+'\x20'+process['argv'][_0x4411ef(0x13b)](0x2)[_0x4411ef(0x12d)]('\x20'))['trim']();logger[_0x4411ef(0xf4)](_0xbb01df);const {isNonInteractive:_0x1a3a92}=await import(_0x4411ef(0x13c)),_0x3cdd1a=_0x1a3a92(_0x1770eb);return{'config':_0xa2ca00,'auth':_0x22ab5e,'logger':logger,'env':_0x18cce4,'nonInteractive':_0x3cdd1a};}export function buildConfigFromFlags(_0x167515){return buildConfig(readRawConfig(),_0x167515);}function a124_0x33fe(_0x3a9648,_0x32cce6){_0x3a9648=_0x3a9648-0xf3;const _0x11ed14=a124_0x11ed();let _0x33feb3=_0x11ed14[_0x3a9648];return _0x33feb3;}export function getProjectConfigPath(){const _0x31b86b=a124_0x20e439;return resolveConfigPath(process[_0x31b86b(0x105)]());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0x21f04b){const _0xb4050a=a124_0x20e439;if(!existsSync(_0x21f04b))return{'status':_0xb4050a(0x106)};try{const _0x33e1ba=readFileSync(_0x21f04b,{'encoding':_0xb4050a(0xf8)});if(!_0x33e1ba?.[_0xb4050a(0x11f)]())return{'status':_0xb4050a(0x138)};const _0x1f5ed4=JSON[_0xb4050a(0xfc)](_0x33e1ba);return{'status':'ok','data':_0x1f5ed4};}catch(_0x28b576){return{'status':_0xb4050a(0xf7),'message':_0x28b576 instanceof Error?_0x28b576[_0xb4050a(0x143)]:String(_0x28b576)};}}function parseCliConfigJsonFile(_0x115c2f,_0xcb1cdc,_0x2fc6a){const _0xe1da11=a124_0x20e439,_0x3c0984=inspectCliConfigJsonFile(_0x115c2f);if(_0x3c0984[_0xe1da11(0x145)]==='missing'||_0x3c0984[_0xe1da11(0x145)]===_0xe1da11(0x138))return{};if(_0x3c0984[_0xe1da11(0x145)]==='ok')return _0x3c0984[_0xe1da11(0x111)];return _0xcb1cdc==='warn'&&_0x2fc6a&&console[_0xe1da11(0xf7)](CLI_BIN_NAME+':\x20'+_0x2fc6a+_0xe1da11(0x133)+_0x115c2f+_0xe1da11(0x129)+_0x3c0984['message']),{};}const normalizedWriteCache=new Map();function normalizeLegacyConfigShape(_0x5db0a8){const _0x2ceedc=a124_0x20e439;if(!_0x5db0a8||typeof _0x5db0a8!==_0x2ceedc(0x10a))return{'config':{},'migrated':![]};const _0x180638={..._0x5db0a8},_0x18510c=_0x180638[_0x2ceedc(0xfd)]&&typeof _0x180638[_0x2ceedc(0xfd)]==='object'?{..._0x180638['apps']}:{},_0x1ab84d=Object['keys'](_0x18510c)['length'],_0x5aad36=_0x180638['appcode']||_0x180638[_0x2ceedc(0x11c)];let _0x492801=![];if(_0x5aad36&&_0x1ab84d===0x0){const _0x194b73=typeof _0x180638[_0x2ceedc(0x13e)]==='string'&&_0x180638['defaultApp'][_0x2ceedc(0x11f)]()?_0x180638[_0x2ceedc(0x13e)]:String(_0x5aad36)[_0x2ceedc(0x11f)]();_0x18510c[_0x194b73]={'appcode':String(_0x5aad36)['trim'](),..._0x180638[_0x2ceedc(0xf3)]!=null?{'env':_0x180638[_0x2ceedc(0xf3)]}:{},..._0x180638[_0x2ceedc(0x11e)]!=null?{'apiDir':_0x180638[_0x2ceedc(0x11e)]}:{},..._0x180638[_0x2ceedc(0xfb)]!=null?{'cookie':_0x180638[_0x2ceedc(0xfb)]}:{},..._0x180638[_0x2ceedc(0x104)]!=null?{'accessKey':_0x180638['accessKey']}:{},..._0x180638[_0x2ceedc(0x149)]!=null?{'format':_0x180638[_0x2ceedc(0x149)]}:{},..._0x180638['pageSize']!=null?{'pageSize':_0x180638['pageSize']}:{},..._0x180638['riskLevel']!=null?{'riskLevel':_0x180638['riskLevel']}:{},..._0x180638[_0x2ceedc(0x148)]!=null?{'locale':_0x180638[_0x2ceedc(0x148)]}:{}},_0x180638['apps']=_0x18510c;if(!_0x180638[_0x2ceedc(0x13e)])_0x180638[_0x2ceedc(0x13e)]=_0x194b73;_0x492801=!![];}return(_0x2ceedc(0xf5)in _0x180638||'app'in _0x180638)&&(delete _0x180638[_0x2ceedc(0xf5)],delete _0x180638[_0x2ceedc(0x11c)],_0x492801=!![]),{'config':_0x180638,'migrated':_0x492801};}function writeNormalizedConfigIfNeeded(_0x14c1dc,_0x2413eb){const _0x51ef89=a124_0x20e439,_0x3ebd31=JSON[_0x51ef89(0x116)](_0x2413eb,null,0x2)+'\x0a';if(normalizedWriteCache[_0x51ef89(0x117)](_0x14c1dc)===_0x3ebd31)return;writeConfigFile(_0x14c1dc,_0x2413eb),normalizedWriteCache[_0x51ef89(0x120)](_0x14c1dc,_0x3ebd31);}function parseAndNormalizeConfig(_0x55bb31,_0xd0bbe6,_0x598ade){const _0x20b0db=a124_0x20e439,_0x52cdba=parseCliConfigJsonFile(_0x55bb31,_0xd0bbe6,_0x598ade),_0x4002db=normalizeLegacyConfigShape(_0x52cdba);if(_0x4002db[_0x20b0db(0x113)])try{writeNormalizedConfigIfNeeded(_0x55bb31,_0x4002db[_0x20b0db(0x128)]);}catch{}return _0x4002db['config'];}export function loadRawConfigLayers(_0x200f26){const _0x417712=a124_0x20e439;let _0x26c460={},_0x25c720={};const _0x475b32=resolveConfigPath(homedir());_0x475b32&&(_0x26c460=parseAndNormalizeConfig(_0x475b32,_0x417712(0x10e),_0x417712(0x108)));const _0x45b774=_0x200f26??findProjectRootDirectory(),_0x4855fa=resolveConfigPath(_0x45b774);return _0x4855fa&&(_0x25c720=parseAndNormalizeConfig(_0x4855fa,_0x417712(0x10e),'Project')),{'globalPath':_0x475b32,'projectPath':_0x4855fa,'globalConfig':_0x26c460,'projectConfig':_0x25c720};}function mergeRawConfigLayers(_0x4f9f71){const _0x43afd5=a124_0x20e439,{globalConfig:_0x4174ee,projectConfig:_0x44fd99}=_0x4f9f71;if(_0x44fd99[_0x43afd5(0x135)]===![]){const _0x47b2f9={..._0x44fd99};delete _0x47b2f9[_0x43afd5(0x135)];const _0x38ba4e=_0x44fd99[_0x43afd5(0xfd)]&&typeof _0x44fd99[_0x43afd5(0xfd)]===_0x43afd5(0x10a)?_0x44fd99[_0x43afd5(0xfd)]:{};Object[_0x43afd5(0xff)](_0x38ba4e)[_0x43afd5(0x115)]>0x0?_0x47b2f9['apps']=_0x38ba4e:delete _0x47b2f9['apps'];if('defaultApp'in _0x44fd99)_0x47b2f9[_0x43afd5(0x13e)]=_0x44fd99[_0x43afd5(0x13e)];else Object[_0x43afd5(0xff)](_0x38ba4e)[_0x43afd5(0x115)]>0x0&&(_0x47b2f9[_0x43afd5(0x13e)]=Object[_0x43afd5(0xff)](_0x38ba4e)[0x0]);return _0x47b2f9;}const _0x1b8a13=_0x4174ee['apps']&&typeof _0x4174ee[_0x43afd5(0xfd)]===_0x43afd5(0x10a)?_0x4174ee['apps']:{},_0x3ffbe3=_0x44fd99[_0x43afd5(0xfd)]&&typeof _0x44fd99[_0x43afd5(0xfd)]===_0x43afd5(0x10a)?_0x44fd99[_0x43afd5(0xfd)]:{},_0x154c30={..._0x1b8a13,..._0x3ffbe3},_0x519f16={..._0x4174ee,..._0x44fd99};Object[_0x43afd5(0xff)](_0x154c30)[_0x43afd5(0x115)]>0x0&&(_0x519f16[_0x43afd5(0xfd)]=_0x154c30);if(_0x43afd5(0x13e)in _0x44fd99)_0x519f16[_0x43afd5(0x13e)]=_0x44fd99[_0x43afd5(0x13e)];else{if(_0x3ffbe3&&Object[_0x43afd5(0xff)](_0x3ffbe3)[_0x43afd5(0x115)]>0x0)_0x519f16['defaultApp']=Object[_0x43afd5(0xff)](_0x3ffbe3)[0x0];else{if(_0x4174ee[_0x43afd5(0x13e)])_0x519f16['defaultApp']=_0x4174ee[_0x43afd5(0x13e)];else{const _0x3df143=Object[_0x43afd5(0xff)](_0x1b8a13);_0x3df143[_0x43afd5(0x115)]>0x0&&(_0x519f16[_0x43afd5(0x13e)]=_0x3df143[0x0]);}}}return _0x519f16;}export function readRawConfigWithLayers(_0x24d396){const _0x469449=loadRawConfigLayers(_0x24d396);return{'config':mergeRawConfigLayers(_0x469449),'layers':_0x469449};}export function readRawConfig(_0x421e2a){return mergeRawConfigLayers(loadRawConfigLayers(_0x421e2a));}export function getConfigAppCode(_0x2c5b1a){const _0x25ffad=a124_0x20e439,_0x278b3e=readRawConfig(_0x2c5b1a);if(_0x278b3e['apps']&&typeof _0x278b3e['apps']==='object'){const _0x313571=_0x278b3e['defaultApp'];if(_0x313571&&_0x278b3e[_0x25ffad(0xfd)][_0x313571]?.[_0x25ffad(0xf5)])return String(_0x278b3e['apps'][_0x313571][_0x25ffad(0xf5)])[_0x25ffad(0x11f)]();const _0x1a28e8=Object[_0x25ffad(0x11d)](_0x278b3e[_0x25ffad(0xfd)])[0x0];if(_0x1a28e8?.[_0x25ffad(0xf5)])return String(_0x1a28e8['appcode'])[_0x25ffad(0x11f)]();}const _0x89091a=_0x278b3e[_0x25ffad(0xf5)]||_0x278b3e[_0x25ffad(0x11c)];if(typeof _0x89091a!=='string'||_0x89091a[_0x25ffad(0x11f)]()==='')return undefined;return _0x89091a[_0x25ffad(0x11f)]();}export function getMultiAppConfigs(_0x5ecb49='project',_0xb5979d){const _0x28fff0=a124_0x20e439,_0x126bcf=_0x5ecb49===_0x28fff0(0x112)?readRawConfig(_0xb5979d):loadRawConfigLayers(_0xb5979d)[_0x28fff0(0x14b)],_0x4a9f93=_0x126bcf['apps'];if(!_0x4a9f93||typeof _0x4a9f93!==_0x28fff0(0x10a)||Object[_0x28fff0(0xff)](_0x4a9f93)[_0x28fff0(0x115)]===0x0)return null;const _0x3e7b59=_0x126bcf[_0x28fff0(0x13e)];return Object[_0x28fff0(0x126)](_0x4a9f93)[_0x28fff0(0x139)](([_0x51536f,_0x47ce70])=>({'name':_0x51536f,'appcode':_0x47ce70?.['appcode']||'','isDefault':_0x51536f===_0x3e7b59,'env':_0x47ce70?.[_0x28fff0(0xf3)],'apiDir':_0x47ce70?.[_0x28fff0(0x11e)],'cookie':_0x47ce70?.['cookie']||undefined}))[_0x28fff0(0x119)](_0x1db5a=>_0x1db5a[_0x28fff0(0xf5)]);}export function getTemplateBaseUrl(_0x3dac93){const _0x39f7b6=a124_0x20e439,_0x5c6f42=readRawConfig(_0x3dac93);if(_0x5c6f42[_0x39f7b6(0x12f)]&&typeof _0x5c6f42[_0x39f7b6(0x12f)]===_0x39f7b6(0x13a))return _0x5c6f42[_0x39f7b6(0x12f)][_0x39f7b6(0x122)](/\/$/,'');return _0x39f7b6(0x12a);}export function readConfigFile(_0x2dd69d){const _0x1cecba=a124_0x20e439;return parseAndNormalizeConfig(_0x2dd69d,_0x1cecba(0x125));}function a124_0x11ed(){const _0x2b6e03=['map','string','slice','./utils/is-non-interactive.js','.tmp','defaultApp','userDomain','maxRisk','api.ts','56738RkNAoq','message','VERBOSE','status','setLogPath','read','locale','format','54VObAys','projectConfig','env','setRawCommand','appcode','find','error','utf8','ENV','COOKIE','cookie','parse','apps','pageSize','keys','./auth/get-cookie.js','813685buwrGi','riskLevel','daily','accessKey','cwd','missing','MAX_RISK','Global','write','object','119638LItIXE','3427330ZoyOhe','.lovrabetrc','warn','800224PToHUh','FORMAT','data','merged','migrated','runtimeDomain','length','stringify','get','apiDomain','filter','RISK_LEVEL','APPCODE','app','values','apiDir','trim','set','production','replace','2220996kwKygS','1477sxFLue','silent','entries','12SnmmGN','config','\x0a\x20\x20','https://g.lovrabet.com/dist/lovrabet-skill','./constant/domain.js','true','join','project','template_base_url','.lovrabet.json','APP','2430vyVubj','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','-api.ts','inherit','11418aKzecd','ACCESS_KEY','empty'];a124_0x11ed=function(){return _0x2b6e03;};return a124_0x11ed();}export function writeConfigFile(_0x39c2da,_0x4b62ac){const _0x4a6aa2=a124_0x20e439,_0xce5700=dirname(_0x39c2da);!existsSync(_0xce5700)&&mkdirSync(_0xce5700,{'recursive':!![]});const _0x5cd6a9=_0x39c2da+_0x4a6aa2(0x13d);try{writeFileSync(_0x5cd6a9,JSON[_0x4a6aa2(0x116)](_0x4b62ac,null,0x2)+'\x0a',{'encoding':_0x4a6aa2(0xf8),'mode':0x180}),renameSync(_0x5cd6a9,_0x39c2da);}catch(_0x3b2c8e){try{unlinkSync(_0x5cd6a9);}catch{}throw _0x3b2c8e;}}export function resolveWriteConfigPath(_0x5359d8){const _0x329254=a124_0x20e439,_0x4e43a5=_0x5359d8===_0x329254(0x12e)?process[_0x329254(0x105)]():homedir(),_0x2a1f47=resolveConfigPath(_0x4e43a5);return _0x2a1f47??resolve(_0x4e43a5,NEW_CONFIG_NAME);}function buildConfig(_0x571492,_0x40b0c1){const _0x4fdff2=a124_0x20e439,_0x56257f={};if(_0x571492[_0x4fdff2(0xfd)]&&typeof _0x571492[_0x4fdff2(0xfd)]==='object')for(const [_0x2731bb,_0x272fce]of Object[_0x4fdff2(0x126)](_0x571492[_0x4fdff2(0xfd)])){_0x272fce&&typeof _0x272fce==='object'&&_0x272fce[_0x4fdff2(0xf5)]&&(_0x56257f[_0x2731bb]=_0x272fce);}const _0x536891=_0x571492[_0x4fdff2(0x13e)]||undefined,_0x4ade27=Object[_0x4fdff2(0xff)](_0x56257f)[_0x4fdff2(0x115)]>0x0,_0x3e3990=_0x40b0c1[_0x4fdff2(0x11c)]||env(_0x4fdff2(0x131))||undefined,_0x3ad0e3=_0x3e3990||_0x536891||undefined,_0xcfb74d=_0x40b0c1[_0x4fdff2(0xf5)]||env(_0x4fdff2(0x11b))||undefined,_0x365fc8=_0xcfb74d?Object['entries'](_0x56257f)[_0x4fdff2(0xf6)](([,_0x106fbb])=>_0x106fbb?.[_0x4fdff2(0xf5)]===_0xcfb74d):undefined,_0x10b12d=_0x365fc8?.[0x0],_0x46a99c=_0x365fc8?.[0x1];let _0x2172c1=_0xcfb74d?_0x10b12d:_0x3ad0e3,_0x5dd847=_0x2172c1&&_0x56257f[_0x2172c1]?_0x56257f[_0x2172c1]:undefined;_0xcfb74d&&_0x46a99c&&(_0x5dd847=_0x46a99c);const _0x59adeb=_0xcfb74d?_0x46a99c??_0x5dd847:_0x5dd847,_0x36a761=_0x3e3990||(_0xcfb74d?_0x10b12d:undefined),_0x585c95=_0xcfb74d||_0x59adeb?.[_0x4fdff2(0xf5)]||undefined,_0x41ed4d=_0x40b0c1[_0x4fdff2(0xf3)]||env(_0x4fdff2(0xf9))||_0x59adeb?.[_0x4fdff2(0xf3)]||_0x571492['env']||DEFAULT_CONFIG_VALUES['env'],_0x432447=_0x59adeb?.[_0x4fdff2(0x148)]||_0x571492['locale']||DEFAULT_CONFIG_VALUES[_0x4fdff2(0x148)],_0x38117b=env(_0x4fdff2(0xfa))||_0x59adeb?.[_0x4fdff2(0xfb)]||_0x571492[_0x4fdff2(0xfb)]||undefined,_0x11f15a=env(_0x4fdff2(0x137))||_0x59adeb?.['accessKey']||_0x571492[_0x4fdff2(0x104)]||undefined,_0x1b8fcf=_0x40b0c1[_0x4fdff2(0x149)]||env(_0x4fdff2(0x110))||_0x59adeb?.['format']||_0x571492[_0x4fdff2(0x149)],_0x3c71ef=normalizeLegacyOutputFormat(_0x1b8fcf),_0xb62c40=env('PAGE_SIZE')||_0x59adeb?.[_0x4fdff2(0xfe)]||_0x571492['pageSize'],_0x287f0e=_0xb62c40?Number(_0xb62c40)||undefined:undefined,_0x9ef451=env(_0x4fdff2(0x11a))||env(_0x4fdff2(0x107))||_0x59adeb?.[_0x4fdff2(0x102)]||_0x571492[_0x4fdff2(0x102)]||_0x571492[_0x4fdff2(0x140)],_0x428b7f=_0x9ef451===_0x4fdff2(0x147)||_0x9ef451===_0x4fdff2(0x109)?_0x9ef451:DEFAULT_CONFIG_VALUES[_0x4fdff2(0x102)],_0x11705c=env(_0x4fdff2(0x144)),_0x5af883=_0x11705c==='1'||_0x11705c===_0x4fdff2(0x12c),_0x446384=_0x59adeb?.[_0x4fdff2(0x11e)]||_0x571492['apiDir']||DEFAULT_CONFIG_VALUES['apiDir'],_0x140a9f=isDaily(normalizeEnv(String(_0x41ed4d)))?_0x4fdff2(0x103):_0x4fdff2(0x121);return{'appCode':typeof _0x585c95===_0x4fdff2(0x13a)&&_0x585c95[_0x4fdff2(0x11f)]()?_0x585c95[_0x4fdff2(0x11f)]():undefined,'env':_0x140a9f,'locale':_0x432447,'cookie':_0x38117b,'accessKey':_0x11f15a,'format':_0x3c71ef,'pageSize':_0x287f0e,'riskLevel':_0x428b7f,'verbose':_0x5af883,'apiDir':_0x446384,'apps':_0x56257f,'defaultApp':_0x536891,'currentApp':_0x4ade27?_0x2172c1:undefined,'explicitAppName':_0x36a761,'raw':_0x571492};}async function buildAuth(_0x458c78){const _0x54fda9=a124_0x20e439,{getCookie:_0x36cd03}=await import(_0x54fda9(0x100)),_0x459cb9=_0x458c78[_0x54fda9(0xfb)]||_0x36cd03(),_0x4f9dd3=_0x459cb9?await getIsSessionValid():![];return{'cookie':_0x459cb9,'isLoggedIn':_0x4f9dd3,async 'getOrLogin'(){if(_0x459cb9&&_0x4f9dd3)return _0x459cb9;throw CliErrors['authRequired']();}};}export function resolveApiFilePath(_0x2acd1a,_0x126644){const _0x27b5a9=a124_0x20e439,_0x52dfb5=resolve(process[_0x27b5a9(0x105)](),_0x2acd1a),_0x3278c7=resolve(_0x52dfb5,_0x27b5a9(0x141));if(!_0x126644)return _0x3278c7;const _0x2de04f=readRawConfig(),_0xd00626=_0x2de04f[_0x27b5a9(0xfd)]&&typeof _0x2de04f[_0x27b5a9(0xfd)]==='object'?_0x2de04f[_0x27b5a9(0xfd)]:{},_0x48bf17=Object[_0x27b5a9(0x126)](_0xd00626)[_0x27b5a9(0xf6)](([,_0x607426])=>_0x607426?.[_0x27b5a9(0xf5)]===_0x126644);if(!_0x48bf17)return _0x3278c7;const [_0x51c198,_0x53b8f9]=_0x48bf17,_0x182536=typeof _0x2de04f[_0x27b5a9(0x13e)]===_0x27b5a9(0x13a)?_0x2de04f[_0x27b5a9(0x13e)]:undefined;if(_0x53b8f9?.[_0x27b5a9(0x11e)])return _0x3278c7;if(_0x182536&&_0x51c198!==_0x182536)return resolve(_0x52dfb5,_0x51c198+_0x27b5a9(0x134));return _0x3278c7;}
|
|
1
|
+
const a124_0x8149bd=a124_0x5771;(function(_0x1ab011,_0x4321b0){const _0x2ab26c=a124_0x5771,_0x2f7851=_0x1ab011();while(!![]){try{const _0x255930=parseInt(_0x2ab26c(0x179))/0x1+parseInt(_0x2ab26c(0x181))/0x2+-parseInt(_0x2ab26c(0x180))/0x3+parseInt(_0x2ab26c(0x14c))/0x4*(-parseInt(_0x2ab26c(0x170))/0x5)+-parseInt(_0x2ab26c(0x187))/0x6*(-parseInt(_0x2ab26c(0x162))/0x7)+parseInt(_0x2ab26c(0x158))/0x8*(-parseInt(_0x2ab26c(0x185))/0x9)+-parseInt(_0x2ab26c(0x176))/0xa*(parseInt(_0x2ab26c(0x172))/0xb);if(_0x255930===_0x4321b0)break;else _0x2f7851['push'](_0x2f7851['shift']());}catch(_0xe25f49){_0x2f7851['push'](_0x2f7851['shift']());}}}(a124_0x4671,0xd7405));import{readFileSync,writeFileSync,existsSync,mkdirSync,renameSync,unlinkSync}from'node:fs';import{resolve,dirname,parse}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';import{CLI_BIN_NAME}from'./constant/cli.js';import{DEFAULT_CONFIG_VALUES}from'./constant/defaults.js';import{normalizeEnv,isDaily}from'./constant/env.js';import{normalizeLegacyOutputFormat}from'./framework/types.js';function env(_0x3bbebc){return process.env[`RABETBASE_${_0x3bbebc}`]||process.env[`LOVRABET_${_0x3bbebc}`]||undefined;}export const NEW_CONFIG_NAME=a124_0x8149bd(0x153);export const CONFIG_NAMES=[a124_0x8149bd(0x153),a124_0x8149bd(0x148),a124_0x8149bd(0x145)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a124_0x8149bd(0x18d)](_0xd85255=>_0xd85255!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x2bbca2){for(const _0x3d38fd of CONFIG_NAMES){const _0xb51b17=resolve(_0x2bbca2,_0x3d38fd);if(existsSync(_0xb51b17))return _0xb51b17;}return undefined;}export function findProjectRootDirectory(_0x4e6d0d=process['cwd']()){let _0x197f1e=resolve(_0x4e6d0d);const {root:_0xe1a0e0}=parse(_0x197f1e),_0x10626c=homedir();while(!![]){if(resolveConfigPath(_0x197f1e)){if(_0x197f1e===_0x10626c)break;return _0x197f1e;}if(_0x197f1e===_0xe1a0e0||_0x197f1e===_0x10626c)break;const _0x1ada01=dirname(_0x197f1e);if(_0x1ada01===_0x197f1e)break;_0x197f1e=_0x1ada01;}return resolve(_0x4e6d0d);}export async function createContext(_0x319286){const _0xe62bb9=a124_0x8149bd,_0x3e7817=readRawConfig(),_0x1c9b1e=buildConfig(_0x3e7817,_0x319286),{initEnv:_0x4a2249}=await import(_0xe62bb9(0x14a));if(_0x1c9b1e[_0xe62bb9(0x167)])_0x4a2249(_0x1c9b1e[_0xe62bb9(0x167)]);else _0x319286[_0xe62bb9(0x167)]&&typeof _0x319286['env']===_0xe62bb9(0x14f)&&_0x4a2249(_0x319286[_0xe62bb9(0x167)]);const {initDomains:_0x572045,getUserDomain:_0x41fdcc,getApiDomain:_0x5b12b7}=await import('./constant/domain.js');_0x572045({'apiDomain':_0x3e7817['apiDomain']||undefined,'userDomain':_0x3e7817[_0xe62bb9(0x159)]||undefined,'runtimeDomain':_0x3e7817['runtimeDomain']||undefined});const _0x424f2a={'apiDomain':_0x5b12b7(),'userDomain':_0x41fdcc()},_0x49fbe9=await buildAuth(_0x1c9b1e);logger[_0xe62bb9(0x17e)](process[_0xe62bb9(0x147)]());const _0x2e46d1=(CLI_BIN_NAME+'\x20'+process[_0xe62bb9(0x189)][_0xe62bb9(0x182)](0x2)[_0xe62bb9(0x160)]('\x20'))['trim']();logger[_0xe62bb9(0x169)](_0x2e46d1);const {isNonInteractive:_0x427490}=await import(_0xe62bb9(0x16a)),_0x3a9a6f=_0x427490(_0x319286);return{'config':_0x1c9b1e,'auth':_0x49fbe9,'logger':logger,'env':_0x424f2a,'nonInteractive':_0x3a9a6f};}export function buildConfigFromFlags(_0x127aaf){return buildConfig(readRawConfig(),_0x127aaf);}export function getProjectConfigPath(){const _0x5ea8f4=a124_0x8149bd;return resolveConfigPath(process[_0x5ea8f4(0x147)]());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0x2fd0d1){const _0x47b40c=a124_0x8149bd;if(!existsSync(_0x2fd0d1))return{'status':_0x47b40c(0x175)};try{const _0xc9c8e3=readFileSync(_0x2fd0d1,{'encoding':_0x47b40c(0x143)});if(!_0xc9c8e3?.[_0x47b40c(0x16e)]())return{'status':'empty'};const _0x450c67=JSON[_0x47b40c(0x140)](_0xc9c8e3);return{'status':'ok','data':_0x450c67};}catch(_0x3ac836){return{'status':_0x47b40c(0x177),'message':_0x3ac836 instanceof Error?_0x3ac836['message']:String(_0x3ac836)};}}function parseCliConfigJsonFile(_0x333446,_0x44e073,_0x42faa0){const _0x16bea6=a124_0x8149bd,_0x1b7fa4=inspectCliConfigJsonFile(_0x333446);if(_0x1b7fa4[_0x16bea6(0x17b)]===_0x16bea6(0x175)||_0x1b7fa4['status']===_0x16bea6(0x17d))return{};if(_0x1b7fa4['status']==='ok')return _0x1b7fa4[_0x16bea6(0x15d)];return _0x44e073===_0x16bea6(0x174)&&_0x42faa0&&console[_0x16bea6(0x177)](CLI_BIN_NAME+':\x20'+_0x42faa0+_0x16bea6(0x161)+_0x333446+_0x16bea6(0x154)+_0x1b7fa4['message']),{};}const normalizedWriteCache=new Map();function normalizeLegacyConfigShape(_0x3a6b22){const _0x543e08=a124_0x8149bd;if(!_0x3a6b22||typeof _0x3a6b22!==_0x543e08(0x16f))return{'config':{},'migrated':![]};const _0x4bae16={..._0x3a6b22},_0x2df93f=_0x4bae16[_0x543e08(0x15b)]&&typeof _0x4bae16[_0x543e08(0x15b)]==='object'?{..._0x4bae16['apps']}:{},_0x405b97=Object[_0x543e08(0x163)](_0x2df93f)['length'],_0x48531e=_0x4bae16['appcode']||_0x4bae16[_0x543e08(0x155)];let _0x270325=![];if(_0x48531e&&_0x405b97===0x0){const _0x487dff=typeof _0x4bae16['defaultApp']===_0x543e08(0x14f)&&_0x4bae16[_0x543e08(0x14e)][_0x543e08(0x16e)]()?_0x4bae16[_0x543e08(0x14e)]:String(_0x48531e)[_0x543e08(0x16e)]();_0x2df93f[_0x487dff]={'appcode':String(_0x48531e)[_0x543e08(0x16e)](),..._0x4bae16['env']!=null?{'env':_0x4bae16[_0x543e08(0x167)]}:{},..._0x4bae16[_0x543e08(0x15c)]!=null?{'apiDir':_0x4bae16[_0x543e08(0x15c)]}:{},..._0x4bae16['cookie']!=null?{'cookie':_0x4bae16['cookie']}:{},..._0x4bae16[_0x543e08(0x13f)]!=null?{'accessKey':_0x4bae16[_0x543e08(0x13f)]}:{},..._0x4bae16[_0x543e08(0x17c)]!=null?{'format':_0x4bae16[_0x543e08(0x17c)]}:{},..._0x4bae16[_0x543e08(0x166)]!=null?{'pageSize':_0x4bae16[_0x543e08(0x166)]}:{},..._0x4bae16[_0x543e08(0x142)]!=null?{'riskLevel':_0x4bae16[_0x543e08(0x142)]}:{},..._0x4bae16[_0x543e08(0x16c)]!=null?{'locale':_0x4bae16[_0x543e08(0x16c)]}:{}},_0x4bae16[_0x543e08(0x15b)]=_0x2df93f;if(!_0x4bae16[_0x543e08(0x14e)])_0x4bae16['defaultApp']=_0x487dff;_0x270325=!![];}return(_0x543e08(0x173)in _0x4bae16||'app'in _0x4bae16)&&(delete _0x4bae16[_0x543e08(0x173)],delete _0x4bae16[_0x543e08(0x155)],_0x270325=!![]),{'config':_0x4bae16,'migrated':_0x270325};}function writeNormalizedConfigIfNeeded(_0x2789bb,_0xfdda17){const _0x270456=a124_0x8149bd,_0x55f903=JSON['stringify'](_0xfdda17,null,0x2)+'\x0a';if(normalizedWriteCache[_0x270456(0x184)](_0x2789bb)===_0x55f903)return;writeConfigFile(_0x2789bb,_0xfdda17),normalizedWriteCache[_0x270456(0x16d)](_0x2789bb,_0x55f903);}function a124_0x5771(_0x4deeaf,_0x6ff4f3){_0x4deeaf=_0x4deeaf-0x13e;const _0x46715d=a124_0x4671();let _0x5771d5=_0x46715d[_0x4deeaf];return _0x5771d5;}function parseAndNormalizeConfig(_0x558c94,_0x4c3070,_0x585437){const _0x235aff=a124_0x8149bd,_0x25abb9=parseCliConfigJsonFile(_0x558c94,_0x4c3070,_0x585437),_0xe655d0=normalizeLegacyConfigShape(_0x25abb9);if(_0xe655d0[_0x235aff(0x14b)])try{writeNormalizedConfigIfNeeded(_0x558c94,_0xe655d0[_0x235aff(0x18a)]);}catch{}return _0xe655d0[_0x235aff(0x18a)];}export function loadRawConfigLayers(_0x40ada2){const _0x26a56e=a124_0x8149bd;let _0x4dec7e={},_0x45ab0e={};const _0x32601e=resolveConfigPath(homedir());_0x32601e&&(_0x4dec7e=parseAndNormalizeConfig(_0x32601e,_0x26a56e(0x174),_0x26a56e(0x168)));const _0x144b9c=_0x40ada2??findProjectRootDirectory(),_0x1099b3=resolveConfigPath(_0x144b9c);return _0x1099b3&&(_0x45ab0e=parseAndNormalizeConfig(_0x1099b3,_0x26a56e(0x174),'Project')),{'globalPath':_0x32601e,'projectPath':_0x1099b3,'globalConfig':_0x4dec7e,'projectConfig':_0x45ab0e};}function mergeRawConfigLayers(_0x5c6f80){const _0x50997c=a124_0x8149bd,{globalConfig:_0x3d647b,projectConfig:_0x5be483}=_0x5c6f80;if(_0x5be483[_0x50997c(0x183)]===![]){const _0x450826={..._0x5be483};delete _0x450826[_0x50997c(0x183)];const _0x4f82eb=_0x5be483['apps']&&typeof _0x5be483['apps']==='object'?_0x5be483[_0x50997c(0x15b)]:{};Object['keys'](_0x4f82eb)[_0x50997c(0x18b)]>0x0?_0x450826[_0x50997c(0x15b)]=_0x4f82eb:delete _0x450826[_0x50997c(0x15b)];if('defaultApp'in _0x5be483)_0x450826[_0x50997c(0x14e)]=_0x5be483[_0x50997c(0x14e)];else Object['keys'](_0x4f82eb)[_0x50997c(0x18b)]>0x0&&(_0x450826[_0x50997c(0x14e)]=Object[_0x50997c(0x163)](_0x4f82eb)[0x0]);return _0x450826;}const _0x5ed153=_0x3d647b[_0x50997c(0x15b)]&&typeof _0x3d647b['apps']==='object'?_0x3d647b[_0x50997c(0x15b)]:{},_0x18c73c=_0x5be483[_0x50997c(0x15b)]&&typeof _0x5be483[_0x50997c(0x15b)]===_0x50997c(0x16f)?_0x5be483['apps']:{},_0x30c0a2={..._0x5ed153,..._0x18c73c},_0x16f46f={..._0x3d647b,..._0x5be483};Object[_0x50997c(0x163)](_0x30c0a2)['length']>0x0&&(_0x16f46f[_0x50997c(0x15b)]=_0x30c0a2);if('defaultApp'in _0x5be483)_0x16f46f[_0x50997c(0x14e)]=_0x5be483[_0x50997c(0x14e)];else{if(_0x18c73c&&Object[_0x50997c(0x163)](_0x18c73c)[_0x50997c(0x18b)]>0x0)_0x16f46f['defaultApp']=Object['keys'](_0x18c73c)[0x0];else{if(_0x3d647b['defaultApp'])_0x16f46f[_0x50997c(0x14e)]=_0x3d647b[_0x50997c(0x14e)];else{const _0xaaa397=Object['keys'](_0x5ed153);_0xaaa397['length']>0x0&&(_0x16f46f[_0x50997c(0x14e)]=_0xaaa397[0x0]);}}}return _0x16f46f;}export function readRawConfigWithLayers(_0x4c3257){const _0x4d3100=loadRawConfigLayers(_0x4c3257);return{'config':mergeRawConfigLayers(_0x4d3100),'layers':_0x4d3100};}export function readRawConfig(_0x118842){return mergeRawConfigLayers(loadRawConfigLayers(_0x118842));}export function getConfigAppCode(_0x18a59f){const _0xaf470c=a124_0x8149bd,_0x524c48=readRawConfig(_0x18a59f);if(_0x524c48[_0xaf470c(0x15b)]&&typeof _0x524c48[_0xaf470c(0x15b)]===_0xaf470c(0x16f)){const _0x36ee47=_0x524c48['defaultApp'];if(_0x36ee47&&_0x524c48['apps'][_0x36ee47]?.[_0xaf470c(0x173)])return String(_0x524c48[_0xaf470c(0x15b)][_0x36ee47][_0xaf470c(0x173)])[_0xaf470c(0x16e)]();const _0x153237=Object[_0xaf470c(0x144)](_0x524c48[_0xaf470c(0x15b)])[0x0];if(_0x153237?.[_0xaf470c(0x173)])return String(_0x153237[_0xaf470c(0x173)])[_0xaf470c(0x16e)]();}const _0x3ae8e2=_0x524c48[_0xaf470c(0x173)]||_0x524c48[_0xaf470c(0x155)];if(typeof _0x3ae8e2!==_0xaf470c(0x14f)||_0x3ae8e2[_0xaf470c(0x16e)]()==='')return undefined;return _0x3ae8e2[_0xaf470c(0x16e)]();}export function getMultiAppConfigs(_0xd8f94=a124_0x8149bd(0x150),_0x2ab242){const _0x418b8e=a124_0x8149bd,_0x27856e=_0xd8f94===_0x418b8e(0x152)?readRawConfig(_0x2ab242):loadRawConfigLayers(_0x2ab242)[_0x418b8e(0x15f)],_0x1c9096=_0x27856e[_0x418b8e(0x15b)];if(!_0x1c9096||typeof _0x1c9096!==_0x418b8e(0x16f)||Object[_0x418b8e(0x163)](_0x1c9096)['length']===0x0)return null;const _0x3938f2=_0x27856e['defaultApp'];return Object['entries'](_0x1c9096)[_0x418b8e(0x18c)](([_0x530932,_0x57e215])=>({'name':_0x530932,'appcode':_0x57e215?.[_0x418b8e(0x173)]||'','isDefault':_0x530932===_0x3938f2,'env':_0x57e215?.[_0x418b8e(0x167)],'apiDir':_0x57e215?.[_0x418b8e(0x15c)],'cookie':_0x57e215?.['cookie']||undefined}))[_0x418b8e(0x18d)](_0xc789ea=>_0xc789ea['appcode']);}function a124_0x4671(){const _0x1ec620=['cwd','.lovrabet.json','https://g.lovrabet.com/dist/lovrabet-skill','./constant/env.js','migrated','920WjfsQY','ACCESS_KEY','defaultApp','string','project','./auth/get-cookie.js','merged','.rabetbase.json','\x0a\x20\x20','app','template_base_url','replace','69080hTMjfc','userDomain','find','apps','apiDir','data','APPCODE','projectConfig','join','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','63pQhvkn','keys','VERBOSE','.tmp','pageSize','env','Global','setRawCommand','./utils/is-non-interactive.js','stringify','locale','set','trim','object','10195ivPTBU','entries','11ykBPnt','appcode','warn','missing','10774860OqVlJB','error','cookie','368019nPbLJH','MAX_RISK','status','format','empty','setLogPath','read','12243CYaFLe','1164178uzFWUY','slice','inherit','get','9rkszLP','write','993822rNBcYL','silent','argv','config','length','map','filter','-api.ts','accessKey','parse','authRequired','riskLevel','utf8','values','.lovrabetrc','maxRisk'];a124_0x4671=function(){return _0x1ec620;};return a124_0x4671();}export function getTemplateBaseUrl(_0x425485){const _0x433455=a124_0x8149bd,_0xa518ed=readRawConfig(_0x425485);if(_0xa518ed[_0x433455(0x156)]&&typeof _0xa518ed[_0x433455(0x156)]==='string')return _0xa518ed['template_base_url'][_0x433455(0x157)](/\/$/,'');return _0x433455(0x149);}export function readConfigFile(_0x5839c2){const _0x2c0539=a124_0x8149bd;return parseAndNormalizeConfig(_0x5839c2,_0x2c0539(0x188));}export function writeConfigFile(_0x418df4,_0x32b22e){const _0x4c0098=a124_0x8149bd,_0x311d46=dirname(_0x418df4);!existsSync(_0x311d46)&&mkdirSync(_0x311d46,{'recursive':!![]});const _0x418320=_0x418df4+_0x4c0098(0x165);try{writeFileSync(_0x418320,JSON[_0x4c0098(0x16b)](_0x32b22e,null,0x2)+'\x0a',{'encoding':_0x4c0098(0x143),'mode':0x180}),renameSync(_0x418320,_0x418df4);}catch(_0x110204){try{unlinkSync(_0x418320);}catch{}throw _0x110204;}}export function resolveWriteConfigPath(_0x52379e){const _0x6ce852=a124_0x8149bd,_0x305727=_0x52379e===_0x6ce852(0x150)?process[_0x6ce852(0x147)]():homedir(),_0x4daca9=resolveConfigPath(_0x305727);return _0x4daca9??resolve(_0x305727,NEW_CONFIG_NAME);}function buildConfig(_0x864324,_0x3ecb54){const _0x19cc1a=a124_0x8149bd,_0x285c0b={};if(_0x864324['apps']&&typeof _0x864324['apps']===_0x19cc1a(0x16f))for(const [_0x47784a,_0x24c0a8]of Object[_0x19cc1a(0x171)](_0x864324['apps'])){_0x24c0a8&&typeof _0x24c0a8===_0x19cc1a(0x16f)&&_0x24c0a8[_0x19cc1a(0x173)]&&(_0x285c0b[_0x47784a]=_0x24c0a8);}const _0x651c83=_0x864324['defaultApp']||undefined,_0x48a495=Object['keys'](_0x285c0b)[_0x19cc1a(0x18b)]>0x0,_0x2d21cb=_0x3ecb54[_0x19cc1a(0x155)]||env('APP')||undefined,_0x30bee8=_0x2d21cb||_0x651c83||undefined,_0x504794=_0x3ecb54['appcode']||env(_0x19cc1a(0x15e))||undefined,_0x196fa1=_0x504794?Object[_0x19cc1a(0x171)](_0x285c0b)['find'](([,_0x1bd891])=>_0x1bd891?.[_0x19cc1a(0x173)]===_0x504794):undefined,_0x43edac=_0x196fa1?.[0x0],_0x1d0e15=_0x196fa1?.[0x1];let _0x2ec431=_0x504794?_0x43edac:_0x30bee8,_0x772d36=_0x2ec431&&_0x285c0b[_0x2ec431]?_0x285c0b[_0x2ec431]:undefined;_0x504794&&_0x1d0e15&&(_0x772d36=_0x1d0e15);const _0x4c7248=_0x504794?_0x1d0e15??_0x772d36:_0x772d36,_0x5a8ed3=_0x2d21cb||(_0x504794?_0x43edac:undefined),_0x18ed74=_0x504794||_0x4c7248?.['appcode']||undefined,_0x3974af=_0x3ecb54['env']||env('ENV')||_0x4c7248?.[_0x19cc1a(0x167)]||_0x864324[_0x19cc1a(0x167)]||DEFAULT_CONFIG_VALUES[_0x19cc1a(0x167)],_0x820a03=_0x4c7248?.[_0x19cc1a(0x16c)]||_0x864324[_0x19cc1a(0x16c)]||DEFAULT_CONFIG_VALUES[_0x19cc1a(0x16c)],_0x1c00f1=env('COOKIE')||_0x4c7248?.[_0x19cc1a(0x178)]||_0x864324[_0x19cc1a(0x178)]||undefined,_0x34dcdb=env(_0x19cc1a(0x14d))||_0x4c7248?.['accessKey']||_0x864324['accessKey']||undefined,_0x4326ad=_0x3ecb54['format']||env('FORMAT')||_0x4c7248?.[_0x19cc1a(0x17c)]||_0x864324[_0x19cc1a(0x17c)],_0xcf9eaf=normalizeLegacyOutputFormat(_0x4326ad),_0x302815=env('PAGE_SIZE')||_0x4c7248?.[_0x19cc1a(0x166)]||_0x864324[_0x19cc1a(0x166)],_0x296f98=_0x302815?Number(_0x302815)||undefined:undefined,_0x436ad5=env('RISK_LEVEL')||env(_0x19cc1a(0x17a))||_0x4c7248?.[_0x19cc1a(0x142)]||_0x864324[_0x19cc1a(0x142)]||_0x864324[_0x19cc1a(0x146)],_0x2f33e8=_0x436ad5===_0x19cc1a(0x17f)||_0x436ad5===_0x19cc1a(0x186)?_0x436ad5:DEFAULT_CONFIG_VALUES['riskLevel'],_0x33c047=env(_0x19cc1a(0x164)),_0x2f9157=_0x33c047==='1'||_0x33c047==='true',_0x15104b=_0x4c7248?.[_0x19cc1a(0x15c)]||_0x864324['apiDir']||DEFAULT_CONFIG_VALUES[_0x19cc1a(0x15c)],_0x2b5b2c=isDaily(normalizeEnv(String(_0x3974af)))?'daily':'production';return{'appCode':typeof _0x18ed74===_0x19cc1a(0x14f)&&_0x18ed74[_0x19cc1a(0x16e)]()?_0x18ed74['trim']():undefined,'env':_0x2b5b2c,'locale':_0x820a03,'cookie':_0x1c00f1,'accessKey':_0x34dcdb,'format':_0xcf9eaf,'pageSize':_0x296f98,'riskLevel':_0x2f33e8,'verbose':_0x2f9157,'apiDir':_0x15104b,'apps':_0x285c0b,'defaultApp':_0x651c83,'currentApp':_0x48a495?_0x2ec431:undefined,'explicitAppName':_0x5a8ed3,'raw':_0x864324};}async function buildAuth(_0x6ca703){const _0x5a04dc=a124_0x8149bd,{getCookie:_0x35a7a2}=await import(_0x5a04dc(0x151)),_0x26c7af=_0x6ca703['cookie']||_0x35a7a2(),_0x1f280f=_0x26c7af?await getIsSessionValid():![];return{'cookie':_0x26c7af,'isLoggedIn':_0x1f280f,async 'getOrLogin'(){const _0x5b44c8=_0x5a04dc;if(_0x26c7af&&_0x1f280f)return _0x26c7af;throw CliErrors[_0x5b44c8(0x141)]();}};}export function resolveApiFilePath(_0x45d1ba,_0x10b089){const _0xaf1e29=a124_0x8149bd,_0x33a579=resolve(process['cwd'](),_0x45d1ba),_0x1a5b9b=resolve(_0x33a579,'api.ts');if(!_0x10b089)return _0x1a5b9b;const _0x1fdaea=readRawConfig(),_0x3d4c51=_0x1fdaea[_0xaf1e29(0x15b)]&&typeof _0x1fdaea[_0xaf1e29(0x15b)]===_0xaf1e29(0x16f)?_0x1fdaea[_0xaf1e29(0x15b)]:{},_0x5e2220=Object[_0xaf1e29(0x171)](_0x3d4c51)[_0xaf1e29(0x15a)](([,_0x41c97a])=>_0x41c97a?.[_0xaf1e29(0x173)]===_0x10b089);if(!_0x5e2220)return _0x1a5b9b;const [_0x3f836c,_0x1ba1d9]=_0x5e2220,_0x17637b=typeof _0x1fdaea[_0xaf1e29(0x14e)]==='string'?_0x1fdaea[_0xaf1e29(0x14e)]:undefined;if(_0x1ba1d9?.[_0xaf1e29(0x15c)])return _0x1a5b9b;if(_0x17637b&&_0x3f836c!==_0x17637b)return resolve(_0x33a579,_0x3f836c+_0xaf1e29(0x13e));return _0x1a5b9b;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a125_0xa3f5(_0x35661b,_0x39bed2){_0x35661b=_0x35661b-0x19a;const _0x449b71=a125_0x449b();let _0xa3f577=_0x449b71[_0x35661b];return _0xa3f577;}function a125_0x449b(){const _0x174e67=['3117294QpCAeb','10RwwgWe','3655032QYXuQZ','77Gimrjr','set','exec','303621BWCBNC','7050rJrogS','has','50kJSNMv','get','push','371802rBwlod','4QGSYNl','api.ts','utf-8','70srnysx','cwd','569128RROJoR','52378LPHzVr'];a125_0x449b=function(){return _0x174e67;};return a125_0x449b();}(function(_0x5cc413,_0x2905e8){const _0x2444b4=a125_0xa3f5,_0x51f49d=_0x5cc413();while(!![]){try{const _0x2e9da4=-parseInt(_0x2444b4(0x1a3))/0x1*(-parseInt(_0x2444b4(0x1ad))/0x2)+-parseInt(_0x2444b4(0x1a0))/0x3*(-parseInt(_0x2444b4(0x1a7))/0x4)+-parseInt(_0x2444b4(0x19b))/0x5*(-parseInt(_0x2444b4(0x1a6))/0x6)+-parseInt(_0x2444b4(0x1aa))/0x7*(parseInt(_0x2444b4(0x1ac))/0x8)+-parseInt(_0x2444b4(0x19a))/0x9+-parseInt(_0x2444b4(0x1a1))/0xa*(parseInt(_0x2444b4(0x19d))/0xb)+parseInt(_0x2444b4(0x19c))/0xc;if(_0x2e9da4===_0x2905e8)break;else _0x51f49d['push'](_0x51f49d['shift']());}catch(_0x392e24){_0x51f49d['push'](_0x51f49d['shift']());}}}(a125_0x449b,0xbd912));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';const cache=new Map();function parseApiFile(_0x412856){const _0x4fc8e1=a125_0xa3f5,_0x5d6adf=[],_0x5785ea=/\{\s*datasetCode:\s*"([^"]+)"\s*,\s*tableName:\s*"([^"]+)"\s*,\s*name:\s*"([^"]*?)"\s*,\s*alias:\s*"([^"]+)"\s*,?\s*\}/g;let _0x3c5f39;while((_0x3c5f39=_0x5785ea[_0x4fc8e1(0x19f)](_0x412856))!==null){_0x5d6adf[_0x4fc8e1(0x1a5)]({'datasetCode':_0x3c5f39[0x1],'tableName':_0x3c5f39[0x2],'name':_0x3c5f39[0x3],'alias':_0x3c5f39[0x4]});}return _0x5d6adf;}export function loadAliasMap(_0x5ab8c7,_0x5a4eb3,_0x2c5f0c){const _0x215f93=a125_0xa3f5,_0x3183a9=_0x2c5f0c??resolve(process[_0x215f93(0x1ab)](),_0x5ab8c7,_0x215f93(0x1a8));if(cache[_0x215f93(0x1a2)](_0x3183a9))return cache[_0x215f93(0x1a4)](_0x3183a9);if(!existsSync(_0x3183a9))return cache[_0x215f93(0x19e)](_0x3183a9,[]),[];try{const _0x27c3a7=readFileSync(_0x3183a9,_0x215f93(0x1a9)),_0x3c92c0=parseApiFile(_0x27c3a7);return cache[_0x215f93(0x19e)](_0x3183a9,_0x3c92c0),_0x3c92c0;}catch{return cache[_0x215f93(0x19e)](_0x3183a9,[]),[];}}export function resolveAlias(_0x49b6bf,_0x1fc0ef,_0x7dadd0,_0x594e08){if(!_0x1fc0ef)return undefined;const _0x4b102d=loadAliasMap(_0x49b6bf,_0x7dadd0,_0x594e08),_0x2b1eef=_0x4b102d['find'](_0x1caee4=>_0x1caee4['alias']===_0x1fc0ef);return _0x2b1eef?.['datasetCode'];}export function listAliases(_0x3507fb,_0x146094,_0x22f63c){return loadAliasMap(_0x3507fb,_0x146094,_0x22f63c);}
|
package/lib/core/api-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x15073f,_0x56af06){const _0x48586e=a126_0x3ca3,_0x354707=_0x15073f();while(!![]){try{const _0xf8eab2=-parseInt(_0x48586e(0x153))/0x1*(parseInt(_0x48586e(0xf3))/0x2)+parseInt(_0x48586e(0x143))/0x3*(-parseInt(_0x48586e(0x118))/0x4)+parseInt(_0x48586e(0xf5))/0x5+parseInt(_0x48586e(0x129))/0x6+parseInt(_0x48586e(0x132))/0x7+-parseInt(_0x48586e(0xe5))/0x8*(parseInt(_0x48586e(0x147))/0x9)+-parseInt(_0x48586e(0xe4))/0xa*(-parseInt(_0x48586e(0x156))/0xb);if(_0xf8eab2===_0x56af06)break;else _0x354707['push'](_0x354707['shift']());}catch(_0x5387ab){_0x354707['push'](_0x354707['shift']());}}}(a126_0x48ab,0xe1849));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain,getRuntimeDomain}from'../constant/domain.js';function a126_0x48ab(){const _0x24a62a=['Page\x20not\x20found:\x20','\x20of\x20','40506862ydUzrL','\x22\x20not\x20found\x20in\x20dataset\x20','label','displayName','error','set','apiError','scriptType','/smartapi/dblink/getList','\x20\x20});','/smartapi/db-analysis/jobs/cancel','currentPage','find','application/json','/standard-page-status?appCode=','/api/management/library/scripts/delete','API\x20error\x20code:\x20','Operation\x20\x22','tableList','replace','getOne','tableData','/generate-standard-pages/start','/smartapi/custom/queryUserCustomSqlList','name','\x20failed,\x20HTTP\x20','operations','/smartapi/dataset/get-dataset-operation','operationName','totalCount','/api/node-toolbox/sql/save','type','json','sqlCode','object','/api/management/library/scripts/save','update','/smartapi/dataset/get-driven-data?','test','/smartapi/dblink/getOne','\x20\x20return\x20rows;','//\x20','10RQSAEa','5224DMiWji','\x20\x20sqlCode:\x20\x27','tableName','body','401','toString','/smartapi/lovrabet/detail?pageId=','dbtableConfig','\x20failed','description','method','const\x20result\x20=\x20await\x20client.models.','table','/api/custom/executeSql','6qNAMNf','scriptName','2708060rKDPDY','Warning:\x20showing\x20first\x20','delete','clientOperationId','\x20\x20currentPage:\x201,','errorCode','/smartapi/db-analysis/start','BFF\x20save\x20returned\x20no\x20valid\x20id','Request\x20timeout:\x20','errorMsg','/smartapi/dblink/delete','dbId','includeImports','map','sdk','Dataset\x20not\x20found:\x20','dataset_','.create({\x20/*\x20fields\x20*/\x20});','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','/smartapi/custom/getUserCustomSql','errorMessage','/smartapi/lovrabet/update-page','push','/smartapi/question/er-config','string','modelCode','\x20\x20\x20\x20sqlCode:\x20\x27','create','\x20\x20where:\x20{},','SQL\x20query\x20not\x20found:\x20id=','/smartapi/lovrabet/dataset/','target','Unauthorized','add','stringify','8eXKHeK','toLowerCase','data','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','path','filter','planId','pageSize','\x20\x20pageSize:\x2020,','&type=','entries','operationId','.remove(id);','\x20apps.\x20','POST','GET','join','626820ssVuxB','/smartapi/dblink/testConnect','abort','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','version','?sqlCode=','code','/smartapi/custom/saveUserCustomSql','//\x20SQL:\x20','2991205eTRIDL','length','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','const\x20results\x20=\x20data.execResult\x20||\x20[];','/smartapi/dblink/getTableDiffV2ByPage','api_error','/api/management/library/scripts/info?id=','enabled','/api/management/library/scripts/list?appCode=','SQL\x20query\x20not\x20found:\x20','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','isArray','requestFields','UNAUTHORIZED','/smartapi/dataset/get-dataset-list','/generate-standard-pages/status?','2676504FXNKnI','sqlName','authRequired','success','17091eXLxBZ','warn','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','/api/management/library/scripts/statistics?appCode=','/smartapi/dblink/create','message','validation','includes','status','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','const\x20data\x20=\x20await\x20client.sql.execute({','/smartapi/dblink/getAllTableList','269245JYawzG'];a126_0x48ab=function(){return _0x24a62a;};return a126_0x48ab();}import{CliError,CliErrors}from'../errors.js';import{extractList,extractPaging}from'../framework/response.js';import{normalizeEntityWithIdResponse}from'../utils/entity-with-id.js';let _activeCookie;export function setActiveCookie(_0x4f70b0){_activeCookie=_0x4f70b0||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}const DEFAULT_REQUEST_TIMEOUT_MS=0x7530;async function apiRequest(_0x1a5998,_0x42e117={}){const _0x512614=a126_0x3ca3,{method:method=_0x512614(0x127),body:_0x17de24,headers:headers={},timeout:timeout=DEFAULT_REQUEST_TIMEOUT_MS,useRuntime:useRuntime=![]}=_0x42e117,_0x1b6f38=useRuntime?getRuntimeDomain():getApiDomain(),_0x389d7d=_activeCookie||getCookie(),_0xf1c1a8=''+_0x1b6f38+_0x1a5998,_0x508e14=new AbortController(),_0x99c77=setTimeout(()=>_0x508e14[_0x512614(0x12b)](),timeout);try{const _0x13ca8b=await fetch(_0xf1c1a8,{'method':method,'headers':{'Content-Type':_0x512614(0xc7),'Cookie':_0x389d7d,'X-Invoke-Source':'cli:rabetbase',...headers},'body':_0x17de24?JSON['stringify'](_0x17de24):undefined,'signal':_0x508e14['signal']});let _0x2f7eeb;try{_0x2f7eeb=await _0x13ca8b[_0x512614(0xda)]();}catch{throw CliErrors[_0x512614(0x15c)](_0x512614(0x107)+_0x13ca8b[_0x512614(0x14f)]+')',_0x13ca8b[_0x512614(0x14f)]>=0x190?_0x512614(0x13d):undefined);}if(!_0x13ca8b['ok']||_0x2f7eeb[_0x512614(0x146)]===![])throw CliErrors['apiError'](_0x2f7eeb['errorMsg']||_0x2f7eeb[_0x512614(0x14c)]||'API\x20error:\x20'+_0x13ca8b[_0x512614(0x14f)],_0x2f7eeb[_0x512614(0xfa)]?_0x512614(0xca)+_0x2f7eeb[_0x512614(0xfa)]:undefined);return _0x2f7eeb;}catch(_0x44f40d){if(_0x44f40d instanceof Error&&_0x44f40d[_0x512614(0xd2)]==='AbortError')throw CliErrors[_0x512614(0x15c)](_0x512614(0xfd)+_0xf1c1a8);throw _0x44f40d;}finally{clearTimeout(_0x99c77);}}function isAuthFailure(_0x3836b9){const _0x1e19f8=a126_0x3ca3,_0x592cf9=_0x3836b9[_0x1e19f8(0xfe)]||_0x3836b9[_0x1e19f8(0x14c)]||_0x3836b9['data']?.[_0x1e19f8(0x14c)]||_0x3836b9[_0x1e19f8(0x109)]||_0x3836b9[_0x1e19f8(0x15a)]||'';return _0x3836b9[_0x1e19f8(0xfa)]===_0x1e19f8(0x140)||_0x3836b9[_0x1e19f8(0x12f)]===0x191||_0x3836b9[_0x1e19f8(0x12f)]===_0x1e19f8(0xe9)||_0x592cf9[_0x1e19f8(0x14e)](_0x1e19f8(0xe9))||_0x592cf9[_0x1e19f8(0x14e)](_0x1e19f8(0x115))||_0x592cf9[_0x1e19f8(0x14e)]('登录')||_0x592cf9[_0x1e19f8(0x14e)]('认证');}export async function platformFetch(_0x2c3fdc,_0x1e4641){const _0x439d08=a126_0x3ca3,_0x282fec=await fetch(_0x2c3fdc,{'method':_0x1e4641[_0x439d08(0xef)]??_0x439d08(0x127),'headers':{'Content-Type':'application/json','Cookie':_0x1e4641['cookie']},..._0x1e4641[_0x439d08(0xe8)]&&{'body':JSON[_0x439d08(0x117)](_0x1e4641[_0x439d08(0xe8)])}});if(!_0x282fec['ok']){if(_0x282fec['status']===0x191)throw CliErrors[_0x439d08(0x145)]();throw CliErrors[_0x439d08(0x15c)](_0x1e4641[_0x439d08(0x158)]+_0x439d08(0xd3)+_0x282fec[_0x439d08(0x14f)]);}const _0x330ab9=await _0x282fec[_0x439d08(0xda)]();if(_0x330ab9[_0x439d08(0x146)]===![]){if(isAuthFailure(_0x330ab9))throw CliErrors[_0x439d08(0x145)]();throw CliErrors['apiError'](_0x330ab9[_0x439d08(0xfe)]||_0x330ab9['message']||_0x1e4641['label']+_0x439d08(0xed));}return _0x330ab9[_0x439d08(0x11a)];}export async function listBffScripts(_0x27b209,_0x3dbd0b,_0x2efae5){const _0x2b07c0=a126_0x3ca3;let _0xc1a10d=_0x2b07c0(0x13a)+_0x27b209;if(_0x3dbd0b)_0xc1a10d+=_0x2b07c0(0x121)+_0x3dbd0b;const _0x480f65=await apiRequest(_0xc1a10d);let _0x40af05=extractList(_0x480f65[_0x2b07c0(0x11a)]);if(_0x2efae5?.[_0x2b07c0(0xf4)]){const _0xf03a22=_0x2efae5[_0x2b07c0(0xf4)][_0x2b07c0(0x119)]();_0x40af05=_0x40af05[_0x2b07c0(0x11d)](_0xd4df31=>_0xd4df31['functionName']?.[_0x2b07c0(0x119)]()[_0x2b07c0(0x14e)](_0xf03a22)||_0xd4df31['description']?.[_0x2b07c0(0x119)]()['includes'](_0xf03a22));}return _0x40af05;}export async function getBffScriptInfo(_0x5b77a6){const _0x24efb1=a126_0x3ca3,_0x142ea8=await apiRequest(_0x24efb1(0x138)+_0x5b77a6);if(!_0x142ea8[_0x24efb1(0x11a)])throw CliErrors['validation']('BFF\x20script\x20not\x20found:\x20id='+_0x5b77a6);return _0x142ea8[_0x24efb1(0x11a)];}export async function saveBffScript(_0x43eb92){const _0x41072c=a126_0x3ca3,_0x1e276b=await apiRequest(_0x41072c(0xdd),{'method':_0x41072c(0x126),'body':_0x43eb92}),{id:_0x30db9b,entity:_0x323dae}=normalizeEntityWithIdResponse(_0x1e276b[_0x41072c(0x11a)]);if(_0x30db9b!==undefined){const _0x2935ee=typeof _0x323dae['functionName']===_0x41072c(0x10d)||typeof _0x323dae[_0x41072c(0xc1)]===_0x41072c(0x10d)?_0x323dae:undefined;return{'id':_0x30db9b,'script':_0x2935ee};}throw CliErrors[_0x41072c(0x15c)](_0x41072c(0xfc));}export async function deleteBffScript(_0x439917){const _0x2ce86a=a126_0x3ca3;await apiRequest(_0x2ce86a(0xc9),{'method':_0x2ce86a(0x126),'body':{'id':_0x439917}});}export async function getBffScriptStatistics(_0xd8aec5){const _0x4085ca=a126_0x3ca3,_0x1aa60c=await apiRequest(_0x4085ca(0x14a)+_0xd8aec5);return extractList(_0x1aa60c[_0x4085ca(0x11a)]);}export async function listBffDatasetOperations(_0x365a3a,_0x195f26){const _0x5a400a=a126_0x3ca3,_0x46b71d=await apiRequest(_0x5a400a(0xd5),{'method':'POST','body':{'appCode':_0x365a3a,'datasetId':_0x195f26}});return _0x46b71d[_0x5a400a(0x11a)];}export async function listSqlQueries(_0x25b89d,_0x508bf7){const _0x1882c3=a126_0x3ca3,_0x3ca5b1=await apiRequest(_0x1882c3(0xd1),{'method':'POST','body':{'appCode':_0x25b89d,'currentPage':_0x508bf7?.[_0x1882c3(0xc5)]??0x1,'pageSize':_0x508bf7?.['pageSize']??0x32,'sqlCode':_0x508bf7?.[_0x1882c3(0xdb)],'sqlName':_0x508bf7?.[_0x1882c3(0x144)]}});return _0x3ca5b1[_0x1882c3(0x11a)];}function a126_0x3ca3(_0x2d84b0,_0x390756){_0x2d84b0=_0x2d84b0-0xc1;const _0x48aba7=a126_0x48ab();let _0x3ca382=_0x48aba7[_0x2d84b0];return _0x3ca382;}export async function getSqlQueryInfo(_0x47a739,_0x431c64){const _0x4d1ae9=a126_0x3ca3,_0x5e9e7e=await listSqlQueries(_0x47a739,{'sqlCode':_0x431c64}),_0x28d6c9=_0x5e9e7e[_0x4d1ae9(0xcf)]?.[0x0];if(!_0x28d6c9)throw CliErrors[_0x4d1ae9(0x14d)](_0x4d1ae9(0x13b)+_0x431c64);return _0x28d6c9;}export async function getSqlQueryDetail(_0x1c57b4){const _0x5f3579=a126_0x3ca3,_0xb47c71=await apiRequest(_0x5f3579(0x108)+(_0x5f3579(0x12e)+encodeURIComponent(_0x1c57b4)));if(!_0xb47c71['data'])throw CliErrors[_0x5f3579(0x14d)]('SQL\x20query\x20not\x20found:\x20'+_0x1c57b4);return _0xb47c71[_0x5f3579(0x11a)];}export async function getSqlQueryDetailById(_0x40b702){const _0x4e9a05=a126_0x3ca3,_0x23d8e9=await apiRequest('/smartapi/custom/getUserCustomSql?id='+_0x40b702);if(!_0x23d8e9[_0x4e9a05(0x11a)])throw CliErrors['validation'](_0x4e9a05(0x112)+_0x40b702);return _0x23d8e9[_0x4e9a05(0x11a)];}export async function createSqlQuery(_0x7fda6d){const _0x36d35e=a126_0x3ca3,_0x425c27=await apiRequest(_0x36d35e(0x130),{'method':_0x36d35e(0x126),'body':_0x7fda6d}),{id:_0x38cc82,entity:_0x20692a}=normalizeEntityWithIdResponse(_0x425c27[_0x36d35e(0x11a)]);if(!('sqlCode'in _0x20692a)&&_0x38cc82)return getSqlQueryDetailById(_0x38cc82);return normalizeSqlQueryEntity(_0x20692a);}export async function updateSqlQuery(_0x57e52f){const _0x194488=a126_0x3ca3,_0x447332=await apiRequest('/smartapi/custom/updateUserCustomSql',{'method':_0x194488(0x126),'body':_0x57e52f}),{id:_0xa544c9,entity:_0x466d36}=normalizeEntityWithIdResponse(_0x447332['data']);if(!('sqlCode'in _0x466d36)){if(_0x57e52f['sqlCode'])return getSqlQueryDetail(_0x57e52f[_0x194488(0xdb)]);if(_0xa544c9)return getSqlQueryDetailById(_0xa544c9);}return normalizeSqlQueryEntity(_0x466d36);}export async function deleteSqlQuery(_0xf2068){const _0x4f727e=a126_0x3ca3;await apiRequest('/smartapi/custom/deleteUserCustomSql',{'method':_0x4f727e(0x126),'body':_0xf2068});}export async function saveSqlQuery(_0x3f8621){const _0x4671a9=a126_0x3ca3,_0x29f146=await apiRequest(_0x4671a9(0xd8),{'method':'POST','body':_0x3f8621});return _0x29f146['data'];}function normalizeSqlQueryEntity(_0x3207bc){const _0x3ac409=a126_0x3ca3;return{..._0x3207bc,'id':Number(_0x3207bc['id']),'dbId':_0x3207bc[_0x3ac409(0x100)]==null?undefined:Number(_0x3207bc[_0x3ac409(0x100)]),'version':_0x3207bc[_0x3ac409(0x12d)]==null?undefined:Number(_0x3207bc['version'])};}export async function executeSql(_0x37b11d,_0x1b2780,_0x3904f0){const _0x24c9b7=a126_0x3ca3,_0x5b4f3a=await apiRequest(_0x24c9b7(0xf2),{'method':_0x24c9b7(0x126),'body':{'appCode':_0x37b11d,'sqlCode':_0x1b2780,..._0x3904f0&&{'params':_0x3904f0}},'useRuntime':!![]});return _0x5b4f3a['data'];}export async function listDatasets(_0x178041,_0x1279e9){const _0xc2f817=a126_0x3ca3,_0x3f788f={'appCode':_0x178041,'deleted':![]};if(_0x1279e9?.[_0xc2f817(0x12f)])_0x3f788f[_0xc2f817(0x12f)]=_0x1279e9[_0xc2f817(0x12f)];if(_0x1279e9?.[_0xc2f817(0xd2)])_0x3f788f['name']=_0x1279e9[_0xc2f817(0xd2)];const _0x31d938=await apiRequest(_0xc2f817(0x141),{'method':_0xc2f817(0x126),'body':_0x3f788f});return extractList(_0x31d938[_0xc2f817(0x11a)]);}export async function searchDatasets(_0x464d8c,_0xf35279){const _0x3252d6=a126_0x3ca3,_0x4ebb7a=await listDatasets(_0x464d8c,{'name':_0xf35279}),_0x5c51c5=_0xf35279[_0x3252d6(0x119)](),_0xe8093c=new Set(_0x4ebb7a[_0x3252d6(0x102)](_0x4431a0=>_0x4431a0['id'])),_0x339515=_0x4ebb7a[_0x3252d6(0x11d)](_0x108ea9=>_0x108ea9[_0x3252d6(0xec)]?.[_0x3252d6(0xe7)]?.[_0x3252d6(0x119)]()[_0x3252d6(0x14e)](_0x5c51c5)||_0x108ea9[_0x3252d6(0xee)]?.[_0x3252d6(0x119)]()['includes'](_0x5c51c5)),_0x329f0b=await listDatasets(_0x464d8c,{'code':_0xf35279});for(const _0x411f4b of _0x329f0b){!_0xe8093c['has'](_0x411f4b['id'])&&(_0x4ebb7a[_0x3252d6(0x10b)](_0x411f4b),_0xe8093c[_0x3252d6(0x116)](_0x411f4b['id']));}return _0x4ebb7a;}export function normalizeDatasetOperations(_0x2607c6){const _0x2cb19a=a126_0x3ca3;if(Array['isArray'](_0x2607c6))return _0x2607c6[_0x2cb19a(0x11d)](_0x2e9180=>_0x2e9180!=null&&typeof _0x2e9180===_0x2cb19a(0xdc));if(_0x2607c6&&typeof _0x2607c6==='object')return Object[_0x2cb19a(0x122)](_0x2607c6)[_0x2cb19a(0x11d)](([,_0x120f8b])=>_0x120f8b!=null&&typeof _0x120f8b===_0x2cb19a(0xdc))[_0x2cb19a(0x102)](([_0x2b9b39,_0x4e72a5])=>({..._0x4e72a5,'name':_0x4e72a5['name']??_0x4e72a5['operationName']??_0x2b9b39}));return[];}export async function getDatasetDetail(_0x2b8e8c){const _0x29a0d0=a126_0x3ca3,_0x496c1f=/^\d+$/[_0x29a0d0(0xe0)](_0x2b8e8c)?'id':_0x29a0d0(0x12f),_0x3a6c6f=await apiRequest(_0x29a0d0(0xdf)+_0x496c1f+'='+_0x2b8e8c);return _0x3a6c6f['data'];}export async function getDatasetOperations(_0x18cd80){const _0x36f348=a126_0x3ca3,_0x38d8bb=await getDatasetDetail(_0x18cd80),_0x4575fa=normalizeDatasetOperations(_0x38d8bb['operations'])[_0x36f348(0x102)](_0x495e6e=>({'name':_0x495e6e[_0x36f348(0xd2)]||_0x495e6e[_0x36f348(0xd6)],'displayName':_0x495e6e[_0x36f348(0x159)]||_0x495e6e[_0x36f348(0xd2)],'type':_0x495e6e[_0x36f348(0xd9)],'method':_0x495e6e['method'],'path':_0x495e6e[_0x36f348(0x11c)],'enabled':_0x495e6e[_0x36f348(0x139)]??!![],'requestFields':_0x495e6e[_0x36f348(0x13f)],'responseFields':_0x495e6e['responseFields']}));return{'dataset':{'id':_0x38d8bb['id']??_0x38d8bb['modelId'],'name':_0x38d8bb[_0x36f348(0xd2)],'code':_0x38d8bb[_0x36f348(0x12f)]||_0x38d8bb[_0x36f348(0x10e)],'tableName':_0x38d8bb[_0x36f348(0xe7)]||_0x38d8bb[_0x36f348(0xec)]?.[_0x36f348(0xe7)]},'operations':_0x4575fa};}export async function getOperationDetail(_0x3db9f1,_0x195aad,_0x20ff5d){const _0x518df0=a126_0x3ca3;let _0x12290e=_0x195aad;if(!/^\d+$/[_0x518df0(0xe0)](_0x195aad)){const _0x4d47c3=await listDatasets(_0x3db9f1,{'code':_0x195aad}),_0x10acd1=_0x4d47c3['find'](_0x16439d=>_0x16439d[_0x518df0(0x12f)]===_0x195aad||String(_0x16439d['id'])===_0x195aad);if(!_0x10acd1)throw CliErrors[_0x518df0(0x14d)](_0x518df0(0x104)+_0x195aad);_0x12290e=String(_0x10acd1['id']);}const _0x5de72b=await getDatasetDetail(_0x12290e),_0x3209b5=normalizeDatasetOperations(_0x5de72b[_0x518df0(0xd4)])[_0x518df0(0xc6)](_0x353a59=>(_0x353a59['name']||_0x353a59[_0x518df0(0xd6)])===_0x20ff5d);if(!_0x3209b5)throw CliErrors[_0x518df0(0x14d)](_0x518df0(0xcb)+_0x20ff5d+_0x518df0(0x157)+_0x195aad);return{'dataset':{'id':_0x5de72b['id']??_0x5de72b['modelId'],'name':_0x5de72b[_0x518df0(0xd2)],'code':_0x5de72b[_0x518df0(0x12f)]||_0x5de72b[_0x518df0(0x10e)],'tableName':_0x5de72b[_0x518df0(0xe7)]||_0x5de72b[_0x518df0(0xec)]?.[_0x518df0(0xe7)]},'operation':_0x3209b5};}export async function startGenerateStandardPages(_0x1fa284,_0x1550e2,_0x344ebd){const _0x1b2980=a126_0x3ca3,_0x3c9173=await apiRequest(_0x1b2980(0x113)+_0x1550e2+_0x1b2980(0xd0),{'method':_0x1b2980(0x126),'body':{'appCode':_0x1fa284,..._0x344ebd?.[_0x1b2980(0xf8)]?{'clientOperationId':_0x344ebd[_0x1b2980(0xf8)]}:{}},'timeout':DEFAULT_REQUEST_TIMEOUT_MS});return _0x3c9173[_0x1b2980(0x11a)];}export async function getGenerateStandardPagesStatus(_0x16900e,_0x326f84,_0x3a8f23){const _0x511989=a126_0x3ca3,_0x19f062=new URLSearchParams({'appCode':_0x16900e});_0x3a8f23[_0x511989(0x123)]&&_0x19f062[_0x511989(0x15b)](_0x511989(0x123),_0x3a8f23[_0x511989(0x123)]);_0x3a8f23[_0x511989(0xf8)]&&_0x19f062[_0x511989(0x15b)](_0x511989(0xf8),_0x3a8f23[_0x511989(0xf8)]);const _0x252e7c=await apiRequest('/smartapi/lovrabet/dataset/'+_0x326f84+_0x511989(0x142)+_0x19f062[_0x511989(0xea)]());return _0x252e7c['data'];}export async function getStandardPageStatus(_0x475911,_0x17e0ce){const _0x1efd74=a126_0x3ca3,_0x5116d3=await apiRequest(_0x1efd74(0x113)+_0x17e0ce+_0x1efd74(0xc8)+encodeURIComponent(_0x475911));return _0x5116d3[_0x1efd74(0x11a)];}export async function tryGetStandardPageStatus(_0x1f1159,_0x4c545c){const _0x2b5780=a126_0x3ca3;try{return await getStandardPageStatus(_0x1f1159,_0x4c545c);}catch(_0xab07b7){if(_0xab07b7 instanceof CliError&&_0xab07b7[_0x2b5780(0x12f)]===_0x2b5780(0x137)&&/404|not found|non-json response/i[_0x2b5780(0xe0)](_0xab07b7[_0x2b5780(0x14c)]))return null;throw _0xab07b7;}}export async function syncStandardPages(_0xb9829f,_0x4e2117){const _0x376565=await apiRequest('/smartapi/lovrabet/dataset/'+_0x4e2117+'/sync-to-pages',{'method':'POST','body':{'appCode':_0xb9829f}});return _0x376565['data'];}export async function getPageDetail(_0x4c9477){const _0x151086=a126_0x3ca3,_0x599278=await apiRequest(_0x151086(0xeb)+_0x4c9477);if(!_0x599278[_0x151086(0x11a)])throw CliErrors['validation'](_0x151086(0x154)+_0x4c9477);return _0x599278[_0x151086(0x11a)];}export async function updatePage(_0x3a85e4,_0x12d5d4,_0xc590f1,_0x549e20){const _0x2e8f5d=a126_0x3ca3,_0x1383fe=await apiRequest(_0x2e8f5d(0x10a),{'method':_0x2e8f5d(0x126),'body':{'appCode':_0x3a85e4,'pageId':_0x12d5d4,'code':_0xc590f1,'datasetIds':_0x549e20}});return _0x1383fe[_0x2e8f5d(0x11a)];}export function generateSdkCode(_0x579cc8,_0x1be087,_0xe03c48){const _0x3c1a8d=a126_0x3ca3,_0x5e773a=_0xe03c48?.[_0x3c1a8d(0x101)]??!![],_0x3b65ec=_0x3c1a8d(0x105)+_0x579cc8[_0x3c1a8d(0x12f)]?.[_0x3c1a8d(0xcd)](/-/g,'_'),_0x4bf362=_0x1be087[_0x3c1a8d(0xd2)]||_0x1be087[_0x3c1a8d(0xd6)]||'filter',_0x5bc7e8=[];_0x5e773a&&_0x5bc7e8[_0x3c1a8d(0x10b)]('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x3c1a8d(0x134),'');_0x5bc7e8[_0x3c1a8d(0x10b)](_0x3c1a8d(0xe3)+_0x579cc8[_0x3c1a8d(0xd2)]+'\x20('+(_0x579cc8[_0x3c1a8d(0xe7)]||_0x3c1a8d(0xf1))+')');if(_0x4bf362===_0x3c1a8d(0x11d))_0x5bc7e8[_0x3c1a8d(0x10b)](_0x3c1a8d(0xf0)+_0x3b65ec+'.filter({',_0x3c1a8d(0x111),_0x3c1a8d(0x120),_0x3c1a8d(0xf9),'});');else{if(_0x4bf362===_0x3c1a8d(0xce))_0x5bc7e8[_0x3c1a8d(0x10b)]('const\x20result\x20=\x20await\x20client.models.'+_0x3b65ec+'.getOne(id);');else{if(_0x4bf362===_0x3c1a8d(0x110))_0x5bc7e8[_0x3c1a8d(0x10b)](_0x3c1a8d(0xf0)+_0x3b65ec+_0x3c1a8d(0x106));else{if(_0x4bf362===_0x3c1a8d(0xde))_0x5bc7e8[_0x3c1a8d(0x10b)](_0x3c1a8d(0xf0)+_0x3b65ec+_0x3c1a8d(0x13c));else _0x4bf362===_0x3c1a8d(0xf7)||_0x4bf362==='remove'?_0x5bc7e8[_0x3c1a8d(0x10b)]('const\x20result\x20=\x20await\x20client.models.'+_0x3b65ec+_0x3c1a8d(0x124)):_0x5bc7e8[_0x3c1a8d(0x10b)](_0x3c1a8d(0xf0)+_0x3b65ec+'.'+_0x4bf362+'(/*\x20params\x20*/);');}}}return _0x5bc7e8[_0x3c1a8d(0x128)]('\x0a');}export function generateSqlCodeTemplate(_0x2fa6bc,_0x2f4022){const _0x3e1eb3=a126_0x3ca3,_0x23a35e=_0x2f4022?.[_0x3e1eb3(0x114)]??_0x3e1eb3(0x103),_0x525999=_0x2f4022?.['includeImports']??!![],_0x5ab198=[];return _0x5ab198['push'](_0x3e1eb3(0x131)+_0x2fa6bc[_0x3e1eb3(0x144)]+'\x20('+_0x2fa6bc[_0x3e1eb3(0xdb)]+')'),_0x23a35e===_0x3e1eb3(0x103)?(_0x525999&&_0x5ab198['push']('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x3e1eb3(0x134),''),_0x5ab198[_0x3e1eb3(0x10b)](_0x3e1eb3(0x151),_0x3e1eb3(0xe6)+_0x2fa6bc[_0x3e1eb3(0xdb)]+'\x27,',_0x3e1eb3(0x150),'});',_0x3e1eb3(0x12c),_0x3e1eb3(0x135))):_0x5ab198[_0x3e1eb3(0x10b)](_0x3e1eb3(0x149),'export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{',_0x3e1eb3(0x11b),_0x3e1eb3(0x10f)+_0x2fa6bc[_0x3e1eb3(0xdb)]+'\x27,','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},',_0x3e1eb3(0xc3),_0x3e1eb3(0xe2),'}'),_0x5ab198[_0x3e1eb3(0x128)]('\x0a');}export async function getErConfig(_0x2fcd6e,_0x211ac4){const _0x3f86df=a126_0x3ca3,_0x196142=await apiRequest(_0x3f86df(0x10c),{'method':_0x3f86df(0x126),'body':{'appCode':_0x2fcd6e,'dblinkId':_0x211ac4}});return _0x196142[_0x3f86df(0x11a)];}function buildQuery(_0x66162){const _0x45f180=a126_0x3ca3,_0x211a77=new URLSearchParams();for(const [_0x118bca,_0x4b8d31]of Object[_0x45f180(0x122)](_0x66162)){if(_0x4b8d31===undefined||_0x4b8d31==='')continue;_0x211a77[_0x45f180(0x15b)](_0x118bca,String(_0x4b8d31));}const _0x5a3481=_0x211a77[_0x45f180(0xea)]();return _0x5a3481?'?'+_0x5a3481:'';}export async function listDbLinks(_0x19966e,_0x122a72){const _0x477ecf=a126_0x3ca3,_0x1c4499=await apiRequest(_0x477ecf(0xc2),{'method':_0x477ecf(0x126),'body':{'appCode':_0x19966e,'currentPage':_0x122a72?.[_0x477ecf(0xc5)]??0x1,'pageSize':_0x122a72?.[_0x477ecf(0x11f)]??0x64}});return{'items':extractList(_0x1c4499[_0x477ecf(0x11a)]),'paging':extractPaging(_0x1c4499[_0x477ecf(0x11a)])};}export async function getDbLinkInfo(_0x5a3736){const _0x4336f0=a126_0x3ca3,_0x23d564=await apiRequest(_0x4336f0(0xe1)+buildQuery({'id':_0x5a3736}));return _0x23d564[_0x4336f0(0x11a)];}export async function createDbLink(_0x28b136){const _0x513a96=a126_0x3ca3,_0x20bf98=await apiRequest(_0x513a96(0x14b),{'method':_0x513a96(0x126),'body':_0x28b136});return _0x20bf98['data'];}export async function updateDbLink(_0x18ac11){const _0x3cbafd=a126_0x3ca3,_0x594b8f=await apiRequest('/smartapi/dblink/update',{'method':_0x3cbafd(0x126),'body':_0x18ac11});return _0x594b8f[_0x3cbafd(0x11a)];}export async function deleteDbLink(_0x24de16){const _0x5099a6=a126_0x3ca3;await apiRequest(_0x5099a6(0xff),{'method':'POST','body':{'id':_0x24de16}});}export async function testDbLinkConnect(_0x117944){const _0x3a1c97=a126_0x3ca3,_0x14dfec=await apiRequest(_0x3a1c97(0x12a)+buildQuery({'id':_0x117944}));return _0x14dfec[_0x3a1c97(0x11a)];}export async function startDbAnalysis(_0x573003,_0xb23e48){const _0x474ed8=a126_0x3ca3,_0x47a0a1=await apiRequest(_0x474ed8(0xfb),{'method':_0x474ed8(0x126),'body':{'dbLinkId':_0x573003,..._0xb23e48&&_0xb23e48[_0x474ed8(0x133)]>0x0?{'tableNames':_0xb23e48}:{}}}),_0x527df4=_0x47a0a1[_0x474ed8(0x11a)];if(typeof _0x527df4===_0x474ed8(0x10d))return _0x527df4;if(_0x527df4&&typeof _0x527df4===_0x474ed8(0xdc)&&typeof _0x527df4[_0x474ed8(0x11e)]===_0x474ed8(0x10d))return _0x527df4[_0x474ed8(0x11e)];return _0x527df4!=null?String(_0x527df4):'';}export async function cancelDbAnalysis(_0x3e0a20){const _0x1bc1eb=a126_0x3ca3;await apiRequest(_0x1bc1eb(0xc4)+buildQuery({'planId':_0x3e0a20}),{'method':_0x1bc1eb(0x126)});}export async function getDbAnalysisStatus(_0x34fb70){const _0x65d8ec=a126_0x3ca3,_0x2611d8=await apiRequest('/smartapi/db-analysis/status/'+encodeURIComponent(_0x34fb70));return _0x2611d8[_0x65d8ec(0x11a)];}export async function getDbAllTableList(_0x57bd40,_0x99c79a){const _0x4d9b58=a126_0x3ca3,_0x10c740=await apiRequest(_0x4d9b58(0x152)+buildQuery({'appCode':_0x57bd40,'dbLinkId':_0x99c79a})),_0x1ebc07=_0x10c740[_0x4d9b58(0x11a)];if(Array[_0x4d9b58(0x13e)](_0x1ebc07))return _0x1ebc07;return extractList(_0x1ebc07);}export async function getDbTableDiff(_0x5cdf8f,_0x1ea864,_0x67957){const _0x63284c=a126_0x3ca3,_0x2fe273=await apiRequest(_0x63284c(0x136)+buildQuery({'appCode':_0x5cdf8f,'dbLinkId':_0x1ea864,'pageIndex':_0x67957?.['pageIndex']??0x1,'pageSize':_0x67957?.[_0x63284c(0x11f)]??0x14,'tableName':_0x67957?.[_0x63284c(0xe7)]})),_0x26cb33=_0x2fe273['data'];return{'totalCount':_0x26cb33?.[_0x63284c(0xd7)]??0x0,'tableList':Array[_0x63284c(0x13e)](_0x26cb33?.['tableList'])?_0x26cb33[_0x63284c(0xcc)]:[]};}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x191bcd=a126_0x3ca3,_0x3c89dd=await apiRequest('/smartapi/app/getList',{'method':'POST','body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x3c0310=extractList(_0x3c89dd[_0x191bcd(0x11a)]),_0x29d923=extractPaging(_0x3c89dd[_0x191bcd(0x11a)]);return _0x29d923&&_0x29d923[_0x191bcd(0xd7)]>REMOTE_APP_PAGE_SIZE&&console[_0x191bcd(0x148)](_0x191bcd(0xf6)+REMOTE_APP_PAGE_SIZE+_0x191bcd(0x155)+_0x29d923['totalCount']+_0x191bcd(0x125)+'Use\x20the\x20platform\x20console\x20to\x20see\x20all.'),_0x3c0310;}
|
|
1
|
+
(function(_0x45ce65,_0x28ba6f){const _0x1942f4=a126_0x5e31,_0x300f8b=_0x45ce65();while(!![]){try{const _0x284532=parseInt(_0x1942f4(0x195))/0x1*(parseInt(_0x1942f4(0x139))/0x2)+parseInt(_0x1942f4(0x1a1))/0x3+parseInt(_0x1942f4(0x173))/0x4*(parseInt(_0x1942f4(0x14b))/0x5)+parseInt(_0x1942f4(0x13c))/0x6*(parseInt(_0x1942f4(0x16e))/0x7)+parseInt(_0x1942f4(0x19d))/0x8*(parseInt(_0x1942f4(0x13a))/0x9)+parseInt(_0x1942f4(0x12f))/0xa*(parseInt(_0x1942f4(0x169))/0xb)+-parseInt(_0x1942f4(0x1a2))/0xc*(parseInt(_0x1942f4(0x13e))/0xd);if(_0x284532===_0x28ba6f)break;else _0x300f8b['push'](_0x300f8b['shift']());}catch(_0x29a108){_0x300f8b['push'](_0x300f8b['shift']());}}}(a126_0x47b1,0x3f793));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain,getRuntimeDomain}from'../constant/domain.js';import{CliError,CliErrors}from'../errors.js';import{extractList,extractPaging}from'../framework/response.js';import{normalizeEntityWithIdResponse}from'../utils/entity-with-id.js';let _activeCookie;export function setActiveCookie(_0x3de690){_activeCookie=_0x3de690||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}const DEFAULT_REQUEST_TIMEOUT_MS=0x7530;async function apiRequest(_0x2b1490,_0xb906e0={}){const _0x1e19b7=a126_0x5e31,{method:method=_0x1e19b7(0x14c),body:_0xf78717,headers:headers={},timeout:timeout=DEFAULT_REQUEST_TIMEOUT_MS,useRuntime:useRuntime=![]}=_0xb906e0,_0x1069d3=useRuntime?getRuntimeDomain():getApiDomain(),_0x46bb56=_activeCookie||getCookie(),_0x2aa916=''+_0x1069d3+_0x2b1490,_0xe6295e=new AbortController(),_0x3a5484=setTimeout(()=>_0xe6295e[_0x1e19b7(0x189)](),timeout);try{const _0x279caf=await fetch(_0x2aa916,{'method':method,'headers':{'Content-Type':_0x1e19b7(0x19c),'Cookie':_0x46bb56,'X-Invoke-Source':'cli:rabetbase',...headers},'body':_0xf78717?JSON[_0x1e19b7(0x163)](_0xf78717):undefined,'signal':_0xe6295e['signal']});let _0x10d705;try{_0x10d705=await _0x279caf[_0x1e19b7(0x129)]();}catch{throw CliErrors[_0x1e19b7(0x18b)](_0x1e19b7(0x186)+_0x279caf[_0x1e19b7(0x1b3)]+')',_0x279caf[_0x1e19b7(0x1b3)]>=0x190?_0x1e19b7(0x14e):undefined);}if(!_0x279caf['ok']||_0x10d705[_0x1e19b7(0x15b)]===![])throw CliErrors[_0x1e19b7(0x18b)](_0x10d705[_0x1e19b7(0x1bd)]||_0x10d705[_0x1e19b7(0x1a5)]||_0x1e19b7(0x15d)+_0x279caf[_0x1e19b7(0x1b3)],_0x10d705['errorCode']?'API\x20error\x20code:\x20'+_0x10d705[_0x1e19b7(0x1aa)]:undefined);return _0x10d705;}catch(_0x4b415a){if(_0x4b415a instanceof Error&&_0x4b415a[_0x1e19b7(0x132)]===_0x1e19b7(0x192))throw CliErrors['apiError'](_0x1e19b7(0x1b5)+_0x2aa916);throw _0x4b415a;}finally{clearTimeout(_0x3a5484);}}function isAuthFailure(_0x3cf668){const _0x21b9b3=a126_0x5e31,_0x8c0ccf=_0x3cf668['errorMsg']||_0x3cf668[_0x21b9b3(0x1a5)]||_0x3cf668[_0x21b9b3(0x133)]?.[_0x21b9b3(0x1a5)]||_0x3cf668[_0x21b9b3(0x19e)]||_0x3cf668[_0x21b9b3(0x178)]||'';return _0x3cf668[_0x21b9b3(0x1aa)]==='UNAUTHORIZED'||_0x3cf668[_0x21b9b3(0x1ba)]===0x191||_0x3cf668[_0x21b9b3(0x1ba)]===_0x21b9b3(0x15a)||_0x8c0ccf[_0x21b9b3(0x1ac)](_0x21b9b3(0x15a))||_0x8c0ccf[_0x21b9b3(0x1ac)](_0x21b9b3(0x140))||_0x8c0ccf[_0x21b9b3(0x1ac)]('登录')||_0x8c0ccf['includes']('认证');}export async function platformFetch(_0x48a0dd,_0x5802ec){const _0x2dc6ba=a126_0x5e31,_0x4ea3e8=await fetch(_0x48a0dd,{'method':_0x5802ec[_0x2dc6ba(0x151)]??_0x2dc6ba(0x14c),'headers':{'Content-Type':_0x2dc6ba(0x19c),'Cookie':_0x5802ec[_0x2dc6ba(0x130)]},..._0x5802ec[_0x2dc6ba(0x15e)]&&{'body':JSON[_0x2dc6ba(0x163)](_0x5802ec['body'])}});if(!_0x4ea3e8['ok']){if(_0x4ea3e8[_0x2dc6ba(0x1b3)]===0x191)throw CliErrors[_0x2dc6ba(0x149)]();throw CliErrors[_0x2dc6ba(0x18b)](_0x5802ec[_0x2dc6ba(0x1a3)]+_0x2dc6ba(0x188)+_0x4ea3e8[_0x2dc6ba(0x1b3)]);}const _0x4fa2f3=await _0x4ea3e8['json']();if(_0x4fa2f3[_0x2dc6ba(0x15b)]===![]){if(isAuthFailure(_0x4fa2f3))throw CliErrors[_0x2dc6ba(0x149)]();throw CliErrors[_0x2dc6ba(0x18b)](_0x4fa2f3[_0x2dc6ba(0x1bd)]||_0x4fa2f3[_0x2dc6ba(0x1a5)]||_0x5802ec[_0x2dc6ba(0x1a3)]+'\x20failed');}return _0x4fa2f3[_0x2dc6ba(0x133)];}export async function listBffScripts(_0x3980ca,_0x2c4ec2,_0x3a7b84){const _0x451b61=a126_0x5e31;let _0x359806=_0x451b61(0x162)+_0x3980ca;if(_0x2c4ec2)_0x359806+=_0x451b61(0x19b)+_0x2c4ec2;const _0x481d6a=await apiRequest(_0x359806);let _0x1d9083=extractList(_0x481d6a[_0x451b61(0x133)]);if(_0x3a7b84?.[_0x451b61(0x193)]){const _0x2f47b1=_0x3a7b84['scriptName'][_0x451b61(0x17d)]();_0x1d9083=_0x1d9083[_0x451b61(0x144)](_0x5c4e00=>_0x5c4e00[_0x451b61(0x154)]?.[_0x451b61(0x17d)]()[_0x451b61(0x1ac)](_0x2f47b1)||_0x5c4e00[_0x451b61(0x1b7)]?.[_0x451b61(0x17d)]()['includes'](_0x2f47b1));}return _0x1d9083;}export async function getBffScriptInfo(_0x49521e){const _0x55a178=a126_0x5e31,_0x56ee8f=await apiRequest('/api/management/library/scripts/info?id='+_0x49521e);if(!_0x56ee8f[_0x55a178(0x133)])throw CliErrors['validation'](_0x55a178(0x166)+_0x49521e);return _0x56ee8f[_0x55a178(0x133)];}export async function saveBffScript(_0x39351e){const _0x457484=a126_0x5e31,_0xf4fd32=await apiRequest(_0x457484(0x16b),{'method':_0x457484(0x15c),'body':_0x39351e}),{id:_0x456973,entity:_0x3afbe3}=normalizeEntityWithIdResponse(_0xf4fd32[_0x457484(0x133)]);if(_0x456973!==undefined){const _0x4749fb=typeof _0x3afbe3['functionName']===_0x457484(0x152)||typeof _0x3afbe3[_0x457484(0x164)]==='string'?_0x3afbe3:undefined;return{'id':_0x456973,'script':_0x4749fb};}throw CliErrors[_0x457484(0x18b)](_0x457484(0x1be));}export async function deleteBffScript(_0x416b4c){const _0x13d260=a126_0x5e31;await apiRequest(_0x13d260(0x1b6),{'method':_0x13d260(0x15c),'body':{'id':_0x416b4c}});}export async function getBffScriptStatistics(_0x3bb42e){const _0x2e8896=a126_0x5e31,_0x2a7fb5=await apiRequest(_0x2e8896(0x179)+_0x3bb42e);return extractList(_0x2a7fb5[_0x2e8896(0x133)]);}export async function listBffDatasetOperations(_0x1bd38b,_0x3c62f2){const _0x215bff=a126_0x5e31,_0x591cf1=await apiRequest('/smartapi/dataset/get-dataset-operation',{'method':_0x215bff(0x15c),'body':{'appCode':_0x1bd38b,'datasetId':_0x3c62f2}});return _0x591cf1[_0x215bff(0x133)];}function a126_0x5e31(_0x263136,_0x5d343d){_0x263136=_0x263136-0x127;const _0x47b1c6=a126_0x47b1();let _0x5e319b=_0x47b1c6[_0x263136];return _0x5e319b;}export async function listSqlQueries(_0x2ab096,_0x4ab113){const _0x423f52=a126_0x5e31,_0x5194c6=await apiRequest(_0x423f52(0x199),{'method':_0x423f52(0x15c),'body':{'appCode':_0x2ab096,'currentPage':_0x4ab113?.[_0x423f52(0x17f)]??0x1,'pageSize':_0x4ab113?.[_0x423f52(0x1a6)]??0x32,'sqlCode':_0x4ab113?.['sqlCode'],'sqlName':_0x4ab113?.[_0x423f52(0x1bc)]}});return _0x5194c6[_0x423f52(0x133)];}export async function getSqlQueryInfo(_0x2c2dfb,_0x2355a9){const _0x1e215e=await listSqlQueries(_0x2c2dfb,{'sqlCode':_0x2355a9}),_0x33d724=_0x1e215e['tableData']?.[0x0];if(!_0x33d724)throw CliErrors['validation']('SQL\x20query\x20not\x20found:\x20'+_0x2355a9);return _0x33d724;}export async function getSqlQueryDetail(_0x4486b8){const _0x44b970=a126_0x5e31,_0x48790e=await apiRequest('/smartapi/custom/getUserCustomSql'+(_0x44b970(0x183)+encodeURIComponent(_0x4486b8)));if(!_0x48790e[_0x44b970(0x133)])throw CliErrors[_0x44b970(0x19f)](_0x44b970(0x165)+_0x4486b8);return _0x48790e[_0x44b970(0x133)];}export async function getSqlQueryDetailById(_0xd8bd95){const _0x4132c5=a126_0x5e31,_0x4e6b35=await apiRequest(_0x4132c5(0x147)+_0xd8bd95);if(!_0x4e6b35[_0x4132c5(0x133)])throw CliErrors[_0x4132c5(0x19f)](_0x4132c5(0x167)+_0xd8bd95);return _0x4e6b35['data'];}export async function createSqlQuery(_0x390100){const _0x47f2eb=a126_0x5e31,_0x4b7c64=await apiRequest(_0x47f2eb(0x134),{'method':'POST','body':_0x390100}),{id:_0x426735,entity:_0x36f723}=normalizeEntityWithIdResponse(_0x4b7c64[_0x47f2eb(0x133)]);if(!(_0x47f2eb(0x1a8)in _0x36f723)&&_0x426735)return getSqlQueryDetailById(_0x426735);return normalizeSqlQueryEntity(_0x36f723);}export async function updateSqlQuery(_0x2f19cd){const _0x2807e8=a126_0x5e31,_0x2540d3=await apiRequest(_0x2807e8(0x1a4),{'method':'POST','body':_0x2f19cd}),{id:_0x25431f,entity:_0x47e0a9}=normalizeEntityWithIdResponse(_0x2540d3[_0x2807e8(0x133)]);if(!('sqlCode'in _0x47e0a9)){if(_0x2f19cd[_0x2807e8(0x1a8)])return getSqlQueryDetail(_0x2f19cd[_0x2807e8(0x1a8)]);if(_0x25431f)return getSqlQueryDetailById(_0x25431f);}return normalizeSqlQueryEntity(_0x47e0a9);}export async function deleteSqlQuery(_0x550d0b){const _0x132902=a126_0x5e31;await apiRequest(_0x132902(0x1af),{'method':_0x132902(0x15c),'body':_0x550d0b});}export async function saveSqlQuery(_0x3ae08b){const _0x58ce99=a126_0x5e31,_0x3a01e1=await apiRequest(_0x58ce99(0x17c),{'method':_0x58ce99(0x15c),'body':_0x3ae08b});return _0x3a01e1[_0x58ce99(0x133)];}function normalizeSqlQueryEntity(_0x5c2407){const _0x3a2354=a126_0x5e31;return{..._0x5c2407,'id':Number(_0x5c2407['id']),'dbId':_0x5c2407[_0x3a2354(0x198)]==null?undefined:Number(_0x5c2407[_0x3a2354(0x198)]),'version':_0x5c2407['version']==null?undefined:Number(_0x5c2407[_0x3a2354(0x1ad)])};}export async function executeSql(_0x382c7e,_0x26261a,_0x5b0dcb){const _0x1a520b=a126_0x5e31,_0x5320c8=await apiRequest(_0x1a520b(0x131),{'method':'POST','body':{'appCode':_0x382c7e,'sqlCode':_0x26261a,..._0x5b0dcb&&{'params':_0x5b0dcb}},'useRuntime':!![]});return _0x5320c8[_0x1a520b(0x133)];}export async function listDatasets(_0x45d538,_0x279e0e){const _0x577004=a126_0x5e31,_0x10bc1c={'appCode':_0x45d538,'deleted':![]};if(_0x279e0e?.[_0x577004(0x1ba)])_0x10bc1c[_0x577004(0x1ba)]=_0x279e0e[_0x577004(0x1ba)];if(_0x279e0e?.[_0x577004(0x132)])_0x10bc1c[_0x577004(0x132)]=_0x279e0e[_0x577004(0x132)];const _0x4dc6e4=await apiRequest('/smartapi/dataset/get-dataset-list',{'method':_0x577004(0x15c),'body':_0x10bc1c});return extractList(_0x4dc6e4[_0x577004(0x133)]);}export async function searchDatasets(_0x240e19,_0x917582){const _0x227472=a126_0x5e31,_0x566813=await listDatasets(_0x240e19,{'name':_0x917582}),_0x3be7ec=_0x917582[_0x227472(0x17d)](),_0xc304db=new Set(_0x566813[_0x227472(0x143)](_0x239901=>_0x239901['id'])),_0x43f304=_0x566813['filter'](_0x16a5b4=>_0x16a5b4[_0x227472(0x19a)]?.[_0x227472(0x1c2)]?.[_0x227472(0x17d)]()[_0x227472(0x1ac)](_0x3be7ec)||_0x16a5b4[_0x227472(0x1b7)]?.['toLowerCase']()[_0x227472(0x1ac)](_0x3be7ec)),_0x4395a5=await listDatasets(_0x240e19,{'code':_0x917582});for(const _0x20576d of _0x4395a5){!_0xc304db['has'](_0x20576d['id'])&&(_0x566813[_0x227472(0x175)](_0x20576d),_0xc304db[_0x227472(0x161)](_0x20576d['id']));}return _0x566813;}export function normalizeDatasetOperations(_0x5dcc07){const _0x36e356=a126_0x5e31;if(Array[_0x36e356(0x172)](_0x5dcc07))return _0x5dcc07[_0x36e356(0x144)](_0x140684=>_0x140684!=null&&typeof _0x140684===_0x36e356(0x185));if(_0x5dcc07&&typeof _0x5dcc07===_0x36e356(0x185))return Object['entries'](_0x5dcc07)[_0x36e356(0x144)](([,_0x268427])=>_0x268427!=null&&typeof _0x268427===_0x36e356(0x185))[_0x36e356(0x143)](([_0xecd811,_0x71dc1d])=>({..._0x71dc1d,'name':_0x71dc1d['name']??_0x71dc1d['operationName']??_0xecd811}));return[];}export async function getDatasetDetail(_0x31a783){const _0x511eda=a126_0x5e31,_0x14a1c6=/^\d+$/[_0x511eda(0x196)](_0x31a783)?'id':_0x511eda(0x1ba),_0x42b24c=await apiRequest(_0x511eda(0x174)+_0x14a1c6+'='+_0x31a783);return _0x42b24c[_0x511eda(0x133)];}export async function getDatasetOperations(_0x145041){const _0x2092bc=a126_0x5e31,_0x292d1b=await getDatasetDetail(_0x145041),_0x5eb2e9=normalizeDatasetOperations(_0x292d1b[_0x2092bc(0x146)])[_0x2092bc(0x143)](_0x5787cb=>({'name':_0x5787cb[_0x2092bc(0x132)]||_0x5787cb[_0x2092bc(0x1c0)],'displayName':_0x5787cb[_0x2092bc(0x127)]||_0x5787cb[_0x2092bc(0x132)],'type':_0x5787cb['type'],'method':_0x5787cb[_0x2092bc(0x151)],'path':_0x5787cb[_0x2092bc(0x145)],'enabled':_0x5787cb[_0x2092bc(0x150)]??!![],'requestFields':_0x5787cb['requestFields'],'responseFields':_0x5787cb[_0x2092bc(0x1a7)]}));return{'dataset':{'id':_0x292d1b['id']??_0x292d1b[_0x2092bc(0x14d)],'name':_0x292d1b[_0x2092bc(0x132)],'code':_0x292d1b['code']||_0x292d1b[_0x2092bc(0x187)],'tableName':_0x292d1b[_0x2092bc(0x1c2)]||_0x292d1b[_0x2092bc(0x19a)]?.[_0x2092bc(0x1c2)]},'operations':_0x5eb2e9};}export async function getOperationDetail(_0x240483,_0x55afbe,_0x287bfa){const _0x19e27c=a126_0x5e31;let _0x13d01c=_0x55afbe;if(!/^\d+$/['test'](_0x55afbe)){const _0x4209da=await listDatasets(_0x240483,{'code':_0x55afbe}),_0x4c7942=_0x4209da[_0x19e27c(0x1c3)](_0x4aed2e=>_0x4aed2e[_0x19e27c(0x1ba)]===_0x55afbe||String(_0x4aed2e['id'])===_0x55afbe);if(!_0x4c7942)throw CliErrors['validation']('Dataset\x20not\x20found:\x20'+_0x55afbe);_0x13d01c=String(_0x4c7942['id']);}const _0x52c53b=await getDatasetDetail(_0x13d01c),_0x3a746b=normalizeDatasetOperations(_0x52c53b['operations'])[_0x19e27c(0x1c3)](_0x5acacc=>(_0x5acacc[_0x19e27c(0x132)]||_0x5acacc[_0x19e27c(0x1c0)])===_0x287bfa);if(!_0x3a746b)throw CliErrors['validation'](_0x19e27c(0x12a)+_0x287bfa+_0x19e27c(0x1bf)+_0x55afbe);return{'dataset':{'id':_0x52c53b['id']??_0x52c53b[_0x19e27c(0x14d)],'name':_0x52c53b[_0x19e27c(0x132)],'code':_0x52c53b[_0x19e27c(0x1ba)]||_0x52c53b['modelCode'],'tableName':_0x52c53b[_0x19e27c(0x1c2)]||_0x52c53b[_0x19e27c(0x19a)]?.[_0x19e27c(0x1c2)]},'operation':_0x3a746b};}export async function startGenerateStandardPages(_0x299116,_0x1d6f1f,_0xbe1227){const _0x55941e=a126_0x5e31,_0x104b92=await apiRequest('/smartapi/lovrabet/dataset/'+_0x1d6f1f+'/generate-standard-pages/start',{'method':_0x55941e(0x15c),'body':{'appCode':_0x299116,..._0xbe1227?.[_0x55941e(0x14a)]?{'clientOperationId':_0xbe1227[_0x55941e(0x14a)]}:{}},'timeout':DEFAULT_REQUEST_TIMEOUT_MS});return _0x104b92['data'];}export async function getGenerateStandardPagesStatus(_0x278b78,_0xb83a80,_0x499f38){const _0x3ccae9=a126_0x5e31,_0x55f7a9=new URLSearchParams({'appCode':_0x278b78});_0x499f38['operationId']&&_0x55f7a9[_0x3ccae9(0x181)](_0x3ccae9(0x13f),_0x499f38[_0x3ccae9(0x13f)]);_0x499f38[_0x3ccae9(0x14a)]&&_0x55f7a9['set'](_0x3ccae9(0x14a),_0x499f38[_0x3ccae9(0x14a)]);const _0x450be2=await apiRequest('/smartapi/lovrabet/dataset/'+_0xb83a80+_0x3ccae9(0x1b4)+_0x55f7a9[_0x3ccae9(0x17b)]());return _0x450be2[_0x3ccae9(0x133)];}export async function getStandardPageStatus(_0x10b483,_0x3b8686){const _0xd9a6de=a126_0x5e31,_0x4985e4=await apiRequest(_0xd9a6de(0x128)+_0x3b8686+_0xd9a6de(0x17e)+encodeURIComponent(_0x10b483));return _0x4985e4[_0xd9a6de(0x133)];}export async function tryGetStandardPageStatus(_0x21ed38,_0x1e5977){const _0x5b6328=a126_0x5e31;try{return await getStandardPageStatus(_0x21ed38,_0x1e5977);}catch(_0x3b3185){if(_0x3b3185 instanceof CliError&&_0x3b3185[_0x5b6328(0x1ba)]===_0x5b6328(0x16a)&&/404|not found|non-json response/i[_0x5b6328(0x196)](_0x3b3185[_0x5b6328(0x1a5)]))return null;throw _0x3b3185;}}export async function syncStandardPages(_0x2e3ba0,_0x16ad57){const _0x55a7f2=a126_0x5e31,_0x4ced83=await apiRequest(_0x55a7f2(0x128)+_0x16ad57+_0x55a7f2(0x148),{'method':_0x55a7f2(0x15c),'body':{'appCode':_0x2e3ba0}});return _0x4ced83[_0x55a7f2(0x133)];}export async function getPageDetail(_0x5d03b5){const _0xea9249=a126_0x5e31,_0x5bd4c4=await apiRequest(_0xea9249(0x176)+_0x5d03b5);if(!_0x5bd4c4[_0xea9249(0x133)])throw CliErrors['validation'](_0xea9249(0x18e)+_0x5d03b5);return _0x5bd4c4[_0xea9249(0x133)];}function a126_0x47b1(){const _0x32af17=['create','/smartapi/dblink/delete','\x20\x20sqlCode:\x20\x27','2RZelAl','133479txPsUU','dataset_','6GdUnAQ','.remove(id);','2084303yWvcqM','operationId','Unauthorized','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','table','map','filter','path','operations','/smartapi/custom/getUserCustomSql?id=','/sync-to-pages','authRequired','clientOperationId','5JRYEja','GET','modelId','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','/smartapi/db-analysis/start','enabled','method','string','\x20\x20pageSize:\x2020,','functionName','\x20\x20return\x20rows;','/smartapi/dblink/getList','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','/smartapi/lovrabet/update-page','\x20apps.\x20','401','success','POST','API\x20error:\x20','body','\x20\x20});','entries','add','/api/management/library/scripts/list?appCode=','stringify','scriptType','SQL\x20query\x20not\x20found:\x20','BFF\x20script\x20not\x20found:\x20id=','SQL\x20query\x20not\x20found:\x20id=','//\x20','61094irvfiX','api_error','/api/management/library/scripts/save','delete','const\x20result\x20=\x20await\x20client.models.','2824563eBXJHG','/smartapi/db-analysis/jobs/cancel','//\x20SQL:\x20','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','isArray','1812784uTfDYI','/smartapi/dataset/get-driven-data?','push','/smartapi/lovrabet/detail?pageId=','sdk','error','/api/management/library/scripts/statistics?appCode=','/smartapi/db-analysis/status/','toString','/api/node-toolbox/sql/save','toLowerCase','/standard-page-status?appCode=','currentPage','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','set','/smartapi/dblink/create','?sqlCode=','includeImports','object','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','modelCode','\x20failed,\x20HTTP\x20','abort','const\x20data\x20=\x20await\x20client.sql.execute({','apiError','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','/smartapi/question/er-config','Page\x20not\x20found:\x20','});','\x20of\x20','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','AbortError','scriptName','const\x20results\x20=\x20data.execResult\x20||\x20[];','217205KaBfTa','test','tableList','dbId','/smartapi/custom/queryUserCustomSqlList','dbtableConfig','&type=','application/json','120IBtZTt','errorMessage','validation','join','241125Rxyggy','84xVGMQQ','label','/smartapi/custom/updateUserCustomSql','message','pageSize','responseFields','sqlCode','(/*\x20params\x20*/);','errorCode','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','includes','version','/smartapi/dblink/update','/smartapi/custom/deleteUserCustomSql','\x20\x20\x20\x20sqlCode:\x20\x27','planId','/smartapi/dblink/getOne','status','/generate-standard-pages/status?','Request\x20timeout:\x20','/api/management/library/scripts/delete','description','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','totalCount','code','/smartapi/dblink/getTableDiffV2ByPage','sqlName','errorMsg','BFF\x20save\x20returned\x20no\x20valid\x20id','\x22\x20not\x20found\x20in\x20dataset\x20','operationName','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','tableName','find','displayName','/smartapi/lovrabet/dataset/','json','Operation\x20\x22','length','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{','update','\x20\x20where:\x20{},','10FZlsCv','cookie','/api/custom/executeSql','name','data','/smartapi/custom/saveUserCustomSql','target'];a126_0x47b1=function(){return _0x32af17;};return a126_0x47b1();}export async function updatePage(_0x59082d,_0xe4243c,_0x260904,_0x525233){const _0x55f7ac=a126_0x5e31,_0x5245ec=await apiRequest(_0x55f7ac(0x158),{'method':'POST','body':{'appCode':_0x59082d,'pageId':_0xe4243c,'code':_0x260904,'datasetIds':_0x525233}});return _0x5245ec[_0x55f7ac(0x133)];}export function generateSdkCode(_0xc8760f,_0x41f2a8,_0x2f2310){const _0x4b52b7=a126_0x5e31,_0xd30d98=_0x2f2310?.[_0x4b52b7(0x184)]??!![],_0x3e041b=_0x4b52b7(0x13b)+_0xc8760f[_0x4b52b7(0x1ba)]?.['replace'](/-/g,'_'),_0x287ba7=_0x41f2a8[_0x4b52b7(0x132)]||_0x41f2a8[_0x4b52b7(0x1c0)]||_0x4b52b7(0x144),_0x15e89e=[];_0xd30d98&&_0x15e89e[_0x4b52b7(0x175)]('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x4b52b7(0x171),'');_0x15e89e[_0x4b52b7(0x175)](_0x4b52b7(0x168)+_0xc8760f['name']+'\x20('+(_0xc8760f[_0x4b52b7(0x1c2)]||_0x4b52b7(0x142))+')');if(_0x287ba7===_0x4b52b7(0x144))_0x15e89e['push'](_0x4b52b7(0x16d)+_0x3e041b+'.filter({',_0x4b52b7(0x12e),_0x4b52b7(0x153),'\x20\x20currentPage:\x201,',_0x4b52b7(0x18f));else{if(_0x287ba7==='getOne')_0x15e89e['push'](_0x4b52b7(0x16d)+_0x3e041b+'.getOne(id);');else{if(_0x287ba7===_0x4b52b7(0x136))_0x15e89e[_0x4b52b7(0x175)](_0x4b52b7(0x16d)+_0x3e041b+'.create({\x20/*\x20fields\x20*/\x20});');else{if(_0x287ba7===_0x4b52b7(0x12d))_0x15e89e[_0x4b52b7(0x175)](_0x4b52b7(0x16d)+_0x3e041b+_0x4b52b7(0x1b8));else _0x287ba7===_0x4b52b7(0x16c)||_0x287ba7==='remove'?_0x15e89e[_0x4b52b7(0x175)](_0x4b52b7(0x16d)+_0x3e041b+_0x4b52b7(0x13d)):_0x15e89e[_0x4b52b7(0x175)](_0x4b52b7(0x16d)+_0x3e041b+'.'+_0x287ba7+_0x4b52b7(0x1a9));}}}return _0x15e89e['join']('\x0a');}export function generateSqlCodeTemplate(_0xf86e48,_0x40db67){const _0x222da0=a126_0x5e31,_0x5eb6ef=_0x40db67?.[_0x222da0(0x135)]??_0x222da0(0x177),_0x1f78aa=_0x40db67?.[_0x222da0(0x184)]??!![],_0x23009f=[];return _0x23009f[_0x222da0(0x175)](_0x222da0(0x170)+_0xf86e48[_0x222da0(0x1bc)]+'\x20('+_0xf86e48['sqlCode']+')'),_0x5eb6ef===_0x222da0(0x177)?(_0x1f78aa&&_0x23009f['push'](_0x222da0(0x191),'',_0x222da0(0x171),''),_0x23009f[_0x222da0(0x175)](_0x222da0(0x18a),_0x222da0(0x138)+_0xf86e48[_0x222da0(0x1a8)]+'\x27,',_0x222da0(0x1c1),_0x222da0(0x18f),_0x222da0(0x1ab),_0x222da0(0x194))):_0x23009f[_0x222da0(0x175)](_0x222da0(0x141),_0x222da0(0x12c),_0x222da0(0x180),_0x222da0(0x1b0)+_0xf86e48[_0x222da0(0x1a8)]+'\x27,',_0x222da0(0x157),_0x222da0(0x15f),_0x222da0(0x155),'}'),_0x23009f[_0x222da0(0x1a0)]('\x0a');}export async function getErConfig(_0xe1104e,_0x18c96f){const _0x1c0828=a126_0x5e31,_0x49ca79=await apiRequest(_0x1c0828(0x18d),{'method':_0x1c0828(0x15c),'body':{'appCode':_0xe1104e,'dblinkId':_0x18c96f}});return _0x49ca79['data'];}function buildQuery(_0x2ad02d){const _0x302e54=a126_0x5e31,_0x369e04=new URLSearchParams();for(const [_0x374b5f,_0x19581e]of Object[_0x302e54(0x160)](_0x2ad02d)){if(_0x19581e===undefined||_0x19581e==='')continue;_0x369e04[_0x302e54(0x181)](_0x374b5f,String(_0x19581e));}const _0xaf1d5=_0x369e04[_0x302e54(0x17b)]();return _0xaf1d5?'?'+_0xaf1d5:'';}export async function listDbLinks(_0x3f5ea8,_0x34cd4b){const _0x3bce80=a126_0x5e31,_0xa156b9=await apiRequest(_0x3bce80(0x156),{'method':_0x3bce80(0x15c),'body':{'appCode':_0x3f5ea8,'currentPage':_0x34cd4b?.[_0x3bce80(0x17f)]??0x1,'pageSize':_0x34cd4b?.[_0x3bce80(0x1a6)]??0x64}});return{'items':extractList(_0xa156b9['data']),'paging':extractPaging(_0xa156b9[_0x3bce80(0x133)])};}export async function getDbLinkInfo(_0x4ef4c4){const _0x530f7d=a126_0x5e31,_0x31ca82=await apiRequest(_0x530f7d(0x1b2)+buildQuery({'id':_0x4ef4c4}));return _0x31ca82[_0x530f7d(0x133)];}export async function createDbLink(_0x1ecfed){const _0x4d95e9=a126_0x5e31,_0x292c63=await apiRequest(_0x4d95e9(0x182),{'method':_0x4d95e9(0x15c),'body':_0x1ecfed});return _0x292c63[_0x4d95e9(0x133)];}export async function updateDbLink(_0x5046a2){const _0x156648=a126_0x5e31,_0x30e754=await apiRequest(_0x156648(0x1ae),{'method':_0x156648(0x15c),'body':_0x5046a2});return _0x30e754[_0x156648(0x133)];}export async function deleteDbLink(_0x187d3b){const _0x54be2f=a126_0x5e31;await apiRequest(_0x54be2f(0x137),{'method':_0x54be2f(0x15c),'body':{'id':_0x187d3b}});}export async function testDbLinkConnect(_0x43eeb3){const _0x96469f=a126_0x5e31,_0x145f28=await apiRequest('/smartapi/dblink/testConnect'+buildQuery({'id':_0x43eeb3}));return _0x145f28[_0x96469f(0x133)];}export async function startDbAnalysis(_0x292e85,_0x365179){const _0x541b0b=a126_0x5e31,_0x427270=await apiRequest(_0x541b0b(0x14f),{'method':_0x541b0b(0x15c),'body':{'dbLinkId':_0x292e85,..._0x365179&&_0x365179[_0x541b0b(0x12b)]>0x0?{'tableNames':_0x365179}:{}}}),_0x5550d3=_0x427270['data'];if(typeof _0x5550d3===_0x541b0b(0x152))return _0x5550d3;if(_0x5550d3&&typeof _0x5550d3===_0x541b0b(0x185)&&typeof _0x5550d3[_0x541b0b(0x1b1)]===_0x541b0b(0x152))return _0x5550d3[_0x541b0b(0x1b1)];return _0x5550d3!=null?String(_0x5550d3):'';}export async function cancelDbAnalysis(_0xe07cb0){const _0x48359f=a126_0x5e31;await apiRequest(_0x48359f(0x16f)+buildQuery({'planId':_0xe07cb0}),{'method':_0x48359f(0x15c)});}export async function getDbAnalysisStatus(_0x57ea93){const _0x3bd616=a126_0x5e31,_0x2cb432=await apiRequest(_0x3bd616(0x17a)+encodeURIComponent(_0x57ea93));return _0x2cb432['data'];}export async function getDbAllTableList(_0x2159a5,_0x5648cc){const _0x54dd00=a126_0x5e31,_0x2446bc=await apiRequest('/smartapi/dblink/getAllTableList'+buildQuery({'appCode':_0x2159a5,'dbLinkId':_0x5648cc})),_0x5bfcdb=_0x2446bc['data'];if(Array[_0x54dd00(0x172)](_0x5bfcdb))return _0x5bfcdb;return extractList(_0x5bfcdb);}export async function getDbTableDiff(_0x48f9ed,_0x59b66a,_0xb6d245){const _0xf77ac1=a126_0x5e31,_0x163766=await apiRequest(_0xf77ac1(0x1bb)+buildQuery({'appCode':_0x48f9ed,'dbLinkId':_0x59b66a,'pageIndex':_0xb6d245?.['pageIndex']??0x1,'pageSize':_0xb6d245?.['pageSize']??0x14,'tableName':_0xb6d245?.[_0xf77ac1(0x1c2)]})),_0x291ae0=_0x163766[_0xf77ac1(0x133)];return{'totalCount':_0x291ae0?.['totalCount']??0x0,'tableList':Array['isArray'](_0x291ae0?.[_0xf77ac1(0x197)])?_0x291ae0[_0xf77ac1(0x197)]:[]};}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x535ec6=a126_0x5e31,_0x41ed1a=await apiRequest('/smartapi/app/getList',{'method':'POST','body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x395d24=extractList(_0x41ed1a[_0x535ec6(0x133)]),_0x2e730e=extractPaging(_0x41ed1a[_0x535ec6(0x133)]);return _0x2e730e&&_0x2e730e[_0x535ec6(0x1b9)]>REMOTE_APP_PAGE_SIZE&&console['warn']('Warning:\x20showing\x20first\x20'+REMOTE_APP_PAGE_SIZE+_0x535ec6(0x190)+_0x2e730e[_0x535ec6(0x1b9)]+_0x535ec6(0x159)+_0x535ec6(0x18c)),_0x395d24;}
|
package/lib/core/bff/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a127_0x18f7(){const _0x48d325=['bff.lock.json','18355pdEgfU','23334192bVowGo','40904hNvkzj','147156cwPRVW','22xhotTe','102792ShrmcD','bff-trash','1350InBuhb','/bff','bff','11VNeqCg','30SyJcwG','66LRugqd','619620amsCce','4633573ZYoYyr'];a127_0x18f7=function(){return _0x48d325;};return a127_0x18f7();}const a127_0x9d85bb=a127_0x56f3;(function(_0x3a9d78,_0xfc8d52){const _0x44ad47=a127_0x56f3,_0x5ad1b4=_0x3a9d78();while(!![]){try{const _0x1e57b6=-parseInt(_0x44ad47(0x1af))/0x1*(-parseInt(_0x44ad47(0x1b3))/0x2)+-parseInt(_0x44ad47(0x1bb))/0x3*(-parseInt(_0x44ad47(0x1b2))/0x4)+-parseInt(_0x44ad47(0x1ba))/0x5*(parseInt(_0x44ad47(0x1b4))/0x6)+parseInt(_0x44ad47(0x1bd))/0x7+-parseInt(_0x44ad47(0x1b1))/0x8*(-parseInt(_0x44ad47(0x1b6))/0x9)+parseInt(_0x44ad47(0x1bc))/0xa*(parseInt(_0x44ad47(0x1b9))/0xb)+-parseInt(_0x44ad47(0x1b0))/0xc;if(_0x1e57b6===_0xfc8d52)break;else _0x5ad1b4['push'](_0x5ad1b4['shift']());}catch(_0xab6699){_0x5ad1b4['push'](_0x5ad1b4['shift']());}}}(a127_0x18f7,0x6f096));import{resolve}from'node:path';import{findProjectRootDirectory}from'../../context.js';function a127_0x56f3(_0x48dcfc,_0x566404){_0x48dcfc=_0x48dcfc-0x1ae;const _0x18f73d=a127_0x18f7();let _0x56f3f8=_0x18f73d[_0x48dcfc];return _0x56f3f8;}const DOT_DIR='.rabetbase',LOCK_FILE_NAME=a127_0x9d85bb(0x1ae),TRASH_DIR_NAME=a127_0x9d85bb(0x1b5);export function loadBffProjectConfig(_0x29898a,_0x485052){const _0xb8917e=a127_0x9d85bb,_0x26c67b=resolve(_0x485052??findProjectRootDirectory()),_0x537de2=DOT_DIR+_0xb8917e(0x1b7),_0x449d44=_0x537de2+'/'+_0x29898a;return{'projectRoot':_0x26c67b,'appCode':_0x29898a,'scriptsBaseDir':DOT_DIR,'scriptsWorkspaceRoot':_0x537de2,'scriptsRoot':_0x449d44,'scriptsRootDir':resolve(_0x26c67b,DOT_DIR,_0xb8917e(0x1b8),_0x29898a),'lockFilePath':resolve(_0x26c67b,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x26c67b,DOT_DIR,TRASH_DIR_NAME)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a128_0x37b847=a128_0x2abe;(function(_0x394472,_0x1a1b8c){const _0x54af21=a128_0x2abe,_0x1125a2=_0x394472();while(!![]){try{const _0x48402e=parseInt(_0x54af21(0xe0))/0x1+-parseInt(_0x54af21(0xeb))/0x2*(parseInt(_0x54af21(0xe6))/0x3)+parseInt(_0x54af21(0xfa))/0x4+parseInt(_0x54af21(0xf3))/0x5*(-parseInt(_0x54af21(0xf7))/0x6)+-parseInt(_0x54af21(0xe5))/0x7*(-parseInt(_0x54af21(0xee))/0x8)+-parseInt(_0x54af21(0xe2))/0x9+-parseInt(_0x54af21(0xdd))/0xa*(-parseInt(_0x54af21(0xd8))/0xb);if(_0x48402e===_0x1a1b8c)break;else _0x1125a2['push'](_0x1125a2['shift']());}catch(_0x3bd775){_0x1125a2['push'](_0x1125a2['shift']());}}}(a128_0x325c,0x2d10f));import{access,mkdir,readdir,stat}from'node:fs/promises';import{constants}from'node:fs';import{dirname,join}from'node:path';import{findHookLocationByRemoteId,snakeToCamel}from'../../core/bff/utils.js';export const SUPPORTED_BFF_TYPES=['COMMON',a128_0x37b847(0xef),'HOOK'];function a128_0x325c(){const _0x5506d8=['1454327JSAlDC','171NrYciC','push','code','ENOENT','before','5986WPNLqO','F_OK','name','8mGyRcG','ENDPOINT','scriptType','.js','HOOK/','85yzhCOZ','beforeScriptId','operationType','isFile','22854hDSyIj','get','includes','231716EbGBAi','toUpperCase','datasetCode','set','replace','11SnXOwA','COMMON','afterScriptId','split','scriptsRootDir','985610jzhLdK','endsWith','functionNode','330948NvwiTO','functionName','2477286BVmJXm','HOOK','isDirectory'];a128_0x325c=function(){return _0x5506d8;};return a128_0x325c();}export function normalizeBffType(_0x53dfda){const _0x3835f3=a128_0x37b847;if(!_0x53dfda)return undefined;const _0x35a9a3=_0x53dfda['trim']()[_0x3835f3(0xfb)]();return SUPPORTED_BFF_TYPES[_0x3835f3(0xf9)](_0x35a9a3)?_0x35a9a3:undefined;}async function scanJsFilesRecursively(_0x159b4b,_0xc0b51b){const _0x51dfb9=a128_0x37b847,_0x2c390f=[];try{const _0x368dde=await readdir(_0x159b4b,{'withFileTypes':!![]});for(const _0x258692 of _0x368dde){const _0x3b31cf=join(_0x159b4b,_0x258692[_0x51dfb9(0xed)]);if(_0x258692[_0x51dfb9(0xe4)]())_0x2c390f[_0x51dfb9(0xe7)](...await scanJsFilesRecursively(_0x3b31cf,_0xc0b51b+'/'+_0x258692[_0x51dfb9(0xed)]));else _0x258692[_0x51dfb9(0xf6)]()&&_0x258692[_0x51dfb9(0xed)][_0x51dfb9(0xde)](_0x51dfb9(0xf1))&&_0x2c390f['push']({'lockKey':_0xc0b51b+'/'+_0x258692[_0x51dfb9(0xed)][_0x51dfb9(0xd7)](/\.js$/,''),'filePath':_0x3b31cf});}}catch(_0x294a2b){if(_0x294a2b[_0x51dfb9(0xe8)]!==_0x51dfb9(0xe9))throw _0x294a2b;}return _0x2c390f;}async function scanFlatFunctions(_0x2144d9,_0x96b1b9){const _0x137a63=join(_0x2144d9['scriptsRootDir'],_0x96b1b9),_0x287bd7=await scanJsFilesRecursively(_0x137a63,_0x96b1b9);return _0x287bd7['map'](({lockKey:_0x172ae3,filePath:_0x2c4c7b})=>({'type':_0x96b1b9,'name':_0x172ae3['split']('/')['at'](-0x1)??'','filePath':_0x2c4c7b,'lockKey':_0x172ae3}));}function a128_0x2abe(_0xc4fe2d,_0x100984){_0xc4fe2d=_0xc4fe2d-0xd6;const _0x325c31=a128_0x325c();let _0x2abe4a=_0x325c31[_0xc4fe2d];return _0x2abe4a;}async function scanHookFunctions(_0x4b95b5){const _0x4df236=a128_0x37b847,_0x4ed017=join(_0x4b95b5[_0x4df236(0xdc)],_0x4df236(0xe3)),_0x37335d=[];try{const _0x4ec778=await readdir(_0x4ed017,{'withFileTypes':!![]});for(const _0x466982 of _0x4ec778){if(!_0x466982['isDirectory']())continue;const _0x2ea40c=_0x466982[_0x4df236(0xed)],_0x390a0c=join(_0x4ed017,_0x2ea40c),_0x21b88a=await readdir(_0x390a0c,{'withFileTypes':!![]});for(const _0x40e256 of _0x21b88a){if(!_0x40e256[_0x4df236(0xe4)]())continue;const _0x5cab07=_0x40e256[_0x4df236(0xed)],_0x41b057=join(_0x390a0c,_0x5cab07),_0x191af2=await readdir(_0x41b057,{'withFileTypes':!![]});for(const _0x2e925d of _0x191af2){if(!_0x2e925d[_0x4df236(0xe4)]())continue;const _0x188021=_0x2e925d[_0x4df236(0xed)],_0xe9337a=join(_0x41b057,_0x188021),_0x4402c8=await readdir(_0xe9337a,{'withFileTypes':!![]});for(const _0x3a7e86 of _0x4402c8){if(!_0x3a7e86['isFile']()||!_0x3a7e86[_0x4df236(0xed)][_0x4df236(0xde)](_0x4df236(0xf1)))continue;const _0x6ca744=_0x3a7e86[_0x4df236(0xed)][_0x4df236(0xd7)](/\.js$/,'');_0x37335d['push']({'type':_0x4df236(0xe3),'name':_0x6ca744,'filePath':join(_0xe9337a,_0x3a7e86[_0x4df236(0xed)]),'lockKey':_0x4df236(0xf2)+_0x2ea40c+'/'+_0x5cab07+'/'+_0x188021+'/'+_0x6ca744,'alias':_0x2ea40c,'operationType':_0x5cab07,'functionNode':_0x188021});}}}}}catch(_0x4ba952){if(_0x4ba952[_0x4df236(0xe8)]!==_0x4df236(0xe9))throw _0x4ba952;}return _0x37335d;}export async function scanLocalBffFunctions(_0x5c2ebd,_0x35c74d){const _0x2d1a31=a128_0x37b847;if(_0x35c74d===_0x2d1a31(0xd9)||_0x35c74d===_0x2d1a31(0xef))return scanFlatFunctions(_0x5c2ebd,_0x35c74d);if(_0x35c74d===_0x2d1a31(0xe3))return scanHookFunctions(_0x5c2ebd);const [_0x32df6a,_0x5d5726,_0x44b156]=await Promise['all']([scanFlatFunctions(_0x5c2ebd,_0x2d1a31(0xd9)),scanFlatFunctions(_0x5c2ebd,_0x2d1a31(0xef)),scanHookFunctions(_0x5c2ebd)]);return[..._0x32df6a,..._0x5d5726,..._0x44b156];}export function resolveLocalFilePathFromLockKey(_0x5ee1a5,_0x37d12c){const _0x53970e=a128_0x37b847;return join(_0x5ee1a5[_0x53970e(0xdc)],..._0x37d12c[_0x53970e(0xdb)]('/'))+_0x53970e(0xf1);}export function createHookLocationMap(_0xd1f6ce){const _0x373cb3=a128_0x37b847,_0x3209d1=new Map();for(const _0x111b7d of _0xd1f6ce){_0x111b7d[_0x373cb3(0xf4)]&&_0x3209d1['set'](_0x111b7d[_0x373cb3(0xf4)],{'datasetCode':_0x111b7d['datasetCode'],'operationType':snakeToCamel(_0x111b7d[_0x373cb3(0xf5)]),'functionNode':_0x373cb3(0xea)}),_0x111b7d[_0x373cb3(0xda)]&&_0x3209d1[_0x373cb3(0xd6)](_0x111b7d['afterScriptId'],{'datasetCode':_0x111b7d['datasetCode'],'operationType':snakeToCamel(_0x111b7d['operationType']),'functionNode':'after'});}return _0x3209d1;}export function resolveRemoteScriptTarget(_0x55f15a,_0x469e11,_0x2b1dbb,_0x2dad3d,_0xb0773){const _0x266304=a128_0x37b847,_0x3cbd58=normalizeBffType(_0x469e11[_0x266304(0xf0)]);if(!_0x3cbd58||!_0x469e11[_0x266304(0xe1)])return null;if(_0x3cbd58===_0x266304(0xe3)){const _0x2e8773=(_0x469e11['id']?_0x2b1dbb[_0x266304(0xf8)](_0x469e11['id']):undefined)??findHookLocationByRemoteId(_0x2dad3d,_0x469e11['id']);if(!_0x2e8773)return null;const _0x33c4d4=_0x2e8773['alias']||_0xb0773['get'](_0x2e8773[_0x266304(0xfc)]),_0xd0bedd=_0x33c4d4??_0x2e8773[_0x266304(0xfc)],_0x1953de={..._0x2e8773,'alias':_0x33c4d4},_0x5203fd=_0x266304(0xf2)+_0xd0bedd+'/'+_0x1953de['operationType']+'/'+_0x1953de[_0x266304(0xdf)]+'/'+_0x469e11['functionName'];return{'lockKey':_0x5203fd,'filePath':resolveLocalFilePathFromLockKey(_0x55f15a,_0x5203fd),'type':'HOOK','hookLocation':_0x1953de};}const _0x29d663=_0x3cbd58+'/'+_0x469e11[_0x266304(0xe1)];return{'lockKey':_0x29d663,'filePath':resolveLocalFilePathFromLockKey(_0x55f15a,_0x29d663),'type':_0x3cbd58};}export async function ensureParentDirectory(_0x53540f){await mkdir(dirname(_0x53540f),{'recursive':!![]});}export async function fileExists(_0x249680){const _0x1b7fc3=a128_0x37b847;try{return await access(_0x249680,constants[_0x1b7fc3(0xec)]),!![];}catch{return![];}}export async function directoryExists(_0x535463){const _0x9bc294=a128_0x37b847;try{const _0x1171e4=await stat(_0x535463);return _0x1171e4[_0x9bc294(0xe4)]();}catch{return![];}}
|
package/lib/core/bff/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5d053a,_0x214c3f){const _0xd32771=a129_0x4665,_0x114d49=_0x5d053a();while(!![]){try{const _0x1f5879=-parseInt(_0xd32771(0xff))/0x1*(-parseInt(_0xd32771(0xfa))/0x2)+parseInt(_0xd32771(0xf8))/0x3*(-parseInt(_0xd32771(0xf7))/0x4)+-parseInt(_0xd32771(0xfd))/0x5+-parseInt(_0xd32771(0xfe))/0x6*(parseInt(_0xd32771(0xf0))/0x7)+parseInt(_0xd32771(0xf6))/0x8+-parseInt(_0xd32771(0xf2))/0x9*(parseInt(_0xd32771(0xf5))/0xa)+parseInt(_0xd32771(0xfc))/0xb;if(_0x1f5879===_0x214c3f)break;else _0x114d49['push'](_0x114d49['shift']());}catch(_0x13f81c){_0x114d49['push'](_0x114d49['shift']());}}}(a129_0x4fbc,0xca351));function a129_0x4665(_0x541722,_0x24af5f){_0x541722=_0x541722-0xf0;const _0x4fbcac=a129_0x4fbc();let _0x4665fb=_0x4fbcac[_0x541722];return _0x4665fb;}import{readFile}from'node:fs/promises';function a129_0x4fbc(){const _0x24f67d=['489VrLifR','md5','10cgNrMt','createHash','39105539JKFRUp','5164660qUscpc','6018fzfNQR','221921SxVVll','11018XvmUHC','hex','36VOcUZQ','digest','update','1041010VXOTLS','3718704UPBnuV','31244ONHvHD'];a129_0x4fbc=function(){return _0x24f67d;};return a129_0x4fbc();}import a129_0x56781d from'node:crypto';export function computeContentHash(_0x3760b1){const _0x333857=a129_0x4665;return a129_0x56781d[_0x333857(0xfb)](_0x333857(0xf9))[_0x333857(0xf4)](_0x3760b1)[_0x333857(0xf3)](_0x333857(0xf1));}export async function computeFileHash(_0x10b904){const _0x349059=await readFile(_0x10b904,'utf8');return computeContentHash(_0x349059);}
|
package/lib/core/bff/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x6c1565,_0x2c0a57){const _0x2cbe58=a130_0x4e95,_0xb640ba=_0x6c1565();while(!![]){try{const _0x2a9b9c=parseInt(_0x2cbe58(0x122))/0x1*(-parseInt(_0x2cbe58(0x120))/0x2)+-parseInt(_0x2cbe58(0x129))/0x3*(-parseInt(_0x2cbe58(0x11d))/0x4)+parseInt(_0x2cbe58(0x114))/0x5+parseInt(_0x2cbe58(0x116))/0x6*(-parseInt(_0x2cbe58(0x11b))/0x7)+parseInt(_0x2cbe58(0x121))/0x8+parseInt(_0x2cbe58(0x12b))/0x9+parseInt(_0x2cbe58(0x117))/0xa*(-parseInt(_0x2cbe58(0x113))/0xb);if(_0x2a9b9c===_0x2c0a57)break;else _0xb640ba['push'](_0xb640ba['shift']());}catch(_0x429475){_0xb640ba['push'](_0xb640ba['shift']());}}}(a130_0x219f,0xc1ce8));import{mkdir,readFile,writeFile}from'node:fs/promises';function a130_0x4e95(_0x2e2f45,_0x350f43){_0x2e2f45=_0x2e2f45-0x112;const _0x219fca=a130_0x219f();let _0x4e951e=_0x219fca[_0x2e2f45];return _0x4e951e;}function a130_0x219f(){const _0xb76a45=['utf8','current\x20\x22','807tvreCJ','Check\x20.rabetbase/bff.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','529452haGEde','Failed\x20to\x20read\x20BFF\x20lock\x20file:\x20','176869DuBKix','6134865teROvk','functions','16602eSpnWH','770QWFvod','scriptsRoot','\x22\x20vs\x20lock\x20\x22','parse','476VkyAPs','ENOENT','19164JoJPhS','stringify','apps','31294pnUYIb','4424136epPnae','58ydaWSM','object','lastSync','\x22.\x20',':\x20scriptsRoot\x20mismatch\x20—\x20'];a130_0x219f=function(){return _0xb76a45;};return a130_0x219f();}import{dirname}from'node:path';export function createEmptyBffLock(){return{'apps':{}};}export function ensureLockScope(_0x2a6b18,_0x387aa7,_0x167a8f,_0x3ae9f6){const _0x34078a=a130_0x4e95,_0x597edb={'apps':_0x2a6b18[_0x34078a(0x11f)]&&typeof _0x2a6b18[_0x34078a(0x11f)]===_0x34078a(0x123)?_0x2a6b18[_0x34078a(0x11f)]:{}};let _0x5502e0=_0x597edb[_0x34078a(0x11f)][_0x387aa7];if(!_0x5502e0)return _0x5502e0={'scriptsRoot':_0x167a8f,'lastSync':'','functions':{}},_0x597edb[_0x34078a(0x11f)][_0x387aa7]=_0x5502e0,{'lockData':_0x597edb,'appLock':_0x5502e0};if(!_0x5502e0[_0x34078a(0x118)])_0x5502e0[_0x34078a(0x118)]=_0x167a8f;else{if(_0x5502e0[_0x34078a(0x118)]!==_0x167a8f)throw new Error(_0x3ae9f6+_0x34078a(0x126)+(_0x34078a(0x128)+_0x167a8f+_0x34078a(0x119)+_0x5502e0['scriptsRoot']+_0x34078a(0x125))+_0x34078a(0x12a));}return!_0x5502e0[_0x34078a(0x115)]&&(_0x5502e0[_0x34078a(0x115)]={}),!_0x5502e0[_0x34078a(0x124)]&&(_0x5502e0[_0x34078a(0x124)]=''),{'lockData':_0x597edb,'appLock':_0x5502e0};}export async function readBffLockFile(_0x6142cf){const _0x1d5b50=a130_0x4e95;try{const _0x388ede=await readFile(_0x6142cf,_0x1d5b50(0x127)),_0x5e5895=JSON[_0x1d5b50(0x11a)](_0x388ede);return{'apps':_0x5e5895[_0x1d5b50(0x11f)]&&typeof _0x5e5895['apps']===_0x1d5b50(0x123)?_0x5e5895[_0x1d5b50(0x11f)]:{}};}catch(_0x2d717e){if(_0x2d717e['code']===_0x1d5b50(0x11c))return null;throw new Error(_0x1d5b50(0x112)+String(_0x2d717e));}}export async function writeBffLockFile(_0x11230d,_0x4bbbda){const _0x33b3a6=a130_0x4e95;await mkdir(dirname(_0x11230d),{'recursive':!![]}),await writeFile(_0x11230d,JSON[_0x33b3a6(0x11e)](_0x4bbbda,null,0x2),_0x33b3a6(0x127));}
|
package/lib/core/bff/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a132_0x46b8(){const _0x5f711a=['632616uyqElT','236798dadIDU','test','993433fZUBSS','after','match','toLowerCase','remoteId','before','336738oVrjbt','50444BjNAsx','datasetCode','functionNode','values','1697712nbptlk','1uDzSsM','460ZJbDho','5mwgdab','trim','operationType','38124TDeyVo','replace'];a132_0x46b8=function(){return _0x5f711a;};return a132_0x46b8();}(function(_0x4ee98c,_0x400373){const _0x335c98=a132_0x5174,_0x320b36=_0x4ee98c();while(!![]){try{const _0x54f044=-parseInt(_0x335c98(0x1bb))/0x1*(-parseInt(_0x335c98(0x1c3))/0x2)+-parseInt(_0x335c98(0x1c2))/0x3+-parseInt(_0x335c98(0x1b6))/0x4+parseInt(_0x335c98(0x1bd))/0x5*(parseInt(_0x335c98(0x1b5))/0x6)+parseInt(_0x335c98(0x1c5))/0x7+parseInt(_0x335c98(0x1ba))/0x8+-parseInt(_0x335c98(0x1c0))/0x9*(parseInt(_0x335c98(0x1bc))/0xa);if(_0x54f044===_0x400373)break;else _0x320b36['push'](_0x320b36['shift']());}catch(_0x39f824){_0x320b36['push'](_0x320b36['shift']());}}}(a132_0x46b8,0x1aeec));export function snakeToCamel(_0x4da052){const _0xd46477=a132_0x5174;return _0x4da052[_0xd46477(0x1c8)]()[_0xd46477(0x1c1)](/_([a-z])/g,(_0x206190,_0xd47c33)=>_0xd47c33['toUpperCase']());}export function findHookLocationByRemoteId(_0x1b3785,_0x43877b){const _0x4c2e0c=a132_0x5174;if(!_0x43877b)return undefined;for(const _0x23d2d4 of Object[_0x4c2e0c(0x1b9)](_0x1b3785)){if(_0x23d2d4[_0x4c2e0c(0x1c9)]===_0x43877b&&_0x23d2d4[_0x4c2e0c(0x1b7)]&&_0x23d2d4[_0x4c2e0c(0x1bf)]&&_0x23d2d4[_0x4c2e0c(0x1b8)])return{'datasetCode':_0x23d2d4[_0x4c2e0c(0x1b7)],'operationType':_0x23d2d4['operationType'],'functionNode':_0x23d2d4[_0x4c2e0c(0x1b8)]};}return undefined;}export function extractScriptDescription(_0x39c224){const _0x12d10f=a132_0x5174,_0x53b46b=_0x39c224[_0x12d10f(0x1c7)](/\[\s*脚本描述\s*]\s*(.+)/);return _0x53b46b?.[0x1]?.[_0x12d10f(0x1be)]()||undefined;}function a132_0x5174(_0x2414d8,_0x5704c0){_0x2414d8=_0x2414d8-0x1b5;const _0x46b84a=a132_0x46b8();let _0x5174e4=_0x46b84a[_0x2414d8];return _0x5174e4;}export function isValidBffFunctionName(_0x35206f){const _0x37de09=a132_0x5174;return/^[A-Za-z_$][A-Za-z0-9_$]*$/[_0x37de09(0x1c4)](_0x35206f);}export function normalizeHookFunctionNode(_0x998b4a){const _0x208ce4=a132_0x5174;if(!_0x998b4a)return undefined;const _0x315cdb=_0x998b4a[_0x208ce4(0x1be)]()[_0x208ce4(0x1c8)]();if(_0x315cdb===_0x208ce4(0x1ca)||_0x315cdb===_0x208ce4(0x1c6))return _0x315cdb;return undefined;}
|
package/lib/core/db-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xa5a544,_0x281ce6){const _0xd7e7ea=a133_0x246c,_0x512015=_0xa5a544();while(!![]){try{const _0x9d2ba9=-parseInt(_0xd7e7ea(0x103))/0x1*(parseInt(_0xd7e7ea(0xfb))/0x2)+parseInt(_0xd7e7ea(0xfc))/0x3*(-parseInt(_0xd7e7ea(0x104))/0x4)+parseInt(_0xd7e7ea(0xff))/0x5+parseInt(_0xd7e7ea(0xf1))/0x6+parseInt(_0xd7e7ea(0xfd))/0x7+parseInt(_0xd7e7ea(0x100))/0x8+parseInt(_0xd7e7ea(0xee))/0x9*(-parseInt(_0xd7e7ea(0xfe))/0xa);if(_0x9d2ba9===_0x281ce6)break;else _0x512015['push'](_0x512015['shift']());}catch(_0x1f8164){_0x512015['push'](_0x512015['shift']());}}}(a133_0x35dd,0x67660));import{listDatasets}from'../core/api-client.js';const cache=new Map();function a133_0x246c(_0x3ce47e,_0x28a709){_0x3ce47e=_0x3ce47e-0xed;const _0x35ddf8=a133_0x35dd();let _0x246c3e=_0x35ddf8[_0x3ce47e];return _0x246c3e;}export async function listDatabases(_0x58f5c0){const _0x245d1a=a133_0x246c;if(cache[_0x245d1a(0xf8)](_0x58f5c0))return cache[_0x245d1a(0xf2)](_0x58f5c0);const _0x18e41a=await listDatasets(_0x58f5c0),_0x24f497=new Map();for(const _0x400c5a of _0x18e41a){const _0x10b263=_0x400c5a[_0x245d1a(0xf3)];_0x10b263?.[_0x245d1a(0xf4)]!=null&&_0x24f497[_0x245d1a(0xfa)](_0x10b263[_0x245d1a(0xf4)],_0x10b263[_0x245d1a(0xef)]??'db-'+_0x10b263[_0x245d1a(0xf4)]);}const _0x18871f=[..._0x24f497[_0x245d1a(0xf9)]()]['map'](([_0x5b2e97,_0x8017fd])=>({'dbId':_0x5b2e97,'dbName':_0x8017fd}));return cache[_0x245d1a(0xfa)](_0x58f5c0,_0x18871f),_0x18871f;}function a133_0x35dd(){const _0x57dc99=['1516NvEHWP','toLowerCase','\x22\x20matches\x20multiple\x20databases:\x20','\x22.\x20Available:\x20','6370848IpDLQE','dbName','find','1346208DEwUgx','get','dbtableConfig','dbId','filter','length','join','has','entries','set','2rVRbmy','1203vTGwpI','722071ZrvrjZ','10csYLUc','1763145bPnSXm','6748240xqtJdE','map','No\x20linked\x20databases\x20found\x20for\x20this\x20app.\x20Make\x20sure\x20datasets\x20have\x20been\x20created.','240309dQDHnF'];a133_0x35dd=function(){return _0x57dc99;};return a133_0x35dd();}export async function resolveDb(_0x50ea85,_0xfae6d3){const _0x5078c2=a133_0x246c,_0x50fc9e=await listDatabases(_0x50ea85);if(_0x50fc9e[_0x5078c2(0xf6)]===0x0)return{'resolved':[],'error':_0x5078c2(0x102)};if(!_0xfae6d3)return{'resolved':_0x50fc9e};const _0x430fab=Number(_0xfae6d3);if(!Number['isNaN'](_0x430fab)){const _0x48d0f8=_0x50fc9e[_0x5078c2(0xf0)](_0x161c86=>_0x161c86[_0x5078c2(0xf4)]===_0x430fab);if(_0x48d0f8)return{'resolved':[_0x48d0f8]};}const _0xfa0617=_0xfae6d3[_0x5078c2(0x105)](),_0x6989c6=_0x50fc9e[_0x5078c2(0xf5)](_0x5c9858=>_0x5c9858[_0x5078c2(0xef)][_0x5078c2(0x105)]()['includes'](_0xfa0617));if(_0x6989c6[_0x5078c2(0xf6)]>0x0)return{'resolved':_0x6989c6};const _0x85d7e7=_0x50fc9e[_0x5078c2(0x101)](_0xa7d253=>_0xa7d253['dbName']+'\x20('+_0xa7d253['dbId']+')')['join'](',\x20');return{'resolved':[],'error':'No\x20database\x20matching\x20\x22'+_0xfae6d3+_0x5078c2(0xed)+_0x85d7e7};}export async function resolveOneDb(_0x59a297,_0x201615){const _0x419b1a=a133_0x246c,{resolved:_0x3cb449,error:_0x2260f1}=await resolveDb(_0x59a297,_0x201615);if(_0x2260f1)return{'db':null,'error':_0x2260f1};if(_0x3cb449[_0x419b1a(0xf6)]===0x1)return{'db':_0x3cb449[0x0]};if(!_0x201615){const _0x2cab9c=_0x3cb449[_0x419b1a(0x101)](_0x53432c=>_0x53432c[_0x419b1a(0xef)]+'\x20('+_0x53432c[_0x419b1a(0xf4)]+')')[_0x419b1a(0xf7)](',\x20');return{'db':null,'error':'Multiple\x20databases\x20found.\x20Specify\x20one\x20with\x20--db:\x20'+_0x2cab9c};}const _0x2ae284=_0x3cb449[_0x419b1a(0x101)](_0x12f655=>_0x12f655[_0x419b1a(0xef)]+'\x20('+_0x12f655[_0x419b1a(0xf4)]+')')[_0x419b1a(0xf7)](',\x20');return{'db':null,'error':'\x22'+_0x201615+_0x419b1a(0x106)+_0x2ae284+'.\x20Be\x20more\x20specific.'};}export async function getDbName(_0x368b89,_0xd588c2){const _0x3ad5cf=a133_0x246c,_0x16c845=await listDatabases(_0x368b89);return _0x16c845['find'](_0x16dc81=>_0x16dc81[_0x3ad5cf(0xf4)]===_0xd588c2)?.[_0x3ad5cf(0xef)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a134_0x2b1a11=a134_0x1e05;(function(_0x37aa56,_0xd5f63f){const _0x58d8cc=a134_0x1e05,_0x530091=_0x37aa56();while(!![]){try{const _0x55edab=parseInt(_0x58d8cc(0xb7))/0x1*(-parseInt(_0x58d8cc(0xa9))/0x2)+-parseInt(_0x58d8cc(0xb0))/0x3+parseInt(_0x58d8cc(0xaf))/0x4+-parseInt(_0x58d8cc(0xb3))/0x5*(-parseInt(_0x58d8cc(0xb5))/0x6)+-parseInt(_0x58d8cc(0xab))/0x7*(parseInt(_0x58d8cc(0xb2))/0x8)+-parseInt(_0x58d8cc(0xb6))/0x9+-parseInt(_0x58d8cc(0xac))/0xa*(-parseInt(_0x58d8cc(0xa7))/0xb);if(_0x55edab===_0xd5f63f)break;else _0x530091['push'](_0x530091['shift']());}catch(_0x1b607b){_0x530091['push'](_0x530091['shift']());}}}(a134_0x148e,0xb3521));import{constants}from'node:fs';import{access,mkdir}from'node:fs/promises';function a134_0x1e05(_0x146e3e,_0x403a3c){_0x146e3e=_0x146e3e-0xa7;const _0x148edd=a134_0x148e();let _0x1e0532=_0x148edd[_0x146e3e];return _0x1e0532;}import{dirname,join,resolve}from'node:path';export function loadPageProjectConfig(_0x1fdeef,_0x1b305f=process[a134_0x2b1a11(0xa8)]()){const _0x47409e=a134_0x2b1a11,_0x4e33d0=resolve(_0x1b305f),_0x4cb6d3=join(_0x4e33d0,_0x47409e(0xae),_0x47409e(0xb1));return{'projectRoot':_0x4e33d0,'pagesBaseDir':_0x4cb6d3,'appPagesDir':join(_0x4cb6d3,_0x1fdeef),'lockFilePath':join(_0x4e33d0,_0x47409e(0xae),_0x47409e(0xb4))};}export function buildPageFileName(_0x187a4c,_0x27c5a0){const _0x39ece8=a134_0x2b1a11;return _0x187a4c+'-'+String(_0x27c5a0)[_0x39ece8(0xaa)]()+_0x39ece8(0xad);}export function resolvePageFilePath(_0x512b05,_0xc65c8a,_0xb8ef9e){return join(_0x512b05['appPagesDir'],buildPageFileName(_0xc65c8a,_0xb8ef9e));}function a134_0x148e(){const _0x18f6b3=['toUpperCase','4088pwxVQV','3700ixmEzc','.json','.rabetbase','4119664tYsPow','3748476wtzFma','page','6544ADSPUE','5cvksFf','page.lock.json','2689638WBDtvs','12390399FLDAYT','1325347EvYsJO','109571aXeeBA','cwd','2jxvhDq'];a134_0x148e=function(){return _0x18f6b3;};return a134_0x148e();}export async function ensureParentDirectory(_0x89f74){await mkdir(dirname(_0x89f74),{'recursive':!![]});}export async function fileExists(_0x19dd12){try{return await access(_0x19dd12,constants['F_OK']),!![];}catch{return![];}}
|
package/lib/core/page/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x545f9c,_0x5d8ced){const _0xb42b2e=a135_0x5dd7,_0x194ac6=_0x545f9c();while(!![]){try{const _0x1303a9=-parseInt(_0xb42b2e(0x102))/0x1+-parseInt(_0xb42b2e(0x103))/0x2+-parseInt(_0xb42b2e(0xf8))/0x3+parseInt(_0xb42b2e(0xfd))/0x4+-parseInt(_0xb42b2e(0xff))/0x5*(parseInt(_0xb42b2e(0xfc))/0x6)+parseInt(_0xb42b2e(0xfa))/0x7*(-parseInt(_0xb42b2e(0x104))/0x8)+parseInt(_0xb42b2e(0xfe))/0x9;if(_0x1303a9===_0x5d8ced)break;else _0x194ac6['push'](_0x194ac6['shift']());}catch(_0x33c2a9){_0x194ac6['push'](_0x194ac6['shift']());}}}(a135_0x419d,0xc6bd5));import a135_0x1a8ebe from'node:crypto';function a135_0x419d(){const _0x1f6d27=['131670slfKMZ','2881474FVHXZI','8Aqbjgl','md5','4599711eROnML','digest','5901826FePlkw','stringify','60VEaTCI','164308WfXsHl','50370228vJGlJz','437485daURCC','update','hex'];a135_0x419d=function(){return _0x1f6d27;};return a135_0x419d();}import{readFile}from'node:fs/promises';export function serializePageSchemaForFile(_0xd36e44){const _0x3a28d0=a135_0x5dd7;return JSON[_0x3a28d0(0xfb)](JSON['parse'](_0xd36e44),null,0x2)+'\x0a';}function a135_0x5dd7(_0x20a95b,_0x3c0509){_0x20a95b=_0x20a95b-0xf8;const _0x419d4e=a135_0x419d();let _0x5dd78c=_0x419d4e[_0x20a95b];return _0x5dd78c;}export function computePageContentHash(_0x372b48){const _0x239e89=a135_0x5dd7;return a135_0x1a8ebe['createHash'](_0x239e89(0x105))[_0x239e89(0x100)](_0x372b48)[_0x239e89(0xf9)](_0x239e89(0x101));}export function computeSerializedSchemaHash(_0x6821c1){return computePageContentHash(serializePageSchemaForFile(_0x6821c1));}export async function computePageFileHash(_0x1d5ed4){const _0x39a45e=await readFile(_0x1d5ed4,'utf8');return computePageContentHash(_0x39a45e);}
|
package/lib/core/page/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5d97da,_0x2891d6){const _0x22e970=a136_0x44a5,_0x2c73c3=_0x5d97da();while(!![]){try{const _0x3e8d33=-parseInt(_0x22e970(0x1a7))/0x1*(parseInt(_0x22e970(0x1aa))/0x2)+parseInt(_0x22e970(0x1a4))/0x3*(parseInt(_0x22e970(0x1a6))/0x4)+parseInt(_0x22e970(0x1a2))/0x5+parseInt(_0x22e970(0x1a9))/0x6*(parseInt(_0x22e970(0x1ae))/0x7)+-parseInt(_0x22e970(0x1af))/0x8+-parseInt(_0x22e970(0x1b3))/0x9*(parseInt(_0x22e970(0x1b0))/0xa)+-parseInt(_0x22e970(0x1b2))/0xb*(-parseInt(_0x22e970(0x1a3))/0xc);if(_0x3e8d33===_0x2891d6)break;else _0x2c73c3['push'](_0x2c73c3['shift']());}catch(_0x38ce01){_0x2c73c3['push'](_0x2c73c3['shift']());}}}(a136_0x4750,0xd8dc2));import{mkdir,readFile,writeFile}from'node:fs/promises';function a136_0x44a5(_0x1dea19,_0x27e7ea){_0x1dea19=_0x1dea19-0x1a2;const _0x4750a1=a136_0x4750();let _0x44a530=_0x4750a1[_0x1dea19];return _0x44a530;}function a136_0x4750(){const _0x2dd9c7=['apps','608045Gtkmmx','389868pGQxnv','249813GGSHIj','Failed\x20to\x20read\x20page\x20lock\x20file:\x20','28LTklaS','675npyFNh','utf8','6xLEWUu','5048GmFXtd','object','pages','stringify','3514021OcmqDV','13299296EPatVv','168550CazmIu','lastSync','1089ccSKlx','90fryDMK','ENOENT'];a136_0x4750=function(){return _0x2dd9c7;};return a136_0x4750();}import{dirname}from'node:path';export function createEmptyPageLock(){return{'apps':{}};}export function ensurePageLockScope(_0x1f721a,_0x1f5f17){const _0x24c8ba=a136_0x44a5,_0x11eb41={'apps':_0x1f721a[_0x24c8ba(0x1b5)]&&typeof _0x1f721a[_0x24c8ba(0x1b5)]===_0x24c8ba(0x1ab)?_0x1f721a['apps']:{}};let _0x574377=_0x11eb41[_0x24c8ba(0x1b5)][_0x1f5f17];if(!_0x574377)return _0x574377={'lastSync':'','pages':{}},_0x11eb41[_0x24c8ba(0x1b5)][_0x1f5f17]=_0x574377,{'lockData':_0x11eb41,'appLock':_0x574377};return!_0x574377['lastSync']&&(_0x574377[_0x24c8ba(0x1b1)]=''),(!_0x574377[_0x24c8ba(0x1ac)]||typeof _0x574377[_0x24c8ba(0x1ac)]!==_0x24c8ba(0x1ab))&&(_0x574377['pages']={}),{'lockData':_0x11eb41,'appLock':_0x574377};}export async function readPageLockFile(_0x156c42){const _0x14f318=a136_0x44a5;try{const _0x29ebd2=await readFile(_0x156c42,_0x14f318(0x1a8)),_0x5ba5b3=JSON['parse'](_0x29ebd2);return{'apps':_0x5ba5b3[_0x14f318(0x1b5)]&&typeof _0x5ba5b3[_0x14f318(0x1b5)]===_0x14f318(0x1ab)?_0x5ba5b3['apps']:{}};}catch(_0x3d2552){if(_0x3d2552['code']===_0x14f318(0x1b4))return null;throw new Error(_0x14f318(0x1a5)+String(_0x3d2552));}}export async function writePageLockFile(_0x598fb9,_0x75d349){const _0x4f1ce6=a136_0x44a5;await mkdir(dirname(_0x598fb9),{'recursive':!![]}),await writeFile(_0x598fb9,JSON[_0x4f1ce6(0x1ad)](_0x75d349,null,0x2),_0x4f1ce6(0x1a8));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a138_0x25a8c5=a138_0x5698;function a138_0x5698(_0x3c8942,_0x229b4f){_0x3c8942=_0x3c8942-0xa8;const _0x1f6c69=a138_0x1f6c();let _0x56989a=_0x1f6c69[_0x3c8942];return _0x56989a;}(function(_0x5523d4,_0x50bf5d){const _0x4810a2=a138_0x5698,_0x51f85f=_0x5523d4();while(!![]){try{const _0x490589=-parseInt(_0x4810a2(0xa8))/0x1+-parseInt(_0x4810a2(0xb6))/0x2*(parseInt(_0x4810a2(0xad))/0x3)+parseInt(_0x4810a2(0xb2))/0x4+-parseInt(_0x4810a2(0xb1))/0x5*(-parseInt(_0x4810a2(0xb7))/0x6)+parseInt(_0x4810a2(0xab))/0x7*(parseInt(_0x4810a2(0xb4))/0x8)+parseInt(_0x4810a2(0xae))/0x9+-parseInt(_0x4810a2(0xb3))/0xa*(-parseInt(_0x4810a2(0xac))/0xb);if(_0x490589===_0x50bf5d)break;else _0x51f85f['push'](_0x51f85f['shift']());}catch(_0x18198d){_0x51f85f['push'](_0x51f85f['shift']());}}}(a138_0x1f6c,0xd706d));import{resolve}from'node:path';import{findProjectRootDirectory}from'../../context.js';const DOT_DIR=a138_0x25a8c5(0xaf),LOCK_FILE_NAME=a138_0x25a8c5(0xa9),TRASH_DIR_NAME=a138_0x25a8c5(0xaa);export function loadSqlProjectConfig(_0x27b3a6,_0x1f1eae){const _0x56143d=a138_0x25a8c5,_0x2a0eba=resolve(_0x1f1eae??findProjectRootDirectory()),_0x5a1d8f=DOT_DIR+_0x56143d(0xb5),_0x49821d=_0x5a1d8f+'/'+_0x27b3a6;return{'projectRoot':_0x2a0eba,'appCode':_0x27b3a6,'sqlWorkspaceRoot':_0x5a1d8f,'sqlRoot':_0x49821d,'sqlRootDir':resolve(_0x2a0eba,DOT_DIR,_0x56143d(0xb0),_0x27b3a6),'lockFilePath':resolve(_0x2a0eba,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x2a0eba,DOT_DIR,TRASH_DIR_NAME)};}function a138_0x1f6c(){const _0x35daf5=['2256064KJnzfs','50XaRHHX','152NzEpwm','/sql','2460Jrplph','358446EkMlhh','1094287kNoXrX','sql.lock.json','sql-trash','167881ScSEGx','765259gzfUBn','1788txrcVi','10452195gZheiN','.rabetbase','sql','15bcgvag'];a138_0x1f6c=function(){return _0x35daf5;};return a138_0x1f6c();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a139_0x40d4(_0x549b4e,_0x10b935){_0x549b4e=_0x549b4e-0x187;const _0x7741fa=a139_0x7741();let _0x40d421=_0x7741fa[_0x549b4e];return _0x40d421;}function a139_0x7741(){const _0x5c4023=['sqlName','14622060JaBplW','isDirectory','1303870pjkqpT','filter','code','mybatisXml','80472AwRlsI','indexOf','21OXerCb','slice','length','test','sqlCode','toLowerCase','69rdEgJy','3107384PLaNva','ENOENT','102156vHUlGl','2716216YkdSCp','replace','5486832fOCvtY','name','.xml','24ZLfuSE','mode','.sql','11UpPsVk','push','split','sql','sqlRootDir','dbName'];a139_0x7741=function(){return _0x5c4023;};return a139_0x7741();}(function(_0x1a0390,_0x2975ea){const _0x4c578e=a139_0x40d4,_0x197eb4=_0x1a0390();while(!![]){try{const _0x481c33=-parseInt(_0x4c578e(0x19a))/0x1*(-parseInt(_0x4c578e(0x1a3))/0x2)+-parseInt(_0x4c578e(0x1a0))/0x3*(-parseInt(_0x4c578e(0x198))/0x4)+-parseInt(_0x4c578e(0x194))/0x5*(-parseInt(_0x4c578e(0x188))/0x6)+parseInt(_0x4c578e(0x1a1))/0x7+-parseInt(_0x4c578e(0x1a4))/0x8+-parseInt(_0x4c578e(0x1a6))/0x9+parseInt(_0x4c578e(0x192))/0xa*(-parseInt(_0x4c578e(0x18b))/0xb);if(_0x481c33===_0x2975ea)break;else _0x197eb4['push'](_0x197eb4['shift']());}catch(_0x4a3c29){_0x197eb4['push'](_0x197eb4['shift']());}}}(a139_0x7741,0x952a3));import{readdir,stat}from'node:fs/promises';import{extname,join,relative}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath}from'./utils.js';function extensionToMode(_0x1d49fe){const _0x3b329c=a139_0x40d4;if(_0x1d49fe===_0x3b329c(0x18a))return'sql';if(_0x1d49fe===_0x3b329c(0x187))return _0x3b329c(0x197);return undefined;}async function scanSqlFilesRecursively(_0xfdeb2b,_0x16c2f3){const _0x53e815=a139_0x40d4,_0x259bcd=[];try{const _0x4c55c8=await readdir(_0xfdeb2b,{'withFileTypes':!![]});for(const _0x1622c7 of _0x4c55c8){const _0x4eb437=join(_0xfdeb2b,_0x1622c7[_0x53e815(0x1a7)]);if(_0x1622c7['isDirectory']()){_0x259bcd[_0x53e815(0x18c)](...await scanSqlFilesRecursively(_0x4eb437,_0x16c2f3));continue;}if(!_0x1622c7['isFile']())continue;const _0x3de9b9=extname(_0x1622c7['name'])[_0x53e815(0x19f)](),_0x362bb4=extensionToMode(_0x3de9b9);if(!_0x362bb4)continue;const _0x1da4c4=relative(_0x16c2f3,_0x4eb437)[_0x53e815(0x1a5)](/\\/g,'/'),_0x2ba6f6=_0x1da4c4[_0x53e815(0x18d)]('/')[_0x53e815(0x195)](Boolean),_0x4d9e6b=parseSqlPath(_0x2ba6f6,_0x1622c7['name'],_0x3de9b9);if(!_0x4d9e6b)continue;_0x259bcd[_0x53e815(0x18c)]({'sqlCode':_0x4d9e6b[_0x53e815(0x19e)],'sqlName':_0x4d9e6b[_0x53e815(0x191)],'dbDirectory':_0x2ba6f6[0x0],'filePath':_0x4eb437,'relativePath':_0x1da4c4,'lockKey':_0x4d9e6b[_0x53e815(0x19e)],'mode':_0x362bb4});}}catch(_0x43e8e5){if(_0x43e8e5[_0x53e815(0x196)]!==_0x53e815(0x1a2))throw _0x43e8e5;}return _0x259bcd;}export async function scanLocalSqlQueries(_0x53ea2f){const _0x37e87a=a139_0x40d4;return scanSqlFilesRecursively(_0x53ea2f[_0x37e87a(0x18f)],_0x53ea2f[_0x37e87a(0x18f)]);}export function resolveLocalSqlFilePath(_0x1415fe,_0x45fc65,_0x361bc9){const _0xa15ad2=a139_0x40d4,_0x3c594d=_0x361bc9?.['path']||(_0x361bc9?.[_0xa15ad2(0x191)]||_0x361bc9?.['dbName']?buildSqlRelativePath(_0x45fc65,_0x361bc9?.['sqlName'],_0x361bc9?.[_0xa15ad2(0x190)],_0x361bc9?.[_0xa15ad2(0x189)]||_0xa15ad2(0x18e),_0x361bc9?.['dbId']):buildDefaultSqlFileName(_0x45fc65,_0x361bc9?.[_0xa15ad2(0x189)]||_0xa15ad2(0x18e)));return join(_0x1415fe['sqlRootDir'],_0x3c594d);}export async function directoryExists(_0x157f72){const _0x7e3fca=a139_0x40d4;try{const _0x26fb0e=await stat(_0x157f72);return _0x26fb0e[_0x7e3fca(0x193)]();}catch{return![];}}function parseSqlPath(_0x17b620,_0x5e708e,_0x47c989){const _0x218d36=a139_0x40d4,_0x198af6=_0x5e708e[_0x218d36(0x19b)](0x0,-_0x47c989[_0x218d36(0x19c)]);if(_0x17b620[_0x218d36(0x19c)]<0x2)return null;const _0x54b852=_0x198af6[_0x218d36(0x199)]('_');if(_0x54b852<=0x0||_0x54b852>=_0x198af6['length']-0x1)return null;const _0x439636=_0x198af6[_0x218d36(0x19b)](0x0,_0x54b852);if(!isLikelySqlCode(_0x439636))return null;return{'sqlCode':_0x439636,'sqlName':_0x198af6[_0x218d36(0x19b)](_0x54b852+0x1)};}function isLikelySqlCode(_0x4290ef){const _0x2d1305=a139_0x40d4;return/^[A-Za-z0-9-]+-[A-Za-z0-9-]+$/[_0x2d1305(0x19d)](_0x4290ef);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5c0c38,_0x3b083){const _0x54eda2=a140_0x1710,_0x11fa81=_0x5c0c38();while(!![]){try{const _0x2c4259=parseInt(_0x54eda2(0xf3))/0x1+-parseInt(_0x54eda2(0xf4))/0x2+parseInt(_0x54eda2(0xf2))/0x3*(-parseInt(_0x54eda2(0xee))/0x4)+-parseInt(_0x54eda2(0xed))/0x5*(parseInt(_0x54eda2(0xef))/0x6)+parseInt(_0x54eda2(0xeb))/0x7+-parseInt(_0x54eda2(0xea))/0x8+parseInt(_0x54eda2(0xf5))/0x9;if(_0x2c4259===_0x3b083)break;else _0x11fa81['push'](_0x11fa81['shift']());}catch(_0x43da4b){_0x11fa81['push'](_0x11fa81['shift']());}}}(a140_0x36cc,0xd7ce0));function a140_0x1710(_0x279a86,_0x5ee64a){_0x279a86=_0x279a86-0xea;const _0x36cc8c=a140_0x36cc();let _0x17107b=_0x36cc8c[_0x279a86];return _0x17107b;}import{readFile}from'node:fs/promises';import a140_0x4b9b2c from'node:crypto';export function computeSqlContentHash(_0x4fdb29){const _0x4bfbd1=a140_0x1710;return a140_0x4b9b2c[_0x4bfbd1(0xf6)](_0x4bfbd1(0xf0))[_0x4bfbd1(0xec)](_0x4fdb29)[_0x4bfbd1(0xf1)]('hex');}export async function computeSqlFileHash(_0x1918c8){const _0x2b5fa9=await readFile(_0x1918c8,'utf8');return computeSqlContentHash(_0x2b5fa9);}function a140_0x36cc(){const _0x12b74f=['184FFvNku','96MhlZeb','md5','digest','2049VdwaQo','814804idofUF','3316478KqtPoo','29472975yCCYME','createHash','10031904dQCJYQ','1784622wTbOBh','update','161545KuONdy'];a140_0x36cc=function(){return _0x12b74f;};return a140_0x36cc();}
|