@lovrabet/rabetbase-cli 2.3.4-beta.3 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -0
- 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 -0
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/dry-run.js +1 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/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/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -0
- package/lib/commands/permit/page-get.js +1 -0
- package/lib/commands/permit/page-set.js +1 -0
- package/lib/commands/permit/role-apis-set.js +1 -0
- package/lib/commands/permit/role-menus-set.js +1 -0
- package/lib/commands/permit/role-menus.js +1 -0
- package/lib/commands/permit/shared.js +1 -0
- 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 -0
- package/lib/commands/role/delete.js +1 -0
- package/lib/commands/role/detail.js +1 -0
- package/lib/commands/role/index.js +1 -0
- package/lib/commands/role/list.js +1 -0
- package/lib/commands/role/shared.js +1 -0
- package/lib/commands/role/update.js +1 -0
- package/lib/commands/role/user-add.js +1 -0
- package/lib/commands/role/user-remove.js +1 -0
- package/lib/commands/role/user-resolve.js +1 -0
- 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/workspace/add.js +1 -0
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -0
- 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-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/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 +2 -2
- package/lib/commands/app/discover.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a151_0x20fa3e=a151_0x3a1d;(function(_0x403ef4,_0x5196fd){const _0x5c08c0=a151_0x3a1d,_0x1d6c45=_0x403ef4();while(!![]){try{const _0x598453=parseInt(_0x5c08c0(0xf2))/0x1*(parseInt(_0x5c08c0(0xd7))/0x2)+-parseInt(_0x5c08c0(0xe7))/0x3*(parseInt(_0x5c08c0(0xd6))/0x4)+-parseInt(_0x5c08c0(0xdf))/0x5+parseInt(_0x5c08c0(0xf4))/0x6*(parseInt(_0x5c08c0(0xed))/0x7)+parseInt(_0x5c08c0(0xda))/0x8*(-parseInt(_0x5c08c0(0xfa))/0x9)+parseInt(_0x5c08c0(0xe5))/0xa+parseInt(_0x5c08c0(0xe2))/0xb;if(_0x598453===_0x5196fd)break;else _0x1d6c45['push'](_0x1d6c45['shift']());}catch(_0x511a19){_0x1d6c45['push'](_0x1d6c45['shift']());}}}(a151_0x4fdd,0x3cbbc));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a151_0x3a1d(_0x207b83,_0x3ce6f6){_0x207b83=_0x207b83-0xd5;const _0x4fdd10=a151_0x4fdd();let _0x3a1daa=_0x4fdd10[_0x207b83];return _0x3a1daa;}import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a151_0x4fdd(){const _0x4ddf98=['fromEntries','829xCMDMt','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','6hOJdPZ','lastSync','sqlRootDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sqlRoot','trashedTo','1344267vUqFMh','Would\x20delete\x20SQL\x20','entries','sqls','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','validation','lockFilePath','12aJSbUk','242rqSoJq','toISOString','\x20(local\x20file\x20moved\x20to\x20trash)','8PzywgL','trashDir','SQL\x20lock\x20file\x20not\x20found.','appCode','/smartapi/custom/deleteUserCustomSql','1426210TPQsHo','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','delete','4521165EUcvhx','remoteId','replace','4324350xTUGKy','startsWith','363021ioYAEv','high-risk-write','str','Deleted\x20','projectRoot','POST','718417RMOFKt','sqlcode','sql','length'];a151_0x4fdd=function(){return _0x4ddf98;};return a151_0x4fdd();}export const sqlDelete={'service':a151_0x20fa3e(0xef),'command':a151_0x20fa3e(0xe1),'description':a151_0x20fa3e(0xf3),'risk':a151_0x20fa3e(0xe8),'flags':[SQLCODE_FLAG],async 'validate'(_0x2aaaae){const _0x38e211=a151_0x20fa3e,_0x54b6a8=loadSqlProjectConfig(_0x2aaaae[_0x38e211(0xdd)]),_0x22554f=await readSqlLockFile(_0x54b6a8[_0x38e211(0xd5)]);if(!_0x22554f)throw CliErrors[_0x38e211(0xff)](_0x38e211(0xf7));},async 'dryRun'(_0x26499d){const _0x5e4670=a151_0x20fa3e,_0x3f566d=loadSqlProjectConfig(_0x26499d[_0x5e4670(0xdd)]),_0x2469d6=await readSqlLockFile(_0x3f566d[_0x5e4670(0xd5)]);if(!_0x2469d6)throw CliErrors[_0x5e4670(0xff)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x3e53ff}=ensureSqlLockScope(_0x2469d6,_0x26499d['appCode'],_0x3f566d[_0x5e4670(0xf8)],_0x5e4670(0xe1)),_0x1f1e6e=_0x26499d['str'](_0x5e4670(0xee)),_0xe5de3a=_0x3e53ff['sqls'][_0x1f1e6e];if(!_0xe5de3a)throw CliErrors[_0x5e4670(0xff)](_0x5e4670(0xe0)+_0x1f1e6e+'\x22.');return{'method':_0x5e4670(0xec),'url':_0x5e4670(0xde),'body':{'sqlCode':_0x1f1e6e,'id':_0xe5de3a[_0x5e4670(0xe3)],'localPath':resolveLocalSqlFilePath(_0x3f566d,_0x1f1e6e,_0xe5de3a)},'description':_0x5e4670(0xfb)+_0x1f1e6e+_0x5e4670(0xfe)+_0x3f566d[_0x5e4670(0xdb)]};},async 'execute'(_0x461557){const _0x14d53c=a151_0x20fa3e,_0x1c7ca3=loadSqlProjectConfig(_0x461557['appCode']),_0x5d540f=await readSqlLockFile(_0x1c7ca3['lockFilePath']);if(!_0x5d540f)throw CliErrors[_0x14d53c(0xff)](_0x14d53c(0xdc));const {lockData:_0x434e0f,appLock:_0x2f63c1}=ensureSqlLockScope(_0x5d540f,_0x461557[_0x14d53c(0xdd)],_0x1c7ca3[_0x14d53c(0xf8)],_0x14d53c(0xe1)),_0x11b780=_0x461557[_0x14d53c(0xe9)](_0x14d53c(0xee)),_0xfab13f=_0x2f63c1[_0x14d53c(0xfd)][_0x11b780];if(!_0xfab13f)throw CliErrors[_0x14d53c(0xff)](_0x14d53c(0xe0)+_0x11b780+'\x22.');await deleteSqlQuery({'id':_0xfab13f['remoteId'],'sqlCode':_0x11b780}),_0x2f63c1[_0x14d53c(0xfd)]=Object[_0x14d53c(0xf1)](Object[_0x14d53c(0xfc)](_0x2f63c1[_0x14d53c(0xfd)])['filter'](([_0x28ec61])=>_0x28ec61!==_0x11b780)),_0x2f63c1[_0x14d53c(0xf5)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1c7ca3['lockFilePath'],_0x434e0f);const _0x4fc812=resolveLocalSqlFilePath(_0x1c7ca3,_0x11b780,_0xfab13f);let _0x2eee32;await fileExists(_0x4fc812)&&(_0x2eee32=await moveToTrash(_0x1c7ca3[_0x14d53c(0xeb)],_0x1c7ca3[_0x14d53c(0xdb)],_0x4fc812),await cleanupEmptyDirectories(dirname(_0x4fc812),_0x1c7ca3[_0x14d53c(0xf6)]));const _0x586d98={'deleted':_0x11b780,'remoteId':_0xfab13f[_0x14d53c(0xe3)]};if(_0x2eee32)_0x586d98[_0x14d53c(0xf9)]=_0x2eee32;return{'ok':!![],'data':_0x586d98,'message':_0x14d53c(0xea)+_0x11b780+(_0x2eee32?_0x14d53c(0xd9):'')};}};async function moveToTrash(_0x3848f,_0x5a2b30,_0x30c901){const _0x50a522=a151_0x20fa3e,_0x481866=new Date()[_0x50a522(0xd8)]()[_0x50a522(0xe4)](/[:.]/g,'-'),_0x5b32e6=relative(_0x3848f,_0x30c901),_0x3e1c04=join(_0x5a2b30,_0x481866,_0x5b32e6);return await mkdir(dirname(_0x3e1c04),{'recursive':!![]}),await rename(_0x30c901,_0x3e1c04),_0x3e1c04;}async function cleanupEmptyDirectories(_0x3eca96,_0x4053cd){const _0x57435b=a151_0x20fa3e;let _0x10f312=resolve(_0x3eca96);const _0x3ecbc2=resolve(_0x4053cd);while(_0x10f312[_0x57435b(0xe6)](''+_0x3ecbc2+sep)||_0x10f312===_0x3ecbc2){if(_0x10f312===_0x3ecbc2)return;try{const _0x15deb5=await readdir(_0x10f312);if(_0x15deb5[_0x57435b(0xf0)]>0x0)return;await rmdir(_0x10f312);}catch{return;}_0x10f312=dirname(_0x10f312);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a152_0x591544=a152_0x486a;(function(_0x554df4,_0x124d7a){const _0x156436=a152_0x486a,_0x1f19a9=_0x554df4();while(!![]){try{const _0x246647=-parseInt(_0x156436(0x123))/0x1*(-parseInt(_0x156436(0x128))/0x2)+-parseInt(_0x156436(0x124))/0x3*(-parseInt(_0x156436(0x121))/0x4)+parseInt(_0x156436(0x125))/0x5*(parseInt(_0x156436(0x115))/0x6)+-parseInt(_0x156436(0x120))/0x7*(-parseInt(_0x156436(0x117))/0x8)+parseInt(_0x156436(0x114))/0x9*(-parseInt(_0x156436(0x113))/0xa)+parseInt(_0x156436(0x116))/0xb*(-parseInt(_0x156436(0x112))/0xc)+-parseInt(_0x156436(0x11b))/0xd*(parseInt(_0x156436(0x11e))/0xe);if(_0x246647===_0x124d7a)break;else _0x1f19a9['push'](_0x1f19a9['shift']());}catch(_0x4a2394){_0x1f19a9['push'](_0x1f19a9['shift']());}}}(a152_0x1036,0x33072));function a152_0x486a(_0x3ed5c8,_0x172b35){_0x3ed5c8=_0x3ed5c8-0x111;const _0x10364b=a152_0x1036();let _0x486a66=_0x10364b[_0x3ed5c8];return _0x486a66;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a152_0x1036(){const _0x16e2b5=['detail','bool','268SXcAad','sqlName','12IbmAtV','49270ZbxKwe','603TDjHvO','5034Cvnuki','2037508wknIBb','402936zIMnFU','description','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','dbId','39HtZMyw','verbose','Return\x20full\x20raw\x20SQL\x20query\x20object','982996rtdUFv','sqlcode','49ANJEDv','3972iroOtx','appCode','1827WXWGzg','39QBQgWk','1935aUapyO'];a152_0x1036=function(){return _0x16e2b5;};return a152_0x1036();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a152_0x591544(0x126),'description':a152_0x591544(0x119),'risk':'read','flags':[SQLCODE_FLAG,{'name':a152_0x591544(0x11c),'type':'boolean','description':a152_0x591544(0x11d)}],async 'execute'(_0x1238f3){const _0x333b74=a152_0x591544,_0x1b1c22=await getSqlQueryInfo(_0x1238f3[_0x333b74(0x122)],_0x1238f3['str'](_0x333b74(0x11f))),_0x221dd2=_0x1238f3[_0x333b74(0x127)]('verbose');if(_0x221dd2)return{'ok':!![],'data':_0x1b1c22};const _0x106f1d=_0x1b1c22[_0x333b74(0x11a)]?await getDbName(_0x1238f3[_0x333b74(0x122)],_0x1b1c22[_0x333b74(0x11a)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1b1c22['sqlCode'],'sqlName':_0x1b1c22[_0x333b74(0x111)],'db':_0x106f1d?_0x106f1d+'\x20('+_0x1b1c22[_0x333b74(0x11a)]+')':_0x1b1c22[_0x333b74(0x11a)]??'','description':_0x1b1c22[_0x333b74(0x118)]??'','sqlContent':_0x1b1c22['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a153_0x440a94=a153_0x350c;function a153_0x5164(){const _0x49b0b6=['99xLuTRx','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','str','272mrQJQf','80022zRgdvH','1189567CSoVvL','Returned\x20','7260520XKYRMp','511EqaZsj','22444930hhVdZf','execError','62412ziEgca','length','params','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','exec','now','read','sql','string','execResult','43623zhXBoU','2953144EKZsqd','SQL\x20execution\x20failed','execSuccess','appCode'];a153_0x5164=function(){return _0x49b0b6;};return a153_0x5164();}(function(_0x5ded01,_0x616894){const _0x551797=a153_0x350c,_0xbb65b5=_0x5ded01();while(!![]){try{const _0x2d62ee=-parseInt(_0x551797(0xce))/0x1+parseInt(_0x551797(0xdf))/0x2+-parseInt(_0x551797(0xc9))/0x3*(-parseInt(_0x551797(0xd4))/0x4)+-parseInt(_0x551797(0xd0))/0x5+parseInt(_0x551797(0xcd))/0x6*(-parseInt(_0x551797(0xd1))/0x7)+-parseInt(_0x551797(0xcc))/0x8*(-parseInt(_0x551797(0xde))/0x9)+parseInt(_0x551797(0xd2))/0xa;if(_0x2d62ee===_0x616894)break;else _0xbb65b5['push'](_0xbb65b5['shift']());}catch(_0x129591){_0xbb65b5['push'](_0xbb65b5['shift']());}}}(a153_0x5164,0xbfc52));function a153_0x350c(_0x247617,_0x112044){_0x247617=_0x247617-0xc9;const _0x516459=a153_0x5164();let _0x350c9c=_0x516459[_0x247617];return _0x350c9c;}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':a153_0x440a94(0xdb),'command':a153_0x440a94(0xd8),'description':a153_0x440a94(0xca),'risk':a153_0x440a94(0xda),'flags':[SQLCODE_FLAG,{'name':a153_0x440a94(0xd6),'type':a153_0x440a94(0xdc),'description':a153_0x440a94(0xd7)}],async 'execute'(_0x3f5fe4){const _0x1b993f=a153_0x440a94,_0x39480a=parseJsonParams(_0x3f5fe4[_0x1b993f(0xcb)](_0x1b993f(0xd6))),_0xd04311=Date[_0x1b993f(0xd9)](),_0xac3c20=await executeSql(_0x3f5fe4[_0x1b993f(0xe2)],_0x3f5fe4[_0x1b993f(0xcb)]('sqlcode'),_0x39480a),_0x4f53b2=Date[_0x1b993f(0xd9)]()-_0xd04311,_0x49abbb=_0xac3c20?.[_0x1b993f(0xdd)]??_0xac3c20,_0x2142c5=_0xac3c20?.[_0x1b993f(0xe1)]??!![];if(!_0x2142c5)return{'ok':![],'data':{'error':_0xac3c20?.[_0x1b993f(0xd3)]||_0x1b993f(0xe0),'elapsed':_0x4f53b2},'message':_0x1b993f(0xe0)};const _0x13e229=Array['isArray'](_0x49abbb)?_0x49abbb:[];return{'ok':!![],'data':{'rows':_0x13e229,'rowCount':_0x13e229[_0x1b993f(0xd5)],'elapsed':_0x4f53b2},'message':_0x1b993f(0xcf)+_0x13e229[_0x1b993f(0xd5)]+'\x20row(s)\x20in\x20'+_0x4f53b2+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x372ced,_0x3feed1){const _0xc6e040=a154_0x568c,_0x1fdd3d=_0x372ced();while(!![]){try{const _0x5af2c0=parseInt(_0xc6e040(0x18c))/0x1+-parseInt(_0xc6e040(0x190))/0x2+-parseInt(_0xc6e040(0x189))/0x3*(parseInt(_0xc6e040(0x18a))/0x4)+-parseInt(_0xc6e040(0x18e))/0x5*(-parseInt(_0xc6e040(0x18d))/0x6)+parseInt(_0xc6e040(0x18b))/0x7+-parseInt(_0xc6e040(0x188))/0x8+parseInt(_0xc6e040(0x18f))/0x9;if(_0x5af2c0===_0x3feed1)break;else _0x1fdd3d['push'](_0x1fdd3d['shift']());}catch(_0x26b268){_0x1fdd3d['push'](_0x1fdd3d['shift']());}}}(a154_0xb24f,0xb1912));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a154_0xb24f(){const _0xe89339=['938224nBBdUA','4878864VWLTZN','260556uUgGoj','52oXkzql','368970yqVPue','104605TLTYjC','6jVxBZO','7140305SigXUb','12149856QjsFJS'];a154_0xb24f=function(){return _0xe89339;};return a154_0xb24f();}function a154_0x568c(_0xec22da,_0x579240){_0xec22da=_0xec22da-0x188;const _0xb24fb3=a154_0xb24f();let _0x568cd6=_0xb24fb3[_0xec22da];return _0x568cd6;}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';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a155_0x1500c2=a155_0x25c0;(function(_0x4691e6,_0x54f7eb){const _0x19c02f=a155_0x25c0,_0x3b28d3=_0x4691e6();while(!![]){try{const _0x4fd6f1=-parseInt(_0x19c02f(0x14f))/0x1*(parseInt(_0x19c02f(0x144))/0x2)+-parseInt(_0x19c02f(0x142))/0x3*(parseInt(_0x19c02f(0x13d))/0x4)+-parseInt(_0x19c02f(0x13c))/0x5*(parseInt(_0x19c02f(0x14b))/0x6)+-parseInt(_0x19c02f(0x14a))/0x7*(parseInt(_0x19c02f(0x154))/0x8)+parseInt(_0x19c02f(0x139))/0x9*(parseInt(_0x19c02f(0x135))/0xa)+-parseInt(_0x19c02f(0x151))/0xb*(parseInt(_0x19c02f(0x140))/0xc)+parseInt(_0x19c02f(0x155))/0xd;if(_0x4fd6f1===_0x54f7eb)break;else _0x3b28d3['push'](_0x3b28d3['shift']());}catch(_0x53d8e9){_0x3b28d3['push'](_0x3b28d3['shift']());}}}(a155_0x48a5,0x266f7));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a155_0x25c0(_0x31c187,_0x371e46){_0x31c187=_0x31c187-0x131;const _0x48a5b5=a155_0x48a5();let _0x25c0e0=_0x48a5b5[_0x31c187];return _0x25c0e0;}function a155_0x48a5(){const _0x3b6c0d=['25aGNyvf','819288HObUAf','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','totalCount','1793892IIUocF','name','3EFCUPj','description','69158qeHuFI','num','number','No\x20custom\x20SQL\x20queries\x20found.','\x20SQL\x20queries\x20(total:\x20','bool','217HfIAoo','376212TAEGrA','page','Page\x20size','map','6GcuvZu','Found\x20','11qUOEiW','string','sql','39784YYXAsD','12896689yKpXGj','Filter\x20by\x20SQL\x20name','dbId','sqlcode','pagesize','List\x20custom\x20SQL\x20queries','all','Page\x20number','70FAeVIK','length','sqlName','str','250506ydxoCZ','verbose','tableData'];a155_0x48a5=function(){return _0x3b6c0d;};return a155_0x48a5();}export const sqlList={'service':a155_0x1500c2(0x153),'command':'list','description':a155_0x1500c2(0x132),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a155_0x1500c2(0x141),'type':a155_0x1500c2(0x152),'description':a155_0x1500c2(0x156)},{'name':'page','type':a155_0x1500c2(0x146),'description':a155_0x1500c2(0x134),'default':0x1},{'name':a155_0x1500c2(0x131),'type':'number','description':a155_0x1500c2(0x14d)},{'name':a155_0x1500c2(0x13a),'type':'boolean','description':a155_0x1500c2(0x13e)}],async 'execute'(_0x4e59c6){const _0x378566=a155_0x1500c2,_0x2abc89=await listSqlQueries(_0x4e59c6['appCode'],{'sqlCode':_0x4e59c6[_0x378566(0x138)](_0x378566(0x158))||undefined,'sqlName':_0x4e59c6[_0x378566(0x138)](_0x378566(0x141))||undefined,'currentPage':_0x4e59c6[_0x378566(0x145)](_0x378566(0x14c)),'pageSize':_0x4e59c6['num']('pagesize',0x32)}),_0x5e1c05=_0x4e59c6[_0x378566(0x149)](_0x378566(0x13a)),_0x4712f6=_0x2abc89[_0x378566(0x13b)]??[],_0x31a35f=_0x2abc89['paging']?.[_0x378566(0x13f)]??_0x4712f6[_0x378566(0x136)];let _0x228dc0;return _0x5e1c05?_0x228dc0=_0x4712f6:_0x228dc0=await Promise[_0x378566(0x133)](_0x4712f6[_0x378566(0x14e)](async _0x121737=>{const _0x5378f1=_0x378566;let _0xa6d9fe;try{_0xa6d9fe=_0x121737[_0x5378f1(0x157)]?await getDbName(_0x4e59c6['appCode'],_0x121737['dbId']):undefined;}catch{}return{'sqlCode':_0x121737['sqlCode'],'sqlName':_0x121737[_0x5378f1(0x137)],'description':_0x121737[_0x5378f1(0x143)]??'','db':_0xa6d9fe?_0xa6d9fe+'\x20('+_0x121737[_0x5378f1(0x157)]+')':_0x121737[_0x5378f1(0x157)]??''};})),{'ok':!![],'data':_0x228dc0,'message':_0x4712f6[_0x378566(0x136)]===0x0?_0x378566(0x147):_0x378566(0x150)+_0x4712f6[_0x378566(0x136)]+_0x378566(0x148)+_0x31a35f+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a137_0x5ac735=a137_0x43e0;(function(_0x44c018,_0x2d0890){const _0x5e4b27=a137_0x43e0,_0x19f4a8=_0x44c018();while(!![]){try{const _0x421e34=-parseInt(_0x5e4b27(0x210))/0x1*(parseInt(_0x5e4b27(0x20e))/0x2)+-parseInt(_0x5e4b27(0x1e5))/0x3+-parseInt(_0x5e4b27(0x1f8))/0x4+-parseInt(_0x5e4b27(0x214))/0x5+-parseInt(_0x5e4b27(0x213))/0x6*(parseInt(_0x5e4b27(0x216))/0x7)+-parseInt(_0x5e4b27(0x21d))/0x8*(-parseInt(_0x5e4b27(0x21a))/0x9)+parseInt(_0x5e4b27(0x1f3))/0xa*(parseInt(_0x5e4b27(0x21c))/0xb);if(_0x421e34===_0x2d0890)break;else _0x19f4a8['push'](_0x19f4a8['shift']());}catch(_0x2c5f16){_0x19f4a8['push'](_0x19f4a8['shift']());}}}(a137_0x2aa7,0x256b2));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a137_0x2aa7(){const _0x545493=['push','boolean','tableData','nonInteractive','str','message','catch','\x20failed','sqls','\x20SQL\x20file(s)\x20into\x20','appCode','name','Would\x20pull\x20','lastSync','dbId','bool','2NlBExP','sqlCode','255763CAuJWk','conflict','filter','1788FtOMaU','726440JmpTri','test','3437fPRgWV','Pull\x20complete:\x20','skipped','description','4905kTljUd','totalCount','6987112AfPLml','3800WSDPZA','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','utf8','would_pull','unchanged','mybatisXml','path','string','toISOString','force','paging','157470vcvfix','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20written,\x20','sql','sqlName','sqlRootDir','cancelled','pull','split','local\x20differs\x20from\x20remote','No\x20remote\x20SQL\x20queries\x20matched.','Force\x20pull\x20cancelled.','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlContent','10DGUmkg','sqlRoot','length','write','apps','563768ThDGoX','trimStart','Filter\x20by\x20SQL\x20display\x20name','lockFilePath','sqlcode','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql'];a137_0x2aa7=function(){return _0x545493;};return a137_0x2aa7();}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(_0x456c30,_0x4158c5){const _0x23d724=a137_0x43e0,_0x3e38dc=[];let _0x240bdc=0x1;while(!![]){const _0x4b5e35=await listSqlQueries(_0x456c30,{'currentPage':_0x240bdc,'pageSize':PAGE_SIZE,'sqlCode':_0x4158c5['sqlCode'],'sqlName':_0x4158c5[_0x23d724(0x1e9)]}),_0x1b5d10=_0x4b5e35[_0x23d724(0x200)]??[];_0x3e38dc[_0x23d724(0x1fe)](..._0x1b5d10);if(_0x1b5d10[_0x23d724(0x1f5)]===0x0)break;const _0x4a6f8e=_0x4b5e35[_0x23d724(0x1e4)]?.[_0x23d724(0x21b)];if(_0x4a6f8e!=null?_0x3e38dc[_0x23d724(0x1f5)]>=_0x4a6f8e:_0x1b5d10[_0x23d724(0x1f5)]<PAGE_SIZE)break;_0x240bdc++;}return _0x3e38dc;}async function ensureSqlContent(_0x3ddf81){const _0x5da8d4=a137_0x43e0;if(_0x3ddf81['sqlContent']!=null&&String(_0x3ddf81[_0x5da8d4(0x1f2)])[_0x5da8d4(0x1f5)]>0x0)return _0x3ddf81;return getSqlQueryDetail(_0x3ddf81[_0x5da8d4(0x20f)]);}export const sqlPull={'service':a137_0x5ac735(0x1e8),'command':a137_0x5ac735(0x1ec),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a137_0x5ac735(0x1f6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a137_0x5ac735(0x209),'type':a137_0x5ac735(0x224),'description':a137_0x5ac735(0x1fa)},{'name':'force','type':a137_0x5ac735(0x1ff),'description':a137_0x5ac735(0x1f1)}],async 'dryRun'(_0x2db893){const _0x3c0363=a137_0x5ac735,_0x591cfb=loadSqlProjectConfig(_0x2db893['appCode']),_0x3f3f63=await readSqlLockFile(_0x591cfb[_0x3c0363(0x1fb)]),{appLock:_0x143de0}=ensureSqlLockScope(_0x3f3f63??createEmptySqlLock(),_0x591cfb[_0x3c0363(0x208)],_0x591cfb[_0x3c0363(0x1f4)],_0x3c0363(0x1ec)),_0x58ad65=await fetchAllSqlQueries(_0x2db893['appCode'],{'sqlCode':_0x2db893[_0x3c0363(0x202)](_0x3c0363(0x1fc))||undefined,'sqlName':_0x2db893[_0x3c0363(0x202)](_0x3c0363(0x209))||undefined}),_0x3f8c3f=[];for(const _0xba71ce of _0x58ad65){const _0x5c3f9d=await ensureSqlContent(_0xba71ce),_0x5a9ad6=ensureRemoteSqlContent(_0x5c3f9d),_0x39dfa0=detectModeFromSql(_0x5c3f9d),_0xe332ff=_0x5c3f9d[_0x3c0363(0x20c)]?await getDbName(_0x2db893[_0x3c0363(0x208)],Number(_0x5c3f9d[_0x3c0363(0x20c)]))[_0x3c0363(0x204)](()=>undefined):undefined,_0x2012c7=buildLocalSqlFileContent({'sqlCode':_0x5c3f9d[_0x3c0363(0x20f)],'sqlName':_0x5c3f9d[_0x3c0363(0x1e9)],'dbId':_0x5c3f9d[_0x3c0363(0x20c)]},_0x5a9ad6,{'dbName':_0xe332ff,'mode':_0x39dfa0,'syncedAt':new Date()[_0x3c0363(0x225)](),'description':_0x5c3f9d[_0x3c0363(0x219)]}),_0x37ffaf=buildSqlLockEntry(_0x5c3f9d,_0x5a9ad6,'',{'dbName':_0xe332ff}),_0x10bbfd=resolveLocalSqlFilePath(_0x591cfb,_0x5c3f9d[_0x3c0363(0x20f)],_0x37ffaf);let _0x4195bc=_0x3c0363(0x220),_0x5b24c6;if(await fileExists(_0x10bbfd)){const _0xbbe1a6=await readFile(_0x10bbfd,_0x3c0363(0x21f));isEquivalentPulledSqlFile(_0xbbe1a6,_0x2012c7,_0x39dfa0)?(_0x4195bc=_0x3c0363(0x218),_0x5b24c6=_0x3c0363(0x221)):(_0x4195bc=_0x3c0363(0x211),_0x5b24c6=_0x3c0363(0x1e6));}_0x3f8c3f[_0x3c0363(0x1fe)]({'sqlCode':_0x5c3f9d[_0x3c0363(0x20f)],'sqlName':_0x5c3f9d[_0x3c0363(0x1e9)],'filePath':_0x10bbfd,'status':_0x4195bc,'reason':_0x5b24c6});}return{'method':'POST','url':_0x3c0363(0x1fd),'body':{'appCode':_0x2db893['appCode'],'sqlCode':_0x2db893[_0x3c0363(0x202)](_0x3c0363(0x1fc))||null,'sqlName':_0x2db893[_0x3c0363(0x202)]('name')||null,'files':_0x3f8c3f},'description':_0x3c0363(0x20a)+_0x3f8c3f[_0x3c0363(0x1f5)]+_0x3c0363(0x207)+_0x591cfb[_0x3c0363(0x1ea)]};},async 'execute'(_0x377fb2){const _0x3a0fb5=a137_0x5ac735,_0x3f0a2a=loadSqlProjectConfig(_0x377fb2[_0x3a0fb5(0x208)]),_0x147ace=await readSqlLockFile(_0x3f0a2a[_0x3a0fb5(0x1fb)]),{lockData:_0x32dc58,appLock:_0x3da8f9}=ensureSqlLockScope(_0x147ace??createEmptySqlLock(),_0x3f0a2a['appCode'],_0x3f0a2a[_0x3a0fb5(0x1f4)],'pull'),_0x441494=_0x377fb2[_0x3a0fb5(0x20d)](_0x3a0fb5(0x1e3)),_0x12d9d8=await fetchAllSqlQueries(_0x377fb2[_0x3a0fb5(0x208)],{'sqlCode':_0x377fb2[_0x3a0fb5(0x202)](_0x3a0fb5(0x1fc))||undefined,'sqlName':_0x377fb2[_0x3a0fb5(0x202)](_0x3a0fb5(0x209))||undefined});if(_0x12d9d8[_0x3a0fb5(0x1f5)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3a0fb5(0x1ef)};const _0x1039ce=[],_0x3d2f93=[];for(const _0x259e72 of _0x12d9d8){try{_0x1039ce[_0x3a0fb5(0x1fe)](await ensureSqlContent(_0x259e72));}catch(_0x3b15d8){_0x3d2f93[_0x3a0fb5(0x1fe)]({'sqlCode':_0x259e72[_0x3a0fb5(0x20f)],'error':_0x3b15d8 instanceof Error?_0x3b15d8[_0x3a0fb5(0x203)]:String(_0x3b15d8)});}}if(_0x441494&&!_0x377fb2[_0x3a0fb5(0x201)]){let _0x5e5fa6=![];for(const _0x13018c of _0x1039ce){const _0x507580=detectModeFromSql(_0x13018c),_0x16acce=_0x13018c[_0x3a0fb5(0x20c)]?await getDbName(_0x377fb2['appCode'],Number(_0x13018c[_0x3a0fb5(0x20c)]))[_0x3a0fb5(0x204)](()=>undefined):undefined,_0xc3224b=buildLocalSqlFileContent({'sqlCode':_0x13018c[_0x3a0fb5(0x20f)],'sqlName':_0x13018c[_0x3a0fb5(0x1e9)],'dbId':_0x13018c[_0x3a0fb5(0x20c)]},ensureRemoteSqlContent(_0x13018c),{'dbName':_0x16acce,'mode':_0x507580,'syncedAt':new Date()['toISOString'](),'description':_0x13018c['description']}),_0x49ba53=resolveLocalSqlFilePath(_0x3f0a2a,_0x13018c['sqlCode'],buildSqlLockEntry(_0x13018c,ensureRemoteSqlContent(_0x13018c),'',{'dbName':_0x16acce}));if(await fileExists(_0x49ba53)){const _0x1b672d=await readFile(_0x49ba53,'utf8');if(!isEquivalentPulledSqlFile(_0x1b672d,_0xc3224b,_0x507580)){_0x5e5fa6=!![];break;}}}if(_0x5e5fa6){const _0x1ef041=await confirmForceOverwrite(_0x3a0fb5(0x21e));if(!_0x1ef041)throw CliErrors[_0x3a0fb5(0x1eb)](_0x3a0fb5(0x1f0));}}const _0x211132=cloneSqlLockData(_0x32dc58),_0xb24bc3=_0x211132[_0x3a0fb5(0x1f7)][_0x3f0a2a[_0x3a0fb5(0x208)]],_0x292c71=[],_0x4a5021=[];for(const _0x4216b5 of _0x1039ce){const _0x1c8d87=_0xb24bc3[_0x3a0fb5(0x206)][_0x4216b5[_0x3a0fb5(0x20f)]],_0x15f19b=ensureRemoteSqlContent(_0x4216b5),_0x30286d=detectModeFromSql(_0x4216b5),_0x5d6eb5=_0x4216b5[_0x3a0fb5(0x20c)]?await getDbName(_0x377fb2['appCode'],Number(_0x4216b5['dbId']))[_0x3a0fb5(0x204)](()=>undefined):undefined,_0x9919c5=buildLocalSqlFileContent({'sqlCode':_0x4216b5['sqlCode'],'sqlName':_0x4216b5[_0x3a0fb5(0x1e9)],'dbId':_0x4216b5[_0x3a0fb5(0x20c)]},_0x15f19b,{'dbName':_0x5d6eb5,'mode':_0x30286d,'syncedAt':new Date()[_0x3a0fb5(0x225)](),'description':_0x4216b5['description']}),_0x5d3bb9=buildSqlLockEntry(_0x4216b5,_0x15f19b,computeSqlContentHash(_0x9919c5),{'dbName':_0x5d6eb5}),_0x233bc3=_0x5d3bb9[_0x3a0fb5(0x223)],_0x33f518=join(_0x3f0a2a[_0x3a0fb5(0x1ea)],_0x233bc3);try{if(await fileExists(_0x33f518)){const _0x271979=await readFile(_0x33f518,'utf8');if(isEquivalentPulledSqlFile(_0x271979,_0x9919c5,_0x30286d)){_0x4a5021[_0x3a0fb5(0x1fe)]({'sqlCode':_0x4216b5[_0x3a0fb5(0x20f)],'reason':_0x3a0fb5(0x221)}),_0xb24bc3[_0x3a0fb5(0x206)][_0x4216b5['sqlCode']]={..._0x5d3bb9,'hash':computeSqlContentHash(_0x271979),'path':_0x233bc3};continue;}if(!_0x441494){_0x4a5021[_0x3a0fb5(0x1fe)]({'sqlCode':_0x4216b5[_0x3a0fb5(0x20f)],'reason':_0x3a0fb5(0x1ee)});continue;}}const _0x117736=_0x1c8d87?.[_0x3a0fb5(0x223)]?join(_0x3f0a2a['sqlRootDir'],_0x1c8d87[_0x3a0fb5(0x223)]):undefined;_0x117736&&_0x117736!==_0x33f518&&await fileExists(_0x117736)&&await rm(_0x117736,{'force':!![]}),await ensureParentDirectory(_0x33f518),await writeFile(_0x33f518,_0x9919c5,_0x3a0fb5(0x21f)),_0xb24bc3[_0x3a0fb5(0x206)][_0x4216b5[_0x3a0fb5(0x20f)]]={..._0x5d3bb9,'path':_0x233bc3},_0x292c71[_0x3a0fb5(0x1fe)]({'sqlCode':_0x4216b5[_0x3a0fb5(0x20f)],'filePath':_0x33f518});}catch(_0x2bd08c){_0x3d2f93[_0x3a0fb5(0x1fe)]({'sqlCode':_0x4216b5[_0x3a0fb5(0x20f)],'error':_0x2bd08c instanceof Error?_0x2bd08c[_0x3a0fb5(0x203)]:String(_0x2bd08c)});}}return _0xb24bc3[_0x3a0fb5(0x20b)]=new Date()[_0x3a0fb5(0x225)](),await writeSqlLockFile(_0x3f0a2a[_0x3a0fb5(0x1fb)],_0x211132),{'ok':_0x3d2f93['length']===0x0,'data':{'pulled':_0x292c71,'skipped':_0x4a5021,'failed':_0x3d2f93},'message':_0x3a0fb5(0x217)+_0x292c71[_0x3a0fb5(0x1f5)]+_0x3a0fb5(0x1e7)+_0x4a5021[_0x3a0fb5(0x1f5)]+'\x20skipped,\x20'+_0x3d2f93[_0x3a0fb5(0x1f5)]+_0x3a0fb5(0x205)};}};function a137_0x43e0(_0x4f093d,_0x964f0f){_0x4f093d=_0x4f093d-0x1e3;const _0x2aa7e5=a137_0x2aa7();let _0x43e088=_0x2aa7e5[_0x4f093d];return _0x43e088;}function detectModeFromSql(_0x6914c1){const _0xd56a2c=a137_0x5ac735,_0xe9d3bf=ensureRemoteSqlContent(_0x6914c1),_0x17bad1=stripLocalSqlMetadata(_0xe9d3bf,_0xd56a2c(0x222))[_0xd56a2c(0x1f9)]();if(/^<(select|insert|update|delete)\b/i[_0xd56a2c(0x215)](_0x17bad1))return _0xd56a2c(0x222);return _0xd56a2c(0x1e8);}function isEquivalentPulledSqlFile(_0x82e77b,_0x255f19,_0xeae1c0){return normalizePullComparableContent(_0x82e77b,_0xeae1c0)===normalizePullComparableContent(_0x255f19,_0xeae1c0);}function normalizePullComparableContent(_0x8950d0,_0x4e9fec){const _0xd3b64d=a137_0x5ac735,_0x56faa2=_0x8950d0['replace'](/\r\n/g,'\x0a')[_0xd3b64d(0x1ed)]('\x0a'),_0x21102c=_0x56faa2[_0xd3b64d(0x212)](_0x101a74=>!isSyncedAtMetadataLine(_0x101a74,_0x4e9fec));return _0x21102c['join']('\x0a');}function isSyncedAtMetadataLine(_0x96096c,_0x145da9){const _0x121fbd=a137_0x5ac735;if(_0x145da9==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x121fbd(0x215)](_0x96096c);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x121fbd(0x215)](_0x96096c);}
|
|
1
|
+
const a156_0x22638b=a156_0x23d2;(function(_0x2c6b69,_0x20727c){const _0x49c3fb=a156_0x23d2,_0x215a97=_0x2c6b69();while(!![]){try{const _0x208709=-parseInt(_0x49c3fb(0x144))/0x1*(-parseInt(_0x49c3fb(0x12c))/0x2)+parseInt(_0x49c3fb(0x124))/0x3*(parseInt(_0x49c3fb(0x153))/0x4)+-parseInt(_0x49c3fb(0x12a))/0x5+parseInt(_0x49c3fb(0x154))/0x6*(-parseInt(_0x49c3fb(0x137))/0x7)+parseInt(_0x49c3fb(0x134))/0x8*(-parseInt(_0x49c3fb(0x132))/0x9)+parseInt(_0x49c3fb(0x13d))/0xa*(parseInt(_0x49c3fb(0x13c))/0xb)+-parseInt(_0x49c3fb(0x138))/0xc*(-parseInt(_0x49c3fb(0x128))/0xd);if(_0x208709===_0x20727c)break;else _0x215a97['push'](_0x215a97['shift']());}catch(_0x1d0c16){_0x215a97['push'](_0x215a97['shift']());}}}(a156_0x1b54,0x6c9e2));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a156_0x1b54(){const _0xb0480c=['30643YcuTxX','boolean','message','trimStart','pull','skipped','cancelled','join','bool','sql','appCode','utf8','No\x20remote\x20SQL\x20queries\x20matched.','catch','mybatisXml','92bdRpCp','78kCkiqe','paging','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlCode','local\x20differs\x20from\x20remote','totalCount','POST','string','push','replace','sqlContent','name','toISOString','unchanged','description','length','\x20skipped,\x20','str','71751OPmmJj','path','nonInteractive','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','91TXGkTN','\x20written,\x20','3982745kFeozd','would_pull','30mLOBVq','sqlRoot','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20failed','Would\x20pull\x20','force','1105002aiQiQL','sqlRootDir','8AohNKC','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlName','457338PtXWrC','1928676MtWoHt','lockFilePath','filter','conflict','173294twxVqL','50vwbsMB','apps','sqls','test','dbId','sqlcode','lastSync'];a156_0x1b54=function(){return _0xb0480c;};return a156_0x1b54();}function a156_0x23d2(_0x2b11fc,_0x14f889){_0x2b11fc=_0x2b11fc-0x11a;const _0x1b54f7=a156_0x1b54();let _0x23d25c=_0x1b54f7[_0x2b11fc];return _0x23d25c;}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(_0x5b0585,_0x46c845){const _0x5c95d1=a156_0x23d2,_0x394647=[];let _0x329990=0x1;while(!![]){const _0x3dc9e5=await listSqlQueries(_0x5b0585,{'currentPage':_0x329990,'pageSize':PAGE_SIZE,'sqlCode':_0x46c845['sqlCode'],'sqlName':_0x46c845[_0x5c95d1(0x136)]}),_0x3662a6=_0x3dc9e5['tableData']??[];_0x394647['push'](..._0x3662a6);if(_0x3662a6[_0x5c95d1(0x121)]===0x0)break;const _0x2360c8=_0x3dc9e5[_0x5c95d1(0x155)]?.[_0x5c95d1(0x159)];if(_0x2360c8!=null?_0x394647['length']>=_0x2360c8:_0x3662a6[_0x5c95d1(0x121)]<PAGE_SIZE)break;_0x329990++;}return _0x394647;}async function ensureSqlContent(_0x501626){const _0x4259e5=a156_0x23d2;if(_0x501626[_0x4259e5(0x11c)]!=null&&String(_0x501626[_0x4259e5(0x11c)])[_0x4259e5(0x121)]>0x0)return _0x501626;return getSqlQueryDetail(_0x501626['sqlCode']);}export const sqlPull={'service':a156_0x22638b(0x14d),'command':a156_0x22638b(0x148),'description':a156_0x22638b(0x135),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a156_0x22638b(0x11d),'type':a156_0x22638b(0x15b),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a156_0x22638b(0x131),'type':a156_0x22638b(0x145),'description':a156_0x22638b(0x156)}],async 'dryRun'(_0x30fd5d){const _0xa96160=a156_0x22638b,_0x31eef7=loadSqlProjectConfig(_0x30fd5d[_0xa96160(0x14e)]),_0x323135=await readSqlLockFile(_0x31eef7[_0xa96160(0x139)]),{appLock:_0x286c6d}=ensureSqlLockScope(_0x323135??createEmptySqlLock(),_0x31eef7[_0xa96160(0x14e)],_0x31eef7[_0xa96160(0x12d)],_0xa96160(0x148)),_0x4d32fb=await fetchAllSqlQueries(_0x30fd5d['appCode'],{'sqlCode':_0x30fd5d[_0xa96160(0x123)](_0xa96160(0x142))||undefined,'sqlName':_0x30fd5d['str'](_0xa96160(0x11d))||undefined}),_0x47b136=[];for(const _0x292ccf of _0x4d32fb){const _0x4c84b3=await ensureSqlContent(_0x292ccf),_0x8c6e94=ensureRemoteSqlContent(_0x4c84b3),_0x56d873=detectModeFromSql(_0x4c84b3),_0x42fa9c=_0x4c84b3[_0xa96160(0x141)]?await getDbName(_0x30fd5d['appCode'],Number(_0x4c84b3[_0xa96160(0x141)]))[_0xa96160(0x151)](()=>undefined):undefined,_0x5b8e87=buildLocalSqlFileContent({'sqlCode':_0x4c84b3['sqlCode'],'sqlName':_0x4c84b3['sqlName'],'dbId':_0x4c84b3[_0xa96160(0x141)]},_0x8c6e94,{'dbName':_0x42fa9c,'mode':_0x56d873,'syncedAt':new Date()[_0xa96160(0x11e)](),'description':_0x4c84b3['description']}),_0x4e500c=buildSqlLockEntry(_0x4c84b3,_0x8c6e94,'',{'dbName':_0x42fa9c}),_0x3c7022=resolveLocalSqlFilePath(_0x31eef7,_0x4c84b3['sqlCode'],_0x4e500c);let _0x1a74bb=_0xa96160(0x12b),_0x570f52;if(await fileExists(_0x3c7022)){const _0x46308f=await readFile(_0x3c7022,_0xa96160(0x14f));isEquivalentPulledSqlFile(_0x46308f,_0x5b8e87,_0x56d873)?(_0x1a74bb=_0xa96160(0x149),_0x570f52='unchanged'):(_0x1a74bb=_0xa96160(0x13b),_0x570f52=_0xa96160(0x12e));}_0x47b136[_0xa96160(0x11a)]({'sqlCode':_0x4c84b3[_0xa96160(0x157)],'sqlName':_0x4c84b3[_0xa96160(0x136)],'filePath':_0x3c7022,'status':_0x1a74bb,'reason':_0x570f52});}return{'method':_0xa96160(0x15a),'url':_0xa96160(0x127),'body':{'appCode':_0x30fd5d[_0xa96160(0x14e)],'sqlCode':_0x30fd5d[_0xa96160(0x123)](_0xa96160(0x142))||null,'sqlName':_0x30fd5d['str']('name')||null,'files':_0x47b136},'description':_0xa96160(0x130)+_0x47b136['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x31eef7[_0xa96160(0x133)]};},async 'execute'(_0x237c60){const _0x247a9a=a156_0x22638b,_0x5dcfdd=loadSqlProjectConfig(_0x237c60[_0x247a9a(0x14e)]),_0x58f65b=await readSqlLockFile(_0x5dcfdd[_0x247a9a(0x139)]),{lockData:_0x4bcd06,appLock:_0x33e479}=ensureSqlLockScope(_0x58f65b??createEmptySqlLock(),_0x5dcfdd['appCode'],_0x5dcfdd['sqlRoot'],_0x247a9a(0x148)),_0x44a4a5=_0x237c60[_0x247a9a(0x14c)](_0x247a9a(0x131)),_0x384cae=await fetchAllSqlQueries(_0x237c60[_0x247a9a(0x14e)],{'sqlCode':_0x237c60[_0x247a9a(0x123)]('sqlcode')||undefined,'sqlName':_0x237c60[_0x247a9a(0x123)](_0x247a9a(0x11d))||undefined});if(_0x384cae[_0x247a9a(0x121)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x247a9a(0x150)};const _0x4a8560=[],_0x4feac5=[];for(const _0x5591c1 of _0x384cae){try{_0x4a8560[_0x247a9a(0x11a)](await ensureSqlContent(_0x5591c1));}catch(_0x633e3f){_0x4feac5[_0x247a9a(0x11a)]({'sqlCode':_0x5591c1[_0x247a9a(0x157)],'error':_0x633e3f instanceof Error?_0x633e3f[_0x247a9a(0x146)]:String(_0x633e3f)});}}if(_0x44a4a5&&!_0x237c60[_0x247a9a(0x126)]){let _0x5c4a0a=![];for(const _0x417771 of _0x4a8560){const _0x845858=detectModeFromSql(_0x417771),_0xdc3495=_0x417771['dbId']?await getDbName(_0x237c60[_0x247a9a(0x14e)],Number(_0x417771['dbId']))[_0x247a9a(0x151)](()=>undefined):undefined,_0x1775df=buildLocalSqlFileContent({'sqlCode':_0x417771[_0x247a9a(0x157)],'sqlName':_0x417771[_0x247a9a(0x136)],'dbId':_0x417771[_0x247a9a(0x141)]},ensureRemoteSqlContent(_0x417771),{'dbName':_0xdc3495,'mode':_0x845858,'syncedAt':new Date()[_0x247a9a(0x11e)](),'description':_0x417771[_0x247a9a(0x120)]}),_0x361b53=resolveLocalSqlFilePath(_0x5dcfdd,_0x417771[_0x247a9a(0x157)],buildSqlLockEntry(_0x417771,ensureRemoteSqlContent(_0x417771),'',{'dbName':_0xdc3495}));if(await fileExists(_0x361b53)){const _0x485029=await readFile(_0x361b53,_0x247a9a(0x14f));if(!isEquivalentPulledSqlFile(_0x485029,_0x1775df,_0x845858)){_0x5c4a0a=!![];break;}}}if(_0x5c4a0a){const _0x3c5374=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x3c5374)throw CliErrors[_0x247a9a(0x14a)]('Force\x20pull\x20cancelled.');}}const _0x19a134=cloneSqlLockData(_0x4bcd06),_0x75d743=_0x19a134[_0x247a9a(0x13e)][_0x5dcfdd[_0x247a9a(0x14e)]],_0x303ac2=[],_0x2b5e4f=[];for(const _0x4472f1 of _0x4a8560){const _0x171e39=_0x75d743['sqls'][_0x4472f1['sqlCode']],_0x2a491a=ensureRemoteSqlContent(_0x4472f1),_0x317a1f=detectModeFromSql(_0x4472f1),_0x1b891e=_0x4472f1[_0x247a9a(0x141)]?await getDbName(_0x237c60[_0x247a9a(0x14e)],Number(_0x4472f1['dbId']))[_0x247a9a(0x151)](()=>undefined):undefined,_0x3f736c=buildLocalSqlFileContent({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'sqlName':_0x4472f1[_0x247a9a(0x136)],'dbId':_0x4472f1[_0x247a9a(0x141)]},_0x2a491a,{'dbName':_0x1b891e,'mode':_0x317a1f,'syncedAt':new Date()[_0x247a9a(0x11e)](),'description':_0x4472f1[_0x247a9a(0x120)]}),_0x330689=buildSqlLockEntry(_0x4472f1,_0x2a491a,computeSqlContentHash(_0x3f736c),{'dbName':_0x1b891e}),_0x3413ad=_0x330689['path'],_0x2f23b9=join(_0x5dcfdd[_0x247a9a(0x133)],_0x3413ad);try{if(await fileExists(_0x2f23b9)){const _0x310424=await readFile(_0x2f23b9,_0x247a9a(0x14f));if(isEquivalentPulledSqlFile(_0x310424,_0x3f736c,_0x317a1f)){_0x2b5e4f[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'reason':_0x247a9a(0x11f)}),_0x75d743['sqls'][_0x4472f1[_0x247a9a(0x157)]]={..._0x330689,'hash':computeSqlContentHash(_0x310424),'path':_0x3413ad};continue;}if(!_0x44a4a5){_0x2b5e4f[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'reason':_0x247a9a(0x158)});continue;}}const _0x381a31=_0x171e39?.[_0x247a9a(0x125)]?join(_0x5dcfdd['sqlRootDir'],_0x171e39[_0x247a9a(0x125)]):undefined;_0x381a31&&_0x381a31!==_0x2f23b9&&await fileExists(_0x381a31)&&await rm(_0x381a31,{'force':!![]}),await ensureParentDirectory(_0x2f23b9),await writeFile(_0x2f23b9,_0x3f736c,_0x247a9a(0x14f)),_0x75d743[_0x247a9a(0x13f)][_0x4472f1['sqlCode']]={..._0x330689,'path':_0x3413ad},_0x303ac2['push']({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'filePath':_0x2f23b9});}catch(_0x552c38){_0x4feac5[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'error':_0x552c38 instanceof Error?_0x552c38['message']:String(_0x552c38)});}}return _0x75d743[_0x247a9a(0x143)]=new Date()[_0x247a9a(0x11e)](),await writeSqlLockFile(_0x5dcfdd[_0x247a9a(0x139)],_0x19a134),{'ok':_0x4feac5['length']===0x0,'data':{'pulled':_0x303ac2,'skipped':_0x2b5e4f,'failed':_0x4feac5},'message':'Pull\x20complete:\x20'+_0x303ac2[_0x247a9a(0x121)]+_0x247a9a(0x129)+_0x2b5e4f[_0x247a9a(0x121)]+_0x247a9a(0x122)+_0x4feac5[_0x247a9a(0x121)]+_0x247a9a(0x12f)};}};function detectModeFromSql(_0x414884){const _0x59a891=a156_0x22638b,_0x59540b=ensureRemoteSqlContent(_0x414884),_0x2e347e=stripLocalSqlMetadata(_0x59540b,_0x59a891(0x152))[_0x59a891(0x147)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x2e347e))return _0x59a891(0x152);return _0x59a891(0x14d);}function isEquivalentPulledSqlFile(_0x54c83e,_0x1e343c,_0x3877e1){return normalizePullComparableContent(_0x54c83e,_0x3877e1)===normalizePullComparableContent(_0x1e343c,_0x3877e1);}function normalizePullComparableContent(_0x184fb5,_0x3f6639){const _0x267f68=a156_0x22638b,_0x11899e=_0x184fb5[_0x267f68(0x11b)](/\r\n/g,'\x0a')['split']('\x0a'),_0x29b2e2=_0x11899e[_0x267f68(0x13a)](_0x3860af=>!isSyncedAtMetadataLine(_0x3860af,_0x3f6639));return _0x29b2e2[_0x267f68(0x14b)]('\x0a');}function isSyncedAtMetadataLine(_0x564200,_0x3fe7bf){const _0x88a489=a156_0x22638b;if(_0x3fe7bf==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x88a489(0x140)](_0x564200);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x88a489(0x140)](_0x564200);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a138_0x1cb83b=a138_0x21ba;(function(_0x31f658,_0x1ae7a5){const _0x59eb0f=a138_0x21ba,_0x2d447e=_0x31f658();while(!![]){try{const _0x359f35=-parseInt(_0x59eb0f(0xd8))/0x1+-parseInt(_0x59eb0f(0xf5))/0x2+parseInt(_0x59eb0f(0xf3))/0x3+parseInt(_0x59eb0f(0xef))/0x4*(parseInt(_0x59eb0f(0xfe))/0x5)+-parseInt(_0x59eb0f(0xfc))/0x6+-parseInt(_0x59eb0f(0xc1))/0x7+-parseInt(_0x59eb0f(0xe6))/0x8*(-parseInt(_0x59eb0f(0xdf))/0x9);if(_0x359f35===_0x1ae7a5)break;else _0x2d447e['push'](_0x2d447e['shift']());}catch(_0x569946){_0x2d447e['push'](_0x2d447e['shift']());}}}(a138_0x1eed,0x4a6f7));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a138_0x1eed(){const _0x4702a8=['\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','mode','dbDirectory','projectRoot','Push\x20local\x20SQL\x20files\x20to\x20remote','146010fTtbeW','path','validation','\x20SQL\x20file(s)','sqlRootDir','sqlcode','relativePath','1491795YChspd','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','appCode','\x22\x20for\x20sqlCode\x20','map','startsWith','entries','8mCLOrw','dbName','Would\x20push\x20','push','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','bool','unchanged','trashDir','sqlRoot','8816JuKLFl','catch','length','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','1643112hzNTwZ','sqls','481286uIvoxt','sqlCode','hash','filter','str','lastSync','\x20pushed,\x20','1821726McDGYI','lockFilePath','1055mXDFgN','Local\x20SQL\x20not\x20found:\x20','dbId','toISOString','filePath','1283394GcBnRn','exec','/smartapi/custom/updateUserCustomSql','set','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','POST','remoteId','has','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','boolean','join','version','sql','get','\x20skipped,\x20','sqlName','utf8','force'];a138_0x1eed=function(){return _0x4702a8;};return a138_0x1eed();}import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a138_0x21ba(_0x1b663d,_0x158bc5){_0x1b663d=_0x1b663d-0xc0;const _0x1eed54=a138_0x1eed();let _0x21bab4=_0x1eed54[_0x1b663d];return _0x21bab4;}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x5100fc,_0xb7832e,_0x5e4f44){const _0x37f0b2=a138_0x21ba,_0x196a41=await scanLocalSqlQueries(_0x5100fc),_0x449253=new Map();for(const _0x4e2090 of _0x196a41){if(_0x5e4f44&&_0x4e2090['sqlCode']!==_0x5e4f44)continue;const _0x5afbc7=_0x449253[_0x37f0b2(0xce)](_0x4e2090[_0x37f0b2(0xf6)])??[];_0x5afbc7[_0x37f0b2(0xe9)](_0x4e2090),_0x449253[_0x37f0b2(0xc4)](_0x4e2090['sqlCode'],_0x5afbc7);}if(_0x5e4f44&&!_0x449253[_0x37f0b2(0xc8)](_0x5e4f44))throw CliErrors[_0x37f0b2(0xda)](_0x37f0b2(0xff)+_0x5e4f44);const _0x155682=[];for(const [_0x37a498,_0x4131ac]of _0x449253[_0x37f0b2(0xe5)]()){if(_0x4131ac[_0x37f0b2(0xf1)]===0x1){_0x155682['push'](_0x4131ac[0x0]);continue;}const _0x4210ab=_0xb7832e[_0x37f0b2(0xf4)][_0x37a498],_0x28e0ba=_0x4210ab?.[_0x37f0b2(0xd9)],_0x462d02=_0x28e0ba?_0x4131ac[_0x37f0b2(0xf8)](_0x593f00=>_0x593f00[_0x37f0b2(0xde)]!==_0x28e0ba):_0x4131ac;if(_0x4210ab&&_0x462d02[_0x37f0b2(0xf1)]===0x1){_0x155682[_0x37f0b2(0xe9)](_0x462d02[0x0]);continue;}throw CliErrors['validation'](_0x37f0b2(0xc9)+_0x37a498+_0x37f0b2(0xf2));}return _0x155682;}export const sqlPush={'service':a138_0x1cb83b(0xcd),'command':a138_0x1cb83b(0xe9),'description':a138_0x1cb83b(0xd7),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a138_0x1cb83b(0xca),'description':a138_0x1cb83b(0xc5)}],async 'dryRun'(_0x531263){const _0x2861d7=a138_0x1cb83b,_0x34b564=loadSqlProjectConfig(_0x531263[_0x2861d7(0xe1)]),_0xe3c257=await readSqlLockFile(_0x34b564[_0x2861d7(0xfd)]),{appLock:_0x35e8db}=ensureSqlLockScope(_0xe3c257??createEmptySqlLock(),_0x531263[_0x2861d7(0xe1)],_0x34b564[_0x2861d7(0xee)],_0x2861d7(0xe9)),_0x4ee891=await getTargetSqlQueries(_0x34b564,_0x35e8db,_0x531263['str'](_0x2861d7(0xdd))||undefined),_0x1662d6=[];for(const _0x3439ba of _0x4ee891){const _0x52f1da=await computeSqlFileHash(_0x3439ba[_0x2861d7(0xc0)]),_0x3ce62f=_0x35e8db[_0x2861d7(0xf4)][_0x3439ba[_0x2861d7(0xf6)]],_0x56ef21=!!_0x3ce62f&&(_0x3ce62f[_0x2861d7(0xd9)]!==_0x3439ba[_0x2861d7(0xde)]||!!_0x3439ba[_0x2861d7(0xd0)]&&_0x3ce62f[_0x2861d7(0xd0)]!==_0x3439ba[_0x2861d7(0xd0)]);if(!_0x531263[_0x2861d7(0xeb)](_0x2861d7(0xd2))&&_0x3ce62f&&_0x3ce62f['hash']===_0x52f1da&&!_0x56ef21)continue;_0x1662d6['push'](_0x3439ba['sqlCode']);}return{'method':_0x2861d7(0xc6),'url':_0x2861d7(0xc3),'body':{'sqlCodes':_0x1662d6,'appCode':_0x531263['appCode']},'description':_0x2861d7(0xe8)+_0x1662d6[_0x2861d7(0xf1)]+_0x2861d7(0xdb)};},async 'execute'(_0x1a3690){const _0x1b6eb8=a138_0x1cb83b,_0x5f535f=loadSqlProjectConfig(_0x1a3690[_0x1b6eb8(0xe1)]),_0x2ab7fa=await readSqlLockFile(_0x5f535f[_0x1b6eb8(0xfd)]),{lockData:_0x2c345b,appLock:_0x143690}=ensureSqlLockScope(_0x2ab7fa??createEmptySqlLock(),_0x1a3690[_0x1b6eb8(0xe1)],_0x5f535f[_0x1b6eb8(0xee)],_0x1b6eb8(0xe9)),_0x305b0a=await getTargetSqlQueries(_0x5f535f,_0x143690,_0x1a3690[_0x1b6eb8(0xf9)](_0x1b6eb8(0xdd))||undefined);if(_0x305b0a[_0x1b6eb8(0xf1)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x12af47=[],_0x41fbb7=[],_0x309078=[];for(const _0x47a0b7 of _0x305b0a){const _0x3e011f=_0x143690[_0x1b6eb8(0xf4)][_0x47a0b7[_0x1b6eb8(0xf6)]];if(!_0x3e011f){_0x309078[_0x1b6eb8(0xe9)]({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'error':_0x1b6eb8(0xe0)});continue;}try{const _0x220a45=await computeSqlFileHash(_0x47a0b7[_0x1b6eb8(0xc0)]),_0x506f73=_0x3e011f['path']!==_0x47a0b7[_0x1b6eb8(0xde)]||!!_0x47a0b7[_0x1b6eb8(0xd0)]&&_0x3e011f['sqlName']!==_0x47a0b7['sqlName'];if(!_0x1a3690[_0x1b6eb8(0xeb)](_0x1b6eb8(0xd2))&&_0x3e011f[_0x1b6eb8(0xf7)]===_0x220a45&&!_0x506f73){_0x41fbb7['push']({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'reason':_0x1b6eb8(0xec)});continue;}if(_0x3e011f[_0x1b6eb8(0xcc)]==null){_0x309078[_0x1b6eb8(0xe9)]({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'error':_0x1b6eb8(0xea)});continue;}const _0x2599a9=await readFile(_0x47a0b7['filePath'],_0x1b6eb8(0xd1)),_0x134866=stripLocalSqlMetadata(_0x2599a9,_0x47a0b7['mode']),_0x316995=_0x47a0b7[_0x1b6eb8(0xd0)]||_0x3e011f['sqlName'],_0x2017f8=await resolveTargetDbBinding(_0x1a3690[_0x1b6eb8(0xe1)],_0x47a0b7,_0x3e011f),_0x160d9e=await updateSqlQuery({'id':_0x3e011f[_0x1b6eb8(0xc7)],'appCode':_0x1a3690[_0x1b6eb8(0xe1)],'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'sqlName':_0x316995,'dbId':_0x2017f8['dbId'],'version':_0x3e011f[_0x1b6eb8(0xcc)],'sqlContent':_0x134866,'sqlConfig':_0x3e011f['sqlConfig']??undefined}),_0x18bf65=_0x160d9e[_0x1b6eb8(0x100)]?await getDbName(_0x1a3690[_0x1b6eb8(0xe1)],Number(_0x160d9e['dbId']))['catch'](()=>_0x2017f8[_0x1b6eb8(0xe7)]):_0x2017f8[_0x1b6eb8(0xe7)];_0x143690[_0x1b6eb8(0xf4)][_0x47a0b7['sqlCode']]={...buildSqlLockEntry(_0x160d9e,_0x134866,_0x220a45,{'dbName':_0x18bf65}),'path':_0x47a0b7[_0x1b6eb8(0xde)],'mode':_0x3e011f[_0x1b6eb8(0xd4)]},await archivePreviousSqlFileIfNeeded(_0x5f535f,_0x3e011f[_0x1b6eb8(0xd9)],_0x47a0b7[_0x1b6eb8(0xde)]),_0x12af47['push']({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'remoteId':_0x3e011f['remoteId']});}catch(_0x4eace4){_0x309078['push']({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'error':_0x4eace4 instanceof Error?_0x4eace4['message']:String(_0x4eace4)});}}return _0x143690[_0x1b6eb8(0xfa)]=new Date()[_0x1b6eb8(0x101)](),await writeSqlLockFile(_0x5f535f[_0x1b6eb8(0xfd)],_0x2c345b),{'ok':_0x309078[_0x1b6eb8(0xf1)]===0x0,'data':{'pushed':_0x12af47,'skipped':_0x41fbb7,'failed':_0x309078},'message':'Push\x20complete:\x20'+_0x12af47[_0x1b6eb8(0xf1)]+_0x1b6eb8(0xfb)+_0x41fbb7[_0x1b6eb8(0xf1)]+_0x1b6eb8(0xcf)+_0x309078[_0x1b6eb8(0xf1)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x5d912d,_0x45b398,_0x470831){const _0x1b0fd4=a138_0x1cb83b;if(!_0x45b398||_0x45b398===_0x470831)return;const _0x26855b=join(_0x5d912d['sqlRootDir'],_0x45b398);if(!await fileExists(_0x26855b))return;const _0x43f4e4=await moveToTrash(_0x5d912d[_0x1b0fd4(0xd6)],_0x5d912d[_0x1b0fd4(0xed)],_0x26855b);await cleanupEmptyDirectories(dirname(_0x26855b),_0x5d912d[_0x1b0fd4(0xdc)]),void _0x43f4e4;}async function moveToTrash(_0x43f996,_0x3e41a4,_0x17745a){const _0x508ef3=a138_0x1cb83b,_0x5742dd=new Date()[_0x508ef3(0x101)]()['replace'](/[:.]/g,'-'),_0x593d28=relative(_0x43f996,_0x17745a),_0x58b1c8=join(_0x3e41a4,_0x5742dd,_0x593d28);return await mkdir(dirname(_0x58b1c8),{'recursive':!![]}),await rename(_0x17745a,_0x58b1c8),_0x58b1c8;}async function cleanupEmptyDirectories(_0x339f1c,_0x5e15d9){const _0x1f5bf5=a138_0x1cb83b;let _0x7bfdc0=resolve(_0x339f1c);const _0x53e1eb=resolve(_0x5e15d9);while(_0x7bfdc0[_0x1f5bf5(0xe4)](''+_0x53e1eb+sep)||_0x7bfdc0===_0x53e1eb){if(_0x7bfdc0===_0x53e1eb)return;try{const _0x2e2a2f=await readdir(_0x7bfdc0);if(_0x2e2a2f[_0x1f5bf5(0xf1)]>0x0)return;await rmdir(_0x7bfdc0);}catch{return;}_0x7bfdc0=dirname(_0x7bfdc0);}}async function resolveTargetDbBinding(_0x15853a,_0x25031d,_0x5533a5){const _0x3f21b4=a138_0x1cb83b,_0x1d550c=_0x25031d[_0x3f21b4(0xd5)];if(!_0x1d550c)return{'dbId':_0x5533a5[_0x3f21b4(0x100)],'dbName':_0x5533a5[_0x3f21b4(0xe7)]};const _0x59110e=buildDbDirectoryName(_0x5533a5[_0x3f21b4(0xe7)],_0x5533a5[_0x3f21b4(0x100)]);if(_0x1d550c===_0x59110e)return{'dbId':_0x5533a5[_0x3f21b4(0x100)],'dbName':_0x5533a5['dbName']};const _0x18db81=parseExplicitDbDirectory(_0x1d550c);if(_0x18db81!=null)return{'dbId':_0x18db81,'dbName':await getDbName(_0x15853a,_0x18db81)[_0x3f21b4(0xf0)](()=>undefined)};const _0x1f3192=await listDatabases(_0x15853a),_0x4f634a=_0x1f3192[_0x3f21b4(0xf8)](_0x28cab0=>buildDbDirectoryName(_0x28cab0['dbName'],_0x28cab0[_0x3f21b4(0x100)])===_0x1d550c);if(_0x4f634a[_0x3f21b4(0xf1)]===0x1)return{'dbId':_0x4f634a[0x0]['dbId'],'dbName':_0x4f634a[0x0][_0x3f21b4(0xe7)]};if(_0x4f634a[_0x3f21b4(0xf1)]===0x0)throw CliErrors[_0x3f21b4(0xda)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x1d550c+_0x3f21b4(0xe2)+_0x25031d['sqlCode']+'.');const _0x44269a=_0x4f634a[_0x3f21b4(0xe3)](_0x595814=>_0x595814[_0x3f21b4(0xe7)]+'\x20('+_0x595814[_0x3f21b4(0x100)]+')')[_0x3f21b4(0xcb)](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x1d550c+_0x3f21b4(0xd3)+_0x25031d[_0x3f21b4(0xf6)]+':\x20'+_0x44269a);}function parseExplicitDbDirectory(_0x4b7404){const _0x43bffd=a138_0x1cb83b,_0x54ab57=/^db-(\d+)$/[_0x43bffd(0xc2)](_0x4b7404);if(!_0x54ab57)return null;const _0x1132e6=Number(_0x54ab57[0x1]);return Number['isFinite'](_0x1132e6)&&_0x1132e6>0x0?_0x1132e6:null;}
|
|
1
|
+
function a157_0x341d(){const _0x50ca40=['entries','get','Local\x20SQL\x20not\x20found:\x20','8726630Qcdekf','\x20skipped,\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','utf8','mode','validation','sqlConfig','sql','boolean','dbDirectory','sqlcode','6TZsIRm','push','force','2294704qJkDSI','startsWith','path','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','trashDir','1223568NRqahh','\x20pushed,\x20','1532LfqNIZ','18PaOAHz','filePath','sqlName','unchanged','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','2039742iojxcz','Would\x20push\x20','hash','\x20failed','length','has','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','replace','6795vHUpyz','27021sVMXHg','No\x20local\x20SQL\x20files\x20found.','POST','sqls','lastSync','version','exec','\x22\x20for\x20sqlCode\x20','isFinite','sqlCode','dbId','bool','lockFilePath','sqlRootDir','relativePath','dbName','toISOString','127715lybpoH','str','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','appCode','catch','remoteId','filter'];a157_0x341d=function(){return _0x50ca40;};return a157_0x341d();}const a157_0x803951=a157_0x4783;(function(_0x4ca230,_0xbcf76b){const _0x2661fd=a157_0x4783,_0x4a8c91=_0x4ca230();while(!![]){try{const _0x4a8ee0=parseInt(_0x2661fd(0xef))/0x1*(parseInt(_0x2661fd(0x120))/0x2)+parseInt(_0x2661fd(0x125))/0x3+-parseInt(_0x2661fd(0x11f))/0x4*(-parseInt(_0x2661fd(0xee))/0x5)+-parseInt(_0x2661fd(0x115))/0x6*(parseInt(_0x2661fd(0x100))/0x7)+-parseInt(_0x2661fd(0x118))/0x8+parseInt(_0x2661fd(0x11d))/0x9+-parseInt(_0x2661fd(0x10a))/0xa;if(_0x4a8ee0===_0xbcf76b)break;else _0x4a8c91['push'](_0x4a8c91['shift']());}catch(_0x572fe5){_0x4a8c91['push'](_0x4a8c91['shift']());}}}(a157_0x341d,0x6218e));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a157_0x4783(_0x1f8b23,_0xcfea5b){_0x1f8b23=_0x1f8b23-0xea;const _0x341dc9=a157_0x341d();let _0x4783b9=_0x341dc9[_0x1f8b23];return _0x4783b9;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x2ec631,_0x2af120,_0x768741){const _0xd964ee=a157_0x4783,_0x197152=await scanLocalSqlQueries(_0x2ec631),_0x1a3b41=new Map();for(const _0x20b5a4 of _0x197152){if(_0x768741&&_0x20b5a4[_0xd964ee(0xf8)]!==_0x768741)continue;const _0x4665d2=_0x1a3b41[_0xd964ee(0x108)](_0x20b5a4[_0xd964ee(0xf8)])??[];_0x4665d2['push'](_0x20b5a4),_0x1a3b41['set'](_0x20b5a4[_0xd964ee(0xf8)],_0x4665d2);}if(_0x768741&&!_0x1a3b41[_0xd964ee(0xeb)](_0x768741))throw CliErrors[_0xd964ee(0x10f)](_0xd964ee(0x109)+_0x768741);const _0x26a798=[];for(const [_0x51a2e1,_0x4452d6]of _0x1a3b41[_0xd964ee(0x107)]()){if(_0x4452d6[_0xd964ee(0xea)]===0x1){_0x26a798[_0xd964ee(0x116)](_0x4452d6[0x0]);continue;}const _0x27bf27=_0x2af120[_0xd964ee(0xf2)][_0x51a2e1],_0x37845f=_0x27bf27?.[_0xd964ee(0x11a)],_0x4ce0d3=_0x37845f?_0x4452d6[_0xd964ee(0x106)](_0x3ca31c=>_0x3ca31c[_0xd964ee(0xfd)]!==_0x37845f):_0x4452d6;if(_0x27bf27&&_0x4ce0d3[_0xd964ee(0xea)]===0x1){_0x26a798[_0xd964ee(0x116)](_0x4ce0d3[0x0]);continue;}throw CliErrors[_0xd964ee(0x10f)](_0xd964ee(0x11b)+_0x51a2e1+_0xd964ee(0x102));}return _0x26a798;}export const sqlPush={'service':a157_0x803951(0x111),'command':a157_0x803951(0x116),'description':a157_0x803951(0x10c),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a157_0x803951(0x112),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x181c53){const _0x198e4f=a157_0x803951,_0x368d16=loadSqlProjectConfig(_0x181c53[_0x198e4f(0x103)]),_0x433a68=await readSqlLockFile(_0x368d16[_0x198e4f(0xfb)]),{appLock:_0x5f40ea}=ensureSqlLockScope(_0x433a68??createEmptySqlLock(),_0x181c53[_0x198e4f(0x103)],_0x368d16['sqlRoot'],_0x198e4f(0x116)),_0x28aa0f=await getTargetSqlQueries(_0x368d16,_0x5f40ea,_0x181c53[_0x198e4f(0x101)](_0x198e4f(0x114))||undefined),_0x2002c6=[];for(const _0x2a82f0 of _0x28aa0f){const _0x516143=await computeSqlFileHash(_0x2a82f0[_0x198e4f(0x121)]),_0xe1b803=_0x5f40ea[_0x198e4f(0xf2)][_0x2a82f0['sqlCode']],_0x2b5fe3=!!_0xe1b803&&(_0xe1b803['path']!==_0x2a82f0[_0x198e4f(0xfd)]||!!_0x2a82f0['sqlName']&&_0xe1b803['sqlName']!==_0x2a82f0['sqlName']);if(!_0x181c53[_0x198e4f(0xfa)](_0x198e4f(0x117))&&_0xe1b803&&_0xe1b803[_0x198e4f(0x127)]===_0x516143&&!_0x2b5fe3)continue;_0x2002c6[_0x198e4f(0x116)](_0x2a82f0[_0x198e4f(0xf8)]);}return{'method':_0x198e4f(0xf1),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x2002c6,'appCode':_0x181c53['appCode']},'description':_0x198e4f(0x126)+_0x2002c6['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x26f335){const _0x4b6a82=a157_0x803951,_0xdd62d3=loadSqlProjectConfig(_0x26f335[_0x4b6a82(0x103)]),_0x3d64ec=await readSqlLockFile(_0xdd62d3[_0x4b6a82(0xfb)]),{lockData:_0x2c707d,appLock:_0x539c86}=ensureSqlLockScope(_0x3d64ec??createEmptySqlLock(),_0x26f335['appCode'],_0xdd62d3['sqlRoot'],_0x4b6a82(0x116)),_0x2b4e8e=await getTargetSqlQueries(_0xdd62d3,_0x539c86,_0x26f335['str'](_0x4b6a82(0x114))||undefined);if(_0x2b4e8e[_0x4b6a82(0xea)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4b6a82(0xf0)};const _0x2459a0=[],_0xdc36c7=[],_0x4a3655=[];for(const _0x423c85 of _0x2b4e8e){const _0x594b25=_0x539c86['sqls'][_0x423c85[_0x4b6a82(0xf8)]];if(!_0x594b25){_0x4a3655[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x56b612=await computeSqlFileHash(_0x423c85['filePath']),_0x25a819=_0x594b25['path']!==_0x423c85[_0x4b6a82(0xfd)]||!!_0x423c85[_0x4b6a82(0x122)]&&_0x594b25[_0x4b6a82(0x122)]!==_0x423c85[_0x4b6a82(0x122)];if(!_0x26f335[_0x4b6a82(0xfa)](_0x4b6a82(0x117))&&_0x594b25[_0x4b6a82(0x127)]===_0x56b612&&!_0x25a819){_0xdc36c7[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'reason':_0x4b6a82(0x123)});continue;}if(_0x594b25[_0x4b6a82(0xf4)]==null){_0x4a3655['push']({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':_0x4b6a82(0x124)});continue;}const _0x3a9b5c=await readFile(_0x423c85[_0x4b6a82(0x121)],_0x4b6a82(0x10d)),_0x513e3=stripLocalSqlMetadata(_0x3a9b5c,_0x423c85[_0x4b6a82(0x10e)]),_0x448955=_0x423c85['sqlName']||_0x594b25[_0x4b6a82(0x122)],_0x2c0a2b=await resolveTargetDbBinding(_0x26f335['appCode'],_0x423c85,_0x594b25),_0x16165b=await updateSqlQuery({'id':_0x594b25['remoteId'],'appCode':_0x26f335[_0x4b6a82(0x103)],'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'sqlName':_0x448955,'dbId':_0x2c0a2b[_0x4b6a82(0xf9)],'version':_0x594b25[_0x4b6a82(0xf4)],'sqlContent':_0x513e3,'sqlConfig':_0x594b25[_0x4b6a82(0x110)]??undefined}),_0x5a4d3b=_0x16165b['dbId']?await getDbName(_0x26f335[_0x4b6a82(0x103)],Number(_0x16165b['dbId']))[_0x4b6a82(0x104)](()=>_0x2c0a2b[_0x4b6a82(0xfe)]):_0x2c0a2b[_0x4b6a82(0xfe)];_0x539c86[_0x4b6a82(0xf2)][_0x423c85[_0x4b6a82(0xf8)]]={...buildSqlLockEntry(_0x16165b,_0x513e3,_0x56b612,{'dbName':_0x5a4d3b}),'path':_0x423c85[_0x4b6a82(0xfd)],'mode':_0x594b25[_0x4b6a82(0x10e)]},await archivePreviousSqlFileIfNeeded(_0xdd62d3,_0x594b25[_0x4b6a82(0x11a)],_0x423c85[_0x4b6a82(0xfd)]),_0x2459a0['push']({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'remoteId':_0x594b25[_0x4b6a82(0x105)]});}catch(_0x2dc9b5){_0x4a3655[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':_0x2dc9b5 instanceof Error?_0x2dc9b5['message']:String(_0x2dc9b5)});}}return _0x539c86[_0x4b6a82(0xf3)]=new Date()[_0x4b6a82(0xff)](),await writeSqlLockFile(_0xdd62d3['lockFilePath'],_0x2c707d),{'ok':_0x4a3655[_0x4b6a82(0xea)]===0x0,'data':{'pushed':_0x2459a0,'skipped':_0xdc36c7,'failed':_0x4a3655},'message':'Push\x20complete:\x20'+_0x2459a0[_0x4b6a82(0xea)]+_0x4b6a82(0x11e)+_0xdc36c7['length']+_0x4b6a82(0x10b)+_0x4a3655[_0x4b6a82(0xea)]+_0x4b6a82(0x128)};}};async function archivePreviousSqlFileIfNeeded(_0x58c81d,_0x3f111c,_0x43ca8f){const _0x29784d=a157_0x803951;if(!_0x3f111c||_0x3f111c===_0x43ca8f)return;const _0x42f507=join(_0x58c81d[_0x29784d(0xfc)],_0x3f111c);if(!await fileExists(_0x42f507))return;const _0x40b1bb=await moveToTrash(_0x58c81d['projectRoot'],_0x58c81d[_0x29784d(0x11c)],_0x42f507);await cleanupEmptyDirectories(dirname(_0x42f507),_0x58c81d[_0x29784d(0xfc)]),void _0x40b1bb;}async function moveToTrash(_0x14c7fa,_0x36acd8,_0x3afcec){const _0x3dba6a=a157_0x803951,_0x178583=new Date()[_0x3dba6a(0xff)]()[_0x3dba6a(0xed)](/[:.]/g,'-'),_0x3a2a53=relative(_0x14c7fa,_0x3afcec),_0x52c774=join(_0x36acd8,_0x178583,_0x3a2a53);return await mkdir(dirname(_0x52c774),{'recursive':!![]}),await rename(_0x3afcec,_0x52c774),_0x52c774;}async function cleanupEmptyDirectories(_0x51de28,_0x1f95b3){const _0x1903e6=a157_0x803951;let _0x3c65ba=resolve(_0x51de28);const _0x307f0e=resolve(_0x1f95b3);while(_0x3c65ba[_0x1903e6(0x119)](''+_0x307f0e+sep)||_0x3c65ba===_0x307f0e){if(_0x3c65ba===_0x307f0e)return;try{const _0x38d96d=await readdir(_0x3c65ba);if(_0x38d96d[_0x1903e6(0xea)]>0x0)return;await rmdir(_0x3c65ba);}catch{return;}_0x3c65ba=dirname(_0x3c65ba);}}async function resolveTargetDbBinding(_0x108088,_0x10dc88,_0x2e24ce){const _0x59168e=a157_0x803951,_0xa6ca9a=_0x10dc88[_0x59168e(0x113)];if(!_0xa6ca9a)return{'dbId':_0x2e24ce[_0x59168e(0xf9)],'dbName':_0x2e24ce[_0x59168e(0xfe)]};const _0x21701e=buildDbDirectoryName(_0x2e24ce[_0x59168e(0xfe)],_0x2e24ce[_0x59168e(0xf9)]);if(_0xa6ca9a===_0x21701e)return{'dbId':_0x2e24ce[_0x59168e(0xf9)],'dbName':_0x2e24ce[_0x59168e(0xfe)]};const _0x4518c3=parseExplicitDbDirectory(_0xa6ca9a);if(_0x4518c3!=null)return{'dbId':_0x4518c3,'dbName':await getDbName(_0x108088,_0x4518c3)[_0x59168e(0x104)](()=>undefined)};const _0x2b99ea=await listDatabases(_0x108088),_0x41fb13=_0x2b99ea[_0x59168e(0x106)](_0x9973fe=>buildDbDirectoryName(_0x9973fe['dbName'],_0x9973fe['dbId'])===_0xa6ca9a);if(_0x41fb13[_0x59168e(0xea)]===0x1)return{'dbId':_0x41fb13[0x0]['dbId'],'dbName':_0x41fb13[0x0][_0x59168e(0xfe)]};if(_0x41fb13['length']===0x0)throw CliErrors[_0x59168e(0x10f)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0xa6ca9a+_0x59168e(0xf6)+_0x10dc88['sqlCode']+'.');const _0x997a07=_0x41fb13['map'](_0x9cc867=>_0x9cc867[_0x59168e(0xfe)]+'\x20('+_0x9cc867[_0x59168e(0xf9)]+')')['join'](',\x20');throw CliErrors[_0x59168e(0x10f)]('Local\x20directory\x20\x22'+_0xa6ca9a+_0x59168e(0xec)+_0x10dc88[_0x59168e(0xf8)]+':\x20'+_0x997a07);}function parseExplicitDbDirectory(_0x1df7ee){const _0x1d1006=a157_0x803951,_0x5a1e7f=/^db-(\d+)$/[_0x1d1006(0xf5)](_0x1df7ee);if(!_0x5a1e7f)return null;const _0x3f6625=Number(_0x5a1e7f[0x1]);return Number[_0x1d1006(0xf7)](_0x3f6625)&&_0x3f6625>0x0?_0x3f6625:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a158_0x29b8c8=a158_0x51e3;(function(_0x1c8e7c,_0x2ee40b){const _0x2e154d=a158_0x51e3,_0x215235=_0x1c8e7c();while(!![]){try{const _0x4b5b88=-parseInt(_0x2e154d(0xd1))/0x1+-parseInt(_0x2e154d(0xd2))/0x2*(-parseInt(_0x2e154d(0xd8))/0x3)+parseInt(_0x2e154d(0xc6))/0x4+-parseInt(_0x2e154d(0xc7))/0x5+-parseInt(_0x2e154d(0xd5))/0x6+-parseInt(_0x2e154d(0xc9))/0x7+-parseInt(_0x2e154d(0xd4))/0x8*(-parseInt(_0x2e154d(0xcc))/0x9);if(_0x4b5b88===_0x2ee40b)break;else _0x215235['push'](_0x215235['shift']());}catch(_0x42221d){_0x215235['push'](_0x215235['shift']());}}}(a158_0x340a,0x72527));function a158_0x51e3(_0x45174b,_0x1f52b0){_0x45174b=_0x45174b-0xc4;const _0x340ad5=a158_0x340a();let _0x51e30b=_0x340ad5[_0x45174b];return _0x51e30b;}function a158_0x340a(){const _0x2b1cb5=['3VJRMgz','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`.','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','2566528SOiCkt','112690mlUhdi','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','3517143CWfDDd','sql','string','11871mKFlhD','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Query\x20description','file','join','262509nEdAMn','778388SpHYNj','validation','3152kkFJOQ','1768518LhISpI','save','SQL\x20query\x20display\x20name'];a158_0x340a=function(){return _0x2b1cb5;};return a158_0x340a();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a158_0x29b8c8(0xc5),a158_0x29b8c8(0xcd),a158_0x29b8c8(0xc4)][a158_0x29b8c8(0xd0)]('\x0a');export const sqlSave={'service':a158_0x29b8c8(0xca),'command':a158_0x29b8c8(0xd6),'description':a158_0x29b8c8(0xc8),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a158_0x29b8c8(0xcf),'type':'string','required':!![],'description':'Path\x20to\x20the\x20SQL\x20file'},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':a158_0x29b8c8(0xcb),'description':a158_0x29b8c8(0xd7)},{'name':'db','type':'string','description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':'description','type':a158_0x29b8c8(0xcb),'description':a158_0x29b8c8(0xce)}],async 'validate'(){const _0x281b17=a158_0x29b8c8;throw CliErrors[_0x281b17(0xd3)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x13161b=a158_0x29b8c8;throw CliErrors[_0x13161b(0xd3)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a159_0x4abf66=a159_0x5a7e;(function(_0x1d86aa,_0x133268){const _0x48acfd=a159_0x5a7e,_0x695b09=_0x1d86aa();while(!![]){try{const _0x1ac132=-parseInt(_0x48acfd(0x150))/0x1*(-parseInt(_0x48acfd(0x13f))/0x2)+parseInt(_0x48acfd(0x13b))/0x3+-parseInt(_0x48acfd(0x145))/0x4*(-parseInt(_0x48acfd(0x159))/0x5)+-parseInt(_0x48acfd(0x13d))/0x6+-parseInt(_0x48acfd(0x14b))/0x7+parseInt(_0x48acfd(0x151))/0x8+-parseInt(_0x48acfd(0x14f))/0x9;if(_0x1ac132===_0x133268)break;else _0x695b09['push'](_0x695b09['shift']());}catch(_0x1a28f3){_0x695b09['push'](_0x695b09['shift']());}}}(a159_0x1415,0x531e5));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a159_0x1415(){const _0x5a79ef=['2vLbLsB','4702368fznImD','dbId','sqlCode','version','.rabetbase/sql','includes','dbName','--\x20@lovrabet.','5OCjtpu','mode','fromEntries','yes','stderr','endsWith','question','path','toLowerCase','map','1465992KGvwyn','sqlName','2244474zhndsz','trimStart','358448OCLgIi','<!--\x20@lovrabet.','length','sqls','stdin','split','594952ubYGEy','push','entries','apps','trim','syncedAt','709982lVKBOj','mybatisXml','filter','test','6909192ggrEJR'];a159_0x1415=function(){return _0x5a79ef;};return a159_0x1415();}export const SQL_LOCAL_REL_DIR=a159_0x4abf66(0x155);export function buildSqlLockEntry(_0x5d94e,_0x58df8f,_0x217ef9,_0x47de4){const _0x521569=a159_0x4abf66,_0x308ebb=detectSqlMode(_0x58df8f);return{'path':buildSqlRelativePath(_0x5d94e[_0x521569(0x153)],_0x5d94e[_0x521569(0x13c)],_0x47de4?.[_0x521569(0x157)],_0x308ebb,_0x5d94e[_0x521569(0x152)]),'hash':_0x217ef9,'remoteId':_0x5d94e['id'],'version':_0x5d94e[_0x521569(0x154)],'dbId':Number(_0x5d94e['dbId']),'dbName':_0x47de4?.[_0x521569(0x157)],'sqlName':_0x5d94e[_0x521569(0x13c)],'sqlConfig':_0x5d94e['sqlConfig']??undefined,'mode':_0x308ebb};}export function cloneSqlLockData(_0x2749d1){const _0x22d44d=a159_0x4abf66;return{'apps':Object[_0x22d44d(0x15b)](Object[_0x22d44d(0x147)](_0x2749d1['apps'])[_0x22d44d(0x13a)](([_0x108502,_0x24d1dd])=>[_0x108502,{'sqlRoot':_0x24d1dd['sqlRoot'],'lastSync':_0x24d1dd['lastSync'],'sqls':{..._0x24d1dd[_0x22d44d(0x142)]}}]))};}export function ensureRemoteSqlContent(_0x12b9cc){return _0x12b9cc['sqlContent']??'';}export function buildLocalSqlFileContent(_0x3f990e,_0x31cd63,_0x3785e9){const _0x2d738a=a159_0x4abf66,_0x26d9b3=_0x3785e9?.[_0x2d738a(0x15a)]??detectSqlMode(_0x31cd63),_0xd38e9=stripLocalSqlMetadata(_0x31cd63,_0x26d9b3)[_0x2d738a(0x149)](),_0x326200=[...buildMetadataHeaderLines({'sqlCode':_0x3f990e['sqlCode'],'sqlName':_0x3f990e['sqlName'],'dbId':_0x3f990e[_0x2d738a(0x152)],'dbName':_0x3785e9?.['dbName'],'mode':_0x26d9b3,'syncedAt':_0x3785e9?.[_0x2d738a(0x14a)],'description':_0x3785e9?.['description']},_0x26d9b3),'',_0xd38e9],_0x698e94=_0x326200['join']('\x0a');return _0x698e94[_0x2d738a(0x136)]('\x0a')?_0x698e94:_0x698e94+'\x0a';}export function stripLocalSqlMetadata(_0x1b760b,_0x374483){const _0x57f49b=a159_0x4abf66,_0x241d47=_0x1b760b['replace'](/\r\n/g,'\x0a')[_0x57f49b(0x144)]('\x0a'),_0x1f2ce2=[];let _0x79ede4=0x0;if(_0x374483===_0x57f49b(0x14c))while(_0x79ede4<_0x241d47[_0x57f49b(0x141)]){const _0x17d8a2=_0x241d47[_0x79ede4]??'';if(/^\s*<!--\s*@lovrabet\./[_0x57f49b(0x14e)](_0x17d8a2)){_0x79ede4++;continue;}if(_0x17d8a2[_0x57f49b(0x149)]()===''&&_0x79ede4>0x0){_0x79ede4++;continue;}break;}else while(_0x79ede4<_0x241d47[_0x57f49b(0x141)]){const _0x405b9c=_0x241d47[_0x79ede4]??'';if(/^\s*--\s*@lovrabet\./[_0x57f49b(0x14e)](_0x405b9c)){_0x79ede4++;continue;}if(_0x405b9c['trim']()===''&&_0x79ede4>0x0){_0x79ede4++;continue;}break;}for(;_0x79ede4<_0x241d47[_0x57f49b(0x141)];_0x79ede4++){_0x1f2ce2[_0x57f49b(0x146)](_0x241d47[_0x79ede4]);}return _0x1f2ce2['join']('\x0a')[_0x57f49b(0x13e)]();}export function resolveSqlMode(_0x5a3b50,_0x4aa0ed){const _0x5cd978=a159_0x4abf66;if(_0x4aa0ed?.[_0x5cd978(0x15a)])return _0x4aa0ed['mode'];return detectSqlMode(_0x5a3b50);}export function resolveSqlFileName(_0x55f353,_0x210e2f,_0x48fdbf){const _0x5e07c=a159_0x4abf66;if(_0x48fdbf?.['path'])return _0x48fdbf[_0x5e07c(0x138)];if(_0x48fdbf?.[_0x5e07c(0x13c)]||_0x48fdbf?.[_0x5e07c(0x157)])return buildSqlRelativePath(_0x55f353,_0x48fdbf?.['sqlName'],_0x48fdbf?.[_0x5e07c(0x157)],resolveSqlMode(_0x210e2f,_0x48fdbf),_0x48fdbf?.['dbId']);return buildDefaultSqlFileName(_0x55f353,resolveSqlMode(_0x210e2f,_0x48fdbf));}export function resolveSqlLocalDir(_0x187487,_0x2ad943){return join(_0x187487,SQL_LOCAL_REL_DIR,_0x2ad943);}export async function confirmForceOverwrite(_0x50ce1c){const _0x1158f5=a159_0x4abf66,_0x1c3c19=createInterface({'input':process[_0x1158f5(0x143)],'output':process[_0x1158f5(0x15d)]}),_0x1b672d=await new Promise(_0x5b8c62=>{const _0x22e466=_0x1158f5;_0x1c3c19[_0x22e466(0x137)](_0x50ce1c+'\x20[y/N]\x20',_0x5b8c62);});return _0x1c3c19['close'](),['y',_0x1158f5(0x15c)][_0x1158f5(0x156)](_0x1b672d[_0x1158f5(0x149)]()[_0x1158f5(0x139)]());}export function findSqlLockScope(_0x356516,_0x538452){const _0x6b0923=a159_0x4abf66;return _0x356516[_0x6b0923(0x148)][_0x538452];}function a159_0x5a7e(_0x303b2b,_0x5a16fb){_0x303b2b=_0x303b2b-0x136;const _0x1415f3=a159_0x1415();let _0x5a7e49=_0x1415f3[_0x303b2b];return _0x5a7e49;}function buildMetadataHeaderLines(_0x2e8fb2,_0x1b2d18){const _0x355c51=a159_0x4abf66,_0x40cbe2=[[_0x355c51(0x153),_0x2e8fb2['sqlCode']],[_0x355c51(0x13c),_0x2e8fb2['sqlName']],['dbId',_0x2e8fb2[_0x355c51(0x152)]],['dbName',_0x2e8fb2[_0x355c51(0x157)]],[_0x355c51(0x15a),_0x2e8fb2['mode']],['syncedAt',_0x2e8fb2['syncedAt']],['description',_0x2e8fb2['description']]];if(_0x1b2d18===_0x355c51(0x14c))return _0x40cbe2[_0x355c51(0x14d)](([,_0x16dd2c])=>_0x16dd2c!==undefined&&_0x16dd2c!==null&&String(_0x16dd2c)[_0x355c51(0x149)]()!=='')[_0x355c51(0x13a)](([_0x5b8c64,_0x4edfe7])=>_0x355c51(0x140)+_0x5b8c64+':\x20'+String(_0x4edfe7)+'\x20-->');return _0x40cbe2[_0x355c51(0x14d)](([,_0x2271fd])=>_0x2271fd!==undefined&&_0x2271fd!==null&&String(_0x2271fd)[_0x355c51(0x149)]()!=='')[_0x355c51(0x13a)](([_0x5d7011,_0x3f1040])=>_0x355c51(0x158)+_0x5d7011+':\x20'+String(_0x3f1040));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a160_0x3ae450=a160_0x61e0;(function(_0x3db269,_0x2fac97){const _0x235640=a160_0x61e0,_0x45ab8d=_0x3db269();while(!![]){try{const _0x36f1dd=parseInt(_0x235640(0x127))/0x1*(parseInt(_0x235640(0x132))/0x2)+parseInt(_0x235640(0x125))/0x3+parseInt(_0x235640(0x120))/0x4*(parseInt(_0x235640(0x133))/0x5)+parseInt(_0x235640(0x12a))/0x6+-parseInt(_0x235640(0x12c))/0x7*(-parseInt(_0x235640(0x128))/0x8)+parseInt(_0x235640(0x11e))/0x9+parseInt(_0x235640(0x131))/0xa*(-parseInt(_0x235640(0x135))/0xb);if(_0x36f1dd===_0x2fac97)break;else _0x45ab8d['push'](_0x45ab8d['shift']());}catch(_0x179f28){_0x45ab8d['push'](_0x45ab8d['shift']());}}}(a160_0x39f5,0xbe962));function a160_0x39f5(){const _0x4e11b1=['All\x20SQL\x20queries\x20are\x20in\x20sync.','lockKey','\x20missing,\x20','sql','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','sqls','lockFilePath','hash','13192263QSRTEf','length','9260bxUuso','status','sqlCode','sqlName','sqlRoot','3475035hNMQUB','appCode','4SPQkrc','5338120ssenxk','filePath','6155526BkWTbq','has','14aQlCCv','\x20remote-only','path','tableData','\x20added,\x20','4116470IimsIY','60218QmwfJN','440XfIxDa','remote','121EeaDwT','totalCount','map','keys','bool','\x20modified,\x20','read','push'];a160_0x39f5=function(){return _0x4e11b1;};return a160_0x39f5();}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x2548ee){const _0x51e4cf=a160_0x61e0,_0x50ea69=[];let _0x232e4e=0x1;while(!![]){const _0x446f5c=await listSqlQueries(_0x2548ee,{'currentPage':_0x232e4e,'pageSize':PAGE_SIZE}),_0x49f5af=_0x446f5c[_0x51e4cf(0x12f)]??[];_0x50ea69[_0x51e4cf(0x13c)](..._0x49f5af[_0x51e4cf(0x137)](_0x8ce6bb=>_0x8ce6bb[_0x51e4cf(0x122)]));if(_0x49f5af[_0x51e4cf(0x11f)]===0x0)break;const _0x300625=_0x446f5c['paging']?.[_0x51e4cf(0x136)];if(_0x300625!=null?_0x50ea69['length']>=_0x300625:_0x49f5af[_0x51e4cf(0x11f)]<PAGE_SIZE)break;_0x232e4e++;}return _0x50ea69;}function a160_0x61e0(_0x171fa8,_0x282d45){_0x171fa8=_0x171fa8-0x117;const _0x39f54f=a160_0x39f5();let _0x61e043=_0x39f54f[_0x171fa8];return _0x61e043;}export const sqlStatus={'service':a160_0x3ae450(0x119),'command':a160_0x3ae450(0x121),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a160_0x3ae450(0x13b),'flags':[{'name':'remote','type':'boolean','description':a160_0x3ae450(0x11a)}],async 'execute'(_0x596d3f){const _0x320115=a160_0x3ae450,_0x3868ea=loadSqlProjectConfig(_0x596d3f['appCode']),_0x396340=await readSqlLockFile(_0x3868ea[_0x320115(0x11c)]),{appLock:_0x5cf9fa}=ensureSqlLockScope(_0x396340??createEmptySqlLock(),_0x3868ea[_0x320115(0x126)],_0x3868ea[_0x320115(0x124)],_0x320115(0x121)),_0x24dd56=await scanLocalSqlQueries(_0x3868ea),_0x1ca2f1=[],_0x42bb39=[],_0x58b4ab=[],_0x51347e=[],_0x2de57c=new Set(_0x24dd56[_0x320115(0x137)](_0x207d15=>_0x207d15[_0x320115(0x117)]));for(const _0x553eb7 of _0x24dd56){const _0x17a556=await computeSqlFileHash(_0x553eb7[_0x320115(0x129)]),_0x593566=_0x5cf9fa['sqls'][_0x553eb7[_0x320115(0x117)]],_0x3dc856=!!_0x593566&&_0x593566[_0x320115(0x12e)]!==_0x553eb7['relativePath'],_0x223333=!!_0x593566&&!!_0x553eb7[_0x320115(0x123)]&&_0x593566[_0x320115(0x123)]!==_0x553eb7['sqlName'];if(!_0x593566)_0x1ca2f1[_0x320115(0x13c)](_0x553eb7[_0x320115(0x117)]);else _0x593566[_0x320115(0x11d)]!==_0x17a556||_0x3dc856||_0x223333?_0x42bb39[_0x320115(0x13c)](_0x553eb7[_0x320115(0x117)]):_0x58b4ab[_0x320115(0x13c)](_0x553eb7['lockKey']);}for(const _0x4e3f5a of Object[_0x320115(0x138)](_0x5cf9fa['sqls'])){!_0x2de57c[_0x320115(0x12b)](_0x4e3f5a)&&_0x51347e[_0x320115(0x13c)](_0x4e3f5a);}const _0x2da76e=[];if(_0x596d3f[_0x320115(0x139)](_0x320115(0x134))){const _0x44f97a=await fetchAllSqlCodes(_0x596d3f['appCode']);for(const _0x2769f8 of _0x44f97a){!_0x2de57c['has'](_0x2769f8)&&!_0x5cf9fa[_0x320115(0x11b)][_0x2769f8]&&_0x2da76e[_0x320115(0x13c)](_0x2769f8);}}const _0x28c562=_0x1ca2f1['length']===0x0&&_0x42bb39[_0x320115(0x11f)]===0x0&&_0x51347e[_0x320115(0x11f)]===0x0&&_0x2da76e['length']===0x0;return{'ok':!![],'data':{'added':_0x1ca2f1,'modified':_0x42bb39,'missing':_0x51347e,'unchanged':_0x58b4ab,'remoteOnly':_0x2da76e},'message':_0x28c562?_0x320115(0x13d):_0x1ca2f1['length']+_0x320115(0x130)+_0x42bb39['length']+_0x320115(0x13a)+_0x51347e['length']+_0x320115(0x118)+_0x58b4ab[_0x320115(0x11f)]+'\x20unchanged'+(_0x2da76e[_0x320115(0x11f)]>0x0?',\x20'+_0x2da76e['length']+_0x320115(0x12d):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x5706ea=a161_0x28dc;(function(_0x3529fa,_0x1c08f7){const _0xdd56=a161_0x28dc,_0x573057=_0x3529fa();while(!![]){try{const _0x49a3ae=-parseInt(_0xdd56(0x13c))/0x1*(parseInt(_0xdd56(0x151))/0x2)+-parseInt(_0xdd56(0x14a))/0x3*(parseInt(_0xdd56(0x127))/0x4)+parseInt(_0xdd56(0x12d))/0x5*(-parseInt(_0xdd56(0x154))/0x6)+-parseInt(_0xdd56(0x139))/0x7*(-parseInt(_0xdd56(0x138))/0x8)+parseInt(_0xdd56(0x147))/0x9+-parseInt(_0xdd56(0x145))/0xa+parseInt(_0xdd56(0x146))/0xb;if(_0x49a3ae===_0x1c08f7)break;else _0x573057['push'](_0x573057['shift']());}catch(_0x58d5c1){_0x573057['push'](_0x573057['shift']());}}}(a161_0x2d6a,0x9d137));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a161_0x28dc(_0x353c08,_0x30528b){_0x353c08=_0x353c08-0x125;const _0x2d6a6b=a161_0x2d6a();let _0x28dc5f=_0x2d6a6b[_0x353c08];return _0x28dc5f;}function a161_0x2d6a(){const _0x1b3a20=['3255776WGpuZg','14cBLiVj','message','fields','1ZFjWrH','name','get','isArray','file','\x22\x20not\x20found\x20in\x20any\x20dataset','trim','reason','map','4616510plDnnI','18030848VizcIU','1789623fuSlNd','toLowerCase','parameters','3JXkKzL','type','isSelectOnly','size','Table\x20\x22','SQL\x20schema\x20validation','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','1096890XTCjwJ','split','filter','6CnGJRk','sql','tableName','length','validation','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','Dataset\x20\x22','Provide\x20--file\x20or\x20--sql','sqlType','1108020WTMZWS','dbtableConfig','str','utf-8','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','schemas','3607375FVzbbn','isDangerous','valid','validate','tables','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','cwd','string','File\x20not\x20found:\x20','push','flagMissing'];a161_0x2d6a=function(){return _0x1b3a20;};return a161_0x2d6a();}import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':'sql','command':a161_0x5706ea(0x130),'description':a161_0x5706ea(0x132),'risk':'read','flags':[{'name':'file','type':a161_0x5706ea(0x134),'description':a161_0x5706ea(0x150)},{'name':a161_0x5706ea(0x155),'type':a161_0x5706ea(0x134),'description':a161_0x5706ea(0x159)},{'name':a161_0x5706ea(0x12c),'type':a161_0x5706ea(0x134),'description':a161_0x5706ea(0x12b)}],async 'execute'(_0x257505){const _0x5d6675=a161_0x5706ea,_0x2c2ebf=_0x257505[_0x5d6675(0x129)](_0x5d6675(0x140)),_0x40ac38=_0x257505[_0x5d6675(0x129)](_0x5d6675(0x155));if(!_0x2c2ebf&&!_0x40ac38)throw CliErrors[_0x5d6675(0x137)](_0x5d6675(0x140),_0x5d6675(0x125));let _0x269b49;if(_0x2c2ebf){const _0xe00785=resolve(process[_0x5d6675(0x133)](),_0x2c2ebf);if(!existsSync(_0xe00785))throw CliErrors[_0x5d6675(0x158)](_0x5d6675(0x135)+_0xe00785);_0x269b49=readFileSync(_0xe00785,_0x5d6675(0x12a));}else _0x269b49=_0x40ac38;const _0x548d03=validateSql(_0x269b49),_0x2b092e={'valid':_0x548d03[_0x5d6675(0x12f)],'sqlType':_0x548d03[_0x5d6675(0x126)][_0x5d6675(0x14b)],'isSelectOnly':_0x548d03['sqlType'][_0x5d6675(0x14c)],'isDangerous':_0x548d03[_0x5d6675(0x126)][_0x5d6675(0x12e)],'tables':_0x548d03[_0x5d6675(0x131)],'parameters':_0x548d03[_0x5d6675(0x149)],'message':_0x548d03[_0x5d6675(0x13a)]};_0x548d03[_0x5d6675(0x126)][_0x5d6675(0x143)]&&(_0x2b092e['reason']=_0x548d03[_0x5d6675(0x126)][_0x5d6675(0x143)]);const _0x304b90=_0x257505[_0x5d6675(0x129)](_0x5d6675(0x12c));if(_0x304b90&&_0x548d03[_0x5d6675(0x12f)]){const _0x4fc490=_0x304b90[_0x5d6675(0x152)](',')[_0x5d6675(0x144)](_0x5ce2e7=>_0x5ce2e7[_0x5d6675(0x142)]())[_0x5d6675(0x153)](Boolean),_0x156db9=[],_0x340b77=filterDbTableBackedDatasets(await listDatasets(_0x257505['appCode'])),_0x1f87d4=new Map(_0x340b77[_0x5d6675(0x144)](_0x11f7ad=>[_0x11f7ad[_0x5d6675(0x128)]?.[_0x5d6675(0x156)]?.[_0x5d6675(0x148)](),_0x11f7ad]));for(const _0x2324f8 of _0x548d03[_0x5d6675(0x131)]){const _0x5853c3=_0x1f87d4[_0x5d6675(0x13e)](_0x2324f8[_0x5d6675(0x148)]());!_0x5853c3&&_0x156db9[_0x5d6675(0x136)](_0x5d6675(0x14e)+_0x2324f8+_0x5d6675(0x141));}for(const _0x4c0a42 of _0x4fc490){let _0x4cc21a;try{_0x4cc21a=await getDatasetDetail(_0x4c0a42);}catch{_0x156db9[_0x5d6675(0x136)](_0x5d6675(0x15a)+_0x4c0a42+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x4cc21a,_0x5d6675(0x14f));const _0x15f03a=Array[_0x5d6675(0x13f)](_0x4cc21a[_0x5d6675(0x13b)])?_0x4cc21a['fields']:[],_0x3d5fab=new Set(_0x15f03a[_0x5d6675(0x144)](_0x255ee3=>_0x255ee3[_0x5d6675(0x13d)]?.[_0x5d6675(0x148)]())),_0x210d69=_0x4cc21a[_0x5d6675(0x128)]?.[_0x5d6675(0x156)]||_0x4cc21a['tableName']||_0x4c0a42;_0x2b092e['schema:'+_0x210d69]={'code':_0x4c0a42,'tableName':_0x210d69,'fieldCount':_0x3d5fab[_0x5d6675(0x14d)],'fields':Array['from'](_0x3d5fab)};}_0x156db9[_0x5d6675(0x157)]>0x0&&(_0x2b092e['schemaWarnings']=_0x156db9);}return{'ok':_0x548d03[_0x5d6675(0x12f)],'data':_0x2b092e,'message':_0x548d03[_0x5d6675(0x13a)]};}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a162_0x3fc27c=a162_0x3aef;(function(_0x3459ec,_0x52c765){const _0x1c45a1=a162_0x3aef,_0x41070=_0x3459ec();while(!![]){try{const _0x306f18=-parseInt(_0x1c45a1(0xf2))/0x1+parseInt(_0x1c45a1(0x100))/0x2*(-parseInt(_0x1c45a1(0xff))/0x3)+parseInt(_0x1c45a1(0xf3))/0x4*(parseInt(_0x1c45a1(0xf0))/0x5)+parseInt(_0x1c45a1(0xf5))/0x6+-parseInt(_0x1c45a1(0xfc))/0x7*(-parseInt(_0x1c45a1(0xf6))/0x8)+-parseInt(_0x1c45a1(0xfe))/0x9*(parseInt(_0x1c45a1(0xfa))/0xa)+parseInt(_0x1c45a1(0xf7))/0xb*(parseInt(_0x1c45a1(0xf8))/0xc);if(_0x306f18===_0x52c765)break;else _0x41070['push'](_0x41070['shift']());}catch(_0x12afd9){_0x41070['push'](_0x41070['shift']());}}}(a162_0x5e4f,0x8771d));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a162_0x3fc27c(0xf9),'command':a162_0x3fc27c(0xf4),'description':a162_0x3fc27c(0x101),'risk':a162_0x3fc27c(0xfd),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a162_0x3fc27c(0xfb),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x4c8cbc=>validateAppName(_0x4c8cbc,a162_0x3fc27c(0xf1)),'execute':_0x14733c=>runAppAdd(_0x14733c,a162_0x3fc27c(0xf1))};function a162_0x3aef(_0x43aa3b,_0x2a09cf){_0x43aa3b=_0x43aa3b-0xf0;const _0x5e4fe3=a162_0x5e4f();let _0x3aef09=_0x5e4fe3[_0x43aa3b];return _0x3aef09;}function a162_0x5e4f(){const _0x774d6c=['32635aEILoh','workspace\x20add','1001001QJOiaI','4KaiQek','add','5752698dacPRb','1784kKZfVK','1956680MATSct','48cTaYaE','workspace','2710AsunQM','App\x20profile\x20name','32179JiUATs','write','26388ANvBTi','1054821hjEQqK','2uVROGu','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)'];a162_0x5e4f=function(){return _0x774d6c;};return a162_0x5e4f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a163_0x40e528=a163_0x5e25;(function(_0x402a2c,_0x35a91a){const _0x296414=a163_0x5e25,_0x14ce42=_0x402a2c();while(!![]){try{const _0x5e6b93=parseInt(_0x296414(0x15c))/0x1+parseInt(_0x296414(0x15d))/0x2+-parseInt(_0x296414(0x139))/0x3+parseInt(_0x296414(0x16c))/0x4*(parseInt(_0x296414(0x145))/0x5)+-parseInt(_0x296414(0x137))/0x6*(-parseInt(_0x296414(0x153))/0x7)+parseInt(_0x296414(0x168))/0x8*(parseInt(_0x296414(0x13b))/0x9)+-parseInt(_0x296414(0x149))/0xa;if(_0x5e6b93===_0x35a91a)break;else _0x14ce42['push'](_0x14ce42['shift']());}catch(_0x9f2da7){_0x14ce42['push'](_0x14ce42['shift']());}}}(a163_0x3683,0x2ad0c));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a163_0x40e528(0x142),SAFE_PROFILE_KEYS=[a163_0x40e528(0x138),a163_0x40e528(0x140),'apiDir',a163_0x40e528(0x16a),'pageSize',a163_0x40e528(0x14c),a163_0x40e528(0x152)],workspaceFlags=[{'name':a163_0x40e528(0x15b),'type':a163_0x40e528(0x150),'description':a163_0x40e528(0x13a)},{'name':a163_0x40e528(0x138),'type':a163_0x40e528(0x150),'description':a163_0x40e528(0x15f)},{'name':'env','type':'string','description':a163_0x40e528(0x158),'enum':[...RABETBASE_ENV_VALUES]},{'name':a163_0x40e528(0x14b),'type':a163_0x40e528(0x150),'description':a163_0x40e528(0x15a)},{'name':a163_0x40e528(0x14f),'type':a163_0x40e528(0x150),'description':'Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a163_0x40e528(0x156),'type':a163_0x40e528(0x169),'description':a163_0x40e528(0x14e)},{'name':a163_0x40e528(0x14c),'type':a163_0x40e528(0x150),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':a163_0x40e528(0x152),'type':a163_0x40e528(0x150),'description':a163_0x40e528(0x167)}];function isRecord(_0x4a4fb3){const _0x1180b6=a163_0x40e528;return!!_0x4a4fb3&&typeof _0x4a4fb3===_0x1180b6(0x159)&&!Array[_0x1180b6(0x161)](_0x4a4fb3);}function assertValidAppcode(_0x31c6dd){const _0x55a471=a163_0x40e528,{valid:_0x39afb8,message:_0x286756}=validateAppcode(_0x31c6dd);if(!_0x39afb8)throw CliErrors[_0x55a471(0x170)](_0x55a471(0x164)+_0x31c6dd,_0x286756);}function a163_0x5e25(_0x2b2494,_0xb45583){_0x2b2494=_0x2b2494-0x137;const _0x3683ce=a163_0x3683();let _0x5e25cf=_0x3683ce[_0x2b2494];return _0x5e25cf;}function sanitizeProfile(_0x26c3a6){if(!isRecord(_0x26c3a6))return{};const _0xed454f={};for(const _0x2a5ec9 of SAFE_PROFILE_KEYS){if(_0x26c3a6[_0x2a5ec9]!==undefined)_0xed454f[_0x2a5ec9]=_0x26c3a6[_0x2a5ec9];}return _0xed454f;}function cloneProfile(_0x3c2de6){return isRecord(_0x3c2de6)?{..._0x3c2de6}:{};}function collectWorkspaceProfileOverrides(_0x494224){const _0xe587c=a163_0x40e528,_0x4bea8b={},_0x56ea0f=_0x494224[_0xe587c(0x154)]('env'),_0x2a2404=_0x494224['str'](_0xe587c(0x14b)),_0x33ceac=_0x494224[_0xe587c(0x154)](_0xe587c(0x14f)),_0x4d5e04=_0x494224['flag'](_0xe587c(0x156)),_0x1bf359=_0x494224[_0xe587c(0x154)](_0xe587c(0x14c)),_0x1a788a=_0x494224[_0xe587c(0x154)](_0xe587c(0x152));if(_0x56ea0f)_0x4bea8b[_0xe587c(0x140)]=_0x56ea0f;if(_0x2a2404)_0x4bea8b[_0xe587c(0x14b)]=_0x2a2404;if(_0x33ceac)_0x4bea8b[_0xe587c(0x16a)]=_0x33ceac;if(_0x4d5e04!==undefined&&_0x4d5e04!=='')_0x4bea8b['pageSize']=Number(_0x4d5e04);if(_0x1bf359)_0x4bea8b[_0xe587c(0x14c)]=_0x1bf359;if(_0x1a788a)_0x4bea8b['locale']=_0x1a788a;return _0x4bea8b;}async function validateWorkspaceArgs(_0x121d58){const _0x4998ec=a163_0x40e528,_0x5337f5=_0x121d58['str'](_0x4998ec(0x15b))['trim'](),_0x15e3b3=_0x121d58[_0x4998ec(0x154)](_0x4998ec(0x138))[_0x4998ec(0x151)]();if(!_0x5337f5&&!_0x15e3b3)throw CliErrors[_0x4998ec(0x170)]('Missing\x20workspace\x20app\x20selector.',_0x4998ec(0x166)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x15e3b3)assertValidAppcode(_0x15e3b3);}function resolveKnownApps(){const _0x3f8ba0=a163_0x40e528,{config:_0x3b3c43,layers:_0x5093de}=readRawConfigWithLayers(),_0xe1ccdf=isRecord(_0x3b3c43[_0x3f8ba0(0x13d)])?_0x3b3c43[_0x3f8ba0(0x13d)]:{},_0x269a65=isRecord(_0x5093de[_0x3f8ba0(0x165)][_0x3f8ba0(0x13d)])?_0x5093de[_0x3f8ba0(0x165)][_0x3f8ba0(0x13d)]:{};return{..._0x269a65,..._0xe1ccdf};}async function configureWorkspace(_0x5474f6,_0x4d3b8b){const _0x549582=a163_0x40e528,_0x2c135d=_0x5474f6[_0x549582(0x154)]('app')[_0x549582(0x151)](),_0x3b3a8d=_0x5474f6[_0x549582(0x154)](_0x549582(0x138))[_0x549582(0x151)](),_0x19859a=_0x2c135d||_0x3b3a8d;if(!_0x19859a)throw CliErrors[_0x549582(0x170)]('Missing\x20workspace\x20app\x20selector.','Use\x20`'+CLI_BIN_NAME+_0x549582(0x13c)+CLI_BIN_NAME+_0x549582(0x146));if(_0x3b3a8d)assertValidAppcode(_0x3b3a8d);const _0x426a47=resolveWriteConfigPath('project'),_0x173836=readConfigFile(_0x426a47),_0x2475bb=resolveKnownApps(),_0x1b73fe=isRecord(_0x173836['apps'])?{..._0x173836[_0x549582(0x13d)]}:{},_0x7e58a3=cloneProfile(_0x1b73fe[_0x19859a]),_0x5cf62b=sanitizeProfile(_0x2475bb[_0x19859a]),_0x4077c6=_0x3b3a8d?{}:_0x5cf62b,_0x50bbc6=_0x3b3a8d||_0x4077c6[_0x549582(0x138)];if(!_0x50bbc6){const _0x22e891=Object['keys'](_0x2475bb),_0x3aee48=_0x22e891[_0x549582(0x157)]===0x0?_0x549582(0x166)+CLI_BIN_NAME+_0x549582(0x148)+_0x4d3b8b+_0x549582(0x15e)+_0x19859a+'\x20--appcode\x20<code>`.':_0x549582(0x14a)+_0x22e891['join'](',\x20');throw CliErrors[_0x549582(0x170)](_0x549582(0x155)+_0x19859a+_0x549582(0x13e),_0x3aee48);}assertValidAppcode(String(_0x50bbc6));const _0x493af6={..._0x4077c6,..._0x7e58a3,'appcode':String(_0x50bbc6),...collectWorkspaceProfileOverrides(_0x5474f6)};return _0x1b73fe[_0x19859a]=_0x493af6,_0x173836[_0x549582(0x13d)]=_0x1b73fe,_0x173836[_0x549582(0x141)]=_0x19859a,delete _0x173836[_0x549582(0x138)],delete _0x173836[_0x549582(0x15b)],_0x493af6[_0x549582(0x140)]&&(_0x173836[_0x549582(0x140)]=_0x493af6['env']),writeConfigFile(_0x426a47,_0x173836),{'ok':!![],'message':_0x549582(0x14d)+(_0x4d3b8b===_0x549582(0x160)?_0x549582(0x13f):_0x549582(0x16f))+':\x20'+_0x19859a+_0x549582(0x144)+_0x493af6[_0x549582(0x138)]+_0x549582(0x16d)+_0x426a47+_0x549582(0x162),'data':{'operation':_0x549582(0x147)+_0x4d3b8b,'configPath':_0x426a47,'app':_0x19859a,'appcode':_0x493af6[_0x549582(0x138)],'env':_0x493af6[_0x549582(0x140)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a163_0x40e528(0x163),'command':'init','description':a163_0x40e528(0x16b),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x23d16c=>configureWorkspace(_0x23d16c,a163_0x40e528(0x160))},workspaceUseDefinition={'service':'workspace','command':a163_0x40e528(0x143),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':a163_0x40e528(0x16e),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x262856=>configureWorkspace(_0x262856,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];function a163_0x3683(){const _0x116bbe=['235196pAFiHh','555484BsYMoO','\x20--app\x20','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','init','isArray','.\x20Credentials:\x20not\x20written.','workspace','Invalid\x20appcode:\x20','globalConfig','Use\x20`','Locale\x20for\x20this\x20workspace\x20app\x20profile','8TyXCDn','number','format','Initialize\x20the\x20current\x20workspace\x20app\x20binding','172OejkWc',').\x20Config:\x20','write','updated','validation','6bEoHVJ','appcode','813369mmPDsC','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','2866797ROwqBL','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','apps','\x22\x20not\x20found.','initialized','env','defaultApp','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','use','\x20(appcode:\x20','38085GhmKDG','\x20workspace\x20use\x20--app\x20<name>`.','workspace.','\x20workspace\x20','7796850dLJCLO','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','apiDir','riskLevel','Workspace\x20','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','defaultFormat','string','trim','locale','470246yDhbRZ','str','App\x20\x22','pageSize','length','Target\x20environment','object','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','app'];a163_0x3683=function(){return _0x116bbe;};return a163_0x3683();}export{WORKSPACE_USAGE};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a164_0x12e7(_0x2b8d67,_0x4f034f){_0x2b8d67=_0x2b8d67-0xc7;const _0x142f39=a164_0x142f();let _0x12e75b=_0x142f39[_0x2b8d67];return _0x12e75b;}const a164_0x5700ac=a164_0x12e7;function a164_0x142f(){const _0x3733b8=['7104776EoVqEL','170TvLgTB','high-risk-write','117iokLUJ','name','3557668CdOaqg','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','remove','126inzbBv','workspace\x20remove','2916980FJsKdm','300531YcjXsN','1067240LepOpX','1990434AgxFmg','App\x20profile\x20name\x20to\x20remove','workspace','5vexyjJ','10943VmgduY'];a164_0x142f=function(){return _0x3733b8;};return a164_0x142f();}(function(_0x1782fa,_0x112578){const _0x3157d3=a164_0x12e7,_0x5b0b03=_0x1782fa();while(!![]){try{const _0x490522=parseInt(_0x3157d3(0xd2))/0x1*(parseInt(_0x3157d3(0xd4))/0x2)+parseInt(_0x3157d3(0xce))/0x3+parseInt(_0x3157d3(0xd8))/0x4*(-parseInt(_0x3157d3(0xd1))/0x5)+-parseInt(_0x3157d3(0xc9))/0x6*(-parseInt(_0x3157d3(0xcc))/0x7)+parseInt(_0x3157d3(0xd3))/0x8+parseInt(_0x3157d3(0xd6))/0x9*(-parseInt(_0x3157d3(0xcd))/0xa)+-parseInt(_0x3157d3(0xcb))/0xb;if(_0x490522===_0x112578)break;else _0x5b0b03['push'](_0x5b0b03['shift']());}catch(_0x3c3a75){_0x5b0b03['push'](_0x5b0b03['shift']());}}}(a164_0x142f,0xcd662));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a164_0x5700ac(0xd0),'command':a164_0x5700ac(0xc8),'description':a164_0x5700ac(0xc7),'risk':a164_0x5700ac(0xd5),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a164_0x5700ac(0xd7),'description':a164_0x5700ac(0xcf),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x1e7ea1=>validateAppName(_0x1e7ea1,a164_0x5700ac(0xca)),'execute':_0x693eab=>runAppRemove(_0x693eab,a164_0x5700ac(0xca))};
|