@lovrabet/rabetbase-cli 2.5.3-beta.1 → 2.5.3-beta.3
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.d.ts +22 -0
- package/lib/api/api-group.js +1 -0
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.d.ts +18 -2
- 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.d.ts +11 -0
- package/lib/api/legacy-api-file.js +1 -0
- package/lib/api/model-registry-file.d.ts +36 -0
- package/lib/api/model-registry-file.js +1 -0
- package/lib/api/model-registry-scaffold.d.ts +7 -0
- package/lib/api/model-registry-scaffold.js +1 -0
- package/lib/api/model-source.d.ts +6 -0
- package/lib/api/model-source.js +1 -0
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.d.ts +7 -0
- package/lib/commands/bff/logs.js +1 -0
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.d.ts +7 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/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.d.ts +21 -0
- package/lib/commands/dataset/batch-design.js +1 -0
- 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.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-create.js +1 -0
- package/lib/commands/dataset/cross-relation-delete.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-delete.js +1 -0
- package/lib/commands/dataset/cross-relation-list.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-list.js +1 -0
- package/lib/commands/dataset/cross-relation-shared.d.ts +190 -0
- package/lib/commands/dataset/cross-relation-shared.js +1 -0
- package/lib/commands/dataset/cross-relation-update.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-update.js +1 -0
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-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/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.d.ts +2 -0
- package/lib/commands/flow/create.js +1 -0
- package/lib/commands/flow/detail.d.ts +2 -0
- package/lib/commands/flow/detail.js +1 -0
- package/lib/commands/flow/index.d.ts +3 -0
- package/lib/commands/flow/index.js +1 -0
- package/lib/commands/flow/list.d.ts +2 -0
- package/lib/commands/flow/list.js +1 -0
- package/lib/commands/flow/publish.d.ts +2 -0
- package/lib/commands/flow/publish.js +1 -0
- package/lib/commands/flow/runtime-resources-shared.d.ts +40 -0
- package/lib/commands/flow/runtime-resources-shared.js +1 -0
- package/lib/commands/flow/runtime-role-list.d.ts +2 -0
- package/lib/commands/flow/runtime-role-list.js +1 -0
- package/lib/commands/flow/runtime-role-user-list.d.ts +2 -0
- package/lib/commands/flow/runtime-role-user-list.js +1 -0
- package/lib/commands/flow/runtime-user-search.d.ts +2 -0
- package/lib/commands/flow/runtime-user-search.js +1 -0
- package/lib/commands/flow/shared.d.ts +41 -0
- package/lib/commands/flow/shared.js +1 -0
- package/lib/commands/flow/update.d.ts +2 -0
- package/lib/commands/flow/update.js +1 -0
- package/lib/commands/flow/validate.d.ts +3 -0
- package/lib/commands/flow/validate.js +1 -0
- 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/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/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.d.ts +28 -0
- package/lib/commands/project/api-architecture-upgrade.js +1 -0
- 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.d.ts +30 -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/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.d.ts +2 -0
- 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.d.ts +2 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.d.ts +13 -17
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +176 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.d.ts +55 -0
- package/lib/core/bff/hook-directory.js +1 -0
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/types.d.ts +15 -0
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.d.ts +41 -0
- package/lib/core/cross-db-relation.js +1 -0
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.d.ts +628 -0
- package/lib/core/flow-config.js +1 -0
- 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.d.ts +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/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.d.ts +0 -10
- 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/types/index.d.ts +11 -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.d.ts +12 -0
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +4 -1
- package/skills/rabetbase/SKILL.md +31 -9
- package/skills/rabetbase/guides/approval-flow-development-workflow.md +137 -0
- package/skills/rabetbase/guides/backend-function.md +19 -9
- package/skills/rabetbase/guides/bff-creation-workflow.md +10 -1
- package/skills/rabetbase/guides/conflict-detection.md +2 -0
- package/skills/rabetbase/guides/sdk-client-generation.md +112 -60
- package/skills/rabetbase/guides/typescript-sdk.md +9 -0
- package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +290 -0
- package/skills/rabetbase/references/rabetbase-api-pull.md +30 -19
- package/skills/rabetbase/references/rabetbase-app-list.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-create.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-logs.md +47 -0
- package/skills/rabetbase/references/rabetbase-bff-pull.md +7 -3
- package/skills/rabetbase/references/rabetbase-bff-push.md +10 -2
- package/skills/rabetbase/references/rabetbase-config.md +2 -1
- package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +60 -0
- package/skills/rabetbase/references/rabetbase-dataset-generate.md +52 -2
- package/skills/rabetbase/references/rabetbase-flow-commands.md +86 -0
- package/skills/rabetbase/references/rabetbase-flow-resources.md +83 -0
- package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +25 -0
- package/skills/rabetbase/references/rabetbase-instant-api-policy.md +103 -11
- package/skills/rabetbase/references/rabetbase-notification-config-list.md +17 -0
- package/skills/rabetbase/references/rabetbase-project-create.md +3 -3
- package/skills/rabetbase/references/rabetbase-project-upgrade.md +24 -13
- package/skills/rabetbase.manifest.json +10 -3
- package/templates/README.md +16 -4
- package/templates/generate-api/model-runtime.ts.tpl +101 -0
- package/templates/generate-api/profile-api.ts.tpl +21 -0
- package/templates/generate-api/profile-client.ts.tpl +14 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a232_0x5294ac=a232_0x49d1;(function(_0x46b079,_0xf102de){const _0x418da9=a232_0x49d1,_0x7b1131=_0x46b079();while(!![]){try{const _0x2a7b64=parseInt(_0x418da9(0xd1))/0x1*(parseInt(_0x418da9(0xe4))/0x2)+parseInt(_0x418da9(0xdd))/0x3+parseInt(_0x418da9(0xd2))/0x4*(parseInt(_0x418da9(0xed))/0x5)+parseInt(_0x418da9(0xcb))/0x6*(-parseInt(_0x418da9(0xce))/0x7)+parseInt(_0x418da9(0xd5))/0x8+parseInt(_0x418da9(0xe6))/0x9+parseInt(_0x418da9(0xdc))/0xa*(-parseInt(_0x418da9(0xe5))/0xb);if(_0x2a7b64===_0xf102de)break;else _0x7b1131['push'](_0x7b1131['shift']());}catch(_0x16810f){_0x7b1131['push'](_0x7b1131['shift']());}}}(a232_0x453e,0x50974));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a232_0x49d1(_0xcf53f4,_0x161ffe){_0xcf53f4=_0xcf53f4-0xca;const _0x453e19=a232_0x453e();let _0x49d16f=_0x453e19[_0xcf53f4];return _0x49d16f;}export const sqlDelete={'service':a232_0x5294ac(0xd4),'command':a232_0x5294ac(0xdb),'description':a232_0x5294ac(0xea),'risk':a232_0x5294ac(0xd8),'flags':[SQLCODE_FLAG],async 'validate'(_0x2e6ed4){const _0x422b29=a232_0x5294ac,_0x23cb75=loadSqlProjectConfig(_0x2e6ed4[_0x422b29(0xcf)]),_0x237947=await readSqlLockFile(_0x23cb75[_0x422b29(0xe9)]);if(!_0x237947)throw CliErrors[_0x422b29(0xe0)](_0x422b29(0xe2));},async 'dryRun'(_0x59a007){const _0x3d11db=a232_0x5294ac,_0x9c291a=loadSqlProjectConfig(_0x59a007[_0x3d11db(0xcf)]),_0x450ecd=await readSqlLockFile(_0x9c291a[_0x3d11db(0xe9)]);if(!_0x450ecd)throw CliErrors[_0x3d11db(0xe0)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x1747ee}=ensureSqlLockScope(_0x450ecd,_0x59a007[_0x3d11db(0xcf)],_0x9c291a[_0x3d11db(0xda)],_0x3d11db(0xdb)),_0xeb4fb5=_0x59a007['str'](_0x3d11db(0xd6)),_0x153bf2=_0x1747ee[_0x3d11db(0xca)][_0xeb4fb5];if(!_0x153bf2)throw CliErrors['validation'](_0x3d11db(0xd3)+_0xeb4fb5+'\x22.');return{'method':_0x3d11db(0xd0),'url':_0x3d11db(0xe8),'body':{'sqlCode':_0xeb4fb5,'id':_0x153bf2[_0x3d11db(0xdf)],'localPath':resolveLocalSqlFilePath(_0x9c291a,_0xeb4fb5,_0x153bf2)},'description':_0x3d11db(0xeb)+_0xeb4fb5+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x9c291a[_0x3d11db(0xe7)]};},async 'execute'(_0x117c7b){const _0x5b4ebd=a232_0x5294ac,_0x50b561=loadSqlProjectConfig(_0x117c7b['appCode']),_0x4e8df5=await readSqlLockFile(_0x50b561[_0x5b4ebd(0xe9)]);if(!_0x4e8df5)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x148012,appLock:_0x24ff87}=ensureSqlLockScope(_0x4e8df5,_0x117c7b[_0x5b4ebd(0xcf)],_0x50b561[_0x5b4ebd(0xda)],_0x5b4ebd(0xdb)),_0xfcf1e8=_0x117c7b[_0x5b4ebd(0xd7)](_0x5b4ebd(0xd6)),_0x238b1a=_0x24ff87[_0x5b4ebd(0xca)][_0xfcf1e8];if(!_0x238b1a)throw CliErrors[_0x5b4ebd(0xe0)](_0x5b4ebd(0xd3)+_0xfcf1e8+'\x22.');await deleteSqlQuery({'id':_0x238b1a[_0x5b4ebd(0xdf)],'sqlCode':_0xfcf1e8}),_0x24ff87[_0x5b4ebd(0xca)]=Object['fromEntries'](Object['entries'](_0x24ff87[_0x5b4ebd(0xca)])['filter'](([_0x2b1b5c])=>_0x2b1b5c!==_0xfcf1e8)),_0x24ff87[_0x5b4ebd(0xe3)]=new Date()[_0x5b4ebd(0xec)](),await writeSqlLockFile(_0x50b561[_0x5b4ebd(0xe9)],_0x148012);const _0x14ee4b=resolveLocalSqlFilePath(_0x50b561,_0xfcf1e8,_0x238b1a);let _0x35d0a6;await fileExists(_0x14ee4b)&&(_0x35d0a6=await moveToTrash(_0x50b561[_0x5b4ebd(0xde)],_0x50b561[_0x5b4ebd(0xe7)],_0x14ee4b),await cleanupEmptyDirectories(dirname(_0x14ee4b),_0x50b561['sqlRootDir']));const _0x10d9a6={'deleted':_0xfcf1e8,'remoteId':_0x238b1a[_0x5b4ebd(0xdf)]};if(_0x35d0a6)_0x10d9a6[_0x5b4ebd(0xcc)]=_0x35d0a6;return{'ok':!![],'data':_0x10d9a6,'message':'Deleted\x20'+_0xfcf1e8+(_0x35d0a6?_0x5b4ebd(0xd9):'')};}};function a232_0x453e(){const _0x4d6e35=['sql','1597288EZyAZj','sqlcode','str','high-risk-write','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRoot','delete','430Qrsnqa','1666845DWiIFp','projectRoot','remoteId','validation','replace','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','lastSync','759028gescnF','381458smIGrs','3643731vXYuIG','trashDir','/smartapi/custom/deleteUserCustomSql','lockFilePath','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','Would\x20delete\x20SQL\x20','toISOString','295nAFHSu','sqls','96ZCvKYn','trashedTo','startsWith','30821HfJscT','appCode','POST','1XkGRXT','23868dNeEoN','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'];a232_0x453e=function(){return _0x4d6e35;};return a232_0x453e();}async function moveToTrash(_0x53a9c3,_0x4008d9,_0xf09484){const _0x284df8=a232_0x5294ac,_0x275ef8=new Date()['toISOString']()[_0x284df8(0xe1)](/[:.]/g,'-'),_0x139899=relative(_0x53a9c3,_0xf09484),_0x3ef168=join(_0x4008d9,_0x275ef8,_0x139899);return await mkdir(dirname(_0x3ef168),{'recursive':!![]}),await rename(_0xf09484,_0x3ef168),_0x3ef168;}async function cleanupEmptyDirectories(_0x2c8a70,_0xb82aa6){const _0x151e1d=a232_0x5294ac;let _0x16950a=resolve(_0x2c8a70);const _0x5e72a3=resolve(_0xb82aa6);while(_0x16950a[_0x151e1d(0xcd)](''+_0x5e72a3+sep)||_0x16950a===_0x5e72a3){if(_0x16950a===_0x5e72a3)return;try{const _0x2c78f3=await readdir(_0x16950a);if(_0x2c78f3['length']>0x0)return;await rmdir(_0x16950a);}catch{return;}_0x16950a=dirname(_0x16950a);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a233_0x33ee(_0x2fa7a7,_0x9f1c6a){_0x2fa7a7=_0x2fa7a7-0x1c0;const _0xcbf016=a233_0xcbf0();let _0x33ee1f=_0xcbf016[_0x2fa7a7];return _0x33ee1f;}const a233_0x305f4d=a233_0x33ee;(function(_0x5e4cec,_0x27501e){const _0x48b954=a233_0x33ee,_0x3d8463=_0x5e4cec();while(!![]){try{const _0x4b4697=-parseInt(_0x48b954(0x1d7))/0x1*(parseInt(_0x48b954(0x1c5))/0x2)+-parseInt(_0x48b954(0x1d5))/0x3+parseInt(_0x48b954(0x1c6))/0x4+-parseInt(_0x48b954(0x1c8))/0x5*(parseInt(_0x48b954(0x1c9))/0x6)+parseInt(_0x48b954(0x1d8))/0x7*(-parseInt(_0x48b954(0x1d3))/0x8)+-parseInt(_0x48b954(0x1c3))/0x9*(-parseInt(_0x48b954(0x1d0))/0xa)+parseInt(_0x48b954(0x1cc))/0xb*(parseInt(_0x48b954(0x1ca))/0xc);if(_0x4b4697===_0x27501e)break;else _0x3d8463['push'](_0x3d8463['shift']());}catch(_0x49e8f2){_0x3d8463['push'](_0x3d8463['shift']());}}}(a233_0xcbf0,0xc53fd));function a233_0xcbf0(){const _0x4446d0=['appCode','145023EFzreX','154khAzzk','detail','boolean','read','198ZcJUvl','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','6MGiMwh','6140092pXxEVk','bool','505cFcLXl','40026KklFfy','18144SRMSYd','sqlContent','14817BbRCvl','sql','sqlName','dbId','484790BoaeRL','verbose','str','584032cfUZeu','sqlcode','3346092iPPLIb'];a233_0xcbf0=function(){return _0x4446d0;};return a233_0xcbf0();}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a233_0x305f4d(0x1cd),'command':a233_0x305f4d(0x1c0),'description':a233_0x305f4d(0x1c4),'risk':a233_0x305f4d(0x1c2),'flags':[SQLCODE_FLAG,{'name':a233_0x305f4d(0x1d1),'type':a233_0x305f4d(0x1c1),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x274e0f){const _0x13653c=a233_0x305f4d,_0x37a2e7=await getSqlQueryInfo(_0x274e0f[_0x13653c(0x1d6)],_0x274e0f[_0x13653c(0x1d2)](_0x13653c(0x1d4))),_0x453c9=_0x274e0f[_0x13653c(0x1c7)]('verbose');if(_0x453c9)return{'ok':!![],'data':_0x37a2e7};const _0x1fb6f5=_0x37a2e7[_0x13653c(0x1cf)]?await getDbName(_0x274e0f[_0x13653c(0x1d6)],_0x37a2e7[_0x13653c(0x1cf)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x37a2e7['sqlCode'],'sqlName':_0x37a2e7[_0x13653c(0x1ce)],'db':_0x1fb6f5?_0x1fb6f5+'\x20('+_0x37a2e7[_0x13653c(0x1cf)]+')':_0x37a2e7[_0x13653c(0x1cf)]??'','description':_0x37a2e7['description']??'','sqlContent':_0x37a2e7[_0x13653c(0x1cb)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a234_0x4a6367=a234_0x40da;(function(_0x1951af,_0x5e95d5){const _0x237391=a234_0x40da,_0x1322a9=_0x1951af();while(!![]){try{const _0x2912ef=parseInt(_0x237391(0x14f))/0x1*(parseInt(_0x237391(0x15a))/0x2)+parseInt(_0x237391(0x146))/0x3*(parseInt(_0x237391(0x14c))/0x4)+parseInt(_0x237391(0x151))/0x5*(parseInt(_0x237391(0x15b))/0x6)+-parseInt(_0x237391(0x144))/0x7+parseInt(_0x237391(0x15d))/0x8*(-parseInt(_0x237391(0x159))/0x9)+parseInt(_0x237391(0x148))/0xa+parseInt(_0x237391(0x152))/0xb*(-parseInt(_0x237391(0x149))/0xc);if(_0x2912ef===_0x5e95d5)break;else _0x1322a9['push'](_0x1322a9['shift']());}catch(_0x236061){_0x1322a9['push'](_0x1322a9['shift']());}}}(a234_0x3d9d,0x64500));import{executeSql}from'../../core/api-client.js';function a234_0x3d9d(){const _0x15ef60=['3614513qoHbXx','Returned\x20','24eaPqGG','sqlcode','7723330qivAaU','36VYnqKg','length','string','143516zWWoDm','execError','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','7508kyaMPd','SQL\x20execution\x20failed','5jijcRR','561473zZGLQU','execResult','exec','sql','isArray','now','\x20row(s)\x20in\x20','85194ZHYVso','34krbQrA','893694GxaebT','read','216FIEBQW','appCode','str','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'];a234_0x3d9d=function(){return _0x15ef60;};return a234_0x3d9d();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a234_0x40da(_0x7e2e94,_0x329632){_0x7e2e94=_0x7e2e94-0x143;const _0x3d9dee=a234_0x3d9d();let _0x40dad0=_0x3d9dee[_0x7e2e94];return _0x40dad0;}export const sqlExec={'service':a234_0x4a6367(0x155),'command':a234_0x4a6367(0x154),'description':a234_0x4a6367(0x14e),'risk':a234_0x4a6367(0x15c),'flags':[SQLCODE_FLAG,{'name':'params','type':a234_0x4a6367(0x14b),'description':a234_0x4a6367(0x143)}],async 'execute'(_0x584768){const _0x1dea58=a234_0x4a6367,_0x1619ac=parseJsonParams(_0x584768['str']('params')),_0x1c2481=Date['now'](),_0x2eb364=await executeSql(_0x584768[_0x1dea58(0x15e)],_0x584768[_0x1dea58(0x15f)](_0x1dea58(0x147)),_0x1619ac),_0x12220b=Date[_0x1dea58(0x157)]()-_0x1c2481,_0x2864f3=_0x2eb364?.[_0x1dea58(0x153)]??_0x2eb364,_0x560b25=_0x2eb364?.['execSuccess']??!![];if(!_0x560b25)return{'ok':![],'data':{'error':_0x2eb364?.[_0x1dea58(0x14d)]||_0x1dea58(0x150),'elapsed':_0x12220b},'message':'SQL\x20execution\x20failed'};const _0x570410=Array[_0x1dea58(0x156)](_0x2864f3)?_0x2864f3:[];return{'ok':!![],'data':{'rows':_0x570410,'rowCount':_0x570410[_0x1dea58(0x14a)],'elapsed':_0x12220b},'message':_0x1dea58(0x145)+_0x570410[_0x1dea58(0x14a)]+_0x1dea58(0x158)+_0x12220b+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xa88827,_0x10e5a6){const _0x5be6ba=a235_0x13de,_0x1643c0=_0xa88827();while(!![]){try{const _0x4de9ab=-parseInt(_0x5be6ba(0x1df))/0x1*(-parseInt(_0x5be6ba(0x1dc))/0x2)+-parseInt(_0x5be6ba(0x1de))/0x3*(-parseInt(_0x5be6ba(0x1da))/0x4)+parseInt(_0x5be6ba(0x1dd))/0x5+-parseInt(_0x5be6ba(0x1d7))/0x6+parseInt(_0x5be6ba(0x1d8))/0x7*(-parseInt(_0x5be6ba(0x1d9))/0x8)+parseInt(_0x5be6ba(0x1d6))/0x9+-parseInt(_0x5be6ba(0x1db))/0xa*(parseInt(_0x5be6ba(0x1e0))/0xb);if(_0x4de9ab===_0x10e5a6)break;else _0x1643c0['push'](_0x1643c0['shift']());}catch(_0xa4d7ea){_0x1643c0['push'](_0x1643c0['shift']());}}}(a235_0x55f4,0xb1df1));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a235_0x13de(_0x4fc562,_0xa903e6){_0x4fc562=_0x4fc562-0x1d6;const _0x55f40e=a235_0x55f4();let _0x13de84=_0x55f40e[_0x4fc562];return _0x13de84;}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';function a235_0x55f4(){const _0x19a016=['778852SuXUTa','10gzsAsa','431254AaKwRU','4631630omVdod','15GLhJdG','1rWcHjm','4334429lGrUQJ','3888441jqaKzr','8444478fxkpkG','122878akOxsW','8LpqXPo'];a235_0x55f4=function(){return _0x19a016;};return a235_0x55f4();}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
|
-
|
|
1
|
+
const a236_0x699c04=a236_0x9815;(function(_0x168635,_0x169a42){const _0xb2a285=a236_0x9815,_0x247eb1=_0x168635();while(!![]){try{const _0x5a546d=parseInt(_0xb2a285(0x8b))/0x1+parseInt(_0xb2a285(0x7e))/0x2*(parseInt(_0xb2a285(0x88))/0x3)+parseInt(_0xb2a285(0x77))/0x4+parseInt(_0xb2a285(0x7d))/0x5*(parseInt(_0xb2a285(0x8d))/0x6)+parseInt(_0xb2a285(0x78))/0x7+parseInt(_0xb2a285(0x91))/0x8*(parseInt(_0xb2a285(0x8c))/0x9)+-parseInt(_0xb2a285(0x8f))/0xa;if(_0x5a546d===_0x169a42)break;else _0x247eb1['push'](_0x247eb1['shift']());}catch(_0x3aec1b){_0x247eb1['push'](_0x247eb1['shift']());}}}(a236_0x3ab3,0xcae27));function a236_0x9815(_0x468881,_0x14028f){_0x468881=_0x468881-0x71;const _0x3ab37c=a236_0x3ab3();let _0x981530=_0x3ab37c[_0x468881];return _0x981530;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a236_0x3ab3(){const _0x166ade=['3gVekqy','boolean','\x20SQL\x20queries\x20(total:\x20','212943OOcSMX','423zJsIGx','341196xSHiNu','appCode','34872210kltbHK','No\x20custom\x20SQL\x20queries\x20found.','69784RzeSNx','Filter\x20by\x20SQL\x20name','pagesize','sqlCode','verbose','length','name','num','sqlName','list','sql','2978932ShKPOe','7501438XYdCea','read','all','str','string','35fctpRg','2961766PHZBfX','paging','page','description','map','dbId','Found\x20','number','List\x20custom\x20SQL\x20queries','tableData'];a236_0x3ab3=function(){return _0x166ade;};return a236_0x3ab3();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a236_0x699c04(0x76),'command':a236_0x699c04(0x75),'description':a236_0x699c04(0x86),'risk':a236_0x699c04(0x79),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a236_0x699c04(0x72),'type':a236_0x699c04(0x7c),'description':a236_0x699c04(0x92)},{'name':a236_0x699c04(0x80),'type':a236_0x699c04(0x85),'description':'Page\x20number','default':0x1},{'name':a236_0x699c04(0x93),'type':a236_0x699c04(0x85),'description':'Page\x20size'},{'name':a236_0x699c04(0x95),'type':a236_0x699c04(0x89),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x4c9917){const _0x76e1=a236_0x699c04,_0x353a06=await listSqlQueries(_0x4c9917[_0x76e1(0x8e)],{'sqlCode':_0x4c9917[_0x76e1(0x7b)]('sqlcode')||undefined,'sqlName':_0x4c9917[_0x76e1(0x7b)](_0x76e1(0x72))||undefined,'currentPage':_0x4c9917['num']('page'),'pageSize':_0x4c9917[_0x76e1(0x73)](_0x76e1(0x93),0x32)}),_0x5a4313=_0x4c9917['bool'](_0x76e1(0x95)),_0x1a00fe=_0x353a06[_0x76e1(0x87)]??[],_0x463c3b=_0x353a06[_0x76e1(0x7f)]?.['totalCount']??_0x1a00fe[_0x76e1(0x71)];let _0x14eeae;return _0x5a4313?_0x14eeae=_0x1a00fe:_0x14eeae=await Promise[_0x76e1(0x7a)](_0x1a00fe[_0x76e1(0x82)](async _0xc10636=>{const _0x519829=_0x76e1;let _0x2877dc;try{_0x2877dc=_0xc10636['dbId']?await getDbName(_0x4c9917[_0x519829(0x8e)],_0xc10636[_0x519829(0x83)]):undefined;}catch{}return{'sqlCode':_0xc10636[_0x519829(0x94)],'sqlName':_0xc10636[_0x519829(0x74)],'description':_0xc10636[_0x519829(0x81)]??'','db':_0x2877dc?_0x2877dc+'\x20('+_0xc10636[_0x519829(0x83)]+')':_0xc10636[_0x519829(0x83)]??''};})),{'ok':!![],'data':_0x14eeae,'message':_0x1a00fe[_0x76e1(0x71)]===0x0?_0x76e1(0x90):_0x76e1(0x84)+_0x1a00fe[_0x76e1(0x71)]+_0x76e1(0x8a)+_0x463c3b+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a212_0x4ecddd=a212_0x44ae;(function(_0x20b2a5,_0x592fe6){const _0x55ac03=a212_0x44ae,_0x140f97=_0x20b2a5();while(!![]){try{const _0x5befc5=-parseInt(_0x55ac03(0x1c5))/0x1+parseInt(_0x55ac03(0x1a8))/0x2*(-parseInt(_0x55ac03(0x197))/0x3)+parseInt(_0x55ac03(0x1b7))/0x4*(parseInt(_0x55ac03(0x1af))/0x5)+parseInt(_0x55ac03(0x1be))/0x6*(parseInt(_0x55ac03(0x1a5))/0x7)+parseInt(_0x55ac03(0x199))/0x8+parseInt(_0x55ac03(0x1a6))/0x9+-parseInt(_0x55ac03(0x1c6))/0xa*(-parseInt(_0x55ac03(0x1b0))/0xb);if(_0x5befc5===_0x592fe6)break;else _0x140f97['push'](_0x140f97['shift']());}catch(_0x5940ab){_0x140f97['push'](_0x140f97['shift']());}}}(a212_0x56e2,0x89d1b));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a212_0x56e2(){const _0x1e9ff8=['string','name','bool','11435stkqRX','13376OARLYn','test','str','Pull\x20complete:\x20','Filter\x20by\x20SQL\x20display\x20name','push','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','580utOaHJ','filter','sqlcode','boolean','\x20skipped,\x20','toISOString','pull','1479522DvNDJt','paging','trimStart','mybatisXml','sqlCode','Would\x20pull\x20','catch','812852lGufFW','880BSitqz','replace','length','totalCount','lockFilePath','sql','sqls','POST','local\x20differs\x20from\x20remote','tableData','appCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','force','join','\x20failed','3bdjOyx','sqlName','2582304JognXd','lastSync','skipped','utf8','dbId','path','nonInteractive','unchanged','sqlRoot','\x20SQL\x20file(s)\x20into\x20','would_pull','description','7VDFLau','3750003vaESTE','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','94612HfjtyH','cancelled','sqlContent','sqlRootDir'];a212_0x56e2=function(){return _0x1e9ff8;};return a212_0x56e2();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x190acd,_0x20fbbc){const _0x54249d=a212_0x44ae,_0x509cbd=[];let _0x3bf5dd=0x1;while(!![]){const _0x3488c6=await listSqlQueries(_0x190acd,{'currentPage':_0x3bf5dd,'pageSize':PAGE_SIZE,'sqlCode':_0x20fbbc[_0x54249d(0x1c2)],'sqlName':_0x20fbbc[_0x54249d(0x198)]}),_0x561d2c=_0x3488c6[_0x54249d(0x1cf)]??[];_0x509cbd[_0x54249d(0x1b5)](..._0x561d2c);if(_0x561d2c[_0x54249d(0x1c8)]===0x0)break;const _0x97d588=_0x3488c6[_0x54249d(0x1bf)]?.[_0x54249d(0x1c9)];if(_0x97d588!=null?_0x509cbd[_0x54249d(0x1c8)]>=_0x97d588:_0x561d2c[_0x54249d(0x1c8)]<PAGE_SIZE)break;_0x3bf5dd++;}return _0x509cbd;}async function ensureSqlContent(_0x187ee3){const _0x32ac69=a212_0x44ae;if(_0x187ee3[_0x32ac69(0x1aa)]!=null&&String(_0x187ee3['sqlContent'])['length']>0x0)return _0x187ee3;return getSqlQueryDetail(_0x187ee3[_0x32ac69(0x1c2)]);}export const sqlPull={'service':a212_0x4ecddd(0x1cb),'command':a212_0x4ecddd(0x1bd),'description':a212_0x4ecddd(0x1a7),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a212_0x4ecddd(0x1ac),'description':a212_0x4ecddd(0x1b4)},{'name':'force','type':a212_0x4ecddd(0x1ba),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x311e00){const _0x136296=a212_0x4ecddd,_0x59cd3a=loadSqlProjectConfig(_0x311e00[_0x136296(0x1d0)]),_0x3fb7bd=await readSqlLockFile(_0x59cd3a[_0x136296(0x1ca)]),{appLock:_0xe02317}=ensureSqlLockScope(_0x3fb7bd??createEmptySqlLock(),_0x59cd3a[_0x136296(0x1d0)],_0x59cd3a[_0x136296(0x1a1)],_0x136296(0x1bd)),_0xcee0ee=await fetchAllSqlQueries(_0x311e00[_0x136296(0x1d0)],{'sqlCode':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1b9))||undefined,'sqlName':_0x311e00['str'](_0x136296(0x1ad))||undefined}),_0x4fa8ca=[];for(const _0x4c0df5 of _0xcee0ee){const _0x4bb91d=await ensureSqlContent(_0x4c0df5),_0x3409ce=ensureRemoteSqlContent(_0x4bb91d),_0x445686=detectModeFromSql(_0x4bb91d),_0x3d82ae=_0x4bb91d[_0x136296(0x19d)]?await getDbName(_0x311e00[_0x136296(0x1d0)],Number(_0x4bb91d[_0x136296(0x19d)]))[_0x136296(0x1c4)](()=>undefined):undefined,_0x50ee20=buildLocalSqlFileContent({'sqlCode':_0x4bb91d[_0x136296(0x1c2)],'sqlName':_0x4bb91d[_0x136296(0x198)],'dbId':_0x4bb91d['dbId']},_0x3409ce,{'dbName':_0x3d82ae,'mode':_0x445686,'syncedAt':new Date()[_0x136296(0x1bc)](),'description':_0x4bb91d[_0x136296(0x1a4)]}),_0x472490=buildSqlLockEntry(_0x4bb91d,_0x3409ce,'',{'dbName':_0x3d82ae}),_0x2e7687=resolveLocalSqlFilePath(_0x59cd3a,_0x4bb91d[_0x136296(0x1c2)],_0x472490);let _0x38a430=_0x136296(0x1a3),_0x3e0b62;if(await fileExists(_0x2e7687)){const _0x44555c=await readFile(_0x2e7687,_0x136296(0x19c));isEquivalentPulledSqlFile(_0x44555c,_0x50ee20,_0x445686)?(_0x38a430=_0x136296(0x19b),_0x3e0b62=_0x136296(0x1a0)):(_0x38a430='conflict',_0x3e0b62=_0x136296(0x1d1));}_0x4fa8ca[_0x136296(0x1b5)]({'sqlCode':_0x4bb91d[_0x136296(0x1c2)],'sqlName':_0x4bb91d['sqlName'],'filePath':_0x2e7687,'status':_0x38a430,'reason':_0x3e0b62});}return{'method':_0x136296(0x1cd),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x311e00[_0x136296(0x1d0)],'sqlCode':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1b9))||null,'sqlName':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1ad))||null,'files':_0x4fa8ca},'description':_0x136296(0x1c3)+_0x4fa8ca[_0x136296(0x1c8)]+_0x136296(0x1a2)+_0x59cd3a[_0x136296(0x1ab)]};},async 'execute'(_0x5a1998){const _0x1d7975=a212_0x4ecddd,_0x3a4f6c=loadSqlProjectConfig(_0x5a1998[_0x1d7975(0x1d0)]),_0x35a612=await readSqlLockFile(_0x3a4f6c[_0x1d7975(0x1ca)]),{lockData:_0x28e050,appLock:_0x53a53e}=ensureSqlLockScope(_0x35a612??createEmptySqlLock(),_0x3a4f6c['appCode'],_0x3a4f6c[_0x1d7975(0x1a1)],'pull'),_0x1a088c=_0x5a1998[_0x1d7975(0x1ae)](_0x1d7975(0x1d2)),_0x37f021=await fetchAllSqlQueries(_0x5a1998[_0x1d7975(0x1d0)],{'sqlCode':_0x5a1998[_0x1d7975(0x1b2)](_0x1d7975(0x1b9))||undefined,'sqlName':_0x5a1998[_0x1d7975(0x1b2)](_0x1d7975(0x1ad))||undefined});if(_0x37f021[_0x1d7975(0x1c8)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x54f0e1=[],_0x4c692f=[];for(const _0x2ecf6a of _0x37f021){try{_0x54f0e1[_0x1d7975(0x1b5)](await ensureSqlContent(_0x2ecf6a));}catch(_0x1c8246){_0x4c692f[_0x1d7975(0x1b5)]({'sqlCode':_0x2ecf6a[_0x1d7975(0x1c2)],'error':_0x1c8246 instanceof Error?_0x1c8246['message']:String(_0x1c8246)});}}if(_0x1a088c&&!_0x5a1998[_0x1d7975(0x19f)]){let _0x21bb85=![];for(const _0x4b2bad of _0x54f0e1){const _0xa06b17=detectModeFromSql(_0x4b2bad),_0x3a64bd=_0x4b2bad[_0x1d7975(0x19d)]?await getDbName(_0x5a1998['appCode'],Number(_0x4b2bad[_0x1d7975(0x19d)]))[_0x1d7975(0x1c4)](()=>undefined):undefined,_0x39d49a=buildLocalSqlFileContent({'sqlCode':_0x4b2bad['sqlCode'],'sqlName':_0x4b2bad[_0x1d7975(0x198)],'dbId':_0x4b2bad[_0x1d7975(0x19d)]},ensureRemoteSqlContent(_0x4b2bad),{'dbName':_0x3a64bd,'mode':_0xa06b17,'syncedAt':new Date()[_0x1d7975(0x1bc)](),'description':_0x4b2bad[_0x1d7975(0x1a4)]}),_0x45c87d=resolveLocalSqlFilePath(_0x3a4f6c,_0x4b2bad[_0x1d7975(0x1c2)],buildSqlLockEntry(_0x4b2bad,ensureRemoteSqlContent(_0x4b2bad),'',{'dbName':_0x3a64bd}));if(await fileExists(_0x45c87d)){const _0x1da928=await readFile(_0x45c87d,_0x1d7975(0x19c));if(!isEquivalentPulledSqlFile(_0x1da928,_0x39d49a,_0xa06b17)){_0x21bb85=!![];break;}}}if(_0x21bb85){const _0x172926=await confirmForceOverwrite(_0x1d7975(0x1b6));if(!_0x172926)throw CliErrors[_0x1d7975(0x1a9)]('Force\x20pull\x20cancelled.');}}const _0x3bcd87=cloneSqlLockData(_0x28e050),_0x96faaf=_0x3bcd87['apps'][_0x3a4f6c['appCode']],_0x1132dd=[],_0x4589a5=[];for(const _0xe25923 of _0x54f0e1){const _0xa173fe=_0x96faaf[_0x1d7975(0x1cc)][_0xe25923[_0x1d7975(0x1c2)]],_0x39612c=ensureRemoteSqlContent(_0xe25923),_0x5b03b3=detectModeFromSql(_0xe25923),_0x3d43a5=_0xe25923[_0x1d7975(0x19d)]?await getDbName(_0x5a1998[_0x1d7975(0x1d0)],Number(_0xe25923[_0x1d7975(0x19d)]))[_0x1d7975(0x1c4)](()=>undefined):undefined,_0x16c9e2=buildLocalSqlFileContent({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'sqlName':_0xe25923[_0x1d7975(0x198)],'dbId':_0xe25923[_0x1d7975(0x19d)]},_0x39612c,{'dbName':_0x3d43a5,'mode':_0x5b03b3,'syncedAt':new Date()[_0x1d7975(0x1bc)](),'description':_0xe25923['description']}),_0x3bd402=buildSqlLockEntry(_0xe25923,_0x39612c,computeSqlContentHash(_0x16c9e2),{'dbName':_0x3d43a5}),_0x18603a=_0x3bd402[_0x1d7975(0x19e)],_0x2d8e40=join(_0x3a4f6c[_0x1d7975(0x1ab)],_0x18603a);try{if(await fileExists(_0x2d8e40)){const _0x349cee=await readFile(_0x2d8e40,'utf8');if(isEquivalentPulledSqlFile(_0x349cee,_0x16c9e2,_0x5b03b3)){_0x4589a5[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923['sqlCode'],'reason':_0x1d7975(0x1a0)}),_0x96faaf[_0x1d7975(0x1cc)][_0xe25923['sqlCode']]={..._0x3bd402,'hash':computeSqlContentHash(_0x349cee),'path':_0x18603a};continue;}if(!_0x1a088c){_0x4589a5[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923['sqlCode'],'reason':_0x1d7975(0x1ce)});continue;}}const _0x118971=_0xa173fe?.[_0x1d7975(0x19e)]?join(_0x3a4f6c[_0x1d7975(0x1ab)],_0xa173fe[_0x1d7975(0x19e)]):undefined;_0x118971&&_0x118971!==_0x2d8e40&&await fileExists(_0x118971)&&await rm(_0x118971,{'force':!![]}),await ensureParentDirectory(_0x2d8e40),await writeFile(_0x2d8e40,_0x16c9e2,_0x1d7975(0x19c)),_0x96faaf['sqls'][_0xe25923[_0x1d7975(0x1c2)]]={..._0x3bd402,'path':_0x18603a},_0x1132dd[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'filePath':_0x2d8e40});}catch(_0x21d0e3){_0x4c692f[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'error':_0x21d0e3 instanceof Error?_0x21d0e3['message']:String(_0x21d0e3)});}}return _0x96faaf[_0x1d7975(0x19a)]=new Date()[_0x1d7975(0x1bc)](),await writeSqlLockFile(_0x3a4f6c['lockFilePath'],_0x3bcd87),{'ok':_0x4c692f['length']===0x0,'data':{'pulled':_0x1132dd,'skipped':_0x4589a5,'failed':_0x4c692f},'message':_0x1d7975(0x1b3)+_0x1132dd['length']+'\x20written,\x20'+_0x4589a5['length']+_0x1d7975(0x1bb)+_0x4c692f['length']+_0x1d7975(0x196)};}};function detectModeFromSql(_0x503a8b){const _0x280874=a212_0x4ecddd,_0x580395=ensureRemoteSqlContent(_0x503a8b),_0x4dbb32=stripLocalSqlMetadata(_0x580395,_0x280874(0x1c1))[_0x280874(0x1c0)]();if(/^<(select|insert|update|delete)\b/i[_0x280874(0x1b1)](_0x4dbb32))return _0x280874(0x1c1);return _0x280874(0x1cb);}function isEquivalentPulledSqlFile(_0x1d5f76,_0x5a3df8,_0x96a540){return normalizePullComparableContent(_0x1d5f76,_0x96a540)===normalizePullComparableContent(_0x5a3df8,_0x96a540);}function a212_0x44ae(_0x1192d0,_0xd4bfbe){_0x1192d0=_0x1192d0-0x195;const _0x56e22f=a212_0x56e2();let _0x44ae6e=_0x56e22f[_0x1192d0];return _0x44ae6e;}function normalizePullComparableContent(_0x266a75,_0x8a35d0){const _0x2b077b=a212_0x4ecddd,_0x5151b1=_0x266a75[_0x2b077b(0x1c7)](/\r\n/g,'\x0a')['split']('\x0a'),_0x417e0d=_0x5151b1[_0x2b077b(0x1b8)](_0x1c4fed=>!isSyncedAtMetadataLine(_0x1c4fed,_0x8a35d0));return _0x417e0d[_0x2b077b(0x195)]('\x0a');}function isSyncedAtMetadataLine(_0xb27144,_0x24b4e0){const _0x5ed7c8=a212_0x4ecddd;if(_0x24b4e0===_0x5ed7c8(0x1c1))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5ed7c8(0x1b1)](_0xb27144);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0xb27144);}
|
|
1
|
+
const a237_0x2fb91e=a237_0x325d;(function(_0x2e8481,_0x4ec5e8){const _0x39183d=a237_0x325d,_0x3c6342=_0x2e8481();while(!![]){try{const _0x38c0f0=parseInt(_0x39183d(0x167))/0x1+parseInt(_0x39183d(0x17c))/0x2+parseInt(_0x39183d(0x14b))/0x3+-parseInt(_0x39183d(0x178))/0x4+parseInt(_0x39183d(0x145))/0x5*(-parseInt(_0x39183d(0x176))/0x6)+-parseInt(_0x39183d(0x149))/0x7*(parseInt(_0x39183d(0x16e))/0x8)+parseInt(_0x39183d(0x166))/0x9;if(_0x38c0f0===_0x4ec5e8)break;else _0x3c6342['push'](_0x3c6342['shift']());}catch(_0x3c26b0){_0x3c6342['push'](_0x3c6342['shift']());}}}(a237_0x4e8f,0x62785));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a237_0x4e8f(){const _0x3c3d2d=['string','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','bool','str','cancelled','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','description','No\x20remote\x20SQL\x20queries\x20matched.','pull','unchanged','Filter\x20by\x20SQL\x20display\x20name','sqlName','catch','would_pull','Force\x20overwrite\x20local\x20unsynced\x20changes','utf8','mybatisXml','join','sqlRootDir','toISOString','filter','3474846HkjNsv','747868wjbrNv','POST','force','\x20failed','name','appCode','tableData','8JaNsGx','dbId','path','trimStart','sqlcode','skipped','paging','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','78kXmwcy','\x20skipped,\x20','2249668EEtOjQ','nonInteractive','push','sqls','185992VSkYPX','lastSync','conflict','test','Pull\x20complete:\x20','56185xoxuks','totalCount','apps','local\x20differs\x20from\x20remote','2591463CIQwCf','sqlContent','765246PrPMpJ','sqlCode','sql','message','lockFilePath','length'];a237_0x4e8f=function(){return _0x3c3d2d;};return a237_0x4e8f();}function a237_0x325d(_0x5b1240,_0x52e622){_0x5b1240=_0x5b1240-0x144;const _0x4e8f7d=a237_0x4e8f();let _0x325d79=_0x4e8f7d[_0x5b1240];return _0x325d79;}async function fetchAllSqlQueries(_0x6f4394,_0xe7115e){const _0xe3016c=a237_0x325d,_0x4d38c4=[];let _0x2d0951=0x1;while(!![]){const _0xb93fa1=await listSqlQueries(_0x6f4394,{'currentPage':_0x2d0951,'pageSize':PAGE_SIZE,'sqlCode':_0xe7115e[_0xe3016c(0x14c)],'sqlName':_0xe7115e[_0xe3016c(0x15c)]}),_0x4bdb51=_0xb93fa1[_0xe3016c(0x16d)]??[];_0x4d38c4[_0xe3016c(0x17a)](..._0x4bdb51);if(_0x4bdb51[_0xe3016c(0x150)]===0x0)break;const _0x9a4e97=_0xb93fa1[_0xe3016c(0x174)]?.[_0xe3016c(0x146)];if(_0x9a4e97!=null?_0x4d38c4[_0xe3016c(0x150)]>=_0x9a4e97:_0x4bdb51[_0xe3016c(0x150)]<PAGE_SIZE)break;_0x2d0951++;}return _0x4d38c4;}async function ensureSqlContent(_0x429a2a){const _0x38394b=a237_0x325d;if(_0x429a2a[_0x38394b(0x14a)]!=null&&String(_0x429a2a[_0x38394b(0x14a)])[_0x38394b(0x150)]>0x0)return _0x429a2a;return getSqlQueryDetail(_0x429a2a[_0x38394b(0x14c)]);}export const sqlPull={'service':a237_0x2fb91e(0x14d),'command':'pull','description':a237_0x2fb91e(0x175),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a237_0x2fb91e(0x16b),'type':a237_0x2fb91e(0x151),'description':a237_0x2fb91e(0x15b)},{'name':a237_0x2fb91e(0x169),'type':'boolean','description':a237_0x2fb91e(0x15f)}],async 'dryRun'(_0x38d1ec){const _0x5042a9=a237_0x2fb91e,_0x23bf6b=loadSqlProjectConfig(_0x38d1ec[_0x5042a9(0x16c)]),_0x3da512=await readSqlLockFile(_0x23bf6b['lockFilePath']),{appLock:_0x285a2d}=ensureSqlLockScope(_0x3da512??createEmptySqlLock(),_0x23bf6b[_0x5042a9(0x16c)],_0x23bf6b['sqlRoot'],_0x5042a9(0x159)),_0x5661a3=await fetchAllSqlQueries(_0x38d1ec[_0x5042a9(0x16c)],{'sqlCode':_0x38d1ec[_0x5042a9(0x154)](_0x5042a9(0x172))||undefined,'sqlName':_0x38d1ec[_0x5042a9(0x154)](_0x5042a9(0x16b))||undefined}),_0x282f33=[];for(const _0x4950dd of _0x5661a3){const _0x391940=await ensureSqlContent(_0x4950dd),_0x1fd98c=ensureRemoteSqlContent(_0x391940),_0x2cbe40=detectModeFromSql(_0x391940),_0x144e3f=_0x391940[_0x5042a9(0x16f)]?await getDbName(_0x38d1ec[_0x5042a9(0x16c)],Number(_0x391940[_0x5042a9(0x16f)]))[_0x5042a9(0x15d)](()=>undefined):undefined,_0x420df7=buildLocalSqlFileContent({'sqlCode':_0x391940[_0x5042a9(0x14c)],'sqlName':_0x391940['sqlName'],'dbId':_0x391940['dbId']},_0x1fd98c,{'dbName':_0x144e3f,'mode':_0x2cbe40,'syncedAt':new Date()['toISOString'](),'description':_0x391940[_0x5042a9(0x157)]}),_0x1f49a5=buildSqlLockEntry(_0x391940,_0x1fd98c,'',{'dbName':_0x144e3f}),_0x573137=resolveLocalSqlFilePath(_0x23bf6b,_0x391940['sqlCode'],_0x1f49a5);let _0x338a43=_0x5042a9(0x15e),_0x27fec1;if(await fileExists(_0x573137)){const _0x5acc84=await readFile(_0x573137,'utf8');isEquivalentPulledSqlFile(_0x5acc84,_0x420df7,_0x2cbe40)?(_0x338a43=_0x5042a9(0x173),_0x27fec1=_0x5042a9(0x15a)):(_0x338a43=_0x5042a9(0x17e),_0x27fec1='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x282f33[_0x5042a9(0x17a)]({'sqlCode':_0x391940['sqlCode'],'sqlName':_0x391940[_0x5042a9(0x15c)],'filePath':_0x573137,'status':_0x338a43,'reason':_0x27fec1});}return{'method':_0x5042a9(0x168),'url':_0x5042a9(0x152),'body':{'appCode':_0x38d1ec['appCode'],'sqlCode':_0x38d1ec[_0x5042a9(0x154)](_0x5042a9(0x172))||null,'sqlName':_0x38d1ec[_0x5042a9(0x154)]('name')||null,'files':_0x282f33},'description':'Would\x20pull\x20'+_0x282f33['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x23bf6b[_0x5042a9(0x163)]};},async 'execute'(_0x4630b9){const _0x4acf9b=a237_0x2fb91e,_0x224abe=loadSqlProjectConfig(_0x4630b9[_0x4acf9b(0x16c)]),_0x50044a=await readSqlLockFile(_0x224abe['lockFilePath']),{lockData:_0x157456,appLock:_0xbb5024}=ensureSqlLockScope(_0x50044a??createEmptySqlLock(),_0x224abe['appCode'],_0x224abe['sqlRoot'],_0x4acf9b(0x159)),_0x292dcf=_0x4630b9[_0x4acf9b(0x153)](_0x4acf9b(0x169)),_0x3351a0=await fetchAllSqlQueries(_0x4630b9[_0x4acf9b(0x16c)],{'sqlCode':_0x4630b9[_0x4acf9b(0x154)](_0x4acf9b(0x172))||undefined,'sqlName':_0x4630b9['str']('name')||undefined});if(_0x3351a0['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4acf9b(0x158)};const _0x1f408f=[],_0x555683=[];for(const _0x4375b6 of _0x3351a0){try{_0x1f408f[_0x4acf9b(0x17a)](await ensureSqlContent(_0x4375b6));}catch(_0x193159){_0x555683[_0x4acf9b(0x17a)]({'sqlCode':_0x4375b6[_0x4acf9b(0x14c)],'error':_0x193159 instanceof Error?_0x193159[_0x4acf9b(0x14e)]:String(_0x193159)});}}if(_0x292dcf&&!_0x4630b9[_0x4acf9b(0x179)]){let _0x3960e7=![];for(const _0x4b785b of _0x1f408f){const _0xe81c5a=detectModeFromSql(_0x4b785b),_0x2e558a=_0x4b785b[_0x4acf9b(0x16f)]?await getDbName(_0x4630b9[_0x4acf9b(0x16c)],Number(_0x4b785b['dbId']))[_0x4acf9b(0x15d)](()=>undefined):undefined,_0x50658e=buildLocalSqlFileContent({'sqlCode':_0x4b785b[_0x4acf9b(0x14c)],'sqlName':_0x4b785b['sqlName'],'dbId':_0x4b785b[_0x4acf9b(0x16f)]},ensureRemoteSqlContent(_0x4b785b),{'dbName':_0x2e558a,'mode':_0xe81c5a,'syncedAt':new Date()[_0x4acf9b(0x164)](),'description':_0x4b785b[_0x4acf9b(0x157)]}),_0x4c1787=resolveLocalSqlFilePath(_0x224abe,_0x4b785b['sqlCode'],buildSqlLockEntry(_0x4b785b,ensureRemoteSqlContent(_0x4b785b),'',{'dbName':_0x2e558a}));if(await fileExists(_0x4c1787)){const _0x1a9a21=await readFile(_0x4c1787,'utf8');if(!isEquivalentPulledSqlFile(_0x1a9a21,_0x50658e,_0xe81c5a)){_0x3960e7=!![];break;}}}if(_0x3960e7){const _0x2ef5e7=await confirmForceOverwrite(_0x4acf9b(0x156));if(!_0x2ef5e7)throw CliErrors[_0x4acf9b(0x155)]('Force\x20pull\x20cancelled.');}}const _0x430672=cloneSqlLockData(_0x157456),_0x5bb7d4=_0x430672[_0x4acf9b(0x147)][_0x224abe[_0x4acf9b(0x16c)]],_0x768d74=[],_0x41e6f7=[];for(const _0x533bc4 of _0x1f408f){const _0x41ee3c=_0x5bb7d4[_0x4acf9b(0x17b)][_0x533bc4['sqlCode']],_0x1129cb=ensureRemoteSqlContent(_0x533bc4),_0x24de28=detectModeFromSql(_0x533bc4),_0x28699a=_0x533bc4[_0x4acf9b(0x16f)]?await getDbName(_0x4630b9[_0x4acf9b(0x16c)],Number(_0x533bc4['dbId']))[_0x4acf9b(0x15d)](()=>undefined):undefined,_0x5b7a2d=buildLocalSqlFileContent({'sqlCode':_0x533bc4[_0x4acf9b(0x14c)],'sqlName':_0x533bc4[_0x4acf9b(0x15c)],'dbId':_0x533bc4[_0x4acf9b(0x16f)]},_0x1129cb,{'dbName':_0x28699a,'mode':_0x24de28,'syncedAt':new Date()[_0x4acf9b(0x164)](),'description':_0x533bc4[_0x4acf9b(0x157)]}),_0x1e3f1b=buildSqlLockEntry(_0x533bc4,_0x1129cb,computeSqlContentHash(_0x5b7a2d),{'dbName':_0x28699a}),_0x2ec176=_0x1e3f1b[_0x4acf9b(0x170)],_0x3ff407=join(_0x224abe[_0x4acf9b(0x163)],_0x2ec176);try{if(await fileExists(_0x3ff407)){const _0x3248fb=await readFile(_0x3ff407,_0x4acf9b(0x160));if(isEquivalentPulledSqlFile(_0x3248fb,_0x5b7a2d,_0x24de28)){_0x41e6f7['push']({'sqlCode':_0x533bc4['sqlCode'],'reason':_0x4acf9b(0x15a)}),_0x5bb7d4[_0x4acf9b(0x17b)][_0x533bc4[_0x4acf9b(0x14c)]]={..._0x1e3f1b,'hash':computeSqlContentHash(_0x3248fb),'path':_0x2ec176};continue;}if(!_0x292dcf){_0x41e6f7['push']({'sqlCode':_0x533bc4[_0x4acf9b(0x14c)],'reason':_0x4acf9b(0x148)});continue;}}const _0x23502b=_0x41ee3c?.[_0x4acf9b(0x170)]?join(_0x224abe[_0x4acf9b(0x163)],_0x41ee3c[_0x4acf9b(0x170)]):undefined;_0x23502b&&_0x23502b!==_0x3ff407&&await fileExists(_0x23502b)&&await rm(_0x23502b,{'force':!![]}),await ensureParentDirectory(_0x3ff407),await writeFile(_0x3ff407,_0x5b7a2d,'utf8'),_0x5bb7d4[_0x4acf9b(0x17b)][_0x533bc4[_0x4acf9b(0x14c)]]={..._0x1e3f1b,'path':_0x2ec176},_0x768d74[_0x4acf9b(0x17a)]({'sqlCode':_0x533bc4[_0x4acf9b(0x14c)],'filePath':_0x3ff407});}catch(_0x2d0b69){_0x555683[_0x4acf9b(0x17a)]({'sqlCode':_0x533bc4[_0x4acf9b(0x14c)],'error':_0x2d0b69 instanceof Error?_0x2d0b69[_0x4acf9b(0x14e)]:String(_0x2d0b69)});}}return _0x5bb7d4[_0x4acf9b(0x17d)]=new Date()[_0x4acf9b(0x164)](),await writeSqlLockFile(_0x224abe[_0x4acf9b(0x14f)],_0x430672),{'ok':_0x555683[_0x4acf9b(0x150)]===0x0,'data':{'pulled':_0x768d74,'skipped':_0x41e6f7,'failed':_0x555683},'message':_0x4acf9b(0x144)+_0x768d74[_0x4acf9b(0x150)]+'\x20written,\x20'+_0x41e6f7['length']+_0x4acf9b(0x177)+_0x555683['length']+_0x4acf9b(0x16a)};}};function detectModeFromSql(_0x251fd2){const _0x5b3560=a237_0x2fb91e,_0x1dbcc2=ensureRemoteSqlContent(_0x251fd2),_0x14431a=stripLocalSqlMetadata(_0x1dbcc2,_0x5b3560(0x161))[_0x5b3560(0x171)]();if(/^<(select|insert|update|delete)\b/i[_0x5b3560(0x17f)](_0x14431a))return'mybatisXml';return'sql';}function isEquivalentPulledSqlFile(_0x26eb23,_0x525313,_0x1f71fb){return normalizePullComparableContent(_0x26eb23,_0x1f71fb)===normalizePullComparableContent(_0x525313,_0x1f71fb);}function normalizePullComparableContent(_0x11584f,_0x1bee53){const _0x51f994=a237_0x2fb91e,_0x3588c8=_0x11584f['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x33bd28=_0x3588c8[_0x51f994(0x165)](_0x36045a=>!isSyncedAtMetadataLine(_0x36045a,_0x1bee53));return _0x33bd28[_0x51f994(0x162)]('\x0a');}function isSyncedAtMetadataLine(_0x4da0cc,_0x65f810){const _0x462ed0=a237_0x2fb91e;if(_0x65f810==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x462ed0(0x17f)](_0x4da0cc);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x4da0cc);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a213_0x1718bb=a213_0x4948;(function(_0x4fac46,_0x511c42){const _0x15b8a9=a213_0x4948,_0x98892e=_0x4fac46();while(!![]){try{const _0x5ac995=-parseInt(_0x15b8a9(0xdd))/0x1*(parseInt(_0x15b8a9(0xcf))/0x2)+parseInt(_0x15b8a9(0xb5))/0x3*(-parseInt(_0x15b8a9(0xac))/0x4)+-parseInt(_0x15b8a9(0xdc))/0x5*(-parseInt(_0x15b8a9(0xce))/0x6)+-parseInt(_0x15b8a9(0xb2))/0x7*(parseInt(_0x15b8a9(0xeb))/0x8)+parseInt(_0x15b8a9(0xe8))/0x9+parseInt(_0x15b8a9(0xd1))/0xa*(parseInt(_0x15b8a9(0xd2))/0xb)+parseInt(_0x15b8a9(0xc3))/0xc*(parseInt(_0x15b8a9(0xae))/0xd);if(_0x5ac995===_0x511c42)break;else _0x98892e['push'](_0x98892e['shift']());}catch(_0x22296c){_0x98892e['push'](_0x98892e['shift']());}}}(a213_0x1fdb,0x482a6));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';function a213_0x4948(_0x59642c,_0x564a5a){_0x59642c=_0x59642c-0xab;const _0x1fdbc4=a213_0x1fdb();let _0x4948c7=_0x1fdbc4[_0x59642c];return _0x4948c7;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x86396,_0x161b8f,_0x2da1df){const _0x287cac=a213_0x4948,_0x5a06e4=await scanLocalSqlQueries(_0x86396),_0x36c084=new Map();for(const _0x195073 of _0x5a06e4){if(_0x2da1df&&_0x195073[_0x287cac(0xb7)]!==_0x2da1df)continue;const _0xe244e7=_0x36c084[_0x287cac(0xe7)](_0x195073[_0x287cac(0xb7)])??[];_0xe244e7[_0x287cac(0xd9)](_0x195073),_0x36c084[_0x287cac(0xd5)](_0x195073[_0x287cac(0xb7)],_0xe244e7);}if(_0x2da1df&&!_0x36c084[_0x287cac(0xe3)](_0x2da1df))throw CliErrors[_0x287cac(0xc0)](_0x287cac(0xc6)+_0x2da1df);const _0x1d6af4=[];for(const [_0x4a45e8,_0x478192]of _0x36c084[_0x287cac(0xb1)]()){if(_0x478192[_0x287cac(0xbf)]===0x1){_0x1d6af4[_0x287cac(0xd9)](_0x478192[0x0]);continue;}const _0x27bbe1=_0x161b8f[_0x287cac(0xd8)][_0x4a45e8],_0x420e21=_0x27bbe1?.[_0x287cac(0xe0)],_0x14bb19=_0x420e21?_0x478192[_0x287cac(0xc4)](_0xf022b6=>_0xf022b6[_0x287cac(0xba)]!==_0x420e21):_0x478192;if(_0x27bbe1&&_0x14bb19[_0x287cac(0xbf)]===0x1){_0x1d6af4[_0x287cac(0xd9)](_0x14bb19[0x0]);continue;}throw CliErrors[_0x287cac(0xc0)](_0x287cac(0xcd)+_0x4a45e8+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x1d6af4;}export const sqlPush={'service':a213_0x1718bb(0xd3),'command':a213_0x1718bb(0xd9),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a213_0x1718bb(0xe5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a213_0x1718bb(0xc7),'type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5bf561){const _0x137d17=a213_0x1718bb,_0x13da32=loadSqlProjectConfig(_0x5bf561[_0x137d17(0xd4)]),_0x57cc3a=await readSqlLockFile(_0x13da32['lockFilePath']),{appLock:_0x228947}=ensureSqlLockScope(_0x57cc3a??createEmptySqlLock(),_0x5bf561[_0x137d17(0xd4)],_0x13da32[_0x137d17(0xcb)],_0x137d17(0xd9)),_0x435fa8=await getTargetSqlQueries(_0x13da32,_0x228947,_0x5bf561[_0x137d17(0xee)](_0x137d17(0xb6))||undefined),_0x40ce94=[];for(const _0x25a718 of _0x435fa8){const _0x26de85=await computeSqlFileHash(_0x25a718[_0x137d17(0xec)]),_0x42e991=_0x228947['sqls'][_0x25a718[_0x137d17(0xb7)]],_0x37ea75=!!_0x42e991&&(_0x42e991[_0x137d17(0xe0)]!==_0x25a718['relativePath']||!!_0x25a718['sqlName']&&_0x42e991[_0x137d17(0xe4)]!==_0x25a718['sqlName']);if(!_0x5bf561[_0x137d17(0xd6)]('force')&&_0x42e991&&_0x42e991['hash']===_0x26de85&&!_0x37ea75)continue;_0x40ce94[_0x137d17(0xd9)](_0x25a718[_0x137d17(0xb7)]);}return{'method':'POST','url':_0x137d17(0xc5),'body':{'sqlCodes':_0x40ce94,'appCode':_0x5bf561[_0x137d17(0xd4)]},'description':_0x137d17(0xe1)+_0x40ce94['length']+_0x137d17(0xc2)};},async 'execute'(_0x3b5b1e){const _0xe81cdc=a213_0x1718bb,_0x3451e7=loadSqlProjectConfig(_0x3b5b1e[_0xe81cdc(0xd4)]),_0x24f8ac=await readSqlLockFile(_0x3451e7[_0xe81cdc(0xca)]),{lockData:_0x242a64,appLock:_0x9cbb60}=ensureSqlLockScope(_0x24f8ac??createEmptySqlLock(),_0x3b5b1e['appCode'],_0x3451e7[_0xe81cdc(0xcb)],_0xe81cdc(0xd9)),_0x3f2387=await getTargetSqlQueries(_0x3451e7,_0x9cbb60,_0x3b5b1e[_0xe81cdc(0xee)](_0xe81cdc(0xb6))||undefined);if(_0x3f2387[_0xe81cdc(0xbf)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3aa878=[],_0x134492=[],_0x4dce2f=[];for(const _0x5709a0 of _0x3f2387){const _0x40f053=_0x9cbb60[_0xe81cdc(0xd8)][_0x5709a0['sqlCode']];if(!_0x40f053){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0xe81cdc(0xbd)});continue;}try{const _0x425dc9=await computeSqlFileHash(_0x5709a0[_0xe81cdc(0xec)]),_0x181ce8=_0x40f053['path']!==_0x5709a0[_0xe81cdc(0xba)]||!!_0x5709a0[_0xe81cdc(0xe4)]&&_0x40f053[_0xe81cdc(0xe4)]!==_0x5709a0[_0xe81cdc(0xe4)];if(!_0x3b5b1e[_0xe81cdc(0xd6)](_0xe81cdc(0xc7))&&_0x40f053[_0xe81cdc(0xaf)]===_0x425dc9&&!_0x181ce8){_0x134492[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'reason':_0xe81cdc(0xbe)});continue;}if(_0x40f053['version']==null){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0xe81cdc(0xd7)});continue;}const _0x5a706b=await readFile(_0x5709a0[_0xe81cdc(0xec)],'utf8'),_0x11cb0c=stripLocalSqlMetadata(_0x5a706b,_0x5709a0['mode']),_0x279fd8=_0x5709a0['sqlName']||_0x40f053[_0xe81cdc(0xe4)],_0x58c849=await resolveTargetDbBinding(_0x3b5b1e[_0xe81cdc(0xd4)],_0x5709a0,_0x40f053),_0x20cc13=await updateSqlQuery({'id':_0x40f053[_0xe81cdc(0xdf)],'appCode':_0x3b5b1e[_0xe81cdc(0xd4)],'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'sqlName':_0x279fd8,'dbId':_0x58c849['dbId'],'version':_0x40f053[_0xe81cdc(0xb9)],'sqlContent':_0x11cb0c,'sqlConfig':_0x40f053['sqlConfig']??undefined}),_0x1decc4=_0x20cc13[_0xe81cdc(0xbb)]?await getDbName(_0x3b5b1e[_0xe81cdc(0xd4)],Number(_0x20cc13[_0xe81cdc(0xbb)]))[_0xe81cdc(0xb3)](()=>_0x58c849[_0xe81cdc(0xe2)]):_0x58c849[_0xe81cdc(0xe2)];_0x9cbb60[_0xe81cdc(0xd8)][_0x5709a0['sqlCode']]={...buildSqlLockEntry(_0x20cc13,_0x11cb0c,_0x425dc9,{'dbName':_0x1decc4}),'path':_0x5709a0[_0xe81cdc(0xba)],'mode':_0x40f053[_0xe81cdc(0xe6)]},await archivePreviousSqlFileIfNeeded(_0x3451e7,_0x40f053[_0xe81cdc(0xe0)],_0x5709a0[_0xe81cdc(0xba)]),_0x3aa878[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0['sqlCode'],'remoteId':_0x40f053[_0xe81cdc(0xdf)]});}catch(_0x53270a){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0x53270a instanceof Error?_0x53270a['message']:String(_0x53270a)});}}_0x9cbb60[_0xe81cdc(0xb4)]=new Date()[_0xe81cdc(0xda)](),await writeSqlLockFile(_0x3451e7[_0xe81cdc(0xca)],_0x242a64);const _0x5e1bd1=_0x4dce2f[_0xe81cdc(0xbf)]===0x0;return{'ok':_0x5e1bd1,'data':{'pushed':_0x3aa878,'skipped':_0x134492,'failed':_0x4dce2f},'message':_0xe81cdc(0xc9)+_0x3aa878[_0xe81cdc(0xbf)]+_0xe81cdc(0xed)+_0x134492[_0xe81cdc(0xbf)]+_0xe81cdc(0xcc)+_0x4dce2f[_0xe81cdc(0xbf)]+_0xe81cdc(0xc1)};}};async function archivePreviousSqlFileIfNeeded(_0x1ccd96,_0xed159a,_0x2a481a){const _0x18f7f0=a213_0x1718bb;if(!_0xed159a||_0xed159a===_0x2a481a)return;const _0x1f8c6a=join(_0x1ccd96[_0x18f7f0(0xad)],_0xed159a);if(!await fileExists(_0x1f8c6a))return;const _0x24521c=await moveToTrash(_0x1ccd96[_0x18f7f0(0xdb)],_0x1ccd96[_0x18f7f0(0xe9)],_0x1f8c6a);await cleanupEmptyDirectories(dirname(_0x1f8c6a),_0x1ccd96[_0x18f7f0(0xad)]),void _0x24521c;}function a213_0x1fdb(){const _0x801744=['version','relativePath','dbId','No\x20database\x20matches\x20local\x20directory\x20\x22','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','unchanged','length','validation','\x20failed','\x20SQL\x20file(s)','24evAkcx','filter','/smartapi/custom/updateUserCustomSql','Local\x20SQL\x20not\x20found:\x20','force','\x22\x20for\x20sqlCode\x20','Push\x20complete:\x20','lockFilePath','sqlRoot','\x20skipped,\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','2211504qjqHxt','2jYygBw','isFinite','970mspKIy','62414QcGxUl','sql','appCode','set','bool','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqls','push','toISOString','projectRoot','5PhAZUp','361770rdLwrU','replace','remoteId','path','Would\x20push\x20','dbName','has','sqlName','write','mode','get','2857950NOwvPU','trashDir','startsWith','8HjtaHK','filePath','\x20pushed,\x20','str','Local\x20directory\x20\x22','2107828CfMhcx','sqlRootDir','491543AibYiH','hash','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','entries','894719xeyzjW','catch','lastSync','3ZyUJme','sqlcode','sqlCode','exec'];a213_0x1fdb=function(){return _0x801744;};return a213_0x1fdb();}async function moveToTrash(_0x4323b0,_0x458e57,_0x445d5a){const _0x5ac8f9=a213_0x1718bb,_0x4cf50b=new Date()[_0x5ac8f9(0xda)]()[_0x5ac8f9(0xde)](/[:.]/g,'-'),_0x1f0cd1=relative(_0x4323b0,_0x445d5a),_0x5c75e7=join(_0x458e57,_0x4cf50b,_0x1f0cd1);return await mkdir(dirname(_0x5c75e7),{'recursive':!![]}),await rename(_0x445d5a,_0x5c75e7),_0x5c75e7;}async function cleanupEmptyDirectories(_0x3b3e46,_0x5957ee){const _0x293071=a213_0x1718bb;let _0x26bc3d=resolve(_0x3b3e46);const _0x3ead71=resolve(_0x5957ee);while(_0x26bc3d[_0x293071(0xea)](''+_0x3ead71+sep)||_0x26bc3d===_0x3ead71){if(_0x26bc3d===_0x3ead71)return;try{const _0x3edb77=await readdir(_0x26bc3d);if(_0x3edb77[_0x293071(0xbf)]>0x0)return;await rmdir(_0x26bc3d);}catch{return;}_0x26bc3d=dirname(_0x26bc3d);}}async function resolveTargetDbBinding(_0x28a99d,_0x53c9b2,_0x266adc){const _0x306c7a=a213_0x1718bb,_0x4d3e99=_0x53c9b2['dbDirectory'];if(!_0x4d3e99)return{'dbId':_0x266adc[_0x306c7a(0xbb)],'dbName':_0x266adc[_0x306c7a(0xe2)]};const _0x4de44c=buildDbDirectoryName(_0x266adc[_0x306c7a(0xe2)],_0x266adc[_0x306c7a(0xbb)]);if(_0x4d3e99===_0x4de44c)return{'dbId':_0x266adc[_0x306c7a(0xbb)],'dbName':_0x266adc[_0x306c7a(0xe2)]};const _0x2c4ee8=parseExplicitDbDirectory(_0x4d3e99);if(_0x2c4ee8!=null)return{'dbId':_0x2c4ee8,'dbName':await getDbName(_0x28a99d,_0x2c4ee8)[_0x306c7a(0xb3)](()=>undefined)};const _0x5a424e=await listDatabases(_0x28a99d),_0x5634b0=_0x5a424e[_0x306c7a(0xc4)](_0x54dea2=>buildDbDirectoryName(_0x54dea2[_0x306c7a(0xe2)],_0x54dea2[_0x306c7a(0xbb)])===_0x4d3e99);if(_0x5634b0[_0x306c7a(0xbf)]===0x1)return{'dbId':_0x5634b0[0x0][_0x306c7a(0xbb)],'dbName':_0x5634b0[0x0]['dbName']};if(_0x5634b0[_0x306c7a(0xbf)]===0x0)throw CliErrors[_0x306c7a(0xc0)](_0x306c7a(0xbc)+_0x4d3e99+_0x306c7a(0xc8)+_0x53c9b2[_0x306c7a(0xb7)]+'.');const _0x2ce4d1=_0x5634b0['map'](_0x3a4c21=>_0x3a4c21[_0x306c7a(0xe2)]+'\x20('+_0x3a4c21[_0x306c7a(0xbb)]+')')['join'](',\x20');throw CliErrors[_0x306c7a(0xc0)](_0x306c7a(0xab)+_0x4d3e99+_0x306c7a(0xb0)+_0x53c9b2[_0x306c7a(0xb7)]+':\x20'+_0x2ce4d1);}function parseExplicitDbDirectory(_0x382070){const _0x5eae42=a213_0x1718bb,_0x2ffe15=/^db-(\d+)$/[_0x5eae42(0xb8)](_0x382070);if(!_0x2ffe15)return null;const _0x20df91=Number(_0x2ffe15[0x1]);return Number[_0x5eae42(0xd0)](_0x20df91)&&_0x20df91>0x0?_0x20df91:null;}
|
|
1
|
+
const a238_0x31b7cd=a238_0x1449;(function(_0x52d0ac,_0x44f729){const _0x7ae4c7=a238_0x1449,_0x595443=_0x52d0ac();while(!![]){try{const _0x180cce=-parseInt(_0x7ae4c7(0x17e))/0x1+parseInt(_0x7ae4c7(0x172))/0x2*(parseInt(_0x7ae4c7(0x1af))/0x3)+-parseInt(_0x7ae4c7(0x1a4))/0x4+parseInt(_0x7ae4c7(0x1ab))/0x5*(-parseInt(_0x7ae4c7(0x18d))/0x6)+parseInt(_0x7ae4c7(0x1a3))/0x7*(-parseInt(_0x7ae4c7(0x1a2))/0x8)+parseInt(_0x7ae4c7(0x174))/0x9*(parseInt(_0x7ae4c7(0x176))/0xa)+-parseInt(_0x7ae4c7(0x184))/0xb*(-parseInt(_0x7ae4c7(0x196))/0xc);if(_0x180cce===_0x44f729)break;else _0x595443['push'](_0x595443['shift']());}catch(_0x263e56){_0x595443['push'](_0x595443['shift']());}}}(a238_0x5734,0xd17b8));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';function a238_0x1449(_0xd0e9d5,_0x4e6761){_0xd0e9d5=_0xd0e9d5-0x16f;const _0x573497=a238_0x5734();let _0x144970=_0x573497[_0xd0e9d5];return _0x144970;}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x16af0c,_0xaccbae,_0x1dd148){const _0xcfef10=a238_0x1449,_0x3f98c3=await scanLocalSqlQueries(_0x16af0c),_0xd101ae=new Map();for(const _0x14d675 of _0x3f98c3){if(_0x1dd148&&_0x14d675[_0xcfef10(0x1a5)]!==_0x1dd148)continue;const _0x572b0b=_0xd101ae[_0xcfef10(0x1ad)](_0x14d675[_0xcfef10(0x1a5)])??[];_0x572b0b[_0xcfef10(0x194)](_0x14d675),_0xd101ae[_0xcfef10(0x1a8)](_0x14d675[_0xcfef10(0x1a5)],_0x572b0b);}if(_0x1dd148&&!_0xd101ae[_0xcfef10(0x187)](_0x1dd148))throw CliErrors['validation']('Local\x20SQL\x20not\x20found:\x20'+_0x1dd148);const _0x2b128f=[];for(const [_0x57ee73,_0x21fa81]of _0xd101ae['entries']()){if(_0x21fa81[_0xcfef10(0x185)]===0x1){_0x2b128f[_0xcfef10(0x194)](_0x21fa81[0x0]);continue;}const _0x41d3cc=_0xaccbae['sqls'][_0x57ee73],_0xfdfd4a=_0x41d3cc?.[_0xcfef10(0x177)],_0x434403=_0xfdfd4a?_0x21fa81['filter'](_0x195d73=>_0x195d73[_0xcfef10(0x19a)]!==_0xfdfd4a):_0x21fa81;if(_0x41d3cc&&_0x434403[_0xcfef10(0x185)]===0x1){_0x2b128f[_0xcfef10(0x194)](_0x434403[0x0]);continue;}throw CliErrors['validation'](_0xcfef10(0x17b)+_0x57ee73+_0xcfef10(0x18e));}return _0x2b128f;}export const sqlPush={'service':a238_0x31b7cd(0x175),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a238_0x31b7cd(0x18a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a238_0x31b7cd(0x1ac),'type':a238_0x31b7cd(0x199),'description':a238_0x31b7cd(0x17f)}],async 'dryRun'(_0x39c7b2){const _0x3ef9a3=a238_0x31b7cd,_0x246c8b=loadSqlProjectConfig(_0x39c7b2[_0x3ef9a3(0x1a1)]),_0x11f18e=await readSqlLockFile(_0x246c8b['lockFilePath']),{appLock:_0x2b7c0d}=ensureSqlLockScope(_0x11f18e??createEmptySqlLock(),_0x39c7b2[_0x3ef9a3(0x1a1)],_0x246c8b[_0x3ef9a3(0x19b)],_0x3ef9a3(0x194)),_0x503574=await getTargetSqlQueries(_0x246c8b,_0x2b7c0d,_0x39c7b2[_0x3ef9a3(0x186)](_0x3ef9a3(0x18b))||undefined),_0x1569bd=[];for(const _0x4a7691 of _0x503574){const _0x283e3d=await computeSqlFileHash(_0x4a7691['filePath']),_0x2ab3a2=_0x2b7c0d[_0x3ef9a3(0x198)][_0x4a7691[_0x3ef9a3(0x1a5)]],_0x470592=!!_0x2ab3a2&&(_0x2ab3a2[_0x3ef9a3(0x177)]!==_0x4a7691[_0x3ef9a3(0x19a)]||!!_0x4a7691[_0x3ef9a3(0x181)]&&_0x2ab3a2[_0x3ef9a3(0x181)]!==_0x4a7691[_0x3ef9a3(0x181)]);if(!_0x39c7b2[_0x3ef9a3(0x1a6)](_0x3ef9a3(0x1ac))&&_0x2ab3a2&&_0x2ab3a2[_0x3ef9a3(0x190)]===_0x283e3d&&!_0x470592)continue;_0x1569bd[_0x3ef9a3(0x194)](_0x4a7691[_0x3ef9a3(0x1a5)]);}return{'method':_0x3ef9a3(0x1b2),'url':_0x3ef9a3(0x197),'body':{'sqlCodes':_0x1569bd,'appCode':_0x39c7b2[_0x3ef9a3(0x1a1)]},'description':_0x3ef9a3(0x191)+_0x1569bd[_0x3ef9a3(0x185)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x21654e){const _0x4ac0c=a238_0x31b7cd,_0x5e4ef6=loadSqlProjectConfig(_0x21654e[_0x4ac0c(0x1a1)]),_0x247ff0=await readSqlLockFile(_0x5e4ef6[_0x4ac0c(0x1ae)]),{lockData:_0x300b8b,appLock:_0x59c168}=ensureSqlLockScope(_0x247ff0??createEmptySqlLock(),_0x21654e[_0x4ac0c(0x1a1)],_0x5e4ef6[_0x4ac0c(0x19b)],'push'),_0x5c51b8=await getTargetSqlQueries(_0x5e4ef6,_0x59c168,_0x21654e[_0x4ac0c(0x186)](_0x4ac0c(0x18b))||undefined);if(_0x5c51b8['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4ac0c(0x173)};const _0x34ed56=[],_0x2b95ab=[],_0x1284d9=[];for(const _0x5403ae of _0x5c51b8){const _0x1fd1cd=_0x59c168['sqls'][_0x5403ae[_0x4ac0c(0x1a5)]];if(!_0x1fd1cd){_0x1284d9['push']({'sqlCode':_0x5403ae[_0x4ac0c(0x1a5)],'error':_0x4ac0c(0x1b0)});continue;}try{const _0x5785af=await computeSqlFileHash(_0x5403ae[_0x4ac0c(0x19c)]),_0x9c2d05=_0x1fd1cd[_0x4ac0c(0x177)]!==_0x5403ae[_0x4ac0c(0x19a)]||!!_0x5403ae[_0x4ac0c(0x181)]&&_0x1fd1cd['sqlName']!==_0x5403ae['sqlName'];if(!_0x21654e[_0x4ac0c(0x1a6)](_0x4ac0c(0x1ac))&&_0x1fd1cd[_0x4ac0c(0x190)]===_0x5785af&&!_0x9c2d05){_0x2b95ab[_0x4ac0c(0x194)]({'sqlCode':_0x5403ae['sqlCode'],'reason':_0x4ac0c(0x1a9)});continue;}if(_0x1fd1cd[_0x4ac0c(0x17c)]==null){_0x1284d9[_0x4ac0c(0x194)]({'sqlCode':_0x5403ae['sqlCode'],'error':_0x4ac0c(0x19e)});continue;}const _0x4a902f=await readFile(_0x5403ae[_0x4ac0c(0x19c)],_0x4ac0c(0x193)),_0x333fd1=stripLocalSqlMetadata(_0x4a902f,_0x5403ae[_0x4ac0c(0x192)]),_0x306161=_0x5403ae[_0x4ac0c(0x181)]||_0x1fd1cd[_0x4ac0c(0x181)],_0x457bf8=await resolveTargetDbBinding(_0x21654e[_0x4ac0c(0x1a1)],_0x5403ae,_0x1fd1cd),_0x5cb2e8=await updateSqlQuery({'id':_0x1fd1cd[_0x4ac0c(0x183)],'appCode':_0x21654e[_0x4ac0c(0x1a1)],'sqlCode':_0x5403ae[_0x4ac0c(0x1a5)],'sqlName':_0x306161,'dbId':_0x457bf8[_0x4ac0c(0x180)],'version':_0x1fd1cd[_0x4ac0c(0x17c)],'sqlContent':_0x333fd1,'sqlConfig':_0x1fd1cd[_0x4ac0c(0x19f)]??undefined}),_0x30b85a=_0x5cb2e8[_0x4ac0c(0x180)]?await getDbName(_0x21654e[_0x4ac0c(0x1a1)],Number(_0x5cb2e8[_0x4ac0c(0x180)]))[_0x4ac0c(0x188)](()=>_0x457bf8[_0x4ac0c(0x16f)]):_0x457bf8['dbName'];_0x59c168['sqls'][_0x5403ae[_0x4ac0c(0x1a5)]]={...buildSqlLockEntry(_0x5cb2e8,_0x333fd1,_0x5785af,{'dbName':_0x30b85a}),'path':_0x5403ae[_0x4ac0c(0x19a)],'mode':_0x1fd1cd[_0x4ac0c(0x192)]},await archivePreviousSqlFileIfNeeded(_0x5e4ef6,_0x1fd1cd[_0x4ac0c(0x177)],_0x5403ae[_0x4ac0c(0x19a)]),_0x34ed56['push']({'sqlCode':_0x5403ae[_0x4ac0c(0x1a5)],'remoteId':_0x1fd1cd[_0x4ac0c(0x183)]});}catch(_0x294ec5){_0x1284d9[_0x4ac0c(0x194)]({'sqlCode':_0x5403ae[_0x4ac0c(0x1a5)],'error':_0x294ec5 instanceof Error?_0x294ec5[_0x4ac0c(0x178)]:String(_0x294ec5)});}}_0x59c168['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x5e4ef6['lockFilePath'],_0x300b8b);const _0x24177c=_0x1284d9[_0x4ac0c(0x185)]===0x0;return{'ok':_0x24177c,'data':{'pushed':_0x34ed56,'skipped':_0x2b95ab,'failed':_0x1284d9},'message':_0x4ac0c(0x195)+_0x34ed56[_0x4ac0c(0x185)]+_0x4ac0c(0x170)+_0x2b95ab[_0x4ac0c(0x185)]+'\x20skipped,\x20'+_0x1284d9['length']+_0x4ac0c(0x1a0)};}};async function archivePreviousSqlFileIfNeeded(_0x410f77,_0x1e07af,_0x234125){const _0x3aeb2a=a238_0x31b7cd;if(!_0x1e07af||_0x1e07af===_0x234125)return;const _0xfff213=join(_0x410f77['sqlRootDir'],_0x1e07af);if(!await fileExists(_0xfff213))return;const _0x33da29=await moveToTrash(_0x410f77['projectRoot'],_0x410f77[_0x3aeb2a(0x182)],_0xfff213);await cleanupEmptyDirectories(dirname(_0xfff213),_0x410f77[_0x3aeb2a(0x1aa)]),void _0x33da29;}function a238_0x5734(){const _0x739ea6=['sqlRootDir','254495nDyZyZ','force','get','lockFilePath','9PrOjJA','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','POST','map','dbName','\x20pushed,\x20','filter','289862tlcfKM','No\x20local\x20SQL\x20files\x20found.','36pjuSmi','sql','4080830sSHjeV','path','message','validation','toISOString','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','version','replace','421501SynYdm','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','dbId','sqlName','trashDir','remoteId','308TZEWrt','length','str','has','catch','startsWith','write','sqlcode','join','78oDEXJC','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20database\x20matches\x20local\x20directory\x20\x22','hash','Would\x20push\x20','mode','utf8','push','Push\x20complete:\x20','596436vXuHnQ','/smartapi/custom/updateUserCustomSql','sqls','boolean','relativePath','sqlRoot','filePath','dbDirectory','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlConfig','\x20failed','appCode','4236992qmlxoX','14wdbnku','1833332LdzeRg','sqlCode','bool','exec','set','unchanged'];a238_0x5734=function(){return _0x739ea6;};return a238_0x5734();}async function moveToTrash(_0x272f9a,_0x49fa99,_0x1b0abb){const _0x99eff7=a238_0x31b7cd,_0x2799d2=new Date()[_0x99eff7(0x17a)]()[_0x99eff7(0x17d)](/[:.]/g,'-'),_0x3abf98=relative(_0x272f9a,_0x1b0abb),_0x53ce35=join(_0x49fa99,_0x2799d2,_0x3abf98);return await mkdir(dirname(_0x53ce35),{'recursive':!![]}),await rename(_0x1b0abb,_0x53ce35),_0x53ce35;}async function cleanupEmptyDirectories(_0xd0a29b,_0x180a09){const _0x388c5f=a238_0x31b7cd;let _0xf25f46=resolve(_0xd0a29b);const _0x55a1a5=resolve(_0x180a09);while(_0xf25f46[_0x388c5f(0x189)](''+_0x55a1a5+sep)||_0xf25f46===_0x55a1a5){if(_0xf25f46===_0x55a1a5)return;try{const _0x305a5a=await readdir(_0xf25f46);if(_0x305a5a['length']>0x0)return;await rmdir(_0xf25f46);}catch{return;}_0xf25f46=dirname(_0xf25f46);}}async function resolveTargetDbBinding(_0x21c85e,_0xc427fc,_0xf76380){const _0x2ea6b4=a238_0x31b7cd,_0xd72018=_0xc427fc[_0x2ea6b4(0x19d)];if(!_0xd72018)return{'dbId':_0xf76380[_0x2ea6b4(0x180)],'dbName':_0xf76380['dbName']};const _0x5ec984=buildDbDirectoryName(_0xf76380[_0x2ea6b4(0x16f)],_0xf76380[_0x2ea6b4(0x180)]);if(_0xd72018===_0x5ec984)return{'dbId':_0xf76380[_0x2ea6b4(0x180)],'dbName':_0xf76380['dbName']};const _0x171ce4=parseExplicitDbDirectory(_0xd72018);if(_0x171ce4!=null)return{'dbId':_0x171ce4,'dbName':await getDbName(_0x21c85e,_0x171ce4)[_0x2ea6b4(0x188)](()=>undefined)};const _0x5f001f=await listDatabases(_0x21c85e),_0x5ac296=_0x5f001f[_0x2ea6b4(0x171)](_0xb9973d=>buildDbDirectoryName(_0xb9973d['dbName'],_0xb9973d[_0x2ea6b4(0x180)])===_0xd72018);if(_0x5ac296[_0x2ea6b4(0x185)]===0x1)return{'dbId':_0x5ac296[0x0][_0x2ea6b4(0x180)],'dbName':_0x5ac296[0x0][_0x2ea6b4(0x16f)]};if(_0x5ac296['length']===0x0)throw CliErrors[_0x2ea6b4(0x179)](_0x2ea6b4(0x18f)+_0xd72018+'\x22\x20for\x20sqlCode\x20'+_0xc427fc[_0x2ea6b4(0x1a5)]+'.');const _0x3472dd=_0x5ac296[_0x2ea6b4(0x1b3)](_0x35a509=>_0x35a509[_0x2ea6b4(0x16f)]+'\x20('+_0x35a509['dbId']+')')[_0x2ea6b4(0x18c)](',\x20');throw CliErrors[_0x2ea6b4(0x179)]('Local\x20directory\x20\x22'+_0xd72018+_0x2ea6b4(0x1b1)+_0xc427fc[_0x2ea6b4(0x1a5)]+':\x20'+_0x3472dd);}function parseExplicitDbDirectory(_0x5eb0dc){const _0xb67cd=a238_0x31b7cd,_0x15192e=/^db-(\d+)$/[_0xb67cd(0x1a7)](_0x5eb0dc);if(!_0x15192e)return null;const _0x226878=Number(_0x15192e[0x1]);return Number['isFinite'](_0x226878)&&_0x226878>0x0?_0x226878:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a239_0x8f4c4c=a239_0x4d7b;(function(_0x542459,_0x3a3084){const _0x2df8c1=a239_0x4d7b,_0x17813f=_0x542459();while(!![]){try{const _0x3007c0=parseInt(_0x2df8c1(0x1b1))/0x1*(parseInt(_0x2df8c1(0x1bf))/0x2)+-parseInt(_0x2df8c1(0x1b0))/0x3*(-parseInt(_0x2df8c1(0x1ca))/0x4)+parseInt(_0x2df8c1(0x1d0))/0x5+parseInt(_0x2df8c1(0x1a7))/0x6+parseInt(_0x2df8c1(0x1b7))/0x7*(-parseInt(_0x2df8c1(0x1ba))/0x8)+-parseInt(_0x2df8c1(0x1ae))/0x9*(parseInt(_0x2df8c1(0x1b5))/0xa)+parseInt(_0x2df8c1(0x1bd))/0xb*(-parseInt(_0x2df8c1(0x1a3))/0xc);if(_0x3007c0===_0x3a3084)break;else _0x17813f['push'](_0x17813f['shift']());}catch(_0x391510){_0x17813f['push'](_0x17813f['shift']());}}}(a239_0x39dc,0x1cd9c));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=a239_0x8f4c4c(0x1cd);function a239_0x39dc(){const _0x3c9f95=['mybatisXml','join','5962icoyhe','syncedAt','2zSDcFD','sqls','trim','version','sqlRoot','push','\x20[y/N]\x20','\x20-->','lastSync','<!--\x20@lovrabet.','toLowerCase','9988AqruLi','dbName','dbId','.rabetbase/sql','stdin','trimStart','782475sPizyS','path','3732WoBbHC','filter','description','sqlCode','377724ajbhWZ','question','close','sqlName','includes','split','map','9ktttKG','test','111yjTVAZ','109411jbGKzh','sqlContent','apps','length','952530TqtPbX','--\x20@lovrabet.','469cijvGB','yes','mode','4688yEjnCT'];a239_0x39dc=function(){return _0x3c9f95;};return a239_0x39dc();}export function buildSqlLockEntry(_0xd47fd6,_0x5de639,_0x542500,_0x46d1f8){const _0x2fa0a9=a239_0x8f4c4c,_0x48d062=detectSqlMode(_0x5de639);return{'path':buildSqlRelativePath(_0xd47fd6[_0x2fa0a9(0x1a6)],_0xd47fd6[_0x2fa0a9(0x1aa)],_0x46d1f8?.[_0x2fa0a9(0x1cb)],_0x48d062,_0xd47fd6[_0x2fa0a9(0x1cc)]),'hash':_0x542500,'remoteId':_0xd47fd6['id'],'version':_0xd47fd6[_0x2fa0a9(0x1c2)],'dbId':Number(_0xd47fd6[_0x2fa0a9(0x1cc)]),'dbName':_0x46d1f8?.[_0x2fa0a9(0x1cb)],'sqlName':_0xd47fd6['sqlName'],'sqlConfig':_0xd47fd6['sqlConfig']??undefined,'mode':_0x48d062};}function a239_0x4d7b(_0x34b6f5,_0xbf2db3){_0x34b6f5=_0x34b6f5-0x1a2;const _0x39dc04=a239_0x39dc();let _0x4d7be0=_0x39dc04[_0x34b6f5];return _0x4d7be0;}export function cloneSqlLockData(_0x163a8a){const _0x481297=a239_0x8f4c4c;return{'apps':Object['fromEntries'](Object['entries'](_0x163a8a[_0x481297(0x1b3)])[_0x481297(0x1ad)](([_0x4e311f,_0x2acc99])=>[_0x4e311f,{'sqlRoot':_0x2acc99[_0x481297(0x1c3)],'lastSync':_0x2acc99[_0x481297(0x1c7)],'sqls':{..._0x2acc99[_0x481297(0x1c0)]}}]))};}export function ensureRemoteSqlContent(_0x2a850d){const _0x3f9197=a239_0x8f4c4c;return _0x2a850d[_0x3f9197(0x1b2)]??'';}export function buildLocalSqlFileContent(_0x3c4492,_0x9a8752,_0x357300){const _0x47af58=a239_0x8f4c4c,_0x52963e=_0x357300?.[_0x47af58(0x1b9)]??detectSqlMode(_0x9a8752),_0x5e9d1b=stripLocalSqlMetadata(_0x9a8752,_0x52963e)[_0x47af58(0x1c1)](),_0x5c5013=[...buildMetadataHeaderLines({'sqlCode':_0x3c4492[_0x47af58(0x1a6)],'sqlName':_0x3c4492['sqlName'],'dbId':_0x3c4492[_0x47af58(0x1cc)],'dbName':_0x357300?.[_0x47af58(0x1cb)],'mode':_0x52963e,'syncedAt':_0x357300?.[_0x47af58(0x1be)],'description':_0x357300?.['description']},_0x52963e),'',_0x5e9d1b],_0x56b625=_0x5c5013[_0x47af58(0x1bc)]('\x0a');return _0x56b625['endsWith']('\x0a')?_0x56b625:_0x56b625+'\x0a';}export function stripLocalSqlMetadata(_0x3e0192,_0x1d8c93){const _0x4df0aa=a239_0x8f4c4c,_0x471de3=_0x3e0192['replace'](/\r\n/g,'\x0a')[_0x4df0aa(0x1ac)]('\x0a'),_0x3536ab=[];let _0x148b73=0x0;if(_0x1d8c93===_0x4df0aa(0x1bb))while(_0x148b73<_0x471de3[_0x4df0aa(0x1b4)]){const _0x394083=_0x471de3[_0x148b73]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x394083)){_0x148b73++;continue;}if(_0x394083[_0x4df0aa(0x1c1)]()===''&&_0x148b73>0x0){_0x148b73++;continue;}break;}else while(_0x148b73<_0x471de3[_0x4df0aa(0x1b4)]){const _0x39905b=_0x471de3[_0x148b73]??'';if(/^\s*--\s*@lovrabet\./[_0x4df0aa(0x1af)](_0x39905b)){_0x148b73++;continue;}if(_0x39905b[_0x4df0aa(0x1c1)]()===''&&_0x148b73>0x0){_0x148b73++;continue;}break;}for(;_0x148b73<_0x471de3[_0x4df0aa(0x1b4)];_0x148b73++){_0x3536ab[_0x4df0aa(0x1c4)](_0x471de3[_0x148b73]);}return _0x3536ab[_0x4df0aa(0x1bc)]('\x0a')[_0x4df0aa(0x1cf)]();}export function resolveSqlMode(_0x268e2b,_0x1188a2){const _0x14c337=a239_0x8f4c4c;if(_0x1188a2?.[_0x14c337(0x1b9)])return _0x1188a2[_0x14c337(0x1b9)];return detectSqlMode(_0x268e2b);}export function resolveSqlFileName(_0x591e42,_0x4ca0a8,_0x2f3183){const _0x45f4f0=a239_0x8f4c4c;if(_0x2f3183?.[_0x45f4f0(0x1a2)])return _0x2f3183['path'];if(_0x2f3183?.[_0x45f4f0(0x1aa)]||_0x2f3183?.['dbName'])return buildSqlRelativePath(_0x591e42,_0x2f3183?.[_0x45f4f0(0x1aa)],_0x2f3183?.['dbName'],resolveSqlMode(_0x4ca0a8,_0x2f3183),_0x2f3183?.[_0x45f4f0(0x1cc)]);return buildDefaultSqlFileName(_0x591e42,resolveSqlMode(_0x4ca0a8,_0x2f3183));}export function resolveSqlLocalDir(_0x1d36c1,_0x14032b){return join(_0x1d36c1,SQL_LOCAL_REL_DIR,_0x14032b);}export async function confirmForceOverwrite(_0x4e20c4){const _0x54b665=a239_0x8f4c4c,_0x58f18d=createInterface({'input':process[_0x54b665(0x1ce)],'output':process['stderr']}),_0x191e44=await new Promise(_0x226f77=>{const _0x25e5e6=_0x54b665;_0x58f18d[_0x25e5e6(0x1a8)](_0x4e20c4+_0x25e5e6(0x1c5),_0x226f77);});return _0x58f18d[_0x54b665(0x1a9)](),['y',_0x54b665(0x1b8)][_0x54b665(0x1ab)](_0x191e44[_0x54b665(0x1c1)]()[_0x54b665(0x1c9)]());}export function findSqlLockScope(_0x16d9c0,_0x224da7){const _0x3dbb63=a239_0x8f4c4c;return _0x16d9c0[_0x3dbb63(0x1b3)][_0x224da7];}function buildMetadataHeaderLines(_0x592cc1,_0x18cdfd){const _0x8d3baa=a239_0x8f4c4c,_0x3ddae6=[[_0x8d3baa(0x1a6),_0x592cc1['sqlCode']],[_0x8d3baa(0x1aa),_0x592cc1['sqlName']],[_0x8d3baa(0x1cc),_0x592cc1[_0x8d3baa(0x1cc)]],[_0x8d3baa(0x1cb),_0x592cc1[_0x8d3baa(0x1cb)]],[_0x8d3baa(0x1b9),_0x592cc1[_0x8d3baa(0x1b9)]],[_0x8d3baa(0x1be),_0x592cc1[_0x8d3baa(0x1be)]],[_0x8d3baa(0x1a5),_0x592cc1[_0x8d3baa(0x1a5)]]];if(_0x18cdfd===_0x8d3baa(0x1bb))return _0x3ddae6[_0x8d3baa(0x1a4)](([,_0x5d28d7])=>_0x5d28d7!==undefined&&_0x5d28d7!==null&&String(_0x5d28d7)[_0x8d3baa(0x1c1)]()!=='')['map'](([_0x41a99c,_0xc93a23])=>_0x8d3baa(0x1c8)+_0x41a99c+':\x20'+String(_0xc93a23)+_0x8d3baa(0x1c6));return _0x3ddae6['filter'](([,_0x28a37b])=>_0x28a37b!==undefined&&_0x28a37b!==null&&String(_0x28a37b)['trim']()!=='')['map'](([_0x258cda,_0x3ed92a])=>_0x8d3baa(0x1b6)+_0x258cda+':\x20'+String(_0x3ed92a));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a240_0x38b08d=a240_0x38bd;(function(_0x1787ea,_0x33361d){const _0x2c5c73=a240_0x38bd,_0x43cf5b=_0x1787ea();while(!![]){try{const _0xf19c59=-parseInt(_0x2c5c73(0x1ef))/0x1+parseInt(_0x2c5c73(0x1fc))/0x2*(-parseInt(_0x2c5c73(0x1f9))/0x3)+-parseInt(_0x2c5c73(0x20a))/0x4+parseInt(_0x2c5c73(0x200))/0x5+-parseInt(_0x2c5c73(0x204))/0x6*(parseInt(_0x2c5c73(0x1ee))/0x7)+parseInt(_0x2c5c73(0x1f2))/0x8+-parseInt(_0x2c5c73(0x207))/0x9*(parseInt(_0x2c5c73(0x201))/0xa);if(_0xf19c59===_0x33361d)break;else _0x43cf5b['push'](_0x43cf5b['shift']());}catch(_0x2d8c16){_0x43cf5b['push'](_0x43cf5b['shift']());}}}(a240_0x51f9,0x4d9eb));function a240_0x51f9(){const _0x320bf3=['read','remote','appCode','3149985lQvMEt','1007150MvCltL','sqls','lockKey','6eVldVz','totalCount','has','9damded','\x20added,\x20','path','1509356fGfVLc','map','\x20unchanged','sqlCode','status','649089nInKPP','326401ceeMHr','keys','filePath','4765512xAkhcp','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','push','lockFilePath','sqlRoot','\x20modified,\x20','All\x20SQL\x20queries\x20are\x20in\x20sync.','31719riuJwB','length','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','2arChKR'];a240_0x51f9=function(){return _0x320bf3;};return a240_0x51f9();}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a240_0x38bd(_0x536f2b,_0x45aa35){_0x536f2b=_0x536f2b-0x1ea;const _0x51f93d=a240_0x51f9();let _0x38bd80=_0x51f93d[_0x536f2b];return _0x38bd80;}async function fetchAllSqlCodes(_0x453d8b){const _0x9f447e=a240_0x38bd,_0x524b70=[];let _0x4c12f7=0x1;while(!![]){const _0x180355=await listSqlQueries(_0x453d8b,{'currentPage':_0x4c12f7,'pageSize':PAGE_SIZE}),_0x3d55f1=_0x180355['tableData']??[];_0x524b70[_0x9f447e(0x1f4)](..._0x3d55f1[_0x9f447e(0x1ea)](_0x195196=>_0x195196[_0x9f447e(0x1ec)]));if(_0x3d55f1[_0x9f447e(0x1fa)]===0x0)break;const _0x2ccccc=_0x180355['paging']?.[_0x9f447e(0x205)];if(_0x2ccccc!=null?_0x524b70['length']>=_0x2ccccc:_0x3d55f1[_0x9f447e(0x1fa)]<PAGE_SIZE)break;_0x4c12f7++;}return _0x524b70;}export const sqlStatus={'service':'sql','command':a240_0x38b08d(0x1ed),'description':a240_0x38b08d(0x1fb),'risk':a240_0x38b08d(0x1fd),'flags':[{'name':a240_0x38b08d(0x1fe),'type':'boolean','description':a240_0x38b08d(0x1f3)}],async 'execute'(_0x401bd3){const _0x2f248b=a240_0x38b08d,_0x4702ed=loadSqlProjectConfig(_0x401bd3[_0x2f248b(0x1ff)]),_0x266c8e=await readSqlLockFile(_0x4702ed[_0x2f248b(0x1f5)]),{appLock:_0x54a887}=ensureSqlLockScope(_0x266c8e??createEmptySqlLock(),_0x4702ed[_0x2f248b(0x1ff)],_0x4702ed[_0x2f248b(0x1f6)],_0x2f248b(0x1ed)),_0xfd731c=await scanLocalSqlQueries(_0x4702ed),_0x5107a1=[],_0x1527c1=[],_0x4b16f8=[],_0x4ba2a7=[],_0x2a4ca3=new Set(_0xfd731c['map'](_0x1cfd57=>_0x1cfd57[_0x2f248b(0x203)]));for(const _0x3985a0 of _0xfd731c){const _0x43b6d7=await computeSqlFileHash(_0x3985a0[_0x2f248b(0x1f1)]),_0x286d85=_0x54a887[_0x2f248b(0x202)][_0x3985a0['lockKey']],_0x292064=!!_0x286d85&&_0x286d85[_0x2f248b(0x209)]!==_0x3985a0['relativePath'],_0x33272f=!!_0x286d85&&!!_0x3985a0['sqlName']&&_0x286d85['sqlName']!==_0x3985a0['sqlName'];if(!_0x286d85)_0x5107a1['push'](_0x3985a0[_0x2f248b(0x203)]);else _0x286d85['hash']!==_0x43b6d7||_0x292064||_0x33272f?_0x1527c1[_0x2f248b(0x1f4)](_0x3985a0['lockKey']):_0x4b16f8[_0x2f248b(0x1f4)](_0x3985a0[_0x2f248b(0x203)]);}for(const _0x7adf86 of Object[_0x2f248b(0x1f0)](_0x54a887['sqls'])){!_0x2a4ca3[_0x2f248b(0x206)](_0x7adf86)&&_0x4ba2a7[_0x2f248b(0x1f4)](_0x7adf86);}const _0x42e6bb=[];if(_0x401bd3['bool']('remote')){const _0x4f0f31=await fetchAllSqlCodes(_0x401bd3[_0x2f248b(0x1ff)]);for(const _0x2fc8ad of _0x4f0f31){!_0x2a4ca3[_0x2f248b(0x206)](_0x2fc8ad)&&!_0x54a887[_0x2f248b(0x202)][_0x2fc8ad]&&_0x42e6bb[_0x2f248b(0x1f4)](_0x2fc8ad);}}const _0xd71c37=_0x5107a1[_0x2f248b(0x1fa)]===0x0&&_0x1527c1['length']===0x0&&_0x4ba2a7[_0x2f248b(0x1fa)]===0x0&&_0x42e6bb[_0x2f248b(0x1fa)]===0x0;return{'ok':!![],'data':{'added':_0x5107a1,'modified':_0x1527c1,'missing':_0x4ba2a7,'unchanged':_0x4b16f8,'remoteOnly':_0x42e6bb},'message':_0xd71c37?_0x2f248b(0x1f8):_0x5107a1[_0x2f248b(0x1fa)]+_0x2f248b(0x208)+_0x1527c1[_0x2f248b(0x1fa)]+_0x2f248b(0x1f7)+_0x4ba2a7['length']+'\x20missing,\x20'+_0x4b16f8[_0x2f248b(0x1fa)]+_0x2f248b(0x1eb)+(_0x42e6bb[_0x2f248b(0x1fa)]>0x0?',\x20'+_0x42e6bb[_0x2f248b(0x1fa)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a241_0xe856ee=a241_0x6301;(function(_0x1f5224,_0x196b21){const _0x1e659d=a241_0x6301,_0x3387f4=_0x1f5224();while(!![]){try{const _0x503554=-parseInt(_0x1e659d(0x14a))/0x1*(parseInt(_0x1e659d(0x179))/0x2)+parseInt(_0x1e659d(0x180))/0x3+-parseInt(_0x1e659d(0x16e))/0x4*(parseInt(_0x1e659d(0x163))/0x5)+parseInt(_0x1e659d(0x155))/0x6*(-parseInt(_0x1e659d(0x187))/0x7)+-parseInt(_0x1e659d(0x184))/0x8*(-parseInt(_0x1e659d(0x16d))/0x9)+parseInt(_0x1e659d(0x152))/0xa*(-parseInt(_0x1e659d(0x18f))/0xb)+parseInt(_0x1e659d(0x18c))/0xc*(-parseInt(_0x1e659d(0x16c))/0xd);if(_0x503554===_0x196b21)break;else _0x3387f4['push'](_0x3387f4['shift']());}catch(_0x3cd6e4){_0x3387f4['push'](_0x3387f4['shift']());}}}(a241_0x2100,0x99852));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a241_0x2100(){const _0x29ccbd=['16950VUDzsO','dbtableConfig','fields','filter','sql','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','dataset','flagMissing','trim','13qVPTLF','9vfUhLI','12cLxwzb','validation','map','reason','index_type','boolean','SQL\x20schema\x20validation','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','Provide\x20--file\x20or\x20--sql','cwd','\x22\x20not\x20found\x20in\x20any\x20dataset','266IHacKS','indexes','get','length','appCode','parameters','file','2909646aNIldu','bool','columns','flatMap','5489968EGlSbP','tableName','toLowerCase','7ifzaBv','isDangerous','str','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','--check-indexes\x20requires\x20--schemas.','428172ubvhBu','valid','File\x20not\x20found:\x20','167497vcrUWb','tables','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','3863LyArZW','check-indexes','type','message','string','isArray','find','schemaWarnings','210MuuHpq','columnNames','joinAudit','887478XBiext','sqlType','push','name','index_columns','schemas','split','indexName','size','unshift','Table\x20\x22','validate','schema:','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'];a241_0x2100=function(){return _0x29ccbd;};return a241_0x2100();}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a241_0xe856ee(0x167),'command':a241_0xe856ee(0x160),'description':a241_0xe856ee(0x168),'risk':'read','flags':[{'name':a241_0xe856ee(0x17f),'type':a241_0xe856ee(0x14e),'description':a241_0xe856ee(0x18a)},{'name':a241_0xe856ee(0x167),'type':a241_0xe856ee(0x14e),'description':a241_0xe856ee(0x191)},{'name':a241_0xe856ee(0x15a),'type':a241_0xe856ee(0x14e),'description':a241_0xe856ee(0x175)},{'name':a241_0xe856ee(0x14b),'type':a241_0xe856ee(0x173),'description':a241_0xe856ee(0x162)}],async 'execute'(_0x145653){const _0x4da592=a241_0xe856ee,_0x5ccbb0=_0x145653[_0x4da592(0x189)](_0x4da592(0x17f)),_0x689662=_0x145653['str'](_0x4da592(0x167)),_0x7e3d8e=_0x145653[_0x4da592(0x189)](_0x4da592(0x15a)),_0x1ad17f=_0x145653[_0x4da592(0x181)](_0x4da592(0x14b));if(!_0x5ccbb0&&!_0x689662)throw CliErrors[_0x4da592(0x16a)](_0x4da592(0x17f),_0x4da592(0x176));if(_0x1ad17f&&!_0x7e3d8e)throw CliErrors[_0x4da592(0x16f)](_0x4da592(0x18b));let _0xbf59a5;if(_0x5ccbb0){const _0x501d82=resolve(process[_0x4da592(0x177)](),_0x5ccbb0);if(!existsSync(_0x501d82))throw CliErrors[_0x4da592(0x16f)](_0x4da592(0x18e)+_0x501d82);_0xbf59a5=readFileSync(_0x501d82,'utf-8');}else _0xbf59a5=_0x689662;const _0x3cb810=validateSql(_0xbf59a5),_0x340c9b={'valid':_0x3cb810[_0x4da592(0x18d)],'sqlType':_0x3cb810[_0x4da592(0x156)][_0x4da592(0x14c)],'isSelectOnly':_0x3cb810['sqlType']['isSelectOnly'],'isDangerous':_0x3cb810['sqlType'][_0x4da592(0x188)],'tables':_0x3cb810[_0x4da592(0x190)],'parameters':_0x3cb810[_0x4da592(0x17e)],'message':_0x3cb810[_0x4da592(0x14d)]};_0x3cb810[_0x4da592(0x156)][_0x4da592(0x171)]&&(_0x340c9b[_0x4da592(0x171)]=_0x3cb810[_0x4da592(0x156)]['reason']);if(_0x7e3d8e&&_0x3cb810[_0x4da592(0x18d)]){const _0x263742=_0x7e3d8e[_0x4da592(0x15b)](',')[_0x4da592(0x170)](_0x24122a=>_0x24122a[_0x4da592(0x16b)]())[_0x4da592(0x166)](Boolean),_0x3942d8=[],_0x4237d8=[],_0x303cd5=filterDbTableBackedDatasets(await listDatasets(_0x145653[_0x4da592(0x17d)])),_0xe6513a=new Map(_0x303cd5[_0x4da592(0x170)](_0x1a5cb1=>[_0x1a5cb1[_0x4da592(0x164)]?.[_0x4da592(0x185)]?.[_0x4da592(0x186)](),_0x1a5cb1]));for(const _0x3d7193 of _0x3cb810[_0x4da592(0x190)]){const _0x14130a=_0xe6513a[_0x4da592(0x17b)](_0x3d7193[_0x4da592(0x186)]());!_0x14130a&&_0x3942d8[_0x4da592(0x157)](_0x4da592(0x15f)+_0x3d7193+_0x4da592(0x178));}for(const _0x513f3c of _0x263742){let _0x3268a2;try{_0x3268a2=await getDatasetDetail(_0x513f3c);}catch{_0x3942d8[_0x4da592(0x157)]('Dataset\x20\x22'+_0x513f3c+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x3268a2,_0x4da592(0x174));const _0x56b00e=Array['isArray'](_0x3268a2[_0x4da592(0x165)])?_0x3268a2[_0x4da592(0x165)]:[],_0x16ac82=new Set(_0x56b00e[_0x4da592(0x170)](_0x2801f6=>_0x2801f6['name']?.[_0x4da592(0x186)]())),_0x409eaf=_0x3268a2['dbtableConfig']?.['tableName']||_0x3268a2[_0x4da592(0x185)]||_0x513f3c;_0x340c9b[_0x4da592(0x161)+_0x409eaf]={'code':_0x513f3c,'tableName':_0x409eaf,'fieldCount':_0x16ac82[_0x4da592(0x15d)],'fields':Array['from'](_0x16ac82)};if(_0x1ad17f){const _0xb77b78=normalizeDatasetIndexes(_0x3268a2);_0x4237d8[_0x4da592(0x157)]({'tableName':_0x409eaf,..._0xb77b78});}}_0x3942d8[_0x4da592(0x17c)]>0x0&&(_0x340c9b[_0x4da592(0x151)]=_0x3942d8),_0x1ad17f&&(_0x340c9b[_0x4da592(0x154)]=auditSqlJoinIndexes(_0xbf59a5,_0x4237d8));}return{'ok':_0x3cb810[_0x4da592(0x18d)],'data':_0x340c9b,'message':_0x3cb810['message']};}};function a241_0x6301(_0x32e476,_0x2717a8){_0x32e476=_0x32e476-0x14a;const _0x21005a=a241_0x2100();let _0x6301fa=_0x21005a[_0x32e476];return _0x6301fa;}function normalizeDatasetIndexes(_0x22716c){const _0x1da3d2=a241_0xe856ee,_0x3229c4=Array[_0x1da3d2(0x14f)](_0x22716c?.['dataset']?.[_0x1da3d2(0x17a)])?_0x22716c[_0x1da3d2(0x169)]['indexes']:Array['isArray'](_0x22716c?.[_0x1da3d2(0x17a)])?_0x22716c[_0x1da3d2(0x17a)]:[],_0x4b2ab0=_0x3229c4[_0x1da3d2(0x183)](_0x19f0e5=>{const _0x75ec39=_0x1da3d2,_0xb79687=Array[_0x75ec39(0x14f)](_0x19f0e5?.['index_columns'])?_0x19f0e5[_0x75ec39(0x159)]:Array[_0x75ec39(0x14f)](_0x19f0e5?.[_0x75ec39(0x153)])?_0x19f0e5[_0x75ec39(0x153)]:Array[_0x75ec39(0x14f)](_0x19f0e5?.['columns'])?_0x19f0e5[_0x75ec39(0x182)]:[],_0x5e9382=_0xb79687['filter'](_0x105907=>typeof _0x105907===_0x75ec39(0x14e))[_0x75ec39(0x170)](_0x4776d6=>_0x4776d6[_0x75ec39(0x16b)]())[_0x75ec39(0x166)](Boolean);if(_0x5e9382[_0x75ec39(0x17c)]===0x0)return[];const _0x34a310=[_0x19f0e5?.[_0x75ec39(0x15c)],_0x19f0e5?.['index_name'],_0x19f0e5?.[_0x75ec39(0x158)]][_0x75ec39(0x150)](_0x418414=>typeof _0x418414==='string'&&_0x418414['trim']()),_0x5c1b65=[_0x19f0e5?.[_0x75ec39(0x172)],_0x19f0e5?.[_0x75ec39(0x14c)]][_0x75ec39(0x150)](_0x34f4b1=>typeof _0x34f4b1==='string'&&_0x34f4b1[_0x75ec39(0x16b)]());return[{..._0x34a310?{'name':_0x34a310[_0x75ec39(0x16b)]()}:{},..._0x5c1b65?{'type':_0x5c1b65[_0x75ec39(0x16b)]()}:{},'columns':_0x5e9382}];}),_0x199e01=[..._0x4b2ab0],_0x34de92=typeof _0x22716c?.['dbtableConfig']?.['pkField']===_0x1da3d2(0x14e)?_0x22716c[_0x1da3d2(0x164)]['pkField'][_0x1da3d2(0x15b)](',')[_0x1da3d2(0x170)](_0x182b4c=>_0x182b4c[_0x1da3d2(0x16b)]())[_0x1da3d2(0x166)](Boolean):[];return _0x34de92[_0x1da3d2(0x17c)]>0x0&&_0x199e01[_0x1da3d2(0x15e)]({'type':'primary','columns':_0x34de92}),{'indexes':_0x199e01,'metadataAvailable':_0x4b2ab0[_0x1da3d2(0x17c)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a242_0x6c57(){const _0x48385b=['76IlrEsL','13574oHJoVH','7rglyIA','7570mntuia','534275LEqQfk','4953ZzAlQm','3850746FywkAn','84530cGQvWT','2467816vUVDyb','18YoPhvr','1813210pSucCi'];a242_0x6c57=function(){return _0x48385b;};return a242_0x6c57();}(function(_0x6b8660,_0x2aef16){const _0x2d9c9d=a242_0x214e,_0x27e12b=_0x6b8660();while(!![]){try{const _0x45e533=parseInt(_0x2d9c9d(0x8d))/0x1+parseInt(_0x2d9c9d(0x85))/0x2+parseInt(_0x2d9c9d(0x8b))/0x3*(-parseInt(_0x2d9c9d(0x86))/0x4)+-parseInt(_0x2d9c9d(0x8a))/0x5+-parseInt(_0x2d9c9d(0x8c))/0x6*(parseInt(_0x2d9c9d(0x88))/0x7)+parseInt(_0x2d9c9d(0x8e))/0x8*(-parseInt(_0x2d9c9d(0x8f))/0x9)+parseInt(_0x2d9c9d(0x89))/0xa*(parseInt(_0x2d9c9d(0x87))/0xb);if(_0x45e533===_0x2aef16)break;else _0x27e12b['push'](_0x27e12b['shift']());}catch(_0x4eb912){_0x27e12b['push'](_0x27e12b['shift']());}}}(a242_0x6c57,0x80fb0));function a242_0x214e(_0x1b4ad4,_0x3627cf){_0x1b4ad4=_0x1b4ad4-0x85;const _0x6c5749=a242_0x6c57();let _0x214eaf=_0x6c5749[_0x1b4ad4];return _0x214eaf;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a243_0x307709=a243_0x218b;(function(_0x4fea72,_0x4665c0){const _0x17ad28=a243_0x218b,_0x5791f7=_0x4fea72();while(!![]){try{const _0x4946d1=-parseInt(_0x17ad28(0xc6))/0x1*(-parseInt(_0x17ad28(0xc9))/0x2)+-parseInt(_0x17ad28(0xca))/0x3*(-parseInt(_0x17ad28(0xc1))/0x4)+-parseInt(_0x17ad28(0xb4))/0x5*(-parseInt(_0x17ad28(0xcb))/0x6)+-parseInt(_0x17ad28(0xc8))/0x7*(-parseInt(_0x17ad28(0xc3))/0x8)+-parseInt(_0x17ad28(0xc7))/0x9+-parseInt(_0x17ad28(0xc0))/0xa+parseInt(_0x17ad28(0xbe))/0xb;if(_0x4946d1===_0x4665c0)break;else _0x5791f7['push'](_0x5791f7['shift']());}catch(_0x33ef12){_0x5791f7['push'](_0x5791f7['shift']());}}}(a243_0x40b4,0xba748));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':a243_0x307709(0xb3),'command':a243_0x307709(0xc5),'description':a243_0x307709(0xbb),'risk':'read','defaultOutputFormat':a243_0x307709(0xcc),'structuredErrors':!![],'flags':[{'name':a243_0x307709(0xbd),'type':a243_0x307709(0xc4),'required':!![],'description':a243_0x307709(0xbf)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x31614d){const _0xf6bac1=a243_0x307709;if(!_0x31614d['str'](_0xf6bac1(0xbd))['trim']())throw CliErrors[_0xf6bac1(0xb7)](_0xf6bac1(0xbd));},async 'execute'(_0x462349){const _0x708e8a=a243_0x307709,_0x5f5a22=_0x462349['str'](_0x708e8a(0xbd))[_0x708e8a(0xbc)](),_0x49224e=normalizeAsyncTask(await getAsyncTaskStatus(_0x5f5a22,_0x462349[_0x708e8a(0xc2)],_0x462349[_0x708e8a(0xb9)]));if(_0x49224e[_0x708e8a(0xba)]!==_0x5f5a22)throw CliErrors['apiError'](_0x708e8a(0xb5)+_0x5f5a22+_0x708e8a(0xb6)+_0x49224e[_0x708e8a(0xba)]+'.');const _0x344a35=buildAsyncTaskStatusCommand(_0x49224e[_0x708e8a(0xba)],_0x462349[_0x708e8a(0xc2)]);return{'ok':!![],'message':asyncTaskMessage(_0x49224e),'data':{'appCode':_0x462349[_0x708e8a(0xc2)],..._0x49224e,'query':_0x49224e[_0x708e8a(0xb8)]?null:{'command':_0x344a35}}};}};function a243_0x218b(_0x1f2cd7,_0x3f8d51){_0x1f2cd7=_0x1f2cd7-0xb3;const _0x40b451=a243_0x40b4();let _0x218bff=_0x40b451[_0x1f2cd7];return _0x218bff;}function a243_0x40b4(){const _0x4dd280=['5CvcbnD','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20',',\x20received\x20','flagMissing','isTerminal','cookie','taskId','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','trim','task-id','5595535MkxaNY','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','7639970vAuXnc','132VaNzVB','appCode','13016KnzeMp','string','status','809534YHKAlO','12964599KvsIWW','63dGrJGB','2rSWxSB','84264ykupCu','4250772siNywU','compress','task'];a243_0x40b4=function(){return _0x4dd280;};return a243_0x40b4();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x50fb6e,_0x2bccaf){const _0x4b02aa=a244_0xbf9a,_0x2dc6c7=_0x50fb6e();while(!![]){try{const _0xb7c3ef=parseInt(_0x4b02aa(0x1f4))/0x1+parseInt(_0x4b02aa(0x1f2))/0x2*(parseInt(_0x4b02aa(0x1f5))/0x3)+-parseInt(_0x4b02aa(0x1ee))/0x4+-parseInt(_0x4b02aa(0x1f0))/0x5+parseInt(_0x4b02aa(0x1f3))/0x6*(parseInt(_0x4b02aa(0x1ef))/0x7)+parseInt(_0x4b02aa(0x1f1))/0x8*(-parseInt(_0x4b02aa(0x1ed))/0x9)+parseInt(_0x4b02aa(0x1f6))/0xa;if(_0xb7c3ef===_0x2bccaf)break;else _0x2dc6c7['push'](_0x2dc6c7['shift']());}catch(_0x128ca4){_0x2dc6c7['push'](_0x2dc6c7['shift']());}}}(a244_0x3cb2,0x2d618));function a244_0x3cb2(){const _0x44fc0f=['456kKqFEY','54ObDLvB','6tRWWRm','205196UEApGd','879HtkIia','5343330iBMCMF','38736dUsSoj','1122136lQNAWJ','941409VSbZYI','850925gpAqLM'];a244_0x3cb2=function(){return _0x44fc0f;};return a244_0x3cb2();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a244_0xbf9a(_0x8315af,_0x410b5f){_0x8315af=_0x8315af-0x1ed;const _0x3cb28a=a244_0x3cb2();let _0xbf9a39=_0x3cb28a[_0x8315af];return _0xbf9a39;}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a245_0x5ebaed=a245_0x365a;(function(_0x35f092,_0x2d0de9){const _0x230ffc=a245_0x365a,_0x3633ed=_0x35f092();while(!![]){try{const _0x3d276a=-parseInt(_0x230ffc(0x15c))/0x1*(parseInt(_0x230ffc(0x150))/0x2)+parseInt(_0x230ffc(0x14e))/0x3*(parseInt(_0x230ffc(0x15a))/0x4)+-parseInt(_0x230ffc(0x14f))/0x5+parseInt(_0x230ffc(0x157))/0x6+-parseInt(_0x230ffc(0x15b))/0x7+-parseInt(_0x230ffc(0x159))/0x8+parseInt(_0x230ffc(0x14b))/0x9;if(_0x3d276a===_0x2d0de9)break;else _0x3633ed['push'](_0x3633ed['shift']());}catch(_0x5ab8a4){_0x3633ed['push'](_0x3633ed['shift']());}}}(a245_0x2a17,0x73845));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a245_0x365a(_0x3653bd,_0x49eb16){_0x3653bd=_0x3653bd-0x14b;const _0x2a1736=a245_0x2a17();let _0x365a92=_0x2a1736[_0x3653bd];return _0x365a92;}import{CliErrors}from'../../errors.js';function a245_0x2a17(){const _0x1b7f05=['2033295qAUwfv','2DdzIFR','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','members-list','length','tenant-code','trim','str','807990simXEW','read','6374760AXMDuZ','1432316OrDSIR','1836415IPkulR','43270QdCnFz','13405788cKQKnv','Exact\x20tenant\x20code','string','3wsGFaR'];a245_0x2a17=function(){return _0x1b7f05;};return a245_0x2a17();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':'tenant','command':a245_0x5ebaed(0x152),'description':a245_0x5ebaed(0x151),'risk':a245_0x5ebaed(0x158),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a245_0x5ebaed(0x154),'type':a245_0x5ebaed(0x14d),'required':!![],'description':a245_0x5ebaed(0x14c)}],async 'validate'(_0x4efa72){const _0x2b27a7=a245_0x5ebaed;if(!_0x4efa72[_0x2b27a7(0x156)]('tenant-code')[_0x2b27a7(0x155)]())throw CliErrors['flagMissing'](_0x2b27a7(0x154),'Pass\x20--tenant-code\x20<code>.');},async 'execute'(_0x16efb){const _0x2594ac=a245_0x5ebaed,_0x1dc5fe=_0x16efb[_0x2594ac(0x156)](_0x2594ac(0x154))[_0x2594ac(0x155)](),_0x34d065=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x1dc5fe,_0x34d065);const _0xa43974=projectTenantMembers(await listTenantDirectoryMembers(_0x1dc5fe));return{'ok':!![],'data':{'tenantCode':_0x1dc5fe,'items':_0xa43974,'totalCount':_0xa43974[_0x2594ac(0x153)]},'message':'Found\x20'+_0xa43974[_0x2594ac(0x153)]+'\x20tenant\x20member(s)'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x101cfc,_0x41fb3b){const _0x3c8387=a246_0xe6ee,_0x1fcaff=_0x101cfc();while(!![]){try{const _0x108dfc=parseInt(_0x3c8387(0x1c1))/0x1*(-parseInt(_0x3c8387(0x1d2))/0x2)+parseInt(_0x3c8387(0x1d7))/0x3+parseInt(_0x3c8387(0x1d8))/0x4*(parseInt(_0x3c8387(0x1ca))/0x5)+-parseInt(_0x3c8387(0x1cc))/0x6+parseInt(_0x3c8387(0x1bf))/0x7+-parseInt(_0x3c8387(0x1ce))/0x8*(-parseInt(_0x3c8387(0x1d0))/0x9)+-parseInt(_0x3c8387(0x1c3))/0xa;if(_0x108dfc===_0x41fb3b)break;else _0x1fcaff['push'](_0x1fcaff['shift']());}catch(_0x33c17e){_0x1fcaff['push'](_0x1fcaff['shift']());}}}(a246_0xbfbc,0xd0b42));function a246_0xe6ee(_0x17401b,_0xb80a91){_0x17401b=_0x17401b-0x1bf;const _0xbfbc6e=a246_0xbfbc();let _0xe6eef6=_0xbfbc6e[_0x17401b];return _0xe6eef6;}function a246_0xbfbc(){const _0x547042=['ADMIN','7329888dzTdaE','status','8EbAuBG','userId','2612196xrUnru','tenantCode','12158efTSgn','get','username','values','set','2951583MadElN','109596NkRGYh','MEMBER','role','9564261cbKAGB','nickname','48ClImvt','displayName','7379210SMeCsp','trim','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','some','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','validation','isFinite','85PWeEkC'];a246_0xbfbc=function(){return _0x547042;};return a246_0xbfbc();}import{CliErrors}from'../../errors.js';function textOrNull(_0x1a9e26){const _0xa969d0=a246_0xe6ee,_0x3cafb8=_0x1a9e26?.[_0xa969d0(0x1c4)]();return _0x3cafb8?_0x3cafb8:null;}export function projectTenantMembers(_0x50146b){const _0x73a908=a246_0xe6ee,_0x6fc41c=new Map();for(const _0x515c05 of _0x50146b){const _0x1cd048=Number(_0x515c05[_0x73a908(0x1cf)]);if(!Number[_0x73a908(0x1c9)](_0x1cd048)||_0x1cd048<=0x0)continue;const _0x5d5d8b={'userId':_0x1cd048,'username':textOrNull(_0x515c05[_0x73a908(0x1d4)]),'displayName':textOrNull(_0x515c05[_0x73a908(0x1c0)]),'role':_0x515c05['adminFlag']===!![]?_0x73a908(0x1cb):_0x73a908(0x1d9),'status':textOrNull(_0x515c05[_0x73a908(0x1cd)])},_0x5dc080=_0x6fc41c[_0x73a908(0x1d3)](_0x1cd048);if(!_0x5dc080){_0x6fc41c[_0x73a908(0x1d6)](_0x1cd048,_0x5d5d8b);continue;}_0x5dc080[_0x73a908(0x1d4)]??=_0x5d5d8b[_0x73a908(0x1d4)],_0x5dc080[_0x73a908(0x1c2)]??=_0x5d5d8b['displayName'],_0x5dc080[_0x73a908(0x1cd)]??=_0x5d5d8b[_0x73a908(0x1cd)];if(_0x5d5d8b[_0x73a908(0x1da)]===_0x73a908(0x1cb))_0x5dc080['role']=_0x73a908(0x1cb);}return[..._0x6fc41c[_0x73a908(0x1d5)]()]['sort']((_0x8ba009,_0x15853)=>_0x8ba009['userId']-_0x15853[_0x73a908(0x1cf)]);}export function assertTenantAccessible(_0x19d8b8,_0x33c821){const _0x393229=a246_0xe6ee;if(_0x33c821[_0x393229(0x1c6)](_0x322579=>_0x322579[_0x393229(0x1d1)]===_0x19d8b8))return;throw CliErrors[_0x393229(0x1c8)]('Tenant\x20\x22'+_0x19d8b8+_0x393229(0x1c7),_0x393229(0x1c5));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a247_0x2d8be9=a247_0x4468;(function(_0x3c6ae7,_0x6571c){const _0x2393c4=a247_0x4468,_0x4bb231=_0x3c6ae7();while(!![]){try{const _0x189682=parseInt(_0x2393c4(0x1bf))/0x1*(-parseInt(_0x2393c4(0x1c7))/0x2)+-parseInt(_0x2393c4(0x1af))/0x3+-parseInt(_0x2393c4(0x1b0))/0x4+parseInt(_0x2393c4(0x1be))/0x5*(-parseInt(_0x2393c4(0x1bd))/0x6)+-parseInt(_0x2393c4(0x1ac))/0x7*(-parseInt(_0x2393c4(0x1b4))/0x8)+-parseInt(_0x2393c4(0x1b6))/0x9*(parseInt(_0x2393c4(0x1c3))/0xa)+-parseInt(_0x2393c4(0x1bc))/0xb*(-parseInt(_0x2393c4(0x1b1))/0xc);if(_0x189682===_0x6571c)break;else _0x4bb231['push'](_0x4bb231['shift']());}catch(_0x57860b){_0x4bb231['push'](_0x4bb231['shift']());}}}(a247_0x1450,0x5ec94));function a247_0x4468(_0x5449b2,_0x3ea267){_0x5449b2=_0x5449b2-0x1ac;const _0x14501c=a247_0x1450();let _0x446852=_0x14501c[_0x5449b2];return _0x446852;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a247_0x2d8be9(0x1b5),CURRENT_BINDING_WARNING=a247_0x2d8be9(0x1bb);function readDingTalkUserId(_0x1b08d0){const _0x300b4d=a247_0x2d8be9,_0x4df058=_0x1b08d0[_0x300b4d(0x1c1)](_0x300b4d(0x1b3))[_0x300b4d(0x1ba)]();if(!_0x4df058)throw CliErrors[_0x300b4d(0x1ae)](_0x300b4d(0x1b2),_0x300b4d(0x1b7));return _0x4df058;}function buildBindingData(_0xcc26a9,_0x193636){const _0xab62fb=a247_0x2d8be9;return{'operation':'bind','selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xcc26a9},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xcc26a9,'bound':!![]},'dryRun':_0x193636,'backend':{'method':_0xab62fb(0x1c6),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a247_0x2d8be9(0x1ad),'command':a247_0x2d8be9(0x1b8),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':a247_0x2d8be9(0x1b9),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a247_0x2d8be9(0x1b3),'type':'string','required':!![],'description':a247_0x2d8be9(0x1c5)}],async 'validate'(_0x4c99a3){readDingTalkUserId(_0x4c99a3);},async 'dryRun'(_0x327658){const _0x353d08=readDingTalkUserId(_0x327658);return asDryRunResult(buildBindingData(_0x353d08,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x27eedc){const _0x12bae5=a247_0x2d8be9,_0x5aba08=readDingTalkUserId(_0x27eedc),_0x2c2691=await bindDingTalkSandboxAccount(_0x5aba08);if(_0x2c2691!==!![])throw CliErrors['apiError'](_0x12bae5(0x1c2),_0x12bae5(0x1c0));return{'ok':!![],'data':buildBindingData(_0x5aba08,![]),'message':_0x12bae5(0x1c4)};}};function a247_0x1450(){const _0x129a76=['ding-talk-user-id','8KifsPD','dingtalk','219717LwExKx','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','dingding-sandbox-bind','write','trim','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','20190005aIiiba','35052PuTjRT','155pSSDxb','1dtbBgP','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','str','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','180erNGSL','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','POST','1308170OzTbkN','3043383tjyXCa','user-account','validation','1058685fasYPu','1017856ESJrYb','12RGxIFC','--ding-talk-user-id\x20cannot\x20be\x20empty.'];a247_0x1450=function(){return _0x129a76;};return a247_0x1450();}
|