@lovrabet/rabetbase-cli 2.5.4 → 2.5.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/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.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +35 -0
- package/skills/rabetbase-page-generation/references/component-baseline.md +18 -0
- package/skills/rabetbase-page-generation/references/generation.md +77 -0
- package/skills/rabetbase-page-generation/templates/onepage/build.mjs +63 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/index.jsx +4 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/index.jsx +194 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/index.jsx +717 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/editor.jsx +395 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/model.js +141 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/page.css +377 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/record-layout.jsx +90 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/responsive.jsx +70 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/README.md +21 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/index.jsx +4 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/preview.png +0 -0
- package/skills/rabetbase.manifest.json +3 -3
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a239_0xd22ec7=a239_0x151d;function a239_0x151d(_0x340d26,_0x270375){_0x340d26=_0x340d26-0x164;const _0x2013e0=a239_0x2013();let _0x151dfa=_0x2013e0[_0x340d26];return _0x151dfa;}function a239_0x2013(){const _0x339679=['3895ixVAqp','136961SBeWfX','32VovqWo','read','6030300rMrqUt','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','isArray','execError','appCode','execSuccess','3266775tuXTku','4cohhBl','now','params','2149215zxcUhk','string','10506OXhHDQ','sqlcode','3797584SddqNR','length','SQL\x20execution\x20failed','str','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','2373048QqpEqi'];a239_0x2013=function(){return _0x339679;};return a239_0x2013();}(function(_0x373242,_0x35cc65){const _0x6bcdf4=a239_0x151d,_0x2f7f48=_0x373242();while(!![]){try{const _0x9cdc73=parseInt(_0x6bcdf4(0x16c))/0x1+parseInt(_0x6bcdf4(0x176))/0x2*(parseInt(_0x6bcdf4(0x179))/0x3)+-parseInt(_0x6bcdf4(0x16a))/0x4+parseInt(_0x6bcdf4(0x16b))/0x5*(parseInt(_0x6bcdf4(0x17b))/0x6)+parseInt(_0x6bcdf4(0x164))/0x7+-parseInt(_0x6bcdf4(0x16d))/0x8*(parseInt(_0x6bcdf4(0x175))/0x9)+-parseInt(_0x6bcdf4(0x16f))/0xa;if(_0x9cdc73===_0x35cc65)break;else _0x2f7f48['push'](_0x2f7f48['shift']());}catch(_0x32c5cd){_0x2f7f48['push'](_0x2f7f48['shift']());}}}(a239_0x2013,0xca2d8));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':'exec','description':a239_0xd22ec7(0x168),'risk':a239_0xd22ec7(0x16e),'flags':[SQLCODE_FLAG,{'name':a239_0xd22ec7(0x178),'type':a239_0xd22ec7(0x17a),'description':a239_0xd22ec7(0x170)}],async 'execute'(_0x265179){const _0x22d587=a239_0xd22ec7,_0xd71f65=parseJsonParams(_0x265179[_0x22d587(0x167)](_0x22d587(0x178))),_0xdb63b1=Date[_0x22d587(0x177)](),_0x266046=await executeSql(_0x265179[_0x22d587(0x173)],_0x265179[_0x22d587(0x167)](_0x22d587(0x17c)),_0xd71f65),_0x1044df=Date[_0x22d587(0x177)]()-_0xdb63b1,_0x47c9d2=_0x266046?.[_0x22d587(0x169)]??_0x266046,_0x463bf7=_0x266046?.[_0x22d587(0x174)]??!![];if(!_0x463bf7)return{'ok':![],'data':{'error':_0x266046?.[_0x22d587(0x172)]||_0x22d587(0x166),'elapsed':_0x1044df},'message':_0x22d587(0x166)};const _0x5e3e7b=Array[_0x22d587(0x171)](_0x47c9d2)?_0x47c9d2:[];return{'ok':!![],'data':{'rows':_0x5e3e7b,'rowCount':_0x5e3e7b[_0x22d587(0x165)],'elapsed':_0x1044df},'message':'Returned\x20'+_0x5e3e7b[_0x22d587(0x165)]+'\x20row(s)\x20in\x20'+_0x1044df+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x128361,_0x39ed1e){const _0x157cc3=a240_0x3d2d,_0x5649cb=_0x128361();while(!![]){try{const _0x11b70b=-parseInt(_0x157cc3(0x17f))/0x1+-parseInt(_0x157cc3(0x17d))/0x2+-parseInt(_0x157cc3(0x185))/0x3*(-parseInt(_0x157cc3(0x17c))/0x4)+-parseInt(_0x157cc3(0x182))/0x5+parseInt(_0x157cc3(0x180))/0x6*(parseInt(_0x157cc3(0x183))/0x7)+-parseInt(_0x157cc3(0x184))/0x8*(-parseInt(_0x157cc3(0x17e))/0x9)+parseInt(_0x157cc3(0x181))/0xa;if(_0x11b70b===_0x39ed1e)break;else _0x5649cb['push'](_0x5649cb['shift']());}catch(_0x1bda21){_0x5649cb['push'](_0x5649cb['shift']());}}}(a240_0x569e,0xa57b9));function a240_0x3d2d(_0x22249a,_0x512b68){_0x22249a=_0x22249a-0x17c;const _0x569e6c=a240_0x569e();let _0x3d2d9e=_0x569e6c[_0x22249a];return _0x3d2d9e;}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a240_0x569e(){const _0x4979b0=['492496eApySk','2688812fbVJuA','357759OWDIWM','924955NpisTI','35832LSxkgZ','25044340SHmyJC','5030775mjLPyt','371tcMdoU','104EnaYvu','15cCubte'];a240_0x569e=function(){return _0x4979b0;};return a240_0x569e();}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a241_0x44cf6e=a241_0x2f6a;(function(_0x459886,_0x4e0666){const _0x116e33=a241_0x2f6a,_0x79b699=_0x459886();while(!![]){try{const _0x5f095a=parseInt(_0x116e33(0xb5))/0x1+-parseInt(_0x116e33(0x95))/0x2*(-parseInt(_0x116e33(0xa1))/0x3)+parseInt(_0x116e33(0xaa))/0x4+parseInt(_0x116e33(0xb3))/0x5+-parseInt(_0x116e33(0x9a))/0x6+-parseInt(_0x116e33(0xb0))/0x7+-parseInt(_0x116e33(0x9f))/0x8;if(_0x5f095a===_0x4e0666)break;else _0x79b699['push'](_0x79b699['shift']());}catch(_0x414368){_0x79b699['push'](_0x79b699['shift']());}}}(a241_0x5d2c,0x213f9));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a241_0x2f6a(_0x7d4667,_0x41c87){_0x7d4667=_0x7d4667-0x93;const _0x5d2ccd=a241_0x5d2c();let _0x2f6af3=_0x5d2ccd[_0x7d4667];return _0x2f6af3;}function a241_0x5d2c(){const _0x1cc698=['pagesize','verbose','List\x20custom\x20SQL\x20queries','sqlcode','list','770994aHDfEK','num','dbId','910705BdiDaG','Filter\x20by\x20SQL\x20name','180271dzIOZG','\x20SQL\x20queries\x20(total:\x20','sqlCode','map','447958hgHPLe','Page\x20size','read','sqlName','bool','954564brPVqR','length','sql','string','No\x20custom\x20SQL\x20queries\x20found.','2806416AJcmpv','totalCount','3kRvUTo','paging','page','name','appCode','boolean','number','str','Found\x20','679328hUPPFc'];a241_0x5d2c=function(){return _0x1cc698;};return a241_0x5d2c();}export const sqlList={'service':a241_0x44cf6e(0x9c),'command':a241_0x44cf6e(0xaf),'description':a241_0x44cf6e(0xad),'risk':a241_0x44cf6e(0x97),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a241_0x44cf6e(0xa4),'type':a241_0x44cf6e(0x9d),'description':a241_0x44cf6e(0xb4)},{'name':a241_0x44cf6e(0xa3),'type':a241_0x44cf6e(0xa7),'description':'Page\x20number','default':0x1},{'name':a241_0x44cf6e(0xab),'type':'number','description':a241_0x44cf6e(0x96)},{'name':a241_0x44cf6e(0xac),'type':a241_0x44cf6e(0xa6),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x576811){const _0x1d2b34=a241_0x44cf6e,_0x2ae84b=await listSqlQueries(_0x576811[_0x1d2b34(0xa5)],{'sqlCode':_0x576811[_0x1d2b34(0xa8)](_0x1d2b34(0xae))||undefined,'sqlName':_0x576811[_0x1d2b34(0xa8)](_0x1d2b34(0xa4))||undefined,'currentPage':_0x576811[_0x1d2b34(0xb1)](_0x1d2b34(0xa3)),'pageSize':_0x576811[_0x1d2b34(0xb1)](_0x1d2b34(0xab),0x32)}),_0x22b978=_0x576811[_0x1d2b34(0x99)](_0x1d2b34(0xac)),_0x5dd9b5=_0x2ae84b['tableData']??[],_0x3a1fa3=_0x2ae84b[_0x1d2b34(0xa2)]?.[_0x1d2b34(0xa0)]??_0x5dd9b5[_0x1d2b34(0x9b)];let _0x29cd7b;return _0x22b978?_0x29cd7b=_0x5dd9b5:_0x29cd7b=await Promise['all'](_0x5dd9b5[_0x1d2b34(0x94)](async _0x569bed=>{const _0x436ed5=_0x1d2b34;let _0x5cab17;try{_0x5cab17=_0x569bed[_0x436ed5(0xb2)]?await getDbName(_0x576811[_0x436ed5(0xa5)],_0x569bed['dbId']):undefined;}catch{}return{'sqlCode':_0x569bed[_0x436ed5(0x93)],'sqlName':_0x569bed[_0x436ed5(0x98)],'description':_0x569bed['description']??'','db':_0x5cab17?_0x5cab17+'\x20('+_0x569bed[_0x436ed5(0xb2)]+')':_0x569bed[_0x436ed5(0xb2)]??''};})),{'ok':!![],'data':_0x29cd7b,'message':_0x5dd9b5[_0x1d2b34(0x9b)]===0x0?_0x1d2b34(0x9e):_0x1d2b34(0xa9)+_0x5dd9b5[_0x1d2b34(0x9b)]+_0x1d2b34(0xb6)+_0x3a1fa3+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a242_0x58b04f=a242_0x4c29;(function(_0x3bac07,_0x2bf5f7){const _0x1ea084=a242_0x4c29,_0x4b2fcd=_0x3bac07();while(!![]){try{const _0x26613e=parseInt(_0x1ea084(0x187))/0x1+parseInt(_0x1ea084(0x165))/0x2+-parseInt(_0x1ea084(0x159))/0x3+parseInt(_0x1ea084(0x144))/0x4+-parseInt(_0x1ea084(0x186))/0x5+-parseInt(_0x1ea084(0x14b))/0x6+parseInt(_0x1ea084(0x158))/0x7;if(_0x26613e===_0x2bf5f7)break;else _0x4b2fcd['push'](_0x4b2fcd['shift']());}catch(_0x2531f9){_0x4b2fcd['push'](_0x4b2fcd['shift']());}}}(a242_0x4f2a,0x1a1ac));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x1440ea,_0x95ade3){const _0x3953fa=a242_0x4c29,_0x356ff5=[];let _0x1a78df=0x1;while(!![]){const _0x61a438=await listSqlQueries(_0x1440ea,{'currentPage':_0x1a78df,'pageSize':PAGE_SIZE,'sqlCode':_0x95ade3['sqlCode'],'sqlName':_0x95ade3[_0x3953fa(0x171)]}),_0x5e7b6c=_0x61a438[_0x3953fa(0x145)]??[];_0x356ff5['push'](..._0x5e7b6c);if(_0x5e7b6c[_0x3953fa(0x16f)]===0x0)break;const _0x3d7325=_0x61a438['paging']?.[_0x3953fa(0x18c)];if(_0x3d7325!=null?_0x356ff5[_0x3953fa(0x16f)]>=_0x3d7325:_0x5e7b6c[_0x3953fa(0x16f)]<PAGE_SIZE)break;_0x1a78df++;}return _0x356ff5;}async function ensureSqlContent(_0x5be63f){const _0x25dfc1=a242_0x4c29;if(_0x5be63f[_0x25dfc1(0x167)]!=null&&String(_0x5be63f['sqlContent'])['length']>0x0)return _0x5be63f;return getSqlQueryDetail(_0x5be63f[_0x25dfc1(0x146)]);}export const sqlPull={'service':'sql','command':a242_0x58b04f(0x15a),'description':a242_0x58b04f(0x16a),'risk':a242_0x58b04f(0x14a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a242_0x58b04f(0x182),'type':a242_0x58b04f(0x156),'description':a242_0x58b04f(0x17a)},{'name':'force','type':a242_0x58b04f(0x173),'description':a242_0x58b04f(0x14f)}],async 'dryRun'(_0x4af89f){const _0x3efa77=a242_0x58b04f,_0x1179a4=loadSqlProjectConfig(_0x4af89f[_0x3efa77(0x157)]),_0x5e63a3=await readSqlLockFile(_0x1179a4[_0x3efa77(0x14d)]),{appLock:_0x1cc665}=ensureSqlLockScope(_0x5e63a3??createEmptySqlLock(),_0x1179a4[_0x3efa77(0x157)],_0x1179a4[_0x3efa77(0x152)],_0x3efa77(0x15a)),_0xef9e1a=await fetchAllSqlQueries(_0x4af89f[_0x3efa77(0x157)],{'sqlCode':_0x4af89f[_0x3efa77(0x16d)](_0x3efa77(0x183))||undefined,'sqlName':_0x4af89f[_0x3efa77(0x16d)](_0x3efa77(0x182))||undefined}),_0x584e19=[];for(const _0x3ca31b of _0xef9e1a){const _0x59c9d8=await ensureSqlContent(_0x3ca31b),_0x4d2cbf=ensureRemoteSqlContent(_0x59c9d8),_0x244889=detectSqlMode(_0x4d2cbf),_0x113219=_0x59c9d8[_0x3efa77(0x177)]?await getDbName(_0x4af89f[_0x3efa77(0x157)],Number(_0x59c9d8[_0x3efa77(0x177)]))[_0x3efa77(0x178)](()=>undefined):undefined,_0x417783=buildLocalSqlFileContent({'sqlCode':_0x59c9d8[_0x3efa77(0x146)],'sqlName':_0x59c9d8[_0x3efa77(0x171)],'dbId':_0x59c9d8['dbId']},_0x4d2cbf,{'dbName':_0x113219,'mode':_0x244889,'syncedAt':new Date()['toISOString'](),'description':_0x59c9d8[_0x3efa77(0x161)]}),_0x3c69b0=buildSqlLockEntry(_0x59c9d8,_0x4d2cbf,'',{'dbName':_0x113219}),_0x11048f=resolveLocalSqlFilePath(_0x1179a4,_0x59c9d8[_0x3efa77(0x146)],_0x3c69b0);let _0x57bdd1=_0x3efa77(0x15d),_0x52a74b;const _0x375f0c=await findExistingSqlFiles(_0x1179a4,_0x11048f,_0x244889,_0x1cc665[_0x3efa77(0x155)][_0x59c9d8[_0x3efa77(0x146)]]);if(_0x375f0c[_0x3efa77(0x16f)]>0x0){const _0x2acf8c=await compareExistingSqlFiles(_0x375f0c,_0x417783,_0x244889);if(_0x2acf8c[_0x3efa77(0x169)](({equivalent:_0x3aa68a})=>!_0x3aa68a))_0x57bdd1=_0x3efa77(0x16b),_0x52a74b=_0x3efa77(0x17c);else _0x2acf8c[_0x3efa77(0x16f)]===0x1&&_0x2acf8c[0x0]?.['file'][_0x3efa77(0x166)]&&(_0x57bdd1=_0x3efa77(0x185),_0x52a74b=_0x3efa77(0x14e));}_0x584e19[_0x3efa77(0x153)]({'sqlCode':_0x59c9d8[_0x3efa77(0x146)],'sqlName':_0x59c9d8['sqlName'],'filePath':_0x11048f,'status':_0x57bdd1,'reason':_0x52a74b});}return{'method':_0x3efa77(0x180),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x4af89f[_0x3efa77(0x157)],'sqlCode':_0x4af89f[_0x3efa77(0x16d)](_0x3efa77(0x183))||null,'sqlName':_0x4af89f[_0x3efa77(0x16d)](_0x3efa77(0x182))||null,'files':_0x584e19},'description':_0x3efa77(0x15f)+_0x584e19[_0x3efa77(0x16f)]+_0x3efa77(0x163)+_0x1179a4['sqlRootDir']};},async 'execute'(_0x1c884b){const _0x211744=a242_0x58b04f,_0x37c4f8=loadSqlProjectConfig(_0x1c884b['appCode']),_0x8890cc=await readSqlLockFile(_0x37c4f8[_0x211744(0x14d)]),{lockData:_0x1dbd72,appLock:_0x32e1d6}=ensureSqlLockScope(_0x8890cc??createEmptySqlLock(),_0x37c4f8[_0x211744(0x157)],_0x37c4f8['sqlRoot'],'pull'),_0x1f209a=_0x1c884b[_0x211744(0x188)]('force'),_0x43f633=await fetchAllSqlQueries(_0x1c884b['appCode'],{'sqlCode':_0x1c884b[_0x211744(0x16d)](_0x211744(0x183))||undefined,'sqlName':_0x1c884b[_0x211744(0x16d)](_0x211744(0x182))||undefined});if(_0x43f633['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x211744(0x164)};const _0x5c95c2=[],_0x3fb976=[];for(const _0x15fb91 of _0x43f633){try{_0x5c95c2[_0x211744(0x153)](await ensureSqlContent(_0x15fb91));}catch(_0x45598e){_0x3fb976[_0x211744(0x153)]({'sqlCode':_0x15fb91[_0x211744(0x146)],'error':_0x45598e instanceof Error?_0x45598e[_0x211744(0x150)]:String(_0x45598e)});}}if(_0x1f209a&&!_0x1c884b[_0x211744(0x170)]){let _0x1dd815=![];for(const _0x3f4ad4 of _0x5c95c2){const _0x525ef4=detectSqlMode(ensureRemoteSqlContent(_0x3f4ad4)),_0x1df824=_0x3f4ad4[_0x211744(0x177)]?await getDbName(_0x1c884b[_0x211744(0x157)],Number(_0x3f4ad4['dbId']))[_0x211744(0x178)](()=>undefined):undefined,_0x3a0560=buildLocalSqlFileContent({'sqlCode':_0x3f4ad4[_0x211744(0x146)],'sqlName':_0x3f4ad4[_0x211744(0x171)],'dbId':_0x3f4ad4[_0x211744(0x177)]},ensureRemoteSqlContent(_0x3f4ad4),{'dbName':_0x1df824,'mode':_0x525ef4,'syncedAt':new Date()[_0x211744(0x176)](),'description':_0x3f4ad4['description']}),_0x577ce9=resolveLocalSqlFilePath(_0x37c4f8,_0x3f4ad4['sqlCode'],buildSqlLockEntry(_0x3f4ad4,ensureRemoteSqlContent(_0x3f4ad4),'',{'dbName':_0x1df824})),_0x1e7d3d=await findExistingSqlFiles(_0x37c4f8,_0x577ce9,_0x525ef4,_0x32e1d6[_0x211744(0x155)][_0x3f4ad4[_0x211744(0x146)]]),_0x5d0fb2=await compareExistingSqlFiles(_0x1e7d3d,_0x3a0560,_0x525ef4);if(_0x5d0fb2[_0x211744(0x169)](({equivalent:_0x4f1596})=>!_0x4f1596)){_0x1dd815=!![];break;}}if(_0x1dd815){const _0x1b6c6e=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1b6c6e)throw CliErrors[_0x211744(0x162)](_0x211744(0x172));}}const _0x262c6c=cloneSqlLockData(_0x1dbd72),_0x558668=_0x262c6c[_0x211744(0x18a)][_0x37c4f8[_0x211744(0x157)]],_0x1c74d1=[],_0x4d73a1=[];for(const _0x1fba20 of _0x5c95c2){const _0x3d99ea=_0x558668[_0x211744(0x155)][_0x1fba20[_0x211744(0x146)]],_0x3c7501=ensureRemoteSqlContent(_0x1fba20),_0x32591c=detectSqlMode(_0x3c7501),_0x42db55=_0x1fba20[_0x211744(0x177)]?await getDbName(_0x1c884b[_0x211744(0x157)],Number(_0x1fba20[_0x211744(0x177)]))[_0x211744(0x178)](()=>undefined):undefined,_0x564fa0=buildLocalSqlFileContent({'sqlCode':_0x1fba20[_0x211744(0x146)],'sqlName':_0x1fba20['sqlName'],'dbId':_0x1fba20[_0x211744(0x177)]},_0x3c7501,{'dbName':_0x42db55,'mode':_0x32591c,'syncedAt':new Date()[_0x211744(0x176)](),'description':_0x1fba20['description']}),_0x23d907=buildSqlLockEntry(_0x1fba20,_0x3c7501,computeSqlContentHash(_0x564fa0),{'dbName':_0x42db55}),_0x5cad2b=_0x23d907[_0x211744(0x15b)],_0x23c82b=join(_0x37c4f8['sqlRootDir'],_0x5cad2b);try{const _0x23967a=await findExistingSqlFiles(_0x37c4f8,_0x23c82b,_0x32591c,_0x3d99ea),_0xe78eb3=await compareExistingSqlFiles(_0x23967a,_0x564fa0,_0x32591c);if(!_0x1f209a&&_0xe78eb3[_0x211744(0x169)](({equivalent:_0xdf8de9})=>!_0xdf8de9)){_0x4d73a1['push']({'sqlCode':_0x1fba20[_0x211744(0x146)],'reason':_0x211744(0x174)});continue;}const _0x3a687e=_0xe78eb3['find'](({file:_0x556279})=>_0x556279[_0x211744(0x166)]),_0x4d24df=_0xe78eb3[_0x211744(0x17e)](({file:_0x7bff8d})=>!_0x7bff8d['isCanonical']);if(_0x3a687e?.[_0x211744(0x149)]&&!_0x4d24df){_0x4d73a1['push']({'sqlCode':_0x1fba20[_0x211744(0x146)],'reason':_0x211744(0x14e)}),_0x558668[_0x211744(0x155)][_0x1fba20[_0x211744(0x146)]]={..._0x23d907,'hash':computeSqlContentHash(_0x3a687e[_0x211744(0x17f)]),'path':_0x5cad2b};continue;}!_0x3a687e?.[_0x211744(0x149)]&&(await ensureParentDirectory(_0x23c82b),await writeFile(_0x23c82b,_0x564fa0,_0x211744(0x179))),_0x4d24df&&await rm(_0x4d24df[_0x211744(0x14c)][_0x211744(0x15c)],{'force':!![]}),_0x558668['sqls'][_0x1fba20['sqlCode']]={..._0x23d907,'hash':_0x3a687e?.[_0x211744(0x149)]?computeSqlContentHash(_0x3a687e[_0x211744(0x17f)]):_0x23d907[_0x211744(0x181)],'path':_0x5cad2b},_0x1c74d1[_0x211744(0x153)]({'sqlCode':_0x1fba20[_0x211744(0x146)],'filePath':_0x23c82b});}catch(_0x5293a4){_0x3fb976[_0x211744(0x153)]({'sqlCode':_0x1fba20['sqlCode'],'error':_0x5293a4 instanceof Error?_0x5293a4['message']:String(_0x5293a4)});}}return _0x558668[_0x211744(0x168)]=new Date()[_0x211744(0x176)](),await writeSqlLockFile(_0x37c4f8['lockFilePath'],_0x262c6c),{'ok':_0x3fb976[_0x211744(0x16f)]===0x0,'data':{'pulled':_0x1c74d1,'skipped':_0x4d73a1,'failed':_0x3fb976},'message':_0x211744(0x15e)+_0x1c74d1[_0x211744(0x16f)]+_0x211744(0x16e)+_0x4d73a1[_0x211744(0x16f)]+'\x20skipped,\x20'+_0x3fb976[_0x211744(0x16f)]+_0x211744(0x16c)};}};function a242_0x4c29(_0x28cce2,_0x3175af){_0x28cce2=_0x28cce2-0x143;const _0x4f2a49=a242_0x4f2a();let _0x4c296d=_0x4f2a49[_0x28cce2];return _0x4c296d;}function isEquivalentPulledSqlFile(_0x78d928,_0x3234e9,_0x3a4d10,_0x868e08){if(_0x3a4d10!==_0x868e08)return normalizePulledSqlBody(_0x78d928,_0x3a4d10)===normalizePulledSqlBody(_0x3234e9,_0x868e08);return normalizePullComparableContent(_0x78d928,_0x3a4d10)===normalizePullComparableContent(_0x3234e9,_0x868e08);}function a242_0x4f2a(){const _0x3d481f=['lastSync','some','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','conflict','\x20failed','str','\x20written,\x20','length','nonInteractive','sqlName','Force\x20pull\x20cancelled.','boolean','local\x20differs\x20from\x20remote','sql','toISOString','dbId','catch','utf8','Filter\x20by\x20SQL\x20display\x20name','test','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','mybatisXml','find','content','POST','hash','name','sqlcode','trim','skipped','22855ZDJpAm','83971zzxAIj','bool','.xml','apps','replace','totalCount','join','265316GZvDYS','tableData','sqlCode','all','toLowerCase','equivalent','read','592788MdkPhe','file','lockFilePath','unchanged','Force\x20overwrite\x20local\x20unsynced\x20changes','message','sqlRootDir','sqlRoot','push','mode','sqls','string','appCode','738262xWJlli','308625FuaerO','pull','path','filePath','would_pull','Pull\x20complete:\x20','Would\x20pull\x20','map','description','cancelled','\x20SQL\x20file(s)\x20into\x20','No\x20remote\x20SQL\x20queries\x20matched.','114804GxteJB','isCanonical','sqlContent'];a242_0x4f2a=function(){return _0x3d481f;};return a242_0x4f2a();}async function findExistingSqlFiles(_0x346f0c,_0x554084,_0x1c9ded,_0x4289f0){const _0x4d904f=a242_0x58b04f,_0x1aa9c7=[];await fileExists(_0x554084)&&_0x1aa9c7[_0x4d904f(0x153)]({'filePath':_0x554084,'mode':_0x1c9ded,'isCanonical':!![]});if(!_0x4289f0?.[_0x4d904f(0x15b)])return _0x1aa9c7;const _0x365714=join(_0x346f0c[_0x4d904f(0x151)],_0x4289f0['path']);if(_0x365714===_0x554084)return _0x1aa9c7;return await fileExists(_0x365714)&&_0x1aa9c7[_0x4d904f(0x153)]({'filePath':_0x365714,'mode':_0x4289f0[_0x4d904f(0x154)]??modeFromFilePath(_0x365714),'isCanonical':![]}),_0x1aa9c7;}async function compareExistingSqlFiles(_0x313129,_0x2165ee,_0x517c27){const _0x475e94=a242_0x58b04f;return Promise[_0x475e94(0x147)](_0x313129[_0x475e94(0x160)](async _0x464bfa=>{const _0x2fe2dd=_0x475e94,_0x4a8677=await readFile(_0x464bfa['filePath'],'utf8');return{'file':_0x464bfa,'content':_0x4a8677,'equivalent':isEquivalentPulledSqlFile(_0x4a8677,_0x2165ee,_0x464bfa[_0x2fe2dd(0x154)],_0x517c27)};}));}function modeFromFilePath(_0x26252c){const _0x538c71=a242_0x58b04f;return _0x26252c[_0x538c71(0x148)]()['endsWith'](_0x538c71(0x189))?_0x538c71(0x17d):_0x538c71(0x175);}function normalizePulledSqlBody(_0x1f7d13,_0x4606e4){const _0x34faaf=a242_0x58b04f;return stripLocalSqlMetadata(_0x1f7d13,_0x4606e4)[_0x34faaf(0x18b)](/\r\n/g,'\x0a')[_0x34faaf(0x184)]();}function normalizePullComparableContent(_0x2841a0,_0x21ff3c){const _0x50d7a1=a242_0x58b04f,_0x4c4c72=_0x2841a0[_0x50d7a1(0x18b)](/\r\n/g,'\x0a')['split']('\x0a'),_0x5090e4=_0x4c4c72['filter'](_0xce7859=>!isSyncedAtMetadataLine(_0xce7859,_0x21ff3c));return _0x5090e4[_0x50d7a1(0x143)]('\x0a');}function isSyncedAtMetadataLine(_0x210b96,_0x4708c0){const _0x1e6680=a242_0x58b04f;if(_0x4708c0===_0x1e6680(0x17d))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1e6680(0x17b)](_0x210b96);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1e6680(0x17b)](_0x210b96);}
|
|
1
|
+
const a242_0x1a79b6=a242_0x4e2f;function a242_0x5ba8(){const _0x91fafc=['equivalent','sqlContent','POST','7GrDNdJ','sqlcode','trim','.xml','No\x20remote\x20SQL\x20queries\x20matched.','\x20SQL\x20file(s)\x20into\x20','totalCount','lockFilePath','push','mode','test','toLowerCase','Pull\x20complete:\x20','12RJVNEC','map','read','str','catch','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqls','569022trfgdP','force','content','\x20skipped,\x20','569560zmxpRh','233637pgHfYk','path','description','replace','name','Filter\x20by\x20SQL\x20display\x20name','message','length','dbId','sqlName','\x20failed','\x20written,\x20','some','isCanonical','sqlRootDir','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','hash','filter','boolean','tableData','mybatisXml','split','lastSync','55058bnscKe','2651930UrTrgl','file','sqlRoot','3279108AEUkTv','all','sqlCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','cancelled','pull','string','4Joomtw','9GPTVYV','5WqpBtY','Would\x20pull\x20','toISOString','appCode','join','skipped','utf8','Force\x20pull\x20cancelled.','1423455RWcmuD','sql','8IHdRzi','local\x20differs\x20from\x20remote','nonInteractive','39yfIuRd','filePath'];a242_0x5ba8=function(){return _0x91fafc;};return a242_0x5ba8();}(function(_0x42f00e,_0x4d5b2f){const _0xe48ca8=a242_0x4e2f,_0x1eb8c4=_0x42f00e();while(!![]){try{const _0x19d924=-parseInt(_0xe48ca8(0x1a1))/0x1*(parseInt(_0xe48ca8(0x18a))/0x2)+-parseInt(_0xe48ca8(0x1c2))/0x3*(-parseInt(_0xe48ca8(0x195))/0x4)+parseInt(_0xe48ca8(0x197))/0x5*(-parseInt(_0xe48ca8(0x1bd))/0x6)+-parseInt(_0xe48ca8(0x1a9))/0x7*(-parseInt(_0xe48ca8(0x1c1))/0x8)+parseInt(_0xe48ca8(0x196))/0x9*(-parseInt(_0xe48ca8(0x18b))/0xa)+parseInt(_0xe48ca8(0x19f))/0xb*(-parseInt(_0xe48ca8(0x1b6))/0xc)+parseInt(_0xe48ca8(0x1a4))/0xd*(parseInt(_0xe48ca8(0x18e))/0xe);if(_0x19d924===_0x4d5b2f)break;else _0x1eb8c4['push'](_0x1eb8c4['shift']());}catch(_0x5e52e4){_0x1eb8c4['push'](_0x1eb8c4['shift']());}}}(a242_0x5ba8,0x22af9));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a242_0x4e2f(_0x13f456,_0x20899f){_0x13f456=_0x13f456-0x179;const _0x5ba83c=a242_0x5ba8();let _0x4e2f62=_0x5ba83c[_0x13f456];return _0x4e2f62;}async function fetchAllSqlQueries(_0x430491,_0x15fab4){const _0x5b30fa=a242_0x4e2f,_0x53f3ab=[];let _0x278621=0x1;while(!![]){const _0x102f9b=await listSqlQueries(_0x430491,{'currentPage':_0x278621,'pageSize':PAGE_SIZE,'sqlCode':_0x15fab4[_0x5b30fa(0x190)],'sqlName':_0x15fab4[_0x5b30fa(0x17c)]}),_0x580a12=_0x102f9b[_0x5b30fa(0x186)]??[];_0x53f3ab[_0x5b30fa(0x1b1)](..._0x580a12);if(_0x580a12[_0x5b30fa(0x17a)]===0x0)break;const _0x2ba950=_0x102f9b['paging']?.[_0x5b30fa(0x1af)];if(_0x2ba950!=null?_0x53f3ab['length']>=_0x2ba950:_0x580a12[_0x5b30fa(0x17a)]<PAGE_SIZE)break;_0x278621++;}return _0x53f3ab;}async function ensureSqlContent(_0x1a3476){const _0x240d7d=a242_0x4e2f;if(_0x1a3476['sqlContent']!=null&&String(_0x1a3476[_0x240d7d(0x1a7)])['length']>0x0)return _0x1a3476;return getSqlQueryDetail(_0x1a3476[_0x240d7d(0x190)]);}export const sqlPull={'service':a242_0x1a79b6(0x1a0),'command':a242_0x1a79b6(0x193),'description':a242_0x1a79b6(0x1bb),'risk':a242_0x1a79b6(0x1b8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a242_0x1a79b6(0x1c6),'type':a242_0x1a79b6(0x194),'description':a242_0x1a79b6(0x1c7)},{'name':a242_0x1a79b6(0x1be),'type':a242_0x1a79b6(0x185),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x3ca7a3){const _0x350986=a242_0x1a79b6,_0x2b89fe=loadSqlProjectConfig(_0x3ca7a3[_0x350986(0x19a)]),_0x2fe5b1=await readSqlLockFile(_0x2b89fe['lockFilePath']),{appLock:_0x424bc7}=ensureSqlLockScope(_0x2fe5b1??createEmptySqlLock(),_0x2b89fe['appCode'],_0x2b89fe[_0x350986(0x18d)],_0x350986(0x193)),_0x3d9534=await fetchAllSqlQueries(_0x3ca7a3['appCode'],{'sqlCode':_0x3ca7a3[_0x350986(0x1b9)](_0x350986(0x1aa))||undefined,'sqlName':_0x3ca7a3['str']('name')||undefined}),_0x32310d=[];for(const _0xff2a18 of _0x3d9534){const _0x3d8b85=await ensureSqlContent(_0xff2a18),_0x2725b2=ensureRemoteSqlContent(_0x3d8b85),_0x224d53=detectSqlMode(_0x2725b2),_0x21c1a2=_0x3d8b85[_0x350986(0x17b)]?await getDbName(_0x3ca7a3[_0x350986(0x19a)],Number(_0x3d8b85[_0x350986(0x17b)]))[_0x350986(0x1ba)](()=>undefined):undefined,_0x10aabf=buildLocalSqlFileContent({'sqlCode':_0x3d8b85[_0x350986(0x190)],'sqlName':_0x3d8b85[_0x350986(0x17c)],'dbId':_0x3d8b85['dbId']},_0x2725b2,{'dbName':_0x21c1a2,'mode':_0x224d53,'syncedAt':new Date()['toISOString'](),'description':_0x3d8b85[_0x350986(0x1c4)]}),_0x316ff5=buildSqlLockEntry(_0x3d8b85,_0x2725b2,'',{'dbName':_0x21c1a2}),_0x177c3f=resolveLocalSqlFilePath(_0x2b89fe,_0x3d8b85[_0x350986(0x190)],_0x316ff5);let _0x16d0d4='would_pull',_0xdd6414;const _0x41cbdc=await findExistingSqlFiles(_0x2b89fe,_0x177c3f,_0x224d53,_0x424bc7[_0x350986(0x1bc)][_0x3d8b85['sqlCode']]);if(_0x41cbdc[_0x350986(0x17a)]>0x0){const _0xb89f3b=await compareExistingSqlFiles(_0x41cbdc,_0x10aabf,_0x224d53);if(_0xb89f3b[_0x350986(0x17f)](({equivalent:_0x4432aa})=>!_0x4432aa))_0x16d0d4='conflict',_0xdd6414=_0x350986(0x191);else _0xb89f3b[_0x350986(0x17a)]===0x1&&_0xb89f3b[0x0]?.[_0x350986(0x18c)][_0x350986(0x180)]&&(_0x16d0d4=_0x350986(0x19c),_0xdd6414='unchanged');}_0x32310d[_0x350986(0x1b1)]({'sqlCode':_0x3d8b85[_0x350986(0x190)],'sqlName':_0x3d8b85['sqlName'],'filePath':_0x177c3f,'status':_0x16d0d4,'reason':_0xdd6414});}return{'method':_0x350986(0x1a8),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x3ca7a3[_0x350986(0x19a)],'sqlCode':_0x3ca7a3[_0x350986(0x1b9)]('sqlcode')||null,'sqlName':_0x3ca7a3[_0x350986(0x1b9)]('name')||null,'files':_0x32310d},'description':_0x350986(0x198)+_0x32310d['length']+_0x350986(0x1ae)+_0x2b89fe[_0x350986(0x181)]};},async 'execute'(_0xc8a5b0){const _0x4049c2=a242_0x1a79b6,_0x21716a=loadSqlProjectConfig(_0xc8a5b0['appCode']),_0x5e5fd9=await readSqlLockFile(_0x21716a[_0x4049c2(0x1b0)]),{lockData:_0x2da450,appLock:_0x3972fc}=ensureSqlLockScope(_0x5e5fd9??createEmptySqlLock(),_0x21716a[_0x4049c2(0x19a)],_0x21716a[_0x4049c2(0x18d)],'pull'),_0x138fac=_0xc8a5b0['bool'](_0x4049c2(0x1be)),_0x535535=await fetchAllSqlQueries(_0xc8a5b0[_0x4049c2(0x19a)],{'sqlCode':_0xc8a5b0[_0x4049c2(0x1b9)](_0x4049c2(0x1aa))||undefined,'sqlName':_0xc8a5b0[_0x4049c2(0x1b9)](_0x4049c2(0x1c6))||undefined});if(_0x535535[_0x4049c2(0x17a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4049c2(0x1ad)};const _0x58d809=[],_0x31b666=[];for(const _0x1aaf21 of _0x535535){try{_0x58d809['push'](await ensureSqlContent(_0x1aaf21));}catch(_0x6778ec){_0x31b666['push']({'sqlCode':_0x1aaf21['sqlCode'],'error':_0x6778ec instanceof Error?_0x6778ec[_0x4049c2(0x179)]:String(_0x6778ec)});}}if(_0x138fac&&!_0xc8a5b0[_0x4049c2(0x1a3)]){let _0x244d66=![];for(const _0x172b79 of _0x58d809){const _0x3a348c=detectSqlMode(ensureRemoteSqlContent(_0x172b79)),_0x375394=_0x172b79[_0x4049c2(0x17b)]?await getDbName(_0xc8a5b0[_0x4049c2(0x19a)],Number(_0x172b79['dbId']))[_0x4049c2(0x1ba)](()=>undefined):undefined,_0x2e7141=buildLocalSqlFileContent({'sqlCode':_0x172b79[_0x4049c2(0x190)],'sqlName':_0x172b79[_0x4049c2(0x17c)],'dbId':_0x172b79[_0x4049c2(0x17b)]},ensureRemoteSqlContent(_0x172b79),{'dbName':_0x375394,'mode':_0x3a348c,'syncedAt':new Date()[_0x4049c2(0x199)](),'description':_0x172b79['description']}),_0x4ee573=resolveLocalSqlFilePath(_0x21716a,_0x172b79[_0x4049c2(0x190)],buildSqlLockEntry(_0x172b79,ensureRemoteSqlContent(_0x172b79),'',{'dbName':_0x375394})),_0x1dae7d=await findExistingSqlFiles(_0x21716a,_0x4ee573,_0x3a348c,_0x3972fc[_0x4049c2(0x1bc)][_0x172b79[_0x4049c2(0x190)]]),_0x319e99=await compareExistingSqlFiles(_0x1dae7d,_0x2e7141,_0x3a348c);if(_0x319e99[_0x4049c2(0x17f)](({equivalent:_0x449a86})=>!_0x449a86)){_0x244d66=!![];break;}}if(_0x244d66){const _0x2610a4=await confirmForceOverwrite(_0x4049c2(0x182));if(!_0x2610a4)throw CliErrors[_0x4049c2(0x192)](_0x4049c2(0x19e));}}const _0x1faed8=cloneSqlLockData(_0x2da450),_0x1b7462=_0x1faed8['apps'][_0x21716a[_0x4049c2(0x19a)]],_0x26bb1d=[],_0x2f6ed2=[];for(const _0x5421fe of _0x58d809){const _0x3bc206=_0x1b7462[_0x4049c2(0x1bc)][_0x5421fe[_0x4049c2(0x190)]],_0x3e08f5=ensureRemoteSqlContent(_0x5421fe),_0x54bf70=detectSqlMode(_0x3e08f5),_0x31cc1b=_0x5421fe[_0x4049c2(0x17b)]?await getDbName(_0xc8a5b0['appCode'],Number(_0x5421fe[_0x4049c2(0x17b)]))['catch'](()=>undefined):undefined,_0x350747=buildLocalSqlFileContent({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'sqlName':_0x5421fe[_0x4049c2(0x17c)],'dbId':_0x5421fe[_0x4049c2(0x17b)]},_0x3e08f5,{'dbName':_0x31cc1b,'mode':_0x54bf70,'syncedAt':new Date()['toISOString'](),'description':_0x5421fe[_0x4049c2(0x1c4)]}),_0x231af4=buildSqlLockEntry(_0x5421fe,_0x3e08f5,computeSqlContentHash(_0x350747),{'dbName':_0x31cc1b}),_0x572339=_0x231af4[_0x4049c2(0x1c3)],_0x476da7=join(_0x21716a[_0x4049c2(0x181)],_0x572339);try{const _0x535c49=await findExistingSqlFiles(_0x21716a,_0x476da7,_0x54bf70,_0x3bc206),_0x560786=await compareExistingSqlFiles(_0x535c49,_0x350747,_0x54bf70);if(!_0x138fac&&_0x560786[_0x4049c2(0x17f)](({equivalent:_0x2e18cb})=>!_0x2e18cb)){_0x2f6ed2[_0x4049c2(0x1b1)]({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'reason':_0x4049c2(0x1a2)});continue;}const _0x5e6229=_0x560786['find'](({file:_0x4a9f38})=>_0x4a9f38[_0x4049c2(0x180)]),_0x514b55=_0x560786['find'](({file:_0x197b7f})=>!_0x197b7f['isCanonical']);if(_0x5e6229?.[_0x4049c2(0x1a6)]&&!_0x514b55){_0x2f6ed2['push']({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'reason':'unchanged'}),_0x1b7462[_0x4049c2(0x1bc)][_0x5421fe['sqlCode']]={..._0x231af4,'hash':computeSqlContentHash(_0x5e6229[_0x4049c2(0x1bf)]),'path':_0x572339};continue;}!_0x5e6229?.[_0x4049c2(0x1a6)]&&(await ensureParentDirectory(_0x476da7),await writeFile(_0x476da7,_0x350747,'utf8')),_0x514b55&&await rm(_0x514b55[_0x4049c2(0x18c)][_0x4049c2(0x1a5)],{'force':!![]}),_0x1b7462[_0x4049c2(0x1bc)][_0x5421fe[_0x4049c2(0x190)]]={..._0x231af4,'hash':_0x5e6229?.[_0x4049c2(0x1a6)]?computeSqlContentHash(_0x5e6229[_0x4049c2(0x1bf)]):_0x231af4[_0x4049c2(0x183)],'path':_0x572339},_0x26bb1d[_0x4049c2(0x1b1)]({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'filePath':_0x476da7});}catch(_0x1922c2){_0x31b666[_0x4049c2(0x1b1)]({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'error':_0x1922c2 instanceof Error?_0x1922c2[_0x4049c2(0x179)]:String(_0x1922c2)});}}return _0x1b7462[_0x4049c2(0x189)]=new Date()[_0x4049c2(0x199)](),await writeSqlLockFile(_0x21716a['lockFilePath'],_0x1faed8),{'ok':_0x31b666[_0x4049c2(0x17a)]===0x0,'data':{'pulled':_0x26bb1d,'skipped':_0x2f6ed2,'failed':_0x31b666},'message':_0x4049c2(0x1b5)+_0x26bb1d[_0x4049c2(0x17a)]+_0x4049c2(0x17e)+_0x2f6ed2[_0x4049c2(0x17a)]+_0x4049c2(0x1c0)+_0x31b666[_0x4049c2(0x17a)]+_0x4049c2(0x17d)};}};function isEquivalentPulledSqlFile(_0x4edb39,_0x27cd99,_0x1abf3b,_0x15a4e4){if(_0x1abf3b!==_0x15a4e4)return normalizePulledSqlBody(_0x4edb39,_0x1abf3b)===normalizePulledSqlBody(_0x27cd99,_0x15a4e4);return normalizePullComparableContent(_0x4edb39,_0x1abf3b)===normalizePullComparableContent(_0x27cd99,_0x15a4e4);}async function findExistingSqlFiles(_0xa3397a,_0x279a4a,_0x525dce,_0x2ee989){const _0x42424c=a242_0x1a79b6,_0x276df9=[];await fileExists(_0x279a4a)&&_0x276df9['push']({'filePath':_0x279a4a,'mode':_0x525dce,'isCanonical':!![]});if(!_0x2ee989?.[_0x42424c(0x1c3)])return _0x276df9;const _0x305131=join(_0xa3397a[_0x42424c(0x181)],_0x2ee989[_0x42424c(0x1c3)]);if(_0x305131===_0x279a4a)return _0x276df9;return await fileExists(_0x305131)&&_0x276df9[_0x42424c(0x1b1)]({'filePath':_0x305131,'mode':_0x2ee989[_0x42424c(0x1b2)]??modeFromFilePath(_0x305131),'isCanonical':![]}),_0x276df9;}async function compareExistingSqlFiles(_0x464681,_0x319bc8,_0x2b5d89){const _0x2f1311=a242_0x1a79b6;return Promise[_0x2f1311(0x18f)](_0x464681[_0x2f1311(0x1b7)](async _0x4325e7=>{const _0x4ed08c=_0x2f1311,_0x4db559=await readFile(_0x4325e7[_0x4ed08c(0x1a5)],_0x4ed08c(0x19d));return{'file':_0x4325e7,'content':_0x4db559,'equivalent':isEquivalentPulledSqlFile(_0x4db559,_0x319bc8,_0x4325e7[_0x4ed08c(0x1b2)],_0x2b5d89)};}));}function modeFromFilePath(_0x186058){const _0x1a5d45=a242_0x1a79b6;return _0x186058[_0x1a5d45(0x1b4)]()['endsWith'](_0x1a5d45(0x1ac))?_0x1a5d45(0x187):_0x1a5d45(0x1a0);}function normalizePulledSqlBody(_0x5a02a5,_0x1509c4){const _0x3a363c=a242_0x1a79b6;return stripLocalSqlMetadata(_0x5a02a5,_0x1509c4)[_0x3a363c(0x1c5)](/\r\n/g,'\x0a')[_0x3a363c(0x1ab)]();}function normalizePullComparableContent(_0x5ac4fb,_0x4e1161){const _0x175c40=a242_0x1a79b6,_0x400f24=_0x5ac4fb[_0x175c40(0x1c5)](/\r\n/g,'\x0a')[_0x175c40(0x188)]('\x0a'),_0x4f8ed6=_0x400f24[_0x175c40(0x184)](_0x599afc=>!isSyncedAtMetadataLine(_0x599afc,_0x4e1161));return _0x4f8ed6[_0x175c40(0x19b)]('\x0a');}function isSyncedAtMetadataLine(_0x1c9871,_0xd3fac5){const _0x227b95=a242_0x1a79b6;if(_0xd3fac5===_0x227b95(0x187))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x1c9871);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x227b95(0x1b3)](_0x1c9871);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a243_0x311b48=a243_0x2af1;(function(_0x23f559,_0x237461){const _0xd35534=a243_0x2af1,_0x2cc36a=_0x23f559();while(!![]){try{const _0x4b5c38=-parseInt(_0xd35534(0x114))/0x1*(parseInt(_0xd35534(0x13c))/0x2)+-parseInt(_0xd35534(0x10b))/0x3+-parseInt(_0xd35534(0x117))/0x4+parseInt(_0xd35534(0x112))/0x5+-parseInt(_0xd35534(0x12a))/0x6*(parseInt(_0xd35534(0x131))/0x7)+parseInt(_0xd35534(0x105))/0x8*(-parseInt(_0xd35534(0x115))/0x9)+parseInt(_0xd35534(0x11d))/0xa*(parseInt(_0xd35534(0x110))/0xb);if(_0x4b5c38===_0x237461)break;else _0x2cc36a['push'](_0x2cc36a['shift']());}catch(_0x1d3932){_0x2cc36a['push'](_0x2cc36a['shift']());}}}(a243_0x2a8d,0x37bf1));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a243_0x2af1(_0x2d565e,_0x3b9111){_0x2d565e=_0x2d565e-0xf7;const _0x2a8d94=a243_0x2a8d();let _0x2af1e7=_0x2a8d94[_0x2d565e];return _0x2af1e7;}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 readSqlUploadContent(_0x3c061e){const _0x24a8cf=a243_0x2af1,_0x239d3b=stripLocalSqlMetadata(await readFile(_0x3c061e[_0x24a8cf(0x120)],_0x24a8cf(0x136)),_0x3c061e[_0x24a8cf(0xf7)]);if(!_0x239d3b[_0x24a8cf(0xf8)]())throw CliErrors[_0x24a8cf(0x102)](_0x3c061e[_0x24a8cf(0x125)]+_0x24a8cf(0x124));return _0x239d3b;}async function getTargetSqlQueries(_0x436264,_0x48259c,_0x2e7b1d){const _0x7d43a6=a243_0x2af1,_0x2830b9=await scanLocalSqlQueries(_0x436264),_0x5a59f0=new Map();for(const _0x23fc3a of _0x2830b9){if(_0x2e7b1d&&_0x23fc3a['sqlCode']!==_0x2e7b1d)continue;const _0x4d8eca=_0x5a59f0[_0x7d43a6(0x11b)](_0x23fc3a[_0x7d43a6(0x125)])??[];_0x4d8eca[_0x7d43a6(0x135)](_0x23fc3a),_0x5a59f0['set'](_0x23fc3a[_0x7d43a6(0x125)],_0x4d8eca);}if(_0x2e7b1d&&!_0x5a59f0[_0x7d43a6(0x132)](_0x2e7b1d))throw CliErrors['validation']('Local\x20SQL\x20not\x20found:\x20'+_0x2e7b1d);const _0x267e86=[];for(const [_0x4bf649,_0x160763]of _0x5a59f0[_0x7d43a6(0x11a)]()){if(_0x160763['length']===0x1){_0x267e86['push'](_0x160763[0x0]);continue;}const _0xf4e21e=_0x48259c['sqls'][_0x4bf649],_0x3ea8e4=_0xf4e21e?.[_0x7d43a6(0x10e)],_0x4cc8d9=_0x3ea8e4?_0x160763[_0x7d43a6(0x130)](_0x87a822=>_0x87a822['relativePath']!==_0x3ea8e4):_0x160763;if(_0xf4e21e&&_0x4cc8d9[_0x7d43a6(0xff)]===0x1){_0x267e86[_0x7d43a6(0x135)](_0x4cc8d9[0x0]);continue;}throw CliErrors[_0x7d43a6(0x102)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x4bf649+_0x7d43a6(0x119));}return _0x267e86;}export const sqlPush={'service':a243_0x311b48(0x104),'command':a243_0x311b48(0x135),'description':a243_0x311b48(0x113),'risk':a243_0x311b48(0x116),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a243_0x311b48(0x10c),'type':'boolean','description':a243_0x311b48(0x128)}],async 'dryRun'(_0x1d0078){const _0x2eab96=a243_0x311b48,_0x40fa38=loadSqlProjectConfig(_0x1d0078[_0x2eab96(0x122)]),_0x45ea8e=await readSqlLockFile(_0x40fa38['lockFilePath']),{appLock:_0x4b56f0}=ensureSqlLockScope(_0x45ea8e??createEmptySqlLock(),_0x1d0078[_0x2eab96(0x122)],_0x40fa38[_0x2eab96(0x133)],_0x2eab96(0x135)),_0x13ed44=await getTargetSqlQueries(_0x40fa38,_0x4b56f0,_0x1d0078['str'](_0x2eab96(0x11c))||undefined),_0x9b77ef=[];for(const _0x280b10 of _0x13ed44){const _0x2d07e8=await computeSqlFileHash(_0x280b10[_0x2eab96(0x120)]),_0x153185=_0x4b56f0[_0x2eab96(0x108)][_0x280b10[_0x2eab96(0x125)]],_0x5963d3=!!_0x153185&&(_0x153185[_0x2eab96(0x10e)]!==_0x280b10['relativePath']||!!_0x280b10[_0x2eab96(0x13b)]&&_0x153185[_0x2eab96(0x13b)]!==_0x280b10[_0x2eab96(0x13b)]||_0x153185[_0x2eab96(0xf7)]!==_0x280b10[_0x2eab96(0xf7)]);if(!_0x1d0078[_0x2eab96(0x12d)](_0x2eab96(0x10c))&&_0x153185&&_0x153185['hash']===_0x2d07e8&&!_0x5963d3)continue;if(!_0x153185)throw CliErrors[_0x2eab96(0x102)](_0x280b10[_0x2eab96(0x125)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x153185[_0x2eab96(0x138)]==null)throw CliErrors['validation'](_0x280b10[_0x2eab96(0x125)]+_0x2eab96(0xfa));await resolveTargetDbBinding(_0x1d0078[_0x2eab96(0x122)],_0x280b10,_0x153185),await readSqlUploadContent(_0x280b10),_0x9b77ef[_0x2eab96(0x135)](_0x280b10['sqlCode']);}return{'method':'POST','url':_0x2eab96(0xfe),'body':{'sqlCodes':_0x9b77ef,'appCode':_0x1d0078[_0x2eab96(0x122)]},'description':_0x2eab96(0x12e)+_0x9b77ef[_0x2eab96(0xff)]+_0x2eab96(0x121)};},async 'execute'(_0x4b13d5){const _0x1c4400=a243_0x311b48,_0x15962d=loadSqlProjectConfig(_0x4b13d5[_0x1c4400(0x122)]),_0x581656=await readSqlLockFile(_0x15962d['lockFilePath']),{lockData:_0x2f1bd5,appLock:_0x189e68}=ensureSqlLockScope(_0x581656??createEmptySqlLock(),_0x4b13d5[_0x1c4400(0x122)],_0x15962d[_0x1c4400(0x133)],_0x1c4400(0x135)),_0x331894=await getTargetSqlQueries(_0x15962d,_0x189e68,_0x4b13d5[_0x1c4400(0xf9)](_0x1c4400(0x11c))||undefined);if(_0x331894[_0x1c4400(0xff)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x1c4400(0x103)};const _0xb2b072=[],_0x3dc61f=[],_0x7eb91f=[];let _0x31cabc=![];for(const _0x3b42de of _0x331894){const _0x44c001=_0x189e68['sqls'][_0x3b42de[_0x1c4400(0x125)]];if(!_0x44c001){_0x7eb91f[_0x1c4400(0x135)]({'sqlCode':_0x3b42de[_0x1c4400(0x125)],'error':_0x1c4400(0x11f)});continue;}try{const _0x18ad29=await computeSqlFileHash(_0x3b42de[_0x1c4400(0x120)]),_0x2cb3a0=_0x44c001[_0x1c4400(0x10e)]!==_0x3b42de[_0x1c4400(0x10d)]||!!_0x3b42de[_0x1c4400(0x13b)]&&_0x44c001[_0x1c4400(0x13b)]!==_0x3b42de[_0x1c4400(0x13b)]||_0x44c001[_0x1c4400(0xf7)]!==_0x3b42de[_0x1c4400(0xf7)];if(!_0x4b13d5[_0x1c4400(0x12d)]('force')&&_0x44c001['hash']===_0x18ad29&&!_0x2cb3a0){_0x3dc61f['push']({'sqlCode':_0x3b42de[_0x1c4400(0x125)],'reason':'unchanged'});continue;}if(_0x44c001[_0x1c4400(0x138)]==null){_0x7eb91f[_0x1c4400(0x135)]({'sqlCode':_0x3b42de[_0x1c4400(0x125)],'error':_0x1c4400(0x12c)});continue;}const _0x3a6298=_0x3b42de[_0x1c4400(0x13b)]||_0x44c001[_0x1c4400(0x13b)],_0x243c5b=await resolveTargetDbBinding(_0x4b13d5[_0x1c4400(0x122)],_0x3b42de,_0x44c001),_0x5bc3c6=await readSqlUploadContent(_0x3b42de),_0x427acb=await updateSqlQuery({'id':_0x44c001['remoteId'],'appCode':_0x4b13d5[_0x1c4400(0x122)],'sqlCode':_0x3b42de[_0x1c4400(0x125)],'sqlName':_0x3a6298,'dbId':_0x243c5b[_0x1c4400(0x126)],'version':_0x44c001[_0x1c4400(0x138)],'sqlContent':_0x5bc3c6,'sqlConfig':_0x44c001[_0x1c4400(0x123)]??undefined}),_0x42835d=_0x427acb['dbId']?await getDbName(_0x4b13d5['appCode'],Number(_0x427acb[_0x1c4400(0x126)]))[_0x1c4400(0x137)](()=>_0x243c5b[_0x1c4400(0x134)]):_0x243c5b[_0x1c4400(0x134)];_0x189e68[_0x1c4400(0x108)][_0x3b42de['sqlCode']]={...buildSqlLockEntry(_0x427acb,_0x5bc3c6,_0x18ad29,{'dbName':_0x42835d}),'path':_0x3b42de[_0x1c4400(0x10d)],'mode':_0x3b42de['mode']},_0x31cabc=!![],await archivePreviousSqlFileIfNeeded(_0x15962d,_0x44c001[_0x1c4400(0x10e)],_0x3b42de['relativePath']),_0xb2b072[_0x1c4400(0x135)]({'sqlCode':_0x3b42de['sqlCode'],'remoteId':_0x44c001[_0x1c4400(0x139)]});}catch(_0x30e371){_0x7eb91f[_0x1c4400(0x135)]({'sqlCode':_0x3b42de[_0x1c4400(0x125)],'error':_0x30e371 instanceof Error?_0x30e371[_0x1c4400(0x109)]:String(_0x30e371)});}}(_0x31cabc||_0x7eb91f[_0x1c4400(0xff)]===0x0)&&(_0x189e68[_0x1c4400(0x12f)]=new Date()[_0x1c4400(0x101)](),await writeSqlLockFile(_0x15962d[_0x1c4400(0x107)],_0x2f1bd5));const _0x127d6c=_0x7eb91f[_0x1c4400(0xff)]===0x0;return{'ok':_0x127d6c,'data':{'pushed':_0xb2b072,'skipped':_0x3dc61f,'failed':_0x7eb91f},'message':_0x1c4400(0x100)+_0xb2b072['length']+'\x20pushed,\x20'+_0x3dc61f[_0x1c4400(0xff)]+_0x1c4400(0xfc)+_0x7eb91f[_0x1c4400(0xff)]+_0x1c4400(0x12b)};}};async function archivePreviousSqlFileIfNeeded(_0x19bba3,_0x5776ab,_0x1ed72b){const _0x3af9da=a243_0x311b48;if(!_0x5776ab||_0x5776ab===_0x1ed72b)return;const _0x8ed448=join(_0x19bba3[_0x3af9da(0x127)],_0x5776ab);if(!await fileExists(_0x8ed448))return;const _0x4a587d=await moveToTrash(_0x19bba3[_0x3af9da(0x106)],_0x19bba3[_0x3af9da(0x11e)],_0x8ed448);await cleanupEmptyDirectories(dirname(_0x8ed448),_0x19bba3[_0x3af9da(0x127)]),void _0x4a587d;}async function moveToTrash(_0x3f137a,_0x42a7a5,_0x225d59){const _0x32935e=a243_0x311b48,_0x5a0955=new Date()[_0x32935e(0x101)]()['replace'](/[:.]/g,'-'),_0x64d938=relative(_0x3f137a,_0x225d59),_0x58246f=join(_0x42a7a5,_0x5a0955,_0x64d938);return await mkdir(dirname(_0x58246f),{'recursive':!![]}),await rename(_0x225d59,_0x58246f),_0x58246f;}async function cleanupEmptyDirectories(_0x3ae52c,_0xc91d95){const _0x3d6eca=a243_0x311b48;let _0x332aed=resolve(_0x3ae52c);const _0x57025b=resolve(_0xc91d95);while(_0x332aed[_0x3d6eca(0x13a)](''+_0x57025b+sep)||_0x332aed===_0x57025b){if(_0x332aed===_0x57025b)return;try{const _0x2b3073=await readdir(_0x332aed);if(_0x2b3073[_0x3d6eca(0xff)]>0x0)return;await rmdir(_0x332aed);}catch{return;}_0x332aed=dirname(_0x332aed);}}function a243_0x2a8d(){const _0x8b6296=['\x22\x20for\x20sqlCode\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','entries','get','sqlcode','7430fbKayD','trashDir','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','filePath','\x20SQL\x20file(s)','appCode','sqlConfig',':\x20SQL\x20content\x20is\x20empty.','sqlCode','dbId','sqlRootDir','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','exec','2736WHSnFG','\x20failed','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','bool','Would\x20push\x20','lastSync','filter','6468fNSURG','has','sqlRoot','dbName','push','utf8','catch','version','remoteId','startsWith','sqlName','153346sGLLkC','mode','trim','str',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20skipped,\x20','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','/smartapi/custom/updateUserCustomSql','length','Push\x20complete:\x20','toISOString','validation','No\x20local\x20SQL\x20files\x20found.','sql','1400gTlLZR','projectRoot','lockFilePath','sqls','message','join','1180935QrcmZW','force','relativePath','path','map','22803NXxrNN','dbDirectory','340470XzjESO','Push\x20local\x20SQL\x20files\x20to\x20remote','2xwtHlX','4302rFjSpO','write','1312044JAPmIl'];a243_0x2a8d=function(){return _0x8b6296;};return a243_0x2a8d();}async function resolveTargetDbBinding(_0x15d478,_0x563ad6,_0x3e4d6e){const _0x1d68d8=a243_0x311b48,_0x55b1b2=_0x563ad6[_0x1d68d8(0x111)];if(!_0x55b1b2)return{'dbId':_0x3e4d6e[_0x1d68d8(0x126)],'dbName':_0x3e4d6e[_0x1d68d8(0x134)]};const _0x45ba1b=buildDbDirectoryName(_0x3e4d6e[_0x1d68d8(0x134)],_0x3e4d6e[_0x1d68d8(0x126)]);if(_0x55b1b2===_0x45ba1b)return{'dbId':_0x3e4d6e['dbId'],'dbName':_0x3e4d6e[_0x1d68d8(0x134)]};const _0x203e83=parseExplicitDbDirectory(_0x55b1b2);if(_0x203e83!=null)return{'dbId':_0x203e83,'dbName':await getDbName(_0x15d478,_0x203e83)[_0x1d68d8(0x137)](()=>undefined)};const _0x44a1b0=await listDatabases(_0x15d478),_0xd093ed=_0x44a1b0['filter'](_0x2c3844=>buildDbDirectoryName(_0x2c3844[_0x1d68d8(0x134)],_0x2c3844[_0x1d68d8(0x126)])===_0x55b1b2);if(_0xd093ed[_0x1d68d8(0xff)]===0x1)return{'dbId':_0xd093ed[0x0][_0x1d68d8(0x126)],'dbName':_0xd093ed[0x0]['dbName']};if(_0xd093ed[_0x1d68d8(0xff)]===0x0)throw CliErrors[_0x1d68d8(0x102)](_0x1d68d8(0xfb)+_0x55b1b2+_0x1d68d8(0x118)+_0x563ad6[_0x1d68d8(0x125)]+'.');const _0x569d37=_0xd093ed[_0x1d68d8(0x10f)](_0x5afb39=>_0x5afb39[_0x1d68d8(0x134)]+'\x20('+_0x5afb39[_0x1d68d8(0x126)]+')')[_0x1d68d8(0x10a)](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x55b1b2+_0x1d68d8(0xfd)+_0x563ad6[_0x1d68d8(0x125)]+':\x20'+_0x569d37);}function parseExplicitDbDirectory(_0x7fb409){const _0x51ce66=a243_0x311b48,_0x5e5470=/^db-(\d+)$/[_0x51ce66(0x129)](_0x7fb409);if(!_0x5e5470)return null;const _0x1f36f0=Number(_0x5e5470[0x1]);return Number['isFinite'](_0x1f36f0)&&_0x1f36f0>0x0?_0x1f36f0:null;}
|
|
1
|
+
const a243_0x4ed571=a243_0x1ecd;(function(_0x56caea,_0x365f46){const _0x2549fc=a243_0x1ecd,_0x1c9229=_0x56caea();while(!![]){try{const _0x2a7f5f=-parseInt(_0x2549fc(0x1dd))/0x1*(-parseInt(_0x2549fc(0x1b1))/0x2)+parseInt(_0x2549fc(0x1de))/0x3+-parseInt(_0x2549fc(0x1bf))/0x4*(parseInt(_0x2549fc(0x1b6))/0x5)+-parseInt(_0x2549fc(0x1eb))/0x6+parseInt(_0x2549fc(0x1d2))/0x7*(parseInt(_0x2549fc(0x1c3))/0x8)+parseInt(_0x2549fc(0x1ca))/0x9+-parseInt(_0x2549fc(0x1f5))/0xa*(parseInt(_0x2549fc(0x1c6))/0xb);if(_0x2a7f5f===_0x365f46)break;else _0x1c9229['push'](_0x1c9229['shift']());}catch(_0x24029e){_0x1c9229['push'](_0x1c9229['shift']());}}}(a243_0x2e8b,0x7de3a));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 a243_0x1ecd(_0x5cd800,_0x214e3f){_0x5cd800=_0x5cd800-0x1ae;const _0x2e8bc2=a243_0x2e8b();let _0x1ecd98=_0x2e8bc2[_0x5cd800];return _0x1ecd98;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x6ac5bc){const _0x1e34f6=a243_0x1ecd,_0x4bbf71=stripLocalSqlMetadata(await readFile(_0x6ac5bc[_0x1e34f6(0x1b5)],_0x1e34f6(0x1d5)),_0x6ac5bc['mode']);if(!_0x4bbf71[_0x1e34f6(0x1b9)]())throw CliErrors[_0x1e34f6(0x1ef)](_0x6ac5bc[_0x1e34f6(0x1d8)]+_0x1e34f6(0x1c7));return _0x4bbf71;}async function getTargetSqlQueries(_0x2ad85d,_0x578bc2,_0x2db995){const _0x3c1e10=a243_0x1ecd,_0x2c35b3=await scanLocalSqlQueries(_0x2ad85d),_0x31833c=new Map();for(const _0x58c353 of _0x2c35b3){if(_0x2db995&&_0x58c353['sqlCode']!==_0x2db995)continue;const _0x289d21=_0x31833c[_0x3c1e10(0x1d7)](_0x58c353[_0x3c1e10(0x1d8)])??[];_0x289d21[_0x3c1e10(0x1df)](_0x58c353),_0x31833c['set'](_0x58c353[_0x3c1e10(0x1d8)],_0x289d21);}if(_0x2db995&&!_0x31833c[_0x3c1e10(0x1f3)](_0x2db995))throw CliErrors['validation'](_0x3c1e10(0x1bd)+_0x2db995);const _0x27efd1=[];for(const [_0x14fa8e,_0x2fb0ce]of _0x31833c[_0x3c1e10(0x1f4)]()){if(_0x2fb0ce[_0x3c1e10(0x1e9)]===0x1){_0x27efd1[_0x3c1e10(0x1df)](_0x2fb0ce[0x0]);continue;}const _0x20b346=_0x578bc2[_0x3c1e10(0x1d6)][_0x14fa8e],_0x19f0e3=_0x20b346?.[_0x3c1e10(0x1d4)],_0x1a3a65=_0x19f0e3?_0x2fb0ce[_0x3c1e10(0x1e3)](_0x53b7de=>_0x53b7de[_0x3c1e10(0x1c2)]!==_0x19f0e3):_0x2fb0ce;if(_0x20b346&&_0x1a3a65['length']===0x1){_0x27efd1[_0x3c1e10(0x1df)](_0x1a3a65[0x0]);continue;}throw CliErrors['validation'](_0x3c1e10(0x1cd)+_0x14fa8e+_0x3c1e10(0x1c4));}return _0x27efd1;}export const sqlPush={'service':a243_0x4ed571(0x1b0),'command':a243_0x4ed571(0x1df),'description':a243_0x4ed571(0x1cf),'risk':a243_0x4ed571(0x1ba),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a243_0x4ed571(0x1e7),'type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x4bae18){const _0x153f23=a243_0x4ed571,_0x2ca4e8=loadSqlProjectConfig(_0x4bae18[_0x153f23(0x1cc)]),_0x184997=await readSqlLockFile(_0x2ca4e8['lockFilePath']),{appLock:_0x40b77c}=ensureSqlLockScope(_0x184997??createEmptySqlLock(),_0x4bae18[_0x153f23(0x1cc)],_0x2ca4e8['sqlRoot'],_0x153f23(0x1df)),_0x174ad1=await getTargetSqlQueries(_0x2ca4e8,_0x40b77c,_0x4bae18[_0x153f23(0x1b4)](_0x153f23(0x1b7))||undefined),_0x228805=[];for(const _0x2d6e05 of _0x174ad1){const _0x5dbae7=await computeSqlFileHash(_0x2d6e05[_0x153f23(0x1b5)]),_0x54e2e1=_0x40b77c[_0x153f23(0x1d6)][_0x2d6e05[_0x153f23(0x1d8)]],_0x27cd3c=!!_0x54e2e1&&(_0x54e2e1[_0x153f23(0x1d4)]!==_0x2d6e05['relativePath']||!!_0x2d6e05[_0x153f23(0x1be)]&&_0x54e2e1[_0x153f23(0x1be)]!==_0x2d6e05['sqlName']||_0x54e2e1[_0x153f23(0x1e8)]!==_0x2d6e05[_0x153f23(0x1e8)]);if(!_0x4bae18[_0x153f23(0x1d1)](_0x153f23(0x1e7))&&_0x54e2e1&&_0x54e2e1[_0x153f23(0x1ce)]===_0x5dbae7&&!_0x27cd3c)continue;if(!_0x54e2e1)throw CliErrors[_0x153f23(0x1ef)](_0x2d6e05[_0x153f23(0x1d8)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x54e2e1[_0x153f23(0x1e2)]==null)throw CliErrors['validation'](_0x2d6e05['sqlCode']+_0x153f23(0x1d0));await resolveTargetDbBinding(_0x4bae18[_0x153f23(0x1cc)],_0x2d6e05,_0x54e2e1),await readSqlUploadContent(_0x2d6e05),_0x228805[_0x153f23(0x1df)](_0x2d6e05[_0x153f23(0x1d8)]);}return{'method':_0x153f23(0x1bc),'url':_0x153f23(0x1e6),'body':{'sqlCodes':_0x228805,'appCode':_0x4bae18[_0x153f23(0x1cc)]},'description':_0x153f23(0x1d9)+_0x228805[_0x153f23(0x1e9)]+_0x153f23(0x1ee)};},async 'execute'(_0xd007e6){const _0x176b2a=a243_0x4ed571,_0xd570b8=loadSqlProjectConfig(_0xd007e6[_0x176b2a(0x1cc)]),_0x33c599=await readSqlLockFile(_0xd570b8[_0x176b2a(0x1e4)]),{lockData:_0x42ce63,appLock:_0x3cdcff}=ensureSqlLockScope(_0x33c599??createEmptySqlLock(),_0xd007e6[_0x176b2a(0x1cc)],_0xd570b8[_0x176b2a(0x1c0)],_0x176b2a(0x1df)),_0x31ea87=await getTargetSqlQueries(_0xd570b8,_0x3cdcff,_0xd007e6[_0x176b2a(0x1b4)](_0x176b2a(0x1b7))||undefined);if(_0x31ea87[_0x176b2a(0x1e9)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x176b2a(0x1f0)};const _0xcf14a4=[],_0x32852b=[],_0x13ea07=[];let _0x45df9f=![];for(const _0x5a307c of _0x31ea87){const _0x51eb94=_0x3cdcff['sqls'][_0x5a307c['sqlCode']];if(!_0x51eb94){_0x13ea07[_0x176b2a(0x1df)]({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'error':_0x176b2a(0x1ed)});continue;}try{const _0x10f435=await computeSqlFileHash(_0x5a307c[_0x176b2a(0x1b5)]),_0x583bcd=_0x51eb94[_0x176b2a(0x1d4)]!==_0x5a307c[_0x176b2a(0x1c2)]||!!_0x5a307c['sqlName']&&_0x51eb94[_0x176b2a(0x1be)]!==_0x5a307c[_0x176b2a(0x1be)]||_0x51eb94[_0x176b2a(0x1e8)]!==_0x5a307c['mode'];if(!_0xd007e6[_0x176b2a(0x1d1)](_0x176b2a(0x1e7))&&_0x51eb94[_0x176b2a(0x1ce)]===_0x10f435&&!_0x583bcd){_0x32852b['push']({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'reason':_0x176b2a(0x1f1)});continue;}if(_0x51eb94[_0x176b2a(0x1e2)]==null){_0x13ea07['push']({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'error':_0x176b2a(0x1b8)});continue;}const _0x369bef=_0x5a307c[_0x176b2a(0x1be)]||_0x51eb94[_0x176b2a(0x1be)],_0x51f257=await resolveTargetDbBinding(_0xd007e6[_0x176b2a(0x1cc)],_0x5a307c,_0x51eb94),_0x142370=await readSqlUploadContent(_0x5a307c),_0x27da56=await updateSqlQuery({'id':_0x51eb94[_0x176b2a(0x1da)],'appCode':_0xd007e6[_0x176b2a(0x1cc)],'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'sqlName':_0x369bef,'dbId':_0x51f257[_0x176b2a(0x1c9)],'version':_0x51eb94[_0x176b2a(0x1e2)],'sqlContent':_0x142370,'sqlConfig':_0x51eb94['sqlConfig']??undefined}),_0x37f7cf=_0x27da56[_0x176b2a(0x1c9)]?await getDbName(_0xd007e6['appCode'],Number(_0x27da56[_0x176b2a(0x1c9)]))[_0x176b2a(0x1cb)](()=>_0x51f257[_0x176b2a(0x1dc)]):_0x51f257[_0x176b2a(0x1dc)];_0x3cdcff[_0x176b2a(0x1d6)][_0x5a307c[_0x176b2a(0x1d8)]]={...buildSqlLockEntry(_0x27da56,_0x142370,_0x10f435,{'dbName':_0x37f7cf}),'path':_0x5a307c[_0x176b2a(0x1c2)],'mode':_0x5a307c[_0x176b2a(0x1e8)]},_0x45df9f=!![],await archivePreviousSqlFileIfNeeded(_0xd570b8,_0x51eb94[_0x176b2a(0x1d4)],_0x5a307c['relativePath']),_0xcf14a4[_0x176b2a(0x1df)]({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'remoteId':_0x51eb94[_0x176b2a(0x1da)]});}catch(_0x4f6203){_0x13ea07[_0x176b2a(0x1df)]({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'error':_0x4f6203 instanceof Error?_0x4f6203[_0x176b2a(0x1c8)]:String(_0x4f6203)});}}(_0x45df9f||_0x13ea07[_0x176b2a(0x1e9)]===0x0)&&(_0x3cdcff[_0x176b2a(0x1ec)]=new Date()[_0x176b2a(0x1e1)](),await writeSqlLockFile(_0xd570b8[_0x176b2a(0x1e4)],_0x42ce63));const _0x2ae82d=_0x13ea07[_0x176b2a(0x1e9)]===0x0;return{'ok':_0x2ae82d,'data':{'pushed':_0xcf14a4,'skipped':_0x32852b,'failed':_0x13ea07},'message':'Push\x20complete:\x20'+_0xcf14a4[_0x176b2a(0x1e9)]+_0x176b2a(0x1ae)+_0x32852b[_0x176b2a(0x1e9)]+_0x176b2a(0x1b2)+_0x13ea07['length']+_0x176b2a(0x1b3)};}};async function archivePreviousSqlFileIfNeeded(_0x1b6624,_0x5b4494,_0x4782b2){const _0x20f406=a243_0x4ed571;if(!_0x5b4494||_0x5b4494===_0x4782b2)return;const _0x37f8a5=join(_0x1b6624[_0x20f406(0x1db)],_0x5b4494);if(!await fileExists(_0x37f8a5))return;const _0x242ee6=await moveToTrash(_0x1b6624[_0x20f406(0x1ea)],_0x1b6624['trashDir'],_0x37f8a5);await cleanupEmptyDirectories(dirname(_0x37f8a5),_0x1b6624[_0x20f406(0x1db)]),void _0x242ee6;}async function moveToTrash(_0x3d2da4,_0x27498f,_0x32e7ca){const _0x2c0051=a243_0x4ed571,_0x332940=new Date()[_0x2c0051(0x1e1)]()[_0x2c0051(0x1f2)](/[:.]/g,'-'),_0x4918f9=relative(_0x3d2da4,_0x32e7ca),_0x332741=join(_0x27498f,_0x332940,_0x4918f9);return await mkdir(dirname(_0x332741),{'recursive':!![]}),await rename(_0x32e7ca,_0x332741),_0x332741;}async function cleanupEmptyDirectories(_0x14c627,_0x1d7dba){const _0x1a9d32=a243_0x4ed571;let _0x10db40=resolve(_0x14c627);const _0x1643df=resolve(_0x1d7dba);while(_0x10db40[_0x1a9d32(0x1bb)](''+_0x1643df+sep)||_0x10db40===_0x1643df){if(_0x10db40===_0x1643df)return;try{const _0x346f03=await readdir(_0x10db40);if(_0x346f03[_0x1a9d32(0x1e9)]>0x0)return;await rmdir(_0x10db40);}catch{return;}_0x10db40=dirname(_0x10db40);}}function a243_0x2e8b(){const _0x29d654=['push','map','toISOString','version','filter','lockFilePath','Local\x20directory\x20\x22','/smartapi/custom/updateUserCustomSql','force','mode','length','projectRoot','4983114lmmHZo','lastSync','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x20SQL\x20file(s)','validation','No\x20local\x20SQL\x20files\x20found.','unchanged','replace','has','entries','22150zsjpTu','\x20pushed,\x20','exec','sql','2YrnncK','\x20skipped,\x20','\x20failed','str','filePath','356795mFYFrb','sqlcode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','trim','write','startsWith','POST','Local\x20SQL\x20not\x20found:\x20','sqlName','52zctxHd','sqlRoot','No\x20database\x20matches\x20local\x20directory\x20\x22','relativePath','184rrXdmh','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','198uZIHwU',':\x20SQL\x20content\x20is\x20empty.','message','dbId','5359599SVBDMD','catch','appCode','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','hash','Push\x20local\x20SQL\x20files\x20to\x20remote',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','bool','29477jXIXYe','join','path','utf8','sqls','get','sqlCode','Would\x20push\x20','remoteId','sqlRootDir','dbName','607741kBaGYD','3040779ynrZaJ'];a243_0x2e8b=function(){return _0x29d654;};return a243_0x2e8b();}async function resolveTargetDbBinding(_0x4636f7,_0x202a91,_0x1bf78e){const _0x22f24d=a243_0x4ed571,_0x47b2c7=_0x202a91['dbDirectory'];if(!_0x47b2c7)return{'dbId':_0x1bf78e[_0x22f24d(0x1c9)],'dbName':_0x1bf78e[_0x22f24d(0x1dc)]};const _0x7a2302=buildDbDirectoryName(_0x1bf78e[_0x22f24d(0x1dc)],_0x1bf78e[_0x22f24d(0x1c9)]);if(_0x47b2c7===_0x7a2302)return{'dbId':_0x1bf78e[_0x22f24d(0x1c9)],'dbName':_0x1bf78e[_0x22f24d(0x1dc)]};const _0x282dcc=parseExplicitDbDirectory(_0x47b2c7);if(_0x282dcc!=null)return{'dbId':_0x282dcc,'dbName':await getDbName(_0x4636f7,_0x282dcc)['catch'](()=>undefined)};const _0x432e0f=await listDatabases(_0x4636f7),_0x5d1910=_0x432e0f[_0x22f24d(0x1e3)](_0x8d4e77=>buildDbDirectoryName(_0x8d4e77[_0x22f24d(0x1dc)],_0x8d4e77[_0x22f24d(0x1c9)])===_0x47b2c7);if(_0x5d1910[_0x22f24d(0x1e9)]===0x1)return{'dbId':_0x5d1910[0x0]['dbId'],'dbName':_0x5d1910[0x0][_0x22f24d(0x1dc)]};if(_0x5d1910[_0x22f24d(0x1e9)]===0x0)throw CliErrors[_0x22f24d(0x1ef)](_0x22f24d(0x1c1)+_0x47b2c7+'\x22\x20for\x20sqlCode\x20'+_0x202a91['sqlCode']+'.');const _0x4449bf=_0x5d1910[_0x22f24d(0x1e0)](_0x380bc4=>_0x380bc4[_0x22f24d(0x1dc)]+'\x20('+_0x380bc4[_0x22f24d(0x1c9)]+')')[_0x22f24d(0x1d3)](',\x20');throw CliErrors['validation'](_0x22f24d(0x1e5)+_0x47b2c7+_0x22f24d(0x1c5)+_0x202a91['sqlCode']+':\x20'+_0x4449bf);}function parseExplicitDbDirectory(_0x4db1f6){const _0x1137d2=a243_0x4ed571,_0x1b1060=/^db-(\d+)$/[_0x1137d2(0x1af)](_0x4db1f6);if(!_0x1b1060)return null;const _0xe90e49=Number(_0x1b1060[0x1]);return Number['isFinite'](_0xe90e49)&&_0xe90e49>0x0?_0xe90e49:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x118c21,_0x41e4a7){const _0x30262f=a244_0x3301,_0x30dcc3=_0x118c21();while(!![]){try{const _0x46fb76=parseInt(_0x30262f(0x7d))/0x1+parseInt(_0x30262f(0x88))/0x2+-parseInt(_0x30262f(0x89))/0x3+-parseInt(_0x30262f(0x73))/0x4*(-parseInt(_0x30262f(0x83))/0x5)+parseInt(_0x30262f(0x6c))/0x6+parseInt(_0x30262f(0x85))/0x7+-parseInt(_0x30262f(0x7a))/0x8;if(_0x46fb76===_0x41e4a7)break;else _0x30dcc3['push'](_0x30dcc3['shift']());}catch(_0xd904ac){_0x30dcc3['push'](_0x30dcc3['shift']());}}}(a244_0x4c38,0xda44d));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x3b809d,_0x1c1a80,_0x5e269e,_0xa5a1d){const _0x469db6=a244_0x3301,_0x5c3de9=detectSqlMode(_0x1c1a80);return{'path':buildSqlRelativePath(_0x3b809d[_0x469db6(0x80)],_0x3b809d[_0x469db6(0x90)],_0xa5a1d?.['dbName'],_0x5c3de9,_0x3b809d[_0x469db6(0x82)]),'hash':_0x5e269e,'remoteId':_0x3b809d['id'],'version':_0x3b809d['version'],'dbId':Number(_0x3b809d['dbId']),'dbName':_0xa5a1d?.[_0x469db6(0x86)],'sqlName':_0x3b809d[_0x469db6(0x90)],'sqlConfig':_0x3b809d['sqlConfig']??undefined,'mode':_0x5c3de9};}export function cloneSqlLockData(_0xb15032){const _0x4d88de=a244_0x3301;return{'apps':Object[_0x4d88de(0x7e)](Object[_0x4d88de(0x8d)](_0xb15032[_0x4d88de(0x6d)])[_0x4d88de(0x8c)](([_0x5693e6,_0x190a6f])=>[_0x5693e6,{'sqlRoot':_0x190a6f[_0x4d88de(0x8a)],'lastSync':_0x190a6f[_0x4d88de(0x8f)],'sqls':{..._0x190a6f['sqls']}}]))};}export function ensureRemoteSqlContent(_0x47b47a){const _0x1f1c49=a244_0x3301;return _0x47b47a[_0x1f1c49(0x77)]??'';}export function buildLocalSqlFileContent(_0x345feb,_0x17f3cd,_0x131120){const _0x15b7fc=a244_0x3301,_0x269f83=_0x131120?.[_0x15b7fc(0x94)]??detectSqlMode(_0x17f3cd),_0x27139e=stripLocalSqlMetadata(_0x17f3cd,_0x269f83)[_0x15b7fc(0x71)](),_0x183980=buildMetadataHeaderLines({'sqlCode':_0x345feb[_0x15b7fc(0x80)],'sqlName':_0x345feb[_0x15b7fc(0x90)],'dbId':_0x345feb[_0x15b7fc(0x82)],'dbName':_0x131120?.[_0x15b7fc(0x86)],'mode':_0x269f83,'syncedAt':_0x131120?.['syncedAt'],'description':_0x131120?.['description']},_0x269f83),_0x46c8f2=_0x269f83===_0x15b7fc(0x84)?splitXmlDeclaration(_0x27139e):{'body':_0x27139e},_0x4071df=[..._0x46c8f2[_0x15b7fc(0x79)]?[_0x46c8f2[_0x15b7fc(0x79)]]:[],..._0x183980,'',_0x46c8f2[_0x15b7fc(0x75)][_0x15b7fc(0x6e)]()],_0x2dc8e6=_0x4071df[_0x15b7fc(0x7f)]('\x0a');return _0x2dc8e6[_0x15b7fc(0x8b)]('\x0a')?_0x2dc8e6:_0x2dc8e6+'\x0a';}function a244_0x3301(_0x4c046c,_0x5d0a8f){_0x4c046c=_0x4c046c-0x6b;const _0x4c38d9=a244_0x4c38();let _0x3301c9=_0x4c38d9[_0x4c046c];return _0x3301c9;}function a244_0x4c38(){const _0x290210=['17379312LInYMv','description','slice','186744NAVBHr','fromEntries','join','sqlCode','filter','dbId','746905YdDIZu','mybatisXml','11130588yZlRkt','dbName','\x20[y/N]\x20','1486720WUJSQA','3578241tsbbYc','sqlRoot','endsWith','map','entries','length','lastSync','sqlName','syncedAt','includes','stderr','mode','toLowerCase','2367438klZXZU','apps','trimStart','--\x20@lovrabet.','question','trim','split','36YWaopT','path','body','replace','sqlContent','yes','declaration'];a244_0x4c38=function(){return _0x290210;};return a244_0x4c38();}export function stripLocalSqlMetadata(_0x5f4260,_0x1bfea3){const _0x35ec13=a244_0x3301;if(_0x1bfea3==='mybatisXml'){const {declaration:_0x47f281,body:_0x3182df}=splitXmlDeclaration(_0x5f4260['replace'](/\r\n/g,'\x0a')),_0x2ef352=stripLeadingMetadataLines(_0x3182df,/^\s*<!--\s*@lovrabet\./);return _0x47f281?''+_0x47f281+(_0x2ef352?'\x0a'+_0x2ef352:''):_0x2ef352;}return stripLeadingMetadataLines(_0x5f4260[_0x35ec13(0x76)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x177c40,_0xdccb92){const _0x26e2c6=a244_0x3301;if(_0xdccb92?.[_0x26e2c6(0x94)])return _0xdccb92[_0x26e2c6(0x94)];return detectSqlMode(_0x177c40);}export function resolveSqlFileName(_0x74b069,_0x231fe7,_0x5f5ddd){const _0x42bf65=a244_0x3301;if(_0x5f5ddd?.[_0x42bf65(0x74)])return _0x5f5ddd[_0x42bf65(0x74)];if(_0x5f5ddd?.[_0x42bf65(0x90)]||_0x5f5ddd?.[_0x42bf65(0x86)])return buildSqlRelativePath(_0x74b069,_0x5f5ddd?.['sqlName'],_0x5f5ddd?.[_0x42bf65(0x86)],resolveSqlMode(_0x231fe7,_0x5f5ddd),_0x5f5ddd?.[_0x42bf65(0x82)]);return buildDefaultSqlFileName(_0x74b069,resolveSqlMode(_0x231fe7,_0x5f5ddd));}export function resolveSqlLocalDir(_0x534114,_0x34d1cf){return join(_0x534114,SQL_LOCAL_REL_DIR,_0x34d1cf);}export async function confirmForceOverwrite(_0x3157f8){const _0x177e94=a244_0x3301,_0x3b798c=createInterface({'input':process['stdin'],'output':process[_0x177e94(0x93)]}),_0x4a0980=await new Promise(_0x4b800d=>{const _0x31eaea=_0x177e94;_0x3b798c[_0x31eaea(0x70)](_0x3157f8+_0x31eaea(0x87),_0x4b800d);});return _0x3b798c['close'](),['y',_0x177e94(0x78)][_0x177e94(0x92)](_0x4a0980['trim']()[_0x177e94(0x6b)]());}export function findSqlLockScope(_0x3f8392,_0x438782){return _0x3f8392['apps'][_0x438782];}function buildMetadataHeaderLines(_0x503361,_0xe0d179){const _0xaf7781=a244_0x3301,_0xd78e64=[['sqlCode',_0x503361[_0xaf7781(0x80)]],[_0xaf7781(0x90),_0x503361[_0xaf7781(0x90)]],[_0xaf7781(0x82),_0x503361[_0xaf7781(0x82)]],[_0xaf7781(0x86),_0x503361[_0xaf7781(0x86)]],['mode',_0x503361[_0xaf7781(0x94)]],[_0xaf7781(0x91),_0x503361[_0xaf7781(0x91)]],['description',_0x503361[_0xaf7781(0x7b)]]];if(_0xe0d179===_0xaf7781(0x84))return _0xd78e64[_0xaf7781(0x81)](([,_0x4d7583])=>_0x4d7583!==undefined&&_0x4d7583!==null&&String(_0x4d7583)[_0xaf7781(0x71)]()!=='')[_0xaf7781(0x8c)](([_0x466b39,_0x1caf69])=>'<!--\x20@lovrabet.'+_0x466b39+':\x20'+String(_0x1caf69)+'\x20-->');return _0xd78e64['filter'](([,_0x3b6c9d])=>_0x3b6c9d!==undefined&&_0x3b6c9d!==null&&String(_0x3b6c9d)['trim']()!=='')[_0xaf7781(0x8c)](([_0x22434b,_0x1dc059])=>_0xaf7781(0x6f)+_0x22434b+':\x20'+String(_0x1dc059));}function splitXmlDeclaration(_0x4577eb){const _0x5ed0b4=a244_0x3301,_0x3aa257=_0x4577eb[_0x5ed0b4(0x6e)](),_0x1f38be=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i['exec'](_0x3aa257);if(!_0x1f38be)return{'body':_0x4577eb};return{'declaration':_0x1f38be[0x0],'body':_0x3aa257['slice'](_0x1f38be[0x0][_0x5ed0b4(0x8e)])};}function stripLeadingMetadataLines(_0x3c9ca0,_0x48d743){const _0x1d48d9=a244_0x3301,_0x286181=_0x3c9ca0[_0x1d48d9(0x72)]('\x0a');let _0x4e32d4=0x0;while(_0x4e32d4<_0x286181[_0x1d48d9(0x8e)]){const _0x19c8ae=_0x286181[_0x4e32d4]??'';if(_0x48d743['test'](_0x19c8ae)||_0x19c8ae[_0x1d48d9(0x71)]()===''){_0x4e32d4++;continue;}break;}return _0x286181[_0x1d48d9(0x7c)](_0x4e32d4)['join']('\x0a')[_0x1d48d9(0x6e)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x3baffb=a245_0x21a2;(function(_0x293fcd,_0x1a9d5f){const _0x3d141b=a245_0x21a2,_0x5bbe02=_0x293fcd();while(!![]){try{const _0x400e04=-parseInt(_0x3d141b(0xa6))/0x1+-parseInt(_0x3d141b(0xc0))/0x2+parseInt(_0x3d141b(0xba))/0x3+-parseInt(_0x3d141b(0xbe))/0x4+parseInt(_0x3d141b(0xa8))/0x5+parseInt(_0x3d141b(0xb1))/0x6*(-parseInt(_0x3d141b(0xb6))/0x7)+-parseInt(_0x3d141b(0xc3))/0x8*(-parseInt(_0x3d141b(0xa9))/0x9);if(_0x400e04===_0x1a9d5f)break;else _0x5bbe02['push'](_0x5bbe02['shift']());}catch(_0x59d5b0){_0x5bbe02['push'](_0x5bbe02['shift']());}}}(a245_0x3659,0xca198));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';function a245_0x21a2(_0x456cf8,_0x4170da){_0x456cf8=_0x456cf8-0xa6;const _0x365978=a245_0x3659();let _0x21a237=_0x365978[_0x456cf8];return _0x21a237;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a245_0x3659(){const _0x3c661e=['sql','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','status','9726262nnDdkp','\x20missing,\x20','paging','\x20remote-only','4250451WrEGYK','path','sqlName','\x20added,\x20','285112xtwhvK','appCode','3288216GZSSEw','\x20modified,\x20','lockFilePath','10224056yLNXQI','has','hash','1552066CJUXZQ','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','7559435GQIxGM','18fepHOl','keys','totalCount','read','sqls','push','boolean','lockKey','6csgpuw','length'];a245_0x3659=function(){return _0x3c661e;};return a245_0x3659();}async function fetchAllSqlCodes(_0x580273){const _0x2c8776=a245_0x21a2,_0x1232a6=[];let _0xbe5656=0x1;while(!![]){const _0xee1b08=await listSqlQueries(_0x580273,{'currentPage':_0xbe5656,'pageSize':PAGE_SIZE}),_0x319521=_0xee1b08['tableData']??[];_0x1232a6['push'](..._0x319521['map'](_0xcf780a=>_0xcf780a['sqlCode']));if(_0x319521[_0x2c8776(0xb2)]===0x0)break;const _0x306880=_0xee1b08[_0x2c8776(0xb8)]?.[_0x2c8776(0xab)];if(_0x306880!=null?_0x1232a6[_0x2c8776(0xb2)]>=_0x306880:_0x319521[_0x2c8776(0xb2)]<PAGE_SIZE)break;_0xbe5656++;}return _0x1232a6;}export const sqlStatus={'service':a245_0x3baffb(0xb3),'command':'status','description':a245_0x3baffb(0xa7),'risk':a245_0x3baffb(0xac),'flags':[{'name':'remote','type':a245_0x3baffb(0xaf),'description':a245_0x3baffb(0xb4)}],async 'execute'(_0x112855){const _0x3c8759=a245_0x3baffb,_0x4c051f=loadSqlProjectConfig(_0x112855['appCode']),_0x2e2c3d=await readSqlLockFile(_0x4c051f[_0x3c8759(0xc2)]),{appLock:_0xc2a9d4}=ensureSqlLockScope(_0x2e2c3d??createEmptySqlLock(),_0x4c051f[_0x3c8759(0xbf)],_0x4c051f['sqlRoot'],_0x3c8759(0xb5)),_0x1b50b3=await scanLocalSqlQueries(_0x4c051f),_0xdabfc3=[],_0x27b1c1=[],_0x302d3f=[],_0x250a8c=[],_0x370436=new Set(_0x1b50b3['map'](_0x443421=>_0x443421[_0x3c8759(0xb0)]));for(const _0x51d788 of _0x1b50b3){const _0x19ca14=await computeSqlFileHash(_0x51d788['filePath']),_0x35bf0e=_0xc2a9d4['sqls'][_0x51d788[_0x3c8759(0xb0)]],_0x303369=!!_0x35bf0e&&_0x35bf0e[_0x3c8759(0xbb)]!==_0x51d788['relativePath'],_0x59fe07=!!_0x35bf0e&&!!_0x51d788['sqlName']&&_0x35bf0e[_0x3c8759(0xbc)]!==_0x51d788[_0x3c8759(0xbc)];if(!_0x35bf0e)_0xdabfc3['push'](_0x51d788[_0x3c8759(0xb0)]);else _0x35bf0e[_0x3c8759(0xc5)]!==_0x19ca14||_0x303369||_0x59fe07?_0x27b1c1[_0x3c8759(0xae)](_0x51d788[_0x3c8759(0xb0)]):_0x302d3f[_0x3c8759(0xae)](_0x51d788[_0x3c8759(0xb0)]);}for(const _0x47aa42 of Object[_0x3c8759(0xaa)](_0xc2a9d4[_0x3c8759(0xad)])){!_0x370436[_0x3c8759(0xc4)](_0x47aa42)&&_0x250a8c[_0x3c8759(0xae)](_0x47aa42);}const _0x527367=[];if(_0x112855['bool']('remote')){const _0x100d74=await fetchAllSqlCodes(_0x112855[_0x3c8759(0xbf)]);for(const _0x10851d of _0x100d74){!_0x370436['has'](_0x10851d)&&!_0xc2a9d4['sqls'][_0x10851d]&&_0x527367[_0x3c8759(0xae)](_0x10851d);}}const _0x4a5963=_0xdabfc3[_0x3c8759(0xb2)]===0x0&&_0x27b1c1['length']===0x0&&_0x250a8c[_0x3c8759(0xb2)]===0x0&&_0x527367['length']===0x0;return{'ok':!![],'data':{'added':_0xdabfc3,'modified':_0x27b1c1,'missing':_0x250a8c,'unchanged':_0x302d3f,'remoteOnly':_0x527367},'message':_0x4a5963?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0xdabfc3[_0x3c8759(0xb2)]+_0x3c8759(0xbd)+_0x27b1c1[_0x3c8759(0xb2)]+_0x3c8759(0xc1)+_0x250a8c[_0x3c8759(0xb2)]+_0x3c8759(0xb7)+_0x302d3f[_0x3c8759(0xb2)]+'\x20unchanged'+(_0x527367[_0x3c8759(0xb2)]>0x0?',\x20'+_0x527367['length']+_0x3c8759(0xb9):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x28992b=a246_0x8aae;(function(_0xf629f7,_0xd0db44){const _0x14e170=a246_0x8aae,_0x14098e=_0xf629f7();while(!![]){try{const _0x46f2ae=parseInt(_0x14e170(0x131))/0x1*(-parseInt(_0x14e170(0x111))/0x2)+parseInt(_0x14e170(0x123))/0x3+-parseInt(_0x14e170(0x113))/0x4+-parseInt(_0x14e170(0x132))/0x5+-parseInt(_0x14e170(0x122))/0x6*(-parseInt(_0x14e170(0xed))/0x7)+parseInt(_0x14e170(0x119))/0x8*(-parseInt(_0x14e170(0x112))/0x9)+parseInt(_0x14e170(0x10b))/0xa*(parseInt(_0x14e170(0xee))/0xb);if(_0x46f2ae===_0xd0db44)break;else _0x14098e['push'](_0x14098e['shift']());}catch(_0x25d2e9){_0x14098e['push'](_0x14098e['shift']());}}}(a246_0x2d07,0x44bd5));import{readFileSync,existsSync}from'node:fs';function a246_0x2d07(){const _0x3b1edf=['isLockingRead','flagMissing','split','Table\x20\x22','appCode','columns','fields','filter','Provide\x20--file\x20or\x20--sql','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','push','1eNAqIa','1443300JroeVS','from','8638bAzQuC','539YPICrh','columnNames','indexes','validation','index_type','index_columns','check-indexes','schemaWarnings','dbtableConfig','tableName','sql','file','\x22\x20not\x20found\x20in\x20any\x20dataset','--check-indexes\x20requires\x20--schemas.','message','str','isArray','toLowerCase','sqlType','name','parameters','boolean','\x22\x20not\x20found\x20or\x20not\x20accessible','indexName','index_name','type','unshift','schema:','map','103030qtjhhf','valid','get','tables','joinAudit','File\x20not\x20found:\x20','658034IjjGeI','1618929KKDAxd','209328UMMyJa','validate','string','length','pkField','primary','16UJgNFp','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','reason','read','isDangerous','flatMap','cwd','find','schemas','1950uJuZjp','1216293vJsXvJ','trim','SQL\x20schema\x20validation'];a246_0x2d07=function(){return _0x3b1edf;};return a246_0x2d07();}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';function a246_0x8aae(_0x54c575,_0x656483){_0x54c575=_0x54c575-0xed;const _0x2d0714=a246_0x2d07();let _0x8aae61=_0x2d0714[_0x54c575];return _0x8aae61;}export const sqlValidate={'service':a246_0x28992b(0xf8),'command':a246_0x28992b(0x114),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a246_0x28992b(0x11c),'flags':[{'name':a246_0x28992b(0xf9),'type':a246_0x28992b(0x115),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a246_0x28992b(0xf8),'type':a246_0x28992b(0x115),'description':a246_0x28992b(0x11a)},{'name':a246_0x28992b(0x121),'type':a246_0x28992b(0x115),'description':a246_0x28992b(0x12f)},{'name':a246_0x28992b(0xf4),'type':a246_0x28992b(0x103),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x153535){const _0x2805e3=a246_0x28992b,_0x19af2d=_0x153535[_0x2805e3(0xfd)](_0x2805e3(0xf9)),_0x41a076=_0x153535[_0x2805e3(0xfd)]('sql'),_0x2a985c=_0x153535[_0x2805e3(0xfd)](_0x2805e3(0x121)),_0x4a7719=_0x153535['bool']('check-indexes');if(!_0x19af2d&&!_0x41a076)throw CliErrors[_0x2805e3(0x127)](_0x2805e3(0xf9),_0x2805e3(0x12e));if(_0x4a7719&&!_0x2a985c)throw CliErrors[_0x2805e3(0xf1)](_0x2805e3(0xfb));let _0x354fab;if(_0x19af2d){const _0x420e96=resolve(process[_0x2805e3(0x11f)](),_0x19af2d);if(!existsSync(_0x420e96))throw CliErrors['validation'](_0x2805e3(0x110)+_0x420e96);_0x354fab=readFileSync(_0x420e96,'utf-8');}else _0x354fab=_0x41a076;const _0x8c5557=validateSql(_0x354fab),_0x26ad02={'valid':_0x8c5557[_0x2805e3(0x10c)],'sqlType':_0x8c5557[_0x2805e3(0x100)][_0x2805e3(0x107)],'isSelectOnly':_0x8c5557[_0x2805e3(0x100)]['isSelectOnly'],'isLockingRead':_0x8c5557[_0x2805e3(0x100)][_0x2805e3(0x126)]??![],'isDangerous':_0x8c5557[_0x2805e3(0x100)][_0x2805e3(0x11d)],'tables':_0x8c5557[_0x2805e3(0x10e)],'parameters':_0x8c5557[_0x2805e3(0x102)],'message':_0x8c5557[_0x2805e3(0xfc)]};_0x8c5557[_0x2805e3(0x100)]['reason']&&(_0x26ad02[_0x2805e3(0x11b)]=_0x8c5557[_0x2805e3(0x100)][_0x2805e3(0x11b)]);if(_0x2a985c&&_0x8c5557[_0x2805e3(0x10c)]){const _0x1e242c=_0x2a985c[_0x2805e3(0x128)](',')['map'](_0xe94b30=>_0xe94b30['trim']())['filter'](Boolean),_0x2c45de=[],_0x4253fb=[],_0x34dd31=filterDbTableBackedDatasets(await listDatasets(_0x153535[_0x2805e3(0x12a)])),_0x20f2ca=new Map(_0x34dd31['map'](_0x323cfd=>[_0x323cfd['dbtableConfig']?.[_0x2805e3(0xf7)]?.[_0x2805e3(0xff)](),_0x323cfd]));for(const _0x17cf5d of _0x8c5557[_0x2805e3(0x10e)]){const _0x3f5fb2=_0x20f2ca[_0x2805e3(0x10d)](_0x17cf5d[_0x2805e3(0xff)]());!_0x3f5fb2&&_0x2c45de[_0x2805e3(0x130)](_0x2805e3(0x129)+_0x17cf5d+_0x2805e3(0xfa));}for(const _0x5464b2 of _0x1e242c){let _0x18d4ee;try{_0x18d4ee=await getDatasetDetail(_0x5464b2);}catch{_0x2c45de['push']('Dataset\x20\x22'+_0x5464b2+_0x2805e3(0x104));continue;}assertDatasetIsDbTableBacked(_0x18d4ee,_0x2805e3(0x125));const _0x3660a7=Array[_0x2805e3(0xfe)](_0x18d4ee[_0x2805e3(0x12c)])?_0x18d4ee[_0x2805e3(0x12c)]:[],_0x721891=new Set(_0x3660a7[_0x2805e3(0x10a)](_0x472aaf=>_0x472aaf[_0x2805e3(0x101)]?.[_0x2805e3(0xff)]())),_0x4daa0f=_0x18d4ee[_0x2805e3(0xf6)]?.[_0x2805e3(0xf7)]||_0x18d4ee[_0x2805e3(0xf7)]||_0x5464b2;_0x26ad02[_0x2805e3(0x109)+_0x4daa0f]={'code':_0x5464b2,'tableName':_0x4daa0f,'fieldCount':_0x721891['size'],'fields':Array[_0x2805e3(0x133)](_0x721891)};if(_0x4a7719){const _0x622dbe=normalizeDatasetIndexes(_0x18d4ee);_0x4253fb[_0x2805e3(0x130)]({'tableName':_0x4daa0f,..._0x622dbe});}}_0x2c45de['length']>0x0&&(_0x26ad02[_0x2805e3(0xf5)]=_0x2c45de),_0x4a7719&&(_0x26ad02[_0x2805e3(0x10f)]=auditSqlJoinIndexes(_0x354fab,_0x4253fb));}return{'ok':_0x8c5557[_0x2805e3(0x10c)],'data':_0x26ad02,'message':_0x8c5557['message']};}};function normalizeDatasetIndexes(_0x16ea66){const _0x287ef4=a246_0x28992b,_0x17d0ec=Array[_0x287ef4(0xfe)](_0x16ea66?.['dataset']?.['indexes'])?_0x16ea66['dataset']['indexes']:Array['isArray'](_0x16ea66?.[_0x287ef4(0xf0)])?_0x16ea66[_0x287ef4(0xf0)]:[],_0x3b1071=_0x17d0ec[_0x287ef4(0x11e)](_0x1b6478=>{const _0x3eee64=_0x287ef4,_0x31c7e8=Array['isArray'](_0x1b6478?.[_0x3eee64(0xf3)])?_0x1b6478[_0x3eee64(0xf3)]:Array[_0x3eee64(0xfe)](_0x1b6478?.[_0x3eee64(0xef)])?_0x1b6478[_0x3eee64(0xef)]:Array[_0x3eee64(0xfe)](_0x1b6478?.[_0x3eee64(0x12b)])?_0x1b6478[_0x3eee64(0x12b)]:[],_0x79abfe=_0x31c7e8[_0x3eee64(0x12d)](_0x26dd78=>typeof _0x26dd78===_0x3eee64(0x115))[_0x3eee64(0x10a)](_0x20dd2f=>_0x20dd2f[_0x3eee64(0x124)]())[_0x3eee64(0x12d)](Boolean);if(_0x79abfe[_0x3eee64(0x116)]===0x0)return[];const _0x5b1f3c=[_0x1b6478?.[_0x3eee64(0x105)],_0x1b6478?.[_0x3eee64(0x106)],_0x1b6478?.[_0x3eee64(0x101)]][_0x3eee64(0x120)](_0x336dc0=>typeof _0x336dc0===_0x3eee64(0x115)&&_0x336dc0[_0x3eee64(0x124)]()),_0x50535b=[_0x1b6478?.[_0x3eee64(0xf2)],_0x1b6478?.[_0x3eee64(0x107)]]['find'](_0x25a3bd=>typeof _0x25a3bd===_0x3eee64(0x115)&&_0x25a3bd[_0x3eee64(0x124)]());return[{..._0x5b1f3c?{'name':_0x5b1f3c['trim']()}:{},..._0x50535b?{'type':_0x50535b['trim']()}:{},'columns':_0x79abfe}];}),_0x5d3aa7=[..._0x3b1071],_0x476b61=typeof _0x16ea66?.[_0x287ef4(0xf6)]?.[_0x287ef4(0x117)]===_0x287ef4(0x115)?_0x16ea66[_0x287ef4(0xf6)][_0x287ef4(0x117)][_0x287ef4(0x128)](',')[_0x287ef4(0x10a)](_0x132c16=>_0x132c16[_0x287ef4(0x124)]())[_0x287ef4(0x12d)](Boolean):[];return _0x476b61['length']>0x0&&_0x5d3aa7[_0x287ef4(0x108)]({'type':_0x287ef4(0x118),'columns':_0x476b61}),{'indexes':_0x5d3aa7,'metadataAvailable':_0x3b1071[_0x287ef4(0x116)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1c9845,_0x5164f9){const _0x35f405=a247_0x54fe,_0x2b21a3=_0x1c9845();while(!![]){try{const _0x547f1f=-parseInt(_0x35f405(0x139))/0x1*(parseInt(_0x35f405(0x13f))/0x2)+-parseInt(_0x35f405(0x13a))/0x3+parseInt(_0x35f405(0x13c))/0x4*(-parseInt(_0x35f405(0x137))/0x5)+-parseInt(_0x35f405(0x134))/0x6+parseInt(_0x35f405(0x135))/0x7*(parseInt(_0x35f405(0x13b))/0x8)+-parseInt(_0x35f405(0x138))/0x9*(parseInt(_0x35f405(0x136))/0xa)+parseInt(_0x35f405(0x13d))/0xb*(parseInt(_0x35f405(0x13e))/0xc);if(_0x547f1f===_0x5164f9)break;else _0x2b21a3['push'](_0x2b21a3['shift']());}catch(_0xbaf51f){_0x2b21a3['push'](_0x2b21a3['shift']());}}}(a247_0x9857,0x9f496));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a247_0x54fe(_0x7370a0,_0xb1785){_0x7370a0=_0x7370a0-0x134;const _0x985791=a247_0x9857();let _0x54fef6=_0x985791[_0x7370a0];return _0x54fef6;}function a247_0x9857(){const _0x8feea2=['4EWlbYt','2721975aeqizH','112UpPEId','256KTgdrp','11MryLpv','41277660ABBiOa','338482MJMcWH','988188ZUbrGo','236663pDxoyD','118470WPIQqO','38505pFbsWv','774OxcnpP'];a247_0x9857=function(){return _0x8feea2;};return a247_0x9857();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x41a142=a248_0x2f22;(function(_0x3f0c3f,_0x7edc0e){const _0x2b4540=a248_0x2f22,_0x5d1e9e=_0x3f0c3f();while(!![]){try{const _0x3ad32a=-parseInt(_0x2b4540(0x85))/0x1*(parseInt(_0x2b4540(0x8b))/0x2)+parseInt(_0x2b4540(0x77))/0x3+parseInt(_0x2b4540(0x83))/0x4+parseInt(_0x2b4540(0x7d))/0x5*(parseInt(_0x2b4540(0x82))/0x6)+-parseInt(_0x2b4540(0x84))/0x7*(parseInt(_0x2b4540(0x89))/0x8)+parseInt(_0x2b4540(0x81))/0x9+-parseInt(_0x2b4540(0x7c))/0xa*(-parseInt(_0x2b4540(0x7f))/0xb);if(_0x3ad32a===_0x7edc0e)break;else _0x5d1e9e['push'](_0x5d1e9e['shift']());}catch(_0x387d66){_0x5d1e9e['push'](_0x5d1e9e['shift']());}}}(a248_0x4713,0x9cd46));function a248_0x2f22(_0xd5734f,_0x42c017){_0xd5734f=_0xd5734f-0x76;const _0x4713a7=a248_0x4713();let _0x2f22c5=_0x4713a7[_0xd5734f];return _0x2f22c5;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a248_0x4713(){const _0x48135a=['11815639dZOuMi','flagMissing','7235271XJbDSG','24qSrvDf','2931904XYPmSk','2746681yWYBOj','379PoYOvb','trim','task-id','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','24jMOyNk','taskId','6406jrMInl','apiError','271404qyKxFl','status','read','str','appCode','10dKGTsq','414935UnccQw','isTerminal'];a248_0x4713=function(){return _0x48135a;};return a248_0x4713();}import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':a248_0x41a142(0x78),'description':a248_0x41a142(0x88),'risk':a248_0x41a142(0x79),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a248_0x41a142(0x87),'type':'string','required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2bffcd){const _0x2859f1=a248_0x41a142;if(!_0x2bffcd[_0x2859f1(0x7a)]('task-id')['trim']())throw CliErrors[_0x2859f1(0x80)]('task-id');},async 'execute'(_0x5f38ec){const _0x4d60be=a248_0x41a142,_0x2e8b8a=_0x5f38ec[_0x4d60be(0x7a)](_0x4d60be(0x87))[_0x4d60be(0x86)](),_0x2ddfde=normalizeAsyncTask(await getAsyncTaskStatus(_0x2e8b8a,_0x5f38ec[_0x4d60be(0x7b)],_0x5f38ec['cookie']));if(_0x2ddfde['taskId']!==_0x2e8b8a)throw CliErrors[_0x4d60be(0x76)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x2e8b8a+',\x20received\x20'+_0x2ddfde['taskId']+'.');const _0x5e3ee4=buildAsyncTaskStatusCommand(_0x2ddfde[_0x4d60be(0x8a)],_0x5f38ec[_0x4d60be(0x7b)]);return{'ok':!![],'message':asyncTaskMessage(_0x2ddfde),'data':{'appCode':_0x5f38ec['appCode'],..._0x2ddfde,'query':_0x2ddfde[_0x4d60be(0x7e)]?null:{'command':_0x5e3ee4}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2fa1e9,_0x538832){const _0x229c76=a249_0x581b,_0x263a6=_0x2fa1e9();while(!![]){try{const _0x550a9a=-parseInt(_0x229c76(0x76))/0x1+parseInt(_0x229c76(0x7d))/0x2+-parseInt(_0x229c76(0x7a))/0x3+parseInt(_0x229c76(0x75))/0x4+-parseInt(_0x229c76(0x78))/0x5*(parseInt(_0x229c76(0x7b))/0x6)+-parseInt(_0x229c76(0x77))/0x7*(-parseInt(_0x229c76(0x79))/0x8)+parseInt(_0x229c76(0x7c))/0x9*(parseInt(_0x229c76(0x7e))/0xa);if(_0x550a9a===_0x538832)break;else _0x263a6['push'](_0x263a6['shift']());}catch(_0x59c8b9){_0x263a6['push'](_0x263a6['shift']());}}}(a249_0x1cee,0xd0887));function a249_0x581b(_0x4977f2,_0x473610){_0x4977f2=_0x4977f2-0x75;const _0x1cee58=a249_0x1cee();let _0x581bfb=_0x1cee58[_0x4977f2];return _0x581bfb;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];function a249_0x1cee(){const _0x4ca2cb=['626885oEYNMQ','1071415MEHOJo','64UmEDKE','1650510aQfIgJ','18AvZwRM','8016444PMlQxR','853684NQKsdl','10VMbLkj','1231748HCajMU','294765MkPcAR'];a249_0x1cee=function(){return _0x4ca2cb;};return a249_0x1cee();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x12020b=a250_0x2622;(function(_0xd088e3,_0x45931c){const _0x499c41=a250_0x2622,_0x1bf304=_0xd088e3();while(!![]){try{const _0x2f5d69=parseInt(_0x499c41(0x132))/0x1*(parseInt(_0x499c41(0x135))/0x2)+-parseInt(_0x499c41(0x138))/0x3+-parseInt(_0x499c41(0x12c))/0x4*(-parseInt(_0x499c41(0x129))/0x5)+-parseInt(_0x499c41(0x13b))/0x6*(-parseInt(_0x499c41(0x134))/0x7)+parseInt(_0x499c41(0x131))/0x8+-parseInt(_0x499c41(0x128))/0x9+parseInt(_0x499c41(0x133))/0xa*(parseInt(_0x499c41(0x137))/0xb);if(_0x2f5d69===_0x45931c)break;else _0x1bf304['push'](_0x1bf304['shift']());}catch(_0xd3e4e0){_0x1bf304['push'](_0x1bf304['shift']());}}}(a250_0x23e1,0xac7d9));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a250_0x2622(_0x563ad5,_0x5ed712){_0x563ad5=_0x563ad5-0x128;const _0x23e1af=a250_0x23e1();let _0x26222a=_0x23e1af[_0x563ad5];return _0x26222a;}import{CliErrors}from'../../errors.js';function a250_0x23e1(){const _0x30e39d=['length','read','Found\x20','members-list','3574584cNkgta','8453BIjYEa','14340HKZrIq','406reJekQ','34UFeahd','Pass\x20--tenant-code\x20<code>.','1375asuGRN','3878247vdQUec','tenant-code','\x20tenant\x20member(s)','80742RrPPbo','tenant','flagMissing','6420483KuPaXD','5811885fDOEYk','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','str','4VHqhKL'];a250_0x23e1=function(){return _0x30e39d;};return a250_0x23e1();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a250_0x12020b(0x13c),'command':a250_0x12020b(0x130),'description':a250_0x12020b(0x12a),'risk':a250_0x12020b(0x12e),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'tenant-code','type':'string','required':!![],'description':'Exact\x20tenant\x20code'}],async 'validate'(_0x40ba05){const _0x4fc6b7=a250_0x12020b;if(!_0x40ba05[_0x4fc6b7(0x12b)](_0x4fc6b7(0x139))['trim']())throw CliErrors[_0x4fc6b7(0x13d)](_0x4fc6b7(0x139),_0x4fc6b7(0x136));},async 'execute'(_0x3f3160){const _0x36e7ec=a250_0x12020b,_0x18e818=_0x3f3160[_0x36e7ec(0x12b)](_0x36e7ec(0x139))['trim'](),_0x1d7a89=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x18e818,_0x1d7a89);const _0x4d5915=projectTenantMembers(await listTenantDirectoryMembers(_0x18e818));return{'ok':!![],'data':{'tenantCode':_0x18e818,'items':_0x4d5915,'totalCount':_0x4d5915[_0x36e7ec(0x12d)]},'message':_0x36e7ec(0x12f)+_0x4d5915['length']+_0x36e7ec(0x13a)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5c3c1c,_0x5a5796){const _0x21514c=a251_0x1b59,_0x433dee=_0x5c3c1c();while(!![]){try{const _0x4a153d=-parseInt(_0x21514c(0x113))/0x1+parseInt(_0x21514c(0x12a))/0x2*(-parseInt(_0x21514c(0x11e))/0x3)+parseInt(_0x21514c(0x11b))/0x4*(parseInt(_0x21514c(0x11f))/0x5)+-parseInt(_0x21514c(0x112))/0x6+-parseInt(_0x21514c(0x12b))/0x7+parseInt(_0x21514c(0x117))/0x8*(-parseInt(_0x21514c(0x123))/0x9)+parseInt(_0x21514c(0x115))/0xa;if(_0x4a153d===_0x5a5796)break;else _0x433dee['push'](_0x433dee['shift']());}catch(_0x52cfc8){_0x433dee['push'](_0x433dee['shift']());}}}(a251_0x555c,0xc01c9));import{CliErrors}from'../../errors.js';function textOrNull(_0x48e2b1){const _0x313a84=a251_0x1b59,_0x2c422f=_0x48e2b1?.[_0x313a84(0x118)]();return _0x2c422f?_0x2c422f:null;}export function projectTenantMembers(_0x4aa822){const _0x3036e0=a251_0x1b59,_0x382451=new Map();for(const _0x10a184 of _0x4aa822){const _0x9ca5e9=Number(_0x10a184['userId']);if(!Number[_0x3036e0(0x126)](_0x9ca5e9)||_0x9ca5e9<=0x0)continue;const _0x321446={'userId':_0x9ca5e9,'username':textOrNull(_0x10a184[_0x3036e0(0x124)]),'displayName':textOrNull(_0x10a184[_0x3036e0(0x11d)]),'role':_0x10a184[_0x3036e0(0x127)]===!![]?_0x3036e0(0x11a):'MEMBER','status':textOrNull(_0x10a184[_0x3036e0(0x114)])},_0x4b8452=_0x382451[_0x3036e0(0x129)](_0x9ca5e9);if(!_0x4b8452){_0x382451[_0x3036e0(0x125)](_0x9ca5e9,_0x321446);continue;}_0x4b8452[_0x3036e0(0x124)]??=_0x321446[_0x3036e0(0x124)],_0x4b8452['displayName']??=_0x321446[_0x3036e0(0x120)],_0x4b8452[_0x3036e0(0x114)]??=_0x321446[_0x3036e0(0x114)];if(_0x321446[_0x3036e0(0x121)]===_0x3036e0(0x11a))_0x4b8452[_0x3036e0(0x121)]=_0x3036e0(0x11a);}return[..._0x382451[_0x3036e0(0x122)]()]['sort']((_0x4f8609,_0xb21157)=>_0x4f8609[_0x3036e0(0x111)]-_0xb21157[_0x3036e0(0x111)]);}export function assertTenantAccessible(_0x4436ab,_0x4f93fa){const _0x56e0a7=a251_0x1b59;if(_0x4f93fa[_0x56e0a7(0x116)](_0x437665=>_0x437665['tenantCode']===_0x4436ab))return;throw CliErrors['validation'](_0x56e0a7(0x119)+_0x4436ab+_0x56e0a7(0x11c),_0x56e0a7(0x128));}function a251_0x1b59(_0x49bbfc,_0x4ddd63){_0x49bbfc=_0x49bbfc-0x111;const _0x555ca2=a251_0x555c();let _0x1b595e=_0x555ca2[_0x49bbfc];return _0x1b595e;}function a251_0x555c(){const _0x307cf7=['set','isFinite','adminFlag','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','get','74978zjuShp','2852710NKOZFe','userId','2093310VeJgcE','870319uNGNVO','status','32323350CpYWta','some','136IHkDJm','trim','Tenant\x20\x22','ADMIN','233304ktEMlK','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','nickname','24roRrJL','55slZXwz','displayName','role','values','614322qDxXMs','username'];a251_0x555c=function(){return _0x307cf7;};return a251_0x555c();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a252_0x28729a=a252_0x2905;(function(_0x5d9064,_0x5f4dbe){const _0x1e811c=a252_0x2905,_0xe97405=_0x5d9064();while(!![]){try{const _0xe7f44c=parseInt(_0x1e811c(0xda))/0x1*(parseInt(_0x1e811c(0xdb))/0x2)+parseInt(_0x1e811c(0xd7))/0x3*(parseInt(_0x1e811c(0xd6))/0x4)+parseInt(_0x1e811c(0xeb))/0x5+parseInt(_0x1e811c(0xd5))/0x6+parseInt(_0x1e811c(0xee))/0x7*(-parseInt(_0x1e811c(0xd8))/0x8)+parseInt(_0x1e811c(0xe4))/0x9*(-parseInt(_0x1e811c(0xe5))/0xa)+-parseInt(_0x1e811c(0xea))/0xb;if(_0xe7f44c===_0x5f4dbe)break;else _0xe97405['push'](_0xe97405['shift']());}catch(_0xf8a7a2){_0xe97405['push'](_0xe97405['shift']());}}}(a252_0x44b9,0x8ac88));import{asDryRunResult}from'../../commands/common/dry-run.js';function a252_0x2905(_0xb42e24,_0x2b9913){_0xb42e24=_0xb42e24-0xd5;const _0x44b9fe=a252_0x44b9();let _0x290543=_0x44b9fe[_0xb42e24];return _0x290543;}import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a252_0x28729a(0xed),CURRENT_BINDING_WARNING=a252_0x28729a(0xe6);function readDingTalkUserId(_0x609976){const _0x1f7cf1=a252_0x28729a,_0x6ea562=_0x609976[_0x1f7cf1(0xde)](_0x1f7cf1(0xdc))[_0x1f7cf1(0xe9)]();if(!_0x6ea562)throw CliErrors[_0x1f7cf1(0xdd)](_0x1f7cf1(0xe0),_0x1f7cf1(0xe8));return _0x6ea562;}function a252_0x44b9(){const _0x54c517=['Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','trim','10055518loqSMx','4916105aHWSwD','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','dingtalk','2695973CEGrhA','3179334IXEWFD','264LNOUPr','17175bUbBPQ','8EikzRQ','POST','1hOHJHP','39062tpTdew','ding-talk-user-id','validation','str','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','--ding-talk-user-id\x20cannot\x20be\x20empty.','apiError','user-account','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','9wYXKik','427580cSgskW','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','bind'];a252_0x44b9=function(){return _0x54c517;};return a252_0x44b9();}function buildBindingData(_0x407bc2,_0x574c9b){const _0x2892b6=a252_0x28729a;return{'operation':_0x2892b6(0xe7),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x407bc2},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x407bc2,'bound':!![]},'dryRun':_0x574c9b,'backend':{'method':'POST','path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a252_0x28729a(0xe2),'command':'dingding-sandbox-bind','description':a252_0x28729a(0xec),'risk':'write','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'ding-talk-user-id','type':'string','required':!![],'description':a252_0x28729a(0xe3)}],async 'validate'(_0x55a869){readDingTalkUserId(_0x55a869);},async 'dryRun'(_0x27611c){const _0x34dc0f=a252_0x28729a,_0x2e1421=readDingTalkUserId(_0x27611c);return asDryRunResult(buildBindingData(_0x2e1421,!![]),{'method':_0x34dc0f(0xd9),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x23fd4d){const _0x3b86c4=a252_0x28729a,_0x45f5cb=readDingTalkUserId(_0x23fd4d),_0x26312e=await bindDingTalkSandboxAccount(_0x45f5cb);if(_0x26312e!==!![])throw CliErrors[_0x3b86c4(0xe1)](_0x3b86c4(0xdf),'Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.');return{'ok':!![],'data':buildBindingData(_0x45f5cb,![]),'message':'Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a253_0x73d387=a253_0x3383;(function(_0x23b3d6,_0x533e33){const _0x514bf7=a253_0x3383,_0xeaa1d6=_0x23b3d6();while(!![]){try{const _0x53e23e=parseInt(_0x514bf7(0x11f))/0x1*(parseInt(_0x514bf7(0x126))/0x2)+parseInt(_0x514bf7(0x115))/0x3*(parseInt(_0x514bf7(0x120))/0x4)+-parseInt(_0x514bf7(0x112))/0x5*(parseInt(_0x514bf7(0x11e))/0x6)+parseInt(_0x514bf7(0x11c))/0x7*(parseInt(_0x514bf7(0x116))/0x8)+-parseInt(_0x514bf7(0x118))/0x9*(parseInt(_0x514bf7(0x11b))/0xa)+parseInt(_0x514bf7(0x124))/0xb*(-parseInt(_0x514bf7(0x117))/0xc)+-parseInt(_0x514bf7(0x122))/0xd;if(_0x53e23e===_0x533e33)break;else _0xeaa1d6['push'](_0xeaa1d6['shift']());}catch(_0x5aecdc){_0xeaa1d6['push'](_0xeaa1d6['shift']());}}}(a253_0x791c,0x7dc2f));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindFeishuAccount,FEISHU_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a253_0x73d387(0x121),CURRENT_BINDING_WARNING=a253_0x73d387(0x127);function readUnionId(_0x4231b3){const _0x13f1d6=a253_0x73d387,_0x59e2d4=_0x4231b3[_0x13f1d6(0x128)](_0x13f1d6(0x125))[_0x13f1d6(0x11d)]();if(!/^on_[A-Za-z0-9_-]+$/['test'](_0x59e2d4))throw CliErrors['validation']('--union-id\x20must\x20match\x20on_\x20followed\x20by\x20letters,\x20digits,\x20underscores,\x20or\x20hyphens.',_0x13f1d6(0x113));return _0x59e2d4;}function a253_0x3383(_0x8bd900,_0x155df2){_0x8bd900=_0x8bd900-0x10f;const _0x791c62=a253_0x791c();let _0x33837f=_0x791c62[_0x8bd900];return _0x33837f;}function a253_0x791c(){const _0x69b2d=['feishu','14992497eFRtMe','bind','209OGEMLr','union-id','134geQGyg','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','str','apiError','Feishu\x20account\x20binding\x20was\x20not\x20confirmed.','user-account','945845wPHoiS','Pass\x20a\x20Feishu\x20union\x20id\x20such\x20as\x20on_example_001.','Bound\x20current\x20user\x20to\x20Feishu\x20account.','2586102iUcdPH','232NrhMDs','54588ZxEzmr','324xEBLfV','string','Feishu\x20union_id\x20for\x20the\x20configured\x20Feishu\x20application\x20developer','57560FeSPye','192619KzgzEG','trim','6geQdPl','7331CdwwqK','4TxFGQo'];a253_0x791c=function(){return _0x69b2d;};return a253_0x791c();}function buildBindingData(_0x3c6a32,_0x200685){const _0x1b56d4=a253_0x73d387;return{'operation':_0x1b56d4(0x123),'selector':{'providerId':PROVIDER_ID,'unionId':_0x3c6a32},'before':null,'after':{'providerId':PROVIDER_ID,'unionId':_0x3c6a32,'bound':!![]},'dryRun':_0x200685,'backend':{'method':'POST','path':FEISHU_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const feishuBind={'service':a253_0x73d387(0x111),'command':'feishu-bind','description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20Feishu\x20account','risk':'write','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a253_0x73d387(0x125),'type':a253_0x73d387(0x119),'required':!![],'description':a253_0x73d387(0x11a)}],async 'validate'(_0x12747c){readUnionId(_0x12747c);},async 'dryRun'(_0x3442c4){const _0x2d2b3c=readUnionId(_0x3442c4);return asDryRunResult(buildBindingData(_0x2d2b3c,!![]),{'method':'POST','url':FEISHU_BIND_PATH});},async 'execute'(_0xea2bba){const _0x4ec209=a253_0x73d387,_0x6b5a43=readUnionId(_0xea2bba),_0x55d0ba=await bindFeishuAccount(_0x6b5a43);if(_0x55d0ba!==!![])throw CliErrors[_0x4ec209(0x10f)](_0x4ec209(0x110),'Verify\x20the\x20current\x20binding\x20through\x20the\x20platform\x20before\x20explicitly\x20retrying;\x20do\x20not\x20automatically\x20retry.');return{'ok':!![],'data':buildBindingData(_0x6b5a43,![]),'message':_0x4ec209(0x114)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a254_0x12db(){const _0x4eb74f=['10008nGgRIU','4bFKulw','900xYlhkj','31473SBZMlq','133lWfXSn','28072OANqfj','152BkWHdC','1044845nxKQNS','51754xjqnnu','72lUlgCU','375GFZTxc','112314mRaCcH','15588nJrPiZ'];a254_0x12db=function(){return _0x4eb74f;};return a254_0x12db();}(function(_0x41bab6,_0xacea3e){const _0x825f4f=a254_0x4fef,_0x518eda=_0x41bab6();while(!![]){try{const _0x882f8d=-parseInt(_0x825f4f(0xbc))/0x1*(-parseInt(_0x825f4f(0xc2))/0x2)+parseInt(_0x825f4f(0xbe))/0x3*(-parseInt(_0x825f4f(0xc1))/0x4)+-parseInt(_0x825f4f(0xbb))/0x5+parseInt(_0x825f4f(0xbf))/0x6*(parseInt(_0x825f4f(0xc5))/0x7)+-parseInt(_0x825f4f(0xc7))/0x8*(-parseInt(_0x825f4f(0xc0))/0x9)+-parseInt(_0x825f4f(0xc3))/0xa*(-parseInt(_0x825f4f(0xc6))/0xb)+-parseInt(_0x825f4f(0xbd))/0xc*(parseInt(_0x825f4f(0xc4))/0xd);if(_0x882f8d===_0xacea3e)break;else _0x518eda['push'](_0x518eda['shift']());}catch(_0x4af48a){_0x518eda['push'](_0x518eda['shift']());}}}(a254_0x12db,0x2d4a8));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';import{feishuBind}from'../../commands/user-account/feishu-bind.js';function a254_0x4fef(_0x1fe32a,_0x131d6e){_0x1fe32a=_0x1fe32a-0xbb;const _0x12db79=a254_0x12db();let _0x4fef6a=_0x12db79[_0x1fe32a];return _0x4fef6a;}export const userAccountDefinitions=[dingTalkSandboxBind,feishuBind];
|