@lovrabet/rabetbase-cli 2.1.14-beta.0 → 2.1.14-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/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/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 -0
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/link-create.js +1 -1
- package/lib/commands/dataset/link-delete.js +1 -1
- package/lib/commands/dataset/link-shared.js +1 -1
- package/lib/commands/dataset/link-update.js +1 -1
- package/lib/commands/dataset/links.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/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/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 +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a117_0x22ca2d=a117_0x3c84;(function(_0x3a772d,_0x18c2bb){const _0x1f666e=a117_0x3c84,_0xbadd83=_0x3a772d();while(!![]){try{const _0x3dd68e=-parseInt(_0x1f666e(0x120))/0x1+-parseInt(_0x1f666e(0x106))/0x2*(parseInt(_0x1f666e(0x105))/0x3)+parseInt(_0x1f666e(0xf7))/0x4+parseInt(_0x1f666e(0x10f))/0x5+-parseInt(_0x1f666e(0x125))/0x6*(parseInt(_0x1f666e(0x111))/0x7)+-parseInt(_0x1f666e(0xfa))/0x8+parseInt(_0x1f666e(0x12a))/0x9;if(_0x3dd68e===_0x18c2bb)break;else _0xbadd83['push'](_0xbadd83['shift']());}catch(_0x4d4690){_0xbadd83['push'](_0xbadd83['shift']());}}}(a117_0x1dd9,0xeb33b));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';function a117_0x3c84(_0x10bc90,_0x29d742){_0x10bc90=_0x10bc90-0xf0;const _0x1dd9a6=a117_0x1dd9();let _0x3c84a5=_0x1dd9a6[_0x10bc90];return _0x3c84a5;}import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a117_0x22ca2d(0xf4),'dev']);function a117_0x1dd9(){const _0x20f7a7=['script','1315190jmRUpP','vite\x20preview\x20exited\x20with\x20code\x20','run','package.json','cwd','8393922XrnQZu','padEnd','\x20run\x20<script>\x0a','map','(none)','43690014SiGkNJ','.bin','args','close','build','start','has','preview','1157120KBjWrC','\x20run\x20','No\x20scripts\x20defined\x20in\x20package.json.','12159264IJXcSc','inherit','pnpm','\x20\x20\x20\x20','entries','bun.lock','error','parse','node_modules','\x20run\x20start','boolean','958359bnHmet','2gPQkGx','\x20exited\x20with\x20code\x20','Run\x20a\x20package.json\x20script','read','push','yarn.lock','vite','Script\x20\x22','log','1865995oXFQMn','join','7CybAqm','npm','scripts','\x0a\x20\x20Usage:\x20','validation','\x20run\x20preview','length','max','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','watch','--watch','keys','bun.lockb','Script\x20name\x20defined\x20in\x20package.json'];a117_0x1dd9=function(){return _0x20f7a7;};return a117_0x1dd9();}function readPackageScripts(_0x8cb959){const _0x191ae1=a117_0x22ca2d,_0x2ec98b=resolve(_0x8cb959,_0x191ae1(0x123));if(!existsSync(_0x2ec98b))return null;try{const _0x2a0120=JSON[_0x191ae1(0x101)](readFileSync(_0x2ec98b,'utf-8'));return _0x2a0120[_0x191ae1(0x113)]??{};}catch{return null;}}function detectPackageManager(_0x5ca449){const _0x575fc8=a117_0x22ca2d;if(existsSync(resolve(_0x5ca449,_0x575fc8(0x11d)))||existsSync(resolve(_0x5ca449,_0x575fc8(0xff))))return'bun';if(existsSync(resolve(_0x5ca449,'pnpm-lock.yaml')))return _0x575fc8(0xfc);if(existsSync(resolve(_0x5ca449,_0x575fc8(0x10b))))return'yarn';return _0x575fc8(0x112);}async function versionCheck(_0x16a124){const _0x18a715=await checkCliVersion();(_0x18a715['needsUpgrade']||_0x18a715['belowMinimum'])&&(printCliUpgradeWarning(_0x18a715),assertCliVersionSupported(_0x18a715));const _0x3ba6fc=await checkSdkVersion(_0x16a124);if(_0x3ba6fc['needsUpgrade'])printSdkUpgradeWarning(_0x3ba6fc);}function spawnScript(_0x3ac326,_0x4dd812,_0x358d87,_0x21dd78){return new Promise((_0xa85eb,_0xdadebd)=>{const _0x11c744=a117_0x3c84,_0x38cb9d=[_0x11c744(0x122),_0x4dd812,..._0x358d87],_0x23d823=spawn(_0x3ac326,_0x38cb9d,{'cwd':_0x21dd78,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x21dd78,_0x11c744(0x102),_0x11c744(0xf0))+delimiter+process.env.PATH}});_0x23d823['on'](_0x11c744(0xf2),_0x35f695=>{const _0x4ad09d=_0x11c744;if(_0x35f695===0x0||_0x35f695===null)_0xa85eb();else _0xdadebd(new Error(_0x3ac326+_0x4ad09d(0xf8)+_0x4dd812+_0x4ad09d(0x107)+_0x35f695));}),_0x23d823['on']('error',_0xdadebd);});}function spawnViteBuildWatch(_0x51ba74){return new Promise((_0x5e23b1,_0x510b7b)=>{const _0x4f995d=a117_0x3c84,_0x3a9128=spawn('vite',[_0x4f995d(0xf3),_0x4f995d(0x11b)],{'cwd':_0x51ba74,'stdio':_0x4f995d(0xfb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x51ba74,'node_modules',_0x4f995d(0xf0))+delimiter+process.env.PATH}});_0x3a9128['on'](_0x4f995d(0xf2),_0x95370a=>{const _0x1b3806=_0x4f995d;if(_0x95370a===0x0||_0x95370a===null)_0x5e23b1();else _0x510b7b(new Error(_0x1b3806(0x119)+_0x95370a));}),_0x3a9128['on'](_0x4f995d(0x100),_0x510b7b);});}function spawnVitePreview(_0x141ab5){return new Promise((_0x5c9f5f,_0x324381)=>{const _0x32c64a=a117_0x3c84,_0x1f8fe1=spawn(_0x32c64a(0x10c),[_0x32c64a(0xf6)],{'cwd':_0x141ab5,'stdio':_0x32c64a(0xfb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x141ab5,_0x32c64a(0x102),'.bin')+delimiter+process.env.PATH}});_0x1f8fe1['on']('close',_0x537c13=>{const _0x5d022f=_0x32c64a;if(_0x537c13===0x0||_0x537c13===null)_0x5c9f5f();else _0x324381(new Error(_0x5d022f(0x121)+_0x537c13));}),_0x1f8fe1['on']('error',_0x324381);});}const runFlags=[{'name':'watch','type':a117_0x22ca2d(0x104),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a117_0x22ca2d(0x122),'command':a117_0x22ca2d(0x122),'description':a117_0x22ca2d(0x108),'risk':a117_0x22ca2d(0x109),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a117_0x22ca2d(0x11f),'description':a117_0x22ca2d(0x11e),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x1fec8e=a117_0x22ca2d,_0x301ffb=readPackageScripts(process[_0x1fec8e(0x124)]()),_0x10e7ec=[];if(_0x301ffb&&Object['keys'](_0x301ffb)['length']>0x0){const _0x5d9381=Object[_0x1fec8e(0x11c)](_0x301ffb),_0x1521be=Math[_0x1fec8e(0x118)](..._0x5d9381[_0x1fec8e(0x128)](_0x532289=>_0x532289['length']));_0x10e7ec[_0x1fec8e(0x10a)]('\x20\x20AVAILABLE\x20SCRIPTS\x20\x20(current\x20project)');for(const [_0x32af22,_0x595c30]of Object['entries'](_0x301ffb)){_0x10e7ec[_0x1fec8e(0x10a)](_0x1fec8e(0xfd)+CLI_BIN_NAME+_0x1fec8e(0xf8)+_0x32af22[_0x1fec8e(0x126)](_0x1521be+0x2)+'#\x20'+_0x595c30);}}else _0x10e7ec[_0x1fec8e(0x10a)]('\x20\x20EXAMPLES'),_0x10e7ec[_0x1fec8e(0x10a)](_0x1fec8e(0xfd)+CLI_BIN_NAME+_0x1fec8e(0x103)),_0x10e7ec[_0x1fec8e(0x10a)](_0x1fec8e(0xfd)+CLI_BIN_NAME+'\x20run\x20build'),_0x10e7ec[_0x1fec8e(0x10a)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1fec8e(0x116)),_0x10e7ec[_0x1fec8e(0x10a)](_0x1fec8e(0xfd)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch\x20\x20\x20#\x20parallel\x20build\x20--watch\x20+\x20preview');return _0x10e7ec['join']('\x0a');},async 'execute'(_0x8e6a19){const _0x59a539=a117_0x22ca2d,_0x59f475=process[_0x59a539(0x124)](),_0xf1d3eb=_0x8e6a19[_0x59a539(0xf1)][0x0],_0x5a97d7=_0x8e6a19[_0x59a539(0xf1)]['slice'](0x1),_0x53598d=readPackageScripts(_0x59f475);if(!_0x53598d)throw CliErrors[_0x59a539(0x115)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0xf1d3eb){const _0x2e08b2=Object['keys'](_0x53598d);if(_0x2e08b2[_0x59a539(0x117)]===0x0)console[_0x59a539(0x10e)](_0x59a539(0xf9));else{console[_0x59a539(0x10e)]('\x0a\x20\x20Available\x20scripts:\x0a');const _0x4fc238=Math[_0x59a539(0x118)](..._0x2e08b2['map'](_0x160e8d=>_0x160e8d[_0x59a539(0x117)]));for(const [_0x59a344,_0x585366]of Object[_0x59a539(0xfe)](_0x53598d)){console['log']('\x20\x20\x20\x20'+_0x59a344[_0x59a539(0x126)](_0x4fc238+0x2)+_0x585366);}console[_0x59a539(0x10e)](_0x59a539(0x114)+CLI_BIN_NAME+_0x59a539(0x127));}return{'ok':!![]};}if(!_0x53598d[_0xf1d3eb])throw CliErrors[_0x59a539(0x115)](_0x59a539(0x10d)+_0xf1d3eb+'\x22\x20not\x20found\x20in\x20package.json.','Available:\x20'+(Object['keys'](_0x53598d)[_0x59a539(0x110)](',\x20')||_0x59a539(0x129)));const _0x5f2850=detectPackageManager(_0x59f475);VERSION_CHECK_SCRIPTS[_0x59a539(0xf5)](_0xf1d3eb)&&await versionCheck(_0x59f475);if(_0xf1d3eb===_0x59a539(0xf6)&&_0x8e6a19['bool'](_0x59a539(0x11a)))return await Promise['all']([spawnViteBuildWatch(_0x59f475),spawnVitePreview(_0x59f475)]),{'ok':!![]};return await spawnScript(_0x5f2850,_0xf1d3eb,_0x5a97d7,_0x59f475),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a118_0x4ce732=a118_0x1d6b;function a118_0x1d6b(_0x3cee8f,_0x41acc4){_0x3cee8f=_0x3cee8f-0xd2;const _0x4fcae1=a118_0x4fca();let _0x1d6b4e=_0x4fcae1[_0x3cee8f];return _0x1d6b4e;}(function(_0xfe743e,_0x5b16fa){const _0x2c6ccb=a118_0x1d6b,_0x29dd71=_0xfe743e();while(!![]){try{const _0x110939=parseInt(_0x2c6ccb(0xde))/0x1+-parseInt(_0x2c6ccb(0xd6))/0x2*(-parseInt(_0x2c6ccb(0xd5))/0x3)+-parseInt(_0x2c6ccb(0xd9))/0x4*(parseInt(_0x2c6ccb(0xd8))/0x5)+-parseInt(_0x2c6ccb(0xdb))/0x6+parseInt(_0x2c6ccb(0xdd))/0x7+-parseInt(_0x2c6ccb(0xd7))/0x8+parseInt(_0x2c6ccb(0xd2))/0x9;if(_0x110939===_0x5b16fa)break;else _0x29dd71['push'](_0x29dd71['shift']());}catch(_0x2e7c35){_0x29dd71['push'](_0x29dd71['shift']());}}}(a118_0x4fca,0x88c03));import{buildSchemaPayload}from'../framework/schema-export.js';function a118_0x4fca(){const _0x4f47e1=['600eGVpHb','32756vOWCcL','schema','4888818xEUelM','read','986447NwIvpH','868777bLWCHn','15739065HUscOH','Export\x20machine-readable\x20command\x20schema\x20(JSON)','export','183WFkxlr','11282jebPHF','5959760eHxKXe'];a118_0x4fca=function(){return _0x4f47e1;};return a118_0x4fca();}async function execute(_0x4970d9){const _0x538d75=await buildSchemaPayload();return{'ok':!![],'data':_0x538d75};}export const schemaDefinition={'service':a118_0x4ce732(0xda),'command':a118_0x4ce732(0xd4),'description':a118_0x4ce732(0xd3),'risk':a118_0x4ce732(0xdc),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a119_0x43367d=a119_0x7565;(function(_0x51dbf2,_0x87626f){const _0x3344ab=a119_0x7565,_0x101230=_0x51dbf2();while(!![]){try{const _0x46ccf0=-parseInt(_0x3344ab(0x1ec))/0x1*(-parseInt(_0x3344ab(0x1eb))/0x2)+-parseInt(_0x3344ab(0x204))/0x3*(parseInt(_0x3344ab(0x1f7))/0x4)+-parseInt(_0x3344ab(0x201))/0x5*(parseInt(_0x3344ab(0x1e7))/0x6)+parseInt(_0x3344ab(0x1e9))/0x7*(parseInt(_0x3344ab(0x1ff))/0x8)+parseInt(_0x3344ab(0x1f8))/0x9+parseInt(_0x3344ab(0x1f3))/0xa*(parseInt(_0x3344ab(0x1f2))/0xb)+parseInt(_0x3344ab(0x1fa))/0xc;if(_0x46ccf0===_0x87626f)break;else _0x101230['push'](_0x101230['shift']());}catch(_0x35e28f){_0x101230['push'](_0x101230['shift']());}}}(a119_0x2790,0x9ef40));function a119_0x2790(){const _0x1c2f4e=['nonInteractive','setLogPath','skill-install','inherit','21670uqMQrm','5230nTkZaN','unknown','cwd','log','4JAglOz','307800whPEkd','../../skills/npx-skills-add.js','1125876FVXSzV','error','Install\x20developer\x20skill\x20package','\x20skill\x20installed','lovrabet/rabetbase','8HLSdoD','Check\x20network\x20connectivity\x20and\x20try\x20again.','2556585VuvxPy',')...','Skipped\x20npx\x20(RABETBASE_SKIP_NPX_SKILLS=1);\x20assuming\x20skill\x20is\x20already\x20present.','1307919utQyts','6SsPHpb','write','755237dCCarc','install','4678RpHsUD','142WGbrzM','info'];a119_0x2790=function(){return _0x1c2f4e;};return a119_0x2790();}function a119_0x7565(_0x2fad4a,_0x41f0cc){_0x2fad4a=_0x2fad4a-0x1e7;const _0x279092=a119_0x2790();let _0x75650f=_0x279092[_0x2fad4a];return _0x75650f;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{logger}from'../../utils/logger.js';import{NPX_SKILLS_ADD_GLOBAL_COMMAND_LINE}from'../../skills/npx-skills-add.js';export const skillDefinitions=[{'service':'skill','command':a119_0x43367d(0x1ea),'description':a119_0x43367d(0x1fc),'risk':a119_0x43367d(0x1e8),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x1f2fcd){const _0x8160cb=a119_0x43367d;logger[_0x8160cb(0x1ef)](process['cwd']()),logger[_0x8160cb(0x1ed)](_0x8160cb(0x1f0),'执行安装技能包命令(委托给\x20npx\x20skills\x20add\x20-g\x20-y)');const {runNpxSkillsAddGlobal:_0x18f3e4}=await import(_0x8160cb(0x1f9)),_0x4b342a=_0x1f2fcd[_0x8160cb(0x1ee)]?'pipe':_0x8160cb(0x1f1);console['log']('Installing\x20official\x20skill\x20via\x20npx\x20('+NPX_SKILLS_ADD_GLOBAL_COMMAND_LINE+_0x8160cb(0x202));const _0x20ea21=_0x18f3e4(process[_0x8160cb(0x1f5)](),_0x8160cb(0x1fe),{'stdio':_0x4b342a});if(_0x20ea21['skipped'])console['log'](_0x8160cb(0x203));else{if(_0x20ea21['ok'])console[_0x8160cb(0x1f6)](CLI_BIN_NAME+_0x8160cb(0x1fd));else throw CliErrors['apiError']('npx\x20skills\x20add\x20failed:\x20'+(_0x20ea21[_0x8160cb(0x1fb)]||_0x8160cb(0x1f4)),_0x8160cb(0x200));}return{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a119_0x375a38=a119_0x39b5;(function(_0x3e472c,_0x5ddcf8){const _0xb9e50=a119_0x39b5,_0x3c501b=_0x3e472c();while(!![]){try{const _0x37cb27=parseInt(_0xb9e50(0xc1))/0x1+-parseInt(_0xb9e50(0xc8))/0x2*(-parseInt(_0xb9e50(0xbb))/0x3)+parseInt(_0xb9e50(0xca))/0x4*(-parseInt(_0xb9e50(0xd5))/0x5)+-parseInt(_0xb9e50(0xae))/0x6*(parseInt(_0xb9e50(0xd4))/0x7)+parseInt(_0xb9e50(0xb5))/0x8+-parseInt(_0xb9e50(0xd2))/0x9*(-parseInt(_0xb9e50(0xb6))/0xa)+-parseInt(_0xb9e50(0xbc))/0xb;if(_0x37cb27===_0x5ddcf8)break;else _0x3c501b['push'](_0x3c501b['shift']());}catch(_0x39b525){_0x3c501b['push'](_0x3c501b['shift']());}}}(a119_0xd902,0xde683));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a119_0xd902(){const _0xc9947e=['high-risk-write','flag','parse','sqlRoot','适合带动态标签的\x20MyBatis\x20XML\x20SQL','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','4968186RgdTBI','utf8','isFinite','Target\x20database\x20ID','description','mode','join','11765008mKUyVm','7825900oAHMbR','lockFilePath','appCode','dbId\x20必须为正整数','mybatisXml','3785466WCreYR','25833038njRNKv','sql','db-id','name','lastSync','1755797XBQZtz','sqlCode','dbName','dbId\x20不能为空','<server-generated-sqlCode>','map','toISOString','2oRAwxE','number','4eguEZq','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','string','sqlName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','flagMissing','trim','SQL\x20query\x20display\x20name','9HBCtBv','catch','14LKRgRg','1776680bBlSCl','sqlRootDir','new','Invalid\x20database\x20selection\x20payload:\x20','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','File\x20already\x20exists:\x20','Created\x20SQL\x20query\x20','length','nonInteractive','Local\x20SQL\x20file\x20mode','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','普通\x20SQL(sql)','/smartapi/custom/saveUserCustomSql','isInteger','str','请输入目标数据库\x20dbId:','SELECT\x201\x20AS\x20id;','\x20\x20SELECT\x201\x20AS\x20id','dbId','✎\x20手动输入\x20dbId'];a119_0xd902=function(){return _0xc9947e;};return a119_0xd902();}function a119_0x39b5(_0x31dabb,_0x5e6de9){_0x31dabb=_0x31dabb-0x97;const _0xd902ce=a119_0xd902();let _0x39b5e9=_0xd902ce[_0x31dabb];return _0x39b5e9;}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x3ea45e){const _0x2abde0=a119_0x39b5;if(_0x3ea45e===_0x2abde0(0xba))return[_0x2abde0(0xad),_0x2abde0(0xa5),'</select>',''][_0x2abde0(0xb4)]('\x0a');return[_0x2abde0(0xa4),''][_0x2abde0(0xb4)]('\x0a');}export const sqlCreate={'service':a119_0x375a38(0xbd),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a119_0x375a38(0xa8),'flags':[{'name':'name','type':a119_0x375a38(0xcc),'description':a119_0x375a38(0xd1)},{'name':'db-id','type':a119_0x375a38(0xc9),'description':a119_0x375a38(0xb1)},{'name':a119_0x375a38(0xb3),'type':a119_0x375a38(0xcc),'enum':['sql',a119_0x375a38(0xba)],'description':a119_0x375a38(0x9c)}],async 'validate'(_0x51704b){const _0x1f5320=a119_0x375a38;if(!_0x51704b[_0x1f5320(0x9b)])return;if(!_0x51704b[_0x1f5320(0xa2)](_0x1f5320(0xbf))['trim']())throw CliErrors[_0x1f5320(0xcf)](_0x1f5320(0xbf),_0x1f5320(0x9d));const _0x1630d2=resolveProvidedDbId(_0x51704b);if(typeof _0x1630d2!==_0x1f5320(0xc9)||!Number[_0x1f5320(0xb0)](_0x1630d2)||_0x1630d2<=0x0)throw CliErrors[_0x1f5320(0xcf)](_0x1f5320(0xbe),_0x1f5320(0x97));if(!_0x51704b[_0x1f5320(0xa2)](_0x1f5320(0xb3))[_0x1f5320(0xd0)]())throw CliErrors['flagMissing'](_0x1f5320(0xb3),_0x1f5320(0x9e));},async 'dryRun'(_0x20bfec){const _0x2dd784=a119_0x375a38,_0x52194a=loadSqlProjectConfig(_0x20bfec[_0x2dd784(0xb8)]),{sqlName:_0x5d1ddf,dbId:_0x3bf742,dbName:_0x26aebd,mode:_0x2bc5a3}=await resolveSqlNewInputs(_0x20bfec),_0x1452f2=buildSqlRelativePath(_0x2dd784(0xc5),_0x5d1ddf,_0x26aebd,_0x2bc5a3,_0x3bf742),_0x19374c=_0x52194a['sqlRootDir']+'/'+_0x1452f2;return{'method':'POST','url':_0x2dd784(0xa0),'body':{'appCode':_0x20bfec[_0x2dd784(0xb8)],'sqlName':_0x5d1ddf,'dbId':_0x3bf742,'mode':_0x2bc5a3,'localPath':_0x19374c},'description':_0x2dd784(0xce)+_0x52194a['sqlRootDir']};},async 'execute'(_0xec69a6){const _0x61171d=a119_0x375a38,_0x2dfd58=loadSqlProjectConfig(_0xec69a6['appCode']),{sqlName:_0x46ce16,dbId:_0x2b8b74,dbName:_0x328668,mode:_0x13801d}=await resolveSqlNewInputs(_0xec69a6),_0x2528fc=generateSqlTemplate(_0x13801d),_0x51c159=await createSqlQuery({'appCode':_0xec69a6[_0x61171d(0xb8)],'sqlName':_0x46ce16,'dbId':_0x2b8b74,'sqlContent':_0x2528fc}),_0x3dd8ba=ensureRemoteSqlContent(_0x51c159),_0x27b906=_0x328668||await getDbName(_0xec69a6[_0x61171d(0xb8)],_0x2b8b74)[_0x61171d(0xd3)](()=>undefined),_0x2d73d5=buildSqlRelativePath(_0x51c159[_0x61171d(0xc2)],_0x51c159[_0x61171d(0xcd)],_0x27b906,_0x13801d,_0x2b8b74),_0x42d0db=_0x2dfd58[_0x61171d(0xd6)]+'/'+_0x2d73d5,_0x1f02a2=buildLocalSqlFileContent({'sqlCode':_0x51c159[_0x61171d(0xc2)],'sqlName':_0x51c159[_0x61171d(0xcd)],'dbId':_0x51c159[_0x61171d(0xa6)]},_0x3dd8ba,{'dbName':_0x27b906,'mode':_0x13801d,'syncedAt':new Date()[_0x61171d(0xc7)](),'description':_0x51c159[_0x61171d(0xb2)]});if(await fileExists(_0x42d0db))throw CliErrors['validation'](_0x61171d(0x98)+_0x42d0db);await ensureParentDirectory(_0x42d0db),await writeFile(_0x42d0db,_0x1f02a2,_0x61171d(0xaf));const _0x15e26f=await readSqlLockFile(_0x2dfd58[_0x61171d(0xb7)]),{lockData:_0x529cf5,appLock:_0x1f2df8}=ensureSqlLockScope(_0x15e26f??createEmptySqlLock(),_0x2dfd58['appCode'],_0x2dfd58[_0x61171d(0xab)],_0x61171d(0xd7));return _0x1f2df8['sqls'][_0x51c159[_0x61171d(0xc2)]]={...buildSqlLockEntry(_0x51c159,_0x3dd8ba,computeSqlContentHash(_0x1f02a2),{'dbName':_0x27b906}),'path':_0x2d73d5,'mode':_0x13801d},_0x1f2df8[_0x61171d(0xc0)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2dfd58[_0x61171d(0xb7)],_0x529cf5),{'ok':!![],'data':{'id':_0x51c159['id'],'sqlCode':_0x51c159[_0x61171d(0xc2)],'sqlName':_0x51c159['sqlName'],'dbId':_0x51c159[_0x61171d(0xa6)],'path':_0x42d0db,'mode':_0x13801d},'message':_0x61171d(0x99)+_0x51c159[_0x61171d(0xc2)]};}};async function resolveSqlNewInputs(_0x16cb3b){const _0x523d3c=await resolveSqlNameInput(_0x16cb3b),{dbId:_0x24e455,dbName:_0x24dd72}=await resolveDbSelection(_0x16cb3b),_0x5b1146=await resolveSqlModeInput(_0x16cb3b);return{'sqlName':_0x523d3c,'dbId':_0x24e455,'dbName':_0x24dd72,'mode':_0x5b1146};}async function resolveSqlNameInput(_0x455742){const _0x3be89f=a119_0x375a38,_0x4dc393=_0x455742[_0x3be89f(0xa2)](_0x3be89f(0xbf))['trim']();if(_0x4dc393)return _0x4dc393;if(_0x455742[_0x3be89f(0x9b)])throw CliErrors['flagMissing'](_0x3be89f(0xbf),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x2624c8=>_0x2624c8['trim']()?!![]:'SQL\x20名称不能为空'}))[_0x3be89f(0xd0)]();}async function resolveDbSelection(_0x73e11){const _0x1cabe2=a119_0x375a38,_0x1b21c0=resolveProvidedDbId(_0x73e11);if(typeof _0x1b21c0==='number'&&Number['isFinite'](_0x1b21c0)&&_0x1b21c0>0x0)return{'dbId':_0x1b21c0,'dbName':await getDbName(_0x73e11['appCode'],_0x1b21c0)[_0x1cabe2(0xd3)](()=>undefined)};if(_0x73e11[_0x1cabe2(0x9b)])throw CliErrors['flagMissing'](_0x1cabe2(0xbe),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0xcb4092=await listDatabases(_0x73e11['appCode'])['catch'](()=>[]);if(_0xcb4092[_0x1cabe2(0x9a)]===0x1)return{'dbId':_0xcb4092[0x0][_0x1cabe2(0xa6)],'dbName':_0xcb4092[0x0][_0x1cabe2(0xc3)]};if(_0xcb4092['length']>0x1){const _0x5f4003=await select({'message':'请选择目标数据库:','choices':[..._0xcb4092[_0x1cabe2(0xc6)](_0x44ae84=>({'name':_0x44ae84[_0x1cabe2(0xc3)]+'\x20('+_0x44ae84[_0x1cabe2(0xa6)]+')','value':serializeDbSelection(_0x44ae84)})),{'name':_0x1cabe2(0xa7),'value':'__manual__'}]});if(_0x5f4003!=='__manual__')return deserializeDbSelection(_0x5f4003);}const _0xbcdfa7=await input({'message':_0x1cabe2(0xa3),'validate':_0x4c1d20=>{const _0x39d0f1=_0x1cabe2,_0x285415=_0x4c1d20[_0x39d0f1(0xd0)]();if(!_0x285415)return _0x39d0f1(0xc4);const _0xe83050=Number(_0x285415);if(!Number[_0x39d0f1(0xa1)](_0xe83050)||_0xe83050<=0x0)return _0x39d0f1(0xb9);return!![];}});return{'dbId':Number(_0xbcdfa7[_0x1cabe2(0xd0)]())};}async function resolveSqlModeInput(_0x12285a){const _0x2b1a4a=a119_0x375a38,_0x263312=_0x12285a[_0x2b1a4a(0xa2)](_0x2b1a4a(0xb3))[_0x2b1a4a(0xd0)]();if(_0x263312===_0x2b1a4a(0xbd)||_0x263312===_0x2b1a4a(0xba))return _0x263312;if(_0x12285a['nonInteractive'])throw CliErrors[_0x2b1a4a(0xcf)](_0x2b1a4a(0xb3),_0x2b1a4a(0x9e));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x2b1a4a(0x9f),'value':_0x2b1a4a(0xbd),'description':_0x2b1a4a(0xcb)},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x2b1a4a(0xba),'description':_0x2b1a4a(0xac)}]});}function serializeDbSelection(_0x781600){const _0x4d11de=a119_0x375a38;return JSON['stringify']({'dbId':_0x781600[_0x4d11de(0xa6)],'dbName':_0x781600[_0x4d11de(0xc3)]});}function deserializeDbSelection(_0x284693){const _0x3f09f9=a119_0x375a38;try{const _0x5258fd=JSON[_0x3f09f9(0xaa)](_0x284693);if(typeof _0x5258fd[_0x3f09f9(0xa6)]===_0x3f09f9(0xc9)&&Number[_0x3f09f9(0xb0)](_0x5258fd[_0x3f09f9(0xa6)]))return{'dbId':_0x5258fd[_0x3f09f9(0xa6)],'dbName':_0x5258fd['dbName']};}catch{}throw CliErrors['validation'](_0x3f09f9(0xd8)+_0x284693);}function resolveProvidedDbId(_0x327ddf){const _0xd6d43=a119_0x375a38,_0x1d3b9c=_0x327ddf[_0xd6d43(0xa9)](_0xd6d43(0xbe));if(typeof _0x1d3b9c===_0xd6d43(0xc9)&&Number[_0xd6d43(0xb0)](_0x1d3b9c))return _0x1d3b9c;return undefined;}
|
|
1
|
+
const a120_0x5d801a=a120_0x45bb;function a120_0x45bb(_0x1544fe,_0x238ff3){_0x1544fe=_0x1544fe-0xfe;const _0x3e3f3f=a120_0x3e3f();let _0x45bbc8=_0x3e3f3f[_0x1544fe];return _0x45bbc8;}(function(_0x52eb76,_0x1c9289){const _0x34d308=a120_0x45bb,_0x5b5b0d=_0x52eb76();while(!![]){try{const _0x1875a4=-parseInt(_0x34d308(0x138))/0x1*(-parseInt(_0x34d308(0x129))/0x2)+-parseInt(_0x34d308(0x105))/0x3*(parseInt(_0x34d308(0x130))/0x4)+parseInt(_0x34d308(0x104))/0x5*(-parseInt(_0x34d308(0x146))/0x6)+-parseInt(_0x34d308(0x134))/0x7*(-parseInt(_0x34d308(0x10e))/0x8)+-parseInt(_0x34d308(0x11a))/0x9*(parseInt(_0x34d308(0x121))/0xa)+parseInt(_0x34d308(0x128))/0xb*(parseInt(_0x34d308(0x10c))/0xc)+parseInt(_0x34d308(0x102))/0xd*(-parseInt(_0x34d308(0xfe))/0xe);if(_0x1875a4===_0x1c9289)break;else _0x5b5b0d['push'](_0x5b5b0d['shift']());}catch(_0x43e3b7){_0x5b5b0d['push'](_0x5b5b0d['shift']());}}}(a120_0x3e3f,0xd40e9));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x1a560c){const _0x3f3f0f=a120_0x45bb;if(_0x1a560c===_0x3f3f0f(0x103))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x3f3f0f(0x127),_0x3f3f0f(0x122),''][_0x3f3f0f(0x13e)]('\x0a');return[_0x3f3f0f(0x10b),''][_0x3f3f0f(0x13e)]('\x0a');}export const sqlCreate={'service':a120_0x5d801a(0x12a),'command':a120_0x5d801a(0x13d),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':'high-risk-write','flags':[{'name':'name','type':a120_0x5d801a(0x135),'description':'SQL\x20query\x20display\x20name'},{'name':a120_0x5d801a(0x12e),'type':'number','description':a120_0x5d801a(0x12d)},{'name':a120_0x5d801a(0xff),'type':a120_0x5d801a(0x135),'enum':[a120_0x5d801a(0x12a),a120_0x5d801a(0x103)],'description':a120_0x5d801a(0x109)}],async 'validate'(_0x1eeb69){const _0x78bbdc=a120_0x5d801a;if(!_0x1eeb69[_0x78bbdc(0x124)])return;if(!_0x1eeb69[_0x78bbdc(0x113)]('name')[_0x78bbdc(0x111)]())throw CliErrors[_0x78bbdc(0x116)](_0x78bbdc(0x118),_0x78bbdc(0x123));const _0x496cfb=resolveProvidedDbId(_0x1eeb69);if(typeof _0x496cfb!==_0x78bbdc(0x13b)||!Number['isFinite'](_0x496cfb)||_0x496cfb<=0x0)throw CliErrors[_0x78bbdc(0x116)](_0x78bbdc(0x12e),_0x78bbdc(0x137));if(!_0x1eeb69[_0x78bbdc(0x113)](_0x78bbdc(0xff))[_0x78bbdc(0x111)]())throw CliErrors[_0x78bbdc(0x116)](_0x78bbdc(0xff),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x4f07ac){const _0x53b334=a120_0x5d801a,_0xb8fb9d=loadSqlProjectConfig(_0x4f07ac[_0x53b334(0x140)]),{sqlName:_0x4f90ac,dbId:_0x5b9315,dbName:_0x576530,mode:_0x2b6840}=await resolveSqlNewInputs(_0x4f07ac),_0x2f9663=buildSqlRelativePath(_0x53b334(0x100),_0x4f90ac,_0x576530,_0x2b6840,_0x5b9315),_0x323412=_0xb8fb9d[_0x53b334(0x106)]+'/'+_0x2f9663;return{'method':'POST','url':_0x53b334(0x13c),'body':{'appCode':_0x4f07ac[_0x53b334(0x140)],'sqlName':_0x4f90ac,'dbId':_0x5b9315,'mode':_0x2b6840,'localPath':_0x323412},'description':_0x53b334(0x117)+_0xb8fb9d[_0x53b334(0x106)]};},async 'execute'(_0x596f6e){const _0x47a565=a120_0x5d801a,_0x4807fe=loadSqlProjectConfig(_0x596f6e[_0x47a565(0x140)]),{sqlName:_0x4b4c79,dbId:_0x2ae7a1,dbName:_0x6eb39,mode:_0x3ec77d}=await resolveSqlNewInputs(_0x596f6e),_0x2129bd=generateSqlTemplate(_0x3ec77d),_0x22d77e=await createSqlQuery({'appCode':_0x596f6e[_0x47a565(0x140)],'sqlName':_0x4b4c79,'dbId':_0x2ae7a1,'sqlContent':_0x2129bd}),_0x18c09d=ensureRemoteSqlContent(_0x22d77e),_0xf61889=_0x6eb39||await getDbName(_0x596f6e[_0x47a565(0x140)],_0x2ae7a1)[_0x47a565(0x10f)](()=>undefined),_0x1d2d84=buildSqlRelativePath(_0x22d77e[_0x47a565(0x110)],_0x22d77e[_0x47a565(0x115)],_0xf61889,_0x3ec77d,_0x2ae7a1),_0x11e250=_0x4807fe[_0x47a565(0x106)]+'/'+_0x1d2d84,_0x42f781=buildLocalSqlFileContent({'sqlCode':_0x22d77e[_0x47a565(0x110)],'sqlName':_0x22d77e[_0x47a565(0x115)],'dbId':_0x22d77e[_0x47a565(0x114)]},_0x18c09d,{'dbName':_0xf61889,'mode':_0x3ec77d,'syncedAt':new Date()[_0x47a565(0x133)](),'description':_0x22d77e[_0x47a565(0x131)]});if(await fileExists(_0x11e250))throw CliErrors[_0x47a565(0x136)](_0x47a565(0x11b)+_0x11e250);await ensureParentDirectory(_0x11e250),await writeFile(_0x11e250,_0x42f781,_0x47a565(0x11f));const _0x515f7e=await readSqlLockFile(_0x4807fe[_0x47a565(0x142)]),{lockData:_0x2fc8fe,appLock:_0x7e7735}=ensureSqlLockScope(_0x515f7e??createEmptySqlLock(),_0x4807fe[_0x47a565(0x140)],_0x4807fe['sqlRoot'],_0x47a565(0x12f));return _0x7e7735[_0x47a565(0x10a)][_0x22d77e[_0x47a565(0x110)]]={...buildSqlLockEntry(_0x22d77e,_0x18c09d,computeSqlContentHash(_0x42f781),{'dbName':_0xf61889}),'path':_0x1d2d84,'mode':_0x3ec77d},_0x7e7735[_0x47a565(0x101)]=new Date()[_0x47a565(0x133)](),await writeSqlLockFile(_0x4807fe[_0x47a565(0x142)],_0x2fc8fe),{'ok':!![],'data':{'id':_0x22d77e['id'],'sqlCode':_0x22d77e[_0x47a565(0x110)],'sqlName':_0x22d77e[_0x47a565(0x115)],'dbId':_0x22d77e[_0x47a565(0x114)],'path':_0x11e250,'mode':_0x3ec77d},'message':_0x47a565(0x143)+_0x22d77e[_0x47a565(0x110)]};}};async function resolveSqlNewInputs(_0x3573f1){const _0x5cbfbc=await resolveSqlNameInput(_0x3573f1),{dbId:_0x535eb5,dbName:_0x122305}=await resolveDbSelection(_0x3573f1),_0x26997b=await resolveSqlModeInput(_0x3573f1);return{'sqlName':_0x5cbfbc,'dbId':_0x535eb5,'dbName':_0x122305,'mode':_0x26997b};}function a120_0x3e3f(){const _0x305411=['请输入目标数据库\x20dbId:','普通\x20SQL(sql)','utf8','__manual__','90zEojQo','</select>','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','nonInteractive','请输入\x20SQL\x20名称:','SQL\x20名称不能为空','\x20\x20SELECT\x201\x20AS\x20id','1012ZNqkGd','38xyisPk','sql','dbId\x20必须为正整数','dbId\x20不能为空','Target\x20database\x20ID','db-id','new','8784uoxhvk','description','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','toISOString','1799LTvWcq','string','validation','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','39049VNNDna','Invalid\x20database\x20selection\x20payload:\x20','请选择本地\x20SQL\x20模式:','number','/smartapi/custom/saveUserCustomSql','create','join','isInteger','appCode','length','lockFilePath','Created\x20SQL\x20query\x20','dbName','请选择目标数据库:','3552gnNvMe','16040794BiDCKD','mode','<server-generated-sqlCode>','lastSync','13ENzLwq','mybatisXml','4895uRmTMX','1104AVPvKD','sqlRootDir','✎\x20手动输入\x20dbId','parse','Local\x20SQL\x20file\x20mode','sqls','SELECT\x201\x20AS\x20id;','222024LNkqJI','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','36856qtnRFn','catch','sqlCode','trim','isFinite','str','dbId','sqlName','flagMissing','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','name','MyBatis\x20XML(mybatisXml)','226062buTWsI','File\x20already\x20exists:\x20','适合带动态标签的\x20MyBatis\x20XML\x20SQL'];a120_0x3e3f=function(){return _0x305411;};return a120_0x3e3f();}async function resolveSqlNameInput(_0x22e8fe){const _0x5d4378=a120_0x5d801a,_0x333e3b=_0x22e8fe[_0x5d4378(0x113)](_0x5d4378(0x118))[_0x5d4378(0x111)]();if(_0x333e3b)return _0x333e3b;if(_0x22e8fe[_0x5d4378(0x124)])throw CliErrors['flagMissing'](_0x5d4378(0x118),_0x5d4378(0x123));return(await input({'message':_0x5d4378(0x125),'validate':_0x22ad2f=>_0x22ad2f[_0x5d4378(0x111)]()?!![]:_0x5d4378(0x126)}))[_0x5d4378(0x111)]();}async function resolveDbSelection(_0x10424d){const _0x11b3e4=a120_0x5d801a,_0x41b60b=resolveProvidedDbId(_0x10424d);if(typeof _0x41b60b===_0x11b3e4(0x13b)&&Number[_0x11b3e4(0x112)](_0x41b60b)&&_0x41b60b>0x0)return{'dbId':_0x41b60b,'dbName':await getDbName(_0x10424d[_0x11b3e4(0x140)],_0x41b60b)['catch'](()=>undefined)};if(_0x10424d['nonInteractive'])throw CliErrors[_0x11b3e4(0x116)](_0x11b3e4(0x12e),_0x11b3e4(0x137));const _0xc7a57e=await listDatabases(_0x10424d['appCode'])[_0x11b3e4(0x10f)](()=>[]);if(_0xc7a57e['length']===0x1)return{'dbId':_0xc7a57e[0x0][_0x11b3e4(0x114)],'dbName':_0xc7a57e[0x0][_0x11b3e4(0x144)]};if(_0xc7a57e[_0x11b3e4(0x141)]>0x1){const _0x509b56=await select({'message':_0x11b3e4(0x145),'choices':[..._0xc7a57e['map'](_0x4f0b17=>({'name':_0x4f0b17[_0x11b3e4(0x144)]+'\x20('+_0x4f0b17[_0x11b3e4(0x114)]+')','value':serializeDbSelection(_0x4f0b17)})),{'name':_0x11b3e4(0x107),'value':_0x11b3e4(0x120)}]});if(_0x509b56!==_0x11b3e4(0x120))return deserializeDbSelection(_0x509b56);}const _0x4ff771=await input({'message':_0x11b3e4(0x11d),'validate':_0x3e5437=>{const _0x1de4ed=_0x11b3e4,_0xab486e=_0x3e5437[_0x1de4ed(0x111)]();if(!_0xab486e)return _0x1de4ed(0x12c);const _0x54f7a0=Number(_0xab486e);if(!Number[_0x1de4ed(0x13f)](_0x54f7a0)||_0x54f7a0<=0x0)return _0x1de4ed(0x12b);return!![];}});return{'dbId':Number(_0x4ff771['trim']())};}async function resolveSqlModeInput(_0x5644ca){const _0x4c55e3=a120_0x5d801a,_0x14c262=_0x5644ca['str'](_0x4c55e3(0xff))['trim']();if(_0x14c262===_0x4c55e3(0x12a)||_0x14c262===_0x4c55e3(0x103))return _0x14c262;if(_0x5644ca[_0x4c55e3(0x124)])throw CliErrors[_0x4c55e3(0x116)](_0x4c55e3(0xff),_0x4c55e3(0x132));return await select({'message':_0x4c55e3(0x13a),'choices':[{'name':_0x4c55e3(0x11e),'value':'sql','description':_0x4c55e3(0x10d)},{'name':_0x4c55e3(0x119),'value':_0x4c55e3(0x103),'description':_0x4c55e3(0x11c)}]});}function serializeDbSelection(_0xbdf4d6){const _0x542909=a120_0x5d801a;return JSON['stringify']({'dbId':_0xbdf4d6[_0x542909(0x114)],'dbName':_0xbdf4d6[_0x542909(0x144)]});}function deserializeDbSelection(_0x18eb18){const _0x3cd24a=a120_0x5d801a;try{const _0x28181f=JSON[_0x3cd24a(0x108)](_0x18eb18);if(typeof _0x28181f[_0x3cd24a(0x114)]===_0x3cd24a(0x13b)&&Number[_0x3cd24a(0x112)](_0x28181f[_0x3cd24a(0x114)]))return{'dbId':_0x28181f[_0x3cd24a(0x114)],'dbName':_0x28181f[_0x3cd24a(0x144)]};}catch{}throw CliErrors[_0x3cd24a(0x136)](_0x3cd24a(0x139)+_0x18eb18);}function resolveProvidedDbId(_0x12f12e){const _0x3a159a=a120_0x5d801a,_0x300c32=_0x12f12e['flag']('db-id');if(typeof _0x300c32===_0x3a159a(0x13b)&&Number['isFinite'](_0x300c32))return _0x300c32;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a121_0x3fe64a=a121_0x3ffc;(function(_0x68f9bc,_0x5bf3dc){const _0x571e37=a121_0x3ffc,_0xdd19ab=_0x68f9bc();while(!![]){try{const _0x3cad1a=-parseInt(_0x571e37(0xac))/0x1+parseInt(_0x571e37(0xa9))/0x2*(-parseInt(_0x571e37(0xb1))/0x3)+parseInt(_0x571e37(0xb7))/0x4+-parseInt(_0x571e37(0xc4))/0x5+-parseInt(_0x571e37(0xa0))/0x6+-parseInt(_0x571e37(0xc2))/0x7*(parseInt(_0x571e37(0xbc))/0x8)+parseInt(_0x571e37(0xbb))/0x9*(parseInt(_0x571e37(0xbe))/0xa);if(_0x3cad1a===_0x5bf3dc)break;else _0xdd19ab['push'](_0xdd19ab['shift']());}catch(_0x273ea7){_0xdd19ab['push'](_0xdd19ab['shift']());}}}(a121_0x19f2,0x37358));function a121_0x19f2(){const _0x36692d=['360792uiVwyE','remoteId','SQL\x20lock\x20file\x20not\x20found.','Deleted\x20','sqlRoot','projectRoot','delete','startsWith','sqlRootDir','60646cWfmKw','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','Would\x20delete\x20SQL\x20','134438chXnHo','sql','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','filter','POST','15lTSbsG','validation','trashedTo','entries','fromEntries','toISOString','1803872Feixmn','sqls','lastSync','replace','23445pmOubw','136sAYZfP','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','2690uFLoLs','str','trashDir','appCode','115731cOelyG','sqlcode','1491655rYoXzK','lockFilePath'];a121_0x19f2=function(){return _0x36692d;};return a121_0x19f2();}import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a121_0x3ffc(_0x37d1c7,_0x4131fd){_0x37d1c7=_0x37d1c7-0xa0;const _0x19f25f=a121_0x19f2();let _0x3ffc0f=_0x19f25f[_0x37d1c7];return _0x3ffc0f;}export const sqlDelete={'service':a121_0x3fe64a(0xad),'command':'delete','description':a121_0x3fe64a(0xaa),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x237009){const _0x20e335=a121_0x3fe64a,_0x2927c8=loadSqlProjectConfig(_0x237009[_0x20e335(0xc1)]),_0x236962=await readSqlLockFile(_0x2927c8[_0x20e335(0xc5)]);if(!_0x236962)throw CliErrors[_0x20e335(0xb2)](_0x20e335(0xae));},async 'dryRun'(_0x36c72b){const _0x456204=a121_0x3fe64a,_0x1eca76=loadSqlProjectConfig(_0x36c72b['appCode']),_0x54f76b=await readSqlLockFile(_0x1eca76[_0x456204(0xc5)]);if(!_0x54f76b)throw CliErrors[_0x456204(0xb2)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x2ed61f}=ensureSqlLockScope(_0x54f76b,_0x36c72b[_0x456204(0xc1)],_0x1eca76[_0x456204(0xa4)],_0x456204(0xa6)),_0x3932fa=_0x36c72b[_0x456204(0xbf)]('sqlcode'),_0x3da15e=_0x2ed61f[_0x456204(0xb8)][_0x3932fa];if(!_0x3da15e)throw CliErrors[_0x456204(0xb2)](_0x456204(0xbd)+_0x3932fa+'\x22.');return{'method':_0x456204(0xb0),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x3932fa,'id':_0x3da15e[_0x456204(0xa1)],'localPath':resolveLocalSqlFilePath(_0x1eca76,_0x3932fa,_0x3da15e)},'description':_0x456204(0xab)+_0x3932fa+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x1eca76['trashDir']};},async 'execute'(_0x2afb8e){const _0x30858e=a121_0x3fe64a,_0x2eead3=loadSqlProjectConfig(_0x2afb8e[_0x30858e(0xc1)]),_0x6febda=await readSqlLockFile(_0x2eead3[_0x30858e(0xc5)]);if(!_0x6febda)throw CliErrors[_0x30858e(0xb2)](_0x30858e(0xa2));const {lockData:_0x45634c,appLock:_0x3e7f79}=ensureSqlLockScope(_0x6febda,_0x2afb8e[_0x30858e(0xc1)],_0x2eead3[_0x30858e(0xa4)],_0x30858e(0xa6)),_0x409c90=_0x2afb8e[_0x30858e(0xbf)](_0x30858e(0xc3)),_0x1ffed6=_0x3e7f79[_0x30858e(0xb8)][_0x409c90];if(!_0x1ffed6)throw CliErrors[_0x30858e(0xb2)](_0x30858e(0xbd)+_0x409c90+'\x22.');await deleteSqlQuery({'id':_0x1ffed6[_0x30858e(0xa1)],'sqlCode':_0x409c90}),_0x3e7f79[_0x30858e(0xb8)]=Object[_0x30858e(0xb5)](Object[_0x30858e(0xb4)](_0x3e7f79[_0x30858e(0xb8)])[_0x30858e(0xaf)](([_0x4a7172])=>_0x4a7172!==_0x409c90)),_0x3e7f79[_0x30858e(0xb9)]=new Date()[_0x30858e(0xb6)](),await writeSqlLockFile(_0x2eead3[_0x30858e(0xc5)],_0x45634c);const _0x4e770a=resolveLocalSqlFilePath(_0x2eead3,_0x409c90,_0x1ffed6);let _0xacf1f3;await fileExists(_0x4e770a)&&(_0xacf1f3=await moveToTrash(_0x2eead3[_0x30858e(0xa5)],_0x2eead3[_0x30858e(0xc0)],_0x4e770a),await cleanupEmptyDirectories(dirname(_0x4e770a),_0x2eead3[_0x30858e(0xa8)]));const _0x3a96dc={'deleted':_0x409c90,'remoteId':_0x1ffed6[_0x30858e(0xa1)]};if(_0xacf1f3)_0x3a96dc[_0x30858e(0xb3)]=_0xacf1f3;return{'ok':!![],'data':_0x3a96dc,'message':_0x30858e(0xa3)+_0x409c90+(_0xacf1f3?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x125b38,_0x17207a,_0x2d740b){const _0x6979d5=a121_0x3fe64a,_0x229676=new Date()[_0x6979d5(0xb6)]()[_0x6979d5(0xba)](/[:.]/g,'-'),_0xf5e6b8=relative(_0x125b38,_0x2d740b),_0x300bc5=join(_0x17207a,_0x229676,_0xf5e6b8);return await mkdir(dirname(_0x300bc5),{'recursive':!![]}),await rename(_0x2d740b,_0x300bc5),_0x300bc5;}async function cleanupEmptyDirectories(_0x15723f,_0x4ffb04){const _0x324ac6=a121_0x3fe64a;let _0x210762=resolve(_0x15723f);const _0x44c23b=resolve(_0x4ffb04);while(_0x210762[_0x324ac6(0xa7)](''+_0x44c23b+sep)||_0x210762===_0x44c23b){if(_0x210762===_0x44c23b)return;try{const _0x38a182=await readdir(_0x210762);if(_0x38a182['length']>0x0)return;await rmdir(_0x210762);}catch{return;}_0x210762=dirname(_0x210762);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a122_0x279415=a122_0x304e;(function(_0x324ecf,_0x4f47b5){const _0x190d1f=a122_0x304e,_0x2c63f0=_0x324ecf();while(!![]){try{const _0x1c4073=-parseInt(_0x190d1f(0x8a))/0x1*(-parseInt(_0x190d1f(0x9c))/0x2)+parseInt(_0x190d1f(0x96))/0x3+parseInt(_0x190d1f(0x9e))/0x4+-parseInt(_0x190d1f(0x94))/0x5+parseInt(_0x190d1f(0x99))/0x6*(parseInt(_0x190d1f(0x9b))/0x7)+-parseInt(_0x190d1f(0x9f))/0x8+-parseInt(_0x190d1f(0x97))/0x9;if(_0x1c4073===_0x4f47b5)break;else _0x2c63f0['push'](_0x2c63f0['shift']());}catch(_0x59f5d5){_0x2c63f0['push'](_0x2c63f0['shift']());}}}(a122_0x1364,0x8d75d));import{getSqlQueryInfo}from'../../core/api-client.js';function a122_0x1364(){const _0x1faa62=['737184KzymkO','sqlcode','sqlContent','1PDEmXv','sqlName','detail','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','verbose','sqlCode','sql','boolean','read','bool','5172670Njngdt','description','2594784kDKJuI','8952939kDljBA','dbId','10794SkVdzt','Return\x20full\x20raw\x20SQL\x20query\x20object','1141Bdtunn','1327276mDaTrj','appCode','3516284XhoRjc'];a122_0x1364=function(){return _0x1faa62;};return a122_0x1364();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a122_0x304e(_0x2b60cf,_0x80dbe8){_0x2b60cf=_0x2b60cf-0x89;const _0x136467=a122_0x1364();let _0x304e55=_0x136467[_0x2b60cf];return _0x304e55;}export const sqlDetail={'service':a122_0x279415(0x90),'command':a122_0x279415(0x8c),'description':a122_0x279415(0x8d),'risk':a122_0x279415(0x92),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a122_0x279415(0x91),'description':a122_0x279415(0x9a)}],async 'execute'(_0x134f7a){const _0x53cfc1=a122_0x279415,_0x70783e=await getSqlQueryInfo(_0x134f7a[_0x53cfc1(0x9d)],_0x134f7a['str'](_0x53cfc1(0xa0))),_0x26a55e=_0x134f7a[_0x53cfc1(0x93)](_0x53cfc1(0x8e));if(_0x26a55e)return{'ok':!![],'data':_0x70783e};const _0x16e2de=_0x70783e[_0x53cfc1(0x98)]?await getDbName(_0x134f7a[_0x53cfc1(0x9d)],_0x70783e[_0x53cfc1(0x98)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x70783e[_0x53cfc1(0x8f)],'sqlName':_0x70783e[_0x53cfc1(0x8b)],'db':_0x16e2de?_0x16e2de+'\x20('+_0x70783e[_0x53cfc1(0x98)]+')':_0x70783e[_0x53cfc1(0x98)]??'','description':_0x70783e[_0x53cfc1(0x95)]??'','sqlContent':_0x70783e[_0x53cfc1(0x89)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a123_0x2b836d=a123_0x4fd9;(function(_0x5af709,_0x1fe541){const _0x523133=a123_0x4fd9,_0x14656b=_0x5af709();while(!![]){try{const _0x726ce7=-parseInt(_0x523133(0xaf))/0x1*(parseInt(_0x523133(0xa6))/0x2)+-parseInt(_0x523133(0xa0))/0x3*(-parseInt(_0x523133(0xaa))/0x4)+parseInt(_0x523133(0xa8))/0x5+-parseInt(_0x523133(0xad))/0x6+-parseInt(_0x523133(0xa3))/0x7+parseInt(_0x523133(0xb2))/0x8*(parseInt(_0x523133(0x9b))/0x9)+parseInt(_0x523133(0xa2))/0xa*(-parseInt(_0x523133(0x9e))/0xb);if(_0x726ce7===_0x1fe541)break;else _0x14656b['push'](_0x14656b['shift']());}catch(_0x4bd8fb){_0x14656b['push'](_0x14656b['shift']());}}}(a123_0x424e,0x748eb));import{executeSql}from'../../core/api-client.js';function a123_0x424e(){const _0x2f8c3f=['now','1206wTAOWp','exec','2530060GiwdLp','str','1424344TpUEXx','isArray','string','282210OVOdIe','appCode','417pgFwhH','params','sqlcode','6646480yeKLYp','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','read','execSuccess','SQL\x20execution\x20failed','9SaJnqM','sql','execResult','491524uhJMDw','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','3saBtxK','\x20row(s)\x20in\x20','70uSHHmj','4229505BLAgSh','execError'];a123_0x424e=function(){return _0x2f8c3f;};return a123_0x424e();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a123_0x4fd9(_0x3f3a57,_0x4d42ac){_0x3f3a57=_0x3f3a57-0x99;const _0x424e58=a123_0x424e();let _0x4fd987=_0x424e58[_0x3f3a57];return _0x4fd987;}export const sqlExec={'service':a123_0x2b836d(0x9c),'command':a123_0x2b836d(0xa7),'description':a123_0x2b836d(0x9f),'risk':a123_0x2b836d(0xb4),'flags':[SQLCODE_FLAG,{'name':a123_0x2b836d(0xb0),'type':a123_0x2b836d(0xac),'description':a123_0x2b836d(0xb3)}],async 'execute'(_0xd6bb1b){const _0x281d6e=a123_0x2b836d,_0xfc603e=parseJsonParams(_0xd6bb1b['str'](_0x281d6e(0xb0))),_0x6be6b0=Date[_0x281d6e(0xa5)](),_0x4c154f=await executeSql(_0xd6bb1b[_0x281d6e(0xae)],_0xd6bb1b[_0x281d6e(0xa9)](_0x281d6e(0xb1)),_0xfc603e),_0xcbeef0=Date['now']()-_0x6be6b0,_0x1ba4da=_0x4c154f?.[_0x281d6e(0x9d)]??_0x4c154f,_0x4eb4bb=_0x4c154f?.[_0x281d6e(0x99)]??!![];if(!_0x4eb4bb)return{'ok':![],'data':{'error':_0x4c154f?.[_0x281d6e(0xa4)]||_0x281d6e(0x9a),'elapsed':_0xcbeef0},'message':_0x281d6e(0x9a)};const _0x15cabc=Array[_0x281d6e(0xab)](_0x1ba4da)?_0x1ba4da:[];return{'ok':!![],'data':{'rows':_0x15cabc,'rowCount':_0x15cabc['length'],'elapsed':_0xcbeef0},'message':'Returned\x20'+_0x15cabc['length']+_0x281d6e(0xa1)+_0xcbeef0+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a124_0x4eca(_0x1470ff,_0x319d9a){_0x1470ff=_0x1470ff-0xa2;const _0x493d53=a124_0x493d();let _0x4eca0d=_0x493d53[_0x1470ff];return _0x4eca0d;}(function(_0x4b79f5,_0x1aa697){const _0x4b9b0b=a124_0x4eca,_0x11ff40=_0x4b79f5();while(!![]){try{const _0x54fb5e=-parseInt(_0x4b9b0b(0xa2))/0x1+-parseInt(_0x4b9b0b(0xa9))/0x2*(-parseInt(_0x4b9b0b(0xa7))/0x3)+-parseInt(_0x4b9b0b(0xa3))/0x4+parseInt(_0x4b9b0b(0xa5))/0x5*(-parseInt(_0x4b9b0b(0xa6))/0x6)+-parseInt(_0x4b9b0b(0xaa))/0x7+-parseInt(_0x4b9b0b(0xa4))/0x8+parseInt(_0x4b9b0b(0xa8))/0x9;if(_0x54fb5e===_0x1aa697)break;else _0x11ff40['push'](_0x11ff40['shift']());}catch(_0x4da4bc){_0x11ff40['push'](_0x11ff40['shift']());}}}(a124_0x493d,0x1d3bf));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a124_0x493d(){const _0x22b512=['161720RnFSdw','1139928rotpSh','325BzdrdT','6432risNyo','1080LlmFfM','4556529IZFGWg','740HJpWkO','269087rCcLRX','228696mPzQqL'];a124_0x493d=function(){return _0x22b512;};return a124_0x493d();}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
|
-
const
|
|
1
|
+
function a125_0x4aa0(_0x11ead3,_0x39b5b4){_0x11ead3=_0x11ead3-0x69;const _0x36d7de=a125_0x36d7();let _0x4aa003=_0x36d7de[_0x11ead3];return _0x4aa003;}const a125_0x267076=a125_0x4aa0;(function(_0x554191,_0x5c7f7f){const _0x119c46=a125_0x4aa0,_0x41a366=_0x554191();while(!![]){try{const _0x1e4218=parseInt(_0x119c46(0x6c))/0x1+-parseInt(_0x119c46(0x84))/0x2*(parseInt(_0x119c46(0x8f))/0x3)+parseInt(_0x119c46(0x82))/0x4*(-parseInt(_0x119c46(0x7d))/0x5)+parseInt(_0x119c46(0x7b))/0x6*(-parseInt(_0x119c46(0x7e))/0x7)+-parseInt(_0x119c46(0x75))/0x8*(-parseInt(_0x119c46(0x74))/0x9)+-parseInt(_0x119c46(0x6d))/0xa+parseInt(_0x119c46(0x8d))/0xb*(parseInt(_0x119c46(0x85))/0xc);if(_0x1e4218===_0x5c7f7f)break;else _0x41a366['push'](_0x41a366['shift']());}catch(_0x4963b8){_0x41a366['push'](_0x41a366['shift']());}}}(a125_0x36d7,0x32e4a));import{listSqlQueries}from'../../core/api-client.js';function a125_0x36d7(){const _0x38f5e4=['83430pyGzUF','155700VJmjYY','string','List\x20custom\x20SQL\x20queries','Page\x20number','sqlName','page','list','2736BQdswi','4184WvFMft','dbId','num','Found\x20','sql','name','9006WoasdM','appCode','15775eDjuUH','903AZJFHI','totalCount','tableData','bool','12eyRRWR','length','40536tPzuRR','96wohdbs','verbose','str','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','description','read','paging','Filter\x20by\x20SQL\x20name','281831IZQNlL','Page\x20size','3coevDd','No\x20custom\x20SQL\x20queries\x20found.','sqlCode','\x20SQL\x20queries\x20(total:\x20','pagesize','sqlcode','number','boolean'];a125_0x36d7=function(){return _0x38f5e4;};return a125_0x36d7();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a125_0x267076(0x79),'command':a125_0x267076(0x73),'description':a125_0x267076(0x6f),'risk':a125_0x267076(0x8a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a125_0x267076(0x7a),'type':a125_0x267076(0x6e),'description':a125_0x267076(0x8c)},{'name':a125_0x267076(0x72),'type':a125_0x267076(0x6a),'description':a125_0x267076(0x70),'default':0x1},{'name':'pagesize','type':a125_0x267076(0x6a),'description':a125_0x267076(0x8e)},{'name':a125_0x267076(0x86),'type':a125_0x267076(0x6b),'description':a125_0x267076(0x88)}],async 'execute'(_0x415479){const _0x4fee90=a125_0x267076,_0x5f40d4=await listSqlQueries(_0x415479['appCode'],{'sqlCode':_0x415479[_0x4fee90(0x87)](_0x4fee90(0x69))||undefined,'sqlName':_0x415479[_0x4fee90(0x87)](_0x4fee90(0x7a))||undefined,'currentPage':_0x415479[_0x4fee90(0x77)]('page'),'pageSize':_0x415479[_0x4fee90(0x77)](_0x4fee90(0x93),0x32)}),_0x567916=_0x415479[_0x4fee90(0x81)]('verbose'),_0x6c544a=_0x5f40d4[_0x4fee90(0x80)]??[],_0x3f9824=_0x5f40d4[_0x4fee90(0x8b)]?.[_0x4fee90(0x7f)]??_0x6c544a[_0x4fee90(0x83)];let _0x90dcc6;return _0x567916?_0x90dcc6=_0x6c544a:_0x90dcc6=await Promise['all'](_0x6c544a['map'](async _0x2132f8=>{const _0x461737=_0x4fee90;let _0x594b94;try{_0x594b94=_0x2132f8['dbId']?await getDbName(_0x415479[_0x461737(0x7c)],_0x2132f8[_0x461737(0x76)]):undefined;}catch{}return{'sqlCode':_0x2132f8[_0x461737(0x91)],'sqlName':_0x2132f8[_0x461737(0x71)],'description':_0x2132f8[_0x461737(0x89)]??'','db':_0x594b94?_0x594b94+'\x20('+_0x2132f8[_0x461737(0x76)]+')':_0x2132f8[_0x461737(0x76)]??''};})),{'ok':!![],'data':_0x90dcc6,'message':_0x6c544a[_0x4fee90(0x83)]===0x0?_0x4fee90(0x90):_0x4fee90(0x78)+_0x6c544a[_0x4fee90(0x83)]+_0x4fee90(0x92)+_0x3f9824+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a125_0x3d11ec=a125_0x75d5;(function(_0x3077ba,_0x568b85){const _0x1ebf2f=a125_0x75d5,_0x2aa5c1=_0x3077ba();while(!![]){try{const _0x3d04d2=-parseInt(_0x1ebf2f(0x118))/0x1*(-parseInt(_0x1ebf2f(0x134))/0x2)+parseInt(_0x1ebf2f(0x117))/0x3+parseInt(_0x1ebf2f(0x12f))/0x4*(-parseInt(_0x1ebf2f(0x120))/0x5)+parseInt(_0x1ebf2f(0x144))/0x6+-parseInt(_0x1ebf2f(0x114))/0x7*(-parseInt(_0x1ebf2f(0x11e))/0x8)+-parseInt(_0x1ebf2f(0x123))/0x9+-parseInt(_0x1ebf2f(0x12d))/0xa;if(_0x3d04d2===_0x568b85)break;else _0x2aa5c1['push'](_0x2aa5c1['shift']());}catch(_0x59a0ce){_0x2aa5c1['push'](_0x2aa5c1['shift']());}}}(a125_0x22b3,0x95f03));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a125_0x22b3(){const _0xd7f13c=['apps','Pull\x20complete:\x20','Would\x20pull\x20','dbId','totalCount','pull','toISOString','24612xQRdZH','skipped','unchanged','624924JeZsAy','3IOSYkX','sql','lockFilePath','sqls','sqlcode','replace','2408JOUyAI','filter','3062665CVnhha','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Filter\x20by\x20SQL\x20display\x20name','73134vizhdy','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','str','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlRootDir','\x20failed','conflict','\x20written,\x20','test','appCode','8264100plHIAC','local\x20differs\x20from\x20remote','4VMXrIr','path','catch','trimStart','sqlCode','406622JMNvma','\x20skipped,\x20','name','cancelled','utf8','sqlName','bool','\x20SQL\x20file(s)\x20into\x20','No\x20remote\x20SQL\x20queries\x20matched.','push','write','length','force','paging','sqlRoot','POST','1107954atVeHr','boolean'];a125_0x22b3=function(){return _0xd7f13c;};return a125_0x22b3();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';function a125_0x75d5(_0x5c4fcc,_0x1538d4){_0x5c4fcc=_0x5c4fcc-0x10d;const _0x22b38f=a125_0x22b3();let _0x75d5e5=_0x22b38f[_0x5c4fcc];return _0x75d5e5;}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(_0x3f3afc,_0x1c44c1){const _0x5adf5a=a125_0x75d5,_0x33f604=[];let _0x158dc8=0x1;while(!![]){const _0x4cbc29=await listSqlQueries(_0x3f3afc,{'currentPage':_0x158dc8,'pageSize':PAGE_SIZE,'sqlCode':_0x1c44c1[_0x5adf5a(0x133)],'sqlName':_0x1c44c1['sqlName']}),_0x1fad07=_0x4cbc29['tableData']??[];_0x33f604[_0x5adf5a(0x13d)](..._0x1fad07);if(_0x1fad07[_0x5adf5a(0x13f)]===0x0)break;const _0x1e7a8f=_0x4cbc29[_0x5adf5a(0x141)]?.[_0x5adf5a(0x111)];if(_0x1e7a8f!=null?_0x33f604['length']>=_0x1e7a8f:_0x1fad07[_0x5adf5a(0x13f)]<PAGE_SIZE)break;_0x158dc8++;}return _0x33f604;}async function ensureSqlContent(_0x13c8a4){const _0xcd9eea=a125_0x75d5;if(_0x13c8a4['sqlContent']!=null&&String(_0x13c8a4['sqlContent'])[_0xcd9eea(0x13f)]>0x0)return _0x13c8a4;return getSqlQueryDetail(_0x13c8a4[_0xcd9eea(0x133)]);}export const sqlPull={'service':a125_0x3d11ec(0x119),'command':a125_0x3d11ec(0x112),'description':a125_0x3d11ec(0x126),'risk':a125_0x3d11ec(0x13e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':'string','description':a125_0x3d11ec(0x122)},{'name':a125_0x3d11ec(0x140),'type':a125_0x3d11ec(0x145),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x200340){const _0x35d687=a125_0x3d11ec,_0x5ed846=loadSqlProjectConfig(_0x200340[_0x35d687(0x12c)]),_0x3cfba4=await readSqlLockFile(_0x5ed846[_0x35d687(0x11a)]),{appLock:_0x3599b2}=ensureSqlLockScope(_0x3cfba4??createEmptySqlLock(),_0x5ed846[_0x35d687(0x12c)],_0x5ed846[_0x35d687(0x142)],_0x35d687(0x112)),_0x4a21e0=await fetchAllSqlQueries(_0x200340[_0x35d687(0x12c)],{'sqlCode':_0x200340[_0x35d687(0x125)]('sqlcode')||undefined,'sqlName':_0x200340['str'](_0x35d687(0x136))||undefined}),_0x54b1b2=[];for(const _0x2896a3 of _0x4a21e0){const _0x33baed=await ensureSqlContent(_0x2896a3),_0x2598b6=ensureRemoteSqlContent(_0x33baed),_0x13ad04=detectModeFromSql(_0x33baed),_0x5da7bb=_0x33baed[_0x35d687(0x110)]?await getDbName(_0x200340[_0x35d687(0x12c)],Number(_0x33baed['dbId']))[_0x35d687(0x131)](()=>undefined):undefined,_0x34fade=buildLocalSqlFileContent({'sqlCode':_0x33baed[_0x35d687(0x133)],'sqlName':_0x33baed[_0x35d687(0x139)],'dbId':_0x33baed[_0x35d687(0x110)]},_0x2598b6,{'dbName':_0x5da7bb,'mode':_0x13ad04,'syncedAt':new Date()[_0x35d687(0x113)](),'description':_0x33baed['description']}),_0x28511e=buildSqlLockEntry(_0x33baed,_0x2598b6,'',{'dbName':_0x5da7bb}),_0xa58275=resolveLocalSqlFilePath(_0x5ed846,_0x33baed[_0x35d687(0x133)],_0x28511e);let _0x3b9b30='would_pull',_0x1b4aac;if(await fileExists(_0xa58275)){const _0x34487b=await readFile(_0xa58275,_0x35d687(0x138));isEquivalentPulledSqlFile(_0x34487b,_0x34fade,_0x13ad04)?(_0x3b9b30=_0x35d687(0x115),_0x1b4aac=_0x35d687(0x116)):(_0x3b9b30=_0x35d687(0x129),_0x1b4aac=_0x35d687(0x124));}_0x54b1b2['push']({'sqlCode':_0x33baed[_0x35d687(0x133)],'sqlName':_0x33baed[_0x35d687(0x139)],'filePath':_0xa58275,'status':_0x3b9b30,'reason':_0x1b4aac});}return{'method':_0x35d687(0x143),'url':_0x35d687(0x121),'body':{'appCode':_0x200340['appCode'],'sqlCode':_0x200340[_0x35d687(0x125)](_0x35d687(0x11c))||null,'sqlName':_0x200340[_0x35d687(0x125)](_0x35d687(0x136))||null,'files':_0x54b1b2},'description':_0x35d687(0x10f)+_0x54b1b2[_0x35d687(0x13f)]+_0x35d687(0x13b)+_0x5ed846['sqlRootDir']};},async 'execute'(_0x4d45f7){const _0x486853=a125_0x3d11ec,_0x3966bb=loadSqlProjectConfig(_0x4d45f7[_0x486853(0x12c)]),_0x3d75e7=await readSqlLockFile(_0x3966bb[_0x486853(0x11a)]),{lockData:_0x375050,appLock:_0x1efdeb}=ensureSqlLockScope(_0x3d75e7??createEmptySqlLock(),_0x3966bb[_0x486853(0x12c)],_0x3966bb[_0x486853(0x142)],'pull'),_0x1afcc2=_0x4d45f7[_0x486853(0x13a)](_0x486853(0x140)),_0x587f4b=await fetchAllSqlQueries(_0x4d45f7[_0x486853(0x12c)],{'sqlCode':_0x4d45f7[_0x486853(0x125)](_0x486853(0x11c))||undefined,'sqlName':_0x4d45f7[_0x486853(0x125)](_0x486853(0x136))||undefined});if(_0x587f4b[_0x486853(0x13f)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x486853(0x13c)};const _0x16eb06=[],_0x69ab76=[];for(const _0x22cbce of _0x587f4b){try{_0x16eb06['push'](await ensureSqlContent(_0x22cbce));}catch(_0x2c2132){_0x69ab76[_0x486853(0x13d)]({'sqlCode':_0x22cbce[_0x486853(0x133)],'error':_0x2c2132 instanceof Error?_0x2c2132['message']:String(_0x2c2132)});}}if(_0x1afcc2&&!_0x4d45f7['nonInteractive']){let _0x4e7f0e=![];for(const _0x4f88f7 of _0x16eb06){const _0x2d524b=detectModeFromSql(_0x4f88f7),_0x1abad3=_0x4f88f7['dbId']?await getDbName(_0x4d45f7[_0x486853(0x12c)],Number(_0x4f88f7[_0x486853(0x110)]))[_0x486853(0x131)](()=>undefined):undefined,_0x33f7ff=buildLocalSqlFileContent({'sqlCode':_0x4f88f7[_0x486853(0x133)],'sqlName':_0x4f88f7['sqlName'],'dbId':_0x4f88f7[_0x486853(0x110)]},ensureRemoteSqlContent(_0x4f88f7),{'dbName':_0x1abad3,'mode':_0x2d524b,'syncedAt':new Date()[_0x486853(0x113)](),'description':_0x4f88f7['description']}),_0x5568cd=resolveLocalSqlFilePath(_0x3966bb,_0x4f88f7[_0x486853(0x133)],buildSqlLockEntry(_0x4f88f7,ensureRemoteSqlContent(_0x4f88f7),'',{'dbName':_0x1abad3}));if(await fileExists(_0x5568cd)){const _0x581d06=await readFile(_0x5568cd,_0x486853(0x138));if(!isEquivalentPulledSqlFile(_0x581d06,_0x33f7ff,_0x2d524b)){_0x4e7f0e=!![];break;}}}if(_0x4e7f0e){const _0x1486f6=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1486f6)throw CliErrors[_0x486853(0x137)]('Force\x20pull\x20cancelled.');}}const _0x541bc5=cloneSqlLockData(_0x375050),_0x165141=_0x541bc5[_0x486853(0x10d)][_0x3966bb['appCode']],_0x374f1b=[],_0xe8ee1c=[];for(const _0x5971c6 of _0x16eb06){const _0x1c65e7=_0x165141[_0x486853(0x11b)][_0x5971c6[_0x486853(0x133)]],_0x4cba49=ensureRemoteSqlContent(_0x5971c6),_0x5c4a23=detectModeFromSql(_0x5971c6),_0x24da0e=_0x5971c6[_0x486853(0x110)]?await getDbName(_0x4d45f7['appCode'],Number(_0x5971c6[_0x486853(0x110)]))[_0x486853(0x131)](()=>undefined):undefined,_0x21253f=buildLocalSqlFileContent({'sqlCode':_0x5971c6[_0x486853(0x133)],'sqlName':_0x5971c6['sqlName'],'dbId':_0x5971c6['dbId']},_0x4cba49,{'dbName':_0x24da0e,'mode':_0x5c4a23,'syncedAt':new Date()[_0x486853(0x113)](),'description':_0x5971c6['description']}),_0x31a107=buildSqlLockEntry(_0x5971c6,_0x4cba49,computeSqlContentHash(_0x21253f),{'dbName':_0x24da0e}),_0x4d6bb3=_0x31a107[_0x486853(0x130)],_0x26b600=join(_0x3966bb['sqlRootDir'],_0x4d6bb3);try{if(await fileExists(_0x26b600)){const _0x3c5b8f=await readFile(_0x26b600,_0x486853(0x138));if(isEquivalentPulledSqlFile(_0x3c5b8f,_0x21253f,_0x5c4a23)){_0xe8ee1c[_0x486853(0x13d)]({'sqlCode':_0x5971c6[_0x486853(0x133)],'reason':'unchanged'}),_0x165141['sqls'][_0x5971c6[_0x486853(0x133)]]={..._0x31a107,'hash':computeSqlContentHash(_0x3c5b8f),'path':_0x4d6bb3};continue;}if(!_0x1afcc2){_0xe8ee1c['push']({'sqlCode':_0x5971c6[_0x486853(0x133)],'reason':_0x486853(0x12e)});continue;}}const _0x5a9b45=_0x1c65e7?.[_0x486853(0x130)]?join(_0x3966bb[_0x486853(0x127)],_0x1c65e7['path']):undefined;_0x5a9b45&&_0x5a9b45!==_0x26b600&&await fileExists(_0x5a9b45)&&await rm(_0x5a9b45,{'force':!![]}),await ensureParentDirectory(_0x26b600),await writeFile(_0x26b600,_0x21253f,'utf8'),_0x165141[_0x486853(0x11b)][_0x5971c6['sqlCode']]={..._0x31a107,'path':_0x4d6bb3},_0x374f1b[_0x486853(0x13d)]({'sqlCode':_0x5971c6[_0x486853(0x133)],'filePath':_0x26b600});}catch(_0x8cfeae){_0x69ab76[_0x486853(0x13d)]({'sqlCode':_0x5971c6[_0x486853(0x133)],'error':_0x8cfeae instanceof Error?_0x8cfeae['message']:String(_0x8cfeae)});}}return _0x165141['lastSync']=new Date()[_0x486853(0x113)](),await writeSqlLockFile(_0x3966bb[_0x486853(0x11a)],_0x541bc5),{'ok':_0x69ab76[_0x486853(0x13f)]===0x0,'data':{'pulled':_0x374f1b,'skipped':_0xe8ee1c,'failed':_0x69ab76},'message':_0x486853(0x10e)+_0x374f1b['length']+_0x486853(0x12a)+_0xe8ee1c[_0x486853(0x13f)]+_0x486853(0x135)+_0x69ab76[_0x486853(0x13f)]+_0x486853(0x128)};}};function detectModeFromSql(_0x258993){const _0x1dcef2=a125_0x3d11ec,_0x1906af=ensureRemoteSqlContent(_0x258993),_0x2978a2=stripLocalSqlMetadata(_0x1906af,'mybatisXml')[_0x1dcef2(0x132)]();if(/^<(select|insert|update|delete)\b/i[_0x1dcef2(0x12b)](_0x2978a2))return'mybatisXml';return'sql';}function isEquivalentPulledSqlFile(_0x514b0e,_0x25d8bf,_0x29f727){return normalizePullComparableContent(_0x514b0e,_0x29f727)===normalizePullComparableContent(_0x25d8bf,_0x29f727);}function normalizePullComparableContent(_0x41aaf0,_0x5ec9e3){const _0x150074=a125_0x3d11ec,_0x37f44f=_0x41aaf0[_0x150074(0x11d)](/\r\n/g,'\x0a')['split']('\x0a'),_0x5691c0=_0x37f44f[_0x150074(0x11f)](_0x35e6da=>!isSyncedAtMetadataLine(_0x35e6da,_0x5ec9e3));return _0x5691c0['join']('\x0a');}function isSyncedAtMetadataLine(_0x8ff1af,_0x498416){const _0x4c7fe4=a125_0x3d11ec;if(_0x498416==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4c7fe4(0x12b)](_0x8ff1af);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4c7fe4(0x12b)](_0x8ff1af);}
|
|
1
|
+
const a126_0xab83f6=a126_0x12dc;(function(_0x44eac1,_0x1899f1){const _0x57ece2=a126_0x12dc,_0x474684=_0x44eac1();while(!![]){try{const _0x469da0=-parseInt(_0x57ece2(0x9d))/0x1+-parseInt(_0x57ece2(0x90))/0x2+parseInt(_0x57ece2(0x9c))/0x3*(-parseInt(_0x57ece2(0xa3))/0x4)+parseInt(_0x57ece2(0x89))/0x5+parseInt(_0x57ece2(0xaa))/0x6+-parseInt(_0x57ece2(0x88))/0x7+parseInt(_0x57ece2(0xa4))/0x8*(parseInt(_0x57ece2(0x85))/0x9);if(_0x469da0===_0x1899f1)break;else _0x474684['push'](_0x474684['shift']());}catch(_0x256818){_0x474684['push'](_0x474684['shift']());}}}(a126_0x3f35,0x72f59));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a126_0x12dc(_0x5931a7,_0x2c02c7){_0x5931a7=_0x5931a7-0x7f;const _0x3f35e2=a126_0x3f35();let _0x12dca7=_0x3f35e2[_0x5931a7];return _0x12dca7;}import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a126_0x3f35(){const _0x19dcef=['sqlName','force','catch','tableData','297sOdGwH','toISOString','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','3695972IrLeht','2247195oXQlpY','\x20skipped,\x20','dbId','totalCount','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqlRootDir','conflict','936362fCzyJZ','boolean','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','write','description','sqls','string','cancelled','mybatisXml','push','str','length','9171Ykpnmc','568010hILPsZ','message','sqlCode','replace','Force\x20pull\x20cancelled.','lockFilePath','772CGRNoZ','432664TDLYmb','local\x20differs\x20from\x20remote','sqlcode','utf8','sqlRoot','appCode','2345298mUOScm','join','sqlContent','test','name','lastSync','Filter\x20by\x20SQL\x20display\x20name','path','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','apps','pull'];a126_0x3f35=function(){return _0x19dcef;};return a126_0x3f35();}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(_0x1d77cc,_0x479362){const _0xf1a373=a126_0x12dc,_0x2d4663=[];let _0xd05a05=0x1;while(!![]){const _0x524e1b=await listSqlQueries(_0x1d77cc,{'currentPage':_0xd05a05,'pageSize':PAGE_SIZE,'sqlCode':_0x479362[_0xf1a373(0x9f)],'sqlName':_0x479362[_0xf1a373(0x81)]}),_0x2bca25=_0x524e1b[_0xf1a373(0x84)]??[];_0x2d4663['push'](..._0x2bca25);if(_0x2bca25[_0xf1a373(0x9b)]===0x0)break;const _0xf0a802=_0x524e1b['paging']?.[_0xf1a373(0x8c)];if(_0xf0a802!=null?_0x2d4663['length']>=_0xf0a802:_0x2bca25[_0xf1a373(0x9b)]<PAGE_SIZE)break;_0xd05a05++;}return _0x2d4663;}async function ensureSqlContent(_0x227073){const _0x2b8131=a126_0x12dc;if(_0x227073['sqlContent']!=null&&String(_0x227073[_0x2b8131(0xac)])['length']>0x0)return _0x227073;return getSqlQueryDetail(_0x227073[_0x2b8131(0x9f)]);}export const sqlPull={'service':'sql','command':a126_0xab83f6(0x80),'description':a126_0xab83f6(0xb2),'risk':a126_0xab83f6(0x93),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a126_0xab83f6(0xae),'type':a126_0xab83f6(0x96),'description':a126_0xab83f6(0xb0)},{'name':a126_0xab83f6(0x82),'type':a126_0xab83f6(0x91),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x3e8575){const _0xb1b01f=a126_0xab83f6,_0x1266d4=loadSqlProjectConfig(_0x3e8575['appCode']),_0x324ffb=await readSqlLockFile(_0x1266d4['lockFilePath']),{appLock:_0x201a8a}=ensureSqlLockScope(_0x324ffb??createEmptySqlLock(),_0x1266d4['appCode'],_0x1266d4[_0xb1b01f(0xa8)],_0xb1b01f(0x80)),_0x43f1fa=await fetchAllSqlQueries(_0x3e8575[_0xb1b01f(0xa9)],{'sqlCode':_0x3e8575[_0xb1b01f(0x9a)](_0xb1b01f(0xa6))||undefined,'sqlName':_0x3e8575[_0xb1b01f(0x9a)](_0xb1b01f(0xae))||undefined}),_0x570394=[];for(const _0x3f938d of _0x43f1fa){const _0x300c87=await ensureSqlContent(_0x3f938d),_0x48ffbd=ensureRemoteSqlContent(_0x300c87),_0x5dc6de=detectModeFromSql(_0x300c87),_0x203572=_0x300c87[_0xb1b01f(0x8b)]?await getDbName(_0x3e8575[_0xb1b01f(0xa9)],Number(_0x300c87[_0xb1b01f(0x8b)]))[_0xb1b01f(0x83)](()=>undefined):undefined,_0x5174a0=buildLocalSqlFileContent({'sqlCode':_0x300c87[_0xb1b01f(0x9f)],'sqlName':_0x300c87[_0xb1b01f(0x81)],'dbId':_0x300c87[_0xb1b01f(0x8b)]},_0x48ffbd,{'dbName':_0x203572,'mode':_0x5dc6de,'syncedAt':new Date()[_0xb1b01f(0x86)](),'description':_0x300c87[_0xb1b01f(0x94)]}),_0x592f48=buildSqlLockEntry(_0x300c87,_0x48ffbd,'',{'dbName':_0x203572}),_0x806f29=resolveLocalSqlFilePath(_0x1266d4,_0x300c87[_0xb1b01f(0x9f)],_0x592f48);let _0x5218c6='would_pull',_0x24d955;if(await fileExists(_0x806f29)){const _0x15b93b=await readFile(_0x806f29,_0xb1b01f(0xa7));isEquivalentPulledSqlFile(_0x15b93b,_0x5174a0,_0x5dc6de)?(_0x5218c6='skipped',_0x24d955='unchanged'):(_0x5218c6=_0xb1b01f(0x8f),_0x24d955=_0xb1b01f(0x92));}_0x570394[_0xb1b01f(0x99)]({'sqlCode':_0x300c87[_0xb1b01f(0x9f)],'sqlName':_0x300c87[_0xb1b01f(0x81)],'filePath':_0x806f29,'status':_0x5218c6,'reason':_0x24d955});}return{'method':'POST','url':_0xb1b01f(0x87),'body':{'appCode':_0x3e8575['appCode'],'sqlCode':_0x3e8575['str'](_0xb1b01f(0xa6))||null,'sqlName':_0x3e8575[_0xb1b01f(0x9a)](_0xb1b01f(0xae))||null,'files':_0x570394},'description':'Would\x20pull\x20'+_0x570394[_0xb1b01f(0x9b)]+'\x20SQL\x20file(s)\x20into\x20'+_0x1266d4['sqlRootDir']};},async 'execute'(_0xd33bbd){const _0x30700e=a126_0xab83f6,_0x5848c8=loadSqlProjectConfig(_0xd33bbd['appCode']),_0x587364=await readSqlLockFile(_0x5848c8[_0x30700e(0xa2)]),{lockData:_0x2a90e7,appLock:_0x54d79b}=ensureSqlLockScope(_0x587364??createEmptySqlLock(),_0x5848c8['appCode'],_0x5848c8['sqlRoot'],_0x30700e(0x80)),_0x458df1=_0xd33bbd['bool'](_0x30700e(0x82)),_0x462e94=await fetchAllSqlQueries(_0xd33bbd[_0x30700e(0xa9)],{'sqlCode':_0xd33bbd[_0x30700e(0x9a)](_0x30700e(0xa6))||undefined,'sqlName':_0xd33bbd['str']('name')||undefined});if(_0x462e94[_0x30700e(0x9b)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x3fbd12=[],_0x237ca0=[];for(const _0x549041 of _0x462e94){try{_0x3fbd12['push'](await ensureSqlContent(_0x549041));}catch(_0x3a1d9f){_0x237ca0[_0x30700e(0x99)]({'sqlCode':_0x549041[_0x30700e(0x9f)],'error':_0x3a1d9f instanceof Error?_0x3a1d9f[_0x30700e(0x9e)]:String(_0x3a1d9f)});}}if(_0x458df1&&!_0xd33bbd['nonInteractive']){let _0x279b0b=![];for(const _0x1a00be of _0x3fbd12){const _0x1fefa1=detectModeFromSql(_0x1a00be),_0x5ade2e=_0x1a00be[_0x30700e(0x8b)]?await getDbName(_0xd33bbd[_0x30700e(0xa9)],Number(_0x1a00be[_0x30700e(0x8b)]))[_0x30700e(0x83)](()=>undefined):undefined,_0x3c2f5a=buildLocalSqlFileContent({'sqlCode':_0x1a00be[_0x30700e(0x9f)],'sqlName':_0x1a00be[_0x30700e(0x81)],'dbId':_0x1a00be[_0x30700e(0x8b)]},ensureRemoteSqlContent(_0x1a00be),{'dbName':_0x5ade2e,'mode':_0x1fefa1,'syncedAt':new Date()['toISOString'](),'description':_0x1a00be[_0x30700e(0x94)]}),_0x717bd1=resolveLocalSqlFilePath(_0x5848c8,_0x1a00be['sqlCode'],buildSqlLockEntry(_0x1a00be,ensureRemoteSqlContent(_0x1a00be),'',{'dbName':_0x5ade2e}));if(await fileExists(_0x717bd1)){const _0x3f327c=await readFile(_0x717bd1,'utf8');if(!isEquivalentPulledSqlFile(_0x3f327c,_0x3c2f5a,_0x1fefa1)){_0x279b0b=!![];break;}}}if(_0x279b0b){const _0x3fe4bf=await confirmForceOverwrite(_0x30700e(0x8d));if(!_0x3fe4bf)throw CliErrors[_0x30700e(0x97)](_0x30700e(0xa1));}}const _0x5e060f=cloneSqlLockData(_0x2a90e7),_0x561303=_0x5e060f[_0x30700e(0x7f)][_0x5848c8[_0x30700e(0xa9)]],_0x39607c=[],_0x5798d2=[];for(const _0x263e1f of _0x3fbd12){const _0x1b6d98=_0x561303['sqls'][_0x263e1f[_0x30700e(0x9f)]],_0x4d3979=ensureRemoteSqlContent(_0x263e1f),_0x57576e=detectModeFromSql(_0x263e1f),_0x483934=_0x263e1f[_0x30700e(0x8b)]?await getDbName(_0xd33bbd[_0x30700e(0xa9)],Number(_0x263e1f[_0x30700e(0x8b)]))[_0x30700e(0x83)](()=>undefined):undefined,_0x13f1a3=buildLocalSqlFileContent({'sqlCode':_0x263e1f[_0x30700e(0x9f)],'sqlName':_0x263e1f[_0x30700e(0x81)],'dbId':_0x263e1f[_0x30700e(0x8b)]},_0x4d3979,{'dbName':_0x483934,'mode':_0x57576e,'syncedAt':new Date()[_0x30700e(0x86)](),'description':_0x263e1f[_0x30700e(0x94)]}),_0xabbb35=buildSqlLockEntry(_0x263e1f,_0x4d3979,computeSqlContentHash(_0x13f1a3),{'dbName':_0x483934}),_0x2e933b=_0xabbb35[_0x30700e(0xb1)],_0x4a3aee=join(_0x5848c8[_0x30700e(0x8e)],_0x2e933b);try{if(await fileExists(_0x4a3aee)){const _0x30448a=await readFile(_0x4a3aee,'utf8');if(isEquivalentPulledSqlFile(_0x30448a,_0x13f1a3,_0x57576e)){_0x5798d2[_0x30700e(0x99)]({'sqlCode':_0x263e1f[_0x30700e(0x9f)],'reason':'unchanged'}),_0x561303[_0x30700e(0x95)][_0x263e1f[_0x30700e(0x9f)]]={..._0xabbb35,'hash':computeSqlContentHash(_0x30448a),'path':_0x2e933b};continue;}if(!_0x458df1){_0x5798d2[_0x30700e(0x99)]({'sqlCode':_0x263e1f[_0x30700e(0x9f)],'reason':_0x30700e(0xa5)});continue;}}const _0x3c87a0=_0x1b6d98?.['path']?join(_0x5848c8[_0x30700e(0x8e)],_0x1b6d98[_0x30700e(0xb1)]):undefined;_0x3c87a0&&_0x3c87a0!==_0x4a3aee&&await fileExists(_0x3c87a0)&&await rm(_0x3c87a0,{'force':!![]}),await ensureParentDirectory(_0x4a3aee),await writeFile(_0x4a3aee,_0x13f1a3,_0x30700e(0xa7)),_0x561303['sqls'][_0x263e1f[_0x30700e(0x9f)]]={..._0xabbb35,'path':_0x2e933b},_0x39607c[_0x30700e(0x99)]({'sqlCode':_0x263e1f['sqlCode'],'filePath':_0x4a3aee});}catch(_0x53c781){_0x237ca0[_0x30700e(0x99)]({'sqlCode':_0x263e1f['sqlCode'],'error':_0x53c781 instanceof Error?_0x53c781[_0x30700e(0x9e)]:String(_0x53c781)});}}return _0x561303[_0x30700e(0xaf)]=new Date()[_0x30700e(0x86)](),await writeSqlLockFile(_0x5848c8[_0x30700e(0xa2)],_0x5e060f),{'ok':_0x237ca0[_0x30700e(0x9b)]===0x0,'data':{'pulled':_0x39607c,'skipped':_0x5798d2,'failed':_0x237ca0},'message':'Pull\x20complete:\x20'+_0x39607c['length']+'\x20written,\x20'+_0x5798d2[_0x30700e(0x9b)]+_0x30700e(0x8a)+_0x237ca0[_0x30700e(0x9b)]+'\x20failed'};}};function detectModeFromSql(_0x3452bd){const _0x287dd8=a126_0xab83f6,_0x5d497e=ensureRemoteSqlContent(_0x3452bd),_0x2bcd43=stripLocalSqlMetadata(_0x5d497e,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x287dd8(0xad)](_0x2bcd43))return _0x287dd8(0x98);return'sql';}function isEquivalentPulledSqlFile(_0x1592a2,_0x17ce10,_0x133db2){return normalizePullComparableContent(_0x1592a2,_0x133db2)===normalizePullComparableContent(_0x17ce10,_0x133db2);}function normalizePullComparableContent(_0x38c227,_0x284f6b){const _0x3416e6=a126_0xab83f6,_0x110c4e=_0x38c227[_0x3416e6(0xa0)](/\r\n/g,'\x0a')['split']('\x0a'),_0x55ca16=_0x110c4e['filter'](_0x596285=>!isSyncedAtMetadataLine(_0x596285,_0x284f6b));return _0x55ca16[_0x3416e6(0xab)]('\x0a');}function isSyncedAtMetadataLine(_0x52efdc,_0x2c5982){if(_0x2c5982==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x52efdc);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x52efdc);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a126_0x5723fd=a126_0x4277;(function(_0x19ca59,_0x3e6d30){const _0x2ff840=a126_0x4277,_0x4d0f2c=_0x19ca59();while(!![]){try{const _0x3d07cc=-parseInt(_0x2ff840(0x118))/0x1+parseInt(_0x2ff840(0xe4))/0x2+parseInt(_0x2ff840(0xf4))/0x3+-parseInt(_0x2ff840(0xf2))/0x4+-parseInt(_0x2ff840(0xf3))/0x5+parseInt(_0x2ff840(0xfb))/0x6*(-parseInt(_0x2ff840(0x108))/0x7)+parseInt(_0x2ff840(0x10f))/0x8;if(_0x3d07cc===_0x3e6d30)break;else _0x4d0f2c['push'](_0x4d0f2c['shift']());}catch(_0x39af15){_0x4d0f2c['push'](_0x4d0f2c['shift']());}}}(a126_0x10ec,0x94a18));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';function a126_0x4277(_0x61b4e1,_0x52f506){_0x61b4e1=_0x61b4e1-0xe1;const _0x10ec57=a126_0x10ec();let _0x4277a3=_0x10ec57[_0x61b4e1];return _0x4277a3;}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(_0x7301bf,_0x18e189,_0x5894e1){const _0x128d53=a126_0x4277,_0x253459=await scanLocalSqlQueries(_0x7301bf),_0xf99b3b=new Map();for(const _0x1df4b3 of _0x253459){if(_0x5894e1&&_0x1df4b3[_0x128d53(0x10c)]!==_0x5894e1)continue;const _0x25d4cc=_0xf99b3b[_0x128d53(0x113)](_0x1df4b3[_0x128d53(0x10c)])??[];_0x25d4cc[_0x128d53(0x107)](_0x1df4b3),_0xf99b3b[_0x128d53(0x117)](_0x1df4b3['sqlCode'],_0x25d4cc);}if(_0x5894e1&&!_0xf99b3b[_0x128d53(0xf0)](_0x5894e1))throw CliErrors[_0x128d53(0x102)](_0x128d53(0x11e)+_0x5894e1);const _0x355886=[];for(const [_0x4abafe,_0xee18b8]of _0xf99b3b['entries']()){if(_0xee18b8[_0x128d53(0xf6)]===0x1){_0x355886[_0x128d53(0x107)](_0xee18b8[0x0]);continue;}const _0x266e98=_0x18e189[_0x128d53(0x122)][_0x4abafe],_0x1505d9=_0x266e98?.[_0x128d53(0xe1)],_0x515183=_0x1505d9?_0xee18b8[_0x128d53(0xed)](_0x1548c9=>_0x1548c9['relativePath']!==_0x1505d9):_0xee18b8;if(_0x266e98&&_0x515183[_0x128d53(0xf6)]===0x1){_0x355886['push'](_0x515183[0x0]);continue;}throw CliErrors[_0x128d53(0x102)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x4abafe+_0x128d53(0x104));}return _0x355886;}export const sqlPush={'service':a126_0x5723fd(0xfd),'command':'push','description':a126_0x5723fd(0x106),'risk':a126_0x5723fd(0xe8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a126_0x5723fd(0xe9),'type':a126_0x5723fd(0x11f),'description':a126_0x5723fd(0x11c)}],async 'dryRun'(_0x4760c3){const _0x33b33d=a126_0x5723fd,_0x23c322=loadSqlProjectConfig(_0x4760c3[_0x33b33d(0x10d)]),_0x4d8fa2=await readSqlLockFile(_0x23c322[_0x33b33d(0xee)]),{appLock:_0x166d60}=ensureSqlLockScope(_0x4d8fa2??createEmptySqlLock(),_0x4760c3[_0x33b33d(0x10d)],_0x23c322[_0x33b33d(0x100)],_0x33b33d(0x107)),_0x16d4a2=await getTargetSqlQueries(_0x23c322,_0x166d60,_0x4760c3['str']('sqlcode')||undefined),_0x3a7165=[];for(const _0x9e5979 of _0x16d4a2){const _0x4522ba=await computeSqlFileHash(_0x9e5979[_0x33b33d(0x116)]),_0x651d1e=_0x166d60[_0x33b33d(0x122)][_0x9e5979[_0x33b33d(0x10c)]],_0x4531f9=!!_0x651d1e&&(_0x651d1e[_0x33b33d(0xe1)]!==_0x9e5979['relativePath']||!!_0x9e5979['sqlName']&&_0x651d1e[_0x33b33d(0xe6)]!==_0x9e5979[_0x33b33d(0xe6)]);if(!_0x4760c3['bool'](_0x33b33d(0xe9))&&_0x651d1e&&_0x651d1e['hash']===_0x4522ba&&!_0x4531f9)continue;_0x3a7165['push'](_0x9e5979['sqlCode']);}return{'method':_0x33b33d(0x112),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x3a7165,'appCode':_0x4760c3[_0x33b33d(0x10d)]},'description':_0x33b33d(0xea)+_0x3a7165[_0x33b33d(0xf6)]+_0x33b33d(0x11b)};},async 'execute'(_0x5587a8){const _0x1cb0f7=a126_0x5723fd,_0x5daab6=loadSqlProjectConfig(_0x5587a8[_0x1cb0f7(0x10d)]),_0x13d435=await readSqlLockFile(_0x5daab6[_0x1cb0f7(0xee)]),{lockData:_0x55355f,appLock:_0x2f9f06}=ensureSqlLockScope(_0x13d435??createEmptySqlLock(),_0x5587a8[_0x1cb0f7(0x10d)],_0x5daab6[_0x1cb0f7(0x100)],'push'),_0xce4e58=await getTargetSqlQueries(_0x5daab6,_0x2f9f06,_0x5587a8[_0x1cb0f7(0xfe)](_0x1cb0f7(0xec))||undefined);if(_0xce4e58[_0x1cb0f7(0xf6)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x377e8d=[],_0x5170d6=[],_0x4d3b28=[];for(const _0x539dfb of _0xce4e58){const _0x347235=_0x2f9f06[_0x1cb0f7(0x122)][_0x539dfb['sqlCode']];if(!_0x347235){_0x4d3b28[_0x1cb0f7(0x107)]({'sqlCode':_0x539dfb[_0x1cb0f7(0x10c)],'error':_0x1cb0f7(0xe2)});continue;}try{const _0x506333=await computeSqlFileHash(_0x539dfb[_0x1cb0f7(0x116)]),_0x25dc90=_0x347235[_0x1cb0f7(0xe1)]!==_0x539dfb[_0x1cb0f7(0xff)]||!!_0x539dfb[_0x1cb0f7(0xe6)]&&_0x347235['sqlName']!==_0x539dfb['sqlName'];if(!_0x5587a8[_0x1cb0f7(0x110)](_0x1cb0f7(0xe9))&&_0x347235['hash']===_0x506333&&!_0x25dc90){_0x5170d6[_0x1cb0f7(0x107)]({'sqlCode':_0x539dfb[_0x1cb0f7(0x10c)],'reason':_0x1cb0f7(0x109)});continue;}if(_0x347235[_0x1cb0f7(0x11a)]==null){_0x4d3b28[_0x1cb0f7(0x107)]({'sqlCode':_0x539dfb[_0x1cb0f7(0x10c)],'error':_0x1cb0f7(0x121)});continue;}const _0x2dda41=await readFile(_0x539dfb['filePath'],_0x1cb0f7(0x11d)),_0x573241=stripLocalSqlMetadata(_0x2dda41,_0x539dfb[_0x1cb0f7(0xe5)]),_0x498ba4=_0x539dfb[_0x1cb0f7(0xe6)]||_0x347235[_0x1cb0f7(0xe6)],_0x3eb5b1=await resolveTargetDbBinding(_0x5587a8[_0x1cb0f7(0x10d)],_0x539dfb,_0x347235),_0xe600f8=await updateSqlQuery({'id':_0x347235[_0x1cb0f7(0x114)],'appCode':_0x5587a8[_0x1cb0f7(0x10d)],'sqlCode':_0x539dfb[_0x1cb0f7(0x10c)],'sqlName':_0x498ba4,'dbId':_0x3eb5b1[_0x1cb0f7(0x111)],'version':_0x347235[_0x1cb0f7(0x11a)],'sqlContent':_0x573241,'sqlConfig':_0x347235[_0x1cb0f7(0x103)]??undefined}),_0x46b116=_0xe600f8[_0x1cb0f7(0x111)]?await getDbName(_0x5587a8['appCode'],Number(_0xe600f8[_0x1cb0f7(0x111)]))[_0x1cb0f7(0x115)](()=>_0x3eb5b1[_0x1cb0f7(0xeb)]):_0x3eb5b1[_0x1cb0f7(0xeb)];_0x2f9f06['sqls'][_0x539dfb['sqlCode']]={...buildSqlLockEntry(_0xe600f8,_0x573241,_0x506333,{'dbName':_0x46b116}),'path':_0x539dfb[_0x1cb0f7(0xff)],'mode':_0x347235[_0x1cb0f7(0xe5)]},await archivePreviousSqlFileIfNeeded(_0x5daab6,_0x347235['path'],_0x539dfb[_0x1cb0f7(0xff)]),_0x377e8d['push']({'sqlCode':_0x539dfb['sqlCode'],'remoteId':_0x347235[_0x1cb0f7(0x114)]});}catch(_0x40e580){_0x4d3b28[_0x1cb0f7(0x107)]({'sqlCode':_0x539dfb[_0x1cb0f7(0x10c)],'error':_0x40e580 instanceof Error?_0x40e580[_0x1cb0f7(0x119)]:String(_0x40e580)});}}return _0x2f9f06[_0x1cb0f7(0xfa)]=new Date()[_0x1cb0f7(0x101)](),await writeSqlLockFile(_0x5daab6[_0x1cb0f7(0xee)],_0x55355f),{'ok':_0x4d3b28[_0x1cb0f7(0xf6)]===0x0,'data':{'pushed':_0x377e8d,'skipped':_0x5170d6,'failed':_0x4d3b28},'message':_0x1cb0f7(0xf7)+_0x377e8d['length']+_0x1cb0f7(0xf1)+_0x5170d6[_0x1cb0f7(0xf6)]+'\x20skipped,\x20'+_0x4d3b28[_0x1cb0f7(0xf6)]+_0x1cb0f7(0xf5)};}};async function archivePreviousSqlFileIfNeeded(_0x45894e,_0x57f0e4,_0x1385cb){const _0x5151dc=a126_0x5723fd;if(!_0x57f0e4||_0x57f0e4===_0x1385cb)return;const _0xe32531=join(_0x45894e['sqlRootDir'],_0x57f0e4);if(!await fileExists(_0xe32531))return;const _0x239562=await moveToTrash(_0x45894e['projectRoot'],_0x45894e[_0x5151dc(0x10b)],_0xe32531);await cleanupEmptyDirectories(dirname(_0xe32531),_0x45894e[_0x5151dc(0xf8)]),void _0x239562;}async function moveToTrash(_0x306862,_0x427b55,_0x3eb803){const _0x5078a3=a126_0x5723fd,_0x52f8db=new Date()[_0x5078a3(0x101)]()[_0x5078a3(0x120)](/[:.]/g,'-'),_0x2d754f=relative(_0x306862,_0x3eb803),_0x229032=join(_0x427b55,_0x52f8db,_0x2d754f);return await mkdir(dirname(_0x229032),{'recursive':!![]}),await rename(_0x3eb803,_0x229032),_0x229032;}function a126_0x10ec(){const _0x3b0d7f=['.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','exec','Push\x20local\x20SQL\x20files\x20to\x20remote','push','42QgwpYT','unchanged','No\x20database\x20matches\x20local\x20directory\x20\x22','trashDir','sqlCode','appCode','isFinite','8060888cTdMUQ','bool','dbId','POST','get','remoteId','catch','filePath','set','574695qhPJmC','message','version','\x20SQL\x20file(s)','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','utf8','Local\x20SQL\x20not\x20found:\x20','boolean','replace','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqls','path','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbDirectory','2073254fOWbAV','mode','sqlName','map','high-risk-write','force','Would\x20push\x20','dbName','sqlcode','filter','lockFilePath','\x22\x20for\x20sqlCode\x20','has','\x20pushed,\x20','2171180IpaycE','918075SMrAZw','1866723vlKMGk','\x20failed','length','Push\x20complete:\x20','sqlRootDir','startsWith','lastSync','756582ICHNYB','join','sql','str','relativePath','sqlRoot','toISOString','validation','sqlConfig'];a126_0x10ec=function(){return _0x3b0d7f;};return a126_0x10ec();}async function cleanupEmptyDirectories(_0x3d4219,_0x3512fe){const _0x2fb236=a126_0x5723fd;let _0x2c023c=resolve(_0x3d4219);const _0x155e72=resolve(_0x3512fe);while(_0x2c023c[_0x2fb236(0xf9)](''+_0x155e72+sep)||_0x2c023c===_0x155e72){if(_0x2c023c===_0x155e72)return;try{const _0x1ee84c=await readdir(_0x2c023c);if(_0x1ee84c['length']>0x0)return;await rmdir(_0x2c023c);}catch{return;}_0x2c023c=dirname(_0x2c023c);}}async function resolveTargetDbBinding(_0x48ead5,_0x37e4dc,_0x15704d){const _0x20a47a=a126_0x5723fd,_0x456e14=_0x37e4dc[_0x20a47a(0xe3)];if(!_0x456e14)return{'dbId':_0x15704d[_0x20a47a(0x111)],'dbName':_0x15704d['dbName']};const _0xd23dc4=buildDbDirectoryName(_0x15704d['dbName'],_0x15704d[_0x20a47a(0x111)]);if(_0x456e14===_0xd23dc4)return{'dbId':_0x15704d[_0x20a47a(0x111)],'dbName':_0x15704d[_0x20a47a(0xeb)]};const _0x5de247=parseExplicitDbDirectory(_0x456e14);if(_0x5de247!=null)return{'dbId':_0x5de247,'dbName':await getDbName(_0x48ead5,_0x5de247)[_0x20a47a(0x115)](()=>undefined)};const _0x3c479d=await listDatabases(_0x48ead5),_0x5f541d=_0x3c479d['filter'](_0x4c02cb=>buildDbDirectoryName(_0x4c02cb[_0x20a47a(0xeb)],_0x4c02cb['dbId'])===_0x456e14);if(_0x5f541d[_0x20a47a(0xf6)]===0x1)return{'dbId':_0x5f541d[0x0][_0x20a47a(0x111)],'dbName':_0x5f541d[0x0][_0x20a47a(0xeb)]};if(_0x5f541d[_0x20a47a(0xf6)]===0x0)throw CliErrors[_0x20a47a(0x102)](_0x20a47a(0x10a)+_0x456e14+_0x20a47a(0xef)+_0x37e4dc['sqlCode']+'.');const _0x464272=_0x5f541d[_0x20a47a(0xe7)](_0x3c74af=>_0x3c74af[_0x20a47a(0xeb)]+'\x20('+_0x3c74af[_0x20a47a(0x111)]+')')[_0x20a47a(0xfc)](',\x20');throw CliErrors[_0x20a47a(0x102)]('Local\x20directory\x20\x22'+_0x456e14+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x37e4dc[_0x20a47a(0x10c)]+':\x20'+_0x464272);}function parseExplicitDbDirectory(_0x1d93ee){const _0x531962=a126_0x5723fd,_0x203f2b=/^db-(\d+)$/[_0x531962(0x105)](_0x1d93ee);if(!_0x203f2b)return null;const _0x43dbc6=Number(_0x203f2b[0x1]);return Number[_0x531962(0x10e)](_0x43dbc6)&&_0x43dbc6>0x0?_0x43dbc6:null;}
|
|
1
|
+
const a127_0x4d9fa9=a127_0x1956;(function(_0x2a2886,_0x1b0f65){const _0x1c32ed=a127_0x1956,_0xdd75d=_0x2a2886();while(!![]){try{const _0x263d86=-parseInt(_0x1c32ed(0x144))/0x1*(parseInt(_0x1c32ed(0x14f))/0x2)+-parseInt(_0x1c32ed(0x169))/0x3*(parseInt(_0x1c32ed(0x171))/0x4)+parseInt(_0x1c32ed(0x13b))/0x5*(parseInt(_0x1c32ed(0x161))/0x6)+-parseInt(_0x1c32ed(0x15c))/0x7*(-parseInt(_0x1c32ed(0x142))/0x8)+-parseInt(_0x1c32ed(0x133))/0x9*(parseInt(_0x1c32ed(0x14e))/0xa)+parseInt(_0x1c32ed(0x151))/0xb*(-parseInt(_0x1c32ed(0x14c))/0xc)+parseInt(_0x1c32ed(0x163))/0xd;if(_0x263d86===_0x1b0f65)break;else _0xdd75d['push'](_0xdd75d['shift']());}catch(_0x2b1ad4){_0xdd75d['push'](_0xdd75d['shift']());}}}(a127_0x83ea,0x53b85));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a127_0x83ea(){const _0x205b61=['remoteId','sqlCode','push','length','dbName','993XAyjUF','trashDir','replace','projectRoot','filter','sqlRoot','Push\x20complete:\x20','Would\x20push\x20','3868hrKTaF','exec','sqlName','\x20SQL\x20file(s)','508779zUnwTT','isFinite','\x20skipped,\x20','path','bool','has','join','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','35cqttvS','hash','/smartapi/custom/updateUserCustomSql','map','\x20failed','No\x20database\x20matches\x20local\x20directory\x20\x22','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','1092008TaaDBR','lockFilePath','431kvoYSU','utf8','sqlRootDir','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqls','sqlConfig','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','str','84tIJCbn','appCode','80BpFdoW','2282TIPQoI','POST','492877iVJOBU','sqlcode','get','\x20pushed,\x20','startsWith','force','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','relativePath','version','set','filePath','7PxVDeX','validation','toISOString','sql','dbId','434874HNCPam','mode','16598504aWeBZJ'];a127_0x83ea=function(){return _0x205b61;};return a127_0x83ea();}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';function a127_0x1956(_0x3d5225,_0x3bf40f){_0x3d5225=_0x3d5225-0x131;const _0x83ea6=a127_0x83ea();let _0x195688=_0x83ea6[_0x3d5225];return _0x195688;}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(_0x1e5e44,_0x3bc290,_0x24b38a){const _0x1a8aa2=a127_0x1956,_0x4cc198=await scanLocalSqlQueries(_0x1e5e44),_0x59eea7=new Map();for(const _0x517bab of _0x4cc198){if(_0x24b38a&&_0x517bab[_0x1a8aa2(0x165)]!==_0x24b38a)continue;const _0x4d6ef6=_0x59eea7[_0x1a8aa2(0x153)](_0x517bab[_0x1a8aa2(0x165)])??[];_0x4d6ef6['push'](_0x517bab),_0x59eea7[_0x1a8aa2(0x15a)](_0x517bab[_0x1a8aa2(0x165)],_0x4d6ef6);}if(_0x24b38a&&!_0x59eea7[_0x1a8aa2(0x138)](_0x24b38a))throw CliErrors[_0x1a8aa2(0x15d)]('Local\x20SQL\x20not\x20found:\x20'+_0x24b38a);const _0x20d65b=[];for(const [_0x39223a,_0x1cfb24]of _0x59eea7['entries']()){if(_0x1cfb24[_0x1a8aa2(0x167)]===0x1){_0x20d65b[_0x1a8aa2(0x166)](_0x1cfb24[0x0]);continue;}const _0xfe6d35=_0x3bc290[_0x1a8aa2(0x148)][_0x39223a],_0x1b4dd3=_0xfe6d35?.['path'],_0x3d181e=_0x1b4dd3?_0x1cfb24[_0x1a8aa2(0x16d)](_0x1130fb=>_0x1130fb[_0x1a8aa2(0x158)]!==_0x1b4dd3):_0x1cfb24;if(_0xfe6d35&&_0x3d181e[_0x1a8aa2(0x167)]===0x1){_0x20d65b[_0x1a8aa2(0x166)](_0x3d181e[0x0]);continue;}throw CliErrors[_0x1a8aa2(0x15d)](_0x1a8aa2(0x13a)+_0x39223a+_0x1a8aa2(0x157));}return _0x20d65b;}export const sqlPush={'service':a127_0x4d9fa9(0x15f),'command':a127_0x4d9fa9(0x166),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a127_0x4d9fa9(0x147)}],async 'dryRun'(_0x4bc7e7){const _0x9228e=a127_0x4d9fa9,_0x4871c0=loadSqlProjectConfig(_0x4bc7e7[_0x9228e(0x14d)]),_0x3aea27=await readSqlLockFile(_0x4871c0['lockFilePath']),{appLock:_0x45f756}=ensureSqlLockScope(_0x3aea27??createEmptySqlLock(),_0x4bc7e7[_0x9228e(0x14d)],_0x4871c0['sqlRoot'],_0x9228e(0x166)),_0x51b2dc=await getTargetSqlQueries(_0x4871c0,_0x45f756,_0x4bc7e7[_0x9228e(0x14b)](_0x9228e(0x152))||undefined),_0x208764=[];for(const _0x54aade of _0x51b2dc){const _0x1a935c=await computeSqlFileHash(_0x54aade[_0x9228e(0x15b)]),_0x4af8da=_0x45f756[_0x9228e(0x148)][_0x54aade[_0x9228e(0x165)]],_0x3c46bc=!!_0x4af8da&&(_0x4af8da[_0x9228e(0x136)]!==_0x54aade['relativePath']||!!_0x54aade[_0x9228e(0x131)]&&_0x4af8da['sqlName']!==_0x54aade[_0x9228e(0x131)]);if(!_0x4bc7e7[_0x9228e(0x137)](_0x9228e(0x156))&&_0x4af8da&&_0x4af8da[_0x9228e(0x13c)]===_0x1a935c&&!_0x3c46bc)continue;_0x208764[_0x9228e(0x166)](_0x54aade[_0x9228e(0x165)]);}return{'method':_0x9228e(0x150),'url':_0x9228e(0x13d),'body':{'sqlCodes':_0x208764,'appCode':_0x4bc7e7[_0x9228e(0x14d)]},'description':_0x9228e(0x170)+_0x208764[_0x9228e(0x167)]+_0x9228e(0x132)};},async 'execute'(_0x438320){const _0x37f7bb=a127_0x4d9fa9,_0x32c2af=loadSqlProjectConfig(_0x438320[_0x37f7bb(0x14d)]),_0x452a1e=await readSqlLockFile(_0x32c2af[_0x37f7bb(0x143)]),{lockData:_0x43faaf,appLock:_0x10886a}=ensureSqlLockScope(_0x452a1e??createEmptySqlLock(),_0x438320[_0x37f7bb(0x14d)],_0x32c2af[_0x37f7bb(0x16e)],_0x37f7bb(0x166)),_0x20fe39=await getTargetSqlQueries(_0x32c2af,_0x10886a,_0x438320[_0x37f7bb(0x14b)]('sqlcode')||undefined);if(_0x20fe39[_0x37f7bb(0x167)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x1371d5=[],_0x2cd18a=[],_0x261130=[];for(const _0x247a7a of _0x20fe39){const _0x21726b=_0x10886a[_0x37f7bb(0x148)][_0x247a7a[_0x37f7bb(0x165)]];if(!_0x21726b){_0x261130[_0x37f7bb(0x166)]({'sqlCode':_0x247a7a['sqlCode'],'error':_0x37f7bb(0x14a)});continue;}try{const _0x1c1583=await computeSqlFileHash(_0x247a7a[_0x37f7bb(0x15b)]),_0x165815=_0x21726b[_0x37f7bb(0x136)]!==_0x247a7a['relativePath']||!!_0x247a7a[_0x37f7bb(0x131)]&&_0x21726b[_0x37f7bb(0x131)]!==_0x247a7a[_0x37f7bb(0x131)];if(!_0x438320['bool']('force')&&_0x21726b[_0x37f7bb(0x13c)]===_0x1c1583&&!_0x165815){_0x2cd18a[_0x37f7bb(0x166)]({'sqlCode':_0x247a7a[_0x37f7bb(0x165)],'reason':'unchanged'});continue;}if(_0x21726b[_0x37f7bb(0x159)]==null){_0x261130['push']({'sqlCode':_0x247a7a[_0x37f7bb(0x165)],'error':_0x37f7bb(0x141)});continue;}const _0x367337=await readFile(_0x247a7a['filePath'],_0x37f7bb(0x145)),_0x294843=stripLocalSqlMetadata(_0x367337,_0x247a7a[_0x37f7bb(0x162)]),_0x930af7=_0x247a7a[_0x37f7bb(0x131)]||_0x21726b[_0x37f7bb(0x131)],_0x10823f=await resolveTargetDbBinding(_0x438320[_0x37f7bb(0x14d)],_0x247a7a,_0x21726b),_0x483428=await updateSqlQuery({'id':_0x21726b[_0x37f7bb(0x164)],'appCode':_0x438320[_0x37f7bb(0x14d)],'sqlCode':_0x247a7a[_0x37f7bb(0x165)],'sqlName':_0x930af7,'dbId':_0x10823f['dbId'],'version':_0x21726b['version'],'sqlContent':_0x294843,'sqlConfig':_0x21726b[_0x37f7bb(0x149)]??undefined}),_0x25c35c=_0x483428[_0x37f7bb(0x160)]?await getDbName(_0x438320[_0x37f7bb(0x14d)],Number(_0x483428['dbId']))['catch'](()=>_0x10823f[_0x37f7bb(0x168)]):_0x10823f[_0x37f7bb(0x168)];_0x10886a[_0x37f7bb(0x148)][_0x247a7a[_0x37f7bb(0x165)]]={...buildSqlLockEntry(_0x483428,_0x294843,_0x1c1583,{'dbName':_0x25c35c}),'path':_0x247a7a[_0x37f7bb(0x158)],'mode':_0x21726b[_0x37f7bb(0x162)]},await archivePreviousSqlFileIfNeeded(_0x32c2af,_0x21726b[_0x37f7bb(0x136)],_0x247a7a[_0x37f7bb(0x158)]),_0x1371d5[_0x37f7bb(0x166)]({'sqlCode':_0x247a7a[_0x37f7bb(0x165)],'remoteId':_0x21726b[_0x37f7bb(0x164)]});}catch(_0x7b2eff){_0x261130['push']({'sqlCode':_0x247a7a['sqlCode'],'error':_0x7b2eff instanceof Error?_0x7b2eff['message']:String(_0x7b2eff)});}}return _0x10886a['lastSync']=new Date()[_0x37f7bb(0x15e)](),await writeSqlLockFile(_0x32c2af[_0x37f7bb(0x143)],_0x43faaf),{'ok':_0x261130['length']===0x0,'data':{'pushed':_0x1371d5,'skipped':_0x2cd18a,'failed':_0x261130},'message':_0x37f7bb(0x16f)+_0x1371d5[_0x37f7bb(0x167)]+_0x37f7bb(0x154)+_0x2cd18a[_0x37f7bb(0x167)]+_0x37f7bb(0x135)+_0x261130[_0x37f7bb(0x167)]+_0x37f7bb(0x13f)};}};async function archivePreviousSqlFileIfNeeded(_0x5d7f83,_0x1b05d7,_0x4e748a){const _0x515d7f=a127_0x4d9fa9;if(!_0x1b05d7||_0x1b05d7===_0x4e748a)return;const _0x3b49c1=join(_0x5d7f83[_0x515d7f(0x146)],_0x1b05d7);if(!await fileExists(_0x3b49c1))return;const _0x78c716=await moveToTrash(_0x5d7f83[_0x515d7f(0x16c)],_0x5d7f83[_0x515d7f(0x16a)],_0x3b49c1);await cleanupEmptyDirectories(dirname(_0x3b49c1),_0x5d7f83['sqlRootDir']),void _0x78c716;}async function moveToTrash(_0x4c8fd4,_0x40746e,_0x1394a5){const _0x5082ac=a127_0x4d9fa9,_0x301bbb=new Date()[_0x5082ac(0x15e)]()[_0x5082ac(0x16b)](/[:.]/g,'-'),_0x278883=relative(_0x4c8fd4,_0x1394a5),_0x2b8113=join(_0x40746e,_0x301bbb,_0x278883);return await mkdir(dirname(_0x2b8113),{'recursive':!![]}),await rename(_0x1394a5,_0x2b8113),_0x2b8113;}async function cleanupEmptyDirectories(_0x4a73b7,_0x5dbb9a){const _0x29b4f7=a127_0x4d9fa9;let _0x121c20=resolve(_0x4a73b7);const _0x524bac=resolve(_0x5dbb9a);while(_0x121c20[_0x29b4f7(0x155)](''+_0x524bac+sep)||_0x121c20===_0x524bac){if(_0x121c20===_0x524bac)return;try{const _0x421bad=await readdir(_0x121c20);if(_0x421bad[_0x29b4f7(0x167)]>0x0)return;await rmdir(_0x121c20);}catch{return;}_0x121c20=dirname(_0x121c20);}}async function resolveTargetDbBinding(_0x2a0c43,_0x35df56,_0x4012d1){const _0xfd9830=a127_0x4d9fa9,_0x25529f=_0x35df56['dbDirectory'];if(!_0x25529f)return{'dbId':_0x4012d1[_0xfd9830(0x160)],'dbName':_0x4012d1['dbName']};const _0x49a850=buildDbDirectoryName(_0x4012d1[_0xfd9830(0x168)],_0x4012d1['dbId']);if(_0x25529f===_0x49a850)return{'dbId':_0x4012d1[_0xfd9830(0x160)],'dbName':_0x4012d1[_0xfd9830(0x168)]};const _0x34e4ba=parseExplicitDbDirectory(_0x25529f);if(_0x34e4ba!=null)return{'dbId':_0x34e4ba,'dbName':await getDbName(_0x2a0c43,_0x34e4ba)['catch'](()=>undefined)};const _0x33b8ff=await listDatabases(_0x2a0c43),_0x512e9b=_0x33b8ff[_0xfd9830(0x16d)](_0x4b2556=>buildDbDirectoryName(_0x4b2556[_0xfd9830(0x168)],_0x4b2556[_0xfd9830(0x160)])===_0x25529f);if(_0x512e9b[_0xfd9830(0x167)]===0x1)return{'dbId':_0x512e9b[0x0]['dbId'],'dbName':_0x512e9b[0x0][_0xfd9830(0x168)]};if(_0x512e9b[_0xfd9830(0x167)]===0x0)throw CliErrors[_0xfd9830(0x15d)](_0xfd9830(0x140)+_0x25529f+'\x22\x20for\x20sqlCode\x20'+_0x35df56['sqlCode']+'.');const _0x1c36ec=_0x512e9b[_0xfd9830(0x13e)](_0xdc1b19=>_0xdc1b19[_0xfd9830(0x168)]+'\x20('+_0xdc1b19[_0xfd9830(0x160)]+')')[_0xfd9830(0x139)](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x25529f+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x35df56['sqlCode']+':\x20'+_0x1c36ec);}function parseExplicitDbDirectory(_0x14fb4d){const _0xc853be=a127_0x4d9fa9,_0x2da4da=/^db-(\d+)$/[_0xc853be(0x172)](_0x14fb4d);if(!_0x2da4da)return null;const _0x22714b=Number(_0x2da4da[0x1]);return Number[_0xc853be(0x134)](_0x22714b)&&_0x22714b>0x0?_0x22714b:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a128_0x320e14=a128_0x33eb;function a128_0x3835(){const _0x885683=['Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','352647OHZfaV','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','2259pPNurU','134DanBcX','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','sqlname','join','2658220JyLIdP','write','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`.','file','string','2730904OoiPKi','1454680PRBhZq','Path\x20to\x20the\x20SQL\x20file','validation','112QdKRYo','144eUhTHT','445464vCdlnp','134406tkYUHW'];a128_0x3835=function(){return _0x885683;};return a128_0x3835();}(function(_0xe0655f,_0x2c8ed6){const _0xc2a593=a128_0x33eb,_0x526366=_0xe0655f();while(!![]){try{const _0x178589=parseInt(_0xc2a593(0x1ac))/0x1*(-parseInt(_0xc2a593(0x1ad))/0x2)+parseInt(_0xc2a593(0x1a7))/0x3+-parseInt(_0xc2a593(0x1a1))/0x4+parseInt(_0xc2a593(0x1a2))/0x5+parseInt(_0xc2a593(0x1a8))/0x6*(parseInt(_0xc2a593(0x1a5))/0x7)+-parseInt(_0xc2a593(0x1a6))/0x8*(-parseInt(_0xc2a593(0x1aa))/0x9)+-parseInt(_0xc2a593(0x19c))/0xa;if(_0x178589===_0x2c8ed6)break;else _0x526366['push'](_0x526366['shift']());}catch(_0xddeeea){_0x526366['push'](_0x526366['shift']());}}}(a128_0x3835,0x62721));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a128_0x320e14(0x199),a128_0x320e14(0x1ab),a128_0x320e14(0x19e)][a128_0x320e14(0x19b)]('\x0a');function a128_0x33eb(_0x19090c,_0xdb909f){_0x19090c=_0x19090c-0x199;const _0x383546=a128_0x3835();let _0x33eb0d=_0x383546[_0x19090c];return _0x33eb0d;}export const sqlSave={'service':'sql','command':'save','description':a128_0x320e14(0x1a9),'risk':a128_0x320e14(0x19d),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a128_0x320e14(0x19f),'type':a128_0x320e14(0x1a0),'required':!![],'description':a128_0x320e14(0x1a3)},SQLCODE_FLAG_OPTIONAL,{'name':a128_0x320e14(0x19a),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a128_0x320e14(0x1a0),'description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':'description','type':a128_0x320e14(0x1a0),'description':'Query\x20description'}],async 'validate'(){const _0x4e5c72=a128_0x320e14;throw CliErrors[_0x4e5c72(0x1a4)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x7aed72=a128_0x320e14;throw CliErrors[_0x7aed72(0x1a4)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a129_0x552975=a129_0x4462;(function(_0x4fa858,_0x48e89b){const _0x2631c2=a129_0x4462,_0x284bf7=_0x4fa858();while(!![]){try{const _0x37df23=parseInt(_0x2631c2(0x1c7))/0x1+parseInt(_0x2631c2(0x1e1))/0x2*(parseInt(_0x2631c2(0x1be))/0x3)+parseInt(_0x2631c2(0x1c9))/0x4+-parseInt(_0x2631c2(0x1c6))/0x5*(parseInt(_0x2631c2(0x1e5))/0x6)+-parseInt(_0x2631c2(0x1d3))/0x7*(-parseInt(_0x2631c2(0x1e7))/0x8)+parseInt(_0x2631c2(0x1e9))/0x9*(-parseInt(_0x2631c2(0x1d9))/0xa)+-parseInt(_0x2631c2(0x1da))/0xb;if(_0x37df23===_0x48e89b)break;else _0x284bf7['push'](_0x284bf7['shift']());}catch(_0x50dbdc){_0x284bf7['push'](_0x284bf7['shift']());}}}(a129_0x1afc,0x82396));import{createInterface}from'node:readline';function a129_0x4462(_0x8e6148,_0x116577){_0x8e6148=_0x8e6148-0x1be;const _0x1afc6e=a129_0x1afc();let _0x4462f5=_0x1afc6e[_0x8e6148];return _0x4462f5;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a129_0x552975(0x1d4);export function buildSqlLockEntry(_0xd0aebf,_0xa90d93,_0x1a77c9,_0x114155){const _0x284c5e=a129_0x552975,_0x2b7579=detectSqlMode(_0xa90d93);return{'path':buildSqlRelativePath(_0xd0aebf[_0x284c5e(0x1cf)],_0xd0aebf[_0x284c5e(0x1eb)],_0x114155?.['dbName'],_0x2b7579,_0xd0aebf[_0x284c5e(0x1d2)]),'hash':_0x1a77c9,'remoteId':_0xd0aebf['id'],'version':_0xd0aebf[_0x284c5e(0x1dd)],'dbId':Number(_0xd0aebf[_0x284c5e(0x1d2)]),'dbName':_0x114155?.[_0x284c5e(0x1e0)],'sqlName':_0xd0aebf[_0x284c5e(0x1eb)],'sqlConfig':_0xd0aebf[_0x284c5e(0x1cd)]??undefined,'mode':_0x2b7579};}export function cloneSqlLockData(_0x43c696){const _0x163989=a129_0x552975;return{'apps':Object['fromEntries'](Object[_0x163989(0x1c0)](_0x43c696[_0x163989(0x1ca)])[_0x163989(0x1e8)](([_0xadd1a0,_0x13d67e])=>[_0xadd1a0,{'sqlRoot':_0x13d67e[_0x163989(0x1c1)],'lastSync':_0x13d67e['lastSync'],'sqls':{..._0x13d67e[_0x163989(0x1d5)]}}]))};}export function ensureRemoteSqlContent(_0x2c51ae){const _0x390f9d=a129_0x552975;return _0x2c51ae[_0x390f9d(0x1c5)]??'';}export function buildLocalSqlFileContent(_0x415828,_0x3613fa,_0x39fdf0){const _0x5c9356=a129_0x552975,_0x557e74=_0x39fdf0?.[_0x5c9356(0x1ec)]??detectSqlMode(_0x3613fa),_0x46c105=stripLocalSqlMetadata(_0x3613fa,_0x557e74)[_0x5c9356(0x1e6)](),_0x5c0950=[...buildMetadataHeaderLines({'sqlCode':_0x415828[_0x5c9356(0x1cf)],'sqlName':_0x415828['sqlName'],'dbId':_0x415828[_0x5c9356(0x1d2)],'dbName':_0x39fdf0?.['dbName'],'mode':_0x557e74,'syncedAt':_0x39fdf0?.['syncedAt'],'description':_0x39fdf0?.[_0x5c9356(0x1c8)]},_0x557e74),'',_0x46c105],_0x2fa5ef=_0x5c0950[_0x5c9356(0x1c3)]('\x0a');return _0x2fa5ef[_0x5c9356(0x1e2)]('\x0a')?_0x2fa5ef:_0x2fa5ef+'\x0a';}export function stripLocalSqlMetadata(_0x5eb41e,_0x253d26){const _0x738206=a129_0x552975,_0x1d9576=_0x5eb41e[_0x738206(0x1cc)](/\r\n/g,'\x0a')[_0x738206(0x1d8)]('\x0a'),_0xa2a392=[];let _0x38bcd6=0x0;if(_0x253d26===_0x738206(0x1df))while(_0x38bcd6<_0x1d9576[_0x738206(0x1d0)]){const _0x214267=_0x1d9576[_0x38bcd6]??'';if(/^\s*<!--\s*@lovrabet\./[_0x738206(0x1d7)](_0x214267)){_0x38bcd6++;continue;}if(_0x214267[_0x738206(0x1e6)]()===''&&_0x38bcd6>0x0){_0x38bcd6++;continue;}break;}else while(_0x38bcd6<_0x1d9576[_0x738206(0x1d0)]){const _0x6730a4=_0x1d9576[_0x38bcd6]??'';if(/^\s*--\s*@lovrabet\./[_0x738206(0x1d7)](_0x6730a4)){_0x38bcd6++;continue;}if(_0x6730a4['trim']()===''&&_0x38bcd6>0x0){_0x38bcd6++;continue;}break;}for(;_0x38bcd6<_0x1d9576['length'];_0x38bcd6++){_0xa2a392[_0x738206(0x1cb)](_0x1d9576[_0x38bcd6]);}return _0xa2a392[_0x738206(0x1c3)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x1827a5,_0x2ae7f2){const _0x33fdb5=a129_0x552975;if(_0x2ae7f2?.['mode'])return _0x2ae7f2[_0x33fdb5(0x1ec)];return detectSqlMode(_0x1827a5);}export function resolveSqlFileName(_0x6f27d7,_0x3d5980,_0x13e091){const _0x46644c=a129_0x552975;if(_0x13e091?.[_0x46644c(0x1c2)])return _0x13e091[_0x46644c(0x1c2)];if(_0x13e091?.[_0x46644c(0x1eb)]||_0x13e091?.[_0x46644c(0x1e0)])return buildSqlRelativePath(_0x6f27d7,_0x13e091?.[_0x46644c(0x1eb)],_0x13e091?.[_0x46644c(0x1e0)],resolveSqlMode(_0x3d5980,_0x13e091),_0x13e091?.[_0x46644c(0x1d2)]);return buildDefaultSqlFileName(_0x6f27d7,resolveSqlMode(_0x3d5980,_0x13e091));}export function resolveSqlLocalDir(_0x5cd915,_0x228244){return join(_0x5cd915,SQL_LOCAL_REL_DIR,_0x228244);}export async function confirmForceOverwrite(_0x12632a){const _0x3824fd=a129_0x552975,_0x581c89=createInterface({'input':process[_0x3824fd(0x1c4)],'output':process['stderr']}),_0x1b2640=await new Promise(_0x49bd2d=>{const _0xb1df38=_0x3824fd;_0x581c89[_0xb1df38(0x1e4)](_0x12632a+_0xb1df38(0x1db),_0x49bd2d);});return _0x581c89['close'](),['y',_0x3824fd(0x1bf)][_0x3824fd(0x1d1)](_0x1b2640[_0x3824fd(0x1e6)]()[_0x3824fd(0x1ea)]());}export function findSqlLockScope(_0x3c6575,_0x473abe){const _0x36894=a129_0x552975;return _0x3c6575[_0x36894(0x1ca)][_0x473abe];}function buildMetadataHeaderLines(_0xe4d640,_0xed0a0c){const _0x1a1ecd=a129_0x552975,_0x504a79=[['sqlCode',_0xe4d640[_0x1a1ecd(0x1cf)]],[_0x1a1ecd(0x1eb),_0xe4d640[_0x1a1ecd(0x1eb)]],[_0x1a1ecd(0x1d2),_0xe4d640['dbId']],['dbName',_0xe4d640[_0x1a1ecd(0x1e0)]],[_0x1a1ecd(0x1ec),_0xe4d640[_0x1a1ecd(0x1ec)]],[_0x1a1ecd(0x1de),_0xe4d640['syncedAt']],[_0x1a1ecd(0x1c8),_0xe4d640[_0x1a1ecd(0x1c8)]]];if(_0xed0a0c==='mybatisXml')return _0x504a79['filter'](([,_0x13b90c])=>_0x13b90c!==undefined&&_0x13b90c!==null&&String(_0x13b90c)[_0x1a1ecd(0x1e6)]()!=='')[_0x1a1ecd(0x1e8)](([_0x3fbb8a,_0x35720a])=>_0x1a1ecd(0x1ce)+_0x3fbb8a+':\x20'+String(_0x35720a)+_0x1a1ecd(0x1e3));return _0x504a79[_0x1a1ecd(0x1d6)](([,_0x2cc44a])=>_0x2cc44a!==undefined&&_0x2cc44a!==null&&String(_0x2cc44a)['trim']()!=='')[_0x1a1ecd(0x1e8)](([_0x1ab379,_0x5ed412])=>_0x1a1ecd(0x1dc)+_0x1ab379+':\x20'+String(_0x5ed412));}function a129_0x1afc(){const _0xa09146=['mode','7677HTbrbU','yes','entries','sqlRoot','path','join','stdin','sqlContent','70sSpBvj','334942LIYONk','description','1361936BkvGSe','apps','push','replace','sqlConfig','<!--\x20@lovrabet.','sqlCode','length','includes','dbId','147zgmajJ','.rabetbase/sql','sqls','filter','test','split','32570fubnIQ','1372833UjrmKP','\x20[y/N]\x20','--\x20@lovrabet.','version','syncedAt','mybatisXml','dbName','724rozcIA','endsWith','\x20-->','question','278130RDbNCo','trim','20528kLodrK','map','963irrwyt','toLowerCase','sqlName'];a129_0x1afc=function(){return _0xa09146;};return a129_0x1afc();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a130_0x2f1b(){const _0x39a6a8=['relativePath','lockFilePath','lockKey','bool','\x20missing,\x20','tableData','remote','map','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','paging','5HVGceC','sql','1611lvtojF','\x20added,\x20','\x20unchanged','sqlName','sqls','All\x20SQL\x20queries\x20are\x20in\x20sync.','919264MioGtQ','1036752nFWtzn','push','totalCount','39290xcsAuK','sqlRoot','\x20remote-only','41864SLUcqy','\x20modified,\x20','140100kdWWUE','sqlCode','keys','length','has','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','path','filePath','status','appCode','1559142tbrmVb','boolean','hash','read','107020wmDnOa','91bFEdql'];a130_0x2f1b=function(){return _0x39a6a8;};return a130_0x2f1b();}const a130_0x559432=a130_0x5327;(function(_0x565fc3,_0x155790){const _0x5df3a0=a130_0x5327,_0x4f38d3=_0x565fc3();while(!![]){try{const _0x400336=parseInt(_0x5df3a0(0x19c))/0x1+parseInt(_0x5df3a0(0x17f))/0x2+-parseInt(_0x5df3a0(0x1a6))/0x3+-parseInt(_0x5df3a0(0x193))/0x4*(-parseInt(_0x5df3a0(0x18b))/0x5)+-parseInt(_0x5df3a0(0x194))/0x6+-parseInt(_0x5df3a0(0x180))/0x7*(parseInt(_0x5df3a0(0x19a))/0x8)+-parseInt(_0x5df3a0(0x18d))/0x9*(-parseInt(_0x5df3a0(0x197))/0xa);if(_0x400336===_0x155790)break;else _0x4f38d3['push'](_0x4f38d3['shift']());}catch(_0x3930c5){_0x4f38d3['push'](_0x4f38d3['shift']());}}}(a130_0x2f1b,0x59666));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x1dd08e){const _0x255d38=a130_0x5327,_0x8751c0=[];let _0x5b1adc=0x1;while(!![]){const _0x1eddd4=await listSqlQueries(_0x1dd08e,{'currentPage':_0x5b1adc,'pageSize':PAGE_SIZE}),_0x3c04f5=_0x1eddd4[_0x255d38(0x186)]??[];_0x8751c0[_0x255d38(0x195)](..._0x3c04f5[_0x255d38(0x188)](_0x5ac0b7=>_0x5ac0b7[_0x255d38(0x19d)]));if(_0x3c04f5[_0x255d38(0x19f)]===0x0)break;const _0x488db4=_0x1eddd4[_0x255d38(0x18a)]?.[_0x255d38(0x196)];if(_0x488db4!=null?_0x8751c0[_0x255d38(0x19f)]>=_0x488db4:_0x3c04f5[_0x255d38(0x19f)]<PAGE_SIZE)break;_0x5b1adc++;}return _0x8751c0;}function a130_0x5327(_0x49db7d,_0x3864f0){_0x49db7d=_0x49db7d-0x17f;const _0x2f1bc0=a130_0x2f1b();let _0x53277e=_0x2f1bc0[_0x49db7d];return _0x53277e;}export const sqlStatus={'service':a130_0x559432(0x18c),'command':a130_0x559432(0x1a4),'description':a130_0x559432(0x1a1),'risk':a130_0x559432(0x1a9),'flags':[{'name':a130_0x559432(0x187),'type':a130_0x559432(0x1a7),'description':a130_0x559432(0x189)}],async 'execute'(_0x44ee96){const _0x43c91e=a130_0x559432,_0x2f33d3=loadSqlProjectConfig(_0x44ee96[_0x43c91e(0x1a5)]),_0x2d3d09=await readSqlLockFile(_0x2f33d3[_0x43c91e(0x182)]),{appLock:_0x42d991}=ensureSqlLockScope(_0x2d3d09??createEmptySqlLock(),_0x2f33d3[_0x43c91e(0x1a5)],_0x2f33d3[_0x43c91e(0x198)],_0x43c91e(0x1a4)),_0x349599=await scanLocalSqlQueries(_0x2f33d3),_0x5c8055=[],_0x211b14=[],_0x5a294e=[],_0x2d3beb=[],_0x3bb91=new Set(_0x349599[_0x43c91e(0x188)](_0x19699a=>_0x19699a['lockKey']));for(const _0x444df6 of _0x349599){const _0x3b30d1=await computeSqlFileHash(_0x444df6[_0x43c91e(0x1a3)]),_0x59b521=_0x42d991[_0x43c91e(0x191)][_0x444df6[_0x43c91e(0x183)]],_0x43e2e8=!!_0x59b521&&_0x59b521[_0x43c91e(0x1a2)]!==_0x444df6[_0x43c91e(0x181)],_0x34371b=!!_0x59b521&&!!_0x444df6['sqlName']&&_0x59b521['sqlName']!==_0x444df6[_0x43c91e(0x190)];if(!_0x59b521)_0x5c8055['push'](_0x444df6[_0x43c91e(0x183)]);else _0x59b521[_0x43c91e(0x1a8)]!==_0x3b30d1||_0x43e2e8||_0x34371b?_0x211b14['push'](_0x444df6[_0x43c91e(0x183)]):_0x5a294e[_0x43c91e(0x195)](_0x444df6[_0x43c91e(0x183)]);}for(const _0x1828db of Object[_0x43c91e(0x19e)](_0x42d991[_0x43c91e(0x191)])){!_0x3bb91[_0x43c91e(0x1a0)](_0x1828db)&&_0x2d3beb[_0x43c91e(0x195)](_0x1828db);}const _0x3ccfb7=[];if(_0x44ee96[_0x43c91e(0x184)](_0x43c91e(0x187))){const _0xeb9297=await fetchAllSqlCodes(_0x44ee96[_0x43c91e(0x1a5)]);for(const _0x47f98f of _0xeb9297){!_0x3bb91[_0x43c91e(0x1a0)](_0x47f98f)&&!_0x42d991[_0x43c91e(0x191)][_0x47f98f]&&_0x3ccfb7['push'](_0x47f98f);}}const _0x129272=_0x5c8055[_0x43c91e(0x19f)]===0x0&&_0x211b14[_0x43c91e(0x19f)]===0x0&&_0x2d3beb[_0x43c91e(0x19f)]===0x0&&_0x3ccfb7[_0x43c91e(0x19f)]===0x0;return{'ok':!![],'data':{'added':_0x5c8055,'modified':_0x211b14,'missing':_0x2d3beb,'unchanged':_0x5a294e,'remoteOnly':_0x3ccfb7},'message':_0x129272?_0x43c91e(0x192):_0x5c8055['length']+_0x43c91e(0x18e)+_0x211b14['length']+_0x43c91e(0x19b)+_0x2d3beb[_0x43c91e(0x19f)]+_0x43c91e(0x185)+_0x5a294e[_0x43c91e(0x19f)]+_0x43c91e(0x18f)+(_0x3ccfb7['length']>0x0?',\x20'+_0x3ccfb7[_0x43c91e(0x19f)]+_0x43c91e(0x199):'')};}};
|