@lovrabet/rabetbase-cli 2.5.5 → 2.5.6
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/README.md +15 -1
- 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.d.ts +1 -0
- package/lib/commands/dataset/design-context.js +1 -0
- package/lib/commands/dataset/design-start.d.ts +1 -0
- package/lib/commands/dataset/design-start.js +1 -0
- package/lib/commands/dataset/design-status.d.ts +1 -0
- package/lib/commands/dataset/design-status.js +1 -0
- package/lib/commands/dataset/design-sync-retry.d.ts +1 -0
- package/lib/commands/dataset/design-sync-retry.js +1 -0
- package/lib/commands/dataset/design-sync-status.d.ts +1 -0
- package/lib/commands/dataset/design-sync-status.js +1 -0
- package/lib/commands/dataset/design-validate.d.ts +1 -0
- package/lib/commands/dataset/design-validate.js +1 -0
- 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.d.ts +40 -0
- package/lib/commands/db/cross-db-analysis-shared.js +1 -0
- package/lib/commands/db/cross-db-analyze-latest.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-latest.js +1 -0
- package/lib/commands/db/cross-db-analyze-start.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-start.js +1 -0
- package/lib/commands/db/cross-db-analyze-status.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-status.js +1 -0
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +18 -0
- 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.d.ts +17 -0
- package/lib/core/cross-db-analysis.js +1 -0
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.d.ts +17 -0
- package/lib/services/dataset-design/checkpoint.js +1 -0
- package/lib/services/dataset-design/commands.d.ts +6 -0
- package/lib/services/dataset-design/commands.js +1 -0
- package/lib/services/dataset-design/contract.d.ts +7 -0
- package/lib/services/dataset-design/contract.js +1 -0
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +3 -2
- package/skills/rabetbase/SKILL.md +9 -7
- package/skills/rabetbase/guides/database-connection-workflow.md +12 -3
- package/skills/rabetbase/guides/independent-deployment.md +10 -2
- package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +2 -0
- package/skills/rabetbase/references/rabetbase-dataset-design.md +25 -0
- package/skills/rabetbase/references/rabetbase-dataset-generate.md +2 -255
- package/skills/rabetbase/references/rabetbase-db-analyze.md +2 -0
- package/skills/rabetbase/references/rabetbase-db-cross-analyze.md +78 -0
- package/skills/rabetbase-dataset-generation/SKILL.md +45 -0
- package/skills/rabetbase-dataset-generation/references/workflow.md +60 -0
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a224_0x314369=a224_0x3c1a;(function(_0x221a31,_0x545676){const _0x50a87a=a224_0x3c1a,_0x49a127=_0x221a31();while(!![]){try{const _0x8377bc=parseInt(_0x50a87a(0x196))/0x1+parseInt(_0x50a87a(0x1bb))/0x2*(parseInt(_0x50a87a(0x1b2))/0x3)+parseInt(_0x50a87a(0x1a0))/0x4+-parseInt(_0x50a87a(0x17a))/0x5+parseInt(_0x50a87a(0x1a9))/0x6*(parseInt(_0x50a87a(0x1c9))/0x7)+-parseInt(_0x50a87a(0x1cc))/0x8*(parseInt(_0x50a87a(0x1c4))/0x9)+-parseInt(_0x50a87a(0x1b4))/0xa;if(_0x8377bc===_0x545676)break;else _0x49a127['push'](_0x49a127['shift']());}catch(_0x55fa05){_0x49a127['push'](_0x49a127['shift']());}}}(a224_0x361c,0xeb5d7));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a224_0x314369(0x18b),'required':!![],'description':a224_0x314369(0x192)};export const ROLE_REF_FLAG={'name':a224_0x314369(0x1a3),'type':'string','required':!![],'description':a224_0x314369(0x1a8)};export const USER_REF_FLAG={'name':a224_0x314369(0x1c7),'type':a224_0x314369(0x1c0),'required':!![],'description':a224_0x314369(0x19b)};function a224_0x3c1a(_0x5dbec3,_0xaf89d9){_0x5dbec3=_0x5dbec3-0x179;const _0x361c38=a224_0x361c();let _0x3c1ad6=_0x361c38[_0x5dbec3];return _0x3c1ad6;}export const NAME_FLAG={'name':a224_0x314369(0x1a7),'type':a224_0x314369(0x1c0),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a224_0x314369(0x1a7),'type':a224_0x314369(0x1c0),'required':!![],'description':a224_0x314369(0x1c1)};export const REMARK_FLAG={'name':a224_0x314369(0x18d),'type':a224_0x314369(0x1c0),'required':![],'description':a224_0x314369(0x1b7)};export const EXPECT_USER_COUNT_FLAG={'name':a224_0x314369(0x1c3),'type':a224_0x314369(0x18b),'required':![],'description':a224_0x314369(0x1cb)};export const BUILTIN_ROLE_TYPES=['ADMIN',a224_0x314369(0x19c),a224_0x314369(0x18a)];export function isBuiltinRole(_0x532822){const _0x5edf42=a224_0x314369;return BUILTIN_ROLE_TYPES[_0x5edf42(0x1bd)](_0x532822);}export function assertCustomRole(_0x3e20a4,_0x9f4ff2){const _0x46924c=a224_0x314369;if(_0x3e20a4[_0x46924c(0x18e)]!==_0x46924c(0x195))throw CliErrors[_0x46924c(0x1ae)](_0x46924c(0x17f)+_0x9f4ff2+'\x20built-in\x20role\x20'+_0x3e20a4[_0x46924c(0x180)]+'\x20('+_0x3e20a4['roleType']+').',_0x46924c(0x19a));}export function projectRole(_0x5d1fd9){const _0x971948=a224_0x314369;return{'id':_0x5d1fd9['id'],'roleName':_0x5d1fd9['roleName'],'roleType':_0x5d1fd9[_0x971948(0x18e)],'remark':_0x5d1fd9['remark'],'userCount':_0x5d1fd9[_0x971948(0x197)],'permitCount':_0x5d1fd9[_0x971948(0x1aa)],'builtin':isBuiltinRole(_0x5d1fd9[_0x971948(0x18e)])};}export async function resolveRoleRef(_0x3544b9,_0x322d36){const _0x3d2bba=a224_0x314369,_0x281c5b=_0x322d36[_0x3d2bba(0x1ca)]();if(!_0x281c5b)throw CliErrors[_0x3d2bba(0x1ae)](_0x3d2bba(0x199),_0x3d2bba(0x1a2));if(/^\d+$/[_0x3d2bba(0x1b9)](_0x281c5b))return getRoleById(_0x3544b9,Number(_0x281c5b));const _0x331441=await listAllAppRoles(_0x3544b9),_0x2468a1=_0x331441[_0x3d2bba(0x1b3)](_0x4aad1f=>_0x4aad1f[_0x3d2bba(0x180)]===_0x281c5b);if(_0x2468a1[_0x3d2bba(0x188)]===0x0)throw CliErrors[_0x3d2bba(0x1ae)](_0x3d2bba(0x184)+_0x281c5b+'\x22\x20not\x20found\x20in\x20app\x20'+_0x3544b9+'.',_0x3d2bba(0x1c5));if(_0x2468a1[_0x3d2bba(0x188)]>0x1){const _0x3220d7=_0x2468a1[_0x3d2bba(0x1c2)](_0x2d6936=>_0x2d6936['id'])[_0x3d2bba(0x1b8)](',\x20');throw CliErrors[_0x3d2bba(0x1ae)](_0x3d2bba(0x184)+_0x281c5b+_0x3d2bba(0x1be)+_0x3220d7+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x2468a1[0x0];}export async function getRoleById(_0x55a2dc,_0x335bfb){const _0x19f410=a224_0x314369,_0x438fc6=await listAllAppRoles(_0x55a2dc),_0x38c365=_0x438fc6[_0x19f410(0x1b3)](_0x5c3376=>_0x5c3376['id']===_0x335bfb&&(!_0x5c3376[_0x19f410(0x194)]||_0x5c3376[_0x19f410(0x194)]===_0x55a2dc));if(_0x38c365[_0x19f410(0x188)]!==0x1)throw CliErrors[_0x19f410(0x1ae)](_0x19f410(0x183)+_0x335bfb+'\x20not\x20found\x20in\x20app\x20'+_0x55a2dc+'.',_0x19f410(0x1b5));return _0x38c365[0x0];}async function listAllAppRoles(_0x51aebe){const _0x34571f=a224_0x314369,_0x337c1e=0x64,_0x3a7047=[];for(let _0xafac27=0x1;;_0xafac27+=0x1){const {items:_0x67b9b2,paging:_0x40655f}=await listAppRoles(_0x51aebe,{'currentPage':_0xafac27,'pageSize':_0x337c1e});_0x3a7047[_0x34571f(0x1ba)](..._0x67b9b2);if(_0x67b9b2['length']<_0x337c1e||_0x40655f&&_0x3a7047[_0x34571f(0x188)]>=_0x40655f['totalCount'])return _0x3a7047;}}export async function resolveTenantCode(){const _0xaf8f3c=a224_0x314369,_0x51a90c=await getSessionUserInfo(),_0x16a8d5=_0x51a90c?.[_0xaf8f3c(0x1c7)]?.[_0xaf8f3c(0x1a1)]?.[_0xaf8f3c(0x1a6)];if(!_0x16a8d5)throw CliErrors[_0xaf8f3c(0x1ad)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x16a8d5;}function matchMember(_0x50265e,_0x1e886a){const _0x2198a8=a224_0x314369,_0x47ceb6=_0x1e886a[_0x2198a8(0x1ca)]()[_0x2198a8(0x1a4)]();return(_0x50265e[_0x2198a8(0x182)]??'')[_0x2198a8(0x1a4)]()===_0x47ceb6||(_0x50265e[_0x2198a8(0x191)]??'')[_0x2198a8(0x1a4)]()===_0x47ceb6;}function a224_0x361c(){const _0x33dbcf=['includes','\x22\x20is\x20ambiguous\x20(ids:\x20','Missing\x20user\x20reference.','string','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','map','expect-user-count','225FvCbDd','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','dev','user','Pass\x20--user\x20<id|name>.','63EaYQjD','trim','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','287032iDohro','flagMissing','4723145mcamZE','Pass\x20--user\x20<id>.','\x20member(s)\x20but\x20role\x20has\x20','User\x20','Removed\x20','Cannot\x20','roleName','POST','nickname','Role\x20id\x20','Role\x20name\x20\x22','/smartapi/permit/user-role/create','Anti-drift\x20check\x20failed:\x20expected\x20',';\x20no\x20change.','length','/smartapi/permit/user-role/delete','OWNER','number','Check\x20the\x20nickname/username.\x20','remark','roleType','\x20is\x20already\x20a\x20member\x20of\x20role\x20','\x22:\x20','username','Role\x20id\x20(from\x20`role\x20list`)','str','appCode','CUSTOM','1577732BRHeNh','userCount','\x20duplicate\x20memberships\x20for\x20user\x20','Missing\x20role\x20reference.','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','DEV','find','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','No\x20tenant\x20member\x20matches\x20\x22','224132grlURt','tenant','Pass\x20--role\x20<id|name>.','role','toLowerCase','userId','tenant_code','name','Role\x20id\x20or\x20exact\x20role\x20name','949398AdgjdV','permitCount','\x20is\x20not\x20a\x20member\x20of\x20role\x20','\x20members\x20of\x20the\x20OWNER\x20role.','authRequired','validation','user-add','dryRun','expectUserCount','6ruNBtP','filter','10050010RgkdWW','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','flag','Optional\x20role\x20remark/description','join','test','push','752798xRGlKO','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.'];a224_0x361c=function(){return _0x33dbcf;};return a224_0x361c();}export async function resolveUserRef(_0x154e17,_0x2641a0=a224_0x314369(0x17b)){const _0x25c70d=a224_0x314369,_0x5ff0c1=_0x154e17[_0x25c70d(0x1ca)]();if(!_0x5ff0c1)throw CliErrors[_0x25c70d(0x1ae)](_0x25c70d(0x1bf),_0x25c70d(0x1c8));const _0x512c9b=await resolveTenantCode(),_0x424c79=await getTenantMembers(_0x512c9b);if(/^\d+$/['test'](_0x5ff0c1)){const _0x5c9dd3=Number(_0x5ff0c1),_0x875bf=_0x424c79[_0x25c70d(0x19d)](_0x4c8b48=>_0x4c8b48[_0x25c70d(0x1a5)]===_0x5c9dd3);return{'userId':_0x5c9dd3,'username':_0x875bf?.[_0x25c70d(0x191)]??String(_0x5c9dd3),'nickname':_0x875bf?.[_0x25c70d(0x182)],'matchedBy':'id'};}const _0x3cd4b4=_0x424c79[_0x25c70d(0x1b3)](_0x2b50f4=>matchMember(_0x2b50f4,_0x5ff0c1));if(_0x3cd4b4[_0x25c70d(0x188)]===0x0)throw CliErrors[_0x25c70d(0x1ae)](_0x25c70d(0x19f)+_0x5ff0c1+'\x22.',_0x25c70d(0x18c)+_0x2641a0);if(_0x3cd4b4[_0x25c70d(0x188)]>0x1){const _0x21649d=_0x3cd4b4[_0x25c70d(0x1c2)](_0x1be8b9=>(_0x1be8b9[_0x25c70d(0x182)]??_0x1be8b9[_0x25c70d(0x191)]??'?')+'('+_0x1be8b9['userId']+')')[_0x25c70d(0x1b8)](',\x20');throw CliErrors[_0x25c70d(0x1ae)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x5ff0c1+_0x25c70d(0x190)+_0x21649d+'.',_0x2641a0);}const _0x58cb46=_0x3cd4b4[0x0];return{'userId':_0x58cb46[_0x25c70d(0x1a5)],'username':_0x58cb46[_0x25c70d(0x191)]??String(_0x58cb46['userId']),'nickname':_0x58cb46[_0x25c70d(0x182)],'matchedBy':_0x25c70d(0x1a7)};}export const CREATE_USER_ROLE_PATH=a224_0x314369(0x185);export const DELETE_USER_ROLE_PATH=a224_0x314369(0x189);export function computeRoleUserMutation(_0x4a0f67){const _0x23a621=a224_0x314369,{operation:_0x3632de,appCode:_0x2efa59,role:_0x1d90ae,relations:_0xb19970,user:_0xfca295}=_0x4a0f67,_0x19fc12=[...new Set(_0xb19970[_0x23a621(0x1c2)](_0x310d68=>_0x310d68[_0x23a621(0x1a5)]))],_0x561434=[];if(_0x4a0f67[_0x23a621(0x1b1)]!==undefined&&_0x4a0f67[_0x23a621(0x1b1)]!==_0x19fc12[_0x23a621(0x188)])throw CliErrors[_0x23a621(0x1ae)](_0x23a621(0x186)+_0x4a0f67[_0x23a621(0x1b1)]+_0x23a621(0x17c)+_0x19fc12[_0x23a621(0x188)]+'.',_0x23a621(0x19e));const _0x207183=_0x19fc12[_0x23a621(0x1bd)](_0xfca295[_0x23a621(0x1a5)]),_0x4dca49=_0xb19970['filter'](_0x43e0de=>_0x43e0de[_0x23a621(0x1a5)]===_0xfca295['userId'])['map'](_0x39c64d=>_0x39c64d['id']),_0x12592a=_0x3632de===_0x23a621(0x1af)?!_0x207183:_0x207183;let _0x40dc5e=_0x19fc12;_0x3632de===_0x23a621(0x1af)?_0x207183?_0x561434[_0x23a621(0x1ba)]('User\x20'+_0xfca295[_0x23a621(0x1a5)]+_0x23a621(0x18f)+_0x1d90ae[_0x23a621(0x180)]+';\x20no\x20change.'):_0x40dc5e=[..._0x19fc12,_0xfca295[_0x23a621(0x1a5)]]:!_0x207183?_0x561434['push'](_0x23a621(0x17d)+_0xfca295[_0x23a621(0x1a5)]+_0x23a621(0x1ab)+_0x1d90ae[_0x23a621(0x180)]+_0x23a621(0x187)):(_0x40dc5e=_0x19fc12[_0x23a621(0x1b3)](_0xd8d068=>_0xd8d068!==_0xfca295[_0x23a621(0x1a5)]),_0x4dca49['length']>0x1&&_0x561434[_0x23a621(0x1ba)](_0x23a621(0x17e)+_0x4dca49[_0x23a621(0x188)]+_0x23a621(0x198)+_0xfca295[_0x23a621(0x1a5)]+'.'));const _0x3d2fb6={'scope':_0x23a621(0x1c6),'operation':_0x3632de,'selector':{'appCode':_0x2efa59,'roleId':_0x1d90ae['id'],'roleName':_0x1d90ae[_0x23a621(0x180)],'userId':_0xfca295[_0x23a621(0x1a5)]},'before':{'userIds':_0x19fc12},'after':{'userIds':_0x40dc5e},'dryRun':_0x4a0f67[_0x23a621(0x1b0)],'backend':{'method':_0x23a621(0x181),'path':_0x3632de===_0x23a621(0x1af)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x561434};return{'mutation':_0x3d2fb6,'changed':_0x12592a,'matchingRelationIds':_0x4dca49};}export async function loadDevRoleRelations(_0x1c06a0,_0x4f207a){const _0x50c774=a224_0x314369,_0x32175a=0x64,_0x2ae3aa=[];for(let _0x54620f=0x1;;_0x54620f+=0x1){const {items:_0x27aa30,paging:_0x25606d}=await listDevUserRoleRelations(_0x1c06a0,{'roleId':_0x4f207a,'currentPage':_0x54620f,'pageSize':_0x32175a});_0x2ae3aa[_0x50c774(0x1ba)](..._0x27aa30);if(_0x27aa30[_0x50c774(0x188)]<_0x32175a||_0x25606d&&_0x2ae3aa['length']>=_0x25606d['totalCount'])return _0x2ae3aa;}}export function readRoleRef(_0x5256eb){const _0x56a5bb=a224_0x314369,_0x51c31b=_0x5256eb[_0x56a5bb(0x193)]('role')['trim']();if(!_0x51c31b)throw CliErrors['flagMissing'](_0x56a5bb(0x1a3),_0x56a5bb(0x1a2));return _0x51c31b;}export async function prepareUserMutation(_0x8bf617,_0x508361,_0x493379){const _0x967343=a224_0x314369,_0x1171aa=readRoleRef(_0x8bf617),_0x5ecf64=_0x8bf617[_0x967343(0x193)]('user')[_0x967343(0x1ca)]();if(!_0x5ecf64)throw CliErrors[_0x967343(0x179)](_0x967343(0x1c7),'Pass\x20--user\x20<id|name>.');const _0x1be740=_0x8bf617[_0x967343(0x1b6)](_0x967343(0x1c3)),_0x44d2c9=_0x1be740===undefined||_0x1be740===null?undefined:Number(_0x1be740),_0x4ed9c6=await resolveRoleRef(_0x8bf617[_0x967343(0x194)],_0x1171aa);if(_0x4ed9c6[_0x967343(0x18e)]===_0x967343(0x18a))throw CliErrors[_0x967343(0x1ae)](_0x967343(0x17f)+_0x508361+_0x967343(0x1ac),_0x967343(0x1bc));const _0x3c39f7=await resolveUserRef(_0x5ecf64),_0x2db926=await loadDevRoleRelations(_0x8bf617['appCode'],_0x4ed9c6['id']);return{...computeRoleUserMutation({'operation':_0x508361,'appCode':_0x8bf617[_0x967343(0x194)],'role':_0x4ed9c6,'relations':_0x2db926,'user':{'userId':_0x3c39f7[_0x967343(0x1a5)],'username':_0x3c39f7['username'],'nickname':_0x3c39f7[_0x967343(0x182)]},'dryRun':_0x493379,..._0x44d2c9!==undefined?{'expectUserCount':_0x44d2c9}:{}}),'role':_0x4ed9c6,'user':_0x3c39f7};}
|
|
1
|
+
const a234_0x19aec3=a234_0x40e1;(function(_0x49dc2d,_0x47c580){const _0x275b43=a234_0x40e1,_0x537b98=_0x49dc2d();while(!![]){try{const _0x1c30b2=parseInt(_0x275b43(0x21e))/0x1+-parseInt(_0x275b43(0x216))/0x2+-parseInt(_0x275b43(0x1ee))/0x3+-parseInt(_0x275b43(0x1f8))/0x4+-parseInt(_0x275b43(0x20f))/0x5*(-parseInt(_0x275b43(0x1e1))/0x6)+-parseInt(_0x275b43(0x1e0))/0x7+parseInt(_0x275b43(0x213))/0x8;if(_0x1c30b2===_0x47c580)break;else _0x537b98['push'](_0x537b98['shift']());}catch(_0x287118){_0x537b98['push'](_0x537b98['shift']());}}}(a234_0x15d8,0x212bd));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a234_0x19aec3(0x212),'required':!![],'description':a234_0x19aec3(0x1fe)};export const ROLE_REF_FLAG={'name':a234_0x19aec3(0x215),'type':a234_0x19aec3(0x203),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a234_0x19aec3(0x224),'type':a234_0x19aec3(0x203),'required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a234_0x19aec3(0x22a),'type':a234_0x19aec3(0x203),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a234_0x19aec3(0x22a),'type':a234_0x19aec3(0x203),'required':!![],'description':a234_0x19aec3(0x20d)};export const REMARK_FLAG={'name':'remark','type':a234_0x19aec3(0x203),'required':![],'description':a234_0x19aec3(0x219)};function a234_0x40e1(_0x350914,_0x2adbb2){_0x350914=_0x350914-0x1db;const _0x15d85c=a234_0x15d8();let _0x40e115=_0x15d85c[_0x350914];return _0x40e115;}export const EXPECT_USER_COUNT_FLAG={'name':a234_0x19aec3(0x205),'type':'number','required':![],'description':a234_0x19aec3(0x221)};export const BUILTIN_ROLE_TYPES=[a234_0x19aec3(0x226),a234_0x19aec3(0x20e),a234_0x19aec3(0x21a)];export function isBuiltinRole(_0x21675a){const _0x34153d=a234_0x19aec3;return BUILTIN_ROLE_TYPES[_0x34153d(0x220)](_0x21675a);}export function assertCustomRole(_0x3a1739,_0x5c1595){const _0x52cf02=a234_0x19aec3;if(_0x3a1739[_0x52cf02(0x200)]!==_0x52cf02(0x1e4))throw CliErrors[_0x52cf02(0x1f4)](_0x52cf02(0x1fd)+_0x5c1595+_0x52cf02(0x202)+_0x3a1739[_0x52cf02(0x227)]+'\x20('+_0x3a1739['roleType']+').',_0x52cf02(0x222));}export function projectRole(_0x333f76){const _0x2e33f3=a234_0x19aec3;return{'id':_0x333f76['id'],'roleName':_0x333f76[_0x2e33f3(0x227)],'roleType':_0x333f76[_0x2e33f3(0x200)],'remark':_0x333f76[_0x2e33f3(0x1ff)],'userCount':_0x333f76[_0x2e33f3(0x1e3)],'permitCount':_0x333f76[_0x2e33f3(0x1f2)],'builtin':isBuiltinRole(_0x333f76[_0x2e33f3(0x200)])};}export async function resolveRoleRef(_0x2aa7bd,_0x3277a7){const _0x4928fb=a234_0x19aec3,_0x39c57f=_0x3277a7[_0x4928fb(0x1f3)]();if(!_0x39c57f)throw CliErrors[_0x4928fb(0x1f4)](_0x4928fb(0x1dc),'Pass\x20--role\x20<id|name>.');if(/^\d+$/['test'](_0x39c57f))return getRoleById(_0x2aa7bd,Number(_0x39c57f));const _0x73e994=await listAllAppRoles(_0x2aa7bd),_0x38275a=_0x73e994[_0x4928fb(0x1f6)](_0x47326d=>_0x47326d['roleName']===_0x39c57f);if(_0x38275a['length']===0x0)throw CliErrors[_0x4928fb(0x1f4)]('Role\x20name\x20\x22'+_0x39c57f+_0x4928fb(0x225)+_0x2aa7bd+'.',_0x4928fb(0x1db));if(_0x38275a[_0x4928fb(0x20b)]>0x1){const _0x32e10e=_0x38275a[_0x4928fb(0x1e9)](_0x3dbe81=>_0x3dbe81['id'])[_0x4928fb(0x1f0)](',\x20');throw CliErrors[_0x4928fb(0x1f4)]('Role\x20name\x20\x22'+_0x39c57f+_0x4928fb(0x217)+_0x32e10e+').',_0x4928fb(0x209));}return _0x38275a[0x0];}export async function getRoleById(_0x5f5291,_0x1df92b){const _0x3ef223=a234_0x19aec3,_0x9ba36a=await listAllAppRoles(_0x5f5291),_0x4cb56f=_0x9ba36a['filter'](_0x24800b=>_0x24800b['id']===_0x1df92b&&(!_0x24800b[_0x3ef223(0x1f5)]||_0x24800b[_0x3ef223(0x1f5)]===_0x5f5291));if(_0x4cb56f[_0x3ef223(0x20b)]!==0x1)throw CliErrors[_0x3ef223(0x1f4)](_0x3ef223(0x1f1)+_0x1df92b+_0x3ef223(0x1f9)+_0x5f5291+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x4cb56f[0x0];}async function listAllAppRoles(_0x32cb4b){const _0x467324=a234_0x19aec3,_0x22fd7d=0x64,_0x3982f1=[];for(let _0x357fc6=0x1;;_0x357fc6+=0x1){const {items:_0x28640d,paging:_0x590fba}=await listAppRoles(_0x32cb4b,{'currentPage':_0x357fc6,'pageSize':_0x22fd7d});_0x3982f1[_0x467324(0x214)](..._0x28640d);if(_0x28640d[_0x467324(0x20b)]<_0x22fd7d||_0x590fba&&_0x3982f1['length']>=_0x590fba['totalCount'])return _0x3982f1;}}function a234_0x15d8(){const _0x24d46f=['string','Pass\x20--user\x20<id>.','expect-user-count','flag','user-add','nickname','Disambiguate\x20with\x20--role\x20<id>.','expectUserCount','length','Pass\x20--user\x20<id|name>.','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','DEV','735adwrDr','Missing\x20user\x20reference.','totalCount','number','4490536tahQGc','push','role','315152ExbSJa','\x22\x20is\x20ambiguous\x20(ids:\x20','\x20members\x20of\x20the\x20OWNER\x20role.','Optional\x20role\x20remark/description','OWNER','test','str','tenant','212797oqVtwT','Multiple\x20tenant\x20members\x20match\x20\x22','includes','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','dryRun','user','\x22\x20not\x20found\x20in\x20app\x20','ADMIN','roleName','/smartapi/permit/user-role/create','Check\x20the\x20nickname/username.\x20','name','User\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Missing\x20role\x20reference.','toLowerCase','POST','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','1522808PgxwWG','3978ewBTPU','\x20member(s)\x20but\x20role\x20has\x20','userCount','CUSTOM','\x20is\x20not\x20a\x20member\x20of\x20role\x20','\x20is\x20already\x20a\x20member\x20of\x20role\x20','No\x20tenant\x20member\x20matches\x20\x22','userId','map','username','Anti-drift\x20check\x20failed:\x20expected\x20','Removed\x20',';\x20no\x20change.','678039IwXfrm','\x20duplicate\x20memberships\x20for\x20user\x20','join','Role\x20id\x20','permitCount','trim','validation','appCode','filter','Pass\x20--role\x20<id|name>.','538292SQHgwv','\x20not\x20found\x20in\x20app\x20','/smartapi/permit/user-role/delete','find','\x22:\x20','Cannot\x20','Role\x20id\x20(from\x20`role\x20list`)','remark','roleType','dev','\x20built-in\x20role\x20'];a234_0x15d8=function(){return _0x24d46f;};return a234_0x15d8();}export async function resolveTenantCode(){const _0x41466e=a234_0x19aec3,_0xc33fb9=await getSessionUserInfo(),_0x114ba9=_0xc33fb9?.[_0x41466e(0x224)]?.[_0x41466e(0x21d)]?.['tenant_code'];if(!_0x114ba9)throw CliErrors['authRequired']('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x114ba9;}function matchMember(_0x4c3b14,_0xa3b914){const _0x15dea5=a234_0x19aec3,_0x467c3c=_0xa3b914[_0x15dea5(0x1f3)]()[_0x15dea5(0x1dd)]();return(_0x4c3b14[_0x15dea5(0x208)]??'')[_0x15dea5(0x1dd)]()===_0x467c3c||(_0x4c3b14[_0x15dea5(0x1ea)]??'')[_0x15dea5(0x1dd)]()===_0x467c3c;}export async function resolveUserRef(_0x2a6928,_0x40e7ee=a234_0x19aec3(0x204)){const _0x530e32=a234_0x19aec3,_0x3de12a=_0x2a6928['trim']();if(!_0x3de12a)throw CliErrors[_0x530e32(0x1f4)](_0x530e32(0x210),_0x530e32(0x20c));const _0x1218da=await resolveTenantCode(),_0x569c9e=await getTenantMembers(_0x1218da);if(/^\d+$/[_0x530e32(0x21b)](_0x3de12a)){const _0x363617=Number(_0x3de12a),_0x3ccd70=_0x569c9e[_0x530e32(0x1fb)](_0x4b80f4=>_0x4b80f4[_0x530e32(0x1e8)]===_0x363617);return{'userId':_0x363617,'username':_0x3ccd70?.[_0x530e32(0x1ea)]??String(_0x363617),'nickname':_0x3ccd70?.[_0x530e32(0x208)],'matchedBy':'id'};}const _0xb923a=_0x569c9e['filter'](_0x4f91d5=>matchMember(_0x4f91d5,_0x3de12a));if(_0xb923a[_0x530e32(0x20b)]===0x0)throw CliErrors[_0x530e32(0x1f4)](_0x530e32(0x1e7)+_0x3de12a+'\x22.',_0x530e32(0x229)+_0x40e7ee);if(_0xb923a[_0x530e32(0x20b)]>0x1){const _0x295837=_0xb923a[_0x530e32(0x1e9)](_0x4e381a=>(_0x4e381a[_0x530e32(0x208)]??_0x4e381a[_0x530e32(0x1ea)]??'?')+'('+_0x4e381a['userId']+')')['join'](',\x20');throw CliErrors['validation'](_0x530e32(0x21f)+_0x3de12a+_0x530e32(0x1fc)+_0x295837+'.',_0x40e7ee);}const _0x1d5993=_0xb923a[0x0];return{'userId':_0x1d5993[_0x530e32(0x1e8)],'username':_0x1d5993[_0x530e32(0x1ea)]??String(_0x1d5993[_0x530e32(0x1e8)]),'nickname':_0x1d5993[_0x530e32(0x208)],'matchedBy':_0x530e32(0x22a)};}export const CREATE_USER_ROLE_PATH=a234_0x19aec3(0x228);export const DELETE_USER_ROLE_PATH=a234_0x19aec3(0x1fa);export function computeRoleUserMutation(_0x75137d){const _0x4c7a7e=a234_0x19aec3,{operation:_0x19b3c0,appCode:_0x1a92d9,role:_0x535d4a,relations:_0x58128a,user:_0x3ec54a}=_0x75137d,_0x379fc0=[...new Set(_0x58128a[_0x4c7a7e(0x1e9)](_0xd09749=>_0xd09749['userId']))],_0x285b0d=[];if(_0x75137d[_0x4c7a7e(0x20a)]!==undefined&&_0x75137d[_0x4c7a7e(0x20a)]!==_0x379fc0[_0x4c7a7e(0x20b)])throw CliErrors[_0x4c7a7e(0x1f4)](_0x4c7a7e(0x1eb)+_0x75137d[_0x4c7a7e(0x20a)]+_0x4c7a7e(0x1e2)+_0x379fc0[_0x4c7a7e(0x20b)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x3f704c=_0x379fc0[_0x4c7a7e(0x220)](_0x3ec54a['userId']),_0x158baf=_0x58128a[_0x4c7a7e(0x1f6)](_0xd01dcb=>_0xd01dcb[_0x4c7a7e(0x1e8)]===_0x3ec54a[_0x4c7a7e(0x1e8)])['map'](_0x2b3129=>_0x2b3129['id']),_0x7d87a9=_0x19b3c0===_0x4c7a7e(0x207)?!_0x3f704c:_0x3f704c;let _0x264e0a=_0x379fc0;_0x19b3c0===_0x4c7a7e(0x207)?_0x3f704c?_0x285b0d[_0x4c7a7e(0x214)](_0x4c7a7e(0x22b)+_0x3ec54a[_0x4c7a7e(0x1e8)]+_0x4c7a7e(0x1e6)+_0x535d4a[_0x4c7a7e(0x227)]+_0x4c7a7e(0x1ed)):_0x264e0a=[..._0x379fc0,_0x3ec54a[_0x4c7a7e(0x1e8)]]:!_0x3f704c?_0x285b0d['push'](_0x4c7a7e(0x22b)+_0x3ec54a[_0x4c7a7e(0x1e8)]+_0x4c7a7e(0x1e5)+_0x535d4a[_0x4c7a7e(0x227)]+_0x4c7a7e(0x1ed)):(_0x264e0a=_0x379fc0[_0x4c7a7e(0x1f6)](_0x1db304=>_0x1db304!==_0x3ec54a['userId']),_0x158baf[_0x4c7a7e(0x20b)]>0x1&&_0x285b0d[_0x4c7a7e(0x214)](_0x4c7a7e(0x1ec)+_0x158baf[_0x4c7a7e(0x20b)]+_0x4c7a7e(0x1ef)+_0x3ec54a['userId']+'.'));const _0x487f68={'scope':_0x4c7a7e(0x201),'operation':_0x19b3c0,'selector':{'appCode':_0x1a92d9,'roleId':_0x535d4a['id'],'roleName':_0x535d4a[_0x4c7a7e(0x227)],'userId':_0x3ec54a[_0x4c7a7e(0x1e8)]},'before':{'userIds':_0x379fc0},'after':{'userIds':_0x264e0a},'dryRun':_0x75137d[_0x4c7a7e(0x223)],'backend':{'method':_0x4c7a7e(0x1de),'path':_0x19b3c0==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x285b0d};return{'mutation':_0x487f68,'changed':_0x7d87a9,'matchingRelationIds':_0x158baf};}export async function loadDevRoleRelations(_0x24e042,_0x363e0f){const _0x4acd64=a234_0x19aec3,_0x81151b=0x64,_0x16f4fb=[];for(let _0x44c828=0x1;;_0x44c828+=0x1){const {items:_0x2040d6,paging:_0x10530e}=await listDevUserRoleRelations(_0x24e042,{'roleId':_0x363e0f,'currentPage':_0x44c828,'pageSize':_0x81151b});_0x16f4fb[_0x4acd64(0x214)](..._0x2040d6);if(_0x2040d6[_0x4acd64(0x20b)]<_0x81151b||_0x10530e&&_0x16f4fb['length']>=_0x10530e[_0x4acd64(0x211)])return _0x16f4fb;}}export function readRoleRef(_0x1dff46){const _0x3a39d1=a234_0x19aec3,_0x14acc5=_0x1dff46[_0x3a39d1(0x21c)](_0x3a39d1(0x215))['trim']();if(!_0x14acc5)throw CliErrors['flagMissing']('role',_0x3a39d1(0x1f7));return _0x14acc5;}export async function prepareUserMutation(_0x2b5fdb,_0x139760,_0x4beb70){const _0x5c7d2f=a234_0x19aec3,_0x17f7d1=readRoleRef(_0x2b5fdb),_0x1986ba=_0x2b5fdb[_0x5c7d2f(0x21c)](_0x5c7d2f(0x224))[_0x5c7d2f(0x1f3)]();if(!_0x1986ba)throw CliErrors['flagMissing']('user',_0x5c7d2f(0x20c));const _0x3c41cd=_0x2b5fdb[_0x5c7d2f(0x206)]('expect-user-count'),_0x327a9b=_0x3c41cd===undefined||_0x3c41cd===null?undefined:Number(_0x3c41cd),_0x282001=await resolveRoleRef(_0x2b5fdb['appCode'],_0x17f7d1);if(_0x282001[_0x5c7d2f(0x200)]===_0x5c7d2f(0x21a))throw CliErrors[_0x5c7d2f(0x1f4)](_0x5c7d2f(0x1fd)+_0x139760+_0x5c7d2f(0x218),_0x5c7d2f(0x1df));const _0x1d3447=await resolveUserRef(_0x1986ba),_0x56b2e1=await loadDevRoleRelations(_0x2b5fdb[_0x5c7d2f(0x1f5)],_0x282001['id']);return{...computeRoleUserMutation({'operation':_0x139760,'appCode':_0x2b5fdb[_0x5c7d2f(0x1f5)],'role':_0x282001,'relations':_0x56b2e1,'user':{'userId':_0x1d3447[_0x5c7d2f(0x1e8)],'username':_0x1d3447[_0x5c7d2f(0x1ea)],'nickname':_0x1d3447[_0x5c7d2f(0x208)]},'dryRun':_0x4beb70,..._0x327a9b!==undefined?{'expectUserCount':_0x327a9b}:{}}),'role':_0x282001,'user':_0x1d3447};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a235_0x21d812=a235_0x152d;(function(_0x2685d6,_0x186607){const _0x4dcd34=a235_0x152d,_0xbb8807=_0x2685d6();while(!![]){try{const _0x281300=-parseInt(_0x4dcd34(0x9a))/0x1+parseInt(_0x4dcd34(0x99))/0x2+-parseInt(_0x4dcd34(0x91))/0x3+-parseInt(_0x4dcd34(0x96))/0x4+-parseInt(_0x4dcd34(0x8e))/0x5+-parseInt(_0x4dcd34(0x94))/0x6+parseInt(_0x4dcd34(0x97))/0x7;if(_0x281300===_0x186607)break;else _0xbb8807['push'](_0xbb8807['shift']());}catch(_0x287df7){_0xbb8807['push'](_0xbb8807['shift']());}}}(a235_0x15ad,0x40601));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';function a235_0x15ad(){const _0x347cf3=['update','validation','dev','Updated\x20role\x20','POST','/smartapi/permit/role/update','flag','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','422230RkGGxW','Nothing\x20to\x20update.','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','1282227RveoCz','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','name','1248822vuTszr','num','28336rklsYz','6489994MddMVv','New\x20role\x20name','345170aLJSeq','108970AYnlOb','appCode','--name\x20cannot\x20be\x20empty.','roleName','remark'];a235_0x15ad=function(){return _0x347cf3;};return a235_0x15ad();}function a235_0x152d(_0x50c9ff,_0x350236){_0x50c9ff=_0x50c9ff-0x84;const _0x15ada0=a235_0x15ad();let _0x152d43=_0x15ada0[_0x50c9ff];return _0x152d43;}const UPDATE_PATH=a235_0x21d812(0x8b);function readPatch(_0x1f6422){const _0xb4be41=a235_0x21d812,_0x299f53=_0x1f6422[_0xb4be41(0x8c)](_0xb4be41(0x93)),_0x4e51d8=_0x1f6422[_0xb4be41(0x8c)](_0xb4be41(0x85)),_0x2fde24={};if(_0x299f53!==undefined&&_0x299f53!==null){const _0x50086c=String(_0x299f53)['trim']();if(!_0x50086c)throw CliErrors['validation'](_0xb4be41(0x9c));if(_0x50086c['length']>0x40)throw CliErrors[_0xb4be41(0x87)](_0xb4be41(0x92));_0x2fde24[_0xb4be41(0x84)]=_0x50086c;}_0x4e51d8!==undefined&&_0x4e51d8!==null&&(_0x2fde24[_0xb4be41(0x85)]=String(_0x4e51d8));if(_0x2fde24[_0xb4be41(0x84)]===undefined&&_0x2fde24['remark']===undefined)throw CliErrors[_0xb4be41(0x87)](_0xb4be41(0x8f),_0xb4be41(0x8d));return _0x2fde24;}export const roleUpdate={'service':'role','command':a235_0x21d812(0x86),'description':a235_0x21d812(0x90),'risk':'write','flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a235_0x21d812(0x93),'type':'string','required':![],'description':a235_0x21d812(0x98)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x221f3b){readPatch(_0x221f3b);},async 'dryRun'(_0x12e50d){const _0x2469ca=a235_0x21d812,_0x4dd2ba=_0x12e50d[_0x2469ca(0x95)]('id'),_0x4a41ac=readPatch(_0x12e50d),_0x32a9da=await getRoleById(_0x12e50d[_0x2469ca(0x9b)],_0x4dd2ba);return assertCustomRole(_0x32a9da,_0x2469ca(0x86)),asDryRunResult({'scope':_0x2469ca(0x88),'operation':_0x2469ca(0x86),'selector':{'appCode':_0x12e50d['appCode'],'roleId':_0x4dd2ba,'roleName':_0x32a9da[_0x2469ca(0x84)]},'before':projectRole(_0x32a9da),'after':projectRole({..._0x32a9da,..._0x4a41ac[_0x2469ca(0x84)]!==undefined?{'roleName':_0x4a41ac[_0x2469ca(0x84)]}:{},..._0x4a41ac[_0x2469ca(0x85)]!==undefined?{'remark':_0x4a41ac[_0x2469ca(0x85)]}:{}}),'dryRun':!![],'backend':{'method':_0x2469ca(0x8a),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0xb90f23){const _0x1e076c=a235_0x21d812,_0x1b6cbd=_0xb90f23[_0x1e076c(0x95)]('id'),_0x2b20e1=readPatch(_0xb90f23),_0x21e68c=await getRoleById(_0xb90f23[_0x1e076c(0x9b)],_0x1b6cbd);assertCustomRole(_0x21e68c,'update'),await updateAppRole({'id':_0x1b6cbd,'appCode':_0xb90f23[_0x1e076c(0x9b)],..._0x2b20e1[_0x1e076c(0x84)]!==undefined?{'roleName':_0x2b20e1[_0x1e076c(0x84)]}:{},..._0x2b20e1['remark']!==undefined?{'remark':_0x2b20e1[_0x1e076c(0x85)]}:{}});const _0x11a671=await getRoleById(_0xb90f23[_0x1e076c(0x9b)],_0x1b6cbd);return{'ok':!![],'data':{'scope':_0x1e076c(0x88),'operation':'update','selector':{'appCode':_0xb90f23['appCode'],'roleId':_0x1b6cbd,'roleName':_0x11a671['roleName']},'before':projectRole(_0x21e68c),'after':projectRole(_0x11a671),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x1e076c(0x89)+_0x11a671[_0x1e076c(0x84)]+'\x20(id='+_0x1b6cbd+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a236_0x57a938=a236_0x1719;function a236_0x516f(){const _0x514a56=['user-add','POST','3003483ntsmCs','8lMsINm','1489499QfhMGi','high-risk-write','\x20already\x20in\x20role\x20','626157BWswFq','\x20to\x20role\x20','20DUqwpH','userId','1775818lECzyB','roleId','selector','39247029xhZDjW','username','8544954ZDAqzS','roleType','role','4116220gKmfMA'];a236_0x516f=function(){return _0x514a56;};return a236_0x516f();}(function(_0x46412c,_0x35120f){const _0xf44c40=a236_0x1719,_0x4f3c24=_0x46412c();while(!![]){try{const _0x165acc=-parseInt(_0xf44c40(0x188))/0x1+-parseInt(_0xf44c40(0x18f))/0x2+parseInt(_0xf44c40(0x18b))/0x3*(-parseInt(_0xf44c40(0x18d))/0x4)+parseInt(_0xf44c40(0x183))/0x5+-parseInt(_0xf44c40(0x194))/0x6+parseInt(_0xf44c40(0x186))/0x7+-parseInt(_0xf44c40(0x187))/0x8*(-parseInt(_0xf44c40(0x192))/0x9);if(_0x165acc===_0x35120f)break;else _0x4f3c24['push'](_0x4f3c24['shift']());}catch(_0xe2f7eb){_0x4f3c24['push'](_0x4f3c24['shift']());}}}(a236_0x516f,0xbb7bc));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';function a236_0x1719(_0x1e6c33,_0x4e7fc0){_0x1e6c33=_0x1e6c33-0x181;const _0x516f82=a236_0x516f();let _0x171931=_0x516f82[_0x1e6c33];return _0x171931;}export const roleUserAdd={'service':a236_0x57a938(0x182),'command':a236_0x57a938(0x184),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a236_0x57a938(0x189),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5cc9ac){const _0x2ee05c=a236_0x57a938,{mutation:_0x4248ed}=await prepareUserMutation(_0x5cc9ac,_0x2ee05c(0x184),!![]);return asDryRunResult(_0x4248ed,{'method':_0x2ee05c(0x185),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x8fcabf){const _0xddddbd=a236_0x57a938,{mutation:_0x437443,changed:_0x5bb742,role:_0x37951f,user:_0x4691bf}=await prepareUserMutation(_0x8fcabf,'user-add',![]);return _0x5bb742&&await createDevUserRole({'appCode':_0x8fcabf['appCode'],'userId':_0x4691bf['userId'],'username':_0x4691bf[_0xddddbd(0x193)],'roleType':_0x37951f[_0xddddbd(0x181)],'roleId':_0x437443['selector'][_0xddddbd(0x190)]}),{'ok':!![],'data':_0x437443,'message':_0x5bb742?'Added\x20user\x20'+_0x437443[_0xddddbd(0x191)][_0xddddbd(0x18e)]+_0xddddbd(0x18c)+_0x437443[_0xddddbd(0x191)]['roleName']:'No\x20change:\x20user\x20'+_0x437443[_0xddddbd(0x191)][_0xddddbd(0x18e)]+_0xddddbd(0x18a)+_0x437443[_0xddddbd(0x191)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a237_0x3bae0a=a237_0x494e;function a237_0x492d(){const _0x3b83d9=['259480wafMib','3yJOKqP','230990hkIhLC','190337ARdZSB','\x20from\x20role\x20','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','1158916dEGuQq','selector','82882OTpnYU','userId','121mUNLnu','Removed\x20user\x20','63COuLOt','No\x20change:\x20user\x20','31074ZbfcWP','role','\x20not\x20in\x20role\x20','5JRlOxL','10411848rxsIvy','245wqiRts','roleName','user-remove'];a237_0x492d=function(){return _0x3b83d9;};return a237_0x492d();}(function(_0xa3e25c,_0x226254){const _0x269987=a237_0x494e,_0x2611e3=_0xa3e25c();while(!![]){try{const _0xbf685a=parseInt(_0x269987(0x1c7))/0x1*(-parseInt(_0x269987(0x1be))/0x2)+parseInt(_0x269987(0x1b7))/0x3*(-parseInt(_0x269987(0x1bc))/0x4)+parseInt(_0x269987(0x1b3))/0x5*(parseInt(_0x269987(0x1c4))/0x6)+parseInt(_0x269987(0x1b9))/0x7+parseInt(_0x269987(0x1b6))/0x8*(-parseInt(_0x269987(0x1c2))/0x9)+parseInt(_0x269987(0x1b8))/0xa*(-parseInt(_0x269987(0x1c0))/0xb)+parseInt(_0x269987(0x1b2))/0xc;if(_0xbf685a===_0x226254)break;else _0x2611e3['push'](_0x2611e3['shift']());}catch(_0x53a37e){_0x2611e3['push'](_0x2611e3['shift']());}}}(a237_0x492d,0x29a34));function a237_0x494e(_0x365a32,_0x293ac0){_0x365a32=_0x365a32-0x1b2;const _0x492ddc=a237_0x492d();let _0x494e6f=_0x492ddc[_0x365a32];return _0x494e6f;}import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a237_0x3bae0a(0x1c5),'command':a237_0x3bae0a(0x1b5),'description':a237_0x3bae0a(0x1bb),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x3f6c4f){const _0x103d07=a237_0x3bae0a,{mutation:_0x4dd125}=await prepareUserMutation(_0x3f6c4f,_0x103d07(0x1b5),!![]);return asDryRunResult(_0x4dd125,{'method':'POST','url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x393246){const _0x487ffe=a237_0x3bae0a,{matchingRelationIds:_0x34ac7c,mutation:_0x127d8b,changed:_0x365bdb}=await prepareUserMutation(_0x393246,_0x487ffe(0x1b5),![]);if(_0x365bdb)for(const _0x5e2a0a of _0x34ac7c){await deleteDevUserRole(_0x5e2a0a);}return{'ok':!![],'data':_0x127d8b,'message':_0x365bdb?_0x487ffe(0x1c1)+_0x127d8b[_0x487ffe(0x1bd)][_0x487ffe(0x1bf)]+_0x487ffe(0x1ba)+_0x127d8b['selector'][_0x487ffe(0x1b4)]:_0x487ffe(0x1c3)+_0x127d8b[_0x487ffe(0x1bd)][_0x487ffe(0x1bf)]+_0x487ffe(0x1c6)+_0x127d8b[_0x487ffe(0x1bd)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a238_0xb6d6(_0x4c4f4f,_0x393492){_0x4c4f4f=_0x4c4f4f-0x19a;const _0x198bd1=a238_0x198b();let _0xb6d6cf=_0x198bd1[_0x4c4f4f];return _0xb6d6cf;}const a238_0xa4bacc=a238_0xb6d6;function a238_0x198b(){const _0x534d15=['175MMMOid','read','user-resolve','132cIfMoh','matchedBy','role','1342vYabFj','1617434GUiVkO','nickname','770477oqOsXD','791796jvwvhm','1268aOEPtb','112sHvisf','Resolved\x20\x22','str','Pass\x20--name\x20<nickname|username>.','386344YahMHc','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','396954ngQqFo','flagMissing','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','userId','username','9230wZDtrl','name','\x22\x20→\x20userId\x20','trim'];a238_0x198b=function(){return _0x534d15;};return a238_0x198b();}(function(_0x3408b6,_0x292a5f){const _0x46e981=a238_0xb6d6,_0x4232fd=_0x3408b6();while(!![]){try{const _0x4ef537=-parseInt(_0x46e981(0x1a7))/0x1+-parseInt(_0x46e981(0x1a5))/0x2+parseInt(_0x46e981(0x1a8))/0x3+parseInt(_0x46e981(0x1a9))/0x4*(parseInt(_0x46e981(0x19e))/0x5)+parseInt(_0x46e981(0x1a1))/0x6*(parseInt(_0x46e981(0x1ae))/0x7)+parseInt(_0x46e981(0x1aa))/0x8*(parseInt(_0x46e981(0x1b0))/0x9)+-parseInt(_0x46e981(0x19a))/0xa*(-parseInt(_0x46e981(0x1a4))/0xb);if(_0x4ef537===_0x292a5f)break;else _0x4232fd['push'](_0x4232fd['shift']());}catch(_0x4ea131){_0x4232fd['push'](_0x4232fd['shift']());}}}(a238_0x198b,0x9c493));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a238_0xa4bacc(0x1a3),'command':a238_0xa4bacc(0x1a0),'description':a238_0xa4bacc(0x1af),'risk':a238_0xa4bacc(0x19f),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x41b6cf){const _0x40660e=a238_0xa4bacc;if(!_0x41b6cf[_0x40660e(0x1ac)](_0x40660e(0x19b))[_0x40660e(0x19d)]())throw CliErrors[_0x40660e(0x1b1)](_0x40660e(0x19b),_0x40660e(0x1ad));},async 'execute'(_0x4cc9e0){const _0x1b5d4d=a238_0xa4bacc,_0x5b1d86=_0x4cc9e0[_0x1b5d4d(0x1ac)](_0x1b5d4d(0x19b))[_0x1b5d4d(0x19d)](),_0x5e17f9=await resolveUserRef(_0x5b1d86,_0x1b5d4d(0x1b2));return{'ok':!![],'data':{'user':{'userId':_0x5e17f9[_0x1b5d4d(0x1b3)],'username':_0x5e17f9[_0x1b5d4d(0x1b4)],'nickname':_0x5e17f9[_0x1b5d4d(0x1a6)],'matchedBy':_0x5e17f9[_0x1b5d4d(0x1a2)]}},'message':_0x1b5d4d(0x1ab)+_0x5b1d86+_0x1b5d4d(0x19c)+_0x5e17f9['userId']};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a239_0x2b71f5=a239_0x18b5;(function(_0x2636b3,_0x389fb5){const _0x3b5f37=a239_0x18b5,_0x22ba74=_0x2636b3();while(!![]){try{const _0x5e062f=-parseInt(_0x3b5f37(0x1be))/0x1+-parseInt(_0x3b5f37(0x1c1))/0x2+-parseInt(_0x3b5f37(0x1c7))/0x3*(parseInt(_0x3b5f37(0x1c9))/0x4)+-parseInt(_0x3b5f37(0x1c0))/0x5*(parseInt(_0x3b5f37(0x1ca))/0x6)+parseInt(_0x3b5f37(0x1c4))/0x7+parseInt(_0x3b5f37(0x1bd))/0x8*(-parseInt(_0x3b5f37(0x1c6))/0x9)+parseInt(_0x3b5f37(0x1bf))/0xa;if(_0x5e062f===_0x389fb5)break;else _0x22ba74['push'](_0x22ba74['shift']());}catch(_0x5a42cf){_0x22ba74['push'](_0x22ba74['shift']());}}}(a239_0x1cb9,0xc06b1));import{getAppRule}from'../../core/api-client.js';function a239_0x1cb9(){const _0x549b5a=['Loaded\x20','9zRFSXt','75ytVORm','rule','236476KvhaWk','286674mYZkWN','cookie','appCode','3176912UwJrXN','144652nHGAiY','36613100mWsIDe','125zsBhKJ','2363376AcdPsN','app_rule_not_found','\x20for\x20','10659173zOnBtl'];a239_0x1cb9=function(){return _0x549b5a;};return a239_0x1cb9();}import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';function a239_0x18b5(_0xbcf7e8,_0x280838){_0xbcf7e8=_0xbcf7e8-0x1bc;const _0x1cb979=a239_0x1cb9();let _0x18b5f0=_0x1cb979[_0xbcf7e8];return _0x18b5f0;}export const ruleGet={'service':a239_0x2b71f5(0x1c8),'command':'get','description':'Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','risk':'read','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0xa5eee4){readAppRuleType(_0xa5eee4);},async 'execute'(_0x13e5e3){const _0x138366=a239_0x2b71f5,_0x52e1fe=readAppRuleType(_0x13e5e3),_0x5d252b=await getAppRule(_0x13e5e3[_0x138366(0x1cb)],{'appCode':_0x13e5e3[_0x138366(0x1bc)],'type':_0x52e1fe});if(!_0x5d252b)throw appRuleError(_0x138366(0x1c2),appRuleFileName(_0x52e1fe)+'\x20is\x20not\x20configured\x20for\x20app\x20'+_0x13e5e3[_0x138366(0x1bc)]+'.','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20'+_0x52e1fe+'\x20--file\x20<path>\x20--dry-run`.');return{'ok':!![],'data':{'rule':{...projectAppRule(_0x52e1fe,_0x5d252b),'content':_0x5d252b['content']}},'message':_0x138366(0x1c5)+appRuleFileName(_0x52e1fe)+_0x138366(0x1c3)+_0x13e5e3[_0x138366(0x1bc)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x53ce9a,_0x442afe){const _0x18313b=a240_0x3e5f,_0x4a0008=_0x53ce9a();while(!![]){try{const _0x572b0c=parseInt(_0x18313b(0x10c))/0x1+parseInt(_0x18313b(0x106))/0x2+-parseInt(_0x18313b(0x10b))/0x3+parseInt(_0x18313b(0x10a))/0x4+-parseInt(_0x18313b(0x108))/0x5*(parseInt(_0x18313b(0x105))/0x6)+-parseInt(_0x18313b(0x107))/0x7+parseInt(_0x18313b(0x109))/0x8;if(_0x572b0c===_0x442afe)break;else _0x4a0008['push'](_0x4a0008['shift']());}catch(_0x115241){_0x4a0008['push'](_0x4a0008['shift']());}}}(a240_0x5e06,0x932f0));import{ruleGet}from'../../commands/rule/get.js';import{ruleList}from'../../commands/rule/list.js';function a240_0x3e5f(_0x3756e3,_0x61695b){_0x3756e3=_0x3756e3-0x105;const _0x5e06bd=a240_0x5e06();let _0x3e5f5f=_0x5e06bd[_0x3756e3];return _0x3e5f5f;}import{ruleSet}from'../../commands/rule/set.js';function a240_0x5e06(){const _0x356a0b=['75cKNCVi','2583456lFCYCX','2717428ecguyC','2893206JGNZUg','622536CbFDdY','150666mIGGku','2302950YThCGg','5826583snHViX'];a240_0x5e06=function(){return _0x356a0b;};return a240_0x5e06();}export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a241_0x2d3727=a241_0x3791;function a241_0x3791(_0x115cf6,_0x30c953){_0x115cf6=_0x115cf6-0xfa;const _0x4db719=a241_0x4db7();let _0x37912a=_0x4db719[_0x115cf6];return _0x37912a;}(function(_0xda5a7f,_0x532496){const _0x382926=a241_0x3791,_0x60ee18=_0xda5a7f();while(!![]){try{const _0x202b08=-parseInt(_0x382926(0xfe))/0x1+-parseInt(_0x382926(0x105))/0x2*(-parseInt(_0x382926(0xfb))/0x3)+-parseInt(_0x382926(0xfa))/0x4*(parseInt(_0x382926(0x108))/0x5)+parseInt(_0x382926(0x103))/0x6+parseInt(_0x382926(0x100))/0x7*(-parseInt(_0x382926(0x101))/0x8)+-parseInt(_0x382926(0xff))/0x9+parseInt(_0x382926(0x10b))/0xa*(parseInt(_0x382926(0x107))/0xb);if(_0x202b08===_0x532496)break;else _0x60ee18['push'](_0x60ee18['shift']());}catch(_0x13fcaf){_0x60ee18['push'](_0x60ee18['shift']());}}}(a241_0x4db7,0x5658b));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a241_0x4db7(){const _0x14de81=['583392ZGtsDk','length','29366zHIGfu','all','253zopjSa','11180ddfjpl','cookie','map','558670SjFBue','read','460kIbVzm','87bUyvwK','Loaded\x20app\x20rule\x20configuration\x20for\x20','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','173040iDAngo','6223779uPNWzB','7IigiYf','2660752LVdtHP','appCode'];a241_0x4db7=function(){return _0x14de81;};return a241_0x4db7();}export const ruleList={'service':'rule','command':'list','description':a241_0x2d3727(0xfd),'risk':a241_0x2d3727(0x10c),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x2f3296){const _0x4b5282=a241_0x2d3727,_0x462153=await Promise[_0x4b5282(0x106)](APP_RULE_TYPES[_0x4b5282(0x10a)](_0x3292f2=>getAppRule(_0x2f3296[_0x4b5282(0x109)],{'appCode':_0x2f3296[_0x4b5282(0x102)],'type':_0x3292f2}))),_0x3af5a7=APP_RULE_TYPES[_0x4b5282(0x10a)]((_0xc9b557,_0x527f97)=>projectAppRule(_0xc9b557,_0x462153[_0x527f97]??null));return{'ok':!![],'data':{'total':_0x3af5a7[_0x4b5282(0x104)],'rules':_0x3af5a7},'message':_0x4b5282(0xfc)+_0x2f3296[_0x4b5282(0x102)]};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a242_0x1a8ef9=a242_0x54a8;(function(_0x35c217,_0x5d9acd){const _0x111795=a242_0x54a8,_0x1d93cf=_0x35c217();while(!![]){try{const _0x88325=parseInt(_0x111795(0x10e))/0x1+parseInt(_0x111795(0x13c))/0x2*(parseInt(_0x111795(0x125))/0x3)+-parseInt(_0x111795(0x12b))/0x4+-parseInt(_0x111795(0x127))/0x5*(parseInt(_0x111795(0x11f))/0x6)+-parseInt(_0x111795(0x10a))/0x7*(-parseInt(_0x111795(0x11e))/0x8)+-parseInt(_0x111795(0x13b))/0x9*(parseInt(_0x111795(0x128))/0xa)+parseInt(_0x111795(0x108))/0xb;if(_0x88325===_0x5d9acd)break;else _0x1d93cf['push'](_0x1d93cf['shift']());}catch(_0x182604){_0x1d93cf['push'](_0x1d93cf['shift']());}}}(a242_0x2f36,0xe5131));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';function a242_0x54a8(_0x1c062f,_0x523f1d){_0x1c062f=_0x1c062f-0x102;const _0x2f36bb=a242_0x2f36();let _0x54a8f3=_0x2f36bb[_0x1c062f];return _0x54a8f3;}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';const SAVE_PATH='/smartapi/knowledge-base/save',NON_ATOMIC_WARNING='--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.';function readSetInput(_0x3acbcf){const _0x5a4eac=a242_0x54a8,_0x31a752=readAppRuleType(_0x3acbcf),_0x396e82=_0x3acbcf['str'](_0x5a4eac(0x103))[_0x5a4eac(0x107)]();if(!_0x396e82)throw appRuleError(_0x5a4eac(0x138),_0x5a4eac(0x12d),_0x5a4eac(0x12f));const _0x2cb4d0=_0x3acbcf[_0x5a4eac(0x136)](_0x5a4eac(0x10f));let _0x81d814;if(_0x2cb4d0!==undefined){_0x81d814=Number(_0x2cb4d0);if(!Number['isSafeInteger'](_0x81d814)||_0x81d814<0x0)throw appRuleError(_0x5a4eac(0x10d),_0x5a4eac(0x139));}return{'type':_0x31a752,'file':_0x396e82,'expectedVersion':_0x81d814};}async function prepareSet(_0x4e33df){const _0x31fc67=a242_0x54a8,_0x123bee=readSetInput(_0x4e33df),_0x55892d=await readAppRuleFile(_0x123bee[_0x31fc67(0x103)]),_0x759527=await getAppRule(_0x4e33df['cookie'],{'appCode':_0x4e33df[_0x31fc67(0x122)],'type':_0x123bee[_0x31fc67(0x12a)]});if(_0x123bee[_0x31fc67(0x104)]!==undefined&&_0x759527?.[_0x31fc67(0x119)]!==_0x123bee[_0x31fc67(0x104)])throw appRuleError(_0x31fc67(0x111),appRuleFileName(_0x123bee[_0x31fc67(0x12a)])+_0x31fc67(0x118),_0x31fc67(0x117)+_0x123bee[_0x31fc67(0x104)]+';\x20current\x20version\x20is\x20'+(_0x759527?.['version']??_0x31fc67(0x11b))+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x123bee,'replacement':_0x55892d,'beforeRecord':_0x759527,'before':projectAppRule(_0x123bee[_0x31fc67(0x12a)],_0x759527),'planned':{'type':_0x123bee[_0x31fc67(0x12a)],'fileName':appRuleFileName(_0x123bee[_0x31fc67(0x12a)]),'contextScope':appRuleContextScope(_0x123bee[_0x31fc67(0x12a)]),'enabled':!![],'appCode':_0x4e33df['appCode'],'scope':'rules','contentByteSize':_0x55892d[_0x31fc67(0x113)],'contentHash':_0x55892d[_0x31fc67(0x116)]}};}function a242_0x2f36(){const _0x4b5f72=['expected-version','rabetbase\x20rule\x20get\x20--type\x20','app_rule_version_mismatch','cause','byteSize','app_rule_set_outcome_unknown','cookie','contentHash','Expected\x20','\x20version\x20changed\x20before\x20write.','version','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','unconfigured','rule','POST','332392huQxKG','10321944wvhHiX','write','app_rule_verification_unavailable','appCode','string','Set\x20','123vBdpNI','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','5DoLuBK','4740vXyGXp','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','type','2544760iNkQPp','\x20could\x20not\x20be\x20verified.','--file\x20is\x20required.','before','Pass\x20a\x20UTF-8\x20Markdown\x20file.','number','app_rule_verification_failed','push','content','input','planned','flag','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','app_rule_file_required','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','\x20for\x20','9936NJamqu','5630deuFLg','verified','replacement','beforeRecord','file','expectedVersion','defineProperty','set','trim','29931825ujgXoX','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','7aMLNxU','rules','\x20--format\x20compress','app_rule_expected_version_invalid','940060aPWkOI'];a242_0x2f36=function(){return _0x4b5f72;};return a242_0x2f36();}function warningsFor(_0x47acda){return _0x47acda===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a242_0x1a8ef9(0x11c),'command':a242_0x1a8ef9(0x106),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a242_0x1a8ef9(0x120),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a242_0x1a8ef9(0x103),'type':a242_0x1a8ef9(0x123),'required':!![],'description':a242_0x1a8ef9(0x109)},{'name':a242_0x1a8ef9(0x10f),'type':a242_0x1a8ef9(0x130),'required':![],'description':a242_0x1a8ef9(0x11a)}],async 'validate'(_0x5bac8e){readSetInput(_0x5bac8e);},async 'dryRun'(_0x4d0607){const _0x19aaa0=a242_0x1a8ef9,_0xf53837=await prepareSet(_0x4d0607);return asDryRunResult({'operation':_0x19aaa0(0x106),'selector':{'appCode':_0x4d0607[_0x19aaa0(0x122)],'scope':_0x19aaa0(0x10b),'type':_0xf53837[_0x19aaa0(0x134)]['type']},'before':_0xf53837[_0x19aaa0(0x12e)],'after':_0xf53837[_0x19aaa0(0x135)],'dryRun':!![],'backend':{'method':_0x19aaa0(0x11d),'path':SAVE_PATH},'warnings':warningsFor(_0xf53837[_0x19aaa0(0x134)][_0x19aaa0(0x104)]),'verification':{'expectedVersion':_0xf53837[_0x19aaa0(0x134)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x19aaa0(0x110)+_0xf53837[_0x19aaa0(0x134)]['type']+_0x19aaa0(0x10c)}},{'method':_0x19aaa0(0x11d),'url':SAVE_PATH});},async 'execute'(_0x4efb89){const _0x4b1945=a242_0x1a8ef9,_0x20c9b8=await prepareSet(_0x4efb89);let _0xd4ed13=![];try{await saveAppRule(_0x4efb89['cookie'],{'appCode':_0x4efb89[_0x4b1945(0x122)],'type':_0x20c9b8[_0x4b1945(0x134)][_0x4b1945(0x12a)],'content':_0x20c9b8[_0x4b1945(0x13e)][_0x4b1945(0x133)]});}catch(_0x43461e){if(!isPlatformTransportFailure(_0x43461e))throw _0x43461e;_0xd4ed13=!![];}let _0x2dc736;try{_0x2dc736=await getAppRule(_0x4efb89[_0x4b1945(0x115)],{'appCode':_0x4efb89[_0x4b1945(0x122)],'type':_0x20c9b8['input']['type']});}catch(_0x183b2a){const _0x474298=appRuleError(_0xd4ed13?_0x4b1945(0x114):_0x4b1945(0x121),'The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x20c9b8['input']['type'])+_0x4b1945(0x12c),_0x4b1945(0x137));Object[_0x4b1945(0x105)](_0x474298,_0x4b1945(0x112),{'value':_0x183b2a,'enumerable':![]});throw _0x474298;}const _0x274d0e=_0x2dc736&&inspectAppRuleContent(_0x2dc736[_0x4b1945(0x133)])[_0x4b1945(0x116)]===_0x20c9b8['replacement'][_0x4b1945(0x116)],_0x21a286=_0x2dc736&&(_0x20c9b8['beforeRecord']===null||_0x2dc736[_0x4b1945(0x119)]>_0x20c9b8[_0x4b1945(0x102)]['version']);if(!_0x2dc736||!_0x274d0e||!_0x21a286)throw appRuleError(_0xd4ed13?_0x4b1945(0x114):_0x4b1945(0x131),appRuleFileName(_0x20c9b8['input'][_0x4b1945(0x12a)])+_0x4b1945(0x126),_0x4b1945(0x129)+_0x20c9b8[_0x4b1945(0x134)][_0x4b1945(0x12a)]+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x118037=warningsFor(_0x20c9b8[_0x4b1945(0x134)][_0x4b1945(0x104)]);_0xd4ed13&&_0x118037[_0x4b1945(0x132)]('Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.');const _0x38bcb3=projectAppRule(_0x20c9b8[_0x4b1945(0x134)]['type'],_0x2dc736);return{'ok':!![],'data':{'operation':_0x4b1945(0x106),'selector':{'appCode':_0x4efb89[_0x4b1945(0x122)],'scope':_0x4b1945(0x10b),'type':_0x20c9b8[_0x4b1945(0x134)]['type']},'before':_0x20c9b8[_0x4b1945(0x12e)],'after':_0x38bcb3,'dryRun':![],'backend':{'method':_0x4b1945(0x11d),'path':SAVE_PATH},'warnings':_0x118037,'verification':{'status':_0x4b1945(0x13d),'recoveredAfterUnknownResponse':_0xd4ed13,'expectedVersion':_0x20c9b8[_0x4b1945(0x134)][_0x4b1945(0x104)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x20c9b8[_0x4b1945(0x134)]['type']+_0x4b1945(0x10c)}},'message':_0x4b1945(0x124)+appRuleFileName(_0x20c9b8[_0x4b1945(0x134)]['type'])+_0x4b1945(0x13a)+_0x4efb89[_0x4b1945(0x122)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a243_0x59d3fd=a243_0x50fb;function a243_0x4f15(){const _0x372c35=['4410060iUChFE','654pljQnd','toLowerCase','byteLength','isFile','893910WEhPhm','26040RIZSIf','33GTWCBo','app_rule_content_too_large','size','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','createTime','278929hOMXDq','DATABASE.md','Cannot\x20read\x20app\x20rule\x20file:\x20','app_rule_file_unreadable','trim','Pass\x20a\x20UTF-8\x20Markdown\x20file.','decode','hex','2TiTsct','RULES.md','app_rule_file_required','153304vbJUvC','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','app_rule_content_invalid','database','version','1912Oetowq','updateTime','App\x20rule\x20file\x20is\x20blank:\x20','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','update','utf-8','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','11709MmbtbA','message','byteSize','contentHash','database-analysis','str','9543237glAhEy','scope','app_rule_file_invalid','content'];a243_0x4f15=function(){return _0x372c35;};return a243_0x4f15();}(function(_0x142109,_0x53eeb9){const _0x9c42b3=a243_0x50fb,_0x484e8b=_0x142109();while(!![]){try{const _0x43fcfd=-parseInt(_0x9c42b3(0xed))/0x1*(-parseInt(_0x9c42b3(0xf5))/0x2)+parseInt(_0x9c42b3(0xe8))/0x3*(parseInt(_0x9c42b3(0xf8))/0x4)+-parseInt(_0x9c42b3(0xe6))/0x5+parseInt(_0x9c42b3(0xe2))/0x6*(-parseInt(_0x9c42b3(0xe7))/0x7)+parseInt(_0x9c42b3(0xfd))/0x8*(-parseInt(_0x9c42b3(0x105))/0x9)+-parseInt(_0x9c42b3(0xe1))/0xa+parseInt(_0x9c42b3(0xdd))/0xb;if(_0x43fcfd===_0x53eeb9)break;else _0x484e8b['push'](_0x484e8b['shift']());}catch(_0x17e926){_0x484e8b['push'](_0x484e8b['shift']());}}}(a243_0x4f15,0x389c3));function a243_0x50fb(_0x421257,_0x3b35b2){_0x421257=_0x421257-0xdd;const _0x4f1582=a243_0x4f15();let _0x50fbf1=_0x4f1582[_0x421257];return _0x50fbf1;}import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=['rules',a243_0x59d3fd(0xfb)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a243_0x59d3fd(0xf6),'database':a243_0x59d3fd(0xee)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a243_0x59d3fd(0x109)};export function appRuleError(_0x2e235b,_0x34c9f8,_0x28646c){return new CliError(_0x2e235b,0x1,_0x34c9f8,_0x28646c);}export function readAppRuleType(_0x10dfa6){const _0xa82905=a243_0x59d3fd,_0x277b46=_0x10dfa6[_0xa82905(0x10a)]('type')['trim']()[_0xa82905(0xe3)]();if(_0x277b46!=='rules'&&_0x277b46!=='database')throw appRuleError('app_rule_type_invalid',_0xa82905(0xeb));return _0x277b46;}export function appRuleFileName(_0xa7196){return APP_RULE_FILES[_0xa7196];}export function appRuleContextScope(_0x3e8cf4){return APP_RULE_CONTEXT_SCOPES[_0x3e8cf4];}export function inspectAppRuleContent(_0x706ccc){const _0x32187b=a243_0x59d3fd,_0x589dff=Buffer['from'](_0x706ccc,'utf8');return{'content':_0x706ccc,'byteSize':_0x589dff[_0x32187b(0xe4)],'contentHash':'sha256:'+createHash('sha256')[_0x32187b(0x101)](_0x589dff)['digest'](_0x32187b(0xf4))};}export async function readAppRuleFile(_0x28535c){const _0x5c2e9d=a243_0x59d3fd,_0xeffe05=_0x28535c[_0x5c2e9d(0xf1)]();if(!_0xeffe05)throw appRuleError(_0x5c2e9d(0xf7),'--file\x20is\x20required.',_0x5c2e9d(0xf2));const _0x496d01=resolve(_0xeffe05);let _0x58640f;try{_0x58640f=await stat(_0x496d01);}catch(_0x3b10ab){throw appRuleError(_0x5c2e9d(0xf0),'Cannot\x20access\x20app\x20rule\x20file:\x20'+_0xeffe05,_0x3b10ab instanceof Error?_0x3b10ab[_0x5c2e9d(0x106)]:String(_0x3b10ab));}if(!_0x58640f[_0x5c2e9d(0xe5)]())throw appRuleError(_0x5c2e9d(0xdf),_0x5c2e9d(0x100)+_0xeffe05);if(_0x58640f[_0x5c2e9d(0xea)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x5c2e9d(0xe9),_0x5c2e9d(0xf9));let _0x38e07f;try{_0x38e07f=await readFile(_0x496d01);}catch(_0x2501c8){throw appRuleError(_0x5c2e9d(0xf0),_0x5c2e9d(0xef)+_0xeffe05,_0x2501c8 instanceof Error?_0x2501c8['message']:String(_0x2501c8));}if(_0x38e07f[_0x5c2e9d(0xe4)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x5c2e9d(0xf9));let _0x3e2259;try{_0x3e2259=new TextDecoder(_0x5c2e9d(0x102),{'fatal':!![],'ignoreBOM':!![]})[_0x5c2e9d(0xf3)](_0x38e07f);}catch{throw appRuleError(_0x5c2e9d(0xfa),_0x5c2e9d(0x104)+_0xeffe05);}if(!_0x3e2259['trim']())throw appRuleError('app_rule_content_invalid',_0x5c2e9d(0xff)+_0xeffe05);return inspectAppRuleContent(_0x3e2259);}export function projectAppRule(_0x5dc164,_0x3d63c2){const _0x27176c=a243_0x59d3fd;if(!_0x3d63c2)return{'type':_0x5dc164,'fileName':appRuleFileName(_0x5dc164),'contextScope':appRuleContextScope(_0x5dc164),'enabled':![]};const _0x409b98=inspectAppRuleContent(_0x3d63c2[_0x27176c(0xe0)]);return{'type':_0x5dc164,'fileName':appRuleFileName(_0x5dc164),'contextScope':appRuleContextScope(_0x5dc164),'enabled':!![],'id':_0x3d63c2['id'],'scope':_0x3d63c2[_0x27176c(0xde)],'appCode':_0x3d63c2['appCode'],'version':_0x3d63c2[_0x27176c(0xfc)],'contentByteSize':_0x409b98[_0x27176c(0x107)],'contentHash':_0x409b98[_0x27176c(0x108)],..._0x3d63c2[_0x27176c(0xec)]!==undefined&&_0x3d63c2[_0x27176c(0xec)]!==null?{'createTime':_0x3d63c2[_0x27176c(0xec)]}:{},..._0x3d63c2['updateTime']!==undefined&&_0x3d63c2[_0x27176c(0xfe)]!==null?{'updateTime':_0x3d63c2[_0x27176c(0xfe)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':'string','required':!![],'description':a243_0x59d3fd(0x103),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0xc51a25=a244_0x104f;(function(_0x228eeb,_0xe0b02c){const _0x383159=a244_0x104f,_0x13d513=_0x228eeb();while(!![]){try{const _0x477da1=-parseInt(_0x383159(0x116))/0x1*(parseInt(_0x383159(0x111))/0x2)+-parseInt(_0x383159(0x113))/0x3*(-parseInt(_0x383159(0x103))/0x4)+-parseInt(_0x383159(0x130))/0x5*(parseInt(_0x383159(0x11d))/0x6)+parseInt(_0x383159(0x11e))/0x7*(parseInt(_0x383159(0x134))/0x8)+parseInt(_0x383159(0x11f))/0x9+-parseInt(_0x383159(0x11b))/0xa*(parseInt(_0x383159(0x115))/0xb)+parseInt(_0x383159(0x100))/0xc;if(_0x477da1===_0xe0b02c)break;else _0x13d513['push'](_0x13d513['shift']());}catch(_0x5d80ab){_0x13d513['push'](_0x13d513['shift']());}}}(a244_0x3973,0xcc178));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';function a244_0x104f(_0x12e929,_0x24cd28){_0x12e929=_0x12e929-0xf8;const _0x397332=a244_0x3973();let _0x104f4a=_0x397332[_0x12e929];return _0x104f4a;}import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';function a244_0x3973(){const _0x55d97c=['2QnRWOi','yarn.lock','3Zzxbeq','keys','22grIMRi','837769MwjKlY','node_modules','script','slice','write','8282090gFzSoe','Available:\x20','477840hXbxSo','21bfmzRf','2030094vaRJRG','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','dev','validation','\x20\x20EXAMPLES','\x20run\x20start','start','\x20run\x20build','\x0a\x20\x20Usage:\x20','package.json','join','\x20run\x20','changed','bun.lock','needsUpgrade','npm','has','5AsGGDB','(none)','.bin','Enable\x20watch\x20mode\x20for\x20preview','3432552QmuIZk','No\x20scripts\x20defined\x20in\x20package.json.','push','args','\x20run\x20preview\x20--watch','belowMinimum','bun.lockb','Run\x20a\x20package.json\x20script','pnpm','vite','\x20run\x20<script>\x0a','close','error','pnpm-lock.yaml','all','build','No\x20package.json\x20found\x20in\x20current\x20directory.','19369848TwQxnK','length','utf-8','1131440jyvfvh','inherit','boolean','--watch','yarn','\x22\x20not\x20found\x20in\x20package.json.','log','cwd','run','bun','\x20\x20\x20\x20','\x20run\x20preview','bool','vite\x20preview\x20exited\x20with\x20code\x20'];a244_0x3973=function(){return _0x55d97c;};return a244_0x3973();}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([a244_0xc51a25(0x125),a244_0xc51a25(0x121)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a244_0xc51a25(0x125),'dev',a244_0xc51a25(0xfe),'preview']);export function syncProjectDomainRoutingBeforeScript(_0x4de6d5,_0x32003f){const _0x41543f=a244_0xc51a25;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x41543f(0x12f)](_0x32003f))return null;const _0x1c1219=findProjectRootDirectory(_0x4de6d5);if(!resolveConfigPath(_0x1c1219))return null;const _0x5f0e1a=writeProjectDomainRoutingManifest(_0x1c1219);return{'path':_0x5f0e1a['path'],'changed':_0x5f0e1a[_0x41543f(0x12b)]};}function readPackageScripts(_0x57b005){const _0x47d8dc=a244_0xc51a25,_0xdd68c8=resolve(_0x57b005,_0x47d8dc(0x128));if(!existsSync(_0xdd68c8))return null;try{const _0xd4c857=JSON['parse'](readFileSync(_0xdd68c8,_0x47d8dc(0x102)));return _0xd4c857['scripts']??{};}catch{return null;}}function detectPackageManager(_0x427eb9){const _0x2baf30=a244_0xc51a25;if(existsSync(resolve(_0x427eb9,_0x2baf30(0x13a)))||existsSync(resolve(_0x427eb9,_0x2baf30(0x12c))))return _0x2baf30(0x10c);if(existsSync(resolve(_0x427eb9,_0x2baf30(0xfc))))return _0x2baf30(0x13c);if(existsSync(resolve(_0x427eb9,_0x2baf30(0x112))))return _0x2baf30(0x107);return _0x2baf30(0x12e);}async function versionCheck(_0x17e626){const _0x1f2129=a244_0xc51a25,_0x3c9a8e=await checkCliVersion();(_0x3c9a8e[_0x1f2129(0x12d)]||_0x3c9a8e[_0x1f2129(0x139)])&&(printCliUpgradeWarning(_0x3c9a8e),assertCliVersionSupported(_0x3c9a8e));const _0xb702b9=await checkSdkVersion(_0x17e626);if(_0xb702b9[_0x1f2129(0x12d)])printSdkUpgradeWarning(_0xb702b9);}function spawnScript(_0x485c16,_0x8cfe46,_0x1abbba,_0x4af442){return new Promise((_0x12f5f2,_0x5c35a3)=>{const _0x550bca=a244_0x104f,_0x5dcb04=[_0x550bca(0x10b),_0x8cfe46,..._0x1abbba],_0x3a62fd=spawn(_0x485c16,_0x5dcb04,{'cwd':_0x4af442,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x4af442,'node_modules',_0x550bca(0x132))+delimiter+process.env.PATH}});_0x3a62fd['on'](_0x550bca(0xfa),_0x3df14a=>{const _0x2bf462=_0x550bca;if(_0x3df14a===0x0||_0x3df14a===null)_0x12f5f2();else _0x5c35a3(new Error(_0x485c16+_0x2bf462(0x12a)+_0x8cfe46+'\x20exited\x20with\x20code\x20'+_0x3df14a));}),_0x3a62fd['on'](_0x550bca(0xfb),_0x5c35a3);});}function spawnViteBuildWatch(_0x37a243){return new Promise((_0x1556cc,_0x501596)=>{const _0x11400a=a244_0x104f,_0x4ad05b=spawn('vite',[_0x11400a(0xfe),_0x11400a(0x106)],{'cwd':_0x37a243,'stdio':_0x11400a(0x104),'shell':!![],'env':{...process.env,'PATH':''+join(_0x37a243,_0x11400a(0x117),'.bin')+delimiter+process.env.PATH}});_0x4ad05b['on'](_0x11400a(0xfa),_0x1f3a57=>{const _0x5201ca=_0x11400a;if(_0x1f3a57===0x0||_0x1f3a57===null)_0x1556cc();else _0x501596(new Error(_0x5201ca(0x120)+_0x1f3a57));}),_0x4ad05b['on']('error',_0x501596);});}function spawnVitePreview(_0x3ff6bb){return new Promise((_0x454cda,_0x57af37)=>{const _0x4dd406=a244_0x104f,_0x2fb684=spawn(_0x4dd406(0xf8),['preview'],{'cwd':_0x3ff6bb,'stdio':_0x4dd406(0x104),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3ff6bb,'node_modules',_0x4dd406(0x132))+delimiter+process.env.PATH}});_0x2fb684['on'](_0x4dd406(0xfa),_0x1a10c3=>{const _0xa567d5=_0x4dd406;if(_0x1a10c3===0x0||_0x1a10c3===null)_0x454cda();else _0x57af37(new Error(_0xa567d5(0x110)+_0x1a10c3));}),_0x2fb684['on'](_0x4dd406(0xfb),_0x57af37);});}const runFlags=[{'name':'watch','type':a244_0xc51a25(0x105),'description':a244_0xc51a25(0x133),'default':![]}];export const runDefinition={'service':a244_0xc51a25(0x10b),'command':a244_0xc51a25(0x10b),'description':a244_0xc51a25(0x13b),'risk':a244_0xc51a25(0x11a),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a244_0xc51a25(0x118),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x37edd2=a244_0xc51a25,_0x38ba39=[];return _0x38ba39[_0x37edd2(0x136)](_0x37edd2(0x123)),_0x38ba39['push'](_0x37edd2(0x10d)+CLI_BIN_NAME+_0x37edd2(0x124)),_0x38ba39[_0x37edd2(0x136)](_0x37edd2(0x10d)+CLI_BIN_NAME+_0x37edd2(0x126)),_0x38ba39[_0x37edd2(0x136)](_0x37edd2(0x10d)+CLI_BIN_NAME+_0x37edd2(0x10e)),_0x38ba39[_0x37edd2(0x136)](_0x37edd2(0x10d)+CLI_BIN_NAME+_0x37edd2(0x138)),_0x38ba39[_0x37edd2(0x129)]('\x0a');},async 'execute'(_0x2b9b94){const _0xe8b1e=a244_0xc51a25,_0x7e1010=process[_0xe8b1e(0x10a)](),_0x55f11f=_0x2b9b94['args'][0x0],_0x4bf4e6=_0x2b9b94[_0xe8b1e(0x137)][_0xe8b1e(0x119)](0x1),_0x2052c9=readPackageScripts(_0x7e1010);if(!_0x2052c9)throw CliErrors[_0xe8b1e(0x122)](_0xe8b1e(0xff));if(!_0x55f11f){const _0x4a3cbf=Object['keys'](_0x2052c9);if(_0x4a3cbf[_0xe8b1e(0x101)]===0x0)console['log'](_0xe8b1e(0x135));else{console[_0xe8b1e(0x109)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x55bf79 of _0x4a3cbf){console[_0xe8b1e(0x109)](_0xe8b1e(0x10d)+_0x55bf79);}console[_0xe8b1e(0x109)](_0xe8b1e(0x127)+CLI_BIN_NAME+_0xe8b1e(0xf9));}return{'ok':!![]};}if(!_0x2052c9[_0x55f11f])throw CliErrors[_0xe8b1e(0x122)]('Script\x20\x22'+_0x55f11f+_0xe8b1e(0x108),_0xe8b1e(0x11c)+(Object[_0xe8b1e(0x114)](_0x2052c9)[_0xe8b1e(0x129)](',\x20')||_0xe8b1e(0x131)));const _0x699408=detectPackageManager(_0x7e1010),_0x560181=syncProjectDomainRoutingBeforeScript(_0x7e1010,_0x55f11f);_0x560181?.['changed']&&console['error']('Domain\x20routing\x20synchronized:\x20'+_0x560181['path']);VERSION_CHECK_SCRIPTS[_0xe8b1e(0x12f)](_0x55f11f)&&await versionCheck(_0x7e1010);if(_0x55f11f==='preview'&&_0x2b9b94[_0xe8b1e(0x10f)]('watch'))return await Promise[_0xe8b1e(0xfd)]([spawnViteBuildWatch(_0x7e1010),spawnVitePreview(_0x7e1010)]),{'ok':!![]};return await spawnScript(_0x699408,_0x55f11f,_0x4bf4e6,_0x7e1010),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x125dea=a245_0x4835;function a245_0x4835(_0x15b458,_0x526e4c){_0x15b458=_0x15b458-0x1df;const _0x2c0b47=a245_0x2c0b();let _0x4835b7=_0x2c0b47[_0x15b458];return _0x4835b7;}(function(_0x477afc,_0x2b0fa7){const _0x41be9d=a245_0x4835,_0x253f1f=_0x477afc();while(!![]){try{const _0x165dfc=parseInt(_0x41be9d(0x1e1))/0x1+parseInt(_0x41be9d(0x1e0))/0x2+parseInt(_0x41be9d(0x1df))/0x3+-parseInt(_0x41be9d(0x1eb))/0x4*(-parseInt(_0x41be9d(0x1ea))/0x5)+parseInt(_0x41be9d(0x1e5))/0x6*(-parseInt(_0x41be9d(0x1e2))/0x7)+parseInt(_0x41be9d(0x1e9))/0x8+-parseInt(_0x41be9d(0x1e6))/0x9*(parseInt(_0x41be9d(0x1ec))/0xa);if(_0x165dfc===_0x2b0fa7)break;else _0x253f1f['push'](_0x253f1f['shift']());}catch(_0x563bb5){_0x253f1f['push'](_0x253f1f['shift']());}}}(a245_0x2c0b,0x77bd2));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x3ae554){const _0x10c8e6=await buildSchemaPayload();return{'ok':!![],'data':_0x10c8e6};}function a245_0x2c0b(){const _0x5ad89f=['9OGzvDP','Export\x20machine-readable\x20command\x20schema\x20(JSON)','json','4095544KafCPC','30PvLdXW','414808QjXfZL','12410120GfTKkD','1810446nEzbxo','365092RnLFDB','370136WcYdVg','7CMaVWf','export','read','3353142BSkPoO'];a245_0x2c0b=function(){return _0x5ad89f;};return a245_0x2c0b();}export const schemaDefinition={'service':'schema','command':a245_0x125dea(0x1e3),'description':a245_0x125dea(0x1e7),'risk':a245_0x125dea(0x1e4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a245_0x125dea(0x1e8),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a236_0x503215=a236_0x580e;(function(_0x42494b,_0x4d6461){const _0x39b85c=a236_0x580e,_0x3c61a5=_0x42494b();while(!![]){try{const _0x535eac=-parseInt(_0x39b85c(0x15c))/0x1*(parseInt(_0x39b85c(0x14c))/0x2)+parseInt(_0x39b85c(0x18a))/0x3*(-parseInt(_0x39b85c(0x183))/0x4)+-parseInt(_0x39b85c(0x18b))/0x5+parseInt(_0x39b85c(0x17f))/0x6+parseInt(_0x39b85c(0x16a))/0x7+parseInt(_0x39b85c(0x178))/0x8*(parseInt(_0x39b85c(0x184))/0x9)+parseInt(_0x39b85c(0x175))/0xa;if(_0x535eac===_0x4d6461)break;else _0x3c61a5['push'](_0x3c61a5['shift']());}catch(_0x5bff5e){_0x3c61a5['push'](_0x3c61a5['shift']());}}}(a236_0x1475,0x26c82));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a236_0x1475(){const _0x4090cf=['name','dbName','validation','db-id','Target\x20database\x20dbId:','953190RxlTRJ','Created\x20SQL\x20query\x20','Select\x20the\x20local\x20SQL\x20mode:','number','Local\x20SQL\x20file\x20mode','SQL\x20name:','nonInteractive','toISOString','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','SELECT\x201\x20AS\x20id;','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','1115500BQmtwr','<server-generated-sqlCode>','flagMissing','32KSnSNq','Target\x20database\x20ID','isFinite','trim','string','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','str','956922TDLUZq','sql','length','flag','48HtQkSy','65241PWoTjY','sqlName','lockFilePath','Invalid\x20database\x20selection\x20payload:\x20','write','File\x20already\x20exists:\x20','4185yXZtoN','913080nvUCWH','dbId\x20cannot\x20be\x20empty','sqlCode','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRoot','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','2TBpaYq','mybatisXml','sqlRootDir','new','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','dbId','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','lastSync','SQL\x20query\x20display\x20name','appCode','map','__manual__','SQL\x20name\x20cannot\x20be\x20empty','MyBatis\x20XML\x20(mybatisXml)','sqls','catch','77997EJgGTE','isInteger','POST','join','utf8','Plain\x20SQL\x20(sql)','\x20\x20SELECT\x201\x20AS\x20id','parse','mode'];a236_0x1475=function(){return _0x4090cf;};return a236_0x1475();}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x1fce98){const _0x41234d=a236_0x580e;if(_0x1fce98===_0x41234d(0x14d))return[_0x41234d(0x174),_0x41234d(0x162),'</select>',''][_0x41234d(0x15f)]('\x0a');return[_0x41234d(0x173),''][_0x41234d(0x15f)]('\x0a');}export const sqlCreate={'service':a236_0x503215(0x180),'command':'create','description':a236_0x503215(0x152),'risk':a236_0x503215(0x188),'flags':[{'name':a236_0x503215(0x165),'type':a236_0x503215(0x17c),'description':a236_0x503215(0x154)},{'name':a236_0x503215(0x168),'type':'number','description':a236_0x503215(0x179)},{'name':a236_0x503215(0x164),'type':a236_0x503215(0x17c),'enum':[a236_0x503215(0x180),a236_0x503215(0x14d)],'description':a236_0x503215(0x16e)}],async 'validate'(_0x4d55bb){const _0x17824c=a236_0x503215;if(!_0x4d55bb[_0x17824c(0x170)])return;if(!_0x4d55bb['str'](_0x17824c(0x165))['trim']())throw CliErrors[_0x17824c(0x177)]('name',_0x17824c(0x14b));const _0xe55fe7=resolveProvidedDbId(_0x4d55bb);if(typeof _0xe55fe7!==_0x17824c(0x16d)||!Number[_0x17824c(0x17a)](_0xe55fe7)||_0xe55fe7<=0x0)throw CliErrors[_0x17824c(0x177)](_0x17824c(0x168),_0x17824c(0x18e));if(!_0x4d55bb['str']('mode')['trim']())throw CliErrors['flagMissing']('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x3e0a5c){const _0x277e26=a236_0x503215,_0x583ce3=loadSqlProjectConfig(_0x3e0a5c[_0x277e26(0x155)]),{sqlName:_0xe89624,dbId:_0x28966e,dbName:_0x87d74a,mode:_0x316ef8}=await resolveSqlNewInputs(_0x3e0a5c),_0x174e6a=buildSqlRelativePath(_0x277e26(0x176),_0xe89624,_0x87d74a,_0x316ef8,_0x28966e),_0x21e81d=_0x583ce3['sqlRootDir']+'/'+_0x174e6a;return{'method':_0x277e26(0x15e),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x3e0a5c[_0x277e26(0x155)],'sqlName':_0xe89624,'dbId':_0x28966e,'mode':_0x316ef8,'localPath':_0x21e81d},'description':_0x277e26(0x172)+_0x583ce3[_0x277e26(0x14e)]};},async 'execute'(_0x585eb9){const _0x30612e=a236_0x503215,_0x57566c=loadSqlProjectConfig(_0x585eb9[_0x30612e(0x155)]),{sqlName:_0x3f676d,dbId:_0x2a1690,dbName:_0x2b45a1,mode:_0x350a44}=await resolveSqlNewInputs(_0x585eb9),_0x173efa=generateSqlTemplate(_0x350a44),_0x522083=await createSqlQuery({'appCode':_0x585eb9[_0x30612e(0x155)],'sqlName':_0x3f676d,'dbId':_0x2a1690,'sqlContent':_0x173efa}),_0x5e9ad0=ensureRemoteSqlContent(_0x522083),_0x2f290d=_0x2b45a1||await getDbName(_0x585eb9[_0x30612e(0x155)],_0x2a1690)['catch'](()=>undefined),_0x518480=buildSqlRelativePath(_0x522083[_0x30612e(0x18d)],_0x522083[_0x30612e(0x185)],_0x2f290d,_0x350a44,_0x2a1690),_0xbbd1d0=_0x57566c[_0x30612e(0x14e)]+'/'+_0x518480,_0x3ea4c2=buildLocalSqlFileContent({'sqlCode':_0x522083[_0x30612e(0x18d)],'sqlName':_0x522083[_0x30612e(0x185)],'dbId':_0x522083[_0x30612e(0x151)]},_0x5e9ad0,{'dbName':_0x2f290d,'mode':_0x350a44,'syncedAt':new Date()[_0x30612e(0x171)](),'description':_0x522083['description']});if(await fileExists(_0xbbd1d0))throw CliErrors[_0x30612e(0x167)](_0x30612e(0x189)+_0xbbd1d0);await ensureParentDirectory(_0xbbd1d0),await writeFile(_0xbbd1d0,_0x3ea4c2,_0x30612e(0x160));const _0x576c29=await readSqlLockFile(_0x57566c['lockFilePath']),{lockData:_0x1ae636,appLock:_0x3152db}=ensureSqlLockScope(_0x576c29??createEmptySqlLock(),_0x57566c[_0x30612e(0x155)],_0x57566c[_0x30612e(0x14a)],_0x30612e(0x14f));return _0x3152db[_0x30612e(0x15a)][_0x522083[_0x30612e(0x18d)]]={...buildSqlLockEntry(_0x522083,_0x5e9ad0,computeSqlContentHash(_0x3ea4c2),{'dbName':_0x2f290d}),'path':_0x518480,'mode':_0x350a44},_0x3152db[_0x30612e(0x153)]=new Date()[_0x30612e(0x171)](),await writeSqlLockFile(_0x57566c[_0x30612e(0x186)],_0x1ae636),{'ok':!![],'data':{'id':_0x522083['id'],'sqlCode':_0x522083['sqlCode'],'sqlName':_0x522083[_0x30612e(0x185)],'dbId':_0x522083[_0x30612e(0x151)],'path':_0xbbd1d0,'mode':_0x350a44},'message':_0x30612e(0x16b)+_0x522083[_0x30612e(0x18d)]};}};async function resolveSqlNewInputs(_0x3a8ffb){const _0x1472ef=await resolveSqlNameInput(_0x3a8ffb),{dbId:_0x377fe1,dbName:_0x3330c8}=await resolveDbSelection(_0x3a8ffb),_0x4b0d2a=await resolveSqlModeInput(_0x3a8ffb);return{'sqlName':_0x1472ef,'dbId':_0x377fe1,'dbName':_0x3330c8,'mode':_0x4b0d2a};}async function resolveSqlNameInput(_0x110881){const _0xf83124=a236_0x503215,_0x4d6a80=_0x110881[_0xf83124(0x17e)](_0xf83124(0x165))[_0xf83124(0x17b)]();if(_0x4d6a80)return _0x4d6a80;if(_0x110881[_0xf83124(0x170)])throw CliErrors['flagMissing']('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0xf83124(0x16f),'validate':_0x1f4ded=>_0x1f4ded[_0xf83124(0x17b)]()?!![]:_0xf83124(0x158)}))['trim']();}async function resolveDbSelection(_0x20babe){const _0x2e6091=a236_0x503215,_0x5f174f=resolveProvidedDbId(_0x20babe);if(typeof _0x5f174f===_0x2e6091(0x16d)&&Number['isFinite'](_0x5f174f)&&_0x5f174f>0x0)return{'dbId':_0x5f174f,'dbName':await getDbName(_0x20babe[_0x2e6091(0x155)],_0x5f174f)[_0x2e6091(0x15b)](()=>undefined)};if(_0x20babe[_0x2e6091(0x170)])throw CliErrors['flagMissing'](_0x2e6091(0x168),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x4f84c3=await listDatabases(_0x20babe[_0x2e6091(0x155)])[_0x2e6091(0x15b)](()=>[]);if(_0x4f84c3[_0x2e6091(0x181)]===0x1)return{'dbId':_0x4f84c3[0x0][_0x2e6091(0x151)],'dbName':_0x4f84c3[0x0]['dbName']};if(_0x4f84c3['length']>0x1){const _0x474b22=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x4f84c3[_0x2e6091(0x156)](_0x162358=>({'name':_0x162358[_0x2e6091(0x166)]+'\x20('+_0x162358[_0x2e6091(0x151)]+')','value':serializeDbSelection(_0x162358)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x2e6091(0x157)}]});if(_0x474b22!=='__manual__')return deserializeDbSelection(_0x474b22);}const _0x3ce336=await input({'message':_0x2e6091(0x169),'validate':_0x151c62=>{const _0x59a8ac=_0x2e6091,_0x2f6c45=_0x151c62[_0x59a8ac(0x17b)]();if(!_0x2f6c45)return _0x59a8ac(0x18c);const _0x5b6c2d=Number(_0x2f6c45);if(!Number[_0x59a8ac(0x15d)](_0x5b6c2d)||_0x5b6c2d<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x3ce336[_0x2e6091(0x17b)]())};}function a236_0x580e(_0x3f38f9,_0x2ee7f2){_0x3f38f9=_0x3f38f9-0x14a;const _0x1475b6=a236_0x1475();let _0x580eca=_0x1475b6[_0x3f38f9];return _0x580eca;}async function resolveSqlModeInput(_0x5953be){const _0x2f34bd=a236_0x503215,_0x2b2c59=_0x5953be[_0x2f34bd(0x17e)](_0x2f34bd(0x164))['trim']();if(_0x2b2c59===_0x2f34bd(0x180)||_0x2b2c59==='mybatisXml')return _0x2b2c59;if(_0x5953be[_0x2f34bd(0x170)])throw CliErrors[_0x2f34bd(0x177)]('mode',_0x2f34bd(0x17d));return await select({'message':_0x2f34bd(0x16c),'choices':[{'name':_0x2f34bd(0x161),'value':_0x2f34bd(0x180),'description':_0x2f34bd(0x150)},{'name':_0x2f34bd(0x159),'value':_0x2f34bd(0x14d),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x29b3fd){const _0x1856e4=a236_0x503215;return JSON['stringify']({'dbId':_0x29b3fd[_0x1856e4(0x151)],'dbName':_0x29b3fd['dbName']});}function deserializeDbSelection(_0x4a4183){const _0x283156=a236_0x503215;try{const _0xa1df50=JSON[_0x283156(0x163)](_0x4a4183);if(typeof _0xa1df50[_0x283156(0x151)]===_0x283156(0x16d)&&Number[_0x283156(0x17a)](_0xa1df50['dbId']))return{'dbId':_0xa1df50['dbId'],'dbName':_0xa1df50[_0x283156(0x166)]};}catch{}throw CliErrors[_0x283156(0x167)](_0x283156(0x187)+_0x4a4183);}function resolveProvidedDbId(_0x5b645c){const _0x4de8c4=a236_0x503215,_0xe5b92=_0x5b645c[_0x4de8c4(0x182)](_0x4de8c4(0x168));if(typeof _0xe5b92==='number'&&Number[_0x4de8c4(0x17a)](_0xe5b92))return _0xe5b92;return undefined;}
|
|
1
|
+
const a246_0x46d7a9=a246_0x58c7;(function(_0x301b77,_0x183f00){const _0x4f0824=a246_0x58c7,_0x3d89bf=_0x301b77();while(!![]){try{const _0x5b8890=-parseInt(_0x4f0824(0x1df))/0x1*(-parseInt(_0x4f0824(0x1bd))/0x2)+parseInt(_0x4f0824(0x1ad))/0x3*(-parseInt(_0x4f0824(0x1a7))/0x4)+-parseInt(_0x4f0824(0x1a4))/0x5+parseInt(_0x4f0824(0x1d5))/0x6*(parseInt(_0x4f0824(0x1a6))/0x7)+-parseInt(_0x4f0824(0x1ce))/0x8+parseInt(_0x4f0824(0x1b4))/0x9+parseInt(_0x4f0824(0x1bc))/0xa;if(_0x5b8890===_0x183f00)break;else _0x3d89bf['push'](_0x3d89bf['shift']());}catch(_0x169f5b){_0x3d89bf['push'](_0x3d89bf['shift']());}}}(a246_0x6453,0x4c173));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a246_0x58c7(_0x168071,_0x4a68b9){_0x168071=_0x168071-0x1a2;const _0x6453c3=a246_0x6453();let _0x58c719=_0x6453c3[_0x168071];return _0x58c719;}function a246_0x6453(){const _0x1f64f0=['toISOString','number','isInteger','Target\x20database\x20dbId:','catch','SELECT\x201\x20AS\x20id;','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','1NOkMXz','Target\x20database\x20ID','dbId\x20cannot\x20be\x20empty','2076055zpwHuc','map','84896ZisXWH','44276jajVjW','flagMissing','/smartapi/custom/saveUserCustomSql','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','isFinite','parse','3hEimzz','length','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','string','sqlCode','dbName','name','1417050azQVdd','db-id','utf8','appCode','trim','str','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','mybatisXml','2276230UCyljh','998606ulkVHS','new','File\x20already\x20exists:\x20','dbId','\x20\x20SELECT\x201\x20AS\x20id','dbId\x20must\x20be\x20a\x20positive\x20integer','stringify','Select\x20the\x20target\x20database:','sqlRootDir','sql','lockFilePath','join','nonInteractive','sqlName','mode','✎\x20Enter\x20dbId\x20manually','Invalid\x20database\x20selection\x20payload:\x20','1559528eKpRDl','__manual__','description','validation','</select>','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Local\x20SQL\x20file\x20mode','24TePaRj','SQL\x20query\x20display\x20name'];a246_0x6453=function(){return _0x1f64f0;};return a246_0x6453();}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(_0x10986a){const _0x218f27=a246_0x58c7;if(_0x10986a===_0x218f27(0x1bb))return[_0x218f27(0x1af),_0x218f27(0x1c1),_0x218f27(0x1d2),'']['join']('\x0a');return[_0x218f27(0x1dc),''][_0x218f27(0x1c8)]('\x0a');}export const sqlCreate={'service':a246_0x46d7a9(0x1c6),'command':'create','description':a246_0x46d7a9(0x1dd),'risk':'write','flags':[{'name':'name','type':'string','description':a246_0x46d7a9(0x1d6)},{'name':'db-id','type':a246_0x46d7a9(0x1d8),'description':a246_0x46d7a9(0x1a2)},{'name':'mode','type':a246_0x46d7a9(0x1b0),'enum':[a246_0x46d7a9(0x1c6),'mybatisXml'],'description':a246_0x46d7a9(0x1d4)}],async 'validate'(_0x517a0d){const _0x3456ec=a246_0x46d7a9;if(!_0x517a0d[_0x3456ec(0x1c9)])return;if(!_0x517a0d['str'](_0x3456ec(0x1b3))[_0x3456ec(0x1b8)]())throw CliErrors[_0x3456ec(0x1a8)]('name',_0x3456ec(0x1ba));const _0x53a838=resolveProvidedDbId(_0x517a0d);if(typeof _0x53a838!==_0x3456ec(0x1d8)||!Number[_0x3456ec(0x1ab)](_0x53a838)||_0x53a838<=0x0)throw CliErrors[_0x3456ec(0x1a8)](_0x3456ec(0x1b5),_0x3456ec(0x1d3));if(!_0x517a0d[_0x3456ec(0x1b9)](_0x3456ec(0x1cb))[_0x3456ec(0x1b8)]())throw CliErrors[_0x3456ec(0x1a8)](_0x3456ec(0x1cb),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x4a852a){const _0x235d4e=a246_0x46d7a9,_0x307fd6=loadSqlProjectConfig(_0x4a852a[_0x235d4e(0x1b7)]),{sqlName:_0x5c7121,dbId:_0x328b19,dbName:_0x1c9e5b,mode:_0x1c2a5e}=await resolveSqlNewInputs(_0x4a852a),_0x258d11=buildSqlRelativePath('<server-generated-sqlCode>',_0x5c7121,_0x1c9e5b,_0x1c2a5e,_0x328b19),_0xce8491=_0x307fd6[_0x235d4e(0x1c5)]+'/'+_0x258d11;return{'method':'POST','url':_0x235d4e(0x1a9),'body':{'appCode':_0x4a852a['appCode'],'sqlName':_0x5c7121,'dbId':_0x328b19,'mode':_0x1c2a5e,'localPath':_0xce8491},'description':_0x235d4e(0x1de)+_0x307fd6[_0x235d4e(0x1c5)]};},async 'execute'(_0x36663f){const _0x16c9af=a246_0x46d7a9,_0x3a767e=loadSqlProjectConfig(_0x36663f['appCode']),{sqlName:_0x2a2754,dbId:_0x108c8d,dbName:_0x48de45,mode:_0x4d20b1}=await resolveSqlNewInputs(_0x36663f),_0x26b6e4=generateSqlTemplate(_0x4d20b1),_0x376c7e=await createSqlQuery({'appCode':_0x36663f[_0x16c9af(0x1b7)],'sqlName':_0x2a2754,'dbId':_0x108c8d,'sqlContent':_0x26b6e4}),_0x18daf1=ensureRemoteSqlContent(_0x376c7e),_0x45a153=_0x48de45||await getDbName(_0x36663f[_0x16c9af(0x1b7)],_0x108c8d)[_0x16c9af(0x1db)](()=>undefined),_0xe50b88=buildSqlRelativePath(_0x376c7e[_0x16c9af(0x1b1)],_0x376c7e[_0x16c9af(0x1ca)],_0x45a153,_0x4d20b1,_0x108c8d),_0x7ed5ba=_0x3a767e['sqlRootDir']+'/'+_0xe50b88,_0x1116a8=buildLocalSqlFileContent({'sqlCode':_0x376c7e[_0x16c9af(0x1b1)],'sqlName':_0x376c7e['sqlName'],'dbId':_0x376c7e[_0x16c9af(0x1c0)]},_0x18daf1,{'dbName':_0x45a153,'mode':_0x4d20b1,'syncedAt':new Date()['toISOString'](),'description':_0x376c7e[_0x16c9af(0x1d0)]});if(await fileExists(_0x7ed5ba))throw CliErrors[_0x16c9af(0x1d1)](_0x16c9af(0x1bf)+_0x7ed5ba);await ensureParentDirectory(_0x7ed5ba),await writeFile(_0x7ed5ba,_0x1116a8,_0x16c9af(0x1b6));const _0x48f748=await readSqlLockFile(_0x3a767e[_0x16c9af(0x1c7)]),{lockData:_0x27b37f,appLock:_0x1bb0bc}=ensureSqlLockScope(_0x48f748??createEmptySqlLock(),_0x3a767e['appCode'],_0x3a767e['sqlRoot'],_0x16c9af(0x1be));return _0x1bb0bc['sqls'][_0x376c7e[_0x16c9af(0x1b1)]]={...buildSqlLockEntry(_0x376c7e,_0x18daf1,computeSqlContentHash(_0x1116a8),{'dbName':_0x45a153}),'path':_0xe50b88,'mode':_0x4d20b1},_0x1bb0bc['lastSync']=new Date()[_0x16c9af(0x1d7)](),await writeSqlLockFile(_0x3a767e['lockFilePath'],_0x27b37f),{'ok':!![],'data':{'id':_0x376c7e['id'],'sqlCode':_0x376c7e['sqlCode'],'sqlName':_0x376c7e[_0x16c9af(0x1ca)],'dbId':_0x376c7e[_0x16c9af(0x1c0)],'path':_0x7ed5ba,'mode':_0x4d20b1},'message':'Created\x20SQL\x20query\x20'+_0x376c7e[_0x16c9af(0x1b1)]};}};async function resolveSqlNewInputs(_0x3f22ee){const _0x57ee69=await resolveSqlNameInput(_0x3f22ee),{dbId:_0x3387ee,dbName:_0x555279}=await resolveDbSelection(_0x3f22ee),_0x5e7fd4=await resolveSqlModeInput(_0x3f22ee);return{'sqlName':_0x57ee69,'dbId':_0x3387ee,'dbName':_0x555279,'mode':_0x5e7fd4};}async function resolveSqlNameInput(_0x218bfb){const _0x3cfc1d=a246_0x46d7a9,_0x5503f6=_0x218bfb[_0x3cfc1d(0x1b9)](_0x3cfc1d(0x1b3))[_0x3cfc1d(0x1b8)]();if(_0x5503f6)return _0x5503f6;if(_0x218bfb[_0x3cfc1d(0x1c9)])throw CliErrors['flagMissing'](_0x3cfc1d(0x1b3),_0x3cfc1d(0x1ba));return(await input({'message':'SQL\x20name:','validate':_0x19868a=>_0x19868a[_0x3cfc1d(0x1b8)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))['trim']();}async function resolveDbSelection(_0x169ef0){const _0x10acfe=a246_0x46d7a9,_0x21586b=resolveProvidedDbId(_0x169ef0);if(typeof _0x21586b==='number'&&Number[_0x10acfe(0x1ab)](_0x21586b)&&_0x21586b>0x0)return{'dbId':_0x21586b,'dbName':await getDbName(_0x169ef0[_0x10acfe(0x1b7)],_0x21586b)[_0x10acfe(0x1db)](()=>undefined)};if(_0x169ef0['nonInteractive'])throw CliErrors[_0x10acfe(0x1a8)](_0x10acfe(0x1b5),_0x10acfe(0x1d3));const _0x278541=await listDatabases(_0x169ef0['appCode'])[_0x10acfe(0x1db)](()=>[]);if(_0x278541[_0x10acfe(0x1ae)]===0x1)return{'dbId':_0x278541[0x0][_0x10acfe(0x1c0)],'dbName':_0x278541[0x0][_0x10acfe(0x1b2)]};if(_0x278541[_0x10acfe(0x1ae)]>0x1){const _0x4499dc=await select({'message':_0x10acfe(0x1c4),'choices':[..._0x278541[_0x10acfe(0x1a5)](_0x583e8f=>({'name':_0x583e8f[_0x10acfe(0x1b2)]+'\x20('+_0x583e8f[_0x10acfe(0x1c0)]+')','value':serializeDbSelection(_0x583e8f)})),{'name':_0x10acfe(0x1cc),'value':'__manual__'}]});if(_0x4499dc!==_0x10acfe(0x1cf))return deserializeDbSelection(_0x4499dc);}const _0x2692e5=await input({'message':_0x10acfe(0x1da),'validate':_0x1a6ec4=>{const _0x2c4d92=_0x10acfe,_0x324a38=_0x1a6ec4['trim']();if(!_0x324a38)return _0x2c4d92(0x1a3);const _0x16de06=Number(_0x324a38);if(!Number[_0x2c4d92(0x1d9)](_0x16de06)||_0x16de06<=0x0)return _0x2c4d92(0x1c2);return!![];}});return{'dbId':Number(_0x2692e5[_0x10acfe(0x1b8)]())};}async function resolveSqlModeInput(_0x22deea){const _0x1a5218=a246_0x46d7a9,_0x333a70=_0x22deea[_0x1a5218(0x1b9)](_0x1a5218(0x1cb))['trim']();if(_0x333a70==='sql'||_0x333a70===_0x1a5218(0x1bb))return _0x333a70;if(_0x22deea[_0x1a5218(0x1c9)])throw CliErrors[_0x1a5218(0x1a8)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x1a5218(0x1c6),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x1a5218(0x1bb),'description':_0x1a5218(0x1aa)}]});}function serializeDbSelection(_0x29e420){const _0x2735fc=a246_0x46d7a9;return JSON[_0x2735fc(0x1c3)]({'dbId':_0x29e420[_0x2735fc(0x1c0)],'dbName':_0x29e420[_0x2735fc(0x1b2)]});}function deserializeDbSelection(_0x32ae59){const _0xac21f8=a246_0x46d7a9;try{const _0x492a66=JSON[_0xac21f8(0x1ac)](_0x32ae59);if(typeof _0x492a66[_0xac21f8(0x1c0)]===_0xac21f8(0x1d8)&&Number[_0xac21f8(0x1ab)](_0x492a66[_0xac21f8(0x1c0)]))return{'dbId':_0x492a66[_0xac21f8(0x1c0)],'dbName':_0x492a66[_0xac21f8(0x1b2)]};}catch{}throw CliErrors[_0xac21f8(0x1d1)](_0xac21f8(0x1cd)+_0x32ae59);}function resolveProvidedDbId(_0x5507b8){const _0x7c11b4=a246_0x46d7a9,_0x9ed9be=_0x5507b8['flag'](_0x7c11b4(0x1b5));if(typeof _0x9ed9be===_0x7c11b4(0x1d8)&&Number[_0x7c11b4(0x1ab)](_0x9ed9be))return _0x9ed9be;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a247_0x4dda(){const _0xdeb26c=['10CsJdyj','sql','validation','1RDkoCD','length','12oCJaXO','trashDir','startsWith','SQL\x20lock\x20file\x20not\x20found.','sqlcode','fromEntries','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','\x20(local\x20file\x20moved\x20to\x20trash)','1031921SzXxPg','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','projectRoot','34416tFDvNd','1571470ngKBRC','toISOString','filter','2084366WtyYPN','lockFilePath','sqlRootDir','Would\x20delete\x20SQL\x20','trashedTo','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','delete','remoteId','27emSpbW','12XtOHGB','replace','appCode','str','1180768lGnogk','sqls','POST','4046091wrssgx','4404630UczxXR','high-risk-write','/smartapi/custom/deleteUserCustomSql','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'];a247_0x4dda=function(){return _0xdeb26c;};return a247_0x4dda();}const a247_0x5f0a08=a247_0x8f6d;(function(_0x6c1612,_0x839882){const _0x5c24f9=a247_0x8f6d,_0x4f4b0a=_0x6c1612();while(!![]){try{const _0x6407a0=-parseInt(_0x5c24f9(0xf7))/0x1*(-parseInt(_0x5c24f9(0x108))/0x2)+parseInt(_0x5c24f9(0x111))/0x3*(-parseInt(_0x5c24f9(0x104))/0x4)+-parseInt(_0x5c24f9(0xf4))/0x5*(parseInt(_0x5c24f9(0xf0))/0x6)+parseInt(_0x5c24f9(0xef))/0x7+parseInt(_0x5c24f9(0xec))/0x8+parseInt(_0x5c24f9(0x110))/0x9*(parseInt(_0x5c24f9(0x105))/0xa)+parseInt(_0x5c24f9(0x101))/0xb*(parseInt(_0x5c24f9(0xf9))/0xc);if(_0x6407a0===_0x839882)break;else _0x4f4b0a['push'](_0x4f4b0a['shift']());}catch(_0x54f758){_0x4f4b0a['push'](_0x4f4b0a['shift']());}}}(a247_0x4dda,0xcabd2));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';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';function a247_0x8f6d(_0x4999ed,_0x54ef3a){_0x4999ed=_0x4999ed-0xea;const _0x4dda8c=a247_0x4dda();let _0x8f6d66=_0x4dda8c[_0x4999ed];return _0x8f6d66;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a247_0x5f0a08(0xf5),'command':a247_0x5f0a08(0x10e),'description':a247_0x5f0a08(0x10d),'risk':a247_0x5f0a08(0xf1),'flags':[SQLCODE_FLAG],async 'validate'(_0x3b1c84){const _0x4ad636=a247_0x5f0a08,_0x380301=loadSqlProjectConfig(_0x3b1c84[_0x4ad636(0xea)]),_0x5c8fad=await readSqlLockFile(_0x380301[_0x4ad636(0x109)]);if(!_0x5c8fad)throw CliErrors[_0x4ad636(0xf6)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x1c0db1){const _0x10b7c1=a247_0x5f0a08,_0x14b0e5=loadSqlProjectConfig(_0x1c0db1[_0x10b7c1(0xea)]),_0x27fba6=await readSqlLockFile(_0x14b0e5[_0x10b7c1(0x109)]);if(!_0x27fba6)throw CliErrors[_0x10b7c1(0xf6)](_0x10b7c1(0xff));const {appLock:_0x5a95ed}=ensureSqlLockScope(_0x27fba6,_0x1c0db1[_0x10b7c1(0xea)],_0x14b0e5['sqlRoot'],_0x10b7c1(0x10e)),_0x1e455a=_0x1c0db1[_0x10b7c1(0xeb)]('sqlcode'),_0xa1ac01=_0x5a95ed[_0x10b7c1(0xed)][_0x1e455a];if(!_0xa1ac01)throw CliErrors[_0x10b7c1(0xf6)](_0x10b7c1(0xf3)+_0x1e455a+'\x22.');return{'method':_0x10b7c1(0xee),'url':_0x10b7c1(0xf2),'body':{'sqlCode':_0x1e455a,'id':_0xa1ac01[_0x10b7c1(0x10f)],'localPath':resolveLocalSqlFilePath(_0x14b0e5,_0x1e455a,_0xa1ac01)},'description':_0x10b7c1(0x10b)+_0x1e455a+_0x10b7c1(0x102)+_0x14b0e5[_0x10b7c1(0xfa)]};},async 'execute'(_0x4570b3){const _0x26803a=a247_0x5f0a08,_0x31eac2=loadSqlProjectConfig(_0x4570b3[_0x26803a(0xea)]),_0x2c07f3=await readSqlLockFile(_0x31eac2[_0x26803a(0x109)]);if(!_0x2c07f3)throw CliErrors[_0x26803a(0xf6)](_0x26803a(0xfc));const {lockData:_0x4a354e,appLock:_0x3eec6c}=ensureSqlLockScope(_0x2c07f3,_0x4570b3['appCode'],_0x31eac2['sqlRoot'],'delete'),_0x37e137=_0x4570b3[_0x26803a(0xeb)](_0x26803a(0xfd)),_0x59d369=_0x3eec6c[_0x26803a(0xed)][_0x37e137];if(!_0x59d369)throw CliErrors[_0x26803a(0xf6)](_0x26803a(0xf3)+_0x37e137+'\x22.');await deleteSqlQuery({'id':_0x59d369['remoteId'],'sqlCode':_0x37e137}),_0x3eec6c[_0x26803a(0xed)]=Object[_0x26803a(0xfe)](Object['entries'](_0x3eec6c[_0x26803a(0xed)])[_0x26803a(0x107)](([_0x1d688b])=>_0x1d688b!==_0x37e137)),_0x3eec6c['lastSync']=new Date()[_0x26803a(0x106)](),await writeSqlLockFile(_0x31eac2[_0x26803a(0x109)],_0x4a354e);const _0xa4f4a4=resolveLocalSqlFilePath(_0x31eac2,_0x37e137,_0x59d369);let _0x5205f1;await fileExists(_0xa4f4a4)&&(_0x5205f1=await moveToTrash(_0x31eac2[_0x26803a(0x103)],_0x31eac2['trashDir'],_0xa4f4a4),await cleanupEmptyDirectories(dirname(_0xa4f4a4),_0x31eac2[_0x26803a(0x10a)]));const _0x337372={'deleted':_0x37e137,'remoteId':_0x59d369['remoteId']};if(_0x5205f1)_0x337372[_0x26803a(0x10c)]=_0x5205f1;return{'ok':!![],'data':_0x337372,'message':'Deleted\x20'+_0x37e137+(_0x5205f1?_0x26803a(0x100):'')};}};async function moveToTrash(_0x328905,_0x1d0744,_0x3d8832){const _0x145938=a247_0x5f0a08,_0x3020f0=new Date()[_0x145938(0x106)]()[_0x145938(0x112)](/[:.]/g,'-'),_0xb10eeb=relative(_0x328905,_0x3d8832),_0x29bbd4=join(_0x1d0744,_0x3020f0,_0xb10eeb);return await mkdir(dirname(_0x29bbd4),{'recursive':!![]}),await rename(_0x3d8832,_0x29bbd4),_0x29bbd4;}async function cleanupEmptyDirectories(_0x172e08,_0x3a6b00){const _0x2b0e90=a247_0x5f0a08;let _0x53c27b=resolve(_0x172e08);const _0x404ed9=resolve(_0x3a6b00);while(_0x53c27b[_0x2b0e90(0xfb)](''+_0x404ed9+sep)||_0x53c27b===_0x404ed9){if(_0x53c27b===_0x404ed9)return;try{const _0x4b167a=await readdir(_0x53c27b);if(_0x4b167a[_0x2b0e90(0xf8)]>0x0)return;await rmdir(_0x53c27b);}catch{return;}_0x53c27b=dirname(_0x53c27b);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x136f1e=a248_0x12a9;function a248_0x99c4(){const _0x230094=['sqlContent','bool','description','boolean','2236332XFYXmE','8dwbZMd','95250kIBwKx','3083310InIntF','str','Return\x20full\x20raw\x20SQL\x20query\x20object','verbose','sql','245GrSgrY','1boNtYV','sqlcode','29022aJLSTr','sqlCode','1314297mjxcly','read','detail','576452TxsxAT','dbId','sqlName','541618zMRVGj'];a248_0x99c4=function(){return _0x230094;};return a248_0x99c4();}(function(_0x63e555,_0x1e4042){const _0x2758dc=a248_0x12a9,_0x631af4=_0x63e555();while(!![]){try{const _0x377b11=parseInt(_0x2758dc(0xaa))/0x1*(parseInt(_0x2758dc(0xb4))/0x2)+-parseInt(_0x2758dc(0xbb))/0x3+-parseInt(_0x2758dc(0xb1))/0x4+parseInt(_0x2758dc(0xa9))/0x5*(parseInt(_0x2758dc(0xac))/0x6)+parseInt(_0x2758dc(0xb9))/0x7*(-parseInt(_0x2758dc(0xba))/0x8)+-parseInt(_0x2758dc(0xae))/0x9+parseInt(_0x2758dc(0xbc))/0xa;if(_0x377b11===_0x1e4042)break;else _0x631af4['push'](_0x631af4['shift']());}catch(_0x4c271d){_0x631af4['push'](_0x631af4['shift']());}}}(a248_0x99c4,0x2aabd));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a248_0x12a9(_0x36b0cb,_0x3e970d){_0x36b0cb=_0x36b0cb-0xa6;const _0x99c498=a248_0x99c4();let _0x12a9e0=_0x99c498[_0x36b0cb];return _0x12a9e0;}export const sqlDetail={'service':a248_0x136f1e(0xa8),'command':a248_0x136f1e(0xb0),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a248_0x136f1e(0xaf),'flags':[SQLCODE_FLAG,{'name':a248_0x136f1e(0xa7),'type':a248_0x136f1e(0xb8),'description':a248_0x136f1e(0xa6)}],async 'execute'(_0x5bf590){const _0x4381f0=a248_0x136f1e,_0x4d00fa=await getSqlQueryInfo(_0x5bf590['appCode'],_0x5bf590[_0x4381f0(0xbd)](_0x4381f0(0xab))),_0xcb301d=_0x5bf590[_0x4381f0(0xb6)]('verbose');if(_0xcb301d)return{'ok':!![],'data':_0x4d00fa};const _0x212d8e=_0x4d00fa['dbId']?await getDbName(_0x5bf590['appCode'],_0x4d00fa[_0x4381f0(0xb2)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4d00fa[_0x4381f0(0xad)],'sqlName':_0x4d00fa[_0x4381f0(0xb3)],'db':_0x212d8e?_0x212d8e+'\x20('+_0x4d00fa[_0x4381f0(0xb2)]+')':_0x4d00fa[_0x4381f0(0xb2)]??'','description':_0x4d00fa[_0x4381f0(0xb7)]??'','sqlContent':_0x4d00fa[_0x4381f0(0xb5)]??''}};}};
|