@lovrabet/rabetbase-cli 2.4.7-beta.2 → 2.4.7
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/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.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/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -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/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a192_0x1dddcb=a192_0x4e3c;(function(_0x316028,_0x3aff87){const _0x50f2f0=a192_0x4e3c,_0x5de189=_0x316028();while(!![]){try{const _0x3ab260=parseInt(_0x50f2f0(0xf1))/0x1*(-parseInt(_0x50f2f0(0x116))/0x2)+-parseInt(_0x50f2f0(0x101))/0x3+-parseInt(_0x50f2f0(0xef))/0x4*(parseInt(_0x50f2f0(0xed))/0x5)+parseInt(_0x50f2f0(0xf4))/0x6+-parseInt(_0x50f2f0(0x11f))/0x7+parseInt(_0x50f2f0(0x10f))/0x8+parseInt(_0x50f2f0(0xfb))/0x9;if(_0x3ab260===_0x3aff87)break;else _0x5de189['push'](_0x5de189['shift']());}catch(_0x1891b6){_0x5de189['push'](_0x5de189['shift']());}}}(a192_0x4ba5,0xecb1f));function a192_0x4ba5(){const _0x1da3cc=['3550408vDYzCr','description','would_pull','sqlRoot','cancelled','boolean','Force\x20pull\x20cancelled.','2fImlZK','trimStart','pull','local\x20differs\x20from\x20remote','split','name','toISOString','\x20failed','skipped','12090344nyLlDY','Filter\x20by\x20SQL\x20display\x20name','sqlName','\x20SQL\x20file(s)\x20into\x20','push','appCode','sqlCode','lastSync','sqlContent','read','\x20skipped,\x20','5988045YDDxHt','str','4PtVdCv','mybatisXml','422314PBzrLE','path','sql','6158442PEIyoQ','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Force\x20overwrite\x20local\x20unsynced\x20changes','length','join','Would\x20pull\x20','utf8','30224637wwvtWH','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','conflict','unchanged','sqlRootDir','1535649XIAWMt','bool','test','Pull\x20complete:\x20','message','totalCount','sqls','catch','dbId','nonInteractive','lockFilePath','sqlcode','\x20written,\x20','filter'];a192_0x4ba5=function(){return _0x1da3cc;};return a192_0x4ba5();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a192_0x4e3c(_0x406bfa,_0x1537df){_0x406bfa=_0x406bfa-0xe4;const _0x4ba5a9=a192_0x4ba5();let _0x4e3cca=_0x4ba5a9[_0x406bfa];return _0x4e3cca;}async function fetchAllSqlQueries(_0x999ed1,_0x47f71f){const _0x4f13ed=a192_0x4e3c,_0x3a9c1f=[];let _0x4dff49=0x1;while(!![]){const _0x4f8a4c=await listSqlQueries(_0x999ed1,{'currentPage':_0x4dff49,'pageSize':PAGE_SIZE,'sqlCode':_0x47f71f[_0x4f13ed(0xe8)],'sqlName':_0x47f71f[_0x4f13ed(0xe4)]}),_0x3f004a=_0x4f8a4c['tableData']??[];_0x3a9c1f['push'](..._0x3f004a);if(_0x3f004a['length']===0x0)break;const _0x132ec7=_0x4f8a4c['paging']?.[_0x4f13ed(0x106)];if(_0x132ec7!=null?_0x3a9c1f[_0x4f13ed(0xf7)]>=_0x132ec7:_0x3f004a[_0x4f13ed(0xf7)]<PAGE_SIZE)break;_0x4dff49++;}return _0x3a9c1f;}async function ensureSqlContent(_0x505253){const _0x149e19=a192_0x4e3c;if(_0x505253[_0x149e19(0xea)]!=null&&String(_0x505253[_0x149e19(0xea)])[_0x149e19(0xf7)]>0x0)return _0x505253;return getSqlQueryDetail(_0x505253['sqlCode']);}export const sqlPull={'service':a192_0x1dddcb(0xf3),'command':a192_0x1dddcb(0x118),'description':a192_0x1dddcb(0xfc),'risk':a192_0x1dddcb(0xeb),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a192_0x1dddcb(0x11b),'type':'string','description':a192_0x1dddcb(0x120)},{'name':'force','type':a192_0x1dddcb(0x114),'description':a192_0x1dddcb(0xf6)}],async 'dryRun'(_0x431178){const _0x1d72e9=a192_0x1dddcb,_0x47e735=loadSqlProjectConfig(_0x431178[_0x1d72e9(0xe7)]),_0x464908=await readSqlLockFile(_0x47e735[_0x1d72e9(0x10b)]),{appLock:_0x4dca2e}=ensureSqlLockScope(_0x464908??createEmptySqlLock(),_0x47e735[_0x1d72e9(0xe7)],_0x47e735[_0x1d72e9(0x112)],_0x1d72e9(0x118)),_0x1b1fea=await fetchAllSqlQueries(_0x431178[_0x1d72e9(0xe7)],{'sqlCode':_0x431178[_0x1d72e9(0xee)](_0x1d72e9(0x10c))||undefined,'sqlName':_0x431178['str'](_0x1d72e9(0x11b))||undefined}),_0x32188a=[];for(const _0xfa77b5 of _0x1b1fea){const _0x134179=await ensureSqlContent(_0xfa77b5),_0x505591=ensureRemoteSqlContent(_0x134179),_0x5780eb=detectModeFromSql(_0x134179),_0x2bb13f=_0x134179['dbId']?await getDbName(_0x431178[_0x1d72e9(0xe7)],Number(_0x134179['dbId']))[_0x1d72e9(0x108)](()=>undefined):undefined,_0x281fed=buildLocalSqlFileContent({'sqlCode':_0x134179[_0x1d72e9(0xe8)],'sqlName':_0x134179['sqlName'],'dbId':_0x134179[_0x1d72e9(0x109)]},_0x505591,{'dbName':_0x2bb13f,'mode':_0x5780eb,'syncedAt':new Date()[_0x1d72e9(0x11c)](),'description':_0x134179[_0x1d72e9(0x110)]}),_0x54bebe=buildSqlLockEntry(_0x134179,_0x505591,'',{'dbName':_0x2bb13f}),_0x59af08=resolveLocalSqlFilePath(_0x47e735,_0x134179['sqlCode'],_0x54bebe);let _0x4a8c4d=_0x1d72e9(0x111),_0x227ef4;if(await fileExists(_0x59af08)){const _0x8d4e40=await readFile(_0x59af08,_0x1d72e9(0xfa));isEquivalentPulledSqlFile(_0x8d4e40,_0x281fed,_0x5780eb)?(_0x4a8c4d=_0x1d72e9(0x11e),_0x227ef4=_0x1d72e9(0xff)):(_0x4a8c4d=_0x1d72e9(0xfe),_0x227ef4=_0x1d72e9(0xf5));}_0x32188a['push']({'sqlCode':_0x134179[_0x1d72e9(0xe8)],'sqlName':_0x134179[_0x1d72e9(0xe4)],'filePath':_0x59af08,'status':_0x4a8c4d,'reason':_0x227ef4});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x431178['appCode'],'sqlCode':_0x431178[_0x1d72e9(0xee)]('sqlcode')||null,'sqlName':_0x431178[_0x1d72e9(0xee)](_0x1d72e9(0x11b))||null,'files':_0x32188a},'description':_0x1d72e9(0xf9)+_0x32188a[_0x1d72e9(0xf7)]+_0x1d72e9(0xe5)+_0x47e735['sqlRootDir']};},async 'execute'(_0x22c1af){const _0x228767=a192_0x1dddcb,_0x535aea=loadSqlProjectConfig(_0x22c1af[_0x228767(0xe7)]),_0x2315e5=await readSqlLockFile(_0x535aea[_0x228767(0x10b)]),{lockData:_0x1acb4d,appLock:_0x2c7b56}=ensureSqlLockScope(_0x2315e5??createEmptySqlLock(),_0x535aea['appCode'],_0x535aea[_0x228767(0x112)],_0x228767(0x118)),_0x1a4a50=_0x22c1af[_0x228767(0x102)]('force'),_0x233038=await fetchAllSqlQueries(_0x22c1af[_0x228767(0xe7)],{'sqlCode':_0x22c1af[_0x228767(0xee)](_0x228767(0x10c))||undefined,'sqlName':_0x22c1af['str']('name')||undefined});if(_0x233038['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x387a98=[],_0x3aa425=[];for(const _0x4815bd of _0x233038){try{_0x387a98[_0x228767(0xe6)](await ensureSqlContent(_0x4815bd));}catch(_0x531d72){_0x3aa425[_0x228767(0xe6)]({'sqlCode':_0x4815bd['sqlCode'],'error':_0x531d72 instanceof Error?_0x531d72['message']:String(_0x531d72)});}}if(_0x1a4a50&&!_0x22c1af[_0x228767(0x10a)]){let _0x434a2f=![];for(const _0x43cc64 of _0x387a98){const _0x431514=detectModeFromSql(_0x43cc64),_0x58bdd7=_0x43cc64[_0x228767(0x109)]?await getDbName(_0x22c1af['appCode'],Number(_0x43cc64[_0x228767(0x109)]))[_0x228767(0x108)](()=>undefined):undefined,_0x479491=buildLocalSqlFileContent({'sqlCode':_0x43cc64[_0x228767(0xe8)],'sqlName':_0x43cc64[_0x228767(0xe4)],'dbId':_0x43cc64[_0x228767(0x109)]},ensureRemoteSqlContent(_0x43cc64),{'dbName':_0x58bdd7,'mode':_0x431514,'syncedAt':new Date()[_0x228767(0x11c)](),'description':_0x43cc64['description']}),_0x514ffa=resolveLocalSqlFilePath(_0x535aea,_0x43cc64[_0x228767(0xe8)],buildSqlLockEntry(_0x43cc64,ensureRemoteSqlContent(_0x43cc64),'',{'dbName':_0x58bdd7}));if(await fileExists(_0x514ffa)){const _0x1e3d54=await readFile(_0x514ffa,_0x228767(0xfa));if(!isEquivalentPulledSqlFile(_0x1e3d54,_0x479491,_0x431514)){_0x434a2f=!![];break;}}}if(_0x434a2f){const _0x2e505c=await confirmForceOverwrite(_0x228767(0xfd));if(!_0x2e505c)throw CliErrors[_0x228767(0x113)](_0x228767(0x115));}}const _0x4681c4=cloneSqlLockData(_0x1acb4d),_0x12f29f=_0x4681c4['apps'][_0x535aea['appCode']],_0x4efa00=[],_0x43658b=[];for(const _0x5ba5e1 of _0x387a98){const _0x167c66=_0x12f29f['sqls'][_0x5ba5e1['sqlCode']],_0x32b179=ensureRemoteSqlContent(_0x5ba5e1),_0x568086=detectModeFromSql(_0x5ba5e1),_0x5309a2=_0x5ba5e1[_0x228767(0x109)]?await getDbName(_0x22c1af[_0x228767(0xe7)],Number(_0x5ba5e1[_0x228767(0x109)]))[_0x228767(0x108)](()=>undefined):undefined,_0x4c1960=buildLocalSqlFileContent({'sqlCode':_0x5ba5e1['sqlCode'],'sqlName':_0x5ba5e1[_0x228767(0xe4)],'dbId':_0x5ba5e1[_0x228767(0x109)]},_0x32b179,{'dbName':_0x5309a2,'mode':_0x568086,'syncedAt':new Date()[_0x228767(0x11c)](),'description':_0x5ba5e1[_0x228767(0x110)]}),_0x19e7bc=buildSqlLockEntry(_0x5ba5e1,_0x32b179,computeSqlContentHash(_0x4c1960),{'dbName':_0x5309a2}),_0x1e2eca=_0x19e7bc[_0x228767(0xf2)],_0x3435e0=join(_0x535aea[_0x228767(0x100)],_0x1e2eca);try{if(await fileExists(_0x3435e0)){const _0x4006a1=await readFile(_0x3435e0,_0x228767(0xfa));if(isEquivalentPulledSqlFile(_0x4006a1,_0x4c1960,_0x568086)){_0x43658b[_0x228767(0xe6)]({'sqlCode':_0x5ba5e1['sqlCode'],'reason':_0x228767(0xff)}),_0x12f29f[_0x228767(0x107)][_0x5ba5e1[_0x228767(0xe8)]]={..._0x19e7bc,'hash':computeSqlContentHash(_0x4006a1),'path':_0x1e2eca};continue;}if(!_0x1a4a50){_0x43658b[_0x228767(0xe6)]({'sqlCode':_0x5ba5e1['sqlCode'],'reason':_0x228767(0x119)});continue;}}const _0x68c85c=_0x167c66?.[_0x228767(0xf2)]?join(_0x535aea[_0x228767(0x100)],_0x167c66[_0x228767(0xf2)]):undefined;_0x68c85c&&_0x68c85c!==_0x3435e0&&await fileExists(_0x68c85c)&&await rm(_0x68c85c,{'force':!![]}),await ensureParentDirectory(_0x3435e0),await writeFile(_0x3435e0,_0x4c1960,_0x228767(0xfa)),_0x12f29f[_0x228767(0x107)][_0x5ba5e1[_0x228767(0xe8)]]={..._0x19e7bc,'path':_0x1e2eca},_0x4efa00['push']({'sqlCode':_0x5ba5e1[_0x228767(0xe8)],'filePath':_0x3435e0});}catch(_0x1c7323){_0x3aa425[_0x228767(0xe6)]({'sqlCode':_0x5ba5e1[_0x228767(0xe8)],'error':_0x1c7323 instanceof Error?_0x1c7323[_0x228767(0x105)]:String(_0x1c7323)});}}return _0x12f29f[_0x228767(0xe9)]=new Date()[_0x228767(0x11c)](),await writeSqlLockFile(_0x535aea[_0x228767(0x10b)],_0x4681c4),{'ok':_0x3aa425[_0x228767(0xf7)]===0x0,'data':{'pulled':_0x4efa00,'skipped':_0x43658b,'failed':_0x3aa425},'message':_0x228767(0x104)+_0x4efa00[_0x228767(0xf7)]+_0x228767(0x10d)+_0x43658b[_0x228767(0xf7)]+_0x228767(0xec)+_0x3aa425[_0x228767(0xf7)]+_0x228767(0x11d)};}};function detectModeFromSql(_0x5b6604){const _0xdb7adb=a192_0x1dddcb,_0x5c3238=ensureRemoteSqlContent(_0x5b6604),_0x55ac6a=stripLocalSqlMetadata(_0x5c3238,_0xdb7adb(0xf0))[_0xdb7adb(0x117)]();if(/^<(select|insert|update|delete)\b/i[_0xdb7adb(0x103)](_0x55ac6a))return _0xdb7adb(0xf0);return _0xdb7adb(0xf3);}function isEquivalentPulledSqlFile(_0x2c7e07,_0x4b4a5a,_0x343599){return normalizePullComparableContent(_0x2c7e07,_0x343599)===normalizePullComparableContent(_0x4b4a5a,_0x343599);}function normalizePullComparableContent(_0x5d4b12,_0x21b2f4){const _0xb1caa0=a192_0x1dddcb,_0x24495e=_0x5d4b12['replace'](/\r\n/g,'\x0a')[_0xb1caa0(0x11a)]('\x0a'),_0x51e479=_0x24495e[_0xb1caa0(0x10e)](_0x37a3f1=>!isSyncedAtMetadataLine(_0x37a3f1,_0x21b2f4));return _0x51e479[_0xb1caa0(0xf8)]('\x0a');}function isSyncedAtMetadataLine(_0x18f557,_0x2c5d85){const _0x352b84=a192_0x1dddcb;if(_0x2c5d85===_0x352b84(0xf0))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x352b84(0x103)](_0x18f557);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x352b84(0x103)](_0x18f557);}
|
|
1
|
+
const a192_0xbf43bb=a192_0x1e27;(function(_0xd2033a,_0x1980eb){const _0x2caf1a=a192_0x1e27,_0x190d45=_0xd2033a();while(!![]){try{const _0x5a851c=parseInt(_0x2caf1a(0xdb))/0x1+parseInt(_0x2caf1a(0xd5))/0x2+-parseInt(_0x2caf1a(0xd3))/0x3+parseInt(_0x2caf1a(0xf4))/0x4+-parseInt(_0x2caf1a(0xe0))/0x5*(parseInt(_0x2caf1a(0xc6))/0x6)+-parseInt(_0x2caf1a(0xc7))/0x7*(parseInt(_0x2caf1a(0xe9))/0x8)+parseInt(_0x2caf1a(0xc8))/0x9*(parseInt(_0x2caf1a(0xd6))/0xa);if(_0x5a851c===_0x1980eb)break;else _0x190d45['push'](_0x190d45['shift']());}catch(_0x4b7827){_0x190d45['push'](_0x190d45['shift']());}}}(a192_0xfc93,0x4596d));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a192_0x1e27(_0x28bc5f,_0x121772){_0x28bc5f=_0x28bc5f-0xc6;const _0xfc930=a192_0xfc93();let _0x1e27f9=_0xfc930[_0x28bc5f];return _0x1e27f9;}import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';function a192_0xfc93(){const _0xc68114=['1254717GeJBHz','dbId','Force\x20pull\x20cancelled.','push','bool','sqlName','length','catch','sqls','appCode','toISOString','1316022OSydXQ','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','86774tiNQWg','10SMrCIC','name','\x20skipped,\x20','Would\x20pull\x20','trimStart','498280EHOaiw','str','force','Pull\x20complete:\x20','mybatisXml','5UtTXuM','sqlCode','utf8','boolean','\x20failed','join','pull','read','No\x20remote\x20SQL\x20queries\x20matched.','664712eJSftf','totalCount','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlContent','path','cancelled','sql','replace','apps','paging','would_pull','1690816mKDhWr','sqlRootDir','conflict','split','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqlRoot','message','lockFilePath','filter','local\x20differs\x20from\x20remote','tableData','string','sqlcode','description','test','286302SHUwUl','28tIREDK'];a192_0xfc93=function(){return _0xc68114;};return a192_0xfc93();}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(_0x2cb5e9,_0x351067){const _0x153705=a192_0x1e27,_0x56d9e1=[];let _0x520a05=0x1;while(!![]){const _0xfad0de=await listSqlQueries(_0x2cb5e9,{'currentPage':_0x520a05,'pageSize':PAGE_SIZE,'sqlCode':_0x351067[_0x153705(0xe1)],'sqlName':_0x351067[_0x153705(0xcd)]}),_0x5f1c10=_0xfad0de[_0x153705(0xfe)]??[];_0x56d9e1[_0x153705(0xcb)](..._0x5f1c10);if(_0x5f1c10['length']===0x0)break;const _0x562354=_0xfad0de[_0x153705(0xf2)]?.[_0x153705(0xea)];if(_0x562354!=null?_0x56d9e1['length']>=_0x562354:_0x5f1c10[_0x153705(0xce)]<PAGE_SIZE)break;_0x520a05++;}return _0x56d9e1;}async function ensureSqlContent(_0x1c9c16){const _0x60958d=a192_0x1e27;if(_0x1c9c16['sqlContent']!=null&&String(_0x1c9c16[_0x60958d(0xec)])[_0x60958d(0xce)]>0x0)return _0x1c9c16;return getSqlQueryDetail(_0x1c9c16[_0x60958d(0xe1)]);}export const sqlPull={'service':'sql','command':a192_0xbf43bb(0xe6),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a192_0xbf43bb(0xe7),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a192_0xbf43bb(0xd7),'type':a192_0xbf43bb(0xff),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a192_0xbf43bb(0xdd),'type':a192_0xbf43bb(0xe3),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x5bc1f8){const _0x5d2253=a192_0xbf43bb,_0xed4496=loadSqlProjectConfig(_0x5bc1f8[_0x5d2253(0xd1)]),_0xae8e51=await readSqlLockFile(_0xed4496['lockFilePath']),{appLock:_0x20a185}=ensureSqlLockScope(_0xae8e51??createEmptySqlLock(),_0xed4496[_0x5d2253(0xd1)],_0xed4496[_0x5d2253(0xf9)],_0x5d2253(0xe6)),_0x11fc78=await fetchAllSqlQueries(_0x5bc1f8[_0x5d2253(0xd1)],{'sqlCode':_0x5bc1f8[_0x5d2253(0xdc)](_0x5d2253(0x100))||undefined,'sqlName':_0x5bc1f8[_0x5d2253(0xdc)](_0x5d2253(0xd7))||undefined}),_0x1560b8=[];for(const _0x4cf171 of _0x11fc78){const _0x574f3d=await ensureSqlContent(_0x4cf171),_0x562f65=ensureRemoteSqlContent(_0x574f3d),_0x48d12d=detectModeFromSql(_0x574f3d),_0x1340b2=_0x574f3d['dbId']?await getDbName(_0x5bc1f8[_0x5d2253(0xd1)],Number(_0x574f3d[_0x5d2253(0xc9)]))['catch'](()=>undefined):undefined,_0x5007b5=buildLocalSqlFileContent({'sqlCode':_0x574f3d[_0x5d2253(0xe1)],'sqlName':_0x574f3d['sqlName'],'dbId':_0x574f3d[_0x5d2253(0xc9)]},_0x562f65,{'dbName':_0x1340b2,'mode':_0x48d12d,'syncedAt':new Date()[_0x5d2253(0xd2)](),'description':_0x574f3d['description']}),_0x3a69a0=buildSqlLockEntry(_0x574f3d,_0x562f65,'',{'dbName':_0x1340b2}),_0x36e775=resolveLocalSqlFilePath(_0xed4496,_0x574f3d[_0x5d2253(0xe1)],_0x3a69a0);let _0x47dd82=_0x5d2253(0xf3),_0x236b16;if(await fileExists(_0x36e775)){const _0x1c3854=await readFile(_0x36e775,'utf8');isEquivalentPulledSqlFile(_0x1c3854,_0x5007b5,_0x48d12d)?(_0x47dd82='skipped',_0x236b16='unchanged'):(_0x47dd82=_0x5d2253(0xf6),_0x236b16=_0x5d2253(0xd4));}_0x1560b8[_0x5d2253(0xcb)]({'sqlCode':_0x574f3d[_0x5d2253(0xe1)],'sqlName':_0x574f3d[_0x5d2253(0xcd)],'filePath':_0x36e775,'status':_0x47dd82,'reason':_0x236b16});}return{'method':'POST','url':_0x5d2253(0xeb),'body':{'appCode':_0x5bc1f8[_0x5d2253(0xd1)],'sqlCode':_0x5bc1f8[_0x5d2253(0xdc)](_0x5d2253(0x100))||null,'sqlName':_0x5bc1f8[_0x5d2253(0xdc)](_0x5d2253(0xd7))||null,'files':_0x1560b8},'description':_0x5d2253(0xd9)+_0x1560b8[_0x5d2253(0xce)]+'\x20SQL\x20file(s)\x20into\x20'+_0xed4496['sqlRootDir']};},async 'execute'(_0x2d5c4f){const _0x12c457=a192_0xbf43bb,_0x3bd95a=loadSqlProjectConfig(_0x2d5c4f['appCode']),_0x21f6e1=await readSqlLockFile(_0x3bd95a[_0x12c457(0xfb)]),{lockData:_0x107e77,appLock:_0x21f37a}=ensureSqlLockScope(_0x21f6e1??createEmptySqlLock(),_0x3bd95a['appCode'],_0x3bd95a['sqlRoot'],'pull'),_0x4147b8=_0x2d5c4f[_0x12c457(0xcc)](_0x12c457(0xdd)),_0x550ac4=await fetchAllSqlQueries(_0x2d5c4f['appCode'],{'sqlCode':_0x2d5c4f[_0x12c457(0xdc)](_0x12c457(0x100))||undefined,'sqlName':_0x2d5c4f[_0x12c457(0xdc)](_0x12c457(0xd7))||undefined});if(_0x550ac4['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x12c457(0xe8)};const _0x295f07=[],_0x29485d=[];for(const _0x44ca02 of _0x550ac4){try{_0x295f07[_0x12c457(0xcb)](await ensureSqlContent(_0x44ca02));}catch(_0x3f9003){_0x29485d[_0x12c457(0xcb)]({'sqlCode':_0x44ca02[_0x12c457(0xe1)],'error':_0x3f9003 instanceof Error?_0x3f9003[_0x12c457(0xfa)]:String(_0x3f9003)});}}if(_0x4147b8&&!_0x2d5c4f['nonInteractive']){let _0x1879f9=![];for(const _0x431102 of _0x295f07){const _0x478d46=detectModeFromSql(_0x431102),_0x5abaa3=_0x431102[_0x12c457(0xc9)]?await getDbName(_0x2d5c4f[_0x12c457(0xd1)],Number(_0x431102['dbId']))[_0x12c457(0xcf)](()=>undefined):undefined,_0x17d1fb=buildLocalSqlFileContent({'sqlCode':_0x431102['sqlCode'],'sqlName':_0x431102[_0x12c457(0xcd)],'dbId':_0x431102['dbId']},ensureRemoteSqlContent(_0x431102),{'dbName':_0x5abaa3,'mode':_0x478d46,'syncedAt':new Date()[_0x12c457(0xd2)](),'description':_0x431102[_0x12c457(0x101)]}),_0xbdc3ed=resolveLocalSqlFilePath(_0x3bd95a,_0x431102['sqlCode'],buildSqlLockEntry(_0x431102,ensureRemoteSqlContent(_0x431102),'',{'dbName':_0x5abaa3}));if(await fileExists(_0xbdc3ed)){const _0x4f0614=await readFile(_0xbdc3ed,_0x12c457(0xe2));if(!isEquivalentPulledSqlFile(_0x4f0614,_0x17d1fb,_0x478d46)){_0x1879f9=!![];break;}}}if(_0x1879f9){const _0x264ba4=await confirmForceOverwrite(_0x12c457(0xf8));if(!_0x264ba4)throw CliErrors[_0x12c457(0xee)](_0x12c457(0xca));}}const _0x24f311=cloneSqlLockData(_0x107e77),_0x321dcb=_0x24f311[_0x12c457(0xf1)][_0x3bd95a['appCode']],_0xd5dd3f=[],_0x5e213e=[];for(const _0x171ac9 of _0x295f07){const _0x16d4b3=_0x321dcb['sqls'][_0x171ac9['sqlCode']],_0xb15f86=ensureRemoteSqlContent(_0x171ac9),_0x517b21=detectModeFromSql(_0x171ac9),_0x3fb37d=_0x171ac9[_0x12c457(0xc9)]?await getDbName(_0x2d5c4f['appCode'],Number(_0x171ac9['dbId']))[_0x12c457(0xcf)](()=>undefined):undefined,_0x58a1d3=buildLocalSqlFileContent({'sqlCode':_0x171ac9[_0x12c457(0xe1)],'sqlName':_0x171ac9[_0x12c457(0xcd)],'dbId':_0x171ac9[_0x12c457(0xc9)]},_0xb15f86,{'dbName':_0x3fb37d,'mode':_0x517b21,'syncedAt':new Date()[_0x12c457(0xd2)](),'description':_0x171ac9[_0x12c457(0x101)]}),_0x37ab2b=buildSqlLockEntry(_0x171ac9,_0xb15f86,computeSqlContentHash(_0x58a1d3),{'dbName':_0x3fb37d}),_0x43853e=_0x37ab2b['path'],_0x5533f0=join(_0x3bd95a[_0x12c457(0xf5)],_0x43853e);try{if(await fileExists(_0x5533f0)){const _0x6d4a6d=await readFile(_0x5533f0,_0x12c457(0xe2));if(isEquivalentPulledSqlFile(_0x6d4a6d,_0x58a1d3,_0x517b21)){_0x5e213e[_0x12c457(0xcb)]({'sqlCode':_0x171ac9['sqlCode'],'reason':'unchanged'}),_0x321dcb['sqls'][_0x171ac9[_0x12c457(0xe1)]]={..._0x37ab2b,'hash':computeSqlContentHash(_0x6d4a6d),'path':_0x43853e};continue;}if(!_0x4147b8){_0x5e213e[_0x12c457(0xcb)]({'sqlCode':_0x171ac9['sqlCode'],'reason':_0x12c457(0xfd)});continue;}}const _0x2f76bb=_0x16d4b3?.[_0x12c457(0xed)]?join(_0x3bd95a['sqlRootDir'],_0x16d4b3['path']):undefined;_0x2f76bb&&_0x2f76bb!==_0x5533f0&&await fileExists(_0x2f76bb)&&await rm(_0x2f76bb,{'force':!![]}),await ensureParentDirectory(_0x5533f0),await writeFile(_0x5533f0,_0x58a1d3,_0x12c457(0xe2)),_0x321dcb[_0x12c457(0xd0)][_0x171ac9['sqlCode']]={..._0x37ab2b,'path':_0x43853e},_0xd5dd3f[_0x12c457(0xcb)]({'sqlCode':_0x171ac9[_0x12c457(0xe1)],'filePath':_0x5533f0});}catch(_0x1a634d){_0x29485d[_0x12c457(0xcb)]({'sqlCode':_0x171ac9['sqlCode'],'error':_0x1a634d instanceof Error?_0x1a634d[_0x12c457(0xfa)]:String(_0x1a634d)});}}return _0x321dcb['lastSync']=new Date()[_0x12c457(0xd2)](),await writeSqlLockFile(_0x3bd95a[_0x12c457(0xfb)],_0x24f311),{'ok':_0x29485d[_0x12c457(0xce)]===0x0,'data':{'pulled':_0xd5dd3f,'skipped':_0x5e213e,'failed':_0x29485d},'message':_0x12c457(0xde)+_0xd5dd3f['length']+'\x20written,\x20'+_0x5e213e[_0x12c457(0xce)]+_0x12c457(0xd8)+_0x29485d[_0x12c457(0xce)]+_0x12c457(0xe4)};}};function detectModeFromSql(_0xbf937e){const _0xfd8509=a192_0xbf43bb,_0x1c48b6=ensureRemoteSqlContent(_0xbf937e),_0x3bd863=stripLocalSqlMetadata(_0x1c48b6,'mybatisXml')[_0xfd8509(0xda)]();if(/^<(select|insert|update|delete)\b/i[_0xfd8509(0x102)](_0x3bd863))return _0xfd8509(0xdf);return _0xfd8509(0xef);}function isEquivalentPulledSqlFile(_0x2cca1f,_0x1cb368,_0x19ed2e){return normalizePullComparableContent(_0x2cca1f,_0x19ed2e)===normalizePullComparableContent(_0x1cb368,_0x19ed2e);}function normalizePullComparableContent(_0x577c5a,_0x757556){const _0x49defd=a192_0xbf43bb,_0x512a1a=_0x577c5a[_0x49defd(0xf0)](/\r\n/g,'\x0a')[_0x49defd(0xf7)]('\x0a'),_0x1f2b26=_0x512a1a[_0x49defd(0xfc)](_0x1496bd=>!isSyncedAtMetadataLine(_0x1496bd,_0x757556));return _0x1f2b26[_0x49defd(0xe5)]('\x0a');}function isSyncedAtMetadataLine(_0x3a8e3d,_0x5b5946){if(_0x5b5946==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x3a8e3d);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x3a8e3d);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a193_0x31e9d3=a193_0x5f44;(function(_0xedad1a,_0x34914b){const _0x2bcaea=a193_0x5f44,_0x2252fe=_0xedad1a();while(!![]){try{const _0xfcfa44=parseInt(_0x2bcaea(0x9e))/0x1+-parseInt(_0x2bcaea(0x9a))/0x2*(-parseInt(_0x2bcaea(0x9b))/0x3)+-parseInt(_0x2bcaea(0x86))/0x4+-parseInt(_0x2bcaea(0x8b))/0x5*(parseInt(_0x2bcaea(0xb3))/0x6)+parseInt(_0x2bcaea(0x90))/0x7+-parseInt(_0x2bcaea(0x8c))/0x8+parseInt(_0x2bcaea(0xa9))/0x9;if(_0xfcfa44===_0x34914b)break;else _0x2252fe['push'](_0x2252fe['shift']());}catch(_0x3643d1){_0x2252fe['push'](_0x2252fe['shift']());}}}(a193_0x170a,0x40bee));function a193_0x5f44(_0x38082b,_0x1dee3d){_0x38082b=_0x38082b-0x7e;const _0x170aa1=a193_0x170a();let _0x5f443d=_0x170aa1[_0x38082b];return _0x5f443d;}import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a193_0x170a(){const _0x56fd1a=['isFinite','\x20failed','filter','entries','filePath','762fOPFNa','join','version','\x20SQL\x20file(s)','has','sqlcode','mode','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','trashDir','map','utf8','path','appCode','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','catch','push','\x20skipped,\x20','659676EYkOrN','POST','toISOString','sql','force','14040yhKyXp','1708688actTGi','\x20pushed,\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','sqlName','1468019WoucEX','sqlRoot','sqls','validation','dbId','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','set','relativePath','dbName','sqlConfig','32618wSfOht','48KATekO','bool','Local\x20SQL\x20not\x20found:\x20','290506UZsJIN','remoteId','replace','dbDirectory','str','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','lockFilePath','message','length','projectRoot','sqlCode','2152368RrNrJx','hash','get','write','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'];a193_0x170a=function(){return _0x56fd1a;};return a193_0x170a();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x1db961,_0x397966,_0x3143bb){const _0x2ef3c8=a193_0x5f44,_0x597323=await scanLocalSqlQueries(_0x1db961),_0xe33e71=new Map();for(const _0x557d9d of _0x597323){if(_0x3143bb&&_0x557d9d[_0x2ef3c8(0xa8)]!==_0x3143bb)continue;const _0x4c4718=_0xe33e71[_0x2ef3c8(0xab)](_0x557d9d[_0x2ef3c8(0xa8)])??[];_0x4c4718['push'](_0x557d9d),_0xe33e71[_0x2ef3c8(0x96)](_0x557d9d[_0x2ef3c8(0xa8)],_0x4c4718);}if(_0x3143bb&&!_0xe33e71[_0x2ef3c8(0xb7)](_0x3143bb))throw CliErrors[_0x2ef3c8(0x93)](_0x2ef3c8(0x9d)+_0x3143bb);const _0x45081c=[];for(const [_0x5abab3,_0x51367b]of _0xe33e71[_0x2ef3c8(0xb1)]()){if(_0x51367b[_0x2ef3c8(0xa6)]===0x1){_0x45081c[_0x2ef3c8(0x84)](_0x51367b[0x0]);continue;}const _0x174758=_0x397966[_0x2ef3c8(0x92)][_0x5abab3],_0x2d86f0=_0x174758?.[_0x2ef3c8(0x80)],_0x3a9334=_0x2d86f0?_0x51367b[_0x2ef3c8(0xb0)](_0x5d8b55=>_0x5d8b55[_0x2ef3c8(0x97)]!==_0x2d86f0):_0x51367b;if(_0x174758&&_0x3a9334[_0x2ef3c8(0xa6)]===0x1){_0x45081c['push'](_0x3a9334[0x0]);continue;}throw CliErrors[_0x2ef3c8(0x93)](_0x2ef3c8(0xba)+_0x5abab3+_0x2ef3c8(0x95));}return _0x45081c;}export const sqlPush={'service':a193_0x31e9d3(0x89),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a193_0x31e9d3(0xac),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a193_0x31e9d3(0xa3)}],async 'dryRun'(_0x9c7900){const _0x91edd8=a193_0x31e9d3,_0xf742b0=loadSqlProjectConfig(_0x9c7900['appCode']),_0x526ba1=await readSqlLockFile(_0xf742b0[_0x91edd8(0xa4)]),{appLock:_0x3ca7b3}=ensureSqlLockScope(_0x526ba1??createEmptySqlLock(),_0x9c7900[_0x91edd8(0x81)],_0xf742b0[_0x91edd8(0x91)],_0x91edd8(0x84)),_0x296d34=await getTargetSqlQueries(_0xf742b0,_0x3ca7b3,_0x9c7900[_0x91edd8(0xa2)](_0x91edd8(0xb8))||undefined),_0x2a24f1=[];for(const _0x43fe4e of _0x296d34){const _0x5d3973=await computeSqlFileHash(_0x43fe4e[_0x91edd8(0xb2)]),_0x3deb71=_0x3ca7b3[_0x91edd8(0x92)][_0x43fe4e[_0x91edd8(0xa8)]],_0x1a78f3=!!_0x3deb71&&(_0x3deb71[_0x91edd8(0x80)]!==_0x43fe4e[_0x91edd8(0x97)]||!!_0x43fe4e['sqlName']&&_0x3deb71[_0x91edd8(0x8f)]!==_0x43fe4e['sqlName']);if(!_0x9c7900['bool'](_0x91edd8(0x8a))&&_0x3deb71&&_0x3deb71['hash']===_0x5d3973&&!_0x1a78f3)continue;_0x2a24f1[_0x91edd8(0x84)](_0x43fe4e[_0x91edd8(0xa8)]);}return{'method':_0x91edd8(0x87),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x2a24f1,'appCode':_0x9c7900[_0x91edd8(0x81)]},'description':'Would\x20push\x20'+_0x2a24f1[_0x91edd8(0xa6)]+_0x91edd8(0xb6)};},async 'execute'(_0x20b5a1){const _0x28a331=a193_0x31e9d3,_0xfdd34e=loadSqlProjectConfig(_0x20b5a1[_0x28a331(0x81)]),_0x47f22b=await readSqlLockFile(_0xfdd34e[_0x28a331(0xa4)]),{lockData:_0x3ecb7c,appLock:_0x506608}=ensureSqlLockScope(_0x47f22b??createEmptySqlLock(),_0x20b5a1[_0x28a331(0x81)],_0xfdd34e[_0x28a331(0x91)],'push'),_0x1c771f=await getTargetSqlQueries(_0xfdd34e,_0x506608,_0x20b5a1[_0x28a331(0xa2)](_0x28a331(0xb8))||undefined);if(_0x1c771f[_0x28a331(0xa6)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3153a8=[],_0x49a3d8=[],_0x26bbe8=[];for(const _0x535815 of _0x1c771f){const _0x1bfa9b=_0x506608['sqls'][_0x535815[_0x28a331(0xa8)]];if(!_0x1bfa9b){_0x26bbe8[_0x28a331(0x84)]({'sqlCode':_0x535815[_0x28a331(0xa8)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x5a39d1=await computeSqlFileHash(_0x535815[_0x28a331(0xb2)]),_0x27f6b8=_0x1bfa9b['path']!==_0x535815[_0x28a331(0x97)]||!!_0x535815['sqlName']&&_0x1bfa9b[_0x28a331(0x8f)]!==_0x535815['sqlName'];if(!_0x20b5a1[_0x28a331(0x9c)](_0x28a331(0x8a))&&_0x1bfa9b[_0x28a331(0xaa)]===_0x5a39d1&&!_0x27f6b8){_0x49a3d8[_0x28a331(0x84)]({'sqlCode':_0x535815[_0x28a331(0xa8)],'reason':'unchanged'});continue;}if(_0x1bfa9b[_0x28a331(0xb5)]==null){_0x26bbe8[_0x28a331(0x84)]({'sqlCode':_0x535815[_0x28a331(0xa8)],'error':_0x28a331(0xad)});continue;}const _0x3f1275=await readFile(_0x535815[_0x28a331(0xb2)],_0x28a331(0x7f)),_0x5ab461=stripLocalSqlMetadata(_0x3f1275,_0x535815[_0x28a331(0xb9)]),_0x57bf2a=_0x535815[_0x28a331(0x8f)]||_0x1bfa9b[_0x28a331(0x8f)],_0x3994b5=await resolveTargetDbBinding(_0x20b5a1['appCode'],_0x535815,_0x1bfa9b),_0x457f1b=await updateSqlQuery({'id':_0x1bfa9b['remoteId'],'appCode':_0x20b5a1[_0x28a331(0x81)],'sqlCode':_0x535815['sqlCode'],'sqlName':_0x57bf2a,'dbId':_0x3994b5[_0x28a331(0x94)],'version':_0x1bfa9b['version'],'sqlContent':_0x5ab461,'sqlConfig':_0x1bfa9b[_0x28a331(0x99)]??undefined}),_0x6e0fa8=_0x457f1b[_0x28a331(0x94)]?await getDbName(_0x20b5a1[_0x28a331(0x81)],Number(_0x457f1b[_0x28a331(0x94)]))[_0x28a331(0x83)](()=>_0x3994b5[_0x28a331(0x98)]):_0x3994b5[_0x28a331(0x98)];_0x506608[_0x28a331(0x92)][_0x535815[_0x28a331(0xa8)]]={...buildSqlLockEntry(_0x457f1b,_0x5ab461,_0x5a39d1,{'dbName':_0x6e0fa8}),'path':_0x535815[_0x28a331(0x97)],'mode':_0x1bfa9b[_0x28a331(0xb9)]},await archivePreviousSqlFileIfNeeded(_0xfdd34e,_0x1bfa9b[_0x28a331(0x80)],_0x535815['relativePath']),_0x3153a8[_0x28a331(0x84)]({'sqlCode':_0x535815[_0x28a331(0xa8)],'remoteId':_0x1bfa9b[_0x28a331(0x9f)]});}catch(_0x38efb9){_0x26bbe8[_0x28a331(0x84)]({'sqlCode':_0x535815[_0x28a331(0xa8)],'error':_0x38efb9 instanceof Error?_0x38efb9[_0x28a331(0xa5)]:String(_0x38efb9)});}}return _0x506608['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xfdd34e[_0x28a331(0xa4)],_0x3ecb7c),{'ok':_0x26bbe8[_0x28a331(0xa6)]===0x0,'data':{'pushed':_0x3153a8,'skipped':_0x49a3d8,'failed':_0x26bbe8},'message':'Push\x20complete:\x20'+_0x3153a8['length']+_0x28a331(0x8d)+_0x49a3d8[_0x28a331(0xa6)]+_0x28a331(0x85)+_0x26bbe8['length']+_0x28a331(0xaf)};}};async function archivePreviousSqlFileIfNeeded(_0x37dce6,_0x1d2e2d,_0x1b9a60){const _0x4677c5=a193_0x31e9d3;if(!_0x1d2e2d||_0x1d2e2d===_0x1b9a60)return;const _0xcae0ab=join(_0x37dce6['sqlRootDir'],_0x1d2e2d);if(!await fileExists(_0xcae0ab))return;const _0x182b88=await moveToTrash(_0x37dce6[_0x4677c5(0xa7)],_0x37dce6[_0x4677c5(0xbb)],_0xcae0ab);await cleanupEmptyDirectories(dirname(_0xcae0ab),_0x37dce6['sqlRootDir']),void _0x182b88;}async function moveToTrash(_0x13694b,_0xb12022,_0x209fa8){const _0x4535c6=a193_0x31e9d3,_0x56d4b7=new Date()[_0x4535c6(0x88)]()[_0x4535c6(0xa0)](/[:.]/g,'-'),_0x19cad8=relative(_0x13694b,_0x209fa8),_0x25931c=join(_0xb12022,_0x56d4b7,_0x19cad8);return await mkdir(dirname(_0x25931c),{'recursive':!![]}),await rename(_0x209fa8,_0x25931c),_0x25931c;}async function cleanupEmptyDirectories(_0x349ddb,_0x58afd1){const _0x1c63c3=a193_0x31e9d3;let _0x30f88a=resolve(_0x349ddb);const _0x2ce004=resolve(_0x58afd1);while(_0x30f88a['startsWith'](''+_0x2ce004+sep)||_0x30f88a===_0x2ce004){if(_0x30f88a===_0x2ce004)return;try{const _0x2486c0=await readdir(_0x30f88a);if(_0x2486c0[_0x1c63c3(0xa6)]>0x0)return;await rmdir(_0x30f88a);}catch{return;}_0x30f88a=dirname(_0x30f88a);}}async function resolveTargetDbBinding(_0x287467,_0x237703,_0x2a4eda){const _0x562327=a193_0x31e9d3,_0x2bf75c=_0x237703[_0x562327(0xa1)];if(!_0x2bf75c)return{'dbId':_0x2a4eda[_0x562327(0x94)],'dbName':_0x2a4eda[_0x562327(0x98)]};const _0x574157=buildDbDirectoryName(_0x2a4eda[_0x562327(0x98)],_0x2a4eda['dbId']);if(_0x2bf75c===_0x574157)return{'dbId':_0x2a4eda['dbId'],'dbName':_0x2a4eda[_0x562327(0x98)]};const _0x137ba6=parseExplicitDbDirectory(_0x2bf75c);if(_0x137ba6!=null)return{'dbId':_0x137ba6,'dbName':await getDbName(_0x287467,_0x137ba6)[_0x562327(0x83)](()=>undefined)};const _0x35cdeb=await listDatabases(_0x287467),_0x58a5a1=_0x35cdeb[_0x562327(0xb0)](_0x46c99a=>buildDbDirectoryName(_0x46c99a[_0x562327(0x98)],_0x46c99a[_0x562327(0x94)])===_0x2bf75c);if(_0x58a5a1[_0x562327(0xa6)]===0x1)return{'dbId':_0x58a5a1[0x0][_0x562327(0x94)],'dbName':_0x58a5a1[0x0][_0x562327(0x98)]};if(_0x58a5a1[_0x562327(0xa6)]===0x0)throw CliErrors[_0x562327(0x93)](_0x562327(0x8e)+_0x2bf75c+'\x22\x20for\x20sqlCode\x20'+_0x237703[_0x562327(0xa8)]+'.');const _0x177e0a=_0x58a5a1[_0x562327(0x7e)](_0x5a2fab=>_0x5a2fab[_0x562327(0x98)]+'\x20('+_0x5a2fab[_0x562327(0x94)]+')')[_0x562327(0xb4)](',\x20');throw CliErrors[_0x562327(0x93)]('Local\x20directory\x20\x22'+_0x2bf75c+_0x562327(0x82)+_0x237703['sqlCode']+':\x20'+_0x177e0a);}function parseExplicitDbDirectory(_0x3be40c){const _0xd525ca=a193_0x31e9d3,_0x368507=/^db-(\d+)$/['exec'](_0x3be40c);if(!_0x368507)return null;const _0x4a67d9=Number(_0x368507[0x1]);return Number[_0xd525ca(0xae)](_0x4a67d9)&&_0x4a67d9>0x0?_0x4a67d9:null;}
|
|
1
|
+
const a193_0x5e27b5=a193_0x48d3;(function(_0xca9cb5,_0xa1c372){const _0x39f77c=a193_0x48d3,_0x2a963a=_0xca9cb5();while(!![]){try{const _0x5d4fe3=parseInt(_0x39f77c(0xf3))/0x1+parseInt(_0x39f77c(0xde))/0x2*(parseInt(_0x39f77c(0x110))/0x3)+-parseInt(_0x39f77c(0xd3))/0x4*(-parseInt(_0x39f77c(0x10f))/0x5)+parseInt(_0x39f77c(0xfb))/0x6+parseInt(_0x39f77c(0x10c))/0x7*(parseInt(_0x39f77c(0x10d))/0x8)+parseInt(_0x39f77c(0xe7))/0x9+-parseInt(_0x39f77c(0x104))/0xa;if(_0x5d4fe3===_0xa1c372)break;else _0x2a963a['push'](_0x2a963a['shift']());}catch(_0x55d071){_0x2a963a['push'](_0x2a963a['shift']());}}}(a193_0x48e8,0x79e81));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a193_0x48e8(){const _0x737e45=['sqlRoot','dbDirectory','entries','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','path','toISOString','1336626ZbSPfN','filePath','str','lockFilePath','unchanged','\x20pushed,\x20','remoteId','write','join','sqlRootDir','replace','has','63461FNyRSz','push','length','dbId','set','boolean','sqlName','POST','1095966XJffFI','appCode','\x20skipped,\x20','Local\x20directory\x20\x22','Local\x20SQL\x20not\x20found:\x20','relativePath','filter','sqlcode','mode','21728350YhRWUt','sqls','get','\x20failed','sqlCode','Would\x20push\x20','version','\x20SQL\x20file(s)','6587gpghVd','7768xNFnxt','force','5tAGyyK','6qKZgYP','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlConfig','/smartapi/custom/updateUserCustomSql','validation','bool','isFinite','Push\x20local\x20SQL\x20files\x20to\x20remote','map','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','projectRoot','1465036PiXDhn','trashDir','sql','startsWith','No\x20database\x20matches\x20local\x20directory\x20\x22','exec','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','catch','lastSync','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','\x22\x20for\x20sqlCode\x20','997558UyvcFW','utf8','dbName'];a193_0x48e8=function(){return _0x737e45;};return a193_0x48e8();}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 a193_0x48d3(_0x596f68,_0x299f86){_0x596f68=_0x596f68-0xcd;const _0x48e8c8=a193_0x48e8();let _0x48d363=_0x48e8c8[_0x596f68];return _0x48d363;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x48d447,_0xd56eb5,_0x17be02){const _0x4cb2a6=a193_0x48d3,_0x4a1946=await scanLocalSqlQueries(_0x48d447),_0x3ed23=new Map();for(const _0x588da0 of _0x4a1946){if(_0x17be02&&_0x588da0[_0x4cb2a6(0x108)]!==_0x17be02)continue;const _0x2207b3=_0x3ed23[_0x4cb2a6(0x106)](_0x588da0[_0x4cb2a6(0x108)])??[];_0x2207b3['push'](_0x588da0),_0x3ed23[_0x4cb2a6(0xf7)](_0x588da0[_0x4cb2a6(0x108)],_0x2207b3);}if(_0x17be02&&!_0x3ed23[_0x4cb2a6(0xf2)](_0x17be02))throw CliErrors['validation'](_0x4cb2a6(0xff)+_0x17be02);const _0x273146=[];for(const [_0x1bbf22,_0x3945e1]of _0x3ed23[_0x4cb2a6(0xe3)]()){if(_0x3945e1[_0x4cb2a6(0xf5)]===0x1){_0x273146['push'](_0x3945e1[0x0]);continue;}const _0x4d9cd8=_0xd56eb5[_0x4cb2a6(0x105)][_0x1bbf22],_0x532458=_0x4d9cd8?.[_0x4cb2a6(0xe5)],_0xe19b7=_0x532458?_0x3945e1[_0x4cb2a6(0x101)](_0x1f048c=>_0x1f048c[_0x4cb2a6(0x100)]!==_0x532458):_0x3945e1;if(_0x4d9cd8&&_0xe19b7[_0x4cb2a6(0xf5)]===0x1){_0x273146['push'](_0xe19b7[0x0]);continue;}throw CliErrors['validation'](_0x4cb2a6(0xdc)+_0x1bbf22+_0x4cb2a6(0x111));}return _0x273146;}export const sqlPush={'service':a193_0x5e27b5(0xd5),'command':a193_0x5e27b5(0xf4),'description':a193_0x5e27b5(0xcf),'risk':a193_0x5e27b5(0xee),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a193_0x5e27b5(0x10e),'type':a193_0x5e27b5(0xf8),'description':a193_0x5e27b5(0xd1)}],async 'dryRun'(_0xaa211d){const _0x2cb902=a193_0x5e27b5,_0x41a02a=loadSqlProjectConfig(_0xaa211d[_0x2cb902(0xfc)]),_0x91e697=await readSqlLockFile(_0x41a02a[_0x2cb902(0xea)]),{appLock:_0x3d6b8c}=ensureSqlLockScope(_0x91e697??createEmptySqlLock(),_0xaa211d[_0x2cb902(0xfc)],_0x41a02a[_0x2cb902(0xe1)],_0x2cb902(0xf4)),_0x556179=await getTargetSqlQueries(_0x41a02a,_0x3d6b8c,_0xaa211d[_0x2cb902(0xe9)](_0x2cb902(0x102))||undefined),_0x6c76c2=[];for(const _0x13b46e of _0x556179){const _0x5938f7=await computeSqlFileHash(_0x13b46e[_0x2cb902(0xe8)]),_0x28c9a6=_0x3d6b8c[_0x2cb902(0x105)][_0x13b46e[_0x2cb902(0x108)]],_0x254a94=!!_0x28c9a6&&(_0x28c9a6[_0x2cb902(0xe5)]!==_0x13b46e[_0x2cb902(0x100)]||!!_0x13b46e[_0x2cb902(0xf9)]&&_0x28c9a6[_0x2cb902(0xf9)]!==_0x13b46e[_0x2cb902(0xf9)]);if(!_0xaa211d[_0x2cb902(0xcd)](_0x2cb902(0x10e))&&_0x28c9a6&&_0x28c9a6['hash']===_0x5938f7&&!_0x254a94)continue;_0x6c76c2[_0x2cb902(0xf4)](_0x13b46e[_0x2cb902(0x108)]);}return{'method':_0x2cb902(0xfa),'url':_0x2cb902(0x113),'body':{'sqlCodes':_0x6c76c2,'appCode':_0xaa211d['appCode']},'description':_0x2cb902(0x109)+_0x6c76c2[_0x2cb902(0xf5)]+_0x2cb902(0x10b)};},async 'execute'(_0x28983c){const _0x24b2f9=a193_0x5e27b5,_0x3f0741=loadSqlProjectConfig(_0x28983c['appCode']),_0x27cad9=await readSqlLockFile(_0x3f0741[_0x24b2f9(0xea)]),{lockData:_0x142e7a,appLock:_0x454a7f}=ensureSqlLockScope(_0x27cad9??createEmptySqlLock(),_0x28983c[_0x24b2f9(0xfc)],_0x3f0741[_0x24b2f9(0xe1)],_0x24b2f9(0xf4)),_0x467402=await getTargetSqlQueries(_0x3f0741,_0x454a7f,_0x28983c[_0x24b2f9(0xe9)](_0x24b2f9(0x102))||undefined);if(_0x467402['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x4cd916=[],_0x5ef433=[],_0x2fe303=[];for(const _0x114010 of _0x467402){const _0x5abbc5=_0x454a7f[_0x24b2f9(0x105)][_0x114010[_0x24b2f9(0x108)]];if(!_0x5abbc5){_0x2fe303['push']({'sqlCode':_0x114010[_0x24b2f9(0x108)],'error':_0x24b2f9(0xd9)});continue;}try{const _0x3f908c=await computeSqlFileHash(_0x114010[_0x24b2f9(0xe8)]),_0x5e74be=_0x5abbc5[_0x24b2f9(0xe5)]!==_0x114010[_0x24b2f9(0x100)]||!!_0x114010[_0x24b2f9(0xf9)]&&_0x5abbc5['sqlName']!==_0x114010[_0x24b2f9(0xf9)];if(!_0x28983c[_0x24b2f9(0xcd)](_0x24b2f9(0x10e))&&_0x5abbc5['hash']===_0x3f908c&&!_0x5e74be){_0x5ef433[_0x24b2f9(0xf4)]({'sqlCode':_0x114010[_0x24b2f9(0x108)],'reason':_0x24b2f9(0xeb)});continue;}if(_0x5abbc5[_0x24b2f9(0x10a)]==null){_0x2fe303['push']({'sqlCode':_0x114010['sqlCode'],'error':_0x24b2f9(0xe4)});continue;}const _0x5df560=await readFile(_0x114010[_0x24b2f9(0xe8)],_0x24b2f9(0xdf)),_0x1220f5=stripLocalSqlMetadata(_0x5df560,_0x114010[_0x24b2f9(0x103)]),_0x2057d8=_0x114010[_0x24b2f9(0xf9)]||_0x5abbc5[_0x24b2f9(0xf9)],_0x890d89=await resolveTargetDbBinding(_0x28983c[_0x24b2f9(0xfc)],_0x114010,_0x5abbc5),_0x1ab299=await updateSqlQuery({'id':_0x5abbc5[_0x24b2f9(0xed)],'appCode':_0x28983c[_0x24b2f9(0xfc)],'sqlCode':_0x114010[_0x24b2f9(0x108)],'sqlName':_0x2057d8,'dbId':_0x890d89['dbId'],'version':_0x5abbc5[_0x24b2f9(0x10a)],'sqlContent':_0x1220f5,'sqlConfig':_0x5abbc5[_0x24b2f9(0x112)]??undefined}),_0xea21b9=_0x1ab299[_0x24b2f9(0xf6)]?await getDbName(_0x28983c[_0x24b2f9(0xfc)],Number(_0x1ab299[_0x24b2f9(0xf6)]))[_0x24b2f9(0xda)](()=>_0x890d89['dbName']):_0x890d89[_0x24b2f9(0xe0)];_0x454a7f[_0x24b2f9(0x105)][_0x114010['sqlCode']]={...buildSqlLockEntry(_0x1ab299,_0x1220f5,_0x3f908c,{'dbName':_0xea21b9}),'path':_0x114010[_0x24b2f9(0x100)],'mode':_0x5abbc5[_0x24b2f9(0x103)]},await archivePreviousSqlFileIfNeeded(_0x3f0741,_0x5abbc5[_0x24b2f9(0xe5)],_0x114010[_0x24b2f9(0x100)]),_0x4cd916[_0x24b2f9(0xf4)]({'sqlCode':_0x114010[_0x24b2f9(0x108)],'remoteId':_0x5abbc5['remoteId']});}catch(_0x512467){_0x2fe303[_0x24b2f9(0xf4)]({'sqlCode':_0x114010[_0x24b2f9(0x108)],'error':_0x512467 instanceof Error?_0x512467['message']:String(_0x512467)});}}return _0x454a7f[_0x24b2f9(0xdb)]=new Date()[_0x24b2f9(0xe6)](),await writeSqlLockFile(_0x3f0741[_0x24b2f9(0xea)],_0x142e7a),{'ok':_0x2fe303['length']===0x0,'data':{'pushed':_0x4cd916,'skipped':_0x5ef433,'failed':_0x2fe303},'message':'Push\x20complete:\x20'+_0x4cd916[_0x24b2f9(0xf5)]+_0x24b2f9(0xec)+_0x5ef433[_0x24b2f9(0xf5)]+_0x24b2f9(0xfd)+_0x2fe303[_0x24b2f9(0xf5)]+_0x24b2f9(0x107)};}};async function archivePreviousSqlFileIfNeeded(_0x13294d,_0x173554,_0x38f91c){const _0x472474=a193_0x5e27b5;if(!_0x173554||_0x173554===_0x38f91c)return;const _0x508f94=join(_0x13294d[_0x472474(0xf0)],_0x173554);if(!await fileExists(_0x508f94))return;const _0x3fa174=await moveToTrash(_0x13294d[_0x472474(0xd2)],_0x13294d[_0x472474(0xd4)],_0x508f94);await cleanupEmptyDirectories(dirname(_0x508f94),_0x13294d[_0x472474(0xf0)]),void _0x3fa174;}async function moveToTrash(_0x22c799,_0x39a0ba,_0x589fcf){const _0x35f591=a193_0x5e27b5,_0x1daeec=new Date()[_0x35f591(0xe6)]()[_0x35f591(0xf1)](/[:.]/g,'-'),_0x5c1ff0=relative(_0x22c799,_0x589fcf),_0x143f0b=join(_0x39a0ba,_0x1daeec,_0x5c1ff0);return await mkdir(dirname(_0x143f0b),{'recursive':!![]}),await rename(_0x589fcf,_0x143f0b),_0x143f0b;}async function cleanupEmptyDirectories(_0x568fa8,_0x22af6a){const _0x59d6e6=a193_0x5e27b5;let _0x3df0fc=resolve(_0x568fa8);const _0x220b76=resolve(_0x22af6a);while(_0x3df0fc[_0x59d6e6(0xd6)](''+_0x220b76+sep)||_0x3df0fc===_0x220b76){if(_0x3df0fc===_0x220b76)return;try{const _0x34a35a=await readdir(_0x3df0fc);if(_0x34a35a[_0x59d6e6(0xf5)]>0x0)return;await rmdir(_0x3df0fc);}catch{return;}_0x3df0fc=dirname(_0x3df0fc);}}async function resolveTargetDbBinding(_0x3e510e,_0x1b65c6,_0x1fdfc8){const _0x3edae2=a193_0x5e27b5,_0x10b23b=_0x1b65c6[_0x3edae2(0xe2)];if(!_0x10b23b)return{'dbId':_0x1fdfc8[_0x3edae2(0xf6)],'dbName':_0x1fdfc8[_0x3edae2(0xe0)]};const _0x3192b2=buildDbDirectoryName(_0x1fdfc8[_0x3edae2(0xe0)],_0x1fdfc8['dbId']);if(_0x10b23b===_0x3192b2)return{'dbId':_0x1fdfc8['dbId'],'dbName':_0x1fdfc8[_0x3edae2(0xe0)]};const _0x42431e=parseExplicitDbDirectory(_0x10b23b);if(_0x42431e!=null)return{'dbId':_0x42431e,'dbName':await getDbName(_0x3e510e,_0x42431e)[_0x3edae2(0xda)](()=>undefined)};const _0x20f145=await listDatabases(_0x3e510e),_0x140dc5=_0x20f145[_0x3edae2(0x101)](_0x50693b=>buildDbDirectoryName(_0x50693b['dbName'],_0x50693b[_0x3edae2(0xf6)])===_0x10b23b);if(_0x140dc5[_0x3edae2(0xf5)]===0x1)return{'dbId':_0x140dc5[0x0][_0x3edae2(0xf6)],'dbName':_0x140dc5[0x0]['dbName']};if(_0x140dc5['length']===0x0)throw CliErrors['validation'](_0x3edae2(0xd7)+_0x10b23b+_0x3edae2(0xdd)+_0x1b65c6[_0x3edae2(0x108)]+'.');const _0xa65b24=_0x140dc5[_0x3edae2(0xd0)](_0x594d0e=>_0x594d0e[_0x3edae2(0xe0)]+'\x20('+_0x594d0e[_0x3edae2(0xf6)]+')')[_0x3edae2(0xef)](',\x20');throw CliErrors[_0x3edae2(0x114)](_0x3edae2(0xfe)+_0x10b23b+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x1b65c6[_0x3edae2(0x108)]+':\x20'+_0xa65b24);}function parseExplicitDbDirectory(_0x569bb1){const _0x1d023d=a193_0x5e27b5,_0x4e5b90=/^db-(\d+)$/[_0x1d023d(0xd8)](_0x569bb1);if(!_0x4e5b90)return null;const _0x5ba52a=Number(_0x4e5b90[0x1]);return Number[_0x1d023d(0xce)](_0x5ba52a)&&_0x5ba52a>0x0?_0x5ba52a:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x203904=a194_0x3128;(function(_0x2f0b1e,_0x26f93b){const _0x16da1a=a194_0x3128,_0x587d40=_0x2f0b1e();while(!![]){try{const _0x56fca1=parseInt(_0x16da1a(0xa1))/0x1*(-parseInt(_0x16da1a(0xb3))/0x2)+-parseInt(_0x16da1a(0x9b))/0x3+parseInt(_0x16da1a(0x99))/0x4*(parseInt(_0x16da1a(0x94))/0x5)+-parseInt(_0x16da1a(0x9e))/0x6+-parseInt(_0x16da1a(0xa2))/0x7+-parseInt(_0x16da1a(0x9c))/0x8*(-parseInt(_0x16da1a(0x91))/0x9)+parseInt(_0x16da1a(0xac))/0xa;if(_0x56fca1===_0x26f93b)break;else _0x587d40['push'](_0x587d40['shift']());}catch(_0x2685c2){_0x587d40['push'](_0x587d40['shift']());}}}(a194_0x5d1b,0x2e803));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a194_0x203904(0xb5);export function buildSqlLockEntry(_0x114091,_0x44572b,_0x5d6409,_0x21d2d9){const _0x104031=a194_0x203904,_0x40cbf7=detectSqlMode(_0x44572b);return{'path':buildSqlRelativePath(_0x114091['sqlCode'],_0x114091[_0x104031(0x96)],_0x21d2d9?.[_0x104031(0x9d)],_0x40cbf7,_0x114091[_0x104031(0xaa)]),'hash':_0x5d6409,'remoteId':_0x114091['id'],'version':_0x114091[_0x104031(0xb4)],'dbId':Number(_0x114091[_0x104031(0xaa)]),'dbName':_0x21d2d9?.[_0x104031(0x9d)],'sqlName':_0x114091[_0x104031(0x96)],'sqlConfig':_0x114091[_0x104031(0x98)]??undefined,'mode':_0x40cbf7};}export function cloneSqlLockData(_0x312b70){const _0x2d1998=a194_0x203904;return{'apps':Object['fromEntries'](Object[_0x2d1998(0xb1)](_0x312b70[_0x2d1998(0xb2)])[_0x2d1998(0xa5)](([_0xe05c8f,_0x42df05])=>[_0xe05c8f,{'sqlRoot':_0x42df05[_0x2d1998(0x92)],'lastSync':_0x42df05[_0x2d1998(0xa4)],'sqls':{..._0x42df05[_0x2d1998(0xa8)]}}]))};}export function ensureRemoteSqlContent(_0x5864c4){const _0x442fb2=a194_0x203904;return _0x5864c4[_0x442fb2(0x97)]??'';}export function buildLocalSqlFileContent(_0x340d11,_0x58d088,_0x4375b7){const _0x16ab09=a194_0x203904,_0x586a35=_0x4375b7?.['mode']??detectSqlMode(_0x58d088),_0xd13f4=stripLocalSqlMetadata(_0x58d088,_0x586a35)[_0x16ab09(0xab)](),_0x2a286c=[...buildMetadataHeaderLines({'sqlCode':_0x340d11[_0x16ab09(0x95)],'sqlName':_0x340d11[_0x16ab09(0x96)],'dbId':_0x340d11[_0x16ab09(0xaa)],'dbName':_0x4375b7?.[_0x16ab09(0x9d)],'mode':_0x586a35,'syncedAt':_0x4375b7?.[_0x16ab09(0x8f)],'description':_0x4375b7?.[_0x16ab09(0xaf)]},_0x586a35),'',_0xd13f4],_0xf591e3=_0x2a286c[_0x16ab09(0xa6)]('\x0a');return _0xf591e3[_0x16ab09(0xad)]('\x0a')?_0xf591e3:_0xf591e3+'\x0a';}export function stripLocalSqlMetadata(_0x5686bb,_0x3bce7c){const _0xfabeac=a194_0x203904,_0x58123d=_0x5686bb[_0xfabeac(0xae)](/\r\n/g,'\x0a')['split']('\x0a'),_0x238904=[];let _0x37f0b0=0x0;if(_0x3bce7c===_0xfabeac(0x8e))while(_0x37f0b0<_0x58123d[_0xfabeac(0xb0)]){const _0x3164e6=_0x58123d[_0x37f0b0]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x3164e6)){_0x37f0b0++;continue;}if(_0x3164e6[_0xfabeac(0xab)]()===''&&_0x37f0b0>0x0){_0x37f0b0++;continue;}break;}else while(_0x37f0b0<_0x58123d['length']){const _0x3d8448=_0x58123d[_0x37f0b0]??'';if(/^\s*--\s*@lovrabet\./[_0xfabeac(0x8c)](_0x3d8448)){_0x37f0b0++;continue;}if(_0x3d8448[_0xfabeac(0xab)]()===''&&_0x37f0b0>0x0){_0x37f0b0++;continue;}break;}for(;_0x37f0b0<_0x58123d['length'];_0x37f0b0++){_0x238904[_0xfabeac(0xa9)](_0x58123d[_0x37f0b0]);}return _0x238904[_0xfabeac(0xa6)]('\x0a')[_0xfabeac(0xa3)]();}export function resolveSqlMode(_0x540df1,_0x439f5c){const _0x34e5a8=a194_0x203904;if(_0x439f5c?.['mode'])return _0x439f5c[_0x34e5a8(0x90)];return detectSqlMode(_0x540df1);}export function resolveSqlFileName(_0x44b52d,_0x453728,_0x48a70d){const _0x18880b=a194_0x203904;if(_0x48a70d?.['path'])return _0x48a70d[_0x18880b(0xa7)];if(_0x48a70d?.[_0x18880b(0x96)]||_0x48a70d?.[_0x18880b(0x9d)])return buildSqlRelativePath(_0x44b52d,_0x48a70d?.[_0x18880b(0x96)],_0x48a70d?.[_0x18880b(0x9d)],resolveSqlMode(_0x453728,_0x48a70d),_0x48a70d?.['dbId']);return buildDefaultSqlFileName(_0x44b52d,resolveSqlMode(_0x453728,_0x48a70d));}export function resolveSqlLocalDir(_0x4171f2,_0x4c53cb){return join(_0x4171f2,SQL_LOCAL_REL_DIR,_0x4c53cb);}export async function confirmForceOverwrite(_0x3b5bfc){const _0x2a38bc=a194_0x203904,_0x2248fb=createInterface({'input':process[_0x2a38bc(0x8d)],'output':process[_0x2a38bc(0x93)]}),_0x4b9986=await new Promise(_0x284a2e=>{_0x2248fb['question'](_0x3b5bfc+'\x20[y/N]\x20',_0x284a2e);});return _0x2248fb['close'](),['y','yes'][_0x2a38bc(0x9f)](_0x4b9986[_0x2a38bc(0xab)]()[_0x2a38bc(0xa0)]());}function a194_0x5d1b(){const _0x387f2a=['sqls','push','dbId','trim','8121830QysTgI','endsWith','replace','description','length','entries','apps','396632TScafP','version','.rabetbase/sql','test','stdin','mybatisXml','syncedAt','mode','333810GQKdON','sqlRoot','stderr','75pCORoU','sqlCode','sqlName','sqlContent','sqlConfig','5532PKEQiR','\x20-->','363954MhXNhD','40qiCSOI','dbName','1198620WGwNxk','includes','toLowerCase','1LqLIpe','2159549WNUJLj','trimStart','lastSync','map','join','path'];a194_0x5d1b=function(){return _0x387f2a;};return a194_0x5d1b();}export function findSqlLockScope(_0x346c50,_0x112967){return _0x346c50['apps'][_0x112967];}function a194_0x3128(_0x2b7d9d,_0x23cb31){_0x2b7d9d=_0x2b7d9d-0x8c;const _0x5d1b2f=a194_0x5d1b();let _0x31287e=_0x5d1b2f[_0x2b7d9d];return _0x31287e;}function buildMetadataHeaderLines(_0x323803,_0x40a16d){const _0x5ef6b1=a194_0x203904,_0x2a78cb=[['sqlCode',_0x323803['sqlCode']],[_0x5ef6b1(0x96),_0x323803[_0x5ef6b1(0x96)]],['dbId',_0x323803[_0x5ef6b1(0xaa)]],['dbName',_0x323803[_0x5ef6b1(0x9d)]],[_0x5ef6b1(0x90),_0x323803[_0x5ef6b1(0x90)]],[_0x5ef6b1(0x8f),_0x323803[_0x5ef6b1(0x8f)]],[_0x5ef6b1(0xaf),_0x323803[_0x5ef6b1(0xaf)]]];if(_0x40a16d==='mybatisXml')return _0x2a78cb['filter'](([,_0x1df49f])=>_0x1df49f!==undefined&&_0x1df49f!==null&&String(_0x1df49f)[_0x5ef6b1(0xab)]()!=='')[_0x5ef6b1(0xa5)](([_0x1d4674,_0x4b12e1])=>'<!--\x20@lovrabet.'+_0x1d4674+':\x20'+String(_0x4b12e1)+_0x5ef6b1(0x9a));return _0x2a78cb['filter'](([,_0x10e61c])=>_0x10e61c!==undefined&&_0x10e61c!==null&&String(_0x10e61c)['trim']()!=='')[_0x5ef6b1(0xa5)](([_0x2a8ecf,_0x129ab2])=>'--\x20@lovrabet.'+_0x2a8ecf+':\x20'+String(_0x129ab2));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a195_0x2596(){const _0x1ccfb0=['boolean','56892anGBfd','861755NUcrki','remote','lockFilePath','445856ipWhJx','relativePath','status','All\x20SQL\x20queries\x20are\x20in\x20sync.','read','lockKey','\x20remote-only','keys','540504gJoeuI','sqls','sql','sqlRoot','bool','path','length','4690jSZqrI','push','map','sqlName','\x20missing,\x20','has','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','446258srqvCb','appCode','totalCount','\x20unchanged','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','filePath','sqlCode','2672Sybdzh','336198CNFohJ'];a195_0x2596=function(){return _0x1ccfb0;};return a195_0x2596();}const a195_0x578fd2=a195_0x45c9;(function(_0x4523a9,_0x355bcc){const _0x1732ba=a195_0x45c9,_0x24fc88=_0x4523a9();while(!![]){try{const _0x17bf1d=parseInt(_0x1732ba(0x109))/0x1+-parseInt(_0x1732ba(0xff))/0x2+parseInt(_0x1732ba(0xf1))/0x3+parseInt(_0x1732ba(0xe9))/0x4+-parseInt(_0x1732ba(0x10a))/0x5+-parseInt(_0x1732ba(0x107))/0x6+-parseInt(_0x1732ba(0xf8))/0x7*(-parseInt(_0x1732ba(0x106))/0x8);if(_0x17bf1d===_0x355bcc)break;else _0x24fc88['push'](_0x24fc88['shift']());}catch(_0x348905){_0x24fc88['push'](_0x24fc88['shift']());}}}(a195_0x2596,0x1d7d7));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a195_0x45c9(_0x321bde,_0xbe1547){_0x321bde=_0x321bde-0xe7;const _0x259646=a195_0x2596();let _0x45c9dc=_0x259646[_0x321bde];return _0x45c9dc;}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(_0x34870a){const _0x3bd849=a195_0x45c9,_0x3c5ff9=[];let _0x45c997=0x1;while(!![]){const _0x227835=await listSqlQueries(_0x34870a,{'currentPage':_0x45c997,'pageSize':PAGE_SIZE}),_0x2ade70=_0x227835['tableData']??[];_0x3c5ff9['push'](..._0x2ade70[_0x3bd849(0xfa)](_0x20ccb9=>_0x20ccb9[_0x3bd849(0x105)]));if(_0x2ade70['length']===0x0)break;const _0x19b5fe=_0x227835['paging']?.[_0x3bd849(0x101)];if(_0x19b5fe!=null?_0x3c5ff9[_0x3bd849(0xf7)]>=_0x19b5fe:_0x2ade70[_0x3bd849(0xf7)]<PAGE_SIZE)break;_0x45c997++;}return _0x3c5ff9;}export const sqlStatus={'service':a195_0x578fd2(0xf3),'command':a195_0x578fd2(0xeb),'description':a195_0x578fd2(0x103),'risk':a195_0x578fd2(0xed),'flags':[{'name':a195_0x578fd2(0xe7),'type':a195_0x578fd2(0x108),'description':a195_0x578fd2(0xfe)}],async 'execute'(_0x26a978){const _0x42ed41=a195_0x578fd2,_0x2e6386=loadSqlProjectConfig(_0x26a978[_0x42ed41(0x100)]),_0x3963e3=await readSqlLockFile(_0x2e6386[_0x42ed41(0xe8)]),{appLock:_0x104317}=ensureSqlLockScope(_0x3963e3??createEmptySqlLock(),_0x2e6386[_0x42ed41(0x100)],_0x2e6386[_0x42ed41(0xf4)],_0x42ed41(0xeb)),_0x153589=await scanLocalSqlQueries(_0x2e6386),_0xe76e6e=[],_0x1226c1=[],_0x1e40bc=[],_0x551559=[],_0x2b25c2=new Set(_0x153589[_0x42ed41(0xfa)](_0x5d1f75=>_0x5d1f75[_0x42ed41(0xee)]));for(const _0x54940b of _0x153589){const _0x5779fd=await computeSqlFileHash(_0x54940b[_0x42ed41(0x104)]),_0x4e5ca4=_0x104317[_0x42ed41(0xf2)][_0x54940b['lockKey']],_0x2fc0c6=!!_0x4e5ca4&&_0x4e5ca4[_0x42ed41(0xf6)]!==_0x54940b[_0x42ed41(0xea)],_0x2458ed=!!_0x4e5ca4&&!!_0x54940b[_0x42ed41(0xfb)]&&_0x4e5ca4[_0x42ed41(0xfb)]!==_0x54940b[_0x42ed41(0xfb)];if(!_0x4e5ca4)_0xe76e6e['push'](_0x54940b['lockKey']);else _0x4e5ca4['hash']!==_0x5779fd||_0x2fc0c6||_0x2458ed?_0x1226c1[_0x42ed41(0xf9)](_0x54940b[_0x42ed41(0xee)]):_0x1e40bc['push'](_0x54940b[_0x42ed41(0xee)]);}for(const _0x50dc78 of Object[_0x42ed41(0xf0)](_0x104317[_0x42ed41(0xf2)])){!_0x2b25c2[_0x42ed41(0xfd)](_0x50dc78)&&_0x551559[_0x42ed41(0xf9)](_0x50dc78);}const _0x5973c9=[];if(_0x26a978[_0x42ed41(0xf5)](_0x42ed41(0xe7))){const _0x438d54=await fetchAllSqlCodes(_0x26a978[_0x42ed41(0x100)]);for(const _0x35e2bc of _0x438d54){!_0x2b25c2['has'](_0x35e2bc)&&!_0x104317[_0x42ed41(0xf2)][_0x35e2bc]&&_0x5973c9[_0x42ed41(0xf9)](_0x35e2bc);}}const _0x29e8f2=_0xe76e6e[_0x42ed41(0xf7)]===0x0&&_0x1226c1[_0x42ed41(0xf7)]===0x0&&_0x551559[_0x42ed41(0xf7)]===0x0&&_0x5973c9[_0x42ed41(0xf7)]===0x0;return{'ok':!![],'data':{'added':_0xe76e6e,'modified':_0x1226c1,'missing':_0x551559,'unchanged':_0x1e40bc,'remoteOnly':_0x5973c9},'message':_0x29e8f2?_0x42ed41(0xec):_0xe76e6e[_0x42ed41(0xf7)]+'\x20added,\x20'+_0x1226c1[_0x42ed41(0xf7)]+'\x20modified,\x20'+_0x551559[_0x42ed41(0xf7)]+_0x42ed41(0xfc)+_0x1e40bc[_0x42ed41(0xf7)]+_0x42ed41(0x102)+(_0x5973c9[_0x42ed41(0xf7)]>0x0?',\x20'+_0x5973c9['length']+_0x42ed41(0xef):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a196_0x2674c1=a196_0x5ee3;function a196_0x5ee3(_0x3a3a1f,_0x401424){_0x3a3a1f=_0x3a3a1f-0x142;const _0x330031=a196_0x3300();let _0x5ee313=_0x330031[_0x3a3a1f];return _0x5ee313;}(function(_0x4199fa,_0x1c53ae){const _0x53505a=a196_0x5ee3,_0x392c8c=_0x4199fa();while(!![]){try{const _0x124ea8=parseInt(_0x53505a(0x160))/0x1*(parseInt(_0x53505a(0x173))/0x2)+parseInt(_0x53505a(0x147))/0x3*(-parseInt(_0x53505a(0x14b))/0x4)+-parseInt(_0x53505a(0x16f))/0x5*(-parseInt(_0x53505a(0x181))/0x6)+-parseInt(_0x53505a(0x179))/0x7+-parseInt(_0x53505a(0x167))/0x8*(parseInt(_0x53505a(0x17b))/0x9)+parseInt(_0x53505a(0x182))/0xa*(parseInt(_0x53505a(0x163))/0xb)+-parseInt(_0x53505a(0x15c))/0xc*(-parseInt(_0x53505a(0x14f))/0xd);if(_0x124ea8===_0x1c53ae)break;else _0x392c8c['push'](_0x392c8c['shift']());}catch(_0x470cae){_0x392c8c['push'](_0x392c8c['shift']());}}}(a196_0x3300,0x3bf9b));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';function a196_0x3300(){const _0x244bec=['columnNames','fields','boolean','tableName','9hCDdwX','indexes','indexName','unshift','491820NCwBcj','type','validate','validation','52esCeqj','string','pkField','valid','index_type','sqlType','columns','Dataset\x20\x22','str','flatMap','filter','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','1049340RYgYAC','isArray','\x22\x20not\x20found\x20or\x20not\x20accessible','sql','52eENVfu','map','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','4805779gxEMgB','dataset','toLowerCase','dbtableConfig','1009456dMyHiM','trim','read','check-indexes','\x22\x20not\x20found\x20in\x20any\x20dataset','reason','bool','push','76060DzCJgg','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','schema:','File\x20not\x20found:\x20','17870OVsZWi','index_columns','tables','find','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','Provide\x20--file\x20or\x20--sql','1914017HqZrVy','--check-indexes\x20requires\x20--schemas.','27NlcRwM','utf-8','Table\x20\x22','name','appCode','schemaWarnings','6zEQEgX','10XjGgFg','isSelectOnly','message','file','length','split','schemas'];a196_0x3300=function(){return _0x244bec;};return a196_0x3300();}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':'sql','command':a196_0x2674c1(0x14d),'description':a196_0x2674c1(0x15a),'risk':a196_0x2674c1(0x169),'flags':[{'name':a196_0x2674c1(0x185),'type':'string','description':a196_0x2674c1(0x177)},{'name':a196_0x2674c1(0x15f),'type':'string','description':a196_0x2674c1(0x15b)},{'name':a196_0x2674c1(0x142),'type':a196_0x2674c1(0x150),'description':a196_0x2674c1(0x162)},{'name':a196_0x2674c1(0x16a),'type':a196_0x2674c1(0x145),'description':a196_0x2674c1(0x170)}],async 'execute'(_0x5c8d16){const _0x5c5001=a196_0x2674c1,_0x3625cd=_0x5c8d16[_0x5c5001(0x157)]('file'),_0x3a6e1=_0x5c8d16['str'](_0x5c5001(0x15f)),_0x19f568=_0x5c8d16[_0x5c5001(0x157)](_0x5c5001(0x142)),_0x453bec=_0x5c8d16[_0x5c5001(0x16d)]('check-indexes');if(!_0x3625cd&&!_0x3a6e1)throw CliErrors['flagMissing'](_0x5c5001(0x185),_0x5c5001(0x178));if(_0x453bec&&!_0x19f568)throw CliErrors[_0x5c5001(0x14e)](_0x5c5001(0x17a));let _0x30bd44;if(_0x3625cd){const _0x2f9383=resolve(process['cwd'](),_0x3625cd);if(!existsSync(_0x2f9383))throw CliErrors['validation'](_0x5c5001(0x172)+_0x2f9383);_0x30bd44=readFileSync(_0x2f9383,_0x5c5001(0x17c));}else _0x30bd44=_0x3a6e1;const _0x52e73f=validateSql(_0x30bd44),_0x49be1f={'valid':_0x52e73f['valid'],'sqlType':_0x52e73f[_0x5c5001(0x154)][_0x5c5001(0x14c)],'isSelectOnly':_0x52e73f['sqlType'][_0x5c5001(0x183)],'isDangerous':_0x52e73f[_0x5c5001(0x154)]['isDangerous'],'tables':_0x52e73f['tables'],'parameters':_0x52e73f['parameters'],'message':_0x52e73f['message']};_0x52e73f[_0x5c5001(0x154)][_0x5c5001(0x16c)]&&(_0x49be1f['reason']=_0x52e73f[_0x5c5001(0x154)][_0x5c5001(0x16c)]);if(_0x19f568&&_0x52e73f[_0x5c5001(0x152)]){const _0x34a53f=_0x19f568[_0x5c5001(0x187)](',')[_0x5c5001(0x161)](_0x35c959=>_0x35c959[_0x5c5001(0x168)]())[_0x5c5001(0x159)](Boolean),_0x39241e=[],_0xf56022=[],_0x15d3e6=filterDbTableBackedDatasets(await listDatasets(_0x5c8d16[_0x5c5001(0x17f)])),_0x12de23=new Map(_0x15d3e6['map'](_0x316459=>[_0x316459[_0x5c5001(0x166)]?.[_0x5c5001(0x146)]?.['toLowerCase'](),_0x316459]));for(const _0x4eaa60 of _0x52e73f[_0x5c5001(0x175)]){const _0x942d96=_0x12de23['get'](_0x4eaa60[_0x5c5001(0x165)]());!_0x942d96&&_0x39241e[_0x5c5001(0x16e)](_0x5c5001(0x17d)+_0x4eaa60+_0x5c5001(0x16b));}for(const _0x3e7439 of _0x34a53f){let _0x54a61b;try{_0x54a61b=await getDatasetDetail(_0x3e7439);}catch{_0x39241e['push'](_0x5c5001(0x156)+_0x3e7439+_0x5c5001(0x15e));continue;}assertDatasetIsDbTableBacked(_0x54a61b,'SQL\x20schema\x20validation');const _0xa1da25=Array['isArray'](_0x54a61b[_0x5c5001(0x144)])?_0x54a61b['fields']:[],_0x14390e=new Set(_0xa1da25[_0x5c5001(0x161)](_0x4e762a=>_0x4e762a['name']?.['toLowerCase']())),_0x48e7da=_0x54a61b[_0x5c5001(0x166)]?.[_0x5c5001(0x146)]||_0x54a61b[_0x5c5001(0x146)]||_0x3e7439;_0x49be1f[_0x5c5001(0x171)+_0x48e7da]={'code':_0x3e7439,'tableName':_0x48e7da,'fieldCount':_0x14390e['size'],'fields':Array['from'](_0x14390e)};if(_0x453bec){const _0x4f9c=normalizeDatasetIndexes(_0x54a61b);_0xf56022[_0x5c5001(0x16e)]({'tableName':_0x48e7da,..._0x4f9c});}}_0x39241e[_0x5c5001(0x186)]>0x0&&(_0x49be1f[_0x5c5001(0x180)]=_0x39241e),_0x453bec&&(_0x49be1f['joinAudit']=auditSqlJoinIndexes(_0x30bd44,_0xf56022));}return{'ok':_0x52e73f[_0x5c5001(0x152)],'data':_0x49be1f,'message':_0x52e73f[_0x5c5001(0x184)]};}};function normalizeDatasetIndexes(_0x51c745){const _0xc03637=a196_0x2674c1,_0x14c9a3=Array[_0xc03637(0x15d)](_0x51c745?.[_0xc03637(0x164)]?.[_0xc03637(0x148)])?_0x51c745[_0xc03637(0x164)][_0xc03637(0x148)]:Array[_0xc03637(0x15d)](_0x51c745?.[_0xc03637(0x148)])?_0x51c745[_0xc03637(0x148)]:[],_0x1aac86=_0x14c9a3[_0xc03637(0x158)](_0x286fa5=>{const _0x579c09=_0xc03637,_0x530d17=Array[_0x579c09(0x15d)](_0x286fa5?.[_0x579c09(0x174)])?_0x286fa5[_0x579c09(0x174)]:Array[_0x579c09(0x15d)](_0x286fa5?.[_0x579c09(0x143)])?_0x286fa5[_0x579c09(0x143)]:Array[_0x579c09(0x15d)](_0x286fa5?.['columns'])?_0x286fa5[_0x579c09(0x155)]:[],_0x374c38=_0x530d17[_0x579c09(0x159)](_0x6cd7b1=>typeof _0x6cd7b1===_0x579c09(0x150))['map'](_0x5e78d7=>_0x5e78d7[_0x579c09(0x168)]())[_0x579c09(0x159)](Boolean);if(_0x374c38[_0x579c09(0x186)]===0x0)return[];const _0x176648=[_0x286fa5?.[_0x579c09(0x149)],_0x286fa5?.['index_name'],_0x286fa5?.[_0x579c09(0x17e)]][_0x579c09(0x176)](_0x5ccd7e=>typeof _0x5ccd7e===_0x579c09(0x150)&&_0x5ccd7e[_0x579c09(0x168)]()),_0x54a5e8=[_0x286fa5?.[_0x579c09(0x153)],_0x286fa5?.[_0x579c09(0x14c)]][_0x579c09(0x176)](_0x50edf7=>typeof _0x50edf7===_0x579c09(0x150)&&_0x50edf7[_0x579c09(0x168)]());return[{..._0x176648?{'name':_0x176648[_0x579c09(0x168)]()}:{},..._0x54a5e8?{'type':_0x54a5e8['trim']()}:{},'columns':_0x374c38}];}),_0x2620fd=[..._0x1aac86],_0x58d790=typeof _0x51c745?.[_0xc03637(0x166)]?.[_0xc03637(0x151)]===_0xc03637(0x150)?_0x51c745[_0xc03637(0x166)][_0xc03637(0x151)][_0xc03637(0x187)](',')[_0xc03637(0x161)](_0x1fcc22=>_0x1fcc22[_0xc03637(0x168)]())[_0xc03637(0x159)](Boolean):[];return _0x58d790[_0xc03637(0x186)]>0x0&&_0x2620fd[_0xc03637(0x14a)]({'type':'primary','columns':_0x58d790}),{'indexes':_0x2620fd,'metadataAvailable':_0x1aac86[_0xc03637(0x186)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a197_0x7271(_0x24289d,_0x4d87fb){_0x24289d=_0x24289d-0x85;const _0x40579f=a197_0x4057();let _0x72710=_0x40579f[_0x24289d];return _0x72710;}(function(_0x2bd533,_0x42af76){const _0x385ac8=a197_0x7271,_0x173784=_0x2bd533();while(!![]){try{const _0x33b46b=-parseInt(_0x385ac8(0x89))/0x1*(-parseInt(_0x385ac8(0x86))/0x2)+-parseInt(_0x385ac8(0x8c))/0x3*(-parseInt(_0x385ac8(0x87))/0x4)+parseInt(_0x385ac8(0x8a))/0x5*(-parseInt(_0x385ac8(0x8f))/0x6)+parseInt(_0x385ac8(0x85))/0x7*(parseInt(_0x385ac8(0x88))/0x8)+-parseInt(_0x385ac8(0x8b))/0x9+-parseInt(_0x385ac8(0x8e))/0xa+-parseInt(_0x385ac8(0x8d))/0xb;if(_0x33b46b===_0x42af76)break;else _0x173784['push'](_0x173784['shift']());}catch(_0x15a4a4){_0x173784['push'](_0x173784['shift']());}}}(a197_0x4057,0x7ef3e));import{taskStatus}from'../../commands/task/status.js';function a197_0x4057(){const _0xffbfa9=['3414CasUYs','190612XQgKeF','699592ANADBZ','19xIkYJk','5485bXiFhq','93474kpwniE','51rpZJVM','11134255TeUFtX','1861910dDmUki','414RXZEKt','77UQflNg'];a197_0x4057=function(){return _0xffbfa9;};return a197_0x4057();}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a198_0x2c6eb4=a198_0xe0e9;(function(_0xe7c3a9,_0x5f2ed3){const _0x2528c0=a198_0xe0e9,_0x3a63d7=_0xe7c3a9();while(!![]){try{const _0x3125e5=parseInt(_0x2528c0(0xcb))/0x1*(-parseInt(_0x2528c0(0xc3))/0x2)+parseInt(_0x2528c0(0xbd))/0x3+parseInt(_0x2528c0(0xba))/0x4+-parseInt(_0x2528c0(0xc1))/0x5*(-parseInt(_0x2528c0(0xc0))/0x6)+-parseInt(_0x2528c0(0xcf))/0x7*(-parseInt(_0x2528c0(0xbe))/0x8)+parseInt(_0x2528c0(0xb8))/0x9+-parseInt(_0x2528c0(0xcc))/0xa*(parseInt(_0x2528c0(0xc5))/0xb);if(_0x3125e5===_0x5f2ed3)break;else _0x3a63d7['push'](_0x3a63d7['shift']());}catch(_0x4dc9b6){_0x3a63d7['push'](_0x3a63d7['shift']());}}}(a198_0x3c9c,0xdddd0));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a198_0xe0e9(_0x5bf9d0,_0x2d757b){_0x5bf9d0=_0x5bf9d0-0xb8;const _0x3c9c2b=a198_0x3c9c();let _0xe0e9d3=_0x3c9c2b[_0x5bf9d0];return _0xe0e9d3;}import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':a198_0x2c6eb4(0xc6),'description':'Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','risk':'read','defaultOutputFormat':a198_0x2c6eb4(0xc8),'structuredErrors':!![],'flags':[{'name':'task-id','type':a198_0x2c6eb4(0xbc),'required':!![],'description':a198_0x2c6eb4(0xc9)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3175c0){const _0x32cd91=a198_0x2c6eb4;if(!_0x3175c0[_0x32cd91(0xbb)]('task-id')[_0x32cd91(0xc2)]())throw CliErrors[_0x32cd91(0xb9)](_0x32cd91(0xca));},async 'execute'(_0x50d280){const _0x506ee1=a198_0x2c6eb4,_0x35828d=_0x50d280[_0x506ee1(0xbb)](_0x506ee1(0xca))[_0x506ee1(0xc2)](),_0x4fd109=normalizeAsyncTask(await getAsyncTaskStatus(_0x35828d,_0x50d280[_0x506ee1(0xce)],_0x50d280[_0x506ee1(0xcd)]));if(_0x4fd109[_0x506ee1(0xc7)]!==_0x35828d)throw CliErrors['apiError'](_0x506ee1(0xc4)+_0x35828d+',\x20received\x20'+_0x4fd109[_0x506ee1(0xc7)]+'.');const _0x4d9e1e=buildAsyncTaskStatusCommand(_0x4fd109[_0x506ee1(0xc7)],_0x50d280[_0x506ee1(0xce)]);return{'ok':!![],'message':asyncTaskMessage(_0x4fd109),'data':{'appCode':_0x50d280[_0x506ee1(0xce)],..._0x4fd109,'query':_0x4fd109[_0x506ee1(0xbf)]?null:{'command':_0x4d9e1e}}};}};function a198_0x3c9c(){const _0x5a8da5=['flagMissing','5821200XBciMG','str','string','3838863TrTiUh','232LINRqP','isTerminal','6BdpaLQ','72115ZYedYo','trim','4iZcfoG','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','5665rqkLId','status','taskId','compress','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','task-id','640364HQwqjJ','30250qOfPLk','cookie','appCode','236593eSxVBc','160560fBZTrW'];a198_0x3c9c=function(){return _0x5a8da5;};return a198_0x3c9c();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a199_0x9ec9(_0x3fedf5,_0x596b0f){_0x3fedf5=_0x3fedf5-0x66;const _0x51014e=a199_0x5101();let _0x9ec9c4=_0x51014e[_0x3fedf5];return _0x9ec9c4;}(function(_0x1cc587,_0x34e8eb){const _0x298ae7=a199_0x9ec9,_0x43e9d8=_0x1cc587();while(!![]){try{const _0x37a05e=-parseInt(_0x298ae7(0x6e))/0x1+parseInt(_0x298ae7(0x6d))/0x2*(-parseInt(_0x298ae7(0x6c))/0x3)+-parseInt(_0x298ae7(0x68))/0x4+parseInt(_0x298ae7(0x6b))/0x5+-parseInt(_0x298ae7(0x6a))/0x6+-parseInt(_0x298ae7(0x67))/0x7*(parseInt(_0x298ae7(0x69))/0x8)+parseInt(_0x298ae7(0x66))/0x9;if(_0x37a05e===_0x34e8eb)break;else _0x43e9d8['push'](_0x43e9d8['shift']());}catch(_0xcee77){_0x43e9d8['push'](_0x43e9d8['shift']());}}}(a199_0x5101,0x1fe52));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];function a199_0x5101(){const _0x1aeea8=['7245HNfCgv','3263067RyLnRG','22904AhFTRV','358544sSIwAX','416hPppeC','548442WqXZLs','1258785UwQDPk','17079zzpbCD','44TQankZ'];a199_0x5101=function(){return _0x1aeea8;};return a199_0x5101();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a200_0x521102=a200_0xfe41;function a200_0x1e06(){const _0x1f6107=['4234965RzONfm','47122WsXRdf','Exact\x20tenant\x20code','\x20tenant\x20member(s)','trim','flagMissing','21GKHJhB','Found\x20','members-list','5787387PZSnUs','232323bnyWGf','length','4623642vSpAtx','read','838060pGVDoq','259208BUGSiP','Pass\x20--tenant-code\x20<code>.','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','str','tenant-code','5yggUwV','string'];a200_0x1e06=function(){return _0x1f6107;};return a200_0x1e06();}(function(_0x155694,_0x3c792d){const _0x4f6ae1=a200_0xfe41,_0xada0d6=_0x155694();while(!![]){try{const _0x1e28f0=-parseInt(_0x4f6ae1(0x16a))/0x1+parseInt(_0x4f6ae1(0x177))/0x2*(parseInt(_0x4f6ae1(0x166))/0x3)+parseInt(_0x4f6ae1(0x16e))/0x4*(-parseInt(_0x4f6ae1(0x174))/0x5)+parseInt(_0x4f6ae1(0x16c))/0x6+parseInt(_0x4f6ae1(0x176))/0x7+-parseInt(_0x4f6ae1(0x16f))/0x8+-parseInt(_0x4f6ae1(0x169))/0x9;if(_0x1e28f0===_0x3c792d)break;else _0xada0d6['push'](_0xada0d6['shift']());}catch(_0x2e2e7c){_0xada0d6['push'](_0xada0d6['shift']());}}}(a200_0x1e06,0x6754f));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a200_0xfe41(_0x3afa8f,_0x156879){_0x3afa8f=_0x3afa8f-0x165;const _0x1e06ea=a200_0x1e06();let _0xfe417c=_0x1e06ea[_0x3afa8f];return _0xfe417c;}import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':'tenant','command':a200_0x521102(0x168),'description':a200_0x521102(0x171),'risk':a200_0x521102(0x16d),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a200_0x521102(0x173),'type':a200_0x521102(0x175),'required':!![],'description':a200_0x521102(0x178)}],async 'validate'(_0x1ddd78){const _0x231337=a200_0x521102;if(!_0x1ddd78['str'](_0x231337(0x173))[_0x231337(0x17a)]())throw CliErrors[_0x231337(0x165)](_0x231337(0x173),_0x231337(0x170));},async 'execute'(_0xfbe065){const _0x42d35d=a200_0x521102,_0x1471e5=_0xfbe065[_0x42d35d(0x172)](_0x42d35d(0x173))[_0x42d35d(0x17a)](),_0x29f342=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x1471e5,_0x29f342);const _0x1aaee1=projectTenantMembers(await listTenantDirectoryMembers(_0x1471e5));return{'ok':!![],'data':{'tenantCode':_0x1471e5,'items':_0x1aaee1,'totalCount':_0x1aaee1[_0x42d35d(0x16b)]},'message':_0x42d35d(0x167)+_0x1aaee1[_0x42d35d(0x16b)]+_0x42d35d(0x179)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x35b40d,_0x5e1112){const _0x34a90a=a201_0x3022,_0x13bf58=_0x35b40d();while(!![]){try{const _0x4ff12e=parseInt(_0x34a90a(0x7a))/0x1*(-parseInt(_0x34a90a(0x6c))/0x2)+parseInt(_0x34a90a(0x6e))/0x3*(parseInt(_0x34a90a(0x73))/0x4)+parseInt(_0x34a90a(0x7f))/0x5*(-parseInt(_0x34a90a(0x6f))/0x6)+-parseInt(_0x34a90a(0x75))/0x7+parseInt(_0x34a90a(0x77))/0x8+-parseInt(_0x34a90a(0x7e))/0x9*(-parseInt(_0x34a90a(0x80))/0xa)+parseInt(_0x34a90a(0x76))/0xb;if(_0x4ff12e===_0x5e1112)break;else _0x13bf58['push'](_0x13bf58['shift']());}catch(_0x29a15d){_0x13bf58['push'](_0x13bf58['shift']());}}}(a201_0x207a,0x7f907));function a201_0x3022(_0x50a205,_0x2c17ab){_0x50a205=_0x50a205-0x69;const _0x207adb=a201_0x207a();let _0x302274=_0x207adb[_0x50a205];return _0x302274;}import{CliErrors}from'../../errors.js';function a201_0x207a(){const _0x56026a=['nickname','53YwxXlA','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','values','adminFlag','884673cnPAMT','5aIzwbe','60gjQmdN','role','trim','isFinite','status','userId','displayName','ADMIN','tenantCode','21106IgXael','validation','1893jZjvZl','3357918nukEKy','Tenant\x20\x22','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','get','1732uvoOce','username','3403694gsGxGw','12959023zCxZqa','692872pcLmPf','MEMBER'];a201_0x207a=function(){return _0x56026a;};return a201_0x207a();}function textOrNull(_0x4a0a3b){const _0x4e1bf3=a201_0x3022,_0x4c0648=_0x4a0a3b?.[_0x4e1bf3(0x82)]();return _0x4c0648?_0x4c0648:null;}export function projectTenantMembers(_0x376983){const _0x47ca9c=a201_0x3022,_0x5b8ac2=new Map();for(const _0x20d5e1 of _0x376983){const _0xfb370b=Number(_0x20d5e1[_0x47ca9c(0x85)]);if(!Number[_0x47ca9c(0x83)](_0xfb370b)||_0xfb370b<=0x0)continue;const _0x2c7ac5={'userId':_0xfb370b,'username':textOrNull(_0x20d5e1[_0x47ca9c(0x74)]),'displayName':textOrNull(_0x20d5e1[_0x47ca9c(0x79)]),'role':_0x20d5e1[_0x47ca9c(0x7d)]===!![]?_0x47ca9c(0x6a):_0x47ca9c(0x78),'status':textOrNull(_0x20d5e1[_0x47ca9c(0x84)])},_0x68ac0c=_0x5b8ac2[_0x47ca9c(0x72)](_0xfb370b);if(!_0x68ac0c){_0x5b8ac2['set'](_0xfb370b,_0x2c7ac5);continue;}_0x68ac0c[_0x47ca9c(0x74)]??=_0x2c7ac5[_0x47ca9c(0x74)],_0x68ac0c[_0x47ca9c(0x69)]??=_0x2c7ac5[_0x47ca9c(0x69)],_0x68ac0c[_0x47ca9c(0x84)]??=_0x2c7ac5[_0x47ca9c(0x84)];if(_0x2c7ac5[_0x47ca9c(0x81)]===_0x47ca9c(0x6a))_0x68ac0c[_0x47ca9c(0x81)]=_0x47ca9c(0x6a);}return[..._0x5b8ac2[_0x47ca9c(0x7c)]()]['sort']((_0x3a19b5,_0x293343)=>_0x3a19b5[_0x47ca9c(0x85)]-_0x293343[_0x47ca9c(0x85)]);}export function assertTenantAccessible(_0x4f3b7e,_0x20f4a6){const _0x3ae8c9=a201_0x3022;if(_0x20f4a6['some'](_0x257fbe=>_0x257fbe[_0x3ae8c9(0x6b)]===_0x4f3b7e))return;throw CliErrors[_0x3ae8c9(0x6d)](_0x3ae8c9(0x70)+_0x4f3b7e+_0x3ae8c9(0x71),_0x3ae8c9(0x7b));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a202_0x34079e=a202_0x3151;(function(_0x2fdfca,_0xf49c3c){const _0xf74639=a202_0x3151,_0x4d85f1=_0x2fdfca();while(!![]){try{const _0x51b559=-parseInt(_0xf74639(0xc8))/0x1*(parseInt(_0xf74639(0xd8))/0x2)+parseInt(_0xf74639(0xc6))/0x3*(-parseInt(_0xf74639(0xd1))/0x4)+parseInt(_0xf74639(0xcd))/0x5+parseInt(_0xf74639(0xc4))/0x6+-parseInt(_0xf74639(0xcf))/0x7+parseInt(_0xf74639(0xc3))/0x8+parseInt(_0xf74639(0xca))/0x9*(parseInt(_0xf74639(0xd5))/0xa);if(_0x51b559===_0xf49c3c)break;else _0x4d85f1['push'](_0x4d85f1['shift']());}catch(_0xc0d37f){_0x4d85f1['push'](_0x4d85f1['shift']());}}}(a202_0xb693,0xc1547));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';function a202_0x3151(_0x2d6c1c,_0x1410f2){_0x2d6c1c=_0x2d6c1c-0xc3;const _0xb6938b=a202_0xb693();let _0x3151ea=_0xb6938b[_0x2d6c1c];return _0x3151ea;}import{CliErrors}from'../../errors.js';const PROVIDER_ID='dingding-sandbox',CURRENT_BINDING_WARNING=a202_0x34079e(0xc9);function readDingTalkUserId(_0x522ce6){const _0x5b0eb3=a202_0x34079e,_0x4a4ff2=_0x522ce6[_0x5b0eb3(0xce)](_0x5b0eb3(0xd0))[_0x5b0eb3(0xcb)]();if(!_0x4a4ff2)throw CliErrors[_0x5b0eb3(0xd4)]('--ding-talk-user-id\x20cannot\x20be\x20empty.','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x4a4ff2;}function a202_0xb693(){const _0x4d1f7d=['The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','45oLkHqc','trim','bind','3328125dBomYN','str','3633252YCASrW','ding-talk-user-id','8tCnjav','dingding-sandbox-bind','apiError','validation','1851260jyXTwL','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','2302610WrHVab','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','8920920oGKzcO','5753976gTAicA','user-account','1804719bqqKeH','string','1SkUClw'];a202_0xb693=function(){return _0x4d1f7d;};return a202_0xb693();}function buildBindingData(_0x380dcd,_0x1bbd51){const _0x40b497=a202_0x34079e;return{'operation':_0x40b497(0xcc),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x380dcd},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x380dcd,'bound':!![]},'dryRun':_0x1bbd51,'backend':{'method':'POST','path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a202_0x34079e(0xc5),'command':a202_0x34079e(0xd2),'description':a202_0x34079e(0xd7),'risk':'write','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a202_0x34079e(0xd0),'type':a202_0x34079e(0xc7),'required':!![],'description':'DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox'}],async 'validate'(_0xe78937){readDingTalkUserId(_0xe78937);},async 'dryRun'(_0x46c516){const _0x314c7f=readDingTalkUserId(_0x46c516);return asDryRunResult(buildBindingData(_0x314c7f,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x1539e1){const _0x136de2=a202_0x34079e,_0x4ffb5c=readDingTalkUserId(_0x1539e1),_0x2395ea=await bindDingTalkSandboxAccount(_0x4ffb5c);if(_0x2395ea!==!![])throw CliErrors[_0x136de2(0xd3)](_0x136de2(0xd9),_0x136de2(0xd6));return{'ok':!![],'data':buildBindingData(_0x4ffb5c,![]),'message':_0x136de2(0xda)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5391de,_0x52fc0e){const _0x1dbdab=a203_0x4ede,_0x4dd87f=_0x5391de();while(!![]){try{const _0x1beb7a=parseInt(_0x1dbdab(0xe7))/0x1*(-parseInt(_0x1dbdab(0xe5))/0x2)+parseInt(_0x1dbdab(0xe4))/0x3+-parseInt(_0x1dbdab(0xe8))/0x4+-parseInt(_0x1dbdab(0xe6))/0x5+-parseInt(_0x1dbdab(0xeb))/0x6+parseInt(_0x1dbdab(0xea))/0x7*(-parseInt(_0x1dbdab(0xe9))/0x8)+parseInt(_0x1dbdab(0xe3))/0x9;if(_0x1beb7a===_0x52fc0e)break;else _0x4dd87f['push'](_0x4dd87f['shift']());}catch(_0x4cb93d){_0x4dd87f['push'](_0x4dd87f['shift']());}}}(a203_0x2bd3,0x85f0f));function a203_0x2bd3(){const _0x22cf99=['8ixVvNH','1282162poJftg','2003208mGYLiA','18209151JiCxTT','2081469cGIjbs','12674KvtUoB','801130etcTvM','170ivsQuS','1655556ZBbMJc'];a203_0x2bd3=function(){return _0x22cf99;};return a203_0x2bd3();}import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';function a203_0x4ede(_0x4f9c72,_0xa1cf4){_0x4f9c72=_0x4f9c72-0xe3;const _0x2bd3fe=a203_0x2bd3();let _0x4ede55=_0x2bd3fe[_0x4f9c72];return _0x4ede55;}export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a204_0x3f6e53=a204_0x279f;(function(_0x147ed2,_0x5aaf3a){const _0x1da658=a204_0x279f,_0x21a59b=_0x147ed2();while(!![]){try{const _0x2f255f=-parseInt(_0x1da658(0x11e))/0x1*(parseInt(_0x1da658(0x114))/0x2)+-parseInt(_0x1da658(0x118))/0x3*(-parseInt(_0x1da658(0x11c))/0x4)+-parseInt(_0x1da658(0x120))/0x5*(-parseInt(_0x1da658(0x111))/0x6)+parseInt(_0x1da658(0x11d))/0x7*(-parseInt(_0x1da658(0x119))/0x8)+-parseInt(_0x1da658(0x121))/0x9*(parseInt(_0x1da658(0x11a))/0xa)+-parseInt(_0x1da658(0x11b))/0xb*(-parseInt(_0x1da658(0x116))/0xc)+parseInt(_0x1da658(0x11f))/0xd;if(_0x2f255f===_0x5aaf3a)break;else _0x21a59b['push'](_0x21a59b['shift']());}catch(_0x325024){_0x21a59b['push'](_0x21a59b['shift']());}}}(a204_0x57b7,0x7d4ce));function a204_0x57b7(){const _0x3adedd=['24KEvKhY','name','workspace','2lQtcXP','workspace\x20add','37416bvwVQx','add','201lFsUGO','16vGnbxl','60UglsfO','737TgAyVe','31888YERjGL','1923159LundsA','440890AtkvXF','12911470CWbFYE','336420KUysfW','752643ZYDydH','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','App\x20profile\x20name'];a204_0x57b7=function(){return _0x3adedd;};return a204_0x57b7();}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a204_0x279f(_0x13fc4f,_0x3e672a){_0x13fc4f=_0x13fc4f-0x10f;const _0x57b738=a204_0x57b7();let _0x279f2e=_0x57b738[_0x13fc4f];return _0x279f2e;}export const workspaceAddDefinition={'service':a204_0x3f6e53(0x113),'command':a204_0x3f6e53(0x117),'description':a204_0x3f6e53(0x10f),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a204_0x3f6e53(0x112),'description':a204_0x3f6e53(0x110),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0xda17f=>validateAppName(_0xda17f,a204_0x3f6e53(0x115)),'execute':_0x1a9b5e=>runAppAdd(_0x1a9b5e,'workspace\x20add')};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a205_0x4f67(_0x4a49ff,_0x9c9264){_0x4a49ff=_0x4a49ff-0x125;const _0x576cf9=a205_0x576c();let _0x4f678c=_0x576cf9[_0x4a49ff];return _0x4f678c;}const a205_0x25ce2e=a205_0x4f67;(function(_0x1a593c,_0x3f007e){const _0x36d0a7=a205_0x4f67,_0x40a93a=_0x1a593c();while(!![]){try{const _0x4f88ed=parseInt(_0x36d0a7(0x13f))/0x1+-parseInt(_0x36d0a7(0x134))/0x2*(-parseInt(_0x36d0a7(0x153))/0x3)+-parseInt(_0x36d0a7(0x152))/0x4*(-parseInt(_0x36d0a7(0x150))/0x5)+parseInt(_0x36d0a7(0x132))/0x6*(parseInt(_0x36d0a7(0x13c))/0x7)+parseInt(_0x36d0a7(0x129))/0x8+-parseInt(_0x36d0a7(0x154))/0x9*(parseInt(_0x36d0a7(0x15a))/0xa)+-parseInt(_0x36d0a7(0x146))/0xb*(parseInt(_0x36d0a7(0x138))/0xc);if(_0x4f88ed===_0x3f007e)break;else _0x40a93a['push'](_0x40a93a['shift']());}catch(_0x1be6d8){_0x40a93a['push'](_0x40a93a['shift']());}}}(a205_0x576c,0x7c996));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+a205_0x25ce2e(0x141),SAFE_PROFILE_KEYS=['appcode','env',a205_0x25ce2e(0x12b),a205_0x25ce2e(0x12e),a205_0x25ce2e(0x156),a205_0x25ce2e(0x14b),a205_0x25ce2e(0x133)],workspaceFlags=[{'name':a205_0x25ce2e(0x137),'type':a205_0x25ce2e(0x126),'description':a205_0x25ce2e(0x15c)},{'name':a205_0x25ce2e(0x144),'type':a205_0x25ce2e(0x126),'description':'App\x20code\x20to\x20bind\x20to\x20this\x20workspace'},{'name':'env','type':a205_0x25ce2e(0x126),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':a205_0x25ce2e(0x12b),'type':a205_0x25ce2e(0x126),'description':a205_0x25ce2e(0x14c)},{'name':a205_0x25ce2e(0x139),'type':a205_0x25ce2e(0x126),'description':a205_0x25ce2e(0x14d),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a205_0x25ce2e(0x156),'type':'number','description':'Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile'},{'name':'riskLevel','type':a205_0x25ce2e(0x126),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':a205_0x25ce2e(0x133),'type':'string','description':'Locale\x20for\x20this\x20workspace\x20app\x20profile'}];function isRecord(_0x262648){const _0x5a5824=a205_0x25ce2e;return!!_0x262648&&typeof _0x262648===_0x5a5824(0x128)&&!Array['isArray'](_0x262648);}function assertValidAppcode(_0x1d9b00){const _0x48b64c=a205_0x25ce2e,{valid:_0x1f2b51,message:_0x9c4324}=validateAppcode(_0x1d9b00);if(!_0x1f2b51)throw CliErrors[_0x48b64c(0x127)](_0x48b64c(0x159)+_0x1d9b00,_0x9c4324);}function sanitizeProfile(_0x537fe2){if(!isRecord(_0x537fe2))return{};const _0x3bd11b={};for(const _0x2400c8 of SAFE_PROFILE_KEYS){if(_0x537fe2[_0x2400c8]!==undefined)_0x3bd11b[_0x2400c8]=_0x537fe2[_0x2400c8];}return _0x3bd11b;}function cloneProfile(_0x364e30){return isRecord(_0x364e30)?{..._0x364e30}:{};}function collectWorkspaceProfileOverrides(_0x4316aa){const _0x589176=a205_0x25ce2e,_0x302094={},_0xe2aa99=_0x4316aa[_0x589176(0x13b)](_0x589176(0x149)),_0x3c30fa=_0x4316aa['str']('apiDir'),_0x1d625f=_0x4316aa[_0x589176(0x13b)]('defaultFormat'),_0x43464e=_0x4316aa['flag'](_0x589176(0x156)),_0x1f3b2f=_0x4316aa[_0x589176(0x13b)](_0x589176(0x14b)),_0x16f179=_0x4316aa['str'](_0x589176(0x133));if(_0xe2aa99)_0x302094[_0x589176(0x149)]=_0xe2aa99;if(_0x3c30fa)_0x302094[_0x589176(0x12b)]=_0x3c30fa;if(_0x1d625f)_0x302094[_0x589176(0x12e)]=_0x1d625f;if(_0x43464e!==undefined&&_0x43464e!=='')_0x302094[_0x589176(0x156)]=Number(_0x43464e);if(_0x1f3b2f)_0x302094[_0x589176(0x14b)]=_0x1f3b2f;if(_0x16f179)_0x302094['locale']=_0x16f179;return _0x302094;}async function validateWorkspaceArgs(_0x3d3b6a){const _0x1a3943=a205_0x25ce2e,_0x5dd37b=_0x3d3b6a['str'](_0x1a3943(0x137))['trim'](),_0xd6d423=_0x3d3b6a[_0x1a3943(0x13b)](_0x1a3943(0x144))[_0x1a3943(0x15d)]();if(!_0x5dd37b&&!_0xd6d423)throw CliErrors[_0x1a3943(0x127)](_0x1a3943(0x14f),_0x1a3943(0x148)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+_0x1a3943(0x13a));if(_0xd6d423)assertValidAppcode(_0xd6d423);}function resolveKnownApps(){const _0x232119=a205_0x25ce2e,{config:_0x42d696,layers:_0x51b4b3}=readRawConfigWithLayers(),_0xebfb26=isRecord(_0x42d696[_0x232119(0x155)])?_0x42d696[_0x232119(0x155)]:{},_0x4d9583=isRecord(_0x51b4b3[_0x232119(0x158)][_0x232119(0x155)])?_0x51b4b3[_0x232119(0x158)][_0x232119(0x155)]:{};return{..._0x4d9583,..._0xebfb26};}async function configureWorkspace(_0x396f32,_0x3885ce){const _0x5d86e3=a205_0x25ce2e,_0x4c3158=_0x396f32['str']('app')[_0x5d86e3(0x15d)](),_0x6cc5fd=_0x396f32['str'](_0x5d86e3(0x144))[_0x5d86e3(0x15d)](),_0x763945=_0x4c3158||_0x6cc5fd;if(!_0x763945)throw CliErrors['validation'](_0x5d86e3(0x14f),'Use\x20`'+CLI_BIN_NAME+_0x5d86e3(0x140)+CLI_BIN_NAME+_0x5d86e3(0x13a));if(_0x6cc5fd)assertValidAppcode(_0x6cc5fd);const _0x120c57=resolveWriteConfigPath('project'),_0x53027d=readConfigFile(_0x120c57),_0x4a4a8a=resolveKnownApps(),_0x489bd4=isRecord(_0x53027d['apps'])?{..._0x53027d[_0x5d86e3(0x155)]}:{},_0x44317c=cloneProfile(_0x489bd4[_0x763945]),_0x24ceeb=sanitizeProfile(_0x4a4a8a[_0x763945]),_0xc1df1b=_0x6cc5fd?{}:_0x24ceeb,_0x497086=_0x6cc5fd||_0xc1df1b['appcode'];if(!_0x497086){const _0x12d27e=Object[_0x5d86e3(0x143)](_0x4a4a8a),_0x2e5a67=_0x12d27e[_0x5d86e3(0x15e)]===0x0?_0x5d86e3(0x148)+CLI_BIN_NAME+_0x5d86e3(0x13d)+_0x3885ce+_0x5d86e3(0x157)+_0x763945+'\x20--appcode\x20<code>`.':_0x5d86e3(0x14e)+_0x12d27e[_0x5d86e3(0x147)](',\x20');throw CliErrors[_0x5d86e3(0x127)](_0x5d86e3(0x14a)+_0x763945+_0x5d86e3(0x131),_0x2e5a67);}assertValidAppcode(String(_0x497086));const _0x183c10={..._0xc1df1b,..._0x44317c,'appcode':String(_0x497086),...collectWorkspaceProfileOverrides(_0x396f32)};return _0x489bd4[_0x763945]=_0x183c10,_0x53027d[_0x5d86e3(0x155)]=_0x489bd4,_0x53027d[_0x5d86e3(0x130)]=_0x763945,delete _0x53027d['appcode'],delete _0x53027d['app'],_0x183c10[_0x5d86e3(0x149)]&&(_0x53027d[_0x5d86e3(0x149)]=_0x183c10[_0x5d86e3(0x149)]),writeConfigFile(_0x120c57,_0x53027d),{'ok':!![],'message':_0x5d86e3(0x145)+(_0x3885ce===_0x5d86e3(0x135)?_0x5d86e3(0x12a):_0x5d86e3(0x12c))+':\x20'+_0x763945+_0x5d86e3(0x12d)+_0x183c10[_0x5d86e3(0x144)]+_0x5d86e3(0x125)+_0x120c57+_0x5d86e3(0x15b),'data':{'operation':_0x5d86e3(0x142)+_0x3885ce,'configPath':_0x120c57,'app':_0x763945,'appcode':_0x183c10[_0x5d86e3(0x144)],'env':_0x183c10[_0x5d86e3(0x149)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a205_0x25ce2e(0x13e),'command':a205_0x25ce2e(0x135),'description':a205_0x25ce2e(0x151),'risk':a205_0x25ce2e(0x12f),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x135773=>configureWorkspace(_0x135773,a205_0x25ce2e(0x135))},workspaceUseDefinition={'service':a205_0x25ce2e(0x13e),'command':'use','description':a205_0x25ce2e(0x136),'risk':a205_0x25ce2e(0x12f),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x129ad1=>configureWorkspace(_0x129ad1,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};function a205_0x576c(){const _0x510e7a=['386727zLGWXR','join','Use\x20`','env','App\x20\x22','riskLevel','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','Missing\x20workspace\x20app\x20selector.','517755oGGKju','Initialize\x20the\x20current\x20workspace\x20app\x20binding','16DVZIsV','3drgBmH','7643763uiXEmj','apps','pageSize','\x20--app\x20','globalConfig','Invalid\x20appcode:\x20','10FiGOeC','.\x20Credentials:\x20not\x20written.','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','trim','length',').\x20Config:\x20','string','validation','object','3089160kApaLS','initialized','apiDir','updated','\x20(appcode:\x20','format','write','defaultApp','\x22\x20not\x20found.','624sbTHtW','locale','519182YhYcuq','init','Switch\x20the\x20current\x20workspace\x20app\x20binding','app','84segWBy','defaultFormat','\x20workspace\x20use\x20--app\x20<name>`.','str','6986ytZZbA','\x20workspace\x20','workspace','442032cVfvlj','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','workspace.','keys','appcode','Workspace\x20'];a205_0x576c=function(){return _0x510e7a;};return a205_0x576c();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a206_0x35b373=a206_0x2396;function a206_0x2396(_0x128837,_0x390033){_0x128837=_0x128837-0x14a;const _0x3291bb=a206_0x3291();let _0x2396a5=_0x3291bb[_0x128837];return _0x2396a5;}(function(_0x341992,_0x53344a){const _0x27de4f=a206_0x2396,_0xa3f60b=_0x341992();while(!![]){try{const _0x44cf63=parseInt(_0x27de4f(0x157))/0x1*(parseInt(_0x27de4f(0x14f))/0x2)+-parseInt(_0x27de4f(0x14b))/0x3+parseInt(_0x27de4f(0x151))/0x4+-parseInt(_0x27de4f(0x155))/0x5*(parseInt(_0x27de4f(0x14e))/0x6)+-parseInt(_0x27de4f(0x152))/0x7*(parseInt(_0x27de4f(0x159))/0x8)+parseInt(_0x27de4f(0x156))/0x9*(parseInt(_0x27de4f(0x154))/0xa)+-parseInt(_0x27de4f(0x150))/0xb*(-parseInt(_0x27de4f(0x14d))/0xc);if(_0x44cf63===_0x53344a)break;else _0xa3f60b['push'](_0xa3f60b['shift']());}catch(_0x13b1c7){_0xa3f60b['push'](_0xa3f60b['shift']());}}}(a206_0x3291,0x35848));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':'workspace','command':a206_0x35b373(0x14a),'description':a206_0x35b373(0x14c),'risk':a206_0x35b373(0x158),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a206_0x35b373(0x153),'description':'App\x20profile\x20name\x20to\x20remove','required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x5dd976=>validateAppName(_0x5dd976,'workspace\x20remove'),'execute':_0x37b245=>runAppRemove(_0x37b245,'workspace\x20remove')};function a206_0x3291(){const _0x359ec0=['282396UImDsI','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','12osyZBE','34824hwmyBD','22JphTVb','1948507mcxBEq','408040CKruFh','9583OhTbRT','name','190yYzpJT','25KEXmYc','27243rKdZVc','21551QtYflm','write','1352IRVliu','remove'];a206_0x3291=function(){return _0x359ec0;};return a206_0x3291();}
|