@lovrabet/rabetbase-cli 2.5.12-beta.1 → 2.5.12
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
|
-
const
|
|
1
|
+
const a242_0x2ba4ea=a242_0x18e6;function a242_0x24fa(){const _0x2d49cb=['2DEOsoU','125112CzirXP','2334876aOdOrf','2465460ZRrTkB','map','list','1580910LokZhs','rule','all','length','read','appCode','932251jBztaO','1913232LGlocr','182lOKzbK','Loaded\x20app\x20rule\x20configuration\x20for\x20','2224260iCZlmo'];a242_0x24fa=function(){return _0x2d49cb;};return a242_0x24fa();}(function(_0x42108c,_0x435cd7){const _0x46edb8=a242_0x18e6,_0x5eb383=_0x42108c();while(!![]){try{const _0x5ae0ae=-parseInt(_0x46edb8(0x181))/0x1*(-parseInt(_0x46edb8(0x186))/0x2)+-parseInt(_0x46edb8(0x188))/0x3+parseInt(_0x46edb8(0x189))/0x4+parseInt(_0x46edb8(0x18c))/0x5+parseInt(_0x46edb8(0x182))/0x6+parseInt(_0x46edb8(0x183))/0x7*(-parseInt(_0x46edb8(0x187))/0x8)+-parseInt(_0x46edb8(0x185))/0x9;if(_0x5ae0ae===_0x435cd7)break;else _0x5eb383['push'](_0x5eb383['shift']());}catch(_0x21d0fd){_0x5eb383['push'](_0x5eb383['shift']());}}}(a242_0x24fa,0xb7808));import{getAppRule}from'../../core/api-client.js';function a242_0x18e6(_0x2962fe,_0x14a0d9){_0x2962fe=_0x2962fe-0x181;const _0x24fa1d=a242_0x24fa();let _0x18e673=_0x24fa1d[_0x2962fe];return _0x18e673;}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a242_0x2ba4ea(0x18d),'command':a242_0x2ba4ea(0x18b),'description':'List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','risk':a242_0x2ba4ea(0x190),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x348cca){const _0x1702d0=a242_0x2ba4ea,_0x478a15=await Promise[_0x1702d0(0x18e)](APP_RULE_TYPES['map'](_0x672516=>getAppRule(_0x348cca['cookie'],{'appCode':_0x348cca[_0x1702d0(0x191)],'type':_0x672516}))),_0x50736f=APP_RULE_TYPES[_0x1702d0(0x18a)]((_0x13a2d7,_0x390e0e)=>projectAppRule(_0x13a2d7,_0x478a15[_0x390e0e]??null));return{'ok':!![],'data':{'total':_0x50736f[_0x1702d0(0x18f)],'rules':_0x50736f},'message':_0x1702d0(0x184)+_0x348cca['appCode']};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a243_0x106366=a243_0x4652;function a243_0x13bb(){const _0x33eaa4=['424450WlewAb','DATABASE','1531392ZDFklG','Set\x20','isSafeInteger','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','appCode','Pass\x20a\x20UTF-8\x20Markdown\x20file.','set','version','update','270HhcEXP','create','rules','expectedVersion','--file\x20is\x20required.','app_rule_version_mismatch','cookie','input','297493ZGKXmN','app_rule_expected_version_invalid','content','planned','\x20for\x20','rule','trim','144YJFNXl','unconfigured','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','164175biTZOG',';\x20current\x20version\x20is\x20','defineProperty','751293eWROHR','The\x20set\x20request\x20was\x20sent,\x20but\x20','before','file','2984448YHbeIa','app_rule_verification_unavailable','UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','str','number','\x20--format\x20compress','Expected\x20','app_rule_set_outcome_unknown','replacement','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','contentHash','cause','length','5dZJnpt','beforeRecord','POST','\x20could\x20not\x20be\x20verified.','write','rabetbase\x20rule\x20get\x20--type\x20','expected-version','push','type','verified','1437024AGERYO'];a243_0x13bb=function(){return _0x33eaa4;};return a243_0x13bb();}(function(_0x1f2a83,_0x4eae5b){const _0x3cd4c1=a243_0x4652,_0x260f7b=_0x1f2a83();while(!![]){try{const _0x2bc982=-parseInt(_0x3cd4c1(0xfd))/0x1+-parseInt(_0x3cd4c1(0xc3))/0x2+parseInt(_0x3cd4c1(0xde))/0x3+parseInt(_0x3cd4c1(0xe5))/0x4+parseInt(_0x3cd4c1(0xf2))/0x5*(-parseInt(_0x3cd4c1(0xfc))/0x6)+parseInt(_0x3cd4c1(0xd4))/0x7*(-parseInt(_0x3cd4c1(0xdb))/0x8)+-parseInt(_0x3cd4c1(0xe1))/0x9*(-parseInt(_0x3cd4c1(0xcc))/0xa);if(_0x2bc982===_0x4eae5b)break;else _0x260f7b['push'](_0x260f7b['shift']());}catch(_0x4ca133){_0x260f7b['push'](_0x260f7b['shift']());}}}(a243_0x13bb,0xd1fb4));import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a243_0x4652(_0x43982c,_0x1f006a){_0x43982c=_0x43982c-0xc3;const _0x13bbbd=a243_0x13bb();let _0x4652cd=_0x13bbbd[_0x43982c];return _0x4652cd;}import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function readSetInput(_0xc1fe2a){const _0x4e7e8a=a243_0x4652,_0x280ce6=readAppRuleType(_0xc1fe2a),_0x2a7cc2=_0xc1fe2a[_0x4e7e8a(0xe8)](_0x4e7e8a(0xe4))[_0x4e7e8a(0xda)]();if(!_0x2a7cc2)throw appRuleError('app_rule_file_required',_0x4e7e8a(0xd0),_0x4e7e8a(0xc8));const _0x516761=_0xc1fe2a['flag'](_0x4e7e8a(0xf8));let _0x49566d;if(_0x516761!==undefined){_0x49566d=Number(_0x516761);if(!Number[_0x4e7e8a(0xc5)](_0x49566d)||_0x49566d<0x0)throw appRuleError(_0x4e7e8a(0xd5),_0x4e7e8a(0xee));}return{'type':_0x280ce6,'file':_0x2a7cc2,'expectedVersion':_0x49566d};}async function prepareSet(_0x3b03d0){const _0x20070c=a243_0x4652,_0x4caa9d=readSetInput(_0x3b03d0),_0x2cb035=await readAppRuleFile(_0x4caa9d['file']);if(_0x4caa9d[_0x20070c(0xfa)]==='rules'&&_0x2cb035['content'][_0x20070c(0xf1)]>0x7d0)throw appRuleError('app_rule_content_too_large',_0x20070c(0xdd));const _0x1ab456=await getAppRule(_0x3b03d0['cookie'],{'appCode':_0x3b03d0['appCode'],'type':_0x4caa9d[_0x20070c(0xfa)]});if(_0x4caa9d[_0x20070c(0xcf)]!==undefined&&(_0x1ab456?.[_0x20070c(0xca)]??0x0)!==_0x4caa9d['expectedVersion'])throw appRuleError(_0x20070c(0xd1),appRuleFileName(_0x4caa9d[_0x20070c(0xfa)])+'\x20version\x20changed\x20before\x20write.',_0x20070c(0xeb)+_0x4caa9d[_0x20070c(0xcf)]+_0x20070c(0xdf)+(_0x1ab456?.[_0x20070c(0xca)]??_0x20070c(0xdc))+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x4caa9d,'replacement':_0x2cb035,'beforeRecord':_0x1ab456,'before':projectAppRule(_0x4caa9d[_0x20070c(0xfa)],_0x1ab456),'planned':{'type':_0x4caa9d[_0x20070c(0xfa)],'fileName':appRuleFileName(_0x4caa9d['type']),'contextScope':appRuleContextScope(_0x4caa9d[_0x20070c(0xfa)]),'enabled':!![],'appCode':_0x3b03d0['appCode'],'scope':_0x20070c(0xce),'contentByteSize':_0x2cb035['byteSize'],'contentHash':_0x2cb035['contentHash']}};}function warningsFor(_0x250eda){return[];}export const ruleSet={'service':a243_0x106366(0xd9),'command':a243_0x106366(0xc9),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a243_0x106366(0xf6),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':'file','type':'string','required':!![],'description':a243_0x106366(0xe7)},{'name':'expected-version','type':a243_0x106366(0xe9),'required':![],'description':'Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set'}],async 'validate'(_0x4a147d){readSetInput(_0x4a147d);},async 'dryRun'(_0x1357a1){const _0x1480f3=a243_0x106366,_0xa18528=await prepareSet(_0x1357a1);return asDryRunResult({'operation':_0x1480f3(0xc9),'selector':{'appCode':_0x1357a1[_0x1480f3(0xc7)],'scope':_0x1480f3(0xce),'type':_0xa18528[_0x1480f3(0xd3)][_0x1480f3(0xfa)]},'before':_0xa18528[_0x1480f3(0xe3)],'after':_0xa18528[_0x1480f3(0xd7)],'dryRun':!![],'backend':{'method':'POST','path':knowledgeDocumentsPath(_0x1480f3(0xce),_0xa18528['beforeRecord']?_0x1480f3(0xcb):_0x1480f3(0xcd)),'body':{'appCode':_0x1357a1[_0x1480f3(0xc7)],..._0xa18528[_0x1480f3(0xf3)]?{'id':_0xa18528['beforeRecord']['id']}:{},'title':_0xa18528[_0x1480f3(0xd3)]['type']===_0x1480f3(0xce)?'RULES':_0x1480f3(0xfe),'contentHash':_0xa18528[_0x1480f3(0xed)][_0x1480f3(0xef)],'contentByteSize':_0xa18528[_0x1480f3(0xed)]['byteSize'],..._0xa18528[_0x1480f3(0xf3)]?{'expectedVersion':_0xa18528['beforeRecord'][_0x1480f3(0xca)]}:{}}},'warnings':warningsFor(_0xa18528[_0x1480f3(0xd3)][_0x1480f3(0xcf)]),'verification':{'expectedVersion':_0xa18528[_0x1480f3(0xf3)]?.[_0x1480f3(0xca)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x1480f3(0xf7)+_0xa18528['input']['type']+_0x1480f3(0xea)}},{'method':_0x1480f3(0xf4),'url':knowledgeDocumentsPath('rules',_0xa18528[_0x1480f3(0xf3)]?_0x1480f3(0xcb):_0x1480f3(0xcd))});},async 'execute'(_0x344cbd){const _0x2bcbd6=a243_0x106366,_0x51381c=await prepareSet(_0x344cbd),_0x78d873=_0x51381c['beforeRecord']===null?0x1:_0x51381c['beforeRecord'][_0x2bcbd6(0xca)]+(_0x51381c[_0x2bcbd6(0xf3)]['content']===_0x51381c['replacement'][_0x2bcbd6(0xd6)]?0x0:0x1);let _0x1e543f,_0x127573=![];try{_0x1e543f=await saveAppRule(_0x344cbd['cookie'],{'appCode':_0x344cbd[_0x2bcbd6(0xc7)],'type':_0x51381c[_0x2bcbd6(0xd3)][_0x2bcbd6(0xfa)],'content':_0x51381c[_0x2bcbd6(0xed)][_0x2bcbd6(0xd6)],'expectedVersion':_0x51381c[_0x2bcbd6(0xf3)]?.[_0x2bcbd6(0xca)]??0x0,..._0x51381c[_0x2bcbd6(0xf3)]?{'id':_0x51381c[_0x2bcbd6(0xf3)]['id']}:{}});if(_0x1e543f[_0x2bcbd6(0xca)]!==_0x78d873||_0x1e543f['content']!==_0x51381c[_0x2bcbd6(0xed)][_0x2bcbd6(0xd6)]||_0x51381c[_0x2bcbd6(0xf3)]!==null&&_0x1e543f['id']!==_0x51381c[_0x2bcbd6(0xf3)]['id'])throw appRuleError('app_rule_verification_failed','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.');}catch(_0x4055db){if(!isPlatformTransportFailure(_0x4055db))throw _0x4055db;_0x127573=!![];}let _0x5ab953;try{_0x5ab953=await getAppRule(_0x344cbd[_0x2bcbd6(0xd2)],{'appCode':_0x344cbd[_0x2bcbd6(0xc7)],'type':_0x51381c[_0x2bcbd6(0xd3)]['type']});}catch(_0x4420d4){const _0x314ec0=appRuleError(_0x127573?_0x2bcbd6(0xec):_0x2bcbd6(0xe6),_0x2bcbd6(0xe2)+appRuleFileName(_0x51381c[_0x2bcbd6(0xd3)][_0x2bcbd6(0xfa)])+_0x2bcbd6(0xf5),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object[_0x2bcbd6(0xe0)](_0x314ec0,_0x2bcbd6(0xf0),{'value':_0x4420d4,'enumerable':![]});throw _0x314ec0;}const _0x2938e7=_0x5ab953&&inspectAppRuleContent(_0x5ab953['content'])[_0x2bcbd6(0xef)]===_0x51381c[_0x2bcbd6(0xed)][_0x2bcbd6(0xef)],_0x52547e=_0x5ab953&&_0x5ab953['version']===_0x78d873&&(!_0x1e543f||_0x5ab953['id']===_0x1e543f['id']&&_0x5ab953[_0x2bcbd6(0xca)]===_0x1e543f[_0x2bcbd6(0xca)]);if(!_0x5ab953||!_0x2938e7||!_0x52547e||_0x51381c[_0x2bcbd6(0xf3)]!==null&&_0x5ab953['id']!==_0x51381c['beforeRecord']['id'])throw appRuleError(_0x127573?_0x2bcbd6(0xec):'app_rule_verification_failed',appRuleFileName(_0x51381c[_0x2bcbd6(0xd3)][_0x2bcbd6(0xfa)])+_0x2bcbd6(0xc6),'Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20'+_0x51381c[_0x2bcbd6(0xd3)][_0x2bcbd6(0xfa)]+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x367b81=warningsFor(_0x51381c[_0x2bcbd6(0xd3)]['expectedVersion']);_0x127573&&_0x367b81[_0x2bcbd6(0xf9)]('Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.');const _0x4b3f30=projectAppRule(_0x51381c[_0x2bcbd6(0xd3)][_0x2bcbd6(0xfa)],_0x5ab953);return{'ok':!![],'data':{'operation':_0x2bcbd6(0xc9),'selector':{'appCode':_0x344cbd[_0x2bcbd6(0xc7)],'scope':_0x2bcbd6(0xce),'type':_0x51381c[_0x2bcbd6(0xd3)][_0x2bcbd6(0xfa)]},'before':_0x51381c['before'],'after':_0x4b3f30,'dryRun':![],'backend':{'method':_0x2bcbd6(0xf4),'path':knowledgeDocumentsPath(_0x2bcbd6(0xce),_0x51381c['beforeRecord']?_0x2bcbd6(0xcb):_0x2bcbd6(0xcd))},'warnings':_0x367b81,'verification':{'status':_0x2bcbd6(0xfb),'recoveredAfterUnknownResponse':_0x127573,'expectedVersion':_0x51381c['beforeRecord']?.[_0x2bcbd6(0xca)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x2bcbd6(0xf7)+_0x51381c[_0x2bcbd6(0xd3)][_0x2bcbd6(0xfa)]+_0x2bcbd6(0xea)}},'message':_0x2bcbd6(0xc4)+appRuleFileName(_0x51381c[_0x2bcbd6(0xd3)]['type'])+_0x2bcbd6(0xd8)+_0x344cbd['appCode']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a244_0x5b84(_0x1c6a37,_0x2c8301){_0x1c6a37=_0x1c6a37-0x172;const _0x88026=a244_0x8802();let _0x5b84a8=_0x88026[_0x1c6a37];return _0x5b84a8;}const a244_0x1b57f6=a244_0x5b84;(function(_0x33c0ab,_0x2e0197){const _0x139313=a244_0x5b84,_0x2d4f66=_0x33c0ab();while(!![]){try{const _0x19ce0d=parseInt(_0x139313(0x173))/0x1*(parseInt(_0x139313(0x199))/0x2)+parseInt(_0x139313(0x1a4))/0x3+-parseInt(_0x139313(0x19d))/0x4*(-parseInt(_0x139313(0x1a2))/0x5)+-parseInt(_0x139313(0x196))/0x6+-parseInt(_0x139313(0x17e))/0x7+-parseInt(_0x139313(0x185))/0x8*(parseInt(_0x139313(0x17d))/0x9)+-parseInt(_0x139313(0x191))/0xa;if(_0x19ce0d===_0x2e0197)break;else _0x2d4f66['push'](_0x2d4f66['shift']());}catch(_0x4155ff){_0x2d4f66['push'](_0x2d4f66['shift']());}}}(a244_0x8802,0x1ae2a));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x1b57f6(0x19c),a244_0x1b57f6(0x176)];export const MAX_APP_RULE_UNITS=0x5*0x400*0x400;export const MAX_APP_RULE_BYTES=MAX_APP_RULE_UNITS*0x4;const APP_RULE_FILES={'rules':a244_0x1b57f6(0x198),'database':a244_0x1b57f6(0x18d)},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x1b57f6(0x195),'database':a244_0x1b57f6(0x17b)};export function appRuleError(_0x282cbb,_0x259735,_0x50e41a){return new CliError(_0x282cbb,0x1,_0x259735,_0x50e41a);}export function readAppRuleType(_0x53ced8){const _0x1a21ed=a244_0x1b57f6,_0x5dc8d7=_0x53ced8['str'](_0x1a21ed(0x1a0))[_0x1a21ed(0x193)]()[_0x1a21ed(0x19b)]();if(_0x5dc8d7!==_0x1a21ed(0x19c)&&_0x5dc8d7!==_0x1a21ed(0x176))throw appRuleError(_0x1a21ed(0x172),_0x1a21ed(0x1a7));return _0x5dc8d7;}export function appRuleFileName(_0x578ab6){return APP_RULE_FILES[_0x578ab6];}export function appRuleContextScope(_0x5a0730){return APP_RULE_CONTEXT_SCOPES[_0x5a0730];}function a244_0x8802(){const _0x4436c6=['database','App\x20rule\x20file\x20is\x20blank:\x20','scope','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','size','database-analysis','Pass\x20a\x20UTF-8\x20Markdown\x20file.','514341oUeDwW','230027fNyWvN','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','digest','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','app_rule_file_required','length','createTime','8XHUcpF','indexStatus','Cannot\x20access\x20app\x20rule\x20file:\x20','updateTime','isFile','decode','utf-8','utf8','DATABASE.md','app_rule_file_invalid','appCode','byteSize','2363360tpAEhd','from','trim','sha256:','page-api-development','939240LmyqDS','--file\x20is\x20required.','RULES.md','129502LCMcAJ','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','toLowerCase','rules','851416xRGVGW','string','app_rule_content_too_large','type','content','5fGKyIe','update','557703hZZEmy','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','app_rule_type_invalid','3QPzuTu','sha256','version'];a244_0x8802=function(){return _0x4436c6;};return a244_0x8802();}export function inspectAppRuleContent(_0x4e5e2b){const _0x437210=a244_0x1b57f6,_0xb3aa98=Buffer[_0x437210(0x192)](_0x4e5e2b,_0x437210(0x18c));return{'content':_0x4e5e2b,'byteSize':_0xb3aa98['byteLength'],'contentHash':_0x437210(0x194)+createHash(_0x437210(0x174))[_0x437210(0x1a3)](_0xb3aa98)[_0x437210(0x180)]('hex')};}export async function readAppRuleFile(_0x3746e5){const _0x5a8c48=a244_0x1b57f6,_0xf518c=_0x3746e5['trim']();if(!_0xf518c)throw appRuleError(_0x5a8c48(0x182),_0x5a8c48(0x197),_0x5a8c48(0x17c));const _0x5d1b96=resolve(_0xf518c);let _0x194e0e;try{_0x194e0e=await stat(_0x5d1b96);}catch(_0x281db0){throw appRuleError('app_rule_file_unreadable',_0x5a8c48(0x187)+_0xf518c,_0x281db0 instanceof Error?_0x281db0['message']:String(_0x281db0));}if(!_0x194e0e[_0x5a8c48(0x189)]())throw appRuleError(_0x5a8c48(0x18e),_0x5a8c48(0x19a)+_0xf518c);if(_0x194e0e[_0x5a8c48(0x17a)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x5a8c48(0x19f),_0x5a8c48(0x181));let _0x2927a5;try{_0x2927a5=await readFile(_0x5d1b96);}catch(_0x2f5586){throw appRuleError('app_rule_file_unreadable','Cannot\x20read\x20app\x20rule\x20file:\x20'+_0xf518c,_0x2f5586 instanceof Error?_0x2f5586['message']:String(_0x2f5586));}if(_0x2927a5['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x5a8c48(0x19f),_0x5a8c48(0x181));let _0x3105b7;try{_0x3105b7=new TextDecoder(_0x5a8c48(0x18b),{'fatal':!![],'ignoreBOM':!![]})[_0x5a8c48(0x18a)](_0x2927a5);}catch{throw appRuleError(_0x5a8c48(0x1a6),_0x5a8c48(0x1a5)+_0xf518c);}if(_0x3105b7[_0x5a8c48(0x183)]>MAX_APP_RULE_UNITS)throw appRuleError(_0x5a8c48(0x19f),_0x5a8c48(0x17f));if(!_0x3105b7[_0x5a8c48(0x193)]())throw appRuleError(_0x5a8c48(0x1a6),_0x5a8c48(0x177)+_0xf518c);return inspectAppRuleContent(_0x3105b7);}export function projectAppRule(_0x35f986,_0x1f8df4){const _0x3eaf45=a244_0x1b57f6;if(!_0x1f8df4)return{'type':_0x35f986,'fileName':appRuleFileName(_0x35f986),'contextScope':appRuleContextScope(_0x35f986),'enabled':![]};const _0xf5f65e=inspectAppRuleContent(_0x1f8df4[_0x3eaf45(0x1a1)]);return{'type':_0x35f986,'fileName':appRuleFileName(_0x35f986),'contextScope':appRuleContextScope(_0x35f986),'enabled':!![],'id':_0x1f8df4['id'],'scope':_0x1f8df4[_0x3eaf45(0x178)],'appCode':_0x1f8df4[_0x3eaf45(0x18f)],'version':_0x1f8df4[_0x3eaf45(0x175)],..._0x1f8df4[_0x3eaf45(0x186)]!==undefined?{'indexStatus':_0x1f8df4[_0x3eaf45(0x186)]}:{},'contentByteSize':_0xf5f65e[_0x3eaf45(0x190)],'contentHash':_0xf5f65e['contentHash'],..._0x1f8df4[_0x3eaf45(0x184)]!==undefined&&_0x1f8df4[_0x3eaf45(0x184)]!==null?{'createTime':_0x1f8df4[_0x3eaf45(0x184)]}:{},..._0x1f8df4[_0x3eaf45(0x188)]!==undefined&&_0x1f8df4[_0x3eaf45(0x188)]!==null?{'updateTime':_0x1f8df4[_0x3eaf45(0x188)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x1b57f6(0x1a0),'type':a244_0x1b57f6(0x19e),'required':!![],'description':a244_0x1b57f6(0x179),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x5089f2=a245_0xc42e;(function(_0x5a7332,_0x3b698a){const _0x445f87=a245_0xc42e,_0x1ec976=_0x5a7332();while(!![]){try{const _0x5cf0cb=parseInt(_0x445f87(0xeb))/0x1+-parseInt(_0x445f87(0x101))/0x2*(parseInt(_0x445f87(0xef))/0x3)+parseInt(_0x445f87(0xe7))/0x4+-parseInt(_0x445f87(0xf3))/0x5+parseInt(_0x445f87(0xee))/0x6+parseInt(_0x445f87(0xf7))/0x7+-parseInt(_0x445f87(0xf5))/0x8;if(_0x5cf0cb===_0x3b698a)break;else _0x1ec976['push'](_0x1ec976['shift']());}catch(_0x4728a7){_0x1ec976['push'](_0x1ec976['shift']());}}}(a245_0x44d0,0x1d454));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a245_0xc42e(_0x71deab,_0x1a21fc){_0x71deab=_0x71deab-0xe5;const _0x44d008=a245_0x44d0();let _0xc42e0b=_0x44d008[_0x71deab];return _0xc42e0b;}function a245_0x44d0(){const _0x41e2a3=['cwd','has','749682DXJjov','5886VtzddD','needsUpgrade','\x20exited\x20with\x20code\x20','\x20run\x20preview\x20--watch','578445PYXUuN','yarn','841184posuOa','\x20run\x20<script>\x0a','177135vHFtDy','log','parse','\x0a\x20\x20Usage:\x20','inherit','Available:\x20','\x20run\x20build','slice','Enable\x20watch\x20mode\x20for\x20preview','(none)','134hrHugr','keys','Run\x20a\x20package.json\x20script','vite\x20preview\x20exited\x20with\x20code\x20','preview','\x20run\x20start','error','\x20\x20\x20\x20','\x22\x20not\x20found\x20in\x20package.json.','write','vite','run','push','start','\x20\x20EXAMPLES','Script\x20\x22','belowMinimum','bun.lock','close','build','utf-8','No\x20scripts\x20defined\x20in\x20package.json.','boolean','package.json','yarn.lock','Domain\x20routing\x20synchronized:\x20','bun.lockb','\x0a\x20\x20Available\x20scripts:\x0a','validation','args','pnpm-lock.yaml','path','459352wAbUdo','node_modules','watch','.bin','207093aMmKtL'];a245_0x44d0=function(){return _0x41e2a3;};return a245_0x44d0();}const VERSION_CHECK_SCRIPTS=new Set([a245_0x5089f2(0x10e),'dev']),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x5089f2(0x10e),'dev',a245_0x5089f2(0x114),a245_0x5089f2(0x105)]);export function syncProjectDomainRoutingBeforeScript(_0x6cab4b,_0x2291ed){const _0x4ed5c2=a245_0x5089f2;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x4ed5c2(0xed)](_0x2291ed))return null;const _0x13b941=findProjectRootDirectory(_0x6cab4b);if(!resolveConfigPath(_0x13b941))return null;const _0x1fc121=writeProjectDomainRoutingManifest(_0x13b941);return{'path':_0x1fc121[_0x4ed5c2(0xe6)],'changed':_0x1fc121['changed']};}function readPackageScripts(_0x4aaa72){const _0x5c8bf0=a245_0x5089f2,_0x3c7380=resolve(_0x4aaa72,_0x5c8bf0(0x118));if(!existsSync(_0x3c7380))return null;try{const _0x5751e2=JSON[_0x5c8bf0(0xf9)](readFileSync(_0x3c7380,_0x5c8bf0(0x115)));return _0x5751e2['scripts']??{};}catch{return null;}}function detectPackageManager(_0x584219){const _0x3e817a=a245_0x5089f2;if(existsSync(resolve(_0x584219,_0x3e817a(0x11b)))||existsSync(resolve(_0x584219,_0x3e817a(0x112))))return'bun';if(existsSync(resolve(_0x584219,_0x3e817a(0xe5))))return'pnpm';if(existsSync(resolve(_0x584219,_0x3e817a(0x119))))return _0x3e817a(0xf4);return'npm';}async function versionCheck(_0x49dee8){const _0x572641=a245_0x5089f2,_0x46d0e1=await checkCliVersion();(_0x46d0e1[_0x572641(0xf0)]||_0x46d0e1[_0x572641(0x111)])&&(printCliUpgradeWarning(_0x46d0e1),assertCliVersionSupported(_0x46d0e1));const _0x1e4ebb=await checkSdkVersion(_0x49dee8);if(_0x1e4ebb[_0x572641(0xf0)])printSdkUpgradeWarning(_0x1e4ebb);}function spawnScript(_0x28a9e9,_0x324655,_0x27d74c,_0x1d380f){return new Promise((_0x1b65a5,_0x4b00dc)=>{const _0x2757a9=a245_0xc42e,_0x3b6c46=[_0x2757a9(0x10c),_0x324655,..._0x27d74c],_0x873589=spawn(_0x28a9e9,_0x3b6c46,{'cwd':_0x1d380f,'stdio':_0x2757a9(0xfb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1d380f,'node_modules',_0x2757a9(0xea))+delimiter+process.env.PATH}});_0x873589['on']('close',_0xfa6165=>{const _0x50b614=_0x2757a9;if(_0xfa6165===0x0||_0xfa6165===null)_0x1b65a5();else _0x4b00dc(new Error(_0x28a9e9+'\x20run\x20'+_0x324655+_0x50b614(0xf1)+_0xfa6165));}),_0x873589['on'](_0x2757a9(0x107),_0x4b00dc);});}function spawnViteBuildWatch(_0x4f3b68){return new Promise((_0x57298d,_0x4fa097)=>{const _0x891216=a245_0xc42e,_0x327767=spawn(_0x891216(0x10b),[_0x891216(0x114),'--watch'],{'cwd':_0x4f3b68,'stdio':_0x891216(0xfb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4f3b68,'node_modules',_0x891216(0xea))+delimiter+process.env.PATH}});_0x327767['on']('close',_0x579203=>{if(_0x579203===0x0||_0x579203===null)_0x57298d();else _0x4fa097(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x579203));}),_0x327767['on'](_0x891216(0x107),_0x4fa097);});}function spawnVitePreview(_0x535ce9){return new Promise((_0x29d88e,_0x1863a2)=>{const _0x4b007b=a245_0xc42e,_0x39387a=spawn(_0x4b007b(0x10b),[_0x4b007b(0x105)],{'cwd':_0x535ce9,'stdio':_0x4b007b(0xfb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x535ce9,_0x4b007b(0xe8),_0x4b007b(0xea))+delimiter+process.env.PATH}});_0x39387a['on'](_0x4b007b(0x113),_0x1b7b37=>{const _0x52c4e4=_0x4b007b;if(_0x1b7b37===0x0||_0x1b7b37===null)_0x29d88e();else _0x1863a2(new Error(_0x52c4e4(0x104)+_0x1b7b37));}),_0x39387a['on'](_0x4b007b(0x107),_0x1863a2);});}const runFlags=[{'name':'watch','type':a245_0x5089f2(0x117),'description':a245_0x5089f2(0xff),'default':![]}];export const runDefinition={'service':'run','command':a245_0x5089f2(0x10c),'description':a245_0x5089f2(0x103),'risk':a245_0x5089f2(0x10a),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3bf6bf=a245_0x5089f2,_0x435584=[];return _0x435584[_0x3bf6bf(0x10d)](_0x3bf6bf(0x10f)),_0x435584[_0x3bf6bf(0x10d)](_0x3bf6bf(0x108)+CLI_BIN_NAME+_0x3bf6bf(0x106)),_0x435584['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x3bf6bf(0xfd)),_0x435584[_0x3bf6bf(0x10d)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview'),_0x435584[_0x3bf6bf(0x10d)](_0x3bf6bf(0x108)+CLI_BIN_NAME+_0x3bf6bf(0xf2)),_0x435584['join']('\x0a');},async 'execute'(_0x2b7790){const _0x964cf3=a245_0x5089f2,_0x4dc946=process[_0x964cf3(0xec)](),_0x2eb9d3=_0x2b7790[_0x964cf3(0x11e)][0x0],_0xc276b2=_0x2b7790[_0x964cf3(0x11e)][_0x964cf3(0xfe)](0x1),_0xc19c0=readPackageScripts(_0x4dc946);if(!_0xc19c0)throw CliErrors[_0x964cf3(0x11d)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x2eb9d3){const _0x1d9f09=Object[_0x964cf3(0x102)](_0xc19c0);if(_0x1d9f09['length']===0x0)console[_0x964cf3(0xf8)](_0x964cf3(0x116));else{console[_0x964cf3(0xf8)](_0x964cf3(0x11c));for(const _0x26675 of _0x1d9f09){console[_0x964cf3(0xf8)](_0x964cf3(0x108)+_0x26675);}console['log'](_0x964cf3(0xfa)+CLI_BIN_NAME+_0x964cf3(0xf6));}return{'ok':!![]};}if(!_0xc19c0[_0x2eb9d3])throw CliErrors[_0x964cf3(0x11d)](_0x964cf3(0x110)+_0x2eb9d3+_0x964cf3(0x109),_0x964cf3(0xfc)+(Object['keys'](_0xc19c0)['join'](',\x20')||_0x964cf3(0x100)));const _0x23d82c=detectPackageManager(_0x4dc946),_0x5bf681=syncProjectDomainRoutingBeforeScript(_0x4dc946,_0x2eb9d3);_0x5bf681?.['changed']&&console[_0x964cf3(0x107)](_0x964cf3(0x11a)+_0x5bf681['path']);VERSION_CHECK_SCRIPTS[_0x964cf3(0xed)](_0x2eb9d3)&&await versionCheck(_0x4dc946);if(_0x2eb9d3==='preview'&&_0x2b7790['bool'](_0x964cf3(0xe9)))return await Promise['all']([spawnViteBuildWatch(_0x4dc946),spawnVitePreview(_0x4dc946)]),{'ok':!![]};return await spawnScript(_0x23d82c,_0x2eb9d3,_0xc276b2,_0x4dc946),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a246_0x4be8(_0x4d8274,_0x586421){_0x4d8274=_0x4d8274-0x87;const _0x2a4534=a246_0x2a45();let _0x4be8bd=_0x2a4534[_0x4d8274];return _0x4be8bd;}const a246_0x4e41d8=a246_0x4be8;(function(_0x29cf30,_0x16ca14){const _0x2629e6=a246_0x4be8,_0x4f02b8=_0x29cf30();while(!![]){try{const _0xd66559=-parseInt(_0x2629e6(0x8a))/0x1+-parseInt(_0x2629e6(0x92))/0x2*(parseInt(_0x2629e6(0x90))/0x3)+parseInt(_0x2629e6(0x88))/0x4+parseInt(_0x2629e6(0x91))/0x5+-parseInt(_0x2629e6(0x87))/0x6+-parseInt(_0x2629e6(0x8d))/0x7*(parseInt(_0x2629e6(0x8b))/0x8)+parseInt(_0x2629e6(0x8c))/0x9;if(_0xd66559===_0x16ca14)break;else _0x4f02b8['push'](_0x4f02b8['shift']());}catch(_0x4603ee){_0x4f02b8['push'](_0x4f02b8['shift']());}}}(a246_0x2a45,0x811dd));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x1b71b8){const _0x44f44c=await buildSchemaPayload();return{'ok':!![],'data':_0x44f44c};}export const schemaDefinition={'service':a246_0x4e41d8(0x8f),'command':a246_0x4e41d8(0x89),'description':a246_0x4e41d8(0x8e),'risk':a246_0x4e41d8(0x93),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};function a246_0x2a45(){const _0x5a8e81=['3994566blGxcC','3391160DuMUSe','export','442170pqGPDM','23224jQHDva','15747021HmoJKE','2373YEQrqY','Export\x20machine-readable\x20command\x20schema\x20(JSON)','schema','126624hAGwQZ','4127010WRBhRq','38VEAiRo','read'];a246_0x2a45=function(){return _0x5a8e81;};return a246_0x2a45();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a247_0xb3c8(){const _0x1696a3=['sqlRootDir','toISOString','name','new','join','length','Invalid\x20database\x20selection\x20payload:\x20','number','2169RPInJG','create','/smartapi/custom/saveUserCustomSql','flagMissing','2205SIwcpr','sqlName','stringify','validation','string','SELECT\x201\x20AS\x20id;','dbName','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','write','Select\x20the\x20local\x20SQL\x20mode:','map','trim','parse','7720AaQRrE','78168YxIRKO','185aoKnnl','sql','File\x20already\x20exists:\x20','✎\x20Enter\x20dbId\x20manually','mybatisXml','\x20\x20SELECT\x201\x20AS\x20id','9339pRZmGz','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','appCode','Target\x20database\x20ID','str','Target\x20database\x20dbId:','SQL\x20name:','23784mAUQhY','Select\x20the\x20target\x20database:','sqls','sqlCode','db-id','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sqlRoot','dbId\x20cannot\x20be\x20empty','44786HhLKPk','description','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','3277512oKDXPm','mode','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','lockFilePath','lastSync','Local\x20SQL\x20file\x20mode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','56gUklrK','SQL\x20query\x20display\x20name','catch','4780fchtkS','nonInteractive','isFinite','MyBatis\x20XML\x20(mybatisXml)','dbId','dbId\x20must\x20be\x20a\x20positive\x20integer','33169212ZvjmDF','isInteger','Plain\x20SQL\x20(sql)'];a247_0xb3c8=function(){return _0x1696a3;};return a247_0xb3c8();}const a247_0x299107=a247_0x4ab2;(function(_0x431cd6,_0x429dc4){const _0x5b9947=a247_0x4ab2,_0x457901=_0x431cd6();while(!![]){try{const _0x2706a1=-parseInt(_0x5b9947(0x133))/0x1*(-parseInt(_0x5b9947(0x129))/0x2)+parseInt(_0x5b9947(0x147))/0x3*(parseInt(_0x5b9947(0x136))/0x4)+-parseInt(_0x5b9947(0x15a))/0x5*(parseInt(_0x5b9947(0x159))/0x6)+parseInt(_0x5b9947(0x12c))/0x7+-parseInt(_0x5b9947(0x121))/0x8*(-parseInt(_0x5b9947(0x14b))/0x9)+-parseInt(_0x5b9947(0x158))/0xa*(-parseInt(_0x5b9947(0x160))/0xb)+-parseInt(_0x5b9947(0x13c))/0xc;if(_0x2706a1===_0x429dc4)break;else _0x457901['push'](_0x457901['shift']());}catch(_0x154c5a){_0x457901['push'](_0x457901['shift']());}}}(a247_0xb3c8,0xb0bad));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a247_0x4ab2(_0x13c755,_0xa90677){_0x13c755=_0x13c755-0x11f;const _0xb3c8ca=a247_0xb3c8();let _0x4ab22d=_0xb3c8ca[_0x13c755];return _0x4ab22d;}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x3f22f4){const _0x5c95bf=a247_0x4ab2;if(_0x3f22f4===_0x5c95bf(0x15e))return[_0x5c95bf(0x132),_0x5c95bf(0x15f),'</select>',''][_0x5c95bf(0x143)]('\x0a');return[_0x5c95bf(0x150),''][_0x5c95bf(0x143)]('\x0a');}export const sqlCreate={'service':a247_0x299107(0x15b),'command':a247_0x299107(0x148),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a247_0x299107(0x153),'flags':[{'name':a247_0x299107(0x141),'type':a247_0x299107(0x14f),'description':a247_0x299107(0x134)},{'name':a247_0x299107(0x125),'type':a247_0x299107(0x146),'description':a247_0x299107(0x163)},{'name':a247_0x299107(0x12d),'type':a247_0x299107(0x14f),'enum':['sql',a247_0x299107(0x15e)],'description':a247_0x299107(0x131)}],async 'validate'(_0x3298cc){const _0x110bad=a247_0x299107;if(!_0x3298cc['nonInteractive'])return;if(!_0x3298cc['str']('name')[_0x110bad(0x156)]())throw CliErrors[_0x110bad(0x14a)]('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x3fc6f1=resolveProvidedDbId(_0x3298cc);if(typeof _0x3fc6f1!==_0x110bad(0x146)||!Number[_0x110bad(0x138)](_0x3fc6f1)||_0x3fc6f1<=0x0)throw CliErrors[_0x110bad(0x14a)](_0x110bad(0x125),_0x110bad(0x12b));if(!_0x3298cc[_0x110bad(0x164)](_0x110bad(0x12d))[_0x110bad(0x156)]())throw CliErrors[_0x110bad(0x14a)](_0x110bad(0x12d),_0x110bad(0x152));},async 'dryRun'(_0xcd0db0){const _0x223f48=a247_0x299107,_0x2fd42c=loadSqlProjectConfig(_0xcd0db0[_0x223f48(0x162)]),{sqlName:_0x478b81,dbId:_0x37bd90,dbName:_0x246128,mode:_0x50024f}=await resolveSqlNewInputs(_0xcd0db0),_0x47617d=buildSqlRelativePath('<server-generated-sqlCode>',_0x478b81,_0x246128,_0x50024f,_0x37bd90),_0x4394ab=_0x2fd42c[_0x223f48(0x13f)]+'/'+_0x47617d;return{'method':'POST','url':_0x223f48(0x149),'body':{'appCode':_0xcd0db0['appCode'],'sqlName':_0x478b81,'dbId':_0x37bd90,'mode':_0x50024f,'localPath':_0x4394ab},'description':_0x223f48(0x126)+_0x2fd42c[_0x223f48(0x13f)]};},async 'execute'(_0x3ac898){const _0x5d655e=a247_0x299107,_0x5ebf09=loadSqlProjectConfig(_0x3ac898[_0x5d655e(0x162)]),{sqlName:_0x367db8,dbId:_0x3376cb,dbName:_0x1bbc56,mode:_0x582b36}=await resolveSqlNewInputs(_0x3ac898),_0x1724e9=generateSqlTemplate(_0x582b36),_0x288873=await createSqlQuery({'appCode':_0x3ac898[_0x5d655e(0x162)],'sqlName':_0x367db8,'dbId':_0x3376cb,'sqlContent':_0x1724e9}),_0x1f8431=ensureRemoteSqlContent(_0x288873),_0x37318e=_0x1bbc56||await getDbName(_0x3ac898[_0x5d655e(0x162)],_0x3376cb)[_0x5d655e(0x135)](()=>undefined),_0x1e528a=buildSqlRelativePath(_0x288873[_0x5d655e(0x124)],_0x288873['sqlName'],_0x37318e,_0x582b36,_0x3376cb),_0x39730c=_0x5ebf09['sqlRootDir']+'/'+_0x1e528a,_0x52078c=buildLocalSqlFileContent({'sqlCode':_0x288873[_0x5d655e(0x124)],'sqlName':_0x288873[_0x5d655e(0x14c)],'dbId':_0x288873[_0x5d655e(0x13a)]},_0x1f8431,{'dbName':_0x37318e,'mode':_0x582b36,'syncedAt':new Date()[_0x5d655e(0x140)](),'description':_0x288873[_0x5d655e(0x12a)]});if(await fileExists(_0x39730c))throw CliErrors['validation'](_0x5d655e(0x15c)+_0x39730c);await ensureParentDirectory(_0x39730c),await writeFile(_0x39730c,_0x52078c,'utf8');const _0x2584cd=await readSqlLockFile(_0x5ebf09[_0x5d655e(0x12f)]),{lockData:_0x574272,appLock:_0x2e99b8}=ensureSqlLockScope(_0x2584cd??createEmptySqlLock(),_0x5ebf09[_0x5d655e(0x162)],_0x5ebf09[_0x5d655e(0x127)],_0x5d655e(0x142));return _0x2e99b8[_0x5d655e(0x123)][_0x288873['sqlCode']]={...buildSqlLockEntry(_0x288873,_0x1f8431,computeSqlContentHash(_0x52078c),{'dbName':_0x37318e}),'path':_0x1e528a,'mode':_0x582b36},_0x2e99b8[_0x5d655e(0x130)]=new Date()[_0x5d655e(0x140)](),await writeSqlLockFile(_0x5ebf09[_0x5d655e(0x12f)],_0x574272),{'ok':!![],'data':{'id':_0x288873['id'],'sqlCode':_0x288873[_0x5d655e(0x124)],'sqlName':_0x288873[_0x5d655e(0x14c)],'dbId':_0x288873[_0x5d655e(0x13a)],'path':_0x39730c,'mode':_0x582b36},'message':'Created\x20SQL\x20query\x20'+_0x288873[_0x5d655e(0x124)]};}};async function resolveSqlNewInputs(_0x395d85){const _0x5d8946=await resolveSqlNameInput(_0x395d85),{dbId:_0x1f9832,dbName:_0x4f45c6}=await resolveDbSelection(_0x395d85),_0x306549=await resolveSqlModeInput(_0x395d85);return{'sqlName':_0x5d8946,'dbId':_0x1f9832,'dbName':_0x4f45c6,'mode':_0x306549};}async function resolveSqlNameInput(_0x122198){const _0x208fce=a247_0x299107,_0x2340b4=_0x122198[_0x208fce(0x164)]('name')[_0x208fce(0x156)]();if(_0x2340b4)return _0x2340b4;if(_0x122198[_0x208fce(0x137)])throw CliErrors['flagMissing'](_0x208fce(0x141),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x208fce(0x120),'validate':_0xe4198f=>_0xe4198f[_0x208fce(0x156)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x208fce(0x156)]();}async function resolveDbSelection(_0x370113){const _0x22e417=a247_0x299107,_0x17b49a=resolveProvidedDbId(_0x370113);if(typeof _0x17b49a===_0x22e417(0x146)&&Number['isFinite'](_0x17b49a)&&_0x17b49a>0x0)return{'dbId':_0x17b49a,'dbName':await getDbName(_0x370113[_0x22e417(0x162)],_0x17b49a)[_0x22e417(0x135)](()=>undefined)};if(_0x370113[_0x22e417(0x137)])throw CliErrors[_0x22e417(0x14a)](_0x22e417(0x125),_0x22e417(0x12b));const _0x50fe5d=await listDatabases(_0x370113['appCode'])[_0x22e417(0x135)](()=>[]);if(_0x50fe5d['length']===0x1)return{'dbId':_0x50fe5d[0x0]['dbId'],'dbName':_0x50fe5d[0x0][_0x22e417(0x151)]};if(_0x50fe5d[_0x22e417(0x144)]>0x1){const _0x2a84a3=await select({'message':_0x22e417(0x122),'choices':[..._0x50fe5d[_0x22e417(0x155)](_0x294ddb=>({'name':_0x294ddb[_0x22e417(0x151)]+'\x20('+_0x294ddb['dbId']+')','value':serializeDbSelection(_0x294ddb)})),{'name':_0x22e417(0x15d),'value':'__manual__'}]});if(_0x2a84a3!=='__manual__')return deserializeDbSelection(_0x2a84a3);}const _0x1249d2=await input({'message':_0x22e417(0x11f),'validate':_0x4969c9=>{const _0x4278ed=_0x22e417,_0x12dac8=_0x4969c9[_0x4278ed(0x156)]();if(!_0x12dac8)return _0x4278ed(0x128);const _0x3a280b=Number(_0x12dac8);if(!Number[_0x4278ed(0x13d)](_0x3a280b)||_0x3a280b<=0x0)return _0x4278ed(0x13b);return!![];}});return{'dbId':Number(_0x1249d2[_0x22e417(0x156)]())};}async function resolveSqlModeInput(_0x1f4d1b){const _0x554525=a247_0x299107,_0x2e3d2a=_0x1f4d1b['str'](_0x554525(0x12d))['trim']();if(_0x2e3d2a===_0x554525(0x15b)||_0x2e3d2a==='mybatisXml')return _0x2e3d2a;if(_0x1f4d1b[_0x554525(0x137)])throw CliErrors['flagMissing']('mode',_0x554525(0x152));return await select({'message':_0x554525(0x154),'choices':[{'name':_0x554525(0x13e),'value':_0x554525(0x15b),'description':_0x554525(0x12e)},{'name':_0x554525(0x139),'value':'mybatisXml','description':_0x554525(0x161)}]});}function serializeDbSelection(_0x560e8f){const _0x1d0175=a247_0x299107;return JSON[_0x1d0175(0x14d)]({'dbId':_0x560e8f['dbId'],'dbName':_0x560e8f['dbName']});}function deserializeDbSelection(_0x143d8c){const _0x56bb69=a247_0x299107;try{const _0x3f5549=JSON[_0x56bb69(0x157)](_0x143d8c);if(typeof _0x3f5549[_0x56bb69(0x13a)]==='number'&&Number[_0x56bb69(0x138)](_0x3f5549['dbId']))return{'dbId':_0x3f5549[_0x56bb69(0x13a)],'dbName':_0x3f5549[_0x56bb69(0x151)]};}catch{}throw CliErrors[_0x56bb69(0x14e)](_0x56bb69(0x145)+_0x143d8c);}function resolveProvidedDbId(_0x3fa3c9){const _0x284a13=a247_0x299107,_0x48ce34=_0x3fa3c9['flag'](_0x284a13(0x125));if(typeof _0x48ce34==='number'&&Number[_0x284a13(0x138)](_0x48ce34))return _0x48ce34;return undefined;}
|
|
1
|
+
const a247_0x23c4da=a247_0x131c;(function(_0x45951c,_0x3fd2b0){const _0x30cd9b=a247_0x131c,_0x3e8eeb=_0x45951c();while(!![]){try{const _0x1014a3=parseInt(_0x30cd9b(0x138))/0x1*(parseInt(_0x30cd9b(0x13d))/0x2)+parseInt(_0x30cd9b(0x117))/0x3*(-parseInt(_0x30cd9b(0x135))/0x4)+parseInt(_0x30cd9b(0x11b))/0x5*(parseInt(_0x30cd9b(0x13f))/0x6)+-parseInt(_0x30cd9b(0x144))/0x7*(-parseInt(_0x30cd9b(0x111))/0x8)+parseInt(_0x30cd9b(0x10a))/0x9+parseInt(_0x30cd9b(0x13a))/0xa*(-parseInt(_0x30cd9b(0x118))/0xb)+-parseInt(_0x30cd9b(0x145))/0xc;if(_0x1014a3===_0x3fd2b0)break;else _0x3e8eeb['push'](_0x3e8eeb['shift']());}catch(_0x3e1f33){_0x3e8eeb['push'](_0x3e8eeb['shift']());}}}(a247_0x5a08,0xb0751));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x49ea50){const _0x218c05=a247_0x131c;if(_0x49ea50===_0x218c05(0x119))return[_0x218c05(0x114),_0x218c05(0x123),_0x218c05(0x12e),'']['join']('\x0a');return[_0x218c05(0x132),''][_0x218c05(0x11d)]('\x0a');}export const sqlCreate={'service':'sql','command':a247_0x23c4da(0x112),'description':a247_0x23c4da(0x140),'risk':a247_0x23c4da(0x130),'flags':[{'name':a247_0x23c4da(0x116),'type':'string','description':a247_0x23c4da(0x139)},{'name':a247_0x23c4da(0x124),'type':a247_0x23c4da(0x12c),'description':a247_0x23c4da(0x11e)},{'name':a247_0x23c4da(0x13e),'type':a247_0x23c4da(0x12b),'enum':[a247_0x23c4da(0x129),a247_0x23c4da(0x119)],'description':a247_0x23c4da(0x133)}],async 'validate'(_0x139bd6){const _0x4fab1f=a247_0x23c4da;if(!_0x139bd6['nonInteractive'])return;if(!_0x139bd6[_0x4fab1f(0x125)](_0x4fab1f(0x116))[_0x4fab1f(0x110)]())throw CliErrors[_0x4fab1f(0x136)](_0x4fab1f(0x116),_0x4fab1f(0x10e));const _0x3a03f1=resolveProvidedDbId(_0x139bd6);if(typeof _0x3a03f1!==_0x4fab1f(0x12c)||!Number['isFinite'](_0x3a03f1)||_0x3a03f1<=0x0)throw CliErrors[_0x4fab1f(0x136)]('db-id',_0x4fab1f(0x104));if(!_0x139bd6[_0x4fab1f(0x125)]('mode')[_0x4fab1f(0x110)]())throw CliErrors['flagMissing'](_0x4fab1f(0x13e),_0x4fab1f(0x11c));},async 'dryRun'(_0x5d3141){const _0x55df21=a247_0x23c4da,_0x4548d5=loadSqlProjectConfig(_0x5d3141[_0x55df21(0x10d)]),{sqlName:_0x142375,dbId:_0x55fd78,dbName:_0x43388f,mode:_0x9e20c0}=await resolveSqlNewInputs(_0x5d3141),_0x320e4f=buildSqlRelativePath(_0x55df21(0x10b),_0x142375,_0x43388f,_0x9e20c0,_0x55fd78),_0x45a4bf=_0x4548d5[_0x55df21(0x128)]+'/'+_0x320e4f;return{'method':'POST','url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x5d3141[_0x55df21(0x10d)],'sqlName':_0x142375,'dbId':_0x55fd78,'mode':_0x9e20c0,'localPath':_0x45a4bf},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x4548d5[_0x55df21(0x128)]};},async 'execute'(_0x3be550){const _0x2b1d01=a247_0x23c4da,_0x6521a1=loadSqlProjectConfig(_0x3be550['appCode']),{sqlName:_0x344e92,dbId:_0x428044,dbName:_0x44b5d6,mode:_0x57e938}=await resolveSqlNewInputs(_0x3be550),_0x5061cd=generateSqlTemplate(_0x57e938),_0x116118=await createSqlQuery({'appCode':_0x3be550[_0x2b1d01(0x10d)],'sqlName':_0x344e92,'dbId':_0x428044,'sqlContent':_0x5061cd}),_0x4d1149=ensureRemoteSqlContent(_0x116118),_0x256fa8=_0x44b5d6||await getDbName(_0x3be550[_0x2b1d01(0x10d)],_0x428044)[_0x2b1d01(0x10f)](()=>undefined),_0x5adc09=buildSqlRelativePath(_0x116118[_0x2b1d01(0x127)],_0x116118[_0x2b1d01(0x148)],_0x256fa8,_0x57e938,_0x428044),_0x4133ef=_0x6521a1[_0x2b1d01(0x128)]+'/'+_0x5adc09,_0x41f928=buildLocalSqlFileContent({'sqlCode':_0x116118[_0x2b1d01(0x127)],'sqlName':_0x116118['sqlName'],'dbId':_0x116118[_0x2b1d01(0x13c)]},_0x4d1149,{'dbName':_0x256fa8,'mode':_0x57e938,'syncedAt':new Date()[_0x2b1d01(0x147)](),'description':_0x116118[_0x2b1d01(0x137)]});if(await fileExists(_0x4133ef))throw CliErrors['validation'](_0x2b1d01(0x134)+_0x4133ef);await ensureParentDirectory(_0x4133ef),await writeFile(_0x4133ef,_0x41f928,_0x2b1d01(0x146));const _0x8ae610=await readSqlLockFile(_0x6521a1['lockFilePath']),{lockData:_0x363255,appLock:_0x4b74b0}=ensureSqlLockScope(_0x8ae610??createEmptySqlLock(),_0x6521a1[_0x2b1d01(0x10d)],_0x6521a1[_0x2b1d01(0x126)],'new');return _0x4b74b0['sqls'][_0x116118[_0x2b1d01(0x127)]]={...buildSqlLockEntry(_0x116118,_0x4d1149,computeSqlContentHash(_0x41f928),{'dbName':_0x256fa8}),'path':_0x5adc09,'mode':_0x57e938},_0x4b74b0[_0x2b1d01(0x12f)]=new Date()[_0x2b1d01(0x147)](),await writeSqlLockFile(_0x6521a1['lockFilePath'],_0x363255),{'ok':!![],'data':{'id':_0x116118['id'],'sqlCode':_0x116118[_0x2b1d01(0x127)],'sqlName':_0x116118[_0x2b1d01(0x148)],'dbId':_0x116118[_0x2b1d01(0x13c)],'path':_0x4133ef,'mode':_0x57e938},'message':_0x2b1d01(0x141)+_0x116118['sqlCode']};}};async function resolveSqlNewInputs(_0x16d84e){const _0x53d57c=await resolveSqlNameInput(_0x16d84e),{dbId:_0x2ba84f,dbName:_0x3bb57d}=await resolveDbSelection(_0x16d84e),_0x233651=await resolveSqlModeInput(_0x16d84e);return{'sqlName':_0x53d57c,'dbId':_0x2ba84f,'dbName':_0x3bb57d,'mode':_0x233651};}async function resolveSqlNameInput(_0x319460){const _0x504b92=a247_0x23c4da,_0x2be16f=_0x319460['str']('name')[_0x504b92(0x110)]();if(_0x2be16f)return _0x2be16f;if(_0x319460[_0x504b92(0x108)])throw CliErrors[_0x504b92(0x136)](_0x504b92(0x116),_0x504b92(0x10e));return(await input({'message':'SQL\x20name:','validate':_0x35f0b7=>_0x35f0b7[_0x504b92(0x110)]()?!![]:_0x504b92(0x13b)}))['trim']();}async function resolveDbSelection(_0x55d6e9){const _0x3666a4=a247_0x23c4da,_0x1ce638=resolveProvidedDbId(_0x55d6e9);if(typeof _0x1ce638===_0x3666a4(0x12c)&&Number['isFinite'](_0x1ce638)&&_0x1ce638>0x0)return{'dbId':_0x1ce638,'dbName':await getDbName(_0x55d6e9[_0x3666a4(0x10d)],_0x1ce638)[_0x3666a4(0x10f)](()=>undefined)};if(_0x55d6e9['nonInteractive'])throw CliErrors[_0x3666a4(0x136)]('db-id',_0x3666a4(0x104));const _0x140cef=await listDatabases(_0x55d6e9[_0x3666a4(0x10d)])[_0x3666a4(0x10f)](()=>[]);if(_0x140cef[_0x3666a4(0x113)]===0x1)return{'dbId':_0x140cef[0x0][_0x3666a4(0x13c)],'dbName':_0x140cef[0x0]['dbName']};if(_0x140cef[_0x3666a4(0x113)]>0x1){const _0xe234e6=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x140cef[_0x3666a4(0x143)](_0x3ba4f6=>({'name':_0x3ba4f6[_0x3666a4(0x122)]+'\x20('+_0x3ba4f6[_0x3666a4(0x13c)]+')','value':serializeDbSelection(_0x3ba4f6)})),{'name':_0x3666a4(0x11f),'value':_0x3666a4(0x120)}]});if(_0xe234e6!==_0x3666a4(0x120))return deserializeDbSelection(_0xe234e6);}const _0x106920=await input({'message':_0x3666a4(0x115),'validate':_0x44dd2c=>{const _0x3d5687=_0x3666a4,_0x535266=_0x44dd2c[_0x3d5687(0x110)]();if(!_0x535266)return _0x3d5687(0x10c);const _0x400813=Number(_0x535266);if(!Number['isInteger'](_0x400813)||_0x400813<=0x0)return _0x3d5687(0x107);return!![];}});return{'dbId':Number(_0x106920[_0x3666a4(0x110)]())};}function a247_0x5a08(){const _0x238697=['write','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','SELECT\x201\x20AS\x20id;','Local\x20SQL\x20file\x20mode','File\x20already\x20exists:\x20','1316kYtKQo','flagMissing','description','1DsBgHO','SQL\x20query\x20display\x20name','310rxUlUr','SQL\x20name\x20cannot\x20be\x20empty','dbId','1422134sjKRwE','mode','2709318ZdOIeb','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Created\x20SQL\x20query\x20','MyBatis\x20XML\x20(mybatisXml)','map','193655ErZZQN','20523996TsbQCk','utf8','toISOString','sqlName','parse','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','flag','Select\x20the\x20local\x20SQL\x20mode:','dbId\x20must\x20be\x20a\x20positive\x20integer','nonInteractive','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','9729495gzcIhL','<server-generated-sqlCode>','dbId\x20cannot\x20be\x20empty','appCode','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','catch','trim','152HTyIWm','create','length','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Target\x20database\x20dbId:','name','1260nYXjLh','70268mdaUzj','mybatisXml','Plain\x20SQL\x20(sql)','5WTnOKJ','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','join','Target\x20database\x20ID','✎\x20Enter\x20dbId\x20manually','__manual__','isFinite','dbName','\x20\x20SELECT\x201\x20AS\x20id','db-id','str','sqlRoot','sqlCode','sqlRootDir','sql','stringify','string','number','Invalid\x20database\x20selection\x20payload:\x20','</select>','lastSync'];a247_0x5a08=function(){return _0x238697;};return a247_0x5a08();}async function resolveSqlModeInput(_0x118ef4){const _0x3fdefd=a247_0x23c4da,_0x5d61e5=_0x118ef4[_0x3fdefd(0x125)]('mode')['trim']();if(_0x5d61e5==='sql'||_0x5d61e5===_0x3fdefd(0x119))return _0x5d61e5;if(_0x118ef4[_0x3fdefd(0x108)])throw CliErrors[_0x3fdefd(0x136)]('mode',_0x3fdefd(0x11c));return await select({'message':_0x3fdefd(0x106),'choices':[{'name':_0x3fdefd(0x11a),'value':_0x3fdefd(0x129),'description':_0x3fdefd(0x109)},{'name':_0x3fdefd(0x142),'value':'mybatisXml','description':_0x3fdefd(0x131)}]});}function serializeDbSelection(_0x3fec29){const _0x55833a=a247_0x23c4da;return JSON[_0x55833a(0x12a)]({'dbId':_0x3fec29['dbId'],'dbName':_0x3fec29['dbName']});}function deserializeDbSelection(_0x373d81){const _0xb2a11=a247_0x23c4da;try{const _0x5cc218=JSON[_0xb2a11(0x103)](_0x373d81);if(typeof _0x5cc218[_0xb2a11(0x13c)]===_0xb2a11(0x12c)&&Number[_0xb2a11(0x121)](_0x5cc218[_0xb2a11(0x13c)]))return{'dbId':_0x5cc218['dbId'],'dbName':_0x5cc218[_0xb2a11(0x122)]};}catch{}throw CliErrors['validation'](_0xb2a11(0x12d)+_0x373d81);}function a247_0x131c(_0x5a5b36,_0x5e5000){_0x5a5b36=_0x5a5b36-0x103;const _0x5a08ec=a247_0x5a08();let _0x131c46=_0x5a08ec[_0x5a5b36];return _0x131c46;}function resolveProvidedDbId(_0x5aee3b){const _0x5d90c0=a247_0x23c4da,_0x126a5b=_0x5aee3b[_0x5d90c0(0x105)](_0x5d90c0(0x124));if(typeof _0x126a5b==='number'&&Number[_0x5d90c0(0x121)](_0x126a5b))return _0x126a5b;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x49093f=a248_0x1526;function a248_0x1526(_0x1924bf,_0x5588ca){_0x1924bf=_0x1924bf-0x18d;const _0x3ac6b7=a248_0x3ac6();let _0x152678=_0x3ac6b7[_0x1924bf];return _0x152678;}(function(_0x168900,_0x4f353d){const _0x315d77=a248_0x1526,_0x3f641f=_0x168900();while(!![]){try{const _0x27e2e2=-parseInt(_0x315d77(0x196))/0x1+parseInt(_0x315d77(0x1a7))/0x2*(-parseInt(_0x315d77(0x19d))/0x3)+-parseInt(_0x315d77(0x1b2))/0x4+parseInt(_0x315d77(0x198))/0x5*(parseInt(_0x315d77(0x191))/0x6)+-parseInt(_0x315d77(0x1a3))/0x7*(-parseInt(_0x315d77(0x1ad))/0x8)+parseInt(_0x315d77(0x194))/0x9+-parseInt(_0x315d77(0x19b))/0xa*(-parseInt(_0x315d77(0x18e))/0xb);if(_0x27e2e2===_0x4f353d)break;else _0x3f641f['push'](_0x3f641f['shift']());}catch(_0x16cea7){_0x3f641f['push'](_0x3f641f['shift']());}}}(a248_0x3ac6,0x7939d));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';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x3ac6(){const _0x17a70a=['7kmTOME','POST','fromEntries','remoteId','34xDAHBK','Would\x20delete\x20SQL\x20','delete','projectRoot','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','filter','3141592hRYbnm','toISOString','sqlRootDir','sqlRoot','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','3557404rNfIZf','trashDir','898502Xsjyoj','replace','sqlcode','41052aNttke','length','validation','8078229HlIiqh','lastSync','374171crddaa','appCode','685qLThmF','entries','high-risk-write','10bEuUdD','sqls','96927RrJhHi','/smartapi/custom/deleteUserCustomSql','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','str','lockFilePath','startsWith'];a248_0x3ac6=function(){return _0x17a70a;};return a248_0x3ac6();}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':'delete','description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a248_0x49093f(0x19a),'flags':[SQLCODE_FLAG],async 'validate'(_0x6ff45f){const _0x3b7ede=a248_0x49093f,_0x3cdeec=loadSqlProjectConfig(_0x6ff45f[_0x3b7ede(0x197)]),_0x3ae53d=await readSqlLockFile(_0x3cdeec[_0x3b7ede(0x1a1)]);if(!_0x3ae53d)throw CliErrors[_0x3b7ede(0x193)](_0x3b7ede(0x1ab));},async 'dryRun'(_0x167249){const _0x4d3f87=a248_0x49093f,_0x4a62ca=loadSqlProjectConfig(_0x167249[_0x4d3f87(0x197)]),_0x2b371f=await readSqlLockFile(_0x4a62ca['lockFilePath']);if(!_0x2b371f)throw CliErrors[_0x4d3f87(0x193)](_0x4d3f87(0x1ab));const {appLock:_0x1ca0be}=ensureSqlLockScope(_0x2b371f,_0x167249[_0x4d3f87(0x197)],_0x4a62ca[_0x4d3f87(0x1b0)],_0x4d3f87(0x1a9)),_0x3bca78=_0x167249[_0x4d3f87(0x1a0)](_0x4d3f87(0x190)),_0x505bae=_0x1ca0be[_0x4d3f87(0x19c)][_0x3bca78];if(!_0x505bae)throw CliErrors[_0x4d3f87(0x193)](_0x4d3f87(0x1b1)+_0x3bca78+'\x22.');return{'method':_0x4d3f87(0x1a4),'url':_0x4d3f87(0x19e),'body':{'sqlCode':_0x3bca78,'id':_0x505bae[_0x4d3f87(0x1a6)],'localPath':resolveLocalSqlFilePath(_0x4a62ca,_0x3bca78,_0x505bae)},'description':_0x4d3f87(0x1a8)+_0x3bca78+_0x4d3f87(0x19f)+_0x4a62ca[_0x4d3f87(0x18d)]};},async 'execute'(_0x3d6eeb){const _0x2a19cc=a248_0x49093f,_0x5c38a7=loadSqlProjectConfig(_0x3d6eeb[_0x2a19cc(0x197)]),_0xb3042=await readSqlLockFile(_0x5c38a7[_0x2a19cc(0x1a1)]);if(!_0xb3042)throw CliErrors[_0x2a19cc(0x193)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x1b3a11,appLock:_0x2ee96d}=ensureSqlLockScope(_0xb3042,_0x3d6eeb[_0x2a19cc(0x197)],_0x5c38a7[_0x2a19cc(0x1b0)],'delete'),_0x44b4eb=_0x3d6eeb[_0x2a19cc(0x1a0)]('sqlcode'),_0x1ee187=_0x2ee96d[_0x2a19cc(0x19c)][_0x44b4eb];if(!_0x1ee187)throw CliErrors[_0x2a19cc(0x193)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x44b4eb+'\x22.');await deleteSqlQuery({'id':_0x1ee187[_0x2a19cc(0x1a6)],'sqlCode':_0x44b4eb}),_0x2ee96d['sqls']=Object[_0x2a19cc(0x1a5)](Object[_0x2a19cc(0x199)](_0x2ee96d[_0x2a19cc(0x19c)])[_0x2a19cc(0x1ac)](([_0x16af45])=>_0x16af45!==_0x44b4eb)),_0x2ee96d[_0x2a19cc(0x195)]=new Date()[_0x2a19cc(0x1ae)](),await writeSqlLockFile(_0x5c38a7[_0x2a19cc(0x1a1)],_0x1b3a11);const _0x504579=resolveLocalSqlFilePath(_0x5c38a7,_0x44b4eb,_0x1ee187);let _0x573e92;await fileExists(_0x504579)&&(_0x573e92=await moveToTrash(_0x5c38a7[_0x2a19cc(0x1aa)],_0x5c38a7[_0x2a19cc(0x18d)],_0x504579),await cleanupEmptyDirectories(dirname(_0x504579),_0x5c38a7[_0x2a19cc(0x1af)]));const _0x1d3982={'deleted':_0x44b4eb,'remoteId':_0x1ee187['remoteId']};if(_0x573e92)_0x1d3982['trashedTo']=_0x573e92;return{'ok':!![],'data':_0x1d3982,'message':'Deleted\x20'+_0x44b4eb+(_0x573e92?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x1ac90d,_0x1362cd,_0x25a63b){const _0x38d230=a248_0x49093f,_0x4fbb41=new Date()['toISOString']()[_0x38d230(0x18f)](/[:.]/g,'-'),_0x53d275=relative(_0x1ac90d,_0x25a63b),_0x36e69d=join(_0x1362cd,_0x4fbb41,_0x53d275);return await mkdir(dirname(_0x36e69d),{'recursive':!![]}),await rename(_0x25a63b,_0x36e69d),_0x36e69d;}async function cleanupEmptyDirectories(_0x42168c,_0x230a4b){const _0x37a56c=a248_0x49093f;let _0x399687=resolve(_0x42168c);const _0x2dcd8c=resolve(_0x230a4b);while(_0x399687[_0x37a56c(0x1a2)](''+_0x2dcd8c+sep)||_0x399687===_0x2dcd8c){if(_0x399687===_0x2dcd8c)return;try{const _0x422504=await readdir(_0x399687);if(_0x422504[_0x37a56c(0x192)]>0x0)return;await rmdir(_0x399687);}catch{return;}_0x399687=dirname(_0x399687);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a249_0x51e0(_0xd4ef64,_0x47a89c){_0xd4ef64=_0xd4ef64-0x8c;const _0x24c7e9=a249_0x24c7();let _0x51e03f=_0x24c7e9[_0xd4ef64];return _0x51e03f;}const a249_0x157550=a249_0x51e0;(function(_0x4b940b,_0x117e51){const _0x451d64=a249_0x51e0,_0x41a2d1=_0x4b940b();while(!![]){try{const _0x3c169b=-parseInt(_0x451d64(0x91))/0x1+-parseInt(_0x451d64(0x9c))/0x2*(parseInt(_0x451d64(0x9b))/0x3)+parseInt(_0x451d64(0x93))/0x4+parseInt(_0x451d64(0x95))/0x5+parseInt(_0x451d64(0x8f))/0x6+-parseInt(_0x451d64(0x9e))/0x7+parseInt(_0x451d64(0x8c))/0x8;if(_0x3c169b===_0x117e51)break;else _0x41a2d1['push'](_0x41a2d1['shift']());}catch(_0x1b6030){_0x41a2d1['push'](_0x41a2d1['shift']());}}}(a249_0x24c7,0xab3c8));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a249_0x24c7(){const _0xf04ba0=['boolean','1085208WFttLV','detail','125499GvEbdw','description','5014008SefNKG','Return\x20full\x20raw\x20SQL\x20query\x20object','6035265CpjQmT','sqlContent','dbId','verbose','sql','str','6pPXbAf','965778NeBnFk','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','6328371ChzJJS','bool','sqlcode','442328uTzCcR','read'];a249_0x24c7=function(){return _0xf04ba0;};return a249_0x24c7();}export const sqlDetail={'service':a249_0x157550(0x99),'command':a249_0x157550(0x90),'description':a249_0x157550(0x9d),'risk':a249_0x157550(0x8d),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a249_0x157550(0x8e),'description':a249_0x157550(0x94)}],async 'execute'(_0x5857c9){const _0x10da92=a249_0x157550,_0x24adc8=await getSqlQueryInfo(_0x5857c9['appCode'],_0x5857c9[_0x10da92(0x9a)](_0x10da92(0xa0))),_0x4c53b4=_0x5857c9[_0x10da92(0x9f)](_0x10da92(0x98));if(_0x4c53b4)return{'ok':!![],'data':_0x24adc8};const _0x38f322=_0x24adc8[_0x10da92(0x97)]?await getDbName(_0x5857c9['appCode'],_0x24adc8[_0x10da92(0x97)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x24adc8['sqlCode'],'sqlName':_0x24adc8['sqlName'],'db':_0x38f322?_0x38f322+'\x20('+_0x24adc8[_0x10da92(0x97)]+')':_0x24adc8[_0x10da92(0x97)]??'','description':_0x24adc8[_0x10da92(0x92)]??'','sqlContent':_0x24adc8[_0x10da92(0x96)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x59f96f=a250_0x6606;(function(_0x3c4996,_0x375460){const _0x5f5bb0=a250_0x6606,_0x5047a5=_0x3c4996();while(!![]){try{const _0x59de48=-parseInt(_0x5f5bb0(0x1a1))/0x1+parseInt(_0x5f5bb0(0x1a5))/0x2+parseInt(_0x5f5bb0(0x1ab))/0x3+parseInt(_0x5f5bb0(0x1a0))/0x4*(-parseInt(_0x5f5bb0(0x19f))/0x5)+parseInt(_0x5f5bb0(0x1a8))/0x6+-parseInt(_0x5f5bb0(0x19e))/0x7+parseInt(_0x5f5bb0(0x19c))/0x8;if(_0x59de48===_0x375460)break;else _0x5047a5['push'](_0x5047a5['shift']());}catch(_0x355a5d){_0x5047a5['push'](_0x5047a5['shift']());}}}(a250_0x2445,0xb32a1));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a250_0x6606(_0x1a9ff5,_0x14b3af){_0x1a9ff5=_0x1a9ff5-0x198;const _0x2445e1=a250_0x2445();let _0x660652=_0x2445e1[_0x1a9ff5];return _0x660652;}function a250_0x2445(){const _0x4d0073=['935936IPcTwu','execSuccess','length','3613320yhmidu','execResult','read','3389100NwsnrD','appCode','SQL\x20execution\x20failed','exec','Returned\x20','sqlcode','\x20row(s)\x20in\x20','6626304SHmWmq','sql','463540ogrUAG','115mDhfGD','205720JLZRUo','1045209DbnPBK','str','now','params'];a250_0x2445=function(){return _0x4d0073;};return a250_0x2445();}export const sqlExec={'service':a250_0x59f96f(0x19d),'command':a250_0x59f96f(0x198),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a250_0x59f96f(0x1aa),'flags':[SQLCODE_FLAG,{'name':a250_0x59f96f(0x1a4),'type':'string','description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x5dde47){const _0x3ca454=a250_0x59f96f,_0x2aaaf1=parseJsonParams(_0x5dde47['str'](_0x3ca454(0x1a4))),_0x2fec10=Date['now'](),_0x23f244=await executeSql(_0x5dde47[_0x3ca454(0x1ac)],_0x5dde47[_0x3ca454(0x1a2)](_0x3ca454(0x19a)),_0x2aaaf1),_0x54d731=Date[_0x3ca454(0x1a3)]()-_0x2fec10,_0x1b140e=_0x23f244?.[_0x3ca454(0x1a9)]??_0x23f244,_0xbeb177=_0x23f244?.[_0x3ca454(0x1a6)]??!![];if(!_0xbeb177)return{'ok':![],'data':{'error':_0x23f244?.['execError']||_0x3ca454(0x1ad),'elapsed':_0x54d731},'message':'SQL\x20execution\x20failed'};const _0x400de6=Array['isArray'](_0x1b140e)?_0x1b140e:[];return{'ok':!![],'data':{'rows':_0x400de6,'rowCount':_0x400de6[_0x3ca454(0x1a7)],'elapsed':_0x54d731},'message':_0x3ca454(0x199)+_0x400de6[_0x3ca454(0x1a7)]+_0x3ca454(0x19b)+_0x54d731+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x30ce2e,_0x5bf229){const _0x1eae30=a251_0xff78,_0x2b4c4d=_0x30ce2e();while(!![]){try{const _0x1b28fb=parseInt(_0x1eae30(0x19c))/0x1*(parseInt(_0x1eae30(0x195))/0x2)+-parseInt(_0x1eae30(0x196))/0x3+-parseInt(_0x1eae30(0x197))/0x4+parseInt(_0x1eae30(0x19a))/0x5*(-parseInt(_0x1eae30(0x19b))/0x6)+-parseInt(_0x1eae30(0x199))/0x7*(parseInt(_0x1eae30(0x194))/0x8)+parseInt(_0x1eae30(0x193))/0x9+parseInt(_0x1eae30(0x198))/0xa;if(_0x1b28fb===_0x5bf229)break;else _0x2b4c4d['push'](_0x2b4c4d['shift']());}catch(_0x2c1125){_0x2b4c4d['push'](_0x2b4c4d['shift']());}}}(a251_0x543a,0x5a4b1));import{sqlList}from'../../commands/sql/list.js';function a251_0xff78(_0x16d99f,_0x59db94){_0x16d99f=_0x16d99f-0x193;const _0x543a45=a251_0x543a();let _0xff782a=_0x543a45[_0x16d99f];return _0xff782a;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a251_0x543a(){const _0x28823a=['1490eXzCnV','272430hlwrYi','142792UbEImo','5000930oeGtOF','77pEQiHs','10gOHNdn','1681368Adyaji','916oXtKrw','670329RZTiwp','145592WlCisc'];a251_0x543a=function(){return _0x28823a;};return a251_0x543a();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a252_0x2cb769=a252_0xc893;function a252_0x2516(){const _0x57ec6f=['1457198yLJIjI','map','21ERCvRu','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','Page\x20size','appCode','length','sqlName','3512331ulewIR','boolean','tableData','paging','sqlCode','pagesize','read','Page\x20number','9069168GhkHJs','618087eegGFb','name','number','str','num','30ApsNQO','273uEMJRa','Filter\x20by\x20SQL\x20name','1601870LIXAKQ','bool','dbId','\x20SQL\x20queries\x20(total:\x20','verbose','all','135570juEKPT','sqlcode','list','page','464652rsfdst'];a252_0x2516=function(){return _0x57ec6f;};return a252_0x2516();}(function(_0x48b951,_0x383768){const _0x33a7b0=a252_0xc893,_0x2fbcf3=_0x48b951();while(!![]){try{const _0x3344fb=-parseInt(_0x33a7b0(0x136))/0x1+-parseInt(_0x33a7b0(0x125))/0x2+parseInt(_0x33a7b0(0x127))/0x3*(parseInt(_0x33a7b0(0x124))/0x4)+-parseInt(_0x33a7b0(0x13e))/0x5+parseInt(_0x33a7b0(0x144))/0x6*(-parseInt(_0x33a7b0(0x13c))/0x7)+parseInt(_0x33a7b0(0x135))/0x8+parseInt(_0x33a7b0(0x12d))/0x9*(parseInt(_0x33a7b0(0x13b))/0xa);if(_0x3344fb===_0x383768)break;else _0x2fbcf3['push'](_0x2fbcf3['shift']());}catch(_0x544b61){_0x2fbcf3['push'](_0x2fbcf3['shift']());}}}(a252_0x2516,0x8afd3));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a252_0xc893(_0x350b88,_0x5513d3){_0x350b88=_0x350b88-0x121;const _0x2516e5=a252_0x2516();let _0xc89392=_0x2516e5[_0x350b88];return _0xc89392;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a252_0x2cb769(0x122),'description':'List\x20custom\x20SQL\x20queries','risk':a252_0x2cb769(0x133),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x2cb769(0x137),'type':'string','description':a252_0x2cb769(0x13d)},{'name':a252_0x2cb769(0x123),'type':'number','description':a252_0x2cb769(0x134),'default':0x1},{'name':a252_0x2cb769(0x132),'type':a252_0x2cb769(0x138),'description':a252_0x2cb769(0x129)},{'name':a252_0x2cb769(0x142),'type':a252_0x2cb769(0x12e),'description':a252_0x2cb769(0x128)}],async 'execute'(_0x358fdb){const _0x5c9e2d=a252_0x2cb769,_0x1b6ba4=await listSqlQueries(_0x358fdb['appCode'],{'sqlCode':_0x358fdb['str'](_0x5c9e2d(0x121))||undefined,'sqlName':_0x358fdb[_0x5c9e2d(0x139)](_0x5c9e2d(0x137))||undefined,'currentPage':_0x358fdb[_0x5c9e2d(0x13a)]('page'),'pageSize':_0x358fdb['num'](_0x5c9e2d(0x132),0x32)}),_0x2b3539=_0x358fdb[_0x5c9e2d(0x13f)]('verbose'),_0x16c945=_0x1b6ba4[_0x5c9e2d(0x12f)]??[],_0x4e3aa7=_0x1b6ba4[_0x5c9e2d(0x130)]?.['totalCount']??_0x16c945[_0x5c9e2d(0x12b)];let _0x209738;return _0x2b3539?_0x209738=_0x16c945:_0x209738=await Promise[_0x5c9e2d(0x143)](_0x16c945[_0x5c9e2d(0x126)](async _0x54219e=>{const _0x63e70=_0x5c9e2d;let _0x1c1f28;try{_0x1c1f28=_0x54219e['dbId']?await getDbName(_0x358fdb[_0x63e70(0x12a)],_0x54219e[_0x63e70(0x140)]):undefined;}catch{}return{'sqlCode':_0x54219e[_0x63e70(0x131)],'sqlName':_0x54219e[_0x63e70(0x12c)],'description':_0x54219e['description']??'','db':_0x1c1f28?_0x1c1f28+'\x20('+_0x54219e[_0x63e70(0x140)]+')':_0x54219e[_0x63e70(0x140)]??''};})),{'ok':!![],'data':_0x209738,'message':_0x16c945[_0x5c9e2d(0x12b)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x16c945[_0x5c9e2d(0x12b)]+_0x5c9e2d(0x141)+_0x4e3aa7+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a253_0x113200=a253_0x287d;(function(_0x5e5a45,_0xc02bf2){const _0x491977=a253_0x287d,_0x4446de=_0x5e5a45();while(!![]){try{const _0x342dc3=-parseInt(_0x491977(0x182))/0x1+parseInt(_0x491977(0x157))/0x2*(parseInt(_0x491977(0x16b))/0x3)+parseInt(_0x491977(0x153))/0x4+-parseInt(_0x491977(0x184))/0x5+-parseInt(_0x491977(0x155))/0x6*(parseInt(_0x491977(0x154))/0x7)+parseInt(_0x491977(0x169))/0x8*(-parseInt(_0x491977(0x14e))/0x9)+parseInt(_0x491977(0x170))/0xa*(parseInt(_0x491977(0x17f))/0xb);if(_0x342dc3===_0xc02bf2)break;else _0x4446de['push'](_0x4446de['shift']());}catch(_0x343967){_0x4446de['push'](_0x4446de['shift']());}}}(a253_0x48fa,0xdb3ef));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x426bbb,_0x35c980){const _0x2928f3=a253_0x287d,_0x2eb322=[];let _0x193cee=0x1;while(!![]){const _0x32eab0=await listSqlQueries(_0x426bbb,{'currentPage':_0x193cee,'pageSize':PAGE_SIZE,'sqlCode':_0x35c980[_0x2928f3(0x18e)],'sqlName':_0x35c980[_0x2928f3(0x162)]}),_0xe92d65=_0x32eab0['tableData']??[];_0x2eb322[_0x2928f3(0x185)](..._0xe92d65);if(_0xe92d65[_0x2928f3(0x172)]===0x0)break;const _0x1c5d2d=_0x32eab0['paging']?.[_0x2928f3(0x152)];if(_0x1c5d2d!=null?_0x2eb322[_0x2928f3(0x172)]>=_0x1c5d2d:_0xe92d65['length']<PAGE_SIZE)break;_0x193cee++;}return _0x2eb322;}async function ensureSqlContent(_0x55edc2){const _0x2f92ef=a253_0x287d;if(_0x55edc2['sqlContent']!=null&&String(_0x55edc2[_0x2f92ef(0x18a)])['length']>0x0)return _0x55edc2;return getSqlQueryDetail(_0x55edc2[_0x2f92ef(0x18e)]);}function a253_0x48fa(){const _0x21d344=['lockFilePath','string','POST','unchanged','replace','filePath','Filter\x20by\x20SQL\x20display\x20name','trim','appCode','boolean','sqlName','apps','dbId','some','sqlcode','\x20failed','isCanonical','120IHioQH','pull','2608437ujlMVZ','lastSync','path','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','content','13517260bHljEd','sqls','length','test','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','Force\x20pull\x20cancelled.','equivalent','description','catch','Force\x20overwrite\x20local\x20unsynced\x20changes','toISOString','No\x20remote\x20SQL\x20queries\x20matched.','skipped','str','mode','22OHSYMC','would_pull','cancelled','710817gemynB','Pull\x20complete:\x20','7792945eMBZtS','push','map','.xml','sqlRootDir','sql','sqlContent','mybatisXml','force','Would\x20pull\x20','sqlCode','nonInteractive','hash','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlRoot','utf8','bool','conflict','\x20SQL\x20file(s)\x20into\x20','name','601362TLXpMs','join','message','file','totalCount','3495348oMOsAd','3227KkMWWG','3606AAysPi','find','2dioIVX'];a253_0x48fa=function(){return _0x21d344;};return a253_0x48fa();}export const sqlPull={'service':a253_0x113200(0x189),'command':a253_0x113200(0x16a),'description':a253_0x113200(0x174),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x113200(0x14d),'type':a253_0x113200(0x159),'description':a253_0x113200(0x15e)},{'name':a253_0x113200(0x18c),'type':a253_0x113200(0x161),'description':a253_0x113200(0x179)}],async 'dryRun'(_0x235b96){const _0x3e2f24=a253_0x113200,_0x8be9d1=loadSqlProjectConfig(_0x235b96['appCode']),_0x2d8b5e=await readSqlLockFile(_0x8be9d1[_0x3e2f24(0x158)]),{appLock:_0x28d7e7}=ensureSqlLockScope(_0x2d8b5e??createEmptySqlLock(),_0x8be9d1[_0x3e2f24(0x160)],_0x8be9d1[_0x3e2f24(0x148)],_0x3e2f24(0x16a)),_0x293cd0=await fetchAllSqlQueries(_0x235b96[_0x3e2f24(0x160)],{'sqlCode':_0x235b96[_0x3e2f24(0x17d)](_0x3e2f24(0x166))||undefined,'sqlName':_0x235b96[_0x3e2f24(0x17d)]('name')||undefined}),_0x113e80=[];for(const _0x5f2ec0 of _0x293cd0){const _0x266ebd=await ensureSqlContent(_0x5f2ec0),_0x8dc059=ensureRemoteSqlContent(_0x266ebd),_0x53a6c8=detectSqlMode(_0x8dc059),_0x44404e=_0x266ebd[_0x3e2f24(0x164)]?await getDbName(_0x235b96[_0x3e2f24(0x160)],Number(_0x266ebd[_0x3e2f24(0x164)]))['catch'](()=>undefined):undefined,_0xb145b3=buildLocalSqlFileContent({'sqlCode':_0x266ebd[_0x3e2f24(0x18e)],'sqlName':_0x266ebd['sqlName'],'dbId':_0x266ebd[_0x3e2f24(0x164)]},_0x8dc059,{'dbName':_0x44404e,'mode':_0x53a6c8,'syncedAt':new Date()[_0x3e2f24(0x17a)](),'description':_0x266ebd['description']}),_0x1fd4d9=buildSqlLockEntry(_0x266ebd,_0x8dc059,'',{'dbName':_0x44404e}),_0x3da1e2=resolveLocalSqlFilePath(_0x8be9d1,_0x266ebd[_0x3e2f24(0x18e)],_0x1fd4d9);let _0x45dbf7=_0x3e2f24(0x180),_0x3ccc38;const _0x144a2b=await findExistingSqlFiles(_0x8be9d1,_0x3da1e2,_0x53a6c8,_0x28d7e7['sqls'][_0x266ebd['sqlCode']]);if(_0x144a2b[_0x3e2f24(0x172)]>0x0){const _0x1e63b1=await compareExistingSqlFiles(_0x144a2b,_0xb145b3,_0x53a6c8);if(_0x1e63b1['some'](({equivalent:_0x22eee3})=>!_0x22eee3))_0x45dbf7=_0x3e2f24(0x14b),_0x3ccc38=_0x3e2f24(0x147);else _0x1e63b1[_0x3e2f24(0x172)]===0x1&&_0x1e63b1[0x0]?.[_0x3e2f24(0x151)]['isCanonical']&&(_0x45dbf7=_0x3e2f24(0x17c),_0x3ccc38=_0x3e2f24(0x15b));}_0x113e80[_0x3e2f24(0x185)]({'sqlCode':_0x266ebd[_0x3e2f24(0x18e)],'sqlName':_0x266ebd[_0x3e2f24(0x162)],'filePath':_0x3da1e2,'status':_0x45dbf7,'reason':_0x3ccc38});}return{'method':_0x3e2f24(0x15a),'url':_0x3e2f24(0x16e),'body':{'appCode':_0x235b96[_0x3e2f24(0x160)],'sqlCode':_0x235b96['str'](_0x3e2f24(0x166))||null,'sqlName':_0x235b96['str'](_0x3e2f24(0x14d))||null,'files':_0x113e80},'description':_0x3e2f24(0x18d)+_0x113e80[_0x3e2f24(0x172)]+_0x3e2f24(0x14c)+_0x8be9d1[_0x3e2f24(0x188)]};},async 'execute'(_0x2dd4f5){const _0x34a2f3=a253_0x113200,_0x438a1d=loadSqlProjectConfig(_0x2dd4f5[_0x34a2f3(0x160)]),_0x49a88e=await readSqlLockFile(_0x438a1d['lockFilePath']),{lockData:_0x1200ed,appLock:_0x126bcf}=ensureSqlLockScope(_0x49a88e??createEmptySqlLock(),_0x438a1d[_0x34a2f3(0x160)],_0x438a1d[_0x34a2f3(0x148)],_0x34a2f3(0x16a)),_0x4bb678=_0x2dd4f5[_0x34a2f3(0x14a)](_0x34a2f3(0x18c)),_0x55f346=await fetchAllSqlQueries(_0x2dd4f5[_0x34a2f3(0x160)],{'sqlCode':_0x2dd4f5[_0x34a2f3(0x17d)](_0x34a2f3(0x166))||undefined,'sqlName':_0x2dd4f5['str'](_0x34a2f3(0x14d))||undefined});if(_0x55f346[_0x34a2f3(0x172)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x34a2f3(0x17b)};const _0x3abec8=[],_0x4aadd7=[];for(const _0x1b7f8f of _0x55f346){try{_0x3abec8[_0x34a2f3(0x185)](await ensureSqlContent(_0x1b7f8f));}catch(_0x59ff32){_0x4aadd7['push']({'sqlCode':_0x1b7f8f[_0x34a2f3(0x18e)],'error':_0x59ff32 instanceof Error?_0x59ff32[_0x34a2f3(0x150)]:String(_0x59ff32)});}}if(_0x4bb678&&!_0x2dd4f5[_0x34a2f3(0x145)]){let _0x233d51=![];for(const _0x1dfde5 of _0x3abec8){const _0x43a323=detectSqlMode(ensureRemoteSqlContent(_0x1dfde5)),_0x48c93e=_0x1dfde5['dbId']?await getDbName(_0x2dd4f5[_0x34a2f3(0x160)],Number(_0x1dfde5['dbId']))['catch'](()=>undefined):undefined,_0x5979ae=buildLocalSqlFileContent({'sqlCode':_0x1dfde5['sqlCode'],'sqlName':_0x1dfde5[_0x34a2f3(0x162)],'dbId':_0x1dfde5[_0x34a2f3(0x164)]},ensureRemoteSqlContent(_0x1dfde5),{'dbName':_0x48c93e,'mode':_0x43a323,'syncedAt':new Date()[_0x34a2f3(0x17a)](),'description':_0x1dfde5['description']}),_0xb6abce=resolveLocalSqlFilePath(_0x438a1d,_0x1dfde5[_0x34a2f3(0x18e)],buildSqlLockEntry(_0x1dfde5,ensureRemoteSqlContent(_0x1dfde5),'',{'dbName':_0x48c93e})),_0x1804fd=await findExistingSqlFiles(_0x438a1d,_0xb6abce,_0x43a323,_0x126bcf[_0x34a2f3(0x171)][_0x1dfde5[_0x34a2f3(0x18e)]]),_0x3e3ef9=await compareExistingSqlFiles(_0x1804fd,_0x5979ae,_0x43a323);if(_0x3e3ef9[_0x34a2f3(0x165)](({equivalent:_0x2543b7})=>!_0x2543b7)){_0x233d51=!![];break;}}if(_0x233d51){const _0x3465b0=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x3465b0)throw CliErrors[_0x34a2f3(0x181)](_0x34a2f3(0x175));}}const _0x520d3e=cloneSqlLockData(_0x1200ed),_0x457c0e=_0x520d3e[_0x34a2f3(0x163)][_0x438a1d[_0x34a2f3(0x160)]],_0x53df61=[],_0x3daeec=[];for(const _0x2b92c1 of _0x3abec8){const _0x14b4b7=_0x457c0e[_0x34a2f3(0x171)][_0x2b92c1['sqlCode']],_0x3a7a2f=ensureRemoteSqlContent(_0x2b92c1),_0x2b1940=detectSqlMode(_0x3a7a2f),_0x5a9eed=_0x2b92c1[_0x34a2f3(0x164)]?await getDbName(_0x2dd4f5[_0x34a2f3(0x160)],Number(_0x2b92c1['dbId']))[_0x34a2f3(0x178)](()=>undefined):undefined,_0x2b5108=buildLocalSqlFileContent({'sqlCode':_0x2b92c1['sqlCode'],'sqlName':_0x2b92c1[_0x34a2f3(0x162)],'dbId':_0x2b92c1[_0x34a2f3(0x164)]},_0x3a7a2f,{'dbName':_0x5a9eed,'mode':_0x2b1940,'syncedAt':new Date()['toISOString'](),'description':_0x2b92c1[_0x34a2f3(0x177)]}),_0x477606=buildSqlLockEntry(_0x2b92c1,_0x3a7a2f,computeSqlContentHash(_0x2b5108),{'dbName':_0x5a9eed}),_0x20d09e=_0x477606[_0x34a2f3(0x16d)],_0x2449e4=join(_0x438a1d[_0x34a2f3(0x188)],_0x20d09e);try{const _0x7f3797=await findExistingSqlFiles(_0x438a1d,_0x2449e4,_0x2b1940,_0x14b4b7),_0x425d8c=await compareExistingSqlFiles(_0x7f3797,_0x2b5108,_0x2b1940);if(!_0x4bb678&&_0x425d8c[_0x34a2f3(0x165)](({equivalent:_0x54c168})=>!_0x54c168)){_0x3daeec[_0x34a2f3(0x185)]({'sqlCode':_0x2b92c1[_0x34a2f3(0x18e)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x188b3c=_0x425d8c[_0x34a2f3(0x156)](({file:_0x157ee})=>_0x157ee[_0x34a2f3(0x168)]),_0x494397=_0x425d8c[_0x34a2f3(0x156)](({file:_0x5b348e})=>!_0x5b348e[_0x34a2f3(0x168)]);if(_0x188b3c?.[_0x34a2f3(0x176)]&&!_0x494397){_0x3daeec[_0x34a2f3(0x185)]({'sqlCode':_0x2b92c1[_0x34a2f3(0x18e)],'reason':_0x34a2f3(0x15b)}),_0x457c0e[_0x34a2f3(0x171)][_0x2b92c1[_0x34a2f3(0x18e)]]={..._0x477606,'hash':computeSqlContentHash(_0x188b3c['content']),'path':_0x20d09e};continue;}!_0x188b3c?.[_0x34a2f3(0x176)]&&(await ensureParentDirectory(_0x2449e4),await writeFile(_0x2449e4,_0x2b5108,_0x34a2f3(0x149))),_0x494397&&await rm(_0x494397[_0x34a2f3(0x151)][_0x34a2f3(0x15d)],{'force':!![]}),_0x457c0e[_0x34a2f3(0x171)][_0x2b92c1[_0x34a2f3(0x18e)]]={..._0x477606,'hash':_0x188b3c?.['equivalent']?computeSqlContentHash(_0x188b3c[_0x34a2f3(0x16f)]):_0x477606[_0x34a2f3(0x146)],'path':_0x20d09e},_0x53df61['push']({'sqlCode':_0x2b92c1['sqlCode'],'filePath':_0x2449e4});}catch(_0x28338c){_0x4aadd7[_0x34a2f3(0x185)]({'sqlCode':_0x2b92c1['sqlCode'],'error':_0x28338c instanceof Error?_0x28338c[_0x34a2f3(0x150)]:String(_0x28338c)});}}return _0x457c0e[_0x34a2f3(0x16c)]=new Date()[_0x34a2f3(0x17a)](),await writeSqlLockFile(_0x438a1d[_0x34a2f3(0x158)],_0x520d3e),{'ok':_0x4aadd7[_0x34a2f3(0x172)]===0x0,'data':{'pulled':_0x53df61,'skipped':_0x3daeec,'failed':_0x4aadd7},'message':_0x34a2f3(0x183)+_0x53df61[_0x34a2f3(0x172)]+'\x20written,\x20'+_0x3daeec['length']+'\x20skipped,\x20'+_0x4aadd7[_0x34a2f3(0x172)]+_0x34a2f3(0x167)};}};function isEquivalentPulledSqlFile(_0x2718ae,_0x1daa75,_0xb0e41d,_0x10e147){if(_0xb0e41d!==_0x10e147)return normalizePulledSqlBody(_0x2718ae,_0xb0e41d)===normalizePulledSqlBody(_0x1daa75,_0x10e147);return normalizePullComparableContent(_0x2718ae,_0xb0e41d)===normalizePullComparableContent(_0x1daa75,_0x10e147);}async function findExistingSqlFiles(_0x3a0089,_0x3f8d90,_0x217f34,_0x3e8fa6){const _0xf909fe=a253_0x113200,_0x252595=[];await fileExists(_0x3f8d90)&&_0x252595[_0xf909fe(0x185)]({'filePath':_0x3f8d90,'mode':_0x217f34,'isCanonical':!![]});if(!_0x3e8fa6?.[_0xf909fe(0x16d)])return _0x252595;const _0x472ec2=join(_0x3a0089[_0xf909fe(0x188)],_0x3e8fa6[_0xf909fe(0x16d)]);if(_0x472ec2===_0x3f8d90)return _0x252595;return await fileExists(_0x472ec2)&&_0x252595[_0xf909fe(0x185)]({'filePath':_0x472ec2,'mode':_0x3e8fa6[_0xf909fe(0x17e)]??modeFromFilePath(_0x472ec2),'isCanonical':![]}),_0x252595;}async function compareExistingSqlFiles(_0x56057d,_0x45efe6,_0x258de8){const _0x13fba8=a253_0x113200;return Promise['all'](_0x56057d[_0x13fba8(0x186)](async _0x108caf=>{const _0x434f48=_0x13fba8,_0x489184=await readFile(_0x108caf[_0x434f48(0x15d)],_0x434f48(0x149));return{'file':_0x108caf,'content':_0x489184,'equivalent':isEquivalentPulledSqlFile(_0x489184,_0x45efe6,_0x108caf['mode'],_0x258de8)};}));}function modeFromFilePath(_0xbc1667){const _0x196c92=a253_0x113200;return _0xbc1667['toLowerCase']()['endsWith'](_0x196c92(0x187))?_0x196c92(0x18b):_0x196c92(0x189);}function a253_0x287d(_0x3bbbb8,_0x40b8b9){_0x3bbbb8=_0x3bbbb8-0x145;const _0x48fa6f=a253_0x48fa();let _0x287d6e=_0x48fa6f[_0x3bbbb8];return _0x287d6e;}function normalizePulledSqlBody(_0x3fb90a,_0x241bf5){const _0x4ff69c=a253_0x113200;return stripLocalSqlMetadata(_0x3fb90a,_0x241bf5)[_0x4ff69c(0x15c)](/\r\n/g,'\x0a')[_0x4ff69c(0x15f)]();}function normalizePullComparableContent(_0x38d341,_0x3a76b7){const _0x230759=a253_0x113200,_0x2d3866=_0x38d341['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x254f24=_0x2d3866['filter'](_0x31a5ed=>!isSyncedAtMetadataLine(_0x31a5ed,_0x3a76b7));return _0x254f24[_0x230759(0x14f)]('\x0a');}function isSyncedAtMetadataLine(_0x457226,_0x103344){const _0x4c0ab4=a253_0x113200;if(_0x103344===_0x4c0ab4(0x18b))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x457226);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4c0ab4(0x173)](_0x457226);}
|
|
1
|
+
const a253_0x1e67f3=a253_0x4366;(function(_0x54e302,_0x58ee71){const _0x100569=a253_0x4366,_0x1fb9c1=_0x54e302();while(!![]){try{const _0x9075b5=-parseInt(_0x100569(0xdd))/0x1+-parseInt(_0x100569(0x10b))/0x2+parseInt(_0x100569(0xde))/0x3*(parseInt(_0x100569(0xed))/0x4)+parseInt(_0x100569(0xe4))/0x5*(parseInt(_0x100569(0x109))/0x6)+parseInt(_0x100569(0x10e))/0x7+parseInt(_0x100569(0xf4))/0x8*(parseInt(_0x100569(0xf5))/0x9)+-parseInt(_0x100569(0x114))/0xa;if(_0x9075b5===_0x58ee71)break;else _0x1fb9c1['push'](_0x1fb9c1['shift']());}catch(_0x3c3861){_0x1fb9c1['push'](_0x1fb9c1['shift']());}}}(a253_0x29d8,0x97d12));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';function a253_0x29d8(){const _0x4dafea=['read','499510FXHwfD','3UJMAdZ','dbId','find','sql','trim','boolean','1350feUBJr','would_pull','unchanged','sqlName','test','apps','No\x20remote\x20SQL\x20queries\x20matched.','tableData','sqlContent','1877116dtcCfS','message','content','file','mybatisXml','local\x20differs\x20from\x20remote','endsWith','4735912SmcSKj','9LgDTZa','\x20failed','sqlRoot','lastSync','str','.xml','equivalent','path','Force\x20pull\x20cancelled.','filter','Force\x20overwrite\x20local\x20unsynced\x20changes','appCode','description','some','sqlCode','conflict','isCanonical','\x20written,\x20','toISOString','hash','8172hYLLez','force','779366MoJVVB','catch','string','4284399QAJvSJ','Pull\x20complete:\x20','split','totalCount','sqlcode','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','5300300cIPFbw','sqls','\x20SQL\x20file(s)\x20into\x20','lockFilePath','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','pull','POST','length','skipped','utf8','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','replace','nonInteractive','name','push','bool','sqlRootDir','mode'];a253_0x29d8=function(){return _0x4dafea;};return a253_0x29d8();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a253_0x4366(_0x3546de,_0xd26feb){_0x3546de=_0x3546de-0xcb;const _0x29d884=a253_0x29d8();let _0x43665e=_0x29d884[_0x3546de];return _0x43665e;}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(_0x1e4e26,_0x44ec1e){const _0x3aa413=a253_0x4366,_0x2c8c9e=[];let _0x21214d=0x1;while(!![]){const _0x359cbe=await listSqlQueries(_0x1e4e26,{'currentPage':_0x21214d,'pageSize':PAGE_SIZE,'sqlCode':_0x44ec1e['sqlCode'],'sqlName':_0x44ec1e[_0x3aa413(0xe7)]}),_0x5bfabe=_0x359cbe[_0x3aa413(0xeb)]??[];_0x2c8c9e[_0x3aa413(0xd8)](..._0x5bfabe);if(_0x5bfabe[_0x3aa413(0xd1)]===0x0)break;const _0x26ea79=_0x359cbe['paging']?.[_0x3aa413(0x111)];if(_0x26ea79!=null?_0x2c8c9e[_0x3aa413(0xd1)]>=_0x26ea79:_0x5bfabe[_0x3aa413(0xd1)]<PAGE_SIZE)break;_0x21214d++;}return _0x2c8c9e;}async function ensureSqlContent(_0x330ac8){const _0x14ce9f=a253_0x4366;if(_0x330ac8[_0x14ce9f(0xec)]!=null&&String(_0x330ac8[_0x14ce9f(0xec)])[_0x14ce9f(0xd1)]>0x0)return _0x330ac8;return getSqlQueryDetail(_0x330ac8[_0x14ce9f(0x103)]);}export const sqlPull={'service':a253_0x1e67f3(0xe1),'command':a253_0x1e67f3(0xcf),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a253_0x1e67f3(0xdc),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x1e67f3(0xd7),'type':a253_0x1e67f3(0x10d),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a253_0x1e67f3(0x10a),'type':a253_0x1e67f3(0xe3),'description':a253_0x1e67f3(0xff)}],async 'dryRun'(_0xf30cc3){const _0x381ced=a253_0x1e67f3,_0x273639=loadSqlProjectConfig(_0xf30cc3[_0x381ced(0x100)]),_0x46d681=await readSqlLockFile(_0x273639[_0x381ced(0xcd)]),{appLock:_0x5d8eef}=ensureSqlLockScope(_0x46d681??createEmptySqlLock(),_0x273639['appCode'],_0x273639[_0x381ced(0xf7)],'pull'),_0xa84d4b=await fetchAllSqlQueries(_0xf30cc3[_0x381ced(0x100)],{'sqlCode':_0xf30cc3[_0x381ced(0xf9)](_0x381ced(0x112))||undefined,'sqlName':_0xf30cc3['str'](_0x381ced(0xd7))||undefined}),_0x42ce9a=[];for(const _0x5c144d of _0xa84d4b){const _0x2e59eb=await ensureSqlContent(_0x5c144d),_0x4ae43a=ensureRemoteSqlContent(_0x2e59eb),_0x5ab0be=detectSqlMode(_0x4ae43a),_0x520d4a=_0x2e59eb[_0x381ced(0xdf)]?await getDbName(_0xf30cc3[_0x381ced(0x100)],Number(_0x2e59eb[_0x381ced(0xdf)]))[_0x381ced(0x10c)](()=>undefined):undefined,_0x2a09ee=buildLocalSqlFileContent({'sqlCode':_0x2e59eb['sqlCode'],'sqlName':_0x2e59eb[_0x381ced(0xe7)],'dbId':_0x2e59eb['dbId']},_0x4ae43a,{'dbName':_0x520d4a,'mode':_0x5ab0be,'syncedAt':new Date()[_0x381ced(0x107)](),'description':_0x2e59eb[_0x381ced(0x101)]}),_0x4e62b8=buildSqlLockEntry(_0x2e59eb,_0x4ae43a,'',{'dbName':_0x520d4a}),_0x2baa5f=resolveLocalSqlFilePath(_0x273639,_0x2e59eb[_0x381ced(0x103)],_0x4e62b8);let _0x3bb179=_0x381ced(0xe5),_0x18279b;const _0x73b716=await findExistingSqlFiles(_0x273639,_0x2baa5f,_0x5ab0be,_0x5d8eef['sqls'][_0x2e59eb['sqlCode']]);if(_0x73b716[_0x381ced(0xd1)]>0x0){const _0x44b205=await compareExistingSqlFiles(_0x73b716,_0x2a09ee,_0x5ab0be);if(_0x44b205[_0x381ced(0x102)](({equivalent:_0x52966f})=>!_0x52966f))_0x3bb179=_0x381ced(0x104),_0x18279b=_0x381ced(0xce);else _0x44b205[_0x381ced(0xd1)]===0x1&&_0x44b205[0x0]?.['file'][_0x381ced(0x105)]&&(_0x3bb179=_0x381ced(0xd2),_0x18279b=_0x381ced(0xe6));}_0x42ce9a['push']({'sqlCode':_0x2e59eb[_0x381ced(0x103)],'sqlName':_0x2e59eb[_0x381ced(0xe7)],'filePath':_0x2baa5f,'status':_0x3bb179,'reason':_0x18279b});}return{'method':_0x381ced(0xd0),'url':_0x381ced(0x113),'body':{'appCode':_0xf30cc3['appCode'],'sqlCode':_0xf30cc3[_0x381ced(0xf9)](_0x381ced(0x112))||null,'sqlName':_0xf30cc3[_0x381ced(0xf9)]('name')||null,'files':_0x42ce9a},'description':'Would\x20pull\x20'+_0x42ce9a[_0x381ced(0xd1)]+_0x381ced(0xcc)+_0x273639[_0x381ced(0xda)]};},async 'execute'(_0x5449b0){const _0x5a5342=a253_0x1e67f3,_0x3d1b46=loadSqlProjectConfig(_0x5449b0[_0x5a5342(0x100)]),_0x489721=await readSqlLockFile(_0x3d1b46[_0x5a5342(0xcd)]),{lockData:_0x28f563,appLock:_0x1a3459}=ensureSqlLockScope(_0x489721??createEmptySqlLock(),_0x3d1b46[_0x5a5342(0x100)],_0x3d1b46[_0x5a5342(0xf7)],'pull'),_0x3cdfa3=_0x5449b0[_0x5a5342(0xd9)]('force'),_0x5dc565=await fetchAllSqlQueries(_0x5449b0[_0x5a5342(0x100)],{'sqlCode':_0x5449b0[_0x5a5342(0xf9)](_0x5a5342(0x112))||undefined,'sqlName':_0x5449b0[_0x5a5342(0xf9)](_0x5a5342(0xd7))||undefined});if(_0x5dc565[_0x5a5342(0xd1)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x5a5342(0xea)};const _0x5309ed=[],_0x20c24c=[];for(const _0xc5375d of _0x5dc565){try{_0x5309ed[_0x5a5342(0xd8)](await ensureSqlContent(_0xc5375d));}catch(_0x4b47e2){_0x20c24c[_0x5a5342(0xd8)]({'sqlCode':_0xc5375d[_0x5a5342(0x103)],'error':_0x4b47e2 instanceof Error?_0x4b47e2['message']:String(_0x4b47e2)});}}if(_0x3cdfa3&&!_0x5449b0[_0x5a5342(0xd6)]){let _0x9c640b=![];for(const _0x8fc1e5 of _0x5309ed){const _0x55b38a=detectSqlMode(ensureRemoteSqlContent(_0x8fc1e5)),_0x492496=_0x8fc1e5['dbId']?await getDbName(_0x5449b0[_0x5a5342(0x100)],Number(_0x8fc1e5[_0x5a5342(0xdf)]))[_0x5a5342(0x10c)](()=>undefined):undefined,_0x2669ff=buildLocalSqlFileContent({'sqlCode':_0x8fc1e5[_0x5a5342(0x103)],'sqlName':_0x8fc1e5[_0x5a5342(0xe7)],'dbId':_0x8fc1e5[_0x5a5342(0xdf)]},ensureRemoteSqlContent(_0x8fc1e5),{'dbName':_0x492496,'mode':_0x55b38a,'syncedAt':new Date()[_0x5a5342(0x107)](),'description':_0x8fc1e5[_0x5a5342(0x101)]}),_0x22e57b=resolveLocalSqlFilePath(_0x3d1b46,_0x8fc1e5['sqlCode'],buildSqlLockEntry(_0x8fc1e5,ensureRemoteSqlContent(_0x8fc1e5),'',{'dbName':_0x492496})),_0x35d3f4=await findExistingSqlFiles(_0x3d1b46,_0x22e57b,_0x55b38a,_0x1a3459[_0x5a5342(0xcb)][_0x8fc1e5['sqlCode']]),_0x5e49f8=await compareExistingSqlFiles(_0x35d3f4,_0x2669ff,_0x55b38a);if(_0x5e49f8[_0x5a5342(0x102)](({equivalent:_0xb5147f})=>!_0xb5147f)){_0x9c640b=!![];break;}}if(_0x9c640b){const _0x39efb2=await confirmForceOverwrite(_0x5a5342(0xd4));if(!_0x39efb2)throw CliErrors['cancelled'](_0x5a5342(0xfd));}}const _0x14dd09=cloneSqlLockData(_0x28f563),_0x50a486=_0x14dd09[_0x5a5342(0xe9)][_0x3d1b46[_0x5a5342(0x100)]],_0x147bb8=[],_0x4c5496=[];for(const _0x15ce43 of _0x5309ed){const _0x31b376=_0x50a486[_0x5a5342(0xcb)][_0x15ce43['sqlCode']],_0x5cfb91=ensureRemoteSqlContent(_0x15ce43),_0x1dd701=detectSqlMode(_0x5cfb91),_0x34f573=_0x15ce43[_0x5a5342(0xdf)]?await getDbName(_0x5449b0[_0x5a5342(0x100)],Number(_0x15ce43[_0x5a5342(0xdf)]))[_0x5a5342(0x10c)](()=>undefined):undefined,_0x2f2b28=buildLocalSqlFileContent({'sqlCode':_0x15ce43[_0x5a5342(0x103)],'sqlName':_0x15ce43[_0x5a5342(0xe7)],'dbId':_0x15ce43[_0x5a5342(0xdf)]},_0x5cfb91,{'dbName':_0x34f573,'mode':_0x1dd701,'syncedAt':new Date()[_0x5a5342(0x107)](),'description':_0x15ce43[_0x5a5342(0x101)]}),_0x128c03=buildSqlLockEntry(_0x15ce43,_0x5cfb91,computeSqlContentHash(_0x2f2b28),{'dbName':_0x34f573}),_0x2e8c92=_0x128c03[_0x5a5342(0xfc)],_0x49f59d=join(_0x3d1b46[_0x5a5342(0xda)],_0x2e8c92);try{const _0x49a1a9=await findExistingSqlFiles(_0x3d1b46,_0x49f59d,_0x1dd701,_0x31b376),_0x7114d7=await compareExistingSqlFiles(_0x49a1a9,_0x2f2b28,_0x1dd701);if(!_0x3cdfa3&&_0x7114d7['some'](({equivalent:_0x4476ac})=>!_0x4476ac)){_0x4c5496['push']({'sqlCode':_0x15ce43[_0x5a5342(0x103)],'reason':_0x5a5342(0xf2)});continue;}const _0x4435ec=_0x7114d7[_0x5a5342(0xe0)](({file:_0x4af0eb})=>_0x4af0eb['isCanonical']),_0x28bf4c=_0x7114d7[_0x5a5342(0xe0)](({file:_0x437580})=>!_0x437580[_0x5a5342(0x105)]);if(_0x4435ec?.[_0x5a5342(0xfb)]&&!_0x28bf4c){_0x4c5496['push']({'sqlCode':_0x15ce43[_0x5a5342(0x103)],'reason':_0x5a5342(0xe6)}),_0x50a486['sqls'][_0x15ce43[_0x5a5342(0x103)]]={..._0x128c03,'hash':computeSqlContentHash(_0x4435ec[_0x5a5342(0xef)]),'path':_0x2e8c92};continue;}!_0x4435ec?.[_0x5a5342(0xfb)]&&(await ensureParentDirectory(_0x49f59d),await writeFile(_0x49f59d,_0x2f2b28,_0x5a5342(0xd3))),_0x28bf4c&&await rm(_0x28bf4c[_0x5a5342(0xf0)]['filePath'],{'force':!![]}),_0x50a486['sqls'][_0x15ce43[_0x5a5342(0x103)]]={..._0x128c03,'hash':_0x4435ec?.['equivalent']?computeSqlContentHash(_0x4435ec[_0x5a5342(0xef)]):_0x128c03[_0x5a5342(0x108)],'path':_0x2e8c92},_0x147bb8[_0x5a5342(0xd8)]({'sqlCode':_0x15ce43[_0x5a5342(0x103)],'filePath':_0x49f59d});}catch(_0x1c8ded){_0x20c24c[_0x5a5342(0xd8)]({'sqlCode':_0x15ce43[_0x5a5342(0x103)],'error':_0x1c8ded instanceof Error?_0x1c8ded[_0x5a5342(0xee)]:String(_0x1c8ded)});}}return _0x50a486[_0x5a5342(0xf8)]=new Date()['toISOString'](),await writeSqlLockFile(_0x3d1b46[_0x5a5342(0xcd)],_0x14dd09),{'ok':_0x20c24c['length']===0x0,'data':{'pulled':_0x147bb8,'skipped':_0x4c5496,'failed':_0x20c24c},'message':_0x5a5342(0x10f)+_0x147bb8[_0x5a5342(0xd1)]+_0x5a5342(0x106)+_0x4c5496['length']+'\x20skipped,\x20'+_0x20c24c[_0x5a5342(0xd1)]+_0x5a5342(0xf6)};}};function isEquivalentPulledSqlFile(_0x2be404,_0x4c950a,_0x1037df,_0x1d5b4c){if(_0x1037df!==_0x1d5b4c)return normalizePulledSqlBody(_0x2be404,_0x1037df)===normalizePulledSqlBody(_0x4c950a,_0x1d5b4c);return normalizePullComparableContent(_0x2be404,_0x1037df)===normalizePullComparableContent(_0x4c950a,_0x1d5b4c);}async function findExistingSqlFiles(_0x30a540,_0x3c67de,_0x449604,_0xadeabb){const _0x51d7cf=a253_0x1e67f3,_0x59fa4c=[];await fileExists(_0x3c67de)&&_0x59fa4c[_0x51d7cf(0xd8)]({'filePath':_0x3c67de,'mode':_0x449604,'isCanonical':!![]});if(!_0xadeabb?.['path'])return _0x59fa4c;const _0x52472b=join(_0x30a540[_0x51d7cf(0xda)],_0xadeabb[_0x51d7cf(0xfc)]);if(_0x52472b===_0x3c67de)return _0x59fa4c;return await fileExists(_0x52472b)&&_0x59fa4c[_0x51d7cf(0xd8)]({'filePath':_0x52472b,'mode':_0xadeabb[_0x51d7cf(0xdb)]??modeFromFilePath(_0x52472b),'isCanonical':![]}),_0x59fa4c;}async function compareExistingSqlFiles(_0x597757,_0x48aba1,_0xdff5cf){return Promise['all'](_0x597757['map'](async _0x5f10d6=>{const _0x70b06a=a253_0x4366,_0x3bac0c=await readFile(_0x5f10d6['filePath'],_0x70b06a(0xd3));return{'file':_0x5f10d6,'content':_0x3bac0c,'equivalent':isEquivalentPulledSqlFile(_0x3bac0c,_0x48aba1,_0x5f10d6[_0x70b06a(0xdb)],_0xdff5cf)};}));}function modeFromFilePath(_0x26bdde){const _0x186cd2=a253_0x1e67f3;return _0x26bdde['toLowerCase']()[_0x186cd2(0xf3)](_0x186cd2(0xfa))?_0x186cd2(0xf1):_0x186cd2(0xe1);}function normalizePulledSqlBody(_0x17a3b9,_0xb4b3cd){const _0x2c3ded=a253_0x1e67f3;return stripLocalSqlMetadata(_0x17a3b9,_0xb4b3cd)[_0x2c3ded(0xd5)](/\r\n/g,'\x0a')[_0x2c3ded(0xe2)]();}function normalizePullComparableContent(_0x132cf2,_0x50474a){const _0x577441=a253_0x1e67f3,_0x198a44=_0x132cf2[_0x577441(0xd5)](/\r\n/g,'\x0a')[_0x577441(0x110)]('\x0a'),_0x5112c7=_0x198a44[_0x577441(0xfe)](_0x3dc631=>!isSyncedAtMetadataLine(_0x3dc631,_0x50474a));return _0x5112c7['join']('\x0a');}function isSyncedAtMetadataLine(_0xcabb70,_0x47d9b5){const _0x431e3b=a253_0x1e67f3;if(_0x47d9b5===_0x431e3b(0xf1))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x431e3b(0xe8)](_0xcabb70);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x431e3b(0xe8)](_0xcabb70);}
|