@lovrabet/rabetbase-cli 2.5.10-beta.4 → 2.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/context.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +4 -4
- 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
|
+
function a242_0x1e79(){const _0x35eba7=['880292QiFrbT','appCode','all','list','rule','40072oRNArw','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','Loaded\x20app\x20rule\x20configuration\x20for\x20','10cdxQgp','29080oUMrzK','2466KvpDFp','6607376EBKtHV','1851294FhcKSz','map','7FetSZS','2073072qKkliA','862532mwNExX'];a242_0x1e79=function(){return _0x35eba7;};return a242_0x1e79();}function a242_0x1e4b(_0x5994ad,_0x2db2e8){_0x5994ad=_0x5994ad-0xcd;const _0x1e79c5=a242_0x1e79();let _0x1e4b5a=_0x1e79c5[_0x5994ad];return _0x1e4b5a;}const a242_0x1cce6f=a242_0x1e4b;(function(_0x1a20c9,_0x163c39){const _0x42b07a=a242_0x1e4b,_0x2a1906=_0x1a20c9();while(!![]){try{const _0x4f59e6=-parseInt(_0x42b07a(0xd5))/0x1+parseInt(_0x42b07a(0xd0))/0x2+parseInt(_0x42b07a(0xdc))/0x3+parseInt(_0x42b07a(0xcf))/0x4+-parseInt(_0x42b07a(0xd8))/0x5*(parseInt(_0x42b07a(0xce))/0x6)+-parseInt(_0x42b07a(0xcd))/0x7*(-parseInt(_0x42b07a(0xdb))/0x8)+-parseInt(_0x42b07a(0xda))/0x9*(parseInt(_0x42b07a(0xd9))/0xa);if(_0x4f59e6===_0x163c39)break;else _0x2a1906['push'](_0x2a1906['shift']());}catch(_0xa94793){_0x2a1906['push'](_0x2a1906['shift']());}}}(a242_0x1e79,0x8b61f));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a242_0x1cce6f(0xd4),'command':a242_0x1cce6f(0xd3),'description':a242_0x1cce6f(0xd6),'risk':'read','requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x551637){const _0x331f1e=a242_0x1cce6f,_0x4165f9=await Promise[_0x331f1e(0xd2)](APP_RULE_TYPES[_0x331f1e(0xdd)](_0x371a81=>getAppRule(_0x551637['cookie'],{'appCode':_0x551637[_0x331f1e(0xd1)],'type':_0x371a81}))),_0x5880a2=APP_RULE_TYPES['map']((_0x53a083,_0x3ce8de)=>projectAppRule(_0x53a083,_0x4165f9[_0x3ce8de]??null));return{'ok':!![],'data':{'total':_0x5880a2['length'],'rules':_0x5880a2},'message':_0x331f1e(0xd7)+_0x551637[_0x331f1e(0xd1)]};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a243_0x1185c5=a243_0x14f6;(function(_0x25549e,_0x260528){const _0x517b60=a243_0x14f6,_0x215300=_0x25549e();while(!![]){try{const _0x3a9cfe=-parseInt(_0x517b60(0x13e))/0x1+-parseInt(_0x517b60(0x170))/0x2*(parseInt(_0x517b60(0x16b))/0x3)+-parseInt(_0x517b60(0x15f))/0x4+-parseInt(_0x517b60(0x178))/0x5+-parseInt(_0x517b60(0x172))/0x6+parseInt(_0x517b60(0x153))/0x7*(-parseInt(_0x517b60(0x156))/0x8)+parseInt(_0x517b60(0x159))/0x9;if(_0x3a9cfe===_0x260528)break;else _0x215300['push'](_0x215300['shift']());}catch(_0x2c96d9){_0x215300['push'](_0x215300['shift']());}}}(a243_0x4343,0xb0567));import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';function a243_0x4343(){const _0x1760aa=['1571095soXeFQ','app_rule_verification_failed','unconfigured','\x20for\x20','rule','\x20version\x20changed\x20before\x20write.','app_rule_expected_version_invalid','app_rule_content_too_large','byteSize','417289APErou','trim','app_rule_version_mismatch','rabetbase\x20rule\x20get\x20--type\x20','Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set','--file\x20is\x20required.','write','content','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','verified','planned','Expected\x20','number','input','version','replacement','UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','defineProperty','isSafeInteger','RULES','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','91BvAQdU','contentHash','flag','230856hgQuTY','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','beforeRecord','27155205GaXAtO','POST','create','type','\x20could\x20not\x20be\x20verified.','cause','95732vQBtRH','rules','\x20--format\x20compress','cookie','Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.','The\x20set\x20request\x20was\x20sent,\x20but\x20','expected-version','appCode','before','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','string','file','28011VDtovG','update',';\x20current\x20version\x20is\x20','set','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','142Ahoxjp','expectedVersion','3008742gfgqXP','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','DATABASE','Set\x20','str','Pass\x20a\x20UTF-8\x20Markdown\x20file.'];a243_0x4343=function(){return _0x1760aa;};return a243_0x4343();}import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function a243_0x14f6(_0x47f191,_0x476cd6){_0x47f191=_0x47f191-0x13c;const _0x434398=a243_0x4343();let _0x14f6c5=_0x434398[_0x47f191];return _0x14f6c5;}function readSetInput(_0x164170){const _0x5cd121=a243_0x14f6,_0x1bd0df=readAppRuleType(_0x164170),_0x77527b=_0x164170[_0x5cd121(0x176)](_0x5cd121(0x16a))[_0x5cd121(0x13f)]();if(!_0x77527b)throw appRuleError('app_rule_file_required',_0x5cd121(0x143),_0x5cd121(0x177));const _0x2abc6e=_0x164170[_0x5cd121(0x155)](_0x5cd121(0x165));let _0x417558;if(_0x2abc6e!==undefined){_0x417558=Number(_0x2abc6e);if(!Number[_0x5cd121(0x150)](_0x417558)||_0x417558<0x0)throw appRuleError(_0x5cd121(0x17e),'--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x1bd0df,'file':_0x77527b,'expectedVersion':_0x417558};}async function prepareSet(_0x10ac2e){const _0x239a61=a243_0x14f6,_0x392952=readSetInput(_0x10ac2e),_0x418829=await readAppRuleFile(_0x392952[_0x239a61(0x16a)]);if(_0x392952[_0x239a61(0x15c)]===_0x239a61(0x160)&&_0x418829[_0x239a61(0x145)]['length']>0x7d0)throw appRuleError(_0x239a61(0x13c),_0x239a61(0x16f));const _0x3aad16=await getAppRule(_0x10ac2e['cookie'],{'appCode':_0x10ac2e[_0x239a61(0x166)],'type':_0x392952[_0x239a61(0x15c)]});if(_0x392952['expectedVersion']!==undefined&&(_0x3aad16?.[_0x239a61(0x14c)]??0x0)!==_0x392952[_0x239a61(0x171)])throw appRuleError(_0x239a61(0x140),appRuleFileName(_0x392952[_0x239a61(0x15c)])+_0x239a61(0x17d),_0x239a61(0x149)+_0x392952[_0x239a61(0x171)]+_0x239a61(0x16d)+(_0x3aad16?.[_0x239a61(0x14c)]??_0x239a61(0x17a))+_0x239a61(0x168));return{'input':_0x392952,'replacement':_0x418829,'beforeRecord':_0x3aad16,'before':projectAppRule(_0x392952[_0x239a61(0x15c)],_0x3aad16),'planned':{'type':_0x392952[_0x239a61(0x15c)],'fileName':appRuleFileName(_0x392952['type']),'contextScope':appRuleContextScope(_0x392952['type']),'enabled':!![],'appCode':_0x10ac2e[_0x239a61(0x166)],'scope':_0x239a61(0x160),'contentByteSize':_0x418829[_0x239a61(0x13d)],'contentHash':_0x418829[_0x239a61(0x154)]}};}function warningsFor(_0xe29dde){return[];}export const ruleSet={'service':a243_0x1185c5(0x17c),'command':a243_0x1185c5(0x16e),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a243_0x1185c5(0x144),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':'file','type':a243_0x1185c5(0x169),'required':!![],'description':a243_0x1185c5(0x14e)},{'name':'expected-version','type':a243_0x1185c5(0x14a),'required':![],'description':a243_0x1185c5(0x142)}],async 'validate'(_0x405bad){readSetInput(_0x405bad);},async 'dryRun'(_0x53127d){const _0xdf161d=a243_0x1185c5,_0x41d556=await prepareSet(_0x53127d);return asDryRunResult({'operation':'set','selector':{'appCode':_0x53127d[_0xdf161d(0x166)],'scope':_0xdf161d(0x160),'type':_0x41d556[_0xdf161d(0x14b)][_0xdf161d(0x15c)]},'before':_0x41d556[_0xdf161d(0x167)],'after':_0x41d556[_0xdf161d(0x148)],'dryRun':!![],'backend':{'method':_0xdf161d(0x15a),'path':knowledgeDocumentsPath(_0xdf161d(0x160),_0x41d556[_0xdf161d(0x158)]?_0xdf161d(0x16c):_0xdf161d(0x15b)),'body':{'appCode':_0x53127d[_0xdf161d(0x166)],..._0x41d556[_0xdf161d(0x158)]?{'id':_0x41d556[_0xdf161d(0x158)]['id']}:{},'title':_0x41d556[_0xdf161d(0x14b)][_0xdf161d(0x15c)]===_0xdf161d(0x160)?_0xdf161d(0x151):_0xdf161d(0x174),'contentHash':_0x41d556['replacement'][_0xdf161d(0x154)],'contentByteSize':_0x41d556[_0xdf161d(0x14d)][_0xdf161d(0x13d)],..._0x41d556[_0xdf161d(0x158)]?{'expectedVersion':_0x41d556[_0xdf161d(0x158)][_0xdf161d(0x14c)]}:{}}},'warnings':warningsFor(_0x41d556[_0xdf161d(0x14b)][_0xdf161d(0x171)]),'verification':{'expectedVersion':_0x41d556[_0xdf161d(0x158)]?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0xdf161d(0x141)+_0x41d556[_0xdf161d(0x14b)][_0xdf161d(0x15c)]+_0xdf161d(0x161)}},{'method':'POST','url':knowledgeDocumentsPath(_0xdf161d(0x160),_0x41d556[_0xdf161d(0x158)]?_0xdf161d(0x16c):_0xdf161d(0x15b))});},async 'execute'(_0x59bdc2){const _0x219581=a243_0x1185c5,_0x1289bd=await prepareSet(_0x59bdc2),_0x21c1d8=_0x1289bd['beforeRecord']===null?0x1:_0x1289bd[_0x219581(0x158)][_0x219581(0x14c)]+(_0x1289bd[_0x219581(0x158)][_0x219581(0x145)]===_0x1289bd[_0x219581(0x14d)][_0x219581(0x145)]?0x0:0x1);let _0x43bfd1,_0x2d7c20=![];try{_0x43bfd1=await saveAppRule(_0x59bdc2['cookie'],{'appCode':_0x59bdc2['appCode'],'type':_0x1289bd[_0x219581(0x14b)][_0x219581(0x15c)],'content':_0x1289bd[_0x219581(0x14d)][_0x219581(0x145)],'expectedVersion':_0x1289bd[_0x219581(0x158)]?.[_0x219581(0x14c)]??0x0,..._0x1289bd[_0x219581(0x158)]?{'id':_0x1289bd[_0x219581(0x158)]['id']}:{}});if(_0x43bfd1['version']!==_0x21c1d8||_0x43bfd1[_0x219581(0x145)]!==_0x1289bd[_0x219581(0x14d)]['content']||_0x1289bd['beforeRecord']!==null&&_0x43bfd1['id']!==_0x1289bd[_0x219581(0x158)]['id'])throw appRuleError(_0x219581(0x179),_0x219581(0x146),_0x219581(0x163));}catch(_0x2ac210){if(!isPlatformTransportFailure(_0x2ac210))throw _0x2ac210;_0x2d7c20=!![];}let _0x734a44;try{_0x734a44=await getAppRule(_0x59bdc2[_0x219581(0x162)],{'appCode':_0x59bdc2[_0x219581(0x166)],'type':_0x1289bd[_0x219581(0x14b)][_0x219581(0x15c)]});}catch(_0xc12a2b){const _0x17ad51=appRuleError(_0x2d7c20?'app_rule_set_outcome_unknown':'app_rule_verification_unavailable',_0x219581(0x164)+appRuleFileName(_0x1289bd[_0x219581(0x14b)]['type'])+_0x219581(0x15d),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object[_0x219581(0x14f)](_0x17ad51,_0x219581(0x15e),{'value':_0xc12a2b,'enumerable':![]});throw _0x17ad51;}const _0x175e40=_0x734a44&&inspectAppRuleContent(_0x734a44[_0x219581(0x145)])[_0x219581(0x154)]===_0x1289bd['replacement'][_0x219581(0x154)],_0x3b1427=_0x734a44&&_0x734a44[_0x219581(0x14c)]===_0x21c1d8&&(!_0x43bfd1||_0x734a44['id']===_0x43bfd1['id']&&_0x734a44[_0x219581(0x14c)]===_0x43bfd1[_0x219581(0x14c)]);if(!_0x734a44||!_0x175e40||!_0x3b1427||_0x1289bd[_0x219581(0x158)]!==null&&_0x734a44['id']!==_0x1289bd[_0x219581(0x158)]['id'])throw appRuleError(_0x2d7c20?'app_rule_set_outcome_unknown':_0x219581(0x179),appRuleFileName(_0x1289bd[_0x219581(0x14b)][_0x219581(0x15c)])+_0x219581(0x173),_0x219581(0x157)+_0x1289bd[_0x219581(0x14b)]['type']+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x4d95f4=warningsFor(_0x1289bd[_0x219581(0x14b)]['expectedVersion']);_0x2d7c20&&_0x4d95f4['push'](_0x219581(0x152));const _0x42c8f4=projectAppRule(_0x1289bd[_0x219581(0x14b)][_0x219581(0x15c)],_0x734a44);return{'ok':!![],'data':{'operation':_0x219581(0x16e),'selector':{'appCode':_0x59bdc2[_0x219581(0x166)],'scope':_0x219581(0x160),'type':_0x1289bd['input'][_0x219581(0x15c)]},'before':_0x1289bd[_0x219581(0x167)],'after':_0x42c8f4,'dryRun':![],'backend':{'method':_0x219581(0x15a),'path':knowledgeDocumentsPath(_0x219581(0x160),_0x1289bd[_0x219581(0x158)]?_0x219581(0x16c):_0x219581(0x15b))},'warnings':_0x4d95f4,'verification':{'status':_0x219581(0x147),'recoveredAfterUnknownResponse':_0x2d7c20,'expectedVersion':_0x1289bd['beforeRecord']?.[_0x219581(0x14c)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x219581(0x141)+_0x1289bd[_0x219581(0x14b)]['type']+_0x219581(0x161)}},'message':_0x219581(0x175)+appRuleFileName(_0x1289bd[_0x219581(0x14b)]['type'])+_0x219581(0x17b)+_0x59bdc2['appCode']};}};
|
|
1
|
+
function a243_0x18c4(){const _0x78365e=['app_rule_set_outcome_unknown','1676820fDIvrE','\x20--format\x20compress','7397UlrtnE','app_rule_expected_version_invalid','rules','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','POST','push','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','expected-version','str','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','app_rule_verification_failed','byteSize','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','update','unconfigured','cause','Set\x20','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','planned','isSafeInteger','version','1654620eiaAvP','\x20version\x20changed\x20before\x20write.','set','--file\x20is\x20required.','replacement','rule','contentHash','beforeRecord','\x20could\x20not\x20be\x20verified.','number','\x20for\x20','string','trim','app_rule_version_mismatch','input','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','file','1062018SvgPTq','4278169mJdqWm','Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set','verified','appCode','UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','expectedVersion','cookie','defineProperty','26AeloRk','78960JUOejb','943032XRRzbv','content','before',';\x20current\x20version\x20is\x20','app_rule_file_required','create','type','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.'];a243_0x18c4=function(){return _0x78365e;};return a243_0x18c4();}const a243_0x3c8b44=a243_0x358e;(function(_0x4060d9,_0x58525d){const _0x110eae=a243_0x358e,_0xeb5516=_0x4060d9();while(!![]){try{const _0x3c9745=parseInt(_0x110eae(0xbe))/0x1*(-parseInt(_0x110eae(0xb1))/0x2)+parseInt(_0x110eae(0xbc))/0x3+parseInt(_0x110eae(0xd3))/0x4+-parseInt(_0x110eae(0xb2))/0x5+parseInt(_0x110eae(0xa8))/0x6+-parseInt(_0x110eae(0xa9))/0x7+-parseInt(_0x110eae(0xb3))/0x8;if(_0x3c9745===_0x58525d)break;else _0xeb5516['push'](_0xeb5516['shift']());}catch(_0x532b24){_0xeb5516['push'](_0xeb5516['shift']());}}}(a243_0x18c4,0x4b577));import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function readSetInput(_0x4a9d8a){const _0x41d680=a243_0x358e,_0x3eaea2=readAppRuleType(_0x4a9d8a),_0x20dc9d=_0x4a9d8a[_0x41d680(0xc6)]('file')[_0x41d680(0xa3)]();if(!_0x20dc9d)throw appRuleError(_0x41d680(0xb7),_0x41d680(0xd6),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x41b76a=_0x4a9d8a['flag'](_0x41d680(0xc5));let _0x38dd3a;if(_0x41b76a!==undefined){_0x38dd3a=Number(_0x41b76a);if(!Number[_0x41d680(0xd1)](_0x38dd3a)||_0x38dd3a<0x0)throw appRuleError(_0x41d680(0xbf),'--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x3eaea2,'file':_0x20dc9d,'expectedVersion':_0x38dd3a};}async function prepareSet(_0x54ba5c){const _0x469d57=a243_0x358e,_0x1c8c9b=readSetInput(_0x54ba5c),_0x3ff889=await readAppRuleFile(_0x1c8c9b[_0x469d57(0xa7)]);if(_0x1c8c9b[_0x469d57(0xb9)]===_0x469d57(0xc0)&&_0x3ff889[_0x469d57(0xb4)]['length']>0x7d0)throw appRuleError('app_rule_content_too_large',_0x469d57(0xc7));const _0x4970a5=await getAppRule(_0x54ba5c[_0x469d57(0xaf)],{'appCode':_0x54ba5c[_0x469d57(0xac)],'type':_0x1c8c9b[_0x469d57(0xb9)]});if(_0x1c8c9b[_0x469d57(0xae)]!==undefined&&(_0x4970a5?.[_0x469d57(0xd2)]??0x0)!==_0x1c8c9b[_0x469d57(0xae)])throw appRuleError(_0x469d57(0xa4),appRuleFileName(_0x1c8c9b[_0x469d57(0xb9)])+_0x469d57(0xd4),'Expected\x20'+_0x1c8c9b['expectedVersion']+_0x469d57(0xb6)+(_0x4970a5?.['version']??_0x469d57(0xcc))+_0x469d57(0xba));return{'input':_0x1c8c9b,'replacement':_0x3ff889,'beforeRecord':_0x4970a5,'before':projectAppRule(_0x1c8c9b[_0x469d57(0xb9)],_0x4970a5),'planned':{'type':_0x1c8c9b[_0x469d57(0xb9)],'fileName':appRuleFileName(_0x1c8c9b[_0x469d57(0xb9)]),'contextScope':appRuleContextScope(_0x1c8c9b['type']),'enabled':!![],'appCode':_0x54ba5c[_0x469d57(0xac)],'scope':'rules','contentByteSize':_0x3ff889['byteSize'],'contentHash':_0x3ff889[_0x469d57(0xd9)]}};}function warningsFor(_0x94239){return[];}function a243_0x358e(_0x2f322e,_0x528aaa){_0x2f322e=_0x2f322e-0x9f;const _0x18c45b=a243_0x18c4();let _0x358eba=_0x18c45b[_0x2f322e];return _0x358eba;}export const ruleSet={'service':a243_0x3c8b44(0xd8),'command':a243_0x3c8b44(0xd5),'description':a243_0x3c8b44(0xc4),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x3c8b44(0xa7),'type':a243_0x3c8b44(0xa2),'required':!![],'description':a243_0x3c8b44(0xad)},{'name':a243_0x3c8b44(0xc5),'type':a243_0x3c8b44(0xa0),'required':![],'description':a243_0x3c8b44(0xaa)}],async 'validate'(_0x42d3dd){readSetInput(_0x42d3dd);},async 'dryRun'(_0x58773e){const _0x42d439=a243_0x3c8b44,_0x280699=await prepareSet(_0x58773e);return asDryRunResult({'operation':_0x42d439(0xd5),'selector':{'appCode':_0x58773e['appCode'],'scope':_0x42d439(0xc0),'type':_0x280699[_0x42d439(0xa5)][_0x42d439(0xb9)]},'before':_0x280699[_0x42d439(0xb5)],'after':_0x280699[_0x42d439(0xd0)],'dryRun':!![],'backend':{'method':_0x42d439(0xc2),'path':knowledgeDocumentsPath('rules',_0x280699[_0x42d439(0xda)]?_0x42d439(0xcb):'create'),'body':{'appCode':_0x58773e['appCode'],..._0x280699[_0x42d439(0xda)]?{'id':_0x280699[_0x42d439(0xda)]['id']}:{},'title':_0x280699['input']['type']===_0x42d439(0xc0)?'RULES':'DATABASE','contentHash':_0x280699[_0x42d439(0xd7)][_0x42d439(0xd9)],'contentByteSize':_0x280699['replacement'][_0x42d439(0xc9)],..._0x280699[_0x42d439(0xda)]?{'expectedVersion':_0x280699['beforeRecord'][_0x42d439(0xd2)]}:{}}},'warnings':warningsFor(_0x280699[_0x42d439(0xa5)]['expectedVersion']),'verification':{'expectedVersion':_0x280699[_0x42d439(0xda)]?.[_0x42d439(0xd2)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x280699[_0x42d439(0xa5)][_0x42d439(0xb9)]+_0x42d439(0xbd)}},{'method':'POST','url':knowledgeDocumentsPath(_0x42d439(0xc0),_0x280699[_0x42d439(0xda)]?'update':_0x42d439(0xb8))});},async 'execute'(_0x1d0061){const _0x722575=a243_0x3c8b44,_0x14d833=await prepareSet(_0x1d0061),_0x2908f6=_0x14d833['beforeRecord']===null?0x1:_0x14d833[_0x722575(0xda)][_0x722575(0xd2)]+(_0x14d833['beforeRecord'][_0x722575(0xb4)]===_0x14d833[_0x722575(0xd7)][_0x722575(0xb4)]?0x0:0x1);let _0x386c0d,_0x19eb55=![];try{_0x386c0d=await saveAppRule(_0x1d0061[_0x722575(0xaf)],{'appCode':_0x1d0061[_0x722575(0xac)],'type':_0x14d833[_0x722575(0xa5)]['type'],'content':_0x14d833[_0x722575(0xd7)][_0x722575(0xb4)],'expectedVersion':_0x14d833['beforeRecord']?.['version']??0x0,..._0x14d833[_0x722575(0xda)]?{'id':_0x14d833[_0x722575(0xda)]['id']}:{}});if(_0x386c0d[_0x722575(0xd2)]!==_0x2908f6||_0x386c0d[_0x722575(0xb4)]!==_0x14d833[_0x722575(0xd7)]['content']||_0x14d833[_0x722575(0xda)]!==null&&_0x386c0d['id']!==_0x14d833[_0x722575(0xda)]['id'])throw appRuleError(_0x722575(0xc8),_0x722575(0xa6),'Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.');}catch(_0x177b8a){if(!isPlatformTransportFailure(_0x177b8a))throw _0x177b8a;_0x19eb55=!![];}let _0x33657b;try{_0x33657b=await getAppRule(_0x1d0061['cookie'],{'appCode':_0x1d0061[_0x722575(0xac)],'type':_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)]});}catch(_0x5272a8){const _0xc0af7f=appRuleError(_0x19eb55?'app_rule_set_outcome_unknown':'app_rule_verification_unavailable','The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x14d833['input']['type'])+_0x722575(0x9f),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object[_0x722575(0xb0)](_0xc0af7f,_0x722575(0xcd),{'value':_0x5272a8,'enumerable':![]});throw _0xc0af7f;}const _0x571e9a=_0x33657b&&inspectAppRuleContent(_0x33657b[_0x722575(0xb4)])[_0x722575(0xd9)]===_0x14d833[_0x722575(0xd7)]['contentHash'],_0x427b1c=_0x33657b&&_0x33657b[_0x722575(0xd2)]===_0x2908f6&&(!_0x386c0d||_0x33657b['id']===_0x386c0d['id']&&_0x33657b[_0x722575(0xd2)]===_0x386c0d[_0x722575(0xd2)]);if(!_0x33657b||!_0x571e9a||!_0x427b1c||_0x14d833[_0x722575(0xda)]!==null&&_0x33657b['id']!==_0x14d833[_0x722575(0xda)]['id'])throw appRuleError(_0x19eb55?_0x722575(0xbb):'app_rule_verification_failed',appRuleFileName(_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)])+_0x722575(0xc1),_0x722575(0xca)+_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)]+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x21f047=warningsFor(_0x14d833[_0x722575(0xa5)][_0x722575(0xae)]);_0x19eb55&&_0x21f047[_0x722575(0xc3)](_0x722575(0xcf));const _0x41c418=projectAppRule(_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)],_0x33657b);return{'ok':!![],'data':{'operation':_0x722575(0xd5),'selector':{'appCode':_0x1d0061[_0x722575(0xac)],'scope':_0x722575(0xc0),'type':_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)]},'before':_0x14d833['before'],'after':_0x41c418,'dryRun':![],'backend':{'method':_0x722575(0xc2),'path':knowledgeDocumentsPath(_0x722575(0xc0),_0x14d833['beforeRecord']?'update':_0x722575(0xb8))},'warnings':_0x21f047,'verification':{'status':_0x722575(0xab),'recoveredAfterUnknownResponse':_0x19eb55,'expectedVersion':_0x14d833[_0x722575(0xda)]?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x14d833[_0x722575(0xa5)]['type']+_0x722575(0xbd)}},'message':_0x722575(0xce)+appRuleFileName(_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)])+_0x722575(0xa1)+_0x1d0061[_0x722575(0xac)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x5644e6=a244_0x3da8;(function(_0x490827,_0x185418){const _0x26d0c0=a244_0x3da8,_0x1f4f38=_0x490827();while(!![]){try{const _0x4542b0=-parseInt(_0x26d0c0(0x99))/0x1*(-parseInt(_0x26d0c0(0x8d))/0x2)+parseInt(_0x26d0c0(0xa8))/0x3*(parseInt(_0x26d0c0(0x87))/0x4)+-parseInt(_0x26d0c0(0x94))/0x5*(-parseInt(_0x26d0c0(0x91))/0x6)+parseInt(_0x26d0c0(0x95))/0x7*(parseInt(_0x26d0c0(0xa3))/0x8)+-parseInt(_0x26d0c0(0x9b))/0x9+parseInt(_0x26d0c0(0x86))/0xa+-parseInt(_0x26d0c0(0xa5))/0xb;if(_0x4542b0===_0x185418)break;else _0x1f4f38['push'](_0x1f4f38['shift']());}catch(_0xe976c7){_0x1f4f38['push'](_0x1f4f38['shift']());}}}(a244_0x3bb1,0xcfe1d));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';function a244_0x3bb1(){const _0x36f038=['database','127918Bdeiji','byteSize','4862268qfbRVv','indexStatus','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','appCode','byteLength','str','--file\x20is\x20required.','RULES.md','8sseZxb','sha256','39531272uQvJyL','size','app_rule_content_too_large','3xOzroY','message','contentHash','utf8','from','DATABASE.md','database-analysis','string','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','hex','7650140mUTAaU','905508nDTlmh','app_rule_file_unreadable','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','rules','updateTime','26QocMMd','trim','app_rule_content_invalid','sha256:','9785382SfpNAE','update','createTime','5tKLFNj','4901869RZkaHN','isFile','type'];a244_0x3bb1=function(){return _0x36f038;};return a244_0x3bb1();}import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x5644e6(0x8b),'database'];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_0x5644e6(0xa2),'database':a244_0x5644e6(0xad)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a244_0x5644e6(0xae)};export function appRuleError(_0x110564,_0x3433e6,_0x152929){return new CliError(_0x110564,0x1,_0x3433e6,_0x152929);}function a244_0x3da8(_0x2d3933,_0x4db1f9){_0x2d3933=_0x2d3933-0x83;const _0x3bb15b=a244_0x3bb1();let _0x3da81e=_0x3bb15b[_0x2d3933];return _0x3da81e;}export function readAppRuleType(_0x16f736){const _0x1e0ab1=a244_0x5644e6,_0x225b45=_0x16f736[_0x1e0ab1(0xa0)]('type')[_0x1e0ab1(0x8e)]()['toLowerCase']();if(_0x225b45!==_0x1e0ab1(0x8b)&&_0x225b45!==_0x1e0ab1(0x98))throw appRuleError('app_rule_type_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x225b45;}export function appRuleFileName(_0x213773){return APP_RULE_FILES[_0x213773];}export function appRuleContextScope(_0x5293b2){return APP_RULE_CONTEXT_SCOPES[_0x5293b2];}export function inspectAppRuleContent(_0x26205f){const _0x1fefb3=a244_0x5644e6,_0x5a6e61=Buffer[_0x1fefb3(0xac)](_0x26205f,_0x1fefb3(0xab));return{'content':_0x26205f,'byteSize':_0x5a6e61[_0x1fefb3(0x9f)],'contentHash':_0x1fefb3(0x90)+createHash(_0x1fefb3(0xa4))[_0x1fefb3(0x92)](_0x5a6e61)['digest'](_0x1fefb3(0x85))};}export async function readAppRuleFile(_0xd0ff98){const _0x2c8bc0=a244_0x5644e6,_0x4e36ec=_0xd0ff98[_0x2c8bc0(0x8e)]();if(!_0x4e36ec)throw appRuleError('app_rule_file_required',_0x2c8bc0(0xa1),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x25d9a3=resolve(_0x4e36ec);let _0x39249e;try{_0x39249e=await stat(_0x25d9a3);}catch(_0x172a3e){throw appRuleError(_0x2c8bc0(0x88),'Cannot\x20access\x20app\x20rule\x20file:\x20'+_0x4e36ec,_0x172a3e instanceof Error?_0x172a3e[_0x2c8bc0(0xa9)]:String(_0x172a3e));}if(!_0x39249e[_0x2c8bc0(0x96)]())throw appRuleError('app_rule_file_invalid','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x4e36ec);if(_0x39249e[_0x2c8bc0(0xa6)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x2c8bc0(0xa7),_0x2c8bc0(0x8a));let _0x22045f;try{_0x22045f=await readFile(_0x25d9a3);}catch(_0x39e751){throw appRuleError(_0x2c8bc0(0x88),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x4e36ec,_0x39e751 instanceof Error?_0x39e751[_0x2c8bc0(0xa9)]:String(_0x39e751));}if(_0x22045f[_0x2c8bc0(0x9f)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x2c8bc0(0xa7),_0x2c8bc0(0x8a));let _0x19676e;try{_0x19676e=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})['decode'](_0x22045f);}catch{throw appRuleError(_0x2c8bc0(0x8f),_0x2c8bc0(0x84)+_0x4e36ec);}if(_0x19676e['length']>MAX_APP_RULE_UNITS)throw appRuleError(_0x2c8bc0(0xa7),_0x2c8bc0(0x9d));if(!_0x19676e[_0x2c8bc0(0x8e)]())throw appRuleError(_0x2c8bc0(0x8f),'App\x20rule\x20file\x20is\x20blank:\x20'+_0x4e36ec);return inspectAppRuleContent(_0x19676e);}export function projectAppRule(_0x30e8d,_0x462d02){const _0xffb08b=a244_0x5644e6;if(!_0x462d02)return{'type':_0x30e8d,'fileName':appRuleFileName(_0x30e8d),'contextScope':appRuleContextScope(_0x30e8d),'enabled':![]};const _0x4981e9=inspectAppRuleContent(_0x462d02['content']);return{'type':_0x30e8d,'fileName':appRuleFileName(_0x30e8d),'contextScope':appRuleContextScope(_0x30e8d),'enabled':!![],'id':_0x462d02['id'],'scope':_0x462d02['scope'],'appCode':_0x462d02[_0xffb08b(0x9e)],'version':_0x462d02['version'],..._0x462d02[_0xffb08b(0x9c)]!==undefined?{'indexStatus':_0x462d02[_0xffb08b(0x9c)]}:{},'contentByteSize':_0x4981e9[_0xffb08b(0x9a)],'contentHash':_0x4981e9[_0xffb08b(0xaa)],..._0x462d02[_0xffb08b(0x93)]!==undefined&&_0x462d02['createTime']!==null?{'createTime':_0x462d02[_0xffb08b(0x93)]}:{},..._0x462d02[_0xffb08b(0x8c)]!==undefined&&_0x462d02[_0xffb08b(0x8c)]!==null?{'updateTime':_0x462d02[_0xffb08b(0x8c)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x5644e6(0x97),'type':a244_0x5644e6(0x83),'required':!![],'description':a244_0x5644e6(0x89),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x599f59=a245_0x1b34;(function(_0x28762f,_0x411525){const _0x4df9b9=a245_0x1b34,_0xe50b6e=_0x28762f();while(!![]){try{const _0x29e457=parseInt(_0x4df9b9(0x132))/0x1+-parseInt(_0x4df9b9(0x12e))/0x2*(-parseInt(_0x4df9b9(0x158))/0x3)+-parseInt(_0x4df9b9(0x152))/0x4*(parseInt(_0x4df9b9(0x135))/0x5)+parseInt(_0x4df9b9(0x156))/0x6+parseInt(_0x4df9b9(0x133))/0x7+parseInt(_0x4df9b9(0x16c))/0x8*(parseInt(_0x4df9b9(0x153))/0x9)+parseInt(_0x4df9b9(0x145))/0xa*(-parseInt(_0x4df9b9(0x164))/0xb);if(_0x29e457===_0x411525)break;else _0xe50b6e['push'](_0xe50b6e['shift']());}catch(_0x16fbc8){_0xe50b6e['push'](_0xe50b6e['shift']());}}}(a245_0xa241,0x8bae8));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';const VERSION_CHECK_SCRIPTS=new Set([a245_0x599f59(0x159),a245_0x599f59(0x14d)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x599f59(0x159),'dev',a245_0x599f59(0x134),a245_0x599f59(0x13a)]);export function syncProjectDomainRoutingBeforeScript(_0x5ea0bb,_0x3677ac){const _0x586424=a245_0x599f59;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x586424(0x155)](_0x3677ac))return null;const _0x53d6f0=findProjectRootDirectory(_0x5ea0bb);if(!resolveConfigPath(_0x53d6f0))return null;const _0x1792ec=writeProjectDomainRoutingManifest(_0x53d6f0);return{'path':_0x1792ec[_0x586424(0x15d)],'changed':_0x1792ec[_0x586424(0x14f)]};}function readPackageScripts(_0x9b184c){const _0x1e49fd=a245_0x599f59,_0x11802c=resolve(_0x9b184c,_0x1e49fd(0x171));if(!existsSync(_0x11802c))return null;try{const _0xd6c097=JSON[_0x1e49fd(0x139)](readFileSync(_0x11802c,_0x1e49fd(0x13e)));return _0xd6c097['scripts']??{};}catch{return null;}}function a245_0x1b34(_0x17e0f0,_0x51233b){_0x17e0f0=_0x17e0f0-0x12a;const _0xa241bf=a245_0xa241();let _0x1b3489=_0xa241bf[_0x17e0f0];return _0x1b3489;}function detectPackageManager(_0x7f4454){const _0x542a0f=a245_0x599f59;if(existsSync(resolve(_0x7f4454,_0x542a0f(0x12b)))||existsSync(resolve(_0x7f4454,_0x542a0f(0x13d))))return _0x542a0f(0x12d);if(existsSync(resolve(_0x7f4454,'pnpm-lock.yaml')))return _0x542a0f(0x12a);if(existsSync(resolve(_0x7f4454,_0x542a0f(0x137))))return _0x542a0f(0x16e);return _0x542a0f(0x14c);}async function versionCheck(_0x60452b){const _0x115921=a245_0x599f59,_0x5ad0d1=await checkCliVersion();(_0x5ad0d1['needsUpgrade']||_0x5ad0d1[_0x115921(0x169)])&&(printCliUpgradeWarning(_0x5ad0d1),assertCliVersionSupported(_0x5ad0d1));const _0x16ef81=await checkSdkVersion(_0x60452b);if(_0x16ef81[_0x115921(0x147)])printSdkUpgradeWarning(_0x16ef81);}function spawnScript(_0x410d2e,_0x5611ed,_0x213fc5,_0x147f90){return new Promise((_0x345dcf,_0x893ee3)=>{const _0x2763c6=a245_0x1b34,_0x544a27=[_0x2763c6(0x13f),_0x5611ed,..._0x213fc5],_0x1c22f3=spawn(_0x410d2e,_0x544a27,{'cwd':_0x147f90,'stdio':_0x2763c6(0x138),'shell':!![],'env':{...process.env,'PATH':''+join(_0x147f90,_0x2763c6(0x15f),'.bin')+delimiter+process.env.PATH}});_0x1c22f3['on'](_0x2763c6(0x16b),_0x2b0b39=>{const _0x5d0eb5=_0x2763c6;if(_0x2b0b39===0x0||_0x2b0b39===null)_0x345dcf();else _0x893ee3(new Error(_0x410d2e+_0x5d0eb5(0x157)+_0x5611ed+_0x5d0eb5(0x15e)+_0x2b0b39));}),_0x1c22f3['on'](_0x2763c6(0x130),_0x893ee3);});}function spawnViteBuildWatch(_0x323842){return new Promise((_0x33062c,_0x200925)=>{const _0x1d2698=a245_0x1b34,_0x9dbb4d=spawn(_0x1d2698(0x14b),[_0x1d2698(0x134),_0x1d2698(0x136)],{'cwd':_0x323842,'stdio':_0x1d2698(0x138),'shell':!![],'env':{...process.env,'PATH':''+join(_0x323842,_0x1d2698(0x15f),'.bin')+delimiter+process.env.PATH}});_0x9dbb4d['on'](_0x1d2698(0x16b),_0x5e6825=>{const _0xbd09f=_0x1d2698;if(_0x5e6825===0x0||_0x5e6825===null)_0x33062c();else _0x200925(new Error(_0xbd09f(0x165)+_0x5e6825));}),_0x9dbb4d['on'](_0x1d2698(0x130),_0x200925);});}function spawnVitePreview(_0x1b048b){return new Promise((_0x15cdde,_0x728f88)=>{const _0x36a1ee=a245_0x1b34,_0x48a50e=spawn('vite',[_0x36a1ee(0x13a)],{'cwd':_0x1b048b,'stdio':_0x36a1ee(0x138),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1b048b,_0x36a1ee(0x15f),_0x36a1ee(0x146))+delimiter+process.env.PATH}});_0x48a50e['on']('close',_0x326912=>{const _0x5381e8=_0x36a1ee;if(_0x326912===0x0||_0x326912===null)_0x15cdde();else _0x728f88(new Error(_0x5381e8(0x16a)+_0x326912));}),_0x48a50e['on'](_0x36a1ee(0x130),_0x728f88);});}function a245_0xa241(){const _0xcc9804=['48fpHakG','Enable\x20watch\x20mode\x20for\x20preview','yarn','\x0a\x20\x20Usage:\x20','cwd','package.json','pnpm','bun.lockb','\x22\x20not\x20found\x20in\x20package.json.','bun','2VvAReT','\x20run\x20<script>\x0a','error','keys','997171ZszkJj','1481648cVozsZ','build','10IVpwSW','--watch','yarn.lock','inherit','parse','preview','slice','write','bun.lock','utf-8','run','\x20run\x20preview','\x20run\x20build','\x20run\x20preview\x20--watch','No\x20package.json\x20found\x20in\x20current\x20directory.','No\x20scripts\x20defined\x20in\x20package.json.','5510piVASx','.bin','needsUpgrade','log','Script\x20name\x20defined\x20in\x20package.json','\x0a\x20\x20Available\x20scripts:\x0a','vite','npm','dev','Run\x20a\x20package.json\x20script','changed','all','Available:\x20','1763636kaCAAA','1442313xzHMUC','validation','has','1078728NnQEuA','\x20run\x20','1761243UxpPTJ','start','Domain\x20routing\x20synchronized:\x20','watch','\x20\x20EXAMPLES','path','\x20exited\x20with\x20code\x20','node_modules','\x20\x20\x20\x20','Script\x20\x22','join','push','29612ksRVHL','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20run\x20start','args','bool','belowMinimum','vite\x20preview\x20exited\x20with\x20code\x20','close'];a245_0xa241=function(){return _0xcc9804;};return a245_0xa241();}const runFlags=[{'name':a245_0x599f59(0x15b),'type':'boolean','description':a245_0x599f59(0x16d),'default':![]}];export const runDefinition={'service':a245_0x599f59(0x13f),'command':'run','description':a245_0x599f59(0x14e),'risk':a245_0x599f59(0x13c),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a245_0x599f59(0x149),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x390a33=a245_0x599f59,_0x5a1487=[];return _0x5a1487[_0x390a33(0x163)](_0x390a33(0x15c)),_0x5a1487[_0x390a33(0x163)](_0x390a33(0x160)+CLI_BIN_NAME+_0x390a33(0x166)),_0x5a1487[_0x390a33(0x163)](_0x390a33(0x160)+CLI_BIN_NAME+_0x390a33(0x141)),_0x5a1487['push'](_0x390a33(0x160)+CLI_BIN_NAME+_0x390a33(0x140)),_0x5a1487[_0x390a33(0x163)](_0x390a33(0x160)+CLI_BIN_NAME+_0x390a33(0x142)),_0x5a1487[_0x390a33(0x162)]('\x0a');},async 'execute'(_0x3b4bd9){const _0x2654d1=a245_0x599f59,_0x1e45b9=process[_0x2654d1(0x170)](),_0x3c67b9=_0x3b4bd9[_0x2654d1(0x167)][0x0],_0x398a08=_0x3b4bd9[_0x2654d1(0x167)][_0x2654d1(0x13b)](0x1),_0x9d04cd=readPackageScripts(_0x1e45b9);if(!_0x9d04cd)throw CliErrors['validation'](_0x2654d1(0x143));if(!_0x3c67b9){const _0x3b6416=Object[_0x2654d1(0x131)](_0x9d04cd);if(_0x3b6416['length']===0x0)console['log'](_0x2654d1(0x144));else{console['log'](_0x2654d1(0x14a));for(const _0x20358c of _0x3b6416){console[_0x2654d1(0x148)](_0x2654d1(0x160)+_0x20358c);}console[_0x2654d1(0x148)](_0x2654d1(0x16f)+CLI_BIN_NAME+_0x2654d1(0x12f));}return{'ok':!![]};}if(!_0x9d04cd[_0x3c67b9])throw CliErrors[_0x2654d1(0x154)](_0x2654d1(0x161)+_0x3c67b9+_0x2654d1(0x12c),_0x2654d1(0x151)+(Object['keys'](_0x9d04cd)['join'](',\x20')||'(none)'));const _0x5a3ee5=detectPackageManager(_0x1e45b9),_0x1730e2=syncProjectDomainRoutingBeforeScript(_0x1e45b9,_0x3c67b9);_0x1730e2?.[_0x2654d1(0x14f)]&&console[_0x2654d1(0x130)](_0x2654d1(0x15a)+_0x1730e2[_0x2654d1(0x15d)]);VERSION_CHECK_SCRIPTS[_0x2654d1(0x155)](_0x3c67b9)&&await versionCheck(_0x1e45b9);if(_0x3c67b9===_0x2654d1(0x13a)&&_0x3b4bd9[_0x2654d1(0x168)](_0x2654d1(0x15b)))return await Promise[_0x2654d1(0x150)]([spawnViteBuildWatch(_0x1e45b9),spawnVitePreview(_0x1e45b9)]),{'ok':!![]};return await spawnScript(_0x5a3ee5,_0x3c67b9,_0x398a08,_0x1e45b9),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x93ef6d=a246_0x4f34;function a246_0x4f34(_0xd13647,_0x2cf494){_0xd13647=_0xd13647-0x159;const _0x31155d=a246_0x3115();let _0x4f34aa=_0x31155d[_0xd13647];return _0x4f34aa;}(function(_0x5966ce,_0x268d61){const _0x34f497=a246_0x4f34,_0x1d7168=_0x5966ce();while(!![]){try{const _0x416100=parseInt(_0x34f497(0x15e))/0x1+parseInt(_0x34f497(0x15f))/0x2+-parseInt(_0x34f497(0x15b))/0x3+-parseInt(_0x34f497(0x15d))/0x4*(parseInt(_0x34f497(0x160))/0x5)+parseInt(_0x34f497(0x159))/0x6*(parseInt(_0x34f497(0x15c))/0x7)+parseInt(_0x34f497(0x15a))/0x8+parseInt(_0x34f497(0x162))/0x9;if(_0x416100===_0x268d61)break;else _0x1d7168['push'](_0x1d7168['shift']());}catch(_0x2ba23c){_0x1d7168['push'](_0x1d7168['shift']());}}}(a246_0x3115,0xb476e));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x1fd9c9){const _0x1edf4f=await buildSchemaPayload();return{'ok':!![],'data':_0x1edf4f};}function a246_0x3115(){const _0x49065e=['262562fSKaZR','1054190HPDehv','schema','6395895VpsFTZ','18wIrHJL','596160zOxOZn','4032384ussfzo','2192148lzUBbL','12KycKfx','859876GAIVru'];a246_0x3115=function(){return _0x49065e;};return a246_0x3115();}export const schemaDefinition={'service':a246_0x93ef6d(0x161),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a247_0x517cef=a247_0x145c;(function(_0x1c486f,_0x3654cd){const _0x26746b=a247_0x145c,_0x180be2=_0x1c486f();while(!![]){try{const _0x1a0c39=-parseInt(_0x26746b(0xa6))/0x1*(-parseInt(_0x26746b(0x9c))/0x2)+parseInt(_0x26746b(0x80))/0x3*(parseInt(_0x26746b(0x91))/0x4)+-parseInt(_0x26746b(0x93))/0x5+parseInt(_0x26746b(0x89))/0x6*(-parseInt(_0x26746b(0xae))/0x7)+-parseInt(_0x26746b(0x86))/0x8+parseInt(_0x26746b(0xb6))/0x9+parseInt(_0x26746b(0x81))/0xa*(parseInt(_0x26746b(0xb2))/0xb);if(_0x1a0c39===_0x3654cd)break;else _0x180be2['push'](_0x180be2['shift']());}catch(_0x4fc8d5){_0x180be2['push'](_0x180be2['shift']());}}}(a247_0x26b3,0x585fd));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a247_0x145c(_0x47e1eb,_0x1bfb45){_0x47e1eb=_0x47e1eb-0x7d;const _0x26b305=a247_0x26b3();let _0x145cf6=_0x26b305[_0x47e1eb];return _0x145cf6;}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(_0x150abe){const _0x467aae=a247_0x145c;if(_0x150abe===_0x467aae(0x87))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x467aae(0xa9),_0x467aae(0x90),'']['join']('\x0a');return[_0x467aae(0x97),''][_0x467aae(0x82)]('\x0a');}export const sqlCreate={'service':a247_0x517cef(0x9d),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a247_0x517cef(0x94),'flags':[{'name':a247_0x517cef(0xb0),'type':a247_0x517cef(0x9e),'description':'SQL\x20query\x20display\x20name'},{'name':a247_0x517cef(0x9f),'type':a247_0x517cef(0x84),'description':'Target\x20database\x20ID'},{'name':a247_0x517cef(0xac),'type':'string','enum':[a247_0x517cef(0x9d),a247_0x517cef(0x87)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x5723db){const _0x598ebc=a247_0x517cef;if(!_0x5723db[_0x598ebc(0xad)])return;if(!_0x5723db[_0x598ebc(0x83)]('name')[_0x598ebc(0xb5)]())throw CliErrors[_0x598ebc(0x9b)](_0x598ebc(0xb0),_0x598ebc(0x8d));const _0xeb409c=resolveProvidedDbId(_0x5723db);if(typeof _0xeb409c!==_0x598ebc(0x84)||!Number['isFinite'](_0xeb409c)||_0xeb409c<=0x0)throw CliErrors[_0x598ebc(0x9b)](_0x598ebc(0x9f),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x5723db[_0x598ebc(0x83)](_0x598ebc(0xac))['trim']())throw CliErrors[_0x598ebc(0x9b)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0xd5b485){const _0x2b548d=a247_0x517cef,_0x21426a=loadSqlProjectConfig(_0xd5b485[_0x2b548d(0xaf)]),{sqlName:_0x23738d,dbId:_0x4b13cd,dbName:_0x215be7,mode:_0x544d1e}=await resolveSqlNewInputs(_0xd5b485),_0x4ee230=buildSqlRelativePath(_0x2b548d(0xa7),_0x23738d,_0x215be7,_0x544d1e,_0x4b13cd),_0x1c5b7f=_0x21426a[_0x2b548d(0x8f)]+'/'+_0x4ee230;return{'method':_0x2b548d(0x96),'url':_0x2b548d(0xa3),'body':{'appCode':_0xd5b485[_0x2b548d(0xaf)],'sqlName':_0x23738d,'dbId':_0x4b13cd,'mode':_0x544d1e,'localPath':_0x1c5b7f},'description':_0x2b548d(0xa1)+_0x21426a[_0x2b548d(0x8f)]};},async 'execute'(_0x31298b){const _0x331ef8=a247_0x517cef,_0x3778c7=loadSqlProjectConfig(_0x31298b['appCode']),{sqlName:_0x237123,dbId:_0x55e2eb,dbName:_0x308027,mode:_0x4508f3}=await resolveSqlNewInputs(_0x31298b),_0x34e837=generateSqlTemplate(_0x4508f3),_0x106b18=await createSqlQuery({'appCode':_0x31298b[_0x331ef8(0xaf)],'sqlName':_0x237123,'dbId':_0x55e2eb,'sqlContent':_0x34e837}),_0x29c7f4=ensureRemoteSqlContent(_0x106b18),_0xf24741=_0x308027||await getDbName(_0x31298b[_0x331ef8(0xaf)],_0x55e2eb)[_0x331ef8(0x85)](()=>undefined),_0xdfc6b8=buildSqlRelativePath(_0x106b18[_0x331ef8(0x8a)],_0x106b18[_0x331ef8(0x95)],_0xf24741,_0x4508f3,_0x55e2eb),_0x4c181=_0x3778c7[_0x331ef8(0x8f)]+'/'+_0xdfc6b8,_0x166ec0=buildLocalSqlFileContent({'sqlCode':_0x106b18['sqlCode'],'sqlName':_0x106b18[_0x331ef8(0x95)],'dbId':_0x106b18[_0x331ef8(0xb1)]},_0x29c7f4,{'dbName':_0xf24741,'mode':_0x4508f3,'syncedAt':new Date()[_0x331ef8(0xb7)](),'description':_0x106b18['description']});if(await fileExists(_0x4c181))throw CliErrors['validation'](_0x331ef8(0xa0)+_0x4c181);await ensureParentDirectory(_0x4c181),await writeFile(_0x4c181,_0x166ec0,_0x331ef8(0xa4));const _0x4280f6=await readSqlLockFile(_0x3778c7['lockFilePath']),{lockData:_0x5f3495,appLock:_0x4cd4fb}=ensureSqlLockScope(_0x4280f6??createEmptySqlLock(),_0x3778c7[_0x331ef8(0xaf)],_0x3778c7[_0x331ef8(0xa8)],'new');return _0x4cd4fb['sqls'][_0x106b18[_0x331ef8(0x8a)]]={...buildSqlLockEntry(_0x106b18,_0x29c7f4,computeSqlContentHash(_0x166ec0),{'dbName':_0xf24741}),'path':_0xdfc6b8,'mode':_0x4508f3},_0x4cd4fb[_0x331ef8(0x98)]=new Date()[_0x331ef8(0xb7)](),await writeSqlLockFile(_0x3778c7['lockFilePath'],_0x5f3495),{'ok':!![],'data':{'id':_0x106b18['id'],'sqlCode':_0x106b18[_0x331ef8(0x8a)],'sqlName':_0x106b18['sqlName'],'dbId':_0x106b18['dbId'],'path':_0x4c181,'mode':_0x4508f3},'message':'Created\x20SQL\x20query\x20'+_0x106b18[_0x331ef8(0x8a)]};}};async function resolveSqlNewInputs(_0x12398e){const _0x33510c=await resolveSqlNameInput(_0x12398e),{dbId:_0x4de2fd,dbName:_0x17b9e4}=await resolveDbSelection(_0x12398e),_0x431d4e=await resolveSqlModeInput(_0x12398e);return{'sqlName':_0x33510c,'dbId':_0x4de2fd,'dbName':_0x17b9e4,'mode':_0x431d4e};}function a247_0x26b3(){const _0x5ccf4e=['write','sqlName','POST','SELECT\x201\x20AS\x20id;','lastSync','length','Target\x20database\x20dbId:','flagMissing','4698aVRgok','sql','string','db-id','File\x20already\x20exists:\x20','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','__manual__','/smartapi/custom/saveUserCustomSql','utf8','dbId\x20must\x20be\x20a\x20positive\x20integer','131JpBZtG','<server-generated-sqlCode>','sqlRoot','\x20\x20SELECT\x201\x20AS\x20id','SQL\x20name:','Plain\x20SQL\x20(sql)','mode','nonInteractive','975107hYewkU','appCode','name','dbId','4446959PPgCoM','SQL\x20name\x20cannot\x20be\x20empty','dbId\x20cannot\x20be\x20empty','trim','4602816ryvvgr','toISOString','isInteger','MyBatis\x20XML\x20(mybatisXml)','validation','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','stringify','dbName','171471TzrgDQ','10keOjHU','join','str','number','catch','3682656joxYUp','mybatisXml','isFinite','6EaVdDz','sqlCode','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','✎\x20Enter\x20dbId\x20manually','sqlRootDir','</select>','4POSdKs','Select\x20the\x20target\x20database:','1594775JTjQTD'];a247_0x26b3=function(){return _0x5ccf4e;};return a247_0x26b3();}async function resolveSqlNameInput(_0x58e2c3){const _0x302be0=a247_0x517cef,_0x2166e3=_0x58e2c3['str'](_0x302be0(0xb0))[_0x302be0(0xb5)]();if(_0x2166e3)return _0x2166e3;if(_0x58e2c3['nonInteractive'])throw CliErrors[_0x302be0(0x9b)](_0x302be0(0xb0),_0x302be0(0x8d));return(await input({'message':_0x302be0(0xaa),'validate':_0x52233a=>_0x52233a[_0x302be0(0xb5)]()?!![]:_0x302be0(0xb3)}))['trim']();}async function resolveDbSelection(_0x156a84){const _0x8e88de=a247_0x517cef,_0x5694d6=resolveProvidedDbId(_0x156a84);if(typeof _0x5694d6===_0x8e88de(0x84)&&Number[_0x8e88de(0x88)](_0x5694d6)&&_0x5694d6>0x0)return{'dbId':_0x5694d6,'dbName':await getDbName(_0x156a84[_0x8e88de(0xaf)],_0x5694d6)[_0x8e88de(0x85)](()=>undefined)};if(_0x156a84[_0x8e88de(0xad)])throw CliErrors[_0x8e88de(0x9b)](_0x8e88de(0x9f),_0x8e88de(0x8b));const _0x32064b=await listDatabases(_0x156a84[_0x8e88de(0xaf)])[_0x8e88de(0x85)](()=>[]);if(_0x32064b[_0x8e88de(0x99)]===0x1)return{'dbId':_0x32064b[0x0][_0x8e88de(0xb1)],'dbName':_0x32064b[0x0][_0x8e88de(0x7f)]};if(_0x32064b[_0x8e88de(0x99)]>0x1){const _0x44b7b0=await select({'message':_0x8e88de(0x92),'choices':[..._0x32064b['map'](_0x74d856=>({'name':_0x74d856[_0x8e88de(0x7f)]+'\x20('+_0x74d856[_0x8e88de(0xb1)]+')','value':serializeDbSelection(_0x74d856)})),{'name':_0x8e88de(0x8e),'value':'__manual__'}]});if(_0x44b7b0!==_0x8e88de(0xa2))return deserializeDbSelection(_0x44b7b0);}const _0xa7c522=await input({'message':_0x8e88de(0x9a),'validate':_0x27d20a=>{const _0x1b3f17=_0x8e88de,_0x13e07d=_0x27d20a[_0x1b3f17(0xb5)]();if(!_0x13e07d)return _0x1b3f17(0xb4);const _0x8716b=Number(_0x13e07d);if(!Number[_0x1b3f17(0xb8)](_0x8716b)||_0x8716b<=0x0)return _0x1b3f17(0xa5);return!![];}});return{'dbId':Number(_0xa7c522[_0x8e88de(0xb5)]())};}async function resolveSqlModeInput(_0x117647){const _0x1921a6=a247_0x517cef,_0xdce764=_0x117647['str'](_0x1921a6(0xac))['trim']();if(_0xdce764===_0x1921a6(0x9d)||_0xdce764===_0x1921a6(0x87))return _0xdce764;if(_0x117647[_0x1921a6(0xad)])throw CliErrors[_0x1921a6(0x9b)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':_0x1921a6(0xab),'value':_0x1921a6(0x9d),'description':_0x1921a6(0x8c)},{'name':_0x1921a6(0xb9),'value':_0x1921a6(0x87),'description':_0x1921a6(0x7d)}]});}function serializeDbSelection(_0x54c3e5){const _0x459ff4=a247_0x517cef;return JSON[_0x459ff4(0x7e)]({'dbId':_0x54c3e5[_0x459ff4(0xb1)],'dbName':_0x54c3e5[_0x459ff4(0x7f)]});}function deserializeDbSelection(_0x132099){const _0x359386=a247_0x517cef;try{const _0x4c5554=JSON['parse'](_0x132099);if(typeof _0x4c5554['dbId']==='number'&&Number['isFinite'](_0x4c5554[_0x359386(0xb1)]))return{'dbId':_0x4c5554[_0x359386(0xb1)],'dbName':_0x4c5554[_0x359386(0x7f)]};}catch{}throw CliErrors[_0x359386(0xba)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x132099);}function resolveProvidedDbId(_0x572ffc){const _0x384728=a247_0x517cef,_0x237b5d=_0x572ffc['flag'](_0x384728(0x9f));if(typeof _0x237b5d===_0x384728(0x84)&&Number[_0x384728(0x88)](_0x237b5d))return _0x237b5d;return undefined;}
|
|
1
|
+
const a247_0xce62b3=a247_0x26c6;(function(_0x262efa,_0x335d71){const _0x23a803=a247_0x26c6,_0x5ab64b=_0x262efa();while(!![]){try{const _0x5abfcf=parseInt(_0x23a803(0xea))/0x1+-parseInt(_0x23a803(0xcb))/0x2*(-parseInt(_0x23a803(0xda))/0x3)+-parseInt(_0x23a803(0xf2))/0x4*(parseInt(_0x23a803(0xfa))/0x5)+-parseInt(_0x23a803(0xcf))/0x6*(-parseInt(_0x23a803(0xe1))/0x7)+parseInt(_0x23a803(0xc3))/0x8+-parseInt(_0x23a803(0xf3))/0x9*(-parseInt(_0x23a803(0xf6))/0xa)+parseInt(_0x23a803(0xd7))/0xb*(-parseInt(_0x23a803(0xed))/0xc);if(_0x5abfcf===_0x335d71)break;else _0x5ab64b['push'](_0x5ab64b['shift']());}catch(_0x5bc2fc){_0x5ab64b['push'](_0x5ab64b['shift']());}}}(a247_0x148e,0x34e88));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';function a247_0x26c6(_0x18d78c,_0x259ae6){_0x18d78c=_0x18d78c-0xbd;const _0x148e3c=a247_0x148e();let _0x26c6e0=_0x148e3c[_0x18d78c];return _0x26c6e0;}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(_0x33ed1b){const _0x4b43ed=a247_0x26c6;if(_0x33ed1b==='mybatisXml')return[_0x4b43ed(0xe3),'\x20\x20SELECT\x201\x20AS\x20id',_0x4b43ed(0xf8),''][_0x4b43ed(0xd4)]('\x0a');return[_0x4b43ed(0xcc),''][_0x4b43ed(0xd4)]('\x0a');}export const sqlCreate={'service':'sql','command':a247_0xce62b3(0xd1),'description':a247_0xce62b3(0xd2),'risk':a247_0xce62b3(0xd5),'flags':[{'name':a247_0xce62b3(0x100),'type':a247_0xce62b3(0xc6),'description':a247_0xce62b3(0xbe)},{'name':a247_0xce62b3(0xe5),'type':a247_0xce62b3(0xc9),'description':'Target\x20database\x20ID'},{'name':a247_0xce62b3(0xf4),'type':'string','enum':[a247_0xce62b3(0xc8),a247_0xce62b3(0xf5)],'description':a247_0xce62b3(0xf7)}],async 'validate'(_0x585e0c){const _0x4fceba=a247_0xce62b3;if(!_0x585e0c[_0x4fceba(0xef)])return;if(!_0x585e0c['str'](_0x4fceba(0x100))['trim']())throw CliErrors[_0x4fceba(0xc5)]('name',_0x4fceba(0xfd));const _0x5b4297=resolveProvidedDbId(_0x585e0c);if(typeof _0x5b4297!==_0x4fceba(0xc9)||!Number[_0x4fceba(0xee)](_0x5b4297)||_0x5b4297<=0x0)throw CliErrors['flagMissing']('db-id',_0x4fceba(0xde));if(!_0x585e0c['str']('mode')[_0x4fceba(0xc1)]())throw CliErrors[_0x4fceba(0xc5)](_0x4fceba(0xf4),_0x4fceba(0xd8));},async 'dryRun'(_0x260079){const _0x4fd6bf=a247_0xce62b3,_0x5e9c11=loadSqlProjectConfig(_0x260079[_0x4fd6bf(0xfe)]),{sqlName:_0x4251e3,dbId:_0xe7e4d9,dbName:_0x192c08,mode:_0x3d855a}=await resolveSqlNewInputs(_0x260079),_0xbde4d=buildSqlRelativePath(_0x4fd6bf(0xf9),_0x4251e3,_0x192c08,_0x3d855a,_0xe7e4d9),_0x1a23ca=_0x5e9c11[_0x4fd6bf(0x102)]+'/'+_0xbde4d;return{'method':_0x4fd6bf(0xd3),'url':_0x4fd6bf(0xe7),'body':{'appCode':_0x260079[_0x4fd6bf(0xfe)],'sqlName':_0x4251e3,'dbId':_0xe7e4d9,'mode':_0x3d855a,'localPath':_0x1a23ca},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x5e9c11[_0x4fd6bf(0x102)]};},async 'execute'(_0x2a5d40){const _0x367ffa=a247_0xce62b3,_0x5970e7=loadSqlProjectConfig(_0x2a5d40[_0x367ffa(0xfe)]),{sqlName:_0x5ba33f,dbId:_0x5532a6,dbName:_0x7631ac,mode:_0x1743a8}=await resolveSqlNewInputs(_0x2a5d40),_0x567ebb=generateSqlTemplate(_0x1743a8),_0x358e01=await createSqlQuery({'appCode':_0x2a5d40[_0x367ffa(0xfe)],'sqlName':_0x5ba33f,'dbId':_0x5532a6,'sqlContent':_0x567ebb}),_0x377760=ensureRemoteSqlContent(_0x358e01),_0x3d0ef9=_0x7631ac||await getDbName(_0x2a5d40[_0x367ffa(0xfe)],_0x5532a6)['catch'](()=>undefined),_0x5348ee=buildSqlRelativePath(_0x358e01[_0x367ffa(0xff)],_0x358e01[_0x367ffa(0xca)],_0x3d0ef9,_0x1743a8,_0x5532a6),_0x521fb5=_0x5970e7[_0x367ffa(0x102)]+'/'+_0x5348ee,_0x1df0ff=buildLocalSqlFileContent({'sqlCode':_0x358e01[_0x367ffa(0xff)],'sqlName':_0x358e01[_0x367ffa(0xca)],'dbId':_0x358e01[_0x367ffa(0xe0)]},_0x377760,{'dbName':_0x3d0ef9,'mode':_0x1743a8,'syncedAt':new Date()[_0x367ffa(0xce)](),'description':_0x358e01[_0x367ffa(0xc0)]});if(await fileExists(_0x521fb5))throw CliErrors['validation'](_0x367ffa(0xdc)+_0x521fb5);await ensureParentDirectory(_0x521fb5),await writeFile(_0x521fb5,_0x1df0ff,'utf8');const _0xe42b7c=await readSqlLockFile(_0x5970e7[_0x367ffa(0xe4)]),{lockData:_0x13ad9d,appLock:_0x67407f}=ensureSqlLockScope(_0xe42b7c??createEmptySqlLock(),_0x5970e7[_0x367ffa(0xfe)],_0x5970e7[_0x367ffa(0xec)],_0x367ffa(0xbf));return _0x67407f['sqls'][_0x358e01[_0x367ffa(0xff)]]={...buildSqlLockEntry(_0x358e01,_0x377760,computeSqlContentHash(_0x1df0ff),{'dbName':_0x3d0ef9}),'path':_0x5348ee,'mode':_0x1743a8},_0x67407f[_0x367ffa(0xc7)]=new Date()[_0x367ffa(0xce)](),await writeSqlLockFile(_0x5970e7[_0x367ffa(0xe4)],_0x13ad9d),{'ok':!![],'data':{'id':_0x358e01['id'],'sqlCode':_0x358e01[_0x367ffa(0xff)],'sqlName':_0x358e01['sqlName'],'dbId':_0x358e01[_0x367ffa(0xe0)],'path':_0x521fb5,'mode':_0x1743a8},'message':'Created\x20SQL\x20query\x20'+_0x358e01['sqlCode']};}};async function resolveSqlNewInputs(_0x346e0e){const _0x19eb89=await resolveSqlNameInput(_0x346e0e),{dbId:_0x11a483,dbName:_0x4004b4}=await resolveDbSelection(_0x346e0e),_0x4186da=await resolveSqlModeInput(_0x346e0e);return{'sqlName':_0x19eb89,'dbId':_0x11a483,'dbName':_0x4004b4,'mode':_0x4186da};}async function resolveSqlNameInput(_0x16359f){const _0x28ea3f=a247_0xce62b3,_0x1120c9=_0x16359f[_0x28ea3f(0xf0)](_0x28ea3f(0x100))[_0x28ea3f(0xc1)]();if(_0x1120c9)return _0x1120c9;if(_0x16359f[_0x28ea3f(0xef)])throw CliErrors[_0x28ea3f(0xc5)](_0x28ea3f(0x100),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x279f20=>_0x279f20[_0x28ea3f(0xc1)]()?!![]:_0x28ea3f(0xd9)}))[_0x28ea3f(0xc1)]();}async function resolveDbSelection(_0x8f7f93){const _0x302b57=a247_0xce62b3,_0x23c32d=resolveProvidedDbId(_0x8f7f93);if(typeof _0x23c32d==='number'&&Number[_0x302b57(0xee)](_0x23c32d)&&_0x23c32d>0x0)return{'dbId':_0x23c32d,'dbName':await getDbName(_0x8f7f93[_0x302b57(0xfe)],_0x23c32d)[_0x302b57(0xcd)](()=>undefined)};if(_0x8f7f93[_0x302b57(0xef)])throw CliErrors[_0x302b57(0xc5)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x2f53cb=await listDatabases(_0x8f7f93[_0x302b57(0xfe)])[_0x302b57(0xcd)](()=>[]);if(_0x2f53cb['length']===0x1)return{'dbId':_0x2f53cb[0x0][_0x302b57(0xe0)],'dbName':_0x2f53cb[0x0][_0x302b57(0x101)]};if(_0x2f53cb[_0x302b57(0xe8)]>0x1){const _0x526c33=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x2f53cb[_0x302b57(0xe9)](_0x46d354=>({'name':_0x46d354[_0x302b57(0x101)]+'\x20('+_0x46d354[_0x302b57(0xe0)]+')','value':serializeDbSelection(_0x46d354)})),{'name':_0x302b57(0xd6),'value':_0x302b57(0xdf)}]});if(_0x526c33!==_0x302b57(0xdf))return deserializeDbSelection(_0x526c33);}const _0x13892c=await input({'message':_0x302b57(0xe2),'validate':_0x47639e=>{const _0x25c321=_0x302b57,_0x309aae=_0x47639e[_0x25c321(0xc1)]();if(!_0x309aae)return _0x25c321(0xbd);const _0x439ddf=Number(_0x309aae);if(!Number[_0x25c321(0xe6)](_0x439ddf)||_0x439ddf<=0x0)return _0x25c321(0xdb);return!![];}});return{'dbId':Number(_0x13892c['trim']())};}async function resolveSqlModeInput(_0xe050aa){const _0x1f031e=a247_0xce62b3,_0x17711f=_0xe050aa[_0x1f031e(0xf0)](_0x1f031e(0xf4))[_0x1f031e(0xc1)]();if(_0x17711f===_0x1f031e(0xc8)||_0x17711f===_0x1f031e(0xf5))return _0x17711f;if(_0xe050aa['nonInteractive'])throw CliErrors['flagMissing']('mode',_0x1f031e(0xd8));return await select({'message':_0x1f031e(0xfc),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x1f031e(0xc8),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x1f031e(0xc2),'value':_0x1f031e(0xf5),'description':_0x1f031e(0xf1)}]});}function serializeDbSelection(_0x16e2ed){const _0x6e8806=a247_0xce62b3;return JSON[_0x6e8806(0xeb)]({'dbId':_0x16e2ed[_0x6e8806(0xe0)],'dbName':_0x16e2ed['dbName']});}function deserializeDbSelection(_0x13b939){const _0x2e43f6=a247_0xce62b3;try{const _0x44956f=JSON[_0x2e43f6(0xd0)](_0x13b939);if(typeof _0x44956f[_0x2e43f6(0xe0)]===_0x2e43f6(0xc9)&&Number[_0x2e43f6(0xee)](_0x44956f[_0x2e43f6(0xe0)]))return{'dbId':_0x44956f[_0x2e43f6(0xe0)],'dbName':_0x44956f['dbName']};}catch{}throw CliErrors[_0x2e43f6(0xfb)](_0x2e43f6(0xdd)+_0x13b939);}function resolveProvidedDbId(_0xe2e0ec){const _0x22f88a=a247_0xce62b3,_0x1e589b=_0xe2e0ec[_0x22f88a(0xc4)](_0x22f88a(0xe5));if(typeof _0x1e589b===_0x22f88a(0xc9)&&Number[_0x22f88a(0xee)](_0x1e589b))return _0x1e589b;return undefined;}function a247_0x148e(){const _0x54582c=['Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','POST','join','write','✎\x20Enter\x20dbId\x20manually','1595jOVwMh','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name\x20cannot\x20be\x20empty','408xvVbQS','dbId\x20must\x20be\x20a\x20positive\x20integer','File\x20already\x20exists:\x20','Invalid\x20database\x20selection\x20payload:\x20','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','__manual__','dbId','25459Arpxpn','Target\x20database\x20dbId:','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','lockFilePath','db-id','isInteger','/smartapi/custom/saveUserCustomSql','length','map','311653rxYvpW','stringify','sqlRoot','43308IOrMGr','isFinite','nonInteractive','str','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','344YsAzFX','123426gDOnIy','mode','mybatisXml','40qKiClr','Local\x20SQL\x20file\x20mode','</select>','<server-generated-sqlCode>','13840MLIIJz','validation','Select\x20the\x20local\x20SQL\x20mode:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','appCode','sqlCode','name','dbName','sqlRootDir','dbId\x20cannot\x20be\x20empty','SQL\x20query\x20display\x20name','new','description','trim','MyBatis\x20XML\x20(mybatisXml)','1718008vqeTCm','flag','flagMissing','string','lastSync','sql','number','sqlName','5354YSNruf','SELECT\x201\x20AS\x20id;','catch','toISOString','54gPslgq','parse','create'];a247_0x148e=function(){return _0x54582c;};return a247_0x148e();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x5f2078=a248_0x3ac0;(function(_0x2fa61e,_0x1f08bf){const _0x562e2d=a248_0x3ac0,_0x4b06f0=_0x2fa61e();while(!![]){try{const _0x248fe8=-parseInt(_0x562e2d(0x1fe))/0x1+parseInt(_0x562e2d(0x201))/0x2+parseInt(_0x562e2d(0x204))/0x3+parseInt(_0x562e2d(0x1e9))/0x4+-parseInt(_0x562e2d(0x1f6))/0x5*(-parseInt(_0x562e2d(0x200))/0x6)+parseInt(_0x562e2d(0x1f9))/0x7+-parseInt(_0x562e2d(0x1f3))/0x8;if(_0x248fe8===_0x1f08bf)break;else _0x4b06f0['push'](_0x4b06f0['shift']());}catch(_0x398e4b){_0x4b06f0['push'](_0x4b06f0['shift']());}}}(a248_0x1075,0x42394));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a248_0x1075(){const _0xe1e51b=['No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','1421508yIiDQo','Would\x20delete\x20SQL\x20','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','remoteId','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRoot','delete','sqls','/smartapi/custom/deleteUserCustomSql','toISOString','6954112XpORCb','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','high-risk-write','5JOdebE','POST','projectRoot','2030798FcYMub','lockFilePath','Deleted\x20','trashedTo','validation','393643FMFYrW','appCode','1851384yXurLL','1016282AXxJNO','sqlcode','entries','215889huNOnv','startsWith','trashDir','str'];a248_0x1075=function(){return _0xe1e51b;};return a248_0x1075();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x3ac0(_0x27af13,_0x34ab52){_0x27af13=_0x27af13-0x1e9;const _0x107568=a248_0x1075();let _0x3ac0e4=_0x107568[_0x27af13];return _0x3ac0e4;}import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a248_0x5f2078(0x1ef),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a248_0x5f2078(0x1f5),'flags':[SQLCODE_FLAG],async 'validate'(_0x163e4a){const _0x1c0479=a248_0x5f2078,_0x5ed0d0=loadSqlProjectConfig(_0x163e4a[_0x1c0479(0x1ff)]),_0x588637=await readSqlLockFile(_0x5ed0d0[_0x1c0479(0x1fa)]);if(!_0x588637)throw CliErrors[_0x1c0479(0x1fd)](_0x1c0479(0x1f4));},async 'dryRun'(_0x88bf65){const _0x585102=a248_0x5f2078,_0xe87a90=loadSqlProjectConfig(_0x88bf65[_0x585102(0x1ff)]),_0x2aa3d8=await readSqlLockFile(_0xe87a90[_0x585102(0x1fa)]);if(!_0x2aa3d8)throw CliErrors[_0x585102(0x1fd)](_0x585102(0x1f4));const {appLock:_0x4e5dcb}=ensureSqlLockScope(_0x2aa3d8,_0x88bf65[_0x585102(0x1ff)],_0xe87a90['sqlRoot'],_0x585102(0x1ef)),_0x46e99b=_0x88bf65['str'](_0x585102(0x202)),_0x35c10b=_0x4e5dcb[_0x585102(0x1f0)][_0x46e99b];if(!_0x35c10b)throw CliErrors[_0x585102(0x1fd)](_0x585102(0x208)+_0x46e99b+'\x22.');return{'method':_0x585102(0x1f7),'url':_0x585102(0x1f1),'body':{'sqlCode':_0x46e99b,'id':_0x35c10b[_0x585102(0x1ec)],'localPath':resolveLocalSqlFilePath(_0xe87a90,_0x46e99b,_0x35c10b)},'description':_0x585102(0x1ea)+_0x46e99b+_0x585102(0x1eb)+_0xe87a90[_0x585102(0x206)]};},async 'execute'(_0x41b3b2){const _0x30471f=a248_0x5f2078,_0x1b9891=loadSqlProjectConfig(_0x41b3b2['appCode']),_0x3dc5ed=await readSqlLockFile(_0x1b9891[_0x30471f(0x1fa)]);if(!_0x3dc5ed)throw CliErrors[_0x30471f(0x1fd)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x43d98b,appLock:_0x38697d}=ensureSqlLockScope(_0x3dc5ed,_0x41b3b2['appCode'],_0x1b9891[_0x30471f(0x1ee)],_0x30471f(0x1ef)),_0x52fb96=_0x41b3b2[_0x30471f(0x207)](_0x30471f(0x202)),_0x357305=_0x38697d[_0x30471f(0x1f0)][_0x52fb96];if(!_0x357305)throw CliErrors[_0x30471f(0x1fd)](_0x30471f(0x208)+_0x52fb96+'\x22.');await deleteSqlQuery({'id':_0x357305['remoteId'],'sqlCode':_0x52fb96}),_0x38697d[_0x30471f(0x1f0)]=Object['fromEntries'](Object[_0x30471f(0x203)](_0x38697d[_0x30471f(0x1f0)])['filter'](([_0x1ae6e0])=>_0x1ae6e0!==_0x52fb96)),_0x38697d['lastSync']=new Date()[_0x30471f(0x1f2)](),await writeSqlLockFile(_0x1b9891[_0x30471f(0x1fa)],_0x43d98b);const _0x3dd3e8=resolveLocalSqlFilePath(_0x1b9891,_0x52fb96,_0x357305);let _0x43023d;await fileExists(_0x3dd3e8)&&(_0x43023d=await moveToTrash(_0x1b9891[_0x30471f(0x1f8)],_0x1b9891[_0x30471f(0x206)],_0x3dd3e8),await cleanupEmptyDirectories(dirname(_0x3dd3e8),_0x1b9891['sqlRootDir']));const _0x4e0528={'deleted':_0x52fb96,'remoteId':_0x357305[_0x30471f(0x1ec)]};if(_0x43023d)_0x4e0528[_0x30471f(0x1fc)]=_0x43023d;return{'ok':!![],'data':_0x4e0528,'message':_0x30471f(0x1fb)+_0x52fb96+(_0x43023d?_0x30471f(0x1ed):'')};}};async function moveToTrash(_0x3d13b3,_0x14fc51,_0x2877e5){const _0x15952a=a248_0x5f2078,_0x4ae245=new Date()[_0x15952a(0x1f2)]()['replace'](/[:.]/g,'-'),_0x3470f2=relative(_0x3d13b3,_0x2877e5),_0x4436ee=join(_0x14fc51,_0x4ae245,_0x3470f2);return await mkdir(dirname(_0x4436ee),{'recursive':!![]}),await rename(_0x2877e5,_0x4436ee),_0x4436ee;}async function cleanupEmptyDirectories(_0x529562,_0x50605f){const _0x5eb882=a248_0x5f2078;let _0x2d2f52=resolve(_0x529562);const _0x43477f=resolve(_0x50605f);while(_0x2d2f52[_0x5eb882(0x205)](''+_0x43477f+sep)||_0x2d2f52===_0x43477f){if(_0x2d2f52===_0x43477f)return;try{const _0x571dba=await readdir(_0x2d2f52);if(_0x571dba['length']>0x0)return;await rmdir(_0x2d2f52);}catch{return;}_0x2d2f52=dirname(_0x2d2f52);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a249_0x57e477=a249_0x62ca;(function(_0x26b7ef,_0x2d43ab){const _0x4bb49b=a249_0x62ca,_0x4e3eec=_0x26b7ef();while(!![]){try{const _0x502da7=parseInt(_0x4bb49b(0x110))/0x1*(-parseInt(_0x4bb49b(0x10c))/0x2)+-parseInt(_0x4bb49b(0xfb))/0x3+parseInt(_0x4bb49b(0xfc))/0x4*(-parseInt(_0x4bb49b(0x102))/0x5)+-parseInt(_0x4bb49b(0x104))/0x6*(parseInt(_0x4bb49b(0x103))/0x7)+-parseInt(_0x4bb49b(0xfe))/0x8+-parseInt(_0x4bb49b(0x10e))/0x9*(-parseInt(_0x4bb49b(0x101))/0xa)+parseInt(_0x4bb49b(0x106))/0xb*(parseInt(_0x4bb49b(0x112))/0xc);if(_0x502da7===_0x2d43ab)break;else _0x4e3eec['push'](_0x4e3eec['shift']());}catch(_0x3918a6){_0x4e3eec['push'](_0x4e3eec['shift']());}}}(a249_0x1447,0xc424b));function a249_0x62ca(_0x5bd52d,_0x22cd0e){_0x5bd52d=_0x5bd52d-0xfb;const _0x144712=a249_0x1447();let _0x62ca2e=_0x144712[_0x5bd52d];return _0x62ca2e;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x57e477(0x10f),'command':a249_0x57e477(0xfd),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a249_0x57e477(0x109),'type':a249_0x57e477(0x107),'description':a249_0x57e477(0x10b)}],async 'execute'(_0x2bc70c){const _0x52fadc=a249_0x57e477,_0x37c308=await getSqlQueryInfo(_0x2bc70c[_0x52fadc(0x100)],_0x2bc70c['str'](_0x52fadc(0xff))),_0x2d61a9=_0x2bc70c[_0x52fadc(0x111)]('verbose');if(_0x2d61a9)return{'ok':!![],'data':_0x37c308};const _0x4675c5=_0x37c308[_0x52fadc(0x105)]?await getDbName(_0x2bc70c[_0x52fadc(0x100)],_0x37c308[_0x52fadc(0x105)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x37c308[_0x52fadc(0x10a)],'sqlName':_0x37c308['sqlName'],'db':_0x4675c5?_0x4675c5+'\x20('+_0x37c308[_0x52fadc(0x105)]+')':_0x37c308[_0x52fadc(0x105)]??'','description':_0x37c308[_0x52fadc(0x10d)]??'','sqlContent':_0x37c308[_0x52fadc(0x108)]??''}};}};function a249_0x1447(){const _0x2ad328=['sqlContent','verbose','sqlCode','Return\x20full\x20raw\x20SQL\x20query\x20object','47570xwuSBb','description','234585KJHkPA','sql','3MuZQpw','bool','12uTVVTb','1885497tCNjzH','335828AYXRKX','detail','5403872CzNMMO','sqlcode','appCode','10TxqnCz','20GXPTyB','99505UyEjxX','6Kxetkm','dbId','27529909KJIgAn','boolean'];a249_0x1447=function(){return _0x2ad328;};return a249_0x1447();}
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a250_0x20d9f9=a250_0xcca9;(function(_0x3d0bae,_0x47ec51){const _0x1d58c6=a250_0xcca9,_0x13df52=_0x3d0bae();while(!![]){try{const _0x171e01=parseInt(_0x1d58c6(0x171))/0x1*(-parseInt(_0x1d58c6(0x180))/0x2)+parseInt(_0x1d58c6(0x174))/0x3+parseInt(_0x1d58c6(0x179))/0x4*(-parseInt(_0x1d58c6(0x177))/0x5)+parseInt(_0x1d58c6(0x17f))/0x6+-parseInt(_0x1d58c6(0x173))/0x7+-parseInt(_0x1d58c6(0x172))/0x8+parseInt(_0x1d58c6(0x176))/0x9*(parseInt(_0x1d58c6(0x178))/0xa);if(_0x171e01===_0x47ec51)break;else _0x13df52['push'](_0x13df52['shift']());}catch(_0x520c24){_0x13df52['push'](_0x13df52['shift']());}}}(a250_0x3a2d,0xc0492));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a250_0x3a2d(){const _0x5b5758=['str','appCode','\x20row(s)\x20in\x20','exec','execError','params','6DcciHi','2072832ZAHdWr','451626gCGucN','1444062TulXCA','SQL\x20execution\x20failed','621Nxcxfb','5jtANPd','157430OeSalm','2757244NmQTpV','execResult','string','sqlcode','sql','execSuccess','4486032dQRZZs','171586aKQwxv','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','length'];a250_0x3a2d=function(){return _0x5b5758;};return a250_0x3a2d();}function a250_0xcca9(_0x330830,_0x3fcd2d){_0x330830=_0x330830-0x16e;const _0x3a2d64=a250_0x3a2d();let _0xcca9a2=_0x3a2d64[_0x330830];return _0xcca9a2;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a250_0x20d9f9(0x17d),'command':a250_0x20d9f9(0x16e),'description':a250_0x20d9f9(0x181),'risk':'read','flags':[SQLCODE_FLAG,{'name':'params','type':a250_0x20d9f9(0x17b),'description':a250_0x20d9f9(0x182)}],async 'execute'(_0x336a37){const _0x180770=a250_0x20d9f9,_0x53178c=parseJsonParams(_0x336a37[_0x180770(0x184)](_0x180770(0x170))),_0x4cd403=Date['now'](),_0x32fd5a=await executeSql(_0x336a37[_0x180770(0x185)],_0x336a37[_0x180770(0x184)](_0x180770(0x17c)),_0x53178c),_0x15266a=Date['now']()-_0x4cd403,_0x45698c=_0x32fd5a?.[_0x180770(0x17a)]??_0x32fd5a,_0x25bec0=_0x32fd5a?.[_0x180770(0x17e)]??!![];if(!_0x25bec0)return{'ok':![],'data':{'error':_0x32fd5a?.[_0x180770(0x16f)]||_0x180770(0x175),'elapsed':_0x15266a},'message':'SQL\x20execution\x20failed'};const _0x2d28f9=Array['isArray'](_0x45698c)?_0x45698c:[];return{'ok':!![],'data':{'rows':_0x2d28f9,'rowCount':_0x2d28f9[_0x180770(0x183)],'elapsed':_0x15266a},'message':'Returned\x20'+_0x2d28f9[_0x180770(0x183)]+_0x180770(0x186)+_0x15266a+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4b0748,_0x2708bb){const _0x4417d7=a251_0x2b78,_0x3157d4=_0x4b0748();while(!![]){try{const _0x54f112=parseInt(_0x4417d7(0x89))/0x1*(parseInt(_0x4417d7(0x8d))/0x2)+parseInt(_0x4417d7(0x8e))/0x3*(parseInt(_0x4417d7(0x83))/0x4)+-parseInt(_0x4417d7(0x8c))/0x5*(parseInt(_0x4417d7(0x8b))/0x6)+-parseInt(_0x4417d7(0x88))/0x7*(parseInt(_0x4417d7(0x86))/0x8)+parseInt(_0x4417d7(0x87))/0x9*(parseInt(_0x4417d7(0x84))/0xa)+-parseInt(_0x4417d7(0x8a))/0xb+-parseInt(_0x4417d7(0x85))/0xc;if(_0x54f112===_0x2708bb)break;else _0x3157d4['push'](_0x3157d4['shift']());}catch(_0x588a11){_0x3157d4['push'](_0x3157d4['shift']());}}}(a251_0x3c5c,0x5171a));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a251_0x3c5c(){const _0x3ade26=['16uuDZlO','10377JuyPHw','974197ydhPhH','743RVRdWB','1221891wPmZOh','2236356rRzklI','5pkwSSC','1724Pxzflj','349788HpcwLp','20HQlckx','4910UXJieO','8325912ELJTeS'];a251_0x3c5c=function(){return _0x3ade26;};return a251_0x3c5c();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a251_0x2b78(_0x4aaaca,_0x568fb5){_0x4aaaca=_0x4aaaca-0x83;const _0x3c5c19=a251_0x3c5c();let _0x2b78b2=_0x3c5c19[_0x4aaaca];return _0x2b78b2;}import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a252_0x13c748=a252_0x2c44;function a252_0x2c44(_0x43d0d9,_0x424b68){_0x43d0d9=_0x43d0d9-0x146;const _0x4b287c=a252_0x4b28();let _0x2c44f7=_0x4b287c[_0x43d0d9];return _0x2c44f7;}function a252_0x4b28(){const _0x3c445e=['49oKUjnQ','Found\x20','22090vStIdt','6JQsniG','page','Page\x20size','length','Filter\x20by\x20SQL\x20name','282vwVXpD','10940vXIiQz','241764nfvZty','299192JtklIl','1152kbGkne','pagesize','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','number','Page\x20number','totalCount','appCode','description','58456aUrjfz','name','bool','sqlCode','map','boolean','num','str','22100DWUUTJ','383572EqLeAs','sqlName','List\x20custom\x20SQL\x20queries','paging','dbId','read','110xsJrEG','string','sql','all','No\x20custom\x20SQL\x20queries\x20found.'];a252_0x4b28=function(){return _0x3c445e;};return a252_0x4b28();}(function(_0x356503,_0x785d4a){const _0x244ddf=a252_0x2c44,_0x40ae65=_0x356503();while(!![]){try{const _0x46bdfa=-parseInt(_0x244ddf(0x167))/0x1+-parseInt(_0x244ddf(0x156))/0x2+-parseInt(_0x244ddf(0x14e))/0x3*(-parseInt(_0x244ddf(0x168))/0x4)+-parseInt(_0x244ddf(0x14d))/0x5*(-parseInt(_0x244ddf(0x153))/0x6)+parseInt(_0x244ddf(0x14b))/0x7*(-parseInt(_0x244ddf(0x15f))/0x8)+-parseInt(_0x244ddf(0x157))/0x9*(-parseInt(_0x244ddf(0x154))/0xa)+-parseInt(_0x244ddf(0x146))/0xb*(parseInt(_0x244ddf(0x155))/0xc);if(_0x46bdfa===_0x785d4a)break;else _0x40ae65['push'](_0x40ae65['shift']());}catch(_0x31683b){_0x40ae65['push'](_0x40ae65['shift']());}}}(a252_0x4b28,0x1c1cd));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x13c748(0x148),'command':'list','description':a252_0x13c748(0x16a),'risk':a252_0x13c748(0x16d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x13c748(0x160),'type':a252_0x13c748(0x147),'description':a252_0x13c748(0x152)},{'name':a252_0x13c748(0x14f),'type':'number','description':a252_0x13c748(0x15b),'default':0x1},{'name':a252_0x13c748(0x158),'type':a252_0x13c748(0x15a),'description':a252_0x13c748(0x150)},{'name':'verbose','type':a252_0x13c748(0x164),'description':a252_0x13c748(0x159)}],async 'execute'(_0x231109){const _0xb029c5=a252_0x13c748,_0x29c751=await listSqlQueries(_0x231109['appCode'],{'sqlCode':_0x231109[_0xb029c5(0x166)]('sqlcode')||undefined,'sqlName':_0x231109[_0xb029c5(0x166)](_0xb029c5(0x160))||undefined,'currentPage':_0x231109[_0xb029c5(0x165)]('page'),'pageSize':_0x231109[_0xb029c5(0x165)](_0xb029c5(0x158),0x32)}),_0x438833=_0x231109[_0xb029c5(0x161)]('verbose'),_0x44c192=_0x29c751['tableData']??[],_0x9444a3=_0x29c751[_0xb029c5(0x16b)]?.[_0xb029c5(0x15c)]??_0x44c192[_0xb029c5(0x151)];let _0x5643d9;return _0x438833?_0x5643d9=_0x44c192:_0x5643d9=await Promise[_0xb029c5(0x149)](_0x44c192[_0xb029c5(0x163)](async _0xe9137d=>{const _0x30dee4=_0xb029c5;let _0x3b7385;try{_0x3b7385=_0xe9137d[_0x30dee4(0x16c)]?await getDbName(_0x231109[_0x30dee4(0x15d)],_0xe9137d[_0x30dee4(0x16c)]):undefined;}catch{}return{'sqlCode':_0xe9137d[_0x30dee4(0x162)],'sqlName':_0xe9137d[_0x30dee4(0x169)],'description':_0xe9137d[_0x30dee4(0x15e)]??'','db':_0x3b7385?_0x3b7385+'\x20('+_0xe9137d[_0x30dee4(0x16c)]+')':_0xe9137d[_0x30dee4(0x16c)]??''};})),{'ok':!![],'data':_0x5643d9,'message':_0x44c192[_0xb029c5(0x151)]===0x0?_0xb029c5(0x14a):_0xb029c5(0x14c)+_0x44c192[_0xb029c5(0x151)]+'\x20SQL\x20queries\x20(total:\x20'+_0x9444a3+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a253_0x339f30=a253_0x14a5;function a253_0x14a5(_0x134164,_0x58e63a){_0x134164=_0x134164-0xaf;const _0x32ae3a=a253_0x32ae();let _0x14a585=_0x32ae3a[_0x134164];return _0x14a585;}(function(_0x59485c,_0xee4008){const _0x52d428=a253_0x14a5,_0x139b77=_0x59485c();while(!![]){try{const _0x1c24c7=parseInt(_0x52d428(0xe5))/0x1+parseInt(_0x52d428(0xd3))/0x2+parseInt(_0x52d428(0xf8))/0x3*(-parseInt(_0x52d428(0xe6))/0x4)+parseInt(_0x52d428(0xf6))/0x5*(-parseInt(_0x52d428(0xec))/0x6)+-parseInt(_0x52d428(0xef))/0x7+-parseInt(_0x52d428(0xaf))/0x8+parseInt(_0x52d428(0xbf))/0x9;if(_0x1c24c7===_0xee4008)break;else _0x139b77['push'](_0x139b77['shift']());}catch(_0x4b0f9c){_0x139b77['push'](_0x139b77['shift']());}}}(a253_0x32ae,0x67a93));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';function a253_0x32ae(){const _0xeaaecb=['catch','join','toLowerCase','POST','668900ICxVQq','425332zVVjFN','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','message','path','nonInteractive','content','18ryGhop','\x20written,\x20','replace','4716502vXBWeh','sqls','would_pull','local\x20differs\x20from\x20remote','isCanonical','dbId','.xml','454015QLaQPT','name','15IuZKKl','sqlName','2760536XvNYDr','mode','lockFilePath','equivalent','some','length','\x20skipped,\x20','Filter\x20by\x20SQL\x20display\x20name','sqlcode','toISOString','find','str','cancelled','string','paging','all','8464338CoUpbr','pull','tableData','Pull\x20complete:\x20','trim','sqlRoot','sqlRootDir','unchanged','appCode','description','hash','apps','split','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Force\x20overwrite\x20local\x20unsynced\x20changes','utf8','totalCount','\x20SQL\x20file(s)\x20into\x20','file','mybatisXml','1276280dieLOK','\x20failed','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlCode','read','sql','skipped','map','test','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlContent','endsWith','Would\x20pull\x20','push'];a253_0x32ae=function(){return _0xeaaecb;};return a253_0x32ae();}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(_0x188a2c,_0x514fba){const _0x3dda85=a253_0x14a5,_0x4186b4=[];let _0x2758ac=0x1;while(!![]){const _0x1aaba1=await listSqlQueries(_0x188a2c,{'currentPage':_0x2758ac,'pageSize':PAGE_SIZE,'sqlCode':_0x514fba[_0x3dda85(0xd6)],'sqlName':_0x514fba[_0x3dda85(0xf9)]}),_0x27a8eb=_0x1aaba1[_0x3dda85(0xc1)]??[];_0x4186b4[_0x3dda85(0xe0)](..._0x27a8eb);if(_0x27a8eb[_0x3dda85(0xb4)]===0x0)break;const _0x27fae0=_0x1aaba1[_0x3dda85(0xbd)]?.[_0x3dda85(0xcf)];if(_0x27fae0!=null?_0x4186b4[_0x3dda85(0xb4)]>=_0x27fae0:_0x27a8eb['length']<PAGE_SIZE)break;_0x2758ac++;}return _0x4186b4;}async function ensureSqlContent(_0x2b605b){const _0xa769a4=a253_0x14a5;if(_0x2b605b['sqlContent']!=null&&String(_0x2b605b[_0xa769a4(0xdd)])[_0xa769a4(0xb4)]>0x0)return _0x2b605b;return getSqlQueryDetail(_0x2b605b[_0xa769a4(0xd6)]);}export const sqlPull={'service':a253_0x339f30(0xd8),'command':a253_0x339f30(0xc0),'description':a253_0x339f30(0xd5),'risk':a253_0x339f30(0xd7),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a253_0x339f30(0xbc),'description':a253_0x339f30(0xb6)},{'name':'force','type':'boolean','description':a253_0x339f30(0xcd)}],async 'dryRun'(_0x417498){const _0x3f6482=a253_0x339f30,_0xa2a6e7=loadSqlProjectConfig(_0x417498['appCode']),_0x15e0b0=await readSqlLockFile(_0xa2a6e7[_0x3f6482(0xb1)]),{appLock:_0x2aa9d2}=ensureSqlLockScope(_0x15e0b0??createEmptySqlLock(),_0xa2a6e7[_0x3f6482(0xc7)],_0xa2a6e7[_0x3f6482(0xc4)],_0x3f6482(0xc0)),_0x5ef820=await fetchAllSqlQueries(_0x417498[_0x3f6482(0xc7)],{'sqlCode':_0x417498['str'](_0x3f6482(0xb7))||undefined,'sqlName':_0x417498[_0x3f6482(0xba)](_0x3f6482(0xf7))||undefined}),_0x22f64f=[];for(const _0x394b19 of _0x5ef820){const _0x2690c3=await ensureSqlContent(_0x394b19),_0x2b81b8=ensureRemoteSqlContent(_0x2690c3),_0x57659e=detectSqlMode(_0x2b81b8),_0x119370=_0x2690c3[_0x3f6482(0xf4)]?await getDbName(_0x417498['appCode'],Number(_0x2690c3[_0x3f6482(0xf4)]))[_0x3f6482(0xe1)](()=>undefined):undefined,_0x699e4a=buildLocalSqlFileContent({'sqlCode':_0x2690c3['sqlCode'],'sqlName':_0x2690c3[_0x3f6482(0xf9)],'dbId':_0x2690c3[_0x3f6482(0xf4)]},_0x2b81b8,{'dbName':_0x119370,'mode':_0x57659e,'syncedAt':new Date()[_0x3f6482(0xb8)](),'description':_0x2690c3[_0x3f6482(0xc8)]}),_0x34fd99=buildSqlLockEntry(_0x2690c3,_0x2b81b8,'',{'dbName':_0x119370}),_0x353bf2=resolveLocalSqlFilePath(_0xa2a6e7,_0x2690c3['sqlCode'],_0x34fd99);let _0x2acf9d=_0x3f6482(0xf1),_0x2dc7a4;const _0x5207f1=await findExistingSqlFiles(_0xa2a6e7,_0x353bf2,_0x57659e,_0x2aa9d2[_0x3f6482(0xf0)][_0x2690c3['sqlCode']]);if(_0x5207f1[_0x3f6482(0xb4)]>0x0){const _0x3904cf=await compareExistingSqlFiles(_0x5207f1,_0x699e4a,_0x57659e);if(_0x3904cf['some'](({equivalent:_0x4c8ece})=>!_0x4c8ece))_0x2acf9d='conflict',_0x2dc7a4=_0x3f6482(0xdc);else _0x3904cf[_0x3f6482(0xb4)]===0x1&&_0x3904cf[0x0]?.[_0x3f6482(0xd1)][_0x3f6482(0xf3)]&&(_0x2acf9d=_0x3f6482(0xd9),_0x2dc7a4=_0x3f6482(0xc6));}_0x22f64f[_0x3f6482(0xe0)]({'sqlCode':_0x2690c3[_0x3f6482(0xd6)],'sqlName':_0x2690c3[_0x3f6482(0xf9)],'filePath':_0x353bf2,'status':_0x2acf9d,'reason':_0x2dc7a4});}return{'method':_0x3f6482(0xe4),'url':_0x3f6482(0xe7),'body':{'appCode':_0x417498['appCode'],'sqlCode':_0x417498[_0x3f6482(0xba)](_0x3f6482(0xb7))||null,'sqlName':_0x417498[_0x3f6482(0xba)](_0x3f6482(0xf7))||null,'files':_0x22f64f},'description':_0x3f6482(0xdf)+_0x22f64f[_0x3f6482(0xb4)]+_0x3f6482(0xd0)+_0xa2a6e7[_0x3f6482(0xc5)]};},async 'execute'(_0x2ec895){const _0x5c6b5f=a253_0x339f30,_0x3823c5=loadSqlProjectConfig(_0x2ec895[_0x5c6b5f(0xc7)]),_0x90f25d=await readSqlLockFile(_0x3823c5[_0x5c6b5f(0xb1)]),{lockData:_0x2f551d,appLock:_0x52d775}=ensureSqlLockScope(_0x90f25d??createEmptySqlLock(),_0x3823c5[_0x5c6b5f(0xc7)],_0x3823c5[_0x5c6b5f(0xc4)],_0x5c6b5f(0xc0)),_0x116d23=_0x2ec895['bool']('force'),_0x1ca638=await fetchAllSqlQueries(_0x2ec895[_0x5c6b5f(0xc7)],{'sqlCode':_0x2ec895[_0x5c6b5f(0xba)](_0x5c6b5f(0xb7))||undefined,'sqlName':_0x2ec895[_0x5c6b5f(0xba)]('name')||undefined});if(_0x1ca638[_0x5c6b5f(0xb4)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x39d3b2=[],_0x52fb1b=[];for(const _0x2c15cd of _0x1ca638){try{_0x39d3b2[_0x5c6b5f(0xe0)](await ensureSqlContent(_0x2c15cd));}catch(_0x1d96c8){_0x52fb1b[_0x5c6b5f(0xe0)]({'sqlCode':_0x2c15cd[_0x5c6b5f(0xd6)],'error':_0x1d96c8 instanceof Error?_0x1d96c8[_0x5c6b5f(0xe8)]:String(_0x1d96c8)});}}if(_0x116d23&&!_0x2ec895[_0x5c6b5f(0xea)]){let _0x12a7b0=![];for(const _0x1784a3 of _0x39d3b2){const _0xb40db8=detectSqlMode(ensureRemoteSqlContent(_0x1784a3)),_0x1b9ef6=_0x1784a3[_0x5c6b5f(0xf4)]?await getDbName(_0x2ec895[_0x5c6b5f(0xc7)],Number(_0x1784a3[_0x5c6b5f(0xf4)]))[_0x5c6b5f(0xe1)](()=>undefined):undefined,_0xe2da72=buildLocalSqlFileContent({'sqlCode':_0x1784a3[_0x5c6b5f(0xd6)],'sqlName':_0x1784a3[_0x5c6b5f(0xf9)],'dbId':_0x1784a3[_0x5c6b5f(0xf4)]},ensureRemoteSqlContent(_0x1784a3),{'dbName':_0x1b9ef6,'mode':_0xb40db8,'syncedAt':new Date()[_0x5c6b5f(0xb8)](),'description':_0x1784a3[_0x5c6b5f(0xc8)]}),_0x15bfe6=resolveLocalSqlFilePath(_0x3823c5,_0x1784a3[_0x5c6b5f(0xd6)],buildSqlLockEntry(_0x1784a3,ensureRemoteSqlContent(_0x1784a3),'',{'dbName':_0x1b9ef6})),_0x47a410=await findExistingSqlFiles(_0x3823c5,_0x15bfe6,_0xb40db8,_0x52d775['sqls'][_0x1784a3[_0x5c6b5f(0xd6)]]),_0x3c0b9a=await compareExistingSqlFiles(_0x47a410,_0xe2da72,_0xb40db8);if(_0x3c0b9a[_0x5c6b5f(0xb3)](({equivalent:_0x4caf08})=>!_0x4caf08)){_0x12a7b0=!![];break;}}if(_0x12a7b0){const _0x12cffd=await confirmForceOverwrite(_0x5c6b5f(0xcc));if(!_0x12cffd)throw CliErrors[_0x5c6b5f(0xbb)]('Force\x20pull\x20cancelled.');}}const _0x50b887=cloneSqlLockData(_0x2f551d),_0x42cf56=_0x50b887[_0x5c6b5f(0xca)][_0x3823c5[_0x5c6b5f(0xc7)]],_0x4c21eb=[],_0x57dcc0=[];for(const _0x5a0bf9 of _0x39d3b2){const _0xd05a2e=_0x42cf56[_0x5c6b5f(0xf0)][_0x5a0bf9[_0x5c6b5f(0xd6)]],_0x4a0f24=ensureRemoteSqlContent(_0x5a0bf9),_0x3c43e3=detectSqlMode(_0x4a0f24),_0x46f8ba=_0x5a0bf9['dbId']?await getDbName(_0x2ec895[_0x5c6b5f(0xc7)],Number(_0x5a0bf9[_0x5c6b5f(0xf4)]))[_0x5c6b5f(0xe1)](()=>undefined):undefined,_0x676790=buildLocalSqlFileContent({'sqlCode':_0x5a0bf9[_0x5c6b5f(0xd6)],'sqlName':_0x5a0bf9['sqlName'],'dbId':_0x5a0bf9[_0x5c6b5f(0xf4)]},_0x4a0f24,{'dbName':_0x46f8ba,'mode':_0x3c43e3,'syncedAt':new Date()[_0x5c6b5f(0xb8)](),'description':_0x5a0bf9['description']}),_0x596d2f=buildSqlLockEntry(_0x5a0bf9,_0x4a0f24,computeSqlContentHash(_0x676790),{'dbName':_0x46f8ba}),_0x2ca2da=_0x596d2f[_0x5c6b5f(0xe9)],_0x460b67=join(_0x3823c5[_0x5c6b5f(0xc5)],_0x2ca2da);try{const _0x35be7f=await findExistingSqlFiles(_0x3823c5,_0x460b67,_0x3c43e3,_0xd05a2e),_0x5ef1af=await compareExistingSqlFiles(_0x35be7f,_0x676790,_0x3c43e3);if(!_0x116d23&&_0x5ef1af[_0x5c6b5f(0xb3)](({equivalent:_0xa4acd7})=>!_0xa4acd7)){_0x57dcc0[_0x5c6b5f(0xe0)]({'sqlCode':_0x5a0bf9[_0x5c6b5f(0xd6)],'reason':_0x5c6b5f(0xf2)});continue;}const _0x11a52d=_0x5ef1af[_0x5c6b5f(0xb9)](({file:_0xe1f42})=>_0xe1f42[_0x5c6b5f(0xf3)]),_0x3517de=_0x5ef1af['find'](({file:_0x21d4cb})=>!_0x21d4cb[_0x5c6b5f(0xf3)]);if(_0x11a52d?.[_0x5c6b5f(0xb2)]&&!_0x3517de){_0x57dcc0[_0x5c6b5f(0xe0)]({'sqlCode':_0x5a0bf9[_0x5c6b5f(0xd6)],'reason':_0x5c6b5f(0xc6)}),_0x42cf56[_0x5c6b5f(0xf0)][_0x5a0bf9[_0x5c6b5f(0xd6)]]={..._0x596d2f,'hash':computeSqlContentHash(_0x11a52d[_0x5c6b5f(0xeb)]),'path':_0x2ca2da};continue;}!_0x11a52d?.[_0x5c6b5f(0xb2)]&&(await ensureParentDirectory(_0x460b67),await writeFile(_0x460b67,_0x676790,'utf8')),_0x3517de&&await rm(_0x3517de[_0x5c6b5f(0xd1)]['filePath'],{'force':!![]}),_0x42cf56[_0x5c6b5f(0xf0)][_0x5a0bf9[_0x5c6b5f(0xd6)]]={..._0x596d2f,'hash':_0x11a52d?.[_0x5c6b5f(0xb2)]?computeSqlContentHash(_0x11a52d[_0x5c6b5f(0xeb)]):_0x596d2f[_0x5c6b5f(0xc9)],'path':_0x2ca2da},_0x4c21eb[_0x5c6b5f(0xe0)]({'sqlCode':_0x5a0bf9[_0x5c6b5f(0xd6)],'filePath':_0x460b67});}catch(_0x5cff94){_0x52fb1b['push']({'sqlCode':_0x5a0bf9['sqlCode'],'error':_0x5cff94 instanceof Error?_0x5cff94[_0x5c6b5f(0xe8)]:String(_0x5cff94)});}}return _0x42cf56['lastSync']=new Date()[_0x5c6b5f(0xb8)](),await writeSqlLockFile(_0x3823c5[_0x5c6b5f(0xb1)],_0x50b887),{'ok':_0x52fb1b['length']===0x0,'data':{'pulled':_0x4c21eb,'skipped':_0x57dcc0,'failed':_0x52fb1b},'message':_0x5c6b5f(0xc2)+_0x4c21eb['length']+_0x5c6b5f(0xed)+_0x57dcc0['length']+_0x5c6b5f(0xb5)+_0x52fb1b[_0x5c6b5f(0xb4)]+_0x5c6b5f(0xd4)};}};function isEquivalentPulledSqlFile(_0x17895d,_0x25c9b1,_0x152398,_0x595c66){if(_0x152398!==_0x595c66)return normalizePulledSqlBody(_0x17895d,_0x152398)===normalizePulledSqlBody(_0x25c9b1,_0x595c66);return normalizePullComparableContent(_0x17895d,_0x152398)===normalizePullComparableContent(_0x25c9b1,_0x595c66);}async function findExistingSqlFiles(_0x2db1f8,_0x1c7286,_0x54e494,_0x4b537d){const _0x9b67d=a253_0x339f30,_0x19901e=[];await fileExists(_0x1c7286)&&_0x19901e[_0x9b67d(0xe0)]({'filePath':_0x1c7286,'mode':_0x54e494,'isCanonical':!![]});if(!_0x4b537d?.['path'])return _0x19901e;const _0x326012=join(_0x2db1f8[_0x9b67d(0xc5)],_0x4b537d[_0x9b67d(0xe9)]);if(_0x326012===_0x1c7286)return _0x19901e;return await fileExists(_0x326012)&&_0x19901e['push']({'filePath':_0x326012,'mode':_0x4b537d[_0x9b67d(0xb0)]??modeFromFilePath(_0x326012),'isCanonical':![]}),_0x19901e;}async function compareExistingSqlFiles(_0xe92f26,_0x19a7d0,_0x31d740){const _0x3b3f3c=a253_0x339f30;return Promise[_0x3b3f3c(0xbe)](_0xe92f26[_0x3b3f3c(0xda)](async _0x1546d5=>{const _0x3e4246=_0x3b3f3c,_0x566d59=await readFile(_0x1546d5['filePath'],_0x3e4246(0xce));return{'file':_0x1546d5,'content':_0x566d59,'equivalent':isEquivalentPulledSqlFile(_0x566d59,_0x19a7d0,_0x1546d5[_0x3e4246(0xb0)],_0x31d740)};}));}function modeFromFilePath(_0x5c824e){const _0x9aca80=a253_0x339f30;return _0x5c824e[_0x9aca80(0xe3)]()[_0x9aca80(0xde)](_0x9aca80(0xf5))?_0x9aca80(0xd2):_0x9aca80(0xd8);}function normalizePulledSqlBody(_0x227344,_0x44adc9){const _0x2ccad7=a253_0x339f30;return stripLocalSqlMetadata(_0x227344,_0x44adc9)[_0x2ccad7(0xee)](/\r\n/g,'\x0a')[_0x2ccad7(0xc3)]();}function normalizePullComparableContent(_0x139f7f,_0x520924){const _0x237e1a=a253_0x339f30,_0x257bd5=_0x139f7f[_0x237e1a(0xee)](/\r\n/g,'\x0a')[_0x237e1a(0xcb)]('\x0a'),_0x3353f3=_0x257bd5['filter'](_0x27491c=>!isSyncedAtMetadataLine(_0x27491c,_0x520924));return _0x3353f3[_0x237e1a(0xe2)]('\x0a');}function isSyncedAtMetadataLine(_0x2e8b59,_0x3fdcd0){const _0x21a5b7=a253_0x339f30;if(_0x3fdcd0===_0x21a5b7(0xd2))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2e8b59);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x21a5b7(0xdb)](_0x2e8b59);}
|
|
1
|
+
const a253_0x5936e3=a253_0xdce6;(function(_0x4a6ace,_0x28a55c){const _0x34ad27=a253_0xdce6,_0x26e087=_0x4a6ace();while(!![]){try{const _0x5bd48a=-parseInt(_0x34ad27(0x155))/0x1*(-parseInt(_0x34ad27(0x171))/0x2)+-parseInt(_0x34ad27(0x172))/0x3+parseInt(_0x34ad27(0x14f))/0x4+-parseInt(_0x34ad27(0x160))/0x5+parseInt(_0x34ad27(0x166))/0x6*(parseInt(_0x34ad27(0x13d))/0x7)+-parseInt(_0x34ad27(0x145))/0x8+parseInt(_0x34ad27(0x12f))/0x9*(parseInt(_0x34ad27(0x15e))/0xa);if(_0x5bd48a===_0x28a55c)break;else _0x26e087['push'](_0x26e087['shift']());}catch(_0x42c7ba){_0x26e087['push'](_0x26e087['shift']());}}}(a253_0x10a3,0xa9660));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a253_0x10a3(){const _0x5edc3f=['Force\x20pull\x20cancelled.','skipped','\x20skipped,\x20','catch','10ABZjZY','content','6054790ZiRQud','tableData','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','POST','find','\x20written,\x20','378WavYvR','message','sqlName','force','filePath','sqlContent','lastSync','equivalent','sqlCode','local\x20differs\x20from\x20remote','apps','15862afjBDH','4143777ZPqYlM','join','boolean','unchanged','dbId','file','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','toLowerCase','string','lockFilePath','24542181HWLJTs','would_pull','bool','appCode','some','filter','sqlRootDir','Pull\x20complete:\x20','conflict','description','pull','mybatisXml','name','hash','70329OkSJVo','Filter\x20by\x20SQL\x20display\x20name','split','toISOString','sqlcode','replace','all','sql','6689392TevYKS','utf8','mode','isCanonical','sqls','totalCount','No\x20remote\x20SQL\x20queries\x20matched.','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','push','sqlRoot','2605372NmPXPw','length','endsWith','read','\x20failed','test','14wmWCCF','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','str','path','nonInteractive'];a253_0x10a3=function(){return _0x5edc3f;};return a253_0x10a3();}import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x2bd855,_0x177c78){const _0x4f63c8=a253_0xdce6,_0x451927=[];let _0x1ea8ad=0x1;while(!![]){const _0x558147=await listSqlQueries(_0x2bd855,{'currentPage':_0x1ea8ad,'pageSize':PAGE_SIZE,'sqlCode':_0x177c78[_0x4f63c8(0x16e)],'sqlName':_0x177c78[_0x4f63c8(0x168)]}),_0x3c71ff=_0x558147[_0x4f63c8(0x161)]??[];_0x451927[_0x4f63c8(0x14d)](..._0x3c71ff);if(_0x3c71ff[_0x4f63c8(0x150)]===0x0)break;const _0x1bc582=_0x558147['paging']?.[_0x4f63c8(0x14a)];if(_0x1bc582!=null?_0x451927[_0x4f63c8(0x150)]>=_0x1bc582:_0x3c71ff[_0x4f63c8(0x150)]<PAGE_SIZE)break;_0x1ea8ad++;}return _0x451927;}async function ensureSqlContent(_0x154438){const _0x13d856=a253_0xdce6;if(_0x154438[_0x13d856(0x16b)]!=null&&String(_0x154438[_0x13d856(0x16b)])['length']>0x0)return _0x154438;return getSqlQueryDetail(_0x154438[_0x13d856(0x16e)]);}export const sqlPull={'service':a253_0x5936e3(0x144),'command':a253_0x5936e3(0x139),'description':a253_0x5936e3(0x162),'risk':a253_0x5936e3(0x152),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x5936e3(0x13b),'type':a253_0x5936e3(0x12d),'description':a253_0x5936e3(0x13e)},{'name':a253_0x5936e3(0x169),'type':a253_0x5936e3(0x174),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x3c2d29){const _0x288963=a253_0x5936e3,_0x808764=loadSqlProjectConfig(_0x3c2d29[_0x288963(0x132)]),_0x31ed24=await readSqlLockFile(_0x808764['lockFilePath']),{appLock:_0x56988b}=ensureSqlLockScope(_0x31ed24??createEmptySqlLock(),_0x808764[_0x288963(0x132)],_0x808764[_0x288963(0x14e)],_0x288963(0x139)),_0x13fa98=await fetchAllSqlQueries(_0x3c2d29['appCode'],{'sqlCode':_0x3c2d29[_0x288963(0x157)](_0x288963(0x141))||undefined,'sqlName':_0x3c2d29['str']('name')||undefined}),_0x40b3df=[];for(const _0x59be73 of _0x13fa98){const _0xedf04e=await ensureSqlContent(_0x59be73),_0x5c8776=ensureRemoteSqlContent(_0xedf04e),_0x239cba=detectSqlMode(_0x5c8776),_0x402d47=_0xedf04e[_0x288963(0x176)]?await getDbName(_0x3c2d29[_0x288963(0x132)],Number(_0xedf04e[_0x288963(0x176)]))[_0x288963(0x15d)](()=>undefined):undefined,_0x5623af=buildLocalSqlFileContent({'sqlCode':_0xedf04e[_0x288963(0x16e)],'sqlName':_0xedf04e[_0x288963(0x168)],'dbId':_0xedf04e[_0x288963(0x176)]},_0x5c8776,{'dbName':_0x402d47,'mode':_0x239cba,'syncedAt':new Date()['toISOString'](),'description':_0xedf04e['description']}),_0xc0d25b=buildSqlLockEntry(_0xedf04e,_0x5c8776,'',{'dbName':_0x402d47}),_0xbf17b7=resolveLocalSqlFilePath(_0x808764,_0xedf04e[_0x288963(0x16e)],_0xc0d25b);let _0x119031=_0x288963(0x130),_0x3b9deb;const _0x20f21d=await findExistingSqlFiles(_0x808764,_0xbf17b7,_0x239cba,_0x56988b['sqls'][_0xedf04e[_0x288963(0x16e)]]);if(_0x20f21d[_0x288963(0x150)]>0x0){const _0x342e95=await compareExistingSqlFiles(_0x20f21d,_0x5623af,_0x239cba);if(_0x342e95[_0x288963(0x133)](({equivalent:_0x1953d9})=>!_0x1953d9))_0x119031=_0x288963(0x137),_0x3b9deb=_0x288963(0x156);else _0x342e95[_0x288963(0x150)]===0x1&&_0x342e95[0x0]?.[_0x288963(0x177)][_0x288963(0x148)]&&(_0x119031=_0x288963(0x15b),_0x3b9deb=_0x288963(0x175));}_0x40b3df[_0x288963(0x14d)]({'sqlCode':_0xedf04e[_0x288963(0x16e)],'sqlName':_0xedf04e[_0x288963(0x168)],'filePath':_0xbf17b7,'status':_0x119031,'reason':_0x3b9deb});}return{'method':_0x288963(0x163),'url':_0x288963(0x14c),'body':{'appCode':_0x3c2d29[_0x288963(0x132)],'sqlCode':_0x3c2d29[_0x288963(0x157)]('sqlcode')||null,'sqlName':_0x3c2d29[_0x288963(0x157)]('name')||null,'files':_0x40b3df},'description':'Would\x20pull\x20'+_0x40b3df[_0x288963(0x150)]+'\x20SQL\x20file(s)\x20into\x20'+_0x808764[_0x288963(0x135)]};},async 'execute'(_0x777530){const _0x547c92=a253_0x5936e3,_0x2d6714=loadSqlProjectConfig(_0x777530[_0x547c92(0x132)]),_0x66492f=await readSqlLockFile(_0x2d6714[_0x547c92(0x12e)]),{lockData:_0x1b53dd,appLock:_0x598f1b}=ensureSqlLockScope(_0x66492f??createEmptySqlLock(),_0x2d6714['appCode'],_0x2d6714[_0x547c92(0x14e)],'pull'),_0x48eba1=_0x777530[_0x547c92(0x131)](_0x547c92(0x169)),_0x2fe752=await fetchAllSqlQueries(_0x777530['appCode'],{'sqlCode':_0x777530[_0x547c92(0x157)]('sqlcode')||undefined,'sqlName':_0x777530['str']('name')||undefined});if(_0x2fe752[_0x547c92(0x150)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x547c92(0x14b)};const _0x359426=[],_0x9394c8=[];for(const _0x5a31e7 of _0x2fe752){try{_0x359426[_0x547c92(0x14d)](await ensureSqlContent(_0x5a31e7));}catch(_0x189b70){_0x9394c8[_0x547c92(0x14d)]({'sqlCode':_0x5a31e7[_0x547c92(0x16e)],'error':_0x189b70 instanceof Error?_0x189b70['message']:String(_0x189b70)});}}if(_0x48eba1&&!_0x777530[_0x547c92(0x159)]){let _0x19227f=![];for(const _0x45be2f of _0x359426){const _0x8e1d62=detectSqlMode(ensureRemoteSqlContent(_0x45be2f)),_0x3173d9=_0x45be2f[_0x547c92(0x176)]?await getDbName(_0x777530['appCode'],Number(_0x45be2f[_0x547c92(0x176)]))[_0x547c92(0x15d)](()=>undefined):undefined,_0x986dae=buildLocalSqlFileContent({'sqlCode':_0x45be2f[_0x547c92(0x16e)],'sqlName':_0x45be2f[_0x547c92(0x168)],'dbId':_0x45be2f[_0x547c92(0x176)]},ensureRemoteSqlContent(_0x45be2f),{'dbName':_0x3173d9,'mode':_0x8e1d62,'syncedAt':new Date()['toISOString'](),'description':_0x45be2f[_0x547c92(0x138)]}),_0x55c1fe=resolveLocalSqlFilePath(_0x2d6714,_0x45be2f['sqlCode'],buildSqlLockEntry(_0x45be2f,ensureRemoteSqlContent(_0x45be2f),'',{'dbName':_0x3173d9})),_0x3979e2=await findExistingSqlFiles(_0x2d6714,_0x55c1fe,_0x8e1d62,_0x598f1b['sqls'][_0x45be2f[_0x547c92(0x16e)]]),_0xd42d13=await compareExistingSqlFiles(_0x3979e2,_0x986dae,_0x8e1d62);if(_0xd42d13[_0x547c92(0x133)](({equivalent:_0x1e652b})=>!_0x1e652b)){_0x19227f=!![];break;}}if(_0x19227f){const _0xbd8b1d=await confirmForceOverwrite(_0x547c92(0x178));if(!_0xbd8b1d)throw CliErrors['cancelled'](_0x547c92(0x15a));}}const _0x5a883e=cloneSqlLockData(_0x1b53dd),_0x2340fb=_0x5a883e[_0x547c92(0x170)][_0x2d6714[_0x547c92(0x132)]],_0x45448b=[],_0x4130c5=[];for(const _0x2aa1c8 of _0x359426){const _0x30c9bb=_0x2340fb[_0x547c92(0x149)][_0x2aa1c8[_0x547c92(0x16e)]],_0x171549=ensureRemoteSqlContent(_0x2aa1c8),_0x4ca6e5=detectSqlMode(_0x171549),_0x143f22=_0x2aa1c8[_0x547c92(0x176)]?await getDbName(_0x777530[_0x547c92(0x132)],Number(_0x2aa1c8[_0x547c92(0x176)]))[_0x547c92(0x15d)](()=>undefined):undefined,_0x25a8f7=buildLocalSqlFileContent({'sqlCode':_0x2aa1c8[_0x547c92(0x16e)],'sqlName':_0x2aa1c8[_0x547c92(0x168)],'dbId':_0x2aa1c8[_0x547c92(0x176)]},_0x171549,{'dbName':_0x143f22,'mode':_0x4ca6e5,'syncedAt':new Date()[_0x547c92(0x140)](),'description':_0x2aa1c8['description']}),_0x5866f8=buildSqlLockEntry(_0x2aa1c8,_0x171549,computeSqlContentHash(_0x25a8f7),{'dbName':_0x143f22}),_0x5b37cb=_0x5866f8[_0x547c92(0x158)],_0x4dee17=join(_0x2d6714['sqlRootDir'],_0x5b37cb);try{const _0x2b31b1=await findExistingSqlFiles(_0x2d6714,_0x4dee17,_0x4ca6e5,_0x30c9bb),_0x1489d3=await compareExistingSqlFiles(_0x2b31b1,_0x25a8f7,_0x4ca6e5);if(!_0x48eba1&&_0x1489d3[_0x547c92(0x133)](({equivalent:_0x28f880})=>!_0x28f880)){_0x4130c5[_0x547c92(0x14d)]({'sqlCode':_0x2aa1c8[_0x547c92(0x16e)],'reason':_0x547c92(0x16f)});continue;}const _0x7c0adb=_0x1489d3[_0x547c92(0x164)](({file:_0x3b37c5})=>_0x3b37c5['isCanonical']),_0x2f2d6f=_0x1489d3['find'](({file:_0x3159a6})=>!_0x3159a6[_0x547c92(0x148)]);if(_0x7c0adb?.[_0x547c92(0x16d)]&&!_0x2f2d6f){_0x4130c5[_0x547c92(0x14d)]({'sqlCode':_0x2aa1c8[_0x547c92(0x16e)],'reason':_0x547c92(0x175)}),_0x2340fb['sqls'][_0x2aa1c8['sqlCode']]={..._0x5866f8,'hash':computeSqlContentHash(_0x7c0adb[_0x547c92(0x15f)]),'path':_0x5b37cb};continue;}!_0x7c0adb?.[_0x547c92(0x16d)]&&(await ensureParentDirectory(_0x4dee17),await writeFile(_0x4dee17,_0x25a8f7,_0x547c92(0x146))),_0x2f2d6f&&await rm(_0x2f2d6f[_0x547c92(0x177)]['filePath'],{'force':!![]}),_0x2340fb[_0x547c92(0x149)][_0x2aa1c8[_0x547c92(0x16e)]]={..._0x5866f8,'hash':_0x7c0adb?.[_0x547c92(0x16d)]?computeSqlContentHash(_0x7c0adb[_0x547c92(0x15f)]):_0x5866f8[_0x547c92(0x13c)],'path':_0x5b37cb},_0x45448b[_0x547c92(0x14d)]({'sqlCode':_0x2aa1c8[_0x547c92(0x16e)],'filePath':_0x4dee17});}catch(_0x116679){_0x9394c8['push']({'sqlCode':_0x2aa1c8['sqlCode'],'error':_0x116679 instanceof Error?_0x116679[_0x547c92(0x167)]:String(_0x116679)});}}return _0x2340fb[_0x547c92(0x16c)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2d6714[_0x547c92(0x12e)],_0x5a883e),{'ok':_0x9394c8[_0x547c92(0x150)]===0x0,'data':{'pulled':_0x45448b,'skipped':_0x4130c5,'failed':_0x9394c8},'message':_0x547c92(0x136)+_0x45448b[_0x547c92(0x150)]+_0x547c92(0x165)+_0x4130c5[_0x547c92(0x150)]+_0x547c92(0x15c)+_0x9394c8[_0x547c92(0x150)]+_0x547c92(0x153)};}};function isEquivalentPulledSqlFile(_0x38d214,_0x1a36a7,_0x197d65,_0x5bfddb){if(_0x197d65!==_0x5bfddb)return normalizePulledSqlBody(_0x38d214,_0x197d65)===normalizePulledSqlBody(_0x1a36a7,_0x5bfddb);return normalizePullComparableContent(_0x38d214,_0x197d65)===normalizePullComparableContent(_0x1a36a7,_0x5bfddb);}async function findExistingSqlFiles(_0x1f50d8,_0x323753,_0x5b1c77,_0x53f9b0){const _0x1c5dad=a253_0x5936e3,_0x3b6169=[];await fileExists(_0x323753)&&_0x3b6169[_0x1c5dad(0x14d)]({'filePath':_0x323753,'mode':_0x5b1c77,'isCanonical':!![]});if(!_0x53f9b0?.[_0x1c5dad(0x158)])return _0x3b6169;const _0x3a61a1=join(_0x1f50d8[_0x1c5dad(0x135)],_0x53f9b0[_0x1c5dad(0x158)]);if(_0x3a61a1===_0x323753)return _0x3b6169;return await fileExists(_0x3a61a1)&&_0x3b6169['push']({'filePath':_0x3a61a1,'mode':_0x53f9b0[_0x1c5dad(0x147)]??modeFromFilePath(_0x3a61a1),'isCanonical':![]}),_0x3b6169;}async function compareExistingSqlFiles(_0x44421f,_0x545264,_0x3d4761){const _0xbf5013=a253_0x5936e3;return Promise[_0xbf5013(0x143)](_0x44421f['map'](async _0x18d8b3=>{const _0x1820dc=_0xbf5013,_0x289420=await readFile(_0x18d8b3[_0x1820dc(0x16a)],'utf8');return{'file':_0x18d8b3,'content':_0x289420,'equivalent':isEquivalentPulledSqlFile(_0x289420,_0x545264,_0x18d8b3['mode'],_0x3d4761)};}));}function modeFromFilePath(_0x294ace){const _0x1c94b9=a253_0x5936e3;return _0x294ace[_0x1c94b9(0x12c)]()[_0x1c94b9(0x151)]('.xml')?_0x1c94b9(0x13a):_0x1c94b9(0x144);}function a253_0xdce6(_0x2c044d,_0x193cb2){_0x2c044d=_0x2c044d-0x12c;const _0x10a313=a253_0x10a3();let _0xdce6e7=_0x10a313[_0x2c044d];return _0xdce6e7;}function normalizePulledSqlBody(_0x5068ca,_0xaf9f97){return stripLocalSqlMetadata(_0x5068ca,_0xaf9f97)['replace'](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x100c22,_0x3adaa0){const _0x921c4b=a253_0x5936e3,_0x3ae82a=_0x100c22[_0x921c4b(0x142)](/\r\n/g,'\x0a')[_0x921c4b(0x13f)]('\x0a'),_0x28ee02=_0x3ae82a[_0x921c4b(0x134)](_0xcc1e38=>!isSyncedAtMetadataLine(_0xcc1e38,_0x3adaa0));return _0x28ee02[_0x921c4b(0x173)]('\x0a');}function isSyncedAtMetadataLine(_0x3e2201,_0x764eac){const _0x23a6a9=a253_0x5936e3;if(_0x764eac===_0x23a6a9(0x13a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x23a6a9(0x154)](_0x3e2201);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x23a6a9(0x154)](_0x3e2201);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a254_0x3f7d(_0x1e2b81,_0x1ac8f1){_0x1e2b81=_0x1e2b81-0xd8;const _0x306e9a=a254_0x306e();let _0x3f7d8b=_0x306e9a[_0x1e2b81];return _0x3f7d8b;}const a254_0x296c84=a254_0x3f7d;(function(_0x297a41,_0x8dae0e){const _0x47e843=a254_0x3f7d,_0x1d732b=_0x297a41();while(!![]){try{const _0x5c9be1=parseInt(_0x47e843(0xfd))/0x1+parseInt(_0x47e843(0xf0))/0x2+-parseInt(_0x47e843(0xff))/0x3*(-parseInt(_0x47e843(0xdf))/0x4)+-parseInt(_0x47e843(0x100))/0x5+parseInt(_0x47e843(0xfc))/0x6+parseInt(_0x47e843(0x114))/0x7+parseInt(_0x47e843(0x105))/0x8*(-parseInt(_0x47e843(0xd8))/0x9);if(_0x5c9be1===_0x8dae0e)break;else _0x1d732b['push'](_0x1d732b['shift']());}catch(_0x4766d4){_0x1d732b['push'](_0x1d732b['shift']());}}}(a254_0x306e,0x4fc24));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a254_0x306e(){const _0x33e427=['boolean','toISOString','relativePath','mode','Would\x20push\x20','607704lCuzbB','407037mHBuRM','filter','129HjdfgB','2601650EGiqQm','sqlRoot','dbId','startsWith','push','88AadmUf','set','sqls','isFinite','exec','\x20SQL\x20file(s)','unchanged','str','Local\x20directory\x20\x22','lockFilePath','trim','has',':\x20SQL\x20content\x20is\x20empty.','map','Local\x20SQL\x20not\x20found:\x20','925162THpXRI','sqlConfig','version','message','sqlRootDir','sql','No\x20database\x20matches\x20local\x20directory\x20\x22','catch','sqlcode','308043IFsmqn','\x22\x20for\x20sqlCode\x20','appCode',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','sqlName','remoteId','join','6172VQHsWJ','path','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','filePath','utf8','bool','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbName','\x20pushed,\x20','validation','hash','/smartapi/custom/updateUserCustomSql','\x20failed','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','length','No\x20local\x20SQL\x20files\x20found.','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','1033366NyYFit','force','Push\x20complete:\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlCode','POST'];a254_0x306e=function(){return _0x33e427;};return a254_0x306e();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x311386){const _0x3eb49f=a254_0x3f7d,_0x2ed965=stripLocalSqlMetadata(await readFile(_0x311386['filePath'],_0x3eb49f(0xe3)),_0x311386['mode']);if(!_0x2ed965[_0x3eb49f(0x10f)]())throw CliErrors[_0x3eb49f(0xe8)](_0x311386[_0x3eb49f(0xf5)]+_0x3eb49f(0x111));return _0x2ed965;}async function getTargetSqlQueries(_0x35bd4f,_0x47db01,_0x141bcd){const _0x5e2579=a254_0x3f7d,_0x11a8e2=await scanLocalSqlQueries(_0x35bd4f),_0x2718be=new Map();for(const _0x3ca816 of _0x11a8e2){if(_0x141bcd&&_0x3ca816[_0x5e2579(0xf5)]!==_0x141bcd)continue;const _0x1aa2d2=_0x2718be['get'](_0x3ca816[_0x5e2579(0xf5)])??[];_0x1aa2d2['push'](_0x3ca816),_0x2718be[_0x5e2579(0x106)](_0x3ca816[_0x5e2579(0xf5)],_0x1aa2d2);}if(_0x141bcd&&!_0x2718be[_0x5e2579(0x110)](_0x141bcd))throw CliErrors[_0x5e2579(0xe8)](_0x5e2579(0x113)+_0x141bcd);const _0x2eb926=[];for(const [_0x442371,_0x473a9c]of _0x2718be['entries']()){if(_0x473a9c[_0x5e2579(0xed)]===0x1){_0x2eb926[_0x5e2579(0x104)](_0x473a9c[0x0]);continue;}const _0x4f1979=_0x47db01[_0x5e2579(0x107)][_0x442371],_0xfa4b79=_0x4f1979?.['path'],_0x4ce08e=_0xfa4b79?_0x473a9c[_0x5e2579(0xfe)](_0x164fde=>_0x164fde[_0x5e2579(0xf9)]!==_0xfa4b79):_0x473a9c;if(_0x4f1979&&_0x4ce08e[_0x5e2579(0xed)]===0x1){_0x2eb926['push'](_0x4ce08e[0x0]);continue;}throw CliErrors[_0x5e2579(0xe8)](_0x5e2579(0xe1)+_0x442371+_0x5e2579(0xf3));}return _0x2eb926;}export const sqlPush={'service':a254_0x296c84(0x119),'command':a254_0x296c84(0x104),'description':a254_0x296c84(0xf4),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x296c84(0xf1),'type':a254_0x296c84(0xf7),'description':a254_0x296c84(0xec)}],async 'dryRun'(_0x23dcec){const _0x16d644=a254_0x296c84,_0x27686f=loadSqlProjectConfig(_0x23dcec['appCode']),_0x15d6ec=await readSqlLockFile(_0x27686f[_0x16d644(0x10e)]),{appLock:_0x3948e2}=ensureSqlLockScope(_0x15d6ec??createEmptySqlLock(),_0x23dcec[_0x16d644(0xda)],_0x27686f[_0x16d644(0x101)],_0x16d644(0x104)),_0x2289f4=await getTargetSqlQueries(_0x27686f,_0x3948e2,_0x23dcec['str'](_0x16d644(0x11c))||undefined),_0x4c873e=[];for(const _0x2a6723 of _0x2289f4){const _0x16afc7=await computeSqlFileHash(_0x2a6723[_0x16d644(0xe2)]),_0x326c6b=_0x3948e2[_0x16d644(0x107)][_0x2a6723['sqlCode']],_0x1e6180=!!_0x326c6b&&(_0x326c6b[_0x16d644(0xe0)]!==_0x2a6723[_0x16d644(0xf9)]||!!_0x2a6723['sqlName']&&_0x326c6b[_0x16d644(0xdc)]!==_0x2a6723[_0x16d644(0xdc)]||_0x326c6b[_0x16d644(0xfa)]!==_0x2a6723[_0x16d644(0xfa)]);if(!_0x23dcec['bool'](_0x16d644(0xf1))&&_0x326c6b&&_0x326c6b['hash']===_0x16afc7&&!_0x1e6180)continue;if(!_0x326c6b)throw CliErrors[_0x16d644(0xe8)](_0x2a6723[_0x16d644(0xf5)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x326c6b[_0x16d644(0x116)]==null)throw CliErrors[_0x16d644(0xe8)](_0x2a6723[_0x16d644(0xf5)]+_0x16d644(0xdb));await resolveTargetDbBinding(_0x23dcec['appCode'],_0x2a6723,_0x326c6b),await readSqlUploadContent(_0x2a6723),_0x4c873e[_0x16d644(0x104)](_0x2a6723[_0x16d644(0xf5)]);}return{'method':_0x16d644(0xf6),'url':_0x16d644(0xea),'body':{'sqlCodes':_0x4c873e,'appCode':_0x23dcec[_0x16d644(0xda)]},'description':_0x16d644(0xfb)+_0x4c873e['length']+_0x16d644(0x10a)};},async 'execute'(_0x261049){const _0x3ba984=a254_0x296c84,_0x3fc923=loadSqlProjectConfig(_0x261049[_0x3ba984(0xda)]),_0x4b1713=await readSqlLockFile(_0x3fc923[_0x3ba984(0x10e)]),{lockData:_0x2a702f,appLock:_0x2cda2b}=ensureSqlLockScope(_0x4b1713??createEmptySqlLock(),_0x261049['appCode'],_0x3fc923[_0x3ba984(0x101)],'push'),_0x2f3679=await getTargetSqlQueries(_0x3fc923,_0x2cda2b,_0x261049[_0x3ba984(0x10c)]('sqlcode')||undefined);if(_0x2f3679[_0x3ba984(0xed)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x3ba984(0xee)};const _0x9dbcdf=[],_0x4c54ed=[],_0x2d9dfb=[];let _0x524dbd=![];for(const _0x5006be of _0x2f3679){const _0x3568b2=_0x2cda2b[_0x3ba984(0x107)][_0x5006be[_0x3ba984(0xf5)]];if(!_0x3568b2){_0x2d9dfb[_0x3ba984(0x104)]({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'error':_0x3ba984(0xe5)});continue;}try{const _0x266e34=await computeSqlFileHash(_0x5006be[_0x3ba984(0xe2)]),_0xc78f90=_0x3568b2[_0x3ba984(0xe0)]!==_0x5006be['relativePath']||!!_0x5006be['sqlName']&&_0x3568b2['sqlName']!==_0x5006be[_0x3ba984(0xdc)]||_0x3568b2[_0x3ba984(0xfa)]!==_0x5006be[_0x3ba984(0xfa)];if(!_0x261049[_0x3ba984(0xe4)](_0x3ba984(0xf1))&&_0x3568b2[_0x3ba984(0xe9)]===_0x266e34&&!_0xc78f90){_0x4c54ed['push']({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'reason':_0x3ba984(0x10b)});continue;}if(_0x3568b2[_0x3ba984(0x116)]==null){_0x2d9dfb[_0x3ba984(0x104)]({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'error':_0x3ba984(0xef)});continue;}const _0x503c41=_0x5006be[_0x3ba984(0xdc)]||_0x3568b2[_0x3ba984(0xdc)],_0x36f240=await resolveTargetDbBinding(_0x261049[_0x3ba984(0xda)],_0x5006be,_0x3568b2),_0x16d14c=await readSqlUploadContent(_0x5006be),_0x56c594=await updateSqlQuery({'id':_0x3568b2[_0x3ba984(0xdd)],'appCode':_0x261049['appCode'],'sqlCode':_0x5006be[_0x3ba984(0xf5)],'sqlName':_0x503c41,'dbId':_0x36f240[_0x3ba984(0x102)],'version':_0x3568b2['version'],'sqlContent':_0x16d14c,'sqlConfig':_0x3568b2[_0x3ba984(0x115)]??undefined}),_0x59ef79=_0x56c594[_0x3ba984(0x102)]?await getDbName(_0x261049[_0x3ba984(0xda)],Number(_0x56c594[_0x3ba984(0x102)]))[_0x3ba984(0x11b)](()=>_0x36f240[_0x3ba984(0xe6)]):_0x36f240['dbName'];_0x2cda2b[_0x3ba984(0x107)][_0x5006be[_0x3ba984(0xf5)]]={...buildSqlLockEntry(_0x56c594,_0x16d14c,_0x266e34,{'dbName':_0x59ef79}),'path':_0x5006be[_0x3ba984(0xf9)],'mode':_0x5006be['mode']},_0x524dbd=!![],await archivePreviousSqlFileIfNeeded(_0x3fc923,_0x3568b2[_0x3ba984(0xe0)],_0x5006be[_0x3ba984(0xf9)]),_0x9dbcdf[_0x3ba984(0x104)]({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'remoteId':_0x3568b2[_0x3ba984(0xdd)]});}catch(_0xe10a41){_0x2d9dfb[_0x3ba984(0x104)]({'sqlCode':_0x5006be[_0x3ba984(0xf5)],'error':_0xe10a41 instanceof Error?_0xe10a41[_0x3ba984(0x117)]:String(_0xe10a41)});}}(_0x524dbd||_0x2d9dfb['length']===0x0)&&(_0x2cda2b['lastSync']=new Date()[_0x3ba984(0xf8)](),await writeSqlLockFile(_0x3fc923[_0x3ba984(0x10e)],_0x2a702f));const _0x446f6c=_0x2d9dfb[_0x3ba984(0xed)]===0x0;return{'ok':_0x446f6c,'data':{'pushed':_0x9dbcdf,'skipped':_0x4c54ed,'failed':_0x2d9dfb},'message':_0x3ba984(0xf2)+_0x9dbcdf['length']+_0x3ba984(0xe7)+_0x4c54ed['length']+'\x20skipped,\x20'+_0x2d9dfb['length']+_0x3ba984(0xeb)};}};async function archivePreviousSqlFileIfNeeded(_0x462492,_0x3119fa,_0x3b2c37){const _0x768ab=a254_0x296c84;if(!_0x3119fa||_0x3119fa===_0x3b2c37)return;const _0x3c6340=join(_0x462492[_0x768ab(0x118)],_0x3119fa);if(!await fileExists(_0x3c6340))return;const _0x722b48=await moveToTrash(_0x462492['projectRoot'],_0x462492['trashDir'],_0x3c6340);await cleanupEmptyDirectories(dirname(_0x3c6340),_0x462492[_0x768ab(0x118)]),void _0x722b48;}async function moveToTrash(_0x2a9841,_0x36b72c,_0x4011c1){const _0x32dfd1=a254_0x296c84,_0x57f805=new Date()[_0x32dfd1(0xf8)]()['replace'](/[:.]/g,'-'),_0x21d630=relative(_0x2a9841,_0x4011c1),_0x2283fa=join(_0x36b72c,_0x57f805,_0x21d630);return await mkdir(dirname(_0x2283fa),{'recursive':!![]}),await rename(_0x4011c1,_0x2283fa),_0x2283fa;}async function cleanupEmptyDirectories(_0x4f99c8,_0x4c6262){const _0x478fe1=a254_0x296c84;let _0x3d27e3=resolve(_0x4f99c8);const _0x2ed88a=resolve(_0x4c6262);while(_0x3d27e3[_0x478fe1(0x103)](''+_0x2ed88a+sep)||_0x3d27e3===_0x2ed88a){if(_0x3d27e3===_0x2ed88a)return;try{const _0x4c8ee1=await readdir(_0x3d27e3);if(_0x4c8ee1['length']>0x0)return;await rmdir(_0x3d27e3);}catch{return;}_0x3d27e3=dirname(_0x3d27e3);}}async function resolveTargetDbBinding(_0x116430,_0x20a085,_0xe3c15b){const _0x297bc4=a254_0x296c84,_0x53f46f=_0x20a085['dbDirectory'];if(!_0x53f46f)return{'dbId':_0xe3c15b[_0x297bc4(0x102)],'dbName':_0xe3c15b[_0x297bc4(0xe6)]};const _0x4c0e6e=buildDbDirectoryName(_0xe3c15b['dbName'],_0xe3c15b[_0x297bc4(0x102)]);if(_0x53f46f===_0x4c0e6e)return{'dbId':_0xe3c15b['dbId'],'dbName':_0xe3c15b[_0x297bc4(0xe6)]};const _0x45528d=parseExplicitDbDirectory(_0x53f46f);if(_0x45528d!=null)return{'dbId':_0x45528d,'dbName':await getDbName(_0x116430,_0x45528d)[_0x297bc4(0x11b)](()=>undefined)};const _0x1d40c4=await listDatabases(_0x116430),_0x53d95f=_0x1d40c4[_0x297bc4(0xfe)](_0x52b22e=>buildDbDirectoryName(_0x52b22e[_0x297bc4(0xe6)],_0x52b22e['dbId'])===_0x53f46f);if(_0x53d95f['length']===0x1)return{'dbId':_0x53d95f[0x0][_0x297bc4(0x102)],'dbName':_0x53d95f[0x0][_0x297bc4(0xe6)]};if(_0x53d95f[_0x297bc4(0xed)]===0x0)throw CliErrors[_0x297bc4(0xe8)](_0x297bc4(0x11a)+_0x53f46f+_0x297bc4(0xd9)+_0x20a085[_0x297bc4(0xf5)]+'.');const _0x513f9d=_0x53d95f[_0x297bc4(0x112)](_0x187fc4=>_0x187fc4[_0x297bc4(0xe6)]+'\x20('+_0x187fc4['dbId']+')')[_0x297bc4(0xde)](',\x20');throw CliErrors['validation'](_0x297bc4(0x10d)+_0x53f46f+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x20a085[_0x297bc4(0xf5)]+':\x20'+_0x513f9d);}function parseExplicitDbDirectory(_0x256702){const _0x4d69ae=a254_0x296c84,_0x3428ae=/^db-(\d+)$/[_0x4d69ae(0x109)](_0x256702);if(!_0x3428ae)return null;const _0x53db8d=Number(_0x3428ae[0x1]);return Number[_0x4d69ae(0x108)](_0x53db8d)&&_0x53db8d>0x0?_0x53db8d:null;}
|
|
1
|
+
const a254_0x2aaff4=a254_0x4c09;(function(_0x2ed773,_0x15c70d){const _0x2ce412=a254_0x4c09,_0x13246e=_0x2ed773();while(!![]){try{const _0x53860e=-parseInt(_0x2ce412(0x131))/0x1+-parseInt(_0x2ce412(0x115))/0x2*(-parseInt(_0x2ce412(0x11d))/0x3)+parseInt(_0x2ce412(0x138))/0x4+-parseInt(_0x2ce412(0x13b))/0x5+parseInt(_0x2ce412(0x11b))/0x6*(parseInt(_0x2ce412(0x129))/0x7)+parseInt(_0x2ce412(0x134))/0x8+-parseInt(_0x2ce412(0x12a))/0x9;if(_0x53860e===_0x15c70d)break;else _0x13246e['push'](_0x13246e['shift']());}catch(_0x11d5a0){_0x13246e['push'](_0x13246e['shift']());}}}(a254_0x5f38,0xbc117));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a254_0x4c09(_0x376b20,_0x46be36){_0x376b20=_0x376b20-0xfe;const _0x5f3862=a254_0x5f38();let _0x4c09d1=_0x5f3862[_0x376b20];return _0x4c09d1;}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x2d1cf2){const _0x2d822f=a254_0x4c09,_0x1f49a3=stripLocalSqlMetadata(await readFile(_0x2d1cf2[_0x2d822f(0x114)],_0x2d822f(0x123)),_0x2d1cf2[_0x2d822f(0x137)]);if(!_0x1f49a3[_0x2d822f(0x105)]())throw CliErrors[_0x2d822f(0x100)](_0x2d1cf2[_0x2d822f(0x122)]+_0x2d822f(0xfe));return _0x1f49a3;}async function getTargetSqlQueries(_0x4f8ab7,_0xe9f339,_0x41299b){const _0x5ce7a1=a254_0x4c09,_0x6358ce=await scanLocalSqlQueries(_0x4f8ab7),_0x1688ab=new Map();for(const _0x3a56ca of _0x6358ce){if(_0x41299b&&_0x3a56ca[_0x5ce7a1(0x122)]!==_0x41299b)continue;const _0x11e5e2=_0x1688ab[_0x5ce7a1(0x109)](_0x3a56ca[_0x5ce7a1(0x122)])??[];_0x11e5e2[_0x5ce7a1(0x141)](_0x3a56ca),_0x1688ab[_0x5ce7a1(0x101)](_0x3a56ca[_0x5ce7a1(0x122)],_0x11e5e2);}if(_0x41299b&&!_0x1688ab[_0x5ce7a1(0x133)](_0x41299b))throw CliErrors[_0x5ce7a1(0x100)](_0x5ce7a1(0x128)+_0x41299b);const _0x5ac95b=[];for(const [_0xa84a11,_0x1287aa]of _0x1688ab['entries']()){if(_0x1287aa[_0x5ce7a1(0x13a)]===0x1){_0x5ac95b[_0x5ce7a1(0x141)](_0x1287aa[0x0]);continue;}const _0x5a6b9d=_0xe9f339[_0x5ce7a1(0x11f)][_0xa84a11],_0x4eb079=_0x5a6b9d?.['path'],_0x30e60e=_0x4eb079?_0x1287aa[_0x5ce7a1(0x10c)](_0x53cb4a=>_0x53cb4a[_0x5ce7a1(0x118)]!==_0x4eb079):_0x1287aa;if(_0x5a6b9d&&_0x30e60e[_0x5ce7a1(0x13a)]===0x1){_0x5ac95b[_0x5ce7a1(0x141)](_0x30e60e[0x0]);continue;}throw CliErrors[_0x5ce7a1(0x100)](_0x5ce7a1(0x112)+_0xa84a11+_0x5ce7a1(0x13c));}return _0x5ac95b;}export const sqlPush={'service':a254_0x2aaff4(0x13e),'command':'push','description':a254_0x2aaff4(0x12c),'risk':a254_0x2aaff4(0x12e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x2aaff4(0x13d),'type':a254_0x2aaff4(0x104),'description':a254_0x2aaff4(0x11e)}],async 'dryRun'(_0x31cf58){const _0x42c391=a254_0x2aaff4,_0x45b5b1=loadSqlProjectConfig(_0x31cf58[_0x42c391(0x119)]),_0x1d58a0=await readSqlLockFile(_0x45b5b1[_0x42c391(0x132)]),{appLock:_0x2bacfc}=ensureSqlLockScope(_0x1d58a0??createEmptySqlLock(),_0x31cf58['appCode'],_0x45b5b1[_0x42c391(0x111)],_0x42c391(0x141)),_0x444228=await getTargetSqlQueries(_0x45b5b1,_0x2bacfc,_0x31cf58['str']('sqlcode')||undefined),_0x269989=[];for(const _0x148452 of _0x444228){const _0x3e510b=await computeSqlFileHash(_0x148452['filePath']),_0x39051b=_0x2bacfc['sqls'][_0x148452[_0x42c391(0x122)]],_0x1844f1=!!_0x39051b&&(_0x39051b[_0x42c391(0x10d)]!==_0x148452[_0x42c391(0x118)]||!!_0x148452[_0x42c391(0x135)]&&_0x39051b['sqlName']!==_0x148452['sqlName']||_0x39051b[_0x42c391(0x137)]!==_0x148452[_0x42c391(0x137)]);if(!_0x31cf58['bool'](_0x42c391(0x13d))&&_0x39051b&&_0x39051b['hash']===_0x3e510b&&!_0x1844f1)continue;if(!_0x39051b)throw CliErrors['validation'](_0x148452[_0x42c391(0x122)]+_0x42c391(0x10b));if(_0x39051b[_0x42c391(0x117)]==null)throw CliErrors[_0x42c391(0x100)](_0x148452['sqlCode']+':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.');await resolveTargetDbBinding(_0x31cf58[_0x42c391(0x119)],_0x148452,_0x39051b),await readSqlUploadContent(_0x148452),_0x269989[_0x42c391(0x141)](_0x148452[_0x42c391(0x122)]);}return{'method':_0x42c391(0x108),'url':_0x42c391(0x12d),'body':{'sqlCodes':_0x269989,'appCode':_0x31cf58[_0x42c391(0x119)]},'description':_0x42c391(0x10e)+_0x269989[_0x42c391(0x13a)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x1fdecd){const _0x4d3786=a254_0x2aaff4,_0x3182b3=loadSqlProjectConfig(_0x1fdecd[_0x4d3786(0x119)]),_0x2d4a7f=await readSqlLockFile(_0x3182b3[_0x4d3786(0x132)]),{lockData:_0x7f6559,appLock:_0x3a1423}=ensureSqlLockScope(_0x2d4a7f??createEmptySqlLock(),_0x1fdecd[_0x4d3786(0x119)],_0x3182b3[_0x4d3786(0x111)],_0x4d3786(0x141)),_0x25c3e0=await getTargetSqlQueries(_0x3182b3,_0x3a1423,_0x1fdecd['str'](_0x4d3786(0x13f))||undefined);if(_0x25c3e0[_0x4d3786(0x13a)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4d3786(0x140)};const _0x3bf5f6=[],_0x558328=[],_0xbbe8cc=[];let _0x327c72=![];for(const _0x1e8b7c of _0x25c3e0){const _0x23c5e3=_0x3a1423['sqls'][_0x1e8b7c[_0x4d3786(0x122)]];if(!_0x23c5e3){_0xbbe8cc[_0x4d3786(0x141)]({'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'error':_0x4d3786(0xff)});continue;}try{const _0x1d9878=await computeSqlFileHash(_0x1e8b7c[_0x4d3786(0x114)]),_0x1def2f=_0x23c5e3['path']!==_0x1e8b7c['relativePath']||!!_0x1e8b7c[_0x4d3786(0x135)]&&_0x23c5e3[_0x4d3786(0x135)]!==_0x1e8b7c[_0x4d3786(0x135)]||_0x23c5e3[_0x4d3786(0x137)]!==_0x1e8b7c[_0x4d3786(0x137)];if(!_0x1fdecd['bool'](_0x4d3786(0x13d))&&_0x23c5e3[_0x4d3786(0x10a)]===_0x1d9878&&!_0x1def2f){_0x558328[_0x4d3786(0x141)]({'sqlCode':_0x1e8b7c['sqlCode'],'reason':_0x4d3786(0x124)});continue;}if(_0x23c5e3['version']==null){_0xbbe8cc['push']({'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'error':_0x4d3786(0x12f)});continue;}const _0x4ca02a=_0x1e8b7c[_0x4d3786(0x135)]||_0x23c5e3[_0x4d3786(0x135)],_0x4e396b=await resolveTargetDbBinding(_0x1fdecd[_0x4d3786(0x119)],_0x1e8b7c,_0x23c5e3),_0x2d76e6=await readSqlUploadContent(_0x1e8b7c),_0x2b358b=await updateSqlQuery({'id':_0x23c5e3[_0x4d3786(0x103)],'appCode':_0x1fdecd['appCode'],'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'sqlName':_0x4ca02a,'dbId':_0x4e396b[_0x4d3786(0x121)],'version':_0x23c5e3[_0x4d3786(0x117)],'sqlContent':_0x2d76e6,'sqlConfig':_0x23c5e3[_0x4d3786(0x116)]??undefined}),_0x5af435=_0x2b358b[_0x4d3786(0x121)]?await getDbName(_0x1fdecd[_0x4d3786(0x119)],Number(_0x2b358b['dbId']))[_0x4d3786(0x126)](()=>_0x4e396b[_0x4d3786(0x107)]):_0x4e396b['dbName'];_0x3a1423[_0x4d3786(0x11f)][_0x1e8b7c[_0x4d3786(0x122)]]={...buildSqlLockEntry(_0x2b358b,_0x2d76e6,_0x1d9878,{'dbName':_0x5af435}),'path':_0x1e8b7c[_0x4d3786(0x118)],'mode':_0x1e8b7c[_0x4d3786(0x137)]},_0x327c72=!![],await archivePreviousSqlFileIfNeeded(_0x3182b3,_0x23c5e3[_0x4d3786(0x10d)],_0x1e8b7c[_0x4d3786(0x118)]),_0x3bf5f6[_0x4d3786(0x141)]({'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'remoteId':_0x23c5e3[_0x4d3786(0x103)]});}catch(_0x21d97a){_0xbbe8cc[_0x4d3786(0x141)]({'sqlCode':_0x1e8b7c[_0x4d3786(0x122)],'error':_0x21d97a instanceof Error?_0x21d97a[_0x4d3786(0x110)]:String(_0x21d97a)});}}(_0x327c72||_0xbbe8cc[_0x4d3786(0x13a)]===0x0)&&(_0x3a1423[_0x4d3786(0x11a)]=new Date()[_0x4d3786(0x127)](),await writeSqlLockFile(_0x3182b3[_0x4d3786(0x132)],_0x7f6559));const _0x1c778a=_0xbbe8cc[_0x4d3786(0x13a)]===0x0;return{'ok':_0x1c778a,'data':{'pushed':_0x3bf5f6,'skipped':_0x558328,'failed':_0xbbe8cc},'message':'Push\x20complete:\x20'+_0x3bf5f6[_0x4d3786(0x13a)]+_0x4d3786(0x10f)+_0x558328['length']+'\x20skipped,\x20'+_0xbbe8cc[_0x4d3786(0x13a)]+_0x4d3786(0x102)};}};async function archivePreviousSqlFileIfNeeded(_0x25c030,_0x47d1d9,_0x3c2c7f){const _0x31b08a=a254_0x2aaff4;if(!_0x47d1d9||_0x47d1d9===_0x3c2c7f)return;const _0x4a40b9=join(_0x25c030[_0x31b08a(0x125)],_0x47d1d9);if(!await fileExists(_0x4a40b9))return;const _0x1d1068=await moveToTrash(_0x25c030[_0x31b08a(0x136)],_0x25c030[_0x31b08a(0x130)],_0x4a40b9);await cleanupEmptyDirectories(dirname(_0x4a40b9),_0x25c030['sqlRootDir']),void _0x1d1068;}function a254_0x5f38(){const _0x25dbec=['dbName','POST','get','hash',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','filter','path','Would\x20push\x20','\x20pushed,\x20','message','sqlRoot','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','dbDirectory','filePath','212GCoQMj','sqlConfig','version','relativePath','appCode','lastSync','6DCUSlV','replace','16404MMxgXg','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqls','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','dbId','sqlCode','utf8','unchanged','sqlRootDir','catch','toISOString','Local\x20SQL\x20not\x20found:\x20','2182915Tzhjfm','8543673RDXDYe','exec','Push\x20local\x20SQL\x20files\x20to\x20remote','/smartapi/custom/updateUserCustomSql','write','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','trashDir','1454251bRRevJ','lockFilePath','has','9280064btYWoi','sqlName','projectRoot','mode','5992988wMnQaf','startsWith','length','1879165eRcNJh','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','force','sql','sqlcode','No\x20local\x20SQL\x20files\x20found.','push',':\x20SQL\x20content\x20is\x20empty.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','validation','set','\x20failed','remoteId','boolean','trim','No\x20database\x20matches\x20local\x20directory\x20\x22'];a254_0x5f38=function(){return _0x25dbec;};return a254_0x5f38();}async function moveToTrash(_0x5d78e8,_0xbd9a1e,_0x41b1c0){const _0x4d7573=a254_0x2aaff4,_0x280b0c=new Date()[_0x4d7573(0x127)]()[_0x4d7573(0x11c)](/[:.]/g,'-'),_0x59ce66=relative(_0x5d78e8,_0x41b1c0),_0x340ca2=join(_0xbd9a1e,_0x280b0c,_0x59ce66);return await mkdir(dirname(_0x340ca2),{'recursive':!![]}),await rename(_0x41b1c0,_0x340ca2),_0x340ca2;}async function cleanupEmptyDirectories(_0x289636,_0x35eda0){const _0x57e6cb=a254_0x2aaff4;let _0x4232be=resolve(_0x289636);const _0x357044=resolve(_0x35eda0);while(_0x4232be[_0x57e6cb(0x139)](''+_0x357044+sep)||_0x4232be===_0x357044){if(_0x4232be===_0x357044)return;try{const _0xb767a2=await readdir(_0x4232be);if(_0xb767a2[_0x57e6cb(0x13a)]>0x0)return;await rmdir(_0x4232be);}catch{return;}_0x4232be=dirname(_0x4232be);}}async function resolveTargetDbBinding(_0x3edfb6,_0xa559f7,_0x318d68){const _0x3c5158=a254_0x2aaff4,_0x1ed13e=_0xa559f7[_0x3c5158(0x113)];if(!_0x1ed13e)return{'dbId':_0x318d68[_0x3c5158(0x121)],'dbName':_0x318d68[_0x3c5158(0x107)]};const _0x111153=buildDbDirectoryName(_0x318d68[_0x3c5158(0x107)],_0x318d68[_0x3c5158(0x121)]);if(_0x1ed13e===_0x111153)return{'dbId':_0x318d68['dbId'],'dbName':_0x318d68['dbName']};const _0x342607=parseExplicitDbDirectory(_0x1ed13e);if(_0x342607!=null)return{'dbId':_0x342607,'dbName':await getDbName(_0x3edfb6,_0x342607)[_0x3c5158(0x126)](()=>undefined)};const _0x1cad1c=await listDatabases(_0x3edfb6),_0x221101=_0x1cad1c[_0x3c5158(0x10c)](_0x5d3fe2=>buildDbDirectoryName(_0x5d3fe2[_0x3c5158(0x107)],_0x5d3fe2[_0x3c5158(0x121)])===_0x1ed13e);if(_0x221101[_0x3c5158(0x13a)]===0x1)return{'dbId':_0x221101[0x0]['dbId'],'dbName':_0x221101[0x0]['dbName']};if(_0x221101['length']===0x0)throw CliErrors['validation'](_0x3c5158(0x106)+_0x1ed13e+'\x22\x20for\x20sqlCode\x20'+_0xa559f7['sqlCode']+'.');const _0x5d7413=_0x221101['map'](_0x34263a=>_0x34263a[_0x3c5158(0x107)]+'\x20('+_0x34263a[_0x3c5158(0x121)]+')')['join'](',\x20');throw CliErrors[_0x3c5158(0x100)]('Local\x20directory\x20\x22'+_0x1ed13e+_0x3c5158(0x120)+_0xa559f7[_0x3c5158(0x122)]+':\x20'+_0x5d7413);}function parseExplicitDbDirectory(_0x1b48fc){const _0x49994e=a254_0x2aaff4,_0x11a1dc=/^db-(\d+)$/[_0x49994e(0x12b)](_0x1b48fc);if(!_0x11a1dc)return null;const _0x21954d=Number(_0x11a1dc[0x1]);return Number['isFinite'](_0x21954d)&&_0x21954d>0x0?_0x21954d:null;}
|