@lovrabet/rabetbase-cli 2.5.3-beta.1 → 2.5.3-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.d.ts +22 -0
- package/lib/api/api-group.js +1 -0
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.d.ts +18 -2
- 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.d.ts +11 -0
- package/lib/api/legacy-api-file.js +1 -0
- package/lib/api/model-registry-file.d.ts +36 -0
- package/lib/api/model-registry-file.js +1 -0
- package/lib/api/model-registry-scaffold.d.ts +7 -0
- package/lib/api/model-registry-scaffold.js +1 -0
- package/lib/api/model-source.d.ts +6 -0
- package/lib/api/model-source.js +1 -0
- 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/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.d.ts +7 -0
- package/lib/commands/bff/logs.js +1 -0
- 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.d.ts +7 -0
- 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.d.ts +21 -0
- package/lib/commands/dataset/batch-design.js +1 -0
- 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.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-create.js +1 -0
- package/lib/commands/dataset/cross-relation-delete.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-delete.js +1 -0
- package/lib/commands/dataset/cross-relation-list.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-list.js +1 -0
- package/lib/commands/dataset/cross-relation-shared.d.ts +190 -0
- package/lib/commands/dataset/cross-relation-shared.js +1 -0
- package/lib/commands/dataset/cross-relation-update.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-update.js +1 -0
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/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.d.ts +2 -0
- package/lib/commands/flow/create.js +1 -0
- package/lib/commands/flow/detail.d.ts +2 -0
- package/lib/commands/flow/detail.js +1 -0
- package/lib/commands/flow/index.d.ts +3 -0
- package/lib/commands/flow/index.js +1 -0
- package/lib/commands/flow/list.d.ts +2 -0
- package/lib/commands/flow/list.js +1 -0
- package/lib/commands/flow/publish.d.ts +2 -0
- package/lib/commands/flow/publish.js +1 -0
- package/lib/commands/flow/runtime-resources-shared.d.ts +40 -0
- package/lib/commands/flow/runtime-resources-shared.js +1 -0
- package/lib/commands/flow/runtime-role-list.d.ts +2 -0
- package/lib/commands/flow/runtime-role-list.js +1 -0
- package/lib/commands/flow/runtime-role-user-list.d.ts +2 -0
- package/lib/commands/flow/runtime-role-user-list.js +1 -0
- package/lib/commands/flow/runtime-user-search.d.ts +2 -0
- package/lib/commands/flow/runtime-user-search.js +1 -0
- package/lib/commands/flow/shared.d.ts +41 -0
- package/lib/commands/flow/shared.js +1 -0
- package/lib/commands/flow/update.d.ts +2 -0
- package/lib/commands/flow/update.js +1 -0
- package/lib/commands/flow/validate.d.ts +3 -0
- package/lib/commands/flow/validate.js +1 -0
- 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/service.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/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.d.ts +28 -0
- package/lib/commands/project/api-architecture-upgrade.js +1 -0
- 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.d.ts +30 -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/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.d.ts +2 -0
- 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.d.ts +2 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.d.ts +13 -17
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +176 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.d.ts +55 -0
- package/lib/core/bff/hook-directory.js +1 -0
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/types.d.ts +15 -0
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.d.ts +41 -0
- package/lib/core/cross-db-relation.js +1 -0
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.d.ts +628 -0
- package/lib/core/flow-config.js +1 -0
- 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.d.ts +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/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.d.ts +0 -10
- 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/types/index.d.ts +11 -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.d.ts +12 -0
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +4 -1
- package/skills/rabetbase/SKILL.md +31 -9
- package/skills/rabetbase/guides/approval-flow-development-workflow.md +137 -0
- package/skills/rabetbase/guides/backend-function.md +19 -9
- package/skills/rabetbase/guides/bff-creation-workflow.md +10 -1
- package/skills/rabetbase/guides/conflict-detection.md +2 -0
- package/skills/rabetbase/guides/sdk-client-generation.md +112 -60
- package/skills/rabetbase/guides/typescript-sdk.md +9 -0
- package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +290 -0
- package/skills/rabetbase/references/rabetbase-api-pull.md +30 -19
- package/skills/rabetbase/references/rabetbase-app-list.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-create.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-logs.md +47 -0
- package/skills/rabetbase/references/rabetbase-bff-pull.md +7 -3
- package/skills/rabetbase/references/rabetbase-bff-push.md +10 -2
- package/skills/rabetbase/references/rabetbase-config.md +2 -1
- package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +60 -0
- package/skills/rabetbase/references/rabetbase-dataset-generate.md +52 -2
- package/skills/rabetbase/references/rabetbase-flow-commands.md +86 -0
- package/skills/rabetbase/references/rabetbase-flow-resources.md +83 -0
- package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +25 -0
- package/skills/rabetbase/references/rabetbase-instant-api-policy.md +103 -11
- package/skills/rabetbase/references/rabetbase-notification-config-list.md +17 -0
- package/skills/rabetbase/references/rabetbase-project-create.md +3 -3
- package/skills/rabetbase/references/rabetbase-project-upgrade.md +24 -13
- package/skills/rabetbase.manifest.json +10 -3
- package/templates/README.md +16 -4
- package/templates/generate-api/model-runtime.ts.tpl +101 -0
- package/templates/generate-api/profile-api.ts.tpl +21 -0
- package/templates/generate-api/profile-client.ts.tpl +14 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a218_0x31cd80=a218_0xccb8;(function(_0x5e69ae,_0x128491){const _0x5e2bb7=a218_0xccb8,_0x552fd9=_0x5e69ae();while(!![]){try{const _0x206644=-parseInt(_0x5e2bb7(0x1b3))/0x1*(-parseInt(_0x5e2bb7(0x19e))/0x2)+-parseInt(_0x5e2bb7(0x1a0))/0x3*(parseInt(_0x5e2bb7(0x19a))/0x4)+parseInt(_0x5e2bb7(0x1a4))/0x5*(-parseInt(_0x5e2bb7(0x1ad))/0x6)+parseInt(_0x5e2bb7(0x195))/0x7+parseInt(_0x5e2bb7(0x1a5))/0x8*(parseInt(_0x5e2bb7(0x197))/0x9)+parseInt(_0x5e2bb7(0x1b0))/0xa*(-parseInt(_0x5e2bb7(0x1a6))/0xb)+parseInt(_0x5e2bb7(0x1b4))/0xc;if(_0x206644===_0x128491)break;else _0x552fd9['push'](_0x552fd9['shift']());}catch(_0x3c75a5){_0x552fd9['push'](_0x552fd9['shift']());}}}(a218_0x1eee,0xadf2a));import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a218_0xccb8(_0x3a2d02,_0x5839f3){_0x3a2d02=_0x3a2d02-0x192;const _0x1eee43=a218_0x1eee();let _0xccb8f2=_0x1eee43[_0x3a2d02];return _0xccb8f2;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=[a218_0x31cd80(0x199),a218_0x31cd80(0x19f),a218_0x31cd80(0x1ac),a218_0x31cd80(0x1a3)];export const roleList={'service':a218_0x31cd80(0x19c),'command':'list','description':a218_0x31cd80(0x198),'risk':a218_0x31cd80(0x1ab),'flags':[APPCODE_FLAG_OPTIONAL,{'name':a218_0x31cd80(0x1a8),'type':a218_0x31cd80(0x1b9),'required':![],'description':a218_0x31cd80(0x19b),'enum':ROLE_TYPES},{'name':a218_0x31cd80(0x1af),'type':'number','description':a218_0x31cd80(0x196),'default':0x1},{'name':a218_0x31cd80(0x1b7),'type':a218_0x31cd80(0x1b6),'description':'Page\x20size\x20(1-100)','default':0x64}],async 'validate'(_0x237fb6){const _0x30ab30=a218_0x31cd80,_0x3de32c=_0x237fb6[_0x30ab30(0x1a7)](_0x30ab30(0x1a8))[_0x30ab30(0x193)]();if(_0x3de32c&&!ROLE_TYPES[_0x30ab30(0x1b5)](_0x3de32c[_0x30ab30(0x192)]()))throw CliErrors[_0x30ab30(0x19d)](_0x30ab30(0x1ae)+_0x3de32c+'\x22.',_0x30ab30(0x1b2)+ROLE_TYPES['join'](',\x20')+'.');const _0x2291e5=_0x237fb6[_0x30ab30(0x1b8)](_0x30ab30(0x1af),0x1),_0x5f276c=_0x237fb6['num'](_0x30ab30(0x1b7),0x64);if(_0x2291e5<0x1)throw CliErrors[_0x30ab30(0x19d)]('--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.');if(_0x5f276c<0x1||_0x5f276c>0x64)throw CliErrors['validation']('--pagesize\x20must\x20be\x20between\x201\x20and\x20100.');},async 'execute'(_0x190db2){const _0xd40a0e=a218_0x31cd80,_0x14bd49=_0x190db2[_0xd40a0e(0x1b8)]('page',0x1)||0x1,_0x526710=_0x190db2[_0xd40a0e(0x1b8)]('pagesize',0x64)||0x64,_0xcc3975=_0x190db2[_0xd40a0e(0x1a7)]('type')[_0xd40a0e(0x193)]()[_0xd40a0e(0x192)](),{items:_0x1b7fcb,paging:_0x3e5053}=await listAppRoles(_0x190db2['appCode'],{'currentPage':_0x14bd49,'pageSize':_0x526710}),_0x3d72ea=_0xcc3975?_0x1b7fcb[_0xd40a0e(0x1a9)](_0x58c5da=>_0x58c5da[_0xd40a0e(0x1aa)]===_0xcc3975):_0x1b7fcb,_0x222ddb=_0x3d72ea[_0xd40a0e(0x1b1)](projectRole);return{'ok':!![],'data':{'scope':_0xd40a0e(0x194),'roles':_0x222ddb,'paging':_0x3e5053},'message':'Found\x20'+_0x222ddb[_0xd40a0e(0x1a1)]+_0xd40a0e(0x1a2)};}};function a218_0x1eee(){const _0x5ec32f=['318451ybJLmC','Page\x20index\x20(1-based)','189yHEuqM','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','ADMIN','8XKwIQp','Filter\x20by\x20role\x20type','role','validation','612rcoZZS','DEV','976863miJciP','length','\x20role(s)','CUSTOM','489665lIkGZr','395704FlAaVq','11RPfaux','str','type','filter','roleType','read','OWNER','6HZxwPD','Invalid\x20--type\x20\x22','page','5663010DZNZvr','map','Use\x20one\x20of:\x20','969ZjgZGF','7766832plFHYj','includes','number','pagesize','num','string','toUpperCase','trim','dev'];a218_0x1eee=function(){return _0x5ec32f;};return a218_0x1eee();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a194_0x5a2978=a194_0x4732;(function(_0x4df329,_0x1f1faa){const _0x4e4bc9=a194_0x4732,_0x5f2d08=_0x4df329();while(!![]){try{const _0x16123a=parseInt(_0x4e4bc9(0xf8))/0x1*(parseInt(_0x4e4bc9(0xfe))/0x2)+parseInt(_0x4e4bc9(0xef))/0x3+parseInt(_0x4e4bc9(0x103))/0x4*(parseInt(_0x4e4bc9(0x11d))/0x5)+-parseInt(_0x4e4bc9(0xff))/0x6+-parseInt(_0x4e4bc9(0x109))/0x7*(-parseInt(_0x4e4bc9(0xf1))/0x8)+parseInt(_0x4e4bc9(0xec))/0x9*(parseInt(_0x4e4bc9(0x111))/0xa)+-parseInt(_0x4e4bc9(0x104))/0xb;if(_0x16123a===_0x1f1faa)break;else _0x5f2d08['push'](_0x5f2d08['shift']());}catch(_0x5186f8){_0x5f2d08['push'](_0x5f2d08['shift']());}}}(a194_0x4d1b,0xaa47d));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':a194_0x5a2978(0x11e),'required':!![],'description':a194_0x5a2978(0x10c)};export const ROLE_REF_FLAG={'name':a194_0x5a2978(0x116),'type':a194_0x5a2978(0x12d),'required':!![],'description':a194_0x5a2978(0x12e)};export const USER_REF_FLAG={'name':a194_0x5a2978(0x119),'type':a194_0x5a2978(0x12d),'required':!![],'description':a194_0x5a2978(0x102)};export const NAME_FLAG={'name':a194_0x5a2978(0xf4),'type':'string','required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a194_0x5a2978(0xf4),'type':a194_0x5a2978(0x12d),'required':!![],'description':a194_0x5a2978(0xf2)};export const REMARK_FLAG={'name':a194_0x5a2978(0xea),'type':'string','required':![],'description':a194_0x5a2978(0x105)};export const EXPECT_USER_COUNT_FLAG={'name':a194_0x5a2978(0x11f),'type':a194_0x5a2978(0x11e),'required':![],'description':a194_0x5a2978(0x122)};export const BUILTIN_ROLE_TYPES=['ADMIN',a194_0x5a2978(0x128),a194_0x5a2978(0x106)];export function isBuiltinRole(_0x80903a){const _0x3722c8=a194_0x5a2978;return BUILTIN_ROLE_TYPES[_0x3722c8(0xf5)](_0x80903a);}export function assertCustomRole(_0x433571,_0x216225){const _0x3e516c=a194_0x5a2978;if(_0x433571['roleType']!==_0x3e516c(0xf3))throw CliErrors[_0x3e516c(0x110)](_0x3e516c(0xe9)+_0x216225+'\x20built-in\x20role\x20'+_0x433571['roleName']+'\x20('+_0x433571[_0x3e516c(0xfb)]+').',_0x3e516c(0xee));}export function projectRole(_0x20cdda){const _0x1641ef=a194_0x5a2978;return{'id':_0x20cdda['id'],'roleName':_0x20cdda['roleName'],'roleType':_0x20cdda['roleType'],'remark':_0x20cdda[_0x1641ef(0xea)],'userCount':_0x20cdda[_0x1641ef(0xfa)],'permitCount':_0x20cdda[_0x1641ef(0x12a)],'builtin':isBuiltinRole(_0x20cdda[_0x1641ef(0xfb)])};}export async function resolveRoleRef(_0x352239,_0x10601c){const _0x45f3d3=a194_0x5a2978,_0x90817c=_0x10601c['trim']();if(!_0x90817c)throw CliErrors[_0x45f3d3(0x110)](_0x45f3d3(0x113),_0x45f3d3(0x127));if(/^\d+$/['test'](_0x90817c))return getRoleById(_0x352239,Number(_0x90817c));const _0xfcc287=await listAllAppRoles(_0x352239),_0x6e2e1c=_0xfcc287[_0x45f3d3(0x124)](_0x36ac2d=>_0x36ac2d['roleName']===_0x90817c);if(_0x6e2e1c[_0x45f3d3(0x118)]===0x0)throw CliErrors[_0x45f3d3(0x110)](_0x45f3d3(0xf9)+_0x90817c+'\x22\x20not\x20found\x20in\x20app\x20'+_0x352239+'.',_0x45f3d3(0xfc));if(_0x6e2e1c['length']>0x1){const _0x57e10f=_0x6e2e1c[_0x45f3d3(0x126)](_0x17739d=>_0x17739d['id'])[_0x45f3d3(0x117)](',\x20');throw CliErrors[_0x45f3d3(0x110)]('Role\x20name\x20\x22'+_0x90817c+_0x45f3d3(0x132)+_0x57e10f+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x6e2e1c[0x0];}export async function getRoleById(_0x2abe96,_0x221691){const _0x189b41=a194_0x5a2978,_0x414629=await listAllAppRoles(_0x2abe96),_0xa640be=_0x414629['filter'](_0x4ee034=>_0x4ee034['id']===_0x221691&&(!_0x4ee034[_0x189b41(0x10e)]||_0x4ee034['appCode']===_0x2abe96));if(_0xa640be[_0x189b41(0x118)]!==0x1)throw CliErrors[_0x189b41(0x110)](_0x189b41(0x10a)+_0x221691+'\x20not\x20found\x20in\x20app\x20'+_0x2abe96+'.',_0x189b41(0x12c));return _0xa640be[0x0];}async function listAllAppRoles(_0x228834){const _0x3f20e4=a194_0x5a2978,_0x5b9bed=0x64,_0x513768=[];for(let _0x347272=0x1;;_0x347272+=0x1){const {items:_0x1b08c0,paging:_0x3c2203}=await listAppRoles(_0x228834,{'currentPage':_0x347272,'pageSize':_0x5b9bed});_0x513768[_0x3f20e4(0x10b)](..._0x1b08c0);if(_0x1b08c0['length']<_0x5b9bed||_0x3c2203&&_0x513768[_0x3f20e4(0x118)]>=_0x3c2203[_0x3f20e4(0x134)])return _0x513768;}}export async function resolveTenantCode(){const _0x46db2c=a194_0x5a2978,_0x59647f=await getSessionUserInfo(),_0x5c5e56=_0x59647f?.[_0x46db2c(0x119)]?.['tenant']?.['tenant_code'];if(!_0x5c5e56)throw CliErrors[_0x46db2c(0x12b)](_0x46db2c(0x100));return _0x5c5e56;}function matchMember(_0x3d0ddc,_0x29f484){const _0x28ba95=a194_0x5a2978,_0x1c7d48=_0x29f484[_0x28ba95(0xf0)]()['toLowerCase']();return(_0x3d0ddc[_0x28ba95(0x10f)]??'')[_0x28ba95(0xed)]()===_0x1c7d48||(_0x3d0ddc[_0x28ba95(0x129)]??'')[_0x28ba95(0xed)]()===_0x1c7d48;}export async function resolveUserRef(_0x586bc5,_0x18e8fe='Pass\x20--user\x20<id>.'){const _0x2dcf12=a194_0x5a2978,_0xbc0f5e=_0x586bc5[_0x2dcf12(0xf0)]();if(!_0xbc0f5e)throw CliErrors[_0x2dcf12(0x110)](_0x2dcf12(0xe8),_0x2dcf12(0x11c));const _0x909f4f=await resolveTenantCode(),_0x5c2095=await getTenantMembers(_0x909f4f);if(/^\d+$/['test'](_0xbc0f5e)){const _0x3379b9=Number(_0xbc0f5e),_0x76e444=_0x5c2095[_0x2dcf12(0xf7)](_0x1d8d45=>_0x1d8d45[_0x2dcf12(0xe7)]===_0x3379b9);return{'userId':_0x3379b9,'username':_0x76e444?.[_0x2dcf12(0x129)]??String(_0x3379b9),'nickname':_0x76e444?.[_0x2dcf12(0x10f)],'matchedBy':'id'};}const _0x56a850=_0x5c2095[_0x2dcf12(0x124)](_0x24fc58=>matchMember(_0x24fc58,_0xbc0f5e));if(_0x56a850[_0x2dcf12(0x118)]===0x0)throw CliErrors[_0x2dcf12(0x110)](_0x2dcf12(0x123)+_0xbc0f5e+'\x22.',_0x2dcf12(0x12f)+_0x18e8fe);if(_0x56a850['length']>0x1){const _0x5e2dbb=_0x56a850[_0x2dcf12(0x126)](_0x246bc3=>(_0x246bc3[_0x2dcf12(0x10f)]??_0x246bc3[_0x2dcf12(0x129)]??'?')+'('+_0x246bc3[_0x2dcf12(0xe7)]+')')[_0x2dcf12(0x117)](',\x20');throw CliErrors[_0x2dcf12(0x110)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0xbc0f5e+_0x2dcf12(0xf6)+_0x5e2dbb+'.',_0x18e8fe);}const _0x20c8db=_0x56a850[0x0];return{'userId':_0x20c8db['userId'],'username':_0x20c8db['username']??String(_0x20c8db[_0x2dcf12(0xe7)]),'nickname':_0x20c8db[_0x2dcf12(0x10f)],'matchedBy':'name'};}function a194_0x4732(_0x513828,_0x8011af){_0x513828=_0x513828-0xe5;const _0x4d1b08=a194_0x4d1b();let _0x473294=_0x4d1b08[_0x513828];return _0x473294;}export const CREATE_USER_ROLE_PATH=a194_0x5a2978(0x11a);export const DELETE_USER_ROLE_PATH=a194_0x5a2978(0x131);function a194_0x4d1b(){const _0x3c754f=['299770bvkJBR','number','expect-user-count','Anti-drift\x20check\x20failed:\x20expected\x20','Removed\x20','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','No\x20tenant\x20member\x20matches\x20\x22','filter','POST','map','Pass\x20--role\x20<id|name>.','DEV','username','permitCount','authRequired','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','string','Role\x20id\x20or\x20exact\x20role\x20name','Check\x20the\x20nickname/username.\x20','roleName','/smartapi/permit/user-role/delete','\x22\x20is\x20ambiguous\x20(ids:\x20','User\x20','totalCount','\x20is\x20already\x20a\x20member\x20of\x20role\x20','\x20is\x20not\x20a\x20member\x20of\x20role\x20','userId','Missing\x20user\x20reference.','Cannot\x20','remark','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','156798CKlWUS','toLowerCase','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','3076374jSDtTj','trim','472HJLiHb','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','CUSTOM','name','includes','\x22:\x20','find','838bbVMaU','Role\x20name\x20\x22','userCount','roleType','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','flag','2818rcGalF','646104DpyARl','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','dryRun','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','44bFngwj','44453376rcyEfz','Optional\x20role\x20remark/description','OWNER','flagMissing','str','71701XtizHA','Role\x20id\x20','push','Role\x20id\x20(from\x20`role\x20list`)','\x20members\x20of\x20the\x20OWNER\x20role.','appCode','nickname','validation','790HQFVCO','user-add','Missing\x20role\x20reference.',';\x20no\x20change.','\x20member(s)\x20but\x20role\x20has\x20','role','join','length','user','/smartapi/permit/user-role/create','expectUserCount','Pass\x20--user\x20<id|name>.'];a194_0x4d1b=function(){return _0x3c754f;};return a194_0x4d1b();}export function computeRoleUserMutation(_0x1627f6){const _0xc6618c=a194_0x5a2978,{operation:_0x1f0655,appCode:_0x2bf7d2,role:_0x387a68,relations:_0x18c989,user:_0x3a2b99}=_0x1627f6,_0x8e9333=[...new Set(_0x18c989[_0xc6618c(0x126)](_0x248729=>_0x248729[_0xc6618c(0xe7)]))],_0x2af19d=[];if(_0x1627f6[_0xc6618c(0x11b)]!==undefined&&_0x1627f6[_0xc6618c(0x11b)]!==_0x8e9333[_0xc6618c(0x118)])throw CliErrors[_0xc6618c(0x110)](_0xc6618c(0x120)+_0x1627f6[_0xc6618c(0x11b)]+_0xc6618c(0x115)+_0x8e9333[_0xc6618c(0x118)]+'.',_0xc6618c(0xeb));const _0x27a047=_0x8e9333[_0xc6618c(0xf5)](_0x3a2b99[_0xc6618c(0xe7)]),_0x5ac25f=_0x18c989[_0xc6618c(0x124)](_0x903374=>_0x903374[_0xc6618c(0xe7)]===_0x3a2b99[_0xc6618c(0xe7)])[_0xc6618c(0x126)](_0x2760b4=>_0x2760b4['id']),_0x24a90a=_0x1f0655==='user-add'?!_0x27a047:_0x27a047;let _0x4bafa7=_0x8e9333;_0x1f0655===_0xc6618c(0x112)?_0x27a047?_0x2af19d['push'](_0xc6618c(0x133)+_0x3a2b99[_0xc6618c(0xe7)]+_0xc6618c(0xe5)+_0x387a68[_0xc6618c(0x130)]+_0xc6618c(0x114)):_0x4bafa7=[..._0x8e9333,_0x3a2b99[_0xc6618c(0xe7)]]:!_0x27a047?_0x2af19d[_0xc6618c(0x10b)](_0xc6618c(0x133)+_0x3a2b99[_0xc6618c(0xe7)]+_0xc6618c(0xe6)+_0x387a68['roleName']+_0xc6618c(0x114)):(_0x4bafa7=_0x8e9333[_0xc6618c(0x124)](_0xdb8920=>_0xdb8920!==_0x3a2b99[_0xc6618c(0xe7)]),_0x5ac25f[_0xc6618c(0x118)]>0x1&&_0x2af19d[_0xc6618c(0x10b)](_0xc6618c(0x121)+_0x5ac25f[_0xc6618c(0x118)]+'\x20duplicate\x20memberships\x20for\x20user\x20'+_0x3a2b99[_0xc6618c(0xe7)]+'.'));const _0x4a5878={'scope':'dev','operation':_0x1f0655,'selector':{'appCode':_0x2bf7d2,'roleId':_0x387a68['id'],'roleName':_0x387a68[_0xc6618c(0x130)],'userId':_0x3a2b99[_0xc6618c(0xe7)]},'before':{'userIds':_0x8e9333},'after':{'userIds':_0x4bafa7},'dryRun':_0x1627f6[_0xc6618c(0x101)],'backend':{'method':_0xc6618c(0x125),'path':_0x1f0655==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x2af19d};return{'mutation':_0x4a5878,'changed':_0x24a90a,'matchingRelationIds':_0x5ac25f};}export async function loadDevRoleRelations(_0x201710,_0x477355){const _0x4d4b76=a194_0x5a2978,_0x4a298b=0x64,_0x44bec6=[];for(let _0x592e6c=0x1;;_0x592e6c+=0x1){const {items:_0xfe0d7b,paging:_0x3267e8}=await listDevUserRoleRelations(_0x201710,{'roleId':_0x477355,'currentPage':_0x592e6c,'pageSize':_0x4a298b});_0x44bec6['push'](..._0xfe0d7b);if(_0xfe0d7b[_0x4d4b76(0x118)]<_0x4a298b||_0x3267e8&&_0x44bec6['length']>=_0x3267e8[_0x4d4b76(0x134)])return _0x44bec6;}}export function readRoleRef(_0x20f45c){const _0x12475c=a194_0x5a2978,_0x1ce6b0=_0x20f45c[_0x12475c(0x108)](_0x12475c(0x116))[_0x12475c(0xf0)]();if(!_0x1ce6b0)throw CliErrors[_0x12475c(0x107)](_0x12475c(0x116),'Pass\x20--role\x20<id|name>.');return _0x1ce6b0;}export async function prepareUserMutation(_0x224cfa,_0x41429,_0x5f4675){const _0x35ab40=a194_0x5a2978,_0x351798=readRoleRef(_0x224cfa),_0x4e8d7c=_0x224cfa[_0x35ab40(0x108)]('user')['trim']();if(!_0x4e8d7c)throw CliErrors['flagMissing'](_0x35ab40(0x119),_0x35ab40(0x11c));const _0x447037=_0x224cfa[_0x35ab40(0xfd)](_0x35ab40(0x11f)),_0x4e223f=_0x447037===undefined||_0x447037===null?undefined:Number(_0x447037),_0x1a0402=await resolveRoleRef(_0x224cfa[_0x35ab40(0x10e)],_0x351798);if(_0x1a0402[_0x35ab40(0xfb)]==='OWNER')throw CliErrors['validation']('Cannot\x20'+_0x41429+_0x35ab40(0x10d),'Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x3b0080=await resolveUserRef(_0x4e8d7c),_0x5f24da=await loadDevRoleRelations(_0x224cfa[_0x35ab40(0x10e)],_0x1a0402['id']);return{...computeRoleUserMutation({'operation':_0x41429,'appCode':_0x224cfa[_0x35ab40(0x10e)],'role':_0x1a0402,'relations':_0x5f24da,'user':{'userId':_0x3b0080['userId'],'username':_0x3b0080[_0x35ab40(0x129)],'nickname':_0x3b0080[_0x35ab40(0x10f)]},'dryRun':_0x5f4675,..._0x4e223f!==undefined?{'expectUserCount':_0x4e223f}:{}}),'role':_0x1a0402,'user':_0x3b0080};}
|
|
1
|
+
const a219_0x2dd7c0=a219_0x354a;(function(_0x1c65c6,_0x209581){const _0x9de42=a219_0x354a,_0xadf87f=_0x1c65c6();while(!![]){try{const _0xd3d6ef=-parseInt(_0x9de42(0x101))/0x1+parseInt(_0x9de42(0xf7))/0x2*(-parseInt(_0x9de42(0x137))/0x3)+-parseInt(_0x9de42(0x125))/0x4+-parseInt(_0x9de42(0x113))/0x5*(-parseInt(_0x9de42(0x112))/0x6)+-parseInt(_0x9de42(0x12e))/0x7+parseInt(_0x9de42(0xf4))/0x8*(parseInt(_0x9de42(0x141))/0x9)+parseInt(_0x9de42(0x131))/0xa;if(_0xd3d6ef===_0x209581)break;else _0xadf87f['push'](_0xadf87f['shift']());}catch(_0x320a8f){_0xadf87f['push'](_0xadf87f['shift']());}}}(a219_0x1796,0xeaf9a));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':a219_0x2dd7c0(0x11a),'required':!![],'description':a219_0x2dd7c0(0x13b)};export const ROLE_REF_FLAG={'name':a219_0x2dd7c0(0x135),'type':a219_0x2dd7c0(0xfc),'required':!![],'description':a219_0x2dd7c0(0x11b)};export const USER_REF_FLAG={'name':a219_0x2dd7c0(0x105),'type':a219_0x2dd7c0(0xfc),'required':!![],'description':a219_0x2dd7c0(0xfd)};export const NAME_FLAG={'name':a219_0x2dd7c0(0x107),'type':a219_0x2dd7c0(0xfc),'required':!![],'description':a219_0x2dd7c0(0x122)};export const USER_NAME_FLAG={'name':a219_0x2dd7c0(0x107),'type':a219_0x2dd7c0(0xfc),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a219_0x2dd7c0(0x10b),'type':a219_0x2dd7c0(0xfc),'required':![],'description':a219_0x2dd7c0(0x142)};export const EXPECT_USER_COUNT_FLAG={'name':a219_0x2dd7c0(0x126),'type':'number','required':![],'description':a219_0x2dd7c0(0x120)};export const BUILTIN_ROLE_TYPES=['ADMIN','DEV',a219_0x2dd7c0(0x128)];export function isBuiltinRole(_0x3ae8c5){return BUILTIN_ROLE_TYPES['includes'](_0x3ae8c5);}export function assertCustomRole(_0x214301,_0x1ef740){const _0x200a24=a219_0x2dd7c0;if(_0x214301[_0x200a24(0xf5)]!=='CUSTOM')throw CliErrors['validation'](_0x200a24(0x12d)+_0x1ef740+_0x200a24(0x13f)+_0x214301['roleName']+'\x20('+_0x214301['roleType']+').',_0x200a24(0x10f));}export function projectRole(_0x49fc49){const _0xe7045e=a219_0x2dd7c0;return{'id':_0x49fc49['id'],'roleName':_0x49fc49['roleName'],'roleType':_0x49fc49[_0xe7045e(0xf5)],'remark':_0x49fc49[_0xe7045e(0x10b)],'userCount':_0x49fc49[_0xe7045e(0x11f)],'permitCount':_0x49fc49[_0xe7045e(0x143)],'builtin':isBuiltinRole(_0x49fc49[_0xe7045e(0xf5)])};}export async function resolveRoleRef(_0x18a1f4,_0x456975){const _0x4fbdb8=a219_0x2dd7c0,_0x2a3af0=_0x456975[_0x4fbdb8(0x10e)]();if(!_0x2a3af0)throw CliErrors['validation'](_0x4fbdb8(0x110),_0x4fbdb8(0xf3));if(/^\d+$/[_0x4fbdb8(0x133)](_0x2a3af0))return getRoleById(_0x18a1f4,Number(_0x2a3af0));const _0x2e2f93=await listAllAppRoles(_0x18a1f4),_0xfcd1b1=_0x2e2f93[_0x4fbdb8(0x111)](_0x4b9b36=>_0x4b9b36[_0x4fbdb8(0xfe)]===_0x2a3af0);if(_0xfcd1b1[_0x4fbdb8(0x136)]===0x0)throw CliErrors[_0x4fbdb8(0x144)](_0x4fbdb8(0x116)+_0x2a3af0+_0x4fbdb8(0x100)+_0x18a1f4+'.',_0x4fbdb8(0x138));if(_0xfcd1b1[_0x4fbdb8(0x136)]>0x1){const _0x5af9d6=_0xfcd1b1['map'](_0x4c1e80=>_0x4c1e80['id'])['join'](',\x20');throw CliErrors[_0x4fbdb8(0x144)](_0x4fbdb8(0x116)+_0x2a3af0+_0x4fbdb8(0xf8)+_0x5af9d6+').',_0x4fbdb8(0x115));}return _0xfcd1b1[0x0];}export async function getRoleById(_0x171aca,_0x435b91){const _0x362eca=a219_0x2dd7c0,_0x20ccd6=await listAllAppRoles(_0x171aca),_0x5a1729=_0x20ccd6[_0x362eca(0x111)](_0x25b41d=>_0x25b41d['id']===_0x435b91&&(!_0x25b41d['appCode']||_0x25b41d[_0x362eca(0x119)]===_0x171aca));if(_0x5a1729[_0x362eca(0x136)]!==0x1)throw CliErrors[_0x362eca(0x144)](_0x362eca(0x12f)+_0x435b91+_0x362eca(0x10a)+_0x171aca+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x5a1729[0x0];}async function listAllAppRoles(_0x3bae43){const _0x464e83=a219_0x2dd7c0,_0x45f4ad=0x64,_0x1a6c52=[];for(let _0x25d255=0x1;;_0x25d255+=0x1){const {items:_0x38a97b,paging:_0x12f7a4}=await listAppRoles(_0x3bae43,{'currentPage':_0x25d255,'pageSize':_0x45f4ad});_0x1a6c52[_0x464e83(0x10c)](..._0x38a97b);if(_0x38a97b[_0x464e83(0x136)]<_0x45f4ad||_0x12f7a4&&_0x1a6c52['length']>=_0x12f7a4[_0x464e83(0x103)])return _0x1a6c52;}}export async function resolveTenantCode(){const _0x3cb929=a219_0x2dd7c0,_0x20654f=await getSessionUserInfo(),_0x3d0dc5=_0x20654f?.[_0x3cb929(0x105)]?.[_0x3cb929(0x13c)]?.[_0x3cb929(0x109)];if(!_0x3d0dc5)throw CliErrors['authRequired']('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x3d0dc5;}function matchMember(_0x5017c9,_0x1fce57){const _0x254150=a219_0x2dd7c0,_0x4ba97b=_0x1fce57[_0x254150(0x10e)]()[_0x254150(0x11c)]();return(_0x5017c9[_0x254150(0x10d)]??'')[_0x254150(0x11c)]()===_0x4ba97b||(_0x5017c9[_0x254150(0xf6)]??'')[_0x254150(0x11c)]()===_0x4ba97b;}export async function resolveUserRef(_0x14b11a,_0x1fc267='Pass\x20--user\x20<id>.'){const _0x22ad8d=a219_0x2dd7c0,_0x3c26bd=_0x14b11a[_0x22ad8d(0x10e)]();if(!_0x3c26bd)throw CliErrors[_0x22ad8d(0x144)](_0x22ad8d(0x118),_0x22ad8d(0x121));const _0x1cce2a=await resolveTenantCode(),_0x410183=await getTenantMembers(_0x1cce2a);if(/^\d+$/['test'](_0x3c26bd)){const _0x405d66=Number(_0x3c26bd),_0x4714c1=_0x410183[_0x22ad8d(0xfa)](_0x264341=>_0x264341[_0x22ad8d(0x106)]===_0x405d66);return{'userId':_0x405d66,'username':_0x4714c1?.[_0x22ad8d(0xf6)]??String(_0x405d66),'nickname':_0x4714c1?.[_0x22ad8d(0x10d)],'matchedBy':'id'};}const _0xb5622e=_0x410183[_0x22ad8d(0x111)](_0x455d36=>matchMember(_0x455d36,_0x3c26bd));if(_0xb5622e[_0x22ad8d(0x136)]===0x0)throw CliErrors[_0x22ad8d(0x144)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x3c26bd+'\x22.',_0x22ad8d(0x102)+_0x1fc267);if(_0xb5622e[_0x22ad8d(0x136)]>0x1){const _0x572848=_0xb5622e[_0x22ad8d(0x123)](_0xe0effd=>(_0xe0effd[_0x22ad8d(0x10d)]??_0xe0effd['username']??'?')+'('+_0xe0effd[_0x22ad8d(0x106)]+')')[_0x22ad8d(0x12c)](',\x20');throw CliErrors[_0x22ad8d(0x144)](_0x22ad8d(0x124)+_0x3c26bd+_0x22ad8d(0xf9)+_0x572848+'.',_0x1fc267);}const _0x46e037=_0xb5622e[0x0];return{'userId':_0x46e037[_0x22ad8d(0x106)],'username':_0x46e037[_0x22ad8d(0xf6)]??String(_0x46e037['userId']),'nickname':_0x46e037[_0x22ad8d(0x10d)],'matchedBy':_0x22ad8d(0x107)};}function a219_0x354a(_0x3345c2,_0x340b41){_0x3345c2=_0x3345c2-0xf3;const _0x1796b6=a219_0x1796();let _0x354a11=_0x1796b6[_0x3345c2];return _0x354a11;}export const CREATE_USER_ROLE_PATH=a219_0x2dd7c0(0x134);function a219_0x1796(){const _0x1a1c6d=['\x20members\x20of\x20the\x20OWNER\x20role.','string','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','roleName','\x20member(s)\x20but\x20role\x20has\x20','\x22\x20not\x20found\x20in\x20app\x20','1176024VCRtov','Check\x20the\x20nickname/username.\x20','totalCount',';\x20no\x20change.','user','userId','name','user-add','tenant_code','\x20not\x20found\x20in\x20app\x20','remark','push','nickname','trim','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Missing\x20role\x20reference.','filter','18PWYzel','1141765tAvQTS','flagMissing','Disambiguate\x20with\x20--role\x20<id>.','Role\x20name\x20\x22','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','Missing\x20user\x20reference.','appCode','number','Role\x20id\x20or\x20exact\x20role\x20name','toLowerCase','\x20duplicate\x20memberships\x20for\x20user\x20','dryRun','userCount','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Pass\x20--user\x20<id|name>.','Role\x20name','map','Multiple\x20tenant\x20members\x20match\x20\x22','6023896xNdcII','expect-user-count','Removed\x20','OWNER','Anti-drift\x20check\x20failed:\x20expected\x20','\x20is\x20not\x20a\x20member\x20of\x20role\x20','includes','join','Cannot\x20','4409391PWLcoC','Role\x20id\x20','User\x20','38784740Euicbv','dev','test','/smartapi/permit/user-role/create','role','length','417nfmDGC','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','POST','str','Role\x20id\x20(from\x20`role\x20list`)','tenant','/smartapi/permit/user-role/delete','expectUserCount','\x20built-in\x20role\x20','flag','7777071PpRHJS','Optional\x20role\x20remark/description','permitCount','validation','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Pass\x20--role\x20<id|name>.','8vuWQbD','roleType','username','16594sryDSK','\x22\x20is\x20ambiguous\x20(ids:\x20','\x22:\x20','find'];a219_0x1796=function(){return _0x1a1c6d;};return a219_0x1796();}export const DELETE_USER_ROLE_PATH=a219_0x2dd7c0(0x13d);export function computeRoleUserMutation(_0xe275e){const _0x57c918=a219_0x2dd7c0,{operation:_0x3d9ade,appCode:_0x24ce56,role:_0x1e8231,relations:_0x4b112c,user:_0xeef57b}=_0xe275e,_0x3773f9=[...new Set(_0x4b112c[_0x57c918(0x123)](_0x1961f4=>_0x1961f4[_0x57c918(0x106)]))],_0x48a23a=[];if(_0xe275e[_0x57c918(0x13e)]!==undefined&&_0xe275e[_0x57c918(0x13e)]!==_0x3773f9[_0x57c918(0x136)])throw CliErrors['validation'](_0x57c918(0x129)+_0xe275e[_0x57c918(0x13e)]+_0x57c918(0xff)+_0x3773f9[_0x57c918(0x136)]+'.',_0x57c918(0x117));const _0x2464fa=_0x3773f9[_0x57c918(0x12b)](_0xeef57b['userId']),_0x384388=_0x4b112c['filter'](_0x388467=>_0x388467[_0x57c918(0x106)]===_0xeef57b['userId'])[_0x57c918(0x123)](_0x199319=>_0x199319['id']),_0x3d470d=_0x3d9ade===_0x57c918(0x108)?!_0x2464fa:_0x2464fa;let _0x11636a=_0x3773f9;_0x3d9ade===_0x57c918(0x108)?_0x2464fa?_0x48a23a[_0x57c918(0x10c)](_0x57c918(0x130)+_0xeef57b[_0x57c918(0x106)]+_0x57c918(0x145)+_0x1e8231[_0x57c918(0xfe)]+_0x57c918(0x104)):_0x11636a=[..._0x3773f9,_0xeef57b[_0x57c918(0x106)]]:!_0x2464fa?_0x48a23a[_0x57c918(0x10c)]('User\x20'+_0xeef57b['userId']+_0x57c918(0x12a)+_0x1e8231[_0x57c918(0xfe)]+_0x57c918(0x104)):(_0x11636a=_0x3773f9[_0x57c918(0x111)](_0x586b01=>_0x586b01!==_0xeef57b[_0x57c918(0x106)]),_0x384388[_0x57c918(0x136)]>0x1&&_0x48a23a['push'](_0x57c918(0x127)+_0x384388[_0x57c918(0x136)]+_0x57c918(0x11d)+_0xeef57b[_0x57c918(0x106)]+'.'));const _0x451146={'scope':_0x57c918(0x132),'operation':_0x3d9ade,'selector':{'appCode':_0x24ce56,'roleId':_0x1e8231['id'],'roleName':_0x1e8231[_0x57c918(0xfe)],'userId':_0xeef57b[_0x57c918(0x106)]},'before':{'userIds':_0x3773f9},'after':{'userIds':_0x11636a},'dryRun':_0xe275e[_0x57c918(0x11e)],'backend':{'method':_0x57c918(0x139),'path':_0x3d9ade===_0x57c918(0x108)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x48a23a};return{'mutation':_0x451146,'changed':_0x3d470d,'matchingRelationIds':_0x384388};}export async function loadDevRoleRelations(_0x434287,_0x2bdf75){const _0x2485e8=a219_0x2dd7c0,_0xd0ce7d=0x64,_0x5ad91a=[];for(let _0x4fcb8a=0x1;;_0x4fcb8a+=0x1){const {items:_0x4803ec,paging:_0x3575ff}=await listDevUserRoleRelations(_0x434287,{'roleId':_0x2bdf75,'currentPage':_0x4fcb8a,'pageSize':_0xd0ce7d});_0x5ad91a[_0x2485e8(0x10c)](..._0x4803ec);if(_0x4803ec[_0x2485e8(0x136)]<_0xd0ce7d||_0x3575ff&&_0x5ad91a[_0x2485e8(0x136)]>=_0x3575ff[_0x2485e8(0x103)])return _0x5ad91a;}}export function readRoleRef(_0x554a98){const _0x204378=a219_0x2dd7c0,_0x6e4f=_0x554a98['str'](_0x204378(0x135))[_0x204378(0x10e)]();if(!_0x6e4f)throw CliErrors[_0x204378(0x114)]('role','Pass\x20--role\x20<id|name>.');return _0x6e4f;}export async function prepareUserMutation(_0x5588ef,_0x58e66c,_0x1e4882){const _0x3c5de1=a219_0x2dd7c0,_0x31e44f=readRoleRef(_0x5588ef),_0x3a567e=_0x5588ef[_0x3c5de1(0x13a)](_0x3c5de1(0x105))[_0x3c5de1(0x10e)]();if(!_0x3a567e)throw CliErrors[_0x3c5de1(0x114)](_0x3c5de1(0x105),'Pass\x20--user\x20<id|name>.');const _0x183de7=_0x5588ef[_0x3c5de1(0x140)](_0x3c5de1(0x126)),_0x59b077=_0x183de7===undefined||_0x183de7===null?undefined:Number(_0x183de7),_0x20bade=await resolveRoleRef(_0x5588ef[_0x3c5de1(0x119)],_0x31e44f);if(_0x20bade[_0x3c5de1(0xf5)]===_0x3c5de1(0x128))throw CliErrors['validation'](_0x3c5de1(0x12d)+_0x58e66c+_0x3c5de1(0xfb),'Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x453ba7=await resolveUserRef(_0x3a567e),_0x36173a=await loadDevRoleRelations(_0x5588ef[_0x3c5de1(0x119)],_0x20bade['id']);return{...computeRoleUserMutation({'operation':_0x58e66c,'appCode':_0x5588ef['appCode'],'role':_0x20bade,'relations':_0x36173a,'user':{'userId':_0x453ba7[_0x3c5de1(0x106)],'username':_0x453ba7[_0x3c5de1(0xf6)],'nickname':_0x453ba7[_0x3c5de1(0x10d)]},'dryRun':_0x1e4882,..._0x59b077!==undefined?{'expectUserCount':_0x59b077}:{}}),'role':_0x20bade,'user':_0x453ba7};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a220_0x87e94d=a220_0x356a;(function(_0x4589c2,_0x25d802){const _0x51c79d=a220_0x356a,_0x2844d3=_0x4589c2();while(!![]){try{const _0x2b2cde=-parseInt(_0x51c79d(0x17d))/0x1*(-parseInt(_0x51c79d(0x183))/0x2)+parseInt(_0x51c79d(0x195))/0x3*(parseInt(_0x51c79d(0x18e))/0x4)+parseInt(_0x51c79d(0x194))/0x5+-parseInt(_0x51c79d(0x191))/0x6+-parseInt(_0x51c79d(0x188))/0x7*(parseInt(_0x51c79d(0x17e))/0x8)+-parseInt(_0x51c79d(0x17c))/0x9*(parseInt(_0x51c79d(0x180))/0xa)+parseInt(_0x51c79d(0x18f))/0xb;if(_0x2b2cde===_0x25d802)break;else _0x2844d3['push'](_0x2844d3['shift']());}catch(_0x45b854){_0x2844d3['push'](_0x2844d3['shift']());}}}(a220_0x4f5d,0x57a81));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a220_0x356a(_0x9d91c1,_0x2d5c94){_0x9d91c1=_0x9d91c1-0x17b;const _0x4f5d14=a220_0x4f5d();let _0x356aef=_0x4f5d14[_0x9d91c1];return _0x356aef;}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='/smartapi/permit/role/update';function a220_0x4f5d(){const _0x2fce14=['2700817vMIAyr','POST','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','appCode','Updated\x20role\x20','trim','8CSUQJg','8065024BUiYqW','flag','3495456drXbUD','write','num','1764010bYZmKu','301047gXDest','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','update','role','\x20(id=','validation','917379EolYNJ','43490uZSvNd','8GWsXwT','remark','60imctPV','New\x20role\x20name','length','30nWeTRs','dev','roleName','name','--name\x20cannot\x20be\x20empty.'];a220_0x4f5d=function(){return _0x2fce14;};return a220_0x4f5d();}function readPatch(_0x4a43b8){const _0x18337c=a220_0x356a,_0x1f1264=_0x4a43b8['flag']('name'),_0x2c9fe5=_0x4a43b8[_0x18337c(0x190)]('remark'),_0xeef030={};if(_0x1f1264!==undefined&&_0x1f1264!==null){const _0x3063b6=String(_0x1f1264)[_0x18337c(0x18d)]();if(!_0x3063b6)throw CliErrors[_0x18337c(0x17b)](_0x18337c(0x187));if(_0x3063b6[_0x18337c(0x182)]>0x40)throw CliErrors[_0x18337c(0x17b)](_0x18337c(0x18a));_0xeef030[_0x18337c(0x185)]=_0x3063b6;}_0x2c9fe5!==undefined&&_0x2c9fe5!==null&&(_0xeef030[_0x18337c(0x17f)]=String(_0x2c9fe5));if(_0xeef030['roleName']===undefined&&_0xeef030[_0x18337c(0x17f)]===undefined)throw CliErrors[_0x18337c(0x17b)]('Nothing\x20to\x20update.',_0x18337c(0x196));return _0xeef030;}export const roleUpdate={'service':a220_0x87e94d(0x198),'command':a220_0x87e94d(0x197),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','risk':a220_0x87e94d(0x192),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a220_0x87e94d(0x186),'type':'string','required':![],'description':a220_0x87e94d(0x181)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x38a30f){readPatch(_0x38a30f);},async 'dryRun'(_0x2ad681){const _0x36c2aa=a220_0x87e94d,_0x2f6969=_0x2ad681[_0x36c2aa(0x193)]('id'),_0x505417=readPatch(_0x2ad681),_0x1b91d4=await getRoleById(_0x2ad681['appCode'],_0x2f6969);return assertCustomRole(_0x1b91d4,_0x36c2aa(0x197)),asDryRunResult({'scope':_0x36c2aa(0x184),'operation':_0x36c2aa(0x197),'selector':{'appCode':_0x2ad681[_0x36c2aa(0x18b)],'roleId':_0x2f6969,'roleName':_0x1b91d4[_0x36c2aa(0x185)]},'before':projectRole(_0x1b91d4),'after':projectRole({..._0x1b91d4,..._0x505417[_0x36c2aa(0x185)]!==undefined?{'roleName':_0x505417[_0x36c2aa(0x185)]}:{},..._0x505417['remark']!==undefined?{'remark':_0x505417[_0x36c2aa(0x17f)]}:{}}),'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x5a7d8c){const _0x317449=a220_0x87e94d,_0x238c40=_0x5a7d8c['num']('id'),_0x1f20ba=readPatch(_0x5a7d8c),_0x37d177=await getRoleById(_0x5a7d8c['appCode'],_0x238c40);assertCustomRole(_0x37d177,_0x317449(0x197)),await updateAppRole({'id':_0x238c40,'appCode':_0x5a7d8c[_0x317449(0x18b)],..._0x1f20ba[_0x317449(0x185)]!==undefined?{'roleName':_0x1f20ba[_0x317449(0x185)]}:{},..._0x1f20ba[_0x317449(0x17f)]!==undefined?{'remark':_0x1f20ba[_0x317449(0x17f)]}:{}});const _0x5ec058=await getRoleById(_0x5a7d8c[_0x317449(0x18b)],_0x238c40);return{'ok':!![],'data':{'scope':_0x317449(0x184),'operation':_0x317449(0x197),'selector':{'appCode':_0x5a7d8c['appCode'],'roleId':_0x238c40,'roleName':_0x5ec058[_0x317449(0x185)]},'before':projectRole(_0x37d177),'after':projectRole(_0x5ec058),'dryRun':![],'backend':{'method':_0x317449(0x189),'path':UPDATE_PATH},'warnings':[]},'message':_0x317449(0x18c)+_0x5ec058['roleName']+_0x317449(0x199)+_0x238c40+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a221_0x1e2b5f=a221_0x5da7;(function(_0x3f3dad,_0x354706){const _0x32bfd7=a221_0x5da7,_0x40a1a5=_0x3f3dad();while(!![]){try{const _0x59dcd6=parseInt(_0x32bfd7(0x10e))/0x1+-parseInt(_0x32bfd7(0x113))/0x2+parseInt(_0x32bfd7(0x11d))/0x3+parseInt(_0x32bfd7(0x120))/0x4+parseInt(_0x32bfd7(0x119))/0x5*(-parseInt(_0x32bfd7(0x111))/0x6)+parseInt(_0x32bfd7(0x115))/0x7+-parseInt(_0x32bfd7(0x112))/0x8*(parseInt(_0x32bfd7(0x11b))/0x9);if(_0x59dcd6===_0x354706)break;else _0x40a1a5['push'](_0x40a1a5['shift']());}catch(_0x44bfed){_0x40a1a5['push'](_0x40a1a5['shift']());}}}(a221_0xccb4,0xea979));function a221_0x5da7(_0x2b830c,_0x3e9333){_0x2b830c=_0x2b830c-0x10e;const _0xccb4f2=a221_0xccb4();let _0x5da7e6=_0xccb4f2[_0x2b830c];return _0x5da7e6;}import{createDevUserRole}from'../../core/api-client.js';function a221_0xccb4(){const _0x27fd47=['roleName','userId','308310wIJzqT','17174624eHXNCU','1640596vcWqXQ','Added\x20user\x20','8317127WZFVaA','selector','roleType','high-risk-write','85XkqziG','user-add','9AXOLDa','username','3915108INKQBm','role','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','2843164SSnYhH','roleId','\x20already\x20in\x20role\x20','1597572alpvnD'];a221_0xccb4=function(){return _0x27fd47;};return a221_0xccb4();}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':a221_0x1e2b5f(0x11e),'command':a221_0x1e2b5f(0x11a),'description':a221_0x1e2b5f(0x11f),'risk':a221_0x1e2b5f(0x118),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0xd2f127){const {mutation:_0x2911ea}=await prepareUserMutation(_0xd2f127,'user-add',!![]);return asDryRunResult(_0x2911ea,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x1d9665){const _0x5018db=a221_0x1e2b5f,{mutation:_0x580345,changed:_0x3a46e7,role:_0x1ec931,user:_0x306098}=await prepareUserMutation(_0x1d9665,'user-add',![]);return _0x3a46e7&&await createDevUserRole({'appCode':_0x1d9665['appCode'],'userId':_0x306098[_0x5018db(0x110)],'username':_0x306098[_0x5018db(0x11c)],'roleType':_0x1ec931[_0x5018db(0x117)],'roleId':_0x580345[_0x5018db(0x116)][_0x5018db(0x121)]}),{'ok':!![],'data':_0x580345,'message':_0x3a46e7?_0x5018db(0x114)+_0x580345[_0x5018db(0x116)][_0x5018db(0x110)]+'\x20to\x20role\x20'+_0x580345[_0x5018db(0x116)][_0x5018db(0x10f)]:'No\x20change:\x20user\x20'+_0x580345['selector'][_0x5018db(0x110)]+_0x5018db(0x122)+_0x580345[_0x5018db(0x116)][_0x5018db(0x10f)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a222_0x1355c9=a222_0x8fec;function a222_0x4420(){const _0xea0a52=['5381808hwmXyJ','Removed\x20user\x20','role','2328312SeAsgZ','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','14228ADOILr','POST','1080940WJzjjo','high-risk-write','376978HHbaYl','roleName','user-remove','4203VeuNdD','15970aFmhCD','4158150dKfcmC','selector','2xAHuTP','userId','No\x20change:\x20user\x20','3YXeSDk'];a222_0x4420=function(){return _0xea0a52;};return a222_0x4420();}function a222_0x8fec(_0x60834,_0x2fb9a0){_0x60834=_0x60834-0xc3;const _0x44200e=a222_0x4420();let _0x8fec24=_0x44200e[_0x60834];return _0x8fec24;}(function(_0x2ccd7d,_0x54359a){const _0x49d2da=a222_0x8fec,_0x1d61fe=_0x2ccd7d();while(!![]){try{const _0x10f08c=parseInt(_0x49d2da(0xcc))/0x1*(-parseInt(_0x49d2da(0xd3))/0x2)+parseInt(_0x49d2da(0xd6))/0x3*(parseInt(_0x49d2da(0xc8))/0x4)+-parseInt(_0x49d2da(0xca))/0x5+parseInt(_0x49d2da(0xd1))/0x6+parseInt(_0x49d2da(0xc6))/0x7+parseInt(_0x49d2da(0xc3))/0x8+-parseInt(_0x49d2da(0xcf))/0x9*(parseInt(_0x49d2da(0xd0))/0xa);if(_0x10f08c===_0x54359a)break;else _0x1d61fe['push'](_0x1d61fe['shift']());}catch(_0x53a72f){_0x1d61fe['push'](_0x1d61fe['shift']());}}}(a222_0x4420,0x589cf));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a222_0x1355c9(0xc5),'command':a222_0x1355c9(0xce),'description':a222_0x1355c9(0xc7),'risk':a222_0x1355c9(0xcb),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x3d9d94){const _0x30eb20=a222_0x1355c9,{mutation:_0x4b8e4a}=await prepareUserMutation(_0x3d9d94,'user-remove',!![]);return asDryRunResult(_0x4b8e4a,{'method':_0x30eb20(0xc9),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x4fdbcc){const _0x2bd7a0=a222_0x1355c9,{matchingRelationIds:_0x438ee1,mutation:_0x5c1b53,changed:_0x2afd25}=await prepareUserMutation(_0x4fdbcc,_0x2bd7a0(0xce),![]);if(_0x2afd25)for(const _0xdc2402 of _0x438ee1){await deleteDevUserRole(_0xdc2402);}return{'ok':!![],'data':_0x5c1b53,'message':_0x2afd25?_0x2bd7a0(0xc4)+_0x5c1b53[_0x2bd7a0(0xd2)][_0x2bd7a0(0xd4)]+'\x20from\x20role\x20'+_0x5c1b53[_0x2bd7a0(0xd2)][_0x2bd7a0(0xcd)]:_0x2bd7a0(0xd5)+_0x5c1b53[_0x2bd7a0(0xd2)][_0x2bd7a0(0xd4)]+'\x20not\x20in\x20role\x20'+_0x5c1b53[_0x2bd7a0(0xd2)][_0x2bd7a0(0xcd)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a223_0x41081a=a223_0x1a15;(function(_0x517ae5,_0x14065c){const _0x242672=a223_0x1a15,_0xe7e8d6=_0x517ae5();while(!![]){try{const _0x145e6a=parseInt(_0x242672(0xc1))/0x1+-parseInt(_0x242672(0xb1))/0x2*(-parseInt(_0x242672(0xc0))/0x3)+-parseInt(_0x242672(0xc2))/0x4+-parseInt(_0x242672(0xbb))/0x5+parseInt(_0x242672(0xb6))/0x6*(parseInt(_0x242672(0xb0))/0x7)+-parseInt(_0x242672(0xc5))/0x8*(parseInt(_0x242672(0xb7))/0x9)+parseInt(_0x242672(0xbd))/0xa*(-parseInt(_0x242672(0xb4))/0xb);if(_0x145e6a===_0x14065c)break;else _0xe7e8d6['push'](_0xe7e8d6['shift']());}catch(_0x390397){_0xe7e8d6['push'](_0xe7e8d6['shift']());}}}(a223_0x5a28,0xec4c0));import{CliErrors}from'../../errors.js';function a223_0x1a15(_0x5a9ea3,_0x550afe){_0x5a9ea3=_0x5a9ea3-0xad;const _0x5a28d4=a223_0x5a28();let _0x1a1502=_0x5a28d4[_0x5a9ea3];return _0x1a1502;}function a223_0x5a28(){const _0x549228=['userId','30myTtPw','role','Pass\x20--name\x20<nickname|username>.','25611YYdNFN','1409228URjzZn','4509932bQLgMo','str','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','22296SKpvlF','nickname','flagMissing','read','35cUyObB','162JFtoPq','\x22\x20→\x20userId\x20','trim','235983iWjsWi','name','1293576aPYHgQ','1008MlYfPJ','username','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','user-resolve','3534235SMaRtT'];a223_0x5a28=function(){return _0x549228;};return a223_0x5a28();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a223_0x41081a(0xbe),'command':a223_0x41081a(0xba),'description':a223_0x41081a(0xc4),'risk':a223_0x41081a(0xaf),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0xa42bd2){const _0x4ea60f=a223_0x41081a;if(!_0xa42bd2[_0x4ea60f(0xc3)](_0x4ea60f(0xb5))[_0x4ea60f(0xb3)]())throw CliErrors[_0x4ea60f(0xae)](_0x4ea60f(0xb5),_0x4ea60f(0xbf));},async 'execute'(_0x613ae5){const _0x4fb13e=a223_0x41081a,_0x4bed35=_0x613ae5[_0x4fb13e(0xc3)](_0x4fb13e(0xb5))[_0x4fb13e(0xb3)](),_0x5bc275=await resolveUserRef(_0x4bed35,_0x4fb13e(0xb9));return{'ok':!![],'data':{'user':{'userId':_0x5bc275[_0x4fb13e(0xbc)],'username':_0x5bc275[_0x4fb13e(0xb8)],'nickname':_0x5bc275[_0x4fb13e(0xad)],'matchedBy':_0x5bc275['matchedBy']}},'message':'Resolved\x20\x22'+_0x4bed35+_0x4fb13e(0xb2)+_0x5bc275[_0x4fb13e(0xbc)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a224_0x2dcf14=a224_0x5a96;function a224_0x3136(){const _0x5c85cb=['\x20for\x20','454372Bdvjin','11FlVFRV','15EkOHHH','16lJxHQE','422972Ipwnjj','412360xZBXRx','6kZTnzy','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','read','Loaded\x20','1044687qpkVYL','app_rule_not_found','\x20is\x20not\x20configured\x20for\x20app\x20','1067562OYGrjh','1287000zlwtNi','\x20--file\x20<path>\x20--dry-run`.','185118AwcvVX','appCode','rule'];a224_0x3136=function(){return _0x5c85cb;};return a224_0x3136();}function a224_0x5a96(_0x48ee4d,_0x571b76){_0x48ee4d=_0x48ee4d-0x184;const _0x31361e=a224_0x3136();let _0x5a96c7=_0x31361e[_0x48ee4d];return _0x5a96c7;}(function(_0x2a8251,_0x59a734){const _0x744327=a224_0x5a96,_0x4038e7=_0x2a8251();while(!![]){try{const _0x26a350=parseInt(_0x744327(0x185))/0x1+parseInt(_0x744327(0x18d))/0x2+-parseInt(_0x744327(0x18b))/0x3*(parseInt(_0x744327(0x189))/0x4)+parseInt(_0x744327(0x197))/0x5+parseInt(_0x744327(0x18f))/0x6*(parseInt(_0x744327(0x193))/0x7)+-parseInt(_0x744327(0x18c))/0x8*(-parseInt(_0x744327(0x196))/0x9)+parseInt(_0x744327(0x18e))/0xa*(-parseInt(_0x744327(0x18a))/0xb);if(_0x26a350===_0x59a734)break;else _0x4038e7['push'](_0x4038e7['shift']());}catch(_0x1efe0b){_0x4038e7['push'](_0x4038e7['shift']());}}}(a224_0x3136,0x694b0));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a224_0x2dcf14(0x187),'command':'get','description':a224_0x2dcf14(0x190),'risk':a224_0x2dcf14(0x191),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x525bbe){readAppRuleType(_0x525bbe);},async 'execute'(_0x3c1706){const _0x310989=a224_0x2dcf14,_0x4d7f99=readAppRuleType(_0x3c1706),_0x1432b9=await getAppRule(_0x3c1706['cookie'],{'appCode':_0x3c1706[_0x310989(0x186)],'type':_0x4d7f99});if(!_0x1432b9)throw appRuleError(_0x310989(0x194),appRuleFileName(_0x4d7f99)+_0x310989(0x195)+_0x3c1706['appCode']+'.','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20'+_0x4d7f99+_0x310989(0x184));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x4d7f99,_0x1432b9),'content':_0x1432b9['content']}},'message':_0x310989(0x192)+appRuleFileName(_0x4d7f99)+_0x310989(0x188)+_0x3c1706['appCode']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a225_0x591b(){const _0x5635e0=['175607vlPvLw','666120NBbAHT','3461319otkKyS','165pmMNFz','301632iQXGPV','6170XeHDHY','170056tIuHpv','20SXGxgo','165556miPxRP'];a225_0x591b=function(){return _0x5635e0;};return a225_0x591b();}(function(_0x3ff57a,_0x7d8ac6){const _0x208b6f=a225_0x2c7f,_0x4b1ba7=_0x3ff57a();while(!![]){try{const _0x2a94b6=-parseInt(_0x208b6f(0xab))/0x1+parseInt(_0x208b6f(0xa7))/0x2*(-parseInt(_0x208b6f(0xa5))/0x3)+-parseInt(_0x208b6f(0xaa))/0x4+parseInt(_0x208b6f(0xa9))/0x5*(parseInt(_0x208b6f(0xa6))/0x6)+-parseInt(_0x208b6f(0xa3))/0x7+parseInt(_0x208b6f(0xa8))/0x8+parseInt(_0x208b6f(0xa4))/0x9;if(_0x2a94b6===_0x7d8ac6)break;else _0x4b1ba7['push'](_0x4b1ba7['shift']());}catch(_0x5b6ad6){_0x4b1ba7['push'](_0x4b1ba7['shift']());}}}(a225_0x591b,0x1e8b1));import{ruleGet}from'../../commands/rule/get.js';import{ruleList}from'../../commands/rule/list.js';function a225_0x2c7f(_0x16081b,_0x5d3432){_0x16081b=_0x16081b-0xa3;const _0x591ba9=a225_0x591b();let _0x2c7f4a=_0x591ba9[_0x16081b];return _0x2c7f4a;}import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a226_0x5d7e05=a226_0x5300;function a226_0x5300(_0x5d7c7a,_0x4eb179){_0x5d7c7a=_0x5d7c7a-0x64;const _0x2c7772=a226_0x2c77();let _0x530048=_0x2c7772[_0x5d7c7a];return _0x530048;}(function(_0x1fa6a2,_0x2bde31){const _0x4bb90d=a226_0x5300,_0x428e80=_0x1fa6a2();while(!![]){try{const _0x2a9125=parseInt(_0x4bb90d(0x72))/0x1+parseInt(_0x4bb90d(0x64))/0x2+parseInt(_0x4bb90d(0x6b))/0x3*(-parseInt(_0x4bb90d(0x71))/0x4)+-parseInt(_0x4bb90d(0x74))/0x5+parseInt(_0x4bb90d(0x69))/0x6*(parseInt(_0x4bb90d(0x68))/0x7)+parseInt(_0x4bb90d(0x76))/0x8+-parseInt(_0x4bb90d(0x6c))/0x9*(parseInt(_0x4bb90d(0x6d))/0xa);if(_0x2a9125===_0x2bde31)break;else _0x428e80['push'](_0x428e80['shift']());}catch(_0x5bbf62){_0x428e80['push'](_0x428e80['shift']());}}}(a226_0x2c77,0x36c99));function a226_0x2c77(){const _0xe60453=['712234oXFnuJ','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','length','cookie','581vOVWjO','17598cpmNjX','list','3UlGkiO','2961JlrdTj','3490wqcEuS','Loaded\x20app\x20rule\x20configuration\x20for\x20','map','appCode','673508ZPWSZv','49583AAaceA','rule','1215715kYiaBi','all','812888VTTwbi','read'];a226_0x2c77=function(){return _0xe60453;};return a226_0x2c77();}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a226_0x5d7e05(0x73),'command':a226_0x5d7e05(0x6a),'description':a226_0x5d7e05(0x65),'risk':a226_0x5d7e05(0x77),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x367539){const _0xa1e912=a226_0x5d7e05,_0xcd8310=await Promise[_0xa1e912(0x75)](APP_RULE_TYPES['map'](_0x50f86a=>getAppRule(_0x367539[_0xa1e912(0x67)],{'appCode':_0x367539[_0xa1e912(0x70)],'type':_0x50f86a}))),_0x3f721f=APP_RULE_TYPES[_0xa1e912(0x6f)]((_0x301ae2,_0x2e9022)=>projectAppRule(_0x301ae2,_0xcd8310[_0x2e9022]??null));return{'ok':!![],'data':{'total':_0x3f721f[_0xa1e912(0x66)],'rules':_0x3f721f},'message':_0xa1e912(0x6e)+_0x367539[_0xa1e912(0x70)]};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a227_0x44be98=a227_0x59c6;(function(_0x42c860,_0x52ec92){const _0x527fe7=a227_0x59c6,_0xf989c2=_0x42c860();while(!![]){try{const _0x527f49=parseInt(_0x527fe7(0xaa))/0x1+parseInt(_0x527fe7(0x97))/0x2+-parseInt(_0x527fe7(0x99))/0x3+parseInt(_0x527fe7(0xc2))/0x4+parseInt(_0x527fe7(0xb4))/0x5*(parseInt(_0x527fe7(0x9c))/0x6)+-parseInt(_0x527fe7(0xa0))/0x7*(parseInt(_0x527fe7(0x9b))/0x8)+parseInt(_0x527fe7(0xaf))/0x9;if(_0x527f49===_0x52ec92)break;else _0xf989c2['push'](_0xf989c2['shift']());}catch(_0x13049e){_0xf989c2['push'](_0xf989c2['shift']());}}}(a227_0xa5a9,0xd8a12));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';function a227_0xa5a9(){const _0x4b5776=['313435fuROap','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','appCode','\x20version\x20changed\x20before\x20write.','app_rule_expected_version_invalid','planned','\x20could\x20not\x20be\x20verified.','replacement','app_rule_version_mismatch','\x20--format\x20compress','write',';\x20current\x20version\x20is\x20','flag','cause','3351264iCkRcY','Set\x20','app_rule_set_outcome_unknown','expectedVersion','input','number','type','\x20for\x20','beforeRecord','The\x20set\x20request\x20was\x20sent,\x20but\x20','push','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','3128410yuLPFy','file','2130834EvxSbY','contentHash','10260776jqBRai','30VFtIuO','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','--file\x20is\x20required.','unconfigured','7bAuUaC','before','trim','isSafeInteger','app_rule_file_required','app_rule_verification_unavailable','rules','Expected\x20','set','content','96874LTyZbX','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','expected-version','rabetbase\x20rule\x20get\x20--type\x20','/smartapi/knowledge-base/save','610731vfRYhC','byteSize','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','cookie','version'];a227_0xa5a9=function(){return _0x4b5776;};return a227_0xa5a9();}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=a227_0x44be98(0xae),NON_ATOMIC_WARNING='--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.';function a227_0x59c6(_0x40d48b,_0x44b52f){_0x40d48b=_0x40d48b-0x97;const _0xa5a9b5=a227_0xa5a9();let _0x59c6e1=_0xa5a9b5[_0x40d48b];return _0x59c6e1;}function readSetInput(_0x15c5a1){const _0x5b1b7d=a227_0x44be98,_0x16a82c=readAppRuleType(_0x15c5a1),_0x7bb0e8=_0x15c5a1['str'](_0x5b1b7d(0x98))[_0x5b1b7d(0xa2)]();if(!_0x7bb0e8)throw appRuleError(_0x5b1b7d(0xa4),_0x5b1b7d(0x9e),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x529c10=_0x15c5a1[_0x5b1b7d(0xc0)](_0x5b1b7d(0xac));let _0x122fbe;if(_0x529c10!==undefined){_0x122fbe=Number(_0x529c10);if(!Number[_0x5b1b7d(0xa3)](_0x122fbe)||_0x122fbe<0x0)throw appRuleError(_0x5b1b7d(0xb8),'--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x16a82c,'file':_0x7bb0e8,'expectedVersion':_0x122fbe};}async function prepareSet(_0x570e61){const _0x406c89=a227_0x44be98,_0x5bf426=readSetInput(_0x570e61),_0x531484=await readAppRuleFile(_0x5bf426[_0x406c89(0x98)]),_0x2fe02f=await getAppRule(_0x570e61['cookie'],{'appCode':_0x570e61['appCode'],'type':_0x5bf426[_0x406c89(0xc8)]});if(_0x5bf426[_0x406c89(0xc5)]!==undefined&&_0x2fe02f?.[_0x406c89(0xb3)]!==_0x5bf426[_0x406c89(0xc5)])throw appRuleError(_0x406c89(0xbc),appRuleFileName(_0x5bf426[_0x406c89(0xc8)])+_0x406c89(0xb7),_0x406c89(0xa7)+_0x5bf426[_0x406c89(0xc5)]+_0x406c89(0xbf)+(_0x2fe02f?.[_0x406c89(0xb3)]??_0x406c89(0x9f))+_0x406c89(0xb5));return{'input':_0x5bf426,'replacement':_0x531484,'beforeRecord':_0x2fe02f,'before':projectAppRule(_0x5bf426[_0x406c89(0xc8)],_0x2fe02f),'planned':{'type':_0x5bf426['type'],'fileName':appRuleFileName(_0x5bf426[_0x406c89(0xc8)]),'contextScope':appRuleContextScope(_0x5bf426[_0x406c89(0xc8)]),'enabled':!![],'appCode':_0x570e61[_0x406c89(0xb6)],'scope':'rules','contentByteSize':_0x531484[_0x406c89(0xb0)],'contentHash':_0x531484['contentHash']}};}function warningsFor(_0x35d559){return _0x35d559===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':'rule','command':'set','description':a227_0x44be98(0xcd),'risk':a227_0x44be98(0xbe),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':'file','type':'string','required':!![],'description':'UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'},{'name':a227_0x44be98(0xac),'type':a227_0x44be98(0xc7),'required':![],'description':'Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version'}],async 'validate'(_0x3c2c52){readSetInput(_0x3c2c52);},async 'dryRun'(_0xba2fd1){const _0x19e4b8=a227_0x44be98,_0x74df7b=await prepareSet(_0xba2fd1);return asDryRunResult({'operation':'set','selector':{'appCode':_0xba2fd1['appCode'],'scope':_0x19e4b8(0xa6),'type':_0x74df7b[_0x19e4b8(0xc6)][_0x19e4b8(0xc8)]},'before':_0x74df7b[_0x19e4b8(0xa1)],'after':_0x74df7b[_0x19e4b8(0xb9)],'dryRun':!![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':warningsFor(_0x74df7b['input'][_0x19e4b8(0xc5)]),'verification':{'expectedVersion':_0x74df7b['input'][_0x19e4b8(0xc5)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x19e4b8(0xad)+_0x74df7b[_0x19e4b8(0xc6)][_0x19e4b8(0xc8)]+_0x19e4b8(0xbd)}},{'method':'POST','url':SAVE_PATH});},async 'execute'(_0x352b14){const _0x4bb5ac=a227_0x44be98,_0x42d7f5=await prepareSet(_0x352b14);let _0x108fde=![];try{await saveAppRule(_0x352b14[_0x4bb5ac(0xb2)],{'appCode':_0x352b14['appCode'],'type':_0x42d7f5[_0x4bb5ac(0xc6)]['type'],'content':_0x42d7f5[_0x4bb5ac(0xbb)][_0x4bb5ac(0xa9)]});}catch(_0x412fe4){if(!isPlatformTransportFailure(_0x412fe4))throw _0x412fe4;_0x108fde=!![];}let _0xf4bce2;try{_0xf4bce2=await getAppRule(_0x352b14[_0x4bb5ac(0xb2)],{'appCode':_0x352b14[_0x4bb5ac(0xb6)],'type':_0x42d7f5[_0x4bb5ac(0xc6)]['type']});}catch(_0x515e2e){const _0x258e52=appRuleError(_0x108fde?_0x4bb5ac(0xc4):_0x4bb5ac(0xa5),_0x4bb5ac(0xcb)+appRuleFileName(_0x42d7f5[_0x4bb5ac(0xc6)][_0x4bb5ac(0xc8)])+_0x4bb5ac(0xba),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object['defineProperty'](_0x258e52,_0x4bb5ac(0xc1),{'value':_0x515e2e,'enumerable':![]});throw _0x258e52;}const _0x26fd61=_0xf4bce2&&inspectAppRuleContent(_0xf4bce2[_0x4bb5ac(0xa9)])[_0x4bb5ac(0x9a)]===_0x42d7f5[_0x4bb5ac(0xbb)][_0x4bb5ac(0x9a)],_0xf2180b=_0xf4bce2&&(_0x42d7f5[_0x4bb5ac(0xca)]===null||_0xf4bce2[_0x4bb5ac(0xb3)]>_0x42d7f5[_0x4bb5ac(0xca)][_0x4bb5ac(0xb3)]);if(!_0xf4bce2||!_0x26fd61||!_0xf2180b)throw appRuleError(_0x108fde?_0x4bb5ac(0xc4):'app_rule_verification_failed',appRuleFileName(_0x42d7f5[_0x4bb5ac(0xc6)][_0x4bb5ac(0xc8)])+_0x4bb5ac(0xb1),_0x4bb5ac(0xce)+_0x42d7f5[_0x4bb5ac(0xc6)]['type']+_0x4bb5ac(0x9d));const _0x5d402f=warningsFor(_0x42d7f5[_0x4bb5ac(0xc6)]['expectedVersion']);_0x108fde&&_0x5d402f[_0x4bb5ac(0xcc)](_0x4bb5ac(0xab));const _0x33c16e=projectAppRule(_0x42d7f5[_0x4bb5ac(0xc6)][_0x4bb5ac(0xc8)],_0xf4bce2);return{'ok':!![],'data':{'operation':_0x4bb5ac(0xa8),'selector':{'appCode':_0x352b14[_0x4bb5ac(0xb6)],'scope':'rules','type':_0x42d7f5['input'][_0x4bb5ac(0xc8)]},'before':_0x42d7f5['before'],'after':_0x33c16e,'dryRun':![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':_0x5d402f,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0x108fde,'expectedVersion':_0x42d7f5[_0x4bb5ac(0xc6)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x4bb5ac(0xad)+_0x42d7f5[_0x4bb5ac(0xc6)][_0x4bb5ac(0xc8)]+_0x4bb5ac(0xbd)}},'message':_0x4bb5ac(0xc3)+appRuleFileName(_0x42d7f5[_0x4bb5ac(0xc6)]['type'])+_0x4bb5ac(0xc9)+_0x352b14['appCode']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a228_0x490b(_0x206d71,_0x36d68b){_0x206d71=_0x206d71-0x18f;const _0x31a97c=a228_0x31a9();let _0x490b86=_0x31a97c[_0x206d71];return _0x490b86;}const a228_0x1faed0=a228_0x490b;(function(_0x2061d8,_0x47f09c){const _0x4003e6=a228_0x490b,_0x3ae9b3=_0x2061d8();while(!![]){try{const _0x4beef0=parseInt(_0x4003e6(0x1b4))/0x1*(-parseInt(_0x4003e6(0x1a6))/0x2)+parseInt(_0x4003e6(0x198))/0x3+parseInt(_0x4003e6(0x1a0))/0x4*(-parseInt(_0x4003e6(0x1b6))/0x5)+-parseInt(_0x4003e6(0x190))/0x6+-parseInt(_0x4003e6(0x196))/0x7+-parseInt(_0x4003e6(0x1af))/0x8*(parseInt(_0x4003e6(0x1ad))/0x9)+parseInt(_0x4003e6(0x1aa))/0xa;if(_0x4beef0===_0x47f09c)break;else _0x3ae9b3['push'](_0x3ae9b3['shift']());}catch(_0x38f97f){_0x3ae9b3['push'](_0x3ae9b3['shift']());}}}(a228_0x31a9,0xccb45));function a228_0x31a9(){const _0x1605d5=['Pass\x20a\x20UTF-8\x20Markdown\x20file.','4XfnhEY','byteSize','byteLength','scope','app_rule_file_invalid','app_rule_file_unreadable','28542DWfPyW','rules','App\x20rule\x20file\x20is\x20blank:\x20','trim','22274080SyMsFc','appCode','utf-8','78588WnPdvO','app_rule_type_invalid','392YIEKbg','content','decode','str','sha256:','1JQmprx','app_rule_content_invalid','7619330eFgstl','contentHash','page-api-development','createTime','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','app_rule_content_too_large','Cannot\x20read\x20app\x20rule\x20file:\x20','database','331836twtCMs','version','toLowerCase','message','hex','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','6283095oiNQLM','utf8','4589871RuEbJx','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','type','RULES.md','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','digest','updateTime'];a228_0x31a9=function(){return _0x1605d5;};return a228_0x31a9();}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=[a228_0x1faed0(0x1a7),a228_0x1faed0(0x18f)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a228_0x1faed0(0x19b),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a228_0x1faed0(0x1b8),'database':'database-analysis'};export function appRuleError(_0x2d97b3,_0x5c31b5,_0x1382c3){return new CliError(_0x2d97b3,0x1,_0x5c31b5,_0x1382c3);}export function readAppRuleType(_0x264649){const _0x170719=a228_0x1faed0,_0x13b6e0=_0x264649[_0x170719(0x1b2)](_0x170719(0x19a))[_0x170719(0x1a9)]()[_0x170719(0x192)]();if(_0x13b6e0!=='rules'&&_0x13b6e0!=='database')throw appRuleError(_0x170719(0x1ae),_0x170719(0x1ba));return _0x13b6e0;}export function appRuleFileName(_0x1a6ab6){return APP_RULE_FILES[_0x1a6ab6];}export function appRuleContextScope(_0x303e78){return APP_RULE_CONTEXT_SCOPES[_0x303e78];}export function inspectAppRuleContent(_0xdc4a7e){const _0x882ea1=a228_0x1faed0,_0xf24135=Buffer['from'](_0xdc4a7e,_0x882ea1(0x197));return{'content':_0xdc4a7e,'byteSize':_0xf24135[_0x882ea1(0x1a2)],'contentHash':_0x882ea1(0x1b3)+createHash('sha256')['update'](_0xf24135)[_0x882ea1(0x19d)](_0x882ea1(0x194))};}export async function readAppRuleFile(_0x157d11){const _0x3e7066=a228_0x1faed0,_0x1cc761=_0x157d11['trim']();if(!_0x1cc761)throw appRuleError('app_rule_file_required','--file\x20is\x20required.',_0x3e7066(0x19f));const _0x3bd529=resolve(_0x1cc761);let _0x123ed8;try{_0x123ed8=await stat(_0x3bd529);}catch(_0x2357e3){throw appRuleError(_0x3e7066(0x1a5),'Cannot\x20access\x20app\x20rule\x20file:\x20'+_0x1cc761,_0x2357e3 instanceof Error?_0x2357e3['message']:String(_0x2357e3));}if(!_0x123ed8['isFile']())throw appRuleError(_0x3e7066(0x1a4),_0x3e7066(0x195)+_0x1cc761);if(_0x123ed8['size']>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x415906;try{_0x415906=await readFile(_0x3bd529);}catch(_0x366e3a){throw appRuleError(_0x3e7066(0x1a5),_0x3e7066(0x1bc)+_0x1cc761,_0x366e3a instanceof Error?_0x366e3a[_0x3e7066(0x193)]:String(_0x366e3a));}if(_0x415906[_0x3e7066(0x1a2)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x3e7066(0x1bb),_0x3e7066(0x199));let _0x5b47b8;try{_0x5b47b8=new TextDecoder(_0x3e7066(0x1ac),{'fatal':!![],'ignoreBOM':!![]})[_0x3e7066(0x1b1)](_0x415906);}catch{throw appRuleError(_0x3e7066(0x1b5),_0x3e7066(0x19c)+_0x1cc761);}if(!_0x5b47b8['trim']())throw appRuleError('app_rule_content_invalid',_0x3e7066(0x1a8)+_0x1cc761);return inspectAppRuleContent(_0x5b47b8);}export function projectAppRule(_0x44aab0,_0x2fc8a8){const _0xba2d21=a228_0x1faed0;if(!_0x2fc8a8)return{'type':_0x44aab0,'fileName':appRuleFileName(_0x44aab0),'contextScope':appRuleContextScope(_0x44aab0),'enabled':![]};const _0x4787a8=inspectAppRuleContent(_0x2fc8a8[_0xba2d21(0x1b0)]);return{'type':_0x44aab0,'fileName':appRuleFileName(_0x44aab0),'contextScope':appRuleContextScope(_0x44aab0),'enabled':!![],'id':_0x2fc8a8['id'],'scope':_0x2fc8a8[_0xba2d21(0x1a3)],'appCode':_0x2fc8a8[_0xba2d21(0x1ab)],'version':_0x2fc8a8[_0xba2d21(0x191)],'contentByteSize':_0x4787a8[_0xba2d21(0x1a1)],'contentHash':_0x4787a8[_0xba2d21(0x1b7)],..._0x2fc8a8['createTime']!==undefined&&_0x2fc8a8[_0xba2d21(0x1b9)]!==null?{'createTime':_0x2fc8a8['createTime']}:{},..._0x2fc8a8[_0xba2d21(0x19e)]!==undefined&&_0x2fc8a8[_0xba2d21(0x19e)]!==null?{'updateTime':_0x2fc8a8[_0xba2d21(0x19e)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':'string','required':!![],'description':'Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a229_0x230d2c=a229_0x3cf2;(function(_0x550efe,_0x52347e){const _0x3eee17=a229_0x3cf2,_0xc951a2=_0x550efe();while(!![]){try{const _0xde6253=-parseInt(_0x3eee17(0x216))/0x1*(parseInt(_0x3eee17(0x1f3))/0x2)+parseInt(_0x3eee17(0x1da))/0x3*(parseInt(_0x3eee17(0x1f0))/0x4)+parseInt(_0x3eee17(0x1f9))/0x5*(parseInt(_0x3eee17(0x1ff))/0x6)+-parseInt(_0x3eee17(0x1de))/0x7*(-parseInt(_0x3eee17(0x203))/0x8)+parseInt(_0x3eee17(0x202))/0x9+parseInt(_0x3eee17(0x1e8))/0xa*(parseInt(_0x3eee17(0x1fb))/0xb)+parseInt(_0x3eee17(0x1e7))/0xc*(-parseInt(_0x3eee17(0x211))/0xd);if(_0xde6253===_0x52347e)break;else _0xc951a2['push'](_0xc951a2['shift']());}catch(_0x251095){_0xc951a2['push'](_0xc951a2['shift']());}}}(a229_0x23f7,0xdc336));function a229_0x3cf2(_0x3c2cca,_0x13da30){_0x3c2cca=_0x3c2cca-0x1d7;const _0x23f73b=a229_0x23f7();let _0x3cf2d7=_0x23f73b[_0x3c2cca];return _0x3cf2d7;}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';function a229_0x23f7(){const _0x19af24=['\x20\x20\x20\x20','(none)','246876yYiAPu','\x22\x20not\x20found\x20in\x20package.json.','join','3246606WWCxAZ','8bcMhHB','.bin','utf-8','dev','bun.lockb','start','needsUpgrade','build','\x20run\x20','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','Script\x20name\x20defined\x20in\x20package.json','args','validation','all','143QNPOlN','Script\x20\x22','vite','script','changed','7APUTSs','bun','close','pnpm','vite\x20preview\x20exited\x20with\x20code\x20','cwd','\x0a\x20\x20Usage:\x20','\x20\x20EXAMPLES','35505hyRFUG','No\x20package.json\x20found\x20in\x20current\x20directory.','preview','Enable\x20watch\x20mode\x20for\x20preview','1525923agQgtq','bool','scripts','boolean','error','Domain\x20routing\x20synchronized:\x20','\x20run\x20start','parse','Available:\x20','2704272auAvTB','50DOTcsz','log','length','\x20run\x20build','yarn.lock','keys','node_modules','yarn','244ugHsKc','has','slice','80922xcHXcX','write','inherit','path','run','watch','185yGWiTq','push','1850255ZblMgD','--watch'];a229_0x23f7=function(){return _0x19af24;};return a229_0x23f7();}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([a229_0x230d2c(0x208),a229_0x230d2c(0x206)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a229_0x230d2c(0x208),a229_0x230d2c(0x206),a229_0x230d2c(0x20a),a229_0x230d2c(0x1dc)]);export function syncProjectDomainRoutingBeforeScript(_0x5686fe,_0x67ca6f){const _0x40d964=a229_0x230d2c;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x40d964(0x1f1)](_0x67ca6f))return null;const _0xdafbc1=findProjectRootDirectory(_0x5686fe);if(!resolveConfigPath(_0xdafbc1))return null;const _0x4fc151=writeProjectDomainRoutingManifest(_0xdafbc1);return{'path':_0x4fc151['path'],'changed':_0x4fc151[_0x40d964(0x215)]};}function readPackageScripts(_0x3a37ba){const _0xeda074=a229_0x230d2c,_0x3b14b2=resolve(_0x3a37ba,'package.json');if(!existsSync(_0x3b14b2))return null;try{const _0x4dc2ab=JSON[_0xeda074(0x1e5)](readFileSync(_0x3b14b2,_0xeda074(0x205)));return _0x4dc2ab[_0xeda074(0x1e0)]??{};}catch{return null;}}function detectPackageManager(_0x3be1eb){const _0x3499d4=a229_0x230d2c;if(existsSync(resolve(_0x3be1eb,_0x3499d4(0x207)))||existsSync(resolve(_0x3be1eb,'bun.lock')))return _0x3499d4(0x217);if(existsSync(resolve(_0x3be1eb,'pnpm-lock.yaml')))return _0x3499d4(0x219);if(existsSync(resolve(_0x3be1eb,_0x3499d4(0x1ec))))return _0x3499d4(0x1ef);return'npm';}async function versionCheck(_0x38d51e){const _0x25dfc1=a229_0x230d2c,_0x2ee917=await checkCliVersion();(_0x2ee917['needsUpgrade']||_0x2ee917['belowMinimum'])&&(printCliUpgradeWarning(_0x2ee917),assertCliVersionSupported(_0x2ee917));const _0x500869=await checkSdkVersion(_0x38d51e);if(_0x500869[_0x25dfc1(0x209)])printSdkUpgradeWarning(_0x500869);}function spawnScript(_0x803404,_0x5e8ce9,_0x2b3415,_0x334175){return new Promise((_0x1a4ee5,_0x407672)=>{const _0x540768=a229_0x3cf2,_0x5b8058=[_0x540768(0x1f7),_0x5e8ce9,..._0x2b3415],_0xc9f6ff=spawn(_0x803404,_0x5b8058,{'cwd':_0x334175,'stdio':_0x540768(0x1f5),'shell':!![],'env':{...process.env,'PATH':''+join(_0x334175,_0x540768(0x1ee),_0x540768(0x204))+delimiter+process.env.PATH}});_0xc9f6ff['on'](_0x540768(0x218),_0x4ad619=>{const _0x3536d7=_0x540768;if(_0x4ad619===0x0||_0x4ad619===null)_0x1a4ee5();else _0x407672(new Error(_0x803404+_0x3536d7(0x20b)+_0x5e8ce9+'\x20exited\x20with\x20code\x20'+_0x4ad619));}),_0xc9f6ff['on'](_0x540768(0x1e2),_0x407672);});}function spawnViteBuildWatch(_0x2bcb23){return new Promise((_0x1d5783,_0x425ee4)=>{const _0x2c7b9e=a229_0x3cf2,_0x37c2a0=spawn(_0x2c7b9e(0x213),[_0x2c7b9e(0x20a),_0x2c7b9e(0x1fc)],{'cwd':_0x2bcb23,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x2bcb23,'node_modules','.bin')+delimiter+process.env.PATH}});_0x37c2a0['on']('close',_0x2c997c=>{const _0x2304b5=_0x2c7b9e;if(_0x2c997c===0x0||_0x2c997c===null)_0x1d5783();else _0x425ee4(new Error(_0x2304b5(0x20c)+_0x2c997c));}),_0x37c2a0['on'](_0x2c7b9e(0x1e2),_0x425ee4);});}function spawnVitePreview(_0x3202b2){return new Promise((_0x2a5da7,_0x782266)=>{const _0x491a14=a229_0x3cf2,_0x55ca7c=spawn(_0x491a14(0x213),['preview'],{'cwd':_0x3202b2,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x3202b2,_0x491a14(0x1ee),'.bin')+delimiter+process.env.PATH}});_0x55ca7c['on'](_0x491a14(0x218),_0x115a68=>{const _0x27876a=_0x491a14;if(_0x115a68===0x0||_0x115a68===null)_0x2a5da7();else _0x782266(new Error(_0x27876a(0x21a)+_0x115a68));}),_0x55ca7c['on'](_0x491a14(0x1e2),_0x782266);});}const runFlags=[{'name':'watch','type':a229_0x230d2c(0x1e1),'description':a229_0x230d2c(0x1dd),'default':![]}];export const runDefinition={'service':'run','command':'run','description':'Run\x20a\x20package.json\x20script','risk':a229_0x230d2c(0x1f4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a229_0x230d2c(0x214),'description':a229_0x230d2c(0x20d),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x10eb97=a229_0x230d2c,_0x397f14=[];return _0x397f14[_0x10eb97(0x1fa)](_0x10eb97(0x1d9)),_0x397f14[_0x10eb97(0x1fa)](_0x10eb97(0x1fd)+CLI_BIN_NAME+_0x10eb97(0x1e4)),_0x397f14[_0x10eb97(0x1fa)](_0x10eb97(0x1fd)+CLI_BIN_NAME+_0x10eb97(0x1eb)),_0x397f14[_0x10eb97(0x1fa)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview'),_0x397f14[_0x10eb97(0x1fa)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x397f14[_0x10eb97(0x201)]('\x0a');},async 'execute'(_0x812fbc){const _0x186d3b=a229_0x230d2c,_0x3cef0f=process[_0x186d3b(0x1d7)](),_0x532fff=_0x812fbc[_0x186d3b(0x20e)][0x0],_0x5d30e=_0x812fbc[_0x186d3b(0x20e)][_0x186d3b(0x1f2)](0x1),_0x506ce1=readPackageScripts(_0x3cef0f);if(!_0x506ce1)throw CliErrors['validation'](_0x186d3b(0x1db));if(!_0x532fff){const _0x1924a6=Object[_0x186d3b(0x1ed)](_0x506ce1);if(_0x1924a6[_0x186d3b(0x1ea)]===0x0)console['log']('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x186d3b(0x1e9)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x52fe34 of _0x1924a6){console['log'](_0x186d3b(0x1fd)+_0x52fe34);}console[_0x186d3b(0x1e9)](_0x186d3b(0x1d8)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x506ce1[_0x532fff])throw CliErrors[_0x186d3b(0x20f)](_0x186d3b(0x212)+_0x532fff+_0x186d3b(0x200),_0x186d3b(0x1e6)+(Object['keys'](_0x506ce1)[_0x186d3b(0x201)](',\x20')||_0x186d3b(0x1fe)));const _0x17e5bb=detectPackageManager(_0x3cef0f),_0xe101c7=syncProjectDomainRoutingBeforeScript(_0x3cef0f,_0x532fff);_0xe101c7?.[_0x186d3b(0x215)]&&console[_0x186d3b(0x1e2)](_0x186d3b(0x1e3)+_0xe101c7[_0x186d3b(0x1f6)]);VERSION_CHECK_SCRIPTS['has'](_0x532fff)&&await versionCheck(_0x3cef0f);if(_0x532fff===_0x186d3b(0x1dc)&&_0x812fbc[_0x186d3b(0x1df)](_0x186d3b(0x1f8)))return await Promise[_0x186d3b(0x210)]([spawnViteBuildWatch(_0x3cef0f),spawnVitePreview(_0x3cef0f)]),{'ok':!![]};return await spawnScript(_0x17e5bb,_0x532fff,_0x5d30e,_0x3cef0f),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a230_0x5566(_0x417388,_0x154663){_0x417388=_0x417388-0x10d;const _0xa2ef51=a230_0xa2ef();let _0x556698=_0xa2ef51[_0x417388];return _0x556698;}const a230_0xfa28ef=a230_0x5566;(function(_0xc7aa52,_0x1749a1){const _0x185fa3=a230_0x5566,_0x5f0b32=_0xc7aa52();while(!![]){try{const _0x426859=parseInt(_0x185fa3(0x116))/0x1*(-parseInt(_0x185fa3(0x118))/0x2)+-parseInt(_0x185fa3(0x10e))/0x3+-parseInt(_0x185fa3(0x112))/0x4*(parseInt(_0x185fa3(0x110))/0x5)+parseInt(_0x185fa3(0x117))/0x6*(parseInt(_0x185fa3(0x11c))/0x7)+parseInt(_0x185fa3(0x114))/0x8+parseInt(_0x185fa3(0x11a))/0x9*(parseInt(_0x185fa3(0x11b))/0xa)+parseInt(_0x185fa3(0x119))/0xb;if(_0x426859===_0x1749a1)break;else _0x5f0b32['push'](_0x5f0b32['shift']());}catch(_0x43dfb2){_0x5f0b32['push'](_0x5f0b32['shift']());}}}(a230_0xa2ef,0x66703));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5204f5){const _0x199970=await buildSchemaPayload();return{'ok':!![],'data':_0x199970};}export const schemaDefinition={'service':a230_0xfa28ef(0x113),'command':a230_0xfa28ef(0x10f),'description':a230_0xfa28ef(0x10d),'risk':a230_0xfa28ef(0x115),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a230_0xfa28ef(0x111),'flags':[],'execute':execute};function a230_0xa2ef(){const _0x1dee91=['json','2613392xdDUxx','schema','6240080ibwhQU','read','603998tOxGJV','3880374mAYxOk','2KwoAHV','1063612rrTuKp','639VBeDMg','103910ztmUXE','7RSpANj','Export\x20machine-readable\x20command\x20schema\x20(JSON)','1752777hyaCtg','export','5fVKCGL'];a230_0xa2ef=function(){return _0x1dee91;};return a230_0xa2ef();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a206_0x101467=a206_0x1cb3;(function(_0xd12e8c,_0x5939f0){const _0x3b8db7=a206_0x1cb3,_0x2c1c63=_0xd12e8c();while(!![]){try{const _0x77e8b9=-parseInt(_0x3b8db7(0xf0))/0x1*(-parseInt(_0x3b8db7(0xec))/0x2)+-parseInt(_0x3b8db7(0x115))/0x3*(-parseInt(_0x3b8db7(0x10e))/0x4)+parseInt(_0x3b8db7(0x11c))/0x5*(parseInt(_0x3b8db7(0x12a))/0x6)+-parseInt(_0x3b8db7(0x119))/0x7*(parseInt(_0x3b8db7(0x10d))/0x8)+-parseInt(_0x3b8db7(0x117))/0x9*(parseInt(_0x3b8db7(0x12b))/0xa)+-parseInt(_0x3b8db7(0xf8))/0xb+parseInt(_0x3b8db7(0x122))/0xc*(parseInt(_0x3b8db7(0x116))/0xd);if(_0x77e8b9===_0x5939f0)break;else _0x2c1c63['push'](_0x2c1c63['shift']());}catch(_0x162adc){_0x2c1c63['push'](_0x2c1c63['shift']());}}}(a206_0x71d5,0xda73f));import{writeFile}from'node:fs/promises';function a206_0x1cb3(_0x2edacc,_0x2aec67){_0x2edacc=_0x2edacc-0xe8;const _0x71d598=a206_0x71d5();let _0x1cb344=_0x71d598[_0x2edacc];return _0x1cb344;}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';function a206_0x71d5(){const _0x6019f4=['Select\x20the\x20target\x20database:','sqlRoot','mybatisXml','1317WRtUcs','13385047pwekQq','720RaNdLS','catch','166607Wkdtfx','length','flagMissing','80atYzHN','sqlName','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRootDir','isFinite','name','12xUvMiq','Plain\x20SQL\x20(sql)','SELECT\x201\x20AS\x20id;','POST','nonInteractive','db-id','SQL\x20name\x20cannot\x20be\x20empty','join','594840iMWMmE','159170xxNdfY','mode','Select\x20the\x20local\x20SQL\x20mode:','SQL\x20query\x20display\x20name','lockFilePath','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','flag','39306iwvoft','trim','string','str','5WkSpzq','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','/smartapi/custom/saveUserCustomSql','new','✎\x20Enter\x20dbId\x20manually','</select>','dbName','appCode','7863339sgDzOj','isInteger','lastSync','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','utf8','Target\x20database\x20ID','Local\x20SQL\x20file\x20mode','__manual__','Invalid\x20database\x20selection\x20payload:\x20','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','dbId','\x20\x20SELECT\x201\x20AS\x20id','SQL\x20name:','sqlCode','toISOString','sql','write','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','create','parse','456TQJYtw','13900ypFjpD','dbId\x20must\x20be\x20a\x20positive\x20integer','MyBatis\x20XML\x20(mybatisXml)','number'];a206_0x71d5=function(){return _0x6019f4;};return a206_0x71d5();}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(_0x38aa85){const _0x46a1c2=a206_0x1cb3;if(_0x38aa85===_0x46a1c2(0x114))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x46a1c2(0x104),_0x46a1c2(0xf5),''][_0x46a1c2(0x129)]('\x0a');return[_0x46a1c2(0x124),''][_0x46a1c2(0x129)]('\x0a');}export const sqlCreate={'service':a206_0x101467(0x108),'command':a206_0x101467(0x10b),'description':a206_0x101467(0x101),'risk':a206_0x101467(0x109),'flags':[{'name':a206_0x101467(0x121),'type':a206_0x101467(0xee),'description':a206_0x101467(0x12e)},{'name':a206_0x101467(0x127),'type':'number','description':a206_0x101467(0xfd)},{'name':a206_0x101467(0x12c),'type':'string','enum':[a206_0x101467(0x108),a206_0x101467(0x114)],'description':a206_0x101467(0xfe)}],async 'validate'(_0xccedca){const _0x304a0a=a206_0x101467;if(!_0xccedca['nonInteractive'])return;if(!_0xccedca['str']('name')['trim']())throw CliErrors['flagMissing'](_0x304a0a(0x121),_0x304a0a(0xe9));const _0x4446cd=resolveProvidedDbId(_0xccedca);if(typeof _0x4446cd!==_0x304a0a(0x111)||!Number[_0x304a0a(0x120)](_0x4446cd)||_0x4446cd<=0x0)throw CliErrors[_0x304a0a(0x11b)](_0x304a0a(0x127),_0x304a0a(0x11e));if(!_0xccedca['str']('mode')['trim']())throw CliErrors[_0x304a0a(0x11b)](_0x304a0a(0x12c),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x418813){const _0x233466=a206_0x101467,_0x5be692=loadSqlProjectConfig(_0x418813['appCode']),{sqlName:_0x2b9cf7,dbId:_0x562540,dbName:_0x26cb02,mode:_0x76cd25}=await resolveSqlNewInputs(_0x418813),_0x192a0c=buildSqlRelativePath('<server-generated-sqlCode>',_0x2b9cf7,_0x26cb02,_0x76cd25,_0x562540),_0x67dbcc=_0x5be692[_0x233466(0x11f)]+'/'+_0x192a0c;return{'method':_0x233466(0x125),'url':_0x233466(0xf2),'body':{'appCode':_0x418813[_0x233466(0xf7)],'sqlName':_0x2b9cf7,'dbId':_0x562540,'mode':_0x76cd25,'localPath':_0x67dbcc},'description':_0x233466(0xfb)+_0x5be692[_0x233466(0x11f)]};},async 'execute'(_0x379a8c){const _0xa60e21=a206_0x101467,_0x5a5da2=loadSqlProjectConfig(_0x379a8c[_0xa60e21(0xf7)]),{sqlName:_0x249418,dbId:_0x38f4d1,dbName:_0x3b5037,mode:_0x4dd1a8}=await resolveSqlNewInputs(_0x379a8c),_0x1c5506=generateSqlTemplate(_0x4dd1a8),_0x38590c=await createSqlQuery({'appCode':_0x379a8c['appCode'],'sqlName':_0x249418,'dbId':_0x38f4d1,'sqlContent':_0x1c5506}),_0x5efb9e=ensureRemoteSqlContent(_0x38590c),_0x2a1212=_0x3b5037||await getDbName(_0x379a8c['appCode'],_0x38f4d1)[_0xa60e21(0x118)](()=>undefined),_0x5c5f45=buildSqlRelativePath(_0x38590c[_0xa60e21(0x106)],_0x38590c[_0xa60e21(0x11d)],_0x2a1212,_0x4dd1a8,_0x38f4d1),_0x562088=_0x5a5da2[_0xa60e21(0x11f)]+'/'+_0x5c5f45,_0x39a475=buildLocalSqlFileContent({'sqlCode':_0x38590c[_0xa60e21(0x106)],'sqlName':_0x38590c[_0xa60e21(0x11d)],'dbId':_0x38590c[_0xa60e21(0x103)]},_0x5efb9e,{'dbName':_0x2a1212,'mode':_0x4dd1a8,'syncedAt':new Date()[_0xa60e21(0x107)](),'description':_0x38590c['description']});if(await fileExists(_0x562088))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x562088);await ensureParentDirectory(_0x562088),await writeFile(_0x562088,_0x39a475,_0xa60e21(0xfc));const _0x133a78=await readSqlLockFile(_0x5a5da2['lockFilePath']),{lockData:_0x1049b2,appLock:_0x1fddcd}=ensureSqlLockScope(_0x133a78??createEmptySqlLock(),_0x5a5da2['appCode'],_0x5a5da2[_0xa60e21(0x113)],_0xa60e21(0xf3));return _0x1fddcd['sqls'][_0x38590c[_0xa60e21(0x106)]]={...buildSqlLockEntry(_0x38590c,_0x5efb9e,computeSqlContentHash(_0x39a475),{'dbName':_0x2a1212}),'path':_0x5c5f45,'mode':_0x4dd1a8},_0x1fddcd[_0xa60e21(0xfa)]=new Date()[_0xa60e21(0x107)](),await writeSqlLockFile(_0x5a5da2[_0xa60e21(0xe8)],_0x1049b2),{'ok':!![],'data':{'id':_0x38590c['id'],'sqlCode':_0x38590c[_0xa60e21(0x106)],'sqlName':_0x38590c[_0xa60e21(0x11d)],'dbId':_0x38590c[_0xa60e21(0x103)],'path':_0x562088,'mode':_0x4dd1a8},'message':'Created\x20SQL\x20query\x20'+_0x38590c[_0xa60e21(0x106)]};}};async function resolveSqlNewInputs(_0x1fba90){const _0x446c64=await resolveSqlNameInput(_0x1fba90),{dbId:_0x5872d4,dbName:_0x373e79}=await resolveDbSelection(_0x1fba90),_0x169c5f=await resolveSqlModeInput(_0x1fba90);return{'sqlName':_0x446c64,'dbId':_0x5872d4,'dbName':_0x373e79,'mode':_0x169c5f};}async function resolveSqlNameInput(_0x5d794c){const _0xb6c7db=a206_0x101467,_0x34e298=_0x5d794c[_0xb6c7db(0xef)]('name')['trim']();if(_0x34e298)return _0x34e298;if(_0x5d794c[_0xb6c7db(0x126)])throw CliErrors['flagMissing'](_0xb6c7db(0x121),_0xb6c7db(0xe9));return(await input({'message':_0xb6c7db(0x105),'validate':_0x2c3b89=>_0x2c3b89[_0xb6c7db(0xed)]()?!![]:_0xb6c7db(0x128)}))[_0xb6c7db(0xed)]();}async function resolveDbSelection(_0xd01abe){const _0x24d7a6=a206_0x101467,_0x436143=resolveProvidedDbId(_0xd01abe);if(typeof _0x436143==='number'&&Number['isFinite'](_0x436143)&&_0x436143>0x0)return{'dbId':_0x436143,'dbName':await getDbName(_0xd01abe[_0x24d7a6(0xf7)],_0x436143)[_0x24d7a6(0x118)](()=>undefined)};if(_0xd01abe[_0x24d7a6(0x126)])throw CliErrors['flagMissing'](_0x24d7a6(0x127),_0x24d7a6(0x11e));const _0x2dabe0=await listDatabases(_0xd01abe[_0x24d7a6(0xf7)])[_0x24d7a6(0x118)](()=>[]);if(_0x2dabe0['length']===0x1)return{'dbId':_0x2dabe0[0x0]['dbId'],'dbName':_0x2dabe0[0x0][_0x24d7a6(0xf6)]};if(_0x2dabe0[_0x24d7a6(0x11a)]>0x1){const _0x174386=await select({'message':_0x24d7a6(0x112),'choices':[..._0x2dabe0['map'](_0x1a27ff=>({'name':_0x1a27ff['dbName']+'\x20('+_0x1a27ff[_0x24d7a6(0x103)]+')','value':serializeDbSelection(_0x1a27ff)})),{'name':_0x24d7a6(0xf4),'value':_0x24d7a6(0xff)}]});if(_0x174386!==_0x24d7a6(0xff))return deserializeDbSelection(_0x174386);}const _0x1845ac=await input({'message':'Target\x20database\x20dbId:','validate':_0x553f54=>{const _0x2a57b8=_0x24d7a6,_0x3678a9=_0x553f54[_0x2a57b8(0xed)]();if(!_0x3678a9)return'dbId\x20cannot\x20be\x20empty';const _0x4f1d50=Number(_0x3678a9);if(!Number[_0x2a57b8(0xf9)](_0x4f1d50)||_0x4f1d50<=0x0)return _0x2a57b8(0x10f);return!![];}});return{'dbId':Number(_0x1845ac[_0x24d7a6(0xed)]())};}async function resolveSqlModeInput(_0x17e598){const _0x391c57=a206_0x101467,_0x168576=_0x17e598[_0x391c57(0xef)](_0x391c57(0x12c))[_0x391c57(0xed)]();if(_0x168576==='sql'||_0x168576==='mybatisXml')return _0x168576;if(_0x17e598['nonInteractive'])throw CliErrors[_0x391c57(0x11b)]('mode',_0x391c57(0xf1));return await select({'message':_0x391c57(0x12d),'choices':[{'name':_0x391c57(0x123),'value':_0x391c57(0x108),'description':_0x391c57(0xea)},{'name':_0x391c57(0x110),'value':_0x391c57(0x114),'description':_0x391c57(0x10a)}]});}function serializeDbSelection(_0x5d3f6a){const _0x2ebc82=a206_0x101467;return JSON[_0x2ebc82(0x102)]({'dbId':_0x5d3f6a[_0x2ebc82(0x103)],'dbName':_0x5d3f6a['dbName']});}function deserializeDbSelection(_0x2cadec){const _0x5d3d94=a206_0x101467;try{const _0x5440f6=JSON[_0x5d3d94(0x10c)](_0x2cadec);if(typeof _0x5440f6[_0x5d3d94(0x103)]===_0x5d3d94(0x111)&&Number[_0x5d3d94(0x120)](_0x5440f6[_0x5d3d94(0x103)]))return{'dbId':_0x5440f6[_0x5d3d94(0x103)],'dbName':_0x5440f6[_0x5d3d94(0xf6)]};}catch{}throw CliErrors['validation'](_0x5d3d94(0x100)+_0x2cadec);}function resolveProvidedDbId(_0xaa849f){const _0x2d4896=a206_0x101467,_0x20ac0e=_0xaa849f[_0x2d4896(0xeb)]('db-id');if(typeof _0x20ac0e===_0x2d4896(0x111)&&Number[_0x2d4896(0x120)](_0x20ac0e))return _0x20ac0e;return undefined;}
|
|
1
|
+
const a231_0x24146a=a231_0x519d;(function(_0x2b88d3,_0x32385d){const _0x577a6a=a231_0x519d,_0x526788=_0x2b88d3();while(!![]){try{const _0x2e9017=parseInt(_0x577a6a(0x143))/0x1+parseInt(_0x577a6a(0x129))/0x2*(-parseInt(_0x577a6a(0x121))/0x3)+-parseInt(_0x577a6a(0x153))/0x4*(-parseInt(_0x577a6a(0x138))/0x5)+parseInt(_0x577a6a(0x127))/0x6+-parseInt(_0x577a6a(0x11e))/0x7*(parseInt(_0x577a6a(0x12b))/0x8)+parseInt(_0x577a6a(0x117))/0x9+parseInt(_0x577a6a(0x11a))/0xa*(parseInt(_0x577a6a(0x139))/0xb);if(_0x2e9017===_0x32385d)break;else _0x526788['push'](_0x526788['shift']());}catch(_0x1c3f77){_0x526788['push'](_0x526788['shift']());}}}(a231_0x550a,0xc0e66));function a231_0x519d(_0x379d20,_0x3702d){_0x379d20=_0x379d20-0x10f;const _0x550a21=a231_0x550a();let _0x519d8c=_0x550a21[_0x379d20];return _0x519d8c;}function a231_0x550a(){const _0x37c63b=['POST','isInteger','map','description','isFinite','utf8','65qkmswR','539LBgHzL','dbName','mybatisXml','db-id','Created\x20SQL\x20query\x20','sqlCode','</select>','__manual__','new','Plain\x20SQL\x20(sql)','446632YRyXbU','toISOString','create','lockFilePath','flagMissing','Target\x20database\x20ID','SQL\x20name:','nonInteractive','string','catch','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sql','appCode','str','flag','write','347836ItqzML','dbId\x20cannot\x20be\x20empty','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','lastSync','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','join','SELECT\x201\x20AS\x20id;','Select\x20the\x20target\x20database:','✎\x20Enter\x20dbId\x20manually','Invalid\x20database\x20selection\x20payload:\x20','2470149ioXHQI','number','Target\x20database\x20dbId:','10370PuEcqD','Local\x20SQL\x20file\x20mode','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','name','4159421aHbgwx','validation','sqlRootDir','219XxmjEh','Select\x20the\x20local\x20SQL\x20mode:','sqls','File\x20already\x20exists:\x20','/smartapi/custom/saveUserCustomSql','dbId','6143460vVScwD','sqlName','25966RBZoBd','\x20\x20SELECT\x201\x20AS\x20id','16BytOXy','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','parse','SQL\x20query\x20display\x20name','mode','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','trim'];a231_0x550a=function(){return _0x37c63b;};return a231_0x550a();}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(_0x3ed812){const _0x2cbc25=a231_0x519d;if(_0x3ed812===_0x2cbc25(0x13b))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x2cbc25(0x12a),_0x2cbc25(0x13f),''][_0x2cbc25(0x112)]('\x0a');return[_0x2cbc25(0x113),''][_0x2cbc25(0x112)]('\x0a');}export const sqlCreate={'service':a231_0x24146a(0x14e),'command':a231_0x24146a(0x145),'description':a231_0x24146a(0x130),'risk':a231_0x24146a(0x152),'flags':[{'name':a231_0x24146a(0x11d),'type':'string','description':a231_0x24146a(0x12e)},{'name':'db-id','type':a231_0x24146a(0x118),'description':a231_0x24146a(0x148)},{'name':'mode','type':a231_0x24146a(0x14b),'enum':[a231_0x24146a(0x14e),a231_0x24146a(0x13b)],'description':a231_0x24146a(0x11b)}],async 'validate'(_0x359cb3){const _0x257004=a231_0x24146a;if(!_0x359cb3[_0x257004(0x14a)])return;if(!_0x359cb3['str']('name')[_0x257004(0x131)]())throw CliErrors['flagMissing']('name',_0x257004(0x14d));const _0x3db38d=resolveProvidedDbId(_0x359cb3);if(typeof _0x3db38d!==_0x257004(0x118)||!Number['isFinite'](_0x3db38d)||_0x3db38d<=0x0)throw CliErrors[_0x257004(0x147)](_0x257004(0x13c),_0x257004(0x11c));if(!_0x359cb3['str'](_0x257004(0x12f))[_0x257004(0x131)]())throw CliErrors[_0x257004(0x147)]('mode',_0x257004(0x12c));},async 'dryRun'(_0x28f552){const _0x1312d2=a231_0x24146a,_0x543c34=loadSqlProjectConfig(_0x28f552[_0x1312d2(0x14f)]),{sqlName:_0x11c66e,dbId:_0x557973,dbName:_0x5eb77a,mode:_0x1c20a1}=await resolveSqlNewInputs(_0x28f552),_0x5a8326=buildSqlRelativePath('<server-generated-sqlCode>',_0x11c66e,_0x5eb77a,_0x1c20a1,_0x557973),_0x41c294=_0x543c34[_0x1312d2(0x120)]+'/'+_0x5a8326;return{'method':_0x1312d2(0x132),'url':_0x1312d2(0x125),'body':{'appCode':_0x28f552[_0x1312d2(0x14f)],'sqlName':_0x11c66e,'dbId':_0x557973,'mode':_0x1c20a1,'localPath':_0x41c294},'description':_0x1312d2(0x10f)+_0x543c34[_0x1312d2(0x120)]};},async 'execute'(_0xbb89fb){const _0x227020=a231_0x24146a,_0x51e514=loadSqlProjectConfig(_0xbb89fb[_0x227020(0x14f)]),{sqlName:_0x67b6c0,dbId:_0x21c36d,dbName:_0x4e0ae7,mode:_0x154df4}=await resolveSqlNewInputs(_0xbb89fb),_0x5b5aad=generateSqlTemplate(_0x154df4),_0x4ac3c6=await createSqlQuery({'appCode':_0xbb89fb[_0x227020(0x14f)],'sqlName':_0x67b6c0,'dbId':_0x21c36d,'sqlContent':_0x5b5aad}),_0x1054c3=ensureRemoteSqlContent(_0x4ac3c6),_0x4c5b79=_0x4e0ae7||await getDbName(_0xbb89fb['appCode'],_0x21c36d)[_0x227020(0x14c)](()=>undefined),_0x166037=buildSqlRelativePath(_0x4ac3c6['sqlCode'],_0x4ac3c6[_0x227020(0x128)],_0x4c5b79,_0x154df4,_0x21c36d),_0x1d826d=_0x51e514[_0x227020(0x120)]+'/'+_0x166037,_0x3d394a=buildLocalSqlFileContent({'sqlCode':_0x4ac3c6[_0x227020(0x13e)],'sqlName':_0x4ac3c6['sqlName'],'dbId':_0x4ac3c6[_0x227020(0x126)]},_0x1054c3,{'dbName':_0x4c5b79,'mode':_0x154df4,'syncedAt':new Date()[_0x227020(0x144)](),'description':_0x4ac3c6[_0x227020(0x135)]});if(await fileExists(_0x1d826d))throw CliErrors[_0x227020(0x11f)](_0x227020(0x124)+_0x1d826d);await ensureParentDirectory(_0x1d826d),await writeFile(_0x1d826d,_0x3d394a,_0x227020(0x137));const _0xdd63c7=await readSqlLockFile(_0x51e514[_0x227020(0x146)]),{lockData:_0x310c75,appLock:_0xe806d5}=ensureSqlLockScope(_0xdd63c7??createEmptySqlLock(),_0x51e514['appCode'],_0x51e514['sqlRoot'],_0x227020(0x141));return _0xe806d5[_0x227020(0x123)][_0x4ac3c6[_0x227020(0x13e)]]={...buildSqlLockEntry(_0x4ac3c6,_0x1054c3,computeSqlContentHash(_0x3d394a),{'dbName':_0x4c5b79}),'path':_0x166037,'mode':_0x154df4},_0xe806d5[_0x227020(0x110)]=new Date()[_0x227020(0x144)](),await writeSqlLockFile(_0x51e514[_0x227020(0x146)],_0x310c75),{'ok':!![],'data':{'id':_0x4ac3c6['id'],'sqlCode':_0x4ac3c6[_0x227020(0x13e)],'sqlName':_0x4ac3c6[_0x227020(0x128)],'dbId':_0x4ac3c6[_0x227020(0x126)],'path':_0x1d826d,'mode':_0x154df4},'message':_0x227020(0x13d)+_0x4ac3c6['sqlCode']};}};async function resolveSqlNewInputs(_0x189827){const _0x2d6c8f=await resolveSqlNameInput(_0x189827),{dbId:_0x1edbbe,dbName:_0xb454c0}=await resolveDbSelection(_0x189827),_0x455cce=await resolveSqlModeInput(_0x189827);return{'sqlName':_0x2d6c8f,'dbId':_0x1edbbe,'dbName':_0xb454c0,'mode':_0x455cce};}async function resolveSqlNameInput(_0x46524b){const _0x1d655f=a231_0x24146a,_0x21847c=_0x46524b[_0x1d655f(0x150)](_0x1d655f(0x11d))['trim']();if(_0x21847c)return _0x21847c;if(_0x46524b['nonInteractive'])throw CliErrors[_0x1d655f(0x147)](_0x1d655f(0x11d),_0x1d655f(0x14d));return(await input({'message':_0x1d655f(0x149),'validate':_0x498a6c=>_0x498a6c[_0x1d655f(0x131)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))['trim']();}async function resolveDbSelection(_0x41b381){const _0x3fff91=a231_0x24146a,_0x371259=resolveProvidedDbId(_0x41b381);if(typeof _0x371259==='number'&&Number[_0x3fff91(0x136)](_0x371259)&&_0x371259>0x0)return{'dbId':_0x371259,'dbName':await getDbName(_0x41b381['appCode'],_0x371259)[_0x3fff91(0x14c)](()=>undefined)};if(_0x41b381[_0x3fff91(0x14a)])throw CliErrors[_0x3fff91(0x147)](_0x3fff91(0x13c),_0x3fff91(0x11c));const _0x1eae1f=await listDatabases(_0x41b381[_0x3fff91(0x14f)])[_0x3fff91(0x14c)](()=>[]);if(_0x1eae1f['length']===0x1)return{'dbId':_0x1eae1f[0x0][_0x3fff91(0x126)],'dbName':_0x1eae1f[0x0]['dbName']};if(_0x1eae1f['length']>0x1){const _0x2d2e00=await select({'message':_0x3fff91(0x114),'choices':[..._0x1eae1f[_0x3fff91(0x134)](_0x5d8a5d=>({'name':_0x5d8a5d[_0x3fff91(0x13a)]+'\x20('+_0x5d8a5d[_0x3fff91(0x126)]+')','value':serializeDbSelection(_0x5d8a5d)})),{'name':_0x3fff91(0x115),'value':_0x3fff91(0x140)}]});if(_0x2d2e00!=='__manual__')return deserializeDbSelection(_0x2d2e00);}const _0x916e3d=await input({'message':_0x3fff91(0x119),'validate':_0x483fa2=>{const _0x3cd37f=_0x3fff91,_0x52f169=_0x483fa2[_0x3cd37f(0x131)]();if(!_0x52f169)return _0x3cd37f(0x154);const _0x32bef0=Number(_0x52f169);if(!Number[_0x3cd37f(0x133)](_0x32bef0)||_0x32bef0<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x916e3d[_0x3fff91(0x131)]())};}async function resolveSqlModeInput(_0x55d050){const _0x2eac5a=a231_0x24146a,_0x90a4bf=_0x55d050[_0x2eac5a(0x150)](_0x2eac5a(0x12f))[_0x2eac5a(0x131)]();if(_0x90a4bf===_0x2eac5a(0x14e)||_0x90a4bf===_0x2eac5a(0x13b))return _0x90a4bf;if(_0x55d050[_0x2eac5a(0x14a)])throw CliErrors[_0x2eac5a(0x147)](_0x2eac5a(0x12f),_0x2eac5a(0x12c));return await select({'message':_0x2eac5a(0x122),'choices':[{'name':_0x2eac5a(0x142),'value':_0x2eac5a(0x14e),'description':_0x2eac5a(0x111)},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x2eac5a(0x13b),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x172317){const _0x14b22b=a231_0x24146a;return JSON['stringify']({'dbId':_0x172317['dbId'],'dbName':_0x172317[_0x14b22b(0x13a)]});}function deserializeDbSelection(_0x5d9692){const _0x483251=a231_0x24146a;try{const _0x1ef4de=JSON[_0x483251(0x12d)](_0x5d9692);if(typeof _0x1ef4de[_0x483251(0x126)]===_0x483251(0x118)&&Number['isFinite'](_0x1ef4de['dbId']))return{'dbId':_0x1ef4de[_0x483251(0x126)],'dbName':_0x1ef4de[_0x483251(0x13a)]};}catch{}throw CliErrors[_0x483251(0x11f)](_0x483251(0x116)+_0x5d9692);}function resolveProvidedDbId(_0x5e880f){const _0x49bfcc=a231_0x24146a,_0x44bedf=_0x5e880f[_0x49bfcc(0x151)](_0x49bfcc(0x13c));if(typeof _0x44bedf===_0x49bfcc(0x118)&&Number['isFinite'](_0x44bedf))return _0x44bedf;return undefined;}
|