@lovrabet/rabetbase-cli 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/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/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.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-skill/index.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/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -0
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.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/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.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/relation-audit.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/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/commands/workspace/index.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/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.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/telemetry/send-platform-issue-collect-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/params.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/update-notice.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/lib/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a156_0x327c(_0x380067,_0xd7f3f9){_0x380067=_0x380067-0x19d;const _0x5cbce7=a156_0x5cbc();let _0x327c94=_0x5cbce7[_0x380067];return _0x327c94;}const a156_0x180b5e=a156_0x327c;(function(_0x12b1f9,_0x4f1342){const _0x1c8ff4=a156_0x327c,_0x4735e5=_0x12b1f9();while(!![]){try{const _0x4b7f7e=-parseInt(_0x1c8ff4(0x1b0))/0x1+parseInt(_0x1c8ff4(0x1aa))/0x2+-parseInt(_0x1c8ff4(0x1af))/0x3+parseInt(_0x1c8ff4(0x1b5))/0x4*(parseInt(_0x1c8ff4(0x1a7))/0x5)+parseInt(_0x1c8ff4(0x1ae))/0x6+-parseInt(_0x1c8ff4(0x1bd))/0x7+parseInt(_0x1c8ff4(0x1a3))/0x8;if(_0x4b7f7e===_0x4f1342)break;else _0x4735e5['push'](_0x4735e5['shift']());}catch(_0xf0125d){_0x4735e5['push'](_0x4735e5['shift']());}}}(a156_0x5cbc,0x91327));import{resolve}from'node:path';import{CLI_BIN_NAME}from'./constant/cli.js';import{buildAuth}from'./context/auth-resolver.js';import{resolveAppConfig}from'./context/app-resolver.js';import{CONFIG_NAMES,LEGACY_CONFIG_NAMES,NEW_CONFIG_NAME,findProjectRootDirectory,getGlobalConfigPath,getProjectConfigPath,inspectCliConfigJsonFile,isInProject,loadRawConfigLayers,mergeRawConfigLayers,readConfigFile,readRawConfig,readRawConfigWithLayers,resolveConfigPath,resolveWriteConfigPath,writeConfigFile}from'./context/config-loader.js';import{logger}from'./utils/logger.js';export{CONFIG_NAMES,LEGACY_CONFIG_NAMES,NEW_CONFIG_NAME,findProjectRootDirectory,getGlobalConfigPath,getProjectConfigPath,inspectCliConfigJsonFile,isInProject,loadRawConfigLayers,mergeRawConfigLayers,readConfigFile,readRawConfig,readRawConfigWithLayers,resolveConfigPath,resolveWriteConfigPath,writeConfigFile};function env(_0xf6c799){return process.env[`RABETBASE_${_0xf6c799}`]||process.env[`LOVRABET_${_0xf6c799}`]||undefined;}export async function createContext(_0x2f1e7c){const _0x5a1d4b=a156_0x327c,{config:_0x2a94be,layers:_0x1a8c77}=readRawConfigWithLayers(),_0x2369b1=buildConfig(_0x2a94be,_0x2f1e7c,_0x1a8c77),{initEnv:_0x4bda31}=await import(_0x5a1d4b(0x1a4));if(_0x2369b1[_0x5a1d4b(0x19f)])_0x4bda31(_0x2369b1['env']);else _0x2f1e7c[_0x5a1d4b(0x19f)]&&typeof _0x2f1e7c['env']==='string'&&_0x4bda31(_0x2f1e7c['env']);const {initDomains:_0x4c27fb,getUserDomain:_0x3fc926,getApiDomain:_0x41a046}=await import(_0x5a1d4b(0x1b1));_0x4c27fb({'apiDomain':_0x2a94be[_0x5a1d4b(0x1bc)]||undefined,'userDomain':_0x2a94be[_0x5a1d4b(0x1c5)]||undefined,'runtimeDomain':_0x2a94be[_0x5a1d4b(0x1bf)]||undefined});const _0x4fadd9={'apiDomain':_0x41a046(),'userDomain':_0x3fc926()},_0x447eac=await buildAuth(_0x2369b1);logger[_0x5a1d4b(0x1a1)](process[_0x5a1d4b(0x1c1)]());const _0x24897b=(CLI_BIN_NAME+'\x20'+process[_0x5a1d4b(0x1a8)][_0x5a1d4b(0x1b8)](0x2)['join']('\x20'))[_0x5a1d4b(0x1b7)]();logger['setRawCommand'](_0x24897b);const {isNonInteractive:_0x310cd2}=await import(_0x5a1d4b(0x1c0)),_0x5ce6c3=_0x310cd2(_0x2f1e7c);return{'config':_0x2369b1,'auth':_0x447eac,'logger':logger,'env':_0x4fadd9,'nonInteractive':_0x5ce6c3};}export function buildConfigFromFlags(_0x68cc0){const {config:_0xd1ee8d,layers:_0xd38615}=readRawConfigWithLayers();return buildConfig(_0xd1ee8d,_0x68cc0,_0xd38615);}export function getConfigAppCode(_0x1451c9){const _0x2f7015=a156_0x327c,_0x3cdd42=readRawConfig(_0x1451c9);if(_0x3cdd42[_0x2f7015(0x1ad)]&&typeof _0x3cdd42[_0x2f7015(0x1ad)]===_0x2f7015(0x1bb)){const _0x2c6527=_0x3cdd42[_0x2f7015(0x1ba)];if(_0x2c6527&&_0x3cdd42[_0x2f7015(0x1ad)][_0x2c6527]?.[_0x2f7015(0x1c3)])return String(_0x3cdd42[_0x2f7015(0x1ad)][_0x2c6527][_0x2f7015(0x1c3)])[_0x2f7015(0x1b7)]();const _0x4cd912=Object[_0x2f7015(0x1b3)](_0x3cdd42[_0x2f7015(0x1ad)])[0x0];if(_0x4cd912?.[_0x2f7015(0x1c3)])return String(_0x4cd912[_0x2f7015(0x1c3)])['trim']();}const _0x920112=_0x3cdd42[_0x2f7015(0x1c3)]||_0x3cdd42['app'];if(typeof _0x920112!==_0x2f7015(0x1b6)||_0x920112[_0x2f7015(0x1b7)]()==='')return undefined;return _0x920112['trim']();}export function getMultiAppConfigs(_0x28b40b=a156_0x180b5e(0x1a9),_0x12f7a0){const _0x454fc6=a156_0x180b5e,_0x3073c5=loadRawConfigLayers(_0x12f7a0);let _0x167cb1,_0x49d421;if(_0x28b40b===_0x454fc6(0x1b2)){const _0x5c962a=_0x3073c5[_0x454fc6(0x19e)][_0x454fc6(0x1ad)]&&typeof _0x3073c5['globalConfig'][_0x454fc6(0x1ad)]===_0x454fc6(0x1bb)?_0x3073c5[_0x454fc6(0x19e)]['apps']:{},_0x42b995=_0x3073c5[_0x454fc6(0x1ac)][_0x454fc6(0x1ad)]&&typeof _0x3073c5[_0x454fc6(0x1ac)]['apps']===_0x454fc6(0x1bb)?_0x3073c5[_0x454fc6(0x1ac)]['apps']:{};_0x167cb1={..._0x5c962a,..._0x42b995};const _0xf1a35c=readRawConfig(_0x12f7a0);_0x49d421=_0xf1a35c[_0x454fc6(0x1ba)];}else _0x167cb1=_0x3073c5[_0x454fc6(0x1ac)]['apps'],_0x49d421=_0x3073c5[_0x454fc6(0x1ac)][_0x454fc6(0x1ba)];if(!_0x167cb1||typeof _0x167cb1!=='object'||Object[_0x454fc6(0x1a0)](_0x167cb1)[_0x454fc6(0x1ab)]===0x0)return null;return Object[_0x454fc6(0x1a6)](_0x167cb1)[_0x454fc6(0x1b4)](([_0x5f39d2,_0x1f66c7])=>({'name':_0x5f39d2,'appcode':_0x1f66c7?.[_0x454fc6(0x1c3)]||'','isDefault':_0x5f39d2===_0x49d421,'env':_0x1f66c7?.[_0x454fc6(0x19f)],'apiDir':_0x1f66c7?.[_0x454fc6(0x1be)],'cookie':_0x1f66c7?.[_0x454fc6(0x1c4)]||undefined}))[_0x454fc6(0x1a2)](_0xeb7a06=>_0xeb7a06['appcode']);}export function getTemplateBaseUrl(_0x405672){const _0x54aa41=a156_0x180b5e,_0x286d69=readRawConfig(_0x405672);if(_0x286d69[_0x54aa41(0x1a5)]&&typeof _0x286d69[_0x54aa41(0x1a5)]===_0x54aa41(0x1b6))return _0x286d69[_0x54aa41(0x1a5)][_0x54aa41(0x19d)](/\/$/,'');return'https://g.lovrabet.com/dist/lovrabet-skill';}function buildConfig(_0x28976a,_0xb0c344,_0x4b1dd7){return{...resolveAppConfig({'raw':_0x28976a,'flags':_0xb0c344,'layers':_0x4b1dd7,'readEnv':env}),'raw':_0x28976a};}export function resolveApiFilePath(_0x588b33,_0x315c9a){const _0x3d457f=a156_0x180b5e,_0x3e296b=resolve(process[_0x3d457f(0x1c1)](),_0x588b33),_0xd3cae2=resolve(_0x3e296b,_0x3d457f(0x1c2));if(!_0x315c9a)return _0xd3cae2;const _0x3d75a5=readRawConfig(),_0x83fa62=_0x3d75a5[_0x3d457f(0x1ad)]&&typeof _0x3d75a5[_0x3d457f(0x1ad)]==='object'?_0x3d75a5[_0x3d457f(0x1ad)]:{},_0x2a5c9d=Object[_0x3d457f(0x1a6)](_0x83fa62)['find'](([,_0x181e90])=>_0x181e90?.['appcode']===_0x315c9a);if(!_0x2a5c9d)return _0xd3cae2;const [_0x17665a,_0x8e3b9]=_0x2a5c9d,_0x3b3d1b=typeof _0x3d75a5[_0x3d457f(0x1ba)]===_0x3d457f(0x1b6)?_0x3d75a5[_0x3d457f(0x1ba)]:undefined;if(_0x8e3b9?.[_0x3d457f(0x1be)])return _0xd3cae2;if(_0x3b3d1b&&_0x17665a!==_0x3b3d1b)return resolve(_0x3e296b,_0x17665a+_0x3d457f(0x1b9));return _0xd3cae2;}function a156_0x5cbc(){const _0x4ced8f=['apiDir','runtimeDomain','./utils/is-non-interactive.js','cwd','api.ts','appcode','cookie','userDomain','replace','globalConfig','env','keys','setLogPath','filter','7373552wrGnRK','./constant/env.js','template_base_url','entries','24100idjVAT','argv','project','692772JLASPc','length','projectConfig','apps','3207852qihOjo','754698SNjUrX','609981fCZSLK','./constant/domain.js','merged','values','map','304sdhGar','string','trim','slice','-api.ts','defaultApp','object','apiDomain','4989376tDNuZB'];a156_0x5cbc=function(){return _0x4ced8f;};return a156_0x5cbc();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a157_0x5535(_0x2bab55,_0x4bf61c){_0x2bab55=_0x2bab55-0xd8;const _0x2a6dbc=a157_0x2a6d();let _0x55354d=_0x2a6dbc[_0x2bab55];return _0x55354d;}(function(_0x438743,_0x5e5c19){const _0x77e2d1=a157_0x5535,_0x5dd863=_0x438743();while(!![]){try{const _0x60a72a=parseInt(_0x77e2d1(0xe9))/0x1*(-parseInt(_0x77e2d1(0xdf))/0x2)+parseInt(_0x77e2d1(0xe1))/0x3+-parseInt(_0x77e2d1(0xdc))/0x4*(-parseInt(_0x77e2d1(0xdd))/0x5)+-parseInt(_0x77e2d1(0xe2))/0x6+-parseInt(_0x77e2d1(0xea))/0x7+parseInt(_0x77e2d1(0xd8))/0x8+parseInt(_0x77e2d1(0xe3))/0x9*(parseInt(_0x77e2d1(0xe0))/0xa);if(_0x60a72a===_0x5e5c19)break;else _0x5dd863['push'](_0x5dd863['shift']());}catch(_0x1c7e12){_0x5dd863['push'](_0x5dd863['shift']());}}}(a157_0x2a6d,0xbf535));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';const cache=new Map();function parseApiFile(_0x24d7b5){const _0x54675b=a157_0x5535,_0x526a7e=[],_0x380ac1=/\{\s*datasetCode:\s*"([^"]+)"\s*,\s*tableName:\s*"([^"]+)"\s*,\s*name:\s*"([^"]*?)"\s*,\s*alias:\s*"([^"]+)"\s*,?\s*\}/g;let _0x4f3f12;while((_0x4f3f12=_0x380ac1[_0x54675b(0xda)](_0x24d7b5))!==null){_0x526a7e[_0x54675b(0xe7)]({'datasetCode':_0x4f3f12[0x1],'tableName':_0x4f3f12[0x2],'name':_0x4f3f12[0x3],'alias':_0x4f3f12[0x4]});}return _0x526a7e;}export function loadAliasMap(_0x36b417,_0x38fa04,_0xef1c30){const _0xc9f9df=a157_0x5535,_0x1c6a68=_0xef1c30??resolve(process[_0xc9f9df(0xdb)](),_0x36b417,_0xc9f9df(0xe6));if(cache['has'](_0x1c6a68))return cache[_0xc9f9df(0xe5)](_0x1c6a68);if(!existsSync(_0x1c6a68))return cache[_0xc9f9df(0xd9)](_0x1c6a68,[]),[];try{const _0x454140=readFileSync(_0x1c6a68,_0xc9f9df(0xe8)),_0x2aa988=parseApiFile(_0x454140);return cache['set'](_0x1c6a68,_0x2aa988),_0x2aa988;}catch{return cache[_0xc9f9df(0xd9)](_0x1c6a68,[]),[];}}export function resolveAlias(_0x5dbbff,_0x5359c7,_0x49f70b,_0x17c6e6){const _0x123816=a157_0x5535;if(!_0x5359c7)return undefined;const _0x2d5974=loadAliasMap(_0x5dbbff,_0x49f70b,_0x17c6e6),_0x1f2511=_0x2d5974[_0x123816(0xde)](_0x5955ae=>_0x5955ae['alias']===_0x5359c7);return _0x1f2511?.[_0x123816(0xe4)];}export function listAliases(_0x5035ce,_0x34ed44,_0x55b4b1){return loadAliasMap(_0x5035ce,_0x34ed44,_0x55b4b1);}function a157_0x2a6d(){const _0x5597c2=['push','utf-8','347EDfDyH','3041514fRtPZE','12412232AxLPtU','set','exec','cwd','4FJGPqL','1890955TzWNGP','find','4282NNlqRD','1420LWTxgZ','4117692fQGPpo','8676744zHDWAZ','6651XGZEYx','datasetCode','get','api.ts'];a157_0x2a6d=function(){return _0x5597c2;};return a157_0x2a6d();}
|
package/lib/core/api-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x5758b3,_0x561d0d){const _0x4012d3=a157_0x5aa0,_0x2e128b=_0x5758b3();while(!![]){try{const _0x21297f=-parseInt(_0x4012d3(0x148))/0x1*(parseInt(_0x4012d3(0x1be))/0x2)+parseInt(_0x4012d3(0x11b))/0x3*(parseInt(_0x4012d3(0x136))/0x4)+parseInt(_0x4012d3(0x162))/0x5*(-parseInt(_0x4012d3(0x1a2))/0x6)+-parseInt(_0x4012d3(0x123))/0x7+-parseInt(_0x4012d3(0x1a8))/0x8*(parseInt(_0x4012d3(0x149))/0x9)+-parseInt(_0x4012d3(0x11d))/0xa+-parseInt(_0x4012d3(0x154))/0xb*(-parseInt(_0x4012d3(0x196))/0xc);if(_0x21297f===_0x561d0d)break;else _0x2e128b['push'](_0x2e128b['shift']());}catch(_0x5841c8){_0x2e128b['push'](_0x2e128b['shift']());}}}(a157_0x263a,0xa3bcd));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(_0x3d3e88){_activeCookie=_0x3d3e88||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}const DEFAULT_REQUEST_TIMEOUT_MS=0x7530,ER_CONFIG_REQUEST_TIMEOUT_MS=0x1d4c0;function createFetchFailureError(_0x21fe99,_0x48e46b){const _0x9296b5=a157_0x5aa0,_0x1d5e1b=_0x48e46b instanceof Error?_0x48e46b['message']:String(_0x48e46b);return CliErrors[_0x9296b5(0x16d)]('Request\x20failed:\x20'+_0x21fe99+(_0x1d5e1b?'\x20('+_0x1d5e1b+')':''),_0x9296b5(0x146));}async function apiRequest(_0x34253c,_0x5b24c4={}){const _0x105eb8=a157_0x5aa0,{method:method='GET',body:_0x257652,headers:headers={},timeout:timeout=DEFAULT_REQUEST_TIMEOUT_MS,useRuntime:useRuntime=![],allowNonJsonSuccess:allowNonJsonSuccess=![]}=_0x5b24c4,_0x2b21a2=useRuntime?getRuntimeDomain():getApiDomain(),_0x146997=_activeCookie||getCookie(),_0x466119=''+_0x2b21a2+_0x34253c,_0x2ce3a7=new AbortController(),_0x54ca6f=setTimeout(()=>_0x2ce3a7['abort'](),timeout);try{const _0x2c6688=await fetch(_0x466119,{'method':method,'headers':{'Content-Type':'application/json','Cookie':_0x146997,'X-Invoke-Source':'cli:rabetbase',...headers},'body':_0x257652?JSON[_0x105eb8(0x1af)](_0x257652):undefined,'signal':_0x2ce3a7[_0x105eb8(0x19e)]});let _0x52a50a;try{_0x52a50a=await _0x2c6688[_0x105eb8(0x170)]();}catch(_0x12f7cb){if(_0x12f7cb instanceof Error&&_0x12f7cb['name']===_0x105eb8(0x186))throw CliErrors[_0x105eb8(0x16d)](_0x105eb8(0x14b)+_0x466119);if(_0x2c6688['ok']&&allowNonJsonSuccess)return{'success':!![],'data':undefined};throw CliErrors[_0x105eb8(0x16d)]('API\x20returned\x20non-JSON\x20response\x20(HTTP\x20'+_0x2c6688[_0x105eb8(0x1ac)]+')',_0x2c6688[_0x105eb8(0x1ac)]>=0x190?_0x105eb8(0x124):undefined);}if(!_0x2c6688['ok']||_0x52a50a[_0x105eb8(0x13e)]===![])throw CliErrors['apiError'](_0x52a50a[_0x105eb8(0x14a)]||_0x52a50a[_0x105eb8(0x15b)]||_0x105eb8(0x13b)+_0x2c6688['status'],_0x52a50a[_0x105eb8(0x13a)]?_0x105eb8(0x194)+_0x52a50a[_0x105eb8(0x13a)]:undefined);return _0x52a50a;}catch(_0x1e20d2){if(_0x1e20d2 instanceof CliError)throw _0x1e20d2;if(_0x1e20d2 instanceof Error&&_0x1e20d2['name']===_0x105eb8(0x186))throw CliErrors['apiError'](_0x105eb8(0x14b)+_0x466119);throw createFetchFailureError(_0x466119,_0x1e20d2);}finally{clearTimeout(_0x54ca6f);}}function isAuthFailure(_0x4779a0){const _0x10727f=a157_0x5aa0,_0x1c54c9=_0x4779a0['errorMsg']||_0x4779a0[_0x10727f(0x15b)]||_0x4779a0['data']?.[_0x10727f(0x15b)]||_0x4779a0[_0x10727f(0x16f)]||_0x4779a0[_0x10727f(0x151)]||'';return _0x4779a0[_0x10727f(0x13a)]===_0x10727f(0x191)||_0x4779a0[_0x10727f(0x159)]===0x191||_0x4779a0[_0x10727f(0x159)]==='401'||_0x1c54c9[_0x10727f(0x181)](_0x10727f(0x12b))||_0x1c54c9[_0x10727f(0x181)](_0x10727f(0x116))||_0x1c54c9[_0x10727f(0x181)]('登录')||_0x1c54c9[_0x10727f(0x181)]('认证');}export async function platformFetch(_0x221c8b,_0x4c799c){const _0x5801a5=a157_0x5aa0;let _0xbbf115;try{_0xbbf115=await fetch(_0x221c8b,{'method':_0x4c799c[_0x5801a5(0x11e)]??_0x5801a5(0x19b),'headers':{'Content-Type':_0x5801a5(0x18e),'Cookie':_0x4c799c[_0x5801a5(0x1ab)],'X-Invoke-Source':_0x5801a5(0x156)},..._0x4c799c['body']&&{'body':JSON[_0x5801a5(0x1af)](_0x4c799c[_0x5801a5(0x13d)])}});}catch(_0x512db3){throw createFetchFailureError(_0x221c8b,_0x512db3);}if(!_0xbbf115['ok']){if(_0xbbf115[_0x5801a5(0x1ac)]===0x191)throw CliErrors['authRequired']();throw CliErrors[_0x5801a5(0x16d)](_0x4c799c[_0x5801a5(0x167)]+_0x5801a5(0x133)+_0xbbf115[_0x5801a5(0x1ac)]);}const _0x330b91=await _0xbbf115[_0x5801a5(0x170)]();if(_0x330b91[_0x5801a5(0x13e)]===![]){if(isAuthFailure(_0x330b91))throw CliErrors['authRequired']();throw CliErrors[_0x5801a5(0x16d)](_0x330b91[_0x5801a5(0x14a)]||_0x330b91[_0x5801a5(0x15b)]||_0x4c799c['label']+_0x5801a5(0x187));}return _0x330b91[_0x5801a5(0x188)];}function a157_0x263a(){const _0x4881fe=['Request\x20timeout:\x20','const\x20result\x20=\x20await\x20client.models.','key','/generate-standard-pages/status?','tableName','add','error','join','list','38939626lHANeR','sdk','cli:rabetbase','/smartapi/dataset/get-dataset-operation','\x20\x20pageSize:\x2020,','code','});','message','/smartapi/custom/deleteUserCustomSql','dataset_','Dataset\x20not\x20found:\x20','version','.create({\x20/*\x20fields\x20*/\x20});','SQL\x20query\x20not\x20found:\x20id=','238115mabfpk','Operation\x20\x22','/api/management/library/scripts/save','dbId','\x20\x20});','label','/smartapi/dblink/delete','BFF\x20save\x20returned\x20no\x20valid\x20id','/smartapi/dblink/update','warn','/api/','apiError','deleted','errorMessage','json','enabled','/smartapi/db-analysis/jobs/cancel','test','\x20\x20sqlCode:\x20\x27','BFF\x20script\x20not\x20found:\x20id=','create','/smartapi/dataset/delete-dataset','set','(/*\x20params\x20*/);','operationId','/api/management/library/scripts/delete','/smartapi/dataset/update-driven-data','operationName','api_error','totalCount','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{','includes','description','requestFields','find','\x20\x20return\x20rows;','AbortError','\x20failed','data','pageSize','\x20apps.\x20','delete','/smartapi/lovrabet/dataset/','POST','application/json','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','\x20\x20\x20\x20sqlCode:\x20\x27','UNAUTHORIZED','const\x20results\x20=\x20data.execResult\x20||\x20[];','modelCode','API\x20error\x20code:\x20','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','12bAkwpp','/smartapi/dblink/create','/smartapi/dblink/testConnect','/smartapi/app-config/getByKey','filter','GET','sqlCode','/smartapi/dblink/getList','signal','/api/management/library/scripts/info?id=','map','\x22\x20not\x20found\x20in\x20dataset\x20','90XXYuun','sqlName','/smartapi/dataset/get-dataset-list','/smartapi/lovrabet/update-page','replace','\x20\x20where:\x20{},','8781592NLfYWj','dbtableConfig','/smartapi/custom/getUserCustomSql?id=','cookie','status','tableData','path','stringify','/smartapi/dataset/restore-dataset','name','/smartapi/app-config/list','table','/standard-page-status?appCode=','/sync-to-pages','planId','isArray','update','getOne','push','target','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','/smartapi/app/getList','549084fWonxe','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','/smartapi/question/er-config/erCreate','Page\x20not\x20found:\x20','/smartapi/question/er-config','includeImports','type','\x20\x20currentPage:\x201,','.getOne(id);','Unauthorized','functionName','/api/management/library/scripts/statistics?appCode=','tableList','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','90891MkLDum','clientOperationId','506610MqaHob','method','/smartapi/app-config/update','object','entries','/smartapi/app-config/delete','2115995gKJmbQ','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','modelId','/smartapi/dblink/getAllTableList','//\x20','/smartapi/app-config/create','has','scriptName','401','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','currentPage','/smartapi/custom/getUserCustomSql','/smartapi/dblink/getOne','/smartapi/dblink/getTableDiffV2ByPage','string','.remove(id);','\x20failed,\x20HTTP\x20','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','/smartapi/lovrabet/detail?pageId=','52lCypHT','operations','const\x20data\x20=\x20await\x20client.sql.execute({','tags','errorCode','API\x20error:\x20','/smartapi/db-analysis/status/','body','success','value','validation','toLowerCase','appCode','//\x20SQL:\x20','responseFields','toString','Check\x20network\x20connectivity\x20and\x20try\x20again.','/smartapi/question/er-config/update-single','4aTRMXm','9kVKwhR','errorMsg'];a157_0x263a=function(){return _0x4881fe;};return a157_0x263a();}export async function listBffScripts(_0x29cc41,_0x19299d,_0x592ee7){const _0x50f300=a157_0x5aa0;let _0x36743a='/api/management/library/scripts/list?appCode='+_0x29cc41;if(_0x19299d)_0x36743a+='&type='+_0x19299d;const _0x5deecc=await apiRequest(_0x36743a);let _0x50970e=extractList(_0x5deecc[_0x50f300(0x188)]);if(_0x592ee7?.[_0x50f300(0x12a)]){const _0x2dff59=_0x592ee7[_0x50f300(0x12a)][_0x50f300(0x141)]();_0x50970e=_0x50970e[_0x50f300(0x19a)](_0x4a6c30=>_0x4a6c30['functionName']?.[_0x50f300(0x141)]()['includes'](_0x2dff59)||_0x4a6c30[_0x50f300(0x182)]?.[_0x50f300(0x141)]()[_0x50f300(0x181)](_0x2dff59));}return _0x50970e;}export async function getBffScriptInfo(_0x5d7be4){const _0x3e12b9=a157_0x5aa0,_0x446cff=await apiRequest(_0x3e12b9(0x19f)+_0x5d7be4);if(!_0x446cff[_0x3e12b9(0x188)])throw CliErrors[_0x3e12b9(0x140)](_0x3e12b9(0x175)+_0x5d7be4);return _0x446cff[_0x3e12b9(0x188)];}export async function saveBffScript(_0x55c328){const _0x47cf03=a157_0x5aa0,_0x5d105f=await apiRequest(_0x47cf03(0x164),{'method':_0x47cf03(0x18d),'body':_0x55c328}),{id:_0x40b335,entity:_0x445cb1}=normalizeEntityWithIdResponse(_0x5d105f[_0x47cf03(0x188)]);if(_0x40b335!==undefined){const _0x51d3e2=typeof _0x445cb1[_0x47cf03(0x117)]===_0x47cf03(0x131)||typeof _0x445cb1['scriptType']===_0x47cf03(0x131)?_0x445cb1:undefined;return{'id':_0x40b335,'script':_0x51d3e2};}throw CliErrors[_0x47cf03(0x16d)](_0x47cf03(0x169));}export async function deleteBffScript(_0x533de4){const _0x490c1e=a157_0x5aa0;await apiRequest(_0x490c1e(0x17b),{'method':_0x490c1e(0x18d),'body':{'id':_0x533de4}});}export async function getBffScriptStatistics(_0x37cfe5){const _0x5ad159=a157_0x5aa0,_0x265a9a=await apiRequest(_0x5ad159(0x118)+_0x37cfe5);return extractList(_0x265a9a['data']);}export async function clearBffScriptCache(){const _0x593738=a157_0x5aa0,_0x46076f=await apiRequest('/api/management/script/cache/clear',{'method':'POST','useRuntime':!![]});return typeof _0x46076f['data']===_0x593738(0x131)?_0x46076f[_0x593738(0x188)]:'';}export async function listBffDatasetOperations(_0x7599f5,_0x435aa2){const _0x5e66e3=a157_0x5aa0,_0x123735=await apiRequest(_0x5e66e3(0x157),{'method':_0x5e66e3(0x18d),'body':{'appCode':_0x7599f5,'datasetId':_0x435aa2}});return _0x123735[_0x5e66e3(0x188)];}export async function listSqlQueries(_0x504a5e,_0xaf5ff0){const _0x114dc0=a157_0x5aa0,_0x314679=await apiRequest('/smartapi/custom/queryUserCustomSqlList',{'method':'POST','body':{'appCode':_0x504a5e,'currentPage':_0xaf5ff0?.['currentPage']??0x1,'pageSize':_0xaf5ff0?.[_0x114dc0(0x189)]??0x32,'sqlCode':_0xaf5ff0?.['sqlCode'],'sqlName':_0xaf5ff0?.[_0x114dc0(0x1a3)]}});return _0x314679['data'];}export async function getSqlQueryInfo(_0xb2054,_0x1d7487){const _0x58c2ba=a157_0x5aa0,_0x381837=await listSqlQueries(_0xb2054,{'sqlCode':_0x1d7487}),_0x22f882=_0x381837[_0x58c2ba(0x1ad)]?.[0x0];if(!_0x22f882)throw CliErrors['validation']('SQL\x20query\x20not\x20found:\x20'+_0x1d7487);return _0x22f882;}export async function getSqlQueryDetail(_0x557084){const _0xb1216d=a157_0x5aa0,_0x1148b0=await apiRequest(_0xb1216d(0x12e)+('?sqlCode='+encodeURIComponent(_0x557084)));if(!_0x1148b0[_0xb1216d(0x188)])throw CliErrors[_0xb1216d(0x140)]('SQL\x20query\x20not\x20found:\x20'+_0x557084);return _0x1148b0[_0xb1216d(0x188)];}export async function getSqlQueryDetailById(_0x3c7ede){const _0x54599a=a157_0x5aa0,_0x57a938=await apiRequest(_0x54599a(0x1aa)+_0x3c7ede);if(!_0x57a938[_0x54599a(0x188)])throw CliErrors[_0x54599a(0x140)](_0x54599a(0x161)+_0x3c7ede);return _0x57a938[_0x54599a(0x188)];}export async function createSqlQuery(_0x2bc46c){const _0x136f13=a157_0x5aa0,_0x19ad66=await apiRequest('/smartapi/custom/saveUserCustomSql',{'method':_0x136f13(0x18d),'body':_0x2bc46c}),{id:_0x34c418,entity:_0x5b42b8}=normalizeEntityWithIdResponse(_0x19ad66['data']);if(!(_0x136f13(0x19c)in _0x5b42b8)&&_0x34c418)return getSqlQueryDetailById(_0x34c418);return normalizeSqlQueryEntity(_0x5b42b8);}export async function updateSqlQuery(_0x19e47e){const _0x15044e=a157_0x5aa0,_0x4e3f23=await apiRequest('/smartapi/custom/updateUserCustomSql',{'method':_0x15044e(0x18d),'body':_0x19e47e}),{id:_0x4c7777,entity:_0x2f94b9}=normalizeEntityWithIdResponse(_0x4e3f23[_0x15044e(0x188)]);if(!('sqlCode'in _0x2f94b9)){if(_0x19e47e['sqlCode'])return getSqlQueryDetail(_0x19e47e['sqlCode']);if(_0x4c7777)return getSqlQueryDetailById(_0x4c7777);}return normalizeSqlQueryEntity(_0x2f94b9);}export async function deleteSqlQuery(_0x214b5e){const _0x5cac61=a157_0x5aa0;await apiRequest(_0x5cac61(0x15c),{'method':_0x5cac61(0x18d),'body':_0x214b5e});}export async function saveSqlQuery(_0x799574){const _0x43f440=a157_0x5aa0,_0x4b15bc=await apiRequest('/api/node-toolbox/sql/save',{'method':'POST','body':_0x799574});return _0x4b15bc[_0x43f440(0x188)];}function normalizeSqlQueryEntity(_0x12ab1a){const _0x4f712b=a157_0x5aa0;return{..._0x12ab1a,'id':Number(_0x12ab1a['id']),'dbId':_0x12ab1a['dbId']==null?undefined:Number(_0x12ab1a[_0x4f712b(0x165)]),'version':_0x12ab1a[_0x4f712b(0x15f)]==null?undefined:Number(_0x12ab1a[_0x4f712b(0x15f)])};}export async function executeSql(_0x405eec,_0x59ee6f,_0x1b2a3c){const _0x2dc8fa=a157_0x5aa0,_0x3730a6=await apiRequest('/api/custom/executeSql',{'method':_0x2dc8fa(0x18d),'body':{'appCode':_0x405eec,'sqlCode':_0x59ee6f,..._0x1b2a3c&&{'params':_0x1b2a3c}},'useRuntime':!![]});return _0x3730a6[_0x2dc8fa(0x188)];}export async function executeDatasetDataOperation(_0x5d2cbf,_0x51b5ad,_0x309836,_0xcf73df={}){const _0x5d9177=a157_0x5aa0;try{const _0x33088b=await apiRequest(_0x5d9177(0x16c)+_0x5d2cbf+'/'+_0x51b5ad+'/'+_0x309836,{'method':'POST','body':_0xcf73df,'useRuntime':!![]});return _0x33088b[_0x5d9177(0x188)];}catch(_0x1d29d2){if(_0x309836==='getOne'&&_0x1d29d2 instanceof CliError&&_0x1d29d2[_0x5d9177(0x159)]===_0x5d9177(0x17e)&&_0xcf73df['id']!==undefined&&_0xcf73df['id']!==null&&_0xcf73df['id']!==''){const _0x593159=await apiRequest(_0x5d9177(0x16c)+_0x5d2cbf+'/'+_0x51b5ad+'/filter',{'method':_0x5d9177(0x18d),'body':{'where':{'id':{'$eq':_0xcf73df['id']}},'currentPage':0x1,'pageSize':0x1},'useRuntime':!![]}),_0x56bc9b=Array[_0x5d9177(0x1b7)](_0x593159[_0x5d9177(0x188)]?.[_0x5d9177(0x1ad)])?_0x593159['data']['tableData']:[];return _0x56bc9b[0x0]??null;}throw _0x1d29d2;}}export async function listDatasets(_0x24f453,_0xc56beb){const _0x2b6075=a157_0x5aa0,_0x1c56cb={'appCode':_0x24f453,'deleted':_0xc56beb?.[_0x2b6075(0x16e)]??![]};if(_0xc56beb?.[_0x2b6075(0x159)])_0x1c56cb[_0x2b6075(0x159)]=_0xc56beb[_0x2b6075(0x159)];if(_0xc56beb?.[_0x2b6075(0x1b1)])_0x1c56cb[_0x2b6075(0x1b1)]=_0xc56beb[_0x2b6075(0x1b1)];const _0xc399ee=await apiRequest(_0x2b6075(0x1a4),{'method':_0x2b6075(0x18d),'body':_0x1c56cb});return extractList(_0xc399ee[_0x2b6075(0x188)]);}export async function deleteDataset(_0x28b32e,_0xaa9652){const _0x384c7b=a157_0x5aa0;await apiRequest(_0x384c7b(0x177),{'method':_0x384c7b(0x18d),'body':{'appCode':_0x28b32e,'datasetId':_0xaa9652}});}export async function restoreDataset(_0x422c15,_0xa5674){const _0x1c55e2=a157_0x5aa0;await apiRequest(_0x1c55e2(0x1b0),{'method':_0x1c55e2(0x18d),'body':{'appCode':_0x422c15,'datasetId':_0xa5674}});}export async function searchDatasets(_0x28c76d,_0x52ce71){const _0xade9f2=a157_0x5aa0,_0x187264=await listDatasets(_0x28c76d,{'name':_0x52ce71}),_0x5d3c4d=_0x52ce71[_0xade9f2(0x141)](),_0x38bb91=new Set(_0x187264[_0xade9f2(0x1a0)](_0xf94b74=>_0xf94b74['id'])),_0x5d08bb=_0x187264['filter'](_0x1aa374=>_0x1aa374['dbtableConfig']?.[_0xade9f2(0x14f)]?.['toLowerCase']()[_0xade9f2(0x181)](_0x5d3c4d)||_0x1aa374[_0xade9f2(0x182)]?.['toLowerCase']()[_0xade9f2(0x181)](_0x5d3c4d)),_0xc08e2a=await listDatasets(_0x28c76d,{'code':_0x52ce71});for(const _0x3d5438 of _0xc08e2a){!_0x38bb91[_0xade9f2(0x129)](_0x3d5438['id'])&&(_0x187264[_0xade9f2(0x1ba)](_0x3d5438),_0x38bb91[_0xade9f2(0x150)](_0x3d5438['id']));}return _0x187264;}export function normalizeDatasetOperations(_0x2c1726){const _0x323b24=a157_0x5aa0;if(Array[_0x323b24(0x1b7)](_0x2c1726))return _0x2c1726[_0x323b24(0x19a)](_0x42dea3=>_0x42dea3!=null&&typeof _0x42dea3===_0x323b24(0x120));if(_0x2c1726&&typeof _0x2c1726===_0x323b24(0x120))return Object['entries'](_0x2c1726)[_0x323b24(0x19a)](([,_0x4d2b22])=>_0x4d2b22!=null&&typeof _0x4d2b22===_0x323b24(0x120))[_0x323b24(0x1a0)](([_0x5e867f,_0x3a410b])=>({..._0x3a410b,'name':_0x3a410b[_0x323b24(0x1b1)]??_0x3a410b[_0x323b24(0x17d)]??_0x5e867f}));return[];}export async function getDatasetDetail(_0x1a50d0){const _0x5a8b57=a157_0x5aa0,_0x387862=/^\d+$/[_0x5a8b57(0x173)](_0x1a50d0)?'id':_0x5a8b57(0x159),_0x29fe36=await apiRequest('/smartapi/dataset/get-driven-data?'+_0x387862+'='+_0x1a50d0);return _0x29fe36[_0x5a8b57(0x188)];}export async function updateDrivenData(_0x53e03c){const _0x368b80=a157_0x5aa0,_0x20c427=await apiRequest(_0x368b80(0x17c),{'method':_0x368b80(0x18d),'body':_0x53e03c});return _0x20c427[_0x368b80(0x188)];}export async function getDatasetOperations(_0x4ffcc0){const _0x5affba=a157_0x5aa0,_0x380713=await getDatasetDetail(_0x4ffcc0),_0x567d05=normalizeDatasetOperations(_0x380713[_0x5affba(0x137)])[_0x5affba(0x1a0)](_0x3c0efd=>({'name':_0x3c0efd[_0x5affba(0x1b1)]||_0x3c0efd[_0x5affba(0x17d)],'displayName':_0x3c0efd['displayName']||_0x3c0efd[_0x5affba(0x1b1)],'type':_0x3c0efd[_0x5affba(0x1c4)],'method':_0x3c0efd[_0x5affba(0x11e)],'path':_0x3c0efd[_0x5affba(0x1ae)],'enabled':_0x3c0efd[_0x5affba(0x171)]??!![],'requestFields':_0x3c0efd[_0x5affba(0x183)],'responseFields':_0x3c0efd[_0x5affba(0x144)]}));return{'dataset':{'id':_0x380713['id']??_0x380713[_0x5affba(0x125)],'name':_0x380713[_0x5affba(0x1b1)],'code':_0x380713[_0x5affba(0x159)]||_0x380713[_0x5affba(0x193)],'tableName':_0x380713['tableName']||_0x380713[_0x5affba(0x1a9)]?.['tableName']},'operations':_0x567d05};}export async function getOperationDetail(_0x18728a,_0x45bc57,_0x19f352){const _0x5a4fdd=a157_0x5aa0;let _0x7a4f29=_0x45bc57;if(!/^\d+$/[_0x5a4fdd(0x173)](_0x45bc57)){const _0xc7e620=await listDatasets(_0x18728a,{'code':_0x45bc57}),_0x2eb234=_0xc7e620[_0x5a4fdd(0x184)](_0x200e8c=>_0x200e8c['code']===_0x45bc57||String(_0x200e8c['id'])===_0x45bc57);if(!_0x2eb234)throw CliErrors[_0x5a4fdd(0x140)](_0x5a4fdd(0x15e)+_0x45bc57);_0x7a4f29=String(_0x2eb234['id']);}const _0x17a52a=await getDatasetDetail(_0x7a4f29),_0x19f1ca=normalizeDatasetOperations(_0x17a52a[_0x5a4fdd(0x137)])['find'](_0x105af7=>(_0x105af7[_0x5a4fdd(0x1b1)]||_0x105af7[_0x5a4fdd(0x17d)])===_0x19f352);if(!_0x19f1ca)throw CliErrors['validation'](_0x5a4fdd(0x163)+_0x19f352+_0x5a4fdd(0x1a1)+_0x45bc57);return{'dataset':{'id':_0x17a52a['id']??_0x17a52a[_0x5a4fdd(0x125)],'name':_0x17a52a[_0x5a4fdd(0x1b1)],'code':_0x17a52a['code']||_0x17a52a[_0x5a4fdd(0x193)],'tableName':_0x17a52a['tableName']||_0x17a52a[_0x5a4fdd(0x1a9)]?.[_0x5a4fdd(0x14f)]},'operation':_0x19f1ca};}export async function startGenerateStandardPages(_0x586e19,_0x4406e6,_0x338036){const _0x565d86=a157_0x5aa0,_0xb53ca6=await apiRequest(_0x565d86(0x18c)+_0x4406e6+'/generate-standard-pages/start',{'method':_0x565d86(0x18d),'body':{'appCode':_0x586e19,..._0x338036?.[_0x565d86(0x11c)]?{'clientOperationId':_0x338036[_0x565d86(0x11c)]}:{}},'timeout':DEFAULT_REQUEST_TIMEOUT_MS});return _0xb53ca6['data'];}export async function getGenerateStandardPagesStatus(_0x33a12f,_0x54cf6e,_0x199499){const _0x16409e=a157_0x5aa0,_0x472f0e=new URLSearchParams({'appCode':_0x33a12f});_0x199499[_0x16409e(0x17a)]&&_0x472f0e[_0x16409e(0x178)]('operationId',_0x199499[_0x16409e(0x17a)]);_0x199499[_0x16409e(0x11c)]&&_0x472f0e[_0x16409e(0x178)](_0x16409e(0x11c),_0x199499[_0x16409e(0x11c)]);const _0x26d3ff=await apiRequest(_0x16409e(0x18c)+_0x54cf6e+_0x16409e(0x14e)+_0x472f0e[_0x16409e(0x145)]());return _0x26d3ff[_0x16409e(0x188)];}function a157_0x5aa0(_0x3e723b,_0x2a7730){_0x3e723b=_0x3e723b-0x115;const _0x263ae3=a157_0x263a();let _0x5aa09f=_0x263ae3[_0x3e723b];return _0x5aa09f;}export async function getStandardPageStatus(_0x3c96e8,_0x1d34d4){const _0xaa7a57=a157_0x5aa0,_0x3ba858=await apiRequest(_0xaa7a57(0x18c)+_0x1d34d4+_0xaa7a57(0x1b4)+encodeURIComponent(_0x3c96e8));return _0x3ba858[_0xaa7a57(0x188)];}export async function tryGetStandardPageStatus(_0x205f3d,_0x5e1796){const _0x314708=a157_0x5aa0;try{return await getStandardPageStatus(_0x205f3d,_0x5e1796);}catch(_0x59b16b){if(_0x59b16b instanceof CliError&&_0x59b16b[_0x314708(0x159)]===_0x314708(0x17e)&&/404|not found|non-json response/i[_0x314708(0x173)](_0x59b16b[_0x314708(0x15b)]))return null;throw _0x59b16b;}}export async function syncStandardPages(_0x508b78,_0x44316e){const _0x17434d=a157_0x5aa0,_0x445ce2=await apiRequest('/smartapi/lovrabet/dataset/'+_0x44316e+_0x17434d(0x1b5),{'method':_0x17434d(0x18d),'body':{'appCode':_0x508b78}});return _0x445ce2[_0x17434d(0x188)];}export async function getPageDetail(_0x54caac){const _0x1ef2b9=a157_0x5aa0,_0x579997=await apiRequest(_0x1ef2b9(0x135)+_0x54caac);if(!_0x579997['data'])throw CliErrors[_0x1ef2b9(0x140)](_0x1ef2b9(0x1c1)+_0x54caac);return _0x579997[_0x1ef2b9(0x188)];}export async function updatePage(_0x5e7dc6,_0x415f3c,_0x462ce9,_0x31f021){const _0x2ec223=a157_0x5aa0,_0x3d2c1b=await apiRequest(_0x2ec223(0x1a5),{'method':_0x2ec223(0x18d),'body':{'appCode':_0x5e7dc6,'pageId':_0x415f3c,'code':_0x462ce9,'datasetIds':_0x31f021}});return _0x3d2c1b[_0x2ec223(0x188)];}export function generateSdkCode(_0x24f63a,_0x13df0f,_0x16e0f5){const _0x24c1d3=a157_0x5aa0,_0x20cf15=_0x16e0f5?.['includeImports']??!![],_0x2c25e8=_0x24c1d3(0x15d)+_0x24f63a[_0x24c1d3(0x159)]?.[_0x24c1d3(0x1a6)](/-/g,'_'),_0x58d8a0=_0x13df0f[_0x24c1d3(0x1b1)]||_0x13df0f['operationName']||_0x24c1d3(0x19a),_0x2b7606=[];_0x20cf15&&_0x2b7606[_0x24c1d3(0x1ba)](_0x24c1d3(0x195),'',_0x24c1d3(0x1bf),'');_0x2b7606[_0x24c1d3(0x1ba)](_0x24c1d3(0x127)+_0x24f63a[_0x24c1d3(0x1b1)]+'\x20('+(_0x24f63a[_0x24c1d3(0x14f)]||_0x24c1d3(0x1b3))+')');if(_0x58d8a0==='filter')_0x2b7606['push'](_0x24c1d3(0x14c)+_0x2c25e8+'.filter({',_0x24c1d3(0x1a7),_0x24c1d3(0x158),_0x24c1d3(0x1c5),'});');else{if(_0x58d8a0===_0x24c1d3(0x1b9))_0x2b7606[_0x24c1d3(0x1ba)](_0x24c1d3(0x14c)+_0x2c25e8+_0x24c1d3(0x115));else{if(_0x58d8a0===_0x24c1d3(0x176))_0x2b7606[_0x24c1d3(0x1ba)](_0x24c1d3(0x14c)+_0x2c25e8+_0x24c1d3(0x160));else{if(_0x58d8a0===_0x24c1d3(0x1b8))_0x2b7606[_0x24c1d3(0x1ba)]('const\x20result\x20=\x20await\x20client.models.'+_0x2c25e8+'.update(id,\x20{\x20/*\x20fields\x20*/\x20});');else _0x58d8a0===_0x24c1d3(0x18b)||_0x58d8a0==='remove'?_0x2b7606[_0x24c1d3(0x1ba)](_0x24c1d3(0x14c)+_0x2c25e8+_0x24c1d3(0x132)):_0x2b7606[_0x24c1d3(0x1ba)](_0x24c1d3(0x14c)+_0x2c25e8+'.'+_0x58d8a0+_0x24c1d3(0x179));}}}return _0x2b7606[_0x24c1d3(0x152)]('\x0a');}export function generateSqlCodeTemplate(_0x148428,_0x4c73c0){const _0x5cb944=a157_0x5aa0,_0x51a65f=_0x4c73c0?.[_0x5cb944(0x1bb)]??_0x5cb944(0x155),_0x4bb0c2=_0x4c73c0?.[_0x5cb944(0x1c3)]??!![],_0x1522b7=[];return _0x1522b7[_0x5cb944(0x1ba)](_0x5cb944(0x143)+_0x148428['sqlName']+'\x20('+_0x148428['sqlCode']+')'),_0x51a65f==='sdk'?(_0x4bb0c2&&_0x1522b7[_0x5cb944(0x1ba)](_0x5cb944(0x195),'',_0x5cb944(0x1bf),''),_0x1522b7[_0x5cb944(0x1ba)](_0x5cb944(0x138),_0x5cb944(0x174)+_0x148428[_0x5cb944(0x19c)]+'\x27,',_0x5cb944(0x12c),_0x5cb944(0x15a),_0x5cb944(0x134),_0x5cb944(0x192))):_0x1522b7[_0x5cb944(0x1ba)](_0x5cb944(0x11a),_0x5cb944(0x180),'\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({',_0x5cb944(0x190)+_0x148428[_0x5cb944(0x19c)]+'\x27,',_0x5cb944(0x1bc),_0x5cb944(0x166),_0x5cb944(0x185),'}'),_0x1522b7['join']('\x0a');}export async function getErConfig(_0x25eba4,_0x52d593){const _0x4d8354=a157_0x5aa0,_0x44504d=await apiRequest(_0x4d8354(0x1c2),{'method':_0x4d8354(0x18d),'body':{'appCode':_0x25eba4,'dblinkId':_0x52d593},'timeout':ER_CONFIG_REQUEST_TIMEOUT_MS});return _0x44504d[_0x4d8354(0x188)];}export async function createErRelation(_0x383a67){const _0x277585=a157_0x5aa0,_0x57501a=await apiRequest(_0x277585(0x1c0),{'method':_0x277585(0x18d),'body':_0x383a67,'allowNonJsonSuccess':!![]});return _0x57501a[_0x277585(0x188)];}export async function updateErRelation(_0xdde2cd){const _0x5ab97d=a157_0x5aa0,_0x2bb379=await apiRequest(_0x5ab97d(0x147),{'method':_0x5ab97d(0x18d),'body':_0xdde2cd,'allowNonJsonSuccess':!![]});return _0x2bb379['data'];}export async function deleteErRelation(_0x565126){const _0x30f218=a157_0x5aa0,_0x11e6c7=await apiRequest('/smartapi/question/er-config/erDelete',{'method':'POST','body':_0x565126,'allowNonJsonSuccess':!![]});return _0x11e6c7[_0x30f218(0x188)];}export async function updateErBusinessGroup(_0x276383){const _0xa8ced8=a157_0x5aa0,_0x499712=await apiRequest('/smartapi/question/er-config/business-group/edit',{'method':_0xa8ced8(0x18d),'body':_0x276383,'allowNonJsonSuccess':!![]});return _0x499712[_0xa8ced8(0x188)];}function buildQuery(_0x4bae26){const _0x4f18e0=a157_0x5aa0,_0x515a81=new URLSearchParams();for(const [_0x392f6a,_0x396005]of Object[_0x4f18e0(0x121)](_0x4bae26)){if(_0x396005===undefined||_0x396005==='')continue;_0x515a81['set'](_0x392f6a,String(_0x396005));}const _0x506f87=_0x515a81[_0x4f18e0(0x145)]();return _0x506f87?'?'+_0x506f87:'';}export async function listAppConfigs(_0x4254fc,_0x41bdef){const _0x226cd9=a157_0x5aa0,_0x3bbfd9=await apiRequest(_0x226cd9(0x1b2),{'method':'POST','body':{'appCode':_0x4254fc,..._0x41bdef?.[_0x226cd9(0x14d)]?{'key':_0x41bdef[_0x226cd9(0x14d)]}:{},..._0x41bdef?.[_0x226cd9(0x139)]?{'tags':_0x41bdef[_0x226cd9(0x139)]}:{}}});return extractAppConfigList(_0x3bbfd9[_0x226cd9(0x188)]);}export async function getAppConfigByKey(_0x5dc204,_0x2b12c4){const _0x537c84=a157_0x5aa0,_0xbc750b=await apiRequest(_0x537c84(0x199)+buildQuery({'appCode':_0x5dc204,'key':_0x2b12c4}));return _0xbc750b[_0x537c84(0x188)]??null;}export async function createAppConfig(_0x1f27c7){const _0x1e9d13=a157_0x5aa0,_0x4635e9=await apiRequest(_0x1e9d13(0x128),{'method':'POST','body':{'appCode':_0x1f27c7['appCode'],'key':_0x1f27c7[_0x1e9d13(0x14d)],'value':_0x1f27c7[_0x1e9d13(0x13f)],..._0x1f27c7['tags']?{'tags':_0x1f27c7['tags']}:{}}});return _0x4635e9[_0x1e9d13(0x188)];}export async function updateAppConfig(_0x15ff70){const _0x39b029=a157_0x5aa0;await apiRequest(_0x39b029(0x11f),{'method':_0x39b029(0x18d),'body':{'id':_0x15ff70['id'],'appCode':_0x15ff70[_0x39b029(0x142)],'key':_0x15ff70[_0x39b029(0x14d)],'value':_0x15ff70[_0x39b029(0x13f)],..._0x15ff70[_0x39b029(0x139)]?{'tags':_0x15ff70[_0x39b029(0x139)]}:{}}});}export async function deleteAppConfig(_0x41c954){const _0x617dac=a157_0x5aa0;await apiRequest(_0x617dac(0x122),{'method':_0x617dac(0x18d),'body':_0x41c954});}function extractAppConfigList(_0x1d065c){const _0x2db271=a157_0x5aa0;if(Array[_0x2db271(0x1b7)](_0x1d065c))return _0x1d065c;if(_0x1d065c&&typeof _0x1d065c===_0x2db271(0x120)&&Array['isArray'](_0x1d065c['list']))return _0x1d065c[_0x2db271(0x153)];return extractList(_0x1d065c);}export async function listDbLinks(_0x4d3995,_0x37647d){const _0x4f9c3b=a157_0x5aa0,_0x448f2f=await apiRequest(_0x4f9c3b(0x19d),{'method':_0x4f9c3b(0x18d),'body':{'appCode':_0x4d3995,'currentPage':_0x37647d?.[_0x4f9c3b(0x12d)]??0x1,'pageSize':_0x37647d?.['pageSize']??0x64}});return{'items':extractList(_0x448f2f[_0x4f9c3b(0x188)]),'paging':extractPaging(_0x448f2f[_0x4f9c3b(0x188)])};}export async function getDbLinkInfo(_0x3c2977){const _0x3d7c51=a157_0x5aa0,_0x42eff4=await apiRequest(_0x3d7c51(0x12f)+buildQuery({'id':_0x3c2977}));return _0x42eff4[_0x3d7c51(0x188)];}export async function createDbLink(_0x3d586f){const _0x543646=a157_0x5aa0,_0x3a225b=await apiRequest(_0x543646(0x197),{'method':_0x543646(0x18d),'body':_0x3d586f});return _0x3a225b[_0x543646(0x188)];}export async function updateDbLink(_0xade252){const _0x2e2cf3=a157_0x5aa0,_0x53fba5=await apiRequest(_0x2e2cf3(0x16a),{'method':'POST','body':_0xade252});return _0x53fba5[_0x2e2cf3(0x188)];}export async function deleteDbLink(_0x14a260){const _0x4b90b0=a157_0x5aa0;await apiRequest(_0x4b90b0(0x168),{'method':_0x4b90b0(0x18d),'body':{'id':_0x14a260}});}export async function testDbLinkConnect(_0x560b77){const _0x526bf8=a157_0x5aa0,_0x443f94=await apiRequest(_0x526bf8(0x198)+buildQuery({'id':_0x560b77}));return _0x443f94[_0x526bf8(0x188)];}export async function startDbAnalysis(_0x5a9b3c,_0x42e1cf){const _0x22020e=a157_0x5aa0,_0x28d100=await apiRequest('/smartapi/db-analysis/start',{'method':_0x22020e(0x18d),'body':{'dbLinkId':_0x5a9b3c,..._0x42e1cf&&_0x42e1cf['length']>0x0?{'tableNames':_0x42e1cf}:{}}}),_0x2ee326=_0x28d100['data'];if(typeof _0x2ee326==='string')return _0x2ee326;if(_0x2ee326&&typeof _0x2ee326==='object'&&typeof _0x2ee326[_0x22020e(0x1b6)]===_0x22020e(0x131))return _0x2ee326['planId'];return _0x2ee326!=null?String(_0x2ee326):'';}export async function cancelDbAnalysis(_0x3e8622){const _0x17b1c1=a157_0x5aa0;await apiRequest(_0x17b1c1(0x172)+buildQuery({'planId':_0x3e8622}),{'method':_0x17b1c1(0x18d)});}export async function getDbAnalysisStatus(_0x19d81d){const _0x5eac94=a157_0x5aa0,_0x255c91=await apiRequest(_0x5eac94(0x13c)+encodeURIComponent(_0x19d81d));return _0x255c91[_0x5eac94(0x188)];}export async function getDbAllTableList(_0x257985,_0x1a9944){const _0x2779fa=a157_0x5aa0,_0x2df929=await apiRequest(_0x2779fa(0x126)+buildQuery({'appCode':_0x257985,'dbLinkId':_0x1a9944})),_0x5d4df3=_0x2df929[_0x2779fa(0x188)];if(Array[_0x2779fa(0x1b7)](_0x5d4df3))return _0x5d4df3;return extractList(_0x5d4df3);}export async function getDbTableDiff(_0x42b055,_0x318fa2,_0x1f1962){const _0x3c9d13=a157_0x5aa0,_0x131601=await apiRequest(_0x3c9d13(0x130)+buildQuery({'appCode':_0x42b055,'dbLinkId':_0x318fa2,'pageIndex':_0x1f1962?.['pageIndex']??0x1,'pageSize':_0x1f1962?.[_0x3c9d13(0x189)]??0x14,'tableName':_0x1f1962?.[_0x3c9d13(0x14f)]})),_0x47c096=_0x131601[_0x3c9d13(0x188)];return{'totalCount':_0x47c096?.[_0x3c9d13(0x17f)]??0x0,'tableList':Array[_0x3c9d13(0x1b7)](_0x47c096?.[_0x3c9d13(0x119)])?_0x47c096['tableList']:[]};}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x3493fc=a157_0x5aa0,_0x406829=await apiRequest(_0x3493fc(0x1bd),{'method':_0x3493fc(0x18d),'body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x148fdd=extractList(_0x406829[_0x3493fc(0x188)]),_0x11566f=extractPaging(_0x406829[_0x3493fc(0x188)]);return _0x11566f&&_0x11566f[_0x3493fc(0x17f)]>REMOTE_APP_PAGE_SIZE&&console[_0x3493fc(0x16b)]('Warning:\x20showing\x20first\x20'+REMOTE_APP_PAGE_SIZE+'\x20of\x20'+_0x11566f[_0x3493fc(0x17f)]+_0x3493fc(0x18a)+_0x3493fc(0x18f)),_0x148fdd;}
|
|
1
|
+
(function(_0xeaa081,_0x37e350){const _0x455ea0=a158_0x2fe6,_0x15de73=_0xeaa081();while(!![]){try{const _0xba9fab=-parseInt(_0x455ea0(0x21f))/0x1+-parseInt(_0x455ea0(0x1ed))/0x2*(-parseInt(_0x455ea0(0x196))/0x3)+parseInt(_0x455ea0(0x216))/0x4*(-parseInt(_0x455ea0(0x1a7))/0x5)+parseInt(_0x455ea0(0x1b8))/0x6+-parseInt(_0x455ea0(0x20d))/0x7*(parseInt(_0x455ea0(0x199))/0x8)+-parseInt(_0x455ea0(0x1d1))/0x9+-parseInt(_0x455ea0(0x1b3))/0xa*(-parseInt(_0x455ea0(0x1e6))/0xb);if(_0xba9fab===_0x37e350)break;else _0x15de73['push'](_0x15de73['shift']());}catch(_0x17e485){_0x15de73['push'](_0x15de73['shift']());}}}(a158_0x4b14,0x27408));function a158_0x4b14(){const _0x2f015d=['/standard-page-status?appCode=','/smartapi/lovrabet/update-page','/smartapi/custom/getUserCustomSql?id=','scriptType','78620JoSegK','enabled','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','functionName','string','754230xFrpbD','responseFields','/smartapi/dblink/getAllTableList','physicalTableCount','/smartapi/custom/queryUserCustomSqlList','(/*\x20params\x20*/);','/smartapi/question/er-config/erCreate','.getOne(id);','/smartapi/question/er-config/erDelete','SQL\x20query\x20not\x20found:\x20','data','length','\x20failed','name','authRequired','key','/smartapi/dataset/get-dataset-list','BFF\x20script\x20not\x20found:\x20id=','Request\x20timeout:\x20','application/json','code','isArray','const\x20result\x20=\x20await\x20client.models.','label','set','938259nrXmCB','\x20\x20\x20\x20sqlCode:\x20\x27','deleted','/generate-standard-pages/status?','toString','requestFields','/smartapi/app-config/delete','object','cli:rabetbase','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','const\x20results\x20=\x20data.execResult\x20||\x20[];','has','warn','\x20apps.\x20','UNAUTHORIZED','/smartapi/dblink/getList','Request\x20failed:\x20','push','/api/management/library/scripts/save','dbtableConfig','sqlName','209fJGxkI','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','/smartapi/dataset/get-dataset-operation','includeImports','/smartapi/question/er-config','api_error','/smartapi/lovrabet/detail?pageId=','5382CYENhf','/api/management/script/cache/clear','401','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','POST','entries','/api/management/library/scripts/list?appCode=','/api/management/library/scripts/statistics?appCode=','tableData','modelCode','/smartapi/custom/updateUserCustomSql','/smartapi/question/er-config/update-single','tableList','json','/smartapi/custom/getUserCustomSql','replace','dbId','/smartapi/db-analysis/start','/sync-to-pages','\x20\x20pageSize:\x2020,','validation','toLowerCase','displayName','Operation\x20\x22','body','totalCount','create','Page\x20not\x20found:\x20','/api/','/api/custom/executeSql','const\x20data\x20=\x20await\x20client.sql.execute({','getOne','21AVlesm','\x20\x20currentPage:\x201,','/smartapi/app-config/list','/smartapi/dblink/getTableDiffV2ByPage','//\x20','BFF\x20save\x20returned\x20no\x20valid\x20id','pageSize','stringify','/smartapi/app-config/create','8pdQuLm','Unauthorized','GET','status','operations','errorCode','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','\x22\x20not\x20found\x20in\x20dataset\x20','test','100462XTATFg','/smartapi/lovrabet/dataset/','errorMsg','/api/management/library/scripts/delete','datasetTableCount','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','value','sdk','apiError','map','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','/smartapi/question/er-config/business-group/edit','operationName','\x20\x20return\x20rows;','join','sqlCode','\x20\x20where:\x20{},','modelId','find','filter','/api/management/library/scripts/info?id=','/smartapi/app-config/update','clientOperationId','/smartapi/app-config/getByKey','operationId','\x20\x20});','signal','description','API\x20error\x20code:\x20','tableName','currentPage','/smartapi/dblink/create','dataset_','309qNpktZ','/generate-standard-pages/start','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','57784JFyaQi','Warning:\x20showing\x20first\x20','method','includes','message','errorMessage','pageIndex','//\x20SQL:\x20','list','error','/filter','});','planId','tags','412745PQdQAp','scriptName','/smartapi/dblink/testConnect','success','Check\x20network\x20connectivity\x20and\x20try\x20again.','SQL\x20query\x20not\x20found:\x20id=','/api/node-toolbox/sql/save','\x20of\x20'];a158_0x4b14=function(){return _0x2f015d;};return a158_0x4b14();}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(_0xb12eb3){_activeCookie=_0xb12eb3||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}const DEFAULT_REQUEST_TIMEOUT_MS=0x7530,ER_CONFIG_REQUEST_TIMEOUT_MS=0x1d4c0;function createFetchFailureError(_0x312b7c,_0x3e8ddc){const _0x215020=a158_0x2fe6,_0x3ff46b=_0x3e8ddc instanceof Error?_0x3e8ddc[_0x215020(0x19d)]:String(_0x3e8ddc);return CliErrors[_0x215020(0x17d)](_0x215020(0x1e1)+_0x312b7c+(_0x3ff46b?'\x20('+_0x3ff46b+')':''),_0x215020(0x1ab));}async function apiRequest(_0x2b221d,_0xf51aa0={}){const _0x270efc=a158_0x2fe6,{method:method='GET',body:_0x10f381,headers:headers={},timeout:timeout=DEFAULT_REQUEST_TIMEOUT_MS,useRuntime:useRuntime=![],allowNonJsonSuccess:allowNonJsonSuccess=![]}=_0xf51aa0,_0x29996d=useRuntime?getRuntimeDomain():getApiDomain(),_0x2f921f=_activeCookie||getCookie(),_0xdc0cb6=''+_0x29996d+_0x2b221d,_0xf8389e=new AbortController(),_0x4d8d61=setTimeout(()=>_0xf8389e['abort'](),timeout);try{const _0x49a345=await fetch(_0xdc0cb6,{'method':method,'headers':{'Content-Type':'application/json','Cookie':_0x2f921f,'X-Invoke-Source':_0x270efc(0x1d9),...headers},'body':_0x10f381?JSON[_0x270efc(0x214)](_0x10f381):undefined,'signal':_0xf8389e[_0x270efc(0x18f)]});let _0x32bac0;try{_0x32bac0=await _0x49a345['json']();}catch(_0x3d61a8){if(_0x3d61a8 instanceof Error&&_0x3d61a8['name']==='AbortError')throw CliErrors['apiError'](_0x270efc(0x1ca)+_0xdc0cb6);if(_0x49a345['ok']&&allowNonJsonSuccess)return{'success':!![],'data':undefined};throw CliErrors[_0x270efc(0x17d)](_0x270efc(0x1f0)+_0x49a345[_0x270efc(0x219)]+')',_0x49a345['status']>=0x190?_0x270efc(0x17a):undefined);}if(!_0x49a345['ok']||_0x32bac0[_0x270efc(0x1aa)]===![])throw CliErrors[_0x270efc(0x17d)](_0x32bac0[_0x270efc(0x221)]||_0x32bac0[_0x270efc(0x19d)]||'API\x20error:\x20'+_0x49a345[_0x270efc(0x219)],_0x32bac0['errorCode']?_0x270efc(0x191)+_0x32bac0[_0x270efc(0x21b)]:undefined);return _0x32bac0;}catch(_0x46222e){if(_0x46222e instanceof CliError)throw _0x46222e;if(_0x46222e instanceof Error&&_0x46222e['name']==='AbortError')throw CliErrors[_0x270efc(0x17d)]('Request\x20timeout:\x20'+_0xdc0cb6);throw createFetchFailureError(_0xdc0cb6,_0x46222e);}finally{clearTimeout(_0x4d8d61);}}function isAuthFailure(_0x220ee5){const _0x531e86=a158_0x2fe6,_0x2dd981=_0x220ee5[_0x531e86(0x221)]||_0x220ee5[_0x531e86(0x19d)]||_0x220ee5[_0x531e86(0x1c2)]?.[_0x531e86(0x19d)]||_0x220ee5[_0x531e86(0x19e)]||_0x220ee5[_0x531e86(0x1a2)]||'';return _0x220ee5[_0x531e86(0x21b)]===_0x531e86(0x1df)||_0x220ee5[_0x531e86(0x1cc)]===0x191||_0x220ee5['code']==='401'||_0x2dd981['includes'](_0x531e86(0x1ef))||_0x2dd981[_0x531e86(0x19c)](_0x531e86(0x217))||_0x2dd981[_0x531e86(0x19c)]('登录')||_0x2dd981['includes']('认证');}export async function platformFetch(_0x1ea523,_0x334d24){const _0x1208e0=a158_0x2fe6;let _0x45fc3d;try{_0x45fc3d=await fetch(_0x1ea523,{'method':_0x334d24[_0x1208e0(0x19b)]??_0x1208e0(0x218),'headers':{'Content-Type':_0x1208e0(0x1cb),'Cookie':_0x334d24['cookie'],'X-Invoke-Source':_0x1208e0(0x1d9)},..._0x334d24[_0x1208e0(0x205)]&&{'body':JSON['stringify'](_0x334d24['body'])}});}catch(_0x4442c0){throw createFetchFailureError(_0x1ea523,_0x4442c0);}if(!_0x45fc3d['ok']){if(_0x45fc3d[_0x1208e0(0x219)]===0x191)throw CliErrors[_0x1208e0(0x1c6)]();throw CliErrors[_0x1208e0(0x17d)](_0x334d24['label']+'\x20failed,\x20HTTP\x20'+_0x45fc3d[_0x1208e0(0x219)]);}const _0x51696c=await _0x45fc3d[_0x1208e0(0x1fa)]();if(_0x51696c['success']===![]){if(isAuthFailure(_0x51696c))throw CliErrors['authRequired']();throw CliErrors[_0x1208e0(0x17d)](_0x51696c[_0x1208e0(0x221)]||_0x51696c['message']||_0x334d24[_0x1208e0(0x1cf)]+_0x1208e0(0x1c4));}return _0x51696c['data'];}export async function listBffScripts(_0x52a7f0,_0xcf92b7,_0x3d13f0){const _0x594de6=a158_0x2fe6;let _0x1cce9a=_0x594de6(0x1f3)+_0x52a7f0;if(_0xcf92b7)_0x1cce9a+='&type='+_0xcf92b7;const _0x59198b=await apiRequest(_0x1cce9a);let _0x645d4d=extractList(_0x59198b[_0x594de6(0x1c2)]);if(_0x3d13f0?.[_0x594de6(0x1a8)]){const _0x516f03=_0x3d13f0['scriptName']['toLowerCase']();_0x645d4d=_0x645d4d[_0x594de6(0x188)](_0x3b0e92=>_0x3b0e92['functionName']?.['toLowerCase']()[_0x594de6(0x19c)](_0x516f03)||_0x3b0e92[_0x594de6(0x190)]?.['toLowerCase']()['includes'](_0x516f03));}return _0x645d4d;}export async function getBffScriptInfo(_0xe96742){const _0x374c12=a158_0x2fe6,_0x23dbbe=await apiRequest(_0x374c12(0x189)+_0xe96742);if(!_0x23dbbe[_0x374c12(0x1c2)])throw CliErrors[_0x374c12(0x201)](_0x374c12(0x1c9)+_0xe96742);return _0x23dbbe[_0x374c12(0x1c2)];}export async function saveBffScript(_0x545cec){const _0x96e178=a158_0x2fe6,_0x287af8=await apiRequest(_0x96e178(0x1e3),{'method':'POST','body':_0x545cec}),{id:_0x5eed57,entity:_0x53bedc}=normalizeEntityWithIdResponse(_0x287af8[_0x96e178(0x1c2)]);if(_0x5eed57!==undefined){const _0x3175b7=typeof _0x53bedc[_0x96e178(0x1b6)]===_0x96e178(0x1b7)||typeof _0x53bedc[_0x96e178(0x1b2)]===_0x96e178(0x1b7)?_0x53bedc:undefined;return{'id':_0x5eed57,'script':_0x3175b7};}throw CliErrors[_0x96e178(0x17d)](_0x96e178(0x212));}export async function deleteBffScript(_0x33e2d7){const _0x11634c=a158_0x2fe6;await apiRequest(_0x11634c(0x222),{'method':_0x11634c(0x1f1),'body':{'id':_0x33e2d7}});}export async function getBffScriptStatistics(_0x38535c){const _0x5382ba=a158_0x2fe6,_0x557e81=await apiRequest(_0x5382ba(0x1f4)+_0x38535c);return extractList(_0x557e81['data']);}export async function clearBffScriptCache(){const _0x2f3c98=a158_0x2fe6,_0x23fccd=await apiRequest(_0x2f3c98(0x1ee),{'method':_0x2f3c98(0x1f1),'useRuntime':!![]});return typeof _0x23fccd[_0x2f3c98(0x1c2)]==='string'?_0x23fccd[_0x2f3c98(0x1c2)]:'';}export async function listBffDatasetOperations(_0x10ff6d,_0x137987){const _0x2d8320=a158_0x2fe6,_0x191864=await apiRequest(_0x2d8320(0x1e8),{'method':_0x2d8320(0x1f1),'body':{'appCode':_0x10ff6d,'datasetId':_0x137987}});return _0x191864[_0x2d8320(0x1c2)];}export async function listSqlQueries(_0x5c0645,_0xe41f2d){const _0x38c747=a158_0x2fe6,_0xb0be94=await apiRequest(_0x38c747(0x1bc),{'method':_0x38c747(0x1f1),'body':{'appCode':_0x5c0645,'currentPage':_0xe41f2d?.['currentPage']??0x1,'pageSize':_0xe41f2d?.[_0x38c747(0x213)]??0x32,'sqlCode':_0xe41f2d?.['sqlCode'],'sqlName':_0xe41f2d?.[_0x38c747(0x1e5)]}});return _0xb0be94[_0x38c747(0x1c2)];}export async function getSqlQueryInfo(_0x389404,_0x2ccd18){const _0x19a448=a158_0x2fe6,_0x6a30c3=await listSqlQueries(_0x389404,{'sqlCode':_0x2ccd18}),_0x43d82c=_0x6a30c3['tableData']?.[0x0];if(!_0x43d82c)throw CliErrors[_0x19a448(0x201)](_0x19a448(0x1c1)+_0x2ccd18);return _0x43d82c;}export async function getSqlQueryDetail(_0x22df43){const _0xa7fa65=a158_0x2fe6,_0x3421e4=await apiRequest(_0xa7fa65(0x1fb)+('?sqlCode='+encodeURIComponent(_0x22df43)));if(!_0x3421e4['data'])throw CliErrors[_0xa7fa65(0x201)]('SQL\x20query\x20not\x20found:\x20'+_0x22df43);return _0x3421e4[_0xa7fa65(0x1c2)];}export async function getSqlQueryDetailById(_0x12f375){const _0x37cb98=a158_0x2fe6,_0x55c3f0=await apiRequest(_0x37cb98(0x1b1)+_0x12f375);if(!_0x55c3f0['data'])throw CliErrors[_0x37cb98(0x201)](_0x37cb98(0x1ac)+_0x12f375);return _0x55c3f0[_0x37cb98(0x1c2)];}export async function createSqlQuery(_0x22ed5b){const _0x46d143=a158_0x2fe6,_0x1d7b93=await apiRequest('/smartapi/custom/saveUserCustomSql',{'method':_0x46d143(0x1f1),'body':_0x22ed5b}),{id:_0x22cdc9,entity:_0x2dcd63}=normalizeEntityWithIdResponse(_0x1d7b93[_0x46d143(0x1c2)]);if(!(_0x46d143(0x184)in _0x2dcd63)&&_0x22cdc9)return getSqlQueryDetailById(_0x22cdc9);return normalizeSqlQueryEntity(_0x2dcd63);}export async function updateSqlQuery(_0x3d4b2f){const _0x59accc=a158_0x2fe6,_0x216115=await apiRequest(_0x59accc(0x1f7),{'method':_0x59accc(0x1f1),'body':_0x3d4b2f}),{id:_0x14d347,entity:_0x562ea4}=normalizeEntityWithIdResponse(_0x216115[_0x59accc(0x1c2)]);if(!(_0x59accc(0x184)in _0x562ea4)){if(_0x3d4b2f[_0x59accc(0x184)])return getSqlQueryDetail(_0x3d4b2f[_0x59accc(0x184)]);if(_0x14d347)return getSqlQueryDetailById(_0x14d347);}return normalizeSqlQueryEntity(_0x562ea4);}export async function deleteSqlQuery(_0x595849){const _0x55d32a=a158_0x2fe6;await apiRequest('/smartapi/custom/deleteUserCustomSql',{'method':_0x55d32a(0x1f1),'body':_0x595849});}export async function saveSqlQuery(_0x500510){const _0x55bd74=a158_0x2fe6,_0x536e93=await apiRequest(_0x55bd74(0x1ad),{'method':_0x55bd74(0x1f1),'body':_0x500510});return _0x536e93[_0x55bd74(0x1c2)];}function normalizeSqlQueryEntity(_0xc97505){const _0x1a6831=a158_0x2fe6;return{..._0xc97505,'id':Number(_0xc97505['id']),'dbId':_0xc97505[_0x1a6831(0x1fd)]==null?undefined:Number(_0xc97505[_0x1a6831(0x1fd)]),'version':_0xc97505['version']==null?undefined:Number(_0xc97505['version'])};}export async function executeSql(_0x245b16,_0xe6404d,_0x3ddac2){const _0x574a76=a158_0x2fe6,_0x3bb6ee=await apiRequest(_0x574a76(0x20a),{'method':'POST','body':{'appCode':_0x245b16,'sqlCode':_0xe6404d,..._0x3ddac2&&{'params':_0x3ddac2}},'useRuntime':!![]});return _0x3bb6ee[_0x574a76(0x1c2)];}export async function executeDatasetDataOperation(_0xc38cf0,_0x2a695a,_0x521f1b,_0x4b3621={}){const _0x5add95=a158_0x2fe6;try{const _0x4960d8=await apiRequest(_0x5add95(0x209)+_0xc38cf0+'/'+_0x2a695a+'/'+_0x521f1b,{'method':'POST','body':_0x4b3621,'useRuntime':!![]});return _0x4960d8[_0x5add95(0x1c2)];}catch(_0x4f737b){if(_0x521f1b===_0x5add95(0x20c)&&_0x4f737b instanceof CliError&&_0x4f737b[_0x5add95(0x1cc)]==='api_error'&&_0x4b3621['id']!==undefined&&_0x4b3621['id']!==null&&_0x4b3621['id']!==''){const _0x508a08=await apiRequest(_0x5add95(0x209)+_0xc38cf0+'/'+_0x2a695a+_0x5add95(0x1a3),{'method':_0x5add95(0x1f1),'body':{'where':{'id':{'$eq':_0x4b3621['id']}},'currentPage':0x1,'pageSize':0x1},'useRuntime':!![]}),_0x2e8546=Array[_0x5add95(0x1cd)](_0x508a08[_0x5add95(0x1c2)]?.[_0x5add95(0x1f5)])?_0x508a08['data'][_0x5add95(0x1f5)]:[];return _0x2e8546[0x0]??null;}throw _0x4f737b;}}export async function listDatasets(_0x53fc52,_0x11c178){const _0x116683=a158_0x2fe6,_0x418f6e={'appCode':_0x53fc52,'deleted':_0x11c178?.[_0x116683(0x1d3)]??![]};if(_0x11c178?.['code'])_0x418f6e[_0x116683(0x1cc)]=_0x11c178[_0x116683(0x1cc)];if(_0x11c178?.[_0x116683(0x1c5)])_0x418f6e[_0x116683(0x1c5)]=_0x11c178[_0x116683(0x1c5)];const _0x5ebec1=await apiRequest(_0x116683(0x1c8),{'method':_0x116683(0x1f1),'body':_0x418f6e});return extractList(_0x5ebec1[_0x116683(0x1c2)]);}export async function deleteDataset(_0x247a40,_0x4d14a0){const _0x226520=a158_0x2fe6;await apiRequest('/smartapi/dataset/delete-dataset',{'method':_0x226520(0x1f1),'body':{'appCode':_0x247a40,'datasetId':_0x4d14a0}});}export async function restoreDataset(_0x34c30d,_0x1e8234){await apiRequest('/smartapi/dataset/restore-dataset',{'method':'POST','body':{'appCode':_0x34c30d,'datasetId':_0x1e8234}});}export async function searchDatasets(_0x1a1a72,_0x4412f8){const _0x468ff0=a158_0x2fe6,_0x24a2b6=await listDatasets(_0x1a1a72,{'name':_0x4412f8}),_0x1d4dfe=_0x4412f8[_0x468ff0(0x202)](),_0x230a26=new Set(_0x24a2b6[_0x468ff0(0x17e)](_0xc6dbc7=>_0xc6dbc7['id'])),_0x125efc=_0x24a2b6[_0x468ff0(0x188)](_0x2138dd=>_0x2138dd['dbtableConfig']?.[_0x468ff0(0x192)]?.['toLowerCase']()['includes'](_0x1d4dfe)||_0x2138dd[_0x468ff0(0x190)]?.[_0x468ff0(0x202)]()[_0x468ff0(0x19c)](_0x1d4dfe)),_0x27078f=await listDatasets(_0x1a1a72,{'code':_0x4412f8});for(const _0x55b065 of _0x27078f){!_0x230a26[_0x468ff0(0x1dc)](_0x55b065['id'])&&(_0x24a2b6[_0x468ff0(0x1e2)](_0x55b065),_0x230a26['add'](_0x55b065['id']));}return _0x24a2b6;}export function normalizeDatasetOperations(_0x5af014){const _0x4603c4=a158_0x2fe6;if(Array[_0x4603c4(0x1cd)](_0x5af014))return _0x5af014[_0x4603c4(0x188)](_0x10e56e=>_0x10e56e!=null&&typeof _0x10e56e===_0x4603c4(0x1d8));if(_0x5af014&&typeof _0x5af014===_0x4603c4(0x1d8))return Object[_0x4603c4(0x1f2)](_0x5af014)[_0x4603c4(0x188)](([,_0x312425])=>_0x312425!=null&&typeof _0x312425==='object')[_0x4603c4(0x17e)](([_0x1bfa30,_0x128d4a])=>({..._0x128d4a,'name':_0x128d4a[_0x4603c4(0x1c5)]??_0x128d4a[_0x4603c4(0x181)]??_0x1bfa30}));return[];}export async function getDatasetDetail(_0x1272ab){const _0x1a9f42=a158_0x2fe6,_0x2a7583=/^\d+$/[_0x1a9f42(0x21e)](_0x1272ab)?'id':_0x1a9f42(0x1cc),_0x1ed041=await apiRequest('/smartapi/dataset/get-driven-data?'+_0x2a7583+'='+_0x1272ab);return _0x1ed041[_0x1a9f42(0x1c2)];}export async function updateDrivenData(_0x892c54){const _0x118260=a158_0x2fe6,_0x356f50=await apiRequest('/smartapi/dataset/update-driven-data',{'method':'POST','body':_0x892c54});return _0x356f50[_0x118260(0x1c2)];}export async function getDatasetOperations(_0x448bda){const _0xba94d1=a158_0x2fe6,_0x7286ad=await getDatasetDetail(_0x448bda),_0x2528cc=normalizeDatasetOperations(_0x7286ad[_0xba94d1(0x21a)])[_0xba94d1(0x17e)](_0x5e895c=>({'name':_0x5e895c[_0xba94d1(0x1c5)]||_0x5e895c['operationName'],'displayName':_0x5e895c[_0xba94d1(0x203)]||_0x5e895c[_0xba94d1(0x1c5)],'type':_0x5e895c['type'],'method':_0x5e895c[_0xba94d1(0x19b)],'path':_0x5e895c['path'],'enabled':_0x5e895c[_0xba94d1(0x1b4)]??!![],'requestFields':_0x5e895c[_0xba94d1(0x1d6)],'responseFields':_0x5e895c[_0xba94d1(0x1b9)]}));return{'dataset':{'id':_0x7286ad['id']??_0x7286ad[_0xba94d1(0x186)],'name':_0x7286ad[_0xba94d1(0x1c5)],'code':_0x7286ad[_0xba94d1(0x1cc)]||_0x7286ad['modelCode'],'tableName':_0x7286ad[_0xba94d1(0x192)]||_0x7286ad[_0xba94d1(0x1e4)]?.[_0xba94d1(0x192)]},'operations':_0x2528cc};}export async function getOperationDetail(_0x3c2743,_0x23b8c4,_0x5b12c7){const _0x2a738f=a158_0x2fe6;let _0x366c7e=_0x23b8c4;if(!/^\d+$/[_0x2a738f(0x21e)](_0x23b8c4)){const _0x28cb26=await listDatasets(_0x3c2743,{'code':_0x23b8c4}),_0x23bc53=_0x28cb26[_0x2a738f(0x187)](_0x41bd8e=>_0x41bd8e[_0x2a738f(0x1cc)]===_0x23b8c4||String(_0x41bd8e['id'])===_0x23b8c4);if(!_0x23bc53)throw CliErrors[_0x2a738f(0x201)]('Dataset\x20not\x20found:\x20'+_0x23b8c4);_0x366c7e=String(_0x23bc53['id']);}const _0x54d51f=await getDatasetDetail(_0x366c7e),_0x44c12a=normalizeDatasetOperations(_0x54d51f[_0x2a738f(0x21a)])[_0x2a738f(0x187)](_0x3ae1c6=>(_0x3ae1c6[_0x2a738f(0x1c5)]||_0x3ae1c6[_0x2a738f(0x181)])===_0x5b12c7);if(!_0x44c12a)throw CliErrors[_0x2a738f(0x201)](_0x2a738f(0x204)+_0x5b12c7+_0x2a738f(0x21d)+_0x23b8c4);return{'dataset':{'id':_0x54d51f['id']??_0x54d51f[_0x2a738f(0x186)],'name':_0x54d51f['name'],'code':_0x54d51f[_0x2a738f(0x1cc)]||_0x54d51f[_0x2a738f(0x1f6)],'tableName':_0x54d51f[_0x2a738f(0x192)]||_0x54d51f[_0x2a738f(0x1e4)]?.['tableName']},'operation':_0x44c12a};}export async function startGenerateStandardPages(_0x990d85,_0x102060,_0x112a1c){const _0x2f0fe7=a158_0x2fe6,_0x20f063=await apiRequest(_0x2f0fe7(0x220)+_0x102060+_0x2f0fe7(0x197),{'method':_0x2f0fe7(0x1f1),'body':{'appCode':_0x990d85,..._0x112a1c?.[_0x2f0fe7(0x18b)]?{'clientOperationId':_0x112a1c[_0x2f0fe7(0x18b)]}:{}},'timeout':DEFAULT_REQUEST_TIMEOUT_MS});return _0x20f063[_0x2f0fe7(0x1c2)];}export async function getGenerateStandardPagesStatus(_0x3814d5,_0x3d0de8,_0x5db3b9){const _0x26c001=a158_0x2fe6,_0x4d46ae=new URLSearchParams({'appCode':_0x3814d5});_0x5db3b9[_0x26c001(0x18d)]&&_0x4d46ae[_0x26c001(0x1d0)](_0x26c001(0x18d),_0x5db3b9[_0x26c001(0x18d)]);_0x5db3b9['clientOperationId']&&_0x4d46ae[_0x26c001(0x1d0)](_0x26c001(0x18b),_0x5db3b9[_0x26c001(0x18b)]);const _0x5c7118=await apiRequest(_0x26c001(0x220)+_0x3d0de8+_0x26c001(0x1d4)+_0x4d46ae['toString']());return _0x5c7118['data'];}export async function getStandardPageStatus(_0x4a27f7,_0x3e9b35){const _0x280cae=a158_0x2fe6,_0x5dee40=await apiRequest('/smartapi/lovrabet/dataset/'+_0x3e9b35+_0x280cae(0x1af)+encodeURIComponent(_0x4a27f7));return _0x5dee40[_0x280cae(0x1c2)];}export async function tryGetStandardPageStatus(_0x30f490,_0x148be8){const _0x6fc9b2=a158_0x2fe6;try{return await getStandardPageStatus(_0x30f490,_0x148be8);}catch(_0x3247fd){if(_0x3247fd instanceof CliError&&_0x3247fd[_0x6fc9b2(0x1cc)]===_0x6fc9b2(0x1eb)&&/404|not found|non-json response/i[_0x6fc9b2(0x21e)](_0x3247fd[_0x6fc9b2(0x19d)]))return null;throw _0x3247fd;}}export async function syncStandardPages(_0x5230ee,_0x19804b){const _0x20372a=a158_0x2fe6,_0x2c2a9e=await apiRequest(_0x20372a(0x220)+_0x19804b+_0x20372a(0x1ff),{'method':_0x20372a(0x1f1),'body':{'appCode':_0x5230ee}});return _0x2c2a9e[_0x20372a(0x1c2)];}export async function getPageDetail(_0xeb2a8a){const _0x517ca6=a158_0x2fe6,_0x5d5b25=await apiRequest(_0x517ca6(0x1ec)+_0xeb2a8a);if(!_0x5d5b25['data'])throw CliErrors[_0x517ca6(0x201)](_0x517ca6(0x208)+_0xeb2a8a);return _0x5d5b25['data'];}export async function updatePage(_0x2057ae,_0x5f3fe6,_0x8cab67,_0x1e4d45){const _0x5aabe9=a158_0x2fe6,_0x495dc7=await apiRequest(_0x5aabe9(0x1b0),{'method':_0x5aabe9(0x1f1),'body':{'appCode':_0x2057ae,'pageId':_0x5f3fe6,'code':_0x8cab67,'datasetIds':_0x1e4d45}});return _0x495dc7[_0x5aabe9(0x1c2)];}export function generateSdkCode(_0x10ab95,_0x5af37c,_0x5359b4){const _0x3f89cd=a158_0x2fe6,_0x510d62=_0x5359b4?.[_0x3f89cd(0x1e9)]??!![],_0x136979=_0x3f89cd(0x195)+_0x10ab95[_0x3f89cd(0x1cc)]?.[_0x3f89cd(0x1fc)](/-/g,'_'),_0x2271db=_0x5af37c[_0x3f89cd(0x1c5)]||_0x5af37c[_0x3f89cd(0x181)]||_0x3f89cd(0x188),_0x42be29=[];_0x510d62&&_0x42be29[_0x3f89cd(0x1e2)](_0x3f89cd(0x17f),'',_0x3f89cd(0x21c),'');_0x42be29['push'](_0x3f89cd(0x211)+_0x10ab95[_0x3f89cd(0x1c5)]+'\x20('+(_0x10ab95[_0x3f89cd(0x192)]||'table')+')');if(_0x2271db===_0x3f89cd(0x188))_0x42be29[_0x3f89cd(0x1e2)]('const\x20result\x20=\x20await\x20client.models.'+_0x136979+'.filter({',_0x3f89cd(0x185),_0x3f89cd(0x200),_0x3f89cd(0x20e),_0x3f89cd(0x1a4));else{if(_0x2271db==='getOne')_0x42be29[_0x3f89cd(0x1e2)](_0x3f89cd(0x1ce)+_0x136979+_0x3f89cd(0x1bf));else{if(_0x2271db===_0x3f89cd(0x207))_0x42be29['push']('const\x20result\x20=\x20await\x20client.models.'+_0x136979+'.create({\x20/*\x20fields\x20*/\x20});');else{if(_0x2271db==='update')_0x42be29[_0x3f89cd(0x1e2)](_0x3f89cd(0x1ce)+_0x136979+_0x3f89cd(0x1e7));else _0x2271db==='delete'||_0x2271db==='remove'?_0x42be29[_0x3f89cd(0x1e2)](_0x3f89cd(0x1ce)+_0x136979+'.remove(id);'):_0x42be29[_0x3f89cd(0x1e2)]('const\x20result\x20=\x20await\x20client.models.'+_0x136979+'.'+_0x2271db+_0x3f89cd(0x1bd));}}}return _0x42be29[_0x3f89cd(0x183)]('\x0a');}export function generateSqlCodeTemplate(_0x225a95,_0x5416c0){const _0x1ba8b0=a158_0x2fe6,_0x5a5867=_0x5416c0?.['target']??_0x1ba8b0(0x17c),_0x506bda=_0x5416c0?.[_0x1ba8b0(0x1e9)]??!![],_0x53cfbe=[];return _0x53cfbe[_0x1ba8b0(0x1e2)](_0x1ba8b0(0x1a0)+_0x225a95[_0x1ba8b0(0x1e5)]+'\x20('+_0x225a95[_0x1ba8b0(0x184)]+')'),_0x5a5867===_0x1ba8b0(0x17c)?(_0x506bda&&_0x53cfbe[_0x1ba8b0(0x1e2)]('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x1ba8b0(0x21c),''),_0x53cfbe[_0x1ba8b0(0x1e2)](_0x1ba8b0(0x20b),'\x20\x20sqlCode:\x20\x27'+_0x225a95['sqlCode']+'\x27,',_0x1ba8b0(0x224),'});',_0x1ba8b0(0x198),_0x1ba8b0(0x1db))):_0x53cfbe['push']('//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{',_0x1ba8b0(0x1b5),_0x1ba8b0(0x1d2)+_0x225a95[_0x1ba8b0(0x184)]+'\x27,','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},',_0x1ba8b0(0x18e),_0x1ba8b0(0x182),'}'),_0x53cfbe[_0x1ba8b0(0x183)]('\x0a');}export async function getErConfig(_0x3f39dd,_0x244c0b){const _0x420995=a158_0x2fe6,_0x2b5a49=await apiRequest(_0x420995(0x1ea),{'method':_0x420995(0x1f1),'body':{'appCode':_0x3f39dd,'dblinkId':_0x244c0b},'timeout':ER_CONFIG_REQUEST_TIMEOUT_MS});return _0x2b5a49[_0x420995(0x1c2)];}export async function createErRelation(_0x3a669c){const _0x5586c4=a158_0x2fe6,_0x52ab9d=await apiRequest(_0x5586c4(0x1be),{'method':'POST','body':_0x3a669c,'allowNonJsonSuccess':!![]});return _0x52ab9d[_0x5586c4(0x1c2)];}export async function updateErRelation(_0x10a067){const _0x30945c=a158_0x2fe6,_0x3200e5=await apiRequest(_0x30945c(0x1f8),{'method':_0x30945c(0x1f1),'body':_0x10a067,'allowNonJsonSuccess':!![]});return _0x3200e5[_0x30945c(0x1c2)];}export async function deleteErRelation(_0x2b70f6){const _0x537fd9=a158_0x2fe6,_0x557938=await apiRequest(_0x537fd9(0x1c0),{'method':'POST','body':_0x2b70f6,'allowNonJsonSuccess':!![]});return _0x557938[_0x537fd9(0x1c2)];}function a158_0x2fe6(_0x352854,_0x5b188f){_0x352854=_0x352854-0x17a;const _0x4b14be=a158_0x4b14();let _0x2fe64f=_0x4b14be[_0x352854];return _0x2fe64f;}export async function updateErBusinessGroup(_0x4110df){const _0x3ea41b=a158_0x2fe6,_0x3bcfc1=await apiRequest(_0x3ea41b(0x180),{'method':_0x3ea41b(0x1f1),'body':_0x4110df,'allowNonJsonSuccess':!![]});return _0x3bcfc1[_0x3ea41b(0x1c2)];}function buildQuery(_0x9d800b){const _0x584234=a158_0x2fe6,_0x2dfa9e=new URLSearchParams();for(const [_0x1e0f0e,_0x4421d8]of Object['entries'](_0x9d800b)){if(_0x4421d8===undefined||_0x4421d8==='')continue;_0x2dfa9e[_0x584234(0x1d0)](_0x1e0f0e,String(_0x4421d8));}const _0x39ee95=_0x2dfa9e[_0x584234(0x1d5)]();return _0x39ee95?'?'+_0x39ee95:'';}export async function listAppConfigs(_0x5d5542,_0x30ab7d){const _0x468dc0=a158_0x2fe6,_0x3c3ebe=await apiRequest(_0x468dc0(0x20f),{'method':_0x468dc0(0x1f1),'body':{'appCode':_0x5d5542,..._0x30ab7d?.[_0x468dc0(0x1c7)]?{'key':_0x30ab7d[_0x468dc0(0x1c7)]}:{},..._0x30ab7d?.['tags']?{'tags':_0x30ab7d[_0x468dc0(0x1a6)]}:{}}});return extractAppConfigList(_0x3c3ebe[_0x468dc0(0x1c2)]);}export async function getAppConfigByKey(_0x68902b,_0x117f03){const _0x2ce98e=a158_0x2fe6,_0x5a6f10=await apiRequest(_0x2ce98e(0x18c)+buildQuery({'appCode':_0x68902b,'key':_0x117f03}));return _0x5a6f10[_0x2ce98e(0x1c2)]??null;}export async function createAppConfig(_0x21af6a){const _0x24d255=a158_0x2fe6,_0x2ed9e3=await apiRequest(_0x24d255(0x215),{'method':_0x24d255(0x1f1),'body':{'appCode':_0x21af6a['appCode'],'key':_0x21af6a[_0x24d255(0x1c7)],'value':_0x21af6a[_0x24d255(0x17b)],..._0x21af6a[_0x24d255(0x1a6)]?{'tags':_0x21af6a['tags']}:{}}});return _0x2ed9e3[_0x24d255(0x1c2)];}export async function updateAppConfig(_0x2c29c8){const _0x48eb91=a158_0x2fe6;await apiRequest(_0x48eb91(0x18a),{'method':_0x48eb91(0x1f1),'body':{'id':_0x2c29c8['id'],'appCode':_0x2c29c8['appCode'],'key':_0x2c29c8[_0x48eb91(0x1c7)],'value':_0x2c29c8[_0x48eb91(0x17b)],..._0x2c29c8[_0x48eb91(0x1a6)]?{'tags':_0x2c29c8[_0x48eb91(0x1a6)]}:{}}});}export async function deleteAppConfig(_0x592138){const _0x3028bd=a158_0x2fe6;await apiRequest(_0x3028bd(0x1d7),{'method':_0x3028bd(0x1f1),'body':_0x592138});}function extractAppConfigList(_0x538203){const _0x935018=a158_0x2fe6;if(Array[_0x935018(0x1cd)](_0x538203))return _0x538203;if(_0x538203&&typeof _0x538203===_0x935018(0x1d8)&&Array['isArray'](_0x538203[_0x935018(0x1a1)]))return _0x538203[_0x935018(0x1a1)];return extractList(_0x538203);}export async function listDbLinks(_0x220680,_0x368f32){const _0x592b21=a158_0x2fe6,_0x40d72c=await apiRequest(_0x592b21(0x1e0),{'method':'POST','body':{'appCode':_0x220680,'currentPage':_0x368f32?.[_0x592b21(0x193)]??0x1,'pageSize':_0x368f32?.['pageSize']??0x64}});return{'items':extractList(_0x40d72c['data']),'paging':extractPaging(_0x40d72c[_0x592b21(0x1c2)])};}export async function getDbLinkInfo(_0x1d1091){const _0x570e2f=a158_0x2fe6,_0x5b5b23=await apiRequest('/smartapi/dblink/getOne'+buildQuery({'id':_0x1d1091}));return _0x5b5b23[_0x570e2f(0x1c2)];}export async function createDbLink(_0xc3a789){const _0x416949=a158_0x2fe6,_0xcbd7f9=await apiRequest(_0x416949(0x194),{'method':_0x416949(0x1f1),'body':_0xc3a789});return _0xcbd7f9[_0x416949(0x1c2)];}export async function updateDbLink(_0x4f66b6){const _0x2f1814=a158_0x2fe6,_0x230c36=await apiRequest('/smartapi/dblink/update',{'method':_0x2f1814(0x1f1),'body':_0x4f66b6});return _0x230c36[_0x2f1814(0x1c2)];}export async function deleteDbLink(_0x911511){await apiRequest('/smartapi/dblink/delete',{'method':'POST','body':{'id':_0x911511}});}export async function testDbLinkConnect(_0x18d810){const _0x2c14c1=a158_0x2fe6,_0x4f7faa=await apiRequest(_0x2c14c1(0x1a9)+buildQuery({'id':_0x18d810}));return _0x4f7faa[_0x2c14c1(0x1c2)];}export async function startDbAnalysis(_0x42e178,_0x1fdded){const _0x4151c8=a158_0x2fe6,_0x2c097f=await apiRequest(_0x4151c8(0x1fe),{'method':_0x4151c8(0x1f1),'body':{'dbLinkId':_0x42e178,..._0x1fdded&&_0x1fdded[_0x4151c8(0x1c3)]>0x0?{'tableNames':_0x1fdded}:{}}}),_0x5081ac=_0x2c097f[_0x4151c8(0x1c2)];if(typeof _0x5081ac===_0x4151c8(0x1b7))return _0x5081ac;if(_0x5081ac&&typeof _0x5081ac===_0x4151c8(0x1d8)&&typeof _0x5081ac['planId']===_0x4151c8(0x1b7))return _0x5081ac[_0x4151c8(0x1a5)];return _0x5081ac!=null?String(_0x5081ac):'';}export async function cancelDbAnalysis(_0x543138){const _0xbcf786=a158_0x2fe6;await apiRequest('/smartapi/db-analysis/jobs/cancel'+buildQuery({'planId':_0x543138}),{'method':_0xbcf786(0x1f1)});}export async function getDbAnalysisStatus(_0x5650a9){const _0x381431=a158_0x2fe6,_0x4197be=await apiRequest('/smartapi/db-analysis/status/'+encodeURIComponent(_0x5650a9));return _0x4197be[_0x381431(0x1c2)];}export async function getDbAllTableList(_0x32b4ca,_0xfc1977){const _0x4d5a8b=a158_0x2fe6,_0x4db156=await apiRequest(_0x4d5a8b(0x1ba)+buildQuery({'appCode':_0x32b4ca,'dbLinkId':_0xfc1977})),_0x320cb6=_0x4db156['data'];if(Array[_0x4d5a8b(0x1cd)](_0x320cb6))return _0x320cb6;return extractList(_0x320cb6);}export async function getDbTableDiff(_0x640769,_0xbfdc57,_0x45ef5d){const _0x3d1b69=a158_0x2fe6,_0x4b4e34=await apiRequest(_0x3d1b69(0x210)+buildQuery({'appCode':_0x640769,'dbLinkId':_0xbfdc57,'pageIndex':_0x45ef5d?.[_0x3d1b69(0x19f)]??0x1,'pageSize':_0x45ef5d?.[_0x3d1b69(0x213)]??0x14,'tableName':_0x45ef5d?.[_0x3d1b69(0x192)]})),_0x742d3c=_0x4b4e34['data'];return{'totalCount':_0x742d3c?.[_0x3d1b69(0x206)]??0x0,'physicalTableCount':_0x742d3c?.[_0x3d1b69(0x1bb)]??0x0,'datasetTableCount':_0x742d3c?.[_0x3d1b69(0x223)]??0x0,..._0x742d3c?.['summary']?{'summary':_0x742d3c['summary']}:{},'tableList':Array[_0x3d1b69(0x1cd)](_0x742d3c?.[_0x3d1b69(0x1f9)])?_0x742d3c['tableList']:[]};}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x1e38d8=a158_0x2fe6,_0x47e156=await apiRequest('/smartapi/app/getList',{'method':'POST','body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x26e93d=extractList(_0x47e156['data']),_0x415ca0=extractPaging(_0x47e156[_0x1e38d8(0x1c2)]);return _0x415ca0&&_0x415ca0[_0x1e38d8(0x206)]>REMOTE_APP_PAGE_SIZE&&console[_0x1e38d8(0x1dd)](_0x1e38d8(0x19a)+REMOTE_APP_PAGE_SIZE+_0x1e38d8(0x1ae)+_0x415ca0[_0x1e38d8(0x206)]+_0x1e38d8(0x1de)+_0x1e38d8(0x1da)),_0x26e93d;}
|
package/lib/core/bff/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a159_0x536ca9=a159_0x2706;(function(_0x1b3796,_0x27e632){const _0x5815a2=a159_0x2706,_0xf70e1b=_0x1b3796();while(!![]){try{const _0x59078e=-parseInt(_0x5815a2(0x156))/0x1+parseInt(_0x5815a2(0x14e))/0x2+-parseInt(_0x5815a2(0x151))/0x3*(-parseInt(_0x5815a2(0x152))/0x4)+parseInt(_0x5815a2(0x157))/0x5+parseInt(_0x5815a2(0x153))/0x6+-parseInt(_0x5815a2(0x154))/0x7+parseInt(_0x5815a2(0x158))/0x8*(-parseInt(_0x5815a2(0x155))/0x9);if(_0x59078e===_0x27e632)break;else _0xf70e1b['push'](_0xf70e1b['shift']());}catch(_0x161761){_0xf70e1b['push'](_0xf70e1b['shift']());}}}(a159_0xe878,0x6adb2));import{resolve}from'node:path';function a159_0xe878(){const _0x79ba24=['1762364sSzrOv','3431298YGXeIY','4831750JqXLjv','273825zyyRAs','582968ANZdAK','1056290TnpLma','56zXvHgQ','.rabetbase','1400286tIsidU','/bff','bff','3kGrsir'];a159_0xe878=function(){return _0x79ba24;};return a159_0xe878();}function a159_0x2706(_0x5afe38,_0x24e71e){_0x5afe38=_0x5afe38-0x14e;const _0xe878b3=a159_0xe878();let _0x2706d3=_0xe878b3[_0x5afe38];return _0x2706d3;}import{findProjectRootDirectory}from'../../context.js';const DOT_DIR=a159_0x536ca9(0x159),LOCK_FILE_NAME='bff.lock.json',TRASH_DIR_NAME='bff-trash';export function loadBffProjectConfig(_0xb39713,_0x8bf120){const _0x2fc350=a159_0x536ca9,_0xadf60c=resolve(_0x8bf120??findProjectRootDirectory()),_0x2fd0e7=DOT_DIR+_0x2fc350(0x14f),_0x16fcd0=_0x2fd0e7+'/'+_0xb39713;return{'projectRoot':_0xadf60c,'appCode':_0xb39713,'scriptsBaseDir':DOT_DIR,'scriptsWorkspaceRoot':_0x2fd0e7,'scriptsRoot':_0x16fcd0,'scriptsRootDir':resolve(_0xadf60c,DOT_DIR,_0x2fc350(0x150),_0xb39713),'lockFilePath':resolve(_0xadf60c,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0xadf60c,DOT_DIR,TRASH_DIR_NAME)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a160_0x3ea255=a160_0x2375;(function(_0x37cd51,_0x5390a1){const _0x1e0d7e=a160_0x2375,_0x5028b1=_0x37cd51();while(!![]){try{const _0x4e4875=-parseInt(_0x1e0d7e(0x10f))/0x1*(-parseInt(_0x1e0d7e(0x10d))/0x2)+-parseInt(_0x1e0d7e(0xfc))/0x3+parseInt(_0x1e0d7e(0x10e))/0x4*(-parseInt(_0x1e0d7e(0xf9))/0x5)+-parseInt(_0x1e0d7e(0xfd))/0x6*(parseInt(_0x1e0d7e(0xf7))/0x7)+-parseInt(_0x1e0d7e(0xfb))/0x8*(parseInt(_0x1e0d7e(0x100))/0x9)+parseInt(_0x1e0d7e(0xe6))/0xa+parseInt(_0x1e0d7e(0xee))/0xb*(parseInt(_0x1e0d7e(0xea))/0xc);if(_0x4e4875===_0x5390a1)break;else _0x5028b1['push'](_0x5028b1['shift']());}catch(_0x452859){_0x5028b1['push'](_0x5028b1['shift']());}}}(a160_0x566b,0x8c2cf));import{access,mkdir,readdir,stat}from'node:fs/promises';import{constants}from'node:fs';function a160_0x2375(_0x3fb5da,_0x509f31){_0x3fb5da=_0x3fb5da-0xe6;const _0x566b6f=a160_0x566b();let _0x2375a7=_0x566b6f[_0x3fb5da];return _0x2375a7;}import{dirname,join}from'node:path';import{findHookLocationByRemoteId,snakeToCamel}from'../../core/bff/utils.js';export const SUPPORTED_BFF_TYPES=[a160_0x3ea255(0x102),a160_0x3ea255(0x10c),a160_0x3ea255(0xfa)];export function normalizeBffType(_0x55ac92){const _0x3210ed=a160_0x3ea255;if(!_0x55ac92)return undefined;const _0x524fb4=_0x55ac92[_0x3210ed(0x104)]()['toUpperCase']();return SUPPORTED_BFF_TYPES[_0x3210ed(0xf6)](_0x524fb4)?_0x524fb4:undefined;}async function scanJsFilesRecursively(_0x86c198,_0x5dcf7a){const _0x438e5f=a160_0x3ea255,_0x524497=[];try{const _0x373293=await readdir(_0x86c198,{'withFileTypes':!![]});for(const _0x6d1b7b of _0x373293){const _0x13df80=join(_0x86c198,_0x6d1b7b['name']);if(_0x6d1b7b[_0x438e5f(0xf3)]())_0x524497['push'](...await scanJsFilesRecursively(_0x13df80,_0x5dcf7a+'/'+_0x6d1b7b[_0x438e5f(0x106)]));else _0x6d1b7b[_0x438e5f(0xe8)]()&&_0x6d1b7b[_0x438e5f(0x106)][_0x438e5f(0xf5)](_0x438e5f(0xef))&&_0x524497[_0x438e5f(0x101)]({'lockKey':_0x5dcf7a+'/'+_0x6d1b7b['name'][_0x438e5f(0xe7)](/\.js$/,''),'filePath':_0x13df80});}}catch(_0x24a8e8){if(_0x24a8e8['code']!==_0x438e5f(0x10b))throw _0x24a8e8;}return _0x524497;}async function scanFlatFunctions(_0x1f9f50,_0x3245c3){const _0x3fb906=a160_0x3ea255,_0x1c5761=join(_0x1f9f50[_0x3fb906(0xe9)],_0x3245c3),_0x5f4686=await scanJsFilesRecursively(_0x1c5761,_0x3245c3);return _0x5f4686[_0x3fb906(0xeb)](({lockKey:_0x347bc6,filePath:_0x4d45ea})=>({'type':_0x3245c3,'name':_0x347bc6[_0x3fb906(0x107)]('/')['at'](-0x1)??'','filePath':_0x4d45ea,'lockKey':_0x347bc6}));}async function scanHookFunctions(_0x58289b){const _0xd7776e=a160_0x3ea255,_0x37560b=join(_0x58289b[_0xd7776e(0xe9)],_0xd7776e(0xfa)),_0x46726e=[];try{const _0x53631b=await readdir(_0x37560b,{'withFileTypes':!![]});for(const _0x44d6be of _0x53631b){if(!_0x44d6be[_0xd7776e(0xf3)]())continue;const _0x5576af=_0x44d6be[_0xd7776e(0x106)],_0x515078=join(_0x37560b,_0x5576af),_0x4fab0c=await readdir(_0x515078,{'withFileTypes':!![]});for(const _0x5165cd of _0x4fab0c){if(!_0x5165cd[_0xd7776e(0xf3)]())continue;const _0x959fd5=_0x5165cd[_0xd7776e(0x106)],_0x542149=join(_0x515078,_0x959fd5),_0x3fe32f=await readdir(_0x542149,{'withFileTypes':!![]});for(const _0x413d73 of _0x3fe32f){if(!_0x413d73[_0xd7776e(0xf3)]())continue;const _0x25eb98=_0x413d73[_0xd7776e(0x106)],_0x1846ad=join(_0x542149,_0x25eb98),_0x37b8d9=await readdir(_0x1846ad,{'withFileTypes':!![]});for(const _0x2ff681 of _0x37b8d9){if(!_0x2ff681[_0xd7776e(0xe8)]()||!_0x2ff681[_0xd7776e(0x106)][_0xd7776e(0xf5)](_0xd7776e(0xef)))continue;const _0x1278a9=_0x2ff681['name']['replace'](/\.js$/,'');_0x46726e[_0xd7776e(0x101)]({'type':_0xd7776e(0xfa),'name':_0x1278a9,'filePath':join(_0x1846ad,_0x2ff681[_0xd7776e(0x106)]),'lockKey':_0xd7776e(0x110)+_0x5576af+'/'+_0x959fd5+'/'+_0x25eb98+'/'+_0x1278a9,'alias':_0x5576af,'operationType':_0x959fd5,'functionNode':_0x25eb98});}}}}}catch(_0x4923f4){if(_0x4923f4[_0xd7776e(0xfe)]!=='ENOENT')throw _0x4923f4;}return _0x46726e;}export async function scanLocalBffFunctions(_0x4fce0d,_0x10f0ea){const _0x5afdf4=a160_0x3ea255;if(_0x10f0ea==='COMMON'||_0x10f0ea===_0x5afdf4(0x10c))return scanFlatFunctions(_0x4fce0d,_0x10f0ea);if(_0x10f0ea===_0x5afdf4(0xfa))return scanHookFunctions(_0x4fce0d);const [_0x251037,_0x4b9c8f,_0x2812b2]=await Promise[_0x5afdf4(0x108)]([scanFlatFunctions(_0x4fce0d,_0x5afdf4(0x102)),scanFlatFunctions(_0x4fce0d,_0x5afdf4(0x10c)),scanHookFunctions(_0x4fce0d)]);return[..._0x251037,..._0x4b9c8f,..._0x2812b2];}export function resolveLocalFilePathFromLockKey(_0x1567da,_0x1f141b){const _0x57c810=a160_0x3ea255;return join(_0x1567da['scriptsRootDir'],..._0x1f141b['split']('/'))+_0x57c810(0xef);}export function createHookLocationMap(_0x1458e3){const _0x2afb4f=a160_0x3ea255,_0xf9bf0=new Map();for(const _0x1071ef of _0x1458e3){_0x1071ef[_0x2afb4f(0x10a)]&&_0xf9bf0[_0x2afb4f(0xff)](_0x1071ef[_0x2afb4f(0x10a)],{'datasetCode':_0x1071ef[_0x2afb4f(0xf2)],'operationType':snakeToCamel(_0x1071ef[_0x2afb4f(0xf0)]),'functionNode':_0x2afb4f(0xf4)}),_0x1071ef['afterScriptId']&&_0xf9bf0[_0x2afb4f(0xff)](_0x1071ef[_0x2afb4f(0xed)],{'datasetCode':_0x1071ef[_0x2afb4f(0xf2)],'operationType':snakeToCamel(_0x1071ef[_0x2afb4f(0xf0)]),'functionNode':_0x2afb4f(0xf1)});}return _0xf9bf0;}function a160_0x566b(){const _0x49f071=['get','name','split','all','functionNode','beforeScriptId','ENOENT','ENDPOINT','470gHZBCu','4eFaayN','4265BjmNzO','HOOK/','3362640VeAdbv','replace','isFile','scriptsRootDir','20451684kbKEjK','map','alias','afterScriptId','11vvYWEn','.js','operationType','after','datasetCode','isDirectory','before','endsWith','includes','7tFUWCn','functionName','2917205VYKMyC','HOOK','8273336ggVoSc','1791966yCdDkc','1522542GpYOeA','code','set','9ZvdeDA','push','COMMON','F_OK','trim'];a160_0x566b=function(){return _0x49f071;};return a160_0x566b();}export function resolveRemoteScriptTarget(_0x1a37ff,_0x273b81,_0x3a5d08,_0x544dc6,_0x2eacad){const _0x68e163=a160_0x3ea255,_0xfb7e8f=normalizeBffType(_0x273b81['scriptType']);if(!_0xfb7e8f||!_0x273b81[_0x68e163(0xf8)])return null;if(_0xfb7e8f===_0x68e163(0xfa)){const _0x2a26eb=(_0x273b81['id']?_0x3a5d08[_0x68e163(0x105)](_0x273b81['id']):undefined)??findHookLocationByRemoteId(_0x544dc6,_0x273b81['id']);if(!_0x2a26eb)return null;const _0x1b8b5e=_0x2a26eb[_0x68e163(0xec)]||_0x2eacad[_0x68e163(0x105)](_0x2a26eb[_0x68e163(0xf2)]),_0x2019f5=_0x1b8b5e??_0x2a26eb[_0x68e163(0xf2)],_0x25c31e={..._0x2a26eb,'alias':_0x1b8b5e},_0x11328b='HOOK/'+_0x2019f5+'/'+_0x25c31e[_0x68e163(0xf0)]+'/'+_0x25c31e[_0x68e163(0x109)]+'/'+_0x273b81['functionName'];return{'lockKey':_0x11328b,'filePath':resolveLocalFilePathFromLockKey(_0x1a37ff,_0x11328b),'type':_0x68e163(0xfa),'hookLocation':_0x25c31e};}const _0x3357e7=_0xfb7e8f+'/'+_0x273b81[_0x68e163(0xf8)];return{'lockKey':_0x3357e7,'filePath':resolveLocalFilePathFromLockKey(_0x1a37ff,_0x3357e7),'type':_0xfb7e8f};}export async function ensureParentDirectory(_0x3ef9f9){await mkdir(dirname(_0x3ef9f9),{'recursive':!![]});}export async function fileExists(_0x4ef453){const _0x1403e5=a160_0x3ea255;try{return await access(_0x4ef453,constants[_0x1403e5(0x103)]),!![];}catch{return![];}}export async function directoryExists(_0x4992df){const _0x569316=a160_0x3ea255;try{const _0x1964a3=await stat(_0x4992df);return _0x1964a3[_0x569316(0xf3)]();}catch{return![];}}
|
package/lib/core/bff/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x541bb3,_0x1769d4){const _0x2b8732=a161_0x4642,_0x232c59=_0x541bb3();while(!![]){try{const _0x3a6886=parseInt(_0x2b8732(0x132))/0x1+parseInt(_0x2b8732(0x127))/0x2*(-parseInt(_0x2b8732(0x130))/0x3)+parseInt(_0x2b8732(0x125))/0x4*(parseInt(_0x2b8732(0x126))/0x5)+-parseInt(_0x2b8732(0x12c))/0x6*(-parseInt(_0x2b8732(0x12d))/0x7)+parseInt(_0x2b8732(0x133))/0x8*(parseInt(_0x2b8732(0x12b))/0x9)+-parseInt(_0x2b8732(0x12e))/0xa+-parseInt(_0x2b8732(0x129))/0xb;if(_0x3a6886===_0x1769d4)break;else _0x232c59['push'](_0x232c59['shift']());}catch(_0x1a3837){_0x232c59['push'](_0x232c59['shift']());}}}(a161_0x2899,0xbebde));import{readFile}from'node:fs/promises';import a161_0xded2d9 from'node:crypto';export function computeContentHash(_0x24699e){const _0x3a75c4=a161_0x4642;return a161_0xded2d9[_0x3a75c4(0x12a)]('md5')[_0x3a75c4(0x131)](_0x24699e)[_0x3a75c4(0x128)](_0x3a75c4(0x12f));}function a161_0x2899(){const _0x32e04e=['7423449PzMUbL','createHash','6543GQTJnP','54TVzoHL','804909YmrCyW','1913240WLiAtz','hex','3ANWVuQ','update','302315iwMALw','10952haWcxj','135896BCbcwi','50dSvmxG','2049480bvyVOL','digest'];a161_0x2899=function(){return _0x32e04e;};return a161_0x2899();}function a161_0x4642(_0x15b1d9,_0x48512c){_0x15b1d9=_0x15b1d9-0x125;const _0x2899f9=a161_0x2899();let _0x4642fd=_0x2899f9[_0x15b1d9];return _0x4642fd;}export async function computeFileHash(_0x3282e5){const _0x522bbd=await readFile(_0x3282e5,'utf8');return computeContentHash(_0x522bbd);}
|
package/lib/core/bff/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x127527,_0x41e5a4){const _0x2dd014=a162_0x558b,_0x5c5607=_0x127527();while(!![]){try{const _0x142fc2=-parseInt(_0x2dd014(0xb7))/0x1*(parseInt(_0x2dd014(0xb5))/0x2)+parseInt(_0x2dd014(0xb1))/0x3*(-parseInt(_0x2dd014(0xa4))/0x4)+-parseInt(_0x2dd014(0xab))/0x5+-parseInt(_0x2dd014(0xa2))/0x6+-parseInt(_0x2dd014(0xac))/0x7+parseInt(_0x2dd014(0xb6))/0x8*(-parseInt(_0x2dd014(0xa3))/0x9)+-parseInt(_0x2dd014(0xa5))/0xa*(-parseInt(_0x2dd014(0xa6))/0xb);if(_0x142fc2===_0x41e5a4)break;else _0x5c5607['push'](_0x5c5607['shift']());}catch(_0x2efb40){_0x5c5607['push'](_0x5c5607['shift']());}}}(a162_0x3a04,0xc9e42));function a162_0x558b(_0x7988d6,_0x32f85b){_0x7988d6=_0x7988d6-0xa2;const _0x3a04a7=a162_0x3a04();let _0x558b1c=_0x3a04a7[_0x7988d6];return _0x558b1c;}import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';export function createEmptyBffLock(){return{'apps':{}};}export function ensureLockScope(_0x1e5414,_0x5180be,_0x5d1b47,_0x488ebb){const _0x5a3bbf=a162_0x558b,_0x59294a={'apps':_0x1e5414[_0x5a3bbf(0xae)]&&typeof _0x1e5414[_0x5a3bbf(0xae)]===_0x5a3bbf(0xa9)?_0x1e5414['apps']:{}};let _0x1c86f6=_0x59294a[_0x5a3bbf(0xae)][_0x5180be];if(!_0x1c86f6)return _0x1c86f6={'scriptsRoot':_0x5d1b47,'lastSync':'','functions':{}},_0x59294a[_0x5a3bbf(0xae)][_0x5180be]=_0x1c86f6,{'lockData':_0x59294a,'appLock':_0x1c86f6};if(!_0x1c86f6[_0x5a3bbf(0xb2)])_0x1c86f6[_0x5a3bbf(0xb2)]=_0x5d1b47;else{if(_0x1c86f6['scriptsRoot']!==_0x5d1b47)throw new Error(_0x488ebb+_0x5a3bbf(0xa8)+(_0x5a3bbf(0xad)+_0x5d1b47+_0x5a3bbf(0xb4)+_0x1c86f6[_0x5a3bbf(0xb2)]+'\x22.\x20')+_0x5a3bbf(0xb0));}return!_0x1c86f6['functions']&&(_0x1c86f6['functions']={}),!_0x1c86f6[_0x5a3bbf(0xaa)]&&(_0x1c86f6['lastSync']=''),{'lockData':_0x59294a,'appLock':_0x1c86f6};}export async function readBffLockFile(_0x131493){const _0x3645e8=a162_0x558b;try{const _0x46e16b=await readFile(_0x131493,_0x3645e8(0xa7)),_0x1045f7=JSON['parse'](_0x46e16b);return{'apps':_0x1045f7[_0x3645e8(0xae)]&&typeof _0x1045f7[_0x3645e8(0xae)]==='object'?_0x1045f7[_0x3645e8(0xae)]:{}};}catch(_0x2ef024){if(_0x2ef024['code']===_0x3645e8(0xaf))return null;throw new Error(_0x3645e8(0xb3)+String(_0x2ef024));}}function a162_0x3a04(){const _0x36126b=['9xeVPAI','89444WvLYvA','59088430JaNcqy','11QCKeNI','utf8',':\x20scriptsRoot\x20mismatch\x20—\x20','object','lastSync','4777145laWkEM','10646174QcUiXx','current\x20\x22','apps','ENOENT','Check\x20.rabetbase/bff.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','111OKXwZb','scriptsRoot','Failed\x20to\x20read\x20BFF\x20lock\x20file:\x20','\x22\x20vs\x20lock\x20\x22','198kDfsPL','1504720LfwaVB','1899lVqMYz','stringify','8412828qdtruB'];a162_0x3a04=function(){return _0x36126b;};return a162_0x3a04();}export async function writeBffLockFile(_0x2783a9,_0x1993ee){const _0x359c3d=a162_0x558b;await mkdir(dirname(_0x2783a9),{'recursive':!![]}),await writeFile(_0x2783a9,JSON[_0x359c3d(0xb8)](_0x1993ee,null,0x2),_0x359c3d(0xa7));}
|
package/lib/core/bff/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a164_0x5e9b(_0x29e02a,_0x39a1dc){_0x29e02a=_0x29e02a-0x156;const _0x20e36a=a164_0x20e3();let _0x5e9b79=_0x20e36a[_0x29e02a];return _0x5e9b79;}(function(_0x24cb01,_0x4909f1){const _0x4faa4b=a164_0x5e9b,_0x4f047e=_0x24cb01();while(!![]){try{const _0x25301b=-parseInt(_0x4faa4b(0x162))/0x1+parseInt(_0x4faa4b(0x15d))/0x2*(parseInt(_0x4faa4b(0x166))/0x3)+-parseInt(_0x4faa4b(0x156))/0x4+-parseInt(_0x4faa4b(0x168))/0x5*(parseInt(_0x4faa4b(0x169))/0x6)+-parseInt(_0x4faa4b(0x163))/0x7+-parseInt(_0x4faa4b(0x160))/0x8+parseInt(_0x4faa4b(0x158))/0x9;if(_0x25301b===_0x4909f1)break;else _0x4f047e['push'](_0x4f047e['shift']());}catch(_0x1fc206){_0x4f047e['push'](_0x4f047e['shift']());}}}(a164_0x20e3,0x91f11));export function snakeToCamel(_0x267839){const _0x3f8c54=a164_0x5e9b;return _0x267839[_0x3f8c54(0x157)]()[_0x3f8c54(0x159)](/_([a-z])/g,(_0x3f1620,_0xcff8e5)=>_0xcff8e5[_0x3f8c54(0x15f)]());}export function findHookLocationByRemoteId(_0xb23473,_0x3c1b11){const _0x52daa0=a164_0x5e9b;if(!_0x3c1b11)return undefined;for(const _0x44cce1 of Object['values'](_0xb23473)){if(_0x44cce1[_0x52daa0(0x16a)]===_0x3c1b11&&_0x44cce1[_0x52daa0(0x15a)]&&_0x44cce1[_0x52daa0(0x15b)]&&_0x44cce1[_0x52daa0(0x161)])return{'datasetCode':_0x44cce1['datasetCode'],'operationType':_0x44cce1[_0x52daa0(0x15b)],'functionNode':_0x44cce1[_0x52daa0(0x161)]};}return undefined;}export function extractScriptDescription(_0x38b548){const _0x2e0319=a164_0x5e9b,_0x226b3f=_0x38b548[_0x2e0319(0x167)](/\[\s*脚本描述\s*]\s*(.+)/);return _0x226b3f?.[0x1]?.[_0x2e0319(0x15c)]()||undefined;}function a164_0x20e3(){const _0x6d779d=['remoteId','4580608QeTEGp','toLowerCase','44121870ppGDwT','replace','datasetCode','operationType','trim','90212SfHVCu','before','toUpperCase','611648KBuUdi','functionNode','1138008SUYudM','6379471cxtTxb','after','test','6VoQxkf','match','120DUUpaU','280974ViZlZk'];a164_0x20e3=function(){return _0x6d779d;};return a164_0x20e3();}export function isValidBffFunctionName(_0x5addf){const _0x4cc912=a164_0x5e9b;return/^[A-Za-z_$][A-Za-z0-9_$]*$/[_0x4cc912(0x165)](_0x5addf);}export function normalizeHookFunctionNode(_0x484fdb){const _0x49ee6d=a164_0x5e9b;if(!_0x484fdb)return undefined;const _0x2d5ae9=_0x484fdb[_0x49ee6d(0x15c)]()[_0x49ee6d(0x157)]();if(_0x2d5ae9===_0x49ee6d(0x15e)||_0x2d5ae9===_0x49ee6d(0x164))return _0x2d5ae9;return undefined;}
|
package/lib/core/db-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a165_0x358b(){const _0x532659=['toLowerCase','330824nossGi','959ypEWKP','length','isNaN','.\x20Be\x20more\x20specific.','2634992YTwWiT','1788345NfgXbA','\x22.\x20Available:\x20','find','dbtableConfig','filter','28470OrgGBX','No\x20database\x20matching\x20\x22','\x22\x20under\x20app\x20\x22','1167129rucDff','338474nSXiee','has','join','get','dbId','db-','853272zopgVy','dbName','map','set'];a165_0x358b=function(){return _0x532659;};return a165_0x358b();}(function(_0x54ca1d,_0x67124b){const _0x4be477=a165_0x4d3b,_0x14554c=_0x54ca1d();while(!![]){try{const _0x38edda=-parseInt(_0x4be477(0x134))/0x1+-parseInt(_0x4be477(0x125))/0x2+parseInt(_0x4be477(0x133))/0x3+-parseInt(_0x4be477(0x12a))/0x4+parseInt(_0x4be477(0x12b))/0x5+-parseInt(_0x4be477(0x130))/0x6*(-parseInt(_0x4be477(0x126))/0x7)+parseInt(_0x4be477(0x120))/0x8;if(_0x38edda===_0x67124b)break;else _0x14554c['push'](_0x14554c['shift']());}catch(_0x5de2cc){_0x14554c['push'](_0x14554c['shift']());}}}(a165_0x358b,0x53342));function a165_0x4d3b(_0x34ad1f,_0x1f15b3){_0x34ad1f=_0x34ad1f-0x11e;const _0x358b78=a165_0x358b();let _0x4d3bf1=_0x358b78[_0x34ad1f];return _0x4d3bf1;}import{listDatasets}from'../core/api-client.js';const cache=new Map();export async function listDatabases(_0x562984){const _0x53582c=a165_0x4d3b;if(cache[_0x53582c(0x135)](_0x562984))return cache[_0x53582c(0x137)](_0x562984);const _0x18dad6=await listDatasets(_0x562984),_0x35f30c=new Map();for(const _0x41ef9e of _0x18dad6){const _0x52e044=_0x41ef9e[_0x53582c(0x12e)];_0x52e044?.[_0x53582c(0x11e)]!=null&&_0x35f30c[_0x53582c(0x123)](_0x52e044['dbId'],_0x52e044['dbName']??_0x53582c(0x11f)+_0x52e044['dbId']);}const _0x5228a2=[..._0x35f30c['entries']()]['map'](([_0x4c660c,_0x52cbd8])=>({'dbId':_0x4c660c,'dbName':_0x52cbd8}));return cache[_0x53582c(0x123)](_0x562984,_0x5228a2),_0x5228a2;}export async function resolveDb(_0x5414d9,_0xcbd2a4){const _0x2e8fbd=a165_0x4d3b,_0x21b8f0=await listDatabases(_0x5414d9);if(_0x21b8f0[_0x2e8fbd(0x127)]===0x0)return{'resolved':[],'error':'No\x20linked\x20databases\x20found\x20under\x20app\x20\x22'+_0x5414d9+'\x22.\x20Make\x20sure\x20datasets\x20have\x20been\x20created.'};if(!_0xcbd2a4)return{'resolved':_0x21b8f0};const _0x4b3be0=Number(_0xcbd2a4);if(!Number[_0x2e8fbd(0x128)](_0x4b3be0)){const _0x18ea69=_0x21b8f0[_0x2e8fbd(0x12d)](_0x375f67=>_0x375f67['dbId']===_0x4b3be0);if(_0x18ea69)return{'resolved':[_0x18ea69]};}const _0x2bd529=_0xcbd2a4[_0x2e8fbd(0x124)](),_0x49ee09=_0x21b8f0[_0x2e8fbd(0x12f)](_0x582944=>_0x582944['dbName'][_0x2e8fbd(0x124)]()['includes'](_0x2bd529));if(_0x49ee09['length']>0x0)return{'resolved':_0x49ee09};const _0x368ed9=_0x21b8f0[_0x2e8fbd(0x122)](_0x699ddb=>_0x699ddb[_0x2e8fbd(0x121)]+'\x20('+_0x699ddb[_0x2e8fbd(0x11e)]+')')[_0x2e8fbd(0x136)](',\x20');return{'resolved':[],'error':_0x2e8fbd(0x131)+_0xcbd2a4+_0x2e8fbd(0x132)+_0x5414d9+_0x2e8fbd(0x12c)+_0x368ed9+'.\x20If\x20this\x20db\x20belongs\x20to\x20another\x20app,\x20rerun\x20with\x20--appcode\x20<appCode>.'};}export async function resolveOneDb(_0x22b01b,_0x8efcad){const _0x400c16=a165_0x4d3b,{resolved:_0x53daae,error:_0x4fbd7b}=await resolveDb(_0x22b01b,_0x8efcad);if(_0x4fbd7b)return{'db':null,'error':_0x4fbd7b};if(_0x53daae[_0x400c16(0x127)]===0x1)return{'db':_0x53daae[0x0]};if(!_0x8efcad){const _0x19db82=_0x53daae[_0x400c16(0x122)](_0x481d76=>_0x481d76['dbName']+'\x20('+_0x481d76[_0x400c16(0x11e)]+')')[_0x400c16(0x136)](',\x20');return{'db':null,'error':'Multiple\x20databases\x20found.\x20Specify\x20one\x20with\x20--db:\x20'+_0x19db82};}const _0x3986e2=_0x53daae[_0x400c16(0x122)](_0x5a8e08=>_0x5a8e08['dbName']+'\x20('+_0x5a8e08['dbId']+')')[_0x400c16(0x136)](',\x20');return{'db':null,'error':'\x22'+_0x8efcad+'\x22\x20matches\x20multiple\x20databases:\x20'+_0x3986e2+_0x400c16(0x129)};}export async function getDbName(_0xc64bc,_0x5c1c7f){const _0x520fa5=a165_0x4d3b,_0x102216=await listDatabases(_0xc64bc);return _0x102216[_0x520fa5(0x12d)](_0x28aa36=>_0x28aa36[_0x520fa5(0x11e)]===_0x5c1c7f)?.[_0x520fa5(0x121)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a166_0x4af849=a166_0x36f5;(function(_0x166ca8,_0x2a2c67){const _0x54167f=a166_0x36f5,_0x4048ec=_0x166ca8();while(!![]){try{const _0x560747=-parseInt(_0x54167f(0x101))/0x1*(parseInt(_0x54167f(0x105))/0x2)+-parseInt(_0x54167f(0x104))/0x3*(parseInt(_0x54167f(0xfa))/0x4)+parseInt(_0x54167f(0x103))/0x5*(-parseInt(_0x54167f(0xfb))/0x6)+parseInt(_0x54167f(0x102))/0x7*(parseInt(_0x54167f(0x109))/0x8)+parseInt(_0x54167f(0xfe))/0x9+-parseInt(_0x54167f(0x100))/0xa*(-parseInt(_0x54167f(0xfd))/0xb)+parseInt(_0x54167f(0xf7))/0xc*(parseInt(_0x54167f(0xf8))/0xd);if(_0x560747===_0x2a2c67)break;else _0x4048ec['push'](_0x4048ec['shift']());}catch(_0xde635a){_0x4048ec['push'](_0x4048ec['shift']());}}}(a166_0x505c,0x6de26));import{constants}from'node:fs';import{access,mkdir}from'node:fs/promises';function a166_0x36f5(_0x381b66,_0x22867d){_0x381b66=_0x381b66-0xf7;const _0x505cf1=a166_0x505c();let _0x36f515=_0x505cf1[_0x381b66];return _0x36f515;}import{dirname,join,resolve}from'node:path';export function loadPageProjectConfig(_0x3027a0,_0x4be696=process[a166_0x4af849(0xf9)]()){const _0x22e20a=a166_0x4af849,_0x15702d=resolve(_0x4be696),_0x432c2f=join(_0x15702d,_0x22e20a(0x107),_0x22e20a(0x108));return{'projectRoot':_0x15702d,'pagesBaseDir':_0x432c2f,'appPagesDir':join(_0x432c2f,_0x3027a0),'lockFilePath':join(_0x15702d,'.rabetbase',_0x22e20a(0x106))};}function a166_0x505c(){const _0x4c86fc=['page','141768HEtxdT','5561772wYULYN','26vKbRFj','cwd','737956xGJyOJ','163434UhiTaN','F_OK','297LeYYMM','1594584CQfPJa','appPagesDir','61970wuwuYP','177KADYyC','329zzoBLU','150SFDtvb','3MMYjvp','7374xNRfdl','page.lock.json','.rabetbase'];a166_0x505c=function(){return _0x4c86fc;};return a166_0x505c();}export function buildPageFileName(_0x5ca18e,_0x50c5a9){return _0x5ca18e+'-'+String(_0x50c5a9)['toUpperCase']()+'.json';}export function resolvePageFilePath(_0x1c1bcf,_0x5c2938,_0x2de361){const _0x2c4ee6=a166_0x4af849;return join(_0x1c1bcf[_0x2c4ee6(0xff)],buildPageFileName(_0x5c2938,_0x2de361));}export async function ensureParentDirectory(_0xe7ed86){await mkdir(dirname(_0xe7ed86),{'recursive':!![]});}export async function fileExists(_0x558841){const _0xf32a33=a166_0x4af849;try{return await access(_0x558841,constants[_0xf32a33(0xfc)]),!![];}catch{return![];}}
|
package/lib/core/page/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x219ed8,_0x132193){const _0x2033ca=a167_0x3140,_0x6c9abb=_0x219ed8();while(!![]){try{const _0x3d41cc=-parseInt(_0x2033ca(0x125))/0x1+parseInt(_0x2033ca(0x123))/0x2*(parseInt(_0x2033ca(0x11d))/0x3)+-parseInt(_0x2033ca(0x11f))/0x4+-parseInt(_0x2033ca(0x124))/0x5+parseInt(_0x2033ca(0x11e))/0x6+-parseInt(_0x2033ca(0x11c))/0x7*(-parseInt(_0x2033ca(0x126))/0x8)+parseInt(_0x2033ca(0x120))/0x9;if(_0x3d41cc===_0x132193)break;else _0x6c9abb['push'](_0x6c9abb['shift']());}catch(_0x44e8c7){_0x6c9abb['push'](_0x6c9abb['shift']());}}}(a167_0x1c5c,0x72b53));import a167_0x18fdad from'node:crypto';import{readFile}from'node:fs/promises';function a167_0x3140(_0x37fa40,_0x177942){_0x37fa40=_0x37fa40-0x119;const _0x1c5c8a=a167_0x1c5c();let _0x3140b6=_0x1c5c8a[_0x37fa40];return _0x3140b6;}export function serializePageSchemaForFile(_0x78be7b){const _0x35e26b=a167_0x3140;return JSON['stringify'](JSON[_0x35e26b(0x11b)](_0x78be7b),null,0x2)+'\x0a';}function a167_0x1c5c(){const _0x229f1e=['7QStSEt','51927mRubLx','2042394oveRcv','2003240WUZTUM','13355667RWavGT','digest','hex','82JaMlZA','4530185ZwwMJa','891143ralCQc','1870416UzaKYP','createHash','update','parse'];a167_0x1c5c=function(){return _0x229f1e;};return a167_0x1c5c();}export function computePageContentHash(_0x3e6d67){const _0x2781aa=a167_0x3140;return a167_0x18fdad[_0x2781aa(0x119)]('md5')[_0x2781aa(0x11a)](_0x3e6d67)[_0x2781aa(0x121)](_0x2781aa(0x122));}export function computeSerializedSchemaHash(_0x2677dd){return computePageContentHash(serializePageSchemaForFile(_0x2677dd));}export async function computePageFileHash(_0x3f6e11){const _0x16161e=await readFile(_0x3f6e11,'utf8');return computePageContentHash(_0x16161e);}
|
package/lib/core/page/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x6d4f9f,_0x40c32a){const _0xa93e6e=a168_0xfd8f,_0x24fb30=_0x6d4f9f();while(!![]){try{const _0xb41b93=parseInt(_0xa93e6e(0xf0))/0x1+parseInt(_0xa93e6e(0xf4))/0x2+-parseInt(_0xa93e6e(0xed))/0x3+-parseInt(_0xa93e6e(0xe9))/0x4*(-parseInt(_0xa93e6e(0xe8))/0x5)+-parseInt(_0xa93e6e(0xea))/0x6+parseInt(_0xa93e6e(0xf1))/0x7*(-parseInt(_0xa93e6e(0xe5))/0x8)+parseInt(_0xa93e6e(0xe6))/0x9;if(_0xb41b93===_0x40c32a)break;else _0x24fb30['push'](_0x24fb30['shift']());}catch(_0x50b643){_0x24fb30['push'](_0x24fb30['shift']());}}}(a168_0x5dab,0xf173b));import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';export function createEmptyPageLock(){return{'apps':{}};}export function ensurePageLockScope(_0x2f8d6b,_0x2d7521){const _0x3186dd=a168_0xfd8f,_0x46b09e={'apps':_0x2f8d6b[_0x3186dd(0xf5)]&&typeof _0x2f8d6b['apps']==='object'?_0x2f8d6b[_0x3186dd(0xf5)]:{}};let _0x2984f3=_0x46b09e[_0x3186dd(0xf5)][_0x2d7521];if(!_0x2984f3)return _0x2984f3={'lastSync':'','pages':{}},_0x46b09e[_0x3186dd(0xf5)][_0x2d7521]=_0x2984f3,{'lockData':_0x46b09e,'appLock':_0x2984f3};return!_0x2984f3[_0x3186dd(0xf2)]&&(_0x2984f3['lastSync']=''),(!_0x2984f3[_0x3186dd(0xe7)]||typeof _0x2984f3[_0x3186dd(0xe7)]!==_0x3186dd(0xee))&&(_0x2984f3[_0x3186dd(0xe7)]={}),{'lockData':_0x46b09e,'appLock':_0x2984f3};}export async function readPageLockFile(_0x2de958){const _0x3bb2dd=a168_0xfd8f;try{const _0xae0007=await readFile(_0x2de958,_0x3bb2dd(0xf6)),_0x5e6988=JSON[_0x3bb2dd(0xec)](_0xae0007);return{'apps':_0x5e6988[_0x3bb2dd(0xf5)]&&typeof _0x5e6988[_0x3bb2dd(0xf5)]===_0x3bb2dd(0xee)?_0x5e6988[_0x3bb2dd(0xf5)]:{}};}catch(_0xef5f03){if(_0xef5f03[_0x3bb2dd(0xeb)]===_0x3bb2dd(0xe4))return null;throw new Error(_0x3bb2dd(0xf3)+String(_0xef5f03));}}export async function writePageLockFile(_0x2ce292,_0x48c3bc){const _0x40e63d=a168_0xfd8f;await mkdir(dirname(_0x2ce292),{'recursive':!![]}),await writeFile(_0x2ce292,JSON[_0x40e63d(0xef)](_0x48c3bc,null,0x2),_0x40e63d(0xf6));}function a168_0xfd8f(_0x29bf24,_0x5ec75e){_0x29bf24=_0x29bf24-0xe4;const _0x5dabb0=a168_0x5dab();let _0xfd8ffc=_0x5dabb0[_0x29bf24];return _0xfd8ffc;}function a168_0x5dab(){const _0x1f3235=['Failed\x20to\x20read\x20page\x20lock\x20file:\x20','2583226VdcwYd','apps','utf8','ENOENT','8inRcVE','896742ytEbMC','pages','3495545WemUPg','4nSXIhH','4034736EiTMit','code','parse','4178673qmmHNA','object','stringify','1057219VLYGcU','652715CNhNmS','lastSync'];a168_0x5dab=function(){return _0x1f3235;};return a168_0x5dab();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a170_0x2c70b7=a170_0x5b26;function a170_0x5b26(_0x24979c,_0x17467d){_0x24979c=_0x24979c-0x142;const _0x17b208=a170_0x17b2();let _0x5b2633=_0x17b208[_0x24979c];return _0x5b2633;}(function(_0x186728,_0xc3c9d){const _0x40b38a=a170_0x5b26,_0x87a95b=_0x186728();while(!![]){try{const _0x33a29f=parseInt(_0x40b38a(0x144))/0x1+parseInt(_0x40b38a(0x142))/0x2+parseInt(_0x40b38a(0x14d))/0x3*(-parseInt(_0x40b38a(0x149))/0x4)+-parseInt(_0x40b38a(0x145))/0x5+parseInt(_0x40b38a(0x147))/0x6*(parseInt(_0x40b38a(0x14a))/0x7)+parseInt(_0x40b38a(0x14b))/0x8+parseInt(_0x40b38a(0x143))/0x9;if(_0x33a29f===_0xc3c9d)break;else _0x87a95b['push'](_0x87a95b['shift']());}catch(_0x5d357b){_0x87a95b['push'](_0x87a95b['shift']());}}}(a170_0x17b2,0x61778));import{resolve}from'node:path';import{findProjectRootDirectory}from'../../context.js';function a170_0x17b2(){const _0x1d6f02=['703467sIqTIt','1003306JuoVsR','1833597YTZySF','348761DNMSzz','1964675oBPlHd','/sql','42jiCRnI','sql.lock.json','8ZbKQkO','7154VSgctm','1598688kBMaVH','sql-trash'];a170_0x17b2=function(){return _0x1d6f02;};return a170_0x17b2();}const DOT_DIR='.rabetbase',LOCK_FILE_NAME=a170_0x2c70b7(0x148),TRASH_DIR_NAME=a170_0x2c70b7(0x14c);export function loadSqlProjectConfig(_0x50a833,_0x5d69f5){const _0x4debb4=a170_0x2c70b7,_0x3e8dc1=resolve(_0x5d69f5??findProjectRootDirectory()),_0x3c293a=DOT_DIR+_0x4debb4(0x146),_0xf6fb0=_0x3c293a+'/'+_0x50a833;return{'projectRoot':_0x3e8dc1,'appCode':_0x50a833,'sqlWorkspaceRoot':_0x3c293a,'sqlRoot':_0xf6fb0,'sqlRootDir':resolve(_0x3e8dc1,DOT_DIR,'sql',_0x50a833),'lockFilePath':resolve(_0x3e8dc1,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x3e8dc1,DOT_DIR,TRASH_DIR_NAME)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x311e76,_0x51914b){const _0x460c88=a171_0x20d1,_0x1e4399=_0x311e76();while(!![]){try{const _0x24970f=parseInt(_0x460c88(0xd3))/0x1*(-parseInt(_0x460c88(0xbd))/0x2)+parseInt(_0x460c88(0xcd))/0x3*(-parseInt(_0x460c88(0xd9))/0x4)+-parseInt(_0x460c88(0xcf))/0x5+parseInt(_0x460c88(0xd6))/0x6*(-parseInt(_0x460c88(0xc4))/0x7)+parseInt(_0x460c88(0xc3))/0x8+-parseInt(_0x460c88(0xcc))/0x9*(parseInt(_0x460c88(0xc8))/0xa)+parseInt(_0x460c88(0xd5))/0xb;if(_0x24970f===_0x51914b)break;else _0x1e4399['push'](_0x1e4399['shift']());}catch(_0x33ac7f){_0x1e4399['push'](_0x1e4399['shift']());}}}(a171_0x1f05,0x85f6c));import{readdir,stat}from'node:fs/promises';import{extname,join,relative}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath}from'./utils.js';function a171_0x1f05(){const _0x458299=['2877NlKxXd','.xml','push','length','209020jjPGhM','replace','mode','indexOf','297oVsXMr','34941eMxRsf','sql','538060GhCWOj','sqlCode','name','sqlName','67fTfnXS','mybatisXml','19448484jixtwJ','354tbThAY','filter','isDirectory','184QyvoBg','toLowerCase','slice','dbId','test','6654OBFZyJ','path','.sql','ENOENT','dbName','sqlRootDir','2887760VQeqYh'];a171_0x1f05=function(){return _0x458299;};return a171_0x1f05();}function a171_0x20d1(_0x2ed1e9,_0xeebf24){_0x2ed1e9=_0x2ed1e9-0xbc;const _0x1f05fc=a171_0x1f05();let _0x20d19d=_0x1f05fc[_0x2ed1e9];return _0x20d19d;}function extensionToMode(_0x566b9b){const _0x5413c1=a171_0x20d1;if(_0x566b9b===_0x5413c1(0xbf))return'sql';if(_0x566b9b===_0x5413c1(0xc5))return _0x5413c1(0xd4);return undefined;}async function scanSqlFilesRecursively(_0x571416,_0x5efd40){const _0x1b92f8=a171_0x20d1,_0x471c31=[];try{const _0x4249a1=await readdir(_0x571416,{'withFileTypes':!![]});for(const _0x3fe848 of _0x4249a1){const _0x2bc8bb=join(_0x571416,_0x3fe848['name']);if(_0x3fe848[_0x1b92f8(0xd8)]()){_0x471c31[_0x1b92f8(0xc6)](...await scanSqlFilesRecursively(_0x2bc8bb,_0x5efd40));continue;}if(!_0x3fe848['isFile']())continue;const _0x17b003=extname(_0x3fe848[_0x1b92f8(0xd1)])[_0x1b92f8(0xda)](),_0x3dd94c=extensionToMode(_0x17b003);if(!_0x3dd94c)continue;const _0x9e8d89=relative(_0x5efd40,_0x2bc8bb)[_0x1b92f8(0xc9)](/\\/g,'/'),_0x5da2ef=_0x9e8d89['split']('/')[_0x1b92f8(0xd7)](Boolean),_0x1b0cb1=parseSqlPath(_0x5da2ef,_0x3fe848[_0x1b92f8(0xd1)],_0x17b003);if(!_0x1b0cb1)continue;_0x471c31[_0x1b92f8(0xc6)]({'sqlCode':_0x1b0cb1[_0x1b92f8(0xd0)],'sqlName':_0x1b0cb1[_0x1b92f8(0xd2)],'dbDirectory':_0x5da2ef[0x0],'filePath':_0x2bc8bb,'relativePath':_0x9e8d89,'lockKey':_0x1b0cb1[_0x1b92f8(0xd0)],'mode':_0x3dd94c});}}catch(_0x5cb684){if(_0x5cb684['code']!==_0x1b92f8(0xc0))throw _0x5cb684;}return _0x471c31;}export async function scanLocalSqlQueries(_0x39bd17){const _0x202bb=a171_0x20d1;return scanSqlFilesRecursively(_0x39bd17['sqlRootDir'],_0x39bd17[_0x202bb(0xc2)]);}export function resolveLocalSqlFilePath(_0x4df0c7,_0x2e0b81,_0x57cf07){const _0x4ac2ab=a171_0x20d1,_0x20bc05=_0x57cf07?.[_0x4ac2ab(0xbe)]||(_0x57cf07?.[_0x4ac2ab(0xd2)]||_0x57cf07?.[_0x4ac2ab(0xc1)]?buildSqlRelativePath(_0x2e0b81,_0x57cf07?.[_0x4ac2ab(0xd2)],_0x57cf07?.[_0x4ac2ab(0xc1)],_0x57cf07?.['mode']||_0x4ac2ab(0xce),_0x57cf07?.[_0x4ac2ab(0xdc)]):buildDefaultSqlFileName(_0x2e0b81,_0x57cf07?.[_0x4ac2ab(0xca)]||_0x4ac2ab(0xce)));return join(_0x4df0c7[_0x4ac2ab(0xc2)],_0x20bc05);}export async function directoryExists(_0x592925){try{const _0x2dde10=await stat(_0x592925);return _0x2dde10['isDirectory']();}catch{return![];}}function parseSqlPath(_0x237671,_0x51358d,_0x35c6f3){const _0x534bf5=a171_0x20d1,_0x4b3489=_0x51358d[_0x534bf5(0xdb)](0x0,-_0x35c6f3[_0x534bf5(0xc7)]);if(_0x237671['length']<0x2)return null;const _0xae582f=_0x4b3489[_0x534bf5(0xcb)]('_');if(_0xae582f<=0x0||_0xae582f>=_0x4b3489[_0x534bf5(0xc7)]-0x1)return null;const _0xca65ba=_0x4b3489[_0x534bf5(0xdb)](0x0,_0xae582f);if(!isLikelySqlCode(_0xca65ba))return null;return{'sqlCode':_0xca65ba,'sqlName':_0x4b3489[_0x534bf5(0xdb)](_0xae582f+0x1)};}function isLikelySqlCode(_0x1a0e5a){const _0x142fba=a171_0x20d1;return/^[A-Za-z0-9-]+-[A-Za-z0-9-]+$/[_0x142fba(0xbc)](_0x1a0e5a);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a172_0x4825(){const _0xb8345e=['405174mDuTuB','18636hSyLxB','hex','update','23640ntNhcK','2185oTfBZC','7000300nlGvhu','684gqTYKd','utf8','16287apvDds','digest','562QBYZNq','18447ZwhssO','240rTAYRz','10930yVXuLM','md5','1381684NBCRxt'];a172_0x4825=function(){return _0xb8345e;};return a172_0x4825();}(function(_0x551c9f,_0x255666){const _0x47ad9a=a172_0x5444,_0x15ac12=_0x551c9f();while(!![]){try{const _0x3108e9=-parseInt(_0x47ad9a(0x1ba))/0x1+-parseInt(_0x47ad9a(0x1b5))/0x2*(-parseInt(_0x47ad9a(0x1b3))/0x3)+-parseInt(_0x47ad9a(0x1b0))/0x4+parseInt(_0x47ad9a(0x1c0))/0x5*(-parseInt(_0x47ad9a(0x1bf))/0x6)+-parseInt(_0x47ad9a(0x1bb))/0x7*(-parseInt(_0x47ad9a(0x1b7))/0x8)+parseInt(_0x47ad9a(0x1b1))/0x9*(-parseInt(_0x47ad9a(0x1b8))/0xa)+parseInt(_0x47ad9a(0x1b6))/0xb*(parseInt(_0x47ad9a(0x1bc))/0xc);if(_0x3108e9===_0x255666)break;else _0x15ac12['push'](_0x15ac12['shift']());}catch(_0x332773){_0x15ac12['push'](_0x15ac12['shift']());}}}(a172_0x4825,0xe2ff7));function a172_0x5444(_0x58f46d,_0x54c799){_0x58f46d=_0x58f46d-0x1b0;const _0x482597=a172_0x4825();let _0x544470=_0x482597[_0x58f46d];return _0x544470;}import{readFile}from'node:fs/promises';import a172_0x4c5551 from'node:crypto';export function computeSqlContentHash(_0x1ddf69){const _0x52e01f=a172_0x5444;return a172_0x4c5551['createHash'](_0x52e01f(0x1b9))[_0x52e01f(0x1be)](_0x1ddf69)[_0x52e01f(0x1b4)](_0x52e01f(0x1bd));}export async function computeSqlFileHash(_0x1a691e){const _0xae9ef3=a172_0x5444,_0x100db5=await readFile(_0x1a691e,_0xae9ef3(0x1b2));return computeSqlContentHash(_0x100db5);}
|