@lovrabet/rabetbase-cli 2.3.11 → 2.3.12
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_0x22a4ad=a164_0x3ba6;(function(_0x309c5c,_0x51ff2a){const _0x5f0265=a164_0x3ba6,_0xcfe03=_0x309c5c();while(!![]){try{const _0x4145f1=parseInt(_0x5f0265(0x211))/0x1*(parseInt(_0x5f0265(0x207))/0x2)+parseInt(_0x5f0265(0x1d9))/0x3+parseInt(_0x5f0265(0x20d))/0x4*(-parseInt(_0x5f0265(0x1e7))/0x5)+parseInt(_0x5f0265(0x208))/0x6*(-parseInt(_0x5f0265(0x1e6))/0x7)+parseInt(_0x5f0265(0x1fc))/0x8*(-parseInt(_0x5f0265(0x1ea))/0x9)+-parseInt(_0x5f0265(0x1fd))/0xa*(parseInt(_0x5f0265(0x1d3))/0xb)+-parseInt(_0x5f0265(0x200))/0xc*(-parseInt(_0x5f0265(0x1f8))/0xd);if(_0x4145f1===_0x51ff2a)break;else _0xcfe03['push'](_0xcfe03['shift']());}catch(_0x2aec25){_0xcfe03['push'](_0xcfe03['shift']());}}}(a164_0x16b5,0x1fca3));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';function a164_0x16b5(){const _0x26c3b0=['511mEUVbC','1265WDoueO','npm','preview','77598yjBJRY','package.json','join','validation','build','node_modules','(none)','\x20\x20EXAMPLES','log','\x20run\x20','args','Run\x20a\x20package.json\x20script','\x22\x20not\x20found\x20in\x20package.json.','needsUpgrade','13kyFjSO','\x20\x20\x20\x20','pnpm','boolean','88oovBku','10nXzTJx','error','No\x20scripts\x20defined\x20in\x20package.json.','3325776bzqrti','all','watch','slice','No\x20package.json\x20found\x20in\x20current\x20directory.','Available:\x20','bun.lockb','77486WAENJT','3054cDJiKf','pnpm-lock.yaml','bun','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','utf-8','628rKIKzB','bun.lock','inherit','yarn.lock','5gmHexB','script','close','length','\x0a\x20\x20Available\x20scripts:\x0a','.bin','Script\x20\x22','2731641MBCGLF','dev','yarn','push','run','\x20run\x20preview\x20--watch','238197nvizAq','start','\x20run\x20preview','Script\x20name\x20defined\x20in\x20package.json','\x20exited\x20with\x20code\x20','vite','keys','parse','read','Enable\x20watch\x20mode\x20for\x20preview','vite\x20preview\x20exited\x20with\x20code\x20','scripts','\x20run\x20start'];a164_0x16b5=function(){return _0x26c3b0;};return a164_0x16b5();}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_0x22a4ad(0x1da),a164_0x22a4ad(0x1d4)]);function readPackageScripts(_0x51ec52){const _0x5b22c8=a164_0x22a4ad,_0x4dd889=resolve(_0x51ec52,_0x5b22c8(0x1eb));if(!existsSync(_0x4dd889))return null;try{const _0xba07cf=JSON[_0x5b22c8(0x1e0)](readFileSync(_0x4dd889,_0x5b22c8(0x20c)));return _0xba07cf[_0x5b22c8(0x1e4)]??{};}catch{return null;}}function detectPackageManager(_0x241453){const _0x39b1f8=a164_0x22a4ad;if(existsSync(resolve(_0x241453,_0x39b1f8(0x206)))||existsSync(resolve(_0x241453,_0x39b1f8(0x20e))))return _0x39b1f8(0x20a);if(existsSync(resolve(_0x241453,_0x39b1f8(0x209))))return _0x39b1f8(0x1fa);if(existsSync(resolve(_0x241453,_0x39b1f8(0x210))))return _0x39b1f8(0x1d5);return _0x39b1f8(0x1e8);}async function versionCheck(_0x233a74){const _0x3ef598=a164_0x22a4ad,_0x1fd4f9=await checkCliVersion();(_0x1fd4f9[_0x3ef598(0x1f7)]||_0x1fd4f9['belowMinimum'])&&(printCliUpgradeWarning(_0x1fd4f9),assertCliVersionSupported(_0x1fd4f9));const _0x364ddf=await checkSdkVersion(_0x233a74);if(_0x364ddf[_0x3ef598(0x1f7)])printSdkUpgradeWarning(_0x364ddf);}function a164_0x3ba6(_0x8eb9d6,_0x85b99f){_0x8eb9d6=_0x8eb9d6-0x1cf;const _0x16b5fb=a164_0x16b5();let _0x3ba60a=_0x16b5fb[_0x8eb9d6];return _0x3ba60a;}function spawnScript(_0x59589b,_0x18dd57,_0x329042,_0x30371a){return new Promise((_0x58c698,_0x348c87)=>{const _0x4c96b2=a164_0x3ba6,_0x2bfaa5=[_0x4c96b2(0x1d7),_0x18dd57,..._0x329042],_0x51730c=spawn(_0x59589b,_0x2bfaa5,{'cwd':_0x30371a,'stdio':_0x4c96b2(0x20f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x30371a,_0x4c96b2(0x1ef),_0x4c96b2(0x1d1))+delimiter+process.env.PATH}});_0x51730c['on'](_0x4c96b2(0x213),_0x5bc3e2=>{const _0x3ac603=_0x4c96b2;if(_0x5bc3e2===0x0||_0x5bc3e2===null)_0x58c698();else _0x348c87(new Error(_0x59589b+_0x3ac603(0x1f3)+_0x18dd57+_0x3ac603(0x1dd)+_0x5bc3e2));}),_0x51730c['on'](_0x4c96b2(0x1fe),_0x348c87);});}function spawnViteBuildWatch(_0x4ea02c){return new Promise((_0x595059,_0x414753)=>{const _0x5496ba=a164_0x3ba6,_0x546e79=spawn('vite',[_0x5496ba(0x1ee),'--watch'],{'cwd':_0x4ea02c,'stdio':_0x5496ba(0x20f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4ea02c,_0x5496ba(0x1ef),'.bin')+delimiter+process.env.PATH}});_0x546e79['on']('close',_0x455aab=>{const _0x2545b7=_0x5496ba;if(_0x455aab===0x0||_0x455aab===null)_0x595059();else _0x414753(new Error(_0x2545b7(0x20b)+_0x455aab));}),_0x546e79['on'](_0x5496ba(0x1fe),_0x414753);});}function spawnVitePreview(_0x3944c){return new Promise((_0x5b6131,_0xa9a187)=>{const _0x331fba=a164_0x3ba6,_0x4f1c6b=spawn(_0x331fba(0x1de),[_0x331fba(0x1e9)],{'cwd':_0x3944c,'stdio':_0x331fba(0x20f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3944c,_0x331fba(0x1ef),_0x331fba(0x1d1))+delimiter+process.env.PATH}});_0x4f1c6b['on'](_0x331fba(0x213),_0x50ba76=>{const _0x3e8ce5=_0x331fba;if(_0x50ba76===0x0||_0x50ba76===null)_0x5b6131();else _0xa9a187(new Error(_0x3e8ce5(0x1e3)+_0x50ba76));}),_0x4f1c6b['on'](_0x331fba(0x1fe),_0xa9a187);});}const runFlags=[{'name':a164_0x22a4ad(0x202),'type':a164_0x22a4ad(0x1fb),'description':a164_0x22a4ad(0x1e2),'default':![]}];export const runDefinition={'service':a164_0x22a4ad(0x1d7),'command':a164_0x22a4ad(0x1d7),'description':a164_0x22a4ad(0x1f5),'risk':a164_0x22a4ad(0x1e1),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a164_0x22a4ad(0x212),'description':a164_0x22a4ad(0x1dc),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x105d99=a164_0x22a4ad,_0xfd032f=[];return _0xfd032f[_0x105d99(0x1d6)](_0x105d99(0x1f1)),_0xfd032f[_0x105d99(0x1d6)](_0x105d99(0x1f9)+CLI_BIN_NAME+_0x105d99(0x1e5)),_0xfd032f['push'](_0x105d99(0x1f9)+CLI_BIN_NAME+'\x20run\x20build'),_0xfd032f[_0x105d99(0x1d6)](_0x105d99(0x1f9)+CLI_BIN_NAME+_0x105d99(0x1db)),_0xfd032f[_0x105d99(0x1d6)](_0x105d99(0x1f9)+CLI_BIN_NAME+_0x105d99(0x1d8)),_0xfd032f[_0x105d99(0x1ec)]('\x0a');},async 'execute'(_0x1336d2){const _0x493e1f=a164_0x22a4ad,_0x1d406b=process['cwd'](),_0x4f6e81=_0x1336d2['args'][0x0],_0x7a1a80=_0x1336d2[_0x493e1f(0x1f4)][_0x493e1f(0x203)](0x1),_0x16ebf8=readPackageScripts(_0x1d406b);if(!_0x16ebf8)throw CliErrors[_0x493e1f(0x1ed)](_0x493e1f(0x204));if(!_0x4f6e81){const _0x520a56=Object[_0x493e1f(0x1df)](_0x16ebf8);if(_0x520a56[_0x493e1f(0x1cf)]===0x0)console[_0x493e1f(0x1f2)](_0x493e1f(0x1ff));else{console[_0x493e1f(0x1f2)](_0x493e1f(0x1d0));for(const _0x14b30e of _0x520a56){console[_0x493e1f(0x1f2)](_0x493e1f(0x1f9)+_0x14b30e);}console[_0x493e1f(0x1f2)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x16ebf8[_0x4f6e81])throw CliErrors[_0x493e1f(0x1ed)](_0x493e1f(0x1d2)+_0x4f6e81+_0x493e1f(0x1f6),_0x493e1f(0x205)+(Object[_0x493e1f(0x1df)](_0x16ebf8)[_0x493e1f(0x1ec)](',\x20')||_0x493e1f(0x1f0)));const _0x4f91fc=detectPackageManager(_0x1d406b);VERSION_CHECK_SCRIPTS['has'](_0x4f6e81)&&await versionCheck(_0x1d406b);if(_0x4f6e81===_0x493e1f(0x1e9)&&_0x1336d2['bool'](_0x493e1f(0x202)))return await Promise[_0x493e1f(0x201)]([spawnViteBuildWatch(_0x1d406b),spawnVitePreview(_0x1d406b)]),{'ok':!![]};return await spawnScript(_0x4f91fc,_0x4f6e81,_0x7a1a80,_0x1d406b),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0x1d8312=a165_0x38ed;function a165_0x38ed(_0x5bc4e3,_0x36bb01){_0x5bc4e3=_0x5bc4e3-0x67;const _0x4c2467=a165_0x4c24();let _0x38ed3b=_0x4c2467[_0x5bc4e3];return _0x38ed3b;}(function(_0x4a5357,_0x3ea57d){const _0x44ac65=a165_0x38ed,_0x4b9a82=_0x4a5357();while(!![]){try{const _0x26f485=-parseInt(_0x44ac65(0x6d))/0x1*(-parseInt(_0x44ac65(0x6e))/0x2)+parseInt(_0x44ac65(0x6f))/0x3*(parseInt(_0x44ac65(0x69))/0x4)+-parseInt(_0x44ac65(0x74))/0x5*(parseInt(_0x44ac65(0x70))/0x6)+parseInt(_0x44ac65(0x6c))/0x7*(-parseInt(_0x44ac65(0x76))/0x8)+-parseInt(_0x44ac65(0x75))/0x9+parseInt(_0x44ac65(0x67))/0xa*(parseInt(_0x44ac65(0x6a))/0xb)+-parseInt(_0x44ac65(0x72))/0xc*(-parseInt(_0x44ac65(0x73))/0xd);if(_0x26f485===_0x3ea57d)break;else _0x4b9a82['push'](_0x4b9a82['shift']());}catch(_0x2604a2){_0x4b9a82['push'](_0x4b9a82['shift']());}}}(a165_0x4c24,0xe4862));function a165_0x4c24(){const _0x552f66=['13lsAsrG','5AtoXmt','16010748UVURUn','80HxKCLb','70ZmcSBn','schema','16bweyWK','649JrznZr','json','728266fBLTRu','489347BIhPsb','2SQZhMj','688236azXsbB','7147482tJtqTF','Export\x20machine-readable\x20command\x20schema\x20(JSON)','42470700tXZwEk'];a165_0x4c24=function(){return _0x552f66;};return a165_0x4c24();}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x48e7e9){const _0x47e83e=await buildSchemaPayload();return{'ok':!![],'data':_0x47e83e};}export const schemaDefinition={'service':a165_0x1d8312(0x68),'command':'export','description':a165_0x1d8312(0x71),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a165_0x1d8312(0x6b),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a166_0x2f9a5d=a166_0x4af8;(function(_0x42b0b1,_0x59c406){const _0x291c15=a166_0x4af8,_0x508d49=_0x42b0b1();while(!![]){try{const _0x20ceee=parseInt(_0x291c15(0x1d7))/0x1+-parseInt(_0x291c15(0x1df))/0x2+parseInt(_0x291c15(0x1eb))/0x3*(parseInt(_0x291c15(0x1dd))/0x4)+-parseInt(_0x291c15(0x1cc))/0x5*(-parseInt(_0x291c15(0x1de))/0x6)+parseInt(_0x291c15(0x1e2))/0x7*(-parseInt(_0x291c15(0x1c5))/0x8)+-parseInt(_0x291c15(0x1c6))/0x9*(parseInt(_0x291c15(0x1d1))/0xa)+parseInt(_0x291c15(0x1ef))/0xb;if(_0x20ceee===_0x59c406)break;else _0x508d49['push'](_0x508d49['shift']());}catch(_0x350aae){_0x508d49['push'](_0x508d49['shift']());}}}(a166_0xce5c,0x3ec03));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_0xce5c(){const _0x5050e8=['dbId\x20不能为空','137187hUAMLJ','sqlCode','length','stringify','2010305mkaoXI','catch','appCode','lockFilePath','number','Invalid\x20database\x20selection\x20payload:\x20','mybatisXml','✎\x20手动输入\x20dbId','sql','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbId','Local\x20SQL\x20file\x20mode','string','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20必须为正整数','flagMissing','high-risk-write','Target\x20database\x20ID','parse','name','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','new','lastSync','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','sqlRoot','263832cTSFAT','36OEQhxK','utf8','isFinite','sqlRootDir','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','map','25WSMsZI','/smartapi/custom/saveUserCustomSql','toISOString','适合带动态标签的\x20MyBatis\x20XML\x20SQL','sqls','669890quevjM','POST','join','请选择目标数据库:','sqlName','mode','189711ARXvQc','create','trim','请选择本地\x20SQL\x20模式:','dbName','Created\x20SQL\x20query\x20','8fshPfN','121776FrndCm','14884pNuSSS','MyBatis\x20XML(mybatisXml)','isInteger','7dyFwWK','db-id','SQL\x20query\x20display\x20name','普通\x20SQL(sql)','SQL\x20名称不能为空','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','nonInteractive','请输入目标数据库\x20dbId:'];a166_0xce5c=function(){return _0x5050e8;};return a166_0xce5c();}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2885b2){const _0x2c12af=a166_0x4af8;if(_0x2885b2==='mybatisXml')return[_0x2c12af(0x1c0),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x2c12af(0x1d3)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x2c12af(0x1d3)]('\x0a');}export const sqlCreate={'service':a166_0x2f9a5d(0x1b2),'command':a166_0x2f9a5d(0x1d8),'description':a166_0x2f9a5d(0x1e7),'risk':a166_0x2f9a5d(0x1bc),'flags':[{'name':a166_0x2f9a5d(0x1bf),'type':a166_0x2f9a5d(0x1b6),'description':a166_0x2f9a5d(0x1e4)},{'name':a166_0x2f9a5d(0x1e3),'type':a166_0x2f9a5d(0x1ae),'description':a166_0x2f9a5d(0x1bd)},{'name':a166_0x2f9a5d(0x1d6),'type':a166_0x2f9a5d(0x1b6),'enum':[a166_0x2f9a5d(0x1b2),a166_0x2f9a5d(0x1b0)],'description':a166_0x2f9a5d(0x1b5)}],async 'validate'(_0xaffaf8){const _0x55f90a=a166_0x2f9a5d;if(!_0xaffaf8[_0x55f90a(0x1e8)])return;if(!_0xaffaf8['str']('name')[_0x55f90a(0x1d9)]())throw CliErrors[_0x55f90a(0x1bb)](_0x55f90a(0x1bf),_0x55f90a(0x1b9));const _0x4b0294=resolveProvidedDbId(_0xaffaf8);if(typeof _0x4b0294!==_0x55f90a(0x1ae)||!Number[_0x55f90a(0x1c8)](_0x4b0294)||_0x4b0294<=0x0)throw CliErrors['flagMissing'](_0x55f90a(0x1e3),_0x55f90a(0x1ca));if(!_0xaffaf8[_0x55f90a(0x1b7)](_0x55f90a(0x1d6))['trim']())throw CliErrors[_0x55f90a(0x1bb)](_0x55f90a(0x1d6),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x3e4484){const _0xf9549f=a166_0x2f9a5d,_0x7f63db=loadSqlProjectConfig(_0x3e4484[_0xf9549f(0x1f1)]),{sqlName:_0x394d52,dbId:_0x2f9ab8,dbName:_0x4dab4e,mode:_0x3cad3a}=await resolveSqlNewInputs(_0x3e4484),_0xcbf286=buildSqlRelativePath('<server-generated-sqlCode>',_0x394d52,_0x4dab4e,_0x3cad3a,_0x2f9ab8),_0xb2ea99=_0x7f63db[_0xf9549f(0x1c9)]+'/'+_0xcbf286;return{'method':_0xf9549f(0x1d2),'url':_0xf9549f(0x1cd),'body':{'appCode':_0x3e4484['appCode'],'sqlName':_0x394d52,'dbId':_0x2f9ab8,'mode':_0x3cad3a,'localPath':_0xb2ea99},'description':_0xf9549f(0x1b3)+_0x7f63db['sqlRootDir']};},async 'execute'(_0x3b18b8){const _0x34e1ef=a166_0x2f9a5d,_0x4d2ab9=loadSqlProjectConfig(_0x3b18b8['appCode']),{sqlName:_0x34a6a5,dbId:_0x451410,dbName:_0x2b814f,mode:_0x49b21b}=await resolveSqlNewInputs(_0x3b18b8),_0x3d4e71=generateSqlTemplate(_0x49b21b),_0x2ee68d=await createSqlQuery({'appCode':_0x3b18b8[_0x34e1ef(0x1f1)],'sqlName':_0x34a6a5,'dbId':_0x451410,'sqlContent':_0x3d4e71}),_0x29fd60=ensureRemoteSqlContent(_0x2ee68d),_0xfb791b=_0x2b814f||await getDbName(_0x3b18b8[_0x34e1ef(0x1f1)],_0x451410)[_0x34e1ef(0x1f0)](()=>undefined),_0x5cd25b=buildSqlRelativePath(_0x2ee68d[_0x34e1ef(0x1ec)],_0x2ee68d[_0x34e1ef(0x1d5)],_0xfb791b,_0x49b21b,_0x451410),_0x53d85e=_0x4d2ab9[_0x34e1ef(0x1c9)]+'/'+_0x5cd25b,_0x441930=buildLocalSqlFileContent({'sqlCode':_0x2ee68d['sqlCode'],'sqlName':_0x2ee68d['sqlName'],'dbId':_0x2ee68d[_0x34e1ef(0x1b4)]},_0x29fd60,{'dbName':_0xfb791b,'mode':_0x49b21b,'syncedAt':new Date()[_0x34e1ef(0x1ce)](),'description':_0x2ee68d['description']});if(await fileExists(_0x53d85e))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x53d85e);await ensureParentDirectory(_0x53d85e),await writeFile(_0x53d85e,_0x441930,_0x34e1ef(0x1c7));const _0x11d5c5=await readSqlLockFile(_0x4d2ab9[_0x34e1ef(0x1ad)]),{lockData:_0x5bc5b3,appLock:_0x5dbc93}=ensureSqlLockScope(_0x11d5c5??createEmptySqlLock(),_0x4d2ab9[_0x34e1ef(0x1f1)],_0x4d2ab9[_0x34e1ef(0x1c4)],_0x34e1ef(0x1c1));return _0x5dbc93[_0x34e1ef(0x1d0)][_0x2ee68d[_0x34e1ef(0x1ec)]]={...buildSqlLockEntry(_0x2ee68d,_0x29fd60,computeSqlContentHash(_0x441930),{'dbName':_0xfb791b}),'path':_0x5cd25b,'mode':_0x49b21b},_0x5dbc93[_0x34e1ef(0x1c2)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4d2ab9[_0x34e1ef(0x1ad)],_0x5bc5b3),{'ok':!![],'data':{'id':_0x2ee68d['id'],'sqlCode':_0x2ee68d[_0x34e1ef(0x1ec)],'sqlName':_0x2ee68d[_0x34e1ef(0x1d5)],'dbId':_0x2ee68d[_0x34e1ef(0x1b4)],'path':_0x53d85e,'mode':_0x49b21b},'message':_0x34e1ef(0x1dc)+_0x2ee68d[_0x34e1ef(0x1ec)]};}};async function resolveSqlNewInputs(_0x3f4f7b){const _0x1a8910=await resolveSqlNameInput(_0x3f4f7b),{dbId:_0x5510f2,dbName:_0x1eeddf}=await resolveDbSelection(_0x3f4f7b),_0x1aab62=await resolveSqlModeInput(_0x3f4f7b);return{'sqlName':_0x1a8910,'dbId':_0x5510f2,'dbName':_0x1eeddf,'mode':_0x1aab62};}function a166_0x4af8(_0x230288,_0x5d76cc){_0x230288=_0x230288-0x1ad;const _0xce5c5a=a166_0xce5c();let _0x4af862=_0xce5c5a[_0x230288];return _0x4af862;}async function resolveSqlNameInput(_0x92cffd){const _0x56ca18=a166_0x2f9a5d,_0x26f80a=_0x92cffd[_0x56ca18(0x1b7)](_0x56ca18(0x1bf))[_0x56ca18(0x1d9)]();if(_0x26f80a)return _0x26f80a;if(_0x92cffd[_0x56ca18(0x1e8)])throw CliErrors[_0x56ca18(0x1bb)](_0x56ca18(0x1bf),_0x56ca18(0x1b9));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x115d04=>_0x115d04[_0x56ca18(0x1d9)]()?!![]:_0x56ca18(0x1e6)}))['trim']();}async function resolveDbSelection(_0x2a4312){const _0x2b8fc5=a166_0x2f9a5d,_0x3422f8=resolveProvidedDbId(_0x2a4312);if(typeof _0x3422f8==='number'&&Number['isFinite'](_0x3422f8)&&_0x3422f8>0x0)return{'dbId':_0x3422f8,'dbName':await getDbName(_0x2a4312['appCode'],_0x3422f8)[_0x2b8fc5(0x1f0)](()=>undefined)};if(_0x2a4312[_0x2b8fc5(0x1e8)])throw CliErrors[_0x2b8fc5(0x1bb)]('db-id',_0x2b8fc5(0x1ca));const _0x11d18a=await listDatabases(_0x2a4312[_0x2b8fc5(0x1f1)])[_0x2b8fc5(0x1f0)](()=>[]);if(_0x11d18a['length']===0x1)return{'dbId':_0x11d18a[0x0]['dbId'],'dbName':_0x11d18a[0x0]['dbName']};if(_0x11d18a[_0x2b8fc5(0x1ed)]>0x1){const _0x489d99=await select({'message':_0x2b8fc5(0x1d4),'choices':[..._0x11d18a[_0x2b8fc5(0x1cb)](_0x10cc5f=>({'name':_0x10cc5f[_0x2b8fc5(0x1db)]+'\x20('+_0x10cc5f[_0x2b8fc5(0x1b4)]+')','value':serializeDbSelection(_0x10cc5f)})),{'name':_0x2b8fc5(0x1b1),'value':'__manual__'}]});if(_0x489d99!=='__manual__')return deserializeDbSelection(_0x489d99);}const _0x281155=await input({'message':_0x2b8fc5(0x1e9),'validate':_0x3a04ba=>{const _0x5491b5=_0x2b8fc5,_0x2def22=_0x3a04ba[_0x5491b5(0x1d9)]();if(!_0x2def22)return _0x5491b5(0x1ea);const _0x532984=Number(_0x2def22);if(!Number[_0x5491b5(0x1e1)](_0x532984)||_0x532984<=0x0)return _0x5491b5(0x1ba);return!![];}});return{'dbId':Number(_0x281155[_0x2b8fc5(0x1d9)]())};}async function resolveSqlModeInput(_0xbcf81c){const _0x4d8106=a166_0x2f9a5d,_0x1af10e=_0xbcf81c['str'](_0x4d8106(0x1d6))['trim']();if(_0x1af10e===_0x4d8106(0x1b2)||_0x1af10e==='mybatisXml')return _0x1af10e;if(_0xbcf81c['nonInteractive'])throw CliErrors[_0x4d8106(0x1bb)]('mode',_0x4d8106(0x1b8));return await select({'message':_0x4d8106(0x1da),'choices':[{'name':_0x4d8106(0x1e5),'value':_0x4d8106(0x1b2),'description':_0x4d8106(0x1c3)},{'name':_0x4d8106(0x1e0),'value':'mybatisXml','description':_0x4d8106(0x1cf)}]});}function serializeDbSelection(_0x4bbd88){const _0xd90419=a166_0x2f9a5d;return JSON[_0xd90419(0x1ee)]({'dbId':_0x4bbd88[_0xd90419(0x1b4)],'dbName':_0x4bbd88[_0xd90419(0x1db)]});}function deserializeDbSelection(_0xfd6823){const _0xb38fcf=a166_0x2f9a5d;try{const _0x3e523b=JSON[_0xb38fcf(0x1be)](_0xfd6823);if(typeof _0x3e523b[_0xb38fcf(0x1b4)]==='number'&&Number[_0xb38fcf(0x1c8)](_0x3e523b['dbId']))return{'dbId':_0x3e523b[_0xb38fcf(0x1b4)],'dbName':_0x3e523b[_0xb38fcf(0x1db)]};}catch{}throw CliErrors['validation'](_0xb38fcf(0x1af)+_0xfd6823);}function resolveProvidedDbId(_0xa87c12){const _0x47140f=a166_0x2f9a5d,_0x2e496f=_0xa87c12['flag'](_0x47140f(0x1e3));if(typeof _0x2e496f===_0x47140f(0x1ae)&&Number[_0x47140f(0x1c8)](_0x2e496f))return _0x2e496f;return undefined;}
|
|
1
|
+
const a166_0x327c5e=a166_0x37ac;(function(_0x1cf99a,_0x5ec971){const _0x351cc5=a166_0x37ac,_0x2177bd=_0x1cf99a();while(!![]){try{const _0x3df1de=-parseInt(_0x351cc5(0x1e4))/0x1+parseInt(_0x351cc5(0x1d7))/0x2+parseInt(_0x351cc5(0x1d3))/0x3*(-parseInt(_0x351cc5(0x1df))/0x4)+-parseInt(_0x351cc5(0x1d4))/0x5*(parseInt(_0x351cc5(0x1f8))/0x6)+-parseInt(_0x351cc5(0x1bf))/0x7*(parseInt(_0x351cc5(0x1fa))/0x8)+-parseInt(_0x351cc5(0x1c7))/0x9+parseInt(_0x351cc5(0x1c0))/0xa;if(_0x3df1de===_0x5ec971)break;else _0x2177bd['push'](_0x2177bd['shift']());}catch(_0x303718){_0x2177bd['push'](_0x2177bd['shift']());}}}(a166_0x37f1,0x6bb81));function a166_0x37f1(){const _0x50b97a=['SQL\x20名称不能为空','description','dbName','appCode','high-risk-write','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','catch','5124189FIkknF','28623780crSVpt','SQL\x20query\x20display\x20name','请选择本地\x20SQL\x20模式:','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','请输入目标数据库\x20dbId:','POST','5285241cGEASP','sql','parse','str','mode','flagMissing','Created\x20SQL\x20query\x20','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','</select>','Local\x20SQL\x20file\x20mode','\x20\x20SELECT\x201\x20AS\x20id','trim','869163hoFMLx','5eQPsdw','name','File\x20already\x20exists:\x20','30018yOWXwo','Target\x20database\x20ID','普通\x20SQL(sql)','mybatisXml','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','map','flag','适合带动态标签的\x20MyBatis\x20XML\x20SQL','4bbUjKb','string','create','length','sqlName','340107dfHJZi','join','sqlRoot','new','lockFilePath','请选择目标数据库:','isFinite','sqls','isInteger','__manual__','dbId','sqlCode','toISOString','nonInteractive','validation','<server-generated-sqlCode>','db-id','SELECT\x201\x20AS\x20id;','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','number','2922396aHNqYM','Invalid\x20database\x20selection\x20payload:\x20','8yGpHhT','sqlRootDir','请输入\x20SQL\x20名称:'];a166_0x37f1=function(){return _0x50b97a;};return a166_0x37f1();}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';function a166_0x37ac(_0x2a4050,_0x19f194){_0x2a4050=_0x2a4050-0x1bf;const _0x37f1dd=a166_0x37f1();let _0x37acb4=_0x37f1dd[_0x2a4050];return _0x37acb4;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x466c35){const _0x398a65=a166_0x37ac;if(_0x466c35===_0x398a65(0x1da))return[_0x398a65(0x1ce),_0x398a65(0x1d1),_0x398a65(0x1cf),'']['join']('\x0a');return[_0x398a65(0x1f5),''][_0x398a65(0x1e5)]('\x0a');}export const sqlCreate={'service':'sql','command':a166_0x327c5e(0x1e1),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a166_0x327c5e(0x201),'flags':[{'name':a166_0x327c5e(0x1d5),'type':'string','description':a166_0x327c5e(0x1c1)},{'name':a166_0x327c5e(0x1f4),'type':a166_0x327c5e(0x1f7),'description':a166_0x327c5e(0x1d8)},{'name':a166_0x327c5e(0x1cb),'type':a166_0x327c5e(0x1e0),'enum':[a166_0x327c5e(0x1c8),a166_0x327c5e(0x1da)],'description':a166_0x327c5e(0x1d0)}],async 'validate'(_0x430456){const _0x254dc1=a166_0x327c5e;if(!_0x430456['nonInteractive'])return;if(!_0x430456[_0x254dc1(0x1ca)](_0x254dc1(0x1d5))[_0x254dc1(0x1d2)]())throw CliErrors['flagMissing'](_0x254dc1(0x1d5),_0x254dc1(0x1c4));const _0x14281c=resolveProvidedDbId(_0x430456);if(typeof _0x14281c!=='number'||!Number[_0x254dc1(0x1ea)](_0x14281c)||_0x14281c<=0x0)throw CliErrors['flagMissing'](_0x254dc1(0x1f4),_0x254dc1(0x202));if(!_0x430456[_0x254dc1(0x1ca)](_0x254dc1(0x1cb))[_0x254dc1(0x1d2)]())throw CliErrors[_0x254dc1(0x1cc)](_0x254dc1(0x1cb),_0x254dc1(0x1c3));},async 'dryRun'(_0x4780f2){const _0x32dc37=a166_0x327c5e,_0x3c1d56=loadSqlProjectConfig(_0x4780f2[_0x32dc37(0x200)]),{sqlName:_0x33b1a2,dbId:_0xd30844,dbName:_0x54d373,mode:_0x58d9e6}=await resolveSqlNewInputs(_0x4780f2),_0x278523=buildSqlRelativePath(_0x32dc37(0x1f3),_0x33b1a2,_0x54d373,_0x58d9e6,_0xd30844),_0x188c21=_0x3c1d56[_0x32dc37(0x1fb)]+'/'+_0x278523;return{'method':_0x32dc37(0x1c6),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x4780f2[_0x32dc37(0x200)],'sqlName':_0x33b1a2,'dbId':_0xd30844,'mode':_0x58d9e6,'localPath':_0x188c21},'description':_0x32dc37(0x1db)+_0x3c1d56[_0x32dc37(0x1fb)]};},async 'execute'(_0x41dc3c){const _0x226745=a166_0x327c5e,_0x5e451d=loadSqlProjectConfig(_0x41dc3c[_0x226745(0x200)]),{sqlName:_0x42f439,dbId:_0x1936c2,dbName:_0x1a7018,mode:_0x33ed77}=await resolveSqlNewInputs(_0x41dc3c),_0x4cb2d5=generateSqlTemplate(_0x33ed77),_0x18e9e6=await createSqlQuery({'appCode':_0x41dc3c[_0x226745(0x200)],'sqlName':_0x42f439,'dbId':_0x1936c2,'sqlContent':_0x4cb2d5}),_0x485cfa=ensureRemoteSqlContent(_0x18e9e6),_0x54fdda=_0x1a7018||await getDbName(_0x41dc3c[_0x226745(0x200)],_0x1936c2)[_0x226745(0x203)](()=>undefined),_0x10f909=buildSqlRelativePath(_0x18e9e6[_0x226745(0x1ef)],_0x18e9e6[_0x226745(0x1e3)],_0x54fdda,_0x33ed77,_0x1936c2),_0x3551be=_0x5e451d[_0x226745(0x1fb)]+'/'+_0x10f909,_0x5c46e5=buildLocalSqlFileContent({'sqlCode':_0x18e9e6[_0x226745(0x1ef)],'sqlName':_0x18e9e6[_0x226745(0x1e3)],'dbId':_0x18e9e6['dbId']},_0x485cfa,{'dbName':_0x54fdda,'mode':_0x33ed77,'syncedAt':new Date()[_0x226745(0x1f0)](),'description':_0x18e9e6[_0x226745(0x1fe)]});if(await fileExists(_0x3551be))throw CliErrors[_0x226745(0x1f2)](_0x226745(0x1d6)+_0x3551be);await ensureParentDirectory(_0x3551be),await writeFile(_0x3551be,_0x5c46e5,'utf8');const _0x1ea4f0=await readSqlLockFile(_0x5e451d[_0x226745(0x1e8)]),{lockData:_0x3bca2b,appLock:_0x316d45}=ensureSqlLockScope(_0x1ea4f0??createEmptySqlLock(),_0x5e451d[_0x226745(0x200)],_0x5e451d[_0x226745(0x1e6)],_0x226745(0x1e7));return _0x316d45[_0x226745(0x1eb)][_0x18e9e6[_0x226745(0x1ef)]]={...buildSqlLockEntry(_0x18e9e6,_0x485cfa,computeSqlContentHash(_0x5c46e5),{'dbName':_0x54fdda}),'path':_0x10f909,'mode':_0x33ed77},_0x316d45['lastSync']=new Date()[_0x226745(0x1f0)](),await writeSqlLockFile(_0x5e451d[_0x226745(0x1e8)],_0x3bca2b),{'ok':!![],'data':{'id':_0x18e9e6['id'],'sqlCode':_0x18e9e6[_0x226745(0x1ef)],'sqlName':_0x18e9e6['sqlName'],'dbId':_0x18e9e6['dbId'],'path':_0x3551be,'mode':_0x33ed77},'message':_0x226745(0x1cd)+_0x18e9e6['sqlCode']};}};async function resolveSqlNewInputs(_0xf3ea01){const _0x45904e=await resolveSqlNameInput(_0xf3ea01),{dbId:_0x1b3599,dbName:_0x536a5e}=await resolveDbSelection(_0xf3ea01),_0x532168=await resolveSqlModeInput(_0xf3ea01);return{'sqlName':_0x45904e,'dbId':_0x1b3599,'dbName':_0x536a5e,'mode':_0x532168};}async function resolveSqlNameInput(_0x1a975c){const _0x40d247=a166_0x327c5e,_0x4c0a83=_0x1a975c[_0x40d247(0x1ca)]('name')[_0x40d247(0x1d2)]();if(_0x4c0a83)return _0x4c0a83;if(_0x1a975c[_0x40d247(0x1f1)])throw CliErrors[_0x40d247(0x1cc)](_0x40d247(0x1d5),_0x40d247(0x1c4));return(await input({'message':_0x40d247(0x1fc),'validate':_0x229515=>_0x229515[_0x40d247(0x1d2)]()?!![]:_0x40d247(0x1fd)}))[_0x40d247(0x1d2)]();}async function resolveDbSelection(_0x1c5837){const _0x29394b=a166_0x327c5e,_0x5f34a2=resolveProvidedDbId(_0x1c5837);if(typeof _0x5f34a2===_0x29394b(0x1f7)&&Number[_0x29394b(0x1ea)](_0x5f34a2)&&_0x5f34a2>0x0)return{'dbId':_0x5f34a2,'dbName':await getDbName(_0x1c5837['appCode'],_0x5f34a2)[_0x29394b(0x203)](()=>undefined)};if(_0x1c5837[_0x29394b(0x1f1)])throw CliErrors['flagMissing'](_0x29394b(0x1f4),_0x29394b(0x202));const _0x40d9d0=await listDatabases(_0x1c5837[_0x29394b(0x200)])['catch'](()=>[]);if(_0x40d9d0[_0x29394b(0x1e2)]===0x1)return{'dbId':_0x40d9d0[0x0][_0x29394b(0x1ee)],'dbName':_0x40d9d0[0x0][_0x29394b(0x1ff)]};if(_0x40d9d0[_0x29394b(0x1e2)]>0x1){const _0x4ce6ca=await select({'message':_0x29394b(0x1e9),'choices':[..._0x40d9d0[_0x29394b(0x1dc)](_0x2eb15d=>({'name':_0x2eb15d['dbName']+'\x20('+_0x2eb15d[_0x29394b(0x1ee)]+')','value':serializeDbSelection(_0x2eb15d)})),{'name':'✎\x20手动输入\x20dbId','value':_0x29394b(0x1ed)}]});if(_0x4ce6ca!==_0x29394b(0x1ed))return deserializeDbSelection(_0x4ce6ca);}const _0x111be8=await input({'message':_0x29394b(0x1c5),'validate':_0x1fb447=>{const _0x452e30=_0x29394b,_0x49dadb=_0x1fb447[_0x452e30(0x1d2)]();if(!_0x49dadb)return'dbId\x20不能为空';const _0x1374b4=Number(_0x49dadb);if(!Number[_0x452e30(0x1ec)](_0x1374b4)||_0x1374b4<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x111be8[_0x29394b(0x1d2)]())};}async function resolveSqlModeInput(_0x478f6e){const _0x3c959e=a166_0x327c5e,_0xeef00=_0x478f6e[_0x3c959e(0x1ca)](_0x3c959e(0x1cb))[_0x3c959e(0x1d2)]();if(_0xeef00===_0x3c959e(0x1c8)||_0xeef00===_0x3c959e(0x1da))return _0xeef00;if(_0x478f6e[_0x3c959e(0x1f1)])throw CliErrors[_0x3c959e(0x1cc)](_0x3c959e(0x1cb),_0x3c959e(0x1c3));return await select({'message':_0x3c959e(0x1c2),'choices':[{'name':_0x3c959e(0x1d9),'value':_0x3c959e(0x1c8),'description':_0x3c959e(0x1f6)},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x3c959e(0x1da),'description':_0x3c959e(0x1de)}]});}function serializeDbSelection(_0x59037c){const _0x4128d7=a166_0x327c5e;return JSON['stringify']({'dbId':_0x59037c[_0x4128d7(0x1ee)],'dbName':_0x59037c[_0x4128d7(0x1ff)]});}function deserializeDbSelection(_0x5308f0){const _0x1a6fa7=a166_0x327c5e;try{const _0xd68d0e=JSON[_0x1a6fa7(0x1c9)](_0x5308f0);if(typeof _0xd68d0e['dbId']===_0x1a6fa7(0x1f7)&&Number[_0x1a6fa7(0x1ea)](_0xd68d0e[_0x1a6fa7(0x1ee)]))return{'dbId':_0xd68d0e[_0x1a6fa7(0x1ee)],'dbName':_0xd68d0e['dbName']};}catch{}throw CliErrors[_0x1a6fa7(0x1f2)](_0x1a6fa7(0x1f9)+_0x5308f0);}function resolveProvidedDbId(_0x44da04){const _0x25d5f0=a166_0x327c5e,_0x3b1bee=_0x44da04[_0x25d5f0(0x1dd)](_0x25d5f0(0x1f4));if(typeof _0x3b1bee===_0x25d5f0(0x1f7)&&Number[_0x25d5f0(0x1ea)](_0x3b1bee))return _0x3b1bee;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x5da502=a167_0x4951;(function(_0x504453,_0x362375){const _0x2e19c9=a167_0x4951,_0x3c0e02=_0x504453();while(!![]){try{const _0x24a101=parseInt(_0x2e19c9(0x107))/0x1+-parseInt(_0x2e19c9(0xf6))/0x2*(-parseInt(_0x2e19c9(0xfc))/0x3)+parseInt(_0x2e19c9(0xf2))/0x4*(-parseInt(_0x2e19c9(0xee))/0x5)+-parseInt(_0x2e19c9(0x10b))/0x6*(parseInt(_0x2e19c9(0x104))/0x7)+-parseInt(_0x2e19c9(0xfa))/0x8+-parseInt(_0x2e19c9(0xed))/0x9*(parseInt(_0x2e19c9(0x10e))/0xa)+parseInt(_0x2e19c9(0xef))/0xb;if(_0x24a101===_0x362375)break;else _0x3c0e02['push'](_0x3c0e02['shift']());}catch(_0x36efaf){_0x3c0e02['push'](_0x3c0e02['shift']());}}}(a167_0x5482,0x2a3eb));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a167_0x5482(){const _0x5a15bf=['remoteId','delete','Deleted\x20','56WhQlaK','POST','str','sqlRoot','369408nxlqSg','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','29523Lvqggn','lockFilePath','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','trashDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','high-risk-write','/smartapi/custom/deleteUserCustomSql','14xsWcAj','validation','sqls','320884PLkdMv','fromEntries','sqlRootDir','appCode','340506peZalS','toISOString','entries','20atrDjb','207639ZMFklb','20crlLKB','814869KSLcxk','sqlcode','\x20(local\x20file\x20moved\x20to\x20trash)','291656wQwnFi'];a167_0x5482=function(){return _0x5a15bf;};return a167_0x5482();}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a167_0x4951(_0x7524c,_0x58778d){_0x7524c=_0x7524c-0xed;const _0x548280=a167_0x5482();let _0x49514e=_0x548280[_0x7524c];return _0x49514e;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a167_0x5da502(0xf4),'description':a167_0x5da502(0xff),'risk':a167_0x5da502(0x102),'flags':[SQLCODE_FLAG],async 'validate'(_0x27f92d){const _0x9e1f03=a167_0x5da502,_0x223f02=loadSqlProjectConfig(_0x27f92d[_0x9e1f03(0x10a)]),_0x4f1136=await readSqlLockFile(_0x223f02[_0x9e1f03(0xfd)]);if(!_0x4f1136)throw CliErrors[_0x9e1f03(0x105)](_0x9e1f03(0x101));},async 'dryRun'(_0x164c33){const _0x545afe=a167_0x5da502,_0x44d5f4=loadSqlProjectConfig(_0x164c33['appCode']),_0xc13881=await readSqlLockFile(_0x44d5f4['lockFilePath']);if(!_0xc13881)throw CliErrors[_0x545afe(0x105)](_0x545afe(0x101));const {appLock:_0x593f50}=ensureSqlLockScope(_0xc13881,_0x164c33[_0x545afe(0x10a)],_0x44d5f4[_0x545afe(0xf9)],_0x545afe(0xf4)),_0x4d7d35=_0x164c33[_0x545afe(0xf8)]('sqlcode'),_0x2ce56d=_0x593f50[_0x545afe(0x106)][_0x4d7d35];if(!_0x2ce56d)throw CliErrors[_0x545afe(0x105)](_0x545afe(0xfb)+_0x4d7d35+'\x22.');return{'method':_0x545afe(0xf7),'url':_0x545afe(0x103),'body':{'sqlCode':_0x4d7d35,'id':_0x2ce56d[_0x545afe(0xf3)],'localPath':resolveLocalSqlFilePath(_0x44d5f4,_0x4d7d35,_0x2ce56d)},'description':'Would\x20delete\x20SQL\x20'+_0x4d7d35+_0x545afe(0xfe)+_0x44d5f4['trashDir']};},async 'execute'(_0x7262d2){const _0x29915d=a167_0x5da502,_0x48ee6d=loadSqlProjectConfig(_0x7262d2[_0x29915d(0x10a)]),_0x4e0d4b=await readSqlLockFile(_0x48ee6d['lockFilePath']);if(!_0x4e0d4b)throw CliErrors[_0x29915d(0x105)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x3cf31f,appLock:_0x43040e}=ensureSqlLockScope(_0x4e0d4b,_0x7262d2['appCode'],_0x48ee6d['sqlRoot'],_0x29915d(0xf4)),_0x3f4d96=_0x7262d2[_0x29915d(0xf8)](_0x29915d(0xf0)),_0x2d6b09=_0x43040e[_0x29915d(0x106)][_0x3f4d96];if(!_0x2d6b09)throw CliErrors[_0x29915d(0x105)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3f4d96+'\x22.');await deleteSqlQuery({'id':_0x2d6b09['remoteId'],'sqlCode':_0x3f4d96}),_0x43040e[_0x29915d(0x106)]=Object[_0x29915d(0x108)](Object[_0x29915d(0x10d)](_0x43040e[_0x29915d(0x106)])['filter'](([_0x35e4c6])=>_0x35e4c6!==_0x3f4d96)),_0x43040e['lastSync']=new Date()[_0x29915d(0x10c)](),await writeSqlLockFile(_0x48ee6d[_0x29915d(0xfd)],_0x3cf31f);const _0x23b98f=resolveLocalSqlFilePath(_0x48ee6d,_0x3f4d96,_0x2d6b09);let _0x2f2d6e;await fileExists(_0x23b98f)&&(_0x2f2d6e=await moveToTrash(_0x48ee6d['projectRoot'],_0x48ee6d[_0x29915d(0x100)],_0x23b98f),await cleanupEmptyDirectories(dirname(_0x23b98f),_0x48ee6d[_0x29915d(0x109)]));const _0x3d074d={'deleted':_0x3f4d96,'remoteId':_0x2d6b09[_0x29915d(0xf3)]};if(_0x2f2d6e)_0x3d074d['trashedTo']=_0x2f2d6e;return{'ok':!![],'data':_0x3d074d,'message':_0x29915d(0xf5)+_0x3f4d96+(_0x2f2d6e?_0x29915d(0xf1):'')};}};async function moveToTrash(_0x2a4d48,_0xb2a246,_0x55d876){const _0x4f595f=a167_0x5da502,_0x37c486=new Date()[_0x4f595f(0x10c)]()['replace'](/[:.]/g,'-'),_0x19f876=relative(_0x2a4d48,_0x55d876),_0x1ce5a3=join(_0xb2a246,_0x37c486,_0x19f876);return await mkdir(dirname(_0x1ce5a3),{'recursive':!![]}),await rename(_0x55d876,_0x1ce5a3),_0x1ce5a3;}async function cleanupEmptyDirectories(_0x27eee5,_0x4b5e91){let _0x10edd0=resolve(_0x27eee5);const _0x396c1e=resolve(_0x4b5e91);while(_0x10edd0['startsWith'](''+_0x396c1e+sep)||_0x10edd0===_0x396c1e){if(_0x10edd0===_0x396c1e)return;try{const _0x149952=await readdir(_0x10edd0);if(_0x149952['length']>0x0)return;await rmdir(_0x10edd0);}catch{return;}_0x10edd0=dirname(_0x10edd0);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a168_0x4439(_0x1c9488,_0x3deee5){_0x1c9488=_0x1c9488-0xc1;const _0x9234fb=a168_0x9234();let _0x443933=_0x9234fb[_0x1c9488];return _0x443933;}const a168_0x40cb9a=a168_0x4439;(function(_0x1ebad0,_0x2093c4){const _0x5223e7=a168_0x4439,_0x2c60bf=_0x1ebad0();while(!![]){try{const _0x298ecb=parseInt(_0x5223e7(0xcd))/0x1*(parseInt(_0x5223e7(0xd1))/0x2)+parseInt(_0x5223e7(0xd5))/0x3*(parseInt(_0x5223e7(0xd0))/0x4)+parseInt(_0x5223e7(0xd2))/0x5+parseInt(_0x5223e7(0xc9))/0x6+-parseInt(_0x5223e7(0xd4))/0x7*(-parseInt(_0x5223e7(0xc4))/0x8)+parseInt(_0x5223e7(0xc1))/0x9*(-parseInt(_0x5223e7(0xc2))/0xa)+-parseInt(_0x5223e7(0xcb))/0xb;if(_0x298ecb===_0x2093c4)break;else _0x2c60bf['push'](_0x2c60bf['shift']());}catch(_0x591194){_0x2c60bf['push'](_0x2c60bf['shift']());}}}(a168_0x9234,0x7b4ad));function a168_0x9234(){const _0x35b5c8=['402eiJStI','sql','bool','279JmHrHW','252410VytUvF','description','16tNjBxb','sqlcode','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','appCode','str','1577832IXLUVf','boolean','11700337AVfLxP','verbose','2uPyZXE','dbId','sqlName','18924xGOKTP','254102jlYGWW','2290165OGgZTV','sqlContent','2597287sZypHd'];a168_0x9234=function(){return _0x35b5c8;};return a168_0x9234();}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a168_0x40cb9a(0xd6),'command':'detail','description':a168_0x40cb9a(0xc6),'risk':'read','flags':[SQLCODE_FLAG,{'name':a168_0x40cb9a(0xcc),'type':a168_0x40cb9a(0xca),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x20dbbc){const _0xdbb60c=a168_0x40cb9a,_0x358a8f=await getSqlQueryInfo(_0x20dbbc[_0xdbb60c(0xc7)],_0x20dbbc[_0xdbb60c(0xc8)](_0xdbb60c(0xc5))),_0x5cf044=_0x20dbbc[_0xdbb60c(0xd7)](_0xdbb60c(0xcc));if(_0x5cf044)return{'ok':!![],'data':_0x358a8f};const _0x295e84=_0x358a8f[_0xdbb60c(0xce)]?await getDbName(_0x20dbbc['appCode'],_0x358a8f[_0xdbb60c(0xce)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x358a8f['sqlCode'],'sqlName':_0x358a8f[_0xdbb60c(0xcf)],'db':_0x295e84?_0x295e84+'\x20('+_0x358a8f[_0xdbb60c(0xce)]+')':_0x358a8f['dbId']??'','description':_0x358a8f[_0xdbb60c(0xc3)]??'','sqlContent':_0x358a8f[_0xdbb60c(0xd3)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a169_0x2df5(){const _0x250932=['params','execError','34518MzPnfI','str','now','read','isArray','3738hulMUX','9133430TtvqCx','2135VeYkzg','5752840OAJMKV','22536LlUwvp','exec','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','length','SQL\x20execution\x20failed','9428tpGgCW','2515kxWRoC','Returned\x20','24396ATmnEE','appCode','1449782GkhfBR','execResult','9XZyoIg','1618GYtEhz'];a169_0x2df5=function(){return _0x250932;};return a169_0x2df5();}const a169_0x4f0f10=a169_0x50c3;(function(_0x37b519,_0x16591c){const _0x24c32c=a169_0x50c3,_0x4b7489=_0x37b519();while(!![]){try{const _0x29a1b6=-parseInt(_0x24c32c(0x19c))/0x1+parseInt(_0x24c32c(0x19f))/0x2*(-parseInt(_0x24c32c(0x18e))/0x3)+-parseInt(_0x24c32c(0x197))/0x4*(parseInt(_0x24c32c(0x198))/0x5)+-parseInt(_0x24c32c(0x19a))/0x6*(parseInt(_0x24c32c(0x190))/0x7)+parseInt(_0x24c32c(0x191))/0x8+parseInt(_0x24c32c(0x19e))/0x9*(-parseInt(_0x24c32c(0x18f))/0xa)+-parseInt(_0x24c32c(0x189))/0xb*(-parseInt(_0x24c32c(0x192))/0xc);if(_0x29a1b6===_0x16591c)break;else _0x4b7489['push'](_0x4b7489['shift']());}catch(_0x2c6c33){_0x4b7489['push'](_0x4b7489['shift']());}}}(a169_0x2df5,0xc7145));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a169_0x50c3(_0x3844f6,_0x258ce8){_0x3844f6=_0x3844f6-0x189;const _0x2df56c=a169_0x2df5();let _0x50c33f=_0x2df56c[_0x3844f6];return _0x50c33f;}export const sqlExec={'service':'sql','command':a169_0x4f0f10(0x193),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a169_0x4f0f10(0x18c),'flags':[SQLCODE_FLAG,{'name':a169_0x4f0f10(0x1a0),'type':'string','description':a169_0x4f0f10(0x194)}],async 'execute'(_0xdf8b2f){const _0x45e5cf=a169_0x4f0f10,_0x3dd66d=parseJsonParams(_0xdf8b2f[_0x45e5cf(0x18a)](_0x45e5cf(0x1a0))),_0x482e54=Date[_0x45e5cf(0x18b)](),_0x184f35=await executeSql(_0xdf8b2f[_0x45e5cf(0x19b)],_0xdf8b2f[_0x45e5cf(0x18a)]('sqlcode'),_0x3dd66d),_0x404e77=Date[_0x45e5cf(0x18b)]()-_0x482e54,_0xf6de90=_0x184f35?.[_0x45e5cf(0x19d)]??_0x184f35,_0x1ac7cf=_0x184f35?.['execSuccess']??!![];if(!_0x1ac7cf)return{'ok':![],'data':{'error':_0x184f35?.[_0x45e5cf(0x1a1)]||'SQL\x20execution\x20failed','elapsed':_0x404e77},'message':_0x45e5cf(0x196)};const _0x2df03c=Array[_0x45e5cf(0x18d)](_0xf6de90)?_0xf6de90:[];return{'ok':!![],'data':{'rows':_0x2df03c,'rowCount':_0x2df03c[_0x45e5cf(0x195)],'elapsed':_0x404e77},'message':_0x45e5cf(0x199)+_0x2df03c[_0x45e5cf(0x195)]+'\x20row(s)\x20in\x20'+_0x404e77+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3b994b,_0x34cc09){const _0x3be7ef=a170_0x3bff,_0x326dc4=_0x3b994b();while(!![]){try{const _0x585786=-parseInt(_0x3be7ef(0x177))/0x1*(parseInt(_0x3be7ef(0x174))/0x2)+-parseInt(_0x3be7ef(0x176))/0x3+-parseInt(_0x3be7ef(0x178))/0x4+-parseInt(_0x3be7ef(0x173))/0x5+parseInt(_0x3be7ef(0x171))/0x6*(-parseInt(_0x3be7ef(0x170))/0x7)+-parseInt(_0x3be7ef(0x175))/0x8*(parseInt(_0x3be7ef(0x179))/0x9)+parseInt(_0x3be7ef(0x172))/0xa;if(_0x585786===_0x34cc09)break;else _0x326dc4['push'](_0x326dc4['shift']());}catch(_0x46aa74){_0x326dc4['push'](_0x326dc4['shift']());}}}(a170_0x29f0,0x4d849));function a170_0x3bff(_0x37ba7a,_0x4b79f7){_0x37ba7a=_0x37ba7a-0x170;const _0x29f040=a170_0x29f0();let _0x3bff02=_0x29f040[_0x37ba7a];return _0x3bff02;}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a170_0x29f0(){const _0x9d9669=['112oBZfnB','141468lVIjLC','20208880xKkWFG','1458915NDkGUr','214mAHoEB','34192VwIjIz','922170fTHvKe','1015RkhJFO','1174100SEhVdn','684xfehbu'];a170_0x29f0=function(){return _0x9d9669;};return a170_0x29f0();}import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a171_0x504b(_0xffe642,_0x37af91){_0xffe642=_0xffe642-0xe5;const _0x3eb015=a171_0x3eb0();let _0x504bdd=_0x3eb015[_0xffe642];return _0x504bdd;}const a171_0x4fd8f7=a171_0x504b;(function(_0x12280e,_0xf0d70c){const _0x547b00=a171_0x504b,_0x50a7e6=_0x12280e();while(!![]){try{const _0x28c85d=-parseInt(_0x547b00(0xe8))/0x1*(parseInt(_0x547b00(0xf5))/0x2)+-parseInt(_0x547b00(0x104))/0x3*(parseInt(_0x547b00(0xff))/0x4)+parseInt(_0x547b00(0xed))/0x5*(parseInt(_0x547b00(0xf2))/0x6)+-parseInt(_0x547b00(0x102))/0x7+parseInt(_0x547b00(0xfa))/0x8+parseInt(_0x547b00(0xfe))/0x9+parseInt(_0x547b00(0xeb))/0xa;if(_0x28c85d===_0xf0d70c)break;else _0x50a7e6['push'](_0x50a7e6['shift']());}catch(_0x1a540a){_0x50a7e6['push'](_0x50a7e6['shift']());}}}(a171_0x3eb0,0x98ce1));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_0x4fd8f7(0xea),'command':a171_0x4fd8f7(0xf8),'description':a171_0x4fd8f7(0xfd),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x4fd8f7(0xf3),'type':a171_0x4fd8f7(0xf7),'description':a171_0x4fd8f7(0xf0)},{'name':a171_0x4fd8f7(0xec),'type':a171_0x4fd8f7(0x101),'description':a171_0x4fd8f7(0xe7),'default':0x1},{'name':a171_0x4fd8f7(0x106),'type':a171_0x4fd8f7(0x101),'description':'Page\x20size'},{'name':a171_0x4fd8f7(0x109),'type':a171_0x4fd8f7(0xfb),'description':a171_0x4fd8f7(0x103)}],async 'execute'(_0x80f404){const _0x26ae5e=a171_0x4fd8f7,_0x41d339=await listSqlQueries(_0x80f404['appCode'],{'sqlCode':_0x80f404['str'](_0x26ae5e(0x108))||undefined,'sqlName':_0x80f404[_0x26ae5e(0x105)](_0x26ae5e(0xf3))||undefined,'currentPage':_0x80f404['num'](_0x26ae5e(0xec)),'pageSize':_0x80f404['num'](_0x26ae5e(0x106),0x32)}),_0xa4a5c3=_0x80f404[_0x26ae5e(0xf6)](_0x26ae5e(0x109)),_0x527271=_0x41d339[_0x26ae5e(0xee)]??[],_0x500fde=_0x41d339[_0x26ae5e(0x100)]?.[_0x26ae5e(0xf9)]??_0x527271['length'];let _0x3f4ad6;return _0xa4a5c3?_0x3f4ad6=_0x527271:_0x3f4ad6=await Promise['all'](_0x527271[_0x26ae5e(0x107)](async _0x2e267a=>{const _0x2bbba9=_0x26ae5e;let _0x4b684f;try{_0x4b684f=_0x2e267a['dbId']?await getDbName(_0x80f404[_0x2bbba9(0xe5)],_0x2e267a[_0x2bbba9(0xf4)]):undefined;}catch{}return{'sqlCode':_0x2e267a[_0x2bbba9(0xfc)],'sqlName':_0x2e267a['sqlName'],'description':_0x2e267a[_0x2bbba9(0xf1)]??'','db':_0x4b684f?_0x4b684f+'\x20('+_0x2e267a['dbId']+')':_0x2e267a[_0x2bbba9(0xf4)]??''};})),{'ok':!![],'data':_0x3f4ad6,'message':_0x527271[_0x26ae5e(0xef)]===0x0?_0x26ae5e(0xe6):'Found\x20'+_0x527271[_0x26ae5e(0xef)]+_0x26ae5e(0xe9)+_0x500fde+').'};}};function a171_0x3eb0(){const _0xca2ea1=['name','dbId','335858uukqvv','bool','string','list','totalCount','4683896gebeku','boolean','sqlCode','List\x20custom\x20SQL\x20queries','8016633xbQUal','116mNhekH','paging','number','7932344qzsuwd','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','112758DvKLYQ','str','pagesize','map','sqlcode','verbose','appCode','No\x20custom\x20SQL\x20queries\x20found.','Page\x20number','1FbmApq','\x20SQL\x20queries\x20(total:\x20','sql','9848910PvLLsr','page','2935NiZXFn','tableData','length','Filter\x20by\x20SQL\x20name','description','5682IESluf'];a171_0x3eb0=function(){return _0xca2ea1;};return a171_0x3eb0();}
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a172_0x491d84=a172_0x51f2;(function(_0x396239,_0x2beebe){const _0x88f509=a172_0x51f2,_0x345ff4=_0x396239();while(!![]){try{const _0x51c227=parseInt(_0x88f509(0x170))/0x1+-parseInt(_0x88f509(0x15f))/0x2*(parseInt(_0x88f509(0x182))/0x3)+parseInt(_0x88f509(0x180))/0x4*(-parseInt(_0x88f509(0x16b))/0x5)+-parseInt(_0x88f509(0x162))/0x6*(parseInt(_0x88f509(0x15e))/0x7)+parseInt(_0x88f509(0x17b))/0x8+-parseInt(_0x88f509(0x148))/0x9*(parseInt(_0x88f509(0x14a))/0xa)+parseInt(_0x88f509(0x149))/0xb;if(_0x51c227===_0x2beebe)break;else _0x345ff4['push'](_0x345ff4['shift']());}catch(_0x1fa40b){_0x345ff4['push'](_0x345ff4['shift']());}}}(a172_0x402b,0xe8e7b));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a172_0x402b(){const _0x3c5fa6=['40DLgZRH','description','length','sqlcode','name','1713672OJSbOD','catch','Force\x20overwrite\x20local\x20unsynced\x20changes','dbId','unchanged','skipped','paging','\x20skipped,\x20','conflict','replace','path','8938320GOlwSW','sql','force','Pull\x20complete:\x20','nonInteractive','592548gupYMZ','Would\x20pull\x20','2736651LcVmVw','377802FOmYES','18121026TwigFf','290YRhcom','sqlCode','tableData','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','filter','mybatisXml','pull','sqlRoot','totalCount','cancelled','No\x20remote\x20SQL\x20queries\x20matched.','boolean','appCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','trimStart','lockFilePath','sqlName','sqlRootDir','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','message','14wxUEnD','2KBmmmp','str','lastSync','629022tZVUCV','utf8','sqlContent','toISOString','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','push','string','Filter\x20by\x20SQL\x20display\x20name','sqls'];a172_0x402b=function(){return _0x3c5fa6;};return a172_0x402b();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a172_0x51f2(_0x175468,_0x346226){_0x175468=_0x175468-0x148;const _0x402bc2=a172_0x402b();let _0x51f20c=_0x402bc2[_0x175468];return _0x51f20c;}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x385ff1,_0x23582e){const _0x39d846=a172_0x51f2,_0x236f60=[];let _0x5888fd=0x1;while(!![]){const _0x565401=await listSqlQueries(_0x385ff1,{'currentPage':_0x5888fd,'pageSize':PAGE_SIZE,'sqlCode':_0x23582e[_0x39d846(0x14b)],'sqlName':_0x23582e['sqlName']}),_0x54d493=_0x565401[_0x39d846(0x14c)]??[];_0x236f60[_0x39d846(0x167)](..._0x54d493);if(_0x54d493[_0x39d846(0x16d)]===0x0)break;const _0x1cb6b5=_0x565401[_0x39d846(0x176)]?.[_0x39d846(0x152)];if(_0x1cb6b5!=null?_0x236f60['length']>=_0x1cb6b5:_0x54d493[_0x39d846(0x16d)]<PAGE_SIZE)break;_0x5888fd++;}return _0x236f60;}async function ensureSqlContent(_0x40b419){const _0x907d47=a172_0x51f2;if(_0x40b419[_0x907d47(0x164)]!=null&&String(_0x40b419[_0x907d47(0x164)])[_0x907d47(0x16d)]>0x0)return _0x40b419;return getSqlQueryDetail(_0x40b419[_0x907d47(0x14b)]);}export const sqlPull={'service':a172_0x491d84(0x17c),'command':a172_0x491d84(0x150),'description':a172_0x491d84(0x157),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x491d84(0x16f),'type':a172_0x491d84(0x168),'description':a172_0x491d84(0x169)},{'name':a172_0x491d84(0x17d),'type':a172_0x491d84(0x155),'description':a172_0x491d84(0x172)}],async 'dryRun'(_0x1ed1de){const _0x107bbd=a172_0x491d84,_0xd0a08=loadSqlProjectConfig(_0x1ed1de[_0x107bbd(0x156)]),_0x362be3=await readSqlLockFile(_0xd0a08['lockFilePath']),{appLock:_0x54fa9f}=ensureSqlLockScope(_0x362be3??createEmptySqlLock(),_0xd0a08[_0x107bbd(0x156)],_0xd0a08[_0x107bbd(0x151)],_0x107bbd(0x150)),_0x574845=await fetchAllSqlQueries(_0x1ed1de[_0x107bbd(0x156)],{'sqlCode':_0x1ed1de[_0x107bbd(0x160)]('sqlcode')||undefined,'sqlName':_0x1ed1de[_0x107bbd(0x160)]('name')||undefined}),_0x312667=[];for(const _0x500d38 of _0x574845){const _0xba6c89=await ensureSqlContent(_0x500d38),_0x19428c=ensureRemoteSqlContent(_0xba6c89),_0x43915e=detectModeFromSql(_0xba6c89),_0xafae28=_0xba6c89[_0x107bbd(0x173)]?await getDbName(_0x1ed1de['appCode'],Number(_0xba6c89[_0x107bbd(0x173)]))[_0x107bbd(0x171)](()=>undefined):undefined,_0xdaed8b=buildLocalSqlFileContent({'sqlCode':_0xba6c89[_0x107bbd(0x14b)],'sqlName':_0xba6c89[_0x107bbd(0x15a)],'dbId':_0xba6c89[_0x107bbd(0x173)]},_0x19428c,{'dbName':_0xafae28,'mode':_0x43915e,'syncedAt':new Date()[_0x107bbd(0x165)](),'description':_0xba6c89['description']}),_0x1f72aa=buildSqlLockEntry(_0xba6c89,_0x19428c,'',{'dbName':_0xafae28}),_0x49f292=resolveLocalSqlFilePath(_0xd0a08,_0xba6c89[_0x107bbd(0x14b)],_0x1f72aa);let _0x175733='would_pull',_0x35e404;if(await fileExists(_0x49f292)){const _0x606e78=await readFile(_0x49f292,_0x107bbd(0x163));isEquivalentPulledSqlFile(_0x606e78,_0xdaed8b,_0x43915e)?(_0x175733=_0x107bbd(0x175),_0x35e404=_0x107bbd(0x174)):(_0x175733=_0x107bbd(0x178),_0x35e404=_0x107bbd(0x15c));}_0x312667[_0x107bbd(0x167)]({'sqlCode':_0xba6c89[_0x107bbd(0x14b)],'sqlName':_0xba6c89[_0x107bbd(0x15a)],'filePath':_0x49f292,'status':_0x175733,'reason':_0x35e404});}return{'method':'POST','url':_0x107bbd(0x166),'body':{'appCode':_0x1ed1de[_0x107bbd(0x156)],'sqlCode':_0x1ed1de[_0x107bbd(0x160)](_0x107bbd(0x16e))||null,'sqlName':_0x1ed1de[_0x107bbd(0x160)](_0x107bbd(0x16f))||null,'files':_0x312667},'description':_0x107bbd(0x181)+_0x312667[_0x107bbd(0x16d)]+'\x20SQL\x20file(s)\x20into\x20'+_0xd0a08[_0x107bbd(0x15b)]};},async 'execute'(_0x14b08e){const _0x4dc777=a172_0x491d84,_0x1ed3e8=loadSqlProjectConfig(_0x14b08e[_0x4dc777(0x156)]),_0x38aea6=await readSqlLockFile(_0x1ed3e8[_0x4dc777(0x159)]),{lockData:_0x3b6229,appLock:_0x116637}=ensureSqlLockScope(_0x38aea6??createEmptySqlLock(),_0x1ed3e8[_0x4dc777(0x156)],_0x1ed3e8['sqlRoot'],_0x4dc777(0x150)),_0x4759ce=_0x14b08e['bool']('force'),_0x1b76a1=await fetchAllSqlQueries(_0x14b08e[_0x4dc777(0x156)],{'sqlCode':_0x14b08e[_0x4dc777(0x160)](_0x4dc777(0x16e))||undefined,'sqlName':_0x14b08e[_0x4dc777(0x160)](_0x4dc777(0x16f))||undefined});if(_0x1b76a1['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4dc777(0x154)};const _0x47f847=[],_0x3a8b0e=[];for(const _0x5f11cf of _0x1b76a1){try{_0x47f847[_0x4dc777(0x167)](await ensureSqlContent(_0x5f11cf));}catch(_0x2a0968){_0x3a8b0e[_0x4dc777(0x167)]({'sqlCode':_0x5f11cf[_0x4dc777(0x14b)],'error':_0x2a0968 instanceof Error?_0x2a0968[_0x4dc777(0x15d)]:String(_0x2a0968)});}}if(_0x4759ce&&!_0x14b08e[_0x4dc777(0x17f)]){let _0x4b4982=![];for(const _0x33fedf of _0x47f847){const _0xe29d53=detectModeFromSql(_0x33fedf),_0x48d5e7=_0x33fedf[_0x4dc777(0x173)]?await getDbName(_0x14b08e['appCode'],Number(_0x33fedf[_0x4dc777(0x173)]))[_0x4dc777(0x171)](()=>undefined):undefined,_0x457190=buildLocalSqlFileContent({'sqlCode':_0x33fedf['sqlCode'],'sqlName':_0x33fedf['sqlName'],'dbId':_0x33fedf[_0x4dc777(0x173)]},ensureRemoteSqlContent(_0x33fedf),{'dbName':_0x48d5e7,'mode':_0xe29d53,'syncedAt':new Date()[_0x4dc777(0x165)](),'description':_0x33fedf[_0x4dc777(0x16c)]}),_0x55e319=resolveLocalSqlFilePath(_0x1ed3e8,_0x33fedf[_0x4dc777(0x14b)],buildSqlLockEntry(_0x33fedf,ensureRemoteSqlContent(_0x33fedf),'',{'dbName':_0x48d5e7}));if(await fileExists(_0x55e319)){const _0x20eef7=await readFile(_0x55e319,_0x4dc777(0x163));if(!isEquivalentPulledSqlFile(_0x20eef7,_0x457190,_0xe29d53)){_0x4b4982=!![];break;}}}if(_0x4b4982){const _0x1d73b6=await confirmForceOverwrite(_0x4dc777(0x14d));if(!_0x1d73b6)throw CliErrors[_0x4dc777(0x153)]('Force\x20pull\x20cancelled.');}}const _0x379931=cloneSqlLockData(_0x3b6229),_0xb0b34d=_0x379931['apps'][_0x1ed3e8['appCode']],_0x1c6ccb=[],_0x5b5339=[];for(const _0x14357d of _0x47f847){const _0x511ad5=_0xb0b34d[_0x4dc777(0x16a)][_0x14357d[_0x4dc777(0x14b)]],_0x13547d=ensureRemoteSqlContent(_0x14357d),_0x1ba919=detectModeFromSql(_0x14357d),_0x3e2e17=_0x14357d[_0x4dc777(0x173)]?await getDbName(_0x14b08e['appCode'],Number(_0x14357d[_0x4dc777(0x173)]))[_0x4dc777(0x171)](()=>undefined):undefined,_0x5bbab6=buildLocalSqlFileContent({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'sqlName':_0x14357d['sqlName'],'dbId':_0x14357d['dbId']},_0x13547d,{'dbName':_0x3e2e17,'mode':_0x1ba919,'syncedAt':new Date()[_0x4dc777(0x165)](),'description':_0x14357d['description']}),_0x43bbfb=buildSqlLockEntry(_0x14357d,_0x13547d,computeSqlContentHash(_0x5bbab6),{'dbName':_0x3e2e17}),_0x317623=_0x43bbfb[_0x4dc777(0x17a)],_0x4f4d69=join(_0x1ed3e8[_0x4dc777(0x15b)],_0x317623);try{if(await fileExists(_0x4f4d69)){const _0x51abae=await readFile(_0x4f4d69,_0x4dc777(0x163));if(isEquivalentPulledSqlFile(_0x51abae,_0x5bbab6,_0x1ba919)){_0x5b5339[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'reason':'unchanged'}),_0xb0b34d[_0x4dc777(0x16a)][_0x14357d['sqlCode']]={..._0x43bbfb,'hash':computeSqlContentHash(_0x51abae),'path':_0x317623};continue;}if(!_0x4759ce){_0x5b5339['push']({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0xf6164b=_0x511ad5?.[_0x4dc777(0x17a)]?join(_0x1ed3e8['sqlRootDir'],_0x511ad5[_0x4dc777(0x17a)]):undefined;_0xf6164b&&_0xf6164b!==_0x4f4d69&&await fileExists(_0xf6164b)&&await rm(_0xf6164b,{'force':!![]}),await ensureParentDirectory(_0x4f4d69),await writeFile(_0x4f4d69,_0x5bbab6,_0x4dc777(0x163)),_0xb0b34d[_0x4dc777(0x16a)][_0x14357d[_0x4dc777(0x14b)]]={..._0x43bbfb,'path':_0x317623},_0x1c6ccb[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'filePath':_0x4f4d69});}catch(_0x48d933){_0x3a8b0e[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'error':_0x48d933 instanceof Error?_0x48d933[_0x4dc777(0x15d)]:String(_0x48d933)});}}return _0xb0b34d[_0x4dc777(0x161)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1ed3e8[_0x4dc777(0x159)],_0x379931),{'ok':_0x3a8b0e[_0x4dc777(0x16d)]===0x0,'data':{'pulled':_0x1c6ccb,'skipped':_0x5b5339,'failed':_0x3a8b0e},'message':_0x4dc777(0x17e)+_0x1c6ccb[_0x4dc777(0x16d)]+'\x20written,\x20'+_0x5b5339[_0x4dc777(0x16d)]+_0x4dc777(0x177)+_0x3a8b0e['length']+'\x20failed'};}};function detectModeFromSql(_0x31558f){const _0x3fc9d6=a172_0x491d84,_0xb61b28=ensureRemoteSqlContent(_0x31558f),_0x20865d=stripLocalSqlMetadata(_0xb61b28,_0x3fc9d6(0x14f))[_0x3fc9d6(0x158)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x20865d))return _0x3fc9d6(0x14f);return _0x3fc9d6(0x17c);}function isEquivalentPulledSqlFile(_0x5b9eff,_0x301e18,_0x9a023){return normalizePullComparableContent(_0x5b9eff,_0x9a023)===normalizePullComparableContent(_0x301e18,_0x9a023);}function normalizePullComparableContent(_0x1de437,_0x4d3911){const _0x138c98=a172_0x491d84,_0x344577=_0x1de437[_0x138c98(0x179)](/\r\n/g,'\x0a')['split']('\x0a'),_0x1b5cb9=_0x344577[_0x138c98(0x14e)](_0x666feb=>!isSyncedAtMetadataLine(_0x666feb,_0x4d3911));return _0x1b5cb9['join']('\x0a');}function isSyncedAtMetadataLine(_0x7985b4,_0x52bd00){const _0x262b86=a172_0x491d84;if(_0x52bd00===_0x262b86(0x14f))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x7985b4);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x7985b4);}
|
|
1
|
+
const a172_0x980794=a172_0x1a6a;(function(_0x591d28,_0x1b2198){const _0x7947d7=a172_0x1a6a,_0x597092=_0x591d28();while(!![]){try{const _0x15adc0=parseInt(_0x7947d7(0xed))/0x1*(-parseInt(_0x7947d7(0xe8))/0x2)+parseInt(_0x7947d7(0xd2))/0x3*(parseInt(_0x7947d7(0xcb))/0x4)+-parseInt(_0x7947d7(0xf6))/0x5*(parseInt(_0x7947d7(0xcc))/0x6)+parseInt(_0x7947d7(0xe9))/0x7*(parseInt(_0x7947d7(0xf4))/0x8)+-parseInt(_0x7947d7(0xec))/0x9*(-parseInt(_0x7947d7(0xbb))/0xa)+parseInt(_0x7947d7(0xc7))/0xb*(-parseInt(_0x7947d7(0xd4))/0xc)+-parseInt(_0x7947d7(0xbe))/0xd;if(_0x15adc0===_0x1b2198)break;else _0x597092['push'](_0x597092['shift']());}catch(_0x2437b1){_0x597092['push'](_0x597092['shift']());}}}(a172_0x198a,0xf3d1d));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';function a172_0x198a(){const _0x5c2f47=['message','str','string','path','bool','sqls','force','skipped','trimStart','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlcode','sqlRoot','sql','utf8','name','replace','127898KATkIh','665HTIaBT','paging','\x20written,\x20','8926974nvZldT','10tGtQsL','unchanged','toISOString','split','POST','Force\x20overwrite\x20local\x20unsynced\x20changes','test','145960svHJRz','appCode','317620sHJtdy','No\x20remote\x20SQL\x20queries\x20matched.','catch','20wSCErq','dbId','sqlRootDir','37360388qgTNvd','would_pull','length','pull','sqlName','lockFilePath','apps','push','lastSync','3837581skIFHS','Filter\x20by\x20SQL\x20display\x20name','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Pull\x20complete:\x20','151132SFjvTj','24OmOqbS','tableData','nonInteractive','mybatisXml','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlContent','111SllBlk','sqlCode','12ZPVQNt','\x20failed','conflict','description'];a172_0x198a=function(){return _0x5c2f47;};return a172_0x198a();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x505263,_0x4f70c9){const _0x5971ee=a172_0x1a6a,_0x4f6cfb=[];let _0x286e2c=0x1;while(!![]){const _0x234ead=await listSqlQueries(_0x505263,{'currentPage':_0x286e2c,'pageSize':PAGE_SIZE,'sqlCode':_0x4f70c9[_0x5971ee(0xd3)],'sqlName':_0x4f70c9['sqlName']}),_0x4aed92=_0x234ead[_0x5971ee(0xcd)]??[];_0x4f6cfb['push'](..._0x4aed92);if(_0x4aed92[_0x5971ee(0xc0)]===0x0)break;const _0xcc5616=_0x234ead[_0x5971ee(0xea)]?.['totalCount'];if(_0xcc5616!=null?_0x4f6cfb[_0x5971ee(0xc0)]>=_0xcc5616:_0x4aed92['length']<PAGE_SIZE)break;_0x286e2c++;}return _0x4f6cfb;}function a172_0x1a6a(_0x1d9116,_0x3e82eb){_0x1d9116=_0x1d9116-0xb9;const _0x198a4e=a172_0x198a();let _0x1a6a86=_0x198a4e[_0x1d9116];return _0x1a6a86;}async function ensureSqlContent(_0x4ef3a5){const _0xddad2c=a172_0x1a6a;if(_0x4ef3a5[_0xddad2c(0xd1)]!=null&&String(_0x4ef3a5[_0xddad2c(0xd1)])[_0xddad2c(0xc0)]>0x0)return _0x4ef3a5;return getSqlQueryDetail(_0x4ef3a5['sqlCode']);}export const sqlPull={'service':a172_0x980794(0xe4),'command':'pull','description':a172_0x980794(0xd0),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x980794(0xe6),'type':a172_0x980794(0xda),'description':a172_0x980794(0xc8)},{'name':'force','type':'boolean','description':a172_0x980794(0xf2)}],async 'dryRun'(_0x32061e){const _0x3392d7=a172_0x980794,_0x3251d2=loadSqlProjectConfig(_0x32061e[_0x3392d7(0xf5)]),_0x49c3bb=await readSqlLockFile(_0x3251d2[_0x3392d7(0xc3)]),{appLock:_0x46c486}=ensureSqlLockScope(_0x49c3bb??createEmptySqlLock(),_0x3251d2[_0x3392d7(0xf5)],_0x3251d2[_0x3392d7(0xe3)],_0x3392d7(0xc1)),_0x3976f3=await fetchAllSqlQueries(_0x32061e['appCode'],{'sqlCode':_0x32061e['str']('sqlcode')||undefined,'sqlName':_0x32061e[_0x3392d7(0xd9)]('name')||undefined}),_0x49b5be=[];for(const _0xec37a3 of _0x3976f3){const _0x4d1a20=await ensureSqlContent(_0xec37a3),_0x5a938d=ensureRemoteSqlContent(_0x4d1a20),_0x5c30d4=detectModeFromSql(_0x4d1a20),_0x53163f=_0x4d1a20[_0x3392d7(0xbc)]?await getDbName(_0x32061e[_0x3392d7(0xf5)],Number(_0x4d1a20['dbId']))[_0x3392d7(0xba)](()=>undefined):undefined,_0x2525ca=buildLocalSqlFileContent({'sqlCode':_0x4d1a20[_0x3392d7(0xd3)],'sqlName':_0x4d1a20[_0x3392d7(0xc2)],'dbId':_0x4d1a20[_0x3392d7(0xbc)]},_0x5a938d,{'dbName':_0x53163f,'mode':_0x5c30d4,'syncedAt':new Date()[_0x3392d7(0xef)](),'description':_0x4d1a20[_0x3392d7(0xd7)]}),_0x101587=buildSqlLockEntry(_0x4d1a20,_0x5a938d,'',{'dbName':_0x53163f}),_0x2dc89b=resolveLocalSqlFilePath(_0x3251d2,_0x4d1a20[_0x3392d7(0xd3)],_0x101587);let _0x5e9e00=_0x3392d7(0xbf),_0x3b9d64;if(await fileExists(_0x2dc89b)){const _0x179697=await readFile(_0x2dc89b,_0x3392d7(0xe5));isEquivalentPulledSqlFile(_0x179697,_0x2525ca,_0x5c30d4)?(_0x5e9e00=_0x3392d7(0xdf),_0x3b9d64=_0x3392d7(0xee)):(_0x5e9e00=_0x3392d7(0xd6),_0x3b9d64=_0x3392d7(0xc9));}_0x49b5be[_0x3392d7(0xc5)]({'sqlCode':_0x4d1a20[_0x3392d7(0xd3)],'sqlName':_0x4d1a20[_0x3392d7(0xc2)],'filePath':_0x2dc89b,'status':_0x5e9e00,'reason':_0x3b9d64});}return{'method':_0x3392d7(0xf1),'url':_0x3392d7(0xe1),'body':{'appCode':_0x32061e[_0x3392d7(0xf5)],'sqlCode':_0x32061e['str'](_0x3392d7(0xe2))||null,'sqlName':_0x32061e['str'](_0x3392d7(0xe6))||null,'files':_0x49b5be},'description':'Would\x20pull\x20'+_0x49b5be['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x3251d2[_0x3392d7(0xbd)]};},async 'execute'(_0x6e924f){const _0x4600c9=a172_0x980794,_0x246868=loadSqlProjectConfig(_0x6e924f[_0x4600c9(0xf5)]),_0x411869=await readSqlLockFile(_0x246868[_0x4600c9(0xc3)]),{lockData:_0x274edb,appLock:_0x1db03a}=ensureSqlLockScope(_0x411869??createEmptySqlLock(),_0x246868[_0x4600c9(0xf5)],_0x246868['sqlRoot'],'pull'),_0x1fc599=_0x6e924f[_0x4600c9(0xdc)](_0x4600c9(0xde)),_0x404232=await fetchAllSqlQueries(_0x6e924f[_0x4600c9(0xf5)],{'sqlCode':_0x6e924f[_0x4600c9(0xd9)]('sqlcode')||undefined,'sqlName':_0x6e924f['str'](_0x4600c9(0xe6))||undefined});if(_0x404232[_0x4600c9(0xc0)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4600c9(0xb9)};const _0x4e6ca2=[],_0x4a8dc6=[];for(const _0x377d02 of _0x404232){try{_0x4e6ca2[_0x4600c9(0xc5)](await ensureSqlContent(_0x377d02));}catch(_0x3caed0){_0x4a8dc6[_0x4600c9(0xc5)]({'sqlCode':_0x377d02[_0x4600c9(0xd3)],'error':_0x3caed0 instanceof Error?_0x3caed0[_0x4600c9(0xd8)]:String(_0x3caed0)});}}if(_0x1fc599&&!_0x6e924f[_0x4600c9(0xce)]){let _0x390689=![];for(const _0x387db4 of _0x4e6ca2){const _0x4a1bea=detectModeFromSql(_0x387db4),_0x4b1911=_0x387db4[_0x4600c9(0xbc)]?await getDbName(_0x6e924f['appCode'],Number(_0x387db4[_0x4600c9(0xbc)]))[_0x4600c9(0xba)](()=>undefined):undefined,_0xe8ef11=buildLocalSqlFileContent({'sqlCode':_0x387db4[_0x4600c9(0xd3)],'sqlName':_0x387db4['sqlName'],'dbId':_0x387db4[_0x4600c9(0xbc)]},ensureRemoteSqlContent(_0x387db4),{'dbName':_0x4b1911,'mode':_0x4a1bea,'syncedAt':new Date()[_0x4600c9(0xef)](),'description':_0x387db4['description']}),_0x4a8918=resolveLocalSqlFilePath(_0x246868,_0x387db4[_0x4600c9(0xd3)],buildSqlLockEntry(_0x387db4,ensureRemoteSqlContent(_0x387db4),'',{'dbName':_0x4b1911}));if(await fileExists(_0x4a8918)){const _0x415785=await readFile(_0x4a8918,_0x4600c9(0xe5));if(!isEquivalentPulledSqlFile(_0x415785,_0xe8ef11,_0x4a1bea)){_0x390689=!![];break;}}}if(_0x390689){const _0x145953=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x145953)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}}const _0x5795af=cloneSqlLockData(_0x274edb),_0x56b351=_0x5795af[_0x4600c9(0xc4)][_0x246868[_0x4600c9(0xf5)]],_0x49ee0b=[],_0x12fbba=[];for(const _0x1c744c of _0x4e6ca2){const _0x5ee369=_0x56b351[_0x4600c9(0xdd)][_0x1c744c['sqlCode']],_0x2273b1=ensureRemoteSqlContent(_0x1c744c),_0x597177=detectModeFromSql(_0x1c744c),_0x53f65a=_0x1c744c[_0x4600c9(0xbc)]?await getDbName(_0x6e924f['appCode'],Number(_0x1c744c[_0x4600c9(0xbc)]))[_0x4600c9(0xba)](()=>undefined):undefined,_0x194f69=buildLocalSqlFileContent({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'sqlName':_0x1c744c[_0x4600c9(0xc2)],'dbId':_0x1c744c[_0x4600c9(0xbc)]},_0x2273b1,{'dbName':_0x53f65a,'mode':_0x597177,'syncedAt':new Date()[_0x4600c9(0xef)](),'description':_0x1c744c[_0x4600c9(0xd7)]}),_0x4ebfd5=buildSqlLockEntry(_0x1c744c,_0x2273b1,computeSqlContentHash(_0x194f69),{'dbName':_0x53f65a}),_0x4881ed=_0x4ebfd5[_0x4600c9(0xdb)],_0x272529=join(_0x246868[_0x4600c9(0xbd)],_0x4881ed);try{if(await fileExists(_0x272529)){const _0x5a40e1=await readFile(_0x272529,_0x4600c9(0xe5));if(isEquivalentPulledSqlFile(_0x5a40e1,_0x194f69,_0x597177)){_0x12fbba[_0x4600c9(0xc5)]({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'reason':_0x4600c9(0xee)}),_0x56b351[_0x4600c9(0xdd)][_0x1c744c['sqlCode']]={..._0x4ebfd5,'hash':computeSqlContentHash(_0x5a40e1),'path':_0x4881ed};continue;}if(!_0x1fc599){_0x12fbba['push']({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x92402c=_0x5ee369?.[_0x4600c9(0xdb)]?join(_0x246868['sqlRootDir'],_0x5ee369[_0x4600c9(0xdb)]):undefined;_0x92402c&&_0x92402c!==_0x272529&&await fileExists(_0x92402c)&&await rm(_0x92402c,{'force':!![]}),await ensureParentDirectory(_0x272529),await writeFile(_0x272529,_0x194f69,_0x4600c9(0xe5)),_0x56b351[_0x4600c9(0xdd)][_0x1c744c['sqlCode']]={..._0x4ebfd5,'path':_0x4881ed},_0x49ee0b[_0x4600c9(0xc5)]({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'filePath':_0x272529});}catch(_0x3b9985){_0x4a8dc6[_0x4600c9(0xc5)]({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'error':_0x3b9985 instanceof Error?_0x3b9985[_0x4600c9(0xd8)]:String(_0x3b9985)});}}return _0x56b351[_0x4600c9(0xc6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x246868[_0x4600c9(0xc3)],_0x5795af),{'ok':_0x4a8dc6[_0x4600c9(0xc0)]===0x0,'data':{'pulled':_0x49ee0b,'skipped':_0x12fbba,'failed':_0x4a8dc6},'message':_0x4600c9(0xca)+_0x49ee0b[_0x4600c9(0xc0)]+_0x4600c9(0xeb)+_0x12fbba[_0x4600c9(0xc0)]+'\x20skipped,\x20'+_0x4a8dc6[_0x4600c9(0xc0)]+_0x4600c9(0xd5)};}};function detectModeFromSql(_0x170694){const _0x50c71f=a172_0x980794,_0x2d012f=ensureRemoteSqlContent(_0x170694),_0x1a9db9=stripLocalSqlMetadata(_0x2d012f,_0x50c71f(0xcf))[_0x50c71f(0xe0)]();if(/^<(select|insert|update|delete)\b/i[_0x50c71f(0xf3)](_0x1a9db9))return _0x50c71f(0xcf);return _0x50c71f(0xe4);}function isEquivalentPulledSqlFile(_0xdf74e5,_0x46b75e,_0x3fc4f2){return normalizePullComparableContent(_0xdf74e5,_0x3fc4f2)===normalizePullComparableContent(_0x46b75e,_0x3fc4f2);}function normalizePullComparableContent(_0x552bc9,_0x2a431b){const _0x5b822d=a172_0x980794,_0x96783a=_0x552bc9[_0x5b822d(0xe7)](/\r\n/g,'\x0a')[_0x5b822d(0xf0)]('\x0a'),_0x1e5cf3=_0x96783a['filter'](_0x5a3ed7=>!isSyncedAtMetadataLine(_0x5a3ed7,_0x2a431b));return _0x1e5cf3['join']('\x0a');}function isSyncedAtMetadataLine(_0x2012d1,_0x36d0c1){const _0x5e804d=a172_0x980794;if(_0x36d0c1===_0x5e804d(0xcf))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2012d1);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2012d1);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a173_0x49e7(_0x46eefb,_0x1ec85f){_0x46eefb=_0x46eefb-0x1a8;const _0x514c2f=a173_0x514c();let _0x49e745=_0x514c2f[_0x46eefb];return _0x49e745;}const a173_0x3a5554=a173_0x49e7;(function(_0x3e926c,_0x229699){const _0x41dd26=a173_0x49e7,_0x3352f2=_0x3e926c();while(!![]){try{const _0x55535c=-parseInt(_0x41dd26(0x1e0))/0x1*(parseInt(_0x41dd26(0x1e4))/0x2)+-parseInt(_0x41dd26(0x1ae))/0x3+-parseInt(_0x41dd26(0x1af))/0x4+-parseInt(_0x41dd26(0x1de))/0x5*(-parseInt(_0x41dd26(0x1b4))/0x6)+parseInt(_0x41dd26(0x1c0))/0x7+parseInt(_0x41dd26(0x1d8))/0x8*(parseInt(_0x41dd26(0x1b7))/0x9)+-parseInt(_0x41dd26(0x1cb))/0xa*(parseInt(_0x41dd26(0x1aa))/0xb);if(_0x55535c===_0x229699)break;else _0x3352f2['push'](_0x3352f2['shift']());}catch(_0x375ff3){_0x3352f2['push'](_0x3352f2['shift']());}}}(a173_0x514c,0x7a583));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(_0x5dced7,_0x31240c,_0x2f1da6){const _0x40a156=a173_0x49e7,_0x5169f2=await scanLocalSqlQueries(_0x5dced7),_0xd5a0d5=new Map();for(const _0x5bb304 of _0x5169f2){if(_0x2f1da6&&_0x5bb304[_0x40a156(0x1ca)]!==_0x2f1da6)continue;const _0x21f2c4=_0xd5a0d5[_0x40a156(0x1df)](_0x5bb304[_0x40a156(0x1ca)])??[];_0x21f2c4['push'](_0x5bb304),_0xd5a0d5['set'](_0x5bb304['sqlCode'],_0x21f2c4);}if(_0x2f1da6&&!_0xd5a0d5[_0x40a156(0x1b3)](_0x2f1da6))throw CliErrors['validation'](_0x40a156(0x1dd)+_0x2f1da6);const _0x481c4d=[];for(const [_0x52a391,_0x33ce6d]of _0xd5a0d5[_0x40a156(0x1ed)]()){if(_0x33ce6d['length']===0x1){_0x481c4d[_0x40a156(0x1b8)](_0x33ce6d[0x0]);continue;}const _0x2d9062=_0x31240c[_0x40a156(0x1d4)][_0x52a391],_0x6650f1=_0x2d9062?.[_0x40a156(0x1d5)],_0x3840c8=_0x6650f1?_0x33ce6d[_0x40a156(0x1c4)](_0x3c1482=>_0x3c1482['relativePath']!==_0x6650f1):_0x33ce6d;if(_0x2d9062&&_0x3840c8[_0x40a156(0x1c2)]===0x1){_0x481c4d[_0x40a156(0x1b8)](_0x3840c8[0x0]);continue;}throw CliErrors[_0x40a156(0x1d1)](_0x40a156(0x1d9)+_0x52a391+_0x40a156(0x1db));}return _0x481c4d;}export const sqlPush={'service':a173_0x3a5554(0x1be),'command':a173_0x3a5554(0x1b8),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a173_0x3a5554(0x1b6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x3a5554(0x1b0),'type':a173_0x3a5554(0x1e2),'description':a173_0x3a5554(0x1bd)}],async 'dryRun'(_0x4d9a51){const _0x2ac10f=a173_0x3a5554,_0x355ff7=loadSqlProjectConfig(_0x4d9a51[_0x2ac10f(0x1ab)]),_0x534962=await readSqlLockFile(_0x355ff7[_0x2ac10f(0x1c3)]),{appLock:_0x5cd4d4}=ensureSqlLockScope(_0x534962??createEmptySqlLock(),_0x4d9a51[_0x2ac10f(0x1ab)],_0x355ff7[_0x2ac10f(0x1c8)],_0x2ac10f(0x1b8)),_0x41eb1f=await getTargetSqlQueries(_0x355ff7,_0x5cd4d4,_0x4d9a51[_0x2ac10f(0x1cd)](_0x2ac10f(0x1ee))||undefined),_0x5ede22=[];for(const _0x1dabf5 of _0x41eb1f){const _0xafd3f6=await computeSqlFileHash(_0x1dabf5[_0x2ac10f(0x1b9)]),_0x337c56=_0x5cd4d4[_0x2ac10f(0x1d4)][_0x1dabf5[_0x2ac10f(0x1ca)]],_0x2a92c4=!!_0x337c56&&(_0x337c56[_0x2ac10f(0x1d5)]!==_0x1dabf5[_0x2ac10f(0x1e6)]||!!_0x1dabf5['sqlName']&&_0x337c56['sqlName']!==_0x1dabf5[_0x2ac10f(0x1c5)]);if(!_0x4d9a51['bool'](_0x2ac10f(0x1b0))&&_0x337c56&&_0x337c56[_0x2ac10f(0x1e5)]===_0xafd3f6&&!_0x2a92c4)continue;_0x5ede22[_0x2ac10f(0x1b8)](_0x1dabf5[_0x2ac10f(0x1ca)]);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x5ede22,'appCode':_0x4d9a51['appCode']},'description':_0x2ac10f(0x1c9)+_0x5ede22['length']+_0x2ac10f(0x1b1)};},async 'execute'(_0x513fa5){const _0x52608b=a173_0x3a5554,_0x28d014=loadSqlProjectConfig(_0x513fa5[_0x52608b(0x1ab)]),_0x4e1c56=await readSqlLockFile(_0x28d014[_0x52608b(0x1c3)]),{lockData:_0x56a7ee,appLock:_0x726994}=ensureSqlLockScope(_0x4e1c56??createEmptySqlLock(),_0x513fa5[_0x52608b(0x1ab)],_0x28d014[_0x52608b(0x1c8)],_0x52608b(0x1b8)),_0x623f09=await getTargetSqlQueries(_0x28d014,_0x726994,_0x513fa5[_0x52608b(0x1cd)]('sqlcode')||undefined);if(_0x623f09['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x52608b(0x1e7)};const _0x338f14=[],_0xce6020=[],_0x58f05b=[];for(const _0x1740a3 of _0x623f09){const _0x109360=_0x726994[_0x52608b(0x1d4)][_0x1740a3['sqlCode']];if(!_0x109360){_0x58f05b[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3['sqlCode'],'error':_0x52608b(0x1bb)});continue;}try{const _0x562c42=await computeSqlFileHash(_0x1740a3[_0x52608b(0x1b9)]),_0x469979=_0x109360['path']!==_0x1740a3[_0x52608b(0x1e6)]||!!_0x1740a3[_0x52608b(0x1c5)]&&_0x109360[_0x52608b(0x1c5)]!==_0x1740a3[_0x52608b(0x1c5)];if(!_0x513fa5[_0x52608b(0x1ce)]('force')&&_0x109360[_0x52608b(0x1e5)]===_0x562c42&&!_0x469979){_0xce6020[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'reason':'unchanged'});continue;}if(_0x109360[_0x52608b(0x1ea)]==null){_0x58f05b[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'error':_0x52608b(0x1e9)});continue;}const _0x1b6255=await readFile(_0x1740a3[_0x52608b(0x1b9)],_0x52608b(0x1cc)),_0x7f3f70=stripLocalSqlMetadata(_0x1b6255,_0x1740a3[_0x52608b(0x1da)]),_0x449e80=_0x1740a3[_0x52608b(0x1c5)]||_0x109360['sqlName'],_0x4a1391=await resolveTargetDbBinding(_0x513fa5[_0x52608b(0x1ab)],_0x1740a3,_0x109360),_0x20df15=await updateSqlQuery({'id':_0x109360[_0x52608b(0x1d7)],'appCode':_0x513fa5[_0x52608b(0x1ab)],'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'sqlName':_0x449e80,'dbId':_0x4a1391[_0x52608b(0x1d3)],'version':_0x109360[_0x52608b(0x1ea)],'sqlContent':_0x7f3f70,'sqlConfig':_0x109360[_0x52608b(0x1c7)]??undefined}),_0x2ba3bd=_0x20df15[_0x52608b(0x1d3)]?await getDbName(_0x513fa5['appCode'],Number(_0x20df15[_0x52608b(0x1d3)]))[_0x52608b(0x1e1)](()=>_0x4a1391[_0x52608b(0x1a9)]):_0x4a1391[_0x52608b(0x1a9)];_0x726994['sqls'][_0x1740a3['sqlCode']]={...buildSqlLockEntry(_0x20df15,_0x7f3f70,_0x562c42,{'dbName':_0x2ba3bd}),'path':_0x1740a3[_0x52608b(0x1e6)],'mode':_0x109360[_0x52608b(0x1da)]},await archivePreviousSqlFileIfNeeded(_0x28d014,_0x109360[_0x52608b(0x1d5)],_0x1740a3['relativePath']),_0x338f14[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'remoteId':_0x109360[_0x52608b(0x1d7)]});}catch(_0x55f4c8){_0x58f05b['push']({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'error':_0x55f4c8 instanceof Error?_0x55f4c8[_0x52608b(0x1c1)]:String(_0x55f4c8)});}}return _0x726994[_0x52608b(0x1b2)]=new Date()[_0x52608b(0x1bf)](),await writeSqlLockFile(_0x28d014[_0x52608b(0x1c3)],_0x56a7ee),{'ok':_0x58f05b[_0x52608b(0x1c2)]===0x0,'data':{'pushed':_0x338f14,'skipped':_0xce6020,'failed':_0x58f05b},'message':_0x52608b(0x1b5)+_0x338f14[_0x52608b(0x1c2)]+_0x52608b(0x1ac)+_0xce6020[_0x52608b(0x1c2)]+'\x20skipped,\x20'+_0x58f05b[_0x52608b(0x1c2)]+_0x52608b(0x1bc)};}};function a173_0x514c(){const _0x38eefd=['sqlCode','321130HsUMTm','utf8','str','bool','projectRoot','No\x20database\x20matches\x20local\x20directory\x20\x22','validation','join','dbId','sqls','path','startsWith','remoteId','32CdXaRS','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','mode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','map','Local\x20SQL\x20not\x20found:\x20','5nCzxLQ','get','5253HReqat','catch','boolean','sqlRootDir','2ZgOvsW','hash','relativePath','No\x20local\x20SQL\x20files\x20found.','replace','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','version','isFinite','dbDirectory','entries','sqlcode','exec','dbName','429inKoay','appCode','\x20pushed,\x20','trashDir','1012758CdIYtx','991724vHMmVm','force','\x20SQL\x20file(s)','lastSync','has','4491222WkvTBH','Push\x20complete:\x20','high-risk-write','2078181IIoIvb','push','filePath','\x22\x20for\x20sqlCode\x20','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x20failed','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sql','toISOString','4704889YlpyKm','message','length','lockFilePath','filter','sqlName','Local\x20directory\x20\x22','sqlConfig','sqlRoot','Would\x20push\x20'];a173_0x514c=function(){return _0x38eefd;};return a173_0x514c();}async function archivePreviousSqlFileIfNeeded(_0x2c13a7,_0x1b6def,_0x367159){const _0x73eb05=a173_0x3a5554;if(!_0x1b6def||_0x1b6def===_0x367159)return;const _0x708189=join(_0x2c13a7[_0x73eb05(0x1e3)],_0x1b6def);if(!await fileExists(_0x708189))return;const _0x2e97f6=await moveToTrash(_0x2c13a7[_0x73eb05(0x1cf)],_0x2c13a7[_0x73eb05(0x1ad)],_0x708189);await cleanupEmptyDirectories(dirname(_0x708189),_0x2c13a7[_0x73eb05(0x1e3)]),void _0x2e97f6;}async function moveToTrash(_0x1f8d06,_0x2b082c,_0x2940e4){const _0x31983a=a173_0x3a5554,_0x481797=new Date()[_0x31983a(0x1bf)]()[_0x31983a(0x1e8)](/[:.]/g,'-'),_0x5560da=relative(_0x1f8d06,_0x2940e4),_0x4b44e4=join(_0x2b082c,_0x481797,_0x5560da);return await mkdir(dirname(_0x4b44e4),{'recursive':!![]}),await rename(_0x2940e4,_0x4b44e4),_0x4b44e4;}async function cleanupEmptyDirectories(_0x58fd8b,_0x4f0d6e){const _0x1f93f6=a173_0x3a5554;let _0x286be4=resolve(_0x58fd8b);const _0x2130ae=resolve(_0x4f0d6e);while(_0x286be4[_0x1f93f6(0x1d6)](''+_0x2130ae+sep)||_0x286be4===_0x2130ae){if(_0x286be4===_0x2130ae)return;try{const _0x1c33bf=await readdir(_0x286be4);if(_0x1c33bf[_0x1f93f6(0x1c2)]>0x0)return;await rmdir(_0x286be4);}catch{return;}_0x286be4=dirname(_0x286be4);}}async function resolveTargetDbBinding(_0x13ee88,_0x540016,_0x2969c4){const _0x3bbcda=a173_0x3a5554,_0x20c5ab=_0x540016[_0x3bbcda(0x1ec)];if(!_0x20c5ab)return{'dbId':_0x2969c4[_0x3bbcda(0x1d3)],'dbName':_0x2969c4['dbName']};const _0x3c1423=buildDbDirectoryName(_0x2969c4[_0x3bbcda(0x1a9)],_0x2969c4[_0x3bbcda(0x1d3)]);if(_0x20c5ab===_0x3c1423)return{'dbId':_0x2969c4[_0x3bbcda(0x1d3)],'dbName':_0x2969c4['dbName']};const _0x68cef=parseExplicitDbDirectory(_0x20c5ab);if(_0x68cef!=null)return{'dbId':_0x68cef,'dbName':await getDbName(_0x13ee88,_0x68cef)[_0x3bbcda(0x1e1)](()=>undefined)};const _0x30d5df=await listDatabases(_0x13ee88),_0x529b02=_0x30d5df['filter'](_0x76b1e7=>buildDbDirectoryName(_0x76b1e7[_0x3bbcda(0x1a9)],_0x76b1e7['dbId'])===_0x20c5ab);if(_0x529b02[_0x3bbcda(0x1c2)]===0x1)return{'dbId':_0x529b02[0x0][_0x3bbcda(0x1d3)],'dbName':_0x529b02[0x0]['dbName']};if(_0x529b02['length']===0x0)throw CliErrors[_0x3bbcda(0x1d1)](_0x3bbcda(0x1d0)+_0x20c5ab+_0x3bbcda(0x1ba)+_0x540016[_0x3bbcda(0x1ca)]+'.');const _0xce3768=_0x529b02[_0x3bbcda(0x1dc)](_0xf95f7f=>_0xf95f7f['dbName']+'\x20('+_0xf95f7f[_0x3bbcda(0x1d3)]+')')[_0x3bbcda(0x1d2)](',\x20');throw CliErrors[_0x3bbcda(0x1d1)](_0x3bbcda(0x1c6)+_0x20c5ab+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x540016['sqlCode']+':\x20'+_0xce3768);}function parseExplicitDbDirectory(_0x3eae12){const _0x296d64=a173_0x3a5554,_0xb5bc64=/^db-(\d+)$/[_0x296d64(0x1a8)](_0x3eae12);if(!_0xb5bc64)return null;const _0x585186=Number(_0xb5bc64[0x1]);return Number[_0x296d64(0x1eb)](_0x585186)&&_0x585186>0x0?_0x585186:null;}
|
|
1
|
+
const a173_0x2a0fde=a173_0x59b6;(function(_0x81925,_0x257cbe){const _0x3cac9f=a173_0x59b6,_0x3bd90d=_0x81925();while(!![]){try{const _0x1c1ad0=parseInt(_0x3cac9f(0xc5))/0x1*(parseInt(_0x3cac9f(0xc9))/0x2)+parseInt(_0x3cac9f(0x102))/0x3+-parseInt(_0x3cac9f(0xe2))/0x4+parseInt(_0x3cac9f(0xff))/0x5*(-parseInt(_0x3cac9f(0xc6))/0x6)+parseInt(_0x3cac9f(0xcf))/0x7*(parseInt(_0x3cac9f(0xda))/0x8)+parseInt(_0x3cac9f(0xde))/0x9+parseInt(_0x3cac9f(0xf0))/0xa;if(_0x1c1ad0===_0x257cbe)break;else _0x3bd90d['push'](_0x3bd90d['shift']());}catch(_0x5b97f5){_0x3bd90d['push'](_0x3bd90d['shift']());}}}(a173_0x1db8,0x9586c));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';function a173_0x1db8(){const _0x383d71=['projectRoot','lastSync','7211464dYJDZl','hash','sqlcode','POST','1754361uUJdGb','Push\x20complete:\x20','\x20SQL\x20file(s)','sqlRoot','4764856yowubo','unchanged','sqlName','dbName','join','force','Local\x20SQL\x20not\x20found:\x20','relativePath','exec','bool','length','sqlRootDir','utf8','\x20skipped,\x20','6963530kYKapx','filePath','entries','replace','sql','filter','/smartapi/custom/updateUserCustomSql','has','catch','remoteId','appCode','sqls','dbDirectory','\x20pushed,\x20','lockFilePath','334155xlUpsH','trashDir','toISOString','2475030uAXUig','str','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','validation','23oFaPNG','108Bsqpls','sqlConfig','sqlCode','33818rCBmwS','startsWith','\x20failed','version','Push\x20local\x20SQL\x20files\x20to\x20remote','boolean','7nSTQNA','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','push','\x22\x20for\x20sqlCode\x20','dbId','No\x20database\x20matches\x20local\x20directory\x20\x22','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','message','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'];a173_0x1db8=function(){return _0x383d71;};return a173_0x1db8();}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(_0x540ecb,_0x581274,_0x423834){const _0x5f4752=a173_0x59b6,_0x2b4019=await scanLocalSqlQueries(_0x540ecb),_0x483c83=new Map();for(const _0x45224d of _0x2b4019){if(_0x423834&&_0x45224d[_0x5f4752(0xc8)]!==_0x423834)continue;const _0x3a1ac6=_0x483c83['get'](_0x45224d[_0x5f4752(0xc8)])??[];_0x3a1ac6[_0x5f4752(0xd1)](_0x45224d),_0x483c83['set'](_0x45224d['sqlCode'],_0x3a1ac6);}if(_0x423834&&!_0x483c83[_0x5f4752(0xf7)](_0x423834))throw CliErrors[_0x5f4752(0xc4)](_0x5f4752(0xe8)+_0x423834);const _0x4757f8=[];for(const [_0x2ba07e,_0x544418]of _0x483c83[_0x5f4752(0xf2)]()){if(_0x544418[_0x5f4752(0xec)]===0x1){_0x4757f8[_0x5f4752(0xd1)](_0x544418[0x0]);continue;}const _0x54c4ff=_0x581274[_0x5f4752(0xfb)][_0x2ba07e],_0x2494d5=_0x54c4ff?.['path'],_0x27b500=_0x2494d5?_0x544418[_0x5f4752(0xf5)](_0x2b54b8=>_0x2b54b8[_0x5f4752(0xe9)]!==_0x2494d5):_0x544418;if(_0x54c4ff&&_0x27b500[_0x5f4752(0xec)]===0x1){_0x4757f8[_0x5f4752(0xd1)](_0x27b500[0x0]);continue;}throw CliErrors[_0x5f4752(0xc4)](_0x5f4752(0xd7)+_0x2ba07e+_0x5f4752(0xd5));}return _0x4757f8;}export const sqlPush={'service':a173_0x2a0fde(0xf4),'command':'push','description':a173_0x2a0fde(0xcd),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x2a0fde(0xe7),'type':a173_0x2a0fde(0xce),'description':a173_0x2a0fde(0xd0)}],async 'dryRun'(_0x433de6){const _0x1d979a=a173_0x2a0fde,_0x5df3d4=loadSqlProjectConfig(_0x433de6[_0x1d979a(0xfa)]),_0xce60e0=await readSqlLockFile(_0x5df3d4[_0x1d979a(0xfe)]),{appLock:_0x2e1bd7}=ensureSqlLockScope(_0xce60e0??createEmptySqlLock(),_0x433de6[_0x1d979a(0xfa)],_0x5df3d4[_0x1d979a(0xe1)],_0x1d979a(0xd1)),_0x510102=await getTargetSqlQueries(_0x5df3d4,_0x2e1bd7,_0x433de6[_0x1d979a(0x103)](_0x1d979a(0xdc))||undefined),_0x97043d=[];for(const _0x1eee98 of _0x510102){const _0x3323f5=await computeSqlFileHash(_0x1eee98['filePath']),_0x28bce1=_0x2e1bd7['sqls'][_0x1eee98[_0x1d979a(0xc8)]],_0x3ac3fa=!!_0x28bce1&&(_0x28bce1['path']!==_0x1eee98['relativePath']||!!_0x1eee98['sqlName']&&_0x28bce1[_0x1d979a(0xe4)]!==_0x1eee98[_0x1d979a(0xe4)]);if(!_0x433de6[_0x1d979a(0xeb)]('force')&&_0x28bce1&&_0x28bce1[_0x1d979a(0xdb)]===_0x3323f5&&!_0x3ac3fa)continue;_0x97043d['push'](_0x1eee98[_0x1d979a(0xc8)]);}return{'method':_0x1d979a(0xdd),'url':_0x1d979a(0xf6),'body':{'sqlCodes':_0x97043d,'appCode':_0x433de6[_0x1d979a(0xfa)]},'description':'Would\x20push\x20'+_0x97043d[_0x1d979a(0xec)]+_0x1d979a(0xe0)};},async 'execute'(_0x15947b){const _0x1c4cbf=a173_0x2a0fde,_0x3f077e=loadSqlProjectConfig(_0x15947b[_0x1c4cbf(0xfa)]),_0x24fced=await readSqlLockFile(_0x3f077e[_0x1c4cbf(0xfe)]),{lockData:_0x3ac16a,appLock:_0x1ad803}=ensureSqlLockScope(_0x24fced??createEmptySqlLock(),_0x15947b[_0x1c4cbf(0xfa)],_0x3f077e[_0x1c4cbf(0xe1)],'push'),_0x3c4dea=await getTargetSqlQueries(_0x3f077e,_0x1ad803,_0x15947b[_0x1c4cbf(0x103)](_0x1c4cbf(0xdc))||undefined);if(_0x3c4dea['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3d4ecc=[],_0x271128=[],_0xec7023=[];for(const _0x56e655 of _0x3c4dea){const _0x253ca6=_0x1ad803[_0x1c4cbf(0xfb)][_0x56e655[_0x1c4cbf(0xc8)]];if(!_0x253ca6){_0xec7023[_0x1c4cbf(0xd1)]({'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'error':_0x1c4cbf(0xc2)});continue;}try{const _0x4d5838=await computeSqlFileHash(_0x56e655[_0x1c4cbf(0xf1)]),_0x36ea9b=_0x253ca6['path']!==_0x56e655['relativePath']||!!_0x56e655[_0x1c4cbf(0xe4)]&&_0x253ca6[_0x1c4cbf(0xe4)]!==_0x56e655[_0x1c4cbf(0xe4)];if(!_0x15947b[_0x1c4cbf(0xeb)](_0x1c4cbf(0xe7))&&_0x253ca6['hash']===_0x4d5838&&!_0x36ea9b){_0x271128[_0x1c4cbf(0xd1)]({'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'reason':_0x1c4cbf(0xe3)});continue;}if(_0x253ca6[_0x1c4cbf(0xcc)]==null){_0xec7023[_0x1c4cbf(0xd1)]({'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x179315=await readFile(_0x56e655[_0x1c4cbf(0xf1)],_0x1c4cbf(0xee)),_0x267eae=stripLocalSqlMetadata(_0x179315,_0x56e655['mode']),_0x4d759a=_0x56e655[_0x1c4cbf(0xe4)]||_0x253ca6[_0x1c4cbf(0xe4)],_0x4f9f61=await resolveTargetDbBinding(_0x15947b[_0x1c4cbf(0xfa)],_0x56e655,_0x253ca6),_0x31e530=await updateSqlQuery({'id':_0x253ca6[_0x1c4cbf(0xf9)],'appCode':_0x15947b[_0x1c4cbf(0xfa)],'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'sqlName':_0x4d759a,'dbId':_0x4f9f61[_0x1c4cbf(0xd3)],'version':_0x253ca6[_0x1c4cbf(0xcc)],'sqlContent':_0x267eae,'sqlConfig':_0x253ca6[_0x1c4cbf(0xc7)]??undefined}),_0x1d9b0e=_0x31e530[_0x1c4cbf(0xd3)]?await getDbName(_0x15947b[_0x1c4cbf(0xfa)],Number(_0x31e530[_0x1c4cbf(0xd3)]))['catch'](()=>_0x4f9f61[_0x1c4cbf(0xe5)]):_0x4f9f61['dbName'];_0x1ad803[_0x1c4cbf(0xfb)][_0x56e655['sqlCode']]={...buildSqlLockEntry(_0x31e530,_0x267eae,_0x4d5838,{'dbName':_0x1d9b0e}),'path':_0x56e655[_0x1c4cbf(0xe9)],'mode':_0x253ca6['mode']},await archivePreviousSqlFileIfNeeded(_0x3f077e,_0x253ca6['path'],_0x56e655[_0x1c4cbf(0xe9)]),_0x3d4ecc['push']({'sqlCode':_0x56e655['sqlCode'],'remoteId':_0x253ca6[_0x1c4cbf(0xf9)]});}catch(_0x25f09a){_0xec7023[_0x1c4cbf(0xd1)]({'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'error':_0x25f09a instanceof Error?_0x25f09a[_0x1c4cbf(0xd6)]:String(_0x25f09a)});}}return _0x1ad803[_0x1c4cbf(0xd9)]=new Date()[_0x1c4cbf(0x101)](),await writeSqlLockFile(_0x3f077e[_0x1c4cbf(0xfe)],_0x3ac16a),{'ok':_0xec7023[_0x1c4cbf(0xec)]===0x0,'data':{'pushed':_0x3d4ecc,'skipped':_0x271128,'failed':_0xec7023},'message':_0x1c4cbf(0xdf)+_0x3d4ecc[_0x1c4cbf(0xec)]+_0x1c4cbf(0xfd)+_0x271128[_0x1c4cbf(0xec)]+_0x1c4cbf(0xef)+_0xec7023[_0x1c4cbf(0xec)]+_0x1c4cbf(0xcb)};}};function a173_0x59b6(_0x30778f,_0x2a78a9){_0x30778f=_0x30778f-0xc2;const _0x1db8d5=a173_0x1db8();let _0x59b6c4=_0x1db8d5[_0x30778f];return _0x59b6c4;}async function archivePreviousSqlFileIfNeeded(_0x3a0050,_0x240e43,_0x3d4b16){const _0x47c9b0=a173_0x2a0fde;if(!_0x240e43||_0x240e43===_0x3d4b16)return;const _0x17dbba=join(_0x3a0050[_0x47c9b0(0xed)],_0x240e43);if(!await fileExists(_0x17dbba))return;const _0x301f8c=await moveToTrash(_0x3a0050[_0x47c9b0(0xd8)],_0x3a0050[_0x47c9b0(0x100)],_0x17dbba);await cleanupEmptyDirectories(dirname(_0x17dbba),_0x3a0050[_0x47c9b0(0xed)]),void _0x301f8c;}async function moveToTrash(_0xa35868,_0x4af45b,_0xee9f2){const _0x16b7f6=a173_0x2a0fde,_0x1e07f6=new Date()['toISOString']()[_0x16b7f6(0xf3)](/[:.]/g,'-'),_0x312f35=relative(_0xa35868,_0xee9f2),_0x4cca72=join(_0x4af45b,_0x1e07f6,_0x312f35);return await mkdir(dirname(_0x4cca72),{'recursive':!![]}),await rename(_0xee9f2,_0x4cca72),_0x4cca72;}async function cleanupEmptyDirectories(_0x3ddefb,_0x2c21c7){const _0xdfbdf8=a173_0x2a0fde;let _0x5c8930=resolve(_0x3ddefb);const _0x364b54=resolve(_0x2c21c7);while(_0x5c8930[_0xdfbdf8(0xca)](''+_0x364b54+sep)||_0x5c8930===_0x364b54){if(_0x5c8930===_0x364b54)return;try{const _0x1f6a16=await readdir(_0x5c8930);if(_0x1f6a16[_0xdfbdf8(0xec)]>0x0)return;await rmdir(_0x5c8930);}catch{return;}_0x5c8930=dirname(_0x5c8930);}}async function resolveTargetDbBinding(_0x104b75,_0x555d65,_0x1496a5){const _0x36483b=a173_0x2a0fde,_0x1da0a9=_0x555d65[_0x36483b(0xfc)];if(!_0x1da0a9)return{'dbId':_0x1496a5['dbId'],'dbName':_0x1496a5[_0x36483b(0xe5)]};const _0x4de33d=buildDbDirectoryName(_0x1496a5[_0x36483b(0xe5)],_0x1496a5[_0x36483b(0xd3)]);if(_0x1da0a9===_0x4de33d)return{'dbId':_0x1496a5[_0x36483b(0xd3)],'dbName':_0x1496a5[_0x36483b(0xe5)]};const _0x28e1df=parseExplicitDbDirectory(_0x1da0a9);if(_0x28e1df!=null)return{'dbId':_0x28e1df,'dbName':await getDbName(_0x104b75,_0x28e1df)[_0x36483b(0xf8)](()=>undefined)};const _0x2894ae=await listDatabases(_0x104b75),_0x113c7a=_0x2894ae[_0x36483b(0xf5)](_0x14f93d=>buildDbDirectoryName(_0x14f93d[_0x36483b(0xe5)],_0x14f93d[_0x36483b(0xd3)])===_0x1da0a9);if(_0x113c7a['length']===0x1)return{'dbId':_0x113c7a[0x0]['dbId'],'dbName':_0x113c7a[0x0][_0x36483b(0xe5)]};if(_0x113c7a[_0x36483b(0xec)]===0x0)throw CliErrors[_0x36483b(0xc4)](_0x36483b(0xd4)+_0x1da0a9+_0x36483b(0xd2)+_0x555d65[_0x36483b(0xc8)]+'.');const _0x4dc499=_0x113c7a['map'](_0x131902=>_0x131902[_0x36483b(0xe5)]+'\x20('+_0x131902[_0x36483b(0xd3)]+')')[_0x36483b(0xe6)](',\x20');throw CliErrors[_0x36483b(0xc4)]('Local\x20directory\x20\x22'+_0x1da0a9+_0x36483b(0xc3)+_0x555d65[_0x36483b(0xc8)]+':\x20'+_0x4dc499);}function parseExplicitDbDirectory(_0x11fa81){const _0x22ee68=a173_0x2a0fde,_0x47cbb3=/^db-(\d+)$/[_0x22ee68(0xea)](_0x11fa81);if(!_0x47cbb3)return null;const _0x1648d0=Number(_0x47cbb3[0x1]);return Number['isFinite'](_0x1648d0)&&_0x1648d0>0x0?_0x1648d0:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a174_0x2928(_0x3741c8,_0x5acf2e){_0x3741c8=_0x3741c8-0x139;const _0x28c34c=a174_0x28c3();let _0x29280a=_0x28c34c[_0x3741c8];return _0x29280a;}const a174_0x57d148=a174_0x2928;(function(_0x1cf565,_0x4ce2a5){const _0x4ef816=a174_0x2928,_0x516d0b=_0x1cf565();while(!![]){try{const _0x566f52=parseInt(_0x4ef816(0x142))/0x1+parseInt(_0x4ef816(0x146))/0x2*(parseInt(_0x4ef816(0x14b))/0x3)+parseInt(_0x4ef816(0x13e))/0x4+parseInt(_0x4ef816(0x13c))/0x5*(-parseInt(_0x4ef816(0x152))/0x6)+-parseInt(_0x4ef816(0x141))/0x7+-parseInt(_0x4ef816(0x14a))/0x8*(-parseInt(_0x4ef816(0x148))/0x9)+-parseInt(_0x4ef816(0x147))/0xa*(parseInt(_0x4ef816(0x13f))/0xb);if(_0x566f52===_0x4ce2a5)break;else _0x516d0b['push'](_0x516d0b['shift']());}catch(_0x1a6851){_0x516d0b['push'](_0x516d0b['shift']());}}}(a174_0x28c3,0xde3b7));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a174_0x28c3(){const _0x30eec2=['2045736RLTjaY','9YjkpjO','file','Path\x20to\x20the\x20SQL\x20file','write','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','sqlname','string','198vVjXLr','validation','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`.','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','5555zPFTVl','save','609444NROnRE','957891NrxYHQ','description','7182238SxChxI','1005685esMXVO','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Query\x20description','join','278794ZiIwZD','160FcbVCO','63rAHOzu','sql'];a174_0x28c3=function(){return _0x30eec2;};return a174_0x28c3();}const SQL_SAVE_DEPRECATED_HINT=[a174_0x57d148(0x13b),a174_0x57d148(0x143),a174_0x57d148(0x139)][a174_0x57d148(0x145)]('\x0a');export const sqlSave={'service':a174_0x57d148(0x149),'command':a174_0x57d148(0x13d),'description':a174_0x57d148(0x13a),'risk':a174_0x57d148(0x14e),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a174_0x57d148(0x14c),'type':'string','required':!![],'description':a174_0x57d148(0x14d)},SQLCODE_FLAG_OPTIONAL,{'name':a174_0x57d148(0x150),'type':a174_0x57d148(0x151),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a174_0x57d148(0x151),'description':a174_0x57d148(0x14f)},{'name':a174_0x57d148(0x140),'type':a174_0x57d148(0x151),'description':a174_0x57d148(0x144)}],async 'validate'(){const _0x3ac2a4=a174_0x57d148;throw CliErrors[_0x3ac2a4(0x153)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x5088=a174_0x57d148;throw CliErrors[_0x5088(0x153)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a175_0x3fd231=a175_0x4aa3;(function(_0x41264d,_0x5da3e2){const _0x32277c=a175_0x4aa3,_0x4be238=_0x41264d();while(!![]){try{const _0x3c7c54=parseInt(_0x32277c(0xab))/0x1+parseInt(_0x32277c(0xb7))/0x2+parseInt(_0x32277c(0xbc))/0x3*(-parseInt(_0x32277c(0xc4))/0x4)+-parseInt(_0x32277c(0xae))/0x5+-parseInt(_0x32277c(0xc1))/0x6+parseInt(_0x32277c(0xc8))/0x7*(-parseInt(_0x32277c(0xbd))/0x8)+parseInt(_0x32277c(0xaf))/0x9*(parseInt(_0x32277c(0xc3))/0xa);if(_0x3c7c54===_0x5da3e2)break;else _0x4be238['push'](_0x4be238['shift']());}catch(_0x1336f4){_0x4be238['push'](_0x4be238['shift']());}}}(a175_0x9ede,0x2e0b0));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_0x3fd231(0xb6);export function buildSqlLockEntry(_0x4747b1,_0x3b0ec1,_0x74609d,_0x345b1b){const _0x22aca7=a175_0x3fd231,_0x5a7bc5=detectSqlMode(_0x3b0ec1);return{'path':buildSqlRelativePath(_0x4747b1[_0x22aca7(0xb4)],_0x4747b1[_0x22aca7(0xcc)],_0x345b1b?.[_0x22aca7(0xc7)],_0x5a7bc5,_0x4747b1[_0x22aca7(0xb1)]),'hash':_0x74609d,'remoteId':_0x4747b1['id'],'version':_0x4747b1[_0x22aca7(0xc5)],'dbId':Number(_0x4747b1[_0x22aca7(0xb1)]),'dbName':_0x345b1b?.[_0x22aca7(0xc7)],'sqlName':_0x4747b1[_0x22aca7(0xcc)],'sqlConfig':_0x4747b1[_0x22aca7(0xb8)]??undefined,'mode':_0x5a7bc5};}export function cloneSqlLockData(_0x34c0fc){const _0x39a90c=a175_0x3fd231;return{'apps':Object[_0x39a90c(0xb0)](Object[_0x39a90c(0xbb)](_0x34c0fc[_0x39a90c(0xa7)])[_0x39a90c(0xac)](([_0x2ff115,_0x132c30])=>[_0x2ff115,{'sqlRoot':_0x132c30[_0x39a90c(0xb5)],'lastSync':_0x132c30['lastSync'],'sqls':{..._0x132c30['sqls']}}]))};}export function ensureRemoteSqlContent(_0x512905){return _0x512905['sqlContent']??'';}export function buildLocalSqlFileContent(_0xd75d1c,_0x1683f6,_0x5a7675){const _0x536883=a175_0x3fd231,_0x3b5a4a=_0x5a7675?.[_0x536883(0xa9)]??detectSqlMode(_0x1683f6),_0x3ab92c=stripLocalSqlMetadata(_0x1683f6,_0x3b5a4a)[_0x536883(0xaa)](),_0x150c64=[...buildMetadataHeaderLines({'sqlCode':_0xd75d1c[_0x536883(0xb4)],'sqlName':_0xd75d1c['sqlName'],'dbId':_0xd75d1c['dbId'],'dbName':_0x5a7675?.[_0x536883(0xc7)],'mode':_0x3b5a4a,'syncedAt':_0x5a7675?.['syncedAt'],'description':_0x5a7675?.[_0x536883(0xc6)]},_0x3b5a4a),'',_0x3ab92c],_0x28135f=_0x150c64['join']('\x0a');return _0x28135f[_0x536883(0xcd)]('\x0a')?_0x28135f:_0x28135f+'\x0a';}export function stripLocalSqlMetadata(_0x3eb5d5,_0x199a86){const _0x16bc88=a175_0x3fd231,_0x1fe8df=_0x3eb5d5[_0x16bc88(0xcb)](/\r\n/g,'\x0a')['split']('\x0a'),_0x51e697=[];let _0x53b7ed=0x0;if(_0x199a86==='mybatisXml')while(_0x53b7ed<_0x1fe8df[_0x16bc88(0xbe)]){const _0x245a0f=_0x1fe8df[_0x53b7ed]??'';if(/^\s*<!--\s*@lovrabet\./[_0x16bc88(0xca)](_0x245a0f)){_0x53b7ed++;continue;}if(_0x245a0f['trim']()===''&&_0x53b7ed>0x0){_0x53b7ed++;continue;}break;}else while(_0x53b7ed<_0x1fe8df['length']){const _0x225966=_0x1fe8df[_0x53b7ed]??'';if(/^\s*--\s*@lovrabet\./[_0x16bc88(0xca)](_0x225966)){_0x53b7ed++;continue;}if(_0x225966['trim']()===''&&_0x53b7ed>0x0){_0x53b7ed++;continue;}break;}for(;_0x53b7ed<_0x1fe8df['length'];_0x53b7ed++){_0x51e697['push'](_0x1fe8df[_0x53b7ed]);}return _0x51e697['join']('\x0a')['trimStart']();}export function resolveSqlMode(_0x151003,_0x350606){const _0x24f6ce=a175_0x3fd231;if(_0x350606?.[_0x24f6ce(0xa9)])return _0x350606[_0x24f6ce(0xa9)];return detectSqlMode(_0x151003);}export function resolveSqlFileName(_0x58924d,_0x3fe9bf,_0x13faa4){const _0x41eead=a175_0x3fd231;if(_0x13faa4?.[_0x41eead(0xb3)])return _0x13faa4[_0x41eead(0xb3)];if(_0x13faa4?.['sqlName']||_0x13faa4?.[_0x41eead(0xc7)])return buildSqlRelativePath(_0x58924d,_0x13faa4?.['sqlName'],_0x13faa4?.[_0x41eead(0xc7)],resolveSqlMode(_0x3fe9bf,_0x13faa4),_0x13faa4?.[_0x41eead(0xb1)]);return buildDefaultSqlFileName(_0x58924d,resolveSqlMode(_0x3fe9bf,_0x13faa4));}export function resolveSqlLocalDir(_0x31f7f8,_0x7136eb){return join(_0x31f7f8,SQL_LOCAL_REL_DIR,_0x7136eb);}export async function confirmForceOverwrite(_0x1ee882){const _0x1cf736=a175_0x3fd231,_0x483e63=createInterface({'input':process[_0x1cf736(0xce)],'output':process[_0x1cf736(0xc9)]}),_0x43d4d5=await new Promise(_0x4805e0=>{const _0x487c96=_0x1cf736;_0x483e63[_0x487c96(0xc2)](_0x1ee882+'\x20[y/N]\x20',_0x4805e0);});return _0x483e63[_0x1cf736(0xad)](),['y',_0x1cf736(0xbf)][_0x1cf736(0xb9)](_0x43d4d5[_0x1cf736(0xaa)]()[_0x1cf736(0xc0)]());}export function findSqlLockScope(_0x27199c,_0x5aa7ab){return _0x27199c['apps'][_0x5aa7ab];}function buildMetadataHeaderLines(_0x4257be,_0x122d0c){const _0x4dd5fb=a175_0x3fd231,_0x28184e=[[_0x4dd5fb(0xb4),_0x4257be[_0x4dd5fb(0xb4)]],[_0x4dd5fb(0xcc),_0x4257be['sqlName']],[_0x4dd5fb(0xb1),_0x4257be[_0x4dd5fb(0xb1)]],[_0x4dd5fb(0xc7),_0x4257be[_0x4dd5fb(0xc7)]],['mode',_0x4257be['mode']],[_0x4dd5fb(0xa6),_0x4257be[_0x4dd5fb(0xa6)]],[_0x4dd5fb(0xc6),_0x4257be[_0x4dd5fb(0xc6)]]];if(_0x122d0c==='mybatisXml')return _0x28184e[_0x4dd5fb(0xa8)](([,_0x31bf4c])=>_0x31bf4c!==undefined&&_0x31bf4c!==null&&String(_0x31bf4c)[_0x4dd5fb(0xaa)]()!=='')['map'](([_0x525222,_0x4e755a])=>_0x4dd5fb(0xba)+_0x525222+':\x20'+String(_0x4e755a)+_0x4dd5fb(0xb2));return _0x28184e[_0x4dd5fb(0xa8)](([,_0x520757])=>_0x520757!==undefined&&_0x520757!==null&&String(_0x520757)[_0x4dd5fb(0xaa)]()!=='')['map'](([_0x140d67,_0x6cd676])=>'--\x20@lovrabet.'+_0x140d67+':\x20'+String(_0x6cd676));}function a175_0x4aa3(_0x3ce457,_0xa13359){_0x3ce457=_0x3ce457-0xa6;const _0x9ede22=a175_0x9ede();let _0x4aa393=_0x9ede22[_0x3ce457];return _0x4aa393;}function a175_0x9ede(){const _0x3f225b=['question','88490HcsAqc','1129292tDkueZ','version','description','dbName','119AgOYND','stderr','test','replace','sqlName','endsWith','stdin','syncedAt','apps','filter','mode','trim','252644hVHcqF','map','close','1569150pHSKCl','684mgTbmk','fromEntries','dbId','\x20-->','path','sqlCode','sqlRoot','.rabetbase/sql','177396kfyLlE','sqlConfig','includes','<!--\x20@lovrabet.','entries','3iyqFaa','13816TvNYAR','length','yes','toLowerCase','1198572fdAtET'];a175_0x9ede=function(){return _0x3f225b;};return a175_0x9ede();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a176_0x6e75d7=a176_0x3a2c;(function(_0x44de17,_0x6cff42){const _0x2ac469=a176_0x3a2c,_0x34a132=_0x44de17();while(!![]){try{const _0x95adfe=parseInt(_0x2ac469(0x160))/0x1*(-parseInt(_0x2ac469(0x168))/0x2)+parseInt(_0x2ac469(0x158))/0x3*(-parseInt(_0x2ac469(0x163))/0x4)+-parseInt(_0x2ac469(0x15a))/0x5+-parseInt(_0x2ac469(0x15b))/0x6+parseInt(_0x2ac469(0x151))/0x7+parseInt(_0x2ac469(0x15e))/0x8*(-parseInt(_0x2ac469(0x15f))/0x9)+parseInt(_0x2ac469(0x15c))/0xa;if(_0x95adfe===_0x6cff42)break;else _0x34a132['push'](_0x34a132['shift']());}catch(_0x585fd8){_0x34a132['push'](_0x34a132['shift']());}}}(a176_0x2bc7,0x7c9f2));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a176_0x3a2c(_0x1962d1,_0x7f0fdd){_0x1962d1=_0x1962d1-0x14d;const _0x2bc70e=a176_0x2bc7();let _0x3a2cae=_0x2bc70e[_0x1962d1];return _0x3a2cae;}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a176_0x2bc7(){const _0x70fa52=['\x20missing,\x20','length','1925560SxOgeB','boolean','\x20modified,\x20','map','\x20remote-only','read','sqlName','74913qdIjEX','filePath','1499575PBVnuT','1257858pmVSXy','24032340vJOrHc','paging','680040rJSkVl','54fcqJAk','67PzdTCV','status','push','128eYIZak','has','hash','remote','sqls','10424EKZvHl','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','relativePath','lockKey','tableData','appCode','path','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'];a176_0x2bc7=function(){return _0x70fa52;};return a176_0x2bc7();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x232c3d){const _0x45d0a5=a176_0x3a2c,_0x2bb340=[];let _0x9ab98f=0x1;while(!![]){const _0xf80199=await listSqlQueries(_0x232c3d,{'currentPage':_0x9ab98f,'pageSize':PAGE_SIZE}),_0x5eb896=_0xf80199[_0x45d0a5(0x16c)]??[];_0x2bb340[_0x45d0a5(0x162)](..._0x5eb896[_0x45d0a5(0x154)](_0x32fc34=>_0x32fc34['sqlCode']));if(_0x5eb896[_0x45d0a5(0x150)]===0x0)break;const _0x54ca64=_0xf80199[_0x45d0a5(0x15d)]?.['totalCount'];if(_0x54ca64!=null?_0x2bb340[_0x45d0a5(0x150)]>=_0x54ca64:_0x5eb896[_0x45d0a5(0x150)]<PAGE_SIZE)break;_0x9ab98f++;}return _0x2bb340;}export const sqlStatus={'service':'sql','command':a176_0x6e75d7(0x161),'description':a176_0x6e75d7(0x169),'risk':a176_0x6e75d7(0x156),'flags':[{'name':a176_0x6e75d7(0x166),'type':a176_0x6e75d7(0x152),'description':a176_0x6e75d7(0x14e)}],async 'execute'(_0x563724){const _0x40332f=a176_0x6e75d7,_0xf2a22f=loadSqlProjectConfig(_0x563724[_0x40332f(0x16d)]),_0x1cb275=await readSqlLockFile(_0xf2a22f['lockFilePath']),{appLock:_0x161b17}=ensureSqlLockScope(_0x1cb275??createEmptySqlLock(),_0xf2a22f[_0x40332f(0x16d)],_0xf2a22f['sqlRoot'],_0x40332f(0x161)),_0x3170b7=await scanLocalSqlQueries(_0xf2a22f),_0x7102d7=[],_0x1f3407=[],_0xfa4619=[],_0x90e2a0=[],_0x2d3b5f=new Set(_0x3170b7[_0x40332f(0x154)](_0x4925a3=>_0x4925a3[_0x40332f(0x16b)]));for(const _0x887033 of _0x3170b7){const _0x2e99a6=await computeSqlFileHash(_0x887033[_0x40332f(0x159)]),_0x1324a6=_0x161b17[_0x40332f(0x167)][_0x887033[_0x40332f(0x16b)]],_0x5f39f8=!!_0x1324a6&&_0x1324a6[_0x40332f(0x14d)]!==_0x887033[_0x40332f(0x16a)],_0x3e404b=!!_0x1324a6&&!!_0x887033[_0x40332f(0x157)]&&_0x1324a6['sqlName']!==_0x887033[_0x40332f(0x157)];if(!_0x1324a6)_0x7102d7[_0x40332f(0x162)](_0x887033[_0x40332f(0x16b)]);else _0x1324a6[_0x40332f(0x165)]!==_0x2e99a6||_0x5f39f8||_0x3e404b?_0x1f3407[_0x40332f(0x162)](_0x887033[_0x40332f(0x16b)]):_0xfa4619[_0x40332f(0x162)](_0x887033[_0x40332f(0x16b)]);}for(const _0x518023 of Object['keys'](_0x161b17['sqls'])){!_0x2d3b5f[_0x40332f(0x164)](_0x518023)&&_0x90e2a0['push'](_0x518023);}const _0x4b7a21=[];if(_0x563724['bool'](_0x40332f(0x166))){const _0x590983=await fetchAllSqlCodes(_0x563724[_0x40332f(0x16d)]);for(const _0x39f6c6 of _0x590983){!_0x2d3b5f[_0x40332f(0x164)](_0x39f6c6)&&!_0x161b17['sqls'][_0x39f6c6]&&_0x4b7a21[_0x40332f(0x162)](_0x39f6c6);}}const _0x209cf6=_0x7102d7[_0x40332f(0x150)]===0x0&&_0x1f3407['length']===0x0&&_0x90e2a0['length']===0x0&&_0x4b7a21[_0x40332f(0x150)]===0x0;return{'ok':!![],'data':{'added':_0x7102d7,'modified':_0x1f3407,'missing':_0x90e2a0,'unchanged':_0xfa4619,'remoteOnly':_0x4b7a21},'message':_0x209cf6?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x7102d7[_0x40332f(0x150)]+'\x20added,\x20'+_0x1f3407[_0x40332f(0x150)]+_0x40332f(0x153)+_0x90e2a0[_0x40332f(0x150)]+_0x40332f(0x14f)+_0xfa4619[_0x40332f(0x150)]+'\x20unchanged'+(_0x4b7a21['length']>0x0?',\x20'+_0x4b7a21[_0x40332f(0x150)]+_0x40332f(0x155):'')};}};
|