@lovrabet/rabetbase-cli 2.5.5-beta.2 → 2.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +3 -3
- package/skills/rabetbase/guides/independent-deployment.md +11 -1
- package/skills/rabetbase/references/rabetbase-config.md +16 -19
- package/skills/rabetbase/references/rabetbase-menu-visibility-update.md +5 -4
- package/skills/rabetbase/references/rabetbase-workspace.md +3 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a238_0x50053f=a238_0x4c35;(function(_0x3c26f6,_0xee7e4c){const _0x5931c7=a238_0x4c35,_0x3733d0=_0x3c26f6();while(!![]){try{const _0x4ab2b3=parseInt(_0x5931c7(0x1aa))/0x1*(-parseInt(_0x5931c7(0x1a8))/0x2)+-parseInt(_0x5931c7(0x1a6))/0x3*(-parseInt(_0x5931c7(0x1b0))/0x4)+-parseInt(_0x5931c7(0x1b2))/0x5+-parseInt(_0x5931c7(0x1b4))/0x6*(-parseInt(_0x5931c7(0x1ab))/0x7)+-parseInt(_0x5931c7(0x1b3))/0x8*(-parseInt(_0x5931c7(0x1b8))/0x9)+parseInt(_0x5931c7(0x1ad))/0xa*(-parseInt(_0x5931c7(0x1a7))/0xb)+-parseInt(_0x5931c7(0x1b6))/0xc*(-parseInt(_0x5931c7(0x1a9))/0xd);if(_0x4ab2b3===_0xee7e4c)break;else _0x3733d0['push'](_0x3733d0['shift']());}catch(_0x2592a4){_0x3733d0['push'](_0x3733d0['shift']());}}}(a238_0x42e0,0x315a9));function a238_0x4c35(_0x334342,_0x4557dc){_0x334342=_0x334342-0x1a2;const _0x42e054=a238_0x42e0();let _0x4c3524=_0x42e054[_0x334342];return _0x4c3524;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a238_0x50053f(0x1ac),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a238_0x50053f(0x1b5),'type':'boolean','description':a238_0x50053f(0x1a3)}],async 'execute'(_0x1ac25d){const _0x1c54ab=a238_0x50053f,_0x728a66=await getSqlQueryInfo(_0x1ac25d[_0x1c54ab(0x1af)],_0x1ac25d[_0x1c54ab(0x1b7)](_0x1c54ab(0x1b1))),_0x43c67f=_0x1ac25d[_0x1c54ab(0x1a2)]('verbose');if(_0x43c67f)return{'ok':!![],'data':_0x728a66};const _0x5b354b=_0x728a66[_0x1c54ab(0x1ae)]?await getDbName(_0x1ac25d['appCode'],_0x728a66[_0x1c54ab(0x1ae)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x728a66[_0x1c54ab(0x1a4)],'sqlName':_0x728a66['sqlName'],'db':_0x5b354b?_0x5b354b+'\x20('+_0x728a66[_0x1c54ab(0x1ae)]+')':_0x728a66[_0x1c54ab(0x1ae)]??'','description':_0x728a66['description']??'','sqlContent':_0x728a66[_0x1c54ab(0x1a5)]??''}};}};function a238_0x42e0(){const _0x10080b=['668MMeodI','sqlcode','1760120GWleMb','25432ffVVNB','564JNjktQ','verbose','995892ObjxEW','str','216WSoAZW','bool','Return\x20full\x20raw\x20SQL\x20query\x20object','sqlCode','sqlContent','117abhtrP','11xXbxYg','3612ThMxrb','117DyilZw','104HKIAEr','18795kDqQpH','detail','3401170qsUgRd','dbId','appCode'];a238_0x42e0=function(){return _0x10080b;};return a238_0x42e0();}
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a239_0x5240ba=a239_0x4735;(function(_0x1bcba3,_0x4aa00e){const _0x52fcda=a239_0x4735,_0x3d06c6=_0x1bcba3();while(!![]){try{const _0x52cb5d=-parseInt(_0x52fcda(0x129))/0x1+-parseInt(_0x52fcda(0x13f))/0x2*(parseInt(_0x52fcda(0x138))/0x3)+-parseInt(_0x52fcda(0x131))/0x4*(parseInt(_0x52fcda(0x134))/0x5)+-parseInt(_0x52fcda(0x12c))/0x6+-parseInt(_0x52fcda(0x137))/0x7+parseInt(_0x52fcda(0x12d))/0x8+parseInt(_0x52fcda(0x13b))/0x9;if(_0x52cb5d===_0x4aa00e)break;else _0x3d06c6['push'](_0x3d06c6['shift']());}catch(_0x556f63){_0x3d06c6['push'](_0x3d06c6['shift']());}}}(a239_0x2c0d,0xafc6e));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a239_0x4735(_0x204f5d,_0x4fc263){_0x204f5d=_0x204f5d-0x129;const _0x2c0df6=a239_0x2c0d();let _0x473598=_0x2c0df6[_0x204f5d];return _0x473598;}function a239_0x2c0d(){const _0x50129e=['length','5189640NReuod','8953744PvBEJI','now','execResult','SQL\x20execution\x20failed','28eaSGuH','isArray','appCode','702785aAisQb','read','execSuccess','9963989MXMDJm','768LCWYaT','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','str','38743470uSReeI','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','string','sqlcode','7280wEtnqy','params','499960OhWqsr','Returned\x20'];a239_0x2c0d=function(){return _0x50129e;};return a239_0x2c0d();}export const sqlExec={'service':'sql','command':'exec','description':a239_0x5240ba(0x13c),'risk':a239_0x5240ba(0x135),'flags':[SQLCODE_FLAG,{'name':a239_0x5240ba(0x140),'type':a239_0x5240ba(0x13d),'description':a239_0x5240ba(0x139)}],async 'execute'(_0x122f03){const _0x351abd=a239_0x5240ba,_0x481e9c=parseJsonParams(_0x122f03[_0x351abd(0x13a)](_0x351abd(0x140))),_0x5207ab=Date[_0x351abd(0x12e)](),_0x52e0b3=await executeSql(_0x122f03[_0x351abd(0x133)],_0x122f03[_0x351abd(0x13a)](_0x351abd(0x13e)),_0x481e9c),_0x2cac14=Date[_0x351abd(0x12e)]()-_0x5207ab,_0x497109=_0x52e0b3?.[_0x351abd(0x12f)]??_0x52e0b3,_0x18b740=_0x52e0b3?.[_0x351abd(0x136)]??!![];if(!_0x18b740)return{'ok':![],'data':{'error':_0x52e0b3?.['execError']||_0x351abd(0x130),'elapsed':_0x2cac14},'message':_0x351abd(0x130)};const _0x956451=Array[_0x351abd(0x132)](_0x497109)?_0x497109:[];return{'ok':!![],'data':{'rows':_0x956451,'rowCount':_0x956451[_0x351abd(0x12b)],'elapsed':_0x2cac14},'message':_0x351abd(0x12a)+_0x956451[_0x351abd(0x12b)]+'\x20row(s)\x20in\x20'+_0x2cac14+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5505d3,_0x40a904){const _0x169692=a240_0x1eeb,_0x976946=_0x5505d3();while(!![]){try{const _0xadf265=-parseInt(_0x169692(0x1c3))/0x1+-parseInt(_0x169692(0x1c9))/0x2*(-parseInt(_0x169692(0x1c6))/0x3)+parseInt(_0x169692(0x1c8))/0x4*(-parseInt(_0x169692(0x1c0))/0x5)+parseInt(_0x169692(0x1c2))/0x6*(parseInt(_0x169692(0x1ca))/0x7)+parseInt(_0x169692(0x1c7))/0x8*(parseInt(_0x169692(0x1c1))/0x9)+-parseInt(_0x169692(0x1c5))/0xa+parseInt(_0x169692(0x1cb))/0xb*(parseInt(_0x169692(0x1c4))/0xc);if(_0xadf265===_0x40a904)break;else _0x976946['push'](_0x976946['shift']());}catch(_0x20e477){_0x976946['push'](_0x976946['shift']());}}}(a240_0x4f30,0x5b4e7));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a240_0x1eeb(_0x56c908,_0x48b4a1){_0x56c908=_0x56c908-0x1c0;const _0x4f30f2=a240_0x4f30();let _0x1eeb2f=_0x4f30f2[_0x56c908];return _0x1eeb2f;}function a240_0x4f30(){const _0x101cb0=['10ayKjjW','144npnKcP','389442qVNkZY','508467TrLPjI','338124IfQBxG','4146540qrIvij','1443CUqgVl','298560fOcyKv','1490052eEBuee','686aokhwW','56jgxAlX','297DgVgwL'];a240_0x4f30=function(){return _0x101cb0;};return a240_0x4f30();}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
|
-
|
|
1
|
+
const a241_0x61354b=a241_0x7fcc;(function(_0x2f6401,_0x1aab35){const _0x5de4f7=a241_0x7fcc,_0xab1b1b=_0x2f6401();while(!![]){try{const _0x48ab02=parseInt(_0x5de4f7(0x1d8))/0x1+parseInt(_0x5de4f7(0x1d7))/0x2+parseInt(_0x5de4f7(0x1db))/0x3+-parseInt(_0x5de4f7(0x1c8))/0x4+parseInt(_0x5de4f7(0x1c7))/0x5*(-parseInt(_0x5de4f7(0x1e6))/0x6)+-parseInt(_0x5de4f7(0x1c5))/0x7*(-parseInt(_0x5de4f7(0x1e0))/0x8)+-parseInt(_0x5de4f7(0x1e2))/0x9*(parseInt(_0x5de4f7(0x1ca))/0xa);if(_0x48ab02===_0x1aab35)break;else _0xab1b1b['push'](_0xab1b1b['shift']());}catch(_0x199b8d){_0xab1b1b['push'](_0xab1b1b['shift']());}}}(a241_0x1a18,0xc7aee));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a241_0x7fcc(_0xbeb37a,_0x4e1aff){_0xbeb37a=_0xbeb37a-0x1c1;const _0x1a1886=a241_0x1a18();let _0x7fccb2=_0x1a1886[_0xbeb37a];return _0x7fccb2;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a241_0x61354b(0x1d3),'description':a241_0x61354b(0x1d4),'risk':a241_0x61354b(0x1d9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a241_0x61354b(0x1dc),'type':a241_0x61354b(0x1c9),'description':a241_0x61354b(0x1cb)},{'name':a241_0x61354b(0x1e3),'type':a241_0x61354b(0x1e8),'description':a241_0x61354b(0x1de),'default':0x1},{'name':a241_0x61354b(0x1c3),'type':a241_0x61354b(0x1e8),'description':a241_0x61354b(0x1cc)},{'name':a241_0x61354b(0x1e4),'type':a241_0x61354b(0x1d2),'description':a241_0x61354b(0x1e7)}],async 'execute'(_0x22131c){const _0x4882aa=a241_0x61354b,_0x53fcce=await listSqlQueries(_0x22131c[_0x4882aa(0x1e5)],{'sqlCode':_0x22131c[_0x4882aa(0x1c4)](_0x4882aa(0x1d1))||undefined,'sqlName':_0x22131c['str'](_0x4882aa(0x1dc))||undefined,'currentPage':_0x22131c['num'](_0x4882aa(0x1e3)),'pageSize':_0x22131c[_0x4882aa(0x1d6)](_0x4882aa(0x1c3),0x32)}),_0x2e4e5e=_0x22131c[_0x4882aa(0x1c6)](_0x4882aa(0x1e4)),_0x46eac7=_0x53fcce[_0x4882aa(0x1cf)]??[],_0x11d4c8=_0x53fcce['paging']?.[_0x4882aa(0x1dd)]??_0x46eac7['length'];let _0x3a6f93;return _0x2e4e5e?_0x3a6f93=_0x46eac7:_0x3a6f93=await Promise[_0x4882aa(0x1d0)](_0x46eac7[_0x4882aa(0x1c1)](async _0x5df3e6=>{const _0x2f5aba=_0x4882aa;let _0x4653d2;try{_0x4653d2=_0x5df3e6[_0x2f5aba(0x1cd)]?await getDbName(_0x22131c[_0x2f5aba(0x1e5)],_0x5df3e6[_0x2f5aba(0x1cd)]):undefined;}catch{}return{'sqlCode':_0x5df3e6[_0x2f5aba(0x1d5)],'sqlName':_0x5df3e6['sqlName'],'description':_0x5df3e6[_0x2f5aba(0x1df)]??'','db':_0x4653d2?_0x4653d2+'\x20('+_0x5df3e6[_0x2f5aba(0x1cd)]+')':_0x5df3e6['dbId']??''};})),{'ok':!![],'data':_0x3a6f93,'message':_0x46eac7[_0x4882aa(0x1ce)]===0x0?_0x4882aa(0x1e1):_0x4882aa(0x1da)+_0x46eac7[_0x4882aa(0x1ce)]+_0x4882aa(0x1c2)+_0x11d4c8+').'};}};function a241_0x1a18(){const _0x1e0361=['read','Found\x20','3699750kvKcwL','name','totalCount','Page\x20number','description','8kQWgOd','No\x20custom\x20SQL\x20queries\x20found.','2151GRcdZD','page','verbose','appCode','3786WHQhHS','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','number','map','\x20SQL\x20queries\x20(total:\x20','pagesize','str','5078675retwJn','bool','10220vQFXuu','823832FLnqTS','string','57170uHSHLP','Filter\x20by\x20SQL\x20name','Page\x20size','dbId','length','tableData','all','sqlcode','boolean','list','List\x20custom\x20SQL\x20queries','sqlCode','num','2195432aUhmAF','623496LeFpEN'];a241_0x1a18=function(){return _0x1e0361;};return a241_0x1a18();}
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a242_0x3c64f9=a242_0x3cd6;(function(_0x24f0d2,_0x37eb4a){const _0x17dda5=a242_0x3cd6,_0x734318=_0x24f0d2();while(!![]){try{const _0x4a3e16=-parseInt(_0x17dda5(0x136))/0x1*(parseInt(_0x17dda5(0x16b))/0x2)+parseInt(_0x17dda5(0x15c))/0x3+parseInt(_0x17dda5(0x131))/0x4+parseInt(_0x17dda5(0x172))/0x5*(-parseInt(_0x17dda5(0x154))/0x6)+parseInt(_0x17dda5(0x139))/0x7+-parseInt(_0x17dda5(0x16e))/0x8+parseInt(_0x17dda5(0x178))/0x9;if(_0x4a3e16===_0x37eb4a)break;else _0x734318['push'](_0x734318['shift']());}catch(_0x37ea8f){_0x734318['push'](_0x734318['shift']());}}}(a242_0x34a5,0x562bf));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(_0x1ebc2a,_0x410cab){const _0x3a02ea=a242_0x3cd6,_0x3facf9=[];let _0x5786c5=0x1;while(!![]){const _0x4004bd=await listSqlQueries(_0x1ebc2a,{'currentPage':_0x5786c5,'pageSize':PAGE_SIZE,'sqlCode':_0x410cab[_0x3a02ea(0x153)],'sqlName':_0x410cab[_0x3a02ea(0x143)]}),_0x58a0b2=_0x4004bd[_0x3a02ea(0x145)]??[];_0x3facf9['push'](..._0x58a0b2);if(_0x58a0b2['length']===0x0)break;const _0x491e47=_0x4004bd['paging']?.[_0x3a02ea(0x15d)];if(_0x491e47!=null?_0x3facf9[_0x3a02ea(0x140)]>=_0x491e47:_0x58a0b2[_0x3a02ea(0x140)]<PAGE_SIZE)break;_0x5786c5++;}return _0x3facf9;}async function ensureSqlContent(_0x44f976){const _0x49c512=a242_0x3cd6;if(_0x44f976[_0x49c512(0x13b)]!=null&&String(_0x44f976[_0x49c512(0x13b)])[_0x49c512(0x140)]>0x0)return _0x44f976;return getSqlQueryDetail(_0x44f976['sqlCode']);}export const sqlPull={'service':'sql','command':a242_0x3c64f9(0x160),'description':a242_0x3c64f9(0x159),'risk':a242_0x3c64f9(0x16d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':'string','description':a242_0x3c64f9(0x166)},{'name':a242_0x3c64f9(0x13c),'type':'boolean','description':a242_0x3c64f9(0x15a)}],async 'dryRun'(_0x2d8de5){const _0x98ceb2=a242_0x3c64f9,_0x90fd88=loadSqlProjectConfig(_0x2d8de5['appCode']),_0x4e49c0=await readSqlLockFile(_0x90fd88[_0x98ceb2(0x16f)]),{appLock:_0x7513db}=ensureSqlLockScope(_0x4e49c0??createEmptySqlLock(),_0x90fd88['appCode'],_0x90fd88[_0x98ceb2(0x144)],_0x98ceb2(0x160)),_0x5ed35f=await fetchAllSqlQueries(_0x2d8de5[_0x98ceb2(0x176)],{'sqlCode':_0x2d8de5[_0x98ceb2(0x164)](_0x98ceb2(0x161))||undefined,'sqlName':_0x2d8de5[_0x98ceb2(0x164)](_0x98ceb2(0x137))||undefined}),_0x5d15ed=[];for(const _0x4589b3 of _0x5ed35f){const _0x536249=await ensureSqlContent(_0x4589b3),_0x1efde2=ensureRemoteSqlContent(_0x536249),_0xfcbb3b=detectSqlMode(_0x1efde2),_0x1ec50d=_0x536249[_0x98ceb2(0x163)]?await getDbName(_0x2d8de5[_0x98ceb2(0x176)],Number(_0x536249['dbId']))['catch'](()=>undefined):undefined,_0xa76e51=buildLocalSqlFileContent({'sqlCode':_0x536249['sqlCode'],'sqlName':_0x536249[_0x98ceb2(0x143)],'dbId':_0x536249[_0x98ceb2(0x163)]},_0x1efde2,{'dbName':_0x1ec50d,'mode':_0xfcbb3b,'syncedAt':new Date()['toISOString'](),'description':_0x536249[_0x98ceb2(0x13f)]}),_0x2c129e=buildSqlLockEntry(_0x536249,_0x1efde2,'',{'dbName':_0x1ec50d}),_0x1f3ab7=resolveLocalSqlFilePath(_0x90fd88,_0x536249['sqlCode'],_0x2c129e);let _0x959266=_0x98ceb2(0x169),_0x497926;const _0x9ed55e=await findExistingSqlFiles(_0x90fd88,_0x1f3ab7,_0xfcbb3b,_0x7513db[_0x98ceb2(0x17a)][_0x536249[_0x98ceb2(0x153)]]);if(_0x9ed55e[_0x98ceb2(0x140)]>0x0){const _0x3cc953=await compareExistingSqlFiles(_0x9ed55e,_0xa76e51,_0xfcbb3b);if(_0x3cc953[_0x98ceb2(0x141)](({equivalent:_0x4a0b42})=>!_0x4a0b42))_0x959266=_0x98ceb2(0x14b),_0x497926=_0x98ceb2(0x16c);else _0x3cc953[_0x98ceb2(0x140)]===0x1&&_0x3cc953[0x0]?.[_0x98ceb2(0x156)][_0x98ceb2(0x14c)]&&(_0x959266=_0x98ceb2(0x167),_0x497926=_0x98ceb2(0x135));}_0x5d15ed['push']({'sqlCode':_0x536249[_0x98ceb2(0x153)],'sqlName':_0x536249[_0x98ceb2(0x143)],'filePath':_0x1f3ab7,'status':_0x959266,'reason':_0x497926});}return{'method':_0x98ceb2(0x170),'url':_0x98ceb2(0x13a),'body':{'appCode':_0x2d8de5[_0x98ceb2(0x176)],'sqlCode':_0x2d8de5['str'](_0x98ceb2(0x161))||null,'sqlName':_0x2d8de5['str']('name')||null,'files':_0x5d15ed},'description':_0x98ceb2(0x165)+_0x5d15ed[_0x98ceb2(0x140)]+_0x98ceb2(0x158)+_0x90fd88[_0x98ceb2(0x171)]};},async 'execute'(_0x58ffe5){const _0x56cf04=a242_0x3c64f9,_0x3bc10c=loadSqlProjectConfig(_0x58ffe5['appCode']),_0x14b7c9=await readSqlLockFile(_0x3bc10c[_0x56cf04(0x16f)]),{lockData:_0x2ab674,appLock:_0x4549a8}=ensureSqlLockScope(_0x14b7c9??createEmptySqlLock(),_0x3bc10c[_0x56cf04(0x176)],_0x3bc10c[_0x56cf04(0x144)],'pull'),_0x5156a6=_0x58ffe5[_0x56cf04(0x14d)](_0x56cf04(0x13c)),_0x375bba=await fetchAllSqlQueries(_0x58ffe5[_0x56cf04(0x176)],{'sqlCode':_0x58ffe5[_0x56cf04(0x164)]('sqlcode')||undefined,'sqlName':_0x58ffe5[_0x56cf04(0x164)]('name')||undefined});if(_0x375bba['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x56cf04(0x16a)};const _0x4dffc1=[],_0x2b10ad=[];for(const _0xc8a777 of _0x375bba){try{_0x4dffc1[_0x56cf04(0x13d)](await ensureSqlContent(_0xc8a777));}catch(_0x5078f9){_0x2b10ad[_0x56cf04(0x13d)]({'sqlCode':_0xc8a777[_0x56cf04(0x153)],'error':_0x5078f9 instanceof Error?_0x5078f9['message']:String(_0x5078f9)});}}if(_0x5156a6&&!_0x58ffe5[_0x56cf04(0x142)]){let _0x15c1a0=![];for(const _0x796168 of _0x4dffc1){const _0x2e3f34=detectSqlMode(ensureRemoteSqlContent(_0x796168)),_0x1570d0=_0x796168[_0x56cf04(0x163)]?await getDbName(_0x58ffe5['appCode'],Number(_0x796168[_0x56cf04(0x163)]))[_0x56cf04(0x15e)](()=>undefined):undefined,_0xe54abb=buildLocalSqlFileContent({'sqlCode':_0x796168['sqlCode'],'sqlName':_0x796168[_0x56cf04(0x143)],'dbId':_0x796168[_0x56cf04(0x163)]},ensureRemoteSqlContent(_0x796168),{'dbName':_0x1570d0,'mode':_0x2e3f34,'syncedAt':new Date()[_0x56cf04(0x175)](),'description':_0x796168[_0x56cf04(0x13f)]}),_0x461c40=resolveLocalSqlFilePath(_0x3bc10c,_0x796168[_0x56cf04(0x153)],buildSqlLockEntry(_0x796168,ensureRemoteSqlContent(_0x796168),'',{'dbName':_0x1570d0})),_0x542de7=await findExistingSqlFiles(_0x3bc10c,_0x461c40,_0x2e3f34,_0x4549a8[_0x56cf04(0x17a)][_0x796168[_0x56cf04(0x153)]]),_0x4d5eec=await compareExistingSqlFiles(_0x542de7,_0xe54abb,_0x2e3f34);if(_0x4d5eec['some'](({equivalent:_0xd51251})=>!_0xd51251)){_0x15c1a0=!![];break;}}if(_0x15c1a0){const _0x1fa696=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1fa696)throw CliErrors[_0x56cf04(0x147)]('Force\x20pull\x20cancelled.');}}const _0x2be726=cloneSqlLockData(_0x2ab674),_0x1b6975=_0x2be726[_0x56cf04(0x177)][_0x3bc10c[_0x56cf04(0x176)]],_0x423717=[],_0x33d1d7=[];for(const _0x4ad30b of _0x4dffc1){const _0x53e1b1=_0x1b6975['sqls'][_0x4ad30b[_0x56cf04(0x153)]],_0x5352a4=ensureRemoteSqlContent(_0x4ad30b),_0x47b78f=detectSqlMode(_0x5352a4),_0xdece23=_0x4ad30b['dbId']?await getDbName(_0x58ffe5[_0x56cf04(0x176)],Number(_0x4ad30b['dbId']))[_0x56cf04(0x15e)](()=>undefined):undefined,_0x4430b6=buildLocalSqlFileContent({'sqlCode':_0x4ad30b[_0x56cf04(0x153)],'sqlName':_0x4ad30b[_0x56cf04(0x143)],'dbId':_0x4ad30b[_0x56cf04(0x163)]},_0x5352a4,{'dbName':_0xdece23,'mode':_0x47b78f,'syncedAt':new Date()[_0x56cf04(0x175)](),'description':_0x4ad30b[_0x56cf04(0x13f)]}),_0x7085b8=buildSqlLockEntry(_0x4ad30b,_0x5352a4,computeSqlContentHash(_0x4430b6),{'dbName':_0xdece23}),_0x477fc4=_0x7085b8['path'],_0xaf5106=join(_0x3bc10c[_0x56cf04(0x171)],_0x477fc4);try{const _0x1dd8ad=await findExistingSqlFiles(_0x3bc10c,_0xaf5106,_0x47b78f,_0x53e1b1),_0x4988d5=await compareExistingSqlFiles(_0x1dd8ad,_0x4430b6,_0x47b78f);if(!_0x5156a6&&_0x4988d5[_0x56cf04(0x141)](({equivalent:_0x58a72a})=>!_0x58a72a)){_0x33d1d7[_0x56cf04(0x13d)]({'sqlCode':_0x4ad30b[_0x56cf04(0x153)],'reason':_0x56cf04(0x152)});continue;}const _0x8f0264=_0x4988d5[_0x56cf04(0x14f)](({file:_0x24cfdd})=>_0x24cfdd[_0x56cf04(0x14c)]),_0x3a35d8=_0x4988d5[_0x56cf04(0x14f)](({file:_0x55abef})=>!_0x55abef[_0x56cf04(0x14c)]);if(_0x8f0264?.['equivalent']&&!_0x3a35d8){_0x33d1d7[_0x56cf04(0x13d)]({'sqlCode':_0x4ad30b[_0x56cf04(0x153)],'reason':_0x56cf04(0x135)}),_0x1b6975[_0x56cf04(0x17a)][_0x4ad30b[_0x56cf04(0x153)]]={..._0x7085b8,'hash':computeSqlContentHash(_0x8f0264[_0x56cf04(0x15f)]),'path':_0x477fc4};continue;}!_0x8f0264?.[_0x56cf04(0x15b)]&&(await ensureParentDirectory(_0xaf5106),await writeFile(_0xaf5106,_0x4430b6,_0x56cf04(0x150))),_0x3a35d8&&await rm(_0x3a35d8[_0x56cf04(0x156)][_0x56cf04(0x162)],{'force':!![]}),_0x1b6975[_0x56cf04(0x17a)][_0x4ad30b[_0x56cf04(0x153)]]={..._0x7085b8,'hash':_0x8f0264?.[_0x56cf04(0x15b)]?computeSqlContentHash(_0x8f0264[_0x56cf04(0x15f)]):_0x7085b8[_0x56cf04(0x179)],'path':_0x477fc4},_0x423717['push']({'sqlCode':_0x4ad30b[_0x56cf04(0x153)],'filePath':_0xaf5106});}catch(_0x521365){_0x2b10ad[_0x56cf04(0x13d)]({'sqlCode':_0x4ad30b['sqlCode'],'error':_0x521365 instanceof Error?_0x521365['message']:String(_0x521365)});}}return _0x1b6975['lastSync']=new Date()[_0x56cf04(0x175)](),await writeSqlLockFile(_0x3bc10c[_0x56cf04(0x16f)],_0x2be726),{'ok':_0x2b10ad[_0x56cf04(0x140)]===0x0,'data':{'pulled':_0x423717,'skipped':_0x33d1d7,'failed':_0x2b10ad},'message':_0x56cf04(0x157)+_0x423717[_0x56cf04(0x140)]+_0x56cf04(0x146)+_0x33d1d7[_0x56cf04(0x140)]+'\x20skipped,\x20'+_0x2b10ad[_0x56cf04(0x140)]+_0x56cf04(0x132)};}};function a242_0x3cd6(_0x5b2da3,_0x2ec156){_0x5b2da3=_0x5b2da3-0x131;const _0x34a574=a242_0x34a5();let _0x3cd609=_0x34a574[_0x5b2da3];return _0x3cd609;}function isEquivalentPulledSqlFile(_0x4cf9f4,_0x463552,_0x563d7f,_0x1970b2){if(_0x563d7f!==_0x1970b2)return normalizePulledSqlBody(_0x4cf9f4,_0x563d7f)===normalizePulledSqlBody(_0x463552,_0x1970b2);return normalizePullComparableContent(_0x4cf9f4,_0x563d7f)===normalizePullComparableContent(_0x463552,_0x1970b2);}async function findExistingSqlFiles(_0x4966a8,_0x16ec5f,_0x5cf000,_0x47c114){const _0x19eb23=a242_0x3c64f9,_0x21be94=[];await fileExists(_0x16ec5f)&&_0x21be94[_0x19eb23(0x13d)]({'filePath':_0x16ec5f,'mode':_0x5cf000,'isCanonical':!![]});if(!_0x47c114?.[_0x19eb23(0x138)])return _0x21be94;const _0x2c639d=join(_0x4966a8[_0x19eb23(0x171)],_0x47c114[_0x19eb23(0x138)]);if(_0x2c639d===_0x16ec5f)return _0x21be94;return await fileExists(_0x2c639d)&&_0x21be94[_0x19eb23(0x13d)]({'filePath':_0x2c639d,'mode':_0x47c114[_0x19eb23(0x149)]??modeFromFilePath(_0x2c639d),'isCanonical':![]}),_0x21be94;}async function compareExistingSqlFiles(_0x184c49,_0x16f560,_0x5569b9){const _0x1398a8=a242_0x3c64f9;return Promise[_0x1398a8(0x155)](_0x184c49[_0x1398a8(0x14e)](async _0x454eb9=>{const _0x556be0=_0x1398a8,_0x5ab412=await readFile(_0x454eb9[_0x556be0(0x162)],_0x556be0(0x150));return{'file':_0x454eb9,'content':_0x5ab412,'equivalent':isEquivalentPulledSqlFile(_0x5ab412,_0x16f560,_0x454eb9[_0x556be0(0x149)],_0x5569b9)};}));}function modeFromFilePath(_0x289385){const _0x8c8258=a242_0x3c64f9;return _0x289385[_0x8c8258(0x134)]()[_0x8c8258(0x13e)]('.xml')?_0x8c8258(0x174):_0x8c8258(0x151);}function normalizePulledSqlBody(_0x221404,_0x388222){const _0x5bae1d=a242_0x3c64f9;return stripLocalSqlMetadata(_0x221404,_0x388222)[_0x5bae1d(0x173)](/\r\n/g,'\x0a')[_0x5bae1d(0x168)]();}function normalizePullComparableContent(_0x3a1c16,_0x11a129){const _0x43bf0f=a242_0x3c64f9,_0xfe6272=_0x3a1c16[_0x43bf0f(0x173)](/\r\n/g,'\x0a')[_0x43bf0f(0x14a)]('\x0a'),_0x3defce=_0xfe6272['filter'](_0x331de0=>!isSyncedAtMetadataLine(_0x331de0,_0x11a129));return _0x3defce[_0x43bf0f(0x148)]('\x0a');}function isSyncedAtMetadataLine(_0x29e009,_0x2d73b5){const _0x4b5e3d=a242_0x3c64f9;if(_0x2d73b5==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4b5e3d(0x133)](_0x29e009);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4b5e3d(0x133)](_0x29e009);}function a242_0x34a5(){const _0x2ef46a=['some','nonInteractive','sqlName','sqlRoot','tableData','\x20written,\x20','cancelled','join','mode','split','conflict','isCanonical','bool','map','find','utf8','sql','local\x20differs\x20from\x20remote','sqlCode','6Ijyued','all','file','Pull\x20complete:\x20','\x20SQL\x20file(s)\x20into\x20','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','Force\x20overwrite\x20local\x20unsynced\x20changes','equivalent','336354mwBzXK','totalCount','catch','content','pull','sqlcode','filePath','dbId','str','Would\x20pull\x20','Filter\x20by\x20SQL\x20display\x20name','skipped','trim','would_pull','No\x20remote\x20SQL\x20queries\x20matched.','26028PDCfMY','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','read','3406880JkgpPr','lockFilePath','POST','sqlRootDir','1685270NyMPBU','replace','mybatisXml','toISOString','appCode','apps','7755696MCjQcc','hash','sqls','1095876GNdiZY','\x20failed','test','toLowerCase','unchanged','47hjUZRq','name','path','3357900wkadLE','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlContent','force','push','endsWith','description','length'];a242_0x34a5=function(){return _0x2ef46a;};return a242_0x34a5();}
|
|
1
|
+
const a242_0x5edcef=a242_0xa41c;(function(_0x2daca9,_0x4ac5cc){const _0x5a9b85=a242_0xa41c,_0x33c39e=_0x2daca9();while(!![]){try{const _0xa9c255=-parseInt(_0x5a9b85(0x168))/0x1+parseInt(_0x5a9b85(0x16f))/0x2+parseInt(_0x5a9b85(0x17d))/0x3+-parseInt(_0x5a9b85(0x161))/0x4+parseInt(_0x5a9b85(0x147))/0x5+-parseInt(_0x5a9b85(0x164))/0x6+parseInt(_0x5a9b85(0x13e))/0x7*(parseInt(_0x5a9b85(0x175))/0x8);if(_0xa9c255===_0x4ac5cc)break;else _0x33c39e['push'](_0x33c39e['shift']());}catch(_0x11f44c){_0x33c39e['push'](_0x33c39e['shift']());}}}(a242_0x1a44,0x21ef0));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a242_0x1a44(){const _0x22642f=['join','pull','unchanged','paging','Force\x20overwrite\x20local\x20unsynced\x20changes','find','appCode','str','mode','Would\x20pull\x20','toISOString','Force\x20pull\x20cancelled.','dbId','772736vFyLVM','Filter\x20by\x20SQL\x20display\x20name','sql','846378BbuWeJ','name','replace','sqlcode','21558rCjSwq','trim','sqlName','Pull\x20complete:\x20','sqlContent','split','equivalent','1160kvpkAV','local\x20differs\x20from\x20remote','totalCount','catch','toLowerCase','.xml','8bykeji','skipped','utf8','all','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','some','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','hash','434277SZPuVX','file','push','lockFilePath','read','cancelled','sqls','sqlRootDir','message','filter','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','No\x20remote\x20SQL\x20queries\x20matched.','sqlRoot','boolean','765422MzhUuK','\x20failed','sqlCode','apps','force','description','content','nonInteractive','\x20skipped,\x20','1200560gWxouK','mybatisXml','tableData','would_pull','lastSync','path','POST','map','\x20SQL\x20file(s)\x20into\x20','endsWith','conflict','isCanonical','length'];a242_0x1a44=function(){return _0x22642f;};return a242_0x1a44();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x48159f,_0x16796a){const _0x5dbb3a=a242_0xa41c,_0x54dc24=[];let _0x3c41cd=0x1;while(!![]){const _0x30ae7d=await listSqlQueries(_0x48159f,{'currentPage':_0x3c41cd,'pageSize':PAGE_SIZE,'sqlCode':_0x16796a[_0x5dbb3a(0x140)],'sqlName':_0x16796a[_0x5dbb3a(0x16a)]}),_0x29a91b=_0x30ae7d[_0x5dbb3a(0x149)]??[];_0x54dc24['push'](..._0x29a91b);if(_0x29a91b[_0x5dbb3a(0x153)]===0x0)break;const _0x324e0f=_0x30ae7d[_0x5dbb3a(0x157)]?.[_0x5dbb3a(0x171)];if(_0x324e0f!=null?_0x54dc24['length']>=_0x324e0f:_0x29a91b[_0x5dbb3a(0x153)]<PAGE_SIZE)break;_0x3c41cd++;}return _0x54dc24;}function a242_0xa41c(_0x5dc221,_0x380d0e){_0x5dc221=_0x5dc221-0x13e;const _0x1a441d=a242_0x1a44();let _0xa41c64=_0x1a441d[_0x5dc221];return _0xa41c64;}async function ensureSqlContent(_0x25b490){const _0x168b73=a242_0xa41c;if(_0x25b490[_0x168b73(0x16c)]!=null&&String(_0x25b490[_0x168b73(0x16c)])[_0x168b73(0x153)]>0x0)return _0x25b490;return getSqlQueryDetail(_0x25b490['sqlCode']);}export const sqlPull={'service':a242_0x5edcef(0x163),'command':a242_0x5edcef(0x155),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a242_0x5edcef(0x181),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a242_0x5edcef(0x165),'type':'string','description':a242_0x5edcef(0x162)},{'name':a242_0x5edcef(0x142),'type':a242_0x5edcef(0x18a),'description':a242_0x5edcef(0x158)}],async 'dryRun'(_0x15efd2){const _0x43a943=a242_0x5edcef,_0x351a01=loadSqlProjectConfig(_0x15efd2[_0x43a943(0x15a)]),_0x74574e=await readSqlLockFile(_0x351a01['lockFilePath']),{appLock:_0x4ed679}=ensureSqlLockScope(_0x74574e??createEmptySqlLock(),_0x351a01['appCode'],_0x351a01[_0x43a943(0x189)],_0x43a943(0x155)),_0x44903f=await fetchAllSqlQueries(_0x15efd2['appCode'],{'sqlCode':_0x15efd2[_0x43a943(0x15b)](_0x43a943(0x167))||undefined,'sqlName':_0x15efd2[_0x43a943(0x15b)]('name')||undefined}),_0x499a01=[];for(const _0x29f075 of _0x44903f){const _0x5896fa=await ensureSqlContent(_0x29f075),_0x1af64b=ensureRemoteSqlContent(_0x5896fa),_0x12396c=detectSqlMode(_0x1af64b),_0x321c28=_0x5896fa[_0x43a943(0x160)]?await getDbName(_0x15efd2[_0x43a943(0x15a)],Number(_0x5896fa[_0x43a943(0x160)]))[_0x43a943(0x172)](()=>undefined):undefined,_0x284f87=buildLocalSqlFileContent({'sqlCode':_0x5896fa['sqlCode'],'sqlName':_0x5896fa[_0x43a943(0x16a)],'dbId':_0x5896fa['dbId']},_0x1af64b,{'dbName':_0x321c28,'mode':_0x12396c,'syncedAt':new Date()[_0x43a943(0x15e)](),'description':_0x5896fa['description']}),_0x4f76b5=buildSqlLockEntry(_0x5896fa,_0x1af64b,'',{'dbName':_0x321c28}),_0x5ea5c2=resolveLocalSqlFilePath(_0x351a01,_0x5896fa[_0x43a943(0x140)],_0x4f76b5);let _0x42a9e2=_0x43a943(0x14a),_0x10f78a;const _0x3cac95=await findExistingSqlFiles(_0x351a01,_0x5ea5c2,_0x12396c,_0x4ed679[_0x43a943(0x183)][_0x5896fa[_0x43a943(0x140)]]);if(_0x3cac95[_0x43a943(0x153)]>0x0){const _0x55bbb9=await compareExistingSqlFiles(_0x3cac95,_0x284f87,_0x12396c);if(_0x55bbb9['some'](({equivalent:_0x439d86})=>!_0x439d86))_0x42a9e2=_0x43a943(0x151),_0x10f78a=_0x43a943(0x17b);else _0x55bbb9['length']===0x1&&_0x55bbb9[0x0]?.[_0x43a943(0x17e)][_0x43a943(0x152)]&&(_0x42a9e2=_0x43a943(0x176),_0x10f78a=_0x43a943(0x156));}_0x499a01[_0x43a943(0x17f)]({'sqlCode':_0x5896fa[_0x43a943(0x140)],'sqlName':_0x5896fa[_0x43a943(0x16a)],'filePath':_0x5ea5c2,'status':_0x42a9e2,'reason':_0x10f78a});}return{'method':_0x43a943(0x14d),'url':_0x43a943(0x179),'body':{'appCode':_0x15efd2[_0x43a943(0x15a)],'sqlCode':_0x15efd2['str'](_0x43a943(0x167))||null,'sqlName':_0x15efd2[_0x43a943(0x15b)]('name')||null,'files':_0x499a01},'description':_0x43a943(0x15d)+_0x499a01[_0x43a943(0x153)]+_0x43a943(0x14f)+_0x351a01[_0x43a943(0x184)]};},async 'execute'(_0x3d56ab){const _0x1711f6=a242_0x5edcef,_0x166d89=loadSqlProjectConfig(_0x3d56ab[_0x1711f6(0x15a)]),_0x25550f=await readSqlLockFile(_0x166d89[_0x1711f6(0x180)]),{lockData:_0x8bd5ad,appLock:_0x257b72}=ensureSqlLockScope(_0x25550f??createEmptySqlLock(),_0x166d89[_0x1711f6(0x15a)],_0x166d89['sqlRoot'],_0x1711f6(0x155)),_0x36982f=_0x3d56ab['bool']('force'),_0x377986=await fetchAllSqlQueries(_0x3d56ab[_0x1711f6(0x15a)],{'sqlCode':_0x3d56ab['str']('sqlcode')||undefined,'sqlName':_0x3d56ab[_0x1711f6(0x15b)](_0x1711f6(0x165))||undefined});if(_0x377986[_0x1711f6(0x153)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x1711f6(0x188)};const _0x508fec=[],_0x296991=[];for(const _0x14ddb2 of _0x377986){try{_0x508fec['push'](await ensureSqlContent(_0x14ddb2));}catch(_0x54774e){_0x296991[_0x1711f6(0x17f)]({'sqlCode':_0x14ddb2[_0x1711f6(0x140)],'error':_0x54774e instanceof Error?_0x54774e[_0x1711f6(0x185)]:String(_0x54774e)});}}if(_0x36982f&&!_0x3d56ab[_0x1711f6(0x145)]){let _0x3e1e61=![];for(const _0x39a045 of _0x508fec){const _0x16f130=detectSqlMode(ensureRemoteSqlContent(_0x39a045)),_0x5a32c2=_0x39a045[_0x1711f6(0x160)]?await getDbName(_0x3d56ab[_0x1711f6(0x15a)],Number(_0x39a045['dbId']))[_0x1711f6(0x172)](()=>undefined):undefined,_0x4364b2=buildLocalSqlFileContent({'sqlCode':_0x39a045[_0x1711f6(0x140)],'sqlName':_0x39a045[_0x1711f6(0x16a)],'dbId':_0x39a045[_0x1711f6(0x160)]},ensureRemoteSqlContent(_0x39a045),{'dbName':_0x5a32c2,'mode':_0x16f130,'syncedAt':new Date()[_0x1711f6(0x15e)](),'description':_0x39a045[_0x1711f6(0x143)]}),_0x1a6115=resolveLocalSqlFilePath(_0x166d89,_0x39a045['sqlCode'],buildSqlLockEntry(_0x39a045,ensureRemoteSqlContent(_0x39a045),'',{'dbName':_0x5a32c2})),_0x525cef=await findExistingSqlFiles(_0x166d89,_0x1a6115,_0x16f130,_0x257b72[_0x1711f6(0x183)][_0x39a045[_0x1711f6(0x140)]]),_0x3da02a=await compareExistingSqlFiles(_0x525cef,_0x4364b2,_0x16f130);if(_0x3da02a['some'](({equivalent:_0x2520ce})=>!_0x2520ce)){_0x3e1e61=!![];break;}}if(_0x3e1e61){const _0x419654=await confirmForceOverwrite(_0x1711f6(0x187));if(!_0x419654)throw CliErrors[_0x1711f6(0x182)](_0x1711f6(0x15f));}}const _0x1913aa=cloneSqlLockData(_0x8bd5ad),_0x3fd07f=_0x1913aa[_0x1711f6(0x141)][_0x166d89['appCode']],_0x5d7107=[],_0x4a95dd=[];for(const _0x27b19a of _0x508fec){const _0x53601d=_0x3fd07f[_0x1711f6(0x183)][_0x27b19a['sqlCode']],_0x49ba17=ensureRemoteSqlContent(_0x27b19a),_0x40b024=detectSqlMode(_0x49ba17),_0x207ab1=_0x27b19a[_0x1711f6(0x160)]?await getDbName(_0x3d56ab['appCode'],Number(_0x27b19a[_0x1711f6(0x160)]))['catch'](()=>undefined):undefined,_0x2cb28b=buildLocalSqlFileContent({'sqlCode':_0x27b19a['sqlCode'],'sqlName':_0x27b19a[_0x1711f6(0x16a)],'dbId':_0x27b19a['dbId']},_0x49ba17,{'dbName':_0x207ab1,'mode':_0x40b024,'syncedAt':new Date()[_0x1711f6(0x15e)](),'description':_0x27b19a[_0x1711f6(0x143)]}),_0x1beaa0=buildSqlLockEntry(_0x27b19a,_0x49ba17,computeSqlContentHash(_0x2cb28b),{'dbName':_0x207ab1}),_0x5321fc=_0x1beaa0[_0x1711f6(0x14c)],_0x411e50=join(_0x166d89[_0x1711f6(0x184)],_0x5321fc);try{const _0x5eeb6e=await findExistingSqlFiles(_0x166d89,_0x411e50,_0x40b024,_0x53601d),_0x3150e0=await compareExistingSqlFiles(_0x5eeb6e,_0x2cb28b,_0x40b024);if(!_0x36982f&&_0x3150e0[_0x1711f6(0x17a)](({equivalent:_0x413d45})=>!_0x413d45)){_0x4a95dd[_0x1711f6(0x17f)]({'sqlCode':_0x27b19a[_0x1711f6(0x140)],'reason':_0x1711f6(0x170)});continue;}const _0x406731=_0x3150e0[_0x1711f6(0x159)](({file:_0x1d62b3})=>_0x1d62b3[_0x1711f6(0x152)]),_0x5e576d=_0x3150e0['find'](({file:_0xcd199d})=>!_0xcd199d[_0x1711f6(0x152)]);if(_0x406731?.[_0x1711f6(0x16e)]&&!_0x5e576d){_0x4a95dd[_0x1711f6(0x17f)]({'sqlCode':_0x27b19a[_0x1711f6(0x140)],'reason':_0x1711f6(0x156)}),_0x3fd07f['sqls'][_0x27b19a[_0x1711f6(0x140)]]={..._0x1beaa0,'hash':computeSqlContentHash(_0x406731['content']),'path':_0x5321fc};continue;}!_0x406731?.[_0x1711f6(0x16e)]&&(await ensureParentDirectory(_0x411e50),await writeFile(_0x411e50,_0x2cb28b,_0x1711f6(0x177))),_0x5e576d&&await rm(_0x5e576d[_0x1711f6(0x17e)]['filePath'],{'force':!![]}),_0x3fd07f[_0x1711f6(0x183)][_0x27b19a['sqlCode']]={..._0x1beaa0,'hash':_0x406731?.['equivalent']?computeSqlContentHash(_0x406731[_0x1711f6(0x144)]):_0x1beaa0[_0x1711f6(0x17c)],'path':_0x5321fc},_0x5d7107['push']({'sqlCode':_0x27b19a['sqlCode'],'filePath':_0x411e50});}catch(_0x561391){_0x296991[_0x1711f6(0x17f)]({'sqlCode':_0x27b19a[_0x1711f6(0x140)],'error':_0x561391 instanceof Error?_0x561391[_0x1711f6(0x185)]:String(_0x561391)});}}return _0x3fd07f[_0x1711f6(0x14b)]=new Date()[_0x1711f6(0x15e)](),await writeSqlLockFile(_0x166d89['lockFilePath'],_0x1913aa),{'ok':_0x296991[_0x1711f6(0x153)]===0x0,'data':{'pulled':_0x5d7107,'skipped':_0x4a95dd,'failed':_0x296991},'message':_0x1711f6(0x16b)+_0x5d7107['length']+'\x20written,\x20'+_0x4a95dd[_0x1711f6(0x153)]+_0x1711f6(0x146)+_0x296991[_0x1711f6(0x153)]+_0x1711f6(0x13f)};}};function isEquivalentPulledSqlFile(_0x313bee,_0x398a9c,_0x5160d7,_0xd2f6f1){if(_0x5160d7!==_0xd2f6f1)return normalizePulledSqlBody(_0x313bee,_0x5160d7)===normalizePulledSqlBody(_0x398a9c,_0xd2f6f1);return normalizePullComparableContent(_0x313bee,_0x5160d7)===normalizePullComparableContent(_0x398a9c,_0xd2f6f1);}async function findExistingSqlFiles(_0x19f947,_0x4d2c6a,_0x4b9a28,_0x4b8da3){const _0x3fa78b=a242_0x5edcef,_0x4db91b=[];await fileExists(_0x4d2c6a)&&_0x4db91b[_0x3fa78b(0x17f)]({'filePath':_0x4d2c6a,'mode':_0x4b9a28,'isCanonical':!![]});if(!_0x4b8da3?.[_0x3fa78b(0x14c)])return _0x4db91b;const _0x522cb8=join(_0x19f947[_0x3fa78b(0x184)],_0x4b8da3[_0x3fa78b(0x14c)]);if(_0x522cb8===_0x4d2c6a)return _0x4db91b;return await fileExists(_0x522cb8)&&_0x4db91b['push']({'filePath':_0x522cb8,'mode':_0x4b8da3[_0x3fa78b(0x15c)]??modeFromFilePath(_0x522cb8),'isCanonical':![]}),_0x4db91b;}async function compareExistingSqlFiles(_0x58fbf6,_0x25a495,_0x4710b1){const _0x2755f8=a242_0x5edcef;return Promise[_0x2755f8(0x178)](_0x58fbf6[_0x2755f8(0x14e)](async _0xa2a586=>{const _0x2b4246=_0x2755f8,_0x413d16=await readFile(_0xa2a586['filePath'],'utf8');return{'file':_0xa2a586,'content':_0x413d16,'equivalent':isEquivalentPulledSqlFile(_0x413d16,_0x25a495,_0xa2a586[_0x2b4246(0x15c)],_0x4710b1)};}));}function modeFromFilePath(_0x6efa85){const _0x337fbc=a242_0x5edcef;return _0x6efa85[_0x337fbc(0x173)]()[_0x337fbc(0x150)](_0x337fbc(0x174))?'mybatisXml':'sql';}function normalizePulledSqlBody(_0x4accc7,_0x3033c0){const _0x495999=a242_0x5edcef;return stripLocalSqlMetadata(_0x4accc7,_0x3033c0)['replace'](/\r\n/g,'\x0a')[_0x495999(0x169)]();}function normalizePullComparableContent(_0x355b25,_0x74fd33){const _0x3370aa=a242_0x5edcef,_0x113e62=_0x355b25[_0x3370aa(0x166)](/\r\n/g,'\x0a')[_0x3370aa(0x16d)]('\x0a'),_0x1bc26d=_0x113e62[_0x3370aa(0x186)](_0x257aef=>!isSyncedAtMetadataLine(_0x257aef,_0x74fd33));return _0x1bc26d[_0x3370aa(0x154)]('\x0a');}function isSyncedAtMetadataLine(_0x1a606,_0x199464){const _0x4ba5c7=a242_0x5edcef;if(_0x199464===_0x4ba5c7(0x148))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x1a606);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x1a606);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a243_0x47bbb9=a243_0x4fe3;(function(_0x48f744,_0x26684d){const _0x32cba0=a243_0x4fe3,_0x149f3f=_0x48f744();while(!![]){try{const _0x9346e3=parseInt(_0x32cba0(0x1a8))/0x1*(-parseInt(_0x32cba0(0x1aa))/0x2)+parseInt(_0x32cba0(0x195))/0x3*(-parseInt(_0x32cba0(0x191))/0x4)+-parseInt(_0x32cba0(0x1b4))/0x5+parseInt(_0x32cba0(0x1b8))/0x6+-parseInt(_0x32cba0(0x181))/0x7*(-parseInt(_0x32cba0(0x1b7))/0x8)+-parseInt(_0x32cba0(0x1b5))/0x9+parseInt(_0x32cba0(0x1b6))/0xa*(parseInt(_0x32cba0(0x196))/0xb);if(_0x9346e3===_0x26684d)break;else _0x149f3f['push'](_0x149f3f['shift']());}catch(_0x277a28){_0x149f3f['push'](_0x149f3f['shift']());}}}(a243_0x87e4,0xa4180));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a243_0x4fe3(_0x494806,_0x5cf0e2){_0x494806=_0x494806-0x17d;const _0x87e412=a243_0x87e4();let _0x4fe3c2=_0x87e412[_0x494806];return _0x4fe3c2;}import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a243_0x87e4(){const _0x7bbfc8=['get','replace','version','length','appCode','filePath','startsWith','bool','sqlCode','boolean','sql','path','52OYAVQd','dbId','No\x20local\x20SQL\x20files\x20found.','toISOString','6465vxnafO','8503vEzAxw','lockFilePath','Would\x20push\x20','remoteId','Local\x20directory\x20\x22','unchanged','exec','force','sqlRootDir','/smartapi/custom/updateUserCustomSql','\x22\x20for\x20sqlCode\x20','\x20SQL\x20file(s)','str','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','Local\x20SQL\x20not\x20found:\x20','has','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','entries','9859twlEYp','Push\x20local\x20SQL\x20files\x20to\x20remote','218LFMVgi','sqlName','POST','hash','catch','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','isFinite','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlcode','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','3032875CuewxG','6278157fiivDk','31670bpaxBy','3843408sPqOyv','902430EbVrRD','dbDirectory','sqlRoot','push','filter','sqlConfig','write','mode','validation','\x20skipped,\x20','dbName','projectRoot','map','sqls','Push\x20complete:\x20','7THHEpy','relativePath','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','join'];a243_0x87e4=function(){return _0x7bbfc8;};return a243_0x87e4();}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x28832f){const _0x4f8a57=a243_0x4fe3,_0x44d5a1=stripLocalSqlMetadata(await readFile(_0x28832f['filePath'],'utf8'),_0x28832f[_0x4f8a57(0x1bf)]);if(!_0x44d5a1['trim']())throw CliErrors['validation'](_0x28832f['sqlCode']+':\x20SQL\x20content\x20is\x20empty.');return _0x44d5a1;}async function getTargetSqlQueries(_0x46ac54,_0x39def8,_0x15834d){const _0x4272e1=a243_0x4fe3,_0x3e3eae=await scanLocalSqlQueries(_0x46ac54),_0xa5d92d=new Map();for(const _0x463c9a of _0x3e3eae){if(_0x15834d&&_0x463c9a[_0x4272e1(0x18d)]!==_0x15834d)continue;const _0x410d4d=_0xa5d92d[_0x4272e1(0x185)](_0x463c9a['sqlCode'])??[];_0x410d4d[_0x4272e1(0x1bb)](_0x463c9a),_0xa5d92d['set'](_0x463c9a[_0x4272e1(0x18d)],_0x410d4d);}if(_0x15834d&&!_0xa5d92d[_0x4272e1(0x1a5)](_0x15834d))throw CliErrors[_0x4272e1(0x1c0)](_0x4272e1(0x1a4)+_0x15834d);const _0x4419fc=[];for(const [_0x1c5017,_0x49a033]of _0xa5d92d[_0x4272e1(0x1a7)]()){if(_0x49a033[_0x4272e1(0x188)]===0x1){_0x4419fc['push'](_0x49a033[0x0]);continue;}const _0x420791=_0x39def8[_0x4272e1(0x17f)][_0x1c5017],_0x769e98=_0x420791?.[_0x4272e1(0x190)],_0x5db6a7=_0x769e98?_0x49a033[_0x4272e1(0x1bc)](_0x3b403f=>_0x3b403f[_0x4272e1(0x182)]!==_0x769e98):_0x49a033;if(_0x420791&&_0x5db6a7['length']===0x1){_0x4419fc[_0x4272e1(0x1bb)](_0x5db6a7[0x0]);continue;}throw CliErrors[_0x4272e1(0x1c0)](_0x4272e1(0x183)+_0x1c5017+_0x4272e1(0x1a3));}return _0x4419fc;}export const sqlPush={'service':a243_0x47bbb9(0x18f),'command':a243_0x47bbb9(0x1bb),'description':a243_0x47bbb9(0x1a9),'risk':a243_0x47bbb9(0x1be),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a243_0x47bbb9(0x19d),'type':a243_0x47bbb9(0x18e),'description':a243_0x47bbb9(0x1af)}],async 'dryRun'(_0x2d3c88){const _0x442c38=a243_0x47bbb9,_0x3ffdf0=loadSqlProjectConfig(_0x2d3c88[_0x442c38(0x189)]),_0x1d1905=await readSqlLockFile(_0x3ffdf0[_0x442c38(0x197)]),{appLock:_0x42aea8}=ensureSqlLockScope(_0x1d1905??createEmptySqlLock(),_0x2d3c88['appCode'],_0x3ffdf0[_0x442c38(0x1ba)],'push'),_0x5035fd=await getTargetSqlQueries(_0x3ffdf0,_0x42aea8,_0x2d3c88['str']('sqlcode')||undefined),_0x4e679e=[];for(const _0x1e6125 of _0x5035fd){const _0x48e1b1=await computeSqlFileHash(_0x1e6125[_0x442c38(0x18a)]),_0xf927fe=_0x42aea8[_0x442c38(0x17f)][_0x1e6125['sqlCode']],_0x3f4f50=!!_0xf927fe&&(_0xf927fe[_0x442c38(0x190)]!==_0x1e6125[_0x442c38(0x182)]||!!_0x1e6125[_0x442c38(0x1ab)]&&_0xf927fe['sqlName']!==_0x1e6125[_0x442c38(0x1ab)]||_0xf927fe[_0x442c38(0x1bf)]!==_0x1e6125[_0x442c38(0x1bf)]);if(!_0x2d3c88[_0x442c38(0x18c)](_0x442c38(0x19d))&&_0xf927fe&&_0xf927fe['hash']===_0x48e1b1&&!_0x3f4f50)continue;if(!_0xf927fe)throw CliErrors['validation'](_0x1e6125[_0x442c38(0x18d)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0xf927fe[_0x442c38(0x187)]==null)throw CliErrors[_0x442c38(0x1c0)](_0x1e6125[_0x442c38(0x18d)]+':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.');await resolveTargetDbBinding(_0x2d3c88['appCode'],_0x1e6125,_0xf927fe),await readSqlUploadContent(_0x1e6125),_0x4e679e[_0x442c38(0x1bb)](_0x1e6125[_0x442c38(0x18d)]);}return{'method':_0x442c38(0x1ac),'url':_0x442c38(0x19f),'body':{'sqlCodes':_0x4e679e,'appCode':_0x2d3c88[_0x442c38(0x189)]},'description':_0x442c38(0x198)+_0x4e679e[_0x442c38(0x188)]+_0x442c38(0x1a1)};},async 'execute'(_0x65cee9){const _0x535e48=a243_0x47bbb9,_0x32a928=loadSqlProjectConfig(_0x65cee9['appCode']),_0x47913c=await readSqlLockFile(_0x32a928['lockFilePath']),{lockData:_0x290472,appLock:_0x143f30}=ensureSqlLockScope(_0x47913c??createEmptySqlLock(),_0x65cee9[_0x535e48(0x189)],_0x32a928['sqlRoot'],_0x535e48(0x1bb)),_0x593987=await getTargetSqlQueries(_0x32a928,_0x143f30,_0x65cee9[_0x535e48(0x1a2)](_0x535e48(0x1b2))||undefined);if(_0x593987[_0x535e48(0x188)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x535e48(0x193)};const _0x29a609=[],_0x319f31=[],_0x369245=[];let _0x311f59=![];for(const _0x458cb5 of _0x593987){const _0x3ccb69=_0x143f30['sqls'][_0x458cb5[_0x535e48(0x18d)]];if(!_0x3ccb69){_0x369245[_0x535e48(0x1bb)]({'sqlCode':_0x458cb5[_0x535e48(0x18d)],'error':_0x535e48(0x1a6)});continue;}try{const _0x2cba9d=await computeSqlFileHash(_0x458cb5[_0x535e48(0x18a)]),_0x537724=_0x3ccb69[_0x535e48(0x190)]!==_0x458cb5['relativePath']||!!_0x458cb5[_0x535e48(0x1ab)]&&_0x3ccb69[_0x535e48(0x1ab)]!==_0x458cb5[_0x535e48(0x1ab)]||_0x3ccb69[_0x535e48(0x1bf)]!==_0x458cb5[_0x535e48(0x1bf)];if(!_0x65cee9['bool'](_0x535e48(0x19d))&&_0x3ccb69[_0x535e48(0x1ad)]===_0x2cba9d&&!_0x537724){_0x319f31[_0x535e48(0x1bb)]({'sqlCode':_0x458cb5[_0x535e48(0x18d)],'reason':_0x535e48(0x19b)});continue;}if(_0x3ccb69[_0x535e48(0x187)]==null){_0x369245[_0x535e48(0x1bb)]({'sqlCode':_0x458cb5['sqlCode'],'error':_0x535e48(0x1b1)});continue;}const _0x4f19e5=_0x458cb5[_0x535e48(0x1ab)]||_0x3ccb69[_0x535e48(0x1ab)],_0x289d67=await resolveTargetDbBinding(_0x65cee9[_0x535e48(0x189)],_0x458cb5,_0x3ccb69),_0x303a0c=await readSqlUploadContent(_0x458cb5),_0x388337=await updateSqlQuery({'id':_0x3ccb69[_0x535e48(0x199)],'appCode':_0x65cee9[_0x535e48(0x189)],'sqlCode':_0x458cb5[_0x535e48(0x18d)],'sqlName':_0x4f19e5,'dbId':_0x289d67[_0x535e48(0x192)],'version':_0x3ccb69['version'],'sqlContent':_0x303a0c,'sqlConfig':_0x3ccb69[_0x535e48(0x1bd)]??undefined}),_0x9a3dde=_0x388337[_0x535e48(0x192)]?await getDbName(_0x65cee9[_0x535e48(0x189)],Number(_0x388337[_0x535e48(0x192)]))[_0x535e48(0x1ae)](()=>_0x289d67['dbName']):_0x289d67[_0x535e48(0x1c2)];_0x143f30[_0x535e48(0x17f)][_0x458cb5['sqlCode']]={...buildSqlLockEntry(_0x388337,_0x303a0c,_0x2cba9d,{'dbName':_0x9a3dde}),'path':_0x458cb5[_0x535e48(0x182)],'mode':_0x458cb5[_0x535e48(0x1bf)]},_0x311f59=!![],await archivePreviousSqlFileIfNeeded(_0x32a928,_0x3ccb69['path'],_0x458cb5[_0x535e48(0x182)]),_0x29a609['push']({'sqlCode':_0x458cb5[_0x535e48(0x18d)],'remoteId':_0x3ccb69[_0x535e48(0x199)]});}catch(_0x23debf){_0x369245[_0x535e48(0x1bb)]({'sqlCode':_0x458cb5[_0x535e48(0x18d)],'error':_0x23debf instanceof Error?_0x23debf['message']:String(_0x23debf)});}}(_0x311f59||_0x369245[_0x535e48(0x188)]===0x0)&&(_0x143f30['lastSync']=new Date()[_0x535e48(0x194)](),await writeSqlLockFile(_0x32a928[_0x535e48(0x197)],_0x290472));const _0x32b53e=_0x369245['length']===0x0;return{'ok':_0x32b53e,'data':{'pushed':_0x29a609,'skipped':_0x319f31,'failed':_0x369245},'message':_0x535e48(0x180)+_0x29a609['length']+'\x20pushed,\x20'+_0x319f31[_0x535e48(0x188)]+_0x535e48(0x1c1)+_0x369245[_0x535e48(0x188)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x430bd2,_0x4ef46b,_0x2d1673){const _0x1e7ea3=a243_0x47bbb9;if(!_0x4ef46b||_0x4ef46b===_0x2d1673)return;const _0x1223fa=join(_0x430bd2[_0x1e7ea3(0x19e)],_0x4ef46b);if(!await fileExists(_0x1223fa))return;const _0x17284a=await moveToTrash(_0x430bd2[_0x1e7ea3(0x17d)],_0x430bd2['trashDir'],_0x1223fa);await cleanupEmptyDirectories(dirname(_0x1223fa),_0x430bd2[_0x1e7ea3(0x19e)]),void _0x17284a;}async function moveToTrash(_0x5821b1,_0xf4e6f9,_0x183ff3){const _0x390b29=a243_0x47bbb9,_0x2b042a=new Date()['toISOString']()[_0x390b29(0x186)](/[:.]/g,'-'),_0x333614=relative(_0x5821b1,_0x183ff3),_0x22e566=join(_0xf4e6f9,_0x2b042a,_0x333614);return await mkdir(dirname(_0x22e566),{'recursive':!![]}),await rename(_0x183ff3,_0x22e566),_0x22e566;}async function cleanupEmptyDirectories(_0x20f02a,_0x3c4d85){const _0x5138bb=a243_0x47bbb9;let _0x2156b6=resolve(_0x20f02a);const _0x2e8f22=resolve(_0x3c4d85);while(_0x2156b6[_0x5138bb(0x18b)](''+_0x2e8f22+sep)||_0x2156b6===_0x2e8f22){if(_0x2156b6===_0x2e8f22)return;try{const _0x292d44=await readdir(_0x2156b6);if(_0x292d44[_0x5138bb(0x188)]>0x0)return;await rmdir(_0x2156b6);}catch{return;}_0x2156b6=dirname(_0x2156b6);}}async function resolveTargetDbBinding(_0x2cce8e,_0x14de15,_0x176a12){const _0x3bbf4d=a243_0x47bbb9,_0x3b7fdd=_0x14de15[_0x3bbf4d(0x1b9)];if(!_0x3b7fdd)return{'dbId':_0x176a12['dbId'],'dbName':_0x176a12[_0x3bbf4d(0x1c2)]};const _0x40313d=buildDbDirectoryName(_0x176a12[_0x3bbf4d(0x1c2)],_0x176a12[_0x3bbf4d(0x192)]);if(_0x3b7fdd===_0x40313d)return{'dbId':_0x176a12[_0x3bbf4d(0x192)],'dbName':_0x176a12[_0x3bbf4d(0x1c2)]};const _0x4a4f01=parseExplicitDbDirectory(_0x3b7fdd);if(_0x4a4f01!=null)return{'dbId':_0x4a4f01,'dbName':await getDbName(_0x2cce8e,_0x4a4f01)['catch'](()=>undefined)};const _0x2f5c28=await listDatabases(_0x2cce8e),_0x333b36=_0x2f5c28[_0x3bbf4d(0x1bc)](_0x4e7f1c=>buildDbDirectoryName(_0x4e7f1c[_0x3bbf4d(0x1c2)],_0x4e7f1c[_0x3bbf4d(0x192)])===_0x3b7fdd);if(_0x333b36[_0x3bbf4d(0x188)]===0x1)return{'dbId':_0x333b36[0x0][_0x3bbf4d(0x192)],'dbName':_0x333b36[0x0][_0x3bbf4d(0x1c2)]};if(_0x333b36[_0x3bbf4d(0x188)]===0x0)throw CliErrors[_0x3bbf4d(0x1c0)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x3b7fdd+_0x3bbf4d(0x1a0)+_0x14de15['sqlCode']+'.');const _0x6b8a03=_0x333b36[_0x3bbf4d(0x17e)](_0x38abfb=>_0x38abfb['dbName']+'\x20('+_0x38abfb[_0x3bbf4d(0x192)]+')')[_0x3bbf4d(0x184)](',\x20');throw CliErrors[_0x3bbf4d(0x1c0)](_0x3bbf4d(0x19a)+_0x3b7fdd+_0x3bbf4d(0x1b3)+_0x14de15[_0x3bbf4d(0x18d)]+':\x20'+_0x6b8a03);}function parseExplicitDbDirectory(_0x526945){const _0x4c8aac=a243_0x47bbb9,_0x39eec3=/^db-(\d+)$/[_0x4c8aac(0x19c)](_0x526945);if(!_0x39eec3)return null;const _0x97fcda=Number(_0x39eec3[0x1]);return Number[_0x4c8aac(0x1b0)](_0x97fcda)&&_0x97fcda>0x0?_0x97fcda:null;}
|
|
1
|
+
const a243_0x59ac29=a243_0x235f;(function(_0x7dacca,_0x8cdd92){const _0x26b66f=a243_0x235f,_0x2be6fa=_0x7dacca();while(!![]){try{const _0x1be414=-parseInt(_0x26b66f(0x8b))/0x1+-parseInt(_0x26b66f(0xbe))/0x2*(parseInt(_0x26b66f(0x8a))/0x3)+-parseInt(_0x26b66f(0xb4))/0x4+parseInt(_0x26b66f(0xad))/0x5*(-parseInt(_0x26b66f(0x86))/0x6)+parseInt(_0x26b66f(0xae))/0x7*(-parseInt(_0x26b66f(0x8d))/0x8)+parseInt(_0x26b66f(0x9b))/0x9+parseInt(_0x26b66f(0xa0))/0xa;if(_0x1be414===_0x8cdd92)break;else _0x2be6fa['push'](_0x2be6fa['shift']());}catch(_0x4f5681){_0x2be6fa['push'](_0x2be6fa['shift']());}}}(a243_0x3fea,0x86d26));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a243_0x235f(_0x3f4102,_0x2bc103){_0x3f4102=_0x3f4102-0x7f;const _0x3feaa7=a243_0x3fea();let _0x235f04=_0x3feaa7[_0x3f4102];return _0x235f04;}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a243_0x3fea(){const _0x32e6b8=['startsWith','Local\x20SQL\x20not\x20found:\x20','sqls','No\x20local\x20SQL\x20files\x20found.','entries','filePath','\x20pushed,\x20','relativePath','706524vpxlvT','remoteId','appCode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','798288kLpzLF','588777wAAEOY','sqlRootDir','1059272VRILko','push',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','sqlConfig','POST','validation','isFinite','set','exec','sqlName',':\x20SQL\x20content\x20is\x20empty.','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','dbId','2181285oKYngI','\x20skipped,\x20','length','Local\x20directory\x20\x22','str','35708210LlnqCU','Push\x20local\x20SQL\x20files\x20to\x20remote','force','bool','sqlcode','catch','join','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','map',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','filter','sqlRoot','trashDir','35nZWlnc','21ilIRhJ','path','write','\x20SQL\x20file(s)','unchanged','toISOString','3673928PkNkxE','dbDirectory','mode','\x20failed','dbName','sqlCode','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','hash','projectRoot','version','4HRmApt','utf8','lockFilePath','No\x20database\x20matches\x20local\x20directory\x20\x22'];a243_0x3fea=function(){return _0x32e6b8;};return a243_0x3fea();}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(_0x2ea348){const _0x240f63=a243_0x235f,_0xb53ac1=stripLocalSqlMetadata(await readFile(_0x2ea348[_0x240f63(0x83)],_0x240f63(0xbf)),_0x2ea348[_0x240f63(0xb6)]);if(!_0xb53ac1['trim']())throw CliErrors[_0x240f63(0x92)](_0x2ea348[_0x240f63(0xb9)]+_0x240f63(0x97));return _0xb53ac1;}async function getTargetSqlQueries(_0x5a7804,_0x386ca6,_0x60dac7){const _0xc300ef=a243_0x235f,_0x360888=await scanLocalSqlQueries(_0x5a7804),_0x5495f6=new Map();for(const _0x4b431d of _0x360888){if(_0x60dac7&&_0x4b431d[_0xc300ef(0xb9)]!==_0x60dac7)continue;const _0x5ef580=_0x5495f6['get'](_0x4b431d['sqlCode'])??[];_0x5ef580[_0xc300ef(0x8e)](_0x4b431d),_0x5495f6[_0xc300ef(0x94)](_0x4b431d[_0xc300ef(0xb9)],_0x5ef580);}if(_0x60dac7&&!_0x5495f6[_0xc300ef(0x98)](_0x60dac7))throw CliErrors[_0xc300ef(0x92)](_0xc300ef(0x7f)+_0x60dac7);const _0x1e1069=[];for(const [_0x11cdd5,_0x126dcf]of _0x5495f6[_0xc300ef(0x82)]()){if(_0x126dcf[_0xc300ef(0x9d)]===0x1){_0x1e1069['push'](_0x126dcf[0x0]);continue;}const _0x47ad57=_0x386ca6[_0xc300ef(0x80)][_0x11cdd5],_0xdc891b=_0x47ad57?.[_0xc300ef(0xaf)],_0x4ee4cf=_0xdc891b?_0x126dcf[_0xc300ef(0xaa)](_0x182410=>_0x182410[_0xc300ef(0x85)]!==_0xdc891b):_0x126dcf;if(_0x47ad57&&_0x4ee4cf[_0xc300ef(0x9d)]===0x1){_0x1e1069[_0xc300ef(0x8e)](_0x4ee4cf[0x0]);continue;}throw CliErrors['validation'](_0xc300ef(0xba)+_0x11cdd5+_0xc300ef(0x89));}return _0x1e1069;}export const sqlPush={'service':'sql','command':a243_0x59ac29(0x8e),'description':a243_0x59ac29(0xa1),'risk':a243_0x59ac29(0xb0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a243_0x59ac29(0xa2),'type':'boolean','description':a243_0x59ac29(0xa7)}],async 'dryRun'(_0x2e0aae){const _0x1a8292=a243_0x59ac29,_0x5e6f12=loadSqlProjectConfig(_0x2e0aae[_0x1a8292(0x88)]),_0x258c73=await readSqlLockFile(_0x5e6f12[_0x1a8292(0xc0)]),{appLock:_0x5bfbac}=ensureSqlLockScope(_0x258c73??createEmptySqlLock(),_0x2e0aae[_0x1a8292(0x88)],_0x5e6f12[_0x1a8292(0xab)],'push'),_0x25c6bc=await getTargetSqlQueries(_0x5e6f12,_0x5bfbac,_0x2e0aae[_0x1a8292(0x9f)]('sqlcode')||undefined),_0x23ce22=[];for(const _0xde5153 of _0x25c6bc){const _0x25cfe8=await computeSqlFileHash(_0xde5153[_0x1a8292(0x83)]),_0xa6f4fc=_0x5bfbac[_0x1a8292(0x80)][_0xde5153[_0x1a8292(0xb9)]],_0x5bd740=!!_0xa6f4fc&&(_0xa6f4fc['path']!==_0xde5153[_0x1a8292(0x85)]||!!_0xde5153[_0x1a8292(0x96)]&&_0xa6f4fc[_0x1a8292(0x96)]!==_0xde5153[_0x1a8292(0x96)]||_0xa6f4fc['mode']!==_0xde5153[_0x1a8292(0xb6)]);if(!_0x2e0aae[_0x1a8292(0xa3)](_0x1a8292(0xa2))&&_0xa6f4fc&&_0xa6f4fc[_0x1a8292(0xbb)]===_0x25cfe8&&!_0x5bd740)continue;if(!_0xa6f4fc)throw CliErrors[_0x1a8292(0x92)](_0xde5153[_0x1a8292(0xb9)]+_0x1a8292(0xa9));if(_0xa6f4fc[_0x1a8292(0xbd)]==null)throw CliErrors[_0x1a8292(0x92)](_0xde5153[_0x1a8292(0xb9)]+_0x1a8292(0x8f));await resolveTargetDbBinding(_0x2e0aae['appCode'],_0xde5153,_0xa6f4fc),await readSqlUploadContent(_0xde5153),_0x23ce22[_0x1a8292(0x8e)](_0xde5153[_0x1a8292(0xb9)]);}return{'method':_0x1a8292(0x91),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x23ce22,'appCode':_0x2e0aae[_0x1a8292(0x88)]},'description':'Would\x20push\x20'+_0x23ce22[_0x1a8292(0x9d)]+_0x1a8292(0xb1)};},async 'execute'(_0x2146f1){const _0x3670cb=a243_0x59ac29,_0x4d6564=loadSqlProjectConfig(_0x2146f1['appCode']),_0x1cd7ee=await readSqlLockFile(_0x4d6564[_0x3670cb(0xc0)]),{lockData:_0x1e78c2,appLock:_0x13cfce}=ensureSqlLockScope(_0x1cd7ee??createEmptySqlLock(),_0x2146f1['appCode'],_0x4d6564[_0x3670cb(0xab)],_0x3670cb(0x8e)),_0x340b75=await getTargetSqlQueries(_0x4d6564,_0x13cfce,_0x2146f1[_0x3670cb(0x9f)](_0x3670cb(0xa4))||undefined);if(_0x340b75['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x3670cb(0x81)};const _0x33b80b=[],_0x6e0d32=[],_0x302bfd=[];let _0x3d52d6=![];for(const _0x399a4d of _0x340b75){const _0xa6b28b=_0x13cfce[_0x3670cb(0x80)][_0x399a4d[_0x3670cb(0xb9)]];if(!_0xa6b28b){_0x302bfd[_0x3670cb(0x8e)]({'sqlCode':_0x399a4d['sqlCode'],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x440773=await computeSqlFileHash(_0x399a4d[_0x3670cb(0x83)]),_0x4d6a95=_0xa6b28b[_0x3670cb(0xaf)]!==_0x399a4d[_0x3670cb(0x85)]||!!_0x399a4d[_0x3670cb(0x96)]&&_0xa6b28b['sqlName']!==_0x399a4d['sqlName']||_0xa6b28b[_0x3670cb(0xb6)]!==_0x399a4d[_0x3670cb(0xb6)];if(!_0x2146f1['bool'](_0x3670cb(0xa2))&&_0xa6b28b[_0x3670cb(0xbb)]===_0x440773&&!_0x4d6a95){_0x6e0d32[_0x3670cb(0x8e)]({'sqlCode':_0x399a4d[_0x3670cb(0xb9)],'reason':_0x3670cb(0xb2)});continue;}if(_0xa6b28b[_0x3670cb(0xbd)]==null){_0x302bfd[_0x3670cb(0x8e)]({'sqlCode':_0x399a4d['sqlCode'],'error':_0x3670cb(0x99)});continue;}const _0x440e40=_0x399a4d[_0x3670cb(0x96)]||_0xa6b28b[_0x3670cb(0x96)],_0xb3aafd=await resolveTargetDbBinding(_0x2146f1['appCode'],_0x399a4d,_0xa6b28b),_0x1b76e9=await readSqlUploadContent(_0x399a4d),_0x514835=await updateSqlQuery({'id':_0xa6b28b[_0x3670cb(0x87)],'appCode':_0x2146f1['appCode'],'sqlCode':_0x399a4d['sqlCode'],'sqlName':_0x440e40,'dbId':_0xb3aafd[_0x3670cb(0x9a)],'version':_0xa6b28b[_0x3670cb(0xbd)],'sqlContent':_0x1b76e9,'sqlConfig':_0xa6b28b[_0x3670cb(0x90)]??undefined}),_0x1569f6=_0x514835[_0x3670cb(0x9a)]?await getDbName(_0x2146f1[_0x3670cb(0x88)],Number(_0x514835[_0x3670cb(0x9a)]))[_0x3670cb(0xa5)](()=>_0xb3aafd[_0x3670cb(0xb8)]):_0xb3aafd[_0x3670cb(0xb8)];_0x13cfce['sqls'][_0x399a4d[_0x3670cb(0xb9)]]={...buildSqlLockEntry(_0x514835,_0x1b76e9,_0x440773,{'dbName':_0x1569f6}),'path':_0x399a4d[_0x3670cb(0x85)],'mode':_0x399a4d['mode']},_0x3d52d6=!![],await archivePreviousSqlFileIfNeeded(_0x4d6564,_0xa6b28b['path'],_0x399a4d[_0x3670cb(0x85)]),_0x33b80b['push']({'sqlCode':_0x399a4d[_0x3670cb(0xb9)],'remoteId':_0xa6b28b['remoteId']});}catch(_0x56175a){_0x302bfd['push']({'sqlCode':_0x399a4d['sqlCode'],'error':_0x56175a instanceof Error?_0x56175a['message']:String(_0x56175a)});}}(_0x3d52d6||_0x302bfd[_0x3670cb(0x9d)]===0x0)&&(_0x13cfce['lastSync']=new Date()[_0x3670cb(0xb3)](),await writeSqlLockFile(_0x4d6564[_0x3670cb(0xc0)],_0x1e78c2));const _0x19e25c=_0x302bfd[_0x3670cb(0x9d)]===0x0;return{'ok':_0x19e25c,'data':{'pushed':_0x33b80b,'skipped':_0x6e0d32,'failed':_0x302bfd},'message':'Push\x20complete:\x20'+_0x33b80b[_0x3670cb(0x9d)]+_0x3670cb(0x84)+_0x6e0d32[_0x3670cb(0x9d)]+_0x3670cb(0x9c)+_0x302bfd[_0x3670cb(0x9d)]+_0x3670cb(0xb7)};}};async function archivePreviousSqlFileIfNeeded(_0x56c03c,_0x8284d8,_0x177223){const _0x343947=a243_0x59ac29;if(!_0x8284d8||_0x8284d8===_0x177223)return;const _0xcac389=join(_0x56c03c[_0x343947(0x8c)],_0x8284d8);if(!await fileExists(_0xcac389))return;const _0x120b7d=await moveToTrash(_0x56c03c[_0x343947(0xbc)],_0x56c03c[_0x343947(0xac)],_0xcac389);await cleanupEmptyDirectories(dirname(_0xcac389),_0x56c03c['sqlRootDir']),void _0x120b7d;}async function moveToTrash(_0x33e9cc,_0x1a6baa,_0xe0045b){const _0x4da5b0=a243_0x59ac29,_0x310aad=new Date()[_0x4da5b0(0xb3)]()['replace'](/[:.]/g,'-'),_0x24df8d=relative(_0x33e9cc,_0xe0045b),_0xc4b3e4=join(_0x1a6baa,_0x310aad,_0x24df8d);return await mkdir(dirname(_0xc4b3e4),{'recursive':!![]}),await rename(_0xe0045b,_0xc4b3e4),_0xc4b3e4;}async function cleanupEmptyDirectories(_0x506b0b,_0x126a8d){const _0x47deff=a243_0x59ac29;let _0x154ce9=resolve(_0x506b0b);const _0x1d7fb9=resolve(_0x126a8d);while(_0x154ce9[_0x47deff(0xc2)](''+_0x1d7fb9+sep)||_0x154ce9===_0x1d7fb9){if(_0x154ce9===_0x1d7fb9)return;try{const _0x389ba1=await readdir(_0x154ce9);if(_0x389ba1[_0x47deff(0x9d)]>0x0)return;await rmdir(_0x154ce9);}catch{return;}_0x154ce9=dirname(_0x154ce9);}}async function resolveTargetDbBinding(_0x1f5996,_0x5c06cb,_0x5afbc9){const _0x410e2b=a243_0x59ac29,_0x9480f9=_0x5c06cb[_0x410e2b(0xb5)];if(!_0x9480f9)return{'dbId':_0x5afbc9['dbId'],'dbName':_0x5afbc9[_0x410e2b(0xb8)]};const _0xc85806=buildDbDirectoryName(_0x5afbc9[_0x410e2b(0xb8)],_0x5afbc9[_0x410e2b(0x9a)]);if(_0x9480f9===_0xc85806)return{'dbId':_0x5afbc9[_0x410e2b(0x9a)],'dbName':_0x5afbc9[_0x410e2b(0xb8)]};const _0x1d22e6=parseExplicitDbDirectory(_0x9480f9);if(_0x1d22e6!=null)return{'dbId':_0x1d22e6,'dbName':await getDbName(_0x1f5996,_0x1d22e6)['catch'](()=>undefined)};const _0x518ef4=await listDatabases(_0x1f5996),_0x319a70=_0x518ef4[_0x410e2b(0xaa)](_0x3c73a5=>buildDbDirectoryName(_0x3c73a5[_0x410e2b(0xb8)],_0x3c73a5['dbId'])===_0x9480f9);if(_0x319a70[_0x410e2b(0x9d)]===0x1)return{'dbId':_0x319a70[0x0][_0x410e2b(0x9a)],'dbName':_0x319a70[0x0]['dbName']};if(_0x319a70[_0x410e2b(0x9d)]===0x0)throw CliErrors[_0x410e2b(0x92)](_0x410e2b(0xc1)+_0x9480f9+'\x22\x20for\x20sqlCode\x20'+_0x5c06cb[_0x410e2b(0xb9)]+'.');const _0x51c4de=_0x319a70[_0x410e2b(0xa8)](_0x36da1e=>_0x36da1e[_0x410e2b(0xb8)]+'\x20('+_0x36da1e['dbId']+')')[_0x410e2b(0xa6)](',\x20');throw CliErrors[_0x410e2b(0x92)](_0x410e2b(0x9e)+_0x9480f9+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x5c06cb[_0x410e2b(0xb9)]+':\x20'+_0x51c4de);}function parseExplicitDbDirectory(_0x5ed286){const _0x4392ec=a243_0x59ac29,_0x52157b=/^db-(\d+)$/[_0x4392ec(0x95)](_0x5ed286);if(!_0x52157b)return null;const _0x4d1523=Number(_0x52157b[0x1]);return Number[_0x4392ec(0x93)](_0x4d1523)&&_0x4d1523>0x0?_0x4d1523:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x9f755a=a244_0x113c;(function(_0x21fb27,_0x2e67c2){const _0x4ad42e=a244_0x113c,_0xf42aa=_0x21fb27();while(!![]){try{const _0x11ebb6=-parseInt(_0x4ad42e(0x17e))/0x1*(-parseInt(_0x4ad42e(0x168))/0x2)+-parseInt(_0x4ad42e(0x174))/0x3+-parseInt(_0x4ad42e(0x172))/0x4+-parseInt(_0x4ad42e(0x18e))/0x5+-parseInt(_0x4ad42e(0x16f))/0x6+parseInt(_0x4ad42e(0x184))/0x7*(parseInt(_0x4ad42e(0x18c))/0x8)+parseInt(_0x4ad42e(0x169))/0x9;if(_0x11ebb6===_0x2e67c2)break;else _0xf42aa['push'](_0xf42aa['shift']());}catch(_0x1809fd){_0xf42aa['push'](_0xf42aa['shift']());}}}(a244_0x4d15,0xb186f));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_0x9f755a(0x187);export function buildSqlLockEntry(_0x160ab4,_0x376f14,_0x33c2ad,_0x201288){const _0x232db6=a244_0x9f755a,_0x1545ef=detectSqlMode(_0x376f14);return{'path':buildSqlRelativePath(_0x160ab4[_0x232db6(0x183)],_0x160ab4[_0x232db6(0x18b)],_0x201288?.[_0x232db6(0x191)],_0x1545ef,_0x160ab4[_0x232db6(0x179)]),'hash':_0x33c2ad,'remoteId':_0x160ab4['id'],'version':_0x160ab4[_0x232db6(0x188)],'dbId':Number(_0x160ab4[_0x232db6(0x179)]),'dbName':_0x201288?.[_0x232db6(0x191)],'sqlName':_0x160ab4[_0x232db6(0x18b)],'sqlConfig':_0x160ab4['sqlConfig']??undefined,'mode':_0x1545ef};}export function cloneSqlLockData(_0x1008a9){const _0x49241d=a244_0x9f755a;return{'apps':Object[_0x49241d(0x186)](Object[_0x49241d(0x171)](_0x1008a9['apps'])[_0x49241d(0x18f)](([_0x457f59,_0x587e30])=>[_0x457f59,{'sqlRoot':_0x587e30[_0x49241d(0x193)],'lastSync':_0x587e30[_0x49241d(0x185)],'sqls':{..._0x587e30[_0x49241d(0x16c)]}}]))};}export function ensureRemoteSqlContent(_0x552edb){const _0x25c210=a244_0x9f755a;return _0x552edb[_0x25c210(0x16a)]??'';}export function buildLocalSqlFileContent(_0x18611a,_0x5945bf,_0x17bc34){const _0x4c6236=a244_0x9f755a,_0x4f21c9=_0x17bc34?.[_0x4c6236(0x16d)]??detectSqlMode(_0x5945bf),_0x2884f5=stripLocalSqlMetadata(_0x5945bf,_0x4f21c9)['trim'](),_0x1622f7=buildMetadataHeaderLines({'sqlCode':_0x18611a[_0x4c6236(0x183)],'sqlName':_0x18611a[_0x4c6236(0x18b)],'dbId':_0x18611a[_0x4c6236(0x179)],'dbName':_0x17bc34?.[_0x4c6236(0x191)],'mode':_0x4f21c9,'syncedAt':_0x17bc34?.[_0x4c6236(0x17f)],'description':_0x17bc34?.[_0x4c6236(0x173)]},_0x4f21c9),_0x5942bc=_0x4f21c9===_0x4c6236(0x192)?splitXmlDeclaration(_0x2884f5):{'body':_0x2884f5},_0x170251=[..._0x5942bc[_0x4c6236(0x18a)]?[_0x5942bc['declaration']]:[],..._0x1622f7,'',_0x5942bc[_0x4c6236(0x181)]['trimStart']()],_0x4fa890=_0x170251[_0x4c6236(0x17d)]('\x0a');return _0x4fa890[_0x4c6236(0x167)]('\x0a')?_0x4fa890:_0x4fa890+'\x0a';}export function stripLocalSqlMetadata(_0x560621,_0x364ae2){const _0x310fd3=a244_0x9f755a;if(_0x364ae2===_0x310fd3(0x192)){const {declaration:_0x3e1165,body:_0xd19b89}=splitXmlDeclaration(_0x560621['replace'](/\r\n/g,'\x0a')),_0x2e1d2a=stripLeadingMetadataLines(_0xd19b89,/^\s*<!--\s*@lovrabet\./);return _0x3e1165?''+_0x3e1165+(_0x2e1d2a?'\x0a'+_0x2e1d2a:''):_0x2e1d2a;}return stripLeadingMetadataLines(_0x560621[_0x310fd3(0x17c)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x2b76bb,_0x471d8e){const _0x41eddb=a244_0x9f755a;if(_0x471d8e?.[_0x41eddb(0x16d)])return _0x471d8e['mode'];return detectSqlMode(_0x2b76bb);}function a244_0x4d15(){const _0x241e35=['filter','replace','join','1111336iPqnqi','syncedAt','--\x20@lovrabet.','body','trimStart','sqlCode','434kLqcSh','lastSync','fromEntries','.rabetbase/sql','version','includes','declaration','sqlName','35128mVmAtr','slice','3806465dBZGcU','map','test','dbName','mybatisXml','sqlRoot','trim','endsWith','2byFGWS','22516038odHoyC','sqlContent','apps','sqls','mode','\x20-->','5286288BSgxbi','question','entries','1015988lfbrkj','description','3785613PyYWYq','path','split','exec','stdin','dbId','length'];a244_0x4d15=function(){return _0x241e35;};return a244_0x4d15();}export function resolveSqlFileName(_0x7fbc9d,_0x58a258,_0x2d4084){const _0x22c07b=a244_0x9f755a;if(_0x2d4084?.[_0x22c07b(0x175)])return _0x2d4084[_0x22c07b(0x175)];if(_0x2d4084?.[_0x22c07b(0x18b)]||_0x2d4084?.[_0x22c07b(0x191)])return buildSqlRelativePath(_0x7fbc9d,_0x2d4084?.[_0x22c07b(0x18b)],_0x2d4084?.[_0x22c07b(0x191)],resolveSqlMode(_0x58a258,_0x2d4084),_0x2d4084?.[_0x22c07b(0x179)]);return buildDefaultSqlFileName(_0x7fbc9d,resolveSqlMode(_0x58a258,_0x2d4084));}export function resolveSqlLocalDir(_0x57e9d3,_0x5ac3ec){return join(_0x57e9d3,SQL_LOCAL_REL_DIR,_0x5ac3ec);}function a244_0x113c(_0x15061b,_0x5d1a28){_0x15061b=_0x15061b-0x166;const _0x4d15d=a244_0x4d15();let _0x113ca5=_0x4d15d[_0x15061b];return _0x113ca5;}export async function confirmForceOverwrite(_0x3a2495){const _0x1c7508=a244_0x9f755a,_0x5e0450=createInterface({'input':process[_0x1c7508(0x178)],'output':process['stderr']}),_0x514a8c=await new Promise(_0x33ec7b=>{const _0x1a6d9b=_0x1c7508;_0x5e0450[_0x1a6d9b(0x170)](_0x3a2495+'\x20[y/N]\x20',_0x33ec7b);});return _0x5e0450['close'](),['y','yes'][_0x1c7508(0x189)](_0x514a8c[_0x1c7508(0x166)]()['toLowerCase']());}export function findSqlLockScope(_0x39400c,_0x3c21ea){const _0xa0a232=a244_0x9f755a;return _0x39400c[_0xa0a232(0x16b)][_0x3c21ea];}function buildMetadataHeaderLines(_0x4675e8,_0x375bea){const _0x402e35=a244_0x9f755a,_0x3b74d5=[[_0x402e35(0x183),_0x4675e8[_0x402e35(0x183)]],[_0x402e35(0x18b),_0x4675e8[_0x402e35(0x18b)]],['dbId',_0x4675e8[_0x402e35(0x179)]],[_0x402e35(0x191),_0x4675e8['dbName']],[_0x402e35(0x16d),_0x4675e8[_0x402e35(0x16d)]],[_0x402e35(0x17f),_0x4675e8['syncedAt']],[_0x402e35(0x173),_0x4675e8[_0x402e35(0x173)]]];if(_0x375bea===_0x402e35(0x192))return _0x3b74d5[_0x402e35(0x17b)](([,_0x38448b])=>_0x38448b!==undefined&&_0x38448b!==null&&String(_0x38448b)[_0x402e35(0x166)]()!=='')[_0x402e35(0x18f)](([_0xc13118,_0x1fedb6])=>'<!--\x20@lovrabet.'+_0xc13118+':\x20'+String(_0x1fedb6)+_0x402e35(0x16e));return _0x3b74d5['filter'](([,_0x3c5d09])=>_0x3c5d09!==undefined&&_0x3c5d09!==null&&String(_0x3c5d09)[_0x402e35(0x166)]()!=='')['map'](([_0x29cba6,_0x33d44f])=>_0x402e35(0x180)+_0x29cba6+':\x20'+String(_0x33d44f));}function splitXmlDeclaration(_0x281cb3){const _0x5db0b2=a244_0x9f755a,_0x30a025=_0x281cb3['trimStart'](),_0x526469=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x5db0b2(0x177)](_0x30a025);if(!_0x526469)return{'body':_0x281cb3};return{'declaration':_0x526469[0x0],'body':_0x30a025[_0x5db0b2(0x18d)](_0x526469[0x0][_0x5db0b2(0x17a)])};}function stripLeadingMetadataLines(_0x3f54a8,_0x3d7fe4){const _0x328247=a244_0x9f755a,_0x4d08e6=_0x3f54a8[_0x328247(0x176)]('\x0a');let _0x4d2e44=0x0;while(_0x4d2e44<_0x4d08e6['length']){const _0x49dc2a=_0x4d08e6[_0x4d2e44]??'';if(_0x3d7fe4[_0x328247(0x190)](_0x49dc2a)||_0x49dc2a[_0x328247(0x166)]()===''){_0x4d2e44++;continue;}break;}return _0x4d08e6[_0x328247(0x18d)](_0x4d2e44)['join']('\x0a')[_0x328247(0x182)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x543eb9=a245_0x1159;(function(_0x3abfcb,_0x1d7786){const _0x4cea85=a245_0x1159,_0x3c6a5d=_0x3abfcb();while(!![]){try{const _0x436515=parseInt(_0x4cea85(0x1d3))/0x1+-parseInt(_0x4cea85(0x1ec))/0x2+parseInt(_0x4cea85(0x1ea))/0x3*(-parseInt(_0x4cea85(0x1cf))/0x4)+parseInt(_0x4cea85(0x1eb))/0x5*(parseInt(_0x4cea85(0x1cc))/0x6)+-parseInt(_0x4cea85(0x1e6))/0x7*(-parseInt(_0x4cea85(0x1ce))/0x8)+-parseInt(_0x4cea85(0x1d6))/0x9*(-parseInt(_0x4cea85(0x1cb))/0xa)+-parseInt(_0x4cea85(0x1da))/0xb*(parseInt(_0x4cea85(0x1ca))/0xc);if(_0x436515===_0x1d7786)break;else _0x3c6a5d['push'](_0x3c6a5d['shift']());}catch(_0x2767be){_0x3c6a5d['push'](_0x3c6a5d['shift']());}}}(a245_0x261f,0x9a0c3));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a245_0x1159(_0x5913ce,_0x51a123){_0x5913ce=_0x5913ce-0x1c8;const _0x261fac=a245_0x261f();let _0x1159d1=_0x261fac[_0x5913ce];return _0x1159d1;}function a245_0x261f(){const _0x1c3665=['985453HYckCQ','has','sqlName','9mvmRJV','boolean','remote','tableData','22198594zAOGwn','\x20missing,\x20','\x20added,\x20','read','paging','status','length','sqls','appCode','lockKey','sqlCode','bool','2030iZuXxn','All\x20SQL\x20queries\x20are\x20in\x20sync.','path','\x20unchanged','253335YHvvuL','10otqkID','711748rMhlzQ','hash','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','push','12ZDHTle','8332370mvcmfX','3569586qppOBR','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','6888besOGX','12DZRyMP','\x20remote-only','map','\x20modified,\x20'];a245_0x261f=function(){return _0x1c3665;};return a245_0x261f();}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x19f5e2){const _0xef0be5=a245_0x1159,_0x168408=[];let _0x50ba84=0x1;while(!![]){const _0x555709=await listSqlQueries(_0x19f5e2,{'currentPage':_0x50ba84,'pageSize':PAGE_SIZE}),_0x4adb50=_0x555709[_0xef0be5(0x1d9)]??[];_0x168408[_0xef0be5(0x1c9)](..._0x4adb50['map'](_0x4c9a69=>_0x4c9a69[_0xef0be5(0x1e4)]));if(_0x4adb50[_0xef0be5(0x1e0)]===0x0)break;const _0x362dfb=_0x555709[_0xef0be5(0x1de)]?.['totalCount'];if(_0x362dfb!=null?_0x168408[_0xef0be5(0x1e0)]>=_0x362dfb:_0x4adb50[_0xef0be5(0x1e0)]<PAGE_SIZE)break;_0x50ba84++;}return _0x168408;}export const sqlStatus={'service':'sql','command':a245_0x543eb9(0x1df),'description':a245_0x543eb9(0x1c8),'risk':a245_0x543eb9(0x1dd),'flags':[{'name':a245_0x543eb9(0x1d8),'type':a245_0x543eb9(0x1d7),'description':a245_0x543eb9(0x1cd)}],async 'execute'(_0x3040a4){const _0x5e6c54=a245_0x543eb9,_0x1adfba=loadSqlProjectConfig(_0x3040a4[_0x5e6c54(0x1e2)]),_0x1221ab=await readSqlLockFile(_0x1adfba['lockFilePath']),{appLock:_0x4b62b3}=ensureSqlLockScope(_0x1221ab??createEmptySqlLock(),_0x1adfba['appCode'],_0x1adfba['sqlRoot'],'status'),_0x545c59=await scanLocalSqlQueries(_0x1adfba),_0xd34f0b=[],_0xdea193=[],_0x4a4982=[],_0x5b09b2=[],_0x23a960=new Set(_0x545c59[_0x5e6c54(0x1d1)](_0x42a4ef=>_0x42a4ef[_0x5e6c54(0x1e3)]));for(const _0x3c6bc4 of _0x545c59){const _0x391c5c=await computeSqlFileHash(_0x3c6bc4['filePath']),_0x507c9a=_0x4b62b3['sqls'][_0x3c6bc4[_0x5e6c54(0x1e3)]],_0x13fd4a=!!_0x507c9a&&_0x507c9a[_0x5e6c54(0x1e8)]!==_0x3c6bc4['relativePath'],_0xd8c04b=!!_0x507c9a&&!!_0x3c6bc4[_0x5e6c54(0x1d5)]&&_0x507c9a[_0x5e6c54(0x1d5)]!==_0x3c6bc4['sqlName'];if(!_0x507c9a)_0xd34f0b['push'](_0x3c6bc4['lockKey']);else _0x507c9a[_0x5e6c54(0x1ed)]!==_0x391c5c||_0x13fd4a||_0xd8c04b?_0xdea193[_0x5e6c54(0x1c9)](_0x3c6bc4['lockKey']):_0x4a4982[_0x5e6c54(0x1c9)](_0x3c6bc4[_0x5e6c54(0x1e3)]);}for(const _0x342c66 of Object['keys'](_0x4b62b3[_0x5e6c54(0x1e1)])){!_0x23a960[_0x5e6c54(0x1d4)](_0x342c66)&&_0x5b09b2[_0x5e6c54(0x1c9)](_0x342c66);}const _0x27e492=[];if(_0x3040a4[_0x5e6c54(0x1e5)](_0x5e6c54(0x1d8))){const _0x2ea414=await fetchAllSqlCodes(_0x3040a4[_0x5e6c54(0x1e2)]);for(const _0x26fb3c of _0x2ea414){!_0x23a960[_0x5e6c54(0x1d4)](_0x26fb3c)&&!_0x4b62b3['sqls'][_0x26fb3c]&&_0x27e492['push'](_0x26fb3c);}}const _0x174635=_0xd34f0b[_0x5e6c54(0x1e0)]===0x0&&_0xdea193[_0x5e6c54(0x1e0)]===0x0&&_0x5b09b2[_0x5e6c54(0x1e0)]===0x0&&_0x27e492[_0x5e6c54(0x1e0)]===0x0;return{'ok':!![],'data':{'added':_0xd34f0b,'modified':_0xdea193,'missing':_0x5b09b2,'unchanged':_0x4a4982,'remoteOnly':_0x27e492},'message':_0x174635?_0x5e6c54(0x1e7):_0xd34f0b[_0x5e6c54(0x1e0)]+_0x5e6c54(0x1dc)+_0xdea193[_0x5e6c54(0x1e0)]+_0x5e6c54(0x1d2)+_0x5b09b2[_0x5e6c54(0x1e0)]+_0x5e6c54(0x1db)+_0x4a4982[_0x5e6c54(0x1e0)]+_0x5e6c54(0x1e9)+(_0x27e492[_0x5e6c54(0x1e0)]>0x0?',\x20'+_0x27e492[_0x5e6c54(0x1e0)]+_0x5e6c54(0x1d0):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x4159c7=a246_0x1cf2;(function(_0x5de800,_0x2765dc){const _0x2a49b6=a246_0x1cf2,_0x428f87=_0x5de800();while(!![]){try{const _0x24d1c6=-parseInt(_0x2a49b6(0xea))/0x1+parseInt(_0x2a49b6(0xcb))/0x2*(-parseInt(_0x2a49b6(0xa6))/0x3)+-parseInt(_0x2a49b6(0xd3))/0x4+-parseInt(_0x2a49b6(0xdb))/0x5*(parseInt(_0x2a49b6(0xcf))/0x6)+parseInt(_0x2a49b6(0xb9))/0x7+-parseInt(_0x2a49b6(0xeb))/0x8*(-parseInt(_0x2a49b6(0xe9))/0x9)+parseInt(_0x2a49b6(0xe7))/0xa;if(_0x24d1c6===_0x2765dc)break;else _0x428f87['push'](_0x428f87['shift']());}catch(_0x20f1d3){_0x428f87['push'](_0x428f87['shift']());}}}(a246_0x1f31,0xa4e74));function a246_0x1f31(){const _0x239183=['trim','pkField','8yQoEQz','valid','Dataset\x20\x22','file','3967242hpMFTd','primary','tables','Provide\x20--file\x20or\x20--sql','2684412HkbOYy','message','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','--check-indexes\x20requires\x20--schemas.','map','toLowerCase','indexName','name','5ryXlwR','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','unshift','utf-8','string','Table\x20\x22','index_name','isArray','fields','str','\x22\x20not\x20found\x20in\x20any\x20dataset','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','22538530erdTmd','dbtableConfig','72XBazeL','549049Okibdt','1069608WgPUOe','bool','cwd','joinAudit','sql','flatMap','indexes','schemaWarnings','980571FnOPdm','filter','columns','read','check-indexes','validate','sqlType','schema:','isDangerous','File\x20not\x20found:\x20','appCode','\x22\x20not\x20found\x20or\x20not\x20accessible','push','isLockingRead','validation','from','columnNames','dataset','schemas','3785390KzxdCr','tableName','SQL\x20schema\x20validation','isSelectOnly','index_type','reason','length','type','boolean','find','get','size','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','split','index_columns','flagMissing'];a246_0x1f31=function(){return _0x239183;};return a246_0x1f31();}import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a246_0x1cf2(_0x2a9341,_0x106d9){_0x2a9341=_0x2a9341-0xa0;const _0x1f312e=a246_0x1f31();let _0x1cf235=_0x1f312e[_0x2a9341];return _0x1cf235;}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a246_0x4159c7(0xa2),'command':a246_0x4159c7(0xab),'description':a246_0x4159c7(0xd5),'risk':a246_0x4159c7(0xa9),'flags':[{'name':a246_0x4159c7(0xce),'type':a246_0x4159c7(0xdf),'description':a246_0x4159c7(0xe6)},{'name':a246_0x4159c7(0xa2),'type':a246_0x4159c7(0xdf),'description':a246_0x4159c7(0xc5)},{'name':a246_0x4159c7(0xb8),'type':'string','description':a246_0x4159c7(0xdc)},{'name':'check-indexes','type':a246_0x4159c7(0xc1),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x68e7f7){const _0xd52c2c=a246_0x4159c7,_0x219cbe=_0x68e7f7[_0xd52c2c(0xe4)](_0xd52c2c(0xce)),_0x3ff239=_0x68e7f7[_0xd52c2c(0xe4)]('sql'),_0x19ca7c=_0x68e7f7[_0xd52c2c(0xe4)](_0xd52c2c(0xb8)),_0x3e723f=_0x68e7f7[_0xd52c2c(0xec)](_0xd52c2c(0xaa));if(!_0x219cbe&&!_0x3ff239)throw CliErrors[_0xd52c2c(0xc8)]('file',_0xd52c2c(0xd2));if(_0x3e723f&&!_0x19ca7c)throw CliErrors[_0xd52c2c(0xb4)](_0xd52c2c(0xd6));let _0x1d0aaf;if(_0x219cbe){const _0x559a03=resolve(process[_0xd52c2c(0xa0)](),_0x219cbe);if(!existsSync(_0x559a03))throw CliErrors['validation'](_0xd52c2c(0xaf)+_0x559a03);_0x1d0aaf=readFileSync(_0x559a03,_0xd52c2c(0xde));}else _0x1d0aaf=_0x3ff239;const _0x1bfe39=validateSql(_0x1d0aaf),_0xdef032={'valid':_0x1bfe39['valid'],'sqlType':_0x1bfe39['sqlType']['type'],'isSelectOnly':_0x1bfe39[_0xd52c2c(0xac)][_0xd52c2c(0xbc)],'isLockingRead':_0x1bfe39[_0xd52c2c(0xac)][_0xd52c2c(0xb3)]??![],'isDangerous':_0x1bfe39[_0xd52c2c(0xac)][_0xd52c2c(0xae)],'tables':_0x1bfe39['tables'],'parameters':_0x1bfe39['parameters'],'message':_0x1bfe39[_0xd52c2c(0xd4)]};_0x1bfe39[_0xd52c2c(0xac)][_0xd52c2c(0xbe)]&&(_0xdef032['reason']=_0x1bfe39[_0xd52c2c(0xac)][_0xd52c2c(0xbe)]);if(_0x19ca7c&&_0x1bfe39[_0xd52c2c(0xcc)]){const _0x404432=_0x19ca7c[_0xd52c2c(0xc6)](',')['map'](_0x45811f=>_0x45811f[_0xd52c2c(0xc9)]())[_0xd52c2c(0xa7)](Boolean),_0x49c4fc=[],_0x848c00=[],_0x4dca9c=filterDbTableBackedDatasets(await listDatasets(_0x68e7f7[_0xd52c2c(0xb0)])),_0x297a80=new Map(_0x4dca9c['map'](_0x268c00=>[_0x268c00[_0xd52c2c(0xe8)]?.[_0xd52c2c(0xba)]?.['toLowerCase'](),_0x268c00]));for(const _0x194f03 of _0x1bfe39[_0xd52c2c(0xd1)]){const _0x41fdd3=_0x297a80[_0xd52c2c(0xc3)](_0x194f03[_0xd52c2c(0xd8)]());!_0x41fdd3&&_0x49c4fc[_0xd52c2c(0xb2)](_0xd52c2c(0xe0)+_0x194f03+_0xd52c2c(0xe5));}for(const _0x45b8bb of _0x404432){let _0x21a03f;try{_0x21a03f=await getDatasetDetail(_0x45b8bb);}catch{_0x49c4fc[_0xd52c2c(0xb2)](_0xd52c2c(0xcd)+_0x45b8bb+_0xd52c2c(0xb1));continue;}assertDatasetIsDbTableBacked(_0x21a03f,_0xd52c2c(0xbb));const _0x5dd719=Array['isArray'](_0x21a03f[_0xd52c2c(0xe3)])?_0x21a03f[_0xd52c2c(0xe3)]:[],_0x125c6b=new Set(_0x5dd719['map'](_0x53b8a8=>_0x53b8a8['name']?.['toLowerCase']())),_0x3374d9=_0x21a03f[_0xd52c2c(0xe8)]?.[_0xd52c2c(0xba)]||_0x21a03f['tableName']||_0x45b8bb;_0xdef032[_0xd52c2c(0xad)+_0x3374d9]={'code':_0x45b8bb,'tableName':_0x3374d9,'fieldCount':_0x125c6b[_0xd52c2c(0xc4)],'fields':Array[_0xd52c2c(0xb5)](_0x125c6b)};if(_0x3e723f){const _0x35ea11=normalizeDatasetIndexes(_0x21a03f);_0x848c00[_0xd52c2c(0xb2)]({'tableName':_0x3374d9,..._0x35ea11});}}_0x49c4fc[_0xd52c2c(0xbf)]>0x0&&(_0xdef032[_0xd52c2c(0xa5)]=_0x49c4fc),_0x3e723f&&(_0xdef032[_0xd52c2c(0xa1)]=auditSqlJoinIndexes(_0x1d0aaf,_0x848c00));}return{'ok':_0x1bfe39[_0xd52c2c(0xcc)],'data':_0xdef032,'message':_0x1bfe39[_0xd52c2c(0xd4)]};}};function normalizeDatasetIndexes(_0x12065f){const _0x590896=a246_0x4159c7,_0xf49248=Array[_0x590896(0xe2)](_0x12065f?.[_0x590896(0xb7)]?.[_0x590896(0xa4)])?_0x12065f['dataset'][_0x590896(0xa4)]:Array['isArray'](_0x12065f?.[_0x590896(0xa4)])?_0x12065f['indexes']:[],_0x2a0340=_0xf49248[_0x590896(0xa3)](_0x466609=>{const _0x4178e3=_0x590896,_0x2281b2=Array[_0x4178e3(0xe2)](_0x466609?.[_0x4178e3(0xc7)])?_0x466609[_0x4178e3(0xc7)]:Array[_0x4178e3(0xe2)](_0x466609?.[_0x4178e3(0xb6)])?_0x466609[_0x4178e3(0xb6)]:Array[_0x4178e3(0xe2)](_0x466609?.[_0x4178e3(0xa8)])?_0x466609[_0x4178e3(0xa8)]:[],_0x552883=_0x2281b2['filter'](_0x17e4b8=>typeof _0x17e4b8===_0x4178e3(0xdf))[_0x4178e3(0xd7)](_0xd684f5=>_0xd684f5[_0x4178e3(0xc9)]())[_0x4178e3(0xa7)](Boolean);if(_0x552883[_0x4178e3(0xbf)]===0x0)return[];const _0x5667b3=[_0x466609?.[_0x4178e3(0xd9)],_0x466609?.[_0x4178e3(0xe1)],_0x466609?.[_0x4178e3(0xda)]][_0x4178e3(0xc2)](_0x116535=>typeof _0x116535===_0x4178e3(0xdf)&&_0x116535[_0x4178e3(0xc9)]()),_0x5552bf=[_0x466609?.[_0x4178e3(0xbd)],_0x466609?.[_0x4178e3(0xc0)]]['find'](_0x8b426d=>typeof _0x8b426d==='string'&&_0x8b426d[_0x4178e3(0xc9)]());return[{..._0x5667b3?{'name':_0x5667b3[_0x4178e3(0xc9)]()}:{},..._0x5552bf?{'type':_0x5552bf[_0x4178e3(0xc9)]()}:{},'columns':_0x552883}];}),_0x3cc8f3=[..._0x2a0340],_0x1c039b=typeof _0x12065f?.[_0x590896(0xe8)]?.[_0x590896(0xca)]==='string'?_0x12065f[_0x590896(0xe8)][_0x590896(0xca)][_0x590896(0xc6)](',')['map'](_0x4e1bde=>_0x4e1bde[_0x590896(0xc9)]())['filter'](Boolean):[];return _0x1c039b[_0x590896(0xbf)]>0x0&&_0x3cc8f3[_0x590896(0xdd)]({'type':_0x590896(0xd0),'columns':_0x1c039b}),{'indexes':_0x3cc8f3,'metadataAvailable':_0x2a0340[_0x590896(0xbf)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a247_0x5ad4(_0x3ef3dc,_0x45836c){_0x3ef3dc=_0x3ef3dc-0x75;const _0x22b639=a247_0x22b6();let _0x5ad4fb=_0x22b639[_0x3ef3dc];return _0x5ad4fb;}function a247_0x22b6(){const _0x3e4873=['9wudPEr','126680ESlPGn','263488WeDZXk','3dMgpAL','41604eJIiiC','629932izDAji','18IhNQOO','388okqnCk','374TLjJDv','547orgBnV','309036QSUIIX','447530PLVKvr'];a247_0x22b6=function(){return _0x3e4873;};return a247_0x22b6();}(function(_0x4d225b,_0x2c2351){const _0x2e6b62=a247_0x5ad4,_0x1f036b=_0x4d225b();while(!![]){try{const _0x3c3b97=parseInt(_0x2e6b62(0x7d))/0x1*(parseInt(_0x2e6b62(0x7b))/0x2)+parseInt(_0x2e6b62(0x77))/0x3*(parseInt(_0x2e6b62(0x79))/0x4)+parseInt(_0x2e6b62(0x75))/0x5*(-parseInt(_0x2e6b62(0x7a))/0x6)+-parseInt(_0x2e6b62(0x7e))/0x7+parseInt(_0x2e6b62(0x76))/0x8+-parseInt(_0x2e6b62(0x80))/0x9*(-parseInt(_0x2e6b62(0x7f))/0xa)+-parseInt(_0x2e6b62(0x7c))/0xb*(parseInt(_0x2e6b62(0x78))/0xc);if(_0x3c3b97===_0x2c2351)break;else _0x1f036b['push'](_0x1f036b['shift']());}catch(_0x2b4cf9){_0x1f036b['push'](_0x1f036b['shift']());}}}(a247_0x22b6,0x19358));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x2c1fc6=a248_0x51c3;(function(_0x166fbc,_0x19c804){const _0x3f0baf=a248_0x51c3,_0x4dbc04=_0x166fbc();while(!![]){try{const _0x4015f4=-parseInt(_0x3f0baf(0x1ea))/0x1+-parseInt(_0x3f0baf(0x1f0))/0x2*(parseInt(_0x3f0baf(0x1eb))/0x3)+-parseInt(_0x3f0baf(0x1e5))/0x4*(parseInt(_0x3f0baf(0x1e6))/0x5)+parseInt(_0x3f0baf(0x1e1))/0x6*(-parseInt(_0x3f0baf(0x1f2))/0x7)+-parseInt(_0x3f0baf(0x1ec))/0x8+parseInt(_0x3f0baf(0x1ee))/0x9+parseInt(_0x3f0baf(0x1df))/0xa;if(_0x4015f4===_0x19c804)break;else _0x4dbc04['push'](_0x4dbc04['shift']());}catch(_0x4d930b){_0x4dbc04['push'](_0x4dbc04['shift']());}}}(a248_0x3703,0x77615));function a248_0x51c3(_0x4c47fc,_0xee9e0c){_0x4c47fc=_0x4c47fc-0x1df;const _0x3703d2=a248_0x3703();let _0x51c3f9=_0x3703d2[_0x4c47fc];return _0x51c3f9;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a248_0x3703(){const _0x2d0f60=['274ziOoBQ','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','1309Aqsuyl','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','flagMissing','appCode','16805210wIubOh','task-id','5694dFoXUL','taskId','apiError','str','67540BrOpIH','145tZitlW','isTerminal',',\x20received\x20','task','829975QSPYgT','10338kWelUk','1498608drucHU','status','8684919jcGkuO','trim'];a248_0x3703=function(){return _0x2d0f60;};return a248_0x3703();}export const taskStatus={'service':a248_0x2c1fc6(0x1e9),'command':a248_0x2c1fc6(0x1ed),'description':a248_0x2c1fc6(0x1f3),'risk':'read','defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a248_0x2c1fc6(0x1e0),'type':'string','required':!![],'description':a248_0x2c1fc6(0x1f1)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x608a3a){const _0x5886b2=a248_0x2c1fc6;if(!_0x608a3a[_0x5886b2(0x1e4)](_0x5886b2(0x1e0))[_0x5886b2(0x1ef)]())throw CliErrors[_0x5886b2(0x1f5)](_0x5886b2(0x1e0));},async 'execute'(_0x5cece1){const _0x467fca=a248_0x2c1fc6,_0x4a1383=_0x5cece1[_0x467fca(0x1e4)]('task-id')[_0x467fca(0x1ef)](),_0x1d08f1=normalizeAsyncTask(await getAsyncTaskStatus(_0x4a1383,_0x5cece1[_0x467fca(0x1f6)],_0x5cece1['cookie']));if(_0x1d08f1[_0x467fca(0x1e2)]!==_0x4a1383)throw CliErrors[_0x467fca(0x1e3)](_0x467fca(0x1f4)+_0x4a1383+_0x467fca(0x1e8)+_0x1d08f1[_0x467fca(0x1e2)]+'.');const _0x178ad1=buildAsyncTaskStatusCommand(_0x1d08f1[_0x467fca(0x1e2)],_0x5cece1[_0x467fca(0x1f6)]);return{'ok':!![],'message':asyncTaskMessage(_0x1d08f1),'data':{'appCode':_0x5cece1[_0x467fca(0x1f6)],..._0x1d08f1,'query':_0x1d08f1[_0x467fca(0x1e7)]?null:{'command':_0x178ad1}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a249_0x393e(_0x41d5fd,_0x26ba11){_0x41d5fd=_0x41d5fd-0x1a3;const _0x4bb02f=a249_0x4bb0();let _0x393e37=_0x4bb02f[_0x41d5fd];return _0x393e37;}(function(_0x5b91fd,_0x3e6c40){const _0x466c0a=a249_0x393e,_0x5c31ef=_0x5b91fd();while(!![]){try{const _0x440fc3=parseInt(_0x466c0a(0x1ad))/0x1*(-parseInt(_0x466c0a(0x1ab))/0x2)+parseInt(_0x466c0a(0x1a9))/0x3*(parseInt(_0x466c0a(0x1a3))/0x4)+parseInt(_0x466c0a(0x1a4))/0x5*(parseInt(_0x466c0a(0x1a8))/0x6)+-parseInt(_0x466c0a(0x1a5))/0x7+-parseInt(_0x466c0a(0x1a6))/0x8*(-parseInt(_0x466c0a(0x1a7))/0x9)+parseInt(_0x466c0a(0x1ae))/0xa+-parseInt(_0x466c0a(0x1aa))/0xb*(parseInt(_0x466c0a(0x1ac))/0xc);if(_0x440fc3===_0x3e6c40)break;else _0x5c31ef['push'](_0x5c31ef['shift']());}catch(_0x322153){_0x5c31ef['push'](_0x5c31ef['shift']());}}}(a249_0x4bb0,0xe0067));function a249_0x4bb0(){const _0x170cb8=['415498PmiXGI','28271736GiZvPJ','1iZtWXc','3233620PXtdqm','4132KgPdBA','8777815nrjqKa','6296654OpIwGl','256664GrJpVl','216XDiRmQ','6uqubCJ','4449InrXoz','11kgbCuw'];a249_0x4bb0=function(){return _0x170cb8;};return a249_0x4bb0();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a250_0x1e1c(_0x4267ac,_0x507341){_0x4267ac=_0x4267ac-0x75;const _0x4b84fe=a250_0x4b84();let _0x1e1cf1=_0x4b84fe[_0x4267ac];return _0x1e1cf1;}const a250_0x5cc9d1=a250_0x1e1c;(function(_0xf2e363,_0x22585c){const _0x4595c8=a250_0x1e1c,_0x3c2654=_0xf2e363();while(!![]){try{const _0x27f998=-parseInt(_0x4595c8(0x76))/0x1+-parseInt(_0x4595c8(0x88))/0x2+parseInt(_0x4595c8(0x83))/0x3+-parseInt(_0x4595c8(0x7e))/0x4*(-parseInt(_0x4595c8(0x84))/0x5)+parseInt(_0x4595c8(0x7b))/0x6+-parseInt(_0x4595c8(0x77))/0x7+-parseInt(_0x4595c8(0x7d))/0x8;if(_0x27f998===_0x22585c)break;else _0x3c2654['push'](_0x3c2654['shift']());}catch(_0x271c08){_0x3c2654['push'](_0x3c2654['shift']());}}}(a250_0x4b84,0xe38f9));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a250_0x4b84(){const _0x417e2e=['4bkzwsi','\x20tenant\x20member(s)','tenant-code','tenant','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','1884138bshWlB','4432045NAKghE','read','members-list','flagMissing','171568IYGGuh','Found\x20','1113471kaUjjO','1202110QmRJBQ','Exact\x20tenant\x20code','trim','length','9287052hSHFVc','str','6073784MioNaL'];a250_0x4b84=function(){return _0x417e2e;};return a250_0x4b84();}import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a250_0x5cc9d1(0x81),'command':a250_0x5cc9d1(0x86),'description':a250_0x5cc9d1(0x82),'risk':a250_0x5cc9d1(0x85),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a250_0x5cc9d1(0x80),'type':'string','required':!![],'description':a250_0x5cc9d1(0x78)}],async 'validate'(_0x4d3c84){const _0x2d8e7d=a250_0x5cc9d1;if(!_0x4d3c84[_0x2d8e7d(0x7c)](_0x2d8e7d(0x80))[_0x2d8e7d(0x79)]())throw CliErrors[_0x2d8e7d(0x87)](_0x2d8e7d(0x80),'Pass\x20--tenant-code\x20<code>.');},async 'execute'(_0x269437){const _0x32e0e4=a250_0x5cc9d1,_0x17b76a=_0x269437[_0x32e0e4(0x7c)](_0x32e0e4(0x80))[_0x32e0e4(0x79)](),_0x1fb72f=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x17b76a,_0x1fb72f);const _0x1b9e68=projectTenantMembers(await listTenantDirectoryMembers(_0x17b76a));return{'ok':!![],'data':{'tenantCode':_0x17b76a,'items':_0x1b9e68,'totalCount':_0x1b9e68[_0x32e0e4(0x7a)]},'message':_0x32e0e4(0x75)+_0x1b9e68[_0x32e0e4(0x7a)]+_0x32e0e4(0x7f)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1ab789,_0x5f31b8){const _0x57fb87=a251_0x3623,_0xa9304b=_0x1ab789();while(!![]){try{const _0x2b7765=parseInt(_0x57fb87(0xd5))/0x1*(-parseInt(_0x57fb87(0xdc))/0x2)+parseInt(_0x57fb87(0xd9))/0x3+parseInt(_0x57fb87(0xe1))/0x4+-parseInt(_0x57fb87(0xe3))/0x5*(parseInt(_0x57fb87(0xdd))/0x6)+-parseInt(_0x57fb87(0xd8))/0x7+parseInt(_0x57fb87(0xd1))/0x8*(parseInt(_0x57fb87(0xde))/0x9)+-parseInt(_0x57fb87(0xd2))/0xa;if(_0x2b7765===_0x5f31b8)break;else _0xa9304b['push'](_0xa9304b['shift']());}catch(_0x1d3c50){_0xa9304b['push'](_0xa9304b['shift']());}}}(a251_0x21b5,0xdea96));function a251_0x21b5(){const _0x2daa0f=['values','status','validation','role','isFinite','254416SAwjAl','14440140QZPPGI','trim','ADMIN','1jarpQS','sort','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','2362129tvcetH','5365239aTYsRZ','adminFlag','some','2062638vSkiSG','6JpoKag','171kZfVIw','set','displayName','5967632xfRXQb','userId','798785cazpuz','username'];a251_0x21b5=function(){return _0x2daa0f;};return a251_0x21b5();}import{CliErrors}from'../../errors.js';function a251_0x3623(_0x58c14e,_0x325d68){_0x58c14e=_0x58c14e-0xd1;const _0x21b5c2=a251_0x21b5();let _0x362312=_0x21b5c2[_0x58c14e];return _0x362312;}function textOrNull(_0x322d96){const _0x5a7ce8=a251_0x3623,_0x1807c6=_0x322d96?.[_0x5a7ce8(0xd3)]();return _0x1807c6?_0x1807c6:null;}export function projectTenantMembers(_0x27a44e){const _0x35fa74=a251_0x3623,_0x4fc21a=new Map();for(const _0x3c29e1 of _0x27a44e){const _0x52419a=Number(_0x3c29e1[_0x35fa74(0xe2)]);if(!Number[_0x35fa74(0xe9)](_0x52419a)||_0x52419a<=0x0)continue;const _0x36304e={'userId':_0x52419a,'username':textOrNull(_0x3c29e1[_0x35fa74(0xe4)]),'displayName':textOrNull(_0x3c29e1['nickname']),'role':_0x3c29e1[_0x35fa74(0xda)]===!![]?_0x35fa74(0xd4):'MEMBER','status':textOrNull(_0x3c29e1[_0x35fa74(0xe6)])},_0x42e497=_0x4fc21a['get'](_0x52419a);if(!_0x42e497){_0x4fc21a[_0x35fa74(0xdf)](_0x52419a,_0x36304e);continue;}_0x42e497[_0x35fa74(0xe4)]??=_0x36304e[_0x35fa74(0xe4)],_0x42e497[_0x35fa74(0xe0)]??=_0x36304e['displayName'],_0x42e497[_0x35fa74(0xe6)]??=_0x36304e[_0x35fa74(0xe6)];if(_0x36304e[_0x35fa74(0xe8)]===_0x35fa74(0xd4))_0x42e497[_0x35fa74(0xe8)]='ADMIN';}return[..._0x4fc21a[_0x35fa74(0xe5)]()][_0x35fa74(0xd6)]((_0x5a18fd,_0x302184)=>_0x5a18fd[_0x35fa74(0xe2)]-_0x302184[_0x35fa74(0xe2)]);}export function assertTenantAccessible(_0x3c016e,_0x5461c3){const _0x4f8b2f=a251_0x3623;if(_0x5461c3[_0x4f8b2f(0xdb)](_0x51a3e3=>_0x51a3e3['tenantCode']===_0x3c016e))return;throw CliErrors[_0x4f8b2f(0xe7)]('Tenant\x20\x22'+_0x3c016e+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x4f8b2f(0xd7));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a252_0x4543(){const _0x5e4fda=['1241813YAMbJh','apiError','POST','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','2136dOkbjh','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','validation','user-account','46186RIEKEP','write','1284062anZgmu','1549470mkwWrd','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','4268570VJnlYx','755628ZSijxS','trim','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','ding-talk-user-id','string','689622mQnpsW','str'];a252_0x4543=function(){return _0x5e4fda;};return a252_0x4543();}const a252_0x3fd17a=a252_0x34c6;(function(_0x3dc513,_0x3f21d3){const _0x3182dc=a252_0x34c6,_0x345c90=_0x3dc513();while(!![]){try{const _0x54967d=parseInt(_0x3182dc(0x1f6))/0x1+-parseInt(_0x3182dc(0x200))/0x2+-parseInt(_0x3182dc(0x201))/0x3+-parseInt(_0x3182dc(0x1ed))/0x4+-parseInt(_0x3182dc(0x203))/0x5+parseInt(_0x3182dc(0x1f4))/0x6+-parseInt(_0x3182dc(0x1fe))/0x7*(-parseInt(_0x3182dc(0x1fa))/0x8);if(_0x54967d===_0x3f21d3)break;else _0x345c90['push'](_0x345c90['shift']());}catch(_0x397715){_0x345c90['push'](_0x345c90['shift']());}}}(a252_0x4543,0xdff1a));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';function a252_0x34c6(_0x1235a6,_0x224f42){_0x1235a6=_0x1235a6-0x1ed;const _0x454392=a252_0x4543();let _0x34c666=_0x454392[_0x1235a6];return _0x34c666;}import{CliErrors}from'../../errors.js';const PROVIDER_ID='dingtalk',CURRENT_BINDING_WARNING=a252_0x3fd17a(0x1f1);function readDingTalkUserId(_0x1c324d){const _0x88ab71=a252_0x3fd17a,_0x58f54d=_0x1c324d[_0x88ab71(0x1f5)]('ding-talk-user-id')[_0x88ab71(0x1ee)]();if(!_0x58f54d)throw CliErrors[_0x88ab71(0x1fc)]('--ding-talk-user-id\x20cannot\x20be\x20empty.','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x58f54d;}function buildBindingData(_0x9aa2d7,_0x21d7c2){const _0x367950=a252_0x3fd17a;return{'operation':'bind','selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x9aa2d7},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x9aa2d7,'bound':!![]},'dryRun':_0x21d7c2,'backend':{'method':_0x367950(0x1f8),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a252_0x3fd17a(0x1fd),'command':'dingding-sandbox-bind','description':a252_0x3fd17a(0x1ef),'risk':a252_0x3fd17a(0x1ff),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a252_0x3fd17a(0x1f2),'type':a252_0x3fd17a(0x1f3),'required':!![],'description':a252_0x3fd17a(0x202)}],async 'validate'(_0x25c4f3){readDingTalkUserId(_0x25c4f3);},async 'dryRun'(_0x1ce0b3){const _0xd5bf45=a252_0x3fd17a,_0x22dc0f=readDingTalkUserId(_0x1ce0b3);return asDryRunResult(buildBindingData(_0x22dc0f,!![]),{'method':_0xd5bf45(0x1f8),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x4727ce){const _0x5b58a1=a252_0x3fd17a,_0x1a43d1=readDingTalkUserId(_0x4727ce),_0x1673ff=await bindDingTalkSandboxAccount(_0x1a43d1);if(_0x1673ff!==!![])throw CliErrors[_0x5b58a1(0x1f7)](_0x5b58a1(0x1f0),_0x5b58a1(0x1f9));return{'ok':!![],'data':buildBindingData(_0x1a43d1,![]),'message':_0x5b58a1(0x1fb)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a253_0x586cae=a253_0x260e;(function(_0x4b6a0d,_0x2e1cc1){const _0x4e2147=a253_0x260e,_0x189469=_0x4b6a0d();while(!![]){try{const _0x3c0e79=parseInt(_0x4e2147(0x13b))/0x1*(parseInt(_0x4e2147(0x124))/0x2)+parseInt(_0x4e2147(0x134))/0x3*(parseInt(_0x4e2147(0x12b))/0x4)+parseInt(_0x4e2147(0x12e))/0x5+parseInt(_0x4e2147(0x13a))/0x6+-parseInt(_0x4e2147(0x133))/0x7*(parseInt(_0x4e2147(0x136))/0x8)+parseInt(_0x4e2147(0x122))/0x9*(parseInt(_0x4e2147(0x128))/0xa)+parseInt(_0x4e2147(0x12d))/0xb*(-parseInt(_0x4e2147(0x12a))/0xc);if(_0x3c0e79===_0x2e1cc1)break;else _0x189469['push'](_0x189469['shift']());}catch(_0x2bb239){_0x189469['push'](_0x189469['shift']());}}}(a253_0x3480,0xd3dac));import{asDryRunResult}from'../../commands/common/dry-run.js';function a253_0x260e(_0x6420f0,_0x322eba){_0x6420f0=_0x6420f0-0x122;const _0x3480c3=a253_0x3480();let _0x260ef7=_0x3480c3[_0x6420f0];return _0x260ef7;}import{bindFeishuAccount,FEISHU_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a253_0x586cae(0x125),CURRENT_BINDING_WARNING='The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.';function a253_0x3480(){const _0x5e34dd=['bind','test','9904584NWMSKn','20408ItaSLE','9sjFzJC','Verify\x20the\x20current\x20binding\x20through\x20the\x20platform\x20before\x20explicitly\x20retrying;\x20do\x20not\x20automatically\x20retry.','38lhWBep','feishu','Bound\x20current\x20user\x20to\x20Feishu\x20account.','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20Feishu\x20account','5039290ZzVcsi','--union-id\x20must\x20match\x20on_\x20followed\x20by\x20letters,\x20digits,\x20underscores,\x20or\x20hyphens.','10220472rAaCZs','33092PbrFVl','trim','44vWYJbx','6629125BbvVaj','POST','validation','str','Feishu\x20account\x20binding\x20was\x20not\x20confirmed.','21BgJmNt','543Xxivds','union-id','2909608jvYCUY','write'];a253_0x3480=function(){return _0x5e34dd;};return a253_0x3480();}function readUnionId(_0x131a47){const _0x14fdc6=a253_0x586cae,_0x436db1=_0x131a47[_0x14fdc6(0x131)]('union-id')[_0x14fdc6(0x12c)]();if(!/^on_[A-Za-z0-9_-]+$/[_0x14fdc6(0x139)](_0x436db1))throw CliErrors[_0x14fdc6(0x130)](_0x14fdc6(0x129),'Pass\x20a\x20Feishu\x20union\x20id\x20such\x20as\x20on_example_001.');return _0x436db1;}function buildBindingData(_0x3e0792,_0x5ce2d3){const _0x46dde5=a253_0x586cae;return{'operation':_0x46dde5(0x138),'selector':{'providerId':PROVIDER_ID,'unionId':_0x3e0792},'before':null,'after':{'providerId':PROVIDER_ID,'unionId':_0x3e0792,'bound':!![]},'dryRun':_0x5ce2d3,'backend':{'method':_0x46dde5(0x12f),'path':FEISHU_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const feishuBind={'service':'user-account','command':'feishu-bind','description':a253_0x586cae(0x127),'risk':a253_0x586cae(0x137),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a253_0x586cae(0x135),'type':'string','required':!![],'description':'Feishu\x20union_id\x20for\x20the\x20configured\x20Feishu\x20application\x20developer'}],async 'validate'(_0x33d9a5){readUnionId(_0x33d9a5);},async 'dryRun'(_0x44e9d3){const _0x2bf99b=a253_0x586cae,_0x2ac154=readUnionId(_0x44e9d3);return asDryRunResult(buildBindingData(_0x2ac154,!![]),{'method':_0x2bf99b(0x12f),'url':FEISHU_BIND_PATH});},async 'execute'(_0x13a986){const _0xe7c766=a253_0x586cae,_0x255f6f=readUnionId(_0x13a986),_0x2c2da9=await bindFeishuAccount(_0x255f6f);if(_0x2c2da9!==!![])throw CliErrors['apiError'](_0xe7c766(0x132),_0xe7c766(0x123));return{'ok':!![],'data':buildBindingData(_0x255f6f,![]),'message':_0xe7c766(0x126)};}};
|