@lovrabet/rabetbase-cli 2.5.1-beta.6 → 2.5.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.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/deployment-sync.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.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/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/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 +1 -1
- package/skills/rabetbase.manifest.json +3 -3
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_0x1c4c4c=a202_0x4a30;(function(_0x4a75eb,_0x288354){const _0x531e78=a202_0x4a30,_0x89554e=_0x4a75eb();while(!![]){try{const _0x18ebbe=parseInt(_0x531e78(0x1c2))/0x1+-parseInt(_0x531e78(0x1a2))/0x2+-parseInt(_0x531e78(0x1ac))/0x3+-parseInt(_0x531e78(0x1b6))/0x4*(parseInt(_0x531e78(0x1a3))/0x5)+parseInt(_0x531e78(0x1a7))/0x6*(-parseInt(_0x531e78(0x1b7))/0x7)+-parseInt(_0x531e78(0x1b1))/0x8+parseInt(_0x531e78(0x1aa))/0x9;if(_0x18ebbe===_0x288354)break;else _0x89554e['push'](_0x89554e['shift']());}catch(_0x5eb92b){_0x89554e['push'](_0x89554e['shift']());}}}(a202_0x5cfb,0xf087b));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';function a202_0x5cfb(){const _0xd722d=['lastSync','5688246mBMNWF','Force\x20overwrite\x20local\x20unsynced\x20changes','mybatisXml','\x20skipped,\x20','sqlName','6652472KosaQi','str','filter','length','sqlRootDir','4lHZdml','4081581xchLCW','message','local\x20differs\x20from\x20remote','sqlContent','read','path','No\x20remote\x20SQL\x20queries\x20matched.','description','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqls','utf8','89860EZFQSv','pull','conflict','sql','cancelled','toISOString','lockFilePath','push','test','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','\x20written,\x20','trimStart','name','dbId','bool','split','string','appCode','sqlcode','force','tableData','unchanged','Pull\x20complete:\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlCode','skipped','2429808vZdnNx','4278385wagrzd','nonInteractive','sqlRoot','\x20failed','6oouTBr','catch','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','56489904aZCqPu'];a202_0x5cfb=function(){return _0xd722d;};return a202_0x5cfb();}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';function a202_0x4a30(_0x62bd70,_0x4b02c1){_0x62bd70=_0x62bd70-0x19e;const _0x5cfbca=a202_0x5cfb();let _0x4a3006=_0x5cfbca[_0x62bd70];return _0x4a3006;}import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x4fc609,_0x2a137b){const _0xafb996=a202_0x4a30,_0x3a6395=[];let _0x4aa6cf=0x1;while(!![]){const _0x4408e1=await listSqlQueries(_0x4fc609,{'currentPage':_0x4aa6cf,'pageSize':PAGE_SIZE,'sqlCode':_0x2a137b[_0xafb996(0x1a0)],'sqlName':_0x2a137b[_0xafb996(0x1b0)]}),_0x3ee1f3=_0x4408e1[_0xafb996(0x1d6)]??[];_0x3a6395[_0xafb996(0x1c9)](..._0x3ee1f3);if(_0x3ee1f3['length']===0x0)break;const _0x2e1848=_0x4408e1['paging']?.['totalCount'];if(_0x2e1848!=null?_0x3a6395[_0xafb996(0x1b4)]>=_0x2e1848:_0x3ee1f3['length']<PAGE_SIZE)break;_0x4aa6cf++;}return _0x3a6395;}async function ensureSqlContent(_0x3901f0){const _0x575459=a202_0x4a30;if(_0x3901f0[_0x575459(0x1ba)]!=null&&String(_0x3901f0[_0x575459(0x1ba)])[_0x575459(0x1b4)]>0x0)return _0x3901f0;return getSqlQueryDetail(_0x3901f0[_0x575459(0x1a0)]);}export const sqlPull={'service':a202_0x1c4c4c(0x1c5),'command':a202_0x1c4c4c(0x1c3),'description':a202_0x1c4c4c(0x1cb),'risk':a202_0x1c4c4c(0x1bb),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a202_0x1c4c4c(0x1ce),'type':a202_0x1c4c4c(0x1d2),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a202_0x1c4c4c(0x1d5),'type':'boolean','description':a202_0x1c4c4c(0x1ad)}],async 'dryRun'(_0x4c602f){const _0x5f0bcc=a202_0x1c4c4c,_0x4b6d7f=loadSqlProjectConfig(_0x4c602f[_0x5f0bcc(0x1d3)]),_0x5f0d49=await readSqlLockFile(_0x4b6d7f['lockFilePath']),{appLock:_0x52cf8b}=ensureSqlLockScope(_0x5f0d49??createEmptySqlLock(),_0x4b6d7f[_0x5f0bcc(0x1d3)],_0x4b6d7f[_0x5f0bcc(0x1a5)],_0x5f0bcc(0x1c3)),_0x5d01e0=await fetchAllSqlQueries(_0x4c602f[_0x5f0bcc(0x1d3)],{'sqlCode':_0x4c602f[_0x5f0bcc(0x1b2)](_0x5f0bcc(0x1d4))||undefined,'sqlName':_0x4c602f['str']('name')||undefined}),_0x5c7ba7=[];for(const _0x256aa8 of _0x5d01e0){const _0x52e0ea=await ensureSqlContent(_0x256aa8),_0x1fc1c7=ensureRemoteSqlContent(_0x52e0ea),_0x166905=detectModeFromSql(_0x52e0ea),_0x5b0d02=_0x52e0ea[_0x5f0bcc(0x1cf)]?await getDbName(_0x4c602f[_0x5f0bcc(0x1d3)],Number(_0x52e0ea['dbId']))[_0x5f0bcc(0x1a8)](()=>undefined):undefined,_0x9fc948=buildLocalSqlFileContent({'sqlCode':_0x52e0ea[_0x5f0bcc(0x1a0)],'sqlName':_0x52e0ea[_0x5f0bcc(0x1b0)],'dbId':_0x52e0ea[_0x5f0bcc(0x1cf)]},_0x1fc1c7,{'dbName':_0x5b0d02,'mode':_0x166905,'syncedAt':new Date()[_0x5f0bcc(0x1c7)](),'description':_0x52e0ea[_0x5f0bcc(0x1be)]}),_0x21f446=buildSqlLockEntry(_0x52e0ea,_0x1fc1c7,'',{'dbName':_0x5b0d02}),_0x1803a0=resolveLocalSqlFilePath(_0x4b6d7f,_0x52e0ea['sqlCode'],_0x21f446);let _0x565c53='would_pull',_0x55fec8;if(await fileExists(_0x1803a0)){const _0x2f9d5b=await readFile(_0x1803a0,_0x5f0bcc(0x1c1));isEquivalentPulledSqlFile(_0x2f9d5b,_0x9fc948,_0x166905)?(_0x565c53=_0x5f0bcc(0x1a1),_0x55fec8='unchanged'):(_0x565c53=_0x5f0bcc(0x1c4),_0x55fec8=_0x5f0bcc(0x1a9));}_0x5c7ba7[_0x5f0bcc(0x1c9)]({'sqlCode':_0x52e0ea[_0x5f0bcc(0x1a0)],'sqlName':_0x52e0ea[_0x5f0bcc(0x1b0)],'filePath':_0x1803a0,'status':_0x565c53,'reason':_0x55fec8});}return{'method':'POST','url':_0x5f0bcc(0x19f),'body':{'appCode':_0x4c602f['appCode'],'sqlCode':_0x4c602f[_0x5f0bcc(0x1b2)](_0x5f0bcc(0x1d4))||null,'sqlName':_0x4c602f[_0x5f0bcc(0x1b2)](_0x5f0bcc(0x1ce))||null,'files':_0x5c7ba7},'description':'Would\x20pull\x20'+_0x5c7ba7[_0x5f0bcc(0x1b4)]+'\x20SQL\x20file(s)\x20into\x20'+_0x4b6d7f['sqlRootDir']};},async 'execute'(_0x44a4e0){const _0x548588=a202_0x1c4c4c,_0x5c5793=loadSqlProjectConfig(_0x44a4e0[_0x548588(0x1d3)]),_0x433fc6=await readSqlLockFile(_0x5c5793[_0x548588(0x1c8)]),{lockData:_0x175ce0,appLock:_0x43fdeb}=ensureSqlLockScope(_0x433fc6??createEmptySqlLock(),_0x5c5793[_0x548588(0x1d3)],_0x5c5793[_0x548588(0x1a5)],_0x548588(0x1c3)),_0x2f4828=_0x44a4e0[_0x548588(0x1d0)](_0x548588(0x1d5)),_0x264577=await fetchAllSqlQueries(_0x44a4e0[_0x548588(0x1d3)],{'sqlCode':_0x44a4e0[_0x548588(0x1b2)](_0x548588(0x1d4))||undefined,'sqlName':_0x44a4e0[_0x548588(0x1b2)](_0x548588(0x1ce))||undefined});if(_0x264577[_0x548588(0x1b4)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x548588(0x1bd)};const _0x3453d5=[],_0xa4db7e=[];for(const _0x5e5adb of _0x264577){try{_0x3453d5[_0x548588(0x1c9)](await ensureSqlContent(_0x5e5adb));}catch(_0x7fb597){_0xa4db7e[_0x548588(0x1c9)]({'sqlCode':_0x5e5adb[_0x548588(0x1a0)],'error':_0x7fb597 instanceof Error?_0x7fb597[_0x548588(0x1b8)]:String(_0x7fb597)});}}if(_0x2f4828&&!_0x44a4e0[_0x548588(0x1a4)]){let _0x4e147d=![];for(const _0x24d75a of _0x3453d5){const _0x53f73b=detectModeFromSql(_0x24d75a),_0x314563=_0x24d75a['dbId']?await getDbName(_0x44a4e0[_0x548588(0x1d3)],Number(_0x24d75a[_0x548588(0x1cf)]))['catch'](()=>undefined):undefined,_0x1f915d=buildLocalSqlFileContent({'sqlCode':_0x24d75a[_0x548588(0x1a0)],'sqlName':_0x24d75a[_0x548588(0x1b0)],'dbId':_0x24d75a[_0x548588(0x1cf)]},ensureRemoteSqlContent(_0x24d75a),{'dbName':_0x314563,'mode':_0x53f73b,'syncedAt':new Date()[_0x548588(0x1c7)](),'description':_0x24d75a['description']}),_0x567747=resolveLocalSqlFilePath(_0x5c5793,_0x24d75a[_0x548588(0x1a0)],buildSqlLockEntry(_0x24d75a,ensureRemoteSqlContent(_0x24d75a),'',{'dbName':_0x314563}));if(await fileExists(_0x567747)){const _0x534e81=await readFile(_0x567747,_0x548588(0x1c1));if(!isEquivalentPulledSqlFile(_0x534e81,_0x1f915d,_0x53f73b)){_0x4e147d=!![];break;}}}if(_0x4e147d){const _0x50a4a3=await confirmForceOverwrite(_0x548588(0x1bf));if(!_0x50a4a3)throw CliErrors[_0x548588(0x1c6)]('Force\x20pull\x20cancelled.');}}const _0x4f9434=cloneSqlLockData(_0x175ce0),_0x477baf=_0x4f9434['apps'][_0x5c5793[_0x548588(0x1d3)]],_0x516152=[],_0x25120f=[];for(const _0x477b13 of _0x3453d5){const _0x28143b=_0x477baf['sqls'][_0x477b13[_0x548588(0x1a0)]],_0x499d2c=ensureRemoteSqlContent(_0x477b13),_0x1aacea=detectModeFromSql(_0x477b13),_0x159018=_0x477b13[_0x548588(0x1cf)]?await getDbName(_0x44a4e0[_0x548588(0x1d3)],Number(_0x477b13['dbId']))[_0x548588(0x1a8)](()=>undefined):undefined,_0x51d2ac=buildLocalSqlFileContent({'sqlCode':_0x477b13[_0x548588(0x1a0)],'sqlName':_0x477b13['sqlName'],'dbId':_0x477b13[_0x548588(0x1cf)]},_0x499d2c,{'dbName':_0x159018,'mode':_0x1aacea,'syncedAt':new Date()['toISOString'](),'description':_0x477b13[_0x548588(0x1be)]}),_0x29fda6=buildSqlLockEntry(_0x477b13,_0x499d2c,computeSqlContentHash(_0x51d2ac),{'dbName':_0x159018}),_0x1d4d6a=_0x29fda6[_0x548588(0x1bc)],_0x192320=join(_0x5c5793[_0x548588(0x1b5)],_0x1d4d6a);try{if(await fileExists(_0x192320)){const _0x4f5b9e=await readFile(_0x192320,'utf8');if(isEquivalentPulledSqlFile(_0x4f5b9e,_0x51d2ac,_0x1aacea)){_0x25120f[_0x548588(0x1c9)]({'sqlCode':_0x477b13[_0x548588(0x1a0)],'reason':_0x548588(0x1d7)}),_0x477baf[_0x548588(0x1c0)][_0x477b13[_0x548588(0x1a0)]]={..._0x29fda6,'hash':computeSqlContentHash(_0x4f5b9e),'path':_0x1d4d6a};continue;}if(!_0x2f4828){_0x25120f[_0x548588(0x1c9)]({'sqlCode':_0x477b13['sqlCode'],'reason':_0x548588(0x1b9)});continue;}}const _0x4159ea=_0x28143b?.[_0x548588(0x1bc)]?join(_0x5c5793[_0x548588(0x1b5)],_0x28143b[_0x548588(0x1bc)]):undefined;_0x4159ea&&_0x4159ea!==_0x192320&&await fileExists(_0x4159ea)&&await rm(_0x4159ea,{'force':!![]}),await ensureParentDirectory(_0x192320),await writeFile(_0x192320,_0x51d2ac,'utf8'),_0x477baf['sqls'][_0x477b13['sqlCode']]={..._0x29fda6,'path':_0x1d4d6a},_0x516152[_0x548588(0x1c9)]({'sqlCode':_0x477b13['sqlCode'],'filePath':_0x192320});}catch(_0xd59278){_0xa4db7e[_0x548588(0x1c9)]({'sqlCode':_0x477b13[_0x548588(0x1a0)],'error':_0xd59278 instanceof Error?_0xd59278[_0x548588(0x1b8)]:String(_0xd59278)});}}return _0x477baf[_0x548588(0x1ab)]=new Date()[_0x548588(0x1c7)](),await writeSqlLockFile(_0x5c5793['lockFilePath'],_0x4f9434),{'ok':_0xa4db7e[_0x548588(0x1b4)]===0x0,'data':{'pulled':_0x516152,'skipped':_0x25120f,'failed':_0xa4db7e},'message':_0x548588(0x19e)+_0x516152[_0x548588(0x1b4)]+_0x548588(0x1cc)+_0x25120f[_0x548588(0x1b4)]+_0x548588(0x1af)+_0xa4db7e[_0x548588(0x1b4)]+_0x548588(0x1a6)};}};function detectModeFromSql(_0x44a1fc){const _0x441680=a202_0x1c4c4c,_0x58add7=ensureRemoteSqlContent(_0x44a1fc),_0x2137d9=stripLocalSqlMetadata(_0x58add7,_0x441680(0x1ae))[_0x441680(0x1cd)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x2137d9))return _0x441680(0x1ae);return _0x441680(0x1c5);}function isEquivalentPulledSqlFile(_0x27c4c6,_0x169310,_0x4e866b){return normalizePullComparableContent(_0x27c4c6,_0x4e866b)===normalizePullComparableContent(_0x169310,_0x4e866b);}function normalizePullComparableContent(_0x507932,_0x532406){const _0xcb3ab7=a202_0x1c4c4c,_0x3765e8=_0x507932['replace'](/\r\n/g,'\x0a')[_0xcb3ab7(0x1d1)]('\x0a'),_0x1f22cd=_0x3765e8[_0xcb3ab7(0x1b3)](_0x556b04=>!isSyncedAtMetadataLine(_0x556b04,_0x532406));return _0x1f22cd['join']('\x0a');}function isSyncedAtMetadataLine(_0x961b81,_0x2a89ec){const _0x3709be=a202_0x1c4c4c;if(_0x2a89ec===_0x3709be(0x1ae))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3709be(0x1ca)](_0x961b81);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x961b81);}
|
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_0x10b9c8=a203_0x4e56;(function(_0x4d7000,_0x1e6807){const _0x3866c6=a203_0x4e56,_0xc25d49=_0x4d7000();while(!![]){try{const _0x20bb3e=-parseInt(_0x3866c6(0x18e))/0x1*(parseInt(_0x3866c6(0x175))/0x2)+parseInt(_0x3866c6(0x14d))/0x3*(parseInt(_0x3866c6(0x17d))/0x4)+-parseInt(_0x3866c6(0x18a))/0x5*(parseInt(_0x3866c6(0x15d))/0x6)+parseInt(_0x3866c6(0x17f))/0x7*(parseInt(_0x3866c6(0x170))/0x8)+parseInt(_0x3866c6(0x176))/0x9+parseInt(_0x3866c6(0x189))/0xa+-parseInt(_0x3866c6(0x16e))/0xb;if(_0x20bb3e===_0x1e6807)break;else _0xc25d49['push'](_0xc25d49['shift']());}catch(_0x5eed9e){_0xc25d49['push'](_0xc25d49['shift']());}}}(a203_0x2049,0x9b5ba));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';import{automaticDeploymentSyncSucceeded,buildAutomaticDeploymentSyncPreview,runAutomaticDeploymentSync,validateAutomaticDeploymentSync}from'../../commands/deployment/auto-sync.js';function a203_0x2049(){const _0x55acf9=['sqlcode','status','write','configured','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlRoot','dbId','dbName','utf8','remoteId','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','unchanged','9276egcdJr','join','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','catch','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqls','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','exec','sqlConfig','entries','push','sqlCode','length','version','lockFilePath','filePath','Local\x20directory\x20\x22','16116628xenZDi','sql','2446648VllAPS','map','Push\x20complete:\x20','has','sqlName','2EBeNZm','11420802OzsnXk','startsWith','\x20pushed,\x20','str','path','relativePath','force','49092GtVwRO','POST','7DcqEkz','hash','mode','message','appCode','bool','set','get','sqlRootDir','trashDir','2851120nagrhl','1385smhqId','/smartapi/custom/updateUserCustomSql','Would\x20push\x20','validation','385663AIufdC','Local\x20SQL\x20not\x20found:\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','toISOString','\x20failed','258uzodSg','replace','\x20SQL\x20file(s)','No\x20local\x20SQL\x20files\x20found.'];a203_0x2049=function(){return _0x55acf9;};return a203_0x2049();}async function getTargetSqlQueries(_0xbcbeb4,_0x2eaaae,_0x20bee3){const _0x144248=a203_0x4e56,_0x3c243e=await scanLocalSqlQueries(_0xbcbeb4),_0x55dd8d=new Map();for(const _0x8070e8 of _0x3c243e){if(_0x20bee3&&_0x8070e8['sqlCode']!==_0x20bee3)continue;const _0x4ad9fa=_0x55dd8d[_0x144248(0x186)](_0x8070e8[_0x144248(0x168)])??[];_0x4ad9fa[_0x144248(0x167)](_0x8070e8),_0x55dd8d[_0x144248(0x185)](_0x8070e8[_0x144248(0x168)],_0x4ad9fa);}if(_0x20bee3&&!_0x55dd8d[_0x144248(0x173)](_0x20bee3))throw CliErrors[_0x144248(0x18d)](_0x144248(0x149)+_0x20bee3);const _0x1a7479=[];for(const [_0x58c3f9,_0x2b855]of _0x55dd8d[_0x144248(0x166)]()){if(_0x2b855[_0x144248(0x169)]===0x1){_0x1a7479[_0x144248(0x167)](_0x2b855[0x0]);continue;}const _0x2497b6=_0x2eaaae[_0x144248(0x162)][_0x58c3f9],_0xb8c5c1=_0x2497b6?.[_0x144248(0x17a)],_0x17522a=_0xb8c5c1?_0x2b855['filter'](_0x47e53c=>_0x47e53c[_0x144248(0x17b)]!==_0xb8c5c1):_0x2b855;if(_0x2497b6&&_0x17522a[_0x144248(0x169)]===0x1){_0x1a7479[_0x144248(0x167)](_0x17522a[0x0]);continue;}throw CliErrors[_0x144248(0x18d)](_0x144248(0x15f)+_0x58c3f9+_0x144248(0x15b));}return _0x1a7479;}export const sqlPush={'service':a203_0x10b9c8(0x16f),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a203_0x10b9c8(0x153),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a203_0x10b9c8(0x17c),'type':'boolean','description':a203_0x10b9c8(0x155)}],async 'validate'(_0x451ba9){validateAutomaticDeploymentSync(_0x451ba9);},async 'dryRun'(_0x5ed96d){const _0x420ea9=a203_0x10b9c8,_0x594e34=loadSqlProjectConfig(_0x5ed96d[_0x420ea9(0x183)]),_0x562e9e=await readSqlLockFile(_0x594e34[_0x420ea9(0x16b)]),{appLock:_0x2631be}=ensureSqlLockScope(_0x562e9e??createEmptySqlLock(),_0x5ed96d[_0x420ea9(0x183)],_0x594e34[_0x420ea9(0x156)],_0x420ea9(0x167)),_0x3bae36=await getTargetSqlQueries(_0x594e34,_0x2631be,_0x5ed96d[_0x420ea9(0x179)](_0x420ea9(0x151))||undefined),_0x26b96d=[];for(const _0x8f417 of _0x3bae36){const _0x41118c=await computeSqlFileHash(_0x8f417['filePath']),_0xaa28f4=_0x2631be['sqls'][_0x8f417[_0x420ea9(0x168)]],_0x1e1d78=!!_0xaa28f4&&(_0xaa28f4[_0x420ea9(0x17a)]!==_0x8f417[_0x420ea9(0x17b)]||!!_0x8f417[_0x420ea9(0x174)]&&_0xaa28f4[_0x420ea9(0x174)]!==_0x8f417[_0x420ea9(0x174)]);if(!_0x5ed96d[_0x420ea9(0x184)](_0x420ea9(0x17c))&&_0xaa28f4&&_0xaa28f4[_0x420ea9(0x180)]===_0x41118c&&!_0x1e1d78)continue;_0x26b96d[_0x420ea9(0x167)](_0x8f417['sqlCode']);}return{'method':_0x420ea9(0x17e),'url':_0x420ea9(0x18b),'deploymentSync':buildAutomaticDeploymentSyncPreview(_0x5ed96d,_0x420ea9(0x16f),_0x26b96d),'body':{'sqlCodes':_0x26b96d,'appCode':_0x5ed96d['appCode']},'description':_0x420ea9(0x18c)+_0x26b96d[_0x420ea9(0x169)]+_0x420ea9(0x14f)};},async 'execute'(_0x2d7727){const _0x52ea46=a203_0x10b9c8,_0x1e09bb=loadSqlProjectConfig(_0x2d7727[_0x52ea46(0x183)]),_0x12a79e=await readSqlLockFile(_0x1e09bb[_0x52ea46(0x16b)]),{lockData:_0x59b20f,appLock:_0x1c98d9}=ensureSqlLockScope(_0x12a79e??createEmptySqlLock(),_0x2d7727[_0x52ea46(0x183)],_0x1e09bb[_0x52ea46(0x156)],_0x52ea46(0x167)),_0xf1ad91=await getTargetSqlQueries(_0x1e09bb,_0x1c98d9,_0x2d7727[_0x52ea46(0x179)]('sqlcode')||undefined);if(_0xf1ad91[_0x52ea46(0x169)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x52ea46(0x150)};const _0x4f6125=[],_0x556780=[],_0x400faf=[];for(const _0x4b4b6c of _0xf1ad91){const _0x2d64f8=_0x1c98d9[_0x52ea46(0x162)][_0x4b4b6c[_0x52ea46(0x168)]];if(!_0x2d64f8){_0x400faf[_0x52ea46(0x167)]({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x3c4ef6=await computeSqlFileHash(_0x4b4b6c['filePath']),_0x4f7591=_0x2d64f8[_0x52ea46(0x17a)]!==_0x4b4b6c['relativePath']||!!_0x4b4b6c[_0x52ea46(0x174)]&&_0x2d64f8[_0x52ea46(0x174)]!==_0x4b4b6c[_0x52ea46(0x174)];if(!_0x2d7727[_0x52ea46(0x184)]('force')&&_0x2d64f8['hash']===_0x3c4ef6&&!_0x4f7591){_0x556780[_0x52ea46(0x167)]({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'reason':_0x52ea46(0x15c)});continue;}if(_0x2d64f8[_0x52ea46(0x16a)]==null){_0x400faf[_0x52ea46(0x167)]({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'error':_0x52ea46(0x161)});continue;}const _0x26e8c8=await readFile(_0x4b4b6c[_0x52ea46(0x16c)],_0x52ea46(0x159)),_0x26b14e=stripLocalSqlMetadata(_0x26e8c8,_0x4b4b6c[_0x52ea46(0x181)]),_0x53ea2c=_0x4b4b6c['sqlName']||_0x2d64f8[_0x52ea46(0x174)],_0x2722c0=await resolveTargetDbBinding(_0x2d7727[_0x52ea46(0x183)],_0x4b4b6c,_0x2d64f8),_0x59e4c1=await updateSqlQuery({'id':_0x2d64f8[_0x52ea46(0x15a)],'appCode':_0x2d7727[_0x52ea46(0x183)],'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'sqlName':_0x53ea2c,'dbId':_0x2722c0['dbId'],'version':_0x2d64f8[_0x52ea46(0x16a)],'sqlContent':_0x26b14e,'sqlConfig':_0x2d64f8[_0x52ea46(0x165)]??undefined}),_0x287d36=_0x59e4c1[_0x52ea46(0x157)]?await getDbName(_0x2d7727[_0x52ea46(0x183)],Number(_0x59e4c1[_0x52ea46(0x157)]))[_0x52ea46(0x160)](()=>_0x2722c0[_0x52ea46(0x158)]):_0x2722c0['dbName'];_0x1c98d9[_0x52ea46(0x162)][_0x4b4b6c[_0x52ea46(0x168)]]={...buildSqlLockEntry(_0x59e4c1,_0x26b14e,_0x3c4ef6,{'dbName':_0x287d36}),'path':_0x4b4b6c[_0x52ea46(0x17b)],'mode':_0x2d64f8['mode']},await archivePreviousSqlFileIfNeeded(_0x1e09bb,_0x2d64f8[_0x52ea46(0x17a)],_0x4b4b6c[_0x52ea46(0x17b)]),_0x4f6125['push']({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'remoteId':_0x2d64f8[_0x52ea46(0x15a)]});}catch(_0xdf69a6){_0x400faf[_0x52ea46(0x167)]({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'error':_0xdf69a6 instanceof Error?_0xdf69a6[_0x52ea46(0x182)]:String(_0xdf69a6)});}}_0x1c98d9['lastSync']=new Date()[_0x52ea46(0x14b)](),await writeSqlLockFile(_0x1e09bb[_0x52ea46(0x16b)],_0x59b20f);const _0x360fa7=_0x400faf['length']===0x0,_0x370131=await runAutomaticDeploymentSync(_0x2d7727,_0x52ea46(0x16f),_0x4f6125[_0x52ea46(0x171)](_0x321517=>_0x321517[_0x52ea46(0x168)]),_0x360fa7),_0x536375=_0x360fa7&&automaticDeploymentSyncSucceeded(_0x370131),_0x52cb97=_0x370131[_0x52ea46(0x154)]?',\x20deployment\x20sync\x20'+_0x370131[_0x52ea46(0x152)]:'';return{'ok':_0x536375,'data':{'pushed':_0x4f6125,'skipped':_0x556780,'failed':_0x400faf,'deploymentSync':_0x370131},'message':_0x52ea46(0x172)+_0x4f6125[_0x52ea46(0x169)]+_0x52ea46(0x178)+_0x556780[_0x52ea46(0x169)]+'\x20skipped,\x20'+_0x400faf[_0x52ea46(0x169)]+_0x52ea46(0x14c)+_0x52cb97};}};async function archivePreviousSqlFileIfNeeded(_0x4df483,_0xe4bacc,_0x418367){const _0x105c2c=a203_0x10b9c8;if(!_0xe4bacc||_0xe4bacc===_0x418367)return;const _0xbe76a3=join(_0x4df483[_0x105c2c(0x187)],_0xe4bacc);if(!await fileExists(_0xbe76a3))return;const _0x17a98c=await moveToTrash(_0x4df483['projectRoot'],_0x4df483[_0x105c2c(0x188)],_0xbe76a3);await cleanupEmptyDirectories(dirname(_0xbe76a3),_0x4df483[_0x105c2c(0x187)]),void _0x17a98c;}async function moveToTrash(_0x5b47e9,_0x217af3,_0x64a6ef){const _0x3ce3b4=a203_0x10b9c8,_0x9d6dcf=new Date()['toISOString']()[_0x3ce3b4(0x14e)](/[:.]/g,'-'),_0x3a1d56=relative(_0x5b47e9,_0x64a6ef),_0x154b59=join(_0x217af3,_0x9d6dcf,_0x3a1d56);return await mkdir(dirname(_0x154b59),{'recursive':!![]}),await rename(_0x64a6ef,_0x154b59),_0x154b59;}async function cleanupEmptyDirectories(_0x355b65,_0x1ffc9e){const _0x4ad28f=a203_0x10b9c8;let _0x162007=resolve(_0x355b65);const _0x218ee2=resolve(_0x1ffc9e);while(_0x162007[_0x4ad28f(0x177)](''+_0x218ee2+sep)||_0x162007===_0x218ee2){if(_0x162007===_0x218ee2)return;try{const _0x13cb6b=await readdir(_0x162007);if(_0x13cb6b[_0x4ad28f(0x169)]>0x0)return;await rmdir(_0x162007);}catch{return;}_0x162007=dirname(_0x162007);}}async function resolveTargetDbBinding(_0x3eab29,_0x52a262,_0x4a6365){const _0x3fa689=a203_0x10b9c8,_0x2a60c6=_0x52a262['dbDirectory'];if(!_0x2a60c6)return{'dbId':_0x4a6365[_0x3fa689(0x157)],'dbName':_0x4a6365[_0x3fa689(0x158)]};const _0x8c7268=buildDbDirectoryName(_0x4a6365[_0x3fa689(0x158)],_0x4a6365['dbId']);if(_0x2a60c6===_0x8c7268)return{'dbId':_0x4a6365[_0x3fa689(0x157)],'dbName':_0x4a6365[_0x3fa689(0x158)]};const _0x133969=parseExplicitDbDirectory(_0x2a60c6);if(_0x133969!=null)return{'dbId':_0x133969,'dbName':await getDbName(_0x3eab29,_0x133969)[_0x3fa689(0x160)](()=>undefined)};const _0x42fa4a=await listDatabases(_0x3eab29),_0x35a763=_0x42fa4a['filter'](_0x33cfec=>buildDbDirectoryName(_0x33cfec[_0x3fa689(0x158)],_0x33cfec[_0x3fa689(0x157)])===_0x2a60c6);if(_0x35a763['length']===0x1)return{'dbId':_0x35a763[0x0]['dbId'],'dbName':_0x35a763[0x0][_0x3fa689(0x158)]};if(_0x35a763[_0x3fa689(0x169)]===0x0)throw CliErrors[_0x3fa689(0x18d)](_0x3fa689(0x14a)+_0x2a60c6+'\x22\x20for\x20sqlCode\x20'+_0x52a262['sqlCode']+'.');const _0x5bd2fb=_0x35a763[_0x3fa689(0x171)](_0x46cfdd=>_0x46cfdd[_0x3fa689(0x158)]+'\x20('+_0x46cfdd[_0x3fa689(0x157)]+')')[_0x3fa689(0x15e)](',\x20');throw CliErrors[_0x3fa689(0x18d)](_0x3fa689(0x16d)+_0x2a60c6+_0x3fa689(0x163)+_0x52a262[_0x3fa689(0x168)]+':\x20'+_0x5bd2fb);}function a203_0x4e56(_0x422cc9,_0x48d923){_0x422cc9=_0x422cc9-0x149;const _0x20490=a203_0x2049();let _0x4e5665=_0x20490[_0x422cc9];return _0x4e5665;}function parseExplicitDbDirectory(_0xbedeb3){const _0x82ce47=a203_0x10b9c8,_0x37d0b7=/^db-(\d+)$/[_0x82ce47(0x164)](_0xbedeb3);if(!_0x37d0b7)return null;const _0x14d528=Number(_0x37d0b7[0x1]);return Number['isFinite'](_0x14d528)&&_0x14d528>0x0?_0x14d528:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a204_0x1c7b71=a204_0x514f;(function(_0x234913,_0x1ca8f6){const _0x36065a=a204_0x514f,_0x4341f1=_0x234913();while(!![]){try{const _0x264a75=parseInt(_0x36065a(0x1fe))/0x1+-parseInt(_0x36065a(0x20c))/0x2*(parseInt(_0x36065a(0x206))/0x3)+-parseInt(_0x36065a(0x1fb))/0x4*(parseInt(_0x36065a(0x20d))/0x5)+-parseInt(_0x36065a(0x1ec))/0x6+-parseInt(_0x36065a(0x200))/0x7+parseInt(_0x36065a(0x202))/0x8+-parseInt(_0x36065a(0x1e6))/0x9*(-parseInt(_0x36065a(0x1fd))/0xa);if(_0x264a75===_0x1ca8f6)break;else _0x4341f1['push'](_0x4341f1['shift']());}catch(_0x425296){_0x4341f1['push'](_0x4341f1['shift']());}}}(a204_0x30ab,0xcc0a1));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=a204_0x1c7b71(0x1eb);export function buildSqlLockEntry(_0x4e0fdd,_0xb6532f,_0x17b7bb,_0x56a801){const _0x1bf138=a204_0x1c7b71,_0x7c7aec=detectSqlMode(_0xb6532f);return{'path':buildSqlRelativePath(_0x4e0fdd[_0x1bf138(0x1e4)],_0x4e0fdd[_0x1bf138(0x1f7)],_0x56a801?.[_0x1bf138(0x1f2)],_0x7c7aec,_0x4e0fdd[_0x1bf138(0x1f4)]),'hash':_0x17b7bb,'remoteId':_0x4e0fdd['id'],'version':_0x4e0fdd['version'],'dbId':Number(_0x4e0fdd[_0x1bf138(0x1f4)]),'dbName':_0x56a801?.['dbName'],'sqlName':_0x4e0fdd[_0x1bf138(0x1f7)],'sqlConfig':_0x4e0fdd[_0x1bf138(0x1f9)]??undefined,'mode':_0x7c7aec};}export function cloneSqlLockData(_0x345b2f){const _0x79fcb9=a204_0x1c7b71;return{'apps':Object[_0x79fcb9(0x1f1)](Object[_0x79fcb9(0x203)](_0x345b2f['apps'])[_0x79fcb9(0x1f0)](([_0x2240d0,_0x4a8196])=>[_0x2240d0,{'sqlRoot':_0x4a8196[_0x79fcb9(0x208)],'lastSync':_0x4a8196[_0x79fcb9(0x209)],'sqls':{..._0x4a8196[_0x79fcb9(0x1e8)]}}]))};}export function ensureRemoteSqlContent(_0x4bf239){return _0x4bf239['sqlContent']??'';}export function buildLocalSqlFileContent(_0x4b5657,_0x559ecc,_0x3a1eb7){const _0x11a791=a204_0x1c7b71,_0x503282=_0x3a1eb7?.[_0x11a791(0x201)]??detectSqlMode(_0x559ecc),_0xf08d93=stripLocalSqlMetadata(_0x559ecc,_0x503282)['trim'](),_0x29bd30=[...buildMetadataHeaderLines({'sqlCode':_0x4b5657['sqlCode'],'sqlName':_0x4b5657['sqlName'],'dbId':_0x4b5657['dbId'],'dbName':_0x3a1eb7?.[_0x11a791(0x1f2)],'mode':_0x503282,'syncedAt':_0x3a1eb7?.[_0x11a791(0x1f6)],'description':_0x3a1eb7?.[_0x11a791(0x207)]},_0x503282),'',_0xf08d93],_0x5a78da=_0x29bd30[_0x11a791(0x1ea)]('\x0a');return _0x5a78da['endsWith']('\x0a')?_0x5a78da:_0x5a78da+'\x0a';}export function stripLocalSqlMetadata(_0x2224a9,_0x5c2085){const _0x5a5869=a204_0x1c7b71,_0x2d3074=_0x2224a9[_0x5a5869(0x1e3)](/\r\n/g,'\x0a')[_0x5a5869(0x204)]('\x0a'),_0x4d0f86=[];let _0x36ad90=0x0;if(_0x5c2085==='mybatisXml')while(_0x36ad90<_0x2d3074['length']){const _0x1beab8=_0x2d3074[_0x36ad90]??'';if(/^\s*<!--\s*@lovrabet\./[_0x5a5869(0x1f3)](_0x1beab8)){_0x36ad90++;continue;}if(_0x1beab8[_0x5a5869(0x1f8)]()===''&&_0x36ad90>0x0){_0x36ad90++;continue;}break;}else while(_0x36ad90<_0x2d3074[_0x5a5869(0x1e5)]){const _0x5df7ec=_0x2d3074[_0x36ad90]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x5df7ec)){_0x36ad90++;continue;}if(_0x5df7ec['trim']()===''&&_0x36ad90>0x0){_0x36ad90++;continue;}break;}for(;_0x36ad90<_0x2d3074['length'];_0x36ad90++){_0x4d0f86[_0x5a5869(0x1e9)](_0x2d3074[_0x36ad90]);}return _0x4d0f86['join']('\x0a')['trimStart']();}export function resolveSqlMode(_0x384078,_0x1f6526){const _0x34fed7=a204_0x1c7b71;if(_0x1f6526?.[_0x34fed7(0x201)])return _0x1f6526[_0x34fed7(0x201)];return detectSqlMode(_0x384078);}export function resolveSqlFileName(_0x29ded3,_0x4be56a,_0x2df90b){const _0x57475f=a204_0x1c7b71;if(_0x2df90b?.[_0x57475f(0x1ff)])return _0x2df90b[_0x57475f(0x1ff)];if(_0x2df90b?.['sqlName']||_0x2df90b?.['dbName'])return buildSqlRelativePath(_0x29ded3,_0x2df90b?.[_0x57475f(0x1f7)],_0x2df90b?.[_0x57475f(0x1f2)],resolveSqlMode(_0x4be56a,_0x2df90b),_0x2df90b?.[_0x57475f(0x1f4)]);return buildDefaultSqlFileName(_0x29ded3,resolveSqlMode(_0x4be56a,_0x2df90b));}export function resolveSqlLocalDir(_0x3ee5d4,_0x573114){return join(_0x3ee5d4,SQL_LOCAL_REL_DIR,_0x573114);}function a204_0x514f(_0x3fdfa3,_0x492ea9){_0x3fdfa3=_0x3fdfa3-0x1e2;const _0x30abc1=a204_0x30ab();let _0x514f3a=_0x30abc1[_0x3fdfa3];return _0x514f3a;}export async function confirmForceOverwrite(_0x42b653){const _0x129ec5=a204_0x1c7b71,_0x926db5=createInterface({'input':process['stdin'],'output':process[_0x129ec5(0x20a)]}),_0xd60a9=await new Promise(_0x137f2e=>{const _0xe3a1be=_0x129ec5;_0x926db5[_0xe3a1be(0x1f5)](_0x42b653+_0xe3a1be(0x1ed),_0x137f2e);});return _0x926db5[_0x129ec5(0x205)](),['y',_0x129ec5(0x1ee)][_0x129ec5(0x20b)](_0xd60a9[_0x129ec5(0x1f8)]()[_0x129ec5(0x1fa)]());}export function findSqlLockScope(_0xadcd11,_0x5bb37d){return _0xadcd11['apps'][_0x5bb37d];}function a204_0x30ab(){const _0xef3481=['syncedAt','sqlName','trim','sqlConfig','toLowerCase','76612taHwew','mybatisXml','28778870qRLowE','636054fLCyaP','path','7965846SNNzGG','mode','3581408YJurwx','entries','split','close','15UggMzd','description','sqlRoot','lastSync','stderr','includes','470674mAksxI','195gvByZR','--\x20@lovrabet.','<!--\x20@lovrabet.','replace','sqlCode','length','9ZHGCcQ','filter','sqls','push','join','.rabetbase/sql','385452FqaPhB','\x20[y/N]\x20','yes','\x20-->','map','fromEntries','dbName','test','dbId','question'];a204_0x30ab=function(){return _0xef3481;};return a204_0x30ab();}function buildMetadataHeaderLines(_0x26d6d1,_0x329f88){const _0x19cf55=a204_0x1c7b71,_0x4b2d40=[[_0x19cf55(0x1e4),_0x26d6d1[_0x19cf55(0x1e4)]],[_0x19cf55(0x1f7),_0x26d6d1[_0x19cf55(0x1f7)]],['dbId',_0x26d6d1[_0x19cf55(0x1f4)]],[_0x19cf55(0x1f2),_0x26d6d1[_0x19cf55(0x1f2)]],['mode',_0x26d6d1[_0x19cf55(0x201)]],[_0x19cf55(0x1f6),_0x26d6d1[_0x19cf55(0x1f6)]],[_0x19cf55(0x207),_0x26d6d1[_0x19cf55(0x207)]]];if(_0x329f88===_0x19cf55(0x1fc))return _0x4b2d40[_0x19cf55(0x1e7)](([,_0x48ef98])=>_0x48ef98!==undefined&&_0x48ef98!==null&&String(_0x48ef98)['trim']()!=='')[_0x19cf55(0x1f0)](([_0x457038,_0x52edfc])=>_0x19cf55(0x1e2)+_0x457038+':\x20'+String(_0x52edfc)+_0x19cf55(0x1ef));return _0x4b2d40['filter'](([,_0x5cf5e1])=>_0x5cf5e1!==undefined&&_0x5cf5e1!==null&&String(_0x5cf5e1)['trim']()!=='')[_0x19cf55(0x1f0)](([_0x2674cc,_0x237f10])=>_0x19cf55(0x20e)+_0x2674cc+':\x20'+String(_0x237f10));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a205_0x202c22=a205_0x4d3b;(function(_0x19e357,_0x5e4dec){const _0x300656=a205_0x4d3b,_0x329ec9=_0x19e357();while(!![]){try{const _0x43262d=-parseInt(_0x300656(0x144))/0x1*(-parseInt(_0x300656(0x12a))/0x2)+parseInt(_0x300656(0x126))/0x3*(parseInt(_0x300656(0x142))/0x4)+parseInt(_0x300656(0x123))/0x5+-parseInt(_0x300656(0x135))/0x6*(parseInt(_0x300656(0x146))/0x7)+-parseInt(_0x300656(0x12e))/0x8*(parseInt(_0x300656(0x133))/0x9)+parseInt(_0x300656(0x12c))/0xa+parseInt(_0x300656(0x13c))/0xb*(-parseInt(_0x300656(0x122))/0xc);if(_0x43262d===_0x5e4dec)break;else _0x329ec9['push'](_0x329ec9['shift']());}catch(_0x267388){_0x329ec9['push'](_0x329ec9['shift']());}}}(a205_0x29dc,0x8f017));function a205_0x29dc(){const _0x34692d=['1005653FKszUp','relativePath','filePath','\x20modified,\x20','sqlName','\x20remote-only','1677784QbtisX','lockFilePath','25bSLXbp','\x20added,\x20','20139RPmGmj','read','boolean','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','length','132UeTCCa','5203610oCIkrx','lockKey','tableData','6sCqrRE','sqls','remote','sql','62282DMcXEZ','hash','6362340ZfNmZd','\x20missing,\x20','21872CNGhal','sqlRoot','paging','keys','appCode','3816KZVuou','All\x20SQL\x20queries\x20are\x20in\x20sync.','1134zJtXya','push','path','map','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','has','bool'];a205_0x29dc=function(){return _0x34692d;};return a205_0x29dc();}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a205_0x4d3b(_0x520c3f,_0x42e65f){_0x520c3f=_0x520c3f-0x11f;const _0x29dc8f=a205_0x29dc();let _0x4d3b3f=_0x29dc8f[_0x520c3f];return _0x4d3b3f;}async function fetchAllSqlCodes(_0x598e05){const _0x28e1c1=a205_0x4d3b,_0x43a01e=[];let _0x2b9449=0x1;while(!![]){const _0x22f884=await listSqlQueries(_0x598e05,{'currentPage':_0x2b9449,'pageSize':PAGE_SIZE}),_0x1a80ae=_0x22f884[_0x28e1c1(0x125)]??[];_0x43a01e[_0x28e1c1(0x136)](..._0x1a80ae[_0x28e1c1(0x138)](_0x330c37=>_0x330c37['sqlCode']));if(_0x1a80ae[_0x28e1c1(0x121)]===0x0)break;const _0x329fbd=_0x22f884[_0x28e1c1(0x130)]?.['totalCount'];if(_0x329fbd!=null?_0x43a01e[_0x28e1c1(0x121)]>=_0x329fbd:_0x1a80ae[_0x28e1c1(0x121)]<PAGE_SIZE)break;_0x2b9449++;}return _0x43a01e;}export const sqlStatus={'service':a205_0x202c22(0x129),'command':'status','description':a205_0x202c22(0x120),'risk':a205_0x202c22(0x147),'flags':[{'name':a205_0x202c22(0x128),'type':a205_0x202c22(0x11f),'description':a205_0x202c22(0x139)}],async 'execute'(_0x4e0821){const _0x174aed=a205_0x202c22,_0x1ddaec=loadSqlProjectConfig(_0x4e0821[_0x174aed(0x132)]),_0x4544e4=await readSqlLockFile(_0x1ddaec[_0x174aed(0x143)]),{appLock:_0x4d68d5}=ensureSqlLockScope(_0x4544e4??createEmptySqlLock(),_0x1ddaec['appCode'],_0x1ddaec[_0x174aed(0x12f)],'status'),_0x1b5446=await scanLocalSqlQueries(_0x1ddaec),_0x310414=[],_0x521a85=[],_0x31f161=[],_0x5028ca=[],_0x5d5a50=new Set(_0x1b5446[_0x174aed(0x138)](_0x1a6bb3=>_0x1a6bb3[_0x174aed(0x124)]));for(const _0x1567f2 of _0x1b5446){const _0x226aee=await computeSqlFileHash(_0x1567f2[_0x174aed(0x13e)]),_0x356891=_0x4d68d5[_0x174aed(0x127)][_0x1567f2[_0x174aed(0x124)]],_0x43c403=!!_0x356891&&_0x356891[_0x174aed(0x137)]!==_0x1567f2[_0x174aed(0x13d)],_0x3281f8=!!_0x356891&&!!_0x1567f2[_0x174aed(0x140)]&&_0x356891[_0x174aed(0x140)]!==_0x1567f2[_0x174aed(0x140)];if(!_0x356891)_0x310414[_0x174aed(0x136)](_0x1567f2[_0x174aed(0x124)]);else _0x356891[_0x174aed(0x12b)]!==_0x226aee||_0x43c403||_0x3281f8?_0x521a85['push'](_0x1567f2[_0x174aed(0x124)]):_0x31f161[_0x174aed(0x136)](_0x1567f2['lockKey']);}for(const _0x63ab53 of Object[_0x174aed(0x131)](_0x4d68d5[_0x174aed(0x127)])){!_0x5d5a50['has'](_0x63ab53)&&_0x5028ca[_0x174aed(0x136)](_0x63ab53);}const _0x296c79=[];if(_0x4e0821[_0x174aed(0x13b)](_0x174aed(0x128))){const _0xa5c7f=await fetchAllSqlCodes(_0x4e0821[_0x174aed(0x132)]);for(const _0x3ac854 of _0xa5c7f){!_0x5d5a50[_0x174aed(0x13a)](_0x3ac854)&&!_0x4d68d5[_0x174aed(0x127)][_0x3ac854]&&_0x296c79[_0x174aed(0x136)](_0x3ac854);}}const _0x13b791=_0x310414[_0x174aed(0x121)]===0x0&&_0x521a85[_0x174aed(0x121)]===0x0&&_0x5028ca[_0x174aed(0x121)]===0x0&&_0x296c79[_0x174aed(0x121)]===0x0;return{'ok':!![],'data':{'added':_0x310414,'modified':_0x521a85,'missing':_0x5028ca,'unchanged':_0x31f161,'remoteOnly':_0x296c79},'message':_0x13b791?_0x174aed(0x134):_0x310414[_0x174aed(0x121)]+_0x174aed(0x145)+_0x521a85[_0x174aed(0x121)]+_0x174aed(0x13f)+_0x5028ca['length']+_0x174aed(0x12d)+_0x31f161[_0x174aed(0x121)]+'\x20unchanged'+(_0x296c79[_0x174aed(0x121)]>0x0?',\x20'+_0x296c79[_0x174aed(0x121)]+_0x174aed(0x141):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a206_0x526e83=a206_0x4075;(function(_0x191faa,_0x40fc42){const _0x2956aa=a206_0x4075,_0x2c26f9=_0x191faa();while(!![]){try{const _0x542dc6=parseInt(_0x2956aa(0x117))/0x1*(parseInt(_0x2956aa(0x143))/0x2)+-parseInt(_0x2956aa(0x11a))/0x3*(parseInt(_0x2956aa(0x155))/0x4)+parseInt(_0x2956aa(0x14e))/0x5*(parseInt(_0x2956aa(0x13a))/0x6)+-parseInt(_0x2956aa(0x139))/0x7*(parseInt(_0x2956aa(0x111))/0x8)+-parseInt(_0x2956aa(0x126))/0x9+-parseInt(_0x2956aa(0x10c))/0xa+parseInt(_0x2956aa(0x157))/0xb*(parseInt(_0x2956aa(0x13c))/0xc);if(_0x542dc6===_0x40fc42)break;else _0x2c26f9['push'](_0x2c26f9['shift']());}catch(_0x4e536d){_0x2c26f9['push'](_0x2c26f9['shift']());}}}(a206_0x3366,0x1f940));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a206_0x4075(_0x2cfb6f,_0xbcbaf8){_0x2cfb6f=_0x2cfb6f-0x10c;const _0x33669b=a206_0x3366();let _0x40759e=_0x33669b[_0x2cfb6f];return _0x40759e;}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';function a206_0x3366(){const _0x2c5997=['type','schemaWarnings','schema:','tables','columnNames','length','message','bool','2118402NIVazk','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','fields','\x22\x20not\x20found\x20or\x20not\x20accessible','check-indexes','reason','\x22\x20not\x20found\x20in\x20any\x20dataset','SQL\x20schema\x20validation','utf-8','validation','sqlType','index_name','push','cwd','size','filter','file','boolean','from','1204238fSuluN','19242FdGgjD','Dataset\x20\x22','2747352AunQxA','validate','Table\x20\x22','appCode','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','get','string','14MaJufF','indexes','dbtableConfig','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','sql','str','primary','parameters','map','flatMap','tableName','270mjDYwh','isArray','pkField','schemas','Provide\x20--file\x20or\x20--sql','index_type','read','24eLqDPy','trim','22VxnVeW','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','566180xshYcF','find','toLowerCase','File\x20not\x20found:\x20','dataset','8NpIbDQ','isSelectOnly','indexName','name','flagMissing','index_columns','10994Utcbja','columns','valid','57327BqVLSB','--check-indexes\x20requires\x20--schemas.','joinAudit','isDangerous'];a206_0x3366=function(){return _0x2c5997;};return a206_0x3366();}export const sqlValidate={'service':a206_0x526e83(0x147),'command':a206_0x526e83(0x13d),'description':a206_0x526e83(0x140),'risk':a206_0x526e83(0x154),'flags':[{'name':'file','type':a206_0x526e83(0x142),'description':a206_0x526e83(0x158)},{'name':a206_0x526e83(0x147),'type':a206_0x526e83(0x142),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a206_0x526e83(0x151),'type':a206_0x526e83(0x142),'description':a206_0x526e83(0x127)},{'name':a206_0x526e83(0x12a),'type':a206_0x526e83(0x137),'description':a206_0x526e83(0x146)}],async 'execute'(_0x1da037){const _0x5c778f=a206_0x526e83,_0x53c9c3=_0x1da037[_0x5c778f(0x148)]('file'),_0xf32f9a=_0x1da037[_0x5c778f(0x148)](_0x5c778f(0x147)),_0x437a8f=_0x1da037['str'](_0x5c778f(0x151)),_0x1ab4c4=_0x1da037[_0x5c778f(0x125)](_0x5c778f(0x12a));if(!_0x53c9c3&&!_0xf32f9a)throw CliErrors[_0x5c778f(0x115)](_0x5c778f(0x136),_0x5c778f(0x152));if(_0x1ab4c4&&!_0x437a8f)throw CliErrors[_0x5c778f(0x12f)](_0x5c778f(0x11b));let _0xa8f4fe;if(_0x53c9c3){const _0xad88aa=resolve(process[_0x5c778f(0x133)](),_0x53c9c3);if(!existsSync(_0xad88aa))throw CliErrors[_0x5c778f(0x12f)](_0x5c778f(0x10f)+_0xad88aa);_0xa8f4fe=readFileSync(_0xad88aa,_0x5c778f(0x12e));}else _0xa8f4fe=_0xf32f9a;const _0x9d308c=validateSql(_0xa8f4fe),_0x37066c={'valid':_0x9d308c['valid'],'sqlType':_0x9d308c[_0x5c778f(0x130)][_0x5c778f(0x11e)],'isSelectOnly':_0x9d308c['sqlType'][_0x5c778f(0x112)],'isDangerous':_0x9d308c[_0x5c778f(0x130)][_0x5c778f(0x11d)],'tables':_0x9d308c[_0x5c778f(0x121)],'parameters':_0x9d308c[_0x5c778f(0x14a)],'message':_0x9d308c[_0x5c778f(0x124)]};_0x9d308c[_0x5c778f(0x130)][_0x5c778f(0x12b)]&&(_0x37066c[_0x5c778f(0x12b)]=_0x9d308c['sqlType']['reason']);if(_0x437a8f&&_0x9d308c[_0x5c778f(0x119)]){const _0x2fc201=_0x437a8f['split'](',')[_0x5c778f(0x14b)](_0x55d7cd=>_0x55d7cd[_0x5c778f(0x156)]())[_0x5c778f(0x135)](Boolean),_0x33e38a=[],_0x1d321f=[],_0x5597f4=filterDbTableBackedDatasets(await listDatasets(_0x1da037[_0x5c778f(0x13f)])),_0x40421c=new Map(_0x5597f4[_0x5c778f(0x14b)](_0x2cd72c=>[_0x2cd72c[_0x5c778f(0x145)]?.['tableName']?.[_0x5c778f(0x10e)](),_0x2cd72c]));for(const _0x5a8947 of _0x9d308c['tables']){const _0x2fb43a=_0x40421c[_0x5c778f(0x141)](_0x5a8947[_0x5c778f(0x10e)]());!_0x2fb43a&&_0x33e38a[_0x5c778f(0x132)](_0x5c778f(0x13e)+_0x5a8947+_0x5c778f(0x12c));}for(const _0x5a9a11 of _0x2fc201){let _0x2e09d1;try{_0x2e09d1=await getDatasetDetail(_0x5a9a11);}catch{_0x33e38a[_0x5c778f(0x132)](_0x5c778f(0x13b)+_0x5a9a11+_0x5c778f(0x129));continue;}assertDatasetIsDbTableBacked(_0x2e09d1,_0x5c778f(0x12d));const _0x1152a3=Array['isArray'](_0x2e09d1[_0x5c778f(0x128)])?_0x2e09d1[_0x5c778f(0x128)]:[],_0x22d82c=new Set(_0x1152a3[_0x5c778f(0x14b)](_0x3e3adc=>_0x3e3adc[_0x5c778f(0x114)]?.[_0x5c778f(0x10e)]())),_0x4eab31=_0x2e09d1[_0x5c778f(0x145)]?.['tableName']||_0x2e09d1[_0x5c778f(0x14d)]||_0x5a9a11;_0x37066c[_0x5c778f(0x120)+_0x4eab31]={'code':_0x5a9a11,'tableName':_0x4eab31,'fieldCount':_0x22d82c[_0x5c778f(0x134)],'fields':Array[_0x5c778f(0x138)](_0x22d82c)};if(_0x1ab4c4){const _0x549066=normalizeDatasetIndexes(_0x2e09d1);_0x1d321f[_0x5c778f(0x132)]({'tableName':_0x4eab31,..._0x549066});}}_0x33e38a[_0x5c778f(0x123)]>0x0&&(_0x37066c[_0x5c778f(0x11f)]=_0x33e38a),_0x1ab4c4&&(_0x37066c[_0x5c778f(0x11c)]=auditSqlJoinIndexes(_0xa8f4fe,_0x1d321f));}return{'ok':_0x9d308c[_0x5c778f(0x119)],'data':_0x37066c,'message':_0x9d308c[_0x5c778f(0x124)]};}};function normalizeDatasetIndexes(_0x5ee75d){const _0x15fba6=a206_0x526e83,_0x4893a0=Array[_0x15fba6(0x14f)](_0x5ee75d?.[_0x15fba6(0x110)]?.[_0x15fba6(0x144)])?_0x5ee75d[_0x15fba6(0x110)]['indexes']:Array['isArray'](_0x5ee75d?.[_0x15fba6(0x144)])?_0x5ee75d[_0x15fba6(0x144)]:[],_0x203434=_0x4893a0[_0x15fba6(0x14c)](_0x54b10f=>{const _0x2534cf=_0x15fba6,_0xad9813=Array[_0x2534cf(0x14f)](_0x54b10f?.[_0x2534cf(0x116)])?_0x54b10f['index_columns']:Array[_0x2534cf(0x14f)](_0x54b10f?.['columnNames'])?_0x54b10f[_0x2534cf(0x122)]:Array['isArray'](_0x54b10f?.[_0x2534cf(0x118)])?_0x54b10f[_0x2534cf(0x118)]:[],_0x263b08=_0xad9813[_0x2534cf(0x135)](_0x5f006e=>typeof _0x5f006e==='string')[_0x2534cf(0x14b)](_0x47c0e3=>_0x47c0e3['trim']())['filter'](Boolean);if(_0x263b08['length']===0x0)return[];const _0x3a8f7a=[_0x54b10f?.[_0x2534cf(0x113)],_0x54b10f?.[_0x2534cf(0x131)],_0x54b10f?.[_0x2534cf(0x114)]][_0x2534cf(0x10d)](_0x146149=>typeof _0x146149===_0x2534cf(0x142)&&_0x146149[_0x2534cf(0x156)]()),_0x1ef6fb=[_0x54b10f?.[_0x2534cf(0x153)],_0x54b10f?.[_0x2534cf(0x11e)]][_0x2534cf(0x10d)](_0x11f96b=>typeof _0x11f96b==='string'&&_0x11f96b[_0x2534cf(0x156)]());return[{..._0x3a8f7a?{'name':_0x3a8f7a['trim']()}:{},..._0x1ef6fb?{'type':_0x1ef6fb[_0x2534cf(0x156)]()}:{},'columns':_0x263b08}];}),_0x45860c=[..._0x203434],_0x463b75=typeof _0x5ee75d?.[_0x15fba6(0x145)]?.[_0x15fba6(0x150)]===_0x15fba6(0x142)?_0x5ee75d[_0x15fba6(0x145)][_0x15fba6(0x150)]['split'](',')['map'](_0x476196=>_0x476196['trim']())['filter'](Boolean):[];return _0x463b75[_0x15fba6(0x123)]>0x0&&_0x45860c['unshift']({'type':_0x15fba6(0x149),'columns':_0x463b75}),{'indexes':_0x45860c,'metadataAvailable':_0x203434[_0x15fba6(0x123)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x40540c,_0x232f33){const _0x4fdd85=a207_0x1852,_0x209efe=_0x40540c();while(!![]){try{const _0x75bce6=-parseInt(_0x4fdd85(0x138))/0x1+parseInt(_0x4fdd85(0x13d))/0x2+-parseInt(_0x4fdd85(0x13f))/0x3+parseInt(_0x4fdd85(0x13e))/0x4+-parseInt(_0x4fdd85(0x13a))/0x5+-parseInt(_0x4fdd85(0x13b))/0x6*(-parseInt(_0x4fdd85(0x139))/0x7)+parseInt(_0x4fdd85(0x140))/0x8*(parseInt(_0x4fdd85(0x13c))/0x9);if(_0x75bce6===_0x232f33)break;else _0x209efe['push'](_0x209efe['shift']());}catch(_0x4d059f){_0x209efe['push'](_0x209efe['shift']());}}}(a207_0x1d87,0x63932));function a207_0x1852(_0xec6871,_0x383fd2){_0xec6871=_0xec6871-0x138;const _0x1d8757=a207_0x1d87();let _0x185230=_0x1d8757[_0xec6871];return _0x185230;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a207_0x1d87(){const _0x4bc857=['56KAZteo','92358njQPUK','2630278VTSCjD','1243690cndpKR','6pyXhYk','82233XKnIcb','729028wWlHbd','2907992PYLPOi','2346813aqVGRg'];a207_0x1d87=function(){return _0x4bc857;};return a207_0x1d87();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a208_0x5138(_0x4c49d2,_0x2cb10b){_0x4c49d2=_0x4c49d2-0x1a5;const _0x341190=a208_0x3411();let _0x51380e=_0x341190[_0x4c49d2];return _0x51380e;}const a208_0x378ff2=a208_0x5138;(function(_0x327a3e,_0x3eae6f){const _0x46433c=a208_0x5138,_0x396eed=_0x327a3e();while(!![]){try{const _0x42ec8e=parseInt(_0x46433c(0x1b3))/0x1+parseInt(_0x46433c(0x1af))/0x2*(parseInt(_0x46433c(0x1b7))/0x3)+parseInt(_0x46433c(0x1ac))/0x4*(parseInt(_0x46433c(0x1b4))/0x5)+parseInt(_0x46433c(0x1a5))/0x6*(-parseInt(_0x46433c(0x1a6))/0x7)+parseInt(_0x46433c(0x1b8))/0x8*(-parseInt(_0x46433c(0x1b0))/0x9)+-parseInt(_0x46433c(0x1b9))/0xa+-parseInt(_0x46433c(0x1a8))/0xb*(-parseInt(_0x46433c(0x1ba))/0xc);if(_0x42ec8e===_0x3eae6f)break;else _0x396eed['push'](_0x396eed['shift']());}catch(_0x308b39){_0x396eed['push'](_0x396eed['shift']());}}}(a208_0x3411,0x41776));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';function a208_0x3411(){const _0x467287=['str','1392BjGQjA','10157jKfqBk','string','77tzWOKo','trim','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','compress','4jjajFJ','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','task','4cddRmx','36DTyeck','task-id','appCode','189289mkshsw','2176655SWnmCc','flagMissing','taskId','290469EQuzGL','596152pkpWak','5144470LziRzl','1026924BAwIng','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'];a208_0x3411=function(){return _0x467287;};return a208_0x3411();}import{CliErrors}from'../../errors.js';export const taskStatus={'service':a208_0x378ff2(0x1ae),'command':'status','description':a208_0x378ff2(0x1ad),'risk':'read','defaultOutputFormat':a208_0x378ff2(0x1ab),'structuredErrors':!![],'flags':[{'name':a208_0x378ff2(0x1b1),'type':a208_0x378ff2(0x1a7),'required':!![],'description':a208_0x378ff2(0x1aa)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x26089b){const _0x44a879=a208_0x378ff2;if(!_0x26089b[_0x44a879(0x1bc)](_0x44a879(0x1b1))[_0x44a879(0x1a9)]())throw CliErrors[_0x44a879(0x1b5)](_0x44a879(0x1b1));},async 'execute'(_0x34d208){const _0x30a67e=a208_0x378ff2,_0x323365=_0x34d208[_0x30a67e(0x1bc)](_0x30a67e(0x1b1))[_0x30a67e(0x1a9)](),_0x2d5ee4=normalizeAsyncTask(await getAsyncTaskStatus(_0x323365,_0x34d208['appCode'],_0x34d208['cookie']));if(_0x2d5ee4['taskId']!==_0x323365)throw CliErrors['apiError'](_0x30a67e(0x1bb)+_0x323365+',\x20received\x20'+_0x2d5ee4[_0x30a67e(0x1b6)]+'.');const _0x40dc55=buildAsyncTaskStatusCommand(_0x2d5ee4[_0x30a67e(0x1b6)],_0x34d208[_0x30a67e(0x1b2)]);return{'ok':!![],'message':asyncTaskMessage(_0x2d5ee4),'data':{'appCode':_0x34d208[_0x30a67e(0x1b2)],..._0x2d5ee4,'query':_0x2d5ee4['isTerminal']?null:{'command':_0x40dc55}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x54a51d,_0x230ea1){const _0x593171=a209_0x30ba,_0x58205a=_0x54a51d();while(!![]){try{const _0x4f0177=-parseInt(_0x593171(0x1ea))/0x1+-parseInt(_0x593171(0x1ee))/0x2+-parseInt(_0x593171(0x1e8))/0x3*(-parseInt(_0x593171(0x1e9))/0x4)+parseInt(_0x593171(0x1e4))/0x5*(-parseInt(_0x593171(0x1ed))/0x6)+parseInt(_0x593171(0x1ec))/0x7+parseInt(_0x593171(0x1e5))/0x8*(parseInt(_0x593171(0x1eb))/0x9)+-parseInt(_0x593171(0x1e7))/0xa*(-parseInt(_0x593171(0x1e6))/0xb);if(_0x4f0177===_0x230ea1)break;else _0x58205a['push'](_0x58205a['shift']());}catch(_0x28cac6){_0x58205a['push'](_0x58205a['shift']());}}}(a209_0x393f,0x6d0b8));function a209_0x30ba(_0x328734,_0x124476){_0x328734=_0x328734-0x1e4;const _0x393f08=a209_0x393f();let _0x30ba40=_0x393f08[_0x328734];return _0x30ba40;}function a209_0x393f(){const _0x117529=['871077RgeHTh','4077VpZxPs','6116593YcCqAt','18FhSRcD','1136650RbvrHa','1181435yWfrqB','248uUCxWj','1349381jufCmq','90GheHGM','6gUIbgI','1206060CQKudS'];a209_0x393f=function(){return _0x117529;};return a209_0x393f();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a210_0x593693=a210_0x5297;(function(_0x290313,_0x195bed){const _0x389400=a210_0x5297,_0x16a226=_0x290313();while(!![]){try{const _0x523ea6=-parseInt(_0x389400(0x14d))/0x1*(parseInt(_0x389400(0x153))/0x2)+parseInt(_0x389400(0x146))/0x3*(parseInt(_0x389400(0x14c))/0x4)+-parseInt(_0x389400(0x150))/0x5+parseInt(_0x389400(0x14e))/0x6*(-parseInt(_0x389400(0x144))/0x7)+parseInt(_0x389400(0x148))/0x8+parseInt(_0x389400(0x147))/0x9*(-parseInt(_0x389400(0x13f))/0xa)+-parseInt(_0x389400(0x14f))/0xb*(-parseInt(_0x389400(0x141))/0xc);if(_0x523ea6===_0x195bed)break;else _0x16a226['push'](_0x16a226['shift']());}catch(_0x511d67){_0x16a226['push'](_0x16a226['shift']());}}}(a210_0x5b7b,0xab816));function a210_0x5b7b(){const _0x36ae5d=['length','members-list','Exact\x20tenant\x20code','string','350FJXkst','str','24EofqMo','read','tenant','3787uluOdg','trim','3cNwAHC','317889jBrcgX','2404512NETFis','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','Found\x20','tenant-code','293028xJTUGR','821ZjmkCi','8178pwEAqw','22945967QrfBSh','4993150wTSeFi','\x20tenant\x20member(s)','Pass\x20--tenant-code\x20<code>.','2122zGCQME'];a210_0x5b7b=function(){return _0x36ae5d;};return a210_0x5b7b();}function a210_0x5297(_0x136c19,_0x1fd1dd){_0x136c19=_0x136c19-0x13b;const _0x5b7bb6=a210_0x5b7b();let _0x52974e=_0x5b7bb6[_0x136c19];return _0x52974e;}import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a210_0x593693(0x143),'command':a210_0x593693(0x13c),'description':a210_0x593693(0x149),'risk':a210_0x593693(0x142),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a210_0x593693(0x14b),'type':a210_0x593693(0x13e),'required':!![],'description':a210_0x593693(0x13d)}],async 'validate'(_0x3db70f){const _0xc78cfa=a210_0x593693;if(!_0x3db70f[_0xc78cfa(0x140)](_0xc78cfa(0x14b))[_0xc78cfa(0x145)]())throw CliErrors['flagMissing']('tenant-code',_0xc78cfa(0x152));},async 'execute'(_0x3c521b){const _0x475d6a=a210_0x593693,_0x2731b8=_0x3c521b[_0x475d6a(0x140)](_0x475d6a(0x14b))[_0x475d6a(0x145)](),_0x1c3ce3=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x2731b8,_0x1c3ce3);const _0x580bb1=projectTenantMembers(await listTenantDirectoryMembers(_0x2731b8));return{'ok':!![],'data':{'tenantCode':_0x2731b8,'items':_0x580bb1,'totalCount':_0x580bb1[_0x475d6a(0x13b)]},'message':_0x475d6a(0x14a)+_0x580bb1[_0x475d6a(0x13b)]+_0x475d6a(0x151)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a211_0x2dcd(){const _0x6b9f=['\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','displayName','values','4525470kvjuQJ','2167272FHCbcS','adminFlag','userId','14ReJYEF','validation','317360mWSGZh','username','status','isFinite','2805868WmnIsr','MEMBER','sort','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','126wbubix','set','role','tenantCode','get','100699IWmrGx','trim','7ldHSmq','170965xaLHqz','ADMIN','1254530cxhknp','nickname'];a211_0x2dcd=function(){return _0x6b9f;};return a211_0x2dcd();}(function(_0x22c532,_0x50a615){const _0x370fd0=a211_0x3145,_0x5f49b0=_0x22c532();while(!![]){try{const _0x3b861e=parseInt(_0x370fd0(0xb7))/0x1*(-parseInt(_0x370fd0(0xa8))/0x2)+-parseInt(_0x370fd0(0xc2))/0x3+-parseInt(_0x370fd0(0xae))/0x4+-parseInt(_0x370fd0(0xba))/0x5+parseInt(_0x370fd0(0xc1))/0x6+-parseInt(_0x370fd0(0xb9))/0x7*(-parseInt(_0x370fd0(0xaa))/0x8)+-parseInt(_0x370fd0(0xb2))/0x9*(-parseInt(_0x370fd0(0xbc))/0xa);if(_0x3b861e===_0x50a615)break;else _0x5f49b0['push'](_0x5f49b0['shift']());}catch(_0x11c644){_0x5f49b0['push'](_0x5f49b0['shift']());}}}(a211_0x2dcd,0x5e8d0));import{CliErrors}from'../../errors.js';function textOrNull(_0x2622a1){const _0x27267b=a211_0x3145,_0x1be885=_0x2622a1?.[_0x27267b(0xb8)]();return _0x1be885?_0x1be885:null;}function a211_0x3145(_0xe354a6,_0x20adf4){_0xe354a6=_0xe354a6-0xa7;const _0x2dcd6d=a211_0x2dcd();let _0x314572=_0x2dcd6d[_0xe354a6];return _0x314572;}export function projectTenantMembers(_0x93749f){const _0x598f4e=a211_0x3145,_0x4f22b6=new Map();for(const _0x3184bd of _0x93749f){const _0x5688b2=Number(_0x3184bd[_0x598f4e(0xa7)]);if(!Number[_0x598f4e(0xad)](_0x5688b2)||_0x5688b2<=0x0)continue;const _0x2a2e8e={'userId':_0x5688b2,'username':textOrNull(_0x3184bd['username']),'displayName':textOrNull(_0x3184bd[_0x598f4e(0xbd)]),'role':_0x3184bd[_0x598f4e(0xc3)]===!![]?'ADMIN':_0x598f4e(0xaf),'status':textOrNull(_0x3184bd[_0x598f4e(0xac)])},_0x4084c3=_0x4f22b6[_0x598f4e(0xb6)](_0x5688b2);if(!_0x4084c3){_0x4f22b6[_0x598f4e(0xb3)](_0x5688b2,_0x2a2e8e);continue;}_0x4084c3['username']??=_0x2a2e8e[_0x598f4e(0xab)],_0x4084c3[_0x598f4e(0xbf)]??=_0x2a2e8e[_0x598f4e(0xbf)],_0x4084c3[_0x598f4e(0xac)]??=_0x2a2e8e['status'];if(_0x2a2e8e[_0x598f4e(0xb4)]===_0x598f4e(0xbb))_0x4084c3[_0x598f4e(0xb4)]='ADMIN';}return[..._0x4f22b6[_0x598f4e(0xc0)]()][_0x598f4e(0xb0)]((_0x3f8ab1,_0x99a81e)=>_0x3f8ab1[_0x598f4e(0xa7)]-_0x99a81e[_0x598f4e(0xa7)]);}export function assertTenantAccessible(_0x588240,_0x450946){const _0x4198d8=a211_0x3145;if(_0x450946['some'](_0x1a9e6b=>_0x1a9e6b[_0x4198d8(0xb5)]===_0x588240))return;throw CliErrors[_0x4198d8(0xa9)]('Tenant\x20\x22'+_0x588240+_0x4198d8(0xbe),_0x4198d8(0xb1));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a212_0x30e90e=a212_0x3083;(function(_0x66f855,_0x110565){const _0x4584f3=a212_0x3083,_0x5af626=_0x66f855();while(!![]){try{const _0x554a15=parseInt(_0x4584f3(0xa9))/0x1*(parseInt(_0x4584f3(0xa6))/0x2)+-parseInt(_0x4584f3(0xb7))/0x3+-parseInt(_0x4584f3(0xac))/0x4+parseInt(_0x4584f3(0xb9))/0x5*(-parseInt(_0x4584f3(0xa8))/0x6)+-parseInt(_0x4584f3(0xb3))/0x7*(-parseInt(_0x4584f3(0xad))/0x8)+-parseInt(_0x4584f3(0xbb))/0x9*(parseInt(_0x4584f3(0xba))/0xa)+-parseInt(_0x4584f3(0xa7))/0xb*(-parseInt(_0x4584f3(0xaf))/0xc);if(_0x554a15===_0x110565)break;else _0x5af626['push'](_0x5af626['shift']());}catch(_0x5ada08){_0x5af626['push'](_0x5af626['shift']());}}}(a212_0x1070,0x233ea));function a212_0x3083(_0x18db65,_0x22d840){_0x18db65=_0x18db65-0xa5;const _0x107079=a212_0x1070();let _0x308306=_0x107079[_0x18db65];return _0x308306;}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_0x1070(){const _0x4e3f46=['user-account','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','dingding-sandbox-bind','write','bind','287736aisUSf','962621GnmaND','100242kHHaPN','1JdoTPX','trim','POST','75384GPfULB','549280qhisrP','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','36Tlicte','validation','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','14CETXYk','ding-talk-user-id','--ding-talk-user-id\x20cannot\x20be\x20empty.','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','150768petxXp','str','45KyuQVH','8140WQPTDY','1989MdXaXc','string','dingtalk'];a212_0x1070=function(){return _0x4e3f46;};return a212_0x1070();}const PROVIDER_ID=a212_0x30e90e(0xbd),CURRENT_BINDING_WARNING='The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.';function readDingTalkUserId(_0x16118b){const _0x1de3b0=a212_0x30e90e,_0x2bc0ad=_0x16118b[_0x1de3b0(0xb8)]('ding-talk-user-id')[_0x1de3b0(0xaa)]();if(!_0x2bc0ad)throw CliErrors[_0x1de3b0(0xb0)](_0x1de3b0(0xb5),_0x1de3b0(0xb2));return _0x2bc0ad;}function buildBindingData(_0x5aa991,_0x3b0d50){const _0x4791cc=a212_0x30e90e;return{'operation':_0x4791cc(0xa5),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x5aa991},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x5aa991,'bound':!![]},'dryRun':_0x3b0d50,'backend':{'method':_0x4791cc(0xab),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a212_0x30e90e(0xbe),'command':a212_0x30e90e(0xc0),'description':a212_0x30e90e(0xbf),'risk':a212_0x30e90e(0xc1),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a212_0x30e90e(0xb4),'type':a212_0x30e90e(0xbc),'required':!![],'description':a212_0x30e90e(0xb1)}],async 'validate'(_0xa823f9){readDingTalkUserId(_0xa823f9);},async 'dryRun'(_0x5d2b5e){const _0x59c0ed=a212_0x30e90e,_0xfa457=readDingTalkUserId(_0x5d2b5e);return asDryRunResult(buildBindingData(_0xfa457,!![]),{'method':_0x59c0ed(0xab),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x16be4f){const _0x383aa1=a212_0x30e90e,_0x123c5a=readDingTalkUserId(_0x16be4f),_0x55eaed=await bindDingTalkSandboxAccount(_0x123c5a);if(_0x55eaed!==!![])throw CliErrors['apiError'](_0x383aa1(0xae),_0x383aa1(0xb6));return{'ok':!![],'data':buildBindingData(_0x123c5a,![]),'message':'Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x132760,_0x56b0bb){const _0x337283=a213_0x2424,_0x4d0757=_0x132760();while(!![]){try{const _0x175b3a=-parseInt(_0x337283(0xe8))/0x1*(-parseInt(_0x337283(0xef))/0x2)+parseInt(_0x337283(0xea))/0x3+-parseInt(_0x337283(0xed))/0x4+-parseInt(_0x337283(0xf0))/0x5*(-parseInt(_0x337283(0xe7))/0x6)+-parseInt(_0x337283(0xee))/0x7*(-parseInt(_0x337283(0xe9))/0x8)+parseInt(_0x337283(0xe6))/0x9*(-parseInt(_0x337283(0xeb))/0xa)+parseInt(_0x337283(0xec))/0xb;if(_0x175b3a===_0x56b0bb)break;else _0x4d0757['push'](_0x4d0757['shift']());}catch(_0x3bed74){_0x4d0757['push'](_0x4d0757['shift']());}}}(a213_0x51de,0x97ca3));function a213_0x51de(){const _0x58fb31=['4969300pclDom','35rPmUZi','555134BufXBN','326525bfbgPT','2604213aMHqRD','18aWnoFy','1eSJjEl','1871448sImYBz','2092212fSvYlQ','40PDiXRJ','7490373ixaSOa'];a213_0x51de=function(){return _0x58fb31;};return a213_0x51de();}import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';function a213_0x2424(_0x377f81,_0x4a0f8d){_0x377f81=_0x377f81-0xe6;const _0x51de36=a213_0x51de();let _0x2424e6=_0x51de36[_0x377f81];return _0x2424e6;}export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a214_0x1e6cd6=a214_0x8bdd;function a214_0x4c8d(){const _0xdafdae=['workspace','708501KaBstv','write','382rjpuXW','name','6687369ssGOxQ','556927SsWLBP','114488xeekVR','2190gekDdx','8526040MzgPTC','1144NrKiEq','add','60XTLvhG','450MtZTJf','App\x20profile\x20name','workspace\x20add','45VFAmub'];a214_0x4c8d=function(){return _0xdafdae;};return a214_0x4c8d();}function a214_0x8bdd(_0x528d62,_0x200810){_0x528d62=_0x528d62-0x1b9;const _0x4c8d5f=a214_0x4c8d();let _0x8bddee=_0x4c8d5f[_0x528d62];return _0x8bddee;}(function(_0x2dd1d8,_0x108925){const _0x3bf36f=a214_0x8bdd,_0x48072f=_0x2dd1d8();while(!![]){try{const _0x5d6a9a=-parseInt(_0x3bf36f(0x1be))/0x1+parseInt(_0x3bf36f(0x1c0))/0x2*(-parseInt(_0x3bf36f(0x1c5))/0x3)+parseInt(_0x3bf36f(0x1c7))/0x4*(-parseInt(_0x3bf36f(0x1bc))/0x5)+-parseInt(_0x3bf36f(0x1c9))/0x6*(-parseInt(_0x3bf36f(0x1c3))/0x7)+parseInt(_0x3bf36f(0x1c6))/0x8+-parseInt(_0x3bf36f(0x1c2))/0x9+-parseInt(_0x3bf36f(0x1b9))/0xa*(-parseInt(_0x3bf36f(0x1c4))/0xb);if(_0x5d6a9a===_0x108925)break;else _0x48072f['push'](_0x48072f['shift']());}catch(_0x40fd5f){_0x48072f['push'](_0x48072f['shift']());}}}(a214_0x4c8d,0xb3bb3));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a214_0x1e6cd6(0x1bd),'command':a214_0x1e6cd6(0x1c8),'description':'Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','risk':a214_0x1e6cd6(0x1bf),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a214_0x1e6cd6(0x1c1),'description':a214_0x1e6cd6(0x1ba),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x287df6=>validateAppName(_0x287df6,a214_0x1e6cd6(0x1bb)),'execute':_0x4bff1a=>runAppAdd(_0x4bff1a,a214_0x1e6cd6(0x1bb))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a215_0x2ee0a9=a215_0x4464;(function(_0x433cd4,_0x23d14b){const _0x31999b=a215_0x4464,_0x4775ad=_0x433cd4();while(!![]){try{const _0x1a2f94=parseInt(_0x31999b(0x1e3))/0x1+-parseInt(_0x31999b(0x1e5))/0x2*(-parseInt(_0x31999b(0x1cd))/0x3)+parseInt(_0x31999b(0x1d3))/0x4*(parseInt(_0x31999b(0x1e4))/0x5)+-parseInt(_0x31999b(0x1d1))/0x6*(parseInt(_0x31999b(0x1c2))/0x7)+parseInt(_0x31999b(0x1c7))/0x8*(parseInt(_0x31999b(0x1e0))/0x9)+-parseInt(_0x31999b(0x1f5))/0xa+-parseInt(_0x31999b(0x1e9))/0xb;if(_0x1a2f94===_0x23d14b)break;else _0x4775ad['push'](_0x4775ad['shift']());}catch(_0x2b177c){_0x4775ad['push'](_0x4775ad['shift']());}}}(a215_0x4fd7,0x92ddf));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';import{normalizeStoredDefaultApp}from'../../config/schema.js';import{collectDeploymentSyncProfile,getDeploymentSyncProfileFlagDefs}from'../../config/deployment-sync.js';const WORKSPACE_USAGE=CLI_BIN_NAME+'\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]',SAFE_PROFILE_KEYS=[a215_0x2ee0a9(0x1ce),'env',a215_0x2ee0a9(0x1df),'format',a215_0x2ee0a9(0x1db),a215_0x2ee0a9(0x1c1),'locale',a215_0x2ee0a9(0x1f2)],workspaceFlags=[{'name':a215_0x2ee0a9(0x1bf),'type':a215_0x2ee0a9(0x1d9),'description':a215_0x2ee0a9(0x1f3)},{'name':a215_0x2ee0a9(0x1ce),'type':a215_0x2ee0a9(0x1d9),'description':a215_0x2ee0a9(0x1ea)},{'name':a215_0x2ee0a9(0x1ef),'type':a215_0x2ee0a9(0x1d9),'description':a215_0x2ee0a9(0x1e1),'enum':[...RABETBASE_ENV_VALUES]},{'name':'apiDir','type':a215_0x2ee0a9(0x1d9),'description':a215_0x2ee0a9(0x1d8)},{'name':'defaultFormat','type':a215_0x2ee0a9(0x1d9),'description':a215_0x2ee0a9(0x1dd),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a215_0x2ee0a9(0x1db),'type':a215_0x2ee0a9(0x1f4),'description':a215_0x2ee0a9(0x1cc)},{'name':a215_0x2ee0a9(0x1c1),'type':a215_0x2ee0a9(0x1d9),'description':a215_0x2ee0a9(0x1c0),'enum':[...RISK_LEVEL_VALUES]},{'name':a215_0x2ee0a9(0x1c6),'type':'string','description':a215_0x2ee0a9(0x1d2)},...getDeploymentSyncProfileFlagDefs()];function isRecord(_0x37d284){const _0x4ea851=a215_0x2ee0a9;return!!_0x37d284&&typeof _0x37d284===_0x4ea851(0x1e6)&&!Array[_0x4ea851(0x1bd)](_0x37d284);}function assertValidAppcode(_0x53cdb9){const _0x3c7d4b=a215_0x2ee0a9,{valid:_0x25c5f5,message:_0x462ee5}=validateAppcode(_0x53cdb9);if(!_0x25c5f5)throw CliErrors[_0x3c7d4b(0x1f1)](_0x3c7d4b(0x1e7)+_0x53cdb9,_0x462ee5);}function sanitizeProfile(_0x1e907d){if(!isRecord(_0x1e907d))return{};const _0x59e571={};for(const _0x25a9f5 of SAFE_PROFILE_KEYS){if(_0x1e907d[_0x25a9f5]!==undefined)_0x59e571[_0x25a9f5]=_0x1e907d[_0x25a9f5];}return _0x59e571;}function cloneProfile(_0x4e06ca){return isRecord(_0x4e06ca)?{..._0x4e06ca}:{};}function collectWorkspaceProfileOverrides(_0x4022ff){const _0x2134c2=a215_0x2ee0a9,_0xec45f5={},_0x3086c0=_0x4022ff[_0x2134c2(0x1e8)](_0x2134c2(0x1ef)),_0x105be1=_0x4022ff[_0x2134c2(0x1e8)](_0x2134c2(0x1df)),_0x46d969=_0x4022ff[_0x2134c2(0x1e8)](_0x2134c2(0x1c5)),_0x57f9c2=_0x4022ff[_0x2134c2(0x1d0)]('pageSize'),_0x2aca10=_0x4022ff['str'](_0x2134c2(0x1c1)),_0x523e5c=_0x4022ff[_0x2134c2(0x1e8)](_0x2134c2(0x1c6));if(_0x3086c0)_0xec45f5['env']=_0x3086c0;if(_0x105be1)_0xec45f5[_0x2134c2(0x1df)]=_0x105be1;if(_0x46d969)_0xec45f5[_0x2134c2(0x1de)]=_0x46d969;if(_0x57f9c2!==undefined&&_0x57f9c2!=='')_0xec45f5[_0x2134c2(0x1db)]=Number(_0x57f9c2);if(_0x2aca10)_0xec45f5[_0x2134c2(0x1c1)]=_0x2aca10;if(_0x523e5c)_0xec45f5[_0x2134c2(0x1c6)]=_0x523e5c;const _0x26459e=collectDeploymentSyncProfile(_0x8c4314=>_0x4022ff[_0x2134c2(0x1e8)](_0x8c4314));if(_0x26459e)_0xec45f5[_0x2134c2(0x1f2)]=_0x26459e;return _0xec45f5;}async function validateWorkspaceArgs(_0x205c3d){const _0x7bc9e4=a215_0x2ee0a9,_0x46710f=_0x205c3d[_0x7bc9e4(0x1e8)]('app')[_0x7bc9e4(0x1d7)](),_0x3d92de=_0x205c3d[_0x7bc9e4(0x1e8)](_0x7bc9e4(0x1ce))['trim']();if(!_0x46710f&&!_0x3d92de)throw CliErrors[_0x7bc9e4(0x1f1)](_0x7bc9e4(0x1e2),_0x7bc9e4(0x1d6)+CLI_BIN_NAME+_0x7bc9e4(0x1ed)+CLI_BIN_NAME+_0x7bc9e4(0x1c9));if(_0x3d92de)assertValidAppcode(_0x3d92de);}function a215_0x4464(_0x3d3ee4,_0x144f31){_0x3d3ee4=_0x3d3ee4-0x1bc;const _0x4fd785=a215_0x4fd7();let _0x4464e3=_0x4fd785[_0x3d3ee4];return _0x4464e3;}function resolveKnownApps(){const _0x3d106f=a215_0x2ee0a9,{config:_0xc096f7,layers:_0x4df415}=readRawConfigWithLayers(),_0x463a70=isRecord(_0xc096f7[_0x3d106f(0x1c4)])?_0xc096f7[_0x3d106f(0x1c4)]:{},_0x59878e=isRecord(_0x4df415['globalConfig']['apps'])?_0x4df415['globalConfig'][_0x3d106f(0x1c4)]:{};return{..._0x59878e,..._0x463a70};}async function configureWorkspace(_0x261bac,_0x56914e){const _0x1ce5cf=a215_0x2ee0a9,_0xd9c738=_0x261bac['str']('app')['trim'](),_0x423f52=_0x261bac[_0x1ce5cf(0x1e8)](_0x1ce5cf(0x1ce))['trim'](),_0x19b6d4=_0xd9c738||_0x423f52;if(!_0x19b6d4)throw CliErrors['validation'](_0x1ce5cf(0x1e2),_0x1ce5cf(0x1d6)+CLI_BIN_NAME+_0x1ce5cf(0x1ed)+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x423f52)assertValidAppcode(_0x423f52);const _0x4d77dc=resolveWriteConfigPath('project'),_0xe85e6c=readConfigFile(_0x4d77dc),_0x58a411=resolveKnownApps(),_0x4bd5c7=isRecord(_0xe85e6c['apps'])?{..._0xe85e6c[_0x1ce5cf(0x1c4)]}:{},_0x92c0f8=cloneProfile(_0x4bd5c7[_0x19b6d4]),_0x2f0e7c=sanitizeProfile(_0x58a411[_0x19b6d4]),_0x160095=_0x423f52?{}:_0x2f0e7c,_0x1c1afa=_0x423f52||_0x160095[_0x1ce5cf(0x1ce)];if(!_0x1c1afa){const _0x3ae11b=Object[_0x1ce5cf(0x1be)](_0x58a411),_0x2ae097=_0x3ae11b[_0x1ce5cf(0x1eb)]===0x0?_0x1ce5cf(0x1d6)+CLI_BIN_NAME+_0x1ce5cf(0x1ee)+_0x56914e+_0x1ce5cf(0x1d5)+_0x19b6d4+'\x20--appcode\x20<code>`.':'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x3ae11b[_0x1ce5cf(0x1d4)](',\x20');throw CliErrors[_0x1ce5cf(0x1f1)]('App\x20\x22'+_0x19b6d4+'\x22\x20not\x20found.',_0x2ae097);}assertValidAppcode(String(_0x1c1afa));const _0x505886={..._0x160095,..._0x92c0f8,'appcode':String(_0x1c1afa),...collectWorkspaceProfileOverrides(_0x261bac)};return _0x4bd5c7[_0x19b6d4]=_0x505886,_0xe85e6c[_0x1ce5cf(0x1c4)]=_0x4bd5c7,normalizeStoredDefaultApp(_0xe85e6c,_0x19b6d4),delete _0xe85e6c['appcode'],delete _0xe85e6c[_0x1ce5cf(0x1bf)],_0x505886['env']&&(_0xe85e6c[_0x1ce5cf(0x1ef)]=_0x505886[_0x1ce5cf(0x1ef)]),writeConfigFile(_0x4d77dc,_0xe85e6c),{'ok':!![],'message':_0x1ce5cf(0x1f0)+(_0x56914e===_0x1ce5cf(0x1ca)?_0x1ce5cf(0x1dc):_0x1ce5cf(0x1ec))+':\x20'+_0x19b6d4+'\x20(appcode:\x20'+_0x505886[_0x1ce5cf(0x1ce)]+_0x1ce5cf(0x1c3)+_0x4d77dc+_0x1ce5cf(0x1bc),'data':{'operation':_0x1ce5cf(0x1c8)+_0x56914e,'configPath':_0x4d77dc,'app':_0x19b6d4,'appcode':_0x505886[_0x1ce5cf(0x1ce)],'env':_0x505886['env']??null,'credentialsWritten':![]}};}function a215_0x4fd7(){const _0x2c6933=['Missing\x20workspace\x20app\x20selector.','1018058lSOEgT','10ZcvRwX','2noXYJO','object','Invalid\x20appcode:\x20','str','6368329KRqwfs','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','length','updated','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','\x20workspace\x20','env','Workspace\x20','validation','deploymentSync','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','number','3734250rcfgaO','.\x20Credentials:\x20not\x20written.','isArray','keys','app','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','riskLevel','5720428yVmPAK',').\x20Config:\x20','apps','defaultFormat','locale','472MRbyoz','workspace.','\x20workspace\x20use\x20--app\x20<name>`.','init','workspace','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','436047HVZPPo','appcode','write','flag','6Hbzgcv','App\x20locale\x20for\x20this\x20workspace\x20app\x20profile\x20(not\x20CLI\x20language;\x20reserved\x20for\x20later\x20app\x20use)','440608McNxuY','join','\x20--app\x20','Use\x20`','trim','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','string','use','pageSize','initialized','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','format','apiDir','150624KPxwod','Target\x20environment'];a215_0x4fd7=function(){return _0x2c6933;};return a215_0x4fd7();}const workspaceInitDefinition={'service':a215_0x2ee0a9(0x1cb),'command':a215_0x2ee0a9(0x1ca),'description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':a215_0x2ee0a9(0x1cf),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x558f0a=>configureWorkspace(_0x558f0a,a215_0x2ee0a9(0x1ca))},workspaceUseDefinition={'service':a215_0x2ee0a9(0x1cb),'command':a215_0x2ee0a9(0x1da),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':a215_0x2ee0a9(0x1cf),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x2ece4d=>configureWorkspace(_0x2ece4d,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a216_0x866b4d=a216_0x2149;function a216_0x5824(){const _0x39e5a0=['workspace','workspace\x20remove','164773lxgsyP','write','24kNYIVC','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','6519684BlNxTf','5mufEzD','remove','52bnPUlQ','340278dMekAr','name','300210JbpfbG','App\x20profile\x20name\x20to\x20remove','11pDnmOA','9pYPTMr','233814tJEtRa','23697UBnqNs','443740VzFDak'];a216_0x5824=function(){return _0x39e5a0;};return a216_0x5824();}function a216_0x2149(_0x3c3e2d,_0x189b9b){_0x3c3e2d=_0x3c3e2d-0x129;const _0x58249c=a216_0x5824();let _0x2149a1=_0x58249c[_0x3c3e2d];return _0x2149a1;}(function(_0x390c59,_0x4d361e){const _0x3fb5aa=a216_0x2149,_0x1c880e=_0x390c59();while(!![]){try{const _0x73d6b9=-parseInt(_0x3fb5aa(0x12b))/0x1+parseInt(_0x3fb5aa(0x136))/0x2+-parseInt(_0x3fb5aa(0x12a))/0x3*(parseInt(_0x3fb5aa(0x135))/0x4)+parseInt(_0x3fb5aa(0x133))/0x5*(parseInt(_0x3fb5aa(0x129))/0x6)+-parseInt(_0x3fb5aa(0x12e))/0x7*(-parseInt(_0x3fb5aa(0x130))/0x8)+-parseInt(_0x3fb5aa(0x13b))/0x9*(parseInt(_0x3fb5aa(0x138))/0xa)+parseInt(_0x3fb5aa(0x13a))/0xb*(parseInt(_0x3fb5aa(0x132))/0xc);if(_0x73d6b9===_0x4d361e)break;else _0x1c880e['push'](_0x1c880e['shift']());}catch(_0x1a3865){_0x1c880e['push'](_0x1c880e['shift']());}}}(a216_0x5824,0x3c338));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a216_0x866b4d(0x12c),'command':a216_0x866b4d(0x134),'description':a216_0x866b4d(0x131),'risk':a216_0x866b4d(0x12f),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a216_0x866b4d(0x137),'description':a216_0x866b4d(0x139),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x271bf6=>validateAppName(_0x271bf6,a216_0x866b4d(0x12d)),'execute':_0x1ef26c=>runAppRemove(_0x1ef26c,a216_0x866b4d(0x12d))};
|