@lovrabet/rabetbase-cli 2.5.10-beta.5 → 2.5.10
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/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.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/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.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/page-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/context.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/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-analysis.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/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.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/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.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/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 +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a248_0x5f2078=a248_0x3ac0;(function(_0x2fa61e,_0x1f08bf){const _0x562e2d=a248_0x3ac0,_0x4b06f0=_0x2fa61e();while(!![]){try{const _0x248fe8=-parseInt(_0x562e2d(0x1fe))/0x1+parseInt(_0x562e2d(0x201))/0x2+parseInt(_0x562e2d(0x204))/0x3+parseInt(_0x562e2d(0x1e9))/0x4+-parseInt(_0x562e2d(0x1f6))/0x5*(-parseInt(_0x562e2d(0x200))/0x6)+parseInt(_0x562e2d(0x1f9))/0x7+-parseInt(_0x562e2d(0x1f3))/0x8;if(_0x248fe8===_0x1f08bf)break;else _0x4b06f0['push'](_0x4b06f0['shift']());}catch(_0x398e4b){_0x4b06f0['push'](_0x4b06f0['shift']());}}}(a248_0x1075,0x42394));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a248_0x1075(){const _0xe1e51b=['No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','1421508yIiDQo','Would\x20delete\x20SQL\x20','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','remoteId','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRoot','delete','sqls','/smartapi/custom/deleteUserCustomSql','toISOString','6954112XpORCb','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','high-risk-write','5JOdebE','POST','projectRoot','2030798FcYMub','lockFilePath','Deleted\x20','trashedTo','validation','393643FMFYrW','appCode','1851384yXurLL','1016282AXxJNO','sqlcode','entries','215889huNOnv','startsWith','trashDir','str'];a248_0x1075=function(){return _0xe1e51b;};return a248_0x1075();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x3ac0(_0x27af13,_0x34ab52){_0x27af13=_0x27af13-0x1e9;const _0x107568=a248_0x1075();let _0x3ac0e4=_0x107568[_0x27af13];return _0x3ac0e4;}import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a248_0x5f2078(0x1ef),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a248_0x5f2078(0x1f5),'flags':[SQLCODE_FLAG],async 'validate'(_0x163e4a){const _0x1c0479=a248_0x5f2078,_0x5ed0d0=loadSqlProjectConfig(_0x163e4a[_0x1c0479(0x1ff)]),_0x588637=await readSqlLockFile(_0x5ed0d0[_0x1c0479(0x1fa)]);if(!_0x588637)throw CliErrors[_0x1c0479(0x1fd)](_0x1c0479(0x1f4));},async 'dryRun'(_0x88bf65){const _0x585102=a248_0x5f2078,_0xe87a90=loadSqlProjectConfig(_0x88bf65[_0x585102(0x1ff)]),_0x2aa3d8=await readSqlLockFile(_0xe87a90[_0x585102(0x1fa)]);if(!_0x2aa3d8)throw CliErrors[_0x585102(0x1fd)](_0x585102(0x1f4));const {appLock:_0x4e5dcb}=ensureSqlLockScope(_0x2aa3d8,_0x88bf65[_0x585102(0x1ff)],_0xe87a90['sqlRoot'],_0x585102(0x1ef)),_0x46e99b=_0x88bf65['str'](_0x585102(0x202)),_0x35c10b=_0x4e5dcb[_0x585102(0x1f0)][_0x46e99b];if(!_0x35c10b)throw CliErrors[_0x585102(0x1fd)](_0x585102(0x208)+_0x46e99b+'\x22.');return{'method':_0x585102(0x1f7),'url':_0x585102(0x1f1),'body':{'sqlCode':_0x46e99b,'id':_0x35c10b[_0x585102(0x1ec)],'localPath':resolveLocalSqlFilePath(_0xe87a90,_0x46e99b,_0x35c10b)},'description':_0x585102(0x1ea)+_0x46e99b+_0x585102(0x1eb)+_0xe87a90[_0x585102(0x206)]};},async 'execute'(_0x41b3b2){const _0x30471f=a248_0x5f2078,_0x1b9891=loadSqlProjectConfig(_0x41b3b2['appCode']),_0x3dc5ed=await readSqlLockFile(_0x1b9891[_0x30471f(0x1fa)]);if(!_0x3dc5ed)throw CliErrors[_0x30471f(0x1fd)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x43d98b,appLock:_0x38697d}=ensureSqlLockScope(_0x3dc5ed,_0x41b3b2['appCode'],_0x1b9891[_0x30471f(0x1ee)],_0x30471f(0x1ef)),_0x52fb96=_0x41b3b2[_0x30471f(0x207)](_0x30471f(0x202)),_0x357305=_0x38697d[_0x30471f(0x1f0)][_0x52fb96];if(!_0x357305)throw CliErrors[_0x30471f(0x1fd)](_0x30471f(0x208)+_0x52fb96+'\x22.');await deleteSqlQuery({'id':_0x357305['remoteId'],'sqlCode':_0x52fb96}),_0x38697d[_0x30471f(0x1f0)]=Object['fromEntries'](Object[_0x30471f(0x203)](_0x38697d[_0x30471f(0x1f0)])['filter'](([_0x1ae6e0])=>_0x1ae6e0!==_0x52fb96)),_0x38697d['lastSync']=new Date()[_0x30471f(0x1f2)](),await writeSqlLockFile(_0x1b9891[_0x30471f(0x1fa)],_0x43d98b);const _0x3dd3e8=resolveLocalSqlFilePath(_0x1b9891,_0x52fb96,_0x357305);let _0x43023d;await fileExists(_0x3dd3e8)&&(_0x43023d=await moveToTrash(_0x1b9891[_0x30471f(0x1f8)],_0x1b9891[_0x30471f(0x206)],_0x3dd3e8),await cleanupEmptyDirectories(dirname(_0x3dd3e8),_0x1b9891['sqlRootDir']));const _0x4e0528={'deleted':_0x52fb96,'remoteId':_0x357305[_0x30471f(0x1ec)]};if(_0x43023d)_0x4e0528[_0x30471f(0x1fc)]=_0x43023d;return{'ok':!![],'data':_0x4e0528,'message':_0x30471f(0x1fb)+_0x52fb96+(_0x43023d?_0x30471f(0x1ed):'')};}};async function moveToTrash(_0x3d13b3,_0x14fc51,_0x2877e5){const _0x15952a=a248_0x5f2078,_0x4ae245=new Date()[_0x15952a(0x1f2)]()['replace'](/[:.]/g,'-'),_0x3470f2=relative(_0x3d13b3,_0x2877e5),_0x4436ee=join(_0x14fc51,_0x4ae245,_0x3470f2);return await mkdir(dirname(_0x4436ee),{'recursive':!![]}),await rename(_0x2877e5,_0x4436ee),_0x4436ee;}async function cleanupEmptyDirectories(_0x529562,_0x50605f){const _0x5eb882=a248_0x5f2078;let _0x2d2f52=resolve(_0x529562);const _0x43477f=resolve(_0x50605f);while(_0x2d2f52[_0x5eb882(0x205)](''+_0x43477f+sep)||_0x2d2f52===_0x43477f){if(_0x2d2f52===_0x43477f)return;try{const _0x571dba=await readdir(_0x2d2f52);if(_0x571dba['length']>0x0)return;await rmdir(_0x2d2f52);}catch{return;}_0x2d2f52=dirname(_0x2d2f52);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a249_0x57e477=a249_0x62ca;(function(_0x26b7ef,_0x2d43ab){const _0x4bb49b=a249_0x62ca,_0x4e3eec=_0x26b7ef();while(!![]){try{const _0x502da7=parseInt(_0x4bb49b(0x110))/0x1*(-parseInt(_0x4bb49b(0x10c))/0x2)+-parseInt(_0x4bb49b(0xfb))/0x3+parseInt(_0x4bb49b(0xfc))/0x4*(-parseInt(_0x4bb49b(0x102))/0x5)+-parseInt(_0x4bb49b(0x104))/0x6*(parseInt(_0x4bb49b(0x103))/0x7)+-parseInt(_0x4bb49b(0xfe))/0x8+-parseInt(_0x4bb49b(0x10e))/0x9*(-parseInt(_0x4bb49b(0x101))/0xa)+parseInt(_0x4bb49b(0x106))/0xb*(parseInt(_0x4bb49b(0x112))/0xc);if(_0x502da7===_0x2d43ab)break;else _0x4e3eec['push'](_0x4e3eec['shift']());}catch(_0x3918a6){_0x4e3eec['push'](_0x4e3eec['shift']());}}}(a249_0x1447,0xc424b));function a249_0x62ca(_0x5bd52d,_0x22cd0e){_0x5bd52d=_0x5bd52d-0xfb;const _0x144712=a249_0x1447();let _0x62ca2e=_0x144712[_0x5bd52d];return _0x62ca2e;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x57e477(0x10f),'command':a249_0x57e477(0xfd),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a249_0x57e477(0x109),'type':a249_0x57e477(0x107),'description':a249_0x57e477(0x10b)}],async 'execute'(_0x2bc70c){const _0x52fadc=a249_0x57e477,_0x37c308=await getSqlQueryInfo(_0x2bc70c[_0x52fadc(0x100)],_0x2bc70c['str'](_0x52fadc(0xff))),_0x2d61a9=_0x2bc70c[_0x52fadc(0x111)]('verbose');if(_0x2d61a9)return{'ok':!![],'data':_0x37c308};const _0x4675c5=_0x37c308[_0x52fadc(0x105)]?await getDbName(_0x2bc70c[_0x52fadc(0x100)],_0x37c308[_0x52fadc(0x105)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x37c308[_0x52fadc(0x10a)],'sqlName':_0x37c308['sqlName'],'db':_0x4675c5?_0x4675c5+'\x20('+_0x37c308[_0x52fadc(0x105)]+')':_0x37c308[_0x52fadc(0x105)]??'','description':_0x37c308[_0x52fadc(0x10d)]??'','sqlContent':_0x37c308[_0x52fadc(0x108)]??''}};}};function a249_0x1447(){const _0x2ad328=['sqlContent','verbose','sqlCode','Return\x20full\x20raw\x20SQL\x20query\x20object','47570xwuSBb','description','234585KJHkPA','sql','3MuZQpw','bool','12uTVVTb','1885497tCNjzH','335828AYXRKX','detail','5403872CzNMMO','sqlcode','appCode','10TxqnCz','20GXPTyB','99505UyEjxX','6Kxetkm','dbId','27529909KJIgAn','boolean'];a249_0x1447=function(){return _0x2ad328;};return a249_0x1447();}
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x20d9f9=a250_0xcca9;(function(_0x3d0bae,_0x47ec51){const _0x1d58c6=a250_0xcca9,_0x13df52=_0x3d0bae();while(!![]){try{const _0x171e01=parseInt(_0x1d58c6(0x171))/0x1*(-parseInt(_0x1d58c6(0x180))/0x2)+parseInt(_0x1d58c6(0x174))/0x3+parseInt(_0x1d58c6(0x179))/0x4*(-parseInt(_0x1d58c6(0x177))/0x5)+parseInt(_0x1d58c6(0x17f))/0x6+-parseInt(_0x1d58c6(0x173))/0x7+-parseInt(_0x1d58c6(0x172))/0x8+parseInt(_0x1d58c6(0x176))/0x9*(parseInt(_0x1d58c6(0x178))/0xa);if(_0x171e01===_0x47ec51)break;else _0x13df52['push'](_0x13df52['shift']());}catch(_0x520c24){_0x13df52['push'](_0x13df52['shift']());}}}(a250_0x3a2d,0xc0492));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a250_0x3a2d(){const _0x5b5758=['str','appCode','\x20row(s)\x20in\x20','exec','execError','params','6DcciHi','2072832ZAHdWr','451626gCGucN','1444062TulXCA','SQL\x20execution\x20failed','621Nxcxfb','5jtANPd','157430OeSalm','2757244NmQTpV','execResult','string','sqlcode','sql','execSuccess','4486032dQRZZs','171586aKQwxv','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','length'];a250_0x3a2d=function(){return _0x5b5758;};return a250_0x3a2d();}function a250_0xcca9(_0x330830,_0x3fcd2d){_0x330830=_0x330830-0x16e;const _0x3a2d64=a250_0x3a2d();let _0xcca9a2=_0x3a2d64[_0x330830];return _0xcca9a2;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a250_0x20d9f9(0x17d),'command':a250_0x20d9f9(0x16e),'description':a250_0x20d9f9(0x181),'risk':'read','flags':[SQLCODE_FLAG,{'name':'params','type':a250_0x20d9f9(0x17b),'description':a250_0x20d9f9(0x182)}],async 'execute'(_0x336a37){const _0x180770=a250_0x20d9f9,_0x53178c=parseJsonParams(_0x336a37[_0x180770(0x184)](_0x180770(0x170))),_0x4cd403=Date['now'](),_0x32fd5a=await executeSql(_0x336a37[_0x180770(0x185)],_0x336a37[_0x180770(0x184)](_0x180770(0x17c)),_0x53178c),_0x15266a=Date['now']()-_0x4cd403,_0x45698c=_0x32fd5a?.[_0x180770(0x17a)]??_0x32fd5a,_0x25bec0=_0x32fd5a?.[_0x180770(0x17e)]??!![];if(!_0x25bec0)return{'ok':![],'data':{'error':_0x32fd5a?.[_0x180770(0x16f)]||_0x180770(0x175),'elapsed':_0x15266a},'message':'SQL\x20execution\x20failed'};const _0x2d28f9=Array['isArray'](_0x45698c)?_0x45698c:[];return{'ok':!![],'data':{'rows':_0x2d28f9,'rowCount':_0x2d28f9[_0x180770(0x183)],'elapsed':_0x15266a},'message':'Returned\x20'+_0x2d28f9[_0x180770(0x183)]+_0x180770(0x186)+_0x15266a+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4b0748,_0x2708bb){const _0x4417d7=a251_0x2b78,_0x3157d4=_0x4b0748();while(!![]){try{const _0x54f112=parseInt(_0x4417d7(0x89))/0x1*(parseInt(_0x4417d7(0x8d))/0x2)+parseInt(_0x4417d7(0x8e))/0x3*(parseInt(_0x4417d7(0x83))/0x4)+-parseInt(_0x4417d7(0x8c))/0x5*(parseInt(_0x4417d7(0x8b))/0x6)+-parseInt(_0x4417d7(0x88))/0x7*(parseInt(_0x4417d7(0x86))/0x8)+parseInt(_0x4417d7(0x87))/0x9*(parseInt(_0x4417d7(0x84))/0xa)+-parseInt(_0x4417d7(0x8a))/0xb+-parseInt(_0x4417d7(0x85))/0xc;if(_0x54f112===_0x2708bb)break;else _0x3157d4['push'](_0x3157d4['shift']());}catch(_0x588a11){_0x3157d4['push'](_0x3157d4['shift']());}}}(a251_0x3c5c,0x5171a));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a251_0x3c5c(){const _0x3ade26=['16uuDZlO','10377JuyPHw','974197ydhPhH','743RVRdWB','1221891wPmZOh','2236356rRzklI','5pkwSSC','1724Pxzflj','349788HpcwLp','20HQlckx','4910UXJieO','8325912ELJTeS'];a251_0x3c5c=function(){return _0x3ade26;};return a251_0x3c5c();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a251_0x2b78(_0x4aaaca,_0x568fb5){_0x4aaaca=_0x4aaaca-0x83;const _0x3c5c19=a251_0x3c5c();let _0x2b78b2=_0x3c5c19[_0x4aaaca];return _0x2b78b2;}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 a252_0x13c748=a252_0x2c44;function a252_0x2c44(_0x43d0d9,_0x424b68){_0x43d0d9=_0x43d0d9-0x146;const _0x4b287c=a252_0x4b28();let _0x2c44f7=_0x4b287c[_0x43d0d9];return _0x2c44f7;}function a252_0x4b28(){const _0x3c445e=['49oKUjnQ','Found\x20','22090vStIdt','6JQsniG','page','Page\x20size','length','Filter\x20by\x20SQL\x20name','282vwVXpD','10940vXIiQz','241764nfvZty','299192JtklIl','1152kbGkne','pagesize','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','number','Page\x20number','totalCount','appCode','description','58456aUrjfz','name','bool','sqlCode','map','boolean','num','str','22100DWUUTJ','383572EqLeAs','sqlName','List\x20custom\x20SQL\x20queries','paging','dbId','read','110xsJrEG','string','sql','all','No\x20custom\x20SQL\x20queries\x20found.'];a252_0x4b28=function(){return _0x3c445e;};return a252_0x4b28();}(function(_0x356503,_0x785d4a){const _0x244ddf=a252_0x2c44,_0x40ae65=_0x356503();while(!![]){try{const _0x46bdfa=-parseInt(_0x244ddf(0x167))/0x1+-parseInt(_0x244ddf(0x156))/0x2+-parseInt(_0x244ddf(0x14e))/0x3*(-parseInt(_0x244ddf(0x168))/0x4)+-parseInt(_0x244ddf(0x14d))/0x5*(-parseInt(_0x244ddf(0x153))/0x6)+parseInt(_0x244ddf(0x14b))/0x7*(-parseInt(_0x244ddf(0x15f))/0x8)+-parseInt(_0x244ddf(0x157))/0x9*(-parseInt(_0x244ddf(0x154))/0xa)+-parseInt(_0x244ddf(0x146))/0xb*(parseInt(_0x244ddf(0x155))/0xc);if(_0x46bdfa===_0x785d4a)break;else _0x40ae65['push'](_0x40ae65['shift']());}catch(_0x31683b){_0x40ae65['push'](_0x40ae65['shift']());}}}(a252_0x4b28,0x1c1cd));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':a252_0x13c748(0x148),'command':'list','description':a252_0x13c748(0x16a),'risk':a252_0x13c748(0x16d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x13c748(0x160),'type':a252_0x13c748(0x147),'description':a252_0x13c748(0x152)},{'name':a252_0x13c748(0x14f),'type':'number','description':a252_0x13c748(0x15b),'default':0x1},{'name':a252_0x13c748(0x158),'type':a252_0x13c748(0x15a),'description':a252_0x13c748(0x150)},{'name':'verbose','type':a252_0x13c748(0x164),'description':a252_0x13c748(0x159)}],async 'execute'(_0x231109){const _0xb029c5=a252_0x13c748,_0x29c751=await listSqlQueries(_0x231109['appCode'],{'sqlCode':_0x231109[_0xb029c5(0x166)]('sqlcode')||undefined,'sqlName':_0x231109[_0xb029c5(0x166)](_0xb029c5(0x160))||undefined,'currentPage':_0x231109[_0xb029c5(0x165)]('page'),'pageSize':_0x231109[_0xb029c5(0x165)](_0xb029c5(0x158),0x32)}),_0x438833=_0x231109[_0xb029c5(0x161)]('verbose'),_0x44c192=_0x29c751['tableData']??[],_0x9444a3=_0x29c751[_0xb029c5(0x16b)]?.[_0xb029c5(0x15c)]??_0x44c192[_0xb029c5(0x151)];let _0x5643d9;return _0x438833?_0x5643d9=_0x44c192:_0x5643d9=await Promise[_0xb029c5(0x149)](_0x44c192[_0xb029c5(0x163)](async _0xe9137d=>{const _0x30dee4=_0xb029c5;let _0x3b7385;try{_0x3b7385=_0xe9137d[_0x30dee4(0x16c)]?await getDbName(_0x231109[_0x30dee4(0x15d)],_0xe9137d[_0x30dee4(0x16c)]):undefined;}catch{}return{'sqlCode':_0xe9137d[_0x30dee4(0x162)],'sqlName':_0xe9137d[_0x30dee4(0x169)],'description':_0xe9137d[_0x30dee4(0x15e)]??'','db':_0x3b7385?_0x3b7385+'\x20('+_0xe9137d[_0x30dee4(0x16c)]+')':_0xe9137d[_0x30dee4(0x16c)]??''};})),{'ok':!![],'data':_0x5643d9,'message':_0x44c192[_0xb029c5(0x151)]===0x0?_0xb029c5(0x14a):_0xb029c5(0x14c)+_0x44c192[_0xb029c5(0x151)]+'\x20SQL\x20queries\x20(total:\x20'+_0x9444a3+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a253_0x82148e=a253_0x4483;(function(_0x46137d,_0x1cf954){const _0x276d62=a253_0x4483,_0x2802b7=_0x46137d();while(!![]){try{const _0x68d4b9=parseInt(_0x276d62(0x195))/0x1*(parseInt(_0x276d62(0x186))/0x2)+parseInt(_0x276d62(0x1a9))/0x3*(-parseInt(_0x276d62(0x17e))/0x4)+-parseInt(_0x276d62(0x17a))/0x5+-parseInt(_0x276d62(0x188))/0x6+parseInt(_0x276d62(0x16d))/0x7*(parseInt(_0x276d62(0x17f))/0x8)+parseInt(_0x276d62(0x182))/0x9*(parseInt(_0x276d62(0x1a6))/0xa)+parseInt(_0x276d62(0x19b))/0xb;if(_0x68d4b9===_0x1cf954)break;else _0x2802b7['push'](_0x2802b7['shift']());}catch(_0x17af1a){_0x2802b7['push'](_0x2802b7['shift']());}}}(a253_0x20ed,0xefa8a));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a253_0x20ed(){const _0x2d8d30=['join','some','762amOfEL','cancelled','792204oaycPU','\x20failed','catch','dbId','boolean','nonInteractive','would_pull','filter','name','sqlcode','replace','isCanonical','sqlRootDir','1745QBSIqY','content','local\x20differs\x20from\x20remote','Filter\x20by\x20SQL\x20display\x20name','length','bool','11192456HxMVae','skipped','No\x20remote\x20SQL\x20queries\x20matched.','.xml','Force\x20pull\x20cancelled.','Pull\x20complete:\x20','str','all','mybatisXml','read','force','320SNZibk','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','message','3659613fBqZJa','utf8','\x20skipped,\x20','split','description','toISOString','pull','Force\x20overwrite\x20local\x20unsynced\x20changes','push','string','unchanged','Would\x20pull\x20','path','endsWith','file','test','apps','1442cSZqSO','mode','conflict','paging','sqls','totalCount','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','equivalent','trim','appCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlRoot','POST','2853180gnkmhe','\x20SQL\x20file(s)\x20into\x20','sql','sqlCode','4lPvsRI','16888qfTthF','lockFilePath','sqlName','221337puAmJv','filePath'];a253_0x20ed=function(){return _0x2d8d30;};return a253_0x20ed();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x4868f8,_0xfa1950){const _0xd038d0=a253_0x4483,_0x4801f1=[];let _0x2c0189=0x1;while(!![]){const _0x164131=await listSqlQueries(_0x4868f8,{'currentPage':_0x2c0189,'pageSize':PAGE_SIZE,'sqlCode':_0xfa1950[_0xd038d0(0x17d)],'sqlName':_0xfa1950[_0xd038d0(0x181)]}),_0x3a69ed=_0x164131['tableData']??[];_0x4801f1['push'](..._0x3a69ed);if(_0x3a69ed[_0xd038d0(0x199)]===0x0)break;const _0x325eb1=_0x164131[_0xd038d0(0x170)]?.[_0xd038d0(0x172)];if(_0x325eb1!=null?_0x4801f1[_0xd038d0(0x199)]>=_0x325eb1:_0x3a69ed[_0xd038d0(0x199)]<PAGE_SIZE)break;_0x2c0189++;}return _0x4801f1;}async function ensureSqlContent(_0x406382){const _0x1e5ece=a253_0x4483;if(_0x406382['sqlContent']!=null&&String(_0x406382['sqlContent'])['length']>0x0)return _0x406382;return getSqlQueryDetail(_0x406382[_0x1e5ece(0x17d)]);}export const sqlPull={'service':a253_0x82148e(0x17c),'command':'pull','description':a253_0x82148e(0x177),'risk':a253_0x82148e(0x1a4),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a253_0x82148e(0x1b2),'description':a253_0x82148e(0x198)},{'name':a253_0x82148e(0x1a5),'type':a253_0x82148e(0x18c),'description':a253_0x82148e(0x1b0)}],async 'dryRun'(_0xd24ab3){const _0xf95a96=a253_0x82148e,_0x4bb9b7=loadSqlProjectConfig(_0xd24ab3['appCode']),_0x58ef96=await readSqlLockFile(_0x4bb9b7[_0xf95a96(0x180)]),{appLock:_0x547a62}=ensureSqlLockScope(_0x58ef96??createEmptySqlLock(),_0x4bb9b7['appCode'],_0x4bb9b7[_0xf95a96(0x178)],_0xf95a96(0x1af)),_0x1c2707=await fetchAllSqlQueries(_0xd24ab3[_0xf95a96(0x176)],{'sqlCode':_0xd24ab3['str'](_0xf95a96(0x191))||undefined,'sqlName':_0xd24ab3[_0xf95a96(0x1a1)](_0xf95a96(0x190))||undefined}),_0x4a6f9c=[];for(const _0x1d2f3a of _0x1c2707){const _0x2dfe6e=await ensureSqlContent(_0x1d2f3a),_0x286979=ensureRemoteSqlContent(_0x2dfe6e),_0xa3eb45=detectSqlMode(_0x286979),_0x1683bc=_0x2dfe6e[_0xf95a96(0x18b)]?await getDbName(_0xd24ab3[_0xf95a96(0x176)],Number(_0x2dfe6e[_0xf95a96(0x18b)]))[_0xf95a96(0x18a)](()=>undefined):undefined,_0x191c18=buildLocalSqlFileContent({'sqlCode':_0x2dfe6e[_0xf95a96(0x17d)],'sqlName':_0x2dfe6e[_0xf95a96(0x181)],'dbId':_0x2dfe6e['dbId']},_0x286979,{'dbName':_0x1683bc,'mode':_0xa3eb45,'syncedAt':new Date()[_0xf95a96(0x1ae)](),'description':_0x2dfe6e['description']}),_0x28646d=buildSqlLockEntry(_0x2dfe6e,_0x286979,'',{'dbName':_0x1683bc}),_0x547cb2=resolveLocalSqlFilePath(_0x4bb9b7,_0x2dfe6e[_0xf95a96(0x17d)],_0x28646d);let _0x5ae69b=_0xf95a96(0x18e),_0x173578;const _0x5ba08d=await findExistingSqlFiles(_0x4bb9b7,_0x547cb2,_0xa3eb45,_0x547a62[_0xf95a96(0x171)][_0x2dfe6e[_0xf95a96(0x17d)]]);if(_0x5ba08d[_0xf95a96(0x199)]>0x0){const _0x4630d8=await compareExistingSqlFiles(_0x5ba08d,_0x191c18,_0xa3eb45);if(_0x4630d8['some'](({equivalent:_0x5704cb})=>!_0x5704cb))_0x5ae69b=_0xf95a96(0x16f),_0x173578=_0xf95a96(0x1a7);else _0x4630d8[_0xf95a96(0x199)]===0x1&&_0x4630d8[0x0]?.['file'][_0xf95a96(0x193)]&&(_0x5ae69b=_0xf95a96(0x19c),_0x173578=_0xf95a96(0x1b3));}_0x4a6f9c[_0xf95a96(0x1b1)]({'sqlCode':_0x2dfe6e[_0xf95a96(0x17d)],'sqlName':_0x2dfe6e[_0xf95a96(0x181)],'filePath':_0x547cb2,'status':_0x5ae69b,'reason':_0x173578});}return{'method':_0xf95a96(0x179),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0xd24ab3[_0xf95a96(0x176)],'sqlCode':_0xd24ab3[_0xf95a96(0x1a1)]('sqlcode')||null,'sqlName':_0xd24ab3[_0xf95a96(0x1a1)](_0xf95a96(0x190))||null,'files':_0x4a6f9c},'description':_0xf95a96(0x1b4)+_0x4a6f9c[_0xf95a96(0x199)]+_0xf95a96(0x17b)+_0x4bb9b7[_0xf95a96(0x194)]};},async 'execute'(_0x59c601){const _0x2acc41=a253_0x82148e,_0x28a546=loadSqlProjectConfig(_0x59c601[_0x2acc41(0x176)]),_0x3a195d=await readSqlLockFile(_0x28a546[_0x2acc41(0x180)]),{lockData:_0xd6cdd7,appLock:_0x44a4e0}=ensureSqlLockScope(_0x3a195d??createEmptySqlLock(),_0x28a546[_0x2acc41(0x176)],_0x28a546['sqlRoot'],'pull'),_0x11cd11=_0x59c601[_0x2acc41(0x19a)]('force'),_0x4f222d=await fetchAllSqlQueries(_0x59c601[_0x2acc41(0x176)],{'sqlCode':_0x59c601[_0x2acc41(0x1a1)](_0x2acc41(0x191))||undefined,'sqlName':_0x59c601[_0x2acc41(0x1a1)]('name')||undefined});if(_0x4f222d['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2acc41(0x19d)};const _0x276179=[],_0x1db820=[];for(const _0x5d10f7 of _0x4f222d){try{_0x276179[_0x2acc41(0x1b1)](await ensureSqlContent(_0x5d10f7));}catch(_0x513ec7){_0x1db820['push']({'sqlCode':_0x5d10f7[_0x2acc41(0x17d)],'error':_0x513ec7 instanceof Error?_0x513ec7[_0x2acc41(0x1a8)]:String(_0x513ec7)});}}if(_0x11cd11&&!_0x59c601[_0x2acc41(0x18d)]){let _0xfb1642=![];for(const _0xcd9c09 of _0x276179){const _0x158b59=detectSqlMode(ensureRemoteSqlContent(_0xcd9c09)),_0x1048d4=_0xcd9c09[_0x2acc41(0x18b)]?await getDbName(_0x59c601['appCode'],Number(_0xcd9c09[_0x2acc41(0x18b)]))['catch'](()=>undefined):undefined,_0x2138f2=buildLocalSqlFileContent({'sqlCode':_0xcd9c09['sqlCode'],'sqlName':_0xcd9c09[_0x2acc41(0x181)],'dbId':_0xcd9c09['dbId']},ensureRemoteSqlContent(_0xcd9c09),{'dbName':_0x1048d4,'mode':_0x158b59,'syncedAt':new Date()[_0x2acc41(0x1ae)](),'description':_0xcd9c09[_0x2acc41(0x1ad)]}),_0x2432e8=resolveLocalSqlFilePath(_0x28a546,_0xcd9c09[_0x2acc41(0x17d)],buildSqlLockEntry(_0xcd9c09,ensureRemoteSqlContent(_0xcd9c09),'',{'dbName':_0x1048d4})),_0x56b3ff=await findExistingSqlFiles(_0x28a546,_0x2432e8,_0x158b59,_0x44a4e0[_0x2acc41(0x171)][_0xcd9c09['sqlCode']]),_0x557ff1=await compareExistingSqlFiles(_0x56b3ff,_0x2138f2,_0x158b59);if(_0x557ff1[_0x2acc41(0x185)](({equivalent:_0x3eddbf})=>!_0x3eddbf)){_0xfb1642=!![];break;}}if(_0xfb1642){const _0x79f63b=await confirmForceOverwrite(_0x2acc41(0x173));if(!_0x79f63b)throw CliErrors[_0x2acc41(0x187)](_0x2acc41(0x19f));}}const _0x55fa0b=cloneSqlLockData(_0xd6cdd7),_0x3461f3=_0x55fa0b[_0x2acc41(0x16c)][_0x28a546[_0x2acc41(0x176)]],_0x40106c=[],_0x4e19f7=[];for(const _0x3d63df of _0x276179){const _0x7a4791=_0x3461f3['sqls'][_0x3d63df[_0x2acc41(0x17d)]],_0x15b70e=ensureRemoteSqlContent(_0x3d63df),_0x1b54c8=detectSqlMode(_0x15b70e),_0x64bb88=_0x3d63df[_0x2acc41(0x18b)]?await getDbName(_0x59c601['appCode'],Number(_0x3d63df['dbId']))['catch'](()=>undefined):undefined,_0x488c4b=buildLocalSqlFileContent({'sqlCode':_0x3d63df['sqlCode'],'sqlName':_0x3d63df[_0x2acc41(0x181)],'dbId':_0x3d63df[_0x2acc41(0x18b)]},_0x15b70e,{'dbName':_0x64bb88,'mode':_0x1b54c8,'syncedAt':new Date()[_0x2acc41(0x1ae)](),'description':_0x3d63df[_0x2acc41(0x1ad)]}),_0x53cac5=buildSqlLockEntry(_0x3d63df,_0x15b70e,computeSqlContentHash(_0x488c4b),{'dbName':_0x64bb88}),_0x3d120a=_0x53cac5['path'],_0x26d1cb=join(_0x28a546['sqlRootDir'],_0x3d120a);try{const _0x1b86b4=await findExistingSqlFiles(_0x28a546,_0x26d1cb,_0x1b54c8,_0x7a4791),_0x1cfe67=await compareExistingSqlFiles(_0x1b86b4,_0x488c4b,_0x1b54c8);if(!_0x11cd11&&_0x1cfe67[_0x2acc41(0x185)](({equivalent:_0x15ae97})=>!_0x15ae97)){_0x4e19f7['push']({'sqlCode':_0x3d63df[_0x2acc41(0x17d)],'reason':_0x2acc41(0x197)});continue;}const _0x2456a2=_0x1cfe67['find'](({file:_0x44f0fb})=>_0x44f0fb['isCanonical']),_0xccce51=_0x1cfe67['find'](({file:_0x209702})=>!_0x209702[_0x2acc41(0x193)]);if(_0x2456a2?.[_0x2acc41(0x174)]&&!_0xccce51){_0x4e19f7[_0x2acc41(0x1b1)]({'sqlCode':_0x3d63df[_0x2acc41(0x17d)],'reason':_0x2acc41(0x1b3)}),_0x3461f3[_0x2acc41(0x171)][_0x3d63df[_0x2acc41(0x17d)]]={..._0x53cac5,'hash':computeSqlContentHash(_0x2456a2[_0x2acc41(0x196)]),'path':_0x3d120a};continue;}!_0x2456a2?.[_0x2acc41(0x174)]&&(await ensureParentDirectory(_0x26d1cb),await writeFile(_0x26d1cb,_0x488c4b,_0x2acc41(0x1aa))),_0xccce51&&await rm(_0xccce51[_0x2acc41(0x16a)][_0x2acc41(0x183)],{'force':!![]}),_0x3461f3[_0x2acc41(0x171)][_0x3d63df[_0x2acc41(0x17d)]]={..._0x53cac5,'hash':_0x2456a2?.[_0x2acc41(0x174)]?computeSqlContentHash(_0x2456a2[_0x2acc41(0x196)]):_0x53cac5['hash'],'path':_0x3d120a},_0x40106c[_0x2acc41(0x1b1)]({'sqlCode':_0x3d63df[_0x2acc41(0x17d)],'filePath':_0x26d1cb});}catch(_0x2e3ed8){_0x1db820[_0x2acc41(0x1b1)]({'sqlCode':_0x3d63df[_0x2acc41(0x17d)],'error':_0x2e3ed8 instanceof Error?_0x2e3ed8[_0x2acc41(0x1a8)]:String(_0x2e3ed8)});}}return _0x3461f3['lastSync']=new Date()[_0x2acc41(0x1ae)](),await writeSqlLockFile(_0x28a546[_0x2acc41(0x180)],_0x55fa0b),{'ok':_0x1db820[_0x2acc41(0x199)]===0x0,'data':{'pulled':_0x40106c,'skipped':_0x4e19f7,'failed':_0x1db820},'message':_0x2acc41(0x1a0)+_0x40106c[_0x2acc41(0x199)]+'\x20written,\x20'+_0x4e19f7[_0x2acc41(0x199)]+_0x2acc41(0x1ab)+_0x1db820['length']+_0x2acc41(0x189)};}};function isEquivalentPulledSqlFile(_0x2b2777,_0x53f785,_0x134263,_0x108335){if(_0x134263!==_0x108335)return normalizePulledSqlBody(_0x2b2777,_0x134263)===normalizePulledSqlBody(_0x53f785,_0x108335);return normalizePullComparableContent(_0x2b2777,_0x134263)===normalizePullComparableContent(_0x53f785,_0x108335);}async function findExistingSqlFiles(_0x34d23a,_0x2f0417,_0x4ddbbe,_0x3d41b3){const _0x3941c9=a253_0x82148e,_0x3842ac=[];await fileExists(_0x2f0417)&&_0x3842ac[_0x3941c9(0x1b1)]({'filePath':_0x2f0417,'mode':_0x4ddbbe,'isCanonical':!![]});if(!_0x3d41b3?.['path'])return _0x3842ac;const _0x5a295c=join(_0x34d23a['sqlRootDir'],_0x3d41b3[_0x3941c9(0x1b5)]);if(_0x5a295c===_0x2f0417)return _0x3842ac;return await fileExists(_0x5a295c)&&_0x3842ac[_0x3941c9(0x1b1)]({'filePath':_0x5a295c,'mode':_0x3d41b3[_0x3941c9(0x16e)]??modeFromFilePath(_0x5a295c),'isCanonical':![]}),_0x3842ac;}async function compareExistingSqlFiles(_0x13ea47,_0x4adb5c,_0x2d8f07){const _0x17a690=a253_0x82148e;return Promise[_0x17a690(0x1a2)](_0x13ea47['map'](async _0x5ead5d=>{const _0xcf3b18=_0x17a690,_0x2b5254=await readFile(_0x5ead5d[_0xcf3b18(0x183)],'utf8');return{'file':_0x5ead5d,'content':_0x2b5254,'equivalent':isEquivalentPulledSqlFile(_0x2b5254,_0x4adb5c,_0x5ead5d[_0xcf3b18(0x16e)],_0x2d8f07)};}));}function modeFromFilePath(_0x1c2445){const _0x318c12=a253_0x82148e;return _0x1c2445['toLowerCase']()[_0x318c12(0x1b6)](_0x318c12(0x19e))?_0x318c12(0x1a3):_0x318c12(0x17c);}function normalizePulledSqlBody(_0x138428,_0x5c99b6){const _0x3ed046=a253_0x82148e;return stripLocalSqlMetadata(_0x138428,_0x5c99b6)[_0x3ed046(0x192)](/\r\n/g,'\x0a')[_0x3ed046(0x175)]();}function normalizePullComparableContent(_0x3d5b3f,_0x24cb7b){const _0x2c7067=a253_0x82148e,_0x3729ab=_0x3d5b3f[_0x2c7067(0x192)](/\r\n/g,'\x0a')[_0x2c7067(0x1ac)]('\x0a'),_0x112863=_0x3729ab[_0x2c7067(0x18f)](_0xe70d19=>!isSyncedAtMetadataLine(_0xe70d19,_0x24cb7b));return _0x112863[_0x2c7067(0x184)]('\x0a');}function a253_0x4483(_0x1827f9,_0x4d88a6){_0x1827f9=_0x1827f9-0x16a;const _0x20ed8b=a253_0x20ed();let _0x4483c7=_0x20ed8b[_0x1827f9];return _0x4483c7;}function isSyncedAtMetadataLine(_0x4c428a,_0x17962f){const _0x240a21=a253_0x82148e;if(_0x17962f===_0x240a21(0x1a3))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x240a21(0x16b)](_0x4c428a);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x240a21(0x16b)](_0x4c428a);}
|
|
1
|
+
const a253_0x5936e3=a253_0xdce6;(function(_0x4a6ace,_0x28a55c){const _0x34ad27=a253_0xdce6,_0x26e087=_0x4a6ace();while(!![]){try{const _0x5bd48a=-parseInt(_0x34ad27(0x155))/0x1*(-parseInt(_0x34ad27(0x171))/0x2)+-parseInt(_0x34ad27(0x172))/0x3+parseInt(_0x34ad27(0x14f))/0x4+-parseInt(_0x34ad27(0x160))/0x5+parseInt(_0x34ad27(0x166))/0x6*(parseInt(_0x34ad27(0x13d))/0x7)+-parseInt(_0x34ad27(0x145))/0x8+parseInt(_0x34ad27(0x12f))/0x9*(parseInt(_0x34ad27(0x15e))/0xa);if(_0x5bd48a===_0x28a55c)break;else _0x26e087['push'](_0x26e087['shift']());}catch(_0x42c7ba){_0x26e087['push'](_0x26e087['shift']());}}}(a253_0x10a3,0xa9660));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';function a253_0x10a3(){const _0x5edc3f=['Force\x20pull\x20cancelled.','skipped','\x20skipped,\x20','catch','10ABZjZY','content','6054790ZiRQud','tableData','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','POST','find','\x20written,\x20','378WavYvR','message','sqlName','force','filePath','sqlContent','lastSync','equivalent','sqlCode','local\x20differs\x20from\x20remote','apps','15862afjBDH','4143777ZPqYlM','join','boolean','unchanged','dbId','file','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','toLowerCase','string','lockFilePath','24542181HWLJTs','would_pull','bool','appCode','some','filter','sqlRootDir','Pull\x20complete:\x20','conflict','description','pull','mybatisXml','name','hash','70329OkSJVo','Filter\x20by\x20SQL\x20display\x20name','split','toISOString','sqlcode','replace','all','sql','6689392TevYKS','utf8','mode','isCanonical','sqls','totalCount','No\x20remote\x20SQL\x20queries\x20matched.','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','push','sqlRoot','2605372NmPXPw','length','endsWith','read','\x20failed','test','14wmWCCF','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','str','path','nonInteractive'];a253_0x10a3=function(){return _0x5edc3f;};return a253_0x10a3();}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(_0x2bd855,_0x177c78){const _0x4f63c8=a253_0xdce6,_0x451927=[];let _0x1ea8ad=0x1;while(!![]){const _0x558147=await listSqlQueries(_0x2bd855,{'currentPage':_0x1ea8ad,'pageSize':PAGE_SIZE,'sqlCode':_0x177c78[_0x4f63c8(0x16e)],'sqlName':_0x177c78[_0x4f63c8(0x168)]}),_0x3c71ff=_0x558147[_0x4f63c8(0x161)]??[];_0x451927[_0x4f63c8(0x14d)](..._0x3c71ff);if(_0x3c71ff[_0x4f63c8(0x150)]===0x0)break;const _0x1bc582=_0x558147['paging']?.[_0x4f63c8(0x14a)];if(_0x1bc582!=null?_0x451927[_0x4f63c8(0x150)]>=_0x1bc582:_0x3c71ff[_0x4f63c8(0x150)]<PAGE_SIZE)break;_0x1ea8ad++;}return _0x451927;}async function ensureSqlContent(_0x154438){const _0x13d856=a253_0xdce6;if(_0x154438[_0x13d856(0x16b)]!=null&&String(_0x154438[_0x13d856(0x16b)])['length']>0x0)return _0x154438;return getSqlQueryDetail(_0x154438[_0x13d856(0x16e)]);}export const sqlPull={'service':a253_0x5936e3(0x144),'command':a253_0x5936e3(0x139),'description':a253_0x5936e3(0x162),'risk':a253_0x5936e3(0x152),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x5936e3(0x13b),'type':a253_0x5936e3(0x12d),'description':a253_0x5936e3(0x13e)},{'name':a253_0x5936e3(0x169),'type':a253_0x5936e3(0x174),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x3c2d29){const _0x288963=a253_0x5936e3,_0x808764=loadSqlProjectConfig(_0x3c2d29[_0x288963(0x132)]),_0x31ed24=await readSqlLockFile(_0x808764['lockFilePath']),{appLock:_0x56988b}=ensureSqlLockScope(_0x31ed24??createEmptySqlLock(),_0x808764[_0x288963(0x132)],_0x808764[_0x288963(0x14e)],_0x288963(0x139)),_0x13fa98=await fetchAllSqlQueries(_0x3c2d29['appCode'],{'sqlCode':_0x3c2d29[_0x288963(0x157)](_0x288963(0x141))||undefined,'sqlName':_0x3c2d29['str']('name')||undefined}),_0x40b3df=[];for(const _0x59be73 of _0x13fa98){const _0xedf04e=await ensureSqlContent(_0x59be73),_0x5c8776=ensureRemoteSqlContent(_0xedf04e),_0x239cba=detectSqlMode(_0x5c8776),_0x402d47=_0xedf04e[_0x288963(0x176)]?await getDbName(_0x3c2d29[_0x288963(0x132)],Number(_0xedf04e[_0x288963(0x176)]))[_0x288963(0x15d)](()=>undefined):undefined,_0x5623af=buildLocalSqlFileContent({'sqlCode':_0xedf04e[_0x288963(0x16e)],'sqlName':_0xedf04e[_0x288963(0x168)],'dbId':_0xedf04e[_0x288963(0x176)]},_0x5c8776,{'dbName':_0x402d47,'mode':_0x239cba,'syncedAt':new Date()['toISOString'](),'description':_0xedf04e['description']}),_0xc0d25b=buildSqlLockEntry(_0xedf04e,_0x5c8776,'',{'dbName':_0x402d47}),_0xbf17b7=resolveLocalSqlFilePath(_0x808764,_0xedf04e[_0x288963(0x16e)],_0xc0d25b);let _0x119031=_0x288963(0x130),_0x3b9deb;const _0x20f21d=await findExistingSqlFiles(_0x808764,_0xbf17b7,_0x239cba,_0x56988b['sqls'][_0xedf04e[_0x288963(0x16e)]]);if(_0x20f21d[_0x288963(0x150)]>0x0){const _0x342e95=await compareExistingSqlFiles(_0x20f21d,_0x5623af,_0x239cba);if(_0x342e95[_0x288963(0x133)](({equivalent:_0x1953d9})=>!_0x1953d9))_0x119031=_0x288963(0x137),_0x3b9deb=_0x288963(0x156);else _0x342e95[_0x288963(0x150)]===0x1&&_0x342e95[0x0]?.[_0x288963(0x177)][_0x288963(0x148)]&&(_0x119031=_0x288963(0x15b),_0x3b9deb=_0x288963(0x175));}_0x40b3df[_0x288963(0x14d)]({'sqlCode':_0xedf04e[_0x288963(0x16e)],'sqlName':_0xedf04e[_0x288963(0x168)],'filePath':_0xbf17b7,'status':_0x119031,'reason':_0x3b9deb});}return{'method':_0x288963(0x163),'url':_0x288963(0x14c),'body':{'appCode':_0x3c2d29[_0x288963(0x132)],'sqlCode':_0x3c2d29[_0x288963(0x157)]('sqlcode')||null,'sqlName':_0x3c2d29[_0x288963(0x157)]('name')||null,'files':_0x40b3df},'description':'Would\x20pull\x20'+_0x40b3df[_0x288963(0x150)]+'\x20SQL\x20file(s)\x20into\x20'+_0x808764[_0x288963(0x135)]};},async 'execute'(_0x777530){const _0x547c92=a253_0x5936e3,_0x2d6714=loadSqlProjectConfig(_0x777530[_0x547c92(0x132)]),_0x66492f=await readSqlLockFile(_0x2d6714[_0x547c92(0x12e)]),{lockData:_0x1b53dd,appLock:_0x598f1b}=ensureSqlLockScope(_0x66492f??createEmptySqlLock(),_0x2d6714['appCode'],_0x2d6714[_0x547c92(0x14e)],'pull'),_0x48eba1=_0x777530[_0x547c92(0x131)](_0x547c92(0x169)),_0x2fe752=await fetchAllSqlQueries(_0x777530['appCode'],{'sqlCode':_0x777530[_0x547c92(0x157)]('sqlcode')||undefined,'sqlName':_0x777530['str']('name')||undefined});if(_0x2fe752[_0x547c92(0x150)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x547c92(0x14b)};const _0x359426=[],_0x9394c8=[];for(const _0x5a31e7 of _0x2fe752){try{_0x359426[_0x547c92(0x14d)](await ensureSqlContent(_0x5a31e7));}catch(_0x189b70){_0x9394c8[_0x547c92(0x14d)]({'sqlCode':_0x5a31e7[_0x547c92(0x16e)],'error':_0x189b70 instanceof Error?_0x189b70['message']:String(_0x189b70)});}}if(_0x48eba1&&!_0x777530[_0x547c92(0x159)]){let _0x19227f=![];for(const _0x45be2f of _0x359426){const _0x8e1d62=detectSqlMode(ensureRemoteSqlContent(_0x45be2f)),_0x3173d9=_0x45be2f[_0x547c92(0x176)]?await getDbName(_0x777530['appCode'],Number(_0x45be2f[_0x547c92(0x176)]))[_0x547c92(0x15d)](()=>undefined):undefined,_0x986dae=buildLocalSqlFileContent({'sqlCode':_0x45be2f[_0x547c92(0x16e)],'sqlName':_0x45be2f[_0x547c92(0x168)],'dbId':_0x45be2f[_0x547c92(0x176)]},ensureRemoteSqlContent(_0x45be2f),{'dbName':_0x3173d9,'mode':_0x8e1d62,'syncedAt':new Date()['toISOString'](),'description':_0x45be2f[_0x547c92(0x138)]}),_0x55c1fe=resolveLocalSqlFilePath(_0x2d6714,_0x45be2f['sqlCode'],buildSqlLockEntry(_0x45be2f,ensureRemoteSqlContent(_0x45be2f),'',{'dbName':_0x3173d9})),_0x3979e2=await findExistingSqlFiles(_0x2d6714,_0x55c1fe,_0x8e1d62,_0x598f1b['sqls'][_0x45be2f[_0x547c92(0x16e)]]),_0xd42d13=await compareExistingSqlFiles(_0x3979e2,_0x986dae,_0x8e1d62);if(_0xd42d13[_0x547c92(0x133)](({equivalent:_0x1e652b})=>!_0x1e652b)){_0x19227f=!![];break;}}if(_0x19227f){const _0xbd8b1d=await confirmForceOverwrite(_0x547c92(0x178));if(!_0xbd8b1d)throw CliErrors['cancelled'](_0x547c92(0x15a));}}const _0x5a883e=cloneSqlLockData(_0x1b53dd),_0x2340fb=_0x5a883e[_0x547c92(0x170)][_0x2d6714[_0x547c92(0x132)]],_0x45448b=[],_0x4130c5=[];for(const _0x2aa1c8 of _0x359426){const _0x30c9bb=_0x2340fb[_0x547c92(0x149)][_0x2aa1c8[_0x547c92(0x16e)]],_0x171549=ensureRemoteSqlContent(_0x2aa1c8),_0x4ca6e5=detectSqlMode(_0x171549),_0x143f22=_0x2aa1c8[_0x547c92(0x176)]?await getDbName(_0x777530[_0x547c92(0x132)],Number(_0x2aa1c8[_0x547c92(0x176)]))[_0x547c92(0x15d)](()=>undefined):undefined,_0x25a8f7=buildLocalSqlFileContent({'sqlCode':_0x2aa1c8[_0x547c92(0x16e)],'sqlName':_0x2aa1c8[_0x547c92(0x168)],'dbId':_0x2aa1c8[_0x547c92(0x176)]},_0x171549,{'dbName':_0x143f22,'mode':_0x4ca6e5,'syncedAt':new Date()[_0x547c92(0x140)](),'description':_0x2aa1c8['description']}),_0x5866f8=buildSqlLockEntry(_0x2aa1c8,_0x171549,computeSqlContentHash(_0x25a8f7),{'dbName':_0x143f22}),_0x5b37cb=_0x5866f8[_0x547c92(0x158)],_0x4dee17=join(_0x2d6714['sqlRootDir'],_0x5b37cb);try{const _0x2b31b1=await findExistingSqlFiles(_0x2d6714,_0x4dee17,_0x4ca6e5,_0x30c9bb),_0x1489d3=await compareExistingSqlFiles(_0x2b31b1,_0x25a8f7,_0x4ca6e5);if(!_0x48eba1&&_0x1489d3[_0x547c92(0x133)](({equivalent:_0x28f880})=>!_0x28f880)){_0x4130c5[_0x547c92(0x14d)]({'sqlCode':_0x2aa1c8[_0x547c92(0x16e)],'reason':_0x547c92(0x16f)});continue;}const _0x7c0adb=_0x1489d3[_0x547c92(0x164)](({file:_0x3b37c5})=>_0x3b37c5['isCanonical']),_0x2f2d6f=_0x1489d3['find'](({file:_0x3159a6})=>!_0x3159a6[_0x547c92(0x148)]);if(_0x7c0adb?.[_0x547c92(0x16d)]&&!_0x2f2d6f){_0x4130c5[_0x547c92(0x14d)]({'sqlCode':_0x2aa1c8[_0x547c92(0x16e)],'reason':_0x547c92(0x175)}),_0x2340fb['sqls'][_0x2aa1c8['sqlCode']]={..._0x5866f8,'hash':computeSqlContentHash(_0x7c0adb[_0x547c92(0x15f)]),'path':_0x5b37cb};continue;}!_0x7c0adb?.[_0x547c92(0x16d)]&&(await ensureParentDirectory(_0x4dee17),await writeFile(_0x4dee17,_0x25a8f7,_0x547c92(0x146))),_0x2f2d6f&&await rm(_0x2f2d6f[_0x547c92(0x177)]['filePath'],{'force':!![]}),_0x2340fb[_0x547c92(0x149)][_0x2aa1c8[_0x547c92(0x16e)]]={..._0x5866f8,'hash':_0x7c0adb?.[_0x547c92(0x16d)]?computeSqlContentHash(_0x7c0adb[_0x547c92(0x15f)]):_0x5866f8[_0x547c92(0x13c)],'path':_0x5b37cb},_0x45448b[_0x547c92(0x14d)]({'sqlCode':_0x2aa1c8[_0x547c92(0x16e)],'filePath':_0x4dee17});}catch(_0x116679){_0x9394c8['push']({'sqlCode':_0x2aa1c8['sqlCode'],'error':_0x116679 instanceof Error?_0x116679[_0x547c92(0x167)]:String(_0x116679)});}}return _0x2340fb[_0x547c92(0x16c)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2d6714[_0x547c92(0x12e)],_0x5a883e),{'ok':_0x9394c8[_0x547c92(0x150)]===0x0,'data':{'pulled':_0x45448b,'skipped':_0x4130c5,'failed':_0x9394c8},'message':_0x547c92(0x136)+_0x45448b[_0x547c92(0x150)]+_0x547c92(0x165)+_0x4130c5[_0x547c92(0x150)]+_0x547c92(0x15c)+_0x9394c8[_0x547c92(0x150)]+_0x547c92(0x153)};}};function isEquivalentPulledSqlFile(_0x38d214,_0x1a36a7,_0x197d65,_0x5bfddb){if(_0x197d65!==_0x5bfddb)return normalizePulledSqlBody(_0x38d214,_0x197d65)===normalizePulledSqlBody(_0x1a36a7,_0x5bfddb);return normalizePullComparableContent(_0x38d214,_0x197d65)===normalizePullComparableContent(_0x1a36a7,_0x5bfddb);}async function findExistingSqlFiles(_0x1f50d8,_0x323753,_0x5b1c77,_0x53f9b0){const _0x1c5dad=a253_0x5936e3,_0x3b6169=[];await fileExists(_0x323753)&&_0x3b6169[_0x1c5dad(0x14d)]({'filePath':_0x323753,'mode':_0x5b1c77,'isCanonical':!![]});if(!_0x53f9b0?.[_0x1c5dad(0x158)])return _0x3b6169;const _0x3a61a1=join(_0x1f50d8[_0x1c5dad(0x135)],_0x53f9b0[_0x1c5dad(0x158)]);if(_0x3a61a1===_0x323753)return _0x3b6169;return await fileExists(_0x3a61a1)&&_0x3b6169['push']({'filePath':_0x3a61a1,'mode':_0x53f9b0[_0x1c5dad(0x147)]??modeFromFilePath(_0x3a61a1),'isCanonical':![]}),_0x3b6169;}async function compareExistingSqlFiles(_0x44421f,_0x545264,_0x3d4761){const _0xbf5013=a253_0x5936e3;return Promise[_0xbf5013(0x143)](_0x44421f['map'](async _0x18d8b3=>{const _0x1820dc=_0xbf5013,_0x289420=await readFile(_0x18d8b3[_0x1820dc(0x16a)],'utf8');return{'file':_0x18d8b3,'content':_0x289420,'equivalent':isEquivalentPulledSqlFile(_0x289420,_0x545264,_0x18d8b3['mode'],_0x3d4761)};}));}function modeFromFilePath(_0x294ace){const _0x1c94b9=a253_0x5936e3;return _0x294ace[_0x1c94b9(0x12c)]()[_0x1c94b9(0x151)]('.xml')?_0x1c94b9(0x13a):_0x1c94b9(0x144);}function a253_0xdce6(_0x2c044d,_0x193cb2){_0x2c044d=_0x2c044d-0x12c;const _0x10a313=a253_0x10a3();let _0xdce6e7=_0x10a313[_0x2c044d];return _0xdce6e7;}function normalizePulledSqlBody(_0x5068ca,_0xaf9f97){return stripLocalSqlMetadata(_0x5068ca,_0xaf9f97)['replace'](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x100c22,_0x3adaa0){const _0x921c4b=a253_0x5936e3,_0x3ae82a=_0x100c22[_0x921c4b(0x142)](/\r\n/g,'\x0a')[_0x921c4b(0x13f)]('\x0a'),_0x28ee02=_0x3ae82a[_0x921c4b(0x134)](_0xcc1e38=>!isSyncedAtMetadataLine(_0xcc1e38,_0x3adaa0));return _0x28ee02[_0x921c4b(0x173)]('\x0a');}function isSyncedAtMetadataLine(_0x3e2201,_0x764eac){const _0x23a6a9=a253_0x5936e3;if(_0x764eac===_0x23a6a9(0x13a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x23a6a9(0x154)](_0x3e2201);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x23a6a9(0x154)](_0x3e2201);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a254_0x6b6949=a254_0x3833;(function(_0x2a25ea,_0x58e99f){const _0x2cff37=a254_0x3833,_0x4d9256=_0x2a25ea();while(!![]){try{const _0x442839=-parseInt(_0x2cff37(0xbe))/0x1*(parseInt(_0x2cff37(0xe8))/0x2)+-parseInt(_0x2cff37(0xd7))/0x3*(parseInt(_0x2cff37(0xd4))/0x4)+-parseInt(_0x2cff37(0xc0))/0x5*(parseInt(_0x2cff37(0xd5))/0x6)+-parseInt(_0x2cff37(0xa4))/0x7*(parseInt(_0x2cff37(0x9f))/0x8)+parseInt(_0x2cff37(0xa1))/0x9*(-parseInt(_0x2cff37(0xc4))/0xa)+-parseInt(_0x2cff37(0xaf))/0xb*(-parseInt(_0x2cff37(0xbc))/0xc)+parseInt(_0x2cff37(0xbf))/0xd;if(_0x442839===_0x58e99f)break;else _0x4d9256['push'](_0x4d9256['shift']());}catch(_0x25165e){_0x4d9256['push'](_0x4d9256['shift']());}}}(a254_0x1d19,0x9fe23));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';function a254_0x3833(_0x3fc259,_0x523a3e){_0x3fc259=_0x3fc259-0x9f;const _0x1d1972=a254_0x1d19();let _0x3833c1=_0x1d1972[_0x3fc259];return _0x3833c1;}function a254_0x1d19(){const _0x2052ca=['message',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','691608pgqAYT','No\x20database\x20matches\x20local\x20directory\x20\x22','4517FfuFTq','53322737gwDXIO','5ibGMok','str','join','exec','368990lUyZtM','lockFilePath','relativePath','sqlConfig','/smartapi/custom/updateUserCustomSql','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','\x20pushed,\x20',':\x20SQL\x20content\x20is\x20empty.','sql','push','has','bool','trim','appCode','sqlName','sqlcode','328cxqJsg','6974514nUcySR','mode','23847LafhSd','sqls','filePath','length','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','trashDir','Local\x20SQL\x20not\x20found:\x20','path','lastSync','sqlRoot','map','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','projectRoot','sqlRootDir','\x20failed','hash','startsWith','236xTFaYp','Push\x20complete:\x20','toISOString','385312jkEIaZ','replace','315hYEzZL','unchanged','filter','14LHxraX','validation','sqlCode','utf8','Would\x20push\x20','\x20skipped,\x20','boolean','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','set','\x20SQL\x20file(s)','isFinite','55ljZyUe','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','remoteId','version','get','catch','dbId','entries','force','Push\x20local\x20SQL\x20files\x20to\x20remote','dbName'];a254_0x1d19=function(){return _0x2052ca;};return a254_0x1d19();}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x2ac574){const _0x1037e3=a254_0x3833,_0x435081=stripLocalSqlMetadata(await readFile(_0x2ac574['filePath'],_0x1037e3(0xa7)),_0x2ac574['mode']);if(!_0x435081[_0x1037e3(0xd0)]())throw CliErrors[_0x1037e3(0xa5)](_0x2ac574[_0x1037e3(0xa6)]+_0x1037e3(0xcb));return _0x435081;}async function getTargetSqlQueries(_0x529740,_0x4b780e,_0x1c226a){const _0x53d147=a254_0x3833,_0x11a59b=await scanLocalSqlQueries(_0x529740),_0x21ab45=new Map();for(const _0x2347a6 of _0x11a59b){if(_0x1c226a&&_0x2347a6[_0x53d147(0xa6)]!==_0x1c226a)continue;const _0x3a64bc=_0x21ab45[_0x53d147(0xb3)](_0x2347a6['sqlCode'])??[];_0x3a64bc['push'](_0x2347a6),_0x21ab45[_0x53d147(0xac)](_0x2347a6[_0x53d147(0xa6)],_0x3a64bc);}if(_0x1c226a&&!_0x21ab45[_0x53d147(0xce)](_0x1c226a))throw CliErrors[_0x53d147(0xa5)](_0x53d147(0xdd)+_0x1c226a);const _0x15a63e=[];for(const [_0x54081b,_0x36bf5b]of _0x21ab45[_0x53d147(0xb6)]()){if(_0x36bf5b[_0x53d147(0xda)]===0x1){_0x15a63e[_0x53d147(0xcd)](_0x36bf5b[0x0]);continue;}const _0xdec719=_0x4b780e['sqls'][_0x54081b],_0x1fe89d=_0xdec719?.['path'],_0x4da831=_0x1fe89d?_0x36bf5b[_0x53d147(0xa3)](_0x15f81f=>_0x15f81f[_0x53d147(0xc6)]!==_0x1fe89d):_0x36bf5b;if(_0xdec719&&_0x4da831[_0x53d147(0xda)]===0x1){_0x15a63e[_0x53d147(0xcd)](_0x4da831[0x0]);continue;}throw CliErrors['validation'](_0x53d147(0xdb)+_0x54081b+_0x53d147(0xb0));}return _0x15a63e;}export const sqlPush={'service':a254_0x6b6949(0xcc),'command':a254_0x6b6949(0xcd),'description':a254_0x6b6949(0xb8),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x6b6949(0xb7),'type':a254_0x6b6949(0xaa),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x3481d5){const _0xcce80c=a254_0x6b6949,_0x15762a=loadSqlProjectConfig(_0x3481d5[_0xcce80c(0xd1)]),_0x53f190=await readSqlLockFile(_0x15762a[_0xcce80c(0xc5)]),{appLock:_0x4478c0}=ensureSqlLockScope(_0x53f190??createEmptySqlLock(),_0x3481d5['appCode'],_0x15762a['sqlRoot'],_0xcce80c(0xcd)),_0x5872a2=await getTargetSqlQueries(_0x15762a,_0x4478c0,_0x3481d5[_0xcce80c(0xc1)]('sqlcode')||undefined),_0x350559=[];for(const _0x281eee of _0x5872a2){const _0x5d87f4=await computeSqlFileHash(_0x281eee[_0xcce80c(0xd9)]),_0x20ca04=_0x4478c0['sqls'][_0x281eee['sqlCode']],_0x4a35b7=!!_0x20ca04&&(_0x20ca04[_0xcce80c(0xde)]!==_0x281eee['relativePath']||!!_0x281eee[_0xcce80c(0xd2)]&&_0x20ca04[_0xcce80c(0xd2)]!==_0x281eee[_0xcce80c(0xd2)]||_0x20ca04['mode']!==_0x281eee['mode']);if(!_0x3481d5[_0xcce80c(0xcf)](_0xcce80c(0xb7))&&_0x20ca04&&_0x20ca04['hash']===_0x5d87f4&&!_0x4a35b7)continue;if(!_0x20ca04)throw CliErrors[_0xcce80c(0xa5)](_0x281eee[_0xcce80c(0xa6)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x20ca04[_0xcce80c(0xb2)]==null)throw CliErrors[_0xcce80c(0xa5)](_0x281eee['sqlCode']+_0xcce80c(0xbb));await resolveTargetDbBinding(_0x3481d5[_0xcce80c(0xd1)],_0x281eee,_0x20ca04),await readSqlUploadContent(_0x281eee),_0x350559[_0xcce80c(0xcd)](_0x281eee[_0xcce80c(0xa6)]);}return{'method':'POST','url':_0xcce80c(0xc8),'body':{'sqlCodes':_0x350559,'appCode':_0x3481d5['appCode']},'description':_0xcce80c(0xa8)+_0x350559[_0xcce80c(0xda)]+_0xcce80c(0xad)};},async 'execute'(_0x5bdcbe){const _0x3c66b2=a254_0x6b6949,_0x5e8bd3=loadSqlProjectConfig(_0x5bdcbe[_0x3c66b2(0xd1)]),_0x5b480b=await readSqlLockFile(_0x5e8bd3[_0x3c66b2(0xc5)]),{lockData:_0x443cf1,appLock:_0x4def70}=ensureSqlLockScope(_0x5b480b??createEmptySqlLock(),_0x5bdcbe[_0x3c66b2(0xd1)],_0x5e8bd3[_0x3c66b2(0xe0)],_0x3c66b2(0xcd)),_0x4ca8fc=await getTargetSqlQueries(_0x5e8bd3,_0x4def70,_0x5bdcbe[_0x3c66b2(0xc1)](_0x3c66b2(0xd3))||undefined);if(_0x4ca8fc['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x55e815=[],_0x49273d=[],_0xdf6cd7=[];let _0x10622e=![];for(const _0xed5d01 of _0x4ca8fc){const _0x420a71=_0x4def70[_0x3c66b2(0xd8)][_0xed5d01['sqlCode']];if(!_0x420a71){_0xdf6cd7[_0x3c66b2(0xcd)]({'sqlCode':_0xed5d01['sqlCode'],'error':_0x3c66b2(0xe2)});continue;}try{const _0xe66baa=await computeSqlFileHash(_0xed5d01[_0x3c66b2(0xd9)]),_0x2f57c8=_0x420a71[_0x3c66b2(0xde)]!==_0xed5d01[_0x3c66b2(0xc6)]||!!_0xed5d01[_0x3c66b2(0xd2)]&&_0x420a71['sqlName']!==_0xed5d01[_0x3c66b2(0xd2)]||_0x420a71[_0x3c66b2(0xd6)]!==_0xed5d01[_0x3c66b2(0xd6)];if(!_0x5bdcbe[_0x3c66b2(0xcf)](_0x3c66b2(0xb7))&&_0x420a71[_0x3c66b2(0xe6)]===_0xe66baa&&!_0x2f57c8){_0x49273d['push']({'sqlCode':_0xed5d01['sqlCode'],'reason':_0x3c66b2(0xa2)});continue;}if(_0x420a71[_0x3c66b2(0xb2)]==null){_0xdf6cd7['push']({'sqlCode':_0xed5d01['sqlCode'],'error':_0x3c66b2(0xab)});continue;}const _0x390f07=_0xed5d01[_0x3c66b2(0xd2)]||_0x420a71[_0x3c66b2(0xd2)],_0x38cf1b=await resolveTargetDbBinding(_0x5bdcbe[_0x3c66b2(0xd1)],_0xed5d01,_0x420a71),_0x2e2f4a=await readSqlUploadContent(_0xed5d01),_0x1e4ef5=await updateSqlQuery({'id':_0x420a71[_0x3c66b2(0xb1)],'appCode':_0x5bdcbe[_0x3c66b2(0xd1)],'sqlCode':_0xed5d01[_0x3c66b2(0xa6)],'sqlName':_0x390f07,'dbId':_0x38cf1b[_0x3c66b2(0xb5)],'version':_0x420a71[_0x3c66b2(0xb2)],'sqlContent':_0x2e2f4a,'sqlConfig':_0x420a71[_0x3c66b2(0xc7)]??undefined}),_0x2e5845=_0x1e4ef5['dbId']?await getDbName(_0x5bdcbe[_0x3c66b2(0xd1)],Number(_0x1e4ef5[_0x3c66b2(0xb5)]))[_0x3c66b2(0xb4)](()=>_0x38cf1b['dbName']):_0x38cf1b['dbName'];_0x4def70['sqls'][_0xed5d01[_0x3c66b2(0xa6)]]={...buildSqlLockEntry(_0x1e4ef5,_0x2e2f4a,_0xe66baa,{'dbName':_0x2e5845}),'path':_0xed5d01[_0x3c66b2(0xc6)],'mode':_0xed5d01['mode']},_0x10622e=!![],await archivePreviousSqlFileIfNeeded(_0x5e8bd3,_0x420a71[_0x3c66b2(0xde)],_0xed5d01[_0x3c66b2(0xc6)]),_0x55e815['push']({'sqlCode':_0xed5d01[_0x3c66b2(0xa6)],'remoteId':_0x420a71[_0x3c66b2(0xb1)]});}catch(_0x13943b){_0xdf6cd7[_0x3c66b2(0xcd)]({'sqlCode':_0xed5d01[_0x3c66b2(0xa6)],'error':_0x13943b instanceof Error?_0x13943b[_0x3c66b2(0xba)]:String(_0x13943b)});}}(_0x10622e||_0xdf6cd7[_0x3c66b2(0xda)]===0x0)&&(_0x4def70[_0x3c66b2(0xdf)]=new Date()['toISOString'](),await writeSqlLockFile(_0x5e8bd3[_0x3c66b2(0xc5)],_0x443cf1));const _0x474af4=_0xdf6cd7[_0x3c66b2(0xda)]===0x0;return{'ok':_0x474af4,'data':{'pushed':_0x55e815,'skipped':_0x49273d,'failed':_0xdf6cd7},'message':_0x3c66b2(0xe9)+_0x55e815[_0x3c66b2(0xda)]+_0x3c66b2(0xca)+_0x49273d[_0x3c66b2(0xda)]+_0x3c66b2(0xa9)+_0xdf6cd7[_0x3c66b2(0xda)]+_0x3c66b2(0xe5)};}};async function archivePreviousSqlFileIfNeeded(_0x34b796,_0x185fb3,_0x5c43ff){const _0x1a4150=a254_0x6b6949;if(!_0x185fb3||_0x185fb3===_0x5c43ff)return;const _0x101a73=join(_0x34b796[_0x1a4150(0xe4)],_0x185fb3);if(!await fileExists(_0x101a73))return;const _0x86a3af=await moveToTrash(_0x34b796[_0x1a4150(0xe3)],_0x34b796[_0x1a4150(0xdc)],_0x101a73);await cleanupEmptyDirectories(dirname(_0x101a73),_0x34b796['sqlRootDir']),void _0x86a3af;}async function moveToTrash(_0x72726c,_0x3a96ea,_0x5d0ba2){const _0x1ff16b=a254_0x6b6949,_0x43a80c=new Date()[_0x1ff16b(0xea)]()[_0x1ff16b(0xa0)](/[:.]/g,'-'),_0x2d80b2=relative(_0x72726c,_0x5d0ba2),_0x3165b6=join(_0x3a96ea,_0x43a80c,_0x2d80b2);return await mkdir(dirname(_0x3165b6),{'recursive':!![]}),await rename(_0x5d0ba2,_0x3165b6),_0x3165b6;}async function cleanupEmptyDirectories(_0x1fcba7,_0xb86e07){const _0x236c9=a254_0x6b6949;let _0xb4c5c3=resolve(_0x1fcba7);const _0x531abd=resolve(_0xb86e07);while(_0xb4c5c3[_0x236c9(0xe7)](''+_0x531abd+sep)||_0xb4c5c3===_0x531abd){if(_0xb4c5c3===_0x531abd)return;try{const _0x393a98=await readdir(_0xb4c5c3);if(_0x393a98['length']>0x0)return;await rmdir(_0xb4c5c3);}catch{return;}_0xb4c5c3=dirname(_0xb4c5c3);}}async function resolveTargetDbBinding(_0xbe9b05,_0x14598c,_0x21ab81){const _0x7a1b94=a254_0x6b6949,_0x4fef29=_0x14598c['dbDirectory'];if(!_0x4fef29)return{'dbId':_0x21ab81[_0x7a1b94(0xb5)],'dbName':_0x21ab81[_0x7a1b94(0xb9)]};const _0x44a1b5=buildDbDirectoryName(_0x21ab81[_0x7a1b94(0xb9)],_0x21ab81['dbId']);if(_0x4fef29===_0x44a1b5)return{'dbId':_0x21ab81[_0x7a1b94(0xb5)],'dbName':_0x21ab81[_0x7a1b94(0xb9)]};const _0xa39975=parseExplicitDbDirectory(_0x4fef29);if(_0xa39975!=null)return{'dbId':_0xa39975,'dbName':await getDbName(_0xbe9b05,_0xa39975)['catch'](()=>undefined)};const _0x1f2a3c=await listDatabases(_0xbe9b05),_0x9b727f=_0x1f2a3c[_0x7a1b94(0xa3)](_0x1ff126=>buildDbDirectoryName(_0x1ff126['dbName'],_0x1ff126['dbId'])===_0x4fef29);if(_0x9b727f[_0x7a1b94(0xda)]===0x1)return{'dbId':_0x9b727f[0x0]['dbId'],'dbName':_0x9b727f[0x0]['dbName']};if(_0x9b727f[_0x7a1b94(0xda)]===0x0)throw CliErrors[_0x7a1b94(0xa5)](_0x7a1b94(0xbd)+_0x4fef29+'\x22\x20for\x20sqlCode\x20'+_0x14598c[_0x7a1b94(0xa6)]+'.');const _0x559175=_0x9b727f[_0x7a1b94(0xe1)](_0x8ed6ce=>_0x8ed6ce[_0x7a1b94(0xb9)]+'\x20('+_0x8ed6ce[_0x7a1b94(0xb5)]+')')[_0x7a1b94(0xc2)](',\x20');throw CliErrors[_0x7a1b94(0xa5)]('Local\x20directory\x20\x22'+_0x4fef29+_0x7a1b94(0xc9)+_0x14598c['sqlCode']+':\x20'+_0x559175);}function parseExplicitDbDirectory(_0x2ad132){const _0x1bb944=a254_0x6b6949,_0x21933c=/^db-(\d+)$/[_0x1bb944(0xc3)](_0x2ad132);if(!_0x21933c)return null;const _0x4b6f2=Number(_0x21933c[0x1]);return Number[_0x1bb944(0xae)](_0x4b6f2)&&_0x4b6f2>0x0?_0x4b6f2:null;}
|
|
1
|
+
const a254_0x2aaff4=a254_0x4c09;(function(_0x2ed773,_0x15c70d){const _0x2ce412=a254_0x4c09,_0x13246e=_0x2ed773();while(!![]){try{const _0x53860e=-parseInt(_0x2ce412(0x131))/0x1+-parseInt(_0x2ce412(0x115))/0x2*(-parseInt(_0x2ce412(0x11d))/0x3)+parseInt(_0x2ce412(0x138))/0x4+-parseInt(_0x2ce412(0x13b))/0x5+parseInt(_0x2ce412(0x11b))/0x6*(parseInt(_0x2ce412(0x129))/0x7)+parseInt(_0x2ce412(0x134))/0x8+-parseInt(_0x2ce412(0x12a))/0x9;if(_0x53860e===_0x15c70d)break;else _0x13246e['push'](_0x13246e['shift']());}catch(_0x11d5a0){_0x13246e['push'](_0x13246e['shift']());}}}(a254_0x5f38,0xbc117));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';function a254_0x4c09(_0x376b20,_0x46be36){_0x376b20=_0x376b20-0xfe;const _0x5f3862=a254_0x5f38();let _0x4c09d1=_0x5f3862[_0x376b20];return _0x4c09d1;}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(_0x2d1cf2){const _0x2d822f=a254_0x4c09,_0x1f49a3=stripLocalSqlMetadata(await readFile(_0x2d1cf2[_0x2d822f(0x114)],_0x2d822f(0x123)),_0x2d1cf2[_0x2d822f(0x137)]);if(!_0x1f49a3[_0x2d822f(0x105)]())throw CliErrors[_0x2d822f(0x100)](_0x2d1cf2[_0x2d822f(0x122)]+_0x2d822f(0xfe));return _0x1f49a3;}async function getTargetSqlQueries(_0x4f8ab7,_0xe9f339,_0x41299b){const _0x5ce7a1=a254_0x4c09,_0x6358ce=await scanLocalSqlQueries(_0x4f8ab7),_0x1688ab=new Map();for(const _0x3a56ca of _0x6358ce){if(_0x41299b&&_0x3a56ca[_0x5ce7a1(0x122)]!==_0x41299b)continue;const _0x11e5e2=_0x1688ab[_0x5ce7a1(0x109)](_0x3a56ca[_0x5ce7a1(0x122)])??[];_0x11e5e2[_0x5ce7a1(0x141)](_0x3a56ca),_0x1688ab[_0x5ce7a1(0x101)](_0x3a56ca[_0x5ce7a1(0x122)],_0x11e5e2);}if(_0x41299b&&!_0x1688ab[_0x5ce7a1(0x133)](_0x41299b))throw CliErrors[_0x5ce7a1(0x100)](_0x5ce7a1(0x128)+_0x41299b);const _0x5ac95b=[];for(const [_0xa84a11,_0x1287aa]of _0x1688ab['entries']()){if(_0x1287aa[_0x5ce7a1(0x13a)]===0x1){_0x5ac95b[_0x5ce7a1(0x141)](_0x1287aa[0x0]);continue;}const _0x5a6b9d=_0xe9f339[_0x5ce7a1(0x11f)][_0xa84a11],_0x4eb079=_0x5a6b9d?.['path'],_0x30e60e=_0x4eb079?_0x1287aa[_0x5ce7a1(0x10c)](_0x53cb4a=>_0x53cb4a[_0x5ce7a1(0x118)]!==_0x4eb079):_0x1287aa;if(_0x5a6b9d&&_0x30e60e[_0x5ce7a1(0x13a)]===0x1){_0x5ac95b[_0x5ce7a1(0x141)](_0x30e60e[0x0]);continue;}throw CliErrors[_0x5ce7a1(0x100)](_0x5ce7a1(0x112)+_0xa84a11+_0x5ce7a1(0x13c));}return _0x5ac95b;}export const sqlPush={'service':a254_0x2aaff4(0x13e),'command':'push','description':a254_0x2aaff4(0x12c),'risk':a254_0x2aaff4(0x12e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x2aaff4(0x13d),'type':a254_0x2aaff4(0x104),'description':a254_0x2aaff4(0x11e)}],async 'dryRun'(_0x31cf58){const _0x42c391=a254_0x2aaff4,_0x45b5b1=loadSqlProjectConfig(_0x31cf58[_0x42c391(0x119)]),_0x1d58a0=await readSqlLockFile(_0x45b5b1[_0x42c391(0x132)]),{appLock:_0x2bacfc}=ensureSqlLockScope(_0x1d58a0??createEmptySqlLock(),_0x31cf58['appCode'],_0x45b5b1[_0x42c391(0x111)],_0x42c391(0x141)),_0x444228=await getTargetSqlQueries(_0x45b5b1,_0x2bacfc,_0x31cf58['str']('sqlcode')||undefined),_0x269989=[];for(const _0x148452 of _0x444228){const _0x3e510b=await computeSqlFileHash(_0x148452['filePath']),_0x39051b=_0x2bacfc['sqls'][_0x148452[_0x42c391(0x122)]],_0x1844f1=!!_0x39051b&&(_0x39051b[_0x42c391(0x10d)]!==_0x148452[_0x42c391(0x118)]||!!_0x148452[_0x42c391(0x135)]&&_0x39051b['sqlName']!==_0x148452['sqlName']||_0x39051b[_0x42c391(0x137)]!==_0x148452[_0x42c391(0x137)]);if(!_0x31cf58['bool'](_0x42c391(0x13d))&&_0x39051b&&_0x39051b['hash']===_0x3e510b&&!_0x1844f1)continue;if(!_0x39051b)throw CliErrors['validation'](_0x148452[_0x42c391(0x122)]+_0x42c391(0x10b));if(_0x39051b[_0x42c391(0x117)]==null)throw CliErrors[_0x42c391(0x100)](_0x148452['sqlCode']+':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.');await resolveTargetDbBinding(_0x31cf58[_0x42c391(0x119)],_0x148452,_0x39051b),await readSqlUploadContent(_0x148452),_0x269989[_0x42c391(0x141)](_0x148452[_0x42c391(0x122)]);}return{'method':_0x42c391(0x108),'url':_0x42c391(0x12d),'body':{'sqlCodes':_0x269989,'appCode':_0x31cf58[_0x42c391(0x119)]},'description':_0x42c391(0x10e)+_0x269989[_0x42c391(0x13a)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x1fdecd){const _0x4d3786=a254_0x2aaff4,_0x3182b3=loadSqlProjectConfig(_0x1fdecd[_0x4d3786(0x119)]),_0x2d4a7f=await readSqlLockFile(_0x3182b3[_0x4d3786(0x132)]),{lockData:_0x7f6559,appLock:_0x3a1423}=ensureSqlLockScope(_0x2d4a7f??createEmptySqlLock(),_0x1fdecd[_0x4d3786(0x119)],_0x3182b3[_0x4d3786(0x111)],_0x4d3786(0x141)),_0x25c3e0=await getTargetSqlQueries(_0x3182b3,_0x3a1423,_0x1fdecd['str'](_0x4d3786(0x13f))||undefined);if(_0x25c3e0[_0x4d3786(0x13a)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4d3786(0x140)};const _0x3bf5f6=[],_0x558328=[],_0xbbe8cc=[];let _0x327c72=![];for(const _0x1e8b7c of _0x25c3e0){const _0x23c5e3=_0x3a1423['sqls'][_0x1e8b7c[_0x4d3786(0x122)]];if(!_0x23c5e3){_0xbbe8cc[_0x4d3786(0x141)]({'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'error':_0x4d3786(0xff)});continue;}try{const _0x1d9878=await computeSqlFileHash(_0x1e8b7c[_0x4d3786(0x114)]),_0x1def2f=_0x23c5e3['path']!==_0x1e8b7c['relativePath']||!!_0x1e8b7c[_0x4d3786(0x135)]&&_0x23c5e3[_0x4d3786(0x135)]!==_0x1e8b7c[_0x4d3786(0x135)]||_0x23c5e3[_0x4d3786(0x137)]!==_0x1e8b7c[_0x4d3786(0x137)];if(!_0x1fdecd['bool'](_0x4d3786(0x13d))&&_0x23c5e3[_0x4d3786(0x10a)]===_0x1d9878&&!_0x1def2f){_0x558328[_0x4d3786(0x141)]({'sqlCode':_0x1e8b7c['sqlCode'],'reason':_0x4d3786(0x124)});continue;}if(_0x23c5e3['version']==null){_0xbbe8cc['push']({'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'error':_0x4d3786(0x12f)});continue;}const _0x4ca02a=_0x1e8b7c[_0x4d3786(0x135)]||_0x23c5e3[_0x4d3786(0x135)],_0x4e396b=await resolveTargetDbBinding(_0x1fdecd[_0x4d3786(0x119)],_0x1e8b7c,_0x23c5e3),_0x2d76e6=await readSqlUploadContent(_0x1e8b7c),_0x2b358b=await updateSqlQuery({'id':_0x23c5e3[_0x4d3786(0x103)],'appCode':_0x1fdecd['appCode'],'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'sqlName':_0x4ca02a,'dbId':_0x4e396b[_0x4d3786(0x121)],'version':_0x23c5e3[_0x4d3786(0x117)],'sqlContent':_0x2d76e6,'sqlConfig':_0x23c5e3[_0x4d3786(0x116)]??undefined}),_0x5af435=_0x2b358b[_0x4d3786(0x121)]?await getDbName(_0x1fdecd[_0x4d3786(0x119)],Number(_0x2b358b['dbId']))[_0x4d3786(0x126)](()=>_0x4e396b[_0x4d3786(0x107)]):_0x4e396b['dbName'];_0x3a1423[_0x4d3786(0x11f)][_0x1e8b7c[_0x4d3786(0x122)]]={...buildSqlLockEntry(_0x2b358b,_0x2d76e6,_0x1d9878,{'dbName':_0x5af435}),'path':_0x1e8b7c[_0x4d3786(0x118)],'mode':_0x1e8b7c[_0x4d3786(0x137)]},_0x327c72=!![],await archivePreviousSqlFileIfNeeded(_0x3182b3,_0x23c5e3[_0x4d3786(0x10d)],_0x1e8b7c[_0x4d3786(0x118)]),_0x3bf5f6[_0x4d3786(0x141)]({'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'remoteId':_0x23c5e3[_0x4d3786(0x103)]});}catch(_0x21d97a){_0xbbe8cc[_0x4d3786(0x141)]({'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'error':_0x21d97a instanceof Error?_0x21d97a[_0x4d3786(0x110)]:String(_0x21d97a)});}}(_0x327c72||_0xbbe8cc[_0x4d3786(0x13a)]===0x0)&&(_0x3a1423[_0x4d3786(0x11a)]=new Date()[_0x4d3786(0x127)](),await writeSqlLockFile(_0x3182b3[_0x4d3786(0x132)],_0x7f6559));const _0x1c778a=_0xbbe8cc[_0x4d3786(0x13a)]===0x0;return{'ok':_0x1c778a,'data':{'pushed':_0x3bf5f6,'skipped':_0x558328,'failed':_0xbbe8cc},'message':'Push\x20complete:\x20'+_0x3bf5f6[_0x4d3786(0x13a)]+_0x4d3786(0x10f)+_0x558328['length']+'\x20skipped,\x20'+_0xbbe8cc[_0x4d3786(0x13a)]+_0x4d3786(0x102)};}};async function archivePreviousSqlFileIfNeeded(_0x25c030,_0x47d1d9,_0x3c2c7f){const _0x31b08a=a254_0x2aaff4;if(!_0x47d1d9||_0x47d1d9===_0x3c2c7f)return;const _0x4a40b9=join(_0x25c030[_0x31b08a(0x125)],_0x47d1d9);if(!await fileExists(_0x4a40b9))return;const _0x1d1068=await moveToTrash(_0x25c030[_0x31b08a(0x136)],_0x25c030[_0x31b08a(0x130)],_0x4a40b9);await cleanupEmptyDirectories(dirname(_0x4a40b9),_0x25c030['sqlRootDir']),void _0x1d1068;}function a254_0x5f38(){const _0x25dbec=['dbName','POST','get','hash',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','filter','path','Would\x20push\x20','\x20pushed,\x20','message','sqlRoot','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','dbDirectory','filePath','212GCoQMj','sqlConfig','version','relativePath','appCode','lastSync','6DCUSlV','replace','16404MMxgXg','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqls','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','dbId','sqlCode','utf8','unchanged','sqlRootDir','catch','toISOString','Local\x20SQL\x20not\x20found:\x20','2182915Tzhjfm','8543673RDXDYe','exec','Push\x20local\x20SQL\x20files\x20to\x20remote','/smartapi/custom/updateUserCustomSql','write','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','trashDir','1454251bRRevJ','lockFilePath','has','9280064btYWoi','sqlName','projectRoot','mode','5992988wMnQaf','startsWith','length','1879165eRcNJh','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','force','sql','sqlcode','No\x20local\x20SQL\x20files\x20found.','push',':\x20SQL\x20content\x20is\x20empty.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','validation','set','\x20failed','remoteId','boolean','trim','No\x20database\x20matches\x20local\x20directory\x20\x22'];a254_0x5f38=function(){return _0x25dbec;};return a254_0x5f38();}async function moveToTrash(_0x5d78e8,_0xbd9a1e,_0x41b1c0){const _0x4d7573=a254_0x2aaff4,_0x280b0c=new Date()[_0x4d7573(0x127)]()[_0x4d7573(0x11c)](/[:.]/g,'-'),_0x59ce66=relative(_0x5d78e8,_0x41b1c0),_0x340ca2=join(_0xbd9a1e,_0x280b0c,_0x59ce66);return await mkdir(dirname(_0x340ca2),{'recursive':!![]}),await rename(_0x41b1c0,_0x340ca2),_0x340ca2;}async function cleanupEmptyDirectories(_0x289636,_0x35eda0){const _0x57e6cb=a254_0x2aaff4;let _0x4232be=resolve(_0x289636);const _0x357044=resolve(_0x35eda0);while(_0x4232be[_0x57e6cb(0x139)](''+_0x357044+sep)||_0x4232be===_0x357044){if(_0x4232be===_0x357044)return;try{const _0xb767a2=await readdir(_0x4232be);if(_0xb767a2[_0x57e6cb(0x13a)]>0x0)return;await rmdir(_0x4232be);}catch{return;}_0x4232be=dirname(_0x4232be);}}async function resolveTargetDbBinding(_0x3edfb6,_0xa559f7,_0x318d68){const _0x3c5158=a254_0x2aaff4,_0x1ed13e=_0xa559f7[_0x3c5158(0x113)];if(!_0x1ed13e)return{'dbId':_0x318d68[_0x3c5158(0x121)],'dbName':_0x318d68[_0x3c5158(0x107)]};const _0x111153=buildDbDirectoryName(_0x318d68[_0x3c5158(0x107)],_0x318d68[_0x3c5158(0x121)]);if(_0x1ed13e===_0x111153)return{'dbId':_0x318d68['dbId'],'dbName':_0x318d68['dbName']};const _0x342607=parseExplicitDbDirectory(_0x1ed13e);if(_0x342607!=null)return{'dbId':_0x342607,'dbName':await getDbName(_0x3edfb6,_0x342607)[_0x3c5158(0x126)](()=>undefined)};const _0x1cad1c=await listDatabases(_0x3edfb6),_0x221101=_0x1cad1c[_0x3c5158(0x10c)](_0x5d3fe2=>buildDbDirectoryName(_0x5d3fe2[_0x3c5158(0x107)],_0x5d3fe2[_0x3c5158(0x121)])===_0x1ed13e);if(_0x221101[_0x3c5158(0x13a)]===0x1)return{'dbId':_0x221101[0x0]['dbId'],'dbName':_0x221101[0x0]['dbName']};if(_0x221101['length']===0x0)throw CliErrors['validation'](_0x3c5158(0x106)+_0x1ed13e+'\x22\x20for\x20sqlCode\x20'+_0xa559f7['sqlCode']+'.');const _0x5d7413=_0x221101['map'](_0x34263a=>_0x34263a[_0x3c5158(0x107)]+'\x20('+_0x34263a[_0x3c5158(0x121)]+')')['join'](',\x20');throw CliErrors[_0x3c5158(0x100)]('Local\x20directory\x20\x22'+_0x1ed13e+_0x3c5158(0x120)+_0xa559f7[_0x3c5158(0x122)]+':\x20'+_0x5d7413);}function parseExplicitDbDirectory(_0x1b48fc){const _0x49994e=a254_0x2aaff4,_0x11a1dc=/^db-(\d+)$/[_0x49994e(0x12b)](_0x1b48fc);if(!_0x11a1dc)return null;const _0x21954d=Number(_0x11a1dc[0x1]);return Number['isFinite'](_0x21954d)&&_0x21954d>0x0?_0x21954d:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a255_0x3ca1b5=a255_0x30bf;(function(_0x267338,_0x25e02b){const _0x27c763=a255_0x30bf,_0x2832b6=_0x267338();while(!![]){try{const _0x51f3f3=-parseInt(_0x27c763(0x141))/0x1*(-parseInt(_0x27c763(0x145))/0x2)+parseInt(_0x27c763(0x15a))/0x3+-parseInt(_0x27c763(0x149))/0x4*(-parseInt(_0x27c763(0x13b))/0x5)+parseInt(_0x27c763(0x148))/0x6*(-parseInt(_0x27c763(0x13c))/0x7)+parseInt(_0x27c763(0x161))/0x8*(-parseInt(_0x27c763(0x13e))/0x9)+-parseInt(_0x27c763(0x15d))/0xa*(parseInt(_0x27c763(0x14b))/0xb)+parseInt(_0x27c763(0x13d))/0xc*(-parseInt(_0x27c763(0x13a))/0xd);if(_0x51f3f3===_0x25e02b)break;else _0x2832b6['push'](_0x2832b6['shift']());}catch(_0x280054){_0x2832b6['push'](_0x2832b6['shift']());}}}(a255_0x3c90,0xec525));import{createInterface}from'node:readline';function a255_0x30bf(_0x3b23c9,_0x19f5f9){_0x3b23c9=_0x3b23c9-0x137;const _0x3c901b=a255_0x3c90();let _0x30bf1c=_0x3c901b[_0x3b23c9];return _0x30bf1c;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a255_0x3ca1b5(0x143);export function buildSqlLockEntry(_0x302324,_0x8b495f,_0x2d3f6f,_0x2add75){const _0x4f4ab1=a255_0x3ca1b5,_0x4cdcd6=detectSqlMode(_0x8b495f);return{'path':buildSqlRelativePath(_0x302324[_0x4f4ab1(0x157)],_0x302324['sqlName'],_0x2add75?.['dbName'],_0x4cdcd6,_0x302324[_0x4f4ab1(0x137)]),'hash':_0x2d3f6f,'remoteId':_0x302324['id'],'version':_0x302324[_0x4f4ab1(0x147)],'dbId':Number(_0x302324[_0x4f4ab1(0x137)]),'dbName':_0x2add75?.['dbName'],'sqlName':_0x302324[_0x4f4ab1(0x146)],'sqlConfig':_0x302324[_0x4f4ab1(0x15e)]??undefined,'mode':_0x4cdcd6};}export function cloneSqlLockData(_0x846540){const _0x263ba6=a255_0x3ca1b5;return{'apps':Object[_0x263ba6(0x14f)](Object['entries'](_0x846540[_0x263ba6(0x14c)])[_0x263ba6(0x15b)](([_0x1fa608,_0x5d2850])=>[_0x1fa608,{'sqlRoot':_0x5d2850[_0x263ba6(0x14e)],'lastSync':_0x5d2850[_0x263ba6(0x164)],'sqls':{..._0x5d2850[_0x263ba6(0x155)]}}]))};}export function ensureRemoteSqlContent(_0x567583){return _0x567583['sqlContent']??'';}export function buildLocalSqlFileContent(_0x3c241f,_0x1d4101,_0x13428d){const _0x35da02=a255_0x3ca1b5,_0x2d080a=_0x13428d?.['mode']??detectSqlMode(_0x1d4101),_0x27ade0=stripLocalSqlMetadata(_0x1d4101,_0x2d080a)[_0x35da02(0x15f)](),_0x26ab3b=buildMetadataHeaderLines({'sqlCode':_0x3c241f[_0x35da02(0x157)],'sqlName':_0x3c241f[_0x35da02(0x146)],'dbId':_0x3c241f['dbId'],'dbName':_0x13428d?.[_0x35da02(0x144)],'mode':_0x2d080a,'syncedAt':_0x13428d?.['syncedAt'],'description':_0x13428d?.[_0x35da02(0x167)]},_0x2d080a),_0x8f8e2a=_0x2d080a===_0x35da02(0x139)?splitXmlDeclaration(_0x27ade0):{'body':_0x27ade0},_0x3cb259=[..._0x8f8e2a[_0x35da02(0x13f)]?[_0x8f8e2a[_0x35da02(0x13f)]]:[],..._0x26ab3b,'',_0x8f8e2a[_0x35da02(0x156)][_0x35da02(0x152)]()],_0x4457f0=_0x3cb259[_0x35da02(0x159)]('\x0a');return _0x4457f0['endsWith']('\x0a')?_0x4457f0:_0x4457f0+'\x0a';}export function stripLocalSqlMetadata(_0xfef293,_0x5316f2){const _0x2717d6=a255_0x3ca1b5;if(_0x5316f2===_0x2717d6(0x139)){const {declaration:_0x1c0ea5,body:_0x1929d6}=splitXmlDeclaration(_0xfef293[_0x2717d6(0x162)](/\r\n/g,'\x0a')),_0x4a4ac0=stripLeadingMetadataLines(_0x1929d6,/^\s*<!--\s*@lovrabet\./);return _0x1c0ea5?''+_0x1c0ea5+(_0x4a4ac0?'\x0a'+_0x4a4ac0:''):_0x4a4ac0;}return stripLeadingMetadataLines(_0xfef293['replace'](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x149c7c,_0xfb0500){const _0x3ee8ce=a255_0x3ca1b5;if(_0xfb0500?.[_0x3ee8ce(0x138)])return _0xfb0500[_0x3ee8ce(0x138)];return detectSqlMode(_0x149c7c);}export function resolveSqlFileName(_0x1f1b1e,_0xcfe5e4,_0x430470){const _0x42864c=a255_0x3ca1b5;if(_0x430470?.[_0x42864c(0x14d)])return _0x430470[_0x42864c(0x14d)];if(_0x430470?.[_0x42864c(0x146)]||_0x430470?.[_0x42864c(0x144)])return buildSqlRelativePath(_0x1f1b1e,_0x430470?.[_0x42864c(0x146)],_0x430470?.['dbName'],resolveSqlMode(_0xcfe5e4,_0x430470),_0x430470?.[_0x42864c(0x137)]);return buildDefaultSqlFileName(_0x1f1b1e,resolveSqlMode(_0xcfe5e4,_0x430470));}export function resolveSqlLocalDir(_0x211d43,_0x47f196){return join(_0x211d43,SQL_LOCAL_REL_DIR,_0x47f196);}function a255_0x3c90(){const _0x583f8f=['dbName','13006SoWQJJ','sqlName','version','6VmiiVv','5012YWePhs','slice','5709baDUBT','apps','path','sqlRoot','fromEntries','\x20-->','<!--\x20@lovrabet.','trimStart','length','test','sqls','body','sqlCode','stderr','join','5725452cJItVh','map','--\x20@lovrabet.','4820SXwXRS','sqlConfig','trim','question','119864depnTT','replace','includes','lastSync','syncedAt','\x20[y/N]\x20','description','dbId','mode','mybatisXml','7111HmpPfu','2685XWRJFW','3348002pFblDP','17052NBGBDf','342zVomtg','declaration','filter','71zJtKfp','stdin','.rabetbase/sql'];a255_0x3c90=function(){return _0x583f8f;};return a255_0x3c90();}export async function confirmForceOverwrite(_0x506c76){const _0x10fb85=a255_0x3ca1b5,_0x1aa817=createInterface({'input':process[_0x10fb85(0x142)],'output':process[_0x10fb85(0x158)]}),_0x519042=await new Promise(_0x24677f=>{const _0x3a6c43=_0x10fb85;_0x1aa817[_0x3a6c43(0x160)](_0x506c76+_0x3a6c43(0x166),_0x24677f);});return _0x1aa817['close'](),['y','yes'][_0x10fb85(0x163)](_0x519042[_0x10fb85(0x15f)]()['toLowerCase']());}export function findSqlLockScope(_0x5da5f7,_0x452af6){const _0x1370b1=a255_0x3ca1b5;return _0x5da5f7[_0x1370b1(0x14c)][_0x452af6];}function buildMetadataHeaderLines(_0x2f4bbb,_0x2eeca9){const _0xee19df=a255_0x3ca1b5,_0x60186=[[_0xee19df(0x157),_0x2f4bbb[_0xee19df(0x157)]],[_0xee19df(0x146),_0x2f4bbb['sqlName']],[_0xee19df(0x137),_0x2f4bbb[_0xee19df(0x137)]],[_0xee19df(0x144),_0x2f4bbb[_0xee19df(0x144)]],[_0xee19df(0x138),_0x2f4bbb[_0xee19df(0x138)]],['syncedAt',_0x2f4bbb[_0xee19df(0x165)]],[_0xee19df(0x167),_0x2f4bbb[_0xee19df(0x167)]]];if(_0x2eeca9===_0xee19df(0x139))return _0x60186[_0xee19df(0x140)](([,_0x5969f4])=>_0x5969f4!==undefined&&_0x5969f4!==null&&String(_0x5969f4)[_0xee19df(0x15f)]()!=='')[_0xee19df(0x15b)](([_0x13a790,_0x1a3e79])=>_0xee19df(0x151)+_0x13a790+':\x20'+String(_0x1a3e79)+_0xee19df(0x150));return _0x60186['filter'](([,_0x210ba4])=>_0x210ba4!==undefined&&_0x210ba4!==null&&String(_0x210ba4)['trim']()!=='')[_0xee19df(0x15b)](([_0x411c3c,_0x5a5983])=>_0xee19df(0x15c)+_0x411c3c+':\x20'+String(_0x5a5983));}function splitXmlDeclaration(_0x38cfa9){const _0x1cd1cd=a255_0x3ca1b5,_0xa27907=_0x38cfa9['trimStart'](),_0x2f49b4=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i['exec'](_0xa27907);if(!_0x2f49b4)return{'body':_0x38cfa9};return{'declaration':_0x2f49b4[0x0],'body':_0xa27907[_0x1cd1cd(0x14a)](_0x2f49b4[0x0][_0x1cd1cd(0x153)])};}function stripLeadingMetadataLines(_0x35d12e,_0xbc5ac5){const _0x82e46e=a255_0x3ca1b5,_0x3b099b=_0x35d12e['split']('\x0a');let _0x489e4b=0x0;while(_0x489e4b<_0x3b099b[_0x82e46e(0x153)]){const _0x3a62ff=_0x3b099b[_0x489e4b]??'';if(_0xbc5ac5[_0x82e46e(0x154)](_0x3a62ff)||_0x3a62ff[_0x82e46e(0x15f)]()===''){_0x489e4b++;continue;}break;}return _0x3b099b[_0x82e46e(0x14a)](_0x489e4b)[_0x82e46e(0x159)]('\x0a')[_0x82e46e(0x152)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a256_0x3fa4(_0x1bd559,_0x271951){_0x1bd559=_0x1bd559-0x7d;const _0x338bdf=a256_0x338b();let _0x3fa415=_0x338bdf[_0x1bd559];return _0x3fa415;}function a256_0x338b(){const _0xbeb874=['14QiDVzP','length','\x20unchanged','sqls','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','421812AoAxkQ','2436sXgEvd','387216WxiQXF','44nMXWZk','575544Aysglf','path','paging','remote','\x20missing,\x20','sql','lockKey','537015TiTtHD','push','hash','2546520kqWYTA','bool','map','appCode','lockFilePath','boolean','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','status','sqlRoot','All\x20SQL\x20queries\x20are\x20in\x20sync.','keys','3099740yCMAfP','88pFhNAw','3820nuiNLh','has','totalCount','2raUoLe','tableData','sqlCode','sqlName'];a256_0x338b=function(){return _0xbeb874;};return a256_0x338b();}const a256_0x5de837=a256_0x3fa4;(function(_0x50f5d0,_0x4b9496){const _0x557544=a256_0x3fa4,_0x1ed5f2=_0x50f5d0();while(!![]){try{const _0x33eea0=-parseInt(_0x557544(0x7d))/0x1+-parseInt(_0x557544(0x9b))/0x2*(parseInt(_0x557544(0x88))/0x3)+-parseInt(_0x557544(0x7e))/0x4*(-parseInt(_0x557544(0x98))/0x5)+-parseInt(_0x557544(0x81))/0x6*(parseInt(_0x557544(0x9f))/0x7)+-parseInt(_0x557544(0x97))/0x8*(parseInt(_0x557544(0x7f))/0x9)+parseInt(_0x557544(0x96))/0xa+-parseInt(_0x557544(0x80))/0xb*(-parseInt(_0x557544(0x8b))/0xc);if(_0x33eea0===_0x4b9496)break;else _0x1ed5f2['push'](_0x1ed5f2['shift']());}catch(_0x42a966){_0x1ed5f2['push'](_0x1ed5f2['shift']());}}}(a256_0x338b,0x57711));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x7c0047){const _0x459824=a256_0x3fa4,_0x1d6fe9=[];let _0x2830fa=0x1;while(!![]){const _0x11776d=await listSqlQueries(_0x7c0047,{'currentPage':_0x2830fa,'pageSize':PAGE_SIZE}),_0x2a31a=_0x11776d[_0x459824(0x9c)]??[];_0x1d6fe9['push'](..._0x2a31a[_0x459824(0x8d)](_0x4ac6d8=>_0x4ac6d8[_0x459824(0x9d)]));if(_0x2a31a['length']===0x0)break;const _0x1c5601=_0x11776d[_0x459824(0x83)]?.[_0x459824(0x9a)];if(_0x1c5601!=null?_0x1d6fe9[_0x459824(0xa0)]>=_0x1c5601:_0x2a31a[_0x459824(0xa0)]<PAGE_SIZE)break;_0x2830fa++;}return _0x1d6fe9;}export const sqlStatus={'service':a256_0x5de837(0x86),'command':a256_0x5de837(0x92),'description':a256_0x5de837(0x91),'risk':'read','flags':[{'name':a256_0x5de837(0x84),'type':a256_0x5de837(0x90),'description':a256_0x5de837(0xa3)}],async 'execute'(_0x1cca35){const _0x3af6b1=a256_0x5de837,_0x1561bf=loadSqlProjectConfig(_0x1cca35[_0x3af6b1(0x8e)]),_0x28923b=await readSqlLockFile(_0x1561bf[_0x3af6b1(0x8f)]),{appLock:_0x273c0e}=ensureSqlLockScope(_0x28923b??createEmptySqlLock(),_0x1561bf['appCode'],_0x1561bf[_0x3af6b1(0x93)],_0x3af6b1(0x92)),_0x566271=await scanLocalSqlQueries(_0x1561bf),_0x735228=[],_0x203b5e=[],_0x33c54f=[],_0x4debb1=[],_0x5bd6bd=new Set(_0x566271[_0x3af6b1(0x8d)](_0x216e5c=>_0x216e5c[_0x3af6b1(0x87)]));for(const _0x5ab18a of _0x566271){const _0x3c58ec=await computeSqlFileHash(_0x5ab18a['filePath']),_0x21ae47=_0x273c0e[_0x3af6b1(0xa2)][_0x5ab18a[_0x3af6b1(0x87)]],_0x172715=!!_0x21ae47&&_0x21ae47[_0x3af6b1(0x82)]!==_0x5ab18a['relativePath'],_0x372ed9=!!_0x21ae47&&!!_0x5ab18a['sqlName']&&_0x21ae47['sqlName']!==_0x5ab18a[_0x3af6b1(0x9e)];if(!_0x21ae47)_0x735228[_0x3af6b1(0x89)](_0x5ab18a['lockKey']);else _0x21ae47[_0x3af6b1(0x8a)]!==_0x3c58ec||_0x172715||_0x372ed9?_0x203b5e['push'](_0x5ab18a[_0x3af6b1(0x87)]):_0x33c54f[_0x3af6b1(0x89)](_0x5ab18a['lockKey']);}for(const _0x1a686c of Object[_0x3af6b1(0x95)](_0x273c0e[_0x3af6b1(0xa2)])){!_0x5bd6bd[_0x3af6b1(0x99)](_0x1a686c)&&_0x4debb1[_0x3af6b1(0x89)](_0x1a686c);}const _0x44624e=[];if(_0x1cca35[_0x3af6b1(0x8c)](_0x3af6b1(0x84))){const _0x488920=await fetchAllSqlCodes(_0x1cca35[_0x3af6b1(0x8e)]);for(const _0x59fc02 of _0x488920){!_0x5bd6bd['has'](_0x59fc02)&&!_0x273c0e[_0x3af6b1(0xa2)][_0x59fc02]&&_0x44624e[_0x3af6b1(0x89)](_0x59fc02);}}const _0xa56c8a=_0x735228[_0x3af6b1(0xa0)]===0x0&&_0x203b5e['length']===0x0&&_0x4debb1[_0x3af6b1(0xa0)]===0x0&&_0x44624e['length']===0x0;return{'ok':!![],'data':{'added':_0x735228,'modified':_0x203b5e,'missing':_0x4debb1,'unchanged':_0x33c54f,'remoteOnly':_0x44624e},'message':_0xa56c8a?_0x3af6b1(0x94):_0x735228[_0x3af6b1(0xa0)]+'\x20added,\x20'+_0x203b5e[_0x3af6b1(0xa0)]+'\x20modified,\x20'+_0x4debb1['length']+_0x3af6b1(0x85)+_0x33c54f[_0x3af6b1(0xa0)]+_0x3af6b1(0xa1)+(_0x44624e[_0x3af6b1(0xa0)]>0x0?',\x20'+_0x44624e[_0x3af6b1(0xa0)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a257_0x3a5675=a257_0x42a0;(function(_0x11a2aa,_0x318a46){const _0x5ade3d=a257_0x42a0,_0x1cc17b=_0x11a2aa();while(!![]){try{const _0x4e5ed3=-parseInt(_0x5ade3d(0x224))/0x1*(parseInt(_0x5ade3d(0x1f5))/0x2)+parseInt(_0x5ade3d(0x207))/0x3+-parseInt(_0x5ade3d(0x20c))/0x4+parseInt(_0x5ade3d(0x22d))/0x5+-parseInt(_0x5ade3d(0x221))/0x6+parseInt(_0x5ade3d(0x20f))/0x7+parseInt(_0x5ade3d(0x236))/0x8*(parseInt(_0x5ade3d(0x22a))/0x9);if(_0x4e5ed3===_0x318a46)break;else _0x1cc17b['push'](_0x1cc17b['shift']());}catch(_0x3e3b7d){_0x1cc17b['push'](_0x1cc17b['shift']());}}}(a257_0x32e5,0xaa327));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a257_0x42a0(_0x2196d3,_0x7319d3){_0x2196d3=_0x2196d3-0x1f3;const _0x32e552=a257_0x32e5();let _0x42a00e=_0x32e552[_0x2196d3];return _0x42a00e;}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a257_0x32e5(){const _0x49d43f=['4100110wSfMXs','str','valid','check-indexes','trim','validation','find','push','isArray','dbtableConfig','type','Table\x20\x22','tableName','index_type','size','columns','flagMissing','index_columns','2419110dfCPxX','flatMap','from','1frtoUY','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','index_name','joinAudit','columnNames','reason','288pAdafO','sql','string','3204560kwQNGi','schema:','\x22\x20not\x20found\x20in\x20any\x20dataset','appCode','dataset','tables','\x22\x20not\x20found\x20or\x20not\x20accessible','isLockingRead','length','351384XVnOYf','indexes','filter','871322liYdpq','file','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','utf-8','schemas','fields','read','name','message','cwd','schemaWarnings','Dataset\x20\x22','validate','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','Provide\x20--file\x20or\x20--sql','sqlType','bool','--check-indexes\x20requires\x20--schemas.','381816bFeVXL','split','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','toLowerCase','4893908wAhkBp','map','primary'];a257_0x32e5=function(){return _0x49d43f;};return a257_0x32e5();}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a257_0x3a5675(0x22b),'command':a257_0x3a5675(0x201),'description':a257_0x3a5675(0x1f7),'risk':a257_0x3a5675(0x1fb),'flags':[{'name':a257_0x3a5675(0x1f6),'type':a257_0x3a5675(0x22c),'description':a257_0x3a5675(0x225)},{'name':a257_0x3a5675(0x22b),'type':a257_0x3a5675(0x22c),'description':a257_0x3a5675(0x202)},{'name':a257_0x3a5675(0x1f9),'type':a257_0x3a5675(0x22c),'description':a257_0x3a5675(0x20a)},{'name':a257_0x3a5675(0x212),'type':'boolean','description':a257_0x3a5675(0x209)}],async 'execute'(_0x5b423b){const _0x139796=a257_0x3a5675,_0x4f9021=_0x5b423b['str']('file'),_0x44ca22=_0x5b423b['str']('sql'),_0x59c0e6=_0x5b423b[_0x139796(0x210)](_0x139796(0x1f9)),_0x44c27f=_0x5b423b[_0x139796(0x205)]('check-indexes');if(!_0x4f9021&&!_0x44ca22)throw CliErrors[_0x139796(0x21f)](_0x139796(0x1f6),_0x139796(0x203));if(_0x44c27f&&!_0x59c0e6)throw CliErrors['validation'](_0x139796(0x206));let _0x1f1743;if(_0x4f9021){const _0x4e16c9=resolve(process[_0x139796(0x1fe)](),_0x4f9021);if(!existsSync(_0x4e16c9))throw CliErrors[_0x139796(0x214)]('File\x20not\x20found:\x20'+_0x4e16c9);_0x1f1743=readFileSync(_0x4e16c9,_0x139796(0x1f8));}else _0x1f1743=_0x44ca22;const _0x43936b=validateSql(_0x1f1743),_0x166a91={'valid':_0x43936b['valid'],'sqlType':_0x43936b['sqlType'][_0x139796(0x219)],'isSelectOnly':_0x43936b[_0x139796(0x204)]['isSelectOnly'],'isLockingRead':_0x43936b[_0x139796(0x204)][_0x139796(0x234)]??![],'isDangerous':_0x43936b[_0x139796(0x204)]['isDangerous'],'tables':_0x43936b[_0x139796(0x232)],'parameters':_0x43936b['parameters'],'message':_0x43936b[_0x139796(0x1fd)]};_0x43936b[_0x139796(0x204)][_0x139796(0x229)]&&(_0x166a91[_0x139796(0x229)]=_0x43936b[_0x139796(0x204)]['reason']);if(_0x59c0e6&&_0x43936b[_0x139796(0x211)]){const _0x2450a4=_0x59c0e6[_0x139796(0x208)](',')[_0x139796(0x20d)](_0x576e9f=>_0x576e9f[_0x139796(0x213)]())[_0x139796(0x1f4)](Boolean),_0x17f153=[],_0xc11307=[],_0x4af298=filterDbTableBackedDatasets(await listDatasets(_0x5b423b[_0x139796(0x230)])),_0x47dbc6=new Map(_0x4af298['map'](_0x54b3b4=>[_0x54b3b4[_0x139796(0x218)]?.[_0x139796(0x21b)]?.[_0x139796(0x20b)](),_0x54b3b4]));for(const _0x1e71a9 of _0x43936b[_0x139796(0x232)]){const _0x136a0b=_0x47dbc6['get'](_0x1e71a9[_0x139796(0x20b)]());!_0x136a0b&&_0x17f153[_0x139796(0x216)](_0x139796(0x21a)+_0x1e71a9+_0x139796(0x22f));}for(const _0x1dc163 of _0x2450a4){let _0x2cef7b;try{_0x2cef7b=await getDatasetDetail(_0x1dc163);}catch{_0x17f153[_0x139796(0x216)](_0x139796(0x200)+_0x1dc163+_0x139796(0x233));continue;}assertDatasetIsDbTableBacked(_0x2cef7b,'SQL\x20schema\x20validation');const _0x20d0e8=Array[_0x139796(0x217)](_0x2cef7b['fields'])?_0x2cef7b[_0x139796(0x1fa)]:[],_0x1ba3f8=new Set(_0x20d0e8[_0x139796(0x20d)](_0x2ee3a5=>_0x2ee3a5[_0x139796(0x1fc)]?.['toLowerCase']())),_0x2d2b91=_0x2cef7b[_0x139796(0x218)]?.['tableName']||_0x2cef7b[_0x139796(0x21b)]||_0x1dc163;_0x166a91[_0x139796(0x22e)+_0x2d2b91]={'code':_0x1dc163,'tableName':_0x2d2b91,'fieldCount':_0x1ba3f8[_0x139796(0x21d)],'fields':Array[_0x139796(0x223)](_0x1ba3f8)};if(_0x44c27f){const _0x2d8534=normalizeDatasetIndexes(_0x2cef7b);_0xc11307[_0x139796(0x216)]({'tableName':_0x2d2b91,..._0x2d8534});}}_0x17f153[_0x139796(0x235)]>0x0&&(_0x166a91[_0x139796(0x1ff)]=_0x17f153),_0x44c27f&&(_0x166a91[_0x139796(0x227)]=auditSqlJoinIndexes(_0x1f1743,_0xc11307));}return{'ok':_0x43936b['valid'],'data':_0x166a91,'message':_0x43936b[_0x139796(0x1fd)]};}};function normalizeDatasetIndexes(_0x51d945){const _0x1b426d=a257_0x3a5675,_0x2cc47e=Array[_0x1b426d(0x217)](_0x51d945?.[_0x1b426d(0x231)]?.[_0x1b426d(0x1f3)])?_0x51d945['dataset'][_0x1b426d(0x1f3)]:Array[_0x1b426d(0x217)](_0x51d945?.[_0x1b426d(0x1f3)])?_0x51d945[_0x1b426d(0x1f3)]:[],_0x2a221b=_0x2cc47e[_0x1b426d(0x222)](_0x5427c6=>{const _0x53b77c=_0x1b426d,_0x370ab3=Array[_0x53b77c(0x217)](_0x5427c6?.[_0x53b77c(0x220)])?_0x5427c6[_0x53b77c(0x220)]:Array['isArray'](_0x5427c6?.['columnNames'])?_0x5427c6[_0x53b77c(0x228)]:Array[_0x53b77c(0x217)](_0x5427c6?.[_0x53b77c(0x21e)])?_0x5427c6['columns']:[],_0x167ba7=_0x370ab3['filter'](_0x4ef104=>typeof _0x4ef104==='string')[_0x53b77c(0x20d)](_0x516145=>_0x516145['trim']())[_0x53b77c(0x1f4)](Boolean);if(_0x167ba7[_0x53b77c(0x235)]===0x0)return[];const _0x4fc205=[_0x5427c6?.['indexName'],_0x5427c6?.[_0x53b77c(0x226)],_0x5427c6?.[_0x53b77c(0x1fc)]]['find'](_0x2f1b3f=>typeof _0x2f1b3f===_0x53b77c(0x22c)&&_0x2f1b3f['trim']()),_0x1da427=[_0x5427c6?.[_0x53b77c(0x21c)],_0x5427c6?.[_0x53b77c(0x219)]][_0x53b77c(0x215)](_0x4342af=>typeof _0x4342af==='string'&&_0x4342af[_0x53b77c(0x213)]());return[{..._0x4fc205?{'name':_0x4fc205[_0x53b77c(0x213)]()}:{},..._0x1da427?{'type':_0x1da427['trim']()}:{},'columns':_0x167ba7}];}),_0x14ca5a=[..._0x2a221b],_0x5d775a=typeof _0x51d945?.[_0x1b426d(0x218)]?.['pkField']===_0x1b426d(0x22c)?_0x51d945[_0x1b426d(0x218)]['pkField']['split'](',')[_0x1b426d(0x20d)](_0x58e184=>_0x58e184['trim']())[_0x1b426d(0x1f4)](Boolean):[];return _0x5d775a['length']>0x0&&_0x14ca5a['unshift']({'type':_0x1b426d(0x20e),'columns':_0x5d775a}),{'indexes':_0x14ca5a,'metadataAvailable':_0x2a221b[_0x1b426d(0x235)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5a12c4,_0x558b1e){const _0x3ad4a4=a258_0x4872,_0x7ad232=_0x5a12c4();while(!![]){try{const _0x18832d=parseInt(_0x3ad4a4(0x108))/0x1+parseInt(_0x3ad4a4(0x106))/0x2+parseInt(_0x3ad4a4(0x10c))/0x3*(parseInt(_0x3ad4a4(0x10a))/0x4)+-parseInt(_0x3ad4a4(0x109))/0x5+-parseInt(_0x3ad4a4(0x10e))/0x6+parseInt(_0x3ad4a4(0x10d))/0x7*(parseInt(_0x3ad4a4(0x107))/0x8)+-parseInt(_0x3ad4a4(0x10b))/0x9*(parseInt(_0x3ad4a4(0x10f))/0xa);if(_0x18832d===_0x558b1e)break;else _0x7ad232['push'](_0x7ad232['shift']());}catch(_0x472a6b){_0x7ad232['push'](_0x7ad232['shift']());}}}(a258_0x200e,0x6e88f));function a258_0x4872(_0x11cbd3,_0x4ac076){_0x11cbd3=_0x11cbd3-0x106;const _0x200eb1=a258_0x200e();let _0x4872aa=_0x200eb1[_0x11cbd3];return _0x4872aa;}import{taskStatus}from'../../commands/task/status.js';function a258_0x200e(){const _0x3bf6dc=['755970lCOvwG','1255988gunbkZ','8abHPQc','671269iRWxea','1232255OhntCJ','3044664aSOOyv','81IZZKIL','3ssaQQl','783335BTeGIy','4756554ZNVHzg'];a258_0x200e=function(){return _0x3bf6dc;};return a258_0x200e();}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a259_0x38e589=a259_0x4109;(function(_0x42995e,_0xecbdc6){const _0x30bb9b=a259_0x4109,_0x59a75f=_0x42995e();while(!![]){try{const _0x3e84ed=-parseInt(_0x30bb9b(0xb0))/0x1+-parseInt(_0x30bb9b(0xb3))/0x2+parseInt(_0x30bb9b(0xb5))/0x3*(-parseInt(_0x30bb9b(0xac))/0x4)+parseInt(_0x30bb9b(0xaf))/0x5*(parseInt(_0x30bb9b(0xbd))/0x6)+parseInt(_0x30bb9b(0xbc))/0x7+-parseInt(_0x30bb9b(0xb2))/0x8+parseInt(_0x30bb9b(0xae))/0x9;if(_0x3e84ed===_0xecbdc6)break;else _0x59a75f['push'](_0x59a75f['shift']());}catch(_0x342ebf){_0x59a75f['push'](_0x59a75f['shift']());}}}(a259_0x2fdb,0xadd07));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a259_0x4109(_0x475afc,_0xd746f){_0x475afc=_0x475afc-0xac;const _0x2fdb01=a259_0x2fdb();let _0x410900=_0x2fdb01[_0x475afc];return _0x410900;}function a259_0x2fdb(){const _0x118ceb=['string','appCode','6009717VrOBIP','6ysDzzY','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','4lPmHhx','task','24166368JVdFet','1755765VdiDua','887379KyPuFY','compress','4552304dWxCRg','1186778XCAbWt','taskId','3399261RjzHgX','task-id','status','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','str'];a259_0x2fdb=function(){return _0x118ceb;};return a259_0x2fdb();}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':a259_0x38e589(0xad),'command':a259_0x38e589(0xb7),'description':a259_0x38e589(0xbf),'risk':'read','defaultOutputFormat':a259_0x38e589(0xb1),'structuredErrors':!![],'flags':[{'name':'task-id','type':a259_0x38e589(0xba),'required':!![],'description':a259_0x38e589(0xb8)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2bd96b){const _0x31f836=a259_0x38e589;if(!_0x2bd96b[_0x31f836(0xb9)](_0x31f836(0xb6))['trim']())throw CliErrors['flagMissing'](_0x31f836(0xb6));},async 'execute'(_0x3fee32){const _0x9d0c48=a259_0x38e589,_0x56f42f=_0x3fee32[_0x9d0c48(0xb9)](_0x9d0c48(0xb6))['trim'](),_0x524739=normalizeAsyncTask(await getAsyncTaskStatus(_0x56f42f,_0x3fee32[_0x9d0c48(0xbb)],_0x3fee32['cookie']));if(_0x524739['taskId']!==_0x56f42f)throw CliErrors['apiError'](_0x9d0c48(0xbe)+_0x56f42f+',\x20received\x20'+_0x524739['taskId']+'.');const _0x16d211=buildAsyncTaskStatusCommand(_0x524739[_0x9d0c48(0xb4)],_0x3fee32[_0x9d0c48(0xbb)]);return{'ok':!![],'message':asyncTaskMessage(_0x524739),'data':{'appCode':_0x3fee32['appCode'],..._0x524739,'query':_0x524739['isTerminal']?null:{'command':_0x16d211}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x379d65,_0x1ad7c5){const _0x13a300=a260_0x2a61,_0xa5d76e=_0x379d65();while(!![]){try{const _0x66e61d=-parseInt(_0x13a300(0x1a5))/0x1+parseInt(_0x13a300(0x1a2))/0x2*(-parseInt(_0x13a300(0x1a1))/0x3)+-parseInt(_0x13a300(0x19d))/0x4*(parseInt(_0x13a300(0x1a6))/0x5)+-parseInt(_0x13a300(0x19e))/0x6*(-parseInt(_0x13a300(0x1a4))/0x7)+parseInt(_0x13a300(0x19b))/0x8*(-parseInt(_0x13a300(0x19f))/0x9)+-parseInt(_0x13a300(0x19c))/0xa*(-parseInt(_0x13a300(0x1a7))/0xb)+parseInt(_0x13a300(0x1a3))/0xc*(parseInt(_0x13a300(0x1a0))/0xd);if(_0x66e61d===_0x1ad7c5)break;else _0xa5d76e['push'](_0xa5d76e['shift']());}catch(_0x49190c){_0xa5d76e['push'](_0xa5d76e['shift']());}}}(a260_0x4bd3,0xf2a33));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a260_0x4bd3(){const _0x450602=['1033821QQOInc','49155782VNaMpx','21LXGvln','489466RuLFcX','12JomPJU','133sKTHTe','773384eRLWVE','2957260HoEkDI','11cTBanw','24PktFPX','1463530cHaRXl','8ixvoSb','341148aUXLuV'];a260_0x4bd3=function(){return _0x450602;};return a260_0x4bd3();}function a260_0x2a61(_0x32f899,_0xad0a68){_0x32f899=_0x32f899-0x19b;const _0x4bd372=a260_0x4bd3();let _0x2a6153=_0x4bd372[_0x32f899];return _0x2a6153;}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a261_0xe1d183=a261_0x15e6;(function(_0x43040b,_0x127e86){const _0x540680=a261_0x15e6,_0x33c7b9=_0x43040b();while(!![]){try{const _0x242a90=parseInt(_0x540680(0x1b3))/0x1+-parseInt(_0x540680(0x1b4))/0x2+-parseInt(_0x540680(0x1be))/0x3+-parseInt(_0x540680(0x1ac))/0x4*(parseInt(_0x540680(0x1bc))/0x5)+-parseInt(_0x540680(0x1b1))/0x6*(parseInt(_0x540680(0x1bb))/0x7)+parseInt(_0x540680(0x1ae))/0x8+-parseInt(_0x540680(0x1b8))/0x9*(-parseInt(_0x540680(0x1aa))/0xa);if(_0x242a90===_0x127e86)break;else _0x33c7b9['push'](_0x33c7b9['shift']());}catch(_0x180705){_0x33c7b9['push'](_0x33c7b9['shift']());}}}(a261_0x4704,0x78a38));function a261_0x15e6(_0x5e9e46,_0x5d4921){_0x5e9e46=_0x5e9e46-0x1a9;const _0x470420=a261_0x4704();let _0x15e638=_0x470420[_0x5e9e46];return _0x15e638;}import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';function a261_0x4704(){const _0x2fa2cc=['\x20tenant\x20member(s)','1333672mUPgRd','string','trim','121866FxOTDe','members-list','250280CywyGo','488704kEPTcw','tenant','read','tenant-code','13941fQVzXF','length','Exact\x20tenant\x20code','189opDpJP','15HwHKne','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','1806177qmujFM','Pass\x20--tenant-code\x20<code>.','flagMissing','12140jOhWAT','str','544708iNnULr'];a261_0x4704=function(){return _0x2fa2cc;};return a261_0x4704();}export const tenantMembersListDefinition={'service':a261_0xe1d183(0x1b5),'command':a261_0xe1d183(0x1b2),'description':a261_0xe1d183(0x1bd),'risk':a261_0xe1d183(0x1b6),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a261_0xe1d183(0x1b7),'type':a261_0xe1d183(0x1af),'required':!![],'description':a261_0xe1d183(0x1ba)}],async 'validate'(_0x208c78){const _0x39d98f=a261_0xe1d183;if(!_0x208c78[_0x39d98f(0x1ab)]('tenant-code')[_0x39d98f(0x1b0)]())throw CliErrors[_0x39d98f(0x1a9)]('tenant-code',_0x39d98f(0x1bf));},async 'execute'(_0x4462bd){const _0x4730dc=a261_0xe1d183,_0x47141a=_0x4462bd[_0x4730dc(0x1ab)](_0x4730dc(0x1b7))[_0x4730dc(0x1b0)](),_0x42bf55=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x47141a,_0x42bf55);const _0x1a8126=projectTenantMembers(await listTenantDirectoryMembers(_0x47141a));return{'ok':!![],'data':{'tenantCode':_0x47141a,'items':_0x1a8126,'totalCount':_0x1a8126['length']},'message':'Found\x20'+_0x1a8126[_0x4730dc(0x1b9)]+_0x4730dc(0x1ad)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a262_0xdb86(){const _0x1d15e8=['Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','3QqwuHE','isFinite','trim','8IeVDlN','set','MEMBER','role','46696MIIUwH','15580yMMxme','nickname','userId','5QEONqn','Tenant\x20\x22','some','594688ItnRMf','ADMIN','sort','2627891ntRauP','1067INsIJx','status','tenantCode','291402UmPSpA','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','username','validation','4440393zyqOUA','531060bKWHps'];a262_0xdb86=function(){return _0x1d15e8;};return a262_0xdb86();}function a262_0x5b64(_0x276995,_0x4ca718){_0x276995=_0x276995-0x6f;const _0xdb861e=a262_0xdb86();let _0x5b64b5=_0xdb861e[_0x276995];return _0x5b64b5;}(function(_0x2ff337,_0x3cc13b){const _0x7acf85=a262_0x5b64,_0x3aa2b1=_0x2ff337();while(!![]){try{const _0x35410f=parseInt(_0x7acf85(0x7e))/0x1+-parseInt(_0x7acf85(0x75))/0x2*(parseInt(_0x7acf85(0x77))/0x3)+-parseInt(_0x7acf85(0x85))/0x4+parseInt(_0x7acf85(0x82))/0x5*(-parseInt(_0x7acf85(0x70))/0x6)+parseInt(_0x7acf85(0x88))/0x7*(parseInt(_0x7acf85(0x7a))/0x8)+parseInt(_0x7acf85(0x74))/0x9+-parseInt(_0x7acf85(0x7f))/0xa*(parseInt(_0x7acf85(0x89))/0xb);if(_0x35410f===_0x3cc13b)break;else _0x3aa2b1['push'](_0x3aa2b1['shift']());}catch(_0xcb82d1){_0x3aa2b1['push'](_0x3aa2b1['shift']());}}}(a262_0xdb86,0x49a17));import{CliErrors}from'../../errors.js';function textOrNull(_0x44a050){const _0x43d14c=a262_0x5b64,_0x155218=_0x44a050?.[_0x43d14c(0x79)]();return _0x155218?_0x155218:null;}export function projectTenantMembers(_0x403f5a){const _0x18f48f=a262_0x5b64,_0xfb8c6e=new Map();for(const _0x1302ce of _0x403f5a){const _0x56460f=Number(_0x1302ce[_0x18f48f(0x81)]);if(!Number[_0x18f48f(0x78)](_0x56460f)||_0x56460f<=0x0)continue;const _0x20a35a={'userId':_0x56460f,'username':textOrNull(_0x1302ce[_0x18f48f(0x72)]),'displayName':textOrNull(_0x1302ce[_0x18f48f(0x80)]),'role':_0x1302ce['adminFlag']===!![]?'ADMIN':_0x18f48f(0x7c),'status':textOrNull(_0x1302ce[_0x18f48f(0x8a)])},_0x4f18ba=_0xfb8c6e['get'](_0x56460f);if(!_0x4f18ba){_0xfb8c6e[_0x18f48f(0x7b)](_0x56460f,_0x20a35a);continue;}_0x4f18ba['username']??=_0x20a35a['username'],_0x4f18ba['displayName']??=_0x20a35a['displayName'],_0x4f18ba[_0x18f48f(0x8a)]??=_0x20a35a['status'];if(_0x20a35a[_0x18f48f(0x7d)]==='ADMIN')_0x4f18ba[_0x18f48f(0x7d)]=_0x18f48f(0x86);}return[..._0xfb8c6e['values']()][_0x18f48f(0x87)]((_0x2e60d5,_0x4df513)=>_0x2e60d5['userId']-_0x4df513[_0x18f48f(0x81)]);}export function assertTenantAccessible(_0x150b55,_0x356f78){const _0x426ffb=a262_0x5b64;if(_0x356f78[_0x426ffb(0x84)](_0xb32841=>_0xb32841[_0x426ffb(0x6f)]===_0x150b55))return;throw CliErrors[_0x426ffb(0x73)](_0x426ffb(0x83)+_0x150b55+_0x426ffb(0x71),_0x426ffb(0x76));}
|