@lovrabet/rabetbase-cli 2.4.4 → 2.4.5
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_0x426c60=a197_0x8d1b;(function(_0x176ec8,_0x81b284){const _0x14d08d=a197_0x8d1b,_0x1d7e6c=_0x176ec8();while(!![]){try{const _0x597add=-parseInt(_0x14d08d(0x1e8))/0x1*(-parseInt(_0x14d08d(0x1c5))/0x2)+parseInt(_0x14d08d(0x1e2))/0x3*(parseInt(_0x14d08d(0x1d9))/0x4)+-parseInt(_0x14d08d(0x1cd))/0x5*(-parseInt(_0x14d08d(0x1b0))/0x6)+parseInt(_0x14d08d(0x1d1))/0x7+parseInt(_0x14d08d(0x1ae))/0x8*(parseInt(_0x14d08d(0x1bd))/0x9)+-parseInt(_0x14d08d(0x1c2))/0xa+parseInt(_0x14d08d(0x1e1))/0xb*(-parseInt(_0x14d08d(0x1b9))/0xc);if(_0x597add===_0x81b284)break;else _0x1d7e6c['push'](_0x1d7e6c['shift']());}catch(_0x22e9b0){_0x1d7e6c['push'](_0x1d7e6c['shift']());}}}(a197_0x5a81,0x459a5));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x25e88c,_0x431816){const _0x2266e1=a197_0x8d1b,_0x11a7ea=[];let _0x295490=0x1;while(!![]){const _0x12227f=await listSqlQueries(_0x25e88c,{'currentPage':_0x295490,'pageSize':PAGE_SIZE,'sqlCode':_0x431816[_0x2266e1(0x1dd)],'sqlName':_0x431816[_0x2266e1(0x1de)]}),_0x132eae=_0x12227f[_0x2266e1(0x1c4)]??[];_0x11a7ea['push'](..._0x132eae);if(_0x132eae[_0x2266e1(0x1ad)]===0x0)break;const _0x44590b=_0x12227f['paging']?.[_0x2266e1(0x1be)];if(_0x44590b!=null?_0x11a7ea[_0x2266e1(0x1ad)]>=_0x44590b:_0x132eae[_0x2266e1(0x1ad)]<PAGE_SIZE)break;_0x295490++;}return _0x11a7ea;}async function ensureSqlContent(_0x5c31f7){const _0x80dd7e=a197_0x8d1b;if(_0x5c31f7['sqlContent']!=null&&String(_0x5c31f7[_0x80dd7e(0x1c6)])[_0x80dd7e(0x1ad)]>0x0)return _0x5c31f7;return getSqlQueryDetail(_0x5c31f7[_0x80dd7e(0x1dd)]);}export const sqlPull={'service':a197_0x426c60(0x1b1),'command':a197_0x426c60(0x1e9),'description':a197_0x426c60(0x1da),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a197_0x426c60(0x1ec),'type':a197_0x426c60(0x1b2),'description':a197_0x426c60(0x1d3)},{'name':a197_0x426c60(0x1cf),'type':a197_0x426c60(0x1ed),'description':a197_0x426c60(0x1d2)}],async 'dryRun'(_0x7544cf){const _0x48b495=a197_0x426c60,_0x3beec2=loadSqlProjectConfig(_0x7544cf[_0x48b495(0x1c0)]),_0x37b454=await readSqlLockFile(_0x3beec2['lockFilePath']),{appLock:_0x277602}=ensureSqlLockScope(_0x37b454??createEmptySqlLock(),_0x3beec2[_0x48b495(0x1c0)],_0x3beec2[_0x48b495(0x1b7)],_0x48b495(0x1e9)),_0x38d8de=await fetchAllSqlQueries(_0x7544cf[_0x48b495(0x1c0)],{'sqlCode':_0x7544cf[_0x48b495(0x1d5)]('sqlcode')||undefined,'sqlName':_0x7544cf[_0x48b495(0x1d5)](_0x48b495(0x1ec))||undefined}),_0x48be89=[];for(const _0x33b0ea of _0x38d8de){const _0x17d2bd=await ensureSqlContent(_0x33b0ea),_0xda0c41=ensureRemoteSqlContent(_0x17d2bd),_0x477ea9=detectModeFromSql(_0x17d2bd),_0x3e0672=_0x17d2bd[_0x48b495(0x1c7)]?await getDbName(_0x7544cf[_0x48b495(0x1c0)],Number(_0x17d2bd[_0x48b495(0x1c7)]))[_0x48b495(0x1e7)](()=>undefined):undefined,_0x1be82a=buildLocalSqlFileContent({'sqlCode':_0x17d2bd[_0x48b495(0x1dd)],'sqlName':_0x17d2bd['sqlName'],'dbId':_0x17d2bd[_0x48b495(0x1c7)]},_0xda0c41,{'dbName':_0x3e0672,'mode':_0x477ea9,'syncedAt':new Date()[_0x48b495(0x1b5)](),'description':_0x17d2bd['description']}),_0x1142b8=buildSqlLockEntry(_0x17d2bd,_0xda0c41,'',{'dbName':_0x3e0672}),_0xe9cb82=resolveLocalSqlFilePath(_0x3beec2,_0x17d2bd[_0x48b495(0x1dd)],_0x1142b8);let _0x401cf6=_0x48b495(0x1eb),_0x7b6761;if(await fileExists(_0xe9cb82)){const _0x249109=await readFile(_0xe9cb82,'utf8');isEquivalentPulledSqlFile(_0x249109,_0x1be82a,_0x477ea9)?(_0x401cf6=_0x48b495(0x1ca),_0x7b6761=_0x48b495(0x1cb)):(_0x401cf6=_0x48b495(0x1d6),_0x7b6761=_0x48b495(0x1ea));}_0x48be89[_0x48b495(0x1ac)]({'sqlCode':_0x17d2bd[_0x48b495(0x1dd)],'sqlName':_0x17d2bd['sqlName'],'filePath':_0xe9cb82,'status':_0x401cf6,'reason':_0x7b6761});}return{'method':_0x48b495(0x1e4),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x7544cf['appCode'],'sqlCode':_0x7544cf[_0x48b495(0x1d5)](_0x48b495(0x1bf))||null,'sqlName':_0x7544cf[_0x48b495(0x1d5)](_0x48b495(0x1ec))||null,'files':_0x48be89},'description':_0x48b495(0x1d4)+_0x48be89[_0x48b495(0x1ad)]+_0x48b495(0x1d0)+_0x3beec2[_0x48b495(0x1e6)]};},async 'execute'(_0x114dc5){const _0x562c70=a197_0x426c60,_0x304e58=loadSqlProjectConfig(_0x114dc5[_0x562c70(0x1c0)]),_0x21b8ce=await readSqlLockFile(_0x304e58[_0x562c70(0x1e3)]),{lockData:_0x4683e7,appLock:_0x3067d6}=ensureSqlLockScope(_0x21b8ce??createEmptySqlLock(),_0x304e58['appCode'],_0x304e58['sqlRoot'],_0x562c70(0x1e9)),_0x3aa001=_0x114dc5[_0x562c70(0x1ce)]('force'),_0x1e2e4=await fetchAllSqlQueries(_0x114dc5[_0x562c70(0x1c0)],{'sqlCode':_0x114dc5[_0x562c70(0x1d5)](_0x562c70(0x1bf))||undefined,'sqlName':_0x114dc5[_0x562c70(0x1d5)](_0x562c70(0x1ec))||undefined});if(_0x1e2e4[_0x562c70(0x1ad)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x1ed442=[],_0x41587a=[];for(const _0x3e4a4d of _0x1e2e4){try{_0x1ed442[_0x562c70(0x1ac)](await ensureSqlContent(_0x3e4a4d));}catch(_0x35891e){_0x41587a[_0x562c70(0x1ac)]({'sqlCode':_0x3e4a4d[_0x562c70(0x1dd)],'error':_0x35891e instanceof Error?_0x35891e['message']:String(_0x35891e)});}}if(_0x3aa001&&!_0x114dc5[_0x562c70(0x1ba)]){let _0xf3c2c=![];for(const _0x489084 of _0x1ed442){const _0x48d109=detectModeFromSql(_0x489084),_0x4e63ec=_0x489084[_0x562c70(0x1c7)]?await getDbName(_0x114dc5[_0x562c70(0x1c0)],Number(_0x489084['dbId']))[_0x562c70(0x1e7)](()=>undefined):undefined,_0x1ac98a=buildLocalSqlFileContent({'sqlCode':_0x489084[_0x562c70(0x1dd)],'sqlName':_0x489084[_0x562c70(0x1de)],'dbId':_0x489084[_0x562c70(0x1c7)]},ensureRemoteSqlContent(_0x489084),{'dbName':_0x4e63ec,'mode':_0x48d109,'syncedAt':new Date()[_0x562c70(0x1b5)](),'description':_0x489084['description']}),_0x212903=resolveLocalSqlFilePath(_0x304e58,_0x489084['sqlCode'],buildSqlLockEntry(_0x489084,ensureRemoteSqlContent(_0x489084),'',{'dbName':_0x4e63ec}));if(await fileExists(_0x212903)){const _0x58e039=await readFile(_0x212903,'utf8');if(!isEquivalentPulledSqlFile(_0x58e039,_0x1ac98a,_0x48d109)){_0xf3c2c=!![];break;}}}if(_0xf3c2c){const _0x4bd775=await confirmForceOverwrite(_0x562c70(0x1e0));if(!_0x4bd775)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}}const _0x5b719a=cloneSqlLockData(_0x4683e7),_0x26de66=_0x5b719a[_0x562c70(0x1c9)][_0x304e58[_0x562c70(0x1c0)]],_0x4c9d19=[],_0x504a6e=[];for(const _0x565e4a of _0x1ed442){const _0x3479ad=_0x26de66[_0x562c70(0x1b4)][_0x565e4a[_0x562c70(0x1dd)]],_0x5502b0=ensureRemoteSqlContent(_0x565e4a),_0x3f44da=detectModeFromSql(_0x565e4a),_0x1ea73f=_0x565e4a['dbId']?await getDbName(_0x114dc5['appCode'],Number(_0x565e4a[_0x562c70(0x1c7)]))[_0x562c70(0x1e7)](()=>undefined):undefined,_0x1a6072=buildLocalSqlFileContent({'sqlCode':_0x565e4a['sqlCode'],'sqlName':_0x565e4a[_0x562c70(0x1de)],'dbId':_0x565e4a[_0x562c70(0x1c7)]},_0x5502b0,{'dbName':_0x1ea73f,'mode':_0x3f44da,'syncedAt':new Date()[_0x562c70(0x1b5)](),'description':_0x565e4a[_0x562c70(0x1dc)]}),_0x1dd297=buildSqlLockEntry(_0x565e4a,_0x5502b0,computeSqlContentHash(_0x1a6072),{'dbName':_0x1ea73f}),_0x170abd=_0x1dd297['path'],_0x7bc63b=join(_0x304e58['sqlRootDir'],_0x170abd);try{if(await fileExists(_0x7bc63b)){const _0x309608=await readFile(_0x7bc63b,_0x562c70(0x1d8));if(isEquivalentPulledSqlFile(_0x309608,_0x1a6072,_0x3f44da)){_0x504a6e[_0x562c70(0x1ac)]({'sqlCode':_0x565e4a[_0x562c70(0x1dd)],'reason':_0x562c70(0x1cb)}),_0x26de66[_0x562c70(0x1b4)][_0x565e4a['sqlCode']]={..._0x1dd297,'hash':computeSqlContentHash(_0x309608),'path':_0x170abd};continue;}if(!_0x3aa001){_0x504a6e['push']({'sqlCode':_0x565e4a['sqlCode'],'reason':_0x562c70(0x1b3)});continue;}}const _0x3d8876=_0x3479ad?.['path']?join(_0x304e58['sqlRootDir'],_0x3479ad[_0x562c70(0x1c3)]):undefined;_0x3d8876&&_0x3d8876!==_0x7bc63b&&await fileExists(_0x3d8876)&&await rm(_0x3d8876,{'force':!![]}),await ensureParentDirectory(_0x7bc63b),await writeFile(_0x7bc63b,_0x1a6072,_0x562c70(0x1d8)),_0x26de66[_0x562c70(0x1b4)][_0x565e4a[_0x562c70(0x1dd)]]={..._0x1dd297,'path':_0x170abd},_0x4c9d19[_0x562c70(0x1ac)]({'sqlCode':_0x565e4a[_0x562c70(0x1dd)],'filePath':_0x7bc63b});}catch(_0x314217){_0x41587a[_0x562c70(0x1ac)]({'sqlCode':_0x565e4a[_0x562c70(0x1dd)],'error':_0x314217 instanceof Error?_0x314217[_0x562c70(0x1bb)]:String(_0x314217)});}}return _0x26de66['lastSync']=new Date()[_0x562c70(0x1b5)](),await writeSqlLockFile(_0x304e58[_0x562c70(0x1e3)],_0x5b719a),{'ok':_0x41587a[_0x562c70(0x1ad)]===0x0,'data':{'pulled':_0x4c9d19,'skipped':_0x504a6e,'failed':_0x41587a},'message':_0x562c70(0x1c1)+_0x4c9d19[_0x562c70(0x1ad)]+_0x562c70(0x1df)+_0x504a6e[_0x562c70(0x1ad)]+_0x562c70(0x1b6)+_0x41587a[_0x562c70(0x1ad)]+_0x562c70(0x1af)};}};function detectModeFromSql(_0x1bfdd5){const _0x1f3504=a197_0x426c60,_0x351dc6=ensureRemoteSqlContent(_0x1bfdd5),_0x278fcb=stripLocalSqlMetadata(_0x351dc6,_0x1f3504(0x1bc))[_0x1f3504(0x1cc)]();if(/^<(select|insert|update|delete)\b/i[_0x1f3504(0x1c8)](_0x278fcb))return _0x1f3504(0x1bc);return _0x1f3504(0x1b1);}function isEquivalentPulledSqlFile(_0x338858,_0x23e883,_0x10ed32){return normalizePullComparableContent(_0x338858,_0x10ed32)===normalizePullComparableContent(_0x23e883,_0x10ed32);}function a197_0x8d1b(_0x171217,_0x338e94){_0x171217=_0x171217-0x1ac;const _0x5a8139=a197_0x5a81();let _0x8d1b22=_0x5a8139[_0x171217];return _0x8d1b22;}function a197_0x5a81(){const _0x293f6a=['trimStart','490125Ajpmur','bool','force','\x20SQL\x20file(s)\x20into\x20','3264149iYrjBq','Force\x20overwrite\x20local\x20unsynced\x20changes','Filter\x20by\x20SQL\x20display\x20name','Would\x20pull\x20','str','conflict','split','utf8','36jLEsJi','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','join','description','sqlCode','sqlName','\x20written,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','11ymAmLq','139581ooIzbt','lockFilePath','POST','replace','sqlRootDir','catch','43PTgMvA','pull','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','would_pull','name','boolean','push','length','808nfiSbv','\x20failed','18WJGTDB','sql','string','local\x20differs\x20from\x20remote','sqls','toISOString','\x20skipped,\x20','sqlRoot','filter','15049752vSbkzE','nonInteractive','message','mybatisXml','7578Nmwmpi','totalCount','sqlcode','appCode','Pull\x20complete:\x20','1450810rHupgE','path','tableData','19542DgDiVt','sqlContent','dbId','test','apps','skipped','unchanged'];a197_0x5a81=function(){return _0x293f6a;};return a197_0x5a81();}function normalizePullComparableContent(_0x49b6b0,_0x19b0d5){const _0x52e808=a197_0x426c60,_0x2aa26b=_0x49b6b0[_0x52e808(0x1e5)](/\r\n/g,'\x0a')[_0x52e808(0x1d7)]('\x0a'),_0x2c00e7=_0x2aa26b[_0x52e808(0x1b8)](_0x4123b3=>!isSyncedAtMetadataLine(_0x4123b3,_0x19b0d5));return _0x2c00e7[_0x52e808(0x1db)]('\x0a');}function isSyncedAtMetadataLine(_0x406a98,_0x39cb57){const _0x176c50=a197_0x426c60;if(_0x39cb57===_0x176c50(0x1bc))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x406a98);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x176c50(0x1c8)](_0x406a98);}
|
|
1
|
+
const a190_0x1517f1=a190_0x5ee8;(function(_0x2022df,_0x47ff94){const _0x483573=a190_0x5ee8,_0x4bd4d6=_0x2022df();while(!![]){try{const _0x206761=parseInt(_0x483573(0x143))/0x1*(-parseInt(_0x483573(0x178))/0x2)+parseInt(_0x483573(0x141))/0x3*(parseInt(_0x483573(0x155))/0x4)+parseInt(_0x483573(0x176))/0x5+-parseInt(_0x483573(0x16e))/0x6*(parseInt(_0x483573(0x14f))/0x7)+-parseInt(_0x483573(0x16d))/0x8*(-parseInt(_0x483573(0x153))/0x9)+parseInt(_0x483573(0x150))/0xa*(-parseInt(_0x483573(0x165))/0xb)+parseInt(_0x483573(0x145))/0xc*(parseInt(_0x483573(0x164))/0xd);if(_0x206761===_0x47ff94)break;else _0x4bd4d6['push'](_0x4bd4d6['shift']());}catch(_0x196cc3){_0x4bd4d6['push'](_0x4bd4d6['shift']());}}}(a190_0x11d9,0x96b4c));function a190_0x5ee8(_0x5a63a6,_0x152a2d){_0x5a63a6=_0x5a63a6-0x13a;const _0x11d9ba=a190_0x11d9();let _0x5ee8b9=_0x11d9ba[_0x5a63a6];return _0x5ee8b9;}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';function a190_0x11d9(){const _0x26be2a=['message','name','catch','sql','lastSync','Pull\x20complete:\x20','test','8ORxCqO','126gywxnT','cancelled','push','str','sqlRootDir','nonInteractive','read','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','4765790HxQpLN','toISOString','330CXeoDF','path','\x20SQL\x20file(s)\x20into\x20','utf8','tableData','filter','Force\x20overwrite\x20local\x20unsynced\x20changes','lockFilePath','force','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','No\x20remote\x20SQL\x20queries\x20matched.','Would\x20pull\x20','pull','1673553mIWFDl','appCode','2837GrDcCy','\x20failed','185112lcRZsW','skipped','sqlRoot','split','replace','conflict','Force\x20pull\x20cancelled.','would_pull','dbId','mybatisXml','372148iprpgC','10oShfuh','totalCount','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','9729873UhWqez','sqlCode','4MHatwR','sqls','\x20skipped,\x20','sqlcode','sqlContent','sqlName','boolean','\x20written,\x20','unchanged','apps','description','length','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','join','Filter\x20by\x20SQL\x20display\x20name','65CHXutY','5141345twfUtC'];a190_0x11d9=function(){return _0x26be2a;};return a190_0x11d9();}import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x1fba28,_0x41540e){const _0xa16099=a190_0x5ee8,_0x3b67ca=[];let _0x3efd0c=0x1;while(!![]){const _0x2fdea8=await listSqlQueries(_0x1fba28,{'currentPage':_0x3efd0c,'pageSize':PAGE_SIZE,'sqlCode':_0x41540e[_0xa16099(0x154)],'sqlName':_0x41540e[_0xa16099(0x15a)]}),_0x1021c7=_0x2fdea8[_0xa16099(0x17c)]??[];_0x3b67ca['push'](..._0x1021c7);if(_0x1021c7[_0xa16099(0x160)]===0x0)break;const _0x8c2c6a=_0x2fdea8['paging']?.[_0xa16099(0x151)];if(_0x8c2c6a!=null?_0x3b67ca[_0xa16099(0x160)]>=_0x8c2c6a:_0x1021c7[_0xa16099(0x160)]<PAGE_SIZE)break;_0x3efd0c++;}return _0x3b67ca;}async function ensureSqlContent(_0xc28cd2){const _0x2a6a10=a190_0x5ee8;if(_0xc28cd2[_0x2a6a10(0x159)]!=null&&String(_0xc28cd2[_0x2a6a10(0x159)])[_0x2a6a10(0x160)]>0x0)return _0xc28cd2;return getSqlQueryDetail(_0xc28cd2[_0x2a6a10(0x154)]);}export const sqlPull={'service':a190_0x1517f1(0x169),'command':'pull','description':a190_0x1517f1(0x152),'risk':a190_0x1517f1(0x174),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x1517f1(0x167),'type':'string','description':a190_0x1517f1(0x163)},{'name':a190_0x1517f1(0x13c),'type':a190_0x1517f1(0x15b),'description':a190_0x1517f1(0x13a)}],async 'dryRun'(_0x1fdd90){const _0x42b57b=a190_0x1517f1,_0x2013af=loadSqlProjectConfig(_0x1fdd90['appCode']),_0x4f4cd7=await readSqlLockFile(_0x2013af[_0x42b57b(0x13b)]),{appLock:_0x43c154}=ensureSqlLockScope(_0x4f4cd7??createEmptySqlLock(),_0x2013af[_0x42b57b(0x142)],_0x2013af['sqlRoot'],_0x42b57b(0x140)),_0x563a61=await fetchAllSqlQueries(_0x1fdd90[_0x42b57b(0x142)],{'sqlCode':_0x1fdd90[_0x42b57b(0x171)]('sqlcode')||undefined,'sqlName':_0x1fdd90[_0x42b57b(0x171)](_0x42b57b(0x167))||undefined}),_0x1f71a3=[];for(const _0x39cd3b of _0x563a61){const _0x4ab47f=await ensureSqlContent(_0x39cd3b),_0x29785e=ensureRemoteSqlContent(_0x4ab47f),_0x5aacb7=detectModeFromSql(_0x4ab47f),_0x1196c2=_0x4ab47f[_0x42b57b(0x14d)]?await getDbName(_0x1fdd90['appCode'],Number(_0x4ab47f[_0x42b57b(0x14d)]))[_0x42b57b(0x168)](()=>undefined):undefined,_0x4ca98c=buildLocalSqlFileContent({'sqlCode':_0x4ab47f[_0x42b57b(0x154)],'sqlName':_0x4ab47f[_0x42b57b(0x15a)],'dbId':_0x4ab47f[_0x42b57b(0x14d)]},_0x29785e,{'dbName':_0x1196c2,'mode':_0x5aacb7,'syncedAt':new Date()['toISOString'](),'description':_0x4ab47f[_0x42b57b(0x15f)]}),_0x4989a6=buildSqlLockEntry(_0x4ab47f,_0x29785e,'',{'dbName':_0x1196c2}),_0x46d334=resolveLocalSqlFilePath(_0x2013af,_0x4ab47f[_0x42b57b(0x154)],_0x4989a6);let _0x818465=_0x42b57b(0x14c),_0x3f7c69;if(await fileExists(_0x46d334)){const _0x391346=await readFile(_0x46d334,_0x42b57b(0x17b));isEquivalentPulledSqlFile(_0x391346,_0x4ca98c,_0x5aacb7)?(_0x818465=_0x42b57b(0x146),_0x3f7c69=_0x42b57b(0x15d)):(_0x818465=_0x42b57b(0x14a),_0x3f7c69=_0x42b57b(0x161));}_0x1f71a3[_0x42b57b(0x170)]({'sqlCode':_0x4ab47f[_0x42b57b(0x154)],'sqlName':_0x4ab47f[_0x42b57b(0x15a)],'filePath':_0x46d334,'status':_0x818465,'reason':_0x3f7c69});}return{'method':'POST','url':_0x42b57b(0x175),'body':{'appCode':_0x1fdd90[_0x42b57b(0x142)],'sqlCode':_0x1fdd90[_0x42b57b(0x171)](_0x42b57b(0x158))||null,'sqlName':_0x1fdd90['str'](_0x42b57b(0x167))||null,'files':_0x1f71a3},'description':_0x42b57b(0x13f)+_0x1f71a3[_0x42b57b(0x160)]+_0x42b57b(0x17a)+_0x2013af[_0x42b57b(0x172)]};},async 'execute'(_0x4842e7){const _0x759c48=a190_0x1517f1,_0x44a6ef=loadSqlProjectConfig(_0x4842e7['appCode']),_0xc16304=await readSqlLockFile(_0x44a6ef[_0x759c48(0x13b)]),{lockData:_0x34fc5a,appLock:_0x526c37}=ensureSqlLockScope(_0xc16304??createEmptySqlLock(),_0x44a6ef[_0x759c48(0x142)],_0x44a6ef[_0x759c48(0x147)],_0x759c48(0x140)),_0x10db40=_0x4842e7['bool'](_0x759c48(0x13c)),_0x5096d8=await fetchAllSqlQueries(_0x4842e7[_0x759c48(0x142)],{'sqlCode':_0x4842e7['str']('sqlcode')||undefined,'sqlName':_0x4842e7[_0x759c48(0x171)](_0x759c48(0x167))||undefined});if(_0x5096d8[_0x759c48(0x160)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x759c48(0x13e)};const _0x29401b=[],_0x5270e5=[];for(const _0x2e3e8d of _0x5096d8){try{_0x29401b[_0x759c48(0x170)](await ensureSqlContent(_0x2e3e8d));}catch(_0x595b6e){_0x5270e5[_0x759c48(0x170)]({'sqlCode':_0x2e3e8d['sqlCode'],'error':_0x595b6e instanceof Error?_0x595b6e['message']:String(_0x595b6e)});}}if(_0x10db40&&!_0x4842e7[_0x759c48(0x173)]){let _0x393dcf=![];for(const _0x5bcedd of _0x29401b){const _0x1b47f7=detectModeFromSql(_0x5bcedd),_0x5a7a83=_0x5bcedd[_0x759c48(0x14d)]?await getDbName(_0x4842e7[_0x759c48(0x142)],Number(_0x5bcedd[_0x759c48(0x14d)]))[_0x759c48(0x168)](()=>undefined):undefined,_0x83de27=buildLocalSqlFileContent({'sqlCode':_0x5bcedd[_0x759c48(0x154)],'sqlName':_0x5bcedd['sqlName'],'dbId':_0x5bcedd[_0x759c48(0x14d)]},ensureRemoteSqlContent(_0x5bcedd),{'dbName':_0x5a7a83,'mode':_0x1b47f7,'syncedAt':new Date()[_0x759c48(0x177)](),'description':_0x5bcedd['description']}),_0x54a7f3=resolveLocalSqlFilePath(_0x44a6ef,_0x5bcedd['sqlCode'],buildSqlLockEntry(_0x5bcedd,ensureRemoteSqlContent(_0x5bcedd),'',{'dbName':_0x5a7a83}));if(await fileExists(_0x54a7f3)){const _0x3976da=await readFile(_0x54a7f3,_0x759c48(0x17b));if(!isEquivalentPulledSqlFile(_0x3976da,_0x83de27,_0x1b47f7)){_0x393dcf=!![];break;}}}if(_0x393dcf){const _0x985304=await confirmForceOverwrite(_0x759c48(0x13d));if(!_0x985304)throw CliErrors[_0x759c48(0x16f)](_0x759c48(0x14b));}}const _0x2bf896=cloneSqlLockData(_0x34fc5a),_0x4a2410=_0x2bf896[_0x759c48(0x15e)][_0x44a6ef['appCode']],_0xfef51e=[],_0x5a0f6e=[];for(const _0x59b331 of _0x29401b){const _0xe2d161=_0x4a2410[_0x759c48(0x156)][_0x59b331[_0x759c48(0x154)]],_0x21a528=ensureRemoteSqlContent(_0x59b331),_0xa5021=detectModeFromSql(_0x59b331),_0x2cd143=_0x59b331[_0x759c48(0x14d)]?await getDbName(_0x4842e7['appCode'],Number(_0x59b331[_0x759c48(0x14d)]))[_0x759c48(0x168)](()=>undefined):undefined,_0x2bb2b8=buildLocalSqlFileContent({'sqlCode':_0x59b331['sqlCode'],'sqlName':_0x59b331[_0x759c48(0x15a)],'dbId':_0x59b331[_0x759c48(0x14d)]},_0x21a528,{'dbName':_0x2cd143,'mode':_0xa5021,'syncedAt':new Date()['toISOString'](),'description':_0x59b331[_0x759c48(0x15f)]}),_0x3316a2=buildSqlLockEntry(_0x59b331,_0x21a528,computeSqlContentHash(_0x2bb2b8),{'dbName':_0x2cd143}),_0x34ee07=_0x3316a2[_0x759c48(0x179)],_0x1d19f3=join(_0x44a6ef['sqlRootDir'],_0x34ee07);try{if(await fileExists(_0x1d19f3)){const _0x11e519=await readFile(_0x1d19f3,_0x759c48(0x17b));if(isEquivalentPulledSqlFile(_0x11e519,_0x2bb2b8,_0xa5021)){_0x5a0f6e[_0x759c48(0x170)]({'sqlCode':_0x59b331['sqlCode'],'reason':_0x759c48(0x15d)}),_0x4a2410[_0x759c48(0x156)][_0x59b331[_0x759c48(0x154)]]={..._0x3316a2,'hash':computeSqlContentHash(_0x11e519),'path':_0x34ee07};continue;}if(!_0x10db40){_0x5a0f6e[_0x759c48(0x170)]({'sqlCode':_0x59b331[_0x759c48(0x154)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x391655=_0xe2d161?.[_0x759c48(0x179)]?join(_0x44a6ef[_0x759c48(0x172)],_0xe2d161[_0x759c48(0x179)]):undefined;_0x391655&&_0x391655!==_0x1d19f3&&await fileExists(_0x391655)&&await rm(_0x391655,{'force':!![]}),await ensureParentDirectory(_0x1d19f3),await writeFile(_0x1d19f3,_0x2bb2b8,_0x759c48(0x17b)),_0x4a2410[_0x759c48(0x156)][_0x59b331['sqlCode']]={..._0x3316a2,'path':_0x34ee07},_0xfef51e[_0x759c48(0x170)]({'sqlCode':_0x59b331[_0x759c48(0x154)],'filePath':_0x1d19f3});}catch(_0x1dd8a){_0x5270e5[_0x759c48(0x170)]({'sqlCode':_0x59b331[_0x759c48(0x154)],'error':_0x1dd8a instanceof Error?_0x1dd8a[_0x759c48(0x166)]:String(_0x1dd8a)});}}return _0x4a2410[_0x759c48(0x16a)]=new Date()[_0x759c48(0x177)](),await writeSqlLockFile(_0x44a6ef[_0x759c48(0x13b)],_0x2bf896),{'ok':_0x5270e5['length']===0x0,'data':{'pulled':_0xfef51e,'skipped':_0x5a0f6e,'failed':_0x5270e5},'message':_0x759c48(0x16b)+_0xfef51e['length']+_0x759c48(0x15c)+_0x5a0f6e[_0x759c48(0x160)]+_0x759c48(0x157)+_0x5270e5[_0x759c48(0x160)]+_0x759c48(0x144)};}};function detectModeFromSql(_0x337524){const _0x46360d=a190_0x1517f1,_0x48eeba=ensureRemoteSqlContent(_0x337524),_0x3653d9=stripLocalSqlMetadata(_0x48eeba,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x46360d(0x16c)](_0x3653d9))return _0x46360d(0x14e);return _0x46360d(0x169);}function isEquivalentPulledSqlFile(_0x221d3c,_0x287fd2,_0x2c9968){return normalizePullComparableContent(_0x221d3c,_0x2c9968)===normalizePullComparableContent(_0x287fd2,_0x2c9968);}function normalizePullComparableContent(_0xcbb2b3,_0x42b43e){const _0xc1e75d=a190_0x1517f1,_0x747177=_0xcbb2b3[_0xc1e75d(0x149)](/\r\n/g,'\x0a')[_0xc1e75d(0x148)]('\x0a'),_0x3dc403=_0x747177[_0xc1e75d(0x17d)](_0x4a4c1f=>!isSyncedAtMetadataLine(_0x4a4c1f,_0x42b43e));return _0x3dc403[_0xc1e75d(0x162)]('\x0a');}function isSyncedAtMetadataLine(_0x5eb8b6,_0x5758c9){const _0x5c1e0e=a190_0x1517f1;if(_0x5758c9===_0x5c1e0e(0x14e))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5c1e0e(0x16c)](_0x5eb8b6);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x5eb8b6);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a198_0x8130a9=a198_0x3f84;(function(_0x279125,_0x534fe8){const _0x2d16b4=a198_0x3f84,_0xc42f47=_0x279125();while(!![]){try{const _0x576a36=parseInt(_0x2d16b4(0x138))/0x1+parseInt(_0x2d16b4(0x136))/0x2*(parseInt(_0x2d16b4(0x135))/0x3)+parseInt(_0x2d16b4(0x168))/0x4+-parseInt(_0x2d16b4(0x164))/0x5*(-parseInt(_0x2d16b4(0x137))/0x6)+parseInt(_0x2d16b4(0x142))/0x7+parseInt(_0x2d16b4(0x157))/0x8*(-parseInt(_0x2d16b4(0x172))/0x9)+parseInt(_0x2d16b4(0x167))/0xa*(-parseInt(_0x2d16b4(0x14c))/0xb);if(_0x576a36===_0x534fe8)break;else _0xc42f47['push'](_0xc42f47['shift']());}catch(_0x55787c){_0xc42f47['push'](_0xc42f47['shift']());}}}(a198_0x4df4,0x7228c));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';function a198_0x4df4(){const _0x240c2d=['trashDir','9375872kDThrj','Local\x20SQL\x20not\x20found:\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','length','Push\x20complete:\x20','sqlRoot','Local\x20directory\x20\x22','bool','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','get','\x20skipped,\x20','236744DufNoo','sqls','force','dbDirectory','No\x20local\x20SQL\x20files\x20found.','filter','push','sqlCode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlRootDir','replace','dbId','Push\x20local\x20SQL\x20files\x20to\x20remote','4260035NCGcnG','toISOString','mode','30wLyvnB','2435980Lqnpmr','appCode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sql','sqlName','lockFilePath','write','catch','\x20failed','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','27eYsrSn','map','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','set','exec','message','entries','relativePath','filePath','1611717NRPVyM','2byEsLA','6hyMqDk','684441yDaScK','\x20pushed,\x20','hash','sqlcode','remoteId','validation','/smartapi/custom/updateUserCustomSql','join','\x20SQL\x20file(s)','path','3015243axJLCM','boolean','utf8','POST','Would\x20push\x20','dbName','No\x20database\x20matches\x20local\x20directory\x20\x22','startsWith','lastSync'];a198_0x4df4=function(){return _0x240c2d;};return a198_0x4df4();}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a198_0x3f84(_0x1c3eb0,_0x3b285a){_0x1c3eb0=_0x1c3eb0-0x135;const _0x4df429=a198_0x4df4();let _0x3f8453=_0x4df429[_0x1c3eb0];return _0x3f8453;}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x234fe2,_0x5ae8cb,_0x41e129){const _0x1377fe=a198_0x3f84,_0x21a57a=await scanLocalSqlQueries(_0x234fe2),_0x56a61e=new Map();for(const _0x135516 of _0x21a57a){if(_0x41e129&&_0x135516[_0x1377fe(0x15e)]!==_0x41e129)continue;const _0xab4030=_0x56a61e[_0x1377fe(0x155)](_0x135516['sqlCode'])??[];_0xab4030['push'](_0x135516),_0x56a61e[_0x1377fe(0x175)](_0x135516[_0x1377fe(0x15e)],_0xab4030);}if(_0x41e129&&!_0x56a61e['has'](_0x41e129))throw CliErrors[_0x1377fe(0x13d)](_0x1377fe(0x14d)+_0x41e129);const _0x3eb7ef=[];for(const [_0x1b552f,_0xf0a761]of _0x56a61e[_0x1377fe(0x178)]()){if(_0xf0a761[_0x1377fe(0x14f)]===0x1){_0x3eb7ef[_0x1377fe(0x15d)](_0xf0a761[0x0]);continue;}const _0x383bf1=_0x5ae8cb[_0x1377fe(0x158)][_0x1b552f],_0x2483a8=_0x383bf1?.[_0x1377fe(0x141)],_0x8f0848=_0x2483a8?_0xf0a761['filter'](_0x2133d8=>_0x2133d8[_0x1377fe(0x179)]!==_0x2483a8):_0xf0a761;if(_0x383bf1&&_0x8f0848['length']===0x1){_0x3eb7ef[_0x1377fe(0x15d)](_0x8f0848[0x0]);continue;}throw CliErrors[_0x1377fe(0x13d)](_0x1377fe(0x14e)+_0x1b552f+_0x1377fe(0x15f));}return _0x3eb7ef;}export const sqlPush={'service':a198_0x8130a9(0x16b),'command':'push','description':a198_0x8130a9(0x163),'risk':a198_0x8130a9(0x16e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a198_0x8130a9(0x159),'type':a198_0x8130a9(0x143),'description':a198_0x8130a9(0x174)}],async 'dryRun'(_0x3491f1){const _0x404db9=a198_0x8130a9,_0x23b065=loadSqlProjectConfig(_0x3491f1[_0x404db9(0x169)]),_0x296622=await readSqlLockFile(_0x23b065[_0x404db9(0x16d)]),{appLock:_0x81ca33}=ensureSqlLockScope(_0x296622??createEmptySqlLock(),_0x3491f1[_0x404db9(0x169)],_0x23b065['sqlRoot'],'push'),_0x4bd504=await getTargetSqlQueries(_0x23b065,_0x81ca33,_0x3491f1['str'](_0x404db9(0x13b))||undefined),_0xc1259=[];for(const _0x2c22a7 of _0x4bd504){const _0x268156=await computeSqlFileHash(_0x2c22a7[_0x404db9(0x17a)]),_0x2c65b9=_0x81ca33['sqls'][_0x2c22a7[_0x404db9(0x15e)]],_0x3f9272=!!_0x2c65b9&&(_0x2c65b9[_0x404db9(0x141)]!==_0x2c22a7[_0x404db9(0x179)]||!!_0x2c22a7[_0x404db9(0x16c)]&&_0x2c65b9[_0x404db9(0x16c)]!==_0x2c22a7[_0x404db9(0x16c)]);if(!_0x3491f1[_0x404db9(0x153)](_0x404db9(0x159))&&_0x2c65b9&&_0x2c65b9['hash']===_0x268156&&!_0x3f9272)continue;_0xc1259[_0x404db9(0x15d)](_0x2c22a7[_0x404db9(0x15e)]);}return{'method':_0x404db9(0x145),'url':_0x404db9(0x13e),'body':{'sqlCodes':_0xc1259,'appCode':_0x3491f1[_0x404db9(0x169)]},'description':_0x404db9(0x146)+_0xc1259['length']+_0x404db9(0x140)};},async 'execute'(_0xa07ee5){const _0x1d9240=a198_0x8130a9,_0x52837a=loadSqlProjectConfig(_0xa07ee5['appCode']),_0x364539=await readSqlLockFile(_0x52837a[_0x1d9240(0x16d)]),{lockData:_0x4b978b,appLock:_0x29fe57}=ensureSqlLockScope(_0x364539??createEmptySqlLock(),_0xa07ee5[_0x1d9240(0x169)],_0x52837a[_0x1d9240(0x151)],_0x1d9240(0x15d)),_0x174d95=await getTargetSqlQueries(_0x52837a,_0x29fe57,_0xa07ee5['str']('sqlcode')||undefined);if(_0x174d95[_0x1d9240(0x14f)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x1d9240(0x15b)};const _0x1bdfb4=[],_0x3316fa=[],_0x510da0=[];for(const _0x28b734 of _0x174d95){const _0x5d87e3=_0x29fe57[_0x1d9240(0x158)][_0x28b734['sqlCode']];if(!_0x5d87e3){_0x510da0[_0x1d9240(0x15d)]({'sqlCode':_0x28b734[_0x1d9240(0x15e)],'error':_0x1d9240(0x154)});continue;}try{const _0x12c83e=await computeSqlFileHash(_0x28b734[_0x1d9240(0x17a)]),_0x1490f9=_0x5d87e3['path']!==_0x28b734[_0x1d9240(0x179)]||!!_0x28b734[_0x1d9240(0x16c)]&&_0x5d87e3['sqlName']!==_0x28b734['sqlName'];if(!_0xa07ee5[_0x1d9240(0x153)](_0x1d9240(0x159))&&_0x5d87e3[_0x1d9240(0x13a)]===_0x12c83e&&!_0x1490f9){_0x3316fa[_0x1d9240(0x15d)]({'sqlCode':_0x28b734[_0x1d9240(0x15e)],'reason':'unchanged'});continue;}if(_0x5d87e3['version']==null){_0x510da0[_0x1d9240(0x15d)]({'sqlCode':_0x28b734[_0x1d9240(0x15e)],'error':_0x1d9240(0x16a)});continue;}const _0x265b42=await readFile(_0x28b734[_0x1d9240(0x17a)],_0x1d9240(0x144)),_0x52f0cd=stripLocalSqlMetadata(_0x265b42,_0x28b734[_0x1d9240(0x166)]),_0x240165=_0x28b734[_0x1d9240(0x16c)]||_0x5d87e3[_0x1d9240(0x16c)],_0x36ee64=await resolveTargetDbBinding(_0xa07ee5[_0x1d9240(0x169)],_0x28b734,_0x5d87e3),_0xe157e5=await updateSqlQuery({'id':_0x5d87e3[_0x1d9240(0x13c)],'appCode':_0xa07ee5[_0x1d9240(0x169)],'sqlCode':_0x28b734[_0x1d9240(0x15e)],'sqlName':_0x240165,'dbId':_0x36ee64[_0x1d9240(0x162)],'version':_0x5d87e3['version'],'sqlContent':_0x52f0cd,'sqlConfig':_0x5d87e3['sqlConfig']??undefined}),_0x38b54b=_0xe157e5[_0x1d9240(0x162)]?await getDbName(_0xa07ee5[_0x1d9240(0x169)],Number(_0xe157e5[_0x1d9240(0x162)]))[_0x1d9240(0x16f)](()=>_0x36ee64[_0x1d9240(0x147)]):_0x36ee64[_0x1d9240(0x147)];_0x29fe57[_0x1d9240(0x158)][_0x28b734['sqlCode']]={...buildSqlLockEntry(_0xe157e5,_0x52f0cd,_0x12c83e,{'dbName':_0x38b54b}),'path':_0x28b734[_0x1d9240(0x179)],'mode':_0x5d87e3[_0x1d9240(0x166)]},await archivePreviousSqlFileIfNeeded(_0x52837a,_0x5d87e3[_0x1d9240(0x141)],_0x28b734[_0x1d9240(0x179)]),_0x1bdfb4['push']({'sqlCode':_0x28b734[_0x1d9240(0x15e)],'remoteId':_0x5d87e3[_0x1d9240(0x13c)]});}catch(_0x24b2e6){_0x510da0[_0x1d9240(0x15d)]({'sqlCode':_0x28b734[_0x1d9240(0x15e)],'error':_0x24b2e6 instanceof Error?_0x24b2e6[_0x1d9240(0x177)]:String(_0x24b2e6)});}}return _0x29fe57[_0x1d9240(0x14a)]=new Date()['toISOString'](),await writeSqlLockFile(_0x52837a[_0x1d9240(0x16d)],_0x4b978b),{'ok':_0x510da0[_0x1d9240(0x14f)]===0x0,'data':{'pushed':_0x1bdfb4,'skipped':_0x3316fa,'failed':_0x510da0},'message':_0x1d9240(0x150)+_0x1bdfb4[_0x1d9240(0x14f)]+_0x1d9240(0x139)+_0x3316fa[_0x1d9240(0x14f)]+_0x1d9240(0x156)+_0x510da0[_0x1d9240(0x14f)]+_0x1d9240(0x170)};}};async function archivePreviousSqlFileIfNeeded(_0x48c3ab,_0x1a6df2,_0x4de8f0){const _0x3cd742=a198_0x8130a9;if(!_0x1a6df2||_0x1a6df2===_0x4de8f0)return;const _0x238a03=join(_0x48c3ab['sqlRootDir'],_0x1a6df2);if(!await fileExists(_0x238a03))return;const _0x2606e3=await moveToTrash(_0x48c3ab['projectRoot'],_0x48c3ab[_0x3cd742(0x14b)],_0x238a03);await cleanupEmptyDirectories(dirname(_0x238a03),_0x48c3ab[_0x3cd742(0x160)]),void _0x2606e3;}async function moveToTrash(_0x4f19cb,_0x7c6537,_0x1b09a3){const _0x1dce91=a198_0x8130a9,_0xfa336b=new Date()[_0x1dce91(0x165)]()[_0x1dce91(0x161)](/[:.]/g,'-'),_0xef8a6f=relative(_0x4f19cb,_0x1b09a3),_0x3b3716=join(_0x7c6537,_0xfa336b,_0xef8a6f);return await mkdir(dirname(_0x3b3716),{'recursive':!![]}),await rename(_0x1b09a3,_0x3b3716),_0x3b3716;}async function cleanupEmptyDirectories(_0x81ce22,_0x4be9cc){const _0x446418=a198_0x8130a9;let _0x411427=resolve(_0x81ce22);const _0x5da06c=resolve(_0x4be9cc);while(_0x411427[_0x446418(0x149)](''+_0x5da06c+sep)||_0x411427===_0x5da06c){if(_0x411427===_0x5da06c)return;try{const _0x12ed32=await readdir(_0x411427);if(_0x12ed32['length']>0x0)return;await rmdir(_0x411427);}catch{return;}_0x411427=dirname(_0x411427);}}async function resolveTargetDbBinding(_0x365d35,_0x29c742,_0x23c93){const _0x35e841=a198_0x8130a9,_0x552e79=_0x29c742[_0x35e841(0x15a)];if(!_0x552e79)return{'dbId':_0x23c93[_0x35e841(0x162)],'dbName':_0x23c93[_0x35e841(0x147)]};const _0x32a2ae=buildDbDirectoryName(_0x23c93[_0x35e841(0x147)],_0x23c93['dbId']);if(_0x552e79===_0x32a2ae)return{'dbId':_0x23c93[_0x35e841(0x162)],'dbName':_0x23c93[_0x35e841(0x147)]};const _0xc5b942=parseExplicitDbDirectory(_0x552e79);if(_0xc5b942!=null)return{'dbId':_0xc5b942,'dbName':await getDbName(_0x365d35,_0xc5b942)[_0x35e841(0x16f)](()=>undefined)};const _0x502a15=await listDatabases(_0x365d35),_0x41e836=_0x502a15[_0x35e841(0x15c)](_0xbdcddb=>buildDbDirectoryName(_0xbdcddb['dbName'],_0xbdcddb['dbId'])===_0x552e79);if(_0x41e836[_0x35e841(0x14f)]===0x1)return{'dbId':_0x41e836[0x0][_0x35e841(0x162)],'dbName':_0x41e836[0x0][_0x35e841(0x147)]};if(_0x41e836[_0x35e841(0x14f)]===0x0)throw CliErrors[_0x35e841(0x13d)](_0x35e841(0x148)+_0x552e79+'\x22\x20for\x20sqlCode\x20'+_0x29c742[_0x35e841(0x15e)]+'.');const _0x3cc6c7=_0x41e836[_0x35e841(0x173)](_0x5c6a06=>_0x5c6a06[_0x35e841(0x147)]+'\x20('+_0x5c6a06[_0x35e841(0x162)]+')')[_0x35e841(0x13f)](',\x20');throw CliErrors[_0x35e841(0x13d)](_0x35e841(0x152)+_0x552e79+_0x35e841(0x171)+_0x29c742[_0x35e841(0x15e)]+':\x20'+_0x3cc6c7);}function parseExplicitDbDirectory(_0x4c4bdf){const _0x2cdfb6=a198_0x8130a9,_0x36f317=/^db-(\d+)$/[_0x2cdfb6(0x176)](_0x4c4bdf);if(!_0x36f317)return null;const _0x1e56ff=Number(_0x36f317[0x1]);return Number['isFinite'](_0x1e56ff)&&_0x1e56ff>0x0?_0x1e56ff:null;}
|
|
1
|
+
const a191_0x110479=a191_0x30d8;(function(_0x2bc606,_0x1f1f2d){const _0x4d5235=a191_0x30d8,_0x39ca42=_0x2bc606();while(!![]){try{const _0x2ea889=parseInt(_0x4d5235(0x10b))/0x1*(-parseInt(_0x4d5235(0x113))/0x2)+parseInt(_0x4d5235(0x127))/0x3*(parseInt(_0x4d5235(0x11b))/0x4)+parseInt(_0x4d5235(0x100))/0x5*(-parseInt(_0x4d5235(0xf6))/0x6)+parseInt(_0x4d5235(0x11f))/0x7*(-parseInt(_0x4d5235(0x101))/0x8)+parseInt(_0x4d5235(0x131))/0x9*(parseInt(_0x4d5235(0x134))/0xa)+-parseInt(_0x4d5235(0x104))/0xb+-parseInt(_0x4d5235(0x10a))/0xc*(-parseInt(_0x4d5235(0x11a))/0xd);if(_0x2ea889===_0x1f1f2d)break;else _0x39ca42['push'](_0x39ca42['shift']());}catch(_0x16658b){_0x39ca42['push'](_0x39ca42['shift']());}}}(a191_0x1c0a,0x88a9a));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_0x30d8(_0x16cbf5,_0x549243){_0x16cbf5=_0x16cbf5-0xf3;const _0x1c0a2f=a191_0x1c0a();let _0x30d869=_0x1c0a2f[_0x16cbf5];return _0x30d869;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';function a191_0x1c0a(){const _0x3d30c6=['No\x20database\x20matches\x20local\x20directory\x20\x22','push','str','appCode','set','dbId','sqlRootDir','/smartapi/custom/updateUserCustomSql','sql','9778599KyUCkq','sqlCode','\x20skipped,\x20','10XvFoIR','dbDirectory','\x22\x20for\x20sqlCode\x20','sqlName','force','validation','No\x20local\x20SQL\x20files\x20found.','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','6QwRFoK','lockFilePath','utf8','bool','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','has','trashDir','startsWith','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','\x20pushed,\x20','4328925gjAMwL','2927648fyaKnR','\x20failed','path','9369294KikBDQ','remoteId','relativePath','version','hash','message','12OCpgDD','2FOJwNo','get','exec','dbName','sqls','mode','POST','catch','379906Jpmcbu','projectRoot','sqlcode','Local\x20directory\x20\x22','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlRoot','isFinite','14590550pdNobx','1628620mWbRnO','join','write','lastSync','7fOTdhY','filter','map','entries','length','unchanged','Local\x20SQL\x20not\x20found:\x20','Would\x20push\x20','6DyOboG'];a191_0x1c0a=function(){return _0x3d30c6;};return a191_0x1c0a();}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(_0x2fc2de,_0x429ea9,_0x2e2a95){const _0x1d276d=a191_0x30d8,_0x38c2db=await scanLocalSqlQueries(_0x2fc2de),_0x558ef=new Map();for(const _0x3a7f91 of _0x38c2db){if(_0x2e2a95&&_0x3a7f91['sqlCode']!==_0x2e2a95)continue;const _0x4ec7b7=_0x558ef[_0x1d276d(0x10c)](_0x3a7f91['sqlCode'])??[];_0x4ec7b7[_0x1d276d(0x129)](_0x3a7f91),_0x558ef[_0x1d276d(0x12c)](_0x3a7f91[_0x1d276d(0x132)],_0x4ec7b7);}if(_0x2e2a95&&!_0x558ef[_0x1d276d(0xfb)](_0x2e2a95))throw CliErrors[_0x1d276d(0xf3)](_0x1d276d(0x125)+_0x2e2a95);const _0xd5eb75=[];for(const [_0x5dff59,_0x1ecf9d]of _0x558ef[_0x1d276d(0x122)]()){if(_0x1ecf9d[_0x1d276d(0x123)]===0x1){_0xd5eb75[_0x1d276d(0x129)](_0x1ecf9d[0x0]);continue;}const _0x31f70f=_0x429ea9[_0x1d276d(0x10f)][_0x5dff59],_0x5a88a2=_0x31f70f?.[_0x1d276d(0x103)],_0x40d509=_0x5a88a2?_0x1ecf9d[_0x1d276d(0x120)](_0x197ec5=>_0x197ec5[_0x1d276d(0x106)]!==_0x5a88a2):_0x1ecf9d;if(_0x31f70f&&_0x40d509[_0x1d276d(0x123)]===0x1){_0xd5eb75[_0x1d276d(0x129)](_0x40d509[0x0]);continue;}throw CliErrors[_0x1d276d(0xf3)](_0x1d276d(0xf5)+_0x5dff59+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0xd5eb75;}export const sqlPush={'service':a191_0x110479(0x130),'command':a191_0x110479(0x129),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a191_0x110479(0x11d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a191_0x110479(0xfe)}],async 'dryRun'(_0x1f5fbb){const _0x5a2bff=a191_0x110479,_0x598c20=loadSqlProjectConfig(_0x1f5fbb[_0x5a2bff(0x12b)]),_0x5e4330=await readSqlLockFile(_0x598c20[_0x5a2bff(0xf7)]),{appLock:_0x1686b7}=ensureSqlLockScope(_0x5e4330??createEmptySqlLock(),_0x1f5fbb[_0x5a2bff(0x12b)],_0x598c20[_0x5a2bff(0x118)],_0x5a2bff(0x129)),_0x5635b9=await getTargetSqlQueries(_0x598c20,_0x1686b7,_0x1f5fbb[_0x5a2bff(0x12a)](_0x5a2bff(0x115))||undefined),_0x4b938c=[];for(const _0x297707 of _0x5635b9){const _0x5584a9=await computeSqlFileHash(_0x297707['filePath']),_0x430667=_0x1686b7[_0x5a2bff(0x10f)][_0x297707[_0x5a2bff(0x132)]],_0x14c4c1=!!_0x430667&&(_0x430667[_0x5a2bff(0x103)]!==_0x297707[_0x5a2bff(0x106)]||!!_0x297707[_0x5a2bff(0x137)]&&_0x430667['sqlName']!==_0x297707[_0x5a2bff(0x137)]);if(!_0x1f5fbb[_0x5a2bff(0xf9)](_0x5a2bff(0x138))&&_0x430667&&_0x430667[_0x5a2bff(0x108)]===_0x5584a9&&!_0x14c4c1)continue;_0x4b938c[_0x5a2bff(0x129)](_0x297707['sqlCode']);}return{'method':_0x5a2bff(0x111),'url':_0x5a2bff(0x12f),'body':{'sqlCodes':_0x4b938c,'appCode':_0x1f5fbb[_0x5a2bff(0x12b)]},'description':_0x5a2bff(0x126)+_0x4b938c[_0x5a2bff(0x123)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x1dc9e9){const _0x5d84bd=a191_0x110479,_0x7aa3e7=loadSqlProjectConfig(_0x1dc9e9[_0x5d84bd(0x12b)]),_0x2750c5=await readSqlLockFile(_0x7aa3e7[_0x5d84bd(0xf7)]),{lockData:_0x3dd614,appLock:_0x460697}=ensureSqlLockScope(_0x2750c5??createEmptySqlLock(),_0x1dc9e9[_0x5d84bd(0x12b)],_0x7aa3e7[_0x5d84bd(0x118)],_0x5d84bd(0x129)),_0x391e66=await getTargetSqlQueries(_0x7aa3e7,_0x460697,_0x1dc9e9[_0x5d84bd(0x12a)]('sqlcode')||undefined);if(_0x391e66[_0x5d84bd(0x123)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5d84bd(0xf4)};const _0x5a64b0=[],_0x288a32=[],_0x4e6477=[];for(const _0x57a846 of _0x391e66){const _0xec37b2=_0x460697[_0x5d84bd(0x10f)][_0x57a846['sqlCode']];if(!_0xec37b2){_0x4e6477[_0x5d84bd(0x129)]({'sqlCode':_0x57a846[_0x5d84bd(0x132)],'error':_0x5d84bd(0xfa)});continue;}try{const _0x3bacb9=await computeSqlFileHash(_0x57a846['filePath']),_0x163712=_0xec37b2[_0x5d84bd(0x103)]!==_0x57a846['relativePath']||!!_0x57a846['sqlName']&&_0xec37b2['sqlName']!==_0x57a846[_0x5d84bd(0x137)];if(!_0x1dc9e9['bool'](_0x5d84bd(0x138))&&_0xec37b2[_0x5d84bd(0x108)]===_0x3bacb9&&!_0x163712){_0x288a32[_0x5d84bd(0x129)]({'sqlCode':_0x57a846[_0x5d84bd(0x132)],'reason':_0x5d84bd(0x124)});continue;}if(_0xec37b2['version']==null){_0x4e6477[_0x5d84bd(0x129)]({'sqlCode':_0x57a846[_0x5d84bd(0x132)],'error':_0x5d84bd(0x117)});continue;}const _0x599607=await readFile(_0x57a846['filePath'],_0x5d84bd(0xf8)),_0x5c2486=stripLocalSqlMetadata(_0x599607,_0x57a846[_0x5d84bd(0x110)]),_0x271860=_0x57a846['sqlName']||_0xec37b2[_0x5d84bd(0x137)],_0x113504=await resolveTargetDbBinding(_0x1dc9e9[_0x5d84bd(0x12b)],_0x57a846,_0xec37b2),_0x4cc2a0=await updateSqlQuery({'id':_0xec37b2[_0x5d84bd(0x105)],'appCode':_0x1dc9e9['appCode'],'sqlCode':_0x57a846[_0x5d84bd(0x132)],'sqlName':_0x271860,'dbId':_0x113504[_0x5d84bd(0x12d)],'version':_0xec37b2[_0x5d84bd(0x107)],'sqlContent':_0x5c2486,'sqlConfig':_0xec37b2['sqlConfig']??undefined}),_0x271fd0=_0x4cc2a0[_0x5d84bd(0x12d)]?await getDbName(_0x1dc9e9['appCode'],Number(_0x4cc2a0['dbId']))[_0x5d84bd(0x112)](()=>_0x113504['dbName']):_0x113504['dbName'];_0x460697['sqls'][_0x57a846[_0x5d84bd(0x132)]]={...buildSqlLockEntry(_0x4cc2a0,_0x5c2486,_0x3bacb9,{'dbName':_0x271fd0}),'path':_0x57a846[_0x5d84bd(0x106)],'mode':_0xec37b2[_0x5d84bd(0x110)]},await archivePreviousSqlFileIfNeeded(_0x7aa3e7,_0xec37b2[_0x5d84bd(0x103)],_0x57a846['relativePath']),_0x5a64b0[_0x5d84bd(0x129)]({'sqlCode':_0x57a846[_0x5d84bd(0x132)],'remoteId':_0xec37b2[_0x5d84bd(0x105)]});}catch(_0x30af63){_0x4e6477[_0x5d84bd(0x129)]({'sqlCode':_0x57a846['sqlCode'],'error':_0x30af63 instanceof Error?_0x30af63[_0x5d84bd(0x109)]:String(_0x30af63)});}}return _0x460697[_0x5d84bd(0x11e)]=new Date()['toISOString'](),await writeSqlLockFile(_0x7aa3e7[_0x5d84bd(0xf7)],_0x3dd614),{'ok':_0x4e6477[_0x5d84bd(0x123)]===0x0,'data':{'pushed':_0x5a64b0,'skipped':_0x288a32,'failed':_0x4e6477},'message':'Push\x20complete:\x20'+_0x5a64b0[_0x5d84bd(0x123)]+_0x5d84bd(0xff)+_0x288a32[_0x5d84bd(0x123)]+_0x5d84bd(0x133)+_0x4e6477['length']+_0x5d84bd(0x102)};}};async function archivePreviousSqlFileIfNeeded(_0x241cfc,_0x1bf5e5,_0x2a9d2d){const _0xdca36a=a191_0x110479;if(!_0x1bf5e5||_0x1bf5e5===_0x2a9d2d)return;const _0x5e6e62=join(_0x241cfc[_0xdca36a(0x12e)],_0x1bf5e5);if(!await fileExists(_0x5e6e62))return;const _0x378764=await moveToTrash(_0x241cfc[_0xdca36a(0x114)],_0x241cfc[_0xdca36a(0xfc)],_0x5e6e62);await cleanupEmptyDirectories(dirname(_0x5e6e62),_0x241cfc['sqlRootDir']),void _0x378764;}async function moveToTrash(_0x586086,_0x48e81c,_0x4b2953){const _0x92143a=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x1c4c0c=relative(_0x586086,_0x4b2953),_0x36f50c=join(_0x48e81c,_0x92143a,_0x1c4c0c);return await mkdir(dirname(_0x36f50c),{'recursive':!![]}),await rename(_0x4b2953,_0x36f50c),_0x36f50c;}async function cleanupEmptyDirectories(_0x2d4072,_0x285bfc){const _0x3e3a25=a191_0x110479;let _0x3f8a10=resolve(_0x2d4072);const _0x1e5c32=resolve(_0x285bfc);while(_0x3f8a10[_0x3e3a25(0xfd)](''+_0x1e5c32+sep)||_0x3f8a10===_0x1e5c32){if(_0x3f8a10===_0x1e5c32)return;try{const _0x455250=await readdir(_0x3f8a10);if(_0x455250[_0x3e3a25(0x123)]>0x0)return;await rmdir(_0x3f8a10);}catch{return;}_0x3f8a10=dirname(_0x3f8a10);}}async function resolveTargetDbBinding(_0x12771b,_0x1c4b7d,_0x260cf8){const _0x1267cb=a191_0x110479,_0xd4477c=_0x1c4b7d[_0x1267cb(0x135)];if(!_0xd4477c)return{'dbId':_0x260cf8['dbId'],'dbName':_0x260cf8[_0x1267cb(0x10e)]};const _0x3e195d=buildDbDirectoryName(_0x260cf8[_0x1267cb(0x10e)],_0x260cf8[_0x1267cb(0x12d)]);if(_0xd4477c===_0x3e195d)return{'dbId':_0x260cf8['dbId'],'dbName':_0x260cf8['dbName']};const _0x3815f7=parseExplicitDbDirectory(_0xd4477c);if(_0x3815f7!=null)return{'dbId':_0x3815f7,'dbName':await getDbName(_0x12771b,_0x3815f7)[_0x1267cb(0x112)](()=>undefined)};const _0x47bfb7=await listDatabases(_0x12771b),_0x36ffde=_0x47bfb7['filter'](_0x492c50=>buildDbDirectoryName(_0x492c50[_0x1267cb(0x10e)],_0x492c50['dbId'])===_0xd4477c);if(_0x36ffde[_0x1267cb(0x123)]===0x1)return{'dbId':_0x36ffde[0x0]['dbId'],'dbName':_0x36ffde[0x0][_0x1267cb(0x10e)]};if(_0x36ffde['length']===0x0)throw CliErrors[_0x1267cb(0xf3)](_0x1267cb(0x128)+_0xd4477c+_0x1267cb(0x136)+_0x1c4b7d['sqlCode']+'.');const _0x47dc51=_0x36ffde[_0x1267cb(0x121)](_0x5cc6e0=>_0x5cc6e0['dbName']+'\x20('+_0x5cc6e0['dbId']+')')[_0x1267cb(0x11c)](',\x20');throw CliErrors[_0x1267cb(0xf3)](_0x1267cb(0x116)+_0xd4477c+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x1c4b7d[_0x1267cb(0x132)]+':\x20'+_0x47dc51);}function parseExplicitDbDirectory(_0x38af16){const _0x5ba65c=a191_0x110479,_0x135d36=/^db-(\d+)$/[_0x5ba65c(0x10d)](_0x38af16);if(!_0x135d36)return null;const _0x1a254b=Number(_0x135d36[0x1]);return Number[_0x5ba65c(0x119)](_0x1a254b)&&_0x1a254b>0x0?_0x1a254b:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a192_0x36ea5a=a192_0x54f0;(function(_0x46d68a,_0x1f6f18){const _0x48339f=a192_0x54f0,_0x345418=_0x46d68a();while(!![]){try{const _0x2a06bc=-parseInt(_0x48339f(0x1a0))/0x1+parseInt(_0x48339f(0x196))/0x2+-parseInt(_0x48339f(0x193))/0x3+parseInt(_0x48339f(0x190))/0x4*(-parseInt(_0x48339f(0x1a6))/0x5)+parseInt(_0x48339f(0x197))/0x6*(-parseInt(_0x48339f(0x189))/0x7)+-parseInt(_0x48339f(0x185))/0x8*(parseInt(_0x48339f(0x19a))/0x9)+parseInt(_0x48339f(0x1ad))/0xa*(parseInt(_0x48339f(0x1aa))/0xb);if(_0x2a06bc===_0x1f6f18)break;else _0x345418['push'](_0x345418['shift']());}catch(_0x19b5b4){_0x345418['push'](_0x345418['shift']());}}}(a192_0x4812,0x9308b));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=a192_0x36ea5a(0x199);export function buildSqlLockEntry(_0x3a7100,_0x52cb31,_0x1d3e6e,_0x45db57){const _0x54ce82=a192_0x36ea5a,_0x2404ea=detectSqlMode(_0x52cb31);return{'path':buildSqlRelativePath(_0x3a7100[_0x54ce82(0x1a4)],_0x3a7100['sqlName'],_0x45db57?.[_0x54ce82(0x18e)],_0x2404ea,_0x3a7100[_0x54ce82(0x186)]),'hash':_0x1d3e6e,'remoteId':_0x3a7100['id'],'version':_0x3a7100['version'],'dbId':Number(_0x3a7100['dbId']),'dbName':_0x45db57?.[_0x54ce82(0x18e)],'sqlName':_0x3a7100[_0x54ce82(0x19c)],'sqlConfig':_0x3a7100[_0x54ce82(0x1a1)]??undefined,'mode':_0x2404ea};}export function cloneSqlLockData(_0xfd04c4){const _0x1b047d=a192_0x36ea5a;return{'apps':Object[_0x1b047d(0x19b)](Object[_0x1b047d(0x18a)](_0xfd04c4[_0x1b047d(0x1a5)])[_0x1b047d(0x18b)](([_0x132257,_0x2ed951])=>[_0x132257,{'sqlRoot':_0x2ed951[_0x1b047d(0x1a9)],'lastSync':_0x2ed951[_0x1b047d(0x194)],'sqls':{..._0x2ed951['sqls']}}]))};}export function ensureRemoteSqlContent(_0x162d22){const _0x506814=a192_0x36ea5a;return _0x162d22[_0x506814(0x195)]??'';}export function buildLocalSqlFileContent(_0x469a39,_0x5d9d61,_0x6b50b6){const _0x435074=a192_0x36ea5a,_0x51125a=_0x6b50b6?.[_0x435074(0x1a2)]??detectSqlMode(_0x5d9d61),_0x2b65c0=stripLocalSqlMetadata(_0x5d9d61,_0x51125a)[_0x435074(0x18d)](),_0x8176e8=[...buildMetadataHeaderLines({'sqlCode':_0x469a39[_0x435074(0x1a4)],'sqlName':_0x469a39[_0x435074(0x19c)],'dbId':_0x469a39[_0x435074(0x186)],'dbName':_0x6b50b6?.['dbName'],'mode':_0x51125a,'syncedAt':_0x6b50b6?.[_0x435074(0x191)],'description':_0x6b50b6?.['description']},_0x51125a),'',_0x2b65c0],_0x1899f2=_0x8176e8[_0x435074(0x1ac)]('\x0a');return _0x1899f2[_0x435074(0x18f)]('\x0a')?_0x1899f2:_0x1899f2+'\x0a';}function a192_0x54f0(_0x2ba293,_0x6decc8){_0x2ba293=_0x2ba293-0x183;const _0x481246=a192_0x4812();let _0x54f036=_0x481246[_0x2ba293];return _0x54f036;}export function stripLocalSqlMetadata(_0x381b78,_0x17c804){const _0x570e54=a192_0x36ea5a,_0x1cfb6d=_0x381b78[_0x570e54(0x18c)](/\r\n/g,'\x0a')[_0x570e54(0x19e)]('\x0a'),_0x50b361=[];let _0x3718d3=0x0;if(_0x17c804===_0x570e54(0x1ae))while(_0x3718d3<_0x1cfb6d[_0x570e54(0x192)]){const _0x4f4b10=_0x1cfb6d[_0x3718d3]??'';if(/^\s*<!--\s*@lovrabet\./[_0x570e54(0x198)](_0x4f4b10)){_0x3718d3++;continue;}if(_0x4f4b10[_0x570e54(0x18d)]()===''&&_0x3718d3>0x0){_0x3718d3++;continue;}break;}else while(_0x3718d3<_0x1cfb6d[_0x570e54(0x192)]){const _0x3a3973=_0x1cfb6d[_0x3718d3]??'';if(/^\s*--\s*@lovrabet\./[_0x570e54(0x198)](_0x3a3973)){_0x3718d3++;continue;}if(_0x3a3973[_0x570e54(0x18d)]()===''&&_0x3718d3>0x0){_0x3718d3++;continue;}break;}for(;_0x3718d3<_0x1cfb6d[_0x570e54(0x192)];_0x3718d3++){_0x50b361[_0x570e54(0x1a8)](_0x1cfb6d[_0x3718d3]);}return _0x50b361[_0x570e54(0x1ac)]('\x0a')[_0x570e54(0x183)]();}function a192_0x4812(){const _0x2480fe=['763526aIbuRu','143214JYxLDb','test','.rabetbase/sql','639vUNPxn','fromEntries','sqlName','close','split','--\x20@lovrabet.','160960RgrGSo','sqlConfig','mode','description','sqlCode','apps','5nmsUhv','filter','push','sqlRoot','11sLUiDn','toLowerCase','join','24713450NzzDCx','mybatisXml','path','question','\x20-->','\x20[y/N]\x20','trimStart','yes','58616HVhdVb','dbId','<!--\x20@lovrabet.','stderr','154nKCDKT','entries','map','replace','trim','dbName','endsWith','2276468lBkgvW','syncedAt','length','1426335sSuCex','lastSync','sqlContent'];a192_0x4812=function(){return _0x2480fe;};return a192_0x4812();}export function resolveSqlMode(_0x1ce115,_0x29da5c){const _0x40af6a=a192_0x36ea5a;if(_0x29da5c?.[_0x40af6a(0x1a2)])return _0x29da5c[_0x40af6a(0x1a2)];return detectSqlMode(_0x1ce115);}export function resolveSqlFileName(_0x2bb1cc,_0x54c787,_0xa37899){const _0x5a3c28=a192_0x36ea5a;if(_0xa37899?.[_0x5a3c28(0x1af)])return _0xa37899[_0x5a3c28(0x1af)];if(_0xa37899?.[_0x5a3c28(0x19c)]||_0xa37899?.[_0x5a3c28(0x18e)])return buildSqlRelativePath(_0x2bb1cc,_0xa37899?.[_0x5a3c28(0x19c)],_0xa37899?.[_0x5a3c28(0x18e)],resolveSqlMode(_0x54c787,_0xa37899),_0xa37899?.[_0x5a3c28(0x186)]);return buildDefaultSqlFileName(_0x2bb1cc,resolveSqlMode(_0x54c787,_0xa37899));}export function resolveSqlLocalDir(_0x168aaf,_0x2b9879){return join(_0x168aaf,SQL_LOCAL_REL_DIR,_0x2b9879);}export async function confirmForceOverwrite(_0x4c749f){const _0x48de0b=a192_0x36ea5a,_0x43ea8b=createInterface({'input':process['stdin'],'output':process[_0x48de0b(0x188)]}),_0x89a4b9=await new Promise(_0x461d82=>{const _0x73238c=_0x48de0b;_0x43ea8b[_0x73238c(0x1b0)](_0x4c749f+_0x73238c(0x1b2),_0x461d82);});return _0x43ea8b[_0x48de0b(0x19d)](),['y',_0x48de0b(0x184)]['includes'](_0x89a4b9[_0x48de0b(0x18d)]()[_0x48de0b(0x1ab)]());}export function findSqlLockScope(_0x16a062,_0x186754){const _0x43f65f=a192_0x36ea5a;return _0x16a062[_0x43f65f(0x1a5)][_0x186754];}function buildMetadataHeaderLines(_0x5bd070,_0x29d5f1){const _0x4897c5=a192_0x36ea5a,_0x22e9de=[[_0x4897c5(0x1a4),_0x5bd070['sqlCode']],[_0x4897c5(0x19c),_0x5bd070[_0x4897c5(0x19c)]],[_0x4897c5(0x186),_0x5bd070[_0x4897c5(0x186)]],[_0x4897c5(0x18e),_0x5bd070[_0x4897c5(0x18e)]],['mode',_0x5bd070[_0x4897c5(0x1a2)]],[_0x4897c5(0x191),_0x5bd070[_0x4897c5(0x191)]],[_0x4897c5(0x1a3),_0x5bd070[_0x4897c5(0x1a3)]]];if(_0x29d5f1===_0x4897c5(0x1ae))return _0x22e9de[_0x4897c5(0x1a7)](([,_0x18104a])=>_0x18104a!==undefined&&_0x18104a!==null&&String(_0x18104a)[_0x4897c5(0x18d)]()!=='')[_0x4897c5(0x18b)](([_0x4626b5,_0x21e520])=>_0x4897c5(0x187)+_0x4626b5+':\x20'+String(_0x21e520)+_0x4897c5(0x1b1));return _0x22e9de[_0x4897c5(0x1a7)](([,_0x129278])=>_0x129278!==undefined&&_0x129278!==null&&String(_0x129278)[_0x4897c5(0x18d)]()!=='')[_0x4897c5(0x18b)](([_0x40b2f6,_0x35d8d3])=>_0x4897c5(0x19f)+_0x40b2f6+':\x20'+String(_0x35d8d3));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a193_0x2ab540=a193_0x4e29;function a193_0x4e29(_0x563a6a,_0x5115cd){_0x563a6a=_0x563a6a-0x14f;const _0x12419c=a193_0x1241();let _0x4e29a5=_0x12419c[_0x563a6a];return _0x4e29a5;}(function(_0x4447fd,_0x36410c){const _0x555c85=a193_0x4e29,_0x2c5b22=_0x4447fd();while(!![]){try{const _0x3e446a=-parseInt(_0x555c85(0x15f))/0x1*(-parseInt(_0x555c85(0x15d))/0x2)+-parseInt(_0x555c85(0x15e))/0x3+-parseInt(_0x555c85(0x16f))/0x4*(-parseInt(_0x555c85(0x16e))/0x5)+-parseInt(_0x555c85(0x169))/0x6+parseInt(_0x555c85(0x153))/0x7+parseInt(_0x555c85(0x16a))/0x8+-parseInt(_0x555c85(0x16b))/0x9;if(_0x3e446a===_0x36410c)break;else _0x2c5b22['push'](_0x2c5b22['shift']());}catch(_0x455cfd){_0x2c5b22['push'](_0x2c5b22['shift']());}}}(a193_0x1241,0x39742));import{listSqlQueries}from'../../core/api-client.js';function a193_0x1241(){const _0x182ff6=['remote','12055MaXdNw','4vUZOGV','hash','\x20unchanged','sqls','status','map','totalCount','appCode','boolean','\x20modified,\x20','3018974DAxyZU','paging','read','relativePath','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','All\x20SQL\x20queries\x20are\x20in\x20sync.','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','push','sqlRoot','lockFilePath','39486iFoqPy','1104711qOfEBR','1veAjnU','lockKey','\x20added,\x20','tableData','bool','path','has','keys','sqlName','length','155550nkQKib','3079280tekyHE','1879686kntUgU','sql'];a193_0x1241=function(){return _0x182ff6;};return a193_0x1241();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x304b0b){const _0x5ca650=a193_0x4e29,_0x464f43=[];let _0x17c02d=0x1;while(!![]){const _0x44035c=await listSqlQueries(_0x304b0b,{'currentPage':_0x17c02d,'pageSize':PAGE_SIZE}),_0x2da2f6=_0x44035c[_0x5ca650(0x162)]??[];_0x464f43[_0x5ca650(0x15a)](..._0x2da2f6[_0x5ca650(0x174)](_0x22438a=>_0x22438a['sqlCode']));if(_0x2da2f6[_0x5ca650(0x168)]===0x0)break;const _0x4c3a5c=_0x44035c[_0x5ca650(0x154)]?.[_0x5ca650(0x14f)];if(_0x4c3a5c!=null?_0x464f43[_0x5ca650(0x168)]>=_0x4c3a5c:_0x2da2f6[_0x5ca650(0x168)]<PAGE_SIZE)break;_0x17c02d++;}return _0x464f43;}export const sqlStatus={'service':a193_0x2ab540(0x16c),'command':a193_0x2ab540(0x173),'description':a193_0x2ab540(0x159),'risk':a193_0x2ab540(0x155),'flags':[{'name':a193_0x2ab540(0x16d),'type':a193_0x2ab540(0x151),'description':a193_0x2ab540(0x157)}],async 'execute'(_0x54134d){const _0x1bf4a6=a193_0x2ab540,_0x1714d9=loadSqlProjectConfig(_0x54134d[_0x1bf4a6(0x150)]),_0x3255d4=await readSqlLockFile(_0x1714d9[_0x1bf4a6(0x15c)]),{appLock:_0x352423}=ensureSqlLockScope(_0x3255d4??createEmptySqlLock(),_0x1714d9[_0x1bf4a6(0x150)],_0x1714d9[_0x1bf4a6(0x15b)],_0x1bf4a6(0x173)),_0x6babf3=await scanLocalSqlQueries(_0x1714d9),_0x23d21e=[],_0x2f147c=[],_0x294aac=[],_0xa49080=[],_0x133ce4=new Set(_0x6babf3[_0x1bf4a6(0x174)](_0x1a6023=>_0x1a6023[_0x1bf4a6(0x160)]));for(const _0x17d005 of _0x6babf3){const _0x1b100c=await computeSqlFileHash(_0x17d005['filePath']),_0x4992a4=_0x352423[_0x1bf4a6(0x172)][_0x17d005[_0x1bf4a6(0x160)]],_0x265da0=!!_0x4992a4&&_0x4992a4[_0x1bf4a6(0x164)]!==_0x17d005[_0x1bf4a6(0x156)],_0x4ea840=!!_0x4992a4&&!!_0x17d005['sqlName']&&_0x4992a4['sqlName']!==_0x17d005[_0x1bf4a6(0x167)];if(!_0x4992a4)_0x23d21e[_0x1bf4a6(0x15a)](_0x17d005['lockKey']);else _0x4992a4[_0x1bf4a6(0x170)]!==_0x1b100c||_0x265da0||_0x4ea840?_0x2f147c[_0x1bf4a6(0x15a)](_0x17d005['lockKey']):_0x294aac['push'](_0x17d005[_0x1bf4a6(0x160)]);}for(const _0x55dfd4 of Object[_0x1bf4a6(0x166)](_0x352423['sqls'])){!_0x133ce4[_0x1bf4a6(0x165)](_0x55dfd4)&&_0xa49080[_0x1bf4a6(0x15a)](_0x55dfd4);}const _0x26155c=[];if(_0x54134d[_0x1bf4a6(0x163)](_0x1bf4a6(0x16d))){const _0xe650fe=await fetchAllSqlCodes(_0x54134d[_0x1bf4a6(0x150)]);for(const _0x35180d of _0xe650fe){!_0x133ce4[_0x1bf4a6(0x165)](_0x35180d)&&!_0x352423[_0x1bf4a6(0x172)][_0x35180d]&&_0x26155c[_0x1bf4a6(0x15a)](_0x35180d);}}const _0x4fe258=_0x23d21e[_0x1bf4a6(0x168)]===0x0&&_0x2f147c['length']===0x0&&_0xa49080[_0x1bf4a6(0x168)]===0x0&&_0x26155c[_0x1bf4a6(0x168)]===0x0;return{'ok':!![],'data':{'added':_0x23d21e,'modified':_0x2f147c,'missing':_0xa49080,'unchanged':_0x294aac,'remoteOnly':_0x26155c},'message':_0x4fe258?_0x1bf4a6(0x158):_0x23d21e[_0x1bf4a6(0x168)]+_0x1bf4a6(0x161)+_0x2f147c[_0x1bf4a6(0x168)]+_0x1bf4a6(0x152)+_0xa49080[_0x1bf4a6(0x168)]+'\x20missing,\x20'+_0x294aac['length']+_0x1bf4a6(0x171)+(_0x26155c[_0x1bf4a6(0x168)]>0x0?',\x20'+_0x26155c['length']+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a194_0x4128(_0x324404,_0x40e5de){_0x324404=_0x324404-0x19b;const _0x519162=a194_0x5191();let _0x412885=_0x519162[_0x324404];return _0x412885;}const a194_0x222ff7=a194_0x4128;(function(_0x3a2160,_0x3b0259){const _0x26fbee=a194_0x4128,_0x8cb894=_0x3a2160();while(!![]){try{const _0x1992a4=-parseInt(_0x26fbee(0x1c0))/0x1+-parseInt(_0x26fbee(0x1ae))/0x2+-parseInt(_0x26fbee(0x1ce))/0x3+parseInt(_0x26fbee(0x1cd))/0x4+-parseInt(_0x26fbee(0x1a5))/0x5+parseInt(_0x26fbee(0x19b))/0x6*(parseInt(_0x26fbee(0x1b9))/0x7)+parseInt(_0x26fbee(0x1b2))/0x8*(parseInt(_0x26fbee(0x1bb))/0x9);if(_0x1992a4===_0x3b0259)break;else _0x8cb894['push'](_0x8cb894['shift']());}catch(_0x437a79){_0x8cb894['push'](_0x8cb894['shift']());}}}(a194_0x5191,0xa1a23));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a194_0x222ff7(0x1b0),'command':a194_0x222ff7(0x1d0),'description':a194_0x222ff7(0x19d),'risk':'read','flags':[{'name':a194_0x222ff7(0x1d4),'type':a194_0x222ff7(0x1aa),'description':a194_0x222ff7(0x1db)},{'name':a194_0x222ff7(0x1b0),'type':a194_0x222ff7(0x1aa),'description':a194_0x222ff7(0x1ca)},{'name':a194_0x222ff7(0x1ad),'type':'string','description':a194_0x222ff7(0x1d5)},{'name':a194_0x222ff7(0x1a4),'type':'boolean','description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x504d06){const _0x15598e=a194_0x222ff7,_0x131470=_0x504d06[_0x15598e(0x1b6)](_0x15598e(0x1d4)),_0x4a5375=_0x504d06[_0x15598e(0x1b6)](_0x15598e(0x1b0)),_0xf43f0a=_0x504d06['str'](_0x15598e(0x1ad)),_0x50888f=_0x504d06[_0x15598e(0x1c2)](_0x15598e(0x1a4));if(!_0x131470&&!_0x4a5375)throw CliErrors[_0x15598e(0x1c7)]('file',_0x15598e(0x1a3));if(_0x50888f&&!_0xf43f0a)throw CliErrors[_0x15598e(0x1c9)](_0x15598e(0x1b3));let _0x103431;if(_0x131470){const _0x4f6d08=resolve(process[_0x15598e(0x1d1)](),_0x131470);if(!existsSync(_0x4f6d08))throw CliErrors[_0x15598e(0x1c9)](_0x15598e(0x1ac)+_0x4f6d08);_0x103431=readFileSync(_0x4f6d08,'utf-8');}else _0x103431=_0x4a5375;const _0x1158ab=validateSql(_0x103431),_0x27f83f={'valid':_0x1158ab[_0x15598e(0x1d6)],'sqlType':_0x1158ab[_0x15598e(0x1ba)][_0x15598e(0x1bd)],'isSelectOnly':_0x1158ab['sqlType'][_0x15598e(0x1b1)],'isDangerous':_0x1158ab[_0x15598e(0x1ba)][_0x15598e(0x1cf)],'tables':_0x1158ab[_0x15598e(0x1b8)],'parameters':_0x1158ab[_0x15598e(0x1af)],'message':_0x1158ab[_0x15598e(0x1b4)]};_0x1158ab[_0x15598e(0x1ba)][_0x15598e(0x1dc)]&&(_0x27f83f[_0x15598e(0x1dc)]=_0x1158ab['sqlType']['reason']);if(_0xf43f0a&&_0x1158ab[_0x15598e(0x1d6)]){const _0x41b9ac=_0xf43f0a[_0x15598e(0x1cc)](',')['map'](_0x1769aa=>_0x1769aa['trim']())[_0x15598e(0x1c6)](Boolean),_0x4d806e=[],_0xcc8418=[],_0xdd973e=filterDbTableBackedDatasets(await listDatasets(_0x504d06[_0x15598e(0x19c)])),_0x32c000=new Map(_0xdd973e[_0x15598e(0x1d9)](_0x210e9e=>[_0x210e9e[_0x15598e(0x1bf)]?.[_0x15598e(0x1bc)]?.[_0x15598e(0x1d2)](),_0x210e9e]));for(const _0x3fcea4 of _0x1158ab[_0x15598e(0x1b8)]){const _0x49572b=_0x32c000['get'](_0x3fcea4[_0x15598e(0x1d2)]());!_0x49572b&&_0x4d806e[_0x15598e(0x1a2)](_0x15598e(0x1a1)+_0x3fcea4+_0x15598e(0x1ab));}for(const _0x26c0d3 of _0x41b9ac){let _0x43fa36;try{_0x43fa36=await getDatasetDetail(_0x26c0d3);}catch{_0x4d806e[_0x15598e(0x1a2)](_0x15598e(0x1a9)+_0x26c0d3+_0x15598e(0x1cb));continue;}assertDatasetIsDbTableBacked(_0x43fa36,_0x15598e(0x1be));const _0xb9f2e0=Array['isArray'](_0x43fa36['fields'])?_0x43fa36[_0x15598e(0x1c1)]:[],_0x3f9442=new Set(_0xb9f2e0[_0x15598e(0x1d9)](_0x59d25f=>_0x59d25f[_0x15598e(0x19e)]?.[_0x15598e(0x1d2)]())),_0x17c432=_0x43fa36[_0x15598e(0x1bf)]?.[_0x15598e(0x1bc)]||_0x43fa36[_0x15598e(0x1bc)]||_0x26c0d3;_0x27f83f[_0x15598e(0x1c8)+_0x17c432]={'code':_0x26c0d3,'tableName':_0x17c432,'fieldCount':_0x3f9442[_0x15598e(0x1d8)],'fields':Array['from'](_0x3f9442)};if(_0x50888f){const _0x2de434=normalizeDatasetIndexes(_0x43fa36);_0xcc8418[_0x15598e(0x1a2)]({'tableName':_0x17c432,..._0x2de434});}}_0x4d806e[_0x15598e(0x1da)]>0x0&&(_0x27f83f['schemaWarnings']=_0x4d806e),_0x50888f&&(_0x27f83f[_0x15598e(0x1d3)]=auditSqlJoinIndexes(_0x103431,_0xcc8418));}return{'ok':_0x1158ab[_0x15598e(0x1d6)],'data':_0x27f83f,'message':_0x1158ab['message']};}};function a194_0x5191(){const _0x877513=['message','index_type','str','find','tables','997773GVnoMG','sqlType','11715093QUMEnm','tableName','type','SQL\x20schema\x20validation','dbtableConfig','487856VGZzYR','fields','bool','index_columns','columns','columnNames','filter','flagMissing','schema:','validation','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','\x22\x20not\x20found\x20or\x20not\x20accessible','split','3210296JVpNOO','1566942tnMnJx','isDangerous','validate','cwd','toLowerCase','joinAudit','file','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','valid','isArray','size','map','length','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','reason','48JxypXt','appCode','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','name','indexName','dataset','Table\x20\x22','push','Provide\x20--file\x20or\x20--sql','check-indexes','5129920SXEFsq','indexes','trim','pkField','Dataset\x20\x22','string','\x22\x20not\x20found\x20in\x20any\x20dataset','File\x20not\x20found:\x20','schemas','1092716hBatov','parameters','sql','isSelectOnly','8SjUIYq','--check-indexes\x20requires\x20--schemas.'];a194_0x5191=function(){return _0x877513;};return a194_0x5191();}function normalizeDatasetIndexes(_0x2ba488){const _0x5e025a=a194_0x222ff7,_0x4869bd=Array[_0x5e025a(0x1d7)](_0x2ba488?.[_0x5e025a(0x1a0)]?.[_0x5e025a(0x1a6)])?_0x2ba488['dataset']['indexes']:Array[_0x5e025a(0x1d7)](_0x2ba488?.[_0x5e025a(0x1a6)])?_0x2ba488[_0x5e025a(0x1a6)]:[],_0x1b384e=_0x4869bd['flatMap'](_0x1cf346=>{const _0x36c193=_0x5e025a,_0x35226d=Array['isArray'](_0x1cf346?.[_0x36c193(0x1c3)])?_0x1cf346[_0x36c193(0x1c3)]:Array[_0x36c193(0x1d7)](_0x1cf346?.[_0x36c193(0x1c5)])?_0x1cf346[_0x36c193(0x1c5)]:Array[_0x36c193(0x1d7)](_0x1cf346?.[_0x36c193(0x1c4)])?_0x1cf346[_0x36c193(0x1c4)]:[],_0x3a042c=_0x35226d['filter'](_0x19b47a=>typeof _0x19b47a===_0x36c193(0x1aa))[_0x36c193(0x1d9)](_0x1c0ce7=>_0x1c0ce7[_0x36c193(0x1a7)]())[_0x36c193(0x1c6)](Boolean);if(_0x3a042c['length']===0x0)return[];const _0x379147=[_0x1cf346?.[_0x36c193(0x19f)],_0x1cf346?.['index_name'],_0x1cf346?.[_0x36c193(0x19e)]][_0x36c193(0x1b7)](_0x5dc7eb=>typeof _0x5dc7eb===_0x36c193(0x1aa)&&_0x5dc7eb[_0x36c193(0x1a7)]()),_0x2bab9a=[_0x1cf346?.[_0x36c193(0x1b5)],_0x1cf346?.['type']][_0x36c193(0x1b7)](_0x4f7dad=>typeof _0x4f7dad===_0x36c193(0x1aa)&&_0x4f7dad[_0x36c193(0x1a7)]());return[{..._0x379147?{'name':_0x379147[_0x36c193(0x1a7)]()}:{},..._0x2bab9a?{'type':_0x2bab9a[_0x36c193(0x1a7)]()}:{},'columns':_0x3a042c}];}),_0xf688f8=[..._0x1b384e],_0x123087=typeof _0x2ba488?.[_0x5e025a(0x1bf)]?.[_0x5e025a(0x1a8)]===_0x5e025a(0x1aa)?_0x2ba488[_0x5e025a(0x1bf)][_0x5e025a(0x1a8)][_0x5e025a(0x1cc)](',')['map'](_0x38997f=>_0x38997f['trim']())[_0x5e025a(0x1c6)](Boolean):[];return _0x123087[_0x5e025a(0x1da)]>0x0&&_0xf688f8['unshift']({'type':'primary','columns':_0x123087}),{'indexes':_0xf688f8,'metadataAvailable':_0x1b384e[_0x5e025a(0x1da)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x6cbb27,_0x1c897f){const _0x5979c7=a195_0x401e,_0x922cbe=_0x6cbb27();while(!![]){try{const _0x7695ce=parseInt(_0x5979c7(0x1f5))/0x1+-parseInt(_0x5979c7(0x1f0))/0x2+-parseInt(_0x5979c7(0x1f4))/0x3+-parseInt(_0x5979c7(0x1ef))/0x4+parseInt(_0x5979c7(0x1f1))/0x5+-parseInt(_0x5979c7(0x1f3))/0x6+parseInt(_0x5979c7(0x1f2))/0x7;if(_0x7695ce===_0x1c897f)break;else _0x922cbe['push'](_0x922cbe['shift']());}catch(_0x429246){_0x922cbe['push'](_0x922cbe['shift']());}}}(a195_0x2f35,0xcdd49));import{taskStatus}from'../../commands/task/status.js';function a195_0x401e(_0x1946d8,_0x310885){_0x1946d8=_0x1946d8-0x1ef;const _0x2f35f5=a195_0x2f35();let _0x401edd=_0x2f35f5[_0x1946d8];return _0x401edd;}export const taskDefinitions=[taskStatus];function a195_0x2f35(){const _0x32845e=['1074058BXPXWm','1646364ZZjIqM','1181190DrptVO','5377605cUUFEB','8524537OGrZxT','424158KCXMZv','4354230EkqiUR'];a195_0x2f35=function(){return _0x32845e;};return a195_0x2f35();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a196_0x15b163=a196_0x1404;(function(_0x16b4bb,_0x5e8bfb){const _0x3c06d9=a196_0x1404,_0x4fb1d1=_0x16b4bb();while(!![]){try{const _0x2096fa=-parseInt(_0x3c06d9(0x7e))/0x1*(-parseInt(_0x3c06d9(0x85))/0x2)+-parseInt(_0x3c06d9(0x76))/0x3*(-parseInt(_0x3c06d9(0x75))/0x4)+-parseInt(_0x3c06d9(0x74))/0x5*(-parseInt(_0x3c06d9(0x83))/0x6)+-parseInt(_0x3c06d9(0x73))/0x7*(parseInt(_0x3c06d9(0x7f))/0x8)+parseInt(_0x3c06d9(0x87))/0x9*(-parseInt(_0x3c06d9(0x7c))/0xa)+-parseInt(_0x3c06d9(0x8a))/0xb*(-parseInt(_0x3c06d9(0x82))/0xc)+-parseInt(_0x3c06d9(0x8c))/0xd*(-parseInt(_0x3c06d9(0x7b))/0xe);if(_0x2096fa===_0x5e8bfb)break;else _0x4fb1d1['push'](_0x4fb1d1['shift']());}catch(_0x182cb0){_0x4fb1d1['push'](_0x4fb1d1['shift']());}}}(a196_0x376e,0xedee9));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a196_0x1404(_0x353932,_0x58044c){_0x353932=_0x353932-0x72;const _0x376efa=a196_0x376e();let _0x14043a=_0x376efa[_0x353932];return _0x14043a;}import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a196_0x376e(){const _0x3b2c40=['18yyFvls','task','string','task-id','compress','3494470rsUJEx','3530QhtwUB','str','1093426KEDemG','13825592dCspgE','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','isTerminal','12dTpVff','2790trHwwb','appCode','2BPiEnK','trim','49500CetrTG',',\x20received\x20','taskId','677039MLhyPP','cookie','91olCMil','apiError','7Qthvrq','11520JyGrPy','447132uOoafS'];a196_0x376e=function(){return _0x3b2c40;};return a196_0x376e();}export const taskStatus={'service':a196_0x15b163(0x77),'command':'status','description':'Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','risk':'read','defaultOutputFormat':a196_0x15b163(0x7a),'structuredErrors':!![],'flags':[{'name':a196_0x15b163(0x79),'type':a196_0x15b163(0x78),'required':!![],'description':a196_0x15b163(0x80)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1da9d1){const _0x5258aa=a196_0x15b163;if(!_0x1da9d1[_0x5258aa(0x7d)](_0x5258aa(0x79))[_0x5258aa(0x86)]())throw CliErrors['flagMissing']('task-id');},async 'execute'(_0x132a97){const _0x1dc987=a196_0x15b163,_0x1d74bc=_0x132a97[_0x1dc987(0x7d)]('task-id')['trim'](),_0x5d9c37=normalizeAsyncTask(await getAsyncTaskStatus(_0x1d74bc,_0x132a97[_0x1dc987(0x84)],_0x132a97[_0x1dc987(0x8b)]));if(_0x5d9c37[_0x1dc987(0x89)]!==_0x1d74bc)throw CliErrors[_0x1dc987(0x72)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x1d74bc+_0x1dc987(0x88)+_0x5d9c37[_0x1dc987(0x89)]+'.');const _0x32e306=buildAsyncTaskStatusCommand(_0x5d9c37[_0x1dc987(0x89)],_0x132a97[_0x1dc987(0x84)]);return{'ok':!![],'message':asyncTaskMessage(_0x5d9c37),'data':{'appCode':_0x132a97[_0x1dc987(0x84)],..._0x5d9c37,'query':_0x5d9c37[_0x1dc987(0x81)]?null:{'command':_0x32e306}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x159405,_0x431d3e){const _0x42efc2=a197_0x584b,_0xf16590=_0x159405();while(!![]){try{const _0x597404=-parseInt(_0x42efc2(0xea))/0x1*(-parseInt(_0x42efc2(0xe9))/0x2)+-parseInt(_0x42efc2(0xeb))/0x3+parseInt(_0x42efc2(0xec))/0x4+parseInt(_0x42efc2(0xe8))/0x5*(parseInt(_0x42efc2(0xed))/0x6)+-parseInt(_0x42efc2(0xe5))/0x7+parseInt(_0x42efc2(0xef))/0x8*(parseInt(_0x42efc2(0xee))/0x9)+parseInt(_0x42efc2(0xe7))/0xa*(-parseInt(_0x42efc2(0xe6))/0xb);if(_0x597404===_0x431d3e)break;else _0xf16590['push'](_0xf16590['shift']());}catch(_0x3e58c3){_0xf16590['push'](_0xf16590['shift']());}}}(a197_0x44f3,0xb8467));function a197_0x584b(_0x6a5cd,_0x65a430){_0x6a5cd=_0x6a5cd-0xe5;const _0x44f359=a197_0x44f3();let _0x584b80=_0x44f359[_0x6a5cd];return _0x584b80;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a197_0x44f3(){const _0x19cdd9=['231JZrAuK','1488680YznJXK','862490KftfIz','127954gwTLnM','23BVUMdu','281376YuFHZg','5848752gHfBHv','30KPljGd','9864VgDjLB','7960jDmsXM','6383006DLjApQ'];a197_0x44f3=function(){return _0x19cdd9;};return a197_0x44f3();}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a198_0x24ef(){const _0x3a65c7=['6kNmGOJ','716377MtgTYu','9BmmEVQ','3598710MrnQnG','12480376jEIeVH','4orxGsY','trim','5325502hrraOC','3390785VNxQMf','7459872mNlQvV','string','\x20tenant\x20member(s)','tenant-code','129501qzQnsd','read','flagMissing','Exact\x20tenant\x20code','str','Pass\x20--tenant-code\x20<code>.','length'];a198_0x24ef=function(){return _0x3a65c7;};return a198_0x24ef();}const a198_0x25df39=a198_0x9505;function a198_0x9505(_0x34abff,_0x52324b){_0x34abff=_0x34abff-0x196;const _0x24efab=a198_0x24ef();let _0x95054f=_0x24efab[_0x34abff];return _0x95054f;}(function(_0x14d023,_0x3dc7c8){const _0x381ad3=a198_0x9505,_0x37b384=_0x14d023();while(!![]){try{const _0x494304=parseInt(_0x381ad3(0x1a9))/0x1+parseInt(_0x381ad3(0x1a8))/0x2*(parseInt(_0x381ad3(0x1a1))/0x3)+-parseInt(_0x381ad3(0x199))/0x4*(-parseInt(_0x381ad3(0x19c))/0x5)+parseInt(_0x381ad3(0x19d))/0x6+-parseInt(_0x381ad3(0x19b))/0x7+parseInt(_0x381ad3(0x198))/0x8*(-parseInt(_0x381ad3(0x196))/0x9)+parseInt(_0x381ad3(0x197))/0xa;if(_0x494304===_0x3dc7c8)break;else _0x37b384['push'](_0x37b384['shift']());}catch(_0x5e06ab){_0x37b384['push'](_0x37b384['shift']());}}}(a198_0x24ef,0xc4df1));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':'tenant','command':'members-list','description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':a198_0x25df39(0x1a2),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a198_0x25df39(0x1a0),'type':a198_0x25df39(0x19e),'required':!![],'description':a198_0x25df39(0x1a4)}],async 'validate'(_0x38dacf){const _0x1337ce=a198_0x25df39;if(!_0x38dacf[_0x1337ce(0x1a5)](_0x1337ce(0x1a0))[_0x1337ce(0x19a)]())throw CliErrors[_0x1337ce(0x1a3)]('tenant-code',_0x1337ce(0x1a6));},async 'execute'(_0x3d58f4){const _0x4d2ef7=a198_0x25df39,_0x47a7d4=_0x3d58f4[_0x4d2ef7(0x1a5)](_0x4d2ef7(0x1a0))[_0x4d2ef7(0x19a)](),_0x5a968a=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x47a7d4,_0x5a968a);const _0x347063=projectTenantMembers(await listTenantDirectoryMembers(_0x47a7d4));return{'ok':!![],'data':{'tenantCode':_0x47a7d4,'items':_0x347063,'totalCount':_0x347063[_0x4d2ef7(0x1a7)]},'message':'Found\x20'+_0x347063[_0x4d2ef7(0x1a7)]+_0x4d2ef7(0x19f)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a199_0x1380(_0x9acbc4,_0x2ea50d){_0x9acbc4=_0x9acbc4-0x6b;const _0x356a9e=a199_0x356a();let _0x138011=_0x356a9e[_0x9acbc4];return _0x138011;}(function(_0x201db4,_0x4ad6d0){const _0x22011c=a199_0x1380,_0x4549bf=_0x201db4();while(!![]){try{const _0x128072=parseInt(_0x22011c(0x72))/0x1+parseInt(_0x22011c(0x85))/0x2*(-parseInt(_0x22011c(0x6c))/0x3)+parseInt(_0x22011c(0x77))/0x4+parseInt(_0x22011c(0x7a))/0x5*(parseInt(_0x22011c(0x6d))/0x6)+-parseInt(_0x22011c(0x6b))/0x7*(-parseInt(_0x22011c(0x80))/0x8)+parseInt(_0x22011c(0x70))/0x9+parseInt(_0x22011c(0x7b))/0xa*(-parseInt(_0x22011c(0x78))/0xb);if(_0x128072===_0x4ad6d0)break;else _0x4549bf['push'](_0x4549bf['shift']());}catch(_0xb2d9f){_0x4549bf['push'](_0x4549bf['shift']());}}}(a199_0x356a,0x95e16));import{CliErrors}from'../../errors.js';function textOrNull(_0x5baee2){const _0x243637=a199_0x1380,_0x14d1df=_0x5baee2?.[_0x243637(0x74)]();return _0x14d1df?_0x14d1df:null;}export function projectTenantMembers(_0x2a7342){const _0x2bd8f6=a199_0x1380,_0x373ac4=new Map();for(const _0x475266 of _0x2a7342){const _0x32a8d5=Number(_0x475266[_0x2bd8f6(0x76)]);if(!Number[_0x2bd8f6(0x6e)](_0x32a8d5)||_0x32a8d5<=0x0)continue;const _0x35a22b={'userId':_0x32a8d5,'username':textOrNull(_0x475266[_0x2bd8f6(0x75)]),'displayName':textOrNull(_0x475266['nickname']),'role':_0x475266[_0x2bd8f6(0x83)]===!![]?_0x2bd8f6(0x71):'MEMBER','status':textOrNull(_0x475266[_0x2bd8f6(0x73)])},_0x28c12c=_0x373ac4['get'](_0x32a8d5);if(!_0x28c12c){_0x373ac4[_0x2bd8f6(0x7f)](_0x32a8d5,_0x35a22b);continue;}_0x28c12c[_0x2bd8f6(0x75)]??=_0x35a22b[_0x2bd8f6(0x75)],_0x28c12c[_0x2bd8f6(0x79)]??=_0x35a22b['displayName'],_0x28c12c[_0x2bd8f6(0x73)]??=_0x35a22b[_0x2bd8f6(0x73)];if(_0x35a22b['role']===_0x2bd8f6(0x71))_0x28c12c[_0x2bd8f6(0x6f)]='ADMIN';}return[..._0x373ac4[_0x2bd8f6(0x7d)]()][_0x2bd8f6(0x84)]((_0x2afb58,_0x3fe0c)=>_0x2afb58['userId']-_0x3fe0c['userId']);}export function assertTenantAccessible(_0x1a24d7,_0x4264dc){const _0x7f2e87=a199_0x1380;if(_0x4264dc[_0x7f2e87(0x81)](_0x22bd61=>_0x22bd61[_0x7f2e87(0x7c)]===_0x1a24d7))return;throw CliErrors[_0x7f2e87(0x82)]('Tenant\x20\x22'+_0x1a24d7+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x7f2e87(0x7e));}function a199_0x356a(){const _0x318a0d=['22YStScg','displayName','232945NtMwPo','2996830FbnPqf','tenantCode','values','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','set','54472iAmuNr','some','validation','adminFlag','sort','818UoRbUf','322JbfAQU','8319MalnMv','42aHOxjc','isFinite','role','123003sUuLAd','ADMIN','799215DDvPGj','status','trim','username','userId','3580856RivKMl'];a199_0x356a=function(){return _0x318a0d;};return a199_0x356a();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a200_0x4ac1ca=a200_0x2618;function a200_0xced1(){const _0x32cc9e=['2tYPdov','POST','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','1426605nWBkCd','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','write','ding-talk-user-id','str','2102236AfamiM','dingding-sandbox-bind','apiError','6072437jjzIzA','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','bind','857732kUlsAv','7132120zdUbRw','3058608DWhRZJ','408321LwiSzj','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','dingding-sandbox','12XlxVAj','string','trim','user-account','--ding-talk-user-id\x20cannot\x20be\x20empty.','690ZpcGxW','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','validation'];a200_0xced1=function(){return _0x32cc9e;};return a200_0xced1();}(function(_0x130486,_0x28dac7){const _0x54a269=a200_0x2618,_0x5d2de4=_0x130486();while(!![]){try{const _0xa63b42=-parseInt(_0x54a269(0x18d))/0x1+parseInt(_0x54a269(0x17f))/0x2*(-parseInt(_0x54a269(0x18f))/0x3)+parseInt(_0x54a269(0x187))/0x4+parseInt(_0x54a269(0x182))/0x5*(parseInt(_0x54a269(0x177))/0x6)+-parseInt(_0x54a269(0x18a))/0x7+-parseInt(_0x54a269(0x18e))/0x8+parseInt(_0x54a269(0x190))/0x9*(parseInt(_0x54a269(0x17c))/0xa);if(_0xa63b42===_0x28dac7)break;else _0x5d2de4['push'](_0x5d2de4['shift']());}catch(_0x65023e){_0x5d2de4['push'](_0x5d2de4['shift']());}}}(a200_0xced1,0x90234));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';function a200_0x2618(_0x4707a7,_0x2b9557){_0x4707a7=_0x4707a7-0x177;const _0xced1f0=a200_0xced1();let _0x2618a5=_0xced1f0[_0x4707a7];return _0x2618a5;}import{CliErrors}from'../../errors.js';const PROVIDER_ID=a200_0x4ac1ca(0x192),CURRENT_BINDING_WARNING='The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.';function readDingTalkUserId(_0x2238a5){const _0x2d3f2f=a200_0x4ac1ca,_0x1ae750=_0x2238a5[_0x2d3f2f(0x186)](_0x2d3f2f(0x185))[_0x2d3f2f(0x179)]();if(!_0x1ae750)throw CliErrors[_0x2d3f2f(0x17e)](_0x2d3f2f(0x17b),_0x2d3f2f(0x18b));return _0x1ae750;}function buildBindingData(_0x292fdf,_0x5ef67e){const _0x4eac8d=a200_0x4ac1ca;return{'operation':_0x4eac8d(0x18c),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x292fdf},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x292fdf,'bound':!![]},'dryRun':_0x5ef67e,'backend':{'method':_0x4eac8d(0x180),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a200_0x4ac1ca(0x17a),'command':a200_0x4ac1ca(0x188),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':a200_0x4ac1ca(0x184),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a200_0x4ac1ca(0x185),'type':a200_0x4ac1ca(0x178),'required':!![],'description':a200_0x4ac1ca(0x17d)}],async 'validate'(_0x498a52){readDingTalkUserId(_0x498a52);},async 'dryRun'(_0x35cd63){const _0x5180e1=a200_0x4ac1ca,_0x44f9c1=readDingTalkUserId(_0x35cd63);return asDryRunResult(buildBindingData(_0x44f9c1,!![]),{'method':_0x5180e1(0x180),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x1de165){const _0xd71604=a200_0x4ac1ca,_0x1a73a3=readDingTalkUserId(_0x1de165),_0x3aaa80=await bindDingTalkSandboxAccount(_0x1a73a3);if(_0x3aaa80!==!![])throw CliErrors[_0xd71604(0x189)](_0xd71604(0x181),_0xd71604(0x191));return{'ok':!![],'data':buildBindingData(_0x1a73a3,![]),'message':_0xd71604(0x183)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a201_0x8751(){const _0x390f6d=['402820nbvPpn','4746186vZujgR','358939dtvBJK','14GZQBXZ','18712kLqMJF','45kZkPNB','4906910FlqtME','5166uvOUqc','1582176Wgfwer','27243050oTQVpa'];a201_0x8751=function(){return _0x390f6d;};return a201_0x8751();}(function(_0xce5c6e,_0x20240c){const _0x3b278e=a201_0x5f49,_0x55cf02=_0xce5c6e();while(!![]){try{const _0x3a398e=parseInt(_0x3b278e(0x1be))/0x1+parseInt(_0x3b278e(0x1ba))/0x2+parseInt(_0x3b278e(0x1c1))/0x3*(-parseInt(_0x3b278e(0x1bc))/0x4)+parseInt(_0x3b278e(0x1c2))/0x5+-parseInt(_0x3b278e(0x1bd))/0x6*(-parseInt(_0x3b278e(0x1bf))/0x7)+-parseInt(_0x3b278e(0x1c0))/0x8*(-parseInt(_0x3b278e(0x1b9))/0x9)+-parseInt(_0x3b278e(0x1bb))/0xa;if(_0x3a398e===_0x20240c)break;else _0x55cf02['push'](_0x55cf02['shift']());}catch(_0xf96340){_0x55cf02['push'](_0x55cf02['shift']());}}}(a201_0x8751,0xc87b9));function a201_0x5f49(_0x220afa,_0x3fc917){_0x220afa=_0x220afa-0x1b9;const _0x875120=a201_0x8751();let _0x5f49d9=_0x875120[_0x220afa];return _0x5f49d9;}import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a202_0x5ad548=a202_0x3ff6;function a202_0x1b06(){const _0x4ed14c=['3269730jORprY','workspace','50562srgVEX','App\x20profile\x20name','827612EUoQXF','workspace\x20add','write','3045WSndBh','12942520UDCmvK','name','903332LcyxbC','3752xVwccw','12UIpcEx','424UzYsAt','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','add','4993807PPwlHa'];a202_0x1b06=function(){return _0x4ed14c;};return a202_0x1b06();}function a202_0x3ff6(_0x59f54d,_0x47aaaa){_0x59f54d=_0x59f54d-0xa0;const _0x1b0612=a202_0x1b06();let _0x3ff628=_0x1b0612[_0x59f54d];return _0x3ff628;}(function(_0x362fbb,_0x4c3d91){const _0x5e021c=a202_0x3ff6,_0x4a58be=_0x362fbb();while(!![]){try{const _0x2a1d07=parseInt(_0x5e021c(0xa9))/0x1+parseInt(_0x5e021c(0xaf))/0x2+parseInt(_0x5e021c(0xac))/0x3*(-parseInt(_0x5e021c(0xb0))/0x4)+parseInt(_0x5e021c(0xa5))/0x5+-parseInt(_0x5e021c(0xa0))/0x6*(-parseInt(_0x5e021c(0xa4))/0x7)+parseInt(_0x5e021c(0xa1))/0x8*(-parseInt(_0x5e021c(0xa7))/0x9)+-parseInt(_0x5e021c(0xad))/0xa;if(_0x2a1d07===_0x4c3d91)break;else _0x4a58be['push'](_0x4a58be['shift']());}catch(_0x1c2385){_0x4a58be['push'](_0x4a58be['shift']());}}}(a202_0x1b06,0xc734e));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a202_0x5ad548(0xa6),'command':a202_0x5ad548(0xa3),'description':a202_0x5ad548(0xa2),'risk':a202_0x5ad548(0xab),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a202_0x5ad548(0xae),'description':a202_0x5ad548(0xa8),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x299338=>validateAppName(_0x299338,'workspace\x20add'),'execute':_0xd027be=>runAppAdd(_0xd027be,a202_0x5ad548(0xaa))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a203_0x4c47b8=a203_0xc44f;(function(_0x15b761,_0x521803){const _0x3d207f=a203_0xc44f,_0x1c1315=_0x15b761();while(!![]){try{const _0x56e7b1=-parseInt(_0x3d207f(0xeb))/0x1+parseInt(_0x3d207f(0xe0))/0x2+parseInt(_0x3d207f(0xdd))/0x3+-parseInt(_0x3d207f(0xda))/0x4*(-parseInt(_0x3d207f(0xe7))/0x5)+-parseInt(_0x3d207f(0xcb))/0x6+-parseInt(_0x3d207f(0xef))/0x7+parseInt(_0x3d207f(0xf3))/0x8;if(_0x56e7b1===_0x521803)break;else _0x1c1315['push'](_0x1c1315['shift']());}catch(_0x536a16){_0x1c1315['push'](_0x1c1315['shift']());}}}(a203_0x5869,0xc15d2));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';function a203_0xc44f(_0x581f6d,_0x525d9c){_0x581f6d=_0x581f6d-0xc6;const _0x586975=a203_0x5869();let _0xc44f50=_0x586975[_0x581f6d];return _0xc44f50;}function a203_0x5869(){const _0x37a8d0=['Initialize\x20the\x20current\x20workspace\x20app\x20binding','Missing\x20workspace\x20app\x20selector.','\x20workspace\x20','env','.\x20Credentials:\x20not\x20written.','app','475bZQWxk','pageSize','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','apps','1260847NQVSjf','trim','globalConfig','defaultApp','10079832wjIxlt','apiDir','initialized','appcode','8906624EKzItF','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','flag','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','\x20--app\x20','\x20(appcode:\x20','isArray','write','Workspace\x20','defaultFormat','validation','updated','workspace','use','init','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','App\x20\x22','4676382bAqZay','number','\x20workspace\x20use\x20--app\x20<name>`.','str','format','Switch\x20the\x20current\x20workspace\x20app\x20binding','length','string','locale','\x22\x20not\x20found.',').\x20Config:\x20','Locale\x20for\x20this\x20workspace\x20app\x20profile','riskLevel','object','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','66472XIDPcH','Use\x20`','project','3338394frUHKC','workspace.','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','934804eMQfeP'];a203_0x5869=function(){return _0x37a8d0;};return a203_0x5869();}import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a203_0x4c47b8(0xf6),SAFE_PROFILE_KEYS=[a203_0x4c47b8(0xf2),a203_0x4c47b8(0xe4),a203_0x4c47b8(0xf0),a203_0x4c47b8(0xcf),a203_0x4c47b8(0xe8),a203_0x4c47b8(0xd7),a203_0x4c47b8(0xd3)],workspaceFlags=[{'name':a203_0x4c47b8(0xe6),'type':'string','description':a203_0x4c47b8(0xdf)},{'name':a203_0x4c47b8(0xf2),'type':a203_0x4c47b8(0xd2),'description':a203_0x4c47b8(0xe9)},{'name':a203_0x4c47b8(0xe4),'type':a203_0x4c47b8(0xd2),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':a203_0x4c47b8(0xf0),'type':'string','description':a203_0x4c47b8(0xf4)},{'name':a203_0x4c47b8(0xfc),'type':a203_0x4c47b8(0xd2),'description':'Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a203_0x4c47b8(0xe8),'type':a203_0x4c47b8(0xcc),'description':a203_0x4c47b8(0xd9)},{'name':'riskLevel','type':a203_0x4c47b8(0xd2),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':'string','description':a203_0x4c47b8(0xd6)}];function isRecord(_0x46fe74){const _0x394f80=a203_0x4c47b8;return!!_0x46fe74&&typeof _0x46fe74===_0x394f80(0xd8)&&!Array[_0x394f80(0xf9)](_0x46fe74);}function assertValidAppcode(_0x2ee5e3){const _0x58f8c1=a203_0x4c47b8,{valid:_0x9350ec,message:_0x29cf4c}=validateAppcode(_0x2ee5e3);if(!_0x9350ec)throw CliErrors[_0x58f8c1(0xfd)]('Invalid\x20appcode:\x20'+_0x2ee5e3,_0x29cf4c);}function sanitizeProfile(_0x236fc2){if(!isRecord(_0x236fc2))return{};const _0x23b612={};for(const _0x495f08 of SAFE_PROFILE_KEYS){if(_0x236fc2[_0x495f08]!==undefined)_0x23b612[_0x495f08]=_0x236fc2[_0x495f08];}return _0x23b612;}function cloneProfile(_0x378863){return isRecord(_0x378863)?{..._0x378863}:{};}function collectWorkspaceProfileOverrides(_0x20962b){const _0x7be68b=a203_0x4c47b8,_0x189e46={},_0x444dda=_0x20962b[_0x7be68b(0xce)]('env'),_0x26c2be=_0x20962b[_0x7be68b(0xce)]('apiDir'),_0x5408a9=_0x20962b['str']('defaultFormat'),_0x344c34=_0x20962b[_0x7be68b(0xf5)](_0x7be68b(0xe8)),_0x5cfaba=_0x20962b['str']('riskLevel'),_0x4a4a88=_0x20962b[_0x7be68b(0xce)]('locale');if(_0x444dda)_0x189e46[_0x7be68b(0xe4)]=_0x444dda;if(_0x26c2be)_0x189e46[_0x7be68b(0xf0)]=_0x26c2be;if(_0x5408a9)_0x189e46[_0x7be68b(0xcf)]=_0x5408a9;if(_0x344c34!==undefined&&_0x344c34!=='')_0x189e46[_0x7be68b(0xe8)]=Number(_0x344c34);if(_0x5cfaba)_0x189e46[_0x7be68b(0xd7)]=_0x5cfaba;if(_0x4a4a88)_0x189e46[_0x7be68b(0xd3)]=_0x4a4a88;return _0x189e46;}async function validateWorkspaceArgs(_0x5373bd){const _0x56582d=a203_0x4c47b8,_0x2e3e48=_0x5373bd[_0x56582d(0xce)]('app')[_0x56582d(0xec)](),_0x1d94cb=_0x5373bd['str'](_0x56582d(0xf2))[_0x56582d(0xec)]();if(!_0x2e3e48&&!_0x1d94cb)throw CliErrors[_0x56582d(0xfd)](_0x56582d(0xe2),_0x56582d(0xdb)+CLI_BIN_NAME+_0x56582d(0xc9)+CLI_BIN_NAME+_0x56582d(0xcd));if(_0x1d94cb)assertValidAppcode(_0x1d94cb);}function resolveKnownApps(){const _0x1135c2=a203_0x4c47b8,{config:_0x1ddd51,layers:_0x4b4e26}=readRawConfigWithLayers(),_0x335ed1=isRecord(_0x1ddd51[_0x1135c2(0xea)])?_0x1ddd51[_0x1135c2(0xea)]:{},_0xc6ba1=isRecord(_0x4b4e26[_0x1135c2(0xed)][_0x1135c2(0xea)])?_0x4b4e26[_0x1135c2(0xed)]['apps']:{};return{..._0xc6ba1,..._0x335ed1};}async function configureWorkspace(_0x5492ef,_0x4df398){const _0x3d20c9=a203_0x4c47b8,_0x539bbe=_0x5492ef[_0x3d20c9(0xce)]('app')['trim'](),_0x22ac53=_0x5492ef[_0x3d20c9(0xce)]('appcode')[_0x3d20c9(0xec)](),_0x72e958=_0x539bbe||_0x22ac53;if(!_0x72e958)throw CliErrors[_0x3d20c9(0xfd)](_0x3d20c9(0xe2),'Use\x20`'+CLI_BIN_NAME+_0x3d20c9(0xc9)+CLI_BIN_NAME+_0x3d20c9(0xcd));if(_0x22ac53)assertValidAppcode(_0x22ac53);const _0x15f168=resolveWriteConfigPath(_0x3d20c9(0xdc)),_0x3e2c72=readConfigFile(_0x15f168),_0x2cb508=resolveKnownApps(),_0x1e5f48=isRecord(_0x3e2c72[_0x3d20c9(0xea)])?{..._0x3e2c72['apps']}:{},_0x3266d2=cloneProfile(_0x1e5f48[_0x72e958]),_0x1e4860=sanitizeProfile(_0x2cb508[_0x72e958]),_0x46b32e=_0x22ac53?{}:_0x1e4860,_0x4062dd=_0x22ac53||_0x46b32e[_0x3d20c9(0xf2)];if(!_0x4062dd){const _0x32f0fd=Object['keys'](_0x2cb508),_0x428a0a=_0x32f0fd[_0x3d20c9(0xd1)]===0x0?_0x3d20c9(0xdb)+CLI_BIN_NAME+_0x3d20c9(0xe3)+_0x4df398+_0x3d20c9(0xf7)+_0x72e958+'\x20--appcode\x20<code>`.':'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x32f0fd['join'](',\x20');throw CliErrors['validation'](_0x3d20c9(0xca)+_0x72e958+_0x3d20c9(0xd4),_0x428a0a);}assertValidAppcode(String(_0x4062dd));const _0x11abb9={..._0x46b32e,..._0x3266d2,'appcode':String(_0x4062dd),...collectWorkspaceProfileOverrides(_0x5492ef)};return _0x1e5f48[_0x72e958]=_0x11abb9,_0x3e2c72['apps']=_0x1e5f48,_0x3e2c72[_0x3d20c9(0xee)]=_0x72e958,delete _0x3e2c72[_0x3d20c9(0xf2)],delete _0x3e2c72[_0x3d20c9(0xe6)],_0x11abb9[_0x3d20c9(0xe4)]&&(_0x3e2c72[_0x3d20c9(0xe4)]=_0x11abb9[_0x3d20c9(0xe4)]),writeConfigFile(_0x15f168,_0x3e2c72),{'ok':!![],'message':_0x3d20c9(0xfb)+(_0x4df398==='init'?_0x3d20c9(0xf1):_0x3d20c9(0xfe))+':\x20'+_0x72e958+_0x3d20c9(0xf8)+_0x11abb9['appcode']+_0x3d20c9(0xd5)+_0x15f168+_0x3d20c9(0xe5),'data':{'operation':_0x3d20c9(0xde)+_0x4df398,'configPath':_0x15f168,'app':_0x72e958,'appcode':_0x11abb9[_0x3d20c9(0xf2)],'env':_0x11abb9[_0x3d20c9(0xe4)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':'workspace','command':a203_0x4c47b8(0xc8),'description':a203_0x4c47b8(0xe1),'risk':a203_0x4c47b8(0xfa),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x4ea013=>configureWorkspace(_0x4ea013,'init')},workspaceUseDefinition={'service':a203_0x4c47b8(0xc6),'command':a203_0x4c47b8(0xc7),'description':a203_0x4c47b8(0xd0),'risk':a203_0x4c47b8(0xfa),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x3336d7=>configureWorkspace(_0x3336d7,a203_0x4c47b8(0xc7))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a204_0x3b6f(_0x30c4f5,_0xb0f2db){_0x30c4f5=_0x30c4f5-0x13c;const _0x530bbc=a204_0x530b();let _0x3b6f76=_0x530bbc[_0x30c4f5];return _0x3b6f76;}const a204_0x5599e4=a204_0x3b6f;function a204_0x530b(){const _0x417db6=['Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','355336dolKTL','1347430qHIcxF','6DAeqyV','81EsAgvL','11qIZtNK','14186VHmyVI','2916130bhElTl','46wxQOWG','1515997CSfjoq','workspace\x20remove','remove','App\x20profile\x20name\x20to\x20remove','564248ETPzlw','897264UUnjtq','3xqCSEp'];a204_0x530b=function(){return _0x417db6;};return a204_0x530b();}(function(_0x2c056b,_0x20de3c){const _0xce8231=a204_0x3b6f,_0x30c5f4=_0x2c056b();while(!![]){try{const _0x46664c=-parseInt(_0xce8231(0x140))/0x1*(parseInt(_0xce8231(0x142))/0x2)+-parseInt(_0xce8231(0x149))/0x3*(parseInt(_0xce8231(0x14b))/0x4)+parseInt(_0xce8231(0x13c))/0x5+-parseInt(_0xce8231(0x13d))/0x6*(-parseInt(_0xce8231(0x143))/0x7)+parseInt(_0xce8231(0x147))/0x8*(parseInt(_0xce8231(0x13e))/0x9)+-parseInt(_0xce8231(0x141))/0xa*(parseInt(_0xce8231(0x13f))/0xb)+-parseInt(_0xce8231(0x148))/0xc;if(_0x46664c===_0x20de3c)break;else _0x30c5f4['push'](_0x30c5f4['shift']());}catch(_0x1006a7){_0x30c5f4['push'](_0x30c5f4['shift']());}}}(a204_0x530b,0x52d8b));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':'workspace','command':a204_0x5599e4(0x145),'description':a204_0x5599e4(0x14a),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a204_0x5599e4(0x146),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x42f167=>validateAppName(_0x42f167,'workspace\x20remove'),'execute':_0x51b44f=>runAppRemove(_0x51b44f,a204_0x5599e4(0x144))};
|