@lovrabet/rabetbase-cli 2.5.6 → 2.5.7
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.d.ts +2 -0
- package/lib/commands/flow/page-list.js +1 -0
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.d.ts +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.d.ts +6 -2
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +26 -6
- 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.d.ts +12 -0
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +8 -4
- package/skills/rabetbase/guides/approval-flow-development-workflow.md +52 -13
- package/skills/rabetbase/guides/backend-function.md +26 -4
- package/skills/rabetbase/guides/bff-creation-workflow.md +9 -0
- package/skills/rabetbase/guides/cross-database-bff.md +1 -0
- package/skills/rabetbase/guides/custom-page-flow-sdk.md +2 -0
- package/skills/rabetbase/guides/data-api-guidelines.md +2 -0
- package/skills/rabetbase/guides/flow-config-examples.md +75 -0
- package/skills/rabetbase/guides/form-flow-start.md +61 -0
- package/skills/rabetbase/guides/typescript-sdk.md +1 -1
- package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +18 -4
- package/skills/rabetbase/references/rabetbase-codegen-sdk.md +5 -4
- package/skills/rabetbase/references/rabetbase-flow-commands.md +21 -2
- package/skills/rabetbase/references/rabetbase-flow-resources.md +21 -3
- package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +6 -2
- package/skills/rabetbase/references/rabetbase-kb.md +4 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +5 -3
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x29a797=a250_0x4194;(function(_0x4eb329,_0xda0068){const _0xdf439e=a250_0x4194,_0x38d8a6=_0x4eb329();while(!![]){try{const _0x39de50=parseInt(_0xdf439e(0x1c8))/0x1+parseInt(_0xdf439e(0x1ce))/0x2+-parseInt(_0xdf439e(0x1c2))/0x3+parseInt(_0xdf439e(0x1d0))/0x4*(parseInt(_0xdf439e(0x1c9))/0x5)+parseInt(_0xdf439e(0x1c5))/0x6*(-parseInt(_0xdf439e(0x1c4))/0x7)+-parseInt(_0xdf439e(0x1ca))/0x8*(-parseInt(_0xdf439e(0x1d1))/0x9)+-parseInt(_0xdf439e(0x1bd))/0xa;if(_0x39de50===_0xda0068)break;else _0x38d8a6['push'](_0x38d8a6['shift']());}catch(_0x11fa61){_0x38d8a6['push'](_0x38d8a6['shift']());}}}(a250_0x1f51,0x36a6f));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a250_0x4194(_0x43c8a,_0x427c61){_0x43c8a=_0x43c8a-0x1ba;const _0x1f51f5=a250_0x1f51();let _0x419447=_0x1f51f5[_0x43c8a];return _0x419447;}function a250_0x1f51(){const _0x1b0c8b=['2801620ZNDTIM','SQL\x20execution\x20failed','Returned\x20','sqlcode','isArray','998727AOeKKU','appCode','63EblUJq','54018YDiRUk','now','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','89140RfaCPC','59855Fbvmof','877792GFlkuH','read','length','\x20row(s)\x20in\x20','791744eOHvhq','str','108tOUgaG','9bvYQgA','params','execSuccess','exec'];a250_0x1f51=function(){return _0x1b0c8b;};return a250_0x1f51();}export const sqlExec={'service':'sql','command':a250_0x29a797(0x1bc),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a250_0x29a797(0x1cb),'flags':[SQLCODE_FLAG,{'name':a250_0x29a797(0x1ba),'type':'string','description':a250_0x29a797(0x1c7)}],async 'execute'(_0x3eeb7e){const _0x229ed0=a250_0x29a797,_0x38a1fc=parseJsonParams(_0x3eeb7e[_0x229ed0(0x1cf)](_0x229ed0(0x1ba))),_0x1ae0ed=Date[_0x229ed0(0x1c6)](),_0x502631=await executeSql(_0x3eeb7e[_0x229ed0(0x1c3)],_0x3eeb7e[_0x229ed0(0x1cf)](_0x229ed0(0x1c0)),_0x38a1fc),_0x5bca02=Date[_0x229ed0(0x1c6)]()-_0x1ae0ed,_0x426a17=_0x502631?.['execResult']??_0x502631,_0x10ff2c=_0x502631?.[_0x229ed0(0x1bb)]??!![];if(!_0x10ff2c)return{'ok':![],'data':{'error':_0x502631?.['execError']||_0x229ed0(0x1be),'elapsed':_0x5bca02},'message':_0x229ed0(0x1be)};const _0x45f57a=Array[_0x229ed0(0x1c1)](_0x426a17)?_0x426a17:[];return{'ok':!![],'data':{'rows':_0x45f57a,'rowCount':_0x45f57a['length'],'elapsed':_0x5bca02},'message':_0x229ed0(0x1bf)+_0x45f57a[_0x229ed0(0x1cc)]+_0x229ed0(0x1cd)+_0x5bca02+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x308c0e,_0x1fbfc9){const _0x19a851=a251_0x4dc5,_0x38c75e=_0x308c0e();while(!![]){try{const _0x2db681=parseInt(_0x19a851(0x99))/0x1+parseInt(_0x19a851(0x98))/0x2+parseInt(_0x19a851(0x96))/0x3*(parseInt(_0x19a851(0x9b))/0x4)+-parseInt(_0x19a851(0x9c))/0x5+-parseInt(_0x19a851(0x95))/0x6+-parseInt(_0x19a851(0x97))/0x7*(-parseInt(_0x19a851(0x9a))/0x8)+-parseInt(_0x19a851(0x9d))/0x9;if(_0x2db681===_0x1fbfc9)break;else _0x38c75e['push'](_0x38c75e['shift']());}catch(_0x58976){_0x38c75e['push'](_0x38c75e['shift']());}}}(a251_0x2401,0x8f4a4));function a251_0x2401(){const _0x48e307=['433906oqOUjN','801746EDeAUr','90056yXtMej','8pGZuDu','2024015AKFXlu','839889qEejYf','3311202WEGsyQ','420747TUYJuM','210yztIol'];a251_0x2401=function(){return _0x48e307;};return a251_0x2401();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a251_0x4dc5(_0x3e566e,_0x1b69d6){_0x3e566e=_0x3e566e-0x95;const _0x24019f=a251_0x2401();let _0x4dc5d5=_0x24019f[_0x3e566e];return _0x4dc5d5;}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';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
|
+
const a252_0x3d4597=a252_0x5354;function a252_0x3e8b(){const _0x4d2fd1=['sqlCode','Filter\x20by\x20SQL\x20name','appCode','length','sqlName','read','List\x20custom\x20SQL\x20queries','63430cZzkEb','848066DYMWzN','dbId','327950WtNOrl','string','all','str','7208pKGswK','516TKfioh','6BVZCip','number','bool','126079mRlwRm','verbose','list','Page\x20number','\x20SQL\x20queries\x20(total:\x20','map','1623704IFLRAG','Found\x20','description','totalCount','num','pagesize','Page\x20size','sql','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','1061770XlsNWt','9hLCvip','name','tableData'];a252_0x3e8b=function(){return _0x4d2fd1;};return a252_0x3e8b();}(function(_0x1fa2a7,_0x492bc2){const _0xdf5367=a252_0x5354,_0x2b5ab2=_0x1fa2a7();while(!![]){try{const _0x438fe7=-parseInt(_0xdf5367(0x13b))/0x1+parseInt(_0xdf5367(0x156))/0x2+parseInt(_0xdf5367(0x15d))/0x3*(parseInt(_0xdf5367(0x15c))/0x4)+parseInt(_0xdf5367(0x155))/0x5*(parseInt(_0xdf5367(0x138))/0x6)+-parseInt(_0xdf5367(0x158))/0x7+-parseInt(_0xdf5367(0x141))/0x8+parseInt(_0xdf5367(0x14b))/0x9*(-parseInt(_0xdf5367(0x14a))/0xa);if(_0x438fe7===_0x492bc2)break;else _0x2b5ab2['push'](_0x2b5ab2['shift']());}catch(_0x5566ea){_0x2b5ab2['push'](_0x2b5ab2['shift']());}}}(a252_0x3e8b,0x40992));import{listSqlQueries}from'../../core/api-client.js';function a252_0x5354(_0x3a75a4,_0x58e033){_0x3a75a4=_0x3a75a4-0x138;const _0x3e8b4a=a252_0x3e8b();let _0x5354d4=_0x3e8b4a[_0x3a75a4];return _0x5354d4;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x3d4597(0x148),'command':a252_0x3d4597(0x13d),'description':a252_0x3d4597(0x154),'risk':a252_0x3d4597(0x153),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x3d4597(0x14c),'type':a252_0x3d4597(0x159),'description':a252_0x3d4597(0x14f)},{'name':'page','type':a252_0x3d4597(0x139),'description':a252_0x3d4597(0x13e),'default':0x1},{'name':'pagesize','type':a252_0x3d4597(0x139),'description':a252_0x3d4597(0x147)},{'name':a252_0x3d4597(0x13c),'type':'boolean','description':a252_0x3d4597(0x149)}],async 'execute'(_0x232774){const _0x5bf692=a252_0x3d4597,_0x52df2e=await listSqlQueries(_0x232774[_0x5bf692(0x150)],{'sqlCode':_0x232774[_0x5bf692(0x15b)]('sqlcode')||undefined,'sqlName':_0x232774['str'](_0x5bf692(0x14c))||undefined,'currentPage':_0x232774[_0x5bf692(0x145)]('page'),'pageSize':_0x232774['num'](_0x5bf692(0x146),0x32)}),_0x1d5bb3=_0x232774[_0x5bf692(0x13a)](_0x5bf692(0x13c)),_0x5dc258=_0x52df2e[_0x5bf692(0x14d)]??[],_0x407246=_0x52df2e['paging']?.[_0x5bf692(0x144)]??_0x5dc258[_0x5bf692(0x151)];let _0x292df6;return _0x1d5bb3?_0x292df6=_0x5dc258:_0x292df6=await Promise[_0x5bf692(0x15a)](_0x5dc258[_0x5bf692(0x140)](async _0x1bade7=>{const _0x5ed799=_0x5bf692;let _0x5c0d56;try{_0x5c0d56=_0x1bade7[_0x5ed799(0x157)]?await getDbName(_0x232774[_0x5ed799(0x150)],_0x1bade7[_0x5ed799(0x157)]):undefined;}catch{}return{'sqlCode':_0x1bade7[_0x5ed799(0x14e)],'sqlName':_0x1bade7[_0x5ed799(0x152)],'description':_0x1bade7[_0x5ed799(0x143)]??'','db':_0x5c0d56?_0x5c0d56+'\x20('+_0x1bade7[_0x5ed799(0x157)]+')':_0x1bade7[_0x5ed799(0x157)]??''};})),{'ok':!![],'data':_0x292df6,'message':_0x5dc258[_0x5bf692(0x151)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x5bf692(0x142)+_0x5dc258['length']+_0x5bf692(0x13f)+_0x407246+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a252_0x1944a2=a252_0x3a92;(function(_0x33233e,_0x4780cc){const _0x2fab9d=a252_0x3a92,_0x3c1e44=_0x33233e();while(!![]){try{const _0x2f8843=-parseInt(_0x2fab9d(0x9e))/0x1*(-parseInt(_0x2fab9d(0x8a))/0x2)+parseInt(_0x2fab9d(0xd3))/0x3+parseInt(_0x2fab9d(0xc8))/0x4+-parseInt(_0x2fab9d(0x9d))/0x5*(parseInt(_0x2fab9d(0xb6))/0x6)+-parseInt(_0x2fab9d(0xc9))/0x7*(-parseInt(_0x2fab9d(0xa7))/0x8)+parseInt(_0x2fab9d(0xc3))/0x9*(-parseInt(_0x2fab9d(0xb0))/0xa)+-parseInt(_0x2fab9d(0x95))/0xb;if(_0x2f8843===_0x4780cc)break;else _0x3c1e44['push'](_0x3c1e44['shift']());}catch(_0x301a79){_0x3c1e44['push'](_0x3c1e44['shift']());}}}(a252_0x3f32,0x95e7d));import{readFile,rm,writeFile}from'node:fs/promises';function a252_0x3a92(_0x297d20,_0x18ff78){_0x297d20=_0x297d20-0x85;const _0x3f3292=a252_0x3f32();let _0x3a92f5=_0x3f3292[_0x297d20];return _0x3a92f5;}import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a252_0x3f32(){const _0x223184=['some','hash','paging','5620386ceuBYJ','utf8','equivalent','sqls','push','all','Would\x20pull\x20','No\x20remote\x20SQL\x20queries\x20matched.','map','sqlRoot','replace','join','read','684873dIcIRJ','boolean','totalCount','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','lockFilePath','4305188qaVAoL','10059iBlvQW','Force\x20overwrite\x20local\x20unsynced\x20changes','conflict','sqlcode','endsWith','dbId','sqlRootDir','lastSync','nonInteractive','length','1245270lNbjaw','Force\x20pull\x20cancelled.','test','.xml','filter','mybatisXml','filePath','sqlCode','3918KVrcQJ','Pull\x20complete:\x20','toLowerCase','skipped','name','description','str','\x20failed','sqlContent','split','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','11724262zTKGVo','POST','force','sql','isCanonical','find','local\x20differs\x20from\x20remote','content','5AxZSRr','545TWVTqO','apps','toISOString','string','catch','mode','appCode','\x20SQL\x20file(s)\x20into\x20','path','744xvMXaN','message','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','pull','\x20written,\x20','\x20skipped,\x20','unchanged','sqlName','trim','10gOSARz','file','cancelled'];a252_0x3f32=function(){return _0x223184;};return a252_0x3f32();}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(_0x345afd,_0x5a5726){const _0x5333a4=a252_0x3a92,_0x2f411d=[];let _0x5f2868=0x1;while(!![]){const _0x16a27d=await listSqlQueries(_0x345afd,{'currentPage':_0x5f2868,'pageSize':PAGE_SIZE,'sqlCode':_0x5a5726['sqlCode'],'sqlName':_0x5a5726['sqlName']}),_0x15397c=_0x16a27d['tableData']??[];_0x2f411d[_0x5333a4(0xba)](..._0x15397c);if(_0x15397c['length']===0x0)break;const _0x2051f4=_0x16a27d[_0x5333a4(0xb5)]?.[_0x5333a4(0xc5)];if(_0x2051f4!=null?_0x2f411d['length']>=_0x2051f4:_0x15397c[_0x5333a4(0xd2)]<PAGE_SIZE)break;_0x5f2868++;}return _0x2f411d;}async function ensureSqlContent(_0x14ac42){const _0x1a2d44=a252_0x3a92;if(_0x14ac42[_0x1a2d44(0x92)]!=null&&String(_0x14ac42[_0x1a2d44(0x92)])[_0x1a2d44(0xd2)]>0x0)return _0x14ac42;return getSqlQueryDetail(_0x14ac42['sqlCode']);}export const sqlPull={'service':a252_0x1944a2(0x98),'command':a252_0x1944a2(0xaa),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a252_0x1944a2(0xc2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x1944a2(0x8e),'type':a252_0x1944a2(0xa1),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a252_0x1944a2(0x97),'type':a252_0x1944a2(0xc4),'description':a252_0x1944a2(0xca)}],async 'dryRun'(_0x22687f){const _0x40e3d1=a252_0x1944a2,_0x2e6b49=loadSqlProjectConfig(_0x22687f['appCode']),_0x402661=await readSqlLockFile(_0x2e6b49[_0x40e3d1(0xc7)]),{appLock:_0x74ec35}=ensureSqlLockScope(_0x402661??createEmptySqlLock(),_0x2e6b49[_0x40e3d1(0xa4)],_0x2e6b49[_0x40e3d1(0xbf)],_0x40e3d1(0xaa)),_0x4f8795=await fetchAllSqlQueries(_0x22687f[_0x40e3d1(0xa4)],{'sqlCode':_0x22687f['str'](_0x40e3d1(0xcc))||undefined,'sqlName':_0x22687f[_0x40e3d1(0x90)](_0x40e3d1(0x8e))||undefined}),_0x526396=[];for(const _0x493f9f of _0x4f8795){const _0x4254a3=await ensureSqlContent(_0x493f9f),_0x198b7f=ensureRemoteSqlContent(_0x4254a3),_0x405d56=detectSqlMode(_0x198b7f),_0x2deaf3=_0x4254a3[_0x40e3d1(0xce)]?await getDbName(_0x22687f[_0x40e3d1(0xa4)],Number(_0x4254a3[_0x40e3d1(0xce)]))[_0x40e3d1(0xa2)](()=>undefined):undefined,_0x1a4baf=buildLocalSqlFileContent({'sqlCode':_0x4254a3[_0x40e3d1(0x89)],'sqlName':_0x4254a3['sqlName'],'dbId':_0x4254a3[_0x40e3d1(0xce)]},_0x198b7f,{'dbName':_0x2deaf3,'mode':_0x405d56,'syncedAt':new Date()[_0x40e3d1(0xa0)](),'description':_0x4254a3[_0x40e3d1(0x8f)]}),_0x5d8284=buildSqlLockEntry(_0x4254a3,_0x198b7f,'',{'dbName':_0x2deaf3}),_0x306c49=resolveLocalSqlFilePath(_0x2e6b49,_0x4254a3['sqlCode'],_0x5d8284);let _0x4dbb75='would_pull',_0x230d42;const _0x3df5fe=await findExistingSqlFiles(_0x2e6b49,_0x306c49,_0x405d56,_0x74ec35[_0x40e3d1(0xb9)][_0x4254a3[_0x40e3d1(0x89)]]);if(_0x3df5fe[_0x40e3d1(0xd2)]>0x0){const _0x28073c=await compareExistingSqlFiles(_0x3df5fe,_0x1a4baf,_0x405d56);if(_0x28073c[_0x40e3d1(0xb3)](({equivalent:_0x5afa77})=>!_0x5afa77))_0x4dbb75=_0x40e3d1(0xcb),_0x230d42=_0x40e3d1(0x94);else _0x28073c[_0x40e3d1(0xd2)]===0x1&&_0x28073c[0x0]?.[_0x40e3d1(0xb1)][_0x40e3d1(0x99)]&&(_0x4dbb75=_0x40e3d1(0x8d),_0x230d42='unchanged');}_0x526396['push']({'sqlCode':_0x4254a3['sqlCode'],'sqlName':_0x4254a3['sqlName'],'filePath':_0x306c49,'status':_0x4dbb75,'reason':_0x230d42});}return{'method':_0x40e3d1(0x96),'url':_0x40e3d1(0xc6),'body':{'appCode':_0x22687f[_0x40e3d1(0xa4)],'sqlCode':_0x22687f[_0x40e3d1(0x90)](_0x40e3d1(0xcc))||null,'sqlName':_0x22687f['str'](_0x40e3d1(0x8e))||null,'files':_0x526396},'description':_0x40e3d1(0xbc)+_0x526396['length']+_0x40e3d1(0xa5)+_0x2e6b49['sqlRootDir']};},async 'execute'(_0x129f06){const _0x534670=a252_0x1944a2,_0x46d59d=loadSqlProjectConfig(_0x129f06[_0x534670(0xa4)]),_0x1fd151=await readSqlLockFile(_0x46d59d[_0x534670(0xc7)]),{lockData:_0x5d4852,appLock:_0x1e3d6f}=ensureSqlLockScope(_0x1fd151??createEmptySqlLock(),_0x46d59d['appCode'],_0x46d59d[_0x534670(0xbf)],_0x534670(0xaa)),_0x4d30cc=_0x129f06['bool'](_0x534670(0x97)),_0x4a9aee=await fetchAllSqlQueries(_0x129f06[_0x534670(0xa4)],{'sqlCode':_0x129f06[_0x534670(0x90)](_0x534670(0xcc))||undefined,'sqlName':_0x129f06[_0x534670(0x90)](_0x534670(0x8e))||undefined});if(_0x4a9aee['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x534670(0xbd)};const _0x3d8dbd=[],_0x1ac7e8=[];for(const _0x355cec of _0x4a9aee){try{_0x3d8dbd[_0x534670(0xba)](await ensureSqlContent(_0x355cec));}catch(_0x159576){_0x1ac7e8[_0x534670(0xba)]({'sqlCode':_0x355cec[_0x534670(0x89)],'error':_0x159576 instanceof Error?_0x159576[_0x534670(0xa8)]:String(_0x159576)});}}if(_0x4d30cc&&!_0x129f06[_0x534670(0xd1)]){let _0x40e53b=![];for(const _0x38cc3b of _0x3d8dbd){const _0x49524a=detectSqlMode(ensureRemoteSqlContent(_0x38cc3b)),_0x299316=_0x38cc3b[_0x534670(0xce)]?await getDbName(_0x129f06[_0x534670(0xa4)],Number(_0x38cc3b[_0x534670(0xce)]))['catch'](()=>undefined):undefined,_0xe959c2=buildLocalSqlFileContent({'sqlCode':_0x38cc3b['sqlCode'],'sqlName':_0x38cc3b[_0x534670(0xae)],'dbId':_0x38cc3b[_0x534670(0xce)]},ensureRemoteSqlContent(_0x38cc3b),{'dbName':_0x299316,'mode':_0x49524a,'syncedAt':new Date()[_0x534670(0xa0)](),'description':_0x38cc3b[_0x534670(0x8f)]}),_0xe4c862=resolveLocalSqlFilePath(_0x46d59d,_0x38cc3b[_0x534670(0x89)],buildSqlLockEntry(_0x38cc3b,ensureRemoteSqlContent(_0x38cc3b),'',{'dbName':_0x299316})),_0x2af0a4=await findExistingSqlFiles(_0x46d59d,_0xe4c862,_0x49524a,_0x1e3d6f[_0x534670(0xb9)][_0x38cc3b[_0x534670(0x89)]]),_0x3077fc=await compareExistingSqlFiles(_0x2af0a4,_0xe959c2,_0x49524a);if(_0x3077fc[_0x534670(0xb3)](({equivalent:_0x530509})=>!_0x530509)){_0x40e53b=!![];break;}}if(_0x40e53b){const _0x5df7b2=await confirmForceOverwrite(_0x534670(0xa9));if(!_0x5df7b2)throw CliErrors[_0x534670(0xb2)](_0x534670(0xd4));}}const _0x3cbd5f=cloneSqlLockData(_0x5d4852),_0x4fdaf6=_0x3cbd5f[_0x534670(0x9f)][_0x46d59d[_0x534670(0xa4)]],_0xce79f6=[],_0x268323=[];for(const _0x5c2bc9 of _0x3d8dbd){const _0x45022a=_0x4fdaf6[_0x534670(0xb9)][_0x5c2bc9['sqlCode']],_0x59701e=ensureRemoteSqlContent(_0x5c2bc9),_0x5090cb=detectSqlMode(_0x59701e),_0x539bf4=_0x5c2bc9['dbId']?await getDbName(_0x129f06[_0x534670(0xa4)],Number(_0x5c2bc9['dbId']))[_0x534670(0xa2)](()=>undefined):undefined,_0x20c649=buildLocalSqlFileContent({'sqlCode':_0x5c2bc9['sqlCode'],'sqlName':_0x5c2bc9[_0x534670(0xae)],'dbId':_0x5c2bc9['dbId']},_0x59701e,{'dbName':_0x539bf4,'mode':_0x5090cb,'syncedAt':new Date()[_0x534670(0xa0)](),'description':_0x5c2bc9[_0x534670(0x8f)]}),_0x5f28be=buildSqlLockEntry(_0x5c2bc9,_0x59701e,computeSqlContentHash(_0x20c649),{'dbName':_0x539bf4}),_0x2e6c21=_0x5f28be[_0x534670(0xa6)],_0x810e70=join(_0x46d59d[_0x534670(0xcf)],_0x2e6c21);try{const _0x391571=await findExistingSqlFiles(_0x46d59d,_0x810e70,_0x5090cb,_0x45022a),_0x82c0a7=await compareExistingSqlFiles(_0x391571,_0x20c649,_0x5090cb);if(!_0x4d30cc&&_0x82c0a7[_0x534670(0xb3)](({equivalent:_0x58b2c6})=>!_0x58b2c6)){_0x268323[_0x534670(0xba)]({'sqlCode':_0x5c2bc9[_0x534670(0x89)],'reason':_0x534670(0x9b)});continue;}const _0x3b5d9e=_0x82c0a7[_0x534670(0x9a)](({file:_0x196510})=>_0x196510[_0x534670(0x99)]),_0x36b0c2=_0x82c0a7[_0x534670(0x9a)](({file:_0x50712f})=>!_0x50712f[_0x534670(0x99)]);if(_0x3b5d9e?.[_0x534670(0xb8)]&&!_0x36b0c2){_0x268323[_0x534670(0xba)]({'sqlCode':_0x5c2bc9[_0x534670(0x89)],'reason':_0x534670(0xad)}),_0x4fdaf6['sqls'][_0x5c2bc9[_0x534670(0x89)]]={..._0x5f28be,'hash':computeSqlContentHash(_0x3b5d9e[_0x534670(0x9c)]),'path':_0x2e6c21};continue;}!_0x3b5d9e?.[_0x534670(0xb8)]&&(await ensureParentDirectory(_0x810e70),await writeFile(_0x810e70,_0x20c649,_0x534670(0xb7))),_0x36b0c2&&await rm(_0x36b0c2[_0x534670(0xb1)][_0x534670(0x88)],{'force':!![]}),_0x4fdaf6[_0x534670(0xb9)][_0x5c2bc9[_0x534670(0x89)]]={..._0x5f28be,'hash':_0x3b5d9e?.[_0x534670(0xb8)]?computeSqlContentHash(_0x3b5d9e[_0x534670(0x9c)]):_0x5f28be[_0x534670(0xb4)],'path':_0x2e6c21},_0xce79f6['push']({'sqlCode':_0x5c2bc9['sqlCode'],'filePath':_0x810e70});}catch(_0x173af4){_0x1ac7e8[_0x534670(0xba)]({'sqlCode':_0x5c2bc9['sqlCode'],'error':_0x173af4 instanceof Error?_0x173af4['message']:String(_0x173af4)});}}return _0x4fdaf6[_0x534670(0xd0)]=new Date()[_0x534670(0xa0)](),await writeSqlLockFile(_0x46d59d[_0x534670(0xc7)],_0x3cbd5f),{'ok':_0x1ac7e8['length']===0x0,'data':{'pulled':_0xce79f6,'skipped':_0x268323,'failed':_0x1ac7e8},'message':_0x534670(0x8b)+_0xce79f6[_0x534670(0xd2)]+_0x534670(0xab)+_0x268323[_0x534670(0xd2)]+_0x534670(0xac)+_0x1ac7e8[_0x534670(0xd2)]+_0x534670(0x91)};}};function isEquivalentPulledSqlFile(_0x55d5d2,_0x4d85b8,_0x54beaa,_0x210797){if(_0x54beaa!==_0x210797)return normalizePulledSqlBody(_0x55d5d2,_0x54beaa)===normalizePulledSqlBody(_0x4d85b8,_0x210797);return normalizePullComparableContent(_0x55d5d2,_0x54beaa)===normalizePullComparableContent(_0x4d85b8,_0x210797);}async function findExistingSqlFiles(_0x1813ce,_0x1ab1f0,_0x339679,_0x575342){const _0xde1075=a252_0x1944a2,_0x3c9fcf=[];await fileExists(_0x1ab1f0)&&_0x3c9fcf[_0xde1075(0xba)]({'filePath':_0x1ab1f0,'mode':_0x339679,'isCanonical':!![]});if(!_0x575342?.['path'])return _0x3c9fcf;const _0xb30c44=join(_0x1813ce[_0xde1075(0xcf)],_0x575342[_0xde1075(0xa6)]);if(_0xb30c44===_0x1ab1f0)return _0x3c9fcf;return await fileExists(_0xb30c44)&&_0x3c9fcf[_0xde1075(0xba)]({'filePath':_0xb30c44,'mode':_0x575342[_0xde1075(0xa3)]??modeFromFilePath(_0xb30c44),'isCanonical':![]}),_0x3c9fcf;}async function compareExistingSqlFiles(_0x566896,_0x4906d4,_0xbfa21e){const _0x4387cc=a252_0x1944a2;return Promise[_0x4387cc(0xbb)](_0x566896[_0x4387cc(0xbe)](async _0x379edf=>{const _0x29f3c0=_0x4387cc,_0x4ede70=await readFile(_0x379edf[_0x29f3c0(0x88)],'utf8');return{'file':_0x379edf,'content':_0x4ede70,'equivalent':isEquivalentPulledSqlFile(_0x4ede70,_0x4906d4,_0x379edf[_0x29f3c0(0xa3)],_0xbfa21e)};}));}function modeFromFilePath(_0xc2ba62){const _0x2f2fc5=a252_0x1944a2;return _0xc2ba62[_0x2f2fc5(0x8c)]()[_0x2f2fc5(0xcd)](_0x2f2fc5(0x85))?_0x2f2fc5(0x87):_0x2f2fc5(0x98);}function normalizePulledSqlBody(_0x121fd9,_0x49f5eb){const _0x4efb72=a252_0x1944a2;return stripLocalSqlMetadata(_0x121fd9,_0x49f5eb)['replace'](/\r\n/g,'\x0a')[_0x4efb72(0xaf)]();}function normalizePullComparableContent(_0x548b19,_0x39cb3a){const _0x7f7b12=a252_0x1944a2,_0x50f089=_0x548b19[_0x7f7b12(0xc0)](/\r\n/g,'\x0a')[_0x7f7b12(0x93)]('\x0a'),_0x806455=_0x50f089[_0x7f7b12(0x86)](_0xe2b7cf=>!isSyncedAtMetadataLine(_0xe2b7cf,_0x39cb3a));return _0x806455[_0x7f7b12(0xc1)]('\x0a');}function isSyncedAtMetadataLine(_0x104d68,_0x17644e){const _0x4facbf=a252_0x1944a2;if(_0x17644e===_0x4facbf(0x87))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4facbf(0xd5)](_0x104d68);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4facbf(0xd5)](_0x104d68);}
|
|
1
|
+
const a253_0x45e837=a253_0x4729;(function(_0x2251ca,_0x5a2176){const _0x72d556=a253_0x4729,_0x1bbb30=_0x2251ca();while(!![]){try{const _0x38bb27=-parseInt(_0x72d556(0x205))/0x1*(parseInt(_0x72d556(0x1e3))/0x2)+parseInt(_0x72d556(0x1e9))/0x3+parseInt(_0x72d556(0x1d9))/0x4*(-parseInt(_0x72d556(0x1fe))/0x5)+parseInt(_0x72d556(0x1fb))/0x6*(-parseInt(_0x72d556(0x1c2))/0x7)+parseInt(_0x72d556(0x1d6))/0x8+-parseInt(_0x72d556(0x1c3))/0x9*(parseInt(_0x72d556(0x1c7))/0xa)+parseInt(_0x72d556(0x1f2))/0xb;if(_0x38bb27===_0x5a2176)break;else _0x1bbb30['push'](_0x1bbb30['shift']());}catch(_0x5d9f74){_0x1bbb30['push'](_0x1bbb30['shift']());}}}(a253_0xd133,0xc7e68));function a253_0xd133(){const _0x5e6d45=['387FUDXEi','Force\x20overwrite\x20local\x20unsynced\x20changes','filter','map','357950goFFbg','paging','Filter\x20by\x20SQL\x20display\x20name','split','No\x20remote\x20SQL\x20queries\x20matched.','toISOString','utf8','sqlRoot','some','\x20SQL\x20file(s)\x20into\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','filePath','conflict','skipped','Pull\x20complete:\x20','12557640bsVggT','all','sqlCode','12nFzrwk','equivalent','pull','Would\x20pull\x20','sql','would_pull','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqls','sqlcode','tableData','1578lxDqfF','push','test','catch','description','\x20skipped,\x20','2736924hplCAR','replace','str','sqlName','\x20failed','nonInteractive','.xml','totalCount','sqlRootDir','7951174zOqjff','find','file','path','length','boolean','sqlContent','mode','mybatisXml','135060DnWlGO','message','force','132095svaYMs','\x20written,\x20','unchanged','isCanonical','string','POST','lockFilePath','117rCCNFl','dbId','hash','content','appCode','cancelled','join','read','name','210iORJJZ'];a253_0xd133=function(){return _0x5e6d45;};return a253_0xd133();}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_0x4729(_0x266638,_0x1159be){_0x266638=_0x266638-0x1bc;const _0xd13358=a253_0xd133();let _0x4729a5=_0xd13358[_0x266638];return _0x4729a5;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x442961,_0x1731cb){const _0x5c59a8=a253_0x4729,_0x271dae=[];let _0x50d2ce=0x1;while(!![]){const _0x382ce3=await listSqlQueries(_0x442961,{'currentPage':_0x50d2ce,'pageSize':PAGE_SIZE,'sqlCode':_0x1731cb['sqlCode'],'sqlName':_0x1731cb[_0x5c59a8(0x1ec)]}),_0x39c32e=_0x382ce3[_0x5c59a8(0x1e2)]??[];_0x271dae[_0x5c59a8(0x1e4)](..._0x39c32e);if(_0x39c32e['length']===0x0)break;const _0xd0274d=_0x382ce3[_0x5c59a8(0x1c8)]?.[_0x5c59a8(0x1f0)];if(_0xd0274d!=null?_0x271dae[_0x5c59a8(0x1f6)]>=_0xd0274d:_0x39c32e[_0x5c59a8(0x1f6)]<PAGE_SIZE)break;_0x50d2ce++;}return _0x271dae;}async function ensureSqlContent(_0x3fd441){const _0x896c2a=a253_0x4729;if(_0x3fd441[_0x896c2a(0x1f8)]!=null&&String(_0x3fd441['sqlContent'])[_0x896c2a(0x1f6)]>0x0)return _0x3fd441;return getSqlQueryDetail(_0x3fd441[_0x896c2a(0x1d8)]);}export const sqlPull={'service':'sql','command':a253_0x45e837(0x1db),'description':a253_0x45e837(0x1df),'risk':a253_0x45e837(0x1c0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x45e837(0x1c1),'type':a253_0x45e837(0x202),'description':a253_0x45e837(0x1c9)},{'name':a253_0x45e837(0x1fd),'type':a253_0x45e837(0x1f7),'description':a253_0x45e837(0x1c4)}],async 'dryRun'(_0x16a970){const _0x439c2b=a253_0x45e837,_0x4b4ab3=loadSqlProjectConfig(_0x16a970['appCode']),_0x39347f=await readSqlLockFile(_0x4b4ab3['lockFilePath']),{appLock:_0x22828d}=ensureSqlLockScope(_0x39347f??createEmptySqlLock(),_0x4b4ab3[_0x439c2b(0x1bd)],_0x4b4ab3[_0x439c2b(0x1ce)],_0x439c2b(0x1db)),_0x448ce6=await fetchAllSqlQueries(_0x16a970[_0x439c2b(0x1bd)],{'sqlCode':_0x16a970[_0x439c2b(0x1eb)](_0x439c2b(0x1e1))||undefined,'sqlName':_0x16a970['str'](_0x439c2b(0x1c1))||undefined}),_0xb39782=[];for(const _0x41526b of _0x448ce6){const _0x470a44=await ensureSqlContent(_0x41526b),_0x55f11a=ensureRemoteSqlContent(_0x470a44),_0x39634c=detectSqlMode(_0x55f11a),_0x5472a0=_0x470a44[_0x439c2b(0x206)]?await getDbName(_0x16a970['appCode'],Number(_0x470a44[_0x439c2b(0x206)]))[_0x439c2b(0x1e6)](()=>undefined):undefined,_0x52931e=buildLocalSqlFileContent({'sqlCode':_0x470a44[_0x439c2b(0x1d8)],'sqlName':_0x470a44[_0x439c2b(0x1ec)],'dbId':_0x470a44['dbId']},_0x55f11a,{'dbName':_0x5472a0,'mode':_0x39634c,'syncedAt':new Date()['toISOString'](),'description':_0x470a44['description']}),_0x14e16c=buildSqlLockEntry(_0x470a44,_0x55f11a,'',{'dbName':_0x5472a0}),_0x1f3ecb=resolveLocalSqlFilePath(_0x4b4ab3,_0x470a44[_0x439c2b(0x1d8)],_0x14e16c);let _0x35fbe8=_0x439c2b(0x1de),_0x5bcb86;const _0x12db4c=await findExistingSqlFiles(_0x4b4ab3,_0x1f3ecb,_0x39634c,_0x22828d['sqls'][_0x470a44[_0x439c2b(0x1d8)]]);if(_0x12db4c[_0x439c2b(0x1f6)]>0x0){const _0x4e1eb1=await compareExistingSqlFiles(_0x12db4c,_0x52931e,_0x39634c);if(_0x4e1eb1[_0x439c2b(0x1cf)](({equivalent:_0x5b54d5})=>!_0x5b54d5))_0x35fbe8=_0x439c2b(0x1d3),_0x5bcb86='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x4e1eb1[_0x439c2b(0x1f6)]===0x1&&_0x4e1eb1[0x0]?.[_0x439c2b(0x1f4)][_0x439c2b(0x201)]&&(_0x35fbe8=_0x439c2b(0x1d4),_0x5bcb86=_0x439c2b(0x200));}_0xb39782[_0x439c2b(0x1e4)]({'sqlCode':_0x470a44[_0x439c2b(0x1d8)],'sqlName':_0x470a44['sqlName'],'filePath':_0x1f3ecb,'status':_0x35fbe8,'reason':_0x5bcb86});}return{'method':_0x439c2b(0x203),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x16a970[_0x439c2b(0x1bd)],'sqlCode':_0x16a970['str'](_0x439c2b(0x1e1))||null,'sqlName':_0x16a970[_0x439c2b(0x1eb)](_0x439c2b(0x1c1))||null,'files':_0xb39782},'description':_0x439c2b(0x1dc)+_0xb39782[_0x439c2b(0x1f6)]+_0x439c2b(0x1d0)+_0x4b4ab3[_0x439c2b(0x1f1)]};},async 'execute'(_0x401e46){const _0x31a170=a253_0x45e837,_0x49c765=loadSqlProjectConfig(_0x401e46[_0x31a170(0x1bd)]),_0x54e331=await readSqlLockFile(_0x49c765[_0x31a170(0x204)]),{lockData:_0x848df,appLock:_0x27c70c}=ensureSqlLockScope(_0x54e331??createEmptySqlLock(),_0x49c765['appCode'],_0x49c765['sqlRoot'],_0x31a170(0x1db)),_0x2b1c22=_0x401e46['bool']('force'),_0xfb8191=await fetchAllSqlQueries(_0x401e46[_0x31a170(0x1bd)],{'sqlCode':_0x401e46['str'](_0x31a170(0x1e1))||undefined,'sqlName':_0x401e46[_0x31a170(0x1eb)]('name')||undefined});if(_0xfb8191[_0x31a170(0x1f6)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x31a170(0x1cb)};const _0x2ba31e=[],_0x4d3fff=[];for(const _0x5a4196 of _0xfb8191){try{_0x2ba31e[_0x31a170(0x1e4)](await ensureSqlContent(_0x5a4196));}catch(_0x20f1b8){_0x4d3fff['push']({'sqlCode':_0x5a4196['sqlCode'],'error':_0x20f1b8 instanceof Error?_0x20f1b8['message']:String(_0x20f1b8)});}}if(_0x2b1c22&&!_0x401e46[_0x31a170(0x1ee)]){let _0x508699=![];for(const _0x146ae9 of _0x2ba31e){const _0x1ded8c=detectSqlMode(ensureRemoteSqlContent(_0x146ae9)),_0x3d149e=_0x146ae9['dbId']?await getDbName(_0x401e46[_0x31a170(0x1bd)],Number(_0x146ae9[_0x31a170(0x206)]))[_0x31a170(0x1e6)](()=>undefined):undefined,_0x30e73d=buildLocalSqlFileContent({'sqlCode':_0x146ae9[_0x31a170(0x1d8)],'sqlName':_0x146ae9['sqlName'],'dbId':_0x146ae9['dbId']},ensureRemoteSqlContent(_0x146ae9),{'dbName':_0x3d149e,'mode':_0x1ded8c,'syncedAt':new Date()[_0x31a170(0x1cc)](),'description':_0x146ae9[_0x31a170(0x1e7)]}),_0x4c2702=resolveLocalSqlFilePath(_0x49c765,_0x146ae9[_0x31a170(0x1d8)],buildSqlLockEntry(_0x146ae9,ensureRemoteSqlContent(_0x146ae9),'',{'dbName':_0x3d149e})),_0x589fe9=await findExistingSqlFiles(_0x49c765,_0x4c2702,_0x1ded8c,_0x27c70c[_0x31a170(0x1e0)][_0x146ae9[_0x31a170(0x1d8)]]),_0x40517e=await compareExistingSqlFiles(_0x589fe9,_0x30e73d,_0x1ded8c);if(_0x40517e['some'](({equivalent:_0xe2769b})=>!_0xe2769b)){_0x508699=!![];break;}}if(_0x508699){const _0xaa7732=await confirmForceOverwrite(_0x31a170(0x1d1));if(!_0xaa7732)throw CliErrors[_0x31a170(0x1be)]('Force\x20pull\x20cancelled.');}}const _0x4313dd=cloneSqlLockData(_0x848df),_0x3f445e=_0x4313dd['apps'][_0x49c765['appCode']],_0x593e16=[],_0x221499=[];for(const _0x1471f4 of _0x2ba31e){const _0x39fd49=_0x3f445e[_0x31a170(0x1e0)][_0x1471f4[_0x31a170(0x1d8)]],_0x52b7bd=ensureRemoteSqlContent(_0x1471f4),_0x5ce21f=detectSqlMode(_0x52b7bd),_0x24a34d=_0x1471f4[_0x31a170(0x206)]?await getDbName(_0x401e46[_0x31a170(0x1bd)],Number(_0x1471f4[_0x31a170(0x206)]))[_0x31a170(0x1e6)](()=>undefined):undefined,_0x383412=buildLocalSqlFileContent({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'sqlName':_0x1471f4[_0x31a170(0x1ec)],'dbId':_0x1471f4['dbId']},_0x52b7bd,{'dbName':_0x24a34d,'mode':_0x5ce21f,'syncedAt':new Date()[_0x31a170(0x1cc)](),'description':_0x1471f4[_0x31a170(0x1e7)]}),_0x49cdb1=buildSqlLockEntry(_0x1471f4,_0x52b7bd,computeSqlContentHash(_0x383412),{'dbName':_0x24a34d}),_0x375e19=_0x49cdb1[_0x31a170(0x1f5)],_0x2302ce=join(_0x49c765[_0x31a170(0x1f1)],_0x375e19);try{const _0x5037b3=await findExistingSqlFiles(_0x49c765,_0x2302ce,_0x5ce21f,_0x39fd49),_0xc065a9=await compareExistingSqlFiles(_0x5037b3,_0x383412,_0x5ce21f);if(!_0x2b1c22&&_0xc065a9['some'](({equivalent:_0x50bba7})=>!_0x50bba7)){_0x221499[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x5d0a38=_0xc065a9[_0x31a170(0x1f3)](({file:_0xf784a6})=>_0xf784a6['isCanonical']),_0x596852=_0xc065a9[_0x31a170(0x1f3)](({file:_0x1185bd})=>!_0x1185bd['isCanonical']);if(_0x5d0a38?.[_0x31a170(0x1da)]&&!_0x596852){_0x221499[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'reason':_0x31a170(0x200)}),_0x3f445e[_0x31a170(0x1e0)][_0x1471f4[_0x31a170(0x1d8)]]={..._0x49cdb1,'hash':computeSqlContentHash(_0x5d0a38[_0x31a170(0x1bc)]),'path':_0x375e19};continue;}!_0x5d0a38?.['equivalent']&&(await ensureParentDirectory(_0x2302ce),await writeFile(_0x2302ce,_0x383412,_0x31a170(0x1cd))),_0x596852&&await rm(_0x596852[_0x31a170(0x1f4)]['filePath'],{'force':!![]}),_0x3f445e[_0x31a170(0x1e0)][_0x1471f4['sqlCode']]={..._0x49cdb1,'hash':_0x5d0a38?.[_0x31a170(0x1da)]?computeSqlContentHash(_0x5d0a38[_0x31a170(0x1bc)]):_0x49cdb1[_0x31a170(0x207)],'path':_0x375e19},_0x593e16[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'filePath':_0x2302ce});}catch(_0x289a6d){_0x4d3fff[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'error':_0x289a6d instanceof Error?_0x289a6d[_0x31a170(0x1fc)]:String(_0x289a6d)});}}return _0x3f445e['lastSync']=new Date()[_0x31a170(0x1cc)](),await writeSqlLockFile(_0x49c765[_0x31a170(0x204)],_0x4313dd),{'ok':_0x4d3fff[_0x31a170(0x1f6)]===0x0,'data':{'pulled':_0x593e16,'skipped':_0x221499,'failed':_0x4d3fff},'message':_0x31a170(0x1d5)+_0x593e16[_0x31a170(0x1f6)]+_0x31a170(0x1ff)+_0x221499[_0x31a170(0x1f6)]+_0x31a170(0x1e8)+_0x4d3fff[_0x31a170(0x1f6)]+_0x31a170(0x1ed)};}};function isEquivalentPulledSqlFile(_0xffc9f4,_0x3b36e8,_0x133f38,_0x34392b){if(_0x133f38!==_0x34392b)return normalizePulledSqlBody(_0xffc9f4,_0x133f38)===normalizePulledSqlBody(_0x3b36e8,_0x34392b);return normalizePullComparableContent(_0xffc9f4,_0x133f38)===normalizePullComparableContent(_0x3b36e8,_0x34392b);}async function findExistingSqlFiles(_0x5b5da0,_0x40a1d9,_0x2eb291,_0x464531){const _0x16a416=a253_0x45e837,_0x3e201c=[];await fileExists(_0x40a1d9)&&_0x3e201c[_0x16a416(0x1e4)]({'filePath':_0x40a1d9,'mode':_0x2eb291,'isCanonical':!![]});if(!_0x464531?.[_0x16a416(0x1f5)])return _0x3e201c;const _0x3ceea7=join(_0x5b5da0[_0x16a416(0x1f1)],_0x464531[_0x16a416(0x1f5)]);if(_0x3ceea7===_0x40a1d9)return _0x3e201c;return await fileExists(_0x3ceea7)&&_0x3e201c[_0x16a416(0x1e4)]({'filePath':_0x3ceea7,'mode':_0x464531[_0x16a416(0x1f9)]??modeFromFilePath(_0x3ceea7),'isCanonical':![]}),_0x3e201c;}async function compareExistingSqlFiles(_0xb3738c,_0x5e8cb3,_0x5b3da9){const _0x5ad54c=a253_0x45e837;return Promise[_0x5ad54c(0x1d7)](_0xb3738c[_0x5ad54c(0x1c6)](async _0x365429=>{const _0xef890b=_0x5ad54c,_0x547035=await readFile(_0x365429[_0xef890b(0x1d2)],_0xef890b(0x1cd));return{'file':_0x365429,'content':_0x547035,'equivalent':isEquivalentPulledSqlFile(_0x547035,_0x5e8cb3,_0x365429[_0xef890b(0x1f9)],_0x5b3da9)};}));}function modeFromFilePath(_0x4d05b6){const _0x2ae7a7=a253_0x45e837;return _0x4d05b6['toLowerCase']()['endsWith'](_0x2ae7a7(0x1ef))?'mybatisXml':_0x2ae7a7(0x1dd);}function normalizePulledSqlBody(_0x39ad05,_0x435bb5){return stripLocalSqlMetadata(_0x39ad05,_0x435bb5)['replace'](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x7220a6,_0x4e812b){const _0x59d89e=a253_0x45e837,_0x395816=_0x7220a6[_0x59d89e(0x1ea)](/\r\n/g,'\x0a')[_0x59d89e(0x1ca)]('\x0a'),_0x51a69a=_0x395816[_0x59d89e(0x1c5)](_0x57e798=>!isSyncedAtMetadataLine(_0x57e798,_0x4e812b));return _0x51a69a[_0x59d89e(0x1bf)]('\x0a');}function isSyncedAtMetadataLine(_0x10ed7,_0x423bef){const _0x2a1b5a=a253_0x45e837;if(_0x423bef===_0x2a1b5a(0x1fa))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2a1b5a(0x1e5)](_0x10ed7);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x2a1b5a(0x1e5)](_0x10ed7);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a253_0x44a9(_0x25eb2e,_0xe4818f){_0x25eb2e=_0x25eb2e-0x1b7;const _0x443e69=a253_0x443e();let _0x44a95c=_0x443e69[_0x25eb2e];return _0x44a95c;}const a253_0x5f4f7d=a253_0x44a9;(function(_0x4d5c43,_0x4ea2c8){const _0xe42b7e=a253_0x44a9,_0x18508e=_0x4d5c43();while(!![]){try{const _0x568aa7=-parseInt(_0xe42b7e(0x1bb))/0x1+-parseInt(_0xe42b7e(0x1c9))/0x2+parseInt(_0xe42b7e(0x1d9))/0x3*(-parseInt(_0xe42b7e(0x1de))/0x4)+-parseInt(_0xe42b7e(0x1d0))/0x5+-parseInt(_0xe42b7e(0x1dc))/0x6+parseInt(_0xe42b7e(0x1ba))/0x7*(-parseInt(_0xe42b7e(0x1d5))/0x8)+parseInt(_0xe42b7e(0x1e7))/0x9;if(_0x568aa7===_0x4ea2c8)break;else _0x18508e['push'](_0x18508e['shift']());}catch(_0x2d465f){_0x18508e['push'](_0x18508e['shift']());}}}(a253_0x443e,0xa64e9));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';function a253_0x443e(){const _0x581d4e=['appCode','3xKEXWA','boolean','str','4737438gcAlgk','exec','5027048zEvalF','has','No\x20database\x20matches\x20local\x20directory\x20\x22','Local\x20SQL\x20not\x20found:\x20','sqlName','dbName','relativePath','sqls','replace','43907715eVmsMe','\x20pushed,\x20','length','push','hash','message','version','lockFilePath','entries','filePath','sql','write','Would\x20push\x20','catch','Push\x20complete:\x20','force','sqlRoot','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlCode','7TfokdL','688236nbofgb','toISOString','path','dbDirectory','filter','isFinite',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','\x22\x20for\x20sqlCode\x20','remoteId','get','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','mode','validation','1959368EtZMne','No\x20local\x20SQL\x20files\x20found.','set','dbId','Local\x20directory\x20\x22','sqlcode','sqlRootDir','111535QzNLIC','bool','sqlConfig','trashDir','\x20skipped,\x20','3687040dbBAGk','/smartapi/custom/updateUserCustomSql','trim'];a253_0x443e=function(){return _0x581d4e;};return a253_0x443e();}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(_0x519844){const _0x6eb7df=a253_0x44a9,_0x960026=stripLocalSqlMetadata(await readFile(_0x519844[_0x6eb7df(0x1f0)],'utf8'),_0x519844[_0x6eb7df(0x1c7)]);if(!_0x960026[_0x6eb7df(0x1d7)]())throw CliErrors['validation'](_0x519844[_0x6eb7df(0x1b9)]+':\x20SQL\x20content\x20is\x20empty.');return _0x960026;}async function getTargetSqlQueries(_0x53ca32,_0x128931,_0x14f0a7){const _0x18974d=a253_0x44a9,_0x3504cf=await scanLocalSqlQueries(_0x53ca32),_0x46c9d9=new Map();for(const _0x4116f5 of _0x3504cf){if(_0x14f0a7&&_0x4116f5[_0x18974d(0x1b9)]!==_0x14f0a7)continue;const _0x8fb5fa=_0x46c9d9[_0x18974d(0x1c5)](_0x4116f5['sqlCode'])??[];_0x8fb5fa['push'](_0x4116f5),_0x46c9d9[_0x18974d(0x1cb)](_0x4116f5[_0x18974d(0x1b9)],_0x8fb5fa);}if(_0x14f0a7&&!_0x46c9d9[_0x18974d(0x1df)](_0x14f0a7))throw CliErrors[_0x18974d(0x1c8)](_0x18974d(0x1e1)+_0x14f0a7);const _0x15f901=[];for(const [_0x3691f5,_0x20172d]of _0x46c9d9[_0x18974d(0x1ef)]()){if(_0x20172d[_0x18974d(0x1e9)]===0x1){_0x15f901[_0x18974d(0x1ea)](_0x20172d[0x0]);continue;}const _0x5910c9=_0x128931[_0x18974d(0x1e5)][_0x3691f5],_0x5efcb4=_0x5910c9?.[_0x18974d(0x1bd)],_0x2edde7=_0x5efcb4?_0x20172d[_0x18974d(0x1bf)](_0x46cb3c=>_0x46cb3c[_0x18974d(0x1e4)]!==_0x5efcb4):_0x20172d;if(_0x5910c9&&_0x2edde7['length']===0x1){_0x15f901[_0x18974d(0x1ea)](_0x2edde7[0x0]);continue;}throw CliErrors[_0x18974d(0x1c8)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x3691f5+_0x18974d(0x1b8));}return _0x15f901;}export const sqlPush={'service':a253_0x5f4f7d(0x1f1),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a253_0x5f4f7d(0x1f2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x5f4f7d(0x1f6),'type':a253_0x5f4f7d(0x1da),'description':a253_0x5f4f7d(0x1c2)}],async 'dryRun'(_0xe88cb2){const _0x393c7=a253_0x5f4f7d,_0x5268d5=loadSqlProjectConfig(_0xe88cb2['appCode']),_0x2dc698=await readSqlLockFile(_0x5268d5[_0x393c7(0x1ee)]),{appLock:_0x812a09}=ensureSqlLockScope(_0x2dc698??createEmptySqlLock(),_0xe88cb2[_0x393c7(0x1d8)],_0x5268d5[_0x393c7(0x1b7)],_0x393c7(0x1ea)),_0x3852d8=await getTargetSqlQueries(_0x5268d5,_0x812a09,_0xe88cb2[_0x393c7(0x1db)](_0x393c7(0x1ce))||undefined),_0x5e008b=[];for(const _0x36a8ba of _0x3852d8){const _0x402093=await computeSqlFileHash(_0x36a8ba['filePath']),_0x314514=_0x812a09[_0x393c7(0x1e5)][_0x36a8ba['sqlCode']],_0x2a2c33=!!_0x314514&&(_0x314514[_0x393c7(0x1bd)]!==_0x36a8ba[_0x393c7(0x1e4)]||!!_0x36a8ba[_0x393c7(0x1e2)]&&_0x314514[_0x393c7(0x1e2)]!==_0x36a8ba[_0x393c7(0x1e2)]||_0x314514['mode']!==_0x36a8ba['mode']);if(!_0xe88cb2[_0x393c7(0x1d1)]('force')&&_0x314514&&_0x314514[_0x393c7(0x1eb)]===_0x402093&&!_0x2a2c33)continue;if(!_0x314514)throw CliErrors[_0x393c7(0x1c8)](_0x36a8ba[_0x393c7(0x1b9)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x314514['version']==null)throw CliErrors[_0x393c7(0x1c8)](_0x36a8ba['sqlCode']+_0x393c7(0x1c1));await resolveTargetDbBinding(_0xe88cb2['appCode'],_0x36a8ba,_0x314514),await readSqlUploadContent(_0x36a8ba),_0x5e008b['push'](_0x36a8ba[_0x393c7(0x1b9)]);}return{'method':'POST','url':_0x393c7(0x1d6),'body':{'sqlCodes':_0x5e008b,'appCode':_0xe88cb2[_0x393c7(0x1d8)]},'description':_0x393c7(0x1f3)+_0x5e008b[_0x393c7(0x1e9)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x39a075){const _0x12ec19=a253_0x5f4f7d,_0x1b5bbf=loadSqlProjectConfig(_0x39a075[_0x12ec19(0x1d8)]),_0x944ac0=await readSqlLockFile(_0x1b5bbf['lockFilePath']),{lockData:_0xd4f115,appLock:_0x4ffc8c}=ensureSqlLockScope(_0x944ac0??createEmptySqlLock(),_0x39a075['appCode'],_0x1b5bbf[_0x12ec19(0x1b7)],'push'),_0x5e1f4d=await getTargetSqlQueries(_0x1b5bbf,_0x4ffc8c,_0x39a075[_0x12ec19(0x1db)]('sqlcode')||undefined);if(_0x5e1f4d[_0x12ec19(0x1e9)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x12ec19(0x1ca)};const _0x40b592=[],_0x91fc4f=[],_0x58dc2b=[];let _0x4c248f=![];for(const _0x508764 of _0x5e1f4d){const _0x10de1e=_0x4ffc8c[_0x12ec19(0x1e5)][_0x508764[_0x12ec19(0x1b9)]];if(!_0x10de1e){_0x58dc2b[_0x12ec19(0x1ea)]({'sqlCode':_0x508764[_0x12ec19(0x1b9)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x1e4c21=await computeSqlFileHash(_0x508764['filePath']),_0x42c447=_0x10de1e['path']!==_0x508764[_0x12ec19(0x1e4)]||!!_0x508764[_0x12ec19(0x1e2)]&&_0x10de1e[_0x12ec19(0x1e2)]!==_0x508764[_0x12ec19(0x1e2)]||_0x10de1e['mode']!==_0x508764[_0x12ec19(0x1c7)];if(!_0x39a075[_0x12ec19(0x1d1)](_0x12ec19(0x1f6))&&_0x10de1e[_0x12ec19(0x1eb)]===_0x1e4c21&&!_0x42c447){_0x91fc4f['push']({'sqlCode':_0x508764[_0x12ec19(0x1b9)],'reason':'unchanged'});continue;}if(_0x10de1e[_0x12ec19(0x1ed)]==null){_0x58dc2b[_0x12ec19(0x1ea)]({'sqlCode':_0x508764[_0x12ec19(0x1b9)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x3b16ec=_0x508764[_0x12ec19(0x1e2)]||_0x10de1e[_0x12ec19(0x1e2)],_0x43f7e9=await resolveTargetDbBinding(_0x39a075[_0x12ec19(0x1d8)],_0x508764,_0x10de1e),_0x40eddb=await readSqlUploadContent(_0x508764),_0x500d2d=await updateSqlQuery({'id':_0x10de1e[_0x12ec19(0x1c4)],'appCode':_0x39a075['appCode'],'sqlCode':_0x508764[_0x12ec19(0x1b9)],'sqlName':_0x3b16ec,'dbId':_0x43f7e9['dbId'],'version':_0x10de1e['version'],'sqlContent':_0x40eddb,'sqlConfig':_0x10de1e[_0x12ec19(0x1d2)]??undefined}),_0x30c8ea=_0x500d2d[_0x12ec19(0x1cc)]?await getDbName(_0x39a075[_0x12ec19(0x1d8)],Number(_0x500d2d['dbId']))[_0x12ec19(0x1f4)](()=>_0x43f7e9[_0x12ec19(0x1e3)]):_0x43f7e9[_0x12ec19(0x1e3)];_0x4ffc8c['sqls'][_0x508764[_0x12ec19(0x1b9)]]={...buildSqlLockEntry(_0x500d2d,_0x40eddb,_0x1e4c21,{'dbName':_0x30c8ea}),'path':_0x508764['relativePath'],'mode':_0x508764[_0x12ec19(0x1c7)]},_0x4c248f=!![],await archivePreviousSqlFileIfNeeded(_0x1b5bbf,_0x10de1e[_0x12ec19(0x1bd)],_0x508764[_0x12ec19(0x1e4)]),_0x40b592[_0x12ec19(0x1ea)]({'sqlCode':_0x508764[_0x12ec19(0x1b9)],'remoteId':_0x10de1e[_0x12ec19(0x1c4)]});}catch(_0x5e1ae5){_0x58dc2b[_0x12ec19(0x1ea)]({'sqlCode':_0x508764[_0x12ec19(0x1b9)],'error':_0x5e1ae5 instanceof Error?_0x5e1ae5[_0x12ec19(0x1ec)]:String(_0x5e1ae5)});}}(_0x4c248f||_0x58dc2b[_0x12ec19(0x1e9)]===0x0)&&(_0x4ffc8c['lastSync']=new Date()[_0x12ec19(0x1bc)](),await writeSqlLockFile(_0x1b5bbf['lockFilePath'],_0xd4f115));const _0x58a766=_0x58dc2b['length']===0x0;return{'ok':_0x58a766,'data':{'pushed':_0x40b592,'skipped':_0x91fc4f,'failed':_0x58dc2b},'message':_0x12ec19(0x1f5)+_0x40b592[_0x12ec19(0x1e9)]+_0x12ec19(0x1e8)+_0x91fc4f[_0x12ec19(0x1e9)]+_0x12ec19(0x1d4)+_0x58dc2b[_0x12ec19(0x1e9)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x2d883b,_0x5e759a,_0x5dcbc3){const _0x320eaa=a253_0x5f4f7d;if(!_0x5e759a||_0x5e759a===_0x5dcbc3)return;const _0x736194=join(_0x2d883b['sqlRootDir'],_0x5e759a);if(!await fileExists(_0x736194))return;const _0x5b486d=await moveToTrash(_0x2d883b['projectRoot'],_0x2d883b[_0x320eaa(0x1d3)],_0x736194);await cleanupEmptyDirectories(dirname(_0x736194),_0x2d883b[_0x320eaa(0x1cf)]),void _0x5b486d;}async function moveToTrash(_0x494ccd,_0xb789d6,_0x280775){const _0x234a5d=a253_0x5f4f7d,_0x501de6=new Date()[_0x234a5d(0x1bc)]()[_0x234a5d(0x1e6)](/[:.]/g,'-'),_0x56f5f5=relative(_0x494ccd,_0x280775),_0x433770=join(_0xb789d6,_0x501de6,_0x56f5f5);return await mkdir(dirname(_0x433770),{'recursive':!![]}),await rename(_0x280775,_0x433770),_0x433770;}async function cleanupEmptyDirectories(_0x472d0b,_0x19c947){const _0x19913e=a253_0x5f4f7d;let _0x169063=resolve(_0x472d0b);const _0x1ae644=resolve(_0x19c947);while(_0x169063['startsWith'](''+_0x1ae644+sep)||_0x169063===_0x1ae644){if(_0x169063===_0x1ae644)return;try{const _0x4f25b0=await readdir(_0x169063);if(_0x4f25b0[_0x19913e(0x1e9)]>0x0)return;await rmdir(_0x169063);}catch{return;}_0x169063=dirname(_0x169063);}}async function resolveTargetDbBinding(_0x25c8e3,_0x16256a,_0x43f244){const _0x5dd477=a253_0x5f4f7d,_0x46e3c1=_0x16256a[_0x5dd477(0x1be)];if(!_0x46e3c1)return{'dbId':_0x43f244['dbId'],'dbName':_0x43f244['dbName']};const _0x38c2a1=buildDbDirectoryName(_0x43f244[_0x5dd477(0x1e3)],_0x43f244[_0x5dd477(0x1cc)]);if(_0x46e3c1===_0x38c2a1)return{'dbId':_0x43f244[_0x5dd477(0x1cc)],'dbName':_0x43f244[_0x5dd477(0x1e3)]};const _0x1251b5=parseExplicitDbDirectory(_0x46e3c1);if(_0x1251b5!=null)return{'dbId':_0x1251b5,'dbName':await getDbName(_0x25c8e3,_0x1251b5)['catch'](()=>undefined)};const _0x442b61=await listDatabases(_0x25c8e3),_0xab835b=_0x442b61[_0x5dd477(0x1bf)](_0x41a1fc=>buildDbDirectoryName(_0x41a1fc[_0x5dd477(0x1e3)],_0x41a1fc[_0x5dd477(0x1cc)])===_0x46e3c1);if(_0xab835b[_0x5dd477(0x1e9)]===0x1)return{'dbId':_0xab835b[0x0][_0x5dd477(0x1cc)],'dbName':_0xab835b[0x0][_0x5dd477(0x1e3)]};if(_0xab835b[_0x5dd477(0x1e9)]===0x0)throw CliErrors['validation'](_0x5dd477(0x1e0)+_0x46e3c1+_0x5dd477(0x1c3)+_0x16256a[_0x5dd477(0x1b9)]+'.');const _0x138e63=_0xab835b['map'](_0x507eb=>_0x507eb['dbName']+'\x20('+_0x507eb['dbId']+')')['join'](',\x20');throw CliErrors['validation'](_0x5dd477(0x1cd)+_0x46e3c1+_0x5dd477(0x1c6)+_0x16256a[_0x5dd477(0x1b9)]+':\x20'+_0x138e63);}function parseExplicitDbDirectory(_0xaebb66){const _0x1216ed=a253_0x5f4f7d,_0x51843a=/^db-(\d+)$/[_0x1216ed(0x1dd)](_0xaebb66);if(!_0x51843a)return null;const _0x2e9fb3=Number(_0x51843a[0x1]);return Number[_0x1216ed(0x1c0)](_0x2e9fb3)&&_0x2e9fb3>0x0?_0x2e9fb3:null;}
|
|
1
|
+
const a254_0x3ddd04=a254_0x4124;(function(_0x47b576,_0xd95e1c){const _0x167919=a254_0x4124,_0x37ff54=_0x47b576();while(!![]){try{const _0x1a80fe=parseInt(_0x167919(0x11c))/0x1+parseInt(_0x167919(0x130))/0x2+-parseInt(_0x167919(0x143))/0x3+-parseInt(_0x167919(0x12f))/0x4*(-parseInt(_0x167919(0x148))/0x5)+parseInt(_0x167919(0x13b))/0x6+parseInt(_0x167919(0x122))/0x7*(parseInt(_0x167919(0x13d))/0x8)+parseInt(_0x167919(0x11f))/0x9*(-parseInt(_0x167919(0x115))/0xa);if(_0x1a80fe===_0xd95e1c)break;else _0x37ff54['push'](_0x37ff54['shift']());}catch(_0x22d7a7){_0x37ff54['push'](_0x37ff54['shift']());}}}(a254_0x5995,0x86a17));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a254_0x5995(){const _0x5349b2=['filter',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','hash','Push\x20local\x20SQL\x20files\x20to\x20remote','force','2566428DqdVGr','1185146leHzNe','push','length','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Local\x20directory\x20\x22','str','projectRoot','relativePath','\x20skipped,\x20','\x20SQL\x20file(s)',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','508728mEWKwB','\x22\x20for\x20sqlCode\x20','149592PkzKoI','has','sqlcode','utf8','sqlRootDir','catch','2409189FUvbJz','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','isFinite','startsWith','exec','5GyLtcL','toISOString','message','validation','\x20failed','dbId','filePath','appCode','No\x20local\x20SQL\x20files\x20found.','Would\x20push\x20','Push\x20complete:\x20','replace','Local\x20SQL\x20not\x20found:\x20','lockFilePath','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','mode','210ZopjDr','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlConfig','path',':\x20SQL\x20content\x20is\x20empty.','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','write','342313LhySss','sqlCode','No\x20database\x20matches\x20local\x20directory\x20\x22','147501ycrPqT','version','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','14KOtpyY','sqls','unchanged','dbName','POST','bool','get','sqlName'];a254_0x5995=function(){return _0x5349b2;};return a254_0x5995();}async function readSqlUploadContent(_0x4bb8d1){const _0xc65b24=a254_0x4124,_0x187f4d=stripLocalSqlMetadata(await readFile(_0x4bb8d1[_0xc65b24(0x10b)],_0xc65b24(0x140)),_0x4bb8d1[_0xc65b24(0x114)]);if(!_0x187f4d['trim']())throw CliErrors['validation'](_0x4bb8d1[_0xc65b24(0x11d)]+_0xc65b24(0x119));return _0x187f4d;}async function getTargetSqlQueries(_0x1f9309,_0x81055a,_0x356d5e){const _0x31d68b=a254_0x4124,_0x4e6e87=await scanLocalSqlQueries(_0x1f9309),_0x2c474e=new Map();for(const _0x57ee0f of _0x4e6e87){if(_0x356d5e&&_0x57ee0f[_0x31d68b(0x11d)]!==_0x356d5e)continue;const _0x157873=_0x2c474e[_0x31d68b(0x128)](_0x57ee0f[_0x31d68b(0x11d)])??[];_0x157873[_0x31d68b(0x131)](_0x57ee0f),_0x2c474e['set'](_0x57ee0f[_0x31d68b(0x11d)],_0x157873);}if(_0x356d5e&&!_0x2c474e[_0x31d68b(0x13e)](_0x356d5e))throw CliErrors['validation'](_0x31d68b(0x111)+_0x356d5e);const _0x1ecc46=[];for(const [_0x4573ab,_0x2b98a5]of _0x2c474e['entries']()){if(_0x2b98a5[_0x31d68b(0x132)]===0x1){_0x1ecc46[_0x31d68b(0x131)](_0x2b98a5[0x0]);continue;}const _0x5f0ce2=_0x81055a['sqls'][_0x4573ab],_0x128ace=_0x5f0ce2?.[_0x31d68b(0x118)],_0x3f7d58=_0x128ace?_0x2b98a5[_0x31d68b(0x12a)](_0x222fc1=>_0x222fc1[_0x31d68b(0x137)]!==_0x128ace):_0x2b98a5;if(_0x5f0ce2&&_0x3f7d58[_0x31d68b(0x132)]===0x1){_0x1ecc46[_0x31d68b(0x131)](_0x3f7d58[0x0]);continue;}throw CliErrors['validation'](_0x31d68b(0x144)+_0x4573ab+_0x31d68b(0x113));}return _0x1ecc46;}export const sqlPush={'service':'sql','command':'push','description':a254_0x3ddd04(0x12d),'risk':a254_0x3ddd04(0x11b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a254_0x3ddd04(0x11a)}],async 'dryRun'(_0x55b129){const _0x3b0d47=a254_0x3ddd04,_0x3b03da=loadSqlProjectConfig(_0x55b129[_0x3b0d47(0x10c)]),_0x4b13cf=await readSqlLockFile(_0x3b03da[_0x3b0d47(0x112)]),{appLock:_0x17f8ca}=ensureSqlLockScope(_0x4b13cf??createEmptySqlLock(),_0x55b129[_0x3b0d47(0x10c)],_0x3b03da['sqlRoot'],_0x3b0d47(0x131)),_0x21847e=await getTargetSqlQueries(_0x3b03da,_0x17f8ca,_0x55b129['str'](_0x3b0d47(0x13f))||undefined),_0x2af14f=[];for(const _0x56403e of _0x21847e){const _0x5ebb23=await computeSqlFileHash(_0x56403e['filePath']),_0x586bb8=_0x17f8ca[_0x3b0d47(0x123)][_0x56403e[_0x3b0d47(0x11d)]],_0x1965a4=!!_0x586bb8&&(_0x586bb8['path']!==_0x56403e[_0x3b0d47(0x137)]||!!_0x56403e['sqlName']&&_0x586bb8[_0x3b0d47(0x129)]!==_0x56403e[_0x3b0d47(0x129)]||_0x586bb8['mode']!==_0x56403e[_0x3b0d47(0x114)]);if(!_0x55b129[_0x3b0d47(0x127)]('force')&&_0x586bb8&&_0x586bb8['hash']===_0x5ebb23&&!_0x1965a4)continue;if(!_0x586bb8)throw CliErrors['validation'](_0x56403e[_0x3b0d47(0x11d)]+_0x3b0d47(0x12b));if(_0x586bb8[_0x3b0d47(0x120)]==null)throw CliErrors[_0x3b0d47(0x14b)](_0x56403e[_0x3b0d47(0x11d)]+_0x3b0d47(0x13a));await resolveTargetDbBinding(_0x55b129[_0x3b0d47(0x10c)],_0x56403e,_0x586bb8),await readSqlUploadContent(_0x56403e),_0x2af14f['push'](_0x56403e[_0x3b0d47(0x11d)]);}return{'method':_0x3b0d47(0x126),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x2af14f,'appCode':_0x55b129[_0x3b0d47(0x10c)]},'description':_0x3b0d47(0x10e)+_0x2af14f['length']+_0x3b0d47(0x139)};},async 'execute'(_0x327ffa){const _0x392c87=a254_0x3ddd04,_0x2468fb=loadSqlProjectConfig(_0x327ffa[_0x392c87(0x10c)]),_0x229d65=await readSqlLockFile(_0x2468fb[_0x392c87(0x112)]),{lockData:_0x10b25c,appLock:_0x4e15c5}=ensureSqlLockScope(_0x229d65??createEmptySqlLock(),_0x327ffa[_0x392c87(0x10c)],_0x2468fb['sqlRoot'],_0x392c87(0x131)),_0xc9622c=await getTargetSqlQueries(_0x2468fb,_0x4e15c5,_0x327ffa[_0x392c87(0x135)](_0x392c87(0x13f))||undefined);if(_0xc9622c[_0x392c87(0x132)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x392c87(0x10d)};const _0x15bffd=[],_0x41df4e=[],_0x485652=[];let _0x1a16f8=![];for(const _0x2630b3 of _0xc9622c){const _0x549f85=_0x4e15c5[_0x392c87(0x123)][_0x2630b3[_0x392c87(0x11d)]];if(!_0x549f85){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'error':_0x392c87(0x133)});continue;}try{const _0x4e7ff1=await computeSqlFileHash(_0x2630b3[_0x392c87(0x10b)]),_0x5db465=_0x549f85[_0x392c87(0x118)]!==_0x2630b3[_0x392c87(0x137)]||!!_0x2630b3['sqlName']&&_0x549f85[_0x392c87(0x129)]!==_0x2630b3[_0x392c87(0x129)]||_0x549f85[_0x392c87(0x114)]!==_0x2630b3[_0x392c87(0x114)];if(!_0x327ffa['bool'](_0x392c87(0x12e))&&_0x549f85[_0x392c87(0x12c)]===_0x4e7ff1&&!_0x5db465){_0x41df4e['push']({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'reason':_0x392c87(0x124)});continue;}if(_0x549f85['version']==null){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3['sqlCode'],'error':_0x392c87(0x116)});continue;}const _0x2d1cbc=_0x2630b3[_0x392c87(0x129)]||_0x549f85[_0x392c87(0x129)],_0x175278=await resolveTargetDbBinding(_0x327ffa['appCode'],_0x2630b3,_0x549f85),_0x479ebc=await readSqlUploadContent(_0x2630b3),_0x277c63=await updateSqlQuery({'id':_0x549f85['remoteId'],'appCode':_0x327ffa['appCode'],'sqlCode':_0x2630b3[_0x392c87(0x11d)],'sqlName':_0x2d1cbc,'dbId':_0x175278['dbId'],'version':_0x549f85[_0x392c87(0x120)],'sqlContent':_0x479ebc,'sqlConfig':_0x549f85[_0x392c87(0x117)]??undefined}),_0xdb600b=_0x277c63[_0x392c87(0x10a)]?await getDbName(_0x327ffa[_0x392c87(0x10c)],Number(_0x277c63[_0x392c87(0x10a)]))[_0x392c87(0x142)](()=>_0x175278[_0x392c87(0x125)]):_0x175278[_0x392c87(0x125)];_0x4e15c5[_0x392c87(0x123)][_0x2630b3[_0x392c87(0x11d)]]={...buildSqlLockEntry(_0x277c63,_0x479ebc,_0x4e7ff1,{'dbName':_0xdb600b}),'path':_0x2630b3[_0x392c87(0x137)],'mode':_0x2630b3[_0x392c87(0x114)]},_0x1a16f8=!![],await archivePreviousSqlFileIfNeeded(_0x2468fb,_0x549f85[_0x392c87(0x118)],_0x2630b3['relativePath']),_0x15bffd[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'remoteId':_0x549f85['remoteId']});}catch(_0x56c397){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'error':_0x56c397 instanceof Error?_0x56c397[_0x392c87(0x14a)]:String(_0x56c397)});}}(_0x1a16f8||_0x485652[_0x392c87(0x132)]===0x0)&&(_0x4e15c5['lastSync']=new Date()[_0x392c87(0x149)](),await writeSqlLockFile(_0x2468fb['lockFilePath'],_0x10b25c));const _0x4bafbd=_0x485652['length']===0x0;return{'ok':_0x4bafbd,'data':{'pushed':_0x15bffd,'skipped':_0x41df4e,'failed':_0x485652},'message':_0x392c87(0x10f)+_0x15bffd[_0x392c87(0x132)]+'\x20pushed,\x20'+_0x41df4e['length']+_0x392c87(0x138)+_0x485652[_0x392c87(0x132)]+_0x392c87(0x109)};}};function a254_0x4124(_0x2b9078,_0x51b9a7){_0x2b9078=_0x2b9078-0x109;const _0x59951f=a254_0x5995();let _0x412400=_0x59951f[_0x2b9078];return _0x412400;}async function archivePreviousSqlFileIfNeeded(_0x26e207,_0x4d35f2,_0x11a372){const _0x4501fa=a254_0x3ddd04;if(!_0x4d35f2||_0x4d35f2===_0x11a372)return;const _0x2285a3=join(_0x26e207[_0x4501fa(0x141)],_0x4d35f2);if(!await fileExists(_0x2285a3))return;const _0x1f043a=await moveToTrash(_0x26e207[_0x4501fa(0x136)],_0x26e207['trashDir'],_0x2285a3);await cleanupEmptyDirectories(dirname(_0x2285a3),_0x26e207['sqlRootDir']),void _0x1f043a;}async function moveToTrash(_0x3fad7f,_0x7515af,_0x37e63e){const _0x491156=a254_0x3ddd04,_0x179161=new Date()['toISOString']()[_0x491156(0x110)](/[:.]/g,'-'),_0x1bc827=relative(_0x3fad7f,_0x37e63e),_0x18e6f4=join(_0x7515af,_0x179161,_0x1bc827);return await mkdir(dirname(_0x18e6f4),{'recursive':!![]}),await rename(_0x37e63e,_0x18e6f4),_0x18e6f4;}async function cleanupEmptyDirectories(_0x4d6b09,_0x4b142e){const _0x5f0b18=a254_0x3ddd04;let _0x2b3f17=resolve(_0x4d6b09);const _0x5c6051=resolve(_0x4b142e);while(_0x2b3f17[_0x5f0b18(0x146)](''+_0x5c6051+sep)||_0x2b3f17===_0x5c6051){if(_0x2b3f17===_0x5c6051)return;try{const _0x1682db=await readdir(_0x2b3f17);if(_0x1682db[_0x5f0b18(0x132)]>0x0)return;await rmdir(_0x2b3f17);}catch{return;}_0x2b3f17=dirname(_0x2b3f17);}}async function resolveTargetDbBinding(_0x6df093,_0x5d4ecb,_0x5a5e73){const _0x322e89=a254_0x3ddd04,_0x39ed9e=_0x5d4ecb['dbDirectory'];if(!_0x39ed9e)return{'dbId':_0x5a5e73[_0x322e89(0x10a)],'dbName':_0x5a5e73[_0x322e89(0x125)]};const _0x3bab4f=buildDbDirectoryName(_0x5a5e73['dbName'],_0x5a5e73[_0x322e89(0x10a)]);if(_0x39ed9e===_0x3bab4f)return{'dbId':_0x5a5e73[_0x322e89(0x10a)],'dbName':_0x5a5e73[_0x322e89(0x125)]};const _0x4b1236=parseExplicitDbDirectory(_0x39ed9e);if(_0x4b1236!=null)return{'dbId':_0x4b1236,'dbName':await getDbName(_0x6df093,_0x4b1236)[_0x322e89(0x142)](()=>undefined)};const _0x405213=await listDatabases(_0x6df093),_0x48d5db=_0x405213[_0x322e89(0x12a)](_0x339d5d=>buildDbDirectoryName(_0x339d5d[_0x322e89(0x125)],_0x339d5d[_0x322e89(0x10a)])===_0x39ed9e);if(_0x48d5db[_0x322e89(0x132)]===0x1)return{'dbId':_0x48d5db[0x0][_0x322e89(0x10a)],'dbName':_0x48d5db[0x0][_0x322e89(0x125)]};if(_0x48d5db[_0x322e89(0x132)]===0x0)throw CliErrors[_0x322e89(0x14b)](_0x322e89(0x11e)+_0x39ed9e+_0x322e89(0x13c)+_0x5d4ecb[_0x322e89(0x11d)]+'.');const _0x2692c8=_0x48d5db['map'](_0x134294=>_0x134294[_0x322e89(0x125)]+'\x20('+_0x134294[_0x322e89(0x10a)]+')')['join'](',\x20');throw CliErrors['validation'](_0x322e89(0x134)+_0x39ed9e+_0x322e89(0x121)+_0x5d4ecb[_0x322e89(0x11d)]+':\x20'+_0x2692c8);}function parseExplicitDbDirectory(_0x176836){const _0x1b47c6=a254_0x3ddd04,_0x7ad30=/^db-(\d+)$/[_0x1b47c6(0x147)](_0x176836);if(!_0x7ad30)return null;const _0x493741=Number(_0x7ad30[0x1]);return Number[_0x1b47c6(0x145)](_0x493741)&&_0x493741>0x0?_0x493741:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2e64b8,_0x80e925){const _0x162498=a255_0x18b7,_0x2ecc98=_0x2e64b8();while(!![]){try{const _0x3d3238=parseInt(_0x162498(0x178))/0x1*(-parseInt(_0x162498(0x189))/0x2)+parseInt(_0x162498(0x181))/0x3+parseInt(_0x162498(0x188))/0x4+-parseInt(_0x162498(0x173))/0x5+parseInt(_0x162498(0x18a))/0x6+parseInt(_0x162498(0x16c))/0x7+parseInt(_0x162498(0x190))/0x8*(parseInt(_0x162498(0x194))/0x9);if(_0x3d3238===_0x80e925)break;else _0x2ecc98['push'](_0x2ecc98['shift']());}catch(_0x15ecdc){_0x2ecc98['push'](_0x2ecc98['shift']());}}}(a255_0x1911,0xe77d5));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x52b08f,_0x652f79,_0x3d5b24,_0x59ebc0){const _0x4ba2b5=a255_0x18b7,_0x4a4d19=detectSqlMode(_0x652f79);return{'path':buildSqlRelativePath(_0x52b08f[_0x4ba2b5(0x186)],_0x52b08f[_0x4ba2b5(0x17d)],_0x59ebc0?.[_0x4ba2b5(0x183)],_0x4a4d19,_0x52b08f[_0x4ba2b5(0x185)]),'hash':_0x3d5b24,'remoteId':_0x52b08f['id'],'version':_0x52b08f[_0x4ba2b5(0x16f)],'dbId':Number(_0x52b08f[_0x4ba2b5(0x185)]),'dbName':_0x59ebc0?.[_0x4ba2b5(0x183)],'sqlName':_0x52b08f['sqlName'],'sqlConfig':_0x52b08f[_0x4ba2b5(0x191)]??undefined,'mode':_0x4a4d19};}export function cloneSqlLockData(_0x5e3cba){const _0x11e8d3=a255_0x18b7;return{'apps':Object[_0x11e8d3(0x196)](Object[_0x11e8d3(0x18f)](_0x5e3cba['apps'])[_0x11e8d3(0x16e)](([_0x572bc1,_0x4a0b60])=>[_0x572bc1,{'sqlRoot':_0x4a0b60['sqlRoot'],'lastSync':_0x4a0b60[_0x11e8d3(0x169)],'sqls':{..._0x4a0b60[_0x11e8d3(0x182)]}}]))};}export function ensureRemoteSqlContent(_0xbbc26d){return _0xbbc26d['sqlContent']??'';}export function buildLocalSqlFileContent(_0x3ab242,_0x50e2a1,_0x6de7b6){const _0x31cb74=a255_0x18b7,_0x40fd4a=_0x6de7b6?.[_0x31cb74(0x179)]??detectSqlMode(_0x50e2a1),_0x428078=stripLocalSqlMetadata(_0x50e2a1,_0x40fd4a)[_0x31cb74(0x16b)](),_0x219ee3=buildMetadataHeaderLines({'sqlCode':_0x3ab242['sqlCode'],'sqlName':_0x3ab242['sqlName'],'dbId':_0x3ab242['dbId'],'dbName':_0x6de7b6?.[_0x31cb74(0x183)],'mode':_0x40fd4a,'syncedAt':_0x6de7b6?.[_0x31cb74(0x17f)],'description':_0x6de7b6?.[_0x31cb74(0x184)]},_0x40fd4a),_0x276028=_0x40fd4a===_0x31cb74(0x171)?splitXmlDeclaration(_0x428078):{'body':_0x428078},_0x23cf84=[..._0x276028[_0x31cb74(0x174)]?[_0x276028[_0x31cb74(0x174)]]:[],..._0x219ee3,'',_0x276028[_0x31cb74(0x17e)][_0x31cb74(0x18b)]()],_0x21c9e1=_0x23cf84[_0x31cb74(0x177)]('\x0a');return _0x21c9e1[_0x31cb74(0x176)]('\x0a')?_0x21c9e1:_0x21c9e1+'\x0a';}export function stripLocalSqlMetadata(_0x3f34d5,_0xa1eb4f){const _0x271875=a255_0x18b7;if(_0xa1eb4f===_0x271875(0x171)){const {declaration:_0x11befd,body:_0x892e64}=splitXmlDeclaration(_0x3f34d5[_0x271875(0x17c)](/\r\n/g,'\x0a')),_0x5e9862=stripLeadingMetadataLines(_0x892e64,/^\s*<!--\s*@lovrabet\./);return _0x11befd?''+_0x11befd+(_0x5e9862?'\x0a'+_0x5e9862:''):_0x5e9862;}return stripLeadingMetadataLines(_0x3f34d5[_0x271875(0x17c)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x41f256,_0x5c4d5c){const _0x827ecb=a255_0x18b7;if(_0x5c4d5c?.[_0x827ecb(0x179)])return _0x5c4d5c['mode'];return detectSqlMode(_0x41f256);}export function resolveSqlFileName(_0x37c336,_0x3d8d84,_0x49a134){const _0x150b52=a255_0x18b7;if(_0x49a134?.[_0x150b52(0x17a)])return _0x49a134[_0x150b52(0x17a)];if(_0x49a134?.[_0x150b52(0x17d)]||_0x49a134?.[_0x150b52(0x183)])return buildSqlRelativePath(_0x37c336,_0x49a134?.[_0x150b52(0x17d)],_0x49a134?.[_0x150b52(0x183)],resolveSqlMode(_0x3d8d84,_0x49a134),_0x49a134?.[_0x150b52(0x185)]);return buildDefaultSqlFileName(_0x37c336,resolveSqlMode(_0x3d8d84,_0x49a134));}export function resolveSqlLocalDir(_0x25ce75,_0x2cfaff){return join(_0x25ce75,SQL_LOCAL_REL_DIR,_0x2cfaff);}export async function confirmForceOverwrite(_0xffa382){const _0x5da6ed=a255_0x18b7,_0x3bdf53=createInterface({'input':process[_0x5da6ed(0x192)],'output':process['stderr']}),_0x1774ff=await new Promise(_0x957916=>{const _0x2ed99f=_0x5da6ed;_0x3bdf53[_0x2ed99f(0x16d)](_0xffa382+_0x2ed99f(0x172),_0x957916);});return _0x3bdf53['close'](),['y',_0x5da6ed(0x195)][_0x5da6ed(0x180)](_0x1774ff[_0x5da6ed(0x16b)]()[_0x5da6ed(0x18c)]());}export function findSqlLockScope(_0x40d52d,_0x3754f3){const _0x51cb1c=a255_0x18b7;return _0x40d52d[_0x51cb1c(0x18e)][_0x3754f3];}function buildMetadataHeaderLines(_0x2ec175,_0x3490f2){const _0x57c895=a255_0x18b7,_0x5e6f38=[['sqlCode',_0x2ec175['sqlCode']],[_0x57c895(0x17d),_0x2ec175[_0x57c895(0x17d)]],[_0x57c895(0x185),_0x2ec175['dbId']],[_0x57c895(0x183),_0x2ec175[_0x57c895(0x183)]],[_0x57c895(0x179),_0x2ec175[_0x57c895(0x179)]],[_0x57c895(0x17f),_0x2ec175[_0x57c895(0x17f)]],['description',_0x2ec175[_0x57c895(0x184)]]];if(_0x3490f2===_0x57c895(0x171))return _0x5e6f38[_0x57c895(0x16a)](([,_0x5d4f8c])=>_0x5d4f8c!==undefined&&_0x5d4f8c!==null&&String(_0x5d4f8c)[_0x57c895(0x16b)]()!=='')[_0x57c895(0x16e)](([_0x3e8051,_0x1f5f6d])=>'<!--\x20@lovrabet.'+_0x3e8051+':\x20'+String(_0x1f5f6d)+_0x57c895(0x18d));return _0x5e6f38[_0x57c895(0x16a)](([,_0x37055f])=>_0x37055f!==undefined&&_0x37055f!==null&&String(_0x37055f)[_0x57c895(0x16b)]()!=='')[_0x57c895(0x16e)](([_0x5de4a4,_0x5dbed6])=>_0x57c895(0x175)+_0x5de4a4+':\x20'+String(_0x5dbed6));}function a255_0x1911(){const _0x5d6485=['version','test','mybatisXml','\x20[y/N]\x20','9029265xwzsto','declaration','--\x20@lovrabet.','endsWith','join','382549JTIgds','mode','path','length','replace','sqlName','body','syncedAt','includes','2929602AVNoIw','sqls','dbName','description','dbId','sqlCode','exec','3434888HdPKZc','8cBuYcz','1694136QyEGPm','trimStart','toLowerCase','\x20-->','apps','entries','64WLrKfw','sqlConfig','stdin','slice','735093MVWDEc','yes','fromEntries','lastSync','filter','trim','10592414YrUlaX','question','map'];a255_0x1911=function(){return _0x5d6485;};return a255_0x1911();}function splitXmlDeclaration(_0x2aac29){const _0x3e2803=a255_0x18b7,_0x22f4ab=_0x2aac29[_0x3e2803(0x18b)](),_0x59e42e=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x3e2803(0x187)](_0x22f4ab);if(!_0x59e42e)return{'body':_0x2aac29};return{'declaration':_0x59e42e[0x0],'body':_0x22f4ab[_0x3e2803(0x193)](_0x59e42e[0x0][_0x3e2803(0x17b)])};}function a255_0x18b7(_0x560b51,_0x4f019b){_0x560b51=_0x560b51-0x169;const _0x1911d9=a255_0x1911();let _0x18b794=_0x1911d9[_0x560b51];return _0x18b794;}function stripLeadingMetadataLines(_0x9c5d1a,_0x2687a7){const _0x27e73d=a255_0x18b7,_0x20f45a=_0x9c5d1a['split']('\x0a');let _0x7f1639=0x0;while(_0x7f1639<_0x20f45a['length']){const _0x6fbe4d=_0x20f45a[_0x7f1639]??'';if(_0x2687a7[_0x27e73d(0x170)](_0x6fbe4d)||_0x6fbe4d[_0x27e73d(0x16b)]()===''){_0x7f1639++;continue;}break;}return _0x20f45a['slice'](_0x7f1639)[_0x27e73d(0x177)]('\x0a')[_0x27e73d(0x18b)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a256_0x59f0(){const _0x19520e=['appCode','572615baIwXk','9bBAgxW','4786AaLjnv','2693590kUOIEl','bool','sqls','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','boolean','filePath','tableData','184icxubC','push','325964GyGxPO','sql','\x20added,\x20','relativePath','has','map','91wEfcrb','sqlCode','All\x20SQL\x20queries\x20are\x20in\x20sync.','sqlName','hash','4393455RTFHPh','remote','totalCount','6GTWfVw','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','42763VCEpNz','\x20missing,\x20','length','lockKey','read','keys','1823085cuOHZt','path','status'];a256_0x59f0=function(){return _0x19520e;};return a256_0x59f0();}const a256_0x234dff=a256_0x10e2;(function(_0x1d656f,_0x4506d4){const _0x1e3361=a256_0x10e2,_0x151e91=_0x1d656f();while(!![]){try{const _0x524162=-parseInt(_0x1e3361(0xe6))/0x1*(-parseInt(_0x1e3361(0xd6))/0x2)+parseInt(_0x1e3361(0xd5))/0x3*(parseInt(_0x1e3361(0xe0))/0x4)+-parseInt(_0x1e3361(0xd4))/0x5*(-parseInt(_0x1e3361(0xee))/0x6)+parseInt(_0x1e3361(0xf0))/0x7*(parseInt(_0x1e3361(0xde))/0x8)+parseInt(_0x1e3361(0xf6))/0x9+-parseInt(_0x1e3361(0xd7))/0xa+-parseInt(_0x1e3361(0xeb))/0xb;if(_0x524162===_0x4506d4)break;else _0x151e91['push'](_0x151e91['shift']());}catch(_0x14af7b){_0x151e91['push'](_0x151e91['shift']());}}}(a256_0x59f0,0x3d4bb));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a256_0x10e2(_0x744805,_0x57c365){_0x744805=_0x744805-0xd3;const _0x59f091=a256_0x59f0();let _0x10e276=_0x59f091[_0x744805];return _0x10e276;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x48a7e7){const _0x3d699d=a256_0x10e2,_0x192a21=[];let _0x2a70b4=0x1;while(!![]){const _0x1f46ae=await listSqlQueries(_0x48a7e7,{'currentPage':_0x2a70b4,'pageSize':PAGE_SIZE}),_0x2fcc87=_0x1f46ae[_0x3d699d(0xdd)]??[];_0x192a21[_0x3d699d(0xdf)](..._0x2fcc87['map'](_0x5c0b82=>_0x5c0b82[_0x3d699d(0xe7)]));if(_0x2fcc87['length']===0x0)break;const _0x4b4854=_0x1f46ae['paging']?.[_0x3d699d(0xed)];if(_0x4b4854!=null?_0x192a21[_0x3d699d(0xf2)]>=_0x4b4854:_0x2fcc87[_0x3d699d(0xf2)]<PAGE_SIZE)break;_0x2a70b4++;}return _0x192a21;}export const sqlStatus={'service':a256_0x234dff(0xe1),'command':a256_0x234dff(0xf8),'description':a256_0x234dff(0xda),'risk':a256_0x234dff(0xf4),'flags':[{'name':a256_0x234dff(0xec),'type':a256_0x234dff(0xdb),'description':a256_0x234dff(0xef)}],async 'execute'(_0x282d72){const _0x150ee5=a256_0x234dff,_0x15231a=loadSqlProjectConfig(_0x282d72[_0x150ee5(0xd3)]),_0xe0a25d=await readSqlLockFile(_0x15231a['lockFilePath']),{appLock:_0x527fa6}=ensureSqlLockScope(_0xe0a25d??createEmptySqlLock(),_0x15231a['appCode'],_0x15231a['sqlRoot'],_0x150ee5(0xf8)),_0x533661=await scanLocalSqlQueries(_0x15231a),_0x44f454=[],_0x4962a3=[],_0x17a791=[],_0x582535=[],_0x5dfc6a=new Set(_0x533661[_0x150ee5(0xe5)](_0x58fc38=>_0x58fc38[_0x150ee5(0xf3)]));for(const _0x3b900c of _0x533661){const _0xc618fc=await computeSqlFileHash(_0x3b900c[_0x150ee5(0xdc)]),_0x5cc68c=_0x527fa6[_0x150ee5(0xd9)][_0x3b900c[_0x150ee5(0xf3)]],_0x5ebc80=!!_0x5cc68c&&_0x5cc68c[_0x150ee5(0xf7)]!==_0x3b900c[_0x150ee5(0xe3)],_0x2b4ae9=!!_0x5cc68c&&!!_0x3b900c[_0x150ee5(0xe9)]&&_0x5cc68c[_0x150ee5(0xe9)]!==_0x3b900c[_0x150ee5(0xe9)];if(!_0x5cc68c)_0x44f454[_0x150ee5(0xdf)](_0x3b900c[_0x150ee5(0xf3)]);else _0x5cc68c[_0x150ee5(0xea)]!==_0xc618fc||_0x5ebc80||_0x2b4ae9?_0x4962a3[_0x150ee5(0xdf)](_0x3b900c['lockKey']):_0x17a791[_0x150ee5(0xdf)](_0x3b900c['lockKey']);}for(const _0x25905a of Object[_0x150ee5(0xf5)](_0x527fa6[_0x150ee5(0xd9)])){!_0x5dfc6a[_0x150ee5(0xe4)](_0x25905a)&&_0x582535[_0x150ee5(0xdf)](_0x25905a);}const _0x15daa4=[];if(_0x282d72[_0x150ee5(0xd8)](_0x150ee5(0xec))){const _0x272ad9=await fetchAllSqlCodes(_0x282d72['appCode']);for(const _0x21ad93 of _0x272ad9){!_0x5dfc6a['has'](_0x21ad93)&&!_0x527fa6[_0x150ee5(0xd9)][_0x21ad93]&&_0x15daa4[_0x150ee5(0xdf)](_0x21ad93);}}const _0x3e32c4=_0x44f454['length']===0x0&&_0x4962a3[_0x150ee5(0xf2)]===0x0&&_0x582535[_0x150ee5(0xf2)]===0x0&&_0x15daa4[_0x150ee5(0xf2)]===0x0;return{'ok':!![],'data':{'added':_0x44f454,'modified':_0x4962a3,'missing':_0x582535,'unchanged':_0x17a791,'remoteOnly':_0x15daa4},'message':_0x3e32c4?_0x150ee5(0xe8):_0x44f454[_0x150ee5(0xf2)]+_0x150ee5(0xe2)+_0x4962a3[_0x150ee5(0xf2)]+'\x20modified,\x20'+_0x582535[_0x150ee5(0xf2)]+_0x150ee5(0xf1)+_0x17a791[_0x150ee5(0xf2)]+'\x20unchanged'+(_0x15daa4['length']>0x0?',\x20'+_0x15daa4[_0x150ee5(0xf2)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a257_0x1ea4(_0x47b8a2,_0x5c11c6){_0x47b8a2=_0x47b8a2-0x122;const _0x3f29f5=a257_0x3f29();let _0x1ea4b6=_0x3f29f5[_0x47b8a2];return _0x1ea4b6;}const a257_0x868bfc=a257_0x1ea4;(function(_0x17fb30,_0x19bd16){const _0x49a98b=a257_0x1ea4,_0x2470e6=_0x17fb30();while(!![]){try{const _0x4ece9d=parseInt(_0x49a98b(0x144))/0x1+parseInt(_0x49a98b(0x131))/0x2*(parseInt(_0x49a98b(0x156))/0x3)+-parseInt(_0x49a98b(0x124))/0x4*(parseInt(_0x49a98b(0x12f))/0x5)+parseInt(_0x49a98b(0x133))/0x6+-parseInt(_0x49a98b(0x159))/0x7+parseInt(_0x49a98b(0x14b))/0x8+parseInt(_0x49a98b(0x13b))/0x9*(-parseInt(_0x49a98b(0x158))/0xa);if(_0x4ece9d===_0x19bd16)break;else _0x2470e6['push'](_0x2470e6['shift']());}catch(_0x469a16){_0x2470e6['push'](_0x2470e6['shift']());}}}(a257_0x3f29,0x25186));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a257_0x3f29(){const _0x4100bd=['split','bool','get','appCode','validate','string','cwd','sql','type','1204045TtDVut','indexes','2LPfBzs','flagMissing','1585866PeRBfR','\x22\x20not\x20found\x20in\x20any\x20dataset','fields','reason','filter','file','columnNames','valid','27JBPpHJ','utf-8','push','isSelectOnly','dbtableConfig','index_type','trim','message','index_columns','222924cWDjyj','SQL\x20schema\x20validation','isArray','check-indexes','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','toLowerCase','File\x20not\x20found:\x20','1368736ltALFm','schemas','parameters','map','schemaWarnings','primary','validation','columns','sqlType','isDangerous','boolean','699513aiWruM','isLockingRead','982780oyxYwu','1427391jkvlvr','\x22\x20not\x20found\x20or\x20not\x20accessible','size','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','dataset','length','str','indexName','name','pkField','flatMap','tableName','read','4HzvzCN','find'];a257_0x3f29=function(){return _0x4100bd;};return a257_0x3f29();}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_0x868bfc(0x12d),'command':a257_0x868bfc(0x12a),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a257_0x868bfc(0x123),'flags':[{'name':a257_0x868bfc(0x138),'type':a257_0x868bfc(0x12b),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a257_0x868bfc(0x12d),'type':a257_0x868bfc(0x12b),'description':a257_0x868bfc(0x15c)},{'name':a257_0x868bfc(0x14c),'type':'string','description':a257_0x868bfc(0x148)},{'name':a257_0x868bfc(0x147),'type':a257_0x868bfc(0x155),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x510c97){const _0xe9c92c=a257_0x868bfc,_0x504707=_0x510c97[_0xe9c92c(0x15f)]('file'),_0x292fd6=_0x510c97[_0xe9c92c(0x15f)](_0xe9c92c(0x12d)),_0x43e550=_0x510c97[_0xe9c92c(0x15f)](_0xe9c92c(0x14c)),_0xbb2c77=_0x510c97[_0xe9c92c(0x127)](_0xe9c92c(0x147));if(!_0x504707&&!_0x292fd6)throw CliErrors[_0xe9c92c(0x132)](_0xe9c92c(0x138),'Provide\x20--file\x20or\x20--sql');if(_0xbb2c77&&!_0x43e550)throw CliErrors[_0xe9c92c(0x151)]('--check-indexes\x20requires\x20--schemas.');let _0x3bba68;if(_0x504707){const _0x564eab=resolve(process[_0xe9c92c(0x12c)](),_0x504707);if(!existsSync(_0x564eab))throw CliErrors[_0xe9c92c(0x151)](_0xe9c92c(0x14a)+_0x564eab);_0x3bba68=readFileSync(_0x564eab,_0xe9c92c(0x13c));}else _0x3bba68=_0x292fd6;const _0x209681=validateSql(_0x3bba68),_0x3670cf={'valid':_0x209681[_0xe9c92c(0x13a)],'sqlType':_0x209681[_0xe9c92c(0x153)]['type'],'isSelectOnly':_0x209681[_0xe9c92c(0x153)][_0xe9c92c(0x13e)],'isLockingRead':_0x209681[_0xe9c92c(0x153)][_0xe9c92c(0x157)]??![],'isDangerous':_0x209681[_0xe9c92c(0x153)][_0xe9c92c(0x154)],'tables':_0x209681['tables'],'parameters':_0x209681[_0xe9c92c(0x14d)],'message':_0x209681[_0xe9c92c(0x142)]};_0x209681[_0xe9c92c(0x153)][_0xe9c92c(0x136)]&&(_0x3670cf[_0xe9c92c(0x136)]=_0x209681[_0xe9c92c(0x153)][_0xe9c92c(0x136)]);if(_0x43e550&&_0x209681[_0xe9c92c(0x13a)]){const _0x325339=_0x43e550[_0xe9c92c(0x126)](',')[_0xe9c92c(0x14e)](_0x3fc809=>_0x3fc809[_0xe9c92c(0x141)]())['filter'](Boolean),_0x219305=[],_0x548a69=[],_0x448963=filterDbTableBackedDatasets(await listDatasets(_0x510c97[_0xe9c92c(0x129)])),_0x84397b=new Map(_0x448963[_0xe9c92c(0x14e)](_0x4bfe42=>[_0x4bfe42[_0xe9c92c(0x13f)]?.[_0xe9c92c(0x122)]?.[_0xe9c92c(0x149)](),_0x4bfe42]));for(const _0x5dba5f of _0x209681['tables']){const _0x4cfee2=_0x84397b[_0xe9c92c(0x128)](_0x5dba5f[_0xe9c92c(0x149)]());!_0x4cfee2&&_0x219305[_0xe9c92c(0x13d)]('Table\x20\x22'+_0x5dba5f+_0xe9c92c(0x134));}for(const _0x4bd419 of _0x325339){let _0x47975a;try{_0x47975a=await getDatasetDetail(_0x4bd419);}catch{_0x219305[_0xe9c92c(0x13d)]('Dataset\x20\x22'+_0x4bd419+_0xe9c92c(0x15a));continue;}assertDatasetIsDbTableBacked(_0x47975a,_0xe9c92c(0x145));const _0x2dc1bc=Array[_0xe9c92c(0x146)](_0x47975a['fields'])?_0x47975a[_0xe9c92c(0x135)]:[],_0x8694dd=new Set(_0x2dc1bc['map'](_0x22965f=>_0x22965f[_0xe9c92c(0x161)]?.[_0xe9c92c(0x149)]())),_0x3abb1c=_0x47975a[_0xe9c92c(0x13f)]?.[_0xe9c92c(0x122)]||_0x47975a['tableName']||_0x4bd419;_0x3670cf['schema:'+_0x3abb1c]={'code':_0x4bd419,'tableName':_0x3abb1c,'fieldCount':_0x8694dd[_0xe9c92c(0x15b)],'fields':Array['from'](_0x8694dd)};if(_0xbb2c77){const _0x4ed4ce=normalizeDatasetIndexes(_0x47975a);_0x548a69[_0xe9c92c(0x13d)]({'tableName':_0x3abb1c,..._0x4ed4ce});}}_0x219305[_0xe9c92c(0x15e)]>0x0&&(_0x3670cf[_0xe9c92c(0x14f)]=_0x219305),_0xbb2c77&&(_0x3670cf['joinAudit']=auditSqlJoinIndexes(_0x3bba68,_0x548a69));}return{'ok':_0x209681[_0xe9c92c(0x13a)],'data':_0x3670cf,'message':_0x209681[_0xe9c92c(0x142)]};}};function normalizeDatasetIndexes(_0x36dd24){const _0x179114=a257_0x868bfc,_0x1da9c0=Array[_0x179114(0x146)](_0x36dd24?.[_0x179114(0x15d)]?.[_0x179114(0x130)])?_0x36dd24['dataset'][_0x179114(0x130)]:Array[_0x179114(0x146)](_0x36dd24?.[_0x179114(0x130)])?_0x36dd24['indexes']:[],_0x53fc66=_0x1da9c0[_0x179114(0x163)](_0x4e9bfd=>{const _0x47c071=_0x179114,_0x510a42=Array[_0x47c071(0x146)](_0x4e9bfd?.[_0x47c071(0x143)])?_0x4e9bfd[_0x47c071(0x143)]:Array[_0x47c071(0x146)](_0x4e9bfd?.['columnNames'])?_0x4e9bfd[_0x47c071(0x139)]:Array['isArray'](_0x4e9bfd?.[_0x47c071(0x152)])?_0x4e9bfd['columns']:[],_0x1a7c32=_0x510a42[_0x47c071(0x137)](_0x43b207=>typeof _0x43b207===_0x47c071(0x12b))[_0x47c071(0x14e)](_0x2af34e=>_0x2af34e[_0x47c071(0x141)]())['filter'](Boolean);if(_0x1a7c32[_0x47c071(0x15e)]===0x0)return[];const _0x39057c=[_0x4e9bfd?.[_0x47c071(0x160)],_0x4e9bfd?.['index_name'],_0x4e9bfd?.['name']][_0x47c071(0x125)](_0x136046=>typeof _0x136046===_0x47c071(0x12b)&&_0x136046['trim']()),_0x546dc3=[_0x4e9bfd?.[_0x47c071(0x140)],_0x4e9bfd?.[_0x47c071(0x12e)]]['find'](_0x9c78bf=>typeof _0x9c78bf==='string'&&_0x9c78bf[_0x47c071(0x141)]());return[{..._0x39057c?{'name':_0x39057c[_0x47c071(0x141)]()}:{},..._0x546dc3?{'type':_0x546dc3[_0x47c071(0x141)]()}:{},'columns':_0x1a7c32}];}),_0x2102f8=[..._0x53fc66],_0x5efda2=typeof _0x36dd24?.[_0x179114(0x13f)]?.[_0x179114(0x162)]===_0x179114(0x12b)?_0x36dd24[_0x179114(0x13f)]['pkField']['split'](',')[_0x179114(0x14e)](_0x1defc6=>_0x1defc6[_0x179114(0x141)]())['filter'](Boolean):[];return _0x5efda2[_0x179114(0x15e)]>0x0&&_0x2102f8['unshift']({'type':_0x179114(0x150),'columns':_0x5efda2}),{'indexes':_0x2102f8,'metadataAvailable':_0x53fc66[_0x179114(0x15e)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3357a2,_0x4b3dc1){const _0x2f58d0=a258_0x4378,_0x24ef9a=_0x3357a2();while(!![]){try{const _0x2e8c09=parseInt(_0x2f58d0(0x174))/0x1+parseInt(_0x2f58d0(0x175))/0x2+-parseInt(_0x2f58d0(0x176))/0x3*(-parseInt(_0x2f58d0(0x17b))/0x4)+-parseInt(_0x2f58d0(0x179))/0x5+-parseInt(_0x2f58d0(0x173))/0x6*(parseInt(_0x2f58d0(0x177))/0x7)+-parseInt(_0x2f58d0(0x17c))/0x8*(-parseInt(_0x2f58d0(0x178))/0x9)+-parseInt(_0x2f58d0(0x17a))/0xa;if(_0x2e8c09===_0x4b3dc1)break;else _0x24ef9a['push'](_0x24ef9a['shift']());}catch(_0x5aa181){_0x24ef9a['push'](_0x24ef9a['shift']());}}}(a258_0x1bc6,0x78ced));import{taskStatus}from'../../commands/task/status.js';function a258_0x4378(_0x375058,_0x206c9e){_0x375058=_0x375058-0x173;const _0x1bc615=a258_0x1bc6();let _0x437831=_0x1bc615[_0x375058];return _0x437831;}export const taskDefinitions=[taskStatus];function a258_0x1bc6(){const _0x474853=['1972JLgaBp','33776cBKcSh','618XWlpSG','44550fToMno','1921932WKqWLi','2316KEoGka','64939vmDjoT','1161bEOmWB','114455xFgihx','4574990hVOUnN'];a258_0x1bc6=function(){return _0x474853;};return a258_0x1bc6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a259_0x349610=a259_0x8405;function a259_0x8405(_0x383159,_0x5baaac){_0x383159=_0x383159-0xb1;const _0x18ce68=a259_0x18ce();let _0x84056e=_0x18ce68[_0x383159];return _0x84056e;}function a259_0x18ce(){const _0x44e6f9=['191328nNrWRj','cookie','2318804GjthFy','compress','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','read','102tFUoLD','appCode','5806670eFoaoo','isTerminal','taskId','9BiAXXs','9678529FKbDLs','84988IiPcOh','6330128qJcNQg','15CAbDmn','apiError','trim','571134XDCImW','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','string','task-id','str','task'];a259_0x18ce=function(){return _0x44e6f9;};return a259_0x18ce();}(function(_0x19e401,_0x40ab39){const _0x2f71d9=a259_0x8405,_0x2ca4d2=_0x19e401();while(!![]){try{const _0x62e13=-parseInt(_0x2f71d9(0xc3))/0x1+-parseInt(_0x2f71d9(0xc5))/0x2+-parseInt(_0x2f71d9(0xb1))/0x3*(parseInt(_0x2f71d9(0xb8))/0x4)+parseInt(_0x2f71d9(0xba))/0x5*(parseInt(_0x2f71d9(0xbd))/0x6)+parseInt(_0x2f71d9(0xb7))/0x7+parseInt(_0x2f71d9(0xb9))/0x8+-parseInt(_0x2f71d9(0xb6))/0x9*(-parseInt(_0x2f71d9(0xb3))/0xa);if(_0x62e13===_0x40ab39)break;else _0x2ca4d2['push'](_0x2ca4d2['shift']());}catch(_0x1bb686){_0x2ca4d2['push'](_0x2ca4d2['shift']());}}}(a259_0x18ce,0xec16b));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a259_0x349610(0xc2),'command':'status','description':'Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','risk':a259_0x349610(0xc8),'defaultOutputFormat':a259_0x349610(0xc6),'structuredErrors':!![],'flags':[{'name':'task-id','type':a259_0x349610(0xbf),'required':!![],'description':a259_0x349610(0xbe)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1050a7){const _0x336447=a259_0x349610;if(!_0x1050a7[_0x336447(0xc1)]('task-id')['trim']())throw CliErrors['flagMissing'](_0x336447(0xc0));},async 'execute'(_0x175cdd){const _0x479e37=a259_0x349610,_0x2cdeea=_0x175cdd[_0x479e37(0xc1)]('task-id')[_0x479e37(0xbc)](),_0x17315a=normalizeAsyncTask(await getAsyncTaskStatus(_0x2cdeea,_0x175cdd['appCode'],_0x175cdd[_0x479e37(0xc4)]));if(_0x17315a[_0x479e37(0xb5)]!==_0x2cdeea)throw CliErrors[_0x479e37(0xbb)](_0x479e37(0xc7)+_0x2cdeea+',\x20received\x20'+_0x17315a[_0x479e37(0xb5)]+'.');const _0x30dd6d=buildAsyncTaskStatusCommand(_0x17315a['taskId'],_0x175cdd[_0x479e37(0xb2)]);return{'ok':!![],'message':asyncTaskMessage(_0x17315a),'data':{'appCode':_0x175cdd['appCode'],..._0x17315a,'query':_0x17315a[_0x479e37(0xb4)]?null:{'command':_0x30dd6d}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x37f863,_0x1888bd){const _0x168660=a260_0x484e,_0x1edd0d=_0x37f863();while(!![]){try{const _0x6d159e=-parseInt(_0x168660(0x197))/0x1+parseInt(_0x168660(0x19c))/0x2*(-parseInt(_0x168660(0x195))/0x3)+parseInt(_0x168660(0x19a))/0x4+parseInt(_0x168660(0x198))/0x5+-parseInt(_0x168660(0x19b))/0x6*(-parseInt(_0x168660(0x194))/0x7)+parseInt(_0x168660(0x199))/0x8*(-parseInt(_0x168660(0x196))/0x9)+-parseInt(_0x168660(0x193))/0xa*(-parseInt(_0x168660(0x19d))/0xb);if(_0x6d159e===_0x1888bd)break;else _0x1edd0d['push'](_0x1edd0d['shift']());}catch(_0x54373f){_0x1edd0d['push'](_0x1edd0d['shift']());}}}(a260_0x2c12,0x1b8a0));function a260_0x484e(_0x241202,_0xc32950){_0x241202=_0x241202-0x193;const _0x2c123e=a260_0x2c12();let _0x484ee7=_0x2c123e[_0x241202];return _0x484ee7;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];function a260_0x2c12(){const _0x2778fb=['29459IVIjtW','56495ROUMNb','104xfIVSf','796768jKzCfR','81114VktuJV','2LgqlmP','1493822KbbMnf','10ohniCS','7OqvlVm','386796TNUBcC','61353rLXILU'];a260_0x2c12=function(){return _0x2778fb;};return a260_0x2c12();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a261_0x5a57b6=a261_0x382d;function a261_0x27d7(){const _0x21359e=['length','Exact\x20tenant\x20code','24LRkREg','read','flagMissing','49027eBCRSk','\x20tenant\x20member(s)','5679ryQVSH','1346261cJfWYf','483AnAAMf','Found\x20','str','25396ucRAUF','tenant-code','2028sDtsBm','string','12050BVkppw','244TkIUIB','trim','5721fGNpgE','81300iIIIOE','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','1625430aObQqe'];a261_0x27d7=function(){return _0x21359e;};return a261_0x27d7();}(function(_0x2506dd,_0x136d31){const _0x25c617=a261_0x382d,_0x9939fd=_0x2506dd();while(!![]){try{const _0x3d0b89=-parseInt(_0x25c617(0xf7))/0x1*(-parseInt(_0x25c617(0xf5))/0x2)+parseInt(_0x25c617(0xed))/0x3*(-parseInt(_0x25c617(0xf0))/0x4)+parseInt(_0x25c617(0xf8))/0x5+parseInt(_0x25c617(0xfa))/0x6+-parseInt(_0x25c617(0xec))/0x7*(-parseInt(_0x25c617(0xfd))/0x8)+-parseInt(_0x25c617(0xeb))/0x9*(parseInt(_0x25c617(0xf4))/0xa)+parseInt(_0x25c617(0xe9))/0xb*(parseInt(_0x25c617(0xf2))/0xc);if(_0x3d0b89===_0x136d31)break;else _0x9939fd['push'](_0x9939fd['shift']());}catch(_0x4ff1e9){_0x9939fd['push'](_0x9939fd['shift']());}}}(a261_0x27d7,0x82131));function a261_0x382d(_0xc7826,_0x16d799){_0xc7826=_0xc7826-0xe8;const _0x27d731=a261_0x27d7();let _0x382d85=_0x27d731[_0xc7826];return _0x382d85;}import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':'tenant','command':'members-list','description':a261_0x5a57b6(0xf9),'risk':a261_0x5a57b6(0xfe),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a261_0x5a57b6(0xf1),'type':a261_0x5a57b6(0xf3),'required':!![],'description':a261_0x5a57b6(0xfc)}],async 'validate'(_0x2a5166){const _0x291007=a261_0x5a57b6;if(!_0x2a5166[_0x291007(0xef)]('tenant-code')[_0x291007(0xf6)]())throw CliErrors[_0x291007(0xe8)](_0x291007(0xf1),'Pass\x20--tenant-code\x20<code>.');},async 'execute'(_0x2bb0df){const _0x15dc0c=a261_0x5a57b6,_0x1e32bc=_0x2bb0df[_0x15dc0c(0xef)](_0x15dc0c(0xf1))[_0x15dc0c(0xf6)](),_0x4b777e=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x1e32bc,_0x4b777e);const _0x39dca1=projectTenantMembers(await listTenantDirectoryMembers(_0x1e32bc));return{'ok':!![],'data':{'tenantCode':_0x1e32bc,'items':_0x39dca1,'totalCount':_0x39dca1[_0x15dc0c(0xfb)]},'message':_0x15dc0c(0xee)+_0x39dca1[_0x15dc0c(0xfb)]+_0x15dc0c(0xea)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x48bdf1,_0xce4956){const _0x1577af=a262_0x227d,_0x10ef82=_0x48bdf1();while(!![]){try{const _0x469dd8=-parseInt(_0x1577af(0x9d))/0x1+parseInt(_0x1577af(0xb4))/0x2*(parseInt(_0x1577af(0xb8))/0x3)+parseInt(_0x1577af(0xa1))/0x4*(-parseInt(_0x1577af(0xb7))/0x5)+parseInt(_0x1577af(0xba))/0x6*(-parseInt(_0x1577af(0x9e))/0x7)+-parseInt(_0x1577af(0xa7))/0x8*(parseInt(_0x1577af(0xa4))/0x9)+-parseInt(_0x1577af(0x9f))/0xa+parseInt(_0x1577af(0xa6))/0xb;if(_0x469dd8===_0xce4956)break;else _0x10ef82['push'](_0x10ef82['shift']());}catch(_0x5754ae){_0x10ef82['push'](_0x10ef82['shift']());}}}(a262_0x3487,0x496c0));import{CliErrors}from'../../errors.js';function textOrNull(_0x2ede82){const _0x2726c5=a262_0x227d,_0x12debf=_0x2ede82?.[_0x2726c5(0xa0)]();return _0x12debf?_0x12debf:null;}export function projectTenantMembers(_0x23327a){const _0x3eed8c=a262_0x227d,_0x4df227=new Map();for(const _0x8e9c2f of _0x23327a){const _0x358ab4=Number(_0x8e9c2f[_0x3eed8c(0xae)]);if(!Number[_0x3eed8c(0xb3)](_0x358ab4)||_0x358ab4<=0x0)continue;const _0x63660d={'userId':_0x358ab4,'username':textOrNull(_0x8e9c2f[_0x3eed8c(0xa3)]),'displayName':textOrNull(_0x8e9c2f[_0x3eed8c(0xa8)]),'role':_0x8e9c2f[_0x3eed8c(0xb2)]===!![]?_0x3eed8c(0xab):_0x3eed8c(0xb1),'status':textOrNull(_0x8e9c2f[_0x3eed8c(0xa5)])},_0x120dd3=_0x4df227[_0x3eed8c(0xa2)](_0x358ab4);if(!_0x120dd3){_0x4df227[_0x3eed8c(0xb5)](_0x358ab4,_0x63660d);continue;}_0x120dd3[_0x3eed8c(0xa3)]??=_0x63660d[_0x3eed8c(0xa3)],_0x120dd3[_0x3eed8c(0xaa)]??=_0x63660d[_0x3eed8c(0xaa)],_0x120dd3['status']??=_0x63660d['status'];if(_0x63660d['role']===_0x3eed8c(0xab))_0x120dd3[_0x3eed8c(0xb6)]=_0x3eed8c(0xab);}return[..._0x4df227[_0x3eed8c(0xac)]()][_0x3eed8c(0xad)]((_0x1abd31,_0x2f188c)=>_0x1abd31['userId']-_0x2f188c[_0x3eed8c(0xae)]);}function a262_0x227d(_0x38dfdf,_0x2b82e9){_0x38dfdf=_0x38dfdf-0x9d;const _0x348770=a262_0x3487();let _0x227dab=_0x348770[_0x38dfdf];return _0x227dab;}export function assertTenantAccessible(_0x505928,_0x5d9c50){const _0x29aa66=a262_0x227d;if(_0x5d9c50['some'](_0x52a95a=>_0x52a95a[_0x29aa66(0xa9)]===_0x505928))return;throw CliErrors[_0x29aa66(0xaf)](_0x29aa66(0xb9)+_0x505928+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x29aa66(0xb0));}function a262_0x3487(){const _0xe011fe=['userId','validation','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','MEMBER','adminFlag','isFinite','2822GBPUwm','set','role','5tkBoQr','741CgVxNe','Tenant\x20\x22','60SaCevr','176411LRLDEe','238077MbKaCq','5724080tMLKTG','trim','259756EtdxuD','get','username','25227FLJfGm','status','14510265hkXLGI','608mSWZzo','nickname','tenantCode','displayName','ADMIN','values','sort'];a262_0x3487=function(){return _0xe011fe;};return a262_0x3487();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a263_0x8e4bfa=a263_0x1420;function a263_0xdbab(){const _0x37fbdb=['2192fbtxaj','string','ding-talk-user-id','13279QDKfnx','352745tHwpDb','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','313638bYVtMG','30fGzpdT','write','10xFJjjm','validation','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','dingtalk','bind','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','str','8010fanWPf','7788UAUAWm','dingding-sandbox-bind','7371RdeDCk','apiError','21372iStYiY','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','POST','582545hFIKvK','--ding-talk-user-id\x20cannot\x20be\x20empty.','614732wUWwEr','user-account','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox'];a263_0xdbab=function(){return _0x37fbdb;};return a263_0xdbab();}(function(_0x5a3e03,_0x15e9c1){const _0x490fba=a263_0x1420,_0x282b61=_0x5a3e03();while(!![]){try{const _0x508a99=-parseInt(_0x490fba(0x1df))/0x1+parseInt(_0x490fba(0x1ed))/0x2*(parseInt(_0x490fba(0x1ea))/0x3)+parseInt(_0x490fba(0x1e1))/0x4+-parseInt(_0x490fba(0x1e8))/0x5*(-parseInt(_0x490fba(0x1eb))/0x6)+-parseInt(_0x490fba(0x1e7))/0x7*(-parseInt(_0x490fba(0x1e4))/0x8)+-parseInt(_0x490fba(0x1da))/0x9*(-parseInt(_0x490fba(0x1d7))/0xa)+parseInt(_0x490fba(0x1d8))/0xb*(-parseInt(_0x490fba(0x1dc))/0xc);if(_0x508a99===_0x15e9c1)break;else _0x282b61['push'](_0x282b61['shift']());}catch(_0xa6f4b){_0x282b61['push'](_0x282b61['shift']());}}}(a263_0xdbab,0x583f6));import{asDryRunResult}from'../../commands/common/dry-run.js';function a263_0x1420(_0xf87d21,_0x451e74){_0xf87d21=_0xf87d21-0x1d2;const _0xdbaba9=a263_0xdbab();let _0x142024=_0xdbaba9[_0xf87d21];return _0x142024;}import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a263_0x8e4bfa(0x1d3),CURRENT_BINDING_WARNING='The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.';function readDingTalkUserId(_0x2ced2a){const _0x1de919=a263_0x8e4bfa,_0x5400b7=_0x2ced2a[_0x1de919(0x1d6)](_0x1de919(0x1e6))['trim']();if(!_0x5400b7)throw CliErrors[_0x1de919(0x1ee)](_0x1de919(0x1e0),_0x1de919(0x1e9));return _0x5400b7;}function buildBindingData(_0x47e3a2,_0x71df05){const _0xf62bb5=a263_0x8e4bfa;return{'operation':_0xf62bb5(0x1d4),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x47e3a2},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x47e3a2,'bound':!![]},'dryRun':_0x71df05,'backend':{'method':'POST','path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a263_0x8e4bfa(0x1e2),'command':a263_0x8e4bfa(0x1d9),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':a263_0x8e4bfa(0x1ec),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a263_0x8e4bfa(0x1e6),'type':a263_0x8e4bfa(0x1e5),'required':!![],'description':a263_0x8e4bfa(0x1e3)}],async 'validate'(_0x29e110){readDingTalkUserId(_0x29e110);},async 'dryRun'(_0x4e43f1){const _0x1e0df5=a263_0x8e4bfa,_0x5621ba=readDingTalkUserId(_0x4e43f1);return asDryRunResult(buildBindingData(_0x5621ba,!![]),{'method':_0x1e0df5(0x1de),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x534352){const _0x2f5d4c=a263_0x8e4bfa,_0x5f28d7=readDingTalkUserId(_0x534352),_0x35babc=await bindDingTalkSandboxAccount(_0x5f28d7);if(_0x35babc!==!![])throw CliErrors[_0x2f5d4c(0x1db)](_0x2f5d4c(0x1d5),_0x2f5d4c(0x1d2));return{'ok':!![],'data':buildBindingData(_0x5f28d7,![]),'message':_0x2f5d4c(0x1dd)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a264_0x3b993d=a264_0x54f5;function a264_0x54f5(_0x52485d,_0x290fd2){_0x52485d=_0x52485d-0x1e2;const _0x3a7cab=a264_0x3a7c();let _0x54f5c1=_0x3a7cab[_0x52485d];return _0x54f5c1;}(function(_0x45b602,_0x2e045c){const _0x514f4f=a264_0x54f5,_0xa07948=_0x45b602();while(!![]){try{const _0x1e2c9e=-parseInt(_0x514f4f(0x1eb))/0x1+parseInt(_0x514f4f(0x1e7))/0x2*(-parseInt(_0x514f4f(0x1e3))/0x3)+parseInt(_0x514f4f(0x1e9))/0x4+parseInt(_0x514f4f(0x1f9))/0x5*(-parseInt(_0x514f4f(0x1fa))/0x6)+parseInt(_0x514f4f(0x1e8))/0x7*(parseInt(_0x514f4f(0x1ea))/0x8)+-parseInt(_0x514f4f(0x1e4))/0x9*(-parseInt(_0x514f4f(0x1e6))/0xa)+parseInt(_0x514f4f(0x1f1))/0xb;if(_0x1e2c9e===_0x2e045c)break;else _0xa07948['push'](_0xa07948['shift']());}catch(_0x459b83){_0xa07948['push'](_0xa07948['shift']());}}}(a264_0x3a7c,0x6504f));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindFeishuAccount,FEISHU_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a264_0x3b993d(0x1f4),CURRENT_BINDING_WARNING=a264_0x3b993d(0x1f7);function readUnionId(_0x59519a){const _0x2beed2=a264_0x3b993d,_0x3d5268=_0x59519a[_0x2beed2(0x1f5)](_0x2beed2(0x1f8))['trim']();if(!/^on_[A-Za-z0-9_-]+$/[_0x2beed2(0x1e5)](_0x3d5268))throw CliErrors[_0x2beed2(0x1ed)](_0x2beed2(0x1f2),_0x2beed2(0x1ef));return _0x3d5268;}function a264_0x3a7c(){const _0x1bf8c1=['307413ZkvANI','test','190PVXrMg','761386rghYmf','35hPyCeo','1935744uzKmlO','341976bTzLjb','754222RgdLVU','string','validation','write','Pass\x20a\x20Feishu\x20union\x20id\x20such\x20as\x20on_example_001.','POST','4497031QBLRXT','--union-id\x20must\x20match\x20on_\x20followed\x20by\x20letters,\x20digits,\x20underscores,\x20or\x20hyphens.','bind','feishu','str','user-account','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','union-id','25eQllud','248142arWkLM','feishu-bind','Feishu\x20account\x20binding\x20was\x20not\x20confirmed.','3oqdmXz'];a264_0x3a7c=function(){return _0x1bf8c1;};return a264_0x3a7c();}function buildBindingData(_0x3f6456,_0x41a905){const _0xa503c2=a264_0x3b993d;return{'operation':_0xa503c2(0x1f3),'selector':{'providerId':PROVIDER_ID,'unionId':_0x3f6456},'before':null,'after':{'providerId':PROVIDER_ID,'unionId':_0x3f6456,'bound':!![]},'dryRun':_0x41a905,'backend':{'method':_0xa503c2(0x1f0),'path':FEISHU_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const feishuBind={'service':a264_0x3b993d(0x1f6),'command':a264_0x3b993d(0x1fb),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20Feishu\x20account','risk':a264_0x3b993d(0x1ee),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a264_0x3b993d(0x1f8),'type':a264_0x3b993d(0x1ec),'required':!![],'description':'Feishu\x20union_id\x20for\x20the\x20configured\x20Feishu\x20application\x20developer'}],async 'validate'(_0x320f40){readUnionId(_0x320f40);},async 'dryRun'(_0x220313){const _0x389a77=a264_0x3b993d,_0x28bc47=readUnionId(_0x220313);return asDryRunResult(buildBindingData(_0x28bc47,!![]),{'method':_0x389a77(0x1f0),'url':FEISHU_BIND_PATH});},async 'execute'(_0x140edd){const _0x5c8933=a264_0x3b993d,_0xee238d=readUnionId(_0x140edd),_0xe1bc3e=await bindFeishuAccount(_0xee238d);if(_0xe1bc3e!==!![])throw CliErrors['apiError'](_0x5c8933(0x1e2),'Verify\x20the\x20current\x20binding\x20through\x20the\x20platform\x20before\x20explicitly\x20retrying;\x20do\x20not\x20automatically\x20retry.');return{'ok':!![],'data':buildBindingData(_0xee238d,![]),'message':'Bound\x20current\x20user\x20to\x20Feishu\x20account.'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a265_0x5a4c(_0x439b31,_0x153917){_0x439b31=_0x439b31-0x84;const _0x2e5e77=a265_0x2e5e();let _0x5a4c9c=_0x2e5e77[_0x439b31];return _0x5a4c9c;}(function(_0x5ed4de,_0x5be593){const _0x359c60=a265_0x5a4c,_0x582eee=_0x5ed4de();while(!![]){try{const _0xc51f1f=-parseInt(_0x359c60(0x87))/0x1*(parseInt(_0x359c60(0x8e))/0x2)+parseInt(_0x359c60(0x88))/0x3*(-parseInt(_0x359c60(0x89))/0x4)+-parseInt(_0x359c60(0x8a))/0x5*(-parseInt(_0x359c60(0x86))/0x6)+-parseInt(_0x359c60(0x85))/0x7*(parseInt(_0x359c60(0x8d))/0x8)+-parseInt(_0x359c60(0x84))/0x9+parseInt(_0x359c60(0x8c))/0xa*(-parseInt(_0x359c60(0x8b))/0xb)+parseInt(_0x359c60(0x8f))/0xc;if(_0xc51f1f===_0x5be593)break;else _0x582eee['push'](_0x582eee['shift']());}catch(_0x25ad38){_0x582eee['push'](_0x582eee['shift']());}}}(a265_0x2e5e,0x93fa4));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';function a265_0x2e5e(){const _0x2778e8=['2391768KzXjtU','234094JuqNPQ','78YPpYbS','1dXPYTg','279HgjQaE','18908gkYOEY','194470CjtQGz','22qHIuZi','2830230EqQMNo','152KgiBHR','1545842IgAodz','33362664gtOdMy'];a265_0x2e5e=function(){return _0x2778e8;};return a265_0x2e5e();}import{feishuBind}from'../../commands/user-account/feishu-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind,feishuBind];
|