@lovrabet/rabetbase-cli 2.5.9-beta.1 → 2.5.10-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.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/detail.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/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.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/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -2
- package/skills/rabetbase/SKILL.md +2 -2
- package/skills/rabetbase-dataset-generation/SKILL.md +2 -2
- package/skills/rabetbase-page-generation/SKILL.md +2 -2
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x453089=a248_0x23e5;(function(_0x2ca567,_0xa856f7){const _0x20e079=a248_0x23e5,_0x44caa2=_0x2ca567();while(!![]){try{const _0x354c62=parseInt(_0x20e079(0x1f3))/0x1+parseInt(_0x20e079(0x214))/0x2*(parseInt(_0x20e079(0x20f))/0x3)+-parseInt(_0x20e079(0x213))/0x4+parseInt(_0x20e079(0x20c))/0x5+-parseInt(_0x20e079(0x202))/0x6+-parseInt(_0x20e079(0x1fb))/0x7*(-parseInt(_0x20e079(0x212))/0x8)+-parseInt(_0x20e079(0x1f6))/0x9;if(_0x354c62===_0xa856f7)break;else _0x44caa2['push'](_0x44caa2['shift']());}catch(_0x50df58){_0x44caa2['push'](_0x44caa2['shift']());}}}(a248_0x501f,0xae540));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a248_0x453089(0x210),'command':a248_0x453089(0x1fc),'description':a248_0x453089(0x215),'risk':a248_0x453089(0x1fd),'flags':[SQLCODE_FLAG],async 'validate'(_0x31f9e5){const _0x20d3e6=a248_0x453089,_0xab502a=loadSqlProjectConfig(_0x31f9e5[_0x20d3e6(0x203)]),_0x4b8236=await readSqlLockFile(_0xab502a['lockFilePath']);if(!_0x4b8236)throw CliErrors['validation'](_0x20d3e6(0x20a));},async 'dryRun'(_0x2b95bd){const _0x486e45=a248_0x453089,_0x51201f=loadSqlProjectConfig(_0x2b95bd[_0x486e45(0x203)]),_0x1bae10=await readSqlLockFile(_0x51201f[_0x486e45(0x1f2)]);if(!_0x1bae10)throw CliErrors['validation'](_0x486e45(0x20a));const {appLock:_0x4247af}=ensureSqlLockScope(_0x1bae10,_0x2b95bd[_0x486e45(0x203)],_0x51201f[_0x486e45(0x20d)],_0x486e45(0x1fc)),_0x30a640=_0x2b95bd['str'](_0x486e45(0x20b)),_0x9195ee=_0x4247af[_0x486e45(0x1f5)][_0x30a640];if(!_0x9195ee)throw CliErrors[_0x486e45(0x1f1)](_0x486e45(0x206)+_0x30a640+'\x22.');return{'method':_0x486e45(0x1f9),'url':_0x486e45(0x201),'body':{'sqlCode':_0x30a640,'id':_0x9195ee[_0x486e45(0x207)],'localPath':resolveLocalSqlFilePath(_0x51201f,_0x30a640,_0x9195ee)},'description':_0x486e45(0x211)+_0x30a640+_0x486e45(0x1f7)+_0x51201f[_0x486e45(0x1f0)]};},async 'execute'(_0x3205f2){const _0x3b9d2=a248_0x453089,_0x23d1bc=loadSqlProjectConfig(_0x3205f2[_0x3b9d2(0x203)]),_0x4e28d0=await readSqlLockFile(_0x23d1bc['lockFilePath']);if(!_0x4e28d0)throw CliErrors[_0x3b9d2(0x1f1)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x4052d5,appLock:_0x14adeb}=ensureSqlLockScope(_0x4e28d0,_0x3205f2[_0x3b9d2(0x203)],_0x23d1bc[_0x3b9d2(0x20d)],_0x3b9d2(0x1fc)),_0x3fceda=_0x3205f2[_0x3b9d2(0x209)]('sqlcode'),_0x1d5021=_0x14adeb[_0x3b9d2(0x1f5)][_0x3fceda];if(!_0x1d5021)throw CliErrors[_0x3b9d2(0x1f1)](_0x3b9d2(0x206)+_0x3fceda+'\x22.');await deleteSqlQuery({'id':_0x1d5021[_0x3b9d2(0x207)],'sqlCode':_0x3fceda}),_0x14adeb['sqls']=Object[_0x3b9d2(0x204)](Object[_0x3b9d2(0x20e)](_0x14adeb[_0x3b9d2(0x1f5)])['filter'](([_0x2261a0])=>_0x2261a0!==_0x3fceda)),_0x14adeb['lastSync']=new Date()[_0x3b9d2(0x1f8)](),await writeSqlLockFile(_0x23d1bc['lockFilePath'],_0x4052d5);const _0x540f76=resolveLocalSqlFilePath(_0x23d1bc,_0x3fceda,_0x1d5021);let _0x2e508d;await fileExists(_0x540f76)&&(_0x2e508d=await moveToTrash(_0x23d1bc[_0x3b9d2(0x208)],_0x23d1bc[_0x3b9d2(0x1f0)],_0x540f76),await cleanupEmptyDirectories(dirname(_0x540f76),_0x23d1bc[_0x3b9d2(0x1fa)]));const _0x3ebd15={'deleted':_0x3fceda,'remoteId':_0x1d5021[_0x3b9d2(0x207)]};if(_0x2e508d)_0x3ebd15[_0x3b9d2(0x205)]=_0x2e508d;return{'ok':!![],'data':_0x3ebd15,'message':_0x3b9d2(0x1f4)+_0x3fceda+(_0x2e508d?_0x3b9d2(0x1fe):'')};}};async function moveToTrash(_0x16b2e4,_0x45644d,_0x14b67e){const _0x26404e=a248_0x453089,_0x292bf5=new Date()[_0x26404e(0x1f8)]()['replace'](/[:.]/g,'-'),_0x8fc9a5=relative(_0x16b2e4,_0x14b67e),_0x20f6ba=join(_0x45644d,_0x292bf5,_0x8fc9a5);return await mkdir(dirname(_0x20f6ba),{'recursive':!![]}),await rename(_0x14b67e,_0x20f6ba),_0x20f6ba;}function a248_0x501f(){const _0x2cdfa5=['45AuSifh','sql','Would\x20delete\x20SQL\x20','56WMxHzD','2222128XIKnAi','75158iYYYNR','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','trashDir','validation','lockFilePath','590436ypdopr','Deleted\x20','sqls','8883cQtWPy','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','toISOString','POST','sqlRootDir','656187dLHWFl','delete','high-risk-write','\x20(local\x20file\x20moved\x20to\x20trash)','startsWith','length','/smartapi/custom/deleteUserCustomSql','4744842OSXmHD','appCode','fromEntries','trashedTo','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','remoteId','projectRoot','str','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sqlcode','1255330xmyLpp','sqlRoot','entries'];a248_0x501f=function(){return _0x2cdfa5;};return a248_0x501f();}function a248_0x23e5(_0x4cf396,_0x3f5240){_0x4cf396=_0x4cf396-0x1f0;const _0x501f91=a248_0x501f();let _0x23e5cc=_0x501f91[_0x4cf396];return _0x23e5cc;}async function cleanupEmptyDirectories(_0x128879,_0x20ef39){const _0x523a30=a248_0x453089;let _0x5632cb=resolve(_0x128879);const _0x254bd5=resolve(_0x20ef39);while(_0x5632cb[_0x523a30(0x1ff)](''+_0x254bd5+sep)||_0x5632cb===_0x254bd5){if(_0x5632cb===_0x254bd5)return;try{const _0x31a5e1=await readdir(_0x5632cb);if(_0x31a5e1[_0x523a30(0x200)]>0x0)return;await rmdir(_0x5632cb);}catch{return;}_0x5632cb=dirname(_0x5632cb);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a249_0x147fba=a249_0x5372;(function(_0xdf4f1a,_0xc5de9a){const _0x2beb22=a249_0x5372,_0x62b747=_0xdf4f1a();while(!![]){try{const _0x5c5e95=parseInt(_0x2beb22(0x1d3))/0x1+-parseInt(_0x2beb22(0x1cf))/0x2*(-parseInt(_0x2beb22(0x1c6))/0x3)+parseInt(_0x2beb22(0x1c8))/0x4+parseInt(_0x2beb22(0x1c5))/0x5*(-parseInt(_0x2beb22(0x1d4))/0x6)+-parseInt(_0x2beb22(0x1c7))/0x7*(-parseInt(_0x2beb22(0x1ca))/0x8)+parseInt(_0x2beb22(0x1bf))/0x9+-parseInt(_0x2beb22(0x1ce))/0xa;if(_0x5c5e95===_0xc5de9a)break;else _0x62b747['push'](_0x62b747['shift']());}catch(_0x158efe){_0x62b747['push'](_0x62b747['shift']());}}}(a249_0x4bbc,0x49824));function a249_0x5372(_0x5d8242,_0xc5c2ac){_0x5d8242=_0x5d8242-0x1bf;const _0x4bbc87=a249_0x4bbc();let _0x537246=_0x4bbc87[_0x5d8242];return _0x537246;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a249_0x4bbc(){const _0x57c7fe=['sql','sqlName','sqlContent','sqlCode','detail','1147015cEBGoK','75SmXcFQ','7hmBtms','222124ldNboD','appCode','3041928YDzFYd','bool','read','str','7531110kzHiUi','17134KdSRDb','sqlcode','verbose','description','65285fEgtAe','6BLJRAK','boolean','dbId','5115366rRvbuX'];a249_0x4bbc=function(){return _0x57c7fe;};return a249_0x4bbc();}export const sqlDetail={'service':a249_0x147fba(0x1c0),'command':a249_0x147fba(0x1c4),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a249_0x147fba(0x1cc),'flags':[SQLCODE_FLAG,{'name':a249_0x147fba(0x1d1),'type':a249_0x147fba(0x1d5),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x93d944){const _0x2fc654=a249_0x147fba,_0x3e7120=await getSqlQueryInfo(_0x93d944[_0x2fc654(0x1c9)],_0x93d944[_0x2fc654(0x1cd)](_0x2fc654(0x1d0))),_0x4f4697=_0x93d944[_0x2fc654(0x1cb)](_0x2fc654(0x1d1));if(_0x4f4697)return{'ok':!![],'data':_0x3e7120};const _0x43da0d=_0x3e7120[_0x2fc654(0x1d6)]?await getDbName(_0x93d944[_0x2fc654(0x1c9)],_0x3e7120[_0x2fc654(0x1d6)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3e7120[_0x2fc654(0x1c3)],'sqlName':_0x3e7120[_0x2fc654(0x1c1)],'db':_0x43da0d?_0x43da0d+'\x20('+_0x3e7120['dbId']+')':_0x3e7120[_0x2fc654(0x1d6)]??'','description':_0x3e7120[_0x2fc654(0x1d2)]??'','sqlContent':_0x3e7120[_0x2fc654(0x1c2)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x520c06=a250_0x4b04;(function(_0x20cb0b,_0xb42489){const _0x2ab08c=a250_0x4b04,_0x3dfba6=_0x20cb0b();while(!![]){try{const _0x3ee031=-parseInt(_0x2ab08c(0x168))/0x1+-parseInt(_0x2ab08c(0x16b))/0x2*(-parseInt(_0x2ab08c(0x15f))/0x3)+parseInt(_0x2ab08c(0x16a))/0x4+parseInt(_0x2ab08c(0x161))/0x5+parseInt(_0x2ab08c(0x16c))/0x6+-parseInt(_0x2ab08c(0x170))/0x7+parseInt(_0x2ab08c(0x166))/0x8*(-parseInt(_0x2ab08c(0x162))/0x9);if(_0x3ee031===_0xb42489)break;else _0x3dfba6['push'](_0x3dfba6['shift']());}catch(_0x97f8e4){_0x3dfba6['push'](_0x3dfba6['shift']());}}}(a250_0x4041,0x5e931));function a250_0x4b04(_0x27e93f,_0x545fed){_0x27e93f=_0x27e93f-0x15b;const _0x40414d=a250_0x4041();let _0x4b0475=_0x40414d[_0x27e93f];return _0x4b0475;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a250_0x4041(){const _0x592c72=['str','read','SQL\x20execution\x20failed','8hyHyCU','\x20row(s)\x20in\x20','724813HoFpQh','execSuccess','1786400Hcgiiu','1536UAKGVa','4485450xzxwHw','appCode','isArray','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','1326213Ftssls','params','sqlcode','execError','sql','exec','execResult','length','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','Returned\x20','2115YZxaPR','string','2689630rqoyZa','8747028xJnrlX'];a250_0x4041=function(){return _0x592c72;};return a250_0x4041();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a250_0x520c06(0x174),'command':a250_0x520c06(0x175),'description':a250_0x520c06(0x16f),'risk':a250_0x520c06(0x164),'flags':[SQLCODE_FLAG,{'name':a250_0x520c06(0x171),'type':a250_0x520c06(0x160),'description':a250_0x520c06(0x15d)}],async 'execute'(_0x3b6e5b){const _0x250990=a250_0x520c06,_0x59147d=parseJsonParams(_0x3b6e5b[_0x250990(0x163)](_0x250990(0x171))),_0x40ec2b=Date['now'](),_0x51aad6=await executeSql(_0x3b6e5b[_0x250990(0x16d)],_0x3b6e5b[_0x250990(0x163)](_0x250990(0x172)),_0x59147d),_0x57e32a=Date['now']()-_0x40ec2b,_0x467ca4=_0x51aad6?.[_0x250990(0x15b)]??_0x51aad6,_0x5a1bb1=_0x51aad6?.[_0x250990(0x169)]??!![];if(!_0x5a1bb1)return{'ok':![],'data':{'error':_0x51aad6?.[_0x250990(0x173)]||_0x250990(0x165),'elapsed':_0x57e32a},'message':_0x250990(0x165)};const _0x204bec=Array[_0x250990(0x16e)](_0x467ca4)?_0x467ca4:[];return{'ok':!![],'data':{'rows':_0x204bec,'rowCount':_0x204bec[_0x250990(0x15c)],'elapsed':_0x57e32a},'message':_0x250990(0x15e)+_0x204bec['length']+_0x250990(0x167)+_0x57e32a+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4e29eb,_0x3478f4){const _0x272035=a251_0x46a3,_0x1a4f36=_0x4e29eb();while(!![]){try{const _0x1aaffd=-parseInt(_0x272035(0x130))/0x1*(parseInt(_0x272035(0x12d))/0x2)+-parseInt(_0x272035(0x12a))/0x3*(-parseInt(_0x272035(0x12e))/0x4)+parseInt(_0x272035(0x133))/0x5+-parseInt(_0x272035(0x12f))/0x6+-parseInt(_0x272035(0x12c))/0x7*(-parseInt(_0x272035(0x12b))/0x8)+-parseInt(_0x272035(0x131))/0x9+parseInt(_0x272035(0x132))/0xa*(parseInt(_0x272035(0x129))/0xb);if(_0x1aaffd===_0x3478f4)break;else _0x1a4f36['push'](_0x1a4f36['shift']());}catch(_0x47fbba){_0x1a4f36['push'](_0x1a4f36['shift']());}}}(a251_0x4548,0x8a89a));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a251_0x46a3(_0x55d908,_0x1deda8){_0x55d908=_0x55d908-0x129;const _0x454857=a251_0x4548();let _0x46a332=_0x454857[_0x55d908];return _0x46a332;}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a251_0x4548(){const _0x28d69f=['4232096IHjxRM','7KnUQQg','646AWthpS','159868sdHLnz','5122536suJwCw','659gqEPTz','2263482ZRNVAl','1850dLnCEC','259330weHNSJ','56188RdTTST','27lOZKqJ'];a251_0x4548=function(){return _0x28d69f;};return a251_0x4548();}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a252_0x12542c=a252_0xc4aa;(function(_0x5cdb8f,_0x1ec0c6){const _0x53d36b=a252_0xc4aa,_0x27d7e7=_0x5cdb8f();while(!![]){try{const _0x415765=-parseInt(_0x53d36b(0x1e4))/0x1+parseInt(_0x53d36b(0x1e6))/0x2+-parseInt(_0x53d36b(0x1fc))/0x3+parseInt(_0x53d36b(0x203))/0x4+parseInt(_0x53d36b(0x1e7))/0x5*(parseInt(_0x53d36b(0x1f0))/0x6)+-parseInt(_0x53d36b(0x1e2))/0x7+-parseInt(_0x53d36b(0x1f1))/0x8;if(_0x415765===_0x1ec0c6)break;else _0x27d7e7['push'](_0x27d7e7['shift']());}catch(_0x324b51){_0x27d7e7['push'](_0x27d7e7['shift']());}}}(a252_0x4caf,0x7df55));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a252_0xc4aa(_0xf942aa,_0x23c87d){_0xf942aa=_0xf942aa-0x1e2;const _0x4caf24=a252_0x4caf();let _0xc4aaf7=_0x4caf24[_0xf942aa];return _0xc4aaf7;}function a252_0x4caf(){const _0x47d013=['boolean','810894QuUvKQ','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','sqlName','page','num','length','verbose','2516040xAWclX','dbId','pagesize','5096371OgAAWh','\x20SQL\x20queries\x20(total:\x20','160105IzMiSF','No\x20custom\x20SQL\x20queries\x20found.','997614uxOykr','4393435lrXaLe','tableData','map','name','Page\x20size','Filter\x20by\x20SQL\x20name','sql','number','Found\x20','6ujZUxM','2656984dzIGwM','string','bool','paging','appCode','Page\x20number','totalCount','str','sqlCode','all'];a252_0x4caf=function(){return _0x47d013;};return a252_0x4caf();}export const sqlList={'service':a252_0x12542c(0x1ed),'command':'list','description':'List\x20custom\x20SQL\x20queries','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x12542c(0x1ea),'type':a252_0x12542c(0x1f2),'description':a252_0x12542c(0x1ec)},{'name':a252_0x12542c(0x1ff),'type':a252_0x12542c(0x1ee),'description':a252_0x12542c(0x1f6),'default':0x1},{'name':a252_0x12542c(0x205),'type':'number','description':a252_0x12542c(0x1eb)},{'name':a252_0x12542c(0x202),'type':a252_0x12542c(0x1fb),'description':a252_0x12542c(0x1fd)}],async 'execute'(_0x234c84){const _0x29b410=a252_0x12542c,_0x1b6062=await listSqlQueries(_0x234c84['appCode'],{'sqlCode':_0x234c84[_0x29b410(0x1f8)]('sqlcode')||undefined,'sqlName':_0x234c84[_0x29b410(0x1f8)](_0x29b410(0x1ea))||undefined,'currentPage':_0x234c84[_0x29b410(0x200)]('page'),'pageSize':_0x234c84[_0x29b410(0x200)](_0x29b410(0x205),0x32)}),_0x2b5f1e=_0x234c84[_0x29b410(0x1f3)]('verbose'),_0x3de467=_0x1b6062[_0x29b410(0x1e8)]??[],_0xa0cc60=_0x1b6062[_0x29b410(0x1f4)]?.[_0x29b410(0x1f7)]??_0x3de467['length'];let _0x417026;return _0x2b5f1e?_0x417026=_0x3de467:_0x417026=await Promise[_0x29b410(0x1fa)](_0x3de467[_0x29b410(0x1e9)](async _0x37d9ae=>{const _0x42c3e5=_0x29b410;let _0x5bb166;try{_0x5bb166=_0x37d9ae[_0x42c3e5(0x204)]?await getDbName(_0x234c84[_0x42c3e5(0x1f5)],_0x37d9ae[_0x42c3e5(0x204)]):undefined;}catch{}return{'sqlCode':_0x37d9ae[_0x42c3e5(0x1f9)],'sqlName':_0x37d9ae[_0x42c3e5(0x1fe)],'description':_0x37d9ae['description']??'','db':_0x5bb166?_0x5bb166+'\x20('+_0x37d9ae[_0x42c3e5(0x204)]+')':_0x37d9ae[_0x42c3e5(0x204)]??''};})),{'ok':!![],'data':_0x417026,'message':_0x3de467[_0x29b410(0x201)]===0x0?_0x29b410(0x1e5):_0x29b410(0x1ef)+_0x3de467[_0x29b410(0x201)]+_0x29b410(0x1e3)+_0xa0cc60+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a253_0x4ba897=a253_0x7b79;(function(_0x2f5d24,_0x2064d7){const _0x29b744=a253_0x7b79,_0x34c6aa=_0x2f5d24();while(!![]){try{const _0x578cce=-parseInt(_0x29b744(0x181))/0x1+parseInt(_0x29b744(0x186))/0x2*(parseInt(_0x29b744(0x158))/0x3)+parseInt(_0x29b744(0x168))/0x4+-parseInt(_0x29b744(0x154))/0x5+parseInt(_0x29b744(0x146))/0x6*(-parseInt(_0x29b744(0x182))/0x7)+parseInt(_0x29b744(0x157))/0x8*(-parseInt(_0x29b744(0x18f))/0x9)+parseInt(_0x29b744(0x14d))/0xa*(parseInt(_0x29b744(0x14e))/0xb);if(_0x578cce===_0x2064d7)break;else _0x34c6aa['push'](_0x34c6aa['shift']());}catch(_0x10a009){_0x34c6aa['push'](_0x34c6aa['shift']());}}}(a253_0x10da,0xaca30));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';function a253_0x10da(){const _0x3cc881=['toISOString','isCanonical','boolean','Would\x20pull\x20','110kLBcHr','3744323UDOptG','conflict','sqlRoot','split','Filter\x20by\x20SQL\x20display\x20name','appCode','5825305rEjXew','would_pull','paging','8pcdBsZ','3PJiSRd','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlcode','name','all','lockFilePath','string','pull','str','tableData','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','utf8','description','sqlCode','dbId','toLowerCase','1965300hPyCnB','No\x20remote\x20SQL\x20queries\x20matched.','path','catch','\x20failed','push','unchanged','file','content','\x20SQL\x20file(s)\x20into\x20','sqlRootDir','sqlName','sqls','Pull\x20complete:\x20','length','find','force','.xml','mode','some','replace','hash','cancelled','filter','endsWith','852475WuIOCU','7xmcqtj','message','sql','local\x20differs\x20from\x20remote','875314TZgfZn','POST','apps','mybatisXml','\x20skipped,\x20','Force\x20overwrite\x20local\x20unsynced\x20changes','test','filePath','lastSync','7478838HsfFUQ','equivalent','6706002gwHZXK','join','map'];a253_0x10da=function(){return _0x3cc881;};return a253_0x10da();}import{detectSqlMode}from'../../core/sql-sync/utils.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(_0x54b3ed,_0x99a053){const _0x193b7d=a253_0x7b79,_0x1c6808=[];let _0x55c76a=0x1;while(!![]){const _0x244695=await listSqlQueries(_0x54b3ed,{'currentPage':_0x55c76a,'pageSize':PAGE_SIZE,'sqlCode':_0x99a053[_0x193b7d(0x165)],'sqlName':_0x99a053[_0x193b7d(0x173)]}),_0x41dab4=_0x244695[_0x193b7d(0x161)]??[];_0x1c6808[_0x193b7d(0x16d)](..._0x41dab4);if(_0x41dab4[_0x193b7d(0x176)]===0x0)break;const _0x237bc1=_0x244695[_0x193b7d(0x156)]?.['totalCount'];if(_0x237bc1!=null?_0x1c6808['length']>=_0x237bc1:_0x41dab4[_0x193b7d(0x176)]<PAGE_SIZE)break;_0x55c76a++;}return _0x1c6808;}async function ensureSqlContent(_0x261d22){const _0x20fc58=a253_0x7b79;if(_0x261d22['sqlContent']!=null&&String(_0x261d22['sqlContent'])['length']>0x0)return _0x261d22;return getSqlQueryDetail(_0x261d22[_0x20fc58(0x165)]);}export const sqlPull={'service':a253_0x4ba897(0x184),'command':a253_0x4ba897(0x15f),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x4ba897(0x15b),'type':a253_0x4ba897(0x15e),'description':a253_0x4ba897(0x152)},{'name':a253_0x4ba897(0x178),'type':a253_0x4ba897(0x14b),'description':a253_0x4ba897(0x18b)}],async 'dryRun'(_0x8c9457){const _0x1a8eb1=a253_0x4ba897,_0x59f4bf=loadSqlProjectConfig(_0x8c9457[_0x1a8eb1(0x153)]),_0x30e7f5=await readSqlLockFile(_0x59f4bf[_0x1a8eb1(0x15d)]),{appLock:_0x1993cd}=ensureSqlLockScope(_0x30e7f5??createEmptySqlLock(),_0x59f4bf[_0x1a8eb1(0x153)],_0x59f4bf[_0x1a8eb1(0x150)],_0x1a8eb1(0x15f)),_0xc7f25f=await fetchAllSqlQueries(_0x8c9457['appCode'],{'sqlCode':_0x8c9457['str'](_0x1a8eb1(0x15a))||undefined,'sqlName':_0x8c9457['str']('name')||undefined}),_0x23e48a=[];for(const _0x33b40a of _0xc7f25f){const _0x49e91f=await ensureSqlContent(_0x33b40a),_0xef3c23=ensureRemoteSqlContent(_0x49e91f),_0x4b601d=detectSqlMode(_0xef3c23),_0x1424b0=_0x49e91f[_0x1a8eb1(0x166)]?await getDbName(_0x8c9457[_0x1a8eb1(0x153)],Number(_0x49e91f['dbId']))['catch'](()=>undefined):undefined,_0x4acc73=buildLocalSqlFileContent({'sqlCode':_0x49e91f[_0x1a8eb1(0x165)],'sqlName':_0x49e91f[_0x1a8eb1(0x173)],'dbId':_0x49e91f['dbId']},_0xef3c23,{'dbName':_0x1424b0,'mode':_0x4b601d,'syncedAt':new Date()[_0x1a8eb1(0x149)](),'description':_0x49e91f['description']}),_0x1987da=buildSqlLockEntry(_0x49e91f,_0xef3c23,'',{'dbName':_0x1424b0}),_0x22faf=resolveLocalSqlFilePath(_0x59f4bf,_0x49e91f[_0x1a8eb1(0x165)],_0x1987da);let _0xf44d4a=_0x1a8eb1(0x155),_0x5d2c20;const _0x1294d1=await findExistingSqlFiles(_0x59f4bf,_0x22faf,_0x4b601d,_0x1993cd[_0x1a8eb1(0x174)][_0x49e91f[_0x1a8eb1(0x165)]]);if(_0x1294d1[_0x1a8eb1(0x176)]>0x0){const _0x38c33a=await compareExistingSqlFiles(_0x1294d1,_0x4acc73,_0x4b601d);if(_0x38c33a[_0x1a8eb1(0x17b)](({equivalent:_0x58e4cd})=>!_0x58e4cd))_0xf44d4a=_0x1a8eb1(0x14f),_0x5d2c20='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x38c33a[_0x1a8eb1(0x176)]===0x1&&_0x38c33a[0x0]?.[_0x1a8eb1(0x16f)][_0x1a8eb1(0x14a)]&&(_0xf44d4a='skipped',_0x5d2c20='unchanged');}_0x23e48a[_0x1a8eb1(0x16d)]({'sqlCode':_0x49e91f['sqlCode'],'sqlName':_0x49e91f[_0x1a8eb1(0x173)],'filePath':_0x22faf,'status':_0xf44d4a,'reason':_0x5d2c20});}return{'method':_0x1a8eb1(0x187),'url':_0x1a8eb1(0x159),'body':{'appCode':_0x8c9457[_0x1a8eb1(0x153)],'sqlCode':_0x8c9457[_0x1a8eb1(0x160)](_0x1a8eb1(0x15a))||null,'sqlName':_0x8c9457['str'](_0x1a8eb1(0x15b))||null,'files':_0x23e48a},'description':_0x1a8eb1(0x14c)+_0x23e48a['length']+_0x1a8eb1(0x171)+_0x59f4bf[_0x1a8eb1(0x172)]};},async 'execute'(_0x5d7b6e){const _0x4101cc=a253_0x4ba897,_0x44c33c=loadSqlProjectConfig(_0x5d7b6e[_0x4101cc(0x153)]),_0x2a7195=await readSqlLockFile(_0x44c33c[_0x4101cc(0x15d)]),{lockData:_0x2b29f7,appLock:_0x18460d}=ensureSqlLockScope(_0x2a7195??createEmptySqlLock(),_0x44c33c['appCode'],_0x44c33c['sqlRoot'],_0x4101cc(0x15f)),_0x4335eb=_0x5d7b6e['bool'](_0x4101cc(0x178)),_0x41d388=await fetchAllSqlQueries(_0x5d7b6e[_0x4101cc(0x153)],{'sqlCode':_0x5d7b6e[_0x4101cc(0x160)]('sqlcode')||undefined,'sqlName':_0x5d7b6e['str'](_0x4101cc(0x15b))||undefined});if(_0x41d388['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4101cc(0x169)};const _0x33cfe4=[],_0x1d6964=[];for(const _0x303b4d of _0x41d388){try{_0x33cfe4[_0x4101cc(0x16d)](await ensureSqlContent(_0x303b4d));}catch(_0x568ad6){_0x1d6964[_0x4101cc(0x16d)]({'sqlCode':_0x303b4d[_0x4101cc(0x165)],'error':_0x568ad6 instanceof Error?_0x568ad6[_0x4101cc(0x183)]:String(_0x568ad6)});}}if(_0x4335eb&&!_0x5d7b6e['nonInteractive']){let _0x515976=![];for(const _0x655c7a of _0x33cfe4){const _0x2f5e2c=detectSqlMode(ensureRemoteSqlContent(_0x655c7a)),_0x287477=_0x655c7a['dbId']?await getDbName(_0x5d7b6e[_0x4101cc(0x153)],Number(_0x655c7a['dbId']))[_0x4101cc(0x16b)](()=>undefined):undefined,_0xd4da50=buildLocalSqlFileContent({'sqlCode':_0x655c7a[_0x4101cc(0x165)],'sqlName':_0x655c7a[_0x4101cc(0x173)],'dbId':_0x655c7a['dbId']},ensureRemoteSqlContent(_0x655c7a),{'dbName':_0x287477,'mode':_0x2f5e2c,'syncedAt':new Date()['toISOString'](),'description':_0x655c7a[_0x4101cc(0x164)]}),_0x18c59c=resolveLocalSqlFilePath(_0x44c33c,_0x655c7a[_0x4101cc(0x165)],buildSqlLockEntry(_0x655c7a,ensureRemoteSqlContent(_0x655c7a),'',{'dbName':_0x287477})),_0x21f9f0=await findExistingSqlFiles(_0x44c33c,_0x18c59c,_0x2f5e2c,_0x18460d[_0x4101cc(0x174)][_0x655c7a[_0x4101cc(0x165)]]),_0x5cad1a=await compareExistingSqlFiles(_0x21f9f0,_0xd4da50,_0x2f5e2c);if(_0x5cad1a[_0x4101cc(0x17b)](({equivalent:_0x2bf51f})=>!_0x2bf51f)){_0x515976=!![];break;}}if(_0x515976){const _0x1dacc6=await confirmForceOverwrite(_0x4101cc(0x162));if(!_0x1dacc6)throw CliErrors[_0x4101cc(0x17e)]('Force\x20pull\x20cancelled.');}}const _0x176b1f=cloneSqlLockData(_0x2b29f7),_0x3dac7e=_0x176b1f[_0x4101cc(0x188)][_0x44c33c[_0x4101cc(0x153)]],_0xe18ca7=[],_0x2aeb02=[];for(const _0x250637 of _0x33cfe4){const _0x5b2698=_0x3dac7e[_0x4101cc(0x174)][_0x250637['sqlCode']],_0x5d07db=ensureRemoteSqlContent(_0x250637),_0x15de9b=detectSqlMode(_0x5d07db),_0x88f90f=_0x250637['dbId']?await getDbName(_0x5d7b6e[_0x4101cc(0x153)],Number(_0x250637[_0x4101cc(0x166)]))[_0x4101cc(0x16b)](()=>undefined):undefined,_0x2da80e=buildLocalSqlFileContent({'sqlCode':_0x250637[_0x4101cc(0x165)],'sqlName':_0x250637[_0x4101cc(0x173)],'dbId':_0x250637[_0x4101cc(0x166)]},_0x5d07db,{'dbName':_0x88f90f,'mode':_0x15de9b,'syncedAt':new Date()[_0x4101cc(0x149)](),'description':_0x250637['description']}),_0x15f8ff=buildSqlLockEntry(_0x250637,_0x5d07db,computeSqlContentHash(_0x2da80e),{'dbName':_0x88f90f}),_0x4e540d=_0x15f8ff[_0x4101cc(0x16a)],_0x27bab2=join(_0x44c33c[_0x4101cc(0x172)],_0x4e540d);try{const _0x4f17d7=await findExistingSqlFiles(_0x44c33c,_0x27bab2,_0x15de9b,_0x5b2698),_0x1c66c7=await compareExistingSqlFiles(_0x4f17d7,_0x2da80e,_0x15de9b);if(!_0x4335eb&&_0x1c66c7[_0x4101cc(0x17b)](({equivalent:_0x21ef78})=>!_0x21ef78)){_0x2aeb02[_0x4101cc(0x16d)]({'sqlCode':_0x250637[_0x4101cc(0x165)],'reason':_0x4101cc(0x185)});continue;}const _0x182b9c=_0x1c66c7[_0x4101cc(0x177)](({file:_0x4ec3d4})=>_0x4ec3d4[_0x4101cc(0x14a)]),_0x29f4ac=_0x1c66c7['find'](({file:_0x3714bc})=>!_0x3714bc['isCanonical']);if(_0x182b9c?.[_0x4101cc(0x190)]&&!_0x29f4ac){_0x2aeb02['push']({'sqlCode':_0x250637['sqlCode'],'reason':_0x4101cc(0x16e)}),_0x3dac7e[_0x4101cc(0x174)][_0x250637[_0x4101cc(0x165)]]={..._0x15f8ff,'hash':computeSqlContentHash(_0x182b9c[_0x4101cc(0x170)]),'path':_0x4e540d};continue;}!_0x182b9c?.['equivalent']&&(await ensureParentDirectory(_0x27bab2),await writeFile(_0x27bab2,_0x2da80e,'utf8')),_0x29f4ac&&await rm(_0x29f4ac['file'][_0x4101cc(0x18d)],{'force':!![]}),_0x3dac7e[_0x4101cc(0x174)][_0x250637[_0x4101cc(0x165)]]={..._0x15f8ff,'hash':_0x182b9c?.[_0x4101cc(0x190)]?computeSqlContentHash(_0x182b9c[_0x4101cc(0x170)]):_0x15f8ff[_0x4101cc(0x17d)],'path':_0x4e540d},_0xe18ca7['push']({'sqlCode':_0x250637[_0x4101cc(0x165)],'filePath':_0x27bab2});}catch(_0x29155d){_0x1d6964['push']({'sqlCode':_0x250637[_0x4101cc(0x165)],'error':_0x29155d instanceof Error?_0x29155d[_0x4101cc(0x183)]:String(_0x29155d)});}}return _0x3dac7e[_0x4101cc(0x18e)]=new Date()[_0x4101cc(0x149)](),await writeSqlLockFile(_0x44c33c['lockFilePath'],_0x176b1f),{'ok':_0x1d6964[_0x4101cc(0x176)]===0x0,'data':{'pulled':_0xe18ca7,'skipped':_0x2aeb02,'failed':_0x1d6964},'message':_0x4101cc(0x175)+_0xe18ca7[_0x4101cc(0x176)]+'\x20written,\x20'+_0x2aeb02['length']+_0x4101cc(0x18a)+_0x1d6964['length']+_0x4101cc(0x16c)};}};function isEquivalentPulledSqlFile(_0x5e92c9,_0x3735ca,_0x4ad565,_0x59162e){if(_0x4ad565!==_0x59162e)return normalizePulledSqlBody(_0x5e92c9,_0x4ad565)===normalizePulledSqlBody(_0x3735ca,_0x59162e);return normalizePullComparableContent(_0x5e92c9,_0x4ad565)===normalizePullComparableContent(_0x3735ca,_0x59162e);}async function findExistingSqlFiles(_0x497352,_0x334aa4,_0x1dc6a7,_0x1d32be){const _0x16bd4a=a253_0x4ba897,_0x790a6c=[];await fileExists(_0x334aa4)&&_0x790a6c[_0x16bd4a(0x16d)]({'filePath':_0x334aa4,'mode':_0x1dc6a7,'isCanonical':!![]});if(!_0x1d32be?.[_0x16bd4a(0x16a)])return _0x790a6c;const _0x42f877=join(_0x497352[_0x16bd4a(0x172)],_0x1d32be['path']);if(_0x42f877===_0x334aa4)return _0x790a6c;return await fileExists(_0x42f877)&&_0x790a6c[_0x16bd4a(0x16d)]({'filePath':_0x42f877,'mode':_0x1d32be[_0x16bd4a(0x17a)]??modeFromFilePath(_0x42f877),'isCanonical':![]}),_0x790a6c;}async function compareExistingSqlFiles(_0x43fd75,_0xbe5013,_0x3a78a2){const _0x159f74=a253_0x4ba897;return Promise[_0x159f74(0x15c)](_0x43fd75[_0x159f74(0x148)](async _0xa4a1da=>{const _0x335da5=_0x159f74,_0x102b95=await readFile(_0xa4a1da['filePath'],_0x335da5(0x163));return{'file':_0xa4a1da,'content':_0x102b95,'equivalent':isEquivalentPulledSqlFile(_0x102b95,_0xbe5013,_0xa4a1da['mode'],_0x3a78a2)};}));}function a253_0x7b79(_0x302d0b,_0x294e6c){_0x302d0b=_0x302d0b-0x146;const _0x10da0c=a253_0x10da();let _0x7b7947=_0x10da0c[_0x302d0b];return _0x7b7947;}function modeFromFilePath(_0x361aeb){const _0x1a6371=a253_0x4ba897;return _0x361aeb[_0x1a6371(0x167)]()[_0x1a6371(0x180)](_0x1a6371(0x179))?'mybatisXml':'sql';}function normalizePulledSqlBody(_0x462227,_0x10e7d2){const _0x703b14=a253_0x4ba897;return stripLocalSqlMetadata(_0x462227,_0x10e7d2)[_0x703b14(0x17c)](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x169ea8,_0x343cdc){const _0x5695cd=a253_0x4ba897,_0x325470=_0x169ea8[_0x5695cd(0x17c)](/\r\n/g,'\x0a')[_0x5695cd(0x151)]('\x0a'),_0xfe5a08=_0x325470[_0x5695cd(0x17f)](_0x1f4c62=>!isSyncedAtMetadataLine(_0x1f4c62,_0x343cdc));return _0xfe5a08[_0x5695cd(0x147)]('\x0a');}function isSyncedAtMetadataLine(_0x13f0d2,_0x3193d9){const _0x820359=a253_0x4ba897;if(_0x3193d9===_0x820359(0x189))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x13f0d2);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x820359(0x18c)](_0x13f0d2);}
|
|
1
|
+
const a253_0x153a56=a253_0x3348;(function(_0x32fcbb,_0x110374){const _0x136105=a253_0x3348,_0x4105df=_0x32fcbb();while(!![]){try{const _0x29f68a=parseInt(_0x136105(0x187))/0x1+-parseInt(_0x136105(0x178))/0x2+-parseInt(_0x136105(0x180))/0x3*(parseInt(_0x136105(0x176))/0x4)+-parseInt(_0x136105(0x173))/0x5*(parseInt(_0x136105(0x15e))/0x6)+-parseInt(_0x136105(0x15c))/0x7+parseInt(_0x136105(0x19b))/0x8*(parseInt(_0x136105(0x162))/0x9)+parseInt(_0x136105(0x16d))/0xa;if(_0x29f68a===_0x110374)break;else _0x4105df['push'](_0x4105df['shift']());}catch(_0x7ff8a3){_0x4105df['push'](_0x4105df['shift']());}}}(a253_0x1d26,0x69f49));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';function a253_0x1d26(){const _0x1805bf=['mode','skipped','dbId','content','2180nWUEAk','.xml','all','9148GQZHZM','push','457474falEFr','\x20failed','totalCount','catch','pull','hash','nonInteractive','appCode','33XgutOX','mybatisXml','replace','toISOString','conflict','sqlRootDir','some','134071odwUOi','string','join','isCanonical','description','lockFilePath','\x20written,\x20','map','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','force','str','sqlName','find','sql','POST','filter','sqlContent','Would\x20pull\x20','utf8','sqls','32hLRnAp','No\x20remote\x20SQL\x20queries\x20matched.','read','endsWith','test','Force\x20pull\x20cancelled.','file','filePath','sqlCode','sqlcode','trim','name','3921484xerXwS','\x20SQL\x20file(s)\x20into\x20','3498wtZkcz','would_pull','length','toLowerCase','708759EPtxoZ','apps','sqlRoot','local\x20differs\x20from\x20remote','equivalent','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','\x20skipped,\x20','message','path','Filter\x20by\x20SQL\x20display\x20name','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','10532120JReylC','tableData'];a253_0x1d26=function(){return _0x1805bf;};return a253_0x1d26();}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{detectSqlMode}from'../../core/sql-sync/utils.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(_0x2125af,_0x268c9a){const _0x1f67d8=a253_0x3348,_0x195a39=[];let _0x236814=0x1;while(!![]){const _0x4c8d3a=await listSqlQueries(_0x2125af,{'currentPage':_0x236814,'pageSize':PAGE_SIZE,'sqlCode':_0x268c9a[_0x1f67d8(0x158)],'sqlName':_0x268c9a[_0x1f67d8(0x192)]}),_0x389414=_0x4c8d3a[_0x1f67d8(0x16e)]??[];_0x195a39[_0x1f67d8(0x177)](..._0x389414);if(_0x389414[_0x1f67d8(0x160)]===0x0)break;const _0x43d16c=_0x4c8d3a['paging']?.[_0x1f67d8(0x17a)];if(_0x43d16c!=null?_0x195a39[_0x1f67d8(0x160)]>=_0x43d16c:_0x389414[_0x1f67d8(0x160)]<PAGE_SIZE)break;_0x236814++;}return _0x195a39;}async function ensureSqlContent(_0x3de340){const _0x15542b=a253_0x3348;if(_0x3de340[_0x15542b(0x197)]!=null&&String(_0x3de340[_0x15542b(0x197)])[_0x15542b(0x160)]>0x0)return _0x3de340;return getSqlQueryDetail(_0x3de340['sqlCode']);}export const sqlPull={'service':a253_0x153a56(0x194),'command':a253_0x153a56(0x17c),'description':a253_0x153a56(0x167),'risk':a253_0x153a56(0x19d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x153a56(0x15b),'type':a253_0x153a56(0x188),'description':a253_0x153a56(0x16b)},{'name':a253_0x153a56(0x190),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x5136b8){const _0x439bce=a253_0x153a56,_0x23b611=loadSqlProjectConfig(_0x5136b8[_0x439bce(0x17f)]),_0x137ee5=await readSqlLockFile(_0x23b611[_0x439bce(0x18c)]),{appLock:_0x35b969}=ensureSqlLockScope(_0x137ee5??createEmptySqlLock(),_0x23b611[_0x439bce(0x17f)],_0x23b611[_0x439bce(0x164)],'pull'),_0x337253=await fetchAllSqlQueries(_0x5136b8[_0x439bce(0x17f)],{'sqlCode':_0x5136b8[_0x439bce(0x191)](_0x439bce(0x159))||undefined,'sqlName':_0x5136b8[_0x439bce(0x191)](_0x439bce(0x15b))||undefined}),_0x339fc8=[];for(const _0x1bb7d7 of _0x337253){const _0x1eaf0a=await ensureSqlContent(_0x1bb7d7),_0x2f4018=ensureRemoteSqlContent(_0x1eaf0a),_0x64d197=detectSqlMode(_0x2f4018),_0x39937a=_0x1eaf0a[_0x439bce(0x171)]?await getDbName(_0x5136b8[_0x439bce(0x17f)],Number(_0x1eaf0a[_0x439bce(0x171)]))[_0x439bce(0x17b)](()=>undefined):undefined,_0x23e6aa=buildLocalSqlFileContent({'sqlCode':_0x1eaf0a[_0x439bce(0x158)],'sqlName':_0x1eaf0a[_0x439bce(0x192)],'dbId':_0x1eaf0a['dbId']},_0x2f4018,{'dbName':_0x39937a,'mode':_0x64d197,'syncedAt':new Date()[_0x439bce(0x183)](),'description':_0x1eaf0a[_0x439bce(0x18b)]}),_0x3caebc=buildSqlLockEntry(_0x1eaf0a,_0x2f4018,'',{'dbName':_0x39937a}),_0x28c437=resolveLocalSqlFilePath(_0x23b611,_0x1eaf0a[_0x439bce(0x158)],_0x3caebc);let _0x5cea50=_0x439bce(0x15f),_0x3d6b1e;const _0x1173ec=await findExistingSqlFiles(_0x23b611,_0x28c437,_0x64d197,_0x35b969[_0x439bce(0x19a)][_0x1eaf0a[_0x439bce(0x158)]]);if(_0x1173ec['length']>0x0){const _0x293cde=await compareExistingSqlFiles(_0x1173ec,_0x23e6aa,_0x64d197);if(_0x293cde[_0x439bce(0x186)](({equivalent:_0x78c7fa})=>!_0x78c7fa))_0x5cea50=_0x439bce(0x184),_0x3d6b1e='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x293cde[_0x439bce(0x160)]===0x1&&_0x293cde[0x0]?.['file'][_0x439bce(0x18a)]&&(_0x5cea50=_0x439bce(0x170),_0x3d6b1e='unchanged');}_0x339fc8[_0x439bce(0x177)]({'sqlCode':_0x1eaf0a[_0x439bce(0x158)],'sqlName':_0x1eaf0a[_0x439bce(0x192)],'filePath':_0x28c437,'status':_0x5cea50,'reason':_0x3d6b1e});}return{'method':_0x439bce(0x195),'url':_0x439bce(0x16c),'body':{'appCode':_0x5136b8[_0x439bce(0x17f)],'sqlCode':_0x5136b8[_0x439bce(0x191)]('sqlcode')||null,'sqlName':_0x5136b8[_0x439bce(0x191)](_0x439bce(0x15b))||null,'files':_0x339fc8},'description':_0x439bce(0x198)+_0x339fc8['length']+_0x439bce(0x15d)+_0x23b611['sqlRootDir']};},async 'execute'(_0x245efc){const _0x23fe5f=a253_0x153a56,_0xe086d8=loadSqlProjectConfig(_0x245efc[_0x23fe5f(0x17f)]),_0x329bae=await readSqlLockFile(_0xe086d8['lockFilePath']),{lockData:_0xdbe145,appLock:_0x44a2c5}=ensureSqlLockScope(_0x329bae??createEmptySqlLock(),_0xe086d8['appCode'],_0xe086d8[_0x23fe5f(0x164)],_0x23fe5f(0x17c)),_0x518dd5=_0x245efc['bool'](_0x23fe5f(0x190)),_0x18bbf7=await fetchAllSqlQueries(_0x245efc[_0x23fe5f(0x17f)],{'sqlCode':_0x245efc[_0x23fe5f(0x191)](_0x23fe5f(0x159))||undefined,'sqlName':_0x245efc[_0x23fe5f(0x191)](_0x23fe5f(0x15b))||undefined});if(_0x18bbf7[_0x23fe5f(0x160)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x23fe5f(0x19c)};const _0x4a5fb5=[],_0xa51ad2=[];for(const _0x2b7c84 of _0x18bbf7){try{_0x4a5fb5[_0x23fe5f(0x177)](await ensureSqlContent(_0x2b7c84));}catch(_0x28e72d){_0xa51ad2[_0x23fe5f(0x177)]({'sqlCode':_0x2b7c84['sqlCode'],'error':_0x28e72d instanceof Error?_0x28e72d[_0x23fe5f(0x169)]:String(_0x28e72d)});}}if(_0x518dd5&&!_0x245efc[_0x23fe5f(0x17e)]){let _0x539beb=![];for(const _0x13c79a of _0x4a5fb5){const _0x530ad3=detectSqlMode(ensureRemoteSqlContent(_0x13c79a)),_0x350c45=_0x13c79a[_0x23fe5f(0x171)]?await getDbName(_0x245efc[_0x23fe5f(0x17f)],Number(_0x13c79a['dbId']))[_0x23fe5f(0x17b)](()=>undefined):undefined,_0x20d3e4=buildLocalSqlFileContent({'sqlCode':_0x13c79a[_0x23fe5f(0x158)],'sqlName':_0x13c79a[_0x23fe5f(0x192)],'dbId':_0x13c79a['dbId']},ensureRemoteSqlContent(_0x13c79a),{'dbName':_0x350c45,'mode':_0x530ad3,'syncedAt':new Date()[_0x23fe5f(0x183)](),'description':_0x13c79a[_0x23fe5f(0x18b)]}),_0xdbc52d=resolveLocalSqlFilePath(_0xe086d8,_0x13c79a[_0x23fe5f(0x158)],buildSqlLockEntry(_0x13c79a,ensureRemoteSqlContent(_0x13c79a),'',{'dbName':_0x350c45})),_0x197ec3=await findExistingSqlFiles(_0xe086d8,_0xdbc52d,_0x530ad3,_0x44a2c5['sqls'][_0x13c79a[_0x23fe5f(0x158)]]),_0x1eb09f=await compareExistingSqlFiles(_0x197ec3,_0x20d3e4,_0x530ad3);if(_0x1eb09f[_0x23fe5f(0x186)](({equivalent:_0x370349})=>!_0x370349)){_0x539beb=!![];break;}}if(_0x539beb){const _0x2d44a3=await confirmForceOverwrite(_0x23fe5f(0x18f));if(!_0x2d44a3)throw CliErrors['cancelled'](_0x23fe5f(0x1a0));}}const _0x188396=cloneSqlLockData(_0xdbe145),_0xa74b2a=_0x188396[_0x23fe5f(0x163)][_0xe086d8[_0x23fe5f(0x17f)]],_0x204c4e=[],_0x2e9e35=[];for(const _0x4d1506 of _0x4a5fb5){const _0x425e76=_0xa74b2a[_0x23fe5f(0x19a)][_0x4d1506[_0x23fe5f(0x158)]],_0x13f265=ensureRemoteSqlContent(_0x4d1506),_0x56b041=detectSqlMode(_0x13f265),_0x3ee0e6=_0x4d1506[_0x23fe5f(0x171)]?await getDbName(_0x245efc[_0x23fe5f(0x17f)],Number(_0x4d1506['dbId']))[_0x23fe5f(0x17b)](()=>undefined):undefined,_0x3da55c=buildLocalSqlFileContent({'sqlCode':_0x4d1506[_0x23fe5f(0x158)],'sqlName':_0x4d1506[_0x23fe5f(0x192)],'dbId':_0x4d1506[_0x23fe5f(0x171)]},_0x13f265,{'dbName':_0x3ee0e6,'mode':_0x56b041,'syncedAt':new Date()[_0x23fe5f(0x183)](),'description':_0x4d1506[_0x23fe5f(0x18b)]}),_0x308a33=buildSqlLockEntry(_0x4d1506,_0x13f265,computeSqlContentHash(_0x3da55c),{'dbName':_0x3ee0e6}),_0x5187d5=_0x308a33[_0x23fe5f(0x16a)],_0x320d7a=join(_0xe086d8[_0x23fe5f(0x185)],_0x5187d5);try{const _0x14e7a3=await findExistingSqlFiles(_0xe086d8,_0x320d7a,_0x56b041,_0x425e76),_0x47d705=await compareExistingSqlFiles(_0x14e7a3,_0x3da55c,_0x56b041);if(!_0x518dd5&&_0x47d705[_0x23fe5f(0x186)](({equivalent:_0x44d196})=>!_0x44d196)){_0x2e9e35[_0x23fe5f(0x177)]({'sqlCode':_0x4d1506[_0x23fe5f(0x158)],'reason':_0x23fe5f(0x165)});continue;}const _0x3a2da2=_0x47d705[_0x23fe5f(0x193)](({file:_0x479f33})=>_0x479f33[_0x23fe5f(0x18a)]),_0x5bdf2b=_0x47d705[_0x23fe5f(0x193)](({file:_0x1a07e4})=>!_0x1a07e4['isCanonical']);if(_0x3a2da2?.[_0x23fe5f(0x166)]&&!_0x5bdf2b){_0x2e9e35[_0x23fe5f(0x177)]({'sqlCode':_0x4d1506[_0x23fe5f(0x158)],'reason':'unchanged'}),_0xa74b2a[_0x23fe5f(0x19a)][_0x4d1506[_0x23fe5f(0x158)]]={..._0x308a33,'hash':computeSqlContentHash(_0x3a2da2[_0x23fe5f(0x172)]),'path':_0x5187d5};continue;}!_0x3a2da2?.[_0x23fe5f(0x166)]&&(await ensureParentDirectory(_0x320d7a),await writeFile(_0x320d7a,_0x3da55c,_0x23fe5f(0x199))),_0x5bdf2b&&await rm(_0x5bdf2b[_0x23fe5f(0x156)][_0x23fe5f(0x157)],{'force':!![]}),_0xa74b2a[_0x23fe5f(0x19a)][_0x4d1506[_0x23fe5f(0x158)]]={..._0x308a33,'hash':_0x3a2da2?.[_0x23fe5f(0x166)]?computeSqlContentHash(_0x3a2da2[_0x23fe5f(0x172)]):_0x308a33[_0x23fe5f(0x17d)],'path':_0x5187d5},_0x204c4e[_0x23fe5f(0x177)]({'sqlCode':_0x4d1506['sqlCode'],'filePath':_0x320d7a});}catch(_0x1e3a9e){_0xa51ad2[_0x23fe5f(0x177)]({'sqlCode':_0x4d1506['sqlCode'],'error':_0x1e3a9e instanceof Error?_0x1e3a9e['message']:String(_0x1e3a9e)});}}return _0xa74b2a['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xe086d8['lockFilePath'],_0x188396),{'ok':_0xa51ad2[_0x23fe5f(0x160)]===0x0,'data':{'pulled':_0x204c4e,'skipped':_0x2e9e35,'failed':_0xa51ad2},'message':'Pull\x20complete:\x20'+_0x204c4e[_0x23fe5f(0x160)]+_0x23fe5f(0x18d)+_0x2e9e35[_0x23fe5f(0x160)]+_0x23fe5f(0x168)+_0xa51ad2[_0x23fe5f(0x160)]+_0x23fe5f(0x179)};}};function a253_0x3348(_0x170e9b,_0xb96569){_0x170e9b=_0x170e9b-0x156;const _0x1d2677=a253_0x1d26();let _0x3348d2=_0x1d2677[_0x170e9b];return _0x3348d2;}function isEquivalentPulledSqlFile(_0x43057f,_0x532905,_0x19e612,_0x4fb52f){if(_0x19e612!==_0x4fb52f)return normalizePulledSqlBody(_0x43057f,_0x19e612)===normalizePulledSqlBody(_0x532905,_0x4fb52f);return normalizePullComparableContent(_0x43057f,_0x19e612)===normalizePullComparableContent(_0x532905,_0x4fb52f);}async function findExistingSqlFiles(_0x473773,_0x36596a,_0x48ec75,_0x5365a1){const _0x3430c0=a253_0x153a56,_0x4b9696=[];await fileExists(_0x36596a)&&_0x4b9696['push']({'filePath':_0x36596a,'mode':_0x48ec75,'isCanonical':!![]});if(!_0x5365a1?.[_0x3430c0(0x16a)])return _0x4b9696;const _0x4cd6eb=join(_0x473773[_0x3430c0(0x185)],_0x5365a1['path']);if(_0x4cd6eb===_0x36596a)return _0x4b9696;return await fileExists(_0x4cd6eb)&&_0x4b9696['push']({'filePath':_0x4cd6eb,'mode':_0x5365a1[_0x3430c0(0x16f)]??modeFromFilePath(_0x4cd6eb),'isCanonical':![]}),_0x4b9696;}async function compareExistingSqlFiles(_0x2194b1,_0x2c8bd5,_0x4953e8){const _0x580e4a=a253_0x153a56;return Promise[_0x580e4a(0x175)](_0x2194b1[_0x580e4a(0x18e)](async _0x54c89d=>{const _0x5104d0=_0x580e4a,_0x485527=await readFile(_0x54c89d[_0x5104d0(0x157)],_0x5104d0(0x199));return{'file':_0x54c89d,'content':_0x485527,'equivalent':isEquivalentPulledSqlFile(_0x485527,_0x2c8bd5,_0x54c89d[_0x5104d0(0x16f)],_0x4953e8)};}));}function modeFromFilePath(_0x763763){const _0x25f13c=a253_0x153a56;return _0x763763[_0x25f13c(0x161)]()[_0x25f13c(0x19e)](_0x25f13c(0x174))?_0x25f13c(0x181):_0x25f13c(0x194);}function normalizePulledSqlBody(_0x28c8a2,_0x43a61b){const _0x54fcae=a253_0x153a56;return stripLocalSqlMetadata(_0x28c8a2,_0x43a61b)['replace'](/\r\n/g,'\x0a')[_0x54fcae(0x15a)]();}function normalizePullComparableContent(_0x37aca4,_0x3f38ce){const _0x30f6c5=a253_0x153a56,_0x2d4de0=_0x37aca4[_0x30f6c5(0x182)](/\r\n/g,'\x0a')['split']('\x0a'),_0x579a6e=_0x2d4de0[_0x30f6c5(0x196)](_0x51f13d=>!isSyncedAtMetadataLine(_0x51f13d,_0x3f38ce));return _0x579a6e[_0x30f6c5(0x189)]('\x0a');}function isSyncedAtMetadataLine(_0x805f18,_0x3425f2){const _0x4f3353=a253_0x153a56;if(_0x3425f2===_0x4f3353(0x181))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4f3353(0x19f)](_0x805f18);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4f3353(0x19f)](_0x805f18);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a254_0x5e9230=a254_0x40a7;(function(_0x5190fb,_0x54390f){const _0x2868bb=a254_0x40a7,_0x51661d=_0x5190fb();while(!![]){try{const _0x4c78a1=-parseInt(_0x2868bb(0xc6))/0x1+-parseInt(_0x2868bb(0xc4))/0x2+-parseInt(_0x2868bb(0xb7))/0x3+-parseInt(_0x2868bb(0xb4))/0x4+-parseInt(_0x2868bb(0xc5))/0x5+-parseInt(_0x2868bb(0xae))/0x6+parseInt(_0x2868bb(0xbe))/0x7;if(_0x4c78a1===_0x54390f)break;else _0x51661d['push'](_0x51661d['shift']());}catch(_0x359530){_0x51661d['push'](_0x51661d['shift']());}}}(a254_0x23a3,0x920f5));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a254_0x23a3(){const _0x6b4905=['toISOString','map','\x20skipped,\x20','isFinite','length','Push\x20local\x20SQL\x20files\x20to\x20remote','push','path','replace','lastSync','bool','get','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Local\x20directory\x20\x22','mode',':\x20SQL\x20content\x20is\x20empty.','\x20failed','join','sqlConfig','sqlName','boolean','\x22\x20for\x20sqlCode\x20','relativePath','/smartapi/custom/updateUserCustomSql','unchanged','lockFilePath','exec','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','dbDirectory','write','209082ISENHY','sql','sqlcode','\x20SQL\x20file(s)','force','sqls','378260nUHmQT','POST','dbId','2015943XKoCLi','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','sqlRootDir','hash','version','trashDir','Would\x20push\x20','28865900uLZZVE','projectRoot','sqlCode','validation','message','No\x20local\x20SQL\x20files\x20found.','1076360MpguLm','5185840jsxjQp','1148698KSWQye','dbName','sqlRoot','str','utf8','appCode','Push\x20complete:\x20'];a254_0x23a3=function(){return _0x6b4905;};return a254_0x23a3();}import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a254_0x40a7(_0x44b108,_0x53bfc5){_0x44b108=_0x44b108-0xa6;const _0x23a393=a254_0x23a3();let _0x40a742=_0x23a393[_0x44b108];return _0x40a742;}async function readSqlUploadContent(_0x1e114e){const _0x256198=a254_0x40a7,_0xb7c352=stripLocalSqlMetadata(await readFile(_0x1e114e['filePath'],_0x256198(0xca)),_0x1e114e['mode']);if(!_0xb7c352['trim']())throw CliErrors[_0x256198(0xc1)](_0x1e114e['sqlCode']+_0x256198(0xdc));return _0xb7c352;}async function getTargetSqlQueries(_0x5130c4,_0x4c3363,_0x2daefa){const _0x3ecedd=a254_0x40a7,_0x4b5f07=await scanLocalSqlQueries(_0x5130c4),_0x78919=new Map();for(const _0x52351a of _0x4b5f07){if(_0x2daefa&&_0x52351a[_0x3ecedd(0xc0)]!==_0x2daefa)continue;const _0x4e1f2b=_0x78919[_0x3ecedd(0xd8)](_0x52351a['sqlCode'])??[];_0x4e1f2b[_0x3ecedd(0xd3)](_0x52351a),_0x78919['set'](_0x52351a[_0x3ecedd(0xc0)],_0x4e1f2b);}if(_0x2daefa&&!_0x78919['has'](_0x2daefa))throw CliErrors[_0x3ecedd(0xc1)]('Local\x20SQL\x20not\x20found:\x20'+_0x2daefa);const _0x40461f=[];for(const [_0x3fe31c,_0x2fb7db]of _0x78919['entries']()){if(_0x2fb7db['length']===0x1){_0x40461f[_0x3ecedd(0xd3)](_0x2fb7db[0x0]);continue;}const _0x204808=_0x4c3363[_0x3ecedd(0xb3)][_0x3fe31c],_0x987538=_0x204808?.[_0x3ecedd(0xd4)],_0x23fde3=_0x987538?_0x2fb7db['filter'](_0x1f984e=>_0x1f984e[_0x3ecedd(0xa6)]!==_0x987538):_0x2fb7db;if(_0x204808&&_0x23fde3[_0x3ecedd(0xd1)]===0x1){_0x40461f[_0x3ecedd(0xd3)](_0x23fde3[0x0]);continue;}throw CliErrors['validation'](_0x3ecedd(0xb8)+_0x3fe31c+_0x3ecedd(0xab));}return _0x40461f;}export const sqlPush={'service':a254_0x5e9230(0xaf),'command':'push','description':a254_0x5e9230(0xd2),'risk':a254_0x5e9230(0xad),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a254_0x5e9230(0xe1),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0xcd6256){const _0x423176=a254_0x5e9230,_0x52621f=loadSqlProjectConfig(_0xcd6256[_0x423176(0xcb)]),_0x45d59e=await readSqlLockFile(_0x52621f[_0x423176(0xa9)]),{appLock:_0x538d70}=ensureSqlLockScope(_0x45d59e??createEmptySqlLock(),_0xcd6256[_0x423176(0xcb)],_0x52621f['sqlRoot'],_0x423176(0xd3)),_0x198a01=await getTargetSqlQueries(_0x52621f,_0x538d70,_0xcd6256[_0x423176(0xc9)](_0x423176(0xb0))||undefined),_0x2cea00=[];for(const _0x48038a of _0x198a01){const _0x45c580=await computeSqlFileHash(_0x48038a['filePath']),_0x290701=_0x538d70[_0x423176(0xb3)][_0x48038a['sqlCode']],_0x2cdc28=!!_0x290701&&(_0x290701[_0x423176(0xd4)]!==_0x48038a[_0x423176(0xa6)]||!!_0x48038a[_0x423176(0xe0)]&&_0x290701[_0x423176(0xe0)]!==_0x48038a[_0x423176(0xe0)]||_0x290701[_0x423176(0xdb)]!==_0x48038a['mode']);if(!_0xcd6256[_0x423176(0xd7)]('force')&&_0x290701&&_0x290701[_0x423176(0xba)]===_0x45c580&&!_0x2cdc28)continue;if(!_0x290701)throw CliErrors[_0x423176(0xc1)](_0x48038a[_0x423176(0xc0)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x290701[_0x423176(0xbb)]==null)throw CliErrors[_0x423176(0xc1)](_0x48038a[_0x423176(0xc0)]+':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.');await resolveTargetDbBinding(_0xcd6256[_0x423176(0xcb)],_0x48038a,_0x290701),await readSqlUploadContent(_0x48038a),_0x2cea00['push'](_0x48038a['sqlCode']);}return{'method':_0x423176(0xb5),'url':_0x423176(0xa7),'body':{'sqlCodes':_0x2cea00,'appCode':_0xcd6256[_0x423176(0xcb)]},'description':_0x423176(0xbd)+_0x2cea00[_0x423176(0xd1)]+_0x423176(0xb1)};},async 'execute'(_0x58ae9e){const _0x22ca18=a254_0x5e9230,_0x10aad2=loadSqlProjectConfig(_0x58ae9e[_0x22ca18(0xcb)]),_0x5c5e97=await readSqlLockFile(_0x10aad2[_0x22ca18(0xa9)]),{lockData:_0x453acf,appLock:_0x288ffe}=ensureSqlLockScope(_0x5c5e97??createEmptySqlLock(),_0x58ae9e['appCode'],_0x10aad2[_0x22ca18(0xc8)],_0x22ca18(0xd3)),_0x2ac655=await getTargetSqlQueries(_0x10aad2,_0x288ffe,_0x58ae9e[_0x22ca18(0xc9)](_0x22ca18(0xb0))||undefined);if(_0x2ac655[_0x22ca18(0xd1)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x22ca18(0xc3)};const _0x2b20b3=[],_0x30aac8=[],_0x1f46e0=[];let _0x4bf5c8=![];for(const _0x449ecd of _0x2ac655){const _0x2b0903=_0x288ffe[_0x22ca18(0xb3)][_0x449ecd['sqlCode']];if(!_0x2b0903){_0x1f46e0['push']({'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'error':_0x22ca18(0xd9)});continue;}try{const _0x1c542f=await computeSqlFileHash(_0x449ecd['filePath']),_0x3b4a8a=_0x2b0903['path']!==_0x449ecd[_0x22ca18(0xa6)]||!!_0x449ecd[_0x22ca18(0xe0)]&&_0x2b0903[_0x22ca18(0xe0)]!==_0x449ecd['sqlName']||_0x2b0903['mode']!==_0x449ecd[_0x22ca18(0xdb)];if(!_0x58ae9e[_0x22ca18(0xd7)](_0x22ca18(0xb2))&&_0x2b0903[_0x22ca18(0xba)]===_0x1c542f&&!_0x3b4a8a){_0x30aac8[_0x22ca18(0xd3)]({'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'reason':_0x22ca18(0xa8)});continue;}if(_0x2b0903[_0x22ca18(0xbb)]==null){_0x1f46e0[_0x22ca18(0xd3)]({'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x12bca8=_0x449ecd['sqlName']||_0x2b0903['sqlName'],_0x4b6c1a=await resolveTargetDbBinding(_0x58ae9e['appCode'],_0x449ecd,_0x2b0903),_0x5e94a5=await readSqlUploadContent(_0x449ecd),_0xa5e621=await updateSqlQuery({'id':_0x2b0903['remoteId'],'appCode':_0x58ae9e['appCode'],'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'sqlName':_0x12bca8,'dbId':_0x4b6c1a['dbId'],'version':_0x2b0903[_0x22ca18(0xbb)],'sqlContent':_0x5e94a5,'sqlConfig':_0x2b0903[_0x22ca18(0xdf)]??undefined}),_0x40c8fe=_0xa5e621['dbId']?await getDbName(_0x58ae9e['appCode'],Number(_0xa5e621[_0x22ca18(0xb6)]))['catch'](()=>_0x4b6c1a['dbName']):_0x4b6c1a[_0x22ca18(0xc7)];_0x288ffe[_0x22ca18(0xb3)][_0x449ecd[_0x22ca18(0xc0)]]={...buildSqlLockEntry(_0xa5e621,_0x5e94a5,_0x1c542f,{'dbName':_0x40c8fe}),'path':_0x449ecd[_0x22ca18(0xa6)],'mode':_0x449ecd[_0x22ca18(0xdb)]},_0x4bf5c8=!![],await archivePreviousSqlFileIfNeeded(_0x10aad2,_0x2b0903[_0x22ca18(0xd4)],_0x449ecd[_0x22ca18(0xa6)]),_0x2b20b3['push']({'sqlCode':_0x449ecd['sqlCode'],'remoteId':_0x2b0903['remoteId']});}catch(_0x181b5a){_0x1f46e0[_0x22ca18(0xd3)]({'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'error':_0x181b5a instanceof Error?_0x181b5a[_0x22ca18(0xc2)]:String(_0x181b5a)});}}(_0x4bf5c8||_0x1f46e0[_0x22ca18(0xd1)]===0x0)&&(_0x288ffe[_0x22ca18(0xd6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x10aad2[_0x22ca18(0xa9)],_0x453acf));const _0x183fd4=_0x1f46e0[_0x22ca18(0xd1)]===0x0;return{'ok':_0x183fd4,'data':{'pushed':_0x2b20b3,'skipped':_0x30aac8,'failed':_0x1f46e0},'message':_0x22ca18(0xcc)+_0x2b20b3[_0x22ca18(0xd1)]+'\x20pushed,\x20'+_0x30aac8[_0x22ca18(0xd1)]+_0x22ca18(0xcf)+_0x1f46e0['length']+_0x22ca18(0xdd)};}};async function archivePreviousSqlFileIfNeeded(_0x1d91bb,_0x36aa72,_0x5da0be){const _0x2fae76=a254_0x5e9230;if(!_0x36aa72||_0x36aa72===_0x5da0be)return;const _0x2578a0=join(_0x1d91bb[_0x2fae76(0xb9)],_0x36aa72);if(!await fileExists(_0x2578a0))return;const _0x4a43d4=await moveToTrash(_0x1d91bb[_0x2fae76(0xbf)],_0x1d91bb[_0x2fae76(0xbc)],_0x2578a0);await cleanupEmptyDirectories(dirname(_0x2578a0),_0x1d91bb[_0x2fae76(0xb9)]),void _0x4a43d4;}async function moveToTrash(_0x1c54b6,_0x1e5e7e,_0x3a1e1e){const _0x282065=a254_0x5e9230,_0x2c2ca9=new Date()[_0x282065(0xcd)]()[_0x282065(0xd5)](/[:.]/g,'-'),_0x486ec4=relative(_0x1c54b6,_0x3a1e1e),_0x262d0b=join(_0x1e5e7e,_0x2c2ca9,_0x486ec4);return await mkdir(dirname(_0x262d0b),{'recursive':!![]}),await rename(_0x3a1e1e,_0x262d0b),_0x262d0b;}async function cleanupEmptyDirectories(_0x129223,_0x1747e0){const _0xd90003=a254_0x5e9230;let _0x57e32c=resolve(_0x129223);const _0x6b53e5=resolve(_0x1747e0);while(_0x57e32c['startsWith'](''+_0x6b53e5+sep)||_0x57e32c===_0x6b53e5){if(_0x57e32c===_0x6b53e5)return;try{const _0xee91c8=await readdir(_0x57e32c);if(_0xee91c8[_0xd90003(0xd1)]>0x0)return;await rmdir(_0x57e32c);}catch{return;}_0x57e32c=dirname(_0x57e32c);}}async function resolveTargetDbBinding(_0x3d8f05,_0x2c1c58,_0x5c3762){const _0x11ffa9=a254_0x5e9230,_0x247db1=_0x2c1c58[_0x11ffa9(0xac)];if(!_0x247db1)return{'dbId':_0x5c3762['dbId'],'dbName':_0x5c3762[_0x11ffa9(0xc7)]};const _0x1d5837=buildDbDirectoryName(_0x5c3762[_0x11ffa9(0xc7)],_0x5c3762[_0x11ffa9(0xb6)]);if(_0x247db1===_0x1d5837)return{'dbId':_0x5c3762[_0x11ffa9(0xb6)],'dbName':_0x5c3762[_0x11ffa9(0xc7)]};const _0x183749=parseExplicitDbDirectory(_0x247db1);if(_0x183749!=null)return{'dbId':_0x183749,'dbName':await getDbName(_0x3d8f05,_0x183749)['catch'](()=>undefined)};const _0x4c3bb2=await listDatabases(_0x3d8f05),_0x5823d1=_0x4c3bb2['filter'](_0x35b4d0=>buildDbDirectoryName(_0x35b4d0[_0x11ffa9(0xc7)],_0x35b4d0[_0x11ffa9(0xb6)])===_0x247db1);if(_0x5823d1[_0x11ffa9(0xd1)]===0x1)return{'dbId':_0x5823d1[0x0][_0x11ffa9(0xb6)],'dbName':_0x5823d1[0x0][_0x11ffa9(0xc7)]};if(_0x5823d1[_0x11ffa9(0xd1)]===0x0)throw CliErrors[_0x11ffa9(0xc1)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x247db1+_0x11ffa9(0xe2)+_0x2c1c58['sqlCode']+'.');const _0x33a9fe=_0x5823d1[_0x11ffa9(0xce)](_0x27072c=>_0x27072c['dbName']+'\x20('+_0x27072c[_0x11ffa9(0xb6)]+')')[_0x11ffa9(0xde)](',\x20');throw CliErrors['validation'](_0x11ffa9(0xda)+_0x247db1+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x2c1c58[_0x11ffa9(0xc0)]+':\x20'+_0x33a9fe);}function parseExplicitDbDirectory(_0x5e3bf7){const _0x24a9c8=a254_0x5e9230,_0x2d9b89=/^db-(\d+)$/[_0x24a9c8(0xaa)](_0x5e3bf7);if(!_0x2d9b89)return null;const _0x2202a5=Number(_0x2d9b89[0x1]);return Number[_0x24a9c8(0xd0)](_0x2202a5)&&_0x2202a5>0x0?_0x2202a5:null;}
|
|
1
|
+
const a254_0x361ade=a254_0x33a6;(function(_0x3db8d3,_0x209b89){const _0x591758=a254_0x33a6,_0x4c0e7a=_0x3db8d3();while(!![]){try{const _0x20d104=parseInt(_0x591758(0xd9))/0x1+-parseInt(_0x591758(0xda))/0x2*(parseInt(_0x591758(0xc7))/0x3)+parseInt(_0x591758(0xc6))/0x4+parseInt(_0x591758(0xed))/0x5+parseInt(_0x591758(0xdd))/0x6+-parseInt(_0x591758(0xc2))/0x7*(parseInt(_0x591758(0xdb))/0x8)+-parseInt(_0x591758(0xe2))/0x9*(-parseInt(_0x591758(0xf0))/0xa);if(_0x20d104===_0x209b89)break;else _0x4c0e7a['push'](_0x4c0e7a['shift']());}catch(_0x23154c){_0x4c0e7a['push'](_0x4c0e7a['shift']());}}}(a254_0x3a47,0xf1e7a));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 a254_0x33a6(_0x5d40aa,_0x473e86){_0x5d40aa=_0x5d40aa-0xb5;const _0x3a4782=a254_0x3a47();let _0x33a63d=_0x3a4782[_0x5d40aa];return _0x33a63d;}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x20dac2){const _0x578051=a254_0x33a6,_0x182056=stripLocalSqlMetadata(await readFile(_0x20dac2[_0x578051(0xf6)],_0x578051(0xd6)),_0x20dac2[_0x578051(0xbc)]);if(!_0x182056[_0x578051(0xc8)]())throw CliErrors['validation'](_0x20dac2[_0x578051(0xdf)]+_0x578051(0xc1));return _0x182056;}async function getTargetSqlQueries(_0x3fe55f,_0x4130fd,_0x19c735){const _0x46e966=a254_0x33a6,_0x362fa1=await scanLocalSqlQueries(_0x3fe55f),_0xb061d7=new Map();for(const _0xfc3517 of _0x362fa1){if(_0x19c735&&_0xfc3517[_0x46e966(0xdf)]!==_0x19c735)continue;const _0x5b47d1=_0xb061d7[_0x46e966(0xe8)](_0xfc3517['sqlCode'])??[];_0x5b47d1['push'](_0xfc3517),_0xb061d7[_0x46e966(0xe1)](_0xfc3517[_0x46e966(0xdf)],_0x5b47d1);}if(_0x19c735&&!_0xb061d7[_0x46e966(0xf5)](_0x19c735))throw CliErrors[_0x46e966(0xbb)]('Local\x20SQL\x20not\x20found:\x20'+_0x19c735);const _0x49eaf7=[];for(const [_0x305dd5,_0x2ba7b4]of _0xb061d7[_0x46e966(0xd3)]()){if(_0x2ba7b4[_0x46e966(0xde)]===0x1){_0x49eaf7[_0x46e966(0xee)](_0x2ba7b4[0x0]);continue;}const _0x4dcb2e=_0x4130fd[_0x46e966(0xf1)][_0x305dd5],_0x4b8b12=_0x4dcb2e?.['path'],_0x2ec255=_0x4b8b12?_0x2ba7b4[_0x46e966(0xc0)](_0xeb89e9=>_0xeb89e9[_0x46e966(0xd1)]!==_0x4b8b12):_0x2ba7b4;if(_0x4dcb2e&&_0x2ec255['length']===0x1){_0x49eaf7[_0x46e966(0xee)](_0x2ec255[0x0]);continue;}throw CliErrors[_0x46e966(0xbb)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x305dd5+_0x46e966(0xbe));}return _0x49eaf7;}export const sqlPush={'service':a254_0x361ade(0xcd),'command':a254_0x361ade(0xee),'description':a254_0x361ade(0xe7),'risk':a254_0x361ade(0xd0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a254_0x361ade(0xb9)}],async 'dryRun'(_0xe98d6f){const _0x3f5634=a254_0x361ade,_0x24c77e=loadSqlProjectConfig(_0xe98d6f[_0x3f5634(0xc3)]),_0x94915e=await readSqlLockFile(_0x24c77e['lockFilePath']),{appLock:_0x4931c1}=ensureSqlLockScope(_0x94915e??createEmptySqlLock(),_0xe98d6f[_0x3f5634(0xc3)],_0x24c77e[_0x3f5634(0xd2)],_0x3f5634(0xee)),_0x1bfaf3=await getTargetSqlQueries(_0x24c77e,_0x4931c1,_0xe98d6f[_0x3f5634(0xe5)](_0x3f5634(0xe4))||undefined),_0x216e5b=[];for(const _0x254866 of _0x1bfaf3){const _0x3635a4=await computeSqlFileHash(_0x254866[_0x3f5634(0xf6)]),_0x685be6=_0x4931c1[_0x3f5634(0xf1)][_0x254866[_0x3f5634(0xdf)]],_0x404bfc=!!_0x685be6&&(_0x685be6['path']!==_0x254866['relativePath']||!!_0x254866[_0x3f5634(0xd4)]&&_0x685be6[_0x3f5634(0xd4)]!==_0x254866[_0x3f5634(0xd4)]||_0x685be6[_0x3f5634(0xbc)]!==_0x254866[_0x3f5634(0xbc)]);if(!_0xe98d6f[_0x3f5634(0xf4)](_0x3f5634(0xe9))&&_0x685be6&&_0x685be6['hash']===_0x3635a4&&!_0x404bfc)continue;if(!_0x685be6)throw CliErrors[_0x3f5634(0xbb)](_0x254866[_0x3f5634(0xdf)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x685be6[_0x3f5634(0xbd)]==null)throw CliErrors[_0x3f5634(0xbb)](_0x254866['sqlCode']+':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.');await resolveTargetDbBinding(_0xe98d6f['appCode'],_0x254866,_0x685be6),await readSqlUploadContent(_0x254866),_0x216e5b[_0x3f5634(0xee)](_0x254866['sqlCode']);}return{'method':_0x3f5634(0xcf),'url':_0x3f5634(0xef),'body':{'sqlCodes':_0x216e5b,'appCode':_0xe98d6f[_0x3f5634(0xc3)]},'description':'Would\x20push\x20'+_0x216e5b[_0x3f5634(0xde)]+_0x3f5634(0xdc)};},async 'execute'(_0x2bb1ec){const _0xe128e6=a254_0x361ade,_0x394536=loadSqlProjectConfig(_0x2bb1ec[_0xe128e6(0xc3)]),_0x363bec=await readSqlLockFile(_0x394536['lockFilePath']),{lockData:_0x25f251,appLock:_0x99aa9a}=ensureSqlLockScope(_0x363bec??createEmptySqlLock(),_0x2bb1ec[_0xe128e6(0xc3)],_0x394536[_0xe128e6(0xd2)],_0xe128e6(0xee)),_0x2875eb=await getTargetSqlQueries(_0x394536,_0x99aa9a,_0x2bb1ec[_0xe128e6(0xe5)](_0xe128e6(0xe4))||undefined);if(_0x2875eb[_0xe128e6(0xde)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x4a9a99=[],_0x2cbc13=[],_0x4857a8=[];let _0x149232=![];for(const _0x42c171 of _0x2875eb){const _0x1fd4a9=_0x99aa9a['sqls'][_0x42c171[_0xe128e6(0xdf)]];if(!_0x1fd4a9){_0x4857a8['push']({'sqlCode':_0x42c171[_0xe128e6(0xdf)],'error':_0xe128e6(0xea)});continue;}try{const _0x3e1ec5=await computeSqlFileHash(_0x42c171[_0xe128e6(0xf6)]),_0x326c5d=_0x1fd4a9['path']!==_0x42c171[_0xe128e6(0xd1)]||!!_0x42c171[_0xe128e6(0xd4)]&&_0x1fd4a9[_0xe128e6(0xd4)]!==_0x42c171[_0xe128e6(0xd4)]||_0x1fd4a9[_0xe128e6(0xbc)]!==_0x42c171['mode'];if(!_0x2bb1ec[_0xe128e6(0xf4)]('force')&&_0x1fd4a9[_0xe128e6(0xd5)]===_0x3e1ec5&&!_0x326c5d){_0x2cbc13[_0xe128e6(0xee)]({'sqlCode':_0x42c171[_0xe128e6(0xdf)],'reason':_0xe128e6(0xeb)});continue;}if(_0x1fd4a9[_0xe128e6(0xbd)]==null){_0x4857a8[_0xe128e6(0xee)]({'sqlCode':_0x42c171[_0xe128e6(0xdf)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x43ad8b=_0x42c171[_0xe128e6(0xd4)]||_0x1fd4a9[_0xe128e6(0xd4)],_0x410115=await resolveTargetDbBinding(_0x2bb1ec[_0xe128e6(0xc3)],_0x42c171,_0x1fd4a9),_0x166887=await readSqlUploadContent(_0x42c171),_0x205f5c=await updateSqlQuery({'id':_0x1fd4a9[_0xe128e6(0xd8)],'appCode':_0x2bb1ec[_0xe128e6(0xc3)],'sqlCode':_0x42c171[_0xe128e6(0xdf)],'sqlName':_0x43ad8b,'dbId':_0x410115['dbId'],'version':_0x1fd4a9[_0xe128e6(0xbd)],'sqlContent':_0x166887,'sqlConfig':_0x1fd4a9[_0xe128e6(0xec)]??undefined}),_0x519325=_0x205f5c[_0xe128e6(0xf3)]?await getDbName(_0x2bb1ec[_0xe128e6(0xc3)],Number(_0x205f5c[_0xe128e6(0xf3)]))['catch'](()=>_0x410115[_0xe128e6(0xcc)]):_0x410115[_0xe128e6(0xcc)];_0x99aa9a[_0xe128e6(0xf1)][_0x42c171[_0xe128e6(0xdf)]]={...buildSqlLockEntry(_0x205f5c,_0x166887,_0x3e1ec5,{'dbName':_0x519325}),'path':_0x42c171[_0xe128e6(0xd1)],'mode':_0x42c171[_0xe128e6(0xbc)]},_0x149232=!![],await archivePreviousSqlFileIfNeeded(_0x394536,_0x1fd4a9[_0xe128e6(0xcb)],_0x42c171[_0xe128e6(0xd1)]),_0x4a9a99[_0xe128e6(0xee)]({'sqlCode':_0x42c171[_0xe128e6(0xdf)],'remoteId':_0x1fd4a9[_0xe128e6(0xd8)]});}catch(_0x55b476){_0x4857a8['push']({'sqlCode':_0x42c171[_0xe128e6(0xdf)],'error':_0x55b476 instanceof Error?_0x55b476[_0xe128e6(0xd7)]:String(_0x55b476)});}}(_0x149232||_0x4857a8[_0xe128e6(0xde)]===0x0)&&(_0x99aa9a[_0xe128e6(0xca)]=new Date()[_0xe128e6(0xce)](),await writeSqlLockFile(_0x394536[_0xe128e6(0xb5)],_0x25f251));const _0x2263dd=_0x4857a8[_0xe128e6(0xde)]===0x0;return{'ok':_0x2263dd,'data':{'pushed':_0x4a9a99,'skipped':_0x2cbc13,'failed':_0x4857a8},'message':_0xe128e6(0xb6)+_0x4a9a99[_0xe128e6(0xde)]+'\x20pushed,\x20'+_0x2cbc13['length']+_0xe128e6(0xbf)+_0x4857a8['length']+_0xe128e6(0xe6)};}};function a254_0x3a47(){const _0x4be1bb=['trashDir','dbId','bool','has','filePath','catch','lockFilePath','Push\x20complete:\x20','\x22\x20for\x20sqlCode\x20','replace','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','Local\x20directory\x20\x22','validation','mode','version','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20skipped,\x20','filter',':\x20SQL\x20content\x20is\x20empty.','63889NNPtyy','appCode','startsWith','projectRoot','3592760nErdzI','3gMOYkh','trim','exec','lastSync','path','dbName','sql','toISOString','POST','write','relativePath','sqlRoot','entries','sqlName','hash','utf8','message','remoteId','811752BjWxHx','3287362zXsKXe','1272JTJWvh','\x20SQL\x20file(s)','5794686HgpMrz','length','sqlCode','sqlRootDir','set','9KGyifr','dbDirectory','sqlcode','str','\x20failed','Push\x20local\x20SQL\x20files\x20to\x20remote','get','force','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','unchanged','sqlConfig','2856030jlUnSj','push','/smartapi/custom/updateUserCustomSql','8387870pHQzKu','sqls'];a254_0x3a47=function(){return _0x4be1bb;};return a254_0x3a47();}async function archivePreviousSqlFileIfNeeded(_0x4be544,_0x205591,_0x10a25b){const _0x384717=a254_0x361ade;if(!_0x205591||_0x205591===_0x10a25b)return;const _0x37360e=join(_0x4be544[_0x384717(0xe0)],_0x205591);if(!await fileExists(_0x37360e))return;const _0x36e8c2=await moveToTrash(_0x4be544[_0x384717(0xc5)],_0x4be544[_0x384717(0xf2)],_0x37360e);await cleanupEmptyDirectories(dirname(_0x37360e),_0x4be544[_0x384717(0xe0)]),void _0x36e8c2;}async function moveToTrash(_0x245eba,_0x50aab8,_0x10d4f1){const _0x4bae0b=a254_0x361ade,_0x1ccf89=new Date()[_0x4bae0b(0xce)]()[_0x4bae0b(0xb8)](/[:.]/g,'-'),_0x42311e=relative(_0x245eba,_0x10d4f1),_0x4a9720=join(_0x50aab8,_0x1ccf89,_0x42311e);return await mkdir(dirname(_0x4a9720),{'recursive':!![]}),await rename(_0x10d4f1,_0x4a9720),_0x4a9720;}async function cleanupEmptyDirectories(_0x3e7a3d,_0x5b40c2){const _0x550d9f=a254_0x361ade;let _0x2409b9=resolve(_0x3e7a3d);const _0x4f62d8=resolve(_0x5b40c2);while(_0x2409b9[_0x550d9f(0xc4)](''+_0x4f62d8+sep)||_0x2409b9===_0x4f62d8){if(_0x2409b9===_0x4f62d8)return;try{const _0x57569e=await readdir(_0x2409b9);if(_0x57569e['length']>0x0)return;await rmdir(_0x2409b9);}catch{return;}_0x2409b9=dirname(_0x2409b9);}}async function resolveTargetDbBinding(_0x41e30a,_0x5e6e60,_0x39a6f9){const _0x4c849e=a254_0x361ade,_0x2ea23f=_0x5e6e60[_0x4c849e(0xe3)];if(!_0x2ea23f)return{'dbId':_0x39a6f9[_0x4c849e(0xf3)],'dbName':_0x39a6f9[_0x4c849e(0xcc)]};const _0x3628a7=buildDbDirectoryName(_0x39a6f9[_0x4c849e(0xcc)],_0x39a6f9[_0x4c849e(0xf3)]);if(_0x2ea23f===_0x3628a7)return{'dbId':_0x39a6f9[_0x4c849e(0xf3)],'dbName':_0x39a6f9[_0x4c849e(0xcc)]};const _0x1d899c=parseExplicitDbDirectory(_0x2ea23f);if(_0x1d899c!=null)return{'dbId':_0x1d899c,'dbName':await getDbName(_0x41e30a,_0x1d899c)[_0x4c849e(0xf7)](()=>undefined)};const _0xab7218=await listDatabases(_0x41e30a),_0x1c8cee=_0xab7218[_0x4c849e(0xc0)](_0x1b52bd=>buildDbDirectoryName(_0x1b52bd[_0x4c849e(0xcc)],_0x1b52bd[_0x4c849e(0xf3)])===_0x2ea23f);if(_0x1c8cee[_0x4c849e(0xde)]===0x1)return{'dbId':_0x1c8cee[0x0][_0x4c849e(0xf3)],'dbName':_0x1c8cee[0x0][_0x4c849e(0xcc)]};if(_0x1c8cee[_0x4c849e(0xde)]===0x0)throw CliErrors[_0x4c849e(0xbb)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x2ea23f+_0x4c849e(0xb7)+_0x5e6e60[_0x4c849e(0xdf)]+'.');const _0x26db40=_0x1c8cee['map'](_0x5c8782=>_0x5c8782['dbName']+'\x20('+_0x5c8782['dbId']+')')['join'](',\x20');throw CliErrors['validation'](_0x4c849e(0xba)+_0x2ea23f+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x5e6e60[_0x4c849e(0xdf)]+':\x20'+_0x26db40);}function parseExplicitDbDirectory(_0x97870){const _0x3292c8=a254_0x361ade,_0x79979e=/^db-(\d+)$/[_0x3292c8(0xc9)](_0x97870);if(!_0x79979e)return null;const _0x424e0f=Number(_0x79979e[0x1]);return Number['isFinite'](_0x424e0f)&&_0x424e0f>0x0?_0x424e0f:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a255_0x415646=a255_0x2b6b;(function(_0x116f8e,_0x39f2ab){const _0x39496f=a255_0x2b6b,_0x3f96d9=_0x116f8e();while(!![]){try{const _0x23ad60=parseInt(_0x39496f(0x1fd))/0x1*(parseInt(_0x39496f(0x220))/0x2)+-parseInt(_0x39496f(0x214))/0x3+-parseInt(_0x39496f(0x1f6))/0x4*(parseInt(_0x39496f(0x1fe))/0x5)+-parseInt(_0x39496f(0x1ff))/0x6*(-parseInt(_0x39496f(0x222))/0x7)+parseInt(_0x39496f(0x20d))/0x8*(-parseInt(_0x39496f(0x21a))/0x9)+parseInt(_0x39496f(0x226))/0xa+-parseInt(_0x39496f(0x223))/0xb;if(_0x23ad60===_0x39f2ab)break;else _0x3f96d9['push'](_0x3f96d9['shift']());}catch(_0x1c2dc1){_0x3f96d9['push'](_0x3f96d9['shift']());}}}(a255_0x13cc,0xc5e70));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=a255_0x415646(0x1f4);export function buildSqlLockEntry(_0x448a40,_0x10dad9,_0x2d221d,_0xa7e8f9){const _0x76a4ce=a255_0x415646,_0xb63142=detectSqlMode(_0x10dad9);return{'path':buildSqlRelativePath(_0x448a40[_0x76a4ce(0x218)],_0x448a40[_0x76a4ce(0x208)],_0xa7e8f9?.['dbName'],_0xb63142,_0x448a40[_0x76a4ce(0x221)]),'hash':_0x2d221d,'remoteId':_0x448a40['id'],'version':_0x448a40[_0x76a4ce(0x211)],'dbId':Number(_0x448a40[_0x76a4ce(0x221)]),'dbName':_0xa7e8f9?.[_0x76a4ce(0x1f9)],'sqlName':_0x448a40['sqlName'],'sqlConfig':_0x448a40[_0x76a4ce(0x20e)]??undefined,'mode':_0xb63142};}export function cloneSqlLockData(_0x56b88f){const _0x51b784=a255_0x415646;return{'apps':Object['fromEntries'](Object['entries'](_0x56b88f[_0x51b784(0x204)])['map'](([_0x30a591,_0x395aa3])=>[_0x30a591,{'sqlRoot':_0x395aa3[_0x51b784(0x21c)],'lastSync':_0x395aa3[_0x51b784(0x21d)],'sqls':{..._0x395aa3[_0x51b784(0x1fb)]}}]))};}export function ensureRemoteSqlContent(_0x3567df){const _0x3ec38f=a255_0x415646;return _0x3567df[_0x3ec38f(0x225)]??'';}export function buildLocalSqlFileContent(_0x119d8a,_0x52f311,_0x155d09){const _0x171750=a255_0x415646,_0x2daef1=_0x155d09?.[_0x171750(0x20a)]??detectSqlMode(_0x52f311),_0x3101ed=stripLocalSqlMetadata(_0x52f311,_0x2daef1)['trim'](),_0x30058c=buildMetadataHeaderLines({'sqlCode':_0x119d8a[_0x171750(0x218)],'sqlName':_0x119d8a[_0x171750(0x208)],'dbId':_0x119d8a[_0x171750(0x221)],'dbName':_0x155d09?.['dbName'],'mode':_0x2daef1,'syncedAt':_0x155d09?.[_0x171750(0x206)],'description':_0x155d09?.[_0x171750(0x1f7)]},_0x2daef1),_0x48cf81=_0x2daef1==='mybatisXml'?splitXmlDeclaration(_0x3101ed):{'body':_0x3101ed},_0x21c813=[..._0x48cf81[_0x171750(0x209)]?[_0x48cf81[_0x171750(0x209)]]:[],..._0x30058c,'',_0x48cf81[_0x171750(0x21f)]['trimStart']()],_0x389b27=_0x21c813['join']('\x0a');return _0x389b27[_0x171750(0x213)]('\x0a')?_0x389b27:_0x389b27+'\x0a';}export function stripLocalSqlMetadata(_0x540d88,_0x16fa02){const _0x1fce96=a255_0x415646;if(_0x16fa02===_0x1fce96(0x201)){const {declaration:_0x318e3b,body:_0x4c8b41}=splitXmlDeclaration(_0x540d88['replace'](/\r\n/g,'\x0a')),_0x50f8ea=stripLeadingMetadataLines(_0x4c8b41,/^\s*<!--\s*@lovrabet\./);return _0x318e3b?''+_0x318e3b+(_0x50f8ea?'\x0a'+_0x50f8ea:''):_0x50f8ea;}return stripLeadingMetadataLines(_0x540d88[_0x1fce96(0x219)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x48a5de,_0x3b7d8f){const _0x41a7db=a255_0x415646;if(_0x3b7d8f?.[_0x41a7db(0x20a)])return _0x3b7d8f[_0x41a7db(0x20a)];return detectSqlMode(_0x48a5de);}function a255_0x13cc(){const _0x54f9d1=['mybatisXml','close','path','apps','--\x20@lovrabet.','syncedAt','map','sqlName','declaration','mode','trim','join','48XzElBq','sqlConfig','\x20[y/N]\x20','stdin','version','toLowerCase','endsWith','1711650mSCEBN','includes','stderr','filter','sqlCode','replace','1962747binWnR','question','sqlRoot','lastSync','exec','body','4WMXMri','dbId','70deBnFY','197780RxFNqV','yes','sqlContent','9208150XfPLZS','.rabetbase/sql','length','4GABeie','description','slice','dbName','trimStart','sqls','split','556839bWrDmv','3616685lsAFPM','837888eySfVd','<!--\x20@lovrabet.'];a255_0x13cc=function(){return _0x54f9d1;};return a255_0x13cc();}export function resolveSqlFileName(_0x421678,_0xa913cc,_0x3c2dde){const _0x60d45e=a255_0x415646;if(_0x3c2dde?.[_0x60d45e(0x203)])return _0x3c2dde[_0x60d45e(0x203)];if(_0x3c2dde?.[_0x60d45e(0x208)]||_0x3c2dde?.['dbName'])return buildSqlRelativePath(_0x421678,_0x3c2dde?.[_0x60d45e(0x208)],_0x3c2dde?.[_0x60d45e(0x1f9)],resolveSqlMode(_0xa913cc,_0x3c2dde),_0x3c2dde?.['dbId']);return buildDefaultSqlFileName(_0x421678,resolveSqlMode(_0xa913cc,_0x3c2dde));}export function resolveSqlLocalDir(_0x364101,_0x262bcd){return join(_0x364101,SQL_LOCAL_REL_DIR,_0x262bcd);}export async function confirmForceOverwrite(_0x1331d0){const _0xc05662=a255_0x415646,_0x3af6c9=createInterface({'input':process[_0xc05662(0x210)],'output':process[_0xc05662(0x216)]}),_0x1b332b=await new Promise(_0x2b646e=>{const _0x5eec99=_0xc05662;_0x3af6c9[_0x5eec99(0x21b)](_0x1331d0+_0x5eec99(0x20f),_0x2b646e);});return _0x3af6c9[_0xc05662(0x202)](),['y',_0xc05662(0x224)][_0xc05662(0x215)](_0x1b332b['trim']()[_0xc05662(0x212)]());}export function findSqlLockScope(_0x366346,_0x7ef5ed){const _0x1dcb3d=a255_0x415646;return _0x366346[_0x1dcb3d(0x204)][_0x7ef5ed];}function a255_0x2b6b(_0x441513,_0x2cf4ac){_0x441513=_0x441513-0x1f4;const _0x13ccf8=a255_0x13cc();let _0x2b6b5c=_0x13ccf8[_0x441513];return _0x2b6b5c;}function buildMetadataHeaderLines(_0x43bfb0,_0x3b69dc){const _0x4f71b5=a255_0x415646,_0x7206df=[[_0x4f71b5(0x218),_0x43bfb0[_0x4f71b5(0x218)]],[_0x4f71b5(0x208),_0x43bfb0[_0x4f71b5(0x208)]],[_0x4f71b5(0x221),_0x43bfb0[_0x4f71b5(0x221)]],[_0x4f71b5(0x1f9),_0x43bfb0[_0x4f71b5(0x1f9)]],[_0x4f71b5(0x20a),_0x43bfb0['mode']],[_0x4f71b5(0x206),_0x43bfb0[_0x4f71b5(0x206)]],[_0x4f71b5(0x1f7),_0x43bfb0['description']]];if(_0x3b69dc===_0x4f71b5(0x201))return _0x7206df[_0x4f71b5(0x217)](([,_0x418c2d])=>_0x418c2d!==undefined&&_0x418c2d!==null&&String(_0x418c2d)[_0x4f71b5(0x20b)]()!=='')['map'](([_0x57057c,_0x3b3d5c])=>_0x4f71b5(0x200)+_0x57057c+':\x20'+String(_0x3b3d5c)+'\x20-->');return _0x7206df['filter'](([,_0x441b2b])=>_0x441b2b!==undefined&&_0x441b2b!==null&&String(_0x441b2b)[_0x4f71b5(0x20b)]()!=='')[_0x4f71b5(0x207)](([_0x5dbdc1,_0x60abcf])=>_0x4f71b5(0x205)+_0x5dbdc1+':\x20'+String(_0x60abcf));}function splitXmlDeclaration(_0x1ae9fd){const _0x4941c1=a255_0x415646,_0x5bb210=_0x1ae9fd[_0x4941c1(0x1fa)](),_0x5200fb=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x4941c1(0x21e)](_0x5bb210);if(!_0x5200fb)return{'body':_0x1ae9fd};return{'declaration':_0x5200fb[0x0],'body':_0x5bb210['slice'](_0x5200fb[0x0][_0x4941c1(0x1f5)])};}function stripLeadingMetadataLines(_0x4cad22,_0x4305f1){const _0x5a1d83=a255_0x415646,_0x3d2cfd=_0x4cad22[_0x5a1d83(0x1fc)]('\x0a');let _0x4fc8a7=0x0;while(_0x4fc8a7<_0x3d2cfd['length']){const _0x38d1b7=_0x3d2cfd[_0x4fc8a7]??'';if(_0x4305f1['test'](_0x38d1b7)||_0x38d1b7[_0x5a1d83(0x20b)]()===''){_0x4fc8a7++;continue;}break;}return _0x3d2cfd[_0x5a1d83(0x1f8)](_0x4fc8a7)[_0x5a1d83(0x20c)]('\x0a')['trimStart']();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a256_0x3fa12d=a256_0x4ebd;(function(_0x199d48,_0x307ee5){const _0x4919ed=a256_0x4ebd,_0x3abe66=_0x199d48();while(!![]){try{const _0x59219a=-parseInt(_0x4919ed(0xc7))/0x1*(-parseInt(_0x4919ed(0xc5))/0x2)+parseInt(_0x4919ed(0xd7))/0x3*(parseInt(_0x4919ed(0xd4))/0x4)+parseInt(_0x4919ed(0xe1))/0x5*(parseInt(_0x4919ed(0xcc))/0x6)+-parseInt(_0x4919ed(0xd5))/0x7*(-parseInt(_0x4919ed(0xcb))/0x8)+parseInt(_0x4919ed(0xda))/0x9+-parseInt(_0x4919ed(0xc6))/0xa+-parseInt(_0x4919ed(0xdb))/0xb;if(_0x59219a===_0x307ee5)break;else _0x3abe66['push'](_0x3abe66['shift']());}catch(_0xd7ab6c){_0x3abe66['push'](_0x3abe66['shift']());}}}(a256_0x48d4,0x9c610));import{listSqlQueries}from'../../core/api-client.js';function a256_0x4ebd(_0x40a911,_0xe67f2d){_0x40a911=_0x40a911-0xbe;const _0x48d4ce=a256_0x48d4();let _0x4ebd48=_0x48d4ce[_0x40a911];return _0x4ebd48;}function a256_0x48d4(){const _0x175a92=['Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','1099388usVlAs','1330mGRClS','lockFilePath','9hZXfGh','sql','sqlCode','5210064TtxEtT','30820669mUPFfm','appCode','status','\x20remote-only','keys','path','20lRxbta','sqls','boolean','tableData','totalCount','remote','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','filePath','sqlRoot','sqlName','hash','1292978xoAYKM','1198730SXbvFt','1XhkHvO','\x20added,\x20','length','lockKey','19912jkCDQj','1559166Njlnjy','bool','map','has','push','\x20missing,\x20','paging'];a256_0x48d4=function(){return _0x175a92;};return a256_0x48d4();}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(_0x195309){const _0x5dcd3d=a256_0x4ebd,_0x2e2529=[];let _0x9d0502=0x1;while(!![]){const _0x559319=await listSqlQueries(_0x195309,{'currentPage':_0x9d0502,'pageSize':PAGE_SIZE}),_0x1242a6=_0x559319[_0x5dcd3d(0xe4)]??[];_0x2e2529[_0x5dcd3d(0xd0)](..._0x1242a6[_0x5dcd3d(0xce)](_0x394940=>_0x394940[_0x5dcd3d(0xd9)]));if(_0x1242a6[_0x5dcd3d(0xc9)]===0x0)break;const _0x51e3f8=_0x559319[_0x5dcd3d(0xd2)]?.[_0x5dcd3d(0xbe)];if(_0x51e3f8!=null?_0x2e2529[_0x5dcd3d(0xc9)]>=_0x51e3f8:_0x1242a6[_0x5dcd3d(0xc9)]<PAGE_SIZE)break;_0x9d0502++;}return _0x2e2529;}export const sqlStatus={'service':a256_0x3fa12d(0xd8),'command':a256_0x3fa12d(0xdd),'description':a256_0x3fa12d(0xc0),'risk':'read','flags':[{'name':a256_0x3fa12d(0xbf),'type':a256_0x3fa12d(0xe3),'description':a256_0x3fa12d(0xd3)}],async 'execute'(_0x291725){const _0x6ba884=a256_0x3fa12d,_0x3e1825=loadSqlProjectConfig(_0x291725[_0x6ba884(0xdc)]),_0x50f13e=await readSqlLockFile(_0x3e1825[_0x6ba884(0xd6)]),{appLock:_0x461f94}=ensureSqlLockScope(_0x50f13e??createEmptySqlLock(),_0x3e1825['appCode'],_0x3e1825[_0x6ba884(0xc2)],_0x6ba884(0xdd)),_0x2240dd=await scanLocalSqlQueries(_0x3e1825),_0x46e913=[],_0x398cc4=[],_0x23510b=[],_0x12aee2=[],_0x2b50ba=new Set(_0x2240dd[_0x6ba884(0xce)](_0x5125e1=>_0x5125e1['lockKey']));for(const _0x52125f of _0x2240dd){const _0x2e4aee=await computeSqlFileHash(_0x52125f[_0x6ba884(0xc1)]),_0x56bd69=_0x461f94[_0x6ba884(0xe2)][_0x52125f[_0x6ba884(0xca)]],_0xc27b94=!!_0x56bd69&&_0x56bd69[_0x6ba884(0xe0)]!==_0x52125f['relativePath'],_0x5a1ecd=!!_0x56bd69&&!!_0x52125f[_0x6ba884(0xc3)]&&_0x56bd69[_0x6ba884(0xc3)]!==_0x52125f[_0x6ba884(0xc3)];if(!_0x56bd69)_0x46e913[_0x6ba884(0xd0)](_0x52125f['lockKey']);else _0x56bd69[_0x6ba884(0xc4)]!==_0x2e4aee||_0xc27b94||_0x5a1ecd?_0x398cc4['push'](_0x52125f[_0x6ba884(0xca)]):_0x23510b[_0x6ba884(0xd0)](_0x52125f[_0x6ba884(0xca)]);}for(const _0x39ed9e of Object[_0x6ba884(0xdf)](_0x461f94['sqls'])){!_0x2b50ba['has'](_0x39ed9e)&&_0x12aee2['push'](_0x39ed9e);}const _0x46447f=[];if(_0x291725[_0x6ba884(0xcd)]('remote')){const _0x3d8bbe=await fetchAllSqlCodes(_0x291725[_0x6ba884(0xdc)]);for(const _0x4658d0 of _0x3d8bbe){!_0x2b50ba[_0x6ba884(0xcf)](_0x4658d0)&&!_0x461f94[_0x6ba884(0xe2)][_0x4658d0]&&_0x46447f[_0x6ba884(0xd0)](_0x4658d0);}}const _0xce60c5=_0x46e913[_0x6ba884(0xc9)]===0x0&&_0x398cc4['length']===0x0&&_0x12aee2[_0x6ba884(0xc9)]===0x0&&_0x46447f[_0x6ba884(0xc9)]===0x0;return{'ok':!![],'data':{'added':_0x46e913,'modified':_0x398cc4,'missing':_0x12aee2,'unchanged':_0x23510b,'remoteOnly':_0x46447f},'message':_0xce60c5?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x46e913['length']+_0x6ba884(0xc8)+_0x398cc4['length']+'\x20modified,\x20'+_0x12aee2[_0x6ba884(0xc9)]+_0x6ba884(0xd1)+_0x23510b[_0x6ba884(0xc9)]+'\x20unchanged'+(_0x46447f[_0x6ba884(0xc9)]>0x0?',\x20'+_0x46447f[_0x6ba884(0xc9)]+_0x6ba884(0xde):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a257_0x150792=a257_0xa61f;(function(_0x2e52a3,_0x5a396c){const _0x26a7dc=a257_0xa61f,_0x6e1ac=_0x2e52a3();while(!![]){try{const _0x4dd296=parseInt(_0x26a7dc(0xa4))/0x1+-parseInt(_0x26a7dc(0x98))/0x2*(-parseInt(_0x26a7dc(0xc1))/0x3)+-parseInt(_0x26a7dc(0xb2))/0x4*(-parseInt(_0x26a7dc(0xc7))/0x5)+parseInt(_0x26a7dc(0xcf))/0x6+-parseInt(_0x26a7dc(0xa6))/0x7+parseInt(_0x26a7dc(0xce))/0x8+-parseInt(_0x26a7dc(0xb0))/0x9;if(_0x4dd296===_0x5a396c)break;else _0x6e1ac['push'](_0x6e1ac['shift']());}catch(_0x4e1980){_0x6e1ac['push'](_0x6e1ac['shift']());}}}(a257_0x343c,0x1cb68));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a257_0x343c(){const _0x382e5b=['141095klhiSr','validation','push','toLowerCase','length','find','message','925544wlFRnq','218118lZJJgs','Dataset\x20\x22','dbtableConfig','indexes','trim','cwd','isLockingRead','sql','--check-indexes\x20requires\x20--schemas.','isSelectOnly','from','name','check-indexes','18FgCivs','string','schemaWarnings','valid','bool','sqlType','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','dataset','appCode','indexName','split','columns','209179eQPAuj','read','1197511SCmUET','File\x20not\x20found:\x20','boolean','tables','index_columns','index_type','reason','columnNames','pkField','joinAudit','1285785PxEhcq','primary','4ZJYdOd','flatMap','fields','validate','type','\x22\x20not\x20found\x20in\x20any\x20dataset','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','str','Table\x20\x22','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','isArray','filter','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','schemas','schema:','14034MwJFAJ','tableName','map','utf-8','get','isDangerous'];a257_0x343c=function(){return _0x382e5b;};return a257_0x343c();}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';function a257_0xa61f(_0x1c6783,_0x4fd5b2){_0x1c6783=_0x1c6783-0x8e;const _0x343c39=a257_0x343c();let _0xa61f3e=_0x343c39[_0x1c6783];return _0xa61f3e;}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':'sql','command':a257_0x150792(0xb5),'description':a257_0x150792(0x9e),'risk':a257_0x150792(0xa5),'flags':[{'name':'file','type':a257_0x150792(0x99),'description':a257_0x150792(0xbe)},{'name':a257_0x150792(0x92),'type':a257_0x150792(0x99),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':'schemas','type':'string','description':a257_0x150792(0xb8)},{'name':a257_0x150792(0x97),'type':a257_0x150792(0xa8),'description':a257_0x150792(0xbb)}],async 'execute'(_0x51c3ab){const _0x42a669=a257_0x150792,_0x596ec0=_0x51c3ab[_0x42a669(0xb9)]('file'),_0x407daa=_0x51c3ab[_0x42a669(0xb9)](_0x42a669(0x92)),_0xea92b2=_0x51c3ab[_0x42a669(0xb9)](_0x42a669(0xbf)),_0x21f08f=_0x51c3ab[_0x42a669(0x9c)](_0x42a669(0x97));if(!_0x596ec0&&!_0x407daa)throw CliErrors['flagMissing']('file','Provide\x20--file\x20or\x20--sql');if(_0x21f08f&&!_0xea92b2)throw CliErrors[_0x42a669(0xc8)](_0x42a669(0x93));let _0x41dfdd;if(_0x596ec0){const _0x5af768=resolve(process[_0x42a669(0x90)](),_0x596ec0);if(!existsSync(_0x5af768))throw CliErrors[_0x42a669(0xc8)](_0x42a669(0xa7)+_0x5af768);_0x41dfdd=readFileSync(_0x5af768,_0x42a669(0xc4));}else _0x41dfdd=_0x407daa;const _0x1c1726=validateSql(_0x41dfdd),_0x263571={'valid':_0x1c1726[_0x42a669(0x9b)],'sqlType':_0x1c1726[_0x42a669(0x9d)]['type'],'isSelectOnly':_0x1c1726[_0x42a669(0x9d)][_0x42a669(0x94)],'isLockingRead':_0x1c1726['sqlType'][_0x42a669(0x91)]??![],'isDangerous':_0x1c1726[_0x42a669(0x9d)][_0x42a669(0xc6)],'tables':_0x1c1726[_0x42a669(0xa9)],'parameters':_0x1c1726['parameters'],'message':_0x1c1726['message']};_0x1c1726[_0x42a669(0x9d)][_0x42a669(0xac)]&&(_0x263571[_0x42a669(0xac)]=_0x1c1726[_0x42a669(0x9d)][_0x42a669(0xac)]);if(_0xea92b2&&_0x1c1726[_0x42a669(0x9b)]){const _0x4f3a53=_0xea92b2[_0x42a669(0xa2)](',')[_0x42a669(0xc3)](_0x4f6893=>_0x4f6893[_0x42a669(0x8f)]())[_0x42a669(0xbd)](Boolean),_0x12ab66=[],_0xc66b81=[],_0x112039=filterDbTableBackedDatasets(await listDatasets(_0x51c3ab[_0x42a669(0xa0)])),_0x1cd89a=new Map(_0x112039[_0x42a669(0xc3)](_0x3667f4=>[_0x3667f4['dbtableConfig']?.[_0x42a669(0xc2)]?.[_0x42a669(0xca)](),_0x3667f4]));for(const _0x49c698 of _0x1c1726['tables']){const _0x20d571=_0x1cd89a[_0x42a669(0xc5)](_0x49c698['toLowerCase']());!_0x20d571&&_0x12ab66[_0x42a669(0xc9)](_0x42a669(0xba)+_0x49c698+_0x42a669(0xb7));}for(const _0x22db26 of _0x4f3a53){let _0x1b26fc;try{_0x1b26fc=await getDatasetDetail(_0x22db26);}catch{_0x12ab66[_0x42a669(0xc9)](_0x42a669(0xd0)+_0x22db26+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x1b26fc,'SQL\x20schema\x20validation');const _0x51c70b=Array['isArray'](_0x1b26fc[_0x42a669(0xb4)])?_0x1b26fc[_0x42a669(0xb4)]:[],_0x13db34=new Set(_0x51c70b[_0x42a669(0xc3)](_0x1e32ec=>_0x1e32ec[_0x42a669(0x96)]?.[_0x42a669(0xca)]())),_0x5db9c3=_0x1b26fc[_0x42a669(0xd1)]?.['tableName']||_0x1b26fc['tableName']||_0x22db26;_0x263571[_0x42a669(0xc0)+_0x5db9c3]={'code':_0x22db26,'tableName':_0x5db9c3,'fieldCount':_0x13db34['size'],'fields':Array[_0x42a669(0x95)](_0x13db34)};if(_0x21f08f){const _0x2ba50f=normalizeDatasetIndexes(_0x1b26fc);_0xc66b81[_0x42a669(0xc9)]({'tableName':_0x5db9c3,..._0x2ba50f});}}_0x12ab66[_0x42a669(0xcb)]>0x0&&(_0x263571[_0x42a669(0x9a)]=_0x12ab66),_0x21f08f&&(_0x263571[_0x42a669(0xaf)]=auditSqlJoinIndexes(_0x41dfdd,_0xc66b81));}return{'ok':_0x1c1726['valid'],'data':_0x263571,'message':_0x1c1726[_0x42a669(0xcd)]};}};function normalizeDatasetIndexes(_0x228025){const _0x193b91=a257_0x150792,_0x34d67a=Array[_0x193b91(0xbc)](_0x228025?.['dataset']?.['indexes'])?_0x228025[_0x193b91(0x9f)][_0x193b91(0x8e)]:Array[_0x193b91(0xbc)](_0x228025?.['indexes'])?_0x228025[_0x193b91(0x8e)]:[],_0x80c858=_0x34d67a[_0x193b91(0xb3)](_0x306c4d=>{const _0x43f9b7=_0x193b91,_0x223562=Array['isArray'](_0x306c4d?.[_0x43f9b7(0xaa)])?_0x306c4d[_0x43f9b7(0xaa)]:Array[_0x43f9b7(0xbc)](_0x306c4d?.['columnNames'])?_0x306c4d[_0x43f9b7(0xad)]:Array[_0x43f9b7(0xbc)](_0x306c4d?.['columns'])?_0x306c4d[_0x43f9b7(0xa3)]:[],_0x60d03e=_0x223562[_0x43f9b7(0xbd)](_0x20a9cf=>typeof _0x20a9cf===_0x43f9b7(0x99))['map'](_0x39cbf2=>_0x39cbf2[_0x43f9b7(0x8f)]())[_0x43f9b7(0xbd)](Boolean);if(_0x60d03e['length']===0x0)return[];const _0x12e717=[_0x306c4d?.[_0x43f9b7(0xa1)],_0x306c4d?.['index_name'],_0x306c4d?.[_0x43f9b7(0x96)]][_0x43f9b7(0xcc)](_0x28872f=>typeof _0x28872f===_0x43f9b7(0x99)&&_0x28872f[_0x43f9b7(0x8f)]()),_0x4d66af=[_0x306c4d?.[_0x43f9b7(0xab)],_0x306c4d?.[_0x43f9b7(0xb6)]][_0x43f9b7(0xcc)](_0x39b99b=>typeof _0x39b99b===_0x43f9b7(0x99)&&_0x39b99b['trim']());return[{..._0x12e717?{'name':_0x12e717[_0x43f9b7(0x8f)]()}:{},..._0x4d66af?{'type':_0x4d66af[_0x43f9b7(0x8f)]()}:{},'columns':_0x60d03e}];}),_0x2c55aa=[..._0x80c858],_0x2e16fe=typeof _0x228025?.[_0x193b91(0xd1)]?.[_0x193b91(0xae)]===_0x193b91(0x99)?_0x228025['dbtableConfig'][_0x193b91(0xae)][_0x193b91(0xa2)](',')['map'](_0x4d02d5=>_0x4d02d5['trim']())[_0x193b91(0xbd)](Boolean):[];return _0x2e16fe['length']>0x0&&_0x2c55aa['unshift']({'type':_0x193b91(0xb1),'columns':_0x2e16fe}),{'indexes':_0x2c55aa,'metadataAvailable':_0x80c858[_0x193b91(0xcb)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a258_0x4ab7(){const _0x226007=['6656XXwSfz','1256676ODXJDk','1593487LoeBzj','1531065toMRJB','6LBmtBo','3908952iNeZAc','3ImRhAb','98wVtRnR','2262968lldmRu','77EUnBhL','17514uWfikh','490GnHsvS'];a258_0x4ab7=function(){return _0x226007;};return a258_0x4ab7();}(function(_0x2823bc,_0x34b766){const _0x530387=a258_0x56a8,_0x1ac316=_0x2823bc();while(!![]){try{const _0x4bd3c6=-parseInt(_0x530387(0x95))/0x1*(-parseInt(_0x530387(0x8e))/0x2)+parseInt(_0x530387(0x94))/0x3*(-parseInt(_0x530387(0x96))/0x4)+-parseInt(_0x530387(0x91))/0x5*(parseInt(_0x530387(0x92))/0x6)+-parseInt(_0x530387(0x90))/0x7+parseInt(_0x530387(0x93))/0x8+parseInt(_0x530387(0x8c))/0x9*(-parseInt(_0x530387(0x8d))/0xa)+-parseInt(_0x530387(0x8b))/0xb*(-parseInt(_0x530387(0x8f))/0xc);if(_0x4bd3c6===_0x34b766)break;else _0x1ac316['push'](_0x1ac316['shift']());}catch(_0xad1adb){_0x1ac316['push'](_0x1ac316['shift']());}}}(a258_0x4ab7,0x5626a));function a258_0x56a8(_0x1d43ce,_0x553489){_0x1d43ce=_0x1d43ce-0x8b;const _0x4ab784=a258_0x4ab7();let _0x56a8dd=_0x4ab784[_0x1d43ce];return _0x56a8dd;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a259_0x587972=a259_0xe629;function a259_0xe629(_0x4f768b,_0x33d69f){_0x4f768b=_0x4f768b-0x1a0;const _0xe20572=a259_0xe205();let _0xe62962=_0xe20572[_0x4f768b];return _0xe62962;}(function(_0x60db21,_0x2659a7){const _0xd33c16=a259_0xe629,_0x387462=_0x60db21();while(!![]){try{const _0x210bd6=-parseInt(_0xd33c16(0x1a0))/0x1+parseInt(_0xd33c16(0x1b2))/0x2*(-parseInt(_0xd33c16(0x1ae))/0x3)+parseInt(_0xd33c16(0x1a5))/0x4+-parseInt(_0xd33c16(0x1a4))/0x5*(parseInt(_0xd33c16(0x1a3))/0x6)+-parseInt(_0xd33c16(0x1ac))/0x7*(-parseInt(_0xd33c16(0x1b1))/0x8)+parseInt(_0xd33c16(0x1af))/0x9*(parseInt(_0xd33c16(0x1b5))/0xa)+-parseInt(_0xd33c16(0x1ab))/0xb*(-parseInt(_0xd33c16(0x1a2))/0xc);if(_0x210bd6===_0x2659a7)break;else _0x387462['push'](_0x387462['shift']());}catch(_0x34fae2){_0x387462['push'](_0x387462['shift']());}}}(a259_0xe205,0xb95db));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';function a259_0xe205(){const _0x3692d6=['Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','apiError','taskId','task-id','string','10032682CQnvjn','49AEJDgS',',\x20received\x20','3FMSZpN','12881340EmOlGR','appCode','1274744AeheOi','681402JPPJLq','status','str','10DRUOsc','read','1425726MnQWlv','trim','12PnEClI','24vUqXdD','1410445bZPACO','781276LfYtOI'];a259_0xe205=function(){return _0x3692d6;};return a259_0xe205();}import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':a259_0x587972(0x1b3),'description':a259_0x587972(0x1a6),'risk':a259_0x587972(0x1b6),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a259_0x587972(0x1a9),'type':a259_0x587972(0x1aa),'required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x11c90a){const _0x3260e3=a259_0x587972;if(!_0x11c90a[_0x3260e3(0x1b4)](_0x3260e3(0x1a9))[_0x3260e3(0x1a1)]())throw CliErrors['flagMissing'](_0x3260e3(0x1a9));},async 'execute'(_0x39fc3f){const _0x377984=a259_0x587972,_0x5b34ff=_0x39fc3f['str'](_0x377984(0x1a9))[_0x377984(0x1a1)](),_0x41f539=normalizeAsyncTask(await getAsyncTaskStatus(_0x5b34ff,_0x39fc3f[_0x377984(0x1b0)],_0x39fc3f['cookie']));if(_0x41f539[_0x377984(0x1a8)]!==_0x5b34ff)throw CliErrors[_0x377984(0x1a7)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x5b34ff+_0x377984(0x1ad)+_0x41f539[_0x377984(0x1a8)]+'.');const _0x1759dd=buildAsyncTaskStatusCommand(_0x41f539[_0x377984(0x1a8)],_0x39fc3f['appCode']);return{'ok':!![],'message':asyncTaskMessage(_0x41f539),'data':{'appCode':_0x39fc3f['appCode'],..._0x41f539,'query':_0x41f539['isTerminal']?null:{'command':_0x1759dd}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3ece90,_0x3d09bd){const _0x43549f=a260_0x1512,_0x447ec5=_0x3ece90();while(!![]){try{const _0xab374b=-parseInt(_0x43549f(0x1a3))/0x1*(-parseInt(_0x43549f(0x1a8))/0x2)+-parseInt(_0x43549f(0x1a4))/0x3+-parseInt(_0x43549f(0x1a6))/0x4+parseInt(_0x43549f(0x1a7))/0x5*(parseInt(_0x43549f(0x1a2))/0x6)+-parseInt(_0x43549f(0x1a5))/0x7+parseInt(_0x43549f(0x1a1))/0x8+parseInt(_0x43549f(0x1a9))/0x9;if(_0xab374b===_0x3d09bd)break;else _0x447ec5['push'](_0x447ec5['shift']());}catch(_0x539c98){_0x447ec5['push'](_0x447ec5['shift']());}}}(a260_0x20fa,0x23947));function a260_0x1512(_0x263fbc,_0x4c9f96){_0x263fbc=_0x263fbc-0x1a1;const _0x20fa84=a260_0x20fa();let _0x15121c=_0x20fa84[_0x263fbc];return _0x15121c;}function a260_0x20fa(){const _0x23303d=['34908deKNfH','341442oRszJR','2231376IveziK','512076IfMpWK','10JOJhuf','658422TylPeQ','1547966iovNBA','644364ByUQWl','15mZIVSf'];a260_0x20fa=function(){return _0x23303d;};return a260_0x20fa();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a261_0x4b33c4=a261_0x21c0;function a261_0x21c0(_0x1576b6,_0xd18dee){_0x1576b6=_0x1576b6-0x171;const _0x4190f9=a261_0x4190();let _0x21c0ac=_0x4190f9[_0x1576b6];return _0x21c0ac;}(function(_0x288b55,_0x5332c5){const _0x446352=a261_0x21c0,_0x500242=_0x288b55();while(!![]){try{const _0x8c10d4=parseInt(_0x446352(0x184))/0x1+-parseInt(_0x446352(0x173))/0x2*(-parseInt(_0x446352(0x176))/0x3)+parseInt(_0x446352(0x17f))/0x4+parseInt(_0x446352(0x175))/0x5+parseInt(_0x446352(0x17e))/0x6+parseInt(_0x446352(0x183))/0x7+-parseInt(_0x446352(0x182))/0x8;if(_0x8c10d4===_0x5332c5)break;else _0x500242['push'](_0x500242['shift']());}catch(_0x3aedb7){_0x500242['push'](_0x500242['shift']());}}}(a261_0x4190,0x4ce14));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a261_0x4190(){const _0x495be2=['407069IMDdGt','members-list','string','84SOTTIE','length','127535veclKG','40947SiJkjv','str','\x20tenant\x20member(s)','Pass\x20--tenant-code\x20<code>.','Exact\x20tenant\x20code','tenant-code','read','trim','619680hLMCEM','2219324NfEsRX','flagMissing','Found\x20','11016296TVqulQ','195944oZdlYQ'];a261_0x4190=function(){return _0x495be2;};return a261_0x4190();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':'tenant','command':a261_0x4b33c4(0x171),'description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':a261_0x4b33c4(0x17c),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'tenant-code','type':a261_0x4b33c4(0x172),'required':!![],'description':a261_0x4b33c4(0x17a)}],async 'validate'(_0x344296){const _0x447397=a261_0x4b33c4;if(!_0x344296[_0x447397(0x177)](_0x447397(0x17b))[_0x447397(0x17d)]())throw CliErrors[_0x447397(0x180)](_0x447397(0x17b),_0x447397(0x179));},async 'execute'(_0x586921){const _0x4b1897=a261_0x4b33c4,_0x1f4ba3=_0x586921[_0x4b1897(0x177)](_0x4b1897(0x17b))[_0x4b1897(0x17d)](),_0x308d1b=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x1f4ba3,_0x308d1b);const _0x6cc5a8=projectTenantMembers(await listTenantDirectoryMembers(_0x1f4ba3));return{'ok':!![],'data':{'tenantCode':_0x1f4ba3,'items':_0x6cc5a8,'totalCount':_0x6cc5a8[_0x4b1897(0x174)]},'message':_0x4b1897(0x181)+_0x6cc5a8[_0x4b1897(0x174)]+_0x4b1897(0x178)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x257a21,_0x2071d5){const _0x5d0ef5=a262_0x5568,_0x136bdc=_0x257a21();while(!![]){try{const _0x5b80ad=parseInt(_0x5d0ef5(0x1d3))/0x1*(-parseInt(_0x5d0ef5(0x1ba))/0x2)+-parseInt(_0x5d0ef5(0x1ca))/0x3*(-parseInt(_0x5d0ef5(0x1cd))/0x4)+parseInt(_0x5d0ef5(0x1bb))/0x5+parseInt(_0x5d0ef5(0x1bc))/0x6*(parseInt(_0x5d0ef5(0x1cf))/0x7)+parseInt(_0x5d0ef5(0x1bd))/0x8+-parseInt(_0x5d0ef5(0x1c7))/0x9+parseInt(_0x5d0ef5(0x1c6))/0xa;if(_0x5b80ad===_0x2071d5)break;else _0x136bdc['push'](_0x136bdc['shift']());}catch(_0x5d41ba){_0x136bdc['push'](_0x136bdc['shift']());}}}(a262_0xd43c,0x95f3c));function a262_0xd43c(){const _0x23be53=['adminFlag','username','8290040fEQHMq','8491068lQqAvP','Tenant\x20\x22','values','251358VwSbhf','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','sort','20DqzFHC','userId','37079iWIVIj','tenantCode','displayName','role','19990QnkXHF','status','get','24qmSlRZ','1022750OImZGV','192HgzvTr','1404384OwqCVc','MEMBER','set','ADMIN','trim','validation','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.'];a262_0xd43c=function(){return _0x23be53;};return a262_0xd43c();}import{CliErrors}from'../../errors.js';function textOrNull(_0x297609){const _0x1eb078=a262_0x5568,_0x370948=_0x297609?.[_0x1eb078(0x1c1)]();return _0x370948?_0x370948:null;}export function projectTenantMembers(_0x294a9a){const _0x984bdc=a262_0x5568,_0x3eb9e4=new Map();for(const _0x7733b8 of _0x294a9a){const _0x17e412=Number(_0x7733b8[_0x984bdc(0x1ce)]);if(!Number['isFinite'](_0x17e412)||_0x17e412<=0x0)continue;const _0x5dca27={'userId':_0x17e412,'username':textOrNull(_0x7733b8[_0x984bdc(0x1c5)]),'displayName':textOrNull(_0x7733b8['nickname']),'role':_0x7733b8[_0x984bdc(0x1c4)]===!![]?_0x984bdc(0x1c0):_0x984bdc(0x1be),'status':textOrNull(_0x7733b8[_0x984bdc(0x1d4)])},_0x1ab522=_0x3eb9e4[_0x984bdc(0x1d5)](_0x17e412);if(!_0x1ab522){_0x3eb9e4[_0x984bdc(0x1bf)](_0x17e412,_0x5dca27);continue;}_0x1ab522[_0x984bdc(0x1c5)]??=_0x5dca27[_0x984bdc(0x1c5)],_0x1ab522[_0x984bdc(0x1d1)]??=_0x5dca27[_0x984bdc(0x1d1)],_0x1ab522['status']??=_0x5dca27['status'];if(_0x5dca27[_0x984bdc(0x1d2)]===_0x984bdc(0x1c0))_0x1ab522[_0x984bdc(0x1d2)]=_0x984bdc(0x1c0);}return[..._0x3eb9e4[_0x984bdc(0x1c9)]()][_0x984bdc(0x1cc)]((_0x160f96,_0x236475)=>_0x160f96[_0x984bdc(0x1ce)]-_0x236475['userId']);}function a262_0x5568(_0x10fe8e,_0x308253){_0x10fe8e=_0x10fe8e-0x1ba;const _0xd43c0f=a262_0xd43c();let _0x5568fc=_0xd43c0f[_0x10fe8e];return _0x5568fc;}export function assertTenantAccessible(_0x1a03dc,_0x48aa07){const _0x5717a9=a262_0x5568;if(_0x48aa07['some'](_0x320e02=>_0x320e02[_0x5717a9(0x1d0)]===_0x1a03dc))return;throw CliErrors[_0x5717a9(0x1c2)](_0x5717a9(0x1c8)+_0x1a03dc+_0x5717a9(0x1c3),_0x5717a9(0x1cb));}
|