@lovrabet/rabetbase-cli 2.5.5 → 2.5.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.d.ts +40 -0
- package/lib/commands/db/cross-db-analysis-shared.js +1 -0
- package/lib/commands/db/cross-db-analyze-latest.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-latest.js +1 -0
- package/lib/commands/db/cross-db-analyze-start.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-start.js +1 -0
- package/lib/commands/db/cross-db-analyze-status.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-status.js +1 -0
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +7 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.d.ts +17 -0
- package/lib/core/cross-db-analysis.js +1 -0
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/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 +6 -4
- package/skills/rabetbase/guides/database-connection-workflow.md +12 -3
- package/skills/rabetbase/guides/independent-deployment.md +10 -2
- package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +2 -0
- package/skills/rabetbase/references/rabetbase-db-analyze.md +2 -0
- package/skills/rabetbase/references/rabetbase-db-cross-analyze.md +78 -0
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a224_0x314369=a224_0x3c1a;(function(_0x221a31,_0x545676){const _0x50a87a=a224_0x3c1a,_0x49a127=_0x221a31();while(!![]){try{const _0x8377bc=parseInt(_0x50a87a(0x196))/0x1+parseInt(_0x50a87a(0x1bb))/0x2*(parseInt(_0x50a87a(0x1b2))/0x3)+parseInt(_0x50a87a(0x1a0))/0x4+-parseInt(_0x50a87a(0x17a))/0x5+parseInt(_0x50a87a(0x1a9))/0x6*(parseInt(_0x50a87a(0x1c9))/0x7)+-parseInt(_0x50a87a(0x1cc))/0x8*(parseInt(_0x50a87a(0x1c4))/0x9)+-parseInt(_0x50a87a(0x1b4))/0xa;if(_0x8377bc===_0x545676)break;else _0x49a127['push'](_0x49a127['shift']());}catch(_0x55fa05){_0x49a127['push'](_0x49a127['shift']());}}}(a224_0x361c,0xeb5d7));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a224_0x314369(0x18b),'required':!![],'description':a224_0x314369(0x192)};export const ROLE_REF_FLAG={'name':a224_0x314369(0x1a3),'type':'string','required':!![],'description':a224_0x314369(0x1a8)};export const USER_REF_FLAG={'name':a224_0x314369(0x1c7),'type':a224_0x314369(0x1c0),'required':!![],'description':a224_0x314369(0x19b)};function a224_0x3c1a(_0x5dbec3,_0xaf89d9){_0x5dbec3=_0x5dbec3-0x179;const _0x361c38=a224_0x361c();let _0x3c1ad6=_0x361c38[_0x5dbec3];return _0x3c1ad6;}export const NAME_FLAG={'name':a224_0x314369(0x1a7),'type':a224_0x314369(0x1c0),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a224_0x314369(0x1a7),'type':a224_0x314369(0x1c0),'required':!![],'description':a224_0x314369(0x1c1)};export const REMARK_FLAG={'name':a224_0x314369(0x18d),'type':a224_0x314369(0x1c0),'required':![],'description':a224_0x314369(0x1b7)};export const EXPECT_USER_COUNT_FLAG={'name':a224_0x314369(0x1c3),'type':a224_0x314369(0x18b),'required':![],'description':a224_0x314369(0x1cb)};export const BUILTIN_ROLE_TYPES=['ADMIN',a224_0x314369(0x19c),a224_0x314369(0x18a)];export function isBuiltinRole(_0x532822){const _0x5edf42=a224_0x314369;return BUILTIN_ROLE_TYPES[_0x5edf42(0x1bd)](_0x532822);}export function assertCustomRole(_0x3e20a4,_0x9f4ff2){const _0x46924c=a224_0x314369;if(_0x3e20a4[_0x46924c(0x18e)]!==_0x46924c(0x195))throw CliErrors[_0x46924c(0x1ae)](_0x46924c(0x17f)+_0x9f4ff2+'\x20built-in\x20role\x20'+_0x3e20a4[_0x46924c(0x180)]+'\x20('+_0x3e20a4['roleType']+').',_0x46924c(0x19a));}export function projectRole(_0x5d1fd9){const _0x971948=a224_0x314369;return{'id':_0x5d1fd9['id'],'roleName':_0x5d1fd9['roleName'],'roleType':_0x5d1fd9[_0x971948(0x18e)],'remark':_0x5d1fd9['remark'],'userCount':_0x5d1fd9[_0x971948(0x197)],'permitCount':_0x5d1fd9[_0x971948(0x1aa)],'builtin':isBuiltinRole(_0x5d1fd9[_0x971948(0x18e)])};}export async function resolveRoleRef(_0x3544b9,_0x322d36){const _0x3d2bba=a224_0x314369,_0x281c5b=_0x322d36[_0x3d2bba(0x1ca)]();if(!_0x281c5b)throw CliErrors[_0x3d2bba(0x1ae)](_0x3d2bba(0x199),_0x3d2bba(0x1a2));if(/^\d+$/[_0x3d2bba(0x1b9)](_0x281c5b))return getRoleById(_0x3544b9,Number(_0x281c5b));const _0x331441=await listAllAppRoles(_0x3544b9),_0x2468a1=_0x331441[_0x3d2bba(0x1b3)](_0x4aad1f=>_0x4aad1f[_0x3d2bba(0x180)]===_0x281c5b);if(_0x2468a1[_0x3d2bba(0x188)]===0x0)throw CliErrors[_0x3d2bba(0x1ae)](_0x3d2bba(0x184)+_0x281c5b+'\x22\x20not\x20found\x20in\x20app\x20'+_0x3544b9+'.',_0x3d2bba(0x1c5));if(_0x2468a1[_0x3d2bba(0x188)]>0x1){const _0x3220d7=_0x2468a1[_0x3d2bba(0x1c2)](_0x2d6936=>_0x2d6936['id'])[_0x3d2bba(0x1b8)](',\x20');throw CliErrors[_0x3d2bba(0x1ae)](_0x3d2bba(0x184)+_0x281c5b+_0x3d2bba(0x1be)+_0x3220d7+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x2468a1[0x0];}export async function getRoleById(_0x55a2dc,_0x335bfb){const _0x19f410=a224_0x314369,_0x438fc6=await listAllAppRoles(_0x55a2dc),_0x38c365=_0x438fc6[_0x19f410(0x1b3)](_0x5c3376=>_0x5c3376['id']===_0x335bfb&&(!_0x5c3376[_0x19f410(0x194)]||_0x5c3376[_0x19f410(0x194)]===_0x55a2dc));if(_0x38c365[_0x19f410(0x188)]!==0x1)throw CliErrors[_0x19f410(0x1ae)](_0x19f410(0x183)+_0x335bfb+'\x20not\x20found\x20in\x20app\x20'+_0x55a2dc+'.',_0x19f410(0x1b5));return _0x38c365[0x0];}async function listAllAppRoles(_0x51aebe){const _0x34571f=a224_0x314369,_0x337c1e=0x64,_0x3a7047=[];for(let _0xafac27=0x1;;_0xafac27+=0x1){const {items:_0x67b9b2,paging:_0x40655f}=await listAppRoles(_0x51aebe,{'currentPage':_0xafac27,'pageSize':_0x337c1e});_0x3a7047[_0x34571f(0x1ba)](..._0x67b9b2);if(_0x67b9b2['length']<_0x337c1e||_0x40655f&&_0x3a7047[_0x34571f(0x188)]>=_0x40655f['totalCount'])return _0x3a7047;}}export async function resolveTenantCode(){const _0xaf8f3c=a224_0x314369,_0x51a90c=await getSessionUserInfo(),_0x16a8d5=_0x51a90c?.[_0xaf8f3c(0x1c7)]?.[_0xaf8f3c(0x1a1)]?.[_0xaf8f3c(0x1a6)];if(!_0x16a8d5)throw CliErrors[_0xaf8f3c(0x1ad)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x16a8d5;}function matchMember(_0x50265e,_0x1e886a){const _0x2198a8=a224_0x314369,_0x47ceb6=_0x1e886a[_0x2198a8(0x1ca)]()[_0x2198a8(0x1a4)]();return(_0x50265e[_0x2198a8(0x182)]??'')[_0x2198a8(0x1a4)]()===_0x47ceb6||(_0x50265e[_0x2198a8(0x191)]??'')[_0x2198a8(0x1a4)]()===_0x47ceb6;}function a224_0x361c(){const _0x33dbcf=['includes','\x22\x20is\x20ambiguous\x20(ids:\x20','Missing\x20user\x20reference.','string','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','map','expect-user-count','225FvCbDd','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','dev','user','Pass\x20--user\x20<id|name>.','63EaYQjD','trim','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','287032iDohro','flagMissing','4723145mcamZE','Pass\x20--user\x20<id>.','\x20member(s)\x20but\x20role\x20has\x20','User\x20','Removed\x20','Cannot\x20','roleName','POST','nickname','Role\x20id\x20','Role\x20name\x20\x22','/smartapi/permit/user-role/create','Anti-drift\x20check\x20failed:\x20expected\x20',';\x20no\x20change.','length','/smartapi/permit/user-role/delete','OWNER','number','Check\x20the\x20nickname/username.\x20','remark','roleType','\x20is\x20already\x20a\x20member\x20of\x20role\x20','\x22:\x20','username','Role\x20id\x20(from\x20`role\x20list`)','str','appCode','CUSTOM','1577732BRHeNh','userCount','\x20duplicate\x20memberships\x20for\x20user\x20','Missing\x20role\x20reference.','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','DEV','find','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','No\x20tenant\x20member\x20matches\x20\x22','224132grlURt','tenant','Pass\x20--role\x20<id|name>.','role','toLowerCase','userId','tenant_code','name','Role\x20id\x20or\x20exact\x20role\x20name','949398AdgjdV','permitCount','\x20is\x20not\x20a\x20member\x20of\x20role\x20','\x20members\x20of\x20the\x20OWNER\x20role.','authRequired','validation','user-add','dryRun','expectUserCount','6ruNBtP','filter','10050010RgkdWW','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','flag','Optional\x20role\x20remark/description','join','test','push','752798xRGlKO','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.'];a224_0x361c=function(){return _0x33dbcf;};return a224_0x361c();}export async function resolveUserRef(_0x154e17,_0x2641a0=a224_0x314369(0x17b)){const _0x25c70d=a224_0x314369,_0x5ff0c1=_0x154e17[_0x25c70d(0x1ca)]();if(!_0x5ff0c1)throw CliErrors[_0x25c70d(0x1ae)](_0x25c70d(0x1bf),_0x25c70d(0x1c8));const _0x512c9b=await resolveTenantCode(),_0x424c79=await getTenantMembers(_0x512c9b);if(/^\d+$/['test'](_0x5ff0c1)){const _0x5c9dd3=Number(_0x5ff0c1),_0x875bf=_0x424c79[_0x25c70d(0x19d)](_0x4c8b48=>_0x4c8b48[_0x25c70d(0x1a5)]===_0x5c9dd3);return{'userId':_0x5c9dd3,'username':_0x875bf?.[_0x25c70d(0x191)]??String(_0x5c9dd3),'nickname':_0x875bf?.[_0x25c70d(0x182)],'matchedBy':'id'};}const _0x3cd4b4=_0x424c79[_0x25c70d(0x1b3)](_0x2b50f4=>matchMember(_0x2b50f4,_0x5ff0c1));if(_0x3cd4b4[_0x25c70d(0x188)]===0x0)throw CliErrors[_0x25c70d(0x1ae)](_0x25c70d(0x19f)+_0x5ff0c1+'\x22.',_0x25c70d(0x18c)+_0x2641a0);if(_0x3cd4b4[_0x25c70d(0x188)]>0x1){const _0x21649d=_0x3cd4b4[_0x25c70d(0x1c2)](_0x1be8b9=>(_0x1be8b9[_0x25c70d(0x182)]??_0x1be8b9[_0x25c70d(0x191)]??'?')+'('+_0x1be8b9['userId']+')')[_0x25c70d(0x1b8)](',\x20');throw CliErrors[_0x25c70d(0x1ae)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x5ff0c1+_0x25c70d(0x190)+_0x21649d+'.',_0x2641a0);}const _0x58cb46=_0x3cd4b4[0x0];return{'userId':_0x58cb46[_0x25c70d(0x1a5)],'username':_0x58cb46[_0x25c70d(0x191)]??String(_0x58cb46['userId']),'nickname':_0x58cb46[_0x25c70d(0x182)],'matchedBy':_0x25c70d(0x1a7)};}export const CREATE_USER_ROLE_PATH=a224_0x314369(0x185);export const DELETE_USER_ROLE_PATH=a224_0x314369(0x189);export function computeRoleUserMutation(_0x4a0f67){const _0x23a621=a224_0x314369,{operation:_0x3632de,appCode:_0x2efa59,role:_0x1d90ae,relations:_0xb19970,user:_0xfca295}=_0x4a0f67,_0x19fc12=[...new Set(_0xb19970[_0x23a621(0x1c2)](_0x310d68=>_0x310d68[_0x23a621(0x1a5)]))],_0x561434=[];if(_0x4a0f67[_0x23a621(0x1b1)]!==undefined&&_0x4a0f67[_0x23a621(0x1b1)]!==_0x19fc12[_0x23a621(0x188)])throw CliErrors[_0x23a621(0x1ae)](_0x23a621(0x186)+_0x4a0f67[_0x23a621(0x1b1)]+_0x23a621(0x17c)+_0x19fc12[_0x23a621(0x188)]+'.',_0x23a621(0x19e));const _0x207183=_0x19fc12[_0x23a621(0x1bd)](_0xfca295[_0x23a621(0x1a5)]),_0x4dca49=_0xb19970['filter'](_0x43e0de=>_0x43e0de[_0x23a621(0x1a5)]===_0xfca295['userId'])['map'](_0x39c64d=>_0x39c64d['id']),_0x12592a=_0x3632de===_0x23a621(0x1af)?!_0x207183:_0x207183;let _0x40dc5e=_0x19fc12;_0x3632de===_0x23a621(0x1af)?_0x207183?_0x561434[_0x23a621(0x1ba)]('User\x20'+_0xfca295[_0x23a621(0x1a5)]+_0x23a621(0x18f)+_0x1d90ae[_0x23a621(0x180)]+';\x20no\x20change.'):_0x40dc5e=[..._0x19fc12,_0xfca295[_0x23a621(0x1a5)]]:!_0x207183?_0x561434['push'](_0x23a621(0x17d)+_0xfca295[_0x23a621(0x1a5)]+_0x23a621(0x1ab)+_0x1d90ae[_0x23a621(0x180)]+_0x23a621(0x187)):(_0x40dc5e=_0x19fc12[_0x23a621(0x1b3)](_0xd8d068=>_0xd8d068!==_0xfca295[_0x23a621(0x1a5)]),_0x4dca49['length']>0x1&&_0x561434[_0x23a621(0x1ba)](_0x23a621(0x17e)+_0x4dca49[_0x23a621(0x188)]+_0x23a621(0x198)+_0xfca295[_0x23a621(0x1a5)]+'.'));const _0x3d2fb6={'scope':_0x23a621(0x1c6),'operation':_0x3632de,'selector':{'appCode':_0x2efa59,'roleId':_0x1d90ae['id'],'roleName':_0x1d90ae[_0x23a621(0x180)],'userId':_0xfca295[_0x23a621(0x1a5)]},'before':{'userIds':_0x19fc12},'after':{'userIds':_0x40dc5e},'dryRun':_0x4a0f67[_0x23a621(0x1b0)],'backend':{'method':_0x23a621(0x181),'path':_0x3632de===_0x23a621(0x1af)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x561434};return{'mutation':_0x3d2fb6,'changed':_0x12592a,'matchingRelationIds':_0x4dca49};}export async function loadDevRoleRelations(_0x1c06a0,_0x4f207a){const _0x50c774=a224_0x314369,_0x32175a=0x64,_0x2ae3aa=[];for(let _0x54620f=0x1;;_0x54620f+=0x1){const {items:_0x27aa30,paging:_0x25606d}=await listDevUserRoleRelations(_0x1c06a0,{'roleId':_0x4f207a,'currentPage':_0x54620f,'pageSize':_0x32175a});_0x2ae3aa[_0x50c774(0x1ba)](..._0x27aa30);if(_0x27aa30[_0x50c774(0x188)]<_0x32175a||_0x25606d&&_0x2ae3aa['length']>=_0x25606d['totalCount'])return _0x2ae3aa;}}export function readRoleRef(_0x5256eb){const _0x56a5bb=a224_0x314369,_0x51c31b=_0x5256eb[_0x56a5bb(0x193)]('role')['trim']();if(!_0x51c31b)throw CliErrors['flagMissing'](_0x56a5bb(0x1a3),_0x56a5bb(0x1a2));return _0x51c31b;}export async function prepareUserMutation(_0x8bf617,_0x508361,_0x493379){const _0x967343=a224_0x314369,_0x1171aa=readRoleRef(_0x8bf617),_0x5ecf64=_0x8bf617[_0x967343(0x193)]('user')[_0x967343(0x1ca)]();if(!_0x5ecf64)throw CliErrors[_0x967343(0x179)](_0x967343(0x1c7),'Pass\x20--user\x20<id|name>.');const _0x1be740=_0x8bf617[_0x967343(0x1b6)](_0x967343(0x1c3)),_0x44d2c9=_0x1be740===undefined||_0x1be740===null?undefined:Number(_0x1be740),_0x4ed9c6=await resolveRoleRef(_0x8bf617[_0x967343(0x194)],_0x1171aa);if(_0x4ed9c6[_0x967343(0x18e)]===_0x967343(0x18a))throw CliErrors[_0x967343(0x1ae)](_0x967343(0x17f)+_0x508361+_0x967343(0x1ac),_0x967343(0x1bc));const _0x3c39f7=await resolveUserRef(_0x5ecf64),_0x2db926=await loadDevRoleRelations(_0x8bf617['appCode'],_0x4ed9c6['id']);return{...computeRoleUserMutation({'operation':_0x508361,'appCode':_0x8bf617[_0x967343(0x194)],'role':_0x4ed9c6,'relations':_0x2db926,'user':{'userId':_0x3c39f7[_0x967343(0x1a5)],'username':_0x3c39f7['username'],'nickname':_0x3c39f7[_0x967343(0x182)]},'dryRun':_0x493379,..._0x44d2c9!==undefined?{'expectUserCount':_0x44d2c9}:{}}),'role':_0x4ed9c6,'user':_0x3c39f7};}
|
|
1
|
+
const a228_0x1bdfd4=a228_0x515f;(function(_0x4f9da1,_0x2b45a1){const _0x41c26b=a228_0x515f,_0x39052b=_0x4f9da1();while(!![]){try{const _0x105262=parseInt(_0x41c26b(0x207))/0x1*(-parseInt(_0x41c26b(0x1cb))/0x2)+-parseInt(_0x41c26b(0x1dc))/0x3*(parseInt(_0x41c26b(0x1e8))/0x4)+-parseInt(_0x41c26b(0x201))/0x5+parseInt(_0x41c26b(0x203))/0x6*(-parseInt(_0x41c26b(0x1b9))/0x7)+-parseInt(_0x41c26b(0x1e2))/0x8+parseInt(_0x41c26b(0x200))/0x9+-parseInt(_0x41c26b(0x1f4))/0xa*(-parseInt(_0x41c26b(0x1d1))/0xb);if(_0x105262===_0x2b45a1)break;else _0x39052b['push'](_0x39052b['shift']());}catch(_0x11417e){_0x39052b['push'](_0x39052b['shift']());}}}(a228_0x34ba,0xaae73));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':a228_0x1bdfd4(0x1bc)};export const ROLE_REF_FLAG={'name':'role','type':a228_0x1bdfd4(0x1f9),'required':!![],'description':a228_0x1bdfd4(0x1d6)};export const USER_REF_FLAG={'name':a228_0x1bdfd4(0x1f7),'type':a228_0x1bdfd4(0x1f9),'required':!![],'description':a228_0x1bdfd4(0x1e0)};export const NAME_FLAG={'name':'name','type':a228_0x1bdfd4(0x1f9),'required':!![],'description':a228_0x1bdfd4(0x1ce)};export const USER_NAME_FLAG={'name':a228_0x1bdfd4(0x1c9),'type':a228_0x1bdfd4(0x1f9),'required':!![],'description':a228_0x1bdfd4(0x1e9)};function a228_0x515f(_0x2a2ca3,_0x244ef1){_0x2a2ca3=_0x2a2ca3-0x1b5;const _0x34ba05=a228_0x34ba();let _0x515fad=_0x34ba05[_0x2a2ca3];return _0x515fad;}export const REMARK_FLAG={'name':a228_0x1bdfd4(0x1e5),'type':a228_0x1bdfd4(0x1f9),'required':![],'description':a228_0x1bdfd4(0x20b)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a228_0x1bdfd4(0x1e7),'required':![],'description':a228_0x1bdfd4(0x1b7)};export const BUILTIN_ROLE_TYPES=[a228_0x1bdfd4(0x1ed),a228_0x1bdfd4(0x202),'OWNER'];export function isBuiltinRole(_0x518a9b){const _0x400f86=a228_0x1bdfd4;return BUILTIN_ROLE_TYPES[_0x400f86(0x209)](_0x518a9b);}export function assertCustomRole(_0x3e5080,_0xc31e58){const _0x53b4a9=a228_0x1bdfd4;if(_0x3e5080[_0x53b4a9(0x1d5)]!==_0x53b4a9(0x1b8))throw CliErrors[_0x53b4a9(0x1fd)]('Cannot\x20'+_0xc31e58+_0x53b4a9(0x1ee)+_0x3e5080[_0x53b4a9(0x1d9)]+'\x20('+_0x3e5080[_0x53b4a9(0x1d5)]+').',_0x53b4a9(0x1d2));}export function projectRole(_0x226cf5){const _0x3e6cec=a228_0x1bdfd4;return{'id':_0x226cf5['id'],'roleName':_0x226cf5[_0x3e6cec(0x1d9)],'roleType':_0x226cf5['roleType'],'remark':_0x226cf5[_0x3e6cec(0x1e5)],'userCount':_0x226cf5['userCount'],'permitCount':_0x226cf5[_0x3e6cec(0x1bd)],'builtin':isBuiltinRole(_0x226cf5['roleType'])};}function a228_0x34ba(){const _0x4df2e3=['/smartapi/permit/user-role/create','Pass\x20--user\x20<id>.','remark','\x20is\x20already\x20a\x20member\x20of\x20role\x20','number','319508frGMdt','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','user-add','nickname','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','ADMIN','\x20built-in\x20role\x20','appCode','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Multiple\x20tenant\x20members\x20match\x20\x22','Pass\x20--role\x20<id|name>.','toLowerCase','33082810IgGSMg','join','totalCount','user','Role\x20id\x20','string','push','expect-user-count','Missing\x20role\x20reference.','validation','\x22\x20not\x20found\x20in\x20app\x20','expectUserCount','2740212ZlJumm','4743865MFRYZB','DEV','6wsPuTo','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','str','User\x20','359091jyPnRh','role','includes','flagMissing','Optional\x20role\x20remark/description','\x22:\x20','Check\x20the\x20nickname/username.\x20','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','CUSTOM','3401979cTruBU','Disambiguate\x20with\x20--role\x20<id>.','length','Role\x20id\x20(from\x20`role\x20list`)','permitCount','Anti-drift\x20check\x20failed:\x20expected\x20','\x22\x20is\x20ambiguous\x20(ids:\x20','authRequired','\x20duplicate\x20memberships\x20for\x20user\x20','Pass\x20--user\x20<id|name>.','dev','Removed\x20','map','filter','userId','\x20member(s)\x20but\x20role\x20has\x20','name','trim','2ZYQzBP',';\x20no\x20change.','tenant','Role\x20name','Cannot\x20','OWNER','11bFvSwl','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','\x20not\x20found\x20in\x20app\x20','Missing\x20user\x20reference.','roleType','Role\x20id\x20or\x20exact\x20role\x20name','Role\x20name\x20\x22','find','roleName','No\x20tenant\x20member\x20matches\x20\x22','flag','6MsHTTF','tenant_code','username','/smartapi/permit/user-role/delete','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','test','7672920LMbqDX'];a228_0x34ba=function(){return _0x4df2e3;};return a228_0x34ba();}export async function resolveRoleRef(_0x2ae5de,_0x1acb73){const _0x101a5c=a228_0x1bdfd4,_0xc4108f=_0x1acb73['trim']();if(!_0xc4108f)throw CliErrors[_0x101a5c(0x1fd)](_0x101a5c(0x1fc),'Pass\x20--role\x20<id|name>.');if(/^\d+$/[_0x101a5c(0x1e1)](_0xc4108f))return getRoleById(_0x2ae5de,Number(_0xc4108f));const _0x441fda=await listAllAppRoles(_0x2ae5de),_0x1339d7=_0x441fda['filter'](_0x58faac=>_0x58faac[_0x101a5c(0x1d9)]===_0xc4108f);if(_0x1339d7[_0x101a5c(0x1bb)]===0x0)throw CliErrors[_0x101a5c(0x1fd)](_0x101a5c(0x1d7)+_0xc4108f+_0x101a5c(0x1fe)+_0x2ae5de+'.',_0x101a5c(0x204));if(_0x1339d7[_0x101a5c(0x1bb)]>0x1){const _0x5d1aa8=_0x1339d7['map'](_0x27b583=>_0x27b583['id'])['join'](',\x20');throw CliErrors[_0x101a5c(0x1fd)](_0x101a5c(0x1d7)+_0xc4108f+_0x101a5c(0x1bf)+_0x5d1aa8+').',_0x101a5c(0x1ba));}return _0x1339d7[0x0];}export async function getRoleById(_0x18392b,_0x105741){const _0x4b9519=a228_0x1bdfd4,_0x526bb3=await listAllAppRoles(_0x18392b),_0x107bcc=_0x526bb3[_0x4b9519(0x1c6)](_0x2280bd=>_0x2280bd['id']===_0x105741&&(!_0x2280bd['appCode']||_0x2280bd[_0x4b9519(0x1ef)]===_0x18392b));if(_0x107bcc[_0x4b9519(0x1bb)]!==0x1)throw CliErrors[_0x4b9519(0x1fd)](_0x4b9519(0x1f8)+_0x105741+_0x4b9519(0x1d3)+_0x18392b+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x107bcc[0x0];}async function listAllAppRoles(_0xc3661c){const _0x1e8548=a228_0x1bdfd4,_0x21dbb5=0x64,_0xc32809=[];for(let _0x22ffaa=0x1;;_0x22ffaa+=0x1){const {items:_0x5c59f6,paging:_0x59e237}=await listAppRoles(_0xc3661c,{'currentPage':_0x22ffaa,'pageSize':_0x21dbb5});_0xc32809[_0x1e8548(0x1fa)](..._0x5c59f6);if(_0x5c59f6[_0x1e8548(0x1bb)]<_0x21dbb5||_0x59e237&&_0xc32809[_0x1e8548(0x1bb)]>=_0x59e237[_0x1e8548(0x1f6)])return _0xc32809;}}export async function resolveTenantCode(){const _0x4b75c4=a228_0x1bdfd4,_0x2c5e53=await getSessionUserInfo(),_0x2d2e70=_0x2c5e53?.[_0x4b75c4(0x1f7)]?.[_0x4b75c4(0x1cd)]?.[_0x4b75c4(0x1dd)];if(!_0x2d2e70)throw CliErrors[_0x4b75c4(0x1c0)](_0x4b75c4(0x1ec));return _0x2d2e70;}function matchMember(_0xedb0a0,_0x4a1c23){const _0x478d29=a228_0x1bdfd4,_0x559532=_0x4a1c23[_0x478d29(0x1ca)]()[_0x478d29(0x1f3)]();return(_0xedb0a0[_0x478d29(0x1eb)]??'')[_0x478d29(0x1f3)]()===_0x559532||(_0xedb0a0[_0x478d29(0x1de)]??'')[_0x478d29(0x1f3)]()===_0x559532;}export async function resolveUserRef(_0x37267a,_0x8de7f5=a228_0x1bdfd4(0x1e4)){const _0x53b359=a228_0x1bdfd4,_0x544657=_0x37267a['trim']();if(!_0x544657)throw CliErrors[_0x53b359(0x1fd)](_0x53b359(0x1d4),_0x53b359(0x1c2));const _0x36b11e=await resolveTenantCode(),_0x4069aa=await getTenantMembers(_0x36b11e);if(/^\d+$/[_0x53b359(0x1e1)](_0x544657)){const _0x5141dd=Number(_0x544657),_0x576c2c=_0x4069aa[_0x53b359(0x1d8)](_0x39b7c0=>_0x39b7c0[_0x53b359(0x1c7)]===_0x5141dd);return{'userId':_0x5141dd,'username':_0x576c2c?.[_0x53b359(0x1de)]??String(_0x5141dd),'nickname':_0x576c2c?.[_0x53b359(0x1eb)],'matchedBy':'id'};}const _0x5d8e5f=_0x4069aa[_0x53b359(0x1c6)](_0x3d44f7=>matchMember(_0x3d44f7,_0x544657));if(_0x5d8e5f[_0x53b359(0x1bb)]===0x0)throw CliErrors['validation'](_0x53b359(0x1da)+_0x544657+'\x22.',_0x53b359(0x1b6)+_0x8de7f5);if(_0x5d8e5f[_0x53b359(0x1bb)]>0x1){const _0x2378a5=_0x5d8e5f[_0x53b359(0x1c5)](_0x4bf9c3=>(_0x4bf9c3[_0x53b359(0x1eb)]??_0x4bf9c3['username']??'?')+'('+_0x4bf9c3[_0x53b359(0x1c7)]+')')[_0x53b359(0x1f5)](',\x20');throw CliErrors[_0x53b359(0x1fd)](_0x53b359(0x1f1)+_0x544657+_0x53b359(0x1b5)+_0x2378a5+'.',_0x8de7f5);}const _0xa20834=_0x5d8e5f[0x0];return{'userId':_0xa20834[_0x53b359(0x1c7)],'username':_0xa20834['username']??String(_0xa20834[_0x53b359(0x1c7)]),'nickname':_0xa20834[_0x53b359(0x1eb)],'matchedBy':_0x53b359(0x1c9)};}export const CREATE_USER_ROLE_PATH=a228_0x1bdfd4(0x1e3);export const DELETE_USER_ROLE_PATH=a228_0x1bdfd4(0x1df);export function computeRoleUserMutation(_0x15d18c){const _0x273757=a228_0x1bdfd4,{operation:_0x15cf47,appCode:_0x3c4bbd,role:_0xab9282,relations:_0x14b7c9,user:_0x9f32bf}=_0x15d18c,_0x2c1ff1=[...new Set(_0x14b7c9['map'](_0x420b7a=>_0x420b7a[_0x273757(0x1c7)]))],_0x49d1bc=[];if(_0x15d18c[_0x273757(0x1ff)]!==undefined&&_0x15d18c[_0x273757(0x1ff)]!==_0x2c1ff1[_0x273757(0x1bb)])throw CliErrors[_0x273757(0x1fd)](_0x273757(0x1be)+_0x15d18c[_0x273757(0x1ff)]+_0x273757(0x1c8)+_0x2c1ff1[_0x273757(0x1bb)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0xe3ad78=_0x2c1ff1[_0x273757(0x209)](_0x9f32bf[_0x273757(0x1c7)]),_0x4949e0=_0x14b7c9[_0x273757(0x1c6)](_0x3495dd=>_0x3495dd[_0x273757(0x1c7)]===_0x9f32bf[_0x273757(0x1c7)])[_0x273757(0x1c5)](_0x4b181e=>_0x4b181e['id']),_0x3b8446=_0x15cf47===_0x273757(0x1ea)?!_0xe3ad78:_0xe3ad78;let _0x2c695d=_0x2c1ff1;_0x15cf47===_0x273757(0x1ea)?_0xe3ad78?_0x49d1bc[_0x273757(0x1fa)](_0x273757(0x206)+_0x9f32bf[_0x273757(0x1c7)]+_0x273757(0x1e6)+_0xab9282[_0x273757(0x1d9)]+_0x273757(0x1cc)):_0x2c695d=[..._0x2c1ff1,_0x9f32bf[_0x273757(0x1c7)]]:!_0xe3ad78?_0x49d1bc['push']('User\x20'+_0x9f32bf[_0x273757(0x1c7)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0xab9282[_0x273757(0x1d9)]+';\x20no\x20change.'):(_0x2c695d=_0x2c1ff1[_0x273757(0x1c6)](_0x2433bc=>_0x2433bc!==_0x9f32bf['userId']),_0x4949e0[_0x273757(0x1bb)]>0x1&&_0x49d1bc['push'](_0x273757(0x1c4)+_0x4949e0[_0x273757(0x1bb)]+_0x273757(0x1c1)+_0x9f32bf[_0x273757(0x1c7)]+'.'));const _0x2b8ad2={'scope':_0x273757(0x1c3),'operation':_0x15cf47,'selector':{'appCode':_0x3c4bbd,'roleId':_0xab9282['id'],'roleName':_0xab9282[_0x273757(0x1d9)],'userId':_0x9f32bf[_0x273757(0x1c7)]},'before':{'userIds':_0x2c1ff1},'after':{'userIds':_0x2c695d},'dryRun':_0x15d18c['dryRun'],'backend':{'method':'POST','path':_0x15cf47===_0x273757(0x1ea)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x49d1bc};return{'mutation':_0x2b8ad2,'changed':_0x3b8446,'matchingRelationIds':_0x4949e0};}export async function loadDevRoleRelations(_0x563130,_0x3dae57){const _0x4c071f=a228_0x1bdfd4,_0x56e21f=0x64,_0x2512c6=[];for(let _0x2b99b1=0x1;;_0x2b99b1+=0x1){const {items:_0x5f7ce0,paging:_0x3484a6}=await listDevUserRoleRelations(_0x563130,{'roleId':_0x3dae57,'currentPage':_0x2b99b1,'pageSize':_0x56e21f});_0x2512c6[_0x4c071f(0x1fa)](..._0x5f7ce0);if(_0x5f7ce0['length']<_0x56e21f||_0x3484a6&&_0x2512c6[_0x4c071f(0x1bb)]>=_0x3484a6[_0x4c071f(0x1f6)])return _0x2512c6;}}export function readRoleRef(_0x280475){const _0x49c2d8=a228_0x1bdfd4,_0x7a6d63=_0x280475[_0x49c2d8(0x205)](_0x49c2d8(0x208))['trim']();if(!_0x7a6d63)throw CliErrors[_0x49c2d8(0x20a)](_0x49c2d8(0x208),_0x49c2d8(0x1f2));return _0x7a6d63;}export async function prepareUserMutation(_0x27ad49,_0x3550a8,_0x3c6a45){const _0x4144db=a228_0x1bdfd4,_0x5f1451=readRoleRef(_0x27ad49),_0x1ab225=_0x27ad49[_0x4144db(0x205)](_0x4144db(0x1f7))[_0x4144db(0x1ca)]();if(!_0x1ab225)throw CliErrors[_0x4144db(0x20a)](_0x4144db(0x1f7),_0x4144db(0x1c2));const _0x425e54=_0x27ad49[_0x4144db(0x1db)](_0x4144db(0x1fb)),_0x23f2cf=_0x425e54===undefined||_0x425e54===null?undefined:Number(_0x425e54),_0x4b7a79=await resolveRoleRef(_0x27ad49['appCode'],_0x5f1451);if(_0x4b7a79[_0x4144db(0x1d5)]===_0x4144db(0x1d0))throw CliErrors['validation'](_0x4144db(0x1cf)+_0x3550a8+'\x20members\x20of\x20the\x20OWNER\x20role.',_0x4144db(0x1f0));const _0x2b31d4=await resolveUserRef(_0x1ab225),_0x18ab09=await loadDevRoleRelations(_0x27ad49[_0x4144db(0x1ef)],_0x4b7a79['id']);return{...computeRoleUserMutation({'operation':_0x3550a8,'appCode':_0x27ad49[_0x4144db(0x1ef)],'role':_0x4b7a79,'relations':_0x18ab09,'user':{'userId':_0x2b31d4[_0x4144db(0x1c7)],'username':_0x2b31d4['username'],'nickname':_0x2b31d4['nickname']},'dryRun':_0x3c6a45,..._0x23f2cf!==undefined?{'expectUserCount':_0x23f2cf}:{}}),'role':_0x4b7a79,'user':_0x2b31d4};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a229_0x4d0569=a229_0x3c61;(function(_0x1f8645,_0x273e37){const _0x26a0c4=a229_0x3c61,_0x132327=_0x1f8645();while(!![]){try{const _0x315b12=parseInt(_0x26a0c4(0x208))/0x1*(-parseInt(_0x26a0c4(0x20c))/0x2)+parseInt(_0x26a0c4(0x1f5))/0x3*(parseInt(_0x26a0c4(0x20a))/0x4)+-parseInt(_0x26a0c4(0x1f8))/0x5+-parseInt(_0x26a0c4(0x1fa))/0x6*(parseInt(_0x26a0c4(0x20d))/0x7)+-parseInt(_0x26a0c4(0x20b))/0x8+parseInt(_0x26a0c4(0x200))/0x9*(parseInt(_0x26a0c4(0x201))/0xa)+-parseInt(_0x26a0c4(0x1f6))/0xb*(-parseInt(_0x26a0c4(0x1f3))/0xc);if(_0x315b12===_0x273e37)break;else _0x132327['push'](_0x132327['shift']());}catch(_0x40218d){_0x132327['push'](_0x132327['shift']());}}}(a229_0x27f1,0x521be));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a229_0x27f1(){const _0x12592c=['num','update','--name\x20cannot\x20be\x20empty.','roleName','3745EIpRTB','trim','973892IrDKoY','3786752MpkbpD','272EXvNVX','7foJEJE','\x20(id=','length','Updated\x20role\x20','validation','2164080lqXasg','appCode','3PXvmdD','66evfsKp','POST','1020420bHoawP','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','922626luiPyE','write','string','name','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','remark','36xhIvbo','878310sRsgXX','flag','role'];a229_0x27f1=function(){return _0x12592c;};return a229_0x27f1();}import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH='/smartapi/permit/role/update';function readPatch(_0x3e0328){const _0x33a510=a229_0x3c61,_0x30ce32=_0x3e0328[_0x33a510(0x202)](_0x33a510(0x1fd)),_0xdbe053=_0x3e0328[_0x33a510(0x202)](_0x33a510(0x1ff)),_0x2f732f={};if(_0x30ce32!==undefined&&_0x30ce32!==null){const _0x9fb20a=String(_0x30ce32)[_0x33a510(0x209)]();if(!_0x9fb20a)throw CliErrors[_0x33a510(0x1f2)](_0x33a510(0x206));if(_0x9fb20a[_0x33a510(0x20f)]>0x40)throw CliErrors[_0x33a510(0x1f2)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x2f732f['roleName']=_0x9fb20a;}_0xdbe053!==undefined&&_0xdbe053!==null&&(_0x2f732f[_0x33a510(0x1ff)]=String(_0xdbe053));if(_0x2f732f[_0x33a510(0x207)]===undefined&&_0x2f732f[_0x33a510(0x1ff)]===undefined)throw CliErrors[_0x33a510(0x1f2)]('Nothing\x20to\x20update.',_0x33a510(0x1f9));return _0x2f732f;}function a229_0x3c61(_0x1bb702,_0x47b27a){_0x1bb702=_0x1bb702-0x1f2;const _0x27f1a4=a229_0x27f1();let _0x3c61ca=_0x27f1a4[_0x1bb702];return _0x3c61ca;}export const roleUpdate={'service':a229_0x4d0569(0x203),'command':a229_0x4d0569(0x205),'description':a229_0x4d0569(0x1fe),'risk':a229_0x4d0569(0x1fb),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a229_0x4d0569(0x1fc),'required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x26a235){readPatch(_0x26a235);},async 'dryRun'(_0x3adbd2){const _0x4019c5=a229_0x4d0569,_0x13598e=_0x3adbd2[_0x4019c5(0x204)]('id'),_0x24e519=readPatch(_0x3adbd2),_0xfbf56d=await getRoleById(_0x3adbd2[_0x4019c5(0x1f4)],_0x13598e);return assertCustomRole(_0xfbf56d,_0x4019c5(0x205)),asDryRunResult({'scope':'dev','operation':_0x4019c5(0x205),'selector':{'appCode':_0x3adbd2[_0x4019c5(0x1f4)],'roleId':_0x13598e,'roleName':_0xfbf56d[_0x4019c5(0x207)]},'before':projectRole(_0xfbf56d),'after':projectRole({..._0xfbf56d,..._0x24e519[_0x4019c5(0x207)]!==undefined?{'roleName':_0x24e519[_0x4019c5(0x207)]}:{},..._0x24e519[_0x4019c5(0x1ff)]!==undefined?{'remark':_0x24e519['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x4019c5(0x1f7),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x29842d){const _0x376e5b=a229_0x4d0569,_0x3ad35e=_0x29842d['num']('id'),_0xa37fc7=readPatch(_0x29842d),_0x50e487=await getRoleById(_0x29842d[_0x376e5b(0x1f4)],_0x3ad35e);assertCustomRole(_0x50e487,'update'),await updateAppRole({'id':_0x3ad35e,'appCode':_0x29842d[_0x376e5b(0x1f4)],..._0xa37fc7[_0x376e5b(0x207)]!==undefined?{'roleName':_0xa37fc7[_0x376e5b(0x207)]}:{},..._0xa37fc7[_0x376e5b(0x1ff)]!==undefined?{'remark':_0xa37fc7[_0x376e5b(0x1ff)]}:{}});const _0x3d59af=await getRoleById(_0x29842d['appCode'],_0x3ad35e);return{'ok':!![],'data':{'scope':'dev','operation':_0x376e5b(0x205),'selector':{'appCode':_0x29842d[_0x376e5b(0x1f4)],'roleId':_0x3ad35e,'roleName':_0x3d59af[_0x376e5b(0x207)]},'before':projectRole(_0x50e487),'after':projectRole(_0x3d59af),'dryRun':![],'backend':{'method':_0x376e5b(0x1f7),'path':UPDATE_PATH},'warnings':[]},'message':_0x376e5b(0x210)+_0x3d59af[_0x376e5b(0x207)]+_0x376e5b(0x20e)+_0x3ad35e+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a230_0x582e(){const _0x3a4e80=['19675071yFIcrZ','\x20to\x20role\x20','6568Ijcsif','userId','968894HkKcwB','username','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','POST','selector','roleId','2944851ylCRUi','5SSjSSd','No\x20change:\x20user\x20','4907fOqbvW','role','3369810AbwzzQ','appCode','964614yOcFfj','Added\x20user\x20','\x20already\x20in\x20role\x20','3368652GGQeFq','user-add','roleName'];a230_0x582e=function(){return _0x3a4e80;};return a230_0x582e();}const a230_0x490a51=a230_0x2509;(function(_0x143f88,_0xffd16c){const _0xbc3999=a230_0x2509,_0x1199f8=_0x143f88();while(!![]){try{const _0x33b1cf=-parseInt(_0xbc3999(0x166))/0x1+-parseInt(_0xbc3999(0x15c))/0x2+-parseInt(_0xbc3999(0x155))/0x3+parseInt(_0xbc3999(0x15f))/0x4+-parseInt(_0xbc3999(0x156))/0x5*(parseInt(_0xbc3999(0x15a))/0x6)+-parseInt(_0xbc3999(0x158))/0x7*(-parseInt(_0xbc3999(0x164))/0x8)+parseInt(_0xbc3999(0x162))/0x9;if(_0x33b1cf===_0xffd16c)break;else _0x1199f8['push'](_0x1199f8['shift']());}catch(_0x55de7e){_0x1199f8['push'](_0x1199f8['shift']());}}}(a230_0x582e,0x94c46));import{createDevUserRole}from'../../core/api-client.js';function a230_0x2509(_0x18227e,_0x462059){_0x18227e=_0x18227e-0x153;const _0x582ed7=a230_0x582e();let _0x2509dd=_0x582ed7[_0x18227e];return _0x2509dd;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a230_0x490a51(0x159),'command':a230_0x490a51(0x160),'description':a230_0x490a51(0x168),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5e8d83){const _0x5e22bd=a230_0x490a51,{mutation:_0x3982d4}=await prepareUserMutation(_0x5e8d83,'user-add',!![]);return asDryRunResult(_0x3982d4,{'method':_0x5e22bd(0x169),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0xe50373){const _0xe34ede=a230_0x490a51,{mutation:_0x320732,changed:_0x5f3206,role:_0x46a28e,user:_0x15c04f}=await prepareUserMutation(_0xe50373,_0xe34ede(0x160),![]);return _0x5f3206&&await createDevUserRole({'appCode':_0xe50373[_0xe34ede(0x15b)],'userId':_0x15c04f[_0xe34ede(0x165)],'username':_0x15c04f[_0xe34ede(0x167)],'roleType':_0x46a28e['roleType'],'roleId':_0x320732['selector'][_0xe34ede(0x154)]}),{'ok':!![],'data':_0x320732,'message':_0x5f3206?_0xe34ede(0x15d)+_0x320732[_0xe34ede(0x153)][_0xe34ede(0x165)]+_0xe34ede(0x163)+_0x320732[_0xe34ede(0x153)][_0xe34ede(0x161)]:_0xe34ede(0x157)+_0x320732[_0xe34ede(0x153)][_0xe34ede(0x165)]+_0xe34ede(0x15e)+_0x320732['selector'][_0xe34ede(0x161)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a231_0x573734=a231_0x4832;(function(_0x127a68,_0x2a6878){const _0x13fc09=a231_0x4832,_0x4805fb=_0x127a68();while(!![]){try{const _0x217329=-parseInt(_0x13fc09(0xdf))/0x1+parseInt(_0x13fc09(0xe0))/0x2*(parseInt(_0x13fc09(0xeb))/0x3)+parseInt(_0x13fc09(0xdd))/0x4+parseInt(_0x13fc09(0xe8))/0x5+-parseInt(_0x13fc09(0xea))/0x6*(parseInt(_0x13fc09(0xe2))/0x7)+parseInt(_0x13fc09(0xe6))/0x8*(parseInt(_0x13fc09(0xd9))/0x9)+-parseInt(_0x13fc09(0xdc))/0xa*(-parseInt(_0x13fc09(0xe9))/0xb);if(_0x217329===_0x2a6878)break;else _0x4805fb['push'](_0x4805fb['shift']());}catch(_0x4df49e){_0x4805fb['push'](_0x4805fb['shift']());}}}(a231_0x1795,0xcf112));import{deleteDevUserRole}from'../../core/api-client.js';function a231_0x4832(_0x152f3d,_0x4bb8d0){_0x152f3d=_0x152f3d-0xd9;const _0x17952d=a231_0x1795();let _0x483262=_0x17952d[_0x152f3d];return _0x483262;}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';function a231_0x1795(){const _0x2b330b=['1572qOiuwu','9ZESYLK','roleName','POST','29660BijXsg','3840876RyghOx','selector','953628BpxpRZ','2858RCCiNN','\x20from\x20role\x20','7WSllED','\x20not\x20in\x20role\x20','No\x20change:\x20user\x20','user-remove','9599512usxCtd','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','246175vXjGvH','11BGqtsV','6956286zCkuVV'];a231_0x1795=function(){return _0x2b330b;};return a231_0x1795();}export const roleUserRemove={'service':'role','command':a231_0x573734(0xe5),'description':a231_0x573734(0xe7),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0xba80ff){const _0x463727=a231_0x573734,{mutation:_0x56e725}=await prepareUserMutation(_0xba80ff,_0x463727(0xe5),!![]);return asDryRunResult(_0x56e725,{'method':_0x463727(0xdb),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x22c07a){const _0xa67cc4=a231_0x573734,{matchingRelationIds:_0x22f88a,mutation:_0x18059e,changed:_0x351c29}=await prepareUserMutation(_0x22c07a,_0xa67cc4(0xe5),![]);if(_0x351c29)for(const _0x53063d of _0x22f88a){await deleteDevUserRole(_0x53063d);}return{'ok':!![],'data':_0x18059e,'message':_0x351c29?'Removed\x20user\x20'+_0x18059e['selector']['userId']+_0xa67cc4(0xe1)+_0x18059e[_0xa67cc4(0xde)][_0xa67cc4(0xda)]:_0xa67cc4(0xe4)+_0x18059e[_0xa67cc4(0xde)]['userId']+_0xa67cc4(0xe3)+_0x18059e[_0xa67cc4(0xde)][_0xa67cc4(0xda)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a232_0x3bac08=a232_0x5e95;function a232_0x5e95(_0x4f4574,_0x55337a){_0x4f4574=_0x4f4574-0x131;const _0x498d9b=a232_0x498d();let _0x5e9536=_0x498d9b[_0x4f4574];return _0x5e9536;}(function(_0x3c8f63,_0x3a3e3d){const _0x16a247=a232_0x5e95,_0x11071c=_0x3c8f63();while(!![]){try{const _0x136e25=parseInt(_0x16a247(0x135))/0x1+-parseInt(_0x16a247(0x13a))/0x2*(-parseInt(_0x16a247(0x142))/0x3)+parseInt(_0x16a247(0x147))/0x4*(parseInt(_0x16a247(0x133))/0x5)+parseInt(_0x16a247(0x13b))/0x6*(parseInt(_0x16a247(0x13c))/0x7)+parseInt(_0x16a247(0x134))/0x8+-parseInt(_0x16a247(0x140))/0x9*(parseInt(_0x16a247(0x138))/0xa)+-parseInt(_0x16a247(0x137))/0xb*(parseInt(_0x16a247(0x148))/0xc);if(_0x136e25===_0x3a3e3d)break;else _0x11071c['push'](_0x11071c['shift']());}catch(_0x44bb57){_0x11071c['push'](_0x11071c['shift']());}}}(a232_0x498d,0x52cb6));function a232_0x498d(){const _0x500077=['211882ZmAGkX','413850DmMkEd','str','180842kfMcgu','48urugbO','29323uWDWKK','\x22\x20→\x20userId\x20','Pass\x20--name\x20<nickname|username>.','flagMissing','81jgRTvn','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','3CmFdPR','userId','matchedBy','read','user-resolve','494404UcOaSr','84SBqiYl','role','username','nickname','name','trim','5khcpps','93256dwEQGm','587234ZWcaXi','Resolved\x20\x22'];a232_0x498d=function(){return _0x500077;};return a232_0x498d();}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':a232_0x3bac08(0x149),'command':a232_0x3bac08(0x146),'description':a232_0x3bac08(0x141),'risk':a232_0x3bac08(0x145),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x204f17){const _0x27e806=a232_0x3bac08;if(!_0x204f17[_0x27e806(0x139)]('name')[_0x27e806(0x132)]())throw CliErrors[_0x27e806(0x13f)](_0x27e806(0x131),_0x27e806(0x13e));},async 'execute'(_0x44df28){const _0x5e7b6a=a232_0x3bac08,_0x56e294=_0x44df28[_0x5e7b6a(0x139)](_0x5e7b6a(0x131))[_0x5e7b6a(0x132)](),_0x4bc8e5=await resolveUserRef(_0x56e294,'Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.');return{'ok':!![],'data':{'user':{'userId':_0x4bc8e5[_0x5e7b6a(0x143)],'username':_0x4bc8e5[_0x5e7b6a(0x14a)],'nickname':_0x4bc8e5[_0x5e7b6a(0x14b)],'matchedBy':_0x4bc8e5[_0x5e7b6a(0x144)]}},'message':_0x5e7b6a(0x136)+_0x56e294+_0x5e7b6a(0x13d)+_0x4bc8e5[_0x5e7b6a(0x143)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a233_0x4e08b3=a233_0x3e2e;(function(_0x186768,_0x397350){const _0x478a4f=a233_0x3e2e,_0x5cab4e=_0x186768();while(!![]){try{const _0x311804=parseInt(_0x478a4f(0x1c6))/0x1*(parseInt(_0x478a4f(0x1ca))/0x2)+-parseInt(_0x478a4f(0x1c9))/0x3+parseInt(_0x478a4f(0x1bb))/0x4+parseInt(_0x478a4f(0x1cb))/0x5*(-parseInt(_0x478a4f(0x1bf))/0x6)+-parseInt(_0x478a4f(0x1bd))/0x7*(-parseInt(_0x478a4f(0x1c1))/0x8)+parseInt(_0x478a4f(0x1bc))/0x9+-parseInt(_0x478a4f(0x1ba))/0xa;if(_0x311804===_0x397350)break;else _0x5cab4e['push'](_0x5cab4e['shift']());}catch(_0x57ebd4){_0x5cab4e['push'](_0x5cab4e['shift']());}}}(a233_0x37c4,0x5f957));import{getAppRule}from'../../core/api-client.js';function a233_0x37c4(){const _0x54837d=['8mWiTQd','rule','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','\x20is\x20not\x20configured\x20for\x20app\x20','get','482RrhAeA','app_rule_not_found','appCode','1687911yyoZDl','1610RTpXHN','35ecfpjf','cookie','2670640auSEDH','2397808mOhnLr','3186729eFrUTp','254842JnCPPE','\x20for\x20','134346DYPNqQ','content'];a233_0x37c4=function(){return _0x54837d;};return a233_0x37c4();}function a233_0x3e2e(_0x40f16f,_0x357dbb){_0x40f16f=_0x40f16f-0x1ba;const _0x37c456=a233_0x37c4();let _0x3e2e7d=_0x37c456[_0x40f16f];return _0x3e2e7d;}import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a233_0x4e08b3(0x1c2),'command':a233_0x4e08b3(0x1c5),'description':a233_0x4e08b3(0x1c3),'risk':'read','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x288228){readAppRuleType(_0x288228);},async 'execute'(_0x4ae056){const _0x1ddbf3=a233_0x4e08b3,_0x3e956f=readAppRuleType(_0x4ae056),_0x307676=await getAppRule(_0x4ae056[_0x1ddbf3(0x1cc)],{'appCode':_0x4ae056[_0x1ddbf3(0x1c8)],'type':_0x3e956f});if(!_0x307676)throw appRuleError(_0x1ddbf3(0x1c7),appRuleFileName(_0x3e956f)+_0x1ddbf3(0x1c4)+_0x4ae056['appCode']+'.','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20'+_0x3e956f+'\x20--file\x20<path>\x20--dry-run`.');return{'ok':!![],'data':{'rule':{...projectAppRule(_0x3e956f,_0x307676),'content':_0x307676[_0x1ddbf3(0x1c0)]}},'message':'Loaded\x20'+appRuleFileName(_0x3e956f)+_0x1ddbf3(0x1be)+_0x4ae056['appCode']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1dd512,_0x2546d6){const _0xf2a83d=a234_0x50c6,_0x27b9fb=_0x1dd512();while(!![]){try{const _0x23dcd4=-parseInt(_0xf2a83d(0xd8))/0x1*(parseInt(_0xf2a83d(0xdb))/0x2)+-parseInt(_0xf2a83d(0xd5))/0x3*(-parseInt(_0xf2a83d(0xd4))/0x4)+parseInt(_0xf2a83d(0xd7))/0x5+-parseInt(_0xf2a83d(0xdc))/0x6*(-parseInt(_0xf2a83d(0xda))/0x7)+parseInt(_0xf2a83d(0xd9))/0x8+-parseInt(_0xf2a83d(0xdd))/0x9+-parseInt(_0xf2a83d(0xd6))/0xa;if(_0x23dcd4===_0x2546d6)break;else _0x27b9fb['push'](_0x27b9fb['shift']());}catch(_0x41379f){_0x27b9fb['push'](_0x27b9fb['shift']());}}}(a234_0x2a8f,0xbe9dc));import{ruleGet}from'../../commands/rule/get.js';import{ruleList}from'../../commands/rule/list.js';function a234_0x50c6(_0x411ece,_0x46c222){_0x411ece=_0x411ece-0xd4;const _0x2a8fb8=a234_0x2a8f();let _0x50c65b=_0x2a8fb8[_0x411ece];return _0x50c65b;}function a234_0x2a8f(){const _0x1739bf=['222669SfboAt','8427080HkUQvW','6294715OYCGHc','19zLWbai','4993224CqXVzO','246274RJmUNr','50686cpDqaS','102NkjXZe','7393851hRbruw','24HVcyle'];a234_0x2a8f=function(){return _0x1739bf;};return a234_0x2a8f();}import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a235_0xe7e4f9=a235_0x1abb;(function(_0x3778a6,_0x1b6e47){const _0x2bb717=a235_0x1abb,_0x21b536=_0x3778a6();while(!![]){try{const _0x273adb=-parseInt(_0x2bb717(0xe4))/0x1*(parseInt(_0x2bb717(0xe9))/0x2)+parseInt(_0x2bb717(0xea))/0x3+parseInt(_0x2bb717(0xf3))/0x4*(-parseInt(_0x2bb717(0xe7))/0x5)+-parseInt(_0x2bb717(0xef))/0x6+parseInt(_0x2bb717(0xf2))/0x7*(parseInt(_0x2bb717(0xf6))/0x8)+-parseInt(_0x2bb717(0xf5))/0x9*(-parseInt(_0x2bb717(0xe6))/0xa)+parseInt(_0x2bb717(0xf1))/0xb*(-parseInt(_0x2bb717(0xf0))/0xc);if(_0x273adb===_0x1b6e47)break;else _0x21b536['push'](_0x21b536['shift']());}catch(_0x203ea7){_0x21b536['push'](_0x21b536['shift']());}}}(a235_0xd618,0x47ad9));function a235_0xd618(){const _0x15d170=['1468OPtgcx','length','2891110YoEGPM','1808965PYvLog','list','648scYbla','1660050HKXxKL','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','Loaded\x20app\x20rule\x20configuration\x20for\x20','map','appCode','721176NBaaFB','12qLqCRk','645326JjEdsX','2457bskzKm','4poANFI','read','18GgVpKg','4064JBqcJe'];a235_0xd618=function(){return _0x15d170;};return a235_0xd618();}function a235_0x1abb(_0x4b4476,_0x3256bc){_0x4b4476=_0x4b4476-0xe4;const _0xd61866=a235_0xd618();let _0x1abbf4=_0xd61866[_0x4b4476];return _0x1abbf4;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':'rule','command':a235_0xe7e4f9(0xe8),'description':a235_0xe7e4f9(0xeb),'risk':a235_0xe7e4f9(0xf4),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x53d4ae){const _0x5a1d91=a235_0xe7e4f9,_0x1adde1=await Promise['all'](APP_RULE_TYPES[_0x5a1d91(0xed)](_0xf6d64=>getAppRule(_0x53d4ae['cookie'],{'appCode':_0x53d4ae[_0x5a1d91(0xee)],'type':_0xf6d64}))),_0x1c2363=APP_RULE_TYPES[_0x5a1d91(0xed)]((_0x3496ab,_0x4a7628)=>projectAppRule(_0x3496ab,_0x1adde1[_0x4a7628]??null));return{'ok':!![],'data':{'total':_0x1c2363[_0x5a1d91(0xe5)],'rules':_0x1c2363},'message':_0x5a1d91(0xec)+_0x53d4ae[_0x5a1d91(0xee)]};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a236_0x1d572a=a236_0x5a8f;(function(_0x1d525d,_0x15c583){const _0x38ade0=a236_0x5a8f,_0xdd2a01=_0x1d525d();while(!![]){try{const _0x1bcb00=parseInt(_0x38ade0(0xcc))/0x1*(-parseInt(_0x38ade0(0xce))/0x2)+parseInt(_0x38ade0(0xb1))/0x3+-parseInt(_0x38ade0(0xdd))/0x4*(parseInt(_0x38ade0(0xd4))/0x5)+parseInt(_0x38ade0(0xb4))/0x6*(parseInt(_0x38ade0(0xaf))/0x7)+parseInt(_0x38ade0(0xac))/0x8*(parseInt(_0x38ade0(0xc3))/0x9)+parseInt(_0x38ade0(0xc5))/0xa*(-parseInt(_0x38ade0(0xd5))/0xb)+parseInt(_0x38ade0(0xd8))/0xc*(-parseInt(_0x38ade0(0xca))/0xd);if(_0x1bcb00===_0x15c583)break;else _0xdd2a01['push'](_0xdd2a01['shift']());}catch(_0x2c2d77){_0xdd2a01['push'](_0xdd2a01['shift']());}}}(a236_0x4ab0,0x2315a));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';const SAVE_PATH=a236_0x1d572a(0xe7),NON_ATOMIC_WARNING='--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.';function readSetInput(_0x309134){const _0x182e62=a236_0x1d572a,_0x22702f=readAppRuleType(_0x309134),_0x3fbe70=_0x309134['str'](_0x182e62(0xe5))[_0x182e62(0xd7)]();if(!_0x3fbe70)throw appRuleError('app_rule_file_required',_0x182e62(0xda),_0x182e62(0xc7));const _0x5590b7=_0x309134[_0x182e62(0xb2)]('expected-version');let _0x554d7c;if(_0x5590b7!==undefined){_0x554d7c=Number(_0x5590b7);if(!Number[_0x182e62(0xae)](_0x554d7c)||_0x554d7c<0x0)throw appRuleError(_0x182e62(0xbd),_0x182e62(0xcb));}return{'type':_0x22702f,'file':_0x3fbe70,'expectedVersion':_0x554d7c};}async function prepareSet(_0x15e00a){const _0x321e4d=a236_0x1d572a,_0x4e2bc1=readSetInput(_0x15e00a),_0x38f463=await readAppRuleFile(_0x4e2bc1[_0x321e4d(0xe5)]),_0x1d1eed=await getAppRule(_0x15e00a[_0x321e4d(0xde)],{'appCode':_0x15e00a['appCode'],'type':_0x4e2bc1[_0x321e4d(0xea)]});if(_0x4e2bc1[_0x321e4d(0xe4)]!==undefined&&_0x1d1eed?.[_0x321e4d(0xab)]!==_0x4e2bc1[_0x321e4d(0xe4)])throw appRuleError(_0x321e4d(0xe1),appRuleFileName(_0x4e2bc1[_0x321e4d(0xea)])+_0x321e4d(0xd2),_0x321e4d(0xcd)+_0x4e2bc1['expectedVersion']+_0x321e4d(0xd0)+(_0x1d1eed?.[_0x321e4d(0xab)]??_0x321e4d(0xbb))+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x4e2bc1,'replacement':_0x38f463,'beforeRecord':_0x1d1eed,'before':projectAppRule(_0x4e2bc1[_0x321e4d(0xea)],_0x1d1eed),'planned':{'type':_0x4e2bc1['type'],'fileName':appRuleFileName(_0x4e2bc1[_0x321e4d(0xea)]),'contextScope':appRuleContextScope(_0x4e2bc1['type']),'enabled':!![],'appCode':_0x15e00a['appCode'],'scope':'rules','contentByteSize':_0x38f463[_0x321e4d(0xbf)],'contentHash':_0x38f463['contentHash']}};}function warningsFor(_0x476f4c){return _0x476f4c===undefined?[]:[NON_ATOMIC_WARNING];}function a236_0x5a8f(_0x5a957d,_0x8f3e17){_0x5a957d=_0x5a957d-0xab;const _0x4ab07c=a236_0x4ab0();let _0x5a8f1e=_0x4ab07c[_0x5a957d];return _0x5a8f1e;}function a236_0x4ab0(){const _0x3eb850=['appCode','\x20version\x20changed\x20before\x20write.','\x20--format\x20compress','5UAKIsu','46442iqHcWr','beforeRecord','trim','12GkgzRh','rule','--file\x20is\x20required.','content','push','693452hdagVS','cookie','app_rule_set_outcome_unknown','\x20could\x20not\x20be\x20verified.','app_rule_version_mismatch','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','number','expectedVersion','file','verified','/smartapi/knowledge-base/save','app_rule_verification_failed','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','type','Set\x20','version','556440rKXmfQ','set','isSafeInteger','119WZoVWx','cause','381141taKyPW','flag','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','82062SCpety','\x20for\x20','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','contentHash','app_rule_verification_unavailable','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','rabetbase\x20rule\x20get\x20--type\x20','unconfigured','input','app_rule_expected_version_invalid','before','byteSize','replacement','expected-version','The\x20set\x20request\x20was\x20sent,\x20but\x20','27dPvgXe','POST','100TLDayj','planned','Pass\x20a\x20UTF-8\x20Markdown\x20file.','write','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','1192763mXTHfa','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','113YcCGgI','Expected\x20','2074GPqEUN','rules',';\x20current\x20version\x20is\x20'];a236_0x4ab0=function(){return _0x3eb850;};return a236_0x4ab0();}export const ruleSet={'service':a236_0x1d572a(0xd9),'command':a236_0x1d572a(0xad),'description':a236_0x1d572a(0xb6),'risk':a236_0x1d572a(0xc8),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a236_0x1d572a(0xe5),'type':'string','required':!![],'description':a236_0x1d572a(0xe2)},{'name':a236_0x1d572a(0xc1),'type':a236_0x1d572a(0xe3),'required':![],'description':a236_0x1d572a(0xe9)}],async 'validate'(_0x3f63fa){readSetInput(_0x3f63fa);},async 'dryRun'(_0x52dd46){const _0x1d44bd=a236_0x1d572a,_0x3403db=await prepareSet(_0x52dd46);return asDryRunResult({'operation':'set','selector':{'appCode':_0x52dd46[_0x1d44bd(0xd1)],'scope':_0x1d44bd(0xcf),'type':_0x3403db[_0x1d44bd(0xbc)]['type']},'before':_0x3403db[_0x1d44bd(0xbe)],'after':_0x3403db[_0x1d44bd(0xc6)],'dryRun':!![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':warningsFor(_0x3403db['input'][_0x1d44bd(0xe4)]),'verification':{'expectedVersion':_0x3403db[_0x1d44bd(0xbc)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x1d44bd(0xba)+_0x3403db[_0x1d44bd(0xbc)][_0x1d44bd(0xea)]+_0x1d44bd(0xd3)}},{'method':_0x1d44bd(0xc4),'url':SAVE_PATH});},async 'execute'(_0x5167a9){const _0x2254a2=a236_0x1d572a,_0x16dd03=await prepareSet(_0x5167a9);let _0x1d3ee4=![];try{await saveAppRule(_0x5167a9[_0x2254a2(0xde)],{'appCode':_0x5167a9['appCode'],'type':_0x16dd03[_0x2254a2(0xbc)][_0x2254a2(0xea)],'content':_0x16dd03['replacement'][_0x2254a2(0xdb)]});}catch(_0x45e73f){if(!isPlatformTransportFailure(_0x45e73f))throw _0x45e73f;_0x1d3ee4=!![];}let _0x45f447;try{_0x45f447=await getAppRule(_0x5167a9[_0x2254a2(0xde)],{'appCode':_0x5167a9[_0x2254a2(0xd1)],'type':_0x16dd03['input'][_0x2254a2(0xea)]});}catch(_0x2b5178){const _0xa8439=appRuleError(_0x1d3ee4?_0x2254a2(0xdf):_0x2254a2(0xb8),_0x2254a2(0xc2)+appRuleFileName(_0x16dd03[_0x2254a2(0xbc)]['type'])+_0x2254a2(0xe0),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object['defineProperty'](_0xa8439,_0x2254a2(0xb0),{'value':_0x2b5178,'enumerable':![]});throw _0xa8439;}const _0x487b3c=_0x45f447&&inspectAppRuleContent(_0x45f447[_0x2254a2(0xdb)])[_0x2254a2(0xb7)]===_0x16dd03[_0x2254a2(0xc0)]['contentHash'],_0x55506b=_0x45f447&&(_0x16dd03[_0x2254a2(0xd6)]===null||_0x45f447[_0x2254a2(0xab)]>_0x16dd03[_0x2254a2(0xd6)][_0x2254a2(0xab)]);if(!_0x45f447||!_0x487b3c||!_0x55506b)throw appRuleError(_0x1d3ee4?_0x2254a2(0xdf):_0x2254a2(0xe8),appRuleFileName(_0x16dd03[_0x2254a2(0xbc)][_0x2254a2(0xea)])+_0x2254a2(0xb9),_0x2254a2(0xc9)+_0x16dd03[_0x2254a2(0xbc)][_0x2254a2(0xea)]+_0x2254a2(0xb3));const _0x2f79f7=warningsFor(_0x16dd03[_0x2254a2(0xbc)][_0x2254a2(0xe4)]);_0x1d3ee4&&_0x2f79f7[_0x2254a2(0xdc)]('Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.');const _0x34a567=projectAppRule(_0x16dd03[_0x2254a2(0xbc)][_0x2254a2(0xea)],_0x45f447);return{'ok':!![],'data':{'operation':_0x2254a2(0xad),'selector':{'appCode':_0x5167a9['appCode'],'scope':_0x2254a2(0xcf),'type':_0x16dd03[_0x2254a2(0xbc)][_0x2254a2(0xea)]},'before':_0x16dd03[_0x2254a2(0xbe)],'after':_0x34a567,'dryRun':![],'backend':{'method':_0x2254a2(0xc4),'path':SAVE_PATH},'warnings':_0x2f79f7,'verification':{'status':_0x2254a2(0xe6),'recoveredAfterUnknownResponse':_0x1d3ee4,'expectedVersion':_0x16dd03['input'][_0x2254a2(0xe4)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x2254a2(0xba)+_0x16dd03['input'][_0x2254a2(0xea)]+_0x2254a2(0xd3)}},'message':_0x2254a2(0xeb)+appRuleFileName(_0x16dd03[_0x2254a2(0xbc)]['type'])+_0x2254a2(0xb5)+_0x5167a9[_0x2254a2(0xd1)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a237_0x34b3eb=a237_0x5bdc;(function(_0x32dd2c,_0x4bccd5){const _0x4c2cae=a237_0x5bdc,_0x218122=_0x32dd2c();while(!![]){try{const _0x1bf39f=-parseInt(_0x4c2cae(0x84))/0x1+parseInt(_0x4c2cae(0x7c))/0x2+-parseInt(_0x4c2cae(0x8f))/0x3+-parseInt(_0x4c2cae(0x98))/0x4+-parseInt(_0x4c2cae(0x8b))/0x5+-parseInt(_0x4c2cae(0x7a))/0x6*(parseInt(_0x4c2cae(0xa5))/0x7)+-parseInt(_0x4c2cae(0x8a))/0x8*(-parseInt(_0x4c2cae(0x93))/0x9);if(_0x1bf39f===_0x4bccd5)break;else _0x218122['push'](_0x218122['shift']());}catch(_0x4f154d){_0x218122['push'](_0x218122['shift']());}}}(a237_0x2fe8,0xf3bcb));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=['rules',a237_0x34b3eb(0xa2)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':'RULES.md','database':a237_0x34b3eb(0x96)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':'database-analysis'};export function appRuleError(_0x42536c,_0x370211,_0x3c3d73){return new CliError(_0x42536c,0x1,_0x370211,_0x3c3d73);}export function readAppRuleType(_0x53ae2e){const _0x4e8313=a237_0x34b3eb,_0x3027b0=_0x53ae2e[_0x4e8313(0x91)](_0x4e8313(0x7e))[_0x4e8313(0x80)]()[_0x4e8313(0x8e)]();if(_0x3027b0!=='rules'&&_0x3027b0!==_0x4e8313(0xa2))throw appRuleError(_0x4e8313(0x7d),_0x4e8313(0x9c));return _0x3027b0;}function a237_0x2fe8(){const _0x5929ab=['appCode','186492dNeJeR','app_rule_file_required','isFile','hex','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','digest','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','App\x20rule\x20file\x20is\x20blank:\x20','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_too_large','database','byteLength','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','469thsgqN','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','content','13788QrFadJ','updateTime','1648042Raeubf','app_rule_type_invalid','type','size','trim','createTime','string','message','1289135mxKfgr','Cannot\x20access\x20app\x20rule\x20file:\x20','update','byteSize','app_rule_content_invalid','app_rule_file_unreadable','113144Xumwzx','117845VPnAel','Cannot\x20read\x20app\x20rule\x20file:\x20','contentHash','toLowerCase','4271523tjrnoD','--file\x20is\x20required.','str','version','1980nIGAhu','app_rule_file_invalid','decode','DATABASE.md'];a237_0x2fe8=function(){return _0x5929ab;};return a237_0x2fe8();}export function appRuleFileName(_0x34a715){return APP_RULE_FILES[_0x34a715];}export function appRuleContextScope(_0x17de72){return APP_RULE_CONTEXT_SCOPES[_0x17de72];}export function inspectAppRuleContent(_0x140fca){const _0xe20cf1=a237_0x34b3eb,_0x5f513c=Buffer['from'](_0x140fca,'utf8');return{'content':_0x140fca,'byteSize':_0x5f513c[_0xe20cf1(0xa3)],'contentHash':'sha256:'+createHash('sha256')[_0xe20cf1(0x86)](_0x5f513c)[_0xe20cf1(0x9d)](_0xe20cf1(0x9b))};}export async function readAppRuleFile(_0xd1a16f){const _0x2a3849=a237_0x34b3eb,_0x5b553b=_0xd1a16f[_0x2a3849(0x80)]();if(!_0x5b553b)throw appRuleError(_0x2a3849(0x99),_0x2a3849(0x90),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x1fcb5b=resolve(_0x5b553b);let _0x4c3b90;try{_0x4c3b90=await stat(_0x1fcb5b);}catch(_0x4a5f44){throw appRuleError('app_rule_file_unreadable',_0x2a3849(0x85)+_0x5b553b,_0x4a5f44 instanceof Error?_0x4a5f44[_0x2a3849(0x83)]:String(_0x4a5f44));}if(!_0x4c3b90[_0x2a3849(0x9a)]())throw appRuleError(_0x2a3849(0x94),_0x2a3849(0x9e)+_0x5b553b);if(_0x4c3b90[_0x2a3849(0x7f)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x2a3849(0xa1),_0x2a3849(0xa4));let _0x3c8d01;try{_0x3c8d01=await readFile(_0x1fcb5b);}catch(_0x2591fb){throw appRuleError(_0x2a3849(0x89),_0x2a3849(0x8c)+_0x5b553b,_0x2591fb instanceof Error?_0x2591fb[_0x2a3849(0x83)]:String(_0x2591fb));}if(_0x3c8d01[_0x2a3849(0xa3)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x2a3849(0xa1),_0x2a3849(0xa4));let _0x248873;try{_0x248873=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x2a3849(0x95)](_0x3c8d01);}catch{throw appRuleError(_0x2a3849(0x88),_0x2a3849(0xa0)+_0x5b553b);}if(!_0x248873[_0x2a3849(0x80)]())throw appRuleError(_0x2a3849(0x88),_0x2a3849(0x9f)+_0x5b553b);return inspectAppRuleContent(_0x248873);}export function projectAppRule(_0xbd808c,_0x1d2764){const _0x2bf05a=a237_0x34b3eb;if(!_0x1d2764)return{'type':_0xbd808c,'fileName':appRuleFileName(_0xbd808c),'contextScope':appRuleContextScope(_0xbd808c),'enabled':![]};const _0x4817c3=inspectAppRuleContent(_0x1d2764[_0x2bf05a(0x79)]);return{'type':_0xbd808c,'fileName':appRuleFileName(_0xbd808c),'contextScope':appRuleContextScope(_0xbd808c),'enabled':!![],'id':_0x1d2764['id'],'scope':_0x1d2764['scope'],'appCode':_0x1d2764[_0x2bf05a(0x97)],'version':_0x1d2764[_0x2bf05a(0x92)],'contentByteSize':_0x4817c3[_0x2bf05a(0x87)],'contentHash':_0x4817c3[_0x2bf05a(0x8d)],..._0x1d2764['createTime']!==undefined&&_0x1d2764[_0x2bf05a(0x81)]!==null?{'createTime':_0x1d2764[_0x2bf05a(0x81)]}:{},..._0x1d2764['updateTime']!==undefined&&_0x1d2764[_0x2bf05a(0x7b)]!==null?{'updateTime':_0x1d2764[_0x2bf05a(0x7b)]}:{}};}function a237_0x5bdc(_0x469ba7,_0x313b15){_0x469ba7=_0x469ba7-0x78;const _0x2fe83f=a237_0x2fe8();let _0x5bdc00=_0x2fe83f[_0x469ba7];return _0x5bdc00;}export const APP_RULE_TYPE_FLAG={'name':a237_0x34b3eb(0x7e),'type':a237_0x34b3eb(0x82),'required':!![],'description':a237_0x34b3eb(0x78),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a238_0x2d8b8b=a238_0x2d12;(function(_0x19e3c4,_0x49abfb){const _0x4d9f70=a238_0x2d12,_0x417b9d=_0x19e3c4();while(!![]){try{const _0x2f95cd=-parseInt(_0x4d9f70(0x1f4))/0x1+-parseInt(_0x4d9f70(0x1ea))/0x2*(-parseInt(_0x4d9f70(0x1b6))/0x3)+-parseInt(_0x4d9f70(0x1d6))/0x4+-parseInt(_0x4d9f70(0x1ec))/0x5+-parseInt(_0x4d9f70(0x1c2))/0x6*(parseInt(_0x4d9f70(0x1b5))/0x7)+-parseInt(_0x4d9f70(0x1c1))/0x8*(-parseInt(_0x4d9f70(0x1d0))/0x9)+parseInt(_0x4d9f70(0x1e7))/0xa*(parseInt(_0x4d9f70(0x1c6))/0xb);if(_0x2f95cd===_0x49abfb)break;else _0x417b9d['push'](_0x417b9d['shift']());}catch(_0x3eb663){_0x417b9d['push'](_0x417b9d['shift']());}}}(a238_0x5721,0xb4525));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';function a238_0x5721(){const _0x411789=['1859196fwSqkx','bun.lockb','4100930qCQwyl','\x20run\x20','utf-8','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','Script\x20name\x20defined\x20in\x20package.json','keys','push','\x0a\x20\x20Available\x20scripts:\x0a','1040498daPKjC','--watch','No\x20scripts\x20defined\x20in\x20package.json.','\x20run\x20<script>\x0a','No\x20package.json\x20found\x20in\x20current\x20directory.','bool','node_modules','\x0a\x20\x20Usage:\x20','140HlJGdj','3bVCrzv','run','build','join','Enable\x20watch\x20mode\x20for\x20preview','yarn.lock','\x20\x20\x20\x20','inherit','.bin','needsUpgrade','slice','992MdALKG','201882WUHTkf','scripts','cwd','preview','101629AfrRnS','error','Script\x20\x22','boolean','close','package.json','bun.lock','(none)','dev','pnpm-lock.yaml','101691UNpqud','\x20run\x20start','write','start','Run\x20a\x20package.json\x20script','npm','2294596JLrGDY','log','changed','args','validation','belowMinimum','all','\x20run\x20build','\x20run\x20preview\x20--watch','watch','bun','vite','pnpm','\x20exited\x20with\x20code\x20','parse','script','has','1640SuaZzk','length','\x20run\x20preview'];a238_0x5721=function(){return _0x411789;};return a238_0x5721();}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([a238_0x2d8b8b(0x1d3),a238_0x2d8b8b(0x1ce)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a238_0x2d8b8b(0x1d3),a238_0x2d8b8b(0x1ce),'build',a238_0x2d8b8b(0x1c5)]);export function syncProjectDomainRoutingBeforeScript(_0x51dfd3,_0x3599fd){const _0x318ff6=a238_0x2d8b8b;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x3599fd))return null;const _0x1dafb2=findProjectRootDirectory(_0x51dfd3);if(!resolveConfigPath(_0x1dafb2))return null;const _0x49e160=writeProjectDomainRoutingManifest(_0x1dafb2);return{'path':_0x49e160['path'],'changed':_0x49e160[_0x318ff6(0x1d8)]};}function readPackageScripts(_0x54958b){const _0x1e7796=a238_0x2d8b8b,_0x26d59a=resolve(_0x54958b,_0x1e7796(0x1cb));if(!existsSync(_0x26d59a))return null;try{const _0x2cf600=JSON[_0x1e7796(0x1e4)](readFileSync(_0x26d59a,_0x1e7796(0x1ee)));return _0x2cf600[_0x1e7796(0x1c3)]??{};}catch{return null;}}function detectPackageManager(_0x27a3a0){const _0x2752a2=a238_0x2d8b8b;if(existsSync(resolve(_0x27a3a0,_0x2752a2(0x1eb)))||existsSync(resolve(_0x27a3a0,_0x2752a2(0x1cc))))return _0x2752a2(0x1e0);if(existsSync(resolve(_0x27a3a0,_0x2752a2(0x1cf))))return _0x2752a2(0x1e2);if(existsSync(resolve(_0x27a3a0,_0x2752a2(0x1bb))))return'yarn';return _0x2752a2(0x1d5);}async function versionCheck(_0x5bf8e9){const _0x20c0aa=a238_0x2d8b8b,_0x37ab73=await checkCliVersion();(_0x37ab73['needsUpgrade']||_0x37ab73[_0x20c0aa(0x1db)])&&(printCliUpgradeWarning(_0x37ab73),assertCliVersionSupported(_0x37ab73));const _0x4b0f4b=await checkSdkVersion(_0x5bf8e9);if(_0x4b0f4b[_0x20c0aa(0x1bf)])printSdkUpgradeWarning(_0x4b0f4b);}function spawnScript(_0x1f76a3,_0x217fcf,_0x176fc4,_0xb9a90a){return new Promise((_0xfcc7ed,_0x5ccb22)=>{const _0x192816=a238_0x2d12,_0x337ae6=[_0x192816(0x1b7),_0x217fcf,..._0x176fc4],_0x4619de=spawn(_0x1f76a3,_0x337ae6,{'cwd':_0xb9a90a,'stdio':_0x192816(0x1bd),'shell':!![],'env':{...process.env,'PATH':''+join(_0xb9a90a,_0x192816(0x1b3),_0x192816(0x1be))+delimiter+process.env.PATH}});_0x4619de['on'](_0x192816(0x1ca),_0x3d56e0=>{const _0x29d2fe=_0x192816;if(_0x3d56e0===0x0||_0x3d56e0===null)_0xfcc7ed();else _0x5ccb22(new Error(_0x1f76a3+_0x29d2fe(0x1ed)+_0x217fcf+_0x29d2fe(0x1e3)+_0x3d56e0));}),_0x4619de['on'](_0x192816(0x1c7),_0x5ccb22);});}function spawnViteBuildWatch(_0x1a2720){return new Promise((_0x1a929f,_0x47c8b5)=>{const _0x2caa0a=a238_0x2d12,_0x1cd855=spawn(_0x2caa0a(0x1e1),[_0x2caa0a(0x1b8),_0x2caa0a(0x1f5)],{'cwd':_0x1a2720,'stdio':_0x2caa0a(0x1bd),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1a2720,_0x2caa0a(0x1b3),'.bin')+delimiter+process.env.PATH}});_0x1cd855['on'](_0x2caa0a(0x1ca),_0x368448=>{const _0xad7a20=_0x2caa0a;if(_0x368448===0x0||_0x368448===null)_0x1a929f();else _0x47c8b5(new Error(_0xad7a20(0x1ef)+_0x368448));}),_0x1cd855['on'](_0x2caa0a(0x1c7),_0x47c8b5);});}function spawnVitePreview(_0x386fb9){return new Promise((_0x476df2,_0x51e665)=>{const _0x27ce41=a238_0x2d12,_0x403199=spawn(_0x27ce41(0x1e1),[_0x27ce41(0x1c5)],{'cwd':_0x386fb9,'stdio':_0x27ce41(0x1bd),'shell':!![],'env':{...process.env,'PATH':''+join(_0x386fb9,_0x27ce41(0x1b3),_0x27ce41(0x1be))+delimiter+process.env.PATH}});_0x403199['on']('close',_0x11287d=>{if(_0x11287d===0x0||_0x11287d===null)_0x476df2();else _0x51e665(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x11287d));}),_0x403199['on'](_0x27ce41(0x1c7),_0x51e665);});}function a238_0x2d12(_0x47482a,_0x4f6fad){_0x47482a=_0x47482a-0x1b2;const _0x5721f7=a238_0x5721();let _0x2d1270=_0x5721f7[_0x47482a];return _0x2d1270;}const runFlags=[{'name':a238_0x2d8b8b(0x1df),'type':a238_0x2d8b8b(0x1c9),'description':a238_0x2d8b8b(0x1ba),'default':![]}];export const runDefinition={'service':a238_0x2d8b8b(0x1b7),'command':a238_0x2d8b8b(0x1b7),'description':a238_0x2d8b8b(0x1d4),'risk':a238_0x2d8b8b(0x1d2),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a238_0x2d8b8b(0x1e5),'description':a238_0x2d8b8b(0x1f0),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x50395c=a238_0x2d8b8b,_0x3ee507=[];return _0x3ee507['push']('\x20\x20EXAMPLES'),_0x3ee507[_0x50395c(0x1f2)](_0x50395c(0x1bc)+CLI_BIN_NAME+_0x50395c(0x1d1)),_0x3ee507[_0x50395c(0x1f2)](_0x50395c(0x1bc)+CLI_BIN_NAME+_0x50395c(0x1dd)),_0x3ee507[_0x50395c(0x1f2)](_0x50395c(0x1bc)+CLI_BIN_NAME+_0x50395c(0x1e9)),_0x3ee507[_0x50395c(0x1f2)](_0x50395c(0x1bc)+CLI_BIN_NAME+_0x50395c(0x1de)),_0x3ee507[_0x50395c(0x1b9)]('\x0a');},async 'execute'(_0x34f32d){const _0x3e2ee6=a238_0x2d8b8b,_0x3a8fc7=process[_0x3e2ee6(0x1c4)](),_0x5ca4bc=_0x34f32d[_0x3e2ee6(0x1d9)][0x0],_0x3a3e39=_0x34f32d[_0x3e2ee6(0x1d9)][_0x3e2ee6(0x1c0)](0x1),_0x4291c0=readPackageScripts(_0x3a8fc7);if(!_0x4291c0)throw CliErrors[_0x3e2ee6(0x1da)](_0x3e2ee6(0x1f8));if(!_0x5ca4bc){const _0x21705b=Object[_0x3e2ee6(0x1f1)](_0x4291c0);if(_0x21705b[_0x3e2ee6(0x1e8)]===0x0)console[_0x3e2ee6(0x1d7)](_0x3e2ee6(0x1f6));else{console[_0x3e2ee6(0x1d7)](_0x3e2ee6(0x1f3));for(const _0x1e39e3 of _0x21705b){console['log'](_0x3e2ee6(0x1bc)+_0x1e39e3);}console[_0x3e2ee6(0x1d7)](_0x3e2ee6(0x1b4)+CLI_BIN_NAME+_0x3e2ee6(0x1f7));}return{'ok':!![]};}if(!_0x4291c0[_0x5ca4bc])throw CliErrors[_0x3e2ee6(0x1da)](_0x3e2ee6(0x1c8)+_0x5ca4bc+'\x22\x20not\x20found\x20in\x20package.json.','Available:\x20'+(Object[_0x3e2ee6(0x1f1)](_0x4291c0)[_0x3e2ee6(0x1b9)](',\x20')||_0x3e2ee6(0x1cd)));const _0x115b2c=detectPackageManager(_0x3a8fc7),_0x29e56d=syncProjectDomainRoutingBeforeScript(_0x3a8fc7,_0x5ca4bc);_0x29e56d?.[_0x3e2ee6(0x1d8)]&&console[_0x3e2ee6(0x1c7)]('Domain\x20routing\x20synchronized:\x20'+_0x29e56d['path']);VERSION_CHECK_SCRIPTS[_0x3e2ee6(0x1e6)](_0x5ca4bc)&&await versionCheck(_0x3a8fc7);if(_0x5ca4bc==='preview'&&_0x34f32d[_0x3e2ee6(0x1b2)](_0x3e2ee6(0x1df)))return await Promise[_0x3e2ee6(0x1dc)]([spawnViteBuildWatch(_0x3a8fc7),spawnVitePreview(_0x3a8fc7)]),{'ok':!![]};return await spawnScript(_0x115b2c,_0x5ca4bc,_0x3a3e39,_0x3a8fc7),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a239_0xf0f4cf=a239_0x3c96;(function(_0x2d94a6,_0x39c0e4){const _0x16dffa=a239_0x3c96,_0x1be25f=_0x2d94a6();while(!![]){try{const _0xe575d5=parseInt(_0x16dffa(0x19d))/0x1*(parseInt(_0x16dffa(0x1a7))/0x2)+-parseInt(_0x16dffa(0x1a2))/0x3*(-parseInt(_0x16dffa(0x19c))/0x4)+parseInt(_0x16dffa(0x1a4))/0x5*(-parseInt(_0x16dffa(0x19f))/0x6)+parseInt(_0x16dffa(0x19a))/0x7+-parseInt(_0x16dffa(0x1a5))/0x8+-parseInt(_0x16dffa(0x19e))/0x9*(-parseInt(_0x16dffa(0x1a3))/0xa)+-parseInt(_0x16dffa(0x1a1))/0xb;if(_0xe575d5===_0x39c0e4)break;else _0x1be25f['push'](_0x1be25f['shift']());}catch(_0xda29d4){_0x1be25f['push'](_0x1be25f['shift']());}}}(a239_0x2ca1,0x60582));function a239_0x3c96(_0x4bff95,_0x4ffddc){_0x4bff95=_0x4bff95-0x199;const _0x2ca134=a239_0x2ca1();let _0x3c9622=_0x2ca134[_0x4bff95];return _0x3c9622;}import{buildSchemaPayload}from'../framework/schema-export.js';function a239_0x2ca1(){const _0x136a98=['10628849sqzsKy','117qcAAne','40sjoOrb','640JvpGWn','1915536icTarO','json','21406GzUJNR','Export\x20machine-readable\x20command\x20schema\x20(JSON)','2440522MSUwLu','read','69432VsSeCr','61ODcTwV','574659zphyyQ','15636VRfVAP','schema'];a239_0x2ca1=function(){return _0x136a98;};return a239_0x2ca1();}async function execute(_0x1cb421){const _0x1ff2a8=await buildSchemaPayload();return{'ok':!![],'data':_0x1ff2a8};}export const schemaDefinition={'service':a239_0xf0f4cf(0x1a0),'command':'export','description':a239_0xf0f4cf(0x199),'risk':a239_0xf0f4cf(0x19b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a239_0xf0f4cf(0x1a6),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a236_0x503215=a236_0x580e;(function(_0x42494b,_0x4d6461){const _0x39b85c=a236_0x580e,_0x3c61a5=_0x42494b();while(!![]){try{const _0x535eac=-parseInt(_0x39b85c(0x15c))/0x1*(parseInt(_0x39b85c(0x14c))/0x2)+parseInt(_0x39b85c(0x18a))/0x3*(-parseInt(_0x39b85c(0x183))/0x4)+-parseInt(_0x39b85c(0x18b))/0x5+parseInt(_0x39b85c(0x17f))/0x6+parseInt(_0x39b85c(0x16a))/0x7+parseInt(_0x39b85c(0x178))/0x8*(parseInt(_0x39b85c(0x184))/0x9)+parseInt(_0x39b85c(0x175))/0xa;if(_0x535eac===_0x4d6461)break;else _0x3c61a5['push'](_0x3c61a5['shift']());}catch(_0x5bff5e){_0x3c61a5['push'](_0x3c61a5['shift']());}}}(a236_0x1475,0x26c82));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a236_0x1475(){const _0x4090cf=['name','dbName','validation','db-id','Target\x20database\x20dbId:','953190RxlTRJ','Created\x20SQL\x20query\x20','Select\x20the\x20local\x20SQL\x20mode:','number','Local\x20SQL\x20file\x20mode','SQL\x20name:','nonInteractive','toISOString','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','SELECT\x201\x20AS\x20id;','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','1115500BQmtwr','<server-generated-sqlCode>','flagMissing','32KSnSNq','Target\x20database\x20ID','isFinite','trim','string','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','str','956922TDLUZq','sql','length','flag','48HtQkSy','65241PWoTjY','sqlName','lockFilePath','Invalid\x20database\x20selection\x20payload:\x20','write','File\x20already\x20exists:\x20','4185yXZtoN','913080nvUCWH','dbId\x20cannot\x20be\x20empty','sqlCode','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRoot','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','2TBpaYq','mybatisXml','sqlRootDir','new','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','dbId','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','lastSync','SQL\x20query\x20display\x20name','appCode','map','__manual__','SQL\x20name\x20cannot\x20be\x20empty','MyBatis\x20XML\x20(mybatisXml)','sqls','catch','77997EJgGTE','isInteger','POST','join','utf8','Plain\x20SQL\x20(sql)','\x20\x20SELECT\x201\x20AS\x20id','parse','mode'];a236_0x1475=function(){return _0x4090cf;};return a236_0x1475();}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x1fce98){const _0x41234d=a236_0x580e;if(_0x1fce98===_0x41234d(0x14d))return[_0x41234d(0x174),_0x41234d(0x162),'</select>',''][_0x41234d(0x15f)]('\x0a');return[_0x41234d(0x173),''][_0x41234d(0x15f)]('\x0a');}export const sqlCreate={'service':a236_0x503215(0x180),'command':'create','description':a236_0x503215(0x152),'risk':a236_0x503215(0x188),'flags':[{'name':a236_0x503215(0x165),'type':a236_0x503215(0x17c),'description':a236_0x503215(0x154)},{'name':a236_0x503215(0x168),'type':'number','description':a236_0x503215(0x179)},{'name':a236_0x503215(0x164),'type':a236_0x503215(0x17c),'enum':[a236_0x503215(0x180),a236_0x503215(0x14d)],'description':a236_0x503215(0x16e)}],async 'validate'(_0x4d55bb){const _0x17824c=a236_0x503215;if(!_0x4d55bb[_0x17824c(0x170)])return;if(!_0x4d55bb['str'](_0x17824c(0x165))['trim']())throw CliErrors[_0x17824c(0x177)]('name',_0x17824c(0x14b));const _0xe55fe7=resolveProvidedDbId(_0x4d55bb);if(typeof _0xe55fe7!==_0x17824c(0x16d)||!Number[_0x17824c(0x17a)](_0xe55fe7)||_0xe55fe7<=0x0)throw CliErrors[_0x17824c(0x177)](_0x17824c(0x168),_0x17824c(0x18e));if(!_0x4d55bb['str']('mode')['trim']())throw CliErrors['flagMissing']('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x3e0a5c){const _0x277e26=a236_0x503215,_0x583ce3=loadSqlProjectConfig(_0x3e0a5c[_0x277e26(0x155)]),{sqlName:_0xe89624,dbId:_0x28966e,dbName:_0x87d74a,mode:_0x316ef8}=await resolveSqlNewInputs(_0x3e0a5c),_0x174e6a=buildSqlRelativePath(_0x277e26(0x176),_0xe89624,_0x87d74a,_0x316ef8,_0x28966e),_0x21e81d=_0x583ce3['sqlRootDir']+'/'+_0x174e6a;return{'method':_0x277e26(0x15e),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x3e0a5c[_0x277e26(0x155)],'sqlName':_0xe89624,'dbId':_0x28966e,'mode':_0x316ef8,'localPath':_0x21e81d},'description':_0x277e26(0x172)+_0x583ce3[_0x277e26(0x14e)]};},async 'execute'(_0x585eb9){const _0x30612e=a236_0x503215,_0x57566c=loadSqlProjectConfig(_0x585eb9[_0x30612e(0x155)]),{sqlName:_0x3f676d,dbId:_0x2a1690,dbName:_0x2b45a1,mode:_0x350a44}=await resolveSqlNewInputs(_0x585eb9),_0x173efa=generateSqlTemplate(_0x350a44),_0x522083=await createSqlQuery({'appCode':_0x585eb9[_0x30612e(0x155)],'sqlName':_0x3f676d,'dbId':_0x2a1690,'sqlContent':_0x173efa}),_0x5e9ad0=ensureRemoteSqlContent(_0x522083),_0x2f290d=_0x2b45a1||await getDbName(_0x585eb9[_0x30612e(0x155)],_0x2a1690)['catch'](()=>undefined),_0x518480=buildSqlRelativePath(_0x522083[_0x30612e(0x18d)],_0x522083[_0x30612e(0x185)],_0x2f290d,_0x350a44,_0x2a1690),_0xbbd1d0=_0x57566c[_0x30612e(0x14e)]+'/'+_0x518480,_0x3ea4c2=buildLocalSqlFileContent({'sqlCode':_0x522083[_0x30612e(0x18d)],'sqlName':_0x522083[_0x30612e(0x185)],'dbId':_0x522083[_0x30612e(0x151)]},_0x5e9ad0,{'dbName':_0x2f290d,'mode':_0x350a44,'syncedAt':new Date()[_0x30612e(0x171)](),'description':_0x522083['description']});if(await fileExists(_0xbbd1d0))throw CliErrors[_0x30612e(0x167)](_0x30612e(0x189)+_0xbbd1d0);await ensureParentDirectory(_0xbbd1d0),await writeFile(_0xbbd1d0,_0x3ea4c2,_0x30612e(0x160));const _0x576c29=await readSqlLockFile(_0x57566c['lockFilePath']),{lockData:_0x1ae636,appLock:_0x3152db}=ensureSqlLockScope(_0x576c29??createEmptySqlLock(),_0x57566c[_0x30612e(0x155)],_0x57566c[_0x30612e(0x14a)],_0x30612e(0x14f));return _0x3152db[_0x30612e(0x15a)][_0x522083[_0x30612e(0x18d)]]={...buildSqlLockEntry(_0x522083,_0x5e9ad0,computeSqlContentHash(_0x3ea4c2),{'dbName':_0x2f290d}),'path':_0x518480,'mode':_0x350a44},_0x3152db[_0x30612e(0x153)]=new Date()[_0x30612e(0x171)](),await writeSqlLockFile(_0x57566c[_0x30612e(0x186)],_0x1ae636),{'ok':!![],'data':{'id':_0x522083['id'],'sqlCode':_0x522083['sqlCode'],'sqlName':_0x522083[_0x30612e(0x185)],'dbId':_0x522083[_0x30612e(0x151)],'path':_0xbbd1d0,'mode':_0x350a44},'message':_0x30612e(0x16b)+_0x522083[_0x30612e(0x18d)]};}};async function resolveSqlNewInputs(_0x3a8ffb){const _0x1472ef=await resolveSqlNameInput(_0x3a8ffb),{dbId:_0x377fe1,dbName:_0x3330c8}=await resolveDbSelection(_0x3a8ffb),_0x4b0d2a=await resolveSqlModeInput(_0x3a8ffb);return{'sqlName':_0x1472ef,'dbId':_0x377fe1,'dbName':_0x3330c8,'mode':_0x4b0d2a};}async function resolveSqlNameInput(_0x110881){const _0xf83124=a236_0x503215,_0x4d6a80=_0x110881[_0xf83124(0x17e)](_0xf83124(0x165))[_0xf83124(0x17b)]();if(_0x4d6a80)return _0x4d6a80;if(_0x110881[_0xf83124(0x170)])throw CliErrors['flagMissing']('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0xf83124(0x16f),'validate':_0x1f4ded=>_0x1f4ded[_0xf83124(0x17b)]()?!![]:_0xf83124(0x158)}))['trim']();}async function resolveDbSelection(_0x20babe){const _0x2e6091=a236_0x503215,_0x5f174f=resolveProvidedDbId(_0x20babe);if(typeof _0x5f174f===_0x2e6091(0x16d)&&Number['isFinite'](_0x5f174f)&&_0x5f174f>0x0)return{'dbId':_0x5f174f,'dbName':await getDbName(_0x20babe[_0x2e6091(0x155)],_0x5f174f)[_0x2e6091(0x15b)](()=>undefined)};if(_0x20babe[_0x2e6091(0x170)])throw CliErrors['flagMissing'](_0x2e6091(0x168),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x4f84c3=await listDatabases(_0x20babe[_0x2e6091(0x155)])[_0x2e6091(0x15b)](()=>[]);if(_0x4f84c3[_0x2e6091(0x181)]===0x1)return{'dbId':_0x4f84c3[0x0][_0x2e6091(0x151)],'dbName':_0x4f84c3[0x0]['dbName']};if(_0x4f84c3['length']>0x1){const _0x474b22=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x4f84c3[_0x2e6091(0x156)](_0x162358=>({'name':_0x162358[_0x2e6091(0x166)]+'\x20('+_0x162358[_0x2e6091(0x151)]+')','value':serializeDbSelection(_0x162358)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x2e6091(0x157)}]});if(_0x474b22!=='__manual__')return deserializeDbSelection(_0x474b22);}const _0x3ce336=await input({'message':_0x2e6091(0x169),'validate':_0x151c62=>{const _0x59a8ac=_0x2e6091,_0x2f6c45=_0x151c62[_0x59a8ac(0x17b)]();if(!_0x2f6c45)return _0x59a8ac(0x18c);const _0x5b6c2d=Number(_0x2f6c45);if(!Number[_0x59a8ac(0x15d)](_0x5b6c2d)||_0x5b6c2d<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x3ce336[_0x2e6091(0x17b)]())};}function a236_0x580e(_0x3f38f9,_0x2ee7f2){_0x3f38f9=_0x3f38f9-0x14a;const _0x1475b6=a236_0x1475();let _0x580eca=_0x1475b6[_0x3f38f9];return _0x580eca;}async function resolveSqlModeInput(_0x5953be){const _0x2f34bd=a236_0x503215,_0x2b2c59=_0x5953be[_0x2f34bd(0x17e)](_0x2f34bd(0x164))['trim']();if(_0x2b2c59===_0x2f34bd(0x180)||_0x2b2c59==='mybatisXml')return _0x2b2c59;if(_0x5953be[_0x2f34bd(0x170)])throw CliErrors[_0x2f34bd(0x177)]('mode',_0x2f34bd(0x17d));return await select({'message':_0x2f34bd(0x16c),'choices':[{'name':_0x2f34bd(0x161),'value':_0x2f34bd(0x180),'description':_0x2f34bd(0x150)},{'name':_0x2f34bd(0x159),'value':_0x2f34bd(0x14d),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x29b3fd){const _0x1856e4=a236_0x503215;return JSON['stringify']({'dbId':_0x29b3fd[_0x1856e4(0x151)],'dbName':_0x29b3fd['dbName']});}function deserializeDbSelection(_0x4a4183){const _0x283156=a236_0x503215;try{const _0xa1df50=JSON[_0x283156(0x163)](_0x4a4183);if(typeof _0xa1df50[_0x283156(0x151)]===_0x283156(0x16d)&&Number[_0x283156(0x17a)](_0xa1df50['dbId']))return{'dbId':_0xa1df50['dbId'],'dbName':_0xa1df50[_0x283156(0x166)]};}catch{}throw CliErrors[_0x283156(0x167)](_0x283156(0x187)+_0x4a4183);}function resolveProvidedDbId(_0x5b645c){const _0x4de8c4=a236_0x503215,_0xe5b92=_0x5b645c[_0x4de8c4(0x182)](_0x4de8c4(0x168));if(typeof _0xe5b92==='number'&&Number[_0x4de8c4(0x17a)](_0xe5b92))return _0xe5b92;return undefined;}
|
|
1
|
+
const a240_0x248308=a240_0x2581;(function(_0x1b17b0,_0x5f1e5d){const _0xe69453=a240_0x2581,_0x16ef80=_0x1b17b0();while(!![]){try{const _0xff268e=-parseInt(_0xe69453(0x11b))/0x1*(parseInt(_0xe69453(0x143))/0x2)+-parseInt(_0xe69453(0x140))/0x3*(parseInt(_0xe69453(0x111))/0x4)+parseInt(_0xe69453(0x112))/0x5+parseInt(_0xe69453(0x136))/0x6+-parseInt(_0xe69453(0x148))/0x7*(parseInt(_0xe69453(0x130))/0x8)+parseInt(_0xe69453(0x12a))/0x9+-parseInt(_0xe69453(0x10a))/0xa;if(_0xff268e===_0x5f1e5d)break;else _0x16ef80['push'](_0x16ef80['shift']());}catch(_0x42e74a){_0x16ef80['push'](_0x16ef80['shift']());}}}(a240_0x1c38,0x43f89));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a240_0x2581(_0x56924d,_0xcb9521){_0x56924d=_0x56924d-0x109;const _0x1c38e7=a240_0x1c38();let _0x2581ca=_0x1c38e7[_0x56924d];return _0x2581ca;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';function a240_0x1c38(){const _0x14d1df=['description','mybatisXml','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','lastSync','trim','Select\x20the\x20local\x20SQL\x20mode:','\x20\x20SELECT\x201\x20AS\x20id','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','toISOString','sqlCode','SQL\x20name:','join','new','Target\x20database\x20ID','4802841Chipwu','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRoot','nonInteractive','File\x20already\x20exists:\x20','map','8iekwLc','dbId\x20cannot\x20be\x20empty','str','sql','/smartapi/custom/saveUserCustomSql','utf8','1941024matMEI','validation','Target\x20database\x20dbId:','✎\x20Enter\x20dbId\x20manually','stringify','POST','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name\x20cannot\x20be\x20empty','sqlRootDir','Local\x20SQL\x20file\x20mode','3BXGRNc','mode','catch','2cicmml','flagMissing','parse','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','string','2261707evtSjg','lockFilePath','dbId','name','1610440FpyuMQ','db-id','length','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqls','flag','Created\x20SQL\x20query\x20','96092aazcpe','1195275CKyvzA','SELECT\x201\x20AS\x20id;','Select\x20the\x20target\x20database:','isFinite','number','__manual__','sqlName','dbName','appCode','309631VeWsbT'];a240_0x1c38=function(){return _0x14d1df;};return a240_0x1c38();}import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2aab86){const _0x8e1ab4=a240_0x2581;if(_0x2aab86===_0x8e1ab4(0x11d))return[_0x8e1ab4(0x146),_0x8e1ab4(0x122),'</select>',''][_0x8e1ab4(0x127)]('\x0a');return[_0x8e1ab4(0x113),''][_0x8e1ab4(0x127)]('\x0a');}export const sqlCreate={'service':a240_0x248308(0x133),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':'write','flags':[{'name':a240_0x248308(0x109),'type':a240_0x248308(0x147),'description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':'number','description':a240_0x248308(0x129)},{'name':a240_0x248308(0x141),'type':a240_0x248308(0x147),'enum':[a240_0x248308(0x133),a240_0x248308(0x11d)],'description':a240_0x248308(0x13f)}],async 'validate'(_0x2e7f89){const _0x1cfcc9=a240_0x248308;if(!_0x2e7f89[_0x1cfcc9(0x12d)])return;if(!_0x2e7f89[_0x1cfcc9(0x132)]('name')['trim']())throw CliErrors[_0x1cfcc9(0x144)](_0x1cfcc9(0x109),_0x1cfcc9(0x13c));const _0x350f67=resolveProvidedDbId(_0x2e7f89);if(typeof _0x350f67!==_0x1cfcc9(0x116)||!Number['isFinite'](_0x350f67)||_0x350f67<=0x0)throw CliErrors[_0x1cfcc9(0x144)](_0x1cfcc9(0x10b),_0x1cfcc9(0x10d));if(!_0x2e7f89['str']('mode')['trim']())throw CliErrors['flagMissing'](_0x1cfcc9(0x141),_0x1cfcc9(0x12b));},async 'dryRun'(_0x1b42ba){const _0x57cd80=a240_0x248308,_0xd0924a=loadSqlProjectConfig(_0x1b42ba[_0x57cd80(0x11a)]),{sqlName:_0x3e83b4,dbId:_0x3c0d5e,dbName:_0x589944,mode:_0x1d0712}=await resolveSqlNewInputs(_0x1b42ba),_0x334a49=buildSqlRelativePath('<server-generated-sqlCode>',_0x3e83b4,_0x589944,_0x1d0712,_0x3c0d5e),_0x3e6e52=_0xd0924a['sqlRootDir']+'/'+_0x334a49;return{'method':_0x57cd80(0x13b),'url':_0x57cd80(0x134),'body':{'appCode':_0x1b42ba[_0x57cd80(0x11a)],'sqlName':_0x3e83b4,'dbId':_0x3c0d5e,'mode':_0x1d0712,'localPath':_0x3e6e52},'description':_0x57cd80(0x11e)+_0xd0924a[_0x57cd80(0x13e)]};},async 'execute'(_0x552211){const _0x3561fd=a240_0x248308,_0x2ad92a=loadSqlProjectConfig(_0x552211[_0x3561fd(0x11a)]),{sqlName:_0x59b6ec,dbId:_0xbdba6b,dbName:_0x55309b,mode:_0x49e5b5}=await resolveSqlNewInputs(_0x552211),_0x457b40=generateSqlTemplate(_0x49e5b5),_0x31a14d=await createSqlQuery({'appCode':_0x552211['appCode'],'sqlName':_0x59b6ec,'dbId':_0xbdba6b,'sqlContent':_0x457b40}),_0x13c946=ensureRemoteSqlContent(_0x31a14d),_0x188916=_0x55309b||await getDbName(_0x552211[_0x3561fd(0x11a)],_0xbdba6b)[_0x3561fd(0x142)](()=>undefined),_0x491613=buildSqlRelativePath(_0x31a14d['sqlCode'],_0x31a14d['sqlName'],_0x188916,_0x49e5b5,_0xbdba6b),_0x1f265d=_0x2ad92a['sqlRootDir']+'/'+_0x491613,_0x4df839=buildLocalSqlFileContent({'sqlCode':_0x31a14d['sqlCode'],'sqlName':_0x31a14d[_0x3561fd(0x118)],'dbId':_0x31a14d[_0x3561fd(0x14a)]},_0x13c946,{'dbName':_0x188916,'mode':_0x49e5b5,'syncedAt':new Date()[_0x3561fd(0x124)](),'description':_0x31a14d[_0x3561fd(0x11c)]});if(await fileExists(_0x1f265d))throw CliErrors[_0x3561fd(0x137)](_0x3561fd(0x12e)+_0x1f265d);await ensureParentDirectory(_0x1f265d),await writeFile(_0x1f265d,_0x4df839,_0x3561fd(0x135));const _0x56980e=await readSqlLockFile(_0x2ad92a[_0x3561fd(0x149)]),{lockData:_0x53a4de,appLock:_0x53a09f}=ensureSqlLockScope(_0x56980e??createEmptySqlLock(),_0x2ad92a['appCode'],_0x2ad92a[_0x3561fd(0x12c)],_0x3561fd(0x128));return _0x53a09f[_0x3561fd(0x10e)][_0x31a14d[_0x3561fd(0x125)]]={...buildSqlLockEntry(_0x31a14d,_0x13c946,computeSqlContentHash(_0x4df839),{'dbName':_0x188916}),'path':_0x491613,'mode':_0x49e5b5},_0x53a09f[_0x3561fd(0x11f)]=new Date()[_0x3561fd(0x124)](),await writeSqlLockFile(_0x2ad92a[_0x3561fd(0x149)],_0x53a4de),{'ok':!![],'data':{'id':_0x31a14d['id'],'sqlCode':_0x31a14d[_0x3561fd(0x125)],'sqlName':_0x31a14d[_0x3561fd(0x118)],'dbId':_0x31a14d[_0x3561fd(0x14a)],'path':_0x1f265d,'mode':_0x49e5b5},'message':_0x3561fd(0x110)+_0x31a14d['sqlCode']};}};async function resolveSqlNewInputs(_0x5b2b39){const _0x280733=await resolveSqlNameInput(_0x5b2b39),{dbId:_0xfec08d,dbName:_0x3e9292}=await resolveDbSelection(_0x5b2b39),_0x39520f=await resolveSqlModeInput(_0x5b2b39);return{'sqlName':_0x280733,'dbId':_0xfec08d,'dbName':_0x3e9292,'mode':_0x39520f};}async function resolveSqlNameInput(_0x5632d8){const _0x290860=a240_0x248308,_0x3f1434=_0x5632d8[_0x290860(0x132)](_0x290860(0x109))[_0x290860(0x120)]();if(_0x3f1434)return _0x3f1434;if(_0x5632d8['nonInteractive'])throw CliErrors[_0x290860(0x144)](_0x290860(0x109),_0x290860(0x13c));return(await input({'message':_0x290860(0x126),'validate':_0x5b6aa4=>_0x5b6aa4['trim']()?!![]:_0x290860(0x13d)}))[_0x290860(0x120)]();}async function resolveDbSelection(_0x446575){const _0x55a21d=a240_0x248308,_0x148d78=resolveProvidedDbId(_0x446575);if(typeof _0x148d78===_0x55a21d(0x116)&&Number[_0x55a21d(0x115)](_0x148d78)&&_0x148d78>0x0)return{'dbId':_0x148d78,'dbName':await getDbName(_0x446575[_0x55a21d(0x11a)],_0x148d78)[_0x55a21d(0x142)](()=>undefined)};if(_0x446575['nonInteractive'])throw CliErrors[_0x55a21d(0x144)](_0x55a21d(0x10b),_0x55a21d(0x10d));const _0x46027d=await listDatabases(_0x446575['appCode'])['catch'](()=>[]);if(_0x46027d[_0x55a21d(0x10c)]===0x1)return{'dbId':_0x46027d[0x0]['dbId'],'dbName':_0x46027d[0x0][_0x55a21d(0x119)]};if(_0x46027d['length']>0x1){const _0x55ff8d=await select({'message':_0x55a21d(0x114),'choices':[..._0x46027d[_0x55a21d(0x12f)](_0x3ef65b=>({'name':_0x3ef65b['dbName']+'\x20('+_0x3ef65b['dbId']+')','value':serializeDbSelection(_0x3ef65b)})),{'name':_0x55a21d(0x139),'value':_0x55a21d(0x117)}]});if(_0x55ff8d!==_0x55a21d(0x117))return deserializeDbSelection(_0x55ff8d);}const _0x234948=await input({'message':_0x55a21d(0x138),'validate':_0x41705a=>{const _0xe16e79=_0x55a21d,_0x1cf445=_0x41705a[_0xe16e79(0x120)]();if(!_0x1cf445)return _0xe16e79(0x131);const _0x669518=Number(_0x1cf445);if(!Number['isInteger'](_0x669518)||_0x669518<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x234948[_0x55a21d(0x120)]())};}async function resolveSqlModeInput(_0x297e45){const _0x48d222=a240_0x248308,_0x556778=_0x297e45[_0x48d222(0x132)](_0x48d222(0x141))[_0x48d222(0x120)]();if(_0x556778===_0x48d222(0x133)||_0x556778===_0x48d222(0x11d))return _0x556778;if(_0x297e45[_0x48d222(0x12d)])throw CliErrors[_0x48d222(0x144)](_0x48d222(0x141),_0x48d222(0x12b));return await select({'message':_0x48d222(0x121),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x48d222(0x11d),'description':_0x48d222(0x123)}]});}function serializeDbSelection(_0x308d2a){const _0x96ef52=a240_0x248308;return JSON[_0x96ef52(0x13a)]({'dbId':_0x308d2a['dbId'],'dbName':_0x308d2a[_0x96ef52(0x119)]});}function deserializeDbSelection(_0x4b1a5e){const _0x32b7ec=a240_0x248308;try{const _0x16f227=JSON[_0x32b7ec(0x145)](_0x4b1a5e);if(typeof _0x16f227[_0x32b7ec(0x14a)]===_0x32b7ec(0x116)&&Number[_0x32b7ec(0x115)](_0x16f227['dbId']))return{'dbId':_0x16f227[_0x32b7ec(0x14a)],'dbName':_0x16f227[_0x32b7ec(0x119)]};}catch{}throw CliErrors[_0x32b7ec(0x137)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x4b1a5e);}function resolveProvidedDbId(_0x245d17){const _0x56c889=a240_0x248308,_0x24c608=_0x245d17[_0x56c889(0x10f)](_0x56c889(0x10b));if(typeof _0x24c608===_0x56c889(0x116)&&Number[_0x56c889(0x115)](_0x24c608))return _0x24c608;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a241_0x4b4f55=a241_0x346a;(function(_0x2a2ed1,_0x3af075){const _0x469daa=a241_0x346a,_0x1b764f=_0x2a2ed1();while(!![]){try{const _0x375243=-parseInt(_0x469daa(0xc5))/0x1+-parseInt(_0x469daa(0xda))/0x2+-parseInt(_0x469daa(0xcb))/0x3*(-parseInt(_0x469daa(0xd1))/0x4)+-parseInt(_0x469daa(0xca))/0x5*(parseInt(_0x469daa(0xd8))/0x6)+parseInt(_0x469daa(0xbf))/0x7+parseInt(_0x469daa(0xd9))/0x8*(parseInt(_0x469daa(0xd5))/0x9)+parseInt(_0x469daa(0xc7))/0xa;if(_0x375243===_0x3af075)break;else _0x1b764f['push'](_0x1b764f['shift']());}catch(_0x2ca169){_0x1b764f['push'](_0x1b764f['shift']());}}}(a241_0x32ec,0xb627f));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a241_0x346a(_0x5e4122,_0x5d05e9){_0x5e4122=_0x5e4122-0xb5;const _0x32eccd=a241_0x32ec();let _0x346a5e=_0x32eccd[_0x5e4122];return _0x346a5e;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a241_0x4b4f55(0xbe),'command':a241_0x4b4f55(0xc8),'description':a241_0x4b4f55(0xc3),'risk':a241_0x4b4f55(0xbd),'flags':[SQLCODE_FLAG],async 'validate'(_0x225dd9){const _0x2bac84=a241_0x4b4f55,_0x51fd60=loadSqlProjectConfig(_0x225dd9[_0x2bac84(0xd2)]),_0x20747f=await readSqlLockFile(_0x51fd60[_0x2bac84(0xd7)]);if(!_0x20747f)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x13909c){const _0xff2344=a241_0x4b4f55,_0x11fc7d=loadSqlProjectConfig(_0x13909c[_0xff2344(0xd2)]),_0x4931a7=await readSqlLockFile(_0x11fc7d[_0xff2344(0xd7)]);if(!_0x4931a7)throw CliErrors[_0xff2344(0xb8)](_0xff2344(0xb7));const {appLock:_0x3e932a}=ensureSqlLockScope(_0x4931a7,_0x13909c['appCode'],_0x11fc7d['sqlRoot'],_0xff2344(0xc8)),_0x37da64=_0x13909c[_0xff2344(0xcd)]('sqlcode'),_0x5253bb=_0x3e932a[_0xff2344(0xdc)][_0x37da64];if(!_0x5253bb)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x37da64+'\x22.');return{'method':_0xff2344(0xcf),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x37da64,'id':_0x5253bb['remoteId'],'localPath':resolveLocalSqlFilePath(_0x11fc7d,_0x37da64,_0x5253bb)},'description':_0xff2344(0xd0)+_0x37da64+_0xff2344(0xce)+_0x11fc7d[_0xff2344(0xc1)]};},async 'execute'(_0x582014){const _0x219fbc=a241_0x4b4f55,_0x58214d=loadSqlProjectConfig(_0x582014['appCode']),_0x3bae4c=await readSqlLockFile(_0x58214d[_0x219fbc(0xd7)]);if(!_0x3bae4c)throw CliErrors[_0x219fbc(0xb8)](_0x219fbc(0xb9));const {lockData:_0x5f5483,appLock:_0x32cb16}=ensureSqlLockScope(_0x3bae4c,_0x582014[_0x219fbc(0xd2)],_0x58214d[_0x219fbc(0xcc)],_0x219fbc(0xc8)),_0x2237e7=_0x582014[_0x219fbc(0xcd)](_0x219fbc(0xc2)),_0x10c1a3=_0x32cb16['sqls'][_0x2237e7];if(!_0x10c1a3)throw CliErrors[_0x219fbc(0xb8)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2237e7+'\x22.');await deleteSqlQuery({'id':_0x10c1a3[_0x219fbc(0xd4)],'sqlCode':_0x2237e7}),_0x32cb16[_0x219fbc(0xdc)]=Object[_0x219fbc(0xbb)](Object[_0x219fbc(0xc9)](_0x32cb16[_0x219fbc(0xdc)])[_0x219fbc(0xd6)](([_0x42f10d])=>_0x42f10d!==_0x2237e7)),_0x32cb16[_0x219fbc(0xc6)]=new Date()[_0x219fbc(0xb6)](),await writeSqlLockFile(_0x58214d[_0x219fbc(0xd7)],_0x5f5483);const _0x2a59c5=resolveLocalSqlFilePath(_0x58214d,_0x2237e7,_0x10c1a3);let _0xac94b3;await fileExists(_0x2a59c5)&&(_0xac94b3=await moveToTrash(_0x58214d[_0x219fbc(0xdb)],_0x58214d[_0x219fbc(0xc1)],_0x2a59c5),await cleanupEmptyDirectories(dirname(_0x2a59c5),_0x58214d[_0x219fbc(0xc4)]));const _0x2fbfae={'deleted':_0x2237e7,'remoteId':_0x10c1a3[_0x219fbc(0xd4)]};if(_0xac94b3)_0x2fbfae[_0x219fbc(0xd3)]=_0xac94b3;return{'ok':!![],'data':_0x2fbfae,'message':'Deleted\x20'+_0x2237e7+(_0xac94b3?_0x219fbc(0xba):'')};}};async function moveToTrash(_0x5e6992,_0x1547da,_0x2eacaa){const _0x1fd3b9=a241_0x4b4f55,_0x4141ab=new Date()[_0x1fd3b9(0xb6)]()[_0x1fd3b9(0xbc)](/[:.]/g,'-'),_0x566bef=relative(_0x5e6992,_0x2eacaa),_0x5a5e2b=join(_0x1547da,_0x4141ab,_0x566bef);return await mkdir(dirname(_0x5a5e2b),{'recursive':!![]}),await rename(_0x2eacaa,_0x5a5e2b),_0x5a5e2b;}function a241_0x32ec(){const _0x3e4cd5=['Would\x20delete\x20SQL\x20','4ZwEDos','appCode','trashedTo','remoteId','15849HNDkIc','filter','lockFilePath','2256WdhUVo','2344XhjIVl','2489974peKldi','projectRoot','sqls','startsWith','toISOString','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','validation','SQL\x20lock\x20file\x20not\x20found.','\x20(local\x20file\x20moved\x20to\x20trash)','fromEntries','replace','high-risk-write','sql','1840930IysQyA','length','trashDir','sqlcode','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','sqlRootDir','985881PVroRu','lastSync','24480090oQWIoY','delete','entries','18485dcmvIq','3420237lvLoCf','sqlRoot','str','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','POST'];a241_0x32ec=function(){return _0x3e4cd5;};return a241_0x32ec();}async function cleanupEmptyDirectories(_0x28f73e,_0x51940d){const _0x131107=a241_0x4b4f55;let _0x3e1021=resolve(_0x28f73e);const _0x488161=resolve(_0x51940d);while(_0x3e1021[_0x131107(0xb5)](''+_0x488161+sep)||_0x3e1021===_0x488161){if(_0x3e1021===_0x488161)return;try{const _0x4dbafc=await readdir(_0x3e1021);if(_0x4dbafc[_0x131107(0xc0)]>0x0)return;await rmdir(_0x3e1021);}catch{return;}_0x3e1021=dirname(_0x3e1021);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a242_0x28134f=a242_0x2200;(function(_0x5ed561,_0x416cab){const _0x3201f9=a242_0x2200,_0x1d117e=_0x5ed561();while(!![]){try{const _0x512c56=parseInt(_0x3201f9(0x192))/0x1*(parseInt(_0x3201f9(0x1a0))/0x2)+-parseInt(_0x3201f9(0x19b))/0x3*(-parseInt(_0x3201f9(0x1a3))/0x4)+-parseInt(_0x3201f9(0x193))/0x5+parseInt(_0x3201f9(0x198))/0x6+-parseInt(_0x3201f9(0x195))/0x7*(parseInt(_0x3201f9(0x1a2))/0x8)+-parseInt(_0x3201f9(0x197))/0x9*(parseInt(_0x3201f9(0x194))/0xa)+parseInt(_0x3201f9(0x19d))/0xb*(-parseInt(_0x3201f9(0x196))/0xc);if(_0x512c56===_0x416cab)break;else _0x1d117e['push'](_0x1d117e['shift']());}catch(_0x4df919){_0x1d117e['push'](_0x1d117e['shift']());}}}(a242_0x4062,0x483fb));import{getSqlQueryInfo}from'../../core/api-client.js';function a242_0x2200(_0x1c19d8,_0x17a587){_0x1c19d8=_0x1c19d8-0x191;const _0x40624f=a242_0x4062();let _0x2200ec=_0x40624f[_0x1c19d8];return _0x2200ec;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a242_0x4062(){const _0xb8a619=['688145msyqsB','10590mcsziC','56WYdtEY','144iVqfST','1278kUbsYF','2643144xJfEkf','Return\x20full\x20raw\x20SQL\x20query\x20object','read','1496913feKjyv','detail','48521JvfgQP','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','description','6ZTHRCl','sql','337584LTMEmq','4jxvDEE','sqlName','verbose','sqlcode','boolean','appCode','dbId','str','11653fxroeD'];a242_0x4062=function(){return _0xb8a619;};return a242_0x4062();}export const sqlDetail={'service':a242_0x28134f(0x1a1),'command':a242_0x28134f(0x19c),'description':a242_0x28134f(0x19e),'risk':a242_0x28134f(0x19a),'flags':[SQLCODE_FLAG,{'name':a242_0x28134f(0x1a5),'type':a242_0x28134f(0x1a7),'description':a242_0x28134f(0x199)}],async 'execute'(_0x4eec5d){const _0x44dced=a242_0x28134f,_0xda38fc=await getSqlQueryInfo(_0x4eec5d[_0x44dced(0x1a8)],_0x4eec5d[_0x44dced(0x191)](_0x44dced(0x1a6))),_0x1f7f8f=_0x4eec5d['bool'](_0x44dced(0x1a5));if(_0x1f7f8f)return{'ok':!![],'data':_0xda38fc};const _0x84cb79=_0xda38fc[_0x44dced(0x1a9)]?await getDbName(_0x4eec5d['appCode'],_0xda38fc['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0xda38fc['sqlCode'],'sqlName':_0xda38fc[_0x44dced(0x1a4)],'db':_0x84cb79?_0x84cb79+'\x20('+_0xda38fc[_0x44dced(0x1a9)]+')':_0xda38fc[_0x44dced(0x1a9)]??'','description':_0xda38fc[_0x44dced(0x19f)]??'','sqlContent':_0xda38fc['sqlContent']??''}};}};
|