@lovrabet/rabetbase-cli 2.5.5-beta.2 → 2.5.5-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.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
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a239_0x5d61(){const _0x37420f=['sqlcode','now','execError','Returned\x20','execResult','appCode','SQL\x20execution\x20failed','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','\x20row(s)\x20in\x20','317114zGHoVx','494584RHcFRU','564181QextHM','61972rAcfIh','2540826IciZGq','2916870HMzJdQ','57490AqBxvt','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','exec','str','isArray','string','123vfVeVl','36GOrBvm','params','length','2ipLTGQ','sql','read'];a239_0x5d61=function(){return _0x37420f;};return a239_0x5d61();}const a239_0x5078ff=a239_0x53ab;function a239_0x53ab(_0x41422e,_0x23f745){_0x41422e=_0x41422e-0x1d0;const _0x5d61bf=a239_0x5d61();let _0x53ab96=_0x5d61bf[_0x41422e];return _0x53ab96;}(function(_0x47b7f8,_0x1d93c9){const _0x3f8bcc=a239_0x53ab,_0x2d09dc=_0x47b7f8();while(!![]){try{const _0x47b0b0=-parseInt(_0x3f8bcc(0x1e7))/0x1*(-parseInt(_0x3f8bcc(0x1d9))/0x2)+-parseInt(_0x3f8bcc(0x1d5))/0x3*(-parseInt(_0x3f8bcc(0x1e8))/0x4)+-parseInt(_0x3f8bcc(0x1ea))/0x5+-parseInt(_0x3f8bcc(0x1e9))/0x6+parseInt(_0x3f8bcc(0x1e5))/0x7+parseInt(_0x3f8bcc(0x1e6))/0x8+-parseInt(_0x3f8bcc(0x1d6))/0x9*(-parseInt(_0x3f8bcc(0x1eb))/0xa);if(_0x47b0b0===_0x1d93c9)break;else _0x2d09dc['push'](_0x2d09dc['shift']());}catch(_0x18130f){_0x2d09dc['push'](_0x2d09dc['shift']());}}}(a239_0x5d61,0x4ec6e));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a239_0x5078ff(0x1da),'command':a239_0x5078ff(0x1d1),'description':a239_0x5078ff(0x1e3),'risk':a239_0x5078ff(0x1db),'flags':[SQLCODE_FLAG,{'name':a239_0x5078ff(0x1d7),'type':a239_0x5078ff(0x1d4),'description':a239_0x5078ff(0x1d0)}],async 'execute'(_0xffef19){const _0x42127b=a239_0x5078ff,_0x469e91=parseJsonParams(_0xffef19[_0x42127b(0x1d2)]('params')),_0x5d33e3=Date[_0x42127b(0x1dd)](),_0x2c4dac=await executeSql(_0xffef19[_0x42127b(0x1e1)],_0xffef19[_0x42127b(0x1d2)](_0x42127b(0x1dc)),_0x469e91),_0x2195f8=Date[_0x42127b(0x1dd)]()-_0x5d33e3,_0x371d96=_0x2c4dac?.[_0x42127b(0x1e0)]??_0x2c4dac,_0x2bfc1d=_0x2c4dac?.['execSuccess']??!![];if(!_0x2bfc1d)return{'ok':![],'data':{'error':_0x2c4dac?.[_0x42127b(0x1de)]||_0x42127b(0x1e2),'elapsed':_0x2195f8},'message':_0x42127b(0x1e2)};const _0x394fd0=Array[_0x42127b(0x1d3)](_0x371d96)?_0x371d96:[];return{'ok':!![],'data':{'rows':_0x394fd0,'rowCount':_0x394fd0[_0x42127b(0x1d8)],'elapsed':_0x2195f8},'message':_0x42127b(0x1df)+_0x394fd0[_0x42127b(0x1d8)]+_0x42127b(0x1e4)+_0x2195f8+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3d6d51,_0x4fd53f){const _0x1c7300=a240_0x463c,_0x530c5a=_0x3d6d51();while(!![]){try{const _0x249e00=-parseInt(_0x1c7300(0x131))/0x1+-parseInt(_0x1c7300(0x130))/0x2+parseInt(_0x1c7300(0x12b))/0x3+parseInt(_0x1c7300(0x12c))/0x4*(-parseInt(_0x1c7300(0x133))/0x5)+-parseInt(_0x1c7300(0x12d))/0x6*(-parseInt(_0x1c7300(0x132))/0x7)+parseInt(_0x1c7300(0x12f))/0x8+parseInt(_0x1c7300(0x12e))/0x9;if(_0x249e00===_0x4fd53f)break;else _0x530c5a['push'](_0x530c5a['shift']());}catch(_0x37fe06){_0x530c5a['push'](_0x530c5a['shift']());}}}(a240_0x2e26,0xdd482));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a240_0x463c(_0x4c8d7c,_0x523f04){_0x4c8d7c=_0x4c8d7c-0x12b;const _0x2e2623=a240_0x2e26();let _0x463c9a=_0x2e2623[_0x4c8d7c];return _0x463c9a;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a240_0x2e26(){const _0x3c8acb=['4752204qCCuzP','25588MLDfEu','174HJqfJY','7637643ayqNwK','105320QhoAUI','1010244PJvzLK','869393NMlriV','72898sXmDIO','365wnOrdB'];a240_0x2e26=function(){return _0x3c8acb;};return a240_0x2e26();}import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a241_0x143786=a241_0x1969;function a241_0x32ed(){const _0xd8b471=['4213844cEmhxo','List\x20custom\x20SQL\x20queries','str','dbId','sqlCode','string','44xnFbUr','3snqjny','bool','\x20SQL\x20queries\x20(total:\x20','4933ydiKSi','boolean','page','sqlName','list','number','1044730ivThIC','112878xOfiND','474qzzhHN','9WhCPvP','verbose','totalCount','225QpxLMe','name','tableData','description','length','num','Filter\x20by\x20SQL\x20name','2949608syKgbP','Page\x20size','pagesize','622716fvBMOP','appCode','731213tWFZHO','read'];a241_0x32ed=function(){return _0xd8b471;};return a241_0x32ed();}function a241_0x1969(_0xd330c6,_0x33900e){_0xd330c6=_0xd330c6-0x149;const _0x32eda8=a241_0x32ed();let _0x1969fa=_0x32eda8[_0xd330c6];return _0x1969fa;}(function(_0x35a520,_0x24f6b3){const _0x3f7202=a241_0x1969,_0xffdf4=_0x35a520();while(!![]){try{const _0x443c12=parseInt(_0x3f7202(0x164))/0x1*(parseInt(_0x3f7202(0x16c))/0x2)+parseInt(_0x3f7202(0x161))/0x3*(-parseInt(_0x3f7202(0x15a))/0x4)+parseInt(_0x3f7202(0x14c))/0x5*(parseInt(_0x3f7202(0x16b))/0x6)+parseInt(_0x3f7202(0x158))/0x7+-parseInt(_0x3f7202(0x153))/0x8+parseInt(_0x3f7202(0x149))/0x9*(parseInt(_0x3f7202(0x16a))/0xa)+parseInt(_0x3f7202(0x160))/0xb*(-parseInt(_0x3f7202(0x156))/0xc);if(_0x443c12===_0x24f6b3)break;else _0xffdf4['push'](_0xffdf4['shift']());}catch(_0x35ea46){_0xffdf4['push'](_0xffdf4['shift']());}}}(a241_0x32ed,0x913d8));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a241_0x143786(0x168),'description':a241_0x143786(0x15b),'risk':a241_0x143786(0x159),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a241_0x143786(0x14d),'type':a241_0x143786(0x15f),'description':a241_0x143786(0x152)},{'name':a241_0x143786(0x166),'type':a241_0x143786(0x169),'description':'Page\x20number','default':0x1},{'name':a241_0x143786(0x155),'type':'number','description':a241_0x143786(0x154)},{'name':a241_0x143786(0x14a),'type':a241_0x143786(0x165),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x4982ad){const _0x384ccc=a241_0x143786,_0x23e572=await listSqlQueries(_0x4982ad[_0x384ccc(0x157)],{'sqlCode':_0x4982ad[_0x384ccc(0x15c)]('sqlcode')||undefined,'sqlName':_0x4982ad[_0x384ccc(0x15c)]('name')||undefined,'currentPage':_0x4982ad[_0x384ccc(0x151)](_0x384ccc(0x166)),'pageSize':_0x4982ad[_0x384ccc(0x151)](_0x384ccc(0x155),0x32)}),_0x5222ca=_0x4982ad[_0x384ccc(0x162)](_0x384ccc(0x14a)),_0x2b070f=_0x23e572[_0x384ccc(0x14e)]??[],_0x400764=_0x23e572['paging']?.[_0x384ccc(0x14b)]??_0x2b070f[_0x384ccc(0x150)];let _0x5a2283;return _0x5222ca?_0x5a2283=_0x2b070f:_0x5a2283=await Promise['all'](_0x2b070f['map'](async _0x484398=>{const _0x4160b9=_0x384ccc;let _0x5bc28a;try{_0x5bc28a=_0x484398[_0x4160b9(0x15d)]?await getDbName(_0x4982ad[_0x4160b9(0x157)],_0x484398['dbId']):undefined;}catch{}return{'sqlCode':_0x484398[_0x4160b9(0x15e)],'sqlName':_0x484398[_0x4160b9(0x167)],'description':_0x484398[_0x4160b9(0x14f)]??'','db':_0x5bc28a?_0x5bc28a+'\x20('+_0x484398[_0x4160b9(0x15d)]+')':_0x484398[_0x4160b9(0x15d)]??''};})),{'ok':!![],'data':_0x5a2283,'message':_0x2b070f[_0x384ccc(0x150)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x2b070f[_0x384ccc(0x150)]+_0x384ccc(0x163)+_0x400764+').'};}};
|
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_0x5521f9=a242_0x2f02;(function(_0x18e9ae,_0x4f9cac){const _0x2f498c=a242_0x2f02,_0x1bab5b=_0x18e9ae();while(!![]){try{const _0x103ffb=-parseInt(_0x2f498c(0x1bd))/0x1+-parseInt(_0x2f498c(0x1b5))/0x2+parseInt(_0x2f498c(0x1c3))/0x3+-parseInt(_0x2f498c(0x185))/0x4+-parseInt(_0x2f498c(0x1b0))/0x5+-parseInt(_0x2f498c(0x188))/0x6*(-parseInt(_0x2f498c(0x1a3))/0x7)+parseInt(_0x2f498c(0x18c))/0x8;if(_0x103ffb===_0x4f9cac)break;else _0x1bab5b['push'](_0x1bab5b['shift']());}catch(_0x48f1aa){_0x1bab5b['push'](_0x1bab5b['shift']());}}}(a242_0x23b2,0x964a3));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a242_0x23b2(){const _0x15403b=['paging','Filter\x20by\x20SQL\x20display\x20name','apps','endsWith','toLowerCase','path','sqlName','\x20skipped,\x20','1954224VTxdxf','some','POST','910668WApRUW','sqlRoot','trim','sqlCode','7288304UnHexn','sqlContent','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20overwrite\x20local\x20unsynced\x20changes','replace','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','tableData','read','test','totalCount','content','isCanonical','would_pull','filter','boolean','lastSync','push','appCode','sql','force','description','sqlRootDir','35XRnjyG','Pull\x20complete:\x20','unchanged','map','mybatisXml','pull','\x20written,\x20','filePath','cancelled','length','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','skipped','dbId','839705XuVymG','message','file','lockFilePath','nonInteractive','1471414MXraxW','hash','equivalent','all','name','find','sqls','toISOString','826537eEKzwC','utf8','join','\x20failed','sqlcode','conflict','3493200SMXYCD','mode','str'];a242_0x23b2=function(){return _0x15403b;};return a242_0x23b2();}async function fetchAllSqlQueries(_0x23bcc9,_0x43ced8){const _0x2fb091=a242_0x2f02,_0x30c4c9=[];let _0x3f200d=0x1;while(!![]){const _0x36bb8b=await listSqlQueries(_0x23bcc9,{'currentPage':_0x3f200d,'pageSize':PAGE_SIZE,'sqlCode':_0x43ced8[_0x2fb091(0x18b)],'sqlName':_0x43ced8[_0x2fb091(0x183)]}),_0x5aa797=_0x36bb8b[_0x2fb091(0x193)]??[];_0x30c4c9['push'](..._0x5aa797);if(_0x5aa797[_0x2fb091(0x1ac)]===0x0)break;const _0x5ec7c8=_0x36bb8b[_0x2fb091(0x1c6)]?.[_0x2fb091(0x196)];if(_0x5ec7c8!=null?_0x30c4c9[_0x2fb091(0x1ac)]>=_0x5ec7c8:_0x5aa797['length']<PAGE_SIZE)break;_0x3f200d++;}return _0x30c4c9;}async function ensureSqlContent(_0x12a33f){const _0x95a131=a242_0x2f02;if(_0x12a33f[_0x95a131(0x18d)]!=null&&String(_0x12a33f[_0x95a131(0x18d)])[_0x95a131(0x1ac)]>0x0)return _0x12a33f;return getSqlQueryDetail(_0x12a33f[_0x95a131(0x18b)]);}export const sqlPull={'service':a242_0x5521f9(0x19f),'command':a242_0x5521f9(0x1a8),'description':a242_0x5521f9(0x1ad),'risk':a242_0x5521f9(0x194),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a242_0x5521f9(0x1b9),'type':'string','description':a242_0x5521f9(0x1c7)},{'name':a242_0x5521f9(0x1a0),'type':a242_0x5521f9(0x19b),'description':a242_0x5521f9(0x190)}],async 'dryRun'(_0x4a55b0){const _0x13da3f=a242_0x5521f9,_0x110655=loadSqlProjectConfig(_0x4a55b0[_0x13da3f(0x19e)]),_0x2091ce=await readSqlLockFile(_0x110655[_0x13da3f(0x1b3)]),{appLock:_0x5ceed8}=ensureSqlLockScope(_0x2091ce??createEmptySqlLock(),_0x110655[_0x13da3f(0x19e)],_0x110655['sqlRoot'],_0x13da3f(0x1a8)),_0x551cee=await fetchAllSqlQueries(_0x4a55b0[_0x13da3f(0x19e)],{'sqlCode':_0x4a55b0[_0x13da3f(0x1c5)](_0x13da3f(0x1c1))||undefined,'sqlName':_0x4a55b0[_0x13da3f(0x1c5)]('name')||undefined}),_0x5697f4=[];for(const _0x7b1a1a of _0x551cee){const _0x2377b6=await ensureSqlContent(_0x7b1a1a),_0x4dcee7=ensureRemoteSqlContent(_0x2377b6),_0x38ee9a=detectSqlMode(_0x4dcee7),_0x12965e=_0x2377b6[_0x13da3f(0x1af)]?await getDbName(_0x4a55b0['appCode'],Number(_0x2377b6[_0x13da3f(0x1af)]))['catch'](()=>undefined):undefined,_0x11d38f=buildLocalSqlFileContent({'sqlCode':_0x2377b6[_0x13da3f(0x18b)],'sqlName':_0x2377b6[_0x13da3f(0x183)],'dbId':_0x2377b6[_0x13da3f(0x1af)]},_0x4dcee7,{'dbName':_0x12965e,'mode':_0x38ee9a,'syncedAt':new Date()[_0x13da3f(0x1bc)](),'description':_0x2377b6[_0x13da3f(0x1a1)]}),_0x31e012=buildSqlLockEntry(_0x2377b6,_0x4dcee7,'',{'dbName':_0x12965e}),_0x2fd890=resolveLocalSqlFilePath(_0x110655,_0x2377b6[_0x13da3f(0x18b)],_0x31e012);let _0xf01603=_0x13da3f(0x199),_0x3013b8;const _0x30851a=await findExistingSqlFiles(_0x110655,_0x2fd890,_0x38ee9a,_0x5ceed8[_0x13da3f(0x1bb)][_0x2377b6['sqlCode']]);if(_0x30851a[_0x13da3f(0x1ac)]>0x0){const _0x13f387=await compareExistingSqlFiles(_0x30851a,_0x11d38f,_0x38ee9a);if(_0x13f387[_0x13da3f(0x186)](({equivalent:_0x3cfffd})=>!_0x3cfffd))_0xf01603=_0x13da3f(0x1c2),_0x3013b8=_0x13da3f(0x18e);else _0x13f387[_0x13da3f(0x1ac)]===0x1&&_0x13f387[0x0]?.[_0x13da3f(0x1b2)][_0x13da3f(0x198)]&&(_0xf01603=_0x13da3f(0x1ae),_0x3013b8=_0x13da3f(0x1a5));}_0x5697f4[_0x13da3f(0x19d)]({'sqlCode':_0x2377b6[_0x13da3f(0x18b)],'sqlName':_0x2377b6[_0x13da3f(0x183)],'filePath':_0x2fd890,'status':_0xf01603,'reason':_0x3013b8});}return{'method':_0x13da3f(0x187),'url':_0x13da3f(0x18f),'body':{'appCode':_0x4a55b0[_0x13da3f(0x19e)],'sqlCode':_0x4a55b0[_0x13da3f(0x1c5)](_0x13da3f(0x1c1))||null,'sqlName':_0x4a55b0['str'](_0x13da3f(0x1b9))||null,'files':_0x5697f4},'description':'Would\x20pull\x20'+_0x5697f4['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x110655['sqlRootDir']};},async 'execute'(_0x21dcac){const _0x204973=a242_0x5521f9,_0x44878a=loadSqlProjectConfig(_0x21dcac['appCode']),_0xb8cfb=await readSqlLockFile(_0x44878a['lockFilePath']),{lockData:_0x4949ff,appLock:_0x547801}=ensureSqlLockScope(_0xb8cfb??createEmptySqlLock(),_0x44878a['appCode'],_0x44878a[_0x204973(0x189)],_0x204973(0x1a8)),_0x2b5609=_0x21dcac['bool'](_0x204973(0x1a0)),_0x4564e7=await fetchAllSqlQueries(_0x21dcac['appCode'],{'sqlCode':_0x21dcac[_0x204973(0x1c5)](_0x204973(0x1c1))||undefined,'sqlName':_0x21dcac[_0x204973(0x1c5)](_0x204973(0x1b9))||undefined});if(_0x4564e7[_0x204973(0x1ac)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x2b9e26=[],_0x396b44=[];for(const _0x1a5338 of _0x4564e7){try{_0x2b9e26[_0x204973(0x19d)](await ensureSqlContent(_0x1a5338));}catch(_0x57d734){_0x396b44['push']({'sqlCode':_0x1a5338[_0x204973(0x18b)],'error':_0x57d734 instanceof Error?_0x57d734['message']:String(_0x57d734)});}}if(_0x2b5609&&!_0x21dcac[_0x204973(0x1b4)]){let _0x20b904=![];for(const _0x11fbb4 of _0x2b9e26){const _0x319bae=detectSqlMode(ensureRemoteSqlContent(_0x11fbb4)),_0x420532=_0x11fbb4[_0x204973(0x1af)]?await getDbName(_0x21dcac['appCode'],Number(_0x11fbb4['dbId']))['catch'](()=>undefined):undefined,_0x57330f=buildLocalSqlFileContent({'sqlCode':_0x11fbb4['sqlCode'],'sqlName':_0x11fbb4[_0x204973(0x183)],'dbId':_0x11fbb4[_0x204973(0x1af)]},ensureRemoteSqlContent(_0x11fbb4),{'dbName':_0x420532,'mode':_0x319bae,'syncedAt':new Date()['toISOString'](),'description':_0x11fbb4[_0x204973(0x1a1)]}),_0x3e9697=resolveLocalSqlFilePath(_0x44878a,_0x11fbb4[_0x204973(0x18b)],buildSqlLockEntry(_0x11fbb4,ensureRemoteSqlContent(_0x11fbb4),'',{'dbName':_0x420532})),_0x285a4b=await findExistingSqlFiles(_0x44878a,_0x3e9697,_0x319bae,_0x547801[_0x204973(0x1bb)][_0x11fbb4[_0x204973(0x18b)]]),_0x8386e3=await compareExistingSqlFiles(_0x285a4b,_0x57330f,_0x319bae);if(_0x8386e3[_0x204973(0x186)](({equivalent:_0x42f1c8})=>!_0x42f1c8)){_0x20b904=!![];break;}}if(_0x20b904){const _0x1f43ce=await confirmForceOverwrite(_0x204973(0x192));if(!_0x1f43ce)throw CliErrors[_0x204973(0x1ab)]('Force\x20pull\x20cancelled.');}}const _0x1c6ec8=cloneSqlLockData(_0x4949ff),_0xd15ef8=_0x1c6ec8[_0x204973(0x1c8)][_0x44878a[_0x204973(0x19e)]],_0x501e92=[],_0x2aa60d=[];for(const _0x4331c0 of _0x2b9e26){const _0xcd9185=_0xd15ef8[_0x204973(0x1bb)][_0x4331c0[_0x204973(0x18b)]],_0x34484c=ensureRemoteSqlContent(_0x4331c0),_0x7469b8=detectSqlMode(_0x34484c),_0x3e9234=_0x4331c0[_0x204973(0x1af)]?await getDbName(_0x21dcac['appCode'],Number(_0x4331c0[_0x204973(0x1af)]))['catch'](()=>undefined):undefined,_0x56161b=buildLocalSqlFileContent({'sqlCode':_0x4331c0['sqlCode'],'sqlName':_0x4331c0[_0x204973(0x183)],'dbId':_0x4331c0['dbId']},_0x34484c,{'dbName':_0x3e9234,'mode':_0x7469b8,'syncedAt':new Date()[_0x204973(0x1bc)](),'description':_0x4331c0[_0x204973(0x1a1)]}),_0x4c0df2=buildSqlLockEntry(_0x4331c0,_0x34484c,computeSqlContentHash(_0x56161b),{'dbName':_0x3e9234}),_0x36f4cb=_0x4c0df2[_0x204973(0x182)],_0x381b34=join(_0x44878a[_0x204973(0x1a2)],_0x36f4cb);try{const _0x113529=await findExistingSqlFiles(_0x44878a,_0x381b34,_0x7469b8,_0xcd9185),_0x587d0f=await compareExistingSqlFiles(_0x113529,_0x56161b,_0x7469b8);if(!_0x2b5609&&_0x587d0f['some'](({equivalent:_0x9d5da1})=>!_0x9d5da1)){_0x2aa60d[_0x204973(0x19d)]({'sqlCode':_0x4331c0[_0x204973(0x18b)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x206d37=_0x587d0f[_0x204973(0x1ba)](({file:_0x324997})=>_0x324997[_0x204973(0x198)]),_0x279c69=_0x587d0f['find'](({file:_0x12ecef})=>!_0x12ecef[_0x204973(0x198)]);if(_0x206d37?.[_0x204973(0x1b7)]&&!_0x279c69){_0x2aa60d[_0x204973(0x19d)]({'sqlCode':_0x4331c0['sqlCode'],'reason':_0x204973(0x1a5)}),_0xd15ef8[_0x204973(0x1bb)][_0x4331c0[_0x204973(0x18b)]]={..._0x4c0df2,'hash':computeSqlContentHash(_0x206d37[_0x204973(0x197)]),'path':_0x36f4cb};continue;}!_0x206d37?.[_0x204973(0x1b7)]&&(await ensureParentDirectory(_0x381b34),await writeFile(_0x381b34,_0x56161b,_0x204973(0x1be))),_0x279c69&&await rm(_0x279c69[_0x204973(0x1b2)][_0x204973(0x1aa)],{'force':!![]}),_0xd15ef8['sqls'][_0x4331c0[_0x204973(0x18b)]]={..._0x4c0df2,'hash':_0x206d37?.[_0x204973(0x1b7)]?computeSqlContentHash(_0x206d37['content']):_0x4c0df2[_0x204973(0x1b6)],'path':_0x36f4cb},_0x501e92['push']({'sqlCode':_0x4331c0[_0x204973(0x18b)],'filePath':_0x381b34});}catch(_0x35872d){_0x396b44[_0x204973(0x19d)]({'sqlCode':_0x4331c0[_0x204973(0x18b)],'error':_0x35872d instanceof Error?_0x35872d[_0x204973(0x1b1)]:String(_0x35872d)});}}return _0xd15ef8[_0x204973(0x19c)]=new Date()[_0x204973(0x1bc)](),await writeSqlLockFile(_0x44878a[_0x204973(0x1b3)],_0x1c6ec8),{'ok':_0x396b44[_0x204973(0x1ac)]===0x0,'data':{'pulled':_0x501e92,'skipped':_0x2aa60d,'failed':_0x396b44},'message':_0x204973(0x1a4)+_0x501e92[_0x204973(0x1ac)]+_0x204973(0x1a9)+_0x2aa60d[_0x204973(0x1ac)]+_0x204973(0x184)+_0x396b44[_0x204973(0x1ac)]+_0x204973(0x1c0)};}};function isEquivalentPulledSqlFile(_0x171c85,_0x2a89d7,_0x20fe08,_0x5e3006){if(_0x20fe08!==_0x5e3006)return normalizePulledSqlBody(_0x171c85,_0x20fe08)===normalizePulledSqlBody(_0x2a89d7,_0x5e3006);return normalizePullComparableContent(_0x171c85,_0x20fe08)===normalizePullComparableContent(_0x2a89d7,_0x5e3006);}async function findExistingSqlFiles(_0x419370,_0x1704e1,_0x44e5bc,_0x4b4022){const _0x20ff7e=a242_0x5521f9,_0x34f91d=[];await fileExists(_0x1704e1)&&_0x34f91d[_0x20ff7e(0x19d)]({'filePath':_0x1704e1,'mode':_0x44e5bc,'isCanonical':!![]});if(!_0x4b4022?.['path'])return _0x34f91d;const _0x786326=join(_0x419370[_0x20ff7e(0x1a2)],_0x4b4022[_0x20ff7e(0x182)]);if(_0x786326===_0x1704e1)return _0x34f91d;return await fileExists(_0x786326)&&_0x34f91d[_0x20ff7e(0x19d)]({'filePath':_0x786326,'mode':_0x4b4022[_0x20ff7e(0x1c4)]??modeFromFilePath(_0x786326),'isCanonical':![]}),_0x34f91d;}async function compareExistingSqlFiles(_0x3ae75d,_0x5ed55e,_0x20cdcc){const _0x40f0ab=a242_0x5521f9;return Promise[_0x40f0ab(0x1b8)](_0x3ae75d[_0x40f0ab(0x1a6)](async _0xdadf80=>{const _0x30957e=_0x40f0ab,_0x35a8a8=await readFile(_0xdadf80['filePath'],_0x30957e(0x1be));return{'file':_0xdadf80,'content':_0x35a8a8,'equivalent':isEquivalentPulledSqlFile(_0x35a8a8,_0x5ed55e,_0xdadf80[_0x30957e(0x1c4)],_0x20cdcc)};}));}function modeFromFilePath(_0x488340){const _0x3a6cf3=a242_0x5521f9;return _0x488340[_0x3a6cf3(0x1ca)]()[_0x3a6cf3(0x1c9)]('.xml')?_0x3a6cf3(0x1a7):_0x3a6cf3(0x19f);}function normalizePulledSqlBody(_0x5e0962,_0x4128f0){const _0x5ce773=a242_0x5521f9;return stripLocalSqlMetadata(_0x5e0962,_0x4128f0)[_0x5ce773(0x191)](/\r\n/g,'\x0a')[_0x5ce773(0x18a)]();}function normalizePullComparableContent(_0x5a22bc,_0x3cae2a){const _0x24f4a3=a242_0x5521f9,_0x1b7076=_0x5a22bc['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x3cb9d6=_0x1b7076[_0x24f4a3(0x19a)](_0xd8ceb4=>!isSyncedAtMetadataLine(_0xd8ceb4,_0x3cae2a));return _0x3cb9d6[_0x24f4a3(0x1bf)]('\x0a');}function a242_0x2f02(_0x1b8229,_0x33e1cb){_0x1b8229=_0x1b8229-0x182;const _0x23b233=a242_0x23b2();let _0x2f02c9=_0x23b233[_0x1b8229];return _0x2f02c9;}function isSyncedAtMetadataLine(_0x172111,_0x210085){const _0x16da6a=a242_0x5521f9;if(_0x210085==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x16da6a(0x195)](_0x172111);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x172111);}
|
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_0x11a8fa=a243_0x1f13;(function(_0x4f3c31,_0x2598fa){const _0x2187e4=a243_0x1f13,_0x30440e=_0x4f3c31();while(!![]){try{const _0x47606f=parseInt(_0x2187e4(0x167))/0x1+-parseInt(_0x2187e4(0x16a))/0x2*(-parseInt(_0x2187e4(0x149))/0x3)+parseInt(_0x2187e4(0x163))/0x4*(-parseInt(_0x2187e4(0x151))/0x5)+-parseInt(_0x2187e4(0x146))/0x6*(parseInt(_0x2187e4(0x137))/0x7)+parseInt(_0x2187e4(0x15d))/0x8+-parseInt(_0x2187e4(0x14c))/0x9*(-parseInt(_0x2187e4(0x160))/0xa)+parseInt(_0x2187e4(0x162))/0xb*(-parseInt(_0x2187e4(0x16d))/0xc);if(_0x47606f===_0x2598fa)break;else _0x30440e['push'](_0x30440e['shift']());}catch(_0x394961){_0x30440e['push'](_0x30440e['shift']());}}}(a243_0x555f,0x8f5fd));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x208ca8){const _0xab583c=a243_0x1f13,_0x47d576=stripLocalSqlMetadata(await readFile(_0x208ca8[_0xab583c(0x141)],_0xab583c(0x139)),_0x208ca8[_0xab583c(0x156)]);if(!_0x47d576[_0xab583c(0x142)]())throw CliErrors[_0xab583c(0x170)](_0x208ca8[_0xab583c(0x159)]+_0xab583c(0x147));return _0x47d576;}async function getTargetSqlQueries(_0x1df4b1,_0x28dceb,_0x45da15){const _0x4aa277=a243_0x1f13,_0x3166b0=await scanLocalSqlQueries(_0x1df4b1),_0x5b296f=new Map();for(const _0x2b3e63 of _0x3166b0){if(_0x45da15&&_0x2b3e63['sqlCode']!==_0x45da15)continue;const _0xec91f0=_0x5b296f[_0x4aa277(0x12f)](_0x2b3e63[_0x4aa277(0x159)])??[];_0xec91f0[_0x4aa277(0x134)](_0x2b3e63),_0x5b296f[_0x4aa277(0x15b)](_0x2b3e63['sqlCode'],_0xec91f0);}if(_0x45da15&&!_0x5b296f[_0x4aa277(0x148)](_0x45da15))throw CliErrors[_0x4aa277(0x170)](_0x4aa277(0x133)+_0x45da15);const _0x32cbe0=[];for(const [_0x20490e,_0x135fc5]of _0x5b296f[_0x4aa277(0x12c)]()){if(_0x135fc5[_0x4aa277(0x175)]===0x1){_0x32cbe0['push'](_0x135fc5[0x0]);continue;}const _0xb0ea57=_0x28dceb['sqls'][_0x20490e],_0x228e4e=_0xb0ea57?.[_0x4aa277(0x152)],_0xd8071=_0x228e4e?_0x135fc5[_0x4aa277(0x143)](_0x5956e7=>_0x5956e7[_0x4aa277(0x13c)]!==_0x228e4e):_0x135fc5;if(_0xb0ea57&&_0xd8071[_0x4aa277(0x175)]===0x1){_0x32cbe0[_0x4aa277(0x134)](_0xd8071[0x0]);continue;}throw CliErrors[_0x4aa277(0x170)](_0x4aa277(0x12e)+_0x20490e+_0x4aa277(0x171));}return _0x32cbe0;}export const sqlPush={'service':a243_0x11a8fa(0x13f),'command':a243_0x11a8fa(0x134),'description':a243_0x11a8fa(0x14a),'risk':a243_0x11a8fa(0x13b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a243_0x11a8fa(0x164),'description':a243_0x11a8fa(0x16c)}],async 'dryRun'(_0x4957a7){const _0x5b7836=a243_0x11a8fa,_0x5bac7b=loadSqlProjectConfig(_0x4957a7[_0x5b7836(0x169)]),_0xc3934c=await readSqlLockFile(_0x5bac7b['lockFilePath']),{appLock:_0x13265f}=ensureSqlLockScope(_0xc3934c??createEmptySqlLock(),_0x4957a7['appCode'],_0x5bac7b[_0x5b7836(0x166)],_0x5b7836(0x134)),_0x598474=await getTargetSqlQueries(_0x5bac7b,_0x13265f,_0x4957a7[_0x5b7836(0x153)](_0x5b7836(0x15c))||undefined),_0x1aef33=[];for(const _0x3a8b31 of _0x598474){const _0x54c1e6=await computeSqlFileHash(_0x3a8b31[_0x5b7836(0x141)]),_0x17a20a=_0x13265f[_0x5b7836(0x154)][_0x3a8b31[_0x5b7836(0x159)]],_0x289632=!!_0x17a20a&&(_0x17a20a[_0x5b7836(0x152)]!==_0x3a8b31[_0x5b7836(0x13c)]||!!_0x3a8b31['sqlName']&&_0x17a20a['sqlName']!==_0x3a8b31[_0x5b7836(0x168)]||_0x17a20a[_0x5b7836(0x156)]!==_0x3a8b31['mode']);if(!_0x4957a7['bool']('force')&&_0x17a20a&&_0x17a20a['hash']===_0x54c1e6&&!_0x289632)continue;if(!_0x17a20a)throw CliErrors[_0x5b7836(0x170)](_0x3a8b31[_0x5b7836(0x159)]+_0x5b7836(0x12a));if(_0x17a20a[_0x5b7836(0x135)]==null)throw CliErrors[_0x5b7836(0x170)](_0x3a8b31['sqlCode']+_0x5b7836(0x136));await resolveTargetDbBinding(_0x4957a7[_0x5b7836(0x169)],_0x3a8b31,_0x17a20a),await readSqlUploadContent(_0x3a8b31),_0x1aef33[_0x5b7836(0x134)](_0x3a8b31['sqlCode']);}return{'method':_0x5b7836(0x128),'url':_0x5b7836(0x158),'body':{'sqlCodes':_0x1aef33,'appCode':_0x4957a7[_0x5b7836(0x169)]},'description':_0x5b7836(0x14d)+_0x1aef33['length']+_0x5b7836(0x145)};},async 'execute'(_0x356a6b){const _0x301aa5=a243_0x11a8fa,_0x3e1f4b=loadSqlProjectConfig(_0x356a6b['appCode']),_0x1e187e=await readSqlLockFile(_0x3e1f4b[_0x301aa5(0x130)]),{lockData:_0x224c81,appLock:_0x1ed351}=ensureSqlLockScope(_0x1e187e??createEmptySqlLock(),_0x356a6b[_0x301aa5(0x169)],_0x3e1f4b[_0x301aa5(0x166)],_0x301aa5(0x134)),_0x39ba72=await getTargetSqlQueries(_0x3e1f4b,_0x1ed351,_0x356a6b[_0x301aa5(0x153)](_0x301aa5(0x15c))||undefined);if(_0x39ba72[_0x301aa5(0x175)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x2da981=[],_0x3716f3=[],_0x3fa0e8=[];let _0x52866e=![];for(const _0xe4b8b0 of _0x39ba72){const _0xd6c492=_0x1ed351['sqls'][_0xe4b8b0[_0x301aa5(0x159)]];if(!_0xd6c492){_0x3fa0e8[_0x301aa5(0x134)]({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'error':_0x301aa5(0x12b)});continue;}try{const _0xd89caa=await computeSqlFileHash(_0xe4b8b0['filePath']),_0x5b40a4=_0xd6c492['path']!==_0xe4b8b0[_0x301aa5(0x13c)]||!!_0xe4b8b0[_0x301aa5(0x168)]&&_0xd6c492[_0x301aa5(0x168)]!==_0xe4b8b0[_0x301aa5(0x168)]||_0xd6c492[_0x301aa5(0x156)]!==_0xe4b8b0['mode'];if(!_0x356a6b[_0x301aa5(0x140)](_0x301aa5(0x16f))&&_0xd6c492['hash']===_0xd89caa&&!_0x5b40a4){_0x3716f3[_0x301aa5(0x134)]({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'reason':_0x301aa5(0x13a)});continue;}if(_0xd6c492[_0x301aa5(0x135)]==null){_0x3fa0e8['push']({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'error':_0x301aa5(0x138)});continue;}const _0x16da3f=_0xe4b8b0[_0x301aa5(0x168)]||_0xd6c492[_0x301aa5(0x168)],_0x327903=await resolveTargetDbBinding(_0x356a6b['appCode'],_0xe4b8b0,_0xd6c492),_0x2ced9f=await readSqlUploadContent(_0xe4b8b0),_0x1d4877=await updateSqlQuery({'id':_0xd6c492[_0x301aa5(0x16b)],'appCode':_0x356a6b['appCode'],'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'sqlName':_0x16da3f,'dbId':_0x327903['dbId'],'version':_0xd6c492[_0x301aa5(0x135)],'sqlContent':_0x2ced9f,'sqlConfig':_0xd6c492[_0x301aa5(0x16e)]??undefined}),_0x5ecc7f=_0x1d4877[_0x301aa5(0x172)]?await getDbName(_0x356a6b[_0x301aa5(0x169)],Number(_0x1d4877[_0x301aa5(0x172)]))[_0x301aa5(0x174)](()=>_0x327903[_0x301aa5(0x131)]):_0x327903[_0x301aa5(0x131)];_0x1ed351['sqls'][_0xe4b8b0[_0x301aa5(0x159)]]={...buildSqlLockEntry(_0x1d4877,_0x2ced9f,_0xd89caa,{'dbName':_0x5ecc7f}),'path':_0xe4b8b0['relativePath'],'mode':_0xe4b8b0['mode']},_0x52866e=!![],await archivePreviousSqlFileIfNeeded(_0x3e1f4b,_0xd6c492[_0x301aa5(0x152)],_0xe4b8b0[_0x301aa5(0x13c)]),_0x2da981[_0x301aa5(0x134)]({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'remoteId':_0xd6c492[_0x301aa5(0x16b)]});}catch(_0x32a0a1){_0x3fa0e8[_0x301aa5(0x134)]({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'error':_0x32a0a1 instanceof Error?_0x32a0a1[_0x301aa5(0x12d)]:String(_0x32a0a1)});}}(_0x52866e||_0x3fa0e8[_0x301aa5(0x175)]===0x0)&&(_0x1ed351[_0x301aa5(0x14e)]=new Date()[_0x301aa5(0x15f)](),await writeSqlLockFile(_0x3e1f4b[_0x301aa5(0x130)],_0x224c81));const _0x324546=_0x3fa0e8['length']===0x0;return{'ok':_0x324546,'data':{'pushed':_0x2da981,'skipped':_0x3716f3,'failed':_0x3fa0e8},'message':_0x301aa5(0x13e)+_0x2da981[_0x301aa5(0x175)]+'\x20pushed,\x20'+_0x3716f3['length']+_0x301aa5(0x150)+_0x3fa0e8[_0x301aa5(0x175)]+_0x301aa5(0x144)};}};async function archivePreviousSqlFileIfNeeded(_0x146c17,_0x384121,_0x392b7a){const _0x4c4be6=a243_0x11a8fa;if(!_0x384121||_0x384121===_0x392b7a)return;const _0x480be7=join(_0x146c17[_0x4c4be6(0x14b)],_0x384121);if(!await fileExists(_0x480be7))return;const _0x2b851e=await moveToTrash(_0x146c17['projectRoot'],_0x146c17[_0x4c4be6(0x173)],_0x480be7);await cleanupEmptyDirectories(dirname(_0x480be7),_0x146c17['sqlRootDir']),void _0x2b851e;}function a243_0x555f(){const _0x42eacc=['has','3GRNLdi','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlRootDir','9OdgWqO','Would\x20push\x20','lastSync','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20skipped,\x20','2879285OJPdUs','path','str','sqls','startsWith','mode','replace','/smartapi/custom/updateUserCustomSql','sqlCode','Local\x20directory\x20\x22','set','sqlcode','5732232PFLXye','\x22\x20for\x20sqlCode\x20','toISOString','4068580TJSQRj','dbDirectory','7415089eNyTWC','8lRLGfu','boolean','isFinite','sqlRoot','938138cMDiao','sqlName','appCode','1890046GTQZHF','remoteId','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','12IyAuht','sqlConfig','force','validation','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','dbId','trashDir','catch','length','POST','join',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','entries','message','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','get','lockFilePath','dbName','exec','Local\x20SQL\x20not\x20found:\x20','push','version',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','296737HbGcOI','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','utf8','unchanged','write','relativePath','map','Push\x20complete:\x20','sql','bool','filePath','trim','filter','\x20failed','\x20SQL\x20file(s)','84codYhH',':\x20SQL\x20content\x20is\x20empty.'];a243_0x555f=function(){return _0x42eacc;};return a243_0x555f();}async function moveToTrash(_0x56c723,_0x590123,_0x12f475){const _0x348305=a243_0x11a8fa,_0x57fee1=new Date()['toISOString']()[_0x348305(0x157)](/[:.]/g,'-'),_0x43067b=relative(_0x56c723,_0x12f475),_0x4a685d=join(_0x590123,_0x57fee1,_0x43067b);return await mkdir(dirname(_0x4a685d),{'recursive':!![]}),await rename(_0x12f475,_0x4a685d),_0x4a685d;}async function cleanupEmptyDirectories(_0x45b0ec,_0x3527dc){const _0x5f318c=a243_0x11a8fa;let _0x56f701=resolve(_0x45b0ec);const _0x48e01a=resolve(_0x3527dc);while(_0x56f701[_0x5f318c(0x155)](''+_0x48e01a+sep)||_0x56f701===_0x48e01a){if(_0x56f701===_0x48e01a)return;try{const _0x950732=await readdir(_0x56f701);if(_0x950732[_0x5f318c(0x175)]>0x0)return;await rmdir(_0x56f701);}catch{return;}_0x56f701=dirname(_0x56f701);}}async function resolveTargetDbBinding(_0x5ae419,_0xa24a86,_0x3791fd){const _0x569dd3=a243_0x11a8fa,_0x492a56=_0xa24a86[_0x569dd3(0x161)];if(!_0x492a56)return{'dbId':_0x3791fd[_0x569dd3(0x172)],'dbName':_0x3791fd[_0x569dd3(0x131)]};const _0x30012f=buildDbDirectoryName(_0x3791fd[_0x569dd3(0x131)],_0x3791fd[_0x569dd3(0x172)]);if(_0x492a56===_0x30012f)return{'dbId':_0x3791fd[_0x569dd3(0x172)],'dbName':_0x3791fd[_0x569dd3(0x131)]};const _0x403a61=parseExplicitDbDirectory(_0x492a56);if(_0x403a61!=null)return{'dbId':_0x403a61,'dbName':await getDbName(_0x5ae419,_0x403a61)['catch'](()=>undefined)};const _0xcce656=await listDatabases(_0x5ae419),_0xc6cc20=_0xcce656['filter'](_0x1b3e13=>buildDbDirectoryName(_0x1b3e13[_0x569dd3(0x131)],_0x1b3e13['dbId'])===_0x492a56);if(_0xc6cc20['length']===0x1)return{'dbId':_0xc6cc20[0x0][_0x569dd3(0x172)],'dbName':_0xc6cc20[0x0][_0x569dd3(0x131)]};if(_0xc6cc20[_0x569dd3(0x175)]===0x0)throw CliErrors[_0x569dd3(0x170)](_0x569dd3(0x14f)+_0x492a56+_0x569dd3(0x15e)+_0xa24a86['sqlCode']+'.');const _0x4514c0=_0xc6cc20[_0x569dd3(0x13d)](_0x1656b6=>_0x1656b6[_0x569dd3(0x131)]+'\x20('+_0x1656b6[_0x569dd3(0x172)]+')')[_0x569dd3(0x129)](',\x20');throw CliErrors[_0x569dd3(0x170)](_0x569dd3(0x15a)+_0x492a56+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0xa24a86[_0x569dd3(0x159)]+':\x20'+_0x4514c0);}function a243_0x1f13(_0x45223e,_0x1902d1){_0x45223e=_0x45223e-0x128;const _0x555f2b=a243_0x555f();let _0x1f1366=_0x555f2b[_0x45223e];return _0x1f1366;}function parseExplicitDbDirectory(_0x3a3c64){const _0x59b4d5=a243_0x11a8fa,_0x4d1915=/^db-(\d+)$/[_0x59b4d5(0x132)](_0x3a3c64);if(!_0x4d1915)return null;const _0x52f3e8=Number(_0x4d1915[0x1]);return Number[_0x59b4d5(0x165)](_0x52f3e8)&&_0x52f3e8>0x0?_0x52f3e8:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x34df82=a244_0x52f6;(function(_0xfb1b9c,_0x2a6eb8){const _0xa39f86=a244_0x52f6,_0x344a29=_0xfb1b9c();while(!![]){try{const _0x16ee1d=-parseInt(_0xa39f86(0x1a9))/0x1*(parseInt(_0xa39f86(0x19d))/0x2)+-parseInt(_0xa39f86(0x1b1))/0x3+-parseInt(_0xa39f86(0x19a))/0x4*(parseInt(_0xa39f86(0x1c7))/0x5)+parseInt(_0xa39f86(0x1b5))/0x6+-parseInt(_0xa39f86(0x1b9))/0x7*(-parseInt(_0xa39f86(0x1ac))/0x8)+-parseInt(_0xa39f86(0x1a0))/0x9*(parseInt(_0xa39f86(0x1bf))/0xa)+parseInt(_0xa39f86(0x1a1))/0xb;if(_0x16ee1d===_0x2a6eb8)break;else _0x344a29['push'](_0x344a29['shift']());}catch(_0xabfa95){_0x344a29['push'](_0x344a29['shift']());}}}(a244_0x27fc,0x37610));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_0x34df82(0x1b8);export function buildSqlLockEntry(_0x2ce84a,_0x2bdc9b,_0x2f8d91,_0x449f5d){const _0x2782f6=a244_0x34df82,_0x43fd05=detectSqlMode(_0x2bdc9b);return{'path':buildSqlRelativePath(_0x2ce84a['sqlCode'],_0x2ce84a['sqlName'],_0x449f5d?.[_0x2782f6(0x19c)],_0x43fd05,_0x2ce84a['dbId']),'hash':_0x2f8d91,'remoteId':_0x2ce84a['id'],'version':_0x2ce84a[_0x2782f6(0x1a3)],'dbId':Number(_0x2ce84a['dbId']),'dbName':_0x449f5d?.[_0x2782f6(0x19c)],'sqlName':_0x2ce84a['sqlName'],'sqlConfig':_0x2ce84a[_0x2782f6(0x1b3)]??undefined,'mode':_0x43fd05};}export function cloneSqlLockData(_0x1a4cbc){const _0x2bc0ca=a244_0x34df82;return{'apps':Object[_0x2bc0ca(0x1c0)](Object[_0x2bc0ca(0x1bc)](_0x1a4cbc['apps'])[_0x2bc0ca(0x1c4)](([_0x29c9bc,_0x482b13])=>[_0x29c9bc,{'sqlRoot':_0x482b13['sqlRoot'],'lastSync':_0x482b13[_0x2bc0ca(0x1ae)],'sqls':{..._0x482b13['sqls']}}]))};}export function ensureRemoteSqlContent(_0x3e19bf){const _0x3c70c1=a244_0x34df82;return _0x3e19bf[_0x3c70c1(0x1bd)]??'';}export function buildLocalSqlFileContent(_0x43c64f,_0x3c3b7b,_0x5135c7){const _0x489875=a244_0x34df82,_0x1c510b=_0x5135c7?.['mode']??detectSqlMode(_0x3c3b7b),_0x366d3c=stripLocalSqlMetadata(_0x3c3b7b,_0x1c510b)[_0x489875(0x1a7)](),_0x323b9e=buildMetadataHeaderLines({'sqlCode':_0x43c64f['sqlCode'],'sqlName':_0x43c64f['sqlName'],'dbId':_0x43c64f['dbId'],'dbName':_0x5135c7?.[_0x489875(0x19c)],'mode':_0x1c510b,'syncedAt':_0x5135c7?.['syncedAt'],'description':_0x5135c7?.[_0x489875(0x1c5)]},_0x1c510b),_0xd38c0e=_0x1c510b===_0x489875(0x19b)?splitXmlDeclaration(_0x366d3c):{'body':_0x366d3c},_0x121b0b=[..._0xd38c0e[_0x489875(0x1a6)]?[_0xd38c0e[_0x489875(0x1a6)]]:[],..._0x323b9e,'',_0xd38c0e['body'][_0x489875(0x1af)]()],_0x256891=_0x121b0b[_0x489875(0x1c2)]('\x0a');return _0x256891[_0x489875(0x1b6)]('\x0a')?_0x256891:_0x256891+'\x0a';}export function stripLocalSqlMetadata(_0x168b3d,_0x284bde){const _0x391313=a244_0x34df82;if(_0x284bde===_0x391313(0x19b)){const {declaration:_0x3db8c4,body:_0x2cc5ff}=splitXmlDeclaration(_0x168b3d[_0x391313(0x1c6)](/\r\n/g,'\x0a')),_0x527ad6=stripLeadingMetadataLines(_0x2cc5ff,/^\s*<!--\s*@lovrabet\./);return _0x3db8c4?''+_0x3db8c4+(_0x527ad6?'\x0a'+_0x527ad6:''):_0x527ad6;}return stripLeadingMetadataLines(_0x168b3d[_0x391313(0x1c6)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x49d589,_0x2d028d){const _0x5bc723=a244_0x34df82;if(_0x2d028d?.[_0x5bc723(0x1b2)])return _0x2d028d[_0x5bc723(0x1b2)];return detectSqlMode(_0x49d589);}export function resolveSqlFileName(_0x1ff2c7,_0x18d197,_0x390a51){const _0x3ccb08=a244_0x34df82;if(_0x390a51?.['path'])return _0x390a51[_0x3ccb08(0x1bb)];if(_0x390a51?.[_0x3ccb08(0x19e)]||_0x390a51?.[_0x3ccb08(0x19c)])return buildSqlRelativePath(_0x1ff2c7,_0x390a51?.[_0x3ccb08(0x19e)],_0x390a51?.[_0x3ccb08(0x19c)],resolveSqlMode(_0x18d197,_0x390a51),_0x390a51?.['dbId']);return buildDefaultSqlFileName(_0x1ff2c7,resolveSqlMode(_0x18d197,_0x390a51));}export function resolveSqlLocalDir(_0x3c21c5,_0x5dc0ef){return join(_0x3c21c5,SQL_LOCAL_REL_DIR,_0x5dc0ef);}export async function confirmForceOverwrite(_0x333000){const _0x55576a=a244_0x34df82,_0x3ff00a=createInterface({'input':process[_0x55576a(0x1a5)],'output':process[_0x55576a(0x1ab)]}),_0x2b9994=await new Promise(_0xa9b111=>{const _0x211647=_0x55576a;_0x3ff00a['question'](_0x333000+_0x211647(0x1a4),_0xa9b111);});return _0x3ff00a['close'](),['y',_0x55576a(0x1a8)][_0x55576a(0x1ad)](_0x2b9994['trim']()[_0x55576a(0x1b7)]());}export function findSqlLockScope(_0x2565d0,_0x164e00){return _0x2565d0['apps'][_0x164e00];}function a244_0x27fc(){const _0x1ad891=['join','syncedAt','map','description','replace','13470kvwUvN','--\x20@lovrabet.','84JrErsu','mybatisXml','dbName','302lntCoS','sqlName','\x20-->','9XZqSMb','9727586XkEZvZ','filter','version','\x20[y/N]\x20','stdin','declaration','trim','yes','1957zNhazt','sqlCode','stderr','16BZqEVk','includes','lastSync','trimStart','split','1101363hwHcCV','mode','sqlConfig','slice','562218GImzyj','endsWith','toLowerCase','.rabetbase/sql','1207059qnivRk','length','path','entries','sqlContent','test','3768690YimheK','fromEntries','dbId'];a244_0x27fc=function(){return _0x1ad891;};return a244_0x27fc();}function buildMetadataHeaderLines(_0x4cd96c,_0x1de703){const _0x3b8e89=a244_0x34df82,_0x1ffaf2=[[_0x3b8e89(0x1aa),_0x4cd96c[_0x3b8e89(0x1aa)]],[_0x3b8e89(0x19e),_0x4cd96c[_0x3b8e89(0x19e)]],[_0x3b8e89(0x1c1),_0x4cd96c[_0x3b8e89(0x1c1)]],[_0x3b8e89(0x19c),_0x4cd96c['dbName']],[_0x3b8e89(0x1b2),_0x4cd96c[_0x3b8e89(0x1b2)]],[_0x3b8e89(0x1c3),_0x4cd96c['syncedAt']],['description',_0x4cd96c[_0x3b8e89(0x1c5)]]];if(_0x1de703===_0x3b8e89(0x19b))return _0x1ffaf2[_0x3b8e89(0x1a2)](([,_0x526ffb])=>_0x526ffb!==undefined&&_0x526ffb!==null&&String(_0x526ffb)[_0x3b8e89(0x1a7)]()!=='')[_0x3b8e89(0x1c4)](([_0x299b52,_0x503f2f])=>'<!--\x20@lovrabet.'+_0x299b52+':\x20'+String(_0x503f2f)+_0x3b8e89(0x19f));return _0x1ffaf2['filter'](([,_0x55d41a])=>_0x55d41a!==undefined&&_0x55d41a!==null&&String(_0x55d41a)[_0x3b8e89(0x1a7)]()!=='')[_0x3b8e89(0x1c4)](([_0x4d8e4d,_0x438aca])=>_0x3b8e89(0x199)+_0x4d8e4d+':\x20'+String(_0x438aca));}function splitXmlDeclaration(_0x442c58){const _0x160500=a244_0x34df82,_0x56a823=_0x442c58[_0x160500(0x1af)](),_0x95b9=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i['exec'](_0x56a823);if(!_0x95b9)return{'body':_0x442c58};return{'declaration':_0x95b9[0x0],'body':_0x56a823[_0x160500(0x1b4)](_0x95b9[0x0][_0x160500(0x1ba)])};}function a244_0x52f6(_0x257429,_0x561327){_0x257429=_0x257429-0x199;const _0x27fc08=a244_0x27fc();let _0x52f694=_0x27fc08[_0x257429];return _0x52f694;}function stripLeadingMetadataLines(_0x5d361e,_0x17b58e){const _0x3660f1=a244_0x34df82,_0x39bdad=_0x5d361e[_0x3660f1(0x1b0)]('\x0a');let _0x181878=0x0;while(_0x181878<_0x39bdad[_0x3660f1(0x1ba)]){const _0x37bacb=_0x39bdad[_0x181878]??'';if(_0x17b58e[_0x3660f1(0x1be)](_0x37bacb)||_0x37bacb[_0x3660f1(0x1a7)]()===''){_0x181878++;continue;}break;}return _0x39bdad[_0x3660f1(0x1b4)](_0x181878)['join']('\x0a')[_0x3660f1(0x1af)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x5a08af=a245_0x2056;function a245_0x279f(){const _0x1740c7=['relativePath','181673LKVTNO','43356VQjpRz','\x20modified,\x20','has','boolean','lockKey','lockFilePath','1848450FYzYuG','paging','sqlName','map','76764bwinUx','sql','155HwzSqd','read','16CDwexo','sqls','tableData','\x20added,\x20','\x20remote-only','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','2325372BzGCqG','totalCount','filePath','All\x20SQL\x20queries\x20are\x20in\x20sync.','length','3160HYhTuA','bool','status','546417KAziOg','appCode','426InaOOT','\x20missing,\x20','push','sqlRoot','remote'];a245_0x279f=function(){return _0x1740c7;};return a245_0x279f();}(function(_0x224c5a,_0x4d8f5f){const _0x3704da=a245_0x2056,_0x2af60b=_0x224c5a();while(!![]){try{const _0x32d732=parseInt(_0x3704da(0x1fd))/0x1+-parseInt(_0x3704da(0x1e3))/0x2+-parseInt(_0x3704da(0x1f7))/0x3*(parseInt(_0x3704da(0x1f2))/0x4)+-parseInt(_0x3704da(0x1e5))/0x5*(parseInt(_0x3704da(0x1fe))/0x6)+parseInt(_0x3704da(0x1ed))/0x7+parseInt(_0x3704da(0x1e7))/0x8*(-parseInt(_0x3704da(0x1f5))/0x9)+parseInt(_0x3704da(0x204))/0xa;if(_0x32d732===_0x4d8f5f)break;else _0x2af60b['push'](_0x2af60b['shift']());}catch(_0x476544){_0x2af60b['push'](_0x2af60b['shift']());}}}(a245_0x279f,0x317e0));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a245_0x2056(_0x3f0851,_0x2a0eb9){_0x3f0851=_0x3f0851-0x1e3;const _0x279f32=a245_0x279f();let _0x205691=_0x279f32[_0x3f0851];return _0x205691;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x1393d4){const _0x3be216=a245_0x2056,_0x55bf3b=[];let _0x260a00=0x1;while(!![]){const _0x4f83f4=await listSqlQueries(_0x1393d4,{'currentPage':_0x260a00,'pageSize':PAGE_SIZE}),_0x530fef=_0x4f83f4[_0x3be216(0x1e9)]??[];_0x55bf3b[_0x3be216(0x1f9)](..._0x530fef[_0x3be216(0x207)](_0x31b399=>_0x31b399['sqlCode']));if(_0x530fef[_0x3be216(0x1f1)]===0x0)break;const _0x84750e=_0x4f83f4[_0x3be216(0x205)]?.[_0x3be216(0x1ee)];if(_0x84750e!=null?_0x55bf3b[_0x3be216(0x1f1)]>=_0x84750e:_0x530fef['length']<PAGE_SIZE)break;_0x260a00++;}return _0x55bf3b;}export const sqlStatus={'service':a245_0x5a08af(0x1e4),'command':a245_0x5a08af(0x1f4),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a245_0x5a08af(0x1e6),'flags':[{'name':a245_0x5a08af(0x1fb),'type':a245_0x5a08af(0x201),'description':a245_0x5a08af(0x1ec)}],async 'execute'(_0x68b3d3){const _0x2fa968=a245_0x5a08af,_0x3b3472=loadSqlProjectConfig(_0x68b3d3[_0x2fa968(0x1f6)]),_0x1fda41=await readSqlLockFile(_0x3b3472[_0x2fa968(0x203)]),{appLock:_0x3cbd9c}=ensureSqlLockScope(_0x1fda41??createEmptySqlLock(),_0x3b3472[_0x2fa968(0x1f6)],_0x3b3472[_0x2fa968(0x1fa)],_0x2fa968(0x1f4)),_0x3168e6=await scanLocalSqlQueries(_0x3b3472),_0x4e9573=[],_0xa601a0=[],_0x5f6ef6=[],_0x1fe958=[],_0x1c2dc4=new Set(_0x3168e6[_0x2fa968(0x207)](_0x3c06d0=>_0x3c06d0[_0x2fa968(0x202)]));for(const _0x33497b of _0x3168e6){const _0x38fea5=await computeSqlFileHash(_0x33497b[_0x2fa968(0x1ef)]),_0x43cf5b=_0x3cbd9c['sqls'][_0x33497b[_0x2fa968(0x202)]],_0xbe8e7c=!!_0x43cf5b&&_0x43cf5b['path']!==_0x33497b[_0x2fa968(0x1fc)],_0x174961=!!_0x43cf5b&&!!_0x33497b[_0x2fa968(0x206)]&&_0x43cf5b[_0x2fa968(0x206)]!==_0x33497b[_0x2fa968(0x206)];if(!_0x43cf5b)_0x4e9573[_0x2fa968(0x1f9)](_0x33497b['lockKey']);else _0x43cf5b['hash']!==_0x38fea5||_0xbe8e7c||_0x174961?_0xa601a0[_0x2fa968(0x1f9)](_0x33497b['lockKey']):_0x5f6ef6['push'](_0x33497b[_0x2fa968(0x202)]);}for(const _0x8f0c60 of Object['keys'](_0x3cbd9c['sqls'])){!_0x1c2dc4[_0x2fa968(0x200)](_0x8f0c60)&&_0x1fe958['push'](_0x8f0c60);}const _0x2e8ac5=[];if(_0x68b3d3[_0x2fa968(0x1f3)](_0x2fa968(0x1fb))){const _0x390a88=await fetchAllSqlCodes(_0x68b3d3[_0x2fa968(0x1f6)]);for(const _0x341f92 of _0x390a88){!_0x1c2dc4[_0x2fa968(0x200)](_0x341f92)&&!_0x3cbd9c[_0x2fa968(0x1e8)][_0x341f92]&&_0x2e8ac5[_0x2fa968(0x1f9)](_0x341f92);}}const _0x5ac1c1=_0x4e9573[_0x2fa968(0x1f1)]===0x0&&_0xa601a0[_0x2fa968(0x1f1)]===0x0&&_0x1fe958['length']===0x0&&_0x2e8ac5['length']===0x0;return{'ok':!![],'data':{'added':_0x4e9573,'modified':_0xa601a0,'missing':_0x1fe958,'unchanged':_0x5f6ef6,'remoteOnly':_0x2e8ac5},'message':_0x5ac1c1?_0x2fa968(0x1f0):_0x4e9573[_0x2fa968(0x1f1)]+_0x2fa968(0x1ea)+_0xa601a0[_0x2fa968(0x1f1)]+_0x2fa968(0x1ff)+_0x1fe958[_0x2fa968(0x1f1)]+_0x2fa968(0x1f8)+_0x5f6ef6[_0x2fa968(0x1f1)]+'\x20unchanged'+(_0x2e8ac5[_0x2fa968(0x1f1)]>0x0?',\x20'+_0x2e8ac5['length']+_0x2fa968(0x1eb):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x8d4bae=a246_0x35a0;function a246_0x35a0(_0x598690,_0x27e619){_0x598690=_0x598690-0x1a7;const _0x1459e5=a246_0x1459();let _0x35a0cb=_0x1459e5[_0x598690];return _0x35a0cb;}(function(_0x574b99,_0x3b6cba){const _0x3ce26a=a246_0x35a0,_0x3e9ecd=_0x574b99();while(!![]){try{const _0x4b172f=parseInt(_0x3ce26a(0x1e4))/0x1*(parseInt(_0x3ce26a(0x1d1))/0x2)+-parseInt(_0x3ce26a(0x1c1))/0x3+parseInt(_0x3ce26a(0x1cd))/0x4*(-parseInt(_0x3ce26a(0x1b9))/0x5)+-parseInt(_0x3ce26a(0x1d5))/0x6+-parseInt(_0x3ce26a(0x1ce))/0x7*(-parseInt(_0x3ce26a(0x1d8))/0x8)+-parseInt(_0x3ce26a(0x1b8))/0x9+-parseInt(_0x3ce26a(0x1c8))/0xa*(-parseInt(_0x3ce26a(0x1b1))/0xb);if(_0x4b172f===_0x3b6cba)break;else _0x3e9ecd['push'](_0x3e9ecd['shift']());}catch(_0x59bf5f){_0x3e9ecd['push'](_0x3e9ecd['shift']());}}}(a246_0x1459,0xd5933));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a246_0x1459(){const _0x42bd2a=['read','4633191LagQqL','isSelectOnly','indexes','flagMissing','filter','\x22\x20not\x20found\x20or\x20not\x20accessible','flatMap','20pkRIrF','sqlType','columnNames','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','indexName','8XjotCY','4351137HaNrTm','validate','reason','382jnoJPX','str','dbtableConfig','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','7738020VxNzuR','schema:','primary','8HmtoKH','valid','Provide\x20--file\x20or\x20--sql','push','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','SQL\x20schema\x20validation','index_columns','--check-indexes\x20requires\x20--schemas.','toLowerCase','schemas','split','find','7001ombvXD','schemaWarnings','tables','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','type','message','index_type','map','validation','index_name','isDangerous','string','trim','length','get','file','from','cwd','13598475emZmbL','isArray','boolean','unshift','sql','Dataset\x20\x22','dataset','1770732CtWEJi','1314035uenLRG','check-indexes','name','tableName','parameters','columns','\x22\x20not\x20found\x20in\x20any\x20dataset'];a246_0x1459=function(){return _0x42bd2a;};return a246_0x1459();}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':'sql','command':a246_0x8d4bae(0x1cf),'description':a246_0x8d4bae(0x1d4),'risk':a246_0x8d4bae(0x1c0),'flags':[{'name':a246_0x8d4bae(0x1ae),'type':a246_0x8d4bae(0x1aa),'description':a246_0x8d4bae(0x1dc)},{'name':a246_0x8d4bae(0x1b5),'type':a246_0x8d4bae(0x1aa),'description':a246_0x8d4bae(0x1e7)},{'name':a246_0x8d4bae(0x1e1),'type':a246_0x8d4bae(0x1aa),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'},{'name':a246_0x8d4bae(0x1ba),'type':a246_0x8d4bae(0x1b3),'description':a246_0x8d4bae(0x1cb)}],async 'execute'(_0x32ca5e){const _0x173e4c=a246_0x8d4bae,_0x52fe18=_0x32ca5e[_0x173e4c(0x1d2)](_0x173e4c(0x1ae)),_0x1de4b8=_0x32ca5e[_0x173e4c(0x1d2)](_0x173e4c(0x1b5)),_0x580174=_0x32ca5e[_0x173e4c(0x1d2)](_0x173e4c(0x1e1)),_0x47185f=_0x32ca5e['bool'](_0x173e4c(0x1ba));if(!_0x52fe18&&!_0x1de4b8)throw CliErrors[_0x173e4c(0x1c4)](_0x173e4c(0x1ae),_0x173e4c(0x1da));if(_0x47185f&&!_0x580174)throw CliErrors['validation'](_0x173e4c(0x1df));let _0x10c09c;if(_0x52fe18){const _0x8be814=resolve(process[_0x173e4c(0x1b0)](),_0x52fe18);if(!existsSync(_0x8be814))throw CliErrors[_0x173e4c(0x1a7)]('File\x20not\x20found:\x20'+_0x8be814);_0x10c09c=readFileSync(_0x8be814,'utf-8');}else _0x10c09c=_0x1de4b8;const _0x4e5f24=validateSql(_0x10c09c),_0x5aee0e={'valid':_0x4e5f24[_0x173e4c(0x1d9)],'sqlType':_0x4e5f24['sqlType'][_0x173e4c(0x1e8)],'isSelectOnly':_0x4e5f24[_0x173e4c(0x1c9)][_0x173e4c(0x1c2)],'isLockingRead':_0x4e5f24[_0x173e4c(0x1c9)]['isLockingRead']??![],'isDangerous':_0x4e5f24['sqlType'][_0x173e4c(0x1a9)],'tables':_0x4e5f24[_0x173e4c(0x1e6)],'parameters':_0x4e5f24[_0x173e4c(0x1bd)],'message':_0x4e5f24[_0x173e4c(0x1e9)]};_0x4e5f24[_0x173e4c(0x1c9)]['reason']&&(_0x5aee0e[_0x173e4c(0x1d0)]=_0x4e5f24['sqlType']['reason']);if(_0x580174&&_0x4e5f24[_0x173e4c(0x1d9)]){const _0xe3c11c=_0x580174[_0x173e4c(0x1e2)](',')[_0x173e4c(0x1eb)](_0x1fe9dc=>_0x1fe9dc[_0x173e4c(0x1ab)]())[_0x173e4c(0x1c5)](Boolean),_0x434489=[],_0x34c203=[],_0x2a5611=filterDbTableBackedDatasets(await listDatasets(_0x32ca5e['appCode'])),_0x51ef00=new Map(_0x2a5611[_0x173e4c(0x1eb)](_0x4801c0=>[_0x4801c0[_0x173e4c(0x1d3)]?.[_0x173e4c(0x1bc)]?.[_0x173e4c(0x1e0)](),_0x4801c0]));for(const _0x35f235 of _0x4e5f24[_0x173e4c(0x1e6)]){const _0x1831f5=_0x51ef00[_0x173e4c(0x1ad)](_0x35f235[_0x173e4c(0x1e0)]());!_0x1831f5&&_0x434489[_0x173e4c(0x1db)]('Table\x20\x22'+_0x35f235+_0x173e4c(0x1bf));}for(const _0x5b749d of _0xe3c11c){let _0x3f3359;try{_0x3f3359=await getDatasetDetail(_0x5b749d);}catch{_0x434489[_0x173e4c(0x1db)](_0x173e4c(0x1b6)+_0x5b749d+_0x173e4c(0x1c6));continue;}assertDatasetIsDbTableBacked(_0x3f3359,_0x173e4c(0x1dd));const _0x8c9ae2=Array['isArray'](_0x3f3359['fields'])?_0x3f3359['fields']:[],_0x2aaa2f=new Set(_0x8c9ae2['map'](_0x3e7342=>_0x3e7342[_0x173e4c(0x1bb)]?.['toLowerCase']())),_0x231028=_0x3f3359[_0x173e4c(0x1d3)]?.['tableName']||_0x3f3359[_0x173e4c(0x1bc)]||_0x5b749d;_0x5aee0e[_0x173e4c(0x1d6)+_0x231028]={'code':_0x5b749d,'tableName':_0x231028,'fieldCount':_0x2aaa2f['size'],'fields':Array[_0x173e4c(0x1af)](_0x2aaa2f)};if(_0x47185f){const _0x261816=normalizeDatasetIndexes(_0x3f3359);_0x34c203['push']({'tableName':_0x231028,..._0x261816});}}_0x434489[_0x173e4c(0x1ac)]>0x0&&(_0x5aee0e[_0x173e4c(0x1e5)]=_0x434489),_0x47185f&&(_0x5aee0e['joinAudit']=auditSqlJoinIndexes(_0x10c09c,_0x34c203));}return{'ok':_0x4e5f24[_0x173e4c(0x1d9)],'data':_0x5aee0e,'message':_0x4e5f24['message']};}};function normalizeDatasetIndexes(_0x3934f4){const _0x1bf1e4=a246_0x8d4bae,_0x54796e=Array[_0x1bf1e4(0x1b2)](_0x3934f4?.[_0x1bf1e4(0x1b7)]?.[_0x1bf1e4(0x1c3)])?_0x3934f4['dataset'][_0x1bf1e4(0x1c3)]:Array['isArray'](_0x3934f4?.['indexes'])?_0x3934f4['indexes']:[],_0x517cf4=_0x54796e[_0x1bf1e4(0x1c7)](_0x314245=>{const _0x4fadb9=_0x1bf1e4,_0x1924f0=Array[_0x4fadb9(0x1b2)](_0x314245?.[_0x4fadb9(0x1de)])?_0x314245[_0x4fadb9(0x1de)]:Array[_0x4fadb9(0x1b2)](_0x314245?.[_0x4fadb9(0x1ca)])?_0x314245[_0x4fadb9(0x1ca)]:Array[_0x4fadb9(0x1b2)](_0x314245?.[_0x4fadb9(0x1be)])?_0x314245[_0x4fadb9(0x1be)]:[],_0x111258=_0x1924f0[_0x4fadb9(0x1c5)](_0x2411ea=>typeof _0x2411ea===_0x4fadb9(0x1aa))['map'](_0x56846f=>_0x56846f[_0x4fadb9(0x1ab)]())[_0x4fadb9(0x1c5)](Boolean);if(_0x111258['length']===0x0)return[];const _0x2c0ca3=[_0x314245?.[_0x4fadb9(0x1cc)],_0x314245?.[_0x4fadb9(0x1a8)],_0x314245?.[_0x4fadb9(0x1bb)]][_0x4fadb9(0x1e3)](_0x5952ff=>typeof _0x5952ff==='string'&&_0x5952ff[_0x4fadb9(0x1ab)]()),_0x1917ce=[_0x314245?.[_0x4fadb9(0x1ea)],_0x314245?.[_0x4fadb9(0x1e8)]]['find'](_0x3af4c2=>typeof _0x3af4c2===_0x4fadb9(0x1aa)&&_0x3af4c2[_0x4fadb9(0x1ab)]());return[{..._0x2c0ca3?{'name':_0x2c0ca3['trim']()}:{},..._0x1917ce?{'type':_0x1917ce[_0x4fadb9(0x1ab)]()}:{},'columns':_0x111258}];}),_0x3c5280=[..._0x517cf4],_0x32edb4=typeof _0x3934f4?.[_0x1bf1e4(0x1d3)]?.['pkField']===_0x1bf1e4(0x1aa)?_0x3934f4[_0x1bf1e4(0x1d3)]['pkField'][_0x1bf1e4(0x1e2)](',')[_0x1bf1e4(0x1eb)](_0x28cbd1=>_0x28cbd1[_0x1bf1e4(0x1ab)]())[_0x1bf1e4(0x1c5)](Boolean):[];return _0x32edb4[_0x1bf1e4(0x1ac)]>0x0&&_0x3c5280[_0x1bf1e4(0x1b4)]({'type':_0x1bf1e4(0x1d7),'columns':_0x32edb4}),{'indexes':_0x3c5280,'metadataAvailable':_0x517cf4[_0x1bf1e4(0x1ac)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a247_0x49fc(){const _0x279b11=['13cGOAaF','640629XMBmsS','1137997gELQxr','687804wLjqQB','18718AImQTV','267942RCIARq','5jDnZci','2400WgyLvb','5183620nrQuWq','42jxKzRE','732evetOx','8rMFktK','9TkGmth'];a247_0x49fc=function(){return _0x279b11;};return a247_0x49fc();}function a247_0x10f7(_0x35859b,_0x547a03){_0x35859b=_0x35859b-0x16d;const _0x49fcb4=a247_0x49fc();let _0x10f780=_0x49fcb4[_0x35859b];return _0x10f780;}(function(_0x1ebfee,_0x14624e){const _0x422089=a247_0x10f7,_0x473996=_0x1ebfee();while(!![]){try{const _0x49baca=parseInt(_0x422089(0x176))/0x1*(-parseInt(_0x422089(0x16e))/0x2)+parseInt(_0x422089(0x16f))/0x3*(parseInt(_0x422089(0x179))/0x4)+parseInt(_0x422089(0x178))/0x5*(-parseInt(_0x422089(0x177))/0x6)+parseInt(_0x422089(0x174))/0x7*(parseInt(_0x422089(0x170))/0x8)+-parseInt(_0x422089(0x171))/0x9*(-parseInt(_0x422089(0x16d))/0xa)+-parseInt(_0x422089(0x173))/0xb+-parseInt(_0x422089(0x175))/0xc*(parseInt(_0x422089(0x172))/0xd);if(_0x49baca===_0x14624e)break;else _0x473996['push'](_0x473996['shift']());}catch(_0x2e91c6){_0x473996['push'](_0x473996['shift']());}}}(a247_0x49fc,0x42e7a));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a248_0x27e2(_0x54e92d,_0x1a54c2){_0x54e92d=_0x54e92d-0x140;const _0x2680d7=a248_0x2680();let _0x27e258=_0x2680d7[_0x54e92d];return _0x27e258;}const a248_0x5a6198=a248_0x27e2;(function(_0x34d231,_0x3ca7e1){const _0x474d7d=a248_0x27e2,_0x1aceca=_0x34d231();while(!![]){try{const _0x404b8e=parseInt(_0x474d7d(0x143))/0x1*(parseInt(_0x474d7d(0x152))/0x2)+parseInt(_0x474d7d(0x141))/0x3*(-parseInt(_0x474d7d(0x144))/0x4)+parseInt(_0x474d7d(0x156))/0x5+-parseInt(_0x474d7d(0x14a))/0x6+parseInt(_0x474d7d(0x14d))/0x7*(parseInt(_0x474d7d(0x145))/0x8)+-parseInt(_0x474d7d(0x147))/0x9+parseInt(_0x474d7d(0x149))/0xa;if(_0x404b8e===_0x3ca7e1)break;else _0x1aceca['push'](_0x1aceca['shift']());}catch(_0x2b03cd){_0x1aceca['push'](_0x1aceca['shift']());}}}(a248_0x2680,0xd40e6));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':'status','description':'Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','risk':a248_0x5a6198(0x148),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a248_0x5a6198(0x14f),'type':a248_0x5a6198(0x157),'required':!![],'description':a248_0x5a6198(0x150)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x25c4fb){const _0x2b3e53=a248_0x5a6198;if(!_0x25c4fb[_0x2b3e53(0x153)](_0x2b3e53(0x14f))['trim']())throw CliErrors[_0x2b3e53(0x14b)](_0x2b3e53(0x14f));},async 'execute'(_0x1d13ac){const _0x3ca69c=a248_0x5a6198,_0x15f4c0=_0x1d13ac[_0x3ca69c(0x153)](_0x3ca69c(0x14f))[_0x3ca69c(0x146)](),_0x2a5ea8=normalizeAsyncTask(await getAsyncTaskStatus(_0x15f4c0,_0x1d13ac[_0x3ca69c(0x14e)],_0x1d13ac[_0x3ca69c(0x142)]));if(_0x2a5ea8[_0x3ca69c(0x151)]!==_0x15f4c0)throw CliErrors[_0x3ca69c(0x140)](_0x3ca69c(0x14c)+_0x15f4c0+_0x3ca69c(0x155)+_0x2a5ea8[_0x3ca69c(0x151)]+'.');const _0x440484=buildAsyncTaskStatusCommand(_0x2a5ea8[_0x3ca69c(0x151)],_0x1d13ac[_0x3ca69c(0x14e)]);return{'ok':!![],'message':asyncTaskMessage(_0x2a5ea8),'data':{'appCode':_0x1d13ac['appCode'],..._0x2a5ea8,'query':_0x2a5ea8[_0x3ca69c(0x154)]?null:{'command':_0x440484}}};}};function a248_0x2680(){const _0x18d2a7=['1582770ofJxdN','string','apiError','2635614yykQDN','cookie','2ATtoFU','4oBxWsC','5106808TcHfYU','trim','10383786ZfWvqR','read','214010fyzgnL','1567590DejdjH','flagMissing','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','14AZyGOM','appCode','task-id','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','taskId','1547482eLLpCW','str','isTerminal',',\x20received\x20'];a248_0x2680=function(){return _0x18d2a7;};return a248_0x2680();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x42d63b,_0x5e158e){const _0x373b2b=a249_0x3654,_0x5a71cc=_0x42d63b();while(!![]){try{const _0x8b9cf6=-parseInt(_0x373b2b(0x10f))/0x1*(parseInt(_0x373b2b(0x110))/0x2)+parseInt(_0x373b2b(0x114))/0x3+parseInt(_0x373b2b(0x10d))/0x4+parseInt(_0x373b2b(0x10b))/0x5+parseInt(_0x373b2b(0x10c))/0x6+-parseInt(_0x373b2b(0x112))/0x7*(-parseInt(_0x373b2b(0x111))/0x8)+parseInt(_0x373b2b(0x113))/0x9*(-parseInt(_0x373b2b(0x10e))/0xa);if(_0x8b9cf6===_0x5e158e)break;else _0x5a71cc['push'](_0x5a71cc['shift']());}catch(_0x120b2b){_0x5a71cc['push'](_0x5a71cc['shift']());}}}(a249_0x4683,0xe8274));function a249_0x3654(_0x2af9f2,_0x2eae32){_0x2af9f2=_0x2af9f2-0x10b;const _0x46834a=a249_0x4683();let _0x3654f6=_0x46834a[_0x2af9f2];return _0x3654f6;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a249_0x4683(){const _0x50a773=['5374128pbNIBB','266360pmFtOl','305936TaMUNw','10xjWjyZ','3212528RzETer','14FzJZse','693vmNsuW','215919FDyRaU','6655215jhSral','5891232ewLYUd'];a249_0x4683=function(){return _0x50a773;};return a249_0x4683();}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x1701ea=a250_0x36d6;(function(_0x5d081e,_0x57432a){const _0x32be3f=a250_0x36d6,_0x2d10b9=_0x5d081e();while(!![]){try{const _0x49f7d2=-parseInt(_0x32be3f(0xd2))/0x1*(parseInt(_0x32be3f(0xc7))/0x2)+-parseInt(_0x32be3f(0xc2))/0x3*(-parseInt(_0x32be3f(0xd0))/0x4)+-parseInt(_0x32be3f(0xcd))/0x5+-parseInt(_0x32be3f(0xc9))/0x6+parseInt(_0x32be3f(0xd4))/0x7+parseInt(_0x32be3f(0xbe))/0x8*(parseInt(_0x32be3f(0xcf))/0x9)+-parseInt(_0x32be3f(0xc6))/0xa*(-parseInt(_0x32be3f(0xd3))/0xb);if(_0x49f7d2===_0x57432a)break;else _0x2d10b9['push'](_0x2d10b9['shift']());}catch(_0xd29e42){_0x2d10b9['push'](_0x2d10b9['shift']());}}}(a250_0x2ffa,0xe8b1e));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a250_0x36d6(_0x176419,_0x1d43d8){_0x176419=_0x176419-0xbd;const _0x2ffac4=a250_0x2ffa();let _0x36d69c=_0x2ffac4[_0x176419];return _0x36d69c;}import{CliErrors}from'../../errors.js';function a250_0x2ffa(){const _0x3596be=['9878568chJWPu','Exact\x20tenant\x20code','tenant','tenant-code','6036345DVOkAb','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','10539UQgQHN','4OjNxGL','flagMissing','3PRfYsz','44132gzoExo','3641967dXnmBy','Pass\x20--tenant-code\x20<code>.','Found\x20','10536jvNZzV','members-list','\x20tenant\x20member(s)','str','4509666wyarLY','trim','length','read','4570oKfrNY','1061586lwaqdp','string'];a250_0x2ffa=function(){return _0x3596be;};return a250_0x2ffa();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a250_0x1701ea(0xcb),'command':a250_0x1701ea(0xbf),'description':a250_0x1701ea(0xce),'risk':a250_0x1701ea(0xc5),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'tenant-code','type':a250_0x1701ea(0xc8),'required':!![],'description':a250_0x1701ea(0xca)}],async 'validate'(_0x3c21d0){const _0x172b6e=a250_0x1701ea;if(!_0x3c21d0[_0x172b6e(0xc1)](_0x172b6e(0xcc))[_0x172b6e(0xc3)]())throw CliErrors[_0x172b6e(0xd1)]('tenant-code',_0x172b6e(0xd5));},async 'execute'(_0x4cbbfa){const _0x152a50=a250_0x1701ea,_0x24dd13=_0x4cbbfa['str'](_0x152a50(0xcc))[_0x152a50(0xc3)](),_0x537f54=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x24dd13,_0x537f54);const _0xeb063e=projectTenantMembers(await listTenantDirectoryMembers(_0x24dd13));return{'ok':!![],'data':{'tenantCode':_0x24dd13,'items':_0xeb063e,'totalCount':_0xeb063e[_0x152a50(0xc4)]},'message':_0x152a50(0xbd)+_0xeb063e[_0x152a50(0xc4)]+_0x152a50(0xc0)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x542820,_0xf35acf){const _0x526f41=a251_0x3274,_0x3c8eb=_0x542820();while(!![]){try{const _0xd8d33b=parseInt(_0x526f41(0x12e))/0x1*(-parseInt(_0x526f41(0x124))/0x2)+-parseInt(_0x526f41(0x13b))/0x3+parseInt(_0x526f41(0x125))/0x4*(-parseInt(_0x526f41(0x131))/0x5)+-parseInt(_0x526f41(0x129))/0x6*(parseInt(_0x526f41(0x132))/0x7)+-parseInt(_0x526f41(0x123))/0x8*(parseInt(_0x526f41(0x135))/0x9)+parseInt(_0x526f41(0x12b))/0xa+-parseInt(_0x526f41(0x137))/0xb*(-parseInt(_0x526f41(0x134))/0xc);if(_0xd8d33b===_0xf35acf)break;else _0x3c8eb['push'](_0x3c8eb['shift']());}catch(_0x511659){_0x3c8eb['push'](_0x3c8eb['shift']());}}}(a251_0x3290,0x3128f));import{CliErrors}from'../../errors.js';function textOrNull(_0x3a0198){const _0x24fe59=a251_0x3274,_0x155f0d=_0x3a0198?.[_0x24fe59(0x122)]();return _0x155f0d?_0x155f0d:null;}function a251_0x3274(_0x19bd8f,_0x3366d5){_0x19bd8f=_0x19bd8f-0x121;const _0x329083=a251_0x3290();let _0x32740c=_0x329083[_0x19bd8f];return _0x32740c;}export function projectTenantMembers(_0x41a066){const _0x4eaa2f=a251_0x3274,_0x1c6d98=new Map();for(const _0x3594df of _0x41a066){const _0x32c9d3=Number(_0x3594df['userId']);if(!Number[_0x4eaa2f(0x138)](_0x32c9d3)||_0x32c9d3<=0x0)continue;const _0x28ae70={'userId':_0x32c9d3,'username':textOrNull(_0x3594df[_0x4eaa2f(0x130)]),'displayName':textOrNull(_0x3594df[_0x4eaa2f(0x121)]),'role':_0x3594df['adminFlag']===!![]?_0x4eaa2f(0x13c):_0x4eaa2f(0x136),'status':textOrNull(_0x3594df[_0x4eaa2f(0x12a)])},_0x20600b=_0x1c6d98[_0x4eaa2f(0x133)](_0x32c9d3);if(!_0x20600b){_0x1c6d98[_0x4eaa2f(0x127)](_0x32c9d3,_0x28ae70);continue;}_0x20600b[_0x4eaa2f(0x130)]??=_0x28ae70[_0x4eaa2f(0x130)],_0x20600b[_0x4eaa2f(0x12d)]??=_0x28ae70[_0x4eaa2f(0x12d)],_0x20600b[_0x4eaa2f(0x12a)]??=_0x28ae70[_0x4eaa2f(0x12a)];if(_0x28ae70[_0x4eaa2f(0x13a)]===_0x4eaa2f(0x13c))_0x20600b[_0x4eaa2f(0x13a)]=_0x4eaa2f(0x13c);}return[..._0x1c6d98['values']()][_0x4eaa2f(0x12f)]((_0x3cf8b5,_0x44d549)=>_0x3cf8b5[_0x4eaa2f(0x128)]-_0x44d549[_0x4eaa2f(0x128)]);}export function assertTenantAccessible(_0x2fa2e3,_0x6b88fc){const _0x5bc004=a251_0x3274;if(_0x6b88fc['some'](_0x1d6a4c=>_0x1d6a4c[_0x5bc004(0x139)]===_0x2fa2e3))return;throw CliErrors['validation'](_0x5bc004(0x12c)+_0x2fa2e3+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x5bc004(0x126));}function a251_0x3290(){const _0x39f714=['set','userId','216QWkyas','status','55100vPfeDT','Tenant\x20\x22','displayName','2pAdFYE','sort','username','38835maQDwm','21357flCryb','get','5868wScZdK','864yAgUEG','MEMBER','21197jLyARS','isFinite','tenantCode','role','369969pRhvUD','ADMIN','nickname','trim','31816OfbBuT','92668uDQBGy','20CYtEcq','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.'];a251_0x3290=function(){return _0x39f714;};return a251_0x3290();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a252_0x5d76eb=a252_0x1423;(function(_0x1f52f5,_0x5c6467){const _0x518f19=a252_0x1423,_0x3194e5=_0x1f52f5();while(!![]){try{const _0x2931ef=parseInt(_0x518f19(0x1ab))/0x1+parseInt(_0x518f19(0x1a7))/0x2+-parseInt(_0x518f19(0x1a0))/0x3*(-parseInt(_0x518f19(0x1a6))/0x4)+parseInt(_0x518f19(0x19e))/0x5*(-parseInt(_0x518f19(0x1a8))/0x6)+parseInt(_0x518f19(0x19f))/0x7*(-parseInt(_0x518f19(0x1a9))/0x8)+parseInt(_0x518f19(0x198))/0x9+parseInt(_0x518f19(0x1a2))/0xa*(-parseInt(_0x518f19(0x197))/0xb);if(_0x2931ef===_0x5c6467)break;else _0x3194e5['push'](_0x3194e5['shift']());}catch(_0x20bd33){_0x3194e5['push'](_0x3194e5['shift']());}}}(a252_0x14b5,0xa54cb));function a252_0x1423(_0x32a548,_0x20b411){_0x32a548=_0x32a548-0x194;const _0x14b592=a252_0x14b5();let _0x14234a=_0x14b592[_0x32a548];return _0x14234a;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a252_0x5d76eb(0x196),CURRENT_BINDING_WARNING=a252_0x5d76eb(0x19c);function readDingTalkUserId(_0x859fb7){const _0x370c5e=a252_0x5d76eb,_0x2742f0=_0x859fb7[_0x370c5e(0x1ac)](_0x370c5e(0x1a5))[_0x370c5e(0x1a3)]();if(!_0x2742f0)throw CliErrors[_0x370c5e(0x19d)](_0x370c5e(0x195),'Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x2742f0;}function buildBindingData(_0x55f3b6,_0x216798){return{'operation':'bind','selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x55f3b6},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x55f3b6,'bound':!![]},'dryRun':_0x216798,'backend':{'method':'POST','path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}function a252_0x14b5(){const _0x5d6fba=['328101nGuVyU','str','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','apiError','--ding-talk-user-id\x20cannot\x20be\x20empty.','dingtalk','33aJqKOI','11600820jNsxUr','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','string','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','validation','4618085XEAaRB','2078601waUgFm','3RxbDuN','user-account','260980kVLkzF','trim','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','ding-talk-user-id','3881896ZpZmWU','558390CBmFpF','6RgBIEj','32SmClsq','POST'];a252_0x14b5=function(){return _0x5d6fba;};return a252_0x14b5();}export const dingTalkSandboxBind={'service':a252_0x5d76eb(0x1a1),'command':'dingding-sandbox-bind','description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':'write','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a252_0x5d76eb(0x1a5),'type':a252_0x5d76eb(0x19b),'required':!![],'description':a252_0x5d76eb(0x199)}],async 'validate'(_0x3e31ef){readDingTalkUserId(_0x3e31ef);},async 'dryRun'(_0x4e1f3c){const _0x4bc517=a252_0x5d76eb,_0x2cbe7a=readDingTalkUserId(_0x4e1f3c);return asDryRunResult(buildBindingData(_0x2cbe7a,!![]),{'method':_0x4bc517(0x1aa),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x4b5d77){const _0x340168=a252_0x5d76eb,_0x4c1d7a=readDingTalkUserId(_0x4b5d77),_0x3015f3=await bindDingTalkSandboxAccount(_0x4c1d7a);if(_0x3015f3!==!![])throw CliErrors[_0x340168(0x194)](_0x340168(0x1ad),_0x340168(0x19a));return{'ok':!![],'data':buildBindingData(_0x4c1d7a,![]),'message':_0x340168(0x1a4)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a253_0x3a2e(_0x5517b9,_0x416500){_0x5517b9=_0x5517b9-0xf9;const _0x53988f=a253_0x5398();let _0x3a2e10=_0x53988f[_0x5517b9];return _0x3a2e10;}const a253_0x184311=a253_0x3a2e;(function(_0x181d74,_0x2f31b6){const _0x5e12df=a253_0x3a2e,_0x350b93=_0x181d74();while(!![]){try{const _0x5de6bd=-parseInt(_0x5e12df(0x10a))/0x1+parseInt(_0x5e12df(0x10d))/0x2+parseInt(_0x5e12df(0xfd))/0x3+-parseInt(_0x5e12df(0x10f))/0x4+-parseInt(_0x5e12df(0x102))/0x5+parseInt(_0x5e12df(0x104))/0x6*(-parseInt(_0x5e12df(0x108))/0x7)+parseInt(_0x5e12df(0x110))/0x8*(parseInt(_0x5e12df(0xff))/0x9);if(_0x5de6bd===_0x2f31b6)break;else _0x350b93['push'](_0x350b93['shift']());}catch(_0x2aa6d4){_0x350b93['push'](_0x350b93['shift']());}}}(a253_0x5398,0x34961));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindFeishuAccount,FEISHU_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a253_0x184311(0x111),CURRENT_BINDING_WARNING=a253_0x184311(0x100);function readUnionId(_0x3bff97){const _0x532427=a253_0x184311,_0x8abe4=_0x3bff97[_0x532427(0xfa)](_0x532427(0x10b))[_0x532427(0xfe)]();if(!/^on_[A-Za-z0-9_-]+$/[_0x532427(0x105)](_0x8abe4))throw CliErrors['validation'](_0x532427(0x107),_0x532427(0x109));return _0x8abe4;}function buildBindingData(_0x5ba263,_0x448ad8){const _0x1cc06b=a253_0x184311;return{'operation':_0x1cc06b(0x112),'selector':{'providerId':PROVIDER_ID,'unionId':_0x5ba263},'before':null,'after':{'providerId':PROVIDER_ID,'unionId':_0x5ba263,'bound':!![]},'dryRun':_0x448ad8,'backend':{'method':_0x1cc06b(0x103),'path':FEISHU_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const feishuBind={'service':a253_0x184311(0x10c),'command':a253_0x184311(0xfc),'description':a253_0x184311(0x101),'risk':'write','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a253_0x184311(0x10b),'type':a253_0x184311(0x113),'required':!![],'description':a253_0x184311(0x106)}],async 'validate'(_0x1a39ab){readUnionId(_0x1a39ab);},async 'dryRun'(_0x535db4){const _0x1aaca7=a253_0x184311,_0xe95680=readUnionId(_0x535db4);return asDryRunResult(buildBindingData(_0xe95680,!![]),{'method':_0x1aaca7(0x103),'url':FEISHU_BIND_PATH});},async 'execute'(_0x4cc819){const _0x3cdb26=a253_0x184311,_0x5f0727=readUnionId(_0x4cc819),_0x10df70=await bindFeishuAccount(_0x5f0727);if(_0x10df70!==!![])throw CliErrors['apiError'](_0x3cdb26(0xfb),_0x3cdb26(0x10e));return{'ok':!![],'data':buildBindingData(_0x5f0727,![]),'message':_0x3cdb26(0xf9)};}};function a253_0x5398(){const _0x161ceb=['union-id','user-account','111772fUXzsm','Verify\x20the\x20current\x20binding\x20through\x20the\x20platform\x20before\x20explicitly\x20retrying;\x20do\x20not\x20automatically\x20retry.','488544VCfXdU','8216DFZCPr','feishu','bind','string','Bound\x20current\x20user\x20to\x20Feishu\x20account.','str','Feishu\x20account\x20binding\x20was\x20not\x20confirmed.','feishu-bind','237252MYBPQX','trim','7443pRDfgr','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20Feishu\x20account','81545rKlTSJ','POST','90FqKWhA','test','Feishu\x20union_id\x20for\x20the\x20configured\x20Feishu\x20application\x20developer','--union-id\x20must\x20match\x20on_\x20followed\x20by\x20letters,\x20digits,\x20underscores,\x20or\x20hyphens.','103215DOboWq','Pass\x20a\x20Feishu\x20union\x20id\x20such\x20as\x20on_example_001.','409286AJNiRn'];a253_0x5398=function(){return _0x161ceb;};return a253_0x5398();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a254_0xadc4(_0x1f7f5f,_0x45f9af){_0x1f7f5f=_0x1f7f5f-0x1ba;const _0x5cf9b1=a254_0x5cf9();let _0xadc4bd=_0x5cf9b1[_0x1f7f5f];return _0xadc4bd;}(function(_0x468200,_0x4bda3c){const _0x481658=a254_0xadc4,_0x44be7d=_0x468200();while(!![]){try{const _0x2b4da4=parseInt(_0x481658(0x1bf))/0x1+parseInt(_0x481658(0x1c3))/0x2*(parseInt(_0x481658(0x1c2))/0x3)+-parseInt(_0x481658(0x1bd))/0x4+parseInt(_0x481658(0x1ba))/0x5*(-parseInt(_0x481658(0x1c0))/0x6)+parseInt(_0x481658(0x1bb))/0x7+-parseInt(_0x481658(0x1bc))/0x8+-parseInt(_0x481658(0x1c1))/0x9*(-parseInt(_0x481658(0x1be))/0xa);if(_0x2b4da4===_0x4bda3c)break;else _0x44be7d['push'](_0x44be7d['shift']());}catch(_0x2993eb){_0x44be7d['push'](_0x44be7d['shift']());}}}(a254_0x5cf9,0x8f81c));function a254_0x5cf9(){const _0x2cf55e=['45QaINKR','6319341lSePwI','6250960KMLzMd','2406544BsQmar','10jkEjcS','165366kQzxNS','148398ZVMsQf','9051363BkISEj','119571zGAodR','6QRSqsF'];a254_0x5cf9=function(){return _0x2cf55e;};return a254_0x5cf9();}import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';import{feishuBind}from'../../commands/user-account/feishu-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind,feishuBind];
|