@lovrabet/rabetbase-cli 2.5.6 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.d.ts +2 -0
- package/lib/commands/flow/page-list.js +1 -0
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.d.ts +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.d.ts +6 -2
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +26 -6
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.d.ts +12 -0
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +8 -4
- package/skills/rabetbase/guides/approval-flow-development-workflow.md +52 -13
- package/skills/rabetbase/guides/backend-function.md +26 -4
- package/skills/rabetbase/guides/bff-creation-workflow.md +9 -0
- package/skills/rabetbase/guides/cross-database-bff.md +1 -0
- package/skills/rabetbase/guides/custom-page-flow-sdk.md +2 -0
- package/skills/rabetbase/guides/data-api-guidelines.md +2 -0
- package/skills/rabetbase/guides/flow-config-examples.md +75 -0
- package/skills/rabetbase/guides/form-flow-start.md +61 -0
- package/skills/rabetbase/guides/typescript-sdk.md +1 -1
- package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +18 -4
- package/skills/rabetbase/references/rabetbase-codegen-sdk.md +5 -4
- package/skills/rabetbase/references/rabetbase-flow-commands.md +21 -2
- package/skills/rabetbase/references/rabetbase-flow-resources.md +21 -3
- package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +6 -2
- package/skills/rabetbase/references/rabetbase-kb.md +4 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a234_0x19aec3=a234_0x40e1;(function(_0x49dc2d,_0x47c580){const _0x275b43=a234_0x40e1,_0x537b98=_0x49dc2d();while(!![]){try{const _0x1c30b2=parseInt(_0x275b43(0x21e))/0x1+-parseInt(_0x275b43(0x216))/0x2+-parseInt(_0x275b43(0x1ee))/0x3+-parseInt(_0x275b43(0x1f8))/0x4+-parseInt(_0x275b43(0x20f))/0x5*(-parseInt(_0x275b43(0x1e1))/0x6)+-parseInt(_0x275b43(0x1e0))/0x7+parseInt(_0x275b43(0x213))/0x8;if(_0x1c30b2===_0x47c580)break;else _0x537b98['push'](_0x537b98['shift']());}catch(_0x287118){_0x537b98['push'](_0x537b98['shift']());}}}(a234_0x15d8,0x212bd));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a234_0x19aec3(0x212),'required':!![],'description':a234_0x19aec3(0x1fe)};export const ROLE_REF_FLAG={'name':a234_0x19aec3(0x215),'type':a234_0x19aec3(0x203),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a234_0x19aec3(0x224),'type':a234_0x19aec3(0x203),'required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a234_0x19aec3(0x22a),'type':a234_0x19aec3(0x203),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a234_0x19aec3(0x22a),'type':a234_0x19aec3(0x203),'required':!![],'description':a234_0x19aec3(0x20d)};export const REMARK_FLAG={'name':'remark','type':a234_0x19aec3(0x203),'required':![],'description':a234_0x19aec3(0x219)};function a234_0x40e1(_0x350914,_0x2adbb2){_0x350914=_0x350914-0x1db;const _0x15d85c=a234_0x15d8();let _0x40e115=_0x15d85c[_0x350914];return _0x40e115;}export const EXPECT_USER_COUNT_FLAG={'name':a234_0x19aec3(0x205),'type':'number','required':![],'description':a234_0x19aec3(0x221)};export const BUILTIN_ROLE_TYPES=[a234_0x19aec3(0x226),a234_0x19aec3(0x20e),a234_0x19aec3(0x21a)];export function isBuiltinRole(_0x21675a){const _0x34153d=a234_0x19aec3;return BUILTIN_ROLE_TYPES[_0x34153d(0x220)](_0x21675a);}export function assertCustomRole(_0x3a1739,_0x5c1595){const _0x52cf02=a234_0x19aec3;if(_0x3a1739[_0x52cf02(0x200)]!==_0x52cf02(0x1e4))throw CliErrors[_0x52cf02(0x1f4)](_0x52cf02(0x1fd)+_0x5c1595+_0x52cf02(0x202)+_0x3a1739[_0x52cf02(0x227)]+'\x20('+_0x3a1739['roleType']+').',_0x52cf02(0x222));}export function projectRole(_0x333f76){const _0x2e33f3=a234_0x19aec3;return{'id':_0x333f76['id'],'roleName':_0x333f76[_0x2e33f3(0x227)],'roleType':_0x333f76[_0x2e33f3(0x200)],'remark':_0x333f76[_0x2e33f3(0x1ff)],'userCount':_0x333f76[_0x2e33f3(0x1e3)],'permitCount':_0x333f76[_0x2e33f3(0x1f2)],'builtin':isBuiltinRole(_0x333f76[_0x2e33f3(0x200)])};}export async function resolveRoleRef(_0x2aa7bd,_0x3277a7){const _0x4928fb=a234_0x19aec3,_0x39c57f=_0x3277a7[_0x4928fb(0x1f3)]();if(!_0x39c57f)throw CliErrors[_0x4928fb(0x1f4)](_0x4928fb(0x1dc),'Pass\x20--role\x20<id|name>.');if(/^\d+$/['test'](_0x39c57f))return getRoleById(_0x2aa7bd,Number(_0x39c57f));const _0x73e994=await listAllAppRoles(_0x2aa7bd),_0x38275a=_0x73e994[_0x4928fb(0x1f6)](_0x47326d=>_0x47326d['roleName']===_0x39c57f);if(_0x38275a['length']===0x0)throw CliErrors[_0x4928fb(0x1f4)]('Role\x20name\x20\x22'+_0x39c57f+_0x4928fb(0x225)+_0x2aa7bd+'.',_0x4928fb(0x1db));if(_0x38275a[_0x4928fb(0x20b)]>0x1){const _0x32e10e=_0x38275a[_0x4928fb(0x1e9)](_0x3dbe81=>_0x3dbe81['id'])[_0x4928fb(0x1f0)](',\x20');throw CliErrors[_0x4928fb(0x1f4)]('Role\x20name\x20\x22'+_0x39c57f+_0x4928fb(0x217)+_0x32e10e+').',_0x4928fb(0x209));}return _0x38275a[0x0];}export async function getRoleById(_0x5f5291,_0x1df92b){const _0x3ef223=a234_0x19aec3,_0x9ba36a=await listAllAppRoles(_0x5f5291),_0x4cb56f=_0x9ba36a['filter'](_0x24800b=>_0x24800b['id']===_0x1df92b&&(!_0x24800b[_0x3ef223(0x1f5)]||_0x24800b[_0x3ef223(0x1f5)]===_0x5f5291));if(_0x4cb56f[_0x3ef223(0x20b)]!==0x1)throw CliErrors[_0x3ef223(0x1f4)](_0x3ef223(0x1f1)+_0x1df92b+_0x3ef223(0x1f9)+_0x5f5291+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x4cb56f[0x0];}async function listAllAppRoles(_0x32cb4b){const _0x467324=a234_0x19aec3,_0x22fd7d=0x64,_0x3982f1=[];for(let _0x357fc6=0x1;;_0x357fc6+=0x1){const {items:_0x28640d,paging:_0x590fba}=await listAppRoles(_0x32cb4b,{'currentPage':_0x357fc6,'pageSize':_0x22fd7d});_0x3982f1[_0x467324(0x214)](..._0x28640d);if(_0x28640d[_0x467324(0x20b)]<_0x22fd7d||_0x590fba&&_0x3982f1['length']>=_0x590fba['totalCount'])return _0x3982f1;}}function a234_0x15d8(){const _0x24d46f=['string','Pass\x20--user\x20<id>.','expect-user-count','flag','user-add','nickname','Disambiguate\x20with\x20--role\x20<id>.','expectUserCount','length','Pass\x20--user\x20<id|name>.','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','DEV','735adwrDr','Missing\x20user\x20reference.','totalCount','number','4490536tahQGc','push','role','315152ExbSJa','\x22\x20is\x20ambiguous\x20(ids:\x20','\x20members\x20of\x20the\x20OWNER\x20role.','Optional\x20role\x20remark/description','OWNER','test','str','tenant','212797oqVtwT','Multiple\x20tenant\x20members\x20match\x20\x22','includes','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','dryRun','user','\x22\x20not\x20found\x20in\x20app\x20','ADMIN','roleName','/smartapi/permit/user-role/create','Check\x20the\x20nickname/username.\x20','name','User\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Missing\x20role\x20reference.','toLowerCase','POST','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','1522808PgxwWG','3978ewBTPU','\x20member(s)\x20but\x20role\x20has\x20','userCount','CUSTOM','\x20is\x20not\x20a\x20member\x20of\x20role\x20','\x20is\x20already\x20a\x20member\x20of\x20role\x20','No\x20tenant\x20member\x20matches\x20\x22','userId','map','username','Anti-drift\x20check\x20failed:\x20expected\x20','Removed\x20',';\x20no\x20change.','678039IwXfrm','\x20duplicate\x20memberships\x20for\x20user\x20','join','Role\x20id\x20','permitCount','trim','validation','appCode','filter','Pass\x20--role\x20<id|name>.','538292SQHgwv','\x20not\x20found\x20in\x20app\x20','/smartapi/permit/user-role/delete','find','\x22:\x20','Cannot\x20','Role\x20id\x20(from\x20`role\x20list`)','remark','roleType','dev','\x20built-in\x20role\x20'];a234_0x15d8=function(){return _0x24d46f;};return a234_0x15d8();}export async function resolveTenantCode(){const _0x41466e=a234_0x19aec3,_0xc33fb9=await getSessionUserInfo(),_0x114ba9=_0xc33fb9?.[_0x41466e(0x224)]?.[_0x41466e(0x21d)]?.['tenant_code'];if(!_0x114ba9)throw CliErrors['authRequired']('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x114ba9;}function matchMember(_0x4c3b14,_0xa3b914){const _0x15dea5=a234_0x19aec3,_0x467c3c=_0xa3b914[_0x15dea5(0x1f3)]()[_0x15dea5(0x1dd)]();return(_0x4c3b14[_0x15dea5(0x208)]??'')[_0x15dea5(0x1dd)]()===_0x467c3c||(_0x4c3b14[_0x15dea5(0x1ea)]??'')[_0x15dea5(0x1dd)]()===_0x467c3c;}export async function resolveUserRef(_0x2a6928,_0x40e7ee=a234_0x19aec3(0x204)){const _0x530e32=a234_0x19aec3,_0x3de12a=_0x2a6928['trim']();if(!_0x3de12a)throw CliErrors[_0x530e32(0x1f4)](_0x530e32(0x210),_0x530e32(0x20c));const _0x1218da=await resolveTenantCode(),_0x569c9e=await getTenantMembers(_0x1218da);if(/^\d+$/[_0x530e32(0x21b)](_0x3de12a)){const _0x363617=Number(_0x3de12a),_0x3ccd70=_0x569c9e[_0x530e32(0x1fb)](_0x4b80f4=>_0x4b80f4[_0x530e32(0x1e8)]===_0x363617);return{'userId':_0x363617,'username':_0x3ccd70?.[_0x530e32(0x1ea)]??String(_0x363617),'nickname':_0x3ccd70?.[_0x530e32(0x208)],'matchedBy':'id'};}const _0xb923a=_0x569c9e['filter'](_0x4f91d5=>matchMember(_0x4f91d5,_0x3de12a));if(_0xb923a[_0x530e32(0x20b)]===0x0)throw CliErrors[_0x530e32(0x1f4)](_0x530e32(0x1e7)+_0x3de12a+'\x22.',_0x530e32(0x229)+_0x40e7ee);if(_0xb923a[_0x530e32(0x20b)]>0x1){const _0x295837=_0xb923a[_0x530e32(0x1e9)](_0x4e381a=>(_0x4e381a[_0x530e32(0x208)]??_0x4e381a[_0x530e32(0x1ea)]??'?')+'('+_0x4e381a['userId']+')')['join'](',\x20');throw CliErrors['validation'](_0x530e32(0x21f)+_0x3de12a+_0x530e32(0x1fc)+_0x295837+'.',_0x40e7ee);}const _0x1d5993=_0xb923a[0x0];return{'userId':_0x1d5993[_0x530e32(0x1e8)],'username':_0x1d5993[_0x530e32(0x1ea)]??String(_0x1d5993[_0x530e32(0x1e8)]),'nickname':_0x1d5993[_0x530e32(0x208)],'matchedBy':_0x530e32(0x22a)};}export const CREATE_USER_ROLE_PATH=a234_0x19aec3(0x228);export const DELETE_USER_ROLE_PATH=a234_0x19aec3(0x1fa);export function computeRoleUserMutation(_0x75137d){const _0x4c7a7e=a234_0x19aec3,{operation:_0x19b3c0,appCode:_0x1a92d9,role:_0x535d4a,relations:_0x58128a,user:_0x3ec54a}=_0x75137d,_0x379fc0=[...new Set(_0x58128a[_0x4c7a7e(0x1e9)](_0xd09749=>_0xd09749['userId']))],_0x285b0d=[];if(_0x75137d[_0x4c7a7e(0x20a)]!==undefined&&_0x75137d[_0x4c7a7e(0x20a)]!==_0x379fc0[_0x4c7a7e(0x20b)])throw CliErrors[_0x4c7a7e(0x1f4)](_0x4c7a7e(0x1eb)+_0x75137d[_0x4c7a7e(0x20a)]+_0x4c7a7e(0x1e2)+_0x379fc0[_0x4c7a7e(0x20b)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x3f704c=_0x379fc0[_0x4c7a7e(0x220)](_0x3ec54a['userId']),_0x158baf=_0x58128a[_0x4c7a7e(0x1f6)](_0xd01dcb=>_0xd01dcb[_0x4c7a7e(0x1e8)]===_0x3ec54a[_0x4c7a7e(0x1e8)])['map'](_0x2b3129=>_0x2b3129['id']),_0x7d87a9=_0x19b3c0===_0x4c7a7e(0x207)?!_0x3f704c:_0x3f704c;let _0x264e0a=_0x379fc0;_0x19b3c0===_0x4c7a7e(0x207)?_0x3f704c?_0x285b0d[_0x4c7a7e(0x214)](_0x4c7a7e(0x22b)+_0x3ec54a[_0x4c7a7e(0x1e8)]+_0x4c7a7e(0x1e6)+_0x535d4a[_0x4c7a7e(0x227)]+_0x4c7a7e(0x1ed)):_0x264e0a=[..._0x379fc0,_0x3ec54a[_0x4c7a7e(0x1e8)]]:!_0x3f704c?_0x285b0d['push'](_0x4c7a7e(0x22b)+_0x3ec54a[_0x4c7a7e(0x1e8)]+_0x4c7a7e(0x1e5)+_0x535d4a[_0x4c7a7e(0x227)]+_0x4c7a7e(0x1ed)):(_0x264e0a=_0x379fc0[_0x4c7a7e(0x1f6)](_0x1db304=>_0x1db304!==_0x3ec54a['userId']),_0x158baf[_0x4c7a7e(0x20b)]>0x1&&_0x285b0d[_0x4c7a7e(0x214)](_0x4c7a7e(0x1ec)+_0x158baf[_0x4c7a7e(0x20b)]+_0x4c7a7e(0x1ef)+_0x3ec54a['userId']+'.'));const _0x487f68={'scope':_0x4c7a7e(0x201),'operation':_0x19b3c0,'selector':{'appCode':_0x1a92d9,'roleId':_0x535d4a['id'],'roleName':_0x535d4a[_0x4c7a7e(0x227)],'userId':_0x3ec54a[_0x4c7a7e(0x1e8)]},'before':{'userIds':_0x379fc0},'after':{'userIds':_0x264e0a},'dryRun':_0x75137d[_0x4c7a7e(0x223)],'backend':{'method':_0x4c7a7e(0x1de),'path':_0x19b3c0==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x285b0d};return{'mutation':_0x487f68,'changed':_0x7d87a9,'matchingRelationIds':_0x158baf};}export async function loadDevRoleRelations(_0x24e042,_0x363e0f){const _0x4acd64=a234_0x19aec3,_0x81151b=0x64,_0x16f4fb=[];for(let _0x44c828=0x1;;_0x44c828+=0x1){const {items:_0x2040d6,paging:_0x10530e}=await listDevUserRoleRelations(_0x24e042,{'roleId':_0x363e0f,'currentPage':_0x44c828,'pageSize':_0x81151b});_0x16f4fb[_0x4acd64(0x214)](..._0x2040d6);if(_0x2040d6[_0x4acd64(0x20b)]<_0x81151b||_0x10530e&&_0x16f4fb['length']>=_0x10530e[_0x4acd64(0x211)])return _0x16f4fb;}}export function readRoleRef(_0x1dff46){const _0x3a39d1=a234_0x19aec3,_0x14acc5=_0x1dff46[_0x3a39d1(0x21c)](_0x3a39d1(0x215))['trim']();if(!_0x14acc5)throw CliErrors['flagMissing']('role',_0x3a39d1(0x1f7));return _0x14acc5;}export async function prepareUserMutation(_0x2b5fdb,_0x139760,_0x4beb70){const _0x5c7d2f=a234_0x19aec3,_0x17f7d1=readRoleRef(_0x2b5fdb),_0x1986ba=_0x2b5fdb[_0x5c7d2f(0x21c)](_0x5c7d2f(0x224))[_0x5c7d2f(0x1f3)]();if(!_0x1986ba)throw CliErrors['flagMissing']('user',_0x5c7d2f(0x20c));const _0x3c41cd=_0x2b5fdb[_0x5c7d2f(0x206)]('expect-user-count'),_0x327a9b=_0x3c41cd===undefined||_0x3c41cd===null?undefined:Number(_0x3c41cd),_0x282001=await resolveRoleRef(_0x2b5fdb['appCode'],_0x17f7d1);if(_0x282001[_0x5c7d2f(0x200)]===_0x5c7d2f(0x21a))throw CliErrors[_0x5c7d2f(0x1f4)](_0x5c7d2f(0x1fd)+_0x139760+_0x5c7d2f(0x218),_0x5c7d2f(0x1df));const _0x1d3447=await resolveUserRef(_0x1986ba),_0x56b2e1=await loadDevRoleRelations(_0x2b5fdb[_0x5c7d2f(0x1f5)],_0x282001['id']);return{...computeRoleUserMutation({'operation':_0x139760,'appCode':_0x2b5fdb[_0x5c7d2f(0x1f5)],'role':_0x282001,'relations':_0x56b2e1,'user':{'userId':_0x1d3447[_0x5c7d2f(0x1e8)],'username':_0x1d3447[_0x5c7d2f(0x1ea)],'nickname':_0x1d3447[_0x5c7d2f(0x208)]},'dryRun':_0x4beb70,..._0x327a9b!==undefined?{'expectUserCount':_0x327a9b}:{}}),'role':_0x282001,'user':_0x1d3447};}
|
|
1
|
+
const a235_0x33f649=a235_0x12cd;(function(_0x323245,_0x170c30){const _0x5d1179=a235_0x12cd,_0x3838d7=_0x323245();while(!![]){try{const _0x4bc158=-parseInt(_0x5d1179(0x151))/0x1*(parseInt(_0x5d1179(0x163))/0x2)+-parseInt(_0x5d1179(0x154))/0x3+parseInt(_0x5d1179(0x16c))/0x4*(parseInt(_0x5d1179(0x126))/0x5)+-parseInt(_0x5d1179(0x168))/0x6+parseInt(_0x5d1179(0x170))/0x7+-parseInt(_0x5d1179(0x165))/0x8*(-parseInt(_0x5d1179(0x155))/0x9)+parseInt(_0x5d1179(0x13c))/0xa;if(_0x4bc158===_0x170c30)break;else _0x3838d7['push'](_0x3838d7['shift']());}catch(_0x58f709){_0x3838d7['push'](_0x3838d7['shift']());}}}(a235_0x5e39,0x9bbe1));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a235_0x33f649(0x130),'required':!![],'description':a235_0x33f649(0x124)};function a235_0x5e39(){const _0x37ae3b=['roleName','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','\x20member(s)\x20but\x20role\x20has\x20','join','test','find','str','Role\x20id\x20or\x20exact\x20role\x20name','Role\x20id\x20','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','role','934294aaoFTd','length','80aPFVnw','\x20members\x20of\x20the\x20OWNER\x20role.','user-add','5623230KTmVAw','\x22:\x20','roleType','\x20duplicate\x20memberships\x20for\x20user\x20','12BASJDr','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','toLowerCase','2919434KrEdOJ','expectUserCount','Role\x20name','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','authRequired','Role\x20id\x20(from\x20`role\x20list`)','flagMissing','82435vkJcSP','userId','Missing\x20user\x20reference.','Cannot\x20','Check\x20the\x20nickname/username.\x20','dev','filter','validation','remark','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','number','User\x20','string','Multiple\x20tenant\x20members\x20match\x20\x22',';\x20no\x20change.','Removed\x20','push','totalCount','Pass\x20--user\x20<id|name>.','trim','appCode','\x20is\x20already\x20a\x20member\x20of\x20role\x20','22524010XvoWiq','includes','username','user','map','permitCount','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','\x22\x20is\x20ambiguous\x20(ids:\x20','name','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Optional\x20role\x20remark/description','DEV','CUSTOM','Pass\x20--user\x20<id>.','No\x20tenant\x20member\x20matches\x20\x22','tenant_code','\x20is\x20not\x20a\x20member\x20of\x20role\x20','Role\x20name\x20\x22','userCount','expect-user-count','/smartapi/permit/user-role/delete','2QhPwXF','OWNER','flag','1346862pBkfER','215505kucAJM','nickname','/smartapi/permit/user-role/create'];a235_0x5e39=function(){return _0x37ae3b;};return a235_0x5e39();}export const ROLE_REF_FLAG={'name':a235_0x33f649(0x162),'type':'string','required':!![],'description':a235_0x33f649(0x15f)};export const USER_REF_FLAG={'name':a235_0x33f649(0x13f),'type':a235_0x33f649(0x132),'required':!![],'description':a235_0x33f649(0x142)};export const NAME_FLAG={'name':'name','type':a235_0x33f649(0x132),'required':!![],'description':a235_0x33f649(0x172)};export const USER_NAME_FLAG={'name':'name','type':a235_0x33f649(0x132),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a235_0x33f649(0x12e),'type':a235_0x33f649(0x132),'required':![],'description':a235_0x33f649(0x146)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':'number','required':![],'description':a235_0x33f649(0x161)};export const BUILTIN_ROLE_TYPES=['ADMIN',a235_0x33f649(0x147),a235_0x33f649(0x152)];export function isBuiltinRole(_0x255413){return BUILTIN_ROLE_TYPES['includes'](_0x255413);}export function assertCustomRole(_0x4e0d0b,_0x1ce7e7){const _0x41337c=a235_0x33f649;if(_0x4e0d0b[_0x41337c(0x16a)]!==_0x41337c(0x148))throw CliErrors[_0x41337c(0x12d)](_0x41337c(0x129)+_0x1ce7e7+'\x20built-in\x20role\x20'+_0x4e0d0b[_0x41337c(0x158)]+'\x20('+_0x4e0d0b[_0x41337c(0x16a)]+').',_0x41337c(0x16e));}export function projectRole(_0xfef809){const _0x746767=a235_0x33f649;return{'id':_0xfef809['id'],'roleName':_0xfef809[_0x746767(0x158)],'roleType':_0xfef809[_0x746767(0x16a)],'remark':_0xfef809[_0x746767(0x12e)],'userCount':_0xfef809[_0x746767(0x14e)],'permitCount':_0xfef809[_0x746767(0x141)],'builtin':isBuiltinRole(_0xfef809[_0x746767(0x16a)])};}export async function resolveRoleRef(_0x2eb882,_0x135f49){const _0x44de88=a235_0x33f649,_0x21f72c=_0x135f49[_0x44de88(0x139)]();if(!_0x21f72c)throw CliErrors[_0x44de88(0x12d)]('Missing\x20role\x20reference.','Pass\x20--role\x20<id|name>.');if(/^\d+$/[_0x44de88(0x15c)](_0x21f72c))return getRoleById(_0x2eb882,Number(_0x21f72c));const _0x3bb640=await listAllAppRoles(_0x2eb882),_0x5e036f=_0x3bb640[_0x44de88(0x12c)](_0x117dae=>_0x117dae[_0x44de88(0x158)]===_0x21f72c);if(_0x5e036f[_0x44de88(0x164)]===0x0)throw CliErrors[_0x44de88(0x12d)](_0x44de88(0x14d)+_0x21f72c+'\x22\x20not\x20found\x20in\x20app\x20'+_0x2eb882+'.',_0x44de88(0x159));if(_0x5e036f[_0x44de88(0x164)]>0x1){const _0x2b4307=_0x5e036f[_0x44de88(0x140)](_0x2471c=>_0x2471c['id'])[_0x44de88(0x15b)](',\x20');throw CliErrors[_0x44de88(0x12d)](_0x44de88(0x14d)+_0x21f72c+_0x44de88(0x143)+_0x2b4307+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x5e036f[0x0];}export async function getRoleById(_0x3407fb,_0x52d368){const _0x95b281=a235_0x33f649,_0x217b7c=await listAllAppRoles(_0x3407fb),_0x3ff3b5=_0x217b7c[_0x95b281(0x12c)](_0x3affe1=>_0x3affe1['id']===_0x52d368&&(!_0x3affe1[_0x95b281(0x13a)]||_0x3affe1[_0x95b281(0x13a)]===_0x3407fb));if(_0x3ff3b5[_0x95b281(0x164)]!==0x1)throw CliErrors[_0x95b281(0x12d)](_0x95b281(0x160)+_0x52d368+'\x20not\x20found\x20in\x20app\x20'+_0x3407fb+'.',_0x95b281(0x145));return _0x3ff3b5[0x0];}async function listAllAppRoles(_0x528822){const _0x11a0e3=a235_0x33f649,_0x4ab2da=0x64,_0x4113a=[];for(let _0x674a28=0x1;;_0x674a28+=0x1){const {items:_0x602515,paging:_0x510f8e}=await listAppRoles(_0x528822,{'currentPage':_0x674a28,'pageSize':_0x4ab2da});_0x4113a[_0x11a0e3(0x136)](..._0x602515);if(_0x602515[_0x11a0e3(0x164)]<_0x4ab2da||_0x510f8e&&_0x4113a[_0x11a0e3(0x164)]>=_0x510f8e['totalCount'])return _0x4113a;}}export async function resolveTenantCode(){const _0x58596b=a235_0x33f649,_0x1efbd8=await getSessionUserInfo(),_0xf78495=_0x1efbd8?.[_0x58596b(0x13f)]?.['tenant']?.[_0x58596b(0x14b)];if(!_0xf78495)throw CliErrors[_0x58596b(0x123)](_0x58596b(0x173));return _0xf78495;}function matchMember(_0xd57a2c,_0x56a8c8){const _0x388d91=a235_0x33f649,_0x78e218=_0x56a8c8['trim']()[_0x388d91(0x16f)]();return(_0xd57a2c[_0x388d91(0x156)]??'')[_0x388d91(0x16f)]()===_0x78e218||(_0xd57a2c['username']??'')[_0x388d91(0x16f)]()===_0x78e218;}export async function resolveUserRef(_0x1f6e62,_0x18bc71=a235_0x33f649(0x149)){const _0x32478e=a235_0x33f649,_0x39983d=_0x1f6e62[_0x32478e(0x139)]();if(!_0x39983d)throw CliErrors['validation'](_0x32478e(0x128),_0x32478e(0x138));const _0x3509cc=await resolveTenantCode(),_0x290e54=await getTenantMembers(_0x3509cc);if(/^\d+$/[_0x32478e(0x15c)](_0x39983d)){const _0x2e8236=Number(_0x39983d),_0x2c6b89=_0x290e54[_0x32478e(0x15d)](_0xe9e43f=>_0xe9e43f['userId']===_0x2e8236);return{'userId':_0x2e8236,'username':_0x2c6b89?.[_0x32478e(0x13e)]??String(_0x2e8236),'nickname':_0x2c6b89?.[_0x32478e(0x156)],'matchedBy':'id'};}const _0x19bc87=_0x290e54['filter'](_0x54ab08=>matchMember(_0x54ab08,_0x39983d));if(_0x19bc87[_0x32478e(0x164)]===0x0)throw CliErrors['validation'](_0x32478e(0x14a)+_0x39983d+'\x22.',_0x32478e(0x12a)+_0x18bc71);if(_0x19bc87['length']>0x1){const _0x367bbc=_0x19bc87['map'](_0x2869ea=>(_0x2869ea[_0x32478e(0x156)]??_0x2869ea[_0x32478e(0x13e)]??'?')+'('+_0x2869ea[_0x32478e(0x127)]+')')['join'](',\x20');throw CliErrors[_0x32478e(0x12d)](_0x32478e(0x133)+_0x39983d+_0x32478e(0x169)+_0x367bbc+'.',_0x18bc71);}const _0x9637c7=_0x19bc87[0x0];return{'userId':_0x9637c7['userId'],'username':_0x9637c7[_0x32478e(0x13e)]??String(_0x9637c7['userId']),'nickname':_0x9637c7[_0x32478e(0x156)],'matchedBy':_0x32478e(0x144)};}export const CREATE_USER_ROLE_PATH=a235_0x33f649(0x157);export const DELETE_USER_ROLE_PATH=a235_0x33f649(0x150);function a235_0x12cd(_0x309356,_0x3f6edc){_0x309356=_0x309356-0x123;const _0x5e3978=a235_0x5e39();let _0x12cd78=_0x5e3978[_0x309356];return _0x12cd78;}export function computeRoleUserMutation(_0x52089f){const _0x5f00ed=a235_0x33f649,{operation:_0x337bd0,appCode:_0x4a894e,role:_0x3171ce,relations:_0x49e356,user:_0x494c35}=_0x52089f,_0x5d5040=[...new Set(_0x49e356['map'](_0x54f456=>_0x54f456['userId']))],_0x357514=[];if(_0x52089f[_0x5f00ed(0x171)]!==undefined&&_0x52089f[_0x5f00ed(0x171)]!==_0x5d5040['length'])throw CliErrors['validation']('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x52089f[_0x5f00ed(0x171)]+_0x5f00ed(0x15a)+_0x5d5040[_0x5f00ed(0x164)]+'.',_0x5f00ed(0x12f));const _0x1bfe33=_0x5d5040[_0x5f00ed(0x13d)](_0x494c35['userId']),_0x42cfaa=_0x49e356['filter'](_0x4a42fb=>_0x4a42fb['userId']===_0x494c35[_0x5f00ed(0x127)])[_0x5f00ed(0x140)](_0x53b9b3=>_0x53b9b3['id']),_0x536553=_0x337bd0==='user-add'?!_0x1bfe33:_0x1bfe33;let _0xfeeaf9=_0x5d5040;_0x337bd0===_0x5f00ed(0x167)?_0x1bfe33?_0x357514[_0x5f00ed(0x136)](_0x5f00ed(0x131)+_0x494c35['userId']+_0x5f00ed(0x13b)+_0x3171ce[_0x5f00ed(0x158)]+_0x5f00ed(0x134)):_0xfeeaf9=[..._0x5d5040,_0x494c35[_0x5f00ed(0x127)]]:!_0x1bfe33?_0x357514[_0x5f00ed(0x136)](_0x5f00ed(0x131)+_0x494c35[_0x5f00ed(0x127)]+_0x5f00ed(0x14c)+_0x3171ce[_0x5f00ed(0x158)]+';\x20no\x20change.'):(_0xfeeaf9=_0x5d5040['filter'](_0x4063bb=>_0x4063bb!==_0x494c35[_0x5f00ed(0x127)]),_0x42cfaa[_0x5f00ed(0x164)]>0x1&&_0x357514[_0x5f00ed(0x136)](_0x5f00ed(0x135)+_0x42cfaa[_0x5f00ed(0x164)]+_0x5f00ed(0x16b)+_0x494c35[_0x5f00ed(0x127)]+'.'));const _0x266cba={'scope':_0x5f00ed(0x12b),'operation':_0x337bd0,'selector':{'appCode':_0x4a894e,'roleId':_0x3171ce['id'],'roleName':_0x3171ce[_0x5f00ed(0x158)],'userId':_0x494c35[_0x5f00ed(0x127)]},'before':{'userIds':_0x5d5040},'after':{'userIds':_0xfeeaf9},'dryRun':_0x52089f['dryRun'],'backend':{'method':'POST','path':_0x337bd0===_0x5f00ed(0x167)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x357514};return{'mutation':_0x266cba,'changed':_0x536553,'matchingRelationIds':_0x42cfaa};}export async function loadDevRoleRelations(_0x47046e,_0x2e00f2){const _0x2468f2=a235_0x33f649,_0x16ba5e=0x64,_0x3465f2=[];for(let _0x5860d4=0x1;;_0x5860d4+=0x1){const {items:_0x59a61c,paging:_0x5f8439}=await listDevUserRoleRelations(_0x47046e,{'roleId':_0x2e00f2,'currentPage':_0x5860d4,'pageSize':_0x16ba5e});_0x3465f2[_0x2468f2(0x136)](..._0x59a61c);if(_0x59a61c[_0x2468f2(0x164)]<_0x16ba5e||_0x5f8439&&_0x3465f2['length']>=_0x5f8439[_0x2468f2(0x137)])return _0x3465f2;}}export function readRoleRef(_0x507e12){const _0x5c8daa=a235_0x33f649,_0x4dae85=_0x507e12[_0x5c8daa(0x15e)](_0x5c8daa(0x162))[_0x5c8daa(0x139)]();if(!_0x4dae85)throw CliErrors['flagMissing']('role','Pass\x20--role\x20<id|name>.');return _0x4dae85;}export async function prepareUserMutation(_0x258131,_0x1a78c1,_0x479b47){const _0x3c3ccb=a235_0x33f649,_0x317f85=readRoleRef(_0x258131),_0x31ee5a=_0x258131[_0x3c3ccb(0x15e)](_0x3c3ccb(0x13f))[_0x3c3ccb(0x139)]();if(!_0x31ee5a)throw CliErrors[_0x3c3ccb(0x125)](_0x3c3ccb(0x13f),_0x3c3ccb(0x138));const _0xb925c5=_0x258131[_0x3c3ccb(0x153)](_0x3c3ccb(0x14f)),_0x3ab232=_0xb925c5===undefined||_0xb925c5===null?undefined:Number(_0xb925c5),_0x5efe18=await resolveRoleRef(_0x258131[_0x3c3ccb(0x13a)],_0x317f85);if(_0x5efe18[_0x3c3ccb(0x16a)]===_0x3c3ccb(0x152))throw CliErrors['validation']('Cannot\x20'+_0x1a78c1+_0x3c3ccb(0x166),_0x3c3ccb(0x16d));const _0x34337c=await resolveUserRef(_0x31ee5a),_0x4f6cc1=await loadDevRoleRelations(_0x258131[_0x3c3ccb(0x13a)],_0x5efe18['id']);return{...computeRoleUserMutation({'operation':_0x1a78c1,'appCode':_0x258131[_0x3c3ccb(0x13a)],'role':_0x5efe18,'relations':_0x4f6cc1,'user':{'userId':_0x34337c[_0x3c3ccb(0x127)],'username':_0x34337c[_0x3c3ccb(0x13e)],'nickname':_0x34337c[_0x3c3ccb(0x156)]},'dryRun':_0x479b47,..._0x3ab232!==undefined?{'expectUserCount':_0x3ab232}:{}}),'role':_0x5efe18,'user':_0x34337c};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a236_0x295c6f=a236_0x2f36;function a236_0xee2b(){const _0x41043e=['remark','27736foPGGq','name','/smartapi/permit/role/update','string','dev','validation','2648088FQySnO','flag','appCode','Updated\x20role\x20','572AKvGaF','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','250gHjqkh','45CipLTB','\x20(id=','num','roleName','POST','2357792crmPFV','write','1435698nMKmHF','202190JMlAJE','length','1037930XQeRGO','New\x20role\x20name','7LeayKX','2268UkCnLy','--name\x20cannot\x20be\x20empty.','update'];a236_0xee2b=function(){return _0x41043e;};return a236_0xee2b();}(function(_0x502ddd,_0x7c8c55){const _0x39b5ac=a236_0x2f36,_0x5569c6=_0x502ddd();while(!![]){try{const _0x3c33dc=-parseInt(_0x39b5ac(0x8c))/0x1*(-parseInt(_0x39b5ac(0x9a))/0x2)+parseInt(_0x39b5ac(0x8d))/0x3*(-parseInt(_0x39b5ac(0x7f))/0x4)+parseInt(_0x39b5ac(0x97))/0x5+parseInt(_0x39b5ac(0x94))/0x6+-parseInt(_0x39b5ac(0x99))/0x7*(-parseInt(_0x39b5ac(0x92))/0x8)+parseInt(_0x39b5ac(0x85))/0x9+parseInt(_0x39b5ac(0x95))/0xa*(-parseInt(_0x39b5ac(0x89))/0xb);if(_0x3c33dc===_0x7c8c55)break;else _0x5569c6['push'](_0x5569c6['shift']());}catch(_0x599e43){_0x5569c6['push'](_0x5569c6['shift']());}}}(a236_0xee2b,0x28057));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a236_0x295c6f(0x81);function readPatch(_0x4f87c6){const _0x5441e7=a236_0x295c6f,_0x4fbd29=_0x4f87c6[_0x5441e7(0x86)](_0x5441e7(0x80)),_0x596b91=_0x4f87c6[_0x5441e7(0x86)](_0x5441e7(0x7e)),_0x410de4={};if(_0x4fbd29!==undefined&&_0x4fbd29!==null){const _0x3ada25=String(_0x4fbd29)['trim']();if(!_0x3ada25)throw CliErrors['validation'](_0x5441e7(0x7c));if(_0x3ada25[_0x5441e7(0x96)]>0x40)throw CliErrors[_0x5441e7(0x84)](_0x5441e7(0x8b));_0x410de4[_0x5441e7(0x90)]=_0x3ada25;}_0x596b91!==undefined&&_0x596b91!==null&&(_0x410de4[_0x5441e7(0x7e)]=String(_0x596b91));if(_0x410de4[_0x5441e7(0x90)]===undefined&&_0x410de4[_0x5441e7(0x7e)]===undefined)throw CliErrors[_0x5441e7(0x84)]('Nothing\x20to\x20update.','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.');return _0x410de4;}function a236_0x2f36(_0xc007d5,_0xef9979){_0xc007d5=_0xc007d5-0x7c;const _0xee2b44=a236_0xee2b();let _0x2f361b=_0xee2b44[_0xc007d5];return _0x2f361b;}export const roleUpdate={'service':'role','command':'update','description':a236_0x295c6f(0x8a),'risk':a236_0x295c6f(0x93),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a236_0x295c6f(0x80),'type':a236_0x295c6f(0x82),'required':![],'description':a236_0x295c6f(0x98)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2f1d03){readPatch(_0x2f1d03);},async 'dryRun'(_0x304210){const _0x391b91=a236_0x295c6f,_0xd218e1=_0x304210['num']('id'),_0x2e8ea1=readPatch(_0x304210),_0x26922e=await getRoleById(_0x304210[_0x391b91(0x87)],_0xd218e1);return assertCustomRole(_0x26922e,_0x391b91(0x7d)),asDryRunResult({'scope':_0x391b91(0x83),'operation':_0x391b91(0x7d),'selector':{'appCode':_0x304210[_0x391b91(0x87)],'roleId':_0xd218e1,'roleName':_0x26922e[_0x391b91(0x90)]},'before':projectRole(_0x26922e),'after':projectRole({..._0x26922e,..._0x2e8ea1['roleName']!==undefined?{'roleName':_0x2e8ea1[_0x391b91(0x90)]}:{},..._0x2e8ea1['remark']!==undefined?{'remark':_0x2e8ea1['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x391b91(0x91),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x4aeebf){const _0x1f58bc=a236_0x295c6f,_0x400e18=_0x4aeebf[_0x1f58bc(0x8f)]('id'),_0x30e0c1=readPatch(_0x4aeebf),_0x2e4cd1=await getRoleById(_0x4aeebf[_0x1f58bc(0x87)],_0x400e18);assertCustomRole(_0x2e4cd1,'update'),await updateAppRole({'id':_0x400e18,'appCode':_0x4aeebf[_0x1f58bc(0x87)],..._0x30e0c1[_0x1f58bc(0x90)]!==undefined?{'roleName':_0x30e0c1[_0x1f58bc(0x90)]}:{},..._0x30e0c1['remark']!==undefined?{'remark':_0x30e0c1['remark']}:{}});const _0x1df2b5=await getRoleById(_0x4aeebf[_0x1f58bc(0x87)],_0x400e18);return{'ok':!![],'data':{'scope':_0x1f58bc(0x83),'operation':'update','selector':{'appCode':_0x4aeebf[_0x1f58bc(0x87)],'roleId':_0x400e18,'roleName':_0x1df2b5[_0x1f58bc(0x90)]},'before':projectRole(_0x2e4cd1),'after':projectRole(_0x1df2b5),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x1f58bc(0x88)+_0x1df2b5['roleName']+_0x1f58bc(0x8e)+_0x400e18+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a237_0x2901a9=a237_0x18f1;function a237_0x3dc0(){const _0x4df742=['user-add','313058oXOUXc','role','roleName','328832rQhGLm','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','appCode','\x20to\x20role\x20','userId','\x20already\x20in\x20role\x20','81EIgIol','1319490BFrSpl','246771SdfaSE','username','2dYxNRf','1371080qXOEpN','roleType','POST','2408466mQLUeB','high-risk-write','298983QLYwZS','Added\x20user\x20','selector','No\x20change:\x20user\x20','roleId'];a237_0x3dc0=function(){return _0x4df742;};return a237_0x3dc0();}(function(_0x96a1f6,_0x23c370){const _0x3f5455=a237_0x18f1,_0x52a60c=_0x96a1f6();while(!![]){try{const _0x175df0=-parseInt(_0x3f5455(0xf6))/0x1*(-parseInt(_0x3f5455(0xe9))/0x2)+parseInt(_0x3f5455(0xe3))/0x3+parseInt(_0x3f5455(0xf7))/0x4+parseInt(_0x3f5455(0xf3))/0x5+-parseInt(_0x3f5455(0xe1))/0x6+-parseInt(_0x3f5455(0xf4))/0x7+parseInt(_0x3f5455(0xec))/0x8*(-parseInt(_0x3f5455(0xf2))/0x9);if(_0x175df0===_0x23c370)break;else _0x52a60c['push'](_0x52a60c['shift']());}catch(_0x398133){_0x52a60c['push'](_0x52a60c['shift']());}}}(a237_0x3dc0,0x33f33));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a237_0x18f1(_0x1fa703,_0x19b3e8){_0x1fa703=_0x1fa703-0xe1;const _0x3dc087=a237_0x3dc0();let _0x18f1d1=_0x3dc087[_0x1fa703];return _0x18f1d1;}import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a237_0x2901a9(0xea),'command':a237_0x2901a9(0xe8),'description':a237_0x2901a9(0xed),'risk':a237_0x2901a9(0xe2),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x1f8656){const _0x3faa36=a237_0x2901a9,{mutation:_0x1bb841}=await prepareUserMutation(_0x1f8656,'user-add',!![]);return asDryRunResult(_0x1bb841,{'method':_0x3faa36(0xf9),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x407f6){const _0x1bf72a=a237_0x2901a9,{mutation:_0xd48151,changed:_0x468ef2,role:_0x329b4f,user:_0x17507d}=await prepareUserMutation(_0x407f6,_0x1bf72a(0xe8),![]);return _0x468ef2&&await createDevUserRole({'appCode':_0x407f6[_0x1bf72a(0xee)],'userId':_0x17507d[_0x1bf72a(0xf0)],'username':_0x17507d[_0x1bf72a(0xf5)],'roleType':_0x329b4f[_0x1bf72a(0xf8)],'roleId':_0xd48151[_0x1bf72a(0xe5)][_0x1bf72a(0xe7)]}),{'ok':!![],'data':_0xd48151,'message':_0x468ef2?_0x1bf72a(0xe4)+_0xd48151[_0x1bf72a(0xe5)][_0x1bf72a(0xf0)]+_0x1bf72a(0xef)+_0xd48151[_0x1bf72a(0xe5)][_0x1bf72a(0xeb)]:_0x1bf72a(0xe6)+_0xd48151['selector'][_0x1bf72a(0xf0)]+_0x1bf72a(0xf1)+_0xd48151[_0x1bf72a(0xe5)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a238_0x25dc(_0xe8b66b,_0x18cd83){_0xe8b66b=_0xe8b66b-0x182;const _0x3315ad=a238_0x3315();let _0x25dc12=_0x3315ad[_0xe8b66b];return _0x25dc12;}const a238_0x178d49=a238_0x25dc;(function(_0xec51c6,_0x25245f){const _0x559f0e=a238_0x25dc,_0x6dfc50=_0xec51c6();while(!![]){try{const _0x3c4d6c=-parseInt(_0x559f0e(0x185))/0x1*(-parseInt(_0x559f0e(0x18c))/0x2)+-parseInt(_0x559f0e(0x184))/0x3*(-parseInt(_0x559f0e(0x193))/0x4)+-parseInt(_0x559f0e(0x18f))/0x5+-parseInt(_0x559f0e(0x186))/0x6+-parseInt(_0x559f0e(0x18a))/0x7+-parseInt(_0x559f0e(0x189))/0x8*(parseInt(_0x559f0e(0x188))/0x9)+-parseInt(_0x559f0e(0x194))/0xa*(-parseInt(_0x559f0e(0x187))/0xb);if(_0x3c4d6c===_0x25245f)break;else _0x6dfc50['push'](_0x6dfc50['shift']());}catch(_0x41c491){_0x6dfc50['push'](_0x6dfc50['shift']());}}}(a238_0x3315,0x63922));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':a238_0x178d49(0x191),'command':'user-remove','description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a238_0x178d49(0x192),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x418e85){const {mutation:_0x45569a}=await prepareUserMutation(_0x418e85,'user-remove',!![]);return asDryRunResult(_0x45569a,{'method':'POST','url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x5ba7d0){const _0x40d8b2=a238_0x178d49,{matchingRelationIds:_0x5ee6c7,mutation:_0x8fc0da,changed:_0xcf49ad}=await prepareUserMutation(_0x5ba7d0,_0x40d8b2(0x18b),![]);if(_0xcf49ad)for(const _0x979014 of _0x5ee6c7){await deleteDevUserRole(_0x979014);}return{'ok':!![],'data':_0x8fc0da,'message':_0xcf49ad?_0x40d8b2(0x18d)+_0x8fc0da[_0x40d8b2(0x196)][_0x40d8b2(0x182)]+_0x40d8b2(0x190)+_0x8fc0da[_0x40d8b2(0x196)][_0x40d8b2(0x195)]:_0x40d8b2(0x18e)+_0x8fc0da['selector']['userId']+_0x40d8b2(0x183)+_0x8fc0da[_0x40d8b2(0x196)][_0x40d8b2(0x195)]};}};function a238_0x3315(){const _0x10f8b5=['5613qOpTOa','91456UWTWUg','2476098vFNoCG','15004UMHOZu','7243389YcOXNq','8KtdWRq','1877960kBSVJm','user-remove','2aiVqCw','Removed\x20user\x20','No\x20change:\x20user\x20','2055295xxqZdD','\x20from\x20role\x20','role','high-risk-write','28GHqmMO','16130muVwBa','roleName','selector','userId','\x20not\x20in\x20role\x20'];a238_0x3315=function(){return _0x10f8b5;};return a238_0x3315();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a239_0x2622(_0x15fff0,_0x2f96b0){_0x15fff0=_0x15fff0-0x8d;const _0x27ce34=a239_0x27ce();let _0x262298=_0x27ce34[_0x15fff0];return _0x262298;}function a239_0x27ce(){const _0x37fbe1=['matchedBy','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','3592986emqUXp','2041944pfpodj','591273Fzaegx','Pass\x20--name\x20<nickname|username>.','582736abvCxM','user-resolve','trim','3154744hoPlCF','2075293qDvmEy','name','8ZkXTTz','read','role','\x22\x20→\x20userId\x20','userId','18FDVEld','131592CtmTQy','str','Resolved\x20\x22','flagMissing','username','5gcuHCo','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','40uCKHck','nickname'];a239_0x27ce=function(){return _0x37fbe1;};return a239_0x27ce();}const a239_0x45d839=a239_0x2622;(function(_0x5d078e,_0x5b017f){const _0x5ad83f=a239_0x2622,_0x7ef4fc=_0x5d078e();while(!![]){try{const _0x37d47b=parseInt(_0x5ad83f(0x9b))/0x1+parseInt(_0x5ad83f(0x95))/0x2*(-parseInt(_0x5ad83f(0x8d))/0x3)+parseInt(_0x5ad83f(0x92))/0x4+-parseInt(_0x5ad83f(0xa0))/0x5*(-parseInt(_0x5ad83f(0xa6))/0x6)+-parseInt(_0x5ad83f(0x8f))/0x7+-parseInt(_0x5ad83f(0xa7))/0x8*(-parseInt(_0x5ad83f(0x9a))/0x9)+-parseInt(_0x5ad83f(0xa2))/0xa*(parseInt(_0x5ad83f(0x93))/0xb);if(_0x37d47b===_0x5b017f)break;else _0x7ef4fc['push'](_0x7ef4fc['shift']());}catch(_0x386c22){_0x7ef4fc['push'](_0x7ef4fc['shift']());}}}(a239_0x27ce,0x62783));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a239_0x45d839(0x97),'command':a239_0x45d839(0x90),'description':a239_0x45d839(0xa1),'risk':a239_0x45d839(0x96),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3a1bcb){const _0x5a3245=a239_0x45d839;if(!_0x3a1bcb[_0x5a3245(0x9c)]('name')[_0x5a3245(0x91)]())throw CliErrors[_0x5a3245(0x9e)](_0x5a3245(0x94),_0x5a3245(0x8e));},async 'execute'(_0x4a7738){const _0x1038c6=a239_0x45d839,_0xffeb74=_0x4a7738[_0x1038c6(0x9c)](_0x1038c6(0x94))[_0x1038c6(0x91)](),_0x1fdfdb=await resolveUserRef(_0xffeb74,_0x1038c6(0xa5));return{'ok':!![],'data':{'user':{'userId':_0x1fdfdb[_0x1038c6(0x99)],'username':_0x1fdfdb[_0x1038c6(0x9f)],'nickname':_0x1fdfdb[_0x1038c6(0xa3)],'matchedBy':_0x1fdfdb[_0x1038c6(0xa4)]}},'message':_0x1038c6(0x9d)+_0xffeb74+_0x1038c6(0x98)+_0x1fdfdb[_0x1038c6(0x99)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a240_0x123a(_0x35c71c,_0x25b7b2){_0x35c71c=_0x35c71c-0x151;const _0x3508ea=a240_0x3508();let _0x123ad1=_0x3508ea[_0x35c71c];return _0x123ad1;}const a240_0x3fa191=a240_0x123a;(function(_0x21d9b0,_0xc30c99){const _0xc1c5a2=a240_0x123a,_0xea5347=_0x21d9b0();while(!![]){try{const _0x237dcb=parseInt(_0xc1c5a2(0x165))/0x1*(-parseInt(_0xc1c5a2(0x15a))/0x2)+parseInt(_0xc1c5a2(0x15c))/0x3*(parseInt(_0xc1c5a2(0x166))/0x4)+-parseInt(_0xc1c5a2(0x158))/0x5+parseInt(_0xc1c5a2(0x161))/0x6+parseInt(_0xc1c5a2(0x164))/0x7*(parseInt(_0xc1c5a2(0x162))/0x8)+-parseInt(_0xc1c5a2(0x152))/0x9+parseInt(_0xc1c5a2(0x160))/0xa*(parseInt(_0xc1c5a2(0x15b))/0xb);if(_0x237dcb===_0xc30c99)break;else _0xea5347['push'](_0xea5347['shift']());}catch(_0x3a3514){_0xea5347['push'](_0xea5347['shift']());}}}(a240_0x3508,0x5acc7));function a240_0x3508(){const _0x2b1c49=['cookie','6483735KiuURb','content','\x20--file\x20<path>\x20--dry-run`.','read','\x20is\x20not\x20configured\x20for\x20app\x20','appCode','2264745tAxgRs','rule','268xyJcab','13010932gbiPnZ','99xxZRrd','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','\x20for\x20','Loaded\x20','10SnNKMI','2666538hnAHnk','268808zflqDI','get','7rphjen','1070GuLJYI','3372sZLoQf'];a240_0x3508=function(){return _0x2b1c49;};return a240_0x3508();}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':a240_0x3fa191(0x159),'command':a240_0x3fa191(0x163),'description':a240_0x3fa191(0x15d),'risk':a240_0x3fa191(0x155),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x442680){readAppRuleType(_0x442680);},async 'execute'(_0x447ec0){const _0x311f1f=a240_0x3fa191,_0x3be4d1=readAppRuleType(_0x447ec0),_0x2b79b1=await getAppRule(_0x447ec0[_0x311f1f(0x151)],{'appCode':_0x447ec0[_0x311f1f(0x157)],'type':_0x3be4d1});if(!_0x2b79b1)throw appRuleError('app_rule_not_found',appRuleFileName(_0x3be4d1)+_0x311f1f(0x156)+_0x447ec0[_0x311f1f(0x157)]+'.','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20'+_0x3be4d1+_0x311f1f(0x154));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x3be4d1,_0x2b79b1),'content':_0x2b79b1[_0x311f1f(0x153)]}},'message':_0x311f1f(0x15f)+appRuleFileName(_0x3be4d1)+_0x311f1f(0x15e)+_0x447ec0[_0x311f1f(0x157)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3e5c93,_0x1db9c8){const _0x31f13e=a241_0x13cf,_0x46cf3b=_0x3e5c93();while(!![]){try{const _0x5c10ad=parseInt(_0x31f13e(0xc0))/0x1*(parseInt(_0x31f13e(0xc6))/0x2)+parseInt(_0x31f13e(0xc4))/0x3+-parseInt(_0x31f13e(0xca))/0x4+-parseInt(_0x31f13e(0xc7))/0x5*(-parseInt(_0x31f13e(0xc9))/0x6)+parseInt(_0x31f13e(0xc2))/0x7*(-parseInt(_0x31f13e(0xc1))/0x8)+parseInt(_0x31f13e(0xc5))/0x9*(parseInt(_0x31f13e(0xc8))/0xa)+parseInt(_0x31f13e(0xcb))/0xb*(-parseInt(_0x31f13e(0xc3))/0xc);if(_0x5c10ad===_0x1db9c8)break;else _0x46cf3b['push'](_0x46cf3b['shift']());}catch(_0x500c87){_0x46cf3b['push'](_0x46cf3b['shift']());}}}(a241_0x2806,0xe46b7));function a241_0x13cf(_0x207a73,_0x2f51a8){_0x207a73=_0x207a73-0xc0;const _0x2806cd=a241_0x2806();let _0x13cfa4=_0x2806cd[_0x207a73];return _0x13cfa4;}import{ruleGet}from'../../commands/rule/get.js';function a241_0x2806(){const _0x4caffb=['1092384MBkUMB','21QFknZk','4067916uLZnpi','2731032PozuAq','13374ttcSfc','52858biNUvZ','493770lmJMFc','2510vrCQqF','72ZommYt','6625164LDZVMf','11dRuPIQ','33kDdFsi'];a241_0x2806=function(){return _0x4caffb;};return a241_0x2806();}import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a242_0x46fb(){const _0x2e0666=['12JjsUsO','rule','1208aWIpiv','17493QEwOHv','read','appCode','map','863DuwHix','6utrTXb','7443CnGOol','1257080xTSbBl','2279460JKbkFB','Loaded\x20app\x20rule\x20configuration\x20for\x20','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','2586518VnPyVi','cookie','4177062qemLTZ','length','1214OtvORn'];a242_0x46fb=function(){return _0x2e0666;};return a242_0x46fb();}const a242_0x3089d4=a242_0x307a;(function(_0x311c4c,_0x395d92){const _0x3c924d=a242_0x307a,_0x57a865=_0x311c4c();while(!![]){try{const _0x399024=-parseInt(_0x3c924d(0x16b))/0x1*(-parseInt(_0x3c924d(0x176))/0x2)+-parseInt(_0x3c924d(0x16d))/0x3*(-parseInt(_0x3c924d(0x177))/0x4)+-parseInt(_0x3c924d(0x16f))/0x5*(parseInt(_0x3c924d(0x16c))/0x6)+-parseInt(_0x3c924d(0x167))/0x7*(-parseInt(_0x3c924d(0x166))/0x8)+-parseInt(_0x3c924d(0x174))/0x9+parseInt(_0x3c924d(0x16e))/0xa+parseInt(_0x3c924d(0x172))/0xb;if(_0x399024===_0x395d92)break;else _0x57a865['push'](_0x57a865['shift']());}catch(_0x4ff6b6){_0x57a865['push'](_0x57a865['shift']());}}}(a242_0x46fb,0x5551d));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a242_0x307a(_0x2d2ec7,_0x2a24a0){_0x2d2ec7=_0x2d2ec7-0x165;const _0x46fb77=a242_0x46fb();let _0x307ad7=_0x46fb77[_0x2d2ec7];return _0x307ad7;}export const ruleList={'service':a242_0x3089d4(0x165),'command':'list','description':a242_0x3089d4(0x171),'risk':a242_0x3089d4(0x168),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x354026){const _0x5eb69e=a242_0x3089d4,_0x12875e=await Promise['all'](APP_RULE_TYPES[_0x5eb69e(0x16a)](_0x556d05=>getAppRule(_0x354026[_0x5eb69e(0x173)],{'appCode':_0x354026[_0x5eb69e(0x169)],'type':_0x556d05}))),_0x62f985=APP_RULE_TYPES['map']((_0x395988,_0x23ddd1)=>projectAppRule(_0x395988,_0x12875e[_0x23ddd1]??null));return{'ok':!![],'data':{'total':_0x62f985[_0x5eb69e(0x175)],'rules':_0x62f985},'message':_0x5eb69e(0x170)+_0x354026[_0x5eb69e(0x169)]};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a243_0xada9bc=a243_0x2601;function a243_0x1bae(){const _0x439b89=['number','write','Expected\x20','contentHash','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','Pass\x20a\x20UTF-8\x20Markdown\x20file.','rule','version','flag','\x20for\x20','expectedVersion','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','\x20--format\x20compress','app_rule_version_mismatch','412948OIahnK','--file\x20is\x20required.','/smartapi/knowledge-base/save','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','4543506bzLDSd','push','cookie','beforeRecord','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','str','isSafeInteger','app_rule_set_outcome_unknown','type','rules','before','content','POST','appCode','Set\x20','byteSize','4984QjBcua','input',';\x20current\x20version\x20is\x20','replacement','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','trim','set','533093meJvIz','verified','5736960jGisKx','defineProperty','file','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','3952SroWWz','12383RUBnpB','410nVjCtr','60YnLdQc','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','string','\x20version\x20changed\x20before\x20write.','1002ADPfWr','rabetbase\x20rule\x20get\x20--type\x20','cause','43768zetZkk','app_rule_expected_version_invalid','unconfigured'];a243_0x1bae=function(){return _0x439b89;};return a243_0x1bae();}(function(_0x22d2a7,_0x52bca5){const _0x17f47c=a243_0x2601,_0x5dec2d=_0x22d2a7();while(!![]){try{const _0x28f370=-parseInt(_0x17f47c(0x16f))/0x1+parseInt(_0x17f47c(0x183))/0x2*(-parseInt(_0x17f47c(0x197))/0x3)+-parseInt(_0x17f47c(0x15e))/0x4*(parseInt(_0x17f47c(0x192))/0x5)+parseInt(_0x17f47c(0x18c))/0x6+-parseInt(_0x17f47c(0x191))/0x7*(-parseInt(_0x17f47c(0x190))/0x8)+parseInt(_0x17f47c(0x173))/0x9+parseInt(_0x17f47c(0x193))/0xa*(parseInt(_0x17f47c(0x18a))/0xb);if(_0x28f370===_0x52bca5)break;else _0x5dec2d['push'](_0x5dec2d['shift']());}catch(_0xacb31e){_0x5dec2d['push'](_0x5dec2d['shift']());}}}(a243_0x1bae,0x75f42));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function a243_0x2601(_0x412ede,_0x2c3489){_0x412ede=_0x412ede-0x15d;const _0x1bae4d=a243_0x1bae();let _0x260110=_0x1bae4d[_0x412ede];return _0x260110;}const SAVE_PATH=a243_0xada9bc(0x171),NON_ATOMIC_WARNING='--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.';function readSetInput(_0x2772cd){const _0x12e1f6=a243_0xada9bc,_0x398bd3=readAppRuleType(_0x2772cd),_0x42953c=_0x2772cd[_0x12e1f6(0x178)](_0x12e1f6(0x18e))[_0x12e1f6(0x188)]();if(!_0x42953c)throw appRuleError('app_rule_file_required',_0x12e1f6(0x170),_0x12e1f6(0x166));const _0x8273c0=_0x2772cd[_0x12e1f6(0x169)]('expected-version');let _0x485e35;if(_0x8273c0!==undefined){_0x485e35=Number(_0x8273c0);if(!Number[_0x12e1f6(0x179)](_0x485e35)||_0x485e35<0x0)throw appRuleError(_0x12e1f6(0x15f),_0x12e1f6(0x194));}return{'type':_0x398bd3,'file':_0x42953c,'expectedVersion':_0x485e35};}async function prepareSet(_0x53d0e0){const _0x38ba87=a243_0xada9bc,_0x120463=readSetInput(_0x53d0e0),_0x1b067a=await readAppRuleFile(_0x120463[_0x38ba87(0x18e)]),_0x599fe7=await getAppRule(_0x53d0e0[_0x38ba87(0x175)],{'appCode':_0x53d0e0[_0x38ba87(0x180)],'type':_0x120463['type']});if(_0x120463[_0x38ba87(0x16b)]!==undefined&&_0x599fe7?.[_0x38ba87(0x168)]!==_0x120463[_0x38ba87(0x16b)])throw appRuleError(_0x38ba87(0x16e),appRuleFileName(_0x120463[_0x38ba87(0x17b)])+_0x38ba87(0x196),_0x38ba87(0x163)+_0x120463[_0x38ba87(0x16b)]+_0x38ba87(0x185)+(_0x599fe7?.[_0x38ba87(0x168)]??_0x38ba87(0x160))+_0x38ba87(0x187));return{'input':_0x120463,'replacement':_0x1b067a,'beforeRecord':_0x599fe7,'before':projectAppRule(_0x120463['type'],_0x599fe7),'planned':{'type':_0x120463[_0x38ba87(0x17b)],'fileName':appRuleFileName(_0x120463[_0x38ba87(0x17b)]),'contextScope':appRuleContextScope(_0x120463[_0x38ba87(0x17b)]),'enabled':!![],'appCode':_0x53d0e0[_0x38ba87(0x180)],'scope':_0x38ba87(0x17c),'contentByteSize':_0x1b067a[_0x38ba87(0x182)],'contentHash':_0x1b067a[_0x38ba87(0x164)]}};}function warningsFor(_0x4364a2){return _0x4364a2===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a243_0xada9bc(0x167),'command':'set','description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a243_0xada9bc(0x162),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0xada9bc(0x18e),'type':a243_0xada9bc(0x195),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'},{'name':'expected-version','type':a243_0xada9bc(0x161),'required':![],'description':a243_0xada9bc(0x172)}],async 'validate'(_0x12260b){readSetInput(_0x12260b);},async 'dryRun'(_0x1aa3a5){const _0x85bcf4=a243_0xada9bc,_0x1207ad=await prepareSet(_0x1aa3a5);return asDryRunResult({'operation':_0x85bcf4(0x189),'selector':{'appCode':_0x1aa3a5[_0x85bcf4(0x180)],'scope':_0x85bcf4(0x17c),'type':_0x1207ad[_0x85bcf4(0x184)]['type']},'before':_0x1207ad[_0x85bcf4(0x17d)],'after':_0x1207ad['planned'],'dryRun':!![],'backend':{'method':_0x85bcf4(0x17f),'path':SAVE_PATH},'warnings':warningsFor(_0x1207ad[_0x85bcf4(0x184)][_0x85bcf4(0x16b)]),'verification':{'expectedVersion':_0x1207ad[_0x85bcf4(0x184)][_0x85bcf4(0x16b)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x85bcf4(0x198)+_0x1207ad['input'][_0x85bcf4(0x17b)]+_0x85bcf4(0x16d)}},{'method':_0x85bcf4(0x17f),'url':SAVE_PATH});},async 'execute'(_0x404106){const _0x3704cd=a243_0xada9bc,_0x273114=await prepareSet(_0x404106);let _0x2ee331=![];try{await saveAppRule(_0x404106[_0x3704cd(0x175)],{'appCode':_0x404106[_0x3704cd(0x180)],'type':_0x273114[_0x3704cd(0x184)]['type'],'content':_0x273114['replacement'][_0x3704cd(0x17e)]});}catch(_0x42aa79){if(!isPlatformTransportFailure(_0x42aa79))throw _0x42aa79;_0x2ee331=!![];}let _0x2f9d12;try{_0x2f9d12=await getAppRule(_0x404106[_0x3704cd(0x175)],{'appCode':_0x404106[_0x3704cd(0x180)],'type':_0x273114[_0x3704cd(0x184)][_0x3704cd(0x17b)]});}catch(_0x4e2302){const _0x45c2cc=appRuleError(_0x2ee331?_0x3704cd(0x17a):'app_rule_verification_unavailable','The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x273114['input'][_0x3704cd(0x17b)])+'\x20could\x20not\x20be\x20verified.',_0x3704cd(0x16c));Object[_0x3704cd(0x18d)](_0x45c2cc,_0x3704cd(0x15d),{'value':_0x4e2302,'enumerable':![]});throw _0x45c2cc;}const _0x128312=_0x2f9d12&&inspectAppRuleContent(_0x2f9d12[_0x3704cd(0x17e)])[_0x3704cd(0x164)]===_0x273114[_0x3704cd(0x186)][_0x3704cd(0x164)],_0x2af342=_0x2f9d12&&(_0x273114[_0x3704cd(0x176)]===null||_0x2f9d12[_0x3704cd(0x168)]>_0x273114[_0x3704cd(0x176)][_0x3704cd(0x168)]);if(!_0x2f9d12||!_0x128312||!_0x2af342)throw appRuleError(_0x2ee331?_0x3704cd(0x17a):'app_rule_verification_failed',appRuleFileName(_0x273114[_0x3704cd(0x184)]['type'])+_0x3704cd(0x177),_0x3704cd(0x165)+_0x273114['input']['type']+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x38af85=warningsFor(_0x273114[_0x3704cd(0x184)][_0x3704cd(0x16b)]);_0x2ee331&&_0x38af85[_0x3704cd(0x174)](_0x3704cd(0x18f));const _0x27aa73=projectAppRule(_0x273114['input']['type'],_0x2f9d12);return{'ok':!![],'data':{'operation':_0x3704cd(0x189),'selector':{'appCode':_0x404106['appCode'],'scope':_0x3704cd(0x17c),'type':_0x273114[_0x3704cd(0x184)][_0x3704cd(0x17b)]},'before':_0x273114['before'],'after':_0x27aa73,'dryRun':![],'backend':{'method':_0x3704cd(0x17f),'path':SAVE_PATH},'warnings':_0x38af85,'verification':{'status':_0x3704cd(0x18b),'recoveredAfterUnknownResponse':_0x2ee331,'expectedVersion':_0x273114[_0x3704cd(0x184)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x3704cd(0x198)+_0x273114[_0x3704cd(0x184)]['type']+'\x20--format\x20compress'}},'message':_0x3704cd(0x181)+appRuleFileName(_0x273114[_0x3704cd(0x184)][_0x3704cd(0x17b)])+_0x3704cd(0x16a)+_0x404106[_0x3704cd(0x180)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x445382=a244_0x29b2;(function(_0x5a56dc,_0xe34643){const _0x1706be=a244_0x29b2,_0x48f065=_0x5a56dc();while(!![]){try{const _0x47ef84=parseInt(_0x1706be(0x183))/0x1+parseInt(_0x1706be(0x190))/0x2+-parseInt(_0x1706be(0x1a9))/0x3*(-parseInt(_0x1706be(0x196))/0x4)+parseInt(_0x1706be(0x19d))/0x5+parseInt(_0x1706be(0x19b))/0x6+parseInt(_0x1706be(0x197))/0x7*(parseInt(_0x1706be(0x199))/0x8)+-parseInt(_0x1706be(0x1a7))/0x9*(parseInt(_0x1706be(0x185))/0xa);if(_0x47ef84===_0xe34643)break;else _0x48f065['push'](_0x48f065['shift']());}catch(_0x49e033){_0x48f065['push'](_0x48f065['shift']());}}}(a244_0x39de,0x389be));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x445382(0x189),'database'];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a244_0x445382(0x1b0),'database':a244_0x445382(0x193)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a244_0x445382(0x19e)};export function appRuleError(_0x5b877b,_0x48e3b9,_0x4aeb25){return new CliError(_0x5b877b,0x1,_0x48e3b9,_0x4aeb25);}export function readAppRuleType(_0x4a68e8){const _0xe95eef=a244_0x445382,_0x20c2e8=_0x4a68e8['str'](_0xe95eef(0x18d))['trim']()['toLowerCase']();if(_0x20c2e8!=='rules'&&_0x20c2e8!==_0xe95eef(0x198))throw appRuleError(_0xe95eef(0x1a6),_0xe95eef(0x18b));return _0x20c2e8;}export function appRuleFileName(_0x590c49){return APP_RULE_FILES[_0x590c49];}export function appRuleContextScope(_0x4ef5aa){return APP_RULE_CONTEXT_SCOPES[_0x4ef5aa];}function a244_0x39de(){const _0x3d2790=['from','1143QhWcsb','decode','Pass\x20a\x20UTF-8\x20Markdown\x20file.','digest','appCode','sha256:','app_rule_content_invalid','RULES.md','message','byteLength','hex','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','contentHash','431057fQkeTD','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','40920BAhdzx','trim','sha256','isFile','rules','app_rule_file_unreadable','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','utf8','type','--file\x20is\x20required.','size','334190nVsdNr','App\x20rule\x20file\x20is\x20blank:\x20','Cannot\x20access\x20app\x20rule\x20file:\x20','DATABASE.md','updateTime','Cannot\x20read\x20app\x20rule\x20file:\x20','788PuzLWe','35ddachf','database','639096mLdGOY','app_rule_content_too_large','1494684zUFjDi','createTime','1159140gsUIZx','database-analysis','scope','app_rule_file_invalid','content','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','update','string','byteSize','app_rule_type_invalid','2907QVGUgy'];a244_0x39de=function(){return _0x3d2790;};return a244_0x39de();}export function inspectAppRuleContent(_0x3e661f){const _0x1ec3a8=a244_0x445382,_0x13900b=Buffer[_0x1ec3a8(0x1a8)](_0x3e661f,_0x1ec3a8(0x18c));return{'content':_0x3e661f,'byteSize':_0x13900b[_0x1ec3a8(0x1b2)],'contentHash':_0x1ec3a8(0x1ae)+createHash(_0x1ec3a8(0x187))[_0x1ec3a8(0x1a3)](_0x13900b)[_0x1ec3a8(0x1ac)](_0x1ec3a8(0x1b3))};}function a244_0x29b2(_0xd9e870,_0xb8806a){_0xd9e870=_0xd9e870-0x181;const _0x39de4a=a244_0x39de();let _0x29b2bd=_0x39de4a[_0xd9e870];return _0x29b2bd;}export async function readAppRuleFile(_0x241b02){const _0x1e66f1=a244_0x445382,_0x5920bb=_0x241b02[_0x1e66f1(0x186)]();if(!_0x5920bb)throw appRuleError('app_rule_file_required',_0x1e66f1(0x18e),_0x1e66f1(0x1ab));const _0x408053=resolve(_0x5920bb);let _0x27c457;try{_0x27c457=await stat(_0x408053);}catch(_0x43a8d1){throw appRuleError(_0x1e66f1(0x18a),_0x1e66f1(0x192)+_0x5920bb,_0x43a8d1 instanceof Error?_0x43a8d1[_0x1e66f1(0x1b1)]:String(_0x43a8d1));}if(!_0x27c457[_0x1e66f1(0x188)]())throw appRuleError(_0x1e66f1(0x1a0),_0x1e66f1(0x181)+_0x5920bb);if(_0x27c457[_0x1e66f1(0x18f)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e66f1(0x19a),_0x1e66f1(0x184));let _0xaf3d4a;try{_0xaf3d4a=await readFile(_0x408053);}catch(_0x143b21){throw appRuleError(_0x1e66f1(0x18a),_0x1e66f1(0x195)+_0x5920bb,_0x143b21 instanceof Error?_0x143b21[_0x1e66f1(0x1b1)]:String(_0x143b21));}if(_0xaf3d4a[_0x1e66f1(0x1b2)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e66f1(0x19a),_0x1e66f1(0x184));let _0x8346da;try{_0x8346da=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x1e66f1(0x1aa)](_0xaf3d4a);}catch{throw appRuleError(_0x1e66f1(0x1af),_0x1e66f1(0x1a2)+_0x5920bb);}if(!_0x8346da['trim']())throw appRuleError('app_rule_content_invalid',_0x1e66f1(0x191)+_0x5920bb);return inspectAppRuleContent(_0x8346da);}export function projectAppRule(_0x5ed4c3,_0x354771){const _0x33176a=a244_0x445382;if(!_0x354771)return{'type':_0x5ed4c3,'fileName':appRuleFileName(_0x5ed4c3),'contextScope':appRuleContextScope(_0x5ed4c3),'enabled':![]};const _0x56c3b6=inspectAppRuleContent(_0x354771[_0x33176a(0x1a1)]);return{'type':_0x5ed4c3,'fileName':appRuleFileName(_0x5ed4c3),'contextScope':appRuleContextScope(_0x5ed4c3),'enabled':!![],'id':_0x354771['id'],'scope':_0x354771[_0x33176a(0x19f)],'appCode':_0x354771[_0x33176a(0x1ad)],'version':_0x354771['version'],'contentByteSize':_0x56c3b6[_0x33176a(0x1a5)],'contentHash':_0x56c3b6[_0x33176a(0x182)],..._0x354771['createTime']!==undefined&&_0x354771['createTime']!==null?{'createTime':_0x354771[_0x33176a(0x19c)]}:{},..._0x354771[_0x33176a(0x194)]!==undefined&&_0x354771['updateTime']!==null?{'updateTime':_0x354771[_0x33176a(0x194)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x445382(0x18d),'type':a244_0x445382(0x1a4),'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 a245_0x3bd918=a245_0x2bae;(function(_0x24841f,_0x1a6e56){const _0x5666de=a245_0x2bae,_0x348925=_0x24841f();while(!![]){try{const _0x2d83df=parseInt(_0x5666de(0x140))/0x1*(parseInt(_0x5666de(0x13b))/0x2)+parseInt(_0x5666de(0x114))/0x3+-parseInt(_0x5666de(0x13d))/0x4+-parseInt(_0x5666de(0x11d))/0x5*(parseInt(_0x5666de(0x109))/0x6)+-parseInt(_0x5666de(0x10c))/0x7+parseInt(_0x5666de(0x146))/0x8*(parseInt(_0x5666de(0x131))/0x9)+parseInt(_0x5666de(0x134))/0xa;if(_0x2d83df===_0x1a6e56)break;else _0x348925['push'](_0x348925['shift']());}catch(_0x512551){_0x348925['push'](_0x348925['shift']());}}}(a245_0x32c0,0x3613f));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x3bd918(0x10e),a245_0x3bd918(0x11e)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set(['start',a245_0x3bd918(0x11e),a245_0x3bd918(0x149),a245_0x3bd918(0x126)]);export function syncProjectDomainRoutingBeforeScript(_0x188f55,_0x270e27){const _0x36e918=a245_0x3bd918;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x270e27))return null;const _0x59e9b6=findProjectRootDirectory(_0x188f55);if(!resolveConfigPath(_0x59e9b6))return null;const _0x5b77d0=writeProjectDomainRoutingManifest(_0x59e9b6);return{'path':_0x5b77d0[_0x36e918(0x10a)],'changed':_0x5b77d0['changed']};}function readPackageScripts(_0x4e37c6){const _0x5a865b=a245_0x3bd918,_0x5a9acb=resolve(_0x4e37c6,_0x5a865b(0x133));if(!existsSync(_0x5a9acb))return null;try{const _0x44f533=JSON[_0x5a865b(0x115)](readFileSync(_0x5a9acb,_0x5a865b(0x120)));return _0x44f533['scripts']??{};}catch{return null;}}function detectPackageManager(_0x5a4cf7){const _0x398350=a245_0x3bd918;if(existsSync(resolve(_0x5a4cf7,_0x398350(0x136)))||existsSync(resolve(_0x5a4cf7,'bun.lock')))return _0x398350(0x13a);if(existsSync(resolve(_0x5a4cf7,_0x398350(0x12a))))return _0x398350(0x128);if(existsSync(resolve(_0x5a4cf7,'yarn.lock')))return'yarn';return _0x398350(0x130);}function a245_0x32c0(){const _0x2f0600=['bun.lockb','run','--watch','Domain\x20routing\x20synchronized:\x20','bun','2AdSqzb','Script\x20name\x20defined\x20in\x20package.json','516156ORPKda','error','\x20run\x20preview\x20--watch','137033mJxRjV','watch','Script\x20\x22','args','\x20run\x20start','close','48miLOvG','\x20run\x20','\x0a\x20\x20Usage:\x20','build','10902cvRmHN','path','\x20exited\x20with\x20code\x20','2038778GiqbaH','push','start','belowMinimum','\x22\x20not\x20found\x20in\x20package.json.','\x0a\x20\x20Available\x20scripts:\x0a','No\x20package.json\x20found\x20in\x20current\x20directory.','script','398862jVLnfE','parse','vite\x20preview\x20exited\x20with\x20code\x20','needsUpgrade','changed','\x20\x20EXAMPLES','Run\x20a\x20package.json\x20script','Available:\x20','\x20run\x20build','965bBhMtL','dev','\x20run\x20preview','utf-8','log','inherit','has','No\x20scripts\x20defined\x20in\x20package.json.','\x20\x20\x20\x20','preview','join','pnpm','slice','pnpm-lock.yaml','all','keys','node_modules','vite','validation','npm','627957XRCZoF','\x20run\x20<script>\x0a','package.json','3038520BWGEqM','vite\x20build\x20--watch\x20exited\x20with\x20code\x20'];a245_0x32c0=function(){return _0x2f0600;};return a245_0x32c0();}async function versionCheck(_0x53980f){const _0x1c9348=a245_0x3bd918,_0x5538b8=await checkCliVersion();(_0x5538b8[_0x1c9348(0x117)]||_0x5538b8[_0x1c9348(0x10f)])&&(printCliUpgradeWarning(_0x5538b8),assertCliVersionSupported(_0x5538b8));const _0x4360cb=await checkSdkVersion(_0x53980f);if(_0x4360cb[_0x1c9348(0x117)])printSdkUpgradeWarning(_0x4360cb);}function a245_0x2bae(_0x165529,_0x3e9084){_0x165529=_0x165529-0x109;const _0x32c08=a245_0x32c0();let _0x2baeda=_0x32c08[_0x165529];return _0x2baeda;}function spawnScript(_0x5a0080,_0x35f376,_0x429d9e,_0x327cde){return new Promise((_0x293f60,_0x3c9720)=>{const _0x4b3ee6=a245_0x2bae,_0x2fee5f=[_0x4b3ee6(0x137),_0x35f376,..._0x429d9e],_0x362f95=spawn(_0x5a0080,_0x2fee5f,{'cwd':_0x327cde,'stdio':_0x4b3ee6(0x122),'shell':!![],'env':{...process.env,'PATH':''+join(_0x327cde,_0x4b3ee6(0x12d),'.bin')+delimiter+process.env.PATH}});_0x362f95['on'](_0x4b3ee6(0x145),_0x500da7=>{const _0x457aa5=_0x4b3ee6;if(_0x500da7===0x0||_0x500da7===null)_0x293f60();else _0x3c9720(new Error(_0x5a0080+_0x457aa5(0x147)+_0x35f376+_0x457aa5(0x10b)+_0x500da7));}),_0x362f95['on'](_0x4b3ee6(0x13e),_0x3c9720);});}function spawnViteBuildWatch(_0x4ac8a5){return new Promise((_0x29077f,_0xa83967)=>{const _0x1a5633=a245_0x2bae,_0x404a8a=spawn(_0x1a5633(0x12e),['build',_0x1a5633(0x138)],{'cwd':_0x4ac8a5,'stdio':_0x1a5633(0x122),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4ac8a5,'node_modules','.bin')+delimiter+process.env.PATH}});_0x404a8a['on'](_0x1a5633(0x145),_0x1813fc=>{const _0x2fad92=_0x1a5633;if(_0x1813fc===0x0||_0x1813fc===null)_0x29077f();else _0xa83967(new Error(_0x2fad92(0x135)+_0x1813fc));}),_0x404a8a['on'](_0x1a5633(0x13e),_0xa83967);});}function spawnVitePreview(_0x4b70d3){return new Promise((_0x5ba26b,_0x3a7ea9)=>{const _0x560eb3=a245_0x2bae,_0x6e2634=spawn(_0x560eb3(0x12e),[_0x560eb3(0x126)],{'cwd':_0x4b70d3,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x4b70d3,_0x560eb3(0x12d),'.bin')+delimiter+process.env.PATH}});_0x6e2634['on']('close',_0x217dc3=>{const _0xa66bad=_0x560eb3;if(_0x217dc3===0x0||_0x217dc3===null)_0x5ba26b();else _0x3a7ea9(new Error(_0xa66bad(0x116)+_0x217dc3));}),_0x6e2634['on'](_0x560eb3(0x13e),_0x3a7ea9);});}const runFlags=[{'name':a245_0x3bd918(0x141),'type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':'run','command':'run','description':a245_0x3bd918(0x11a),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x3bd918(0x113),'description':a245_0x3bd918(0x13c),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x1e5471=a245_0x3bd918,_0x14e726=[];return _0x14e726[_0x1e5471(0x10d)](_0x1e5471(0x119)),_0x14e726['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1e5471(0x144)),_0x14e726[_0x1e5471(0x10d)](_0x1e5471(0x125)+CLI_BIN_NAME+_0x1e5471(0x11c)),_0x14e726[_0x1e5471(0x10d)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1e5471(0x11f)),_0x14e726['push'](_0x1e5471(0x125)+CLI_BIN_NAME+_0x1e5471(0x13f)),_0x14e726[_0x1e5471(0x127)]('\x0a');},async 'execute'(_0x13ad01){const _0x59723b=a245_0x3bd918,_0x37c66a=process['cwd'](),_0x434d68=_0x13ad01[_0x59723b(0x143)][0x0],_0x254458=_0x13ad01['args'][_0x59723b(0x129)](0x1),_0x60482c=readPackageScripts(_0x37c66a);if(!_0x60482c)throw CliErrors[_0x59723b(0x12f)](_0x59723b(0x112));if(!_0x434d68){const _0x4004d2=Object[_0x59723b(0x12c)](_0x60482c);if(_0x4004d2['length']===0x0)console[_0x59723b(0x121)](_0x59723b(0x124));else{console[_0x59723b(0x121)](_0x59723b(0x111));for(const _0x49a773 of _0x4004d2){console['log'](_0x59723b(0x125)+_0x49a773);}console['log'](_0x59723b(0x148)+CLI_BIN_NAME+_0x59723b(0x132));}return{'ok':!![]};}if(!_0x60482c[_0x434d68])throw CliErrors['validation'](_0x59723b(0x142)+_0x434d68+_0x59723b(0x110),_0x59723b(0x11b)+(Object[_0x59723b(0x12c)](_0x60482c)[_0x59723b(0x127)](',\x20')||'(none)'));const _0x28babe=detectPackageManager(_0x37c66a),_0x437d0d=syncProjectDomainRoutingBeforeScript(_0x37c66a,_0x434d68);_0x437d0d?.[_0x59723b(0x118)]&&console[_0x59723b(0x13e)](_0x59723b(0x139)+_0x437d0d[_0x59723b(0x10a)]);VERSION_CHECK_SCRIPTS[_0x59723b(0x123)](_0x434d68)&&await versionCheck(_0x37c66a);if(_0x434d68==='preview'&&_0x13ad01['bool'](_0x59723b(0x141)))return await Promise[_0x59723b(0x12b)]([spawnViteBuildWatch(_0x37c66a),spawnVitePreview(_0x37c66a)]),{'ok':!![]};return await spawnScript(_0x28babe,_0x434d68,_0x254458,_0x37c66a),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a246_0x5029(){const _0x3645c7=['20221900KqFFhR','read','6rZNgTQ','99985uZJvTP','867944RBbACt','188ICqjMJ','export','schema','821668ysPuRS','3314794IkCvFD','9iYrWlc','1247118mEmpVU','11DHqRaS','Export\x20machine-readable\x20command\x20schema\x20(JSON)','304311qLeuYN'];a246_0x5029=function(){return _0x3645c7;};return a246_0x5029();}const a246_0x42a19a=a246_0x2c8f;function a246_0x2c8f(_0x581af6,_0x375f75){_0x581af6=_0x581af6-0x70;const _0x502997=a246_0x5029();let _0x2c8ff2=_0x502997[_0x581af6];return _0x2c8ff2;}(function(_0x843805,_0x57cca9){const _0x23692c=a246_0x2c8f,_0x3dca10=_0x843805();while(!![]){try{const _0x3b6407=parseInt(_0x23692c(0x73))/0x1+-parseInt(_0x23692c(0x7c))/0x2*(parseInt(_0x23692c(0x76))/0x3)+-parseInt(_0x23692c(0x79))/0x4*(parseInt(_0x23692c(0x77))/0x5)+-parseInt(_0x23692c(0x70))/0x6+parseInt(_0x23692c(0x7d))/0x7+-parseInt(_0x23692c(0x78))/0x8*(parseInt(_0x23692c(0x7e))/0x9)+-parseInt(_0x23692c(0x74))/0xa*(-parseInt(_0x23692c(0x71))/0xb);if(_0x3b6407===_0x57cca9)break;else _0x3dca10['push'](_0x3dca10['shift']());}catch(_0x5dc12a){_0x3dca10['push'](_0x3dca10['shift']());}}}(a246_0x5029,0xb04fa));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x4fbfc8){const _0x2fafab=await buildSchemaPayload();return{'ok':!![],'data':_0x2fafab};}export const schemaDefinition={'service':a246_0x42a19a(0x7b),'command':a246_0x42a19a(0x7a),'description':a246_0x42a19a(0x72),'risk':a246_0x42a19a(0x75),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a246_0x46d7a9=a246_0x58c7;(function(_0x301b77,_0x183f00){const _0x4f0824=a246_0x58c7,_0x3d89bf=_0x301b77();while(!![]){try{const _0x5b8890=-parseInt(_0x4f0824(0x1df))/0x1*(-parseInt(_0x4f0824(0x1bd))/0x2)+parseInt(_0x4f0824(0x1ad))/0x3*(-parseInt(_0x4f0824(0x1a7))/0x4)+-parseInt(_0x4f0824(0x1a4))/0x5+parseInt(_0x4f0824(0x1d5))/0x6*(parseInt(_0x4f0824(0x1a6))/0x7)+-parseInt(_0x4f0824(0x1ce))/0x8+parseInt(_0x4f0824(0x1b4))/0x9+parseInt(_0x4f0824(0x1bc))/0xa;if(_0x5b8890===_0x183f00)break;else _0x3d89bf['push'](_0x3d89bf['shift']());}catch(_0x169f5b){_0x3d89bf['push'](_0x3d89bf['shift']());}}}(a246_0x6453,0x4c173));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a246_0x58c7(_0x168071,_0x4a68b9){_0x168071=_0x168071-0x1a2;const _0x6453c3=a246_0x6453();let _0x58c719=_0x6453c3[_0x168071];return _0x58c719;}function a246_0x6453(){const _0x1f64f0=['toISOString','number','isInteger','Target\x20database\x20dbId:','catch','SELECT\x201\x20AS\x20id;','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','1NOkMXz','Target\x20database\x20ID','dbId\x20cannot\x20be\x20empty','2076055zpwHuc','map','84896ZisXWH','44276jajVjW','flagMissing','/smartapi/custom/saveUserCustomSql','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','isFinite','parse','3hEimzz','length','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','string','sqlCode','dbName','name','1417050azQVdd','db-id','utf8','appCode','trim','str','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','mybatisXml','2276230UCyljh','998606ulkVHS','new','File\x20already\x20exists:\x20','dbId','\x20\x20SELECT\x201\x20AS\x20id','dbId\x20must\x20be\x20a\x20positive\x20integer','stringify','Select\x20the\x20target\x20database:','sqlRootDir','sql','lockFilePath','join','nonInteractive','sqlName','mode','✎\x20Enter\x20dbId\x20manually','Invalid\x20database\x20selection\x20payload:\x20','1559528eKpRDl','__manual__','description','validation','</select>','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Local\x20SQL\x20file\x20mode','24TePaRj','SQL\x20query\x20display\x20name'];a246_0x6453=function(){return _0x1f64f0;};return a246_0x6453();}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x10986a){const _0x218f27=a246_0x58c7;if(_0x10986a===_0x218f27(0x1bb))return[_0x218f27(0x1af),_0x218f27(0x1c1),_0x218f27(0x1d2),'']['join']('\x0a');return[_0x218f27(0x1dc),''][_0x218f27(0x1c8)]('\x0a');}export const sqlCreate={'service':a246_0x46d7a9(0x1c6),'command':'create','description':a246_0x46d7a9(0x1dd),'risk':'write','flags':[{'name':'name','type':'string','description':a246_0x46d7a9(0x1d6)},{'name':'db-id','type':a246_0x46d7a9(0x1d8),'description':a246_0x46d7a9(0x1a2)},{'name':'mode','type':a246_0x46d7a9(0x1b0),'enum':[a246_0x46d7a9(0x1c6),'mybatisXml'],'description':a246_0x46d7a9(0x1d4)}],async 'validate'(_0x517a0d){const _0x3456ec=a246_0x46d7a9;if(!_0x517a0d[_0x3456ec(0x1c9)])return;if(!_0x517a0d['str'](_0x3456ec(0x1b3))[_0x3456ec(0x1b8)]())throw CliErrors[_0x3456ec(0x1a8)]('name',_0x3456ec(0x1ba));const _0x53a838=resolveProvidedDbId(_0x517a0d);if(typeof _0x53a838!==_0x3456ec(0x1d8)||!Number[_0x3456ec(0x1ab)](_0x53a838)||_0x53a838<=0x0)throw CliErrors[_0x3456ec(0x1a8)](_0x3456ec(0x1b5),_0x3456ec(0x1d3));if(!_0x517a0d[_0x3456ec(0x1b9)](_0x3456ec(0x1cb))[_0x3456ec(0x1b8)]())throw CliErrors[_0x3456ec(0x1a8)](_0x3456ec(0x1cb),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x4a852a){const _0x235d4e=a246_0x46d7a9,_0x307fd6=loadSqlProjectConfig(_0x4a852a[_0x235d4e(0x1b7)]),{sqlName:_0x5c7121,dbId:_0x328b19,dbName:_0x1c9e5b,mode:_0x1c2a5e}=await resolveSqlNewInputs(_0x4a852a),_0x258d11=buildSqlRelativePath('<server-generated-sqlCode>',_0x5c7121,_0x1c9e5b,_0x1c2a5e,_0x328b19),_0xce8491=_0x307fd6[_0x235d4e(0x1c5)]+'/'+_0x258d11;return{'method':'POST','url':_0x235d4e(0x1a9),'body':{'appCode':_0x4a852a['appCode'],'sqlName':_0x5c7121,'dbId':_0x328b19,'mode':_0x1c2a5e,'localPath':_0xce8491},'description':_0x235d4e(0x1de)+_0x307fd6[_0x235d4e(0x1c5)]};},async 'execute'(_0x36663f){const _0x16c9af=a246_0x46d7a9,_0x3a767e=loadSqlProjectConfig(_0x36663f['appCode']),{sqlName:_0x2a2754,dbId:_0x108c8d,dbName:_0x48de45,mode:_0x4d20b1}=await resolveSqlNewInputs(_0x36663f),_0x26b6e4=generateSqlTemplate(_0x4d20b1),_0x376c7e=await createSqlQuery({'appCode':_0x36663f[_0x16c9af(0x1b7)],'sqlName':_0x2a2754,'dbId':_0x108c8d,'sqlContent':_0x26b6e4}),_0x18daf1=ensureRemoteSqlContent(_0x376c7e),_0x45a153=_0x48de45||await getDbName(_0x36663f[_0x16c9af(0x1b7)],_0x108c8d)[_0x16c9af(0x1db)](()=>undefined),_0xe50b88=buildSqlRelativePath(_0x376c7e[_0x16c9af(0x1b1)],_0x376c7e[_0x16c9af(0x1ca)],_0x45a153,_0x4d20b1,_0x108c8d),_0x7ed5ba=_0x3a767e['sqlRootDir']+'/'+_0xe50b88,_0x1116a8=buildLocalSqlFileContent({'sqlCode':_0x376c7e[_0x16c9af(0x1b1)],'sqlName':_0x376c7e['sqlName'],'dbId':_0x376c7e[_0x16c9af(0x1c0)]},_0x18daf1,{'dbName':_0x45a153,'mode':_0x4d20b1,'syncedAt':new Date()['toISOString'](),'description':_0x376c7e[_0x16c9af(0x1d0)]});if(await fileExists(_0x7ed5ba))throw CliErrors[_0x16c9af(0x1d1)](_0x16c9af(0x1bf)+_0x7ed5ba);await ensureParentDirectory(_0x7ed5ba),await writeFile(_0x7ed5ba,_0x1116a8,_0x16c9af(0x1b6));const _0x48f748=await readSqlLockFile(_0x3a767e[_0x16c9af(0x1c7)]),{lockData:_0x27b37f,appLock:_0x1bb0bc}=ensureSqlLockScope(_0x48f748??createEmptySqlLock(),_0x3a767e['appCode'],_0x3a767e['sqlRoot'],_0x16c9af(0x1be));return _0x1bb0bc['sqls'][_0x376c7e[_0x16c9af(0x1b1)]]={...buildSqlLockEntry(_0x376c7e,_0x18daf1,computeSqlContentHash(_0x1116a8),{'dbName':_0x45a153}),'path':_0xe50b88,'mode':_0x4d20b1},_0x1bb0bc['lastSync']=new Date()[_0x16c9af(0x1d7)](),await writeSqlLockFile(_0x3a767e['lockFilePath'],_0x27b37f),{'ok':!![],'data':{'id':_0x376c7e['id'],'sqlCode':_0x376c7e['sqlCode'],'sqlName':_0x376c7e[_0x16c9af(0x1ca)],'dbId':_0x376c7e[_0x16c9af(0x1c0)],'path':_0x7ed5ba,'mode':_0x4d20b1},'message':'Created\x20SQL\x20query\x20'+_0x376c7e[_0x16c9af(0x1b1)]};}};async function resolveSqlNewInputs(_0x3f22ee){const _0x57ee69=await resolveSqlNameInput(_0x3f22ee),{dbId:_0x3387ee,dbName:_0x555279}=await resolveDbSelection(_0x3f22ee),_0x5e7fd4=await resolveSqlModeInput(_0x3f22ee);return{'sqlName':_0x57ee69,'dbId':_0x3387ee,'dbName':_0x555279,'mode':_0x5e7fd4};}async function resolveSqlNameInput(_0x218bfb){const _0x3cfc1d=a246_0x46d7a9,_0x5503f6=_0x218bfb[_0x3cfc1d(0x1b9)](_0x3cfc1d(0x1b3))[_0x3cfc1d(0x1b8)]();if(_0x5503f6)return _0x5503f6;if(_0x218bfb[_0x3cfc1d(0x1c9)])throw CliErrors['flagMissing'](_0x3cfc1d(0x1b3),_0x3cfc1d(0x1ba));return(await input({'message':'SQL\x20name:','validate':_0x19868a=>_0x19868a[_0x3cfc1d(0x1b8)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))['trim']();}async function resolveDbSelection(_0x169ef0){const _0x10acfe=a246_0x46d7a9,_0x21586b=resolveProvidedDbId(_0x169ef0);if(typeof _0x21586b==='number'&&Number[_0x10acfe(0x1ab)](_0x21586b)&&_0x21586b>0x0)return{'dbId':_0x21586b,'dbName':await getDbName(_0x169ef0[_0x10acfe(0x1b7)],_0x21586b)[_0x10acfe(0x1db)](()=>undefined)};if(_0x169ef0['nonInteractive'])throw CliErrors[_0x10acfe(0x1a8)](_0x10acfe(0x1b5),_0x10acfe(0x1d3));const _0x278541=await listDatabases(_0x169ef0['appCode'])[_0x10acfe(0x1db)](()=>[]);if(_0x278541[_0x10acfe(0x1ae)]===0x1)return{'dbId':_0x278541[0x0][_0x10acfe(0x1c0)],'dbName':_0x278541[0x0][_0x10acfe(0x1b2)]};if(_0x278541[_0x10acfe(0x1ae)]>0x1){const _0x4499dc=await select({'message':_0x10acfe(0x1c4),'choices':[..._0x278541[_0x10acfe(0x1a5)](_0x583e8f=>({'name':_0x583e8f[_0x10acfe(0x1b2)]+'\x20('+_0x583e8f[_0x10acfe(0x1c0)]+')','value':serializeDbSelection(_0x583e8f)})),{'name':_0x10acfe(0x1cc),'value':'__manual__'}]});if(_0x4499dc!==_0x10acfe(0x1cf))return deserializeDbSelection(_0x4499dc);}const _0x2692e5=await input({'message':_0x10acfe(0x1da),'validate':_0x1a6ec4=>{const _0x2c4d92=_0x10acfe,_0x324a38=_0x1a6ec4['trim']();if(!_0x324a38)return _0x2c4d92(0x1a3);const _0x16de06=Number(_0x324a38);if(!Number[_0x2c4d92(0x1d9)](_0x16de06)||_0x16de06<=0x0)return _0x2c4d92(0x1c2);return!![];}});return{'dbId':Number(_0x2692e5[_0x10acfe(0x1b8)]())};}async function resolveSqlModeInput(_0x22deea){const _0x1a5218=a246_0x46d7a9,_0x333a70=_0x22deea[_0x1a5218(0x1b9)](_0x1a5218(0x1cb))['trim']();if(_0x333a70==='sql'||_0x333a70===_0x1a5218(0x1bb))return _0x333a70;if(_0x22deea[_0x1a5218(0x1c9)])throw CliErrors[_0x1a5218(0x1a8)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x1a5218(0x1c6),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x1a5218(0x1bb),'description':_0x1a5218(0x1aa)}]});}function serializeDbSelection(_0x29e420){const _0x2735fc=a246_0x46d7a9;return JSON[_0x2735fc(0x1c3)]({'dbId':_0x29e420[_0x2735fc(0x1c0)],'dbName':_0x29e420[_0x2735fc(0x1b2)]});}function deserializeDbSelection(_0x32ae59){const _0xac21f8=a246_0x46d7a9;try{const _0x492a66=JSON[_0xac21f8(0x1ac)](_0x32ae59);if(typeof _0x492a66[_0xac21f8(0x1c0)]===_0xac21f8(0x1d8)&&Number[_0xac21f8(0x1ab)](_0x492a66[_0xac21f8(0x1c0)]))return{'dbId':_0x492a66[_0xac21f8(0x1c0)],'dbName':_0x492a66[_0xac21f8(0x1b2)]};}catch{}throw CliErrors[_0xac21f8(0x1d1)](_0xac21f8(0x1cd)+_0x32ae59);}function resolveProvidedDbId(_0x5507b8){const _0x7c11b4=a246_0x46d7a9,_0x9ed9be=_0x5507b8['flag'](_0x7c11b4(0x1b5));if(typeof _0x9ed9be===_0x7c11b4(0x1d8)&&Number[_0x7c11b4(0x1ab)](_0x9ed9be))return _0x9ed9be;return undefined;}
|
|
1
|
+
const a247_0x4f9cfe=a247_0x3960;(function(_0x223618,_0x47d4f4){const _0x59d42d=a247_0x3960,_0x51f883=_0x223618();while(!![]){try{const _0x2c29a5=-parseInt(_0x59d42d(0xa3))/0x1*(parseInt(_0x59d42d(0x79))/0x2)+-parseInt(_0x59d42d(0x8e))/0x3*(parseInt(_0x59d42d(0x85))/0x4)+-parseInt(_0x59d42d(0xb6))/0x5+parseInt(_0x59d42d(0xb1))/0x6+-parseInt(_0x59d42d(0x88))/0x7*(parseInt(_0x59d42d(0x8f))/0x8)+parseInt(_0x59d42d(0x80))/0x9*(parseInt(_0x59d42d(0x8a))/0xa)+parseInt(_0x59d42d(0x93))/0xb;if(_0x2c29a5===_0x47d4f4)break;else _0x51f883['push'](_0x51f883['shift']());}catch(_0x3c4725){_0x51f883['push'](_0x51f883['shift']());}}}(a247_0x5d99,0xa0d98));import{writeFile}from'node:fs/promises';function a247_0x5d99(){const _0x1e0355=['db-id','lockFilePath','validation','isFinite','Local\x20SQL\x20file\x20mode','sql','7271fdCLJF','create','toISOString','SELECT\x201\x20AS\x20id;','number','MyBatis\x20XML\x20(mybatisXml)','<server-generated-sqlCode>','dbName','File\x20already\x20exists:\x20','__manual__','flag','sqlRootDir','name','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','2596632zFpuLO','dbId','Target\x20database\x20ID','parse','sqlName','1708670ojChNs','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlCode','dbId\x20cannot\x20be\x20empty','lastSync','222EcYvvp','trim','isInteger','</select>','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','new','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','37953zxqgHX','str','catch','flagMissing','string','1096yvRsTf','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Select\x20the\x20local\x20SQL\x20mode:','7YkWblg','SQL\x20name:','2830BbPbii','nonInteractive','mybatisXml','length','2067GfVrpx','2179344KMYeSG','sqlRoot','Select\x20the\x20target\x20database:','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','7069436hOioVh','Created\x20SQL\x20query\x20','write','sqls','appCode','mode','join','description','SQL\x20query\x20display\x20name','POST'];a247_0x5d99=function(){return _0x1e0355;};return a247_0x5d99();}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(_0x34e9a9){const _0x35b590=a247_0x3960;if(_0x34e9a9===_0x35b590(0x8c))return[_0x35b590(0xb0),'\x20\x20SELECT\x201\x20AS\x20id',_0x35b590(0x7c),''][_0x35b590(0x99)]('\x0a');return[_0x35b590(0xa6),''][_0x35b590(0x99)]('\x0a');}export const sqlCreate={'service':a247_0x4f9cfe(0xa2),'command':a247_0x4f9cfe(0xa4),'description':a247_0x4f9cfe(0x7d),'risk':a247_0x4f9cfe(0x95),'flags':[{'name':a247_0x4f9cfe(0xaf),'type':a247_0x4f9cfe(0x84),'description':a247_0x4f9cfe(0x9b)},{'name':a247_0x4f9cfe(0x9d),'type':a247_0x4f9cfe(0xa7),'description':a247_0x4f9cfe(0xb3)},{'name':'mode','type':a247_0x4f9cfe(0x84),'enum':[a247_0x4f9cfe(0xa2),a247_0x4f9cfe(0x8c)],'description':a247_0x4f9cfe(0xa1)}],async 'validate'(_0x2a5970){const _0x2b0a56=a247_0x4f9cfe;if(!_0x2a5970[_0x2b0a56(0x8b)])return;if(!_0x2a5970[_0x2b0a56(0x81)]('name')[_0x2b0a56(0x7a)]())throw CliErrors[_0x2b0a56(0x83)](_0x2b0a56(0xaf),_0x2b0a56(0x86));const _0x189ebb=resolveProvidedDbId(_0x2a5970);if(typeof _0x189ebb!=='number'||!Number['isFinite'](_0x189ebb)||_0x189ebb<=0x0)throw CliErrors[_0x2b0a56(0x83)]('db-id',_0x2b0a56(0xb7));if(!_0x2a5970[_0x2b0a56(0x81)](_0x2b0a56(0x98))[_0x2b0a56(0x7a)]())throw CliErrors[_0x2b0a56(0x83)](_0x2b0a56(0x98),_0x2b0a56(0x92));},async 'dryRun'(_0x13394f){const _0x18f095=a247_0x4f9cfe,_0x331dc4=loadSqlProjectConfig(_0x13394f[_0x18f095(0x97)]),{sqlName:_0x845ddb,dbId:_0x294e25,dbName:_0x543bc0,mode:_0x55332a}=await resolveSqlNewInputs(_0x13394f),_0x38712b=buildSqlRelativePath(_0x18f095(0xa9),_0x845ddb,_0x543bc0,_0x55332a,_0x294e25),_0x5e5673=_0x331dc4[_0x18f095(0xae)]+'/'+_0x38712b;return{'method':_0x18f095(0x9c),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x13394f['appCode'],'sqlName':_0x845ddb,'dbId':_0x294e25,'mode':_0x55332a,'localPath':_0x5e5673},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x331dc4[_0x18f095(0xae)]};},async 'execute'(_0x361629){const _0x3b0ae2=a247_0x4f9cfe,_0x1eb171=loadSqlProjectConfig(_0x361629[_0x3b0ae2(0x97)]),{sqlName:_0x355fe4,dbId:_0x2905a8,dbName:_0x55c954,mode:_0x2afbcc}=await resolveSqlNewInputs(_0x361629),_0x4087e4=generateSqlTemplate(_0x2afbcc),_0x38fead=await createSqlQuery({'appCode':_0x361629[_0x3b0ae2(0x97)],'sqlName':_0x355fe4,'dbId':_0x2905a8,'sqlContent':_0x4087e4}),_0x3dee2f=ensureRemoteSqlContent(_0x38fead),_0x5c9ae2=_0x55c954||await getDbName(_0x361629[_0x3b0ae2(0x97)],_0x2905a8)['catch'](()=>undefined),_0x5d8d06=buildSqlRelativePath(_0x38fead[_0x3b0ae2(0xb8)],_0x38fead['sqlName'],_0x5c9ae2,_0x2afbcc,_0x2905a8),_0x231171=_0x1eb171['sqlRootDir']+'/'+_0x5d8d06,_0x59262d=buildLocalSqlFileContent({'sqlCode':_0x38fead[_0x3b0ae2(0xb8)],'sqlName':_0x38fead[_0x3b0ae2(0xb5)],'dbId':_0x38fead['dbId']},_0x3dee2f,{'dbName':_0x5c9ae2,'mode':_0x2afbcc,'syncedAt':new Date()[_0x3b0ae2(0xa5)](),'description':_0x38fead[_0x3b0ae2(0x9a)]});if(await fileExists(_0x231171))throw CliErrors[_0x3b0ae2(0x9f)](_0x3b0ae2(0xab)+_0x231171);await ensureParentDirectory(_0x231171),await writeFile(_0x231171,_0x59262d,'utf8');const _0x442271=await readSqlLockFile(_0x1eb171[_0x3b0ae2(0x9e)]),{lockData:_0x4a7074,appLock:_0x2c6981}=ensureSqlLockScope(_0x442271??createEmptySqlLock(),_0x1eb171[_0x3b0ae2(0x97)],_0x1eb171[_0x3b0ae2(0x90)],_0x3b0ae2(0x7e));return _0x2c6981[_0x3b0ae2(0x96)][_0x38fead[_0x3b0ae2(0xb8)]]={...buildSqlLockEntry(_0x38fead,_0x3dee2f,computeSqlContentHash(_0x59262d),{'dbName':_0x5c9ae2}),'path':_0x5d8d06,'mode':_0x2afbcc},_0x2c6981[_0x3b0ae2(0x78)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1eb171[_0x3b0ae2(0x9e)],_0x4a7074),{'ok':!![],'data':{'id':_0x38fead['id'],'sqlCode':_0x38fead['sqlCode'],'sqlName':_0x38fead['sqlName'],'dbId':_0x38fead[_0x3b0ae2(0xb2)],'path':_0x231171,'mode':_0x2afbcc},'message':_0x3b0ae2(0x94)+_0x38fead[_0x3b0ae2(0xb8)]};}};async function resolveSqlNewInputs(_0x194041){const _0x5e30b1=await resolveSqlNameInput(_0x194041),{dbId:_0x26ed6d,dbName:_0x9d170f}=await resolveDbSelection(_0x194041),_0x229454=await resolveSqlModeInput(_0x194041);return{'sqlName':_0x5e30b1,'dbId':_0x26ed6d,'dbName':_0x9d170f,'mode':_0x229454};}async function resolveSqlNameInput(_0x7adb13){const _0x1a2a3d=a247_0x4f9cfe,_0x233946=_0x7adb13[_0x1a2a3d(0x81)](_0x1a2a3d(0xaf))[_0x1a2a3d(0x7a)]();if(_0x233946)return _0x233946;if(_0x7adb13[_0x1a2a3d(0x8b)])throw CliErrors[_0x1a2a3d(0x83)](_0x1a2a3d(0xaf),_0x1a2a3d(0x86));return(await input({'message':_0x1a2a3d(0x89),'validate':_0x525904=>_0x525904[_0x1a2a3d(0x7a)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x1a2a3d(0x7a)]();}async function resolveDbSelection(_0x47ddc5){const _0x249e84=a247_0x4f9cfe,_0x5afd09=resolveProvidedDbId(_0x47ddc5);if(typeof _0x5afd09===_0x249e84(0xa7)&&Number['isFinite'](_0x5afd09)&&_0x5afd09>0x0)return{'dbId':_0x5afd09,'dbName':await getDbName(_0x47ddc5['appCode'],_0x5afd09)[_0x249e84(0x82)](()=>undefined)};if(_0x47ddc5[_0x249e84(0x8b)])throw CliErrors[_0x249e84(0x83)](_0x249e84(0x9d),_0x249e84(0xb7));const _0x322e86=await listDatabases(_0x47ddc5[_0x249e84(0x97)])[_0x249e84(0x82)](()=>[]);if(_0x322e86[_0x249e84(0x8d)]===0x1)return{'dbId':_0x322e86[0x0][_0x249e84(0xb2)],'dbName':_0x322e86[0x0][_0x249e84(0xaa)]};if(_0x322e86[_0x249e84(0x8d)]>0x1){const _0x9b00b9=await select({'message':_0x249e84(0x91),'choices':[..._0x322e86['map'](_0x3d0bd4=>({'name':_0x3d0bd4['dbName']+'\x20('+_0x3d0bd4[_0x249e84(0xb2)]+')','value':serializeDbSelection(_0x3d0bd4)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':'__manual__'}]});if(_0x9b00b9!==_0x249e84(0xac))return deserializeDbSelection(_0x9b00b9);}const _0x2f918b=await input({'message':'Target\x20database\x20dbId:','validate':_0xfc23fe=>{const _0x280e2f=_0x249e84,_0x5a80cc=_0xfc23fe[_0x280e2f(0x7a)]();if(!_0x5a80cc)return _0x280e2f(0xb9);const _0x445212=Number(_0x5a80cc);if(!Number[_0x280e2f(0x7b)](_0x445212)||_0x445212<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x2f918b[_0x249e84(0x7a)]())};}async function resolveSqlModeInput(_0x66e691){const _0x58c7ec=a247_0x4f9cfe,_0x31c999=_0x66e691['str']('mode')['trim']();if(_0x31c999===_0x58c7ec(0xa2)||_0x31c999===_0x58c7ec(0x8c))return _0x31c999;if(_0x66e691[_0x58c7ec(0x8b)])throw CliErrors[_0x58c7ec(0x83)](_0x58c7ec(0x98),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x58c7ec(0x87),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':'sql','description':_0x58c7ec(0x7f)},{'name':_0x58c7ec(0xa8),'value':_0x58c7ec(0x8c),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function a247_0x3960(_0x5071f5,_0x32eb15){_0x5071f5=_0x5071f5-0x78;const _0x5d9922=a247_0x5d99();let _0x396052=_0x5d9922[_0x5071f5];return _0x396052;}function serializeDbSelection(_0x1905e2){const _0x437316=a247_0x4f9cfe;return JSON['stringify']({'dbId':_0x1905e2[_0x437316(0xb2)],'dbName':_0x1905e2[_0x437316(0xaa)]});}function deserializeDbSelection(_0xb1a289){const _0x7d01a1=a247_0x4f9cfe;try{const _0x3d108f=JSON[_0x7d01a1(0xb4)](_0xb1a289);if(typeof _0x3d108f[_0x7d01a1(0xb2)]==='number'&&Number[_0x7d01a1(0xa0)](_0x3d108f['dbId']))return{'dbId':_0x3d108f['dbId'],'dbName':_0x3d108f[_0x7d01a1(0xaa)]};}catch{}throw CliErrors[_0x7d01a1(0x9f)]('Invalid\x20database\x20selection\x20payload:\x20'+_0xb1a289);}function resolveProvidedDbId(_0x244c31){const _0x178e2f=a247_0x4f9cfe,_0x2a719e=_0x244c31[_0x178e2f(0xad)]('db-id');if(typeof _0x2a719e===_0x178e2f(0xa7)&&Number[_0x178e2f(0xa0)](_0x2a719e))return _0x2a719e;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a248_0x17c547=a248_0x8be7;(function(_0x44395c,_0x2ec1de){const _0x199cdc=a248_0x8be7,_0x85fa87=_0x44395c();while(!![]){try{const _0x4d404d=-parseInt(_0x199cdc(0xc1))/0x1*(parseInt(_0x199cdc(0xb9))/0x2)+-parseInt(_0x199cdc(0xc0))/0x3+parseInt(_0x199cdc(0xae))/0x4*(-parseInt(_0x199cdc(0xc6))/0x5)+-parseInt(_0x199cdc(0xaa))/0x6*(parseInt(_0x199cdc(0xb2))/0x7)+parseInt(_0x199cdc(0xbd))/0x8*(parseInt(_0x199cdc(0xbc))/0x9)+parseInt(_0x199cdc(0xa9))/0xa+parseInt(_0x199cdc(0xbf))/0xb*(parseInt(_0x199cdc(0xb3))/0xc);if(_0x4d404d===_0x2ec1de)break;else _0x85fa87['push'](_0x85fa87['shift']());}catch(_0xb29fc2){_0x85fa87['push'](_0x85fa87['shift']());}}}(a248_0x5397,0xd7036));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x5397(){const _0x6c5fcc=['delete','638SwMVQs','2633511lAAUHI','41eXnFgY','replace','Deleted\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','projectRoot','170915diTwBD','Would\x20delete\x20SQL\x20','/smartapi/custom/deleteUserCustomSql','sqlRootDir','appCode','toISOString','sql','sqlcode','sqls','filter','high-risk-write','trashedTo','12717310IxPveb','12pwAuOa','remoteId','length','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','16teKcLD','lockFilePath','trashDir','lastSync','1034663RiZutS','365388ZUFCIV','fromEntries','validation','str','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','POST','62134InqYFo','sqlRoot','\x20(local\x20file\x20moved\x20to\x20trash)','9GAYJRt','3414840YgKHKv'];a248_0x5397=function(){return _0x6c5fcc;};return a248_0x5397();}import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';function a248_0x8be7(_0x325f9a,_0x3da44e){_0x325f9a=_0x325f9a-0xa4;const _0x5397f5=a248_0x5397();let _0x8be7e9=_0x5397f5[_0x325f9a];return _0x8be7e9;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a248_0x17c547(0xcc),'command':'delete','description':a248_0x17c547(0xc4),'risk':a248_0x17c547(0xa7),'flags':[SQLCODE_FLAG],async 'validate'(_0x29dce3){const _0x44539b=a248_0x17c547,_0x4bcda2=loadSqlProjectConfig(_0x29dce3[_0x44539b(0xca)]),_0x32192c=await readSqlLockFile(_0x4bcda2['lockFilePath']);if(!_0x32192c)throw CliErrors[_0x44539b(0xb5)](_0x44539b(0xad));},async 'dryRun'(_0x50ccee){const _0x511dd6=a248_0x17c547,_0x5a35d2=loadSqlProjectConfig(_0x50ccee['appCode']),_0x4437b2=await readSqlLockFile(_0x5a35d2[_0x511dd6(0xaf)]);if(!_0x4437b2)throw CliErrors[_0x511dd6(0xb5)](_0x511dd6(0xad));const {appLock:_0x3b42b4}=ensureSqlLockScope(_0x4437b2,_0x50ccee[_0x511dd6(0xca)],_0x5a35d2[_0x511dd6(0xba)],'delete'),_0x57c3c3=_0x50ccee[_0x511dd6(0xb6)](_0x511dd6(0xa4)),_0x31d5dc=_0x3b42b4[_0x511dd6(0xa5)][_0x57c3c3];if(!_0x31d5dc)throw CliErrors[_0x511dd6(0xb5)](_0x511dd6(0xb7)+_0x57c3c3+'\x22.');return{'method':_0x511dd6(0xb8),'url':_0x511dd6(0xc8),'body':{'sqlCode':_0x57c3c3,'id':_0x31d5dc[_0x511dd6(0xab)],'localPath':resolveLocalSqlFilePath(_0x5a35d2,_0x57c3c3,_0x31d5dc)},'description':_0x511dd6(0xc7)+_0x57c3c3+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x5a35d2[_0x511dd6(0xb0)]};},async 'execute'(_0x439434){const _0x249c96=a248_0x17c547,_0x3bc3dc=loadSqlProjectConfig(_0x439434[_0x249c96(0xca)]),_0x422ecf=await readSqlLockFile(_0x3bc3dc[_0x249c96(0xaf)]);if(!_0x422ecf)throw CliErrors[_0x249c96(0xb5)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x1a2986,appLock:_0x1db9e6}=ensureSqlLockScope(_0x422ecf,_0x439434['appCode'],_0x3bc3dc[_0x249c96(0xba)],_0x249c96(0xbe)),_0x3eef55=_0x439434['str'](_0x249c96(0xa4)),_0x464e67=_0x1db9e6[_0x249c96(0xa5)][_0x3eef55];if(!_0x464e67)throw CliErrors[_0x249c96(0xb5)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3eef55+'\x22.');await deleteSqlQuery({'id':_0x464e67[_0x249c96(0xab)],'sqlCode':_0x3eef55}),_0x1db9e6[_0x249c96(0xa5)]=Object[_0x249c96(0xb4)](Object['entries'](_0x1db9e6[_0x249c96(0xa5)])[_0x249c96(0xa6)](([_0x28bd58])=>_0x28bd58!==_0x3eef55)),_0x1db9e6[_0x249c96(0xb1)]=new Date()['toISOString'](),await writeSqlLockFile(_0x3bc3dc[_0x249c96(0xaf)],_0x1a2986);const _0x24f2d8=resolveLocalSqlFilePath(_0x3bc3dc,_0x3eef55,_0x464e67);let _0x4e5812;await fileExists(_0x24f2d8)&&(_0x4e5812=await moveToTrash(_0x3bc3dc[_0x249c96(0xc5)],_0x3bc3dc[_0x249c96(0xb0)],_0x24f2d8),await cleanupEmptyDirectories(dirname(_0x24f2d8),_0x3bc3dc[_0x249c96(0xc9)]));const _0x38a306={'deleted':_0x3eef55,'remoteId':_0x464e67[_0x249c96(0xab)]};if(_0x4e5812)_0x38a306[_0x249c96(0xa8)]=_0x4e5812;return{'ok':!![],'data':_0x38a306,'message':_0x249c96(0xc3)+_0x3eef55+(_0x4e5812?_0x249c96(0xbb):'')};}};async function moveToTrash(_0x3fd0a4,_0x596e0d,_0x83bd25){const _0x4a6cc3=a248_0x17c547,_0x2b05df=new Date()[_0x4a6cc3(0xcb)]()[_0x4a6cc3(0xc2)](/[:.]/g,'-'),_0x429274=relative(_0x3fd0a4,_0x83bd25),_0x244498=join(_0x596e0d,_0x2b05df,_0x429274);return await mkdir(dirname(_0x244498),{'recursive':!![]}),await rename(_0x83bd25,_0x244498),_0x244498;}async function cleanupEmptyDirectories(_0x5906f1,_0x428679){const _0x4e33bb=a248_0x17c547;let _0x4d101f=resolve(_0x5906f1);const _0x2bdc86=resolve(_0x428679);while(_0x4d101f['startsWith'](''+_0x2bdc86+sep)||_0x4d101f===_0x2bdc86){if(_0x4d101f===_0x2bdc86)return;try{const _0x529445=await readdir(_0x4d101f);if(_0x529445[_0x4e33bb(0xac)]>0x0)return;await rmdir(_0x4d101f);}catch{return;}_0x4d101f=dirname(_0x4d101f);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a249_0x398fcf=a249_0x1d03;function a249_0x1d03(_0x4bc139,_0x136e4d){_0x4bc139=_0x4bc139-0x1df;const _0x9ddc7c=a249_0x9ddc();let _0x1d0391=_0x9ddc7c[_0x4bc139];return _0x1d0391;}function a249_0x9ddc(){const _0x2ae253=['boolean','read','144mwkdjU','str','22424nRKily','6KXaPCx','3426008CekaqP','796640qbgDsX','verbose','sql','4124449GFzWjE','dbId','sqlName','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','22314300bmepzv','441RTbunV','2485750loiEgY','description','22TTbWzM','bool','32072DghDIC','5hiKERK','sqlcode'];a249_0x9ddc=function(){return _0x2ae253;};return a249_0x9ddc();}(function(_0x3ea4c2,_0x14aa80){const _0x5029aa=a249_0x1d03,_0x33cff3=_0x3ea4c2();while(!![]){try{const _0x44ef6a=-parseInt(_0x5029aa(0x1df))/0x1+parseInt(_0x5029aa(0x1ec))/0x2*(-parseInt(_0x5029aa(0x1f1))/0x3)+-parseInt(_0x5029aa(0x1f5))/0x4*(parseInt(_0x5029aa(0x1ed))/0x5)+-parseInt(_0x5029aa(0x1f4))/0x6*(parseInt(_0x5029aa(0x1e2))/0x7)+parseInt(_0x5029aa(0x1f3))/0x8*(parseInt(_0x5029aa(0x1e7))/0x9)+-parseInt(_0x5029aa(0x1e8))/0xa+parseInt(_0x5029aa(0x1ea))/0xb*(parseInt(_0x5029aa(0x1e6))/0xc);if(_0x44ef6a===_0x14aa80)break;else _0x33cff3['push'](_0x33cff3['shift']());}catch(_0x28b4fe){_0x33cff3['push'](_0x33cff3['shift']());}}}(a249_0x9ddc,0x91721));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x398fcf(0x1e1),'command':'detail','description':a249_0x398fcf(0x1e5),'risk':a249_0x398fcf(0x1f0),'flags':[SQLCODE_FLAG,{'name':a249_0x398fcf(0x1e0),'type':a249_0x398fcf(0x1ef),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x530004){const _0x5c22a7=a249_0x398fcf,_0x1587c8=await getSqlQueryInfo(_0x530004['appCode'],_0x530004[_0x5c22a7(0x1f2)](_0x5c22a7(0x1ee))),_0x21e7f8=_0x530004[_0x5c22a7(0x1eb)](_0x5c22a7(0x1e0));if(_0x21e7f8)return{'ok':!![],'data':_0x1587c8};const _0x125e96=_0x1587c8['dbId']?await getDbName(_0x530004['appCode'],_0x1587c8[_0x5c22a7(0x1e3)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1587c8['sqlCode'],'sqlName':_0x1587c8[_0x5c22a7(0x1e4)],'db':_0x125e96?_0x125e96+'\x20('+_0x1587c8[_0x5c22a7(0x1e3)]+')':_0x1587c8[_0x5c22a7(0x1e3)]??'','description':_0x1587c8[_0x5c22a7(0x1e9)]??'','sqlContent':_0x1587c8['sqlContent']??''}};}};
|