@lovrabet/rabetbase-cli 2.5.4-beta.4 → 2.5.4
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/README.md +8 -2
- 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.d.ts +2 -0
- package/lib/commands/app/detail.js +1 -0
- 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.d.ts +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.d.ts +3 -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.d.ts +2 -0
- package/lib/commands/menu/shared/path.js +1 -0
- package/lib/commands/menu/shared/service.d.ts +6 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.d.ts +28 -0
- package/lib/commands/menu/shared/subapp-assets.js +1 -0
- package/lib/commands/menu/shared/sync-core.d.ts +2 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/types.d.ts +14 -4
- 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.d.ts +2 -0
- package/lib/commands/menu/subapp-assets-status.js +1 -0
- package/lib/commands/menu/subapp-assets-update.d.ts +2 -0
- package/lib/commands/menu/subapp-assets-update.js +1 -0
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +15 -0
- 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 +1 -1
- package/skills/rabetbase/SKILL.md +21 -12
- package/skills/rabetbase/guides/backend-function.md +2 -7
- package/skills/rabetbase/guides/bff-creation-workflow.md +24 -23
- package/skills/rabetbase/guides/host-frontend-integration.md +62 -0
- package/skills/rabetbase/guides/independent-deployment.md +45 -0
- package/skills/rabetbase/guides/troubleshooting.md +9 -1
- package/skills/rabetbase/references/rabetbase-app-detail.md +31 -0
- package/skills/rabetbase/references/rabetbase-bff-detail.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-push.md +2 -2
- package/skills/rabetbase/references/rabetbase-data-list-status.md +1 -0
- package/skills/rabetbase/references/rabetbase-deployment-sync-all.md +5 -1
- package/skills/rabetbase/references/rabetbase-menu-asset-update.md +9 -7
- package/skills/rabetbase/references/rabetbase-menu-list.md +2 -2
- package/skills/rabetbase/references/rabetbase-menu-subapp-assets-status.md +19 -0
- package/skills/rabetbase/references/rabetbase-menu-subapp-assets-update.md +27 -0
- package/skills/rabetbase/references/rabetbase-menu-sync.md +40 -14
- package/skills/rabetbase/references/rabetbase-page-create.md +1 -1
- package/skills/rabetbase/references/rabetbase-page-generate-start.md +5 -3
- package/skills/rabetbase/references/rabetbase-page-generate-status.md +1 -0
- package/skills/rabetbase.manifest.json +8 -3
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a239_0x2b61(){const _0x262e73=['942792GmDayT','5FUOcaQ','14tBueZw','1443693rKMxXv','SQL\x20execution\x20failed','sqlcode','str','length','20055882QTaZMu','798800eaYKJL','3062110YFdbCj','execError','\x20row(s)\x20in\x20','execResult','string','425713vnLZwc','appCode','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','execSuccess','18eClRQi','2177408MKSmXy','now','2wgPGaj','params','sql'];a239_0x2b61=function(){return _0x262e73;};return a239_0x2b61();}function a239_0x1874(_0xc736ff,_0x3110f4){_0xc736ff=_0xc736ff-0x14d;const _0x2b61ce=a239_0x2b61();let _0x18740c=_0x2b61ce[_0xc736ff];return _0x18740c;}const a239_0x534992=a239_0x1874;(function(_0x1c0a97,_0x4b0d8e){const _0x1c47ca=a239_0x1874,_0x2f755b=_0x1c0a97();while(!![]){try{const _0x5d9171=-parseInt(_0x1c47ca(0x150))/0x1+parseInt(_0x1c47ca(0x157))/0x2*(parseInt(_0x1c47ca(0x15d))/0x3)+-parseInt(_0x1c47ca(0x163))/0x4*(parseInt(_0x1c47ca(0x15b))/0x5)+-parseInt(_0x1c47ca(0x15a))/0x6+parseInt(_0x1c47ca(0x15c))/0x7*(-parseInt(_0x1c47ca(0x155))/0x8)+-parseInt(_0x1c47ca(0x154))/0x9*(parseInt(_0x1c47ca(0x164))/0xa)+parseInt(_0x1c47ca(0x162))/0xb;if(_0x5d9171===_0x4b0d8e)break;else _0x2f755b['push'](_0x2f755b['shift']());}catch(_0x5253ff){_0x2f755b['push'](_0x2f755b['shift']());}}}(a239_0x2b61,0x59276));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':a239_0x534992(0x159),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':'params','type':a239_0x534992(0x14f),'description':a239_0x534992(0x152)}],async 'execute'(_0x3ae108){const _0x48325a=a239_0x534992,_0x2eae1c=parseJsonParams(_0x3ae108['str'](_0x48325a(0x158))),_0xbd174c=Date[_0x48325a(0x156)](),_0x54a9cc=await executeSql(_0x3ae108[_0x48325a(0x151)],_0x3ae108[_0x48325a(0x160)](_0x48325a(0x15f)),_0x2eae1c),_0x547d95=Date['now']()-_0xbd174c,_0x1cce9a=_0x54a9cc?.[_0x48325a(0x14e)]??_0x54a9cc,_0x1c5034=_0x54a9cc?.[_0x48325a(0x153)]??!![];if(!_0x1c5034)return{'ok':![],'data':{'error':_0x54a9cc?.[_0x48325a(0x165)]||_0x48325a(0x15e),'elapsed':_0x547d95},'message':_0x48325a(0x15e)};const _0x6e2956=Array['isArray'](_0x1cce9a)?_0x1cce9a:[];return{'ok':!![],'data':{'rows':_0x6e2956,'rowCount':_0x6e2956[_0x48325a(0x161)],'elapsed':_0x547d95},'message':'Returned\x20'+_0x6e2956['length']+_0x48325a(0x14d)+_0x547d95+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x310bba,_0x4e42bd){const _0x37e755=a240_0xcb79,_0x388aa7=_0x310bba();while(!![]){try{const _0x2baecd=-parseInt(_0x37e755(0x89))/0x1*(parseInt(_0x37e755(0x91))/0x2)+parseInt(_0x37e755(0x8a))/0x3+-parseInt(_0x37e755(0x86))/0x4*(-parseInt(_0x37e755(0x8c))/0x5)+parseInt(_0x37e755(0x87))/0x6*(parseInt(_0x37e755(0x88))/0x7)+-parseInt(_0x37e755(0x8b))/0x8*(parseInt(_0x37e755(0x90))/0x9)+parseInt(_0x37e755(0x8e))/0xa+parseInt(_0x37e755(0x8f))/0xb*(parseInt(_0x37e755(0x8d))/0xc);if(_0x2baecd===_0x4e42bd)break;else _0x388aa7['push'](_0x388aa7['shift']());}catch(_0x419c9d){_0x388aa7['push'](_0x388aa7['shift']());}}}(a240_0x5104,0x773b0));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a240_0xcb79(_0x47d39b,_0x2fd2bf){_0x47d39b=_0x47d39b-0x86;const _0x5104f5=a240_0x5104();let _0xcb793=_0x5104f5[_0x47d39b];return _0xcb793;}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a240_0x5104(){const _0x2cc6af=['2411547LgwgIP','8zRKKOS','815sAOeje','22620ovRuuH','22200uLrRln','1133rXUXiB','7588233InPqZN','23142mdidwo','15316KlxYcc','1228242JYBEEV','7SABDeL','43GUIrmn'];a240_0x5104=function(){return _0x2cc6af;};return a240_0x5104();}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a241_0x5db3(_0x174d1a,_0x51d617){_0x174d1a=_0x174d1a-0x144;const _0x49bcd0=a241_0x49bc();let _0x5db303=_0x49bcd0[_0x174d1a];return _0x5db303;}const a241_0x38237a=a241_0x5db3;(function(_0x37f32e,_0xcdc89b){const _0x1c6d62=a241_0x5db3,_0x40a90b=_0x37f32e();while(!![]){try{const _0x161c52=-parseInt(_0x1c6d62(0x15a))/0x1+parseInt(_0x1c6d62(0x163))/0x2*(parseInt(_0x1c6d62(0x15b))/0x3)+-parseInt(_0x1c6d62(0x15f))/0x4*(-parseInt(_0x1c6d62(0x157))/0x5)+-parseInt(_0x1c6d62(0x15e))/0x6*(-parseInt(_0x1c6d62(0x169))/0x7)+-parseInt(_0x1c6d62(0x156))/0x8*(parseInt(_0x1c6d62(0x14d))/0x9)+parseInt(_0x1c6d62(0x155))/0xa*(-parseInt(_0x1c6d62(0x151))/0xb)+parseInt(_0x1c6d62(0x167))/0xc*(parseInt(_0x1c6d62(0x166))/0xd);if(_0x161c52===_0xcdc89b)break;else _0x40a90b['push'](_0x40a90b['shift']());}catch(_0x24dc7a){_0x40a90b['push'](_0x40a90b['shift']());}}}(a241_0x49bc,0xcd255));function a241_0x49bc(){const _0x5cbc80=['sql','145174BbImWs','length','Found\x20','943566iISNjF','420UexExb','Page\x20size','9086GzutGc','string','bool','all','number','verbose','dbId','num','List\x20custom\x20SQL\x20queries','paging','9kMeiLQ','page','sqlCode','str','22fHmbbU','description','Filter\x20by\x20SQL\x20name','read','3231850bwnWKU','10980248fAecIH','185XCXgmM','name','tableData','500391IpGVjf','15pyqjkC','appCode','map','1662pYCwVe','10456TOJMel','sqlcode','pagesize'];a241_0x49bc=function(){return _0x5cbc80;};return a241_0x49bc();}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a241_0x38237a(0x162),'command':'list','description':a241_0x38237a(0x14b),'risk':a241_0x38237a(0x154),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a241_0x38237a(0x158),'type':a241_0x38237a(0x144),'description':a241_0x38237a(0x153)},{'name':'page','type':a241_0x38237a(0x147),'description':'Page\x20number','default':0x1},{'name':a241_0x38237a(0x161),'type':a241_0x38237a(0x147),'description':a241_0x38237a(0x168)},{'name':a241_0x38237a(0x148),'type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x34b474){const _0x40739f=a241_0x38237a,_0x294949=await listSqlQueries(_0x34b474[_0x40739f(0x15c)],{'sqlCode':_0x34b474['str'](_0x40739f(0x160))||undefined,'sqlName':_0x34b474[_0x40739f(0x150)](_0x40739f(0x158))||undefined,'currentPage':_0x34b474[_0x40739f(0x14a)](_0x40739f(0x14e)),'pageSize':_0x34b474[_0x40739f(0x14a)]('pagesize',0x32)}),_0x31297d=_0x34b474[_0x40739f(0x145)](_0x40739f(0x148)),_0x6d04c3=_0x294949[_0x40739f(0x159)]??[],_0x12107c=_0x294949[_0x40739f(0x14c)]?.['totalCount']??_0x6d04c3['length'];let _0x4c05ff;return _0x31297d?_0x4c05ff=_0x6d04c3:_0x4c05ff=await Promise[_0x40739f(0x146)](_0x6d04c3[_0x40739f(0x15d)](async _0xe3784e=>{const _0x3328e9=_0x40739f;let _0x5bac91;try{_0x5bac91=_0xe3784e[_0x3328e9(0x149)]?await getDbName(_0x34b474[_0x3328e9(0x15c)],_0xe3784e[_0x3328e9(0x149)]):undefined;}catch{}return{'sqlCode':_0xe3784e[_0x3328e9(0x14f)],'sqlName':_0xe3784e['sqlName'],'description':_0xe3784e[_0x3328e9(0x152)]??'','db':_0x5bac91?_0x5bac91+'\x20('+_0xe3784e[_0x3328e9(0x149)]+')':_0xe3784e[_0x3328e9(0x149)]??''};})),{'ok':!![],'data':_0x4c05ff,'message':_0x6d04c3[_0x40739f(0x164)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x40739f(0x165)+_0x6d04c3[_0x40739f(0x164)]+'\x20SQL\x20queries\x20(total:\x20'+_0x12107c+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a237_0x1d0ba9=a237_0x390a;(function(_0x82887d,_0x49d323){const _0x3573f1=a237_0x390a,_0xb1e81d=_0x82887d();while(!![]){try{const _0x518208=-parseInt(_0x3573f1(0x1d1))/0x1+parseInt(_0x3573f1(0x1ae))/0x2*(parseInt(_0x3573f1(0x1a6))/0x3)+-parseInt(_0x3573f1(0x1df))/0x4*(-parseInt(_0x3573f1(0x1d3))/0x5)+parseInt(_0x3573f1(0x1d0))/0x6+-parseInt(_0x3573f1(0x1de))/0x7+parseInt(_0x3573f1(0x1d4))/0x8+-parseInt(_0x3573f1(0x1d7))/0x9;if(_0x518208===_0x49d323)break;else _0xb1e81d['push'](_0xb1e81d['shift']());}catch(_0x16b74b){_0xb1e81d['push'](_0xb1e81d['shift']());}}}(a237_0x4ec1,0x8cd67));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';function a237_0x390a(_0x2ec6ee,_0x58e2f8){_0x2ec6ee=_0x2ec6ee-0x198;const _0x4ec1a0=a237_0x4ec1();let _0x390ae5=_0x4ec1a0[_0x2ec6ee];return _0x390ae5;}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(_0x3b8505,_0x3ab9a3){const _0x570c6d=a237_0x390a,_0x257b6f=[];let _0x280ff4=0x1;while(!![]){const _0x4aad0b=await listSqlQueries(_0x3b8505,{'currentPage':_0x280ff4,'pageSize':PAGE_SIZE,'sqlCode':_0x3ab9a3[_0x570c6d(0x1dd)],'sqlName':_0x3ab9a3[_0x570c6d(0x1a8)]}),_0x26f666=_0x4aad0b['tableData']??[];_0x257b6f[_0x570c6d(0x1c3)](..._0x26f666);if(_0x26f666[_0x570c6d(0x1cf)]===0x0)break;const _0x52f142=_0x4aad0b[_0x570c6d(0x1b7)]?.[_0x570c6d(0x1bf)];if(_0x52f142!=null?_0x257b6f[_0x570c6d(0x1cf)]>=_0x52f142:_0x26f666[_0x570c6d(0x1cf)]<PAGE_SIZE)break;_0x280ff4++;}return _0x257b6f;}async function ensureSqlContent(_0x4e1625){const _0xe5dab8=a237_0x390a;if(_0x4e1625['sqlContent']!=null&&String(_0x4e1625['sqlContent'])[_0xe5dab8(0x1cf)]>0x0)return _0x4e1625;return getSqlQueryDetail(_0x4e1625[_0xe5dab8(0x1dd)]);}export const sqlPull={'service':'sql','command':'pull','description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a237_0x1d0ba9(0x1c9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a237_0x1d0ba9(0x1da),'description':a237_0x1d0ba9(0x1b2)},{'name':a237_0x1d0ba9(0x1d9),'type':a237_0x1d0ba9(0x1b9),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x26e2d6){const _0x57a001=a237_0x1d0ba9,_0x482d89=loadSqlProjectConfig(_0x26e2d6[_0x57a001(0x1d6)]),_0x5e833b=await readSqlLockFile(_0x482d89[_0x57a001(0x1bb)]),{appLock:_0x1d6a5c}=ensureSqlLockScope(_0x5e833b??createEmptySqlLock(),_0x482d89[_0x57a001(0x1d6)],_0x482d89[_0x57a001(0x19c)],_0x57a001(0x1b3)),_0x1c6bda=await fetchAllSqlQueries(_0x26e2d6[_0x57a001(0x1d6)],{'sqlCode':_0x26e2d6[_0x57a001(0x19f)](_0x57a001(0x1be))||undefined,'sqlName':_0x26e2d6[_0x57a001(0x19f)](_0x57a001(0x1aa))||undefined}),_0x5c56eb=[];for(const _0x1e2754 of _0x1c6bda){const _0x271063=await ensureSqlContent(_0x1e2754),_0x11c4d4=ensureRemoteSqlContent(_0x271063),_0x4b4bad=detectSqlMode(_0x11c4d4),_0x1433fd=_0x271063[_0x57a001(0x1a9)]?await getDbName(_0x26e2d6['appCode'],Number(_0x271063[_0x57a001(0x1a9)]))[_0x57a001(0x1ca)](()=>undefined):undefined,_0x269764=buildLocalSqlFileContent({'sqlCode':_0x271063['sqlCode'],'sqlName':_0x271063[_0x57a001(0x1a8)],'dbId':_0x271063[_0x57a001(0x1a9)]},_0x11c4d4,{'dbName':_0x1433fd,'mode':_0x4b4bad,'syncedAt':new Date()[_0x57a001(0x1b8)](),'description':_0x271063[_0x57a001(0x19d)]}),_0x5b3993=buildSqlLockEntry(_0x271063,_0x11c4d4,'',{'dbName':_0x1433fd}),_0xe809f2=resolveLocalSqlFilePath(_0x482d89,_0x271063[_0x57a001(0x1dd)],_0x5b3993);let _0x2faf02='would_pull',_0x43f1c0;const _0x5399f2=await findExistingSqlFiles(_0x482d89,_0xe809f2,_0x4b4bad,_0x1d6a5c[_0x57a001(0x1a0)][_0x271063[_0x57a001(0x1dd)]]);if(_0x5399f2[_0x57a001(0x1cf)]>0x0){const _0x27c105=await compareExistingSqlFiles(_0x5399f2,_0x269764,_0x4b4bad);if(_0x27c105[_0x57a001(0x1a7)](({equivalent:_0x1128ea})=>!_0x1128ea))_0x2faf02=_0x57a001(0x1b1),_0x43f1c0=_0x57a001(0x19a);else _0x27c105[_0x57a001(0x1cf)]===0x1&&_0x27c105[0x0]?.['file'][_0x57a001(0x1d2)]&&(_0x2faf02=_0x57a001(0x1c4),_0x43f1c0=_0x57a001(0x1c6));}_0x5c56eb[_0x57a001(0x1c3)]({'sqlCode':_0x271063[_0x57a001(0x1dd)],'sqlName':_0x271063[_0x57a001(0x1a8)],'filePath':_0xe809f2,'status':_0x2faf02,'reason':_0x43f1c0});}return{'method':'POST','url':_0x57a001(0x1c1),'body':{'appCode':_0x26e2d6[_0x57a001(0x1d6)],'sqlCode':_0x26e2d6[_0x57a001(0x19f)]('sqlcode')||null,'sqlName':_0x26e2d6[_0x57a001(0x19f)](_0x57a001(0x1aa))||null,'files':_0x5c56eb},'description':'Would\x20pull\x20'+_0x5c56eb[_0x57a001(0x1cf)]+_0x57a001(0x1bc)+_0x482d89[_0x57a001(0x1b5)]};},async 'execute'(_0x1993d6){const _0x3c8e16=a237_0x1d0ba9,_0x30797a=loadSqlProjectConfig(_0x1993d6[_0x3c8e16(0x1d6)]),_0x347672=await readSqlLockFile(_0x30797a[_0x3c8e16(0x1bb)]),{lockData:_0x281e04,appLock:_0x1a03d3}=ensureSqlLockScope(_0x347672??createEmptySqlLock(),_0x30797a['appCode'],_0x30797a[_0x3c8e16(0x19c)],'pull'),_0x295d97=_0x1993d6[_0x3c8e16(0x1cc)](_0x3c8e16(0x1d9)),_0x2e1596=await fetchAllSqlQueries(_0x1993d6[_0x3c8e16(0x1d6)],{'sqlCode':_0x1993d6[_0x3c8e16(0x19f)](_0x3c8e16(0x1be))||undefined,'sqlName':_0x1993d6['str'](_0x3c8e16(0x1aa))||undefined});if(_0x2e1596[_0x3c8e16(0x1cf)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3c8e16(0x199)};const _0x51b6fe=[],_0x4906a8=[];for(const _0x16dc07 of _0x2e1596){try{_0x51b6fe[_0x3c8e16(0x1c3)](await ensureSqlContent(_0x16dc07));}catch(_0x2b52d4){_0x4906a8[_0x3c8e16(0x1c3)]({'sqlCode':_0x16dc07['sqlCode'],'error':_0x2b52d4 instanceof Error?_0x2b52d4['message']:String(_0x2b52d4)});}}if(_0x295d97&&!_0x1993d6[_0x3c8e16(0x1d8)]){let _0x14ce89=![];for(const _0x979f14 of _0x51b6fe){const _0x5a2047=detectSqlMode(ensureRemoteSqlContent(_0x979f14)),_0x54cd6a=_0x979f14[_0x3c8e16(0x1a9)]?await getDbName(_0x1993d6[_0x3c8e16(0x1d6)],Number(_0x979f14[_0x3c8e16(0x1a9)]))[_0x3c8e16(0x1ca)](()=>undefined):undefined,_0x5c7717=buildLocalSqlFileContent({'sqlCode':_0x979f14[_0x3c8e16(0x1dd)],'sqlName':_0x979f14['sqlName'],'dbId':_0x979f14[_0x3c8e16(0x1a9)]},ensureRemoteSqlContent(_0x979f14),{'dbName':_0x54cd6a,'mode':_0x5a2047,'syncedAt':new Date()[_0x3c8e16(0x1b8)](),'description':_0x979f14[_0x3c8e16(0x19d)]}),_0x928fb2=resolveLocalSqlFilePath(_0x30797a,_0x979f14[_0x3c8e16(0x1dd)],buildSqlLockEntry(_0x979f14,ensureRemoteSqlContent(_0x979f14),'',{'dbName':_0x54cd6a})),_0x18a777=await findExistingSqlFiles(_0x30797a,_0x928fb2,_0x5a2047,_0x1a03d3['sqls'][_0x979f14[_0x3c8e16(0x1dd)]]),_0x2e719a=await compareExistingSqlFiles(_0x18a777,_0x5c7717,_0x5a2047);if(_0x2e719a[_0x3c8e16(0x1a7)](({equivalent:_0x10e03b})=>!_0x10e03b)){_0x14ce89=!![];break;}}if(_0x14ce89){const _0x4305f4=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x4305f4)throw CliErrors[_0x3c8e16(0x1ad)](_0x3c8e16(0x1a5));}}const _0x411755=cloneSqlLockData(_0x281e04),_0x1e8c48=_0x411755[_0x3c8e16(0x1c5)][_0x30797a[_0x3c8e16(0x1d6)]],_0x26513d=[],_0x5b703d=[];for(const _0x1e2fda of _0x51b6fe){const _0x2fcb1e=_0x1e8c48[_0x3c8e16(0x1a0)][_0x1e2fda[_0x3c8e16(0x1dd)]],_0xed7047=ensureRemoteSqlContent(_0x1e2fda),_0x2a01c9=detectSqlMode(_0xed7047),_0x36e3e7=_0x1e2fda['dbId']?await getDbName(_0x1993d6[_0x3c8e16(0x1d6)],Number(_0x1e2fda[_0x3c8e16(0x1a9)]))[_0x3c8e16(0x1ca)](()=>undefined):undefined,_0x553aa8=buildLocalSqlFileContent({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'sqlName':_0x1e2fda[_0x3c8e16(0x1a8)],'dbId':_0x1e2fda[_0x3c8e16(0x1a9)]},_0xed7047,{'dbName':_0x36e3e7,'mode':_0x2a01c9,'syncedAt':new Date()[_0x3c8e16(0x1b8)](),'description':_0x1e2fda[_0x3c8e16(0x19d)]}),_0x4792b2=buildSqlLockEntry(_0x1e2fda,_0xed7047,computeSqlContentHash(_0x553aa8),{'dbName':_0x36e3e7}),_0x1016f9=_0x4792b2[_0x3c8e16(0x1cb)],_0x420dc7=join(_0x30797a[_0x3c8e16(0x1b5)],_0x1016f9);try{const _0x50e7ae=await findExistingSqlFiles(_0x30797a,_0x420dc7,_0x2a01c9,_0x2fcb1e),_0x3f4e6f=await compareExistingSqlFiles(_0x50e7ae,_0x553aa8,_0x2a01c9);if(!_0x295d97&&_0x3f4e6f['some'](({equivalent:_0x255aa4})=>!_0x255aa4)){_0x5b703d[_0x3c8e16(0x1c3)]({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'reason':_0x3c8e16(0x1c8)});continue;}const _0x2e4747=_0x3f4e6f[_0x3c8e16(0x1b4)](({file:_0x5a314f})=>_0x5a314f[_0x3c8e16(0x1d2)]),_0x43fbb3=_0x3f4e6f[_0x3c8e16(0x1b4)](({file:_0x5dde29})=>!_0x5dde29['isCanonical']);if(_0x2e4747?.['equivalent']&&!_0x43fbb3){_0x5b703d[_0x3c8e16(0x1c3)]({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'reason':_0x3c8e16(0x1c6)}),_0x1e8c48[_0x3c8e16(0x1a0)][_0x1e2fda[_0x3c8e16(0x1dd)]]={..._0x4792b2,'hash':computeSqlContentHash(_0x2e4747[_0x3c8e16(0x1ab)]),'path':_0x1016f9};continue;}!_0x2e4747?.['equivalent']&&(await ensureParentDirectory(_0x420dc7),await writeFile(_0x420dc7,_0x553aa8,_0x3c8e16(0x1a2))),_0x43fbb3&&await rm(_0x43fbb3[_0x3c8e16(0x1dc)][_0x3c8e16(0x1af)],{'force':!![]}),_0x1e8c48[_0x3c8e16(0x1a0)][_0x1e2fda[_0x3c8e16(0x1dd)]]={..._0x4792b2,'hash':_0x2e4747?.[_0x3c8e16(0x1ac)]?computeSqlContentHash(_0x2e4747[_0x3c8e16(0x1ab)]):_0x4792b2[_0x3c8e16(0x1b6)],'path':_0x1016f9},_0x26513d[_0x3c8e16(0x1c3)]({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'filePath':_0x420dc7});}catch(_0x47ac9d){_0x4906a8[_0x3c8e16(0x1c3)]({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'error':_0x47ac9d instanceof Error?_0x47ac9d[_0x3c8e16(0x1d5)]:String(_0x47ac9d)});}}return _0x1e8c48[_0x3c8e16(0x1cd)]=new Date()[_0x3c8e16(0x1b8)](),await writeSqlLockFile(_0x30797a[_0x3c8e16(0x1bb)],_0x411755),{'ok':_0x4906a8[_0x3c8e16(0x1cf)]===0x0,'data':{'pulled':_0x26513d,'skipped':_0x5b703d,'failed':_0x4906a8},'message':_0x3c8e16(0x1ba)+_0x26513d[_0x3c8e16(0x1cf)]+_0x3c8e16(0x1ce)+_0x5b703d[_0x3c8e16(0x1cf)]+'\x20skipped,\x20'+_0x4906a8['length']+_0x3c8e16(0x1c7)};}};function isEquivalentPulledSqlFile(_0x353ff4,_0xb38d0c,_0x3ca1af,_0x66ad5d){if(_0x3ca1af!==_0x66ad5d)return normalizePulledSqlBody(_0x353ff4,_0x3ca1af)===normalizePulledSqlBody(_0xb38d0c,_0x66ad5d);return normalizePullComparableContent(_0x353ff4,_0x3ca1af)===normalizePullComparableContent(_0xb38d0c,_0x66ad5d);}function a237_0x4ec1(){const _0x174f74=['equivalent','cancelled','8zPBopI','filePath','map','conflict','Filter\x20by\x20SQL\x20display\x20name','pull','find','sqlRootDir','hash','paging','toISOString','boolean','Pull\x20complete:\x20','lockFilePath','\x20SQL\x20file(s)\x20into\x20','test','sqlcode','totalCount','mybatisXml','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','mode','push','skipped','apps','unchanged','\x20failed','local\x20differs\x20from\x20remote','read','catch','path','bool','lastSync','\x20written,\x20','length','3061668HQvcwZ','56640cymOZi','isCanonical','525xvvcfZ','8733160OwESpf','message','appCode','22400334FEMvLl','nonInteractive','force','string','split','file','sqlCode','2562875zdnJJC','32908KrVjJQ','endsWith','No\x20remote\x20SQL\x20queries\x20matched.','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','.xml','sqlRoot','description','filter','str','sqls','replace','utf8','trim','toLowerCase','Force\x20pull\x20cancelled.','767103oNWHBh','some','sqlName','dbId','name','content'];a237_0x4ec1=function(){return _0x174f74;};return a237_0x4ec1();}async function findExistingSqlFiles(_0x392402,_0x5bf1ad,_0x41ff36,_0x4a83ae){const _0x1cea9e=a237_0x1d0ba9,_0x226dae=[];await fileExists(_0x5bf1ad)&&_0x226dae[_0x1cea9e(0x1c3)]({'filePath':_0x5bf1ad,'mode':_0x41ff36,'isCanonical':!![]});if(!_0x4a83ae?.['path'])return _0x226dae;const _0x2d466d=join(_0x392402['sqlRootDir'],_0x4a83ae[_0x1cea9e(0x1cb)]);if(_0x2d466d===_0x5bf1ad)return _0x226dae;return await fileExists(_0x2d466d)&&_0x226dae['push']({'filePath':_0x2d466d,'mode':_0x4a83ae[_0x1cea9e(0x1c2)]??modeFromFilePath(_0x2d466d),'isCanonical':![]}),_0x226dae;}async function compareExistingSqlFiles(_0x40efde,_0x530664,_0x2b6c02){const _0x544f75=a237_0x1d0ba9;return Promise['all'](_0x40efde[_0x544f75(0x1b0)](async _0x37b4d9=>{const _0x1e356d=_0x544f75,_0x301eae=await readFile(_0x37b4d9[_0x1e356d(0x1af)],_0x1e356d(0x1a2));return{'file':_0x37b4d9,'content':_0x301eae,'equivalent':isEquivalentPulledSqlFile(_0x301eae,_0x530664,_0x37b4d9['mode'],_0x2b6c02)};}));}function modeFromFilePath(_0xc56807){const _0x5263f6=a237_0x1d0ba9;return _0xc56807[_0x5263f6(0x1a4)]()[_0x5263f6(0x198)](_0x5263f6(0x19b))?'mybatisXml':'sql';}function normalizePulledSqlBody(_0xacf3f6,_0x22bf9f){const _0x345c6c=a237_0x1d0ba9;return stripLocalSqlMetadata(_0xacf3f6,_0x22bf9f)[_0x345c6c(0x1a1)](/\r\n/g,'\x0a')[_0x345c6c(0x1a3)]();}function normalizePullComparableContent(_0x54f80,_0x1f9dd3){const _0x511af2=a237_0x1d0ba9,_0x4d1817=_0x54f80['replace'](/\r\n/g,'\x0a')[_0x511af2(0x1db)]('\x0a'),_0x21d349=_0x4d1817[_0x511af2(0x19e)](_0x30fbbe=>!isSyncedAtMetadataLine(_0x30fbbe,_0x1f9dd3));return _0x21d349['join']('\x0a');}function isSyncedAtMetadataLine(_0x2cf4ba,_0x2bd1fa){const _0x381d91=a237_0x1d0ba9;if(_0x2bd1fa===_0x381d91(0x1c0))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2cf4ba);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x381d91(0x1bd)](_0x2cf4ba);}
|
|
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);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a238_0x4d4323=a238_0x54d3;(function(_0x159241,_0x20315b){const _0x2b7fbe=a238_0x54d3,_0x4135ad=_0x159241();while(!![]){try{const _0x202bc3=-parseInt(_0x2b7fbe(0x1dd))/0x1+parseInt(_0x2b7fbe(0x1b0))/0x2+parseInt(_0x2b7fbe(0x1d8))/0x3*(-parseInt(_0x2b7fbe(0x1c9))/0x4)+-parseInt(_0x2b7fbe(0x1b5))/0x5*(-parseInt(_0x2b7fbe(0x1b7))/0x6)+-parseInt(_0x2b7fbe(0x1c8))/0x7+parseInt(_0x2b7fbe(0x1be))/0x8*(-parseInt(_0x2b7fbe(0x1d2))/0x9)+parseInt(_0x2b7fbe(0x1cb))/0xa*(parseInt(_0x2b7fbe(0x1bd))/0xb);if(_0x202bc3===_0x20315b)break;else _0x4135ad['push'](_0x4135ad['shift']());}catch(_0x5a5a51){_0x4135ad['push'](_0x4135ad['shift']());}}}(a238_0x2043,0x1ab67));function a238_0x54d3(_0x386e30,_0x51723e){_0x386e30=_0x386e30-0x1ad;const _0x2043ce=a238_0x2043();let _0x54d3b6=_0x2043ce[_0x386e30];return _0x54d3b6;}import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a238_0x2043(){const _0x28ca2a=['73910qmIgjc','has','mode','dbId','\x20failed','29385ZGcAdU','unchanged','12DUEtYc','set','hash','map','dbName','No\x20local\x20SQL\x20files\x20found.','4168637FLVBHV','1002440lDKAzn','validation','remoteId','path','catch','sqlRootDir','sqlCode','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20skipped,\x20','isFinite','51779ZFxiVX','20NkhUkc','force','10CBURgB','sqlName','write','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','lastSync','9cwSdsH','join','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlcode','replace','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','3459WTftbD','sql',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','length','version','179794HEFquZ','sqls','trim',':\x20SQL\x20content\x20is\x20empty.','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','relativePath','filePath','boolean','push','utf8','filter','lockFilePath','dbDirectory','Push\x20local\x20SQL\x20files\x20to\x20remote','appCode','Local\x20SQL\x20not\x20found:\x20','sqlRoot','get','\x20SQL\x20file(s)','\x20pushed,\x20','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','toISOString','projectRoot','bool','trashDir','startsWith'];a238_0x2043=function(){return _0x28ca2a;};return a238_0x2043();}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(_0x5486ac){const _0x420147=a238_0x54d3,_0x2f2dfd=stripLocalSqlMetadata(await readFile(_0x5486ac[_0x420147(0x1e3)],_0x420147(0x1e6)),_0x5486ac[_0x420147(0x1b2)]);if(!_0x2f2dfd[_0x420147(0x1df)]())throw CliErrors[_0x420147(0x1bf)](_0x5486ac[_0x420147(0x1c4)]+_0x420147(0x1e0));return _0x2f2dfd;}async function getTargetSqlQueries(_0x97f7a4,_0x2ef73f,_0x1610f1){const _0x9fbb39=a238_0x54d3,_0xfad63b=await scanLocalSqlQueries(_0x97f7a4),_0x50278c=new Map();for(const _0x566ac5 of _0xfad63b){if(_0x1610f1&&_0x566ac5['sqlCode']!==_0x1610f1)continue;const _0xbcb22c=_0x50278c[_0x9fbb39(0x1ee)](_0x566ac5['sqlCode'])??[];_0xbcb22c['push'](_0x566ac5),_0x50278c[_0x9fbb39(0x1b8)](_0x566ac5[_0x9fbb39(0x1c4)],_0xbcb22c);}if(_0x1610f1&&!_0x50278c[_0x9fbb39(0x1b1)](_0x1610f1))throw CliErrors[_0x9fbb39(0x1bf)](_0x9fbb39(0x1ec)+_0x1610f1);const _0x474b32=[];for(const [_0x4923f3,_0x4ab647]of _0x50278c['entries']()){if(_0x4ab647[_0x9fbb39(0x1db)]===0x1){_0x474b32['push'](_0x4ab647[0x0]);continue;}const _0x65bbf9=_0x2ef73f['sqls'][_0x4923f3],_0x136dd7=_0x65bbf9?.[_0x9fbb39(0x1c1)],_0x4a7285=_0x136dd7?_0x4ab647[_0x9fbb39(0x1e7)](_0x20092c=>_0x20092c[_0x9fbb39(0x1e2)]!==_0x136dd7):_0x4ab647;if(_0x65bbf9&&_0x4a7285[_0x9fbb39(0x1db)]===0x1){_0x474b32[_0x9fbb39(0x1e5)](_0x4a7285[0x0]);continue;}throw CliErrors['validation'](_0x9fbb39(0x1ce)+_0x4923f3+_0x9fbb39(0x1d4));}return _0x474b32;}export const sqlPush={'service':a238_0x4d4323(0x1d9),'command':a238_0x4d4323(0x1e5),'description':a238_0x4d4323(0x1ea),'risk':a238_0x4d4323(0x1cd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a238_0x4d4323(0x1ca),'type':a238_0x4d4323(0x1e4),'description':a238_0x4d4323(0x1f1)}],async 'dryRun'(_0x28b737){const _0x4e308a=a238_0x4d4323,_0x48b48a=loadSqlProjectConfig(_0x28b737[_0x4e308a(0x1eb)]),_0xe333ca=await readSqlLockFile(_0x48b48a['lockFilePath']),{appLock:_0x2e72bc}=ensureSqlLockScope(_0xe333ca??createEmptySqlLock(),_0x28b737[_0x4e308a(0x1eb)],_0x48b48a['sqlRoot'],_0x4e308a(0x1e5)),_0x5b8599=await getTargetSqlQueries(_0x48b48a,_0x2e72bc,_0x28b737['str']('sqlcode')||undefined),_0x124b01=[];for(const _0x380d33 of _0x5b8599){const _0x21f99a=await computeSqlFileHash(_0x380d33[_0x4e308a(0x1e3)]),_0xd8af9d=_0x2e72bc[_0x4e308a(0x1de)][_0x380d33[_0x4e308a(0x1c4)]],_0x555366=!!_0xd8af9d&&(_0xd8af9d[_0x4e308a(0x1c1)]!==_0x380d33[_0x4e308a(0x1e2)]||!!_0x380d33[_0x4e308a(0x1cc)]&&_0xd8af9d[_0x4e308a(0x1cc)]!==_0x380d33[_0x4e308a(0x1cc)]||_0xd8af9d[_0x4e308a(0x1b2)]!==_0x380d33['mode']);if(!_0x28b737[_0x4e308a(0x1ad)](_0x4e308a(0x1ca))&&_0xd8af9d&&_0xd8af9d[_0x4e308a(0x1b9)]===_0x21f99a&&!_0x555366)continue;if(!_0xd8af9d)throw CliErrors[_0x4e308a(0x1bf)](_0x380d33['sqlCode']+_0x4e308a(0x1da));if(_0xd8af9d[_0x4e308a(0x1dc)]==null)throw CliErrors[_0x4e308a(0x1bf)](_0x380d33[_0x4e308a(0x1c4)]+_0x4e308a(0x1cf));await resolveTargetDbBinding(_0x28b737[_0x4e308a(0x1eb)],_0x380d33,_0xd8af9d),await readSqlUploadContent(_0x380d33),_0x124b01[_0x4e308a(0x1e5)](_0x380d33[_0x4e308a(0x1c4)]);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x124b01,'appCode':_0x28b737[_0x4e308a(0x1eb)]},'description':'Would\x20push\x20'+_0x124b01[_0x4e308a(0x1db)]+_0x4e308a(0x1ef)};},async 'execute'(_0x29c376){const _0x354b58=a238_0x4d4323,_0x4ec760=loadSqlProjectConfig(_0x29c376[_0x354b58(0x1eb)]),_0x51610a=await readSqlLockFile(_0x4ec760['lockFilePath']),{lockData:_0x1b9259,appLock:_0x32a159}=ensureSqlLockScope(_0x51610a??createEmptySqlLock(),_0x29c376[_0x354b58(0x1eb)],_0x4ec760[_0x354b58(0x1ed)],_0x354b58(0x1e5)),_0x23ed83=await getTargetSqlQueries(_0x4ec760,_0x32a159,_0x29c376['str'](_0x354b58(0x1d5))||undefined);if(_0x23ed83['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x354b58(0x1bc)};const _0xd8ae61=[],_0x540edc=[],_0x55384e=[];let _0x4a9be1=![];for(const _0x593fd7 of _0x23ed83){const _0x39ef91=_0x32a159[_0x354b58(0x1de)][_0x593fd7[_0x354b58(0x1c4)]];if(!_0x39ef91){_0x55384e[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'error':_0x354b58(0x1d0)});continue;}try{const _0x3c4e19=await computeSqlFileHash(_0x593fd7[_0x354b58(0x1e3)]),_0x365bb1=_0x39ef91[_0x354b58(0x1c1)]!==_0x593fd7[_0x354b58(0x1e2)]||!!_0x593fd7[_0x354b58(0x1cc)]&&_0x39ef91[_0x354b58(0x1cc)]!==_0x593fd7[_0x354b58(0x1cc)]||_0x39ef91[_0x354b58(0x1b2)]!==_0x593fd7['mode'];if(!_0x29c376['bool'](_0x354b58(0x1ca))&&_0x39ef91[_0x354b58(0x1b9)]===_0x3c4e19&&!_0x365bb1){_0x540edc[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'reason':_0x354b58(0x1b6)});continue;}if(_0x39ef91['version']==null){_0x55384e[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'error':_0x354b58(0x1d7)});continue;}const _0x55cfa1=_0x593fd7[_0x354b58(0x1cc)]||_0x39ef91[_0x354b58(0x1cc)],_0x414b34=await resolveTargetDbBinding(_0x29c376['appCode'],_0x593fd7,_0x39ef91),_0x48e96d=await readSqlUploadContent(_0x593fd7),_0x86da4a=await updateSqlQuery({'id':_0x39ef91[_0x354b58(0x1c0)],'appCode':_0x29c376[_0x354b58(0x1eb)],'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'sqlName':_0x55cfa1,'dbId':_0x414b34['dbId'],'version':_0x39ef91['version'],'sqlContent':_0x48e96d,'sqlConfig':_0x39ef91['sqlConfig']??undefined}),_0x1296fa=_0x86da4a[_0x354b58(0x1b3)]?await getDbName(_0x29c376[_0x354b58(0x1eb)],Number(_0x86da4a[_0x354b58(0x1b3)]))[_0x354b58(0x1c2)](()=>_0x414b34[_0x354b58(0x1bb)]):_0x414b34[_0x354b58(0x1bb)];_0x32a159['sqls'][_0x593fd7[_0x354b58(0x1c4)]]={...buildSqlLockEntry(_0x86da4a,_0x48e96d,_0x3c4e19,{'dbName':_0x1296fa}),'path':_0x593fd7[_0x354b58(0x1e2)],'mode':_0x593fd7['mode']},_0x4a9be1=!![],await archivePreviousSqlFileIfNeeded(_0x4ec760,_0x39ef91[_0x354b58(0x1c1)],_0x593fd7[_0x354b58(0x1e2)]),_0xd8ae61[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'remoteId':_0x39ef91['remoteId']});}catch(_0x50dab5){_0x55384e[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'error':_0x50dab5 instanceof Error?_0x50dab5['message']:String(_0x50dab5)});}}(_0x4a9be1||_0x55384e[_0x354b58(0x1db)]===0x0)&&(_0x32a159[_0x354b58(0x1d1)]=new Date()[_0x354b58(0x1f2)](),await writeSqlLockFile(_0x4ec760[_0x354b58(0x1e8)],_0x1b9259));const _0x2f72c5=_0x55384e[_0x354b58(0x1db)]===0x0;return{'ok':_0x2f72c5,'data':{'pushed':_0xd8ae61,'skipped':_0x540edc,'failed':_0x55384e},'message':'Push\x20complete:\x20'+_0xd8ae61[_0x354b58(0x1db)]+_0x354b58(0x1f0)+_0x540edc['length']+_0x354b58(0x1c6)+_0x55384e['length']+_0x354b58(0x1b4)};}};async function archivePreviousSqlFileIfNeeded(_0x2d8b7d,_0x51d270,_0x553a85){const _0x158240=a238_0x4d4323;if(!_0x51d270||_0x51d270===_0x553a85)return;const _0x49e252=join(_0x2d8b7d[_0x158240(0x1c3)],_0x51d270);if(!await fileExists(_0x49e252))return;const _0x43cab5=await moveToTrash(_0x2d8b7d[_0x158240(0x1f3)],_0x2d8b7d[_0x158240(0x1ae)],_0x49e252);await cleanupEmptyDirectories(dirname(_0x49e252),_0x2d8b7d[_0x158240(0x1c3)]),void _0x43cab5;}async function moveToTrash(_0x8bb851,_0x243592,_0x314d99){const _0x189861=a238_0x4d4323,_0x39cfeb=new Date()[_0x189861(0x1f2)]()[_0x189861(0x1d6)](/[:.]/g,'-'),_0x2fa2bb=relative(_0x8bb851,_0x314d99),_0x4ee9f5=join(_0x243592,_0x39cfeb,_0x2fa2bb);return await mkdir(dirname(_0x4ee9f5),{'recursive':!![]}),await rename(_0x314d99,_0x4ee9f5),_0x4ee9f5;}async function cleanupEmptyDirectories(_0x4ca392,_0x53e664){const _0x45e794=a238_0x4d4323;let _0x12fa8c=resolve(_0x4ca392);const _0x131691=resolve(_0x53e664);while(_0x12fa8c[_0x45e794(0x1af)](''+_0x131691+sep)||_0x12fa8c===_0x131691){if(_0x12fa8c===_0x131691)return;try{const _0x46ad49=await readdir(_0x12fa8c);if(_0x46ad49[_0x45e794(0x1db)]>0x0)return;await rmdir(_0x12fa8c);}catch{return;}_0x12fa8c=dirname(_0x12fa8c);}}async function resolveTargetDbBinding(_0x1facd5,_0x14f6ad,_0x359f06){const _0x1dfdec=a238_0x4d4323,_0x4905f4=_0x14f6ad[_0x1dfdec(0x1e9)];if(!_0x4905f4)return{'dbId':_0x359f06['dbId'],'dbName':_0x359f06[_0x1dfdec(0x1bb)]};const _0x3347ae=buildDbDirectoryName(_0x359f06[_0x1dfdec(0x1bb)],_0x359f06[_0x1dfdec(0x1b3)]);if(_0x4905f4===_0x3347ae)return{'dbId':_0x359f06['dbId'],'dbName':_0x359f06['dbName']};const _0x23a94e=parseExplicitDbDirectory(_0x4905f4);if(_0x23a94e!=null)return{'dbId':_0x23a94e,'dbName':await getDbName(_0x1facd5,_0x23a94e)[_0x1dfdec(0x1c2)](()=>undefined)};const _0x4ccb6b=await listDatabases(_0x1facd5),_0x32c8d8=_0x4ccb6b[_0x1dfdec(0x1e7)](_0x170a53=>buildDbDirectoryName(_0x170a53['dbName'],_0x170a53[_0x1dfdec(0x1b3)])===_0x4905f4);if(_0x32c8d8[_0x1dfdec(0x1db)]===0x1)return{'dbId':_0x32c8d8[0x0]['dbId'],'dbName':_0x32c8d8[0x0][_0x1dfdec(0x1bb)]};if(_0x32c8d8[_0x1dfdec(0x1db)]===0x0)throw CliErrors['validation'](_0x1dfdec(0x1c5)+_0x4905f4+'\x22\x20for\x20sqlCode\x20'+_0x14f6ad[_0x1dfdec(0x1c4)]+'.');const _0x3f542f=_0x32c8d8[_0x1dfdec(0x1ba)](_0x3cbda2=>_0x3cbda2[_0x1dfdec(0x1bb)]+'\x20('+_0x3cbda2['dbId']+')')[_0x1dfdec(0x1d3)](',\x20');throw CliErrors[_0x1dfdec(0x1bf)]('Local\x20directory\x20\x22'+_0x4905f4+_0x1dfdec(0x1e1)+_0x14f6ad[_0x1dfdec(0x1c4)]+':\x20'+_0x3f542f);}function parseExplicitDbDirectory(_0x2ad7df){const _0x2ff917=a238_0x4d4323,_0x31c1ba=/^db-(\d+)$/['exec'](_0x2ad7df);if(!_0x31c1ba)return null;const _0x3d082a=Number(_0x31c1ba[0x1]);return Number[_0x2ff917(0x1c7)](_0x3d082a)&&_0x3d082a>0x0?_0x3d082a:null;}
|
|
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 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x44eda7=a244_0x51c9;(function(_0x18722a,_0x2eeb97){const _0x2166f6=a244_0x51c9,_0x12fc77=_0x18722a();while(!![]){try{const _0x181a20=-parseInt(_0x2166f6(0xe4))/0x1+-parseInt(_0x2166f6(0xe2))/0x2*(parseInt(_0x2166f6(0xf0))/0x3)+parseInt(_0x2166f6(0xcf))/0x4*(parseInt(_0x2166f6(0xd3))/0x5)+parseInt(_0x2166f6(0xda))/0x6*(parseInt(_0x2166f6(0xf9))/0x7)+parseInt(_0x2166f6(0xea))/0x8+parseInt(_0x2166f6(0xf7))/0x9+parseInt(_0x2166f6(0xd1))/0xa;if(_0x181a20===_0x2eeb97)break;else _0x12fc77['push'](_0x12fc77['shift']());}catch(_0x5ca406){_0x12fc77['push'](_0x12fc77['shift']());}}}(a244_0x4d78,0xbb03b));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=a244_0x44eda7(0xe6);export function buildSqlLockEntry(_0x573cf3,_0x6d6f3,_0x17d970,_0x7d5c96){const _0xf5d224=a244_0x44eda7,_0x2da00f=detectSqlMode(_0x6d6f3);return{'path':buildSqlRelativePath(_0x573cf3[_0xf5d224(0xde)],_0x573cf3['sqlName'],_0x7d5c96?.[_0xf5d224(0xee)],_0x2da00f,_0x573cf3[_0xf5d224(0xd2)]),'hash':_0x17d970,'remoteId':_0x573cf3['id'],'version':_0x573cf3[_0xf5d224(0xf4)],'dbId':Number(_0x573cf3[_0xf5d224(0xd2)]),'dbName':_0x7d5c96?.[_0xf5d224(0xee)],'sqlName':_0x573cf3[_0xf5d224(0xec)],'sqlConfig':_0x573cf3['sqlConfig']??undefined,'mode':_0x2da00f};}export function cloneSqlLockData(_0xe49dcf){const _0x1fd596=a244_0x44eda7;return{'apps':Object[_0x1fd596(0xd9)](Object['entries'](_0xe49dcf[_0x1fd596(0xe7)])[_0x1fd596(0xd5)](([_0x52ef4a,_0x294fdc])=>[_0x52ef4a,{'sqlRoot':_0x294fdc[_0x1fd596(0xe9)],'lastSync':_0x294fdc['lastSync'],'sqls':{..._0x294fdc['sqls']}}]))};}export function ensureRemoteSqlContent(_0x474c68){const _0x52feb3=a244_0x44eda7;return _0x474c68[_0x52feb3(0xd8)]??'';}export function buildLocalSqlFileContent(_0x54b261,_0x328968,_0x52efdc){const _0x55cf58=a244_0x44eda7,_0x53c03e=_0x52efdc?.['mode']??detectSqlMode(_0x328968),_0x32530a=stripLocalSqlMetadata(_0x328968,_0x53c03e)[_0x55cf58(0xf8)](),_0x417173=buildMetadataHeaderLines({'sqlCode':_0x54b261['sqlCode'],'sqlName':_0x54b261[_0x55cf58(0xec)],'dbId':_0x54b261[_0x55cf58(0xd2)],'dbName':_0x52efdc?.[_0x55cf58(0xee)],'mode':_0x53c03e,'syncedAt':_0x52efdc?.[_0x55cf58(0xd7)],'description':_0x52efdc?.[_0x55cf58(0xe0)]},_0x53c03e),_0x47d4b2=_0x53c03e===_0x55cf58(0xcd)?splitXmlDeclaration(_0x32530a):{'body':_0x32530a},_0x494edb=[..._0x47d4b2['declaration']?[_0x47d4b2[_0x55cf58(0xdf)]]:[],..._0x417173,'',_0x47d4b2[_0x55cf58(0xf2)][_0x55cf58(0xeb)]()],_0x438fda=_0x494edb[_0x55cf58(0xf3)]('\x0a');return _0x438fda['endsWith']('\x0a')?_0x438fda:_0x438fda+'\x0a';}export function stripLocalSqlMetadata(_0x4d11ee,_0x58d243){const _0xd78e6b=a244_0x44eda7;if(_0x58d243===_0xd78e6b(0xcd)){const {declaration:_0x594749,body:_0x421a7d}=splitXmlDeclaration(_0x4d11ee[_0xd78e6b(0xef)](/\r\n/g,'\x0a')),_0x1e9319=stripLeadingMetadataLines(_0x421a7d,/^\s*<!--\s*@lovrabet\./);return _0x594749?''+_0x594749+(_0x1e9319?'\x0a'+_0x1e9319:''):_0x1e9319;}return stripLeadingMetadataLines(_0x4d11ee[_0xd78e6b(0xef)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x53bcd3,_0x280211){const _0x425e0d=a244_0x44eda7;if(_0x280211?.[_0x425e0d(0xd0)])return _0x280211[_0x425e0d(0xd0)];return detectSqlMode(_0x53bcd3);}export function resolveSqlFileName(_0x5673a8,_0x448164,_0x1407ce){const _0x21a43c=a244_0x44eda7;if(_0x1407ce?.[_0x21a43c(0xd6)])return _0x1407ce['path'];if(_0x1407ce?.[_0x21a43c(0xec)]||_0x1407ce?.[_0x21a43c(0xee)])return buildSqlRelativePath(_0x5673a8,_0x1407ce?.[_0x21a43c(0xec)],_0x1407ce?.[_0x21a43c(0xee)],resolveSqlMode(_0x448164,_0x1407ce),_0x1407ce?.[_0x21a43c(0xd2)]);return buildDefaultSqlFileName(_0x5673a8,resolveSqlMode(_0x448164,_0x1407ce));}export function resolveSqlLocalDir(_0x33a353,_0x4183db){return join(_0x33a353,SQL_LOCAL_REL_DIR,_0x4183db);}function a244_0x51c9(_0x3ca186,_0x137885){_0x3ca186=_0x3ca186-0xcd;const _0x4d7884=a244_0x4d78();let _0x51c9d6=_0x4d7884[_0x3ca186];return _0x51c9d6;}export async function confirmForceOverwrite(_0x11db82){const _0x48eabd=a244_0x44eda7,_0x2ddd35=createInterface({'input':process[_0x48eabd(0xdd)],'output':process[_0x48eabd(0xed)]}),_0x1434d5=await new Promise(_0x58c8b2=>{const _0x36279b=_0x48eabd;_0x2ddd35[_0x36279b(0xe5)](_0x11db82+_0x36279b(0xe8),_0x58c8b2);});return _0x2ddd35['close'](),['y',_0x48eabd(0xf6)][_0x48eabd(0xf5)](_0x1434d5[_0x48eabd(0xf8)]()[_0x48eabd(0xdb)]());}export function findSqlLockScope(_0x109281,_0x1e976d){return _0x109281['apps'][_0x1e976d];}function buildMetadataHeaderLines(_0x303b59,_0x13e75e){const _0x2bc43f=a244_0x44eda7,_0x455e50=[[_0x2bc43f(0xde),_0x303b59[_0x2bc43f(0xde)]],[_0x2bc43f(0xec),_0x303b59['sqlName']],[_0x2bc43f(0xd2),_0x303b59[_0x2bc43f(0xd2)]],['dbName',_0x303b59[_0x2bc43f(0xee)]],[_0x2bc43f(0xd0),_0x303b59['mode']],[_0x2bc43f(0xd7),_0x303b59[_0x2bc43f(0xd7)]],['description',_0x303b59[_0x2bc43f(0xe0)]]];if(_0x13e75e===_0x2bc43f(0xcd))return _0x455e50[_0x2bc43f(0xce)](([,_0x77b42a])=>_0x77b42a!==undefined&&_0x77b42a!==null&&String(_0x77b42a)[_0x2bc43f(0xf8)]()!=='')['map'](([_0x3b753b,_0x58157c])=>_0x2bc43f(0xdc)+_0x3b753b+':\x20'+String(_0x58157c)+'\x20-->');return _0x455e50[_0x2bc43f(0xce)](([,_0x5372e5])=>_0x5372e5!==undefined&&_0x5372e5!==null&&String(_0x5372e5)[_0x2bc43f(0xf8)]()!=='')[_0x2bc43f(0xd5)](([_0x14baea,_0x10e928])=>_0x2bc43f(0xfa)+_0x14baea+':\x20'+String(_0x10e928));}function a244_0x4d78(){const _0x35d8dc=['6vBoYAE','toLowerCase','<!--\x20@lovrabet.','stdin','sqlCode','declaration','description','exec','25040OwjGkp','test','670804yHQFao','question','.rabetbase/sql','apps','\x20[y/N]\x20','sqlRoot','1522688KRquLd','trimStart','sqlName','stderr','dbName','replace','315VJYUwB','split','body','join','version','includes','yes','2100870TJfOjJ','trim','4104436ifINEI','--\x20@lovrabet.','slice','mybatisXml','filter','12gsHLNt','mode','10195970JcmdlW','dbId','1202840eqbQAn','length','map','path','syncedAt','sqlContent','fromEntries'];a244_0x4d78=function(){return _0x35d8dc;};return a244_0x4d78();}function splitXmlDeclaration(_0x2e3acb){const _0xa707d3=a244_0x44eda7,_0xd2f5e6=_0x2e3acb['trimStart'](),_0x5a6685=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0xa707d3(0xe1)](_0xd2f5e6);if(!_0x5a6685)return{'body':_0x2e3acb};return{'declaration':_0x5a6685[0x0],'body':_0xd2f5e6[_0xa707d3(0xfb)](_0x5a6685[0x0][_0xa707d3(0xd4)])};}function stripLeadingMetadataLines(_0x458312,_0x19f25e){const _0x33fb3d=a244_0x44eda7,_0xd26b42=_0x458312[_0x33fb3d(0xf1)]('\x0a');let _0x4a7df3=0x0;while(_0x4a7df3<_0xd26b42['length']){const _0x168660=_0xd26b42[_0x4a7df3]??'';if(_0x19f25e[_0x33fb3d(0xe3)](_0x168660)||_0x168660[_0x33fb3d(0xf8)]()===''){_0x4a7df3++;continue;}break;}return _0xd26b42[_0x33fb3d(0xfb)](_0x4a7df3)[_0x33fb3d(0xf3)]('\x0a')[_0x33fb3d(0xeb)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a245_0x3f756b=a245_0x1411;(function(_0x4932b4,_0x5dc354){const _0x52ab8a=a245_0x1411,_0x5af587=_0x4932b4();while(!![]){try{const _0x27558b=parseInt(_0x52ab8a(0x13f))/0x1+parseInt(_0x52ab8a(0x13d))/0x2*(parseInt(_0x52ab8a(0x13e))/0x3)+parseInt(_0x52ab8a(0x140))/0x4*(parseInt(_0x52ab8a(0x13a))/0x5)+-parseInt(_0x52ab8a(0x136))/0x6+-parseInt(_0x52ab8a(0x149))/0x7+parseInt(_0x52ab8a(0x14c))/0x8*(parseInt(_0x52ab8a(0x141))/0x9)+-parseInt(_0x52ab8a(0x14e))/0xa;if(_0x27558b===_0x5dc354)break;else _0x5af587['push'](_0x5af587['shift']());}catch(_0x569c7d){_0x5af587['push'](_0x5af587['shift']());}}}(a245_0xf312,0xbe473));import{listSqlQueries}from'../../core/api-client.js';function a245_0x1411(_0x5d0fc3,_0x58b4d8){_0x5d0fc3=_0x5d0fc3-0x12e;const _0xf31208=a245_0xf312();let _0x1411f1=_0xf31208[_0x5d0fc3];return _0x1411f1;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a245_0xf312(){const _0x48c7a7=['bool','remote','7037093AkhBeF','lockFilePath','\x20added,\x20','88CVlQSM','keys','10447830SdzzEs','tableData','\x20remote-only','\x20missing,\x20','map','totalCount','appCode','sql','filePath','boolean','relativePath','\x20unchanged','status','sqlName','6493380OAMXfG','length','lockKey','All\x20SQL\x20queries\x20are\x20in\x20sync.','135FVQUYC','has','sqlCode','1525642XYXwEi','3AoHaMb','1125584IxbgZA','78972jKqjaa','1219275PzIfFj','\x20modified,\x20','push','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','sqls','sqlRoot'];a245_0xf312=function(){return _0x48c7a7;};return a245_0xf312();}async function fetchAllSqlCodes(_0x1a6ff4){const _0x1960f9=a245_0x1411,_0x1c184d=[];let _0x492a20=0x1;while(!![]){const _0x701f0c=await listSqlQueries(_0x1a6ff4,{'currentPage':_0x492a20,'pageSize':PAGE_SIZE}),_0x136ace=_0x701f0c[_0x1960f9(0x14f)]??[];_0x1c184d['push'](..._0x136ace[_0x1960f9(0x152)](_0x3b5067=>_0x3b5067[_0x1960f9(0x13c)]));if(_0x136ace[_0x1960f9(0x137)]===0x0)break;const _0x4d28d9=_0x701f0c['paging']?.[_0x1960f9(0x153)];if(_0x4d28d9!=null?_0x1c184d[_0x1960f9(0x137)]>=_0x4d28d9:_0x136ace['length']<PAGE_SIZE)break;_0x492a20++;}return _0x1c184d;}export const sqlStatus={'service':a245_0x3f756b(0x12f),'command':a245_0x3f756b(0x134),'description':a245_0x3f756b(0x144),'risk':'read','flags':[{'name':a245_0x3f756b(0x148),'type':a245_0x3f756b(0x131),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0xead968){const _0x5e6178=a245_0x3f756b,_0xfff353=loadSqlProjectConfig(_0xead968['appCode']),_0x42ba03=await readSqlLockFile(_0xfff353[_0x5e6178(0x14a)]),{appLock:_0x16a5d1}=ensureSqlLockScope(_0x42ba03??createEmptySqlLock(),_0xfff353[_0x5e6178(0x12e)],_0xfff353[_0x5e6178(0x146)],_0x5e6178(0x134)),_0x452482=await scanLocalSqlQueries(_0xfff353),_0x1437a0=[],_0x6d3002=[],_0x5b1075=[],_0x745951=[],_0x2da391=new Set(_0x452482[_0x5e6178(0x152)](_0x46bbbd=>_0x46bbbd[_0x5e6178(0x138)]));for(const _0x36a635 of _0x452482){const _0x29d9f5=await computeSqlFileHash(_0x36a635[_0x5e6178(0x130)]),_0x344940=_0x16a5d1[_0x5e6178(0x145)][_0x36a635[_0x5e6178(0x138)]],_0x53b500=!!_0x344940&&_0x344940['path']!==_0x36a635[_0x5e6178(0x132)],_0x7a4678=!!_0x344940&&!!_0x36a635[_0x5e6178(0x135)]&&_0x344940[_0x5e6178(0x135)]!==_0x36a635[_0x5e6178(0x135)];if(!_0x344940)_0x1437a0[_0x5e6178(0x143)](_0x36a635[_0x5e6178(0x138)]);else _0x344940['hash']!==_0x29d9f5||_0x53b500||_0x7a4678?_0x6d3002[_0x5e6178(0x143)](_0x36a635[_0x5e6178(0x138)]):_0x5b1075[_0x5e6178(0x143)](_0x36a635['lockKey']);}for(const _0xb71263 of Object[_0x5e6178(0x14d)](_0x16a5d1[_0x5e6178(0x145)])){!_0x2da391[_0x5e6178(0x13b)](_0xb71263)&&_0x745951['push'](_0xb71263);}const _0x4397ec=[];if(_0xead968[_0x5e6178(0x147)](_0x5e6178(0x148))){const _0x4e6662=await fetchAllSqlCodes(_0xead968[_0x5e6178(0x12e)]);for(const _0x1524a9 of _0x4e6662){!_0x2da391[_0x5e6178(0x13b)](_0x1524a9)&&!_0x16a5d1[_0x5e6178(0x145)][_0x1524a9]&&_0x4397ec[_0x5e6178(0x143)](_0x1524a9);}}const _0x5e596f=_0x1437a0[_0x5e6178(0x137)]===0x0&&_0x6d3002[_0x5e6178(0x137)]===0x0&&_0x745951[_0x5e6178(0x137)]===0x0&&_0x4397ec['length']===0x0;return{'ok':!![],'data':{'added':_0x1437a0,'modified':_0x6d3002,'missing':_0x745951,'unchanged':_0x5b1075,'remoteOnly':_0x4397ec},'message':_0x5e596f?_0x5e6178(0x139):_0x1437a0[_0x5e6178(0x137)]+_0x5e6178(0x14b)+_0x6d3002[_0x5e6178(0x137)]+_0x5e6178(0x142)+_0x745951[_0x5e6178(0x137)]+_0x5e6178(0x151)+_0x5b1075[_0x5e6178(0x137)]+_0x5e6178(0x133)+(_0x4397ec[_0x5e6178(0x137)]>0x0?',\x20'+_0x4397ec[_0x5e6178(0x137)]+_0x5e6178(0x150):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x26d124=a246_0x220d;(function(_0x16d02a,_0x3f03f9){const _0xc8a162=a246_0x220d,_0x1c8a1c=_0x16d02a();while(!![]){try{const _0x56876e=parseInt(_0xc8a162(0xf6))/0x1*(-parseInt(_0xc8a162(0xde))/0x2)+-parseInt(_0xc8a162(0xe5))/0x3+-parseInt(_0xc8a162(0x100))/0x4*(-parseInt(_0xc8a162(0x110))/0x5)+parseInt(_0xc8a162(0x106))/0x6+-parseInt(_0xc8a162(0xe4))/0x7+parseInt(_0xc8a162(0x111))/0x8+parseInt(_0xc8a162(0xf0))/0x9;if(_0x56876e===_0x3f03f9)break;else _0x1c8a1c['push'](_0x1c8a1c['shift']());}catch(_0x363a54){_0x1c8a1c['push'](_0x1c8a1c['shift']());}}}(a246_0x2a2c,0xb1cc9));function a246_0x220d(_0x44bbb1,_0x58691a){_0x44bbb1=_0x44bbb1-0xd5;const _0x2a2c4b=a246_0x2a2c();let _0x220d44=_0x2a2c4b[_0x44bbb1];return _0x220d44;}import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';function a246_0x2a2c(){const _0x398feb=['file','name','Provide\x20--file\x20or\x20--sql','Table\x20\x22','find','size','5kMdfGK','2213616sAtHMv','dbtableConfig','length','bool','read','isLockingRead','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','index_type','schemas','str','utf-8','string','dataset','message','indexes','unshift','cwd','32mZYFyZ','--check-indexes\x20requires\x20--schemas.','from','type','flagMissing','check-indexes','1401638xMActr','2212251FLVHXs','\x22\x20not\x20found\x20in\x20any\x20dataset','columns','validate','appCode','isDangerous','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','map','SQL\x20schema\x20validation','get','schemaWarnings','164952DMDflS','trim','push','sql','isArray','pkField','87853dHeGZu','tables','filter','File\x20not\x20found:\x20','joinAudit','valid','index_columns','sqlType','indexName','toLowerCase','5818604dGINAO','reason','split','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','schema:','validation','7931298SWRXAX','boolean','primary','columnNames'];a246_0x2a2c=function(){return _0x398feb;};return a246_0x2a2c();}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a246_0x26d124(0xf3),'command':a246_0x26d124(0xe8),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a246_0x26d124(0x115),'flags':[{'name':a246_0x26d124(0x10a),'type':a246_0x26d124(0xd8),'description':a246_0x26d124(0xeb)},{'name':a246_0x26d124(0xf3),'type':'string','description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':'schemas','type':'string','description':a246_0x26d124(0x117)},{'name':a246_0x26d124(0xe3),'type':a246_0x26d124(0x107),'description':a246_0x26d124(0x103)}],async 'execute'(_0x4bc48d){const _0x445a5f=a246_0x26d124,_0x4bdc92=_0x4bc48d[_0x445a5f(0xd6)]('file'),_0x50bb79=_0x4bc48d[_0x445a5f(0xd6)](_0x445a5f(0xf3)),_0x535cb6=_0x4bc48d['str'](_0x445a5f(0xd5)),_0x5382cf=_0x4bc48d[_0x445a5f(0x114)](_0x445a5f(0xe3));if(!_0x4bdc92&&!_0x50bb79)throw CliErrors[_0x445a5f(0xe2)]('file',_0x445a5f(0x10c));if(_0x5382cf&&!_0x535cb6)throw CliErrors[_0x445a5f(0x105)](_0x445a5f(0xdf));let _0x1b2a86;if(_0x4bdc92){const _0x314bae=resolve(process[_0x445a5f(0xdd)](),_0x4bdc92);if(!existsSync(_0x314bae))throw CliErrors[_0x445a5f(0x105)](_0x445a5f(0xf9)+_0x314bae);_0x1b2a86=readFileSync(_0x314bae,_0x445a5f(0xd7));}else _0x1b2a86=_0x50bb79;const _0x1cb78b=validateSql(_0x1b2a86),_0x16a13c={'valid':_0x1cb78b[_0x445a5f(0xfb)],'sqlType':_0x1cb78b[_0x445a5f(0xfd)][_0x445a5f(0xe1)],'isSelectOnly':_0x1cb78b['sqlType']['isSelectOnly'],'isLockingRead':_0x1cb78b['sqlType'][_0x445a5f(0x116)]??![],'isDangerous':_0x1cb78b[_0x445a5f(0xfd)][_0x445a5f(0xea)],'tables':_0x1cb78b[_0x445a5f(0xf7)],'parameters':_0x1cb78b['parameters'],'message':_0x1cb78b[_0x445a5f(0xda)]};_0x1cb78b[_0x445a5f(0xfd)][_0x445a5f(0x101)]&&(_0x16a13c[_0x445a5f(0x101)]=_0x1cb78b[_0x445a5f(0xfd)][_0x445a5f(0x101)]);if(_0x535cb6&&_0x1cb78b[_0x445a5f(0xfb)]){const _0x9abd31=_0x535cb6[_0x445a5f(0x102)](',')[_0x445a5f(0xec)](_0xd36d01=>_0xd36d01[_0x445a5f(0xf1)]())[_0x445a5f(0xf8)](Boolean),_0xcce77=[],_0x81d7f5=[],_0x4b01ea=filterDbTableBackedDatasets(await listDatasets(_0x4bc48d[_0x445a5f(0xe9)])),_0x340afe=new Map(_0x4b01ea[_0x445a5f(0xec)](_0x443e46=>[_0x443e46[_0x445a5f(0x112)]?.['tableName']?.[_0x445a5f(0xff)](),_0x443e46]));for(const _0x329bde of _0x1cb78b[_0x445a5f(0xf7)]){const _0x37de6e=_0x340afe[_0x445a5f(0xee)](_0x329bde[_0x445a5f(0xff)]());!_0x37de6e&&_0xcce77[_0x445a5f(0xf2)](_0x445a5f(0x10d)+_0x329bde+_0x445a5f(0xe6));}for(const _0x3ed9c9 of _0x9abd31){let _0x4f38b8;try{_0x4f38b8=await getDatasetDetail(_0x3ed9c9);}catch{_0xcce77[_0x445a5f(0xf2)]('Dataset\x20\x22'+_0x3ed9c9+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x4f38b8,_0x445a5f(0xed));const _0x4cef93=Array['isArray'](_0x4f38b8['fields'])?_0x4f38b8['fields']:[],_0x5620c9=new Set(_0x4cef93[_0x445a5f(0xec)](_0x16ae66=>_0x16ae66[_0x445a5f(0x10b)]?.[_0x445a5f(0xff)]())),_0x59d64a=_0x4f38b8[_0x445a5f(0x112)]?.['tableName']||_0x4f38b8['tableName']||_0x3ed9c9;_0x16a13c[_0x445a5f(0x104)+_0x59d64a]={'code':_0x3ed9c9,'tableName':_0x59d64a,'fieldCount':_0x5620c9[_0x445a5f(0x10f)],'fields':Array[_0x445a5f(0xe0)](_0x5620c9)};if(_0x5382cf){const _0x27c74e=normalizeDatasetIndexes(_0x4f38b8);_0x81d7f5[_0x445a5f(0xf2)]({'tableName':_0x59d64a,..._0x27c74e});}}_0xcce77[_0x445a5f(0x113)]>0x0&&(_0x16a13c[_0x445a5f(0xef)]=_0xcce77),_0x5382cf&&(_0x16a13c[_0x445a5f(0xfa)]=auditSqlJoinIndexes(_0x1b2a86,_0x81d7f5));}return{'ok':_0x1cb78b[_0x445a5f(0xfb)],'data':_0x16a13c,'message':_0x1cb78b['message']};}};function normalizeDatasetIndexes(_0x4a835d){const _0x85fb6f=a246_0x26d124,_0x2f93ed=Array[_0x85fb6f(0xf4)](_0x4a835d?.[_0x85fb6f(0xd9)]?.[_0x85fb6f(0xdb)])?_0x4a835d[_0x85fb6f(0xd9)]['indexes']:Array[_0x85fb6f(0xf4)](_0x4a835d?.[_0x85fb6f(0xdb)])?_0x4a835d[_0x85fb6f(0xdb)]:[],_0x3c4d52=_0x2f93ed['flatMap'](_0x4767b9=>{const _0x36e5ca=_0x85fb6f,_0x5b0eca=Array[_0x36e5ca(0xf4)](_0x4767b9?.[_0x36e5ca(0xfc)])?_0x4767b9[_0x36e5ca(0xfc)]:Array[_0x36e5ca(0xf4)](_0x4767b9?.[_0x36e5ca(0x109)])?_0x4767b9[_0x36e5ca(0x109)]:Array['isArray'](_0x4767b9?.[_0x36e5ca(0xe7)])?_0x4767b9[_0x36e5ca(0xe7)]:[],_0x8a12ba=_0x5b0eca[_0x36e5ca(0xf8)](_0x167c6b=>typeof _0x167c6b===_0x36e5ca(0xd8))[_0x36e5ca(0xec)](_0x3a8ab5=>_0x3a8ab5[_0x36e5ca(0xf1)]())[_0x36e5ca(0xf8)](Boolean);if(_0x8a12ba[_0x36e5ca(0x113)]===0x0)return[];const _0xa87c43=[_0x4767b9?.[_0x36e5ca(0xfe)],_0x4767b9?.['index_name'],_0x4767b9?.[_0x36e5ca(0x10b)]][_0x36e5ca(0x10e)](_0x29ea84=>typeof _0x29ea84===_0x36e5ca(0xd8)&&_0x29ea84[_0x36e5ca(0xf1)]()),_0x404040=[_0x4767b9?.[_0x36e5ca(0x118)],_0x4767b9?.[_0x36e5ca(0xe1)]][_0x36e5ca(0x10e)](_0x5649f1=>typeof _0x5649f1==='string'&&_0x5649f1[_0x36e5ca(0xf1)]());return[{..._0xa87c43?{'name':_0xa87c43[_0x36e5ca(0xf1)]()}:{},..._0x404040?{'type':_0x404040[_0x36e5ca(0xf1)]()}:{},'columns':_0x8a12ba}];}),_0x2b9677=[..._0x3c4d52],_0x4491f0=typeof _0x4a835d?.[_0x85fb6f(0x112)]?.[_0x85fb6f(0xf5)]===_0x85fb6f(0xd8)?_0x4a835d[_0x85fb6f(0x112)][_0x85fb6f(0xf5)][_0x85fb6f(0x102)](',')[_0x85fb6f(0xec)](_0x495815=>_0x495815['trim']())[_0x85fb6f(0xf8)](Boolean):[];return _0x4491f0[_0x85fb6f(0x113)]>0x0&&_0x2b9677[_0x85fb6f(0xdc)]({'type':_0x85fb6f(0x108),'columns':_0x4491f0}),{'indexes':_0x2b9677,'metadataAvailable':_0x3c4d52[_0x85fb6f(0x113)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a247_0x5b23(){const _0x3bee8e=['140348KfSMGm','6gngxYb','2387735uaovTp','3851370uiKyOl','3080872mRzlux','8bFwlxT','2pDaYfs','895235spSQqg','418986dwWfQR','135070VjOjgt','341DjcutL'];a247_0x5b23=function(){return _0x3bee8e;};return a247_0x5b23();}(function(_0x2824d5,_0x1dbc3b){const _0x132536=a247_0x164e,_0x3976e3=_0x2824d5();while(!![]){try{const _0x4d646b=parseInt(_0x132536(0x1bc))/0x1*(-parseInt(_0x132536(0x1b6))/0x2)+-parseInt(_0x132536(0x1be))/0x3*(parseInt(_0x132536(0x1bb))/0x4)+parseInt(_0x132536(0x1bd))/0x5*(-parseInt(_0x132536(0x1b7))/0x6)+-parseInt(_0x132536(0x1b8))/0x7+parseInt(_0x132536(0x1ba))/0x8+parseInt(_0x132536(0x1b9))/0x9+-parseInt(_0x132536(0x1bf))/0xa*(-parseInt(_0x132536(0x1b5))/0xb);if(_0x4d646b===_0x1dbc3b)break;else _0x3976e3['push'](_0x3976e3['shift']());}catch(_0x5db2a0){_0x3976e3['push'](_0x3976e3['shift']());}}}(a247_0x5b23,0x4745c));function a247_0x164e(_0x48f4f7,_0x3eb6c0){_0x48f4f7=_0x48f4f7-0x1b5;const _0x5b23c5=a247_0x5b23();let _0x164e58=_0x5b23c5[_0x48f4f7];return _0x164e58;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a248_0x305ae9=a248_0x3fb0;(function(_0x2c54a9,_0x2a2537){const _0x52858e=a248_0x3fb0,_0x433138=_0x2c54a9();while(!![]){try{const _0x1a90ec=-parseInt(_0x52858e(0xc0))/0x1*(-parseInt(_0x52858e(0xb8))/0x2)+parseInt(_0x52858e(0xbf))/0x3+parseInt(_0x52858e(0xc7))/0x4+parseInt(_0x52858e(0xc6))/0x5*(-parseInt(_0x52858e(0xc8))/0x6)+parseInt(_0x52858e(0xc2))/0x7+-parseInt(_0x52858e(0xc5))/0x8+-parseInt(_0x52858e(0xb9))/0x9*(parseInt(_0x52858e(0xb3))/0xa);if(_0x1a90ec===_0x2a2537)break;else _0x433138['push'](_0x433138['shift']());}catch(_0x5c00fc){_0x433138['push'](_0x433138['shift']());}}}(a248_0x3aad,0x53718));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a248_0x3fb0(_0x3f234a,_0x232c06){_0x3f234a=_0x3f234a-0xb0;const _0x3aad3e=a248_0x3aad();let _0x3fb0ce=_0x3aad3e[_0x3f234a];return _0x3fb0ce;}import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a248_0x3aad(){const _0x12649c=['3217858JocnHm','status','taskId','2922328kEZIMx','65avoSik','1697012EkJEbf','134898nfSjum','cookie','trim','read','task','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','1580CwPwdn','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','task-id','isTerminal','str','2tjOlBc','3258XMwIph','compress','string','appCode','apiError',',\x20received\x20','228018BdoeUR','96597qSAZOL','flagMissing'];a248_0x3aad=function(){return _0x12649c;};return a248_0x3aad();}export const taskStatus={'service':a248_0x305ae9(0xb1),'command':a248_0x305ae9(0xc3),'description':a248_0x305ae9(0xb4),'risk':a248_0x305ae9(0xb0),'defaultOutputFormat':a248_0x305ae9(0xba),'structuredErrors':!![],'flags':[{'name':a248_0x305ae9(0xb5),'type':a248_0x305ae9(0xbb),'required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3182ee){const _0x304893=a248_0x305ae9;if(!_0x3182ee[_0x304893(0xb7)]('task-id')[_0x304893(0xca)]())throw CliErrors[_0x304893(0xc1)]('task-id');},async 'execute'(_0x2001db){const _0x2a8607=a248_0x305ae9,_0xbdd062=_0x2001db[_0x2a8607(0xb7)](_0x2a8607(0xb5))[_0x2a8607(0xca)](),_0x45a313=normalizeAsyncTask(await getAsyncTaskStatus(_0xbdd062,_0x2001db[_0x2a8607(0xbc)],_0x2001db[_0x2a8607(0xc9)]));if(_0x45a313[_0x2a8607(0xc4)]!==_0xbdd062)throw CliErrors[_0x2a8607(0xbd)](_0x2a8607(0xb2)+_0xbdd062+_0x2a8607(0xbe)+_0x45a313['taskId']+'.');const _0x9fdd81=buildAsyncTaskStatusCommand(_0x45a313[_0x2a8607(0xc4)],_0x2001db[_0x2a8607(0xbc)]);return{'ok':!![],'message':asyncTaskMessage(_0x45a313),'data':{'appCode':_0x2001db[_0x2a8607(0xbc)],..._0x45a313,'query':_0x45a313[_0x2a8607(0xb6)]?null:{'command':_0x9fdd81}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x130df0,_0x1e5081){const _0xdb6615=a249_0x40d8,_0x4a64f1=_0x130df0();while(!![]){try{const _0x1a200a=-parseInt(_0xdb6615(0x171))/0x1*(parseInt(_0xdb6615(0x16f))/0x2)+parseInt(_0xdb6615(0x16d))/0x3*(-parseInt(_0xdb6615(0x175))/0x4)+-parseInt(_0xdb6615(0x172))/0x5*(parseInt(_0xdb6615(0x177))/0x6)+parseInt(_0xdb6615(0x173))/0x7+-parseInt(_0xdb6615(0x176))/0x8*(parseInt(_0xdb6615(0x16e))/0x9)+-parseInt(_0xdb6615(0x174))/0xa+parseInt(_0xdb6615(0x170))/0xb;if(_0x1a200a===_0x1e5081)break;else _0x4a64f1['push'](_0x4a64f1['shift']());}catch(_0x11f7be){_0x4a64f1['push'](_0x4a64f1['shift']());}}}(a249_0x160a,0x5afdc));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a249_0x40d8(_0x432019,_0x5481db){_0x432019=_0x432019-0x16d;const _0x160ae3=a249_0x160a();let _0x40d83d=_0x160ae3[_0x432019];return _0x40d83d;}function a249_0x160a(){const _0x14b057=['405167sBVlAI','3065780DLcBIM','1147524bZNvJs','632roEZbu','1614ZDrgUe','6iAeHWo','11007wNEVwd','81802WBugXi','14686078NfeucB','1GJWryv','45FgxVKf'];a249_0x160a=function(){return _0x14b057;};return a249_0x160a();}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x290a0b=a250_0x1c57;(function(_0x29e25e,_0x4f610d){const _0x51514b=a250_0x1c57,_0x24d3d7=_0x29e25e();while(!![]){try{const _0x48165f=parseInt(_0x51514b(0x118))/0x1*(-parseInt(_0x51514b(0x113))/0x2)+-parseInt(_0x51514b(0x122))/0x3*(parseInt(_0x51514b(0x11d))/0x4)+-parseInt(_0x51514b(0x112))/0x5*(parseInt(_0x51514b(0x10a))/0x6)+-parseInt(_0x51514b(0x10c))/0x7*(parseInt(_0x51514b(0x11a))/0x8)+-parseInt(_0x51514b(0x11c))/0x9+-parseInt(_0x51514b(0x11e))/0xa+parseInt(_0x51514b(0x10b))/0xb;if(_0x48165f===_0x4f610d)break;else _0x24d3d7['push'](_0x24d3d7['shift']());}catch(_0x95a2cc){_0x24d3d7['push'](_0x24d3d7['shift']());}}}(a250_0x5cc3,0xcec52));function a250_0x5cc3(){const _0x402aff=['48415499DblTUt','55846oEvzEA','string','Pass\x20--tenant-code\x20<code>.','flagMissing','Exact\x20tenant\x20code','tenant-code','2305345YIspwH','6aKyAfL','Found\x20','\x20tenant\x20member(s)','tenant','read','504822ohHSuy','members-list','24IEtqLc','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','3803418plKfQA','10212QQtqtL','10124170JyTvyw','length','str','trim','141jFvSJb','6TymgmI'];a250_0x5cc3=function(){return _0x402aff;};return a250_0x5cc3();}import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a250_0x1c57(_0x5b7341,_0x2c8f8a){_0x5b7341=_0x5b7341-0x10a;const _0x5cc32d=a250_0x5cc3();let _0x1c57d9=_0x5cc32d[_0x5b7341];return _0x1c57d9;}import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a250_0x290a0b(0x116),'command':a250_0x290a0b(0x119),'description':a250_0x290a0b(0x11b),'risk':a250_0x290a0b(0x117),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'tenant-code','type':a250_0x290a0b(0x10d),'required':!![],'description':a250_0x290a0b(0x110)}],async 'validate'(_0x179a7d){const _0x58ca20=a250_0x290a0b;if(!_0x179a7d[_0x58ca20(0x120)]('tenant-code')[_0x58ca20(0x121)]())throw CliErrors[_0x58ca20(0x10f)]('tenant-code',_0x58ca20(0x10e));},async 'execute'(_0x15de53){const _0x25cfd4=a250_0x290a0b,_0x109b7e=_0x15de53[_0x25cfd4(0x120)](_0x25cfd4(0x111))[_0x25cfd4(0x121)](),_0x353744=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x109b7e,_0x353744);const _0x361325=projectTenantMembers(await listTenantDirectoryMembers(_0x109b7e));return{'ok':!![],'data':{'tenantCode':_0x109b7e,'items':_0x361325,'totalCount':_0x361325[_0x25cfd4(0x11f)]},'message':_0x25cfd4(0x114)+_0x361325[_0x25cfd4(0x11f)]+_0x25cfd4(0x115)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a251_0x49a5(_0x191abc,_0x51d8b9){_0x191abc=_0x191abc-0x183;const _0x110471=a251_0x1104();let _0x49a5e=_0x110471[_0x191abc];return _0x49a5e;}(function(_0x122dd8,_0x369428){const _0xd9cd63=a251_0x49a5,_0x13a0a3=_0x122dd8();while(!![]){try{const _0x464433=-parseInt(_0xd9cd63(0x18f))/0x1+parseInt(_0xd9cd63(0x18e))/0x2+parseInt(_0xd9cd63(0x188))/0x3+-parseInt(_0xd9cd63(0x18c))/0x4*(parseInt(_0xd9cd63(0x18d))/0x5)+parseInt(_0xd9cd63(0x191))/0x6*(parseInt(_0xd9cd63(0x195))/0x7)+parseInt(_0xd9cd63(0x198))/0x8*(parseInt(_0xd9cd63(0x192))/0x9)+-parseInt(_0xd9cd63(0x194))/0xa;if(_0x464433===_0x369428)break;else _0x13a0a3['push'](_0x13a0a3['shift']());}catch(_0x503103){_0x13a0a3['push'](_0x13a0a3['shift']());}}}(a251_0x1104,0xc5280));import{CliErrors}from'../../errors.js';function textOrNull(_0x583b35){const _0x19e0d8=_0x583b35?.['trim']();return _0x19e0d8?_0x19e0d8:null;}function a251_0x1104(){const _0x43db3a=['1720grwdQZ','8380pOeijQ','3160794ttPTcD','1279027jVVDOs','userId','5639898BLRbAp','387nLdCRF','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','9547200RalSJj','7kWLZZl','adminFlag','tenantCode','64608JtRhhb','username','Tenant\x20\x22','MEMBER','displayName','get','some','validation','2682993lClSat','role','ADMIN','status'];a251_0x1104=function(){return _0x43db3a;};return a251_0x1104();}export function projectTenantMembers(_0x75755c){const _0x3900e2=a251_0x49a5,_0x3b8f14=new Map();for(const _0x263cfc of _0x75755c){const _0x289fbe=Number(_0x263cfc['userId']);if(!Number['isFinite'](_0x289fbe)||_0x289fbe<=0x0)continue;const _0x12856e={'userId':_0x289fbe,'username':textOrNull(_0x263cfc['username']),'displayName':textOrNull(_0x263cfc['nickname']),'role':_0x263cfc[_0x3900e2(0x196)]===!![]?_0x3900e2(0x18a):_0x3900e2(0x183),'status':textOrNull(_0x263cfc[_0x3900e2(0x18b)])},_0x3ec98d=_0x3b8f14[_0x3900e2(0x185)](_0x289fbe);if(!_0x3ec98d){_0x3b8f14['set'](_0x289fbe,_0x12856e);continue;}_0x3ec98d[_0x3900e2(0x199)]??=_0x12856e[_0x3900e2(0x199)],_0x3ec98d[_0x3900e2(0x184)]??=_0x12856e[_0x3900e2(0x184)],_0x3ec98d[_0x3900e2(0x18b)]??=_0x12856e[_0x3900e2(0x18b)];if(_0x12856e[_0x3900e2(0x189)]===_0x3900e2(0x18a))_0x3ec98d[_0x3900e2(0x189)]=_0x3900e2(0x18a);}return[..._0x3b8f14['values']()]['sort']((_0x11fcdb,_0x29765d)=>_0x11fcdb['userId']-_0x29765d[_0x3900e2(0x190)]);}export function assertTenantAccessible(_0x546c5c,_0x5076b6){const _0x21e115=a251_0x49a5;if(_0x5076b6[_0x21e115(0x186)](_0x4de3c0=>_0x4de3c0[_0x21e115(0x197)]===_0x546c5c))return;throw CliErrors[_0x21e115(0x187)](_0x21e115(0x19a)+_0x546c5c+_0x21e115(0x193),'Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a252_0x1659(){const _0x101957=['70630APXlgW','1027904TZZyWK','208976AcZYvb','dingding-sandbox-bind','dingtalk','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','trim','2651FxvywD','2595810mLjacd','1549395tICnOz','2RabCuv','write','4736123baMTfc','1992807fdBosM','8yOBBxn','string','POST','bind','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','apiError','6WyyrMF','ding-talk-user-id','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','--ding-talk-user-id\x20cannot\x20be\x20empty.','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.'];a252_0x1659=function(){return _0x101957;};return a252_0x1659();}const a252_0x1d45df=a252_0x4702;(function(_0x1e5424,_0x34d6a5){const _0x522db3=a252_0x4702,_0x3170da=_0x1e5424();while(!![]){try{const _0x2e026c=parseInt(_0x522db3(0x12a))/0x1*(-parseInt(_0x522db3(0x13b))/0x2)+parseInt(_0x522db3(0x134))/0x3*(-parseInt(_0x522db3(0x13a))/0x4)+parseInt(_0x522db3(0x143))/0x5+-parseInt(_0x522db3(0x142))/0x6+parseInt(_0x522db3(0x12c))/0x7*(-parseInt(_0x522db3(0x12e))/0x8)+parseInt(_0x522db3(0x12d))/0x9+parseInt(_0x522db3(0x139))/0xa*(parseInt(_0x522db3(0x141))/0xb);if(_0x2e026c===_0x34d6a5)break;else _0x3170da['push'](_0x3170da['shift']());}catch(_0x2444c7){_0x3170da['push'](_0x3170da['shift']());}}}(a252_0x1659,0x61fb5));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';function a252_0x4702(_0x136bd1,_0x303412){_0x136bd1=_0x136bd1-0x12a;const _0x16594e=a252_0x1659();let _0x470253=_0x16594e[_0x136bd1];return _0x470253;}import{CliErrors}from'../../errors.js';const PROVIDER_ID=a252_0x1d45df(0x13d),CURRENT_BINDING_WARNING=a252_0x1d45df(0x136);function readDingTalkUserId(_0x32f55d){const _0x33a42a=a252_0x1d45df,_0x29b9d4=_0x32f55d['str'](_0x33a42a(0x135))[_0x33a42a(0x140)]();if(!_0x29b9d4)throw CliErrors['validation'](_0x33a42a(0x137),'Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x29b9d4;}function buildBindingData(_0xbe2bc8,_0x4a12c2){const _0xd38b5d=a252_0x1d45df;return{'operation':_0xd38b5d(0x131),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xbe2bc8},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xbe2bc8,'bound':!![]},'dryRun':_0x4a12c2,'backend':{'method':_0xd38b5d(0x130),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':'user-account','command':a252_0x1d45df(0x13c),'description':a252_0x1d45df(0x13e),'risk':a252_0x1d45df(0x12b),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a252_0x1d45df(0x135),'type':a252_0x1d45df(0x12f),'required':!![],'description':a252_0x1d45df(0x132)}],async 'validate'(_0xe31f4a){readDingTalkUserId(_0xe31f4a);},async 'dryRun'(_0x196a8c){const _0x5101f2=readDingTalkUserId(_0x196a8c);return asDryRunResult(buildBindingData(_0x5101f2,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x2ec5bf){const _0x3586ec=a252_0x1d45df,_0x35861a=readDingTalkUserId(_0x2ec5bf),_0x112166=await bindDingTalkSandboxAccount(_0x35861a);if(_0x112166!==!![])throw CliErrors[_0x3586ec(0x133)](_0x3586ec(0x13f),'Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.');return{'ok':!![],'data':buildBindingData(_0x35861a,![]),'message':_0x3586ec(0x138)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a253_0x474552=a253_0x32a9;function a253_0x2602(){const _0x22d7c4=['write','Feishu\x20account\x20binding\x20was\x20not\x20confirmed.','apiError','Bound\x20current\x20user\x20to\x20Feishu\x20account.','POST','504104MnJepP','1384772QWpJDv','trim','user-account','feishu-bind','validation','63bsUVCu','test','165144hKGMHa','243274WCAiaI','--union-id\x20must\x20match\x20on_\x20followed\x20by\x20letters,\x20digits,\x20underscores,\x20or\x20hyphens.','455PuHDLS','Verify\x20the\x20current\x20binding\x20through\x20the\x20platform\x20before\x20explicitly\x20retrying;\x20do\x20not\x20automatically\x20retry.','string','20058MKZXJH','union-id','329334cPdYJv','396798ArdOip','feishu','str'];a253_0x2602=function(){return _0x22d7c4;};return a253_0x2602();}function a253_0x32a9(_0x2fb453,_0x2d5f71){_0x2fb453=_0x2fb453-0x183;const _0x2602e1=a253_0x2602();let _0x32a9df=_0x2602e1[_0x2fb453];return _0x32a9df;}(function(_0x48cbb3,_0x5da1bf){const _0x3fa5a9=a253_0x32a9,_0x198a64=_0x48cbb3();while(!![]){try{const _0x54528e=-parseInt(_0x3fa5a9(0x199))/0x1+-parseInt(_0x3fa5a9(0x188))/0x2+parseInt(_0x3fa5a9(0x187))/0x3+parseInt(_0x3fa5a9(0x191))/0x4+-parseInt(_0x3fa5a9(0x19b))/0x5*(parseInt(_0x3fa5a9(0x185))/0x6)+parseInt(_0x3fa5a9(0x198))/0x7+-parseInt(_0x3fa5a9(0x190))/0x8*(-parseInt(_0x3fa5a9(0x196))/0x9);if(_0x54528e===_0x5da1bf)break;else _0x198a64['push'](_0x198a64['shift']());}catch(_0x28a7bd){_0x198a64['push'](_0x198a64['shift']());}}}(a253_0x2602,0x2aab0));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_0x474552(0x189),CURRENT_BINDING_WARNING='The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.';function readUnionId(_0x3a2293){const _0x5d2db9=a253_0x474552,_0x5549ed=_0x3a2293[_0x5d2db9(0x18a)](_0x5d2db9(0x186))[_0x5d2db9(0x192)]();if(!/^on_[A-Za-z0-9_-]+$/[_0x5d2db9(0x197)](_0x5549ed))throw CliErrors[_0x5d2db9(0x195)](_0x5d2db9(0x19a),'Pass\x20a\x20Feishu\x20union\x20id\x20such\x20as\x20on_example_001.');return _0x5549ed;}function buildBindingData(_0x5ef5cf,_0x2dd7cf){const _0x306bb6=a253_0x474552;return{'operation':'bind','selector':{'providerId':PROVIDER_ID,'unionId':_0x5ef5cf},'before':null,'after':{'providerId':PROVIDER_ID,'unionId':_0x5ef5cf,'bound':!![]},'dryRun':_0x2dd7cf,'backend':{'method':_0x306bb6(0x18f),'path':FEISHU_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const feishuBind={'service':a253_0x474552(0x193),'command':a253_0x474552(0x194),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20Feishu\x20account','risk':a253_0x474552(0x18b),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'union-id','type':a253_0x474552(0x184),'required':!![],'description':'Feishu\x20union_id\x20for\x20the\x20configured\x20Feishu\x20application\x20developer'}],async 'validate'(_0x38d3f3){readUnionId(_0x38d3f3);},async 'dryRun'(_0x1bfd03){const _0x1dde96=a253_0x474552,_0x52779e=readUnionId(_0x1bfd03);return asDryRunResult(buildBindingData(_0x52779e,!![]),{'method':_0x1dde96(0x18f),'url':FEISHU_BIND_PATH});},async 'execute'(_0x2ba165){const _0x469ff2=a253_0x474552,_0x125dc2=readUnionId(_0x2ba165),_0x4301a4=await bindFeishuAccount(_0x125dc2);if(_0x4301a4!==!![])throw CliErrors[_0x469ff2(0x18d)](_0x469ff2(0x18c),_0x469ff2(0x183));return{'ok':!![],'data':buildBindingData(_0x125dc2,![]),'message':_0x469ff2(0x18e)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a254_0x25fc(_0xec09e5,_0x3c8dc2){_0xec09e5=_0xec09e5-0x119;const _0x58bd63=a254_0x58bd();let _0x25fcb1=_0x58bd63[_0xec09e5];return _0x25fcb1;}(function(_0x83ebbc,_0x16deee){const _0x327c8a=a254_0x25fc,_0x46720c=_0x83ebbc();while(!![]){try{const _0x519f95=-parseInt(_0x327c8a(0x11c))/0x1*(-parseInt(_0x327c8a(0x11e))/0x2)+-parseInt(_0x327c8a(0x11d))/0x3+-parseInt(_0x327c8a(0x11b))/0x4+-parseInt(_0x327c8a(0x119))/0x5+parseInt(_0x327c8a(0x121))/0x6+parseInt(_0x327c8a(0x11f))/0x7*(-parseInt(_0x327c8a(0x11a))/0x8)+parseInt(_0x327c8a(0x120))/0x9;if(_0x519f95===_0x16deee)break;else _0x46720c['push'](_0x46720c['shift']());}catch(_0x1d12ee){_0x46720c['push'](_0x46720c['shift']());}}}(a254_0x58bd,0x9ddf6));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';import{feishuBind}from'../../commands/user-account/feishu-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind,feishuBind];function a254_0x58bd(){const _0x4ed55f=['1632609TxEVWm','2hsRctw','2160613MKJooG','10130211RGshLy','6987486UVmrYQ','2690665HlSneQ','24iPydtX','1189504AgkXzZ','662175WzlLFe'];a254_0x58bd=function(){return _0x4ed55f;};return a254_0x58bd();}
|