@lovrabet/rabetbase-cli 2.2.5-beta.2 → 2.3.1
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 -0
- 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-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/commands/skill/index.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a128_0x4a932e=a128_0x2916;(function(_0x3b13cb,_0x23cce7){const _0x198abe=a128_0x2916,_0x2819a4=_0x3b13cb();while(!![]){try{const _0x14eabf=parseInt(_0x198abe(0x1ca))/0x1*(-parseInt(_0x198abe(0x1c3))/0x2)+-parseInt(_0x198abe(0x1e0))/0x3+parseInt(_0x198abe(0x1cb))/0x4*(-parseInt(_0x198abe(0x200))/0x5)+parseInt(_0x198abe(0x1f8))/0x6*(-parseInt(_0x198abe(0x1eb))/0x7)+parseInt(_0x198abe(0x1f4))/0x8+parseInt(_0x198abe(0x1d4))/0x9+parseInt(_0x198abe(0x1d8))/0xa;if(_0x14eabf===_0x23cce7)break;else _0x2819a4['push'](_0x2819a4['shift']());}catch(_0x51a339){_0x2819a4['push'](_0x2819a4['shift']());}}}(a128_0x2cac,0x63924));import{readFileSync,existsSync}from'node:fs';function a128_0x2916(_0x31d3e4,_0x5f6a5c){_0x31d3e4=_0x31d3e4-0x1c1;const _0x2cacfe=a128_0x2cac();let _0x291622=_0x2cacfe[_0x31d3e4];return _0x291622;}function a128_0x2cac(){const _0x49537a=['Enable\x20watch\x20mode\x20for\x20preview','\x20exited\x20with\x20code\x20','inherit','153658Bpjrbu','368AoaYMs','bun','\x20run\x20preview','bool','bun.lock','preview','\x20run\x20start','.bin','error','4308552JmIlzP','needsUpgrade','run','\x20\x20AVAILABLE\x20SCRIPTS\x20\x20(current\x20project)','3354250CloZYz','keys','join','build','\x22\x20not\x20found\x20in\x20package.json.','length','npm','dev','832284GkshfZ','parse','Script\x20\x22','\x20run\x20','\x0a\x20\x20Usage:\x20','close','map','No\x20scripts\x20defined\x20in\x20package.json.','\x0a\x20\x20Available\x20scripts:\x0a','cwd','boolean','16023FpVYgr','\x20\x20\x20\x20','slice','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','--watch','has','script','node_modules','package.json','5912768lEFWhw','all','vite','vite\x20preview\x20exited\x20with\x20code\x20','786NktPRF','watch','args','push','log','\x20run\x20preview\x20--watch\x20\x20\x20#\x20parallel\x20build\x20--watch\x20+\x20preview','\x20run\x20<script>\x0a','Script\x20name\x20defined\x20in\x20package.json','22525SxICbT','max','yarn','\x20run\x20build','\x20\x20EXAMPLES','padEnd','read','2xzjDyl','validation','Run\x20a\x20package.json\x20script','(none)'];a128_0x2cac=function(){return _0x49537a;};return a128_0x2cac();}import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a128_0x4a932e(0x1df)]);function readPackageScripts(_0xfbc6d1){const _0xc6866c=a128_0x4a932e,_0x18d978=resolve(_0xfbc6d1,_0xc6866c(0x1f3));if(!existsSync(_0x18d978))return null;try{const _0xa0d2a8=JSON[_0xc6866c(0x1e1)](readFileSync(_0x18d978,'utf-8'));return _0xa0d2a8['scripts']??{};}catch{return null;}}function detectPackageManager(_0x18e5fa){const _0x599283=a128_0x4a932e;if(existsSync(resolve(_0x18e5fa,'bun.lockb'))||existsSync(resolve(_0x18e5fa,_0x599283(0x1cf))))return _0x599283(0x1cc);if(existsSync(resolve(_0x18e5fa,'pnpm-lock.yaml')))return'pnpm';if(existsSync(resolve(_0x18e5fa,'yarn.lock')))return _0x599283(0x202);return _0x599283(0x1de);}async function versionCheck(_0x53e36a){const _0x3ec8d5=a128_0x4a932e,_0x36fc8f=await checkCliVersion();(_0x36fc8f[_0x3ec8d5(0x1d5)]||_0x36fc8f['belowMinimum'])&&(printCliUpgradeWarning(_0x36fc8f),assertCliVersionSupported(_0x36fc8f));const _0x41e5f8=await checkSdkVersion(_0x53e36a);if(_0x41e5f8[_0x3ec8d5(0x1d5)])printSdkUpgradeWarning(_0x41e5f8);}function spawnScript(_0x2d8425,_0x1ae04d,_0xae3175,_0x540cff){return new Promise((_0xb5f2a1,_0x42cbc3)=>{const _0x273244=a128_0x2916,_0x5e18c9=['run',_0x1ae04d,..._0xae3175],_0x4459da=spawn(_0x2d8425,_0x5e18c9,{'cwd':_0x540cff,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x540cff,'node_modules',_0x273244(0x1d2))+delimiter+process.env.PATH}});_0x4459da['on'](_0x273244(0x1e5),_0x5b6a2f=>{const _0x2c2044=_0x273244;if(_0x5b6a2f===0x0||_0x5b6a2f===null)_0xb5f2a1();else _0x42cbc3(new Error(_0x2d8425+_0x2c2044(0x1e3)+_0x1ae04d+_0x2c2044(0x1c8)+_0x5b6a2f));}),_0x4459da['on']('error',_0x42cbc3);});}function spawnViteBuildWatch(_0x1c1b4c){return new Promise((_0xd2b06b,_0x13d077)=>{const _0x16f5e5=a128_0x2916,_0x106402=spawn(_0x16f5e5(0x1f6),[_0x16f5e5(0x1db),_0x16f5e5(0x1ef)],{'cwd':_0x1c1b4c,'stdio':_0x16f5e5(0x1c9),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1c1b4c,_0x16f5e5(0x1f2),'.bin')+delimiter+process.env.PATH}});_0x106402['on'](_0x16f5e5(0x1e5),_0x51f82a=>{const _0x1ae904=_0x16f5e5;if(_0x51f82a===0x0||_0x51f82a===null)_0xd2b06b();else _0x13d077(new Error(_0x1ae904(0x1ee)+_0x51f82a));}),_0x106402['on']('error',_0x13d077);});}function spawnVitePreview(_0x2914bc){return new Promise((_0x5ede8c,_0x2cf645)=>{const _0x567ad8=a128_0x2916,_0x3d9a12=spawn('vite',[_0x567ad8(0x1d0)],{'cwd':_0x2914bc,'stdio':_0x567ad8(0x1c9),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2914bc,_0x567ad8(0x1f2),_0x567ad8(0x1d2))+delimiter+process.env.PATH}});_0x3d9a12['on'](_0x567ad8(0x1e5),_0x59c24f=>{const _0x56ea8c=_0x567ad8;if(_0x59c24f===0x0||_0x59c24f===null)_0x5ede8c();else _0x2cf645(new Error(_0x56ea8c(0x1f7)+_0x59c24f));}),_0x3d9a12['on'](_0x567ad8(0x1d3),_0x2cf645);});}const runFlags=[{'name':a128_0x4a932e(0x1f9),'type':a128_0x4a932e(0x1ea),'description':a128_0x4a932e(0x1c7),'default':![]}];export const runDefinition={'service':a128_0x4a932e(0x1d6),'command':a128_0x4a932e(0x1d6),'description':a128_0x4a932e(0x1c5),'risk':a128_0x4a932e(0x1c2),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a128_0x4a932e(0x1f1),'description':a128_0x4a932e(0x1ff),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x39bc19=a128_0x4a932e,_0x4ba290=readPackageScripts(process[_0x39bc19(0x1e9)]()),_0x4941ed=[];if(_0x4ba290&&Object[_0x39bc19(0x1d9)](_0x4ba290)[_0x39bc19(0x1dd)]>0x0){const _0x258787=Object[_0x39bc19(0x1d9)](_0x4ba290),_0xa007f1=Math[_0x39bc19(0x201)](..._0x258787[_0x39bc19(0x1e6)](_0x28d4b0=>_0x28d4b0[_0x39bc19(0x1dd)]));_0x4941ed['push'](_0x39bc19(0x1d7));for(const [_0x3b91d1,_0x1d6dae]of Object['entries'](_0x4ba290)){_0x4941ed['push'](_0x39bc19(0x1ec)+CLI_BIN_NAME+_0x39bc19(0x1e3)+_0x3b91d1['padEnd'](_0xa007f1+0x2)+'#\x20'+_0x1d6dae);}}else _0x4941ed[_0x39bc19(0x1fb)](_0x39bc19(0x204)),_0x4941ed[_0x39bc19(0x1fb)](_0x39bc19(0x1ec)+CLI_BIN_NAME+_0x39bc19(0x1d1)),_0x4941ed['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x39bc19(0x203)),_0x4941ed[_0x39bc19(0x1fb)](_0x39bc19(0x1ec)+CLI_BIN_NAME+_0x39bc19(0x1cd)),_0x4941ed[_0x39bc19(0x1fb)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x39bc19(0x1fd));return _0x4941ed[_0x39bc19(0x1da)]('\x0a');},async 'execute'(_0x5e62e2){const _0x22e572=a128_0x4a932e,_0x419206=process[_0x22e572(0x1e9)](),_0x56af64=_0x5e62e2[_0x22e572(0x1fa)][0x0],_0x408cc6=_0x5e62e2['args'][_0x22e572(0x1ed)](0x1),_0x19f217=readPackageScripts(_0x419206);if(!_0x19f217)throw CliErrors['validation']('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x56af64){const _0x1b3a77=Object[_0x22e572(0x1d9)](_0x19f217);if(_0x1b3a77[_0x22e572(0x1dd)]===0x0)console[_0x22e572(0x1fc)](_0x22e572(0x1e7));else{console['log'](_0x22e572(0x1e8));const _0xfb38ce=Math['max'](..._0x1b3a77[_0x22e572(0x1e6)](_0x29ab39=>_0x29ab39['length']));for(const [_0x74c18e,_0x480ff7]of Object['entries'](_0x19f217)){console[_0x22e572(0x1fc)](_0x22e572(0x1ec)+_0x74c18e[_0x22e572(0x1c1)](_0xfb38ce+0x2)+_0x480ff7);}console['log'](_0x22e572(0x1e4)+CLI_BIN_NAME+_0x22e572(0x1fe));}return{'ok':!![]};}if(!_0x19f217[_0x56af64])throw CliErrors[_0x22e572(0x1c4)](_0x22e572(0x1e2)+_0x56af64+_0x22e572(0x1dc),'Available:\x20'+(Object[_0x22e572(0x1d9)](_0x19f217)[_0x22e572(0x1da)](',\x20')||_0x22e572(0x1c6)));const _0x253189=detectPackageManager(_0x419206);VERSION_CHECK_SCRIPTS[_0x22e572(0x1f0)](_0x56af64)&&await versionCheck(_0x419206);if(_0x56af64==='preview'&&_0x5e62e2[_0x22e572(0x1ce)](_0x22e572(0x1f9)))return await Promise[_0x22e572(0x1f5)]([spawnViteBuildWatch(_0x419206),spawnVitePreview(_0x419206)]),{'ok':!![]};return await spawnScript(_0x253189,_0x56af64,_0x408cc6,_0x419206),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a129_0xc083(_0x3d948e,_0x341ad9){_0x3d948e=_0x3d948e-0xb9;const _0x5e5951=a129_0x5e59();let _0xc08338=_0x5e5951[_0x3d948e];return _0xc08338;}function a129_0x5e59(){const _0x54130c=['116GTeeNU','2351937nDYBvf','read','schema','118945ebzVXd','9knLlsS','5432778vQdLkw','2OgxTWB','9355955QxGPQo','19037890bDcoir','557654cnSTUT','3692712TBTlCW'];a129_0x5e59=function(){return _0x54130c;};return a129_0x5e59();}const a129_0x2b1957=a129_0xc083;(function(_0x524804,_0x1be3c0){const _0x4f63a6=a129_0xc083,_0x173063=_0x524804();while(!![]){try{const _0x20bb46=parseInt(_0x4f63a6(0xbb))/0x1*(-parseInt(_0x4f63a6(0xc4))/0x2)+parseInt(_0x4f63a6(0xbe))/0x3+parseInt(_0x4f63a6(0xbd))/0x4*(parseInt(_0x4f63a6(0xc1))/0x5)+parseInt(_0x4f63a6(0xc3))/0x6+parseInt(_0x4f63a6(0xb9))/0x7+-parseInt(_0x4f63a6(0xbc))/0x8+parseInt(_0x4f63a6(0xc2))/0x9*(-parseInt(_0x4f63a6(0xba))/0xa);if(_0x20bb46===_0x1be3c0)break;else _0x173063['push'](_0x173063['shift']());}catch(_0x406e41){_0x173063['push'](_0x173063['shift']());}}}(a129_0x5e59,0xc1918));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x14800c){const _0x3fb10b=await buildSchemaPayload();return{'ok':!![],'data':_0x3fb10b};}export const schemaDefinition={'service':a129_0x2b1957(0xc0),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a129_0x2b1957(0xbf),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a130_0x73739=a130_0x290c;(function(_0x56903f,_0x224ac1){const _0x4be092=a130_0x290c,_0x2523b1=_0x56903f();while(!![]){try{const _0x2a7b40=-parseInt(_0x4be092(0xb6))/0x1+parseInt(_0x4be092(0x93))/0x2*(parseInt(_0x4be092(0xd0))/0x3)+-parseInt(_0x4be092(0xb4))/0x4+parseInt(_0x4be092(0xae))/0x5*(parseInt(_0x4be092(0xcc))/0x6)+parseInt(_0x4be092(0xb7))/0x7*(parseInt(_0x4be092(0xce))/0x8)+-parseInt(_0x4be092(0x94))/0x9*(parseInt(_0x4be092(0xc7))/0xa)+parseInt(_0x4be092(0xa6))/0xb*(parseInt(_0x4be092(0xa7))/0xc);if(_0x2a7b40===_0x224ac1)break;else _0x2523b1['push'](_0x2523b1['shift']());}catch(_0x1b718f){_0x2523b1['push'](_0x2523b1['shift']());}}}(a130_0x2e8a,0x46994));import{writeFile}from'node:fs/promises';function a130_0x290c(_0x33a630,_0x2c398e){_0x33a630=_0x33a630-0x8e;const _0x2e8a9=a130_0x2e8a();let _0x290c45=_0x2e8a9[_0x33a630];return _0x290c45;}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a130_0x2e8a(){const _0x497ab8=['<server-generated-sqlCode>','Created\x20SQL\x20query\x20','isInteger','534uoPpuY','dbName','16WvOXpm','nonInteractive','451155IPCpqM','string','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','适合带动态标签的\x20MyBatis\x20XML\x20SQL','name','number','2TLyQtV','225MSqrhT','mode','sqls','请选择目标数据库:','appCode','validation','请选择本地\x20SQL\x20模式:','sqlRootDir','Target\x20database\x20ID','db-id','请输入\x20SQL\x20名称:','MyBatis\x20XML(mybatisXml)','sqlName','sql','</select>','flagMissing','请输入目标数据库\x20dbId:','dbId','77pzLTzq','879864OCWAoP','__manual__','high-risk-write','toISOString','SQL\x20query\x20display\x20name','catch','str','8660SjZvIT','utf8','new','isFinite','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','普通\x20SQL(sql)','1295820eKitkH','mybatisXml','172146JLVcze','856226bBhVxI','parse','lockFilePath','trim','create','Local\x20SQL\x20file\x20mode','Invalid\x20database\x20selection\x20payload:\x20','length','stringify','POST','/smartapi/custom/saveUserCustomSql','\x20\x20SELECT\x201\x20AS\x20id','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','File\x20already\x20exists:\x20','110860RgxqSa','sqlCode'];a130_0x2e8a=function(){return _0x497ab8;};return a130_0x2e8a();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x51fdc8){const _0x30d644=a130_0x290c;if(_0x51fdc8===_0x30d644(0xb5))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x30d644(0xc2),_0x30d644(0xa2),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}export const sqlCreate={'service':a130_0x73739(0xa1),'command':a130_0x73739(0xbb),'description':a130_0x73739(0x8f),'risk':a130_0x73739(0xa9),'flags':[{'name':'name','type':a130_0x73739(0x8e),'description':a130_0x73739(0xab)},{'name':a130_0x73739(0x9d),'type':'number','description':a130_0x73739(0x9c)},{'name':'mode','type':a130_0x73739(0x8e),'enum':['sql','mybatisXml'],'description':a130_0x73739(0xbc)}],async 'validate'(_0x5d398c){const _0x1ceb08=a130_0x73739;if(!_0x5d398c[_0x1ceb08(0xcf)])return;if(!_0x5d398c[_0x1ceb08(0xad)](_0x1ceb08(0x91))['trim']())throw CliErrors[_0x1ceb08(0xa3)](_0x1ceb08(0x91),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x540a8d=resolveProvidedDbId(_0x5d398c);if(typeof _0x540a8d!==_0x1ceb08(0x92)||!Number[_0x1ceb08(0xb1)](_0x540a8d)||_0x540a8d<=0x0)throw CliErrors['flagMissing'](_0x1ceb08(0x9d),_0x1ceb08(0xb2));if(!_0x5d398c[_0x1ceb08(0xad)](_0x1ceb08(0x95))[_0x1ceb08(0xba)]())throw CliErrors[_0x1ceb08(0xa3)](_0x1ceb08(0x95),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x11a83a){const _0x58c34d=a130_0x73739,_0x48eac8=loadSqlProjectConfig(_0x11a83a[_0x58c34d(0x98)]),{sqlName:_0x47b3a9,dbId:_0x375807,dbName:_0x36a42b,mode:_0x4d42a5}=await resolveSqlNewInputs(_0x11a83a),_0x4f7422=buildSqlRelativePath(_0x58c34d(0xc9),_0x47b3a9,_0x36a42b,_0x4d42a5,_0x375807),_0x5836bb=_0x48eac8[_0x58c34d(0x9b)]+'/'+_0x4f7422;return{'method':_0x58c34d(0xc0),'url':_0x58c34d(0xc1),'body':{'appCode':_0x11a83a[_0x58c34d(0x98)],'sqlName':_0x47b3a9,'dbId':_0x375807,'mode':_0x4d42a5,'localPath':_0x5836bb},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x48eac8['sqlRootDir']};},async 'execute'(_0x3bdb35){const _0x43a04c=a130_0x73739,_0x42d5cd=loadSqlProjectConfig(_0x3bdb35['appCode']),{sqlName:_0x2f6414,dbId:_0x563be7,dbName:_0xca2da3,mode:_0x510c27}=await resolveSqlNewInputs(_0x3bdb35),_0x5a1ace=generateSqlTemplate(_0x510c27),_0x1d505b=await createSqlQuery({'appCode':_0x3bdb35[_0x43a04c(0x98)],'sqlName':_0x2f6414,'dbId':_0x563be7,'sqlContent':_0x5a1ace}),_0x321968=ensureRemoteSqlContent(_0x1d505b),_0x539f67=_0xca2da3||await getDbName(_0x3bdb35[_0x43a04c(0x98)],_0x563be7)[_0x43a04c(0xac)](()=>undefined),_0x4731e7=buildSqlRelativePath(_0x1d505b['sqlCode'],_0x1d505b[_0x43a04c(0xa0)],_0x539f67,_0x510c27,_0x563be7),_0x3bc737=_0x42d5cd[_0x43a04c(0x9b)]+'/'+_0x4731e7,_0x1a1855=buildLocalSqlFileContent({'sqlCode':_0x1d505b['sqlCode'],'sqlName':_0x1d505b['sqlName'],'dbId':_0x1d505b[_0x43a04c(0xa5)]},_0x321968,{'dbName':_0x539f67,'mode':_0x510c27,'syncedAt':new Date()[_0x43a04c(0xaa)](),'description':_0x1d505b['description']});if(await fileExists(_0x3bc737))throw CliErrors[_0x43a04c(0x99)](_0x43a04c(0xc6)+_0x3bc737);await ensureParentDirectory(_0x3bc737),await writeFile(_0x3bc737,_0x1a1855,_0x43a04c(0xaf));const _0x570063=await readSqlLockFile(_0x42d5cd[_0x43a04c(0xb9)]),{lockData:_0x119d96,appLock:_0xe83796}=ensureSqlLockScope(_0x570063??createEmptySqlLock(),_0x42d5cd[_0x43a04c(0x98)],_0x42d5cd['sqlRoot'],_0x43a04c(0xb0));return _0xe83796[_0x43a04c(0x96)][_0x1d505b['sqlCode']]={...buildSqlLockEntry(_0x1d505b,_0x321968,computeSqlContentHash(_0x1a1855),{'dbName':_0x539f67}),'path':_0x4731e7,'mode':_0x510c27},_0xe83796['lastSync']=new Date()[_0x43a04c(0xaa)](),await writeSqlLockFile(_0x42d5cd[_0x43a04c(0xb9)],_0x119d96),{'ok':!![],'data':{'id':_0x1d505b['id'],'sqlCode':_0x1d505b[_0x43a04c(0xc8)],'sqlName':_0x1d505b['sqlName'],'dbId':_0x1d505b[_0x43a04c(0xa5)],'path':_0x3bc737,'mode':_0x510c27},'message':_0x43a04c(0xca)+_0x1d505b[_0x43a04c(0xc8)]};}};async function resolveSqlNewInputs(_0x4a9a95){const _0x4318f3=await resolveSqlNameInput(_0x4a9a95),{dbId:_0xa63dbe,dbName:_0x4d04e8}=await resolveDbSelection(_0x4a9a95),_0x476307=await resolveSqlModeInput(_0x4a9a95);return{'sqlName':_0x4318f3,'dbId':_0xa63dbe,'dbName':_0x4d04e8,'mode':_0x476307};}async function resolveSqlNameInput(_0x1229cc){const _0x2f2693=a130_0x73739,_0x5fd8b=_0x1229cc['str'](_0x2f2693(0x91))[_0x2f2693(0xba)]();if(_0x5fd8b)return _0x5fd8b;if(_0x1229cc[_0x2f2693(0xcf)])throw CliErrors[_0x2f2693(0xa3)]('name',_0x2f2693(0xc5));return(await input({'message':_0x2f2693(0x9e),'validate':_0x3560f4=>_0x3560f4[_0x2f2693(0xba)]()?!![]:'SQL\x20名称不能为空'}))[_0x2f2693(0xba)]();}async function resolveDbSelection(_0x8af65b){const _0x46ec53=a130_0x73739,_0x5b570e=resolveProvidedDbId(_0x8af65b);if(typeof _0x5b570e===_0x46ec53(0x92)&&Number[_0x46ec53(0xb1)](_0x5b570e)&&_0x5b570e>0x0)return{'dbId':_0x5b570e,'dbName':await getDbName(_0x8af65b['appCode'],_0x5b570e)[_0x46ec53(0xac)](()=>undefined)};if(_0x8af65b[_0x46ec53(0xcf)])throw CliErrors['flagMissing'](_0x46ec53(0x9d),_0x46ec53(0xb2));const _0x28fe98=await listDatabases(_0x8af65b['appCode'])[_0x46ec53(0xac)](()=>[]);if(_0x28fe98[_0x46ec53(0xbe)]===0x1)return{'dbId':_0x28fe98[0x0][_0x46ec53(0xa5)],'dbName':_0x28fe98[0x0][_0x46ec53(0xcd)]};if(_0x28fe98[_0x46ec53(0xbe)]>0x1){const _0xe83c1b=await select({'message':_0x46ec53(0x97),'choices':[..._0x28fe98['map'](_0x37e563=>({'name':_0x37e563[_0x46ec53(0xcd)]+'\x20('+_0x37e563[_0x46ec53(0xa5)]+')','value':serializeDbSelection(_0x37e563)})),{'name':'✎\x20手动输入\x20dbId','value':_0x46ec53(0xa8)}]});if(_0xe83c1b!=='__manual__')return deserializeDbSelection(_0xe83c1b);}const _0x34fce4=await input({'message':_0x46ec53(0xa4),'validate':_0x153d42=>{const _0x4c1161=_0x46ec53,_0x3c4169=_0x153d42['trim']();if(!_0x3c4169)return'dbId\x20不能为空';const _0x32d537=Number(_0x3c4169);if(!Number[_0x4c1161(0xcb)](_0x32d537)||_0x32d537<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x34fce4[_0x46ec53(0xba)]())};}async function resolveSqlModeInput(_0x33beac){const _0x249fe7=a130_0x73739,_0x11dac2=_0x33beac['str']('mode')[_0x249fe7(0xba)]();if(_0x11dac2==='sql'||_0x11dac2==='mybatisXml')return _0x11dac2;if(_0x33beac[_0x249fe7(0xcf)])throw CliErrors[_0x249fe7(0xa3)](_0x249fe7(0x95),_0x249fe7(0xc3));return await select({'message':_0x249fe7(0x9a),'choices':[{'name':_0x249fe7(0xb3),'value':_0x249fe7(0xa1),'description':_0x249fe7(0xc4)},{'name':_0x249fe7(0x9f),'value':_0x249fe7(0xb5),'description':_0x249fe7(0x90)}]});}function serializeDbSelection(_0x171d6f){const _0x210f03=a130_0x73739;return JSON[_0x210f03(0xbf)]({'dbId':_0x171d6f[_0x210f03(0xa5)],'dbName':_0x171d6f['dbName']});}function deserializeDbSelection(_0x3cb83a){const _0x129068=a130_0x73739;try{const _0x5e7cfa=JSON[_0x129068(0xb8)](_0x3cb83a);if(typeof _0x5e7cfa['dbId']===_0x129068(0x92)&&Number['isFinite'](_0x5e7cfa[_0x129068(0xa5)]))return{'dbId':_0x5e7cfa[_0x129068(0xa5)],'dbName':_0x5e7cfa['dbName']};}catch{}throw CliErrors['validation'](_0x129068(0xbd)+_0x3cb83a);}function resolveProvidedDbId(_0x4bfe02){const _0x39a6c5=a130_0x73739,_0xb846e2=_0x4bfe02['flag'](_0x39a6c5(0x9d));if(typeof _0xb846e2==='number'&&Number[_0x39a6c5(0xb1)](_0xb846e2))return _0xb846e2;return undefined;}
|
|
1
|
+
const a130_0x40406e=a130_0x1fee;(function(_0xb1188b,_0x4db7a5){const _0x258586=a130_0x1fee,_0x36b904=_0xb1188b();while(!![]){try{const _0x2f26ea=-parseInt(_0x258586(0xf5))/0x1*(-parseInt(_0x258586(0xb6))/0x2)+-parseInt(_0x258586(0xce))/0x3*(parseInt(_0x258586(0xc6))/0x4)+parseInt(_0x258586(0xc9))/0x5*(parseInt(_0x258586(0xd6))/0x6)+parseInt(_0x258586(0xd5))/0x7*(-parseInt(_0x258586(0xb5))/0x8)+parseInt(_0x258586(0xf8))/0x9*(parseInt(_0x258586(0xf9))/0xa)+parseInt(_0x258586(0xd7))/0xb*(-parseInt(_0x258586(0xd0))/0xc)+-parseInt(_0x258586(0xf1))/0xd;if(_0x2f26ea===_0x4db7a5)break;else _0x36b904['push'](_0x36b904['shift']());}catch(_0xec2e7){_0x36b904['push'](_0x36b904['shift']());}}}(a130_0x4670,0xca407));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a130_0x1fee(_0x147ab1,_0x2895c5){_0x147ab1=_0x147ab1-0xb4;const _0x467016=a130_0x4670();let _0x1fee64=_0x467016[_0x147ab1];return _0x1fee64;}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a130_0x4670(){const _0x18fbc0=['stringify','join','适合带动态标签的\x20MyBatis\x20XML\x20SQL','Invalid\x20database\x20selection\x20payload:\x20','flag','catch','isFinite','nonInteractive','isInteger','POST','sql','parse','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','sqls','/smartapi/custom/saveUserCustomSql','请选择本地\x20SQL\x20模式:','<server-generated-sqlCode>','lockFilePath','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','请输入\x20SQL\x20名称:','sqlRoot','✎\x20手动输入\x20dbId','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','new','lastSync','14766661fwcpjs','sqlRootDir','description','普通\x20SQL(sql)','469FvTVNI','mode','toISOString','5463IlVugE','26680fwHFbd','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbId\x20不能为空','请选择目标数据库:','flagMissing','502488TQNdYn','14ZBsnVV','db-id','map','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','sqlName','Created\x20SQL\x20query\x20','\x20\x20SELECT\x201\x20AS\x20id','utf8','string','dbName','mybatisXml','name','high-risk-write','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','</select>','Target\x20database\x20ID','1416BuOkoM','sqlCode','number','1372860FMhvOr','validation','trim','__manual__','appCode','1437tubuVL','MyBatis\x20XML(mybatisXml)','12wYxKIe','str','length','dbId','File\x20already\x20exists:\x20','98DvhSCt','36vOdilM','2826461TCgOcK'];a130_0x4670=function(){return _0x18fbc0;};return a130_0x4670();}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x5a794a){const _0x53bf5f=a130_0x1fee;if(_0x5a794a===_0x53bf5f(0xc0))return[_0x53bf5f(0xea),_0x53bf5f(0xbc),_0x53bf5f(0xc4),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x53bf5f(0xd9)]('\x0a');}export const sqlCreate={'service':'sql','command':'create','description':a130_0x40406e(0xb9),'risk':a130_0x40406e(0xc2),'flags':[{'name':a130_0x40406e(0xc1),'type':a130_0x40406e(0xbe),'description':'SQL\x20query\x20display\x20name'},{'name':a130_0x40406e(0xb7),'type':a130_0x40406e(0xc8),'description':a130_0x40406e(0xc5)},{'name':a130_0x40406e(0xf6),'type':a130_0x40406e(0xbe),'enum':[a130_0x40406e(0xe2),a130_0x40406e(0xc0)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x51a0e0){const _0x18186d=a130_0x40406e;if(!_0x51a0e0[_0x18186d(0xdf)])return;if(!_0x51a0e0[_0x18186d(0xd1)](_0x18186d(0xc1))[_0x18186d(0xcb)]())throw CliErrors[_0x18186d(0xb4)](_0x18186d(0xc1),_0x18186d(0xc3));const _0xae1a02=resolveProvidedDbId(_0x51a0e0);if(typeof _0xae1a02!=='number'||!Number[_0x18186d(0xde)](_0xae1a02)||_0xae1a02<=0x0)throw CliErrors[_0x18186d(0xb4)](_0x18186d(0xb7),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x51a0e0[_0x18186d(0xd1)]('mode')[_0x18186d(0xcb)]())throw CliErrors[_0x18186d(0xb4)](_0x18186d(0xf6),_0x18186d(0xe4));},async 'dryRun'(_0x505737){const _0x27565=a130_0x40406e,_0x408425=loadSqlProjectConfig(_0x505737[_0x27565(0xcd)]),{sqlName:_0x3c169e,dbId:_0x296625,dbName:_0x1977b8,mode:_0x2518b9}=await resolveSqlNewInputs(_0x505737),_0x394f79=buildSqlRelativePath(_0x27565(0xe8),_0x3c169e,_0x1977b8,_0x2518b9,_0x296625),_0x21ee57=_0x408425[_0x27565(0xf2)]+'/'+_0x394f79;return{'method':_0x27565(0xe1),'url':_0x27565(0xe6),'body':{'appCode':_0x505737[_0x27565(0xcd)],'sqlName':_0x3c169e,'dbId':_0x296625,'mode':_0x2518b9,'localPath':_0x21ee57},'description':_0x27565(0xfa)+_0x408425[_0x27565(0xf2)]};},async 'execute'(_0x3e88f7){const _0x4e619b=a130_0x40406e,_0x199d96=loadSqlProjectConfig(_0x3e88f7['appCode']),{sqlName:_0x4d8ad9,dbId:_0x44b161,dbName:_0x58c37f,mode:_0x54a18e}=await resolveSqlNewInputs(_0x3e88f7),_0xf98176=generateSqlTemplate(_0x54a18e),_0x42ecc6=await createSqlQuery({'appCode':_0x3e88f7[_0x4e619b(0xcd)],'sqlName':_0x4d8ad9,'dbId':_0x44b161,'sqlContent':_0xf98176}),_0x5db251=ensureRemoteSqlContent(_0x42ecc6),_0x60d6f5=_0x58c37f||await getDbName(_0x3e88f7[_0x4e619b(0xcd)],_0x44b161)[_0x4e619b(0xdd)](()=>undefined),_0x50e860=buildSqlRelativePath(_0x42ecc6[_0x4e619b(0xc7)],_0x42ecc6[_0x4e619b(0xba)],_0x60d6f5,_0x54a18e,_0x44b161),_0x170328=_0x199d96[_0x4e619b(0xf2)]+'/'+_0x50e860,_0x425c0e=buildLocalSqlFileContent({'sqlCode':_0x42ecc6['sqlCode'],'sqlName':_0x42ecc6[_0x4e619b(0xba)],'dbId':_0x42ecc6[_0x4e619b(0xd3)]},_0x5db251,{'dbName':_0x60d6f5,'mode':_0x54a18e,'syncedAt':new Date()[_0x4e619b(0xf7)](),'description':_0x42ecc6[_0x4e619b(0xf3)]});if(await fileExists(_0x170328))throw CliErrors[_0x4e619b(0xca)](_0x4e619b(0xd4)+_0x170328);await ensureParentDirectory(_0x170328),await writeFile(_0x170328,_0x425c0e,_0x4e619b(0xbd));const _0x3a0d7a=await readSqlLockFile(_0x199d96[_0x4e619b(0xe9)]),{lockData:_0x66febc,appLock:_0x23127c}=ensureSqlLockScope(_0x3a0d7a??createEmptySqlLock(),_0x199d96[_0x4e619b(0xcd)],_0x199d96[_0x4e619b(0xec)],_0x4e619b(0xef));return _0x23127c[_0x4e619b(0xe5)][_0x42ecc6['sqlCode']]={...buildSqlLockEntry(_0x42ecc6,_0x5db251,computeSqlContentHash(_0x425c0e),{'dbName':_0x60d6f5}),'path':_0x50e860,'mode':_0x54a18e},_0x23127c[_0x4e619b(0xf0)]=new Date()[_0x4e619b(0xf7)](),await writeSqlLockFile(_0x199d96[_0x4e619b(0xe9)],_0x66febc),{'ok':!![],'data':{'id':_0x42ecc6['id'],'sqlCode':_0x42ecc6[_0x4e619b(0xc7)],'sqlName':_0x42ecc6[_0x4e619b(0xba)],'dbId':_0x42ecc6['dbId'],'path':_0x170328,'mode':_0x54a18e},'message':_0x4e619b(0xbb)+_0x42ecc6[_0x4e619b(0xc7)]};}};async function resolveSqlNewInputs(_0x39c4bf){const _0x5d2705=await resolveSqlNameInput(_0x39c4bf),{dbId:_0x372ca8,dbName:_0x5ed043}=await resolveDbSelection(_0x39c4bf),_0x4a5803=await resolveSqlModeInput(_0x39c4bf);return{'sqlName':_0x5d2705,'dbId':_0x372ca8,'dbName':_0x5ed043,'mode':_0x4a5803};}async function resolveSqlNameInput(_0x3abf52){const _0x28c460=a130_0x40406e,_0x82dd8=_0x3abf52[_0x28c460(0xd1)](_0x28c460(0xc1))[_0x28c460(0xcb)]();if(_0x82dd8)return _0x82dd8;if(_0x3abf52[_0x28c460(0xdf)])throw CliErrors['flagMissing'](_0x28c460(0xc1),_0x28c460(0xc3));return(await input({'message':_0x28c460(0xeb),'validate':_0x4ae81c=>_0x4ae81c['trim']()?!![]:'SQL\x20名称不能为空'}))['trim']();}async function resolveDbSelection(_0xa0987e){const _0x5ea056=a130_0x40406e,_0x56826a=resolveProvidedDbId(_0xa0987e);if(typeof _0x56826a===_0x5ea056(0xc8)&&Number[_0x5ea056(0xde)](_0x56826a)&&_0x56826a>0x0)return{'dbId':_0x56826a,'dbName':await getDbName(_0xa0987e[_0x5ea056(0xcd)],_0x56826a)[_0x5ea056(0xdd)](()=>undefined)};if(_0xa0987e[_0x5ea056(0xdf)])throw CliErrors[_0x5ea056(0xb4)](_0x5ea056(0xb7),_0x5ea056(0xee));const _0x3cc0f9=await listDatabases(_0xa0987e['appCode'])[_0x5ea056(0xdd)](()=>[]);if(_0x3cc0f9[_0x5ea056(0xd2)]===0x1)return{'dbId':_0x3cc0f9[0x0][_0x5ea056(0xd3)],'dbName':_0x3cc0f9[0x0][_0x5ea056(0xbf)]};if(_0x3cc0f9[_0x5ea056(0xd2)]>0x1){const _0x459409=await select({'message':_0x5ea056(0xfc),'choices':[..._0x3cc0f9[_0x5ea056(0xb8)](_0x4127d1=>({'name':_0x4127d1[_0x5ea056(0xbf)]+'\x20('+_0x4127d1['dbId']+')','value':serializeDbSelection(_0x4127d1)})),{'name':_0x5ea056(0xed),'value':_0x5ea056(0xcc)}]});if(_0x459409!==_0x5ea056(0xcc))return deserializeDbSelection(_0x459409);}const _0xd509b5=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x351e8a=>{const _0x2e1895=_0x5ea056,_0x865ff3=_0x351e8a[_0x2e1895(0xcb)]();if(!_0x865ff3)return _0x2e1895(0xfb);const _0x4c468e=Number(_0x865ff3);if(!Number[_0x2e1895(0xe0)](_0x4c468e)||_0x4c468e<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0xd509b5[_0x5ea056(0xcb)]())};}async function resolveSqlModeInput(_0x3f3a69){const _0x2bb147=a130_0x40406e,_0x36dad2=_0x3f3a69[_0x2bb147(0xd1)](_0x2bb147(0xf6))[_0x2bb147(0xcb)]();if(_0x36dad2===_0x2bb147(0xe2)||_0x36dad2===_0x2bb147(0xc0))return _0x36dad2;if(_0x3f3a69[_0x2bb147(0xdf)])throw CliErrors[_0x2bb147(0xb4)](_0x2bb147(0xf6),_0x2bb147(0xe4));return await select({'message':_0x2bb147(0xe7),'choices':[{'name':_0x2bb147(0xf4),'value':_0x2bb147(0xe2),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x2bb147(0xcf),'value':_0x2bb147(0xc0),'description':_0x2bb147(0xda)}]});}function serializeDbSelection(_0x5d7c36){const _0x39956f=a130_0x40406e;return JSON[_0x39956f(0xd8)]({'dbId':_0x5d7c36[_0x39956f(0xd3)],'dbName':_0x5d7c36[_0x39956f(0xbf)]});}function deserializeDbSelection(_0x2cfe58){const _0x42ebf1=a130_0x40406e;try{const _0x4dfb58=JSON[_0x42ebf1(0xe3)](_0x2cfe58);if(typeof _0x4dfb58[_0x42ebf1(0xd3)]===_0x42ebf1(0xc8)&&Number[_0x42ebf1(0xde)](_0x4dfb58[_0x42ebf1(0xd3)]))return{'dbId':_0x4dfb58[_0x42ebf1(0xd3)],'dbName':_0x4dfb58['dbName']};}catch{}throw CliErrors[_0x42ebf1(0xca)](_0x42ebf1(0xdb)+_0x2cfe58);}function resolveProvidedDbId(_0x5d9825){const _0xc38f62=a130_0x40406e,_0x5403c1=_0x5d9825[_0xc38f62(0xdc)](_0xc38f62(0xb7));if(typeof _0x5403c1===_0xc38f62(0xc8)&&Number[_0xc38f62(0xde)](_0x5403c1))return _0x5403c1;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a131_0x293901=a131_0x1e66;(function(_0x189ab6,_0x45be5d){const _0x3745da=a131_0x1e66,_0x1ebce9=_0x189ab6();while(!![]){try{const _0x458261=-parseInt(_0x3745da(0xfb))/0x1*(-parseInt(_0x3745da(0x118))/0x2)+parseInt(_0x3745da(0x111))/0x3+parseInt(_0x3745da(0x108))/0x4+-parseInt(_0x3745da(0x11a))/0x5+-parseInt(_0x3745da(0x101))/0x6+-parseInt(_0x3745da(0x10a))/0x7+-parseInt(_0x3745da(0x105))/0x8;if(_0x458261===_0x45be5d)break;else _0x1ebce9['push'](_0x1ebce9['shift']());}catch(_0x45436c){_0x1ebce9['push'](_0x1ebce9['shift']());}}}(a131_0x53fb,0x19cb6));function a131_0x1e66(_0x261bf3,_0x593109){_0x261bf3=_0x261bf3-0xf7;const _0x53fb42=a131_0x53fb();let _0x1e66ca=_0x53fb42[_0x261bf3];return _0x1e66ca;}import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a131_0x53fb(){const _0x51b9a8=['131125JkiLhf','projectRoot','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','lastSync','appCode','733fEeOYB','\x20(local\x20file\x20moved\x20to\x20trash)','SQL\x20lock\x20file\x20not\x20found.','fromEntries','replace','POST','496530MCzXFB','filter','Deleted\x20','toISOString','1306280BAKhUb','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','sqlRoot','513540CKLscq','sqlcode','196427VQSvfx','lockFilePath','delete','/smartapi/custom/deleteUserCustomSql','sqls','startsWith','validation','465552TeXnpU','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','remoteId','str','sql','trashDir','sqlRootDir','334Jnrynu','length'];a131_0x53fb=function(){return _0x51b9a8;};return a131_0x53fb();}import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a131_0x293901(0x115),'command':a131_0x293901(0x10c),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x2ba79a){const _0x576d86=a131_0x293901,_0x320537=loadSqlProjectConfig(_0x2ba79a[_0x576d86(0xfa)]),_0x38f0dc=await readSqlLockFile(_0x320537[_0x576d86(0x10b)]);if(!_0x38f0dc)throw CliErrors[_0x576d86(0x110)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x175be3){const _0x138812=a131_0x293901,_0x2889ba=loadSqlProjectConfig(_0x175be3[_0x138812(0xfa)]),_0x3b60d7=await readSqlLockFile(_0x2889ba[_0x138812(0x10b)]);if(!_0x3b60d7)throw CliErrors['validation'](_0x138812(0xf8));const {appLock:_0x10c465}=ensureSqlLockScope(_0x3b60d7,_0x175be3[_0x138812(0xfa)],_0x2889ba['sqlRoot'],_0x138812(0x10c)),_0x52704e=_0x175be3['str'](_0x138812(0x109)),_0x3fa48b=_0x10c465[_0x138812(0x10e)][_0x52704e];if(!_0x3fa48b)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x52704e+'\x22.');return{'method':_0x138812(0x100),'url':_0x138812(0x10d),'body':{'sqlCode':_0x52704e,'id':_0x3fa48b[_0x138812(0x113)],'localPath':resolveLocalSqlFilePath(_0x2889ba,_0x52704e,_0x3fa48b)},'description':'Would\x20delete\x20SQL\x20'+_0x52704e+_0x138812(0x106)+_0x2889ba[_0x138812(0x116)]};},async 'execute'(_0x26cd0a){const _0x291a78=a131_0x293901,_0x5339d5=loadSqlProjectConfig(_0x26cd0a[_0x291a78(0xfa)]),_0x538889=await readSqlLockFile(_0x5339d5[_0x291a78(0x10b)]);if(!_0x538889)throw CliErrors[_0x291a78(0x110)](_0x291a78(0xfd));const {lockData:_0x31e47a,appLock:_0x30f18c}=ensureSqlLockScope(_0x538889,_0x26cd0a['appCode'],_0x5339d5[_0x291a78(0x107)],'delete'),_0x530f8f=_0x26cd0a[_0x291a78(0x114)](_0x291a78(0x109)),_0x2a03d8=_0x30f18c[_0x291a78(0x10e)][_0x530f8f];if(!_0x2a03d8)throw CliErrors[_0x291a78(0x110)](_0x291a78(0x112)+_0x530f8f+'\x22.');await deleteSqlQuery({'id':_0x2a03d8[_0x291a78(0x113)],'sqlCode':_0x530f8f}),_0x30f18c[_0x291a78(0x10e)]=Object[_0x291a78(0xfe)](Object['entries'](_0x30f18c['sqls'])[_0x291a78(0x102)](([_0xb3014a])=>_0xb3014a!==_0x530f8f)),_0x30f18c[_0x291a78(0xf9)]=new Date()[_0x291a78(0x104)](),await writeSqlLockFile(_0x5339d5[_0x291a78(0x10b)],_0x31e47a);const _0x5e62c6=resolveLocalSqlFilePath(_0x5339d5,_0x530f8f,_0x2a03d8);let _0x1cde53;await fileExists(_0x5e62c6)&&(_0x1cde53=await moveToTrash(_0x5339d5[_0x291a78(0xf7)],_0x5339d5['trashDir'],_0x5e62c6),await cleanupEmptyDirectories(dirname(_0x5e62c6),_0x5339d5[_0x291a78(0x117)]));const _0x244cc7={'deleted':_0x530f8f,'remoteId':_0x2a03d8['remoteId']};if(_0x1cde53)_0x244cc7['trashedTo']=_0x1cde53;return{'ok':!![],'data':_0x244cc7,'message':_0x291a78(0x103)+_0x530f8f+(_0x1cde53?_0x291a78(0xfc):'')};}};async function moveToTrash(_0x5b67fe,_0x514f42,_0x251a36){const _0x14f6ab=a131_0x293901,_0x4089d1=new Date()[_0x14f6ab(0x104)]()[_0x14f6ab(0xff)](/[:.]/g,'-'),_0x37351b=relative(_0x5b67fe,_0x251a36),_0x2761fb=join(_0x514f42,_0x4089d1,_0x37351b);return await mkdir(dirname(_0x2761fb),{'recursive':!![]}),await rename(_0x251a36,_0x2761fb),_0x2761fb;}async function cleanupEmptyDirectories(_0x32f866,_0x56e6b6){const _0x223995=a131_0x293901;let _0x5c5596=resolve(_0x32f866);const _0x403db6=resolve(_0x56e6b6);while(_0x5c5596[_0x223995(0x10f)](''+_0x403db6+sep)||_0x5c5596===_0x403db6){if(_0x5c5596===_0x403db6)return;try{const _0xc72669=await readdir(_0x5c5596);if(_0xc72669[_0x223995(0x119)]>0x0)return;await rmdir(_0x5c5596);}catch{return;}_0x5c5596=dirname(_0x5c5596);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a132_0x43c966=a132_0x2578;(function(_0x49cf6d,_0x5c5044){const _0x1bf2a9=a132_0x2578,_0x14e224=_0x49cf6d();while(!![]){try{const _0x452124=parseInt(_0x1bf2a9(0x1e6))/0x1+parseInt(_0x1bf2a9(0x1f3))/0x2+parseInt(_0x1bf2a9(0x1ef))/0x3*(-parseInt(_0x1bf2a9(0x1ec))/0x4)+-parseInt(_0x1bf2a9(0x1df))/0x5+parseInt(_0x1bf2a9(0x1f0))/0x6+parseInt(_0x1bf2a9(0x1f4))/0x7*(parseInt(_0x1bf2a9(0x1e0))/0x8)+parseInt(_0x1bf2a9(0x1e1))/0x9*(-parseInt(_0x1bf2a9(0x1e9))/0xa);if(_0x452124===_0x5c5044)break;else _0x14e224['push'](_0x14e224['shift']());}catch(_0x269881){_0x14e224['push'](_0x14e224['shift']());}}}(a132_0x5179,0xa8f2c));import{getSqlQueryInfo}from'../../core/api-client.js';function a132_0x2578(_0x199233,_0x4cface){_0x199233=_0x199233-0x1df;const _0x5179c2=a132_0x5179();let _0x2578ad=_0x5179c2[_0x199233];return _0x2578ad;}function a132_0x5179(){const _0x195704=['302608DwflaM','126qAvKkU','boolean','str','sqlName','description','1291595OxZgEK','appCode','sqlCode','842500mbwhrR','sql','detail','3409156XgPeCI','bool','Return\x20full\x20raw\x20SQL\x20query\x20object','3njRZLV','7393884YEeilK','dbId','verbose','66148mKqzKX','168Thbfsn','sqlContent','read','3705030RZnrGw'];a132_0x5179=function(){return _0x195704;};return a132_0x5179();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a132_0x43c966(0x1ea),'command':a132_0x43c966(0x1eb),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a132_0x43c966(0x1f6),'flags':[SQLCODE_FLAG,{'name':a132_0x43c966(0x1f2),'type':a132_0x43c966(0x1e2),'description':a132_0x43c966(0x1ee)}],async 'execute'(_0x3b69d9){const _0x2da8c0=a132_0x43c966,_0x4637a1=await getSqlQueryInfo(_0x3b69d9[_0x2da8c0(0x1e7)],_0x3b69d9[_0x2da8c0(0x1e3)]('sqlcode')),_0x14928e=_0x3b69d9[_0x2da8c0(0x1ed)](_0x2da8c0(0x1f2));if(_0x14928e)return{'ok':!![],'data':_0x4637a1};const _0x4ea288=_0x4637a1['dbId']?await getDbName(_0x3b69d9['appCode'],_0x4637a1[_0x2da8c0(0x1f1)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4637a1[_0x2da8c0(0x1e8)],'sqlName':_0x4637a1[_0x2da8c0(0x1e4)],'db':_0x4ea288?_0x4ea288+'\x20('+_0x4637a1[_0x2da8c0(0x1f1)]+')':_0x4637a1[_0x2da8c0(0x1f1)]??'','description':_0x4637a1[_0x2da8c0(0x1e5)]??'','sqlContent':_0x4637a1[_0x2da8c0(0x1f5)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a133_0x4c41(_0x2a6f43,_0xbc40a7){_0x2a6f43=_0x2a6f43-0xbb;const _0x25ed21=a133_0x25ed();let _0x4c41e6=_0x25ed21[_0x2a6f43];return _0x4c41e6;}const a133_0xbf1739=a133_0x4c41;function a133_0x25ed(){const _0x2fd8bf=['48063IXMAOu','now','exec','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','\x20row(s)\x20in\x20','appCode','read','sqlcode','1414520wouyCg','Returned\x20','execError','string','length','SQL\x20execution\x20failed','params','662900SMPtvT','8eVUWAp','sql','execSuccess','20NFzARy','2581464FMiazT','14775777qZGtok','execResult','isArray','2197674pndaam','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','725548JwkAgr'];a133_0x25ed=function(){return _0x2fd8bf;};return a133_0x25ed();}(function(_0xb999f4,_0x312e81){const _0x4dca66=a133_0x4c41,_0x3e78a8=_0xb999f4();while(!![]){try{const _0x5aedeb=-parseInt(_0x4dca66(0xc6))/0x1+parseInt(_0x4dca66(0xc0))/0x2+parseInt(_0x4dca66(0xc7))/0x3+-parseInt(_0x4dca66(0xbf))/0x4*(-parseInt(_0x4dca66(0xcf))/0x5)+parseInt(_0x4dca66(0xc4))/0x6+parseInt(_0x4dca66(0xbb))/0x7+-parseInt(_0x4dca66(0xbc))/0x8*(parseInt(_0x4dca66(0xc1))/0x9);if(_0x5aedeb===_0x312e81)break;else _0x3e78a8['push'](_0x3e78a8['shift']());}catch(_0x5dccbe){_0x3e78a8['push'](_0x3e78a8['shift']());}}}(a133_0x25ed,0xc6f67));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a133_0xbf1739(0xbd),'command':a133_0xbf1739(0xc9),'description':a133_0xbf1739(0xca),'risk':a133_0xbf1739(0xcd),'flags':[SQLCODE_FLAG,{'name':'params','type':a133_0xbf1739(0xd2),'description':a133_0xbf1739(0xc5)}],async 'execute'(_0x153069){const _0x5c9624=a133_0xbf1739,_0x4402d2=parseJsonParams(_0x153069['str'](_0x5c9624(0xd5))),_0x589ede=Date[_0x5c9624(0xc8)](),_0x3c2a21=await executeSql(_0x153069[_0x5c9624(0xcc)],_0x153069['str'](_0x5c9624(0xce)),_0x4402d2),_0x2dd048=Date[_0x5c9624(0xc8)]()-_0x589ede,_0x2d2b92=_0x3c2a21?.[_0x5c9624(0xc2)]??_0x3c2a21,_0x1e8257=_0x3c2a21?.[_0x5c9624(0xbe)]??!![];if(!_0x1e8257)return{'ok':![],'data':{'error':_0x3c2a21?.[_0x5c9624(0xd1)]||_0x5c9624(0xd4),'elapsed':_0x2dd048},'message':_0x5c9624(0xd4)};const _0x39d411=Array[_0x5c9624(0xc3)](_0x2d2b92)?_0x2d2b92:[];return{'ok':!![],'data':{'rows':_0x39d411,'rowCount':_0x39d411[_0x5c9624(0xd3)],'elapsed':_0x2dd048},'message':_0x5c9624(0xd0)+_0x39d411[_0x5c9624(0xd3)]+_0x5c9624(0xcb)+_0x2dd048+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x56251b,_0x14fa21){const _0x2c345f=a134_0x41ea,_0xdd4fe7=_0x56251b();while(!![]){try{const _0x282286=parseInt(_0x2c345f(0x14b))/0x1+-parseInt(_0x2c345f(0x144))/0x2*(parseInt(_0x2c345f(0x148))/0x3)+-parseInt(_0x2c345f(0x149))/0x4+-parseInt(_0x2c345f(0x146))/0x5*(parseInt(_0x2c345f(0x147))/0x6)+-parseInt(_0x2c345f(0x143))/0x7*(parseInt(_0x2c345f(0x142))/0x8)+parseInt(_0x2c345f(0x14a))/0x9*(parseInt(_0x2c345f(0x145))/0xa)+parseInt(_0x2c345f(0x141))/0xb;if(_0x282286===_0x14fa21)break;else _0xdd4fe7['push'](_0xdd4fe7['shift']());}catch(_0x2e0762){_0xdd4fe7['push'](_0xdd4fe7['shift']());}}}(a134_0x11b8,0x48eb5));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a134_0x11b8(){const _0x3d8dcc=['168143CRVbSu','12586640LdZzEG','613840hnvfvD','28lwjYOZ','446PMKXWH','151030gPTgwC','60ReZqqs','184638uNkDkW','5721ZZvtGI','978060SeCBOV','198XxAaKX'];a134_0x11b8=function(){return _0x3d8dcc;};return a134_0x11b8();}import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a134_0x41ea(_0x532adc,_0x4b9c2c){_0x532adc=_0x532adc-0x141;const _0x11b828=a134_0x11b8();let _0x41ea3f=_0x11b828[_0x532adc];return _0x41ea3f;}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a135_0x4b89(_0x2ba66a,_0x5b4dd2){_0x2ba66a=_0x2ba66a-0xbf;const _0x4ca5e6=a135_0x4ca5();let _0x4b89b6=_0x4ca5e6[_0x2ba66a];return _0x4b89b6;}const a135_0x2fe4aa=a135_0x4b89;function a135_0x4ca5(){const _0x47b4aa=['1978110WwbitD','all','str','722813YSNylS','2329265Hcfztx','Page\x20size','9794936OMutVM','tableData','pagesize','Filter\x20by\x20SQL\x20name','Found\x20','num','description','string','read','331084PkZUIh','List\x20custom\x20SQL\x20queries','number','list','\x20SQL\x20queries\x20(total:\x20','11501CGUdWx','sqlName','1565760pXraGq','length','appCode','map','page','No\x20custom\x20SQL\x20queries\x20found.','bool','name','82xzfWKS','dbId','sql','sqlcode','verbose','totalCount'];a135_0x4ca5=function(){return _0x47b4aa;};return a135_0x4ca5();}(function(_0x24bc16,_0x5e6d16){const _0x31770b=a135_0x4b89,_0x4e9050=_0x24bc16();while(!![]){try{const _0x1116f7=parseInt(_0x31770b(0xdf))/0x1*(-parseInt(_0x31770b(0xc5))/0x2)+-parseInt(_0x31770b(0xcb))/0x3+-parseInt(_0x31770b(0xda))/0x4+parseInt(_0x31770b(0xcf))/0x5+parseInt(_0x31770b(0xe1))/0x6+-parseInt(_0x31770b(0xce))/0x7+parseInt(_0x31770b(0xd1))/0x8;if(_0x1116f7===_0x5e6d16)break;else _0x4e9050['push'](_0x4e9050['shift']());}catch(_0x1a6af4){_0x4e9050['push'](_0x4e9050['shift']());}}}(a135_0x4ca5,0x9ad7f));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a135_0x2fe4aa(0xc7),'command':a135_0x2fe4aa(0xdd),'description':a135_0x2fe4aa(0xdb),'risk':a135_0x2fe4aa(0xd9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a135_0x2fe4aa(0xc4),'type':a135_0x2fe4aa(0xd8),'description':a135_0x2fe4aa(0xd4)},{'name':a135_0x2fe4aa(0xc1),'type':'number','description':'Page\x20number','default':0x1},{'name':a135_0x2fe4aa(0xd3),'type':a135_0x2fe4aa(0xdc),'description':a135_0x2fe4aa(0xd0)},{'name':'verbose','type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x59da3d){const _0x41be13=a135_0x2fe4aa,_0x426688=await listSqlQueries(_0x59da3d['appCode'],{'sqlCode':_0x59da3d[_0x41be13(0xcd)](_0x41be13(0xc8))||undefined,'sqlName':_0x59da3d['str']('name')||undefined,'currentPage':_0x59da3d[_0x41be13(0xd6)](_0x41be13(0xc1)),'pageSize':_0x59da3d[_0x41be13(0xd6)](_0x41be13(0xd3),0x32)}),_0x249294=_0x59da3d[_0x41be13(0xc3)](_0x41be13(0xc9)),_0x77bada=_0x426688[_0x41be13(0xd2)]??[],_0xa94052=_0x426688['paging']?.[_0x41be13(0xca)]??_0x77bada[_0x41be13(0xe2)];let _0x394cfd;return _0x249294?_0x394cfd=_0x77bada:_0x394cfd=await Promise[_0x41be13(0xcc)](_0x77bada[_0x41be13(0xc0)](async _0x287f24=>{const _0x52ed5d=_0x41be13;let _0x355b90;try{_0x355b90=_0x287f24[_0x52ed5d(0xc6)]?await getDbName(_0x59da3d[_0x52ed5d(0xbf)],_0x287f24[_0x52ed5d(0xc6)]):undefined;}catch{}return{'sqlCode':_0x287f24['sqlCode'],'sqlName':_0x287f24[_0x52ed5d(0xe0)],'description':_0x287f24[_0x52ed5d(0xd7)]??'','db':_0x355b90?_0x355b90+'\x20('+_0x287f24[_0x52ed5d(0xc6)]+')':_0x287f24['dbId']??''};})),{'ok':!![],'data':_0x394cfd,'message':_0x77bada[_0x41be13(0xe2)]===0x0?_0x41be13(0xc2):_0x41be13(0xd5)+_0x77bada[_0x41be13(0xe2)]+_0x41be13(0xde)+_0xa94052+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a136_0x5d1988=a136_0x3b1a;(function(_0x3d9300,_0x1460e4){const _0x399001=a136_0x3b1a,_0x3962ed=_0x3d9300();while(!![]){try{const _0x115aa5=-parseInt(_0x399001(0x1e6))/0x1+-parseInt(_0x399001(0x1f4))/0x2*(parseInt(_0x399001(0x1ff))/0x3)+parseInt(_0x399001(0x1db))/0x4+-parseInt(_0x399001(0x1e0))/0x5+parseInt(_0x399001(0x201))/0x6*(-parseInt(_0x399001(0x202))/0x7)+parseInt(_0x399001(0x1de))/0x8*(parseInt(_0x399001(0x1d6))/0x9)+-parseInt(_0x399001(0x1df))/0xa*(-parseInt(_0x399001(0x1fb))/0xb);if(_0x115aa5===_0x1460e4)break;else _0x3962ed['push'](_0x3962ed['shift']());}catch(_0x148d28){_0x3962ed['push'](_0x3962ed['shift']());}}}(a136_0x2079,0x3503f));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a136_0x2079(){const _0x87e51=['171KLEWbc','sqlcode','\x20SQL\x20file(s)\x20into\x20','sqlCode','sql','382732WHEKmf','POST','\x20failed','75128LvDydQ','10XNcSbJ','1818930yZgkco','Filter\x20by\x20SQL\x20display\x20name','sqls','write','Force\x20pull\x20cancelled.','force','250535uNfpqM','appCode','Force\x20overwrite\x20local\x20unsynced\x20changes','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','str','sqlRoot','skipped','length','cancelled','bool','\x20written,\x20','message','join','push','54bOhOFx','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','filter','paging','pull','apps','description','7635881Urvsrd','totalCount','mybatisXml','catch','13251VEfzlv','string','6TIZvkt','122864dBoHBr','Would\x20pull\x20','No\x20remote\x20SQL\x20queries\x20matched.','sqlRootDir','toISOString','dbId','sqlContent','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','test','unchanged','lockFilePath','trimStart','utf8','sqlName','conflict','name'];a136_0x2079=function(){return _0x87e51;};return a136_0x2079();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a136_0x3b1a(_0x5a8ce4,_0x1f2793){_0x5a8ce4=_0x5a8ce4-0x1d3;const _0x2079be=a136_0x2079();let _0x3b1a63=_0x2079be[_0x5a8ce4];return _0x3b1a63;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x2834f7,_0x32bd00){const _0x2630f9=a136_0x3b1a,_0x23ce9c=[];let _0x1fbe6f=0x1;while(!![]){const _0x90c549=await listSqlQueries(_0x2834f7,{'currentPage':_0x1fbe6f,'pageSize':PAGE_SIZE,'sqlCode':_0x32bd00['sqlCode'],'sqlName':_0x32bd00[_0x2630f9(0x1d3)]}),_0x28bc7b=_0x90c549['tableData']??[];_0x23ce9c[_0x2630f9(0x1f3)](..._0x28bc7b);if(_0x28bc7b['length']===0x0)break;const _0x5053d1=_0x90c549[_0x2630f9(0x1f7)]?.[_0x2630f9(0x1fc)];if(_0x5053d1!=null?_0x23ce9c[_0x2630f9(0x1ed)]>=_0x5053d1:_0x28bc7b[_0x2630f9(0x1ed)]<PAGE_SIZE)break;_0x1fbe6f++;}return _0x23ce9c;}async function ensureSqlContent(_0x16fcf9){const _0x4977c6=a136_0x3b1a;if(_0x16fcf9[_0x4977c6(0x208)]!=null&&String(_0x16fcf9[_0x4977c6(0x208)])['length']>0x0)return _0x16fcf9;return getSqlQueryDetail(_0x16fcf9['sqlCode']);}export const sqlPull={'service':'sql','command':a136_0x5d1988(0x1f8),'description':a136_0x5d1988(0x1f5),'risk':a136_0x5d1988(0x1e3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a136_0x5d1988(0x1d5),'type':a136_0x5d1988(0x200),'description':a136_0x5d1988(0x1e1)},{'name':a136_0x5d1988(0x1e5),'type':'boolean','description':a136_0x5d1988(0x1e8)}],async 'dryRun'(_0x236426){const _0x5c43e8=a136_0x5d1988,_0x167f6e=loadSqlProjectConfig(_0x236426[_0x5c43e8(0x1e7)]),_0x2215d6=await readSqlLockFile(_0x167f6e['lockFilePath']),{appLock:_0x5516bb}=ensureSqlLockScope(_0x2215d6??createEmptySqlLock(),_0x167f6e[_0x5c43e8(0x1e7)],_0x167f6e[_0x5c43e8(0x1eb)],_0x5c43e8(0x1f8)),_0x1eb484=await fetchAllSqlQueries(_0x236426['appCode'],{'sqlCode':_0x236426[_0x5c43e8(0x1ea)](_0x5c43e8(0x1d7))||undefined,'sqlName':_0x236426[_0x5c43e8(0x1ea)](_0x5c43e8(0x1d5))||undefined}),_0x3c6af3=[];for(const _0x549077 of _0x1eb484){const _0xbb9d27=await ensureSqlContent(_0x549077),_0x262839=ensureRemoteSqlContent(_0xbb9d27),_0x423b31=detectModeFromSql(_0xbb9d27),_0x575396=_0xbb9d27[_0x5c43e8(0x207)]?await getDbName(_0x236426['appCode'],Number(_0xbb9d27[_0x5c43e8(0x207)]))[_0x5c43e8(0x1fe)](()=>undefined):undefined,_0x4f1e3b=buildLocalSqlFileContent({'sqlCode':_0xbb9d27[_0x5c43e8(0x1d9)],'sqlName':_0xbb9d27[_0x5c43e8(0x1d3)],'dbId':_0xbb9d27[_0x5c43e8(0x207)]},_0x262839,{'dbName':_0x575396,'mode':_0x423b31,'syncedAt':new Date()[_0x5c43e8(0x206)](),'description':_0xbb9d27[_0x5c43e8(0x1fa)]}),_0x10842c=buildSqlLockEntry(_0xbb9d27,_0x262839,'',{'dbName':_0x575396}),_0x50e3cf=resolveLocalSqlFilePath(_0x167f6e,_0xbb9d27['sqlCode'],_0x10842c);let _0x4f4884='would_pull',_0x4dfa28;if(await fileExists(_0x50e3cf)){const _0x29e864=await readFile(_0x50e3cf,_0x5c43e8(0x20e));isEquivalentPulledSqlFile(_0x29e864,_0x4f1e3b,_0x423b31)?(_0x4f4884=_0x5c43e8(0x1ec),_0x4dfa28=_0x5c43e8(0x20b)):(_0x4f4884=_0x5c43e8(0x1d4),_0x4dfa28=_0x5c43e8(0x209));}_0x3c6af3[_0x5c43e8(0x1f3)]({'sqlCode':_0xbb9d27[_0x5c43e8(0x1d9)],'sqlName':_0xbb9d27['sqlName'],'filePath':_0x50e3cf,'status':_0x4f4884,'reason':_0x4dfa28});}return{'method':_0x5c43e8(0x1dc),'url':_0x5c43e8(0x1e9),'body':{'appCode':_0x236426[_0x5c43e8(0x1e7)],'sqlCode':_0x236426['str'](_0x5c43e8(0x1d7))||null,'sqlName':_0x236426[_0x5c43e8(0x1ea)](_0x5c43e8(0x1d5))||null,'files':_0x3c6af3},'description':_0x5c43e8(0x203)+_0x3c6af3[_0x5c43e8(0x1ed)]+_0x5c43e8(0x1d8)+_0x167f6e[_0x5c43e8(0x205)]};},async 'execute'(_0x1df416){const _0x237ca5=a136_0x5d1988,_0x520176=loadSqlProjectConfig(_0x1df416['appCode']),_0xe1433f=await readSqlLockFile(_0x520176[_0x237ca5(0x20c)]),{lockData:_0x31d62d,appLock:_0x1de536}=ensureSqlLockScope(_0xe1433f??createEmptySqlLock(),_0x520176['appCode'],_0x520176[_0x237ca5(0x1eb)],_0x237ca5(0x1f8)),_0x34070d=_0x1df416[_0x237ca5(0x1ef)]('force'),_0x5c6cfc=await fetchAllSqlQueries(_0x1df416[_0x237ca5(0x1e7)],{'sqlCode':_0x1df416['str'](_0x237ca5(0x1d7))||undefined,'sqlName':_0x1df416[_0x237ca5(0x1ea)](_0x237ca5(0x1d5))||undefined});if(_0x5c6cfc[_0x237ca5(0x1ed)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x237ca5(0x204)};const _0x36965d=[],_0x390e10=[];for(const _0x40a68a of _0x5c6cfc){try{_0x36965d[_0x237ca5(0x1f3)](await ensureSqlContent(_0x40a68a));}catch(_0x13a4ed){_0x390e10[_0x237ca5(0x1f3)]({'sqlCode':_0x40a68a[_0x237ca5(0x1d9)],'error':_0x13a4ed instanceof Error?_0x13a4ed[_0x237ca5(0x1f1)]:String(_0x13a4ed)});}}if(_0x34070d&&!_0x1df416['nonInteractive']){let _0x1189f6=![];for(const _0x4ddbb0 of _0x36965d){const _0x50844b=detectModeFromSql(_0x4ddbb0),_0x5df2f0=_0x4ddbb0[_0x237ca5(0x207)]?await getDbName(_0x1df416[_0x237ca5(0x1e7)],Number(_0x4ddbb0[_0x237ca5(0x207)]))['catch'](()=>undefined):undefined,_0x5bd6c8=buildLocalSqlFileContent({'sqlCode':_0x4ddbb0[_0x237ca5(0x1d9)],'sqlName':_0x4ddbb0[_0x237ca5(0x1d3)],'dbId':_0x4ddbb0['dbId']},ensureRemoteSqlContent(_0x4ddbb0),{'dbName':_0x5df2f0,'mode':_0x50844b,'syncedAt':new Date()[_0x237ca5(0x206)](),'description':_0x4ddbb0[_0x237ca5(0x1fa)]}),_0x1fbe9d=resolveLocalSqlFilePath(_0x520176,_0x4ddbb0[_0x237ca5(0x1d9)],buildSqlLockEntry(_0x4ddbb0,ensureRemoteSqlContent(_0x4ddbb0),'',{'dbName':_0x5df2f0}));if(await fileExists(_0x1fbe9d)){const _0x1f7158=await readFile(_0x1fbe9d,'utf8');if(!isEquivalentPulledSqlFile(_0x1f7158,_0x5bd6c8,_0x50844b)){_0x1189f6=!![];break;}}}if(_0x1189f6){const _0x2eb0ae=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x2eb0ae)throw CliErrors[_0x237ca5(0x1ee)](_0x237ca5(0x1e4));}}const _0x5964cc=cloneSqlLockData(_0x31d62d),_0x58bb0c=_0x5964cc[_0x237ca5(0x1f9)][_0x520176[_0x237ca5(0x1e7)]],_0x1f0c5a=[],_0x1ab6e5=[];for(const _0x1b92a9 of _0x36965d){const _0x5eb431=_0x58bb0c[_0x237ca5(0x1e2)][_0x1b92a9[_0x237ca5(0x1d9)]],_0x4ad6b1=ensureRemoteSqlContent(_0x1b92a9),_0x39fc46=detectModeFromSql(_0x1b92a9),_0x329ecf=_0x1b92a9[_0x237ca5(0x207)]?await getDbName(_0x1df416['appCode'],Number(_0x1b92a9[_0x237ca5(0x207)]))[_0x237ca5(0x1fe)](()=>undefined):undefined,_0x67fb2e=buildLocalSqlFileContent({'sqlCode':_0x1b92a9['sqlCode'],'sqlName':_0x1b92a9[_0x237ca5(0x1d3)],'dbId':_0x1b92a9['dbId']},_0x4ad6b1,{'dbName':_0x329ecf,'mode':_0x39fc46,'syncedAt':new Date()[_0x237ca5(0x206)](),'description':_0x1b92a9['description']}),_0x96ac62=buildSqlLockEntry(_0x1b92a9,_0x4ad6b1,computeSqlContentHash(_0x67fb2e),{'dbName':_0x329ecf}),_0x5e3768=_0x96ac62['path'],_0x5f86db=join(_0x520176[_0x237ca5(0x205)],_0x5e3768);try{if(await fileExists(_0x5f86db)){const _0x44967b=await readFile(_0x5f86db,_0x237ca5(0x20e));if(isEquivalentPulledSqlFile(_0x44967b,_0x67fb2e,_0x39fc46)){_0x1ab6e5[_0x237ca5(0x1f3)]({'sqlCode':_0x1b92a9['sqlCode'],'reason':'unchanged'}),_0x58bb0c[_0x237ca5(0x1e2)][_0x1b92a9[_0x237ca5(0x1d9)]]={..._0x96ac62,'hash':computeSqlContentHash(_0x44967b),'path':_0x5e3768};continue;}if(!_0x34070d){_0x1ab6e5[_0x237ca5(0x1f3)]({'sqlCode':_0x1b92a9[_0x237ca5(0x1d9)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x56a34b=_0x5eb431?.['path']?join(_0x520176[_0x237ca5(0x205)],_0x5eb431['path']):undefined;_0x56a34b&&_0x56a34b!==_0x5f86db&&await fileExists(_0x56a34b)&&await rm(_0x56a34b,{'force':!![]}),await ensureParentDirectory(_0x5f86db),await writeFile(_0x5f86db,_0x67fb2e,'utf8'),_0x58bb0c[_0x237ca5(0x1e2)][_0x1b92a9[_0x237ca5(0x1d9)]]={..._0x96ac62,'path':_0x5e3768},_0x1f0c5a[_0x237ca5(0x1f3)]({'sqlCode':_0x1b92a9[_0x237ca5(0x1d9)],'filePath':_0x5f86db});}catch(_0x1b0cba){_0x390e10[_0x237ca5(0x1f3)]({'sqlCode':_0x1b92a9['sqlCode'],'error':_0x1b0cba instanceof Error?_0x1b0cba[_0x237ca5(0x1f1)]:String(_0x1b0cba)});}}return _0x58bb0c['lastSync']=new Date()[_0x237ca5(0x206)](),await writeSqlLockFile(_0x520176[_0x237ca5(0x20c)],_0x5964cc),{'ok':_0x390e10[_0x237ca5(0x1ed)]===0x0,'data':{'pulled':_0x1f0c5a,'skipped':_0x1ab6e5,'failed':_0x390e10},'message':'Pull\x20complete:\x20'+_0x1f0c5a[_0x237ca5(0x1ed)]+_0x237ca5(0x1f0)+_0x1ab6e5[_0x237ca5(0x1ed)]+'\x20skipped,\x20'+_0x390e10[_0x237ca5(0x1ed)]+_0x237ca5(0x1dd)};}};function detectModeFromSql(_0x17cb49){const _0x20a7be=a136_0x5d1988,_0x44f16e=ensureRemoteSqlContent(_0x17cb49),_0x3b2320=stripLocalSqlMetadata(_0x44f16e,_0x20a7be(0x1fd))[_0x20a7be(0x20d)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x3b2320))return _0x20a7be(0x1fd);return _0x20a7be(0x1da);}function isEquivalentPulledSqlFile(_0x59870c,_0x264b66,_0x33d78f){return normalizePullComparableContent(_0x59870c,_0x33d78f)===normalizePullComparableContent(_0x264b66,_0x33d78f);}function normalizePullComparableContent(_0x5c9be2,_0x448d23){const _0x53619b=a136_0x5d1988,_0x41c641=_0x5c9be2['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x4d216b=_0x41c641[_0x53619b(0x1f6)](_0x1091ec=>!isSyncedAtMetadataLine(_0x1091ec,_0x448d23));return _0x4d216b[_0x53619b(0x1f2)]('\x0a');}function isSyncedAtMetadataLine(_0x1fa0ed,_0x5b234d){const _0xdb7eb1=a136_0x5d1988;if(_0x5b234d==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x1fa0ed);return/^\s*--\s*@lovrabet\.syncedAt:/[_0xdb7eb1(0x20a)](_0x1fa0ed);}
|
|
1
|
+
function a136_0x5433(){const _0x3982c0=['Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','utf8','nonInteractive','lockFilePath','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','No\x20remote\x20SQL\x20queries\x20matched.','local\x20differs\x20from\x20remote','1021509dpqHlt','50bNgqFL','88860rgMSlp','name','apps','totalCount','description','test','\x20failed','Filter\x20by\x20SQL\x20display\x20name','toISOString','string','sqlRoot','sqlCode','dbId','conflict','POST','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','71031kvOlfM','270763bYIoBm','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','2737lnpfRl','sqls','2ABKyjH','write','sqlRootDir','skipped','bool','5224GoxMxL','unchanged','pull','force','Force\x20pull\x20cancelled.','Pull\x20complete:\x20','sqlName','appCode','cancelled','filter','length','546088QUYvLF','str','catch','message','Force\x20overwrite\x20local\x20unsynced\x20changes','split','join','\x20SQL\x20file(s)\x20into\x20','replace','sqlcode','sql','1026530wuzomo','paging','lastSync','sqlContent','mybatisXml','push','path'];a136_0x5433=function(){return _0x3982c0;};return a136_0x5433();}const a136_0x28db64=a136_0x31f2;(function(_0x9cd7ab,_0x188255){const _0x44317f=a136_0x31f2,_0x40f93d=_0x9cd7ab();while(!![]){try{const _0x137065=-parseInt(_0x44317f(0x121))/0x1+-parseInt(_0x44317f(0x125))/0x2*(-parseInt(_0x44317f(0x120))/0x3)+-parseInt(_0x44317f(0x135))/0x4+parseInt(_0x44317f(0x140))/0x5+parseInt(_0x44317f(0x150))/0x6+parseInt(_0x44317f(0x123))/0x7*(-parseInt(_0x44317f(0x12a))/0x8)+parseInt(_0x44317f(0x14e))/0x9*(parseInt(_0x44317f(0x14f))/0xa);if(_0x137065===_0x188255)break;else _0x40f93d['push'](_0x40f93d['shift']());}catch(_0x109940){_0x40f93d['push'](_0x40f93d['shift']());}}}(a136_0x5433,0x244d2));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a136_0x31f2(_0x471aa9,_0x26c34d){_0x471aa9=_0x471aa9-0x114;const _0x543350=a136_0x5433();let _0x31f244=_0x543350[_0x471aa9];return _0x31f244;}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x1e0d69,_0x38b671){const _0x3e1f98=a136_0x31f2,_0x161802=[];let _0x31e2ab=0x1;while(!![]){const _0x49ca80=await listSqlQueries(_0x1e0d69,{'currentPage':_0x31e2ab,'pageSize':PAGE_SIZE,'sqlCode':_0x38b671['sqlCode'],'sqlName':_0x38b671[_0x3e1f98(0x130)]}),_0x347908=_0x49ca80['tableData']??[];_0x161802[_0x3e1f98(0x145)](..._0x347908);if(_0x347908[_0x3e1f98(0x134)]===0x0)break;const _0x22f66e=_0x49ca80[_0x3e1f98(0x141)]?.[_0x3e1f98(0x153)];if(_0x22f66e!=null?_0x161802['length']>=_0x22f66e:_0x347908[_0x3e1f98(0x134)]<PAGE_SIZE)break;_0x31e2ab++;}return _0x161802;}async function ensureSqlContent(_0x5a02ee){const _0x8867a2=a136_0x31f2;if(_0x5a02ee['sqlContent']!=null&&String(_0x5a02ee[_0x8867a2(0x143)])[_0x8867a2(0x134)]>0x0)return _0x5a02ee;return getSqlQueryDetail(_0x5a02ee['sqlCode']);}export const sqlPull={'service':a136_0x28db64(0x13f),'command':a136_0x28db64(0x12c),'description':a136_0x28db64(0x147),'risk':a136_0x28db64(0x126),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a136_0x28db64(0x151),'type':a136_0x28db64(0x119),'description':a136_0x28db64(0x117)},{'name':a136_0x28db64(0x12d),'type':'boolean','description':a136_0x28db64(0x139)}],async 'dryRun'(_0x57ec2a){const _0x530a53=a136_0x28db64,_0x55bcf8=loadSqlProjectConfig(_0x57ec2a[_0x530a53(0x131)]),_0x15bd65=await readSqlLockFile(_0x55bcf8[_0x530a53(0x14a)]),{appLock:_0x111e7d}=ensureSqlLockScope(_0x15bd65??createEmptySqlLock(),_0x55bcf8[_0x530a53(0x131)],_0x55bcf8[_0x530a53(0x11a)],_0x530a53(0x12c)),_0x119286=await fetchAllSqlQueries(_0x57ec2a[_0x530a53(0x131)],{'sqlCode':_0x57ec2a[_0x530a53(0x136)](_0x530a53(0x13e))||undefined,'sqlName':_0x57ec2a['str'](_0x530a53(0x151))||undefined}),_0x490d48=[];for(const _0x1f749b of _0x119286){const _0x1ac8a3=await ensureSqlContent(_0x1f749b),_0x42ca3f=ensureRemoteSqlContent(_0x1ac8a3),_0x2f3945=detectModeFromSql(_0x1ac8a3),_0x3f8318=_0x1ac8a3['dbId']?await getDbName(_0x57ec2a[_0x530a53(0x131)],Number(_0x1ac8a3[_0x530a53(0x11c)]))[_0x530a53(0x137)](()=>undefined):undefined,_0x4f0bfe=buildLocalSqlFileContent({'sqlCode':_0x1ac8a3[_0x530a53(0x11b)],'sqlName':_0x1ac8a3[_0x530a53(0x130)],'dbId':_0x1ac8a3[_0x530a53(0x11c)]},_0x42ca3f,{'dbName':_0x3f8318,'mode':_0x2f3945,'syncedAt':new Date()[_0x530a53(0x118)](),'description':_0x1ac8a3['description']}),_0x11d209=buildSqlLockEntry(_0x1ac8a3,_0x42ca3f,'',{'dbName':_0x3f8318}),_0x2f7fd7=resolveLocalSqlFilePath(_0x55bcf8,_0x1ac8a3[_0x530a53(0x11b)],_0x11d209);let _0x275365='would_pull',_0x22dd0c;if(await fileExists(_0x2f7fd7)){const _0x46f93b=await readFile(_0x2f7fd7,'utf8');isEquivalentPulledSqlFile(_0x46f93b,_0x4f0bfe,_0x2f3945)?(_0x275365=_0x530a53(0x128),_0x22dd0c=_0x530a53(0x12b)):(_0x275365=_0x530a53(0x11d),_0x22dd0c=_0x530a53(0x11f));}_0x490d48[_0x530a53(0x145)]({'sqlCode':_0x1ac8a3[_0x530a53(0x11b)],'sqlName':_0x1ac8a3[_0x530a53(0x130)],'filePath':_0x2f7fd7,'status':_0x275365,'reason':_0x22dd0c});}return{'method':_0x530a53(0x11e),'url':_0x530a53(0x122),'body':{'appCode':_0x57ec2a[_0x530a53(0x131)],'sqlCode':_0x57ec2a[_0x530a53(0x136)](_0x530a53(0x13e))||null,'sqlName':_0x57ec2a[_0x530a53(0x136)](_0x530a53(0x151))||null,'files':_0x490d48},'description':'Would\x20pull\x20'+_0x490d48[_0x530a53(0x134)]+_0x530a53(0x13c)+_0x55bcf8[_0x530a53(0x127)]};},async 'execute'(_0x3a8c3f){const _0x6ab451=a136_0x28db64,_0x50e21d=loadSqlProjectConfig(_0x3a8c3f[_0x6ab451(0x131)]),_0xc561ca=await readSqlLockFile(_0x50e21d[_0x6ab451(0x14a)]),{lockData:_0x481acd,appLock:_0x2bfd44}=ensureSqlLockScope(_0xc561ca??createEmptySqlLock(),_0x50e21d[_0x6ab451(0x131)],_0x50e21d[_0x6ab451(0x11a)],_0x6ab451(0x12c)),_0x529081=_0x3a8c3f[_0x6ab451(0x129)](_0x6ab451(0x12d)),_0x47323f=await fetchAllSqlQueries(_0x3a8c3f['appCode'],{'sqlCode':_0x3a8c3f['str']('sqlcode')||undefined,'sqlName':_0x3a8c3f['str']('name')||undefined});if(_0x47323f['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x6ab451(0x14c)};const _0x683ffa=[],_0x265b84=[];for(const _0x45a7c6 of _0x47323f){try{_0x683ffa[_0x6ab451(0x145)](await ensureSqlContent(_0x45a7c6));}catch(_0xc46fb2){_0x265b84[_0x6ab451(0x145)]({'sqlCode':_0x45a7c6[_0x6ab451(0x11b)],'error':_0xc46fb2 instanceof Error?_0xc46fb2['message']:String(_0xc46fb2)});}}if(_0x529081&&!_0x3a8c3f[_0x6ab451(0x149)]){let _0x536387=![];for(const _0x696ddd of _0x683ffa){const _0x2bac00=detectModeFromSql(_0x696ddd),_0x3f7627=_0x696ddd[_0x6ab451(0x11c)]?await getDbName(_0x3a8c3f[_0x6ab451(0x131)],Number(_0x696ddd[_0x6ab451(0x11c)]))[_0x6ab451(0x137)](()=>undefined):undefined,_0x1f42ed=buildLocalSqlFileContent({'sqlCode':_0x696ddd['sqlCode'],'sqlName':_0x696ddd['sqlName'],'dbId':_0x696ddd[_0x6ab451(0x11c)]},ensureRemoteSqlContent(_0x696ddd),{'dbName':_0x3f7627,'mode':_0x2bac00,'syncedAt':new Date()['toISOString'](),'description':_0x696ddd[_0x6ab451(0x114)]}),_0x38dd6d=resolveLocalSqlFilePath(_0x50e21d,_0x696ddd[_0x6ab451(0x11b)],buildSqlLockEntry(_0x696ddd,ensureRemoteSqlContent(_0x696ddd),'',{'dbName':_0x3f7627}));if(await fileExists(_0x38dd6d)){const _0x156815=await readFile(_0x38dd6d,_0x6ab451(0x148));if(!isEquivalentPulledSqlFile(_0x156815,_0x1f42ed,_0x2bac00)){_0x536387=!![];break;}}}if(_0x536387){const _0x3396c1=await confirmForceOverwrite(_0x6ab451(0x14b));if(!_0x3396c1)throw CliErrors[_0x6ab451(0x132)](_0x6ab451(0x12e));}}const _0x404ef8=cloneSqlLockData(_0x481acd),_0x263f5c=_0x404ef8[_0x6ab451(0x152)][_0x50e21d[_0x6ab451(0x131)]],_0x2585b8=[],_0x1933e6=[];for(const _0x39160c of _0x683ffa){const _0x5cd2df=_0x263f5c['sqls'][_0x39160c[_0x6ab451(0x11b)]],_0x209570=ensureRemoteSqlContent(_0x39160c),_0x35e93b=detectModeFromSql(_0x39160c),_0x1ab6fd=_0x39160c[_0x6ab451(0x11c)]?await getDbName(_0x3a8c3f[_0x6ab451(0x131)],Number(_0x39160c[_0x6ab451(0x11c)]))[_0x6ab451(0x137)](()=>undefined):undefined,_0x51ecaf=buildLocalSqlFileContent({'sqlCode':_0x39160c[_0x6ab451(0x11b)],'sqlName':_0x39160c[_0x6ab451(0x130)],'dbId':_0x39160c[_0x6ab451(0x11c)]},_0x209570,{'dbName':_0x1ab6fd,'mode':_0x35e93b,'syncedAt':new Date()[_0x6ab451(0x118)](),'description':_0x39160c[_0x6ab451(0x114)]}),_0x27383b=buildSqlLockEntry(_0x39160c,_0x209570,computeSqlContentHash(_0x51ecaf),{'dbName':_0x1ab6fd}),_0x1c5774=_0x27383b['path'],_0x18dfa6=join(_0x50e21d[_0x6ab451(0x127)],_0x1c5774);try{if(await fileExists(_0x18dfa6)){const _0x4f02bd=await readFile(_0x18dfa6,_0x6ab451(0x148));if(isEquivalentPulledSqlFile(_0x4f02bd,_0x51ecaf,_0x35e93b)){_0x1933e6[_0x6ab451(0x145)]({'sqlCode':_0x39160c[_0x6ab451(0x11b)],'reason':_0x6ab451(0x12b)}),_0x263f5c[_0x6ab451(0x124)][_0x39160c[_0x6ab451(0x11b)]]={..._0x27383b,'hash':computeSqlContentHash(_0x4f02bd),'path':_0x1c5774};continue;}if(!_0x529081){_0x1933e6['push']({'sqlCode':_0x39160c[_0x6ab451(0x11b)],'reason':_0x6ab451(0x14d)});continue;}}const _0x3233fa=_0x5cd2df?.[_0x6ab451(0x146)]?join(_0x50e21d[_0x6ab451(0x127)],_0x5cd2df[_0x6ab451(0x146)]):undefined;_0x3233fa&&_0x3233fa!==_0x18dfa6&&await fileExists(_0x3233fa)&&await rm(_0x3233fa,{'force':!![]}),await ensureParentDirectory(_0x18dfa6),await writeFile(_0x18dfa6,_0x51ecaf,_0x6ab451(0x148)),_0x263f5c[_0x6ab451(0x124)][_0x39160c[_0x6ab451(0x11b)]]={..._0x27383b,'path':_0x1c5774},_0x2585b8[_0x6ab451(0x145)]({'sqlCode':_0x39160c['sqlCode'],'filePath':_0x18dfa6});}catch(_0x28fd0e){_0x265b84[_0x6ab451(0x145)]({'sqlCode':_0x39160c[_0x6ab451(0x11b)],'error':_0x28fd0e instanceof Error?_0x28fd0e[_0x6ab451(0x138)]:String(_0x28fd0e)});}}return _0x263f5c[_0x6ab451(0x142)]=new Date()['toISOString'](),await writeSqlLockFile(_0x50e21d[_0x6ab451(0x14a)],_0x404ef8),{'ok':_0x265b84[_0x6ab451(0x134)]===0x0,'data':{'pulled':_0x2585b8,'skipped':_0x1933e6,'failed':_0x265b84},'message':_0x6ab451(0x12f)+_0x2585b8[_0x6ab451(0x134)]+'\x20written,\x20'+_0x1933e6[_0x6ab451(0x134)]+'\x20skipped,\x20'+_0x265b84['length']+_0x6ab451(0x116)};}};function detectModeFromSql(_0x23b2d7){const _0x808cf9=a136_0x28db64,_0x480a90=ensureRemoteSqlContent(_0x23b2d7),_0x442796=stripLocalSqlMetadata(_0x480a90,_0x808cf9(0x144))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x808cf9(0x115)](_0x442796))return _0x808cf9(0x144);return _0x808cf9(0x13f);}function isEquivalentPulledSqlFile(_0x369609,_0x4c80c0,_0x583134){return normalizePullComparableContent(_0x369609,_0x583134)===normalizePullComparableContent(_0x4c80c0,_0x583134);}function normalizePullComparableContent(_0x3ec4fd,_0x5964ba){const _0x103f77=a136_0x28db64,_0x3f7bea=_0x3ec4fd[_0x103f77(0x13d)](/\r\n/g,'\x0a')[_0x103f77(0x13a)]('\x0a'),_0x140ce8=_0x3f7bea[_0x103f77(0x133)](_0x100460=>!isSyncedAtMetadataLine(_0x100460,_0x5964ba));return _0x140ce8[_0x103f77(0x13b)]('\x0a');}function isSyncedAtMetadataLine(_0x21acd2,_0x3b451d){const _0x26035c=a136_0x28db64;if(_0x3b451d==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x26035c(0x115)](_0x21acd2);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x21acd2);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a137_0x1e275d=a137_0x18f6;(function(_0x446b28,_0x346a35){const _0x146790=a137_0x18f6,_0x502d40=_0x446b28();while(!![]){try{const _0x11c982=parseInt(_0x146790(0x145))/0x1*(parseInt(_0x146790(0x11f))/0x2)+parseInt(_0x146790(0x12c))/0x3+parseInt(_0x146790(0x12f))/0x4+-parseInt(_0x146790(0x130))/0x5*(parseInt(_0x146790(0x151))/0x6)+parseInt(_0x146790(0x154))/0x7*(-parseInt(_0x146790(0x125))/0x8)+parseInt(_0x146790(0x11c))/0x9*(-parseInt(_0x146790(0x15a))/0xa)+parseInt(_0x146790(0x136))/0xb;if(_0x11c982===_0x346a35)break;else _0x502d40['push'](_0x502d40['shift']());}catch(_0x4b94c1){_0x502d40['push'](_0x502d40['shift']());}}}(a137_0x1afd,0xdc675));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a137_0x18f6(_0xc9869a,_0x4508da){_0xc9869a=_0xc9869a-0x11a;const _0x1afd4b=a137_0x1afd();let _0x18f6a3=_0x1afd4b[_0xc9869a];return _0x18f6a3;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x311a28,_0x581f12,_0x36c0a3){const _0x3c897b=a137_0x18f6,_0x19dc63=await scanLocalSqlQueries(_0x311a28),_0x351910=new Map();for(const _0x185b94 of _0x19dc63){if(_0x36c0a3&&_0x185b94[_0x3c897b(0x146)]!==_0x36c0a3)continue;const _0x308c15=_0x351910[_0x3c897b(0x12e)](_0x185b94[_0x3c897b(0x146)])??[];_0x308c15[_0x3c897b(0x123)](_0x185b94),_0x351910[_0x3c897b(0x140)](_0x185b94[_0x3c897b(0x146)],_0x308c15);}if(_0x36c0a3&&!_0x351910[_0x3c897b(0x13d)](_0x36c0a3))throw CliErrors[_0x3c897b(0x12d)](_0x3c897b(0x11a)+_0x36c0a3);const _0x35b6ac=[];for(const [_0x4c6eb6,_0x5f5c6f]of _0x351910['entries']()){if(_0x5f5c6f[_0x3c897b(0x12a)]===0x1){_0x35b6ac[_0x3c897b(0x123)](_0x5f5c6f[0x0]);continue;}const _0x2dbbe8=_0x581f12['sqls'][_0x4c6eb6],_0x2087e9=_0x2dbbe8?.[_0x3c897b(0x135)],_0xda9667=_0x2087e9?_0x5f5c6f[_0x3c897b(0x132)](_0x3f5fa3=>_0x3f5fa3[_0x3c897b(0x155)]!==_0x2087e9):_0x5f5c6f;if(_0x2dbbe8&&_0xda9667[_0x3c897b(0x12a)]===0x1){_0x35b6ac[_0x3c897b(0x123)](_0xda9667[0x0]);continue;}throw CliErrors[_0x3c897b(0x12d)](_0x3c897b(0x137)+_0x4c6eb6+_0x3c897b(0x14c));}return _0x35b6ac;}export const sqlPush={'service':'sql','command':'push','description':a137_0x1e275d(0x14a),'risk':a137_0x1e275d(0x11e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a137_0x1e275d(0x152),'type':a137_0x1e275d(0x11b),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x131abf){const _0x4e986b=a137_0x1e275d,_0x4c6bc3=loadSqlProjectConfig(_0x131abf['appCode']),_0x13be78=await readSqlLockFile(_0x4c6bc3[_0x4e986b(0x120)]),{appLock:_0x51a054}=ensureSqlLockScope(_0x13be78??createEmptySqlLock(),_0x131abf[_0x4e986b(0x126)],_0x4c6bc3['sqlRoot'],_0x4e986b(0x123)),_0x55c13c=await getTargetSqlQueries(_0x4c6bc3,_0x51a054,_0x131abf[_0x4e986b(0x13a)](_0x4e986b(0x134))||undefined),_0x4d4b86=[];for(const _0x37b992 of _0x55c13c){const _0x3a3874=await computeSqlFileHash(_0x37b992['filePath']),_0x3e4c5f=_0x51a054[_0x4e986b(0x14b)][_0x37b992[_0x4e986b(0x146)]],_0x55c944=!!_0x3e4c5f&&(_0x3e4c5f['path']!==_0x37b992['relativePath']||!!_0x37b992[_0x4e986b(0x129)]&&_0x3e4c5f[_0x4e986b(0x129)]!==_0x37b992['sqlName']);if(!_0x131abf[_0x4e986b(0x131)]('force')&&_0x3e4c5f&&_0x3e4c5f[_0x4e986b(0x15b)]===_0x3a3874&&!_0x55c944)continue;_0x4d4b86[_0x4e986b(0x123)](_0x37b992[_0x4e986b(0x146)]);}return{'method':_0x4e986b(0x138),'url':_0x4e986b(0x150),'body':{'sqlCodes':_0x4d4b86,'appCode':_0x131abf[_0x4e986b(0x126)]},'description':'Would\x20push\x20'+_0x4d4b86[_0x4e986b(0x12a)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x377cf4){const _0x289db9=a137_0x1e275d,_0x17f0ac=loadSqlProjectConfig(_0x377cf4[_0x289db9(0x126)]),_0x386f04=await readSqlLockFile(_0x17f0ac['lockFilePath']),{lockData:_0x5b8be4,appLock:_0x508e68}=ensureSqlLockScope(_0x386f04??createEmptySqlLock(),_0x377cf4[_0x289db9(0x126)],_0x17f0ac[_0x289db9(0x13c)],_0x289db9(0x123)),_0x56426c=await getTargetSqlQueries(_0x17f0ac,_0x508e68,_0x377cf4[_0x289db9(0x13a)](_0x289db9(0x134))||undefined);if(_0x56426c[_0x289db9(0x12a)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x289db9(0x159)};const _0x55ca82=[],_0x4c9e5a=[],_0x5a14ae=[];for(const _0x487952 of _0x56426c){const _0x250c1d=_0x508e68[_0x289db9(0x14b)][_0x487952[_0x289db9(0x146)]];if(!_0x250c1d){_0x5a14ae['push']({'sqlCode':_0x487952[_0x289db9(0x146)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x2fb946=await computeSqlFileHash(_0x487952['filePath']),_0x158705=_0x250c1d['path']!==_0x487952[_0x289db9(0x155)]||!!_0x487952['sqlName']&&_0x250c1d['sqlName']!==_0x487952[_0x289db9(0x129)];if(!_0x377cf4[_0x289db9(0x131)](_0x289db9(0x152))&&_0x250c1d[_0x289db9(0x15b)]===_0x2fb946&&!_0x158705){_0x4c9e5a[_0x289db9(0x123)]({'sqlCode':_0x487952['sqlCode'],'reason':_0x289db9(0x121)});continue;}if(_0x250c1d['version']==null){_0x5a14ae[_0x289db9(0x123)]({'sqlCode':_0x487952[_0x289db9(0x146)],'error':_0x289db9(0x156)});continue;}const _0x514e26=await readFile(_0x487952[_0x289db9(0x139)],'utf8'),_0x5abeb7=stripLocalSqlMetadata(_0x514e26,_0x487952[_0x289db9(0x148)]),_0x3284d0=_0x487952[_0x289db9(0x129)]||_0x250c1d['sqlName'],_0x109363=await resolveTargetDbBinding(_0x377cf4[_0x289db9(0x126)],_0x487952,_0x250c1d),_0x401c5d=await updateSqlQuery({'id':_0x250c1d[_0x289db9(0x13e)],'appCode':_0x377cf4[_0x289db9(0x126)],'sqlCode':_0x487952['sqlCode'],'sqlName':_0x3284d0,'dbId':_0x109363[_0x289db9(0x127)],'version':_0x250c1d[_0x289db9(0x124)],'sqlContent':_0x5abeb7,'sqlConfig':_0x250c1d[_0x289db9(0x11d)]??undefined}),_0xea510b=_0x401c5d[_0x289db9(0x127)]?await getDbName(_0x377cf4[_0x289db9(0x126)],Number(_0x401c5d['dbId']))['catch'](()=>_0x109363['dbName']):_0x109363[_0x289db9(0x14e)];_0x508e68['sqls'][_0x487952[_0x289db9(0x146)]]={...buildSqlLockEntry(_0x401c5d,_0x5abeb7,_0x2fb946,{'dbName':_0xea510b}),'path':_0x487952[_0x289db9(0x155)],'mode':_0x250c1d[_0x289db9(0x148)]},await archivePreviousSqlFileIfNeeded(_0x17f0ac,_0x250c1d['path'],_0x487952['relativePath']),_0x55ca82[_0x289db9(0x123)]({'sqlCode':_0x487952[_0x289db9(0x146)],'remoteId':_0x250c1d['remoteId']});}catch(_0x3f6e18){_0x5a14ae[_0x289db9(0x123)]({'sqlCode':_0x487952[_0x289db9(0x146)],'error':_0x3f6e18 instanceof Error?_0x3f6e18[_0x289db9(0x142)]:String(_0x3f6e18)});}}return _0x508e68[_0x289db9(0x143)]=new Date()[_0x289db9(0x12b)](),await writeSqlLockFile(_0x17f0ac[_0x289db9(0x120)],_0x5b8be4),{'ok':_0x5a14ae['length']===0x0,'data':{'pushed':_0x55ca82,'skipped':_0x4c9e5a,'failed':_0x5a14ae},'message':_0x289db9(0x144)+_0x55ca82[_0x289db9(0x12a)]+_0x289db9(0x14d)+_0x4c9e5a[_0x289db9(0x12a)]+_0x289db9(0x14f)+_0x5a14ae['length']+_0x289db9(0x133)};}};async function archivePreviousSqlFileIfNeeded(_0x165cb5,_0x28bc5e,_0x1a881a){const _0x564450=a137_0x1e275d;if(!_0x28bc5e||_0x28bc5e===_0x1a881a)return;const _0x42bd81=join(_0x165cb5['sqlRootDir'],_0x28bc5e);if(!await fileExists(_0x42bd81))return;const _0x1704c3=await moveToTrash(_0x165cb5[_0x564450(0x158)],_0x165cb5[_0x564450(0x122)],_0x42bd81);await cleanupEmptyDirectories(dirname(_0x42bd81),_0x165cb5[_0x564450(0x147)]),void _0x1704c3;}async function moveToTrash(_0x2184ea,_0xae2a0e,_0x3fd33d){const _0x3b5ae2=a137_0x1e275d,_0x5b9197=new Date()[_0x3b5ae2(0x12b)]()['replace'](/[:.]/g,'-'),_0x4128e3=relative(_0x2184ea,_0x3fd33d),_0x2418ea=join(_0xae2a0e,_0x5b9197,_0x4128e3);return await mkdir(dirname(_0x2418ea),{'recursive':!![]}),await rename(_0x3fd33d,_0x2418ea),_0x2418ea;}async function cleanupEmptyDirectories(_0x34c4ed,_0x9072d3){const _0x386e76=a137_0x1e275d;let _0xbd766f=resolve(_0x34c4ed);const _0x4a7d12=resolve(_0x9072d3);while(_0xbd766f['startsWith'](''+_0x4a7d12+sep)||_0xbd766f===_0x4a7d12){if(_0xbd766f===_0x4a7d12)return;try{const _0x45e45e=await readdir(_0xbd766f);if(_0x45e45e[_0x386e76(0x12a)]>0x0)return;await rmdir(_0xbd766f);}catch{return;}_0xbd766f=dirname(_0xbd766f);}}async function resolveTargetDbBinding(_0x10418c,_0x2a7aa0,_0x21a9a9){const _0x381697=a137_0x1e275d,_0xab7d26=_0x2a7aa0[_0x381697(0x149)];if(!_0xab7d26)return{'dbId':_0x21a9a9[_0x381697(0x127)],'dbName':_0x21a9a9['dbName']};const _0xb89573=buildDbDirectoryName(_0x21a9a9[_0x381697(0x14e)],_0x21a9a9[_0x381697(0x127)]);if(_0xab7d26===_0xb89573)return{'dbId':_0x21a9a9[_0x381697(0x127)],'dbName':_0x21a9a9[_0x381697(0x14e)]};const _0x4c7aee=parseExplicitDbDirectory(_0xab7d26);if(_0x4c7aee!=null)return{'dbId':_0x4c7aee,'dbName':await getDbName(_0x10418c,_0x4c7aee)['catch'](()=>undefined)};const _0x3da0e8=await listDatabases(_0x10418c),_0x3de22f=_0x3da0e8['filter'](_0x36e049=>buildDbDirectoryName(_0x36e049[_0x381697(0x14e)],_0x36e049[_0x381697(0x127)])===_0xab7d26);if(_0x3de22f[_0x381697(0x12a)]===0x1)return{'dbId':_0x3de22f[0x0][_0x381697(0x127)],'dbName':_0x3de22f[0x0][_0x381697(0x14e)]};if(_0x3de22f[_0x381697(0x12a)]===0x0)throw CliErrors[_0x381697(0x12d)](_0x381697(0x13b)+_0xab7d26+_0x381697(0x141)+_0x2a7aa0[_0x381697(0x146)]+'.');const _0x53d06a=_0x3de22f[_0x381697(0x128)](_0x89e2bc=>_0x89e2bc[_0x381697(0x14e)]+'\x20('+_0x89e2bc['dbId']+')')[_0x381697(0x157)](',\x20');throw CliErrors[_0x381697(0x12d)]('Local\x20directory\x20\x22'+_0xab7d26+_0x381697(0x13f)+_0x2a7aa0[_0x381697(0x146)]+':\x20'+_0x53d06a);}function parseExplicitDbDirectory(_0x579613){const _0x451650=a137_0x1e275d,_0x375bd1=/^db-(\d+)$/[_0x451650(0x153)](_0x579613);if(!_0x375bd1)return null;const _0x4331d7=Number(_0x375bd1[0x1]);return Number['isFinite'](_0x4331d7)&&_0x4331d7>0x0?_0x4331d7:null;}function a137_0x1afd(){const _0x57ff4f=['Local\x20SQL\x20not\x20found:\x20','boolean','91431DJrTUs','sqlConfig','high-risk-write','12156YujucD','lockFilePath','unchanged','trashDir','push','version','56ZKHQic','appCode','dbId','map','sqlName','length','toISOString','267051mKNeNK','validation','get','3131324yLdlUK','406040IqbfHD','bool','filter','\x20failed','sqlcode','path','29736806OOYYEK','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','POST','filePath','str','No\x20database\x20matches\x20local\x20directory\x20\x22','sqlRoot','has','remoteId','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','set','\x22\x20for\x20sqlCode\x20','message','lastSync','Push\x20complete:\x20','23kTPjsZ','sqlCode','sqlRootDir','mode','dbDirectory','Push\x20local\x20SQL\x20files\x20to\x20remote','sqls','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20pushed,\x20','dbName','\x20skipped,\x20','/smartapi/custom/updateUserCustomSql','6KbFvOW','force','exec','1562722mMOTZY','relativePath','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','join','projectRoot','No\x20local\x20SQL\x20files\x20found.','1150JNoXmL','hash'];a137_0x1afd=function(){return _0x57ff4f;};return a137_0x1afd();}
|
|
1
|
+
const a137_0x21b644=a137_0x174a;(function(_0x1734ba,_0x3a7935){const _0x5a41a2=a137_0x174a,_0x10657e=_0x1734ba();while(!![]){try{const _0x397e7e=-parseInt(_0x5a41a2(0x1b4))/0x1*(-parseInt(_0x5a41a2(0x1b2))/0x2)+-parseInt(_0x5a41a2(0x1b7))/0x3+parseInt(_0x5a41a2(0x1c3))/0x4+parseInt(_0x5a41a2(0x195))/0x5+-parseInt(_0x5a41a2(0x1ba))/0x6*(-parseInt(_0x5a41a2(0x1cb))/0x7)+parseInt(_0x5a41a2(0x19a))/0x8*(-parseInt(_0x5a41a2(0x197))/0x9)+parseInt(_0x5a41a2(0x1ce))/0xa*(-parseInt(_0x5a41a2(0x1bb))/0xb);if(_0x397e7e===_0x3a7935)break;else _0x10657e['push'](_0x10657e['shift']());}catch(_0x8a4095){_0x10657e['push'](_0x10657e['shift']());}}}(a137_0x2ef2,0x70172));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a137_0x2ef2(){const _0x484980=['2937AfhEoK','dbId','boolean','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','force','\x20failed','appCode','map','963512byezux','sqlName','\x20SQL\x20file(s)','version','sqlCode','high-risk-write','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlcode','557578QMyxqH','path','set','41030ttYmTW','dbDirectory','entries','trashDir','sqlRoot','sql','filePath','Would\x20push\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','sqls','unchanged','3879375qaQYQy','Local\x20SQL\x20not\x20found:\x20','322821NpRdTn','length','\x22\x20for\x20sqlCode\x20','80pPzXrA','startsWith','filter','push','No\x20local\x20SQL\x20files\x20found.','mode','bool','/smartapi/custom/updateUserCustomSql','message','str','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','Push\x20complete:\x20','lastSync','\x20pushed,\x20','\x20skipped,\x20','sqlConfig','lockFilePath','Push\x20local\x20SQL\x20files\x20to\x20remote','toISOString','sqlRootDir','dbName','relativePath','has','utf8','86356MSRjnh','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','20ciwceB','catch','isFinite','2051658prWZKu','validation','hash','54nWnyjf'];a137_0x2ef2=function(){return _0x484980;};return a137_0x2ef2();}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x2fe429,_0x553535,_0x274113){const _0x16b6a0=a137_0x174a,_0x5d3ade=await scanLocalSqlQueries(_0x2fe429),_0x5d5ede=new Map();for(const _0x19e4bc of _0x5d3ade){if(_0x274113&&_0x19e4bc[_0x16b6a0(0x1c7)]!==_0x274113)continue;const _0x342377=_0x5d5ede['get'](_0x19e4bc['sqlCode'])??[];_0x342377['push'](_0x19e4bc),_0x5d5ede[_0x16b6a0(0x1cd)](_0x19e4bc[_0x16b6a0(0x1c7)],_0x342377);}if(_0x274113&&!_0x5d5ede[_0x16b6a0(0x1b0)](_0x274113))throw CliErrors[_0x16b6a0(0x1b8)](_0x16b6a0(0x196)+_0x274113);const _0x56fe77=[];for(const [_0x3e437b,_0x2bb625]of _0x5d5ede[_0x16b6a0(0x18c)]()){if(_0x2bb625[_0x16b6a0(0x198)]===0x1){_0x56fe77[_0x16b6a0(0x19d)](_0x2bb625[0x0]);continue;}const _0x307285=_0x553535[_0x16b6a0(0x193)][_0x3e437b],_0x105354=_0x307285?.[_0x16b6a0(0x1cc)],_0x131c42=_0x105354?_0x2bb625[_0x16b6a0(0x19c)](_0x25d344=>_0x25d344[_0x16b6a0(0x1af)]!==_0x105354):_0x2bb625;if(_0x307285&&_0x131c42[_0x16b6a0(0x198)]===0x1){_0x56fe77[_0x16b6a0(0x19d)](_0x131c42[0x0]);continue;}throw CliErrors[_0x16b6a0(0x1b8)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x3e437b+_0x16b6a0(0x1b3));}return _0x56fe77;}export const sqlPush={'service':a137_0x21b644(0x18f),'command':a137_0x21b644(0x19d),'description':a137_0x21b644(0x1ab),'risk':a137_0x21b644(0x1c8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a137_0x21b644(0x1bf),'type':a137_0x21b644(0x1bd),'description':a137_0x21b644(0x1c9)}],async 'dryRun'(_0x193aaa){const _0x115627=a137_0x21b644,_0x1e363a=loadSqlProjectConfig(_0x193aaa[_0x115627(0x1c1)]),_0x331065=await readSqlLockFile(_0x1e363a[_0x115627(0x1aa)]),{appLock:_0x6603fd}=ensureSqlLockScope(_0x331065??createEmptySqlLock(),_0x193aaa['appCode'],_0x1e363a['sqlRoot'],'push'),_0x20c5ff=await getTargetSqlQueries(_0x1e363a,_0x6603fd,_0x193aaa[_0x115627(0x1a3)](_0x115627(0x1ca))||undefined),_0x236f8d=[];for(const _0x3d7a99 of _0x20c5ff){const _0x5b0cc8=await computeSqlFileHash(_0x3d7a99[_0x115627(0x190)]),_0x403910=_0x6603fd[_0x115627(0x193)][_0x3d7a99['sqlCode']],_0x15f595=!!_0x403910&&(_0x403910[_0x115627(0x1cc)]!==_0x3d7a99[_0x115627(0x1af)]||!!_0x3d7a99[_0x115627(0x1c4)]&&_0x403910[_0x115627(0x1c4)]!==_0x3d7a99[_0x115627(0x1c4)]);if(!_0x193aaa[_0x115627(0x1a0)]('force')&&_0x403910&&_0x403910['hash']===_0x5b0cc8&&!_0x15f595)continue;_0x236f8d[_0x115627(0x19d)](_0x3d7a99[_0x115627(0x1c7)]);}return{'method':'POST','url':_0x115627(0x1a1),'body':{'sqlCodes':_0x236f8d,'appCode':_0x193aaa[_0x115627(0x1c1)]},'description':_0x115627(0x191)+_0x236f8d[_0x115627(0x198)]+_0x115627(0x1c5)};},async 'execute'(_0x36910a){const _0x1ada4a=a137_0x21b644,_0x8f9f7f=loadSqlProjectConfig(_0x36910a[_0x1ada4a(0x1c1)]),_0x1c1263=await readSqlLockFile(_0x8f9f7f[_0x1ada4a(0x1aa)]),{lockData:_0x93c144,appLock:_0x2b111}=ensureSqlLockScope(_0x1c1263??createEmptySqlLock(),_0x36910a['appCode'],_0x8f9f7f[_0x1ada4a(0x18e)],_0x1ada4a(0x19d)),_0xcc59c2=await getTargetSqlQueries(_0x8f9f7f,_0x2b111,_0x36910a[_0x1ada4a(0x1a3)](_0x1ada4a(0x1ca))||undefined);if(_0xcc59c2[_0x1ada4a(0x198)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x1ada4a(0x19e)};const _0x4643b8=[],_0x2aa9c6=[],_0x3f5835=[];for(const _0x587bdc of _0xcc59c2){const _0x332ab4=_0x2b111[_0x1ada4a(0x193)][_0x587bdc['sqlCode']];if(!_0x332ab4){_0x3f5835[_0x1ada4a(0x19d)]({'sqlCode':_0x587bdc[_0x1ada4a(0x1c7)],'error':_0x1ada4a(0x1be)});continue;}try{const _0x5f4e35=await computeSqlFileHash(_0x587bdc[_0x1ada4a(0x190)]),_0x221306=_0x332ab4['path']!==_0x587bdc[_0x1ada4a(0x1af)]||!!_0x587bdc[_0x1ada4a(0x1c4)]&&_0x332ab4[_0x1ada4a(0x1c4)]!==_0x587bdc[_0x1ada4a(0x1c4)];if(!_0x36910a[_0x1ada4a(0x1a0)](_0x1ada4a(0x1bf))&&_0x332ab4[_0x1ada4a(0x1b9)]===_0x5f4e35&&!_0x221306){_0x2aa9c6[_0x1ada4a(0x19d)]({'sqlCode':_0x587bdc[_0x1ada4a(0x1c7)],'reason':_0x1ada4a(0x194)});continue;}if(_0x332ab4[_0x1ada4a(0x1c6)]==null){_0x3f5835[_0x1ada4a(0x19d)]({'sqlCode':_0x587bdc['sqlCode'],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x4f2a52=await readFile(_0x587bdc[_0x1ada4a(0x190)],_0x1ada4a(0x1b1)),_0x1cd52a=stripLocalSqlMetadata(_0x4f2a52,_0x587bdc[_0x1ada4a(0x19f)]),_0x56852c=_0x587bdc[_0x1ada4a(0x1c4)]||_0x332ab4['sqlName'],_0x1e9c5f=await resolveTargetDbBinding(_0x36910a[_0x1ada4a(0x1c1)],_0x587bdc,_0x332ab4),_0x326f06=await updateSqlQuery({'id':_0x332ab4['remoteId'],'appCode':_0x36910a[_0x1ada4a(0x1c1)],'sqlCode':_0x587bdc[_0x1ada4a(0x1c7)],'sqlName':_0x56852c,'dbId':_0x1e9c5f[_0x1ada4a(0x1bc)],'version':_0x332ab4[_0x1ada4a(0x1c6)],'sqlContent':_0x1cd52a,'sqlConfig':_0x332ab4[_0x1ada4a(0x1a9)]??undefined}),_0x176142=_0x326f06[_0x1ada4a(0x1bc)]?await getDbName(_0x36910a[_0x1ada4a(0x1c1)],Number(_0x326f06[_0x1ada4a(0x1bc)]))[_0x1ada4a(0x1b5)](()=>_0x1e9c5f[_0x1ada4a(0x1ae)]):_0x1e9c5f[_0x1ada4a(0x1ae)];_0x2b111[_0x1ada4a(0x193)][_0x587bdc['sqlCode']]={...buildSqlLockEntry(_0x326f06,_0x1cd52a,_0x5f4e35,{'dbName':_0x176142}),'path':_0x587bdc['relativePath'],'mode':_0x332ab4[_0x1ada4a(0x19f)]},await archivePreviousSqlFileIfNeeded(_0x8f9f7f,_0x332ab4[_0x1ada4a(0x1cc)],_0x587bdc['relativePath']),_0x4643b8[_0x1ada4a(0x19d)]({'sqlCode':_0x587bdc['sqlCode'],'remoteId':_0x332ab4['remoteId']});}catch(_0x3b483a){_0x3f5835['push']({'sqlCode':_0x587bdc[_0x1ada4a(0x1c7)],'error':_0x3b483a instanceof Error?_0x3b483a[_0x1ada4a(0x1a2)]:String(_0x3b483a)});}}return _0x2b111[_0x1ada4a(0x1a6)]=new Date()[_0x1ada4a(0x1ac)](),await writeSqlLockFile(_0x8f9f7f[_0x1ada4a(0x1aa)],_0x93c144),{'ok':_0x3f5835['length']===0x0,'data':{'pushed':_0x4643b8,'skipped':_0x2aa9c6,'failed':_0x3f5835},'message':_0x1ada4a(0x1a5)+_0x4643b8[_0x1ada4a(0x198)]+_0x1ada4a(0x1a7)+_0x2aa9c6['length']+_0x1ada4a(0x1a8)+_0x3f5835[_0x1ada4a(0x198)]+_0x1ada4a(0x1c0)};}};function a137_0x174a(_0x26f7f6,_0x45bdca){_0x26f7f6=_0x26f7f6-0x18c;const _0x2ef245=a137_0x2ef2();let _0x174aad=_0x2ef245[_0x26f7f6];return _0x174aad;}async function archivePreviousSqlFileIfNeeded(_0x43525a,_0x453bfa,_0x514c11){const _0x7feb30=a137_0x21b644;if(!_0x453bfa||_0x453bfa===_0x514c11)return;const _0x561259=join(_0x43525a[_0x7feb30(0x1ad)],_0x453bfa);if(!await fileExists(_0x561259))return;const _0x23e904=await moveToTrash(_0x43525a['projectRoot'],_0x43525a[_0x7feb30(0x18d)],_0x561259);await cleanupEmptyDirectories(dirname(_0x561259),_0x43525a[_0x7feb30(0x1ad)]),void _0x23e904;}async function moveToTrash(_0x2fe335,_0x4afc0a,_0x350436){const _0xece337=a137_0x21b644,_0x396213=new Date()[_0xece337(0x1ac)]()['replace'](/[:.]/g,'-'),_0x4e401b=relative(_0x2fe335,_0x350436),_0x3f9b0f=join(_0x4afc0a,_0x396213,_0x4e401b);return await mkdir(dirname(_0x3f9b0f),{'recursive':!![]}),await rename(_0x350436,_0x3f9b0f),_0x3f9b0f;}async function cleanupEmptyDirectories(_0x27abfb,_0x29f30e){const _0xdb41ae=a137_0x21b644;let _0x4ef1ec=resolve(_0x27abfb);const _0x27b0d5=resolve(_0x29f30e);while(_0x4ef1ec[_0xdb41ae(0x19b)](''+_0x27b0d5+sep)||_0x4ef1ec===_0x27b0d5){if(_0x4ef1ec===_0x27b0d5)return;try{const _0x3333bd=await readdir(_0x4ef1ec);if(_0x3333bd['length']>0x0)return;await rmdir(_0x4ef1ec);}catch{return;}_0x4ef1ec=dirname(_0x4ef1ec);}}async function resolveTargetDbBinding(_0x2fe616,_0x21a234,_0x37ce15){const _0x59edd4=a137_0x21b644,_0x5b26bb=_0x21a234[_0x59edd4(0x1cf)];if(!_0x5b26bb)return{'dbId':_0x37ce15[_0x59edd4(0x1bc)],'dbName':_0x37ce15[_0x59edd4(0x1ae)]};const _0x20ea4b=buildDbDirectoryName(_0x37ce15[_0x59edd4(0x1ae)],_0x37ce15[_0x59edd4(0x1bc)]);if(_0x5b26bb===_0x20ea4b)return{'dbId':_0x37ce15['dbId'],'dbName':_0x37ce15[_0x59edd4(0x1ae)]};const _0x511e00=parseExplicitDbDirectory(_0x5b26bb);if(_0x511e00!=null)return{'dbId':_0x511e00,'dbName':await getDbName(_0x2fe616,_0x511e00)[_0x59edd4(0x1b5)](()=>undefined)};const _0x2ab46f=await listDatabases(_0x2fe616),_0x470388=_0x2ab46f[_0x59edd4(0x19c)](_0x1988b4=>buildDbDirectoryName(_0x1988b4[_0x59edd4(0x1ae)],_0x1988b4['dbId'])===_0x5b26bb);if(_0x470388[_0x59edd4(0x198)]===0x1)return{'dbId':_0x470388[0x0][_0x59edd4(0x1bc)],'dbName':_0x470388[0x0][_0x59edd4(0x1ae)]};if(_0x470388[_0x59edd4(0x198)]===0x0)throw CliErrors[_0x59edd4(0x1b8)](_0x59edd4(0x192)+_0x5b26bb+_0x59edd4(0x199)+_0x21a234['sqlCode']+'.');const _0x5a0aee=_0x470388[_0x59edd4(0x1c2)](_0x522efd=>_0x522efd[_0x59edd4(0x1ae)]+'\x20('+_0x522efd[_0x59edd4(0x1bc)]+')')['join'](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x5b26bb+_0x59edd4(0x1a4)+_0x21a234[_0x59edd4(0x1c7)]+':\x20'+_0x5a0aee);}function parseExplicitDbDirectory(_0xe40fb5){const _0x59ba27=a137_0x21b644,_0x5c20c0=/^db-(\d+)$/['exec'](_0xe40fb5);if(!_0x5c20c0)return null;const _0x2189f0=Number(_0x5c20c0[0x1]);return Number[_0x59ba27(0x1b6)](_0x2189f0)&&_0x2189f0>0x0?_0x2189f0:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a138_0xf73f01=a138_0x1f6e;function a138_0x36de(){const _0x53b425=['join','342150euwKDS','SQL\x20query\x20display\x20name','299415MYUnqV','279320LpzMtH','249988lMaalq','write','881230GijaAd','description','validation','8ouMsct','string','16NRmlsf','file','1411746pLQIUg','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.','sqlname','save','Path\x20to\x20the\x20SQL\x20file','45JgqCWB','Query\x20description','182322fMnPzv'];a138_0x36de=function(){return _0x53b425;};return a138_0x36de();}(function(_0x1826b6,_0x5bb7da){const _0xecd7e5=a138_0x1f6e,_0x17e9c6=_0x1826b6();while(!![]){try{const _0x4ca621=parseInt(_0xecd7e5(0x7f))/0x1+parseInt(_0xecd7e5(0x7e))/0x2+-parseInt(_0xecd7e5(0x7b))/0x3*(parseInt(_0xecd7e5(0x84))/0x4)+parseInt(_0xecd7e5(0x7d))/0x5+parseInt(_0xecd7e5(0x79))/0x6+-parseInt(_0xecd7e5(0x72))/0x7*(-parseInt(_0xecd7e5(0x86))/0x8)+-parseInt(_0xecd7e5(0x77))/0x9*(parseInt(_0xecd7e5(0x81))/0xa);if(_0x4ca621===_0x5bb7da)break;else _0x17e9c6['push'](_0x17e9c6['shift']());}catch(_0x163d63){_0x17e9c6['push'](_0x17e9c6['shift']());}}}(a138_0x36de,0x3461f));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=['`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a138_0xf73f01(0x73)][a138_0xf73f01(0x7a)]('\x0a');function a138_0x1f6e(_0xb9e9af,_0x15c153){_0xb9e9af=_0xb9e9af-0x72;const _0x36de9a=a138_0x36de();let _0x1f6ea3=_0x36de9a[_0xb9e9af];return _0x1f6ea3;}export const sqlSave={'service':'sql','command':a138_0xf73f01(0x75),'description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a138_0xf73f01(0x80),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a138_0xf73f01(0x87),'type':a138_0xf73f01(0x85),'required':!![],'description':a138_0xf73f01(0x76)},SQLCODE_FLAG_OPTIONAL,{'name':a138_0xf73f01(0x74),'type':a138_0xf73f01(0x85),'description':a138_0xf73f01(0x7c)},{'name':'db','type':a138_0xf73f01(0x85),'description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':a138_0xf73f01(0x82),'type':a138_0xf73f01(0x85),'description':a138_0xf73f01(0x78)}],async 'validate'(){const _0x5047f0=a138_0xf73f01;throw CliErrors[_0x5047f0(0x83)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x4b2835=a138_0xf73f01;throw CliErrors[_0x4b2835(0x83)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a139_0x3110e5=a139_0x54bc;(function(_0xacca47,_0x1425ac){const _0x592bb5=a139_0x54bc,_0x467fc=_0xacca47();while(!![]){try{const _0x41c161=parseInt(_0x592bb5(0x8a))/0x1*(-parseInt(_0x592bb5(0x7a))/0x2)+-parseInt(_0x592bb5(0x78))/0x3+-parseInt(_0x592bb5(0x99))/0x4*(parseInt(_0x592bb5(0x72))/0x5)+-parseInt(_0x592bb5(0x79))/0x6*(-parseInt(_0x592bb5(0x85))/0x7)+-parseInt(_0x592bb5(0x77))/0x8+parseInt(_0x592bb5(0x94))/0x9+parseInt(_0x592bb5(0x87))/0xa;if(_0x41c161===_0x1425ac)break;else _0x467fc['push'](_0x467fc['shift']());}catch(_0x416987){_0x467fc['push'](_0x467fc['shift']());}}}(a139_0x1b74,0x87265));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a139_0x1b74(){const _0x4fb6f2=['description','sqlCode','sqlName','length','mybatisXml','mode','test','stdin','2394xzwnQl','entries','9962980vGUfnB','sqlRoot','toLowerCase','168943yymXSY','syncedAt','map','lastSync','sqls','trim','version','split','.rabetbase/sql','<!--\x20@lovrabet.','5163732BUvLmF','endsWith','question','yes','join','2781052SQrIFF','path','filter','\x20-->','trimStart','apps','5XjmfKP','dbId','\x20[y/N]\x20','push','sqlConfig','1135872igRQCF','645438mxhwgL','6558VBDnwu','4LrxNXE','dbName','sqlContent'];a139_0x1b74=function(){return _0x4fb6f2;};return a139_0x1b74();}function a139_0x54bc(_0x3eae08,_0x3ae0db){_0x3eae08=_0x3eae08-0x71;const _0x1b7496=a139_0x1b74();let _0x54bc2e=_0x1b7496[_0x3eae08];return _0x54bc2e;}export const SQL_LOCAL_REL_DIR=a139_0x3110e5(0x92);export function buildSqlLockEntry(_0x342760,_0x36c8c8,_0x2f45f0,_0x488c6f){const _0x2b1d60=a139_0x3110e5,_0x308d4c=detectSqlMode(_0x36c8c8);return{'path':buildSqlRelativePath(_0x342760[_0x2b1d60(0x7e)],_0x342760[_0x2b1d60(0x7f)],_0x488c6f?.[_0x2b1d60(0x7b)],_0x308d4c,_0x342760[_0x2b1d60(0x73)]),'hash':_0x2f45f0,'remoteId':_0x342760['id'],'version':_0x342760[_0x2b1d60(0x90)],'dbId':Number(_0x342760[_0x2b1d60(0x73)]),'dbName':_0x488c6f?.['dbName'],'sqlName':_0x342760[_0x2b1d60(0x7f)],'sqlConfig':_0x342760[_0x2b1d60(0x76)]??undefined,'mode':_0x308d4c};}export function cloneSqlLockData(_0x5cf8d4){const _0x414803=a139_0x3110e5;return{'apps':Object['fromEntries'](Object[_0x414803(0x86)](_0x5cf8d4['apps'])['map'](([_0x24220f,_0x466795])=>[_0x24220f,{'sqlRoot':_0x466795[_0x414803(0x88)],'lastSync':_0x466795[_0x414803(0x8d)],'sqls':{..._0x466795[_0x414803(0x8e)]}}]))};}export function ensureRemoteSqlContent(_0xc8cfe7){const _0x477bbc=a139_0x3110e5;return _0xc8cfe7[_0x477bbc(0x7c)]??'';}export function buildLocalSqlFileContent(_0x4dece4,_0x267317,_0x328a9f){const _0x21f127=a139_0x3110e5,_0x434d24=_0x328a9f?.[_0x21f127(0x82)]??detectSqlMode(_0x267317),_0x330ee6=stripLocalSqlMetadata(_0x267317,_0x434d24)[_0x21f127(0x8f)](),_0x56a82a=[...buildMetadataHeaderLines({'sqlCode':_0x4dece4[_0x21f127(0x7e)],'sqlName':_0x4dece4[_0x21f127(0x7f)],'dbId':_0x4dece4[_0x21f127(0x73)],'dbName':_0x328a9f?.[_0x21f127(0x7b)],'mode':_0x434d24,'syncedAt':_0x328a9f?.[_0x21f127(0x8b)],'description':_0x328a9f?.[_0x21f127(0x7d)]},_0x434d24),'',_0x330ee6],_0x245c0a=_0x56a82a[_0x21f127(0x98)]('\x0a');return _0x245c0a[_0x21f127(0x95)]('\x0a')?_0x245c0a:_0x245c0a+'\x0a';}export function stripLocalSqlMetadata(_0x3ed0fd,_0x5ab067){const _0x2f5ad0=a139_0x3110e5,_0xa7bd00=_0x3ed0fd['replace'](/\r\n/g,'\x0a')[_0x2f5ad0(0x91)]('\x0a'),_0x5032d4=[];let _0xc377e3=0x0;if(_0x5ab067===_0x2f5ad0(0x81))while(_0xc377e3<_0xa7bd00[_0x2f5ad0(0x80)]){const _0x32ce64=_0xa7bd00[_0xc377e3]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x32ce64)){_0xc377e3++;continue;}if(_0x32ce64[_0x2f5ad0(0x8f)]()===''&&_0xc377e3>0x0){_0xc377e3++;continue;}break;}else while(_0xc377e3<_0xa7bd00[_0x2f5ad0(0x80)]){const _0x535fe7=_0xa7bd00[_0xc377e3]??'';if(/^\s*--\s*@lovrabet\./[_0x2f5ad0(0x83)](_0x535fe7)){_0xc377e3++;continue;}if(_0x535fe7['trim']()===''&&_0xc377e3>0x0){_0xc377e3++;continue;}break;}for(;_0xc377e3<_0xa7bd00[_0x2f5ad0(0x80)];_0xc377e3++){_0x5032d4[_0x2f5ad0(0x75)](_0xa7bd00[_0xc377e3]);}return _0x5032d4[_0x2f5ad0(0x98)]('\x0a')[_0x2f5ad0(0x9d)]();}export function resolveSqlMode(_0x4fdd19,_0x49e0c8){const _0x3fb09f=a139_0x3110e5;if(_0x49e0c8?.[_0x3fb09f(0x82)])return _0x49e0c8[_0x3fb09f(0x82)];return detectSqlMode(_0x4fdd19);}export function resolveSqlFileName(_0x5dc62f,_0x4ae949,_0x10ba1f){const _0x101395=a139_0x3110e5;if(_0x10ba1f?.[_0x101395(0x9a)])return _0x10ba1f['path'];if(_0x10ba1f?.[_0x101395(0x7f)]||_0x10ba1f?.['dbName'])return buildSqlRelativePath(_0x5dc62f,_0x10ba1f?.[_0x101395(0x7f)],_0x10ba1f?.[_0x101395(0x7b)],resolveSqlMode(_0x4ae949,_0x10ba1f),_0x10ba1f?.['dbId']);return buildDefaultSqlFileName(_0x5dc62f,resolveSqlMode(_0x4ae949,_0x10ba1f));}export function resolveSqlLocalDir(_0x8e1b2f,_0x51f30a){return join(_0x8e1b2f,SQL_LOCAL_REL_DIR,_0x51f30a);}export async function confirmForceOverwrite(_0x129482){const _0x1807a5=a139_0x3110e5,_0x3aeb0c=createInterface({'input':process[_0x1807a5(0x84)],'output':process['stderr']}),_0x3ea44f=await new Promise(_0x159a8e=>{const _0x4bcdd7=_0x1807a5;_0x3aeb0c[_0x4bcdd7(0x96)](_0x129482+_0x4bcdd7(0x74),_0x159a8e);});return _0x3aeb0c['close'](),['y',_0x1807a5(0x97)]['includes'](_0x3ea44f[_0x1807a5(0x8f)]()[_0x1807a5(0x89)]());}export function findSqlLockScope(_0x26372f,_0x1de298){const _0x12673a=a139_0x3110e5;return _0x26372f[_0x12673a(0x71)][_0x1de298];}function buildMetadataHeaderLines(_0x2e6ccc,_0x3b138c){const _0x1b5699=a139_0x3110e5,_0x4b4a1a=[[_0x1b5699(0x7e),_0x2e6ccc['sqlCode']],[_0x1b5699(0x7f),_0x2e6ccc[_0x1b5699(0x7f)]],[_0x1b5699(0x73),_0x2e6ccc[_0x1b5699(0x73)]],[_0x1b5699(0x7b),_0x2e6ccc[_0x1b5699(0x7b)]],[_0x1b5699(0x82),_0x2e6ccc[_0x1b5699(0x82)]],[_0x1b5699(0x8b),_0x2e6ccc[_0x1b5699(0x8b)]],[_0x1b5699(0x7d),_0x2e6ccc['description']]];if(_0x3b138c==='mybatisXml')return _0x4b4a1a[_0x1b5699(0x9b)](([,_0x1b1ce2])=>_0x1b1ce2!==undefined&&_0x1b1ce2!==null&&String(_0x1b1ce2)[_0x1b5699(0x8f)]()!=='')[_0x1b5699(0x8c)](([_0x15583c,_0x15e4b4])=>_0x1b5699(0x93)+_0x15583c+':\x20'+String(_0x15e4b4)+_0x1b5699(0x9c));return _0x4b4a1a[_0x1b5699(0x9b)](([,_0x1dc75e])=>_0x1dc75e!==undefined&&_0x1dc75e!==null&&String(_0x1dc75e)[_0x1b5699(0x8f)]()!=='')[_0x1b5699(0x8c)](([_0x1a5478,_0xa9e10b])=>'--\x20@lovrabet.'+_0x1a5478+':\x20'+String(_0xa9e10b));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a140_0x1a4052=a140_0x2a15;(function(_0x172453,_0x407c0e){const _0x4be5e0=a140_0x2a15,_0x481d2f=_0x172453();while(!![]){try{const _0x15b4f3=-parseInt(_0x4be5e0(0xab))/0x1*(parseInt(_0x4be5e0(0xbd))/0x2)+parseInt(_0x4be5e0(0xc0))/0x3*(-parseInt(_0x4be5e0(0xa9))/0x4)+-parseInt(_0x4be5e0(0xbe))/0x5*(parseInt(_0x4be5e0(0xb5))/0x6)+-parseInt(_0x4be5e0(0xa1))/0x7+parseInt(_0x4be5e0(0xb2))/0x8+-parseInt(_0x4be5e0(0xb4))/0x9*(-parseInt(_0x4be5e0(0xc2))/0xa)+parseInt(_0x4be5e0(0xb8))/0xb;if(_0x15b4f3===_0x407c0e)break;else _0x481d2f['push'](_0x481d2f['shift']());}catch(_0x4b40e1){_0x481d2f['push'](_0x481d2f['shift']());}}}(a140_0x6e8e,0xea07d));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a140_0x6e8e(){const _0xbbfd91=['225RVjQCE','2748YfwEWc','appCode','tableData','21199695CCtqpu','filePath','hash','sqls','sqlRoot','156556dawDxe','16535eDSIAt','totalCount','21TCOkuo','push','539590JPYSWv','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','keys','\x20missing,\x20','\x20added,\x20','6677573EMZcAH','status','paging','lockFilePath','lockKey','All\x20SQL\x20queries\x20are\x20in\x20sync.','sqlName','\x20unchanged','186968kdvTMt','sql','14GBtlQw','remote','has','length','relativePath','path','bool','12592000RoBawI','read'];a140_0x6e8e=function(){return _0xbbfd91;};return a140_0x6e8e();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a140_0x2a15(_0x2c4306,_0x5ee943){_0x2c4306=_0x2c4306-0x9d;const _0x6e8e4b=a140_0x6e8e();let _0x2a151f=_0x6e8e4b[_0x2c4306];return _0x2a151f;}async function fetchAllSqlCodes(_0x173690){const _0x1c384d=a140_0x2a15,_0x569748=[];let _0x22cbe9=0x1;while(!![]){const _0x810938=await listSqlQueries(_0x173690,{'currentPage':_0x22cbe9,'pageSize':PAGE_SIZE}),_0xc6d8ca=_0x810938[_0x1c384d(0xb7)]??[];_0x569748[_0x1c384d(0xc1)](..._0xc6d8ca['map'](_0x4a5a44=>_0x4a5a44['sqlCode']));if(_0xc6d8ca[_0x1c384d(0xae)]===0x0)break;const _0x41d2d1=_0x810938[_0x1c384d(0xa3)]?.[_0x1c384d(0xbf)];if(_0x41d2d1!=null?_0x569748[_0x1c384d(0xae)]>=_0x41d2d1:_0xc6d8ca[_0x1c384d(0xae)]<PAGE_SIZE)break;_0x22cbe9++;}return _0x569748;}export const sqlStatus={'service':a140_0x1a4052(0xaa),'command':a140_0x1a4052(0xa2),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a140_0x1a4052(0xb3),'flags':[{'name':a140_0x1a4052(0xac),'type':'boolean','description':a140_0x1a4052(0x9d)}],async 'execute'(_0x3ebea2){const _0x2ffc3b=a140_0x1a4052,_0xdfd0f3=loadSqlProjectConfig(_0x3ebea2[_0x2ffc3b(0xb6)]),_0x3e1f4c=await readSqlLockFile(_0xdfd0f3[_0x2ffc3b(0xa4)]),{appLock:_0x283d8b}=ensureSqlLockScope(_0x3e1f4c??createEmptySqlLock(),_0xdfd0f3[_0x2ffc3b(0xb6)],_0xdfd0f3[_0x2ffc3b(0xbc)],_0x2ffc3b(0xa2)),_0xaf4cd5=await scanLocalSqlQueries(_0xdfd0f3),_0x4ac0a0=[],_0x58a9af=[],_0x30962b=[],_0x34684e=[],_0x46b275=new Set(_0xaf4cd5['map'](_0x5e93f1=>_0x5e93f1[_0x2ffc3b(0xa5)]));for(const _0x3d3843 of _0xaf4cd5){const _0x445754=await computeSqlFileHash(_0x3d3843[_0x2ffc3b(0xb9)]),_0x470df7=_0x283d8b[_0x2ffc3b(0xbb)][_0x3d3843[_0x2ffc3b(0xa5)]],_0x494020=!!_0x470df7&&_0x470df7[_0x2ffc3b(0xb0)]!==_0x3d3843[_0x2ffc3b(0xaf)],_0x4d38f2=!!_0x470df7&&!!_0x3d3843['sqlName']&&_0x470df7[_0x2ffc3b(0xa7)]!==_0x3d3843['sqlName'];if(!_0x470df7)_0x4ac0a0[_0x2ffc3b(0xc1)](_0x3d3843['lockKey']);else _0x470df7[_0x2ffc3b(0xba)]!==_0x445754||_0x494020||_0x4d38f2?_0x58a9af['push'](_0x3d3843[_0x2ffc3b(0xa5)]):_0x30962b[_0x2ffc3b(0xc1)](_0x3d3843['lockKey']);}for(const _0x325364 of Object[_0x2ffc3b(0x9e)](_0x283d8b[_0x2ffc3b(0xbb)])){!_0x46b275[_0x2ffc3b(0xad)](_0x325364)&&_0x34684e[_0x2ffc3b(0xc1)](_0x325364);}const _0x39bde8=[];if(_0x3ebea2[_0x2ffc3b(0xb1)](_0x2ffc3b(0xac))){const _0x512514=await fetchAllSqlCodes(_0x3ebea2[_0x2ffc3b(0xb6)]);for(const _0xaa671c of _0x512514){!_0x46b275[_0x2ffc3b(0xad)](_0xaa671c)&&!_0x283d8b[_0x2ffc3b(0xbb)][_0xaa671c]&&_0x39bde8['push'](_0xaa671c);}}const _0x522430=_0x4ac0a0[_0x2ffc3b(0xae)]===0x0&&_0x58a9af[_0x2ffc3b(0xae)]===0x0&&_0x34684e[_0x2ffc3b(0xae)]===0x0&&_0x39bde8[_0x2ffc3b(0xae)]===0x0;return{'ok':!![],'data':{'added':_0x4ac0a0,'modified':_0x58a9af,'missing':_0x34684e,'unchanged':_0x30962b,'remoteOnly':_0x39bde8},'message':_0x522430?_0x2ffc3b(0xa6):_0x4ac0a0[_0x2ffc3b(0xae)]+_0x2ffc3b(0xa0)+_0x58a9af[_0x2ffc3b(0xae)]+'\x20modified,\x20'+_0x34684e[_0x2ffc3b(0xae)]+_0x2ffc3b(0x9f)+_0x30962b['length']+_0x2ffc3b(0xa8)+(_0x39bde8[_0x2ffc3b(0xae)]>0x0?',\x20'+_0x39bde8['length']+'\x20remote-only':'')};}};
|