@lovrabet/rabetbase-cli 2.5.6-beta.1 → 2.5.7-beta.1
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.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.d.ts +2 -0
- package/lib/commands/flow/page-list.js +1 -0
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.d.ts +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.d.ts +6 -2
- 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 +37 -6
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.d.ts +12 -0
- 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 +11 -7
- package/skills/rabetbase/guides/approval-flow-development-workflow.md +52 -13
- package/skills/rabetbase/guides/backend-function.md +26 -4
- package/skills/rabetbase/guides/bff-creation-workflow.md +9 -0
- package/skills/rabetbase/guides/cross-database-bff.md +1 -0
- package/skills/rabetbase/guides/custom-page-flow-sdk.md +2 -0
- package/skills/rabetbase/guides/data-api-guidelines.md +2 -0
- package/skills/rabetbase/guides/flow-config-examples.md +75 -0
- package/skills/rabetbase/guides/form-flow-start.md +61 -0
- package/skills/rabetbase/guides/typescript-sdk.md +1 -1
- package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +18 -4
- package/skills/rabetbase/references/rabetbase-codegen-sdk.md +5 -4
- 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-flow-commands.md +21 -2
- package/skills/rabetbase/references/rabetbase-flow-resources.md +21 -3
- package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +6 -2
- package/skills/rabetbase/references/rabetbase-kb.md +4 -1
- 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 +6 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a228_0x1bdfd4=a228_0x515f;(function(_0x4f9da1,_0x2b45a1){const _0x41c26b=a228_0x515f,_0x39052b=_0x4f9da1();while(!![]){try{const _0x105262=parseInt(_0x41c26b(0x207))/0x1*(-parseInt(_0x41c26b(0x1cb))/0x2)+-parseInt(_0x41c26b(0x1dc))/0x3*(parseInt(_0x41c26b(0x1e8))/0x4)+-parseInt(_0x41c26b(0x201))/0x5+parseInt(_0x41c26b(0x203))/0x6*(-parseInt(_0x41c26b(0x1b9))/0x7)+-parseInt(_0x41c26b(0x1e2))/0x8+parseInt(_0x41c26b(0x200))/0x9+-parseInt(_0x41c26b(0x1f4))/0xa*(-parseInt(_0x41c26b(0x1d1))/0xb);if(_0x105262===_0x2b45a1)break;else _0x39052b['push'](_0x39052b['shift']());}catch(_0x11417e){_0x39052b['push'](_0x39052b['shift']());}}}(a228_0x34ba,0xaae73));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':'number','required':!![],'description':a228_0x1bdfd4(0x1bc)};export const ROLE_REF_FLAG={'name':'role','type':a228_0x1bdfd4(0x1f9),'required':!![],'description':a228_0x1bdfd4(0x1d6)};export const USER_REF_FLAG={'name':a228_0x1bdfd4(0x1f7),'type':a228_0x1bdfd4(0x1f9),'required':!![],'description':a228_0x1bdfd4(0x1e0)};export const NAME_FLAG={'name':'name','type':a228_0x1bdfd4(0x1f9),'required':!![],'description':a228_0x1bdfd4(0x1ce)};export const USER_NAME_FLAG={'name':a228_0x1bdfd4(0x1c9),'type':a228_0x1bdfd4(0x1f9),'required':!![],'description':a228_0x1bdfd4(0x1e9)};function a228_0x515f(_0x2a2ca3,_0x244ef1){_0x2a2ca3=_0x2a2ca3-0x1b5;const _0x34ba05=a228_0x34ba();let _0x515fad=_0x34ba05[_0x2a2ca3];return _0x515fad;}export const REMARK_FLAG={'name':a228_0x1bdfd4(0x1e5),'type':a228_0x1bdfd4(0x1f9),'required':![],'description':a228_0x1bdfd4(0x20b)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a228_0x1bdfd4(0x1e7),'required':![],'description':a228_0x1bdfd4(0x1b7)};export const BUILTIN_ROLE_TYPES=[a228_0x1bdfd4(0x1ed),a228_0x1bdfd4(0x202),'OWNER'];export function isBuiltinRole(_0x518a9b){const _0x400f86=a228_0x1bdfd4;return BUILTIN_ROLE_TYPES[_0x400f86(0x209)](_0x518a9b);}export function assertCustomRole(_0x3e5080,_0xc31e58){const _0x53b4a9=a228_0x1bdfd4;if(_0x3e5080[_0x53b4a9(0x1d5)]!==_0x53b4a9(0x1b8))throw CliErrors[_0x53b4a9(0x1fd)]('Cannot\x20'+_0xc31e58+_0x53b4a9(0x1ee)+_0x3e5080[_0x53b4a9(0x1d9)]+'\x20('+_0x3e5080[_0x53b4a9(0x1d5)]+').',_0x53b4a9(0x1d2));}export function projectRole(_0x226cf5){const _0x3e6cec=a228_0x1bdfd4;return{'id':_0x226cf5['id'],'roleName':_0x226cf5[_0x3e6cec(0x1d9)],'roleType':_0x226cf5['roleType'],'remark':_0x226cf5[_0x3e6cec(0x1e5)],'userCount':_0x226cf5['userCount'],'permitCount':_0x226cf5[_0x3e6cec(0x1bd)],'builtin':isBuiltinRole(_0x226cf5['roleType'])};}function a228_0x34ba(){const _0x4df2e3=['/smartapi/permit/user-role/create','Pass\x20--user\x20<id>.','remark','\x20is\x20already\x20a\x20member\x20of\x20role\x20','number','319508frGMdt','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','user-add','nickname','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','ADMIN','\x20built-in\x20role\x20','appCode','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Multiple\x20tenant\x20members\x20match\x20\x22','Pass\x20--role\x20<id|name>.','toLowerCase','33082810IgGSMg','join','totalCount','user','Role\x20id\x20','string','push','expect-user-count','Missing\x20role\x20reference.','validation','\x22\x20not\x20found\x20in\x20app\x20','expectUserCount','2740212ZlJumm','4743865MFRYZB','DEV','6wsPuTo','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','str','User\x20','359091jyPnRh','role','includes','flagMissing','Optional\x20role\x20remark/description','\x22:\x20','Check\x20the\x20nickname/username.\x20','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','CUSTOM','3401979cTruBU','Disambiguate\x20with\x20--role\x20<id>.','length','Role\x20id\x20(from\x20`role\x20list`)','permitCount','Anti-drift\x20check\x20failed:\x20expected\x20','\x22\x20is\x20ambiguous\x20(ids:\x20','authRequired','\x20duplicate\x20memberships\x20for\x20user\x20','Pass\x20--user\x20<id|name>.','dev','Removed\x20','map','filter','userId','\x20member(s)\x20but\x20role\x20has\x20','name','trim','2ZYQzBP',';\x20no\x20change.','tenant','Role\x20name','Cannot\x20','OWNER','11bFvSwl','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','\x20not\x20found\x20in\x20app\x20','Missing\x20user\x20reference.','roleType','Role\x20id\x20or\x20exact\x20role\x20name','Role\x20name\x20\x22','find','roleName','No\x20tenant\x20member\x20matches\x20\x22','flag','6MsHTTF','tenant_code','username','/smartapi/permit/user-role/delete','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','test','7672920LMbqDX'];a228_0x34ba=function(){return _0x4df2e3;};return a228_0x34ba();}export async function resolveRoleRef(_0x2ae5de,_0x1acb73){const _0x101a5c=a228_0x1bdfd4,_0xc4108f=_0x1acb73['trim']();if(!_0xc4108f)throw CliErrors[_0x101a5c(0x1fd)](_0x101a5c(0x1fc),'Pass\x20--role\x20<id|name>.');if(/^\d+$/[_0x101a5c(0x1e1)](_0xc4108f))return getRoleById(_0x2ae5de,Number(_0xc4108f));const _0x441fda=await listAllAppRoles(_0x2ae5de),_0x1339d7=_0x441fda['filter'](_0x58faac=>_0x58faac[_0x101a5c(0x1d9)]===_0xc4108f);if(_0x1339d7[_0x101a5c(0x1bb)]===0x0)throw CliErrors[_0x101a5c(0x1fd)](_0x101a5c(0x1d7)+_0xc4108f+_0x101a5c(0x1fe)+_0x2ae5de+'.',_0x101a5c(0x204));if(_0x1339d7[_0x101a5c(0x1bb)]>0x1){const _0x5d1aa8=_0x1339d7['map'](_0x27b583=>_0x27b583['id'])['join'](',\x20');throw CliErrors[_0x101a5c(0x1fd)](_0x101a5c(0x1d7)+_0xc4108f+_0x101a5c(0x1bf)+_0x5d1aa8+').',_0x101a5c(0x1ba));}return _0x1339d7[0x0];}export async function getRoleById(_0x18392b,_0x105741){const _0x4b9519=a228_0x1bdfd4,_0x526bb3=await listAllAppRoles(_0x18392b),_0x107bcc=_0x526bb3[_0x4b9519(0x1c6)](_0x2280bd=>_0x2280bd['id']===_0x105741&&(!_0x2280bd['appCode']||_0x2280bd[_0x4b9519(0x1ef)]===_0x18392b));if(_0x107bcc[_0x4b9519(0x1bb)]!==0x1)throw CliErrors[_0x4b9519(0x1fd)](_0x4b9519(0x1f8)+_0x105741+_0x4b9519(0x1d3)+_0x18392b+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x107bcc[0x0];}async function listAllAppRoles(_0xc3661c){const _0x1e8548=a228_0x1bdfd4,_0x21dbb5=0x64,_0xc32809=[];for(let _0x22ffaa=0x1;;_0x22ffaa+=0x1){const {items:_0x5c59f6,paging:_0x59e237}=await listAppRoles(_0xc3661c,{'currentPage':_0x22ffaa,'pageSize':_0x21dbb5});_0xc32809[_0x1e8548(0x1fa)](..._0x5c59f6);if(_0x5c59f6[_0x1e8548(0x1bb)]<_0x21dbb5||_0x59e237&&_0xc32809[_0x1e8548(0x1bb)]>=_0x59e237[_0x1e8548(0x1f6)])return _0xc32809;}}export async function resolveTenantCode(){const _0x4b75c4=a228_0x1bdfd4,_0x2c5e53=await getSessionUserInfo(),_0x2d2e70=_0x2c5e53?.[_0x4b75c4(0x1f7)]?.[_0x4b75c4(0x1cd)]?.[_0x4b75c4(0x1dd)];if(!_0x2d2e70)throw CliErrors[_0x4b75c4(0x1c0)](_0x4b75c4(0x1ec));return _0x2d2e70;}function matchMember(_0xedb0a0,_0x4a1c23){const _0x478d29=a228_0x1bdfd4,_0x559532=_0x4a1c23[_0x478d29(0x1ca)]()[_0x478d29(0x1f3)]();return(_0xedb0a0[_0x478d29(0x1eb)]??'')[_0x478d29(0x1f3)]()===_0x559532||(_0xedb0a0[_0x478d29(0x1de)]??'')[_0x478d29(0x1f3)]()===_0x559532;}export async function resolveUserRef(_0x37267a,_0x8de7f5=a228_0x1bdfd4(0x1e4)){const _0x53b359=a228_0x1bdfd4,_0x544657=_0x37267a['trim']();if(!_0x544657)throw CliErrors[_0x53b359(0x1fd)](_0x53b359(0x1d4),_0x53b359(0x1c2));const _0x36b11e=await resolveTenantCode(),_0x4069aa=await getTenantMembers(_0x36b11e);if(/^\d+$/[_0x53b359(0x1e1)](_0x544657)){const _0x5141dd=Number(_0x544657),_0x576c2c=_0x4069aa[_0x53b359(0x1d8)](_0x39b7c0=>_0x39b7c0[_0x53b359(0x1c7)]===_0x5141dd);return{'userId':_0x5141dd,'username':_0x576c2c?.[_0x53b359(0x1de)]??String(_0x5141dd),'nickname':_0x576c2c?.[_0x53b359(0x1eb)],'matchedBy':'id'};}const _0x5d8e5f=_0x4069aa[_0x53b359(0x1c6)](_0x3d44f7=>matchMember(_0x3d44f7,_0x544657));if(_0x5d8e5f[_0x53b359(0x1bb)]===0x0)throw CliErrors['validation'](_0x53b359(0x1da)+_0x544657+'\x22.',_0x53b359(0x1b6)+_0x8de7f5);if(_0x5d8e5f[_0x53b359(0x1bb)]>0x1){const _0x2378a5=_0x5d8e5f[_0x53b359(0x1c5)](_0x4bf9c3=>(_0x4bf9c3[_0x53b359(0x1eb)]??_0x4bf9c3['username']??'?')+'('+_0x4bf9c3[_0x53b359(0x1c7)]+')')[_0x53b359(0x1f5)](',\x20');throw CliErrors[_0x53b359(0x1fd)](_0x53b359(0x1f1)+_0x544657+_0x53b359(0x1b5)+_0x2378a5+'.',_0x8de7f5);}const _0xa20834=_0x5d8e5f[0x0];return{'userId':_0xa20834[_0x53b359(0x1c7)],'username':_0xa20834['username']??String(_0xa20834[_0x53b359(0x1c7)]),'nickname':_0xa20834[_0x53b359(0x1eb)],'matchedBy':_0x53b359(0x1c9)};}export const CREATE_USER_ROLE_PATH=a228_0x1bdfd4(0x1e3);export const DELETE_USER_ROLE_PATH=a228_0x1bdfd4(0x1df);export function computeRoleUserMutation(_0x15d18c){const _0x273757=a228_0x1bdfd4,{operation:_0x15cf47,appCode:_0x3c4bbd,role:_0xab9282,relations:_0x14b7c9,user:_0x9f32bf}=_0x15d18c,_0x2c1ff1=[...new Set(_0x14b7c9['map'](_0x420b7a=>_0x420b7a[_0x273757(0x1c7)]))],_0x49d1bc=[];if(_0x15d18c[_0x273757(0x1ff)]!==undefined&&_0x15d18c[_0x273757(0x1ff)]!==_0x2c1ff1[_0x273757(0x1bb)])throw CliErrors[_0x273757(0x1fd)](_0x273757(0x1be)+_0x15d18c[_0x273757(0x1ff)]+_0x273757(0x1c8)+_0x2c1ff1[_0x273757(0x1bb)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0xe3ad78=_0x2c1ff1[_0x273757(0x209)](_0x9f32bf[_0x273757(0x1c7)]),_0x4949e0=_0x14b7c9[_0x273757(0x1c6)](_0x3495dd=>_0x3495dd[_0x273757(0x1c7)]===_0x9f32bf[_0x273757(0x1c7)])[_0x273757(0x1c5)](_0x4b181e=>_0x4b181e['id']),_0x3b8446=_0x15cf47===_0x273757(0x1ea)?!_0xe3ad78:_0xe3ad78;let _0x2c695d=_0x2c1ff1;_0x15cf47===_0x273757(0x1ea)?_0xe3ad78?_0x49d1bc[_0x273757(0x1fa)](_0x273757(0x206)+_0x9f32bf[_0x273757(0x1c7)]+_0x273757(0x1e6)+_0xab9282[_0x273757(0x1d9)]+_0x273757(0x1cc)):_0x2c695d=[..._0x2c1ff1,_0x9f32bf[_0x273757(0x1c7)]]:!_0xe3ad78?_0x49d1bc['push']('User\x20'+_0x9f32bf[_0x273757(0x1c7)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0xab9282[_0x273757(0x1d9)]+';\x20no\x20change.'):(_0x2c695d=_0x2c1ff1[_0x273757(0x1c6)](_0x2433bc=>_0x2433bc!==_0x9f32bf['userId']),_0x4949e0[_0x273757(0x1bb)]>0x1&&_0x49d1bc['push'](_0x273757(0x1c4)+_0x4949e0[_0x273757(0x1bb)]+_0x273757(0x1c1)+_0x9f32bf[_0x273757(0x1c7)]+'.'));const _0x2b8ad2={'scope':_0x273757(0x1c3),'operation':_0x15cf47,'selector':{'appCode':_0x3c4bbd,'roleId':_0xab9282['id'],'roleName':_0xab9282[_0x273757(0x1d9)],'userId':_0x9f32bf[_0x273757(0x1c7)]},'before':{'userIds':_0x2c1ff1},'after':{'userIds':_0x2c695d},'dryRun':_0x15d18c['dryRun'],'backend':{'method':'POST','path':_0x15cf47===_0x273757(0x1ea)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x49d1bc};return{'mutation':_0x2b8ad2,'changed':_0x3b8446,'matchingRelationIds':_0x4949e0};}export async function loadDevRoleRelations(_0x563130,_0x3dae57){const _0x4c071f=a228_0x1bdfd4,_0x56e21f=0x64,_0x2512c6=[];for(let _0x2b99b1=0x1;;_0x2b99b1+=0x1){const {items:_0x5f7ce0,paging:_0x3484a6}=await listDevUserRoleRelations(_0x563130,{'roleId':_0x3dae57,'currentPage':_0x2b99b1,'pageSize':_0x56e21f});_0x2512c6[_0x4c071f(0x1fa)](..._0x5f7ce0);if(_0x5f7ce0['length']<_0x56e21f||_0x3484a6&&_0x2512c6[_0x4c071f(0x1bb)]>=_0x3484a6[_0x4c071f(0x1f6)])return _0x2512c6;}}export function readRoleRef(_0x280475){const _0x49c2d8=a228_0x1bdfd4,_0x7a6d63=_0x280475[_0x49c2d8(0x205)](_0x49c2d8(0x208))['trim']();if(!_0x7a6d63)throw CliErrors[_0x49c2d8(0x20a)](_0x49c2d8(0x208),_0x49c2d8(0x1f2));return _0x7a6d63;}export async function prepareUserMutation(_0x27ad49,_0x3550a8,_0x3c6a45){const _0x4144db=a228_0x1bdfd4,_0x5f1451=readRoleRef(_0x27ad49),_0x1ab225=_0x27ad49[_0x4144db(0x205)](_0x4144db(0x1f7))[_0x4144db(0x1ca)]();if(!_0x1ab225)throw CliErrors[_0x4144db(0x20a)](_0x4144db(0x1f7),_0x4144db(0x1c2));const _0x425e54=_0x27ad49[_0x4144db(0x1db)](_0x4144db(0x1fb)),_0x23f2cf=_0x425e54===undefined||_0x425e54===null?undefined:Number(_0x425e54),_0x4b7a79=await resolveRoleRef(_0x27ad49['appCode'],_0x5f1451);if(_0x4b7a79[_0x4144db(0x1d5)]===_0x4144db(0x1d0))throw CliErrors['validation'](_0x4144db(0x1cf)+_0x3550a8+'\x20members\x20of\x20the\x20OWNER\x20role.',_0x4144db(0x1f0));const _0x2b31d4=await resolveUserRef(_0x1ab225),_0x18ab09=await loadDevRoleRelations(_0x27ad49[_0x4144db(0x1ef)],_0x4b7a79['id']);return{...computeRoleUserMutation({'operation':_0x3550a8,'appCode':_0x27ad49[_0x4144db(0x1ef)],'role':_0x4b7a79,'relations':_0x18ab09,'user':{'userId':_0x2b31d4[_0x4144db(0x1c7)],'username':_0x2b31d4['username'],'nickname':_0x2b31d4['nickname']},'dryRun':_0x3c6a45,..._0x23f2cf!==undefined?{'expectUserCount':_0x23f2cf}:{}}),'role':_0x4b7a79,'user':_0x2b31d4};}
|
|
1
|
+
const a235_0x5c3421=a235_0x3e24;(function(_0xd20ecd,_0x14260f){const _0x5d84c1=a235_0x3e24,_0x3b1e2b=_0xd20ecd();while(!![]){try{const _0x28c11a=-parseInt(_0x5d84c1(0x110))/0x1+parseInt(_0x5d84c1(0x133))/0x2*(parseInt(_0x5d84c1(0x102))/0x3)+parseInt(_0x5d84c1(0xec))/0x4+-parseInt(_0x5d84c1(0xf0))/0x5+parseInt(_0x5d84c1(0x10d))/0x6*(-parseInt(_0x5d84c1(0x139))/0x7)+parseInt(_0x5d84c1(0x10c))/0x8+parseInt(_0x5d84c1(0x11f))/0x9*(parseInt(_0x5d84c1(0x124))/0xa);if(_0x28c11a===_0x14260f)break;else _0x3b1e2b['push'](_0x3b1e2b['shift']());}catch(_0x2fcd95){_0x3b1e2b['push'](_0x3b1e2b['shift']());}}}(a235_0x48f7,0x8620e));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':a235_0x5c3421(0x112),'required':!![],'description':a235_0x5c3421(0x106)};export const ROLE_REF_FLAG={'name':a235_0x5c3421(0x104),'type':a235_0x5c3421(0xf8),'required':!![],'description':a235_0x5c3421(0x12f)};export const USER_REF_FLAG={'name':a235_0x5c3421(0x113),'type':a235_0x5c3421(0xf8),'required':!![],'description':a235_0x5c3421(0xf1)};export const NAME_FLAG={'name':a235_0x5c3421(0x122),'type':a235_0x5c3421(0xf8),'required':!![],'description':a235_0x5c3421(0x115)};export const USER_NAME_FLAG={'name':a235_0x5c3421(0x122),'type':a235_0x5c3421(0xf8),'required':!![],'description':a235_0x5c3421(0x132)};export const REMARK_FLAG={'name':a235_0x5c3421(0x135),'type':a235_0x5c3421(0xf8),'required':![],'description':a235_0x5c3421(0x11c)};export const EXPECT_USER_COUNT_FLAG={'name':a235_0x5c3421(0x12e),'type':a235_0x5c3421(0x112),'required':![],'description':a235_0x5c3421(0x10f)};export const BUILTIN_ROLE_TYPES=[a235_0x5c3421(0xee),a235_0x5c3421(0xfa),'OWNER'];export function isBuiltinRole(_0x1460f2){const _0xc8377=a235_0x5c3421;return BUILTIN_ROLE_TYPES[_0xc8377(0x116)](_0x1460f2);}export function assertCustomRole(_0x295968,_0x53a2ed){const _0x205206=a235_0x5c3421;if(_0x295968[_0x205206(0x117)]!==_0x205206(0xff))throw CliErrors[_0x205206(0x107)]('Cannot\x20'+_0x53a2ed+_0x205206(0xf2)+_0x295968[_0x205206(0x111)]+'\x20('+_0x295968[_0x205206(0x117)]+').',_0x205206(0x136));}export function projectRole(_0x717dbd){const _0x296096=a235_0x5c3421;return{'id':_0x717dbd['id'],'roleName':_0x717dbd[_0x296096(0x111)],'roleType':_0x717dbd[_0x296096(0x117)],'remark':_0x717dbd[_0x296096(0x135)],'userCount':_0x717dbd[_0x296096(0x11e)],'permitCount':_0x717dbd[_0x296096(0xea)],'builtin':isBuiltinRole(_0x717dbd[_0x296096(0x117)])};}export async function resolveRoleRef(_0x782472,_0x50afe5){const _0xf536f5=a235_0x5c3421,_0x12d5bc=_0x50afe5[_0xf536f5(0x134)]();if(!_0x12d5bc)throw CliErrors[_0xf536f5(0x107)](_0xf536f5(0x127),_0xf536f5(0x123));if(/^\d+$/[_0xf536f5(0x138)](_0x12d5bc))return getRoleById(_0x782472,Number(_0x12d5bc));const _0x48a1cd=await listAllAppRoles(_0x782472),_0x25fba8=_0x48a1cd[_0xf536f5(0x120)](_0x5e5810=>_0x5e5810[_0xf536f5(0x111)]===_0x12d5bc);if(_0x25fba8[_0xf536f5(0xf4)]===0x0)throw CliErrors['validation'](_0xf536f5(0xfb)+_0x12d5bc+_0xf536f5(0x137)+_0x782472+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x25fba8[_0xf536f5(0xf4)]>0x1){const _0x2c93ea=_0x25fba8[_0xf536f5(0xe9)](_0x1dd860=>_0x1dd860['id'])[_0xf536f5(0xf9)](',\x20');throw CliErrors[_0xf536f5(0x107)](_0xf536f5(0xfb)+_0x12d5bc+_0xf536f5(0x105)+_0x2c93ea+').',_0xf536f5(0xef));}return _0x25fba8[0x0];}export async function getRoleById(_0x18646b,_0x5bc8b2){const _0x2f586=a235_0x5c3421,_0x5f1423=await listAllAppRoles(_0x18646b),_0x345576=_0x5f1423[_0x2f586(0x120)](_0x89eeaf=>_0x89eeaf['id']===_0x5bc8b2&&(!_0x89eeaf[_0x2f586(0xf6)]||_0x89eeaf['appCode']===_0x18646b));if(_0x345576[_0x2f586(0xf4)]!==0x1)throw CliErrors[_0x2f586(0x107)](_0x2f586(0x11b)+_0x5bc8b2+'\x20not\x20found\x20in\x20app\x20'+_0x18646b+'.',_0x2f586(0x12a));return _0x345576[0x0];}async function listAllAppRoles(_0x23dd8c){const _0x7d40d2=a235_0x5c3421,_0x5ae477=0x64,_0x2fcc0e=[];for(let _0x566456=0x1;;_0x566456+=0x1){const {items:_0x46e402,paging:_0x3a7039}=await listAppRoles(_0x23dd8c,{'currentPage':_0x566456,'pageSize':_0x5ae477});_0x2fcc0e[_0x7d40d2(0x119)](..._0x46e402);if(_0x46e402[_0x7d40d2(0xf4)]<_0x5ae477||_0x3a7039&&_0x2fcc0e[_0x7d40d2(0xf4)]>=_0x3a7039[_0x7d40d2(0x129)])return _0x2fcc0e;}}export async function resolveTenantCode(){const _0x113d74=a235_0x5c3421,_0x5c5803=await getSessionUserInfo(),_0x43a129=_0x5c5803?.['user']?.[_0x113d74(0x11a)]?.['tenant_code'];if(!_0x43a129)throw CliErrors['authRequired'](_0x113d74(0x114));return _0x43a129;}function matchMember(_0x4fb9e6,_0x3ee9e4){const _0x2d0ed7=a235_0x5c3421,_0x361107=_0x3ee9e4[_0x2d0ed7(0x134)]()[_0x2d0ed7(0x128)]();return(_0x4fb9e6['nickname']??'')[_0x2d0ed7(0x128)]()===_0x361107||(_0x4fb9e6[_0x2d0ed7(0x101)]??'')['toLowerCase']()===_0x361107;}function a235_0x3e24(_0x10ea9c,_0xc4048c){_0x10ea9c=_0x10ea9c-0xe9;const _0x48f76e=a235_0x48f7();let _0x3e2461=_0x48f76e[_0x10ea9c];return _0x3e2461;}export async function resolveUserRef(_0xf2134b,_0x64eb04=a235_0x5c3421(0xf3)){const _0x23d2bd=a235_0x5c3421,_0x19c2c3=_0xf2134b['trim']();if(!_0x19c2c3)throw CliErrors[_0x23d2bd(0x107)]('Missing\x20user\x20reference.',_0x23d2bd(0xfc));const _0x95730d=await resolveTenantCode(),_0xb8a9b3=await getTenantMembers(_0x95730d);if(/^\d+$/[_0x23d2bd(0x138)](_0x19c2c3)){const _0x382f18=Number(_0x19c2c3),_0x1ea5e8=_0xb8a9b3[_0x23d2bd(0x130)](_0x4d7ed7=>_0x4d7ed7[_0x23d2bd(0xf7)]===_0x382f18);return{'userId':_0x382f18,'username':_0x1ea5e8?.[_0x23d2bd(0x101)]??String(_0x382f18),'nickname':_0x1ea5e8?.['nickname'],'matchedBy':'id'};}const _0x36924c=_0xb8a9b3[_0x23d2bd(0x120)](_0x12603b=>matchMember(_0x12603b,_0x19c2c3));if(_0x36924c[_0x23d2bd(0xf4)]===0x0)throw CliErrors[_0x23d2bd(0x107)](_0x23d2bd(0xfe)+_0x19c2c3+'\x22.',_0x23d2bd(0x12d)+_0x64eb04);if(_0x36924c[_0x23d2bd(0xf4)]>0x1){const _0x200bfe=_0x36924c['map'](_0x57d44=>(_0x57d44[_0x23d2bd(0x126)]??_0x57d44[_0x23d2bd(0x101)]??'?')+'('+_0x57d44[_0x23d2bd(0xf7)]+')')[_0x23d2bd(0xf9)](',\x20');throw CliErrors[_0x23d2bd(0x107)](_0x23d2bd(0x103)+_0x19c2c3+_0x23d2bd(0x125)+_0x200bfe+'.',_0x64eb04);}const _0x8ff251=_0x36924c[0x0];return{'userId':_0x8ff251[_0x23d2bd(0xf7)],'username':_0x8ff251[_0x23d2bd(0x101)]??String(_0x8ff251['userId']),'nickname':_0x8ff251['nickname'],'matchedBy':_0x23d2bd(0x122)};}export const CREATE_USER_ROLE_PATH=a235_0x5c3421(0x100);export const DELETE_USER_ROLE_PATH=a235_0x5c3421(0x10e);function a235_0x48f7(){const _0xf388a2=['OWNER','User\x20','4325056fXYnno','144chimGS','/smartapi/permit/user-role/delete','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','66953KCPDtn','roleName','number','user','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','Role\x20name','includes','roleType','expectUserCount','push','tenant','Role\x20id\x20','Optional\x20role\x20remark/description','Anti-drift\x20check\x20failed:\x20expected\x20','userCount','110502ChpYIR','filter','Cannot\x20','name','Pass\x20--role\x20<id|name>.','470qVeiKE','\x22:\x20','nickname','Missing\x20role\x20reference.','toLowerCase','totalCount','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','\x20member(s)\x20but\x20role\x20has\x20','str','Check\x20the\x20nickname/username.\x20','expect-user-count','Role\x20id\x20or\x20exact\x20role\x20name','find','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','10ewfrap','trim','remark','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','\x22\x20not\x20found\x20in\x20app\x20','test','190897ZhhvmF','map','permitCount','\x20is\x20not\x20a\x20member\x20of\x20role\x20','3108160WImSRi',';\x20no\x20change.','ADMIN','Disambiguate\x20with\x20--role\x20<id>.','3344255mMwZUn','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','\x20built-in\x20role\x20','Pass\x20--user\x20<id>.','length','\x20duplicate\x20memberships\x20for\x20user\x20','appCode','userId','string','join','DEV','Role\x20name\x20\x22','Pass\x20--user\x20<id|name>.','flagMissing','No\x20tenant\x20member\x20matches\x20\x22','CUSTOM','/smartapi/permit/user-role/create','username','26976qkpEWG','Multiple\x20tenant\x20members\x20match\x20\x22','role','\x22\x20is\x20ambiguous\x20(ids:\x20','Role\x20id\x20(from\x20`role\x20list`)','validation','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','POST'];a235_0x48f7=function(){return _0xf388a2;};return a235_0x48f7();}export function computeRoleUserMutation(_0x20100c){const _0x2b0ad8=a235_0x5c3421,{operation:_0x1ba0bd,appCode:_0x303ae8,role:_0x3f3c23,relations:_0x5a1c08,user:_0x206e9e}=_0x20100c,_0xdcf4fd=[...new Set(_0x5a1c08[_0x2b0ad8(0xe9)](_0x53a83f=>_0x53a83f[_0x2b0ad8(0xf7)]))],_0x3a73fd=[];if(_0x20100c[_0x2b0ad8(0x118)]!==undefined&&_0x20100c['expectUserCount']!==_0xdcf4fd[_0x2b0ad8(0xf4)])throw CliErrors[_0x2b0ad8(0x107)](_0x2b0ad8(0x11d)+_0x20100c[_0x2b0ad8(0x118)]+_0x2b0ad8(0x12b)+_0xdcf4fd['length']+'.',_0x2b0ad8(0x108));const _0x4496ce=_0xdcf4fd[_0x2b0ad8(0x116)](_0x206e9e[_0x2b0ad8(0xf7)]),_0x2a1036=_0x5a1c08['filter'](_0x461995=>_0x461995[_0x2b0ad8(0xf7)]===_0x206e9e[_0x2b0ad8(0xf7)])[_0x2b0ad8(0xe9)](_0x3aa872=>_0x3aa872['id']),_0x23005c=_0x1ba0bd==='user-add'?!_0x4496ce:_0x4496ce;let _0x463763=_0xdcf4fd;_0x1ba0bd==='user-add'?_0x4496ce?_0x3a73fd[_0x2b0ad8(0x119)](_0x2b0ad8(0x10b)+_0x206e9e[_0x2b0ad8(0xf7)]+'\x20is\x20already\x20a\x20member\x20of\x20role\x20'+_0x3f3c23[_0x2b0ad8(0x111)]+_0x2b0ad8(0xed)):_0x463763=[..._0xdcf4fd,_0x206e9e['userId']]:!_0x4496ce?_0x3a73fd[_0x2b0ad8(0x119)](_0x2b0ad8(0x10b)+_0x206e9e['userId']+_0x2b0ad8(0xeb)+_0x3f3c23[_0x2b0ad8(0x111)]+_0x2b0ad8(0xed)):(_0x463763=_0xdcf4fd[_0x2b0ad8(0x120)](_0x5c62a1=>_0x5c62a1!==_0x206e9e['userId']),_0x2a1036[_0x2b0ad8(0xf4)]>0x1&&_0x3a73fd[_0x2b0ad8(0x119)]('Removed\x20'+_0x2a1036[_0x2b0ad8(0xf4)]+_0x2b0ad8(0xf5)+_0x206e9e[_0x2b0ad8(0xf7)]+'.'));const _0x1ca347={'scope':'dev','operation':_0x1ba0bd,'selector':{'appCode':_0x303ae8,'roleId':_0x3f3c23['id'],'roleName':_0x3f3c23[_0x2b0ad8(0x111)],'userId':_0x206e9e[_0x2b0ad8(0xf7)]},'before':{'userIds':_0xdcf4fd},'after':{'userIds':_0x463763},'dryRun':_0x20100c['dryRun'],'backend':{'method':_0x2b0ad8(0x109),'path':_0x1ba0bd==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x3a73fd};return{'mutation':_0x1ca347,'changed':_0x23005c,'matchingRelationIds':_0x2a1036};}export async function loadDevRoleRelations(_0x595d64,_0x49dadd){const _0x2f2c5e=a235_0x5c3421,_0x103611=0x64,_0x2715ab=[];for(let _0x2976e9=0x1;;_0x2976e9+=0x1){const {items:_0x2ed5ab,paging:_0x37321d}=await listDevUserRoleRelations(_0x595d64,{'roleId':_0x49dadd,'currentPage':_0x2976e9,'pageSize':_0x103611});_0x2715ab[_0x2f2c5e(0x119)](..._0x2ed5ab);if(_0x2ed5ab['length']<_0x103611||_0x37321d&&_0x2715ab[_0x2f2c5e(0xf4)]>=_0x37321d[_0x2f2c5e(0x129)])return _0x2715ab;}}export function readRoleRef(_0x13e228){const _0x116500=a235_0x5c3421,_0x50a1ce=_0x13e228['str']('role')[_0x116500(0x134)]();if(!_0x50a1ce)throw CliErrors[_0x116500(0xfd)](_0x116500(0x104),_0x116500(0x123));return _0x50a1ce;}export async function prepareUserMutation(_0x3a3471,_0x173804,_0x1dfa04){const _0x29ba72=a235_0x5c3421,_0x3c3f62=readRoleRef(_0x3a3471),_0x7a7824=_0x3a3471[_0x29ba72(0x12c)](_0x29ba72(0x113))[_0x29ba72(0x134)]();if(!_0x7a7824)throw CliErrors['flagMissing'](_0x29ba72(0x113),'Pass\x20--user\x20<id|name>.');const _0x43f9d1=_0x3a3471['flag'](_0x29ba72(0x12e)),_0x412f4b=_0x43f9d1===undefined||_0x43f9d1===null?undefined:Number(_0x43f9d1),_0x5846cd=await resolveRoleRef(_0x3a3471[_0x29ba72(0xf6)],_0x3c3f62);if(_0x5846cd[_0x29ba72(0x117)]===_0x29ba72(0x10a))throw CliErrors[_0x29ba72(0x107)](_0x29ba72(0x121)+_0x173804+'\x20members\x20of\x20the\x20OWNER\x20role.',_0x29ba72(0x131));const _0x43a470=await resolveUserRef(_0x7a7824),_0x59c828=await loadDevRoleRelations(_0x3a3471['appCode'],_0x5846cd['id']);return{...computeRoleUserMutation({'operation':_0x173804,'appCode':_0x3a3471[_0x29ba72(0xf6)],'role':_0x5846cd,'relations':_0x59c828,'user':{'userId':_0x43a470[_0x29ba72(0xf7)],'username':_0x43a470['username'],'nickname':_0x43a470[_0x29ba72(0x126)]},'dryRun':_0x1dfa04,..._0x412f4b!==undefined?{'expectUserCount':_0x412f4b}:{}}),'role':_0x5846cd,'user':_0x43a470};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a236_0x2dce3e=a236_0xbdeb;(function(_0x4dc4f7,_0x1988b1){const _0x4ad79a=a236_0xbdeb,_0x562b80=_0x4dc4f7();while(!![]){try{const _0x41cfe7=parseInt(_0x4ad79a(0x1d6))/0x1*(-parseInt(_0x4ad79a(0x1d2))/0x2)+-parseInt(_0x4ad79a(0x1ca))/0x3+parseInt(_0x4ad79a(0x1da))/0x4+parseInt(_0x4ad79a(0x1cb))/0x5+parseInt(_0x4ad79a(0x1d5))/0x6*(parseInt(_0x4ad79a(0x1db))/0x7)+parseInt(_0x4ad79a(0x1d0))/0x8+parseInt(_0x4ad79a(0x1cd))/0x9*(-parseInt(_0x4ad79a(0x1de))/0xa);if(_0x41cfe7===_0x1988b1)break;else _0x562b80['push'](_0x562b80['shift']());}catch(_0x55077a){_0x562b80['push'](_0x562b80['shift']());}}}(a236_0x361c,0xbcb6e));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';const UPDATE_PATH=a236_0x2dce3e(0x1df);function a236_0x361c(){const _0x48a913=['dev','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','3341946kEewAC','7534805ZgYBrd','validation','9IzPqdg','string','POST','2403776WDtekg','num','43146vXUziu','write','name','174tdKwNZ','39WEzHCD','roleName','Updated\x20role\x20','flag','2963136EDzlAm','140749KjCXXO','Nothing\x20to\x20update.','trim','4030170BLvAza','/smartapi/permit/role/update','--name\x20cannot\x20be\x20empty.','remark','update','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','appCode'];a236_0x361c=function(){return _0x48a913;};return a236_0x361c();}function readPatch(_0xf92e9a){const _0x22c38b=a236_0x2dce3e,_0x5babac=_0xf92e9a[_0x22c38b(0x1d9)]('name'),_0x44cf8a=_0xf92e9a[_0x22c38b(0x1d9)](_0x22c38b(0x1c4)),_0x47f496={};if(_0x5babac!==undefined&&_0x5babac!==null){const _0x3043da=String(_0x5babac)[_0x22c38b(0x1dd)]();if(!_0x3043da)throw CliErrors[_0x22c38b(0x1cc)](_0x22c38b(0x1c3));if(_0x3043da['length']>0x40)throw CliErrors[_0x22c38b(0x1cc)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x47f496[_0x22c38b(0x1d7)]=_0x3043da;}_0x44cf8a!==undefined&&_0x44cf8a!==null&&(_0x47f496[_0x22c38b(0x1c4)]=String(_0x44cf8a));if(_0x47f496['roleName']===undefined&&_0x47f496[_0x22c38b(0x1c4)]===undefined)throw CliErrors[_0x22c38b(0x1cc)](_0x22c38b(0x1dc),_0x22c38b(0x1c6));return _0x47f496;}function a236_0xbdeb(_0x48e654,_0x461bf4){_0x48e654=_0x48e654-0x1c3;const _0x361cbe=a236_0x361c();let _0xbdebdc=_0x361cbe[_0x48e654];return _0xbdebdc;}export const roleUpdate={'service':'role','command':a236_0x2dce3e(0x1c5),'description':a236_0x2dce3e(0x1c9),'risk':a236_0x2dce3e(0x1d3),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a236_0x2dce3e(0x1d4),'type':a236_0x2dce3e(0x1ce),'required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x5c476f){readPatch(_0x5c476f);},async 'dryRun'(_0x31fd3b){const _0x2ac6bb=a236_0x2dce3e,_0x232bb4=_0x31fd3b[_0x2ac6bb(0x1d1)]('id'),_0x1cb888=readPatch(_0x31fd3b),_0x2c91e2=await getRoleById(_0x31fd3b[_0x2ac6bb(0x1c7)],_0x232bb4);return assertCustomRole(_0x2c91e2,_0x2ac6bb(0x1c5)),asDryRunResult({'scope':_0x2ac6bb(0x1c8),'operation':_0x2ac6bb(0x1c5),'selector':{'appCode':_0x31fd3b[_0x2ac6bb(0x1c7)],'roleId':_0x232bb4,'roleName':_0x2c91e2[_0x2ac6bb(0x1d7)]},'before':projectRole(_0x2c91e2),'after':projectRole({..._0x2c91e2,..._0x1cb888[_0x2ac6bb(0x1d7)]!==undefined?{'roleName':_0x1cb888[_0x2ac6bb(0x1d7)]}:{},..._0x1cb888['remark']!==undefined?{'remark':_0x1cb888[_0x2ac6bb(0x1c4)]}:{}}),'dryRun':!![],'backend':{'method':_0x2ac6bb(0x1cf),'path':UPDATE_PATH},'warnings':[]},{'method':_0x2ac6bb(0x1cf),'url':UPDATE_PATH});},async 'execute'(_0x1af3b2){const _0x223466=a236_0x2dce3e,_0x54f501=_0x1af3b2[_0x223466(0x1d1)]('id'),_0x57f4ce=readPatch(_0x1af3b2),_0x173a48=await getRoleById(_0x1af3b2[_0x223466(0x1c7)],_0x54f501);assertCustomRole(_0x173a48,_0x223466(0x1c5)),await updateAppRole({'id':_0x54f501,'appCode':_0x1af3b2[_0x223466(0x1c7)],..._0x57f4ce[_0x223466(0x1d7)]!==undefined?{'roleName':_0x57f4ce[_0x223466(0x1d7)]}:{},..._0x57f4ce[_0x223466(0x1c4)]!==undefined?{'remark':_0x57f4ce[_0x223466(0x1c4)]}:{}});const _0x455aaf=await getRoleById(_0x1af3b2[_0x223466(0x1c7)],_0x54f501);return{'ok':!![],'data':{'scope':_0x223466(0x1c8),'operation':_0x223466(0x1c5),'selector':{'appCode':_0x1af3b2[_0x223466(0x1c7)],'roleId':_0x54f501,'roleName':_0x455aaf[_0x223466(0x1d7)]},'before':projectRole(_0x173a48),'after':projectRole(_0x455aaf),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x223466(0x1d8)+_0x455aaf[_0x223466(0x1d7)]+'\x20(id='+_0x54f501+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a237_0x3d1c(){const _0x3793e5=['8BkwJgE','8sgoAst','18823541lIHEsc','20pvbYoY','user-add','93576qGKLOR','selector','userId','5895533ABdNRa','9544140kOHIkv','No\x20change:\x20user\x20','roleName','1166140cjzJoC','username','roleId','Added\x20user\x20','82130ddafzA','403032GbbofG','POST','high-risk-write','roleType','appCode','role','348NpBNEx'];a237_0x3d1c=function(){return _0x3793e5;};return a237_0x3d1c();}const a237_0x47bb0a=a237_0x55d0;function a237_0x55d0(_0x473989,_0x1fb8e8){_0x473989=_0x473989-0x1d6;const _0x3d1cbf=a237_0x3d1c();let _0x55d0f8=_0x3d1cbf[_0x473989];return _0x55d0f8;}(function(_0x3f821d,_0x3d305e){const _0x517e2b=a237_0x55d0,_0x4fd267=_0x3f821d();while(!![]){try{const _0x17aa68=parseInt(_0x517e2b(0x1df))/0x1*(-parseInt(_0x517e2b(0x1e4))/0x2)+parseInt(_0x517e2b(0x1d8))/0x3+parseInt(_0x517e2b(0x1eb))/0x4+parseInt(_0x517e2b(0x1d7))/0x5*(-parseInt(_0x517e2b(0x1de))/0x6)+parseInt(_0x517e2b(0x1e7))/0x7*(-parseInt(_0x517e2b(0x1e0))/0x8)+-parseInt(_0x517e2b(0x1e8))/0x9+parseInt(_0x517e2b(0x1e2))/0xa*(parseInt(_0x517e2b(0x1e1))/0xb);if(_0x17aa68===_0x3d305e)break;else _0x4fd267['push'](_0x4fd267['shift']());}catch(_0x3608c4){_0x4fd267['push'](_0x4fd267['shift']());}}}(a237_0x3d1c,0x9709a));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';export const roleUserAdd={'service':a237_0x47bb0a(0x1dd),'command':a237_0x47bb0a(0x1e3),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a237_0x47bb0a(0x1da),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x4d2f9a){const _0x33a2a6=a237_0x47bb0a,{mutation:_0x3f5e28}=await prepareUserMutation(_0x4d2f9a,_0x33a2a6(0x1e3),!![]);return asDryRunResult(_0x3f5e28,{'method':_0x33a2a6(0x1d9),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x39d148){const _0x25410c=a237_0x47bb0a,{mutation:_0x10bcd5,changed:_0xcba870,role:_0x535ca9,user:_0x444204}=await prepareUserMutation(_0x39d148,_0x25410c(0x1e3),![]);return _0xcba870&&await createDevUserRole({'appCode':_0x39d148[_0x25410c(0x1dc)],'userId':_0x444204[_0x25410c(0x1e6)],'username':_0x444204[_0x25410c(0x1ec)],'roleType':_0x535ca9[_0x25410c(0x1db)],'roleId':_0x10bcd5[_0x25410c(0x1e5)][_0x25410c(0x1ed)]}),{'ok':!![],'data':_0x10bcd5,'message':_0xcba870?_0x25410c(0x1d6)+_0x10bcd5[_0x25410c(0x1e5)]['userId']+'\x20to\x20role\x20'+_0x10bcd5[_0x25410c(0x1e5)][_0x25410c(0x1ea)]:_0x25410c(0x1e9)+_0x10bcd5[_0x25410c(0x1e5)]['userId']+'\x20already\x20in\x20role\x20'+_0x10bcd5[_0x25410c(0x1e5)][_0x25410c(0x1ea)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a238_0x351d24=a238_0x237c;(function(_0x27c63d,_0x6164e3){const _0x3af86e=a238_0x237c,_0x52aa9a=_0x27c63d();while(!![]){try{const _0x111aa6=parseInt(_0x3af86e(0x6b))/0x1+-parseInt(_0x3af86e(0x77))/0x2*(-parseInt(_0x3af86e(0x76))/0x3)+-parseInt(_0x3af86e(0x6c))/0x4*(parseInt(_0x3af86e(0x70))/0x5)+-parseInt(_0x3af86e(0x6d))/0x6*(parseInt(_0x3af86e(0x78))/0x7)+parseInt(_0x3af86e(0x79))/0x8*(parseInt(_0x3af86e(0x6e))/0x9)+parseInt(_0x3af86e(0x6f))/0xa+-parseInt(_0x3af86e(0x7a))/0xb;if(_0x111aa6===_0x6164e3)break;else _0x52aa9a['push'](_0x52aa9a['shift']());}catch(_0xd00df8){_0x52aa9a['push'](_0x52aa9a['shift']());}}}(a238_0x41bd,0xb0df8));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a238_0x237c(_0x2ab349,_0x5d52e0){_0x2ab349=_0x2ab349-0x6a;const _0x41bda1=a238_0x41bd();let _0x237cbc=_0x41bda1[_0x2ab349];return _0x237cbc;}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';function a238_0x41bd(){const _0x44fc3f=['Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','high-risk-write','1368165MowxIe','1842124SafAyh','12tcbMLJ','958077HpGdzt','4022340xQldvS','5EslTve','role','roleName','userId','user-remove','selector','2709651HpVmkP','2TLvUEe','4621442CvVirx','104jdwNiw','17072990LruxyA','No\x20change:\x20user\x20'];a238_0x41bd=function(){return _0x44fc3f;};return a238_0x41bd();}export const roleUserRemove={'service':a238_0x351d24(0x71),'command':a238_0x351d24(0x74),'description':a238_0x351d24(0x7c),'risk':a238_0x351d24(0x6a),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2f3972){const _0x253617=a238_0x351d24,{mutation:_0x326e37}=await prepareUserMutation(_0x2f3972,_0x253617(0x74),!![]);return asDryRunResult(_0x326e37,{'method':'POST','url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x430c9c){const _0xb2e832=a238_0x351d24,{matchingRelationIds:_0x2eb8ae,mutation:_0x3db4ff,changed:_0x373f30}=await prepareUserMutation(_0x430c9c,_0xb2e832(0x74),![]);if(_0x373f30)for(const _0xc9bfc of _0x2eb8ae){await deleteDevUserRole(_0xc9bfc);}return{'ok':!![],'data':_0x3db4ff,'message':_0x373f30?'Removed\x20user\x20'+_0x3db4ff[_0xb2e832(0x75)]['userId']+'\x20from\x20role\x20'+_0x3db4ff[_0xb2e832(0x75)]['roleName']:_0xb2e832(0x7b)+_0x3db4ff[_0xb2e832(0x75)][_0xb2e832(0x73)]+'\x20not\x20in\x20role\x20'+_0x3db4ff['selector'][_0xb2e832(0x72)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a239_0x7097(){const _0x1833f4=['522417CzGrVy','30yiMCHg','592758IWEjle','2205071sQDzjT','read','str','Resolved\x20\x22','696965uofiZF','137896ydsKBU','2195320ZXDEQX','user-resolve','\x22\x20→\x20userId\x20','nickname','1320633IgXpXE','role','matchedBy','Pass\x20--name\x20<nickname|username>.','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','userId','name','4mlBmyB','20NcajRu','8pUDRra','username','flagMissing'];a239_0x7097=function(){return _0x1833f4;};return a239_0x7097();}const a239_0x1f1d81=a239_0x1e25;(function(_0x209ea0,_0x27e636){const _0x556f0b=a239_0x1e25,_0xed1f91=_0x209ea0();while(!![]){try{const _0x554314=-parseInt(_0x556f0b(0x1d8))/0x1*(parseInt(_0x556f0b(0x1e5))/0x2)+-parseInt(_0x556f0b(0x1ec))/0x3+-parseInt(_0x556f0b(0x1e7))/0x4*(-parseInt(_0x556f0b(0x1d7))/0x5)+-parseInt(_0x556f0b(0x1eb))/0x6*(-parseInt(_0x556f0b(0x1ea))/0x7)+parseInt(_0x556f0b(0x1d9))/0x8+parseInt(_0x556f0b(0x1dd))/0x9+parseInt(_0x556f0b(0x1e6))/0xa*(-parseInt(_0x556f0b(0x1ed))/0xb);if(_0x554314===_0x27e636)break;else _0xed1f91['push'](_0xed1f91['shift']());}catch(_0x5c28ed){_0xed1f91['push'](_0xed1f91['shift']());}}}(a239_0x7097,0x30889));import{CliErrors}from'../../errors.js';function a239_0x1e25(_0xf01b9a,_0x447828){_0xf01b9a=_0xf01b9a-0x1d5;const _0x70979a=a239_0x7097();let _0x1e2534=_0x70979a[_0xf01b9a];return _0x1e2534;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a239_0x1f1d81(0x1de),'command':a239_0x1f1d81(0x1da),'description':a239_0x1f1d81(0x1e2),'risk':a239_0x1f1d81(0x1ee),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3f11c6){const _0xf3e756=a239_0x1f1d81;if(!_0x3f11c6[_0xf3e756(0x1d5)](_0xf3e756(0x1e4))['trim']())throw CliErrors[_0xf3e756(0x1e9)](_0xf3e756(0x1e4),_0xf3e756(0x1e0));},async 'execute'(_0xe5cd71){const _0x2e6cd6=a239_0x1f1d81,_0x157a67=_0xe5cd71[_0x2e6cd6(0x1d5)](_0x2e6cd6(0x1e4))['trim'](),_0x9e0f43=await resolveUserRef(_0x157a67,_0x2e6cd6(0x1e1));return{'ok':!![],'data':{'user':{'userId':_0x9e0f43[_0x2e6cd6(0x1e3)],'username':_0x9e0f43[_0x2e6cd6(0x1e8)],'nickname':_0x9e0f43[_0x2e6cd6(0x1dc)],'matchedBy':_0x9e0f43[_0x2e6cd6(0x1df)]}},'message':_0x2e6cd6(0x1d6)+_0x157a67+_0x2e6cd6(0x1db)+_0x9e0f43[_0x2e6cd6(0x1e3)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a240_0x124f97=a240_0x5d3e;(function(_0x1ab3ff,_0x52fd71){const _0xa04b00=a240_0x5d3e,_0x59f6ce=_0x1ab3ff();while(!![]){try{const _0x56223f=-parseInt(_0xa04b00(0x1b8))/0x1*(parseInt(_0xa04b00(0x1ae))/0x2)+-parseInt(_0xa04b00(0x1b2))/0x3+parseInt(_0xa04b00(0x1b0))/0x4+parseInt(_0xa04b00(0x1b3))/0x5*(parseInt(_0xa04b00(0x1ad))/0x6)+-parseInt(_0xa04b00(0x1b1))/0x7+-parseInt(_0xa04b00(0x1c2))/0x8*(-parseInt(_0xa04b00(0x1bd))/0x9)+-parseInt(_0xa04b00(0x1c0))/0xa*(-parseInt(_0xa04b00(0x1c1))/0xb);if(_0x56223f===_0x52fd71)break;else _0x59f6ce['push'](_0x59f6ce['shift']());}catch(_0x827d14){_0x59f6ce['push'](_0x59f6ce['shift']());}}}(a240_0x3770,0x7774c));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';function a240_0x3770(){const _0x32edd8=['Loaded\x20','2636580drnHYR','5056282PmbMxc','2590620YoePaq','1770tRhCuY','rule','\x20for\x20','cookie','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','503921wYcosP','\x20is\x20not\x20configured\x20for\x20app\x20','appCode','\x20--file\x20<path>\x20--dry-run`.','app_rule_not_found','7398711zggCUj','read','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','1639930MEUyBu','55aRIyBv','8FflrzT','content','4710jHvmAR','2KDwjnz'];a240_0x3770=function(){return _0x32edd8;};return a240_0x3770();}function a240_0x5d3e(_0x4ddd16,_0x1e8af8){_0x4ddd16=_0x4ddd16-0x1ac;const _0x377085=a240_0x3770();let _0x5d3eef=_0x377085[_0x4ddd16];return _0x5d3eef;}export const ruleGet={'service':a240_0x124f97(0x1b4),'command':'get','description':a240_0x124f97(0x1bf),'risk':a240_0x124f97(0x1be),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x321d84){readAppRuleType(_0x321d84);},async 'execute'(_0x3615b9){const _0x2563ce=a240_0x124f97,_0x30f98c=readAppRuleType(_0x3615b9),_0xb2faa3=await getAppRule(_0x3615b9[_0x2563ce(0x1b6)],{'appCode':_0x3615b9[_0x2563ce(0x1ba)],'type':_0x30f98c});if(!_0xb2faa3)throw appRuleError(_0x2563ce(0x1bc),appRuleFileName(_0x30f98c)+_0x2563ce(0x1b9)+_0x3615b9['appCode']+'.',_0x2563ce(0x1b7)+_0x30f98c+_0x2563ce(0x1bb));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x30f98c,_0xb2faa3),'content':_0xb2faa3[_0x2563ce(0x1ac)]}},'message':_0x2563ce(0x1af)+appRuleFileName(_0x30f98c)+_0x2563ce(0x1b5)+_0x3615b9['appCode']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x157a9c,_0x2fe36d){const _0x2bec21=a241_0x25f0,_0x17fa51=_0x157a9c();while(!![]){try{const _0x54629a=parseInt(_0x2bec21(0x84))/0x1*(parseInt(_0x2bec21(0x83))/0x2)+parseInt(_0x2bec21(0x85))/0x3+-parseInt(_0x2bec21(0x81))/0x4+-parseInt(_0x2bec21(0x86))/0x5+-parseInt(_0x2bec21(0x7f))/0x6*(parseInt(_0x2bec21(0x80))/0x7)+parseInt(_0x2bec21(0x88))/0x8*(-parseInt(_0x2bec21(0x87))/0x9)+parseInt(_0x2bec21(0x82))/0xa*(parseInt(_0x2bec21(0x89))/0xb);if(_0x54629a===_0x2fe36d)break;else _0x17fa51['push'](_0x17fa51['shift']());}catch(_0x2ca251){_0x17fa51['push'](_0x17fa51['shift']());}}}(a241_0x4614,0x20d3f));function a241_0x25f0(_0x518d44,_0x55ddba){_0x518d44=_0x518d44-0x7f;const _0x461405=a241_0x4614();let _0x25f027=_0x461405[_0x518d44];return _0x25f027;}import{ruleGet}from'../../commands/rule/get.js';function a241_0x4614(){const _0x4b4783=['707YPWeqj','840208KPyltS','52810twRToF','712Ymycfi','433oLKilw','71931DfPezN','159590MaSlyG','1021338NAaQeL','16ophOAP','1441IKOLdi','15834Vazzmm'];a241_0x4614=function(){return _0x4b4783;};return a241_0x4614();}import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a242_0x5dba5c=a242_0x592e;(function(_0x4eddb0,_0x2dd4fe){const _0x3d4fa7=a242_0x592e,_0xee104b=_0x4eddb0();while(!![]){try{const _0x38b266=-parseInt(_0x3d4fa7(0xc2))/0x1+-parseInt(_0x3d4fa7(0xbb))/0x2+parseInt(_0x3d4fa7(0xc7))/0x3+-parseInt(_0x3d4fa7(0xbc))/0x4*(-parseInt(_0x3d4fa7(0xc6))/0x5)+-parseInt(_0x3d4fa7(0xbf))/0x6+-parseInt(_0x3d4fa7(0xba))/0x7+parseInt(_0x3d4fa7(0xbd))/0x8;if(_0x38b266===_0x2dd4fe)break;else _0xee104b['push'](_0xee104b['shift']());}catch(_0x405e29){_0xee104b['push'](_0xee104b['shift']());}}}(a242_0x2077,0x7d6f9));function a242_0x592e(_0x13eb62,_0x3ded48){_0x13eb62=_0x13eb62-0xb9;const _0x207752=a242_0x2077();let _0x592e73=_0x207752[_0x13eb62];return _0x592e73;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a242_0x5dba5c(0xc5),'command':a242_0x5dba5c(0xc1),'description':a242_0x5dba5c(0xb9),'risk':a242_0x5dba5c(0xc9),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x500efc){const _0x5ebaef=a242_0x5dba5c,_0x3098e4=await Promise[_0x5ebaef(0xbe)](APP_RULE_TYPES[_0x5ebaef(0xca)](_0x1d865d=>getAppRule(_0x500efc[_0x5ebaef(0xc3)],{'appCode':_0x500efc['appCode'],'type':_0x1d865d}))),_0x18b822=APP_RULE_TYPES['map']((_0x37bfe0,_0x17810a)=>projectAppRule(_0x37bfe0,_0x3098e4[_0x17810a]??null));return{'ok':!![],'data':{'total':_0x18b822[_0x5ebaef(0xc8)],'rules':_0x18b822},'message':_0x5ebaef(0xc4)+_0x500efc[_0x5ebaef(0xc0)]};}};function a242_0x2077(){const _0x4d3738=['List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','5140212ArTRGV','1482776EgDFOQ','1439224oNqqCb','19220016ErFKhU','all','5220132ecdCZm','appCode','list','490580FmstUM','cookie','Loaded\x20app\x20rule\x20configuration\x20for\x20','rule','5vMoccW','1763349AXNDHc','length','read','map'];a242_0x2077=function(){return _0x4d3738;};return a242_0x2077();}
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a243_0x42ce15=a243_0x48bd;(function(_0x5da8a8,_0x335fe9){const _0x56ec13=a243_0x48bd,_0x2c0044=_0x5da8a8();while(!![]){try{const _0x53c667=-parseInt(_0x56ec13(0x145))/0x1*(-parseInt(_0x56ec13(0x13b))/0x2)+parseInt(_0x56ec13(0x12e))/0x3+parseInt(_0x56ec13(0x150))/0x4*(-parseInt(_0x56ec13(0x14e))/0x5)+-parseInt(_0x56ec13(0x13d))/0x6*(-parseInt(_0x56ec13(0x146))/0x7)+-parseInt(_0x56ec13(0x134))/0x8+parseInt(_0x56ec13(0x141))/0x9+-parseInt(_0x56ec13(0x12f))/0xa;if(_0x53c667===_0x335fe9)break;else _0x2c0044['push'](_0x2c0044['shift']());}catch(_0x4e4462){_0x2c0044['push'](_0x2c0044['shift']());}}}(a243_0x4e4d,0xdc2c1));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';const SAVE_PATH=a243_0x42ce15(0x152),NON_ATOMIC_WARNING=a243_0x42ce15(0x148);function readSetInput(_0x1fd813){const _0x2a172d=a243_0x42ce15,_0x56411b=readAppRuleType(_0x1fd813),_0x5cb30d=_0x1fd813[_0x2a172d(0x163)](_0x2a172d(0x153))[_0x2a172d(0x123)]();if(!_0x5cb30d)throw appRuleError(_0x2a172d(0x151),_0x2a172d(0x127),_0x2a172d(0x12c));const _0x18d5f1=_0x1fd813[_0x2a172d(0x124)](_0x2a172d(0x139));let _0x2d5712;if(_0x18d5f1!==undefined){_0x2d5712=Number(_0x18d5f1);if(!Number[_0x2a172d(0x157)](_0x2d5712)||_0x2d5712<0x0)throw appRuleError(_0x2a172d(0x125),_0x2a172d(0x128));}return{'type':_0x56411b,'file':_0x5cb30d,'expectedVersion':_0x2d5712};}async function prepareSet(_0x4e27f6){const _0x3d06c3=a243_0x42ce15,_0x49c62d=readSetInput(_0x4e27f6),_0x4438e9=await readAppRuleFile(_0x49c62d[_0x3d06c3(0x153)]),_0x16918f=await getAppRule(_0x4e27f6[_0x3d06c3(0x15e)],{'appCode':_0x4e27f6[_0x3d06c3(0x15a)],'type':_0x49c62d['type']});if(_0x49c62d[_0x3d06c3(0x142)]!==undefined&&_0x16918f?.['version']!==_0x49c62d['expectedVersion'])throw appRuleError(_0x3d06c3(0x143),appRuleFileName(_0x49c62d['type'])+'\x20version\x20changed\x20before\x20write.',_0x3d06c3(0x15f)+_0x49c62d[_0x3d06c3(0x142)]+_0x3d06c3(0x160)+(_0x16918f?.[_0x3d06c3(0x132)]??_0x3d06c3(0x14c))+_0x3d06c3(0x122));return{'input':_0x49c62d,'replacement':_0x4438e9,'beforeRecord':_0x16918f,'before':projectAppRule(_0x49c62d[_0x3d06c3(0x159)],_0x16918f),'planned':{'type':_0x49c62d[_0x3d06c3(0x159)],'fileName':appRuleFileName(_0x49c62d['type']),'contextScope':appRuleContextScope(_0x49c62d[_0x3d06c3(0x159)]),'enabled':!![],'appCode':_0x4e27f6[_0x3d06c3(0x15a)],'scope':_0x3d06c3(0x137),'contentByteSize':_0x4438e9[_0x3d06c3(0x161)],'contentHash':_0x4438e9[_0x3d06c3(0x129)]}};}function a243_0x48bd(_0x126718,_0x5b47b2){_0x126718=_0x126718-0x122;const _0x4e4de2=a243_0x4e4d();let _0x48bd27=_0x4e4de2[_0x126718];return _0x48bd27;}function warningsFor(_0x49ae6d){return _0x49ae6d===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a243_0x42ce15(0x131),'command':a243_0x42ce15(0x14d),'description':a243_0x42ce15(0x13a),'risk':a243_0x42ce15(0x162),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x42ce15(0x153),'type':a243_0x42ce15(0x14a),'required':!![],'description':a243_0x42ce15(0x144)},{'name':a243_0x42ce15(0x139),'type':a243_0x42ce15(0x14b),'required':![],'description':a243_0x42ce15(0x15c)}],async 'validate'(_0x3d4fae){readSetInput(_0x3d4fae);},async 'dryRun'(_0xe7c2fc){const _0x22dd7c=a243_0x42ce15,_0x3a83d0=await prepareSet(_0xe7c2fc);return asDryRunResult({'operation':_0x22dd7c(0x14d),'selector':{'appCode':_0xe7c2fc[_0x22dd7c(0x15a)],'scope':_0x22dd7c(0x137),'type':_0x3a83d0[_0x22dd7c(0x133)][_0x22dd7c(0x159)]},'before':_0x3a83d0[_0x22dd7c(0x13f)],'after':_0x3a83d0['planned'],'dryRun':!![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':warningsFor(_0x3a83d0[_0x22dd7c(0x133)][_0x22dd7c(0x142)]),'verification':{'expectedVersion':_0x3a83d0[_0x22dd7c(0x133)][_0x22dd7c(0x142)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x22dd7c(0x156)+_0x3a83d0[_0x22dd7c(0x133)][_0x22dd7c(0x159)]+'\x20--format\x20compress'}},{'method':'POST','url':SAVE_PATH});},async 'execute'(_0x4ac171){const _0x4df375=a243_0x42ce15,_0x3a761c=await prepareSet(_0x4ac171);let _0x4d5571=![];try{await saveAppRule(_0x4ac171[_0x4df375(0x15e)],{'appCode':_0x4ac171['appCode'],'type':_0x3a761c[_0x4df375(0x133)][_0x4df375(0x159)],'content':_0x3a761c[_0x4df375(0x126)][_0x4df375(0x158)]});}catch(_0x277a86){if(!isPlatformTransportFailure(_0x277a86))throw _0x277a86;_0x4d5571=!![];}let _0x4bb546;try{_0x4bb546=await getAppRule(_0x4ac171[_0x4df375(0x15e)],{'appCode':_0x4ac171[_0x4df375(0x15a)],'type':_0x3a761c[_0x4df375(0x133)]['type']});}catch(_0xe516fc){const _0x4d9cf2=appRuleError(_0x4d5571?_0x4df375(0x136):_0x4df375(0x15b),'The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x3a761c[_0x4df375(0x133)][_0x4df375(0x159)])+_0x4df375(0x135),_0x4df375(0x154));Object[_0x4df375(0x147)](_0x4d9cf2,_0x4df375(0x14f),{'value':_0xe516fc,'enumerable':![]});throw _0x4d9cf2;}const _0x4fe286=_0x4bb546&&inspectAppRuleContent(_0x4bb546['content'])[_0x4df375(0x129)]===_0x3a761c[_0x4df375(0x126)][_0x4df375(0x129)],_0x3169e7=_0x4bb546&&(_0x3a761c[_0x4df375(0x149)]===null||_0x4bb546[_0x4df375(0x132)]>_0x3a761c[_0x4df375(0x149)][_0x4df375(0x132)]);if(!_0x4bb546||!_0x4fe286||!_0x3169e7)throw appRuleError(_0x4d5571?_0x4df375(0x136):_0x4df375(0x155),appRuleFileName(_0x3a761c[_0x4df375(0x133)][_0x4df375(0x159)])+_0x4df375(0x140),_0x4df375(0x12b)+_0x3a761c[_0x4df375(0x133)][_0x4df375(0x159)]+_0x4df375(0x138));const _0xc2ed42=warningsFor(_0x3a761c[_0x4df375(0x133)][_0x4df375(0x142)]);_0x4d5571&&_0xc2ed42[_0x4df375(0x130)]('Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.');const _0xfb1830=projectAppRule(_0x3a761c[_0x4df375(0x133)][_0x4df375(0x159)],_0x4bb546);return{'ok':!![],'data':{'operation':_0x4df375(0x14d),'selector':{'appCode':_0x4ac171[_0x4df375(0x15a)],'scope':_0x4df375(0x137),'type':_0x3a761c[_0x4df375(0x133)]['type']},'before':_0x3a761c[_0x4df375(0x13f)],'after':_0xfb1830,'dryRun':![],'backend':{'method':_0x4df375(0x15d),'path':SAVE_PATH},'warnings':_0xc2ed42,'verification':{'status':_0x4df375(0x12a),'recoveredAfterUnknownResponse':_0x4d5571,'expectedVersion':_0x3a761c[_0x4df375(0x133)][_0x4df375(0x142)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x3a761c['input'][_0x4df375(0x159)]+_0x4df375(0x13e)}},'message':_0x4df375(0x13c)+appRuleFileName(_0x3a761c[_0x4df375(0x133)][_0x4df375(0x159)])+_0x4df375(0x12d)+_0x4ac171[_0x4df375(0x15a)]};}};function a243_0x4e4d(){const _0x5a62f9=['type','appCode','app_rule_verification_unavailable','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','POST','cookie','Expected\x20',';\x20current\x20version\x20is\x20','byteSize','write','str','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','trim','flag','app_rule_expected_version_invalid','replacement','--file\x20is\x20required.','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','contentHash','verified','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','Pass\x20a\x20UTF-8\x20Markdown\x20file.','\x20for\x20','2781036VqmoKI','16118510WcXHuw','push','rule','version','input','13808152fFXBZf','\x20could\x20not\x20be\x20verified.','app_rule_set_outcome_unknown','rules','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','expected-version','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','1609620XYjLqH','Set\x20','1386996tmhPZJ','\x20--format\x20compress','before','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','14073255IUnqFQ','expectedVersion','app_rule_version_mismatch','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','1btvWeT','49zHWZuH','defineProperty','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','beforeRecord','string','number','unconfigured','set','105310QnXVNh','cause','128rPRzMl','app_rule_file_required','/smartapi/knowledge-base/save','file','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','app_rule_verification_failed','rabetbase\x20rule\x20get\x20--type\x20','isSafeInteger','content'];a243_0x4e4d=function(){return _0x5a62f9;};return a243_0x4e4d();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x39dc7b=a244_0x3c8b;(function(_0x35ebdc,_0x1da223){const _0x32e282=a244_0x3c8b,_0x58ddd7=_0x35ebdc();while(!![]){try{const _0x58c8f5=-parseInt(_0x32e282(0xc2))/0x1+-parseInt(_0x32e282(0xc5))/0x2*(-parseInt(_0x32e282(0xac))/0x3)+parseInt(_0x32e282(0xb7))/0x4*(parseInt(_0x32e282(0xb5))/0x5)+-parseInt(_0x32e282(0xba))/0x6*(-parseInt(_0x32e282(0xbf))/0x7)+-parseInt(_0x32e282(0xc3))/0x8*(parseInt(_0x32e282(0xd2))/0x9)+parseInt(_0x32e282(0xce))/0xa*(parseInt(_0x32e282(0xcf))/0xb)+parseInt(_0x32e282(0xb1))/0xc*(-parseInt(_0x32e282(0xb9))/0xd);if(_0x58c8f5===_0x1da223)break;else _0x58ddd7['push'](_0x58ddd7['shift']());}catch(_0x547993){_0x58ddd7['push'](_0x58ddd7['shift']());}}}(a244_0x5292,0xb86f4));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x39dc7b(0xa8),a244_0x39dc7b(0xc7)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;function a244_0x5292(){const _0x11e16f=['App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','createTime','10152MxAvqZ','hex','utf-8','Cannot\x20read\x20app\x20rule\x20file:\x20','from','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','appCode','type','DATABASE.md','app_rule_content_too_large','app_rule_content_invalid','Cannot\x20access\x20app\x20rule\x20file:\x20','database-analysis','rules','size','page-api-development','utf8','62409bhZkZV','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','Pass\x20a\x20UTF-8\x20Markdown\x20file.','byteSize','digest','8254476svLPcE','byteLength','sha256','version','281455ZgqseP','trim','60VLyNeZ','contentHash','13PupEGA','6333258ToGZdy','message','decode','app_rule_file_required','string','7edetvl','str','RULES.md','984429LfwCuW','5200JYDHNn','App\x20rule\x20file\x20is\x20blank:\x20','40DTZSfp','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','database','--file\x20is\x20required.','updateTime','app_rule_file_invalid','app_rule_type_invalid','isFile','content','31180lMBlLR','2981wYqCjx'];a244_0x5292=function(){return _0x11e16f;};return a244_0x5292();}const APP_RULE_FILES={'rules':a244_0x39dc7b(0xc1),'database':a244_0x39dc7b(0xa3)},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x39dc7b(0xaa),'database':a244_0x39dc7b(0xa7)};export function appRuleError(_0x225085,_0x51c74e,_0x3b9289){return new CliError(_0x225085,0x1,_0x51c74e,_0x3b9289);}function a244_0x3c8b(_0xd87fc4,_0x3a1e67){_0xd87fc4=_0xd87fc4-0x9c;const _0x529237=a244_0x5292();let _0x3c8bbe=_0x529237[_0xd87fc4];return _0x3c8bbe;}export function readAppRuleType(_0x43cd67){const _0x108503=a244_0x39dc7b,_0x49139a=_0x43cd67[_0x108503(0xc0)]('type')[_0x108503(0xb6)]()['toLowerCase']();if(_0x49139a!==_0x108503(0xa8)&&_0x49139a!==_0x108503(0xc7))throw appRuleError(_0x108503(0xcb),'--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x49139a;}export function appRuleFileName(_0x20c5eb){return APP_RULE_FILES[_0x20c5eb];}export function appRuleContextScope(_0x341bbd){return APP_RULE_CONTEXT_SCOPES[_0x341bbd];}export function inspectAppRuleContent(_0x4df157){const _0x494f77=a244_0x39dc7b,_0xcc26ec=Buffer[_0x494f77(0x9f)](_0x4df157,_0x494f77(0xab));return{'content':_0x4df157,'byteSize':_0xcc26ec[_0x494f77(0xb2)],'contentHash':'sha256:'+createHash(_0x494f77(0xb3))['update'](_0xcc26ec)[_0x494f77(0xb0)](_0x494f77(0x9c))};}export async function readAppRuleFile(_0x322da2){const _0x555dba=a244_0x39dc7b,_0x2fb1a6=_0x322da2[_0x555dba(0xb6)]();if(!_0x2fb1a6)throw appRuleError(_0x555dba(0xbd),_0x555dba(0xc8),_0x555dba(0xae));const _0x2ec8cc=resolve(_0x2fb1a6);let _0x1ea73c;try{_0x1ea73c=await stat(_0x2ec8cc);}catch(_0x36de3d){throw appRuleError('app_rule_file_unreadable',_0x555dba(0xa6)+_0x2fb1a6,_0x36de3d instanceof Error?_0x36de3d['message']:String(_0x36de3d));}if(!_0x1ea73c[_0x555dba(0xcc)]())throw appRuleError(_0x555dba(0xca),_0x555dba(0xa0)+_0x2fb1a6);if(_0x1ea73c[_0x555dba(0xa9)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x555dba(0xa4),'App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x2151ab;try{_0x2151ab=await readFile(_0x2ec8cc);}catch(_0x4d49cf){throw appRuleError('app_rule_file_unreadable',_0x555dba(0x9e)+_0x2fb1a6,_0x4d49cf instanceof Error?_0x4d49cf[_0x555dba(0xbb)]:String(_0x4d49cf));}if(_0x2151ab[_0x555dba(0xb2)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x555dba(0xd0));let _0x4115b8;try{_0x4115b8=new TextDecoder(_0x555dba(0x9d),{'fatal':!![],'ignoreBOM':!![]})[_0x555dba(0xbc)](_0x2151ab);}catch{throw appRuleError(_0x555dba(0xa5),_0x555dba(0xc6)+_0x2fb1a6);}if(!_0x4115b8[_0x555dba(0xb6)]())throw appRuleError(_0x555dba(0xa5),_0x555dba(0xc4)+_0x2fb1a6);return inspectAppRuleContent(_0x4115b8);}export function projectAppRule(_0x1ad921,_0x4df02b){const _0x400efa=a244_0x39dc7b;if(!_0x4df02b)return{'type':_0x1ad921,'fileName':appRuleFileName(_0x1ad921),'contextScope':appRuleContextScope(_0x1ad921),'enabled':![]};const _0x323841=inspectAppRuleContent(_0x4df02b[_0x400efa(0xcd)]);return{'type':_0x1ad921,'fileName':appRuleFileName(_0x1ad921),'contextScope':appRuleContextScope(_0x1ad921),'enabled':!![],'id':_0x4df02b['id'],'scope':_0x4df02b['scope'],'appCode':_0x4df02b[_0x400efa(0xa1)],'version':_0x4df02b[_0x400efa(0xb4)],'contentByteSize':_0x323841[_0x400efa(0xaf)],'contentHash':_0x323841[_0x400efa(0xb8)],..._0x4df02b['createTime']!==undefined&&_0x4df02b[_0x400efa(0xd1)]!==null?{'createTime':_0x4df02b['createTime']}:{},..._0x4df02b[_0x400efa(0xc9)]!==undefined&&_0x4df02b['updateTime']!==null?{'updateTime':_0x4df02b[_0x400efa(0xc9)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x39dc7b(0xa2),'type':a244_0x39dc7b(0xbe),'required':!![],'description':a244_0x39dc7b(0xad),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x3d43cf=a245_0x3a42;(function(_0x524f34,_0x14599c){const _0x52302a=a245_0x3a42,_0x126355=_0x524f34();while(!![]){try{const _0x1a9523=parseInt(_0x52302a(0x1a7))/0x1+parseInt(_0x52302a(0x174))/0x2*(-parseInt(_0x52302a(0x191))/0x3)+parseInt(_0x52302a(0x17f))/0x4*(parseInt(_0x52302a(0x169))/0x5)+-parseInt(_0x52302a(0x183))/0x6+parseInt(_0x52302a(0x195))/0x7*(-parseInt(_0x52302a(0x16f))/0x8)+-parseInt(_0x52302a(0x18f))/0x9*(parseInt(_0x52302a(0x19b))/0xa)+-parseInt(_0x52302a(0x17c))/0xb*(-parseInt(_0x52302a(0x172))/0xc);if(_0x1a9523===_0x14599c)break;else _0x126355['push'](_0x126355['shift']());}catch(_0x304b9d){_0x126355['push'](_0x126355['shift']());}}}(a245_0x1fdb,0xba7bb));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x3d43cf(0x178),a245_0x3d43cf(0x18a)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x3d43cf(0x178),a245_0x3d43cf(0x18a),a245_0x3d43cf(0x19e),a245_0x3d43cf(0x16e)]);function a245_0x1fdb(){const _0x5839eb=['dev','\x20run\x20<script>\x0a','utf-8','Enable\x20watch\x20mode\x20for\x20preview','No\x20scripts\x20defined\x20in\x20package.json.','63576mDFkfK','write','795ZtGUVQ','inherit','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','error','25837Sifqxx','log','--watch','close','bun','bun.lock','470GnTsty','pnpm-lock.yaml','.bin','build','changed','join','vite','node_modules','length','Script\x20\x22','package.json','needsUpgrade','101884JBUqwX','args','Domain\x20routing\x20synchronized:\x20','yarn.lock','1907630BAgvZV','push','Available:\x20','(none)','\x20run\x20','preview','592nxlhsz','No\x20package.json\x20found\x20in\x20current\x20directory.','yarn','26184ftzIOv','Run\x20a\x20package.json\x20script','596Zcugmt','cwd','\x20run\x20preview','\x20run\x20preview\x20--watch','start','vite\x20preview\x20exited\x20with\x20code\x20','\x20\x20\x20\x20','watch','8239lFauXW','has','keys','8USTgdp','scripts','run','parse','6307842PYTkMO','path','npm','bun.lockb','validation','belowMinimum','all'];a245_0x1fdb=function(){return _0x5839eb;};return a245_0x1fdb();}export function syncProjectDomainRoutingBeforeScript(_0x5a4734,_0x2ade79){const _0x5e03d7=a245_0x3d43cf;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x5e03d7(0x17d)](_0x2ade79))return null;const _0x5e2458=findProjectRootDirectory(_0x5a4734);if(!resolveConfigPath(_0x5e2458))return null;const _0x21a853=writeProjectDomainRoutingManifest(_0x5e2458);return{'path':_0x21a853[_0x5e03d7(0x184)],'changed':_0x21a853['changed']};}function readPackageScripts(_0x18fdeb){const _0xce9430=a245_0x3d43cf,_0x20f7b0=resolve(_0x18fdeb,_0xce9430(0x1a5));if(!existsSync(_0x20f7b0))return null;try{const _0x5debf4=JSON[_0xce9430(0x182)](readFileSync(_0x20f7b0,_0xce9430(0x18c)));return _0x5debf4[_0xce9430(0x180)]??{};}catch{return null;}}function detectPackageManager(_0x4ae305){const _0x7a22f0=a245_0x3d43cf;if(existsSync(resolve(_0x4ae305,_0x7a22f0(0x186)))||existsSync(resolve(_0x4ae305,_0x7a22f0(0x19a))))return _0x7a22f0(0x199);if(existsSync(resolve(_0x4ae305,_0x7a22f0(0x19c))))return'pnpm';if(existsSync(resolve(_0x4ae305,_0x7a22f0(0x1aa))))return _0x7a22f0(0x171);return _0x7a22f0(0x185);}async function versionCheck(_0x507902){const _0x343dcc=a245_0x3d43cf,_0x41891d=await checkCliVersion();(_0x41891d['needsUpgrade']||_0x41891d[_0x343dcc(0x188)])&&(printCliUpgradeWarning(_0x41891d),assertCliVersionSupported(_0x41891d));const _0x1243a6=await checkSdkVersion(_0x507902);if(_0x1243a6[_0x343dcc(0x1a6)])printSdkUpgradeWarning(_0x1243a6);}function spawnScript(_0x24f52e,_0x6683d3,_0x109d66,_0x164415){return new Promise((_0x4fbf29,_0x3aa532)=>{const _0x3a9bcd=a245_0x3a42,_0x169ad3=[_0x3a9bcd(0x181),_0x6683d3,..._0x109d66],_0x4433c2=spawn(_0x24f52e,_0x169ad3,{'cwd':_0x164415,'stdio':_0x3a9bcd(0x192),'shell':!![],'env':{...process.env,'PATH':''+join(_0x164415,_0x3a9bcd(0x1a2),_0x3a9bcd(0x19d))+delimiter+process.env.PATH}});_0x4433c2['on'](_0x3a9bcd(0x198),_0x1f77f8=>{const _0x56e9bb=_0x3a9bcd;if(_0x1f77f8===0x0||_0x1f77f8===null)_0x4fbf29();else _0x3aa532(new Error(_0x24f52e+_0x56e9bb(0x16d)+_0x6683d3+'\x20exited\x20with\x20code\x20'+_0x1f77f8));}),_0x4433c2['on'](_0x3a9bcd(0x194),_0x3aa532);});}function spawnViteBuildWatch(_0x2a6f7b){return new Promise((_0x2a2476,_0x2893f1)=>{const _0x298a77=a245_0x3a42,_0x1b0431=spawn('vite',[_0x298a77(0x19e),_0x298a77(0x197)],{'cwd':_0x2a6f7b,'stdio':_0x298a77(0x192),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2a6f7b,_0x298a77(0x1a2),_0x298a77(0x19d))+delimiter+process.env.PATH}});_0x1b0431['on'](_0x298a77(0x198),_0x29ace2=>{const _0x2ad84f=_0x298a77;if(_0x29ace2===0x0||_0x29ace2===null)_0x2a2476();else _0x2893f1(new Error(_0x2ad84f(0x193)+_0x29ace2));}),_0x1b0431['on'](_0x298a77(0x194),_0x2893f1);});}function spawnVitePreview(_0x4fdaf5){return new Promise((_0x4f2280,_0x2ca8b8)=>{const _0x1832a7=a245_0x3a42,_0x39d194=spawn(_0x1832a7(0x1a1),[_0x1832a7(0x16e)],{'cwd':_0x4fdaf5,'stdio':_0x1832a7(0x192),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4fdaf5,_0x1832a7(0x1a2),_0x1832a7(0x19d))+delimiter+process.env.PATH}});_0x39d194['on']('close',_0x4abfe6=>{const _0x4035af=_0x1832a7;if(_0x4abfe6===0x0||_0x4abfe6===null)_0x4f2280();else _0x2ca8b8(new Error(_0x4035af(0x179)+_0x4abfe6));}),_0x39d194['on']('error',_0x2ca8b8);});}const runFlags=[{'name':a245_0x3d43cf(0x17b),'type':'boolean','description':a245_0x3d43cf(0x18d),'default':![]}];function a245_0x3a42(_0x508947,_0xefe306){_0x508947=_0x508947-0x169;const _0x1fdb7e=a245_0x1fdb();let _0x3a425b=_0x1fdb7e[_0x508947];return _0x3a425b;}export const runDefinition={'service':a245_0x3d43cf(0x181),'command':a245_0x3d43cf(0x181),'description':a245_0x3d43cf(0x173),'risk':a245_0x3d43cf(0x190),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x581a39=a245_0x3d43cf,_0x3eb9f1=[];return _0x3eb9f1['push']('\x20\x20EXAMPLES'),_0x3eb9f1[_0x581a39(0x16a)](_0x581a39(0x17a)+CLI_BIN_NAME+'\x20run\x20start'),_0x3eb9f1[_0x581a39(0x16a)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20build'),_0x3eb9f1[_0x581a39(0x16a)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x581a39(0x176)),_0x3eb9f1[_0x581a39(0x16a)](_0x581a39(0x17a)+CLI_BIN_NAME+_0x581a39(0x177)),_0x3eb9f1[_0x581a39(0x1a0)]('\x0a');},async 'execute'(_0x2bbbb8){const _0x4ba160=a245_0x3d43cf,_0x10b0dd=process[_0x4ba160(0x175)](),_0xd46026=_0x2bbbb8[_0x4ba160(0x1a8)][0x0],_0x51b6dc=_0x2bbbb8[_0x4ba160(0x1a8)]['slice'](0x1),_0x6240e4=readPackageScripts(_0x10b0dd);if(!_0x6240e4)throw CliErrors[_0x4ba160(0x187)](_0x4ba160(0x170));if(!_0xd46026){const _0x3a22f7=Object['keys'](_0x6240e4);if(_0x3a22f7[_0x4ba160(0x1a3)]===0x0)console[_0x4ba160(0x196)](_0x4ba160(0x18e));else{console[_0x4ba160(0x196)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x306f70 of _0x3a22f7){console[_0x4ba160(0x196)](_0x4ba160(0x17a)+_0x306f70);}console[_0x4ba160(0x196)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x4ba160(0x18b));}return{'ok':!![]};}if(!_0x6240e4[_0xd46026])throw CliErrors['validation'](_0x4ba160(0x1a4)+_0xd46026+'\x22\x20not\x20found\x20in\x20package.json.',_0x4ba160(0x16b)+(Object[_0x4ba160(0x17e)](_0x6240e4)[_0x4ba160(0x1a0)](',\x20')||_0x4ba160(0x16c)));const _0x4db9d6=detectPackageManager(_0x10b0dd),_0x4849e1=syncProjectDomainRoutingBeforeScript(_0x10b0dd,_0xd46026);_0x4849e1?.[_0x4ba160(0x19f)]&&console[_0x4ba160(0x194)](_0x4ba160(0x1a9)+_0x4849e1[_0x4ba160(0x184)]);VERSION_CHECK_SCRIPTS[_0x4ba160(0x17d)](_0xd46026)&&await versionCheck(_0x10b0dd);if(_0xd46026===_0x4ba160(0x16e)&&_0x2bbbb8['bool']('watch'))return await Promise[_0x4ba160(0x189)]([spawnViteBuildWatch(_0x10b0dd),spawnVitePreview(_0x10b0dd)]),{'ok':!![]};return await spawnScript(_0x4db9d6,_0xd46026,_0x51b6dc,_0x10b0dd),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a246_0x4fd6(_0x49a26c,_0x4473df){_0x49a26c=_0x49a26c-0xc4;const _0x3fc841=a246_0x3fc8();let _0x4fd6e0=_0x3fc841[_0x49a26c];return _0x4fd6e0;}const a246_0x33df0a=a246_0x4fd6;function a246_0x3fc8(){const _0x3c524e=['schema','read','export','476SzGpoD','1JiwCpc','756132Wmmfni','87219HMocyx','377298ZxIunl','421760oHQrPa','15824yGVMPa','Export\x20machine-readable\x20command\x20schema\x20(JSON)','119666lNByEN','507612DNJEVe'];a246_0x3fc8=function(){return _0x3c524e;};return a246_0x3fc8();}(function(_0x2bc0e5,_0x39c2aa){const _0x2eda6c=a246_0x4fd6,_0x9a11d2=_0x2bc0e5();while(!![]){try{const _0x1354e9=parseInt(_0x2eda6c(0xcd))/0x1*(parseInt(_0x2eda6c(0xc7))/0x2)+parseInt(_0x2eda6c(0xcf))/0x3+parseInt(_0x2eda6c(0xce))/0x4+parseInt(_0x2eda6c(0xc4))/0x5+-parseInt(_0x2eda6c(0xc8))/0x6+-parseInt(_0x2eda6c(0xcc))/0x7*(parseInt(_0x2eda6c(0xc5))/0x8)+-parseInt(_0x2eda6c(0xd0))/0x9;if(_0x1354e9===_0x39c2aa)break;else _0x9a11d2['push'](_0x9a11d2['shift']());}catch(_0x24c4e7){_0x9a11d2['push'](_0x9a11d2['shift']());}}}(a246_0x3fc8,0x18b8f));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5635dd){const _0x4b30e6=await buildSchemaPayload();return{'ok':!![],'data':_0x4b30e6};}export const schemaDefinition={'service':a246_0x33df0a(0xc9),'command':a246_0x33df0a(0xcb),'description':a246_0x33df0a(0xc6),'risk':a246_0x33df0a(0xca),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a240_0x248308=a240_0x2581;(function(_0x1b17b0,_0x5f1e5d){const _0xe69453=a240_0x2581,_0x16ef80=_0x1b17b0();while(!![]){try{const _0xff268e=-parseInt(_0xe69453(0x11b))/0x1*(parseInt(_0xe69453(0x143))/0x2)+-parseInt(_0xe69453(0x140))/0x3*(parseInt(_0xe69453(0x111))/0x4)+parseInt(_0xe69453(0x112))/0x5+parseInt(_0xe69453(0x136))/0x6+-parseInt(_0xe69453(0x148))/0x7*(parseInt(_0xe69453(0x130))/0x8)+parseInt(_0xe69453(0x12a))/0x9+-parseInt(_0xe69453(0x10a))/0xa;if(_0xff268e===_0x5f1e5d)break;else _0x16ef80['push'](_0x16ef80['shift']());}catch(_0x42e74a){_0x16ef80['push'](_0x16ef80['shift']());}}}(a240_0x1c38,0x43f89));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';function a240_0x2581(_0x56924d,_0xcb9521){_0x56924d=_0x56924d-0x109;const _0x1c38e7=a240_0x1c38();let _0x2581ca=_0x1c38e7[_0x56924d];return _0x2581ca;}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';function a240_0x1c38(){const _0x14d1df=['description','mybatisXml','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','lastSync','trim','Select\x20the\x20local\x20SQL\x20mode:','\x20\x20SELECT\x201\x20AS\x20id','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','toISOString','sqlCode','SQL\x20name:','join','new','Target\x20database\x20ID','4802841Chipwu','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRoot','nonInteractive','File\x20already\x20exists:\x20','map','8iekwLc','dbId\x20cannot\x20be\x20empty','str','sql','/smartapi/custom/saveUserCustomSql','utf8','1941024matMEI','validation','Target\x20database\x20dbId:','✎\x20Enter\x20dbId\x20manually','stringify','POST','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name\x20cannot\x20be\x20empty','sqlRootDir','Local\x20SQL\x20file\x20mode','3BXGRNc','mode','catch','2cicmml','flagMissing','parse','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','string','2261707evtSjg','lockFilePath','dbId','name','1610440FpyuMQ','db-id','length','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqls','flag','Created\x20SQL\x20query\x20','96092aazcpe','1195275CKyvzA','SELECT\x201\x20AS\x20id;','Select\x20the\x20target\x20database:','isFinite','number','__manual__','sqlName','dbName','appCode','309631VeWsbT'];a240_0x1c38=function(){return _0x14d1df;};return a240_0x1c38();}import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2aab86){const _0x8e1ab4=a240_0x2581;if(_0x2aab86===_0x8e1ab4(0x11d))return[_0x8e1ab4(0x146),_0x8e1ab4(0x122),'</select>',''][_0x8e1ab4(0x127)]('\x0a');return[_0x8e1ab4(0x113),''][_0x8e1ab4(0x127)]('\x0a');}export const sqlCreate={'service':a240_0x248308(0x133),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':'write','flags':[{'name':a240_0x248308(0x109),'type':a240_0x248308(0x147),'description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':'number','description':a240_0x248308(0x129)},{'name':a240_0x248308(0x141),'type':a240_0x248308(0x147),'enum':[a240_0x248308(0x133),a240_0x248308(0x11d)],'description':a240_0x248308(0x13f)}],async 'validate'(_0x2e7f89){const _0x1cfcc9=a240_0x248308;if(!_0x2e7f89[_0x1cfcc9(0x12d)])return;if(!_0x2e7f89[_0x1cfcc9(0x132)]('name')['trim']())throw CliErrors[_0x1cfcc9(0x144)](_0x1cfcc9(0x109),_0x1cfcc9(0x13c));const _0x350f67=resolveProvidedDbId(_0x2e7f89);if(typeof _0x350f67!==_0x1cfcc9(0x116)||!Number['isFinite'](_0x350f67)||_0x350f67<=0x0)throw CliErrors[_0x1cfcc9(0x144)](_0x1cfcc9(0x10b),_0x1cfcc9(0x10d));if(!_0x2e7f89['str']('mode')['trim']())throw CliErrors['flagMissing'](_0x1cfcc9(0x141),_0x1cfcc9(0x12b));},async 'dryRun'(_0x1b42ba){const _0x57cd80=a240_0x248308,_0xd0924a=loadSqlProjectConfig(_0x1b42ba[_0x57cd80(0x11a)]),{sqlName:_0x3e83b4,dbId:_0x3c0d5e,dbName:_0x589944,mode:_0x1d0712}=await resolveSqlNewInputs(_0x1b42ba),_0x334a49=buildSqlRelativePath('<server-generated-sqlCode>',_0x3e83b4,_0x589944,_0x1d0712,_0x3c0d5e),_0x3e6e52=_0xd0924a['sqlRootDir']+'/'+_0x334a49;return{'method':_0x57cd80(0x13b),'url':_0x57cd80(0x134),'body':{'appCode':_0x1b42ba[_0x57cd80(0x11a)],'sqlName':_0x3e83b4,'dbId':_0x3c0d5e,'mode':_0x1d0712,'localPath':_0x3e6e52},'description':_0x57cd80(0x11e)+_0xd0924a[_0x57cd80(0x13e)]};},async 'execute'(_0x552211){const _0x3561fd=a240_0x248308,_0x2ad92a=loadSqlProjectConfig(_0x552211[_0x3561fd(0x11a)]),{sqlName:_0x59b6ec,dbId:_0xbdba6b,dbName:_0x55309b,mode:_0x49e5b5}=await resolveSqlNewInputs(_0x552211),_0x457b40=generateSqlTemplate(_0x49e5b5),_0x31a14d=await createSqlQuery({'appCode':_0x552211['appCode'],'sqlName':_0x59b6ec,'dbId':_0xbdba6b,'sqlContent':_0x457b40}),_0x13c946=ensureRemoteSqlContent(_0x31a14d),_0x188916=_0x55309b||await getDbName(_0x552211[_0x3561fd(0x11a)],_0xbdba6b)[_0x3561fd(0x142)](()=>undefined),_0x491613=buildSqlRelativePath(_0x31a14d['sqlCode'],_0x31a14d['sqlName'],_0x188916,_0x49e5b5,_0xbdba6b),_0x1f265d=_0x2ad92a['sqlRootDir']+'/'+_0x491613,_0x4df839=buildLocalSqlFileContent({'sqlCode':_0x31a14d['sqlCode'],'sqlName':_0x31a14d[_0x3561fd(0x118)],'dbId':_0x31a14d[_0x3561fd(0x14a)]},_0x13c946,{'dbName':_0x188916,'mode':_0x49e5b5,'syncedAt':new Date()[_0x3561fd(0x124)](),'description':_0x31a14d[_0x3561fd(0x11c)]});if(await fileExists(_0x1f265d))throw CliErrors[_0x3561fd(0x137)](_0x3561fd(0x12e)+_0x1f265d);await ensureParentDirectory(_0x1f265d),await writeFile(_0x1f265d,_0x4df839,_0x3561fd(0x135));const _0x56980e=await readSqlLockFile(_0x2ad92a[_0x3561fd(0x149)]),{lockData:_0x53a4de,appLock:_0x53a09f}=ensureSqlLockScope(_0x56980e??createEmptySqlLock(),_0x2ad92a['appCode'],_0x2ad92a[_0x3561fd(0x12c)],_0x3561fd(0x128));return _0x53a09f[_0x3561fd(0x10e)][_0x31a14d[_0x3561fd(0x125)]]={...buildSqlLockEntry(_0x31a14d,_0x13c946,computeSqlContentHash(_0x4df839),{'dbName':_0x188916}),'path':_0x491613,'mode':_0x49e5b5},_0x53a09f[_0x3561fd(0x11f)]=new Date()[_0x3561fd(0x124)](),await writeSqlLockFile(_0x2ad92a[_0x3561fd(0x149)],_0x53a4de),{'ok':!![],'data':{'id':_0x31a14d['id'],'sqlCode':_0x31a14d[_0x3561fd(0x125)],'sqlName':_0x31a14d[_0x3561fd(0x118)],'dbId':_0x31a14d[_0x3561fd(0x14a)],'path':_0x1f265d,'mode':_0x49e5b5},'message':_0x3561fd(0x110)+_0x31a14d['sqlCode']};}};async function resolveSqlNewInputs(_0x5b2b39){const _0x280733=await resolveSqlNameInput(_0x5b2b39),{dbId:_0xfec08d,dbName:_0x3e9292}=await resolveDbSelection(_0x5b2b39),_0x39520f=await resolveSqlModeInput(_0x5b2b39);return{'sqlName':_0x280733,'dbId':_0xfec08d,'dbName':_0x3e9292,'mode':_0x39520f};}async function resolveSqlNameInput(_0x5632d8){const _0x290860=a240_0x248308,_0x3f1434=_0x5632d8[_0x290860(0x132)](_0x290860(0x109))[_0x290860(0x120)]();if(_0x3f1434)return _0x3f1434;if(_0x5632d8['nonInteractive'])throw CliErrors[_0x290860(0x144)](_0x290860(0x109),_0x290860(0x13c));return(await input({'message':_0x290860(0x126),'validate':_0x5b6aa4=>_0x5b6aa4['trim']()?!![]:_0x290860(0x13d)}))[_0x290860(0x120)]();}async function resolveDbSelection(_0x446575){const _0x55a21d=a240_0x248308,_0x148d78=resolveProvidedDbId(_0x446575);if(typeof _0x148d78===_0x55a21d(0x116)&&Number[_0x55a21d(0x115)](_0x148d78)&&_0x148d78>0x0)return{'dbId':_0x148d78,'dbName':await getDbName(_0x446575[_0x55a21d(0x11a)],_0x148d78)[_0x55a21d(0x142)](()=>undefined)};if(_0x446575['nonInteractive'])throw CliErrors[_0x55a21d(0x144)](_0x55a21d(0x10b),_0x55a21d(0x10d));const _0x46027d=await listDatabases(_0x446575['appCode'])['catch'](()=>[]);if(_0x46027d[_0x55a21d(0x10c)]===0x1)return{'dbId':_0x46027d[0x0]['dbId'],'dbName':_0x46027d[0x0][_0x55a21d(0x119)]};if(_0x46027d['length']>0x1){const _0x55ff8d=await select({'message':_0x55a21d(0x114),'choices':[..._0x46027d[_0x55a21d(0x12f)](_0x3ef65b=>({'name':_0x3ef65b['dbName']+'\x20('+_0x3ef65b['dbId']+')','value':serializeDbSelection(_0x3ef65b)})),{'name':_0x55a21d(0x139),'value':_0x55a21d(0x117)}]});if(_0x55ff8d!==_0x55a21d(0x117))return deserializeDbSelection(_0x55ff8d);}const _0x234948=await input({'message':_0x55a21d(0x138),'validate':_0x41705a=>{const _0xe16e79=_0x55a21d,_0x1cf445=_0x41705a[_0xe16e79(0x120)]();if(!_0x1cf445)return _0xe16e79(0x131);const _0x669518=Number(_0x1cf445);if(!Number['isInteger'](_0x669518)||_0x669518<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x234948[_0x55a21d(0x120)]())};}async function resolveSqlModeInput(_0x297e45){const _0x48d222=a240_0x248308,_0x556778=_0x297e45[_0x48d222(0x132)](_0x48d222(0x141))[_0x48d222(0x120)]();if(_0x556778===_0x48d222(0x133)||_0x556778===_0x48d222(0x11d))return _0x556778;if(_0x297e45[_0x48d222(0x12d)])throw CliErrors[_0x48d222(0x144)](_0x48d222(0x141),_0x48d222(0x12b));return await select({'message':_0x48d222(0x121),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x48d222(0x11d),'description':_0x48d222(0x123)}]});}function serializeDbSelection(_0x308d2a){const _0x96ef52=a240_0x248308;return JSON[_0x96ef52(0x13a)]({'dbId':_0x308d2a['dbId'],'dbName':_0x308d2a[_0x96ef52(0x119)]});}function deserializeDbSelection(_0x4b1a5e){const _0x32b7ec=a240_0x248308;try{const _0x16f227=JSON[_0x32b7ec(0x145)](_0x4b1a5e);if(typeof _0x16f227[_0x32b7ec(0x14a)]===_0x32b7ec(0x116)&&Number[_0x32b7ec(0x115)](_0x16f227['dbId']))return{'dbId':_0x16f227[_0x32b7ec(0x14a)],'dbName':_0x16f227[_0x32b7ec(0x119)]};}catch{}throw CliErrors[_0x32b7ec(0x137)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x4b1a5e);}function resolveProvidedDbId(_0x245d17){const _0x56c889=a240_0x248308,_0x24c608=_0x245d17[_0x56c889(0x10f)](_0x56c889(0x10b));if(typeof _0x24c608===_0x56c889(0x116)&&Number[_0x56c889(0x115)](_0x24c608))return _0x24c608;return undefined;}
|
|
1
|
+
const a247_0x42abe5=a247_0x3a28;(function(_0x141233,_0x27231c){const _0x52ffff=a247_0x3a28,_0x40aa71=_0x141233();while(!![]){try{const _0xfb596f=parseInt(_0x52ffff(0xb3))/0x1*(parseInt(_0x52ffff(0x99))/0x2)+-parseInt(_0x52ffff(0xbf))/0x3+-parseInt(_0x52ffff(0xc4))/0x4+parseInt(_0x52ffff(0xda))/0x5+parseInt(_0x52ffff(0x98))/0x6*(-parseInt(_0x52ffff(0xc9))/0x7)+-parseInt(_0x52ffff(0xd0))/0x8*(parseInt(_0x52ffff(0xba))/0x9)+parseInt(_0x52ffff(0xae))/0xa;if(_0xfb596f===_0x27231c)break;else _0x40aa71['push'](_0x40aa71['shift']());}catch(_0xc3a2e2){_0x40aa71['push'](_0x40aa71['shift']());}}}(a247_0x5b29,0x992f5));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x123170){const _0x351872=a247_0x3a28;if(_0x123170==='mybatisXml')return[_0x351872(0xbc),_0x351872(0xdc),_0x351872(0xab),''][_0x351872(0xbe)]('\x0a');return[_0x351872(0xbb),''][_0x351872(0xbe)]('\x0a');}export const sqlCreate={'service':'sql','command':a247_0x42abe5(0xa4),'description':a247_0x42abe5(0xd6),'risk':a247_0x42abe5(0xb6),'flags':[{'name':a247_0x42abe5(0xcc),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':a247_0x42abe5(0xd5),'description':'Target\x20database\x20ID'},{'name':a247_0x42abe5(0xca),'type':a247_0x42abe5(0xcb),'enum':['sql',a247_0x42abe5(0xa5)],'description':a247_0x42abe5(0xa0)}],async 'validate'(_0x2e237f){const _0x4c9f7a=a247_0x42abe5;if(!_0x2e237f[_0x4c9f7a(0x9f)])return;if(!_0x2e237f[_0x4c9f7a(0xb4)](_0x4c9f7a(0xcc))['trim']())throw CliErrors['flagMissing'](_0x4c9f7a(0xcc),_0x4c9f7a(0xdb));const _0x104914=resolveProvidedDbId(_0x2e237f);if(typeof _0x104914!=='number'||!Number[_0x4c9f7a(0xa1)](_0x104914)||_0x104914<=0x0)throw CliErrors[_0x4c9f7a(0xa8)](_0x4c9f7a(0xb0),_0x4c9f7a(0xd2));if(!_0x2e237f['str']('mode')['trim']())throw CliErrors['flagMissing'](_0x4c9f7a(0xca),_0x4c9f7a(0xd9));},async 'dryRun'(_0x3935bf){const _0x4965c8=a247_0x42abe5,_0x106f97=loadSqlProjectConfig(_0x3935bf[_0x4965c8(0xa6)]),{sqlName:_0x5e9a45,dbId:_0x3c45a8,dbName:_0x45e1ac,mode:_0xd7c730}=await resolveSqlNewInputs(_0x3935bf),_0x5ca3d8=buildSqlRelativePath(_0x4965c8(0x9a),_0x5e9a45,_0x45e1ac,_0xd7c730,_0x3c45a8),_0x814565=_0x106f97['sqlRootDir']+'/'+_0x5ca3d8;return{'method':_0x4965c8(0xd4),'url':_0x4965c8(0xaf),'body':{'appCode':_0x3935bf[_0x4965c8(0xa6)],'sqlName':_0x5e9a45,'dbId':_0x3c45a8,'mode':_0xd7c730,'localPath':_0x814565},'description':_0x4965c8(0xb9)+_0x106f97[_0x4965c8(0xb7)]};},async 'execute'(_0x21b42a){const _0x5b2b1c=a247_0x42abe5,_0x4088fa=loadSqlProjectConfig(_0x21b42a[_0x5b2b1c(0xa6)]),{sqlName:_0x322b3a,dbId:_0x36f515,dbName:_0x1b41bd,mode:_0x3a6fc6}=await resolveSqlNewInputs(_0x21b42a),_0x2a68c0=generateSqlTemplate(_0x3a6fc6),_0x27c501=await createSqlQuery({'appCode':_0x21b42a[_0x5b2b1c(0xa6)],'sqlName':_0x322b3a,'dbId':_0x36f515,'sqlContent':_0x2a68c0}),_0x3ddaa2=ensureRemoteSqlContent(_0x27c501),_0x552dd0=_0x1b41bd||await getDbName(_0x21b42a[_0x5b2b1c(0xa6)],_0x36f515)[_0x5b2b1c(0x9c)](()=>undefined),_0x176834=buildSqlRelativePath(_0x27c501[_0x5b2b1c(0xad)],_0x27c501[_0x5b2b1c(0xa2)],_0x552dd0,_0x3a6fc6,_0x36f515),_0x809c0c=_0x4088fa[_0x5b2b1c(0xb7)]+'/'+_0x176834,_0x5dbe62=buildLocalSqlFileContent({'sqlCode':_0x27c501[_0x5b2b1c(0xad)],'sqlName':_0x27c501[_0x5b2b1c(0xa2)],'dbId':_0x27c501['dbId']},_0x3ddaa2,{'dbName':_0x552dd0,'mode':_0x3a6fc6,'syncedAt':new Date()[_0x5b2b1c(0xc7)](),'description':_0x27c501[_0x5b2b1c(0xc3)]});if(await fileExists(_0x809c0c))throw CliErrors[_0x5b2b1c(0xb8)](_0x5b2b1c(0xaa)+_0x809c0c);await ensureParentDirectory(_0x809c0c),await writeFile(_0x809c0c,_0x5dbe62,_0x5b2b1c(0xcf));const _0xddd362=await readSqlLockFile(_0x4088fa['lockFilePath']),{lockData:_0x4c1507,appLock:_0x211888}=ensureSqlLockScope(_0xddd362??createEmptySqlLock(),_0x4088fa[_0x5b2b1c(0xa6)],_0x4088fa['sqlRoot'],_0x5b2b1c(0xd8));return _0x211888['sqls'][_0x27c501['sqlCode']]={...buildSqlLockEntry(_0x27c501,_0x3ddaa2,computeSqlContentHash(_0x5dbe62),{'dbName':_0x552dd0}),'path':_0x176834,'mode':_0x3a6fc6},_0x211888[_0x5b2b1c(0xc2)]=new Date()[_0x5b2b1c(0xc7)](),await writeSqlLockFile(_0x4088fa[_0x5b2b1c(0xc8)],_0x4c1507),{'ok':!![],'data':{'id':_0x27c501['id'],'sqlCode':_0x27c501['sqlCode'],'sqlName':_0x27c501[_0x5b2b1c(0xa2)],'dbId':_0x27c501[_0x5b2b1c(0xac)],'path':_0x809c0c,'mode':_0x3a6fc6},'message':_0x5b2b1c(0x9e)+_0x27c501[_0x5b2b1c(0xad)]};}};function a247_0x3a28(_0xaf427c,_0x1e584c){_0xaf427c=_0xaf427c-0x95;const _0x5b29bc=a247_0x5b29();let _0x3a283b=_0x5b29bc[_0xaf427c];return _0x3a283b;}function a247_0x5b29(){const _0x54fe2f=['For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','Created\x20SQL\x20query\x20','nonInteractive','Local\x20SQL\x20file\x20mode','isFinite','sqlName','SQL\x20name:','create','mybatisXml','appCode','Target\x20database\x20dbId:','flagMissing','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','File\x20already\x20exists:\x20','</select>','dbId','sqlCode','8992700cVoxza','/smartapi/custom/saveUserCustomSql','db-id','Select\x20the\x20target\x20database:','length','6HsieVn','str','parse','write','sqlRootDir','validation','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','3294xrQygs','SELECT\x201\x20AS\x20id;','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','flag','join','1904820YagBhx','dbName','✎\x20Enter\x20dbId\x20manually','lastSync','description','478244ZqWVuM','sql','isInteger','toISOString','lockFilePath','154119GDfTjF','mode','string','name','dbId\x20must\x20be\x20a\x20positive\x20integer','trim','utf8','10208CFbRcf','__manual__','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','MyBatis\x20XML\x20(mybatisXml)','POST','number','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Invalid\x20database\x20selection\x20payload:\x20','new','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','1804470eZYRdO','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','\x20\x20SELECT\x201\x20AS\x20id','dbId\x20cannot\x20be\x20empty','SQL\x20name\x20cannot\x20be\x20empty','map','180HcgjCq','416436nvVQJM','<server-generated-sqlCode>','Select\x20the\x20local\x20SQL\x20mode:','catch'];a247_0x5b29=function(){return _0x54fe2f;};return a247_0x5b29();}async function resolveSqlNewInputs(_0x477db1){const _0xc6e290=await resolveSqlNameInput(_0x477db1),{dbId:_0x235da4,dbName:_0x25b2d0}=await resolveDbSelection(_0x477db1),_0x3539c7=await resolveSqlModeInput(_0x477db1);return{'sqlName':_0xc6e290,'dbId':_0x235da4,'dbName':_0x25b2d0,'mode':_0x3539c7};}async function resolveSqlNameInput(_0x7e3fad){const _0x1c9cc2=a247_0x42abe5,_0x2c64e8=_0x7e3fad[_0x1c9cc2(0xb4)](_0x1c9cc2(0xcc))[_0x1c9cc2(0xce)]();if(_0x2c64e8)return _0x2c64e8;if(_0x7e3fad[_0x1c9cc2(0x9f)])throw CliErrors[_0x1c9cc2(0xa8)](_0x1c9cc2(0xcc),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x1c9cc2(0xa3),'validate':_0x1ad88f=>_0x1ad88f[_0x1c9cc2(0xce)]()?!![]:_0x1c9cc2(0x96)}))[_0x1c9cc2(0xce)]();}async function resolveDbSelection(_0x18fa5b){const _0x5e49f3=a247_0x42abe5,_0x4c361a=resolveProvidedDbId(_0x18fa5b);if(typeof _0x4c361a==='number'&&Number[_0x5e49f3(0xa1)](_0x4c361a)&&_0x4c361a>0x0)return{'dbId':_0x4c361a,'dbName':await getDbName(_0x18fa5b[_0x5e49f3(0xa6)],_0x4c361a)['catch'](()=>undefined)};if(_0x18fa5b[_0x5e49f3(0x9f)])throw CliErrors[_0x5e49f3(0xa8)](_0x5e49f3(0xb0),_0x5e49f3(0xd2));const _0x2c3938=await listDatabases(_0x18fa5b[_0x5e49f3(0xa6)])[_0x5e49f3(0x9c)](()=>[]);if(_0x2c3938[_0x5e49f3(0xb2)]===0x1)return{'dbId':_0x2c3938[0x0][_0x5e49f3(0xac)],'dbName':_0x2c3938[0x0][_0x5e49f3(0xc0)]};if(_0x2c3938['length']>0x1){const _0xa9d820=await select({'message':_0x5e49f3(0xb1),'choices':[..._0x2c3938[_0x5e49f3(0x97)](_0x56b973=>({'name':_0x56b973['dbName']+'\x20('+_0x56b973[_0x5e49f3(0xac)]+')','value':serializeDbSelection(_0x56b973)})),{'name':_0x5e49f3(0xc1),'value':'__manual__'}]});if(_0xa9d820!==_0x5e49f3(0xd1))return deserializeDbSelection(_0xa9d820);}const _0x249455=await input({'message':_0x5e49f3(0xa7),'validate':_0x228c33=>{const _0x46ba7d=_0x5e49f3,_0x250973=_0x228c33[_0x46ba7d(0xce)]();if(!_0x250973)return _0x46ba7d(0x95);const _0x3cf7e9=Number(_0x250973);if(!Number[_0x46ba7d(0xc6)](_0x3cf7e9)||_0x3cf7e9<=0x0)return _0x46ba7d(0xcd);return!![];}});return{'dbId':Number(_0x249455['trim']())};}async function resolveSqlModeInput(_0x1e3455){const _0x521f80=a247_0x42abe5,_0x14c0ca=_0x1e3455['str'](_0x521f80(0xca))[_0x521f80(0xce)]();if(_0x14c0ca===_0x521f80(0xc5)||_0x14c0ca===_0x521f80(0xa5))return _0x14c0ca;if(_0x1e3455[_0x521f80(0x9f)])throw CliErrors[_0x521f80(0xa8)](_0x521f80(0xca),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x521f80(0x9b),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x521f80(0xc5),'description':_0x521f80(0x9d)},{'name':_0x521f80(0xd3),'value':_0x521f80(0xa5),'description':_0x521f80(0xa9)}]});}function serializeDbSelection(_0x5a02a4){const _0x178eb6=a247_0x42abe5;return JSON['stringify']({'dbId':_0x5a02a4[_0x178eb6(0xac)],'dbName':_0x5a02a4[_0x178eb6(0xc0)]});}function deserializeDbSelection(_0x3da69e){const _0x23e02d=a247_0x42abe5;try{const _0x26806e=JSON[_0x23e02d(0xb5)](_0x3da69e);if(typeof _0x26806e['dbId']===_0x23e02d(0xd5)&&Number['isFinite'](_0x26806e[_0x23e02d(0xac)]))return{'dbId':_0x26806e[_0x23e02d(0xac)],'dbName':_0x26806e[_0x23e02d(0xc0)]};}catch{}throw CliErrors[_0x23e02d(0xb8)](_0x23e02d(0xd7)+_0x3da69e);}function resolveProvidedDbId(_0x41619f){const _0x5474d2=a247_0x42abe5,_0x2e83fa=_0x41619f[_0x5474d2(0xbd)](_0x5474d2(0xb0));if(typeof _0x2e83fa===_0x5474d2(0xd5)&&Number[_0x5474d2(0xa1)](_0x2e83fa))return _0x2e83fa;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0xe7b3f0=a248_0xec28;(function(_0x253c04,_0x1c5694){const _0x590a17=a248_0xec28,_0x2e40ce=_0x253c04();while(!![]){try{const _0xf8005b=-parseInt(_0x590a17(0x1e5))/0x1*(-parseInt(_0x590a17(0x1e4))/0x2)+parseInt(_0x590a17(0x1dc))/0x3*(-parseInt(_0x590a17(0x1e8))/0x4)+-parseInt(_0x590a17(0x1e0))/0x5+parseInt(_0x590a17(0x1ec))/0x6*(-parseInt(_0x590a17(0x1e7))/0x7)+-parseInt(_0x590a17(0x1df))/0x8+-parseInt(_0x590a17(0x1e9))/0x9+parseInt(_0x590a17(0x1ed))/0xa;if(_0xf8005b===_0x1c5694)break;else _0x2e40ce['push'](_0x2e40ce['shift']());}catch(_0x355576){_0x2e40ce['push'](_0x2e40ce['shift']());}}}(a248_0x2c36,0xafeca));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';function a248_0xec28(_0xe85000,_0x3b1cdc){_0xe85000=_0xe85000-0x1dc;const _0x2c36d4=a248_0x2c36();let _0xec2824=_0x2c36d4[_0xe85000];return _0xec2824;}import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a248_0xe7b3f0(0x1eb),'command':a248_0xe7b3f0(0x1fc),'description':a248_0xe7b3f0(0x1e2),'risk':a248_0xe7b3f0(0x1f6),'flags':[SQLCODE_FLAG],async 'validate'(_0x13fe09){const _0x248e1c=a248_0xe7b3f0,_0x114abf=loadSqlProjectConfig(_0x13fe09['appCode']),_0x35bb99=await readSqlLockFile(_0x114abf[_0x248e1c(0x1fe)]);if(!_0x35bb99)throw CliErrors[_0x248e1c(0x1f0)](_0x248e1c(0x1f8));},async 'dryRun'(_0x36eecf){const _0x434a89=a248_0xe7b3f0,_0xbcbbff=loadSqlProjectConfig(_0x36eecf[_0x434a89(0x1ff)]),_0x45ff81=await readSqlLockFile(_0xbcbbff[_0x434a89(0x1fe)]);if(!_0x45ff81)throw CliErrors[_0x434a89(0x1f0)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x42cf91}=ensureSqlLockScope(_0x45ff81,_0x36eecf[_0x434a89(0x1ff)],_0xbcbbff[_0x434a89(0x1ef)],_0x434a89(0x1fc)),_0x25ae5a=_0x36eecf[_0x434a89(0x1f1)](_0x434a89(0x1f3)),_0x239971=_0x42cf91[_0x434a89(0x1fa)][_0x25ae5a];if(!_0x239971)throw CliErrors[_0x434a89(0x1f0)](_0x434a89(0x1ea)+_0x25ae5a+'\x22.');return{'method':_0x434a89(0x1f5),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x25ae5a,'id':_0x239971[_0x434a89(0x1e6)],'localPath':resolveLocalSqlFilePath(_0xbcbbff,_0x25ae5a,_0x239971)},'description':'Would\x20delete\x20SQL\x20'+_0x25ae5a+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0xbcbbff['trashDir']};},async 'execute'(_0x4047c0){const _0x4f0710=a248_0xe7b3f0,_0x2eb4a6=loadSqlProjectConfig(_0x4047c0[_0x4f0710(0x1ff)]),_0x3d0ed6=await readSqlLockFile(_0x2eb4a6[_0x4f0710(0x1fe)]);if(!_0x3d0ed6)throw CliErrors['validation'](_0x4f0710(0x1fd));const {lockData:_0x37506a,appLock:_0x240915}=ensureSqlLockScope(_0x3d0ed6,_0x4047c0[_0x4f0710(0x1ff)],_0x2eb4a6[_0x4f0710(0x1ef)],_0x4f0710(0x1fc)),_0x3da983=_0x4047c0[_0x4f0710(0x1f1)](_0x4f0710(0x1f3)),_0x3dd0cc=_0x240915['sqls'][_0x3da983];if(!_0x3dd0cc)throw CliErrors[_0x4f0710(0x1f0)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3da983+'\x22.');await deleteSqlQuery({'id':_0x3dd0cc[_0x4f0710(0x1e6)],'sqlCode':_0x3da983}),_0x240915[_0x4f0710(0x1fa)]=Object[_0x4f0710(0x1f2)](Object['entries'](_0x240915[_0x4f0710(0x1fa)])['filter'](([_0x283c25])=>_0x283c25!==_0x3da983)),_0x240915[_0x4f0710(0x1dd)]=new Date()[_0x4f0710(0x1ee)](),await writeSqlLockFile(_0x2eb4a6[_0x4f0710(0x1fe)],_0x37506a);const _0x33988b=resolveLocalSqlFilePath(_0x2eb4a6,_0x3da983,_0x3dd0cc);let _0x524b41;await fileExists(_0x33988b)&&(_0x524b41=await moveToTrash(_0x2eb4a6[_0x4f0710(0x1de)],_0x2eb4a6[_0x4f0710(0x1f7)],_0x33988b),await cleanupEmptyDirectories(dirname(_0x33988b),_0x2eb4a6['sqlRootDir']));const _0x3fddfe={'deleted':_0x3da983,'remoteId':_0x3dd0cc[_0x4f0710(0x1e6)]};if(_0x524b41)_0x3fddfe[_0x4f0710(0x1f4)]=_0x524b41;return{'ok':!![],'data':_0x3fddfe,'message':_0x4f0710(0x1fb)+_0x3da983+(_0x524b41?_0x4f0710(0x1e1):'')};}};function a248_0x2c36(){const _0x250b42=['trashedTo','POST','high-risk-write','trashDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','replace','sqls','Deleted\x20','delete','SQL\x20lock\x20file\x20not\x20found.','lockFilePath','appCode','1515tUWDRU','lastSync','projectRoot','4382144OFRuhe','5666515nvNdgO','\x20(local\x20file\x20moved\x20to\x20trash)','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','startsWith','4EsfJnW','625398ZhnqwO','remoteId','202265VaqLkc','10436QCstsy','11860578hJPCiw','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sql','90spyFqo','42196730uYonej','toISOString','sqlRoot','validation','str','fromEntries','sqlcode'];a248_0x2c36=function(){return _0x250b42;};return a248_0x2c36();}async function moveToTrash(_0xe0c8ac,_0x5db0e1,_0x41fb18){const _0x212018=a248_0xe7b3f0,_0xa6d585=new Date()[_0x212018(0x1ee)]()[_0x212018(0x1f9)](/[:.]/g,'-'),_0x5f417a=relative(_0xe0c8ac,_0x41fb18),_0x4e6144=join(_0x5db0e1,_0xa6d585,_0x5f417a);return await mkdir(dirname(_0x4e6144),{'recursive':!![]}),await rename(_0x41fb18,_0x4e6144),_0x4e6144;}async function cleanupEmptyDirectories(_0x113030,_0x2da003){const _0x7a7a40=a248_0xe7b3f0;let _0x1d3447=resolve(_0x113030);const _0x45c6a1=resolve(_0x2da003);while(_0x1d3447[_0x7a7a40(0x1e3)](''+_0x45c6a1+sep)||_0x1d3447===_0x45c6a1){if(_0x1d3447===_0x45c6a1)return;try{const _0x3edbb0=await readdir(_0x1d3447);if(_0x3edbb0['length']>0x0)return;await rmdir(_0x1d3447);}catch{return;}_0x1d3447=dirname(_0x1d3447);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a249_0x3bc68b=a249_0x118e;function a249_0x36f4(){const _0x3841df=['str','boolean','7762216HPRawW','113576DtPDCl','657UlpqML','sqlCode','bool','detail','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','appCode','Return\x20full\x20raw\x20SQL\x20query\x20object','verbose','18qhAhyJ','read','sqlName','946122XgKqZV','2404490jnRlqO','8OLFqqt','214484uPykpb','1235878RKiOZt','sqlContent','8AiMQcv','727880yTWVVv','dbId'];a249_0x36f4=function(){return _0x3841df;};return a249_0x36f4();}function a249_0x118e(_0x15279b,_0x299b36){_0x15279b=_0x15279b-0x1c5;const _0x36f425=a249_0x36f4();let _0x118e2=_0x36f425[_0x15279b];return _0x118e2;}(function(_0x3a651e,_0x2e8f1d){const _0x53ce38=a249_0x118e,_0x23f9cc=_0x3a651e();while(!![]){try{const _0x1e5180=-parseInt(_0x53ce38(0x1c5))/0x1*(parseInt(_0x53ce38(0x1dc))/0x2)+-parseInt(_0x53ce38(0x1da))/0x3*(-parseInt(_0x53ce38(0x1c8))/0x4)+-parseInt(_0x53ce38(0x1db))/0x5+-parseInt(_0x53ce38(0x1d7))/0x6*(parseInt(_0x53ce38(0x1c6))/0x7)+parseInt(_0x53ce38(0x1ce))/0x8*(parseInt(_0x53ce38(0x1cf))/0x9)+parseInt(_0x53ce38(0x1c9))/0xa+parseInt(_0x53ce38(0x1cd))/0xb;if(_0x1e5180===_0x2e8f1d)break;else _0x23f9cc['push'](_0x23f9cc['shift']());}catch(_0x265da6){_0x23f9cc['push'](_0x23f9cc['shift']());}}}(a249_0x36f4,0x8ce35));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a249_0x3bc68b(0x1d2),'description':a249_0x3bc68b(0x1d3),'risk':a249_0x3bc68b(0x1d8),'flags':[SQLCODE_FLAG,{'name':a249_0x3bc68b(0x1d6),'type':a249_0x3bc68b(0x1cc),'description':a249_0x3bc68b(0x1d5)}],async 'execute'(_0x27e8cf){const _0x18b117=a249_0x3bc68b,_0x1b3ff0=await getSqlQueryInfo(_0x27e8cf['appCode'],_0x27e8cf[_0x18b117(0x1cb)]('sqlcode')),_0x16bfe4=_0x27e8cf[_0x18b117(0x1d1)](_0x18b117(0x1d6));if(_0x16bfe4)return{'ok':!![],'data':_0x1b3ff0};const _0x3fbe41=_0x1b3ff0[_0x18b117(0x1ca)]?await getDbName(_0x27e8cf[_0x18b117(0x1d4)],_0x1b3ff0[_0x18b117(0x1ca)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1b3ff0[_0x18b117(0x1d0)],'sqlName':_0x1b3ff0[_0x18b117(0x1d9)],'db':_0x3fbe41?_0x3fbe41+'\x20('+_0x1b3ff0[_0x18b117(0x1ca)]+')':_0x1b3ff0['dbId']??'','description':_0x1b3ff0['description']??'','sqlContent':_0x1b3ff0[_0x18b117(0x1c7)]??''}};}};
|