@lovrabet/rabetbase-cli 2.3.12-beta.1 → 2.3.13-beta.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/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.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/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -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/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.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/file/index.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/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.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/mutations.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/notification/config-list.js +1 -1
- package/lib/commands/notification/index.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/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.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/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.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/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.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-index-auditor.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/error-output.js +1 -1
- package/lib/framework/explicit-yes.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
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x3e24ef=a164_0x8146;(function(_0x349284,_0x34c8e0){const _0x317f74=a164_0x8146,_0x2f3fde=_0x349284();while(!![]){try{const _0x175b23=-parseInt(_0x317f74(0xbe))/0x1+-parseInt(_0x317f74(0xb2))/0x2+-parseInt(_0x317f74(0xa8))/0x3+-parseInt(_0x317f74(0x9a))/0x4*(parseInt(_0x317f74(0xa5))/0x5)+-parseInt(_0x317f74(0x9c))/0x6*(parseInt(_0x317f74(0x8f))/0x7)+parseInt(_0x317f74(0x99))/0x8*(-parseInt(_0x317f74(0xc7))/0x9)+parseInt(_0x317f74(0xbf))/0xa*(parseInt(_0x317f74(0xca))/0xb);if(_0x175b23===_0x34c8e0)break;else _0x2f3fde['push'](_0x2f3fde['shift']());}catch(_0x3c3c35){_0x2f3fde['push'](_0x2f3fde['shift']());}}}(a164_0xa78c,0xc8b8f));import{readFileSync,existsSync}from'node:fs';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([a164_0x3e24ef(0x94),a164_0x3e24ef(0x9d)]);function readPackageScripts(_0x3b1494){const _0x3ec3d5=a164_0x3e24ef,_0x47e9ac=resolve(_0x3b1494,_0x3ec3d5(0xc5));if(!existsSync(_0x47e9ac))return null;try{const _0x169cc8=JSON['parse'](readFileSync(_0x47e9ac,_0x3ec3d5(0xb1)));return _0x169cc8[_0x3ec3d5(0x97)]??{};}catch{return null;}}function a164_0x8146(_0x583ea5,_0x28e001){_0x583ea5=_0x583ea5-0x8c;const _0xa78c9e=a164_0xa78c();let _0x814672=_0xa78c9e[_0x583ea5];return _0x814672;}function detectPackageManager(_0x361c33){const _0x2e0730=a164_0x3e24ef;if(existsSync(resolve(_0x361c33,_0x2e0730(0x95)))||existsSync(resolve(_0x361c33,_0x2e0730(0xb8))))return _0x2e0730(0xc2);if(existsSync(resolve(_0x361c33,_0x2e0730(0x96))))return _0x2e0730(0x8e);if(existsSync(resolve(_0x361c33,'yarn.lock')))return'yarn';return _0x2e0730(0xc9);}async function versionCheck(_0x2494ea){const _0x57e4b5=a164_0x3e24ef,_0x530258=await checkCliVersion();(_0x530258[_0x57e4b5(0xb7)]||_0x530258[_0x57e4b5(0xb6)])&&(printCliUpgradeWarning(_0x530258),assertCliVersionSupported(_0x530258));const _0x3ac32d=await checkSdkVersion(_0x2494ea);if(_0x3ac32d['needsUpgrade'])printSdkUpgradeWarning(_0x3ac32d);}function spawnScript(_0x3d08ac,_0x30da5e,_0xed3c53,_0x26f40e){return new Promise((_0x5ac411,_0x7fbdc8)=>{const _0x9b0bb9=a164_0x8146,_0xbd4fb7=[_0x9b0bb9(0xa7),_0x30da5e,..._0xed3c53],_0x130be0=spawn(_0x3d08ac,_0xbd4fb7,{'cwd':_0x26f40e,'stdio':_0x9b0bb9(0xc4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x26f40e,_0x9b0bb9(0xc6),_0x9b0bb9(0x8c))+delimiter+process.env.PATH}});_0x130be0['on'](_0x9b0bb9(0xc8),_0x956290=>{const _0x543163=_0x9b0bb9;if(_0x956290===0x0||_0x956290===null)_0x5ac411();else _0x7fbdc8(new Error(_0x3d08ac+_0x543163(0xa1)+_0x30da5e+_0x543163(0xbd)+_0x956290));}),_0x130be0['on']('error',_0x7fbdc8);});}function spawnViteBuildWatch(_0x35c09f){return new Promise((_0x14f520,_0xa61ef9)=>{const _0x7b873=a164_0x8146,_0x485a5f=spawn('vite',['build',_0x7b873(0xab)],{'cwd':_0x35c09f,'stdio':_0x7b873(0xc4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x35c09f,_0x7b873(0xc6),_0x7b873(0x8c))+delimiter+process.env.PATH}});_0x485a5f['on']('close',_0x2970d8=>{const _0x3e9df3=_0x7b873;if(_0x2970d8===0x0||_0x2970d8===null)_0x14f520();else _0xa61ef9(new Error(_0x3e9df3(0x9e)+_0x2970d8));}),_0x485a5f['on'](_0x7b873(0x8d),_0xa61ef9);});}function a164_0xa78c(){const _0x457be9=['9zpxHCD','close','npm','627GhdTAO','args','.bin','error','pnpm','389109pPQPXW','vite\x20preview\x20exited\x20with\x20code\x20','join','keys','has','start','bun.lockb','pnpm-lock.yaml','scripts','\x22\x20not\x20found\x20in\x20package.json.','4440496JmyewD','251108UtwIEP','validation','78ZKIhEP','dev','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20\x20\x20\x20','\x20run\x20preview','\x20run\x20','No\x20package.json\x20found\x20in\x20current\x20directory.','Script\x20\x22','preview','115JNkezE','push','run','1107168XlWPrC','\x20run\x20build','all','--watch','cwd','(none)','No\x20scripts\x20defined\x20in\x20package.json.','vite','log','utf-8','2219308YMJbXQ','bool','Available:\x20','watch','belowMinimum','needsUpgrade','bun.lock','\x20\x20EXAMPLES','Enable\x20watch\x20mode\x20for\x20preview','boolean','length','\x20exited\x20with\x20code\x20','814196KBbkfV','1023970lQpfrQ','\x20run\x20<script>\x0a','\x20run\x20start','bun','Run\x20a\x20package.json\x20script','inherit','package.json','node_modules'];a164_0xa78c=function(){return _0x457be9;};return a164_0xa78c();}function spawnVitePreview(_0x568709){return new Promise((_0x3b0834,_0x3f6469)=>{const _0xf67b75=a164_0x8146,_0xe43ac4=spawn(_0xf67b75(0xaf),[_0xf67b75(0xa4)],{'cwd':_0x568709,'stdio':_0xf67b75(0xc4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x568709,_0xf67b75(0xc6),_0xf67b75(0x8c))+delimiter+process.env.PATH}});_0xe43ac4['on'](_0xf67b75(0xc8),_0x543b9a=>{const _0x4ac8d7=_0xf67b75;if(_0x543b9a===0x0||_0x543b9a===null)_0x3b0834();else _0x3f6469(new Error(_0x4ac8d7(0x90)+_0x543b9a));}),_0xe43ac4['on'](_0xf67b75(0x8d),_0x3f6469);});}const runFlags=[{'name':'watch','type':a164_0x3e24ef(0xbb),'description':a164_0x3e24ef(0xba),'default':![]}];export const runDefinition={'service':a164_0x3e24ef(0xa7),'command':a164_0x3e24ef(0xa7),'description':a164_0x3e24ef(0xc3),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x588f4a=a164_0x3e24ef,_0x33dbb3=[];return _0x33dbb3['push'](_0x588f4a(0xb9)),_0x33dbb3[_0x588f4a(0xa6)](_0x588f4a(0x9f)+CLI_BIN_NAME+_0x588f4a(0xc1)),_0x33dbb3[_0x588f4a(0xa6)](_0x588f4a(0x9f)+CLI_BIN_NAME+_0x588f4a(0xa9)),_0x33dbb3['push'](_0x588f4a(0x9f)+CLI_BIN_NAME+_0x588f4a(0xa0)),_0x33dbb3[_0x588f4a(0xa6)](_0x588f4a(0x9f)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x33dbb3[_0x588f4a(0x91)]('\x0a');},async 'execute'(_0x243974){const _0x305169=a164_0x3e24ef,_0x5808ce=process[_0x305169(0xac)](),_0x4f6ae0=_0x243974[_0x305169(0xcb)][0x0],_0x29f845=_0x243974[_0x305169(0xcb)]['slice'](0x1),_0x2dcd6d=readPackageScripts(_0x5808ce);if(!_0x2dcd6d)throw CliErrors['validation'](_0x305169(0xa2));if(!_0x4f6ae0){const _0x1cbcfc=Object[_0x305169(0x92)](_0x2dcd6d);if(_0x1cbcfc[_0x305169(0xbc)]===0x0)console[_0x305169(0xb0)](_0x305169(0xae));else{console[_0x305169(0xb0)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x503c94 of _0x1cbcfc){console['log'](_0x305169(0x9f)+_0x503c94);}console[_0x305169(0xb0)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x305169(0xc0));}return{'ok':!![]};}if(!_0x2dcd6d[_0x4f6ae0])throw CliErrors[_0x305169(0x9b)](_0x305169(0xa3)+_0x4f6ae0+_0x305169(0x98),_0x305169(0xb4)+(Object['keys'](_0x2dcd6d)[_0x305169(0x91)](',\x20')||_0x305169(0xad)));const _0x8e3403=detectPackageManager(_0x5808ce);VERSION_CHECK_SCRIPTS[_0x305169(0x93)](_0x4f6ae0)&&await versionCheck(_0x5808ce);if(_0x4f6ae0===_0x305169(0xa4)&&_0x243974[_0x305169(0xb3)](_0x305169(0xb5)))return await Promise[_0x305169(0xaa)]([spawnViteBuildWatch(_0x5808ce),spawnVitePreview(_0x5808ce)]),{'ok':!![]};return await spawnScript(_0x8e3403,_0x4f6ae0,_0x29f845,_0x5808ce),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a165_0x36eaf0=a165_0x5462;(function(_0x71699e,_0x55560d){const _0x24b80e=a165_0x5462,_0x575913=_0x71699e();while(!![]){try{const _0x13806f=parseInt(_0x24b80e(0x1bd))/0x1+-parseInt(_0x24b80e(0x1bb))/0x2+parseInt(_0x24b80e(0x1c3))/0x3+-parseInt(_0x24b80e(0x1b9))/0x4*(-parseInt(_0x24b80e(0x1c5))/0x5)+parseInt(_0x24b80e(0x1c6))/0x6*(-parseInt(_0x24b80e(0x1c4))/0x7)+-parseInt(_0x24b80e(0x1bc))/0x8+parseInt(_0x24b80e(0x1bf))/0x9*(-parseInt(_0x24b80e(0x1c0))/0xa);if(_0x13806f===_0x55560d)break;else _0x575913['push'](_0x575913['shift']());}catch(_0x28f361){_0x575913['push'](_0x575913['shift']());}}}(a165_0x5f17,0x5c14a));function a165_0x5462(_0x656a8,_0x2c8acc){_0x656a8=_0x656a8-0x1b9;const _0x5f17e6=a165_0x5f17();let _0x546264=_0x5f17e6[_0x656a8];return _0x546264;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x8616d2){const _0x4f4383=await buildSchemaPayload();return{'ok':!![],'data':_0x4f4383};}export const schemaDefinition={'service':a165_0x36eaf0(0x1c2),'command':a165_0x36eaf0(0x1c1),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a165_0x36eaf0(0x1be),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a165_0x36eaf0(0x1ba),'flags':[],'execute':execute};function a165_0x5f17(){const _0x1f1cd9=['844462XhUfWQ','136304xpyZYK','331890mOQKAv','read','9fySJVx','3102640WIOKwp','export','schema','1237341azeWnF','196ImGWcs','742310fHfZNL','13506FDquNt','12oejScJ','json'];a165_0x5f17=function(){return _0x1f1cd9;};return a165_0x5f17();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a166_0x23d486=a166_0x4105;(function(_0x455a02,_0x446fc8){const _0x36a101=a166_0x4105,_0x3b47ee=_0x455a02();while(!![]){try{const _0x2cc04d=parseInt(_0x36a101(0x1fb))/0x1+-parseInt(_0x36a101(0x1e9))/0x2+-parseInt(_0x36a101(0x1f7))/0x3+parseInt(_0x36a101(0x1fa))/0x4*(parseInt(_0x36a101(0x211))/0x5)+-parseInt(_0x36a101(0x1e7))/0x6+-parseInt(_0x36a101(0x1e1))/0x7+-parseInt(_0x36a101(0x204))/0x8*(-parseInt(_0x36a101(0x1de))/0x9);if(_0x2cc04d===_0x446fc8)break;else _0x3b47ee['push'](_0x3b47ee['shift']());}catch(_0x27f1f0){_0x3b47ee['push'](_0x3b47ee['shift']());}}}(a166_0x2a7e,0x71ab2));import{writeFile}from'node:fs/promises';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';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 a166_0x2a7e(){const _0x41ea6a=['--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','trim','SQL\x20query\x20display\x20name','dbName','Invalid\x20database\x20selection\x20payload:\x20','24718743DzdKYm','description','请选择本地\x20SQL\x20模式:','3650780gYqFVl','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','appCode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20不能为空','number','5137662TdDrPT','sqlRoot','1720700rbmHns','mode','validation','catch','str','POST','flag','isFinite','new','SQL\x20名称不能为空','/smartapi/custom/saveUserCustomSql','sql','sqlRootDir','isInteger','2132379LecfPW','flagMissing','</select>','4viZeVs','505557hcEcir','db-id','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','sqls','适合带动态标签的\x20MyBatis\x20XML\x20SQL','lastSync','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','length','MyBatis\x20XML(mybatisXml)','8SdioTY','utf8','__manual__','name','sqlCode','Target\x20database\x20ID','stringify','请输入\x20SQL\x20名称:','\x20\x20SELECT\x201\x20AS\x20id','string','Created\x20SQL\x20query\x20','请输入目标数据库\x20dbId:','lockFilePath','812310OtQQvb','mybatisXml','join','nonInteractive','sqlName','SELECT\x201\x20AS\x20id;','<server-generated-sqlCode>','toISOString','dbId'];a166_0x2a7e=function(){return _0x41ea6a;};return a166_0x2a7e();}function a166_0x4105(_0x12eef2,_0x306d00){_0x12eef2=_0x12eef2-0x1db;const _0x2a7e61=a166_0x2a7e();let _0x410524=_0x2a7e61[_0x12eef2];return _0x410524;}function generateSqlTemplate(_0x48d132){const _0x4d8331=a166_0x4105;if(_0x48d132===_0x4d8331(0x212))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x4d8331(0x20c),_0x4d8331(0x1f9),'']['join']('\x0a');return[_0x4d8331(0x216),''][_0x4d8331(0x213)]('\x0a');}export const sqlCreate={'service':'sql','command':'create','description':a166_0x23d486(0x1e2),'risk':'high-risk-write','flags':[{'name':a166_0x23d486(0x207),'type':a166_0x23d486(0x20d),'description':a166_0x23d486(0x1db)},{'name':a166_0x23d486(0x1fc),'type':a166_0x23d486(0x1e6),'description':a166_0x23d486(0x209)},{'name':a166_0x23d486(0x1ea),'type':a166_0x23d486(0x20d),'enum':[a166_0x23d486(0x1f4),a166_0x23d486(0x212)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x5d9e8d){const _0x13023c=a166_0x23d486;if(!_0x5d9e8d[_0x13023c(0x214)])return;if(!_0x5d9e8d['str'](_0x13023c(0x207))[_0x13023c(0x21b)]())throw CliErrors['flagMissing']('name',_0x13023c(0x201));const _0x27bcee=resolveProvidedDbId(_0x5d9e8d);if(typeof _0x27bcee!=='number'||!Number[_0x13023c(0x1f0)](_0x27bcee)||_0x27bcee<=0x0)throw CliErrors[_0x13023c(0x1f8)](_0x13023c(0x1fc),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x5d9e8d[_0x13023c(0x1ed)](_0x13023c(0x1ea))[_0x13023c(0x21b)]())throw CliErrors[_0x13023c(0x1f8)](_0x13023c(0x1ea),_0x13023c(0x1e4));},async 'dryRun'(_0x40d2bc){const _0x3fc550=a166_0x23d486,_0x171b29=loadSqlProjectConfig(_0x40d2bc[_0x3fc550(0x1e3)]),{sqlName:_0x1790e4,dbId:_0x45bd5f,dbName:_0x2037b6,mode:_0x350728}=await resolveSqlNewInputs(_0x40d2bc),_0x54ae31=buildSqlRelativePath(_0x3fc550(0x217),_0x1790e4,_0x2037b6,_0x350728,_0x45bd5f),_0x1c05a5=_0x171b29[_0x3fc550(0x1f5)]+'/'+_0x54ae31;return{'method':_0x3fc550(0x1ee),'url':_0x3fc550(0x1f3),'body':{'appCode':_0x40d2bc[_0x3fc550(0x1e3)],'sqlName':_0x1790e4,'dbId':_0x45bd5f,'mode':_0x350728,'localPath':_0x1c05a5},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x171b29[_0x3fc550(0x1f5)]};},async 'execute'(_0x41c191){const _0x4a3dff=a166_0x23d486,_0x2e7bac=loadSqlProjectConfig(_0x41c191[_0x4a3dff(0x1e3)]),{sqlName:_0xf571a7,dbId:_0x76761f,dbName:_0x3b5acf,mode:_0x24f56e}=await resolveSqlNewInputs(_0x41c191),_0x1a9d25=generateSqlTemplate(_0x24f56e),_0x4a64ea=await createSqlQuery({'appCode':_0x41c191[_0x4a3dff(0x1e3)],'sqlName':_0xf571a7,'dbId':_0x76761f,'sqlContent':_0x1a9d25}),_0x424d8d=ensureRemoteSqlContent(_0x4a64ea),_0x330ed4=_0x3b5acf||await getDbName(_0x41c191[_0x4a3dff(0x1e3)],_0x76761f)[_0x4a3dff(0x1ec)](()=>undefined),_0x5cf504=buildSqlRelativePath(_0x4a64ea[_0x4a3dff(0x208)],_0x4a64ea['sqlName'],_0x330ed4,_0x24f56e,_0x76761f),_0x1f741e=_0x2e7bac[_0x4a3dff(0x1f5)]+'/'+_0x5cf504,_0x1f4a36=buildLocalSqlFileContent({'sqlCode':_0x4a64ea[_0x4a3dff(0x208)],'sqlName':_0x4a64ea[_0x4a3dff(0x215)],'dbId':_0x4a64ea[_0x4a3dff(0x219)]},_0x424d8d,{'dbName':_0x330ed4,'mode':_0x24f56e,'syncedAt':new Date()[_0x4a3dff(0x218)](),'description':_0x4a64ea[_0x4a3dff(0x1df)]});if(await fileExists(_0x1f741e))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x1f741e);await ensureParentDirectory(_0x1f741e),await writeFile(_0x1f741e,_0x1f4a36,_0x4a3dff(0x205));const _0x1ad186=await readSqlLockFile(_0x2e7bac['lockFilePath']),{lockData:_0x580d22,appLock:_0x126099}=ensureSqlLockScope(_0x1ad186??createEmptySqlLock(),_0x2e7bac[_0x4a3dff(0x1e3)],_0x2e7bac[_0x4a3dff(0x1e8)],_0x4a3dff(0x1f1));return _0x126099[_0x4a3dff(0x1fe)][_0x4a64ea['sqlCode']]={...buildSqlLockEntry(_0x4a64ea,_0x424d8d,computeSqlContentHash(_0x1f4a36),{'dbName':_0x330ed4}),'path':_0x5cf504,'mode':_0x24f56e},_0x126099[_0x4a3dff(0x200)]=new Date()[_0x4a3dff(0x218)](),await writeSqlLockFile(_0x2e7bac[_0x4a3dff(0x210)],_0x580d22),{'ok':!![],'data':{'id':_0x4a64ea['id'],'sqlCode':_0x4a64ea[_0x4a3dff(0x208)],'sqlName':_0x4a64ea['sqlName'],'dbId':_0x4a64ea['dbId'],'path':_0x1f741e,'mode':_0x24f56e},'message':_0x4a3dff(0x20e)+_0x4a64ea[_0x4a3dff(0x208)]};}};async function resolveSqlNewInputs(_0x4645c2){const _0x57f053=await resolveSqlNameInput(_0x4645c2),{dbId:_0xf4f642,dbName:_0x36f70f}=await resolveDbSelection(_0x4645c2),_0x16a97a=await resolveSqlModeInput(_0x4645c2);return{'sqlName':_0x57f053,'dbId':_0xf4f642,'dbName':_0x36f70f,'mode':_0x16a97a};}async function resolveSqlNameInput(_0x436ab0){const _0x4908c8=a166_0x23d486,_0x2fdda1=_0x436ab0[_0x4908c8(0x1ed)](_0x4908c8(0x207))[_0x4908c8(0x21b)]();if(_0x2fdda1)return _0x2fdda1;if(_0x436ab0['nonInteractive'])throw CliErrors[_0x4908c8(0x1f8)]('name',_0x4908c8(0x201));return(await input({'message':_0x4908c8(0x20b),'validate':_0x3d97a0=>_0x3d97a0[_0x4908c8(0x21b)]()?!![]:_0x4908c8(0x1f2)}))[_0x4908c8(0x21b)]();}async function resolveDbSelection(_0xb01376){const _0x52c07c=a166_0x23d486,_0x247bc7=resolveProvidedDbId(_0xb01376);if(typeof _0x247bc7===_0x52c07c(0x1e6)&&Number[_0x52c07c(0x1f0)](_0x247bc7)&&_0x247bc7>0x0)return{'dbId':_0x247bc7,'dbName':await getDbName(_0xb01376[_0x52c07c(0x1e3)],_0x247bc7)[_0x52c07c(0x1ec)](()=>undefined)};if(_0xb01376['nonInteractive'])throw CliErrors[_0x52c07c(0x1f8)](_0x52c07c(0x1fc),_0x52c07c(0x21a));const _0x499f2e=await listDatabases(_0xb01376[_0x52c07c(0x1e3)])[_0x52c07c(0x1ec)](()=>[]);if(_0x499f2e[_0x52c07c(0x202)]===0x1)return{'dbId':_0x499f2e[0x0][_0x52c07c(0x219)],'dbName':_0x499f2e[0x0][_0x52c07c(0x1dc)]};if(_0x499f2e['length']>0x1){const _0x4c5a28=await select({'message':'请选择目标数据库:','choices':[..._0x499f2e['map'](_0x43f96e=>({'name':_0x43f96e[_0x52c07c(0x1dc)]+'\x20('+_0x43f96e['dbId']+')','value':serializeDbSelection(_0x43f96e)})),{'name':'✎\x20手动输入\x20dbId','value':_0x52c07c(0x206)}]});if(_0x4c5a28!==_0x52c07c(0x206))return deserializeDbSelection(_0x4c5a28);}const _0x21f16=await input({'message':_0x52c07c(0x20f),'validate':_0x2cd028=>{const _0xfa328a=_0x52c07c,_0x3e5036=_0x2cd028[_0xfa328a(0x21b)]();if(!_0x3e5036)return _0xfa328a(0x1e5);const _0x17f03b=Number(_0x3e5036);if(!Number[_0xfa328a(0x1f6)](_0x17f03b)||_0x17f03b<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x21f16['trim']())};}async function resolveSqlModeInput(_0x5e0675){const _0x487899=a166_0x23d486,_0x339961=_0x5e0675[_0x487899(0x1ed)](_0x487899(0x1ea))[_0x487899(0x21b)]();if(_0x339961===_0x487899(0x1f4)||_0x339961===_0x487899(0x212))return _0x339961;if(_0x5e0675[_0x487899(0x214)])throw CliErrors[_0x487899(0x1f8)](_0x487899(0x1ea),_0x487899(0x1e4));return await select({'message':_0x487899(0x1e0),'choices':[{'name':'普通\x20SQL(sql)','value':_0x487899(0x1f4),'description':_0x487899(0x1fd)},{'name':_0x487899(0x203),'value':_0x487899(0x212),'description':_0x487899(0x1ff)}]});}function serializeDbSelection(_0x338b74){const _0x5266a0=a166_0x23d486;return JSON[_0x5266a0(0x20a)]({'dbId':_0x338b74['dbId'],'dbName':_0x338b74[_0x5266a0(0x1dc)]});}function deserializeDbSelection(_0x21d40e){const _0xfceb8b=a166_0x23d486;try{const _0x2a2917=JSON['parse'](_0x21d40e);if(typeof _0x2a2917[_0xfceb8b(0x219)]===_0xfceb8b(0x1e6)&&Number[_0xfceb8b(0x1f0)](_0x2a2917[_0xfceb8b(0x219)]))return{'dbId':_0x2a2917[_0xfceb8b(0x219)],'dbName':_0x2a2917[_0xfceb8b(0x1dc)]};}catch{}throw CliErrors[_0xfceb8b(0x1eb)](_0xfceb8b(0x1dd)+_0x21d40e);}function resolveProvidedDbId(_0x2936ee){const _0x26ee34=a166_0x23d486,_0x50e43f=_0x2936ee[_0x26ee34(0x1ef)](_0x26ee34(0x1fc));if(typeof _0x50e43f===_0x26ee34(0x1e6)&&Number[_0x26ee34(0x1f0)](_0x50e43f))return _0x50e43f;return undefined;}
|
|
1
|
+
const a166_0x3cf64e=a166_0x3f31;(function(_0x4b280d,_0x153a92){const _0x7ae830=a166_0x3f31,_0x5d0e23=_0x4b280d();while(!![]){try{const _0x4b247d=parseInt(_0x7ae830(0xb2))/0x1*(parseInt(_0x7ae830(0x99))/0x2)+-parseInt(_0x7ae830(0x7e))/0x3+-parseInt(_0x7ae830(0x9b))/0x4*(-parseInt(_0x7ae830(0xbb))/0x5)+parseInt(_0x7ae830(0xae))/0x6*(parseInt(_0x7ae830(0x87))/0x7)+parseInt(_0x7ae830(0xab))/0x8*(parseInt(_0x7ae830(0x80))/0x9)+parseInt(_0x7ae830(0x81))/0xa+-parseInt(_0x7ae830(0x7f))/0xb*(parseInt(_0x7ae830(0x92))/0xc);if(_0x4b247d===_0x153a92)break;else _0x5d0e23['push'](_0x5d0e23['shift']());}catch(_0x3e23bd){_0x5d0e23['push'](_0x5d0e23['shift']());}}}(a166_0x2caf,0x66912));function a166_0x2caf(){const _0x184d06=['--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','18bYoEef','</select>','db-id','lockFilePath','554335khSGVu','POST','toISOString','name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRootDir','length','catch','5xCEJbW','high-risk-write','sql','lastSync','str','description','314571gplKTZ','11MmOmNw','9ZLSNhF','1176530coLyMW','trim','appCode','__manual__','stringify','flagMissing','386554lZrjAg','sqls','validation','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbId\x20不能为空','<server-generated-sqlCode>','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','✎\x20手动输入\x20dbId','适合带动态标签的\x20MyBatis\x20XML\x20SQL','flag','19281180zcuykM','mybatisXml','请选择目标数据库:','sqlRoot','Created\x20SQL\x20query\x20','utf8','请选择本地\x20SQL\x20模式:','2bMaPqp','mode','1965464OKAHbt','dbName','/smartapi/custom/saveUserCustomSql','普通\x20SQL(sql)','请输入\x20SQL\x20名称:','create','nonInteractive','Target\x20database\x20ID','sqlName','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','number','string','SQL\x20query\x20display\x20name','dbId','File\x20already\x20exists:\x20','isFinite','6421728pkXOXC','sqlCode'];a166_0x2caf=function(){return _0x184d06;};return a166_0x2caf();}import{writeFile}from'node:fs/promises';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';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';function a166_0x3f31(_0x40154d,_0x120cf2){_0x40154d=_0x40154d-0x79;const _0x2cafd2=a166_0x2caf();let _0x3f312b=_0x2cafd2[_0x40154d];return _0x3f312b;}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x494806){const _0x1b9f7d=a166_0x3f31;if(_0x494806===_0x1b9f7d(0x93))return[_0x1b9f7d(0x8e),'\x20\x20SELECT\x201\x20AS\x20id',_0x1b9f7d(0xaf),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}export const sqlCreate={'service':a166_0x3cf64e(0x7a),'command':a166_0x3cf64e(0xa0),'description':a166_0x3cf64e(0x8a),'risk':a166_0x3cf64e(0x79),'flags':[{'name':a166_0x3cf64e(0xb5),'type':a166_0x3cf64e(0xa6),'description':a166_0x3cf64e(0xa7)},{'name':'db-id','type':a166_0x3cf64e(0xa5),'description':a166_0x3cf64e(0xa2)},{'name':a166_0x3cf64e(0x9a),'type':a166_0x3cf64e(0xa6),'enum':[a166_0x3cf64e(0x7a),'mybatisXml'],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x558b29){const _0x408255=a166_0x3cf64e;if(!_0x558b29[_0x408255(0xa1)])return;if(!_0x558b29[_0x408255(0x7c)](_0x408255(0xb5))[_0x408255(0x82)]())throw CliErrors[_0x408255(0x86)](_0x408255(0xb5),_0x408255(0xb6));const _0x34b1f1=resolveProvidedDbId(_0x558b29);if(typeof _0x34b1f1!=='number'||!Number[_0x408255(0xaa)](_0x34b1f1)||_0x34b1f1<=0x0)throw CliErrors[_0x408255(0x86)](_0x408255(0xb0),_0x408255(0xad));if(!_0x558b29[_0x408255(0x7c)](_0x408255(0x9a))['trim']())throw CliErrors['flagMissing'](_0x408255(0x9a),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x1e99ad){const _0x35109b=a166_0x3cf64e,_0x3fdc49=loadSqlProjectConfig(_0x1e99ad[_0x35109b(0x83)]),{sqlName:_0x5d7aa1,dbId:_0x3d945d,dbName:_0x5b4ab5,mode:_0x296fb1}=await resolveSqlNewInputs(_0x1e99ad),_0x220fa0=buildSqlRelativePath(_0x35109b(0x8d),_0x5d7aa1,_0x5b4ab5,_0x296fb1,_0x3d945d),_0x160e6e=_0x3fdc49[_0x35109b(0xb8)]+'/'+_0x220fa0;return{'method':_0x35109b(0xb3),'url':_0x35109b(0x9d),'body':{'appCode':_0x1e99ad['appCode'],'sqlName':_0x5d7aa1,'dbId':_0x3d945d,'mode':_0x296fb1,'localPath':_0x160e6e},'description':_0x35109b(0x8b)+_0x3fdc49[_0x35109b(0xb8)]};},async 'execute'(_0x208343){const _0x2e4af2=a166_0x3cf64e,_0x49a4b5=loadSqlProjectConfig(_0x208343[_0x2e4af2(0x83)]),{sqlName:_0x297f51,dbId:_0x5b3973,dbName:_0x8f3107,mode:_0x3a4199}=await resolveSqlNewInputs(_0x208343),_0x595f20=generateSqlTemplate(_0x3a4199),_0x262c29=await createSqlQuery({'appCode':_0x208343[_0x2e4af2(0x83)],'sqlName':_0x297f51,'dbId':_0x5b3973,'sqlContent':_0x595f20}),_0x5094fc=ensureRemoteSqlContent(_0x262c29),_0x5509e1=_0x8f3107||await getDbName(_0x208343[_0x2e4af2(0x83)],_0x5b3973)[_0x2e4af2(0xba)](()=>undefined),_0x358df0=buildSqlRelativePath(_0x262c29[_0x2e4af2(0xac)],_0x262c29['sqlName'],_0x5509e1,_0x3a4199,_0x5b3973),_0x23495b=_0x49a4b5[_0x2e4af2(0xb8)]+'/'+_0x358df0,_0x4c9c3b=buildLocalSqlFileContent({'sqlCode':_0x262c29[_0x2e4af2(0xac)],'sqlName':_0x262c29[_0x2e4af2(0xa3)],'dbId':_0x262c29[_0x2e4af2(0xa8)]},_0x5094fc,{'dbName':_0x5509e1,'mode':_0x3a4199,'syncedAt':new Date()[_0x2e4af2(0xb4)](),'description':_0x262c29[_0x2e4af2(0x7d)]});if(await fileExists(_0x23495b))throw CliErrors[_0x2e4af2(0x89)](_0x2e4af2(0xa9)+_0x23495b);await ensureParentDirectory(_0x23495b),await writeFile(_0x23495b,_0x4c9c3b,_0x2e4af2(0x97));const _0x3ca64c=await readSqlLockFile(_0x49a4b5[_0x2e4af2(0xb1)]),{lockData:_0x5932d4,appLock:_0x219024}=ensureSqlLockScope(_0x3ca64c??createEmptySqlLock(),_0x49a4b5[_0x2e4af2(0x83)],_0x49a4b5[_0x2e4af2(0x95)],'new');return _0x219024[_0x2e4af2(0x88)][_0x262c29[_0x2e4af2(0xac)]]={...buildSqlLockEntry(_0x262c29,_0x5094fc,computeSqlContentHash(_0x4c9c3b),{'dbName':_0x5509e1}),'path':_0x358df0,'mode':_0x3a4199},_0x219024[_0x2e4af2(0x7b)]=new Date()[_0x2e4af2(0xb4)](),await writeSqlLockFile(_0x49a4b5[_0x2e4af2(0xb1)],_0x5932d4),{'ok':!![],'data':{'id':_0x262c29['id'],'sqlCode':_0x262c29[_0x2e4af2(0xac)],'sqlName':_0x262c29['sqlName'],'dbId':_0x262c29[_0x2e4af2(0xa8)],'path':_0x23495b,'mode':_0x3a4199},'message':_0x2e4af2(0x96)+_0x262c29[_0x2e4af2(0xac)]};}};async function resolveSqlNewInputs(_0x39edd4){const _0x212aac=await resolveSqlNameInput(_0x39edd4),{dbId:_0x1f56ad,dbName:_0x161fc5}=await resolveDbSelection(_0x39edd4),_0x2538ba=await resolveSqlModeInput(_0x39edd4);return{'sqlName':_0x212aac,'dbId':_0x1f56ad,'dbName':_0x161fc5,'mode':_0x2538ba};}async function resolveSqlNameInput(_0x1b147c){const _0x563533=a166_0x3cf64e,_0xa7f95d=_0x1b147c[_0x563533(0x7c)]('name')[_0x563533(0x82)]();if(_0xa7f95d)return _0xa7f95d;if(_0x1b147c[_0x563533(0xa1)])throw CliErrors[_0x563533(0x86)]('name',_0x563533(0xb6));return(await input({'message':_0x563533(0x9f),'validate':_0x2e9b7e=>_0x2e9b7e['trim']()?!![]:'SQL\x20名称不能为空'}))[_0x563533(0x82)]();}async function resolveDbSelection(_0x4f4d50){const _0xf837bf=a166_0x3cf64e,_0x244e36=resolveProvidedDbId(_0x4f4d50);if(typeof _0x244e36===_0xf837bf(0xa5)&&Number[_0xf837bf(0xaa)](_0x244e36)&&_0x244e36>0x0)return{'dbId':_0x244e36,'dbName':await getDbName(_0x4f4d50[_0xf837bf(0x83)],_0x244e36)[_0xf837bf(0xba)](()=>undefined)};if(_0x4f4d50[_0xf837bf(0xa1)])throw CliErrors[_0xf837bf(0x86)](_0xf837bf(0xb0),_0xf837bf(0xad));const _0x3a8530=await listDatabases(_0x4f4d50['appCode'])[_0xf837bf(0xba)](()=>[]);if(_0x3a8530[_0xf837bf(0xb9)]===0x1)return{'dbId':_0x3a8530[0x0][_0xf837bf(0xa8)],'dbName':_0x3a8530[0x0][_0xf837bf(0x9c)]};if(_0x3a8530[_0xf837bf(0xb9)]>0x1){const _0xe2b1c5=await select({'message':_0xf837bf(0x94),'choices':[..._0x3a8530['map'](_0xef2951=>({'name':_0xef2951['dbName']+'\x20('+_0xef2951[_0xf837bf(0xa8)]+')','value':serializeDbSelection(_0xef2951)})),{'name':_0xf837bf(0x8f),'value':'__manual__'}]});if(_0xe2b1c5!==_0xf837bf(0x84))return deserializeDbSelection(_0xe2b1c5);}const _0x4ad779=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x4b78f8=>{const _0x1c923f=_0xf837bf,_0x131639=_0x4b78f8[_0x1c923f(0x82)]();if(!_0x131639)return _0x1c923f(0x8c);const _0x2c851e=Number(_0x131639);if(!Number['isInteger'](_0x2c851e)||_0x2c851e<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x4ad779[_0xf837bf(0x82)]())};}async function resolveSqlModeInput(_0x23b164){const _0x546b05=a166_0x3cf64e,_0x449471=_0x23b164[_0x546b05(0x7c)]('mode')[_0x546b05(0x82)]();if(_0x449471===_0x546b05(0x7a)||_0x449471===_0x546b05(0x93))return _0x449471;if(_0x23b164[_0x546b05(0xa1)])throw CliErrors['flagMissing'](_0x546b05(0x9a),_0x546b05(0xb7));return await select({'message':_0x546b05(0x98),'choices':[{'name':_0x546b05(0x9e),'value':_0x546b05(0x7a),'description':_0x546b05(0xa4)},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x546b05(0x93),'description':_0x546b05(0x90)}]});}function serializeDbSelection(_0x58c014){const _0x51944b=a166_0x3cf64e;return JSON[_0x51944b(0x85)]({'dbId':_0x58c014[_0x51944b(0xa8)],'dbName':_0x58c014[_0x51944b(0x9c)]});}function deserializeDbSelection(_0x33dca3){const _0x260123=a166_0x3cf64e;try{const _0x464fa7=JSON['parse'](_0x33dca3);if(typeof _0x464fa7[_0x260123(0xa8)]===_0x260123(0xa5)&&Number[_0x260123(0xaa)](_0x464fa7[_0x260123(0xa8)]))return{'dbId':_0x464fa7[_0x260123(0xa8)],'dbName':_0x464fa7[_0x260123(0x9c)]};}catch{}throw CliErrors[_0x260123(0x89)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x33dca3);}function resolveProvidedDbId(_0x34e3e6){const _0x32e7af=a166_0x3cf64e,_0x10d983=_0x34e3e6[_0x32e7af(0x91)]('db-id');if(typeof _0x10d983===_0x32e7af(0xa5)&&Number[_0x32e7af(0xaa)](_0x10d983))return _0x10d983;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x1a6b2c=a167_0x1681;(function(_0x590953,_0x43af1f){const _0xbdc4da=a167_0x1681,_0x2c5095=_0x590953();while(!![]){try{const _0x28892d=-parseInt(_0xbdc4da(0x11c))/0x1*(parseInt(_0xbdc4da(0x128))/0x2)+-parseInt(_0xbdc4da(0x132))/0x3*(parseInt(_0xbdc4da(0x139))/0x4)+parseInt(_0xbdc4da(0x12f))/0x5+-parseInt(_0xbdc4da(0x138))/0x6+parseInt(_0xbdc4da(0x137))/0x7+-parseInt(_0xbdc4da(0x11b))/0x8+-parseInt(_0xbdc4da(0x12a))/0x9*(-parseInt(_0xbdc4da(0x129))/0xa);if(_0x28892d===_0x43af1f)break;else _0x2c5095['push'](_0x2c5095['shift']());}catch(_0x5d1834){_0x2c5095['push'](_0x2c5095['shift']());}}}(a167_0x1cc4,0x50d77));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';function a167_0x1681(_0x2dea11,_0x47924c){_0x2dea11=_0x2dea11-0x11b;const _0x1cc427=a167_0x1cc4();let _0x168154=_0x1cc427[_0x2dea11];return _0x168154;}import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';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':a167_0x1a6b2c(0x125),'command':a167_0x1a6b2c(0x127),'description':a167_0x1a6b2c(0x133),'risk':a167_0x1a6b2c(0x13a),'flags':[SQLCODE_FLAG],async 'validate'(_0x1ac8cd){const _0x54964d=a167_0x1a6b2c,_0x85ad8c=loadSqlProjectConfig(_0x1ac8cd['appCode']),_0x205636=await readSqlLockFile(_0x85ad8c['lockFilePath']);if(!_0x205636)throw CliErrors['validation'](_0x54964d(0x130));},async 'dryRun'(_0x4150e6){const _0xa6e054=a167_0x1a6b2c,_0x1dceff=loadSqlProjectConfig(_0x4150e6['appCode']),_0x2e9f47=await readSqlLockFile(_0x1dceff['lockFilePath']);if(!_0x2e9f47)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x5a7c94}=ensureSqlLockScope(_0x2e9f47,_0x4150e6[_0xa6e054(0x124)],_0x1dceff[_0xa6e054(0x13b)],_0xa6e054(0x127)),_0x176560=_0x4150e6[_0xa6e054(0x13d)](_0xa6e054(0x120)),_0x4b6ba3=_0x5a7c94[_0xa6e054(0x123)][_0x176560];if(!_0x4b6ba3)throw CliErrors['validation'](_0xa6e054(0x11f)+_0x176560+'\x22.');return{'method':'POST','url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x176560,'id':_0x4b6ba3['remoteId'],'localPath':resolveLocalSqlFilePath(_0x1dceff,_0x176560,_0x4b6ba3)},'description':_0xa6e054(0x126)+_0x176560+_0xa6e054(0x136)+_0x1dceff[_0xa6e054(0x131)]};},async 'execute'(_0x1540a9){const _0x18fcc7=a167_0x1a6b2c,_0x2ce3fd=loadSqlProjectConfig(_0x1540a9[_0x18fcc7(0x124)]),_0xb51726=await readSqlLockFile(_0x2ce3fd[_0x18fcc7(0x121)]);if(!_0xb51726)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x8f194c,appLock:_0x1a32be}=ensureSqlLockScope(_0xb51726,_0x1540a9[_0x18fcc7(0x124)],_0x2ce3fd[_0x18fcc7(0x13b)],_0x18fcc7(0x127)),_0x1dc282=_0x1540a9['str'](_0x18fcc7(0x120)),_0x5b227c=_0x1a32be[_0x18fcc7(0x123)][_0x1dc282];if(!_0x5b227c)throw CliErrors[_0x18fcc7(0x122)](_0x18fcc7(0x11f)+_0x1dc282+'\x22.');await deleteSqlQuery({'id':_0x5b227c[_0x18fcc7(0x12b)],'sqlCode':_0x1dc282}),_0x1a32be[_0x18fcc7(0x123)]=Object['fromEntries'](Object[_0x18fcc7(0x135)](_0x1a32be['sqls'])['filter'](([_0x498946])=>_0x498946!==_0x1dc282)),_0x1a32be[_0x18fcc7(0x11e)]=new Date()[_0x18fcc7(0x134)](),await writeSqlLockFile(_0x2ce3fd['lockFilePath'],_0x8f194c);const _0x4aa554=resolveLocalSqlFilePath(_0x2ce3fd,_0x1dc282,_0x5b227c);let _0x366a41;await fileExists(_0x4aa554)&&(_0x366a41=await moveToTrash(_0x2ce3fd[_0x18fcc7(0x11d)],_0x2ce3fd[_0x18fcc7(0x131)],_0x4aa554),await cleanupEmptyDirectories(dirname(_0x4aa554),_0x2ce3fd[_0x18fcc7(0x12d)]));const _0x46f807={'deleted':_0x1dc282,'remoteId':_0x5b227c['remoteId']};if(_0x366a41)_0x46f807[_0x18fcc7(0x13c)]=_0x366a41;return{'ok':!![],'data':_0x46f807,'message':'Deleted\x20'+_0x1dc282+(_0x366a41?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x18d911,_0x1acd3b,_0x7f83f3){const _0x3bc32f=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x2ce79a=relative(_0x18d911,_0x7f83f3),_0x120f54=join(_0x1acd3b,_0x3bc32f,_0x2ce79a);return await mkdir(dirname(_0x120f54),{'recursive':!![]}),await rename(_0x7f83f3,_0x120f54),_0x120f54;}async function cleanupEmptyDirectories(_0x2146cd,_0x30385a){const _0x3c5c30=a167_0x1a6b2c;let _0x30dd5b=resolve(_0x2146cd);const _0x39daea=resolve(_0x30385a);while(_0x30dd5b[_0x3c5c30(0x12e)](''+_0x39daea+sep)||_0x30dd5b===_0x39daea){if(_0x30dd5b===_0x39daea)return;try{const _0x2a279f=await readdir(_0x30dd5b);if(_0x2a279f[_0x3c5c30(0x12c)]>0x0)return;await rmdir(_0x30dd5b);}catch{return;}_0x30dd5b=dirname(_0x30dd5b);}}function a167_0x1cc4(){const _0x1692f3=['lockFilePath','validation','sqls','appCode','sql','Would\x20delete\x20SQL\x20','delete','6rwIrPA','15055650DTjqDy','9VVwboy','remoteId','length','sqlRootDir','startsWith','1508035nuUSWc','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','trashDir','33429zhMDqP','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','toISOString','entries','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','1557920AFQkrM','186240edIrpl','236tSfmzI','high-risk-write','sqlRoot','trashedTo','str','4816016dBbCZV','136042CxWWvo','projectRoot','lastSync','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlcode'];a167_0x1cc4=function(){return _0x1692f3;};return a167_0x1cc4();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a168_0x1faa6f=a168_0x1234;(function(_0x975320,_0x2e506e){const _0x49ab29=a168_0x1234,_0x417526=_0x975320();while(!![]){try{const _0x2fce01=parseInt(_0x49ab29(0x137))/0x1+parseInt(_0x49ab29(0x139))/0x2+-parseInt(_0x49ab29(0x138))/0x3+-parseInt(_0x49ab29(0x131))/0x4+parseInt(_0x49ab29(0x133))/0x5*(-parseInt(_0x49ab29(0x12a))/0x6)+-parseInt(_0x49ab29(0x136))/0x7+-parseInt(_0x49ab29(0x134))/0x8*(-parseInt(_0x49ab29(0x132))/0x9);if(_0x2fce01===_0x2e506e)break;else _0x417526['push'](_0x417526['shift']());}catch(_0x4423cc){_0x417526['push'](_0x417526['shift']());}}}(a168_0x4663,0x75e11));function a168_0x4663(){const _0x491adc=['22045IGVDPn','8GMPnoE','boolean','311360RpPaNF','81275zYrfCL','7329MKvjcy','143700dJReGX','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','appCode','sqlCode','sqlName','sqlContent','354guPCie','dbId','description','read','sqlcode','sql','verbose','670004InOjhi','7238367mCqIYQ'];a168_0x4663=function(){return _0x491adc;};return a168_0x4663();}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a168_0x1234(_0x20dc14,_0x5517d2){_0x20dc14=_0x20dc14-0x128;const _0x466324=a168_0x4663();let _0x1234c9=_0x466324[_0x20dc14];return _0x1234c9;}export const sqlDetail={'service':a168_0x1faa6f(0x12f),'command':'detail','description':a168_0x1faa6f(0x13a),'risk':a168_0x1faa6f(0x12d),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a168_0x1faa6f(0x135),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x344432){const _0xdabb8f=a168_0x1faa6f,_0xe2c379=await getSqlQueryInfo(_0x344432['appCode'],_0x344432['str'](_0xdabb8f(0x12e))),_0x16c6a5=_0x344432['bool'](_0xdabb8f(0x130));if(_0x16c6a5)return{'ok':!![],'data':_0xe2c379};const _0x15f507=_0xe2c379[_0xdabb8f(0x12b)]?await getDbName(_0x344432[_0xdabb8f(0x13b)],_0xe2c379[_0xdabb8f(0x12b)]):undefined;return{'ok':!![],'data':{'sqlCode':_0xe2c379[_0xdabb8f(0x13c)],'sqlName':_0xe2c379[_0xdabb8f(0x128)],'db':_0x15f507?_0x15f507+'\x20('+_0xe2c379[_0xdabb8f(0x12b)]+')':_0xe2c379[_0xdabb8f(0x12b)]??'','description':_0xe2c379[_0xdabb8f(0x12c)]??'','sqlContent':_0xe2c379[_0xdabb8f(0x129)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a169_0x58c0cf=a169_0x251b;function a169_0x251b(_0x5bd49d,_0x2549b0){_0x5bd49d=_0x5bd49d-0xa2;const _0x30027e=a169_0x3002();let _0x251bc1=_0x30027e[_0x5bd49d];return _0x251bc1;}(function(_0xa844cc,_0x23502c){const _0x5416e0=a169_0x251b,_0x3fe793=_0xa844cc();while(!![]){try{const _0xd18b7c=parseInt(_0x5416e0(0xb9))/0x1*(parseInt(_0x5416e0(0xaf))/0x2)+-parseInt(_0x5416e0(0xb4))/0x3+parseInt(_0x5416e0(0xa5))/0x4+parseInt(_0x5416e0(0xbd))/0x5*(-parseInt(_0x5416e0(0xa7))/0x6)+parseInt(_0x5416e0(0xa6))/0x7*(parseInt(_0x5416e0(0xab))/0x8)+parseInt(_0x5416e0(0xb8))/0x9+parseInt(_0x5416e0(0xb6))/0xa*(parseInt(_0x5416e0(0xb5))/0xb);if(_0xd18b7c===_0x23502c)break;else _0x3fe793['push'](_0x3fe793['shift']());}catch(_0x56b864){_0x3fe793['push'](_0x3fe793['shift']());}}}(a169_0x3002,0xcdb7a));import{executeSql}from'../../core/api-client.js';function a169_0x3002(){const _0x5badc1=['5313FvlPhD','198606eUjwBp','\x20row(s)\x20in\x20','sql','exec','11080HQaUwk','sqlcode','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','str','3446LcVpCG','length','appCode','execResult','isArray','3616068klOQEx','22nqTZXI','3258080qlmZCc','now','648099xmyAvm','32jVktmT','execSuccess','read','Returned\x20','50TuMgjz','params','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execError','2196024Czajpg'];a169_0x3002=function(){return _0x5badc1;};return a169_0x3002();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a169_0x58c0cf(0xa9),'command':a169_0x58c0cf(0xaa),'description':a169_0x58c0cf(0xa3),'risk':a169_0x58c0cf(0xbb),'flags':[SQLCODE_FLAG,{'name':a169_0x58c0cf(0xa2),'type':'string','description':a169_0x58c0cf(0xad)}],async 'execute'(_0xc57a9){const _0x8de298=a169_0x58c0cf,_0x2d0133=parseJsonParams(_0xc57a9[_0x8de298(0xae)](_0x8de298(0xa2))),_0x2b7825=Date['now'](),_0x5724a2=await executeSql(_0xc57a9[_0x8de298(0xb1)],_0xc57a9[_0x8de298(0xae)](_0x8de298(0xac)),_0x2d0133),_0x260f49=Date[_0x8de298(0xb7)]()-_0x2b7825,_0x472627=_0x5724a2?.[_0x8de298(0xb2)]??_0x5724a2,_0xb3995e=_0x5724a2?.[_0x8de298(0xba)]??!![];if(!_0xb3995e)return{'ok':![],'data':{'error':_0x5724a2?.[_0x8de298(0xa4)]||'SQL\x20execution\x20failed','elapsed':_0x260f49},'message':'SQL\x20execution\x20failed'};const _0x1b3328=Array[_0x8de298(0xb3)](_0x472627)?_0x472627:[];return{'ok':!![],'data':{'rows':_0x1b3328,'rowCount':_0x1b3328[_0x8de298(0xb0)],'elapsed':_0x260f49},'message':_0x8de298(0xbc)+_0x1b3328[_0x8de298(0xb0)]+_0x8de298(0xa8)+_0x260f49+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x7e368f,_0x220c75){const _0x458dc6=a170_0x12da,_0x30bed2=_0x7e368f();while(!![]){try{const _0x42bdd1=parseInt(_0x458dc6(0x1d3))/0x1+-parseInt(_0x458dc6(0x1d4))/0x2+-parseInt(_0x458dc6(0x1d5))/0x3*(-parseInt(_0x458dc6(0x1d9))/0x4)+parseInt(_0x458dc6(0x1d1))/0x5+-parseInt(_0x458dc6(0x1d8))/0x6*(parseInt(_0x458dc6(0x1d7))/0x7)+-parseInt(_0x458dc6(0x1da))/0x8*(-parseInt(_0x458dc6(0x1d0))/0x9)+-parseInt(_0x458dc6(0x1d6))/0xa*(parseInt(_0x458dc6(0x1d2))/0xb);if(_0x42bdd1===_0x220c75)break;else _0x30bed2['push'](_0x30bed2['shift']());}catch(_0x282e6f){_0x30bed2['push'](_0x30bed2['shift']());}}}(a170_0x239d,0xa0817));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';function a170_0x12da(_0x56589f,_0x2572e7){_0x56589f=_0x56589f-0x1d0;const _0x239d55=a170_0x239d();let _0x12da01=_0x239d55[_0x56589f];return _0x12da01;}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a170_0x239d(){const _0x59cb3c=['3983930LOiJHt','946UijICD','1151319ePIwpB','933298kEiKCM','33AIjNNa','287930BlXDjX','365421gfyfth','78YzBgEw','407788MDHBdi','15992JipmJe','5445THYywA'];a170_0x239d=function(){return _0x59cb3c;};return a170_0x239d();}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
|
+
const a171_0x3e7d10=a171_0x522d;(function(_0x25a805,_0xe3828c){const _0x482a1f=a171_0x522d,_0x258846=_0x25a805();while(!![]){try{const _0x126b8a=-parseInt(_0x482a1f(0x138))/0x1*(parseInt(_0x482a1f(0x121))/0x2)+-parseInt(_0x482a1f(0x137))/0x3*(parseInt(_0x482a1f(0x139))/0x4)+-parseInt(_0x482a1f(0x124))/0x5*(parseInt(_0x482a1f(0x141))/0x6)+parseInt(_0x482a1f(0x134))/0x7+parseInt(_0x482a1f(0x123))/0x8+-parseInt(_0x482a1f(0x126))/0x9*(-parseInt(_0x482a1f(0x120))/0xa)+parseInt(_0x482a1f(0x135))/0xb;if(_0x126b8a===_0xe3828c)break;else _0x258846['push'](_0x258846['shift']());}catch(_0x3c4bed){_0x258846['push'](_0x258846['shift']());}}}(a171_0x5850,0x29a91));function a171_0x522d(_0x117a88,_0x252aee){_0x117a88=_0x117a88-0x11f;const _0x5850e0=a171_0x5850();let _0x522dd2=_0x5850e0[_0x117a88];return _0x522dd2;}function a171_0x5850(){const _0x1bb55d=['sql','List\x20custom\x20SQL\x20queries','\x20SQL\x20queries\x20(total:\x20','paging','map','name','description','str','verbose','num','length','boolean','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','568953RysiKp','6287556yFImvN','appCode','226020CSHeZJ','58854pLAVjy','16flDbmU','dbId','pagesize','totalCount','number','list','page','all','12fUNeUf','Page\x20size','230210oUVvky','2GhdrNb','Filter\x20by\x20SQL\x20name','413256CdmBwj','491745YnXVem','Found\x20','9kFLYzm'];a171_0x5850=function(){return _0x1bb55d;};return a171_0x5850();}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':a171_0x3e7d10(0x127),'command':a171_0x3e7d10(0x13e),'description':a171_0x3e7d10(0x128),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x3e7d10(0x12c),'type':'string','description':a171_0x3e7d10(0x122)},{'name':a171_0x3e7d10(0x13f),'type':'number','description':'Page\x20number','default':0x1},{'name':a171_0x3e7d10(0x13b),'type':a171_0x3e7d10(0x13d),'description':a171_0x3e7d10(0x11f)},{'name':a171_0x3e7d10(0x12f),'type':a171_0x3e7d10(0x132),'description':a171_0x3e7d10(0x133)}],async 'execute'(_0x16573f){const _0x35b8a4=a171_0x3e7d10,_0x3b8199=await listSqlQueries(_0x16573f[_0x35b8a4(0x136)],{'sqlCode':_0x16573f[_0x35b8a4(0x12e)]('sqlcode')||undefined,'sqlName':_0x16573f[_0x35b8a4(0x12e)](_0x35b8a4(0x12c))||undefined,'currentPage':_0x16573f[_0x35b8a4(0x130)](_0x35b8a4(0x13f)),'pageSize':_0x16573f[_0x35b8a4(0x130)](_0x35b8a4(0x13b),0x32)}),_0x1d84a2=_0x16573f['bool'](_0x35b8a4(0x12f)),_0x482442=_0x3b8199['tableData']??[],_0x4a0ef7=_0x3b8199[_0x35b8a4(0x12a)]?.[_0x35b8a4(0x13c)]??_0x482442[_0x35b8a4(0x131)];let _0x445a07;return _0x1d84a2?_0x445a07=_0x482442:_0x445a07=await Promise[_0x35b8a4(0x140)](_0x482442[_0x35b8a4(0x12b)](async _0x128a82=>{const _0xbe6db7=_0x35b8a4;let _0x2241ee;try{_0x2241ee=_0x128a82[_0xbe6db7(0x13a)]?await getDbName(_0x16573f['appCode'],_0x128a82['dbId']):undefined;}catch{}return{'sqlCode':_0x128a82['sqlCode'],'sqlName':_0x128a82['sqlName'],'description':_0x128a82[_0xbe6db7(0x12d)]??'','db':_0x2241ee?_0x2241ee+'\x20('+_0x128a82[_0xbe6db7(0x13a)]+')':_0x128a82[_0xbe6db7(0x13a)]??''};})),{'ok':!![],'data':_0x445a07,'message':_0x482442[_0x35b8a4(0x131)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x35b8a4(0x125)+_0x482442[_0x35b8a4(0x131)]+_0x35b8a4(0x129)+_0x4a0ef7+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a172_0x5be294=a172_0x7049;(function(_0x4acaff,_0x5eedd4){const _0x4836fb=a172_0x7049,_0x5c63e3=_0x4acaff();while(!![]){try{const _0x429018=parseInt(_0x4836fb(0x1f4))/0x1+parseInt(_0x4836fb(0x1d5))/0x2+parseInt(_0x4836fb(0x1e3))/0x3*(-parseInt(_0x4836fb(0x207))/0x4)+-parseInt(_0x4836fb(0x1fe))/0x5*(parseInt(_0x4836fb(0x1fa))/0x6)+-parseInt(_0x4836fb(0x202))/0x7*(parseInt(_0x4836fb(0x1e5))/0x8)+-parseInt(_0x4836fb(0x1db))/0x9+-parseInt(_0x4836fb(0x1d3))/0xa*(-parseInt(_0x4836fb(0x206))/0xb);if(_0x429018===_0x5eedd4)break;else _0x5c63e3['push'](_0x5c63e3['shift']());}catch(_0x473356){_0x5c63e3['push'](_0x5c63e3['shift']());}}}(a172_0x59d1,0x5d85b));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';function a172_0x7049(_0x740445,_0x50f38e){_0x740445=_0x740445-0x1ce;const _0x59d10f=a172_0x59d1();let _0x7049bd=_0x59d10f[_0x740445];return _0x7049bd;}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';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';function a172_0x59d1(){const _0x382da8=['Force\x20pull\x20cancelled.','apps','59838ClOnbO','appCode','length','toISOString','265BGeKdb','pull','Pull\x20complete:\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','419223WFXGut','Would\x20pull\x20','filter','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','22EtbadP','1222472XukNVk','POST','name','write','unchanged','path','push','sqlRoot','8019590BxGwbO','tableData','1004528JVhdrt','utf8','sqls','mybatisXml','dbId','test','4973760qXORnI','sql','sqlRootDir','cancelled','sqlcode','sqlContent','lockFilePath','trimStart','6ywVvHH','Force\x20overwrite\x20local\x20unsynced\x20changes','88uELttE','No\x20remote\x20SQL\x20queries\x20matched.','split','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlName','force','string','nonInteractive','lastSync','paging','boolean','catch','\x20SQL\x20file(s)\x20into\x20','str','sqlCode','628109DuXuGg','\x20failed','message','replace'];a172_0x59d1=function(){return _0x382da8;};return a172_0x59d1();}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(_0x1a41a2,_0x3025a2){const _0x990949=a172_0x7049,_0x4c24dd=[];let _0x119c28=0x1;while(!![]){const _0x42c274=await listSqlQueries(_0x1a41a2,{'currentPage':_0x119c28,'pageSize':PAGE_SIZE,'sqlCode':_0x3025a2['sqlCode'],'sqlName':_0x3025a2['sqlName']}),_0x18c0ad=_0x42c274[_0x990949(0x1d4)]??[];_0x4c24dd['push'](..._0x18c0ad);if(_0x18c0ad[_0x990949(0x1fc)]===0x0)break;const _0x4adffa=_0x42c274[_0x990949(0x1ee)]?.['totalCount'];if(_0x4adffa!=null?_0x4c24dd[_0x990949(0x1fc)]>=_0x4adffa:_0x18c0ad[_0x990949(0x1fc)]<PAGE_SIZE)break;_0x119c28++;}return _0x4c24dd;}async function ensureSqlContent(_0x1270ea){const _0x46d2ec=a172_0x7049;if(_0x1270ea[_0x46d2ec(0x1e0)]!=null&&String(_0x1270ea[_0x46d2ec(0x1e0)])['length']>0x0)return _0x1270ea;return getSqlQueryDetail(_0x1270ea[_0x46d2ec(0x1f3)]);}export const sqlPull={'service':a172_0x5be294(0x1dc),'command':a172_0x5be294(0x1ff),'description':a172_0x5be294(0x1e8),'risk':a172_0x5be294(0x1ce),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x5be294(0x209),'type':a172_0x5be294(0x1eb),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a172_0x5be294(0x1ea),'type':a172_0x5be294(0x1ef),'description':a172_0x5be294(0x1e4)}],async 'dryRun'(_0x1a3fa6){const _0x1ed66e=a172_0x5be294,_0x599127=loadSqlProjectConfig(_0x1a3fa6[_0x1ed66e(0x1fb)]),_0x390b6f=await readSqlLockFile(_0x599127[_0x1ed66e(0x1e1)]),{appLock:_0x1e7fea}=ensureSqlLockScope(_0x390b6f??createEmptySqlLock(),_0x599127[_0x1ed66e(0x1fb)],_0x599127[_0x1ed66e(0x1d2)],_0x1ed66e(0x1ff)),_0x4fb3cf=await fetchAllSqlQueries(_0x1a3fa6[_0x1ed66e(0x1fb)],{'sqlCode':_0x1a3fa6[_0x1ed66e(0x1f2)]('sqlcode')||undefined,'sqlName':_0x1a3fa6['str'](_0x1ed66e(0x209))||undefined}),_0x24e14e=[];for(const _0xc1a635 of _0x4fb3cf){const _0x6cce35=await ensureSqlContent(_0xc1a635),_0x443399=ensureRemoteSqlContent(_0x6cce35),_0x18cafb=detectModeFromSql(_0x6cce35),_0x9de1c4=_0x6cce35[_0x1ed66e(0x1d9)]?await getDbName(_0x1a3fa6['appCode'],Number(_0x6cce35[_0x1ed66e(0x1d9)]))['catch'](()=>undefined):undefined,_0x35de20=buildLocalSqlFileContent({'sqlCode':_0x6cce35[_0x1ed66e(0x1f3)],'sqlName':_0x6cce35['sqlName'],'dbId':_0x6cce35['dbId']},_0x443399,{'dbName':_0x9de1c4,'mode':_0x18cafb,'syncedAt':new Date()[_0x1ed66e(0x1fd)](),'description':_0x6cce35['description']}),_0x1a4b3a=buildSqlLockEntry(_0x6cce35,_0x443399,'',{'dbName':_0x9de1c4}),_0x32b7a3=resolveLocalSqlFilePath(_0x599127,_0x6cce35[_0x1ed66e(0x1f3)],_0x1a4b3a);let _0x4f561d='would_pull',_0x241f3c;if(await fileExists(_0x32b7a3)){const _0x8afb1c=await readFile(_0x32b7a3,_0x1ed66e(0x1d6));isEquivalentPulledSqlFile(_0x8afb1c,_0x35de20,_0x18cafb)?(_0x4f561d='skipped',_0x241f3c='unchanged'):(_0x4f561d='conflict',_0x241f3c=_0x1ed66e(0x205));}_0x24e14e[_0x1ed66e(0x1d1)]({'sqlCode':_0x6cce35['sqlCode'],'sqlName':_0x6cce35[_0x1ed66e(0x1e9)],'filePath':_0x32b7a3,'status':_0x4f561d,'reason':_0x241f3c});}return{'method':_0x1ed66e(0x208),'url':_0x1ed66e(0x201),'body':{'appCode':_0x1a3fa6['appCode'],'sqlCode':_0x1a3fa6[_0x1ed66e(0x1f2)](_0x1ed66e(0x1df))||null,'sqlName':_0x1a3fa6['str']('name')||null,'files':_0x24e14e},'description':_0x1ed66e(0x203)+_0x24e14e[_0x1ed66e(0x1fc)]+_0x1ed66e(0x1f1)+_0x599127['sqlRootDir']};},async 'execute'(_0x5a8d20){const _0x32103d=a172_0x5be294,_0x2628ab=loadSqlProjectConfig(_0x5a8d20[_0x32103d(0x1fb)]),_0x275910=await readSqlLockFile(_0x2628ab[_0x32103d(0x1e1)]),{lockData:_0xb1cd73,appLock:_0x10f00a}=ensureSqlLockScope(_0x275910??createEmptySqlLock(),_0x2628ab[_0x32103d(0x1fb)],_0x2628ab[_0x32103d(0x1d2)],_0x32103d(0x1ff)),_0x368f11=_0x5a8d20['bool']('force'),_0x5abc02=await fetchAllSqlQueries(_0x5a8d20[_0x32103d(0x1fb)],{'sqlCode':_0x5a8d20[_0x32103d(0x1f2)](_0x32103d(0x1df))||undefined,'sqlName':_0x5a8d20[_0x32103d(0x1f2)](_0x32103d(0x209))||undefined});if(_0x5abc02['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x32103d(0x1e6)};const _0x4f0604=[],_0x3215db=[];for(const _0x51bd36 of _0x5abc02){try{_0x4f0604[_0x32103d(0x1d1)](await ensureSqlContent(_0x51bd36));}catch(_0x5b1a2e){_0x3215db[_0x32103d(0x1d1)]({'sqlCode':_0x51bd36[_0x32103d(0x1f3)],'error':_0x5b1a2e instanceof Error?_0x5b1a2e[_0x32103d(0x1f6)]:String(_0x5b1a2e)});}}if(_0x368f11&&!_0x5a8d20[_0x32103d(0x1ec)]){let _0x297d54=![];for(const _0x50f1d3 of _0x4f0604){const _0x157255=detectModeFromSql(_0x50f1d3),_0x464627=_0x50f1d3['dbId']?await getDbName(_0x5a8d20['appCode'],Number(_0x50f1d3['dbId']))[_0x32103d(0x1f0)](()=>undefined):undefined,_0x180b52=buildLocalSqlFileContent({'sqlCode':_0x50f1d3[_0x32103d(0x1f3)],'sqlName':_0x50f1d3['sqlName'],'dbId':_0x50f1d3[_0x32103d(0x1d9)]},ensureRemoteSqlContent(_0x50f1d3),{'dbName':_0x464627,'mode':_0x157255,'syncedAt':new Date()['toISOString'](),'description':_0x50f1d3['description']}),_0x280e45=resolveLocalSqlFilePath(_0x2628ab,_0x50f1d3['sqlCode'],buildSqlLockEntry(_0x50f1d3,ensureRemoteSqlContent(_0x50f1d3),'',{'dbName':_0x464627}));if(await fileExists(_0x280e45)){const _0x1f30b2=await readFile(_0x280e45,_0x32103d(0x1d6));if(!isEquivalentPulledSqlFile(_0x1f30b2,_0x180b52,_0x157255)){_0x297d54=!![];break;}}}if(_0x297d54){const _0x113b00=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x113b00)throw CliErrors[_0x32103d(0x1de)](_0x32103d(0x1f8));}}const _0x15cd7f=cloneSqlLockData(_0xb1cd73),_0x2444da=_0x15cd7f[_0x32103d(0x1f9)][_0x2628ab[_0x32103d(0x1fb)]],_0x120401=[],_0x15cf41=[];for(const _0x2bd5e5 of _0x4f0604){const _0x585da8=_0x2444da['sqls'][_0x2bd5e5[_0x32103d(0x1f3)]],_0x29057c=ensureRemoteSqlContent(_0x2bd5e5),_0x3f150c=detectModeFromSql(_0x2bd5e5),_0x25735a=_0x2bd5e5['dbId']?await getDbName(_0x5a8d20[_0x32103d(0x1fb)],Number(_0x2bd5e5[_0x32103d(0x1d9)]))[_0x32103d(0x1f0)](()=>undefined):undefined,_0x171286=buildLocalSqlFileContent({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'sqlName':_0x2bd5e5[_0x32103d(0x1e9)],'dbId':_0x2bd5e5['dbId']},_0x29057c,{'dbName':_0x25735a,'mode':_0x3f150c,'syncedAt':new Date()['toISOString'](),'description':_0x2bd5e5['description']}),_0x4d4ad4=buildSqlLockEntry(_0x2bd5e5,_0x29057c,computeSqlContentHash(_0x171286),{'dbName':_0x25735a}),_0x41bf29=_0x4d4ad4['path'],_0x135aca=join(_0x2628ab['sqlRootDir'],_0x41bf29);try{if(await fileExists(_0x135aca)){const _0x389bdb=await readFile(_0x135aca,_0x32103d(0x1d6));if(isEquivalentPulledSqlFile(_0x389bdb,_0x171286,_0x3f150c)){_0x15cf41[_0x32103d(0x1d1)]({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'reason':_0x32103d(0x1cf)}),_0x2444da[_0x32103d(0x1d7)][_0x2bd5e5[_0x32103d(0x1f3)]]={..._0x4d4ad4,'hash':computeSqlContentHash(_0x389bdb),'path':_0x41bf29};continue;}if(!_0x368f11){_0x15cf41[_0x32103d(0x1d1)]({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x36f2c4=_0x585da8?.[_0x32103d(0x1d0)]?join(_0x2628ab[_0x32103d(0x1dd)],_0x585da8[_0x32103d(0x1d0)]):undefined;_0x36f2c4&&_0x36f2c4!==_0x135aca&&await fileExists(_0x36f2c4)&&await rm(_0x36f2c4,{'force':!![]}),await ensureParentDirectory(_0x135aca),await writeFile(_0x135aca,_0x171286,_0x32103d(0x1d6)),_0x2444da['sqls'][_0x2bd5e5['sqlCode']]={..._0x4d4ad4,'path':_0x41bf29},_0x120401[_0x32103d(0x1d1)]({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'filePath':_0x135aca});}catch(_0x359f14){_0x3215db['push']({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'error':_0x359f14 instanceof Error?_0x359f14[_0x32103d(0x1f6)]:String(_0x359f14)});}}return _0x2444da[_0x32103d(0x1ed)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2628ab[_0x32103d(0x1e1)],_0x15cd7f),{'ok':_0x3215db[_0x32103d(0x1fc)]===0x0,'data':{'pulled':_0x120401,'skipped':_0x15cf41,'failed':_0x3215db},'message':_0x32103d(0x200)+_0x120401[_0x32103d(0x1fc)]+'\x20written,\x20'+_0x15cf41['length']+'\x20skipped,\x20'+_0x3215db[_0x32103d(0x1fc)]+_0x32103d(0x1f5)};}};function detectModeFromSql(_0x288a71){const _0x4dbccb=a172_0x5be294,_0x271b9f=ensureRemoteSqlContent(_0x288a71),_0x1a3d01=stripLocalSqlMetadata(_0x271b9f,_0x4dbccb(0x1d8))[_0x4dbccb(0x1e2)]();if(/^<(select|insert|update|delete)\b/i[_0x4dbccb(0x1da)](_0x1a3d01))return _0x4dbccb(0x1d8);return'sql';}function isEquivalentPulledSqlFile(_0x44f7cc,_0x48afea,_0x17f323){return normalizePullComparableContent(_0x44f7cc,_0x17f323)===normalizePullComparableContent(_0x48afea,_0x17f323);}function normalizePullComparableContent(_0xb66c69,_0x54948a){const _0x497ca1=a172_0x5be294,_0x4d1c44=_0xb66c69[_0x497ca1(0x1f7)](/\r\n/g,'\x0a')[_0x497ca1(0x1e7)]('\x0a'),_0x5dbdcd=_0x4d1c44[_0x497ca1(0x204)](_0x208daa=>!isSyncedAtMetadataLine(_0x208daa,_0x54948a));return _0x5dbdcd['join']('\x0a');}function isSyncedAtMetadataLine(_0x227fd5,_0x2b14aa){const _0x3f9024=a172_0x5be294;if(_0x2b14aa==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3f9024(0x1da)](_0x227fd5);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x227fd5);}
|
|
1
|
+
const a172_0x518cec=a172_0x73db;(function(_0x54795d,_0x1dbca9){const _0x242e13=a172_0x73db,_0x847ba4=_0x54795d();while(!![]){try{const _0x29a423=-parseInt(_0x242e13(0x18b))/0x1*(-parseInt(_0x242e13(0x1a0))/0x2)+-parseInt(_0x242e13(0x188))/0x3+-parseInt(_0x242e13(0x19e))/0x4*(-parseInt(_0x242e13(0x191))/0x5)+-parseInt(_0x242e13(0x1bc))/0x6+-parseInt(_0x242e13(0x1b7))/0x7+-parseInt(_0x242e13(0x1b3))/0x8+parseInt(_0x242e13(0x1ad))/0x9;if(_0x29a423===_0x1dbca9)break;else _0x847ba4['push'](_0x847ba4['shift']());}catch(_0x2ff41d){_0x847ba4['push'](_0x847ba4['shift']());}}}(a172_0x4107,0x57116));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';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a172_0x4107(){const _0xb29091=['pull','dbId','join','sqlContent','write','\x20SQL\x20file(s)\x20into\x20','sql','string','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Force\x20pull\x20cancelled.','paging','16765335WTCbNi','boolean','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlCode','local\x20differs\x20from\x20remote','sqls','4591776Xvnxpf','would_pull','tableData','push','4456956ZwLpSe','sqlcode','path','Filter\x20by\x20SQL\x20display\x20name','unchanged','4002510qKZoVH','force','catch','skipped','name','sqlName','utf8','cancelled','1319256hixzbV','lastSync','trimStart','53782OqQthf','No\x20remote\x20SQL\x20queries\x20matched.','totalCount','length','description','sqlRootDir','16495mQRiQz','apps','lockFilePath','\x20written,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','bool','mybatisXml','filter','test','appCode','split','POST','sqlRoot','136xHzKTh','Force\x20overwrite\x20local\x20unsynced\x20changes','26fIVcYb','str'];a172_0x4107=function(){return _0xb29091;};return a172_0x4107();}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(_0x2a8bcc,_0x28f66c){const _0x1286b1=a172_0x73db,_0x8a033b=[];let _0xcf9b72=0x1;while(!![]){const _0x2f55d9=await listSqlQueries(_0x2a8bcc,{'currentPage':_0xcf9b72,'pageSize':PAGE_SIZE,'sqlCode':_0x28f66c[_0x1286b1(0x1b0)],'sqlName':_0x28f66c[_0x1286b1(0x185)]}),_0x305d23=_0x2f55d9[_0x1286b1(0x1b5)]??[];_0x8a033b['push'](..._0x305d23);if(_0x305d23[_0x1286b1(0x18e)]===0x0)break;const _0x1a99ce=_0x2f55d9[_0x1286b1(0x1ac)]?.[_0x1286b1(0x18d)];if(_0x1a99ce!=null?_0x8a033b[_0x1286b1(0x18e)]>=_0x1a99ce:_0x305d23[_0x1286b1(0x18e)]<PAGE_SIZE)break;_0xcf9b72++;}return _0x8a033b;}async function ensureSqlContent(_0x3df757){const _0x43c603=a172_0x73db;if(_0x3df757[_0x43c603(0x1a5)]!=null&&String(_0x3df757[_0x43c603(0x1a5)])[_0x43c603(0x18e)]>0x0)return _0x3df757;return getSqlQueryDetail(_0x3df757[_0x43c603(0x1b0)]);}function a172_0x73db(_0x2bbb08,_0x23f962){_0x2bbb08=_0x2bbb08-0x182;const _0x410711=a172_0x4107();let _0x73db98=_0x410711[_0x2bbb08];return _0x73db98;}export const sqlPull={'service':a172_0x518cec(0x1a8),'command':a172_0x518cec(0x1a2),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a172_0x518cec(0x1a6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x518cec(0x184),'type':a172_0x518cec(0x1a9),'description':a172_0x518cec(0x1ba)},{'name':a172_0x518cec(0x1bd),'type':a172_0x518cec(0x1ae),'description':a172_0x518cec(0x19f)}],async 'dryRun'(_0xb456e5){const _0x444027=a172_0x518cec,_0x37fdd2=loadSqlProjectConfig(_0xb456e5[_0x444027(0x19a)]),_0x38eaec=await readSqlLockFile(_0x37fdd2[_0x444027(0x193)]),{appLock:_0x4984c8}=ensureSqlLockScope(_0x38eaec??createEmptySqlLock(),_0x37fdd2[_0x444027(0x19a)],_0x37fdd2[_0x444027(0x19d)],_0x444027(0x1a2)),_0x59503f=await fetchAllSqlQueries(_0xb456e5['appCode'],{'sqlCode':_0xb456e5[_0x444027(0x1a1)](_0x444027(0x1b8))||undefined,'sqlName':_0xb456e5[_0x444027(0x1a1)](_0x444027(0x184))||undefined}),_0x39924e=[];for(const _0x51df11 of _0x59503f){const _0x46f8e8=await ensureSqlContent(_0x51df11),_0x58e130=ensureRemoteSqlContent(_0x46f8e8),_0x30773d=detectModeFromSql(_0x46f8e8),_0x3e871f=_0x46f8e8[_0x444027(0x1a3)]?await getDbName(_0xb456e5[_0x444027(0x19a)],Number(_0x46f8e8['dbId']))[_0x444027(0x182)](()=>undefined):undefined,_0x3e908a=buildLocalSqlFileContent({'sqlCode':_0x46f8e8[_0x444027(0x1b0)],'sqlName':_0x46f8e8[_0x444027(0x185)],'dbId':_0x46f8e8[_0x444027(0x1a3)]},_0x58e130,{'dbName':_0x3e871f,'mode':_0x30773d,'syncedAt':new Date()['toISOString'](),'description':_0x46f8e8['description']}),_0x1d1ca2=buildSqlLockEntry(_0x46f8e8,_0x58e130,'',{'dbName':_0x3e871f}),_0x2c3633=resolveLocalSqlFilePath(_0x37fdd2,_0x46f8e8['sqlCode'],_0x1d1ca2);let _0x7a4cd8=_0x444027(0x1b4),_0x4fc09d;if(await fileExists(_0x2c3633)){const _0x2b86c4=await readFile(_0x2c3633,_0x444027(0x186));isEquivalentPulledSqlFile(_0x2b86c4,_0x3e908a,_0x30773d)?(_0x7a4cd8=_0x444027(0x183),_0x4fc09d=_0x444027(0x1bb)):(_0x7a4cd8='conflict',_0x4fc09d=_0x444027(0x1aa));}_0x39924e[_0x444027(0x1b6)]({'sqlCode':_0x46f8e8[_0x444027(0x1b0)],'sqlName':_0x46f8e8['sqlName'],'filePath':_0x2c3633,'status':_0x7a4cd8,'reason':_0x4fc09d});}return{'method':_0x444027(0x19c),'url':_0x444027(0x1af),'body':{'appCode':_0xb456e5[_0x444027(0x19a)],'sqlCode':_0xb456e5[_0x444027(0x1a1)](_0x444027(0x1b8))||null,'sqlName':_0xb456e5[_0x444027(0x1a1)](_0x444027(0x184))||null,'files':_0x39924e},'description':'Would\x20pull\x20'+_0x39924e[_0x444027(0x18e)]+_0x444027(0x1a7)+_0x37fdd2['sqlRootDir']};},async 'execute'(_0xddccb0){const _0x1e51b5=a172_0x518cec,_0x48bd17=loadSqlProjectConfig(_0xddccb0[_0x1e51b5(0x19a)]),_0x14f8ea=await readSqlLockFile(_0x48bd17[_0x1e51b5(0x193)]),{lockData:_0x145172,appLock:_0x36a21a}=ensureSqlLockScope(_0x14f8ea??createEmptySqlLock(),_0x48bd17[_0x1e51b5(0x19a)],_0x48bd17[_0x1e51b5(0x19d)],'pull'),_0x565b11=_0xddccb0[_0x1e51b5(0x196)]('force'),_0x312b95=await fetchAllSqlQueries(_0xddccb0[_0x1e51b5(0x19a)],{'sqlCode':_0xddccb0['str'](_0x1e51b5(0x1b8))||undefined,'sqlName':_0xddccb0[_0x1e51b5(0x1a1)](_0x1e51b5(0x184))||undefined});if(_0x312b95[_0x1e51b5(0x18e)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x1e51b5(0x18c)};const _0x444039=[],_0x3f82f6=[];for(const _0x53cc83 of _0x312b95){try{_0x444039[_0x1e51b5(0x1b6)](await ensureSqlContent(_0x53cc83));}catch(_0x51b773){_0x3f82f6[_0x1e51b5(0x1b6)]({'sqlCode':_0x53cc83[_0x1e51b5(0x1b0)],'error':_0x51b773 instanceof Error?_0x51b773['message']:String(_0x51b773)});}}if(_0x565b11&&!_0xddccb0['nonInteractive']){let _0x42137c=![];for(const _0x22bccc of _0x444039){const _0x4e563f=detectModeFromSql(_0x22bccc),_0x430140=_0x22bccc[_0x1e51b5(0x1a3)]?await getDbName(_0xddccb0['appCode'],Number(_0x22bccc['dbId']))[_0x1e51b5(0x182)](()=>undefined):undefined,_0x370d03=buildLocalSqlFileContent({'sqlCode':_0x22bccc[_0x1e51b5(0x1b0)],'sqlName':_0x22bccc[_0x1e51b5(0x185)],'dbId':_0x22bccc[_0x1e51b5(0x1a3)]},ensureRemoteSqlContent(_0x22bccc),{'dbName':_0x430140,'mode':_0x4e563f,'syncedAt':new Date()['toISOString'](),'description':_0x22bccc[_0x1e51b5(0x18f)]}),_0x1d331e=resolveLocalSqlFilePath(_0x48bd17,_0x22bccc[_0x1e51b5(0x1b0)],buildSqlLockEntry(_0x22bccc,ensureRemoteSqlContent(_0x22bccc),'',{'dbName':_0x430140}));if(await fileExists(_0x1d331e)){const _0x3aed33=await readFile(_0x1d331e,_0x1e51b5(0x186));if(!isEquivalentPulledSqlFile(_0x3aed33,_0x370d03,_0x4e563f)){_0x42137c=!![];break;}}}if(_0x42137c){const _0x4056b2=await confirmForceOverwrite(_0x1e51b5(0x195));if(!_0x4056b2)throw CliErrors[_0x1e51b5(0x187)](_0x1e51b5(0x1ab));}}const _0x1cefab=cloneSqlLockData(_0x145172),_0x3a699d=_0x1cefab[_0x1e51b5(0x192)][_0x48bd17[_0x1e51b5(0x19a)]],_0x181f62=[],_0xd61585=[];for(const _0x2c4e34 of _0x444039){const _0xccc11b=_0x3a699d[_0x1e51b5(0x1b2)][_0x2c4e34['sqlCode']],_0x32e1da=ensureRemoteSqlContent(_0x2c4e34),_0xa04e86=detectModeFromSql(_0x2c4e34),_0x2d1424=_0x2c4e34[_0x1e51b5(0x1a3)]?await getDbName(_0xddccb0[_0x1e51b5(0x19a)],Number(_0x2c4e34[_0x1e51b5(0x1a3)]))[_0x1e51b5(0x182)](()=>undefined):undefined,_0x4f0a90=buildLocalSqlFileContent({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'sqlName':_0x2c4e34['sqlName'],'dbId':_0x2c4e34[_0x1e51b5(0x1a3)]},_0x32e1da,{'dbName':_0x2d1424,'mode':_0xa04e86,'syncedAt':new Date()['toISOString'](),'description':_0x2c4e34[_0x1e51b5(0x18f)]}),_0x44718a=buildSqlLockEntry(_0x2c4e34,_0x32e1da,computeSqlContentHash(_0x4f0a90),{'dbName':_0x2d1424}),_0x506a97=_0x44718a[_0x1e51b5(0x1b9)],_0x3c89ab=join(_0x48bd17[_0x1e51b5(0x190)],_0x506a97);try{if(await fileExists(_0x3c89ab)){const _0x5b6d9a=await readFile(_0x3c89ab,_0x1e51b5(0x186));if(isEquivalentPulledSqlFile(_0x5b6d9a,_0x4f0a90,_0xa04e86)){_0xd61585[_0x1e51b5(0x1b6)]({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'reason':_0x1e51b5(0x1bb)}),_0x3a699d[_0x1e51b5(0x1b2)][_0x2c4e34[_0x1e51b5(0x1b0)]]={..._0x44718a,'hash':computeSqlContentHash(_0x5b6d9a),'path':_0x506a97};continue;}if(!_0x565b11){_0xd61585[_0x1e51b5(0x1b6)]({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'reason':_0x1e51b5(0x1b1)});continue;}}const _0x27ac51=_0xccc11b?.[_0x1e51b5(0x1b9)]?join(_0x48bd17[_0x1e51b5(0x190)],_0xccc11b[_0x1e51b5(0x1b9)]):undefined;_0x27ac51&&_0x27ac51!==_0x3c89ab&&await fileExists(_0x27ac51)&&await rm(_0x27ac51,{'force':!![]}),await ensureParentDirectory(_0x3c89ab),await writeFile(_0x3c89ab,_0x4f0a90,_0x1e51b5(0x186)),_0x3a699d[_0x1e51b5(0x1b2)][_0x2c4e34[_0x1e51b5(0x1b0)]]={..._0x44718a,'path':_0x506a97},_0x181f62[_0x1e51b5(0x1b6)]({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'filePath':_0x3c89ab});}catch(_0x94f76d){_0x3f82f6[_0x1e51b5(0x1b6)]({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'error':_0x94f76d instanceof Error?_0x94f76d['message']:String(_0x94f76d)});}}return _0x3a699d[_0x1e51b5(0x189)]=new Date()['toISOString'](),await writeSqlLockFile(_0x48bd17[_0x1e51b5(0x193)],_0x1cefab),{'ok':_0x3f82f6[_0x1e51b5(0x18e)]===0x0,'data':{'pulled':_0x181f62,'skipped':_0xd61585,'failed':_0x3f82f6},'message':'Pull\x20complete:\x20'+_0x181f62[_0x1e51b5(0x18e)]+_0x1e51b5(0x194)+_0xd61585[_0x1e51b5(0x18e)]+'\x20skipped,\x20'+_0x3f82f6[_0x1e51b5(0x18e)]+'\x20failed'};}};function detectModeFromSql(_0x2002e4){const _0x4b787c=a172_0x518cec,_0x5943a0=ensureRemoteSqlContent(_0x2002e4),_0xd1ac67=stripLocalSqlMetadata(_0x5943a0,_0x4b787c(0x197))[_0x4b787c(0x18a)]();if(/^<(select|insert|update|delete)\b/i['test'](_0xd1ac67))return _0x4b787c(0x197);return _0x4b787c(0x1a8);}function isEquivalentPulledSqlFile(_0x3e8842,_0x4601e7,_0x4e684c){return normalizePullComparableContent(_0x3e8842,_0x4e684c)===normalizePullComparableContent(_0x4601e7,_0x4e684c);}function normalizePullComparableContent(_0x2ab356,_0x4af141){const _0x382628=a172_0x518cec,_0x206a5d=_0x2ab356['replace'](/\r\n/g,'\x0a')[_0x382628(0x19b)]('\x0a'),_0x6752e6=_0x206a5d[_0x382628(0x198)](_0x4039cd=>!isSyncedAtMetadataLine(_0x4039cd,_0x4af141));return _0x6752e6[_0x382628(0x1a4)]('\x0a');}function isSyncedAtMetadataLine(_0x6a9b82,_0x2d9041){const _0x481f3b=a172_0x518cec;if(_0x2d9041===_0x481f3b(0x197))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x481f3b(0x199)](_0x6a9b82);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x6a9b82);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a173_0x1839b9=a173_0x4ab2;(function(_0x4e4a00,_0x176912){const _0x54eb03=a173_0x4ab2,_0x2f2e2a=_0x4e4a00();while(!![]){try{const _0x20de16=-parseInt(_0x54eb03(0x1b5))/0x1+-parseInt(_0x54eb03(0x1b6))/0x2*(-parseInt(_0x54eb03(0x1a8))/0x3)+-parseInt(_0x54eb03(0x1a9))/0x4+parseInt(_0x54eb03(0x1c5))/0x5+parseInt(_0x54eb03(0x1b9))/0x6+parseInt(_0x54eb03(0x1ae))/0x7+parseInt(_0x54eb03(0x1ba))/0x8;if(_0x20de16===_0x176912)break;else _0x2f2e2a['push'](_0x2f2e2a['shift']());}catch(_0x500938){_0x2f2e2a['push'](_0x2f2e2a['shift']());}}}(a173_0x4d07,0xb11ba));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';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x49c6a0,_0x49c781,_0x16ed82){const _0x402b79=a173_0x4ab2,_0xc1d513=await scanLocalSqlQueries(_0x49c6a0),_0x2ed495=new Map();for(const _0x1844bc of _0xc1d513){if(_0x16ed82&&_0x1844bc[_0x402b79(0x1d2)]!==_0x16ed82)continue;const _0x1b0e3f=_0x2ed495['get'](_0x1844bc['sqlCode'])??[];_0x1b0e3f[_0x402b79(0x1c7)](_0x1844bc),_0x2ed495[_0x402b79(0x1b1)](_0x1844bc[_0x402b79(0x1d2)],_0x1b0e3f);}if(_0x16ed82&&!_0x2ed495[_0x402b79(0x1bd)](_0x16ed82))throw CliErrors[_0x402b79(0x1df)](_0x402b79(0x1b8)+_0x16ed82);const _0x13ed8a=[];for(const [_0x16c361,_0x154b48]of _0x2ed495[_0x402b79(0x1de)]()){if(_0x154b48['length']===0x1){_0x13ed8a[_0x402b79(0x1c7)](_0x154b48[0x0]);continue;}const _0x46dbaf=_0x49c781['sqls'][_0x16c361],_0x3d2f13=_0x46dbaf?.[_0x402b79(0x1cf)],_0x34beb9=_0x3d2f13?_0x154b48[_0x402b79(0x1d5)](_0x4828c2=>_0x4828c2[_0x402b79(0x1dc)]!==_0x3d2f13):_0x154b48;if(_0x46dbaf&&_0x34beb9['length']===0x1){_0x13ed8a['push'](_0x34beb9[0x0]);continue;}throw CliErrors['validation'](_0x402b79(0x1bf)+_0x16c361+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x13ed8a;}export const sqlPush={'service':a173_0x1839b9(0x1dd),'command':a173_0x1839b9(0x1c7),'description':a173_0x1839b9(0x1d6),'risk':a173_0x1839b9(0x1c4),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x1839b9(0x1c6),'type':a173_0x1839b9(0x1cb),'description':a173_0x1839b9(0x1ab)}],async 'dryRun'(_0x51006e){const _0x579cfd=a173_0x1839b9,_0x4242c0=loadSqlProjectConfig(_0x51006e[_0x579cfd(0x1e5)]),_0x9bf743=await readSqlLockFile(_0x4242c0[_0x579cfd(0x1da)]),{appLock:_0x546f71}=ensureSqlLockScope(_0x9bf743??createEmptySqlLock(),_0x51006e[_0x579cfd(0x1e5)],_0x4242c0[_0x579cfd(0x1c9)],_0x579cfd(0x1c7)),_0x16c233=await getTargetSqlQueries(_0x4242c0,_0x546f71,_0x51006e['str'](_0x579cfd(0x1c1))||undefined),_0x51851c=[];for(const _0x32dc7a of _0x16c233){const _0x41e885=await computeSqlFileHash(_0x32dc7a['filePath']),_0x3bae87=_0x546f71[_0x579cfd(0x1ce)][_0x32dc7a[_0x579cfd(0x1d2)]],_0x19405c=!!_0x3bae87&&(_0x3bae87[_0x579cfd(0x1cf)]!==_0x32dc7a[_0x579cfd(0x1dc)]||!!_0x32dc7a[_0x579cfd(0x1d9)]&&_0x3bae87['sqlName']!==_0x32dc7a[_0x579cfd(0x1d9)]);if(!_0x51006e[_0x579cfd(0x1db)]('force')&&_0x3bae87&&_0x3bae87['hash']===_0x41e885&&!_0x19405c)continue;_0x51851c[_0x579cfd(0x1c7)](_0x32dc7a[_0x579cfd(0x1d2)]);}return{'method':_0x579cfd(0x1af),'url':_0x579cfd(0x1ca),'body':{'sqlCodes':_0x51851c,'appCode':_0x51006e[_0x579cfd(0x1e5)]},'description':_0x579cfd(0x1e8)+_0x51851c[_0x579cfd(0x1e9)]+_0x579cfd(0x1d1)};},async 'execute'(_0x5ad2e3){const _0x5be17a=a173_0x1839b9,_0x15efec=loadSqlProjectConfig(_0x5ad2e3[_0x5be17a(0x1e5)]),_0x1c6de3=await readSqlLockFile(_0x15efec['lockFilePath']),{lockData:_0x203a26,appLock:_0x751eb9}=ensureSqlLockScope(_0x1c6de3??createEmptySqlLock(),_0x5ad2e3[_0x5be17a(0x1e5)],_0x15efec['sqlRoot'],_0x5be17a(0x1c7)),_0x357842=await getTargetSqlQueries(_0x15efec,_0x751eb9,_0x5ad2e3[_0x5be17a(0x1ac)](_0x5be17a(0x1c1))||undefined);if(_0x357842[_0x5be17a(0x1e9)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5be17a(0x1d7)};const _0x1f2c08=[],_0x21aa2e=[],_0x4074b7=[];for(const _0x4df687 of _0x357842){const _0x13e3cc=_0x751eb9[_0x5be17a(0x1ce)][_0x4df687[_0x5be17a(0x1d2)]];if(!_0x13e3cc){_0x4074b7[_0x5be17a(0x1c7)]({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x231d9d=await computeSqlFileHash(_0x4df687[_0x5be17a(0x1e6)]),_0x396737=_0x13e3cc[_0x5be17a(0x1cf)]!==_0x4df687['relativePath']||!!_0x4df687[_0x5be17a(0x1d9)]&&_0x13e3cc[_0x5be17a(0x1d9)]!==_0x4df687[_0x5be17a(0x1d9)];if(!_0x5ad2e3[_0x5be17a(0x1db)](_0x5be17a(0x1c6))&&_0x13e3cc[_0x5be17a(0x1e0)]===_0x231d9d&&!_0x396737){_0x21aa2e['push']({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'reason':'unchanged'});continue;}if(_0x13e3cc[_0x5be17a(0x1e7)]==null){_0x4074b7[_0x5be17a(0x1c7)]({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'error':_0x5be17a(0x1b3)});continue;}const _0x4d9e38=await readFile(_0x4df687[_0x5be17a(0x1e6)],_0x5be17a(0x1d3)),_0x1d1f7e=stripLocalSqlMetadata(_0x4d9e38,_0x4df687[_0x5be17a(0x1c2)]),_0x549d61=_0x4df687['sqlName']||_0x13e3cc[_0x5be17a(0x1d9)],_0x4dc4bd=await resolveTargetDbBinding(_0x5ad2e3[_0x5be17a(0x1e5)],_0x4df687,_0x13e3cc),_0x332976=await updateSqlQuery({'id':_0x13e3cc['remoteId'],'appCode':_0x5ad2e3[_0x5be17a(0x1e5)],'sqlCode':_0x4df687['sqlCode'],'sqlName':_0x549d61,'dbId':_0x4dc4bd['dbId'],'version':_0x13e3cc[_0x5be17a(0x1e7)],'sqlContent':_0x1d1f7e,'sqlConfig':_0x13e3cc[_0x5be17a(0x1e4)]??undefined}),_0x1b439d=_0x332976[_0x5be17a(0x1c3)]?await getDbName(_0x5ad2e3[_0x5be17a(0x1e5)],Number(_0x332976[_0x5be17a(0x1c3)]))[_0x5be17a(0x1e2)](()=>_0x4dc4bd[_0x5be17a(0x1be)]):_0x4dc4bd[_0x5be17a(0x1be)];_0x751eb9[_0x5be17a(0x1ce)][_0x4df687['sqlCode']]={...buildSqlLockEntry(_0x332976,_0x1d1f7e,_0x231d9d,{'dbName':_0x1b439d}),'path':_0x4df687[_0x5be17a(0x1dc)],'mode':_0x13e3cc['mode']},await archivePreviousSqlFileIfNeeded(_0x15efec,_0x13e3cc['path'],_0x4df687[_0x5be17a(0x1dc)]),_0x1f2c08['push']({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'remoteId':_0x13e3cc['remoteId']});}catch(_0x7265e9){_0x4074b7[_0x5be17a(0x1c7)]({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'error':_0x7265e9 instanceof Error?_0x7265e9[_0x5be17a(0x1b2)]:String(_0x7265e9)});}}return _0x751eb9[_0x5be17a(0x1b0)]=new Date()['toISOString'](),await writeSqlLockFile(_0x15efec['lockFilePath'],_0x203a26),{'ok':_0x4074b7[_0x5be17a(0x1e9)]===0x0,'data':{'pushed':_0x1f2c08,'skipped':_0x21aa2e,'failed':_0x4074b7},'message':_0x5be17a(0x1cc)+_0x1f2c08[_0x5be17a(0x1e9)]+_0x5be17a(0x1d4)+_0x21aa2e[_0x5be17a(0x1e9)]+_0x5be17a(0x1b7)+_0x4074b7['length']+_0x5be17a(0x1c8)};}};function a173_0x4d07(){const _0x2354a8=['990026dmbdrj','\x20skipped,\x20','Local\x20SQL\x20not\x20found:\x20','2188098GkqNjS','9325880bqIbts','isFinite','join','has','dbName','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','\x22\x20for\x20sqlCode\x20','sqlcode','mode','dbId','high-risk-write','127310lHhrpM','force','push','\x20failed','sqlRoot','/smartapi/custom/updateUserCustomSql','boolean','Push\x20complete:\x20','toISOString','sqls','path','replace','\x20SQL\x20file(s)','sqlCode','utf8','\x20pushed,\x20','filter','Push\x20local\x20SQL\x20files\x20to\x20remote','No\x20local\x20SQL\x20files\x20found.','sqlRootDir','sqlName','lockFilePath','bool','relativePath','sql','entries','validation','hash','trashDir','catch','No\x20database\x20matches\x20local\x20directory\x20\x22','sqlConfig','appCode','filePath','version','Would\x20push\x20','length','exec','3zJdbxT','3139020vteTOG','startsWith','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','str','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','6095152CiEhxC','POST','lastSync','set','message','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','projectRoot','1411440VKboer'];a173_0x4d07=function(){return _0x2354a8;};return a173_0x4d07();}function a173_0x4ab2(_0x46573c,_0x5401ec){_0x46573c=_0x46573c-0x1a8;const _0x4d07a0=a173_0x4d07();let _0x4ab24b=_0x4d07a0[_0x46573c];return _0x4ab24b;}async function archivePreviousSqlFileIfNeeded(_0x1d9705,_0x17611c,_0x4c3bc1){const _0x59aa34=a173_0x1839b9;if(!_0x17611c||_0x17611c===_0x4c3bc1)return;const _0x585135=join(_0x1d9705['sqlRootDir'],_0x17611c);if(!await fileExists(_0x585135))return;const _0x191caa=await moveToTrash(_0x1d9705[_0x59aa34(0x1b4)],_0x1d9705[_0x59aa34(0x1e1)],_0x585135);await cleanupEmptyDirectories(dirname(_0x585135),_0x1d9705[_0x59aa34(0x1d8)]),void _0x191caa;}async function moveToTrash(_0x22710a,_0x3e81a4,_0x21176b){const _0x3ee9b8=a173_0x1839b9,_0x59b0c4=new Date()[_0x3ee9b8(0x1cd)]()[_0x3ee9b8(0x1d0)](/[:.]/g,'-'),_0xeb372d=relative(_0x22710a,_0x21176b),_0x9b88cc=join(_0x3e81a4,_0x59b0c4,_0xeb372d);return await mkdir(dirname(_0x9b88cc),{'recursive':!![]}),await rename(_0x21176b,_0x9b88cc),_0x9b88cc;}async function cleanupEmptyDirectories(_0x3eab05,_0x19adf1){const _0x109e45=a173_0x1839b9;let _0x2f1e4e=resolve(_0x3eab05);const _0x145892=resolve(_0x19adf1);while(_0x2f1e4e[_0x109e45(0x1aa)](''+_0x145892+sep)||_0x2f1e4e===_0x145892){if(_0x2f1e4e===_0x145892)return;try{const _0x53f95d=await readdir(_0x2f1e4e);if(_0x53f95d[_0x109e45(0x1e9)]>0x0)return;await rmdir(_0x2f1e4e);}catch{return;}_0x2f1e4e=dirname(_0x2f1e4e);}}async function resolveTargetDbBinding(_0x3188ef,_0x4ad894,_0x34202b){const _0x1de28c=a173_0x1839b9,_0x440ac4=_0x4ad894['dbDirectory'];if(!_0x440ac4)return{'dbId':_0x34202b[_0x1de28c(0x1c3)],'dbName':_0x34202b[_0x1de28c(0x1be)]};const _0x3b815c=buildDbDirectoryName(_0x34202b[_0x1de28c(0x1be)],_0x34202b['dbId']);if(_0x440ac4===_0x3b815c)return{'dbId':_0x34202b['dbId'],'dbName':_0x34202b[_0x1de28c(0x1be)]};const _0x52375d=parseExplicitDbDirectory(_0x440ac4);if(_0x52375d!=null)return{'dbId':_0x52375d,'dbName':await getDbName(_0x3188ef,_0x52375d)['catch'](()=>undefined)};const _0x48f845=await listDatabases(_0x3188ef),_0x4596f8=_0x48f845[_0x1de28c(0x1d5)](_0x1d6783=>buildDbDirectoryName(_0x1d6783['dbName'],_0x1d6783[_0x1de28c(0x1c3)])===_0x440ac4);if(_0x4596f8[_0x1de28c(0x1e9)]===0x1)return{'dbId':_0x4596f8[0x0][_0x1de28c(0x1c3)],'dbName':_0x4596f8[0x0][_0x1de28c(0x1be)]};if(_0x4596f8['length']===0x0)throw CliErrors['validation'](_0x1de28c(0x1e3)+_0x440ac4+_0x1de28c(0x1c0)+_0x4ad894[_0x1de28c(0x1d2)]+'.');const _0x5ebc6a=_0x4596f8['map'](_0xb53095=>_0xb53095[_0x1de28c(0x1be)]+'\x20('+_0xb53095['dbId']+')')[_0x1de28c(0x1bc)](',\x20');throw CliErrors[_0x1de28c(0x1df)]('Local\x20directory\x20\x22'+_0x440ac4+_0x1de28c(0x1ad)+_0x4ad894['sqlCode']+':\x20'+_0x5ebc6a);}function parseExplicitDbDirectory(_0x571bdd){const _0x58afc8=a173_0x1839b9,_0xe4a8b7=/^db-(\d+)$/[_0x58afc8(0x1ea)](_0x571bdd);if(!_0xe4a8b7)return null;const _0x153dca=Number(_0xe4a8b7[0x1]);return Number[_0x58afc8(0x1bb)](_0x153dca)&&_0x153dca>0x0?_0x153dca:null;}
|
|
1
|
+
const a173_0x186e53=a173_0x1ff8;(function(_0x99c2ac,_0x3e980a){const _0x17c32c=a173_0x1ff8,_0x3235c7=_0x99c2ac();while(!![]){try{const _0x514a6a=-parseInt(_0x17c32c(0x188))/0x1+-parseInt(_0x17c32c(0x19c))/0x2+-parseInt(_0x17c32c(0x198))/0x3*(-parseInt(_0x17c32c(0x164))/0x4)+-parseInt(_0x17c32c(0x16a))/0x5*(parseInt(_0x17c32c(0x189))/0x6)+parseInt(_0x17c32c(0x19b))/0x7*(-parseInt(_0x17c32c(0x18d))/0x8)+-parseInt(_0x17c32c(0x162))/0x9+parseInt(_0x17c32c(0x199))/0xa;if(_0x514a6a===_0x3e980a)break;else _0x3235c7['push'](_0x3235c7['shift']());}catch(_0x42ca2c){_0x3235c7['push'](_0x3235c7['shift']());}}}(a173_0x5a52,0x9c5f9));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';function a173_0x5a52(){const _0x9218f5=['828748hCtEIJ','has','dbDirectory','Would\x20push\x20','trashDir','mode','3872570iPzHLP','\x20SQL\x20file(s)','version','dbName','sqlName','relativePath','catch','dbId','high-risk-write','remoteId','toISOString','Local\x20directory\x20\x22','lockFilePath','No\x20local\x20SQL\x20files\x20found.','sqls','set','filePath','push','appCode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlRoot','filter','validation','force','str','sqlcode','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','\x20pushed,\x20','\x20skipped,\x20','\x22\x20for\x20sqlCode\x20','288353HcVVRS','6gxmMBN','POST','map','join','4970744brgqkT','No\x20database\x20matches\x20local\x20directory\x20\x22','message','hash','sql','path','entries','isFinite','length','bool','Push\x20complete:\x20','3nQQHZo','40727160zwNGCM','sqlCode','14mSeAXO','1277854CKRIFD','Push\x20local\x20SQL\x20files\x20to\x20remote','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','6254262ABWGIp','boolean'];a173_0x5a52=function(){return _0x9218f5;};return a173_0x5a52();}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a173_0x1ff8(_0x30b46c,_0x1517a1){_0x30b46c=_0x30b46c-0x160;const _0x5a52db=a173_0x5a52();let _0x1ff8c3=_0x5a52db[_0x30b46c];return _0x1ff8c3;}async function getTargetSqlQueries(_0x30310b,_0x1b4d71,_0x24b4ae){const _0x378916=a173_0x1ff8,_0x10f0c0=await scanLocalSqlQueries(_0x30310b),_0x253078=new Map();for(const _0x4cd2a6 of _0x10f0c0){if(_0x24b4ae&&_0x4cd2a6['sqlCode']!==_0x24b4ae)continue;const _0xcd7544=_0x253078['get'](_0x4cd2a6['sqlCode'])??[];_0xcd7544[_0x378916(0x17b)](_0x4cd2a6),_0x253078[_0x378916(0x179)](_0x4cd2a6['sqlCode'],_0xcd7544);}if(_0x24b4ae&&!_0x253078[_0x378916(0x165)](_0x24b4ae))throw CliErrors[_0x378916(0x180)]('Local\x20SQL\x20not\x20found:\x20'+_0x24b4ae);const _0xfe2d71=[];for(const [_0x45633a,_0x15bd23]of _0x253078[_0x378916(0x193)]()){if(_0x15bd23[_0x378916(0x195)]===0x1){_0xfe2d71[_0x378916(0x17b)](_0x15bd23[0x0]);continue;}const _0x5bb241=_0x1b4d71['sqls'][_0x45633a],_0x311a0b=_0x5bb241?.['path'],_0x5bc0d7=_0x311a0b?_0x15bd23['filter'](_0x393e57=>_0x393e57[_0x378916(0x16f)]!==_0x311a0b):_0x15bd23;if(_0x5bb241&&_0x5bc0d7[_0x378916(0x195)]===0x1){_0xfe2d71[_0x378916(0x17b)](_0x5bc0d7[0x0]);continue;}throw CliErrors[_0x378916(0x180)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x45633a+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0xfe2d71;}export const sqlPush={'service':a173_0x186e53(0x191),'command':a173_0x186e53(0x17b),'description':a173_0x186e53(0x160),'risk':a173_0x186e53(0x172),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x186e53(0x181),'type':a173_0x186e53(0x163),'description':a173_0x186e53(0x184)}],async 'dryRun'(_0x1f5007){const _0x2fb114=a173_0x186e53,_0xf92402=loadSqlProjectConfig(_0x1f5007[_0x2fb114(0x17c)]),_0x1be2a0=await readSqlLockFile(_0xf92402[_0x2fb114(0x176)]),{appLock:_0x1b481c}=ensureSqlLockScope(_0x1be2a0??createEmptySqlLock(),_0x1f5007[_0x2fb114(0x17c)],_0xf92402[_0x2fb114(0x17e)],_0x2fb114(0x17b)),_0x3110cd=await getTargetSqlQueries(_0xf92402,_0x1b481c,_0x1f5007[_0x2fb114(0x182)](_0x2fb114(0x183))||undefined),_0x26dbae=[];for(const _0x34b3b1 of _0x3110cd){const _0x27ac61=await computeSqlFileHash(_0x34b3b1[_0x2fb114(0x17a)]),_0x29dc6f=_0x1b481c[_0x2fb114(0x178)][_0x34b3b1['sqlCode']],_0xbab337=!!_0x29dc6f&&(_0x29dc6f['path']!==_0x34b3b1[_0x2fb114(0x16f)]||!!_0x34b3b1[_0x2fb114(0x16e)]&&_0x29dc6f[_0x2fb114(0x16e)]!==_0x34b3b1[_0x2fb114(0x16e)]);if(!_0x1f5007[_0x2fb114(0x196)](_0x2fb114(0x181))&&_0x29dc6f&&_0x29dc6f[_0x2fb114(0x190)]===_0x27ac61&&!_0xbab337)continue;_0x26dbae[_0x2fb114(0x17b)](_0x34b3b1[_0x2fb114(0x19a)]);}return{'method':_0x2fb114(0x18a),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x26dbae,'appCode':_0x1f5007[_0x2fb114(0x17c)]},'description':_0x2fb114(0x167)+_0x26dbae[_0x2fb114(0x195)]+_0x2fb114(0x16b)};},async 'execute'(_0x2ccbb7){const _0x4a63b1=a173_0x186e53,_0x2b632b=loadSqlProjectConfig(_0x2ccbb7['appCode']),_0x2c83ea=await readSqlLockFile(_0x2b632b[_0x4a63b1(0x176)]),{lockData:_0xd5023b,appLock:_0x2830c1}=ensureSqlLockScope(_0x2c83ea??createEmptySqlLock(),_0x2ccbb7[_0x4a63b1(0x17c)],_0x2b632b['sqlRoot'],_0x4a63b1(0x17b)),_0x10c2af=await getTargetSqlQueries(_0x2b632b,_0x2830c1,_0x2ccbb7[_0x4a63b1(0x182)](_0x4a63b1(0x183))||undefined);if(_0x10c2af[_0x4a63b1(0x195)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4a63b1(0x177)};const _0x4daa37=[],_0x1bcd47=[],_0x301b70=[];for(const _0x11d819 of _0x10c2af){const _0x5ea23c=_0x2830c1[_0x4a63b1(0x178)][_0x11d819[_0x4a63b1(0x19a)]];if(!_0x5ea23c){_0x301b70[_0x4a63b1(0x17b)]({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'error':_0x4a63b1(0x161)});continue;}try{const _0x18afa4=await computeSqlFileHash(_0x11d819[_0x4a63b1(0x17a)]),_0x4574e3=_0x5ea23c[_0x4a63b1(0x192)]!==_0x11d819[_0x4a63b1(0x16f)]||!!_0x11d819[_0x4a63b1(0x16e)]&&_0x5ea23c[_0x4a63b1(0x16e)]!==_0x11d819['sqlName'];if(!_0x2ccbb7[_0x4a63b1(0x196)]('force')&&_0x5ea23c[_0x4a63b1(0x190)]===_0x18afa4&&!_0x4574e3){_0x1bcd47[_0x4a63b1(0x17b)]({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'reason':'unchanged'});continue;}if(_0x5ea23c[_0x4a63b1(0x16c)]==null){_0x301b70['push']({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'error':_0x4a63b1(0x17d)});continue;}const _0x2c1498=await readFile(_0x11d819['filePath'],'utf8'),_0x4ae0a2=stripLocalSqlMetadata(_0x2c1498,_0x11d819['mode']),_0xf7f079=_0x11d819[_0x4a63b1(0x16e)]||_0x5ea23c[_0x4a63b1(0x16e)],_0x5dbe37=await resolveTargetDbBinding(_0x2ccbb7[_0x4a63b1(0x17c)],_0x11d819,_0x5ea23c),_0x5b51ad=await updateSqlQuery({'id':_0x5ea23c[_0x4a63b1(0x173)],'appCode':_0x2ccbb7['appCode'],'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'sqlName':_0xf7f079,'dbId':_0x5dbe37['dbId'],'version':_0x5ea23c[_0x4a63b1(0x16c)],'sqlContent':_0x4ae0a2,'sqlConfig':_0x5ea23c['sqlConfig']??undefined}),_0x404876=_0x5b51ad[_0x4a63b1(0x171)]?await getDbName(_0x2ccbb7[_0x4a63b1(0x17c)],Number(_0x5b51ad[_0x4a63b1(0x171)]))[_0x4a63b1(0x170)](()=>_0x5dbe37['dbName']):_0x5dbe37[_0x4a63b1(0x16d)];_0x2830c1['sqls'][_0x11d819[_0x4a63b1(0x19a)]]={...buildSqlLockEntry(_0x5b51ad,_0x4ae0a2,_0x18afa4,{'dbName':_0x404876}),'path':_0x11d819[_0x4a63b1(0x16f)],'mode':_0x5ea23c[_0x4a63b1(0x169)]},await archivePreviousSqlFileIfNeeded(_0x2b632b,_0x5ea23c[_0x4a63b1(0x192)],_0x11d819['relativePath']),_0x4daa37[_0x4a63b1(0x17b)]({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'remoteId':_0x5ea23c[_0x4a63b1(0x173)]});}catch(_0x2f04ce){_0x301b70[_0x4a63b1(0x17b)]({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'error':_0x2f04ce instanceof Error?_0x2f04ce[_0x4a63b1(0x18f)]:String(_0x2f04ce)});}}return _0x2830c1['lastSync']=new Date()[_0x4a63b1(0x174)](),await writeSqlLockFile(_0x2b632b['lockFilePath'],_0xd5023b),{'ok':_0x301b70[_0x4a63b1(0x195)]===0x0,'data':{'pushed':_0x4daa37,'skipped':_0x1bcd47,'failed':_0x301b70},'message':_0x4a63b1(0x197)+_0x4daa37['length']+_0x4a63b1(0x185)+_0x1bcd47[_0x4a63b1(0x195)]+_0x4a63b1(0x186)+_0x301b70[_0x4a63b1(0x195)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x37614a,_0x5847dc,_0x3279a0){const _0x1934c0=a173_0x186e53;if(!_0x5847dc||_0x5847dc===_0x3279a0)return;const _0x1b5712=join(_0x37614a['sqlRootDir'],_0x5847dc);if(!await fileExists(_0x1b5712))return;const _0x4bdb52=await moveToTrash(_0x37614a['projectRoot'],_0x37614a[_0x1934c0(0x168)],_0x1b5712);await cleanupEmptyDirectories(dirname(_0x1b5712),_0x37614a['sqlRootDir']),void _0x4bdb52;}async function moveToTrash(_0x234428,_0x1580ea,_0x13ac7f){const _0x203a50=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x5740a5=relative(_0x234428,_0x13ac7f),_0x3ed478=join(_0x1580ea,_0x203a50,_0x5740a5);return await mkdir(dirname(_0x3ed478),{'recursive':!![]}),await rename(_0x13ac7f,_0x3ed478),_0x3ed478;}async function cleanupEmptyDirectories(_0x250c9f,_0x3f3462){const _0x3d28fa=a173_0x186e53;let _0x490d97=resolve(_0x250c9f);const _0x13e60d=resolve(_0x3f3462);while(_0x490d97['startsWith'](''+_0x13e60d+sep)||_0x490d97===_0x13e60d){if(_0x490d97===_0x13e60d)return;try{const _0x536a60=await readdir(_0x490d97);if(_0x536a60[_0x3d28fa(0x195)]>0x0)return;await rmdir(_0x490d97);}catch{return;}_0x490d97=dirname(_0x490d97);}}async function resolveTargetDbBinding(_0x5bb2dc,_0x1caea1,_0x38c50c){const _0x3bc29a=a173_0x186e53,_0x1f0c81=_0x1caea1[_0x3bc29a(0x166)];if(!_0x1f0c81)return{'dbId':_0x38c50c[_0x3bc29a(0x171)],'dbName':_0x38c50c[_0x3bc29a(0x16d)]};const _0x5aed43=buildDbDirectoryName(_0x38c50c['dbName'],_0x38c50c[_0x3bc29a(0x171)]);if(_0x1f0c81===_0x5aed43)return{'dbId':_0x38c50c['dbId'],'dbName':_0x38c50c[_0x3bc29a(0x16d)]};const _0x41d25d=parseExplicitDbDirectory(_0x1f0c81);if(_0x41d25d!=null)return{'dbId':_0x41d25d,'dbName':await getDbName(_0x5bb2dc,_0x41d25d)[_0x3bc29a(0x170)](()=>undefined)};const _0x2c25c0=await listDatabases(_0x5bb2dc),_0x2da950=_0x2c25c0[_0x3bc29a(0x17f)](_0x5e0462=>buildDbDirectoryName(_0x5e0462['dbName'],_0x5e0462[_0x3bc29a(0x171)])===_0x1f0c81);if(_0x2da950['length']===0x1)return{'dbId':_0x2da950[0x0][_0x3bc29a(0x171)],'dbName':_0x2da950[0x0]['dbName']};if(_0x2da950[_0x3bc29a(0x195)]===0x0)throw CliErrors['validation'](_0x3bc29a(0x18e)+_0x1f0c81+_0x3bc29a(0x187)+_0x1caea1[_0x3bc29a(0x19a)]+'.');const _0x299684=_0x2da950[_0x3bc29a(0x18b)](_0x57d80f=>_0x57d80f[_0x3bc29a(0x16d)]+'\x20('+_0x57d80f[_0x3bc29a(0x171)]+')')[_0x3bc29a(0x18c)](',\x20');throw CliErrors[_0x3bc29a(0x180)](_0x3bc29a(0x175)+_0x1f0c81+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x1caea1[_0x3bc29a(0x19a)]+':\x20'+_0x299684);}function parseExplicitDbDirectory(_0xad8a88){const _0x4bcd6a=a173_0x186e53,_0x47532b=/^db-(\d+)$/['exec'](_0xad8a88);if(!_0x47532b)return null;const _0x4dfda9=Number(_0x47532b[0x1]);return Number[_0x4bcd6a(0x194)](_0x4dfda9)&&_0x4dfda9>0x0?_0x4dfda9:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a174_0x1d0864=a174_0x5cdd;function a174_0x5cdd(_0x523812,_0x404deb){_0x523812=_0x523812-0x1a9;const _0x7b083d=a174_0x7b08();let _0x5cdd11=_0x7b083d[_0x523812];return _0x5cdd11;}(function(_0x2a1244,_0x489c42){const _0x184037=a174_0x5cdd,_0x523041=_0x2a1244();while(!![]){try{const _0x36da95=parseInt(_0x184037(0x1b9))/0x1+parseInt(_0x184037(0x1b7))/0x2+-parseInt(_0x184037(0x1bc))/0x3*(-parseInt(_0x184037(0x1be))/0x4)+-parseInt(_0x184037(0x1b3))/0x5+parseInt(_0x184037(0x1b8))/0x6*(parseInt(_0x184037(0x1b4))/0x7)+parseInt(_0x184037(0x1a9))/0x8*(parseInt(_0x184037(0x1b6))/0x9)+parseInt(_0x184037(0x1b2))/0xa*(-parseInt(_0x184037(0x1ab))/0xb);if(_0x36da95===_0x489c42)break;else _0x523041['push'](_0x523041['shift']());}catch(_0x5e6f7d){_0x523041['push'](_0x523041['shift']());}}}(a174_0x7b08,0x45e80));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a174_0x1d0864(0x1af),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a174_0x1d0864(0x1aa)][a174_0x1d0864(0x1b0)]('\x0a');export const sqlSave={'service':a174_0x1d0864(0x1ad),'command':'save','description':a174_0x1d0864(0x1c1),'risk':a174_0x1d0864(0x1b5),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a174_0x1d0864(0x1bd),'type':'string','required':!![],'description':a174_0x1d0864(0x1ac)},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':a174_0x1d0864(0x1ba),'description':a174_0x1d0864(0x1bf)},{'name':'db','type':a174_0x1d0864(0x1ba),'description':a174_0x1d0864(0x1bb)},{'name':a174_0x1d0864(0x1c0),'type':a174_0x1d0864(0x1ba),'description':a174_0x1d0864(0x1b1)}],async 'validate'(){const _0x4c36b8=a174_0x1d0864;throw CliErrors[_0x4c36b8(0x1ae)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x41780b=a174_0x1d0864;throw CliErrors[_0x41780b(0x1ae)](SQL_SAVE_DEPRECATED_HINT);}};function a174_0x7b08(){const _0x311480=['576910daLOCc','2173710XSIZZo','345989fnsmZf','write','99wbKYwP','741894nxhSOK','42WJpSSA','180760Iohwrz','string','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','102ymWYib','file','6020TgyWNu','SQL\x20query\x20display\x20name','description','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','295864VPmDeN','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`.','121ytcFqT','Path\x20to\x20the\x20SQL\x20file','sql','validation','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','join','Query\x20description'];a174_0x7b08=function(){return _0x311480;};return a174_0x7b08();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a175_0x4b01d5=a175_0x56d7;(function(_0x19f4dc,_0x443712){const _0x465d5a=a175_0x56d7,_0x12ec47=_0x19f4dc();while(!![]){try{const _0x58b35b=-parseInt(_0x465d5a(0xec))/0x1*(-parseInt(_0x465d5a(0xd0))/0x2)+parseInt(_0x465d5a(0xd6))/0x3+-parseInt(_0x465d5a(0xe6))/0x4+-parseInt(_0x465d5a(0xe7))/0x5*(-parseInt(_0x465d5a(0xd7))/0x6)+-parseInt(_0x465d5a(0xea))/0x7*(parseInt(_0x465d5a(0xdd))/0x8)+parseInt(_0x465d5a(0xc7))/0x9+-parseInt(_0x465d5a(0xe2))/0xa*(parseInt(_0x465d5a(0xc6))/0xb);if(_0x58b35b===_0x443712)break;else _0x12ec47['push'](_0x12ec47['shift']());}catch(_0x557e2f){_0x12ec47['push'](_0x12ec47['shift']());}}}(a175_0x3239,0xb0231));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a175_0x4b01d5(0xd8);export function buildSqlLockEntry(_0x3fb224,_0x3edc2c,_0x2c2e17,_0x1b8fa8){const _0x5f02ef=a175_0x4b01d5,_0x2fd43b=detectSqlMode(_0x3edc2c);return{'path':buildSqlRelativePath(_0x3fb224[_0x5f02ef(0xcc)],_0x3fb224[_0x5f02ef(0xeb)],_0x1b8fa8?.['dbName'],_0x2fd43b,_0x3fb224['dbId']),'hash':_0x2c2e17,'remoteId':_0x3fb224['id'],'version':_0x3fb224[_0x5f02ef(0xc8)],'dbId':Number(_0x3fb224[_0x5f02ef(0xbf)]),'dbName':_0x1b8fa8?.[_0x5f02ef(0xe4)],'sqlName':_0x3fb224[_0x5f02ef(0xeb)],'sqlConfig':_0x3fb224['sqlConfig']??undefined,'mode':_0x2fd43b};}export function cloneSqlLockData(_0xe08492){const _0x133bff=a175_0x4b01d5;return{'apps':Object['fromEntries'](Object[_0x133bff(0xe0)](_0xe08492[_0x133bff(0xcf)])[_0x133bff(0xe1)](([_0x16973c,_0x495cbb])=>[_0x16973c,{'sqlRoot':_0x495cbb[_0x133bff(0xe9)],'lastSync':_0x495cbb['lastSync'],'sqls':{..._0x495cbb[_0x133bff(0xc2)]}}]))};}export function ensureRemoteSqlContent(_0x3a99ce){const _0x379c5a=a175_0x4b01d5;return _0x3a99ce[_0x379c5a(0xce)]??'';}function a175_0x3239(){const _0x4c7353=['version','length','toLowerCase','yes','sqlCode','question','sqlContent','apps','2026QPKCHj','join','--\x20@lovrabet.','mode','trimStart','\x20-->','1397538dIRiQL','102xhSsEQ','.rabetbase/sql','mybatisXml','syncedAt','\x20[y/N]\x20','push','3246968YNZmvw','path','<!--\x20@lovrabet.','entries','map','2952850dvcFyi','close','dbName','trim','2287424rRjWnn','295755TYPLua','includes','sqlRoot','14hOhZDF','sqlName','1109NNPArL','dbId','stdin','description','sqls','replace','stderr','test','22QwLyvU','907155MGCCDt'];a175_0x3239=function(){return _0x4c7353;};return a175_0x3239();}export function buildLocalSqlFileContent(_0x26c18b,_0xa2f086,_0x1836f8){const _0x1eeeb1=a175_0x4b01d5,_0x196f4c=_0x1836f8?.[_0x1eeeb1(0xd3)]??detectSqlMode(_0xa2f086),_0xc40e23=stripLocalSqlMetadata(_0xa2f086,_0x196f4c)[_0x1eeeb1(0xe5)](),_0x54a605=[...buildMetadataHeaderLines({'sqlCode':_0x26c18b['sqlCode'],'sqlName':_0x26c18b[_0x1eeeb1(0xeb)],'dbId':_0x26c18b[_0x1eeeb1(0xbf)],'dbName':_0x1836f8?.[_0x1eeeb1(0xe4)],'mode':_0x196f4c,'syncedAt':_0x1836f8?.['syncedAt'],'description':_0x1836f8?.[_0x1eeeb1(0xc1)]},_0x196f4c),'',_0xc40e23],_0x3738a0=_0x54a605[_0x1eeeb1(0xd1)]('\x0a');return _0x3738a0['endsWith']('\x0a')?_0x3738a0:_0x3738a0+'\x0a';}export function stripLocalSqlMetadata(_0x53d536,_0xfef4ab){const _0x1c628d=a175_0x4b01d5,_0x30b014=_0x53d536[_0x1c628d(0xc3)](/\r\n/g,'\x0a')['split']('\x0a'),_0x37eab5=[];let _0x29ee10=0x0;if(_0xfef4ab===_0x1c628d(0xd9))while(_0x29ee10<_0x30b014[_0x1c628d(0xc9)]){const _0x34806d=_0x30b014[_0x29ee10]??'';if(/^\s*<!--\s*@lovrabet\./[_0x1c628d(0xc5)](_0x34806d)){_0x29ee10++;continue;}if(_0x34806d['trim']()===''&&_0x29ee10>0x0){_0x29ee10++;continue;}break;}else while(_0x29ee10<_0x30b014[_0x1c628d(0xc9)]){const _0x36f21d=_0x30b014[_0x29ee10]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x36f21d)){_0x29ee10++;continue;}if(_0x36f21d[_0x1c628d(0xe5)]()===''&&_0x29ee10>0x0){_0x29ee10++;continue;}break;}for(;_0x29ee10<_0x30b014[_0x1c628d(0xc9)];_0x29ee10++){_0x37eab5[_0x1c628d(0xdc)](_0x30b014[_0x29ee10]);}return _0x37eab5[_0x1c628d(0xd1)]('\x0a')[_0x1c628d(0xd4)]();}function a175_0x56d7(_0x15aa56,_0x2eaf52){_0x15aa56=_0x15aa56-0xbf;const _0x32398b=a175_0x3239();let _0x56d7aa=_0x32398b[_0x15aa56];return _0x56d7aa;}export function resolveSqlMode(_0x5b90a4,_0x5b0344){const _0x564eb7=a175_0x4b01d5;if(_0x5b0344?.[_0x564eb7(0xd3)])return _0x5b0344[_0x564eb7(0xd3)];return detectSqlMode(_0x5b90a4);}export function resolveSqlFileName(_0x461abe,_0xf168f1,_0x32dc72){const _0x5a9dc1=a175_0x4b01d5;if(_0x32dc72?.[_0x5a9dc1(0xde)])return _0x32dc72[_0x5a9dc1(0xde)];if(_0x32dc72?.[_0x5a9dc1(0xeb)]||_0x32dc72?.['dbName'])return buildSqlRelativePath(_0x461abe,_0x32dc72?.[_0x5a9dc1(0xeb)],_0x32dc72?.['dbName'],resolveSqlMode(_0xf168f1,_0x32dc72),_0x32dc72?.['dbId']);return buildDefaultSqlFileName(_0x461abe,resolveSqlMode(_0xf168f1,_0x32dc72));}export function resolveSqlLocalDir(_0x416b12,_0x25a877){return join(_0x416b12,SQL_LOCAL_REL_DIR,_0x25a877);}export async function confirmForceOverwrite(_0x468b6d){const _0x271fef=a175_0x4b01d5,_0x1774b0=createInterface({'input':process[_0x271fef(0xc0)],'output':process[_0x271fef(0xc4)]}),_0x1b59d5=await new Promise(_0x510c01=>{const _0x18b279=_0x271fef;_0x1774b0[_0x18b279(0xcd)](_0x468b6d+_0x18b279(0xdb),_0x510c01);});return _0x1774b0[_0x271fef(0xe3)](),['y',_0x271fef(0xcb)][_0x271fef(0xe8)](_0x1b59d5[_0x271fef(0xe5)]()[_0x271fef(0xca)]());}export function findSqlLockScope(_0x3c888b,_0xe4c11c){return _0x3c888b['apps'][_0xe4c11c];}function buildMetadataHeaderLines(_0x4dc463,_0x38ad5c){const _0x14f5ad=a175_0x4b01d5,_0x2c8919=[['sqlCode',_0x4dc463['sqlCode']],['sqlName',_0x4dc463['sqlName']],['dbId',_0x4dc463[_0x14f5ad(0xbf)]],['dbName',_0x4dc463[_0x14f5ad(0xe4)]],['mode',_0x4dc463[_0x14f5ad(0xd3)]],['syncedAt',_0x4dc463[_0x14f5ad(0xda)]],[_0x14f5ad(0xc1),_0x4dc463[_0x14f5ad(0xc1)]]];if(_0x38ad5c==='mybatisXml')return _0x2c8919['filter'](([,_0xf10706])=>_0xf10706!==undefined&&_0xf10706!==null&&String(_0xf10706)[_0x14f5ad(0xe5)]()!=='')[_0x14f5ad(0xe1)](([_0x513524,_0xc1d628])=>_0x14f5ad(0xdf)+_0x513524+':\x20'+String(_0xc1d628)+_0x14f5ad(0xd5));return _0x2c8919['filter'](([,_0x55f476])=>_0x55f476!==undefined&&_0x55f476!==null&&String(_0x55f476)[_0x14f5ad(0xe5)]()!=='')[_0x14f5ad(0xe1)](([_0x4fcc65,_0x474335])=>_0x14f5ad(0xd2)+_0x4fcc65+':\x20'+String(_0x474335));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a176_0x3ff0(_0x1e11b1,_0x5357e4){_0x1e11b1=_0x1e11b1-0x1b7;const _0x3c3a1f=a176_0x3c3a();let _0x3ff012=_0x3c3a1f[_0x1e11b1];return _0x3ff012;}const a176_0x19fb26=a176_0x3ff0;(function(_0x499430,_0x177b7a){const _0x20f9bb=a176_0x3ff0,_0x5a22d9=_0x499430();while(!![]){try{const _0xff220f=parseInt(_0x20f9bb(0x1dd))/0x1*(-parseInt(_0x20f9bb(0x1bc))/0x2)+-parseInt(_0x20f9bb(0x1cc))/0x3+-parseInt(_0x20f9bb(0x1d3))/0x4*(parseInt(_0x20f9bb(0x1c3))/0x5)+parseInt(_0x20f9bb(0x1e0))/0x6+parseInt(_0x20f9bb(0x1cb))/0x7*(parseInt(_0x20f9bb(0x1d4))/0x8)+-parseInt(_0x20f9bb(0x1b8))/0x9*(parseInt(_0x20f9bb(0x1be))/0xa)+-parseInt(_0x20f9bb(0x1b7))/0xb*(-parseInt(_0x20f9bb(0x1c5))/0xc);if(_0xff220f===_0x177b7a)break;else _0x5a22d9['push'](_0x5a22d9['shift']());}catch(_0xe70836){_0x5a22d9['push'](_0x5a22d9['shift']());}}}(a176_0x3c3a,0xaaa2e));function a176_0x3c3a(){const _0x10de40=['27650BDKlvq','sql','read','tableData','hash','1905QmYtRO','\x20missing,\x20','290868BRCmjB','path','\x20remote-only','length','sqlName','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','54677WfXeZh','1920951OCyKNk','lockKey','\x20unchanged','sqlCode','totalCount','sqls','\x20added,\x20','1552vxgrxV','1304xEAKMh','filePath','paging','lockFilePath','relativePath','map','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20modified,\x20','bool','25hNdAUZ','status','keys','4416822Fhchmf','374VMhhBo','1746bCbkrJ','has','remote','push','64798KlFZwh','appCode'];a176_0x3c3a=function(){return _0x10de40;};return a176_0x3c3a();}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';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x3f1d75){const _0x1af6c4=a176_0x3ff0,_0x59a894=[];let _0x3b2711=0x1;while(!![]){const _0x8e1be1=await listSqlQueries(_0x3f1d75,{'currentPage':_0x3b2711,'pageSize':PAGE_SIZE}),_0x1d10f9=_0x8e1be1[_0x1af6c4(0x1c1)]??[];_0x59a894[_0x1af6c4(0x1bb)](..._0x1d10f9['map'](_0x53695a=>_0x53695a[_0x1af6c4(0x1cf)]));if(_0x1d10f9[_0x1af6c4(0x1c8)]===0x0)break;const _0x5e51c2=_0x8e1be1[_0x1af6c4(0x1d6)]?.[_0x1af6c4(0x1d0)];if(_0x5e51c2!=null?_0x59a894[_0x1af6c4(0x1c8)]>=_0x5e51c2:_0x1d10f9[_0x1af6c4(0x1c8)]<PAGE_SIZE)break;_0x3b2711++;}return _0x59a894;}export const sqlStatus={'service':a176_0x19fb26(0x1bf),'command':a176_0x19fb26(0x1de),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a176_0x19fb26(0x1c0),'flags':[{'name':a176_0x19fb26(0x1ba),'type':'boolean','description':a176_0x19fb26(0x1ca)}],async 'execute'(_0xae86d){const _0x450dfe=a176_0x19fb26,_0x15633e=loadSqlProjectConfig(_0xae86d[_0x450dfe(0x1bd)]),_0x30e196=await readSqlLockFile(_0x15633e[_0x450dfe(0x1d7)]),{appLock:_0x28a12e}=ensureSqlLockScope(_0x30e196??createEmptySqlLock(),_0x15633e[_0x450dfe(0x1bd)],_0x15633e['sqlRoot'],_0x450dfe(0x1de)),_0x5804e8=await scanLocalSqlQueries(_0x15633e),_0x9479bb=[],_0x488fe7=[],_0x467ec2=[],_0xb5ceb3=[],_0x548651=new Set(_0x5804e8[_0x450dfe(0x1d9)](_0x3bd956=>_0x3bd956['lockKey']));for(const _0x36dbc5 of _0x5804e8){const _0x3c6be2=await computeSqlFileHash(_0x36dbc5[_0x450dfe(0x1d5)]),_0x2ac847=_0x28a12e[_0x450dfe(0x1d1)][_0x36dbc5[_0x450dfe(0x1cd)]],_0x10c706=!!_0x2ac847&&_0x2ac847[_0x450dfe(0x1c6)]!==_0x36dbc5[_0x450dfe(0x1d8)],_0x15304c=!!_0x2ac847&&!!_0x36dbc5[_0x450dfe(0x1c9)]&&_0x2ac847[_0x450dfe(0x1c9)]!==_0x36dbc5['sqlName'];if(!_0x2ac847)_0x9479bb[_0x450dfe(0x1bb)](_0x36dbc5[_0x450dfe(0x1cd)]);else _0x2ac847[_0x450dfe(0x1c2)]!==_0x3c6be2||_0x10c706||_0x15304c?_0x488fe7['push'](_0x36dbc5[_0x450dfe(0x1cd)]):_0x467ec2[_0x450dfe(0x1bb)](_0x36dbc5[_0x450dfe(0x1cd)]);}for(const _0x2dd990 of Object[_0x450dfe(0x1df)](_0x28a12e['sqls'])){!_0x548651['has'](_0x2dd990)&&_0xb5ceb3[_0x450dfe(0x1bb)](_0x2dd990);}const _0x84805=[];if(_0xae86d[_0x450dfe(0x1dc)](_0x450dfe(0x1ba))){const _0x2be4c4=await fetchAllSqlCodes(_0xae86d[_0x450dfe(0x1bd)]);for(const _0x138255 of _0x2be4c4){!_0x548651[_0x450dfe(0x1b9)](_0x138255)&&!_0x28a12e[_0x450dfe(0x1d1)][_0x138255]&&_0x84805[_0x450dfe(0x1bb)](_0x138255);}}const _0x2d8930=_0x9479bb[_0x450dfe(0x1c8)]===0x0&&_0x488fe7[_0x450dfe(0x1c8)]===0x0&&_0xb5ceb3['length']===0x0&&_0x84805[_0x450dfe(0x1c8)]===0x0;return{'ok':!![],'data':{'added':_0x9479bb,'modified':_0x488fe7,'missing':_0xb5ceb3,'unchanged':_0x467ec2,'remoteOnly':_0x84805},'message':_0x2d8930?_0x450dfe(0x1da):_0x9479bb[_0x450dfe(0x1c8)]+_0x450dfe(0x1d2)+_0x488fe7[_0x450dfe(0x1c8)]+_0x450dfe(0x1db)+_0xb5ceb3[_0x450dfe(0x1c8)]+_0x450dfe(0x1c4)+_0x467ec2['length']+_0x450dfe(0x1ce)+(_0x84805[_0x450dfe(0x1c8)]>0x0?',\x20'+_0x84805[_0x450dfe(0x1c8)]+_0x450dfe(0x1c7):'')};}};
|