@lovrabet/rabetbase-cli 2.3.10-beta.1 → 2.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -0
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function a164_0x167d(_0x522920,_0x158462){_0x522920=_0x522920-0x138;const _0x1c3056=a164_0x1c30();let _0x167d1e=_0x1c3056[_0x522920];return _0x167d1e;}const a164_0x5ec471=a164_0x167d;(function(_0x16d1f6,_0x3f1066){const _0x445cd2=a164_0x167d,_0x182455=_0x16d1f6();while(!![]){try{const _0x2bec65=parseInt(_0x445cd2(0x145))/0x1+parseInt(_0x445cd2(0x16a))/0x2+-parseInt(_0x445cd2(0x17a))/0x3+parseInt(_0x445cd2(0x142))/0x4+parseInt(_0x445cd2(0x16b))/0x5+parseInt(_0x445cd2(0x157))/0x6*(-parseInt(_0x445cd2(0x139))/0x7)+-parseInt(_0x445cd2(0x15c))/0x8;if(_0x2bec65===_0x3f1066)break;else _0x182455['push'](_0x182455['shift']());}catch(_0x17a539){_0x182455['push'](_0x182455['shift']());}}}(a164_0x1c30,0x85f63));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';function a164_0x1c30(){const _0x1f1ca3=['new','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','mybatisXml','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','1837080EUuFAY','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','875891JsbUqD','str','trim','sqlName','Invalid\x20database\x20selection\x20payload:\x20','name','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','validation','nonInteractive','high-risk-write','sqlRootDir','flag','SQL\x20名称不能为空','description','mode','dbId\x20不能为空','请输入\x20SQL\x20名称:','2075802HDamWH','<server-generated-sqlCode>','dbId\x20必须为正整数','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20query\x20display\x20name','12082472cVNgjb','File\x20already\x20exists:\x20','请选择目标数据库:','sqls','catch','请输入目标数据库\x20dbId:','toISOString','db-id','isFinite','Local\x20SQL\x20file\x20mode','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','✎\x20手动输入\x20dbId','lockFilePath','/smartapi/custom/saveUserCustomSql','1026506QlCEWU','4363660aDAfCy','SELECT\x201\x20AS\x20id;','dbId','lastSync','\x20\x20SELECT\x201\x20AS\x20id','请选择本地\x20SQL\x20模式:','appCode','length','普通\x20SQL(sql)','join','flagMissing','number','sql','sqlRoot','map','948489yVdBJK','__manual__','7pkTKUr','dbName','sqlCode','utf8','POST'];a164_0x1c30=function(){return _0x1f1ca3;};return a164_0x1c30();}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(_0x547923){const _0x504ca7=a164_0x167d;if(_0x547923===_0x504ca7(0x140))return[_0x504ca7(0x14b),_0x504ca7(0x16f),'</select>',''][_0x504ca7(0x174)]('\x0a');return[_0x504ca7(0x16c),''][_0x504ca7(0x174)]('\x0a');}export const sqlCreate={'service':a164_0x5ec471(0x177),'command':'create','description':a164_0x5ec471(0x13f),'risk':a164_0x5ec471(0x14f),'flags':[{'name':a164_0x5ec471(0x14a),'type':'string','description':a164_0x5ec471(0x15b)},{'name':'db-id','type':a164_0x5ec471(0x176),'description':'Target\x20database\x20ID'},{'name':a164_0x5ec471(0x154),'type':'string','enum':[a164_0x5ec471(0x177),a164_0x5ec471(0x140)],'description':a164_0x5ec471(0x165)}],async 'validate'(_0x57c23a){const _0x2dd351=a164_0x5ec471;if(!_0x57c23a[_0x2dd351(0x14e)])return;if(!_0x57c23a[_0x2dd351(0x146)](_0x2dd351(0x14a))[_0x2dd351(0x147)]())throw CliErrors['flagMissing'](_0x2dd351(0x14a),_0x2dd351(0x15a));const _0xd25803=resolveProvidedDbId(_0x57c23a);if(typeof _0xd25803!=='number'||!Number[_0x2dd351(0x164)](_0xd25803)||_0xd25803<=0x0)throw CliErrors[_0x2dd351(0x175)](_0x2dd351(0x163),_0x2dd351(0x141));if(!_0x57c23a[_0x2dd351(0x146)](_0x2dd351(0x154))[_0x2dd351(0x147)]())throw CliErrors[_0x2dd351(0x175)](_0x2dd351(0x154),_0x2dd351(0x143));},async 'dryRun'(_0x35729b){const _0x52a90b=a164_0x5ec471,_0x26ea44=loadSqlProjectConfig(_0x35729b[_0x52a90b(0x171)]),{sqlName:_0x4921d4,dbId:_0x593de5,dbName:_0x29efc8,mode:_0x356cb8}=await resolveSqlNewInputs(_0x35729b),_0x353f99=buildSqlRelativePath(_0x52a90b(0x158),_0x4921d4,_0x29efc8,_0x356cb8,_0x593de5),_0x13158d=_0x26ea44[_0x52a90b(0x150)]+'/'+_0x353f99;return{'method':_0x52a90b(0x13d),'url':_0x52a90b(0x169),'body':{'appCode':_0x35729b[_0x52a90b(0x171)],'sqlName':_0x4921d4,'dbId':_0x593de5,'mode':_0x356cb8,'localPath':_0x13158d},'description':_0x52a90b(0x14c)+_0x26ea44[_0x52a90b(0x150)]};},async 'execute'(_0x532089){const _0x48b287=a164_0x5ec471,_0x7f2c18=loadSqlProjectConfig(_0x532089[_0x48b287(0x171)]),{sqlName:_0x60eeb4,dbId:_0x54f225,dbName:_0x3229e6,mode:_0xd5b0b8}=await resolveSqlNewInputs(_0x532089),_0x53f1d4=generateSqlTemplate(_0xd5b0b8),_0x3ffe3f=await createSqlQuery({'appCode':_0x532089[_0x48b287(0x171)],'sqlName':_0x60eeb4,'dbId':_0x54f225,'sqlContent':_0x53f1d4}),_0x4056ca=ensureRemoteSqlContent(_0x3ffe3f),_0x4d2a24=_0x3229e6||await getDbName(_0x532089[_0x48b287(0x171)],_0x54f225)[_0x48b287(0x160)](()=>undefined),_0x47a383=buildSqlRelativePath(_0x3ffe3f[_0x48b287(0x13b)],_0x3ffe3f[_0x48b287(0x148)],_0x4d2a24,_0xd5b0b8,_0x54f225),_0x13ee7d=_0x7f2c18[_0x48b287(0x150)]+'/'+_0x47a383,_0x18b7c5=buildLocalSqlFileContent({'sqlCode':_0x3ffe3f[_0x48b287(0x13b)],'sqlName':_0x3ffe3f['sqlName'],'dbId':_0x3ffe3f[_0x48b287(0x16d)]},_0x4056ca,{'dbName':_0x4d2a24,'mode':_0xd5b0b8,'syncedAt':new Date()[_0x48b287(0x162)](),'description':_0x3ffe3f[_0x48b287(0x153)]});if(await fileExists(_0x13ee7d))throw CliErrors[_0x48b287(0x14d)](_0x48b287(0x15d)+_0x13ee7d);await ensureParentDirectory(_0x13ee7d),await writeFile(_0x13ee7d,_0x18b7c5,_0x48b287(0x13c));const _0x32efdf=await readSqlLockFile(_0x7f2c18[_0x48b287(0x168)]),{lockData:_0x21887e,appLock:_0x5419ea}=ensureSqlLockScope(_0x32efdf??createEmptySqlLock(),_0x7f2c18[_0x48b287(0x171)],_0x7f2c18[_0x48b287(0x178)],_0x48b287(0x13e));return _0x5419ea[_0x48b287(0x15f)][_0x3ffe3f[_0x48b287(0x13b)]]={...buildSqlLockEntry(_0x3ffe3f,_0x4056ca,computeSqlContentHash(_0x18b7c5),{'dbName':_0x4d2a24}),'path':_0x47a383,'mode':_0xd5b0b8},_0x5419ea[_0x48b287(0x16e)]=new Date()['toISOString'](),await writeSqlLockFile(_0x7f2c18['lockFilePath'],_0x21887e),{'ok':!![],'data':{'id':_0x3ffe3f['id'],'sqlCode':_0x3ffe3f['sqlCode'],'sqlName':_0x3ffe3f['sqlName'],'dbId':_0x3ffe3f[_0x48b287(0x16d)],'path':_0x13ee7d,'mode':_0xd5b0b8},'message':_0x48b287(0x144)+_0x3ffe3f[_0x48b287(0x13b)]};}};async function resolveSqlNewInputs(_0x37b927){const _0x1ff1e6=await resolveSqlNameInput(_0x37b927),{dbId:_0x5605db,dbName:_0x4a3504}=await resolveDbSelection(_0x37b927),_0x42493f=await resolveSqlModeInput(_0x37b927);return{'sqlName':_0x1ff1e6,'dbId':_0x5605db,'dbName':_0x4a3504,'mode':_0x42493f};}async function resolveSqlNameInput(_0x2de6fa){const _0x321a5b=a164_0x5ec471,_0x53aea6=_0x2de6fa['str'](_0x321a5b(0x14a))[_0x321a5b(0x147)]();if(_0x53aea6)return _0x53aea6;if(_0x2de6fa['nonInteractive'])throw CliErrors[_0x321a5b(0x175)]('name',_0x321a5b(0x15a));return(await input({'message':_0x321a5b(0x156),'validate':_0x1be05b=>_0x1be05b[_0x321a5b(0x147)]()?!![]:_0x321a5b(0x152)}))[_0x321a5b(0x147)]();}async function resolveDbSelection(_0x3a3e4f){const _0x3f1ae8=a164_0x5ec471,_0x118e76=resolveProvidedDbId(_0x3a3e4f);if(typeof _0x118e76===_0x3f1ae8(0x176)&&Number[_0x3f1ae8(0x164)](_0x118e76)&&_0x118e76>0x0)return{'dbId':_0x118e76,'dbName':await getDbName(_0x3a3e4f[_0x3f1ae8(0x171)],_0x118e76)[_0x3f1ae8(0x160)](()=>undefined)};if(_0x3a3e4f[_0x3f1ae8(0x14e)])throw CliErrors[_0x3f1ae8(0x175)](_0x3f1ae8(0x163),_0x3f1ae8(0x141));const _0x4107df=await listDatabases(_0x3a3e4f['appCode'])[_0x3f1ae8(0x160)](()=>[]);if(_0x4107df[_0x3f1ae8(0x172)]===0x1)return{'dbId':_0x4107df[0x0][_0x3f1ae8(0x16d)],'dbName':_0x4107df[0x0][_0x3f1ae8(0x13a)]};if(_0x4107df[_0x3f1ae8(0x172)]>0x1){const _0x5bdbe9=await select({'message':_0x3f1ae8(0x15e),'choices':[..._0x4107df[_0x3f1ae8(0x179)](_0x5365db=>({'name':_0x5365db[_0x3f1ae8(0x13a)]+'\x20('+_0x5365db[_0x3f1ae8(0x16d)]+')','value':serializeDbSelection(_0x5365db)})),{'name':_0x3f1ae8(0x167),'value':_0x3f1ae8(0x138)}]});if(_0x5bdbe9!==_0x3f1ae8(0x138))return deserializeDbSelection(_0x5bdbe9);}const _0x88caa4=await input({'message':_0x3f1ae8(0x161),'validate':_0x554fdc=>{const _0x465cbc=_0x3f1ae8,_0x225abc=_0x554fdc[_0x465cbc(0x147)]();if(!_0x225abc)return _0x465cbc(0x155);const _0x19f500=Number(_0x225abc);if(!Number['isInteger'](_0x19f500)||_0x19f500<=0x0)return _0x465cbc(0x159);return!![];}});return{'dbId':Number(_0x88caa4[_0x3f1ae8(0x147)]())};}async function resolveSqlModeInput(_0x10452b){const _0x2d4399=a164_0x5ec471,_0xa7b03e=_0x10452b['str'](_0x2d4399(0x154))[_0x2d4399(0x147)]();if(_0xa7b03e===_0x2d4399(0x177)||_0xa7b03e==='mybatisXml')return _0xa7b03e;if(_0x10452b[_0x2d4399(0x14e)])throw CliErrors[_0x2d4399(0x175)](_0x2d4399(0x154),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x2d4399(0x170),'choices':[{'name':_0x2d4399(0x173),'value':_0x2d4399(0x177),'description':_0x2d4399(0x166)},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x2d4399(0x140),'description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x4e321c){const _0xe65b81=a164_0x5ec471;return JSON['stringify']({'dbId':_0x4e321c[_0xe65b81(0x16d)],'dbName':_0x4e321c[_0xe65b81(0x13a)]});}function deserializeDbSelection(_0xa1668f){const _0x2fad56=a164_0x5ec471;try{const _0x4651d4=JSON['parse'](_0xa1668f);if(typeof _0x4651d4[_0x2fad56(0x16d)]===_0x2fad56(0x176)&&Number[_0x2fad56(0x164)](_0x4651d4[_0x2fad56(0x16d)]))return{'dbId':_0x4651d4['dbId'],'dbName':_0x4651d4[_0x2fad56(0x13a)]};}catch{}throw CliErrors['validation'](_0x2fad56(0x149)+_0xa1668f);}function resolveProvidedDbId(_0x405837){const _0xd56a42=a164_0x5ec471,_0x49c0f4=_0x405837[_0xd56a42(0x151)](_0xd56a42(0x163));if(typeof _0x49c0f4===_0xd56a42(0x176)&&Number[_0xd56a42(0x164)](_0x49c0f4))return _0x49c0f4;return undefined;}
|
|
1
|
+
const a165_0x525a6c=a165_0x37e3;function a165_0x37e3(_0x331e17,_0x4490bf){_0x331e17=_0x331e17-0xe1;const _0x2fa7ba=a165_0x2fa7();let _0x37e35d=_0x2fa7ba[_0x331e17];return _0x37e35d;}(function(_0xc225ca,_0x50ffc8){const _0x218198=a165_0x37e3,_0x1fda7e=_0xc225ca();while(!![]){try{const _0x3c5707=-parseInt(_0x218198(0x112))/0x1*(parseInt(_0x218198(0x103))/0x2)+parseInt(_0x218198(0x102))/0x3+parseInt(_0x218198(0xe4))/0x4+-parseInt(_0x218198(0xfb))/0x5*(-parseInt(_0x218198(0x109))/0x6)+-parseInt(_0x218198(0x119))/0x7+parseInt(_0x218198(0xfa))/0x8+parseInt(_0x218198(0x121))/0x9*(-parseInt(_0x218198(0xf2))/0xa);if(_0x3c5707===_0x50ffc8)break;else _0x1fda7e['push'](_0x1fda7e['shift']());}catch(_0x289273){_0x1fda7e['push'](_0x1fda7e['shift']());}}}(a165_0x2fa7,0x7013f));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';function a165_0x2fa7(){const _0x29252f=['File\x20already\x20exists:\x20','appCode','POST','3519Mskobg','SELECT\x201\x20AS\x20id;','Created\x20SQL\x20query\x20','nonInteractive','sqlCode','join','create','1811320pCvyri','length','sql','dbName','lockFilePath','Target\x20database\x20ID','high-risk-write','number','适合带动态标签的\x20MyBatis\x20XML\x20SQL','string','SQL\x20名称不能为空','trim','isFinite','parse','32830cVbjot','sqlRoot','isInteger','utf8','SQL\x20query\x20display\x20name','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','mode','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','6952480icMFkL','13685bARTeF','\x20\x20SELECT\x201\x20AS\x20id','new','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','dbId\x20必须为正整数','MyBatis\x20XML(mybatisXml)','2532465EJzOFf','8LgDQdx','请输入\x20SQL\x20名称:','flagMissing','__manual__','</select>','db-id','1578sfRPpI','description','sqlRootDir','dbId\x20不能为空','Invalid\x20database\x20selection\x20payload:\x20','stringify','name','Local\x20SQL\x20file\x20mode','validation','172961kEFOvq','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','catch','mybatisXml','sqlName','map','普通\x20SQL(sql)','3159156aDpdlf','请输入目标数据库\x20dbId:','str','dbId','✎\x20手动输入\x20dbId'];a165_0x2fa7=function(){return _0x29252f;};return a165_0x2fa7();}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x17c861){const _0x27a50f=a165_0x37e3;if(_0x17c861===_0x27a50f(0x115))return[_0x27a50f(0xff),_0x27a50f(0xfc),_0x27a50f(0x107),'']['join']('\x0a');return[_0x27a50f(0x122),''][_0x27a50f(0xe2)]('\x0a');}export const sqlCreate={'service':'sql','command':a165_0x525a6c(0xe3),'description':a165_0x525a6c(0xf7),'risk':a165_0x525a6c(0xea),'flags':[{'name':a165_0x525a6c(0x10f),'type':a165_0x525a6c(0xed),'description':a165_0x525a6c(0xf6)},{'name':a165_0x525a6c(0x108),'type':a165_0x525a6c(0xeb),'description':a165_0x525a6c(0xe9)},{'name':a165_0x525a6c(0xf8),'type':'string','enum':[a165_0x525a6c(0xe6),a165_0x525a6c(0x115)],'description':a165_0x525a6c(0x110)}],async 'validate'(_0x4adad1){const _0x15c515=a165_0x525a6c;if(!_0x4adad1[_0x15c515(0x124)])return;if(!_0x4adad1[_0x15c515(0x11b)](_0x15c515(0x10f))[_0x15c515(0xef)]())throw CliErrors[_0x15c515(0x105)](_0x15c515(0x10f),_0x15c515(0xfe));const _0xcf9484=resolveProvidedDbId(_0x4adad1);if(typeof _0xcf9484!=='number'||!Number[_0x15c515(0xf0)](_0xcf9484)||_0xcf9484<=0x0)throw CliErrors[_0x15c515(0x105)](_0x15c515(0x108),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x4adad1[_0x15c515(0x11b)]('mode')[_0x15c515(0xef)]())throw CliErrors[_0x15c515(0x105)](_0x15c515(0xf8),_0x15c515(0x113));},async 'dryRun'(_0x49f5a6){const _0x58bc41=a165_0x525a6c,_0x1527e4=loadSqlProjectConfig(_0x49f5a6[_0x58bc41(0x11f)]),{sqlName:_0x43b50a,dbId:_0x14c8bf,dbName:_0x1a5f3e,mode:_0x29e4cf}=await resolveSqlNewInputs(_0x49f5a6),_0x20e903=buildSqlRelativePath('<server-generated-sqlCode>',_0x43b50a,_0x1a5f3e,_0x29e4cf,_0x14c8bf),_0x11d30c=_0x1527e4[_0x58bc41(0x10b)]+'/'+_0x20e903;return{'method':_0x58bc41(0x120),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x49f5a6[_0x58bc41(0x11f)],'sqlName':_0x43b50a,'dbId':_0x14c8bf,'mode':_0x29e4cf,'localPath':_0x11d30c},'description':_0x58bc41(0xf9)+_0x1527e4['sqlRootDir']};},async 'execute'(_0x3802de){const _0x276539=a165_0x525a6c,_0xa5bce8=loadSqlProjectConfig(_0x3802de[_0x276539(0x11f)]),{sqlName:_0x1896ec,dbId:_0x89e802,dbName:_0x181536,mode:_0x533e0b}=await resolveSqlNewInputs(_0x3802de),_0xec1fff=generateSqlTemplate(_0x533e0b),_0x4d5c14=await createSqlQuery({'appCode':_0x3802de['appCode'],'sqlName':_0x1896ec,'dbId':_0x89e802,'sqlContent':_0xec1fff}),_0x375d23=ensureRemoteSqlContent(_0x4d5c14),_0xdd775c=_0x181536||await getDbName(_0x3802de[_0x276539(0x11f)],_0x89e802)[_0x276539(0x114)](()=>undefined),_0x3a28f9=buildSqlRelativePath(_0x4d5c14['sqlCode'],_0x4d5c14['sqlName'],_0xdd775c,_0x533e0b,_0x89e802),_0x2429b5=_0xa5bce8[_0x276539(0x10b)]+'/'+_0x3a28f9,_0x22b730=buildLocalSqlFileContent({'sqlCode':_0x4d5c14[_0x276539(0xe1)],'sqlName':_0x4d5c14[_0x276539(0x116)],'dbId':_0x4d5c14[_0x276539(0x11c)]},_0x375d23,{'dbName':_0xdd775c,'mode':_0x533e0b,'syncedAt':new Date()['toISOString'](),'description':_0x4d5c14[_0x276539(0x10a)]});if(await fileExists(_0x2429b5))throw CliErrors[_0x276539(0x111)](_0x276539(0x11e)+_0x2429b5);await ensureParentDirectory(_0x2429b5),await writeFile(_0x2429b5,_0x22b730,_0x276539(0xf5));const _0x1a5163=await readSqlLockFile(_0xa5bce8[_0x276539(0xe8)]),{lockData:_0x1d84f3,appLock:_0x14db5}=ensureSqlLockScope(_0x1a5163??createEmptySqlLock(),_0xa5bce8['appCode'],_0xa5bce8[_0x276539(0xf3)],_0x276539(0xfd));return _0x14db5['sqls'][_0x4d5c14[_0x276539(0xe1)]]={...buildSqlLockEntry(_0x4d5c14,_0x375d23,computeSqlContentHash(_0x22b730),{'dbName':_0xdd775c}),'path':_0x3a28f9,'mode':_0x533e0b},_0x14db5['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xa5bce8[_0x276539(0xe8)],_0x1d84f3),{'ok':!![],'data':{'id':_0x4d5c14['id'],'sqlCode':_0x4d5c14[_0x276539(0xe1)],'sqlName':_0x4d5c14[_0x276539(0x116)],'dbId':_0x4d5c14['dbId'],'path':_0x2429b5,'mode':_0x533e0b},'message':_0x276539(0x123)+_0x4d5c14[_0x276539(0xe1)]};}};async function resolveSqlNewInputs(_0x43e8eb){const _0x1fe370=await resolveSqlNameInput(_0x43e8eb),{dbId:_0xec5e16,dbName:_0x4ea4ba}=await resolveDbSelection(_0x43e8eb),_0x49bc0d=await resolveSqlModeInput(_0x43e8eb);return{'sqlName':_0x1fe370,'dbId':_0xec5e16,'dbName':_0x4ea4ba,'mode':_0x49bc0d};}async function resolveSqlNameInput(_0x257e69){const _0x547fc4=a165_0x525a6c,_0x1c3e75=_0x257e69[_0x547fc4(0x11b)](_0x547fc4(0x10f))[_0x547fc4(0xef)]();if(_0x1c3e75)return _0x1c3e75;if(_0x257e69[_0x547fc4(0x124)])throw CliErrors['flagMissing']('name',_0x547fc4(0xfe));return(await input({'message':_0x547fc4(0x104),'validate':_0x5c3a01=>_0x5c3a01[_0x547fc4(0xef)]()?!![]:_0x547fc4(0xee)}))[_0x547fc4(0xef)]();}async function resolveDbSelection(_0x2ba09f){const _0x369e29=a165_0x525a6c,_0x1d3827=resolveProvidedDbId(_0x2ba09f);if(typeof _0x1d3827===_0x369e29(0xeb)&&Number[_0x369e29(0xf0)](_0x1d3827)&&_0x1d3827>0x0)return{'dbId':_0x1d3827,'dbName':await getDbName(_0x2ba09f[_0x369e29(0x11f)],_0x1d3827)[_0x369e29(0x114)](()=>undefined)};if(_0x2ba09f[_0x369e29(0x124)])throw CliErrors[_0x369e29(0x105)](_0x369e29(0x108),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x4007b0=await listDatabases(_0x2ba09f[_0x369e29(0x11f)])['catch'](()=>[]);if(_0x4007b0[_0x369e29(0xe5)]===0x1)return{'dbId':_0x4007b0[0x0][_0x369e29(0x11c)],'dbName':_0x4007b0[0x0][_0x369e29(0xe7)]};if(_0x4007b0[_0x369e29(0xe5)]>0x1){const _0x4c0a79=await select({'message':'请选择目标数据库:','choices':[..._0x4007b0[_0x369e29(0x117)](_0x570003=>({'name':_0x570003[_0x369e29(0xe7)]+'\x20('+_0x570003[_0x369e29(0x11c)]+')','value':serializeDbSelection(_0x570003)})),{'name':_0x369e29(0x11d),'value':_0x369e29(0x106)}]});if(_0x4c0a79!==_0x369e29(0x106))return deserializeDbSelection(_0x4c0a79);}const _0x25bd24=await input({'message':_0x369e29(0x11a),'validate':_0xe91219=>{const _0x33788a=_0x369e29,_0x5516dd=_0xe91219[_0x33788a(0xef)]();if(!_0x5516dd)return _0x33788a(0x10c);const _0x77452=Number(_0x5516dd);if(!Number[_0x33788a(0xf4)](_0x77452)||_0x77452<=0x0)return _0x33788a(0x100);return!![];}});return{'dbId':Number(_0x25bd24[_0x369e29(0xef)]())};}async function resolveSqlModeInput(_0x2273c6){const _0x103f4a=a165_0x525a6c,_0x46c9a7=_0x2273c6['str'](_0x103f4a(0xf8))[_0x103f4a(0xef)]();if(_0x46c9a7===_0x103f4a(0xe6)||_0x46c9a7===_0x103f4a(0x115))return _0x46c9a7;if(_0x2273c6['nonInteractive'])throw CliErrors[_0x103f4a(0x105)](_0x103f4a(0xf8),_0x103f4a(0x113));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x103f4a(0x118),'value':_0x103f4a(0xe6),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x103f4a(0x101),'value':_0x103f4a(0x115),'description':_0x103f4a(0xec)}]});}function serializeDbSelection(_0x120274){const _0x44161e=a165_0x525a6c;return JSON[_0x44161e(0x10e)]({'dbId':_0x120274[_0x44161e(0x11c)],'dbName':_0x120274[_0x44161e(0xe7)]});}function deserializeDbSelection(_0x1e6d60){const _0x13aaa7=a165_0x525a6c;try{const _0x406021=JSON[_0x13aaa7(0xf1)](_0x1e6d60);if(typeof _0x406021[_0x13aaa7(0x11c)]==='number'&&Number['isFinite'](_0x406021['dbId']))return{'dbId':_0x406021['dbId'],'dbName':_0x406021['dbName']};}catch{}throw CliErrors[_0x13aaa7(0x111)](_0x13aaa7(0x10d)+_0x1e6d60);}function resolveProvidedDbId(_0x55bd17){const _0x553e14=a165_0x525a6c,_0x656b6b=_0x55bd17['flag']('db-id');if(typeof _0x656b6b===_0x553e14(0xeb)&&Number[_0x553e14(0xf0)](_0x656b6b))return _0x656b6b;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x483393=a166_0x56f6;(function(_0x201287,_0x16bae8){const _0x405edf=a166_0x56f6,_0x439243=_0x201287();while(!![]){try{const _0x183c1d=parseInt(_0x405edf(0x83))/0x1*(parseInt(_0x405edf(0x92))/0x2)+parseInt(_0x405edf(0x9d))/0x3+-parseInt(_0x405edf(0x82))/0x4+parseInt(_0x405edf(0x8c))/0x5+parseInt(_0x405edf(0x95))/0x6*(-parseInt(_0x405edf(0x84))/0x7)+parseInt(_0x405edf(0x7f))/0x8*(parseInt(_0x405edf(0x8d))/0x9)+-parseInt(_0x405edf(0x86))/0xa;if(_0x183c1d===_0x16bae8)break;else _0x439243['push'](_0x439243['shift']());}catch(_0x9c8b){_0x439243['push'](_0x439243['shift']());}}}(a166_0x3494,0xb5fc9));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a166_0x3494(){const _0x430db4=['POST','validation','Would\x20delete\x20SQL\x20','/smartapi/custom/deleteUserCustomSql','4402794vxWsSb','projectRoot','str','toISOString','fromEntries','sqlcode','520dOwynR','sqlRootDir','lockFilePath','95620pCvLKA','1426213uJdAJR','798qgwLsu','trashDir','29444010QllZud','sql','high-risk-write','sqlRoot','appCode','startsWith','2067670fLrnCj','60498HlKzCd','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','remoteId','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','filter','2XmAOir','\x20(local\x20file\x20moved\x20to\x20trash)','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','1608zXMDcM','delete','length','sqls'];a166_0x3494=function(){return _0x430db4;};return a166_0x3494();}function a166_0x56f6(_0x558a3b,_0x104010){_0x558a3b=_0x558a3b-0x7f;const _0x3494c1=a166_0x3494();let _0x56f64b=_0x3494c1[_0x558a3b];return _0x56f64b;}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';export const sqlDelete={'service':a166_0x483393(0x87),'command':a166_0x483393(0x96),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a166_0x483393(0x88),'flags':[SQLCODE_FLAG],async 'validate'(_0x4e4147){const _0x458f3e=a166_0x483393,_0x4e13ed=loadSqlProjectConfig(_0x4e4147[_0x458f3e(0x8a)]),_0x4df216=await readSqlLockFile(_0x4e13ed['lockFilePath']);if(!_0x4df216)throw CliErrors[_0x458f3e(0x9a)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x256a16){const _0x43e148=a166_0x483393,_0x9f3034=loadSqlProjectConfig(_0x256a16[_0x43e148(0x8a)]),_0x563c98=await readSqlLockFile(_0x9f3034[_0x43e148(0x81)]);if(!_0x563c98)throw CliErrors['validation'](_0x43e148(0x94));const {appLock:_0x2f271d}=ensureSqlLockScope(_0x563c98,_0x256a16[_0x43e148(0x8a)],_0x9f3034[_0x43e148(0x89)],_0x43e148(0x96)),_0x35262d=_0x256a16[_0x43e148(0x9f)](_0x43e148(0xa2)),_0x212fe5=_0x2f271d[_0x43e148(0x98)][_0x35262d];if(!_0x212fe5)throw CliErrors['validation'](_0x43e148(0x8e)+_0x35262d+'\x22.');return{'method':_0x43e148(0x99),'url':_0x43e148(0x9c),'body':{'sqlCode':_0x35262d,'id':_0x212fe5[_0x43e148(0x8f)],'localPath':resolveLocalSqlFilePath(_0x9f3034,_0x35262d,_0x212fe5)},'description':_0x43e148(0x9b)+_0x35262d+_0x43e148(0x90)+_0x9f3034[_0x43e148(0x85)]};},async 'execute'(_0x696339){const _0x57d845=a166_0x483393,_0x269fdb=loadSqlProjectConfig(_0x696339[_0x57d845(0x8a)]),_0x2e28df=await readSqlLockFile(_0x269fdb[_0x57d845(0x81)]);if(!_0x2e28df)throw CliErrors[_0x57d845(0x9a)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x25ad0d,appLock:_0x5147e9}=ensureSqlLockScope(_0x2e28df,_0x696339[_0x57d845(0x8a)],_0x269fdb['sqlRoot'],_0x57d845(0x96)),_0x328f41=_0x696339[_0x57d845(0x9f)](_0x57d845(0xa2)),_0x448b8a=_0x5147e9[_0x57d845(0x98)][_0x328f41];if(!_0x448b8a)throw CliErrors['validation'](_0x57d845(0x8e)+_0x328f41+'\x22.');await deleteSqlQuery({'id':_0x448b8a[_0x57d845(0x8f)],'sqlCode':_0x328f41}),_0x5147e9['sqls']=Object[_0x57d845(0xa1)](Object['entries'](_0x5147e9['sqls'])[_0x57d845(0x91)](([_0x176e6b])=>_0x176e6b!==_0x328f41)),_0x5147e9['lastSync']=new Date()[_0x57d845(0xa0)](),await writeSqlLockFile(_0x269fdb[_0x57d845(0x81)],_0x25ad0d);const _0x190517=resolveLocalSqlFilePath(_0x269fdb,_0x328f41,_0x448b8a);let _0x5355b2;await fileExists(_0x190517)&&(_0x5355b2=await moveToTrash(_0x269fdb[_0x57d845(0x9e)],_0x269fdb[_0x57d845(0x85)],_0x190517),await cleanupEmptyDirectories(dirname(_0x190517),_0x269fdb[_0x57d845(0x80)]));const _0x56b12a={'deleted':_0x328f41,'remoteId':_0x448b8a['remoteId']};if(_0x5355b2)_0x56b12a['trashedTo']=_0x5355b2;return{'ok':!![],'data':_0x56b12a,'message':'Deleted\x20'+_0x328f41+(_0x5355b2?_0x57d845(0x93):'')};}};async function moveToTrash(_0x347c7c,_0xd3c6ba,_0x209af5){const _0x5402f1=a166_0x483393,_0x4cfb98=new Date()[_0x5402f1(0xa0)]()['replace'](/[:.]/g,'-'),_0x519358=relative(_0x347c7c,_0x209af5),_0x34b5ae=join(_0xd3c6ba,_0x4cfb98,_0x519358);return await mkdir(dirname(_0x34b5ae),{'recursive':!![]}),await rename(_0x209af5,_0x34b5ae),_0x34b5ae;}async function cleanupEmptyDirectories(_0x3e30b5,_0x1b678c){const _0x11d414=a166_0x483393;let _0x1f5e51=resolve(_0x3e30b5);const _0x5c1a63=resolve(_0x1b678c);while(_0x1f5e51[_0x11d414(0x8b)](''+_0x5c1a63+sep)||_0x1f5e51===_0x5c1a63){if(_0x1f5e51===_0x5c1a63)return;try{const _0x1f0307=await readdir(_0x1f5e51);if(_0x1f0307[_0x11d414(0x97)]>0x0)return;await rmdir(_0x1f5e51);}catch{return;}_0x1f5e51=dirname(_0x1f5e51);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x255dbe=a167_0x14e9;(function(_0x108abf,_0x1a2b76){const _0x2e2b71=a167_0x14e9,_0x3f51a1=_0x108abf();while(!![]){try{const _0x24522f=-parseInt(_0x2e2b71(0x12d))/0x1*(parseInt(_0x2e2b71(0x132))/0x2)+parseInt(_0x2e2b71(0x123))/0x3+parseInt(_0x2e2b71(0x126))/0x4+-parseInt(_0x2e2b71(0x138))/0x5+-parseInt(_0x2e2b71(0x137))/0x6*(-parseInt(_0x2e2b71(0x12b))/0x7)+parseInt(_0x2e2b71(0x129))/0x8+parseInt(_0x2e2b71(0x131))/0x9*(-parseInt(_0x2e2b71(0x136))/0xa);if(_0x24522f===_0x1a2b76)break;else _0x3f51a1['push'](_0x3f51a1['shift']());}catch(_0x545f8f){_0x3f51a1['push'](_0x3f51a1['shift']());}}}(a167_0x51d9,0x4b656));import{getSqlQueryInfo}from'../../core/api-client.js';function a167_0x51d9(){const _0x26d10a=['40tMHTuR','bool','sql','verbose','170wjzRtA','6hlfdsd','1024940oMnMBc','boolean','dbId','311880vnLbnO','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlCode','1780776zhqBrD','read','sqlcode','4335808MSZITm','appCode','1172514lOnzNZ','sqlName','11532YOQTCl','Return\x20full\x20raw\x20SQL\x20query\x20object','detail','str','272214WcXwPz'];a167_0x51d9=function(){return _0x26d10a;};return a167_0x51d9();}import{getDbName}from'../../core/db-resolver.js';function a167_0x14e9(_0x4bc759,_0xb9652e){_0x4bc759=_0x4bc759-0x121;const _0x51d969=a167_0x51d9();let _0x14e956=_0x51d969[_0x4bc759];return _0x14e956;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a167_0x255dbe(0x134),'command':a167_0x255dbe(0x12f),'description':a167_0x255dbe(0x124),'risk':a167_0x255dbe(0x127),'flags':[SQLCODE_FLAG,{'name':a167_0x255dbe(0x135),'type':a167_0x255dbe(0x121),'description':a167_0x255dbe(0x12e)}],async 'execute'(_0x435003){const _0x4a9b2e=a167_0x255dbe,_0x51c8f5=await getSqlQueryInfo(_0x435003[_0x4a9b2e(0x12a)],_0x435003[_0x4a9b2e(0x130)](_0x4a9b2e(0x128))),_0x54bb9c=_0x435003[_0x4a9b2e(0x133)](_0x4a9b2e(0x135));if(_0x54bb9c)return{'ok':!![],'data':_0x51c8f5};const _0x1c1ee6=_0x51c8f5[_0x4a9b2e(0x122)]?await getDbName(_0x435003['appCode'],_0x51c8f5[_0x4a9b2e(0x122)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x51c8f5[_0x4a9b2e(0x125)],'sqlName':_0x51c8f5[_0x4a9b2e(0x12c)],'db':_0x1c1ee6?_0x1c1ee6+'\x20('+_0x51c8f5[_0x4a9b2e(0x122)]+')':_0x51c8f5[_0x4a9b2e(0x122)]??'','description':_0x51c8f5['description']??'','sqlContent':_0x51c8f5['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a168_0x3f7088=a168_0x1f8e;(function(_0x39a453,_0x1e7278){const _0x1c2095=a168_0x1f8e,_0x1b2cf4=_0x39a453();while(!![]){try{const _0x19765d=parseInt(_0x1c2095(0x78))/0x1+-parseInt(_0x1c2095(0x86))/0x2*(parseInt(_0x1c2095(0x8b))/0x3)+parseInt(_0x1c2095(0x73))/0x4*(parseInt(_0x1c2095(0x87))/0x5)+parseInt(_0x1c2095(0x72))/0x6*(parseInt(_0x1c2095(0x75))/0x7)+-parseInt(_0x1c2095(0x81))/0x8*(-parseInt(_0x1c2095(0x71))/0x9)+parseInt(_0x1c2095(0x77))/0xa+-parseInt(_0x1c2095(0x7c))/0xb;if(_0x19765d===_0x1e7278)break;else _0x1b2cf4['push'](_0x1b2cf4['shift']());}catch(_0x16665c){_0x1b2cf4['push'](_0x1b2cf4['shift']());}}}(a168_0xfd37,0xc00fb));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a168_0x1f8e(_0x307508,_0x271f7){_0x307508=_0x307508-0x71;const _0xfd3738=a168_0xfd37();let _0x1f8e7a=_0xfd3738[_0x307508];return _0x1f8e7a;}export const sqlExec={'service':a168_0x3f7088(0x7b),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a168_0x3f7088(0x82),'flags':[SQLCODE_FLAG,{'name':a168_0x3f7088(0x85),'type':a168_0x3f7088(0x76),'description':a168_0x3f7088(0x80)}],async 'execute'(_0x40517f){const _0x187ec7=a168_0x3f7088,_0x30cc81=parseJsonParams(_0x40517f[_0x187ec7(0x7d)](_0x187ec7(0x85))),_0x4cbfcc=Date['now'](),_0x2c510f=await executeSql(_0x40517f[_0x187ec7(0x84)],_0x40517f[_0x187ec7(0x7d)](_0x187ec7(0x79)),_0x30cc81),_0x31a20f=Date[_0x187ec7(0x7a)]()-_0x4cbfcc,_0x12f9c3=_0x2c510f?.[_0x187ec7(0x83)]??_0x2c510f,_0x42007a=_0x2c510f?.[_0x187ec7(0x7e)]??!![];if(!_0x42007a)return{'ok':![],'data':{'error':_0x2c510f?.[_0x187ec7(0x74)]||'SQL\x20execution\x20failed','elapsed':_0x31a20f},'message':_0x187ec7(0x89)};const _0x53d177=Array['isArray'](_0x12f9c3)?_0x12f9c3:[];return{'ok':!![],'data':{'rows':_0x53d177,'rowCount':_0x53d177[_0x187ec7(0x8a)],'elapsed':_0x31a20f},'message':_0x187ec7(0x7f)+_0x53d177[_0x187ec7(0x8a)]+_0x187ec7(0x88)+_0x31a20f+'ms'};}};function a168_0xfd37(){const _0x8767c3=['params','2rovsLj','15wmXNds','\x20row(s)\x20in\x20','SQL\x20execution\x20failed','length','629544sPxwpg','26469TeDfnI','111156ddmmIa','1279288xmjVTF','execError','252qEnzyc','string','4347170lHGflC','590107SeLugt','sqlcode','now','sql','29395091mMqSqr','str','execSuccess','Returned\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','2768HkjjCp','read','execResult','appCode'];a168_0xfd37=function(){return _0x8767c3;};return a168_0xfd37();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x55bfcd,_0x1a206e){const _0x27b07a=a169_0x318f,_0x137de2=_0x55bfcd();while(!![]){try{const _0xa37788=-parseInt(_0x27b07a(0x1eb))/0x1*(parseInt(_0x27b07a(0x1ea))/0x2)+parseInt(_0x27b07a(0x1ee))/0x3+parseInt(_0x27b07a(0x1ed))/0x4*(-parseInt(_0x27b07a(0x1e9))/0x5)+parseInt(_0x27b07a(0x1e7))/0x6+parseInt(_0x27b07a(0x1ec))/0x7*(-parseInt(_0x27b07a(0x1e4))/0x8)+parseInt(_0x27b07a(0x1e8))/0x9+-parseInt(_0x27b07a(0x1e6))/0xa*(-parseInt(_0x27b07a(0x1e5))/0xb);if(_0xa37788===_0x1a206e)break;else _0x137de2['push'](_0x137de2['shift']());}catch(_0x39ec1c){_0x137de2['push'](_0x137de2['shift']());}}}(a169_0x54e2,0x5f5b3));import{sqlList}from'../../commands/sql/list.js';function a169_0x54e2(){const _0x23094e=['2362248fCeTdA','6921135hTvaBF','1385SuckGz','2dKfPUl','424823JEjjsT','7pRaRKv','5876yQjhgM','1025625Rusgbe','6066344ASNxKN','193930zaVkZx','270JMcwLI'];a169_0x54e2=function(){return _0x23094e;};return a169_0x54e2();}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';function a169_0x318f(_0x1b35fd,_0x33b001){_0x1b35fd=_0x1b35fd-0x1e4;const _0x54e277=a169_0x54e2();let _0x318fea=_0x54e277[_0x1b35fd];return _0x318fea;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a170_0xc3cca4=a170_0x3165;(function(_0x43c94c,_0xe48048){const _0x592ec6=a170_0x3165,_0x570bba=_0x43c94c();while(!![]){try{const _0x4fe84a=parseInt(_0x592ec6(0x1a2))/0x1*(-parseInt(_0x592ec6(0x18d))/0x2)+parseInt(_0x592ec6(0x196))/0x3*(parseInt(_0x592ec6(0x182))/0x4)+-parseInt(_0x592ec6(0x1a7))/0x5+-parseInt(_0x592ec6(0x186))/0x6+-parseInt(_0x592ec6(0x1a6))/0x7*(parseInt(_0x592ec6(0x18a))/0x8)+parseInt(_0x592ec6(0x191))/0x9*(parseInt(_0x592ec6(0x197))/0xa)+parseInt(_0x592ec6(0x184))/0xb*(parseInt(_0x592ec6(0x19f))/0xc);if(_0x4fe84a===_0xe48048)break;else _0x570bba['push'](_0x570bba['shift']());}catch(_0x504003){_0x570bba['push'](_0x570bba['shift']());}}}(a170_0x1168,0xc6eb6));import{listSqlQueries}from'../../core/api-client.js';function a170_0x3165(_0x4fd679,_0x17869f){_0x4fd679=_0x4fd679-0x182;const _0x116811=a170_0x1168();let _0x316556=_0x116811[_0x4fd679];return _0x316556;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a170_0x1168(){const _0x40adf2=['4101PekcmY','10XcTHUl','description','pagesize','dbId','map','Page\x20size','paging','tableData','60iAwNQP','sqlcode','number','20762RIApfQ','sql','bool','page','1981441evKsGv','6960400BbIHOO','boolean','num','932GivDzY','str','1570382aDVyhR','Filter\x20by\x20SQL\x20name','29994AYEwYu','appCode','List\x20custom\x20SQL\x20queries','length','8RiwoKv','totalCount','No\x20custom\x20SQL\x20queries\x20found.','2kikoDx','name','read','Found\x20','13350213WiZjRI','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','all','\x20SQL\x20queries\x20(total:\x20','list'];a170_0x1168=function(){return _0x40adf2;};return a170_0x1168();}export const sqlList={'service':a170_0xc3cca4(0x1a3),'command':a170_0xc3cca4(0x195),'description':a170_0xc3cca4(0x188),'risk':a170_0xc3cca4(0x18f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a170_0xc3cca4(0x18e),'type':'string','description':a170_0xc3cca4(0x185)},{'name':a170_0xc3cca4(0x1a5),'type':a170_0xc3cca4(0x1a1),'description':'Page\x20number','default':0x1},{'name':a170_0xc3cca4(0x199),'type':'number','description':a170_0xc3cca4(0x19c)},{'name':'verbose','type':a170_0xc3cca4(0x1a8),'description':a170_0xc3cca4(0x192)}],async 'execute'(_0x12a064){const _0x2107f1=a170_0xc3cca4,_0x4162fe=await listSqlQueries(_0x12a064[_0x2107f1(0x187)],{'sqlCode':_0x12a064[_0x2107f1(0x183)](_0x2107f1(0x1a0))||undefined,'sqlName':_0x12a064[_0x2107f1(0x183)](_0x2107f1(0x18e))||undefined,'currentPage':_0x12a064[_0x2107f1(0x1a9)](_0x2107f1(0x1a5)),'pageSize':_0x12a064['num'](_0x2107f1(0x199),0x32)}),_0x40acae=_0x12a064[_0x2107f1(0x1a4)]('verbose'),_0x3d1d87=_0x4162fe[_0x2107f1(0x19e)]??[],_0x133633=_0x4162fe[_0x2107f1(0x19d)]?.[_0x2107f1(0x18b)]??_0x3d1d87[_0x2107f1(0x189)];let _0x259210;return _0x40acae?_0x259210=_0x3d1d87:_0x259210=await Promise[_0x2107f1(0x193)](_0x3d1d87[_0x2107f1(0x19b)](async _0x5009a8=>{const _0xb9ee36=_0x2107f1;let _0x361257;try{_0x361257=_0x5009a8['dbId']?await getDbName(_0x12a064[_0xb9ee36(0x187)],_0x5009a8[_0xb9ee36(0x19a)]):undefined;}catch{}return{'sqlCode':_0x5009a8['sqlCode'],'sqlName':_0x5009a8['sqlName'],'description':_0x5009a8[_0xb9ee36(0x198)]??'','db':_0x361257?_0x361257+'\x20('+_0x5009a8[_0xb9ee36(0x19a)]+')':_0x5009a8[_0xb9ee36(0x19a)]??''};})),{'ok':!![],'data':_0x259210,'message':_0x3d1d87['length']===0x0?_0x2107f1(0x18c):_0x2107f1(0x190)+_0x3d1d87[_0x2107f1(0x189)]+_0x2107f1(0x194)+_0x133633+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a170_0x274dcd=a170_0x2358;(function(_0x18a4cb,_0x1f3af1){const _0x41be13=a170_0x2358,_0xdb8eea=_0x18a4cb();while(!![]){try{const _0x3ce993=parseInt(_0x41be13(0xe8))/0x1+parseInt(_0x41be13(0xfd))/0x2*(-parseInt(_0x41be13(0x124))/0x3)+-parseInt(_0x41be13(0xea))/0x4+parseInt(_0x41be13(0x103))/0x5*(-parseInt(_0x41be13(0x113))/0x6)+-parseInt(_0x41be13(0x112))/0x7+-parseInt(_0x41be13(0xf5))/0x8*(-parseInt(_0x41be13(0xf2))/0x9)+parseInt(_0x41be13(0x126))/0xa;if(_0x3ce993===_0x1f3af1)break;else _0xdb8eea['push'](_0xdb8eea['shift']());}catch(_0x278c97){_0xdb8eea['push'](_0xdb8eea['shift']());}}}(a170_0x8b5f,0x3373e));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';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a170_0x8b5f(){const _0x484e2b=['12709900EVSYdo','dbId','force','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','description','conflict','112006HixJpc','push','1004568xJyvuj','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','pull','bool','Force\x20pull\x20cancelled.','toISOString','lockFilePath','skipped','22527bNApwW','appCode','totalCount','376Hrvnyw','No\x20remote\x20SQL\x20queries\x20matched.','sqlCode','cancelled','would_pull','Force\x20overwrite\x20local\x20unsynced\x20changes','filter','Would\x20pull\x20','2ubkjAO','path','\x20written,\x20','nonInteractive','message','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','915720DXIIHR','paging','sql','write','Pull\x20complete:\x20','boolean','sqlContent','name','test','mybatisXml','local\x20differs\x20from\x20remote','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqls','split','unchanged','2362052tIQIWH','12btUIiF','utf8','sqlName','catch','replace','Filter\x20by\x20SQL\x20display\x20name','length','\x20SQL\x20file(s)\x20into\x20','sqlRootDir','join','\x20skipped,\x20','sqlcode','\x20failed','apps','POST','trimStart','sqlRoot','1005063rrzkRg','str'];a170_0x8b5f=function(){return _0x484e2b;};return a170_0x8b5f();}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(_0x42ba8b,_0x11e994){const _0x5bbaa0=a170_0x2358,_0x59f511=[];let _0x310783=0x1;while(!![]){const _0x27f592=await listSqlQueries(_0x42ba8b,{'currentPage':_0x310783,'pageSize':PAGE_SIZE,'sqlCode':_0x11e994[_0x5bbaa0(0xf7)],'sqlName':_0x11e994[_0x5bbaa0(0x115)]}),_0x4bb413=_0x27f592['tableData']??[];_0x59f511[_0x5bbaa0(0xe9)](..._0x4bb413);if(_0x4bb413[_0x5bbaa0(0x119)]===0x0)break;const _0x2fb30b=_0x27f592[_0x5bbaa0(0x104)]?.[_0x5bbaa0(0xf4)];if(_0x2fb30b!=null?_0x59f511[_0x5bbaa0(0x119)]>=_0x2fb30b:_0x4bb413[_0x5bbaa0(0x119)]<PAGE_SIZE)break;_0x310783++;}return _0x59f511;}async function ensureSqlContent(_0x37dc63){const _0x1e1e2d=a170_0x2358;if(_0x37dc63[_0x1e1e2d(0x109)]!=null&&String(_0x37dc63[_0x1e1e2d(0x109)])['length']>0x0)return _0x37dc63;return getSqlQueryDetail(_0x37dc63[_0x1e1e2d(0xf7)]);}function a170_0x2358(_0x25a9dd,_0x52668c){_0x25a9dd=_0x25a9dd-0xe5;const _0x8b5f3a=a170_0x8b5f();let _0x235843=_0x8b5f3a[_0x25a9dd];return _0x235843;}export const sqlPull={'service':a170_0x274dcd(0x105),'command':a170_0x274dcd(0xec),'description':a170_0x274dcd(0x10e),'risk':a170_0x274dcd(0x106),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a170_0x274dcd(0x10a),'type':'string','description':a170_0x274dcd(0x118)},{'name':a170_0x274dcd(0x128),'type':a170_0x274dcd(0x108),'description':a170_0x274dcd(0xfa)}],async 'dryRun'(_0x222e13){const _0x4c0e7a=a170_0x274dcd,_0x41912a=loadSqlProjectConfig(_0x222e13[_0x4c0e7a(0xf3)]),_0xdd9f86=await readSqlLockFile(_0x41912a[_0x4c0e7a(0xf0)]),{appLock:_0x2f13c7}=ensureSqlLockScope(_0xdd9f86??createEmptySqlLock(),_0x41912a[_0x4c0e7a(0xf3)],_0x41912a[_0x4c0e7a(0x123)],_0x4c0e7a(0xec)),_0x457172=await fetchAllSqlQueries(_0x222e13[_0x4c0e7a(0xf3)],{'sqlCode':_0x222e13['str']('sqlcode')||undefined,'sqlName':_0x222e13[_0x4c0e7a(0x125)]('name')||undefined}),_0x2f9afd=[];for(const _0x11d920 of _0x457172){const _0x14b549=await ensureSqlContent(_0x11d920),_0x54e662=ensureRemoteSqlContent(_0x14b549),_0x35ff06=detectModeFromSql(_0x14b549),_0x2f594b=_0x14b549[_0x4c0e7a(0x127)]?await getDbName(_0x222e13[_0x4c0e7a(0xf3)],Number(_0x14b549[_0x4c0e7a(0x127)]))[_0x4c0e7a(0x116)](()=>undefined):undefined,_0xaa91b0=buildLocalSqlFileContent({'sqlCode':_0x14b549['sqlCode'],'sqlName':_0x14b549[_0x4c0e7a(0x115)],'dbId':_0x14b549['dbId']},_0x54e662,{'dbName':_0x2f594b,'mode':_0x35ff06,'syncedAt':new Date()['toISOString'](),'description':_0x14b549[_0x4c0e7a(0xe6)]}),_0x3e0b92=buildSqlLockEntry(_0x14b549,_0x54e662,'',{'dbName':_0x2f594b}),_0x28df88=resolveLocalSqlFilePath(_0x41912a,_0x14b549[_0x4c0e7a(0xf7)],_0x3e0b92);let _0x236f2e=_0x4c0e7a(0xf9),_0x2475f5;if(await fileExists(_0x28df88)){const _0x19f8fb=await readFile(_0x28df88,_0x4c0e7a(0x114));isEquivalentPulledSqlFile(_0x19f8fb,_0xaa91b0,_0x35ff06)?(_0x236f2e=_0x4c0e7a(0xf1),_0x2475f5=_0x4c0e7a(0x111)):(_0x236f2e=_0x4c0e7a(0xe7),_0x2475f5=_0x4c0e7a(0xe5));}_0x2f9afd[_0x4c0e7a(0xe9)]({'sqlCode':_0x14b549[_0x4c0e7a(0xf7)],'sqlName':_0x14b549[_0x4c0e7a(0x115)],'filePath':_0x28df88,'status':_0x236f2e,'reason':_0x2475f5});}return{'method':_0x4c0e7a(0x121),'url':_0x4c0e7a(0x102),'body':{'appCode':_0x222e13[_0x4c0e7a(0xf3)],'sqlCode':_0x222e13[_0x4c0e7a(0x125)](_0x4c0e7a(0x11e))||null,'sqlName':_0x222e13[_0x4c0e7a(0x125)]('name')||null,'files':_0x2f9afd},'description':_0x4c0e7a(0xfc)+_0x2f9afd[_0x4c0e7a(0x119)]+_0x4c0e7a(0x11a)+_0x41912a[_0x4c0e7a(0x11b)]};},async 'execute'(_0x353e20){const _0x16f2af=a170_0x274dcd,_0x2d299d=loadSqlProjectConfig(_0x353e20[_0x16f2af(0xf3)]),_0x34e1ff=await readSqlLockFile(_0x2d299d[_0x16f2af(0xf0)]),{lockData:_0x2830b9,appLock:_0x1522c8}=ensureSqlLockScope(_0x34e1ff??createEmptySqlLock(),_0x2d299d[_0x16f2af(0xf3)],_0x2d299d[_0x16f2af(0x123)],_0x16f2af(0xec)),_0x4cd54e=_0x353e20[_0x16f2af(0xed)](_0x16f2af(0x128)),_0x3f511e=await fetchAllSqlQueries(_0x353e20[_0x16f2af(0xf3)],{'sqlCode':_0x353e20[_0x16f2af(0x125)](_0x16f2af(0x11e))||undefined,'sqlName':_0x353e20[_0x16f2af(0x125)](_0x16f2af(0x10a))||undefined});if(_0x3f511e[_0x16f2af(0x119)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x16f2af(0xf6)};const _0x426284=[],_0x3bfccd=[];for(const _0x18b79f of _0x3f511e){try{_0x426284[_0x16f2af(0xe9)](await ensureSqlContent(_0x18b79f));}catch(_0xef23dd){_0x3bfccd[_0x16f2af(0xe9)]({'sqlCode':_0x18b79f[_0x16f2af(0xf7)],'error':_0xef23dd instanceof Error?_0xef23dd['message']:String(_0xef23dd)});}}if(_0x4cd54e&&!_0x353e20[_0x16f2af(0x100)]){let _0x4b8744=![];for(const _0x339ff5 of _0x426284){const _0x4ade4f=detectModeFromSql(_0x339ff5),_0x5809dc=_0x339ff5[_0x16f2af(0x127)]?await getDbName(_0x353e20['appCode'],Number(_0x339ff5['dbId']))['catch'](()=>undefined):undefined,_0x102de6=buildLocalSqlFileContent({'sqlCode':_0x339ff5['sqlCode'],'sqlName':_0x339ff5[_0x16f2af(0x115)],'dbId':_0x339ff5[_0x16f2af(0x127)]},ensureRemoteSqlContent(_0x339ff5),{'dbName':_0x5809dc,'mode':_0x4ade4f,'syncedAt':new Date()[_0x16f2af(0xef)](),'description':_0x339ff5[_0x16f2af(0xe6)]}),_0x55c3e4=resolveLocalSqlFilePath(_0x2d299d,_0x339ff5[_0x16f2af(0xf7)],buildSqlLockEntry(_0x339ff5,ensureRemoteSqlContent(_0x339ff5),'',{'dbName':_0x5809dc}));if(await fileExists(_0x55c3e4)){const _0x577acd=await readFile(_0x55c3e4,_0x16f2af(0x114));if(!isEquivalentPulledSqlFile(_0x577acd,_0x102de6,_0x4ade4f)){_0x4b8744=!![];break;}}}if(_0x4b8744){const _0x338c10=await confirmForceOverwrite(_0x16f2af(0xeb));if(!_0x338c10)throw CliErrors[_0x16f2af(0xf8)](_0x16f2af(0xee));}}const _0x5e3c2b=cloneSqlLockData(_0x2830b9),_0x20f535=_0x5e3c2b[_0x16f2af(0x120)][_0x2d299d[_0x16f2af(0xf3)]],_0x3f8a82=[],_0x142540=[];for(const _0x4a948f of _0x426284){const _0x20fb95=_0x20f535[_0x16f2af(0x10f)][_0x4a948f['sqlCode']],_0x22cd78=ensureRemoteSqlContent(_0x4a948f),_0x2f32dc=detectModeFromSql(_0x4a948f),_0x2ce320=_0x4a948f[_0x16f2af(0x127)]?await getDbName(_0x353e20['appCode'],Number(_0x4a948f[_0x16f2af(0x127)]))['catch'](()=>undefined):undefined,_0x3a8234=buildLocalSqlFileContent({'sqlCode':_0x4a948f['sqlCode'],'sqlName':_0x4a948f[_0x16f2af(0x115)],'dbId':_0x4a948f['dbId']},_0x22cd78,{'dbName':_0x2ce320,'mode':_0x2f32dc,'syncedAt':new Date()[_0x16f2af(0xef)](),'description':_0x4a948f['description']}),_0x338954=buildSqlLockEntry(_0x4a948f,_0x22cd78,computeSqlContentHash(_0x3a8234),{'dbName':_0x2ce320}),_0x4b2c4b=_0x338954[_0x16f2af(0xfe)],_0x3fab41=join(_0x2d299d['sqlRootDir'],_0x4b2c4b);try{if(await fileExists(_0x3fab41)){const _0xa708df=await readFile(_0x3fab41,'utf8');if(isEquivalentPulledSqlFile(_0xa708df,_0x3a8234,_0x2f32dc)){_0x142540[_0x16f2af(0xe9)]({'sqlCode':_0x4a948f['sqlCode'],'reason':_0x16f2af(0x111)}),_0x20f535['sqls'][_0x4a948f['sqlCode']]={..._0x338954,'hash':computeSqlContentHash(_0xa708df),'path':_0x4b2c4b};continue;}if(!_0x4cd54e){_0x142540['push']({'sqlCode':_0x4a948f[_0x16f2af(0xf7)],'reason':_0x16f2af(0x10d)});continue;}}const _0x37cbd5=_0x20fb95?.[_0x16f2af(0xfe)]?join(_0x2d299d[_0x16f2af(0x11b)],_0x20fb95[_0x16f2af(0xfe)]):undefined;_0x37cbd5&&_0x37cbd5!==_0x3fab41&&await fileExists(_0x37cbd5)&&await rm(_0x37cbd5,{'force':!![]}),await ensureParentDirectory(_0x3fab41),await writeFile(_0x3fab41,_0x3a8234,_0x16f2af(0x114)),_0x20f535[_0x16f2af(0x10f)][_0x4a948f['sqlCode']]={..._0x338954,'path':_0x4b2c4b},_0x3f8a82[_0x16f2af(0xe9)]({'sqlCode':_0x4a948f[_0x16f2af(0xf7)],'filePath':_0x3fab41});}catch(_0x50ef2d){_0x3bfccd[_0x16f2af(0xe9)]({'sqlCode':_0x4a948f[_0x16f2af(0xf7)],'error':_0x50ef2d instanceof Error?_0x50ef2d[_0x16f2af(0x101)]:String(_0x50ef2d)});}}return _0x20f535['lastSync']=new Date()[_0x16f2af(0xef)](),await writeSqlLockFile(_0x2d299d['lockFilePath'],_0x5e3c2b),{'ok':_0x3bfccd[_0x16f2af(0x119)]===0x0,'data':{'pulled':_0x3f8a82,'skipped':_0x142540,'failed':_0x3bfccd},'message':_0x16f2af(0x107)+_0x3f8a82['length']+_0x16f2af(0xff)+_0x142540[_0x16f2af(0x119)]+_0x16f2af(0x11d)+_0x3bfccd[_0x16f2af(0x119)]+_0x16f2af(0x11f)};}};function detectModeFromSql(_0x5281c1){const _0x376cf4=a170_0x274dcd,_0x4e62c0=ensureRemoteSqlContent(_0x5281c1),_0x53410c=stripLocalSqlMetadata(_0x4e62c0,_0x376cf4(0x10c))[_0x376cf4(0x122)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x53410c))return'mybatisXml';return'sql';}function isEquivalentPulledSqlFile(_0x287ae6,_0x377439,_0x497902){return normalizePullComparableContent(_0x287ae6,_0x497902)===normalizePullComparableContent(_0x377439,_0x497902);}function normalizePullComparableContent(_0x5331c5,_0x562ca0){const _0x57da0c=a170_0x274dcd,_0x1aa834=_0x5331c5[_0x57da0c(0x117)](/\r\n/g,'\x0a')[_0x57da0c(0x110)]('\x0a'),_0x408067=_0x1aa834[_0x57da0c(0xfb)](_0x13445d=>!isSyncedAtMetadataLine(_0x13445d,_0x562ca0));return _0x408067[_0x57da0c(0x11c)]('\x0a');}function isSyncedAtMetadataLine(_0x135de2,_0x3d7171){const _0x197569=a170_0x274dcd;if(_0x3d7171===_0x197569(0x10c))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x197569(0x10b)](_0x135de2);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x197569(0x10b)](_0x135de2);}
|
|
1
|
+
const a171_0x21510c=a171_0x42a9;(function(_0x2c773d,_0xee39b0){const _0x168d05=a171_0x42a9,_0x1f344f=_0x2c773d();while(!![]){try{const _0x5174f2=parseInt(_0x168d05(0x108))/0x1+-parseInt(_0x168d05(0x101))/0x2*(-parseInt(_0x168d05(0x133))/0x3)+-parseInt(_0x168d05(0x106))/0x4*(-parseInt(_0x168d05(0x122))/0x5)+parseInt(_0x168d05(0x125))/0x6*(parseInt(_0x168d05(0x13c))/0x7)+-parseInt(_0x168d05(0x11e))/0x8+parseInt(_0x168d05(0x12d))/0x9+-parseInt(_0x168d05(0x11b))/0xa;if(_0x5174f2===_0xee39b0)break;else _0x1f344f['push'](_0x1f344f['shift']());}catch(_0x1f4d51){_0x1f344f['push'](_0x1f344f['shift']());}}}(a171_0x4622,0x7d3f1));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a171_0x4622(){const _0x535528=['string','515163BilkXb','apps','mybatisXml','\x20SQL\x20file(s)\x20into\x20','totalCount','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','description','would_pull','bool','No\x20remote\x20SQL\x20queries\x20matched.','appCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqls','paging','conflict','toISOString','dbId','sql','sqlcode','11290500GmEbLf','sqlRootDir','length','3569808nlxXrt','push','lockFilePath','Force\x20pull\x20cancelled.','150460OkfCNy','nonInteractive','name','24wshUHg','sqlCode','tableData','utf8','\x20skipped,\x20','sqlName','test','Filter\x20by\x20SQL\x20display\x20name','1132299BgWYVr','sqlRoot','message','POST','join','force','3EhIMQw','cancelled','catch','filter','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','replace','unchanged','split','\x20written,\x20','979391TXUEbX','Pull\x20complete:\x20','str','\x20failed','391086uzsvNd','sqlContent','lastSync','path','boolean','92QLAaLx'];a171_0x4622=function(){return _0x535528;};return a171_0x4622();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x7b7f5a,_0xb129f6){const _0x520295=a171_0x42a9,_0x466c04=[];let _0x4e423c=0x1;while(!![]){const _0x3971c8=await listSqlQueries(_0x7b7f5a,{'currentPage':_0x4e423c,'pageSize':PAGE_SIZE,'sqlCode':_0xb129f6[_0x520295(0x126)],'sqlName':_0xb129f6[_0x520295(0x12a)]}),_0x6c842=_0x3971c8[_0x520295(0x127)]??[];_0x466c04[_0x520295(0x11f)](..._0x6c842);if(_0x6c842[_0x520295(0x11d)]===0x0)break;const _0x543855=_0x3971c8[_0x520295(0x115)]?.[_0x520295(0x10c)];if(_0x543855!=null?_0x466c04['length']>=_0x543855:_0x6c842[_0x520295(0x11d)]<PAGE_SIZE)break;_0x4e423c++;}return _0x466c04;}async function ensureSqlContent(_0x5d738c){const _0x2d4933=a171_0x42a9;if(_0x5d738c['sqlContent']!=null&&String(_0x5d738c[_0x2d4933(0x102)])[_0x2d4933(0x11d)]>0x0)return _0x5d738c;return getSqlQueryDetail(_0x5d738c['sqlCode']);}function a171_0x42a9(_0x35521b,_0x59ae5c){_0x35521b=_0x35521b-0xff;const _0x46221f=a171_0x4622();let _0x42a9f9=_0x46221f[_0x35521b];return _0x42a9f9;}export const sqlPull={'service':a171_0x21510c(0x119),'command':'pull','description':a171_0x21510c(0x113),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x21510c(0x124),'type':a171_0x21510c(0x107),'description':a171_0x21510c(0x12c)},{'name':'force','type':a171_0x21510c(0x105),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x29dd6a){const _0x526514=a171_0x21510c,_0x2f804a=loadSqlProjectConfig(_0x29dd6a[_0x526514(0x112)]),_0x53ca3e=await readSqlLockFile(_0x2f804a['lockFilePath']),{appLock:_0x51c9cb}=ensureSqlLockScope(_0x53ca3e??createEmptySqlLock(),_0x2f804a[_0x526514(0x112)],_0x2f804a[_0x526514(0x12e)],'pull'),_0x3c21d4=await fetchAllSqlQueries(_0x29dd6a[_0x526514(0x112)],{'sqlCode':_0x29dd6a['str'](_0x526514(0x11a))||undefined,'sqlName':_0x29dd6a[_0x526514(0xff)](_0x526514(0x124))||undefined}),_0x3c6ad8=[];for(const _0x5d05f5 of _0x3c21d4){const _0x17c0ad=await ensureSqlContent(_0x5d05f5),_0x2a94ce=ensureRemoteSqlContent(_0x17c0ad),_0x3fead7=detectModeFromSql(_0x17c0ad),_0x1301c0=_0x17c0ad[_0x526514(0x118)]?await getDbName(_0x29dd6a[_0x526514(0x112)],Number(_0x17c0ad[_0x526514(0x118)]))[_0x526514(0x135)](()=>undefined):undefined,_0x1372a0=buildLocalSqlFileContent({'sqlCode':_0x17c0ad[_0x526514(0x126)],'sqlName':_0x17c0ad[_0x526514(0x12a)],'dbId':_0x17c0ad[_0x526514(0x118)]},_0x2a94ce,{'dbName':_0x1301c0,'mode':_0x3fead7,'syncedAt':new Date()['toISOString'](),'description':_0x17c0ad['description']}),_0x4992c5=buildSqlLockEntry(_0x17c0ad,_0x2a94ce,'',{'dbName':_0x1301c0}),_0x417895=resolveLocalSqlFilePath(_0x2f804a,_0x17c0ad[_0x526514(0x126)],_0x4992c5);let _0x2e3d3d=_0x526514(0x10f),_0x2604e0;if(await fileExists(_0x417895)){const _0x50a9a1=await readFile(_0x417895,_0x526514(0x128));isEquivalentPulledSqlFile(_0x50a9a1,_0x1372a0,_0x3fead7)?(_0x2e3d3d='skipped',_0x2604e0='unchanged'):(_0x2e3d3d=_0x526514(0x116),_0x2604e0=_0x526514(0x10d));}_0x3c6ad8[_0x526514(0x11f)]({'sqlCode':_0x17c0ad[_0x526514(0x126)],'sqlName':_0x17c0ad[_0x526514(0x12a)],'filePath':_0x417895,'status':_0x2e3d3d,'reason':_0x2604e0});}return{'method':_0x526514(0x130),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x29dd6a[_0x526514(0x112)],'sqlCode':_0x29dd6a[_0x526514(0xff)](_0x526514(0x11a))||null,'sqlName':_0x29dd6a[_0x526514(0xff)](_0x526514(0x124))||null,'files':_0x3c6ad8},'description':'Would\x20pull\x20'+_0x3c6ad8[_0x526514(0x11d)]+_0x526514(0x10b)+_0x2f804a[_0x526514(0x11c)]};},async 'execute'(_0x526c5b){const _0x28a7bf=a171_0x21510c,_0x1b32ef=loadSqlProjectConfig(_0x526c5b[_0x28a7bf(0x112)]),_0x243215=await readSqlLockFile(_0x1b32ef[_0x28a7bf(0x120)]),{lockData:_0x276e89,appLock:_0x222f42}=ensureSqlLockScope(_0x243215??createEmptySqlLock(),_0x1b32ef['appCode'],_0x1b32ef[_0x28a7bf(0x12e)],'pull'),_0x3a4f5d=_0x526c5b[_0x28a7bf(0x110)](_0x28a7bf(0x132)),_0xf38bec=await fetchAllSqlQueries(_0x526c5b['appCode'],{'sqlCode':_0x526c5b[_0x28a7bf(0xff)]('sqlcode')||undefined,'sqlName':_0x526c5b[_0x28a7bf(0xff)](_0x28a7bf(0x124))||undefined});if(_0xf38bec['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x28a7bf(0x111)};const _0x39d75b=[],_0x42c3c7=[];for(const _0x5734a8 of _0xf38bec){try{_0x39d75b[_0x28a7bf(0x11f)](await ensureSqlContent(_0x5734a8));}catch(_0xa65193){_0x42c3c7[_0x28a7bf(0x11f)]({'sqlCode':_0x5734a8[_0x28a7bf(0x126)],'error':_0xa65193 instanceof Error?_0xa65193[_0x28a7bf(0x12f)]:String(_0xa65193)});}}if(_0x3a4f5d&&!_0x526c5b[_0x28a7bf(0x123)]){let _0x16c74e=![];for(const _0x583147 of _0x39d75b){const _0x4be860=detectModeFromSql(_0x583147),_0x17fc38=_0x583147['dbId']?await getDbName(_0x526c5b['appCode'],Number(_0x583147['dbId']))[_0x28a7bf(0x135)](()=>undefined):undefined,_0x14e27b=buildLocalSqlFileContent({'sqlCode':_0x583147['sqlCode'],'sqlName':_0x583147['sqlName'],'dbId':_0x583147[_0x28a7bf(0x118)]},ensureRemoteSqlContent(_0x583147),{'dbName':_0x17fc38,'mode':_0x4be860,'syncedAt':new Date()[_0x28a7bf(0x117)](),'description':_0x583147['description']}),_0x2b3461=resolveLocalSqlFilePath(_0x1b32ef,_0x583147[_0x28a7bf(0x126)],buildSqlLockEntry(_0x583147,ensureRemoteSqlContent(_0x583147),'',{'dbName':_0x17fc38}));if(await fileExists(_0x2b3461)){const _0x363c78=await readFile(_0x2b3461,_0x28a7bf(0x128));if(!isEquivalentPulledSqlFile(_0x363c78,_0x14e27b,_0x4be860)){_0x16c74e=!![];break;}}}if(_0x16c74e){const _0x58817c=await confirmForceOverwrite(_0x28a7bf(0x137));if(!_0x58817c)throw CliErrors[_0x28a7bf(0x134)](_0x28a7bf(0x121));}}const _0x3e405c=cloneSqlLockData(_0x276e89),_0x2814d2=_0x3e405c[_0x28a7bf(0x109)][_0x1b32ef['appCode']],_0x5f2a17=[],_0x32e845=[];for(const _0x216e7a of _0x39d75b){const _0x4a408e=_0x2814d2[_0x28a7bf(0x114)][_0x216e7a[_0x28a7bf(0x126)]],_0x5813ec=ensureRemoteSqlContent(_0x216e7a),_0x282051=detectModeFromSql(_0x216e7a),_0x1fb912=_0x216e7a[_0x28a7bf(0x118)]?await getDbName(_0x526c5b[_0x28a7bf(0x112)],Number(_0x216e7a[_0x28a7bf(0x118)]))[_0x28a7bf(0x135)](()=>undefined):undefined,_0x39dfbe=buildLocalSqlFileContent({'sqlCode':_0x216e7a['sqlCode'],'sqlName':_0x216e7a[_0x28a7bf(0x12a)],'dbId':_0x216e7a[_0x28a7bf(0x118)]},_0x5813ec,{'dbName':_0x1fb912,'mode':_0x282051,'syncedAt':new Date()[_0x28a7bf(0x117)](),'description':_0x216e7a[_0x28a7bf(0x10e)]}),_0x474c45=buildSqlLockEntry(_0x216e7a,_0x5813ec,computeSqlContentHash(_0x39dfbe),{'dbName':_0x1fb912}),_0x361e24=_0x474c45[_0x28a7bf(0x104)],_0x2208e2=join(_0x1b32ef['sqlRootDir'],_0x361e24);try{if(await fileExists(_0x2208e2)){const _0x1c7ceb=await readFile(_0x2208e2,_0x28a7bf(0x128));if(isEquivalentPulledSqlFile(_0x1c7ceb,_0x39dfbe,_0x282051)){_0x32e845[_0x28a7bf(0x11f)]({'sqlCode':_0x216e7a['sqlCode'],'reason':_0x28a7bf(0x139)}),_0x2814d2[_0x28a7bf(0x114)][_0x216e7a[_0x28a7bf(0x126)]]={..._0x474c45,'hash':computeSqlContentHash(_0x1c7ceb),'path':_0x361e24};continue;}if(!_0x3a4f5d){_0x32e845[_0x28a7bf(0x11f)]({'sqlCode':_0x216e7a[_0x28a7bf(0x126)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x1da3c=_0x4a408e?.[_0x28a7bf(0x104)]?join(_0x1b32ef[_0x28a7bf(0x11c)],_0x4a408e[_0x28a7bf(0x104)]):undefined;_0x1da3c&&_0x1da3c!==_0x2208e2&&await fileExists(_0x1da3c)&&await rm(_0x1da3c,{'force':!![]}),await ensureParentDirectory(_0x2208e2),await writeFile(_0x2208e2,_0x39dfbe,_0x28a7bf(0x128)),_0x2814d2[_0x28a7bf(0x114)][_0x216e7a[_0x28a7bf(0x126)]]={..._0x474c45,'path':_0x361e24},_0x5f2a17['push']({'sqlCode':_0x216e7a[_0x28a7bf(0x126)],'filePath':_0x2208e2});}catch(_0xc8b1c){_0x42c3c7[_0x28a7bf(0x11f)]({'sqlCode':_0x216e7a[_0x28a7bf(0x126)],'error':_0xc8b1c instanceof Error?_0xc8b1c['message']:String(_0xc8b1c)});}}return _0x2814d2[_0x28a7bf(0x103)]=new Date()[_0x28a7bf(0x117)](),await writeSqlLockFile(_0x1b32ef[_0x28a7bf(0x120)],_0x3e405c),{'ok':_0x42c3c7[_0x28a7bf(0x11d)]===0x0,'data':{'pulled':_0x5f2a17,'skipped':_0x32e845,'failed':_0x42c3c7},'message':_0x28a7bf(0x13d)+_0x5f2a17[_0x28a7bf(0x11d)]+_0x28a7bf(0x13b)+_0x32e845[_0x28a7bf(0x11d)]+_0x28a7bf(0x129)+_0x42c3c7[_0x28a7bf(0x11d)]+_0x28a7bf(0x100)};}};function detectModeFromSql(_0x2ac638){const _0x23d0c0=a171_0x21510c,_0x53aeb8=ensureRemoteSqlContent(_0x2ac638),_0x503525=stripLocalSqlMetadata(_0x53aeb8,_0x23d0c0(0x10a))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x23d0c0(0x12b)](_0x503525))return'mybatisXml';return _0x23d0c0(0x119);}function isEquivalentPulledSqlFile(_0x20c840,_0x16c59e,_0x3615cf){return normalizePullComparableContent(_0x20c840,_0x3615cf)===normalizePullComparableContent(_0x16c59e,_0x3615cf);}function normalizePullComparableContent(_0x42fe98,_0x1af20e){const _0x50e89c=a171_0x21510c,_0x4d3ba7=_0x42fe98[_0x50e89c(0x138)](/\r\n/g,'\x0a')[_0x50e89c(0x13a)]('\x0a'),_0x2cc19c=_0x4d3ba7[_0x50e89c(0x136)](_0x74f792=>!isSyncedAtMetadataLine(_0x74f792,_0x1af20e));return _0x2cc19c[_0x50e89c(0x131)]('\x0a');}function isSyncedAtMetadataLine(_0x25553a,_0x407c1e){const _0x49b8a3=a171_0x21510c;if(_0x407c1e===_0x49b8a3(0x10a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x49b8a3(0x12b)](_0x25553a);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x49b8a3(0x12b)](_0x25553a);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a171_0x5d2063=a171_0x4b0b;function a171_0x4b0b(_0x5b357f,_0x56a17a){_0x5b357f=_0x5b357f-0xd5;const _0x5e28ef=a171_0x5e28();let _0x4b0bc3=_0x5e28ef[_0x5b357f];return _0x4b0bc3;}(function(_0x209f05,_0x1d9a70){const _0x3d90b0=a171_0x4b0b,_0x2929a6=_0x209f05();while(!![]){try{const _0x21bf45=-parseInt(_0x3d90b0(0x111))/0x1+parseInt(_0x3d90b0(0xde))/0x2+parseInt(_0x3d90b0(0xec))/0x3*(-parseInt(_0x3d90b0(0xf6))/0x4)+-parseInt(_0x3d90b0(0xfb))/0x5+parseInt(_0x3d90b0(0xdb))/0x6+parseInt(_0x3d90b0(0xd7))/0x7*(-parseInt(_0x3d90b0(0xf9))/0x8)+parseInt(_0x3d90b0(0xe0))/0x9*(parseInt(_0x3d90b0(0xf8))/0xa);if(_0x21bf45===_0x1d9a70)break;else _0x2929a6['push'](_0x2929a6['shift']());}catch(_0x20440b){_0x2929a6['push'](_0x2929a6['shift']());}}}(a171_0x5e28,0x8b234));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a171_0x5e28(){const _0x565984=['exec','trashDir','sqlRoot','replace','entries','set','remoteId','map','Local\x20directory\x20\x22','relativePath','appCode','Would\x20push\x20','path','No\x20database\x20matches\x20local\x20directory\x20\x22','/smartapi/custom/updateUserCustomSql','sqlRootDir','sqlName','hash','589720HOvKqo','lastSync','POST','lockFilePath','28vsNblD','Push\x20local\x20SQL\x20files\x20to\x20remote','unchanged','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','4266804fjKHBp','version','Local\x20SQL\x20not\x20found:\x20','1774262hgpfoL','join','720qeooTx','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqlcode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','\x20SQL\x20file(s)','length','dbId','bool','push','message','mode','str','3lUoejy','validation','has','force','dbName','sqlCode','high-risk-write','sqls','toISOString','\x22\x20for\x20sqlCode\x20','1222116jsHaEK','filter','87450OHKlHP','1124568VPsCpZ','get','1352120oeLmGI','catch','\x20failed','filePath'];a171_0x5e28=function(){return _0x565984;};return a171_0x5e28();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x3aff45,_0x35d2f5,_0x579b68){const _0x5323fe=a171_0x4b0b,_0x508464=await scanLocalSqlQueries(_0x3aff45),_0x387f59=new Map();for(const _0x164f6f of _0x508464){if(_0x579b68&&_0x164f6f[_0x5323fe(0xf1)]!==_0x579b68)continue;const _0x44accc=_0x387f59[_0x5323fe(0xfa)](_0x164f6f[_0x5323fe(0xf1)])??[];_0x44accc['push'](_0x164f6f),_0x387f59[_0x5323fe(0x104)](_0x164f6f[_0x5323fe(0xf1)],_0x44accc);}if(_0x579b68&&!_0x387f59[_0x5323fe(0xee)](_0x579b68))throw CliErrors[_0x5323fe(0xed)](_0x5323fe(0xdd)+_0x579b68);const _0x50aed3=[];for(const [_0x49964f,_0x53fbe0]of _0x387f59[_0x5323fe(0x103)]()){if(_0x53fbe0['length']===0x1){_0x50aed3['push'](_0x53fbe0[0x0]);continue;}const _0x4c57c6=_0x35d2f5[_0x5323fe(0xf3)][_0x49964f],_0x2b27ca=_0x4c57c6?.[_0x5323fe(0x10b)],_0xc8c9d7=_0x2b27ca?_0x53fbe0[_0x5323fe(0xf7)](_0xa0e85e=>_0xa0e85e[_0x5323fe(0x108)]!==_0x2b27ca):_0x53fbe0;if(_0x4c57c6&&_0xc8c9d7['length']===0x1){_0x50aed3['push'](_0xc8c9d7[0x0]);continue;}throw CliErrors[_0x5323fe(0xed)](_0x5323fe(0xda)+_0x49964f+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x50aed3;}export const sqlPush={'service':'sql','command':a171_0x5d2063(0xe8),'description':a171_0x5d2063(0xd8),'risk':a171_0x5d2063(0xf2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x5d2063(0xef),'type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x44ed05){const _0x48fcd6=a171_0x5d2063,_0x3105e3=loadSqlProjectConfig(_0x44ed05[_0x48fcd6(0x109)]),_0x3d1bd0=await readSqlLockFile(_0x3105e3[_0x48fcd6(0xd6)]),{appLock:_0x5e9245}=ensureSqlLockScope(_0x3d1bd0??createEmptySqlLock(),_0x44ed05[_0x48fcd6(0x109)],_0x3105e3[_0x48fcd6(0x101)],_0x48fcd6(0xe8)),_0x296c0a=await getTargetSqlQueries(_0x3105e3,_0x5e9245,_0x44ed05[_0x48fcd6(0xeb)](_0x48fcd6(0xe2))||undefined),_0x3b2cee=[];for(const _0x162d90 of _0x296c0a){const _0x6ae8b8=await computeSqlFileHash(_0x162d90[_0x48fcd6(0xfe)]),_0x192bef=_0x5e9245[_0x48fcd6(0xf3)][_0x162d90[_0x48fcd6(0xf1)]],_0x533e98=!!_0x192bef&&(_0x192bef['path']!==_0x162d90[_0x48fcd6(0x108)]||!!_0x162d90[_0x48fcd6(0x10f)]&&_0x192bef[_0x48fcd6(0x10f)]!==_0x162d90['sqlName']);if(!_0x44ed05[_0x48fcd6(0xe7)](_0x48fcd6(0xef))&&_0x192bef&&_0x192bef[_0x48fcd6(0x110)]===_0x6ae8b8&&!_0x533e98)continue;_0x3b2cee[_0x48fcd6(0xe8)](_0x162d90[_0x48fcd6(0xf1)]);}return{'method':_0x48fcd6(0xd5),'url':_0x48fcd6(0x10d),'body':{'sqlCodes':_0x3b2cee,'appCode':_0x44ed05[_0x48fcd6(0x109)]},'description':_0x48fcd6(0x10a)+_0x3b2cee[_0x48fcd6(0xe5)]+_0x48fcd6(0xe4)};},async 'execute'(_0x5c7728){const _0x25db0e=a171_0x5d2063,_0x11ba51=loadSqlProjectConfig(_0x5c7728[_0x25db0e(0x109)]),_0x2631ff=await readSqlLockFile(_0x11ba51[_0x25db0e(0xd6)]),{lockData:_0x654c52,appLock:_0x5b7d7f}=ensureSqlLockScope(_0x2631ff??createEmptySqlLock(),_0x5c7728['appCode'],_0x11ba51[_0x25db0e(0x101)],_0x25db0e(0xe8)),_0x1d15d7=await getTargetSqlQueries(_0x11ba51,_0x5b7d7f,_0x5c7728[_0x25db0e(0xeb)](_0x25db0e(0xe2))||undefined);if(_0x1d15d7[_0x25db0e(0xe5)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3a2117=[],_0x1fe9b7=[],_0x571a94=[];for(const _0x146ba1 of _0x1d15d7){const _0x130275=_0x5b7d7f[_0x25db0e(0xf3)][_0x146ba1[_0x25db0e(0xf1)]];if(!_0x130275){_0x571a94[_0x25db0e(0xe8)]({'sqlCode':_0x146ba1['sqlCode'],'error':_0x25db0e(0xe1)});continue;}try{const _0x3ace63=await computeSqlFileHash(_0x146ba1['filePath']),_0x157f12=_0x130275[_0x25db0e(0x10b)]!==_0x146ba1[_0x25db0e(0x108)]||!!_0x146ba1['sqlName']&&_0x130275[_0x25db0e(0x10f)]!==_0x146ba1['sqlName'];if(!_0x5c7728[_0x25db0e(0xe7)](_0x25db0e(0xef))&&_0x130275[_0x25db0e(0x110)]===_0x3ace63&&!_0x157f12){_0x1fe9b7[_0x25db0e(0xe8)]({'sqlCode':_0x146ba1['sqlCode'],'reason':_0x25db0e(0xd9)});continue;}if(_0x130275[_0x25db0e(0xdc)]==null){_0x571a94[_0x25db0e(0xe8)]({'sqlCode':_0x146ba1['sqlCode'],'error':_0x25db0e(0xe3)});continue;}const _0x226f61=await readFile(_0x146ba1['filePath'],'utf8'),_0x1f8e9e=stripLocalSqlMetadata(_0x226f61,_0x146ba1['mode']),_0x5336d2=_0x146ba1['sqlName']||_0x130275[_0x25db0e(0x10f)],_0x4f8ade=await resolveTargetDbBinding(_0x5c7728[_0x25db0e(0x109)],_0x146ba1,_0x130275),_0x4a2eec=await updateSqlQuery({'id':_0x130275['remoteId'],'appCode':_0x5c7728[_0x25db0e(0x109)],'sqlCode':_0x146ba1[_0x25db0e(0xf1)],'sqlName':_0x5336d2,'dbId':_0x4f8ade[_0x25db0e(0xe6)],'version':_0x130275[_0x25db0e(0xdc)],'sqlContent':_0x1f8e9e,'sqlConfig':_0x130275['sqlConfig']??undefined}),_0x17790d=_0x4a2eec['dbId']?await getDbName(_0x5c7728[_0x25db0e(0x109)],Number(_0x4a2eec['dbId']))['catch'](()=>_0x4f8ade[_0x25db0e(0xf0)]):_0x4f8ade[_0x25db0e(0xf0)];_0x5b7d7f[_0x25db0e(0xf3)][_0x146ba1[_0x25db0e(0xf1)]]={...buildSqlLockEntry(_0x4a2eec,_0x1f8e9e,_0x3ace63,{'dbName':_0x17790d}),'path':_0x146ba1[_0x25db0e(0x108)],'mode':_0x130275[_0x25db0e(0xea)]},await archivePreviousSqlFileIfNeeded(_0x11ba51,_0x130275[_0x25db0e(0x10b)],_0x146ba1[_0x25db0e(0x108)]),_0x3a2117['push']({'sqlCode':_0x146ba1[_0x25db0e(0xf1)],'remoteId':_0x130275[_0x25db0e(0x105)]});}catch(_0x3d43a0){_0x571a94['push']({'sqlCode':_0x146ba1['sqlCode'],'error':_0x3d43a0 instanceof Error?_0x3d43a0[_0x25db0e(0xe9)]:String(_0x3d43a0)});}}return _0x5b7d7f[_0x25db0e(0x112)]=new Date()[_0x25db0e(0xf4)](),await writeSqlLockFile(_0x11ba51[_0x25db0e(0xd6)],_0x654c52),{'ok':_0x571a94[_0x25db0e(0xe5)]===0x0,'data':{'pushed':_0x3a2117,'skipped':_0x1fe9b7,'failed':_0x571a94},'message':'Push\x20complete:\x20'+_0x3a2117['length']+'\x20pushed,\x20'+_0x1fe9b7[_0x25db0e(0xe5)]+'\x20skipped,\x20'+_0x571a94[_0x25db0e(0xe5)]+_0x25db0e(0xfd)};}};async function archivePreviousSqlFileIfNeeded(_0x3e39a9,_0x2b2417,_0x3ce3c4){const _0x50c3c7=a171_0x5d2063;if(!_0x2b2417||_0x2b2417===_0x3ce3c4)return;const _0x14e52a=join(_0x3e39a9['sqlRootDir'],_0x2b2417);if(!await fileExists(_0x14e52a))return;const _0x38680a=await moveToTrash(_0x3e39a9['projectRoot'],_0x3e39a9[_0x50c3c7(0x100)],_0x14e52a);await cleanupEmptyDirectories(dirname(_0x14e52a),_0x3e39a9[_0x50c3c7(0x10e)]),void _0x38680a;}async function moveToTrash(_0x669d4a,_0x4369dc,_0x4257bf){const _0xaa8241=a171_0x5d2063,_0x4298b5=new Date()[_0xaa8241(0xf4)]()[_0xaa8241(0x102)](/[:.]/g,'-'),_0xe6be72=relative(_0x669d4a,_0x4257bf),_0x276d82=join(_0x4369dc,_0x4298b5,_0xe6be72);return await mkdir(dirname(_0x276d82),{'recursive':!![]}),await rename(_0x4257bf,_0x276d82),_0x276d82;}async function cleanupEmptyDirectories(_0x24f17d,_0x14977f){const _0x524025=a171_0x5d2063;let _0x46d31b=resolve(_0x24f17d);const _0x240407=resolve(_0x14977f);while(_0x46d31b['startsWith'](''+_0x240407+sep)||_0x46d31b===_0x240407){if(_0x46d31b===_0x240407)return;try{const _0x4b041c=await readdir(_0x46d31b);if(_0x4b041c[_0x524025(0xe5)]>0x0)return;await rmdir(_0x46d31b);}catch{return;}_0x46d31b=dirname(_0x46d31b);}}async function resolveTargetDbBinding(_0x5a7d86,_0x5623a6,_0x7e6a73){const _0x2ad0b3=a171_0x5d2063,_0x26c88c=_0x5623a6['dbDirectory'];if(!_0x26c88c)return{'dbId':_0x7e6a73[_0x2ad0b3(0xe6)],'dbName':_0x7e6a73[_0x2ad0b3(0xf0)]};const _0x27e26a=buildDbDirectoryName(_0x7e6a73['dbName'],_0x7e6a73[_0x2ad0b3(0xe6)]);if(_0x26c88c===_0x27e26a)return{'dbId':_0x7e6a73[_0x2ad0b3(0xe6)],'dbName':_0x7e6a73[_0x2ad0b3(0xf0)]};const _0x461d0c=parseExplicitDbDirectory(_0x26c88c);if(_0x461d0c!=null)return{'dbId':_0x461d0c,'dbName':await getDbName(_0x5a7d86,_0x461d0c)[_0x2ad0b3(0xfc)](()=>undefined)};const _0x563137=await listDatabases(_0x5a7d86),_0x494d62=_0x563137[_0x2ad0b3(0xf7)](_0x32b97c=>buildDbDirectoryName(_0x32b97c[_0x2ad0b3(0xf0)],_0x32b97c['dbId'])===_0x26c88c);if(_0x494d62[_0x2ad0b3(0xe5)]===0x1)return{'dbId':_0x494d62[0x0][_0x2ad0b3(0xe6)],'dbName':_0x494d62[0x0][_0x2ad0b3(0xf0)]};if(_0x494d62[_0x2ad0b3(0xe5)]===0x0)throw CliErrors[_0x2ad0b3(0xed)](_0x2ad0b3(0x10c)+_0x26c88c+_0x2ad0b3(0xf5)+_0x5623a6[_0x2ad0b3(0xf1)]+'.');const _0x17792b=_0x494d62[_0x2ad0b3(0x106)](_0xfb9e57=>_0xfb9e57[_0x2ad0b3(0xf0)]+'\x20('+_0xfb9e57[_0x2ad0b3(0xe6)]+')')[_0x2ad0b3(0xdf)](',\x20');throw CliErrors['validation'](_0x2ad0b3(0x107)+_0x26c88c+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x5623a6[_0x2ad0b3(0xf1)]+':\x20'+_0x17792b);}function parseExplicitDbDirectory(_0x1fe9dc){const _0x34fc0f=a171_0x5d2063,_0xd3e1a1=/^db-(\d+)$/[_0x34fc0f(0xff)](_0x1fe9dc);if(!_0xd3e1a1)return null;const _0x4ed427=Number(_0xd3e1a1[0x1]);return Number['isFinite'](_0x4ed427)&&_0x4ed427>0x0?_0x4ed427:null;}
|
|
1
|
+
const a172_0x398eb1=a172_0xf3b8;(function(_0x285433,_0x2fe65f){const _0x1f66a8=a172_0xf3b8,_0x404f09=_0x285433();while(!![]){try{const _0x254ae2=parseInt(_0x1f66a8(0x1f2))/0x1+-parseInt(_0x1f66a8(0x1f1))/0x2*(-parseInt(_0x1f66a8(0x20e))/0x3)+-parseInt(_0x1f66a8(0x1e9))/0x4+parseInt(_0x1f66a8(0x212))/0x5+-parseInt(_0x1f66a8(0x202))/0x6+parseInt(_0x1f66a8(0x1d7))/0x7*(-parseInt(_0x1f66a8(0x203))/0x8)+-parseInt(_0x1f66a8(0x1f5))/0x9*(parseInt(_0x1f66a8(0x201))/0xa);if(_0x254ae2===_0x2fe65f)break;else _0x404f09['push'](_0x404f09['shift']());}catch(_0x511930){_0x404f09['push'](_0x404f09['shift']());}}}(a172_0x1111,0x3cddd));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';function a172_0xf3b8(_0x39129b,_0x7517dd){_0x39129b=_0x39129b-0x1d6;const _0x111159=a172_0x1111();let _0xf3b8e4=_0x111159[_0x39129b];return _0xf3b8e4;}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(_0x1f8ed4,_0x55666b,_0x2869a7){const _0x159f3a=a172_0xf3b8,_0xe18ed6=await scanLocalSqlQueries(_0x1f8ed4),_0x267b04=new Map();for(const _0x54ee5c of _0xe18ed6){if(_0x2869a7&&_0x54ee5c[_0x159f3a(0x204)]!==_0x2869a7)continue;const _0x41ec11=_0x267b04['get'](_0x54ee5c['sqlCode'])??[];_0x41ec11[_0x159f3a(0x1e7)](_0x54ee5c),_0x267b04[_0x159f3a(0x1e2)](_0x54ee5c[_0x159f3a(0x204)],_0x41ec11);}if(_0x2869a7&&!_0x267b04[_0x159f3a(0x1eb)](_0x2869a7))throw CliErrors[_0x159f3a(0x205)](_0x159f3a(0x209)+_0x2869a7);const _0x40ee90=[];for(const [_0x5480b1,_0x493c5a]of _0x267b04['entries']()){if(_0x493c5a[_0x159f3a(0x1fc)]===0x1){_0x40ee90[_0x159f3a(0x1e7)](_0x493c5a[0x0]);continue;}const _0x5a107c=_0x55666b['sqls'][_0x5480b1],_0x4e6895=_0x5a107c?.[_0x159f3a(0x1ee)],_0xa92583=_0x4e6895?_0x493c5a[_0x159f3a(0x1ff)](_0x1f8ce6=>_0x1f8ce6[_0x159f3a(0x1ef)]!==_0x4e6895):_0x493c5a;if(_0x5a107c&&_0xa92583[_0x159f3a(0x1fc)]===0x1){_0x40ee90[_0x159f3a(0x1e7)](_0xa92583[0x0]);continue;}throw CliErrors[_0x159f3a(0x205)](_0x159f3a(0x215)+_0x5480b1+_0x159f3a(0x1e5));}return _0x40ee90;}function a172_0x1111(){const _0x406e2e=['hash','filter','\x22\x20for\x20sqlCode\x20','1135100mfsRpP','1212174ueQAmu','10232RaLIwo','sqlCode','validation','high-risk-write','trashDir','unchanged','Local\x20SQL\x20not\x20found:\x20','boolean','\x20skipped,\x20','force','str','25089MVrjeL','Would\x20push\x20','\x20pushed,\x20','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','1376575PBrKVu','startsWith','version','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','filePath','POST','sqlRootDir','1414YxCXBK','map','/smartapi/custom/updateUserCustomSql','isFinite','dbDirectory','lockFilePath','sqlcode','join','sql','sqlRoot','bool','set','exec','sqlName','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','dbName','push','mode','44964WDJFHT','sqlConfig','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','dbId','path','relativePath','sqls','62WAgiDD','413389Qkifsm','Local\x20directory\x20\x22','replace','18pyFOzh','remoteId','toISOString','appCode','projectRoot','\x20SQL\x20file(s)','message','length','catch'];a172_0x1111=function(){return _0x406e2e;};return a172_0x1111();}export const sqlPush={'service':a172_0x398eb1(0x1df),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a172_0x398eb1(0x206),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a172_0x398eb1(0x20a),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5d0ec1){const _0xb68e33=a172_0x398eb1,_0x1883b8=loadSqlProjectConfig(_0x5d0ec1[_0xb68e33(0x1f8)]),_0x364143=await readSqlLockFile(_0x1883b8[_0xb68e33(0x1dc)]),{appLock:_0xc7a42a}=ensureSqlLockScope(_0x364143??createEmptySqlLock(),_0x5d0ec1['appCode'],_0x1883b8[_0xb68e33(0x1e0)],_0xb68e33(0x1e7)),_0x15da49=await getTargetSqlQueries(_0x1883b8,_0xc7a42a,_0x5d0ec1[_0xb68e33(0x20d)](_0xb68e33(0x1dd))||undefined),_0x57d891=[];for(const _0x3f971a of _0x15da49){const _0x25976f=await computeSqlFileHash(_0x3f971a[_0xb68e33(0x217)]),_0x3d8118=_0xc7a42a['sqls'][_0x3f971a['sqlCode']],_0x1a3b58=!!_0x3d8118&&(_0x3d8118['path']!==_0x3f971a[_0xb68e33(0x1ef)]||!!_0x3f971a[_0xb68e33(0x1e4)]&&_0x3d8118[_0xb68e33(0x1e4)]!==_0x3f971a[_0xb68e33(0x1e4)]);if(!_0x5d0ec1[_0xb68e33(0x1e1)](_0xb68e33(0x20c))&&_0x3d8118&&_0x3d8118[_0xb68e33(0x1fe)]===_0x25976f&&!_0x1a3b58)continue;_0x57d891[_0xb68e33(0x1e7)](_0x3f971a[_0xb68e33(0x204)]);}return{'method':_0xb68e33(0x218),'url':_0xb68e33(0x1d9),'body':{'sqlCodes':_0x57d891,'appCode':_0x5d0ec1['appCode']},'description':_0xb68e33(0x20f)+_0x57d891[_0xb68e33(0x1fc)]+_0xb68e33(0x1fa)};},async 'execute'(_0x130d94){const _0x47ffbf=a172_0x398eb1,_0x139bf3=loadSqlProjectConfig(_0x130d94[_0x47ffbf(0x1f8)]),_0x64d7a3=await readSqlLockFile(_0x139bf3['lockFilePath']),{lockData:_0x3a01bc,appLock:_0x99e30}=ensureSqlLockScope(_0x64d7a3??createEmptySqlLock(),_0x130d94[_0x47ffbf(0x1f8)],_0x139bf3['sqlRoot'],_0x47ffbf(0x1e7)),_0x30503a=await getTargetSqlQueries(_0x139bf3,_0x99e30,_0x130d94[_0x47ffbf(0x20d)](_0x47ffbf(0x1dd))||undefined);if(_0x30503a[_0x47ffbf(0x1fc)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x2e0b79=[],_0x3664da=[],_0x241bab=[];for(const _0x5e76af of _0x30503a){const _0x44e80b=_0x99e30[_0x47ffbf(0x1f0)][_0x5e76af['sqlCode']];if(!_0x44e80b){_0x241bab['push']({'sqlCode':_0x5e76af[_0x47ffbf(0x204)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x2ba81f=await computeSqlFileHash(_0x5e76af[_0x47ffbf(0x217)]),_0x28f4c6=_0x44e80b['path']!==_0x5e76af[_0x47ffbf(0x1ef)]||!!_0x5e76af[_0x47ffbf(0x1e4)]&&_0x44e80b[_0x47ffbf(0x1e4)]!==_0x5e76af[_0x47ffbf(0x1e4)];if(!_0x130d94[_0x47ffbf(0x1e1)](_0x47ffbf(0x20c))&&_0x44e80b[_0x47ffbf(0x1fe)]===_0x2ba81f&&!_0x28f4c6){_0x3664da['push']({'sqlCode':_0x5e76af['sqlCode'],'reason':_0x47ffbf(0x208)});continue;}if(_0x44e80b[_0x47ffbf(0x214)]==null){_0x241bab[_0x47ffbf(0x1e7)]({'sqlCode':_0x5e76af[_0x47ffbf(0x204)],'error':_0x47ffbf(0x1ec)});continue;}const _0x152235=await readFile(_0x5e76af[_0x47ffbf(0x217)],'utf8'),_0x5ad4af=stripLocalSqlMetadata(_0x152235,_0x5e76af[_0x47ffbf(0x1e8)]),_0x41e0bc=_0x5e76af[_0x47ffbf(0x1e4)]||_0x44e80b['sqlName'],_0x356c99=await resolveTargetDbBinding(_0x130d94[_0x47ffbf(0x1f8)],_0x5e76af,_0x44e80b),_0x35aab7=await updateSqlQuery({'id':_0x44e80b['remoteId'],'appCode':_0x130d94[_0x47ffbf(0x1f8)],'sqlCode':_0x5e76af['sqlCode'],'sqlName':_0x41e0bc,'dbId':_0x356c99[_0x47ffbf(0x1ed)],'version':_0x44e80b['version'],'sqlContent':_0x5ad4af,'sqlConfig':_0x44e80b[_0x47ffbf(0x1ea)]??undefined}),_0x1779c8=_0x35aab7[_0x47ffbf(0x1ed)]?await getDbName(_0x130d94[_0x47ffbf(0x1f8)],Number(_0x35aab7['dbId']))[_0x47ffbf(0x1fd)](()=>_0x356c99['dbName']):_0x356c99[_0x47ffbf(0x1e6)];_0x99e30[_0x47ffbf(0x1f0)][_0x5e76af[_0x47ffbf(0x204)]]={...buildSqlLockEntry(_0x35aab7,_0x5ad4af,_0x2ba81f,{'dbName':_0x1779c8}),'path':_0x5e76af['relativePath'],'mode':_0x44e80b['mode']},await archivePreviousSqlFileIfNeeded(_0x139bf3,_0x44e80b[_0x47ffbf(0x1ee)],_0x5e76af[_0x47ffbf(0x1ef)]),_0x2e0b79[_0x47ffbf(0x1e7)]({'sqlCode':_0x5e76af['sqlCode'],'remoteId':_0x44e80b[_0x47ffbf(0x1f6)]});}catch(_0x44dc83){_0x241bab[_0x47ffbf(0x1e7)]({'sqlCode':_0x5e76af['sqlCode'],'error':_0x44dc83 instanceof Error?_0x44dc83[_0x47ffbf(0x1fb)]:String(_0x44dc83)});}}return _0x99e30['lastSync']=new Date()[_0x47ffbf(0x1f7)](),await writeSqlLockFile(_0x139bf3['lockFilePath'],_0x3a01bc),{'ok':_0x241bab['length']===0x0,'data':{'pushed':_0x2e0b79,'skipped':_0x3664da,'failed':_0x241bab},'message':'Push\x20complete:\x20'+_0x2e0b79['length']+_0x47ffbf(0x210)+_0x3664da[_0x47ffbf(0x1fc)]+_0x47ffbf(0x20b)+_0x241bab[_0x47ffbf(0x1fc)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x75980f,_0x17cfae,_0x18476c){const _0x2d2d42=a172_0x398eb1;if(!_0x17cfae||_0x17cfae===_0x18476c)return;const _0x4edfb0=join(_0x75980f[_0x2d2d42(0x1d6)],_0x17cfae);if(!await fileExists(_0x4edfb0))return;const _0x391943=await moveToTrash(_0x75980f[_0x2d2d42(0x1f9)],_0x75980f[_0x2d2d42(0x207)],_0x4edfb0);await cleanupEmptyDirectories(dirname(_0x4edfb0),_0x75980f['sqlRootDir']),void _0x391943;}async function moveToTrash(_0x4d8024,_0xfa7125,_0x3ac5e1){const _0x1e457c=a172_0x398eb1,_0x5ecea7=new Date()[_0x1e457c(0x1f7)]()[_0x1e457c(0x1f4)](/[:.]/g,'-'),_0x128f37=relative(_0x4d8024,_0x3ac5e1),_0x4c4867=join(_0xfa7125,_0x5ecea7,_0x128f37);return await mkdir(dirname(_0x4c4867),{'recursive':!![]}),await rename(_0x3ac5e1,_0x4c4867),_0x4c4867;}async function cleanupEmptyDirectories(_0xd60fd5,_0x2777e8){const _0x191ceb=a172_0x398eb1;let _0x5bb0f8=resolve(_0xd60fd5);const _0x22c7d2=resolve(_0x2777e8);while(_0x5bb0f8[_0x191ceb(0x213)](''+_0x22c7d2+sep)||_0x5bb0f8===_0x22c7d2){if(_0x5bb0f8===_0x22c7d2)return;try{const _0x3fb5c1=await readdir(_0x5bb0f8);if(_0x3fb5c1[_0x191ceb(0x1fc)]>0x0)return;await rmdir(_0x5bb0f8);}catch{return;}_0x5bb0f8=dirname(_0x5bb0f8);}}async function resolveTargetDbBinding(_0x279484,_0x4c4ed2,_0x3885f9){const _0x56e130=a172_0x398eb1,_0x86e0cd=_0x4c4ed2[_0x56e130(0x1db)];if(!_0x86e0cd)return{'dbId':_0x3885f9[_0x56e130(0x1ed)],'dbName':_0x3885f9[_0x56e130(0x1e6)]};const _0x37ca41=buildDbDirectoryName(_0x3885f9['dbName'],_0x3885f9['dbId']);if(_0x86e0cd===_0x37ca41)return{'dbId':_0x3885f9[_0x56e130(0x1ed)],'dbName':_0x3885f9[_0x56e130(0x1e6)]};const _0x4eb392=parseExplicitDbDirectory(_0x86e0cd);if(_0x4eb392!=null)return{'dbId':_0x4eb392,'dbName':await getDbName(_0x279484,_0x4eb392)['catch'](()=>undefined)};const _0x14c761=await listDatabases(_0x279484),_0x35bd53=_0x14c761[_0x56e130(0x1ff)](_0x2dee42=>buildDbDirectoryName(_0x2dee42[_0x56e130(0x1e6)],_0x2dee42[_0x56e130(0x1ed)])===_0x86e0cd);if(_0x35bd53[_0x56e130(0x1fc)]===0x1)return{'dbId':_0x35bd53[0x0]['dbId'],'dbName':_0x35bd53[0x0][_0x56e130(0x1e6)]};if(_0x35bd53[_0x56e130(0x1fc)]===0x0)throw CliErrors[_0x56e130(0x205)](_0x56e130(0x216)+_0x86e0cd+_0x56e130(0x200)+_0x4c4ed2[_0x56e130(0x204)]+'.');const _0x172bec=_0x35bd53[_0x56e130(0x1d8)](_0x31a80a=>_0x31a80a[_0x56e130(0x1e6)]+'\x20('+_0x31a80a[_0x56e130(0x1ed)]+')')[_0x56e130(0x1de)](',\x20');throw CliErrors[_0x56e130(0x205)](_0x56e130(0x1f3)+_0x86e0cd+_0x56e130(0x211)+_0x4c4ed2[_0x56e130(0x204)]+':\x20'+_0x172bec);}function parseExplicitDbDirectory(_0x1b59c2){const _0x35c772=a172_0x398eb1,_0x40d530=/^db-(\d+)$/[_0x35c772(0x1e3)](_0x1b59c2);if(!_0x40d530)return null;const _0x320be3=Number(_0x40d530[0x1]);return Number[_0x35c772(0x1da)](_0x320be3)&&_0x320be3>0x0?_0x320be3:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a173_0x18bceb=a173_0x1be1;function a173_0x1be1(_0x31c734,_0x59a2c8){_0x31c734=_0x31c734-0x1e9;const _0x4363cd=a173_0x4363();let _0x1be1bb=_0x4363cd[_0x31c734];return _0x1be1bb;}(function(_0x2f41e2,_0x271310){const _0x279317=a173_0x1be1,_0x3493f9=_0x2f41e2();while(!![]){try{const _0x559d94=parseInt(_0x279317(0x1f4))/0x1+parseInt(_0x279317(0x1f8))/0x2*(parseInt(_0x279317(0x1ea))/0x3)+parseInt(_0x279317(0x1f6))/0x4*(parseInt(_0x279317(0x1ed))/0x5)+-parseInt(_0x279317(0x1ec))/0x6+-parseInt(_0x279317(0x1f0))/0x7+parseInt(_0x279317(0x1f3))/0x8+-parseInt(_0x279317(0x1f9))/0x9;if(_0x559d94===_0x271310)break;else _0x3493f9['push'](_0x3493f9['shift']());}catch(_0xb24b29){_0x3493f9['push'](_0x3493f9['shift']());}}}(a173_0x4363,0xb54f5));function a173_0x4363(){const _0x5bfc92=['Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','5012064OmjwMK','3779785LFGUJc','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','SQL\x20query\x20display\x20name','976038czgYPs','sqlname','join','8279728ModaBV','798143SkQgwH','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','4vcQejd','Path\x20to\x20the\x20SQL\x20file','2ExUGkP','17841834MrlXYh','sql','file','string','3332349MJDosq'];a173_0x4363=function(){return _0x5bfc92;};return a173_0x4363();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a173_0x18bceb(0x1f5),a173_0x18bceb(0x1eb),'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`.'][a173_0x18bceb(0x1f2)]('\x0a');export const sqlSave={'service':a173_0x18bceb(0x1fa),'command':'save','description':a173_0x18bceb(0x1ee),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a173_0x18bceb(0x1fb),'type':'string','required':!![],'description':a173_0x18bceb(0x1f7)},SQLCODE_FLAG_OPTIONAL,{'name':a173_0x18bceb(0x1f1),'type':a173_0x18bceb(0x1e9),'description':a173_0x18bceb(0x1ef)},{'name':'db','type':a173_0x18bceb(0x1e9),'description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':'description','type':a173_0x18bceb(0x1e9),'description':'Query\x20description'}],async 'validate'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a174_0x419c34=a174_0x3c1f;(function(_0x42396a,_0x535bac){const _0x35251d=a174_0x3c1f,_0x5a63fa=_0x42396a();while(!![]){try{const _0x13d8ba=-parseInt(_0x35251d(0x10d))/0x1*(-parseInt(_0x35251d(0xe8))/0x2)+-parseInt(_0x35251d(0xf9))/0x3*(-parseInt(_0x35251d(0xf5))/0x4)+-parseInt(_0x35251d(0xf4))/0x5+parseInt(_0x35251d(0x10c))/0x6*(parseInt(_0x35251d(0x105))/0x7)+parseInt(_0x35251d(0x102))/0x8*(parseInt(_0x35251d(0x10a))/0x9)+-parseInt(_0x35251d(0xe2))/0xa*(parseInt(_0x35251d(0x101))/0xb)+parseInt(_0x35251d(0xee))/0xc;if(_0x13d8ba===_0x535bac)break;else _0x5a63fa['push'](_0x5a63fa['shift']());}catch(_0x517f9c){_0x5a63fa['push'](_0x5a63fa['shift']());}}}(a174_0x1cf5,0xb0f09));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a174_0x419c34(0xe3);export function buildSqlLockEntry(_0xf9bd26,_0x515dc5,_0x422a88,_0x12fc67){const _0x5203d5=a174_0x419c34,_0x204476=detectSqlMode(_0x515dc5);return{'path':buildSqlRelativePath(_0xf9bd26[_0x5203d5(0xe5)],_0xf9bd26['sqlName'],_0x12fc67?.[_0x5203d5(0x108)],_0x204476,_0xf9bd26[_0x5203d5(0x109)]),'hash':_0x422a88,'remoteId':_0xf9bd26['id'],'version':_0xf9bd26[_0x5203d5(0xfc)],'dbId':Number(_0xf9bd26[_0x5203d5(0x109)]),'dbName':_0x12fc67?.[_0x5203d5(0x108)],'sqlName':_0xf9bd26['sqlName'],'sqlConfig':_0xf9bd26[_0x5203d5(0xf2)]??undefined,'mode':_0x204476};}export function cloneSqlLockData(_0x509ef4){const _0x1cd476=a174_0x419c34;return{'apps':Object[_0x1cd476(0xf1)](Object[_0x1cd476(0x10f)](_0x509ef4[_0x1cd476(0xed)])['map'](([_0x31ee25,_0x4f2578])=>[_0x31ee25,{'sqlRoot':_0x4f2578[_0x1cd476(0x10b)],'lastSync':_0x4f2578[_0x1cd476(0xfb)],'sqls':{..._0x4f2578[_0x1cd476(0xef)]}}]))};}export function ensureRemoteSqlContent(_0x1819fc){const _0x51225b=a174_0x419c34;return _0x1819fc[_0x51225b(0xfa)]??'';}export function buildLocalSqlFileContent(_0x157ab8,_0x218bdf,_0xddf74e){const _0x314528=a174_0x419c34,_0x360048=_0xddf74e?.['mode']??detectSqlMode(_0x218bdf),_0x21d2e5=stripLocalSqlMetadata(_0x218bdf,_0x360048)[_0x314528(0xfd)](),_0xade7be=[...buildMetadataHeaderLines({'sqlCode':_0x157ab8[_0x314528(0xe5)],'sqlName':_0x157ab8[_0x314528(0xe4)],'dbId':_0x157ab8['dbId'],'dbName':_0xddf74e?.['dbName'],'mode':_0x360048,'syncedAt':_0xddf74e?.['syncedAt'],'description':_0xddf74e?.[_0x314528(0xfe)]},_0x360048),'',_0x21d2e5],_0x4ab2d9=_0xade7be[_0x314528(0xec)]('\x0a');return _0x4ab2d9[_0x314528(0xf8)]('\x0a')?_0x4ab2d9:_0x4ab2d9+'\x0a';}export function stripLocalSqlMetadata(_0x80f017,_0x53d1d0){const _0x43282d=a174_0x419c34,_0x160638=_0x80f017['replace'](/\r\n/g,'\x0a')[_0x43282d(0x103)]('\x0a'),_0x2af3fb=[];let _0x382764=0x0;if(_0x53d1d0===_0x43282d(0xe0))while(_0x382764<_0x160638[_0x43282d(0xf7)]){const _0x175d87=_0x160638[_0x382764]??'';if(/^\s*<!--\s*@lovrabet\./[_0x43282d(0x106)](_0x175d87)){_0x382764++;continue;}if(_0x175d87[_0x43282d(0xfd)]()===''&&_0x382764>0x0){_0x382764++;continue;}break;}else while(_0x382764<_0x160638[_0x43282d(0xf7)]){const _0x47ae15=_0x160638[_0x382764]??'';if(/^\s*--\s*@lovrabet\./[_0x43282d(0x106)](_0x47ae15)){_0x382764++;continue;}if(_0x47ae15[_0x43282d(0xfd)]()===''&&_0x382764>0x0){_0x382764++;continue;}break;}for(;_0x382764<_0x160638['length'];_0x382764++){_0x2af3fb[_0x43282d(0xf6)](_0x160638[_0x382764]);}return _0x2af3fb[_0x43282d(0xec)]('\x0a')[_0x43282d(0xea)]();}export function resolveSqlMode(_0x35ba7d,_0x5f0eac){const _0x27fffc=a174_0x419c34;if(_0x5f0eac?.[_0x27fffc(0xff)])return _0x5f0eac[_0x27fffc(0xff)];return detectSqlMode(_0x35ba7d);}export function resolveSqlFileName(_0x23d820,_0x26e05c,_0x5d7a94){const _0x3ca6e9=a174_0x419c34;if(_0x5d7a94?.[_0x3ca6e9(0x10e)])return _0x5d7a94[_0x3ca6e9(0x10e)];if(_0x5d7a94?.[_0x3ca6e9(0xe4)]||_0x5d7a94?.['dbName'])return buildSqlRelativePath(_0x23d820,_0x5d7a94?.[_0x3ca6e9(0xe4)],_0x5d7a94?.[_0x3ca6e9(0x108)],resolveSqlMode(_0x26e05c,_0x5d7a94),_0x5d7a94?.[_0x3ca6e9(0x109)]);return buildDefaultSqlFileName(_0x23d820,resolveSqlMode(_0x26e05c,_0x5d7a94));}function a174_0x1cf5(){const _0x51c3fb=['apps','8269344eNCJtB','sqls','--\x20@lovrabet.','fromEntries','sqlConfig','filter','3346090QzgbGP','12zYEEcw','push','length','endsWith','521907yDxqbE','sqlContent','lastSync','version','trim','description','mode','syncedAt','11keLBQz','13576srGOmH','split','includes','105bwaJcS','test','\x20[y/N]\x20','dbName','dbId','63DtylTT','sqlRoot','141402reclPv','12731TPMBCd','path','entries','mybatisXml','stderr','11881890LDVJYQ','.rabetbase/sql','sqlName','sqlCode','question','\x20-->','158BmmsgS','stdin','trimStart','<!--\x20@lovrabet.','join'];a174_0x1cf5=function(){return _0x51c3fb;};return a174_0x1cf5();}function a174_0x3c1f(_0x301660,_0x52a32f){_0x301660=_0x301660-0xe0;const _0x1cf5c6=a174_0x1cf5();let _0x3c1fa8=_0x1cf5c6[_0x301660];return _0x3c1fa8;}export function resolveSqlLocalDir(_0x2f26ee,_0x5d08cb){return join(_0x2f26ee,SQL_LOCAL_REL_DIR,_0x5d08cb);}export async function confirmForceOverwrite(_0xe78961){const _0x56bdd4=a174_0x419c34,_0x498e19=createInterface({'input':process[_0x56bdd4(0xe9)],'output':process[_0x56bdd4(0xe1)]}),_0x1f8fe8=await new Promise(_0x4fbe3b=>{const _0x3e576e=_0x56bdd4;_0x498e19[_0x3e576e(0xe6)](_0xe78961+_0x3e576e(0x107),_0x4fbe3b);});return _0x498e19['close'](),['y','yes'][_0x56bdd4(0x104)](_0x1f8fe8[_0x56bdd4(0xfd)]()['toLowerCase']());}export function findSqlLockScope(_0x18c739,_0x55b13e){const _0x2defc2=a174_0x419c34;return _0x18c739[_0x2defc2(0xed)][_0x55b13e];}function buildMetadataHeaderLines(_0x1877da,_0x39db89){const _0x2eb100=a174_0x419c34,_0x4043d4=[['sqlCode',_0x1877da[_0x2eb100(0xe5)]],['sqlName',_0x1877da[_0x2eb100(0xe4)]],['dbId',_0x1877da[_0x2eb100(0x109)]],['dbName',_0x1877da[_0x2eb100(0x108)]],[_0x2eb100(0xff),_0x1877da[_0x2eb100(0xff)]],[_0x2eb100(0x100),_0x1877da['syncedAt']],['description',_0x1877da[_0x2eb100(0xfe)]]];if(_0x39db89===_0x2eb100(0xe0))return _0x4043d4[_0x2eb100(0xf3)](([,_0x934318])=>_0x934318!==undefined&&_0x934318!==null&&String(_0x934318)[_0x2eb100(0xfd)]()!=='')['map'](([_0x3e1a86,_0x43284c])=>_0x2eb100(0xeb)+_0x3e1a86+':\x20'+String(_0x43284c)+_0x2eb100(0xe7));return _0x4043d4[_0x2eb100(0xf3)](([,_0x251e96])=>_0x251e96!==undefined&&_0x251e96!==null&&String(_0x251e96)['trim']()!=='')['map'](([_0x5305d3,_0x5b8a18])=>_0x2eb100(0xf0)+_0x5305d3+':\x20'+String(_0x5b8a18));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a175_0x1d0a(){const _0x44d39e=['\x20added,\x20','\x20remote-only','5626472tMiVxU','hash','tableData','remote','554332KRWPCE','length','sqlName','1538082sqWakh','has','boolean','All\x20SQL\x20queries\x20are\x20in\x20sync.','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','relativePath','bool','path','keys','2365098AYhLnn','42130pvjnbC','paging','265829JwJXqs','push','status','\x20unchanged','appCode','\x20missing,\x20','sqlCode','totalCount','map','sqls','lockKey','2573602pkZQBR','filePath','822DHNtSP','lockFilePath','sql','read'];a175_0x1d0a=function(){return _0x44d39e;};return a175_0x1d0a();}function a175_0x715b(_0xf5dd33,_0x56ff0d){_0xf5dd33=_0xf5dd33-0x16a;const _0x1d0a68=a175_0x1d0a();let _0x715bcf=_0x1d0a68[_0xf5dd33];return _0x715bcf;}const a175_0x18c5b3=a175_0x715b;(function(_0x5685b7,_0x4e1f31){const _0x4b778d=a175_0x715b,_0x3643aa=_0x5685b7();while(!![]){try{const _0x7a5e64=-parseInt(_0x4b778d(0x16b))/0x1+-parseInt(_0x4b778d(0x176))/0x2+parseInt(_0x4b778d(0x18e))/0x3+-parseInt(_0x4b778d(0x182))/0x4+-parseInt(_0x4b778d(0x18f))/0x5*(-parseInt(_0x4b778d(0x178))/0x6)+-parseInt(_0x4b778d(0x185))/0x7+parseInt(_0x4b778d(0x17e))/0x8;if(_0x7a5e64===_0x4e1f31)break;else _0x3643aa['push'](_0x3643aa['shift']());}catch(_0x50990c){_0x3643aa['push'](_0x3643aa['shift']());}}}(a175_0x1d0a,0xb377a));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(_0x1368c7){const _0x26975b=a175_0x715b,_0x447f2b=[];let _0x940453=0x1;while(!![]){const _0x57cf41=await listSqlQueries(_0x1368c7,{'currentPage':_0x940453,'pageSize':PAGE_SIZE}),_0x23bbd5=_0x57cf41[_0x26975b(0x180)]??[];_0x447f2b[_0x26975b(0x16c)](..._0x23bbd5[_0x26975b(0x173)](_0x405963=>_0x405963[_0x26975b(0x171)]));if(_0x23bbd5[_0x26975b(0x183)]===0x0)break;const _0x175d8a=_0x57cf41[_0x26975b(0x16a)]?.[_0x26975b(0x172)];if(_0x175d8a!=null?_0x447f2b[_0x26975b(0x183)]>=_0x175d8a:_0x23bbd5[_0x26975b(0x183)]<PAGE_SIZE)break;_0x940453++;}return _0x447f2b;}export const sqlStatus={'service':a175_0x18c5b3(0x17a),'command':'status','description':a175_0x18c5b3(0x189),'risk':a175_0x18c5b3(0x17b),'flags':[{'name':a175_0x18c5b3(0x181),'type':a175_0x18c5b3(0x187),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x42f2c9){const _0x13c56a=a175_0x18c5b3,_0x5d8db5=loadSqlProjectConfig(_0x42f2c9[_0x13c56a(0x16f)]),_0x3a15eb=await readSqlLockFile(_0x5d8db5[_0x13c56a(0x179)]),{appLock:_0x1e83d3}=ensureSqlLockScope(_0x3a15eb??createEmptySqlLock(),_0x5d8db5[_0x13c56a(0x16f)],_0x5d8db5['sqlRoot'],_0x13c56a(0x16d)),_0x44be40=await scanLocalSqlQueries(_0x5d8db5),_0x6b1027=[],_0x4a4ee5=[],_0x257608=[],_0x3d5cba=[],_0x1fb05b=new Set(_0x44be40[_0x13c56a(0x173)](_0x14842c=>_0x14842c[_0x13c56a(0x175)]));for(const _0x2b78f3 of _0x44be40){const _0x3f5674=await computeSqlFileHash(_0x2b78f3[_0x13c56a(0x177)]),_0x36504e=_0x1e83d3[_0x13c56a(0x174)][_0x2b78f3[_0x13c56a(0x175)]],_0x15ca0d=!!_0x36504e&&_0x36504e[_0x13c56a(0x18c)]!==_0x2b78f3[_0x13c56a(0x18a)],_0x5225a6=!!_0x36504e&&!!_0x2b78f3[_0x13c56a(0x184)]&&_0x36504e[_0x13c56a(0x184)]!==_0x2b78f3['sqlName'];if(!_0x36504e)_0x6b1027['push'](_0x2b78f3[_0x13c56a(0x175)]);else _0x36504e[_0x13c56a(0x17f)]!==_0x3f5674||_0x15ca0d||_0x5225a6?_0x4a4ee5['push'](_0x2b78f3[_0x13c56a(0x175)]):_0x257608[_0x13c56a(0x16c)](_0x2b78f3[_0x13c56a(0x175)]);}for(const _0xe04b6 of Object[_0x13c56a(0x18d)](_0x1e83d3[_0x13c56a(0x174)])){!_0x1fb05b['has'](_0xe04b6)&&_0x3d5cba[_0x13c56a(0x16c)](_0xe04b6);}const _0x5f1c4a=[];if(_0x42f2c9[_0x13c56a(0x18b)]('remote')){const _0x47e492=await fetchAllSqlCodes(_0x42f2c9[_0x13c56a(0x16f)]);for(const _0x55c47a of _0x47e492){!_0x1fb05b[_0x13c56a(0x186)](_0x55c47a)&&!_0x1e83d3[_0x13c56a(0x174)][_0x55c47a]&&_0x5f1c4a[_0x13c56a(0x16c)](_0x55c47a);}}const _0x58347f=_0x6b1027[_0x13c56a(0x183)]===0x0&&_0x4a4ee5[_0x13c56a(0x183)]===0x0&&_0x3d5cba[_0x13c56a(0x183)]===0x0&&_0x5f1c4a['length']===0x0;return{'ok':!![],'data':{'added':_0x6b1027,'modified':_0x4a4ee5,'missing':_0x3d5cba,'unchanged':_0x257608,'remoteOnly':_0x5f1c4a},'message':_0x58347f?_0x13c56a(0x188):_0x6b1027[_0x13c56a(0x183)]+_0x13c56a(0x17c)+_0x4a4ee5['length']+'\x20modified,\x20'+_0x3d5cba[_0x13c56a(0x183)]+_0x13c56a(0x170)+_0x257608[_0x13c56a(0x183)]+_0x13c56a(0x16e)+(_0x5f1c4a[_0x13c56a(0x183)]>0x0?',\x20'+_0x5f1c4a[_0x13c56a(0x183)]+_0x13c56a(0x17d):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a176_0x455c0e=a176_0x3403;(function(_0xa9d07a,_0x380034){const _0x15beba=a176_0x3403,_0x33fe5d=_0xa9d07a();while(!![]){try{const _0x2a44a6=parseInt(_0x15beba(0xeb))/0x1+-parseInt(_0x15beba(0xdf))/0x2+parseInt(_0x15beba(0xff))/0x3+parseInt(_0x15beba(0xec))/0x4*(-parseInt(_0x15beba(0xee))/0x5)+parseInt(_0x15beba(0x105))/0x6*(-parseInt(_0x15beba(0xd8))/0x7)+-parseInt(_0x15beba(0xe5))/0x8*(-parseInt(_0x15beba(0x100))/0x9)+-parseInt(_0x15beba(0xf1))/0xa*(-parseInt(_0x15beba(0xd6))/0xb);if(_0x2a44a6===_0x380034)break;else _0x33fe5d['push'](_0x33fe5d['shift']());}catch(_0x2c1b1d){_0x33fe5d['push'](_0x33fe5d['shift']());}}}(a176_0x18b5,0xf0c7b));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a176_0x18b5(){const _0x1828e2=['3125hIFOrD','str','appCode','60NfcCCK','sql','index_columns','fields','indexes','validate','--check-indexes\x20requires\x20--schemas.','columnNames','SQL\x20schema\x20validation','indexName','Table\x20\x22','isDangerous','primary','unshift','4955109ovrVDz','6975yVdblo','Dataset\x20\x22','size','utf-8','flagMissing','12SDroWM','message','read','trim','schemas','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','flatMap','from','valid','map','find','Provide\x20--file\x20or\x20--sql','cwd','toLowerCase','index_name','check-indexes','pkField','validation','split','push','schemaWarnings','File\x20not\x20found:\x20','sqlType','dbtableConfig','2211649ZndnNM','boolean','6829193mmIDqD','dataset','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','isArray','length','columns','tables','1994026NyCzFr','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','\x22\x20not\x20found\x20in\x20any\x20dataset','reason','string','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','11080kywPbL','type','filter','name','file','tableName','1806139EHjhgZ','11540RpsSTR','bool'];a176_0x18b5=function(){return _0x1828e2;};return a176_0x18b5();}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';function a176_0x3403(_0x51affc,_0x353924){_0x51affc=_0x51affc-0xce;const _0x18b57b=a176_0x18b5();let _0x34037f=_0x18b57b[_0x51affc];return _0x34037f;}export const sqlValidate={'service':a176_0x455c0e(0xf2),'command':a176_0x455c0e(0xf6),'description':a176_0x455c0e(0xe4),'risk':a176_0x455c0e(0x107),'flags':[{'name':a176_0x455c0e(0xe9),'type':'string','description':a176_0x455c0e(0xda)},{'name':a176_0x455c0e(0xf2),'type':'string','description':a176_0x455c0e(0x10a)},{'name':a176_0x455c0e(0x109),'type':a176_0x455c0e(0xe3),'description':a176_0x455c0e(0xe0)},{'name':a176_0x455c0e(0x114),'type':a176_0x455c0e(0xd7),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x378419){const _0x1581a8=a176_0x455c0e,_0x5b2a06=_0x378419['str']('file'),_0x7f92b5=_0x378419[_0x1581a8(0xef)](_0x1581a8(0xf2)),_0x36ad41=_0x378419[_0x1581a8(0xef)](_0x1581a8(0x109)),_0x42c60a=_0x378419[_0x1581a8(0xed)](_0x1581a8(0x114));if(!_0x5b2a06&&!_0x7f92b5)throw CliErrors[_0x1581a8(0x104)](_0x1581a8(0xe9),_0x1581a8(0x110));if(_0x42c60a&&!_0x36ad41)throw CliErrors[_0x1581a8(0xcf)](_0x1581a8(0xf7));let _0xf9a903;if(_0x5b2a06){const _0x4dd49e=resolve(process[_0x1581a8(0x111)](),_0x5b2a06);if(!existsSync(_0x4dd49e))throw CliErrors['validation'](_0x1581a8(0xd3)+_0x4dd49e);_0xf9a903=readFileSync(_0x4dd49e,_0x1581a8(0x103));}else _0xf9a903=_0x7f92b5;const _0x4b1571=validateSql(_0xf9a903),_0x84cbc5={'valid':_0x4b1571['valid'],'sqlType':_0x4b1571[_0x1581a8(0xd4)]['type'],'isSelectOnly':_0x4b1571[_0x1581a8(0xd4)]['isSelectOnly'],'isDangerous':_0x4b1571[_0x1581a8(0xd4)][_0x1581a8(0xfc)],'tables':_0x4b1571['tables'],'parameters':_0x4b1571['parameters'],'message':_0x4b1571[_0x1581a8(0x106)]};_0x4b1571[_0x1581a8(0xd4)][_0x1581a8(0xe2)]&&(_0x84cbc5[_0x1581a8(0xe2)]=_0x4b1571[_0x1581a8(0xd4)][_0x1581a8(0xe2)]);if(_0x36ad41&&_0x4b1571[_0x1581a8(0x10d)]){const _0xd4a9be=_0x36ad41[_0x1581a8(0xd0)](',')[_0x1581a8(0x10e)](_0x383a9a=>_0x383a9a[_0x1581a8(0x108)]())[_0x1581a8(0xe7)](Boolean),_0x40f5d6=[],_0x38074d=[],_0x36eefb=filterDbTableBackedDatasets(await listDatasets(_0x378419[_0x1581a8(0xf0)])),_0x375846=new Map(_0x36eefb[_0x1581a8(0x10e)](_0x6dba0d=>[_0x6dba0d[_0x1581a8(0xd5)]?.['tableName']?.[_0x1581a8(0x112)](),_0x6dba0d]));for(const _0x569d0d of _0x4b1571[_0x1581a8(0xde)]){const _0x27c28e=_0x375846['get'](_0x569d0d[_0x1581a8(0x112)]());!_0x27c28e&&_0x40f5d6[_0x1581a8(0xd1)](_0x1581a8(0xfb)+_0x569d0d+_0x1581a8(0xe1));}for(const _0x1d2d00 of _0xd4a9be){let _0x118b6f;try{_0x118b6f=await getDatasetDetail(_0x1d2d00);}catch{_0x40f5d6[_0x1581a8(0xd1)](_0x1581a8(0x101)+_0x1d2d00+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x118b6f,_0x1581a8(0xf9));const _0x180a53=Array['isArray'](_0x118b6f[_0x1581a8(0xf4)])?_0x118b6f[_0x1581a8(0xf4)]:[],_0x2bfcb8=new Set(_0x180a53[_0x1581a8(0x10e)](_0x2bcd04=>_0x2bcd04[_0x1581a8(0xe8)]?.['toLowerCase']())),_0x36628a=_0x118b6f[_0x1581a8(0xd5)]?.['tableName']||_0x118b6f[_0x1581a8(0xea)]||_0x1d2d00;_0x84cbc5['schema:'+_0x36628a]={'code':_0x1d2d00,'tableName':_0x36628a,'fieldCount':_0x2bfcb8[_0x1581a8(0x102)],'fields':Array[_0x1581a8(0x10c)](_0x2bfcb8)};if(_0x42c60a){const _0x59737d=normalizeDatasetIndexes(_0x118b6f);_0x38074d['push']({'tableName':_0x36628a,..._0x59737d});}}_0x40f5d6[_0x1581a8(0xdc)]>0x0&&(_0x84cbc5[_0x1581a8(0xd2)]=_0x40f5d6),_0x42c60a&&(_0x84cbc5['joinAudit']=auditSqlJoinIndexes(_0xf9a903,_0x38074d));}return{'ok':_0x4b1571[_0x1581a8(0x10d)],'data':_0x84cbc5,'message':_0x4b1571['message']};}};function normalizeDatasetIndexes(_0x172869){const _0x357cc1=a176_0x455c0e,_0x221220=Array[_0x357cc1(0xdb)](_0x172869?.[_0x357cc1(0xd9)]?.['indexes'])?_0x172869[_0x357cc1(0xd9)]['indexes']:Array[_0x357cc1(0xdb)](_0x172869?.[_0x357cc1(0xf5)])?_0x172869[_0x357cc1(0xf5)]:[],_0x4a969f=_0x221220[_0x357cc1(0x10b)](_0x335f3d=>{const _0x12c3e8=_0x357cc1,_0x535180=Array[_0x12c3e8(0xdb)](_0x335f3d?.['index_columns'])?_0x335f3d[_0x12c3e8(0xf3)]:Array[_0x12c3e8(0xdb)](_0x335f3d?.[_0x12c3e8(0xf8)])?_0x335f3d[_0x12c3e8(0xf8)]:Array[_0x12c3e8(0xdb)](_0x335f3d?.[_0x12c3e8(0xdd)])?_0x335f3d[_0x12c3e8(0xdd)]:[],_0x1a46eb=_0x535180['filter'](_0x1001f7=>typeof _0x1001f7==='string')[_0x12c3e8(0x10e)](_0xe075f3=>_0xe075f3[_0x12c3e8(0x108)]())[_0x12c3e8(0xe7)](Boolean);if(_0x1a46eb[_0x12c3e8(0xdc)]===0x0)return[];const _0x28720a=[_0x335f3d?.[_0x12c3e8(0xfa)],_0x335f3d?.[_0x12c3e8(0x113)],_0x335f3d?.[_0x12c3e8(0xe8)]][_0x12c3e8(0x10f)](_0x5860d9=>typeof _0x5860d9===_0x12c3e8(0xe3)&&_0x5860d9[_0x12c3e8(0x108)]()),_0x4485be=[_0x335f3d?.['index_type'],_0x335f3d?.[_0x12c3e8(0xe6)]][_0x12c3e8(0x10f)](_0x4130bd=>typeof _0x4130bd===_0x12c3e8(0xe3)&&_0x4130bd[_0x12c3e8(0x108)]());return[{..._0x28720a?{'name':_0x28720a[_0x12c3e8(0x108)]()}:{},..._0x4485be?{'type':_0x4485be['trim']()}:{},'columns':_0x1a46eb}];}),_0x5ecd0d=[..._0x4a969f],_0x155a58=typeof _0x172869?.['dbtableConfig']?.[_0x357cc1(0xce)]==='string'?_0x172869[_0x357cc1(0xd5)][_0x357cc1(0xce)][_0x357cc1(0xd0)](',')[_0x357cc1(0x10e)](_0x34caa0=>_0x34caa0[_0x357cc1(0x108)]())[_0x357cc1(0xe7)](Boolean):[];return _0x155a58[_0x357cc1(0xdc)]>0x0&&_0x5ecd0d[_0x357cc1(0xfe)]({'type':_0x357cc1(0xfd),'columns':_0x155a58}),{'indexes':_0x5ecd0d,'metadataAvailable':_0x4a969f[_0x357cc1(0xdc)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x294926,_0x9d6f2c){const _0x34bda0=a177_0x5ce0,_0x3c7688=_0x294926();while(!![]){try{const _0x249e3b=parseInt(_0x34bda0(0x14e))/0x1+parseInt(_0x34bda0(0x14b))/0x2*(-parseInt(_0x34bda0(0x14a))/0x3)+parseInt(_0x34bda0(0x14c))/0x4+-parseInt(_0x34bda0(0x14d))/0x5+-parseInt(_0x34bda0(0x148))/0x6+parseInt(_0x34bda0(0x149))/0x7+parseInt(_0x34bda0(0x146))/0x8*(parseInt(_0x34bda0(0x147))/0x9);if(_0x249e3b===_0x9d6f2c)break;else _0x3c7688['push'](_0x3c7688['shift']());}catch(_0x20a311){_0x3c7688['push'](_0x3c7688['shift']());}}}(a177_0x322c,0xeab20));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a177_0x5ce0(_0x425e4e,_0x30c709){_0x425e4e=_0x425e4e-0x146;const _0x322c4f=a177_0x322c();let _0x5ce001=_0x322c4f[_0x425e4e];return _0x5ce001;}function a177_0x322c(){const _0x2d6e16=['45615bOWzqI','104VNCyjx','2959692YOdXMX','7574435djyBgs','1325334dZlPaf','40VfYtnl','1813689BQDJUU','7368408ppSKSt','9954455CAxiom'];a177_0x322c=function(){return _0x2d6e16;};return a177_0x322c();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a178_0xebc549=a178_0x24fc;(function(_0x23caab,_0x3a9eb1){const _0x961cfb=a178_0x24fc,_0x162d02=_0x23caab();while(!![]){try{const _0x36621b=-parseInt(_0x961cfb(0x9c))/0x1*(-parseInt(_0x961cfb(0x97))/0x2)+-parseInt(_0x961cfb(0x94))/0x3+-parseInt(_0x961cfb(0x90))/0x4+parseInt(_0x961cfb(0x95))/0x5+-parseInt(_0x961cfb(0x8c))/0x6*(parseInt(_0x961cfb(0x8f))/0x7)+parseInt(_0x961cfb(0x82))/0x8*(-parseInt(_0x961cfb(0x96))/0x9)+-parseInt(_0x961cfb(0x93))/0xa*(-parseInt(_0x961cfb(0x91))/0xb);if(_0x36621b===_0x3a9eb1)break;else _0x162d02['push'](_0x162d02['shift']());}catch(_0x5b1f31){_0x162d02['push'](_0x162d02['shift']());}}}(a178_0x5645,0x94489));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a178_0x24fc(_0x2b0141,_0x310b77){_0x2b0141=_0x2b0141-0x80;const _0x5645a0=a178_0x5645();let _0x24fc43=_0x5645a0[_0x2b0141];return _0x24fc43;}import{getAsyncTaskStatus}from'../../core/api-client.js';function a178_0x5645(){const _0x5623a6=['8504BraDds','taskId',',\x20received\x20','status','task-id','read','appCode','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','apiError','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','6PCSeaP','flagMissing','str','348299shpobd','1053072VQrjoD','389323DtfaCk','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','190QbImcW','635052zzUEky','797005eXUDSi','5841ZysHns','14246OjCaRc','trim','isTerminal','cookie','task','139UxsQJC','string','compress'];a178_0x5645=function(){return _0x5623a6;};return a178_0x5645();}import{CliErrors}from'../../errors.js';export const taskStatus={'service':a178_0xebc549(0x9b),'command':a178_0xebc549(0x85),'description':a178_0xebc549(0x8b),'risk':a178_0xebc549(0x87),'defaultOutputFormat':a178_0xebc549(0x81),'structuredErrors':!![],'flags':[{'name':a178_0xebc549(0x86),'type':a178_0xebc549(0x80),'required':!![],'description':a178_0xebc549(0x89)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x307073){const _0x23c5fd=a178_0xebc549;if(!_0x307073['str'](_0x23c5fd(0x86))[_0x23c5fd(0x98)]())throw CliErrors[_0x23c5fd(0x8d)](_0x23c5fd(0x86));},async 'execute'(_0x4f8d21){const _0x2c7fc0=a178_0xebc549,_0x41ec29=_0x4f8d21[_0x2c7fc0(0x8e)]('task-id')[_0x2c7fc0(0x98)](),_0x493c8e=normalizeAsyncTask(await getAsyncTaskStatus(_0x41ec29,_0x4f8d21[_0x2c7fc0(0x88)],_0x4f8d21[_0x2c7fc0(0x9a)]));if(_0x493c8e[_0x2c7fc0(0x83)]!==_0x41ec29)throw CliErrors[_0x2c7fc0(0x8a)](_0x2c7fc0(0x92)+_0x41ec29+_0x2c7fc0(0x84)+_0x493c8e[_0x2c7fc0(0x83)]+'.');const _0x4c31be=buildAsyncTaskStatusCommand(_0x493c8e[_0x2c7fc0(0x83)],_0x4f8d21[_0x2c7fc0(0x88)]);return{'ok':!![],'message':asyncTaskMessage(_0x493c8e),'data':{'appCode':_0x4f8d21[_0x2c7fc0(0x88)],..._0x493c8e,'query':_0x493c8e[_0x2c7fc0(0x99)]?null:{'command':_0x4c31be}}};}};
|