@lovrabet/rabetbase-cli 2.3.15 → 2.3.16-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- 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/kb/create.js +1 -0
- package/lib/commands/kb/delete.js +1 -0
- package/lib/commands/kb/detail.js +1 -0
- package/lib/commands/kb/index.js +1 -0
- package/lib/commands/kb/list.js +1 -0
- package/lib/commands/kb/shared.js +1 -0
- package/lib/commands/kb/update.js +1 -0
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.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/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/ocr/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/restore.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/skills/skill-presence.js +1 -0
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a170_0xfd8dd8=a170_0x2890;(function(_0x375806,_0x5f20de){const _0x456353=a170_0x2890,_0x59b5f8=_0x375806();while(!![]){try{const _0x3d1905=parseInt(_0x456353(0x12f))/0x1*(-parseInt(_0x456353(0x125))/0x2)+-parseInt(_0x456353(0x116))/0x3+parseInt(_0x456353(0x118))/0x4*(parseInt(_0x456353(0x11c))/0x5)+-parseInt(_0x456353(0x131))/0x6*(parseInt(_0x456353(0x112))/0x7)+-parseInt(_0x456353(0x14c))/0x8+parseInt(_0x456353(0x135))/0x9*(parseInt(_0x456353(0x140))/0xa)+parseInt(_0x456353(0x121))/0xb*(parseInt(_0x456353(0x117))/0xc);if(_0x3d1905===_0x5f20de)break;else _0x59b5f8['push'](_0x59b5f8['shift']());}catch(_0x2958ce){_0x59b5f8['push'](_0x59b5f8['shift']());}}}(a170_0x4590,0x51867));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';function a170_0x2890(_0x48fd45,_0x92debc){_0x48fd45=_0x48fd45-0x109;const _0x4590fe=a170_0x4590();let _0x2890ba=_0x4590fe[_0x48fd45];return _0x2890ba;}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(_0x269fee){const _0x55ea3b=a170_0x2890;if(_0x269fee===_0x55ea3b(0x132))return[_0x55ea3b(0x122),'\x20\x20SELECT\x201\x20AS\x20id',_0x55ea3b(0x145),''][_0x55ea3b(0x142)]('\x0a');return[_0x55ea3b(0x141),''][_0x55ea3b(0x142)]('\x0a');}export const sqlCreate={'service':'sql','command':'create','description':a170_0xfd8dd8(0x13f),'risk':a170_0xfd8dd8(0x133),'flags':[{'name':a170_0xfd8dd8(0x10a),'type':a170_0xfd8dd8(0x137),'description':a170_0xfd8dd8(0x13b)},{'name':a170_0xfd8dd8(0x139),'type':'number','description':a170_0xfd8dd8(0x11f)},{'name':a170_0xfd8dd8(0x13c),'type':a170_0xfd8dd8(0x137),'enum':[a170_0xfd8dd8(0x143),a170_0xfd8dd8(0x132)],'description':a170_0xfd8dd8(0x119)}],async 'validate'(_0x395ea2){const _0x4074b5=a170_0xfd8dd8;if(!_0x395ea2['nonInteractive'])return;if(!_0x395ea2[_0x4074b5(0x11d)](_0x4074b5(0x10a))['trim']())throw CliErrors[_0x4074b5(0x114)]('name',_0x4074b5(0x14a));const _0x3b5b31=resolveProvidedDbId(_0x395ea2);if(typeof _0x3b5b31!==_0x4074b5(0x10b)||!Number['isFinite'](_0x3b5b31)||_0x3b5b31<=0x0)throw CliErrors[_0x4074b5(0x114)](_0x4074b5(0x139),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x395ea2[_0x4074b5(0x11d)](_0x4074b5(0x13c))[_0x4074b5(0x10f)]())throw CliErrors['flagMissing'](_0x4074b5(0x13c),_0x4074b5(0x128));},async 'dryRun'(_0x14a7fe){const _0x2e5b94=a170_0xfd8dd8,_0x628ab9=loadSqlProjectConfig(_0x14a7fe[_0x2e5b94(0x124)]),{sqlName:_0x384693,dbId:_0x56e566,dbName:_0x16791c,mode:_0x46701e}=await resolveSqlNewInputs(_0x14a7fe),_0x1f7451=buildSqlRelativePath('<server-generated-sqlCode>',_0x384693,_0x16791c,_0x46701e,_0x56e566),_0xfed3=_0x628ab9['sqlRootDir']+'/'+_0x1f7451;return{'method':_0x2e5b94(0x11a),'url':_0x2e5b94(0x10c),'body':{'appCode':_0x14a7fe[_0x2e5b94(0x124)],'sqlName':_0x384693,'dbId':_0x56e566,'mode':_0x46701e,'localPath':_0xfed3},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x628ab9['sqlRootDir']};},async 'execute'(_0x118209){const _0x103980=a170_0xfd8dd8,_0x4dc496=loadSqlProjectConfig(_0x118209[_0x103980(0x124)]),{sqlName:_0x5610b,dbId:_0x298559,dbName:_0xd9643f,mode:_0x50c641}=await resolveSqlNewInputs(_0x118209),_0x21fd0b=generateSqlTemplate(_0x50c641),_0x18a276=await createSqlQuery({'appCode':_0x118209[_0x103980(0x124)],'sqlName':_0x5610b,'dbId':_0x298559,'sqlContent':_0x21fd0b}),_0x2c9081=ensureRemoteSqlContent(_0x18a276),_0x5c2f99=_0xd9643f||await getDbName(_0x118209['appCode'],_0x298559)[_0x103980(0x127)](()=>undefined),_0x5a5418=buildSqlRelativePath(_0x18a276['sqlCode'],_0x18a276[_0x103980(0x11b)],_0x5c2f99,_0x50c641,_0x298559),_0x31f209=_0x4dc496[_0x103980(0x13d)]+'/'+_0x5a5418,_0x4a1586=buildLocalSqlFileContent({'sqlCode':_0x18a276['sqlCode'],'sqlName':_0x18a276['sqlName'],'dbId':_0x18a276['dbId']},_0x2c9081,{'dbName':_0x5c2f99,'mode':_0x50c641,'syncedAt':new Date()[_0x103980(0x138)](),'description':_0x18a276[_0x103980(0x11e)]});if(await fileExists(_0x31f209))throw CliErrors[_0x103980(0x14d)](_0x103980(0x147)+_0x31f209);await ensureParentDirectory(_0x31f209),await writeFile(_0x31f209,_0x4a1586,_0x103980(0x126));const _0x4b909c=await readSqlLockFile(_0x4dc496[_0x103980(0x14b)]),{lockData:_0x54dafc,appLock:_0x5416f7}=ensureSqlLockScope(_0x4b909c??createEmptySqlLock(),_0x4dc496[_0x103980(0x124)],_0x4dc496[_0x103980(0x113)],_0x103980(0x129));return _0x5416f7[_0x103980(0x10d)][_0x18a276[_0x103980(0x12e)]]={...buildSqlLockEntry(_0x18a276,_0x2c9081,computeSqlContentHash(_0x4a1586),{'dbName':_0x5c2f99}),'path':_0x5a5418,'mode':_0x50c641},_0x5416f7[_0x103980(0x146)]=new Date()[_0x103980(0x138)](),await writeSqlLockFile(_0x4dc496[_0x103980(0x14b)],_0x54dafc),{'ok':!![],'data':{'id':_0x18a276['id'],'sqlCode':_0x18a276['sqlCode'],'sqlName':_0x18a276[_0x103980(0x11b)],'dbId':_0x18a276['dbId'],'path':_0x31f209,'mode':_0x50c641},'message':_0x103980(0x123)+_0x18a276['sqlCode']};}};async function resolveSqlNewInputs(_0x5d6cef){const _0x2a5dc4=await resolveSqlNameInput(_0x5d6cef),{dbId:_0x59405b,dbName:_0x50d2f3}=await resolveDbSelection(_0x5d6cef),_0x2f35f7=await resolveSqlModeInput(_0x5d6cef);return{'sqlName':_0x2a5dc4,'dbId':_0x59405b,'dbName':_0x50d2f3,'mode':_0x2f35f7};}async function resolveSqlNameInput(_0x2ab539){const _0xc1a4b=a170_0xfd8dd8,_0x49885e=_0x2ab539[_0xc1a4b(0x11d)]('name')[_0xc1a4b(0x10f)]();if(_0x49885e)return _0x49885e;if(_0x2ab539[_0xc1a4b(0x134)])throw CliErrors[_0xc1a4b(0x114)](_0xc1a4b(0x10a),_0xc1a4b(0x14a));return(await input({'message':_0xc1a4b(0x109),'validate':_0x43e9b4=>_0x43e9b4[_0xc1a4b(0x10f)]()?!![]:'SQL\x20名称不能为空'}))[_0xc1a4b(0x10f)]();}async function resolveDbSelection(_0x9d391b){const _0x13bdae=a170_0xfd8dd8,_0x438045=resolveProvidedDbId(_0x9d391b);if(typeof _0x438045===_0x13bdae(0x10b)&&Number[_0x13bdae(0x144)](_0x438045)&&_0x438045>0x0)return{'dbId':_0x438045,'dbName':await getDbName(_0x9d391b[_0x13bdae(0x124)],_0x438045)[_0x13bdae(0x127)](()=>undefined)};if(_0x9d391b[_0x13bdae(0x134)])throw CliErrors['flagMissing'](_0x13bdae(0x139),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x65d6ba=await listDatabases(_0x9d391b[_0x13bdae(0x124)])[_0x13bdae(0x127)](()=>[]);if(_0x65d6ba[_0x13bdae(0x12c)]===0x1)return{'dbId':_0x65d6ba[0x0][_0x13bdae(0x13a)],'dbName':_0x65d6ba[0x0]['dbName']};if(_0x65d6ba[_0x13bdae(0x12c)]>0x1){const _0x36476b=await select({'message':_0x13bdae(0x14e),'choices':[..._0x65d6ba[_0x13bdae(0x120)](_0x1db9eb=>({'name':_0x1db9eb[_0x13bdae(0x10e)]+'\x20('+_0x1db9eb['dbId']+')','value':serializeDbSelection(_0x1db9eb)})),{'name':'✎\x20手动输入\x20dbId','value':_0x13bdae(0x12b)}]});if(_0x36476b!==_0x13bdae(0x12b))return deserializeDbSelection(_0x36476b);}const _0x256b39=await input({'message':_0x13bdae(0x12a),'validate':_0x575efc=>{const _0x29170b=_0x13bdae,_0x3e4bf4=_0x575efc[_0x29170b(0x10f)]();if(!_0x3e4bf4)return _0x29170b(0x111);const _0x1df566=Number(_0x3e4bf4);if(!Number[_0x29170b(0x148)](_0x1df566)||_0x1df566<=0x0)return _0x29170b(0x12d);return!![];}});return{'dbId':Number(_0x256b39[_0x13bdae(0x10f)]())};}function a170_0x4590(){const _0x534cad=['Target\x20database\x20ID','map','14571524ddLqXl','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Created\x20SQL\x20query\x20','appCode','14588odTYOP','utf8','catch','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','new','请输入目标数据库\x20dbId:','__manual__','length','dbId\x20必须为正整数','sqlCode','14FJSYBB','适合带动态标签的\x20MyBatis\x20XML\x20SQL','488574yZoxOF','mybatisXml','high-risk-write','nonInteractive','9PldmwB','MyBatis\x20XML(mybatisXml)','string','toISOString','db-id','dbId','SQL\x20query\x20display\x20name','mode','sqlRootDir','flag','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','2362410QwAuKe','SELECT\x201\x20AS\x20id;','join','sql','isFinite','</select>','lastSync','File\x20already\x20exists:\x20','isInteger','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','lockFilePath','4931384eIbZBG','validation','请选择目标数据库:','请输入\x20SQL\x20名称:','name','number','/smartapi/custom/saveUserCustomSql','sqls','dbName','trim','stringify','dbId\x20不能为空','49YcycCU','sqlRoot','flagMissing','Invalid\x20database\x20selection\x20payload:\x20','766101mJSjLI','12nyrJbo','28BOfSpP','Local\x20SQL\x20file\x20mode','POST','sqlName','226365KKlSBB','str','description'];a170_0x4590=function(){return _0x534cad;};return a170_0x4590();}async function resolveSqlModeInput(_0x1c3bf0){const _0x3e2658=a170_0xfd8dd8,_0xb43b71=_0x1c3bf0[_0x3e2658(0x11d)]('mode')['trim']();if(_0xb43b71===_0x3e2658(0x143)||_0xb43b71===_0x3e2658(0x132))return _0xb43b71;if(_0x1c3bf0['nonInteractive'])throw CliErrors[_0x3e2658(0x114)](_0x3e2658(0x13c),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':'普通\x20SQL(sql)','value':'sql','description':_0x3e2658(0x149)},{'name':_0x3e2658(0x136),'value':_0x3e2658(0x132),'description':_0x3e2658(0x130)}]});}function serializeDbSelection(_0x33ed9f){const _0x37a812=a170_0xfd8dd8;return JSON[_0x37a812(0x110)]({'dbId':_0x33ed9f[_0x37a812(0x13a)],'dbName':_0x33ed9f[_0x37a812(0x10e)]});}function deserializeDbSelection(_0x26b142){const _0x3339e7=a170_0xfd8dd8;try{const _0x2c0114=JSON['parse'](_0x26b142);if(typeof _0x2c0114['dbId']===_0x3339e7(0x10b)&&Number[_0x3339e7(0x144)](_0x2c0114[_0x3339e7(0x13a)]))return{'dbId':_0x2c0114[_0x3339e7(0x13a)],'dbName':_0x2c0114[_0x3339e7(0x10e)]};}catch{}throw CliErrors[_0x3339e7(0x14d)](_0x3339e7(0x115)+_0x26b142);}function resolveProvidedDbId(_0x5e9120){const _0x1d3c16=a170_0xfd8dd8,_0x374f79=_0x5e9120[_0x1d3c16(0x13e)](_0x1d3c16(0x139));if(typeof _0x374f79===_0x1d3c16(0x10b)&&Number['isFinite'](_0x374f79))return _0x374f79;return undefined;}
|
|
1
|
+
const a177_0x29b9fc=a177_0x1efd;(function(_0x3f988a,_0x129c78){const _0x17b313=a177_0x1efd,_0x348ae5=_0x3f988a();while(!![]){try{const _0x855f8d=parseInt(_0x17b313(0xfa))/0x1*(parseInt(_0x17b313(0xe3))/0x2)+parseInt(_0x17b313(0x11d))/0x3*(parseInt(_0x17b313(0xe4))/0x4)+parseInt(_0x17b313(0xee))/0x5+-parseInt(_0x17b313(0xe6))/0x6+-parseInt(_0x17b313(0xec))/0x7+-parseInt(_0x17b313(0x104))/0x8+-parseInt(_0x17b313(0x10d))/0x9*(-parseInt(_0x17b313(0xfe))/0xa);if(_0x855f8d===_0x129c78)break;else _0x348ae5['push'](_0x348ae5['shift']());}catch(_0x542d0e){_0x348ae5['push'](_0x348ae5['shift']());}}}(a177_0xb593,0xdbd50));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a177_0xb593(){const _0x22b83d=['lastSync','sqlCode','number','toISOString','validation','isInteger','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','create','appCode','dbName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sql','nonInteractive','/smartapi/custom/saveUserCustomSql','3ZegmpU','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','trim','length','20jcLiNQ','2885752tqQvRN','sqlRoot','8966742sidyuv','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','catch','请输入\x20SQL\x20名称:','flagMissing','dbId\x20不能为空','11464467hSRKQk','sqlName','3304550QNSzqK','lockFilePath','str','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','name','mode','File\x20already\x20exists:\x20','sqls','mybatisXml','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','isFinite','SQL\x20名称不能为空','31114RvhcjE','Invalid\x20database\x20selection\x20payload:\x20','db-id','dbId','10850HYWslV','Target\x20database\x20ID','join','适合带动态标签的\x20MyBatis\x20XML\x20SQL','SQL\x20query\x20display\x20name','flag','9505224ZGIpjU','sqlRootDir','__manual__','<server-generated-sqlCode>','parse','utf8','MyBatis\x20XML(mybatisXml)','Local\x20SQL\x20file\x20mode','请选择目标数据库:','29259kELiPh','</select>'];a177_0xb593=function(){return _0x22b83d;};return a177_0xb593();}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2d5420){const _0x8b085c=a177_0x1efd;if(_0x2d5420==='mybatisXml')return[_0x8b085c(0xf1),'\x20\x20SELECT\x201\x20AS\x20id',_0x8b085c(0x10e),''][_0x8b085c(0x100)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x8b085c(0x100)]('\x0a');}export const sqlCreate={'service':a177_0x29b9fc(0x11a),'command':a177_0x29b9fc(0x116),'description':a177_0x29b9fc(0xf7),'risk':'high-risk-write','flags':[{'name':a177_0x29b9fc(0xf2),'type':'string','description':a177_0x29b9fc(0x102)},{'name':a177_0x29b9fc(0xfc),'type':a177_0x29b9fc(0x111),'description':a177_0x29b9fc(0xff)},{'name':a177_0x29b9fc(0xf3),'type':'string','enum':[a177_0x29b9fc(0x11a),a177_0x29b9fc(0xf6)],'description':a177_0x29b9fc(0x10b)}],async 'validate'(_0x2339ab){const _0x221311=a177_0x29b9fc;if(!_0x2339ab[_0x221311(0x11b)])return;if(!_0x2339ab['str'](_0x221311(0xf2))[_0x221311(0xe1)]())throw CliErrors[_0x221311(0xea)](_0x221311(0xf2),_0x221311(0x11e));const _0x287614=resolveProvidedDbId(_0x2339ab);if(typeof _0x287614!==_0x221311(0x111)||!Number[_0x221311(0xf8)](_0x287614)||_0x287614<=0x0)throw CliErrors['flagMissing']('db-id',_0x221311(0xe7));if(!_0x2339ab[_0x221311(0xf0)]('mode')['trim']())throw CliErrors[_0x221311(0xea)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x39a193){const _0x4f9f17=a177_0x29b9fc,_0x178122=loadSqlProjectConfig(_0x39a193['appCode']),{sqlName:_0x2eefeb,dbId:_0x4a4019,dbName:_0x2fdc3a,mode:_0x396ebe}=await resolveSqlNewInputs(_0x39a193),_0xd15e9a=buildSqlRelativePath(_0x4f9f17(0x107),_0x2eefeb,_0x2fdc3a,_0x396ebe,_0x4a4019),_0x3430d2=_0x178122[_0x4f9f17(0x105)]+'/'+_0xd15e9a;return{'method':'POST','url':_0x4f9f17(0x11c),'body':{'appCode':_0x39a193[_0x4f9f17(0x117)],'sqlName':_0x2eefeb,'dbId':_0x4a4019,'mode':_0x396ebe,'localPath':_0x3430d2},'description':_0x4f9f17(0x119)+_0x178122[_0x4f9f17(0x105)]};},async 'execute'(_0xaf8054){const _0x2809b4=a177_0x29b9fc,_0x34f561=loadSqlProjectConfig(_0xaf8054[_0x2809b4(0x117)]),{sqlName:_0x4a1ea1,dbId:_0x577895,dbName:_0x224bb7,mode:_0x5b88ba}=await resolveSqlNewInputs(_0xaf8054),_0x24f741=generateSqlTemplate(_0x5b88ba),_0x41e15c=await createSqlQuery({'appCode':_0xaf8054[_0x2809b4(0x117)],'sqlName':_0x4a1ea1,'dbId':_0x577895,'sqlContent':_0x24f741}),_0x14ecb5=ensureRemoteSqlContent(_0x41e15c),_0x4b485b=_0x224bb7||await getDbName(_0xaf8054[_0x2809b4(0x117)],_0x577895)[_0x2809b4(0xe8)](()=>undefined),_0x3cbcfd=buildSqlRelativePath(_0x41e15c[_0x2809b4(0x110)],_0x41e15c[_0x2809b4(0xed)],_0x4b485b,_0x5b88ba,_0x577895),_0x2f9969=_0x34f561[_0x2809b4(0x105)]+'/'+_0x3cbcfd,_0x39ce95=buildLocalSqlFileContent({'sqlCode':_0x41e15c[_0x2809b4(0x110)],'sqlName':_0x41e15c[_0x2809b4(0xed)],'dbId':_0x41e15c[_0x2809b4(0xfd)]},_0x14ecb5,{'dbName':_0x4b485b,'mode':_0x5b88ba,'syncedAt':new Date()[_0x2809b4(0x112)](),'description':_0x41e15c['description']});if(await fileExists(_0x2f9969))throw CliErrors[_0x2809b4(0x113)](_0x2809b4(0xf4)+_0x2f9969);await ensureParentDirectory(_0x2f9969),await writeFile(_0x2f9969,_0x39ce95,_0x2809b4(0x109));const _0x19836a=await readSqlLockFile(_0x34f561['lockFilePath']),{lockData:_0x56294e,appLock:_0x26e5b6}=ensureSqlLockScope(_0x19836a??createEmptySqlLock(),_0x34f561[_0x2809b4(0x117)],_0x34f561[_0x2809b4(0xe5)],'new');return _0x26e5b6[_0x2809b4(0xf5)][_0x41e15c[_0x2809b4(0x110)]]={...buildSqlLockEntry(_0x41e15c,_0x14ecb5,computeSqlContentHash(_0x39ce95),{'dbName':_0x4b485b}),'path':_0x3cbcfd,'mode':_0x5b88ba},_0x26e5b6[_0x2809b4(0x10f)]=new Date()[_0x2809b4(0x112)](),await writeSqlLockFile(_0x34f561[_0x2809b4(0xef)],_0x56294e),{'ok':!![],'data':{'id':_0x41e15c['id'],'sqlCode':_0x41e15c[_0x2809b4(0x110)],'sqlName':_0x41e15c[_0x2809b4(0xed)],'dbId':_0x41e15c[_0x2809b4(0xfd)],'path':_0x2f9969,'mode':_0x5b88ba},'message':_0x2809b4(0xe0)+_0x41e15c[_0x2809b4(0x110)]};}};async function resolveSqlNewInputs(_0x49bac3){const _0x495af1=await resolveSqlNameInput(_0x49bac3),{dbId:_0x434df3,dbName:_0x212937}=await resolveDbSelection(_0x49bac3),_0x454c80=await resolveSqlModeInput(_0x49bac3);return{'sqlName':_0x495af1,'dbId':_0x434df3,'dbName':_0x212937,'mode':_0x454c80};}function a177_0x1efd(_0xa919e8,_0x528a56){_0xa919e8=_0xa919e8-0xe0;const _0xb59340=a177_0xb593();let _0x1efdba=_0xb59340[_0xa919e8];return _0x1efdba;}async function resolveSqlNameInput(_0x1632d7){const _0x5f54c5=a177_0x29b9fc,_0x9d6284=_0x1632d7[_0x5f54c5(0xf0)]('name')[_0x5f54c5(0xe1)]();if(_0x9d6284)return _0x9d6284;if(_0x1632d7['nonInteractive'])throw CliErrors[_0x5f54c5(0xea)]('name',_0x5f54c5(0x11e));return(await input({'message':_0x5f54c5(0xe9),'validate':_0x7bd9bc=>_0x7bd9bc['trim']()?!![]:_0x5f54c5(0xf9)}))[_0x5f54c5(0xe1)]();}async function resolveDbSelection(_0x59bdc3){const _0x3cebc5=a177_0x29b9fc,_0x2e638e=resolveProvidedDbId(_0x59bdc3);if(typeof _0x2e638e==='number'&&Number['isFinite'](_0x2e638e)&&_0x2e638e>0x0)return{'dbId':_0x2e638e,'dbName':await getDbName(_0x59bdc3[_0x3cebc5(0x117)],_0x2e638e)[_0x3cebc5(0xe8)](()=>undefined)};if(_0x59bdc3['nonInteractive'])throw CliErrors[_0x3cebc5(0xea)](_0x3cebc5(0xfc),_0x3cebc5(0xe7));const _0x3de581=await listDatabases(_0x59bdc3[_0x3cebc5(0x117)])['catch'](()=>[]);if(_0x3de581[_0x3cebc5(0xe2)]===0x1)return{'dbId':_0x3de581[0x0][_0x3cebc5(0xfd)],'dbName':_0x3de581[0x0]['dbName']};if(_0x3de581[_0x3cebc5(0xe2)]>0x1){const _0x67a454=await select({'message':_0x3cebc5(0x10c),'choices':[..._0x3de581['map'](_0x53024d=>({'name':_0x53024d['dbName']+'\x20('+_0x53024d[_0x3cebc5(0xfd)]+')','value':serializeDbSelection(_0x53024d)})),{'name':'✎\x20手动输入\x20dbId','value':_0x3cebc5(0x106)}]});if(_0x67a454!==_0x3cebc5(0x106))return deserializeDbSelection(_0x67a454);}const _0x106e1e=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x2d3ca1=>{const _0x279822=_0x3cebc5,_0x44c4fd=_0x2d3ca1[_0x279822(0xe1)]();if(!_0x44c4fd)return _0x279822(0xeb);const _0x10298e=Number(_0x44c4fd);if(!Number[_0x279822(0x114)](_0x10298e)||_0x10298e<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x106e1e[_0x3cebc5(0xe1)]())};}async function resolveSqlModeInput(_0x4a3f16){const _0xeda318=a177_0x29b9fc,_0xfde804=_0x4a3f16[_0xeda318(0xf0)](_0xeda318(0xf3))[_0xeda318(0xe1)]();if(_0xfde804===_0xeda318(0x11a)||_0xfde804===_0xeda318(0xf6))return _0xfde804;if(_0x4a3f16[_0xeda318(0x11b)])throw CliErrors[_0xeda318(0xea)](_0xeda318(0xf3),_0xeda318(0x115));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':'普通\x20SQL(sql)','value':_0xeda318(0x11a),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0xeda318(0x10a),'value':_0xeda318(0xf6),'description':_0xeda318(0x101)}]});}function serializeDbSelection(_0x3123bf){const _0x4b60f7=a177_0x29b9fc;return JSON['stringify']({'dbId':_0x3123bf[_0x4b60f7(0xfd)],'dbName':_0x3123bf[_0x4b60f7(0x118)]});}function deserializeDbSelection(_0x2691af){const _0x5d0030=a177_0x29b9fc;try{const _0x326e1e=JSON[_0x5d0030(0x108)](_0x2691af);if(typeof _0x326e1e[_0x5d0030(0xfd)]==='number'&&Number[_0x5d0030(0xf8)](_0x326e1e[_0x5d0030(0xfd)]))return{'dbId':_0x326e1e['dbId'],'dbName':_0x326e1e['dbName']};}catch{}throw CliErrors['validation'](_0x5d0030(0xfb)+_0x2691af);}function resolveProvidedDbId(_0x69e85a){const _0x1f0705=a177_0x29b9fc,_0x4a3184=_0x69e85a[_0x1f0705(0x103)](_0x1f0705(0xfc));if(typeof _0x4a3184===_0x1f0705(0x111)&&Number['isFinite'](_0x4a3184))return _0x4a3184;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a178_0x1df11f=a178_0x4c3f;function a178_0x427a(){const _0x1203c0=['POST','high-risk-write','SQL\x20lock\x20file\x20not\x20found.','str','replace','1891040NPZidr','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','5McPSBq','lastSync','fromEntries','validation','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','projectRoot','delete','1872717SvRBUp','remoteId','Would\x20delete\x20SQL\x20','5262363HdDRRo','10TdtEQu','sqls','appCode','91JSVXnO','\x20(local\x20file\x20moved\x20to\x20trash)','252730iCEcTv','1626216Fbfxlp','lockFilePath','filter','/smartapi/custom/deleteUserCustomSql','70352xrbknt','3516348rnMvKc','sqlRootDir','startsWith','trashDir','trashedTo','Deleted\x20','toISOString'];a178_0x427a=function(){return _0x1203c0;};return a178_0x427a();}(function(_0x3d510c,_0x176b66){const _0x7a8ade=a178_0x4c3f,_0x175bec=_0x3d510c();while(!![]){try{const _0xefd776=parseInt(_0x7a8ade(0x19c))/0x1+parseInt(_0x7a8ade(0x18a))/0x2+-parseInt(_0x7a8ade(0x193))/0x3+-parseInt(_0x7a8ade(0x17e))/0x4*(parseInt(_0x7a8ade(0x18c))/0x5)+parseInt(_0x7a8ade(0x19d))/0x6+parseInt(_0x7a8ade(0x19a))/0x7*(parseInt(_0x7a8ade(0x17d))/0x8)+parseInt(_0x7a8ade(0x196))/0x9*(parseInt(_0x7a8ade(0x197))/0xa);if(_0xefd776===_0x176b66)break;else _0x175bec['push'](_0x175bec['shift']());}catch(_0x1ba0ba){_0x175bec['push'](_0x175bec['shift']());}}}(a178_0x427a,0xa259d));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a178_0x4c3f(_0x3b6ee0,_0x3afd1c){_0x3b6ee0=_0x3b6ee0-0x17a;const _0x427ad8=a178_0x427a();let _0x4c3f77=_0x427ad8[_0x3b6ee0];return _0x4c3f77;}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':'sql','command':a178_0x1df11f(0x192),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a178_0x1df11f(0x186),'flags':[SQLCODE_FLAG],async 'validate'(_0x23d69b){const _0x178903=a178_0x1df11f,_0x3903fb=loadSqlProjectConfig(_0x23d69b[_0x178903(0x199)]),_0x15dbe1=await readSqlLockFile(_0x3903fb[_0x178903(0x17a)]);if(!_0x15dbe1)throw CliErrors['validation'](_0x178903(0x190));},async 'dryRun'(_0x37f2cd){const _0x2ee747=a178_0x1df11f,_0xbedcc1=loadSqlProjectConfig(_0x37f2cd[_0x2ee747(0x199)]),_0x5b2550=await readSqlLockFile(_0xbedcc1[_0x2ee747(0x17a)]);if(!_0x5b2550)throw CliErrors[_0x2ee747(0x18f)](_0x2ee747(0x190));const {appLock:_0x44d32e}=ensureSqlLockScope(_0x5b2550,_0x37f2cd[_0x2ee747(0x199)],_0xbedcc1['sqlRoot'],'delete'),_0x40687f=_0x37f2cd[_0x2ee747(0x188)]('sqlcode'),_0x1ce2ce=_0x44d32e['sqls'][_0x40687f];if(!_0x1ce2ce)throw CliErrors[_0x2ee747(0x18f)](_0x2ee747(0x18b)+_0x40687f+'\x22.');return{'method':_0x2ee747(0x185),'url':_0x2ee747(0x17c),'body':{'sqlCode':_0x40687f,'id':_0x1ce2ce[_0x2ee747(0x194)],'localPath':resolveLocalSqlFilePath(_0xbedcc1,_0x40687f,_0x1ce2ce)},'description':_0x2ee747(0x195)+_0x40687f+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0xbedcc1[_0x2ee747(0x181)]};},async 'execute'(_0x22f596){const _0x5f3c9f=a178_0x1df11f,_0x39f8ed=loadSqlProjectConfig(_0x22f596[_0x5f3c9f(0x199)]),_0x471598=await readSqlLockFile(_0x39f8ed['lockFilePath']);if(!_0x471598)throw CliErrors[_0x5f3c9f(0x18f)](_0x5f3c9f(0x187));const {lockData:_0x207259,appLock:_0x549e06}=ensureSqlLockScope(_0x471598,_0x22f596[_0x5f3c9f(0x199)],_0x39f8ed['sqlRoot'],_0x5f3c9f(0x192)),_0x359b24=_0x22f596[_0x5f3c9f(0x188)]('sqlcode'),_0x2e5429=_0x549e06['sqls'][_0x359b24];if(!_0x2e5429)throw CliErrors[_0x5f3c9f(0x18f)](_0x5f3c9f(0x18b)+_0x359b24+'\x22.');await deleteSqlQuery({'id':_0x2e5429[_0x5f3c9f(0x194)],'sqlCode':_0x359b24}),_0x549e06[_0x5f3c9f(0x198)]=Object[_0x5f3c9f(0x18e)](Object['entries'](_0x549e06[_0x5f3c9f(0x198)])[_0x5f3c9f(0x17b)](([_0x6eaa4e])=>_0x6eaa4e!==_0x359b24)),_0x549e06[_0x5f3c9f(0x18d)]=new Date()[_0x5f3c9f(0x184)](),await writeSqlLockFile(_0x39f8ed[_0x5f3c9f(0x17a)],_0x207259);const _0x4d473c=resolveLocalSqlFilePath(_0x39f8ed,_0x359b24,_0x2e5429);let _0x4e6817;await fileExists(_0x4d473c)&&(_0x4e6817=await moveToTrash(_0x39f8ed[_0x5f3c9f(0x191)],_0x39f8ed[_0x5f3c9f(0x181)],_0x4d473c),await cleanupEmptyDirectories(dirname(_0x4d473c),_0x39f8ed[_0x5f3c9f(0x17f)]));const _0x19f5eb={'deleted':_0x359b24,'remoteId':_0x2e5429['remoteId']};if(_0x4e6817)_0x19f5eb[_0x5f3c9f(0x182)]=_0x4e6817;return{'ok':!![],'data':_0x19f5eb,'message':_0x5f3c9f(0x183)+_0x359b24+(_0x4e6817?_0x5f3c9f(0x19b):'')};}};async function moveToTrash(_0x718c06,_0x4ffe94,_0x176650){const _0x809bc6=a178_0x1df11f,_0x577b49=new Date()[_0x809bc6(0x184)]()[_0x809bc6(0x189)](/[:.]/g,'-'),_0x5e875c=relative(_0x718c06,_0x176650),_0x5a4279=join(_0x4ffe94,_0x577b49,_0x5e875c);return await mkdir(dirname(_0x5a4279),{'recursive':!![]}),await rename(_0x176650,_0x5a4279),_0x5a4279;}async function cleanupEmptyDirectories(_0x78b0f2,_0x2acf9d){const _0x18016a=a178_0x1df11f;let _0x5e14c5=resolve(_0x78b0f2);const _0x18367c=resolve(_0x2acf9d);while(_0x5e14c5[_0x18016a(0x180)](''+_0x18367c+sep)||_0x5e14c5===_0x18367c){if(_0x5e14c5===_0x18367c)return;try{const _0x11fd47=await readdir(_0x5e14c5);if(_0x11fd47['length']>0x0)return;await rmdir(_0x5e14c5);}catch{return;}_0x5e14c5=dirname(_0x5e14c5);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a179_0x4bd2(){const _0x4c219a=['1009464LOyUIO','description','7HjTlSD','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','1764OAvxcB','detail','44vitEFx','907470dJeNdE','appCode','verbose','7928HVJKnm','78IAxBAA','420504XroEFy','str','1590570HmsJkO','sqlcode','sqlCode','Return\x20full\x20raw\x20SQL\x20query\x20object','dbId','10rTeuKn','82398chXVlO','18746UgDusD'];a179_0x4bd2=function(){return _0x4c219a;};return a179_0x4bd2();}const a179_0x4921c3=a179_0x4d21;(function(_0x36561f,_0x4b7900){const _0x1cab27=a179_0x4d21,_0x1f5169=_0x36561f();while(!![]){try{const _0x5b38aa=-parseInt(_0x1cab27(0x1aa))/0x1+-parseInt(_0x1cab27(0x1ab))/0x2*(parseInt(_0x1cab27(0x1b7))/0x3)+parseInt(_0x1cab27(0x1b8))/0x4*(parseInt(_0x1cab27(0x1a9))/0x5)+-parseInt(_0x1cab27(0x1a4))/0x6*(parseInt(_0x1cab27(0x1ae))/0x7)+-parseInt(_0x1cab27(0x1b6))/0x8*(-parseInt(_0x1cab27(0x1b0))/0x9)+parseInt(_0x1cab27(0x1b3))/0xa+-parseInt(_0x1cab27(0x1b2))/0xb*(-parseInt(_0x1cab27(0x1ac))/0xc);if(_0x5b38aa===_0x4b7900)break;else _0x1f5169['push'](_0x1f5169['shift']());}catch(_0x4728d2){_0x1f5169['push'](_0x1f5169['shift']());}}}(a179_0x4bd2,0x3ab94));import{getSqlQueryInfo}from'../../core/api-client.js';function a179_0x4d21(_0x30cd8f,_0x529176){_0x30cd8f=_0x30cd8f-0x1a3;const _0x4bd2ed=a179_0x4bd2();let _0x4d213b=_0x4bd2ed[_0x30cd8f];return _0x4d213b;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a179_0x4921c3(0x1b1),'description':a179_0x4921c3(0x1af),'risk':'read','flags':[SQLCODE_FLAG,{'name':a179_0x4921c3(0x1b5),'type':'boolean','description':a179_0x4921c3(0x1a7)}],async 'execute'(_0x205510){const _0x14c593=a179_0x4921c3,_0x1e9b07=await getSqlQueryInfo(_0x205510['appCode'],_0x205510[_0x14c593(0x1a3)](_0x14c593(0x1a5))),_0xd156=_0x205510['bool']('verbose');if(_0xd156)return{'ok':!![],'data':_0x1e9b07};const _0x13d5df=_0x1e9b07['dbId']?await getDbName(_0x205510[_0x14c593(0x1b4)],_0x1e9b07[_0x14c593(0x1a8)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1e9b07[_0x14c593(0x1a6)],'sqlName':_0x1e9b07['sqlName'],'db':_0x13d5df?_0x13d5df+'\x20('+_0x1e9b07[_0x14c593(0x1a8)]+')':_0x1e9b07['dbId']??'','description':_0x1e9b07[_0x14c593(0x1ad)]??'','sqlContent':_0x1e9b07['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a180_0x2b71(_0x17fb82,_0x53da71){_0x17fb82=_0x17fb82-0x119;const _0x274464=a180_0x2744();let _0x2b71d9=_0x274464[_0x17fb82];return _0x2b71d9;}const a180_0x5aa633=a180_0x2b71;(function(_0x4e7b51,_0x39a9fc){const _0x118766=a180_0x2b71,_0x1605b2=_0x4e7b51();while(!![]){try{const _0x3fd7c0=parseInt(_0x118766(0x11d))/0x1+-parseInt(_0x118766(0x11e))/0x2*(parseInt(_0x118766(0x12b))/0x3)+parseInt(_0x118766(0x128))/0x4*(-parseInt(_0x118766(0x11f))/0x5)+-parseInt(_0x118766(0x132))/0x6*(-parseInt(_0x118766(0x119))/0x7)+-parseInt(_0x118766(0x12e))/0x8+parseInt(_0x118766(0x121))/0x9*(parseInt(_0x118766(0x130))/0xa)+-parseInt(_0x118766(0x11c))/0xb*(-parseInt(_0x118766(0x12a))/0xc);if(_0x3fd7c0===_0x39a9fc)break;else _0x1605b2['push'](_0x1605b2['shift']());}catch(_0x35f736){_0x1605b2['push'](_0x1605b2['shift']());}}}(a180_0x2744,0x8dcc1));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a180_0x5aa633(0x12f),'description':a180_0x5aa633(0x12c),'risk':a180_0x5aa633(0x11b),'flags':[SQLCODE_FLAG,{'name':a180_0x5aa633(0x120),'type':a180_0x5aa633(0x131),'description':a180_0x5aa633(0x125)}],async 'execute'(_0x1efbc1){const _0x466445=a180_0x5aa633,_0x3f8c51=parseJsonParams(_0x1efbc1[_0x466445(0x126)](_0x466445(0x120))),_0x19ce99=Date['now'](),_0xd4f1bb=await executeSql(_0x1efbc1['appCode'],_0x1efbc1[_0x466445(0x126)]('sqlcode'),_0x3f8c51),_0x42b1d3=Date[_0x466445(0x12d)]()-_0x19ce99,_0x10355c=_0xd4f1bb?.[_0x466445(0x123)]??_0xd4f1bb,_0x4e3b4e=_0xd4f1bb?.[_0x466445(0x127)]??!![];if(!_0x4e3b4e)return{'ok':![],'data':{'error':_0xd4f1bb?.[_0x466445(0x129)]||_0x466445(0x11a),'elapsed':_0x42b1d3},'message':'SQL\x20execution\x20failed'};const _0x1c90fd=Array[_0x466445(0x122)](_0x10355c)?_0x10355c:[];return{'ok':!![],'data':{'rows':_0x1c90fd,'rowCount':_0x1c90fd[_0x466445(0x124)],'elapsed':_0x42b1d3},'message':'Returned\x20'+_0x1c90fd['length']+'\x20row(s)\x20in\x20'+_0x42b1d3+'ms'};}};function a180_0x2744(){const _0x5ae0ce=['2paNVtd','3180msiYcz','params','9stCZcc','isArray','execResult','length','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','str','execSuccess','5588dGpsoe','execError','12924UAIlAY','405837eyFOCw','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','now','7411184iCyBLO','exec','3834170fvtSoW','string','3896154bUzMdv','7moBVba','SQL\x20execution\x20failed','read','12793HdtNnw','245643uVHLJv'];a180_0x2744=function(){return _0x5ae0ce;};return a180_0x2744();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x356864,_0x36b210){const _0x24397c=a181_0x5c2c,_0x2334b1=_0x356864();while(!![]){try{const _0x3a98d5=-parseInt(_0x24397c(0x89))/0x1*(-parseInt(_0x24397c(0x8d))/0x2)+-parseInt(_0x24397c(0x8f))/0x3*(-parseInt(_0x24397c(0x8c))/0x4)+parseInt(_0x24397c(0x8b))/0x5*(-parseInt(_0x24397c(0x90))/0x6)+parseInt(_0x24397c(0x91))/0x7*(-parseInt(_0x24397c(0x94))/0x8)+parseInt(_0x24397c(0x95))/0x9*(parseInt(_0x24397c(0x8e))/0xa)+parseInt(_0x24397c(0x8a))/0xb+-parseInt(_0x24397c(0x93))/0xc*(parseInt(_0x24397c(0x92))/0xd);if(_0x3a98d5===_0x36b210)break;else _0x2334b1['push'](_0x2334b1['shift']());}catch(_0x283441){_0x2334b1['push'](_0x2334b1['shift']());}}}(a181_0x5970,0xd8479));function a181_0x5970(){const _0x265431=['612828zhGnEI','9txzukl','18925819gtMXry','1930ZuXZoD','4134908nIoPKX','291602IgHEGj','90hLQTet','3jmhJzM','10794zcJvVE','418663kXIEXp','416CHEjEM','668700OSuoug','176EGnUlJ'];a181_0x5970=function(){return _0x265431;};return a181_0x5970();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a181_0x5c2c(_0x5b1e32,_0x3cb90d){_0x5b1e32=_0x5b1e32-0x89;const _0x5970b8=a181_0x5970();let _0x5c2cb5=_0x5970b8[_0x5b1e32];return _0x5c2cb5;}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
|
-
function
|
|
1
|
+
function a182_0x582b(){const _0x4c188a=['string','2341420dKWdxy','List\x20custom\x20SQL\x20queries','page','Found\x20','4146376hVImcv','name','read','number','Page\x20number','verbose','16qnnzeA','10SVzlHW','1047483NbfTTu','16705678NNhOuw','sqlCode','dbId','sqlName','\x20SQL\x20queries\x20(total:\x20','pagesize','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','appCode','all','list','map','paging','91899iHoaUK','5268sLCJPu','sql','22SsueUf','146176QEBIVB','532NuJlXG','boolean','num','length','str'];a182_0x582b=function(){return _0x4c188a;};return a182_0x582b();}function a182_0x4c3f(_0x169afa,_0x2a233b){_0x169afa=_0x169afa-0x92;const _0x582b01=a182_0x582b();let _0x4c3fd3=_0x582b01[_0x169afa];return _0x4c3fd3;}const a182_0x9b7291=a182_0x4c3f;(function(_0x272f5d,_0x194634){const _0xc24598=a182_0x4c3f,_0x21c38c=_0x272f5d();while(!![]){try{const _0x163697=parseInt(_0xc24598(0xac))/0x1+-parseInt(_0xc24598(0xab))/0x2*(-parseInt(_0xc24598(0xa8))/0x3)+-parseInt(_0xc24598(0x93))/0x4+-parseInt(_0xc24598(0xb3))/0x5+-parseInt(_0xc24598(0xa9))/0x6*(-parseInt(_0xc24598(0xad))/0x7)+parseInt(_0xc24598(0x99))/0x8*(parseInt(_0xc24598(0x9b))/0x9)+parseInt(_0xc24598(0x9a))/0xa*(parseInt(_0xc24598(0x9c))/0xb);if(_0x163697===_0x194634)break;else _0x21c38c['push'](_0x21c38c['shift']());}catch(_0x1b49df){_0x21c38c['push'](_0x21c38c['shift']());}}}(a182_0x582b,0xc272d));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a182_0x9b7291(0xaa),'command':a182_0x9b7291(0xa5),'description':a182_0x9b7291(0xb4),'risk':a182_0x9b7291(0x95),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a182_0x9b7291(0x94),'type':a182_0x9b7291(0xb2),'description':'Filter\x20by\x20SQL\x20name'},{'name':a182_0x9b7291(0xb5),'type':a182_0x9b7291(0x96),'description':a182_0x9b7291(0x97),'default':0x1},{'name':'pagesize','type':a182_0x9b7291(0x96),'description':'Page\x20size'},{'name':a182_0x9b7291(0x98),'type':a182_0x9b7291(0xae),'description':a182_0x9b7291(0xa2)}],async 'execute'(_0x82c7e9){const _0x5089b7=a182_0x9b7291,_0x19307c=await listSqlQueries(_0x82c7e9['appCode'],{'sqlCode':_0x82c7e9[_0x5089b7(0xb1)]('sqlcode')||undefined,'sqlName':_0x82c7e9['str'](_0x5089b7(0x94))||undefined,'currentPage':_0x82c7e9['num'](_0x5089b7(0xb5)),'pageSize':_0x82c7e9[_0x5089b7(0xaf)](_0x5089b7(0xa1),0x32)}),_0x45d1cd=_0x82c7e9['bool'](_0x5089b7(0x98)),_0x2ea766=_0x19307c['tableData']??[],_0xd79a7d=_0x19307c[_0x5089b7(0xa7)]?.['totalCount']??_0x2ea766['length'];let _0xd21a92;return _0x45d1cd?_0xd21a92=_0x2ea766:_0xd21a92=await Promise[_0x5089b7(0xa4)](_0x2ea766[_0x5089b7(0xa6)](async _0x3ee66a=>{const _0x134b86=_0x5089b7;let _0x5371e3;try{_0x5371e3=_0x3ee66a[_0x134b86(0x9e)]?await getDbName(_0x82c7e9[_0x134b86(0xa3)],_0x3ee66a['dbId']):undefined;}catch{}return{'sqlCode':_0x3ee66a[_0x134b86(0x9d)],'sqlName':_0x3ee66a[_0x134b86(0x9f)],'description':_0x3ee66a['description']??'','db':_0x5371e3?_0x5371e3+'\x20('+_0x3ee66a[_0x134b86(0x9e)]+')':_0x3ee66a[_0x134b86(0x9e)]??''};})),{'ok':!![],'data':_0xd21a92,'message':_0x2ea766[_0x5089b7(0xb0)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x5089b7(0x92)+_0x2ea766['length']+_0x5089b7(0xa0)+_0xd79a7d+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a176_0x3c2e27=a176_0x4f17;(function(_0x5ef697,_0x413325){const _0x32f187=a176_0x4f17,_0x13c3bc=_0x5ef697();while(!![]){try{const _0x3c3db8=parseInt(_0x32f187(0x19c))/0x1+parseInt(_0x32f187(0x1a8))/0x2*(-parseInt(_0x32f187(0x1b3))/0x3)+parseInt(_0x32f187(0x1aa))/0x4*(-parseInt(_0x32f187(0x18e))/0x5)+parseInt(_0x32f187(0x188))/0x6+parseInt(_0x32f187(0x1ae))/0x7+parseInt(_0x32f187(0x191))/0x8+-parseInt(_0x32f187(0x185))/0x9*(parseInt(_0x32f187(0x1a0))/0xa);if(_0x3c3db8===_0x413325)break;else _0x13c3bc['push'](_0x13c3bc['shift']());}catch(_0x5ef0ff){_0x13c3bc['push'](_0x13c3bc['shift']());}}}(a176_0x4333,0x1a693));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';function a176_0x4f17(_0x499b18,_0x338b16){_0x499b18=_0x499b18-0x181;const _0x43337d=a176_0x4333();let _0x4f178a=_0x43337d[_0x499b18];return _0x4f178a;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a176_0x4333(){const _0x514bab=['string','887936WmHgMy','mybatisXml','description','name','message','force','test','dbId','trimStart','\x20SQL\x20file(s)\x20into\x20','totalCount','8897ADoNgt','No\x20remote\x20SQL\x20queries\x20matched.','pull','write','458580VBgEAV','conflict','utf8','appCode','sqls','local\x20differs\x20from\x20remote','sqlName','unchanged','25094uSmxnh','Would\x20pull\x20','108952ZkAXSx','str','catch','toISOString','1444114NzYZaj','bool','\x20written,\x20','sql','Force\x20pull\x20cancelled.','33LHcyQd','nonInteractive','filter','sqlContent','tableData','Pull\x20complete:\x20','sqlRoot','join','sqlRootDir','push','Force\x20overwrite\x20local\x20unsynced\x20changes','Filter\x20by\x20SQL\x20display\x20name','\x20skipped,\x20','lockFilePath','POST','18sehsBk','paging','length','560610CphRtE','sqlCode','sqlcode','boolean','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','15xmdnYX','path'];a176_0x4333=function(){return _0x514bab;};return a176_0x4333();}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x335447,_0x436c7b){const _0x4a8c44=a176_0x4f17,_0x26f264=[];let _0x4a6d1c=0x1;while(!![]){const _0x2e01b4=await listSqlQueries(_0x335447,{'currentPage':_0x4a6d1c,'pageSize':PAGE_SIZE,'sqlCode':_0x436c7b[_0x4a8c44(0x189)],'sqlName':_0x436c7b[_0x4a8c44(0x1a6)]}),_0x38d7fc=_0x2e01b4[_0x4a8c44(0x1b7)]??[];_0x26f264[_0x4a8c44(0x1bc)](..._0x38d7fc);if(_0x38d7fc[_0x4a8c44(0x187)]===0x0)break;const _0x5e7da6=_0x2e01b4[_0x4a8c44(0x186)]?.[_0x4a8c44(0x19b)];if(_0x5e7da6!=null?_0x26f264['length']>=_0x5e7da6:_0x38d7fc[_0x4a8c44(0x187)]<PAGE_SIZE)break;_0x4a6d1c++;}return _0x26f264;}async function ensureSqlContent(_0x460ab8){const _0x281c02=a176_0x4f17;if(_0x460ab8[_0x281c02(0x1b6)]!=null&&String(_0x460ab8['sqlContent'])[_0x281c02(0x187)]>0x0)return _0x460ab8;return getSqlQueryDetail(_0x460ab8[_0x281c02(0x189)]);}export const sqlPull={'service':a176_0x3c2e27(0x1b1),'command':a176_0x3c2e27(0x19e),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a176_0x3c2e27(0x19f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a176_0x3c2e27(0x194),'type':a176_0x3c2e27(0x190),'description':a176_0x3c2e27(0x181)},{'name':a176_0x3c2e27(0x196),'type':a176_0x3c2e27(0x18b),'description':a176_0x3c2e27(0x1bd)}],async 'dryRun'(_0x45b08a){const _0x1c11c1=a176_0x3c2e27,_0x44a286=loadSqlProjectConfig(_0x45b08a[_0x1c11c1(0x1a3)]),_0x18ab45=await readSqlLockFile(_0x44a286[_0x1c11c1(0x183)]),{appLock:_0x274e2a}=ensureSqlLockScope(_0x18ab45??createEmptySqlLock(),_0x44a286['appCode'],_0x44a286['sqlRoot'],_0x1c11c1(0x19e)),_0x260082=await fetchAllSqlQueries(_0x45b08a[_0x1c11c1(0x1a3)],{'sqlCode':_0x45b08a['str'](_0x1c11c1(0x18a))||undefined,'sqlName':_0x45b08a['str'](_0x1c11c1(0x194))||undefined}),_0x114881=[];for(const _0x221e42 of _0x260082){const _0x1d25ab=await ensureSqlContent(_0x221e42),_0x431128=ensureRemoteSqlContent(_0x1d25ab),_0x74a5c5=detectModeFromSql(_0x1d25ab),_0x51c757=_0x1d25ab[_0x1c11c1(0x198)]?await getDbName(_0x45b08a[_0x1c11c1(0x1a3)],Number(_0x1d25ab[_0x1c11c1(0x198)]))[_0x1c11c1(0x1ac)](()=>undefined):undefined,_0x3f5546=buildLocalSqlFileContent({'sqlCode':_0x1d25ab[_0x1c11c1(0x189)],'sqlName':_0x1d25ab[_0x1c11c1(0x1a6)],'dbId':_0x1d25ab[_0x1c11c1(0x198)]},_0x431128,{'dbName':_0x51c757,'mode':_0x74a5c5,'syncedAt':new Date()[_0x1c11c1(0x1ad)](),'description':_0x1d25ab[_0x1c11c1(0x193)]}),_0x55ab45=buildSqlLockEntry(_0x1d25ab,_0x431128,'',{'dbName':_0x51c757}),_0x2c78e8=resolveLocalSqlFilePath(_0x44a286,_0x1d25ab['sqlCode'],_0x55ab45);let _0x35d6ba='would_pull',_0x489a52;if(await fileExists(_0x2c78e8)){const _0x4c28ae=await readFile(_0x2c78e8,_0x1c11c1(0x1a2));isEquivalentPulledSqlFile(_0x4c28ae,_0x3f5546,_0x74a5c5)?(_0x35d6ba='skipped',_0x489a52='unchanged'):(_0x35d6ba=_0x1c11c1(0x1a1),_0x489a52=_0x1c11c1(0x18d));}_0x114881[_0x1c11c1(0x1bc)]({'sqlCode':_0x1d25ab[_0x1c11c1(0x189)],'sqlName':_0x1d25ab[_0x1c11c1(0x1a6)],'filePath':_0x2c78e8,'status':_0x35d6ba,'reason':_0x489a52});}return{'method':_0x1c11c1(0x184),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x45b08a[_0x1c11c1(0x1a3)],'sqlCode':_0x45b08a[_0x1c11c1(0x1ab)](_0x1c11c1(0x18a))||null,'sqlName':_0x45b08a[_0x1c11c1(0x1ab)](_0x1c11c1(0x194))||null,'files':_0x114881},'description':_0x1c11c1(0x1a9)+_0x114881[_0x1c11c1(0x187)]+_0x1c11c1(0x19a)+_0x44a286[_0x1c11c1(0x1bb)]};},async 'execute'(_0x1dc846){const _0x3ffb8f=a176_0x3c2e27,_0x382162=loadSqlProjectConfig(_0x1dc846[_0x3ffb8f(0x1a3)]),_0x23ae56=await readSqlLockFile(_0x382162[_0x3ffb8f(0x183)]),{lockData:_0x522dc5,appLock:_0x170303}=ensureSqlLockScope(_0x23ae56??createEmptySqlLock(),_0x382162[_0x3ffb8f(0x1a3)],_0x382162[_0x3ffb8f(0x1b9)],_0x3ffb8f(0x19e)),_0xdef228=_0x1dc846[_0x3ffb8f(0x1af)]('force'),_0x906e22=await fetchAllSqlQueries(_0x1dc846[_0x3ffb8f(0x1a3)],{'sqlCode':_0x1dc846[_0x3ffb8f(0x1ab)]('sqlcode')||undefined,'sqlName':_0x1dc846[_0x3ffb8f(0x1ab)](_0x3ffb8f(0x194))||undefined});if(_0x906e22[_0x3ffb8f(0x187)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3ffb8f(0x19d)};const _0x5ae3ae=[],_0x2eefd4=[];for(const _0x398937 of _0x906e22){try{_0x5ae3ae['push'](await ensureSqlContent(_0x398937));}catch(_0x4f8886){_0x2eefd4['push']({'sqlCode':_0x398937[_0x3ffb8f(0x189)],'error':_0x4f8886 instanceof Error?_0x4f8886['message']:String(_0x4f8886)});}}if(_0xdef228&&!_0x1dc846[_0x3ffb8f(0x1b4)]){let _0x1e270d=![];for(const _0xd97b54 of _0x5ae3ae){const _0x39c9fe=detectModeFromSql(_0xd97b54),_0x131611=_0xd97b54[_0x3ffb8f(0x198)]?await getDbName(_0x1dc846[_0x3ffb8f(0x1a3)],Number(_0xd97b54[_0x3ffb8f(0x198)]))['catch'](()=>undefined):undefined,_0x27f136=buildLocalSqlFileContent({'sqlCode':_0xd97b54[_0x3ffb8f(0x189)],'sqlName':_0xd97b54[_0x3ffb8f(0x1a6)],'dbId':_0xd97b54['dbId']},ensureRemoteSqlContent(_0xd97b54),{'dbName':_0x131611,'mode':_0x39c9fe,'syncedAt':new Date()[_0x3ffb8f(0x1ad)](),'description':_0xd97b54[_0x3ffb8f(0x193)]}),_0x2a9ab3=resolveLocalSqlFilePath(_0x382162,_0xd97b54[_0x3ffb8f(0x189)],buildSqlLockEntry(_0xd97b54,ensureRemoteSqlContent(_0xd97b54),'',{'dbName':_0x131611}));if(await fileExists(_0x2a9ab3)){const _0x30f988=await readFile(_0x2a9ab3,_0x3ffb8f(0x1a2));if(!isEquivalentPulledSqlFile(_0x30f988,_0x27f136,_0x39c9fe)){_0x1e270d=!![];break;}}}if(_0x1e270d){const _0x7b07cc=await confirmForceOverwrite(_0x3ffb8f(0x18c));if(!_0x7b07cc)throw CliErrors['cancelled'](_0x3ffb8f(0x1b2));}}const _0x5dd235=cloneSqlLockData(_0x522dc5),_0x1874ab=_0x5dd235['apps'][_0x382162[_0x3ffb8f(0x1a3)]],_0x596075=[],_0x5a0568=[];for(const _0x3ec058 of _0x5ae3ae){const _0x52d333=_0x1874ab['sqls'][_0x3ec058[_0x3ffb8f(0x189)]],_0x4f3292=ensureRemoteSqlContent(_0x3ec058),_0x50f1d5=detectModeFromSql(_0x3ec058),_0x169b81=_0x3ec058[_0x3ffb8f(0x198)]?await getDbName(_0x1dc846[_0x3ffb8f(0x1a3)],Number(_0x3ec058[_0x3ffb8f(0x198)]))[_0x3ffb8f(0x1ac)](()=>undefined):undefined,_0x589d99=buildLocalSqlFileContent({'sqlCode':_0x3ec058['sqlCode'],'sqlName':_0x3ec058['sqlName'],'dbId':_0x3ec058['dbId']},_0x4f3292,{'dbName':_0x169b81,'mode':_0x50f1d5,'syncedAt':new Date()[_0x3ffb8f(0x1ad)](),'description':_0x3ec058['description']}),_0xcc9ee9=buildSqlLockEntry(_0x3ec058,_0x4f3292,computeSqlContentHash(_0x589d99),{'dbName':_0x169b81}),_0x15efdf=_0xcc9ee9[_0x3ffb8f(0x18f)],_0x35b4ed=join(_0x382162[_0x3ffb8f(0x1bb)],_0x15efdf);try{if(await fileExists(_0x35b4ed)){const _0x279f33=await readFile(_0x35b4ed,_0x3ffb8f(0x1a2));if(isEquivalentPulledSqlFile(_0x279f33,_0x589d99,_0x50f1d5)){_0x5a0568[_0x3ffb8f(0x1bc)]({'sqlCode':_0x3ec058[_0x3ffb8f(0x189)],'reason':_0x3ffb8f(0x1a7)}),_0x1874ab[_0x3ffb8f(0x1a4)][_0x3ec058['sqlCode']]={..._0xcc9ee9,'hash':computeSqlContentHash(_0x279f33),'path':_0x15efdf};continue;}if(!_0xdef228){_0x5a0568[_0x3ffb8f(0x1bc)]({'sqlCode':_0x3ec058[_0x3ffb8f(0x189)],'reason':_0x3ffb8f(0x1a5)});continue;}}const _0x21aa0e=_0x52d333?.[_0x3ffb8f(0x18f)]?join(_0x382162['sqlRootDir'],_0x52d333[_0x3ffb8f(0x18f)]):undefined;_0x21aa0e&&_0x21aa0e!==_0x35b4ed&&await fileExists(_0x21aa0e)&&await rm(_0x21aa0e,{'force':!![]}),await ensureParentDirectory(_0x35b4ed),await writeFile(_0x35b4ed,_0x589d99,_0x3ffb8f(0x1a2)),_0x1874ab['sqls'][_0x3ec058['sqlCode']]={..._0xcc9ee9,'path':_0x15efdf},_0x596075[_0x3ffb8f(0x1bc)]({'sqlCode':_0x3ec058[_0x3ffb8f(0x189)],'filePath':_0x35b4ed});}catch(_0x21855a){_0x2eefd4['push']({'sqlCode':_0x3ec058[_0x3ffb8f(0x189)],'error':_0x21855a instanceof Error?_0x21855a[_0x3ffb8f(0x195)]:String(_0x21855a)});}}return _0x1874ab['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x382162[_0x3ffb8f(0x183)],_0x5dd235),{'ok':_0x2eefd4[_0x3ffb8f(0x187)]===0x0,'data':{'pulled':_0x596075,'skipped':_0x5a0568,'failed':_0x2eefd4},'message':_0x3ffb8f(0x1b8)+_0x596075['length']+_0x3ffb8f(0x1b0)+_0x5a0568[_0x3ffb8f(0x187)]+_0x3ffb8f(0x182)+_0x2eefd4[_0x3ffb8f(0x187)]+'\x20failed'};}};function detectModeFromSql(_0xaee7fd){const _0xf0038e=a176_0x3c2e27,_0x5636c5=ensureRemoteSqlContent(_0xaee7fd),_0xd11f52=stripLocalSqlMetadata(_0x5636c5,_0xf0038e(0x192))[_0xf0038e(0x199)]();if(/^<(select|insert|update|delete)\b/i[_0xf0038e(0x197)](_0xd11f52))return _0xf0038e(0x192);return _0xf0038e(0x1b1);}function isEquivalentPulledSqlFile(_0x200024,_0x19f7e8,_0x7e08c7){return normalizePullComparableContent(_0x200024,_0x7e08c7)===normalizePullComparableContent(_0x19f7e8,_0x7e08c7);}function normalizePullComparableContent(_0x4ed8f7,_0x1136d1){const _0xe715b3=a176_0x3c2e27,_0x3fa5da=_0x4ed8f7['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x3a3a1b=_0x3fa5da[_0xe715b3(0x1b5)](_0x166797=>!isSyncedAtMetadataLine(_0x166797,_0x1136d1));return _0x3a3a1b[_0xe715b3(0x1ba)]('\x0a');}function isSyncedAtMetadataLine(_0x3f5600,_0xbce9f6){const _0x29fc97=a176_0x3c2e27;if(_0xbce9f6===_0x29fc97(0x192))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x3f5600);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x29fc97(0x197)](_0x3f5600);}
|
|
1
|
+
const a183_0x336927=a183_0x2e58;(function(_0x568b2d,_0x210547){const _0x1af825=a183_0x2e58,_0x36d633=_0x568b2d();while(!![]){try{const _0x281e2f=parseInt(_0x1af825(0x121))/0x1*(-parseInt(_0x1af825(0xfe))/0x2)+-parseInt(_0x1af825(0x10c))/0x3*(parseInt(_0x1af825(0x10d))/0x4)+-parseInt(_0x1af825(0x102))/0x5*(parseInt(_0x1af825(0xfd))/0x6)+parseInt(_0x1af825(0xee))/0x7+-parseInt(_0x1af825(0x10a))/0x8*(parseInt(_0x1af825(0xf9))/0x9)+-parseInt(_0x1af825(0xf1))/0xa*(parseInt(_0x1af825(0xfa))/0xb)+parseInt(_0x1af825(0x10e))/0xc*(parseInt(_0x1af825(0x10b))/0xd);if(_0x281e2f===_0x210547)break;else _0x36d633['push'](_0x36d633['shift']());}catch(_0x51b8f9){_0x36d633['push'](_0x36d633['shift']());}}}(a183_0x1540,0x7b041));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';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(_0x1781ea,_0x528655){const _0x229f80=a183_0x2e58,_0x38a735=[];let _0x50ae7b=0x1;while(!![]){const _0x5ba5e2=await listSqlQueries(_0x1781ea,{'currentPage':_0x50ae7b,'pageSize':PAGE_SIZE,'sqlCode':_0x528655[_0x229f80(0x119)],'sqlName':_0x528655['sqlName']}),_0x2670c1=_0x5ba5e2['tableData']??[];_0x38a735['push'](..._0x2670c1);if(_0x2670c1[_0x229f80(0xfc)]===0x0)break;const _0x453a8f=_0x5ba5e2[_0x229f80(0x118)]?.[_0x229f80(0x124)];if(_0x453a8f!=null?_0x38a735[_0x229f80(0xfc)]>=_0x453a8f:_0x2670c1[_0x229f80(0xfc)]<PAGE_SIZE)break;_0x50ae7b++;}return _0x38a735;}async function ensureSqlContent(_0x172cec){const _0x42a692=a183_0x2e58;if(_0x172cec['sqlContent']!=null&&String(_0x172cec[_0x42a692(0xed)])[_0x42a692(0xfc)]>0x0)return _0x172cec;return getSqlQueryDetail(_0x172cec['sqlCode']);}export const sqlPull={'service':a183_0x336927(0x11c),'command':a183_0x336927(0x103),'description':a183_0x336927(0x126),'risk':a183_0x336927(0x123),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a183_0x336927(0x100),'description':a183_0x336927(0x113)},{'name':'force','type':a183_0x336927(0xec),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x319493){const _0x1af55f=a183_0x336927,_0x40d2de=loadSqlProjectConfig(_0x319493[_0x1af55f(0xf6)]),_0x2162d0=await readSqlLockFile(_0x40d2de[_0x1af55f(0xf7)]),{appLock:_0x3f4d3e}=ensureSqlLockScope(_0x2162d0??createEmptySqlLock(),_0x40d2de[_0x1af55f(0xf6)],_0x40d2de[_0x1af55f(0xf2)],_0x1af55f(0x103)),_0x596a0b=await fetchAllSqlQueries(_0x319493['appCode'],{'sqlCode':_0x319493[_0x1af55f(0x116)](_0x1af55f(0x11b))||undefined,'sqlName':_0x319493[_0x1af55f(0x116)](_0x1af55f(0x101))||undefined}),_0x12e5b5=[];for(const _0x3b9294 of _0x596a0b){const _0x2ea9e4=await ensureSqlContent(_0x3b9294),_0x300feb=ensureRemoteSqlContent(_0x2ea9e4),_0x3d2913=detectModeFromSql(_0x2ea9e4),_0x29ba51=_0x2ea9e4[_0x1af55f(0x106)]?await getDbName(_0x319493[_0x1af55f(0xf6)],Number(_0x2ea9e4[_0x1af55f(0x106)]))[_0x1af55f(0x114)](()=>undefined):undefined,_0x1e8f6c=buildLocalSqlFileContent({'sqlCode':_0x2ea9e4[_0x1af55f(0x119)],'sqlName':_0x2ea9e4[_0x1af55f(0xff)],'dbId':_0x2ea9e4[_0x1af55f(0x106)]},_0x300feb,{'dbName':_0x29ba51,'mode':_0x3d2913,'syncedAt':new Date()[_0x1af55f(0x11f)](),'description':_0x2ea9e4[_0x1af55f(0x11d)]}),_0x41fa97=buildSqlLockEntry(_0x2ea9e4,_0x300feb,'',{'dbName':_0x29ba51}),_0x3af40b=resolveLocalSqlFilePath(_0x40d2de,_0x2ea9e4[_0x1af55f(0x119)],_0x41fa97);let _0xf899be='would_pull',_0xd9230f;if(await fileExists(_0x3af40b)){const _0x6cedb4=await readFile(_0x3af40b,_0x1af55f(0xf3));isEquivalentPulledSqlFile(_0x6cedb4,_0x1e8f6c,_0x3d2913)?(_0xf899be='skipped',_0xd9230f=_0x1af55f(0x10f)):(_0xf899be='conflict',_0xd9230f='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x12e5b5[_0x1af55f(0xf8)]({'sqlCode':_0x2ea9e4[_0x1af55f(0x119)],'sqlName':_0x2ea9e4['sqlName'],'filePath':_0x3af40b,'status':_0xf899be,'reason':_0xd9230f});}return{'method':_0x1af55f(0x117),'url':_0x1af55f(0x122),'body':{'appCode':_0x319493[_0x1af55f(0xf6)],'sqlCode':_0x319493['str'](_0x1af55f(0x11b))||null,'sqlName':_0x319493[_0x1af55f(0x116)](_0x1af55f(0x101))||null,'files':_0x12e5b5},'description':'Would\x20pull\x20'+_0x12e5b5[_0x1af55f(0xfc)]+_0x1af55f(0x128)+_0x40d2de['sqlRootDir']};},async 'execute'(_0x1992d6){const _0x52a091=a183_0x336927,_0x4be2e3=loadSqlProjectConfig(_0x1992d6[_0x52a091(0xf6)]),_0xb4f2aa=await readSqlLockFile(_0x4be2e3[_0x52a091(0xf7)]),{lockData:_0x37884a,appLock:_0x395d4f}=ensureSqlLockScope(_0xb4f2aa??createEmptySqlLock(),_0x4be2e3[_0x52a091(0xf6)],_0x4be2e3['sqlRoot'],_0x52a091(0x103)),_0x32bf4f=_0x1992d6[_0x52a091(0x127)](_0x52a091(0x112)),_0x409cd0=await fetchAllSqlQueries(_0x1992d6[_0x52a091(0xf6)],{'sqlCode':_0x1992d6['str'](_0x52a091(0x11b))||undefined,'sqlName':_0x1992d6[_0x52a091(0x116)](_0x52a091(0x101))||undefined});if(_0x409cd0[_0x52a091(0xfc)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0xf76ebb=[],_0x4afeb2=[];for(const _0x569751 of _0x409cd0){try{_0xf76ebb['push'](await ensureSqlContent(_0x569751));}catch(_0x2cec8c){_0x4afeb2[_0x52a091(0xf8)]({'sqlCode':_0x569751[_0x52a091(0x119)],'error':_0x2cec8c instanceof Error?_0x2cec8c[_0x52a091(0xf0)]:String(_0x2cec8c)});}}if(_0x32bf4f&&!_0x1992d6[_0x52a091(0x108)]){let _0x2fc256=![];for(const _0x2a04dc of _0xf76ebb){const _0x6c833a=detectModeFromSql(_0x2a04dc),_0x384fb6=_0x2a04dc[_0x52a091(0x106)]?await getDbName(_0x1992d6[_0x52a091(0xf6)],Number(_0x2a04dc[_0x52a091(0x106)]))[_0x52a091(0x114)](()=>undefined):undefined,_0x2ac128=buildLocalSqlFileContent({'sqlCode':_0x2a04dc['sqlCode'],'sqlName':_0x2a04dc[_0x52a091(0xff)],'dbId':_0x2a04dc['dbId']},ensureRemoteSqlContent(_0x2a04dc),{'dbName':_0x384fb6,'mode':_0x6c833a,'syncedAt':new Date()[_0x52a091(0x11f)](),'description':_0x2a04dc[_0x52a091(0x11d)]}),_0x319f2e=resolveLocalSqlFilePath(_0x4be2e3,_0x2a04dc[_0x52a091(0x119)],buildSqlLockEntry(_0x2a04dc,ensureRemoteSqlContent(_0x2a04dc),'',{'dbName':_0x384fb6}));if(await fileExists(_0x319f2e)){const _0x112b00=await readFile(_0x319f2e,_0x52a091(0xf3));if(!isEquivalentPulledSqlFile(_0x112b00,_0x2ac128,_0x6c833a)){_0x2fc256=!![];break;}}}if(_0x2fc256){const _0x42a761=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x42a761)throw CliErrors[_0x52a091(0xef)](_0x52a091(0x110));}}const _0x2f87f3=cloneSqlLockData(_0x37884a),_0x35aa1f=_0x2f87f3[_0x52a091(0x105)][_0x4be2e3[_0x52a091(0xf6)]],_0x372bca=[],_0x54f85e=[];for(const _0x146435 of _0xf76ebb){const _0x31e7e8=_0x35aa1f[_0x52a091(0x109)][_0x146435[_0x52a091(0x119)]],_0x1119cd=ensureRemoteSqlContent(_0x146435),_0x182f3c=detectModeFromSql(_0x146435),_0x1f7e7a=_0x146435[_0x52a091(0x106)]?await getDbName(_0x1992d6[_0x52a091(0xf6)],Number(_0x146435[_0x52a091(0x106)]))[_0x52a091(0x114)](()=>undefined):undefined,_0x21ed88=buildLocalSqlFileContent({'sqlCode':_0x146435[_0x52a091(0x119)],'sqlName':_0x146435[_0x52a091(0xff)],'dbId':_0x146435[_0x52a091(0x106)]},_0x1119cd,{'dbName':_0x1f7e7a,'mode':_0x182f3c,'syncedAt':new Date()['toISOString'](),'description':_0x146435[_0x52a091(0x11d)]}),_0xf91bd=buildSqlLockEntry(_0x146435,_0x1119cd,computeSqlContentHash(_0x21ed88),{'dbName':_0x1f7e7a}),_0x463459=_0xf91bd[_0x52a091(0x104)],_0x361f58=join(_0x4be2e3[_0x52a091(0x115)],_0x463459);try{if(await fileExists(_0x361f58)){const _0x5558c4=await readFile(_0x361f58,_0x52a091(0xf3));if(isEquivalentPulledSqlFile(_0x5558c4,_0x21ed88,_0x182f3c)){_0x54f85e[_0x52a091(0xf8)]({'sqlCode':_0x146435['sqlCode'],'reason':_0x52a091(0x10f)}),_0x35aa1f[_0x52a091(0x109)][_0x146435[_0x52a091(0x119)]]={..._0xf91bd,'hash':computeSqlContentHash(_0x5558c4),'path':_0x463459};continue;}if(!_0x32bf4f){_0x54f85e[_0x52a091(0xf8)]({'sqlCode':_0x146435[_0x52a091(0x119)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0xbdd1e2=_0x31e7e8?.[_0x52a091(0x104)]?join(_0x4be2e3['sqlRootDir'],_0x31e7e8[_0x52a091(0x104)]):undefined;_0xbdd1e2&&_0xbdd1e2!==_0x361f58&&await fileExists(_0xbdd1e2)&&await rm(_0xbdd1e2,{'force':!![]}),await ensureParentDirectory(_0x361f58),await writeFile(_0x361f58,_0x21ed88,'utf8'),_0x35aa1f[_0x52a091(0x109)][_0x146435[_0x52a091(0x119)]]={..._0xf91bd,'path':_0x463459},_0x372bca['push']({'sqlCode':_0x146435[_0x52a091(0x119)],'filePath':_0x361f58});}catch(_0x2a917a){_0x4afeb2[_0x52a091(0xf8)]({'sqlCode':_0x146435['sqlCode'],'error':_0x2a917a instanceof Error?_0x2a917a[_0x52a091(0xf0)]:String(_0x2a917a)});}}return _0x35aa1f[_0x52a091(0x111)]=new Date()[_0x52a091(0x11f)](),await writeSqlLockFile(_0x4be2e3[_0x52a091(0xf7)],_0x2f87f3),{'ok':_0x4afeb2[_0x52a091(0xfc)]===0x0,'data':{'pulled':_0x372bca,'skipped':_0x54f85e,'failed':_0x4afeb2},'message':_0x52a091(0x11a)+_0x372bca[_0x52a091(0xfc)]+_0x52a091(0x125)+_0x54f85e[_0x52a091(0xfc)]+'\x20skipped,\x20'+_0x4afeb2[_0x52a091(0xfc)]+'\x20failed'};}};function detectModeFromSql(_0x5ca4d7){const _0x2159d0=a183_0x336927,_0x1f6428=ensureRemoteSqlContent(_0x5ca4d7),_0x10ad8b=stripLocalSqlMetadata(_0x1f6428,'mybatisXml')[_0x2159d0(0xf4)]();if(/^<(select|insert|update|delete)\b/i[_0x2159d0(0x120)](_0x10ad8b))return _0x2159d0(0x107);return'sql';}function isEquivalentPulledSqlFile(_0x36d7c7,_0x2b388a,_0x3e8f82){return normalizePullComparableContent(_0x36d7c7,_0x3e8f82)===normalizePullComparableContent(_0x2b388a,_0x3e8f82);}function a183_0x1540(){const _0x2ffd1a=['lastSync','force','Filter\x20by\x20SQL\x20display\x20name','catch','sqlRootDir','str','POST','paging','sqlCode','Pull\x20complete:\x20','sqlcode','sql','description','split','toISOString','test','27325DzAEmj','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','write','totalCount','\x20written,\x20','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','bool','\x20SQL\x20file(s)\x20into\x20','boolean','sqlContent','2207254MuMCxw','cancelled','message','170tnHUCW','sqlRoot','utf8','trimStart','replace','appCode','lockFilePath','push','9ZawdMn','18271RFqHAE','join','length','1716WdGSff','14bBdVul','sqlName','string','name','4705ctGHzH','pull','path','apps','dbId','mybatisXml','nonInteractive','sqls','3012056CMaaPN','156ncUuVW','627fqqybv','3504BspVBf','1236780iTcNQi','unchanged','Force\x20pull\x20cancelled.'];a183_0x1540=function(){return _0x2ffd1a;};return a183_0x1540();}function normalizePullComparableContent(_0x34ed21,_0x11f3d6){const _0x585643=a183_0x336927,_0x35efac=_0x34ed21[_0x585643(0xf5)](/\r\n/g,'\x0a')[_0x585643(0x11e)]('\x0a'),_0x401066=_0x35efac['filter'](_0x4555d6=>!isSyncedAtMetadataLine(_0x4555d6,_0x11f3d6));return _0x401066[_0x585643(0xfb)]('\x0a');}function a183_0x2e58(_0x419b79,_0x11da6b){_0x419b79=_0x419b79-0xec;const _0x15401c=a183_0x1540();let _0x2e5839=_0x15401c[_0x419b79];return _0x2e5839;}function isSyncedAtMetadataLine(_0x221698,_0xaeab59){const _0x500756=a183_0x336927;if(_0xaeab59===_0x500756(0x107))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x500756(0x120)](_0x221698);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x221698);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a177_0x44466a=a177_0x5eef;(function(_0x1e2690,_0x4455d1){const _0x53d366=a177_0x5eef,_0x149689=_0x1e2690();while(!![]){try{const _0x28ae3b=parseInt(_0x53d366(0x17d))/0x1+parseInt(_0x53d366(0x1a7))/0x2+-parseInt(_0x53d366(0x199))/0x3*(-parseInt(_0x53d366(0x189))/0x4)+-parseInt(_0x53d366(0x19d))/0x5*(parseInt(_0x53d366(0x18d))/0x6)+-parseInt(_0x53d366(0x1ae))/0x7+-parseInt(_0x53d366(0x187))/0x8+-parseInt(_0x53d366(0x1b3))/0x9;if(_0x28ae3b===_0x4455d1)break;else _0x149689['push'](_0x149689['shift']());}catch(_0x33d7d6){_0x149689['push'](_0x149689['shift']());}}}(a177_0x3083,0x30f71));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a177_0x5eef(_0x473bf6,_0x3f56af){_0x473bf6=_0x473bf6-0x179;const _0x308331=a177_0x3083();let _0x5eef2e=_0x308331[_0x473bf6];return _0x5eef2e;}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';function a177_0x3083(){const _0x60b8fc=['relativePath','version','330696ydHILk','boolean','\x22\x20for\x20sqlCode\x20','sqlcode','dbDirectory','toISOString','Push\x20local\x20SQL\x20files\x20to\x20remote','1175804nVfJTK','sqlRoot','dbName','projectRoot','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','2108556gqbvoq','sqlCode','\x20SQL\x20file(s)','sqlConfig','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','No\x20local\x20SQL\x20files\x20found.','331407tGhzdN','Local\x20SQL\x20not\x20found:\x20','catch','path','sqlName','replace','dbId','message','\x20failed','sql','2115472GColHs','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','297892lIrBHA','join','appCode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','534aOEkeu','length','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','hash','No\x20database\x20matches\x20local\x20directory\x20\x22','mode','utf8','push','map','has','filter','\x20pushed,\x20','15QFgDcG','force','unchanged','sqls','105QRFXLz','exec','filePath','validation','set','startsWith','sqlRootDir','remoteId'];a177_0x3083=function(){return _0x60b8fc;};return a177_0x3083();}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(_0x2b10e6,_0xfa4e5f,_0x364297){const _0x34dd54=a177_0x5eef,_0x599509=await scanLocalSqlQueries(_0x2b10e6),_0x420aa1=new Map();for(const _0x411a53 of _0x599509){if(_0x364297&&_0x411a53[_0x34dd54(0x1b4)]!==_0x364297)continue;const _0x40c1b5=_0x420aa1['get'](_0x411a53[_0x34dd54(0x1b4)])??[];_0x40c1b5[_0x34dd54(0x194)](_0x411a53),_0x420aa1[_0x34dd54(0x1a1)](_0x411a53['sqlCode'],_0x40c1b5);}if(_0x364297&&!_0x420aa1[_0x34dd54(0x196)](_0x364297))throw CliErrors['validation'](_0x34dd54(0x17e)+_0x364297);const _0x349f4f=[];for(const [_0x36915c,_0x335a7a]of _0x420aa1['entries']()){if(_0x335a7a[_0x34dd54(0x18e)]===0x1){_0x349f4f['push'](_0x335a7a[0x0]);continue;}const _0x1e6b10=_0xfa4e5f[_0x34dd54(0x19c)][_0x36915c],_0x1b610e=_0x1e6b10?.[_0x34dd54(0x180)],_0x5b6fea=_0x1b610e?_0x335a7a['filter'](_0x4c28ca=>_0x4c28ca[_0x34dd54(0x1a5)]!==_0x1b610e):_0x335a7a;if(_0x1e6b10&&_0x5b6fea[_0x34dd54(0x18e)]===0x1){_0x349f4f[_0x34dd54(0x194)](_0x5b6fea[0x0]);continue;}throw CliErrors[_0x34dd54(0x1a0)](_0x34dd54(0x188)+_0x36915c+_0x34dd54(0x18c));}return _0x349f4f;}export const sqlPush={'service':a177_0x44466a(0x186),'command':a177_0x44466a(0x194),'description':a177_0x44466a(0x1ad),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a177_0x44466a(0x19a),'type':a177_0x44466a(0x1a8),'description':a177_0x44466a(0x18f)}],async 'dryRun'(_0x5d733e){const _0x58cbe1=a177_0x44466a,_0x37890c=loadSqlProjectConfig(_0x5d733e['appCode']),_0x412b54=await readSqlLockFile(_0x37890c['lockFilePath']),{appLock:_0x55467d}=ensureSqlLockScope(_0x412b54??createEmptySqlLock(),_0x5d733e[_0x58cbe1(0x18b)],_0x37890c[_0x58cbe1(0x1af)],'push'),_0x38ea24=await getTargetSqlQueries(_0x37890c,_0x55467d,_0x5d733e['str'](_0x58cbe1(0x1aa))||undefined),_0x36b66e=[];for(const _0x9d270f of _0x38ea24){const _0xa00ffb=await computeSqlFileHash(_0x9d270f[_0x58cbe1(0x19f)]),_0x17f971=_0x55467d[_0x58cbe1(0x19c)][_0x9d270f['sqlCode']],_0x15bd15=!!_0x17f971&&(_0x17f971['path']!==_0x9d270f[_0x58cbe1(0x1a5)]||!!_0x9d270f[_0x58cbe1(0x181)]&&_0x17f971[_0x58cbe1(0x181)]!==_0x9d270f[_0x58cbe1(0x181)]);if(!_0x5d733e['bool'](_0x58cbe1(0x19a))&&_0x17f971&&_0x17f971[_0x58cbe1(0x190)]===_0xa00ffb&&!_0x15bd15)continue;_0x36b66e[_0x58cbe1(0x194)](_0x9d270f['sqlCode']);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x36b66e,'appCode':_0x5d733e[_0x58cbe1(0x18b)]},'description':'Would\x20push\x20'+_0x36b66e['length']+_0x58cbe1(0x179)};},async 'execute'(_0x1fa592){const _0x402ae7=a177_0x44466a,_0xbeb829=loadSqlProjectConfig(_0x1fa592[_0x402ae7(0x18b)]),_0xffe08f=await readSqlLockFile(_0xbeb829['lockFilePath']),{lockData:_0x4712db,appLock:_0x5d25b2}=ensureSqlLockScope(_0xffe08f??createEmptySqlLock(),_0x1fa592['appCode'],_0xbeb829[_0x402ae7(0x1af)],_0x402ae7(0x194)),_0x411a40=await getTargetSqlQueries(_0xbeb829,_0x5d25b2,_0x1fa592['str'](_0x402ae7(0x1aa))||undefined);if(_0x411a40[_0x402ae7(0x18e)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x402ae7(0x17c)};const _0x271868=[],_0x5177a6=[],_0x120ff9=[];for(const _0x1cde17 of _0x411a40){const _0x5c8cb6=_0x5d25b2[_0x402ae7(0x19c)][_0x1cde17['sqlCode']];if(!_0x5c8cb6){_0x120ff9['push']({'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'error':_0x402ae7(0x1b2)});continue;}try{const _0x4212c7=await computeSqlFileHash(_0x1cde17[_0x402ae7(0x19f)]),_0x83cb35=_0x5c8cb6[_0x402ae7(0x180)]!==_0x1cde17[_0x402ae7(0x1a5)]||!!_0x1cde17['sqlName']&&_0x5c8cb6[_0x402ae7(0x181)]!==_0x1cde17[_0x402ae7(0x181)];if(!_0x1fa592['bool'](_0x402ae7(0x19a))&&_0x5c8cb6[_0x402ae7(0x190)]===_0x4212c7&&!_0x83cb35){_0x5177a6[_0x402ae7(0x194)]({'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'reason':_0x402ae7(0x19b)});continue;}if(_0x5c8cb6[_0x402ae7(0x1a6)]==null){_0x120ff9[_0x402ae7(0x194)]({'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'error':_0x402ae7(0x17b)});continue;}const _0x206d86=await readFile(_0x1cde17[_0x402ae7(0x19f)],_0x402ae7(0x193)),_0x14f958=stripLocalSqlMetadata(_0x206d86,_0x1cde17[_0x402ae7(0x192)]),_0x409e1c=_0x1cde17[_0x402ae7(0x181)]||_0x5c8cb6[_0x402ae7(0x181)],_0x49fe3f=await resolveTargetDbBinding(_0x1fa592[_0x402ae7(0x18b)],_0x1cde17,_0x5c8cb6),_0x2e1ff9=await updateSqlQuery({'id':_0x5c8cb6[_0x402ae7(0x1a4)],'appCode':_0x1fa592[_0x402ae7(0x18b)],'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'sqlName':_0x409e1c,'dbId':_0x49fe3f[_0x402ae7(0x183)],'version':_0x5c8cb6[_0x402ae7(0x1a6)],'sqlContent':_0x14f958,'sqlConfig':_0x5c8cb6[_0x402ae7(0x17a)]??undefined}),_0x367913=_0x2e1ff9[_0x402ae7(0x183)]?await getDbName(_0x1fa592[_0x402ae7(0x18b)],Number(_0x2e1ff9[_0x402ae7(0x183)]))[_0x402ae7(0x17f)](()=>_0x49fe3f[_0x402ae7(0x1b0)]):_0x49fe3f[_0x402ae7(0x1b0)];_0x5d25b2[_0x402ae7(0x19c)][_0x1cde17['sqlCode']]={...buildSqlLockEntry(_0x2e1ff9,_0x14f958,_0x4212c7,{'dbName':_0x367913}),'path':_0x1cde17['relativePath'],'mode':_0x5c8cb6['mode']},await archivePreviousSqlFileIfNeeded(_0xbeb829,_0x5c8cb6['path'],_0x1cde17[_0x402ae7(0x1a5)]),_0x271868['push']({'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'remoteId':_0x5c8cb6['remoteId']});}catch(_0x457fec){_0x120ff9[_0x402ae7(0x194)]({'sqlCode':_0x1cde17['sqlCode'],'error':_0x457fec instanceof Error?_0x457fec[_0x402ae7(0x184)]:String(_0x457fec)});}}return _0x5d25b2['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xbeb829['lockFilePath'],_0x4712db),{'ok':_0x120ff9['length']===0x0,'data':{'pushed':_0x271868,'skipped':_0x5177a6,'failed':_0x120ff9},'message':'Push\x20complete:\x20'+_0x271868[_0x402ae7(0x18e)]+_0x402ae7(0x198)+_0x5177a6['length']+'\x20skipped,\x20'+_0x120ff9['length']+_0x402ae7(0x185)};}};async function archivePreviousSqlFileIfNeeded(_0x2ee7eb,_0xa577bd,_0x3cde76){const _0x2fc753=a177_0x44466a;if(!_0xa577bd||_0xa577bd===_0x3cde76)return;const _0x17843e=join(_0x2ee7eb['sqlRootDir'],_0xa577bd);if(!await fileExists(_0x17843e))return;const _0x4dd00f=await moveToTrash(_0x2ee7eb[_0x2fc753(0x1b1)],_0x2ee7eb['trashDir'],_0x17843e);await cleanupEmptyDirectories(dirname(_0x17843e),_0x2ee7eb[_0x2fc753(0x1a3)]),void _0x4dd00f;}async function moveToTrash(_0x568977,_0x291f3a,_0x49a051){const _0x48911b=a177_0x44466a,_0xcc28c7=new Date()[_0x48911b(0x1ac)]()[_0x48911b(0x182)](/[:.]/g,'-'),_0x1c5b8b=relative(_0x568977,_0x49a051),_0x3cc007=join(_0x291f3a,_0xcc28c7,_0x1c5b8b);return await mkdir(dirname(_0x3cc007),{'recursive':!![]}),await rename(_0x49a051,_0x3cc007),_0x3cc007;}async function cleanupEmptyDirectories(_0x5ef314,_0x168da1){const _0xc91aaf=a177_0x44466a;let _0x1697c8=resolve(_0x5ef314);const _0x1e285c=resolve(_0x168da1);while(_0x1697c8[_0xc91aaf(0x1a2)](''+_0x1e285c+sep)||_0x1697c8===_0x1e285c){if(_0x1697c8===_0x1e285c)return;try{const _0x26648d=await readdir(_0x1697c8);if(_0x26648d[_0xc91aaf(0x18e)]>0x0)return;await rmdir(_0x1697c8);}catch{return;}_0x1697c8=dirname(_0x1697c8);}}async function resolveTargetDbBinding(_0xe5a241,_0x5ae420,_0x4d1fa0){const _0x486c5c=a177_0x44466a,_0x551d6f=_0x5ae420[_0x486c5c(0x1ab)];if(!_0x551d6f)return{'dbId':_0x4d1fa0[_0x486c5c(0x183)],'dbName':_0x4d1fa0[_0x486c5c(0x1b0)]};const _0x5967d5=buildDbDirectoryName(_0x4d1fa0[_0x486c5c(0x1b0)],_0x4d1fa0['dbId']);if(_0x551d6f===_0x5967d5)return{'dbId':_0x4d1fa0['dbId'],'dbName':_0x4d1fa0[_0x486c5c(0x1b0)]};const _0x1f0046=parseExplicitDbDirectory(_0x551d6f);if(_0x1f0046!=null)return{'dbId':_0x1f0046,'dbName':await getDbName(_0xe5a241,_0x1f0046)['catch'](()=>undefined)};const _0x4de14a=await listDatabases(_0xe5a241),_0x2b37db=_0x4de14a[_0x486c5c(0x197)](_0x4db486=>buildDbDirectoryName(_0x4db486['dbName'],_0x4db486[_0x486c5c(0x183)])===_0x551d6f);if(_0x2b37db[_0x486c5c(0x18e)]===0x1)return{'dbId':_0x2b37db[0x0][_0x486c5c(0x183)],'dbName':_0x2b37db[0x0][_0x486c5c(0x1b0)]};if(_0x2b37db['length']===0x0)throw CliErrors[_0x486c5c(0x1a0)](_0x486c5c(0x191)+_0x551d6f+_0x486c5c(0x1a9)+_0x5ae420['sqlCode']+'.');const _0x59297c=_0x2b37db[_0x486c5c(0x195)](_0x2f7802=>_0x2f7802[_0x486c5c(0x1b0)]+'\x20('+_0x2f7802['dbId']+')')[_0x486c5c(0x18a)](',\x20');throw CliErrors[_0x486c5c(0x1a0)]('Local\x20directory\x20\x22'+_0x551d6f+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x5ae420['sqlCode']+':\x20'+_0x59297c);}function parseExplicitDbDirectory(_0x5d8b3c){const _0x5d52a2=a177_0x44466a,_0x3c49a9=/^db-(\d+)$/[_0x5d52a2(0x19e)](_0x5d8b3c);if(!_0x3c49a9)return null;const _0x159452=Number(_0x3c49a9[0x1]);return Number['isFinite'](_0x159452)&&_0x159452>0x0?_0x159452:null;}
|
|
1
|
+
const a184_0x502892=a184_0xe019;(function(_0x42a8dd,_0x44f4bf){const _0x456345=a184_0xe019,_0x19f44f=_0x42a8dd();while(!![]){try{const _0x337af1=-parseInt(_0x456345(0x13f))/0x1*(parseInt(_0x456345(0x15b))/0x2)+-parseInt(_0x456345(0x169))/0x3+parseInt(_0x456345(0x141))/0x4*(parseInt(_0x456345(0x136))/0x5)+parseInt(_0x456345(0x165))/0x6*(parseInt(_0x456345(0x14e))/0x7)+parseInt(_0x456345(0x150))/0x8+parseInt(_0x456345(0x16b))/0x9+parseInt(_0x456345(0x13d))/0xa*(parseInt(_0x456345(0x163))/0xb);if(_0x337af1===_0x44f4bf)break;else _0x19f44f['push'](_0x19f44f['shift']());}catch(_0x21fbac){_0x19f44f['push'](_0x19f44f['shift']());}}}(a184_0x377d,0xb475b));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';function a184_0x377d(){const _0x438a0a=['set','90PQGnuB','utf8','1tUNomb','version','19640ZrSyaF','sqlName','relativePath','unchanged','path','validation','trashDir','length','dbName','Would\x20push\x20','sqlRootDir','dbId','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','27447GMWLqo','str','3315408lsBwrQ','sqls','entries','bool','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','Local\x20directory\x20\x22','replace','sqlRoot','sqlConfig','startsWith','lockFilePath','2878882zVLYzF','isFinite','high-risk-write','toISOString','filter','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','force','sqlcode','1092718UdJGtT','filePath','996sQaUFC','catch','No\x20database\x20matches\x20local\x20directory\x20\x22','sqlCode','4187397WOQoiZ','\x20skipped,\x20','3974031WNCazk','hash','dbDirectory','Push\x20local\x20SQL\x20files\x20to\x20remote','Push\x20complete:\x20','sql','\x20pushed,\x20','Local\x20SQL\x20not\x20found:\x20','push','1195EjNGcl','boolean','mode','has','appCode','map'];a184_0x377d=function(){return _0x438a0a;};return a184_0x377d();}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(_0x1d41a4,_0x5ca07a,_0x39eb8a){const _0x508aff=a184_0xe019,_0xe2e459=await scanLocalSqlQueries(_0x1d41a4),_0x37da4b=new Map();for(const _0x57d711 of _0xe2e459){if(_0x39eb8a&&_0x57d711[_0x508aff(0x168)]!==_0x39eb8a)continue;const _0x83369c=_0x37da4b['get'](_0x57d711['sqlCode'])??[];_0x83369c['push'](_0x57d711),_0x37da4b[_0x508aff(0x13c)](_0x57d711[_0x508aff(0x168)],_0x83369c);}if(_0x39eb8a&&!_0x37da4b[_0x508aff(0x139)](_0x39eb8a))throw CliErrors[_0x508aff(0x146)](_0x508aff(0x134)+_0x39eb8a);const _0x211f1b=[];for(const [_0x5d9383,_0x2fc5fc]of _0x37da4b[_0x508aff(0x152)]()){if(_0x2fc5fc['length']===0x1){_0x211f1b['push'](_0x2fc5fc[0x0]);continue;}const _0x563c52=_0x5ca07a[_0x508aff(0x151)][_0x5d9383],_0x290143=_0x563c52?.[_0x508aff(0x145)],_0x1f764f=_0x290143?_0x2fc5fc['filter'](_0x81db15=>_0x81db15['relativePath']!==_0x290143):_0x2fc5fc;if(_0x563c52&&_0x1f764f['length']===0x1){_0x211f1b['push'](_0x1f764f[0x0]);continue;}throw CliErrors[_0x508aff(0x146)](_0x508aff(0x14d)+_0x5d9383+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x211f1b;}export const sqlPush={'service':a184_0x502892(0x170),'command':a184_0x502892(0x135),'description':a184_0x502892(0x16e),'risk':a184_0x502892(0x15d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a184_0x502892(0x137),'description':a184_0x502892(0x160)}],async 'dryRun'(_0x208c13){const _0x32a182=a184_0x502892,_0x479469=loadSqlProjectConfig(_0x208c13['appCode']),_0x243adf=await readSqlLockFile(_0x479469[_0x32a182(0x15a)]),{appLock:_0x6dcda6}=ensureSqlLockScope(_0x243adf??createEmptySqlLock(),_0x208c13['appCode'],_0x479469[_0x32a182(0x157)],_0x32a182(0x135)),_0x581a63=await getTargetSqlQueries(_0x479469,_0x6dcda6,_0x208c13[_0x32a182(0x14f)](_0x32a182(0x162))||undefined),_0x217820=[];for(const _0x2641a6 of _0x581a63){const _0x1db95b=await computeSqlFileHash(_0x2641a6[_0x32a182(0x164)]),_0xe79b6=_0x6dcda6[_0x32a182(0x151)][_0x2641a6[_0x32a182(0x168)]],_0x1f18c7=!!_0xe79b6&&(_0xe79b6[_0x32a182(0x145)]!==_0x2641a6[_0x32a182(0x143)]||!!_0x2641a6[_0x32a182(0x142)]&&_0xe79b6['sqlName']!==_0x2641a6[_0x32a182(0x142)]);if(!_0x208c13['bool'](_0x32a182(0x161))&&_0xe79b6&&_0xe79b6[_0x32a182(0x16c)]===_0x1db95b&&!_0x1f18c7)continue;_0x217820['push'](_0x2641a6[_0x32a182(0x168)]);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x217820,'appCode':_0x208c13[_0x32a182(0x13a)]},'description':_0x32a182(0x14a)+_0x217820['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x322b6f){const _0x2ab60c=a184_0x502892,_0x241abc=loadSqlProjectConfig(_0x322b6f[_0x2ab60c(0x13a)]),_0x20e0e2=await readSqlLockFile(_0x241abc[_0x2ab60c(0x15a)]),{lockData:_0xa78c83,appLock:_0xffffd0}=ensureSqlLockScope(_0x20e0e2??createEmptySqlLock(),_0x322b6f['appCode'],_0x241abc[_0x2ab60c(0x157)],'push'),_0x4eaa11=await getTargetSqlQueries(_0x241abc,_0xffffd0,_0x322b6f['str'](_0x2ab60c(0x162))||undefined);if(_0x4eaa11['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x2130e1=[],_0x10eb0c=[],_0x2894ec=[];for(const _0x1815e1 of _0x4eaa11){const _0x292bbf=_0xffffd0[_0x2ab60c(0x151)][_0x1815e1['sqlCode']];if(!_0x292bbf){_0x2894ec[_0x2ab60c(0x135)]({'sqlCode':_0x1815e1[_0x2ab60c(0x168)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x5da0d5=await computeSqlFileHash(_0x1815e1['filePath']),_0x1cc1ca=_0x292bbf[_0x2ab60c(0x145)]!==_0x1815e1[_0x2ab60c(0x143)]||!!_0x1815e1[_0x2ab60c(0x142)]&&_0x292bbf[_0x2ab60c(0x142)]!==_0x1815e1[_0x2ab60c(0x142)];if(!_0x322b6f[_0x2ab60c(0x153)](_0x2ab60c(0x161))&&_0x292bbf[_0x2ab60c(0x16c)]===_0x5da0d5&&!_0x1cc1ca){_0x10eb0c[_0x2ab60c(0x135)]({'sqlCode':_0x1815e1[_0x2ab60c(0x168)],'reason':_0x2ab60c(0x144)});continue;}if(_0x292bbf[_0x2ab60c(0x140)]==null){_0x2894ec['push']({'sqlCode':_0x1815e1[_0x2ab60c(0x168)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x2beafb=await readFile(_0x1815e1[_0x2ab60c(0x164)],_0x2ab60c(0x13e)),_0x2dcbff=stripLocalSqlMetadata(_0x2beafb,_0x1815e1[_0x2ab60c(0x138)]),_0x4badcb=_0x1815e1[_0x2ab60c(0x142)]||_0x292bbf[_0x2ab60c(0x142)],_0x149a80=await resolveTargetDbBinding(_0x322b6f[_0x2ab60c(0x13a)],_0x1815e1,_0x292bbf),_0x3bc8bb=await updateSqlQuery({'id':_0x292bbf['remoteId'],'appCode':_0x322b6f[_0x2ab60c(0x13a)],'sqlCode':_0x1815e1[_0x2ab60c(0x168)],'sqlName':_0x4badcb,'dbId':_0x149a80[_0x2ab60c(0x14c)],'version':_0x292bbf[_0x2ab60c(0x140)],'sqlContent':_0x2dcbff,'sqlConfig':_0x292bbf[_0x2ab60c(0x158)]??undefined}),_0x3b1b2d=_0x3bc8bb[_0x2ab60c(0x14c)]?await getDbName(_0x322b6f[_0x2ab60c(0x13a)],Number(_0x3bc8bb[_0x2ab60c(0x14c)]))[_0x2ab60c(0x166)](()=>_0x149a80[_0x2ab60c(0x149)]):_0x149a80['dbName'];_0xffffd0[_0x2ab60c(0x151)][_0x1815e1[_0x2ab60c(0x168)]]={...buildSqlLockEntry(_0x3bc8bb,_0x2dcbff,_0x5da0d5,{'dbName':_0x3b1b2d}),'path':_0x1815e1['relativePath'],'mode':_0x292bbf[_0x2ab60c(0x138)]},await archivePreviousSqlFileIfNeeded(_0x241abc,_0x292bbf['path'],_0x1815e1[_0x2ab60c(0x143)]),_0x2130e1[_0x2ab60c(0x135)]({'sqlCode':_0x1815e1[_0x2ab60c(0x168)],'remoteId':_0x292bbf['remoteId']});}catch(_0x23edb9){_0x2894ec[_0x2ab60c(0x135)]({'sqlCode':_0x1815e1['sqlCode'],'error':_0x23edb9 instanceof Error?_0x23edb9['message']:String(_0x23edb9)});}}return _0xffffd0['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x241abc[_0x2ab60c(0x15a)],_0xa78c83),{'ok':_0x2894ec['length']===0x0,'data':{'pushed':_0x2130e1,'skipped':_0x10eb0c,'failed':_0x2894ec},'message':_0x2ab60c(0x16f)+_0x2130e1['length']+_0x2ab60c(0x171)+_0x10eb0c[_0x2ab60c(0x148)]+_0x2ab60c(0x16a)+_0x2894ec['length']+'\x20failed'};}};function a184_0xe019(_0x3cf575,_0x29c16e){_0x3cf575=_0x3cf575-0x134;const _0x377d01=a184_0x377d();let _0xe01981=_0x377d01[_0x3cf575];return _0xe01981;}async function archivePreviousSqlFileIfNeeded(_0x510636,_0x5024c6,_0x5b1752){const _0x344995=a184_0x502892;if(!_0x5024c6||_0x5024c6===_0x5b1752)return;const _0x45d083=join(_0x510636[_0x344995(0x14b)],_0x5024c6);if(!await fileExists(_0x45d083))return;const _0x54020b=await moveToTrash(_0x510636['projectRoot'],_0x510636[_0x344995(0x147)],_0x45d083);await cleanupEmptyDirectories(dirname(_0x45d083),_0x510636[_0x344995(0x14b)]),void _0x54020b;}async function moveToTrash(_0x1274fb,_0x116c8c,_0x1cf68b){const _0x3732d2=a184_0x502892,_0x955e8f=new Date()[_0x3732d2(0x15e)]()[_0x3732d2(0x156)](/[:.]/g,'-'),_0xf8b02=relative(_0x1274fb,_0x1cf68b),_0x5fd1b2=join(_0x116c8c,_0x955e8f,_0xf8b02);return await mkdir(dirname(_0x5fd1b2),{'recursive':!![]}),await rename(_0x1cf68b,_0x5fd1b2),_0x5fd1b2;}async function cleanupEmptyDirectories(_0x538d20,_0x4274e5){const _0x4d6201=a184_0x502892;let _0x30ea9d=resolve(_0x538d20);const _0x3976f5=resolve(_0x4274e5);while(_0x30ea9d[_0x4d6201(0x159)](''+_0x3976f5+sep)||_0x30ea9d===_0x3976f5){if(_0x30ea9d===_0x3976f5)return;try{const _0x1c0f07=await readdir(_0x30ea9d);if(_0x1c0f07[_0x4d6201(0x148)]>0x0)return;await rmdir(_0x30ea9d);}catch{return;}_0x30ea9d=dirname(_0x30ea9d);}}async function resolveTargetDbBinding(_0x4f3f1f,_0x4f75d0,_0x196372){const _0x20be9d=a184_0x502892,_0x1f539c=_0x4f75d0[_0x20be9d(0x16d)];if(!_0x1f539c)return{'dbId':_0x196372[_0x20be9d(0x14c)],'dbName':_0x196372['dbName']};const _0x1a7132=buildDbDirectoryName(_0x196372[_0x20be9d(0x149)],_0x196372['dbId']);if(_0x1f539c===_0x1a7132)return{'dbId':_0x196372[_0x20be9d(0x14c)],'dbName':_0x196372['dbName']};const _0x2b0c71=parseExplicitDbDirectory(_0x1f539c);if(_0x2b0c71!=null)return{'dbId':_0x2b0c71,'dbName':await getDbName(_0x4f3f1f,_0x2b0c71)['catch'](()=>undefined)};const _0x50d659=await listDatabases(_0x4f3f1f),_0x2988bd=_0x50d659[_0x20be9d(0x15f)](_0x2c7d32=>buildDbDirectoryName(_0x2c7d32[_0x20be9d(0x149)],_0x2c7d32[_0x20be9d(0x14c)])===_0x1f539c);if(_0x2988bd[_0x20be9d(0x148)]===0x1)return{'dbId':_0x2988bd[0x0][_0x20be9d(0x14c)],'dbName':_0x2988bd[0x0][_0x20be9d(0x149)]};if(_0x2988bd[_0x20be9d(0x148)]===0x0)throw CliErrors[_0x20be9d(0x146)](_0x20be9d(0x167)+_0x1f539c+'\x22\x20for\x20sqlCode\x20'+_0x4f75d0[_0x20be9d(0x168)]+'.');const _0x520279=_0x2988bd[_0x20be9d(0x13b)](_0x7cdebe=>_0x7cdebe[_0x20be9d(0x149)]+'\x20('+_0x7cdebe[_0x20be9d(0x14c)]+')')['join'](',\x20');throw CliErrors[_0x20be9d(0x146)](_0x20be9d(0x155)+_0x1f539c+_0x20be9d(0x154)+_0x4f75d0[_0x20be9d(0x168)]+':\x20'+_0x520279);}function parseExplicitDbDirectory(_0x5d78e2){const _0x3758d4=a184_0x502892,_0x2feb1e=/^db-(\d+)$/['exec'](_0x5d78e2);if(!_0x2feb1e)return null;const _0x3b44d0=Number(_0x2feb1e[0x1]);return Number[_0x3758d4(0x15c)](_0x3b44d0)&&_0x3b44d0>0x0?_0x3b44d0:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a185_0x41d5(_0x2c9099,_0x34067c){_0x2c9099=_0x2c9099-0x101;const _0x38ccea=a185_0x38cc();let _0x41d598=_0x38ccea[_0x2c9099];return _0x41d598;}function a185_0x38cc(){const _0x2b7829=['file','502131QWcRaz','36RIaBlh','608839MyeoTz','76628oFKKZv','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','sql','sqlname','Query\x20description','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','40xzmebv','3180176pQfDGk','40TOzXfc','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`.','write','5mlAEeW','75RBAruC','SQL\x20query\x20display\x20name','Path\x20to\x20the\x20SQL\x20file','1566324uyuQzS','1561909bUyHTO','7330086gvRZOB','string','validation'];a185_0x38cc=function(){return _0x2b7829;};return a185_0x38cc();}const a185_0x26927e=a185_0x41d5;(function(_0x354487,_0x9f3eb9){const _0x4f6a85=a185_0x41d5,_0x292589=_0x354487();while(!![]){try{const _0x6f803=-parseInt(_0x4f6a85(0x10c))/0x1+-parseInt(_0x4f6a85(0x114))/0x2*(-parseInt(_0x4f6a85(0x108))/0x3)+-parseInt(_0x4f6a85(0x103))/0x4*(-parseInt(_0x4f6a85(0x107))/0x5)+parseInt(_0x4f6a85(0x10d))/0x6+-parseInt(_0x4f6a85(0x111))/0x7*(-parseInt(_0x4f6a85(0x102))/0x8)+parseInt(_0x4f6a85(0x10b))/0x9*(-parseInt(_0x4f6a85(0x104))/0xa)+-parseInt(_0x4f6a85(0x113))/0xb*(parseInt(_0x4f6a85(0x112))/0xc);if(_0x6f803===_0x9f3eb9)break;else _0x292589['push'](_0x292589['shift']());}catch(_0x83b207){_0x292589['push'](_0x292589['shift']());}}}(a185_0x38cc,0xddf54));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a185_0x26927e(0x101),a185_0x26927e(0x115),a185_0x26927e(0x105)]['join']('\x0a');export const sqlSave={'service':a185_0x26927e(0x117),'command':'save','description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a185_0x26927e(0x106),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a185_0x26927e(0x110),'type':a185_0x26927e(0x10e),'required':!![],'description':a185_0x26927e(0x10a)},SQLCODE_FLAG_OPTIONAL,{'name':a185_0x26927e(0x118),'type':a185_0x26927e(0x10e),'description':a185_0x26927e(0x109)},{'name':'db','type':a185_0x26927e(0x10e),'description':a185_0x26927e(0x116)},{'name':'description','type':'string','description':a185_0x26927e(0x119)}],async 'validate'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x3dba4b=a185_0x26927e;throw CliErrors[_0x3dba4b(0x10f)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a186_0xb1ab(_0x28f7cb,_0x4f8ffc){_0x28f7cb=_0x28f7cb-0x14d;const _0xc90161=a186_0xc901();let _0xb1abe0=_0xc90161[_0x28f7cb];return _0xb1abe0;}(function(_0x308275,_0x798ac2){const _0x5e65be=a186_0xb1ab,_0x3ad640=_0x308275();while(!![]){try{const _0x36687c=-parseInt(_0x5e65be(0x158))/0x1+parseInt(_0x5e65be(0x16a))/0x2+-parseInt(_0x5e65be(0x168))/0x3+parseInt(_0x5e65be(0x15b))/0x4+parseInt(_0x5e65be(0x165))/0x5*(-parseInt(_0x5e65be(0x16c))/0x6)+parseInt(_0x5e65be(0x155))/0x7*(parseInt(_0x5e65be(0x170))/0x8)+parseInt(_0x5e65be(0x16f))/0x9;if(_0x36687c===_0x798ac2)break;else _0x3ad640['push'](_0x3ad640['shift']());}catch(_0xb15133){_0x3ad640['push'](_0x3ad640['shift']());}}}(a186_0xc901,0x2bd50));import{createInterface}from'node:readline';function a186_0xc901(){const _0x2628b0=['question','fromEntries','join','yes','sqlConfig','mode','description','filter','dbId','test','sqlName','7315DQEYND','split','includes','50910RWzDBE','lastSync','sqlCode','1078260FgeZzv','map','<!--\x20@lovrabet.','version','mybatisXml','dbName','apps','length','stderr','toLowerCase','1152815TmZXMj','sqlContent','push','860388Yzldph','\x20[y/N]\x20','24926TRvaxZ','close','6ZTKwMA','syncedAt','trim','3317328ibDegz','744YaqgRT','sqlRoot'];a186_0xc901=function(){return _0x2628b0;};return a186_0xc901();}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x4f5889,_0x4cd577,_0x1dda70,_0x3b85bc){const _0x287614=a186_0xb1ab,_0x310d8f=detectSqlMode(_0x4cd577);return{'path':buildSqlRelativePath(_0x4f5889[_0x287614(0x15a)],_0x4f5889['sqlName'],_0x3b85bc?.[_0x287614(0x160)],_0x310d8f,_0x4f5889['dbId']),'hash':_0x1dda70,'remoteId':_0x4f5889['id'],'version':_0x4f5889[_0x287614(0x15e)],'dbId':Number(_0x4f5889[_0x287614(0x152)]),'dbName':_0x3b85bc?.['dbName'],'sqlName':_0x4f5889[_0x287614(0x154)],'sqlConfig':_0x4f5889[_0x287614(0x14e)]??undefined,'mode':_0x310d8f};}export function cloneSqlLockData(_0x11e5af){const _0x218af2=a186_0xb1ab;return{'apps':Object[_0x218af2(0x173)](Object['entries'](_0x11e5af[_0x218af2(0x161)])['map'](([_0x2a8273,_0x45cf20])=>[_0x2a8273,{'sqlRoot':_0x45cf20[_0x218af2(0x171)],'lastSync':_0x45cf20[_0x218af2(0x159)],'sqls':{..._0x45cf20['sqls']}}]))};}export function ensureRemoteSqlContent(_0x477d6c){const _0x16f01f=a186_0xb1ab;return _0x477d6c[_0x16f01f(0x166)]??'';}export function buildLocalSqlFileContent(_0x4918c8,_0x4b087a,_0xf4741){const _0x12bf1b=a186_0xb1ab,_0x36793d=_0xf4741?.['mode']??detectSqlMode(_0x4b087a),_0x37a6b3=stripLocalSqlMetadata(_0x4b087a,_0x36793d)[_0x12bf1b(0x16e)](),_0x3e2043=[...buildMetadataHeaderLines({'sqlCode':_0x4918c8[_0x12bf1b(0x15a)],'sqlName':_0x4918c8[_0x12bf1b(0x154)],'dbId':_0x4918c8[_0x12bf1b(0x152)],'dbName':_0xf4741?.['dbName'],'mode':_0x36793d,'syncedAt':_0xf4741?.[_0x12bf1b(0x16d)],'description':_0xf4741?.['description']},_0x36793d),'',_0x37a6b3],_0x4ff192=_0x3e2043[_0x12bf1b(0x174)]('\x0a');return _0x4ff192['endsWith']('\x0a')?_0x4ff192:_0x4ff192+'\x0a';}export function stripLocalSqlMetadata(_0x3bad0f,_0x476451){const _0x547472=a186_0xb1ab,_0x3ac4fd=_0x3bad0f['replace'](/\r\n/g,'\x0a')[_0x547472(0x156)]('\x0a'),_0x4cfb60=[];let _0x387040=0x0;if(_0x476451===_0x547472(0x15f))while(_0x387040<_0x3ac4fd[_0x547472(0x162)]){const _0x31b659=_0x3ac4fd[_0x387040]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x31b659)){_0x387040++;continue;}if(_0x31b659[_0x547472(0x16e)]()===''&&_0x387040>0x0){_0x387040++;continue;}break;}else while(_0x387040<_0x3ac4fd[_0x547472(0x162)]){const _0x307d95=_0x3ac4fd[_0x387040]??'';if(/^\s*--\s*@lovrabet\./[_0x547472(0x153)](_0x307d95)){_0x387040++;continue;}if(_0x307d95[_0x547472(0x16e)]()===''&&_0x387040>0x0){_0x387040++;continue;}break;}for(;_0x387040<_0x3ac4fd['length'];_0x387040++){_0x4cfb60[_0x547472(0x167)](_0x3ac4fd[_0x387040]);}return _0x4cfb60[_0x547472(0x174)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x1d41b6,_0xce699c){const _0x5684d7=a186_0xb1ab;if(_0xce699c?.[_0x5684d7(0x14f)])return _0xce699c[_0x5684d7(0x14f)];return detectSqlMode(_0x1d41b6);}export function resolveSqlFileName(_0x287ab0,_0x25f850,_0x4fb0d6){const _0x4203f2=a186_0xb1ab;if(_0x4fb0d6?.['path'])return _0x4fb0d6['path'];if(_0x4fb0d6?.[_0x4203f2(0x154)]||_0x4fb0d6?.[_0x4203f2(0x160)])return buildSqlRelativePath(_0x287ab0,_0x4fb0d6?.[_0x4203f2(0x154)],_0x4fb0d6?.[_0x4203f2(0x160)],resolveSqlMode(_0x25f850,_0x4fb0d6),_0x4fb0d6?.[_0x4203f2(0x152)]);return buildDefaultSqlFileName(_0x287ab0,resolveSqlMode(_0x25f850,_0x4fb0d6));}export function resolveSqlLocalDir(_0x433089,_0x3439cd){return join(_0x433089,SQL_LOCAL_REL_DIR,_0x3439cd);}export async function confirmForceOverwrite(_0x52091d){const _0xf13577=a186_0xb1ab,_0x15d735=createInterface({'input':process['stdin'],'output':process[_0xf13577(0x163)]}),_0x1c9301=await new Promise(_0x3dcb99=>{const _0xe8f2f0=_0xf13577;_0x15d735[_0xe8f2f0(0x172)](_0x52091d+_0xe8f2f0(0x169),_0x3dcb99);});return _0x15d735[_0xf13577(0x16b)](),['y',_0xf13577(0x14d)][_0xf13577(0x157)](_0x1c9301[_0xf13577(0x16e)]()[_0xf13577(0x164)]());}export function findSqlLockScope(_0x13927a,_0xaa965d){const _0x50a5e5=a186_0xb1ab;return _0x13927a[_0x50a5e5(0x161)][_0xaa965d];}function buildMetadataHeaderLines(_0x6218c9,_0x28fe3b){const _0x579f44=a186_0xb1ab,_0x120f70=[['sqlCode',_0x6218c9[_0x579f44(0x15a)]],[_0x579f44(0x154),_0x6218c9[_0x579f44(0x154)]],[_0x579f44(0x152),_0x6218c9[_0x579f44(0x152)]],[_0x579f44(0x160),_0x6218c9[_0x579f44(0x160)]],['mode',_0x6218c9[_0x579f44(0x14f)]],['syncedAt',_0x6218c9[_0x579f44(0x16d)]],['description',_0x6218c9[_0x579f44(0x150)]]];if(_0x28fe3b===_0x579f44(0x15f))return _0x120f70[_0x579f44(0x151)](([,_0x4d4c13])=>_0x4d4c13!==undefined&&_0x4d4c13!==null&&String(_0x4d4c13)['trim']()!=='')['map'](([_0x56c335,_0x37f914])=>_0x579f44(0x15d)+_0x56c335+':\x20'+String(_0x37f914)+'\x20-->');return _0x120f70['filter'](([,_0x56cc8e])=>_0x56cc8e!==undefined&&_0x56cc8e!==null&&String(_0x56cc8e)[_0x579f44(0x16e)]()!=='')[_0x579f44(0x15c)](([_0x314c41,_0x4f4a9b])=>'--\x20@lovrabet.'+_0x314c41+':\x20'+String(_0x4f4a9b));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a187_0x1ced66=a187_0x1d44;(function(_0x17683e,_0x1c63c5){const _0x41b231=a187_0x1d44,_0x4dc5e3=_0x17683e();while(!![]){try{const _0x181eb5=-parseInt(_0x41b231(0xc8))/0x1*(parseInt(_0x41b231(0xcf))/0x2)+-parseInt(_0x41b231(0xcd))/0x3*(-parseInt(_0x41b231(0xe1))/0x4)+-parseInt(_0x41b231(0xde))/0x5*(-parseInt(_0x41b231(0xc6))/0x6)+-parseInt(_0x41b231(0xe3))/0x7*(-parseInt(_0x41b231(0xd1))/0x8)+parseInt(_0x41b231(0xca))/0x9+parseInt(_0x41b231(0xd0))/0xa*(parseInt(_0x41b231(0xc4))/0xb)+parseInt(_0x41b231(0xc5))/0xc*(-parseInt(_0x41b231(0xd2))/0xd);if(_0x181eb5===_0x1c63c5)break;else _0x4dc5e3['push'](_0x4dc5e3['shift']());}catch(_0x291e0d){_0x4dc5e3['push'](_0x4dc5e3['shift']());}}}(a187_0x7085,0x4c011));function a187_0x7085(){const _0x549a99=['sqlCode','has','sqls','sqlRoot','2887247Rhxyjx','2568Mhhkzq','6iBPnkz','lockFilePath','1mehFyw','appCode','2772135xwgZyO','length','paging','1770621BTDfTU','\x20missing,\x20','58468uQgPev','10TyXFOg','156888CaHjUY','79066XjhOjj','read','tableData','keys','relativePath','push','sqlName','boolean','status','path','lockKey','map','1524485ZukQTw','sql','\x20unchanged','4xyLpma','remote','63ZHernA','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','filePath'];a187_0x7085=function(){return _0x549a99;};return a187_0x7085();}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a187_0x1d44(_0x11258a,_0x562db0){_0x11258a=_0x11258a-0xbe;const _0x70857c=a187_0x7085();let _0x1d4474=_0x70857c[_0x11258a];return _0x1d4474;}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(_0x3ae2a6){const _0x2b755e=a187_0x1d44,_0xd24479=[];let _0x5d2579=0x1;while(!![]){const _0x2233da=await listSqlQueries(_0x3ae2a6,{'currentPage':_0x5d2579,'pageSize':PAGE_SIZE}),_0x3d5bc0=_0x2233da[_0x2b755e(0xd4)]??[];_0xd24479[_0x2b755e(0xd7)](..._0x3d5bc0['map'](_0x32867f=>_0x32867f[_0x2b755e(0xc0)]));if(_0x3d5bc0['length']===0x0)break;const _0x10ee35=_0x2233da[_0x2b755e(0xcc)]?.['totalCount'];if(_0x10ee35!=null?_0xd24479['length']>=_0x10ee35:_0x3d5bc0[_0x2b755e(0xcb)]<PAGE_SIZE)break;_0x5d2579++;}return _0xd24479;}export const sqlStatus={'service':a187_0x1ced66(0xdf),'command':a187_0x1ced66(0xda),'description':a187_0x1ced66(0xbe),'risk':a187_0x1ced66(0xd3),'flags':[{'name':'remote','type':a187_0x1ced66(0xd9),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x57e1db){const _0x2e8a51=a187_0x1ced66,_0x2166e9=loadSqlProjectConfig(_0x57e1db[_0x2e8a51(0xc9)]),_0x6224ef=await readSqlLockFile(_0x2166e9[_0x2e8a51(0xc7)]),{appLock:_0x163125}=ensureSqlLockScope(_0x6224ef??createEmptySqlLock(),_0x2166e9[_0x2e8a51(0xc9)],_0x2166e9[_0x2e8a51(0xc3)],_0x2e8a51(0xda)),_0x35c279=await scanLocalSqlQueries(_0x2166e9),_0x337f47=[],_0x3c3fb7=[],_0x1637bf=[],_0x58c5a6=[],_0x35cda8=new Set(_0x35c279[_0x2e8a51(0xdd)](_0x333f1d=>_0x333f1d[_0x2e8a51(0xdc)]));for(const _0x453cbc of _0x35c279){const _0x1378ec=await computeSqlFileHash(_0x453cbc[_0x2e8a51(0xbf)]),_0x44a5e8=_0x163125[_0x2e8a51(0xc2)][_0x453cbc['lockKey']],_0x2b12a9=!!_0x44a5e8&&_0x44a5e8[_0x2e8a51(0xdb)]!==_0x453cbc[_0x2e8a51(0xd6)],_0x59ad79=!!_0x44a5e8&&!!_0x453cbc[_0x2e8a51(0xd8)]&&_0x44a5e8['sqlName']!==_0x453cbc[_0x2e8a51(0xd8)];if(!_0x44a5e8)_0x337f47['push'](_0x453cbc[_0x2e8a51(0xdc)]);else _0x44a5e8['hash']!==_0x1378ec||_0x2b12a9||_0x59ad79?_0x3c3fb7[_0x2e8a51(0xd7)](_0x453cbc['lockKey']):_0x1637bf[_0x2e8a51(0xd7)](_0x453cbc[_0x2e8a51(0xdc)]);}for(const _0x5f3295 of Object[_0x2e8a51(0xd5)](_0x163125[_0x2e8a51(0xc2)])){!_0x35cda8['has'](_0x5f3295)&&_0x58c5a6[_0x2e8a51(0xd7)](_0x5f3295);}const _0x22e8b3=[];if(_0x57e1db['bool'](_0x2e8a51(0xe2))){const _0x4642ac=await fetchAllSqlCodes(_0x57e1db[_0x2e8a51(0xc9)]);for(const _0x241d45 of _0x4642ac){!_0x35cda8[_0x2e8a51(0xc1)](_0x241d45)&&!_0x163125['sqls'][_0x241d45]&&_0x22e8b3[_0x2e8a51(0xd7)](_0x241d45);}}const _0xf049e=_0x337f47['length']===0x0&&_0x3c3fb7['length']===0x0&&_0x58c5a6[_0x2e8a51(0xcb)]===0x0&&_0x22e8b3[_0x2e8a51(0xcb)]===0x0;return{'ok':!![],'data':{'added':_0x337f47,'modified':_0x3c3fb7,'missing':_0x58c5a6,'unchanged':_0x1637bf,'remoteOnly':_0x22e8b3},'message':_0xf049e?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x337f47[_0x2e8a51(0xcb)]+'\x20added,\x20'+_0x3c3fb7['length']+'\x20modified,\x20'+_0x58c5a6['length']+_0x2e8a51(0xce)+_0x1637bf['length']+_0x2e8a51(0xe0)+(_0x22e8b3[_0x2e8a51(0xcb)]>0x0?',\x20'+_0x22e8b3[_0x2e8a51(0xcb)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a188_0x14ede3=a188_0x3066;(function(_0x243b9d,_0x189d1f){const _0x3b8ae9=a188_0x3066,_0x4e55f2=_0x243b9d();while(!![]){try{const _0xbcbd67=-parseInt(_0x3b8ae9(0xff))/0x1*(-parseInt(_0x3b8ae9(0x135))/0x2)+parseInt(_0x3b8ae9(0x112))/0x3+parseInt(_0x3b8ae9(0x126))/0x4+-parseInt(_0x3b8ae9(0x11b))/0x5+-parseInt(_0x3b8ae9(0x137))/0x6*(-parseInt(_0x3b8ae9(0x11a))/0x7)+parseInt(_0x3b8ae9(0x134))/0x8*(parseInt(_0x3b8ae9(0x101))/0x9)+-parseInt(_0x3b8ae9(0x10b))/0xa;if(_0xbcbd67===_0x189d1f)break;else _0x4e55f2['push'](_0x4e55f2['shift']());}catch(_0x26c969){_0x4e55f2['push'](_0x4e55f2['shift']());}}}(a188_0x2fdd,0x25dee));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a188_0x2fdd(){const _0x3a10=['2549799zkUghX','columns','schema:','flagMissing','pkField','Dataset\x20\x22','split','dbtableConfig','map','name','4851730aurUUe','Provide\x20--file\x20or\x20--sql','primary','schemaWarnings','push','unshift','toLowerCase','793488OoKRDV','find','type','str','length','check-indexes','sql','get','7klhBci','1372935baYCdz','fields','appCode','bool','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','valid','filter','Table\x20\x22','indexName','utf-8','message','1111492aizQWW','trim','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','file','index_columns','string','cwd','columnNames','parameters','schemas','read','isArray','reason','File\x20not\x20found:\x20','8ERMrWY','2mCXmoY','validate','327282YySrOa','flatMap','--check-indexes\x20requires\x20--schemas.','tables','validation','sqlType','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','index_type','tableName','indexes','isDangerous','34651VvLeQD','SQL\x20schema\x20validation'];a188_0x2fdd=function(){return _0x3a10;};return a188_0x2fdd();}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a188_0x3066(_0x28dd54,_0x33458d){_0x28dd54=_0x28dd54-0xfe;const _0x2fdd84=a188_0x2fdd();let _0x3066f5=_0x2fdd84[_0x28dd54];return _0x3066f5;}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a188_0x14ede3(0x118),'command':a188_0x14ede3(0x136),'description':a188_0x14ede3(0x13d),'risk':a188_0x14ede3(0x130),'flags':[{'name':a188_0x14ede3(0x129),'type':a188_0x14ede3(0x12b),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a188_0x14ede3(0x118),'type':a188_0x14ede3(0x12b),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a188_0x14ede3(0x12f),'type':'string','description':a188_0x14ede3(0x11f)},{'name':a188_0x14ede3(0x117),'type':'boolean','description':a188_0x14ede3(0x128)}],async 'execute'(_0x299795){const _0x29d3fc=a188_0x14ede3,_0x1bbb1d=_0x299795['str'](_0x29d3fc(0x129)),_0x3fe9b0=_0x299795[_0x29d3fc(0x115)](_0x29d3fc(0x118)),_0x57771b=_0x299795[_0x29d3fc(0x115)]('schemas'),_0x4c61b3=_0x299795[_0x29d3fc(0x11e)]('check-indexes');if(!_0x1bbb1d&&!_0x3fe9b0)throw CliErrors[_0x29d3fc(0x104)](_0x29d3fc(0x129),_0x29d3fc(0x10c));if(_0x4c61b3&&!_0x57771b)throw CliErrors[_0x29d3fc(0x13b)](_0x29d3fc(0x139));let _0x43a001;if(_0x1bbb1d){const _0x4e0fa5=resolve(process[_0x29d3fc(0x12c)](),_0x1bbb1d);if(!existsSync(_0x4e0fa5))throw CliErrors[_0x29d3fc(0x13b)](_0x29d3fc(0x133)+_0x4e0fa5);_0x43a001=readFileSync(_0x4e0fa5,_0x29d3fc(0x124));}else _0x43a001=_0x3fe9b0;const _0x3024da=validateSql(_0x43a001),_0x13968e={'valid':_0x3024da[_0x29d3fc(0x120)],'sqlType':_0x3024da[_0x29d3fc(0x13c)][_0x29d3fc(0x114)],'isSelectOnly':_0x3024da[_0x29d3fc(0x13c)]['isSelectOnly'],'isDangerous':_0x3024da[_0x29d3fc(0x13c)][_0x29d3fc(0xfe)],'tables':_0x3024da[_0x29d3fc(0x13a)],'parameters':_0x3024da[_0x29d3fc(0x12e)],'message':_0x3024da[_0x29d3fc(0x125)]};_0x3024da[_0x29d3fc(0x13c)][_0x29d3fc(0x132)]&&(_0x13968e[_0x29d3fc(0x132)]=_0x3024da[_0x29d3fc(0x13c)][_0x29d3fc(0x132)]);if(_0x57771b&&_0x3024da[_0x29d3fc(0x120)]){const _0x4f1a7a=_0x57771b[_0x29d3fc(0x107)](',')['map'](_0x5b4ad5=>_0x5b4ad5[_0x29d3fc(0x127)]())[_0x29d3fc(0x121)](Boolean),_0x1359d2=[],_0x1a832d=[],_0x2957bd=filterDbTableBackedDatasets(await listDatasets(_0x299795[_0x29d3fc(0x11d)])),_0x23f218=new Map(_0x2957bd[_0x29d3fc(0x109)](_0x32969a=>[_0x32969a['dbtableConfig']?.[_0x29d3fc(0x13f)]?.[_0x29d3fc(0x111)](),_0x32969a]));for(const _0x19b117 of _0x3024da[_0x29d3fc(0x13a)]){const _0x34eca4=_0x23f218[_0x29d3fc(0x119)](_0x19b117[_0x29d3fc(0x111)]());!_0x34eca4&&_0x1359d2[_0x29d3fc(0x10f)](_0x29d3fc(0x122)+_0x19b117+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0xcef791 of _0x4f1a7a){let _0x392acf;try{_0x392acf=await getDatasetDetail(_0xcef791);}catch{_0x1359d2[_0x29d3fc(0x10f)](_0x29d3fc(0x106)+_0xcef791+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x392acf,_0x29d3fc(0x100));const _0x587d9d=Array[_0x29d3fc(0x131)](_0x392acf[_0x29d3fc(0x11c)])?_0x392acf[_0x29d3fc(0x11c)]:[],_0xadf58=new Set(_0x587d9d[_0x29d3fc(0x109)](_0x362c97=>_0x362c97[_0x29d3fc(0x10a)]?.[_0x29d3fc(0x111)]())),_0x1f92a5=_0x392acf[_0x29d3fc(0x108)]?.['tableName']||_0x392acf[_0x29d3fc(0x13f)]||_0xcef791;_0x13968e[_0x29d3fc(0x103)+_0x1f92a5]={'code':_0xcef791,'tableName':_0x1f92a5,'fieldCount':_0xadf58['size'],'fields':Array['from'](_0xadf58)};if(_0x4c61b3){const _0xcd14a3=normalizeDatasetIndexes(_0x392acf);_0x1a832d['push']({'tableName':_0x1f92a5,..._0xcd14a3});}}_0x1359d2[_0x29d3fc(0x116)]>0x0&&(_0x13968e[_0x29d3fc(0x10e)]=_0x1359d2),_0x4c61b3&&(_0x13968e['joinAudit']=auditSqlJoinIndexes(_0x43a001,_0x1a832d));}return{'ok':_0x3024da[_0x29d3fc(0x120)],'data':_0x13968e,'message':_0x3024da[_0x29d3fc(0x125)]};}};function normalizeDatasetIndexes(_0x2309c8){const _0x50b2af=a188_0x14ede3,_0x52b4ea=Array[_0x50b2af(0x131)](_0x2309c8?.['dataset']?.[_0x50b2af(0x140)])?_0x2309c8['dataset'][_0x50b2af(0x140)]:Array[_0x50b2af(0x131)](_0x2309c8?.[_0x50b2af(0x140)])?_0x2309c8[_0x50b2af(0x140)]:[],_0x29d177=_0x52b4ea[_0x50b2af(0x138)](_0x2abd33=>{const _0x1b59ce=_0x50b2af,_0xf59929=Array[_0x1b59ce(0x131)](_0x2abd33?.[_0x1b59ce(0x12a)])?_0x2abd33['index_columns']:Array[_0x1b59ce(0x131)](_0x2abd33?.['columnNames'])?_0x2abd33[_0x1b59ce(0x12d)]:Array[_0x1b59ce(0x131)](_0x2abd33?.[_0x1b59ce(0x102)])?_0x2abd33[_0x1b59ce(0x102)]:[],_0x1ce4cf=_0xf59929['filter'](_0x592024=>typeof _0x592024===_0x1b59ce(0x12b))['map'](_0x2bd65a=>_0x2bd65a[_0x1b59ce(0x127)]())[_0x1b59ce(0x121)](Boolean);if(_0x1ce4cf['length']===0x0)return[];const _0x5d0bf9=[_0x2abd33?.[_0x1b59ce(0x123)],_0x2abd33?.['index_name'],_0x2abd33?.[_0x1b59ce(0x10a)]][_0x1b59ce(0x113)](_0x34b9c4=>typeof _0x34b9c4===_0x1b59ce(0x12b)&&_0x34b9c4[_0x1b59ce(0x127)]()),_0x47420b=[_0x2abd33?.[_0x1b59ce(0x13e)],_0x2abd33?.[_0x1b59ce(0x114)]]['find'](_0x3f9efb=>typeof _0x3f9efb===_0x1b59ce(0x12b)&&_0x3f9efb[_0x1b59ce(0x127)]());return[{..._0x5d0bf9?{'name':_0x5d0bf9['trim']()}:{},..._0x47420b?{'type':_0x47420b[_0x1b59ce(0x127)]()}:{},'columns':_0x1ce4cf}];}),_0x5db000=[..._0x29d177],_0x39e547=typeof _0x2309c8?.[_0x50b2af(0x108)]?.[_0x50b2af(0x105)]===_0x50b2af(0x12b)?_0x2309c8[_0x50b2af(0x108)]['pkField'][_0x50b2af(0x107)](',')[_0x50b2af(0x109)](_0x1d6258=>_0x1d6258['trim']())[_0x50b2af(0x121)](Boolean):[];return _0x39e547[_0x50b2af(0x116)]>0x0&&_0x5db000[_0x50b2af(0x110)]({'type':_0x50b2af(0x10d),'columns':_0x39e547}),{'indexes':_0x5db000,'metadataAvailable':_0x29d177[_0x50b2af(0x116)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a189_0xe3b8(_0x2d2921,_0x2eeff1){_0x2d2921=_0x2d2921-0x144;const _0x36cdf9=a189_0x36cd();let _0xe3b8cc=_0x36cdf9[_0x2d2921];return _0xe3b8cc;}(function(_0x391a3c,_0x4990bb){const _0x3d22f4=a189_0xe3b8,_0x15f131=_0x391a3c();while(!![]){try{const _0x1cdf6e=parseInt(_0x3d22f4(0x14b))/0x1*(parseInt(_0x3d22f4(0x149))/0x2)+-parseInt(_0x3d22f4(0x144))/0x3+-parseInt(_0x3d22f4(0x14e))/0x4*(parseInt(_0x3d22f4(0x14c))/0x5)+-parseInt(_0x3d22f4(0x14d))/0x6*(parseInt(_0x3d22f4(0x145))/0x7)+-parseInt(_0x3d22f4(0x14a))/0x8+-parseInt(_0x3d22f4(0x147))/0x9+parseInt(_0x3d22f4(0x146))/0xa*(parseInt(_0x3d22f4(0x148))/0xb);if(_0x1cdf6e===_0x4990bb)break;else _0x15f131['push'](_0x15f131['shift']());}catch(_0x4766d9){_0x15f131['push'](_0x15f131['shift']());}}}(a189_0x36cd,0x4f500));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a189_0x36cd(){const _0x3e95b7=['436068WeXglS','11QpHveL','768VpkBVq','4884776HiRuon','1453MhGjpQ','14215JfLCLO','18JaJLyN','808VyTqwP','1176588hcuYrU','1111299zvuwAc','18687140dIsbNO'];a189_0x36cd=function(){return _0x3e95b7;};return a189_0x36cd();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a190_0x53dffc=a190_0x35bc;(function(_0xe9bc93,_0xa038f8){const _0x42e137=a190_0x35bc,_0xa2943d=_0xe9bc93();while(!![]){try{const _0x2e8bb1=parseInt(_0x42e137(0x193))/0x1+parseInt(_0x42e137(0x190))/0x2+parseInt(_0x42e137(0x194))/0x3+parseInt(_0x42e137(0x1a0))/0x4*(parseInt(_0x42e137(0x19d))/0x5)+-parseInt(_0x42e137(0x199))/0x6*(parseInt(_0x42e137(0x192))/0x7)+parseInt(_0x42e137(0x1a1))/0x8*(-parseInt(_0x42e137(0x18e))/0x9)+-parseInt(_0x42e137(0x19e))/0xa;if(_0x2e8bb1===_0xa038f8)break;else _0xa2943d['push'](_0xa2943d['shift']());}catch(_0x44dbc8){_0xa2943d['push'](_0xa2943d['shift']());}}}(a190_0xa8b0,0x62e04));function a190_0xa8b0(){const _0x17ccf7=['read','str','isTerminal','task-id','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','266499DiMmLH','cookie','442370oCGnCI','apiError','2993207oGEGNy','670205bwiSyT','2134359hQQOnA','trim','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','status',',\x20received\x20','6MypXbj','flagMissing','taskId','appCode','4965PgiLZS','6136120xlriEI','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','204sVHYAI','56jWtoJK'];a190_0xa8b0=function(){return _0x17ccf7;};return a190_0xa8b0();}function a190_0x35bc(_0x1ac37e,_0x4187bd){_0x1ac37e=_0x1ac37e-0x18a;const _0xa8b0fe=a190_0xa8b0();let _0x35bcb7=_0xa8b0fe[_0x1ac37e];return _0x35bcb7;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':a190_0x53dffc(0x197),'description':a190_0x53dffc(0x196),'risk':a190_0x53dffc(0x1a2),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a190_0x53dffc(0x18c),'type':'string','required':!![],'description':a190_0x53dffc(0x19f)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1d8419){const _0x137faa=a190_0x53dffc;if(!_0x1d8419[_0x137faa(0x18a)](_0x137faa(0x18c))['trim']())throw CliErrors[_0x137faa(0x19a)](_0x137faa(0x18c));},async 'execute'(_0x12f1ab){const _0x43047a=a190_0x53dffc,_0x4aa98d=_0x12f1ab[_0x43047a(0x18a)](_0x43047a(0x18c))[_0x43047a(0x195)](),_0x337c50=normalizeAsyncTask(await getAsyncTaskStatus(_0x4aa98d,_0x12f1ab['appCode'],_0x12f1ab[_0x43047a(0x18f)]));if(_0x337c50[_0x43047a(0x19b)]!==_0x4aa98d)throw CliErrors[_0x43047a(0x191)](_0x43047a(0x18d)+_0x4aa98d+_0x43047a(0x198)+_0x337c50['taskId']+'.');const _0x1185c2=buildAsyncTaskStatusCommand(_0x337c50[_0x43047a(0x19b)],_0x12f1ab[_0x43047a(0x19c)]);return{'ok':!![],'message':asyncTaskMessage(_0x337c50),'data':{'appCode':_0x12f1ab[_0x43047a(0x19c)],..._0x337c50,'query':_0x337c50[_0x43047a(0x18b)]?null:{'command':_0x1185c2}}};}};
|