@lovrabet/rabetbase-cli 2.5.11-beta.1 → 2.5.12-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/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.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/context.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/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.d.ts +1 -0
- 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.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.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.d.ts +2 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/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 +1 -1
- package/skills/rabetbase/references/rabetbase-kb.md +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a235_0x1f828e=a235_0x5389;(function(_0x248671,_0x4c890a){const _0xf10414=a235_0x5389,_0x25f5c2=_0x248671();while(!![]){try{const _0x3ea8fe=parseInt(_0xf10414(0x121))/0x1*(-parseInt(_0xf10414(0xe1))/0x2)+parseInt(_0xf10414(0xe0))/0x3*(parseInt(_0xf10414(0xeb))/0x4)+parseInt(_0xf10414(0xf6))/0x5+parseInt(_0xf10414(0xf0))/0x6*(parseInt(_0xf10414(0x107))/0x7)+-parseInt(_0xf10414(0xdb))/0x8*(parseInt(_0xf10414(0x119))/0x9)+-parseInt(_0xf10414(0x11c))/0xa*(-parseInt(_0xf10414(0xe2))/0xb)+-parseInt(_0xf10414(0xf7))/0xc;if(_0x3ea8fe===_0x4c890a)break;else _0x25f5c2['push'](_0x25f5c2['shift']());}catch(_0x5a2bc5){_0x25f5c2['push'](_0x25f5c2['shift']());}}}(a235_0x1673,0x5f37d));function a235_0x5389(_0x2b0605,_0x1ac3cb){_0x2b0605=_0x2b0605-0xda;const _0x167315=a235_0x1673();let _0x5389cf=_0x167315[_0x2b0605];return _0x5389cf;}import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a235_0x1f828e(0xf5),'required':!![],'description':a235_0x1f828e(0x105)};export const ROLE_REF_FLAG={'name':'role','type':a235_0x1f828e(0x10c),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a235_0x1f828e(0xfe),'type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};function a235_0x1673(){const _0x3a60d9=['expect-user-count','user-add','\x20not\x20found\x20in\x20app\x20','dev','map','Cannot\x20','No\x20tenant\x20member\x20matches\x20\x22','push','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','5802471IneMyg','username','nickname','408230EFDjCv','Role\x20id\x20','\x20member(s)\x20but\x20role\x20has\x20','appCode','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','15CCHPjj','\x22\x20not\x20found\x20in\x20app\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','userCount','flagMissing','POST','\x20members\x20of\x20the\x20OWNER\x20role.','Pass\x20--user\x20<id|name>.','Role\x20name','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','join','8ePQeZH','remark','Pass\x20--role\x20<id|name>.','length','totalCount','1023kwfAia','2144kGRBHR','88KyNiLO','flag','\x20built-in\x20role\x20','authRequired','tenant_code','Missing\x20user\x20reference.','roleType','test','\x20duplicate\x20memberships\x20for\x20user\x20','12xnLEpz','validation','tenant','permitCount','userId','6uwjjen','toLowerCase',';\x20no\x20change.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','\x22:\x20','number','1410770CDogHL','1021200PCfTFh','roleName','role','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Anti-drift\x20check\x20failed:\x20expected\x20','trim','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','user','includes','Role\x20name\x20\x22','Pass\x20--user\x20<id>.','Removed\x20','filter','User\x20','Role\x20id\x20(from\x20`role\x20list`)','str','3683057hGnmDQ','\x20is\x20already\x20a\x20member\x20of\x20role\x20','name','find','DEV','string','OWNER','/smartapi/permit/user-role/create','expectUserCount'];a235_0x1673=function(){return _0x3a60d9;};return a235_0x1673();}export const NAME_FLAG={'name':a235_0x1f828e(0x109),'type':a235_0x1f828e(0x10c),'required':!![],'description':a235_0x1f828e(0x129)};export const USER_NAME_FLAG={'name':a235_0x1f828e(0x109),'type':a235_0x1f828e(0x10c),'required':!![],'description':a235_0x1f828e(0x123)};export const REMARK_FLAG={'name':a235_0x1f828e(0xdc),'type':a235_0x1f828e(0x10c),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a235_0x1f828e(0x110),'type':a235_0x1f828e(0xf5),'required':![],'description':a235_0x1f828e(0x12a)};export const BUILTIN_ROLE_TYPES=['ADMIN',a235_0x1f828e(0x10b),a235_0x1f828e(0x10d)];export function isBuiltinRole(_0x537c25){return BUILTIN_ROLE_TYPES['includes'](_0x537c25);}export function assertCustomRole(_0x2063e8,_0x5cf8ef){const _0x4d1fb8=a235_0x1f828e;if(_0x2063e8['roleType']!=='CUSTOM')throw CliErrors[_0x4d1fb8(0xec)](_0x4d1fb8(0x115)+_0x5cf8ef+_0x4d1fb8(0xe4)+_0x2063e8[_0x4d1fb8(0xf8)]+'\x20('+_0x2063e8[_0x4d1fb8(0xe8)]+').',_0x4d1fb8(0x120));}export function projectRole(_0x287d2f){const _0x24838c=a235_0x1f828e;return{'id':_0x287d2f['id'],'roleName':_0x287d2f[_0x24838c(0xf8)],'roleType':_0x287d2f['roleType'],'remark':_0x287d2f[_0x24838c(0xdc)],'userCount':_0x287d2f[_0x24838c(0x124)],'permitCount':_0x287d2f[_0x24838c(0xee)],'builtin':isBuiltinRole(_0x287d2f[_0x24838c(0xe8)])};}export async function resolveRoleRef(_0x519f76,_0x515f3b){const _0x22c3f6=a235_0x1f828e,_0x4a932c=_0x515f3b['trim']();if(!_0x4a932c)throw CliErrors[_0x22c3f6(0xec)]('Missing\x20role\x20reference.',_0x22c3f6(0xdd));if(/^\d+$/[_0x22c3f6(0xe9)](_0x4a932c))return getRoleById(_0x519f76,Number(_0x4a932c));const _0x2974f8=await listAllAppRoles(_0x519f76),_0x297102=_0x2974f8[_0x22c3f6(0x103)](_0x5e0bb0=>_0x5e0bb0[_0x22c3f6(0xf8)]===_0x4a932c);if(_0x297102[_0x22c3f6(0xde)]===0x0)throw CliErrors[_0x22c3f6(0xec)](_0x22c3f6(0x100)+_0x4a932c+_0x22c3f6(0x122)+_0x519f76+'.',_0x22c3f6(0xfd));if(_0x297102[_0x22c3f6(0xde)]>0x1){const _0x28e6bb=_0x297102[_0x22c3f6(0x114)](_0x366612=>_0x366612['id'])[_0x22c3f6(0xda)](',\x20');throw CliErrors[_0x22c3f6(0xec)](_0x22c3f6(0x100)+_0x4a932c+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x28e6bb+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x297102[0x0];}export async function getRoleById(_0x53be9a,_0x30ccf1){const _0x26deb3=a235_0x1f828e,_0x427820=await listAllAppRoles(_0x53be9a),_0x2e775a=_0x427820[_0x26deb3(0x103)](_0xa490c4=>_0xa490c4['id']===_0x30ccf1&&(!_0xa490c4[_0x26deb3(0x11f)]||_0xa490c4['appCode']===_0x53be9a));if(_0x2e775a[_0x26deb3(0xde)]!==0x1)throw CliErrors[_0x26deb3(0xec)](_0x26deb3(0x11d)+_0x30ccf1+_0x26deb3(0x112)+_0x53be9a+'.',_0x26deb3(0x118));return _0x2e775a[0x0];}async function listAllAppRoles(_0x5507d0){const _0x21659f=a235_0x1f828e,_0x4b92e5=0x64,_0x2aa18c=[];for(let _0x5b4bbb=0x1;;_0x5b4bbb+=0x1){const {items:_0x34d9d8,paging:_0xd9078}=await listAppRoles(_0x5507d0,{'currentPage':_0x5b4bbb,'pageSize':_0x4b92e5});_0x2aa18c[_0x21659f(0x117)](..._0x34d9d8);if(_0x34d9d8['length']<_0x4b92e5||_0xd9078&&_0x2aa18c[_0x21659f(0xde)]>=_0xd9078['totalCount'])return _0x2aa18c;}}export async function resolveTenantCode(){const _0x142f1d=a235_0x1f828e,_0x12df2c=await getSessionUserInfo(),_0x5778ce=_0x12df2c?.[_0x142f1d(0xfe)]?.[_0x142f1d(0xed)]?.[_0x142f1d(0xe6)];if(!_0x5778ce)throw CliErrors[_0x142f1d(0xe5)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x5778ce;}function matchMember(_0x2e15b4,_0x43a7d4){const _0x3a4be8=a235_0x1f828e,_0x3b9532=_0x43a7d4[_0x3a4be8(0xfc)]()[_0x3a4be8(0xf1)]();return(_0x2e15b4[_0x3a4be8(0x11b)]??'')['toLowerCase']()===_0x3b9532||(_0x2e15b4['username']??'')[_0x3a4be8(0xf1)]()===_0x3b9532;}export async function resolveUserRef(_0xb05d9f,_0x546318=a235_0x1f828e(0x101)){const _0x5072de=a235_0x1f828e,_0x4d7b4d=_0xb05d9f[_0x5072de(0xfc)]();if(!_0x4d7b4d)throw CliErrors[_0x5072de(0xec)](_0x5072de(0xe7),_0x5072de(0x128));const _0x1514e9=await resolveTenantCode(),_0x438aea=await getTenantMembers(_0x1514e9);if(/^\d+$/[_0x5072de(0xe9)](_0x4d7b4d)){const _0x385ec9=Number(_0x4d7b4d),_0x21ffca=_0x438aea[_0x5072de(0x10a)](_0x1a26d0=>_0x1a26d0[_0x5072de(0xef)]===_0x385ec9);return{'userId':_0x385ec9,'username':_0x21ffca?.[_0x5072de(0x11a)]??String(_0x385ec9),'nickname':_0x21ffca?.[_0x5072de(0x11b)],'matchedBy':'id'};}const _0x2274f7=_0x438aea['filter'](_0x47b0ac=>matchMember(_0x47b0ac,_0x4d7b4d));if(_0x2274f7[_0x5072de(0xde)]===0x0)throw CliErrors[_0x5072de(0xec)](_0x5072de(0x116)+_0x4d7b4d+'\x22.','Check\x20the\x20nickname/username.\x20'+_0x546318);if(_0x2274f7['length']>0x1){const _0x5c02c5=_0x2274f7['map'](_0x57ab2e=>(_0x57ab2e[_0x5072de(0x11b)]??_0x57ab2e['username']??'?')+'('+_0x57ab2e[_0x5072de(0xef)]+')')[_0x5072de(0xda)](',\x20');throw CliErrors[_0x5072de(0xec)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x4d7b4d+_0x5072de(0xf4)+_0x5c02c5+'.',_0x546318);}const _0x1790f5=_0x2274f7[0x0];return{'userId':_0x1790f5[_0x5072de(0xef)],'username':_0x1790f5['username']??String(_0x1790f5[_0x5072de(0xef)]),'nickname':_0x1790f5[_0x5072de(0x11b)],'matchedBy':_0x5072de(0x109)};}export const CREATE_USER_ROLE_PATH=a235_0x1f828e(0x10e);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';export function computeRoleUserMutation(_0x15357c){const _0x346d91=a235_0x1f828e,{operation:_0x175f59,appCode:_0x3027cf,role:_0x372426,relations:_0x11512c,user:_0x154f3e}=_0x15357c,_0x36aa30=[...new Set(_0x11512c[_0x346d91(0x114)](_0x186435=>_0x186435[_0x346d91(0xef)]))],_0xe8b05f=[];if(_0x15357c[_0x346d91(0x10f)]!==undefined&&_0x15357c['expectUserCount']!==_0x36aa30[_0x346d91(0xde)])throw CliErrors[_0x346d91(0xec)](_0x346d91(0xfb)+_0x15357c[_0x346d91(0x10f)]+_0x346d91(0x11e)+_0x36aa30[_0x346d91(0xde)]+'.',_0x346d91(0xf3));const _0x5067d6=_0x36aa30[_0x346d91(0xff)](_0x154f3e[_0x346d91(0xef)]),_0x1b464d=_0x11512c[_0x346d91(0x103)](_0x2cef16=>_0x2cef16[_0x346d91(0xef)]===_0x154f3e['userId'])[_0x346d91(0x114)](_0x18f5e6=>_0x18f5e6['id']),_0x536811=_0x175f59===_0x346d91(0x111)?!_0x5067d6:_0x5067d6;let _0x48fed3=_0x36aa30;_0x175f59===_0x346d91(0x111)?_0x5067d6?_0xe8b05f['push'](_0x346d91(0x104)+_0x154f3e[_0x346d91(0xef)]+_0x346d91(0x108)+_0x372426[_0x346d91(0xf8)]+';\x20no\x20change.'):_0x48fed3=[..._0x36aa30,_0x154f3e['userId']]:!_0x5067d6?_0xe8b05f[_0x346d91(0x117)](_0x346d91(0x104)+_0x154f3e['userId']+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x372426[_0x346d91(0xf8)]+_0x346d91(0xf2)):(_0x48fed3=_0x36aa30[_0x346d91(0x103)](_0x143b22=>_0x143b22!==_0x154f3e[_0x346d91(0xef)]),_0x1b464d[_0x346d91(0xde)]>0x1&&_0xe8b05f['push'](_0x346d91(0x102)+_0x1b464d[_0x346d91(0xde)]+_0x346d91(0xea)+_0x154f3e[_0x346d91(0xef)]+'.'));const _0x34d665={'scope':_0x346d91(0x113),'operation':_0x175f59,'selector':{'appCode':_0x3027cf,'roleId':_0x372426['id'],'roleName':_0x372426[_0x346d91(0xf8)],'userId':_0x154f3e[_0x346d91(0xef)]},'before':{'userIds':_0x36aa30},'after':{'userIds':_0x48fed3},'dryRun':_0x15357c['dryRun'],'backend':{'method':_0x346d91(0x126),'path':_0x175f59===_0x346d91(0x111)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0xe8b05f};return{'mutation':_0x34d665,'changed':_0x536811,'matchingRelationIds':_0x1b464d};}export async function loadDevRoleRelations(_0x3dcb03,_0x542d17){const _0x3edf12=a235_0x1f828e,_0xdf43c=0x64,_0x29d6f5=[];for(let _0xee1322=0x1;;_0xee1322+=0x1){const {items:_0x13a8c0,paging:_0x1b4332}=await listDevUserRoleRelations(_0x3dcb03,{'roleId':_0x542d17,'currentPage':_0xee1322,'pageSize':_0xdf43c});_0x29d6f5[_0x3edf12(0x117)](..._0x13a8c0);if(_0x13a8c0[_0x3edf12(0xde)]<_0xdf43c||_0x1b4332&&_0x29d6f5[_0x3edf12(0xde)]>=_0x1b4332[_0x3edf12(0xdf)])return _0x29d6f5;}}export function readRoleRef(_0x405ea4){const _0x130e3b=a235_0x1f828e,_0x10caef=_0x405ea4[_0x130e3b(0x106)](_0x130e3b(0xf9))['trim']();if(!_0x10caef)throw CliErrors[_0x130e3b(0x125)](_0x130e3b(0xf9),_0x130e3b(0xdd));return _0x10caef;}export async function prepareUserMutation(_0x15e913,_0x4ddb0b,_0x3cd7dd){const _0x1466aa=a235_0x1f828e,_0x10917b=readRoleRef(_0x15e913),_0x5df929=_0x15e913[_0x1466aa(0x106)]('user')[_0x1466aa(0xfc)]();if(!_0x5df929)throw CliErrors['flagMissing'](_0x1466aa(0xfe),'Pass\x20--user\x20<id|name>.');const _0x271966=_0x15e913[_0x1466aa(0xe3)](_0x1466aa(0x110)),_0x45ab81=_0x271966===undefined||_0x271966===null?undefined:Number(_0x271966),_0x3290bf=await resolveRoleRef(_0x15e913[_0x1466aa(0x11f)],_0x10917b);if(_0x3290bf['roleType']===_0x1466aa(0x10d))throw CliErrors[_0x1466aa(0xec)](_0x1466aa(0x115)+_0x4ddb0b+_0x1466aa(0x127),_0x1466aa(0xfa));const _0x5a73a1=await resolveUserRef(_0x5df929),_0x1ab54a=await loadDevRoleRelations(_0x15e913[_0x1466aa(0x11f)],_0x3290bf['id']);return{...computeRoleUserMutation({'operation':_0x4ddb0b,'appCode':_0x15e913[_0x1466aa(0x11f)],'role':_0x3290bf,'relations':_0x1ab54a,'user':{'userId':_0x5a73a1['userId'],'username':_0x5a73a1[_0x1466aa(0x11a)],'nickname':_0x5a73a1[_0x1466aa(0x11b)]},'dryRun':_0x3cd7dd,..._0x45ab81!==undefined?{'expectUserCount':_0x45ab81}:{}}),'role':_0x3290bf,'user':_0x5a73a1};}
|
|
1
|
+
const a235_0x3d0f3d=a235_0x383c;(function(_0x3b20b8,_0x1c1b1b){const _0x51f90b=a235_0x383c,_0x2f981c=_0x3b20b8();while(!![]){try{const _0x54e051=-parseInt(_0x51f90b(0x192))/0x1*(-parseInt(_0x51f90b(0x1d4))/0x2)+-parseInt(_0x51f90b(0x1a4))/0x3+parseInt(_0x51f90b(0x1b1))/0x4+parseInt(_0x51f90b(0x1c9))/0x5+-parseInt(_0x51f90b(0x1a2))/0x6*(parseInt(_0x51f90b(0x1cf))/0x7)+parseInt(_0x51f90b(0x194))/0x8+-parseInt(_0x51f90b(0x1d0))/0x9;if(_0x54e051===_0x1c1b1b)break;else _0x2f981c['push'](_0x2f981c['shift']());}catch(_0x5045b8){_0x2f981c['push'](_0x2f981c['shift']());}}}(a235_0x55ce,0x85c62));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a235_0x3d0f3d(0x18f),'required':!![],'description':a235_0x3d0f3d(0x18b)};export const ROLE_REF_FLAG={'name':'role','type':a235_0x3d0f3d(0x196),'required':!![],'description':a235_0x3d0f3d(0x1cd)};export const USER_REF_FLAG={'name':a235_0x3d0f3d(0x19f),'type':a235_0x3d0f3d(0x196),'required':!![],'description':a235_0x3d0f3d(0x1ce)};export const NAME_FLAG={'name':a235_0x3d0f3d(0x1c7),'type':a235_0x3d0f3d(0x196),'required':!![],'description':a235_0x3d0f3d(0x19a)};export const USER_NAME_FLAG={'name':a235_0x3d0f3d(0x1c7),'type':'string','required':!![],'description':a235_0x3d0f3d(0x1b7)};export const REMARK_FLAG={'name':a235_0x3d0f3d(0x1cc),'type':a235_0x3d0f3d(0x196),'required':![],'description':a235_0x3d0f3d(0x1bf)};export const EXPECT_USER_COUNT_FLAG={'name':a235_0x3d0f3d(0x1b3),'type':a235_0x3d0f3d(0x18f),'required':![],'description':a235_0x3d0f3d(0x193)};export const BUILTIN_ROLE_TYPES=[a235_0x3d0f3d(0x1bd),a235_0x3d0f3d(0x1d3),a235_0x3d0f3d(0x19e)];export function isBuiltinRole(_0x24ee38){return BUILTIN_ROLE_TYPES['includes'](_0x24ee38);}export function assertCustomRole(_0x2ab541,_0x5bcb46){const _0x41d79b=a235_0x3d0f3d;if(_0x2ab541[_0x41d79b(0x1c0)]!==_0x41d79b(0x1a6))throw CliErrors[_0x41d79b(0x1ac)](_0x41d79b(0x19b)+_0x5bcb46+'\x20built-in\x20role\x20'+_0x2ab541['roleName']+'\x20('+_0x2ab541[_0x41d79b(0x1c0)]+').',_0x41d79b(0x1be));}export function projectRole(_0x1e4985){const _0xd49cb3=a235_0x3d0f3d;return{'id':_0x1e4985['id'],'roleName':_0x1e4985[_0xd49cb3(0x1ae)],'roleType':_0x1e4985[_0xd49cb3(0x1c0)],'remark':_0x1e4985['remark'],'userCount':_0x1e4985[_0xd49cb3(0x1af)],'permitCount':_0x1e4985[_0xd49cb3(0x1ad)],'builtin':isBuiltinRole(_0x1e4985[_0xd49cb3(0x1c0)])};}function a235_0x383c(_0xff0592,_0x41a0c2){_0xff0592=_0xff0592-0x18a;const _0x55ceaa=a235_0x55ce();let _0x383c15=_0x55ceaa[_0xff0592];return _0x383c15;}export async function resolveRoleRef(_0x52bcdc,_0x509594){const _0x53f0e2=a235_0x3d0f3d,_0x1c0c68=_0x509594[_0x53f0e2(0x1b2)]();if(!_0x1c0c68)throw CliErrors[_0x53f0e2(0x1ac)]('Missing\x20role\x20reference.',_0x53f0e2(0x199));if(/^\d+$/[_0x53f0e2(0x1ba)](_0x1c0c68))return getRoleById(_0x52bcdc,Number(_0x1c0c68));const _0x3612dd=await listAllAppRoles(_0x52bcdc),_0x2b3e40=_0x3612dd[_0x53f0e2(0x1a9)](_0x28dd26=>_0x28dd26[_0x53f0e2(0x1ae)]===_0x1c0c68);if(_0x2b3e40[_0x53f0e2(0x1c5)]===0x0)throw CliErrors[_0x53f0e2(0x1ac)](_0x53f0e2(0x1d2)+_0x1c0c68+'\x22\x20not\x20found\x20in\x20app\x20'+_0x52bcdc+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x2b3e40[_0x53f0e2(0x1c5)]>0x1){const _0x24e342=_0x2b3e40[_0x53f0e2(0x18d)](_0x1bd5f4=>_0x1bd5f4['id'])[_0x53f0e2(0x19d)](',\x20');throw CliErrors['validation'](_0x53f0e2(0x1d2)+_0x1c0c68+_0x53f0e2(0x1a5)+_0x24e342+').',_0x53f0e2(0x1a7));}return _0x2b3e40[0x0];}export async function getRoleById(_0x2dd099,_0x2aeafc){const _0x9bb621=a235_0x3d0f3d,_0x1627fa=await listAllAppRoles(_0x2dd099),_0x109b4f=_0x1627fa['filter'](_0x39e276=>_0x39e276['id']===_0x2aeafc&&(!_0x39e276['appCode']||_0x39e276[_0x9bb621(0x18a)]===_0x2dd099));if(_0x109b4f[_0x9bb621(0x1c5)]!==0x1)throw CliErrors[_0x9bb621(0x1ac)]('Role\x20id\x20'+_0x2aeafc+_0x9bb621(0x18e)+_0x2dd099+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x109b4f[0x0];}async function listAllAppRoles(_0x3f0b42){const _0x2c0ea6=a235_0x3d0f3d,_0x25cb48=0x64,_0xa4b535=[];for(let _0x4fa2a3=0x1;;_0x4fa2a3+=0x1){const {items:_0x1509bd,paging:_0x22d588}=await listAppRoles(_0x3f0b42,{'currentPage':_0x4fa2a3,'pageSize':_0x25cb48});_0xa4b535[_0x2c0ea6(0x1b4)](..._0x1509bd);if(_0x1509bd[_0x2c0ea6(0x1c5)]<_0x25cb48||_0x22d588&&_0xa4b535[_0x2c0ea6(0x1c5)]>=_0x22d588['totalCount'])return _0xa4b535;}}export async function resolveTenantCode(){const _0x48a861=a235_0x3d0f3d,_0x27258f=await getSessionUserInfo(),_0x3755c9=_0x27258f?.[_0x48a861(0x19f)]?.[_0x48a861(0x1b0)]?.[_0x48a861(0x1c3)];if(!_0x3755c9)throw CliErrors['authRequired']('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x3755c9;}function matchMember(_0x5a3326,_0x276758){const _0x5739c1=a235_0x3d0f3d,_0x18d0bf=_0x276758[_0x5739c1(0x1b2)]()['toLowerCase']();return(_0x5a3326[_0x5739c1(0x195)]??'')[_0x5739c1(0x1b8)]()===_0x18d0bf||(_0x5a3326['username']??'')[_0x5739c1(0x1b8)]()===_0x18d0bf;}export async function resolveUserRef(_0x4394d9,_0x1b5bcf=a235_0x3d0f3d(0x1c2)){const _0x44769c=a235_0x3d0f3d,_0x455ae2=_0x4394d9['trim']();if(!_0x455ae2)throw CliErrors[_0x44769c(0x1ac)]('Missing\x20user\x20reference.',_0x44769c(0x190));const _0x2518a3=await resolveTenantCode(),_0x519314=await getTenantMembers(_0x2518a3);if(/^\d+$/[_0x44769c(0x1ba)](_0x455ae2)){const _0x4d227e=Number(_0x455ae2),_0x2c933e=_0x519314['find'](_0x46b728=>_0x46b728[_0x44769c(0x1d1)]===_0x4d227e);return{'userId':_0x4d227e,'username':_0x2c933e?.[_0x44769c(0x1c1)]??String(_0x4d227e),'nickname':_0x2c933e?.[_0x44769c(0x195)],'matchedBy':'id'};}const _0x320e47=_0x519314[_0x44769c(0x1a9)](_0x89c467=>matchMember(_0x89c467,_0x455ae2));if(_0x320e47[_0x44769c(0x1c5)]===0x0)throw CliErrors[_0x44769c(0x1ac)](_0x44769c(0x1bc)+_0x455ae2+'\x22.',_0x44769c(0x1b9)+_0x1b5bcf);if(_0x320e47[_0x44769c(0x1c5)]>0x1){const _0xf1ae6c=_0x320e47[_0x44769c(0x18d)](_0x13b601=>(_0x13b601[_0x44769c(0x195)]??_0x13b601[_0x44769c(0x1c1)]??'?')+'('+_0x13b601[_0x44769c(0x1d1)]+')')['join'](',\x20');throw CliErrors[_0x44769c(0x1ac)](_0x44769c(0x18c)+_0x455ae2+'\x22:\x20'+_0xf1ae6c+'.',_0x1b5bcf);}const _0x48b97a=_0x320e47[0x0];return{'userId':_0x48b97a[_0x44769c(0x1d1)],'username':_0x48b97a[_0x44769c(0x1c1)]??String(_0x48b97a[_0x44769c(0x1d1)]),'nickname':_0x48b97a[_0x44769c(0x195)],'matchedBy':_0x44769c(0x1c7)};}export const CREATE_USER_ROLE_PATH=a235_0x3d0f3d(0x1b6);export const DELETE_USER_ROLE_PATH=a235_0x3d0f3d(0x1a1);export function computeRoleUserMutation(_0x3caf87){const _0x349bb0=a235_0x3d0f3d,{operation:_0x4d09b8,appCode:_0x3d964d,role:_0x40cd41,relations:_0x410d6d,user:_0x12f58d}=_0x3caf87,_0x403c6d=[...new Set(_0x410d6d[_0x349bb0(0x18d)](_0x2d7fb4=>_0x2d7fb4[_0x349bb0(0x1d1)]))],_0x4ae56e=[];if(_0x3caf87[_0x349bb0(0x19c)]!==undefined&&_0x3caf87[_0x349bb0(0x19c)]!==_0x403c6d[_0x349bb0(0x1c5)])throw CliErrors[_0x349bb0(0x1ac)](_0x349bb0(0x1a8)+_0x3caf87[_0x349bb0(0x19c)]+_0x349bb0(0x1b5)+_0x403c6d[_0x349bb0(0x1c5)]+'.',_0x349bb0(0x1bb));const _0x1670fd=_0x403c6d['includes'](_0x12f58d[_0x349bb0(0x1d1)]),_0x35e918=_0x410d6d[_0x349bb0(0x1a9)](_0x1e7494=>_0x1e7494[_0x349bb0(0x1d1)]===_0x12f58d['userId'])[_0x349bb0(0x18d)](_0xcc34b7=>_0xcc34b7['id']),_0x506151=_0x4d09b8==='user-add'?!_0x1670fd:_0x1670fd;let _0x53eea7=_0x403c6d;_0x4d09b8===_0x349bb0(0x1c8)?_0x1670fd?_0x4ae56e[_0x349bb0(0x1b4)](_0x349bb0(0x198)+_0x12f58d[_0x349bb0(0x1d1)]+'\x20is\x20already\x20a\x20member\x20of\x20role\x20'+_0x40cd41[_0x349bb0(0x1ae)]+_0x349bb0(0x1aa)):_0x53eea7=[..._0x403c6d,_0x12f58d[_0x349bb0(0x1d1)]]:!_0x1670fd?_0x4ae56e[_0x349bb0(0x1b4)](_0x349bb0(0x198)+_0x12f58d[_0x349bb0(0x1d1)]+_0x349bb0(0x1ca)+_0x40cd41[_0x349bb0(0x1ae)]+_0x349bb0(0x1aa)):(_0x53eea7=_0x403c6d[_0x349bb0(0x1a9)](_0x328f67=>_0x328f67!==_0x12f58d['userId']),_0x35e918[_0x349bb0(0x1c5)]>0x1&&_0x4ae56e[_0x349bb0(0x1b4)](_0x349bb0(0x1ab)+_0x35e918[_0x349bb0(0x1c5)]+_0x349bb0(0x191)+_0x12f58d['userId']+'.'));const _0x478cbc={'scope':'dev','operation':_0x4d09b8,'selector':{'appCode':_0x3d964d,'roleId':_0x40cd41['id'],'roleName':_0x40cd41['roleName'],'userId':_0x12f58d[_0x349bb0(0x1d1)]},'before':{'userIds':_0x403c6d},'after':{'userIds':_0x53eea7},'dryRun':_0x3caf87[_0x349bb0(0x1cb)],'backend':{'method':_0x349bb0(0x1a3),'path':_0x4d09b8==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x4ae56e};return{'mutation':_0x478cbc,'changed':_0x506151,'matchingRelationIds':_0x35e918};}export async function loadDevRoleRelations(_0x2df7c0,_0x4380b7){const _0x35031c=a235_0x3d0f3d,_0x131464=0x64,_0x51f893=[];for(let _0x263bbe=0x1;;_0x263bbe+=0x1){const {items:_0x4655bd,paging:_0x31c13f}=await listDevUserRoleRelations(_0x2df7c0,{'roleId':_0x4380b7,'currentPage':_0x263bbe,'pageSize':_0x131464});_0x51f893[_0x35031c(0x1b4)](..._0x4655bd);if(_0x4655bd['length']<_0x131464||_0x31c13f&&_0x51f893[_0x35031c(0x1c5)]>=_0x31c13f[_0x35031c(0x1a0)])return _0x51f893;}}export function readRoleRef(_0x7617bb){const _0x1f0689=a235_0x3d0f3d,_0x5e716d=_0x7617bb[_0x1f0689(0x197)]('role')['trim']();if(!_0x5e716d)throw CliErrors['flagMissing'](_0x1f0689(0x1c6),_0x1f0689(0x199));return _0x5e716d;}export async function prepareUserMutation(_0x2bf8d7,_0x152ad6,_0x2ba4ad){const _0x1ef078=a235_0x3d0f3d,_0x97bc=readRoleRef(_0x2bf8d7),_0x3078c3=_0x2bf8d7[_0x1ef078(0x197)](_0x1ef078(0x19f))[_0x1ef078(0x1b2)]();if(!_0x3078c3)throw CliErrors['flagMissing'](_0x1ef078(0x19f),_0x1ef078(0x190));const _0x4568bb=_0x2bf8d7[_0x1ef078(0x1c4)](_0x1ef078(0x1b3)),_0x3aa838=_0x4568bb===undefined||_0x4568bb===null?undefined:Number(_0x4568bb),_0x36d7cd=await resolveRoleRef(_0x2bf8d7[_0x1ef078(0x18a)],_0x97bc);if(_0x36d7cd['roleType']==='OWNER')throw CliErrors['validation'](_0x1ef078(0x19b)+_0x152ad6+'\x20members\x20of\x20the\x20OWNER\x20role.','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x223333=await resolveUserRef(_0x3078c3),_0x43e2c6=await loadDevRoleRelations(_0x2bf8d7[_0x1ef078(0x18a)],_0x36d7cd['id']);return{...computeRoleUserMutation({'operation':_0x152ad6,'appCode':_0x2bf8d7[_0x1ef078(0x18a)],'role':_0x36d7cd,'relations':_0x43e2c6,'user':{'userId':_0x223333[_0x1ef078(0x1d1)],'username':_0x223333[_0x1ef078(0x1c1)],'nickname':_0x223333[_0x1ef078(0x195)]},'dryRun':_0x2ba4ad,..._0x3aa838!==undefined?{'expectUserCount':_0x3aa838}:{}}),'role':_0x36d7cd,'user':_0x223333};}function a235_0x55ce(){const _0x3a4a31=['remark','Role\x20id\x20or\x20exact\x20role\x20name','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','2373560jivZaz','5311449YGsZEr','userId','Role\x20name\x20\x22','DEV','22GRcCpt','appCode','Role\x20id\x20(from\x20`role\x20list`)','Multiple\x20tenant\x20members\x20match\x20\x22','map','\x20not\x20found\x20in\x20app\x20','number','Pass\x20--user\x20<id|name>.','\x20duplicate\x20memberships\x20for\x20user\x20','32447bOSojn','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','3332088kWVNdd','nickname','string','str','User\x20','Pass\x20--role\x20<id|name>.','Role\x20name','Cannot\x20','expectUserCount','join','OWNER','user','totalCount','/smartapi/permit/user-role/delete','6LgZije','POST','1307400aysNLR','\x22\x20is\x20ambiguous\x20(ids:\x20','CUSTOM','Disambiguate\x20with\x20--role\x20<id>.','Anti-drift\x20check\x20failed:\x20expected\x20','filter',';\x20no\x20change.','Removed\x20','validation','permitCount','roleName','userCount','tenant','2592252qyjwnL','trim','expect-user-count','push','\x20member(s)\x20but\x20role\x20has\x20','/smartapi/permit/user-role/create','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','toLowerCase','Check\x20the\x20nickname/username.\x20','test','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','No\x20tenant\x20member\x20matches\x20\x22','ADMIN','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Optional\x20role\x20remark/description','roleType','username','Pass\x20--user\x20<id>.','tenant_code','flag','length','role','name','user-add','2457440EusKZh','\x20is\x20not\x20a\x20member\x20of\x20role\x20','dryRun'];a235_0x55ce=function(){return _0x3a4a31;};return a235_0x55ce();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a236_0x15a4b1=a236_0x3070;function a236_0x5d81(){const _0x3a64ab=['remark','name','Nothing\x20to\x20update.','4jQFZKu','731736UZWEgl','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','role','string','1367181NThkRt','711474FhvlgO','\x20(id=','Updated\x20role\x20','286PhmKRH','207790XyZCuS','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','479388fUKfBD','New\x20role\x20name','roleName','7QdLSOQ','dev','trim','/smartapi/permit/role/update','101525RUDxkJ','--name\x20cannot\x20be\x20empty.','validation','update','109609CdpLdW','2BAiqwv','write','appCode','POST'];a236_0x5d81=function(){return _0x3a64ab;};return a236_0x5d81();}(function(_0x35c0d3,_0x210026){const _0x27b202=a236_0x3070,_0x2a464a=_0x35c0d3();while(!![]){try{const _0x19f80c=-parseInt(_0x27b202(0x197))/0x1*(-parseInt(_0x27b202(0x198))/0x2)+parseInt(_0x27b202(0x18c))/0x3+parseInt(_0x27b202(0x19f))/0x4*(parseInt(_0x27b202(0x193))/0x5)+parseInt(_0x27b202(0x1a5))/0x6*(parseInt(_0x27b202(0x18f))/0x7)+parseInt(_0x27b202(0x1a0))/0x8+parseInt(_0x27b202(0x1a4))/0x9+parseInt(_0x27b202(0x18a))/0xa*(-parseInt(_0x27b202(0x189))/0xb);if(_0x19f80c===_0x210026)break;else _0x2a464a['push'](_0x2a464a['shift']());}catch(_0x17d796){_0x2a464a['push'](_0x2a464a['shift']());}}}(a236_0x5d81,0x1b333));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a236_0x3070(_0x460130,_0x495e66){_0x460130=_0x460130-0x188;const _0x5d81b5=a236_0x5d81();let _0x307011=_0x5d81b5[_0x460130];return _0x307011;}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a236_0x15a4b1(0x192);function readPatch(_0x5438e3){const _0x3d2d55=a236_0x15a4b1,_0x2bb8f0=_0x5438e3['flag'](_0x3d2d55(0x19d)),_0x515621=_0x5438e3['flag'](_0x3d2d55(0x19c)),_0x41a248={};if(_0x2bb8f0!==undefined&&_0x2bb8f0!==null){const _0x33d956=String(_0x2bb8f0)[_0x3d2d55(0x191)]();if(!_0x33d956)throw CliErrors[_0x3d2d55(0x195)](_0x3d2d55(0x194));if(_0x33d956['length']>0x40)throw CliErrors[_0x3d2d55(0x195)](_0x3d2d55(0x1a1));_0x41a248[_0x3d2d55(0x18e)]=_0x33d956;}_0x515621!==undefined&&_0x515621!==null&&(_0x41a248['remark']=String(_0x515621));if(_0x41a248['roleName']===undefined&&_0x41a248[_0x3d2d55(0x19c)]===undefined)throw CliErrors[_0x3d2d55(0x195)](_0x3d2d55(0x19e),_0x3d2d55(0x18b));return _0x41a248;}export const roleUpdate={'service':a236_0x15a4b1(0x1a2),'command':'update','description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','risk':a236_0x15a4b1(0x199),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a236_0x15a4b1(0x19d),'type':a236_0x15a4b1(0x1a3),'required':![],'description':a236_0x15a4b1(0x18d)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x28230a){readPatch(_0x28230a);},async 'dryRun'(_0x2b542b){const _0x5d8331=a236_0x15a4b1,_0x119ec3=_0x2b542b['num']('id'),_0x4d219c=readPatch(_0x2b542b),_0x20a97a=await getRoleById(_0x2b542b[_0x5d8331(0x19a)],_0x119ec3);return assertCustomRole(_0x20a97a,_0x5d8331(0x196)),asDryRunResult({'scope':'dev','operation':_0x5d8331(0x196),'selector':{'appCode':_0x2b542b[_0x5d8331(0x19a)],'roleId':_0x119ec3,'roleName':_0x20a97a[_0x5d8331(0x18e)]},'before':projectRole(_0x20a97a),'after':projectRole({..._0x20a97a,..._0x4d219c[_0x5d8331(0x18e)]!==undefined?{'roleName':_0x4d219c[_0x5d8331(0x18e)]}:{},..._0x4d219c[_0x5d8331(0x19c)]!==undefined?{'remark':_0x4d219c['remark']}:{}}),'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},{'method':_0x5d8331(0x19b),'url':UPDATE_PATH});},async 'execute'(_0x54de27){const _0x5f2981=a236_0x15a4b1,_0x8f1f99=_0x54de27['num']('id'),_0x21f59d=readPatch(_0x54de27),_0x4666a0=await getRoleById(_0x54de27[_0x5f2981(0x19a)],_0x8f1f99);assertCustomRole(_0x4666a0,_0x5f2981(0x196)),await updateAppRole({'id':_0x8f1f99,'appCode':_0x54de27[_0x5f2981(0x19a)],..._0x21f59d[_0x5f2981(0x18e)]!==undefined?{'roleName':_0x21f59d[_0x5f2981(0x18e)]}:{},..._0x21f59d['remark']!==undefined?{'remark':_0x21f59d[_0x5f2981(0x19c)]}:{}});const _0x2e05cd=await getRoleById(_0x54de27[_0x5f2981(0x19a)],_0x8f1f99);return{'ok':!![],'data':{'scope':_0x5f2981(0x190),'operation':_0x5f2981(0x196),'selector':{'appCode':_0x54de27[_0x5f2981(0x19a)],'roleId':_0x8f1f99,'roleName':_0x2e05cd[_0x5f2981(0x18e)]},'before':projectRole(_0x4666a0),'after':projectRole(_0x2e05cd),'dryRun':![],'backend':{'method':_0x5f2981(0x19b),'path':UPDATE_PATH},'warnings':[]},'message':_0x5f2981(0x188)+_0x2e05cd[_0x5f2981(0x18e)]+_0x5f2981(0x1a6)+_0x8f1f99+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a237_0x245061=a237_0x1a9e;function a237_0x1a9e(_0x529e16,_0x47f4f5){_0x529e16=_0x529e16-0x186;const _0x56c3bb=a237_0x56c3();let _0x1a9efb=_0x56c3bb[_0x529e16];return _0x1a9efb;}(function(_0x22d2a8,_0x3c56aa){const _0x17800b=a237_0x1a9e,_0x1aae09=_0x22d2a8();while(!![]){try{const _0x4a7540=parseInt(_0x17800b(0x199))/0x1+-parseInt(_0x17800b(0x18d))/0x2+-parseInt(_0x17800b(0x187))/0x3+-parseInt(_0x17800b(0x18e))/0x4+-parseInt(_0x17800b(0x190))/0x5+parseInt(_0x17800b(0x19a))/0x6+parseInt(_0x17800b(0x198))/0x7*(parseInt(_0x17800b(0x19b))/0x8);if(_0x4a7540===_0x3c56aa)break;else _0x1aae09['push'](_0x1aae09['shift']());}catch(_0x3c09c1){_0x1aae09['push'](_0x1aae09['shift']());}}}(a237_0x56c3,0xaab2f));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';function a237_0x56c3(){const _0x4568d4=['3988521VChNNZ','appCode','role','No\x20change:\x20user\x20','username','selector','1245738ONUpFE','60540pqAzBN','user-add','2349860QCGenx','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','\x20already\x20in\x20role\x20','high-risk-write','roleType','POST','Added\x20user\x20','userId','13736135eFORnt','324871jbXFwn','5096940kNFPtF','8dGTyrB','\x20to\x20role\x20'];a237_0x56c3=function(){return _0x4568d4;};return a237_0x56c3();}export const roleUserAdd={'service':a237_0x245061(0x189),'command':a237_0x245061(0x18f),'description':a237_0x245061(0x191),'risk':a237_0x245061(0x193),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0xb5dc69){const _0x406572=a237_0x245061,{mutation:_0x1e3183}=await prepareUserMutation(_0xb5dc69,_0x406572(0x18f),!![]);return asDryRunResult(_0x1e3183,{'method':_0x406572(0x195),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x23a54b){const _0x2c0528=a237_0x245061,{mutation:_0x1e5c57,changed:_0x1fc974,role:_0x37b5cd,user:_0x18cb80}=await prepareUserMutation(_0x23a54b,'user-add',![]);return _0x1fc974&&await createDevUserRole({'appCode':_0x23a54b[_0x2c0528(0x188)],'userId':_0x18cb80['userId'],'username':_0x18cb80[_0x2c0528(0x18b)],'roleType':_0x37b5cd[_0x2c0528(0x194)],'roleId':_0x1e5c57['selector']['roleId']}),{'ok':!![],'data':_0x1e5c57,'message':_0x1fc974?_0x2c0528(0x196)+_0x1e5c57[_0x2c0528(0x18c)][_0x2c0528(0x197)]+_0x2c0528(0x186)+_0x1e5c57[_0x2c0528(0x18c)]['roleName']:_0x2c0528(0x18a)+_0x1e5c57[_0x2c0528(0x18c)][_0x2c0528(0x197)]+_0x2c0528(0x192)+_0x1e5c57[_0x2c0528(0x18c)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a238_0x3a6132=a238_0x465b;(function(_0x1e81dc,_0x1299bf){const _0x45d13d=a238_0x465b,_0x3bc47e=_0x1e81dc();while(!![]){try{const _0x5dc5ef=parseInt(_0x45d13d(0x1b2))/0x1+parseInt(_0x45d13d(0x1ad))/0x2*(parseInt(_0x45d13d(0x1a7))/0x3)+-parseInt(_0x45d13d(0x1af))/0x4*(-parseInt(_0x45d13d(0x1b0))/0x5)+parseInt(_0x45d13d(0x1a6))/0x6*(parseInt(_0x45d13d(0x1a2))/0x7)+-parseInt(_0x45d13d(0x1a3))/0x8*(-parseInt(_0x45d13d(0x1a1))/0x9)+-parseInt(_0x45d13d(0x1a5))/0xa+-parseInt(_0x45d13d(0x1a8))/0xb*(parseInt(_0x45d13d(0x1b3))/0xc);if(_0x5dc5ef===_0x1299bf)break;else _0x3bc47e['push'](_0x3bc47e['shift']());}catch(_0x2ff041){_0x3bc47e['push'](_0x3bc47e['shift']());}}}(a238_0x25c5,0x789c7));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';function a238_0x465b(_0x271f13,_0x2ed175){_0x271f13=_0x271f13-0x1a0;const _0x25c5b8=a238_0x25c5();let _0x465b5c=_0x25c5b8[_0x271f13];return _0x465b5c;}function a238_0x25c5(){const _0x3ba2c1=['roleName','role','No\x20change:\x20user\x20','user-remove','2SkKsYU','selector','19996kewxZS','305nNezli','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','63993BVroJf','6726828kyWVXJ','Removed\x20user\x20','high-risk-write','userId','POST','8135091nXTSma','1698375OltkWQ','8osNDZb','\x20from\x20role\x20','6374220xqdydf','6RpCgRB','529674djmCzG','11vgQWRP'];a238_0x25c5=function(){return _0x3ba2c1;};return a238_0x25c5();}export const roleUserRemove={'service':a238_0x3a6132(0x1aa),'command':a238_0x3a6132(0x1ac),'description':a238_0x3a6132(0x1b1),'risk':a238_0x3a6132(0x1b5),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x375127){const _0x2df64f=a238_0x3a6132,{mutation:_0x3e34ba}=await prepareUserMutation(_0x375127,_0x2df64f(0x1ac),!![]);return asDryRunResult(_0x3e34ba,{'method':_0x2df64f(0x1a0),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x2ed230){const _0x5e5229=a238_0x3a6132,{matchingRelationIds:_0x4ee6ca,mutation:_0x119d40,changed:_0x33b2f0}=await prepareUserMutation(_0x2ed230,'user-remove',![]);if(_0x33b2f0)for(const _0x41bae0 of _0x4ee6ca){await deleteDevUserRole(_0x41bae0);}return{'ok':!![],'data':_0x119d40,'message':_0x33b2f0?_0x5e5229(0x1b4)+_0x119d40[_0x5e5229(0x1ae)][_0x5e5229(0x1b6)]+_0x5e5229(0x1a4)+_0x119d40[_0x5e5229(0x1ae)][_0x5e5229(0x1a9)]:_0x5e5229(0x1ab)+_0x119d40[_0x5e5229(0x1ae)][_0x5e5229(0x1b6)]+'\x20not\x20in\x20role\x20'+_0x119d40['selector'][_0x5e5229(0x1a9)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a239_0x77079d=a239_0x448b;function a239_0x4b4b(){const _0x40353a=['Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','name','read','user-resolve','nickname','268934WTJMKo','3429856aoquqt','matchedBy','5heHOkZ','trim','134210NywDsf','174256wwpBQT','1020162FUofNq','1777926mUjTCn','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','\x22\x20→\x20userId\x20','username','userId','role','1350370zrzGDz','Resolved\x20\x22','str','flagMissing'];a239_0x4b4b=function(){return _0x40353a;};return a239_0x4b4b();}(function(_0x1ea62a,_0x4fd808){const _0x30a350=a239_0x448b,_0x4db93f=_0x1ea62a();while(!![]){try{const _0x35182e=-parseInt(_0x30a350(0xd2))/0x1+-parseInt(_0x30a350(0xd7))/0x2+-parseInt(_0x30a350(0xd9))/0x3+-parseInt(_0x30a350(0xd8))/0x4+parseInt(_0x30a350(0xd5))/0x5*(parseInt(_0x30a350(0xda))/0x6)+parseInt(_0x30a350(0xc9))/0x7+parseInt(_0x30a350(0xd3))/0x8;if(_0x35182e===_0x4fd808)break;else _0x4db93f['push'](_0x4db93f['shift']());}catch(_0x4bc317){_0x4db93f['push'](_0x4db93f['shift']());}}}(a239_0x4b4b,0x306a2));import{CliErrors}from'../../errors.js';function a239_0x448b(_0xe8b971,_0x2697c6){_0xe8b971=_0xe8b971-0xc5;const _0x4b4bbf=a239_0x4b4b();let _0x448be9=_0x4b4bbf[_0xe8b971];return _0x448be9;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a239_0x77079d(0xc8),'command':a239_0x77079d(0xd0),'description':a239_0x77079d(0xcd),'risk':a239_0x77079d(0xcf),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1a0647){const _0x39ad73=a239_0x77079d;if(!_0x1a0647['str'](_0x39ad73(0xce))[_0x39ad73(0xd6)]())throw CliErrors[_0x39ad73(0xcc)](_0x39ad73(0xce),'Pass\x20--name\x20<nickname|username>.');},async 'execute'(_0x255d02){const _0x10d17f=a239_0x77079d,_0x1536f6=_0x255d02[_0x10d17f(0xcb)](_0x10d17f(0xce))['trim'](),_0x31bd66=await resolveUserRef(_0x1536f6,_0x10d17f(0xdb));return{'ok':!![],'data':{'user':{'userId':_0x31bd66['userId'],'username':_0x31bd66[_0x10d17f(0xc6)],'nickname':_0x31bd66[_0x10d17f(0xd1)],'matchedBy':_0x31bd66[_0x10d17f(0xd4)]}},'message':_0x10d17f(0xca)+_0x1536f6+_0x10d17f(0xc5)+_0x31bd66[_0x10d17f(0xc7)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a240_0x3ad6e4=a240_0x4377;function a240_0x4377(_0x51f5ae,_0x5accfc){_0x51f5ae=_0x51f5ae-0xa0;const _0x5b00d8=a240_0x5b00();let _0x437798=_0x5b00d8[_0x51f5ae];return _0x437798;}(function(_0x4a76c,_0x5b06c3){const _0x3bfab0=a240_0x4377,_0x2d7ce2=_0x4a76c();while(!![]){try{const _0x1f4e2b=parseInt(_0x3bfab0(0xae))/0x1+parseInt(_0x3bfab0(0xa4))/0x2*(parseInt(_0x3bfab0(0xa0))/0x3)+parseInt(_0x3bfab0(0xb0))/0x4+parseInt(_0x3bfab0(0xad))/0x5*(parseInt(_0x3bfab0(0xa3))/0x6)+parseInt(_0x3bfab0(0xa7))/0x7+-parseInt(_0x3bfab0(0xa2))/0x8*(parseInt(_0x3bfab0(0xb1))/0x9)+-parseInt(_0x3bfab0(0xa5))/0xa*(parseInt(_0x3bfab0(0xaa))/0xb);if(_0x1f4e2b===_0x5b06c3)break;else _0x2d7ce2['push'](_0x2d7ce2['shift']());}catch(_0x59e141){_0x2d7ce2['push'](_0x2d7ce2['shift']());}}}(a240_0x5b00,0x9421d));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';function a240_0x5b00(){const _0x570438=['get','2467796gKtzlz','36DeLxDN','Loaded\x20','content','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','530421hMOJlu','\x20for\x20','2026120EBSYDX','5181558bHnkxH','10JIWXOr','737670XKCaLM','appCode','2207877ByQuxH','rule','read','165mhdvnH','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','\x20is\x20not\x20configured\x20for\x20app\x20','5xacYkk','46326EJUJwk'];a240_0x5b00=function(){return _0x570438;};return a240_0x5b00();}export const ruleGet={'service':a240_0x3ad6e4(0xa8),'command':a240_0x3ad6e4(0xaf),'description':a240_0x3ad6e4(0xb4),'risk':a240_0x3ad6e4(0xa9),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x4b8ef6){readAppRuleType(_0x4b8ef6);},async 'execute'(_0x348975){const _0x19a3bd=a240_0x3ad6e4,_0x5de9ff=readAppRuleType(_0x348975),_0x3624f8=await getAppRule(_0x348975['cookie'],{'appCode':_0x348975[_0x19a3bd(0xa6)],'type':_0x5de9ff});if(!_0x3624f8)throw appRuleError('app_rule_not_found',appRuleFileName(_0x5de9ff)+_0x19a3bd(0xac)+_0x348975['appCode']+'.',_0x19a3bd(0xab)+_0x5de9ff+'\x20--file\x20<path>\x20--dry-run`.');return{'ok':!![],'data':{'rule':{...projectAppRule(_0x5de9ff,_0x3624f8),'content':_0x3624f8[_0x19a3bd(0xb3)]}},'message':_0x19a3bd(0xb2)+appRuleFileName(_0x5de9ff)+_0x19a3bd(0xa1)+_0x348975[_0x19a3bd(0xa6)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a241_0x474651=a241_0x4826;(function(_0x14daf3,_0x2eec85){const _0x8bb443=a241_0x4826,_0x3b9a45=_0x14daf3();while(!![]){try{const _0x467ac4=parseInt(_0x8bb443(0x1d9))/0x1*(parseInt(_0x8bb443(0x1d7))/0x2)+parseInt(_0x8bb443(0x1db))/0x3*(parseInt(_0x8bb443(0x1d0))/0x4)+-parseInt(_0x8bb443(0x1d2))/0x5*(parseInt(_0x8bb443(0x1de))/0x6)+-parseInt(_0x8bb443(0x1d8))/0x7*(parseInt(_0x8bb443(0x1d3))/0x8)+parseInt(_0x8bb443(0x1d6))/0x9+parseInt(_0x8bb443(0x1da))/0xa+parseInt(_0x8bb443(0x1dd))/0xb*(-parseInt(_0x8bb443(0x1dc))/0xc);if(_0x467ac4===_0x2eec85)break;else _0x3b9a45['push'](_0x3b9a45['shift']());}catch(_0x503084){_0x3b9a45['push'](_0x3b9a45['shift']());}}}(a241_0x1ae4,0x65be4));import{withKbManagementSession}from'../../core/kb-management-client.js';function a241_0x1ae4(){const _0x48a81=['3zoqTNQ','1500FLDgVQ','21659yvtAgv','34890qsKdZT','1349828wjwODA','dryRun','565DxfTrv','5003672lTAMCV','execute','signal','1385226xPzKYq','2YjtJlE','7kpENFd','826051mIBSXa','6279970jADGPw'];a241_0x1ae4=function(){return _0x48a81;};return a241_0x1ae4();}import{ruleGet}from'../../commands/rule/get.js';function a241_0x4826(_0x183fd1,_0x1123fa){_0x183fd1=_0x183fd1-0x1d0;const _0x1ae4cb=a241_0x1ae4();let _0x482670=_0x1ae4cb[_0x183fd1];return _0x482670;}import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet]['map'](_0x54eb89=>({..._0x54eb89,'execute':_0x3b3004=>withKbManagementSession(_0x3b3004[a241_0x474651(0x1d5)],()=>_0x54eb89[a241_0x474651(0x1d4)](_0x3b3004)),..._0x54eb89['dryRun']?{'dryRun':_0x35c81d=>withKbManagementSession(_0x35c81d['signal'],()=>_0x54eb89[a241_0x474651(0x1d1)](_0x35c81d))}:{}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a242_0x4220a9=a242_0x17d5;(function(_0x44b181,_0x154ce5){const _0x2e6ae5=a242_0x17d5,_0x96f237=_0x44b181();while(!![]){try{const _0x45327f=-parseInt(_0x2e6ae5(0xcd))/0x1+-parseInt(_0x2e6ae5(0xc2))/0x2*(parseInt(_0x2e6ae5(0xd4))/0x3)+parseInt(_0x2e6ae5(0xd2))/0x4*(parseInt(_0x2e6ae5(0xcb))/0x5)+-parseInt(_0x2e6ae5(0xca))/0x6+parseInt(_0x2e6ae5(0xc3))/0x7*(-parseInt(_0x2e6ae5(0xc6))/0x8)+parseInt(_0x2e6ae5(0xcc))/0x9*(-parseInt(_0x2e6ae5(0xd3))/0xa)+-parseInt(_0x2e6ae5(0xc4))/0xb*(-parseInt(_0x2e6ae5(0xd1))/0xc);if(_0x45327f===_0x154ce5)break;else _0x96f237['push'](_0x96f237['shift']());}catch(_0x14d39e){_0x96f237['push'](_0x96f237['shift']());}}}(a242_0x50ea,0xba426));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a242_0x50ea(){const _0x58bcc1=['5LjEOvY','153abAGNN','331307LcReVW','rule','map','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','40545888sXpPaf','1419344UikhyM','171830cdRrOI','246RKVbxg','appCode','24322Borzvu','7pOVmuv','11kbjwpp','length','9099400TanDYh','cookie','read','Loaded\x20app\x20rule\x20configuration\x20for\x20','1276182dzGukB'];a242_0x50ea=function(){return _0x58bcc1;};return a242_0x50ea();}function a242_0x17d5(_0x54b18e,_0x370b38){_0x54b18e=_0x54b18e-0xc1;const _0x50ea39=a242_0x50ea();let _0x17d54c=_0x50ea39[_0x54b18e];return _0x17d54c;}export const ruleList={'service':a242_0x4220a9(0xce),'command':'list','description':a242_0x4220a9(0xd0),'risk':a242_0x4220a9(0xc8),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x1b59e0){const _0x38bfcb=a242_0x4220a9,_0x2014ef=await Promise['all'](APP_RULE_TYPES['map'](_0x4d8608=>getAppRule(_0x1b59e0[_0x38bfcb(0xc7)],{'appCode':_0x1b59e0[_0x38bfcb(0xc1)],'type':_0x4d8608}))),_0x3077c1=APP_RULE_TYPES[_0x38bfcb(0xcf)]((_0x35f236,_0x3c3400)=>projectAppRule(_0x35f236,_0x2014ef[_0x3c3400]??null));return{'ok':!![],'data':{'total':_0x3077c1[_0x38bfcb(0xc5)],'rules':_0x3077c1},'message':_0x38bfcb(0xc9)+_0x1b59e0[_0x38bfcb(0xc1)]};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a243_0x43699c=a243_0x31d7;function a243_0x6c73(){const _0x2ab8ab=['UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','7814121oXulBG','--file\x20is\x20required.','rules','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','set','replacement','create','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','trim','write',';\x20current\x20version\x20is\x20','app_rule_version_mismatch','rabetbase\x20rule\x20get\x20--type\x20','cookie','input','file','number','DATABASE','appCode','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','isSafeInteger','app_rule_verification_unavailable','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','byteSize','app_rule_verification_failed','Pass\x20a\x20UTF-8\x20Markdown\x20file.','8403616RSFcgX','POST','type','app_rule_content_too_large','\x20--format\x20compress','flag','beforeRecord','expectedVersion','17152MaSirQ','planned','string','contentHash','Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.','app_rule_expected_version_invalid','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','9sAjvvn','13922460CVJUsN','version','cause','str','201910TCPxFT','content','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','update','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','Expected\x20','1dZfkhd','before','\x20could\x20not\x20be\x20verified.','\x20version\x20changed\x20before\x20write.','rule','\x20for\x20','Set\x20','761950lBmdtu','30lAUgwF','expected-version','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','RULES','11202768smJswi','Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set'];a243_0x6c73=function(){return _0x2ab8ab;};return a243_0x6c73();}(function(_0x5a0856,_0x3624e9){const _0x548c6f=a243_0x31d7,_0x4259f2=_0x5a0856();while(!![]){try{const _0x1716aa=-parseInt(_0x548c6f(0xd1))/0x1*(-parseInt(_0x548c6f(0xd8))/0x2)+-parseInt(_0x548c6f(0xc6))/0x3*(-parseInt(_0x548c6f(0xbf))/0x4)+parseInt(_0x548c6f(0xcb))/0x5*(-parseInt(_0x548c6f(0xd9))/0x6)+-parseInt(_0x548c6f(0xe0))/0x7+-parseInt(_0x548c6f(0xb7))/0x8+parseInt(_0x548c6f(0xdd))/0x9+parseInt(_0x548c6f(0xc7))/0xa;if(_0x1716aa===_0x3624e9)break;else _0x4259f2['push'](_0x4259f2['shift']());}catch(_0x4ce68d){_0x4259f2['push'](_0x4259f2['shift']());}}}(a243_0x6c73,0xa1a9c));import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function readSetInput(_0x451ea3){const _0x5c0450=a243_0x31d7,_0x1c0a38=readAppRuleType(_0x451ea3),_0xf3a79a=_0x451ea3[_0x5c0450(0xca)](_0x5c0450(0xac))[_0x5c0450(0xe8)]();if(!_0xf3a79a)throw appRuleError('app_rule_file_required',_0x5c0450(0xe1),_0x5c0450(0xb6));const _0x13bda0=_0x451ea3[_0x5c0450(0xbc)]('expected-version');let _0x2a48e1;if(_0x13bda0!==undefined){_0x2a48e1=Number(_0x13bda0);if(!Number[_0x5c0450(0xb1)](_0x2a48e1)||_0x2a48e1<0x0)throw appRuleError(_0x5c0450(0xc4),_0x5c0450(0xc5));}return{'type':_0x1c0a38,'file':_0xf3a79a,'expectedVersion':_0x2a48e1};}async function prepareSet(_0x13e443){const _0x2b3e5b=a243_0x31d7,_0x3ce70f=readSetInput(_0x13e443),_0x291a47=await readAppRuleFile(_0x3ce70f['file']);if(_0x3ce70f['type']===_0x2b3e5b(0xe2)&&_0x291a47[_0x2b3e5b(0xcc)]['length']>0x7d0)throw appRuleError(_0x2b3e5b(0xba),'RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.');const _0x4f5582=await getAppRule(_0x13e443[_0x2b3e5b(0xed)],{'appCode':_0x13e443[_0x2b3e5b(0xaf)],'type':_0x3ce70f[_0x2b3e5b(0xb9)]});if(_0x3ce70f[_0x2b3e5b(0xbe)]!==undefined&&(_0x4f5582?.['version']??0x0)!==_0x3ce70f[_0x2b3e5b(0xbe)])throw appRuleError(_0x2b3e5b(0xeb),appRuleFileName(_0x3ce70f[_0x2b3e5b(0xb9)])+_0x2b3e5b(0xd4),_0x2b3e5b(0xd0)+_0x3ce70f[_0x2b3e5b(0xbe)]+_0x2b3e5b(0xea)+(_0x4f5582?.[_0x2b3e5b(0xc8)]??'unconfigured')+_0x2b3e5b(0xdb));return{'input':_0x3ce70f,'replacement':_0x291a47,'beforeRecord':_0x4f5582,'before':projectAppRule(_0x3ce70f['type'],_0x4f5582),'planned':{'type':_0x3ce70f[_0x2b3e5b(0xb9)],'fileName':appRuleFileName(_0x3ce70f[_0x2b3e5b(0xb9)]),'contextScope':appRuleContextScope(_0x3ce70f[_0x2b3e5b(0xb9)]),'enabled':!![],'appCode':_0x13e443[_0x2b3e5b(0xaf)],'scope':_0x2b3e5b(0xe2),'contentByteSize':_0x291a47[_0x2b3e5b(0xb4)],'contentHash':_0x291a47[_0x2b3e5b(0xc2)]}};}function a243_0x31d7(_0x78a9e6,_0x54a6d0){_0x78a9e6=_0x78a9e6-0xab;const _0x6c734a=a243_0x6c73();let _0x31d7c9=_0x6c734a[_0x78a9e6];return _0x31d7c9;}function warningsFor(_0x3f2ecc){return[];}export const ruleSet={'service':a243_0x43699c(0xd5),'command':'set','description':a243_0x43699c(0xcf),'risk':a243_0x43699c(0xe9),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x43699c(0xac),'type':a243_0x43699c(0xc1),'required':!![],'description':a243_0x43699c(0xdf)},{'name':a243_0x43699c(0xda),'type':a243_0x43699c(0xad),'required':![],'description':a243_0x43699c(0xde)}],async 'validate'(_0x5dd5e7){readSetInput(_0x5dd5e7);},async 'dryRun'(_0x2b795c){const _0x49fee3=a243_0x43699c,_0x13899b=await prepareSet(_0x2b795c);return asDryRunResult({'operation':_0x49fee3(0xe4),'selector':{'appCode':_0x2b795c[_0x49fee3(0xaf)],'scope':'rules','type':_0x13899b[_0x49fee3(0xab)][_0x49fee3(0xb9)]},'before':_0x13899b[_0x49fee3(0xd2)],'after':_0x13899b[_0x49fee3(0xc0)],'dryRun':!![],'backend':{'method':_0x49fee3(0xb8),'path':knowledgeDocumentsPath(_0x49fee3(0xe2),_0x13899b[_0x49fee3(0xbd)]?'update':'create'),'body':{'appCode':_0x2b795c['appCode'],..._0x13899b[_0x49fee3(0xbd)]?{'id':_0x13899b[_0x49fee3(0xbd)]['id']}:{},'title':_0x13899b['input'][_0x49fee3(0xb9)]==='rules'?_0x49fee3(0xdc):_0x49fee3(0xae),'contentHash':_0x13899b['replacement'][_0x49fee3(0xc2)],'contentByteSize':_0x13899b[_0x49fee3(0xe5)][_0x49fee3(0xb4)],..._0x13899b['beforeRecord']?{'expectedVersion':_0x13899b[_0x49fee3(0xbd)][_0x49fee3(0xc8)]}:{}}},'warnings':warningsFor(_0x13899b['input'][_0x49fee3(0xbe)]),'verification':{'expectedVersion':_0x13899b[_0x49fee3(0xbd)]?.[_0x49fee3(0xc8)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x49fee3(0xec)+_0x13899b[_0x49fee3(0xab)][_0x49fee3(0xb9)]+_0x49fee3(0xbb)}},{'method':_0x49fee3(0xb8),'url':knowledgeDocumentsPath(_0x49fee3(0xe2),_0x13899b[_0x49fee3(0xbd)]?'update':_0x49fee3(0xe6))});},async 'execute'(_0x3c6283){const _0x483d03=a243_0x43699c,_0x189e00=await prepareSet(_0x3c6283),_0x57acc2=_0x189e00['beforeRecord']===null?0x1:_0x189e00[_0x483d03(0xbd)][_0x483d03(0xc8)]+(_0x189e00[_0x483d03(0xbd)][_0x483d03(0xcc)]===_0x189e00['replacement'][_0x483d03(0xcc)]?0x0:0x1);let _0x5c8dcb,_0x32ec7e=![];try{_0x5c8dcb=await saveAppRule(_0x3c6283[_0x483d03(0xed)],{'appCode':_0x3c6283[_0x483d03(0xaf)],'type':_0x189e00['input'][_0x483d03(0xb9)],'content':_0x189e00[_0x483d03(0xe5)][_0x483d03(0xcc)],'expectedVersion':_0x189e00['beforeRecord']?.[_0x483d03(0xc8)]??0x0,..._0x189e00[_0x483d03(0xbd)]?{'id':_0x189e00[_0x483d03(0xbd)]['id']}:{}});if(_0x5c8dcb['version']!==_0x57acc2||_0x5c8dcb[_0x483d03(0xcc)]!==_0x189e00['replacement'][_0x483d03(0xcc)]||_0x189e00[_0x483d03(0xbd)]!==null&&_0x5c8dcb['id']!==_0x189e00['beforeRecord']['id'])throw appRuleError(_0x483d03(0xb5),_0x483d03(0xcd),_0x483d03(0xc3));}catch(_0x307cf7){if(!isPlatformTransportFailure(_0x307cf7))throw _0x307cf7;_0x32ec7e=!![];}let _0x375204;try{_0x375204=await getAppRule(_0x3c6283[_0x483d03(0xed)],{'appCode':_0x3c6283[_0x483d03(0xaf)],'type':_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)]});}catch(_0xc54f8e){const _0x2e78d4=appRuleError(_0x32ec7e?'app_rule_set_outcome_unknown':_0x483d03(0xb2),'The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x189e00[_0x483d03(0xab)]['type'])+_0x483d03(0xd3),_0x483d03(0xe3));Object['defineProperty'](_0x2e78d4,_0x483d03(0xc9),{'value':_0xc54f8e,'enumerable':![]});throw _0x2e78d4;}const _0x577f63=_0x375204&&inspectAppRuleContent(_0x375204[_0x483d03(0xcc)])[_0x483d03(0xc2)]===_0x189e00[_0x483d03(0xe5)]['contentHash'],_0x8b7012=_0x375204&&_0x375204[_0x483d03(0xc8)]===_0x57acc2&&(!_0x5c8dcb||_0x375204['id']===_0x5c8dcb['id']&&_0x375204['version']===_0x5c8dcb[_0x483d03(0xc8)]);if(!_0x375204||!_0x577f63||!_0x8b7012||_0x189e00[_0x483d03(0xbd)]!==null&&_0x375204['id']!==_0x189e00[_0x483d03(0xbd)]['id'])throw appRuleError(_0x32ec7e?'app_rule_set_outcome_unknown':_0x483d03(0xb5),appRuleFileName(_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)])+'\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.',_0x483d03(0xe7)+_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)]+_0x483d03(0xb3));const _0x1010a6=warningsFor(_0x189e00[_0x483d03(0xab)][_0x483d03(0xbe)]);_0x32ec7e&&_0x1010a6['push'](_0x483d03(0xb0));const _0x2a3473=projectAppRule(_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)],_0x375204);return{'ok':!![],'data':{'operation':_0x483d03(0xe4),'selector':{'appCode':_0x3c6283[_0x483d03(0xaf)],'scope':'rules','type':_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)]},'before':_0x189e00[_0x483d03(0xd2)],'after':_0x2a3473,'dryRun':![],'backend':{'method':_0x483d03(0xb8),'path':knowledgeDocumentsPath('rules',_0x189e00['beforeRecord']?_0x483d03(0xce):_0x483d03(0xe6))},'warnings':_0x1010a6,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0x32ec7e,'expectedVersion':_0x189e00[_0x483d03(0xbd)]?.[_0x483d03(0xc8)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x483d03(0xec)+_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)]+_0x483d03(0xbb)}},'message':_0x483d03(0xd7)+appRuleFileName(_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)])+_0x483d03(0xd6)+_0x3c6283[_0x483d03(0xaf)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x1b33da=a244_0x4269;(function(_0x49d7c9,_0x545e81){const _0x4fdebe=a244_0x4269,_0x4955ed=_0x49d7c9();while(!![]){try{const _0x374809=-parseInt(_0x4fdebe(0xa1))/0x1+-parseInt(_0x4fdebe(0xb2))/0x2+-parseInt(_0x4fdebe(0xbf))/0x3*(parseInt(_0x4fdebe(0xad))/0x4)+parseInt(_0x4fdebe(0x92))/0x5*(parseInt(_0x4fdebe(0x8f))/0x6)+parseInt(_0x4fdebe(0xa4))/0x7+parseInt(_0x4fdebe(0xbe))/0x8+parseInt(_0x4fdebe(0xb4))/0x9*(-parseInt(_0x4fdebe(0xac))/0xa);if(_0x374809===_0x545e81)break;else _0x4955ed['push'](_0x4955ed['shift']());}catch(_0xb3ef45){_0x4955ed['push'](_0x4955ed['shift']());}}}(a244_0x27db,0xd4f67));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x1b33da(0x94),a244_0x1b33da(0x99)];export const MAX_APP_RULE_UNITS=0x5*0x400*0x400;export const MAX_APP_RULE_BYTES=MAX_APP_RULE_UNITS*0x4;const APP_RULE_FILES={'rules':'RULES.md','database':a244_0x1b33da(0xa8)},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x1b33da(0xb8),'database':a244_0x1b33da(0x98)};export function appRuleError(_0x13fd39,_0x421c21,_0x193bcc){return new CliError(_0x13fd39,0x1,_0x421c21,_0x193bcc);}export function readAppRuleType(_0x46ab44){const _0x3caabf=a244_0x1b33da,_0x1b0e6d=_0x46ab44[_0x3caabf(0xaa)](_0x3caabf(0x91))[_0x3caabf(0x90)]()[_0x3caabf(0xb7)]();if(_0x1b0e6d!=='rules'&&_0x1b0e6d!==_0x3caabf(0x99))throw appRuleError(_0x3caabf(0x96),_0x3caabf(0xb5));return _0x1b0e6d;}export function appRuleFileName(_0x520c1c){return APP_RULE_FILES[_0x520c1c];}export function appRuleContextScope(_0x95e0c8){return APP_RULE_CONTEXT_SCOPES[_0x95e0c8];}export function inspectAppRuleContent(_0x121295){const _0x427623=a244_0x1b33da,_0x1957d3=Buffer['from'](_0x121295,_0x427623(0xa3));return{'content':_0x121295,'byteSize':_0x1957d3['byteLength'],'contentHash':_0x427623(0x9c)+createHash(_0x427623(0x97))['update'](_0x1957d3)['digest'](_0x427623(0xa6))};}export async function readAppRuleFile(_0x4f6967){const _0x44110e=a244_0x1b33da,_0x598d6c=_0x4f6967[_0x44110e(0x90)]();if(!_0x598d6c)throw appRuleError(_0x44110e(0x9d),_0x44110e(0x9e),_0x44110e(0xaf));const _0x34a0c1=resolve(_0x598d6c);let _0x2457d3;try{_0x2457d3=await stat(_0x34a0c1);}catch(_0x1bea0b){throw appRuleError(_0x44110e(0xa2),'Cannot\x20access\x20app\x20rule\x20file:\x20'+_0x598d6c,_0x1bea0b instanceof Error?_0x1bea0b[_0x44110e(0x93)]:String(_0x1bea0b));}if(!_0x2457d3[_0x44110e(0xa5)]())throw appRuleError(_0x44110e(0xae),_0x44110e(0xc0)+_0x598d6c);if(_0x2457d3['size']>MAX_APP_RULE_BYTES)throw appRuleError(_0x44110e(0xb1),'App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.');let _0x1779c9;try{_0x1779c9=await readFile(_0x34a0c1);}catch(_0x84bb38){throw appRuleError(_0x44110e(0xa2),_0x44110e(0xba)+_0x598d6c,_0x84bb38 instanceof Error?_0x84bb38[_0x44110e(0x93)]:String(_0x84bb38));}if(_0x1779c9[_0x44110e(0x9b)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x44110e(0xb1),_0x44110e(0xa7));let _0x1a9182;try{_0x1a9182=new TextDecoder(_0x44110e(0xb9),{'fatal':!![],'ignoreBOM':!![]})['decode'](_0x1779c9);}catch{throw appRuleError(_0x44110e(0x9a),_0x44110e(0xb0)+_0x598d6c);}if(_0x1a9182[_0x44110e(0xb6)]>MAX_APP_RULE_UNITS)throw appRuleError(_0x44110e(0xb1),_0x44110e(0x9f));if(!_0x1a9182[_0x44110e(0x90)]())throw appRuleError(_0x44110e(0x9a),'App\x20rule\x20file\x20is\x20blank:\x20'+_0x598d6c);return inspectAppRuleContent(_0x1a9182);}function a244_0x27db(){const _0x508d09=['isFile','hex','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','DATABASE.md','updateTime','str','version','10otRZUR','224288yYkASU','app_rule_file_invalid','Pass\x20a\x20UTF-8\x20Markdown\x20file.','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_too_large','795932SwyKNl','contentHash','5713911aEkqji','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','length','toLowerCase','page-api-development','utf-8','Cannot\x20read\x20app\x20rule\x20file:\x20','content','createTime','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','4478760VdvboC','21yZCyaS','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','2759112ghTQTl','trim','type','10fchNxL','message','rules','scope','app_rule_type_invalid','sha256','database-analysis','database','app_rule_content_invalid','byteLength','sha256:','app_rule_file_required','--file\x20is\x20required.','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','indexStatus','759783denSAC','app_rule_file_unreadable','utf8','11045146NDrNTR'];a244_0x27db=function(){return _0x508d09;};return a244_0x27db();}function a244_0x4269(_0x7d494d,_0x2b24e){_0x7d494d=_0x7d494d-0x8f;const _0x27db67=a244_0x27db();let _0x42692e=_0x27db67[_0x7d494d];return _0x42692e;}export function projectAppRule(_0x598931,_0x440ff4){const _0x15c2ee=a244_0x1b33da;if(!_0x440ff4)return{'type':_0x598931,'fileName':appRuleFileName(_0x598931),'contextScope':appRuleContextScope(_0x598931),'enabled':![]};const _0x317562=inspectAppRuleContent(_0x440ff4[_0x15c2ee(0xbb)]);return{'type':_0x598931,'fileName':appRuleFileName(_0x598931),'contextScope':appRuleContextScope(_0x598931),'enabled':!![],'id':_0x440ff4['id'],'scope':_0x440ff4[_0x15c2ee(0x95)],'appCode':_0x440ff4['appCode'],'version':_0x440ff4[_0x15c2ee(0xab)],..._0x440ff4[_0x15c2ee(0xa0)]!==undefined?{'indexStatus':_0x440ff4['indexStatus']}:{},'contentByteSize':_0x317562['byteSize'],'contentHash':_0x317562[_0x15c2ee(0xb3)],..._0x440ff4[_0x15c2ee(0xbc)]!==undefined&&_0x440ff4['createTime']!==null?{'createTime':_0x440ff4['createTime']}:{},..._0x440ff4[_0x15c2ee(0xa9)]!==undefined&&_0x440ff4[_0x15c2ee(0xa9)]!==null?{'updateTime':_0x440ff4[_0x15c2ee(0xa9)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x1b33da(0x91),'type':'string','required':!![],'description':a244_0x1b33da(0xbd),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x3fcd4a=a245_0x11d8;(function(_0x8f8731,_0x5ebcab){const _0x5753d7=a245_0x11d8,_0x519252=_0x8f8731();while(!![]){try{const _0x29891e=parseInt(_0x5753d7(0x114))/0x1+parseInt(_0x5753d7(0x10a))/0x2+-parseInt(_0x5753d7(0x107))/0x3*(-parseInt(_0x5753d7(0x102))/0x4)+-parseInt(_0x5753d7(0x124))/0x5*(-parseInt(_0x5753d7(0x11d))/0x6)+parseInt(_0x5753d7(0x11b))/0x7+-parseInt(_0x5753d7(0xf9))/0x8*(-parseInt(_0x5753d7(0x11a))/0x9)+-parseInt(_0x5753d7(0x109))/0xa*(parseInt(_0x5753d7(0x119))/0xb);if(_0x29891e===_0x5ebcab)break;else _0x519252['push'](_0x519252['shift']());}catch(_0x17f95c){_0x519252['push'](_0x519252['shift']());}}}(a245_0x3055,0x4b856));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 a245_0x11d8(_0x5d1fbb,_0x30dd48){_0x5d1fbb=_0x5d1fbb-0xec;const _0x30553c=a245_0x3055();let _0x11d818=_0x30553c[_0x5d1fbb];return _0x11d818;}import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a245_0x3055(){const _0x1a875f=['utf-8','all','yarn.lock','\x22\x20not\x20found\x20in\x20package.json.','Run\x20a\x20package.json\x20script','package.json','pnpm-lock.yaml','No\x20package.json\x20found\x20in\x20current\x20directory.','73983rFxfgb','log','preview','keys','\x20run\x20','2277ShhuyS','3465828VOMdqr','1089291PvSNAF','No\x20scripts\x20defined\x20in\x20package.json.','3589506vKQVrw','.bin','\x20run\x20preview','needsUpgrade','Domain\x20routing\x20synchronized:\x20','parse','\x0a\x20\x20Available\x20scripts:\x0a','5SBAOFK','vite','yarn','\x20\x20\x20\x20','push','bun.lockb','--watch','run','error','script','bun.lock','watch','bun','start','node_modules','Enable\x20watch\x20mode\x20for\x20preview','slice','dev','npm','write','changed','inherit','join','8EDROtx','\x20run\x20build','length','bool','Script\x20\x22','cwd','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20run\x20start','(none)','52NuCmrM','pnpm','path','build','validation','34746VjzSFF','close','65270fXDgYb','593836ioFsGe','belowMinimum'];a245_0x3055=function(){return _0x1a875f;};return a245_0x3055();}const VERSION_CHECK_SCRIPTS=new Set([a245_0x3fcd4a(0xef),a245_0x3fcd4a(0xf3)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set(['start',a245_0x3fcd4a(0xf3),'build','preview']);export function syncProjectDomainRoutingBeforeScript(_0x2647b0,_0x9af01d){const _0x464ff0=a245_0x3fcd4a;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x9af01d))return null;const _0x42cc1f=findProjectRootDirectory(_0x2647b0);if(!resolveConfigPath(_0x42cc1f))return null;const _0x41504b=writeProjectDomainRoutingManifest(_0x42cc1f);return{'path':_0x41504b[_0x464ff0(0x104)],'changed':_0x41504b[_0x464ff0(0xf6)]};}function readPackageScripts(_0x26374d){const _0x5b9d13=a245_0x3fcd4a,_0x3e7fd3=resolve(_0x26374d,_0x5b9d13(0x111));if(!existsSync(_0x3e7fd3))return null;try{const _0x5aafb1=JSON[_0x5b9d13(0x122)](readFileSync(_0x3e7fd3,_0x5b9d13(0x10c)));return _0x5aafb1['scripts']??{};}catch{return null;}}function detectPackageManager(_0x5ceedb){const _0x404efe=a245_0x3fcd4a;if(existsSync(resolve(_0x5ceedb,_0x404efe(0x129)))||existsSync(resolve(_0x5ceedb,_0x404efe(0xec))))return _0x404efe(0xee);if(existsSync(resolve(_0x5ceedb,_0x404efe(0x112))))return _0x404efe(0x103);if(existsSync(resolve(_0x5ceedb,_0x404efe(0x10e))))return _0x404efe(0x126);return _0x404efe(0xf4);}async function versionCheck(_0x2438d3){const _0x31e4c9=a245_0x3fcd4a,_0x1d4582=await checkCliVersion();(_0x1d4582[_0x31e4c9(0x120)]||_0x1d4582[_0x31e4c9(0x10b)])&&(printCliUpgradeWarning(_0x1d4582),assertCliVersionSupported(_0x1d4582));const _0x2044ab=await checkSdkVersion(_0x2438d3);if(_0x2044ab[_0x31e4c9(0x120)])printSdkUpgradeWarning(_0x2044ab);}function spawnScript(_0x306d39,_0x199976,_0x37402c,_0x356da9){return new Promise((_0x417ff2,_0x173fab)=>{const _0x252ba9=a245_0x11d8,_0x4a7ba9=[_0x252ba9(0x12b),_0x199976,..._0x37402c],_0x114a54=spawn(_0x306d39,_0x4a7ba9,{'cwd':_0x356da9,'stdio':_0x252ba9(0xf7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x356da9,_0x252ba9(0xf0),_0x252ba9(0x11e))+delimiter+process.env.PATH}});_0x114a54['on']('close',_0x101c60=>{const _0x4e4452=_0x252ba9;if(_0x101c60===0x0||_0x101c60===null)_0x417ff2();else _0x173fab(new Error(_0x306d39+_0x4e4452(0x118)+_0x199976+'\x20exited\x20with\x20code\x20'+_0x101c60));}),_0x114a54['on'](_0x252ba9(0x12c),_0x173fab);});}function spawnViteBuildWatch(_0x5504fb){return new Promise((_0x59cd34,_0x2571cd)=>{const _0x42d4d1=a245_0x11d8,_0x4878ad=spawn('vite',[_0x42d4d1(0x105),_0x42d4d1(0x12a)],{'cwd':_0x5504fb,'stdio':_0x42d4d1(0xf7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5504fb,'node_modules',_0x42d4d1(0x11e))+delimiter+process.env.PATH}});_0x4878ad['on'](_0x42d4d1(0x108),_0x4a29f1=>{const _0x2cdbc2=_0x42d4d1;if(_0x4a29f1===0x0||_0x4a29f1===null)_0x59cd34();else _0x2571cd(new Error(_0x2cdbc2(0xff)+_0x4a29f1));}),_0x4878ad['on']('error',_0x2571cd);});}function spawnVitePreview(_0x27f01c){return new Promise((_0x11f1cd,_0x78de3b)=>{const _0x70debf=a245_0x11d8,_0xcecda=spawn(_0x70debf(0x125),[_0x70debf(0x116)],{'cwd':_0x27f01c,'stdio':_0x70debf(0xf7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x27f01c,_0x70debf(0xf0),_0x70debf(0x11e))+delimiter+process.env.PATH}});_0xcecda['on'](_0x70debf(0x108),_0x895855=>{if(_0x895855===0x0||_0x895855===null)_0x11f1cd();else _0x78de3b(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x895855));}),_0xcecda['on']('error',_0x78de3b);});}const runFlags=[{'name':a245_0x3fcd4a(0xed),'type':'boolean','description':a245_0x3fcd4a(0xf1),'default':![]}];export const runDefinition={'service':'run','command':'run','description':a245_0x3fcd4a(0x110),'risk':a245_0x3fcd4a(0xf5),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x3fcd4a(0x12d),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x1919ac=a245_0x3fcd4a,_0x54de1d=[];return _0x54de1d[_0x1919ac(0x128)]('\x20\x20EXAMPLES'),_0x54de1d['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1919ac(0x100)),_0x54de1d[_0x1919ac(0x128)](_0x1919ac(0x127)+CLI_BIN_NAME+_0x1919ac(0xfa)),_0x54de1d[_0x1919ac(0x128)](_0x1919ac(0x127)+CLI_BIN_NAME+_0x1919ac(0x11f)),_0x54de1d[_0x1919ac(0x128)](_0x1919ac(0x127)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x54de1d[_0x1919ac(0xf8)]('\x0a');},async 'execute'(_0x10ae5c){const _0x361bba=a245_0x3fcd4a,_0x96d4f9=process[_0x361bba(0xfe)](),_0x20ffdb=_0x10ae5c['args'][0x0],_0x22c94a=_0x10ae5c['args'][_0x361bba(0xf2)](0x1),_0x4674bf=readPackageScripts(_0x96d4f9);if(!_0x4674bf)throw CliErrors[_0x361bba(0x106)](_0x361bba(0x113));if(!_0x20ffdb){const _0x1082c4=Object['keys'](_0x4674bf);if(_0x1082c4[_0x361bba(0xfb)]===0x0)console[_0x361bba(0x115)](_0x361bba(0x11c));else{console[_0x361bba(0x115)](_0x361bba(0x123));for(const _0x4eba98 of _0x1082c4){console['log'](_0x361bba(0x127)+_0x4eba98);}console[_0x361bba(0x115)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x4674bf[_0x20ffdb])throw CliErrors[_0x361bba(0x106)](_0x361bba(0xfd)+_0x20ffdb+_0x361bba(0x10f),'Available:\x20'+(Object[_0x361bba(0x117)](_0x4674bf)['join'](',\x20')||_0x361bba(0x101)));const _0x5115e4=detectPackageManager(_0x96d4f9),_0x28a2a8=syncProjectDomainRoutingBeforeScript(_0x96d4f9,_0x20ffdb);_0x28a2a8?.[_0x361bba(0xf6)]&&console['error'](_0x361bba(0x121)+_0x28a2a8[_0x361bba(0x104)]);VERSION_CHECK_SCRIPTS['has'](_0x20ffdb)&&await versionCheck(_0x96d4f9);if(_0x20ffdb===_0x361bba(0x116)&&_0x10ae5c[_0x361bba(0xfc)]('watch'))return await Promise[_0x361bba(0x10d)]([spawnViteBuildWatch(_0x96d4f9),spawnVitePreview(_0x96d4f9)]),{'ok':!![]};return await spawnScript(_0x5115e4,_0x20ffdb,_0x22c94a,_0x96d4f9),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x4dce19=a246_0x26e1;function a246_0x3182(){const _0x4c16c3=['2629578unnExr','schema','6988612CysNki','1213401NHFClf','12iiqnHp','214792wVKsGz','10952736swgCrF','19871352KqJEsV','2564990uKKJwh','18MuanXl'];a246_0x3182=function(){return _0x4c16c3;};return a246_0x3182();}(function(_0x59a61d,_0x33daea){const _0x445734=a246_0x26e1,_0x426c14=_0x59a61d();while(!![]){try{const _0xd9872e=-parseInt(_0x445734(0x124))/0x1*(-parseInt(_0x445734(0x123))/0x2)+parseInt(_0x445734(0x129))/0x3+-parseInt(_0x445734(0x121))/0x4+-parseInt(_0x445734(0x127))/0x5*(-parseInt(_0x445734(0x128))/0x6)+-parseInt(_0x445734(0x122))/0x7+parseInt(_0x445734(0x125))/0x8+-parseInt(_0x445734(0x126))/0x9;if(_0xd9872e===_0x33daea)break;else _0x426c14['push'](_0x426c14['shift']());}catch(_0x36261b){_0x426c14['push'](_0x426c14['shift']());}}}(a246_0x3182,0xe6b2c));function a246_0x26e1(_0xdb872f,_0x32fc8d){_0xdb872f=_0xdb872f-0x121;const _0x318218=a246_0x3182();let _0x26e102=_0x318218[_0xdb872f];return _0x26e102;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x46afff){const _0x4b61fe=await buildSchemaPayload();return{'ok':!![],'data':_0x4b61fe};}export const schemaDefinition={'service':a246_0x4dce19(0x12a),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a247_0x2ee645=a247_0x51f5;(function(_0x3b3638,_0x1f9d7a){const _0xdb2c7e=a247_0x51f5,_0xadf74c=_0x3b3638();while(!![]){try{const _0x42ec41=parseInt(_0xdb2c7e(0x123))/0x1+parseInt(_0xdb2c7e(0x157))/0x2*(parseInt(_0xdb2c7e(0x14f))/0x3)+parseInt(_0xdb2c7e(0x14e))/0x4*(-parseInt(_0xdb2c7e(0x117))/0x5)+parseInt(_0xdb2c7e(0x129))/0x6*(parseInt(_0xdb2c7e(0x124))/0x7)+parseInt(_0xdb2c7e(0x13d))/0x8*(-parseInt(_0xdb2c7e(0x13e))/0x9)+-parseInt(_0xdb2c7e(0x12b))/0xa+-parseInt(_0xdb2c7e(0x15d))/0xb*(-parseInt(_0xdb2c7e(0x135))/0xc);if(_0x42ec41===_0x1f9d7a)break;else _0xadf74c['push'](_0xadf74c['shift']());}catch(_0x5c5245){_0xadf74c['push'](_0xadf74c['shift']());}}}(a247_0x5213,0xd5b0e));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a247_0x51f5(_0x5b0c99,_0xcc300b){_0x5b0c99=_0x5b0c99-0x117;const _0x5213ef=a247_0x5213();let _0x51f51c=_0x5213ef[_0x5b0c99];return _0x51f51c;}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a247_0x5213(){const _0x212a81=['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','db-id','create','new','toISOString','sqls','sqlRootDir','description','179418FrjtkX','11241587UWsLss','SELECT\x201\x20AS\x20id;','str','sqlCode','isInteger','6gqvRyW','Target\x20database\x20ID','15469440THOTOg','dbId','string','catch','sqlRoot','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','dbId\x20must\x20be\x20a\x20positive\x20integer','map','SQL\x20query\x20display\x20name','36fKPgBJ','join','Select\x20the\x20local\x20SQL\x20mode:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','length','lastSync','POST','parse','2328xPzdxs','5589LLAWxH','/smartapi/custom/saveUserCustomSql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name\x20cannot\x20be\x20empty','nonInteractive','lockFilePath','dbId\x20cannot\x20be\x20empty','number','__manual__','trim','write','Select\x20the\x20target\x20database:','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbName','sql','48tMDvJE','105MZmrEq','flagMissing','mybatisXml','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','\x20\x20SELECT\x201\x20AS\x20id','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','appCode','49190tTzgbY','validation','✎\x20Enter\x20dbId\x20manually','mode','MyBatis\x20XML\x20(mybatisXml)','name','3718649bNAsBX','440595yUKdXo','isFinite','sqlName','Invalid\x20database\x20selection\x20payload:\x20'];a247_0x5213=function(){return _0x212a81;};return a247_0x5213();}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(_0x2fa646){const _0x3b42e4=a247_0x51f5;if(_0x2fa646===_0x3b42e4(0x151))return[_0x3b42e4(0x11b),_0x3b42e4(0x154),'</select>',''][_0x3b42e4(0x136)]('\x0a');return[_0x3b42e4(0x125),'']['join']('\x0a');}export const sqlCreate={'service':a247_0x2ee645(0x14d),'command':a247_0x2ee645(0x11d),'description':a247_0x2ee645(0x130),'risk':a247_0x2ee645(0x148),'flags':[{'name':'name','type':a247_0x2ee645(0x12d),'description':a247_0x2ee645(0x134)},{'name':a247_0x2ee645(0x11c),'type':a247_0x2ee645(0x145),'description':a247_0x2ee645(0x12a)},{'name':a247_0x2ee645(0x15a),'type':a247_0x2ee645(0x12d),'enum':[a247_0x2ee645(0x14d),a247_0x2ee645(0x151)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x358a3e){const _0x380627=a247_0x2ee645;if(!_0x358a3e[_0x380627(0x142)])return;if(!_0x358a3e[_0x380627(0x126)](_0x380627(0x15c))[_0x380627(0x147)]())throw CliErrors['flagMissing'](_0x380627(0x15c),_0x380627(0x138));const _0x3d2928=resolveProvidedDbId(_0x358a3e);if(typeof _0x3d2928!==_0x380627(0x145)||!Number[_0x380627(0x118)](_0x3d2928)||_0x3d2928<=0x0)throw CliErrors[_0x380627(0x150)](_0x380627(0x11c),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x358a3e[_0x380627(0x126)](_0x380627(0x15a))['trim']())throw CliErrors[_0x380627(0x150)](_0x380627(0x15a),_0x380627(0x152));},async 'dryRun'(_0x206882){const _0x1a978e=a247_0x2ee645,_0x568aaa=loadSqlProjectConfig(_0x206882['appCode']),{sqlName:_0x13af2c,dbId:_0x3e8a15,dbName:_0x45a7c9,mode:_0x9b8441}=await resolveSqlNewInputs(_0x206882),_0x597127=buildSqlRelativePath('<server-generated-sqlCode>',_0x13af2c,_0x45a7c9,_0x9b8441,_0x3e8a15),_0x41c465=_0x568aaa['sqlRootDir']+'/'+_0x597127;return{'method':_0x1a978e(0x13b),'url':_0x1a978e(0x13f),'body':{'appCode':_0x206882[_0x1a978e(0x156)],'sqlName':_0x13af2c,'dbId':_0x3e8a15,'mode':_0x9b8441,'localPath':_0x41c465},'description':_0x1a978e(0x14b)+_0x568aaa[_0x1a978e(0x121)]};},async 'execute'(_0x20abb3){const _0x357500=a247_0x2ee645,_0x2ce8e5=loadSqlProjectConfig(_0x20abb3[_0x357500(0x156)]),{sqlName:_0x56fdcb,dbId:_0x258966,dbName:_0x417189,mode:_0x3d8932}=await resolveSqlNewInputs(_0x20abb3),_0x3b00aa=generateSqlTemplate(_0x3d8932),_0x6d2040=await createSqlQuery({'appCode':_0x20abb3[_0x357500(0x156)],'sqlName':_0x56fdcb,'dbId':_0x258966,'sqlContent':_0x3b00aa}),_0x320cf8=ensureRemoteSqlContent(_0x6d2040),_0x319eb2=_0x417189||await getDbName(_0x20abb3[_0x357500(0x156)],_0x258966)[_0x357500(0x12e)](()=>undefined),_0x2b8a43=buildSqlRelativePath(_0x6d2040[_0x357500(0x127)],_0x6d2040[_0x357500(0x119)],_0x319eb2,_0x3d8932,_0x258966),_0x798366=_0x2ce8e5['sqlRootDir']+'/'+_0x2b8a43,_0x266dbf=buildLocalSqlFileContent({'sqlCode':_0x6d2040[_0x357500(0x127)],'sqlName':_0x6d2040[_0x357500(0x119)],'dbId':_0x6d2040[_0x357500(0x12c)]},_0x320cf8,{'dbName':_0x319eb2,'mode':_0x3d8932,'syncedAt':new Date()[_0x357500(0x11f)](),'description':_0x6d2040[_0x357500(0x122)]});if(await fileExists(_0x798366))throw CliErrors[_0x357500(0x158)]('File\x20already\x20exists:\x20'+_0x798366);await ensureParentDirectory(_0x798366),await writeFile(_0x798366,_0x266dbf,'utf8');const _0x472cf3=await readSqlLockFile(_0x2ce8e5[_0x357500(0x143)]),{lockData:_0x25eb6d,appLock:_0x4aef70}=ensureSqlLockScope(_0x472cf3??createEmptySqlLock(),_0x2ce8e5['appCode'],_0x2ce8e5[_0x357500(0x12f)],_0x357500(0x11e));return _0x4aef70[_0x357500(0x120)][_0x6d2040[_0x357500(0x127)]]={...buildSqlLockEntry(_0x6d2040,_0x320cf8,computeSqlContentHash(_0x266dbf),{'dbName':_0x319eb2}),'path':_0x2b8a43,'mode':_0x3d8932},_0x4aef70[_0x357500(0x13a)]=new Date()[_0x357500(0x11f)](),await writeSqlLockFile(_0x2ce8e5[_0x357500(0x143)],_0x25eb6d),{'ok':!![],'data':{'id':_0x6d2040['id'],'sqlCode':_0x6d2040[_0x357500(0x127)],'sqlName':_0x6d2040[_0x357500(0x119)],'dbId':_0x6d2040[_0x357500(0x12c)],'path':_0x798366,'mode':_0x3d8932},'message':_0x357500(0x153)+_0x6d2040[_0x357500(0x127)]};}};async function resolveSqlNewInputs(_0x479911){const _0xcdbdf1=await resolveSqlNameInput(_0x479911),{dbId:_0xbcccc6,dbName:_0x2413fe}=await resolveDbSelection(_0x479911),_0x3d678d=await resolveSqlModeInput(_0x479911);return{'sqlName':_0xcdbdf1,'dbId':_0xbcccc6,'dbName':_0x2413fe,'mode':_0x3d678d};}async function resolveSqlNameInput(_0x31015e){const _0x2e03f3=a247_0x2ee645,_0x4f3308=_0x31015e[_0x2e03f3(0x126)](_0x2e03f3(0x15c))[_0x2e03f3(0x147)]();if(_0x4f3308)return _0x4f3308;if(_0x31015e[_0x2e03f3(0x142)])throw CliErrors[_0x2e03f3(0x150)](_0x2e03f3(0x15c),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x1c4bb1=>_0x1c4bb1[_0x2e03f3(0x147)]()?!![]:_0x2e03f3(0x141)}))[_0x2e03f3(0x147)]();}async function resolveDbSelection(_0x5be8d9){const _0x19e46e=a247_0x2ee645,_0x6230c4=resolveProvidedDbId(_0x5be8d9);if(typeof _0x6230c4===_0x19e46e(0x145)&&Number[_0x19e46e(0x118)](_0x6230c4)&&_0x6230c4>0x0)return{'dbId':_0x6230c4,'dbName':await getDbName(_0x5be8d9[_0x19e46e(0x156)],_0x6230c4)[_0x19e46e(0x12e)](()=>undefined)};if(_0x5be8d9[_0x19e46e(0x142)])throw CliErrors[_0x19e46e(0x150)](_0x19e46e(0x11c),_0x19e46e(0x140));const _0x12650c=await listDatabases(_0x5be8d9[_0x19e46e(0x156)])['catch'](()=>[]);if(_0x12650c[_0x19e46e(0x139)]===0x1)return{'dbId':_0x12650c[0x0][_0x19e46e(0x12c)],'dbName':_0x12650c[0x0]['dbName']};if(_0x12650c[_0x19e46e(0x139)]>0x1){const _0x3af36c=await select({'message':_0x19e46e(0x149),'choices':[..._0x12650c[_0x19e46e(0x133)](_0x1d2c52=>({'name':_0x1d2c52[_0x19e46e(0x14c)]+'\x20('+_0x1d2c52[_0x19e46e(0x12c)]+')','value':serializeDbSelection(_0x1d2c52)})),{'name':_0x19e46e(0x159),'value':_0x19e46e(0x146)}]});if(_0x3af36c!==_0x19e46e(0x146))return deserializeDbSelection(_0x3af36c);}const _0x3c53d=await input({'message':'Target\x20database\x20dbId:','validate':_0x126e1d=>{const _0x1937ac=_0x19e46e,_0x1282f7=_0x126e1d[_0x1937ac(0x147)]();if(!_0x1282f7)return _0x1937ac(0x144);const _0x421421=Number(_0x1282f7);if(!Number[_0x1937ac(0x128)](_0x421421)||_0x421421<=0x0)return _0x1937ac(0x132);return!![];}});return{'dbId':Number(_0x3c53d[_0x19e46e(0x147)]())};}async function resolveSqlModeInput(_0x11cc5b){const _0x5a6ed6=a247_0x2ee645,_0x573647=_0x11cc5b[_0x5a6ed6(0x126)](_0x5a6ed6(0x15a))[_0x5a6ed6(0x147)]();if(_0x573647===_0x5a6ed6(0x14d)||_0x573647===_0x5a6ed6(0x151))return _0x573647;if(_0x11cc5b[_0x5a6ed6(0x142)])throw CliErrors[_0x5a6ed6(0x150)](_0x5a6ed6(0x15a),_0x5a6ed6(0x152));return await select({'message':_0x5a6ed6(0x137),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x5a6ed6(0x14d),'description':_0x5a6ed6(0x155)},{'name':_0x5a6ed6(0x15b),'value':_0x5a6ed6(0x151),'description':_0x5a6ed6(0x14a)}]});}function serializeDbSelection(_0x53ae49){const _0x20b54c=a247_0x2ee645;return JSON[_0x20b54c(0x131)]({'dbId':_0x53ae49['dbId'],'dbName':_0x53ae49[_0x20b54c(0x14c)]});}function deserializeDbSelection(_0x1e734d){const _0x3b3636=a247_0x2ee645;try{const _0x25e50b=JSON[_0x3b3636(0x13c)](_0x1e734d);if(typeof _0x25e50b['dbId']===_0x3b3636(0x145)&&Number['isFinite'](_0x25e50b[_0x3b3636(0x12c)]))return{'dbId':_0x25e50b['dbId'],'dbName':_0x25e50b[_0x3b3636(0x14c)]};}catch{}throw CliErrors[_0x3b3636(0x158)](_0x3b3636(0x11a)+_0x1e734d);}function resolveProvidedDbId(_0x39d80e){const _0xb3cbf0=a247_0x2ee645,_0x230a02=_0x39d80e['flag'](_0xb3cbf0(0x11c));if(typeof _0x230a02===_0xb3cbf0(0x145)&&Number[_0xb3cbf0(0x118)](_0x230a02))return _0x230a02;return undefined;}
|
|
1
|
+
function a247_0xb3c8(){const _0x1696a3=['sqlRootDir','toISOString','name','new','join','length','Invalid\x20database\x20selection\x20payload:\x20','number','2169RPInJG','create','/smartapi/custom/saveUserCustomSql','flagMissing','2205SIwcpr','sqlName','stringify','validation','string','SELECT\x201\x20AS\x20id;','dbName','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','write','Select\x20the\x20local\x20SQL\x20mode:','map','trim','parse','7720AaQRrE','78168YxIRKO','185aoKnnl','sql','File\x20already\x20exists:\x20','✎\x20Enter\x20dbId\x20manually','mybatisXml','\x20\x20SELECT\x201\x20AS\x20id','9339pRZmGz','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','appCode','Target\x20database\x20ID','str','Target\x20database\x20dbId:','SQL\x20name:','23784mAUQhY','Select\x20the\x20target\x20database:','sqls','sqlCode','db-id','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sqlRoot','dbId\x20cannot\x20be\x20empty','44786HhLKPk','description','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','3277512oKDXPm','mode','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','lockFilePath','lastSync','Local\x20SQL\x20file\x20mode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','56gUklrK','SQL\x20query\x20display\x20name','catch','4780fchtkS','nonInteractive','isFinite','MyBatis\x20XML\x20(mybatisXml)','dbId','dbId\x20must\x20be\x20a\x20positive\x20integer','33169212ZvjmDF','isInteger','Plain\x20SQL\x20(sql)'];a247_0xb3c8=function(){return _0x1696a3;};return a247_0xb3c8();}const a247_0x299107=a247_0x4ab2;(function(_0x431cd6,_0x429dc4){const _0x5b9947=a247_0x4ab2,_0x457901=_0x431cd6();while(!![]){try{const _0x2706a1=-parseInt(_0x5b9947(0x133))/0x1*(-parseInt(_0x5b9947(0x129))/0x2)+parseInt(_0x5b9947(0x147))/0x3*(parseInt(_0x5b9947(0x136))/0x4)+-parseInt(_0x5b9947(0x15a))/0x5*(parseInt(_0x5b9947(0x159))/0x6)+parseInt(_0x5b9947(0x12c))/0x7+-parseInt(_0x5b9947(0x121))/0x8*(-parseInt(_0x5b9947(0x14b))/0x9)+-parseInt(_0x5b9947(0x158))/0xa*(-parseInt(_0x5b9947(0x160))/0xb)+-parseInt(_0x5b9947(0x13c))/0xc;if(_0x2706a1===_0x429dc4)break;else _0x457901['push'](_0x457901['shift']());}catch(_0x154c5a){_0x457901['push'](_0x457901['shift']());}}}(a247_0xb3c8,0xb0bad));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a247_0x4ab2(_0x13c755,_0xa90677){_0x13c755=_0x13c755-0x11f;const _0xb3c8ca=a247_0xb3c8();let _0x4ab22d=_0xb3c8ca[_0x13c755];return _0x4ab22d;}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(_0x3f22f4){const _0x5c95bf=a247_0x4ab2;if(_0x3f22f4===_0x5c95bf(0x15e))return[_0x5c95bf(0x132),_0x5c95bf(0x15f),'</select>',''][_0x5c95bf(0x143)]('\x0a');return[_0x5c95bf(0x150),''][_0x5c95bf(0x143)]('\x0a');}export const sqlCreate={'service':a247_0x299107(0x15b),'command':a247_0x299107(0x148),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a247_0x299107(0x153),'flags':[{'name':a247_0x299107(0x141),'type':a247_0x299107(0x14f),'description':a247_0x299107(0x134)},{'name':a247_0x299107(0x125),'type':a247_0x299107(0x146),'description':a247_0x299107(0x163)},{'name':a247_0x299107(0x12d),'type':a247_0x299107(0x14f),'enum':['sql',a247_0x299107(0x15e)],'description':a247_0x299107(0x131)}],async 'validate'(_0x3298cc){const _0x110bad=a247_0x299107;if(!_0x3298cc['nonInteractive'])return;if(!_0x3298cc['str']('name')[_0x110bad(0x156)]())throw CliErrors[_0x110bad(0x14a)]('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x3fc6f1=resolveProvidedDbId(_0x3298cc);if(typeof _0x3fc6f1!==_0x110bad(0x146)||!Number[_0x110bad(0x138)](_0x3fc6f1)||_0x3fc6f1<=0x0)throw CliErrors[_0x110bad(0x14a)](_0x110bad(0x125),_0x110bad(0x12b));if(!_0x3298cc[_0x110bad(0x164)](_0x110bad(0x12d))[_0x110bad(0x156)]())throw CliErrors[_0x110bad(0x14a)](_0x110bad(0x12d),_0x110bad(0x152));},async 'dryRun'(_0xcd0db0){const _0x223f48=a247_0x299107,_0x2fd42c=loadSqlProjectConfig(_0xcd0db0[_0x223f48(0x162)]),{sqlName:_0x478b81,dbId:_0x37bd90,dbName:_0x246128,mode:_0x50024f}=await resolveSqlNewInputs(_0xcd0db0),_0x47617d=buildSqlRelativePath('<server-generated-sqlCode>',_0x478b81,_0x246128,_0x50024f,_0x37bd90),_0x4394ab=_0x2fd42c[_0x223f48(0x13f)]+'/'+_0x47617d;return{'method':'POST','url':_0x223f48(0x149),'body':{'appCode':_0xcd0db0['appCode'],'sqlName':_0x478b81,'dbId':_0x37bd90,'mode':_0x50024f,'localPath':_0x4394ab},'description':_0x223f48(0x126)+_0x2fd42c[_0x223f48(0x13f)]};},async 'execute'(_0x3ac898){const _0x5d655e=a247_0x299107,_0x5ebf09=loadSqlProjectConfig(_0x3ac898[_0x5d655e(0x162)]),{sqlName:_0x367db8,dbId:_0x3376cb,dbName:_0x1bbc56,mode:_0x582b36}=await resolveSqlNewInputs(_0x3ac898),_0x1724e9=generateSqlTemplate(_0x582b36),_0x288873=await createSqlQuery({'appCode':_0x3ac898[_0x5d655e(0x162)],'sqlName':_0x367db8,'dbId':_0x3376cb,'sqlContent':_0x1724e9}),_0x1f8431=ensureRemoteSqlContent(_0x288873),_0x37318e=_0x1bbc56||await getDbName(_0x3ac898[_0x5d655e(0x162)],_0x3376cb)[_0x5d655e(0x135)](()=>undefined),_0x1e528a=buildSqlRelativePath(_0x288873[_0x5d655e(0x124)],_0x288873['sqlName'],_0x37318e,_0x582b36,_0x3376cb),_0x39730c=_0x5ebf09['sqlRootDir']+'/'+_0x1e528a,_0x52078c=buildLocalSqlFileContent({'sqlCode':_0x288873[_0x5d655e(0x124)],'sqlName':_0x288873[_0x5d655e(0x14c)],'dbId':_0x288873[_0x5d655e(0x13a)]},_0x1f8431,{'dbName':_0x37318e,'mode':_0x582b36,'syncedAt':new Date()[_0x5d655e(0x140)](),'description':_0x288873[_0x5d655e(0x12a)]});if(await fileExists(_0x39730c))throw CliErrors['validation'](_0x5d655e(0x15c)+_0x39730c);await ensureParentDirectory(_0x39730c),await writeFile(_0x39730c,_0x52078c,'utf8');const _0x2584cd=await readSqlLockFile(_0x5ebf09[_0x5d655e(0x12f)]),{lockData:_0x574272,appLock:_0x2e99b8}=ensureSqlLockScope(_0x2584cd??createEmptySqlLock(),_0x5ebf09[_0x5d655e(0x162)],_0x5ebf09[_0x5d655e(0x127)],_0x5d655e(0x142));return _0x2e99b8[_0x5d655e(0x123)][_0x288873['sqlCode']]={...buildSqlLockEntry(_0x288873,_0x1f8431,computeSqlContentHash(_0x52078c),{'dbName':_0x37318e}),'path':_0x1e528a,'mode':_0x582b36},_0x2e99b8[_0x5d655e(0x130)]=new Date()[_0x5d655e(0x140)](),await writeSqlLockFile(_0x5ebf09[_0x5d655e(0x12f)],_0x574272),{'ok':!![],'data':{'id':_0x288873['id'],'sqlCode':_0x288873[_0x5d655e(0x124)],'sqlName':_0x288873[_0x5d655e(0x14c)],'dbId':_0x288873[_0x5d655e(0x13a)],'path':_0x39730c,'mode':_0x582b36},'message':'Created\x20SQL\x20query\x20'+_0x288873[_0x5d655e(0x124)]};}};async function resolveSqlNewInputs(_0x395d85){const _0x5d8946=await resolveSqlNameInput(_0x395d85),{dbId:_0x1f9832,dbName:_0x4f45c6}=await resolveDbSelection(_0x395d85),_0x306549=await resolveSqlModeInput(_0x395d85);return{'sqlName':_0x5d8946,'dbId':_0x1f9832,'dbName':_0x4f45c6,'mode':_0x306549};}async function resolveSqlNameInput(_0x122198){const _0x208fce=a247_0x299107,_0x2340b4=_0x122198[_0x208fce(0x164)]('name')[_0x208fce(0x156)]();if(_0x2340b4)return _0x2340b4;if(_0x122198[_0x208fce(0x137)])throw CliErrors['flagMissing'](_0x208fce(0x141),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x208fce(0x120),'validate':_0xe4198f=>_0xe4198f[_0x208fce(0x156)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x208fce(0x156)]();}async function resolveDbSelection(_0x370113){const _0x22e417=a247_0x299107,_0x17b49a=resolveProvidedDbId(_0x370113);if(typeof _0x17b49a===_0x22e417(0x146)&&Number['isFinite'](_0x17b49a)&&_0x17b49a>0x0)return{'dbId':_0x17b49a,'dbName':await getDbName(_0x370113[_0x22e417(0x162)],_0x17b49a)[_0x22e417(0x135)](()=>undefined)};if(_0x370113[_0x22e417(0x137)])throw CliErrors[_0x22e417(0x14a)](_0x22e417(0x125),_0x22e417(0x12b));const _0x50fe5d=await listDatabases(_0x370113['appCode'])[_0x22e417(0x135)](()=>[]);if(_0x50fe5d['length']===0x1)return{'dbId':_0x50fe5d[0x0]['dbId'],'dbName':_0x50fe5d[0x0][_0x22e417(0x151)]};if(_0x50fe5d[_0x22e417(0x144)]>0x1){const _0x2a84a3=await select({'message':_0x22e417(0x122),'choices':[..._0x50fe5d[_0x22e417(0x155)](_0x294ddb=>({'name':_0x294ddb[_0x22e417(0x151)]+'\x20('+_0x294ddb['dbId']+')','value':serializeDbSelection(_0x294ddb)})),{'name':_0x22e417(0x15d),'value':'__manual__'}]});if(_0x2a84a3!=='__manual__')return deserializeDbSelection(_0x2a84a3);}const _0x1249d2=await input({'message':_0x22e417(0x11f),'validate':_0x4969c9=>{const _0x4278ed=_0x22e417,_0x12dac8=_0x4969c9[_0x4278ed(0x156)]();if(!_0x12dac8)return _0x4278ed(0x128);const _0x3a280b=Number(_0x12dac8);if(!Number[_0x4278ed(0x13d)](_0x3a280b)||_0x3a280b<=0x0)return _0x4278ed(0x13b);return!![];}});return{'dbId':Number(_0x1249d2[_0x22e417(0x156)]())};}async function resolveSqlModeInput(_0x1f4d1b){const _0x554525=a247_0x299107,_0x2e3d2a=_0x1f4d1b['str'](_0x554525(0x12d))['trim']();if(_0x2e3d2a===_0x554525(0x15b)||_0x2e3d2a==='mybatisXml')return _0x2e3d2a;if(_0x1f4d1b[_0x554525(0x137)])throw CliErrors['flagMissing']('mode',_0x554525(0x152));return await select({'message':_0x554525(0x154),'choices':[{'name':_0x554525(0x13e),'value':_0x554525(0x15b),'description':_0x554525(0x12e)},{'name':_0x554525(0x139),'value':'mybatisXml','description':_0x554525(0x161)}]});}function serializeDbSelection(_0x560e8f){const _0x1d0175=a247_0x299107;return JSON[_0x1d0175(0x14d)]({'dbId':_0x560e8f['dbId'],'dbName':_0x560e8f['dbName']});}function deserializeDbSelection(_0x143d8c){const _0x56bb69=a247_0x299107;try{const _0x3f5549=JSON[_0x56bb69(0x157)](_0x143d8c);if(typeof _0x3f5549[_0x56bb69(0x13a)]==='number'&&Number[_0x56bb69(0x138)](_0x3f5549['dbId']))return{'dbId':_0x3f5549[_0x56bb69(0x13a)],'dbName':_0x3f5549[_0x56bb69(0x151)]};}catch{}throw CliErrors[_0x56bb69(0x14e)](_0x56bb69(0x145)+_0x143d8c);}function resolveProvidedDbId(_0x3fa3c9){const _0x284a13=a247_0x299107,_0x48ce34=_0x3fa3c9['flag'](_0x284a13(0x125));if(typeof _0x48ce34==='number'&&Number[_0x284a13(0x138)](_0x48ce34))return _0x48ce34;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x3df418=a248_0x3fce;(function(_0x523eaf,_0x550495){const _0x4b2d74=a248_0x3fce,_0x3e9769=_0x523eaf();while(!![]){try{const _0x4fa439=-parseInt(_0x4b2d74(0x7a))/0x1*(parseInt(_0x4b2d74(0x81))/0x2)+-parseInt(_0x4b2d74(0x8d))/0x3*(parseInt(_0x4b2d74(0x84))/0x4)+-parseInt(_0x4b2d74(0x86))/0x5+-parseInt(_0x4b2d74(0x99))/0x6*(-parseInt(_0x4b2d74(0x9c))/0x7)+parseInt(_0x4b2d74(0x98))/0x8*(-parseInt(_0x4b2d74(0x83))/0x9)+parseInt(_0x4b2d74(0x92))/0xa+parseInt(_0x4b2d74(0x8a))/0xb;if(_0x4fa439===_0x550495)break;else _0x3e9769['push'](_0x3e9769['shift']());}catch(_0x45bb27){_0x3e9769['push'](_0x3e9769['shift']());}}}(a248_0x49fd,0x7bc30));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a248_0x3fce(_0x24c694,_0xd3e26b){_0x24c694=_0x24c694-0x78;const _0x49fdea=a248_0x49fd();let _0x3fcef9=_0x49fdea[_0x24c694];return _0x3fcef9;}export const sqlDelete={'service':'sql','command':a248_0x3df418(0x8b),'description':a248_0x3df418(0x91),'risk':a248_0x3df418(0x79),'flags':[SQLCODE_FLAG],async 'validate'(_0x1c9cdc){const _0x1ad229=a248_0x3df418,_0x2fc260=loadSqlProjectConfig(_0x1c9cdc['appCode']),_0x20de76=await readSqlLockFile(_0x2fc260['lockFilePath']);if(!_0x20de76)throw CliErrors[_0x1ad229(0x7d)](_0x1ad229(0x8f));},async 'dryRun'(_0x4a477b){const _0xa3e3e6=a248_0x3df418,_0xac896f=loadSqlProjectConfig(_0x4a477b[_0xa3e3e6(0x9d)]),_0x3410d4=await readSqlLockFile(_0xac896f[_0xa3e3e6(0x93)]);if(!_0x3410d4)throw CliErrors[_0xa3e3e6(0x7d)](_0xa3e3e6(0x8f));const {appLock:_0x4a1ae5}=ensureSqlLockScope(_0x3410d4,_0x4a477b[_0xa3e3e6(0x9d)],_0xac896f[_0xa3e3e6(0x87)],_0xa3e3e6(0x8b)),_0x1b24fb=_0x4a477b[_0xa3e3e6(0x85)](_0xa3e3e6(0x97)),_0x2c560b=_0x4a1ae5[_0xa3e3e6(0x7e)][_0x1b24fb];if(!_0x2c560b)throw CliErrors[_0xa3e3e6(0x7d)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x1b24fb+'\x22.');return{'method':_0xa3e3e6(0x94),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x1b24fb,'id':_0x2c560b[_0xa3e3e6(0x7c)],'localPath':resolveLocalSqlFilePath(_0xac896f,_0x1b24fb,_0x2c560b)},'description':_0xa3e3e6(0x8e)+_0x1b24fb+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0xac896f[_0xa3e3e6(0x95)]};},async 'execute'(_0x567f73){const _0x34cd94=a248_0x3df418,_0x22fe7c=loadSqlProjectConfig(_0x567f73['appCode']),_0xc9c94c=await readSqlLockFile(_0x22fe7c[_0x34cd94(0x93)]);if(!_0xc9c94c)throw CliErrors[_0x34cd94(0x7d)](_0x34cd94(0x8c));const {lockData:_0x544793,appLock:_0x123ca9}=ensureSqlLockScope(_0xc9c94c,_0x567f73[_0x34cd94(0x9d)],_0x22fe7c['sqlRoot'],'delete'),_0x3cc191=_0x567f73['str'](_0x34cd94(0x97)),_0xfc5a23=_0x123ca9['sqls'][_0x3cc191];if(!_0xfc5a23)throw CliErrors[_0x34cd94(0x7d)](_0x34cd94(0x96)+_0x3cc191+'\x22.');await deleteSqlQuery({'id':_0xfc5a23['remoteId'],'sqlCode':_0x3cc191}),_0x123ca9[_0x34cd94(0x7e)]=Object[_0x34cd94(0x7f)](Object['entries'](_0x123ca9['sqls'])[_0x34cd94(0x80)](([_0x1effc4])=>_0x1effc4!==_0x3cc191)),_0x123ca9[_0x34cd94(0x7b)]=new Date()['toISOString'](),await writeSqlLockFile(_0x22fe7c[_0x34cd94(0x93)],_0x544793);const _0x138b99=resolveLocalSqlFilePath(_0x22fe7c,_0x3cc191,_0xfc5a23);let _0x5416c3;await fileExists(_0x138b99)&&(_0x5416c3=await moveToTrash(_0x22fe7c[_0x34cd94(0x9b)],_0x22fe7c[_0x34cd94(0x95)],_0x138b99),await cleanupEmptyDirectories(dirname(_0x138b99),_0x22fe7c['sqlRootDir']));const _0x2391e1={'deleted':_0x3cc191,'remoteId':_0xfc5a23[_0x34cd94(0x7c)]};if(_0x5416c3)_0x2391e1[_0x34cd94(0x82)]=_0x5416c3;return{'ok':!![],'data':_0x2391e1,'message':_0x34cd94(0x90)+_0x3cc191+(_0x5416c3?_0x34cd94(0x78):'')};}};async function moveToTrash(_0x231faa,_0x578969,_0x237cfb){const _0x39ebe3=a248_0x3df418,_0x1bb164=new Date()[_0x39ebe3(0x9a)]()['replace'](/[:.]/g,'-'),_0x45c492=relative(_0x231faa,_0x237cfb),_0x591359=join(_0x578969,_0x1bb164,_0x45c492);return await mkdir(dirname(_0x591359),{'recursive':!![]}),await rename(_0x237cfb,_0x591359),_0x591359;}function a248_0x49fd(){const _0x1c447e=['lastSync','remoteId','validation','sqls','fromEntries','filter','1910752DOvVjC','trashedTo','9cpaEIO','4QDrCdw','str','3101915nGImLf','sqlRoot','startsWith','length','22605506dzoczx','delete','SQL\x20lock\x20file\x20not\x20found.','88401cZNOpA','Would\x20delete\x20SQL\x20','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','Deleted\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','5363810XxlKLS','lockFilePath','POST','trashDir','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlcode','4379448eVvSrv','636yoyYKF','toISOString','projectRoot','4501yJNVqS','appCode','\x20(local\x20file\x20moved\x20to\x20trash)','high-risk-write','1fyzWsA'];a248_0x49fd=function(){return _0x1c447e;};return a248_0x49fd();}async function cleanupEmptyDirectories(_0x16312e,_0x1078c5){const _0x17ee28=a248_0x3df418;let _0x479165=resolve(_0x16312e);const _0x3b2c19=resolve(_0x1078c5);while(_0x479165[_0x17ee28(0x88)](''+_0x3b2c19+sep)||_0x479165===_0x3b2c19){if(_0x479165===_0x3b2c19)return;try{const _0x2371fb=await readdir(_0x479165);if(_0x2371fb[_0x17ee28(0x89)]>0x0)return;await rmdir(_0x479165);}catch{return;}_0x479165=dirname(_0x479165);}}
|