@lovrabet/rabetbase-cli 2.4.4-beta.1 → 2.4.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.d.ts +1 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/{permit/index.d.ts → dataset/business-groups.d.ts} +1 -1
- package/lib/commands/dataset/business-groups.js +1 -0
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.d.ts +15 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/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/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/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/react/create.js +1 -1
- package/lib/commands/page/react/detail.js +1 -1
- package/lib/commands/page/react/list.js +1 -1
- package/lib/commands/page/react/publish.js +1 -1
- package/lib/commands/page/react/shared.js +1 -1
- package/lib/commands/page/react/syntax.js +1 -1
- package/lib/commands/page/react/template.js +1 -1
- package/lib/commands/page/react/update.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/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.d.ts +15 -17
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +70 -79
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.d.ts +1 -0
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +18 -24
- package/skills/rabetbase/guides/database-connection-workflow.md +6 -2
- package/skills/rabetbase/references/rabetbase-dataset-business-groups.md +28 -0
- package/skills/rabetbase/references/rabetbase-dataset-delete.md +7 -5
- package/skills/rabetbase/references/rabetbase-dataset-list.md +6 -6
- package/skills/rabetbase/references/rabetbase-dataset-restore.md +5 -5
- package/skills/rabetbase/references/rabetbase-db-create.md +3 -0
- package/skills/rabetbase/references/rabetbase-db-delete.md +10 -2
- package/skills/rabetbase/references/rabetbase-db-detail.md +2 -0
- package/skills/rabetbase/references/rabetbase-db-list.md +3 -2
- package/skills/rabetbase/references/rabetbase-db-update.md +4 -2
- package/skills/rabetbase/references/rabetbase-role-list.md +9 -17
- package/skills/rabetbase/references/rabetbase-role-user-add.md +44 -16
- package/skills/rabetbase/references/rabetbase-role-user-resolve.md +2 -2
- package/skills/rabetbase.manifest.json +4 -7
- package/lib/commands/permit/index.js +0 -1
- package/lib/commands/permit/page-get.d.ts +0 -2
- package/lib/commands/permit/page-get.js +0 -1
- package/lib/commands/permit/page-set.d.ts +0 -2
- package/lib/commands/permit/page-set.js +0 -1
- package/lib/commands/permit/role-apis-set.d.ts +0 -2
- package/lib/commands/permit/role-apis-set.js +0 -1
- package/lib/commands/permit/role-menus-set.d.ts +0 -2
- package/lib/commands/permit/role-menus-set.js +0 -1
- package/lib/commands/permit/role-menus.d.ts +0 -2
- package/lib/commands/permit/role-menus.js +0 -1
- package/lib/commands/permit/shared.d.ts +0 -74
- package/lib/commands/permit/shared.js +0 -1
- package/lib/commands/role/create.d.ts +0 -2
- package/lib/commands/role/create.js +0 -1
- package/skills/rabetbase/guides/role-permit-workflow.md +0 -127
- package/skills/rabetbase/references/rabetbase-permit-page-set.md +0 -69
- package/skills/rabetbase/references/rabetbase-permit-role-apis-set.md +0 -53
- package/skills/rabetbase/references/rabetbase-permit-role-menus-set.md +0 -57
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a197_0x226a4a=a197_0x2956;(function(_0x63f39a,_0x4243d4){const _0x8f1cb6=a197_0x2956,_0x5ecdb6=_0x63f39a();while(!![]){try{const _0x58fbd6=-parseInt(_0x8f1cb6(0x93))/0x1+-parseInt(_0x8f1cb6(0xbe))/0x2+-parseInt(_0x8f1cb6(0x9c))/0x3+parseInt(_0x8f1cb6(0x98))/0x4*(parseInt(_0x8f1cb6(0xca))/0x5)+-parseInt(_0x8f1cb6(0xc9))/0x6+parseInt(_0x8f1cb6(0xc6))/0x7+-parseInt(_0x8f1cb6(0xa5))/0x8*(-parseInt(_0x8f1cb6(0xbd))/0x9);if(_0x58fbd6===_0x4243d4)break;else _0x5ecdb6['push'](_0x5ecdb6['shift']());}catch(_0x2c4e95){_0x5ecdb6['push'](_0x5ecdb6['shift']());}}}(a197_0x3e82,0xe0b70));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a197_0x2956(_0x267d55,_0x1a38ff){_0x267d55=_0x267d55-0x91;const _0x3e825d=a197_0x3e82();let _0x295627=_0x3e825d[_0x267d55];return _0x295627;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x258785,_0x411dfc){const _0x546146=a197_0x2956,_0x59b7b8=[];let _0x1b9864=0x1;while(!![]){const _0xd9d97=await listSqlQueries(_0x258785,{'currentPage':_0x1b9864,'pageSize':PAGE_SIZE,'sqlCode':_0x411dfc[_0x546146(0xa3)],'sqlName':_0x411dfc[_0x546146(0xa8)]}),_0x50859a=_0xd9d97[_0x546146(0xac)]??[];_0x59b7b8['push'](..._0x50859a);if(_0x50859a[_0x546146(0x9d)]===0x0)break;const _0x4ed2aa=_0xd9d97[_0x546146(0xb6)]?.[_0x546146(0xa9)];if(_0x4ed2aa!=null?_0x59b7b8[_0x546146(0x9d)]>=_0x4ed2aa:_0x50859a[_0x546146(0x9d)]<PAGE_SIZE)break;_0x1b9864++;}return _0x59b7b8;}async function ensureSqlContent(_0x115c18){const _0x120fdd=a197_0x2956;if(_0x115c18['sqlContent']!=null&&String(_0x115c18['sqlContent'])[_0x120fdd(0x9d)]>0x0)return _0x115c18;return getSqlQueryDetail(_0x115c18[_0x120fdd(0xa3)]);}export const sqlPull={'service':'sql','command':'pull','description':a197_0x226a4a(0x94),'risk':a197_0x226a4a(0xab),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a197_0x226a4a(0xb4),'description':a197_0x226a4a(0xc0)},{'name':a197_0x226a4a(0x91),'type':'boolean','description':a197_0x226a4a(0xce)}],async 'dryRun'(_0x3976c1){const _0x5c0b99=a197_0x226a4a,_0x52c31d=loadSqlProjectConfig(_0x3976c1[_0x5c0b99(0xba)]),_0x5cb7b5=await readSqlLockFile(_0x52c31d['lockFilePath']),{appLock:_0xe09721}=ensureSqlLockScope(_0x5cb7b5??createEmptySqlLock(),_0x52c31d['appCode'],_0x52c31d[_0x5c0b99(0xa2)],_0x5c0b99(0x92)),_0x15227c=await fetchAllSqlQueries(_0x3976c1['appCode'],{'sqlCode':_0x3976c1[_0x5c0b99(0xcd)](_0x5c0b99(0x96))||undefined,'sqlName':_0x3976c1['str'](_0x5c0b99(0xb0))||undefined}),_0x4e4932=[];for(const _0xb4a57f of _0x15227c){const _0x3cc8d3=await ensureSqlContent(_0xb4a57f),_0x3bcd84=ensureRemoteSqlContent(_0x3cc8d3),_0x2e0372=detectModeFromSql(_0x3cc8d3),_0x53beb5=_0x3cc8d3[_0x5c0b99(0xbb)]?await getDbName(_0x3976c1[_0x5c0b99(0xba)],Number(_0x3cc8d3['dbId']))[_0x5c0b99(0xb2)](()=>undefined):undefined,_0x3e5654=buildLocalSqlFileContent({'sqlCode':_0x3cc8d3[_0x5c0b99(0xa3)],'sqlName':_0x3cc8d3['sqlName'],'dbId':_0x3cc8d3[_0x5c0b99(0xbb)]},_0x3bcd84,{'dbName':_0x53beb5,'mode':_0x2e0372,'syncedAt':new Date()['toISOString'](),'description':_0x3cc8d3[_0x5c0b99(0x9b)]}),_0x4066eb=buildSqlLockEntry(_0x3cc8d3,_0x3bcd84,'',{'dbName':_0x53beb5}),_0x316fa4=resolveLocalSqlFilePath(_0x52c31d,_0x3cc8d3[_0x5c0b99(0xa3)],_0x4066eb);let _0x52e915=_0x5c0b99(0xa4),_0x5d1f88;if(await fileExists(_0x316fa4)){const _0x40b47f=await readFile(_0x316fa4,_0x5c0b99(0xaf));isEquivalentPulledSqlFile(_0x40b47f,_0x3e5654,_0x2e0372)?(_0x52e915=_0x5c0b99(0xc1),_0x5d1f88=_0x5c0b99(0xaa)):(_0x52e915=_0x5c0b99(0xa7),_0x5d1f88=_0x5c0b99(0xcb));}_0x4e4932[_0x5c0b99(0xbc)]({'sqlCode':_0x3cc8d3[_0x5c0b99(0xa3)],'sqlName':_0x3cc8d3[_0x5c0b99(0xa8)],'filePath':_0x316fa4,'status':_0x52e915,'reason':_0x5d1f88});}return{'method':_0x5c0b99(0x9f),'url':_0x5c0b99(0x9a),'body':{'appCode':_0x3976c1['appCode'],'sqlCode':_0x3976c1[_0x5c0b99(0xcd)](_0x5c0b99(0x96))||null,'sqlName':_0x3976c1[_0x5c0b99(0xcd)](_0x5c0b99(0xb0))||null,'files':_0x4e4932},'description':_0x5c0b99(0xbf)+_0x4e4932['length']+_0x5c0b99(0x97)+_0x52c31d['sqlRootDir']};},async 'execute'(_0x3388be){const _0x2b360d=a197_0x226a4a,_0x2d8a60=loadSqlProjectConfig(_0x3388be['appCode']),_0x23c595=await readSqlLockFile(_0x2d8a60['lockFilePath']),{lockData:_0x4d3618,appLock:_0xbd9ba1}=ensureSqlLockScope(_0x23c595??createEmptySqlLock(),_0x2d8a60[_0x2b360d(0xba)],_0x2d8a60[_0x2b360d(0xa2)],_0x2b360d(0x92)),_0x4cbb66=_0x3388be[_0x2b360d(0xb3)](_0x2b360d(0x91)),_0x451d59=await fetchAllSqlQueries(_0x3388be[_0x2b360d(0xba)],{'sqlCode':_0x3388be[_0x2b360d(0xcd)](_0x2b360d(0x96))||undefined,'sqlName':_0x3388be[_0x2b360d(0xcd)](_0x2b360d(0xb0))||undefined});if(_0x451d59['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2b360d(0xa0)};const _0x2da7bb=[],_0xd0a2e2=[];for(const _0x20d831 of _0x451d59){try{_0x2da7bb[_0x2b360d(0xbc)](await ensureSqlContent(_0x20d831));}catch(_0x321a6b){_0xd0a2e2[_0x2b360d(0xbc)]({'sqlCode':_0x20d831['sqlCode'],'error':_0x321a6b instanceof Error?_0x321a6b[_0x2b360d(0x9e)]:String(_0x321a6b)});}}if(_0x4cbb66&&!_0x3388be[_0x2b360d(0xad)]){let _0x2700c3=![];for(const _0x40776f of _0x2da7bb){const _0x10c2cd=detectModeFromSql(_0x40776f),_0x12dda1=_0x40776f['dbId']?await getDbName(_0x3388be[_0x2b360d(0xba)],Number(_0x40776f[_0x2b360d(0xbb)]))[_0x2b360d(0xb2)](()=>undefined):undefined,_0x202531=buildLocalSqlFileContent({'sqlCode':_0x40776f[_0x2b360d(0xa3)],'sqlName':_0x40776f[_0x2b360d(0xa8)],'dbId':_0x40776f[_0x2b360d(0xbb)]},ensureRemoteSqlContent(_0x40776f),{'dbName':_0x12dda1,'mode':_0x10c2cd,'syncedAt':new Date()['toISOString'](),'description':_0x40776f[_0x2b360d(0x9b)]}),_0x3b142f=resolveLocalSqlFilePath(_0x2d8a60,_0x40776f['sqlCode'],buildSqlLockEntry(_0x40776f,ensureRemoteSqlContent(_0x40776f),'',{'dbName':_0x12dda1}));if(await fileExists(_0x3b142f)){const _0x3df556=await readFile(_0x3b142f,_0x2b360d(0xaf));if(!isEquivalentPulledSqlFile(_0x3df556,_0x202531,_0x10c2cd)){_0x2700c3=!![];break;}}}if(_0x2700c3){const _0x1f5472=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1f5472)throw CliErrors[_0x2b360d(0xae)](_0x2b360d(0xa1));}}const _0x22c732=cloneSqlLockData(_0x4d3618),_0x5e8f5f=_0x22c732[_0x2b360d(0xc4)][_0x2d8a60[_0x2b360d(0xba)]],_0x5e20d4=[],_0x393236=[];for(const _0x1bbbd6 of _0x2da7bb){const _0x865035=_0x5e8f5f['sqls'][_0x1bbbd6['sqlCode']],_0x16f245=ensureRemoteSqlContent(_0x1bbbd6),_0x262550=detectModeFromSql(_0x1bbbd6),_0x8c6344=_0x1bbbd6[_0x2b360d(0xbb)]?await getDbName(_0x3388be[_0x2b360d(0xba)],Number(_0x1bbbd6[_0x2b360d(0xbb)]))[_0x2b360d(0xb2)](()=>undefined):undefined,_0x4b9ee8=buildLocalSqlFileContent({'sqlCode':_0x1bbbd6['sqlCode'],'sqlName':_0x1bbbd6['sqlName'],'dbId':_0x1bbbd6[_0x2b360d(0xbb)]},_0x16f245,{'dbName':_0x8c6344,'mode':_0x262550,'syncedAt':new Date()[_0x2b360d(0xb8)](),'description':_0x1bbbd6['description']}),_0x3fe226=buildSqlLockEntry(_0x1bbbd6,_0x16f245,computeSqlContentHash(_0x4b9ee8),{'dbName':_0x8c6344}),_0x24b5f8=_0x3fe226['path'],_0x197543=join(_0x2d8a60[_0x2b360d(0x95)],_0x24b5f8);try{if(await fileExists(_0x197543)){const _0x534106=await readFile(_0x197543,_0x2b360d(0xaf));if(isEquivalentPulledSqlFile(_0x534106,_0x4b9ee8,_0x262550)){_0x393236['push']({'sqlCode':_0x1bbbd6[_0x2b360d(0xa3)],'reason':_0x2b360d(0xaa)}),_0x5e8f5f[_0x2b360d(0xb1)][_0x1bbbd6[_0x2b360d(0xa3)]]={..._0x3fe226,'hash':computeSqlContentHash(_0x534106),'path':_0x24b5f8};continue;}if(!_0x4cbb66){_0x393236['push']({'sqlCode':_0x1bbbd6[_0x2b360d(0xa3)],'reason':_0x2b360d(0xc5)});continue;}}const _0x5b222e=_0x865035?.[_0x2b360d(0xd0)]?join(_0x2d8a60[_0x2b360d(0x95)],_0x865035[_0x2b360d(0xd0)]):undefined;_0x5b222e&&_0x5b222e!==_0x197543&&await fileExists(_0x5b222e)&&await rm(_0x5b222e,{'force':!![]}),await ensureParentDirectory(_0x197543),await writeFile(_0x197543,_0x4b9ee8,_0x2b360d(0xaf)),_0x5e8f5f[_0x2b360d(0xb1)][_0x1bbbd6[_0x2b360d(0xa3)]]={..._0x3fe226,'path':_0x24b5f8},_0x5e20d4['push']({'sqlCode':_0x1bbbd6[_0x2b360d(0xa3)],'filePath':_0x197543});}catch(_0x1f103b){_0xd0a2e2[_0x2b360d(0xbc)]({'sqlCode':_0x1bbbd6[_0x2b360d(0xa3)],'error':_0x1f103b instanceof Error?_0x1f103b[_0x2b360d(0x9e)]:String(_0x1f103b)});}}return _0x5e8f5f['lastSync']=new Date()[_0x2b360d(0xb8)](),await writeSqlLockFile(_0x2d8a60[_0x2b360d(0xcc)],_0x22c732),{'ok':_0xd0a2e2['length']===0x0,'data':{'pulled':_0x5e20d4,'skipped':_0x393236,'failed':_0xd0a2e2},'message':'Pull\x20complete:\x20'+_0x5e20d4['length']+_0x2b360d(0xa6)+_0x393236[_0x2b360d(0x9d)]+_0x2b360d(0xc3)+_0xd0a2e2['length']+_0x2b360d(0xc2)};}};function detectModeFromSql(_0x571162){const _0x2e3625=a197_0x226a4a,_0x5ca7b6=ensureRemoteSqlContent(_0x571162),_0x415221=stripLocalSqlMetadata(_0x5ca7b6,_0x2e3625(0x99))[_0x2e3625(0xc8)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x415221))return'mybatisXml';return _0x2e3625(0xcf);}function isEquivalentPulledSqlFile(_0x4bb0d3,_0x3acdc3,_0x442026){return normalizePullComparableContent(_0x4bb0d3,_0x442026)===normalizePullComparableContent(_0x3acdc3,_0x442026);}function normalizePullComparableContent(_0x1e0217,_0x44009e){const _0x465998=a197_0x226a4a,_0x11af7f=_0x1e0217['replace'](/\r\n/g,'\x0a')[_0x465998(0xc7)]('\x0a'),_0x20e66b=_0x11af7f[_0x465998(0xb5)](_0x1de9e7=>!isSyncedAtMetadataLine(_0x1de9e7,_0x44009e));return _0x20e66b[_0x465998(0xb7)]('\x0a');}function a197_0x3e82(){const _0x6e94=['push','18891ONhHCA','3400306kDkmtc','Would\x20pull\x20','Filter\x20by\x20SQL\x20display\x20name','skipped','\x20failed','\x20skipped,\x20','apps','local\x20differs\x20from\x20remote','7590079NEVIQD','split','trimStart','10638228QEYVdJ','815PipCsZ','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','lockFilePath','str','Force\x20overwrite\x20local\x20unsynced\x20changes','sql','path','force','pull','859283esNpzL','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlRootDir','sqlcode','\x20SQL\x20file(s)\x20into\x20','31760mNbJmd','mybatisXml','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','description','1401657ZSVOHO','length','message','POST','No\x20remote\x20SQL\x20queries\x20matched.','Force\x20pull\x20cancelled.','sqlRoot','sqlCode','would_pull','12736AvYDnv','\x20written,\x20','conflict','sqlName','totalCount','unchanged','read','tableData','nonInteractive','cancelled','utf8','name','sqls','catch','bool','string','filter','paging','join','toISOString','test','appCode','dbId'];a197_0x3e82=function(){return _0x6e94;};return a197_0x3e82();}function isSyncedAtMetadataLine(_0x4c9fcc,_0x259240){const _0x394487=a197_0x226a4a;if(_0x259240===_0x394487(0x99))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x4c9fcc);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x394487(0xb9)](_0x4c9fcc);}
|
|
1
|
+
const a190_0x5c4c7e=a190_0x7294;(function(_0x4de3ac,_0x477541){const _0x20129e=a190_0x7294,_0x23423f=_0x4de3ac();while(!![]){try{const _0x42dbaf=-parseInt(_0x20129e(0xd6))/0x1*(-parseInt(_0x20129e(0x9b))/0x2)+-parseInt(_0x20129e(0xad))/0x3+parseInt(_0x20129e(0xcc))/0x4+parseInt(_0x20129e(0xae))/0x5*(-parseInt(_0x20129e(0xa2))/0x6)+-parseInt(_0x20129e(0xbc))/0x7*(-parseInt(_0x20129e(0xc5))/0x8)+parseInt(_0x20129e(0xca))/0x9+-parseInt(_0x20129e(0xc2))/0xa;if(_0x42dbaf===_0x477541)break;else _0x23423f['push'](_0x23423f['shift']());}catch(_0xe72829){_0x23423f['push'](_0x23423f['shift']());}}}(a190_0x2bef,0xcfacd));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';function a190_0x2bef(){const _0x1fabdb=['push','split','\x20failed','sqlRootDir','sqlName','lockFilePath','path','sqlCode','Force\x20pull\x20cancelled.','conflict','string','Force\x20overwrite\x20local\x20unsynced\x20changes','test','7tuiGQr','sqlcode','lastSync','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','length','21081810aJbKrT','description','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','9628568XVJTvY','catch','No\x20remote\x20SQL\x20queries\x20matched.','Pull\x20complete:\x20','totalCount','8418267gzNpXY','cancelled','6384036FMyGwl','filter','trimStart','\x20written,\x20','replace','sqls','Would\x20pull\x20','message','\x20SQL\x20file(s)\x20into\x20','force','177zvDyJh','POST','unchanged','nonInteractive','Filter\x20by\x20SQL\x20display\x20name','18074KAzfML','toISOString','paging','name','dbId','skipped','sqlRoot','6vjswqV','utf8','str','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqlContent','appCode','sql','tableData','mybatisXml','pull','bool','2999655KUFfpc','6878945hscaQW'];a190_0x2bef=function(){return _0x1fabdb;};return a190_0x2bef();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x2fd1d3,_0x1c5498){const _0x41e7d1=a190_0x7294,_0x25ed69=[];let _0x354bb4=0x1;while(!![]){const _0x89dad2=await listSqlQueries(_0x2fd1d3,{'currentPage':_0x354bb4,'pageSize':PAGE_SIZE,'sqlCode':_0x1c5498[_0x41e7d1(0xb6)],'sqlName':_0x1c5498['sqlName']}),_0x27d917=_0x89dad2[_0x41e7d1(0xa9)]??[];_0x25ed69[_0x41e7d1(0xaf)](..._0x27d917);if(_0x27d917[_0x41e7d1(0xc1)]===0x0)break;const _0x3434c7=_0x89dad2[_0x41e7d1(0x9d)]?.[_0x41e7d1(0xc9)];if(_0x3434c7!=null?_0x25ed69['length']>=_0x3434c7:_0x27d917[_0x41e7d1(0xc1)]<PAGE_SIZE)break;_0x354bb4++;}return _0x25ed69;}async function ensureSqlContent(_0x34626e){const _0x4bf46=a190_0x7294;if(_0x34626e[_0x4bf46(0xa6)]!=null&&String(_0x34626e[_0x4bf46(0xa6)])[_0x4bf46(0xc1)]>0x0)return _0x34626e;return getSqlQueryDetail(_0x34626e['sqlCode']);}export const sqlPull={'service':a190_0x5c4c7e(0xa8),'command':a190_0x5c4c7e(0xab),'description':a190_0x5c4c7e(0xc4),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x5c4c7e(0x9e),'type':a190_0x5c4c7e(0xb9),'description':a190_0x5c4c7e(0x9a)},{'name':a190_0x5c4c7e(0xd5),'type':'boolean','description':a190_0x5c4c7e(0xba)}],async 'dryRun'(_0x142d9f){const _0x246c06=a190_0x5c4c7e,_0x2d8575=loadSqlProjectConfig(_0x142d9f[_0x246c06(0xa7)]),_0x9573af=await readSqlLockFile(_0x2d8575[_0x246c06(0xb4)]),{appLock:_0x60ff09}=ensureSqlLockScope(_0x9573af??createEmptySqlLock(),_0x2d8575[_0x246c06(0xa7)],_0x2d8575[_0x246c06(0xa1)],_0x246c06(0xab)),_0x507ba7=await fetchAllSqlQueries(_0x142d9f[_0x246c06(0xa7)],{'sqlCode':_0x142d9f['str'](_0x246c06(0xbd))||undefined,'sqlName':_0x142d9f[_0x246c06(0xa4)](_0x246c06(0x9e))||undefined}),_0x5edef4=[];for(const _0x1a9610 of _0x507ba7){const _0x208496=await ensureSqlContent(_0x1a9610),_0x2787b8=ensureRemoteSqlContent(_0x208496),_0x4c7c95=detectModeFromSql(_0x208496),_0xf9e835=_0x208496[_0x246c06(0x9f)]?await getDbName(_0x142d9f[_0x246c06(0xa7)],Number(_0x208496[_0x246c06(0x9f)]))['catch'](()=>undefined):undefined,_0x2476a7=buildLocalSqlFileContent({'sqlCode':_0x208496[_0x246c06(0xb6)],'sqlName':_0x208496['sqlName'],'dbId':_0x208496[_0x246c06(0x9f)]},_0x2787b8,{'dbName':_0xf9e835,'mode':_0x4c7c95,'syncedAt':new Date()[_0x246c06(0x9c)](),'description':_0x208496[_0x246c06(0xc3)]}),_0x57ce45=buildSqlLockEntry(_0x208496,_0x2787b8,'',{'dbName':_0xf9e835}),_0x26b88d=resolveLocalSqlFilePath(_0x2d8575,_0x208496[_0x246c06(0xb6)],_0x57ce45);let _0x22eda9='would_pull',_0x3adbc9;if(await fileExists(_0x26b88d)){const _0x400736=await readFile(_0x26b88d,_0x246c06(0xa3));isEquivalentPulledSqlFile(_0x400736,_0x2476a7,_0x4c7c95)?(_0x22eda9=_0x246c06(0xa0),_0x3adbc9=_0x246c06(0x98)):(_0x22eda9=_0x246c06(0xb8),_0x3adbc9=_0x246c06(0xc0));}_0x5edef4['push']({'sqlCode':_0x208496[_0x246c06(0xb6)],'sqlName':_0x208496[_0x246c06(0xb3)],'filePath':_0x26b88d,'status':_0x22eda9,'reason':_0x3adbc9});}return{'method':_0x246c06(0x97),'url':_0x246c06(0xbf),'body':{'appCode':_0x142d9f[_0x246c06(0xa7)],'sqlCode':_0x142d9f[_0x246c06(0xa4)](_0x246c06(0xbd))||null,'sqlName':_0x142d9f[_0x246c06(0xa4)](_0x246c06(0x9e))||null,'files':_0x5edef4},'description':_0x246c06(0xd2)+_0x5edef4[_0x246c06(0xc1)]+_0x246c06(0xd4)+_0x2d8575['sqlRootDir']};},async 'execute'(_0x52f4b4){const _0xd8eac9=a190_0x5c4c7e,_0x3a17ad=loadSqlProjectConfig(_0x52f4b4[_0xd8eac9(0xa7)]),_0x35d7ea=await readSqlLockFile(_0x3a17ad[_0xd8eac9(0xb4)]),{lockData:_0x3d42cb,appLock:_0x5b20f0}=ensureSqlLockScope(_0x35d7ea??createEmptySqlLock(),_0x3a17ad[_0xd8eac9(0xa7)],_0x3a17ad[_0xd8eac9(0xa1)],_0xd8eac9(0xab)),_0x461bae=_0x52f4b4[_0xd8eac9(0xac)](_0xd8eac9(0xd5)),_0x57163a=await fetchAllSqlQueries(_0x52f4b4[_0xd8eac9(0xa7)],{'sqlCode':_0x52f4b4[_0xd8eac9(0xa4)]('sqlcode')||undefined,'sqlName':_0x52f4b4['str'](_0xd8eac9(0x9e))||undefined});if(_0x57163a[_0xd8eac9(0xc1)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xd8eac9(0xc7)};const _0x20531b=[],_0x1dfd42=[];for(const _0x58db78 of _0x57163a){try{_0x20531b[_0xd8eac9(0xaf)](await ensureSqlContent(_0x58db78));}catch(_0x44a8c9){_0x1dfd42[_0xd8eac9(0xaf)]({'sqlCode':_0x58db78[_0xd8eac9(0xb6)],'error':_0x44a8c9 instanceof Error?_0x44a8c9[_0xd8eac9(0xd3)]:String(_0x44a8c9)});}}if(_0x461bae&&!_0x52f4b4[_0xd8eac9(0x99)]){let _0x545d8f=![];for(const _0x347e23 of _0x20531b){const _0x58a42b=detectModeFromSql(_0x347e23),_0x27e1fc=_0x347e23['dbId']?await getDbName(_0x52f4b4[_0xd8eac9(0xa7)],Number(_0x347e23['dbId']))['catch'](()=>undefined):undefined,_0x19acac=buildLocalSqlFileContent({'sqlCode':_0x347e23[_0xd8eac9(0xb6)],'sqlName':_0x347e23[_0xd8eac9(0xb3)],'dbId':_0x347e23[_0xd8eac9(0x9f)]},ensureRemoteSqlContent(_0x347e23),{'dbName':_0x27e1fc,'mode':_0x58a42b,'syncedAt':new Date()[_0xd8eac9(0x9c)](),'description':_0x347e23[_0xd8eac9(0xc3)]}),_0x192169=resolveLocalSqlFilePath(_0x3a17ad,_0x347e23[_0xd8eac9(0xb6)],buildSqlLockEntry(_0x347e23,ensureRemoteSqlContent(_0x347e23),'',{'dbName':_0x27e1fc}));if(await fileExists(_0x192169)){const _0x6a60cb=await readFile(_0x192169,_0xd8eac9(0xa3));if(!isEquivalentPulledSqlFile(_0x6a60cb,_0x19acac,_0x58a42b)){_0x545d8f=!![];break;}}}if(_0x545d8f){const _0x26577c=await confirmForceOverwrite(_0xd8eac9(0xa5));if(!_0x26577c)throw CliErrors[_0xd8eac9(0xcb)](_0xd8eac9(0xb7));}}const _0x1a4242=cloneSqlLockData(_0x3d42cb),_0x1291e9=_0x1a4242['apps'][_0x3a17ad[_0xd8eac9(0xa7)]],_0x532879=[],_0x2be333=[];for(const _0x37657b of _0x20531b){const _0x885738=_0x1291e9['sqls'][_0x37657b['sqlCode']],_0x1cb4b2=ensureRemoteSqlContent(_0x37657b),_0x4ef760=detectModeFromSql(_0x37657b),_0x2c76a0=_0x37657b[_0xd8eac9(0x9f)]?await getDbName(_0x52f4b4[_0xd8eac9(0xa7)],Number(_0x37657b[_0xd8eac9(0x9f)]))[_0xd8eac9(0xc6)](()=>undefined):undefined,_0x5a0f10=buildLocalSqlFileContent({'sqlCode':_0x37657b[_0xd8eac9(0xb6)],'sqlName':_0x37657b[_0xd8eac9(0xb3)],'dbId':_0x37657b['dbId']},_0x1cb4b2,{'dbName':_0x2c76a0,'mode':_0x4ef760,'syncedAt':new Date()[_0xd8eac9(0x9c)](),'description':_0x37657b[_0xd8eac9(0xc3)]}),_0x49c454=buildSqlLockEntry(_0x37657b,_0x1cb4b2,computeSqlContentHash(_0x5a0f10),{'dbName':_0x2c76a0}),_0x297909=_0x49c454[_0xd8eac9(0xb5)],_0x39cc7d=join(_0x3a17ad[_0xd8eac9(0xb2)],_0x297909);try{if(await fileExists(_0x39cc7d)){const _0x12d745=await readFile(_0x39cc7d,'utf8');if(isEquivalentPulledSqlFile(_0x12d745,_0x5a0f10,_0x4ef760)){_0x2be333[_0xd8eac9(0xaf)]({'sqlCode':_0x37657b[_0xd8eac9(0xb6)],'reason':_0xd8eac9(0x98)}),_0x1291e9[_0xd8eac9(0xd1)][_0x37657b[_0xd8eac9(0xb6)]]={..._0x49c454,'hash':computeSqlContentHash(_0x12d745),'path':_0x297909};continue;}if(!_0x461bae){_0x2be333[_0xd8eac9(0xaf)]({'sqlCode':_0x37657b[_0xd8eac9(0xb6)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x19eb4d=_0x885738?.[_0xd8eac9(0xb5)]?join(_0x3a17ad[_0xd8eac9(0xb2)],_0x885738[_0xd8eac9(0xb5)]):undefined;_0x19eb4d&&_0x19eb4d!==_0x39cc7d&&await fileExists(_0x19eb4d)&&await rm(_0x19eb4d,{'force':!![]}),await ensureParentDirectory(_0x39cc7d),await writeFile(_0x39cc7d,_0x5a0f10,_0xd8eac9(0xa3)),_0x1291e9[_0xd8eac9(0xd1)][_0x37657b[_0xd8eac9(0xb6)]]={..._0x49c454,'path':_0x297909},_0x532879[_0xd8eac9(0xaf)]({'sqlCode':_0x37657b[_0xd8eac9(0xb6)],'filePath':_0x39cc7d});}catch(_0x2b757c){_0x1dfd42[_0xd8eac9(0xaf)]({'sqlCode':_0x37657b[_0xd8eac9(0xb6)],'error':_0x2b757c instanceof Error?_0x2b757c[_0xd8eac9(0xd3)]:String(_0x2b757c)});}}return _0x1291e9[_0xd8eac9(0xbe)]=new Date()[_0xd8eac9(0x9c)](),await writeSqlLockFile(_0x3a17ad[_0xd8eac9(0xb4)],_0x1a4242),{'ok':_0x1dfd42[_0xd8eac9(0xc1)]===0x0,'data':{'pulled':_0x532879,'skipped':_0x2be333,'failed':_0x1dfd42},'message':_0xd8eac9(0xc8)+_0x532879['length']+_0xd8eac9(0xcf)+_0x2be333[_0xd8eac9(0xc1)]+'\x20skipped,\x20'+_0x1dfd42[_0xd8eac9(0xc1)]+_0xd8eac9(0xb1)};}};function a190_0x7294(_0x565959,_0x281596){_0x565959=_0x565959-0x97;const _0x2bef08=a190_0x2bef();let _0x729484=_0x2bef08[_0x565959];return _0x729484;}function detectModeFromSql(_0x17af7b){const _0x2cce9b=a190_0x5c4c7e,_0x115633=ensureRemoteSqlContent(_0x17af7b),_0x30c554=stripLocalSqlMetadata(_0x115633,_0x2cce9b(0xaa))[_0x2cce9b(0xce)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x30c554))return _0x2cce9b(0xaa);return _0x2cce9b(0xa8);}function isEquivalentPulledSqlFile(_0x24faab,_0xb3426,_0x2efda4){return normalizePullComparableContent(_0x24faab,_0x2efda4)===normalizePullComparableContent(_0xb3426,_0x2efda4);}function normalizePullComparableContent(_0x427f37,_0x3ba846){const _0x4d751b=a190_0x5c4c7e,_0x1c2e33=_0x427f37[_0x4d751b(0xd0)](/\r\n/g,'\x0a')[_0x4d751b(0xb0)]('\x0a'),_0x38624a=_0x1c2e33[_0x4d751b(0xcd)](_0x248fb8=>!isSyncedAtMetadataLine(_0x248fb8,_0x3ba846));return _0x38624a['join']('\x0a');}function isSyncedAtMetadataLine(_0x546010,_0x200a34){const _0x4969f8=a190_0x5c4c7e;if(_0x200a34===_0x4969f8(0xaa))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4969f8(0xbb)](_0x546010);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4969f8(0xbb)](_0x546010);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a198_0x3a3914=a198_0x3075;(function(_0x4003f0,_0x5ea444){const _0x5c86b6=a198_0x3075,_0x4b26d8=_0x4003f0();while(!![]){try{const _0x4008c7=-parseInt(_0x5c86b6(0x1d0))/0x1*(-parseInt(_0x5c86b6(0x194))/0x2)+-parseInt(_0x5c86b6(0x1be))/0x3+-parseInt(_0x5c86b6(0x190))/0x4*(parseInt(_0x5c86b6(0x1af))/0x5)+parseInt(_0x5c86b6(0x19f))/0x6+-parseInt(_0x5c86b6(0x197))/0x7*(-parseInt(_0x5c86b6(0x196))/0x8)+-parseInt(_0x5c86b6(0x1b6))/0x9*(parseInt(_0x5c86b6(0x1ca))/0xa)+parseInt(_0x5c86b6(0x1a1))/0xb*(parseInt(_0x5c86b6(0x1a2))/0xc);if(_0x4008c7===_0x5ea444)break;else _0x4b26d8['push'](_0x4b26d8['shift']());}catch(_0x33c9b6){_0x4b26d8['push'](_0x4b26d8['shift']());}}}(a198_0x20fc,0x3c7e1));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';function a198_0x20fc(){const _0xc18e1e=['validation','write','dbDirectory','Local\x20SQL\x20not\x20found:\x20','243EoGKQF','utf8','No\x20local\x20SQL\x20files\x20found.','path','relativePath','force','\x20skipped,\x20','toISOString','517044upXpsJ','length','\x20pushed,\x20','sqlRoot','sqlcode','trashDir','get','lockFilePath','sqlCode','replace','sql','Push\x20local\x20SQL\x20files\x20to\x20remote','139010SNeHgs','sqlRootDir','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','dbId','filter','startsWith','1JTAwIS','lastSync','has','70044BuvpGZ','sqlName','\x22\x20for\x20sqlCode\x20','/smartapi/custom/updateUserCustomSql','218872TmBDrb','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','8WWGPmI','2706844WGJNNO','\x20failed','sqls','version','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','Would\x20push\x20','\x20SQL\x20file(s)','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','366882RRFkQU','catch','6279746lopDPR','12PzGlmH','unchanged','remoteId','mode','filePath','exec','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','appCode','push','POST','Local\x20directory\x20\x22','sqlConfig','boolean','95LshpEl','dbName','bool'];a198_0x20fc=function(){return _0xc18e1e;};return a198_0x20fc();}function a198_0x3075(_0xd30f0e,_0x38ddca){_0xd30f0e=_0xd30f0e-0x190;const _0x20fce2=a198_0x20fc();let _0x30754c=_0x20fce2[_0xd30f0e];return _0x30754c;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x3f5e86,_0x169c6f,_0x390510){const _0x55626e=a198_0x3075,_0x2ec9df=await scanLocalSqlQueries(_0x3f5e86),_0x18d4d8=new Map();for(const _0x588a98 of _0x2ec9df){if(_0x390510&&_0x588a98[_0x55626e(0x1c6)]!==_0x390510)continue;const _0x2afcb6=_0x18d4d8[_0x55626e(0x1c4)](_0x588a98[_0x55626e(0x1c6)])??[];_0x2afcb6['push'](_0x588a98),_0x18d4d8['set'](_0x588a98['sqlCode'],_0x2afcb6);}if(_0x390510&&!_0x18d4d8[_0x55626e(0x1d2)](_0x390510))throw CliErrors[_0x55626e(0x1b2)](_0x55626e(0x1b5)+_0x390510);const _0x45457f=[];for(const [_0x459ef7,_0x34cfbc]of _0x18d4d8['entries']()){if(_0x34cfbc['length']===0x1){_0x45457f[_0x55626e(0x1aa)](_0x34cfbc[0x0]);continue;}const _0x1aa85b=_0x169c6f['sqls'][_0x459ef7],_0x4da362=_0x1aa85b?.[_0x55626e(0x1b9)],_0x1e3525=_0x4da362?_0x34cfbc['filter'](_0x28a49a=>_0x28a49a[_0x55626e(0x1ba)]!==_0x4da362):_0x34cfbc;if(_0x1aa85b&&_0x1e3525[_0x55626e(0x1bf)]===0x1){_0x45457f[_0x55626e(0x1aa)](_0x1e3525[0x0]);continue;}throw CliErrors['validation'](_0x55626e(0x19e)+_0x459ef7+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x45457f;}export const sqlPush={'service':a198_0x3a3914(0x1c8),'command':a198_0x3a3914(0x1aa),'description':a198_0x3a3914(0x1c9),'risk':a198_0x3a3914(0x1b3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a198_0x3a3914(0x1bb),'type':a198_0x3a3914(0x1ae),'description':a198_0x3a3914(0x1a8)}],async 'dryRun'(_0xcf2cb1){const _0x3501d8=a198_0x3a3914,_0x2a4b95=loadSqlProjectConfig(_0xcf2cb1['appCode']),_0x5c82ca=await readSqlLockFile(_0x2a4b95[_0x3501d8(0x1c5)]),{appLock:_0x2265c1}=ensureSqlLockScope(_0x5c82ca??createEmptySqlLock(),_0xcf2cb1[_0x3501d8(0x1a9)],_0x2a4b95[_0x3501d8(0x1c1)],_0x3501d8(0x1aa)),_0x2fc523=await getTargetSqlQueries(_0x2a4b95,_0x2265c1,_0xcf2cb1['str'](_0x3501d8(0x1c2))||undefined),_0x541f39=[];for(const _0x387ec4 of _0x2fc523){const _0x198b17=await computeSqlFileHash(_0x387ec4[_0x3501d8(0x1a6)]),_0x127050=_0x2265c1['sqls'][_0x387ec4[_0x3501d8(0x1c6)]],_0x4e25ac=!!_0x127050&&(_0x127050[_0x3501d8(0x1b9)]!==_0x387ec4[_0x3501d8(0x1ba)]||!!_0x387ec4[_0x3501d8(0x191)]&&_0x127050[_0x3501d8(0x191)]!==_0x387ec4[_0x3501d8(0x191)]);if(!_0xcf2cb1[_0x3501d8(0x1b1)](_0x3501d8(0x1bb))&&_0x127050&&_0x127050['hash']===_0x198b17&&!_0x4e25ac)continue;_0x541f39['push'](_0x387ec4[_0x3501d8(0x1c6)]);}return{'method':_0x3501d8(0x1ab),'url':_0x3501d8(0x193),'body':{'sqlCodes':_0x541f39,'appCode':_0xcf2cb1[_0x3501d8(0x1a9)]},'description':_0x3501d8(0x19c)+_0x541f39['length']+_0x3501d8(0x19d)};},async 'execute'(_0x285737){const _0x19f1c7=a198_0x3a3914,_0x13f683=loadSqlProjectConfig(_0x285737['appCode']),_0x4203bd=await readSqlLockFile(_0x13f683[_0x19f1c7(0x1c5)]),{lockData:_0x7dc3e7,appLock:_0x367b82}=ensureSqlLockScope(_0x4203bd??createEmptySqlLock(),_0x285737[_0x19f1c7(0x1a9)],_0x13f683[_0x19f1c7(0x1c1)],'push'),_0x301235=await getTargetSqlQueries(_0x13f683,_0x367b82,_0x285737['str']('sqlcode')||undefined);if(_0x301235['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x19f1c7(0x1b8)};const _0x4fd794=[],_0xc58feb=[],_0x303e22=[];for(const _0x266771 of _0x301235){const _0x4ff441=_0x367b82[_0x19f1c7(0x199)][_0x266771[_0x19f1c7(0x1c6)]];if(!_0x4ff441){_0x303e22[_0x19f1c7(0x1aa)]({'sqlCode':_0x266771['sqlCode'],'error':_0x19f1c7(0x195)});continue;}try{const _0x3947a0=await computeSqlFileHash(_0x266771[_0x19f1c7(0x1a6)]),_0x1356b9=_0x4ff441[_0x19f1c7(0x1b9)]!==_0x266771[_0x19f1c7(0x1ba)]||!!_0x266771[_0x19f1c7(0x191)]&&_0x4ff441[_0x19f1c7(0x191)]!==_0x266771['sqlName'];if(!_0x285737[_0x19f1c7(0x1b1)](_0x19f1c7(0x1bb))&&_0x4ff441['hash']===_0x3947a0&&!_0x1356b9){_0xc58feb['push']({'sqlCode':_0x266771[_0x19f1c7(0x1c6)],'reason':_0x19f1c7(0x1a3)});continue;}if(_0x4ff441[_0x19f1c7(0x19a)]==null){_0x303e22[_0x19f1c7(0x1aa)]({'sqlCode':_0x266771['sqlCode'],'error':_0x19f1c7(0x1cc)});continue;}const _0x35a31c=await readFile(_0x266771[_0x19f1c7(0x1a6)],_0x19f1c7(0x1b7)),_0x5711ed=stripLocalSqlMetadata(_0x35a31c,_0x266771['mode']),_0x5e6284=_0x266771[_0x19f1c7(0x191)]||_0x4ff441[_0x19f1c7(0x191)],_0x31ef14=await resolveTargetDbBinding(_0x285737['appCode'],_0x266771,_0x4ff441),_0x2c274e=await updateSqlQuery({'id':_0x4ff441[_0x19f1c7(0x1a4)],'appCode':_0x285737[_0x19f1c7(0x1a9)],'sqlCode':_0x266771['sqlCode'],'sqlName':_0x5e6284,'dbId':_0x31ef14[_0x19f1c7(0x1cd)],'version':_0x4ff441['version'],'sqlContent':_0x5711ed,'sqlConfig':_0x4ff441[_0x19f1c7(0x1ad)]??undefined}),_0x1ac859=_0x2c274e[_0x19f1c7(0x1cd)]?await getDbName(_0x285737[_0x19f1c7(0x1a9)],Number(_0x2c274e[_0x19f1c7(0x1cd)]))['catch'](()=>_0x31ef14[_0x19f1c7(0x1b0)]):_0x31ef14['dbName'];_0x367b82[_0x19f1c7(0x199)][_0x266771['sqlCode']]={...buildSqlLockEntry(_0x2c274e,_0x5711ed,_0x3947a0,{'dbName':_0x1ac859}),'path':_0x266771[_0x19f1c7(0x1ba)],'mode':_0x4ff441[_0x19f1c7(0x1a5)]},await archivePreviousSqlFileIfNeeded(_0x13f683,_0x4ff441[_0x19f1c7(0x1b9)],_0x266771[_0x19f1c7(0x1ba)]),_0x4fd794[_0x19f1c7(0x1aa)]({'sqlCode':_0x266771[_0x19f1c7(0x1c6)],'remoteId':_0x4ff441['remoteId']});}catch(_0x3da25c){_0x303e22[_0x19f1c7(0x1aa)]({'sqlCode':_0x266771[_0x19f1c7(0x1c6)],'error':_0x3da25c instanceof Error?_0x3da25c['message']:String(_0x3da25c)});}}return _0x367b82[_0x19f1c7(0x1d1)]=new Date()[_0x19f1c7(0x1bd)](),await writeSqlLockFile(_0x13f683[_0x19f1c7(0x1c5)],_0x7dc3e7),{'ok':_0x303e22[_0x19f1c7(0x1bf)]===0x0,'data':{'pushed':_0x4fd794,'skipped':_0xc58feb,'failed':_0x303e22},'message':'Push\x20complete:\x20'+_0x4fd794[_0x19f1c7(0x1bf)]+_0x19f1c7(0x1c0)+_0xc58feb[_0x19f1c7(0x1bf)]+_0x19f1c7(0x1bc)+_0x303e22['length']+_0x19f1c7(0x198)};}};async function archivePreviousSqlFileIfNeeded(_0x307ae4,_0x3ffe9a,_0x24804f){const _0x951c68=a198_0x3a3914;if(!_0x3ffe9a||_0x3ffe9a===_0x24804f)return;const _0x1ac22f=join(_0x307ae4[_0x951c68(0x1cb)],_0x3ffe9a);if(!await fileExists(_0x1ac22f))return;const _0x194586=await moveToTrash(_0x307ae4['projectRoot'],_0x307ae4[_0x951c68(0x1c3)],_0x1ac22f);await cleanupEmptyDirectories(dirname(_0x1ac22f),_0x307ae4['sqlRootDir']),void _0x194586;}async function moveToTrash(_0x6e05,_0x5d0384,_0x5ea9c4){const _0x1af636=a198_0x3a3914,_0x301244=new Date()[_0x1af636(0x1bd)]()[_0x1af636(0x1c7)](/[:.]/g,'-'),_0x10d78d=relative(_0x6e05,_0x5ea9c4),_0x133f22=join(_0x5d0384,_0x301244,_0x10d78d);return await mkdir(dirname(_0x133f22),{'recursive':!![]}),await rename(_0x5ea9c4,_0x133f22),_0x133f22;}async function cleanupEmptyDirectories(_0x371cf1,_0x34a1b1){const _0x260579=a198_0x3a3914;let _0x145d27=resolve(_0x371cf1);const _0x5d91c9=resolve(_0x34a1b1);while(_0x145d27[_0x260579(0x1cf)](''+_0x5d91c9+sep)||_0x145d27===_0x5d91c9){if(_0x145d27===_0x5d91c9)return;try{const _0x2d77e5=await readdir(_0x145d27);if(_0x2d77e5[_0x260579(0x1bf)]>0x0)return;await rmdir(_0x145d27);}catch{return;}_0x145d27=dirname(_0x145d27);}}async function resolveTargetDbBinding(_0x403e45,_0x182e34,_0x29688f){const _0x3258f2=a198_0x3a3914,_0x4f7d7b=_0x182e34[_0x3258f2(0x1b4)];if(!_0x4f7d7b)return{'dbId':_0x29688f[_0x3258f2(0x1cd)],'dbName':_0x29688f[_0x3258f2(0x1b0)]};const _0x8d9f34=buildDbDirectoryName(_0x29688f[_0x3258f2(0x1b0)],_0x29688f[_0x3258f2(0x1cd)]);if(_0x4f7d7b===_0x8d9f34)return{'dbId':_0x29688f['dbId'],'dbName':_0x29688f[_0x3258f2(0x1b0)]};const _0x572168=parseExplicitDbDirectory(_0x4f7d7b);if(_0x572168!=null)return{'dbId':_0x572168,'dbName':await getDbName(_0x403e45,_0x572168)[_0x3258f2(0x1a0)](()=>undefined)};const _0x276395=await listDatabases(_0x403e45),_0x1ca79b=_0x276395[_0x3258f2(0x1ce)](_0x1df8da=>buildDbDirectoryName(_0x1df8da[_0x3258f2(0x1b0)],_0x1df8da['dbId'])===_0x4f7d7b);if(_0x1ca79b['length']===0x1)return{'dbId':_0x1ca79b[0x0][_0x3258f2(0x1cd)],'dbName':_0x1ca79b[0x0][_0x3258f2(0x1b0)]};if(_0x1ca79b['length']===0x0)throw CliErrors[_0x3258f2(0x1b2)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x4f7d7b+_0x3258f2(0x192)+_0x182e34[_0x3258f2(0x1c6)]+'.');const _0x462ef4=_0x1ca79b['map'](_0x4ba436=>_0x4ba436[_0x3258f2(0x1b0)]+'\x20('+_0x4ba436[_0x3258f2(0x1cd)]+')')['join'](',\x20');throw CliErrors[_0x3258f2(0x1b2)](_0x3258f2(0x1ac)+_0x4f7d7b+_0x3258f2(0x19b)+_0x182e34['sqlCode']+':\x20'+_0x462ef4);}function parseExplicitDbDirectory(_0x2a4435){const _0xe0b13a=a198_0x3a3914,_0xb540bc=/^db-(\d+)$/[_0xe0b13a(0x1a7)](_0x2a4435);if(!_0xb540bc)return null;const _0xc76b2f=Number(_0xb540bc[0x1]);return Number['isFinite'](_0xc76b2f)&&_0xc76b2f>0x0?_0xc76b2f:null;}
|
|
1
|
+
const a191_0x445a58=a191_0x5960;(function(_0x446792,_0x132c10){const _0x54faaf=a191_0x5960,_0x928946=_0x446792();while(!![]){try{const _0x47aa6c=parseInt(_0x54faaf(0x1ed))/0x1*(-parseInt(_0x54faaf(0x1dd))/0x2)+-parseInt(_0x54faaf(0x1c6))/0x3+parseInt(_0x54faaf(0x1ba))/0x4*(parseInt(_0x54faaf(0x1ee))/0x5)+parseInt(_0x54faaf(0x1d2))/0x6*(parseInt(_0x54faaf(0x1c2))/0x7)+-parseInt(_0x54faaf(0x1df))/0x8*(-parseInt(_0x54faaf(0x1b1))/0x9)+parseInt(_0x54faaf(0x1d1))/0xa+-parseInt(_0x54faaf(0x1b2))/0xb;if(_0x47aa6c===_0x132c10)break;else _0x928946['push'](_0x928946['shift']());}catch(_0x5b3e0b){_0x928946['push'](_0x928946['shift']());}}}(a191_0x19c2,0x62b15));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a191_0x5960(_0x126de7,_0x3443b1){_0x126de7=_0x126de7-0x1ab;const _0x19c235=a191_0x19c2();let _0x59608c=_0x19c235[_0x126de7];return _0x59608c;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x102d4e,_0x470bef,_0x1757c3){const _0x29540b=a191_0x5960,_0x5c46d6=await scanLocalSqlQueries(_0x102d4e),_0x5070ec=new Map();for(const _0x22f8e0 of _0x5c46d6){if(_0x1757c3&&_0x22f8e0[_0x29540b(0x1ea)]!==_0x1757c3)continue;const _0x1a73da=_0x5070ec['get'](_0x22f8e0[_0x29540b(0x1ea)])??[];_0x1a73da['push'](_0x22f8e0),_0x5070ec[_0x29540b(0x1c3)](_0x22f8e0['sqlCode'],_0x1a73da);}if(_0x1757c3&&!_0x5070ec[_0x29540b(0x1e2)](_0x1757c3))throw CliErrors[_0x29540b(0x1e4)](_0x29540b(0x1b3)+_0x1757c3);const _0x5572ef=[];for(const [_0x1fb43d,_0x15c68e]of _0x5070ec[_0x29540b(0x1eb)]()){if(_0x15c68e['length']===0x1){_0x5572ef[_0x29540b(0x1cd)](_0x15c68e[0x0]);continue;}const _0x223e5b=_0x470bef[_0x29540b(0x1ef)][_0x1fb43d],_0x3310e6=_0x223e5b?.[_0x29540b(0x1b5)],_0x4080eb=_0x3310e6?_0x15c68e[_0x29540b(0x1ac)](_0x5e0a69=>_0x5e0a69[_0x29540b(0x1d6)]!==_0x3310e6):_0x15c68e;if(_0x223e5b&&_0x4080eb[_0x29540b(0x1c1)]===0x1){_0x5572ef[_0x29540b(0x1cd)](_0x4080eb[0x0]);continue;}throw CliErrors[_0x29540b(0x1e4)](_0x29540b(0x1ab)+_0x1fb43d+_0x29540b(0x1d4));}return _0x5572ef;}export const sqlPush={'service':a191_0x445a58(0x1cb),'command':a191_0x445a58(0x1cd),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a191_0x445a58(0x1ca),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a191_0x445a58(0x1b9),'description':a191_0x445a58(0x1ae)}],async 'dryRun'(_0x343567){const _0xd9946a=a191_0x445a58,_0x19fd5b=loadSqlProjectConfig(_0x343567[_0xd9946a(0x1d0)]),_0x3abd2c=await readSqlLockFile(_0x19fd5b[_0xd9946a(0x1c7)]),{appLock:_0x128f4b}=ensureSqlLockScope(_0x3abd2c??createEmptySqlLock(),_0x343567[_0xd9946a(0x1d0)],_0x19fd5b[_0xd9946a(0x1d9)],_0xd9946a(0x1cd)),_0x6e6ada=await getTargetSqlQueries(_0x19fd5b,_0x128f4b,_0x343567[_0xd9946a(0x1b4)](_0xd9946a(0x1c8))||undefined),_0x59deb2=[];for(const _0x8028d3 of _0x6e6ada){const _0x97b16f=await computeSqlFileHash(_0x8028d3[_0xd9946a(0x1da)]),_0x15d8c1=_0x128f4b['sqls'][_0x8028d3[_0xd9946a(0x1ea)]],_0x18c675=!!_0x15d8c1&&(_0x15d8c1[_0xd9946a(0x1b5)]!==_0x8028d3['relativePath']||!!_0x8028d3[_0xd9946a(0x1e1)]&&_0x15d8c1[_0xd9946a(0x1e1)]!==_0x8028d3[_0xd9946a(0x1e1)]);if(!_0x343567[_0xd9946a(0x1c9)](_0xd9946a(0x1cc))&&_0x15d8c1&&_0x15d8c1[_0xd9946a(0x1ec)]===_0x97b16f&&!_0x18c675)continue;_0x59deb2[_0xd9946a(0x1cd)](_0x8028d3['sqlCode']);}return{'method':_0xd9946a(0x1e7),'url':_0xd9946a(0x1e8),'body':{'sqlCodes':_0x59deb2,'appCode':_0x343567[_0xd9946a(0x1d0)]},'description':_0xd9946a(0x1b6)+_0x59deb2[_0xd9946a(0x1c1)]+_0xd9946a(0x1bd)};},async 'execute'(_0x23e476){const _0x35d804=a191_0x445a58,_0x1d5c32=loadSqlProjectConfig(_0x23e476['appCode']),_0x3b33db=await readSqlLockFile(_0x1d5c32['lockFilePath']),{lockData:_0x270c11,appLock:_0x173a63}=ensureSqlLockScope(_0x3b33db??createEmptySqlLock(),_0x23e476[_0x35d804(0x1d0)],_0x1d5c32[_0x35d804(0x1d9)],_0x35d804(0x1cd)),_0x1a2f76=await getTargetSqlQueries(_0x1d5c32,_0x173a63,_0x23e476['str']('sqlcode')||undefined);if(_0x1a2f76[_0x35d804(0x1c1)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x35d804(0x1c4)};const _0x6eeb4e=[],_0x1a28b3=[],_0x561048=[];for(const _0xd646ab of _0x1a2f76){const _0x534851=_0x173a63['sqls'][_0xd646ab['sqlCode']];if(!_0x534851){_0x561048[_0x35d804(0x1cd)]({'sqlCode':_0xd646ab[_0x35d804(0x1ea)],'error':_0x35d804(0x1c5)});continue;}try{const _0x22486a=await computeSqlFileHash(_0xd646ab[_0x35d804(0x1da)]),_0x3e7fa6=_0x534851[_0x35d804(0x1b5)]!==_0xd646ab[_0x35d804(0x1d6)]||!!_0xd646ab['sqlName']&&_0x534851[_0x35d804(0x1e1)]!==_0xd646ab[_0x35d804(0x1e1)];if(!_0x23e476[_0x35d804(0x1c9)](_0x35d804(0x1cc))&&_0x534851[_0x35d804(0x1ec)]===_0x22486a&&!_0x3e7fa6){_0x1a28b3['push']({'sqlCode':_0xd646ab[_0x35d804(0x1ea)],'reason':_0x35d804(0x1af)});continue;}if(_0x534851[_0x35d804(0x1e0)]==null){_0x561048[_0x35d804(0x1cd)]({'sqlCode':_0xd646ab[_0x35d804(0x1ea)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x12c5ab=await readFile(_0xd646ab[_0x35d804(0x1da)],_0x35d804(0x1de)),_0x5def3a=stripLocalSqlMetadata(_0x12c5ab,_0xd646ab['mode']),_0x26d1b3=_0xd646ab[_0x35d804(0x1e1)]||_0x534851[_0x35d804(0x1e1)],_0x2c5f10=await resolveTargetDbBinding(_0x23e476[_0x35d804(0x1d0)],_0xd646ab,_0x534851),_0x10a802=await updateSqlQuery({'id':_0x534851[_0x35d804(0x1d3)],'appCode':_0x23e476[_0x35d804(0x1d0)],'sqlCode':_0xd646ab['sqlCode'],'sqlName':_0x26d1b3,'dbId':_0x2c5f10[_0x35d804(0x1d5)],'version':_0x534851['version'],'sqlContent':_0x5def3a,'sqlConfig':_0x534851[_0x35d804(0x1e5)]??undefined}),_0x5b34ef=_0x10a802['dbId']?await getDbName(_0x23e476['appCode'],Number(_0x10a802['dbId']))['catch'](()=>_0x2c5f10[_0x35d804(0x1b0)]):_0x2c5f10['dbName'];_0x173a63[_0x35d804(0x1ef)][_0xd646ab[_0x35d804(0x1ea)]]={...buildSqlLockEntry(_0x10a802,_0x5def3a,_0x22486a,{'dbName':_0x5b34ef}),'path':_0xd646ab['relativePath'],'mode':_0x534851[_0x35d804(0x1ce)]},await archivePreviousSqlFileIfNeeded(_0x1d5c32,_0x534851[_0x35d804(0x1b5)],_0xd646ab[_0x35d804(0x1d6)]),_0x6eeb4e[_0x35d804(0x1cd)]({'sqlCode':_0xd646ab[_0x35d804(0x1ea)],'remoteId':_0x534851['remoteId']});}catch(_0x2f49a0){_0x561048[_0x35d804(0x1cd)]({'sqlCode':_0xd646ab[_0x35d804(0x1ea)],'error':_0x2f49a0 instanceof Error?_0x2f49a0[_0x35d804(0x1f0)]:String(_0x2f49a0)});}}return _0x173a63[_0x35d804(0x1cf)]=new Date()[_0x35d804(0x1bf)](),await writeSqlLockFile(_0x1d5c32[_0x35d804(0x1c7)],_0x270c11),{'ok':_0x561048['length']===0x0,'data':{'pushed':_0x6eeb4e,'skipped':_0x1a28b3,'failed':_0x561048},'message':_0x35d804(0x1c0)+_0x6eeb4e[_0x35d804(0x1c1)]+_0x35d804(0x1f1)+_0x1a28b3[_0x35d804(0x1c1)]+_0x35d804(0x1e6)+_0x561048[_0x35d804(0x1c1)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x2d4db9,_0x43a7a4,_0xf0d7c1){const _0x206bcd=a191_0x445a58;if(!_0x43a7a4||_0x43a7a4===_0xf0d7c1)return;const _0x550b75=join(_0x2d4db9['sqlRootDir'],_0x43a7a4);if(!await fileExists(_0x550b75))return;const _0x53a5b9=await moveToTrash(_0x2d4db9['projectRoot'],_0x2d4db9[_0x206bcd(0x1dc)],_0x550b75);await cleanupEmptyDirectories(dirname(_0x550b75),_0x2d4db9[_0x206bcd(0x1bc)]),void _0x53a5b9;}async function moveToTrash(_0x4b0bd6,_0x8f60d0,_0x1976fe){const _0x4743a3=a191_0x445a58,_0x3c9f6d=new Date()[_0x4743a3(0x1bf)]()[_0x4743a3(0x1b7)](/[:.]/g,'-'),_0x43b2df=relative(_0x4b0bd6,_0x1976fe),_0x202c14=join(_0x8f60d0,_0x3c9f6d,_0x43b2df);return await mkdir(dirname(_0x202c14),{'recursive':!![]}),await rename(_0x1976fe,_0x202c14),_0x202c14;}function a191_0x19c2(){const _0x518b5c=['.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','dbId','relativePath','map','exec','sqlRoot','filePath','Local\x20directory\x20\x22','trashDir','1696VBeobr','utf8','272Abqemw','version','sqlName','has','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','validation','sqlConfig','\x20skipped,\x20','POST','/smartapi/custom/updateUserCustomSql','\x22\x20for\x20sqlCode\x20','sqlCode','entries','hash','21iYtIQt','259085fhsTOQ','sqls','message','\x20pushed,\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','filter','isFinite','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','unchanged','dbName','102519YSKXOp','17319665uKvIwf','Local\x20SQL\x20not\x20found:\x20','str','path','Would\x20push\x20','replace','No\x20database\x20matches\x20local\x20directory\x20\x22','boolean','44RnRnUr','join','sqlRootDir','\x20SQL\x20file(s)','dbDirectory','toISOString','Push\x20complete:\x20','length','14zeOcOw','set','No\x20local\x20SQL\x20files\x20found.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','30159AGUnxP','lockFilePath','sqlcode','bool','write','sql','force','push','mode','lastSync','appCode','5900900LVTIeB','1377750aMnrdW','remoteId'];a191_0x19c2=function(){return _0x518b5c;};return a191_0x19c2();}async function cleanupEmptyDirectories(_0x2c1acc,_0x127fd5){let _0x4e6f01=resolve(_0x2c1acc);const _0x57269c=resolve(_0x127fd5);while(_0x4e6f01['startsWith'](''+_0x57269c+sep)||_0x4e6f01===_0x57269c){if(_0x4e6f01===_0x57269c)return;try{const _0x2969f5=await readdir(_0x4e6f01);if(_0x2969f5['length']>0x0)return;await rmdir(_0x4e6f01);}catch{return;}_0x4e6f01=dirname(_0x4e6f01);}}async function resolveTargetDbBinding(_0x5dd1eb,_0x6245a,_0x34ef27){const _0x28dd48=a191_0x445a58,_0x149913=_0x6245a[_0x28dd48(0x1be)];if(!_0x149913)return{'dbId':_0x34ef27[_0x28dd48(0x1d5)],'dbName':_0x34ef27[_0x28dd48(0x1b0)]};const _0xfea5c8=buildDbDirectoryName(_0x34ef27[_0x28dd48(0x1b0)],_0x34ef27[_0x28dd48(0x1d5)]);if(_0x149913===_0xfea5c8)return{'dbId':_0x34ef27[_0x28dd48(0x1d5)],'dbName':_0x34ef27[_0x28dd48(0x1b0)]};const _0x115dfd=parseExplicitDbDirectory(_0x149913);if(_0x115dfd!=null)return{'dbId':_0x115dfd,'dbName':await getDbName(_0x5dd1eb,_0x115dfd)['catch'](()=>undefined)};const _0x1c8d6e=await listDatabases(_0x5dd1eb),_0x2f9cdb=_0x1c8d6e[_0x28dd48(0x1ac)](_0x2c7e29=>buildDbDirectoryName(_0x2c7e29[_0x28dd48(0x1b0)],_0x2c7e29[_0x28dd48(0x1d5)])===_0x149913);if(_0x2f9cdb[_0x28dd48(0x1c1)]===0x1)return{'dbId':_0x2f9cdb[0x0][_0x28dd48(0x1d5)],'dbName':_0x2f9cdb[0x0][_0x28dd48(0x1b0)]};if(_0x2f9cdb['length']===0x0)throw CliErrors[_0x28dd48(0x1e4)](_0x28dd48(0x1b8)+_0x149913+_0x28dd48(0x1e9)+_0x6245a[_0x28dd48(0x1ea)]+'.');const _0x147e47=_0x2f9cdb[_0x28dd48(0x1d7)](_0x166e3d=>_0x166e3d[_0x28dd48(0x1b0)]+'\x20('+_0x166e3d[_0x28dd48(0x1d5)]+')')[_0x28dd48(0x1bb)](',\x20');throw CliErrors[_0x28dd48(0x1e4)](_0x28dd48(0x1db)+_0x149913+_0x28dd48(0x1e3)+_0x6245a[_0x28dd48(0x1ea)]+':\x20'+_0x147e47);}function parseExplicitDbDirectory(_0xe45f6f){const _0x37683a=a191_0x445a58,_0x2d4cca=/^db-(\d+)$/[_0x37683a(0x1d8)](_0xe45f6f);if(!_0x2d4cca)return null;const _0x1e1ae4=Number(_0x2d4cca[0x1]);return Number[_0x37683a(0x1ad)](_0x1e1ae4)&&_0x1e1ae4>0x0?_0x1e1ae4:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xe45b9c,_0x24d27d){const _0x1a2a10=a192_0x16c7,_0x54f3e2=_0xe45b9c();while(!![]){try{const _0x24c913=parseInt(_0x1a2a10(0x127))/0x1*(parseInt(_0x1a2a10(0x134))/0x2)+-parseInt(_0x1a2a10(0x13c))/0x3*(parseInt(_0x1a2a10(0x11a))/0x4)+parseInt(_0x1a2a10(0x12f))/0x5*(-parseInt(_0x1a2a10(0x131))/0x6)+-parseInt(_0x1a2a10(0x13a))/0x7+parseInt(_0x1a2a10(0x11c))/0x8+parseInt(_0x1a2a10(0x125))/0x9+parseInt(_0x1a2a10(0x12e))/0xa*(parseInt(_0x1a2a10(0x11b))/0xb);if(_0x24c913===_0x24d27d)break;else _0x54f3e2['push'](_0x54f3e2['shift']());}catch(_0x73d1be){_0x54f3e2['push'](_0x54f3e2['shift']());}}}(a192_0x5481,0xceae9));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';function a192_0x16c7(_0x53a0aa,_0x501423){_0x53a0aa=_0x53a0aa-0x110;const _0x548139=a192_0x5481();let _0x16c73e=_0x548139[_0x53a0aa];return _0x16c73e;}function a192_0x5481(){const _0x4f7498=['2rWozSP','sqlName','sqlContent','mode','dbName','mybatisXml','6121962cIAhpK','apps','118977Udbuhs','path','stdin','yes','syncedAt','close','description','lastSync','includes','sqls','sqlCode','104GcVQwd','25219634BCQBrp','2995144DkcZmD','trim','entries','test','map','trimStart','\x20[y/N]\x20','sqlConfig','split','7963578tPnwBR','endsWith','550931EWEotC','filter','length','--\x20@lovrabet.','fromEntries','dbId','push','10cVZJxa','613905wLqfJL','sqlRoot','66mPAmwV','stderr','join'];a192_0x5481=function(){return _0x4f7498;};return a192_0x5481();}export function buildSqlLockEntry(_0x4bde7b,_0x194960,_0x12f177,_0x5d5e88){const _0x56b56a=a192_0x16c7,_0x2080a0=detectSqlMode(_0x194960);return{'path':buildSqlRelativePath(_0x4bde7b[_0x56b56a(0x119)],_0x4bde7b[_0x56b56a(0x135)],_0x5d5e88?.[_0x56b56a(0x138)],_0x2080a0,_0x4bde7b[_0x56b56a(0x12c)]),'hash':_0x12f177,'remoteId':_0x4bde7b['id'],'version':_0x4bde7b['version'],'dbId':Number(_0x4bde7b['dbId']),'dbName':_0x5d5e88?.[_0x56b56a(0x138)],'sqlName':_0x4bde7b[_0x56b56a(0x135)],'sqlConfig':_0x4bde7b[_0x56b56a(0x123)]??undefined,'mode':_0x2080a0};}export function cloneSqlLockData(_0xa28cc8){const _0xaa9680=a192_0x16c7;return{'apps':Object[_0xaa9680(0x12b)](Object[_0xaa9680(0x11e)](_0xa28cc8[_0xaa9680(0x13b)])[_0xaa9680(0x120)](([_0x27b6b,_0x400118])=>[_0x27b6b,{'sqlRoot':_0x400118[_0xaa9680(0x130)],'lastSync':_0x400118[_0xaa9680(0x116)],'sqls':{..._0x400118[_0xaa9680(0x118)]}}]))};}export function ensureRemoteSqlContent(_0x3e466c){const _0xcd3b6b=a192_0x16c7;return _0x3e466c[_0xcd3b6b(0x136)]??'';}export function buildLocalSqlFileContent(_0x10c68a,_0x1ba8d8,_0x2fae74){const _0x2ddf2e=a192_0x16c7,_0x2ad335=_0x2fae74?.[_0x2ddf2e(0x137)]??detectSqlMode(_0x1ba8d8),_0x1bbe7d=stripLocalSqlMetadata(_0x1ba8d8,_0x2ad335)[_0x2ddf2e(0x11d)](),_0x2e8c2c=[...buildMetadataHeaderLines({'sqlCode':_0x10c68a['sqlCode'],'sqlName':_0x10c68a[_0x2ddf2e(0x135)],'dbId':_0x10c68a[_0x2ddf2e(0x12c)],'dbName':_0x2fae74?.[_0x2ddf2e(0x138)],'mode':_0x2ad335,'syncedAt':_0x2fae74?.[_0x2ddf2e(0x113)],'description':_0x2fae74?.[_0x2ddf2e(0x115)]},_0x2ad335),'',_0x1bbe7d],_0x587547=_0x2e8c2c[_0x2ddf2e(0x133)]('\x0a');return _0x587547[_0x2ddf2e(0x126)]('\x0a')?_0x587547:_0x587547+'\x0a';}export function stripLocalSqlMetadata(_0x722588,_0x5cd4c5){const _0x3444e9=a192_0x16c7,_0x432613=_0x722588['replace'](/\r\n/g,'\x0a')[_0x3444e9(0x124)]('\x0a'),_0x258f4d=[];let _0x2225bb=0x0;if(_0x5cd4c5==='mybatisXml')while(_0x2225bb<_0x432613[_0x3444e9(0x129)]){const _0x40a19d=_0x432613[_0x2225bb]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x40a19d)){_0x2225bb++;continue;}if(_0x40a19d[_0x3444e9(0x11d)]()===''&&_0x2225bb>0x0){_0x2225bb++;continue;}break;}else while(_0x2225bb<_0x432613[_0x3444e9(0x129)]){const _0x3db748=_0x432613[_0x2225bb]??'';if(/^\s*--\s*@lovrabet\./[_0x3444e9(0x11f)](_0x3db748)){_0x2225bb++;continue;}if(_0x3db748[_0x3444e9(0x11d)]()===''&&_0x2225bb>0x0){_0x2225bb++;continue;}break;}for(;_0x2225bb<_0x432613['length'];_0x2225bb++){_0x258f4d[_0x3444e9(0x12d)](_0x432613[_0x2225bb]);}return _0x258f4d['join']('\x0a')[_0x3444e9(0x121)]();}export function resolveSqlMode(_0x5dd49c,_0x368da5){const _0x4c0261=a192_0x16c7;if(_0x368da5?.[_0x4c0261(0x137)])return _0x368da5[_0x4c0261(0x137)];return detectSqlMode(_0x5dd49c);}export function resolveSqlFileName(_0x18b434,_0x550028,_0x32e61a){const _0x37a390=a192_0x16c7;if(_0x32e61a?.[_0x37a390(0x110)])return _0x32e61a[_0x37a390(0x110)];if(_0x32e61a?.[_0x37a390(0x135)]||_0x32e61a?.[_0x37a390(0x138)])return buildSqlRelativePath(_0x18b434,_0x32e61a?.[_0x37a390(0x135)],_0x32e61a?.['dbName'],resolveSqlMode(_0x550028,_0x32e61a),_0x32e61a?.['dbId']);return buildDefaultSqlFileName(_0x18b434,resolveSqlMode(_0x550028,_0x32e61a));}export function resolveSqlLocalDir(_0x418f8e,_0x1196f0){return join(_0x418f8e,SQL_LOCAL_REL_DIR,_0x1196f0);}export async function confirmForceOverwrite(_0x1be92d){const _0x18222a=a192_0x16c7,_0x5e3e72=createInterface({'input':process[_0x18222a(0x111)],'output':process[_0x18222a(0x132)]}),_0x13c987=await new Promise(_0x3ea5cc=>{const _0x53c81f=_0x18222a;_0x5e3e72['question'](_0x1be92d+_0x53c81f(0x122),_0x3ea5cc);});return _0x5e3e72[_0x18222a(0x114)](),['y',_0x18222a(0x112)][_0x18222a(0x117)](_0x13c987[_0x18222a(0x11d)]()['toLowerCase']());}export function findSqlLockScope(_0x12da49,_0x4aef32){const _0x3bf873=a192_0x16c7;return _0x12da49[_0x3bf873(0x13b)][_0x4aef32];}function buildMetadataHeaderLines(_0xbff397,_0x51330a){const _0x11c2a4=a192_0x16c7,_0x2ed238=[['sqlCode',_0xbff397[_0x11c2a4(0x119)]],[_0x11c2a4(0x135),_0xbff397['sqlName']],[_0x11c2a4(0x12c),_0xbff397[_0x11c2a4(0x12c)]],[_0x11c2a4(0x138),_0xbff397['dbName']],[_0x11c2a4(0x137),_0xbff397[_0x11c2a4(0x137)]],['syncedAt',_0xbff397['syncedAt']],[_0x11c2a4(0x115),_0xbff397['description']]];if(_0x51330a===_0x11c2a4(0x139))return _0x2ed238[_0x11c2a4(0x128)](([,_0x5b8061])=>_0x5b8061!==undefined&&_0x5b8061!==null&&String(_0x5b8061)[_0x11c2a4(0x11d)]()!=='')[_0x11c2a4(0x120)](([_0x1b836c,_0x3cc4d8])=>'<!--\x20@lovrabet.'+_0x1b836c+':\x20'+String(_0x3cc4d8)+'\x20-->');return _0x2ed238[_0x11c2a4(0x128)](([,_0x3c549b])=>_0x3c549b!==undefined&&_0x3c549b!==null&&String(_0x3c549b)[_0x11c2a4(0x11d)]()!=='')['map'](([_0x111607,_0x342271])=>_0x11c2a4(0x12a)+_0x111607+':\x20'+String(_0x342271));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a193_0x1ca1c1=a193_0x5948;(function(_0x1de720,_0x1fee27){const _0x2c5df4=a193_0x5948,_0x2f242b=_0x1de720();while(!![]){try{const _0x1d4698=parseInt(_0x2c5df4(0xc9))/0x1*(-parseInt(_0x2c5df4(0xe3))/0x2)+-parseInt(_0x2c5df4(0xdf))/0x3*(-parseInt(_0x2c5df4(0xdd))/0x4)+parseInt(_0x2c5df4(0xc7))/0x5*(-parseInt(_0x2c5df4(0xe2))/0x6)+parseInt(_0x2c5df4(0xdb))/0x7+parseInt(_0x2c5df4(0xe5))/0x8+-parseInt(_0x2c5df4(0xca))/0x9*(-parseInt(_0x2c5df4(0xd0))/0xa)+-parseInt(_0x2c5df4(0xd6))/0xb;if(_0x1d4698===_0x1fee27)break;else _0x2f242b['push'](_0x2f242b['shift']());}catch(_0x243380){_0x2f242b['push'](_0x2f242b['shift']());}}}(a193_0x3ad7,0x4033f));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a193_0x5948(_0xc1bcde,_0x319c85){_0xc1bcde=_0xc1bcde-0xc2;const _0x3ad734=a193_0x3ad7();let _0x594801=_0x3ad734[_0xc1bcde];return _0x594801;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x1fa17c){const _0xf741d7=a193_0x5948,_0x4195bd=[];let _0x53d4f8=0x1;while(!![]){const _0x10f10b=await listSqlQueries(_0x1fa17c,{'currentPage':_0x53d4f8,'pageSize':PAGE_SIZE}),_0x383d71=_0x10f10b[_0xf741d7(0xd4)]??[];_0x4195bd[_0xf741d7(0xe6)](..._0x383d71[_0xf741d7(0xcc)](_0xdedd95=>_0xdedd95[_0xf741d7(0xc4)]));if(_0x383d71[_0xf741d7(0xe0)]===0x0)break;const _0x905e02=_0x10f10b[_0xf741d7(0xe1)]?.[_0xf741d7(0xc2)];if(_0x905e02!=null?_0x4195bd[_0xf741d7(0xe0)]>=_0x905e02:_0x383d71[_0xf741d7(0xe0)]<PAGE_SIZE)break;_0x53d4f8++;}return _0x4195bd;}function a193_0x3ad7(){const _0x4ed731=['8349440unKbbo','\x20missing,\x20','has','\x20added,\x20','lockKey','1306935uMmvra','\x20modified,\x20','3148fvbUnZ','lockFilePath','1770VckNBj','length','paging','12zOBhAW','804986HSdEmz','sqlRoot','2176616ZreOnk','push','totalCount','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','sqlCode','appCode','sqlName','34060eTftnJ','remote','1ZwhsVe','99WqAJoJ','All\x20SQL\x20queries\x20are\x20in\x20sync.','map','\x20remote-only','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','hash','468200jJMPzQ','status','sqls','filePath','tableData','boolean'];a193_0x3ad7=function(){return _0x4ed731;};return a193_0x3ad7();}export const sqlStatus={'service':'sql','command':'status','description':a193_0x1ca1c1(0xc3),'risk':'read','flags':[{'name':a193_0x1ca1c1(0xc8),'type':a193_0x1ca1c1(0xd5),'description':a193_0x1ca1c1(0xce)}],async 'execute'(_0x572a3e){const _0x32e47a=a193_0x1ca1c1,_0x5006a7=loadSqlProjectConfig(_0x572a3e[_0x32e47a(0xc5)]),_0x31439b=await readSqlLockFile(_0x5006a7[_0x32e47a(0xde)]),{appLock:_0x2d0a35}=ensureSqlLockScope(_0x31439b??createEmptySqlLock(),_0x5006a7[_0x32e47a(0xc5)],_0x5006a7[_0x32e47a(0xe4)],_0x32e47a(0xd1)),_0x52143e=await scanLocalSqlQueries(_0x5006a7),_0x329b89=[],_0x4bd31d=[],_0x6852a9=[],_0x388750=[],_0x2ad0e9=new Set(_0x52143e['map'](_0x22a77e=>_0x22a77e[_0x32e47a(0xda)]));for(const _0x4b78d4 of _0x52143e){const _0x26d34b=await computeSqlFileHash(_0x4b78d4[_0x32e47a(0xd3)]),_0x5d8977=_0x2d0a35[_0x32e47a(0xd2)][_0x4b78d4['lockKey']],_0x23ee04=!!_0x5d8977&&_0x5d8977['path']!==_0x4b78d4['relativePath'],_0x40d89d=!!_0x5d8977&&!!_0x4b78d4[_0x32e47a(0xc6)]&&_0x5d8977[_0x32e47a(0xc6)]!==_0x4b78d4[_0x32e47a(0xc6)];if(!_0x5d8977)_0x329b89[_0x32e47a(0xe6)](_0x4b78d4[_0x32e47a(0xda)]);else _0x5d8977[_0x32e47a(0xcf)]!==_0x26d34b||_0x23ee04||_0x40d89d?_0x4bd31d[_0x32e47a(0xe6)](_0x4b78d4['lockKey']):_0x6852a9[_0x32e47a(0xe6)](_0x4b78d4[_0x32e47a(0xda)]);}for(const _0x5b193e of Object['keys'](_0x2d0a35['sqls'])){!_0x2ad0e9[_0x32e47a(0xd8)](_0x5b193e)&&_0x388750[_0x32e47a(0xe6)](_0x5b193e);}const _0x51d296=[];if(_0x572a3e['bool'](_0x32e47a(0xc8))){const _0x50d14b=await fetchAllSqlCodes(_0x572a3e[_0x32e47a(0xc5)]);for(const _0x51943b of _0x50d14b){!_0x2ad0e9[_0x32e47a(0xd8)](_0x51943b)&&!_0x2d0a35[_0x32e47a(0xd2)][_0x51943b]&&_0x51d296['push'](_0x51943b);}}const _0x283f7f=_0x329b89[_0x32e47a(0xe0)]===0x0&&_0x4bd31d[_0x32e47a(0xe0)]===0x0&&_0x388750[_0x32e47a(0xe0)]===0x0&&_0x51d296[_0x32e47a(0xe0)]===0x0;return{'ok':!![],'data':{'added':_0x329b89,'modified':_0x4bd31d,'missing':_0x388750,'unchanged':_0x6852a9,'remoteOnly':_0x51d296},'message':_0x283f7f?_0x32e47a(0xcb):_0x329b89[_0x32e47a(0xe0)]+_0x32e47a(0xd9)+_0x4bd31d[_0x32e47a(0xe0)]+_0x32e47a(0xdc)+_0x388750[_0x32e47a(0xe0)]+_0x32e47a(0xd7)+_0x6852a9['length']+'\x20unchanged'+(_0x51d296[_0x32e47a(0xe0)]>0x0?',\x20'+_0x51d296[_0x32e47a(0xe0)]+_0x32e47a(0xcd):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x2210d3=a194_0x1bd1;(function(_0x3da535,_0x2c6320){const _0x327c55=a194_0x1bd1,_0x30abd5=_0x3da535();while(!![]){try{const _0x355d29=parseInt(_0x327c55(0x148))/0x1+parseInt(_0x327c55(0x15c))/0x2+-parseInt(_0x327c55(0x167))/0x3+-parseInt(_0x327c55(0x14c))/0x4*(-parseInt(_0x327c55(0x159))/0x5)+parseInt(_0x327c55(0x152))/0x6*(-parseInt(_0x327c55(0x15b))/0x7)+parseInt(_0x327c55(0x15d))/0x8+parseInt(_0x327c55(0x144))/0x9*(-parseInt(_0x327c55(0x13e))/0xa);if(_0x355d29===_0x2c6320)break;else _0x30abd5['push'](_0x30abd5['shift']());}catch(_0x5d9ed5){_0x30abd5['push'](_0x30abd5['shift']());}}}(a194_0x26f8,0xca1b1));function a194_0x26f8(){const _0x30eb1a=['Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','flagMissing','push','Provide\x20--file\x20or\x20--sql','schema:','indexes','200eTfYhI','schemas','parameters','map','sqlType','pkField','120816eZDdye','Dataset\x20\x22','dbtableConfig','isArray','511478iDuuIy','indexName','index_name','bool','44alJtXc','file','length','trim','message','flatMap','56004KAcovk','filter','size','dataset','--check-indexes\x20requires\x20--schemas.','tables','\x22\x20not\x20found\x20or\x20not\x20accessible','207300eiSnPr','index_columns','483QpDORH','1321746CFFDTb','10684056pvFzVV','Table\x20\x22','tableName','columns','string','index_type','utf-8','get','str','split','3670701VUStwV','read','unshift','reason','check-indexes','columnNames','type','isSelectOnly','toLowerCase','find','schemaWarnings','SQL\x20schema\x20validation','valid','File\x20not\x20found:\x20','isDangerous','validation','sql','name','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','\x22\x20not\x20found\x20in\x20any\x20dataset','validate','joinAudit','fields'];a194_0x26f8=function(){return _0x30eb1a;};return a194_0x26f8();}import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a194_0x1bd1(_0x4a5ec5,_0x58ad2f){_0x4a5ec5=_0x4a5ec5-0x122;const _0x26f8fc=a194_0x26f8();let _0x1bd13b=_0x26f8fc[_0x4a5ec5];return _0x1bd13b;}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a194_0x2210d3(0x130),'command':a194_0x2210d3(0x134),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a194_0x2210d3(0x168),'flags':[{'name':a194_0x2210d3(0x14d),'type':a194_0x2210d3(0x161),'description':a194_0x2210d3(0x132)},{'name':'sql','type':a194_0x2210d3(0x161),'description':a194_0x2210d3(0x138)},{'name':a194_0x2210d3(0x13f),'type':'string','description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'},{'name':a194_0x2210d3(0x124),'type':'boolean','description':a194_0x2210d3(0x137)}],async 'execute'(_0x24e13a){const _0x21a004=a194_0x2210d3,_0x2cce8c=_0x24e13a[_0x21a004(0x165)](_0x21a004(0x14d)),_0x423faa=_0x24e13a[_0x21a004(0x165)](_0x21a004(0x130)),_0xd97136=_0x24e13a['str'](_0x21a004(0x13f)),_0x1bddad=_0x24e13a[_0x21a004(0x14b)](_0x21a004(0x124));if(!_0x2cce8c&&!_0x423faa)throw CliErrors[_0x21a004(0x139)]('file',_0x21a004(0x13b));if(_0x1bddad&&!_0xd97136)throw CliErrors[_0x21a004(0x12f)](_0x21a004(0x156));let _0x414de5;if(_0x2cce8c){const _0x5aacdf=resolve(process['cwd'](),_0x2cce8c);if(!existsSync(_0x5aacdf))throw CliErrors[_0x21a004(0x12f)](_0x21a004(0x12d)+_0x5aacdf);_0x414de5=readFileSync(_0x5aacdf,_0x21a004(0x163));}else _0x414de5=_0x423faa;const _0xe873e6=validateSql(_0x414de5),_0x2fe89d={'valid':_0xe873e6[_0x21a004(0x12c)],'sqlType':_0xe873e6[_0x21a004(0x142)][_0x21a004(0x126)],'isSelectOnly':_0xe873e6[_0x21a004(0x142)][_0x21a004(0x127)],'isDangerous':_0xe873e6[_0x21a004(0x142)][_0x21a004(0x12e)],'tables':_0xe873e6['tables'],'parameters':_0xe873e6[_0x21a004(0x140)],'message':_0xe873e6['message']};_0xe873e6[_0x21a004(0x142)]['reason']&&(_0x2fe89d[_0x21a004(0x123)]=_0xe873e6[_0x21a004(0x142)]['reason']);if(_0xd97136&&_0xe873e6[_0x21a004(0x12c)]){const _0x2e3b34=_0xd97136[_0x21a004(0x166)](',')[_0x21a004(0x141)](_0x13a5dd=>_0x13a5dd[_0x21a004(0x14f)]())[_0x21a004(0x153)](Boolean),_0x495e39=[],_0x507d45=[],_0x2f3b2a=filterDbTableBackedDatasets(await listDatasets(_0x24e13a['appCode'])),_0x52e2a3=new Map(_0x2f3b2a[_0x21a004(0x141)](_0x3ff41e=>[_0x3ff41e['dbtableConfig']?.[_0x21a004(0x15f)]?.[_0x21a004(0x128)](),_0x3ff41e]));for(const _0xa38bb8 of _0xe873e6[_0x21a004(0x157)]){const _0x4be4f1=_0x52e2a3[_0x21a004(0x164)](_0xa38bb8['toLowerCase']());!_0x4be4f1&&_0x495e39[_0x21a004(0x13a)](_0x21a004(0x15e)+_0xa38bb8+_0x21a004(0x133));}for(const _0x2c220e of _0x2e3b34){let _0x52262b;try{_0x52262b=await getDatasetDetail(_0x2c220e);}catch{_0x495e39[_0x21a004(0x13a)](_0x21a004(0x145)+_0x2c220e+_0x21a004(0x158));continue;}assertDatasetIsDbTableBacked(_0x52262b,_0x21a004(0x12b));const _0x54092d=Array[_0x21a004(0x147)](_0x52262b[_0x21a004(0x136)])?_0x52262b[_0x21a004(0x136)]:[],_0x3ab62d=new Set(_0x54092d[_0x21a004(0x141)](_0x3fb517=>_0x3fb517[_0x21a004(0x131)]?.[_0x21a004(0x128)]())),_0x10c826=_0x52262b[_0x21a004(0x146)]?.[_0x21a004(0x15f)]||_0x52262b[_0x21a004(0x15f)]||_0x2c220e;_0x2fe89d[_0x21a004(0x13c)+_0x10c826]={'code':_0x2c220e,'tableName':_0x10c826,'fieldCount':_0x3ab62d[_0x21a004(0x154)],'fields':Array['from'](_0x3ab62d)};if(_0x1bddad){const _0x4b0786=normalizeDatasetIndexes(_0x52262b);_0x507d45['push']({'tableName':_0x10c826,..._0x4b0786});}}_0x495e39[_0x21a004(0x14e)]>0x0&&(_0x2fe89d[_0x21a004(0x12a)]=_0x495e39),_0x1bddad&&(_0x2fe89d[_0x21a004(0x135)]=auditSqlJoinIndexes(_0x414de5,_0x507d45));}return{'ok':_0xe873e6[_0x21a004(0x12c)],'data':_0x2fe89d,'message':_0xe873e6[_0x21a004(0x150)]};}};function normalizeDatasetIndexes(_0x2c0363){const _0x514712=a194_0x2210d3,_0x1311c7=Array[_0x514712(0x147)](_0x2c0363?.[_0x514712(0x155)]?.['indexes'])?_0x2c0363[_0x514712(0x155)]['indexes']:Array[_0x514712(0x147)](_0x2c0363?.[_0x514712(0x13d)])?_0x2c0363[_0x514712(0x13d)]:[],_0x219889=_0x1311c7[_0x514712(0x151)](_0x188842=>{const _0x5e9d99=_0x514712,_0x2b8daa=Array[_0x5e9d99(0x147)](_0x188842?.[_0x5e9d99(0x15a)])?_0x188842[_0x5e9d99(0x15a)]:Array[_0x5e9d99(0x147)](_0x188842?.[_0x5e9d99(0x125)])?_0x188842[_0x5e9d99(0x125)]:Array[_0x5e9d99(0x147)](_0x188842?.[_0x5e9d99(0x160)])?_0x188842[_0x5e9d99(0x160)]:[],_0xa97569=_0x2b8daa[_0x5e9d99(0x153)](_0x4b0335=>typeof _0x4b0335===_0x5e9d99(0x161))[_0x5e9d99(0x141)](_0x37e4df=>_0x37e4df[_0x5e9d99(0x14f)]())[_0x5e9d99(0x153)](Boolean);if(_0xa97569[_0x5e9d99(0x14e)]===0x0)return[];const _0xc766e=[_0x188842?.[_0x5e9d99(0x149)],_0x188842?.[_0x5e9d99(0x14a)],_0x188842?.[_0x5e9d99(0x131)]][_0x5e9d99(0x129)](_0x4d5ec1=>typeof _0x4d5ec1===_0x5e9d99(0x161)&&_0x4d5ec1[_0x5e9d99(0x14f)]()),_0x16549a=[_0x188842?.[_0x5e9d99(0x162)],_0x188842?.[_0x5e9d99(0x126)]][_0x5e9d99(0x129)](_0x1484d7=>typeof _0x1484d7===_0x5e9d99(0x161)&&_0x1484d7[_0x5e9d99(0x14f)]());return[{..._0xc766e?{'name':_0xc766e[_0x5e9d99(0x14f)]()}:{},..._0x16549a?{'type':_0x16549a[_0x5e9d99(0x14f)]()}:{},'columns':_0xa97569}];}),_0x22dcdb=[..._0x219889],_0x177374=typeof _0x2c0363?.[_0x514712(0x146)]?.[_0x514712(0x143)]===_0x514712(0x161)?_0x2c0363[_0x514712(0x146)]['pkField']['split'](',')[_0x514712(0x141)](_0xa97ca6=>_0xa97ca6[_0x514712(0x14f)]())[_0x514712(0x153)](Boolean):[];return _0x177374['length']>0x0&&_0x22dcdb[_0x514712(0x122)]({'type':'primary','columns':_0x177374}),{'indexes':_0x22dcdb,'metadataAvailable':_0x219889[_0x514712(0x14e)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1e21f,_0x59c3de){const _0x43b2b2=a195_0x8a3c,_0x4ddab5=_0x1e21f();while(!![]){try{const _0x1b61ba=parseInt(_0x43b2b2(0x73))/0x1+parseInt(_0x43b2b2(0x72))/0x2+parseInt(_0x43b2b2(0x70))/0x3*(-parseInt(_0x43b2b2(0x6d))/0x4)+parseInt(_0x43b2b2(0x77))/0x5*(parseInt(_0x43b2b2(0x6f))/0x6)+-parseInt(_0x43b2b2(0x71))/0x7*(parseInt(_0x43b2b2(0x6e))/0x8)+parseInt(_0x43b2b2(0x74))/0x9+parseInt(_0x43b2b2(0x76))/0xa*(-parseInt(_0x43b2b2(0x75))/0xb);if(_0x1b61ba===_0x59c3de)break;else _0x4ddab5['push'](_0x4ddab5['shift']());}catch(_0x22c96){_0x4ddab5['push'](_0x4ddab5['shift']());}}}(a195_0x1a09,0x8abd7));function a195_0x8a3c(_0x424fc7,_0x1fd3d6){_0x424fc7=_0x424fc7-0x6d;const _0x1a09a4=a195_0x1a09();let _0x8a3cf0=_0x1a09a4[_0x424fc7];return _0x8a3cf0;}import{taskStatus}from'../../commands/task/status.js';function a195_0x1a09(){const _0x3ddd42=['349665XCBEgB','67020ibmiyY','59704WpmSBG','36hcrcNe','81rPCOpB','511oAXbwE','735144oIPAXM','946770hRHtaO','933561hwrCEv','2994266kAXYvs','10fvMbnr'];a195_0x1a09=function(){return _0x3ddd42;};return a195_0x1a09();}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a196_0x22e1b5=a196_0x32c8;(function(_0x1ab464,_0x3b1efb){const _0x2fbde0=a196_0x32c8,_0x913d06=_0x1ab464();while(!![]){try{const _0x124ba7=-parseInt(_0x2fbde0(0x69))/0x1*(-parseInt(_0x2fbde0(0x6d))/0x2)+parseInt(_0x2fbde0(0x6a))/0x3*(-parseInt(_0x2fbde0(0x80))/0x4)+-parseInt(_0x2fbde0(0x82))/0x5+-parseInt(_0x2fbde0(0x7c))/0x6+-parseInt(_0x2fbde0(0x72))/0x7*(-parseInt(_0x2fbde0(0x79))/0x8)+-parseInt(_0x2fbde0(0x78))/0x9*(parseInt(_0x2fbde0(0x70))/0xa)+parseInt(_0x2fbde0(0x7d))/0xb;if(_0x124ba7===_0x3b1efb)break;else _0x913d06['push'](_0x913d06['shift']());}catch(_0x5a81f9){_0x913d06['push'](_0x913d06['shift']());}}}(a196_0x2ecb,0xdcd0e));function a196_0x2ecb(){const _0x4c1a3d=['4736EPAwYL','compress','str','1375590toRKRg','9735935sWgQnj','taskId','flagMissing','48mRdbSO','trim','5709770goWBCO','29IbPDAc','37980lQLndP','appCode','string','16478MjBcHh','status','task','2184470wewduU','cookie','17997chEOge','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','task-id','apiError','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','9AyLLqI'];a196_0x2ecb=function(){return _0x4c1a3d;};return a196_0x2ecb();}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 a196_0x32c8(_0x446ac1,_0x36dd75){_0x446ac1=_0x446ac1-0x69;const _0x2ecb53=a196_0x2ecb();let _0x32c871=_0x2ecb53[_0x446ac1];return _0x32c871;}import{CliErrors}from'../../errors.js';export const taskStatus={'service':a196_0x22e1b5(0x6f),'command':a196_0x22e1b5(0x6e),'description':a196_0x22e1b5(0x74),'risk':'read','defaultOutputFormat':a196_0x22e1b5(0x7a),'structuredErrors':!![],'flags':[{'name':a196_0x22e1b5(0x75),'type':a196_0x22e1b5(0x6c),'required':!![],'description':a196_0x22e1b5(0x77)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x103675){const _0x4bec0a=a196_0x22e1b5;if(!_0x103675[_0x4bec0a(0x7b)](_0x4bec0a(0x75))[_0x4bec0a(0x81)]())throw CliErrors[_0x4bec0a(0x7f)]('task-id');},async 'execute'(_0x5cd387){const _0x25f45d=a196_0x22e1b5,_0x290cf2=_0x5cd387[_0x25f45d(0x7b)]('task-id')[_0x25f45d(0x81)](),_0x53fc7e=normalizeAsyncTask(await getAsyncTaskStatus(_0x290cf2,_0x5cd387['appCode'],_0x5cd387[_0x25f45d(0x71)]));if(_0x53fc7e[_0x25f45d(0x7e)]!==_0x290cf2)throw CliErrors[_0x25f45d(0x76)](_0x25f45d(0x73)+_0x290cf2+',\x20received\x20'+_0x53fc7e[_0x25f45d(0x7e)]+'.');const _0x3c111f=buildAsyncTaskStatusCommand(_0x53fc7e[_0x25f45d(0x7e)],_0x5cd387[_0x25f45d(0x6b)]);return{'ok':!![],'message':asyncTaskMessage(_0x53fc7e),'data':{'appCode':_0x5cd387[_0x25f45d(0x6b)],..._0x53fc7e,'query':_0x53fc7e['isTerminal']?null:{'command':_0x3c111f}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xef08e2,_0xb371d4){const _0x339465=a197_0x32dc,_0x2b39c0=_0xef08e2();while(!![]){try{const _0x22f13e=parseInt(_0x339465(0xa8))/0x1+-parseInt(_0x339465(0xad))/0x2+-parseInt(_0x339465(0xac))/0x3+-parseInt(_0x339465(0xae))/0x4+-parseInt(_0x339465(0xaa))/0x5*(-parseInt(_0x339465(0xa9))/0x6)+-parseInt(_0x339465(0xab))/0x7+parseInt(_0x339465(0xa7))/0x8;if(_0x22f13e===_0xb371d4)break;else _0x2b39c0['push'](_0x2b39c0['shift']());}catch(_0x35942b){_0x2b39c0['push'](_0x2b39c0['shift']());}}}(a197_0x2f8b,0xa19ab));function a197_0x2f8b(){const _0x5d919b=['5280788SHLRwa','16083816lDladh','953438DAepve','48vKACdL','590980pHorlf','8379707BMYiPO','308607mxAHlS','1254770UBDMoT'];a197_0x2f8b=function(){return _0x5d919b;};return a197_0x2f8b();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a197_0x32dc(_0x974d8d,_0x32699d){_0x974d8d=_0x974d8d-0xa7;const _0x2f8b72=a197_0x2f8b();let _0x32dc6d=_0x2f8b72[_0x974d8d];return _0x32dc6d;}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a198_0x52fe(_0x162a6f,_0x233aec){_0x162a6f=_0x162a6f-0x1b1;const _0x5a287d=a198_0x5a28();let _0x52fe2c=_0x5a287d[_0x162a6f];return _0x52fe2c;}const a198_0x2754b2=a198_0x52fe;(function(_0x19a6a6,_0x2a10dc){const _0x5731e7=a198_0x52fe,_0x2992a1=_0x19a6a6();while(!![]){try{const _0x36cfae=parseInt(_0x5731e7(0x1b2))/0x1*(-parseInt(_0x5731e7(0x1b6))/0x2)+-parseInt(_0x5731e7(0x1b7))/0x3+parseInt(_0x5731e7(0x1be))/0x4*(-parseInt(_0x5731e7(0x1bd))/0x5)+-parseInt(_0x5731e7(0x1b9))/0x6+-parseInt(_0x5731e7(0x1c1))/0x7*(-parseInt(_0x5731e7(0x1c6))/0x8)+parseInt(_0x5731e7(0x1bf))/0x9*(-parseInt(_0x5731e7(0x1c5))/0xa)+parseInt(_0x5731e7(0x1b1))/0xb;if(_0x36cfae===_0x2a10dc)break;else _0x2992a1['push'](_0x2992a1['shift']());}catch(_0x209355){_0x2992a1['push'](_0x2992a1['shift']());}}}(a198_0x5a28,0xeb510));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':a198_0x2754b2(0x1b3),'command':'members-list','description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':'read','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a198_0x2754b2(0x1c2),'type':a198_0x2754b2(0x1c4),'required':!![],'description':a198_0x2754b2(0x1c0)}],async 'validate'(_0x435cce){const _0xa28176=a198_0x2754b2;if(!_0x435cce[_0xa28176(0x1b5)](_0xa28176(0x1c2))['trim']())throw CliErrors[_0xa28176(0x1bb)](_0xa28176(0x1c2),_0xa28176(0x1b8));},async 'execute'(_0x18b37b){const _0x2bf7d5=a198_0x2754b2,_0x13b798=_0x18b37b[_0x2bf7d5(0x1b5)](_0x2bf7d5(0x1c2))[_0x2bf7d5(0x1bc)](),_0x4d2108=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x13b798,_0x4d2108);const _0x124f5b=projectTenantMembers(await listTenantDirectoryMembers(_0x13b798));return{'ok':!![],'data':{'tenantCode':_0x13b798,'items':_0x124f5b,'totalCount':_0x124f5b[_0x2bf7d5(0x1c3)]},'message':_0x2bf7d5(0x1b4)+_0x124f5b['length']+_0x2bf7d5(0x1ba)};}};function a198_0x5a28(){const _0x2ec4e9=['2090qLALPn','6226152JnpAbO','54160337JgtWlu','12021sMdRsN','tenant','Found\x20','str','178GYJwns','1161573xPUISz','Pass\x20--tenant-code\x20<code>.','7806102QlSGYM','\x20tenant\x20member(s)','flagMissing','trim','6917585LMwGsm','4Eiyzdm','25686lztOaH','Exact\x20tenant\x20code','7OgyZmo','tenant-code','length','string'];a198_0x5a28=function(){return _0x2ec4e9;};return a198_0x5a28();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a199_0x3a73(_0xcd2005,_0x3a12d0){_0xcd2005=_0xcd2005-0x1f4;const _0x1f1c60=a199_0x1f1c();let _0x3a7376=_0x1f1c60[_0xcd2005];return _0x3a7376;}(function(_0x1bb0e7,_0x235b49){const _0x3e353b=a199_0x3a73,_0x17c794=_0x1bb0e7();while(!![]){try{const _0x5320ce=-parseInt(_0x3e353b(0x1f5))/0x1+parseInt(_0x3e353b(0x20d))/0x2*(parseInt(_0x3e353b(0x200))/0x3)+parseInt(_0x3e353b(0x1fb))/0x4+-parseInt(_0x3e353b(0x20a))/0x5*(parseInt(_0x3e353b(0x1f9))/0x6)+parseInt(_0x3e353b(0x204))/0x7+-parseInt(_0x3e353b(0x20b))/0x8+-parseInt(_0x3e353b(0x202))/0x9*(-parseInt(_0x3e353b(0x206))/0xa);if(_0x5320ce===_0x235b49)break;else _0x17c794['push'](_0x17c794['shift']());}catch(_0xa23c2b){_0x17c794['push'](_0x17c794['shift']());}}}(a199_0x1f1c,0x39087));import{CliErrors}from'../../errors.js';function textOrNull(_0x25ad74){const _0xb0f63d=a199_0x3a73,_0x4519c3=_0x25ad74?.[_0xb0f63d(0x1fd)]();return _0x4519c3?_0x4519c3:null;}export function projectTenantMembers(_0x36d407){const _0x2a0a5d=a199_0x3a73,_0x13ec20=new Map();for(const _0x50d0fe of _0x36d407){const _0x592bae=Number(_0x50d0fe['userId']);if(!Number[_0x2a0a5d(0x207)](_0x592bae)||_0x592bae<=0x0)continue;const _0x253441={'userId':_0x592bae,'username':textOrNull(_0x50d0fe[_0x2a0a5d(0x1f7)]),'displayName':textOrNull(_0x50d0fe['nickname']),'role':_0x50d0fe[_0x2a0a5d(0x203)]===!![]?_0x2a0a5d(0x205):_0x2a0a5d(0x1f8),'status':textOrNull(_0x50d0fe[_0x2a0a5d(0x208)])},_0x5a74fd=_0x13ec20[_0x2a0a5d(0x20e)](_0x592bae);if(!_0x5a74fd){_0x13ec20[_0x2a0a5d(0x1f4)](_0x592bae,_0x253441);continue;}_0x5a74fd[_0x2a0a5d(0x1f7)]??=_0x253441[_0x2a0a5d(0x1f7)],_0x5a74fd[_0x2a0a5d(0x209)]??=_0x253441[_0x2a0a5d(0x209)],_0x5a74fd[_0x2a0a5d(0x208)]??=_0x253441[_0x2a0a5d(0x208)];if(_0x253441[_0x2a0a5d(0x201)]===_0x2a0a5d(0x205))_0x5a74fd[_0x2a0a5d(0x201)]=_0x2a0a5d(0x205);}return[..._0x13ec20[_0x2a0a5d(0x20c)]()]['sort']((_0x547e8c,_0x37a0e2)=>_0x547e8c[_0x2a0a5d(0x1fa)]-_0x37a0e2['userId']);}function a199_0x1f1c(){const _0x27d77e=['2007VaMZVX','adminFlag','1359750EdFCPH','ADMIN','26330baJcbh','isFinite','status','displayName','10SCwPfQ','1774968VDautP','values','22aGWCuh','get','set','266222qGNYri','some','username','MEMBER','499794zxRGxr','userId','396800jHnOgy','tenantCode','trim','validation','Tenant\x20\x22','2097qhzSOr','role'];a199_0x1f1c=function(){return _0x27d77e;};return a199_0x1f1c();}export function assertTenantAccessible(_0x27eefb,_0x42a85d){const _0x3bb55d=a199_0x3a73;if(_0x42a85d[_0x3bb55d(0x1f6)](_0x1bf59e=>_0x1bf59e[_0x3bb55d(0x1fc)]===_0x27eefb))return;throw CliErrors[_0x3bb55d(0x1fe)](_0x3bb55d(0x1ff)+_0x27eefb+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a200_0x58336e=a200_0x5e05;(function(_0x3d3c4a,_0x14a691){const _0x1f6524=a200_0x5e05,_0xbb932=_0x3d3c4a();while(!![]){try{const _0x178b73=-parseInt(_0x1f6524(0x1b6))/0x1*(-parseInt(_0x1f6524(0x1c4))/0x2)+parseInt(_0x1f6524(0x1bb))/0x3*(-parseInt(_0x1f6524(0x1b9))/0x4)+-parseInt(_0x1f6524(0x1be))/0x5*(-parseInt(_0x1f6524(0x1c6))/0x6)+parseInt(_0x1f6524(0x1c3))/0x7+-parseInt(_0x1f6524(0x1ce))/0x8*(parseInt(_0x1f6524(0x1bf))/0x9)+-parseInt(_0x1f6524(0x1b7))/0xa+parseInt(_0x1f6524(0x1b5))/0xb;if(_0x178b73===_0x14a691)break;else _0xbb932['push'](_0xbb932['shift']());}catch(_0x3ae6c3){_0xbb932['push'](_0xbb932['shift']());}}}(a200_0x1942,0x75dd6));function a200_0x5e05(_0x3f29d9,_0x43185d){_0x3f29d9=_0x3f29d9-0x1b3;const _0x19423b=a200_0x1942();let _0x5e050c=_0x19423b[_0x3f29d9];return _0x5e050c;}import{asDryRunResult}from'../../commands/common/dry-run.js';function a200_0x1942(){const _0x450962=['bind','string','POST','dingding-sandbox','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','8hInSwY','dingding-sandbox-bind','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','5238035TxrZxT','79eewnha','1030690arThuR','ding-talk-user-id','31732unVGbl','validation','114JmOIxm','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','5JlHBQe','1529208bHncSk','str','trim','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','2215094eFKJol','4904spRjJL','user-account','425244BUUjDL','--ding-talk-user-id\x20cannot\x20be\x20empty.','write'];a200_0x1942=function(){return _0x450962;};return a200_0x1942();}import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a200_0x58336e(0x1cc),CURRENT_BINDING_WARNING=a200_0x58336e(0x1cd);function readDingTalkUserId(_0x306358){const _0x104154=a200_0x58336e,_0x2cf44f=_0x306358[_0x104154(0x1c0)](_0x104154(0x1b8))[_0x104154(0x1c1)]();if(!_0x2cf44f)throw CliErrors[_0x104154(0x1ba)](_0x104154(0x1c7),_0x104154(0x1bc));return _0x2cf44f;}function buildBindingData(_0x2c59f1,_0x20faf2){const _0x3fae7b=a200_0x58336e;return{'operation':_0x3fae7b(0x1c9),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x2c59f1},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x2c59f1,'bound':!![]},'dryRun':_0x20faf2,'backend':{'method':_0x3fae7b(0x1cb),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a200_0x58336e(0x1c5),'command':a200_0x58336e(0x1b3),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':a200_0x58336e(0x1c8),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a200_0x58336e(0x1b8),'type':a200_0x58336e(0x1ca),'required':!![],'description':'DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox'}],async 'validate'(_0x1c6fca){readDingTalkUserId(_0x1c6fca);},async 'dryRun'(_0x182a4d){const _0xa2855f=readDingTalkUserId(_0x182a4d);return asDryRunResult(buildBindingData(_0xa2855f,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x43055c){const _0x5b2a8a=a200_0x58336e,_0x1404de=readDingTalkUserId(_0x43055c),_0x3e1a14=await bindDingTalkSandboxAccount(_0x1404de);if(_0x3e1a14!==!![])throw CliErrors['apiError'](_0x5b2a8a(0x1b4),_0x5b2a8a(0x1bd));return{'ok':!![],'data':buildBindingData(_0x1404de,![]),'message':_0x5b2a8a(0x1c2)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a201_0x2117(){const _0x2e5e4b=['2354052yXEJeX','8ObXDxA','471360keCmoo','8883650EgyLIb','11ZeFppG','330326sIPogl','7BPGXVV','10852YflBrf','78owkhHd','1771444fvWHIU','2824947LyNUnu'];a201_0x2117=function(){return _0x2e5e4b;};return a201_0x2117();}(function(_0x529e5f,_0x833728){const _0x29e7b3=a201_0x5bb5,_0x51160e=_0x529e5f();while(!![]){try{const _0x63f5d4=-parseInt(_0x29e7b3(0x10c))/0x1+parseInt(_0x29e7b3(0x10e))/0x2*(-parseInt(_0x29e7b3(0x10f))/0x3)+parseInt(_0x29e7b3(0x110))/0x4+parseInt(_0x29e7b3(0x114))/0x5+parseInt(_0x29e7b3(0x112))/0x6*(-parseInt(_0x29e7b3(0x10d))/0x7)+-parseInt(_0x29e7b3(0x113))/0x8*(parseInt(_0x29e7b3(0x111))/0x9)+parseInt(_0x29e7b3(0x10a))/0xa*(parseInt(_0x29e7b3(0x10b))/0xb);if(_0x63f5d4===_0x833728)break;else _0x51160e['push'](_0x51160e['shift']());}catch(_0x5b37c9){_0x51160e['push'](_0x51160e['shift']());}}}(a201_0x2117,0x3c83f));function a201_0x5bb5(_0x320ebc,_0x3bf42b){_0x320ebc=_0x320ebc-0x10a;const _0x21172a=a201_0x2117();let _0x5bb57b=_0x21172a[_0x320ebc];return _0x5bb57b;}import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a202_0x5b66(){const _0x22ec35=['1900430xbjIHC','2102wbBLZA','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','1021196QzzLkp','workspace\x20add','add','130bIhfLj','App\x20profile\x20name','6587811TVMjOu','405652QKqYJL','40PdxgAe','1017VbbnPY','3240732INAzqB','name','8EoGtCH','712221TBqHEo','write'];a202_0x5b66=function(){return _0x22ec35;};return a202_0x5b66();}function a202_0x467c(_0x3b7017,_0x3b6099){_0x3b7017=_0x3b7017-0x16a;const _0x5b6620=a202_0x5b66();let _0x467cc8=_0x5b6620[_0x3b7017];return _0x467cc8;}const a202_0x429dde=a202_0x467c;(function(_0x108c46,_0xe753b4){const _0x46e617=a202_0x467c,_0x3f6e6d=_0x108c46();while(!![]){try{const _0xf8ec1b=parseInt(_0x46e617(0x172))/0x1+-parseInt(_0x46e617(0x175))/0x2*(-parseInt(_0x46e617(0x16e))/0x3)+parseInt(_0x46e617(0x16c))/0x4*(-parseInt(_0x46e617(0x16d))/0x5)+-parseInt(_0x46e617(0x16f))/0x6+-parseInt(_0x46e617(0x174))/0x7*(-parseInt(_0x46e617(0x171))/0x8)+-parseInt(_0x46e617(0x16b))/0x9+parseInt(_0x46e617(0x17a))/0xa*(parseInt(_0x46e617(0x177))/0xb);if(_0xf8ec1b===_0xe753b4)break;else _0x3f6e6d['push'](_0x3f6e6d['shift']());}catch(_0x1c9520){_0x3f6e6d['push'](_0x3f6e6d['shift']());}}}(a202_0x5b66,0x71267));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':'workspace','command':a202_0x429dde(0x179),'description':a202_0x429dde(0x176),'risk':a202_0x429dde(0x173),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a202_0x429dde(0x170),'description':a202_0x429dde(0x16a),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x5c5fa9=>validateAppName(_0x5c5fa9,a202_0x429dde(0x178)),'execute':_0x4033f7=>runAppAdd(_0x4033f7,a202_0x429dde(0x178))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a203_0x29b80a=a203_0x5623;(function(_0x47301,_0x4ee5bb){const _0x1d011f=a203_0x5623,_0x7b3b3f=_0x47301();while(!![]){try{const _0x167541=-parseInt(_0x1d011f(0x10c))/0x1+-parseInt(_0x1d011f(0x119))/0x2+parseInt(_0x1d011f(0x110))/0x3*(parseInt(_0x1d011f(0x115))/0x4)+-parseInt(_0x1d011f(0xf1))/0x5*(parseInt(_0x1d011f(0xfc))/0x6)+-parseInt(_0x1d011f(0x11d))/0x7+parseInt(_0x1d011f(0x10f))/0x8*(parseInt(_0x1d011f(0x118))/0x9)+parseInt(_0x1d011f(0x102))/0xa*(parseInt(_0x1d011f(0x108))/0xb);if(_0x167541===_0x4ee5bb)break;else _0x7b3b3f['push'](_0x7b3b3f['shift']());}catch(_0x337a31){_0x7b3b3f['push'](_0x7b3b3f['shift']());}}}(a203_0x3f0f,0xe3387));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';function a203_0x3f0f(){const _0x43764d=['workspace','flag','\x20--appcode\x20<code>`.','6544433qssPDl','riskLevel','Target\x20environment','trim','object','locale','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','\x20(appcode:\x20','apiDir','format','8982065yWqoYu','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','number','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','appcode','defaultFormat','length','env','workspace.','pageSize','App\x20\x22','6biRAbV','apps','Initialize\x20the\x20current\x20workspace\x20app\x20binding','Switch\x20the\x20current\x20workspace\x20app\x20binding','\x20workspace\x20use\x20--app\x20<name>`.','app','10cdeElS','validation','Use\x20`','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','Locale\x20for\x20this\x20workspace\x20app\x20profile','init','60268197hCzmjG','\x20--app\x20','keys','use','1585888rDXxEu','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','str','5624096CPsHAL','15BrJABV','globalConfig','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','Missing\x20workspace\x20app\x20selector.','286792eZZOHa','string','write','9oPpebe','2585028MchtNr'];a203_0x3f0f=function(){return _0x43764d;};return a203_0x3f0f();}function a203_0x5623(_0x3d6934,_0x41dbb4){_0x3d6934=_0x3d6934-0xee;const _0x3f0f34=a203_0x3f0f();let _0x562364=_0x3f0f34[_0x3d6934];return _0x562364;}const WORKSPACE_USAGE=CLI_BIN_NAME+a203_0x29b80a(0x113),SAFE_PROFILE_KEYS=['appcode','env','apiDir',a203_0x29b80a(0xf0),a203_0x29b80a(0xfa),a203_0x29b80a(0x11e),a203_0x29b80a(0x122)],workspaceFlags=[{'name':a203_0x29b80a(0x101),'type':a203_0x29b80a(0x116),'description':'App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace'},{'name':'appcode','type':'string','description':'App\x20code\x20to\x20bind\x20to\x20this\x20workspace'},{'name':a203_0x29b80a(0xf8),'type':'string','description':a203_0x29b80a(0x11f),'enum':[...RABETBASE_ENV_VALUES]},{'name':'apiDir','type':'string','description':a203_0x29b80a(0x10d)},{'name':a203_0x29b80a(0xf6),'type':a203_0x29b80a(0x116),'description':a203_0x29b80a(0x123),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':a203_0x29b80a(0xf3),'description':a203_0x29b80a(0x112)},{'name':a203_0x29b80a(0x11e),'type':a203_0x29b80a(0x116),'description':a203_0x29b80a(0xf4),'enum':[...RISK_LEVEL_VALUES]},{'name':a203_0x29b80a(0x122),'type':a203_0x29b80a(0x116),'description':a203_0x29b80a(0x106)}];function isRecord(_0x4732c8){const _0x17b09e=a203_0x29b80a;return!!_0x4732c8&&typeof _0x4732c8===_0x17b09e(0x121)&&!Array['isArray'](_0x4732c8);}function assertValidAppcode(_0x249e8f){const _0x44abce=a203_0x29b80a,{valid:_0x154775,message:_0x417ea9}=validateAppcode(_0x249e8f);if(!_0x154775)throw CliErrors[_0x44abce(0x103)]('Invalid\x20appcode:\x20'+_0x249e8f,_0x417ea9);}function sanitizeProfile(_0x2660da){if(!isRecord(_0x2660da))return{};const _0x25b20d={};for(const _0x34a2b4 of SAFE_PROFILE_KEYS){if(_0x2660da[_0x34a2b4]!==undefined)_0x25b20d[_0x34a2b4]=_0x2660da[_0x34a2b4];}return _0x25b20d;}function cloneProfile(_0x39842e){return isRecord(_0x39842e)?{..._0x39842e}:{};}function collectWorkspaceProfileOverrides(_0x3e4cbf){const _0x499b86=a203_0x29b80a,_0x190568={},_0xf2915f=_0x3e4cbf['str'](_0x499b86(0xf8)),_0x5cd1c0=_0x3e4cbf['str']('apiDir'),_0x5d9bcd=_0x3e4cbf[_0x499b86(0x10e)](_0x499b86(0xf6)),_0x88384f=_0x3e4cbf[_0x499b86(0x11b)]('pageSize'),_0xf34247=_0x3e4cbf[_0x499b86(0x10e)]('riskLevel'),_0x1e8ce7=_0x3e4cbf[_0x499b86(0x10e)](_0x499b86(0x122));if(_0xf2915f)_0x190568[_0x499b86(0xf8)]=_0xf2915f;if(_0x5cd1c0)_0x190568[_0x499b86(0xef)]=_0x5cd1c0;if(_0x5d9bcd)_0x190568[_0x499b86(0xf0)]=_0x5d9bcd;if(_0x88384f!==undefined&&_0x88384f!=='')_0x190568['pageSize']=Number(_0x88384f);if(_0xf34247)_0x190568[_0x499b86(0x11e)]=_0xf34247;if(_0x1e8ce7)_0x190568['locale']=_0x1e8ce7;return _0x190568;}async function validateWorkspaceArgs(_0x2fdcbf){const _0x23351c=a203_0x29b80a,_0x484df8=_0x2fdcbf[_0x23351c(0x10e)](_0x23351c(0x101))[_0x23351c(0x120)](),_0x30e407=_0x2fdcbf[_0x23351c(0x10e)](_0x23351c(0xf5))[_0x23351c(0x120)]();if(!_0x484df8&&!_0x30e407)throw CliErrors['validation'](_0x23351c(0x114),_0x23351c(0x104)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+_0x23351c(0x100));if(_0x30e407)assertValidAppcode(_0x30e407);}function resolveKnownApps(){const _0x52b505=a203_0x29b80a,{config:_0x351695,layers:_0x587bfe}=readRawConfigWithLayers(),_0x2708b5=isRecord(_0x351695['apps'])?_0x351695[_0x52b505(0xfd)]:{},_0x4ff698=isRecord(_0x587bfe['globalConfig'][_0x52b505(0xfd)])?_0x587bfe[_0x52b505(0x111)][_0x52b505(0xfd)]:{};return{..._0x4ff698,..._0x2708b5};}async function configureWorkspace(_0xd92d6c,_0x384fff){const _0x303cd8=a203_0x29b80a,_0x1c53b0=_0xd92d6c[_0x303cd8(0x10e)](_0x303cd8(0x101))[_0x303cd8(0x120)](),_0x578c19=_0xd92d6c['str'](_0x303cd8(0xf5))['trim'](),_0x452292=_0x1c53b0||_0x578c19;if(!_0x452292)throw CliErrors[_0x303cd8(0x103)](_0x303cd8(0x114),'Use\x20`'+CLI_BIN_NAME+_0x303cd8(0x105)+CLI_BIN_NAME+_0x303cd8(0x100));if(_0x578c19)assertValidAppcode(_0x578c19);const _0x446b4e=resolveWriteConfigPath('project'),_0x301fde=readConfigFile(_0x446b4e),_0x25df8e=resolveKnownApps(),_0x23b70d=isRecord(_0x301fde[_0x303cd8(0xfd)])?{..._0x301fde[_0x303cd8(0xfd)]}:{},_0x1cf75d=cloneProfile(_0x23b70d[_0x452292]),_0x50b96d=sanitizeProfile(_0x25df8e[_0x452292]),_0x301a16=_0x578c19?{}:_0x50b96d,_0x1997b4=_0x578c19||_0x301a16['appcode'];if(!_0x1997b4){const _0x11f962=Object[_0x303cd8(0x10a)](_0x25df8e),_0x2c5a1b=_0x11f962[_0x303cd8(0xf7)]===0x0?_0x303cd8(0x104)+CLI_BIN_NAME+'\x20workspace\x20'+_0x384fff+_0x303cd8(0x109)+_0x452292+_0x303cd8(0x11c):_0x303cd8(0xf2)+_0x11f962['join'](',\x20');throw CliErrors['validation'](_0x303cd8(0xfb)+_0x452292+'\x22\x20not\x20found.',_0x2c5a1b);}assertValidAppcode(String(_0x1997b4));const _0x10724e={..._0x301a16,..._0x1cf75d,'appcode':String(_0x1997b4),...collectWorkspaceProfileOverrides(_0xd92d6c)};return _0x23b70d[_0x452292]=_0x10724e,_0x301fde['apps']=_0x23b70d,_0x301fde['defaultApp']=_0x452292,delete _0x301fde[_0x303cd8(0xf5)],delete _0x301fde[_0x303cd8(0x101)],_0x10724e[_0x303cd8(0xf8)]&&(_0x301fde[_0x303cd8(0xf8)]=_0x10724e[_0x303cd8(0xf8)]),writeConfigFile(_0x446b4e,_0x301fde),{'ok':!![],'message':'Workspace\x20'+(_0x384fff===_0x303cd8(0x107)?'initialized':'updated')+':\x20'+_0x452292+_0x303cd8(0xee)+_0x10724e['appcode']+').\x20Config:\x20'+_0x446b4e+'.\x20Credentials:\x20not\x20written.','data':{'operation':_0x303cd8(0xf9)+_0x384fff,'configPath':_0x446b4e,'app':_0x452292,'appcode':_0x10724e[_0x303cd8(0xf5)],'env':_0x10724e[_0x303cd8(0xf8)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a203_0x29b80a(0x11a),'command':a203_0x29b80a(0x107),'description':a203_0x29b80a(0xfe),'risk':a203_0x29b80a(0x117),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x4147e1=>configureWorkspace(_0x4147e1,a203_0x29b80a(0x107))},workspaceUseDefinition={'service':a203_0x29b80a(0x11a),'command':a203_0x29b80a(0x10b),'description':a203_0x29b80a(0xff),'risk':a203_0x29b80a(0x117),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x9d6464=>configureWorkspace(_0x9d6464,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a204_0x4305c7=a204_0x567d;function a204_0x567d(_0x319d42,_0x3d9d32){_0x319d42=_0x319d42-0x19c;const _0x262c6a=a204_0x262c();let _0x567daf=_0x262c6a[_0x319d42];return _0x567daf;}(function(_0x6d2c6,_0x2008da){const _0x1b4e1c=a204_0x567d,_0x2ec167=_0x6d2c6();while(!![]){try{const _0x428af9=-parseInt(_0x1b4e1c(0x1a0))/0x1*(parseInt(_0x1b4e1c(0x1a9))/0x2)+-parseInt(_0x1b4e1c(0x1a8))/0x3*(parseInt(_0x1b4e1c(0x1a1))/0x4)+parseInt(_0x1b4e1c(0x19e))/0x5+-parseInt(_0x1b4e1c(0x1ac))/0x6*(-parseInt(_0x1b4e1c(0x1a2))/0x7)+parseInt(_0x1b4e1c(0x19d))/0x8+parseInt(_0x1b4e1c(0x1a5))/0x9+-parseInt(_0x1b4e1c(0x1ab))/0xa*(parseInt(_0x1b4e1c(0x1a4))/0xb);if(_0x428af9===_0x2008da)break;else _0x2ec167['push'](_0x2ec167['shift']());}catch(_0x1b42b1){_0x2ec167['push'](_0x2ec167['shift']());}}}(a204_0x262c,0x38428));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';function a204_0x262c(){const _0x56e89b=['10Urvnqm','48RxJRlG','write','574600xGNWSn','19680VwFIBE','App\x20profile\x20name\x20to\x20remove','12cxzIuT','212UQpswQ','284977PPBUXw','name','2613391iocAIT','4078917PZNwla','remove','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','3039vXxvGr','55492oiigkk','workspace\x20remove'];a204_0x262c=function(){return _0x56e89b;};return a204_0x262c();}export const workspaceRemoveDefinition={'service':'workspace','command':a204_0x4305c7(0x1a6),'description':a204_0x4305c7(0x1a7),'risk':a204_0x4305c7(0x19c),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a204_0x4305c7(0x1a3),'description':a204_0x4305c7(0x19f),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x3bfdf9=>validateAppName(_0x3bfdf9,'workspace\x20remove'),'execute':_0x30287d=>runAppRemove(_0x30287d,a204_0x4305c7(0x1aa))};
|