@lovrabet/rabetbase-cli 2.5.10-beta.4 → 2.5.10-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/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/context.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/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/instant-api-policy/endpoints.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/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 +4 -4
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a248_0x575f(){const _0x3a4dcb=['projectRoot','fromEntries','331173LONbqq','startsWith','518422vnMCai','6heNhIE','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','toISOString','trashDir','high-risk-write','125762HjeYeH','50SCzMUL','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','sqlRoot','sql','sqlRootDir','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','12446652sRyDPl','lastSync','\x20(local\x20file\x20moved\x20to\x20trash)','SQL\x20lock\x20file\x20not\x20found.','str','sqls','120jyZzvu','11TOBUqn','filter','trashedTo','Would\x20delete\x20SQL\x20','sqlcode','8UqIfkr','validation','lockFilePath','643244nTAmGw','appCode','/smartapi/custom/deleteUserCustomSql','delete','entries','1727173KBjZcY','247566mpDtyP'];a248_0x575f=function(){return _0x3a4dcb;};return a248_0x575f();}const a248_0x4d6263=a248_0x2fbc;(function(_0x39be5d,_0x3040f1){const _0x5327c8=a248_0x2fbc,_0x16665b=_0x39be5d();while(!![]){try{const _0x285e4c=parseInt(_0x5327c8(0x140))/0x1+parseInt(_0x5327c8(0x13a))/0x2*(-parseInt(_0x5327c8(0x13b))/0x3)+-parseInt(_0x5327c8(0x156))/0x4+parseInt(_0x5327c8(0x141))/0x5*(-parseInt(_0x5327c8(0x135))/0x6)+-parseInt(_0x5327c8(0x134))/0x7*(parseInt(_0x5327c8(0x153))/0x8)+parseInt(_0x5327c8(0x138))/0x9*(parseInt(_0x5327c8(0x14d))/0xa)+-parseInt(_0x5327c8(0x14e))/0xb*(-parseInt(_0x5327c8(0x147))/0xc);if(_0x285e4c===_0x3040f1)break;else _0x16665b['push'](_0x16665b['shift']());}catch(_0x4dd7c6){_0x16665b['push'](_0x16665b['shift']());}}}(a248_0x575f,0x40eed));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a248_0x2fbc(_0x4680ba,_0x2d9859){_0x4680ba=_0x4680ba-0x133;const _0x575fa4=a248_0x575f();let _0x2fbc44=_0x575fa4[_0x4680ba];return _0x2fbc44;}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_0x4d6263(0x144),'command':'delete','description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a248_0x4d6263(0x13f),'flags':[SQLCODE_FLAG],async 'validate'(_0x41d0fb){const _0x1aed66=a248_0x4d6263,_0x1d416d=loadSqlProjectConfig(_0x41d0fb[_0x1aed66(0x157)]),_0x1d4b0c=await readSqlLockFile(_0x1d416d['lockFilePath']);if(!_0x1d4b0c)throw CliErrors[_0x1aed66(0x154)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x570e3b){const _0x2fb836=a248_0x4d6263,_0x59da79=loadSqlProjectConfig(_0x570e3b[_0x2fb836(0x157)]),_0x3b114b=await readSqlLockFile(_0x59da79[_0x2fb836(0x155)]);if(!_0x3b114b)throw CliErrors[_0x2fb836(0x154)](_0x2fb836(0x13c));const {appLock:_0x21a5cb}=ensureSqlLockScope(_0x3b114b,_0x570e3b[_0x2fb836(0x157)],_0x59da79[_0x2fb836(0x143)],'delete'),_0x2a3c62=_0x570e3b[_0x2fb836(0x14b)](_0x2fb836(0x152)),_0x4fbf62=_0x21a5cb[_0x2fb836(0x14c)][_0x2a3c62];if(!_0x4fbf62)throw CliErrors['validation'](_0x2fb836(0x146)+_0x2a3c62+'\x22.');return{'method':'POST','url':_0x2fb836(0x158),'body':{'sqlCode':_0x2a3c62,'id':_0x4fbf62['remoteId'],'localPath':resolveLocalSqlFilePath(_0x59da79,_0x2a3c62,_0x4fbf62)},'description':_0x2fb836(0x151)+_0x2a3c62+_0x2fb836(0x142)+_0x59da79['trashDir']};},async 'execute'(_0x4aefd5){const _0x4ede1d=a248_0x4d6263,_0x1cce52=loadSqlProjectConfig(_0x4aefd5[_0x4ede1d(0x157)]),_0x13683d=await readSqlLockFile(_0x1cce52[_0x4ede1d(0x155)]);if(!_0x13683d)throw CliErrors[_0x4ede1d(0x154)](_0x4ede1d(0x14a));const {lockData:_0x256e10,appLock:_0x50a10b}=ensureSqlLockScope(_0x13683d,_0x4aefd5[_0x4ede1d(0x157)],_0x1cce52[_0x4ede1d(0x143)],_0x4ede1d(0x159)),_0x2a54de=_0x4aefd5['str'](_0x4ede1d(0x152)),_0x597679=_0x50a10b[_0x4ede1d(0x14c)][_0x2a54de];if(!_0x597679)throw CliErrors[_0x4ede1d(0x154)](_0x4ede1d(0x146)+_0x2a54de+'\x22.');await deleteSqlQuery({'id':_0x597679['remoteId'],'sqlCode':_0x2a54de}),_0x50a10b[_0x4ede1d(0x14c)]=Object[_0x4ede1d(0x137)](Object[_0x4ede1d(0x133)](_0x50a10b[_0x4ede1d(0x14c)])[_0x4ede1d(0x14f)](([_0x4920fe])=>_0x4920fe!==_0x2a54de)),_0x50a10b[_0x4ede1d(0x148)]=new Date()[_0x4ede1d(0x13d)](),await writeSqlLockFile(_0x1cce52[_0x4ede1d(0x155)],_0x256e10);const _0x4f941e=resolveLocalSqlFilePath(_0x1cce52,_0x2a54de,_0x597679);let _0xda10a3;await fileExists(_0x4f941e)&&(_0xda10a3=await moveToTrash(_0x1cce52[_0x4ede1d(0x136)],_0x1cce52[_0x4ede1d(0x13e)],_0x4f941e),await cleanupEmptyDirectories(dirname(_0x4f941e),_0x1cce52[_0x4ede1d(0x145)]));const _0x19da80={'deleted':_0x2a54de,'remoteId':_0x597679['remoteId']};if(_0xda10a3)_0x19da80[_0x4ede1d(0x150)]=_0xda10a3;return{'ok':!![],'data':_0x19da80,'message':'Deleted\x20'+_0x2a54de+(_0xda10a3?_0x4ede1d(0x149):'')};}};async function moveToTrash(_0x7f5baa,_0x2de485,_0x4dd305){const _0x46a0a3=a248_0x4d6263,_0x22afbc=new Date()[_0x46a0a3(0x13d)]()['replace'](/[:.]/g,'-'),_0x48e3ae=relative(_0x7f5baa,_0x4dd305),_0x191960=join(_0x2de485,_0x22afbc,_0x48e3ae);return await mkdir(dirname(_0x191960),{'recursive':!![]}),await rename(_0x4dd305,_0x191960),_0x191960;}async function cleanupEmptyDirectories(_0x103ab1,_0x129944){const _0xab5139=a248_0x4d6263;let _0x2d6a46=resolve(_0x103ab1);const _0x1e1006=resolve(_0x129944);while(_0x2d6a46[_0xab5139(0x139)](''+_0x1e1006+sep)||_0x2d6a46===_0x1e1006){if(_0x2d6a46===_0x1e1006)return;try{const _0x50f3bf=await readdir(_0x2d6a46);if(_0x50f3bf['length']>0x0)return;await rmdir(_0x2d6a46);}catch{return;}_0x2d6a46=dirname(_0x2d6a46);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a249_0x40f535=a249_0x151e;(function(_0xef9b19,_0xb508cc){const _0x3b3dc0=a249_0x151e,_0x106778=_0xef9b19();while(!![]){try{const _0x39c62e=parseInt(_0x3b3dc0(0x1c7))/0x1+-parseInt(_0x3b3dc0(0x1bc))/0x2+-parseInt(_0x3b3dc0(0x1c0))/0x3*(parseInt(_0x3b3dc0(0x1ca))/0x4)+parseInt(_0x3b3dc0(0x1c5))/0x5*(parseInt(_0x3b3dc0(0x1cc))/0x6)+parseInt(_0x3b3dc0(0x1c4))/0x7*(parseInt(_0x3b3dc0(0x1b8))/0x8)+-parseInt(_0x3b3dc0(0x1be))/0x9+parseInt(_0x3b3dc0(0x1bd))/0xa*(parseInt(_0x3b3dc0(0x1c8))/0xb);if(_0x39c62e===_0xb508cc)break;else _0x106778['push'](_0x106778['shift']());}catch(_0x9f3456){_0x106778['push'](_0x106778['shift']());}}}(a249_0x4fea,0xa7e52));import{getSqlQueryInfo}from'../../core/api-client.js';function a249_0x151e(_0x11b6cf,_0x4dc7a6){_0x11b6cf=_0x11b6cf-0x1b6;const _0x4feade=a249_0x4fea();let _0x151e57=_0x4feade[_0x11b6cf];return _0x151e57;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a249_0x40f535(0x1b9),'risk':a249_0x40f535(0x1bb),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a249_0x40f535(0x1b7),'description':a249_0x40f535(0x1c6)}],async 'execute'(_0x29a69b){const _0x28a32c=a249_0x40f535,_0xf28ee9=await getSqlQueryInfo(_0x29a69b[_0x28a32c(0x1bf)],_0x29a69b[_0x28a32c(0x1c9)](_0x28a32c(0x1c1))),_0x1c6af8=_0x29a69b[_0x28a32c(0x1cb)](_0x28a32c(0x1b6));if(_0x1c6af8)return{'ok':!![],'data':_0xf28ee9};const _0x49e360=_0xf28ee9[_0x28a32c(0x1c2)]?await getDbName(_0x29a69b['appCode'],_0xf28ee9[_0x28a32c(0x1c2)]):undefined;return{'ok':!![],'data':{'sqlCode':_0xf28ee9[_0x28a32c(0x1ba)],'sqlName':_0xf28ee9['sqlName'],'db':_0x49e360?_0x49e360+'\x20('+_0xf28ee9[_0x28a32c(0x1c2)]+')':_0xf28ee9[_0x28a32c(0x1c2)]??'','description':_0xf28ee9[_0x28a32c(0x1c3)]??'','sqlContent':_0xf28ee9['sqlContent']??''}};}};function a249_0x4fea(){const _0x2568b5=['21gPJlKZ','40320BJYwuA','Return\x20full\x20raw\x20SQL\x20query\x20object','516682FUyFtI','8109266QIOqyB','str','3946532vsXTJx','bool','774eKvKmu','verbose','boolean','1681472qzCthI','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlCode','read','2101716kCbgaX','20xuwPUw','8430417HtlFkm','appCode','3FishIX','sqlcode','dbId','description'];a249_0x4fea=function(){return _0x2568b5;};return a249_0x4fea();}
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x674753=a250_0x3374;(function(_0x369f2a,_0x17037f){const _0xbbf324=a250_0x3374,_0x1c924a=_0x369f2a();while(!![]){try{const _0x378623=-parseInt(_0xbbf324(0xf3))/0x1+-parseInt(_0xbbf324(0xff))/0x2+-parseInt(_0xbbf324(0x106))/0x3+-parseInt(_0xbbf324(0xfd))/0x4+parseInt(_0xbbf324(0xf6))/0x5*(parseInt(_0xbbf324(0x101))/0x6)+parseInt(_0xbbf324(0x108))/0x7*(-parseInt(_0xbbf324(0xf9))/0x8)+-parseInt(_0xbbf324(0xf8))/0x9*(-parseInt(_0xbbf324(0x109))/0xa);if(_0x378623===_0x17037f)break;else _0x1c924a['push'](_0x1c924a['shift']());}catch(_0x16602c){_0x1c924a['push'](_0x1c924a['shift']());}}}(a250_0x4a55,0x470c3));function a250_0x4a55(){const _0x3c9c09=['now','1916184tkoHut','execSuccess','string','params','str','215754wvOnmd','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','358806OCnoGC','80GXmnuG','Returned\x20','SQL\x20execution\x20failed','sql','appCode','50002xDNKrF','execError','sqlcode','5jipcEc','execResult','1120617jVxiQb','8pOQfYQ','length','exec','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','1467316Inglrl','read','968900kmpgpc'];a250_0x4a55=function(){return _0x3c9c09;};return a250_0x4a55();}import{executeSql}from'../../core/api-client.js';function a250_0x3374(_0x4fe8d1,_0x2329d4){_0x4fe8d1=_0x4fe8d1-0xf2;const _0x4a5509=a250_0x4a55();let _0x3374b2=_0x4a5509[_0x4fe8d1];return _0x3374b2;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a250_0x674753(0x10c),'command':a250_0x674753(0xfb),'description':a250_0x674753(0xfc),'risk':a250_0x674753(0xfe),'flags':[SQLCODE_FLAG,{'name':a250_0x674753(0x104),'type':a250_0x674753(0x103),'description':a250_0x674753(0x107)}],async 'execute'(_0x1e1318){const _0x579a3b=a250_0x674753,_0x3cd85e=parseJsonParams(_0x1e1318[_0x579a3b(0x105)](_0x579a3b(0x104))),_0x3e6f49=Date[_0x579a3b(0x100)](),_0x4958cb=await executeSql(_0x1e1318[_0x579a3b(0xf2)],_0x1e1318[_0x579a3b(0x105)](_0x579a3b(0xf5)),_0x3cd85e),_0x182edf=Date[_0x579a3b(0x100)]()-_0x3e6f49,_0x464005=_0x4958cb?.[_0x579a3b(0xf7)]??_0x4958cb,_0x2b2e6e=_0x4958cb?.[_0x579a3b(0x102)]??!![];if(!_0x2b2e6e)return{'ok':![],'data':{'error':_0x4958cb?.[_0x579a3b(0xf4)]||_0x579a3b(0x10b),'elapsed':_0x182edf},'message':_0x579a3b(0x10b)};const _0x2c7aa5=Array['isArray'](_0x464005)?_0x464005:[];return{'ok':!![],'data':{'rows':_0x2c7aa5,'rowCount':_0x2c7aa5[_0x579a3b(0xfa)],'elapsed':_0x182edf},'message':_0x579a3b(0x10a)+_0x2c7aa5[_0x579a3b(0xfa)]+'\x20row(s)\x20in\x20'+_0x182edf+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1edbc3,_0x339986){const _0x3b2885=a251_0x4eb1,_0x2e4e20=_0x1edbc3();while(!![]){try{const _0xebe2ed=-parseInt(_0x3b2885(0xcd))/0x1+-parseInt(_0x3b2885(0xca))/0x2+-parseInt(_0x3b2885(0xd2))/0x3*(-parseInt(_0x3b2885(0xd1))/0x4)+-parseInt(_0x3b2885(0xcc))/0x5+-parseInt(_0x3b2885(0xcf))/0x6+-parseInt(_0x3b2885(0xc9))/0x7*(-parseInt(_0x3b2885(0xce))/0x8)+-parseInt(_0x3b2885(0xcb))/0x9*(-parseInt(_0x3b2885(0xd0))/0xa);if(_0xebe2ed===_0x339986)break;else _0x2e4e20['push'](_0x2e4e20['shift']());}catch(_0x480759){_0x2e4e20['push'](_0x2e4e20['shift']());}}}(a251_0x23b5,0x3b3fb));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_0x4eb1(_0x252ade,_0x3c65e2){_0x252ade=_0x252ade-0xc9;const _0x23b54d=a251_0x23b5();let _0x4eb13c=_0x23b54d[_0x252ade];return _0x4eb13c;}function a251_0x23b5(){const _0x4df9eb=['469605iBQVCY','14956xUdpTe','16IqMjkx','2399688DCqhWA','66990gszTSd','8tyLVFC','632475OmNRCZ','1467683dxNmJa','915850uwplHg','495rEslIb'];a251_0x23b5=function(){return _0x4df9eb;};return a251_0x23b5();}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a252_0x1148(){const _0x305b87=['sql','list','370568wFQBFB','1918434SNHTsg','4GVizFd','6795265ZJbuCQ','map','43qVJBkx','str','sqlcode','paging','sqlName','Page\x20number','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','bool','33266wtwwNB','Page\x20size','name','length','1176ihdvod','dbId','236247JFrhbt','pagesize','boolean','all','number','30XrPPIG','2201022QxtzXx','appCode','177697KpPwCu','Found\x20','sqlCode','page','\x20SQL\x20queries\x20(total:\x20','read','totalCount','string','description','12hVYyYc','num','261bZpItC','verbose','List\x20custom\x20SQL\x20queries'];a252_0x1148=function(){return _0x305b87;};return a252_0x1148();}const a252_0x27c770=a252_0x1a2d;(function(_0x394e7d,_0x503c42){const _0x1a2475=a252_0x1a2d,_0x5c29cc=_0x394e7d();while(!![]){try{const _0xa13f71=-parseInt(_0x1a2475(0x97))/0x1*(parseInt(_0x1a2475(0x9f))/0x2)+parseInt(_0x1a2475(0x80))/0x3+-parseInt(_0x1a2475(0x94))/0x4*(parseInt(_0x1a2475(0x95))/0x5)+parseInt(_0x1a2475(0x8b))/0x6*(-parseInt(_0x1a2475(0x93))/0x7)+-parseInt(_0x1a2475(0x92))/0x8*(-parseInt(_0x1a2475(0x8d))/0x9)+parseInt(_0x1a2475(0x7f))/0xa*(-parseInt(_0x1a2475(0x7a))/0xb)+-parseInt(_0x1a2475(0x78))/0xc*(-parseInt(_0x1a2475(0x82))/0xd);if(_0xa13f71===_0x503c42)break;else _0x5c29cc['push'](_0x5c29cc['shift']());}catch(_0x2ae98d){_0x5c29cc['push'](_0x5c29cc['shift']());}}}(a252_0x1148,0xb2276));import{listSqlQueries}from'../../core/api-client.js';function a252_0x1a2d(_0x5032c9,_0x365b2b){_0x5032c9=_0x5032c9-0x75;const _0x1148df=a252_0x1148();let _0x1a2d1b=_0x1148df[_0x5032c9];return _0x1a2d1b;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x27c770(0x90),'command':a252_0x27c770(0x91),'description':a252_0x27c770(0x8f),'risk':a252_0x27c770(0x87),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x27c770(0x76),'type':a252_0x27c770(0x89),'description':'Filter\x20by\x20SQL\x20name'},{'name':a252_0x27c770(0x85),'type':a252_0x27c770(0x7e),'description':a252_0x27c770(0x9c),'default':0x1},{'name':a252_0x27c770(0x7b),'type':a252_0x27c770(0x7e),'description':a252_0x27c770(0x75)},{'name':a252_0x27c770(0x8e),'type':a252_0x27c770(0x7c),'description':a252_0x27c770(0x9d)}],async 'execute'(_0x30362f){const _0x164e8f=a252_0x27c770,_0x1d3c86=await listSqlQueries(_0x30362f[_0x164e8f(0x81)],{'sqlCode':_0x30362f[_0x164e8f(0x98)](_0x164e8f(0x99))||undefined,'sqlName':_0x30362f['str'](_0x164e8f(0x76))||undefined,'currentPage':_0x30362f[_0x164e8f(0x8c)](_0x164e8f(0x85)),'pageSize':_0x30362f[_0x164e8f(0x8c)](_0x164e8f(0x7b),0x32)}),_0x535c49=_0x30362f[_0x164e8f(0x9e)](_0x164e8f(0x8e)),_0x41b966=_0x1d3c86['tableData']??[],_0x4e385c=_0x1d3c86[_0x164e8f(0x9a)]?.[_0x164e8f(0x88)]??_0x41b966['length'];let _0x33bffc;return _0x535c49?_0x33bffc=_0x41b966:_0x33bffc=await Promise[_0x164e8f(0x7d)](_0x41b966[_0x164e8f(0x96)](async _0x197243=>{const _0x948a8c=_0x164e8f;let _0x36e81b;try{_0x36e81b=_0x197243['dbId']?await getDbName(_0x30362f[_0x948a8c(0x81)],_0x197243[_0x948a8c(0x79)]):undefined;}catch{}return{'sqlCode':_0x197243[_0x948a8c(0x84)],'sqlName':_0x197243[_0x948a8c(0x9b)],'description':_0x197243[_0x948a8c(0x8a)]??'','db':_0x36e81b?_0x36e81b+'\x20('+_0x197243[_0x948a8c(0x79)]+')':_0x197243[_0x948a8c(0x79)]??''};})),{'ok':!![],'data':_0x33bffc,'message':_0x41b966[_0x164e8f(0x77)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x164e8f(0x83)+_0x41b966[_0x164e8f(0x77)]+_0x164e8f(0x86)+_0x4e385c+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a253_0x339f30=a253_0x14a5;function a253_0x14a5(_0x134164,_0x58e63a){_0x134164=_0x134164-0xaf;const _0x32ae3a=a253_0x32ae();let _0x14a585=_0x32ae3a[_0x134164];return _0x14a585;}(function(_0x59485c,_0xee4008){const _0x52d428=a253_0x14a5,_0x139b77=_0x59485c();while(!![]){try{const _0x1c24c7=parseInt(_0x52d428(0xe5))/0x1+parseInt(_0x52d428(0xd3))/0x2+parseInt(_0x52d428(0xf8))/0x3*(-parseInt(_0x52d428(0xe6))/0x4)+parseInt(_0x52d428(0xf6))/0x5*(-parseInt(_0x52d428(0xec))/0x6)+-parseInt(_0x52d428(0xef))/0x7+-parseInt(_0x52d428(0xaf))/0x8+parseInt(_0x52d428(0xbf))/0x9;if(_0x1c24c7===_0xee4008)break;else _0x139b77['push'](_0x139b77['shift']());}catch(_0x4b0f9c){_0x139b77['push'](_0x139b77['shift']());}}}(a253_0x32ae,0x67a93));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';function a253_0x32ae(){const _0xeaaecb=['catch','join','toLowerCase','POST','668900ICxVQq','425332zVVjFN','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','message','path','nonInteractive','content','18ryGhop','\x20written,\x20','replace','4716502vXBWeh','sqls','would_pull','local\x20differs\x20from\x20remote','isCanonical','dbId','.xml','454015QLaQPT','name','15IuZKKl','sqlName','2760536XvNYDr','mode','lockFilePath','equivalent','some','length','\x20skipped,\x20','Filter\x20by\x20SQL\x20display\x20name','sqlcode','toISOString','find','str','cancelled','string','paging','all','8464338CoUpbr','pull','tableData','Pull\x20complete:\x20','trim','sqlRoot','sqlRootDir','unchanged','appCode','description','hash','apps','split','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Force\x20overwrite\x20local\x20unsynced\x20changes','utf8','totalCount','\x20SQL\x20file(s)\x20into\x20','file','mybatisXml','1276280dieLOK','\x20failed','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlCode','read','sql','skipped','map','test','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlContent','endsWith','Would\x20pull\x20','push'];a253_0x32ae=function(){return _0xeaaecb;};return a253_0x32ae();}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(_0x188a2c,_0x514fba){const _0x3dda85=a253_0x14a5,_0x4186b4=[];let _0x2758ac=0x1;while(!![]){const _0x1aaba1=await listSqlQueries(_0x188a2c,{'currentPage':_0x2758ac,'pageSize':PAGE_SIZE,'sqlCode':_0x514fba[_0x3dda85(0xd6)],'sqlName':_0x514fba[_0x3dda85(0xf9)]}),_0x27a8eb=_0x1aaba1[_0x3dda85(0xc1)]??[];_0x4186b4[_0x3dda85(0xe0)](..._0x27a8eb);if(_0x27a8eb[_0x3dda85(0xb4)]===0x0)break;const _0x27fae0=_0x1aaba1[_0x3dda85(0xbd)]?.[_0x3dda85(0xcf)];if(_0x27fae0!=null?_0x4186b4[_0x3dda85(0xb4)]>=_0x27fae0:_0x27a8eb['length']<PAGE_SIZE)break;_0x2758ac++;}return _0x4186b4;}async function ensureSqlContent(_0x2b605b){const _0xa769a4=a253_0x14a5;if(_0x2b605b['sqlContent']!=null&&String(_0x2b605b[_0xa769a4(0xdd)])[_0xa769a4(0xb4)]>0x0)return _0x2b605b;return getSqlQueryDetail(_0x2b605b[_0xa769a4(0xd6)]);}export const sqlPull={'service':a253_0x339f30(0xd8),'command':a253_0x339f30(0xc0),'description':a253_0x339f30(0xd5),'risk':a253_0x339f30(0xd7),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a253_0x339f30(0xbc),'description':a253_0x339f30(0xb6)},{'name':'force','type':'boolean','description':a253_0x339f30(0xcd)}],async 'dryRun'(_0x417498){const _0x3f6482=a253_0x339f30,_0xa2a6e7=loadSqlProjectConfig(_0x417498['appCode']),_0x15e0b0=await readSqlLockFile(_0xa2a6e7[_0x3f6482(0xb1)]),{appLock:_0x2aa9d2}=ensureSqlLockScope(_0x15e0b0??createEmptySqlLock(),_0xa2a6e7[_0x3f6482(0xc7)],_0xa2a6e7[_0x3f6482(0xc4)],_0x3f6482(0xc0)),_0x5ef820=await fetchAllSqlQueries(_0x417498[_0x3f6482(0xc7)],{'sqlCode':_0x417498['str'](_0x3f6482(0xb7))||undefined,'sqlName':_0x417498[_0x3f6482(0xba)](_0x3f6482(0xf7))||undefined}),_0x22f64f=[];for(const _0x394b19 of _0x5ef820){const _0x2690c3=await ensureSqlContent(_0x394b19),_0x2b81b8=ensureRemoteSqlContent(_0x2690c3),_0x57659e=detectSqlMode(_0x2b81b8),_0x119370=_0x2690c3[_0x3f6482(0xf4)]?await getDbName(_0x417498['appCode'],Number(_0x2690c3[_0x3f6482(0xf4)]))[_0x3f6482(0xe1)](()=>undefined):undefined,_0x699e4a=buildLocalSqlFileContent({'sqlCode':_0x2690c3['sqlCode'],'sqlName':_0x2690c3[_0x3f6482(0xf9)],'dbId':_0x2690c3[_0x3f6482(0xf4)]},_0x2b81b8,{'dbName':_0x119370,'mode':_0x57659e,'syncedAt':new Date()[_0x3f6482(0xb8)](),'description':_0x2690c3[_0x3f6482(0xc8)]}),_0x34fd99=buildSqlLockEntry(_0x2690c3,_0x2b81b8,'',{'dbName':_0x119370}),_0x353bf2=resolveLocalSqlFilePath(_0xa2a6e7,_0x2690c3['sqlCode'],_0x34fd99);let _0x2acf9d=_0x3f6482(0xf1),_0x2dc7a4;const _0x5207f1=await findExistingSqlFiles(_0xa2a6e7,_0x353bf2,_0x57659e,_0x2aa9d2[_0x3f6482(0xf0)][_0x2690c3['sqlCode']]);if(_0x5207f1[_0x3f6482(0xb4)]>0x0){const _0x3904cf=await compareExistingSqlFiles(_0x5207f1,_0x699e4a,_0x57659e);if(_0x3904cf['some'](({equivalent:_0x4c8ece})=>!_0x4c8ece))_0x2acf9d='conflict',_0x2dc7a4=_0x3f6482(0xdc);else _0x3904cf[_0x3f6482(0xb4)]===0x1&&_0x3904cf[0x0]?.[_0x3f6482(0xd1)][_0x3f6482(0xf3)]&&(_0x2acf9d=_0x3f6482(0xd9),_0x2dc7a4=_0x3f6482(0xc6));}_0x22f64f[_0x3f6482(0xe0)]({'sqlCode':_0x2690c3[_0x3f6482(0xd6)],'sqlName':_0x2690c3[_0x3f6482(0xf9)],'filePath':_0x353bf2,'status':_0x2acf9d,'reason':_0x2dc7a4});}return{'method':_0x3f6482(0xe4),'url':_0x3f6482(0xe7),'body':{'appCode':_0x417498['appCode'],'sqlCode':_0x417498[_0x3f6482(0xba)](_0x3f6482(0xb7))||null,'sqlName':_0x417498[_0x3f6482(0xba)](_0x3f6482(0xf7))||null,'files':_0x22f64f},'description':_0x3f6482(0xdf)+_0x22f64f[_0x3f6482(0xb4)]+_0x3f6482(0xd0)+_0xa2a6e7[_0x3f6482(0xc5)]};},async 'execute'(_0x2ec895){const _0x5c6b5f=a253_0x339f30,_0x3823c5=loadSqlProjectConfig(_0x2ec895[_0x5c6b5f(0xc7)]),_0x90f25d=await readSqlLockFile(_0x3823c5[_0x5c6b5f(0xb1)]),{lockData:_0x2f551d,appLock:_0x52d775}=ensureSqlLockScope(_0x90f25d??createEmptySqlLock(),_0x3823c5[_0x5c6b5f(0xc7)],_0x3823c5[_0x5c6b5f(0xc4)],_0x5c6b5f(0xc0)),_0x116d23=_0x2ec895['bool']('force'),_0x1ca638=await fetchAllSqlQueries(_0x2ec895[_0x5c6b5f(0xc7)],{'sqlCode':_0x2ec895[_0x5c6b5f(0xba)](_0x5c6b5f(0xb7))||undefined,'sqlName':_0x2ec895[_0x5c6b5f(0xba)]('name')||undefined});if(_0x1ca638[_0x5c6b5f(0xb4)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x39d3b2=[],_0x52fb1b=[];for(const _0x2c15cd of _0x1ca638){try{_0x39d3b2[_0x5c6b5f(0xe0)](await ensureSqlContent(_0x2c15cd));}catch(_0x1d96c8){_0x52fb1b[_0x5c6b5f(0xe0)]({'sqlCode':_0x2c15cd[_0x5c6b5f(0xd6)],'error':_0x1d96c8 instanceof Error?_0x1d96c8[_0x5c6b5f(0xe8)]:String(_0x1d96c8)});}}if(_0x116d23&&!_0x2ec895[_0x5c6b5f(0xea)]){let _0x12a7b0=![];for(const _0x1784a3 of _0x39d3b2){const _0xb40db8=detectSqlMode(ensureRemoteSqlContent(_0x1784a3)),_0x1b9ef6=_0x1784a3[_0x5c6b5f(0xf4)]?await getDbName(_0x2ec895[_0x5c6b5f(0xc7)],Number(_0x1784a3[_0x5c6b5f(0xf4)]))[_0x5c6b5f(0xe1)](()=>undefined):undefined,_0xe2da72=buildLocalSqlFileContent({'sqlCode':_0x1784a3[_0x5c6b5f(0xd6)],'sqlName':_0x1784a3[_0x5c6b5f(0xf9)],'dbId':_0x1784a3[_0x5c6b5f(0xf4)]},ensureRemoteSqlContent(_0x1784a3),{'dbName':_0x1b9ef6,'mode':_0xb40db8,'syncedAt':new Date()[_0x5c6b5f(0xb8)](),'description':_0x1784a3[_0x5c6b5f(0xc8)]}),_0x15bfe6=resolveLocalSqlFilePath(_0x3823c5,_0x1784a3[_0x5c6b5f(0xd6)],buildSqlLockEntry(_0x1784a3,ensureRemoteSqlContent(_0x1784a3),'',{'dbName':_0x1b9ef6})),_0x47a410=await findExistingSqlFiles(_0x3823c5,_0x15bfe6,_0xb40db8,_0x52d775['sqls'][_0x1784a3[_0x5c6b5f(0xd6)]]),_0x3c0b9a=await compareExistingSqlFiles(_0x47a410,_0xe2da72,_0xb40db8);if(_0x3c0b9a[_0x5c6b5f(0xb3)](({equivalent:_0x4caf08})=>!_0x4caf08)){_0x12a7b0=!![];break;}}if(_0x12a7b0){const _0x12cffd=await confirmForceOverwrite(_0x5c6b5f(0xcc));if(!_0x12cffd)throw CliErrors[_0x5c6b5f(0xbb)]('Force\x20pull\x20cancelled.');}}const _0x50b887=cloneSqlLockData(_0x2f551d),_0x42cf56=_0x50b887[_0x5c6b5f(0xca)][_0x3823c5[_0x5c6b5f(0xc7)]],_0x4c21eb=[],_0x57dcc0=[];for(const _0x5a0bf9 of _0x39d3b2){const _0xd05a2e=_0x42cf56[_0x5c6b5f(0xf0)][_0x5a0bf9[_0x5c6b5f(0xd6)]],_0x4a0f24=ensureRemoteSqlContent(_0x5a0bf9),_0x3c43e3=detectSqlMode(_0x4a0f24),_0x46f8ba=_0x5a0bf9['dbId']?await getDbName(_0x2ec895[_0x5c6b5f(0xc7)],Number(_0x5a0bf9[_0x5c6b5f(0xf4)]))[_0x5c6b5f(0xe1)](()=>undefined):undefined,_0x676790=buildLocalSqlFileContent({'sqlCode':_0x5a0bf9[_0x5c6b5f(0xd6)],'sqlName':_0x5a0bf9['sqlName'],'dbId':_0x5a0bf9[_0x5c6b5f(0xf4)]},_0x4a0f24,{'dbName':_0x46f8ba,'mode':_0x3c43e3,'syncedAt':new Date()[_0x5c6b5f(0xb8)](),'description':_0x5a0bf9['description']}),_0x596d2f=buildSqlLockEntry(_0x5a0bf9,_0x4a0f24,computeSqlContentHash(_0x676790),{'dbName':_0x46f8ba}),_0x2ca2da=_0x596d2f[_0x5c6b5f(0xe9)],_0x460b67=join(_0x3823c5[_0x5c6b5f(0xc5)],_0x2ca2da);try{const _0x35be7f=await findExistingSqlFiles(_0x3823c5,_0x460b67,_0x3c43e3,_0xd05a2e),_0x5ef1af=await compareExistingSqlFiles(_0x35be7f,_0x676790,_0x3c43e3);if(!_0x116d23&&_0x5ef1af[_0x5c6b5f(0xb3)](({equivalent:_0xa4acd7})=>!_0xa4acd7)){_0x57dcc0[_0x5c6b5f(0xe0)]({'sqlCode':_0x5a0bf9[_0x5c6b5f(0xd6)],'reason':_0x5c6b5f(0xf2)});continue;}const _0x11a52d=_0x5ef1af[_0x5c6b5f(0xb9)](({file:_0xe1f42})=>_0xe1f42[_0x5c6b5f(0xf3)]),_0x3517de=_0x5ef1af['find'](({file:_0x21d4cb})=>!_0x21d4cb[_0x5c6b5f(0xf3)]);if(_0x11a52d?.[_0x5c6b5f(0xb2)]&&!_0x3517de){_0x57dcc0[_0x5c6b5f(0xe0)]({'sqlCode':_0x5a0bf9[_0x5c6b5f(0xd6)],'reason':_0x5c6b5f(0xc6)}),_0x42cf56[_0x5c6b5f(0xf0)][_0x5a0bf9[_0x5c6b5f(0xd6)]]={..._0x596d2f,'hash':computeSqlContentHash(_0x11a52d[_0x5c6b5f(0xeb)]),'path':_0x2ca2da};continue;}!_0x11a52d?.[_0x5c6b5f(0xb2)]&&(await ensureParentDirectory(_0x460b67),await writeFile(_0x460b67,_0x676790,'utf8')),_0x3517de&&await rm(_0x3517de[_0x5c6b5f(0xd1)]['filePath'],{'force':!![]}),_0x42cf56[_0x5c6b5f(0xf0)][_0x5a0bf9[_0x5c6b5f(0xd6)]]={..._0x596d2f,'hash':_0x11a52d?.[_0x5c6b5f(0xb2)]?computeSqlContentHash(_0x11a52d[_0x5c6b5f(0xeb)]):_0x596d2f[_0x5c6b5f(0xc9)],'path':_0x2ca2da},_0x4c21eb[_0x5c6b5f(0xe0)]({'sqlCode':_0x5a0bf9[_0x5c6b5f(0xd6)],'filePath':_0x460b67});}catch(_0x5cff94){_0x52fb1b['push']({'sqlCode':_0x5a0bf9['sqlCode'],'error':_0x5cff94 instanceof Error?_0x5cff94[_0x5c6b5f(0xe8)]:String(_0x5cff94)});}}return _0x42cf56['lastSync']=new Date()[_0x5c6b5f(0xb8)](),await writeSqlLockFile(_0x3823c5[_0x5c6b5f(0xb1)],_0x50b887),{'ok':_0x52fb1b['length']===0x0,'data':{'pulled':_0x4c21eb,'skipped':_0x57dcc0,'failed':_0x52fb1b},'message':_0x5c6b5f(0xc2)+_0x4c21eb['length']+_0x5c6b5f(0xed)+_0x57dcc0['length']+_0x5c6b5f(0xb5)+_0x52fb1b[_0x5c6b5f(0xb4)]+_0x5c6b5f(0xd4)};}};function isEquivalentPulledSqlFile(_0x17895d,_0x25c9b1,_0x152398,_0x595c66){if(_0x152398!==_0x595c66)return normalizePulledSqlBody(_0x17895d,_0x152398)===normalizePulledSqlBody(_0x25c9b1,_0x595c66);return normalizePullComparableContent(_0x17895d,_0x152398)===normalizePullComparableContent(_0x25c9b1,_0x595c66);}async function findExistingSqlFiles(_0x2db1f8,_0x1c7286,_0x54e494,_0x4b537d){const _0x9b67d=a253_0x339f30,_0x19901e=[];await fileExists(_0x1c7286)&&_0x19901e[_0x9b67d(0xe0)]({'filePath':_0x1c7286,'mode':_0x54e494,'isCanonical':!![]});if(!_0x4b537d?.['path'])return _0x19901e;const _0x326012=join(_0x2db1f8[_0x9b67d(0xc5)],_0x4b537d[_0x9b67d(0xe9)]);if(_0x326012===_0x1c7286)return _0x19901e;return await fileExists(_0x326012)&&_0x19901e['push']({'filePath':_0x326012,'mode':_0x4b537d[_0x9b67d(0xb0)]??modeFromFilePath(_0x326012),'isCanonical':![]}),_0x19901e;}async function compareExistingSqlFiles(_0xe92f26,_0x19a7d0,_0x31d740){const _0x3b3f3c=a253_0x339f30;return Promise[_0x3b3f3c(0xbe)](_0xe92f26[_0x3b3f3c(0xda)](async _0x1546d5=>{const _0x3e4246=_0x3b3f3c,_0x566d59=await readFile(_0x1546d5['filePath'],_0x3e4246(0xce));return{'file':_0x1546d5,'content':_0x566d59,'equivalent':isEquivalentPulledSqlFile(_0x566d59,_0x19a7d0,_0x1546d5[_0x3e4246(0xb0)],_0x31d740)};}));}function modeFromFilePath(_0x5c824e){const _0x9aca80=a253_0x339f30;return _0x5c824e[_0x9aca80(0xe3)]()[_0x9aca80(0xde)](_0x9aca80(0xf5))?_0x9aca80(0xd2):_0x9aca80(0xd8);}function normalizePulledSqlBody(_0x227344,_0x44adc9){const _0x2ccad7=a253_0x339f30;return stripLocalSqlMetadata(_0x227344,_0x44adc9)[_0x2ccad7(0xee)](/\r\n/g,'\x0a')[_0x2ccad7(0xc3)]();}function normalizePullComparableContent(_0x139f7f,_0x520924){const _0x237e1a=a253_0x339f30,_0x257bd5=_0x139f7f[_0x237e1a(0xee)](/\r\n/g,'\x0a')[_0x237e1a(0xcb)]('\x0a'),_0x3353f3=_0x257bd5['filter'](_0x27491c=>!isSyncedAtMetadataLine(_0x27491c,_0x520924));return _0x3353f3[_0x237e1a(0xe2)]('\x0a');}function isSyncedAtMetadataLine(_0x2e8b59,_0x3fdcd0){const _0x21a5b7=a253_0x339f30;if(_0x3fdcd0===_0x21a5b7(0xd2))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2e8b59);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x21a5b7(0xdb)](_0x2e8b59);}
|
|
1
|
+
const a253_0x82148e=a253_0x4483;(function(_0x46137d,_0x1cf954){const _0x276d62=a253_0x4483,_0x2802b7=_0x46137d();while(!![]){try{const _0x68d4b9=parseInt(_0x276d62(0x195))/0x1*(parseInt(_0x276d62(0x186))/0x2)+parseInt(_0x276d62(0x1a9))/0x3*(-parseInt(_0x276d62(0x17e))/0x4)+-parseInt(_0x276d62(0x17a))/0x5+-parseInt(_0x276d62(0x188))/0x6+parseInt(_0x276d62(0x16d))/0x7*(parseInt(_0x276d62(0x17f))/0x8)+parseInt(_0x276d62(0x182))/0x9*(parseInt(_0x276d62(0x1a6))/0xa)+parseInt(_0x276d62(0x19b))/0xb;if(_0x68d4b9===_0x1cf954)break;else _0x2802b7['push'](_0x2802b7['shift']());}catch(_0x17af1a){_0x2802b7['push'](_0x2802b7['shift']());}}}(a253_0x20ed,0xefa8a));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{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';function a253_0x20ed(){const _0x2d8d30=['join','some','762amOfEL','cancelled','792204oaycPU','\x20failed','catch','dbId','boolean','nonInteractive','would_pull','filter','name','sqlcode','replace','isCanonical','sqlRootDir','1745QBSIqY','content','local\x20differs\x20from\x20remote','Filter\x20by\x20SQL\x20display\x20name','length','bool','11192456HxMVae','skipped','No\x20remote\x20SQL\x20queries\x20matched.','.xml','Force\x20pull\x20cancelled.','Pull\x20complete:\x20','str','all','mybatisXml','read','force','320SNZibk','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','message','3659613fBqZJa','utf8','\x20skipped,\x20','split','description','toISOString','pull','Force\x20overwrite\x20local\x20unsynced\x20changes','push','string','unchanged','Would\x20pull\x20','path','endsWith','file','test','apps','1442cSZqSO','mode','conflict','paging','sqls','totalCount','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','equivalent','trim','appCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlRoot','POST','2853180gnkmhe','\x20SQL\x20file(s)\x20into\x20','sql','sqlCode','4lPvsRI','16888qfTthF','lockFilePath','sqlName','221337puAmJv','filePath'];a253_0x20ed=function(){return _0x2d8d30;};return a253_0x20ed();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x4868f8,_0xfa1950){const _0xd038d0=a253_0x4483,_0x4801f1=[];let _0x2c0189=0x1;while(!![]){const _0x164131=await listSqlQueries(_0x4868f8,{'currentPage':_0x2c0189,'pageSize':PAGE_SIZE,'sqlCode':_0xfa1950[_0xd038d0(0x17d)],'sqlName':_0xfa1950[_0xd038d0(0x181)]}),_0x3a69ed=_0x164131['tableData']??[];_0x4801f1['push'](..._0x3a69ed);if(_0x3a69ed[_0xd038d0(0x199)]===0x0)break;const _0x325eb1=_0x164131[_0xd038d0(0x170)]?.[_0xd038d0(0x172)];if(_0x325eb1!=null?_0x4801f1[_0xd038d0(0x199)]>=_0x325eb1:_0x3a69ed[_0xd038d0(0x199)]<PAGE_SIZE)break;_0x2c0189++;}return _0x4801f1;}async function ensureSqlContent(_0x406382){const _0x1e5ece=a253_0x4483;if(_0x406382['sqlContent']!=null&&String(_0x406382['sqlContent'])['length']>0x0)return _0x406382;return getSqlQueryDetail(_0x406382[_0x1e5ece(0x17d)]);}export const sqlPull={'service':a253_0x82148e(0x17c),'command':'pull','description':a253_0x82148e(0x177),'risk':a253_0x82148e(0x1a4),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a253_0x82148e(0x1b2),'description':a253_0x82148e(0x198)},{'name':a253_0x82148e(0x1a5),'type':a253_0x82148e(0x18c),'description':a253_0x82148e(0x1b0)}],async 'dryRun'(_0xd24ab3){const _0xf95a96=a253_0x82148e,_0x4bb9b7=loadSqlProjectConfig(_0xd24ab3['appCode']),_0x58ef96=await readSqlLockFile(_0x4bb9b7[_0xf95a96(0x180)]),{appLock:_0x547a62}=ensureSqlLockScope(_0x58ef96??createEmptySqlLock(),_0x4bb9b7['appCode'],_0x4bb9b7[_0xf95a96(0x178)],_0xf95a96(0x1af)),_0x1c2707=await fetchAllSqlQueries(_0xd24ab3[_0xf95a96(0x176)],{'sqlCode':_0xd24ab3['str'](_0xf95a96(0x191))||undefined,'sqlName':_0xd24ab3[_0xf95a96(0x1a1)](_0xf95a96(0x190))||undefined}),_0x4a6f9c=[];for(const _0x1d2f3a of _0x1c2707){const _0x2dfe6e=await ensureSqlContent(_0x1d2f3a),_0x286979=ensureRemoteSqlContent(_0x2dfe6e),_0xa3eb45=detectSqlMode(_0x286979),_0x1683bc=_0x2dfe6e[_0xf95a96(0x18b)]?await getDbName(_0xd24ab3[_0xf95a96(0x176)],Number(_0x2dfe6e[_0xf95a96(0x18b)]))[_0xf95a96(0x18a)](()=>undefined):undefined,_0x191c18=buildLocalSqlFileContent({'sqlCode':_0x2dfe6e[_0xf95a96(0x17d)],'sqlName':_0x2dfe6e[_0xf95a96(0x181)],'dbId':_0x2dfe6e['dbId']},_0x286979,{'dbName':_0x1683bc,'mode':_0xa3eb45,'syncedAt':new Date()[_0xf95a96(0x1ae)](),'description':_0x2dfe6e['description']}),_0x28646d=buildSqlLockEntry(_0x2dfe6e,_0x286979,'',{'dbName':_0x1683bc}),_0x547cb2=resolveLocalSqlFilePath(_0x4bb9b7,_0x2dfe6e[_0xf95a96(0x17d)],_0x28646d);let _0x5ae69b=_0xf95a96(0x18e),_0x173578;const _0x5ba08d=await findExistingSqlFiles(_0x4bb9b7,_0x547cb2,_0xa3eb45,_0x547a62[_0xf95a96(0x171)][_0x2dfe6e[_0xf95a96(0x17d)]]);if(_0x5ba08d[_0xf95a96(0x199)]>0x0){const _0x4630d8=await compareExistingSqlFiles(_0x5ba08d,_0x191c18,_0xa3eb45);if(_0x4630d8['some'](({equivalent:_0x5704cb})=>!_0x5704cb))_0x5ae69b=_0xf95a96(0x16f),_0x173578=_0xf95a96(0x1a7);else _0x4630d8[_0xf95a96(0x199)]===0x1&&_0x4630d8[0x0]?.['file'][_0xf95a96(0x193)]&&(_0x5ae69b=_0xf95a96(0x19c),_0x173578=_0xf95a96(0x1b3));}_0x4a6f9c[_0xf95a96(0x1b1)]({'sqlCode':_0x2dfe6e[_0xf95a96(0x17d)],'sqlName':_0x2dfe6e[_0xf95a96(0x181)],'filePath':_0x547cb2,'status':_0x5ae69b,'reason':_0x173578});}return{'method':_0xf95a96(0x179),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0xd24ab3[_0xf95a96(0x176)],'sqlCode':_0xd24ab3[_0xf95a96(0x1a1)]('sqlcode')||null,'sqlName':_0xd24ab3[_0xf95a96(0x1a1)](_0xf95a96(0x190))||null,'files':_0x4a6f9c},'description':_0xf95a96(0x1b4)+_0x4a6f9c[_0xf95a96(0x199)]+_0xf95a96(0x17b)+_0x4bb9b7[_0xf95a96(0x194)]};},async 'execute'(_0x59c601){const _0x2acc41=a253_0x82148e,_0x28a546=loadSqlProjectConfig(_0x59c601[_0x2acc41(0x176)]),_0x3a195d=await readSqlLockFile(_0x28a546[_0x2acc41(0x180)]),{lockData:_0xd6cdd7,appLock:_0x44a4e0}=ensureSqlLockScope(_0x3a195d??createEmptySqlLock(),_0x28a546[_0x2acc41(0x176)],_0x28a546['sqlRoot'],'pull'),_0x11cd11=_0x59c601[_0x2acc41(0x19a)]('force'),_0x4f222d=await fetchAllSqlQueries(_0x59c601[_0x2acc41(0x176)],{'sqlCode':_0x59c601[_0x2acc41(0x1a1)](_0x2acc41(0x191))||undefined,'sqlName':_0x59c601[_0x2acc41(0x1a1)]('name')||undefined});if(_0x4f222d['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2acc41(0x19d)};const _0x276179=[],_0x1db820=[];for(const _0x5d10f7 of _0x4f222d){try{_0x276179[_0x2acc41(0x1b1)](await ensureSqlContent(_0x5d10f7));}catch(_0x513ec7){_0x1db820['push']({'sqlCode':_0x5d10f7[_0x2acc41(0x17d)],'error':_0x513ec7 instanceof Error?_0x513ec7[_0x2acc41(0x1a8)]:String(_0x513ec7)});}}if(_0x11cd11&&!_0x59c601[_0x2acc41(0x18d)]){let _0xfb1642=![];for(const _0xcd9c09 of _0x276179){const _0x158b59=detectSqlMode(ensureRemoteSqlContent(_0xcd9c09)),_0x1048d4=_0xcd9c09[_0x2acc41(0x18b)]?await getDbName(_0x59c601['appCode'],Number(_0xcd9c09[_0x2acc41(0x18b)]))['catch'](()=>undefined):undefined,_0x2138f2=buildLocalSqlFileContent({'sqlCode':_0xcd9c09['sqlCode'],'sqlName':_0xcd9c09[_0x2acc41(0x181)],'dbId':_0xcd9c09['dbId']},ensureRemoteSqlContent(_0xcd9c09),{'dbName':_0x1048d4,'mode':_0x158b59,'syncedAt':new Date()[_0x2acc41(0x1ae)](),'description':_0xcd9c09[_0x2acc41(0x1ad)]}),_0x2432e8=resolveLocalSqlFilePath(_0x28a546,_0xcd9c09[_0x2acc41(0x17d)],buildSqlLockEntry(_0xcd9c09,ensureRemoteSqlContent(_0xcd9c09),'',{'dbName':_0x1048d4})),_0x56b3ff=await findExistingSqlFiles(_0x28a546,_0x2432e8,_0x158b59,_0x44a4e0[_0x2acc41(0x171)][_0xcd9c09['sqlCode']]),_0x557ff1=await compareExistingSqlFiles(_0x56b3ff,_0x2138f2,_0x158b59);if(_0x557ff1[_0x2acc41(0x185)](({equivalent:_0x3eddbf})=>!_0x3eddbf)){_0xfb1642=!![];break;}}if(_0xfb1642){const _0x79f63b=await confirmForceOverwrite(_0x2acc41(0x173));if(!_0x79f63b)throw CliErrors[_0x2acc41(0x187)](_0x2acc41(0x19f));}}const _0x55fa0b=cloneSqlLockData(_0xd6cdd7),_0x3461f3=_0x55fa0b[_0x2acc41(0x16c)][_0x28a546[_0x2acc41(0x176)]],_0x40106c=[],_0x4e19f7=[];for(const _0x3d63df of _0x276179){const _0x7a4791=_0x3461f3['sqls'][_0x3d63df[_0x2acc41(0x17d)]],_0x15b70e=ensureRemoteSqlContent(_0x3d63df),_0x1b54c8=detectSqlMode(_0x15b70e),_0x64bb88=_0x3d63df[_0x2acc41(0x18b)]?await getDbName(_0x59c601['appCode'],Number(_0x3d63df['dbId']))['catch'](()=>undefined):undefined,_0x488c4b=buildLocalSqlFileContent({'sqlCode':_0x3d63df['sqlCode'],'sqlName':_0x3d63df[_0x2acc41(0x181)],'dbId':_0x3d63df[_0x2acc41(0x18b)]},_0x15b70e,{'dbName':_0x64bb88,'mode':_0x1b54c8,'syncedAt':new Date()[_0x2acc41(0x1ae)](),'description':_0x3d63df[_0x2acc41(0x1ad)]}),_0x53cac5=buildSqlLockEntry(_0x3d63df,_0x15b70e,computeSqlContentHash(_0x488c4b),{'dbName':_0x64bb88}),_0x3d120a=_0x53cac5['path'],_0x26d1cb=join(_0x28a546['sqlRootDir'],_0x3d120a);try{const _0x1b86b4=await findExistingSqlFiles(_0x28a546,_0x26d1cb,_0x1b54c8,_0x7a4791),_0x1cfe67=await compareExistingSqlFiles(_0x1b86b4,_0x488c4b,_0x1b54c8);if(!_0x11cd11&&_0x1cfe67[_0x2acc41(0x185)](({equivalent:_0x15ae97})=>!_0x15ae97)){_0x4e19f7['push']({'sqlCode':_0x3d63df[_0x2acc41(0x17d)],'reason':_0x2acc41(0x197)});continue;}const _0x2456a2=_0x1cfe67['find'](({file:_0x44f0fb})=>_0x44f0fb['isCanonical']),_0xccce51=_0x1cfe67['find'](({file:_0x209702})=>!_0x209702[_0x2acc41(0x193)]);if(_0x2456a2?.[_0x2acc41(0x174)]&&!_0xccce51){_0x4e19f7[_0x2acc41(0x1b1)]({'sqlCode':_0x3d63df[_0x2acc41(0x17d)],'reason':_0x2acc41(0x1b3)}),_0x3461f3[_0x2acc41(0x171)][_0x3d63df[_0x2acc41(0x17d)]]={..._0x53cac5,'hash':computeSqlContentHash(_0x2456a2[_0x2acc41(0x196)]),'path':_0x3d120a};continue;}!_0x2456a2?.[_0x2acc41(0x174)]&&(await ensureParentDirectory(_0x26d1cb),await writeFile(_0x26d1cb,_0x488c4b,_0x2acc41(0x1aa))),_0xccce51&&await rm(_0xccce51[_0x2acc41(0x16a)][_0x2acc41(0x183)],{'force':!![]}),_0x3461f3[_0x2acc41(0x171)][_0x3d63df[_0x2acc41(0x17d)]]={..._0x53cac5,'hash':_0x2456a2?.[_0x2acc41(0x174)]?computeSqlContentHash(_0x2456a2[_0x2acc41(0x196)]):_0x53cac5['hash'],'path':_0x3d120a},_0x40106c[_0x2acc41(0x1b1)]({'sqlCode':_0x3d63df[_0x2acc41(0x17d)],'filePath':_0x26d1cb});}catch(_0x2e3ed8){_0x1db820[_0x2acc41(0x1b1)]({'sqlCode':_0x3d63df[_0x2acc41(0x17d)],'error':_0x2e3ed8 instanceof Error?_0x2e3ed8[_0x2acc41(0x1a8)]:String(_0x2e3ed8)});}}return _0x3461f3['lastSync']=new Date()[_0x2acc41(0x1ae)](),await writeSqlLockFile(_0x28a546[_0x2acc41(0x180)],_0x55fa0b),{'ok':_0x1db820[_0x2acc41(0x199)]===0x0,'data':{'pulled':_0x40106c,'skipped':_0x4e19f7,'failed':_0x1db820},'message':_0x2acc41(0x1a0)+_0x40106c[_0x2acc41(0x199)]+'\x20written,\x20'+_0x4e19f7[_0x2acc41(0x199)]+_0x2acc41(0x1ab)+_0x1db820['length']+_0x2acc41(0x189)};}};function isEquivalentPulledSqlFile(_0x2b2777,_0x53f785,_0x134263,_0x108335){if(_0x134263!==_0x108335)return normalizePulledSqlBody(_0x2b2777,_0x134263)===normalizePulledSqlBody(_0x53f785,_0x108335);return normalizePullComparableContent(_0x2b2777,_0x134263)===normalizePullComparableContent(_0x53f785,_0x108335);}async function findExistingSqlFiles(_0x34d23a,_0x2f0417,_0x4ddbbe,_0x3d41b3){const _0x3941c9=a253_0x82148e,_0x3842ac=[];await fileExists(_0x2f0417)&&_0x3842ac[_0x3941c9(0x1b1)]({'filePath':_0x2f0417,'mode':_0x4ddbbe,'isCanonical':!![]});if(!_0x3d41b3?.['path'])return _0x3842ac;const _0x5a295c=join(_0x34d23a['sqlRootDir'],_0x3d41b3[_0x3941c9(0x1b5)]);if(_0x5a295c===_0x2f0417)return _0x3842ac;return await fileExists(_0x5a295c)&&_0x3842ac[_0x3941c9(0x1b1)]({'filePath':_0x5a295c,'mode':_0x3d41b3[_0x3941c9(0x16e)]??modeFromFilePath(_0x5a295c),'isCanonical':![]}),_0x3842ac;}async function compareExistingSqlFiles(_0x13ea47,_0x4adb5c,_0x2d8f07){const _0x17a690=a253_0x82148e;return Promise[_0x17a690(0x1a2)](_0x13ea47['map'](async _0x5ead5d=>{const _0xcf3b18=_0x17a690,_0x2b5254=await readFile(_0x5ead5d[_0xcf3b18(0x183)],'utf8');return{'file':_0x5ead5d,'content':_0x2b5254,'equivalent':isEquivalentPulledSqlFile(_0x2b5254,_0x4adb5c,_0x5ead5d[_0xcf3b18(0x16e)],_0x2d8f07)};}));}function modeFromFilePath(_0x1c2445){const _0x318c12=a253_0x82148e;return _0x1c2445['toLowerCase']()[_0x318c12(0x1b6)](_0x318c12(0x19e))?_0x318c12(0x1a3):_0x318c12(0x17c);}function normalizePulledSqlBody(_0x138428,_0x5c99b6){const _0x3ed046=a253_0x82148e;return stripLocalSqlMetadata(_0x138428,_0x5c99b6)[_0x3ed046(0x192)](/\r\n/g,'\x0a')[_0x3ed046(0x175)]();}function normalizePullComparableContent(_0x3d5b3f,_0x24cb7b){const _0x2c7067=a253_0x82148e,_0x3729ab=_0x3d5b3f[_0x2c7067(0x192)](/\r\n/g,'\x0a')[_0x2c7067(0x1ac)]('\x0a'),_0x112863=_0x3729ab[_0x2c7067(0x18f)](_0xe70d19=>!isSyncedAtMetadataLine(_0xe70d19,_0x24cb7b));return _0x112863[_0x2c7067(0x184)]('\x0a');}function a253_0x4483(_0x1827f9,_0x4d88a6){_0x1827f9=_0x1827f9-0x16a;const _0x20ed8b=a253_0x20ed();let _0x4483c7=_0x20ed8b[_0x1827f9];return _0x4483c7;}function isSyncedAtMetadataLine(_0x4c428a,_0x17962f){const _0x240a21=a253_0x82148e;if(_0x17962f===_0x240a21(0x1a3))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x240a21(0x16b)](_0x4c428a);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x240a21(0x16b)](_0x4c428a);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a254_0x3f7d(_0x1e2b81,_0x1ac8f1){_0x1e2b81=_0x1e2b81-0xd8;const _0x306e9a=a254_0x306e();let _0x3f7d8b=_0x306e9a[_0x1e2b81];return _0x3f7d8b;}const a254_0x296c84=a254_0x3f7d;(function(_0x297a41,_0x8dae0e){const _0x47e843=a254_0x3f7d,_0x1d732b=_0x297a41();while(!![]){try{const _0x5c9be1=parseInt(_0x47e843(0xfd))/0x1+parseInt(_0x47e843(0xf0))/0x2+-parseInt(_0x47e843(0xff))/0x3*(-parseInt(_0x47e843(0xdf))/0x4)+-parseInt(_0x47e843(0x100))/0x5+parseInt(_0x47e843(0xfc))/0x6+parseInt(_0x47e843(0x114))/0x7+parseInt(_0x47e843(0x105))/0x8*(-parseInt(_0x47e843(0xd8))/0x9);if(_0x5c9be1===_0x8dae0e)break;else _0x1d732b['push'](_0x1d732b['shift']());}catch(_0x4766d4){_0x1d732b['push'](_0x1d732b['shift']());}}}(a254_0x306e,0x4fc24));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a254_0x306e(){const _0x33e427=['boolean','toISOString','relativePath','mode','Would\x20push\x20','607704lCuzbB','407037mHBuRM','filter','129HjdfgB','2601650EGiqQm','sqlRoot','dbId','startsWith','push','88AadmUf','set','sqls','isFinite','exec','\x20SQL\x20file(s)','unchanged','str','Local\x20directory\x20\x22','lockFilePath','trim','has',':\x20SQL\x20content\x20is\x20empty.','map','Local\x20SQL\x20not\x20found:\x20','925162THpXRI','sqlConfig','version','message','sqlRootDir','sql','No\x20database\x20matches\x20local\x20directory\x20\x22','catch','sqlcode','308043IFsmqn','\x22\x20for\x20sqlCode\x20','appCode',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','sqlName','remoteId','join','6172VQHsWJ','path','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','filePath','utf8','bool','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbName','\x20pushed,\x20','validation','hash','/smartapi/custom/updateUserCustomSql','\x20failed','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','length','No\x20local\x20SQL\x20files\x20found.','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','1033366NyYFit','force','Push\x20complete:\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlCode','POST'];a254_0x306e=function(){return _0x33e427;};return a254_0x306e();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x311386){const _0x3eb49f=a254_0x3f7d,_0x2ed965=stripLocalSqlMetadata(await readFile(_0x311386['filePath'],_0x3eb49f(0xe3)),_0x311386['mode']);if(!_0x2ed965[_0x3eb49f(0x10f)]())throw CliErrors[_0x3eb49f(0xe8)](_0x311386[_0x3eb49f(0xf5)]+_0x3eb49f(0x111));return _0x2ed965;}async function getTargetSqlQueries(_0x35bd4f,_0x47db01,_0x141bcd){const _0x5e2579=a254_0x3f7d,_0x11a8e2=await scanLocalSqlQueries(_0x35bd4f),_0x2718be=new Map();for(const _0x3ca816 of _0x11a8e2){if(_0x141bcd&&_0x3ca816[_0x5e2579(0xf5)]!==_0x141bcd)continue;const _0x1aa2d2=_0x2718be['get'](_0x3ca816[_0x5e2579(0xf5)])??[];_0x1aa2d2['push'](_0x3ca816),_0x2718be[_0x5e2579(0x106)](_0x3ca816[_0x5e2579(0xf5)],_0x1aa2d2);}if(_0x141bcd&&!_0x2718be[_0x5e2579(0x110)](_0x141bcd))throw CliErrors[_0x5e2579(0xe8)](_0x5e2579(0x113)+_0x141bcd);const _0x2eb926=[];for(const [_0x442371,_0x473a9c]of _0x2718be['entries']()){if(_0x473a9c[_0x5e2579(0xed)]===0x1){_0x2eb926[_0x5e2579(0x104)](_0x473a9c[0x0]);continue;}const _0x4f1979=_0x47db01[_0x5e2579(0x107)][_0x442371],_0xfa4b79=_0x4f1979?.['path'],_0x4ce08e=_0xfa4b79?_0x473a9c[_0x5e2579(0xfe)](_0x164fde=>_0x164fde[_0x5e2579(0xf9)]!==_0xfa4b79):_0x473a9c;if(_0x4f1979&&_0x4ce08e[_0x5e2579(0xed)]===0x1){_0x2eb926['push'](_0x4ce08e[0x0]);continue;}throw CliErrors[_0x5e2579(0xe8)](_0x5e2579(0xe1)+_0x442371+_0x5e2579(0xf3));}return _0x2eb926;}export const sqlPush={'service':a254_0x296c84(0x119),'command':a254_0x296c84(0x104),'description':a254_0x296c84(0xf4),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x296c84(0xf1),'type':a254_0x296c84(0xf7),'description':a254_0x296c84(0xec)}],async 'dryRun'(_0x23dcec){const _0x16d644=a254_0x296c84,_0x27686f=loadSqlProjectConfig(_0x23dcec['appCode']),_0x15d6ec=await readSqlLockFile(_0x27686f[_0x16d644(0x10e)]),{appLock:_0x3948e2}=ensureSqlLockScope(_0x15d6ec??createEmptySqlLock(),_0x23dcec[_0x16d644(0xda)],_0x27686f[_0x16d644(0x101)],_0x16d644(0x104)),_0x2289f4=await getTargetSqlQueries(_0x27686f,_0x3948e2,_0x23dcec['str'](_0x16d644(0x11c))||undefined),_0x4c873e=[];for(const _0x2a6723 of _0x2289f4){const _0x16afc7=await computeSqlFileHash(_0x2a6723[_0x16d644(0xe2)]),_0x326c6b=_0x3948e2[_0x16d644(0x107)][_0x2a6723['sqlCode']],_0x1e6180=!!_0x326c6b&&(_0x326c6b[_0x16d644(0xe0)]!==_0x2a6723[_0x16d644(0xf9)]||!!_0x2a6723['sqlName']&&_0x326c6b[_0x16d644(0xdc)]!==_0x2a6723[_0x16d644(0xdc)]||_0x326c6b[_0x16d644(0xfa)]!==_0x2a6723[_0x16d644(0xfa)]);if(!_0x23dcec['bool'](_0x16d644(0xf1))&&_0x326c6b&&_0x326c6b['hash']===_0x16afc7&&!_0x1e6180)continue;if(!_0x326c6b)throw CliErrors[_0x16d644(0xe8)](_0x2a6723[_0x16d644(0xf5)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x326c6b[_0x16d644(0x116)]==null)throw CliErrors[_0x16d644(0xe8)](_0x2a6723[_0x16d644(0xf5)]+_0x16d644(0xdb));await resolveTargetDbBinding(_0x23dcec['appCode'],_0x2a6723,_0x326c6b),await readSqlUploadContent(_0x2a6723),_0x4c873e[_0x16d644(0x104)](_0x2a6723[_0x16d644(0xf5)]);}return{'method':_0x16d644(0xf6),'url':_0x16d644(0xea),'body':{'sqlCodes':_0x4c873e,'appCode':_0x23dcec[_0x16d644(0xda)]},'description':_0x16d644(0xfb)+_0x4c873e['length']+_0x16d644(0x10a)};},async 'execute'(_0x261049){const _0x3ba984=a254_0x296c84,_0x3fc923=loadSqlProjectConfig(_0x261049[_0x3ba984(0xda)]),_0x4b1713=await readSqlLockFile(_0x3fc923[_0x3ba984(0x10e)]),{lockData:_0x2a702f,appLock:_0x2cda2b}=ensureSqlLockScope(_0x4b1713??createEmptySqlLock(),_0x261049['appCode'],_0x3fc923[_0x3ba984(0x101)],'push'),_0x2f3679=await getTargetSqlQueries(_0x3fc923,_0x2cda2b,_0x261049[_0x3ba984(0x10c)]('sqlcode')||undefined);if(_0x2f3679[_0x3ba984(0xed)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x3ba984(0xee)};const _0x9dbcdf=[],_0x4c54ed=[],_0x2d9dfb=[];let _0x524dbd=![];for(const _0x5006be of _0x2f3679){const _0x3568b2=_0x2cda2b[_0x3ba984(0x107)][_0x5006be[_0x3ba984(0xf5)]];if(!_0x3568b2){_0x2d9dfb[_0x3ba984(0x104)]({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'error':_0x3ba984(0xe5)});continue;}try{const _0x266e34=await computeSqlFileHash(_0x5006be[_0x3ba984(0xe2)]),_0xc78f90=_0x3568b2[_0x3ba984(0xe0)]!==_0x5006be['relativePath']||!!_0x5006be['sqlName']&&_0x3568b2['sqlName']!==_0x5006be[_0x3ba984(0xdc)]||_0x3568b2[_0x3ba984(0xfa)]!==_0x5006be[_0x3ba984(0xfa)];if(!_0x261049[_0x3ba984(0xe4)](_0x3ba984(0xf1))&&_0x3568b2[_0x3ba984(0xe9)]===_0x266e34&&!_0xc78f90){_0x4c54ed['push']({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'reason':_0x3ba984(0x10b)});continue;}if(_0x3568b2[_0x3ba984(0x116)]==null){_0x2d9dfb[_0x3ba984(0x104)]({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'error':_0x3ba984(0xef)});continue;}const _0x503c41=_0x5006be[_0x3ba984(0xdc)]||_0x3568b2[_0x3ba984(0xdc)],_0x36f240=await resolveTargetDbBinding(_0x261049[_0x3ba984(0xda)],_0x5006be,_0x3568b2),_0x16d14c=await readSqlUploadContent(_0x5006be),_0x56c594=await updateSqlQuery({'id':_0x3568b2[_0x3ba984(0xdd)],'appCode':_0x261049['appCode'],'sqlCode':_0x5006be[_0x3ba984(0xf5)],'sqlName':_0x503c41,'dbId':_0x36f240[_0x3ba984(0x102)],'version':_0x3568b2['version'],'sqlContent':_0x16d14c,'sqlConfig':_0x3568b2[_0x3ba984(0x115)]??undefined}),_0x59ef79=_0x56c594[_0x3ba984(0x102)]?await getDbName(_0x261049[_0x3ba984(0xda)],Number(_0x56c594[_0x3ba984(0x102)]))[_0x3ba984(0x11b)](()=>_0x36f240[_0x3ba984(0xe6)]):_0x36f240['dbName'];_0x2cda2b[_0x3ba984(0x107)][_0x5006be[_0x3ba984(0xf5)]]={...buildSqlLockEntry(_0x56c594,_0x16d14c,_0x266e34,{'dbName':_0x59ef79}),'path':_0x5006be[_0x3ba984(0xf9)],'mode':_0x5006be['mode']},_0x524dbd=!![],await archivePreviousSqlFileIfNeeded(_0x3fc923,_0x3568b2[_0x3ba984(0xe0)],_0x5006be[_0x3ba984(0xf9)]),_0x9dbcdf[_0x3ba984(0x104)]({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'remoteId':_0x3568b2[_0x3ba984(0xdd)]});}catch(_0xe10a41){_0x2d9dfb[_0x3ba984(0x104)]({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'error':_0xe10a41 instanceof Error?_0xe10a41[_0x3ba984(0x117)]:String(_0xe10a41)});}}(_0x524dbd||_0x2d9dfb['length']===0x0)&&(_0x2cda2b['lastSync']=new Date()[_0x3ba984(0xf8)](),await writeSqlLockFile(_0x3fc923[_0x3ba984(0x10e)],_0x2a702f));const _0x446f6c=_0x2d9dfb[_0x3ba984(0xed)]===0x0;return{'ok':_0x446f6c,'data':{'pushed':_0x9dbcdf,'skipped':_0x4c54ed,'failed':_0x2d9dfb},'message':_0x3ba984(0xf2)+_0x9dbcdf['length']+_0x3ba984(0xe7)+_0x4c54ed['length']+'\x20skipped,\x20'+_0x2d9dfb['length']+_0x3ba984(0xeb)};}};async function archivePreviousSqlFileIfNeeded(_0x462492,_0x3119fa,_0x3b2c37){const _0x768ab=a254_0x296c84;if(!_0x3119fa||_0x3119fa===_0x3b2c37)return;const _0x3c6340=join(_0x462492[_0x768ab(0x118)],_0x3119fa);if(!await fileExists(_0x3c6340))return;const _0x722b48=await moveToTrash(_0x462492['projectRoot'],_0x462492['trashDir'],_0x3c6340);await cleanupEmptyDirectories(dirname(_0x3c6340),_0x462492[_0x768ab(0x118)]),void _0x722b48;}async function moveToTrash(_0x2a9841,_0x36b72c,_0x4011c1){const _0x32dfd1=a254_0x296c84,_0x57f805=new Date()[_0x32dfd1(0xf8)]()['replace'](/[:.]/g,'-'),_0x21d630=relative(_0x2a9841,_0x4011c1),_0x2283fa=join(_0x36b72c,_0x57f805,_0x21d630);return await mkdir(dirname(_0x2283fa),{'recursive':!![]}),await rename(_0x4011c1,_0x2283fa),_0x2283fa;}async function cleanupEmptyDirectories(_0x4f99c8,_0x4c6262){const _0x478fe1=a254_0x296c84;let _0x3d27e3=resolve(_0x4f99c8);const _0x2ed88a=resolve(_0x4c6262);while(_0x3d27e3[_0x478fe1(0x103)](''+_0x2ed88a+sep)||_0x3d27e3===_0x2ed88a){if(_0x3d27e3===_0x2ed88a)return;try{const _0x4c8ee1=await readdir(_0x3d27e3);if(_0x4c8ee1['length']>0x0)return;await rmdir(_0x3d27e3);}catch{return;}_0x3d27e3=dirname(_0x3d27e3);}}async function resolveTargetDbBinding(_0x116430,_0x20a085,_0xe3c15b){const _0x297bc4=a254_0x296c84,_0x53f46f=_0x20a085['dbDirectory'];if(!_0x53f46f)return{'dbId':_0xe3c15b[_0x297bc4(0x102)],'dbName':_0xe3c15b[_0x297bc4(0xe6)]};const _0x4c0e6e=buildDbDirectoryName(_0xe3c15b['dbName'],_0xe3c15b[_0x297bc4(0x102)]);if(_0x53f46f===_0x4c0e6e)return{'dbId':_0xe3c15b['dbId'],'dbName':_0xe3c15b[_0x297bc4(0xe6)]};const _0x45528d=parseExplicitDbDirectory(_0x53f46f);if(_0x45528d!=null)return{'dbId':_0x45528d,'dbName':await getDbName(_0x116430,_0x45528d)[_0x297bc4(0x11b)](()=>undefined)};const _0x1d40c4=await listDatabases(_0x116430),_0x53d95f=_0x1d40c4[_0x297bc4(0xfe)](_0x52b22e=>buildDbDirectoryName(_0x52b22e[_0x297bc4(0xe6)],_0x52b22e['dbId'])===_0x53f46f);if(_0x53d95f['length']===0x1)return{'dbId':_0x53d95f[0x0][_0x297bc4(0x102)],'dbName':_0x53d95f[0x0][_0x297bc4(0xe6)]};if(_0x53d95f[_0x297bc4(0xed)]===0x0)throw CliErrors[_0x297bc4(0xe8)](_0x297bc4(0x11a)+_0x53f46f+_0x297bc4(0xd9)+_0x20a085[_0x297bc4(0xf5)]+'.');const _0x513f9d=_0x53d95f[_0x297bc4(0x112)](_0x187fc4=>_0x187fc4[_0x297bc4(0xe6)]+'\x20('+_0x187fc4['dbId']+')')[_0x297bc4(0xde)](',\x20');throw CliErrors['validation'](_0x297bc4(0x10d)+_0x53f46f+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x20a085[_0x297bc4(0xf5)]+':\x20'+_0x513f9d);}function parseExplicitDbDirectory(_0x256702){const _0x4d69ae=a254_0x296c84,_0x3428ae=/^db-(\d+)$/[_0x4d69ae(0x109)](_0x256702);if(!_0x3428ae)return null;const _0x53db8d=Number(_0x3428ae[0x1]);return Number[_0x4d69ae(0x108)](_0x53db8d)&&_0x53db8d>0x0?_0x53db8d:null;}
|
|
1
|
+
const a254_0x6b6949=a254_0x3833;(function(_0x2a25ea,_0x58e99f){const _0x2cff37=a254_0x3833,_0x4d9256=_0x2a25ea();while(!![]){try{const _0x442839=-parseInt(_0x2cff37(0xbe))/0x1*(parseInt(_0x2cff37(0xe8))/0x2)+-parseInt(_0x2cff37(0xd7))/0x3*(parseInt(_0x2cff37(0xd4))/0x4)+-parseInt(_0x2cff37(0xc0))/0x5*(parseInt(_0x2cff37(0xd5))/0x6)+-parseInt(_0x2cff37(0xa4))/0x7*(parseInt(_0x2cff37(0x9f))/0x8)+parseInt(_0x2cff37(0xa1))/0x9*(-parseInt(_0x2cff37(0xc4))/0xa)+-parseInt(_0x2cff37(0xaf))/0xb*(-parseInt(_0x2cff37(0xbc))/0xc)+parseInt(_0x2cff37(0xbf))/0xd;if(_0x442839===_0x58e99f)break;else _0x4d9256['push'](_0x4d9256['shift']());}catch(_0x25165e){_0x4d9256['push'](_0x4d9256['shift']());}}}(a254_0x1d19,0x9fe23));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a254_0x3833(_0x3fc259,_0x523a3e){_0x3fc259=_0x3fc259-0x9f;const _0x1d1972=a254_0x1d19();let _0x3833c1=_0x1d1972[_0x3fc259];return _0x3833c1;}function a254_0x1d19(){const _0x2052ca=['message',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','691608pgqAYT','No\x20database\x20matches\x20local\x20directory\x20\x22','4517FfuFTq','53322737gwDXIO','5ibGMok','str','join','exec','368990lUyZtM','lockFilePath','relativePath','sqlConfig','/smartapi/custom/updateUserCustomSql','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','\x20pushed,\x20',':\x20SQL\x20content\x20is\x20empty.','sql','push','has','bool','trim','appCode','sqlName','sqlcode','328cxqJsg','6974514nUcySR','mode','23847LafhSd','sqls','filePath','length','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','trashDir','Local\x20SQL\x20not\x20found:\x20','path','lastSync','sqlRoot','map','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','projectRoot','sqlRootDir','\x20failed','hash','startsWith','236xTFaYp','Push\x20complete:\x20','toISOString','385312jkEIaZ','replace','315hYEzZL','unchanged','filter','14LHxraX','validation','sqlCode','utf8','Would\x20push\x20','\x20skipped,\x20','boolean','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','set','\x20SQL\x20file(s)','isFinite','55ljZyUe','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','remoteId','version','get','catch','dbId','entries','force','Push\x20local\x20SQL\x20files\x20to\x20remote','dbName'];a254_0x1d19=function(){return _0x2052ca;};return a254_0x1d19();}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x2ac574){const _0x1037e3=a254_0x3833,_0x435081=stripLocalSqlMetadata(await readFile(_0x2ac574['filePath'],_0x1037e3(0xa7)),_0x2ac574['mode']);if(!_0x435081[_0x1037e3(0xd0)]())throw CliErrors[_0x1037e3(0xa5)](_0x2ac574[_0x1037e3(0xa6)]+_0x1037e3(0xcb));return _0x435081;}async function getTargetSqlQueries(_0x529740,_0x4b780e,_0x1c226a){const _0x53d147=a254_0x3833,_0x11a59b=await scanLocalSqlQueries(_0x529740),_0x21ab45=new Map();for(const _0x2347a6 of _0x11a59b){if(_0x1c226a&&_0x2347a6[_0x53d147(0xa6)]!==_0x1c226a)continue;const _0x3a64bc=_0x21ab45[_0x53d147(0xb3)](_0x2347a6['sqlCode'])??[];_0x3a64bc['push'](_0x2347a6),_0x21ab45[_0x53d147(0xac)](_0x2347a6[_0x53d147(0xa6)],_0x3a64bc);}if(_0x1c226a&&!_0x21ab45[_0x53d147(0xce)](_0x1c226a))throw CliErrors[_0x53d147(0xa5)](_0x53d147(0xdd)+_0x1c226a);const _0x15a63e=[];for(const [_0x54081b,_0x36bf5b]of _0x21ab45[_0x53d147(0xb6)]()){if(_0x36bf5b[_0x53d147(0xda)]===0x1){_0x15a63e[_0x53d147(0xcd)](_0x36bf5b[0x0]);continue;}const _0xdec719=_0x4b780e['sqls'][_0x54081b],_0x1fe89d=_0xdec719?.['path'],_0x4da831=_0x1fe89d?_0x36bf5b[_0x53d147(0xa3)](_0x15f81f=>_0x15f81f[_0x53d147(0xc6)]!==_0x1fe89d):_0x36bf5b;if(_0xdec719&&_0x4da831[_0x53d147(0xda)]===0x1){_0x15a63e[_0x53d147(0xcd)](_0x4da831[0x0]);continue;}throw CliErrors['validation'](_0x53d147(0xdb)+_0x54081b+_0x53d147(0xb0));}return _0x15a63e;}export const sqlPush={'service':a254_0x6b6949(0xcc),'command':a254_0x6b6949(0xcd),'description':a254_0x6b6949(0xb8),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x6b6949(0xb7),'type':a254_0x6b6949(0xaa),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x3481d5){const _0xcce80c=a254_0x6b6949,_0x15762a=loadSqlProjectConfig(_0x3481d5[_0xcce80c(0xd1)]),_0x53f190=await readSqlLockFile(_0x15762a[_0xcce80c(0xc5)]),{appLock:_0x4478c0}=ensureSqlLockScope(_0x53f190??createEmptySqlLock(),_0x3481d5['appCode'],_0x15762a['sqlRoot'],_0xcce80c(0xcd)),_0x5872a2=await getTargetSqlQueries(_0x15762a,_0x4478c0,_0x3481d5[_0xcce80c(0xc1)]('sqlcode')||undefined),_0x350559=[];for(const _0x281eee of _0x5872a2){const _0x5d87f4=await computeSqlFileHash(_0x281eee[_0xcce80c(0xd9)]),_0x20ca04=_0x4478c0['sqls'][_0x281eee['sqlCode']],_0x4a35b7=!!_0x20ca04&&(_0x20ca04[_0xcce80c(0xde)]!==_0x281eee['relativePath']||!!_0x281eee[_0xcce80c(0xd2)]&&_0x20ca04[_0xcce80c(0xd2)]!==_0x281eee[_0xcce80c(0xd2)]||_0x20ca04['mode']!==_0x281eee['mode']);if(!_0x3481d5[_0xcce80c(0xcf)](_0xcce80c(0xb7))&&_0x20ca04&&_0x20ca04['hash']===_0x5d87f4&&!_0x4a35b7)continue;if(!_0x20ca04)throw CliErrors[_0xcce80c(0xa5)](_0x281eee[_0xcce80c(0xa6)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x20ca04[_0xcce80c(0xb2)]==null)throw CliErrors[_0xcce80c(0xa5)](_0x281eee['sqlCode']+_0xcce80c(0xbb));await resolveTargetDbBinding(_0x3481d5[_0xcce80c(0xd1)],_0x281eee,_0x20ca04),await readSqlUploadContent(_0x281eee),_0x350559[_0xcce80c(0xcd)](_0x281eee[_0xcce80c(0xa6)]);}return{'method':'POST','url':_0xcce80c(0xc8),'body':{'sqlCodes':_0x350559,'appCode':_0x3481d5['appCode']},'description':_0xcce80c(0xa8)+_0x350559[_0xcce80c(0xda)]+_0xcce80c(0xad)};},async 'execute'(_0x5bdcbe){const _0x3c66b2=a254_0x6b6949,_0x5e8bd3=loadSqlProjectConfig(_0x5bdcbe[_0x3c66b2(0xd1)]),_0x5b480b=await readSqlLockFile(_0x5e8bd3[_0x3c66b2(0xc5)]),{lockData:_0x443cf1,appLock:_0x4def70}=ensureSqlLockScope(_0x5b480b??createEmptySqlLock(),_0x5bdcbe[_0x3c66b2(0xd1)],_0x5e8bd3[_0x3c66b2(0xe0)],_0x3c66b2(0xcd)),_0x4ca8fc=await getTargetSqlQueries(_0x5e8bd3,_0x4def70,_0x5bdcbe[_0x3c66b2(0xc1)](_0x3c66b2(0xd3))||undefined);if(_0x4ca8fc['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x55e815=[],_0x49273d=[],_0xdf6cd7=[];let _0x10622e=![];for(const _0xed5d01 of _0x4ca8fc){const _0x420a71=_0x4def70[_0x3c66b2(0xd8)][_0xed5d01['sqlCode']];if(!_0x420a71){_0xdf6cd7[_0x3c66b2(0xcd)]({'sqlCode':_0xed5d01['sqlCode'],'error':_0x3c66b2(0xe2)});continue;}try{const _0xe66baa=await computeSqlFileHash(_0xed5d01[_0x3c66b2(0xd9)]),_0x2f57c8=_0x420a71[_0x3c66b2(0xde)]!==_0xed5d01[_0x3c66b2(0xc6)]||!!_0xed5d01[_0x3c66b2(0xd2)]&&_0x420a71['sqlName']!==_0xed5d01[_0x3c66b2(0xd2)]||_0x420a71[_0x3c66b2(0xd6)]!==_0xed5d01[_0x3c66b2(0xd6)];if(!_0x5bdcbe[_0x3c66b2(0xcf)](_0x3c66b2(0xb7))&&_0x420a71[_0x3c66b2(0xe6)]===_0xe66baa&&!_0x2f57c8){_0x49273d['push']({'sqlCode':_0xed5d01['sqlCode'],'reason':_0x3c66b2(0xa2)});continue;}if(_0x420a71[_0x3c66b2(0xb2)]==null){_0xdf6cd7['push']({'sqlCode':_0xed5d01['sqlCode'],'error':_0x3c66b2(0xab)});continue;}const _0x390f07=_0xed5d01[_0x3c66b2(0xd2)]||_0x420a71[_0x3c66b2(0xd2)],_0x38cf1b=await resolveTargetDbBinding(_0x5bdcbe[_0x3c66b2(0xd1)],_0xed5d01,_0x420a71),_0x2e2f4a=await readSqlUploadContent(_0xed5d01),_0x1e4ef5=await updateSqlQuery({'id':_0x420a71[_0x3c66b2(0xb1)],'appCode':_0x5bdcbe[_0x3c66b2(0xd1)],'sqlCode':_0xed5d01[_0x3c66b2(0xa6)],'sqlName':_0x390f07,'dbId':_0x38cf1b[_0x3c66b2(0xb5)],'version':_0x420a71[_0x3c66b2(0xb2)],'sqlContent':_0x2e2f4a,'sqlConfig':_0x420a71[_0x3c66b2(0xc7)]??undefined}),_0x2e5845=_0x1e4ef5['dbId']?await getDbName(_0x5bdcbe[_0x3c66b2(0xd1)],Number(_0x1e4ef5[_0x3c66b2(0xb5)]))[_0x3c66b2(0xb4)](()=>_0x38cf1b['dbName']):_0x38cf1b['dbName'];_0x4def70['sqls'][_0xed5d01[_0x3c66b2(0xa6)]]={...buildSqlLockEntry(_0x1e4ef5,_0x2e2f4a,_0xe66baa,{'dbName':_0x2e5845}),'path':_0xed5d01[_0x3c66b2(0xc6)],'mode':_0xed5d01['mode']},_0x10622e=!![],await archivePreviousSqlFileIfNeeded(_0x5e8bd3,_0x420a71[_0x3c66b2(0xde)],_0xed5d01[_0x3c66b2(0xc6)]),_0x55e815['push']({'sqlCode':_0xed5d01[_0x3c66b2(0xa6)],'remoteId':_0x420a71[_0x3c66b2(0xb1)]});}catch(_0x13943b){_0xdf6cd7[_0x3c66b2(0xcd)]({'sqlCode':_0xed5d01[_0x3c66b2(0xa6)],'error':_0x13943b instanceof Error?_0x13943b[_0x3c66b2(0xba)]:String(_0x13943b)});}}(_0x10622e||_0xdf6cd7[_0x3c66b2(0xda)]===0x0)&&(_0x4def70[_0x3c66b2(0xdf)]=new Date()['toISOString'](),await writeSqlLockFile(_0x5e8bd3[_0x3c66b2(0xc5)],_0x443cf1));const _0x474af4=_0xdf6cd7[_0x3c66b2(0xda)]===0x0;return{'ok':_0x474af4,'data':{'pushed':_0x55e815,'skipped':_0x49273d,'failed':_0xdf6cd7},'message':_0x3c66b2(0xe9)+_0x55e815[_0x3c66b2(0xda)]+_0x3c66b2(0xca)+_0x49273d[_0x3c66b2(0xda)]+_0x3c66b2(0xa9)+_0xdf6cd7[_0x3c66b2(0xda)]+_0x3c66b2(0xe5)};}};async function archivePreviousSqlFileIfNeeded(_0x34b796,_0x185fb3,_0x5c43ff){const _0x1a4150=a254_0x6b6949;if(!_0x185fb3||_0x185fb3===_0x5c43ff)return;const _0x101a73=join(_0x34b796[_0x1a4150(0xe4)],_0x185fb3);if(!await fileExists(_0x101a73))return;const _0x86a3af=await moveToTrash(_0x34b796[_0x1a4150(0xe3)],_0x34b796[_0x1a4150(0xdc)],_0x101a73);await cleanupEmptyDirectories(dirname(_0x101a73),_0x34b796['sqlRootDir']),void _0x86a3af;}async function moveToTrash(_0x72726c,_0x3a96ea,_0x5d0ba2){const _0x1ff16b=a254_0x6b6949,_0x43a80c=new Date()[_0x1ff16b(0xea)]()[_0x1ff16b(0xa0)](/[:.]/g,'-'),_0x2d80b2=relative(_0x72726c,_0x5d0ba2),_0x3165b6=join(_0x3a96ea,_0x43a80c,_0x2d80b2);return await mkdir(dirname(_0x3165b6),{'recursive':!![]}),await rename(_0x5d0ba2,_0x3165b6),_0x3165b6;}async function cleanupEmptyDirectories(_0x1fcba7,_0xb86e07){const _0x236c9=a254_0x6b6949;let _0xb4c5c3=resolve(_0x1fcba7);const _0x531abd=resolve(_0xb86e07);while(_0xb4c5c3[_0x236c9(0xe7)](''+_0x531abd+sep)||_0xb4c5c3===_0x531abd){if(_0xb4c5c3===_0x531abd)return;try{const _0x393a98=await readdir(_0xb4c5c3);if(_0x393a98['length']>0x0)return;await rmdir(_0xb4c5c3);}catch{return;}_0xb4c5c3=dirname(_0xb4c5c3);}}async function resolveTargetDbBinding(_0xbe9b05,_0x14598c,_0x21ab81){const _0x7a1b94=a254_0x6b6949,_0x4fef29=_0x14598c['dbDirectory'];if(!_0x4fef29)return{'dbId':_0x21ab81[_0x7a1b94(0xb5)],'dbName':_0x21ab81[_0x7a1b94(0xb9)]};const _0x44a1b5=buildDbDirectoryName(_0x21ab81[_0x7a1b94(0xb9)],_0x21ab81['dbId']);if(_0x4fef29===_0x44a1b5)return{'dbId':_0x21ab81[_0x7a1b94(0xb5)],'dbName':_0x21ab81[_0x7a1b94(0xb9)]};const _0xa39975=parseExplicitDbDirectory(_0x4fef29);if(_0xa39975!=null)return{'dbId':_0xa39975,'dbName':await getDbName(_0xbe9b05,_0xa39975)['catch'](()=>undefined)};const _0x1f2a3c=await listDatabases(_0xbe9b05),_0x9b727f=_0x1f2a3c[_0x7a1b94(0xa3)](_0x1ff126=>buildDbDirectoryName(_0x1ff126['dbName'],_0x1ff126['dbId'])===_0x4fef29);if(_0x9b727f[_0x7a1b94(0xda)]===0x1)return{'dbId':_0x9b727f[0x0]['dbId'],'dbName':_0x9b727f[0x0]['dbName']};if(_0x9b727f[_0x7a1b94(0xda)]===0x0)throw CliErrors[_0x7a1b94(0xa5)](_0x7a1b94(0xbd)+_0x4fef29+'\x22\x20for\x20sqlCode\x20'+_0x14598c[_0x7a1b94(0xa6)]+'.');const _0x559175=_0x9b727f[_0x7a1b94(0xe1)](_0x8ed6ce=>_0x8ed6ce[_0x7a1b94(0xb9)]+'\x20('+_0x8ed6ce[_0x7a1b94(0xb5)]+')')[_0x7a1b94(0xc2)](',\x20');throw CliErrors[_0x7a1b94(0xa5)]('Local\x20directory\x20\x22'+_0x4fef29+_0x7a1b94(0xc9)+_0x14598c['sqlCode']+':\x20'+_0x559175);}function parseExplicitDbDirectory(_0x2ad132){const _0x1bb944=a254_0x6b6949,_0x21933c=/^db-(\d+)$/[_0x1bb944(0xc3)](_0x2ad132);if(!_0x21933c)return null;const _0x4b6f2=Number(_0x21933c[0x1]);return Number[_0x1bb944(0xae)](_0x4b6f2)&&_0x4b6f2>0x0?_0x4b6f2:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a255_0x5a0949=a255_0x3164;function a255_0x3164(_0x53773b,_0x488c6f){_0x53773b=_0x53773b-0xbd;const _0x581d4c=a255_0x581d();let _0x31643b=_0x581d4c[_0x53773b];return _0x31643b;}(function(_0x3a0434,_0x133d7d){const _0x4955ae=a255_0x3164,_0x3c9c6f=_0x3a0434();while(!![]){try{const _0x1f0137=-parseInt(_0x4955ae(0xeb))/0x1*(-parseInt(_0x4955ae(0xc7))/0x2)+-parseInt(_0x4955ae(0xd4))/0x3+parseInt(_0x4955ae(0xd0))/0x4+-parseInt(_0x4955ae(0xcb))/0x5*(parseInt(_0x4955ae(0xda))/0x6)+-parseInt(_0x4955ae(0xe3))/0x7+-parseInt(_0x4955ae(0xcc))/0x8+-parseInt(_0x4955ae(0xd5))/0x9*(-parseInt(_0x4955ae(0xea))/0xa);if(_0x1f0137===_0x133d7d)break;else _0x3c9c6f['push'](_0x3c9c6f['shift']());}catch(_0x8c924f){_0x3c9c6f['push'](_0x3c9c6f['shift']());}}}(a255_0x581d,0x1bd0a));import{createInterface}from'node:readline';function a255_0x581d(){const _0x4e5d33=['trimStart','sqlName','split','description','join','\x20-->','length','lastSync','443890BVLOdF','mybatisXml','dbId','apps','55rqVaUZ','1286840IrkCau','filter','syncedAt','stdin','320148OyyTNs','sqlConfig','declaration','replace','643914JYGcsF','729TscUSq','stderr','map','\x20[y/N]\x20','body','76278VkEeOZ','<!--\x20@lovrabet.','question','includes','test','toLowerCase','trim','yes','endsWith','291130smZvGG','sqlContent','mode','close','entries','version','sqlCode','45540bAxhod','1JMFQyX','.rabetbase/sql','path','dbName','sqlRoot','slice','exec'];a255_0x581d=function(){return _0x4e5d33;};return a255_0x581d();}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a255_0x5a0949(0xec);export function buildSqlLockEntry(_0x42c5b8,_0x18ca50,_0x5e1e34,_0x3850ba){const _0x4b885a=a255_0x5a0949,_0x58a6d7=detectSqlMode(_0x18ca50);return{'path':buildSqlRelativePath(_0x42c5b8[_0x4b885a(0xe9)],_0x42c5b8[_0x4b885a(0xc0)],_0x3850ba?.[_0x4b885a(0xee)],_0x58a6d7,_0x42c5b8['dbId']),'hash':_0x5e1e34,'remoteId':_0x42c5b8['id'],'version':_0x42c5b8[_0x4b885a(0xe8)],'dbId':Number(_0x42c5b8[_0x4b885a(0xc9)]),'dbName':_0x3850ba?.[_0x4b885a(0xee)],'sqlName':_0x42c5b8[_0x4b885a(0xc0)],'sqlConfig':_0x42c5b8[_0x4b885a(0xd1)]??undefined,'mode':_0x58a6d7};}export function cloneSqlLockData(_0x182442){const _0x4477fa=a255_0x5a0949;return{'apps':Object['fromEntries'](Object[_0x4477fa(0xe7)](_0x182442['apps'])[_0x4477fa(0xd7)](([_0x46cc3f,_0x38ee8d])=>[_0x46cc3f,{'sqlRoot':_0x38ee8d[_0x4477fa(0xef)],'lastSync':_0x38ee8d[_0x4477fa(0xc6)],'sqls':{..._0x38ee8d['sqls']}}]))};}export function ensureRemoteSqlContent(_0x3bc8c5){const _0x35f27a=a255_0x5a0949;return _0x3bc8c5[_0x35f27a(0xe4)]??'';}export function buildLocalSqlFileContent(_0xb43326,_0x36b6c3,_0x4386e3){const _0x5900b6=a255_0x5a0949,_0x24f1d2=_0x4386e3?.[_0x5900b6(0xe5)]??detectSqlMode(_0x36b6c3),_0x5e1d5b=stripLocalSqlMetadata(_0x36b6c3,_0x24f1d2)[_0x5900b6(0xe0)](),_0x483888=buildMetadataHeaderLines({'sqlCode':_0xb43326['sqlCode'],'sqlName':_0xb43326[_0x5900b6(0xc0)],'dbId':_0xb43326[_0x5900b6(0xc9)],'dbName':_0x4386e3?.[_0x5900b6(0xee)],'mode':_0x24f1d2,'syncedAt':_0x4386e3?.['syncedAt'],'description':_0x4386e3?.[_0x5900b6(0xc2)]},_0x24f1d2),_0x1fb4ad=_0x24f1d2===_0x5900b6(0xc8)?splitXmlDeclaration(_0x5e1d5b):{'body':_0x5e1d5b},_0x4bcfef=[..._0x1fb4ad['declaration']?[_0x1fb4ad[_0x5900b6(0xd2)]]:[],..._0x483888,'',_0x1fb4ad[_0x5900b6(0xd9)][_0x5900b6(0xbf)]()],_0x5168fe=_0x4bcfef[_0x5900b6(0xc3)]('\x0a');return _0x5168fe[_0x5900b6(0xe2)]('\x0a')?_0x5168fe:_0x5168fe+'\x0a';}export function stripLocalSqlMetadata(_0x46973a,_0x15b3ba){const _0x39e497=a255_0x5a0949;if(_0x15b3ba===_0x39e497(0xc8)){const {declaration:_0x372966,body:_0x3bc6b5}=splitXmlDeclaration(_0x46973a[_0x39e497(0xd3)](/\r\n/g,'\x0a')),_0xaa27d8=stripLeadingMetadataLines(_0x3bc6b5,/^\s*<!--\s*@lovrabet\./);return _0x372966?''+_0x372966+(_0xaa27d8?'\x0a'+_0xaa27d8:''):_0xaa27d8;}return stripLeadingMetadataLines(_0x46973a['replace'](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x2a7af1,_0x319726){const _0x83aa6b=a255_0x5a0949;if(_0x319726?.[_0x83aa6b(0xe5)])return _0x319726['mode'];return detectSqlMode(_0x2a7af1);}export function resolveSqlFileName(_0x4143f7,_0x4ecd81,_0x5eb4dc){const _0x12cb0c=a255_0x5a0949;if(_0x5eb4dc?.['path'])return _0x5eb4dc[_0x12cb0c(0xed)];if(_0x5eb4dc?.['sqlName']||_0x5eb4dc?.['dbName'])return buildSqlRelativePath(_0x4143f7,_0x5eb4dc?.[_0x12cb0c(0xc0)],_0x5eb4dc?.[_0x12cb0c(0xee)],resolveSqlMode(_0x4ecd81,_0x5eb4dc),_0x5eb4dc?.[_0x12cb0c(0xc9)]);return buildDefaultSqlFileName(_0x4143f7,resolveSqlMode(_0x4ecd81,_0x5eb4dc));}export function resolveSqlLocalDir(_0x2e3492,_0x361a16){return join(_0x2e3492,SQL_LOCAL_REL_DIR,_0x361a16);}export async function confirmForceOverwrite(_0x14522e){const _0x1ebcd9=a255_0x5a0949,_0x3bbb95=createInterface({'input':process[_0x1ebcd9(0xcf)],'output':process[_0x1ebcd9(0xd6)]}),_0xfde60a=await new Promise(_0x2c8f48=>{const _0x3c0eca=_0x1ebcd9;_0x3bbb95[_0x3c0eca(0xdc)](_0x14522e+_0x3c0eca(0xd8),_0x2c8f48);});return _0x3bbb95[_0x1ebcd9(0xe6)](),['y',_0x1ebcd9(0xe1)][_0x1ebcd9(0xdd)](_0xfde60a['trim']()[_0x1ebcd9(0xdf)]());}export function findSqlLockScope(_0x1b315b,_0x39bb12){const _0x367425=a255_0x5a0949;return _0x1b315b[_0x367425(0xca)][_0x39bb12];}function buildMetadataHeaderLines(_0x53d1c4,_0x545363){const _0x1344b6=a255_0x5a0949,_0x3ff798=[[_0x1344b6(0xe9),_0x53d1c4[_0x1344b6(0xe9)]],[_0x1344b6(0xc0),_0x53d1c4[_0x1344b6(0xc0)]],[_0x1344b6(0xc9),_0x53d1c4[_0x1344b6(0xc9)]],[_0x1344b6(0xee),_0x53d1c4['dbName']],[_0x1344b6(0xe5),_0x53d1c4[_0x1344b6(0xe5)]],[_0x1344b6(0xce),_0x53d1c4[_0x1344b6(0xce)]],[_0x1344b6(0xc2),_0x53d1c4[_0x1344b6(0xc2)]]];if(_0x545363==='mybatisXml')return _0x3ff798[_0x1344b6(0xcd)](([,_0x2baebe])=>_0x2baebe!==undefined&&_0x2baebe!==null&&String(_0x2baebe)[_0x1344b6(0xe0)]()!=='')[_0x1344b6(0xd7)](([_0x531ac0,_0x5207f4])=>_0x1344b6(0xdb)+_0x531ac0+':\x20'+String(_0x5207f4)+_0x1344b6(0xc4));return _0x3ff798[_0x1344b6(0xcd)](([,_0x15e6ea])=>_0x15e6ea!==undefined&&_0x15e6ea!==null&&String(_0x15e6ea)[_0x1344b6(0xe0)]()!=='')['map'](([_0x4c4dca,_0x234a4c])=>'--\x20@lovrabet.'+_0x4c4dca+':\x20'+String(_0x234a4c));}function splitXmlDeclaration(_0x21070a){const _0x21e6de=a255_0x5a0949,_0x45ca95=_0x21070a[_0x21e6de(0xbf)](),_0x152258=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x21e6de(0xbe)](_0x45ca95);if(!_0x152258)return{'body':_0x21070a};return{'declaration':_0x152258[0x0],'body':_0x45ca95[_0x21e6de(0xbd)](_0x152258[0x0][_0x21e6de(0xc5)])};}function stripLeadingMetadataLines(_0xe4b49,_0x388cf5){const _0x264bee=a255_0x5a0949,_0x171879=_0xe4b49[_0x264bee(0xc1)]('\x0a');let _0x50b3f2=0x0;while(_0x50b3f2<_0x171879['length']){const _0x122468=_0x171879[_0x50b3f2]??'';if(_0x388cf5[_0x264bee(0xde)](_0x122468)||_0x122468[_0x264bee(0xe0)]()===''){_0x50b3f2++;continue;}break;}return _0x171879[_0x264bee(0xbd)](_0x50b3f2)['join']('\x0a')[_0x264bee(0xbf)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a256_0x2a3f(_0x4add12,_0xc52262){_0x4add12=_0x4add12-0x113;const _0x31ce39=a256_0x31ce();let _0x2a3f13=_0x31ce39[_0x4add12];return _0x2a3f13;}const a256_0x16d3f9=a256_0x2a3f;(function(_0x154a80,_0x44c188){const _0x275639=a256_0x2a3f,_0x1d5b90=_0x154a80();while(!![]){try{const _0x6d6464=parseInt(_0x275639(0x123))/0x1*(parseInt(_0x275639(0x11a))/0x2)+parseInt(_0x275639(0x122))/0x3+-parseInt(_0x275639(0x128))/0x4*(-parseInt(_0x275639(0x135))/0x5)+parseInt(_0x275639(0x12b))/0x6+-parseInt(_0x275639(0x11c))/0x7+parseInt(_0x275639(0x120))/0x8+-parseInt(_0x275639(0x12e))/0x9*(parseInt(_0x275639(0x11e))/0xa);if(_0x6d6464===_0x44c188)break;else _0x1d5b90['push'](_0x1d5b90['shift']());}catch(_0xc2eef6){_0x1d5b90['push'](_0x1d5b90['shift']());}}}(a256_0x31ce,0xdec28));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';function a256_0x31ce(){const _0x82e469=['353886AwDNgE','appCode','boolean','2090196UUVMjh','filePath','push','path','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','remote','relativePath','3612290mfWlsL','hash','sqls','\x20unchanged','paging','lockKey','sqlRoot','\x20missing,\x20','851988XxQmDq','sqlCode','11425211OAKQPQ','lockFilePath','80GAWZwo','sqlName','11800472ywAwSU','status','2992797KpHaZL','1RzSToj','bool','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','length','has','8ZqBUlp','map','\x20remote-only'];a256_0x31ce=function(){return _0x82e469;};return a256_0x31ce();}const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x763e04){const _0xaabb3f=a256_0x2a3f,_0x37242a=[];let _0x4b62aa=0x1;while(!![]){const _0x75399d=await listSqlQueries(_0x763e04,{'currentPage':_0x4b62aa,'pageSize':PAGE_SIZE}),_0x4d05c7=_0x75399d['tableData']??[];_0x37242a[_0xaabb3f(0x130)](..._0x4d05c7[_0xaabb3f(0x129)](_0x436b47=>_0x436b47[_0xaabb3f(0x11b)]));if(_0x4d05c7[_0xaabb3f(0x126)]===0x0)break;const _0x2348a7=_0x75399d[_0xaabb3f(0x116)]?.['totalCount'];if(_0x2348a7!=null?_0x37242a[_0xaabb3f(0x126)]>=_0x2348a7:_0x4d05c7[_0xaabb3f(0x126)]<PAGE_SIZE)break;_0x4b62aa++;}return _0x37242a;}export const sqlStatus={'service':'sql','command':a256_0x16d3f9(0x121),'description':a256_0x16d3f9(0x125),'risk':'read','flags':[{'name':a256_0x16d3f9(0x133),'type':a256_0x16d3f9(0x12d),'description':a256_0x16d3f9(0x132)}],async 'execute'(_0x19774f){const _0x23ff35=a256_0x16d3f9,_0x4b8322=loadSqlProjectConfig(_0x19774f[_0x23ff35(0x12c)]),_0x128efb=await readSqlLockFile(_0x4b8322[_0x23ff35(0x11d)]),{appLock:_0x50a87e}=ensureSqlLockScope(_0x128efb??createEmptySqlLock(),_0x4b8322[_0x23ff35(0x12c)],_0x4b8322[_0x23ff35(0x118)],_0x23ff35(0x121)),_0x4872b0=await scanLocalSqlQueries(_0x4b8322),_0xf66dc8=[],_0x4e2c51=[],_0x134e64=[],_0x1bce82=[],_0x4c4bc0=new Set(_0x4872b0['map'](_0x56e336=>_0x56e336[_0x23ff35(0x117)]));for(const _0x3ac0f of _0x4872b0){const _0x5e185e=await computeSqlFileHash(_0x3ac0f[_0x23ff35(0x12f)]),_0x388b66=_0x50a87e[_0x23ff35(0x114)][_0x3ac0f[_0x23ff35(0x117)]],_0x436681=!!_0x388b66&&_0x388b66[_0x23ff35(0x131)]!==_0x3ac0f[_0x23ff35(0x134)],_0x1a2872=!!_0x388b66&&!!_0x3ac0f['sqlName']&&_0x388b66['sqlName']!==_0x3ac0f[_0x23ff35(0x11f)];if(!_0x388b66)_0xf66dc8[_0x23ff35(0x130)](_0x3ac0f['lockKey']);else _0x388b66[_0x23ff35(0x113)]!==_0x5e185e||_0x436681||_0x1a2872?_0x4e2c51[_0x23ff35(0x130)](_0x3ac0f[_0x23ff35(0x117)]):_0x134e64[_0x23ff35(0x130)](_0x3ac0f[_0x23ff35(0x117)]);}for(const _0x384eba of Object['keys'](_0x50a87e[_0x23ff35(0x114)])){!_0x4c4bc0['has'](_0x384eba)&&_0x1bce82['push'](_0x384eba);}const _0x478824=[];if(_0x19774f[_0x23ff35(0x124)](_0x23ff35(0x133))){const _0x50f2fc=await fetchAllSqlCodes(_0x19774f[_0x23ff35(0x12c)]);for(const _0x59e492 of _0x50f2fc){!_0x4c4bc0[_0x23ff35(0x127)](_0x59e492)&&!_0x50a87e['sqls'][_0x59e492]&&_0x478824['push'](_0x59e492);}}const _0x3399b5=_0xf66dc8[_0x23ff35(0x126)]===0x0&&_0x4e2c51[_0x23ff35(0x126)]===0x0&&_0x1bce82[_0x23ff35(0x126)]===0x0&&_0x478824[_0x23ff35(0x126)]===0x0;return{'ok':!![],'data':{'added':_0xf66dc8,'modified':_0x4e2c51,'missing':_0x1bce82,'unchanged':_0x134e64,'remoteOnly':_0x478824},'message':_0x3399b5?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0xf66dc8[_0x23ff35(0x126)]+'\x20added,\x20'+_0x4e2c51[_0x23ff35(0x126)]+'\x20modified,\x20'+_0x1bce82['length']+_0x23ff35(0x119)+_0x134e64[_0x23ff35(0x126)]+_0x23ff35(0x115)+(_0x478824[_0x23ff35(0x126)]>0x0?',\x20'+_0x478824['length']+_0x23ff35(0x12a):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a257_0x16e2(_0x3ac3fd,_0x846ce9){_0x3ac3fd=_0x3ac3fd-0x1e6;const _0x36e941=a257_0x36e9();let _0x16e228=_0x36e941[_0x3ac3fd];return _0x16e228;}const a257_0x508248=a257_0x16e2;(function(_0x2d76a7,_0x4d9804){const _0x47b7cf=a257_0x16e2,_0x29829b=_0x2d76a7();while(!![]){try{const _0x18c246=-parseInt(_0x47b7cf(0x1e7))/0x1+parseInt(_0x47b7cf(0x1fe))/0x2+parseInt(_0x47b7cf(0x1e6))/0x3+parseInt(_0x47b7cf(0x1fd))/0x4+-parseInt(_0x47b7cf(0x20a))/0x5+-parseInt(_0x47b7cf(0x203))/0x6+parseInt(_0x47b7cf(0x228))/0x7*(-parseInt(_0x47b7cf(0x209))/0x8);if(_0x18c246===_0x4d9804)break;else _0x29829b['push'](_0x29829b['shift']());}catch(_0x141613){_0x29829b['push'](_0x29829b['shift']());}}}(a257_0x36e9,0xc3672));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a257_0x508248(0x201),'command':a257_0x508248(0x211),'description':a257_0x508248(0x219),'risk':'read','flags':[{'name':a257_0x508248(0x213),'type':a257_0x508248(0x20c),'description':a257_0x508248(0x1fc)},{'name':'sql','type':a257_0x508248(0x20c),'description':a257_0x508248(0x215)},{'name':a257_0x508248(0x20e),'type':a257_0x508248(0x20c),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'},{'name':'check-indexes','type':a257_0x508248(0x1ee),'description':a257_0x508248(0x20b)}],async 'execute'(_0x10c889){const _0x4c47fc=a257_0x508248,_0x4372bc=_0x10c889[_0x4c47fc(0x1f2)](_0x4c47fc(0x213)),_0x334a0e=_0x10c889[_0x4c47fc(0x1f2)]('sql'),_0x6ae5a6=_0x10c889[_0x4c47fc(0x1f2)]('schemas'),_0x4e2bff=_0x10c889[_0x4c47fc(0x225)](_0x4c47fc(0x205));if(!_0x4372bc&&!_0x334a0e)throw CliErrors[_0x4c47fc(0x208)](_0x4c47fc(0x213),_0x4c47fc(0x218));if(_0x4e2bff&&!_0x6ae5a6)throw CliErrors['validation']('--check-indexes\x20requires\x20--schemas.');let _0x486754;if(_0x4372bc){const _0x1fcde7=resolve(process[_0x4c47fc(0x1f0)](),_0x4372bc);if(!existsSync(_0x1fcde7))throw CliErrors[_0x4c47fc(0x1ef)](_0x4c47fc(0x1e8)+_0x1fcde7);_0x486754=readFileSync(_0x1fcde7,_0x4c47fc(0x1f4));}else _0x486754=_0x334a0e;const _0x429ded=validateSql(_0x486754),_0x3b826f={'valid':_0x429ded[_0x4c47fc(0x210)],'sqlType':_0x429ded[_0x4c47fc(0x221)]['type'],'isSelectOnly':_0x429ded['sqlType'][_0x4c47fc(0x21f)],'isLockingRead':_0x429ded[_0x4c47fc(0x221)]['isLockingRead']??![],'isDangerous':_0x429ded[_0x4c47fc(0x221)][_0x4c47fc(0x214)],'tables':_0x429ded[_0x4c47fc(0x1ed)],'parameters':_0x429ded[_0x4c47fc(0x220)],'message':_0x429ded[_0x4c47fc(0x1f5)]};_0x429ded[_0x4c47fc(0x221)][_0x4c47fc(0x202)]&&(_0x3b826f[_0x4c47fc(0x202)]=_0x429ded['sqlType'][_0x4c47fc(0x202)]);if(_0x6ae5a6&&_0x429ded[_0x4c47fc(0x210)]){const _0x59eb25=_0x6ae5a6[_0x4c47fc(0x1f8)](',')['map'](_0xd48ce7=>_0xd48ce7[_0x4c47fc(0x1fa)]())[_0x4c47fc(0x21d)](Boolean),_0x1130ad=[],_0xe7675=[],_0x21e37d=filterDbTableBackedDatasets(await listDatasets(_0x10c889[_0x4c47fc(0x206)])),_0x2ea675=new Map(_0x21e37d[_0x4c47fc(0x1ea)](_0x5549e5=>[_0x5549e5['dbtableConfig']?.[_0x4c47fc(0x1f7)]?.[_0x4c47fc(0x1f1)](),_0x5549e5]));for(const _0x119b06 of _0x429ded[_0x4c47fc(0x1ed)]){const _0x55f6d6=_0x2ea675[_0x4c47fc(0x212)](_0x119b06['toLowerCase']());!_0x55f6d6&&_0x1130ad[_0x4c47fc(0x20d)](_0x4c47fc(0x229)+_0x119b06+_0x4c47fc(0x204));}for(const _0x131777 of _0x59eb25){let _0x6e2d0d;try{_0x6e2d0d=await getDatasetDetail(_0x131777);}catch{_0x1130ad[_0x4c47fc(0x20d)](_0x4c47fc(0x1ec)+_0x131777+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x6e2d0d,_0x4c47fc(0x216));const _0xf6224e=Array[_0x4c47fc(0x1f9)](_0x6e2d0d['fields'])?_0x6e2d0d['fields']:[],_0x1f3a22=new Set(_0xf6224e[_0x4c47fc(0x1ea)](_0x17f6c5=>_0x17f6c5[_0x4c47fc(0x21b)]?.[_0x4c47fc(0x1f1)]())),_0x143554=_0x6e2d0d[_0x4c47fc(0x21e)]?.[_0x4c47fc(0x1f7)]||_0x6e2d0d[_0x4c47fc(0x1f7)]||_0x131777;_0x3b826f[_0x4c47fc(0x223)+_0x143554]={'code':_0x131777,'tableName':_0x143554,'fieldCount':_0x1f3a22['size'],'fields':Array[_0x4c47fc(0x1e9)](_0x1f3a22)};if(_0x4e2bff){const _0x5792d7=normalizeDatasetIndexes(_0x6e2d0d);_0xe7675['push']({'tableName':_0x143554,..._0x5792d7});}}_0x1130ad[_0x4c47fc(0x1eb)]>0x0&&(_0x3b826f[_0x4c47fc(0x217)]=_0x1130ad),_0x4e2bff&&(_0x3b826f[_0x4c47fc(0x20f)]=auditSqlJoinIndexes(_0x486754,_0xe7675));}return{'ok':_0x429ded[_0x4c47fc(0x210)],'data':_0x3b826f,'message':_0x429ded[_0x4c47fc(0x1f5)]};}};function normalizeDatasetIndexes(_0x6ffa09){const _0x30e1c3=a257_0x508248,_0x414b92=Array[_0x30e1c3(0x1f9)](_0x6ffa09?.[_0x30e1c3(0x224)]?.[_0x30e1c3(0x207)])?_0x6ffa09[_0x30e1c3(0x224)][_0x30e1c3(0x207)]:Array[_0x30e1c3(0x1f9)](_0x6ffa09?.['indexes'])?_0x6ffa09['indexes']:[],_0x2beca3=_0x414b92[_0x30e1c3(0x1ff)](_0x273c82=>{const _0x4e97b1=_0x30e1c3,_0xb7219d=Array[_0x4e97b1(0x1f9)](_0x273c82?.[_0x4e97b1(0x227)])?_0x273c82[_0x4e97b1(0x227)]:Array[_0x4e97b1(0x1f9)](_0x273c82?.[_0x4e97b1(0x21c)])?_0x273c82['columnNames']:Array['isArray'](_0x273c82?.[_0x4e97b1(0x21a)])?_0x273c82[_0x4e97b1(0x21a)]:[],_0x270758=_0xb7219d['filter'](_0x27a5ac=>typeof _0x27a5ac==='string')['map'](_0x5d31cc=>_0x5d31cc[_0x4e97b1(0x1fa)]())[_0x4e97b1(0x21d)](Boolean);if(_0x270758[_0x4e97b1(0x1eb)]===0x0)return[];const _0x312616=[_0x273c82?.[_0x4e97b1(0x226)],_0x273c82?.[_0x4e97b1(0x1f3)],_0x273c82?.['name']][_0x4e97b1(0x1fb)](_0x50c56e=>typeof _0x50c56e===_0x4e97b1(0x20c)&&_0x50c56e[_0x4e97b1(0x1fa)]()),_0x21cb78=[_0x273c82?.['index_type'],_0x273c82?.['type']][_0x4e97b1(0x1fb)](_0x3215af=>typeof _0x3215af===_0x4e97b1(0x20c)&&_0x3215af[_0x4e97b1(0x1fa)]());return[{..._0x312616?{'name':_0x312616[_0x4e97b1(0x1fa)]()}:{},..._0x21cb78?{'type':_0x21cb78[_0x4e97b1(0x1fa)]()}:{},'columns':_0x270758}];}),_0x17aea1=[..._0x2beca3],_0x845af3=typeof _0x6ffa09?.[_0x30e1c3(0x21e)]?.[_0x30e1c3(0x200)]===_0x30e1c3(0x20c)?_0x6ffa09['dbtableConfig']['pkField'][_0x30e1c3(0x1f8)](',')[_0x30e1c3(0x1ea)](_0x12498d=>_0x12498d[_0x30e1c3(0x1fa)]())[_0x30e1c3(0x21d)](Boolean):[];return _0x845af3[_0x30e1c3(0x1eb)]>0x0&&_0x17aea1[_0x30e1c3(0x222)]({'type':_0x30e1c3(0x1f6),'columns':_0x845af3}),{'indexes':_0x17aea1,'metadataAvailable':_0x2beca3[_0x30e1c3(0x1eb)]>0x0};}function a257_0x36e9(){const _0x34af33=['str','index_name','utf-8','message','primary','tableName','split','isArray','trim','find','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','1844156MysGej','1067634UmeQNG','flatMap','pkField','sql','reason','2018922slZcmk','\x22\x20not\x20found\x20in\x20any\x20dataset','check-indexes','appCode','indexes','flagMissing','1173992yVCpnr','1314255gmEIpj','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','string','push','schemas','joinAudit','valid','validate','get','file','isDangerous','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','SQL\x20schema\x20validation','schemaWarnings','Provide\x20--file\x20or\x20--sql','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','columns','name','columnNames','filter','dbtableConfig','isSelectOnly','parameters','sqlType','unshift','schema:','dataset','bool','indexName','index_columns','7qXPiYa','Table\x20\x22','4052175pASgeB','799124UCGeji','File\x20not\x20found:\x20','from','map','length','Dataset\x20\x22','tables','boolean','validation','cwd','toLowerCase'];a257_0x36e9=function(){return _0x34af33;};return a257_0x36e9();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x58f034,_0x6961ec){const _0x4d116a=a258_0xd23a,_0x1da8b8=_0x58f034();while(!![]){try{const _0x3f3f30=parseInt(_0x4d116a(0x176))/0x1+parseInt(_0x4d116a(0x17a))/0x2*(parseInt(_0x4d116a(0x173))/0x3)+parseInt(_0x4d116a(0x172))/0x4*(parseInt(_0x4d116a(0x177))/0x5)+parseInt(_0x4d116a(0x171))/0x6+-parseInt(_0x4d116a(0x175))/0x7*(parseInt(_0x4d116a(0x17b))/0x8)+parseInt(_0x4d116a(0x174))/0x9*(parseInt(_0x4d116a(0x17c))/0xa)+-parseInt(_0x4d116a(0x178))/0xb*(parseInt(_0x4d116a(0x179))/0xc);if(_0x3f3f30===_0x6961ec)break;else _0x1da8b8['push'](_0x1da8b8['shift']());}catch(_0x42cb32){_0x1da8b8['push'](_0x1da8b8['shift']());}}}(a258_0x3519,0xba906));function a258_0x3519(){const _0x3ffb9d=['4414904SfkRBP','1939110UmfKlk','5700648jlVekO','5468844chTGIv','732723UUqRNB','18uiKCSD','7CtsMTD','1194044WdYqvk','5GvDKWQ','22267311yicVbv','24cIIxGZ','12oLrKka'];a258_0x3519=function(){return _0x3ffb9d;};return a258_0x3519();}function a258_0xd23a(_0x4c2d55,_0x526257){_0x4c2d55=_0x4c2d55-0x171;const _0x351962=a258_0x3519();let _0xd23a52=_0x351962[_0x4c2d55];return _0xd23a52;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a259_0xb37fc7=a259_0x1a96;function a259_0x1a96(_0xe28824,_0x5dc249){_0xe28824=_0xe28824-0x1f1;const _0x319388=a259_0x3193();let _0x1a96e1=_0x319388[_0xe28824];return _0x1a96e1;}(function(_0x4ab2e6,_0x1d6677){const _0x1fbe18=a259_0x1a96,_0x1cdde5=_0x4ab2e6();while(!![]){try{const _0x4dd818=parseInt(_0x1fbe18(0x200))/0x1*(parseInt(_0x1fbe18(0x1f5))/0x2)+-parseInt(_0x1fbe18(0x203))/0x3+parseInt(_0x1fbe18(0x1f4))/0x4+parseInt(_0x1fbe18(0x1f9))/0x5+parseInt(_0x1fbe18(0x201))/0x6+parseInt(_0x1fbe18(0x206))/0x7+-parseInt(_0x1fbe18(0x204))/0x8*(parseInt(_0x1fbe18(0x1fb))/0x9);if(_0x4dd818===_0x1d6677)break;else _0x1cdde5['push'](_0x1cdde5['shift']());}catch(_0x5e3a77){_0x1cdde5['push'](_0x1cdde5['shift']());}}}(a259_0x3193,0x740a6));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a259_0x3193(){const _0x568d9b=['flagMissing','1417Itcyhu','3189960BTCxUp','cookie','231906hyqpGs','24162520gACaIl','appCode','6615630pGcFQX','task',',\x20received\x20','taskId','compress','str','status','trim','2992064qurzjP','1086nfEnxd','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','task-id','read','2893610XnBnOV','string','9bYwfSx','isTerminal','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','apiError'];a259_0x3193=function(){return _0x568d9b;};return a259_0x3193();}import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a259_0xb37fc7(0x207),'command':a259_0xb37fc7(0x1f2),'description':a259_0xb37fc7(0x1fd),'risk':a259_0xb37fc7(0x1f8),'defaultOutputFormat':a259_0xb37fc7(0x20a),'structuredErrors':!![],'flags':[{'name':a259_0xb37fc7(0x1f7),'type':a259_0xb37fc7(0x1fa),'required':!![],'description':a259_0xb37fc7(0x1f6)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2a050a){const _0x418ae8=a259_0xb37fc7;if(!_0x2a050a[_0x418ae8(0x1f1)](_0x418ae8(0x1f7))['trim']())throw CliErrors[_0x418ae8(0x1ff)](_0x418ae8(0x1f7));},async 'execute'(_0x947014){const _0x2c5376=a259_0xb37fc7,_0x28076c=_0x947014[_0x2c5376(0x1f1)](_0x2c5376(0x1f7))[_0x2c5376(0x1f3)](),_0x3e5aaf=normalizeAsyncTask(await getAsyncTaskStatus(_0x28076c,_0x947014[_0x2c5376(0x205)],_0x947014[_0x2c5376(0x202)]));if(_0x3e5aaf['taskId']!==_0x28076c)throw CliErrors[_0x2c5376(0x1fe)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x28076c+_0x2c5376(0x208)+_0x3e5aaf[_0x2c5376(0x209)]+'.');const _0x41fa75=buildAsyncTaskStatusCommand(_0x3e5aaf['taskId'],_0x947014[_0x2c5376(0x205)]);return{'ok':!![],'message':asyncTaskMessage(_0x3e5aaf),'data':{'appCode':_0x947014[_0x2c5376(0x205)],..._0x3e5aaf,'query':_0x3e5aaf[_0x2c5376(0x1fc)]?null:{'command':_0x41fa75}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3072e5,_0x5f3158){const _0x37efc2=a260_0x30a3,_0x1161bc=_0x3072e5();while(!![]){try{const _0x57dd59=-parseInt(_0x37efc2(0x13f))/0x1*(-parseInt(_0x37efc2(0x145))/0x2)+-parseInt(_0x37efc2(0x144))/0x3+-parseInt(_0x37efc2(0x147))/0x4+-parseInt(_0x37efc2(0x149))/0x5*(-parseInt(_0x37efc2(0x148))/0x6)+parseInt(_0x37efc2(0x141))/0x7*(parseInt(_0x37efc2(0x140))/0x8)+parseInt(_0x37efc2(0x143))/0x9*(parseInt(_0x37efc2(0x142))/0xa)+-parseInt(_0x37efc2(0x146))/0xb;if(_0x57dd59===_0x5f3158)break;else _0x1161bc['push'](_0x1161bc['shift']());}catch(_0x2e226b){_0x1161bc['push'](_0x1161bc['shift']());}}}(a260_0x25ee,0x59692));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a260_0x30a3(_0x47a39f,_0x74aeab){_0x47a39f=_0x47a39f-0x13f;const _0x25ee5e=a260_0x25ee();let _0x30a3d9=_0x25ee5e[_0x47a39f];return _0x30a3d9;}function a260_0x25ee(){const _0x4cab12=['11086fiuEyj','4195552lpVsll','7PhwxGS','290kUWfqn','183213ojkHLJ','258732lgAjXO','54txzkcb','13518703wzcdYg','611612BHqbfC','6RtRVMM','2101135miWHWw'];a260_0x25ee=function(){return _0x4cab12;};return a260_0x25ee();}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a261_0x13d6(){const _0x17170d=['1256GYLrju','1238woDsGB','flagMissing','322mwNgFH','\x20tenant\x20member(s)','5822424eBIEXE','Found\x20','length','65853tqHyJT','1301434zEvSyM','members-list','tenant','string','310GrvyQH','105702UAQtIG','str','1892295VmrfxC','1833RiRIok','Pass\x20--tenant-code\x20<code>.','trim','tenant-code','1715021EaMZqz'];a261_0x13d6=function(){return _0x17170d;};return a261_0x13d6();}const a261_0x3b3287=a261_0x19ab;(function(_0xedf362,_0x128ade){const _0x15f20a=a261_0x19ab,_0x1119d2=_0xedf362();while(!![]){try{const _0x66aade=-parseInt(_0x15f20a(0x129))/0x1+-parseInt(_0x15f20a(0x121))/0x2*(-parseInt(_0x15f20a(0x11b))/0x3)+-parseInt(_0x15f20a(0x125))/0x4+parseInt(_0x15f20a(0x11a))/0x5+-parseInt(_0x15f20a(0x118))/0x6*(parseInt(_0x15f20a(0x123))/0x7)+parseInt(_0x15f20a(0x120))/0x8*(-parseInt(_0x15f20a(0x128))/0x9)+parseInt(_0x15f20a(0x117))/0xa*(parseInt(_0x15f20a(0x11f))/0xb);if(_0x66aade===_0x128ade)break;else _0x1119d2['push'](_0x1119d2['shift']());}catch(_0x46b2ca){_0x1119d2['push'](_0x1119d2['shift']());}}}(a261_0x13d6,0xd54f6));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a261_0x19ab(_0x38c71a,_0x4ee952){_0x38c71a=_0x38c71a-0x116;const _0x13d675=a261_0x13d6();let _0x19ab7b=_0x13d675[_0x38c71a];return _0x19ab7b;}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a261_0x3b3287(0x12b),'command':a261_0x3b3287(0x12a),'description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':'read','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a261_0x3b3287(0x11e),'type':a261_0x3b3287(0x116),'required':!![],'description':'Exact\x20tenant\x20code'}],async 'validate'(_0x5de3b0){const _0x17b599=a261_0x3b3287;if(!_0x5de3b0[_0x17b599(0x119)](_0x17b599(0x11e))[_0x17b599(0x11d)]())throw CliErrors[_0x17b599(0x122)]('tenant-code',_0x17b599(0x11c));},async 'execute'(_0x1f32a0){const _0xd0d484=a261_0x3b3287,_0x4e2edb=_0x1f32a0[_0xd0d484(0x119)]('tenant-code')[_0xd0d484(0x11d)](),_0x429e57=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x4e2edb,_0x429e57);const _0x16781d=projectTenantMembers(await listTenantDirectoryMembers(_0x4e2edb));return{'ok':!![],'data':{'tenantCode':_0x4e2edb,'items':_0x16781d,'totalCount':_0x16781d[_0xd0d484(0x127)]},'message':_0xd0d484(0x126)+_0x16781d[_0xd0d484(0x127)]+_0xd0d484(0x124)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x57edf7,_0x522441){const _0x45898d=a262_0x3cf8,_0x25b665=_0x57edf7();while(!![]){try{const _0x54f184=parseInt(_0x45898d(0x1a6))/0x1+-parseInt(_0x45898d(0x199))/0x2+parseInt(_0x45898d(0x19d))/0x3+parseInt(_0x45898d(0x18e))/0x4*(parseInt(_0x45898d(0x195))/0x5)+-parseInt(_0x45898d(0x19f))/0x6*(parseInt(_0x45898d(0x190))/0x7)+-parseInt(_0x45898d(0x1a3))/0x8+-parseInt(_0x45898d(0x19e))/0x9;if(_0x54f184===_0x522441)break;else _0x25b665['push'](_0x25b665['shift']());}catch(_0x4918b7){_0x25b665['push'](_0x25b665['shift']());}}}(a262_0x4b05,0x93557));import{CliErrors}from'../../errors.js';function textOrNull(_0x21c8f1){const _0x5967d7=a262_0x3cf8,_0x227749=_0x21c8f1?.[_0x5967d7(0x19b)]();return _0x227749?_0x227749:null;}export function projectTenantMembers(_0x3a322b){const _0x2f922e=a262_0x3cf8,_0x286d27=new Map();for(const _0x3faa31 of _0x3a322b){const _0x3479e1=Number(_0x3faa31['userId']);if(!Number[_0x2f922e(0x19c)](_0x3479e1)||_0x3479e1<=0x0)continue;const _0x153a43={'userId':_0x3479e1,'username':textOrNull(_0x3faa31[_0x2f922e(0x192)]),'displayName':textOrNull(_0x3faa31['nickname']),'role':_0x3faa31[_0x2f922e(0x19a)]===!![]?_0x2f922e(0x1a1):_0x2f922e(0x197),'status':textOrNull(_0x3faa31['status'])},_0x3dc46d=_0x286d27[_0x2f922e(0x1a4)](_0x3479e1);if(!_0x3dc46d){_0x286d27['set'](_0x3479e1,_0x153a43);continue;}_0x3dc46d[_0x2f922e(0x192)]??=_0x153a43[_0x2f922e(0x192)],_0x3dc46d[_0x2f922e(0x198)]??=_0x153a43[_0x2f922e(0x198)],_0x3dc46d[_0x2f922e(0x194)]??=_0x153a43[_0x2f922e(0x194)];if(_0x153a43[_0x2f922e(0x1a7)]===_0x2f922e(0x1a1))_0x3dc46d['role']=_0x2f922e(0x1a1);}return[..._0x286d27['values']()][_0x2f922e(0x193)]((_0x60b64d,_0x3e23d6)=>_0x60b64d[_0x2f922e(0x1a5)]-_0x3e23d6[_0x2f922e(0x1a5)]);}function a262_0x3cf8(_0x2c545f,_0x4e1ef2){_0x2c545f=_0x2c545f-0x18e;const _0x4b050c=a262_0x4b05();let _0x3cf8f5=_0x4b050c[_0x2c545f];return _0x3cf8f5;}export function assertTenantAccessible(_0x1d036b,_0x2aa328){const _0x4b77ac=a262_0x3cf8;if(_0x2aa328[_0x4b77ac(0x1a2)](_0x3e4557=>_0x3e4557[_0x4b77ac(0x196)]===_0x1d036b))return;throw CliErrors[_0x4b77ac(0x18f)](_0x4b77ac(0x1a0)+_0x1d036b+_0x4b77ac(0x191),'Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.');}function a262_0x4b05(){const _0x214080=['get','userId','1200126prPonu','role','31912SgdJsy','validation','14AOGerK','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','username','sort','status','745OdTqXz','tenantCode','MEMBER','displayName','423018HtLCqu','adminFlag','trim','isFinite','569112bVtjJS','3123675ZvTavt','2632236BRYYpZ','Tenant\x20\x22','ADMIN','some','4312616VcliSr'];a262_0x4b05=function(){return _0x214080;};return a262_0x4b05();}
|