@lovrabet/rabetbase-cli 2.5.1-beta.6 → 2.5.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/api/generate-sdk-config-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.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/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-restore.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/dataset/user-deleted-field-list.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/table-diff-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/deployment/auto-sync.d.ts +3 -11
- package/lib/commands/deployment/auto-sync.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/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/domain-routing-sync.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/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.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/domain-config.js +1 -1
- package/lib/config/project-domain-routing.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/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.d.ts +0 -2
- 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 +0 -2
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/kb-search-client.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/supported-flags.d.ts +2 -0
- package/lib/framework/supported-flags.js +1 -0
- package/lib/framework/types.d.ts +2 -4
- 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/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.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/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +3 -3
- package/skills/rabetbase/references/rabetbase-deployment-sync.md +16 -44
- package/skills/rabetbase.manifest.json +3 -3
- package/lib/config/deployment-sync.d.ts +0 -10
- package/lib/config/deployment-sync.js +0 -1
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a202_0xe97d40=a202_0x5463;(function(_0x8f50a1,_0x447847){const _0x4341bc=a202_0x5463,_0x58cd8c=_0x8f50a1();while(!![]){try{const _0x1933d4=parseInt(_0x4341bc(0x181))/0x1*(parseInt(_0x4341bc(0x173))/0x2)+parseInt(_0x4341bc(0x18a))/0x3*(parseInt(_0x4341bc(0x167))/0x4)+-parseInt(_0x4341bc(0x17d))/0x5+-parseInt(_0x4341bc(0x166))/0x6+-parseInt(_0x4341bc(0x16d))/0x7*(parseInt(_0x4341bc(0x162))/0x8)+-parseInt(_0x4341bc(0x168))/0x9+parseInt(_0x4341bc(0x161))/0xa*(parseInt(_0x4341bc(0x15f))/0xb);if(_0x1933d4===_0x447847)break;else _0x58cd8c['push'](_0x58cd8c['shift']());}catch(_0x41c2c2){_0x58cd8c['push'](_0x58cd8c['shift']());}}}(a202_0x15e9,0x8b793));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 a202_0x15e9(){const _0x552439=['749790VlCVTJ','lockFilePath','appCode','sqlRootDir','sql','No\x20remote\x20SQL\x20queries\x20matched.','Force\x20overwrite\x20local\x20unsynced\x20changes','\x20skipped,\x20','boolean','apps','sqlCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','totalCount','Filter\x20by\x20SQL\x20display\x20name','join','\x20SQL\x20file(s)\x20into\x20','string','sqls','message','mybatisXml','4631LJTNNh','path','23570MXMIdY','8LEWOGs','catch','test','\x20failed','799542AoIApq','4wkZIws','4347279rWQGEb','filter','Pull\x20complete:\x20','description','sqlContent','241990glaPuk','unchanged','push','local\x20differs\x20from\x20remote','\x20written,\x20','sqlName','6616LtaRjP','force','cancelled','conflict','sqlcode','pull','sqlRoot','dbId','nonInteractive','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','3772310vQjOQP','Would\x20pull\x20','toISOString','str','222LrdPLU','replace','utf8','name','paging','length','skipped','Force\x20pull\x20cancelled.','split'];a202_0x15e9=function(){return _0x552439;};return a202_0x15e9();}async function fetchAllSqlQueries(_0x1aa8b6,_0x55d236){const _0x5337e1=a202_0x5463,_0x2cea28=[];let _0x5ec443=0x1;while(!![]){const _0x363cce=await listSqlQueries(_0x1aa8b6,{'currentPage':_0x5ec443,'pageSize':PAGE_SIZE,'sqlCode':_0x55d236[_0x5337e1(0x155)],'sqlName':_0x55d236[_0x5337e1(0x172)]}),_0x3e1e26=_0x363cce['tableData']??[];_0x2cea28[_0x5337e1(0x16f)](..._0x3e1e26);if(_0x3e1e26['length']===0x0)break;const _0x36c0b4=_0x363cce[_0x5337e1(0x185)]?.[_0x5337e1(0x157)];if(_0x36c0b4!=null?_0x2cea28['length']>=_0x36c0b4:_0x3e1e26['length']<PAGE_SIZE)break;_0x5ec443++;}return _0x2cea28;}async function ensureSqlContent(_0x1a4afd){const _0xb35e52=a202_0x5463;if(_0x1a4afd['sqlContent']!=null&&String(_0x1a4afd[_0xb35e52(0x16c)])['length']>0x0)return _0x1a4afd;return getSqlQueryDetail(_0x1a4afd[_0xb35e52(0x155)]);}function a202_0x5463(_0x1f7361,_0x17ee1c){_0x1f7361=_0x1f7361-0x151;const _0x15e909=a202_0x15e9();let _0x54634d=_0x15e909[_0x1f7361];return _0x54634d;}export const sqlPull={'service':a202_0xe97d40(0x18e),'command':'pull','description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a202_0xe97d40(0x184),'type':a202_0xe97d40(0x15b),'description':a202_0xe97d40(0x158)},{'name':'force','type':a202_0xe97d40(0x153),'description':a202_0xe97d40(0x151)}],async 'dryRun'(_0x5e49d1){const _0x5244e0=a202_0xe97d40,_0x33545a=loadSqlProjectConfig(_0x5e49d1[_0x5244e0(0x18c)]),_0x37b1a3=await readSqlLockFile(_0x33545a[_0x5244e0(0x18b)]),{appLock:_0x2115a6}=ensureSqlLockScope(_0x37b1a3??createEmptySqlLock(),_0x33545a['appCode'],_0x33545a[_0x5244e0(0x179)],_0x5244e0(0x178)),_0x4b3271=await fetchAllSqlQueries(_0x5e49d1[_0x5244e0(0x18c)],{'sqlCode':_0x5e49d1[_0x5244e0(0x180)](_0x5244e0(0x177))||undefined,'sqlName':_0x5e49d1[_0x5244e0(0x180)](_0x5244e0(0x184))||undefined}),_0x396847=[];for(const _0x42cacd of _0x4b3271){const _0x3d95a2=await ensureSqlContent(_0x42cacd),_0x3a178d=ensureRemoteSqlContent(_0x3d95a2),_0x207b8c=detectModeFromSql(_0x3d95a2),_0x3e6100=_0x3d95a2[_0x5244e0(0x17a)]?await getDbName(_0x5e49d1[_0x5244e0(0x18c)],Number(_0x3d95a2[_0x5244e0(0x17a)]))[_0x5244e0(0x163)](()=>undefined):undefined,_0x2e7669=buildLocalSqlFileContent({'sqlCode':_0x3d95a2[_0x5244e0(0x155)],'sqlName':_0x3d95a2['sqlName'],'dbId':_0x3d95a2[_0x5244e0(0x17a)]},_0x3a178d,{'dbName':_0x3e6100,'mode':_0x207b8c,'syncedAt':new Date()[_0x5244e0(0x17f)](),'description':_0x3d95a2[_0x5244e0(0x16b)]}),_0x26000b=buildSqlLockEntry(_0x3d95a2,_0x3a178d,'',{'dbName':_0x3e6100}),_0x24fd83=resolveLocalSqlFilePath(_0x33545a,_0x3d95a2[_0x5244e0(0x155)],_0x26000b);let _0x464aea='would_pull',_0x51e6d4;if(await fileExists(_0x24fd83)){const _0x273c39=await readFile(_0x24fd83,'utf8');isEquivalentPulledSqlFile(_0x273c39,_0x2e7669,_0x207b8c)?(_0x464aea=_0x5244e0(0x187),_0x51e6d4=_0x5244e0(0x16e)):(_0x464aea=_0x5244e0(0x176),_0x51e6d4=_0x5244e0(0x156));}_0x396847['push']({'sqlCode':_0x3d95a2[_0x5244e0(0x155)],'sqlName':_0x3d95a2['sqlName'],'filePath':_0x24fd83,'status':_0x464aea,'reason':_0x51e6d4});}return{'method':'POST','url':_0x5244e0(0x17c),'body':{'appCode':_0x5e49d1[_0x5244e0(0x18c)],'sqlCode':_0x5e49d1['str']('sqlcode')||null,'sqlName':_0x5e49d1[_0x5244e0(0x180)](_0x5244e0(0x184))||null,'files':_0x396847},'description':_0x5244e0(0x17e)+_0x396847['length']+_0x5244e0(0x15a)+_0x33545a[_0x5244e0(0x18d)]};},async 'execute'(_0x4fbbd6){const _0x2e9213=a202_0xe97d40,_0x4a3740=loadSqlProjectConfig(_0x4fbbd6[_0x2e9213(0x18c)]),_0xff0cb1=await readSqlLockFile(_0x4a3740[_0x2e9213(0x18b)]),{lockData:_0x9d40ca,appLock:_0x4b513a}=ensureSqlLockScope(_0xff0cb1??createEmptySqlLock(),_0x4a3740[_0x2e9213(0x18c)],_0x4a3740['sqlRoot'],_0x2e9213(0x178)),_0x1f75b3=_0x4fbbd6['bool'](_0x2e9213(0x174)),_0x31af3f=await fetchAllSqlQueries(_0x4fbbd6[_0x2e9213(0x18c)],{'sqlCode':_0x4fbbd6[_0x2e9213(0x180)](_0x2e9213(0x177))||undefined,'sqlName':_0x4fbbd6[_0x2e9213(0x180)](_0x2e9213(0x184))||undefined});if(_0x31af3f[_0x2e9213(0x186)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2e9213(0x18f)};const _0x5ae099=[],_0x2ac733=[];for(const _0x2374a2 of _0x31af3f){try{_0x5ae099[_0x2e9213(0x16f)](await ensureSqlContent(_0x2374a2));}catch(_0x4fdfbf){_0x2ac733['push']({'sqlCode':_0x2374a2[_0x2e9213(0x155)],'error':_0x4fdfbf instanceof Error?_0x4fdfbf[_0x2e9213(0x15d)]:String(_0x4fdfbf)});}}if(_0x1f75b3&&!_0x4fbbd6[_0x2e9213(0x17b)]){let _0x5e69d0=![];for(const _0xbdc0ed of _0x5ae099){const _0x8cafad=detectModeFromSql(_0xbdc0ed),_0x12e5c4=_0xbdc0ed['dbId']?await getDbName(_0x4fbbd6[_0x2e9213(0x18c)],Number(_0xbdc0ed['dbId']))[_0x2e9213(0x163)](()=>undefined):undefined,_0x49bb3e=buildLocalSqlFileContent({'sqlCode':_0xbdc0ed[_0x2e9213(0x155)],'sqlName':_0xbdc0ed[_0x2e9213(0x172)],'dbId':_0xbdc0ed['dbId']},ensureRemoteSqlContent(_0xbdc0ed),{'dbName':_0x12e5c4,'mode':_0x8cafad,'syncedAt':new Date()[_0x2e9213(0x17f)](),'description':_0xbdc0ed[_0x2e9213(0x16b)]}),_0x48e183=resolveLocalSqlFilePath(_0x4a3740,_0xbdc0ed[_0x2e9213(0x155)],buildSqlLockEntry(_0xbdc0ed,ensureRemoteSqlContent(_0xbdc0ed),'',{'dbName':_0x12e5c4}));if(await fileExists(_0x48e183)){const _0x491842=await readFile(_0x48e183,'utf8');if(!isEquivalentPulledSqlFile(_0x491842,_0x49bb3e,_0x8cafad)){_0x5e69d0=!![];break;}}}if(_0x5e69d0){const _0x59896f=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x59896f)throw CliErrors[_0x2e9213(0x175)](_0x2e9213(0x188));}}const _0x7313e6=cloneSqlLockData(_0x9d40ca),_0x809896=_0x7313e6[_0x2e9213(0x154)][_0x4a3740[_0x2e9213(0x18c)]],_0x18c316=[],_0x237218=[];for(const _0x15d949 of _0x5ae099){const _0xe39da2=_0x809896[_0x2e9213(0x15c)][_0x15d949[_0x2e9213(0x155)]],_0x362cfc=ensureRemoteSqlContent(_0x15d949),_0xf259d2=detectModeFromSql(_0x15d949),_0x34b0e6=_0x15d949[_0x2e9213(0x17a)]?await getDbName(_0x4fbbd6[_0x2e9213(0x18c)],Number(_0x15d949[_0x2e9213(0x17a)]))[_0x2e9213(0x163)](()=>undefined):undefined,_0x242336=buildLocalSqlFileContent({'sqlCode':_0x15d949[_0x2e9213(0x155)],'sqlName':_0x15d949[_0x2e9213(0x172)],'dbId':_0x15d949[_0x2e9213(0x17a)]},_0x362cfc,{'dbName':_0x34b0e6,'mode':_0xf259d2,'syncedAt':new Date()['toISOString'](),'description':_0x15d949[_0x2e9213(0x16b)]}),_0x298a79=buildSqlLockEntry(_0x15d949,_0x362cfc,computeSqlContentHash(_0x242336),{'dbName':_0x34b0e6}),_0x19ab00=_0x298a79[_0x2e9213(0x160)],_0x115f5a=join(_0x4a3740[_0x2e9213(0x18d)],_0x19ab00);try{if(await fileExists(_0x115f5a)){const _0x5d2204=await readFile(_0x115f5a,_0x2e9213(0x183));if(isEquivalentPulledSqlFile(_0x5d2204,_0x242336,_0xf259d2)){_0x237218[_0x2e9213(0x16f)]({'sqlCode':_0x15d949[_0x2e9213(0x155)],'reason':_0x2e9213(0x16e)}),_0x809896[_0x2e9213(0x15c)][_0x15d949[_0x2e9213(0x155)]]={..._0x298a79,'hash':computeSqlContentHash(_0x5d2204),'path':_0x19ab00};continue;}if(!_0x1f75b3){_0x237218[_0x2e9213(0x16f)]({'sqlCode':_0x15d949[_0x2e9213(0x155)],'reason':_0x2e9213(0x170)});continue;}}const _0x2b7dfc=_0xe39da2?.['path']?join(_0x4a3740[_0x2e9213(0x18d)],_0xe39da2[_0x2e9213(0x160)]):undefined;_0x2b7dfc&&_0x2b7dfc!==_0x115f5a&&await fileExists(_0x2b7dfc)&&await rm(_0x2b7dfc,{'force':!![]}),await ensureParentDirectory(_0x115f5a),await writeFile(_0x115f5a,_0x242336,'utf8'),_0x809896[_0x2e9213(0x15c)][_0x15d949[_0x2e9213(0x155)]]={..._0x298a79,'path':_0x19ab00},_0x18c316[_0x2e9213(0x16f)]({'sqlCode':_0x15d949[_0x2e9213(0x155)],'filePath':_0x115f5a});}catch(_0xf29111){_0x2ac733[_0x2e9213(0x16f)]({'sqlCode':_0x15d949[_0x2e9213(0x155)],'error':_0xf29111 instanceof Error?_0xf29111['message']:String(_0xf29111)});}}return _0x809896['lastSync']=new Date()[_0x2e9213(0x17f)](),await writeSqlLockFile(_0x4a3740[_0x2e9213(0x18b)],_0x7313e6),{'ok':_0x2ac733['length']===0x0,'data':{'pulled':_0x18c316,'skipped':_0x237218,'failed':_0x2ac733},'message':_0x2e9213(0x16a)+_0x18c316[_0x2e9213(0x186)]+_0x2e9213(0x171)+_0x237218['length']+_0x2e9213(0x152)+_0x2ac733[_0x2e9213(0x186)]+_0x2e9213(0x165)};}};function detectModeFromSql(_0x15ed21){const _0x3c6af3=a202_0xe97d40,_0x1b0de8=ensureRemoteSqlContent(_0x15ed21),_0x22729f=stripLocalSqlMetadata(_0x1b0de8,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x3c6af3(0x164)](_0x22729f))return _0x3c6af3(0x15e);return'sql';}function isEquivalentPulledSqlFile(_0x221d1e,_0x48be2c,_0x548261){return normalizePullComparableContent(_0x221d1e,_0x548261)===normalizePullComparableContent(_0x48be2c,_0x548261);}function normalizePullComparableContent(_0x34836b,_0x499994){const _0x58fd79=a202_0xe97d40,_0x84bc7c=_0x34836b[_0x58fd79(0x182)](/\r\n/g,'\x0a')[_0x58fd79(0x189)]('\x0a'),_0x166537=_0x84bc7c[_0x58fd79(0x169)](_0x2c87dc=>!isSyncedAtMetadataLine(_0x2c87dc,_0x499994));return _0x166537[_0x58fd79(0x159)]('\x0a');}function isSyncedAtMetadataLine(_0xb91dfc,_0x1c5e94){const _0x2c641f=a202_0xe97d40;if(_0x1c5e94===_0x2c641f(0x15e))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0xb91dfc);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x2c641f(0x164)](_0xb91dfc);}
|
|
1
|
+
const a202_0x4ad68a=a202_0x28c5;(function(_0x435cd4,_0x597863){const _0x577a51=a202_0x28c5,_0x260dbe=_0x435cd4();while(!![]){try{const _0x577568=-parseInt(_0x577a51(0x9d))/0x1*(-parseInt(_0x577a51(0xb3))/0x2)+parseInt(_0x577a51(0xa4))/0x3+parseInt(_0x577a51(0xac))/0x4+parseInt(_0x577a51(0x96))/0x5*(parseInt(_0x577a51(0xa9))/0x6)+parseInt(_0x577a51(0x9f))/0x7+-parseInt(_0x577a51(0xb0))/0x8+-parseInt(_0x577a51(0x99))/0x9;if(_0x577568===_0x597863)break;else _0x260dbe['push'](_0x260dbe['shift']());}catch(_0x131848){_0x260dbe['push'](_0x260dbe['shift']());}}}(a202_0x2cee,0x64f6c));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';function a202_0x2cee(){const _0x802fd6=['split','read','boolean','lastSync','filter','mybatisXml','totalCount','string','message','tableData','Force\x20pull\x20cancelled.','No\x20remote\x20SQL\x20queries\x20matched.','utf8','trimStart','nonInteractive','replace','toISOString','skipped','conflict','pull','sqlcode','3545GGDolA','local\x20differs\x20from\x20remote','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','7967907TMMCWQ','sqlRootDir','unchanged','name','12151OBgygi','paging','3492300BsJPoT','sqlContent','would_pull','str','sqlName','902769EoyZMM','dbId','sql','push','path','1692kiVKJT','Would\x20pull\x20','appCode','3103308ipCAzE','lockFilePath','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20written,\x20','4299776PQBeOv','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','10ilPVMk','sqlCode','sqlRoot','Force\x20overwrite\x20local\x20unsynced\x20changes','description','\x20skipped,\x20','force','sqls','catch','length','cancelled','\x20failed','Filter\x20by\x20SQL\x20display\x20name'];a202_0x2cee=function(){return _0x802fd6;};return a202_0x2cee();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x2d2464,_0x1bc32e){const _0x21dc11=a202_0x28c5,_0x34a185=[];let _0x49fd2c=0x1;while(!![]){const _0x35efcc=await listSqlQueries(_0x2d2464,{'currentPage':_0x49fd2c,'pageSize':PAGE_SIZE,'sqlCode':_0x1bc32e[_0x21dc11(0xb4)],'sqlName':_0x1bc32e[_0x21dc11(0xa3)]}),_0x44c6c7=_0x35efcc[_0x21dc11(0x8a)]??[];_0x34a185[_0x21dc11(0xa7)](..._0x44c6c7);if(_0x44c6c7['length']===0x0)break;const _0x551132=_0x35efcc[_0x21dc11(0x9e)]?.[_0x21dc11(0x87)];if(_0x551132!=null?_0x34a185[_0x21dc11(0x7d)]>=_0x551132:_0x44c6c7[_0x21dc11(0x7d)]<PAGE_SIZE)break;_0x49fd2c++;}return _0x34a185;}async function ensureSqlContent(_0x2b0c3c){const _0x4af7b6=a202_0x28c5;if(_0x2b0c3c['sqlContent']!=null&&String(_0x2b0c3c[_0x4af7b6(0xa0)])[_0x4af7b6(0x7d)]>0x0)return _0x2b0c3c;return getSqlQueryDetail(_0x2b0c3c[_0x4af7b6(0xb4)]);}export const sqlPull={'service':a202_0x4ad68a(0xa6),'command':a202_0x4ad68a(0x94),'description':a202_0x4ad68a(0xb2),'risk':a202_0x4ad68a(0x82),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a202_0x4ad68a(0x9c),'type':a202_0x4ad68a(0x88),'description':a202_0x4ad68a(0x80)},{'name':a202_0x4ad68a(0xb9),'type':a202_0x4ad68a(0x83),'description':a202_0x4ad68a(0xb6)}],async 'dryRun'(_0x3cb74a){const _0x583e37=a202_0x4ad68a,_0x138548=loadSqlProjectConfig(_0x3cb74a[_0x583e37(0xab)]),_0x200752=await readSqlLockFile(_0x138548[_0x583e37(0xad)]),{appLock:_0x538fb6}=ensureSqlLockScope(_0x200752??createEmptySqlLock(),_0x138548['appCode'],_0x138548['sqlRoot'],_0x583e37(0x94)),_0x271fd7=await fetchAllSqlQueries(_0x3cb74a['appCode'],{'sqlCode':_0x3cb74a['str'](_0x583e37(0x95))||undefined,'sqlName':_0x3cb74a[_0x583e37(0xa2)]('name')||undefined}),_0x33a30c=[];for(const _0xe7460b of _0x271fd7){const _0x3a5f39=await ensureSqlContent(_0xe7460b),_0x28ec15=ensureRemoteSqlContent(_0x3a5f39),_0x3862dd=detectModeFromSql(_0x3a5f39),_0x38237a=_0x3a5f39['dbId']?await getDbName(_0x3cb74a[_0x583e37(0xab)],Number(_0x3a5f39[_0x583e37(0xa5)]))['catch'](()=>undefined):undefined,_0xc58a2=buildLocalSqlFileContent({'sqlCode':_0x3a5f39[_0x583e37(0xb4)],'sqlName':_0x3a5f39[_0x583e37(0xa3)],'dbId':_0x3a5f39['dbId']},_0x28ec15,{'dbName':_0x38237a,'mode':_0x3862dd,'syncedAt':new Date()[_0x583e37(0x91)](),'description':_0x3a5f39[_0x583e37(0xb7)]}),_0x27bca0=buildSqlLockEntry(_0x3a5f39,_0x28ec15,'',{'dbName':_0x38237a}),_0x15dc1a=resolveLocalSqlFilePath(_0x138548,_0x3a5f39['sqlCode'],_0x27bca0);let _0x304a45=_0x583e37(0xa1),_0x44e6ce;if(await fileExists(_0x15dc1a)){const _0x4bcf7a=await readFile(_0x15dc1a,'utf8');isEquivalentPulledSqlFile(_0x4bcf7a,_0xc58a2,_0x3862dd)?(_0x304a45=_0x583e37(0x92),_0x44e6ce=_0x583e37(0x9b)):(_0x304a45=_0x583e37(0x93),_0x44e6ce=_0x583e37(0xae));}_0x33a30c['push']({'sqlCode':_0x3a5f39[_0x583e37(0xb4)],'sqlName':_0x3a5f39[_0x583e37(0xa3)],'filePath':_0x15dc1a,'status':_0x304a45,'reason':_0x44e6ce});}return{'method':'POST','url':_0x583e37(0x98),'body':{'appCode':_0x3cb74a['appCode'],'sqlCode':_0x3cb74a[_0x583e37(0xa2)]('sqlcode')||null,'sqlName':_0x3cb74a[_0x583e37(0xa2)](_0x583e37(0x9c))||null,'files':_0x33a30c},'description':_0x583e37(0xaa)+_0x33a30c[_0x583e37(0x7d)]+'\x20SQL\x20file(s)\x20into\x20'+_0x138548['sqlRootDir']};},async 'execute'(_0x315adc){const _0x24191f=a202_0x4ad68a,_0x22ea56=loadSqlProjectConfig(_0x315adc[_0x24191f(0xab)]),_0x40771d=await readSqlLockFile(_0x22ea56['lockFilePath']),{lockData:_0x18e777,appLock:_0x2f4613}=ensureSqlLockScope(_0x40771d??createEmptySqlLock(),_0x22ea56[_0x24191f(0xab)],_0x22ea56[_0x24191f(0xb5)],_0x24191f(0x94)),_0x35f46f=_0x315adc['bool']('force'),_0x5ca4a9=await fetchAllSqlQueries(_0x315adc[_0x24191f(0xab)],{'sqlCode':_0x315adc[_0x24191f(0xa2)]('sqlcode')||undefined,'sqlName':_0x315adc['str'](_0x24191f(0x9c))||undefined});if(_0x5ca4a9[_0x24191f(0x7d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x24191f(0x8c)};const _0x1da047=[],_0x45f5f3=[];for(const _0x18731a of _0x5ca4a9){try{_0x1da047[_0x24191f(0xa7)](await ensureSqlContent(_0x18731a));}catch(_0x2404f8){_0x45f5f3[_0x24191f(0xa7)]({'sqlCode':_0x18731a[_0x24191f(0xb4)],'error':_0x2404f8 instanceof Error?_0x2404f8[_0x24191f(0x89)]:String(_0x2404f8)});}}if(_0x35f46f&&!_0x315adc[_0x24191f(0x8f)]){let _0x835f29=![];for(const _0x3de7d0 of _0x1da047){const _0x34f7e4=detectModeFromSql(_0x3de7d0),_0x570947=_0x3de7d0[_0x24191f(0xa5)]?await getDbName(_0x315adc[_0x24191f(0xab)],Number(_0x3de7d0[_0x24191f(0xa5)]))['catch'](()=>undefined):undefined,_0x40d41c=buildLocalSqlFileContent({'sqlCode':_0x3de7d0[_0x24191f(0xb4)],'sqlName':_0x3de7d0['sqlName'],'dbId':_0x3de7d0[_0x24191f(0xa5)]},ensureRemoteSqlContent(_0x3de7d0),{'dbName':_0x570947,'mode':_0x34f7e4,'syncedAt':new Date()[_0x24191f(0x91)](),'description':_0x3de7d0['description']}),_0x17a56b=resolveLocalSqlFilePath(_0x22ea56,_0x3de7d0[_0x24191f(0xb4)],buildSqlLockEntry(_0x3de7d0,ensureRemoteSqlContent(_0x3de7d0),'',{'dbName':_0x570947}));if(await fileExists(_0x17a56b)){const _0xe05e13=await readFile(_0x17a56b,_0x24191f(0x8d));if(!isEquivalentPulledSqlFile(_0xe05e13,_0x40d41c,_0x34f7e4)){_0x835f29=!![];break;}}}if(_0x835f29){const _0x7ae315=await confirmForceOverwrite(_0x24191f(0xb1));if(!_0x7ae315)throw CliErrors[_0x24191f(0x7e)](_0x24191f(0x8b));}}const _0x2c6b8d=cloneSqlLockData(_0x18e777),_0x3cdb8f=_0x2c6b8d['apps'][_0x22ea56[_0x24191f(0xab)]],_0x530273=[],_0xc2e572=[];for(const _0x102a08 of _0x1da047){const _0x309cd2=_0x3cdb8f[_0x24191f(0x7b)][_0x102a08[_0x24191f(0xb4)]],_0x155858=ensureRemoteSqlContent(_0x102a08),_0x352a21=detectModeFromSql(_0x102a08),_0x5c1a58=_0x102a08[_0x24191f(0xa5)]?await getDbName(_0x315adc[_0x24191f(0xab)],Number(_0x102a08[_0x24191f(0xa5)]))[_0x24191f(0x7c)](()=>undefined):undefined,_0x3330ce=buildLocalSqlFileContent({'sqlCode':_0x102a08[_0x24191f(0xb4)],'sqlName':_0x102a08['sqlName'],'dbId':_0x102a08[_0x24191f(0xa5)]},_0x155858,{'dbName':_0x5c1a58,'mode':_0x352a21,'syncedAt':new Date()[_0x24191f(0x91)](),'description':_0x102a08[_0x24191f(0xb7)]}),_0x216d47=buildSqlLockEntry(_0x102a08,_0x155858,computeSqlContentHash(_0x3330ce),{'dbName':_0x5c1a58}),_0x25b993=_0x216d47[_0x24191f(0xa8)],_0x282b7a=join(_0x22ea56[_0x24191f(0x9a)],_0x25b993);try{if(await fileExists(_0x282b7a)){const _0x3727b2=await readFile(_0x282b7a,_0x24191f(0x8d));if(isEquivalentPulledSqlFile(_0x3727b2,_0x3330ce,_0x352a21)){_0xc2e572['push']({'sqlCode':_0x102a08[_0x24191f(0xb4)],'reason':'unchanged'}),_0x3cdb8f['sqls'][_0x102a08[_0x24191f(0xb4)]]={..._0x216d47,'hash':computeSqlContentHash(_0x3727b2),'path':_0x25b993};continue;}if(!_0x35f46f){_0xc2e572[_0x24191f(0xa7)]({'sqlCode':_0x102a08[_0x24191f(0xb4)],'reason':_0x24191f(0x97)});continue;}}const _0x873fad=_0x309cd2?.[_0x24191f(0xa8)]?join(_0x22ea56[_0x24191f(0x9a)],_0x309cd2[_0x24191f(0xa8)]):undefined;_0x873fad&&_0x873fad!==_0x282b7a&&await fileExists(_0x873fad)&&await rm(_0x873fad,{'force':!![]}),await ensureParentDirectory(_0x282b7a),await writeFile(_0x282b7a,_0x3330ce,_0x24191f(0x8d)),_0x3cdb8f[_0x24191f(0x7b)][_0x102a08[_0x24191f(0xb4)]]={..._0x216d47,'path':_0x25b993},_0x530273['push']({'sqlCode':_0x102a08[_0x24191f(0xb4)],'filePath':_0x282b7a});}catch(_0x545e2d){_0x45f5f3['push']({'sqlCode':_0x102a08[_0x24191f(0xb4)],'error':_0x545e2d instanceof Error?_0x545e2d[_0x24191f(0x89)]:String(_0x545e2d)});}}return _0x3cdb8f[_0x24191f(0x84)]=new Date()[_0x24191f(0x91)](),await writeSqlLockFile(_0x22ea56[_0x24191f(0xad)],_0x2c6b8d),{'ok':_0x45f5f3[_0x24191f(0x7d)]===0x0,'data':{'pulled':_0x530273,'skipped':_0xc2e572,'failed':_0x45f5f3},'message':'Pull\x20complete:\x20'+_0x530273[_0x24191f(0x7d)]+_0x24191f(0xaf)+_0xc2e572['length']+_0x24191f(0xb8)+_0x45f5f3[_0x24191f(0x7d)]+_0x24191f(0x7f)};}};function detectModeFromSql(_0xe0fc09){const _0x4e81d5=a202_0x4ad68a,_0x3ed212=ensureRemoteSqlContent(_0xe0fc09),_0x3bf931=stripLocalSqlMetadata(_0x3ed212,_0x4e81d5(0x86))[_0x4e81d5(0x8e)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x3bf931))return _0x4e81d5(0x86);return _0x4e81d5(0xa6);}function isEquivalentPulledSqlFile(_0x14fe3d,_0x59ff85,_0x933776){return normalizePullComparableContent(_0x14fe3d,_0x933776)===normalizePullComparableContent(_0x59ff85,_0x933776);}function a202_0x28c5(_0x168019,_0x180f84){_0x168019=_0x168019-0x7b;const _0x2ceebd=a202_0x2cee();let _0x28c519=_0x2ceebd[_0x168019];return _0x28c519;}function normalizePullComparableContent(_0x12f430,_0x14da39){const _0x4c1dc3=a202_0x4ad68a,_0x378163=_0x12f430[_0x4c1dc3(0x90)](/\r\n/g,'\x0a')[_0x4c1dc3(0x81)]('\x0a'),_0x3b87e5=_0x378163[_0x4c1dc3(0x85)](_0x53b0d2=>!isSyncedAtMetadataLine(_0x53b0d2,_0x14da39));return _0x3b87e5['join']('\x0a');}function isSyncedAtMetadataLine(_0x45a169,_0x5e1205){if(_0x5e1205==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x45a169);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x45a169);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a203_0x43f694=a203_0x2235;(function(_0x46c978,_0x509d32){const _0x1b7543=a203_0x2235,_0x48ee5e=_0x46c978();while(!![]){try{const _0x265926=-parseInt(_0x1b7543(0xa5))/0x1*(-parseInt(_0x1b7543(0xb5))/0x2)+-parseInt(_0x1b7543(0xd6))/0x3+parseInt(_0x1b7543(0xd2))/0x4*(-parseInt(_0x1b7543(0xdc))/0x5)+-parseInt(_0x1b7543(0xa7))/0x6+-parseInt(_0x1b7543(0xbf))/0x7+parseInt(_0x1b7543(0xd7))/0x8+parseInt(_0x1b7543(0xb0))/0x9;if(_0x265926===_0x509d32)break;else _0x48ee5e['push'](_0x48ee5e['shift']());}catch(_0x55fb4a){_0x48ee5e['push'](_0x48ee5e['shift']());}}}(a203_0x5796,0x8974f));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';function a203_0x2235(_0x129965,_0x3bea44){_0x129965=_0x129965-0x9d;const _0x57969c=a203_0x5796();let _0x22358b=_0x57969c[_0x129965];return _0x22358b;}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';import{automaticDeploymentSyncSucceeded,buildAutomaticDeploymentSyncPreview,runAutomaticDeploymentSync,validateAutomaticDeploymentSync}from'../../commands/deployment/auto-sync.js';async function getTargetSqlQueries(_0x2bef72,_0x375b6c,_0x333cca){const _0x4d7229=a203_0x2235,_0x6b177e=await scanLocalSqlQueries(_0x2bef72),_0x33116c=new Map();for(const _0x2bc1b4 of _0x6b177e){if(_0x333cca&&_0x2bc1b4[_0x4d7229(0xac)]!==_0x333cca)continue;const _0x2c248c=_0x33116c[_0x4d7229(0xa1)](_0x2bc1b4[_0x4d7229(0xac)])??[];_0x2c248c[_0x4d7229(0xb7)](_0x2bc1b4),_0x33116c[_0x4d7229(0xbd)](_0x2bc1b4[_0x4d7229(0xac)],_0x2c248c);}if(_0x333cca&&!_0x33116c[_0x4d7229(0xa6)](_0x333cca))throw CliErrors['validation'](_0x4d7229(0xb3)+_0x333cca);const _0x3160a5=[];for(const [_0x5a4d39,_0x1bbb51]of _0x33116c[_0x4d7229(0xcc)]()){if(_0x1bbb51['length']===0x1){_0x3160a5[_0x4d7229(0xb7)](_0x1bbb51[0x0]);continue;}const _0x2e38b0=_0x375b6c['sqls'][_0x5a4d39],_0x2462ac=_0x2e38b0?.[_0x4d7229(0xa3)],_0x5cee43=_0x2462ac?_0x1bbb51[_0x4d7229(0xc2)](_0x49b124=>_0x49b124[_0x4d7229(0x9e)]!==_0x2462ac):_0x1bbb51;if(_0x2e38b0&&_0x5cee43[_0x4d7229(0xc5)]===0x1){_0x3160a5[_0x4d7229(0xb7)](_0x5cee43[0x0]);continue;}throw CliErrors[_0x4d7229(0xad)](_0x4d7229(0xbc)+_0x5a4d39+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x3160a5;}export const sqlPush={'service':a203_0x43f694(0xaa),'command':a203_0x43f694(0xb7),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a203_0x43f694(0xe1),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a203_0x43f694(0xcf),'type':a203_0x43f694(0xbb),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'validate'(_0x5eb535){validateAutomaticDeploymentSync(_0x5eb535);},async 'dryRun'(_0x131d29){const _0x1b2af1=a203_0x43f694,_0x215125=loadSqlProjectConfig(_0x131d29['appCode']),_0x322930=await readSqlLockFile(_0x215125['lockFilePath']),{appLock:_0x9aa4c1}=ensureSqlLockScope(_0x322930??createEmptySqlLock(),_0x131d29[_0x1b2af1(0xcb)],_0x215125[_0x1b2af1(0xda)],_0x1b2af1(0xb7)),_0x5bf605=await getTargetSqlQueries(_0x215125,_0x9aa4c1,_0x131d29[_0x1b2af1(0xde)](_0x1b2af1(0xce))||undefined),_0x447b8c=[];for(const _0x45859c of _0x5bf605){const _0x78e785=await computeSqlFileHash(_0x45859c[_0x1b2af1(0xc0)]),_0x529e2c=_0x9aa4c1[_0x1b2af1(0xd9)][_0x45859c['sqlCode']],_0x5be3d5=!!_0x529e2c&&(_0x529e2c[_0x1b2af1(0xa3)]!==_0x45859c[_0x1b2af1(0x9e)]||!!_0x45859c['sqlName']&&_0x529e2c[_0x1b2af1(0xb6)]!==_0x45859c[_0x1b2af1(0xb6)]);if(!_0x131d29['bool'](_0x1b2af1(0xcf))&&_0x529e2c&&_0x529e2c[_0x1b2af1(0xbe)]===_0x78e785&&!_0x5be3d5)continue;_0x447b8c[_0x1b2af1(0xb7)](_0x45859c['sqlCode']);}return{'method':_0x1b2af1(0xc8),'url':_0x1b2af1(0xd3),'deploymentSync':buildAutomaticDeploymentSyncPreview(_0x131d29,_0x1b2af1(0xaa),_0x447b8c),'body':{'sqlCodes':_0x447b8c,'appCode':_0x131d29['appCode']},'description':_0x1b2af1(0x9d)+_0x447b8c[_0x1b2af1(0xc5)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x113296){const _0x5bbc99=a203_0x43f694,_0x325c35=loadSqlProjectConfig(_0x113296['appCode']),_0xa91b64=await readSqlLockFile(_0x325c35[_0x5bbc99(0xd0)]),{lockData:_0x5dddee,appLock:_0x1511d2}=ensureSqlLockScope(_0xa91b64??createEmptySqlLock(),_0x113296[_0x5bbc99(0xcb)],_0x325c35[_0x5bbc99(0xda)],_0x5bbc99(0xb7)),_0x3414a7=await getTargetSqlQueries(_0x325c35,_0x1511d2,_0x113296['str'](_0x5bbc99(0xce))||undefined);if(_0x3414a7['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5bbc99(0xca)};const _0x43dfbb=[],_0x1ff811=[],_0x3958bf=[];for(const _0x3f003a of _0x3414a7){const _0x1b65d5=_0x1511d2['sqls'][_0x3f003a['sqlCode']];if(!_0x1b65d5){_0x3958bf[_0x5bbc99(0xb7)]({'sqlCode':_0x3f003a[_0x5bbc99(0xac)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0xd4b703=await computeSqlFileHash(_0x3f003a[_0x5bbc99(0xc0)]),_0x1e9352=_0x1b65d5[_0x5bbc99(0xa3)]!==_0x3f003a[_0x5bbc99(0x9e)]||!!_0x3f003a['sqlName']&&_0x1b65d5[_0x5bbc99(0xb6)]!==_0x3f003a[_0x5bbc99(0xb6)];if(!_0x113296['bool'](_0x5bbc99(0xcf))&&_0x1b65d5[_0x5bbc99(0xbe)]===_0xd4b703&&!_0x1e9352){_0x1ff811[_0x5bbc99(0xb7)]({'sqlCode':_0x3f003a[_0x5bbc99(0xac)],'reason':_0x5bbc99(0xc1)});continue;}if(_0x1b65d5[_0x5bbc99(0xb8)]==null){_0x3958bf['push']({'sqlCode':_0x3f003a[_0x5bbc99(0xac)],'error':_0x5bbc99(0xdb)});continue;}const _0x87e539=await readFile(_0x3f003a['filePath'],_0x5bbc99(0xd8)),_0x54a461=stripLocalSqlMetadata(_0x87e539,_0x3f003a[_0x5bbc99(0xb9)]),_0x262999=_0x3f003a['sqlName']||_0x1b65d5[_0x5bbc99(0xb6)],_0x5b4ba1=await resolveTargetDbBinding(_0x113296[_0x5bbc99(0xcb)],_0x3f003a,_0x1b65d5),_0x2459c6=await updateSqlQuery({'id':_0x1b65d5['remoteId'],'appCode':_0x113296['appCode'],'sqlCode':_0x3f003a[_0x5bbc99(0xac)],'sqlName':_0x262999,'dbId':_0x5b4ba1[_0x5bbc99(0xd5)],'version':_0x1b65d5[_0x5bbc99(0xb8)],'sqlContent':_0x54a461,'sqlConfig':_0x1b65d5[_0x5bbc99(0xdd)]??undefined}),_0x1f46b9=_0x2459c6[_0x5bbc99(0xd5)]?await getDbName(_0x113296['appCode'],Number(_0x2459c6['dbId']))[_0x5bbc99(0xc4)](()=>_0x5b4ba1['dbName']):_0x5b4ba1['dbName'];_0x1511d2[_0x5bbc99(0xd9)][_0x3f003a[_0x5bbc99(0xac)]]={...buildSqlLockEntry(_0x2459c6,_0x54a461,_0xd4b703,{'dbName':_0x1f46b9}),'path':_0x3f003a[_0x5bbc99(0x9e)],'mode':_0x1b65d5[_0x5bbc99(0xb9)]},await archivePreviousSqlFileIfNeeded(_0x325c35,_0x1b65d5[_0x5bbc99(0xa3)],_0x3f003a['relativePath']),_0x43dfbb[_0x5bbc99(0xb7)]({'sqlCode':_0x3f003a[_0x5bbc99(0xac)],'remoteId':_0x1b65d5[_0x5bbc99(0xd1)]});}catch(_0x299b02){_0x3958bf[_0x5bbc99(0xb7)]({'sqlCode':_0x3f003a['sqlCode'],'error':_0x299b02 instanceof Error?_0x299b02[_0x5bbc99(0xb1)]:String(_0x299b02)});}}_0x1511d2[_0x5bbc99(0xb4)]=new Date()[_0x5bbc99(0xa8)](),await writeSqlLockFile(_0x325c35[_0x5bbc99(0xd0)],_0x5dddee);const _0x46d204=_0x3958bf[_0x5bbc99(0xc5)]===0x0,_0x494a03=await runAutomaticDeploymentSync(_0x113296,_0x5bbc99(0xaa),_0x43dfbb[_0x5bbc99(0xaf)](_0x571dec=>_0x571dec[_0x5bbc99(0xac)]),_0x46d204),_0x39be04=_0x46d204&&automaticDeploymentSyncSucceeded(_0x494a03),_0x883083=_0x494a03[_0x5bbc99(0x9f)]?_0x5bbc99(0xae)+_0x494a03[_0x5bbc99(0xa9)]:'';return{'ok':_0x39be04,'data':{'pushed':_0x43dfbb,'skipped':_0x1ff811,'failed':_0x3958bf,'deploymentSync':_0x494a03},'message':_0x5bbc99(0xa2)+_0x43dfbb[_0x5bbc99(0xc5)]+_0x5bbc99(0xc3)+_0x1ff811[_0x5bbc99(0xc5)]+'\x20skipped,\x20'+_0x3958bf['length']+_0x5bbc99(0xc7)+_0x883083};}};async function archivePreviousSqlFileIfNeeded(_0x53274e,_0x1394c2,_0x1fc694){const _0x51d9ec=a203_0x43f694;if(!_0x1394c2||_0x1394c2===_0x1fc694)return;const _0x378689=join(_0x53274e[_0x51d9ec(0xdf)],_0x1394c2);if(!await fileExists(_0x378689))return;const _0x77bb9b=await moveToTrash(_0x53274e[_0x51d9ec(0xba)],_0x53274e[_0x51d9ec(0xb2)],_0x378689);await cleanupEmptyDirectories(dirname(_0x378689),_0x53274e[_0x51d9ec(0xdf)]),void _0x77bb9b;}function a203_0x5796(){const _0x330417=['remoteId','12eYJTIM','/smartapi/custom/updateUserCustomSql','join','dbId','711936NXZAFw','1836848KkaQHP','utf8','sqls','sqlRoot','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','1403555JcGEzj','sqlConfig','str','sqlRootDir','replace','write','Would\x20push\x20','relativePath','configured','startsWith','get','Push\x20complete:\x20','path','exec','235573rAehbW','has','2430456eNVGHe','toISOString','status','sql','\x22\x20for\x20sqlCode\x20','sqlCode','validation',',\x20deployment\x20sync\x20','map','11059659anPMHc','message','trashDir','Local\x20SQL\x20not\x20found:\x20','lastSync','6IwufCB','sqlName','push','version','mode','projectRoot','boolean','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','set','hash','823424bzpSSv','filePath','unchanged','filter','\x20pushed,\x20','catch','length','Local\x20directory\x20\x22','\x20failed','POST','dbName','No\x20local\x20SQL\x20files\x20found.','appCode','entries','dbDirectory','sqlcode','force','lockFilePath'];a203_0x5796=function(){return _0x330417;};return a203_0x5796();}async function moveToTrash(_0x31a55f,_0x2a95e4,_0x426285){const _0x16f3df=a203_0x43f694,_0x3f4ba6=new Date()[_0x16f3df(0xa8)]()[_0x16f3df(0xe0)](/[:.]/g,'-'),_0x5247fc=relative(_0x31a55f,_0x426285),_0x5de2e9=join(_0x2a95e4,_0x3f4ba6,_0x5247fc);return await mkdir(dirname(_0x5de2e9),{'recursive':!![]}),await rename(_0x426285,_0x5de2e9),_0x5de2e9;}async function cleanupEmptyDirectories(_0x2bfad7,_0x20e32c){const _0x4952a3=a203_0x43f694;let _0x199782=resolve(_0x2bfad7);const _0x12df9c=resolve(_0x20e32c);while(_0x199782[_0x4952a3(0xa0)](''+_0x12df9c+sep)||_0x199782===_0x12df9c){if(_0x199782===_0x12df9c)return;try{const _0x426187=await readdir(_0x199782);if(_0x426187[_0x4952a3(0xc5)]>0x0)return;await rmdir(_0x199782);}catch{return;}_0x199782=dirname(_0x199782);}}async function resolveTargetDbBinding(_0xad83a1,_0x37a124,_0x552b5a){const _0x2369df=a203_0x43f694,_0x40f314=_0x37a124[_0x2369df(0xcd)];if(!_0x40f314)return{'dbId':_0x552b5a[_0x2369df(0xd5)],'dbName':_0x552b5a[_0x2369df(0xc9)]};const _0x3d2c38=buildDbDirectoryName(_0x552b5a[_0x2369df(0xc9)],_0x552b5a[_0x2369df(0xd5)]);if(_0x40f314===_0x3d2c38)return{'dbId':_0x552b5a['dbId'],'dbName':_0x552b5a[_0x2369df(0xc9)]};const _0x538a7a=parseExplicitDbDirectory(_0x40f314);if(_0x538a7a!=null)return{'dbId':_0x538a7a,'dbName':await getDbName(_0xad83a1,_0x538a7a)['catch'](()=>undefined)};const _0x4e18f9=await listDatabases(_0xad83a1),_0x3c49db=_0x4e18f9[_0x2369df(0xc2)](_0x513709=>buildDbDirectoryName(_0x513709[_0x2369df(0xc9)],_0x513709[_0x2369df(0xd5)])===_0x40f314);if(_0x3c49db[_0x2369df(0xc5)]===0x1)return{'dbId':_0x3c49db[0x0]['dbId'],'dbName':_0x3c49db[0x0][_0x2369df(0xc9)]};if(_0x3c49db[_0x2369df(0xc5)]===0x0)throw CliErrors[_0x2369df(0xad)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x40f314+_0x2369df(0xab)+_0x37a124['sqlCode']+'.');const _0x1c70d0=_0x3c49db['map'](_0x37e402=>_0x37e402['dbName']+'\x20('+_0x37e402[_0x2369df(0xd5)]+')')[_0x2369df(0xd4)](',\x20');throw CliErrors[_0x2369df(0xad)](_0x2369df(0xc6)+_0x40f314+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x37a124[_0x2369df(0xac)]+':\x20'+_0x1c70d0);}function parseExplicitDbDirectory(_0xbb8240){const _0x49efeb=a203_0x43f694,_0xd24cf2=/^db-(\d+)$/[_0x49efeb(0xa4)](_0xbb8240);if(!_0xd24cf2)return null;const _0x47cc78=Number(_0xd24cf2[0x1]);return Number['isFinite'](_0x47cc78)&&_0x47cc78>0x0?_0x47cc78:null;}
|
|
1
|
+
const a203_0xfb2fb3=a203_0x5e27;(function(_0x18fb9c,_0x50f13e){const _0x3ff4a0=a203_0x5e27,_0x35b48c=_0x18fb9c();while(!![]){try{const _0xfd152f=-parseInt(_0x3ff4a0(0x212))/0x1+parseInt(_0x3ff4a0(0x1f3))/0x2+-parseInt(_0x3ff4a0(0x203))/0x3+parseInt(_0x3ff4a0(0x1eb))/0x4*(parseInt(_0x3ff4a0(0x21e))/0x5)+parseInt(_0x3ff4a0(0x20e))/0x6*(-parseInt(_0x3ff4a0(0x20b))/0x7)+-parseInt(_0x3ff4a0(0x219))/0x8*(-parseInt(_0x3ff4a0(0x1e0))/0x9)+parseInt(_0x3ff4a0(0x1e4))/0xa;if(_0xfd152f===_0x50f13e)break;else _0x35b48c['push'](_0x35b48c['shift']());}catch(_0xe6dbc4){_0x35b48c['push'](_0x35b48c['shift']());}}}(a203_0x835f,0x68dc6));function a203_0x5e27(_0x3946b1,_0x4c5c63){_0x3946b1=_0x3946b1-0x1e0;const _0x835f19=a203_0x835f();let _0x5e2797=_0x835f19[_0x3946b1];return _0x5e2797;}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';function a203_0x835f(){const _0x35d3e5=['1433268oopXrY','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','join','length','str','mode','validation','dbName','\x20failed','Push\x20local\x20SQL\x20files\x20to\x20remote','/smartapi/custom/updateUserCustomSql','push','filePath','sqlRootDir','toISOString','status','916371KjsOGM','dbDirectory','set','has','Local\x20SQL\x20not\x20found:\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','\x20pushed,\x20','sqls','14HuHUDG','write','lockFilePath','1677906GQYmut','exec','force','projectRoot','660401EpnwhR','sqlRoot','lastSync','entries','trashDir','Push\x20complete:\x20','appCode','274504mRmrVX','utf8','remoteId','sql','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','985SzKRSN','No\x20local\x20SQL\x20files\x20found.','sqlConfig','sqlCode','isFinite','sqlcode','map','153TXdPUD','Local\x20directory\x20\x22','filter','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','3034640YQwJde','boolean','path','version','sqlName','message','dbId','7132FMjtXb','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','relativePath','replace','hash','POST','bool','startsWith'];a203_0x835f=function(){return _0x35d3e5;};return a203_0x835f();}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';import{automaticDeploymentSyncSucceeded,buildAutomaticDeploymentSyncPreview,runAutomaticDeploymentSync}from'../../commands/deployment/auto-sync.js';async function getTargetSqlQueries(_0x1f35f6,_0x29db05,_0x1efc24){const _0x366dd4=a203_0x5e27,_0x338bc2=await scanLocalSqlQueries(_0x1f35f6),_0x5a03c3=new Map();for(const _0x1476a3 of _0x338bc2){if(_0x1efc24&&_0x1476a3['sqlCode']!==_0x1efc24)continue;const _0x297c84=_0x5a03c3['get'](_0x1476a3[_0x366dd4(0x221)])??[];_0x297c84[_0x366dd4(0x1fe)](_0x1476a3),_0x5a03c3[_0x366dd4(0x205)](_0x1476a3[_0x366dd4(0x221)],_0x297c84);}if(_0x1efc24&&!_0x5a03c3[_0x366dd4(0x206)](_0x1efc24))throw CliErrors[_0x366dd4(0x1f9)](_0x366dd4(0x207)+_0x1efc24);const _0x1c139a=[];for(const [_0x2bb121,_0x583296]of _0x5a03c3[_0x366dd4(0x215)]()){if(_0x583296[_0x366dd4(0x1f6)]===0x1){_0x1c139a[_0x366dd4(0x1fe)](_0x583296[0x0]);continue;}const _0x5262a4=_0x29db05[_0x366dd4(0x20a)][_0x2bb121],_0x3a2067=_0x5262a4?.['path'],_0x2223bb=_0x3a2067?_0x583296[_0x366dd4(0x1e2)](_0x2f323c=>_0x2f323c[_0x366dd4(0x1ed)]!==_0x3a2067):_0x583296;if(_0x5262a4&&_0x2223bb[_0x366dd4(0x1f6)]===0x1){_0x1c139a[_0x366dd4(0x1fe)](_0x2223bb[0x0]);continue;}throw CliErrors[_0x366dd4(0x1f9)](_0x366dd4(0x1f4)+_0x2bb121+_0x366dd4(0x1e3));}return _0x1c139a;}export const sqlPush={'service':a203_0xfb2fb3(0x21c),'command':'push','description':a203_0xfb2fb3(0x1fc),'risk':a203_0xfb2fb3(0x20c),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a203_0xfb2fb3(0x210),'type':a203_0xfb2fb3(0x1e5),'description':a203_0xfb2fb3(0x1ec)}],async 'dryRun'(_0x3442fd){const _0x2904e9=a203_0xfb2fb3,_0x21fc35=loadSqlProjectConfig(_0x3442fd['appCode']),_0x464ea0=await readSqlLockFile(_0x21fc35[_0x2904e9(0x20d)]),{appLock:_0x5f5238}=ensureSqlLockScope(_0x464ea0??createEmptySqlLock(),_0x3442fd['appCode'],_0x21fc35[_0x2904e9(0x213)],_0x2904e9(0x1fe)),_0x45493a=await getTargetSqlQueries(_0x21fc35,_0x5f5238,_0x3442fd[_0x2904e9(0x1f7)](_0x2904e9(0x223))||undefined),_0x560757=[];for(const _0x446f42 of _0x45493a){const _0x2220d7=await computeSqlFileHash(_0x446f42[_0x2904e9(0x1ff)]),_0x322973=_0x5f5238[_0x2904e9(0x20a)][_0x446f42[_0x2904e9(0x221)]],_0x365c56=!!_0x322973&&(_0x322973[_0x2904e9(0x1e6)]!==_0x446f42[_0x2904e9(0x1ed)]||!!_0x446f42['sqlName']&&_0x322973[_0x2904e9(0x1e8)]!==_0x446f42[_0x2904e9(0x1e8)]);if(!_0x3442fd[_0x2904e9(0x1f1)](_0x2904e9(0x210))&&_0x322973&&_0x322973[_0x2904e9(0x1ef)]===_0x2220d7&&!_0x365c56)continue;_0x560757[_0x2904e9(0x1fe)](_0x446f42[_0x2904e9(0x221)]);}return{'method':_0x2904e9(0x1f0),'url':_0x2904e9(0x1fd),'deploymentSync':buildAutomaticDeploymentSyncPreview('sql',_0x560757),'body':{'sqlCodes':_0x560757,'appCode':_0x3442fd[_0x2904e9(0x218)]},'description':'Would\x20push\x20'+_0x560757[_0x2904e9(0x1f6)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x31f6e9){const _0x85bba=a203_0xfb2fb3,_0x12ac1c=loadSqlProjectConfig(_0x31f6e9[_0x85bba(0x218)]),_0x320b25=await readSqlLockFile(_0x12ac1c[_0x85bba(0x20d)]),{lockData:_0x2a7bfc,appLock:_0x3bbc2a}=ensureSqlLockScope(_0x320b25??createEmptySqlLock(),_0x31f6e9[_0x85bba(0x218)],_0x12ac1c[_0x85bba(0x213)],_0x85bba(0x1fe)),_0x34cac0=await getTargetSqlQueries(_0x12ac1c,_0x3bbc2a,_0x31f6e9[_0x85bba(0x1f7)](_0x85bba(0x223))||undefined);if(_0x34cac0[_0x85bba(0x1f6)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x85bba(0x21f)};const _0x9b8c4e=[],_0x1f07a0=[],_0x397fc0=[];for(const _0x2eee40 of _0x34cac0){const _0x4c2256=_0x3bbc2a[_0x85bba(0x20a)][_0x2eee40['sqlCode']];if(!_0x4c2256){_0x397fc0['push']({'sqlCode':_0x2eee40[_0x85bba(0x221)],'error':_0x85bba(0x21d)});continue;}try{const _0x56e7c1=await computeSqlFileHash(_0x2eee40[_0x85bba(0x1ff)]),_0x3b1678=_0x4c2256[_0x85bba(0x1e6)]!==_0x2eee40[_0x85bba(0x1ed)]||!!_0x2eee40[_0x85bba(0x1e8)]&&_0x4c2256[_0x85bba(0x1e8)]!==_0x2eee40[_0x85bba(0x1e8)];if(!_0x31f6e9[_0x85bba(0x1f1)](_0x85bba(0x210))&&_0x4c2256['hash']===_0x56e7c1&&!_0x3b1678){_0x1f07a0[_0x85bba(0x1fe)]({'sqlCode':_0x2eee40[_0x85bba(0x221)],'reason':'unchanged'});continue;}if(_0x4c2256[_0x85bba(0x1e7)]==null){_0x397fc0['push']({'sqlCode':_0x2eee40[_0x85bba(0x221)],'error':_0x85bba(0x208)});continue;}const _0x11010d=await readFile(_0x2eee40[_0x85bba(0x1ff)],_0x85bba(0x21a)),_0x461517=stripLocalSqlMetadata(_0x11010d,_0x2eee40[_0x85bba(0x1f8)]),_0x1e85d5=_0x2eee40[_0x85bba(0x1e8)]||_0x4c2256[_0x85bba(0x1e8)],_0x45ccc2=await resolveTargetDbBinding(_0x31f6e9['appCode'],_0x2eee40,_0x4c2256),_0x3c8420=await updateSqlQuery({'id':_0x4c2256[_0x85bba(0x21b)],'appCode':_0x31f6e9['appCode'],'sqlCode':_0x2eee40[_0x85bba(0x221)],'sqlName':_0x1e85d5,'dbId':_0x45ccc2['dbId'],'version':_0x4c2256['version'],'sqlContent':_0x461517,'sqlConfig':_0x4c2256[_0x85bba(0x220)]??undefined}),_0x34e6a9=_0x3c8420['dbId']?await getDbName(_0x31f6e9[_0x85bba(0x218)],Number(_0x3c8420[_0x85bba(0x1ea)]))['catch'](()=>_0x45ccc2[_0x85bba(0x1fa)]):_0x45ccc2[_0x85bba(0x1fa)];_0x3bbc2a[_0x85bba(0x20a)][_0x2eee40[_0x85bba(0x221)]]={...buildSqlLockEntry(_0x3c8420,_0x461517,_0x56e7c1,{'dbName':_0x34e6a9}),'path':_0x2eee40[_0x85bba(0x1ed)],'mode':_0x4c2256[_0x85bba(0x1f8)]},await archivePreviousSqlFileIfNeeded(_0x12ac1c,_0x4c2256['path'],_0x2eee40[_0x85bba(0x1ed)]),_0x9b8c4e['push']({'sqlCode':_0x2eee40[_0x85bba(0x221)],'remoteId':_0x4c2256[_0x85bba(0x21b)]});}catch(_0x32b19f){_0x397fc0[_0x85bba(0x1fe)]({'sqlCode':_0x2eee40[_0x85bba(0x221)],'error':_0x32b19f instanceof Error?_0x32b19f[_0x85bba(0x1e9)]:String(_0x32b19f)});}}_0x3bbc2a[_0x85bba(0x214)]=new Date()[_0x85bba(0x201)](),await writeSqlLockFile(_0x12ac1c[_0x85bba(0x20d)],_0x2a7bfc);const _0x266877=_0x397fc0['length']===0x0,_0x59745d=await runAutomaticDeploymentSync(_0x31f6e9,_0x85bba(0x21c),_0x9b8c4e[_0x85bba(0x224)](_0x57213c=>_0x57213c[_0x85bba(0x221)]),_0x266877),_0x35c5c0=_0x266877&&automaticDeploymentSyncSucceeded(_0x59745d),_0x41ef42=',\x20deployment\x20sync\x20'+_0x59745d[_0x85bba(0x202)];return{'ok':_0x35c5c0,'data':{'pushed':_0x9b8c4e,'skipped':_0x1f07a0,'failed':_0x397fc0,'deploymentSync':_0x59745d},'message':_0x85bba(0x217)+_0x9b8c4e[_0x85bba(0x1f6)]+_0x85bba(0x209)+_0x1f07a0[_0x85bba(0x1f6)]+'\x20skipped,\x20'+_0x397fc0[_0x85bba(0x1f6)]+_0x85bba(0x1fb)+_0x41ef42};}};async function archivePreviousSqlFileIfNeeded(_0x4d3542,_0x5f9b1a,_0x1203db){const _0x21acd1=a203_0xfb2fb3;if(!_0x5f9b1a||_0x5f9b1a===_0x1203db)return;const _0x4cad3f=join(_0x4d3542[_0x21acd1(0x200)],_0x5f9b1a);if(!await fileExists(_0x4cad3f))return;const _0x947e10=await moveToTrash(_0x4d3542[_0x21acd1(0x211)],_0x4d3542[_0x21acd1(0x216)],_0x4cad3f);await cleanupEmptyDirectories(dirname(_0x4cad3f),_0x4d3542[_0x21acd1(0x200)]),void _0x947e10;}async function moveToTrash(_0x547e9b,_0x159bc2,_0x1df4ec){const _0x5f5820=a203_0xfb2fb3,_0x53e36c=new Date()[_0x5f5820(0x201)]()[_0x5f5820(0x1ee)](/[:.]/g,'-'),_0xc7e752=relative(_0x547e9b,_0x1df4ec),_0x5f39f2=join(_0x159bc2,_0x53e36c,_0xc7e752);return await mkdir(dirname(_0x5f39f2),{'recursive':!![]}),await rename(_0x1df4ec,_0x5f39f2),_0x5f39f2;}async function cleanupEmptyDirectories(_0x1b2d75,_0x16290b){const _0x274600=a203_0xfb2fb3;let _0x615912=resolve(_0x1b2d75);const _0x5a4f9a=resolve(_0x16290b);while(_0x615912[_0x274600(0x1f2)](''+_0x5a4f9a+sep)||_0x615912===_0x5a4f9a){if(_0x615912===_0x5a4f9a)return;try{const _0x1e6372=await readdir(_0x615912);if(_0x1e6372[_0x274600(0x1f6)]>0x0)return;await rmdir(_0x615912);}catch{return;}_0x615912=dirname(_0x615912);}}async function resolveTargetDbBinding(_0x162e0b,_0x578794,_0x1068db){const _0xeca1fa=a203_0xfb2fb3,_0x3279cc=_0x578794[_0xeca1fa(0x204)];if(!_0x3279cc)return{'dbId':_0x1068db[_0xeca1fa(0x1ea)],'dbName':_0x1068db[_0xeca1fa(0x1fa)]};const _0x325954=buildDbDirectoryName(_0x1068db['dbName'],_0x1068db[_0xeca1fa(0x1ea)]);if(_0x3279cc===_0x325954)return{'dbId':_0x1068db[_0xeca1fa(0x1ea)],'dbName':_0x1068db[_0xeca1fa(0x1fa)]};const _0x5bd115=parseExplicitDbDirectory(_0x3279cc);if(_0x5bd115!=null)return{'dbId':_0x5bd115,'dbName':await getDbName(_0x162e0b,_0x5bd115)['catch'](()=>undefined)};const _0xa13633=await listDatabases(_0x162e0b),_0x5d7fb1=_0xa13633[_0xeca1fa(0x1e2)](_0x880181=>buildDbDirectoryName(_0x880181['dbName'],_0x880181['dbId'])===_0x3279cc);if(_0x5d7fb1['length']===0x1)return{'dbId':_0x5d7fb1[0x0][_0xeca1fa(0x1ea)],'dbName':_0x5d7fb1[0x0][_0xeca1fa(0x1fa)]};if(_0x5d7fb1[_0xeca1fa(0x1f6)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x3279cc+'\x22\x20for\x20sqlCode\x20'+_0x578794[_0xeca1fa(0x221)]+'.');const _0x2830fe=_0x5d7fb1[_0xeca1fa(0x224)](_0x3b2266=>_0x3b2266['dbName']+'\x20('+_0x3b2266[_0xeca1fa(0x1ea)]+')')[_0xeca1fa(0x1f5)](',\x20');throw CliErrors[_0xeca1fa(0x1f9)](_0xeca1fa(0x1e1)+_0x3279cc+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x578794['sqlCode']+':\x20'+_0x2830fe);}function parseExplicitDbDirectory(_0x47b8eb){const _0x6362d3=a203_0xfb2fb3,_0x15cd81=/^db-(\d+)$/[_0x6362d3(0x20f)](_0x47b8eb);if(!_0x15cd81)return null;const _0x4a93c3=Number(_0x15cd81[0x1]);return Number[_0x6362d3(0x222)](_0x4a93c3)&&_0x4a93c3>0x0?_0x4a93c3:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x175ce5,_0x12792b){const _0x2b9cd0=a204_0x50d1,_0x3f4f2d=_0x175ce5();while(!![]){try{const _0x54524b=parseInt(_0x2b9cd0(0x174))/0x1+parseInt(_0x2b9cd0(0x189))/0x2+parseInt(_0x2b9cd0(0x17c))/0x3*(-parseInt(_0x2b9cd0(0x170))/0x4)+parseInt(_0x2b9cd0(0x175))/0x5+-parseInt(_0x2b9cd0(0x173))/0x6*(-parseInt(_0x2b9cd0(0x193))/0x7)+parseInt(_0x2b9cd0(0x185))/0x8+parseInt(_0x2b9cd0(0x186))/0x9*(-parseInt(_0x2b9cd0(0x192))/0xa);if(_0x54524b===_0x12792b)break;else _0x3f4f2d['push'](_0x3f4f2d['shift']());}catch(_0x9c3c4e){_0x3f4f2d['push'](_0x3f4f2d['shift']());}}}(a204_0x40e3,0x95e9f));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='.rabetbase/sql';export function buildSqlLockEntry(_0xce9e5b,_0xfa1c88,_0x568af8,_0x1343e4){const _0x3e24ae=a204_0x50d1,_0x13af9a=detectSqlMode(_0xfa1c88);return{'path':buildSqlRelativePath(_0xce9e5b[_0x3e24ae(0x176)],_0xce9e5b[_0x3e24ae(0x190)],_0x1343e4?.[_0x3e24ae(0x16c)],_0x13af9a,_0xce9e5b['dbId']),'hash':_0x568af8,'remoteId':_0xce9e5b['id'],'version':_0xce9e5b['version'],'dbId':Number(_0xce9e5b[_0x3e24ae(0x16f)]),'dbName':_0x1343e4?.[_0x3e24ae(0x16c)],'sqlName':_0xce9e5b[_0x3e24ae(0x190)],'sqlConfig':_0xce9e5b[_0x3e24ae(0x184)]??undefined,'mode':_0x13af9a};}export function cloneSqlLockData(_0x471e4f){const _0x42bb6b=a204_0x50d1;return{'apps':Object['fromEntries'](Object[_0x42bb6b(0x179)](_0x471e4f[_0x42bb6b(0x18c)])[_0x42bb6b(0x187)](([_0x58d291,_0x5440c2])=>[_0x58d291,{'sqlRoot':_0x5440c2[_0x42bb6b(0x172)],'lastSync':_0x5440c2[_0x42bb6b(0x177)],'sqls':{..._0x5440c2[_0x42bb6b(0x17e)]}}]))};}function a204_0x50d1(_0x5ac12f,_0x3b3d78){_0x5ac12f=_0x5ac12f-0x16c;const _0x40e376=a204_0x40e3();let _0x50d1fb=_0x40e376[_0x5ac12f];return _0x50d1fb;}export function ensureRemoteSqlContent(_0x1c8183){const _0x3913fb=a204_0x50d1;return _0x1c8183[_0x3913fb(0x17a)]??'';}export function buildLocalSqlFileContent(_0x3155e4,_0x164922,_0x2691d8){const _0x3bea26=a204_0x50d1,_0x5133b0=_0x2691d8?.[_0x3bea26(0x18a)]??detectSqlMode(_0x164922),_0x56f7b0=stripLocalSqlMetadata(_0x164922,_0x5133b0)[_0x3bea26(0x191)](),_0x16e007=[...buildMetadataHeaderLines({'sqlCode':_0x3155e4['sqlCode'],'sqlName':_0x3155e4[_0x3bea26(0x190)],'dbId':_0x3155e4[_0x3bea26(0x16f)],'dbName':_0x2691d8?.[_0x3bea26(0x16c)],'mode':_0x5133b0,'syncedAt':_0x2691d8?.['syncedAt'],'description':_0x2691d8?.[_0x3bea26(0x171)]},_0x5133b0),'',_0x56f7b0],_0x212821=_0x16e007[_0x3bea26(0x194)]('\x0a');return _0x212821['endsWith']('\x0a')?_0x212821:_0x212821+'\x0a';}export function stripLocalSqlMetadata(_0x5107e7,_0x4aa8a0){const _0x2e55a7=a204_0x50d1,_0x690fa9=_0x5107e7[_0x2e55a7(0x18d)](/\r\n/g,'\x0a')['split']('\x0a'),_0xbeac27=[];let _0x8f779a=0x0;if(_0x4aa8a0===_0x2e55a7(0x195))while(_0x8f779a<_0x690fa9['length']){const _0x85119c=_0x690fa9[_0x8f779a]??'';if(/^\s*<!--\s*@lovrabet\./[_0x2e55a7(0x182)](_0x85119c)){_0x8f779a++;continue;}if(_0x85119c[_0x2e55a7(0x191)]()===''&&_0x8f779a>0x0){_0x8f779a++;continue;}break;}else while(_0x8f779a<_0x690fa9[_0x2e55a7(0x18b)]){const _0x4fde52=_0x690fa9[_0x8f779a]??'';if(/^\s*--\s*@lovrabet\./[_0x2e55a7(0x182)](_0x4fde52)){_0x8f779a++;continue;}if(_0x4fde52[_0x2e55a7(0x191)]()===''&&_0x8f779a>0x0){_0x8f779a++;continue;}break;}for(;_0x8f779a<_0x690fa9[_0x2e55a7(0x18b)];_0x8f779a++){_0xbeac27['push'](_0x690fa9[_0x8f779a]);}return _0xbeac27[_0x2e55a7(0x194)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x86b1ba,_0x7b4354){const _0x591631=a204_0x50d1;if(_0x7b4354?.['mode'])return _0x7b4354[_0x591631(0x18a)];return detectSqlMode(_0x86b1ba);}export function resolveSqlFileName(_0x405ff9,_0x9da412,_0x38d1e8){const _0x210cc1=a204_0x50d1;if(_0x38d1e8?.['path'])return _0x38d1e8[_0x210cc1(0x18f)];if(_0x38d1e8?.[_0x210cc1(0x190)]||_0x38d1e8?.[_0x210cc1(0x16c)])return buildSqlRelativePath(_0x405ff9,_0x38d1e8?.[_0x210cc1(0x190)],_0x38d1e8?.[_0x210cc1(0x16c)],resolveSqlMode(_0x9da412,_0x38d1e8),_0x38d1e8?.[_0x210cc1(0x16f)]);return buildDefaultSqlFileName(_0x405ff9,resolveSqlMode(_0x9da412,_0x38d1e8));}function a204_0x40e3(){const _0x210d15=['lastSync','\x20-->','entries','sqlContent','includes','3MRKNOI','stderr','sqls','syncedAt','close','\x20[y/N]\x20','test','question','sqlConfig','800920gzJpRR','21851658wIMcKo','map','--\x20@lovrabet.','1185608fhTwRz','mode','length','apps','replace','<!--\x20@lovrabet.','path','sqlName','trim','10MBcNBD','826sAnSAl','join','mybatisXml','dbName','toLowerCase','filter','dbId','3780108PfPuJW','description','sqlRoot','61284RIdgVs','913370AJXqwN','5877475rgejHX','sqlCode'];a204_0x40e3=function(){return _0x210d15;};return a204_0x40e3();}export function resolveSqlLocalDir(_0x50be30,_0x5591ae){return join(_0x50be30,SQL_LOCAL_REL_DIR,_0x5591ae);}export async function confirmForceOverwrite(_0x1a5878){const _0x315cfd=a204_0x50d1,_0x1b7812=createInterface({'input':process['stdin'],'output':process[_0x315cfd(0x17d)]}),_0xae87a0=await new Promise(_0x7c6af0=>{const _0x56de13=_0x315cfd;_0x1b7812[_0x56de13(0x183)](_0x1a5878+_0x56de13(0x181),_0x7c6af0);});return _0x1b7812[_0x315cfd(0x180)](),['y','yes'][_0x315cfd(0x17b)](_0xae87a0[_0x315cfd(0x191)]()[_0x315cfd(0x16d)]());}export function findSqlLockScope(_0x4634dd,_0x576923){return _0x4634dd['apps'][_0x576923];}function buildMetadataHeaderLines(_0xe3f9c5,_0x10ccd7){const _0x2fb8f9=a204_0x50d1,_0x56cf6a=[['sqlCode',_0xe3f9c5['sqlCode']],[_0x2fb8f9(0x190),_0xe3f9c5[_0x2fb8f9(0x190)]],[_0x2fb8f9(0x16f),_0xe3f9c5[_0x2fb8f9(0x16f)]],[_0x2fb8f9(0x16c),_0xe3f9c5['dbName']],[_0x2fb8f9(0x18a),_0xe3f9c5[_0x2fb8f9(0x18a)]],[_0x2fb8f9(0x17f),_0xe3f9c5[_0x2fb8f9(0x17f)]],[_0x2fb8f9(0x171),_0xe3f9c5[_0x2fb8f9(0x171)]]];if(_0x10ccd7===_0x2fb8f9(0x195))return _0x56cf6a[_0x2fb8f9(0x16e)](([,_0x5e73ba])=>_0x5e73ba!==undefined&&_0x5e73ba!==null&&String(_0x5e73ba)[_0x2fb8f9(0x191)]()!=='')[_0x2fb8f9(0x187)](([_0x50dab0,_0xe0dbdb])=>_0x2fb8f9(0x18e)+_0x50dab0+':\x20'+String(_0xe0dbdb)+_0x2fb8f9(0x178));return _0x56cf6a[_0x2fb8f9(0x16e)](([,_0x3f7306])=>_0x3f7306!==undefined&&_0x3f7306!==null&&String(_0x3f7306)[_0x2fb8f9(0x191)]()!=='')['map'](([_0xef0660,_0x5b9876])=>_0x2fb8f9(0x188)+_0xef0660+':\x20'+String(_0x5b9876));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a205_0x15f317=a205_0x1220;(function(_0x17dfb7,_0x4540ad){const _0x4c7552=a205_0x1220,_0x4054cd=_0x17dfb7();while(!![]){try{const _0x239813=parseInt(_0x4c7552(0x13a))/0x1+-parseInt(_0x4c7552(0x130))/0x2+parseInt(_0x4c7552(0x11f))/0x3+-parseInt(_0x4c7552(0x120))/0x4+-parseInt(_0x4c7552(0x11b))/0x5*(parseInt(_0x4c7552(0x126))/0x6)+parseInt(_0x4c7552(0x13b))/0x7+-parseInt(_0x4c7552(0x137))/0x8*(parseInt(_0x4c7552(0x132))/0x9);if(_0x239813===_0x4540ad)break;else _0x4054cd['push'](_0x4054cd['shift']());}catch(_0x1be394){_0x4054cd['push'](_0x4054cd['shift']());}}}(a205_0x26c1,0x26695));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a205_0x26c1(){const _0x284620=['bool','6FsqKbc','sqls','map','totalCount','boolean','paging','keys','sql','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','push','262730JJONAa','lockKey','345834EZphOL','has','\x20missing,\x20','length','\x20unchanged','24kxsQqv','remote','filePath','224224UHTzgV','441217sySTKH','sqlName','path','103415vlKVZQ','status','\x20remote-only','All\x20SQL\x20queries\x20are\x20in\x20sync.','439395MAeMHV','36244tYaOzx','sqlCode','hash','\x20modified,\x20','appCode'];a205_0x26c1=function(){return _0x284620;};return a205_0x26c1();}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(_0x1b9afe){const _0x28f7c0=a205_0x1220,_0x505ee8=[];let _0x5e45a5=0x1;while(!![]){const _0x17105a=await listSqlQueries(_0x1b9afe,{'currentPage':_0x5e45a5,'pageSize':PAGE_SIZE}),_0x91ce6b=_0x17105a['tableData']??[];_0x505ee8[_0x28f7c0(0x12f)](..._0x91ce6b['map'](_0x3697c4=>_0x3697c4[_0x28f7c0(0x121)]));if(_0x91ce6b[_0x28f7c0(0x135)]===0x0)break;const _0x16e0f6=_0x17105a[_0x28f7c0(0x12b)]?.[_0x28f7c0(0x129)];if(_0x16e0f6!=null?_0x505ee8[_0x28f7c0(0x135)]>=_0x16e0f6:_0x91ce6b['length']<PAGE_SIZE)break;_0x5e45a5++;}return _0x505ee8;}function a205_0x1220(_0x16c9f8,_0x1ce8ec){_0x16c9f8=_0x16c9f8-0x11b;const _0x26c107=a205_0x26c1();let _0x122088=_0x26c107[_0x16c9f8];return _0x122088;}export const sqlStatus={'service':a205_0x15f317(0x12d),'command':a205_0x15f317(0x11c),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':'read','flags':[{'name':a205_0x15f317(0x138),'type':a205_0x15f317(0x12a),'description':a205_0x15f317(0x12e)}],async 'execute'(_0x5b621d){const _0x1b04c2=a205_0x15f317,_0x5137d0=loadSqlProjectConfig(_0x5b621d[_0x1b04c2(0x124)]),_0x5f2c35=await readSqlLockFile(_0x5137d0['lockFilePath']),{appLock:_0x330a0b}=ensureSqlLockScope(_0x5f2c35??createEmptySqlLock(),_0x5137d0[_0x1b04c2(0x124)],_0x5137d0['sqlRoot'],_0x1b04c2(0x11c)),_0x3fccd2=await scanLocalSqlQueries(_0x5137d0),_0xe67c49=[],_0x3657c0=[],_0x162acd=[],_0x4e5c6c=[],_0x591a1f=new Set(_0x3fccd2[_0x1b04c2(0x128)](_0x386107=>_0x386107[_0x1b04c2(0x131)]));for(const _0x379cc7 of _0x3fccd2){const _0x85e4d8=await computeSqlFileHash(_0x379cc7[_0x1b04c2(0x139)]),_0x4e3a02=_0x330a0b[_0x1b04c2(0x127)][_0x379cc7[_0x1b04c2(0x131)]],_0x209fa7=!!_0x4e3a02&&_0x4e3a02[_0x1b04c2(0x13d)]!==_0x379cc7['relativePath'],_0x1bb993=!!_0x4e3a02&&!!_0x379cc7['sqlName']&&_0x4e3a02[_0x1b04c2(0x13c)]!==_0x379cc7['sqlName'];if(!_0x4e3a02)_0xe67c49[_0x1b04c2(0x12f)](_0x379cc7[_0x1b04c2(0x131)]);else _0x4e3a02[_0x1b04c2(0x122)]!==_0x85e4d8||_0x209fa7||_0x1bb993?_0x3657c0[_0x1b04c2(0x12f)](_0x379cc7['lockKey']):_0x162acd[_0x1b04c2(0x12f)](_0x379cc7[_0x1b04c2(0x131)]);}for(const _0x983322 of Object[_0x1b04c2(0x12c)](_0x330a0b['sqls'])){!_0x591a1f['has'](_0x983322)&&_0x4e5c6c[_0x1b04c2(0x12f)](_0x983322);}const _0x36a840=[];if(_0x5b621d[_0x1b04c2(0x125)](_0x1b04c2(0x138))){const _0x5b3e25=await fetchAllSqlCodes(_0x5b621d[_0x1b04c2(0x124)]);for(const _0x3ab01c of _0x5b3e25){!_0x591a1f[_0x1b04c2(0x133)](_0x3ab01c)&&!_0x330a0b[_0x1b04c2(0x127)][_0x3ab01c]&&_0x36a840[_0x1b04c2(0x12f)](_0x3ab01c);}}const _0x1a001f=_0xe67c49[_0x1b04c2(0x135)]===0x0&&_0x3657c0[_0x1b04c2(0x135)]===0x0&&_0x4e5c6c[_0x1b04c2(0x135)]===0x0&&_0x36a840['length']===0x0;return{'ok':!![],'data':{'added':_0xe67c49,'modified':_0x3657c0,'missing':_0x4e5c6c,'unchanged':_0x162acd,'remoteOnly':_0x36a840},'message':_0x1a001f?_0x1b04c2(0x11e):_0xe67c49['length']+'\x20added,\x20'+_0x3657c0[_0x1b04c2(0x135)]+_0x1b04c2(0x123)+_0x4e5c6c[_0x1b04c2(0x135)]+_0x1b04c2(0x134)+_0x162acd[_0x1b04c2(0x135)]+_0x1b04c2(0x136)+(_0x36a840[_0x1b04c2(0x135)]>0x0?',\x20'+_0x36a840[_0x1b04c2(0x135)]+_0x1b04c2(0x11d):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a206_0x2cbb(){const _0x10c9d7=['message','get','index_columns','flatMap','columnNames','--check-indexes\x20requires\x20--schemas.','schema:','2649112JzcqBa','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','Dataset\x20\x22','valid','Table\x20\x22','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','318671RiDbAN','find','map','joinAudit','isDangerous','push','toLowerCase','validation','columns','str','schemas','cwd','8742234IzxUBg','6yfHTLl','dataset','sql','Provide\x20--file\x20or\x20--sql','check-indexes','\x22\x20not\x20found\x20in\x20any\x20dataset','SQL\x20schema\x20validation','file','fields','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','pkField','indexes','boolean','utf-8','4061595IJspSx','2449648HnVPAe','parameters','read','index_type','size','File\x20not\x20found:\x20','flagMissing','trim','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','sqlType','dbtableConfig','filter','name','type','reason','9082626CRlNEL','schemaWarnings','isSelectOnly','split','indexName','primary','from','18YorGek','tables','tableName','813355yKHoXj','string','isArray','length','appCode','\x22\x20not\x20found\x20or\x20not\x20accessible'];a206_0x2cbb=function(){return _0x10c9d7;};return a206_0x2cbb();}const a206_0x3ba014=a206_0x17bc;(function(_0x13b9c9,_0x11a5cd){const _0x809f54=a206_0x17bc,_0x558a77=_0x13b9c9();while(!![]){try{const _0x329e30=parseInt(_0x809f54(0x1c2))/0x1*(parseInt(_0x809f54(0x1cf))/0x2)+-parseInt(_0x809f54(0x195))/0x3+parseInt(_0x809f54(0x196))/0x4+-parseInt(_0x809f54(0x1af))/0x5+parseInt(_0x809f54(0x1ce))/0x6+-parseInt(_0x809f54(0x1a5))/0x7+-parseInt(_0x809f54(0x1bc))/0x8*(-parseInt(_0x809f54(0x1ac))/0x9);if(_0x329e30===_0x11a5cd)break;else _0x558a77['push'](_0x558a77['shift']());}catch(_0xd13178){_0x558a77['push'](_0x558a77['shift']());}}}(a206_0x2cbb,0xd54d8));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a206_0x3ba014(0x1d1),'command':'validate','description':a206_0x3ba014(0x1c1),'risk':a206_0x3ba014(0x198),'flags':[{'name':'file','type':'string','description':a206_0x3ba014(0x19e)},{'name':a206_0x3ba014(0x1d1),'type':a206_0x3ba014(0x1b0),'description':a206_0x3ba014(0x1bd)},{'name':a206_0x3ba014(0x1cc),'type':a206_0x3ba014(0x1b0),'description':a206_0x3ba014(0x190)},{'name':a206_0x3ba014(0x18b),'type':a206_0x3ba014(0x193),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x18ee66){const _0x129da8=a206_0x3ba014,_0x73047a=_0x18ee66['str'](_0x129da8(0x18e)),_0x172da8=_0x18ee66[_0x129da8(0x1cb)](_0x129da8(0x1d1)),_0x2a55d1=_0x18ee66[_0x129da8(0x1cb)](_0x129da8(0x1cc)),_0x4c3524=_0x18ee66['bool'](_0x129da8(0x18b));if(!_0x73047a&&!_0x172da8)throw CliErrors[_0x129da8(0x19c)](_0x129da8(0x18e),_0x129da8(0x1d2));if(_0x4c3524&&!_0x2a55d1)throw CliErrors[_0x129da8(0x1c9)](_0x129da8(0x1ba));let _0x520ba5;if(_0x73047a){const _0x1f9c78=resolve(process[_0x129da8(0x1cd)](),_0x73047a);if(!existsSync(_0x1f9c78))throw CliErrors[_0x129da8(0x1c9)](_0x129da8(0x19b)+_0x1f9c78);_0x520ba5=readFileSync(_0x1f9c78,_0x129da8(0x194));}else _0x520ba5=_0x172da8;const _0x226b45=validateSql(_0x520ba5),_0x372d96={'valid':_0x226b45['valid'],'sqlType':_0x226b45[_0x129da8(0x19f)]['type'],'isSelectOnly':_0x226b45[_0x129da8(0x19f)][_0x129da8(0x1a7)],'isDangerous':_0x226b45[_0x129da8(0x19f)][_0x129da8(0x1c6)],'tables':_0x226b45[_0x129da8(0x1ad)],'parameters':_0x226b45[_0x129da8(0x197)],'message':_0x226b45[_0x129da8(0x1b5)]};_0x226b45['sqlType'][_0x129da8(0x1a4)]&&(_0x372d96[_0x129da8(0x1a4)]=_0x226b45[_0x129da8(0x19f)]['reason']);if(_0x2a55d1&&_0x226b45[_0x129da8(0x1bf)]){const _0x5b7bab=_0x2a55d1[_0x129da8(0x1a8)](',')[_0x129da8(0x1c4)](_0x13599d=>_0x13599d[_0x129da8(0x19d)]())[_0x129da8(0x1a1)](Boolean),_0x7a8687=[],_0x329506=[],_0x1d56a3=filterDbTableBackedDatasets(await listDatasets(_0x18ee66[_0x129da8(0x1b3)])),_0x4f8010=new Map(_0x1d56a3[_0x129da8(0x1c4)](_0x4492e8=>[_0x4492e8['dbtableConfig']?.[_0x129da8(0x1ae)]?.[_0x129da8(0x1c8)](),_0x4492e8]));for(const _0x48092a of _0x226b45[_0x129da8(0x1ad)]){const _0x13fef3=_0x4f8010[_0x129da8(0x1b6)](_0x48092a[_0x129da8(0x1c8)]());!_0x13fef3&&_0x7a8687[_0x129da8(0x1c7)](_0x129da8(0x1c0)+_0x48092a+_0x129da8(0x18c));}for(const _0x2311d9 of _0x5b7bab){let _0x4c66e4;try{_0x4c66e4=await getDatasetDetail(_0x2311d9);}catch{_0x7a8687[_0x129da8(0x1c7)](_0x129da8(0x1be)+_0x2311d9+_0x129da8(0x1b4));continue;}assertDatasetIsDbTableBacked(_0x4c66e4,_0x129da8(0x18d));const _0x5d51ef=Array[_0x129da8(0x1b1)](_0x4c66e4[_0x129da8(0x18f)])?_0x4c66e4[_0x129da8(0x18f)]:[],_0x24ff98=new Set(_0x5d51ef[_0x129da8(0x1c4)](_0x4dcba0=>_0x4dcba0[_0x129da8(0x1a2)]?.[_0x129da8(0x1c8)]())),_0x4f4a84=_0x4c66e4[_0x129da8(0x1a0)]?.[_0x129da8(0x1ae)]||_0x4c66e4[_0x129da8(0x1ae)]||_0x2311d9;_0x372d96[_0x129da8(0x1bb)+_0x4f4a84]={'code':_0x2311d9,'tableName':_0x4f4a84,'fieldCount':_0x24ff98[_0x129da8(0x19a)],'fields':Array[_0x129da8(0x1ab)](_0x24ff98)};if(_0x4c3524){const _0x1ccae0=normalizeDatasetIndexes(_0x4c66e4);_0x329506[_0x129da8(0x1c7)]({'tableName':_0x4f4a84,..._0x1ccae0});}}_0x7a8687[_0x129da8(0x1b2)]>0x0&&(_0x372d96[_0x129da8(0x1a6)]=_0x7a8687),_0x4c3524&&(_0x372d96[_0x129da8(0x1c5)]=auditSqlJoinIndexes(_0x520ba5,_0x329506));}return{'ok':_0x226b45['valid'],'data':_0x372d96,'message':_0x226b45[_0x129da8(0x1b5)]};}};function a206_0x17bc(_0xa2d817,_0x13deaa){_0xa2d817=_0xa2d817-0x18b;const _0x2cbbf2=a206_0x2cbb();let _0x17bc79=_0x2cbbf2[_0xa2d817];return _0x17bc79;}function normalizeDatasetIndexes(_0x3e95bb){const _0x47cc06=a206_0x3ba014,_0x3b1259=Array[_0x47cc06(0x1b1)](_0x3e95bb?.[_0x47cc06(0x1d0)]?.[_0x47cc06(0x192)])?_0x3e95bb[_0x47cc06(0x1d0)]['indexes']:Array[_0x47cc06(0x1b1)](_0x3e95bb?.[_0x47cc06(0x192)])?_0x3e95bb[_0x47cc06(0x192)]:[],_0x34efe6=_0x3b1259[_0x47cc06(0x1b8)](_0x2b278d=>{const _0x588c50=_0x47cc06,_0x20bca2=Array[_0x588c50(0x1b1)](_0x2b278d?.[_0x588c50(0x1b7)])?_0x2b278d[_0x588c50(0x1b7)]:Array[_0x588c50(0x1b1)](_0x2b278d?.[_0x588c50(0x1b9)])?_0x2b278d['columnNames']:Array[_0x588c50(0x1b1)](_0x2b278d?.[_0x588c50(0x1ca)])?_0x2b278d[_0x588c50(0x1ca)]:[],_0x20da5f=_0x20bca2[_0x588c50(0x1a1)](_0x4d3bbf=>typeof _0x4d3bbf===_0x588c50(0x1b0))[_0x588c50(0x1c4)](_0x5c2caa=>_0x5c2caa['trim']())[_0x588c50(0x1a1)](Boolean);if(_0x20da5f[_0x588c50(0x1b2)]===0x0)return[];const _0x552e63=[_0x2b278d?.[_0x588c50(0x1a9)],_0x2b278d?.['index_name'],_0x2b278d?.[_0x588c50(0x1a2)]][_0x588c50(0x1c3)](_0x1c6ff3=>typeof _0x1c6ff3==='string'&&_0x1c6ff3['trim']()),_0x3ffbad=[_0x2b278d?.[_0x588c50(0x199)],_0x2b278d?.[_0x588c50(0x1a3)]]['find'](_0x6aa57a=>typeof _0x6aa57a===_0x588c50(0x1b0)&&_0x6aa57a[_0x588c50(0x19d)]());return[{..._0x552e63?{'name':_0x552e63[_0x588c50(0x19d)]()}:{},..._0x3ffbad?{'type':_0x3ffbad['trim']()}:{},'columns':_0x20da5f}];}),_0x675bb1=[..._0x34efe6],_0x3d3570=typeof _0x3e95bb?.[_0x47cc06(0x1a0)]?.['pkField']===_0x47cc06(0x1b0)?_0x3e95bb[_0x47cc06(0x1a0)][_0x47cc06(0x191)][_0x47cc06(0x1a8)](',')[_0x47cc06(0x1c4)](_0x43e53f=>_0x43e53f[_0x47cc06(0x19d)]())[_0x47cc06(0x1a1)](Boolean):[];return _0x3d3570[_0x47cc06(0x1b2)]>0x0&&_0x675bb1['unshift']({'type':_0x47cc06(0x1aa),'columns':_0x3d3570}),{'indexes':_0x675bb1,'metadataAvailable':_0x34efe6[_0x47cc06(0x1b2)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1365e1,_0x42b8c0){const _0x2603c6=a207_0x5864,_0x386bd3=_0x1365e1();while(!![]){try{const _0x5d3b96=-parseInt(_0x2603c6(0x1cf))/0x1+-parseInt(_0x2603c6(0x1cc))/0x2+-parseInt(_0x2603c6(0x1d0))/0x3+parseInt(_0x2603c6(0x1c9))/0x4+parseInt(_0x2603c6(0x1ce))/0x5+-parseInt(_0x2603c6(0x1ca))/0x6+-parseInt(_0x2603c6(0x1cb))/0x7*(-parseInt(_0x2603c6(0x1cd))/0x8);if(_0x5d3b96===_0x42b8c0)break;else _0x386bd3['push'](_0x386bd3['shift']());}catch(_0x5342e7){_0x386bd3['push'](_0x386bd3['shift']());}}}(a207_0x131c,0xbdd96));function a207_0x131c(){const _0x11eefc=['8756232mABrnL','112hfhgJt','3024146DDpgrY','2159624PPMbWO','518940LEveFM','1450805wEVzjG','54549NNRosK','3180076uosJiD'];a207_0x131c=function(){return _0x11eefc;};return a207_0x131c();}function a207_0x5864(_0x314807,_0x353eb2){_0x314807=_0x314807-0x1c9;const _0x131c4e=a207_0x131c();let _0x5864bf=_0x131c4e[_0x314807];return _0x5864bf;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a208_0x5667d0=a208_0x5222;(function(_0x175098,_0x2507d5){const _0x5ebee6=a208_0x5222,_0x212268=_0x175098();while(!![]){try{const _0x40d45a=parseInt(_0x5ebee6(0x87))/0x1+-parseInt(_0x5ebee6(0x96))/0x2+parseInt(_0x5ebee6(0x90))/0x3*(-parseInt(_0x5ebee6(0x9c))/0x4)+parseInt(_0x5ebee6(0x93))/0x5+parseInt(_0x5ebee6(0x8a))/0x6*(-parseInt(_0x5ebee6(0x89))/0x7)+-parseInt(_0x5ebee6(0x95))/0x8+-parseInt(_0x5ebee6(0x8b))/0x9*(-parseInt(_0x5ebee6(0x94))/0xa);if(_0x40d45a===_0x2507d5)break;else _0x212268['push'](_0x212268['shift']());}catch(_0x114786){_0x212268['push'](_0x212268['shift']());}}}(a208_0x3f21,0xbeeaf));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a208_0x5222(_0x373ca9,_0x374e8a){_0x373ca9=_0x373ca9-0x87;const _0x3f216a=a208_0x3f21();let _0x5222de=_0x3f216a[_0x373ca9];return _0x5222de;}function a208_0x3f21(){const _0x5e38dd=['8633328EyDESA','1951734VKuUgc','str',',\x20received\x20','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','task','375904mARaSm','isTerminal','string','523464rywbRu','taskId','37121UdzEnD','78hsyleZ','99PsiWTc','flagMissing','compress','task-id','appCode','3XlBGhQ','trim','cookie','1355080GbWQEm','2004970OOTNKl'];a208_0x3f21=function(){return _0x5e38dd;};return a208_0x3f21();}import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a208_0x5667d0(0x9b),'command':'status','description':a208_0x5667d0(0x99),'risk':'read','defaultOutputFormat':a208_0x5667d0(0x8d),'structuredErrors':!![],'flags':[{'name':'task-id','type':a208_0x5667d0(0x9e),'required':!![],'description':a208_0x5667d0(0x9a)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x58ab61){const _0x1bbe6e=a208_0x5667d0;if(!_0x58ab61[_0x1bbe6e(0x97)](_0x1bbe6e(0x8e))[_0x1bbe6e(0x91)]())throw CliErrors[_0x1bbe6e(0x8c)](_0x1bbe6e(0x8e));},async 'execute'(_0x3cf219){const _0x4fd7f8=a208_0x5667d0,_0x376c2e=_0x3cf219[_0x4fd7f8(0x97)]('task-id')[_0x4fd7f8(0x91)](),_0x631758=normalizeAsyncTask(await getAsyncTaskStatus(_0x376c2e,_0x3cf219['appCode'],_0x3cf219[_0x4fd7f8(0x92)]));if(_0x631758[_0x4fd7f8(0x88)]!==_0x376c2e)throw CliErrors['apiError']('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x376c2e+_0x4fd7f8(0x98)+_0x631758[_0x4fd7f8(0x88)]+'.');const _0x2f3115=buildAsyncTaskStatusCommand(_0x631758[_0x4fd7f8(0x88)],_0x3cf219[_0x4fd7f8(0x8f)]);return{'ok':!![],'message':asyncTaskMessage(_0x631758),'data':{'appCode':_0x3cf219[_0x4fd7f8(0x8f)],..._0x631758,'query':_0x631758[_0x4fd7f8(0x9d)]?null:{'command':_0x2f3115}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xdb2282,_0x20e4ec){const _0x4c1378=a209_0x2961,_0x10eae8=_0xdb2282();while(!![]){try{const _0xe1191b=-parseInt(_0x4c1378(0x179))/0x1+-parseInt(_0x4c1378(0x178))/0x2+parseInt(_0x4c1378(0x177))/0x3*(parseInt(_0x4c1378(0x176))/0x4)+-parseInt(_0x4c1378(0x17a))/0x5+-parseInt(_0x4c1378(0x17b))/0x6*(parseInt(_0x4c1378(0x175))/0x7)+parseInt(_0x4c1378(0x172))/0x8*(-parseInt(_0x4c1378(0x174))/0x9)+-parseInt(_0x4c1378(0x173))/0xa*(-parseInt(_0x4c1378(0x17c))/0xb);if(_0xe1191b===_0x20e4ec)break;else _0x10eae8['push'](_0x10eae8['shift']());}catch(_0x1c0c97){_0x10eae8['push'](_0x10eae8['shift']());}}}(a209_0x5603,0x46c44));function a209_0x2961(_0x158694,_0x9614c5){_0x158694=_0x158694-0x172;const _0x5603c1=a209_0x5603();let _0x2961a8=_0x5603c1[_0x158694];return _0x2961a8;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a209_0x5603(){const _0x4b593d=['603344NQaakp','562427RQXPVQ','2099340xVjvvY','6RBhpSK','11wbkPgo','16eyifXK','23182620xmzTqJ','2231613WOWnTy','2155790DHtrVW','884oIxxfd','807tfTfew'];a209_0x5603=function(){return _0x4b593d;};return a209_0x5603();}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a210_0x3292f1=a210_0x4ff9;function a210_0x4ff9(_0x59f455,_0x4c2377){_0x59f455=_0x59f455-0x17a;const _0x3a281e=a210_0x3a28();let _0x4ff996=_0x3a281e[_0x59f455];return _0x4ff996;}(function(_0xbbf33d,_0x2c4fef){const _0x478015=a210_0x4ff9,_0x23365a=_0xbbf33d();while(!![]){try{const _0x27c6a9=-parseInt(_0x478015(0x189))/0x1*(-parseInt(_0x478015(0x18f))/0x2)+parseInt(_0x478015(0x17c))/0x3*(-parseInt(_0x478015(0x18e))/0x4)+parseInt(_0x478015(0x18c))/0x5*(parseInt(_0x478015(0x17e))/0x6)+parseInt(_0x478015(0x17b))/0x7+parseInt(_0x478015(0x17f))/0x8*(-parseInt(_0x478015(0x18a))/0x9)+parseInt(_0x478015(0x17a))/0xa*(parseInt(_0x478015(0x18b))/0xb)+-parseInt(_0x478015(0x191))/0xc;if(_0x27c6a9===_0x2c4fef)break;else _0x23365a['push'](_0x23365a['shift']());}catch(_0x59889d){_0x23365a['push'](_0x23365a['shift']());}}}(a210_0x3a28,0x266c9));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a210_0x3a28(){const _0x5a40bf=['645LoWyWN','trim','1166116zbEDnP','432422RmZQXw','tenant','1858620tnTebj','20VgDZiM','1070153HVgHda','3hlEWfp','tenant-code','2442lcslit','96KutmnH','\x20tenant\x20member(s)','Exact\x20tenant\x20code','string','Pass\x20--tenant-code\x20<code>.','Found\x20','length','flagMissing','read','str','1qVXHXY','1323SiGkGW','1011835hrFeGD'];a210_0x3a28=function(){return _0x5a40bf;};return a210_0x3a28();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a210_0x3292f1(0x190),'command':'members-list','description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':a210_0x3292f1(0x187),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'tenant-code','type':a210_0x3292f1(0x182),'required':!![],'description':a210_0x3292f1(0x181)}],async 'validate'(_0x3dd468){const _0x4be5f7=a210_0x3292f1;if(!_0x3dd468[_0x4be5f7(0x188)](_0x4be5f7(0x17d))[_0x4be5f7(0x18d)]())throw CliErrors[_0x4be5f7(0x186)](_0x4be5f7(0x17d),_0x4be5f7(0x183));},async 'execute'(_0x96ff65){const _0x5b40f5=a210_0x3292f1,_0x2314a4=_0x96ff65[_0x5b40f5(0x188)]('tenant-code')[_0x5b40f5(0x18d)](),_0x58154b=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x2314a4,_0x58154b);const _0x5f5287=projectTenantMembers(await listTenantDirectoryMembers(_0x2314a4));return{'ok':!![],'data':{'tenantCode':_0x2314a4,'items':_0x5f5287,'totalCount':_0x5f5287[_0x5b40f5(0x185)]},'message':_0x5b40f5(0x184)+_0x5f5287[_0x5b40f5(0x185)]+_0x5b40f5(0x180)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x24bcb0,_0x25a427){const _0x5c3551=a211_0x1403,_0x2ed5f5=_0x24bcb0();while(!![]){try{const _0x21b366=parseInt(_0x5c3551(0x1fa))/0x1+-parseInt(_0x5c3551(0x1f7))/0x2+parseInt(_0x5c3551(0x1ea))/0x3+-parseInt(_0x5c3551(0x1f4))/0x4*(parseInt(_0x5c3551(0x1e8))/0x5)+-parseInt(_0x5c3551(0x1f1))/0x6+parseInt(_0x5c3551(0x1ed))/0x7+parseInt(_0x5c3551(0x1f6))/0x8;if(_0x21b366===_0x25a427)break;else _0x2ed5f5['push'](_0x2ed5f5['shift']());}catch(_0x216efd){_0x2ed5f5['push'](_0x2ed5f5['shift']());}}}(a211_0x6116,0x84404));import{CliErrors}from'../../errors.js';function textOrNull(_0x585b7d){const _0x3d2415=_0x585b7d?.['trim']();return _0x3d2415?_0x3d2415:null;}function a211_0x1403(_0x4ed50b,_0x44ab06){_0x4ed50b=_0x4ed50b-0x1e6;const _0x61168b=a211_0x6116();let _0x1403be=_0x61168b[_0x4ed50b];return _0x1403be;}export function projectTenantMembers(_0x58531a){const _0x40ba65=a211_0x1403,_0x5311a7=new Map();for(const _0x5e1653 of _0x58531a){const _0x2800aa=Number(_0x5e1653[_0x40ba65(0x1f0)]);if(!Number['isFinite'](_0x2800aa)||_0x2800aa<=0x0)continue;const _0x5c9bac={'userId':_0x2800aa,'username':textOrNull(_0x5e1653[_0x40ba65(0x1ec)]),'displayName':textOrNull(_0x5e1653[_0x40ba65(0x1e7)]),'role':_0x5e1653['adminFlag']===!![]?'ADMIN':_0x40ba65(0x1e9),'status':textOrNull(_0x5e1653[_0x40ba65(0x1fd)])},_0x2ba7c4=_0x5311a7[_0x40ba65(0x1f9)](_0x2800aa);if(!_0x2ba7c4){_0x5311a7[_0x40ba65(0x1ee)](_0x2800aa,_0x5c9bac);continue;}_0x2ba7c4[_0x40ba65(0x1ec)]??=_0x5c9bac['username'],_0x2ba7c4[_0x40ba65(0x1fc)]??=_0x5c9bac['displayName'],_0x2ba7c4[_0x40ba65(0x1fd)]??=_0x5c9bac[_0x40ba65(0x1fd)];if(_0x5c9bac[_0x40ba65(0x1e6)]===_0x40ba65(0x1f3))_0x2ba7c4[_0x40ba65(0x1e6)]=_0x40ba65(0x1f3);}return[..._0x5311a7[_0x40ba65(0x1f8)]()][_0x40ba65(0x1eb)]((_0x5d988d,_0x5c7b29)=>_0x5d988d[_0x40ba65(0x1f0)]-_0x5c7b29[_0x40ba65(0x1f0)]);}function a211_0x6116(){const _0x520d0c=['values','get','320560LLXASj','Tenant\x20\x22','displayName','status','role','nickname','1964660RtQqff','MEMBER','939435vbpbrf','sort','username','703164qgHaSF','set','validation','userId','5750550igmafN','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','ADMIN','4rNCMTm','tenantCode','12640888WkMRZl','842422kfzdSU'];a211_0x6116=function(){return _0x520d0c;};return a211_0x6116();}export function assertTenantAccessible(_0x275cee,_0x334b06){const _0x1b4b77=a211_0x1403;if(_0x334b06['some'](_0x3a0b3e=>_0x3a0b3e[_0x1b4b77(0x1f5)]===_0x275cee))return;throw CliErrors[_0x1b4b77(0x1ef)](_0x1b4b77(0x1fb)+_0x275cee+_0x1b4b77(0x1f2),'Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a212_0x366cbd=a212_0x3483;(function(_0x160a46,_0x59cccb){const _0x560751=a212_0x3483,_0x478898=_0x160a46();while(!![]){try{const _0x1a9fd9=-parseInt(_0x560751(0x110))/0x1*(-parseInt(_0x560751(0x104))/0x2)+-parseInt(_0x560751(0x106))/0x3*(parseInt(_0x560751(0x100))/0x4)+-parseInt(_0x560751(0xfe))/0x5*(parseInt(_0x560751(0x114))/0x6)+parseInt(_0x560751(0x108))/0x7+-parseInt(_0x560751(0x101))/0x8*(parseInt(_0x560751(0xfb))/0x9)+-parseInt(_0x560751(0xff))/0xa*(-parseInt(_0x560751(0xfc))/0xb)+-parseInt(_0x560751(0x112))/0xc*(-parseInt(_0x560751(0x10f))/0xd);if(_0x1a9fd9===_0x59cccb)break;else _0x478898['push'](_0x478898['shift']());}catch(_0x43e541){_0x478898['push'](_0x478898['shift']());}}}(a212_0x8662,0x45414));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';function a212_0x3483(_0xb6c5ff,_0x3d3140){_0xb6c5ff=_0xb6c5ff-0xfb;const _0x8662f6=a212_0x8662();let _0x34833d=_0x8662f6[_0xb6c5ff];return _0x34833d;}const PROVIDER_ID=a212_0x366cbd(0x10c),CURRENT_BINDING_WARNING=a212_0x366cbd(0x10a);function readDingTalkUserId(_0x105957){const _0x119771=a212_0x366cbd,_0x36ba61=_0x105957[_0x119771(0xfd)]('ding-talk-user-id')[_0x119771(0x10b)]();if(!_0x36ba61)throw CliErrors[_0x119771(0x111)]('--ding-talk-user-id\x20cannot\x20be\x20empty.','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x36ba61;}function buildBindingData(_0xb97004,_0xd16628){const _0x13db39=a212_0x366cbd;return{'operation':'bind','selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xb97004},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xb97004,'bound':!![]},'dryRun':_0xd16628,'backend':{'method':_0x13db39(0x105),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}function a212_0x8662(){const _0x43dc09=['4sGWtIx','1288vzMpFc','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','3752zTuJdP','POST','302649VtIhab','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','1872486uADgXq','ding-talk-user-id','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','trim','dingtalk','write','dingding-sandbox-bind','624aGxsiS','113GuqtWg','validation','103260MBuEMg','string','30RQqOLs','18513SiOKUJ','11MXddTu','str','348295EtYnNf','1714970GOrXAn'];a212_0x8662=function(){return _0x43dc09;};return a212_0x8662();}export const dingTalkSandboxBind={'service':'user-account','command':a212_0x366cbd(0x10e),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':a212_0x366cbd(0x10d),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a212_0x366cbd(0x109),'type':a212_0x366cbd(0x113),'required':!![],'description':a212_0x366cbd(0x102)}],async 'validate'(_0x3c8b5b){readDingTalkUserId(_0x3c8b5b);},async 'dryRun'(_0xa3b610){const _0x5b8b67=readDingTalkUserId(_0xa3b610);return asDryRunResult(buildBindingData(_0x5b8b67,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x41dc62){const _0xea0ecf=a212_0x366cbd,_0x154521=readDingTalkUserId(_0x41dc62),_0x33906d=await bindDingTalkSandboxAccount(_0x154521);if(_0x33906d!==!![])throw CliErrors['apiError'](_0xea0ecf(0x107),_0xea0ecf(0x103));return{'ok':!![],'data':buildBindingData(_0x154521,![]),'message':'Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2437f0,_0x727f5){const _0x372d03=a213_0x1ce7,_0x5bb2cf=_0x2437f0();while(!![]){try{const _0x22db8b=-parseInt(_0x372d03(0x1b5))/0x1+-parseInt(_0x372d03(0x1b9))/0x2*(parseInt(_0x372d03(0x1b8))/0x3)+-parseInt(_0x372d03(0x1b7))/0x4+-parseInt(_0x372d03(0x1b3))/0x5*(parseInt(_0x372d03(0x1b4))/0x6)+parseInt(_0x372d03(0x1b2))/0x7+-parseInt(_0x372d03(0x1b6))/0x8*(parseInt(_0x372d03(0x1bb))/0x9)+-parseInt(_0x372d03(0x1ba))/0xa*(-parseInt(_0x372d03(0x1b1))/0xb);if(_0x22db8b===_0x727f5)break;else _0x5bb2cf['push'](_0x5bb2cf['shift']());}catch(_0x281f97){_0x5bb2cf['push'](_0x5bb2cf['shift']());}}}(a213_0x2ff0,0x5bd3d));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';function a213_0x2ff0(){const _0x1e21e9=['3724938wNDkoD','977495soxYtq','6MiPyqR','463503MlVgel','56xHkQHs','470768MEAWam','1814259VVBQfq','2dJGFlx','100DGLpip','655164BHFojX','1908511pyBYUi'];a213_0x2ff0=function(){return _0x1e21e9;};return a213_0x2ff0();}function a213_0x1ce7(_0x5484fe,_0x12e0ae){_0x5484fe=_0x5484fe-0x1b1;const _0x2ff0cd=a213_0x2ff0();let _0x1ce727=_0x2ff0cd[_0x5484fe];return _0x1ce727;}export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a214_0x3452(){const _0x54ccd9=['App\x20profile\x20name','9413586RymvwD','workspace','add','272VAqlCb','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','12377770KDGoyo','1964mYjdft','11345AGUJAc','write','13542mQlYoD','workspace\x20add','1200938jcPCmO','name','966SJmwiN','2821YiSBNq','1418432jDtEzZ'];a214_0x3452=function(){return _0x54ccd9;};return a214_0x3452();}function a214_0x1320(_0x3ff962,_0x36b3b1){_0x3ff962=_0x3ff962-0xa1;const _0x3452b6=a214_0x3452();let _0x1320b2=_0x3452b6[_0x3ff962];return _0x1320b2;}const a214_0x52841a=a214_0x1320;(function(_0x319632,_0x183e1a){const _0x2475b5=a214_0x1320,_0xcaf8a8=_0x319632();while(!![]){try{const _0x1a6f22=-parseInt(_0x2475b5(0xa3))/0x1+-parseInt(_0x2475b5(0xac))/0x2*(-parseInt(_0x2475b5(0xa1))/0x3)+parseInt(_0x2475b5(0xaf))/0x4*(parseInt(_0x2475b5(0xb0))/0x5)+parseInt(_0x2475b5(0xa5))/0x6*(parseInt(_0x2475b5(0xa6))/0x7)+-parseInt(_0x2475b5(0xa7))/0x8+-parseInt(_0x2475b5(0xa9))/0x9+parseInt(_0x2475b5(0xae))/0xa;if(_0x1a6f22===_0x183e1a)break;else _0xcaf8a8['push'](_0xcaf8a8['shift']());}catch(_0x452c2e){_0xcaf8a8['push'](_0xcaf8a8['shift']());}}}(a214_0x3452,0x940ef));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a214_0x52841a(0xaa),'command':a214_0x52841a(0xab),'description':a214_0x52841a(0xad),'risk':a214_0x52841a(0xb1),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a214_0x52841a(0xa4),'description':a214_0x52841a(0xa8),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x431137=>validateAppName(_0x431137,a214_0x52841a(0xa2)),'execute':_0x155e9c=>runAppAdd(_0x155e9c,a214_0x52841a(0xa2))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a215_0x288320=a215_0x4b12;(function(_0x3e283a,_0x4261bd){const _0x5550f0=a215_0x4b12,_0x42be80=_0x3e283a();while(!![]){try{const _0x2b8083=parseInt(_0x5550f0(0x17b))/0x1+parseInt(_0x5550f0(0x16e))/0x2*(parseInt(_0x5550f0(0x162))/0x3)+parseInt(_0x5550f0(0x15a))/0x4*(-parseInt(_0x5550f0(0x16b))/0x5)+-parseInt(_0x5550f0(0x178))/0x6*(-parseInt(_0x5550f0(0x188))/0x7)+-parseInt(_0x5550f0(0x171))/0x8+-parseInt(_0x5550f0(0x177))/0x9*(-parseInt(_0x5550f0(0x18d))/0xa)+parseInt(_0x5550f0(0x172))/0xb;if(_0x2b8083===_0x4261bd)break;else _0x42be80['push'](_0x42be80['shift']());}catch(_0x44ac49){_0x42be80['push'](_0x42be80['shift']());}}}(a215_0x4891,0x2c794));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';function a215_0x4891(){const _0x4eac55=['167302Ralqsj','Invalid\x20appcode:\x20','object','801848UmGOqY','2683813eNUjQT','Switch\x20the\x20current\x20workspace\x20app\x20binding','\x20(appcode:\x20','App\x20locale\x20for\x20this\x20workspace\x20app\x20profile\x20(not\x20CLI\x20language;\x20reserved\x20for\x20later\x20app\x20use)','app','153knIFmH','30264dNGHzp','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','use','7095WocuAM','env','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','\x20--app\x20','trim','updated','defaultFormat','riskLevel','Missing\x20workspace\x20app\x20selector.','locale','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','.\x20Credentials:\x20not\x20written.','28CDdQOl','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','apiDir','isArray','project','89730jFCnKt','write','Use\x20`','join','workspace.','Initialize\x20the\x20current\x20workspace\x20app\x20binding','workspace','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','initialized','keys','4bifSwv','\x20--appcode\x20<code>`.','validation','format','flag','Workspace\x20','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile',').\x20Config:\x20','6mjNDoj','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','\x20workspace\x20use\x20--app\x20<name>`.','init','apps','pageSize','string','appcode','1543510nsVclN','str','number'];a215_0x4891=function(){return _0x4eac55;};return a215_0x4891();}import{normalizeStoredDefaultApp}from'../../config/schema.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a215_0x288320(0x186),SAFE_PROFILE_KEYS=[a215_0x288320(0x16a),a215_0x288320(0x17c),'apiDir',a215_0x288320(0x15d),a215_0x288320(0x168),a215_0x288320(0x182),'locale'],workspaceFlags=[{'name':a215_0x288320(0x176),'type':'string','description':a215_0x288320(0x17d)},{'name':a215_0x288320(0x16a),'type':'string','description':a215_0x288320(0x164)},{'name':a215_0x288320(0x17c),'type':a215_0x288320(0x169),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':a215_0x288320(0x18a),'type':a215_0x288320(0x169),'description':a215_0x288320(0x179)},{'name':a215_0x288320(0x181),'type':a215_0x288320(0x169),'description':a215_0x288320(0x160),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a215_0x288320(0x168),'type':a215_0x288320(0x16d),'description':a215_0x288320(0x194)},{'name':'riskLevel','type':'string','description':a215_0x288320(0x185),'enum':[...RISK_LEVEL_VALUES]},{'name':a215_0x288320(0x184),'type':a215_0x288320(0x169),'description':a215_0x288320(0x175)}];function isRecord(_0x4676b5){const _0x5a58fc=a215_0x288320;return!!_0x4676b5&&typeof _0x4676b5===_0x5a58fc(0x170)&&!Array[_0x5a58fc(0x18b)](_0x4676b5);}function assertValidAppcode(_0x538856){const _0xb2172c=a215_0x288320,{valid:_0x1fb11e,message:_0x4da2ac}=validateAppcode(_0x538856);if(!_0x1fb11e)throw CliErrors['validation'](_0xb2172c(0x16f)+_0x538856,_0x4da2ac);}function sanitizeProfile(_0x2d7f72){if(!isRecord(_0x2d7f72))return{};const _0xd76e8d={};for(const _0x323f16 of SAFE_PROFILE_KEYS){if(_0x2d7f72[_0x323f16]!==undefined)_0xd76e8d[_0x323f16]=_0x2d7f72[_0x323f16];}return _0xd76e8d;}function cloneProfile(_0x2e00e0){return isRecord(_0x2e00e0)?{..._0x2e00e0}:{};}function collectWorkspaceProfileOverrides(_0x53f2df){const _0x4ebbe9=a215_0x288320,_0xe54f27={},_0xb64272=_0x53f2df[_0x4ebbe9(0x16c)](_0x4ebbe9(0x17c)),_0x562cb0=_0x53f2df['str']('apiDir'),_0x544005=_0x53f2df[_0x4ebbe9(0x16c)]('defaultFormat'),_0x2f4daa=_0x53f2df[_0x4ebbe9(0x15e)](_0x4ebbe9(0x168)),_0x5a4eff=_0x53f2df[_0x4ebbe9(0x16c)]('riskLevel'),_0x55db3a=_0x53f2df['str'](_0x4ebbe9(0x184));if(_0xb64272)_0xe54f27[_0x4ebbe9(0x17c)]=_0xb64272;if(_0x562cb0)_0xe54f27[_0x4ebbe9(0x18a)]=_0x562cb0;if(_0x544005)_0xe54f27['format']=_0x544005;if(_0x2f4daa!==undefined&&_0x2f4daa!=='')_0xe54f27[_0x4ebbe9(0x168)]=Number(_0x2f4daa);if(_0x5a4eff)_0xe54f27['riskLevel']=_0x5a4eff;if(_0x55db3a)_0xe54f27['locale']=_0x55db3a;return _0xe54f27;}async function validateWorkspaceArgs(_0x224913){const _0x8919ea=a215_0x288320,_0x4c6c2b=_0x224913[_0x8919ea(0x16c)](_0x8919ea(0x176))[_0x8919ea(0x17f)](),_0xd24507=_0x224913[_0x8919ea(0x16c)]('appcode')[_0x8919ea(0x17f)]();if(!_0x4c6c2b&&!_0xd24507)throw CliErrors[_0x8919ea(0x15c)](_0x8919ea(0x183),_0x8919ea(0x18f)+CLI_BIN_NAME+_0x8919ea(0x189)+CLI_BIN_NAME+_0x8919ea(0x165));if(_0xd24507)assertValidAppcode(_0xd24507);}function resolveKnownApps(){const _0x5a0fd6=a215_0x288320,{config:_0x4287db,layers:_0x9906d1}=readRawConfigWithLayers(),_0x253ade=isRecord(_0x4287db[_0x5a0fd6(0x167)])?_0x4287db[_0x5a0fd6(0x167)]:{},_0x379939=isRecord(_0x9906d1['globalConfig']['apps'])?_0x9906d1['globalConfig'][_0x5a0fd6(0x167)]:{};return{..._0x379939,..._0x253ade};}function a215_0x4b12(_0x323dab,_0x28c5ce){_0x323dab=_0x323dab-0x159;const _0x48913b=a215_0x4891();let _0x4b12a6=_0x48913b[_0x323dab];return _0x4b12a6;}async function configureWorkspace(_0xe1c9c0,_0x59d726){const _0x3fd628=a215_0x288320,_0x18ffc7=_0xe1c9c0[_0x3fd628(0x16c)]('app')['trim'](),_0x4381c7=_0xe1c9c0['str'](_0x3fd628(0x16a))[_0x3fd628(0x17f)](),_0x10cbba=_0x18ffc7||_0x4381c7;if(!_0x10cbba)throw CliErrors[_0x3fd628(0x15c)](_0x3fd628(0x183),'Use\x20`'+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+_0x3fd628(0x165));if(_0x4381c7)assertValidAppcode(_0x4381c7);const _0x34327f=resolveWriteConfigPath(_0x3fd628(0x18c)),_0x25f861=readConfigFile(_0x34327f),_0x970495=resolveKnownApps(),_0x560557=isRecord(_0x25f861['apps'])?{..._0x25f861['apps']}:{},_0x31d6ca=cloneProfile(_0x560557[_0x10cbba]),_0x517ae1=sanitizeProfile(_0x970495[_0x10cbba]),_0x4972f2=_0x4381c7?{}:_0x517ae1,_0x5cd1c3=_0x4381c7||_0x4972f2[_0x3fd628(0x16a)];if(!_0x5cd1c3){const _0x3d4452=Object[_0x3fd628(0x159)](_0x970495),_0x378691=_0x3d4452['length']===0x0?_0x3fd628(0x18f)+CLI_BIN_NAME+'\x20workspace\x20'+_0x59d726+_0x3fd628(0x17e)+_0x10cbba+_0x3fd628(0x15b):_0x3fd628(0x163)+_0x3d4452[_0x3fd628(0x190)](',\x20');throw CliErrors[_0x3fd628(0x15c)]('App\x20\x22'+_0x10cbba+'\x22\x20not\x20found.',_0x378691);}assertValidAppcode(String(_0x5cd1c3));const _0x194c03={..._0x4972f2,..._0x31d6ca,'appcode':String(_0x5cd1c3),...collectWorkspaceProfileOverrides(_0xe1c9c0)};return _0x560557[_0x10cbba]=_0x194c03,_0x25f861[_0x3fd628(0x167)]=_0x560557,normalizeStoredDefaultApp(_0x25f861,_0x10cbba),delete _0x25f861[_0x3fd628(0x16a)],delete _0x25f861[_0x3fd628(0x176)],_0x194c03['env']&&(_0x25f861[_0x3fd628(0x17c)]=_0x194c03[_0x3fd628(0x17c)]),writeConfigFile(_0x34327f,_0x25f861),{'ok':!![],'message':_0x3fd628(0x15f)+(_0x59d726===_0x3fd628(0x166)?_0x3fd628(0x195):_0x3fd628(0x180))+':\x20'+_0x10cbba+_0x3fd628(0x174)+_0x194c03[_0x3fd628(0x16a)]+_0x3fd628(0x161)+_0x34327f+_0x3fd628(0x187),'data':{'operation':_0x3fd628(0x191)+_0x59d726,'configPath':_0x34327f,'app':_0x10cbba,'appcode':_0x194c03[_0x3fd628(0x16a)],'env':_0x194c03[_0x3fd628(0x17c)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':'workspace','command':a215_0x288320(0x166),'description':a215_0x288320(0x192),'risk':a215_0x288320(0x18e),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x1a4f8f=>configureWorkspace(_0x1a4f8f,a215_0x288320(0x166))},workspaceUseDefinition={'service':a215_0x288320(0x193),'command':'use','description':a215_0x288320(0x173),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x4ab3aa=>configureWorkspace(_0x4ab3aa,a215_0x288320(0x17a))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a216_0x51d80b=a216_0x5e65;(function(_0x2ed620,_0x308468){const _0x53db67=a216_0x5e65,_0x39cad4=_0x2ed620();while(!![]){try{const _0x42c570=-parseInt(_0x53db67(0xc3))/0x1+parseInt(_0x53db67(0xc6))/0x2+-parseInt(_0x53db67(0xcc))/0x3*(parseInt(_0x53db67(0xcf))/0x4)+-parseInt(_0x53db67(0xca))/0x5+parseInt(_0x53db67(0xcb))/0x6+-parseInt(_0x53db67(0xc5))/0x7*(-parseInt(_0x53db67(0xd0))/0x8)+parseInt(_0x53db67(0xc8))/0x9*(parseInt(_0x53db67(0xcd))/0xa);if(_0x42c570===_0x308468)break;else _0x39cad4['push'](_0x39cad4['shift']());}catch(_0x2c8aa5){_0x39cad4['push'](_0x39cad4['shift']());}}}(a216_0x2267,0x8dea9));function a216_0x2267(){const _0x32646e=['write','173092EbTIhw','40ZlPBNs','570396iMbRGE','name','788158lkyTHA','1359904ZGmcsV','workspace\x20remove','197199tCEAII','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','4778270nKzskZ','2642532UhHUlG','42JdJnLB','470WJKyEi'];a216_0x2267=function(){return _0x32646e;};return a216_0x2267();}function a216_0x5e65(_0x1a4589,_0x3c6beb){_0x1a4589=_0x1a4589-0xc3;const _0x22679b=a216_0x2267();let _0x5e657f=_0x22679b[_0x1a4589];return _0x5e657f;}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':'workspace','command':'remove','description':a216_0x51d80b(0xc9),'risk':a216_0x51d80b(0xce),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a216_0x51d80b(0xc4),'description':'App\x20profile\x20name\x20to\x20remove','required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x31091a=>validateAppName(_0x31091a,'workspace\x20remove'),'execute':_0x5ae980=>runAppRemove(_0x5ae980,a216_0x51d80b(0xc7))};
|