@lovrabet/rabetbase-cli 2.4.7-beta.1 → 2.4.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- 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.d.ts +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.d.ts +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.d.ts +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.d.ts +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.d.ts +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.d.ts +2 -2
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/types.d.ts +1 -1
- package/lib/core/bff/utils.d.ts +2 -2
- 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 +2 -2
- package/sidecar/flags.json +1 -1
- package/skills/rabetbase/SKILL.md +28 -28
- package/skills/rabetbase/guides/backend-function.md +30 -30
- package/skills/rabetbase/guides/best-practices.md +8 -8
- package/skills/rabetbase/guides/bff-creation-workflow.md +16 -16
- package/skills/rabetbase/guides/conflict-detection.md +3 -3
- package/skills/rabetbase/guides/custom-page-workflow.md +8 -8
- package/skills/rabetbase/guides/data-api-guidelines.md +6 -6
- package/skills/rabetbase/guides/legacy-application-blueprint-workflow.md +8 -8
- package/skills/rabetbase/guides/sql-creation-workflow.md +2 -2
- package/skills/rabetbase/guides/troubleshooting.md +6 -6
- package/skills/rabetbase/guides/typescript-sdk.md +10 -10
- package/skills/rabetbase/knowledge/page-schema/LrSmartTable.md +1 -1
- package/skills/rabetbase/knowledge/page-schema/external-resources-usage.md +10 -10
- package/skills/rabetbase/references/rabetbase-app-config.md +2 -2
- package/skills/rabetbase/references/rabetbase-bff-create.md +3 -3
- package/skills/rabetbase/references/rabetbase-bff-delete.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-detail.md +4 -4
- package/skills/rabetbase/references/rabetbase-bff-list.md +8 -8
- package/skills/rabetbase/references/rabetbase-bff-pull.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-push.md +3 -3
- package/skills/rabetbase/references/rabetbase-bff-status.md +1 -1
- package/skills/rabetbase/references/rabetbase-codegen-sql.md +3 -3
- package/skills/rabetbase/references/rabetbase-dataset-detail.md +1 -1
- package/skills/rabetbase/references/rabetbase-notification-config-list.md +3 -3
- package/skills/rabetbase.manifest.json +3 -3
- package/templates/rules/lovrabet_rules.mdc.tpl +7 -7
- package/templates/skill/SKILL.md.tpl +12 -12
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a192_0x31a16e=a192_0x4950;(function(_0x4fc993,_0x570ee7){const _0x11843b=a192_0x4950,_0x345665=_0x4fc993();while(!![]){try{const _0x39e117=-parseInt(_0x11843b(0x147))/0x1*(-parseInt(_0x11843b(0x149))/0x2)+parseInt(_0x11843b(0x161))/0x3*(parseInt(_0x11843b(0x145))/0x4)+parseInt(_0x11843b(0x146))/0x5+-parseInt(_0x11843b(0x139))/0x6+-parseInt(_0x11843b(0x166))/0x7*(-parseInt(_0x11843b(0x138))/0x8)+parseInt(_0x11843b(0x14b))/0x9+-parseInt(_0x11843b(0x154))/0xa;if(_0x39e117===_0x570ee7)break;else _0x345665['push'](_0x345665['shift']());}catch(_0x15a956){_0x345665['push'](_0x345665['shift']());}}}(a192_0x2804,0x2909f));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';function a192_0x4950(_0xb96f5b,_0x2a8740){_0xb96f5b=_0xb96f5b-0x133;const _0x280418=a192_0x2804();let _0x495064=_0x280418[_0xb96f5b];return _0x495064;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x248299,_0x425bd1){const _0x5332ca=a192_0x4950,_0x562c81=[];let _0x183776=0x1;while(!![]){const _0x57323f=await listSqlQueries(_0x248299,{'currentPage':_0x183776,'pageSize':PAGE_SIZE,'sqlCode':_0x425bd1[_0x5332ca(0x13a)],'sqlName':_0x425bd1['sqlName']}),_0x303406=_0x57323f['tableData']??[];_0x562c81[_0x5332ca(0x165)](..._0x303406);if(_0x303406[_0x5332ca(0x134)]===0x0)break;const _0x40ee2e=_0x57323f[_0x5332ca(0x159)]?.[_0x5332ca(0x14f)];if(_0x40ee2e!=null?_0x562c81[_0x5332ca(0x134)]>=_0x40ee2e:_0x303406[_0x5332ca(0x134)]<PAGE_SIZE)break;_0x183776++;}return _0x562c81;}async function ensureSqlContent(_0x4de109){const _0x17987d=a192_0x4950;if(_0x4de109[_0x17987d(0x13c)]!=null&&String(_0x4de109[_0x17987d(0x13c)])[_0x17987d(0x134)]>0x0)return _0x4de109;return getSqlQueryDetail(_0x4de109[_0x17987d(0x13a)]);}export const sqlPull={'service':a192_0x31a16e(0x140),'command':a192_0x31a16e(0x137),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a192_0x31a16e(0x162),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a192_0x31a16e(0x14d),'type':'string','description':a192_0x31a16e(0x133)},{'name':'force','type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x385fa3){const _0x5a4d2a=a192_0x31a16e,_0x3d288d=loadSqlProjectConfig(_0x385fa3[_0x5a4d2a(0x143)]),_0x441b44=await readSqlLockFile(_0x3d288d[_0x5a4d2a(0x164)]),{appLock:_0x3600db}=ensureSqlLockScope(_0x441b44??createEmptySqlLock(),_0x3d288d[_0x5a4d2a(0x143)],_0x3d288d[_0x5a4d2a(0x15c)],'pull'),_0x12b88f=await fetchAllSqlQueries(_0x385fa3[_0x5a4d2a(0x143)],{'sqlCode':_0x385fa3[_0x5a4d2a(0x160)](_0x5a4d2a(0x142))||undefined,'sqlName':_0x385fa3[_0x5a4d2a(0x160)](_0x5a4d2a(0x14d))||undefined}),_0x11f302=[];for(const _0x1da2ff of _0x12b88f){const _0x31996a=await ensureSqlContent(_0x1da2ff),_0x10c48b=ensureRemoteSqlContent(_0x31996a),_0x150219=detectModeFromSql(_0x31996a),_0x4f625b=_0x31996a[_0x5a4d2a(0x168)]?await getDbName(_0x385fa3[_0x5a4d2a(0x143)],Number(_0x31996a[_0x5a4d2a(0x168)]))[_0x5a4d2a(0x13f)](()=>undefined):undefined,_0x3ff9cd=buildLocalSqlFileContent({'sqlCode':_0x31996a['sqlCode'],'sqlName':_0x31996a[_0x5a4d2a(0x14a)],'dbId':_0x31996a[_0x5a4d2a(0x168)]},_0x10c48b,{'dbName':_0x4f625b,'mode':_0x150219,'syncedAt':new Date()[_0x5a4d2a(0x14c)](),'description':_0x31996a[_0x5a4d2a(0x141)]}),_0x153c59=buildSqlLockEntry(_0x31996a,_0x10c48b,'',{'dbName':_0x4f625b}),_0x13cfba=resolveLocalSqlFilePath(_0x3d288d,_0x31996a[_0x5a4d2a(0x13a)],_0x153c59);let _0x238cb2='would_pull',_0x474867;if(await fileExists(_0x13cfba)){const _0x11720a=await readFile(_0x13cfba,_0x5a4d2a(0x13d));isEquivalentPulledSqlFile(_0x11720a,_0x3ff9cd,_0x150219)?(_0x238cb2=_0x5a4d2a(0x144),_0x474867=_0x5a4d2a(0x157)):(_0x238cb2=_0x5a4d2a(0x148),_0x474867=_0x5a4d2a(0x13b));}_0x11f302[_0x5a4d2a(0x165)]({'sqlCode':_0x31996a[_0x5a4d2a(0x13a)],'sqlName':_0x31996a[_0x5a4d2a(0x14a)],'filePath':_0x13cfba,'status':_0x238cb2,'reason':_0x474867});}return{'method':_0x5a4d2a(0x151),'url':_0x5a4d2a(0x15d),'body':{'appCode':_0x385fa3[_0x5a4d2a(0x143)],'sqlCode':_0x385fa3[_0x5a4d2a(0x160)](_0x5a4d2a(0x142))||null,'sqlName':_0x385fa3[_0x5a4d2a(0x160)](_0x5a4d2a(0x14d))||null,'files':_0x11f302},'description':_0x5a4d2a(0x136)+_0x11f302[_0x5a4d2a(0x134)]+_0x5a4d2a(0x163)+_0x3d288d[_0x5a4d2a(0x14e)]};},async 'execute'(_0x5b7e23){const _0x20514e=a192_0x31a16e,_0x2d9a86=loadSqlProjectConfig(_0x5b7e23[_0x20514e(0x143)]),_0x4de9c1=await readSqlLockFile(_0x2d9a86[_0x20514e(0x164)]),{lockData:_0x118542,appLock:_0x45667c}=ensureSqlLockScope(_0x4de9c1??createEmptySqlLock(),_0x2d9a86[_0x20514e(0x143)],_0x2d9a86[_0x20514e(0x15c)],'pull'),_0x1c5835=_0x5b7e23[_0x20514e(0x158)]('force'),_0x3420bb=await fetchAllSqlQueries(_0x5b7e23[_0x20514e(0x143)],{'sqlCode':_0x5b7e23[_0x20514e(0x160)](_0x20514e(0x142))||undefined,'sqlName':_0x5b7e23[_0x20514e(0x160)](_0x20514e(0x14d))||undefined});if(_0x3420bb[_0x20514e(0x134)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x20514e(0x155)};const _0x854567=[],_0x572bd2=[];for(const _0x393fd9 of _0x3420bb){try{_0x854567['push'](await ensureSqlContent(_0x393fd9));}catch(_0x34d42f){_0x572bd2[_0x20514e(0x165)]({'sqlCode':_0x393fd9[_0x20514e(0x13a)],'error':_0x34d42f instanceof Error?_0x34d42f[_0x20514e(0x153)]:String(_0x34d42f)});}}if(_0x1c5835&&!_0x5b7e23['nonInteractive']){let _0x23ac94=![];for(const _0x47893a of _0x854567){const _0x5b66fc=detectModeFromSql(_0x47893a),_0x1fbfa8=_0x47893a['dbId']?await getDbName(_0x5b7e23[_0x20514e(0x143)],Number(_0x47893a[_0x20514e(0x168)]))['catch'](()=>undefined):undefined,_0x570b90=buildLocalSqlFileContent({'sqlCode':_0x47893a[_0x20514e(0x13a)],'sqlName':_0x47893a[_0x20514e(0x14a)],'dbId':_0x47893a[_0x20514e(0x168)]},ensureRemoteSqlContent(_0x47893a),{'dbName':_0x1fbfa8,'mode':_0x5b66fc,'syncedAt':new Date()[_0x20514e(0x14c)](),'description':_0x47893a['description']}),_0x1afc92=resolveLocalSqlFilePath(_0x2d9a86,_0x47893a['sqlCode'],buildSqlLockEntry(_0x47893a,ensureRemoteSqlContent(_0x47893a),'',{'dbName':_0x1fbfa8}));if(await fileExists(_0x1afc92)){const _0x89978b=await readFile(_0x1afc92,'utf8');if(!isEquivalentPulledSqlFile(_0x89978b,_0x570b90,_0x5b66fc)){_0x23ac94=!![];break;}}}if(_0x23ac94){const _0x44b8d3=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x44b8d3)throw CliErrors[_0x20514e(0x156)]('Force\x20pull\x20cancelled.');}}const _0x4c19da=cloneSqlLockData(_0x118542),_0x5b6e16=_0x4c19da['apps'][_0x2d9a86[_0x20514e(0x143)]],_0x4ec1e4=[],_0x561362=[];for(const _0x25aed7 of _0x854567){const _0x402df2=_0x5b6e16[_0x20514e(0x15a)][_0x25aed7['sqlCode']],_0x36054e=ensureRemoteSqlContent(_0x25aed7),_0x15e0dd=detectModeFromSql(_0x25aed7),_0x40a40c=_0x25aed7[_0x20514e(0x168)]?await getDbName(_0x5b7e23[_0x20514e(0x143)],Number(_0x25aed7['dbId']))['catch'](()=>undefined):undefined,_0x1cd2a1=buildLocalSqlFileContent({'sqlCode':_0x25aed7[_0x20514e(0x13a)],'sqlName':_0x25aed7[_0x20514e(0x14a)],'dbId':_0x25aed7[_0x20514e(0x168)]},_0x36054e,{'dbName':_0x40a40c,'mode':_0x15e0dd,'syncedAt':new Date()['toISOString'](),'description':_0x25aed7[_0x20514e(0x141)]}),_0x16fdd0=buildSqlLockEntry(_0x25aed7,_0x36054e,computeSqlContentHash(_0x1cd2a1),{'dbName':_0x40a40c}),_0x2ab329=_0x16fdd0[_0x20514e(0x152)],_0x4022b4=join(_0x2d9a86[_0x20514e(0x14e)],_0x2ab329);try{if(await fileExists(_0x4022b4)){const _0x2a64f6=await readFile(_0x4022b4,_0x20514e(0x13d));if(isEquivalentPulledSqlFile(_0x2a64f6,_0x1cd2a1,_0x15e0dd)){_0x561362['push']({'sqlCode':_0x25aed7[_0x20514e(0x13a)],'reason':_0x20514e(0x157)}),_0x5b6e16[_0x20514e(0x15a)][_0x25aed7[_0x20514e(0x13a)]]={..._0x16fdd0,'hash':computeSqlContentHash(_0x2a64f6),'path':_0x2ab329};continue;}if(!_0x1c5835){_0x561362[_0x20514e(0x165)]({'sqlCode':_0x25aed7['sqlCode'],'reason':_0x20514e(0x15b)});continue;}}const _0x34a970=_0x402df2?.[_0x20514e(0x152)]?join(_0x2d9a86[_0x20514e(0x14e)],_0x402df2['path']):undefined;_0x34a970&&_0x34a970!==_0x4022b4&&await fileExists(_0x34a970)&&await rm(_0x34a970,{'force':!![]}),await ensureParentDirectory(_0x4022b4),await writeFile(_0x4022b4,_0x1cd2a1,_0x20514e(0x13d)),_0x5b6e16['sqls'][_0x25aed7[_0x20514e(0x13a)]]={..._0x16fdd0,'path':_0x2ab329},_0x4ec1e4['push']({'sqlCode':_0x25aed7['sqlCode'],'filePath':_0x4022b4});}catch(_0x4ba36e){_0x572bd2[_0x20514e(0x165)]({'sqlCode':_0x25aed7[_0x20514e(0x13a)],'error':_0x4ba36e instanceof Error?_0x4ba36e['message']:String(_0x4ba36e)});}}return _0x5b6e16[_0x20514e(0x135)]=new Date()[_0x20514e(0x14c)](),await writeSqlLockFile(_0x2d9a86[_0x20514e(0x164)],_0x4c19da),{'ok':_0x572bd2[_0x20514e(0x134)]===0x0,'data':{'pulled':_0x4ec1e4,'skipped':_0x561362,'failed':_0x572bd2},'message':_0x20514e(0x150)+_0x4ec1e4['length']+_0x20514e(0x15f)+_0x561362['length']+'\x20skipped,\x20'+_0x572bd2[_0x20514e(0x134)]+'\x20failed'};}};function a192_0x2804(){const _0x341844=['3klijnR','conflict','141254QSViBE','sqlName','1806606cmcEOx','toISOString','name','sqlRootDir','totalCount','Pull\x20complete:\x20','POST','path','message','6201360WIqmDg','No\x20remote\x20SQL\x20queries\x20matched.','cancelled','unchanged','bool','paging','sqls','local\x20differs\x20from\x20remote','sqlRoot','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','mybatisXml','\x20written,\x20','str','120768uVEQBn','read','\x20SQL\x20file(s)\x20into\x20','lockFilePath','push','1113126ZcMtNT','test','dbId','Filter\x20by\x20SQL\x20display\x20name','length','lastSync','Would\x20pull\x20','pull','8RjxNdo','1267080nCWdGX','sqlCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlContent','utf8','trimStart','catch','sql','description','sqlcode','appCode','skipped','24WaBhHO','931210sDkSdA'];a192_0x2804=function(){return _0x341844;};return a192_0x2804();}function detectModeFromSql(_0x5dea40){const _0x510ea1=a192_0x31a16e,_0xb268e3=ensureRemoteSqlContent(_0x5dea40),_0x57da95=stripLocalSqlMetadata(_0xb268e3,'mybatisXml')[_0x510ea1(0x13e)]();if(/^<(select|insert|update|delete)\b/i[_0x510ea1(0x167)](_0x57da95))return'mybatisXml';return _0x510ea1(0x140);}function isEquivalentPulledSqlFile(_0x3ca97e,_0x935234,_0x4f24f2){return normalizePullComparableContent(_0x3ca97e,_0x4f24f2)===normalizePullComparableContent(_0x935234,_0x4f24f2);}function normalizePullComparableContent(_0x119bbc,_0x2f970d){const _0x54badd=_0x119bbc['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x4c4224=_0x54badd['filter'](_0x180793=>!isSyncedAtMetadataLine(_0x180793,_0x2f970d));return _0x4c4224['join']('\x0a');}function isSyncedAtMetadataLine(_0x2d270d,_0x42ed1d){const _0x45e6fd=a192_0x31a16e;if(_0x42ed1d===_0x45e6fd(0x15e))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x45e6fd(0x167)](_0x2d270d);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2d270d);}
|
|
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);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a193_0x579b6e=a193_0x1b34;(function(_0x237eb6,_0x1e6c45){const _0x1a4cb2=a193_0x1b34,_0x3ea555=_0x237eb6();while(!![]){try{const _0x536f32=-parseInt(_0x1a4cb2(0x178))/0x1*(-parseInt(_0x1a4cb2(0x17e))/0x2)+-parseInt(_0x1a4cb2(0x194))/0x3*(-parseInt(_0x1a4cb2(0x19f))/0x4)+-parseInt(_0x1a4cb2(0x1b6))/0x5*(parseInt(_0x1a4cb2(0x17a))/0x6)+-parseInt(_0x1a4cb2(0x175))/0x7*(-parseInt(_0x1a4cb2(0x1b3))/0x8)+parseInt(_0x1a4cb2(0x19d))/0x9+parseInt(_0x1a4cb2(0x1a9))/0xa*(-parseInt(_0x1a4cb2(0x1af))/0xb)+-parseInt(_0x1a4cb2(0x193))/0xc;if(_0x536f32===_0x1e6c45)break;else _0x3ea555['push'](_0x3ea555['shift']());}catch(_0x52c1fe){_0x3ea555['push'](_0x3ea555['shift']());}}}(a193_0x4592,0xb2506));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x38d9fb,_0x252221,_0xd702a){const _0x3fd558=a193_0x1b34,_0x5863eb=await scanLocalSqlQueries(_0x38d9fb),_0x2b7ba8=new Map();for(const _0x3398ad of _0x5863eb){if(_0xd702a&&_0x3398ad[_0x3fd558(0x17d)]!==_0xd702a)continue;const _0xe26764=_0x2b7ba8[_0x3fd558(0x1a3)](_0x3398ad[_0x3fd558(0x17d)])??[];_0xe26764['push'](_0x3398ad),_0x2b7ba8['set'](_0x3398ad[_0x3fd558(0x17d)],_0xe26764);}if(_0xd702a&&!_0x2b7ba8[_0x3fd558(0x177)](_0xd702a))throw CliErrors[_0x3fd558(0x181)](_0x3fd558(0x1a0)+_0xd702a);const _0x285c7c=[];for(const [_0x210651,_0x3b951f]of _0x2b7ba8[_0x3fd558(0x1b1)]()){if(_0x3b951f[_0x3fd558(0x192)]===0x1){_0x285c7c['push'](_0x3b951f[0x0]);continue;}const _0x4a40dc=_0x252221[_0x3fd558(0x184)][_0x210651],_0x1addbc=_0x4a40dc?.['path'],_0x14ba34=_0x1addbc?_0x3b951f[_0x3fd558(0x17f)](_0x2a76c2=>_0x2a76c2[_0x3fd558(0x1ab)]!==_0x1addbc):_0x3b951f;if(_0x4a40dc&&_0x14ba34[_0x3fd558(0x192)]===0x1){_0x285c7c['push'](_0x14ba34[0x0]);continue;}throw CliErrors[_0x3fd558(0x181)](_0x3fd558(0x18b)+_0x210651+_0x3fd558(0x180));}return _0x285c7c;}function a193_0x4592(){const _0x5db434=['Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','exec','\x20pushed,\x20','mode','boolean','hash','write','length','20156700XmcKXY','28893XWrcKk','sql','POST','push','\x20failed','startsWith','utf8','bool','projectRoot','4482360FJsyya','dbName','292BGiaNk','Local\x20SQL\x20not\x20found:\x20','No\x20local\x20SQL\x20files\x20found.','\x22\x20for\x20sqlCode\x20','get','catch','Push\x20local\x20SQL\x20files\x20to\x20remote','lockFilePath','path','toISOString','115670gxplcE','/smartapi/custom/updateUserCustomSql','relativePath','str','message','dbDirectory','88OkDiZz','dbId','entries','trashDir','240bkzWKs','replace','sqlConfig','5SnlGaA','Push\x20complete:\x20','327747ogbJtm','map','has','1516DkMMhS','No\x20database\x20matches\x20local\x20directory\x20\x22','2164908HrHDOf','force','remoteId','sqlCode','340eBZfMh','filter','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','validation','appCode','filePath','sqls','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqlName','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','version','sqlRoot','Local\x20directory\x20\x22'];a193_0x4592=function(){return _0x5db434;};return a193_0x4592();}export const sqlPush={'service':a193_0x579b6e(0x195),'command':a193_0x579b6e(0x197),'description':a193_0x579b6e(0x1a5),'risk':a193_0x579b6e(0x191),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a193_0x579b6e(0x17b),'type':a193_0x579b6e(0x18f),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x4b0ea4){const _0x3c8f15=a193_0x579b6e,_0xff6731=loadSqlProjectConfig(_0x4b0ea4[_0x3c8f15(0x182)]),_0x423c92=await readSqlLockFile(_0xff6731[_0x3c8f15(0x1a6)]),{appLock:_0x861581}=ensureSqlLockScope(_0x423c92??createEmptySqlLock(),_0x4b0ea4[_0x3c8f15(0x182)],_0xff6731['sqlRoot'],_0x3c8f15(0x197)),_0x44bad6=await getTargetSqlQueries(_0xff6731,_0x861581,_0x4b0ea4[_0x3c8f15(0x1ac)]('sqlcode')||undefined),_0x35349b=[];for(const _0x47bbf7 of _0x44bad6){const _0x217b87=await computeSqlFileHash(_0x47bbf7[_0x3c8f15(0x183)]),_0x12f89b=_0x861581['sqls'][_0x47bbf7[_0x3c8f15(0x17d)]],_0x467100=!!_0x12f89b&&(_0x12f89b[_0x3c8f15(0x1a7)]!==_0x47bbf7[_0x3c8f15(0x1ab)]||!!_0x47bbf7[_0x3c8f15(0x186)]&&_0x12f89b['sqlName']!==_0x47bbf7[_0x3c8f15(0x186)]);if(!_0x4b0ea4['bool'](_0x3c8f15(0x17b))&&_0x12f89b&&_0x12f89b[_0x3c8f15(0x190)]===_0x217b87&&!_0x467100)continue;_0x35349b[_0x3c8f15(0x197)](_0x47bbf7[_0x3c8f15(0x17d)]);}return{'method':_0x3c8f15(0x196),'url':_0x3c8f15(0x1aa),'body':{'sqlCodes':_0x35349b,'appCode':_0x4b0ea4[_0x3c8f15(0x182)]},'description':'Would\x20push\x20'+_0x35349b[_0x3c8f15(0x192)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x3aa027){const _0x6577bc=a193_0x579b6e,_0x24ba01=loadSqlProjectConfig(_0x3aa027[_0x6577bc(0x182)]),_0xe239c5=await readSqlLockFile(_0x24ba01['lockFilePath']),{lockData:_0x530083,appLock:_0x518dcb}=ensureSqlLockScope(_0xe239c5??createEmptySqlLock(),_0x3aa027[_0x6577bc(0x182)],_0x24ba01[_0x6577bc(0x189)],_0x6577bc(0x197)),_0x1e9671=await getTargetSqlQueries(_0x24ba01,_0x518dcb,_0x3aa027[_0x6577bc(0x1ac)]('sqlcode')||undefined);if(_0x1e9671[_0x6577bc(0x192)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x6577bc(0x1a1)};const _0x47228e=[],_0x7cee38=[],_0x16185f=[];for(const _0x35a73e of _0x1e9671){const _0x3174b4=_0x518dcb[_0x6577bc(0x184)][_0x35a73e[_0x6577bc(0x17d)]];if(!_0x3174b4){_0x16185f['push']({'sqlCode':_0x35a73e[_0x6577bc(0x17d)],'error':_0x6577bc(0x185)});continue;}try{const _0x36b1d3=await computeSqlFileHash(_0x35a73e[_0x6577bc(0x183)]),_0x11f315=_0x3174b4[_0x6577bc(0x1a7)]!==_0x35a73e[_0x6577bc(0x1ab)]||!!_0x35a73e[_0x6577bc(0x186)]&&_0x3174b4[_0x6577bc(0x186)]!==_0x35a73e[_0x6577bc(0x186)];if(!_0x3aa027[_0x6577bc(0x19b)](_0x6577bc(0x17b))&&_0x3174b4[_0x6577bc(0x190)]===_0x36b1d3&&!_0x11f315){_0x7cee38[_0x6577bc(0x197)]({'sqlCode':_0x35a73e[_0x6577bc(0x17d)],'reason':'unchanged'});continue;}if(_0x3174b4[_0x6577bc(0x188)]==null){_0x16185f[_0x6577bc(0x197)]({'sqlCode':_0x35a73e[_0x6577bc(0x17d)],'error':_0x6577bc(0x187)});continue;}const _0x143ed9=await readFile(_0x35a73e[_0x6577bc(0x183)],_0x6577bc(0x19a)),_0x30850f=stripLocalSqlMetadata(_0x143ed9,_0x35a73e[_0x6577bc(0x18e)]),_0x5bf308=_0x35a73e[_0x6577bc(0x186)]||_0x3174b4['sqlName'],_0x6c9e29=await resolveTargetDbBinding(_0x3aa027[_0x6577bc(0x182)],_0x35a73e,_0x3174b4),_0x33642f=await updateSqlQuery({'id':_0x3174b4[_0x6577bc(0x17c)],'appCode':_0x3aa027[_0x6577bc(0x182)],'sqlCode':_0x35a73e['sqlCode'],'sqlName':_0x5bf308,'dbId':_0x6c9e29[_0x6577bc(0x1b0)],'version':_0x3174b4[_0x6577bc(0x188)],'sqlContent':_0x30850f,'sqlConfig':_0x3174b4[_0x6577bc(0x1b5)]??undefined}),_0x53fecf=_0x33642f[_0x6577bc(0x1b0)]?await getDbName(_0x3aa027['appCode'],Number(_0x33642f[_0x6577bc(0x1b0)]))[_0x6577bc(0x1a4)](()=>_0x6c9e29[_0x6577bc(0x19e)]):_0x6c9e29['dbName'];_0x518dcb[_0x6577bc(0x184)][_0x35a73e['sqlCode']]={...buildSqlLockEntry(_0x33642f,_0x30850f,_0x36b1d3,{'dbName':_0x53fecf}),'path':_0x35a73e['relativePath'],'mode':_0x3174b4['mode']},await archivePreviousSqlFileIfNeeded(_0x24ba01,_0x3174b4[_0x6577bc(0x1a7)],_0x35a73e['relativePath']),_0x47228e['push']({'sqlCode':_0x35a73e[_0x6577bc(0x17d)],'remoteId':_0x3174b4[_0x6577bc(0x17c)]});}catch(_0x22d675){_0x16185f[_0x6577bc(0x197)]({'sqlCode':_0x35a73e['sqlCode'],'error':_0x22d675 instanceof Error?_0x22d675[_0x6577bc(0x1ad)]:String(_0x22d675)});}}return _0x518dcb['lastSync']=new Date()[_0x6577bc(0x1a8)](),await writeSqlLockFile(_0x24ba01['lockFilePath'],_0x530083),{'ok':_0x16185f[_0x6577bc(0x192)]===0x0,'data':{'pushed':_0x47228e,'skipped':_0x7cee38,'failed':_0x16185f},'message':_0x6577bc(0x1b7)+_0x47228e[_0x6577bc(0x192)]+_0x6577bc(0x18d)+_0x7cee38['length']+'\x20skipped,\x20'+_0x16185f[_0x6577bc(0x192)]+_0x6577bc(0x198)};}};async function archivePreviousSqlFileIfNeeded(_0xdec34a,_0x481dfe,_0x31575e){const _0x368851=a193_0x579b6e;if(!_0x481dfe||_0x481dfe===_0x31575e)return;const _0x2524dd=join(_0xdec34a['sqlRootDir'],_0x481dfe);if(!await fileExists(_0x2524dd))return;const _0x4f0bb7=await moveToTrash(_0xdec34a[_0x368851(0x19c)],_0xdec34a[_0x368851(0x1b2)],_0x2524dd);await cleanupEmptyDirectories(dirname(_0x2524dd),_0xdec34a['sqlRootDir']),void _0x4f0bb7;}async function moveToTrash(_0x5ab7e5,_0x5d5a94,_0x16bc92){const _0x37d783=a193_0x579b6e,_0x3052cd=new Date()[_0x37d783(0x1a8)]()[_0x37d783(0x1b4)](/[:.]/g,'-'),_0x2e9fac=relative(_0x5ab7e5,_0x16bc92),_0x3fb03c=join(_0x5d5a94,_0x3052cd,_0x2e9fac);return await mkdir(dirname(_0x3fb03c),{'recursive':!![]}),await rename(_0x16bc92,_0x3fb03c),_0x3fb03c;}async function cleanupEmptyDirectories(_0x57e586,_0x2704d6){const _0x2dffd1=a193_0x579b6e;let _0x4fa84e=resolve(_0x57e586);const _0x2b529d=resolve(_0x2704d6);while(_0x4fa84e[_0x2dffd1(0x199)](''+_0x2b529d+sep)||_0x4fa84e===_0x2b529d){if(_0x4fa84e===_0x2b529d)return;try{const _0x747775=await readdir(_0x4fa84e);if(_0x747775[_0x2dffd1(0x192)]>0x0)return;await rmdir(_0x4fa84e);}catch{return;}_0x4fa84e=dirname(_0x4fa84e);}}function a193_0x1b34(_0x5679c8,_0x4479ea){_0x5679c8=_0x5679c8-0x175;const _0x459243=a193_0x4592();let _0x1b3408=_0x459243[_0x5679c8];return _0x1b3408;}async function resolveTargetDbBinding(_0x5a889f,_0x3b98a0,_0x588b7f){const _0x8eb8d5=a193_0x579b6e,_0x34475f=_0x3b98a0[_0x8eb8d5(0x1ae)];if(!_0x34475f)return{'dbId':_0x588b7f['dbId'],'dbName':_0x588b7f['dbName']};const _0x5a43d8=buildDbDirectoryName(_0x588b7f[_0x8eb8d5(0x19e)],_0x588b7f[_0x8eb8d5(0x1b0)]);if(_0x34475f===_0x5a43d8)return{'dbId':_0x588b7f['dbId'],'dbName':_0x588b7f[_0x8eb8d5(0x19e)]};const _0x3509a5=parseExplicitDbDirectory(_0x34475f);if(_0x3509a5!=null)return{'dbId':_0x3509a5,'dbName':await getDbName(_0x5a889f,_0x3509a5)[_0x8eb8d5(0x1a4)](()=>undefined)};const _0x4a7ef1=await listDatabases(_0x5a889f),_0x49b11d=_0x4a7ef1['filter'](_0x4dfd0c=>buildDbDirectoryName(_0x4dfd0c['dbName'],_0x4dfd0c[_0x8eb8d5(0x1b0)])===_0x34475f);if(_0x49b11d[_0x8eb8d5(0x192)]===0x1)return{'dbId':_0x49b11d[0x0][_0x8eb8d5(0x1b0)],'dbName':_0x49b11d[0x0][_0x8eb8d5(0x19e)]};if(_0x49b11d[_0x8eb8d5(0x192)]===0x0)throw CliErrors[_0x8eb8d5(0x181)](_0x8eb8d5(0x179)+_0x34475f+_0x8eb8d5(0x1a2)+_0x3b98a0[_0x8eb8d5(0x17d)]+'.');const _0x188bc0=_0x49b11d[_0x8eb8d5(0x176)](_0x40a4eb=>_0x40a4eb['dbName']+'\x20('+_0x40a4eb[_0x8eb8d5(0x1b0)]+')')['join'](',\x20');throw CliErrors['validation'](_0x8eb8d5(0x18a)+_0x34475f+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x3b98a0[_0x8eb8d5(0x17d)]+':\x20'+_0x188bc0);}function parseExplicitDbDirectory(_0x2f198e){const _0x364e89=a193_0x579b6e,_0x446b4c=/^db-(\d+)$/[_0x364e89(0x18c)](_0x2f198e);if(!_0x446b4c)return null;const _0x4472dc=Number(_0x446b4c[0x1]);return Number['isFinite'](_0x4472dc)&&_0x4472dc>0x0?_0x4472dc:null;}
|
|
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 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x27b2d2=a194_0x58cc;(function(_0x4c43bc,_0x245688){const _0x22feb0=a194_0x58cc,_0x5e1787=_0x4c43bc();while(!![]){try{const _0x179eb7=-parseInt(_0x22feb0(0x178))/0x1+-parseInt(_0x22feb0(0x177))/0x2+parseInt(_0x22feb0(0x17e))/0x3*(parseInt(_0x22feb0(0x1a0))/0x4)+parseInt(_0x22feb0(0x180))/0x5+parseInt(_0x22feb0(0x18a))/0x6*(-parseInt(_0x22feb0(0x176))/0x7)+parseInt(_0x22feb0(0x17b))/0x8+-parseInt(_0x22feb0(0x18c))/0x9*(parseInt(_0x22feb0(0x19f))/0xa);if(_0x179eb7===_0x245688)break;else _0x5e1787['push'](_0x5e1787['shift']());}catch(_0xf61d39){_0x5e1787['push'](_0x5e1787['shift']());}}}(a194_0x47e9,0x2eb63));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_0x27b2d2(0x185);export function buildSqlLockEntry(_0x273410,_0x40edd6,_0x471cb0,_0x4dbcce){const _0x234f76=a194_0x27b2d2,_0xc52c5e=detectSqlMode(_0x40edd6);return{'path':buildSqlRelativePath(_0x273410['sqlCode'],_0x273410[_0x234f76(0x17f)],_0x4dbcce?.[_0x234f76(0x18e)],_0xc52c5e,_0x273410[_0x234f76(0x193)]),'hash':_0x471cb0,'remoteId':_0x273410['id'],'version':_0x273410['version'],'dbId':Number(_0x273410['dbId']),'dbName':_0x4dbcce?.[_0x234f76(0x18e)],'sqlName':_0x273410['sqlName'],'sqlConfig':_0x273410[_0x234f76(0x187)]??undefined,'mode':_0xc52c5e};}export function cloneSqlLockData(_0x45d259){const _0x21921b=a194_0x27b2d2;return{'apps':Object[_0x21921b(0x179)](Object[_0x21921b(0x194)](_0x45d259[_0x21921b(0x190)])[_0x21921b(0x19a)](([_0x47552d,_0x1aa687])=>[_0x47552d,{'sqlRoot':_0x1aa687['sqlRoot'],'lastSync':_0x1aa687[_0x21921b(0x17c)],'sqls':{..._0x1aa687['sqls']}}]))};}export function ensureRemoteSqlContent(_0x4013d4){const _0x47d2f7=a194_0x27b2d2;return _0x4013d4[_0x47d2f7(0x19e)]??'';}export function buildLocalSqlFileContent(_0x2670a3,_0xa04ee2,_0x40a8a3){const _0x19f45c=a194_0x27b2d2,_0xcbd097=_0x40a8a3?.[_0x19f45c(0x186)]??detectSqlMode(_0xa04ee2),_0x39b0a4=stripLocalSqlMetadata(_0xa04ee2,_0xcbd097)['trim'](),_0x563ef5=[...buildMetadataHeaderLines({'sqlCode':_0x2670a3['sqlCode'],'sqlName':_0x2670a3[_0x19f45c(0x17f)],'dbId':_0x2670a3['dbId'],'dbName':_0x40a8a3?.[_0x19f45c(0x18e)],'mode':_0xcbd097,'syncedAt':_0x40a8a3?.[_0x19f45c(0x188)],'description':_0x40a8a3?.[_0x19f45c(0x181)]},_0xcbd097),'',_0x39b0a4],_0x30c39c=_0x563ef5[_0x19f45c(0x19c)]('\x0a');return _0x30c39c[_0x19f45c(0x18b)]('\x0a')?_0x30c39c:_0x30c39c+'\x0a';}export function stripLocalSqlMetadata(_0x41468f,_0x54b75f){const _0x408668=a194_0x27b2d2,_0x5acffa=_0x41468f[_0x408668(0x18f)](/\r\n/g,'\x0a')[_0x408668(0x191)]('\x0a'),_0x178b35=[];let _0x77c65=0x0;if(_0x54b75f===_0x408668(0x182))while(_0x77c65<_0x5acffa[_0x408668(0x184)]){const _0x202fbd=_0x5acffa[_0x77c65]??'';if(/^\s*<!--\s*@lovrabet\./[_0x408668(0x197)](_0x202fbd)){_0x77c65++;continue;}if(_0x202fbd[_0x408668(0x1a1)]()===''&&_0x77c65>0x0){_0x77c65++;continue;}break;}else while(_0x77c65<_0x5acffa[_0x408668(0x184)]){const _0xb43ff1=_0x5acffa[_0x77c65]??'';if(/^\s*--\s*@lovrabet\./['test'](_0xb43ff1)){_0x77c65++;continue;}if(_0xb43ff1[_0x408668(0x1a1)]()===''&&_0x77c65>0x0){_0x77c65++;continue;}break;}for(;_0x77c65<_0x5acffa[_0x408668(0x184)];_0x77c65++){_0x178b35[_0x408668(0x19d)](_0x5acffa[_0x77c65]);}return _0x178b35[_0x408668(0x19c)]('\x0a')[_0x408668(0x198)]();}export function resolveSqlMode(_0x4961ef,_0x51ebb0){const _0x3128d3=a194_0x27b2d2;if(_0x51ebb0?.[_0x3128d3(0x186)])return _0x51ebb0[_0x3128d3(0x186)];return detectSqlMode(_0x4961ef);}export function resolveSqlFileName(_0x16bc18,_0x48b32e,_0x7b18b0){const _0x4c4663=a194_0x27b2d2;if(_0x7b18b0?.['path'])return _0x7b18b0[_0x4c4663(0x199)];if(_0x7b18b0?.[_0x4c4663(0x17f)]||_0x7b18b0?.[_0x4c4663(0x18e)])return buildSqlRelativePath(_0x16bc18,_0x7b18b0?.[_0x4c4663(0x17f)],_0x7b18b0?.[_0x4c4663(0x18e)],resolveSqlMode(_0x48b32e,_0x7b18b0),_0x7b18b0?.[_0x4c4663(0x193)]);return buildDefaultSqlFileName(_0x16bc18,resolveSqlMode(_0x48b32e,_0x7b18b0));}function a194_0x47e9(){const _0x2aa07b=['description','mybatisXml','stdin','length','.rabetbase/sql','mode','sqlConfig','syncedAt','sqlCode','1781154GMelqA','endsWith','18xHMfMn','includes','dbName','replace','apps','split','yes','dbId','entries','--\x20@lovrabet.','\x20-->','test','trimStart','path','map','toLowerCase','join','push','sqlContent','1167980YWPNGI','18576uCDqen','trim','7kuVSgc','115042cUTAgU','197554wemxND','fromEntries','filter','3035064tspwou','lastSync','\x20[y/N]\x20','195bEoQMr','sqlName','1478090ZAVKKS'];a194_0x47e9=function(){return _0x2aa07b;};return a194_0x47e9();}export function resolveSqlLocalDir(_0x37c178,_0x5f0be7){return join(_0x37c178,SQL_LOCAL_REL_DIR,_0x5f0be7);}export async function confirmForceOverwrite(_0x122eeb){const _0x2ccbdf=a194_0x27b2d2,_0x3ce5a1=createInterface({'input':process[_0x2ccbdf(0x183)],'output':process['stderr']}),_0x3049df=await new Promise(_0x210095=>{const _0x48a959=_0x2ccbdf;_0x3ce5a1['question'](_0x122eeb+_0x48a959(0x17d),_0x210095);});return _0x3ce5a1['close'](),['y',_0x2ccbdf(0x192)][_0x2ccbdf(0x18d)](_0x3049df['trim']()[_0x2ccbdf(0x19b)]());}function a194_0x58cc(_0x6bae81,_0x272a61){_0x6bae81=_0x6bae81-0x176;const _0x47e965=a194_0x47e9();let _0x58cca3=_0x47e965[_0x6bae81];return _0x58cca3;}export function findSqlLockScope(_0x420304,_0x2da468){const _0x2ed244=a194_0x27b2d2;return _0x420304[_0x2ed244(0x190)][_0x2da468];}function buildMetadataHeaderLines(_0x2a6ff6,_0x32aa24){const _0x4af264=a194_0x27b2d2,_0x37e4bf=[[_0x4af264(0x189),_0x2a6ff6['sqlCode']],['sqlName',_0x2a6ff6[_0x4af264(0x17f)]],[_0x4af264(0x193),_0x2a6ff6['dbId']],[_0x4af264(0x18e),_0x2a6ff6[_0x4af264(0x18e)]],['mode',_0x2a6ff6[_0x4af264(0x186)]],[_0x4af264(0x188),_0x2a6ff6['syncedAt']],[_0x4af264(0x181),_0x2a6ff6['description']]];if(_0x32aa24==='mybatisXml')return _0x37e4bf[_0x4af264(0x17a)](([,_0x44f96a])=>_0x44f96a!==undefined&&_0x44f96a!==null&&String(_0x44f96a)[_0x4af264(0x1a1)]()!=='')[_0x4af264(0x19a)](([_0x2e9beb,_0x52f0a5])=>'<!--\x20@lovrabet.'+_0x2e9beb+':\x20'+String(_0x52f0a5)+_0x4af264(0x196));return _0x37e4bf[_0x4af264(0x17a)](([,_0x3cc5c4])=>_0x3cc5c4!==undefined&&_0x3cc5c4!==null&&String(_0x3cc5c4)[_0x4af264(0x1a1)]()!=='')['map'](([_0x3c28e9,_0x3c78f8])=>_0x4af264(0x195)+_0x3c28e9+':\x20'+String(_0x3c78f8));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a195_0x406a(){const _0x44a39c=['map','142860cHaNTc','3753068IdaJck','lockFilePath','sqls','2kElwgX','keys','lockKey','read','\x20remote-only','8EUwunx','9PZqBAM','totalCount','length','relativePath','hash','sql','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','80863cElJSv','\x20unchanged','push','31092DGZOAC','1768yRTOJL','6959570RxhyjM','sqlRoot','55XzbGiD','74766jxIoSv','status','appCode','boolean','\x20missing,\x20','remote','sqlCode','sqlName','416647kILTOb','40tcdNap','tableData','has','\x20modified,\x20','bool'];a195_0x406a=function(){return _0x44a39c;};return a195_0x406a();}const a195_0x40c0c2=a195_0x7945;function a195_0x7945(_0x4efb92,_0x4cc06b){_0x4efb92=_0x4efb92-0x1a0;const _0x406a89=a195_0x406a();let _0x794534=_0x406a89[_0x4efb92];return _0x794534;}(function(_0x280a5f,_0xc561c5){const _0xa148b1=a195_0x7945,_0x4a6964=_0x280a5f();while(!![]){try{const _0x3ad2db=-parseInt(_0xa148b1(0x1c1))/0x1*(-parseInt(_0xa148b1(0x1b4))/0x2)+parseInt(_0xa148b1(0x1a1))/0x3*(-parseInt(_0xa148b1(0x1aa))/0x4)+parseInt(_0xa148b1(0x1a0))/0x5*(parseInt(_0xa148b1(0x1c4))/0x6)+-parseInt(_0xa148b1(0x1a9))/0x7*(parseInt(_0xa148b1(0x1b9))/0x8)+-parseInt(_0xa148b1(0x1ba))/0x9*(parseInt(_0xa148b1(0x1c6))/0xa)+-parseInt(_0xa148b1(0x1b1))/0xb+-parseInt(_0xa148b1(0x1b0))/0xc*(-parseInt(_0xa148b1(0x1c5))/0xd);if(_0x3ad2db===_0xc561c5)break;else _0x4a6964['push'](_0x4a6964['shift']());}catch(_0x4026b4){_0x4a6964['push'](_0x4a6964['shift']());}}}(a195_0x406a,0x645b3));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x22572f){const _0x48d8e8=a195_0x7945,_0x48e5f0=[];let _0x49d0f8=0x1;while(!![]){const _0x45d13e=await listSqlQueries(_0x22572f,{'currentPage':_0x49d0f8,'pageSize':PAGE_SIZE}),_0x150144=_0x45d13e[_0x48d8e8(0x1ab)]??[];_0x48e5f0[_0x48d8e8(0x1c3)](..._0x150144['map'](_0x1721ae=>_0x1721ae[_0x48d8e8(0x1a7)]));if(_0x150144['length']===0x0)break;const _0x533fa0=_0x45d13e['paging']?.[_0x48d8e8(0x1bb)];if(_0x533fa0!=null?_0x48e5f0['length']>=_0x533fa0:_0x150144[_0x48d8e8(0x1bc)]<PAGE_SIZE)break;_0x49d0f8++;}return _0x48e5f0;}export const sqlStatus={'service':a195_0x40c0c2(0x1bf),'command':a195_0x40c0c2(0x1a2),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a195_0x40c0c2(0x1b7),'flags':[{'name':a195_0x40c0c2(0x1a6),'type':a195_0x40c0c2(0x1a4),'description':a195_0x40c0c2(0x1c0)}],async 'execute'(_0x1fe003){const _0x53e8da=a195_0x40c0c2,_0x6f1506=loadSqlProjectConfig(_0x1fe003[_0x53e8da(0x1a3)]),_0x5a655c=await readSqlLockFile(_0x6f1506[_0x53e8da(0x1b2)]),{appLock:_0x3370d3}=ensureSqlLockScope(_0x5a655c??createEmptySqlLock(),_0x6f1506[_0x53e8da(0x1a3)],_0x6f1506[_0x53e8da(0x1c7)],_0x53e8da(0x1a2)),_0x3762fa=await scanLocalSqlQueries(_0x6f1506),_0x288bf8=[],_0xc4ce57=[],_0xead54=[],_0x1f6d5e=[],_0xf42dbe=new Set(_0x3762fa[_0x53e8da(0x1af)](_0x25ea58=>_0x25ea58[_0x53e8da(0x1b6)]));for(const _0x26909a of _0x3762fa){const _0x38ca9c=await computeSqlFileHash(_0x26909a['filePath']),_0x538037=_0x3370d3[_0x53e8da(0x1b3)][_0x26909a[_0x53e8da(0x1b6)]],_0x308a93=!!_0x538037&&_0x538037['path']!==_0x26909a[_0x53e8da(0x1bd)],_0x18cfe8=!!_0x538037&&!!_0x26909a[_0x53e8da(0x1a8)]&&_0x538037[_0x53e8da(0x1a8)]!==_0x26909a[_0x53e8da(0x1a8)];if(!_0x538037)_0x288bf8[_0x53e8da(0x1c3)](_0x26909a[_0x53e8da(0x1b6)]);else _0x538037[_0x53e8da(0x1be)]!==_0x38ca9c||_0x308a93||_0x18cfe8?_0xc4ce57[_0x53e8da(0x1c3)](_0x26909a[_0x53e8da(0x1b6)]):_0xead54[_0x53e8da(0x1c3)](_0x26909a[_0x53e8da(0x1b6)]);}for(const _0x157026 of Object[_0x53e8da(0x1b5)](_0x3370d3['sqls'])){!_0xf42dbe[_0x53e8da(0x1ac)](_0x157026)&&_0x1f6d5e[_0x53e8da(0x1c3)](_0x157026);}const _0x453b49=[];if(_0x1fe003[_0x53e8da(0x1ae)](_0x53e8da(0x1a6))){const _0x1a55cd=await fetchAllSqlCodes(_0x1fe003[_0x53e8da(0x1a3)]);for(const _0x4c48d8 of _0x1a55cd){!_0xf42dbe[_0x53e8da(0x1ac)](_0x4c48d8)&&!_0x3370d3[_0x53e8da(0x1b3)][_0x4c48d8]&&_0x453b49[_0x53e8da(0x1c3)](_0x4c48d8);}}const _0x3026d7=_0x288bf8[_0x53e8da(0x1bc)]===0x0&&_0xc4ce57[_0x53e8da(0x1bc)]===0x0&&_0x1f6d5e[_0x53e8da(0x1bc)]===0x0&&_0x453b49[_0x53e8da(0x1bc)]===0x0;return{'ok':!![],'data':{'added':_0x288bf8,'modified':_0xc4ce57,'missing':_0x1f6d5e,'unchanged':_0xead54,'remoteOnly':_0x453b49},'message':_0x3026d7?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x288bf8[_0x53e8da(0x1bc)]+'\x20added,\x20'+_0xc4ce57['length']+_0x53e8da(0x1ad)+_0x1f6d5e[_0x53e8da(0x1bc)]+_0x53e8da(0x1a5)+_0xead54[_0x53e8da(0x1bc)]+_0x53e8da(0x1c2)+(_0x453b49[_0x53e8da(0x1bc)]>0x0?',\x20'+_0x453b49[_0x53e8da(0x1bc)]+_0x53e8da(0x1b8):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a196_0x218a(){const _0x4f775c=['Provide\x20--file\x20or\x20--sql','sqlType','22xkuRie','cwd','8705920ZZhRxv','flagMissing','trim','5Yehipc','5326659mqEnHa','length','\x22\x20not\x20found\x20in\x20any\x20dataset','8cQufKm','check-indexes','flatMap','push','schema:','columnNames','--check-indexes\x20requires\x20--schemas.','indexes','isDangerous','from','index_columns','message','tables','schemas','valid','index_type','split','Table\x20\x22','indexName','pkField','schemaWarnings','sql','read','579493aasjyl','str','utf-8','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','map','find','parameters','reason','toLowerCase','62115ZYSefC','validate','joinAudit','fields','index_name','3978864fyZtCU','type','string','2748216kbdgIU','file','columns','primary','tableName','isArray','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','\x22\x20not\x20found\x20or\x20not\x20accessible','4980612OPkLYZ','Dataset\x20\x22','filter','unshift','dbtableConfig','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','name','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','validation','SQL\x20schema\x20validation','dataset'];a196_0x218a=function(){return _0x4f775c;};return a196_0x218a();}const a196_0x243ba2=a196_0x55c2;(function(_0x23a0f6,_0x51b829){const _0x4eb910=a196_0x55c2,_0x49ae76=_0x23a0f6();while(!![]){try{const _0x477538=parseInt(_0x4eb910(0x1eb))/0x1+-parseInt(_0x4eb910(0x211))/0x2*(-parseInt(_0x4eb910(0x1f4))/0x3)+parseInt(_0x4eb910(0x1fc))/0x4+parseInt(_0x4eb910(0x1d0))/0x5*(-parseInt(_0x4eb910(0x1f9))/0x6)+-parseInt(_0x4eb910(0x204))/0x7+parseInt(_0x4eb910(0x1d4))/0x8*(-parseInt(_0x4eb910(0x1d1))/0x9)+parseInt(_0x4eb910(0x1cd))/0xa;if(_0x477538===_0x51b829)break;else _0x49ae76['push'](_0x49ae76['shift']());}catch(_0x359dd4){_0x49ae76['push'](_0x49ae76['shift']());}}}(a196_0x218a,0x6142f));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a196_0x55c2(_0x44baf7,_0x2af3e5){_0x44baf7=_0x44baf7-0x1cc;const _0x218ae2=a196_0x218a();let _0x55c25b=_0x218ae2[_0x44baf7];return _0x55c25b;}import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';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':a196_0x243ba2(0x1e9),'command':a196_0x243ba2(0x1f5),'description':a196_0x243ba2(0x209),'risk':a196_0x243ba2(0x1ea),'flags':[{'name':a196_0x243ba2(0x1fd),'type':a196_0x243ba2(0x1fb),'description':a196_0x243ba2(0x1ee)},{'name':a196_0x243ba2(0x1e9),'type':a196_0x243ba2(0x1fb),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':'schemas','type':'string','description':a196_0x243ba2(0x20b)},{'name':'check-indexes','type':'boolean','description':a196_0x243ba2(0x202)}],async 'execute'(_0x481abd){const _0x1ddd32=a196_0x243ba2,_0x52fc87=_0x481abd[_0x1ddd32(0x1ec)](_0x1ddd32(0x1fd)),_0x55ae0b=_0x481abd[_0x1ddd32(0x1ec)](_0x1ddd32(0x1e9)),_0x183681=_0x481abd[_0x1ddd32(0x1ec)](_0x1ddd32(0x1e1)),_0x583eda=_0x481abd['bool'](_0x1ddd32(0x1d5));if(!_0x52fc87&&!_0x55ae0b)throw CliErrors[_0x1ddd32(0x1ce)](_0x1ddd32(0x1fd),_0x1ddd32(0x20f));if(_0x583eda&&!_0x183681)throw CliErrors[_0x1ddd32(0x20c)](_0x1ddd32(0x1da));let _0xf7d83;if(_0x52fc87){const _0x249b0d=resolve(process[_0x1ddd32(0x1cc)](),_0x52fc87);if(!existsSync(_0x249b0d))throw CliErrors[_0x1ddd32(0x20c)]('File\x20not\x20found:\x20'+_0x249b0d);_0xf7d83=readFileSync(_0x249b0d,_0x1ddd32(0x1ed));}else _0xf7d83=_0x55ae0b;const _0xcb4a40=validateSql(_0xf7d83),_0x1f9e36={'valid':_0xcb4a40[_0x1ddd32(0x1e2)],'sqlType':_0xcb4a40[_0x1ddd32(0x210)][_0x1ddd32(0x1fa)],'isSelectOnly':_0xcb4a40[_0x1ddd32(0x210)]['isSelectOnly'],'isDangerous':_0xcb4a40[_0x1ddd32(0x210)][_0x1ddd32(0x1dc)],'tables':_0xcb4a40['tables'],'parameters':_0xcb4a40[_0x1ddd32(0x1f1)],'message':_0xcb4a40[_0x1ddd32(0x1df)]};_0xcb4a40[_0x1ddd32(0x210)][_0x1ddd32(0x1f2)]&&(_0x1f9e36[_0x1ddd32(0x1f2)]=_0xcb4a40[_0x1ddd32(0x210)][_0x1ddd32(0x1f2)]);if(_0x183681&&_0xcb4a40[_0x1ddd32(0x1e2)]){const _0x708b6c=_0x183681[_0x1ddd32(0x1e4)](',')[_0x1ddd32(0x1ef)](_0xd7029c=>_0xd7029c['trim']())['filter'](Boolean),_0x28c1ed=[],_0x8fd972=[],_0x1c39e6=filterDbTableBackedDatasets(await listDatasets(_0x481abd['appCode'])),_0x47ce77=new Map(_0x1c39e6[_0x1ddd32(0x1ef)](_0x5af94c=>[_0x5af94c[_0x1ddd32(0x208)]?.[_0x1ddd32(0x200)]?.[_0x1ddd32(0x1f3)](),_0x5af94c]));for(const _0x56eb37 of _0xcb4a40[_0x1ddd32(0x1e0)]){const _0x3aecc6=_0x47ce77['get'](_0x56eb37[_0x1ddd32(0x1f3)]());!_0x3aecc6&&_0x28c1ed[_0x1ddd32(0x1d7)](_0x1ddd32(0x1e5)+_0x56eb37+_0x1ddd32(0x1d3));}for(const _0x49912e of _0x708b6c){let _0x250022;try{_0x250022=await getDatasetDetail(_0x49912e);}catch{_0x28c1ed[_0x1ddd32(0x1d7)](_0x1ddd32(0x205)+_0x49912e+_0x1ddd32(0x203));continue;}assertDatasetIsDbTableBacked(_0x250022,_0x1ddd32(0x20d));const _0x1acc0e=Array['isArray'](_0x250022[_0x1ddd32(0x1f7)])?_0x250022[_0x1ddd32(0x1f7)]:[],_0x2feec9=new Set(_0x1acc0e['map'](_0x1fd9d4=>_0x1fd9d4[_0x1ddd32(0x20a)]?.[_0x1ddd32(0x1f3)]())),_0xdbc042=_0x250022['dbtableConfig']?.['tableName']||_0x250022[_0x1ddd32(0x200)]||_0x49912e;_0x1f9e36[_0x1ddd32(0x1d8)+_0xdbc042]={'code':_0x49912e,'tableName':_0xdbc042,'fieldCount':_0x2feec9['size'],'fields':Array[_0x1ddd32(0x1dd)](_0x2feec9)};if(_0x583eda){const _0x5ab889=normalizeDatasetIndexes(_0x250022);_0x8fd972[_0x1ddd32(0x1d7)]({'tableName':_0xdbc042,..._0x5ab889});}}_0x28c1ed['length']>0x0&&(_0x1f9e36[_0x1ddd32(0x1e8)]=_0x28c1ed),_0x583eda&&(_0x1f9e36[_0x1ddd32(0x1f6)]=auditSqlJoinIndexes(_0xf7d83,_0x8fd972));}return{'ok':_0xcb4a40[_0x1ddd32(0x1e2)],'data':_0x1f9e36,'message':_0xcb4a40[_0x1ddd32(0x1df)]};}};function normalizeDatasetIndexes(_0x73b4c){const _0x1e3e10=a196_0x243ba2,_0x2e69c2=Array[_0x1e3e10(0x201)](_0x73b4c?.[_0x1e3e10(0x20e)]?.[_0x1e3e10(0x1db)])?_0x73b4c[_0x1e3e10(0x20e)][_0x1e3e10(0x1db)]:Array[_0x1e3e10(0x201)](_0x73b4c?.[_0x1e3e10(0x1db)])?_0x73b4c[_0x1e3e10(0x1db)]:[],_0x4b527a=_0x2e69c2[_0x1e3e10(0x1d6)](_0x136b50=>{const _0x281aad=_0x1e3e10,_0x25e7c2=Array[_0x281aad(0x201)](_0x136b50?.['index_columns'])?_0x136b50[_0x281aad(0x1de)]:Array[_0x281aad(0x201)](_0x136b50?.[_0x281aad(0x1d9)])?_0x136b50[_0x281aad(0x1d9)]:Array[_0x281aad(0x201)](_0x136b50?.['columns'])?_0x136b50[_0x281aad(0x1fe)]:[],_0xd7f011=_0x25e7c2['filter'](_0x4f3207=>typeof _0x4f3207==='string')[_0x281aad(0x1ef)](_0x521c74=>_0x521c74[_0x281aad(0x1cf)]())[_0x281aad(0x206)](Boolean);if(_0xd7f011[_0x281aad(0x1d2)]===0x0)return[];const _0x399e4e=[_0x136b50?.[_0x281aad(0x1e6)],_0x136b50?.[_0x281aad(0x1f8)],_0x136b50?.['name']][_0x281aad(0x1f0)](_0x48a3a7=>typeof _0x48a3a7===_0x281aad(0x1fb)&&_0x48a3a7[_0x281aad(0x1cf)]()),_0xbd95e5=[_0x136b50?.[_0x281aad(0x1e3)],_0x136b50?.[_0x281aad(0x1fa)]][_0x281aad(0x1f0)](_0x19dbf0=>typeof _0x19dbf0===_0x281aad(0x1fb)&&_0x19dbf0[_0x281aad(0x1cf)]());return[{..._0x399e4e?{'name':_0x399e4e['trim']()}:{},..._0xbd95e5?{'type':_0xbd95e5['trim']()}:{},'columns':_0xd7f011}];}),_0x295e70=[..._0x4b527a],_0x245be3=typeof _0x73b4c?.[_0x1e3e10(0x208)]?.[_0x1e3e10(0x1e7)]===_0x1e3e10(0x1fb)?_0x73b4c[_0x1e3e10(0x208)][_0x1e3e10(0x1e7)][_0x1e3e10(0x1e4)](',')['map'](_0x3ed0e5=>_0x3ed0e5[_0x1e3e10(0x1cf)]())[_0x1e3e10(0x206)](Boolean):[];return _0x245be3[_0x1e3e10(0x1d2)]>0x0&&_0x295e70[_0x1e3e10(0x207)]({'type':_0x1e3e10(0x1ff),'columns':_0x245be3}),{'indexes':_0x295e70,'metadataAvailable':_0x4b527a[_0x1e3e10(0x1d2)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x573dbd,_0x4652ce){const _0x36195b=a197_0x1dc0,_0x4df951=_0x573dbd();while(!![]){try{const _0x286f0d=parseInt(_0x36195b(0x189))/0x1*(-parseInt(_0x36195b(0x18c))/0x2)+-parseInt(_0x36195b(0x191))/0x3*(-parseInt(_0x36195b(0x18b))/0x4)+-parseInt(_0x36195b(0x192))/0x5+-parseInt(_0x36195b(0x18d))/0x6+-parseInt(_0x36195b(0x190))/0x7*(-parseInt(_0x36195b(0x193))/0x8)+parseInt(_0x36195b(0x18e))/0x9*(-parseInt(_0x36195b(0x18a))/0xa)+parseInt(_0x36195b(0x18f))/0xb;if(_0x286f0d===_0x4652ce)break;else _0x4df951['push'](_0x4df951['shift']());}catch(_0x1c8a59){_0x4df951['push'](_0x4df951['shift']());}}}(a197_0x218b,0xd0785));function a197_0x218b(){const _0x33bc98=['2411142VhHoNK','5528922vnHznA','18IbVTim','19022344gRBUzF','4312eDowaQ','2943027AmWWQZ','3619920bDgxnt','13152ghAGYP','1eHbCuk','90410FliHdL','4oNYmZb'];a197_0x218b=function(){return _0x33bc98;};return a197_0x218b();}import{taskStatus}from'../../commands/task/status.js';function a197_0x1dc0(_0x30b781,_0x2b2aa4){_0x30b781=_0x30b781-0x189;const _0x218bfd=a197_0x218b();let _0x1dc0fb=_0x218bfd[_0x30b781];return _0x1dc0fb;}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a198_0x3a0bef=a198_0x4537;(function(_0x335338,_0x36163a){const _0x4fc10e=a198_0x4537,_0x24dce3=_0x335338();while(!![]){try{const _0x58f2dc=parseInt(_0x4fc10e(0x1cc))/0x1*(parseInt(_0x4fc10e(0x1d2))/0x2)+parseInt(_0x4fc10e(0x1d4))/0x3*(parseInt(_0x4fc10e(0x1d3))/0x4)+parseInt(_0x4fc10e(0x1c4))/0x5*(-parseInt(_0x4fc10e(0x1c7))/0x6)+-parseInt(_0x4fc10e(0x1d8))/0x7*(parseInt(_0x4fc10e(0x1ca))/0x8)+-parseInt(_0x4fc10e(0x1c2))/0x9+parseInt(_0x4fc10e(0x1c8))/0xa+-parseInt(_0x4fc10e(0x1db))/0xb;if(_0x58f2dc===_0x36163a)break;else _0x24dce3['push'](_0x24dce3['shift']());}catch(_0x38f6be){_0x24dce3['push'](_0x24dce3['shift']());}}}(a198_0x4088,0x36739));function a198_0x4537(_0x599c16,_0x2081eb){_0x599c16=_0x599c16-0x1c2;const _0x4088b6=a198_0x4088();let _0x453725=_0x4088b6[_0x599c16];return _0x453725;}function a198_0x4088(){const _0x3b361f=['apiError',',\x20received\x20','7DYFzji','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','flagMissing','1202113aJgYmE','cookie','190890wScVzY','isTerminal','253885vBfnQz','read','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','12DGIUsa','3132150cXvjaE','trim','1755016CqhuAl','string','1526ARiWDh','compress','task-id','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','taskId','appCode','34VKjFAb','268240jBUoOf','15wwcprw','str'];a198_0x4088=function(){return _0x3b361f;};return a198_0x4088();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':'status','description':a198_0x3a0bef(0x1d9),'risk':a198_0x3a0bef(0x1c5),'defaultOutputFormat':a198_0x3a0bef(0x1cd),'structuredErrors':!![],'flags':[{'name':'task-id','type':a198_0x3a0bef(0x1cb),'required':!![],'description':a198_0x3a0bef(0x1cf)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0xa587c5){const _0x4bbbb8=a198_0x3a0bef;if(!_0xa587c5['str'](_0x4bbbb8(0x1ce))[_0x4bbbb8(0x1c9)]())throw CliErrors[_0x4bbbb8(0x1da)](_0x4bbbb8(0x1ce));},async 'execute'(_0x330692){const _0x43f453=a198_0x3a0bef,_0x287247=_0x330692[_0x43f453(0x1d5)](_0x43f453(0x1ce))[_0x43f453(0x1c9)](),_0x12cce8=normalizeAsyncTask(await getAsyncTaskStatus(_0x287247,_0x330692[_0x43f453(0x1d1)],_0x330692[_0x43f453(0x1dc)]));if(_0x12cce8['taskId']!==_0x287247)throw CliErrors[_0x43f453(0x1d6)](_0x43f453(0x1c6)+_0x287247+_0x43f453(0x1d7)+_0x12cce8[_0x43f453(0x1d0)]+'.');const _0x56d5c7=buildAsyncTaskStatusCommand(_0x12cce8[_0x43f453(0x1d0)],_0x330692[_0x43f453(0x1d1)]);return{'ok':!![],'message':asyncTaskMessage(_0x12cce8),'data':{'appCode':_0x330692[_0x43f453(0x1d1)],..._0x12cce8,'query':_0x12cce8[_0x43f453(0x1c3)]?null:{'command':_0x56d5c7}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1dbf3b,_0x41d86a){const _0x23ab84=a199_0x1993,_0x2c9064=_0x1dbf3b();while(!![]){try{const _0x341b5e=parseInt(_0x23ab84(0x1d2))/0x1*(-parseInt(_0x23ab84(0x1cd))/0x2)+-parseInt(_0x23ab84(0x1d5))/0x3*(parseInt(_0x23ab84(0x1cc))/0x4)+-parseInt(_0x23ab84(0x1d1))/0x5*(parseInt(_0x23ab84(0x1d3))/0x6)+parseInt(_0x23ab84(0x1d6))/0x7+-parseInt(_0x23ab84(0x1ce))/0x8*(parseInt(_0x23ab84(0x1cf))/0x9)+-parseInt(_0x23ab84(0x1d7))/0xa*(-parseInt(_0x23ab84(0x1d4))/0xb)+parseInt(_0x23ab84(0x1d0))/0xc;if(_0x341b5e===_0x41d86a)break;else _0x2c9064['push'](_0x2c9064['shift']());}catch(_0xee8c07){_0x2c9064['push'](_0x2c9064['shift']());}}}(a199_0x4c27,0xee340));function a199_0x1993(_0x13aab4,_0x52c253){_0x13aab4=_0x13aab4-0x1cc;const _0x4c27fb=a199_0x4c27();let _0x199323=_0x4c27fb[_0x13aab4];return _0x199323;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];function a199_0x4c27(){const _0x21590b=['10KagEjf','12qrHcmN','1222264TUQPKQ','40rEqYBp','647415aylLsu','25921140EOOZnV','5dpbjdi','1MaMLCI','7381548gQKfbI','12451824kILZyl','1279617TcdMUx','8149981uiLwfb'];a199_0x4c27=function(){return _0x21590b;};return a199_0x4c27();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a200_0x51f787=a200_0x4f8d;function a200_0x5827(){const _0x537166=['read','3168095PhFvyK','length','flagMissing','5111825tONrld','Found\x20','2wHVzHP','506736AKODNd','2878264LvyZwd','3848994TzUchN','members-list','36VFfynW','Pass\x20--tenant-code\x20<code>.','trim','str','Exact\x20tenant\x20code','297496BJGkEK','3887368jEnvko','tenant','tenant-code'];a200_0x5827=function(){return _0x537166;};return a200_0x5827();}(function(_0xa9ba2c,_0x55416c){const _0x5c86ce=a200_0x4f8d,_0x3c8c66=_0xa9ba2c();while(!![]){try{const _0x4dffb1=-parseInt(_0x5c86ce(0xc5))/0x1*(parseInt(_0x5c86ce(0xbb))/0x2)+parseInt(_0x5c86ce(0xb4))/0x3+-parseInt(_0x5c86ce(0xb3))/0x4+-parseInt(_0x5c86ce(0xc3))/0x5+parseInt(_0x5c86ce(0xb2))/0x6+-parseInt(_0x5c86ce(0xc0))/0x7+-parseInt(_0x5c86ce(0xbc))/0x8*(-parseInt(_0x5c86ce(0xb6))/0x9);if(_0x4dffb1===_0x55416c)break;else _0x3c8c66['push'](_0x3c8c66['shift']());}catch(_0x215b16){_0x3c8c66['push'](_0x3c8c66['shift']());}}}(a200_0x5827,0xc7fb6));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a200_0x4f8d(_0xe8066f,_0x394c8c){_0xe8066f=_0xe8066f-0xb2;const _0x58279e=a200_0x5827();let _0x4f8d40=_0x58279e[_0xe8066f];return _0x4f8d40;}import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a200_0x51f787(0xbd),'command':a200_0x51f787(0xb5),'description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':a200_0x51f787(0xbf),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a200_0x51f787(0xbe),'type':'string','required':!![],'description':a200_0x51f787(0xba)}],async 'validate'(_0x53d2ee){const _0x196e54=a200_0x51f787;if(!_0x53d2ee[_0x196e54(0xb9)](_0x196e54(0xbe))[_0x196e54(0xb8)]())throw CliErrors[_0x196e54(0xc2)](_0x196e54(0xbe),_0x196e54(0xb7));},async 'execute'(_0x1d4b24){const _0x132cf5=a200_0x51f787,_0x2e2ec4=_0x1d4b24[_0x132cf5(0xb9)](_0x132cf5(0xbe))[_0x132cf5(0xb8)](),_0x4fcb82=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x2e2ec4,_0x4fcb82);const _0x2c510a=projectTenantMembers(await listTenantDirectoryMembers(_0x2e2ec4));return{'ok':!![],'data':{'tenantCode':_0x2e2ec4,'items':_0x2c510a,'totalCount':_0x2c510a['length']},'message':_0x132cf5(0xc4)+_0x2c510a[_0x132cf5(0xc1)]+'\x20tenant\x20member(s)'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4687f4,_0x5b732f){const _0x2cd1ae=a201_0x68ff,_0x273a32=_0x4687f4();while(!![]){try{const _0x35b63f=parseInt(_0x2cd1ae(0x11f))/0x1+parseInt(_0x2cd1ae(0x124))/0x2*(-parseInt(_0x2cd1ae(0x112))/0x3)+parseInt(_0x2cd1ae(0x10d))/0x4*(parseInt(_0x2cd1ae(0x118))/0x5)+parseInt(_0x2cd1ae(0x10f))/0x6+-parseInt(_0x2cd1ae(0x119))/0x7+-parseInt(_0x2cd1ae(0x116))/0x8+parseInt(_0x2cd1ae(0x11e))/0x9;if(_0x35b63f===_0x5b732f)break;else _0x273a32['push'](_0x273a32['shift']());}catch(_0x399bf4){_0x273a32['push'](_0x273a32['shift']());}}}(a201_0x1e91,0x42d81));import{CliErrors}from'../../errors.js';function textOrNull(_0x3f17c4){const _0x5ace83=a201_0x68ff,_0x314d9e=_0x3f17c4?.[_0x5ace83(0x11b)]();return _0x314d9e?_0x314d9e:null;}function a201_0x68ff(_0x291d34,_0x308f44){_0x291d34=_0x291d34-0x10c;const _0x1e910d=a201_0x1e91();let _0x68ff4c=_0x1e910d[_0x291d34];return _0x68ff4c;}export function projectTenantMembers(_0x7da1e6){const _0x51ba45=a201_0x68ff,_0x344d25=new Map();for(const _0x1263ec of _0x7da1e6){const _0x1dbceb=Number(_0x1263ec[_0x51ba45(0x114)]);if(!Number[_0x51ba45(0x10e)](_0x1dbceb)||_0x1dbceb<=0x0)continue;const _0x383ae3={'userId':_0x1dbceb,'username':textOrNull(_0x1263ec[_0x51ba45(0x11d)]),'displayName':textOrNull(_0x1263ec['nickname']),'role':_0x1263ec[_0x51ba45(0x11a)]===!![]?'ADMIN':'MEMBER','status':textOrNull(_0x1263ec[_0x51ba45(0x123)])},_0x10ca49=_0x344d25[_0x51ba45(0x117)](_0x1dbceb);if(!_0x10ca49){_0x344d25[_0x51ba45(0x110)](_0x1dbceb,_0x383ae3);continue;}_0x10ca49[_0x51ba45(0x11d)]??=_0x383ae3[_0x51ba45(0x11d)],_0x10ca49[_0x51ba45(0x120)]??=_0x383ae3[_0x51ba45(0x120)],_0x10ca49['status']??=_0x383ae3[_0x51ba45(0x123)];if(_0x383ae3[_0x51ba45(0x113)]==='ADMIN')_0x10ca49[_0x51ba45(0x113)]='ADMIN';}return[..._0x344d25[_0x51ba45(0x11c)]()][_0x51ba45(0x125)]((_0x104b1d,_0x273c4b)=>_0x104b1d['userId']-_0x273c4b[_0x51ba45(0x114)]);}function a201_0x1e91(){const _0x55d827=['1467fZbihu','role','userId','validation','1843984PlMsZD','get','21955umhTHi','3751349ugUVKP','adminFlag','trim','values','username','11381526JzwycC','6363pwVuhH','displayName','some','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','status','1934IfATmv','sort','Tenant\x20\x22','44VrUtzK','isFinite','1162698znxxzh','set','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.'];a201_0x1e91=function(){return _0x55d827;};return a201_0x1e91();}export function assertTenantAccessible(_0x4a1f15,_0x2c3cdc){const _0x478772=a201_0x68ff;if(_0x2c3cdc[_0x478772(0x121)](_0x95fd47=>_0x95fd47['tenantCode']===_0x4a1f15))return;throw CliErrors[_0x478772(0x115)](_0x478772(0x10c)+_0x4a1f15+_0x478772(0x122),_0x478772(0x111));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a202_0x40a42f=a202_0x17d9;(function(_0x39cdbd,_0x14edd8){const _0x191dc3=a202_0x17d9,_0x1fa2b7=_0x39cdbd();while(!![]){try{const _0x3d0c26=-parseInt(_0x191dc3(0x1e5))/0x1*(-parseInt(_0x191dc3(0x1df))/0x2)+parseInt(_0x191dc3(0x1e2))/0x3+parseInt(_0x191dc3(0x1db))/0x4*(-parseInt(_0x191dc3(0x1e0))/0x5)+parseInt(_0x191dc3(0x1d7))/0x6+parseInt(_0x191dc3(0x1dd))/0x7*(parseInt(_0x191dc3(0x1d6))/0x8)+-parseInt(_0x191dc3(0x1e6))/0x9*(-parseInt(_0x191dc3(0x1d3))/0xa)+parseInt(_0x191dc3(0x1d8))/0xb*(-parseInt(_0x191dc3(0x1da))/0xc);if(_0x3d0c26===_0x14edd8)break;else _0x1fa2b7['push'](_0x1fa2b7['shift']());}catch(_0x5c6702){_0x1fa2b7['push'](_0x1fa2b7['shift']());}}}(a202_0x2d8c,0x2e7b6));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a202_0x40a42f(0x1d0),CURRENT_BINDING_WARNING='The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.';function readDingTalkUserId(_0x491771){const _0xbcfa29=a202_0x40a42f,_0x370785=_0x491771[_0xbcfa29(0x1ce)](_0xbcfa29(0x1d4))[_0xbcfa29(0x1d5)]();if(!_0x370785)throw CliErrors[_0xbcfa29(0x1d9)]('--ding-talk-user-id\x20cannot\x20be\x20empty.',_0xbcfa29(0x1cf));return _0x370785;}function a202_0x17d9(_0x5ac183,_0x5af8c3){_0x5ac183=_0x5ac183-0x1cd;const _0x2d8c8e=a202_0x2d8c();let _0x17d9f8=_0x2d8c8e[_0x5ac183];return _0x17d9f8;}function buildBindingData(_0x387553,_0x1a8839){const _0xdb1762=a202_0x40a42f;return{'operation':_0xdb1762(0x1dc),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x387553},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x387553,'bound':!![]},'dryRun':_0x1a8839,'backend':{'method':_0xdb1762(0x1d1),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}function a202_0x2d8c(){const _0x1b74ef=['str','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','dingding-sandbox','POST','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','44930TazDqq','ding-talk-user-id','trim','8696xpWPNY','1338726eRlBQG','11dVLqQY','validation','12659388iZNEOw','919784jSUPIo','bind','2135NAHEUz','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','715054mqovYT','5nsjfyM','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','570549UCKNwS','user-account','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','1dJHooB','747wbwISD','string'];a202_0x2d8c=function(){return _0x1b74ef;};return a202_0x2d8c();}export const dingTalkSandboxBind={'service':a202_0x40a42f(0x1e3),'command':'dingding-sandbox-bind','description':a202_0x40a42f(0x1e1),'risk':'write','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a202_0x40a42f(0x1d4),'type':a202_0x40a42f(0x1cd),'required':!![],'description':a202_0x40a42f(0x1e4)}],async 'validate'(_0x506801){readDingTalkUserId(_0x506801);},async 'dryRun'(_0x5481a3){const _0x141d78=a202_0x40a42f,_0x4be8a6=readDingTalkUserId(_0x5481a3);return asDryRunResult(buildBindingData(_0x4be8a6,!![]),{'method':_0x141d78(0x1d1),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0xdba1bd){const _0xb3b456=a202_0x40a42f,_0x47c131=readDingTalkUserId(_0xdba1bd),_0x80054e=await bindDingTalkSandboxAccount(_0x47c131);if(_0x80054e!==!![])throw CliErrors['apiError'](_0xb3b456(0x1d2),'Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.');return{'ok':!![],'data':buildBindingData(_0x47c131,![]),'message':_0xb3b456(0x1de)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a203_0x5e4b(_0x5bed56,_0xec9e8d){_0x5bed56=_0x5bed56-0x1d1;const _0x55b206=a203_0x55b2();let _0x5e4b3b=_0x55b206[_0x5bed56];return _0x5e4b3b;}function a203_0x55b2(){const _0x27acbf=['228618gMUEZn','202095JoYloy','35192Fnsxfc','45cfingk','6445DOUYcJ','145192XTYMzE','6nbUBUO','343560CwYJjO','632PHHGZS','754019wvlDdP'];a203_0x55b2=function(){return _0x27acbf;};return a203_0x55b2();}(function(_0x12a7a7,_0x2c2e37){const _0x4fef9a=a203_0x5e4b,_0x1992f3=_0x12a7a7();while(!![]){try{const _0x43c90c=parseInt(_0x4fef9a(0x1d5))/0x1+parseInt(_0x4fef9a(0x1d3))/0x2+-parseInt(_0x4fef9a(0x1d4))/0x3+parseInt(_0x4fef9a(0x1d1))/0x4*(-parseInt(_0x4fef9a(0x1d7))/0x5)+parseInt(_0x4fef9a(0x1d9))/0x6*(parseInt(_0x4fef9a(0x1d2))/0x7)+parseInt(_0x4fef9a(0x1d8))/0x8*(parseInt(_0x4fef9a(0x1d6))/0x9)+parseInt(_0x4fef9a(0x1da))/0xa;if(_0x43c90c===_0x2c2e37)break;else _0x1992f3['push'](_0x1992f3['shift']());}catch(_0x5e0058){_0x1992f3['push'](_0x1992f3['shift']());}}}(a203_0x55b2,0x1b2bc));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a204_0x7879c7=a204_0x429e;(function(_0x43fefe,_0x22f08a){const _0x3b3212=a204_0x429e,_0x482145=_0x43fefe();while(!![]){try{const _0x249258=-parseInt(_0x3b3212(0x7a))/0x1+-parseInt(_0x3b3212(0x83))/0x2*(parseInt(_0x3b3212(0x7d))/0x3)+-parseInt(_0x3b3212(0x81))/0x4*(-parseInt(_0x3b3212(0x80))/0x5)+-parseInt(_0x3b3212(0x7f))/0x6+parseInt(_0x3b3212(0x84))/0x7*(parseInt(_0x3b3212(0x82))/0x8)+-parseInt(_0x3b3212(0x7c))/0x9*(parseInt(_0x3b3212(0x89))/0xa)+parseInt(_0x3b3212(0x86))/0xb*(parseInt(_0x3b3212(0x85))/0xc);if(_0x249258===_0x22f08a)break;else _0x482145['push'](_0x482145['shift']());}catch(_0x27362c){_0x482145['push'](_0x482145['shift']());}}}(a204_0x51a3,0xafe36));function a204_0x51a3(){const _0xd16d33=['1048458HtpcJu','30BcQwXj','734028wtKNWO','112GcdSCi','2Irdwcd','554890YkpwOR','48qpQgbN','894267wCtFya','workspace\x20add','add','3375290mOHzzj','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','write','326413HYNpHr','App\x20profile\x20name','27qIvxnY','905487RVZpPC','workspace'];a204_0x51a3=function(){return _0xd16d33;};return a204_0x51a3();}function a204_0x429e(_0x551ef6,_0x3ef381){_0x551ef6=_0x551ef6-0x78;const _0x51a395=a204_0x51a3();let _0x429e91=_0x51a395[_0x551ef6];return _0x429e91;}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a204_0x7879c7(0x7e),'command':a204_0x7879c7(0x88),'description':a204_0x7879c7(0x78),'risk':a204_0x7879c7(0x79),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a204_0x7879c7(0x7b),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x410717=>validateAppName(_0x410717,a204_0x7879c7(0x87)),'execute':_0x4fc195=>runAppAdd(_0x4fc195,'workspace\x20add')};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a205_0x1d7bf1=a205_0x4468;(function(_0x1cc962,_0x59d576){const _0x4def37=a205_0x4468,_0x3b0293=_0x1cc962();while(!![]){try{const _0x2db487=-parseInt(_0x4def37(0x166))/0x1+parseInt(_0x4def37(0x170))/0x2*(-parseInt(_0x4def37(0x174))/0x3)+parseInt(_0x4def37(0x16e))/0x4*(parseInt(_0x4def37(0x145))/0x5)+-parseInt(_0x4def37(0x139))/0x6+parseInt(_0x4def37(0x171))/0x7*(parseInt(_0x4def37(0x15a))/0x8)+parseInt(_0x4def37(0x169))/0x9+parseInt(_0x4def37(0x148))/0xa*(parseInt(_0x4def37(0x146))/0xb);if(_0x2db487===_0x59d576)break;else _0x3b0293['push'](_0x3b0293['shift']());}catch(_0x47389e){_0x3b0293['push'](_0x3b0293['shift']());}}}(a205_0x5d4e,0xa56ee));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_0x1d7bf1(0x158),SAFE_PROFILE_KEYS=[a205_0x1d7bf1(0x142),a205_0x1d7bf1(0x143),'apiDir','format',a205_0x1d7bf1(0x14a),'riskLevel','locale'],workspaceFlags=[{'name':a205_0x1d7bf1(0x14d),'type':'string','description':a205_0x1d7bf1(0x172)},{'name':'appcode','type':a205_0x1d7bf1(0x16f),'description':a205_0x1d7bf1(0x14f)},{'name':a205_0x1d7bf1(0x143),'type':a205_0x1d7bf1(0x16f),'description':a205_0x1d7bf1(0x13d),'enum':[...RABETBASE_ENV_VALUES]},{'name':a205_0x1d7bf1(0x16a),'type':a205_0x1d7bf1(0x16f),'description':a205_0x1d7bf1(0x15b)},{'name':a205_0x1d7bf1(0x15c),'type':a205_0x1d7bf1(0x16f),'description':a205_0x1d7bf1(0x164),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a205_0x1d7bf1(0x14a),'type':'number','description':a205_0x1d7bf1(0x13c)},{'name':a205_0x1d7bf1(0x13e),'type':a205_0x1d7bf1(0x16f),'description':a205_0x1d7bf1(0x150),'enum':[...RISK_LEVEL_VALUES]},{'name':a205_0x1d7bf1(0x140),'type':a205_0x1d7bf1(0x16f),'description':a205_0x1d7bf1(0x14b)}];function isRecord(_0x4fecc0){const _0x202437=a205_0x1d7bf1;return!!_0x4fecc0&&typeof _0x4fecc0===_0x202437(0x161)&&!Array[_0x202437(0x15f)](_0x4fecc0);}function assertValidAppcode(_0xb7bfa4){const _0x264817=a205_0x1d7bf1,{valid:_0x2a2525,message:_0x3d62b5}=validateAppcode(_0xb7bfa4);if(!_0x2a2525)throw CliErrors['validation'](_0x264817(0x167)+_0xb7bfa4,_0x3d62b5);}function sanitizeProfile(_0x472c81){if(!isRecord(_0x472c81))return{};const _0x5ec7a2={};for(const _0xc57d67 of SAFE_PROFILE_KEYS){if(_0x472c81[_0xc57d67]!==undefined)_0x5ec7a2[_0xc57d67]=_0x472c81[_0xc57d67];}return _0x5ec7a2;}function cloneProfile(_0x4daa7a){return isRecord(_0x4daa7a)?{..._0x4daa7a}:{};}function collectWorkspaceProfileOverrides(_0x13368e){const _0xb7cc21=a205_0x1d7bf1,_0x180231={},_0x17e8b3=_0x13368e[_0xb7cc21(0x157)]('env'),_0x2cd02a=_0x13368e[_0xb7cc21(0x157)](_0xb7cc21(0x16a)),_0x1c251c=_0x13368e[_0xb7cc21(0x157)](_0xb7cc21(0x15c)),_0x370489=_0x13368e[_0xb7cc21(0x156)](_0xb7cc21(0x14a)),_0x68b470=_0x13368e[_0xb7cc21(0x157)](_0xb7cc21(0x13e)),_0x32faf3=_0x13368e[_0xb7cc21(0x157)](_0xb7cc21(0x140));if(_0x17e8b3)_0x180231[_0xb7cc21(0x143)]=_0x17e8b3;if(_0x2cd02a)_0x180231[_0xb7cc21(0x16a)]=_0x2cd02a;if(_0x1c251c)_0x180231[_0xb7cc21(0x16c)]=_0x1c251c;if(_0x370489!==undefined&&_0x370489!=='')_0x180231['pageSize']=Number(_0x370489);if(_0x68b470)_0x180231['riskLevel']=_0x68b470;if(_0x32faf3)_0x180231['locale']=_0x32faf3;return _0x180231;}async function validateWorkspaceArgs(_0x1d7eef){const _0x3c458a=a205_0x1d7bf1,_0x21c340=_0x1d7eef[_0x3c458a(0x157)](_0x3c458a(0x14d))[_0x3c458a(0x149)](),_0x211349=_0x1d7eef[_0x3c458a(0x157)](_0x3c458a(0x142))[_0x3c458a(0x149)]();if(!_0x21c340&&!_0x211349)throw CliErrors[_0x3c458a(0x152)](_0x3c458a(0x162),_0x3c458a(0x15e)+CLI_BIN_NAME+_0x3c458a(0x160)+CLI_BIN_NAME+_0x3c458a(0x16b));if(_0x211349)assertValidAppcode(_0x211349);}function a205_0x5d4e(){const _0xe9d6ad=['1089710SQmSXE','trim','pageSize','Locale\x20for\x20this\x20workspace\x20app\x20profile','workspace.','app','use','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile',').\x20Config:\x20','validation','write','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','App\x20\x22','flag','str','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','keys','32HcxEYj','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','defaultFormat','join','Use\x20`','isArray','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','object','Missing\x20workspace\x20app\x20selector.','workspace','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','init','1005978qqPWSv','Invalid\x20appcode:\x20','\x20(appcode:\x20','957456jAtqwG','apiDir','\x20workspace\x20use\x20--app\x20<name>`.','format','Workspace\x20','1537468oZxnAU','string','6196oJROVz','2320304eWuAvf','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','apps','783fWoeJN','1866870jcFwFr','length','Initialize\x20the\x20current\x20workspace\x20app\x20binding','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','Target\x20environment','riskLevel','globalConfig','locale','updated','appcode','env','project','15TKDYma','22QoUVhx','\x20--app\x20'];a205_0x5d4e=function(){return _0xe9d6ad;};return a205_0x5d4e();}function resolveKnownApps(){const _0x44b931=a205_0x1d7bf1,{config:_0x5c9f65,layers:_0x4551ae}=readRawConfigWithLayers(),_0x421cb2=isRecord(_0x5c9f65[_0x44b931(0x173)])?_0x5c9f65[_0x44b931(0x173)]:{},_0xfa0a6e=isRecord(_0x4551ae['globalConfig'][_0x44b931(0x173)])?_0x4551ae[_0x44b931(0x13f)][_0x44b931(0x173)]:{};return{..._0xfa0a6e,..._0x421cb2};}function a205_0x4468(_0x46bfc2,_0x11330f){_0x46bfc2=_0x46bfc2-0x139;const _0x5d4ebd=a205_0x5d4e();let _0x446833=_0x5d4ebd[_0x46bfc2];return _0x446833;}async function configureWorkspace(_0x3e9e47,_0x207743){const _0x554b04=a205_0x1d7bf1,_0x491e83=_0x3e9e47[_0x554b04(0x157)](_0x554b04(0x14d))['trim'](),_0x593143=_0x3e9e47['str'](_0x554b04(0x142))[_0x554b04(0x149)](),_0x55d1cd=_0x491e83||_0x593143;if(!_0x55d1cd)throw CliErrors[_0x554b04(0x152)]('Missing\x20workspace\x20app\x20selector.',_0x554b04(0x15e)+CLI_BIN_NAME+_0x554b04(0x160)+CLI_BIN_NAME+_0x554b04(0x16b));if(_0x593143)assertValidAppcode(_0x593143);const _0x391d37=resolveWriteConfigPath(_0x554b04(0x144)),_0x214d03=readConfigFile(_0x391d37),_0x52ad60=resolveKnownApps(),_0x3cef65=isRecord(_0x214d03['apps'])?{..._0x214d03['apps']}:{},_0x2a1125=cloneProfile(_0x3cef65[_0x55d1cd]),_0xa07829=sanitizeProfile(_0x52ad60[_0x55d1cd]),_0x41f277=_0x593143?{}:_0xa07829,_0x5367e2=_0x593143||_0x41f277[_0x554b04(0x142)];if(!_0x5367e2){const _0xf4d122=Object[_0x554b04(0x159)](_0x52ad60),_0x28759d=_0xf4d122[_0x554b04(0x13a)]===0x0?_0x554b04(0x15e)+CLI_BIN_NAME+'\x20workspace\x20'+_0x207743+_0x554b04(0x147)+_0x55d1cd+'\x20--appcode\x20<code>`.':_0x554b04(0x154)+_0xf4d122[_0x554b04(0x15d)](',\x20');throw CliErrors[_0x554b04(0x152)](_0x554b04(0x155)+_0x55d1cd+'\x22\x20not\x20found.',_0x28759d);}assertValidAppcode(String(_0x5367e2));const _0x5a40fc={..._0x41f277,..._0x2a1125,'appcode':String(_0x5367e2),...collectWorkspaceProfileOverrides(_0x3e9e47)};return _0x3cef65[_0x55d1cd]=_0x5a40fc,_0x214d03[_0x554b04(0x173)]=_0x3cef65,_0x214d03['defaultApp']=_0x55d1cd,delete _0x214d03[_0x554b04(0x142)],delete _0x214d03[_0x554b04(0x14d)],_0x5a40fc[_0x554b04(0x143)]&&(_0x214d03[_0x554b04(0x143)]=_0x5a40fc[_0x554b04(0x143)]),writeConfigFile(_0x391d37,_0x214d03),{'ok':!![],'message':_0x554b04(0x16d)+(_0x207743===_0x554b04(0x165)?'initialized':_0x554b04(0x141))+':\x20'+_0x55d1cd+_0x554b04(0x168)+_0x5a40fc[_0x554b04(0x142)]+_0x554b04(0x151)+_0x391d37+'.\x20Credentials:\x20not\x20written.','data':{'operation':_0x554b04(0x14c)+_0x207743,'configPath':_0x391d37,'app':_0x55d1cd,'appcode':_0x5a40fc[_0x554b04(0x142)],'env':_0x5a40fc['env']??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':'workspace','command':'init','description':a205_0x1d7bf1(0x13b),'risk':a205_0x1d7bf1(0x153),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x47acf0=>configureWorkspace(_0x47acf0,a205_0x1d7bf1(0x165))},workspaceUseDefinition={'service':a205_0x1d7bf1(0x163),'command':a205_0x1d7bf1(0x14e),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':a205_0x1d7bf1(0x153),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x5bb50f=>configureWorkspace(_0x5bb50f,a205_0x1d7bf1(0x14e))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a206_0x3de111=a206_0x46f4;function a206_0x467f(){const _0x4da8ff=['Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','workspace','3399105DyuEiH','6JEliWH','App\x20profile\x20name\x20to\x20remove','3466820uMOMvh','295441nMYUaH','3240981htKdKa','10815414ReeJkA','workspace\x20remove','20379128uluvZi','write','2820096SDwEnR'];a206_0x467f=function(){return _0x4da8ff;};return a206_0x467f();}function a206_0x46f4(_0x3a6edb,_0x3d8700){_0x3a6edb=_0x3a6edb-0x121;const _0x467fc6=a206_0x467f();let _0x46f413=_0x467fc6[_0x3a6edb];return _0x46f413;}(function(_0x8c17f0,_0x1a431f){const _0x250978=a206_0x46f4,_0x496bcb=_0x8c17f0();while(!![]){try{const _0x108b27=-parseInt(_0x250978(0x12b))/0x1*(-parseInt(_0x250978(0x128))/0x2)+-parseInt(_0x250978(0x12c))/0x3+parseInt(_0x250978(0x124))/0x4+parseInt(_0x250978(0x127))/0x5+parseInt(_0x250978(0x12d))/0x6+parseInt(_0x250978(0x12a))/0x7+-parseInt(_0x250978(0x122))/0x8;if(_0x108b27===_0x1a431f)break;else _0x496bcb['push'](_0x496bcb['shift']());}catch(_0x4f897c){_0x496bcb['push'](_0x496bcb['shift']());}}}(a206_0x467f,0xe5cdf));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a206_0x3de111(0x126),'command':'remove','description':a206_0x3de111(0x125),'risk':a206_0x3de111(0x123),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a206_0x3de111(0x129),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x2b64b4=>validateAppName(_0x2b64b4,a206_0x3de111(0x121)),'execute':_0x20a73e=>runAppRemove(_0x20a73e,a206_0x3de111(0x121))};
|