@lovrabet/rabetbase-cli 2.5.2 → 2.5.3-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.d.ts +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.d.ts +2 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/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.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/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/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/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.d.ts +23 -0
- package/lib/config/region-config.js +1 -0
- package/lib/config/schema.d.ts +15 -0
- 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 +6 -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 +13 -0
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +172 -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/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.d.ts +6 -0
- package/lib/core/page/lr-smart-jsx.js +1 -0
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.d.ts +2 -8
- 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.d.ts +2 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +27 -8
- 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/page-development-workflow.md +3 -0
- package/skills/rabetbase/guides/sdk-client-generation.md +6 -5
- package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +290 -0
- package/skills/rabetbase/knowledge/page-schema/LrSmartJsx.md +11 -3
- package/skills/rabetbase/references/rabetbase-api-pull.md +5 -4
- package/skills/rabetbase/references/rabetbase-app-list.md +3 -0
- package/skills/rabetbase/references/rabetbase-bff-create.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-list.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-logs.md +47 -0
- package/skills/rabetbase/references/rabetbase-bff-pull.md +9 -3
- package/skills/rabetbase/references/rabetbase-bff-push.md +10 -2
- package/skills/rabetbase/references/rabetbase-bff-status.md +2 -0
- package/skills/rabetbase/references/rabetbase-config.md +10 -9
- package/skills/rabetbase/references/rabetbase-dataset-generate.md +52 -2
- package/skills/rabetbase/references/rabetbase-doctor.md +2 -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-page-push.md +5 -1
- package/skills/rabetbase/references/rabetbase-workspace.md +4 -2
- package/skills/rabetbase.manifest.json +9 -3
- package/templates/generate-api/client.ts.tpl +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a221_0xaec108=a221_0x381b;(function(_0x100ebf,_0x3d790a){const _0x45c74b=a221_0x381b,_0x11c969=_0x100ebf();while(!![]){try{const _0xb13e07=parseInt(_0x45c74b(0xd3))/0x1+-parseInt(_0x45c74b(0xdf))/0x2*(parseInt(_0x45c74b(0xd5))/0x3)+-parseInt(_0x45c74b(0xe2))/0x4*(-parseInt(_0x45c74b(0xdb))/0x5)+-parseInt(_0x45c74b(0xec))/0x6+-parseInt(_0x45c74b(0xe9))/0x7+-parseInt(_0x45c74b(0xe6))/0x8+parseInt(_0x45c74b(0xe1))/0x9;if(_0xb13e07===_0x3d790a)break;else _0x11c969['push'](_0x11c969['shift']());}catch(_0x2afae1){_0x11c969['push'](_0x11c969['shift']());}}}(a221_0x2b35,0xa1285));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';function a221_0x381b(_0xbbb326,_0xeb9d38){_0xbbb326=_0xbbb326-0xc9;const _0x2b3500=a221_0x2b35();let _0x381b02=_0x2b3500[_0xbbb326];return _0x381b02;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a221_0xaec108(0xd1),'command':a221_0xaec108(0xcd),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a221_0xaec108(0xd4),'flags':[SQLCODE_FLAG],async 'validate'(_0x10e616){const _0x343306=a221_0xaec108,_0xc9ba9d=loadSqlProjectConfig(_0x10e616[_0x343306(0xda)]),_0x4d38d3=await readSqlLockFile(_0xc9ba9d[_0x343306(0xde)]);if(!_0x4d38d3)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x530380){const _0x5a8a3f=a221_0xaec108,_0x32ad56=loadSqlProjectConfig(_0x530380['appCode']),_0x416706=await readSqlLockFile(_0x32ad56[_0x5a8a3f(0xde)]);if(!_0x416706)throw CliErrors['validation'](_0x5a8a3f(0xcf));const {appLock:_0xc3a1a8}=ensureSqlLockScope(_0x416706,_0x530380[_0x5a8a3f(0xda)],_0x32ad56[_0x5a8a3f(0xcc)],_0x5a8a3f(0xcd)),_0x533de3=_0x530380[_0x5a8a3f(0xe7)](_0x5a8a3f(0xe5)),_0x23c74d=_0xc3a1a8['sqls'][_0x533de3];if(!_0x23c74d)throw CliErrors[_0x5a8a3f(0xdc)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x533de3+'\x22.');return{'method':_0x5a8a3f(0xea),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x533de3,'id':_0x23c74d[_0x5a8a3f(0xd6)],'localPath':resolveLocalSqlFilePath(_0x32ad56,_0x533de3,_0x23c74d)},'description':_0x5a8a3f(0xca)+_0x533de3+_0x5a8a3f(0xe4)+_0x32ad56[_0x5a8a3f(0xe0)]};},async 'execute'(_0x268d51){const _0x5a34c5=a221_0xaec108,_0xe9bb71=loadSqlProjectConfig(_0x268d51[_0x5a34c5(0xda)]),_0x4f6875=await readSqlLockFile(_0xe9bb71[_0x5a34c5(0xde)]);if(!_0x4f6875)throw CliErrors[_0x5a34c5(0xdc)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x283b73,appLock:_0x355d41}=ensureSqlLockScope(_0x4f6875,_0x268d51[_0x5a34c5(0xda)],_0xe9bb71[_0x5a34c5(0xcc)],'delete'),_0xe0865c=_0x268d51[_0x5a34c5(0xe7)](_0x5a34c5(0xe5)),_0x3caf4f=_0x355d41[_0x5a34c5(0xd7)][_0xe0865c];if(!_0x3caf4f)throw CliErrors[_0x5a34c5(0xdc)](_0x5a34c5(0xeb)+_0xe0865c+'\x22.');await deleteSqlQuery({'id':_0x3caf4f['remoteId'],'sqlCode':_0xe0865c}),_0x355d41['sqls']=Object[_0x5a34c5(0xdd)](Object[_0x5a34c5(0xe8)](_0x355d41[_0x5a34c5(0xd7)])[_0x5a34c5(0xd9)](([_0x157603])=>_0x157603!==_0xe0865c)),_0x355d41['lastSync']=new Date()[_0x5a34c5(0xd0)](),await writeSqlLockFile(_0xe9bb71[_0x5a34c5(0xde)],_0x283b73);const _0x3b1bda=resolveLocalSqlFilePath(_0xe9bb71,_0xe0865c,_0x3caf4f);let _0x3d9da0;await fileExists(_0x3b1bda)&&(_0x3d9da0=await moveToTrash(_0xe9bb71[_0x5a34c5(0xd2)],_0xe9bb71[_0x5a34c5(0xe0)],_0x3b1bda),await cleanupEmptyDirectories(dirname(_0x3b1bda),_0xe9bb71[_0x5a34c5(0xce)]));const _0x502733={'deleted':_0xe0865c,'remoteId':_0x3caf4f['remoteId']};if(_0x3d9da0)_0x502733[_0x5a34c5(0xd8)]=_0x3d9da0;return{'ok':!![],'data':_0x502733,'message':_0x5a34c5(0xcb)+_0xe0865c+(_0x3d9da0?_0x5a34c5(0xc9):'')};}};async function moveToTrash(_0x44bc29,_0xb33de,_0x1f8a41){const _0x5b7c99=a221_0xaec108,_0x66299e=new Date()[_0x5b7c99(0xd0)]()[_0x5b7c99(0xe3)](/[:.]/g,'-'),_0x38a37a=relative(_0x44bc29,_0x1f8a41),_0x253a36=join(_0xb33de,_0x66299e,_0x38a37a);return await mkdir(dirname(_0x253a36),{'recursive':!![]}),await rename(_0x1f8a41,_0x253a36),_0x253a36;}function a221_0x2b35(){const _0x334823=['SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','toISOString','sql','projectRoot','318462aFIfJm','high-risk-write','15XgRLRJ','remoteId','sqls','trashedTo','filter','appCode','955TkUPUt','validation','fromEntries','lockFilePath','506362ciUWzE','trashDir','28708749SYesxR','2964KRyDEk','replace','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','sqlcode','7313624HZHDYu','str','entries','2937998EORKDb','POST','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','2339586hVClQc','\x20(local\x20file\x20moved\x20to\x20trash)','Would\x20delete\x20SQL\x20','Deleted\x20','sqlRoot','delete','sqlRootDir'];a221_0x2b35=function(){return _0x334823;};return a221_0x2b35();}async function cleanupEmptyDirectories(_0x3aa97a,_0x42e711){let _0x4fd876=resolve(_0x3aa97a);const _0x24286f=resolve(_0x42e711);while(_0x4fd876['startsWith'](''+_0x24286f+sep)||_0x4fd876===_0x24286f){if(_0x4fd876===_0x24286f)return;try{const _0xfaabf6=await readdir(_0x4fd876);if(_0xfaabf6['length']>0x0)return;await rmdir(_0x4fd876);}catch{return;}_0x4fd876=dirname(_0x4fd876);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a222_0x4f0b52=a222_0x447c;(function(_0x340912,_0x3eb730){const _0x3b345d=a222_0x447c,_0x2abe65=_0x340912();while(!![]){try{const _0x43e67e=parseInt(_0x3b345d(0x1c1))/0x1+-parseInt(_0x3b345d(0x1d4))/0x2*(-parseInt(_0x3b345d(0x1cc))/0x3)+-parseInt(_0x3b345d(0x1c7))/0x4*(parseInt(_0x3b345d(0x1d0))/0x5)+-parseInt(_0x3b345d(0x1c4))/0x6+-parseInt(_0x3b345d(0x1c8))/0x7*(parseInt(_0x3b345d(0x1d1))/0x8)+parseInt(_0x3b345d(0x1cf))/0x9*(parseInt(_0x3b345d(0x1c5))/0xa)+parseInt(_0x3b345d(0x1ce))/0xb;if(_0x43e67e===_0x3eb730)break;else _0x2abe65['push'](_0x2abe65['shift']());}catch(_0x1b1773){_0x2abe65['push'](_0x2abe65['shift']());}}}(a222_0x8455,0xb3ead));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a222_0x447c(_0x3d64d1,_0x2e248b){_0x3d64d1=_0x3d64d1-0x1c0;const _0x84551=a222_0x8455();let _0x447c41=_0x84551[_0x3d64d1];return _0x447c41;}function a222_0x8455(){const _0x34935b=['11821623psooqB','81pCKTpa','14225PVAdyC','32CAXWpx','sqlcode','description','232534IosBQO','sqlName','appCode','833914kivLGQ','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','verbose','5021340NXczVw','319040UDcYzF','sql','1796SksAmd','277158FvtBwD','sqlCode','Return\x20full\x20raw\x20SQL\x20query\x20object','read','21XoLeSG','dbId'];a222_0x8455=function(){return _0x34935b;};return a222_0x8455();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a222_0x4f0b52(0x1c6),'command':'detail','description':a222_0x4f0b52(0x1c2),'risk':a222_0x4f0b52(0x1cb),'flags':[SQLCODE_FLAG,{'name':a222_0x4f0b52(0x1c3),'type':'boolean','description':a222_0x4f0b52(0x1ca)}],async 'execute'(_0x9e72c0){const _0x445fa8=a222_0x4f0b52,_0x1d3345=await getSqlQueryInfo(_0x9e72c0[_0x445fa8(0x1c0)],_0x9e72c0['str'](_0x445fa8(0x1d2))),_0x1e9afc=_0x9e72c0['bool']('verbose');if(_0x1e9afc)return{'ok':!![],'data':_0x1d3345};const _0x506dda=_0x1d3345[_0x445fa8(0x1cd)]?await getDbName(_0x9e72c0[_0x445fa8(0x1c0)],_0x1d3345['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x1d3345[_0x445fa8(0x1c9)],'sqlName':_0x1d3345[_0x445fa8(0x1d5)],'db':_0x506dda?_0x506dda+'\x20('+_0x1d3345[_0x445fa8(0x1cd)]+')':_0x1d3345[_0x445fa8(0x1cd)]??'','description':_0x1d3345[_0x445fa8(0x1d3)]??'','sqlContent':_0x1d3345['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a223_0x2bc08b=a223_0x10ae;(function(_0x5b600e,_0x5decf0){const _0x241a91=a223_0x10ae,_0x5bf4d0=_0x5b600e();while(!![]){try{const _0xe4151d=-parseInt(_0x241a91(0x124))/0x1+-parseInt(_0x241a91(0x11a))/0x2+-parseInt(_0x241a91(0x126))/0x3+-parseInt(_0x241a91(0x127))/0x4+-parseInt(_0x241a91(0x11e))/0x5*(parseInt(_0x241a91(0x120))/0x6)+-parseInt(_0x241a91(0x112))/0x7*(parseInt(_0x241a91(0x116))/0x8)+parseInt(_0x241a91(0x115))/0x9;if(_0xe4151d===_0x5decf0)break;else _0x5bf4d0['push'](_0x5bf4d0['shift']());}catch(_0x869a17){_0x5bf4d0['push'](_0x5bf4d0['shift']());}}}(a223_0x5ab6,0x618b0));import{executeSql}from'../../core/api-client.js';function a223_0x5ab6(){const _0x299799=['string','153520QiLSlJ','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','appCode','execResult','355AMXZLo','now','38196lPyBZV','sql','length','isArray','646831IkUeds','SQL\x20execution\x20failed','412374Csanrr','89836NtmRjX','56OqYyuq','params','str','16624638qNAtXT','112152JqdsNc','read','execSuccess'];a223_0x5ab6=function(){return _0x299799;};return a223_0x5ab6();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a223_0x10ae(_0x2462db,_0x1c51f7){_0x2462db=_0x2462db-0x112;const _0x5ab6d3=a223_0x5ab6();let _0x10aea5=_0x5ab6d3[_0x2462db];return _0x10aea5;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a223_0x2bc08b(0x121),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a223_0x2bc08b(0x117),'flags':[SQLCODE_FLAG,{'name':a223_0x2bc08b(0x113),'type':a223_0x2bc08b(0x119),'description':a223_0x2bc08b(0x11b)}],async 'execute'(_0x51a1ff){const _0x253bd2=a223_0x2bc08b,_0x596808=parseJsonParams(_0x51a1ff[_0x253bd2(0x114)](_0x253bd2(0x113))),_0x4e4c54=Date[_0x253bd2(0x11f)](),_0x2457e4=await executeSql(_0x51a1ff[_0x253bd2(0x11c)],_0x51a1ff[_0x253bd2(0x114)]('sqlcode'),_0x596808),_0x538f79=Date[_0x253bd2(0x11f)]()-_0x4e4c54,_0xfd6448=_0x2457e4?.[_0x253bd2(0x11d)]??_0x2457e4,_0x1cdd73=_0x2457e4?.[_0x253bd2(0x118)]??!![];if(!_0x1cdd73)return{'ok':![],'data':{'error':_0x2457e4?.['execError']||_0x253bd2(0x125),'elapsed':_0x538f79},'message':_0x253bd2(0x125)};const _0x5a61d5=Array[_0x253bd2(0x123)](_0xfd6448)?_0xfd6448:[];return{'ok':!![],'data':{'rows':_0x5a61d5,'rowCount':_0x5a61d5[_0x253bd2(0x122)],'elapsed':_0x538f79},'message':'Returned\x20'+_0x5a61d5[_0x253bd2(0x122)]+'\x20row(s)\x20in\x20'+_0x538f79+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4d0bed,_0xc22b5b){const _0xc8a2be=a224_0xedcc,_0x163d89=_0x4d0bed();while(!![]){try{const _0x20740f=-parseInt(_0xc8a2be(0x87))/0x1*(-parseInt(_0xc8a2be(0x86))/0x2)+-parseInt(_0xc8a2be(0x7f))/0x3+-parseInt(_0xc8a2be(0x80))/0x4*(-parseInt(_0xc8a2be(0x83))/0x5)+-parseInt(_0xc8a2be(0x88))/0x6+-parseInt(_0xc8a2be(0x85))/0x7+-parseInt(_0xc8a2be(0x84))/0x8*(parseInt(_0xc8a2be(0x82))/0x9)+-parseInt(_0xc8a2be(0x81))/0xa*(-parseInt(_0xc8a2be(0x89))/0xb);if(_0x20740f===_0xc22b5b)break;else _0x163d89['push'](_0x163d89['shift']());}catch(_0x2ee4a0){_0x163d89['push'](_0x163d89['shift']());}}}(a224_0x2a27,0x423b0));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a224_0xedcc(_0x50c95e,_0x5aaf0b){_0x50c95e=_0x50c95e-0x7f;const _0x2a275a=a224_0x2a27();let _0xedccbc=_0x2a275a[_0x50c95e];return _0xedccbc;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a224_0x2a27(){const _0x3136f7=['2433466KzQHsp','2334rsLhuu','73nbfYcN','2761188XUbhxU','22RyaViw','261576DlVlgm','8PtnpRw','4284580EWYMxT','318753NwSSDK','826130yDvruu','24gDwfDC'];a224_0x2a27=function(){return _0x3136f7;};return a224_0x2a27();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a225_0x52779c=a225_0x48a7;function a225_0x1f21(){const _0x2349ec=['paging','2192KlBKuw','13704400ocgbgs','pagesize','sqlcode','176844AWPkcd','list','appCode','str','name','string','bool','boolean','sqlName','1589535JtuVPo','read','verbose','No\x20custom\x20SQL\x20queries\x20found.','sqlCode','tableData','List\x20custom\x20SQL\x20queries','12327KKQIGO','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','all','sql','Found\x20','number','dbId','map','245OkoOyF','\x20SQL\x20queries\x20(total:\x20','length','1261196ueqmII','Filter\x20by\x20SQL\x20name','1180NrOEWC','totalCount','65418wcOOxV','45063Qytnio','page','description'];a225_0x1f21=function(){return _0x2349ec;};return a225_0x1f21();}(function(_0xa30ce2,_0xe42670){const _0x201b5a=a225_0x48a7,_0x5450b8=_0xa30ce2();while(!![]){try{const _0x57c888=parseInt(_0x201b5a(0x15f))/0x1+-parseInt(_0x201b5a(0x17a))/0x2+parseInt(_0x201b5a(0x16f))/0x3*(parseInt(_0x201b5a(0x17c))/0x4)+-parseInt(_0x201b5a(0x168))/0x5+-parseInt(_0x201b5a(0x17e))/0x6*(-parseInt(_0x201b5a(0x177))/0x7)+parseInt(_0x201b5a(0x15b))/0x8*(-parseInt(_0x201b5a(0x157))/0x9)+parseInt(_0x201b5a(0x15c))/0xa;if(_0x57c888===_0xe42670)break;else _0x5450b8['push'](_0x5450b8['shift']());}catch(_0x211ab3){_0x5450b8['push'](_0x5450b8['shift']());}}}(a225_0x1f21,0xc858d));import{listSqlQueries}from'../../core/api-client.js';function a225_0x48a7(_0x44200a,_0x4190c0){_0x44200a=_0x44200a-0x157;const _0x1f2124=a225_0x1f21();let _0x48a7cf=_0x1f2124[_0x44200a];return _0x48a7cf;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a225_0x52779c(0x172),'command':a225_0x52779c(0x160),'description':a225_0x52779c(0x16e),'risk':a225_0x52779c(0x169),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a225_0x52779c(0x164),'description':a225_0x52779c(0x17b)},{'name':a225_0x52779c(0x158),'type':a225_0x52779c(0x174),'description':'Page\x20number','default':0x1},{'name':a225_0x52779c(0x15d),'type':a225_0x52779c(0x174),'description':'Page\x20size'},{'name':a225_0x52779c(0x16a),'type':a225_0x52779c(0x166),'description':a225_0x52779c(0x170)}],async 'execute'(_0x2a0298){const _0x168947=a225_0x52779c,_0x317c16=await listSqlQueries(_0x2a0298['appCode'],{'sqlCode':_0x2a0298[_0x168947(0x162)](_0x168947(0x15e))||undefined,'sqlName':_0x2a0298[_0x168947(0x162)](_0x168947(0x163))||undefined,'currentPage':_0x2a0298['num']('page'),'pageSize':_0x2a0298['num']('pagesize',0x32)}),_0x2b3973=_0x2a0298[_0x168947(0x165)](_0x168947(0x16a)),_0x457252=_0x317c16[_0x168947(0x16d)]??[],_0x35a841=_0x317c16[_0x168947(0x15a)]?.[_0x168947(0x17d)]??_0x457252[_0x168947(0x179)];let _0x33e110;return _0x2b3973?_0x33e110=_0x457252:_0x33e110=await Promise[_0x168947(0x171)](_0x457252[_0x168947(0x176)](async _0x27097e=>{const _0x632257=_0x168947;let _0x48b466;try{_0x48b466=_0x27097e[_0x632257(0x175)]?await getDbName(_0x2a0298[_0x632257(0x161)],_0x27097e[_0x632257(0x175)]):undefined;}catch{}return{'sqlCode':_0x27097e[_0x632257(0x16c)],'sqlName':_0x27097e[_0x632257(0x167)],'description':_0x27097e[_0x632257(0x159)]??'','db':_0x48b466?_0x48b466+'\x20('+_0x27097e['dbId']+')':_0x27097e[_0x632257(0x175)]??''};})),{'ok':!![],'data':_0x33e110,'message':_0x457252[_0x168947(0x179)]===0x0?_0x168947(0x16b):_0x168947(0x173)+_0x457252[_0x168947(0x179)]+_0x168947(0x178)+_0x35a841+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a212_0x461c(){const _0x1f9351=['skipped','Filter\x20by\x20SQL\x20display\x20name','8MmeJie','message','push','split','str','Would\x20pull\x20','boolean','local\x20differs\x20from\x20remote','utf8','dbId','Force\x20pull\x20cancelled.','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','force','104FIVVvN','\x20skipped,\x20','trimStart','sqlContent','join','sqls','612378yZndHQ','602631ebXuRn','read','sqlRootDir','bool','\x20SQL\x20file(s)\x20into\x20','lockFilePath','sqlName','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','conflict','description','catch','replace','708rgiNFI','sqlcode','POST','535975wiTZnR','sqlCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sql','4kOEMwY','3614292bZEGJb','string','Force\x20overwrite\x20local\x20unsynced\x20changes','86884tEFbXy','sqlRoot','mybatisXml','pull','10347440lQZZKm','name','path','length','totalCount','2437195suMwaJ','tableData','nonInteractive','unchanged','toISOString','test','appCode','apps'];a212_0x461c=function(){return _0x1f9351;};return a212_0x461c();}const a212_0x14db3a=a212_0x41b1;(function(_0x409ab3,_0x102035){const _0x159406=a212_0x41b1,_0x5c6bce=_0x409ab3();while(!![]){try{const _0x54dd3d=parseInt(_0x159406(0x1be))/0x1*(parseInt(_0x159406(0x194))/0x2)+parseInt(_0x159406(0x195))/0x3+-parseInt(_0x159406(0x1ab))/0x4*(parseInt(_0x159406(0x1a1))/0x5)+-parseInt(_0x159406(0x18d))/0x6*(-parseInt(_0x159406(0x198))/0x7)+-parseInt(_0x159406(0x1b8))/0x8*(parseInt(_0x159406(0x1bf))/0x9)+-parseInt(_0x159406(0x19c))/0xa+-parseInt(_0x159406(0x190))/0xb;if(_0x54dd3d===_0x102035)break;else _0x5c6bce['push'](_0x5c6bce['shift']());}catch(_0x151dbe){_0x5c6bce['push'](_0x5c6bce['shift']());}}}(a212_0x461c,0xebaca));import{readFile,rm,writeFile}from'node:fs/promises';function a212_0x41b1(_0x108a42,_0x4a8133){_0x108a42=_0x108a42-0x184;const _0x461c83=a212_0x461c();let _0x41b131=_0x461c83[_0x108a42];return _0x41b131;}import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0xb276a8,_0x324423){const _0x2a4837=a212_0x41b1,_0x247e87=[];let _0x54e2e3=0x1;while(!![]){const _0x221334=await listSqlQueries(_0xb276a8,{'currentPage':_0x54e2e3,'pageSize':PAGE_SIZE,'sqlCode':_0x324423[_0x2a4837(0x191)],'sqlName':_0x324423['sqlName']}),_0x32b9ec=_0x221334[_0x2a4837(0x1a2)]??[];_0x247e87[_0x2a4837(0x1ad)](..._0x32b9ec);if(_0x32b9ec[_0x2a4837(0x19f)]===0x0)break;const _0x3bae53=_0x221334['paging']?.[_0x2a4837(0x1a0)];if(_0x3bae53!=null?_0x247e87['length']>=_0x3bae53:_0x32b9ec[_0x2a4837(0x19f)]<PAGE_SIZE)break;_0x54e2e3++;}return _0x247e87;}async function ensureSqlContent(_0x3bc194){const _0x144ef5=a212_0x41b1;if(_0x3bc194[_0x144ef5(0x1bb)]!=null&&String(_0x3bc194[_0x144ef5(0x1bb)])[_0x144ef5(0x19f)]>0x0)return _0x3bc194;return getSqlQueryDetail(_0x3bc194[_0x144ef5(0x191)]);}export const sqlPull={'service':a212_0x14db3a(0x193),'command':'pull','description':a212_0x14db3a(0x192),'risk':a212_0x14db3a(0x1c0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a212_0x14db3a(0x196),'description':a212_0x14db3a(0x1aa)},{'name':a212_0x14db3a(0x1b7),'type':a212_0x14db3a(0x1b1),'description':a212_0x14db3a(0x197)}],async 'dryRun'(_0x340c94){const _0x28fb8c=a212_0x14db3a,_0x7447f8=loadSqlProjectConfig(_0x340c94[_0x28fb8c(0x1a7)]),_0x3157bc=await readSqlLockFile(_0x7447f8[_0x28fb8c(0x186)]),{appLock:_0x418318}=ensureSqlLockScope(_0x3157bc??createEmptySqlLock(),_0x7447f8['appCode'],_0x7447f8[_0x28fb8c(0x199)],_0x28fb8c(0x19b)),_0x546317=await fetchAllSqlQueries(_0x340c94[_0x28fb8c(0x1a7)],{'sqlCode':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x18e))||undefined,'sqlName':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x19d))||undefined}),_0x42961c=[];for(const _0x1d2435 of _0x546317){const _0x42fab5=await ensureSqlContent(_0x1d2435),_0xf6723a=ensureRemoteSqlContent(_0x42fab5),_0x4d6fc0=detectModeFromSql(_0x42fab5),_0x35fda4=_0x42fab5['dbId']?await getDbName(_0x340c94[_0x28fb8c(0x1a7)],Number(_0x42fab5['dbId']))[_0x28fb8c(0x18b)](()=>undefined):undefined,_0x3f1921=buildLocalSqlFileContent({'sqlCode':_0x42fab5[_0x28fb8c(0x191)],'sqlName':_0x42fab5['sqlName'],'dbId':_0x42fab5[_0x28fb8c(0x1b4)]},_0xf6723a,{'dbName':_0x35fda4,'mode':_0x4d6fc0,'syncedAt':new Date()[_0x28fb8c(0x1a5)](),'description':_0x42fab5[_0x28fb8c(0x18a)]}),_0x4cdedc=buildSqlLockEntry(_0x42fab5,_0xf6723a,'',{'dbName':_0x35fda4}),_0x5443cb=resolveLocalSqlFilePath(_0x7447f8,_0x42fab5[_0x28fb8c(0x191)],_0x4cdedc);let _0x53554b='would_pull',_0xa73831;if(await fileExists(_0x5443cb)){const _0x46c183=await readFile(_0x5443cb,'utf8');isEquivalentPulledSqlFile(_0x46c183,_0x3f1921,_0x4d6fc0)?(_0x53554b=_0x28fb8c(0x1a9),_0xa73831=_0x28fb8c(0x1a4)):(_0x53554b=_0x28fb8c(0x189),_0xa73831='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x42961c[_0x28fb8c(0x1ad)]({'sqlCode':_0x42fab5[_0x28fb8c(0x191)],'sqlName':_0x42fab5['sqlName'],'filePath':_0x5443cb,'status':_0x53554b,'reason':_0xa73831});}return{'method':_0x28fb8c(0x18f),'url':_0x28fb8c(0x1b6),'body':{'appCode':_0x340c94[_0x28fb8c(0x1a7)],'sqlCode':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x18e))||null,'sqlName':_0x340c94['str'](_0x28fb8c(0x19d))||null,'files':_0x42961c},'description':_0x28fb8c(0x1b0)+_0x42961c[_0x28fb8c(0x19f)]+_0x28fb8c(0x185)+_0x7447f8[_0x28fb8c(0x1c1)]};},async 'execute'(_0x53f97b){const _0x3f98ce=a212_0x14db3a,_0x19d223=loadSqlProjectConfig(_0x53f97b[_0x3f98ce(0x1a7)]),_0x233ec4=await readSqlLockFile(_0x19d223[_0x3f98ce(0x186)]),{lockData:_0x17bd43,appLock:_0x5ec5bc}=ensureSqlLockScope(_0x233ec4??createEmptySqlLock(),_0x19d223['appCode'],_0x19d223['sqlRoot'],_0x3f98ce(0x19b)),_0x32f602=_0x53f97b[_0x3f98ce(0x184)]('force'),_0x35a9c3=await fetchAllSqlQueries(_0x53f97b[_0x3f98ce(0x1a7)],{'sqlCode':_0x53f97b[_0x3f98ce(0x1af)]('sqlcode')||undefined,'sqlName':_0x53f97b['str'](_0x3f98ce(0x19d))||undefined});if(_0x35a9c3[_0x3f98ce(0x19f)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x40de1c=[],_0x579cbd=[];for(const _0x5d610c of _0x35a9c3){try{_0x40de1c['push'](await ensureSqlContent(_0x5d610c));}catch(_0x27bdc0){_0x579cbd[_0x3f98ce(0x1ad)]({'sqlCode':_0x5d610c['sqlCode'],'error':_0x27bdc0 instanceof Error?_0x27bdc0[_0x3f98ce(0x1ac)]:String(_0x27bdc0)});}}if(_0x32f602&&!_0x53f97b[_0x3f98ce(0x1a3)]){let _0x3bda49=![];for(const _0x2155e3 of _0x40de1c){const _0xcfaaa0=detectModeFromSql(_0x2155e3),_0x2ba70d=_0x2155e3[_0x3f98ce(0x1b4)]?await getDbName(_0x53f97b[_0x3f98ce(0x1a7)],Number(_0x2155e3['dbId']))[_0x3f98ce(0x18b)](()=>undefined):undefined,_0x9c7c76=buildLocalSqlFileContent({'sqlCode':_0x2155e3[_0x3f98ce(0x191)],'sqlName':_0x2155e3[_0x3f98ce(0x187)],'dbId':_0x2155e3['dbId']},ensureRemoteSqlContent(_0x2155e3),{'dbName':_0x2ba70d,'mode':_0xcfaaa0,'syncedAt':new Date()[_0x3f98ce(0x1a5)](),'description':_0x2155e3[_0x3f98ce(0x18a)]}),_0x48c904=resolveLocalSqlFilePath(_0x19d223,_0x2155e3['sqlCode'],buildSqlLockEntry(_0x2155e3,ensureRemoteSqlContent(_0x2155e3),'',{'dbName':_0x2ba70d}));if(await fileExists(_0x48c904)){const _0x4c84c8=await readFile(_0x48c904,_0x3f98ce(0x1b3));if(!isEquivalentPulledSqlFile(_0x4c84c8,_0x9c7c76,_0xcfaaa0)){_0x3bda49=!![];break;}}}if(_0x3bda49){const _0x2f9fe2=await confirmForceOverwrite(_0x3f98ce(0x188));if(!_0x2f9fe2)throw CliErrors['cancelled'](_0x3f98ce(0x1b5));}}const _0x52d1c0=cloneSqlLockData(_0x17bd43),_0x250be6=_0x52d1c0[_0x3f98ce(0x1a8)][_0x19d223[_0x3f98ce(0x1a7)]],_0x4f2f2d=[],_0x4e7f2a=[];for(const _0x16928b of _0x40de1c){const _0x5308fd=_0x250be6[_0x3f98ce(0x1bd)][_0x16928b[_0x3f98ce(0x191)]],_0x48925d=ensureRemoteSqlContent(_0x16928b),_0x2e92ed=detectModeFromSql(_0x16928b),_0x2c1752=_0x16928b[_0x3f98ce(0x1b4)]?await getDbName(_0x53f97b[_0x3f98ce(0x1a7)],Number(_0x16928b['dbId']))['catch'](()=>undefined):undefined,_0x773b6c=buildLocalSqlFileContent({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'sqlName':_0x16928b[_0x3f98ce(0x187)],'dbId':_0x16928b[_0x3f98ce(0x1b4)]},_0x48925d,{'dbName':_0x2c1752,'mode':_0x2e92ed,'syncedAt':new Date()[_0x3f98ce(0x1a5)](),'description':_0x16928b['description']}),_0x2d9513=buildSqlLockEntry(_0x16928b,_0x48925d,computeSqlContentHash(_0x773b6c),{'dbName':_0x2c1752}),_0x2e9ef2=_0x2d9513[_0x3f98ce(0x19e)],_0x4d9643=join(_0x19d223[_0x3f98ce(0x1c1)],_0x2e9ef2);try{if(await fileExists(_0x4d9643)){const _0x390161=await readFile(_0x4d9643,_0x3f98ce(0x1b3));if(isEquivalentPulledSqlFile(_0x390161,_0x773b6c,_0x2e92ed)){_0x4e7f2a['push']({'sqlCode':_0x16928b['sqlCode'],'reason':_0x3f98ce(0x1a4)}),_0x250be6[_0x3f98ce(0x1bd)][_0x16928b[_0x3f98ce(0x191)]]={..._0x2d9513,'hash':computeSqlContentHash(_0x390161),'path':_0x2e9ef2};continue;}if(!_0x32f602){_0x4e7f2a[_0x3f98ce(0x1ad)]({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'reason':_0x3f98ce(0x1b2)});continue;}}const _0x5305e8=_0x5308fd?.[_0x3f98ce(0x19e)]?join(_0x19d223[_0x3f98ce(0x1c1)],_0x5308fd[_0x3f98ce(0x19e)]):undefined;_0x5305e8&&_0x5305e8!==_0x4d9643&&await fileExists(_0x5305e8)&&await rm(_0x5305e8,{'force':!![]}),await ensureParentDirectory(_0x4d9643),await writeFile(_0x4d9643,_0x773b6c,_0x3f98ce(0x1b3)),_0x250be6[_0x3f98ce(0x1bd)][_0x16928b['sqlCode']]={..._0x2d9513,'path':_0x2e9ef2},_0x4f2f2d['push']({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'filePath':_0x4d9643});}catch(_0x25afa6){_0x579cbd[_0x3f98ce(0x1ad)]({'sqlCode':_0x16928b['sqlCode'],'error':_0x25afa6 instanceof Error?_0x25afa6['message']:String(_0x25afa6)});}}return _0x250be6['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x19d223[_0x3f98ce(0x186)],_0x52d1c0),{'ok':_0x579cbd[_0x3f98ce(0x19f)]===0x0,'data':{'pulled':_0x4f2f2d,'skipped':_0x4e7f2a,'failed':_0x579cbd},'message':'Pull\x20complete:\x20'+_0x4f2f2d[_0x3f98ce(0x19f)]+'\x20written,\x20'+_0x4e7f2a[_0x3f98ce(0x19f)]+_0x3f98ce(0x1b9)+_0x579cbd[_0x3f98ce(0x19f)]+'\x20failed'};}};function detectModeFromSql(_0x44e4c8){const _0xe8940c=a212_0x14db3a,_0x1712ff=ensureRemoteSqlContent(_0x44e4c8),_0x585451=stripLocalSqlMetadata(_0x1712ff,_0xe8940c(0x19a))[_0xe8940c(0x1ba)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x585451))return _0xe8940c(0x19a);return'sql';}function isEquivalentPulledSqlFile(_0x4d6db5,_0x386159,_0x669bdf){return normalizePullComparableContent(_0x4d6db5,_0x669bdf)===normalizePullComparableContent(_0x386159,_0x669bdf);}function normalizePullComparableContent(_0x4de56a,_0x21fa5c){const _0x5be104=a212_0x14db3a,_0x53f46c=_0x4de56a[_0x5be104(0x18c)](/\r\n/g,'\x0a')[_0x5be104(0x1ae)]('\x0a'),_0x370b13=_0x53f46c['filter'](_0x15cd53=>!isSyncedAtMetadataLine(_0x15cd53,_0x21fa5c));return _0x370b13[_0x5be104(0x1bc)]('\x0a');}function isSyncedAtMetadataLine(_0x4c7baf,_0x504311){const _0x3ce4c9=a212_0x14db3a;if(_0x504311===_0x3ce4c9(0x19a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3ce4c9(0x1a6)](_0x4c7baf);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x3ce4c9(0x1a6)](_0x4c7baf);}
|
|
1
|
+
const a226_0x28bb34=a226_0x1b12;(function(_0x4808e1,_0x25550e){const _0x2b5948=a226_0x1b12,_0xec9362=_0x4808e1();while(!![]){try{const _0x297b18=-parseInt(_0x2b5948(0xa1))/0x1*(-parseInt(_0x2b5948(0xa0))/0x2)+-parseInt(_0x2b5948(0xb8))/0x3*(-parseInt(_0x2b5948(0x8c))/0x4)+parseInt(_0x2b5948(0xba))/0x5*(parseInt(_0x2b5948(0x9a))/0x6)+-parseInt(_0x2b5948(0x98))/0x7+parseInt(_0x2b5948(0xb0))/0x8+-parseInt(_0x2b5948(0x89))/0x9*(-parseInt(_0x2b5948(0x9b))/0xa)+-parseInt(_0x2b5948(0x92))/0xb;if(_0x297b18===_0x25550e)break;else _0xec9362['push'](_0xec9362['shift']());}catch(_0x443a2d){_0xec9362['push'](_0xec9362['shift']());}}}(a226_0x5a47,0x380e6));function a226_0x5a47(){const _0x56d870=['513060STDZMl','force','push','sqlcode','sqlName','2RAWSDN','429062PQytNz','Pull\x20complete:\x20','\x20skipped,\x20','catch','sqlCode','str','POST','cancelled','sqlRootDir','message','paging','boolean','toISOString','tableData','\x20failed','2866760GwBNPK','appCode','would_pull','sql','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','read','pull','name','3iEojXl','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','185sAUZwp','No\x20remote\x20SQL\x20queries\x20matched.','length','replace','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','mybatisXml','path','test','local\x20differs\x20from\x20remote','skipped','utf8','lockFilePath','unchanged','dbId','36qtVqmi','sqlRoot','description','398540mAIJtR','string','lastSync','Would\x20pull\x20','sqls','\x20written,\x20','7742867cWZSCN','Force\x20overwrite\x20local\x20unsynced\x20changes','Filter\x20by\x20SQL\x20display\x20name','Force\x20pull\x20cancelled.','split','nonInteractive','1218826DivkZG','filter','2490VJMiPv'];a226_0x5a47=function(){return _0x56d870;};return a226_0x5a47();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0xcd500b,_0x3e689f){const _0x34e048=a226_0x1b12,_0x2b2d72=[];let _0x1c5add=0x1;while(!![]){const _0x1995f0=await listSqlQueries(_0xcd500b,{'currentPage':_0x1c5add,'pageSize':PAGE_SIZE,'sqlCode':_0x3e689f[_0x34e048(0xa5)],'sqlName':_0x3e689f['sqlName']}),_0x3d348a=_0x1995f0[_0x34e048(0xae)]??[];_0x2b2d72[_0x34e048(0x9d)](..._0x3d348a);if(_0x3d348a[_0x34e048(0xbc)]===0x0)break;const _0x3e48a5=_0x1995f0[_0x34e048(0xab)]?.['totalCount'];if(_0x3e48a5!=null?_0x2b2d72[_0x34e048(0xbc)]>=_0x3e48a5:_0x3d348a[_0x34e048(0xbc)]<PAGE_SIZE)break;_0x1c5add++;}return _0x2b2d72;}async function ensureSqlContent(_0x24a13f){const _0x50d6bd=a226_0x1b12;if(_0x24a13f['sqlContent']!=null&&String(_0x24a13f['sqlContent'])[_0x50d6bd(0xbc)]>0x0)return _0x24a13f;return getSqlQueryDetail(_0x24a13f['sqlCode']);}export const sqlPull={'service':a226_0x28bb34(0xb3),'command':'pull','description':a226_0x28bb34(0xb9),'risk':a226_0x28bb34(0xb5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a226_0x28bb34(0x8d),'description':a226_0x28bb34(0x94)},{'name':a226_0x28bb34(0x9c),'type':a226_0x28bb34(0xac),'description':a226_0x28bb34(0x93)}],async 'dryRun'(_0x5cd8ed){const _0x4a0e10=a226_0x28bb34,_0x445693=loadSqlProjectConfig(_0x5cd8ed[_0x4a0e10(0xb1)]),_0x4edd82=await readSqlLockFile(_0x445693['lockFilePath']),{appLock:_0x25f6ca}=ensureSqlLockScope(_0x4edd82??createEmptySqlLock(),_0x445693[_0x4a0e10(0xb1)],_0x445693[_0x4a0e10(0x8a)],'pull'),_0x1382f9=await fetchAllSqlQueries(_0x5cd8ed['appCode'],{'sqlCode':_0x5cd8ed[_0x4a0e10(0xa6)](_0x4a0e10(0x9e))||undefined,'sqlName':_0x5cd8ed[_0x4a0e10(0xa6)](_0x4a0e10(0xb7))||undefined}),_0x5d9926=[];for(const _0x515c14 of _0x1382f9){const _0x22f9e5=await ensureSqlContent(_0x515c14),_0x5a3281=ensureRemoteSqlContent(_0x22f9e5),_0x20ca55=detectModeFromSql(_0x22f9e5),_0x598f9b=_0x22f9e5[_0x4a0e10(0x88)]?await getDbName(_0x5cd8ed[_0x4a0e10(0xb1)],Number(_0x22f9e5[_0x4a0e10(0x88)]))[_0x4a0e10(0xa4)](()=>undefined):undefined,_0x1515cd=buildLocalSqlFileContent({'sqlCode':_0x22f9e5[_0x4a0e10(0xa5)],'sqlName':_0x22f9e5[_0x4a0e10(0x9f)],'dbId':_0x22f9e5[_0x4a0e10(0x88)]},_0x5a3281,{'dbName':_0x598f9b,'mode':_0x20ca55,'syncedAt':new Date()[_0x4a0e10(0xad)](),'description':_0x22f9e5[_0x4a0e10(0x8b)]}),_0x229a7f=buildSqlLockEntry(_0x22f9e5,_0x5a3281,'',{'dbName':_0x598f9b}),_0x5c1f05=resolveLocalSqlFilePath(_0x445693,_0x22f9e5[_0x4a0e10(0xa5)],_0x229a7f);let _0x21d2ef=_0x4a0e10(0xb2),_0x32a211;if(await fileExists(_0x5c1f05)){const _0x9467c2=await readFile(_0x5c1f05,_0x4a0e10(0x85));isEquivalentPulledSqlFile(_0x9467c2,_0x1515cd,_0x20ca55)?(_0x21d2ef=_0x4a0e10(0x84),_0x32a211=_0x4a0e10(0x87)):(_0x21d2ef='conflict',_0x32a211=_0x4a0e10(0x7f));}_0x5d9926['push']({'sqlCode':_0x22f9e5['sqlCode'],'sqlName':_0x22f9e5[_0x4a0e10(0x9f)],'filePath':_0x5c1f05,'status':_0x21d2ef,'reason':_0x32a211});}return{'method':_0x4a0e10(0xa7),'url':_0x4a0e10(0xb4),'body':{'appCode':_0x5cd8ed[_0x4a0e10(0xb1)],'sqlCode':_0x5cd8ed[_0x4a0e10(0xa6)]('sqlcode')||null,'sqlName':_0x5cd8ed[_0x4a0e10(0xa6)]('name')||null,'files':_0x5d9926},'description':_0x4a0e10(0x8f)+_0x5d9926[_0x4a0e10(0xbc)]+'\x20SQL\x20file(s)\x20into\x20'+_0x445693[_0x4a0e10(0xa9)]};},async 'execute'(_0x35f092){const _0x255a93=a226_0x28bb34,_0x21588b=loadSqlProjectConfig(_0x35f092[_0x255a93(0xb1)]),_0x2eb344=await readSqlLockFile(_0x21588b[_0x255a93(0x86)]),{lockData:_0x2b7d19,appLock:_0x1ae898}=ensureSqlLockScope(_0x2eb344??createEmptySqlLock(),_0x21588b[_0x255a93(0xb1)],_0x21588b['sqlRoot'],_0x255a93(0xb6)),_0x1013bf=_0x35f092['bool']('force'),_0x230900=await fetchAllSqlQueries(_0x35f092[_0x255a93(0xb1)],{'sqlCode':_0x35f092[_0x255a93(0xa6)]('sqlcode')||undefined,'sqlName':_0x35f092[_0x255a93(0xa6)](_0x255a93(0xb7))||undefined});if(_0x230900['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x255a93(0xbb)};const _0x5519dc=[],_0x3bc892=[];for(const _0x2b41d1 of _0x230900){try{_0x5519dc['push'](await ensureSqlContent(_0x2b41d1));}catch(_0xa59fbb){_0x3bc892[_0x255a93(0x9d)]({'sqlCode':_0x2b41d1[_0x255a93(0xa5)],'error':_0xa59fbb instanceof Error?_0xa59fbb[_0x255a93(0xaa)]:String(_0xa59fbb)});}}if(_0x1013bf&&!_0x35f092[_0x255a93(0x97)]){let _0x34e2d9=![];for(const _0x387508 of _0x5519dc){const _0x4ad24d=detectModeFromSql(_0x387508),_0x35fe91=_0x387508[_0x255a93(0x88)]?await getDbName(_0x35f092[_0x255a93(0xb1)],Number(_0x387508[_0x255a93(0x88)]))[_0x255a93(0xa4)](()=>undefined):undefined,_0x5854c0=buildLocalSqlFileContent({'sqlCode':_0x387508[_0x255a93(0xa5)],'sqlName':_0x387508['sqlName'],'dbId':_0x387508['dbId']},ensureRemoteSqlContent(_0x387508),{'dbName':_0x35fe91,'mode':_0x4ad24d,'syncedAt':new Date()[_0x255a93(0xad)](),'description':_0x387508[_0x255a93(0x8b)]}),_0x43a46f=resolveLocalSqlFilePath(_0x21588b,_0x387508['sqlCode'],buildSqlLockEntry(_0x387508,ensureRemoteSqlContent(_0x387508),'',{'dbName':_0x35fe91}));if(await fileExists(_0x43a46f)){const _0x188d49=await readFile(_0x43a46f,_0x255a93(0x85));if(!isEquivalentPulledSqlFile(_0x188d49,_0x5854c0,_0x4ad24d)){_0x34e2d9=!![];break;}}}if(_0x34e2d9){const _0x28a311=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x28a311)throw CliErrors[_0x255a93(0xa8)](_0x255a93(0x95));}}const _0x78d826=cloneSqlLockData(_0x2b7d19),_0x53c04f=_0x78d826['apps'][_0x21588b['appCode']],_0x5259cb=[],_0x291ea6=[];for(const _0xfcd9a9 of _0x5519dc){const _0x702443=_0x53c04f['sqls'][_0xfcd9a9[_0x255a93(0xa5)]],_0x492f1a=ensureRemoteSqlContent(_0xfcd9a9),_0x3e040b=detectModeFromSql(_0xfcd9a9),_0x3b1fa8=_0xfcd9a9[_0x255a93(0x88)]?await getDbName(_0x35f092['appCode'],Number(_0xfcd9a9[_0x255a93(0x88)]))[_0x255a93(0xa4)](()=>undefined):undefined,_0x326d7b=buildLocalSqlFileContent({'sqlCode':_0xfcd9a9[_0x255a93(0xa5)],'sqlName':_0xfcd9a9[_0x255a93(0x9f)],'dbId':_0xfcd9a9[_0x255a93(0x88)]},_0x492f1a,{'dbName':_0x3b1fa8,'mode':_0x3e040b,'syncedAt':new Date()[_0x255a93(0xad)](),'description':_0xfcd9a9[_0x255a93(0x8b)]}),_0x31d269=buildSqlLockEntry(_0xfcd9a9,_0x492f1a,computeSqlContentHash(_0x326d7b),{'dbName':_0x3b1fa8}),_0x2565ec=_0x31d269[_0x255a93(0x81)],_0x1a9aa1=join(_0x21588b[_0x255a93(0xa9)],_0x2565ec);try{if(await fileExists(_0x1a9aa1)){const _0x24e92a=await readFile(_0x1a9aa1,_0x255a93(0x85));if(isEquivalentPulledSqlFile(_0x24e92a,_0x326d7b,_0x3e040b)){_0x291ea6['push']({'sqlCode':_0xfcd9a9['sqlCode'],'reason':_0x255a93(0x87)}),_0x53c04f[_0x255a93(0x90)][_0xfcd9a9['sqlCode']]={..._0x31d269,'hash':computeSqlContentHash(_0x24e92a),'path':_0x2565ec};continue;}if(!_0x1013bf){_0x291ea6[_0x255a93(0x9d)]({'sqlCode':_0xfcd9a9[_0x255a93(0xa5)],'reason':_0x255a93(0x83)});continue;}}const _0x18ad23=_0x702443?.[_0x255a93(0x81)]?join(_0x21588b[_0x255a93(0xa9)],_0x702443[_0x255a93(0x81)]):undefined;_0x18ad23&&_0x18ad23!==_0x1a9aa1&&await fileExists(_0x18ad23)&&await rm(_0x18ad23,{'force':!![]}),await ensureParentDirectory(_0x1a9aa1),await writeFile(_0x1a9aa1,_0x326d7b,_0x255a93(0x85)),_0x53c04f['sqls'][_0xfcd9a9[_0x255a93(0xa5)]]={..._0x31d269,'path':_0x2565ec},_0x5259cb[_0x255a93(0x9d)]({'sqlCode':_0xfcd9a9[_0x255a93(0xa5)],'filePath':_0x1a9aa1});}catch(_0x253792){_0x3bc892['push']({'sqlCode':_0xfcd9a9[_0x255a93(0xa5)],'error':_0x253792 instanceof Error?_0x253792[_0x255a93(0xaa)]:String(_0x253792)});}}return _0x53c04f[_0x255a93(0x8e)]=new Date()[_0x255a93(0xad)](),await writeSqlLockFile(_0x21588b[_0x255a93(0x86)],_0x78d826),{'ok':_0x3bc892[_0x255a93(0xbc)]===0x0,'data':{'pulled':_0x5259cb,'skipped':_0x291ea6,'failed':_0x3bc892},'message':_0x255a93(0xa2)+_0x5259cb[_0x255a93(0xbc)]+_0x255a93(0x91)+_0x291ea6['length']+_0x255a93(0xa3)+_0x3bc892[_0x255a93(0xbc)]+_0x255a93(0xaf)};}};function detectModeFromSql(_0x327746){const _0x51d0b9=a226_0x28bb34,_0x121efd=ensureRemoteSqlContent(_0x327746),_0x5d5dc6=stripLocalSqlMetadata(_0x121efd,_0x51d0b9(0x80))['trimStart']();if(/^<(select|insert|update|delete)\b/i['test'](_0x5d5dc6))return _0x51d0b9(0x80);return _0x51d0b9(0xb3);}function a226_0x1b12(_0x1b181c,_0x1ce365){_0x1b181c=_0x1b181c-0x7e;const _0x5a47a7=a226_0x5a47();let _0x1b121a=_0x5a47a7[_0x1b181c];return _0x1b121a;}function isEquivalentPulledSqlFile(_0xdeaa6d,_0x5167ea,_0x5dced7){return normalizePullComparableContent(_0xdeaa6d,_0x5dced7)===normalizePullComparableContent(_0x5167ea,_0x5dced7);}function normalizePullComparableContent(_0x347559,_0x2caa5e){const _0x2ae761=a226_0x28bb34,_0x7fe1c8=_0x347559[_0x2ae761(0x7e)](/\r\n/g,'\x0a')[_0x2ae761(0x96)]('\x0a'),_0x44bac1=_0x7fe1c8[_0x2ae761(0x99)](_0x44a112=>!isSyncedAtMetadataLine(_0x44a112,_0x2caa5e));return _0x44bac1['join']('\x0a');}function isSyncedAtMetadataLine(_0x5ca201,_0x4f4836){const _0x1abe96=a226_0x28bb34;if(_0x4f4836==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1abe96(0x82)](_0x5ca201);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1abe96(0x82)](_0x5ca201);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a213_0x1c47(_0x32a822,_0x3d123b){_0x32a822=_0x32a822-0x157;const _0xff3c17=a213_0xff3c();let _0x1c4766=_0xff3c17[_0x32a822];return _0x1c4766;}const a213_0x479043=a213_0x1c47;(function(_0x498031,_0x588216){const _0x54b5b0=a213_0x1c47,_0x3503a9=_0x498031();while(!![]){try{const _0x1a18cb=-parseInt(_0x54b5b0(0x188))/0x1*(-parseInt(_0x54b5b0(0x181))/0x2)+-parseInt(_0x54b5b0(0x159))/0x3+-parseInt(_0x54b5b0(0x164))/0x4*(-parseInt(_0x54b5b0(0x19b))/0x5)+parseInt(_0x54b5b0(0x19c))/0x6*(parseInt(_0x54b5b0(0x18f))/0x7)+-parseInt(_0x54b5b0(0x17a))/0x8+parseInt(_0x54b5b0(0x191))/0x9+-parseInt(_0x54b5b0(0x15f))/0xa;if(_0x1a18cb===_0x588216)break;else _0x3503a9['push'](_0x3503a9['shift']());}catch(_0x41639f){_0x3503a9['push'](_0x3503a9['shift']());}}}(a213_0xff3c,0x597d0));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';function a213_0xff3c(){const _0x5b2eed=['927288xLEvgi','No\x20database\x20matches\x20local\x20directory\x20\x22','lastSync','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','remoteId','/smartapi/custom/updateUserCustomSql','5509920vPisjp','push','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','catch','58260IZhMSO','\x20pushed,\x20','get','relativePath','dbName','path','hash','lockFilePath','\x22\x20for\x20sqlCode\x20','dbId','Local\x20SQL\x20not\x20found:\x20','sqlcode','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','length','mode','boolean','startsWith','sqlRootDir','utf8','\x20failed','Push\x20local\x20SQL\x20files\x20to\x20remote','filter','1684232UCTbEF','Local\x20directory\x20\x22','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','message','filePath','sqlRoot','map','253714sCXYTF','str','sqlCode','sql','replace','sqls','toISOString','4QPvJpx','exec','No\x20local\x20SQL\x20files\x20found.','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlName','projectRoot','dbDirectory','7DCWgvp','unchanged','5643045WkXPDE','isFinite','\x20skipped,\x20','appCode','entries','bool','force','Push\x20complete:\x20','validation','\x20SQL\x20file(s)','15pCDplB','1554198xqzpKj','version','Would\x20push\x20'];a213_0xff3c=function(){return _0x5b2eed;};return a213_0xff3c();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x52015c,_0xf5e871,_0x1f15de){const _0x4fbac4=a213_0x1c47,_0x1e4707=await scanLocalSqlQueries(_0x52015c),_0x117351=new Map();for(const _0xc26864 of _0x1e4707){if(_0x1f15de&&_0xc26864['sqlCode']!==_0x1f15de)continue;const _0xc9af8b=_0x117351[_0x4fbac4(0x166)](_0xc26864[_0x4fbac4(0x183)])??[];_0xc9af8b[_0x4fbac4(0x160)](_0xc26864),_0x117351['set'](_0xc26864[_0x4fbac4(0x183)],_0xc9af8b);}if(_0x1f15de&&!_0x117351[_0x4fbac4(0x161)](_0x1f15de))throw CliErrors['validation'](_0x4fbac4(0x16e)+_0x1f15de);const _0x50b389=[];for(const [_0x28d3d2,_0x4bbb2c]of _0x117351[_0x4fbac4(0x195)]()){if(_0x4bbb2c[_0x4fbac4(0x171)]===0x1){_0x50b389[_0x4fbac4(0x160)](_0x4bbb2c[0x0]);continue;}const _0x310f4b=_0xf5e871[_0x4fbac4(0x186)][_0x28d3d2],_0x4aad03=_0x310f4b?.['path'],_0x210718=_0x4aad03?_0x4bbb2c[_0x4fbac4(0x179)](_0x3fc1bc=>_0x3fc1bc[_0x4fbac4(0x167)]!==_0x4aad03):_0x4bbb2c;if(_0x310f4b&&_0x210718[_0x4fbac4(0x171)]===0x1){_0x50b389['push'](_0x210718[0x0]);continue;}throw CliErrors['validation']('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x28d3d2+_0x4fbac4(0x18b));}return _0x50b389;}export const sqlPush={'service':a213_0x479043(0x184),'command':'push','description':a213_0x479043(0x178),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a213_0x479043(0x173),'description':a213_0x479043(0x170)}],async 'dryRun'(_0x93173e){const _0x5f5514=a213_0x479043,_0x38e851=loadSqlProjectConfig(_0x93173e[_0x5f5514(0x194)]),_0x57fe11=await readSqlLockFile(_0x38e851['lockFilePath']),{appLock:_0x68535d}=ensureSqlLockScope(_0x57fe11??createEmptySqlLock(),_0x93173e['appCode'],_0x38e851[_0x5f5514(0x17f)],_0x5f5514(0x160)),_0x27ff3b=await getTargetSqlQueries(_0x38e851,_0x68535d,_0x93173e[_0x5f5514(0x182)](_0x5f5514(0x16f))||undefined),_0x2da0c5=[];for(const _0x300489 of _0x27ff3b){const _0x2c95db=await computeSqlFileHash(_0x300489[_0x5f5514(0x17e)]),_0x51511d=_0x68535d[_0x5f5514(0x186)][_0x300489['sqlCode']],_0x1d8a8a=!!_0x51511d&&(_0x51511d[_0x5f5514(0x169)]!==_0x300489[_0x5f5514(0x167)]||!!_0x300489[_0x5f5514(0x18c)]&&_0x51511d['sqlName']!==_0x300489[_0x5f5514(0x18c)]);if(!_0x93173e[_0x5f5514(0x196)](_0x5f5514(0x197))&&_0x51511d&&_0x51511d[_0x5f5514(0x16a)]===_0x2c95db&&!_0x1d8a8a)continue;_0x2da0c5[_0x5f5514(0x160)](_0x300489[_0x5f5514(0x183)]);}return{'method':'POST','url':_0x5f5514(0x15e),'body':{'sqlCodes':_0x2da0c5,'appCode':_0x93173e[_0x5f5514(0x194)]},'description':_0x5f5514(0x158)+_0x2da0c5[_0x5f5514(0x171)]+_0x5f5514(0x19a)};},async 'execute'(_0x408d6e){const _0x333ce4=a213_0x479043,_0x5094df=loadSqlProjectConfig(_0x408d6e['appCode']),_0x3555f1=await readSqlLockFile(_0x5094df[_0x333ce4(0x16b)]),{lockData:_0x2c3096,appLock:_0x398920}=ensureSqlLockScope(_0x3555f1??createEmptySqlLock(),_0x408d6e[_0x333ce4(0x194)],_0x5094df[_0x333ce4(0x17f)],'push'),_0x259281=await getTargetSqlQueries(_0x5094df,_0x398920,_0x408d6e['str'](_0x333ce4(0x16f))||undefined);if(_0x259281[_0x333ce4(0x171)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x333ce4(0x18a)};const _0x3994df=[],_0x353021=[],_0xcd7b60=[];for(const _0x377615 of _0x259281){const _0x4785fb=_0x398920[_0x333ce4(0x186)][_0x377615[_0x333ce4(0x183)]];if(!_0x4785fb){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615['sqlCode'],'error':_0x333ce4(0x17c)});continue;}try{const _0x921ba4=await computeSqlFileHash(_0x377615[_0x333ce4(0x17e)]),_0x356ff3=_0x4785fb[_0x333ce4(0x169)]!==_0x377615[_0x333ce4(0x167)]||!!_0x377615[_0x333ce4(0x18c)]&&_0x4785fb[_0x333ce4(0x18c)]!==_0x377615[_0x333ce4(0x18c)];if(!_0x408d6e[_0x333ce4(0x196)]('force')&&_0x4785fb[_0x333ce4(0x16a)]===_0x921ba4&&!_0x356ff3){_0x353021[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'reason':_0x333ce4(0x190)});continue;}if(_0x4785fb[_0x333ce4(0x157)]==null){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'error':_0x333ce4(0x162)});continue;}const _0x1f4566=await readFile(_0x377615[_0x333ce4(0x17e)],_0x333ce4(0x176)),_0x1d9c76=stripLocalSqlMetadata(_0x1f4566,_0x377615[_0x333ce4(0x172)]),_0xf862df=_0x377615['sqlName']||_0x4785fb[_0x333ce4(0x18c)],_0x782fb2=await resolveTargetDbBinding(_0x408d6e[_0x333ce4(0x194)],_0x377615,_0x4785fb),_0x24951c=await updateSqlQuery({'id':_0x4785fb[_0x333ce4(0x15d)],'appCode':_0x408d6e['appCode'],'sqlCode':_0x377615[_0x333ce4(0x183)],'sqlName':_0xf862df,'dbId':_0x782fb2[_0x333ce4(0x16d)],'version':_0x4785fb['version'],'sqlContent':_0x1d9c76,'sqlConfig':_0x4785fb['sqlConfig']??undefined}),_0x18a1d3=_0x24951c[_0x333ce4(0x16d)]?await getDbName(_0x408d6e['appCode'],Number(_0x24951c[_0x333ce4(0x16d)]))[_0x333ce4(0x163)](()=>_0x782fb2[_0x333ce4(0x168)]):_0x782fb2[_0x333ce4(0x168)];_0x398920[_0x333ce4(0x186)][_0x377615[_0x333ce4(0x183)]]={...buildSqlLockEntry(_0x24951c,_0x1d9c76,_0x921ba4,{'dbName':_0x18a1d3}),'path':_0x377615['relativePath'],'mode':_0x4785fb[_0x333ce4(0x172)]},await archivePreviousSqlFileIfNeeded(_0x5094df,_0x4785fb[_0x333ce4(0x169)],_0x377615[_0x333ce4(0x167)]),_0x3994df['push']({'sqlCode':_0x377615[_0x333ce4(0x183)],'remoteId':_0x4785fb['remoteId']});}catch(_0x489d55){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'error':_0x489d55 instanceof Error?_0x489d55[_0x333ce4(0x17d)]:String(_0x489d55)});}}_0x398920[_0x333ce4(0x15b)]=new Date()[_0x333ce4(0x187)](),await writeSqlLockFile(_0x5094df[_0x333ce4(0x16b)],_0x2c3096);const _0x2a640e=_0xcd7b60[_0x333ce4(0x171)]===0x0;return{'ok':_0x2a640e,'data':{'pushed':_0x3994df,'skipped':_0x353021,'failed':_0xcd7b60},'message':_0x333ce4(0x198)+_0x3994df[_0x333ce4(0x171)]+_0x333ce4(0x165)+_0x353021['length']+_0x333ce4(0x193)+_0xcd7b60['length']+_0x333ce4(0x177)};}};async function archivePreviousSqlFileIfNeeded(_0x2927aa,_0x5be5d5,_0x1311c9){const _0xef4694=a213_0x479043;if(!_0x5be5d5||_0x5be5d5===_0x1311c9)return;const _0x238484=join(_0x2927aa[_0xef4694(0x175)],_0x5be5d5);if(!await fileExists(_0x238484))return;const _0x502d4c=await moveToTrash(_0x2927aa[_0xef4694(0x18d)],_0x2927aa['trashDir'],_0x238484);await cleanupEmptyDirectories(dirname(_0x238484),_0x2927aa['sqlRootDir']),void _0x502d4c;}async function moveToTrash(_0x504097,_0x30b3a4,_0x3db04f){const _0x29313c=a213_0x479043,_0x5d0fd2=new Date()[_0x29313c(0x187)]()[_0x29313c(0x185)](/[:.]/g,'-'),_0x9dfe70=relative(_0x504097,_0x3db04f),_0x583b3b=join(_0x30b3a4,_0x5d0fd2,_0x9dfe70);return await mkdir(dirname(_0x583b3b),{'recursive':!![]}),await rename(_0x3db04f,_0x583b3b),_0x583b3b;}async function cleanupEmptyDirectories(_0x48d328,_0x835b00){const _0x235ca5=a213_0x479043;let _0x471655=resolve(_0x48d328);const _0x4b3555=resolve(_0x835b00);while(_0x471655[_0x235ca5(0x174)](''+_0x4b3555+sep)||_0x471655===_0x4b3555){if(_0x471655===_0x4b3555)return;try{const _0x5615f0=await readdir(_0x471655);if(_0x5615f0['length']>0x0)return;await rmdir(_0x471655);}catch{return;}_0x471655=dirname(_0x471655);}}async function resolveTargetDbBinding(_0x2d2175,_0x40cec9,_0x3338b3){const _0x485261=a213_0x479043,_0x2380b8=_0x40cec9[_0x485261(0x18e)];if(!_0x2380b8)return{'dbId':_0x3338b3['dbId'],'dbName':_0x3338b3[_0x485261(0x168)]};const _0x2f2f00=buildDbDirectoryName(_0x3338b3['dbName'],_0x3338b3[_0x485261(0x16d)]);if(_0x2380b8===_0x2f2f00)return{'dbId':_0x3338b3[_0x485261(0x16d)],'dbName':_0x3338b3[_0x485261(0x168)]};const _0x48003d=parseExplicitDbDirectory(_0x2380b8);if(_0x48003d!=null)return{'dbId':_0x48003d,'dbName':await getDbName(_0x2d2175,_0x48003d)[_0x485261(0x163)](()=>undefined)};const _0x5e5d90=await listDatabases(_0x2d2175),_0x30e336=_0x5e5d90[_0x485261(0x179)](_0x19a753=>buildDbDirectoryName(_0x19a753['dbName'],_0x19a753[_0x485261(0x16d)])===_0x2380b8);if(_0x30e336[_0x485261(0x171)]===0x1)return{'dbId':_0x30e336[0x0]['dbId'],'dbName':_0x30e336[0x0][_0x485261(0x168)]};if(_0x30e336['length']===0x0)throw CliErrors[_0x485261(0x199)](_0x485261(0x15a)+_0x2380b8+_0x485261(0x16c)+_0x40cec9['sqlCode']+'.');const _0x31687f=_0x30e336[_0x485261(0x180)](_0x30e7df=>_0x30e7df[_0x485261(0x168)]+'\x20('+_0x30e7df['dbId']+')')['join'](',\x20');throw CliErrors['validation'](_0x485261(0x17b)+_0x2380b8+_0x485261(0x15c)+_0x40cec9[_0x485261(0x183)]+':\x20'+_0x31687f);}function parseExplicitDbDirectory(_0x4722a5){const _0x421fe3=a213_0x479043,_0x49213e=/^db-(\d+)$/[_0x421fe3(0x189)](_0x4722a5);if(!_0x49213e)return null;const _0x3ab8f1=Number(_0x49213e[0x1]);return Number[_0x421fe3(0x192)](_0x3ab8f1)&&_0x3ab8f1>0x0?_0x3ab8f1:null;}
|
|
1
|
+
const a227_0x596368=a227_0x3094;(function(_0x3d0703,_0x3aa844){const _0x45e595=a227_0x3094,_0x942296=_0x3d0703();while(!![]){try{const _0xf8370b=parseInt(_0x45e595(0x1f0))/0x1*(parseInt(_0x45e595(0x1e1))/0x2)+parseInt(_0x45e595(0x1e3))/0x3+-parseInt(_0x45e595(0x1dd))/0x4+parseInt(_0x45e595(0x1d9))/0x5*(-parseInt(_0x45e595(0x1d7))/0x6)+-parseInt(_0x45e595(0x1f2))/0x7*(-parseInt(_0x45e595(0x1de))/0x8)+parseInt(_0x45e595(0x1d2))/0x9*(-parseInt(_0x45e595(0x1f5))/0xa)+-parseInt(_0x45e595(0x1dc))/0xb;if(_0xf8370b===_0x3aa844)break;else _0x942296['push'](_0x942296['shift']());}catch(_0x9b6be9){_0x942296['push'](_0x942296['shift']());}}}(a227_0x1e86,0xdc891));function a227_0x3094(_0xde04f4,_0x156c05){_0xde04f4=_0xde04f4-0x1c8;const _0x1e862c=a227_0x1e86();let _0x309464=_0x1e862c[_0xde04f4];return _0x309464;}import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x437de4,_0x54245e,_0x1fdca5){const _0x2c4399=a227_0x3094,_0x866b31=await scanLocalSqlQueries(_0x437de4),_0x2b3f23=new Map();for(const _0x4e9b09 of _0x866b31){if(_0x1fdca5&&_0x4e9b09[_0x2c4399(0x1e2)]!==_0x1fdca5)continue;const _0x12888a=_0x2b3f23['get'](_0x4e9b09['sqlCode'])??[];_0x12888a[_0x2c4399(0x1e5)](_0x4e9b09),_0x2b3f23['set'](_0x4e9b09[_0x2c4399(0x1e2)],_0x12888a);}if(_0x1fdca5&&!_0x2b3f23['has'](_0x1fdca5))throw CliErrors['validation'](_0x2c4399(0x1e6)+_0x1fdca5);const _0x49e369=[];for(const [_0x583d33,_0x19beb0]of _0x2b3f23[_0x2c4399(0x1ff)]()){if(_0x19beb0[_0x2c4399(0x1db)]===0x1){_0x49e369[_0x2c4399(0x1e5)](_0x19beb0[0x0]);continue;}const _0x163d56=_0x54245e[_0x2c4399(0x1d5)][_0x583d33],_0x993040=_0x163d56?.[_0x2c4399(0x1eb)],_0x5cc56f=_0x993040?_0x19beb0['filter'](_0xd4e863=>_0xd4e863[_0x2c4399(0x1f4)]!==_0x993040):_0x19beb0;if(_0x163d56&&_0x5cc56f['length']===0x1){_0x49e369[_0x2c4399(0x1e5)](_0x5cc56f[0x0]);continue;}throw CliErrors[_0x2c4399(0x1f7)](_0x2c4399(0x1cb)+_0x583d33+_0x2c4399(0x1fc));}return _0x49e369;}export const sqlPush={'service':a227_0x596368(0x1e7),'command':a227_0x596368(0x1e5),'description':a227_0x596368(0x1cf),'risk':a227_0x596368(0x1cd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a227_0x596368(0x1ce),'type':'boolean','description':a227_0x596368(0x1e8)}],async 'dryRun'(_0x512745){const _0x15e241=a227_0x596368,_0x24810e=loadSqlProjectConfig(_0x512745[_0x15e241(0x1d0)]),_0x409587=await readSqlLockFile(_0x24810e[_0x15e241(0x1df)]),{appLock:_0x11af14}=ensureSqlLockScope(_0x409587??createEmptySqlLock(),_0x512745[_0x15e241(0x1d0)],_0x24810e[_0x15e241(0x201)],_0x15e241(0x1e5)),_0x117482=await getTargetSqlQueries(_0x24810e,_0x11af14,_0x512745['str'](_0x15e241(0x1ee))||undefined),_0x54b4cc=[];for(const _0x50ad95 of _0x117482){const _0x3c5597=await computeSqlFileHash(_0x50ad95[_0x15e241(0x1d3)]),_0x46078e=_0x11af14[_0x15e241(0x1d5)][_0x50ad95['sqlCode']],_0x2e5741=!!_0x46078e&&(_0x46078e[_0x15e241(0x1eb)]!==_0x50ad95[_0x15e241(0x1f4)]||!!_0x50ad95[_0x15e241(0x1c9)]&&_0x46078e[_0x15e241(0x1c9)]!==_0x50ad95[_0x15e241(0x1c9)]);if(!_0x512745[_0x15e241(0x1ec)](_0x15e241(0x1ce))&&_0x46078e&&_0x46078e['hash']===_0x3c5597&&!_0x2e5741)continue;_0x54b4cc[_0x15e241(0x1e5)](_0x50ad95[_0x15e241(0x1e2)]);}return{'method':'POST','url':_0x15e241(0x1f3),'body':{'sqlCodes':_0x54b4cc,'appCode':_0x512745[_0x15e241(0x1d0)]},'description':'Would\x20push\x20'+_0x54b4cc[_0x15e241(0x1db)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x3820d1){const _0x437228=a227_0x596368,_0x12e85f=loadSqlProjectConfig(_0x3820d1['appCode']),_0x5c2b48=await readSqlLockFile(_0x12e85f[_0x437228(0x1df)]),{lockData:_0x2a9210,appLock:_0x5b6b83}=ensureSqlLockScope(_0x5c2b48??createEmptySqlLock(),_0x3820d1[_0x437228(0x1d0)],_0x12e85f['sqlRoot'],_0x437228(0x1e5)),_0x414510=await getTargetSqlQueries(_0x12e85f,_0x5b6b83,_0x3820d1[_0x437228(0x1cc)]('sqlcode')||undefined);if(_0x414510[_0x437228(0x1db)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x217cf3=[],_0x24300c=[],_0x1ecfe2=[];for(const _0xdf2e9f of _0x414510){const _0x3acfae=_0x5b6b83['sqls'][_0xdf2e9f[_0x437228(0x1e2)]];if(!_0x3acfae){_0x1ecfe2[_0x437228(0x1e5)]({'sqlCode':_0xdf2e9f[_0x437228(0x1e2)],'error':_0x437228(0x1d4)});continue;}try{const _0x3340e9=await computeSqlFileHash(_0xdf2e9f[_0x437228(0x1d3)]),_0x12bdc=_0x3acfae[_0x437228(0x1eb)]!==_0xdf2e9f['relativePath']||!!_0xdf2e9f['sqlName']&&_0x3acfae[_0x437228(0x1c9)]!==_0xdf2e9f['sqlName'];if(!_0x3820d1[_0x437228(0x1ec)]('force')&&_0x3acfae[_0x437228(0x1fd)]===_0x3340e9&&!_0x12bdc){_0x24300c[_0x437228(0x1e5)]({'sqlCode':_0xdf2e9f[_0x437228(0x1e2)],'reason':_0x437228(0x1fb)});continue;}if(_0x3acfae['version']==null){_0x1ecfe2[_0x437228(0x1e5)]({'sqlCode':_0xdf2e9f[_0x437228(0x1e2)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x2611c5=await readFile(_0xdf2e9f['filePath'],_0x437228(0x203)),_0x5dc164=stripLocalSqlMetadata(_0x2611c5,_0xdf2e9f[_0x437228(0x1e0)]),_0x3eb98b=_0xdf2e9f[_0x437228(0x1c9)]||_0x3acfae[_0x437228(0x1c9)],_0x3cb177=await resolveTargetDbBinding(_0x3820d1[_0x437228(0x1d0)],_0xdf2e9f,_0x3acfae),_0x5a6679=await updateSqlQuery({'id':_0x3acfae[_0x437228(0x1d8)],'appCode':_0x3820d1[_0x437228(0x1d0)],'sqlCode':_0xdf2e9f['sqlCode'],'sqlName':_0x3eb98b,'dbId':_0x3cb177['dbId'],'version':_0x3acfae['version'],'sqlContent':_0x5dc164,'sqlConfig':_0x3acfae['sqlConfig']??undefined}),_0x153e0f=_0x5a6679[_0x437228(0x1e9)]?await getDbName(_0x3820d1[_0x437228(0x1d0)],Number(_0x5a6679[_0x437228(0x1e9)]))[_0x437228(0x1da)](()=>_0x3cb177[_0x437228(0x1ef)]):_0x3cb177[_0x437228(0x1ef)];_0x5b6b83['sqls'][_0xdf2e9f[_0x437228(0x1e2)]]={...buildSqlLockEntry(_0x5a6679,_0x5dc164,_0x3340e9,{'dbName':_0x153e0f}),'path':_0xdf2e9f[_0x437228(0x1f4)],'mode':_0x3acfae[_0x437228(0x1e0)]},await archivePreviousSqlFileIfNeeded(_0x12e85f,_0x3acfae['path'],_0xdf2e9f[_0x437228(0x1f4)]),_0x217cf3[_0x437228(0x1e5)]({'sqlCode':_0xdf2e9f[_0x437228(0x1e2)],'remoteId':_0x3acfae[_0x437228(0x1d8)]});}catch(_0x2dfbd0){_0x1ecfe2['push']({'sqlCode':_0xdf2e9f['sqlCode'],'error':_0x2dfbd0 instanceof Error?_0x2dfbd0[_0x437228(0x1f6)]:String(_0x2dfbd0)});}}_0x5b6b83['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x12e85f[_0x437228(0x1df)],_0x2a9210);const _0x372c41=_0x1ecfe2['length']===0x0;return{'ok':_0x372c41,'data':{'pushed':_0x217cf3,'skipped':_0x24300c,'failed':_0x1ecfe2},'message':_0x437228(0x1ed)+_0x217cf3[_0x437228(0x1db)]+_0x437228(0x1f8)+_0x24300c[_0x437228(0x1db)]+'\x20skipped,\x20'+_0x1ecfe2['length']+_0x437228(0x1ea)};}};async function archivePreviousSqlFileIfNeeded(_0x105727,_0x553184,_0x2176af){const _0x40766e=a227_0x596368;if(!_0x553184||_0x553184===_0x2176af)return;const _0x18431f=join(_0x105727[_0x40766e(0x1f9)],_0x553184);if(!await fileExists(_0x18431f))return;const _0x3b3518=await moveToTrash(_0x105727['projectRoot'],_0x105727['trashDir'],_0x18431f);await cleanupEmptyDirectories(dirname(_0x18431f),_0x105727[_0x40766e(0x1f9)]),void _0x3b3518;}async function moveToTrash(_0x4a89a9,_0x1a22f2,_0x4be8bb){const _0x1bc4bc=a227_0x596368,_0x351278=new Date()[_0x1bc4bc(0x1fe)]()[_0x1bc4bc(0x1d1)](/[:.]/g,'-'),_0x2480b0=relative(_0x4a89a9,_0x4be8bb),_0x458f22=join(_0x1a22f2,_0x351278,_0x2480b0);return await mkdir(dirname(_0x458f22),{'recursive':!![]}),await rename(_0x4be8bb,_0x458f22),_0x458f22;}function a227_0x1e86(){const _0x211839=['sqlRootDir','\x22\x20for\x20sqlCode\x20','unchanged','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','hash','toISOString','entries','Local\x20directory\x20\x22','sqlRoot','join','utf8','exec','sqlName','dbDirectory','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','str','write','force','Push\x20local\x20SQL\x20files\x20to\x20remote','appCode','replace','18nMlyQH','filePath','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqls','filter','1716wcYhOe','remoteId','8210ITCQFh','catch','length','13982122aYmrfA','2662500AjjUln','6808scgeyu','lockFilePath','mode','82670KTrOaQ','sqlCode','4610985yEVtBi','isFinite','push','Local\x20SQL\x20not\x20found:\x20','sql','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','dbId','\x20failed','path','bool','Push\x20complete:\x20','sqlcode','dbName','24SZiZBY','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','9247tRAmEg','/smartapi/custom/updateUserCustomSql','relativePath','1717770BjrVCs','message','validation','\x20pushed,\x20'];a227_0x1e86=function(){return _0x211839;};return a227_0x1e86();}async function cleanupEmptyDirectories(_0x16739d,_0x43bb7e){let _0x2d150d=resolve(_0x16739d);const _0x5c5852=resolve(_0x43bb7e);while(_0x2d150d['startsWith'](''+_0x5c5852+sep)||_0x2d150d===_0x5c5852){if(_0x2d150d===_0x5c5852)return;try{const _0x428c98=await readdir(_0x2d150d);if(_0x428c98['length']>0x0)return;await rmdir(_0x2d150d);}catch{return;}_0x2d150d=dirname(_0x2d150d);}}async function resolveTargetDbBinding(_0xbb566b,_0x2730ad,_0x52fe83){const _0x2209ab=a227_0x596368,_0x4fcd10=_0x2730ad[_0x2209ab(0x1ca)];if(!_0x4fcd10)return{'dbId':_0x52fe83[_0x2209ab(0x1e9)],'dbName':_0x52fe83['dbName']};const _0x148199=buildDbDirectoryName(_0x52fe83[_0x2209ab(0x1ef)],_0x52fe83['dbId']);if(_0x4fcd10===_0x148199)return{'dbId':_0x52fe83['dbId'],'dbName':_0x52fe83[_0x2209ab(0x1ef)]};const _0x441648=parseExplicitDbDirectory(_0x4fcd10);if(_0x441648!=null)return{'dbId':_0x441648,'dbName':await getDbName(_0xbb566b,_0x441648)[_0x2209ab(0x1da)](()=>undefined)};const _0x47f85c=await listDatabases(_0xbb566b),_0x37142c=_0x47f85c[_0x2209ab(0x1d6)](_0xa3a404=>buildDbDirectoryName(_0xa3a404['dbName'],_0xa3a404[_0x2209ab(0x1e9)])===_0x4fcd10);if(_0x37142c[_0x2209ab(0x1db)]===0x1)return{'dbId':_0x37142c[0x0][_0x2209ab(0x1e9)],'dbName':_0x37142c[0x0][_0x2209ab(0x1ef)]};if(_0x37142c['length']===0x0)throw CliErrors[_0x2209ab(0x1f7)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x4fcd10+_0x2209ab(0x1fa)+_0x2730ad[_0x2209ab(0x1e2)]+'.');const _0x38d418=_0x37142c['map'](_0x39ba54=>_0x39ba54[_0x2209ab(0x1ef)]+'\x20('+_0x39ba54[_0x2209ab(0x1e9)]+')')[_0x2209ab(0x202)](',\x20');throw CliErrors['validation'](_0x2209ab(0x200)+_0x4fcd10+_0x2209ab(0x1f1)+_0x2730ad['sqlCode']+':\x20'+_0x38d418);}function parseExplicitDbDirectory(_0x31ec37){const _0xc73cc8=a227_0x596368,_0xcba9e4=/^db-(\d+)$/[_0xc73cc8(0x1c8)](_0x31ec37);if(!_0xcba9e4)return null;const _0x203b5e=Number(_0xcba9e4[0x1]);return Number[_0xc73cc8(0x1e4)](_0x203b5e)&&_0x203b5e>0x0?_0x203b5e:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a228_0x5a5eb8=a228_0x4a05;(function(_0x2fb6d2,_0x2ca37a){const _0x22b1bc=a228_0x4a05,_0x12194f=_0x2fb6d2();while(!![]){try{const _0x1040ce=parseInt(_0x22b1bc(0x11f))/0x1*(-parseInt(_0x22b1bc(0x128))/0x2)+-parseInt(_0x22b1bc(0x114))/0x3*(parseInt(_0x22b1bc(0x12b))/0x4)+-parseInt(_0x22b1bc(0x132))/0x5+parseInt(_0x22b1bc(0x12a))/0x6+parseInt(_0x22b1bc(0x13c))/0x7*(-parseInt(_0x22b1bc(0x113))/0x8)+-parseInt(_0x22b1bc(0x11d))/0x9*(-parseInt(_0x22b1bc(0x117))/0xa)+-parseInt(_0x22b1bc(0x10f))/0xb*(-parseInt(_0x22b1bc(0x125))/0xc);if(_0x1040ce===_0x2ca37a)break;else _0x12194f['push'](_0x12194f['shift']());}catch(_0x277674){_0x12194f['push'](_0x12194f['shift']());}}}(a228_0x52f9,0x596df));import{createInterface}from'node:readline';import{join}from'node:path';function a228_0x4a05(_0x46a081,_0x849a5f){_0x46a081=_0x46a081-0x10f;const _0x52f90b=a228_0x52f9();let _0x4a0578=_0x52f90b[_0x46a081];return _0x4a0578;}import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a228_0x5a5eb8(0x110);export function buildSqlLockEntry(_0x3a5632,_0x58b657,_0x2ee2dc,_0x553c1e){const _0x328fe9=a228_0x5a5eb8,_0x505303=detectSqlMode(_0x58b657);return{'path':buildSqlRelativePath(_0x3a5632[_0x328fe9(0x127)],_0x3a5632['sqlName'],_0x553c1e?.[_0x328fe9(0x119)],_0x505303,_0x3a5632[_0x328fe9(0x126)]),'hash':_0x2ee2dc,'remoteId':_0x3a5632['id'],'version':_0x3a5632['version'],'dbId':Number(_0x3a5632[_0x328fe9(0x126)]),'dbName':_0x553c1e?.[_0x328fe9(0x119)],'sqlName':_0x3a5632['sqlName'],'sqlConfig':_0x3a5632[_0x328fe9(0x122)]??undefined,'mode':_0x505303};}export function cloneSqlLockData(_0x3782be){const _0x857f88=a228_0x5a5eb8;return{'apps':Object[_0x857f88(0x133)](Object['entries'](_0x3782be[_0x857f88(0x120)])[_0x857f88(0x116)](([_0x44c466,_0x1b6587])=>[_0x44c466,{'sqlRoot':_0x1b6587[_0x857f88(0x115)],'lastSync':_0x1b6587[_0x857f88(0x11b)],'sqls':{..._0x1b6587['sqls']}}]))};}export function ensureRemoteSqlContent(_0x3ecfb0){const _0x13f137=a228_0x5a5eb8;return _0x3ecfb0[_0x13f137(0x135)]??'';}export function buildLocalSqlFileContent(_0x3c56e6,_0x5cf6ce,_0x270fa0){const _0x2164a1=a228_0x5a5eb8,_0x44eb10=_0x270fa0?.[_0x2164a1(0x118)]??detectSqlMode(_0x5cf6ce),_0x377cef=stripLocalSqlMetadata(_0x5cf6ce,_0x44eb10)['trim'](),_0x1040b5=[...buildMetadataHeaderLines({'sqlCode':_0x3c56e6['sqlCode'],'sqlName':_0x3c56e6['sqlName'],'dbId':_0x3c56e6['dbId'],'dbName':_0x270fa0?.[_0x2164a1(0x119)],'mode':_0x44eb10,'syncedAt':_0x270fa0?.['syncedAt'],'description':_0x270fa0?.['description']},_0x44eb10),'',_0x377cef],_0xcec008=_0x1040b5[_0x2164a1(0x112)]('\x0a');return _0xcec008[_0x2164a1(0x12f)]('\x0a')?_0xcec008:_0xcec008+'\x0a';}export function stripLocalSqlMetadata(_0x18f59a,_0x133fae){const _0x4acd3f=a228_0x5a5eb8,_0x249615=_0x18f59a[_0x4acd3f(0x12d)](/\r\n/g,'\x0a')[_0x4acd3f(0x130)]('\x0a'),_0x2c9d89=[];let _0x29a45b=0x0;if(_0x133fae===_0x4acd3f(0x11c))while(_0x29a45b<_0x249615[_0x4acd3f(0x129)]){const _0x320cbe=_0x249615[_0x29a45b]??'';if(/^\s*<!--\s*@lovrabet\./[_0x4acd3f(0x124)](_0x320cbe)){_0x29a45b++;continue;}if(_0x320cbe[_0x4acd3f(0x136)]()===''&&_0x29a45b>0x0){_0x29a45b++;continue;}break;}else while(_0x29a45b<_0x249615['length']){const _0x309c6d=_0x249615[_0x29a45b]??'';if(/^\s*--\s*@lovrabet\./[_0x4acd3f(0x124)](_0x309c6d)){_0x29a45b++;continue;}if(_0x309c6d[_0x4acd3f(0x136)]()===''&&_0x29a45b>0x0){_0x29a45b++;continue;}break;}for(;_0x29a45b<_0x249615[_0x4acd3f(0x129)];_0x29a45b++){_0x2c9d89[_0x4acd3f(0x138)](_0x249615[_0x29a45b]);}return _0x2c9d89[_0x4acd3f(0x112)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x54446f,_0x3713a9){const _0x3c966f=a228_0x5a5eb8;if(_0x3713a9?.[_0x3c966f(0x118)])return _0x3713a9[_0x3c966f(0x118)];return detectSqlMode(_0x54446f);}function a228_0x52f9(){const _0x4f1031=['lastSync','mybatisXml','15894uYanqA','stderr','1pfspGi','apps','includes','sqlConfig','filter','test','72oXTnkf','dbId','sqlCode','1443458mAAgck','length','1676472FIyuLi','203652wvGCWD','\x20[y/N]\x20','replace','syncedAt','endsWith','split','<!--\x20@lovrabet.','1210375LrdMBe','fromEntries','close','sqlContent','trim','toLowerCase','push','stdin','path','description','7BIpwgt','1818366yKqMxC','.rabetbase/sql','--\x20@lovrabet.','join','1417784gxNRid','12svskzC','sqlRoot','map','2490hvfNlv','mode','dbName','sqlName'];a228_0x52f9=function(){return _0x4f1031;};return a228_0x52f9();}export function resolveSqlFileName(_0xdfb5d0,_0x11d94e,_0x1ecb3c){const _0x2fac3a=a228_0x5a5eb8;if(_0x1ecb3c?.['path'])return _0x1ecb3c[_0x2fac3a(0x13a)];if(_0x1ecb3c?.[_0x2fac3a(0x11a)]||_0x1ecb3c?.[_0x2fac3a(0x119)])return buildSqlRelativePath(_0xdfb5d0,_0x1ecb3c?.[_0x2fac3a(0x11a)],_0x1ecb3c?.[_0x2fac3a(0x119)],resolveSqlMode(_0x11d94e,_0x1ecb3c),_0x1ecb3c?.[_0x2fac3a(0x126)]);return buildDefaultSqlFileName(_0xdfb5d0,resolveSqlMode(_0x11d94e,_0x1ecb3c));}export function resolveSqlLocalDir(_0x2566d2,_0x2db98d){return join(_0x2566d2,SQL_LOCAL_REL_DIR,_0x2db98d);}export async function confirmForceOverwrite(_0x5248a0){const _0x3009fe=a228_0x5a5eb8,_0x497075=createInterface({'input':process[_0x3009fe(0x139)],'output':process[_0x3009fe(0x11e)]}),_0x558ca3=await new Promise(_0x5217d9=>{const _0x25b1a6=_0x3009fe;_0x497075['question'](_0x5248a0+_0x25b1a6(0x12c),_0x5217d9);});return _0x497075[_0x3009fe(0x134)](),['y','yes'][_0x3009fe(0x121)](_0x558ca3[_0x3009fe(0x136)]()[_0x3009fe(0x137)]());}export function findSqlLockScope(_0x5499b1,_0x55529f){const _0x2e7063=a228_0x5a5eb8;return _0x5499b1[_0x2e7063(0x120)][_0x55529f];}function buildMetadataHeaderLines(_0x50f075,_0x969327){const _0x4db961=a228_0x5a5eb8,_0x4dca21=[[_0x4db961(0x127),_0x50f075[_0x4db961(0x127)]],[_0x4db961(0x11a),_0x50f075[_0x4db961(0x11a)]],[_0x4db961(0x126),_0x50f075['dbId']],[_0x4db961(0x119),_0x50f075[_0x4db961(0x119)]],[_0x4db961(0x118),_0x50f075[_0x4db961(0x118)]],['syncedAt',_0x50f075[_0x4db961(0x12e)]],[_0x4db961(0x13b),_0x50f075[_0x4db961(0x13b)]]];if(_0x969327===_0x4db961(0x11c))return _0x4dca21[_0x4db961(0x123)](([,_0x3d4ea1])=>_0x3d4ea1!==undefined&&_0x3d4ea1!==null&&String(_0x3d4ea1)[_0x4db961(0x136)]()!=='')[_0x4db961(0x116)](([_0x1c59cf,_0x8341fa])=>_0x4db961(0x131)+_0x1c59cf+':\x20'+String(_0x8341fa)+'\x20-->');return _0x4dca21[_0x4db961(0x123)](([,_0x3743b2])=>_0x3743b2!==undefined&&_0x3743b2!==null&&String(_0x3743b2)[_0x4db961(0x136)]()!=='')[_0x4db961(0x116)](([_0x134acb,_0x3b1efd])=>_0x4db961(0x111)+_0x134acb+':\x20'+String(_0x3b1efd));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a229_0x709696=a229_0x57ec;(function(_0x172136,_0x4c8434){const _0x1558e3=a229_0x57ec,_0x1854c2=_0x172136();while(!![]){try{const _0x1a081f=-parseInt(_0x1558e3(0x1c2))/0x1+-parseInt(_0x1558e3(0x1a2))/0x2*(-parseInt(_0x1558e3(0x1a5))/0x3)+parseInt(_0x1558e3(0x1af))/0x4+-parseInt(_0x1558e3(0x1ba))/0x5+-parseInt(_0x1558e3(0x1bf))/0x6+parseInt(_0x1558e3(0x1b0))/0x7+parseInt(_0x1558e3(0x1ae))/0x8;if(_0x1a081f===_0x4c8434)break;else _0x1854c2['push'](_0x1854c2['shift']());}catch(_0x5dccc5){_0x1854c2['push'](_0x1854c2['shift']());}}}(a229_0x1b55,0x90a8e));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;async function fetchAllSqlCodes(_0x449a88){const _0x57ee46=a229_0x57ec,_0x16f28a=[];let _0xae86f0=0x1;while(!![]){const _0x176ff9=await listSqlQueries(_0x449a88,{'currentPage':_0xae86f0,'pageSize':PAGE_SIZE}),_0x9ab28b=_0x176ff9[_0x57ee46(0x1ac)]??[];_0x16f28a[_0x57ee46(0x1b3)](..._0x9ab28b['map'](_0x362f96=>_0x362f96[_0x57ee46(0x1c0)]));if(_0x9ab28b[_0x57ee46(0x1b4)]===0x0)break;const _0x269091=_0x176ff9['paging']?.[_0x57ee46(0x1bd)];if(_0x269091!=null?_0x16f28a[_0x57ee46(0x1b4)]>=_0x269091:_0x9ab28b[_0x57ee46(0x1b4)]<PAGE_SIZE)break;_0xae86f0++;}return _0x16f28a;}export const sqlStatus={'service':a229_0x709696(0x1c5),'command':'status','description':a229_0x709696(0x1bc),'risk':a229_0x709696(0x1a9),'flags':[{'name':a229_0x709696(0x1a6),'type':a229_0x709696(0x1a4),'description':a229_0x709696(0x1c3)}],async 'execute'(_0x12ab77){const _0x5d3d5e=a229_0x709696,_0x1a486a=loadSqlProjectConfig(_0x12ab77[_0x5d3d5e(0x1b7)]),_0x348de3=await readSqlLockFile(_0x1a486a[_0x5d3d5e(0x1b9)]),{appLock:_0xe744bb}=ensureSqlLockScope(_0x348de3??createEmptySqlLock(),_0x1a486a[_0x5d3d5e(0x1b7)],_0x1a486a[_0x5d3d5e(0x1bb)],_0x5d3d5e(0x1c6)),_0x1b5050=await scanLocalSqlQueries(_0x1a486a),_0x2d159c=[],_0x42b3a5=[],_0x58c2ea=[],_0x314520=[],_0x4b21b6=new Set(_0x1b5050[_0x5d3d5e(0x1aa)](_0x468acd=>_0x468acd[_0x5d3d5e(0x1ad)]));for(const _0x32c4c5 of _0x1b5050){const _0x2b8330=await computeSqlFileHash(_0x32c4c5['filePath']),_0x19d3ad=_0xe744bb[_0x5d3d5e(0x1b6)][_0x32c4c5[_0x5d3d5e(0x1ad)]],_0x1597ac=!!_0x19d3ad&&_0x19d3ad[_0x5d3d5e(0x1b8)]!==_0x32c4c5[_0x5d3d5e(0x1be)],_0x4803c5=!!_0x19d3ad&&!!_0x32c4c5['sqlName']&&_0x19d3ad[_0x5d3d5e(0x1b2)]!==_0x32c4c5[_0x5d3d5e(0x1b2)];if(!_0x19d3ad)_0x2d159c[_0x5d3d5e(0x1b3)](_0x32c4c5[_0x5d3d5e(0x1ad)]);else _0x19d3ad[_0x5d3d5e(0x1c4)]!==_0x2b8330||_0x1597ac||_0x4803c5?_0x42b3a5['push'](_0x32c4c5[_0x5d3d5e(0x1ad)]):_0x58c2ea['push'](_0x32c4c5[_0x5d3d5e(0x1ad)]);}for(const _0x905695 of Object[_0x5d3d5e(0x1a8)](_0xe744bb['sqls'])){!_0x4b21b6[_0x5d3d5e(0x1c1)](_0x905695)&&_0x314520['push'](_0x905695);}const _0x4aef6a=[];if(_0x12ab77[_0x5d3d5e(0x1ab)]('remote')){const _0x2db740=await fetchAllSqlCodes(_0x12ab77[_0x5d3d5e(0x1b7)]);for(const _0xb3a5ba of _0x2db740){!_0x4b21b6['has'](_0xb3a5ba)&&!_0xe744bb[_0x5d3d5e(0x1b6)][_0xb3a5ba]&&_0x4aef6a[_0x5d3d5e(0x1b3)](_0xb3a5ba);}}const _0x4becac=_0x2d159c[_0x5d3d5e(0x1b4)]===0x0&&_0x42b3a5['length']===0x0&&_0x314520['length']===0x0&&_0x4aef6a['length']===0x0;return{'ok':!![],'data':{'added':_0x2d159c,'modified':_0x42b3a5,'missing':_0x314520,'unchanged':_0x58c2ea,'remoteOnly':_0x4aef6a},'message':_0x4becac?_0x5d3d5e(0x1b5):_0x2d159c[_0x5d3d5e(0x1b4)]+_0x5d3d5e(0x1b1)+_0x42b3a5[_0x5d3d5e(0x1b4)]+'\x20modified,\x20'+_0x314520[_0x5d3d5e(0x1b4)]+_0x5d3d5e(0x1a7)+_0x58c2ea[_0x5d3d5e(0x1b4)]+_0x5d3d5e(0x1a3)+(_0x4aef6a[_0x5d3d5e(0x1b4)]>0x0?',\x20'+_0x4aef6a['length']+'\x20remote-only':'')};}};function a229_0x57ec(_0x1152a3,_0x552464){_0x1152a3=_0x1152a3-0x1a2;const _0x1b5561=a229_0x1b55();let _0x57ec09=_0x1b5561[_0x1152a3];return _0x57ec09;}function a229_0x1b55(){const _0x35f2c6=['6lHoCGm','remote','\x20missing,\x20','keys','read','map','bool','tableData','lockKey','3878064NGnAIP','359548TOrGYD','1352582UbxNny','\x20added,\x20','sqlName','push','length','All\x20SQL\x20queries\x20are\x20in\x20sync.','sqls','appCode','path','lockFilePath','1576970gLdjgt','sqlRoot','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','totalCount','relativePath','1224624bWKXhC','sqlCode','has','275831ldTKox','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','hash','sql','status','619984JiIIcv','\x20unchanged','boolean'];a229_0x1b55=function(){return _0x35f2c6;};return a229_0x1b55();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a230_0x5b385f=a230_0x3f2b;function a230_0x23a4(){const _0x8599bd=['boolean','isArray','appCode','\x22\x20not\x20found\x20in\x20any\x20dataset','schemas','joinAudit','SQL\x20schema\x20validation','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','cwd','1272412JBSiOJ','flagMissing','indexes','columns','length','primary','Table\x20\x22','columnNames','2166203MWEHFN','--check-indexes\x20requires\x20--schemas.','693MLdZdW','check-indexes','3370437YOQonY','index_type','message','3lAOSei','type','split','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','validation','push','tableName','file','66845goObaK','size','fields','name','string','utf-8','500086AEiLfs','flatMap','78TNCXrO','find','24HfxlxV','indexName','index_name','trim','from','valid','dbtableConfig','parameters','get','6792170bjRfiB','read','index_columns','\x22\x20not\x20found\x20or\x20not\x20accessible','reason','sql','tables','pkField','str','2FpotRI','toLowerCase','Dataset\x20\x22','schemaWarnings','filter','sqlType','schema:','map','dataset','File\x20not\x20found:\x20','50624QiTLRI','10kIXbCa'];a230_0x23a4=function(){return _0x8599bd;};return a230_0x23a4();}(function(_0x26849b,_0x34a225){const _0x2c0b20=a230_0x3f2b,_0x2a30e1=_0x26849b();while(!![]){try{const _0xa03922=parseInt(_0x2c0b20(0x1fc))/0x1*(-parseInt(_0x2c0b20(0x1c9))/0x2)+-parseInt(_0x2c0b20(0x1ed))/0x3*(-parseInt(_0x2c0b20(0x1de))/0x4)+-parseInt(_0x2c0b20(0x1f6))/0x5*(parseInt(_0x2c0b20(0x1b5))/0x6)+-parseInt(_0x2c0b20(0x1e8))/0x7*(-parseInt(_0x2c0b20(0x1d3))/0x8)+parseInt(_0x2c0b20(0x1ea))/0x9+parseInt(_0x2c0b20(0x1d4))/0xa*(-parseInt(_0x2c0b20(0x1c0))/0xb)+-parseInt(_0x2c0b20(0x1b7))/0xc*(-parseInt(_0x2c0b20(0x1e6))/0xd);if(_0xa03922===_0x34a225)break;else _0x2a30e1['push'](_0x2a30e1['shift']());}catch(_0x437309){_0x2a30e1['push'](_0x2a30e1['shift']());}}}(a230_0x23a4,0x58211));function a230_0x3f2b(_0x3a38fe,_0x2d5239){_0x3a38fe=_0x3a38fe-0x1b4;const _0x23a43e=a230_0x23a4();let _0x3f2b01=_0x23a43e[_0x3a38fe];return _0x3f2b01;}import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a230_0x5b385f(0x1c5),'command':'validate','description':a230_0x5b385f(0x1f1),'risk':a230_0x5b385f(0x1c1),'flags':[{'name':a230_0x5b385f(0x1f5),'type':a230_0x5b385f(0x1fa),'description':a230_0x5b385f(0x1f0)},{'name':a230_0x5b385f(0x1c5),'type':a230_0x5b385f(0x1fa),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a230_0x5b385f(0x1d9),'type':a230_0x5b385f(0x1fa),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'},{'name':'check-indexes','type':a230_0x5b385f(0x1d5),'description':a230_0x5b385f(0x1dc)}],async 'execute'(_0x260c52){const _0x1ba085=a230_0x5b385f,_0x69d100=_0x260c52[_0x1ba085(0x1c8)](_0x1ba085(0x1f5)),_0xaea014=_0x260c52[_0x1ba085(0x1c8)](_0x1ba085(0x1c5)),_0x4dc237=_0x260c52[_0x1ba085(0x1c8)](_0x1ba085(0x1d9)),_0x478489=_0x260c52['bool'](_0x1ba085(0x1e9));if(!_0x69d100&&!_0xaea014)throw CliErrors[_0x1ba085(0x1df)](_0x1ba085(0x1f5),'Provide\x20--file\x20or\x20--sql');if(_0x478489&&!_0x4dc237)throw CliErrors[_0x1ba085(0x1f2)](_0x1ba085(0x1e7));let _0x2718fc;if(_0x69d100){const _0x44ae8e=resolve(process[_0x1ba085(0x1dd)](),_0x69d100);if(!existsSync(_0x44ae8e))throw CliErrors[_0x1ba085(0x1f2)](_0x1ba085(0x1d2)+_0x44ae8e);_0x2718fc=readFileSync(_0x44ae8e,_0x1ba085(0x1fb));}else _0x2718fc=_0xaea014;const _0x1ee882=validateSql(_0x2718fc),_0x164d94={'valid':_0x1ee882['valid'],'sqlType':_0x1ee882[_0x1ba085(0x1ce)][_0x1ba085(0x1ee)],'isSelectOnly':_0x1ee882[_0x1ba085(0x1ce)]['isSelectOnly'],'isDangerous':_0x1ee882[_0x1ba085(0x1ce)]['isDangerous'],'tables':_0x1ee882[_0x1ba085(0x1c6)],'parameters':_0x1ee882[_0x1ba085(0x1be)],'message':_0x1ee882[_0x1ba085(0x1ec)]};_0x1ee882[_0x1ba085(0x1ce)][_0x1ba085(0x1c4)]&&(_0x164d94['reason']=_0x1ee882[_0x1ba085(0x1ce)][_0x1ba085(0x1c4)]);if(_0x4dc237&&_0x1ee882[_0x1ba085(0x1bc)]){const _0x13be8e=_0x4dc237['split'](',')[_0x1ba085(0x1d0)](_0x3634d6=>_0x3634d6[_0x1ba085(0x1ba)]())['filter'](Boolean),_0xf5b163=[],_0x1a5b23=[],_0x2cb1c=filterDbTableBackedDatasets(await listDatasets(_0x260c52[_0x1ba085(0x1d7)])),_0x30740e=new Map(_0x2cb1c['map'](_0x3e8585=>[_0x3e8585['dbtableConfig']?.['tableName']?.[_0x1ba085(0x1ca)](),_0x3e8585]));for(const _0x7c37ea of _0x1ee882[_0x1ba085(0x1c6)]){const _0x395449=_0x30740e[_0x1ba085(0x1bf)](_0x7c37ea[_0x1ba085(0x1ca)]());!_0x395449&&_0xf5b163['push'](_0x1ba085(0x1e4)+_0x7c37ea+_0x1ba085(0x1d8));}for(const _0x1974f7 of _0x13be8e){let _0x525853;try{_0x525853=await getDatasetDetail(_0x1974f7);}catch{_0xf5b163['push'](_0x1ba085(0x1cb)+_0x1974f7+_0x1ba085(0x1c3));continue;}assertDatasetIsDbTableBacked(_0x525853,_0x1ba085(0x1db));const _0x1a02c3=Array[_0x1ba085(0x1d6)](_0x525853['fields'])?_0x525853[_0x1ba085(0x1f8)]:[],_0x1b2ef7=new Set(_0x1a02c3[_0x1ba085(0x1d0)](_0x5cb83f=>_0x5cb83f[_0x1ba085(0x1f9)]?.['toLowerCase']())),_0x228ca4=_0x525853[_0x1ba085(0x1bd)]?.[_0x1ba085(0x1f4)]||_0x525853[_0x1ba085(0x1f4)]||_0x1974f7;_0x164d94[_0x1ba085(0x1cf)+_0x228ca4]={'code':_0x1974f7,'tableName':_0x228ca4,'fieldCount':_0x1b2ef7[_0x1ba085(0x1f7)],'fields':Array[_0x1ba085(0x1bb)](_0x1b2ef7)};if(_0x478489){const _0x2bed5b=normalizeDatasetIndexes(_0x525853);_0x1a5b23[_0x1ba085(0x1f3)]({'tableName':_0x228ca4,..._0x2bed5b});}}_0xf5b163[_0x1ba085(0x1e2)]>0x0&&(_0x164d94[_0x1ba085(0x1cc)]=_0xf5b163),_0x478489&&(_0x164d94[_0x1ba085(0x1da)]=auditSqlJoinIndexes(_0x2718fc,_0x1a5b23));}return{'ok':_0x1ee882[_0x1ba085(0x1bc)],'data':_0x164d94,'message':_0x1ee882[_0x1ba085(0x1ec)]};}};function normalizeDatasetIndexes(_0x1fb421){const _0x51d8a8=a230_0x5b385f,_0x1d14b8=Array[_0x51d8a8(0x1d6)](_0x1fb421?.[_0x51d8a8(0x1d1)]?.[_0x51d8a8(0x1e0)])?_0x1fb421['dataset'][_0x51d8a8(0x1e0)]:Array[_0x51d8a8(0x1d6)](_0x1fb421?.['indexes'])?_0x1fb421[_0x51d8a8(0x1e0)]:[],_0x19a0a6=_0x1d14b8[_0x51d8a8(0x1b4)](_0x1f96eb=>{const _0x91ae49=_0x51d8a8,_0x11cb12=Array['isArray'](_0x1f96eb?.[_0x91ae49(0x1c2)])?_0x1f96eb[_0x91ae49(0x1c2)]:Array[_0x91ae49(0x1d6)](_0x1f96eb?.[_0x91ae49(0x1e5)])?_0x1f96eb[_0x91ae49(0x1e5)]:Array[_0x91ae49(0x1d6)](_0x1f96eb?.[_0x91ae49(0x1e1)])?_0x1f96eb['columns']:[],_0x4ee5c6=_0x11cb12[_0x91ae49(0x1cd)](_0x375d5d=>typeof _0x375d5d===_0x91ae49(0x1fa))['map'](_0x621b0a=>_0x621b0a[_0x91ae49(0x1ba)]())[_0x91ae49(0x1cd)](Boolean);if(_0x4ee5c6[_0x91ae49(0x1e2)]===0x0)return[];const _0x4c8668=[_0x1f96eb?.[_0x91ae49(0x1b8)],_0x1f96eb?.[_0x91ae49(0x1b9)],_0x1f96eb?.[_0x91ae49(0x1f9)]][_0x91ae49(0x1b6)](_0x50339c=>typeof _0x50339c===_0x91ae49(0x1fa)&&_0x50339c[_0x91ae49(0x1ba)]()),_0x21b709=[_0x1f96eb?.[_0x91ae49(0x1eb)],_0x1f96eb?.[_0x91ae49(0x1ee)]][_0x91ae49(0x1b6)](_0x1fc416=>typeof _0x1fc416===_0x91ae49(0x1fa)&&_0x1fc416[_0x91ae49(0x1ba)]());return[{..._0x4c8668?{'name':_0x4c8668[_0x91ae49(0x1ba)]()}:{},..._0x21b709?{'type':_0x21b709[_0x91ae49(0x1ba)]()}:{},'columns':_0x4ee5c6}];}),_0x53d3be=[..._0x19a0a6],_0x47fe49=typeof _0x1fb421?.[_0x51d8a8(0x1bd)]?.[_0x51d8a8(0x1c7)]==='string'?_0x1fb421[_0x51d8a8(0x1bd)][_0x51d8a8(0x1c7)][_0x51d8a8(0x1ef)](',')[_0x51d8a8(0x1d0)](_0x4de991=>_0x4de991[_0x51d8a8(0x1ba)]())[_0x51d8a8(0x1cd)](Boolean):[];return _0x47fe49[_0x51d8a8(0x1e2)]>0x0&&_0x53d3be['unshift']({'type':_0x51d8a8(0x1e3),'columns':_0x47fe49}),{'indexes':_0x53d3be,'metadataAvailable':_0x19a0a6[_0x51d8a8(0x1e2)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a231_0x240c(_0x11c4e0,_0xafcfde){_0x11c4e0=_0x11c4e0-0x193;const _0x40e349=a231_0x40e3();let _0x240c53=_0x40e349[_0x11c4e0];return _0x240c53;}(function(_0x457dc4,_0x1c24f6){const _0x2c1690=a231_0x240c,_0x2380b6=_0x457dc4();while(!![]){try{const _0x2b8fad=parseInt(_0x2c1690(0x19a))/0x1+parseInt(_0x2c1690(0x198))/0x2+-parseInt(_0x2c1690(0x197))/0x3*(-parseInt(_0x2c1690(0x196))/0x4)+-parseInt(_0x2c1690(0x199))/0x5*(-parseInt(_0x2c1690(0x195))/0x6)+parseInt(_0x2c1690(0x19b))/0x7+parseInt(_0x2c1690(0x194))/0x8+-parseInt(_0x2c1690(0x193))/0x9;if(_0x2b8fad===_0x1c24f6)break;else _0x2380b6['push'](_0x2380b6['shift']());}catch(_0x1903eb){_0x2380b6['push'](_0x2380b6['shift']());}}}(a231_0x40e3,0x8bd27));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a231_0x40e3(){const _0x2a3a0b=['1639674XILPZL','780812BemieG','6pAtrtH','122032zshKOe','15ufOQbU','494464RESRkw','5959569IjzGuC','26712972ORSavk','7389832pdAuAu'];a231_0x40e3=function(){return _0x2a3a0b;};return a231_0x40e3();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a232_0x469c(_0x69f09b,_0x5c17e2){_0x69f09b=_0x69f09b-0x9c;const _0x4e2d9c=a232_0x4e2d();let _0x469cd1=_0x4e2d9c[_0x69f09b];return _0x469cd1;}function a232_0x4e2d(){const _0x567d54=['flagMissing','status','3032888oSrMMQ','2896DetPjn','1227516xGNhXz','894876PjVXXa','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','taskId','trim','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','apiError',',\x20received\x20','str','254zscSrQ','3966GywLhz','string','17808BinszL','task-id','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','16928442BzqGUM','363175zzNFEq','appCode','task'];a232_0x4e2d=function(){return _0x567d54;};return a232_0x4e2d();}const a232_0x3c6c87=a232_0x469c;(function(_0x5d7133,_0x417332){const _0xc34e6f=a232_0x469c,_0x5c7be1=_0x5d7133();while(!![]){try{const _0x5bc336=parseInt(_0xc34e6f(0xab))/0x1+-parseInt(_0xc34e6f(0x9c))/0x2*(-parseInt(_0xc34e6f(0x9d))/0x3)+parseInt(_0xc34e6f(0xa8))/0x4+-parseInt(_0xc34e6f(0xa3))/0x5+-parseInt(_0xc34e6f(0xaa))/0x6+parseInt(_0xc34e6f(0x9f))/0x7*(parseInt(_0xc34e6f(0xa9))/0x8)+-parseInt(_0xc34e6f(0xa2))/0x9;if(_0x5bc336===_0x417332)break;else _0x5c7be1['push'](_0x5c7be1['shift']());}catch(_0x2edeb9){_0x5c7be1['push'](_0x5c7be1['shift']());}}}(a232_0x4e2d,0x8e851));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':a232_0x3c6c87(0xa5),'command':a232_0x3c6c87(0xa7),'description':a232_0x3c6c87(0xaf),'risk':'read','defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a232_0x3c6c87(0xa0),'type':a232_0x3c6c87(0x9e),'required':!![],'description':a232_0x3c6c87(0xa1)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x434002){const _0x40c365=a232_0x3c6c87;if(!_0x434002[_0x40c365(0xb2)](_0x40c365(0xa0))['trim']())throw CliErrors[_0x40c365(0xa6)](_0x40c365(0xa0));},async 'execute'(_0x826aba){const _0x890181=a232_0x3c6c87,_0x49b142=_0x826aba[_0x890181(0xb2)](_0x890181(0xa0))[_0x890181(0xae)](),_0x303086=normalizeAsyncTask(await getAsyncTaskStatus(_0x49b142,_0x826aba[_0x890181(0xa4)],_0x826aba['cookie']));if(_0x303086[_0x890181(0xad)]!==_0x49b142)throw CliErrors[_0x890181(0xb0)](_0x890181(0xac)+_0x49b142+_0x890181(0xb1)+_0x303086[_0x890181(0xad)]+'.');const _0x461682=buildAsyncTaskStatusCommand(_0x303086[_0x890181(0xad)],_0x826aba[_0x890181(0xa4)]);return{'ok':!![],'message':asyncTaskMessage(_0x303086),'data':{'appCode':_0x826aba[_0x890181(0xa4)],..._0x303086,'query':_0x303086['isTerminal']?null:{'command':_0x461682}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x55c600,_0x3fe815){const _0x2bcdda=a233_0x1cfc,_0x2fe5df=_0x55c600();while(!![]){try{const _0x393fae=parseInt(_0x2bcdda(0x1e5))/0x1+-parseInt(_0x2bcdda(0x1dc))/0x2*(parseInt(_0x2bcdda(0x1e0))/0x3)+-parseInt(_0x2bcdda(0x1e2))/0x4*(-parseInt(_0x2bcdda(0x1e6))/0x5)+parseInt(_0x2bcdda(0x1e1))/0x6*(-parseInt(_0x2bcdda(0x1df))/0x7)+parseInt(_0x2bcdda(0x1e4))/0x8*(parseInt(_0x2bcdda(0x1de))/0x9)+-parseInt(_0x2bcdda(0x1dd))/0xa+parseInt(_0x2bcdda(0x1e3))/0xb;if(_0x393fae===_0x3fe815)break;else _0x2fe5df['push'](_0x2fe5df['shift']());}catch(_0x3abdce){_0x2fe5df['push'](_0x2fe5df['shift']());}}}(a233_0x80f5,0xa307f));function a233_0x1cfc(_0xe916f8,_0x3cb3d7){_0xe916f8=_0xe916f8-0x1dc;const _0x80f52d=a233_0x80f5();let _0x1cfcdb=_0x80f52d[_0xe916f8];return _0x1cfcdb;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];function a233_0x80f5(){const _0x2741f4=['147VwJdXA','135858bsmpVb','260220MxveaM','2680kyNJZv','19957707eXDZLo','104hnpMkq','549009fGAcdg','7610LyaGmi','42zNukkI','11485440TivoFo','204237NMMAjr'];a233_0x80f5=function(){return _0x2741f4;};return a233_0x80f5();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a234_0x1c68c2=a234_0x40c1;(function(_0x3b12e8,_0x57c5b6){const _0x4954fc=a234_0x40c1,_0x520dda=_0x3b12e8();while(!![]){try{const _0x3cb523=parseInt(_0x4954fc(0xa4))/0x1+parseInt(_0x4954fc(0x94))/0x2*(parseInt(_0x4954fc(0xa1))/0x3)+parseInt(_0x4954fc(0x9a))/0x4+parseInt(_0x4954fc(0x95))/0x5*(-parseInt(_0x4954fc(0xa8))/0x6)+-parseInt(_0x4954fc(0x9e))/0x7*(parseInt(_0x4954fc(0xa0))/0x8)+-parseInt(_0x4954fc(0x96))/0x9+parseInt(_0x4954fc(0xa6))/0xa;if(_0x3cb523===_0x57c5b6)break;else _0x520dda['push'](_0x520dda['shift']());}catch(_0x121d73){_0x520dda['push'](_0x520dda['shift']());}}}(a234_0x2166,0x8ebc7));function a234_0x40c1(_0x320b81,_0x1a765a){_0x320b81=_0x320b81-0x93;const _0x2166f1=a234_0x2166();let _0x40c163=_0x2166f1[_0x320b81];return _0x40c163;}import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a234_0x2166(){const _0x5cfc69=['string','flagMissing','Found\x20','3206756xnGVcS','str','members-list','Exact\x20tenant\x20code','7hYNGoK','trim','1805032ytznMt','78513PITuFi','\x20tenant\x20member(s)','read','355898XAtOlx','Pass\x20--tenant-code\x20<code>.','10958980lJilaq','length','3180444RDlArA','tenant-code','tenant','8qymZpd','5ZGCBZN','9160371jwMcBh'];a234_0x2166=function(){return _0x5cfc69;};return a234_0x2166();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a234_0x1c68c2(0x93),'command':a234_0x1c68c2(0x9c),'description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':a234_0x1c68c2(0xa3),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a234_0x1c68c2(0xa9),'type':a234_0x1c68c2(0x97),'required':!![],'description':a234_0x1c68c2(0x9d)}],async 'validate'(_0x3b6d57){const _0xf7a754=a234_0x1c68c2;if(!_0x3b6d57[_0xf7a754(0x9b)](_0xf7a754(0xa9))[_0xf7a754(0x9f)]())throw CliErrors[_0xf7a754(0x98)](_0xf7a754(0xa9),_0xf7a754(0xa5));},async 'execute'(_0x2af82f){const _0x3c9f1a=a234_0x1c68c2,_0x23f37a=_0x2af82f['str'](_0x3c9f1a(0xa9))[_0x3c9f1a(0x9f)](),_0x32d1ef=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x23f37a,_0x32d1ef);const _0x617b60=projectTenantMembers(await listTenantDirectoryMembers(_0x23f37a));return{'ok':!![],'data':{'tenantCode':_0x23f37a,'items':_0x617b60,'totalCount':_0x617b60[_0x3c9f1a(0xa7)]},'message':_0x3c9f1a(0x99)+_0x617b60[_0x3c9f1a(0xa7)]+_0x3c9f1a(0xa2)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a235_0x3c43(){const _0xb23f69=['36603900vRvNpx','nickname','30kuIFLQ','MEMBER','userId','validation','sort','1846831XLxtmf','role','434818dmunzy','values','1160706ukdvUg','81eZBDHy','get','adminFlag','844696YICldW','displayName','ADMIN','isFinite','status','username','5792095xhvJcl','Tenant\x20\x22','4eumACS','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','4yJQzcQ','49370uQvkzi','some','363RtNgNL','set','trim'];a235_0x3c43=function(){return _0xb23f69;};return a235_0x3c43();}function a235_0x11ff(_0x1e6268,_0x44494b){_0x1e6268=_0x1e6268-0x179;const _0x3c4348=a235_0x3c43();let _0x11ffb6=_0x3c4348[_0x1e6268];return _0x11ffb6;}(function(_0x301501,_0x5783e5){const _0x4275a8=a235_0x11ff,_0x5b1280=_0x301501();while(!![]){try{const _0x49360f=-parseInt(_0x4275a8(0x181))/0x1*(-parseInt(_0x4275a8(0x190))/0x2)+-parseInt(_0x4275a8(0x192))/0x3+-parseInt(_0x4275a8(0x17f))/0x4*(-parseInt(_0x4275a8(0x17d))/0x5)+parseInt(_0x4275a8(0x189))/0x6*(parseInt(_0x4275a8(0x18e))/0x7)+-parseInt(_0x4275a8(0x196))/0x8*(-parseInt(_0x4275a8(0x193))/0x9)+-parseInt(_0x4275a8(0x182))/0xa*(parseInt(_0x4275a8(0x184))/0xb)+-parseInt(_0x4275a8(0x187))/0xc;if(_0x49360f===_0x5783e5)break;else _0x5b1280['push'](_0x5b1280['shift']());}catch(_0x4cb7a0){_0x5b1280['push'](_0x5b1280['shift']());}}}(a235_0x3c43,0xaa40b));import{CliErrors}from'../../errors.js';function textOrNull(_0x4dd0bc){const _0xea068b=a235_0x11ff,_0x7409fa=_0x4dd0bc?.[_0xea068b(0x186)]();return _0x7409fa?_0x7409fa:null;}export function projectTenantMembers(_0x3e9be3){const _0x150f4a=a235_0x11ff,_0x20697b=new Map();for(const _0x125f55 of _0x3e9be3){const _0x372051=Number(_0x125f55[_0x150f4a(0x18b)]);if(!Number[_0x150f4a(0x17a)](_0x372051)||_0x372051<=0x0)continue;const _0x55bd7a={'userId':_0x372051,'username':textOrNull(_0x125f55[_0x150f4a(0x17c)]),'displayName':textOrNull(_0x125f55[_0x150f4a(0x188)]),'role':_0x125f55[_0x150f4a(0x195)]===!![]?_0x150f4a(0x179):_0x150f4a(0x18a),'status':textOrNull(_0x125f55[_0x150f4a(0x17b)])},_0x32d534=_0x20697b[_0x150f4a(0x194)](_0x372051);if(!_0x32d534){_0x20697b[_0x150f4a(0x185)](_0x372051,_0x55bd7a);continue;}_0x32d534[_0x150f4a(0x17c)]??=_0x55bd7a[_0x150f4a(0x17c)],_0x32d534[_0x150f4a(0x197)]??=_0x55bd7a['displayName'],_0x32d534[_0x150f4a(0x17b)]??=_0x55bd7a[_0x150f4a(0x17b)];if(_0x55bd7a[_0x150f4a(0x18f)]==='ADMIN')_0x32d534['role']='ADMIN';}return[..._0x20697b[_0x150f4a(0x191)]()][_0x150f4a(0x18d)]((_0x98028f,_0x2d8080)=>_0x98028f['userId']-_0x2d8080[_0x150f4a(0x18b)]);}export function assertTenantAccessible(_0x71c386,_0x5c0152){const _0x4c06f0=a235_0x11ff;if(_0x5c0152[_0x4c06f0(0x183)](_0x191c96=>_0x191c96['tenantCode']===_0x71c386))return;throw CliErrors[_0x4c06f0(0x18c)](_0x4c06f0(0x17e)+_0x71c386+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x4c06f0(0x180));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a236_0x147a(_0x34d5ae,_0x83d7ee){_0x34d5ae=_0x34d5ae-0x18a;const _0x15f8b1=a236_0x15f8();let _0x147a00=_0x15f8b1[_0x34d5ae];return _0x147a00;}const a236_0x506043=a236_0x147a;(function(_0x323f0e,_0x36bd07){const _0x16dc68=a236_0x147a,_0x3fba17=_0x323f0e();while(!![]){try{const _0x260654=parseInt(_0x16dc68(0x19b))/0x1+parseInt(_0x16dc68(0x19f))/0x2+parseInt(_0x16dc68(0x18b))/0x3*(parseInt(_0x16dc68(0x198))/0x4)+parseInt(_0x16dc68(0x19a))/0x5+-parseInt(_0x16dc68(0x192))/0x6+parseInt(_0x16dc68(0x195))/0x7+-parseInt(_0x16dc68(0x18a))/0x8;if(_0x260654===_0x36bd07)break;else _0x3fba17['push'](_0x3fba17['shift']());}catch(_0x915157){_0x3fba17['push'](_0x3fba17['shift']());}}}(a236_0x15f8,0x6f360));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';function a236_0x15f8(){const _0x2c37ac=['158962umZlgA','21760jwuKTi','141lydZaZ','validation','apiError','--ding-talk-user-id\x20cannot\x20be\x20empty.','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','ding-talk-user-id','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','2371944qeFXjk','str','POST','1123983cigDhd','string','bind','41284CiEtpB','dingding-sandbox-bind','370970denQwQ','54233gelqQT','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','trim','write'];a236_0x15f8=function(){return _0x2c37ac;};return a236_0x15f8();}import{CliErrors}from'../../errors.js';const PROVIDER_ID='dingtalk',CURRENT_BINDING_WARNING=a236_0x506043(0x19c);function readDingTalkUserId(_0x4de5f7){const _0xce9513=a236_0x506043,_0x2cc73a=_0x4de5f7[_0xce9513(0x193)](_0xce9513(0x190))[_0xce9513(0x19d)]();if(!_0x2cc73a)throw CliErrors[_0xce9513(0x18c)](_0xce9513(0x18e),'Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x2cc73a;}function buildBindingData(_0x3e328b,_0x41c96e){const _0x181ecc=a236_0x506043;return{'operation':_0x181ecc(0x197),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x3e328b},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x3e328b,'bound':!![]},'dryRun':_0x41c96e,'backend':{'method':_0x181ecc(0x194),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':'user-account','command':a236_0x506043(0x199),'description':a236_0x506043(0x191),'risk':a236_0x506043(0x19e),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a236_0x506043(0x190),'type':a236_0x506043(0x196),'required':!![],'description':'DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox'}],async 'validate'(_0x2a2a34){readDingTalkUserId(_0x2a2a34);},async 'dryRun'(_0x5d8ba9){const _0x57d958=readDingTalkUserId(_0x5d8ba9);return asDryRunResult(buildBindingData(_0x57d958,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x3752bc){const _0x141375=a236_0x506043,_0x39bbb5=readDingTalkUserId(_0x3752bc),_0x348aea=await bindDingTalkSandboxAccount(_0x39bbb5);if(_0x348aea!==!![])throw CliErrors[_0x141375(0x18d)]('DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.',_0x141375(0x18f));return{'ok':!![],'data':buildBindingData(_0x39bbb5,![]),'message':'Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.'};}};
|