@lovrabet/rabetbase-cli 2.5.10-beta.1 → 2.5.10-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- 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.d.ts +2 -2
- 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.d.ts +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.d.ts +3 -0
- package/lib/commands/issue/context.js +1 -0
- 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.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +0 -28
- 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.d.ts +8 -0
- package/lib/core/instant-api-policy/endpoints.js +1 -0
- package/lib/core/kb-management-client.d.ts +3 -9
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.d.ts +1 -4
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +3 -2
- package/skills/rabetbase/SKILL.md +2 -2
- package/skills/rabetbase/references/rabetbase-issue-report.md +4 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
- package/lib/commands/issue/shared.d.ts +0 -32
- package/lib/commands/issue/shared.js +0 -1
- package/lib/telemetry/send-platform-issue-collect-log.d.ts +0 -26
- package/lib/telemetry/send-platform-issue-collect-log.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a235_0x42bd67=a235_0x4864;(function(_0x237c02,_0x53a09f){const _0x1322e6=a235_0x4864,_0x25c73c=_0x237c02();while(!![]){try{const _0xd23871=parseInt(_0x1322e6(0xa1))/0x1*(-parseInt(_0x1322e6(0xb5))/0x2)+parseInt(_0x1322e6(0x93))/0x3+parseInt(_0x1322e6(0xb8))/0x4+-parseInt(_0x1322e6(0xd6))/0x5+parseInt(_0x1322e6(0x8b))/0x6+-parseInt(_0x1322e6(0x9e))/0x7+-parseInt(_0x1322e6(0xd1))/0x8*(-parseInt(_0x1322e6(0x8c))/0x9);if(_0xd23871===_0x53a09f)break;else _0x25c73c['push'](_0x25c73c['shift']());}catch(_0x1fb85f){_0x25c73c['push'](_0x25c73c['shift']());}}}(a235_0x103a,0x904a3));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_0x42bd67(0x90),'required':!![],'description':a235_0x42bd67(0xc8)};export const ROLE_REF_FLAG={'name':a235_0x42bd67(0xc9),'type':'string','required':!![],'description':a235_0x42bd67(0xce)};export const USER_REF_FLAG={'name':a235_0x42bd67(0x89),'type':a235_0x42bd67(0x91),'required':!![],'description':a235_0x42bd67(0xa8)};export const NAME_FLAG={'name':a235_0x42bd67(0x9d),'type':a235_0x42bd67(0x91),'required':!![],'description':'Role\x20name'};function a235_0x103a(){const _0xf54554=['user-add','552PugeIz','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','join','CUSTOM','Anti-drift\x20check\x20failed:\x20expected\x20','1793720uaNcMW','appCode','Missing\x20user\x20reference.','expectUserCount','flagMissing','user','tenant_code','1716834jYgKGC','154863PXJQUD','Pass\x20--user\x20<id|name>.','OWNER','Role\x20id\x20','number','string','Missing\x20role\x20reference.','280491vurPGA','test','Multiple\x20tenant\x20members\x20match\x20\x22','roleName','\x20is\x20not\x20a\x20member\x20of\x20role\x20','nickname','\x20member(s)\x20but\x20role\x20has\x20','toLowerCase','/smartapi/permit/user-role/create','permitCount','name','4074518BfaLuF','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','totalCount','93239cYqQyI','trim','userCount','Check\x20the\x20nickname/username.\x20','\x20built-in\x20role\x20','includes','\x22\x20is\x20ambiguous\x20(ids:\x20','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','ADMIN','map','\x22:\x20','User\x20','length','validation','No\x20tenant\x20member\x20matches\x20\x22','flag','expect-user-count','Role\x20name\x20\x22','userId','Pass\x20--role\x20<id|name>.','10WpTcNp','Pass\x20--user\x20<id>.','push','1724420jdXKSa','authRequired','Optional\x20role\x20remark/description','POST','Cannot\x20','tenant','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Disambiguate\x20with\x20--role\x20<id>.','remark','username',';\x20no\x20change.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','find','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','filter','\x20duplicate\x20memberships\x20for\x20user\x20','Role\x20id\x20(from\x20`role\x20list`)','role','\x20not\x20found\x20in\x20app\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','roleType','DEV','Role\x20id\x20or\x20exact\x20role\x20name','Removed\x20'];a235_0x103a=function(){return _0xf54554;};return a235_0x103a();}export const USER_NAME_FLAG={'name':a235_0x42bd67(0x9d),'type':a235_0x42bd67(0x91),'required':!![],'description':a235_0x42bd67(0xd2)};export const REMARK_FLAG={'name':a235_0x42bd67(0xc0),'type':'string','required':![],'description':a235_0x42bd67(0xba)};export const EXPECT_USER_COUNT_FLAG={'name':a235_0x42bd67(0xb1),'type':a235_0x42bd67(0x90),'required':![],'description':a235_0x42bd67(0xbe)};export const BUILTIN_ROLE_TYPES=[a235_0x42bd67(0xa9),a235_0x42bd67(0xcd),a235_0x42bd67(0x8e)];export function isBuiltinRole(_0x28b1cb){return BUILTIN_ROLE_TYPES['includes'](_0x28b1cb);}export function assertCustomRole(_0x1b1b01,_0x387efa){const _0x48b835=a235_0x42bd67;if(_0x1b1b01['roleType']!==_0x48b835(0xd4))throw CliErrors[_0x48b835(0xae)](_0x48b835(0xbc)+_0x387efa+_0x48b835(0xa5)+_0x1b1b01[_0x48b835(0x96)]+'\x20('+_0x1b1b01[_0x48b835(0xcc)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0xc535c9){const _0x40a547=a235_0x42bd67;return{'id':_0xc535c9['id'],'roleName':_0xc535c9[_0x40a547(0x96)],'roleType':_0xc535c9['roleType'],'remark':_0xc535c9[_0x40a547(0xc0)],'userCount':_0xc535c9[_0x40a547(0xa3)],'permitCount':_0xc535c9[_0x40a547(0x9c)],'builtin':isBuiltinRole(_0xc535c9[_0x40a547(0xcc)])};}export async function resolveRoleRef(_0x121349,_0xe27f86){const _0x2ae1f3=a235_0x42bd67,_0x8d91b7=_0xe27f86['trim']();if(!_0x8d91b7)throw CliErrors[_0x2ae1f3(0xae)](_0x2ae1f3(0x92),_0x2ae1f3(0xb4));if(/^\d+$/['test'](_0x8d91b7))return getRoleById(_0x121349,Number(_0x8d91b7));const _0x33810a=await listAllAppRoles(_0x121349),_0x417e4b=_0x33810a[_0x2ae1f3(0xc6)](_0x163c4f=>_0x163c4f[_0x2ae1f3(0x96)]===_0x8d91b7);if(_0x417e4b[_0x2ae1f3(0xad)]===0x0)throw CliErrors['validation'](_0x2ae1f3(0xb2)+_0x8d91b7+'\x22\x20not\x20found\x20in\x20app\x20'+_0x121349+'.',_0x2ae1f3(0xcb));if(_0x417e4b[_0x2ae1f3(0xad)]>0x1){const _0x59166c=_0x417e4b[_0x2ae1f3(0xaa)](_0xef81e2=>_0xef81e2['id'])[_0x2ae1f3(0xd3)](',\x20');throw CliErrors[_0x2ae1f3(0xae)](_0x2ae1f3(0xb2)+_0x8d91b7+_0x2ae1f3(0xa7)+_0x59166c+').',_0x2ae1f3(0xbf));}return _0x417e4b[0x0];}export async function getRoleById(_0x523218,_0x15b212){const _0x4add52=a235_0x42bd67,_0x3c8cd0=await listAllAppRoles(_0x523218),_0x23bc0d=_0x3c8cd0['filter'](_0x22bdc1=>_0x22bdc1['id']===_0x15b212&&(!_0x22bdc1[_0x4add52(0x85)]||_0x22bdc1[_0x4add52(0x85)]===_0x523218));if(_0x23bc0d[_0x4add52(0xad)]!==0x1)throw CliErrors[_0x4add52(0xae)](_0x4add52(0x8f)+_0x15b212+_0x4add52(0xca)+_0x523218+'.',_0x4add52(0xc3));return _0x23bc0d[0x0];}async function listAllAppRoles(_0xd3b1e6){const _0x2fb27f=a235_0x42bd67,_0x5c459f=0x64,_0x2a9a1c=[];for(let _0xfbd09c=0x1;;_0xfbd09c+=0x1){const {items:_0x19d964,paging:_0xed3432}=await listAppRoles(_0xd3b1e6,{'currentPage':_0xfbd09c,'pageSize':_0x5c459f});_0x2a9a1c[_0x2fb27f(0xb7)](..._0x19d964);if(_0x19d964[_0x2fb27f(0xad)]<_0x5c459f||_0xed3432&&_0x2a9a1c['length']>=_0xed3432[_0x2fb27f(0xa0)])return _0x2a9a1c;}}function a235_0x4864(_0x3a1f79,_0x3c14a1){_0x3a1f79=_0x3a1f79-0x85;const _0x103a43=a235_0x103a();let _0x4864d0=_0x103a43[_0x3a1f79];return _0x4864d0;}export async function resolveTenantCode(){const _0x384555=a235_0x42bd67,_0xa2f55=await getSessionUserInfo(),_0x50301f=_0xa2f55?.[_0x384555(0x89)]?.[_0x384555(0xbd)]?.[_0x384555(0x8a)];if(!_0x50301f)throw CliErrors[_0x384555(0xb9)](_0x384555(0xc5));return _0x50301f;}function matchMember(_0x4a95b3,_0x4368d1){const _0x5be8c1=a235_0x42bd67,_0x3da6f2=_0x4368d1[_0x5be8c1(0xa2)]()[_0x5be8c1(0x9a)]();return(_0x4a95b3[_0x5be8c1(0x98)]??'')[_0x5be8c1(0x9a)]()===_0x3da6f2||(_0x4a95b3[_0x5be8c1(0xc1)]??'')[_0x5be8c1(0x9a)]()===_0x3da6f2;}export async function resolveUserRef(_0x352d58,_0x5b57d2=a235_0x42bd67(0xb6)){const _0x4e26c1=a235_0x42bd67,_0x411576=_0x352d58['trim']();if(!_0x411576)throw CliErrors[_0x4e26c1(0xae)](_0x4e26c1(0x86),_0x4e26c1(0x8d));const _0x4569d1=await resolveTenantCode(),_0x55cdcf=await getTenantMembers(_0x4569d1);if(/^\d+$/[_0x4e26c1(0x94)](_0x411576)){const _0x4926e4=Number(_0x411576),_0x364a7c=_0x55cdcf[_0x4e26c1(0xc4)](_0xbae12a=>_0xbae12a[_0x4e26c1(0xb3)]===_0x4926e4);return{'userId':_0x4926e4,'username':_0x364a7c?.[_0x4e26c1(0xc1)]??String(_0x4926e4),'nickname':_0x364a7c?.['nickname'],'matchedBy':'id'};}const _0x58d967=_0x55cdcf[_0x4e26c1(0xc6)](_0x6bfbad=>matchMember(_0x6bfbad,_0x411576));if(_0x58d967['length']===0x0)throw CliErrors[_0x4e26c1(0xae)](_0x4e26c1(0xaf)+_0x411576+'\x22.',_0x4e26c1(0xa4)+_0x5b57d2);if(_0x58d967[_0x4e26c1(0xad)]>0x1){const _0x10eacd=_0x58d967[_0x4e26c1(0xaa)](_0x28487e=>(_0x28487e['nickname']??_0x28487e[_0x4e26c1(0xc1)]??'?')+'('+_0x28487e[_0x4e26c1(0xb3)]+')')[_0x4e26c1(0xd3)](',\x20');throw CliErrors[_0x4e26c1(0xae)](_0x4e26c1(0x95)+_0x411576+_0x4e26c1(0xab)+_0x10eacd+'.',_0x5b57d2);}const _0x27b813=_0x58d967[0x0];return{'userId':_0x27b813[_0x4e26c1(0xb3)],'username':_0x27b813[_0x4e26c1(0xc1)]??String(_0x27b813[_0x4e26c1(0xb3)]),'nickname':_0x27b813['nickname'],'matchedBy':_0x4e26c1(0x9d)};}export const CREATE_USER_ROLE_PATH=a235_0x42bd67(0x9b);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';export function computeRoleUserMutation(_0x5a7143){const _0x4023e8=a235_0x42bd67,{operation:_0x58ae3b,appCode:_0x1324c6,role:_0x34e7be,relations:_0x1a53da,user:_0x527c27}=_0x5a7143,_0x55c7a0=[...new Set(_0x1a53da[_0x4023e8(0xaa)](_0x5da81f=>_0x5da81f[_0x4023e8(0xb3)]))],_0xf7165=[];if(_0x5a7143[_0x4023e8(0x87)]!==undefined&&_0x5a7143['expectUserCount']!==_0x55c7a0[_0x4023e8(0xad)])throw CliErrors[_0x4023e8(0xae)](_0x4023e8(0xd5)+_0x5a7143[_0x4023e8(0x87)]+_0x4023e8(0x99)+_0x55c7a0['length']+'.',_0x4023e8(0x9f));const _0x57cb0a=_0x55c7a0[_0x4023e8(0xa6)](_0x527c27[_0x4023e8(0xb3)]),_0x4ed776=_0x1a53da[_0x4023e8(0xc6)](_0x124c66=>_0x124c66[_0x4023e8(0xb3)]===_0x527c27[_0x4023e8(0xb3)])[_0x4023e8(0xaa)](_0x1392d6=>_0x1392d6['id']),_0x1d4867=_0x58ae3b==='user-add'?!_0x57cb0a:_0x57cb0a;let _0x3e2a87=_0x55c7a0;_0x58ae3b===_0x4023e8(0xd0)?_0x57cb0a?_0xf7165[_0x4023e8(0xb7)]('User\x20'+_0x527c27[_0x4023e8(0xb3)]+'\x20is\x20already\x20a\x20member\x20of\x20role\x20'+_0x34e7be['roleName']+_0x4023e8(0xc2)):_0x3e2a87=[..._0x55c7a0,_0x527c27[_0x4023e8(0xb3)]]:!_0x57cb0a?_0xf7165[_0x4023e8(0xb7)](_0x4023e8(0xac)+_0x527c27[_0x4023e8(0xb3)]+_0x4023e8(0x97)+_0x34e7be['roleName']+_0x4023e8(0xc2)):(_0x3e2a87=_0x55c7a0[_0x4023e8(0xc6)](_0x530301=>_0x530301!==_0x527c27[_0x4023e8(0xb3)]),_0x4ed776[_0x4023e8(0xad)]>0x1&&_0xf7165[_0x4023e8(0xb7)](_0x4023e8(0xcf)+_0x4ed776[_0x4023e8(0xad)]+_0x4023e8(0xc7)+_0x527c27[_0x4023e8(0xb3)]+'.'));const _0x9f3048={'scope':'dev','operation':_0x58ae3b,'selector':{'appCode':_0x1324c6,'roleId':_0x34e7be['id'],'roleName':_0x34e7be[_0x4023e8(0x96)],'userId':_0x527c27[_0x4023e8(0xb3)]},'before':{'userIds':_0x55c7a0},'after':{'userIds':_0x3e2a87},'dryRun':_0x5a7143['dryRun'],'backend':{'method':_0x4023e8(0xbb),'path':_0x58ae3b===_0x4023e8(0xd0)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0xf7165};return{'mutation':_0x9f3048,'changed':_0x1d4867,'matchingRelationIds':_0x4ed776};}export async function loadDevRoleRelations(_0x1f7adc,_0x121792){const _0x27638d=a235_0x42bd67,_0x304540=0x64,_0x4eb877=[];for(let _0x3efe88=0x1;;_0x3efe88+=0x1){const {items:_0x1669b0,paging:_0x1ca54b}=await listDevUserRoleRelations(_0x1f7adc,{'roleId':_0x121792,'currentPage':_0x3efe88,'pageSize':_0x304540});_0x4eb877[_0x27638d(0xb7)](..._0x1669b0);if(_0x1669b0[_0x27638d(0xad)]<_0x304540||_0x1ca54b&&_0x4eb877['length']>=_0x1ca54b[_0x27638d(0xa0)])return _0x4eb877;}}export function readRoleRef(_0x49c1de){const _0x59b4a1=a235_0x42bd67,_0x5ef821=_0x49c1de['str']('role')[_0x59b4a1(0xa2)]();if(!_0x5ef821)throw CliErrors[_0x59b4a1(0x88)](_0x59b4a1(0xc9),_0x59b4a1(0xb4));return _0x5ef821;}export async function prepareUserMutation(_0x2020b6,_0x1c43ad,_0x8b4aa){const _0x5e2518=a235_0x42bd67,_0x44e120=readRoleRef(_0x2020b6),_0x1a6ffc=_0x2020b6['str']('user')['trim']();if(!_0x1a6ffc)throw CliErrors[_0x5e2518(0x88)](_0x5e2518(0x89),'Pass\x20--user\x20<id|name>.');const _0x24c225=_0x2020b6[_0x5e2518(0xb0)]('expect-user-count'),_0x4dd89a=_0x24c225===undefined||_0x24c225===null?undefined:Number(_0x24c225),_0x50f9f8=await resolveRoleRef(_0x2020b6[_0x5e2518(0x85)],_0x44e120);if(_0x50f9f8[_0x5e2518(0xcc)]==='OWNER')throw CliErrors[_0x5e2518(0xae)](_0x5e2518(0xbc)+_0x1c43ad+'\x20members\x20of\x20the\x20OWNER\x20role.','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x47eaec=await resolveUserRef(_0x1a6ffc),_0x377187=await loadDevRoleRelations(_0x2020b6[_0x5e2518(0x85)],_0x50f9f8['id']);return{...computeRoleUserMutation({'operation':_0x1c43ad,'appCode':_0x2020b6[_0x5e2518(0x85)],'role':_0x50f9f8,'relations':_0x377187,'user':{'userId':_0x47eaec[_0x5e2518(0xb3)],'username':_0x47eaec['username'],'nickname':_0x47eaec[_0x5e2518(0x98)]},'dryRun':_0x8b4aa,..._0x4dd89a!==undefined?{'expectUserCount':_0x4dd89a}:{}}),'role':_0x50f9f8,'user':_0x47eaec};}
|
|
1
|
+
const a235_0x25a3ea=a235_0x182d;(function(_0x524186,_0x4213ae){const _0x3d6690=a235_0x182d,_0x3477c7=_0x524186();while(!![]){try{const _0x2d46bd=parseInt(_0x3d6690(0x1b8))/0x1*(-parseInt(_0x3d6690(0x1ca))/0x2)+parseInt(_0x3d6690(0x1ab))/0x3+parseInt(_0x3d6690(0x1a8))/0x4*(parseInt(_0x3d6690(0x1ad))/0x5)+-parseInt(_0x3d6690(0x1d8))/0x6*(-parseInt(_0x3d6690(0x19e))/0x7)+parseInt(_0x3d6690(0x1d1))/0x8+parseInt(_0x3d6690(0x1b5))/0x9+-parseInt(_0x3d6690(0x19b))/0xa*(parseInt(_0x3d6690(0x1c6))/0xb);if(_0x2d46bd===_0x4213ae)break;else _0x3477c7['push'](_0x3477c7['shift']());}catch(_0x402ed2){_0x3477c7['push'](_0x3477c7['shift']());}}}(a235_0x123d,0xde7e4));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_0x25a3ea(0x1dc),'required':!![],'description':a235_0x25a3ea(0x193)};export const ROLE_REF_FLAG={'name':'role','type':a235_0x25a3ea(0x1be),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};function a235_0x182d(_0xa76495,_0x1c28a9){_0xa76495=_0xa76495-0x190;const _0x123d19=a235_0x123d();let _0x182dc3=_0x123d19[_0xa76495];return _0x182dc3;}export const USER_REF_FLAG={'name':a235_0x25a3ea(0x1b4),'type':'string','required':!![],'description':a235_0x25a3ea(0x1cd)};export const NAME_FLAG={'name':'name','type':a235_0x25a3ea(0x1be),'required':!![],'description':'Role\x20name'};function a235_0x123d(){const _0x5593cd=['push','name','expect-user-count','Role\x20name\x20\x22','5847368ETIitU','username','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','2491608DXhCUj','validation','5upqaGr','\x20built-in\x20role\x20','DEV','dryRun','\x22\x20not\x20found\x20in\x20app\x20','\x22\x20is\x20ambiguous\x20(ids:\x20','Disambiguate\x20with\x20--role\x20<id>.','user','16205913MrfxrY','Anti-drift\x20check\x20failed:\x20expected\x20','find','1TZqrqt','\x22:\x20','permitCount','User\x20','expectUserCount','Pass\x20--user\x20<id|name>.','string','user-add','Multiple\x20tenant\x20members\x20match\x20\x22','Missing\x20role\x20reference.','roleType','\x20is\x20already\x20a\x20member\x20of\x20role\x20','toLowerCase','remark','253IeqaJm','Cannot\x20','roleName','/smartapi/permit/user-role/delete','1994086Uvyjkp','OWNER','length','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','/smartapi/permit/user-role/create','role','Removed\x20','6032264BNwLIb','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Role\x20id\x20','Pass\x20--role\x20<id|name>.','map','tenant_code','flag','88470oXEwda','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','appCode','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','number','dev','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Missing\x20user\x20reference.','Role\x20id\x20(from\x20`role\x20list`)','\x20members\x20of\x20the\x20OWNER\x20role.','userId','totalCount',';\x20no\x20change.','flagMissing','filter','nickname','1700810OJMmeT','trim','join','462sXYdiZ','includes','\x20member(s)\x20but\x20role\x20has\x20','Optional\x20role\x20remark/description','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','test'];a235_0x123d=function(){return _0x5593cd;};return a235_0x123d();}export const USER_NAME_FLAG={'name':'name','type':a235_0x25a3ea(0x1be),'required':!![],'description':a235_0x25a3ea(0x191)};export const REMARK_FLAG={'name':a235_0x25a3ea(0x1c5),'type':a235_0x25a3ea(0x1be),'required':![],'description':a235_0x25a3ea(0x1a1)};export const EXPECT_USER_COUNT_FLAG={'name':a235_0x25a3ea(0x1a6),'type':a235_0x25a3ea(0x1dc),'required':![],'description':a235_0x25a3ea(0x1d9)};export const BUILTIN_ROLE_TYPES=['ADMIN',a235_0x25a3ea(0x1af),a235_0x25a3ea(0x1cb)];export function isBuiltinRole(_0x430868){return BUILTIN_ROLE_TYPES['includes'](_0x430868);}export function assertCustomRole(_0x3c7360,_0x26b96b){const _0x4e95c5=a235_0x25a3ea;if(_0x3c7360[_0x4e95c5(0x1c2)]!=='CUSTOM')throw CliErrors['validation'](_0x4e95c5(0x1c7)+_0x26b96b+_0x4e95c5(0x1ae)+_0x3c7360['roleName']+'\x20('+_0x3c7360[_0x4e95c5(0x1c2)]+').',_0x4e95c5(0x1d2));}export function projectRole(_0x3466cf){const _0x304295=a235_0x25a3ea;return{'id':_0x3466cf['id'],'roleName':_0x3466cf[_0x304295(0x1c8)],'roleType':_0x3466cf[_0x304295(0x1c2)],'remark':_0x3466cf[_0x304295(0x1c5)],'userCount':_0x3466cf['userCount'],'permitCount':_0x3466cf[_0x304295(0x1ba)],'builtin':isBuiltinRole(_0x3466cf[_0x304295(0x1c2)])};}export async function resolveRoleRef(_0x125869,_0x9ea3c4){const _0x557d94=a235_0x25a3ea,_0x5391c1=_0x9ea3c4[_0x557d94(0x19c)]();if(!_0x5391c1)throw CliErrors['validation'](_0x557d94(0x1c1),_0x557d94(0x1d4));if(/^\d+$/[_0x557d94(0x1a3)](_0x5391c1))return getRoleById(_0x125869,Number(_0x5391c1));const _0x161344=await listAllAppRoles(_0x125869),_0x36e8ce=_0x161344[_0x557d94(0x199)](_0x2c7259=>_0x2c7259[_0x557d94(0x1c8)]===_0x5391c1);if(_0x36e8ce[_0x557d94(0x1cc)]===0x0)throw CliErrors[_0x557d94(0x1ac)](_0x557d94(0x1a7)+_0x5391c1+_0x557d94(0x1b1)+_0x125869+'.',_0x557d94(0x1aa));if(_0x36e8ce[_0x557d94(0x1cc)]>0x1){const _0x41f43a=_0x36e8ce['map'](_0x39978b=>_0x39978b['id'])[_0x557d94(0x19d)](',\x20');throw CliErrors[_0x557d94(0x1ac)](_0x557d94(0x1a7)+_0x5391c1+_0x557d94(0x1b2)+_0x41f43a+').',_0x557d94(0x1b3));}return _0x36e8ce[0x0];}export async function getRoleById(_0x5f5ab3,_0x54d36f){const _0x4fff0e=a235_0x25a3ea,_0x506253=await listAllAppRoles(_0x5f5ab3),_0x2dbbf9=_0x506253[_0x4fff0e(0x199)](_0x9e418b=>_0x9e418b['id']===_0x54d36f&&(!_0x9e418b['appCode']||_0x9e418b[_0x4fff0e(0x1da)]===_0x5f5ab3));if(_0x2dbbf9['length']!==0x1)throw CliErrors['validation'](_0x4fff0e(0x1d3)+_0x54d36f+'\x20not\x20found\x20in\x20app\x20'+_0x5f5ab3+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x2dbbf9[0x0];}async function listAllAppRoles(_0x122146){const _0x385314=a235_0x25a3ea,_0x5c720d=0x64,_0x107252=[];for(let _0x551ef2=0x1;;_0x551ef2+=0x1){const {items:_0x483d31,paging:_0x5c7e57}=await listAppRoles(_0x122146,{'currentPage':_0x551ef2,'pageSize':_0x5c720d});_0x107252[_0x385314(0x1a4)](..._0x483d31);if(_0x483d31[_0x385314(0x1cc)]<_0x5c720d||_0x5c7e57&&_0x107252['length']>=_0x5c7e57[_0x385314(0x196)])return _0x107252;}}export async function resolveTenantCode(){const _0x5a845d=a235_0x25a3ea,_0x30848a=await getSessionUserInfo(),_0x264f7e=_0x30848a?.[_0x5a845d(0x1b4)]?.['tenant']?.[_0x5a845d(0x1d6)];if(!_0x264f7e)throw CliErrors['authRequired']('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x264f7e;}function matchMember(_0x393e5b,_0xb2c4ab){const _0x379081=a235_0x25a3ea,_0x12c6a2=_0xb2c4ab[_0x379081(0x19c)]()[_0x379081(0x1c4)]();return(_0x393e5b[_0x379081(0x19a)]??'')['toLowerCase']()===_0x12c6a2||(_0x393e5b[_0x379081(0x1a9)]??'')[_0x379081(0x1c4)]()===_0x12c6a2;}export async function resolveUserRef(_0x1a1c18,_0x3adb06='Pass\x20--user\x20<id>.'){const _0x34770e=a235_0x25a3ea,_0x2c5bbb=_0x1a1c18[_0x34770e(0x19c)]();if(!_0x2c5bbb)throw CliErrors[_0x34770e(0x1ac)](_0x34770e(0x192),_0x34770e(0x1bd));const _0x408c28=await resolveTenantCode(),_0x47fc1c=await getTenantMembers(_0x408c28);if(/^\d+$/[_0x34770e(0x1a3)](_0x2c5bbb)){const _0x24ec9e=Number(_0x2c5bbb),_0x5c4ed1=_0x47fc1c[_0x34770e(0x1b7)](_0x293ccd=>_0x293ccd['userId']===_0x24ec9e);return{'userId':_0x24ec9e,'username':_0x5c4ed1?.[_0x34770e(0x1a9)]??String(_0x24ec9e),'nickname':_0x5c4ed1?.[_0x34770e(0x19a)],'matchedBy':'id'};}const _0x393300=_0x47fc1c[_0x34770e(0x199)](_0x1d1470=>matchMember(_0x1d1470,_0x2c5bbb));if(_0x393300[_0x34770e(0x1cc)]===0x0)throw CliErrors['validation']('No\x20tenant\x20member\x20matches\x20\x22'+_0x2c5bbb+'\x22.','Check\x20the\x20nickname/username.\x20'+_0x3adb06);if(_0x393300[_0x34770e(0x1cc)]>0x1){const _0x594f3b=_0x393300[_0x34770e(0x1d5)](_0x5de014=>(_0x5de014[_0x34770e(0x19a)]??_0x5de014[_0x34770e(0x1a9)]??'?')+'('+_0x5de014[_0x34770e(0x195)]+')')[_0x34770e(0x19d)](',\x20');throw CliErrors[_0x34770e(0x1ac)](_0x34770e(0x1c0)+_0x2c5bbb+_0x34770e(0x1b9)+_0x594f3b+'.',_0x3adb06);}const _0x39b5e8=_0x393300[0x0];return{'userId':_0x39b5e8[_0x34770e(0x195)],'username':_0x39b5e8['username']??String(_0x39b5e8[_0x34770e(0x195)]),'nickname':_0x39b5e8[_0x34770e(0x19a)],'matchedBy':_0x34770e(0x1a5)};}export const CREATE_USER_ROLE_PATH=a235_0x25a3ea(0x1ce);export const DELETE_USER_ROLE_PATH=a235_0x25a3ea(0x1c9);export function computeRoleUserMutation(_0x51123e){const _0x532238=a235_0x25a3ea,{operation:_0x2c30b5,appCode:_0x58026d,role:_0x1347ce,relations:_0x5a9eeb,user:_0x1ce200}=_0x51123e,_0x3eea1e=[...new Set(_0x5a9eeb[_0x532238(0x1d5)](_0x103600=>_0x103600[_0x532238(0x195)]))],_0x383a0e=[];if(_0x51123e[_0x532238(0x1bc)]!==undefined&&_0x51123e['expectUserCount']!==_0x3eea1e[_0x532238(0x1cc)])throw CliErrors[_0x532238(0x1ac)](_0x532238(0x1b6)+_0x51123e[_0x532238(0x1bc)]+_0x532238(0x1a0)+_0x3eea1e['length']+'.',_0x532238(0x1a2));const _0x237c1c=_0x3eea1e[_0x532238(0x19f)](_0x1ce200[_0x532238(0x195)]),_0x1a92f5=_0x5a9eeb[_0x532238(0x199)](_0x410edf=>_0x410edf['userId']===_0x1ce200[_0x532238(0x195)])[_0x532238(0x1d5)](_0x1606da=>_0x1606da['id']),_0x3d71ca=_0x2c30b5===_0x532238(0x1bf)?!_0x237c1c:_0x237c1c;let _0x38131b=_0x3eea1e;_0x2c30b5===_0x532238(0x1bf)?_0x237c1c?_0x383a0e[_0x532238(0x1a4)](_0x532238(0x1bb)+_0x1ce200['userId']+_0x532238(0x1c3)+_0x1347ce['roleName']+_0x532238(0x197)):_0x38131b=[..._0x3eea1e,_0x1ce200[_0x532238(0x195)]]:!_0x237c1c?_0x383a0e[_0x532238(0x1a4)](_0x532238(0x1bb)+_0x1ce200['userId']+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x1347ce[_0x532238(0x1c8)]+_0x532238(0x197)):(_0x38131b=_0x3eea1e[_0x532238(0x199)](_0x286f93=>_0x286f93!==_0x1ce200[_0x532238(0x195)]),_0x1a92f5['length']>0x1&&_0x383a0e[_0x532238(0x1a4)](_0x532238(0x1d0)+_0x1a92f5[_0x532238(0x1cc)]+'\x20duplicate\x20memberships\x20for\x20user\x20'+_0x1ce200[_0x532238(0x195)]+'.'));const _0x2f7a7b={'scope':_0x532238(0x190),'operation':_0x2c30b5,'selector':{'appCode':_0x58026d,'roleId':_0x1347ce['id'],'roleName':_0x1347ce[_0x532238(0x1c8)],'userId':_0x1ce200['userId']},'before':{'userIds':_0x3eea1e},'after':{'userIds':_0x38131b},'dryRun':_0x51123e[_0x532238(0x1b0)],'backend':{'method':'POST','path':_0x2c30b5===_0x532238(0x1bf)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x383a0e};return{'mutation':_0x2f7a7b,'changed':_0x3d71ca,'matchingRelationIds':_0x1a92f5};}export async function loadDevRoleRelations(_0x586198,_0x31be67){const _0x7a1f5e=a235_0x25a3ea,_0x3f21a2=0x64,_0x251cd8=[];for(let _0x2684b4=0x1;;_0x2684b4+=0x1){const {items:_0x5ba088,paging:_0x187fe2}=await listDevUserRoleRelations(_0x586198,{'roleId':_0x31be67,'currentPage':_0x2684b4,'pageSize':_0x3f21a2});_0x251cd8[_0x7a1f5e(0x1a4)](..._0x5ba088);if(_0x5ba088[_0x7a1f5e(0x1cc)]<_0x3f21a2||_0x187fe2&&_0x251cd8['length']>=_0x187fe2[_0x7a1f5e(0x196)])return _0x251cd8;}}export function readRoleRef(_0x23c2ba){const _0x21b340=a235_0x25a3ea,_0x2ba071=_0x23c2ba['str'](_0x21b340(0x1cf))[_0x21b340(0x19c)]();if(!_0x2ba071)throw CliErrors[_0x21b340(0x198)]('role',_0x21b340(0x1d4));return _0x2ba071;}export async function prepareUserMutation(_0x3602e0,_0x1814b6,_0x4e7e3c){const _0x2c2462=a235_0x25a3ea,_0x3b6d57=readRoleRef(_0x3602e0),_0x1da6be=_0x3602e0['str']('user')[_0x2c2462(0x19c)]();if(!_0x1da6be)throw CliErrors[_0x2c2462(0x198)]('user',_0x2c2462(0x1bd));const _0x1fa456=_0x3602e0[_0x2c2462(0x1d7)]('expect-user-count'),_0x475958=_0x1fa456===undefined||_0x1fa456===null?undefined:Number(_0x1fa456),_0x32e256=await resolveRoleRef(_0x3602e0['appCode'],_0x3b6d57);if(_0x32e256[_0x2c2462(0x1c2)]===_0x2c2462(0x1cb))throw CliErrors[_0x2c2462(0x1ac)](_0x2c2462(0x1c7)+_0x1814b6+_0x2c2462(0x194),_0x2c2462(0x1db));const _0x28f5c5=await resolveUserRef(_0x1da6be),_0x3fcd84=await loadDevRoleRelations(_0x3602e0[_0x2c2462(0x1da)],_0x32e256['id']);return{...computeRoleUserMutation({'operation':_0x1814b6,'appCode':_0x3602e0['appCode'],'role':_0x32e256,'relations':_0x3fcd84,'user':{'userId':_0x28f5c5[_0x2c2462(0x195)],'username':_0x28f5c5[_0x2c2462(0x1a9)],'nickname':_0x28f5c5[_0x2c2462(0x19a)]},'dryRun':_0x4e7e3c,..._0x475958!==undefined?{'expectUserCount':_0x475958}:{}}),'role':_0x32e256,'user':_0x28f5c5};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a236_0x125633=a236_0x4922;(function(_0x55bd49,_0xe1e988){const _0x363500=a236_0x4922,_0x2bb96e=_0x55bd49();while(!![]){try{const _0x5b476a=parseInt(_0x363500(0x116))/0x1+-parseInt(_0x363500(0x118))/0x2+parseInt(_0x363500(0x123))/0x3*(-parseInt(_0x363500(0x109))/0x4)+-parseInt(_0x363500(0x11a))/0x5*(-parseInt(_0x363500(0x110))/0x6)+parseInt(_0x363500(0x112))/0x7*(parseInt(_0x363500(0x108))/0x8)+-parseInt(_0x363500(0x114))/0x9*(-parseInt(_0x363500(0x10c))/0xa)+-parseInt(_0x363500(0x10e))/0xb;if(_0x5b476a===_0xe1e988)break;else _0x2bb96e['push'](_0x2bb96e['shift']());}catch(_0x20aaac){_0x2bb96e['push'](_0x2bb96e['shift']());}}}(a236_0x486f,0x42a77));import{updateAppRole}from'../../core/api-client.js';function a236_0x486f(){const _0x1e55b4=['appCode','943281aeUCkX','length','434504SjXaCk','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','424776nhpltl','Updated\x20role\x20','345kWhUnT','validation','--name\x20cannot\x20be\x20empty.','roleName','POST','role','New\x20role\x20name','remark','write','3LOjWvN','num','Nothing\x20to\x20update.','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','16LAKNpj','1770884iqlnLq','dev','\x20(id=','20JlnvRH','name','654236LShMjo','/smartapi/permit/role/update','2076vbNtaK','update','1118614FAzWrc'];a236_0x486f=function(){return _0x1e55b4;};return a236_0x486f();}function a236_0x4922(_0x1a7a97,_0x46728a){_0x1a7a97=_0x1a7a97-0x108;const _0x486f64=a236_0x486f();let _0x49221e=_0x486f64[_0x1a7a97];return _0x49221e;}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a236_0x125633(0x10f);function readPatch(_0x4d0e73){const _0x381cb2=a236_0x125633,_0x5f3756=_0x4d0e73['flag'](_0x381cb2(0x10d)),_0x147762=_0x4d0e73['flag'](_0x381cb2(0x121)),_0x3316b5={};if(_0x5f3756!==undefined&&_0x5f3756!==null){const _0x1b5240=String(_0x5f3756)['trim']();if(!_0x1b5240)throw CliErrors[_0x381cb2(0x11b)](_0x381cb2(0x11c));if(_0x1b5240[_0x381cb2(0x115)]>0x40)throw CliErrors[_0x381cb2(0x11b)](_0x381cb2(0x126));_0x3316b5[_0x381cb2(0x11d)]=_0x1b5240;}_0x147762!==undefined&&_0x147762!==null&&(_0x3316b5[_0x381cb2(0x121)]=String(_0x147762));if(_0x3316b5[_0x381cb2(0x11d)]===undefined&&_0x3316b5[_0x381cb2(0x121)]===undefined)throw CliErrors[_0x381cb2(0x11b)](_0x381cb2(0x125),'Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.');return _0x3316b5;}export const roleUpdate={'service':a236_0x125633(0x11f),'command':a236_0x125633(0x111),'description':a236_0x125633(0x117),'risk':a236_0x125633(0x122),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a236_0x125633(0x10d),'type':'string','required':![],'description':a236_0x125633(0x120)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2cff00){readPatch(_0x2cff00);},async 'dryRun'(_0x1fce7b){const _0x2355fb=a236_0x125633,_0x4de9cb=_0x1fce7b[_0x2355fb(0x124)]('id'),_0x3565b8=readPatch(_0x1fce7b),_0xb0f9d9=await getRoleById(_0x1fce7b[_0x2355fb(0x113)],_0x4de9cb);return assertCustomRole(_0xb0f9d9,_0x2355fb(0x111)),asDryRunResult({'scope':'dev','operation':_0x2355fb(0x111),'selector':{'appCode':_0x1fce7b[_0x2355fb(0x113)],'roleId':_0x4de9cb,'roleName':_0xb0f9d9[_0x2355fb(0x11d)]},'before':projectRole(_0xb0f9d9),'after':projectRole({..._0xb0f9d9,..._0x3565b8[_0x2355fb(0x11d)]!==undefined?{'roleName':_0x3565b8[_0x2355fb(0x11d)]}:{},..._0x3565b8[_0x2355fb(0x121)]!==undefined?{'remark':_0x3565b8[_0x2355fb(0x121)]}:{}}),'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},{'method':_0x2355fb(0x11e),'url':UPDATE_PATH});},async 'execute'(_0x369aaf){const _0x35c2fb=a236_0x125633,_0x2d6eae=_0x369aaf[_0x35c2fb(0x124)]('id'),_0x50607e=readPatch(_0x369aaf),_0x3f59e8=await getRoleById(_0x369aaf[_0x35c2fb(0x113)],_0x2d6eae);assertCustomRole(_0x3f59e8,_0x35c2fb(0x111)),await updateAppRole({'id':_0x2d6eae,'appCode':_0x369aaf['appCode'],..._0x50607e[_0x35c2fb(0x11d)]!==undefined?{'roleName':_0x50607e[_0x35c2fb(0x11d)]}:{},..._0x50607e[_0x35c2fb(0x121)]!==undefined?{'remark':_0x50607e[_0x35c2fb(0x121)]}:{}});const _0x56f06b=await getRoleById(_0x369aaf[_0x35c2fb(0x113)],_0x2d6eae);return{'ok':!![],'data':{'scope':_0x35c2fb(0x10a),'operation':_0x35c2fb(0x111),'selector':{'appCode':_0x369aaf['appCode'],'roleId':_0x2d6eae,'roleName':_0x56f06b[_0x35c2fb(0x11d)]},'before':projectRole(_0x3f59e8),'after':projectRole(_0x56f06b),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x35c2fb(0x119)+_0x56f06b['roleName']+_0x35c2fb(0x10b)+_0x2d6eae+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a237_0x577eeb=a237_0x18af;(function(_0x11d5ed,_0x29583f){const _0x2931ba=a237_0x18af,_0x182a05=_0x11d5ed();while(!![]){try{const _0x47085b=-parseInt(_0x2931ba(0xbb))/0x1*(-parseInt(_0x2931ba(0xb9))/0x2)+-parseInt(_0x2931ba(0xaf))/0x3*(parseInt(_0x2931ba(0xb1))/0x4)+-parseInt(_0x2931ba(0xa7))/0x5*(-parseInt(_0x2931ba(0xa8))/0x6)+-parseInt(_0x2931ba(0xae))/0x7+-parseInt(_0x2931ba(0xad))/0x8+parseInt(_0x2931ba(0xba))/0x9*(-parseInt(_0x2931ba(0xb6))/0xa)+parseInt(_0x2931ba(0xa9))/0xb;if(_0x47085b===_0x29583f)break;else _0x182a05['push'](_0x182a05['shift']());}catch(_0x11aed1){_0x182a05['push'](_0x182a05['shift']());}}}(a237_0xc9c5,0x43600));import{createDevUserRole}from'../../core/api-client.js';function a237_0xc9c5(){const _0x5e6646=['112zAIZpe','appCode','roleId','Added\x20user\x20','roleType','470600MjUHGD','POST','roleName','2FoRBES','90hSAbzT','110270AMxSqE','\x20already\x20in\x20role\x20','\x20to\x20role\x20','role','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','461255OjafRB','12qszgjq','20936806JBrome','No\x20change:\x20user\x20','user-add','selector','4129720tttiZu','3095393ZMKtRE','52836SGzPNk','userId'];a237_0xc9c5=function(){return _0x5e6646;};return a237_0xc9c5();}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_0x18af(_0x2fc3f1,_0x16afdb){_0x2fc3f1=_0x2fc3f1-0xa4;const _0xc9c58e=a237_0xc9c5();let _0x18af55=_0xc9c58e[_0x2fc3f1];return _0x18af55;}export const roleUserAdd={'service':a237_0x577eeb(0xa5),'command':'user-add','description':a237_0x577eeb(0xa6),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x130eac){const _0x103fb1=a237_0x577eeb,{mutation:_0x3760d7}=await prepareUserMutation(_0x130eac,_0x103fb1(0xab),!![]);return asDryRunResult(_0x3760d7,{'method':_0x103fb1(0xb7),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x4fa35e){const _0x1b3353=a237_0x577eeb,{mutation:_0x442578,changed:_0x2719e4,role:_0x35aebf,user:_0x144e30}=await prepareUserMutation(_0x4fa35e,_0x1b3353(0xab),![]);return _0x2719e4&&await createDevUserRole({'appCode':_0x4fa35e[_0x1b3353(0xb2)],'userId':_0x144e30[_0x1b3353(0xb0)],'username':_0x144e30['username'],'roleType':_0x35aebf[_0x1b3353(0xb5)],'roleId':_0x442578['selector'][_0x1b3353(0xb3)]}),{'ok':!![],'data':_0x442578,'message':_0x2719e4?_0x1b3353(0xb4)+_0x442578[_0x1b3353(0xac)]['userId']+_0x1b3353(0xa4)+_0x442578[_0x1b3353(0xac)][_0x1b3353(0xb8)]:_0x1b3353(0xaa)+_0x442578[_0x1b3353(0xac)]['userId']+_0x1b3353(0xbc)+_0x442578[_0x1b3353(0xac)][_0x1b3353(0xb8)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a238_0x223347=a238_0xcf35;(function(_0x41758d,_0x5be8aa){const _0x3f91f7=a238_0xcf35,_0x3d2a2c=_0x41758d();while(!![]){try{const _0xbf5738=-parseInt(_0x3f91f7(0x1c5))/0x1*(-parseInt(_0x3f91f7(0x1cb))/0x2)+-parseInt(_0x3f91f7(0x1da))/0x3*(parseInt(_0x3f91f7(0x1ce))/0x4)+-parseInt(_0x3f91f7(0x1c9))/0x5*(-parseInt(_0x3f91f7(0x1d1))/0x6)+parseInt(_0x3f91f7(0x1d3))/0x7+parseInt(_0x3f91f7(0x1c8))/0x8+parseInt(_0x3f91f7(0x1d0))/0x9+parseInt(_0x3f91f7(0x1d8))/0xa*(parseInt(_0x3f91f7(0x1d2))/0xb);if(_0xbf5738===_0x5be8aa)break;else _0x3d2a2c['push'](_0x3d2a2c['shift']());}catch(_0x4932f3){_0x3d2a2c['push'](_0x3d2a2c['shift']());}}}(a238_0x4047,0x3eda7));function a238_0x4047(){const _0x1d6400=['userId','role','4iTrkBm','high-risk-write','1342845UTzSGf','1130124adQuxw','1382722oAseBz','241822xmhuKE','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','POST','selector','No\x20change:\x20user\x20','10gkLLdq','\x20not\x20in\x20role\x20','1023441oNLwYP','27LXFwae','user-remove','roleName','160888GEgrNz','5YPzqAL','\x20from\x20role\x20','5976eFgZgz'];a238_0x4047=function(){return _0x1d6400;};return a238_0x4047();}import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a238_0xcf35(_0x25c955,_0x5d0847){_0x25c955=_0x25c955-0x1c5;const _0x4047a8=a238_0x4047();let _0xcf3571=_0x4047a8[_0x25c955];return _0xcf3571;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a238_0x223347(0x1cd),'command':'user-remove','description':a238_0x223347(0x1d4),'risk':a238_0x223347(0x1cf),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x99573){const _0x2b7d5f=a238_0x223347,{mutation:_0x367d79}=await prepareUserMutation(_0x99573,_0x2b7d5f(0x1c6),!![]);return asDryRunResult(_0x367d79,{'method':_0x2b7d5f(0x1d5),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x5681f3){const _0x5808a5=a238_0x223347,{matchingRelationIds:_0x5e4851,mutation:_0x322cf9,changed:_0x3eb92a}=await prepareUserMutation(_0x5681f3,_0x5808a5(0x1c6),![]);if(_0x3eb92a)for(const _0x404097 of _0x5e4851){await deleteDevUserRole(_0x404097);}return{'ok':!![],'data':_0x322cf9,'message':_0x3eb92a?'Removed\x20user\x20'+_0x322cf9['selector'][_0x5808a5(0x1cc)]+_0x5808a5(0x1ca)+_0x322cf9[_0x5808a5(0x1d6)][_0x5808a5(0x1c7)]:_0x5808a5(0x1d7)+_0x322cf9['selector'][_0x5808a5(0x1cc)]+_0x5808a5(0x1d9)+_0x322cf9[_0x5808a5(0x1d6)][_0x5808a5(0x1c7)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a239_0x14bf(_0x15fec1,_0x30d634){_0x15fec1=_0x15fec1-0xf2;const _0x5a91cb=a239_0x5a91();let _0x14bf73=_0x5a91cb[_0x15fec1];return _0x14bf73;}function a239_0x5a91(){const _0x327ee5=['13715046bvikaC','55567900xfBSDe','userId','user-resolve','18grdHqe','148LQAnrH','role','68182SPuVrO','559118wRZBnP','name','24QWdVey','Pass\x20--name\x20<nickname|username>.','\x22\x20→\x20userId\x20','read','194205gzXocA','281920RDzBQQ','matchedBy','Resolved\x20\x22','str','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','8191904afplYO','username'];a239_0x5a91=function(){return _0x327ee5;};return a239_0x5a91();}const a239_0x2409cd=a239_0x14bf;(function(_0x4a257a,_0x21911c){const _0x571af7=a239_0x14bf,_0x2aeeea=_0x4a257a();while(!![]){try{const _0x359a78=-parseInt(_0x571af7(0xf4))/0x1+-parseInt(_0x571af7(0x102))/0x2*(parseInt(_0x571af7(0x105))/0x3)+-parseInt(_0x571af7(0x100))/0x4*(parseInt(_0x571af7(0xf3))/0x5)+-parseInt(_0x571af7(0xff))/0x6*(parseInt(_0x571af7(0x103))/0x7)+-parseInt(_0x571af7(0xf9))/0x8+-parseInt(_0x571af7(0xfb))/0x9+parseInt(_0x571af7(0xfc))/0xa;if(_0x359a78===_0x21911c)break;else _0x2aeeea['push'](_0x2aeeea['shift']());}catch(_0x126d9e){_0x2aeeea['push'](_0x2aeeea['shift']());}}}(a239_0x5a91,0xbdd31));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a239_0x2409cd(0x101),'command':a239_0x2409cd(0xfe),'description':a239_0x2409cd(0xf8),'risk':a239_0x2409cd(0xf2),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x417484){const _0x34956a=a239_0x2409cd;if(!_0x417484[_0x34956a(0xf7)]('name')['trim']())throw CliErrors['flagMissing']('name',_0x34956a(0x106));},async 'execute'(_0x839c23){const _0x251c9c=a239_0x2409cd,_0x5daa29=_0x839c23[_0x251c9c(0xf7)](_0x251c9c(0x104))['trim'](),_0x2a3174=await resolveUserRef(_0x5daa29,'Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.');return{'ok':!![],'data':{'user':{'userId':_0x2a3174['userId'],'username':_0x2a3174[_0x251c9c(0xfa)],'nickname':_0x2a3174['nickname'],'matchedBy':_0x2a3174[_0x251c9c(0xf5)]}},'message':_0x251c9c(0xf6)+_0x5daa29+_0x251c9c(0x107)+_0x2a3174[_0x251c9c(0xfd)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a240_0xefb1ab=a240_0x19e8;(function(_0xd3665b,_0x30f1a8){const _0x4c194f=a240_0x19e8,_0x36db62=_0xd3665b();while(!![]){try{const _0x55a2f8=parseInt(_0x4c194f(0xb7))/0x1*(parseInt(_0x4c194f(0xb5))/0x2)+parseInt(_0x4c194f(0xb3))/0x3+-parseInt(_0x4c194f(0xbb))/0x4+parseInt(_0x4c194f(0xb4))/0x5+-parseInt(_0x4c194f(0xb8))/0x6+parseInt(_0x4c194f(0xb2))/0x7+-parseInt(_0x4c194f(0xba))/0x8;if(_0x55a2f8===_0x30f1a8)break;else _0x36db62['push'](_0x36db62['shift']());}catch(_0x1018a3){_0x36db62['push'](_0x36db62['shift']());}}}(a240_0x14cf,0xb5c54));function a240_0x14cf(){const _0x9ad917=['rule','\x20for\x20','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','read','cookie','content','7355761HGixxs','3443145bUngPI','2316020BdDbiy','4vZOtjO','\x20--file\x20<path>\x20--dry-run`.','462556hMlCPw','2619522YYGXyn','appCode','17836872CgWqGN','704504VpdfNL','\x20is\x20not\x20configured\x20for\x20app\x20','Loaded\x20','app_rule_not_found','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app'];a240_0x14cf=function(){return _0x9ad917;};return a240_0x14cf();}function a240_0x19e8(_0x1c9a12,_0x71349b){_0x1c9a12=_0x1c9a12-0xac;const _0x14cf09=a240_0x14cf();let _0x19e8bd=_0x14cf09[_0x1c9a12];return _0x19e8bd;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a240_0xefb1ab(0xac),'command':'get','description':a240_0xefb1ab(0xbf),'risk':a240_0xefb1ab(0xaf),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x4d6f64){readAppRuleType(_0x4d6f64);},async 'execute'(_0x5cc216){const _0x38cf12=a240_0xefb1ab,_0x32cd24=readAppRuleType(_0x5cc216),_0x98a628=await getAppRule(_0x5cc216[_0x38cf12(0xb0)],{'appCode':_0x5cc216[_0x38cf12(0xb9)],'type':_0x32cd24});if(!_0x98a628)throw appRuleError(_0x38cf12(0xbe),appRuleFileName(_0x32cd24)+_0x38cf12(0xbc)+_0x5cc216[_0x38cf12(0xb9)]+'.',_0x38cf12(0xae)+_0x32cd24+_0x38cf12(0xb6));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x32cd24,_0x98a628),'content':_0x98a628[_0x38cf12(0xb1)]}},'message':_0x38cf12(0xbd)+appRuleFileName(_0x32cd24)+_0x38cf12(0xad)+_0x5cc216[_0x38cf12(0xb9)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a241_0x5a01d1=a241_0x4513;(function(_0x29057b,_0x530efd){const _0x37bfa9=a241_0x4513,_0x40c2bd=_0x29057b();while(!![]){try{const _0x444bf8=parseInt(_0x37bfa9(0x1b6))/0x1*(-parseInt(_0x37bfa9(0x1bd))/0x2)+-parseInt(_0x37bfa9(0x1be))/0x3*(-parseInt(_0x37bfa9(0x1b2))/0x4)+-parseInt(_0x37bfa9(0x1b5))/0x5*(parseInt(_0x37bfa9(0x1b1))/0x6)+parseInt(_0x37bfa9(0x1b9))/0x7+-parseInt(_0x37bfa9(0x1b8))/0x8*(-parseInt(_0x37bfa9(0x1bc))/0x9)+-parseInt(_0x37bfa9(0x1b4))/0xa*(parseInt(_0x37bfa9(0x1ba))/0xb)+-parseInt(_0x37bfa9(0x1b0))/0xc*(-parseInt(_0x37bfa9(0x1bb))/0xd);if(_0x444bf8===_0x530efd)break;else _0x40c2bd['push'](_0x40c2bd['shift']());}catch(_0x37e282){_0x40c2bd['push'](_0x40c2bd['shift']());}}}(a241_0x1d07,0xdf841));import{withKbManagementSession}from'../../core/kb-management-client.js';import{ruleGet}from'../../commands/rule/get.js';function a241_0x4513(_0x1432a4,_0x59e8ea){_0x1432a4=_0x1432a4-0x1ae;const _0x1d0736=a241_0x1d07();let _0x451380=_0x1d0736[_0x1432a4];return _0x451380;}function a241_0x1d07(){const _0x2acd12=['execute','dryRun','5820bwIHSK','6nTSlUZ','16UGUBgs','signal','5841140oGOWYM','1727295uhPmqX','96349KbHcoS','map','1215352rfnRoU','6607839tKMxng','33zVFLoa','28691ZHIcvL','45ViISFZ','2XNciZQ','251778DBqmqy'];a241_0x1d07=function(){return _0x2acd12;};return a241_0x1d07();}import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet][a241_0x5a01d1(0x1b7)](_0x1ef5b9=>({..._0x1ef5b9,'execute':_0x1ac6c7=>withKbManagementSession(_0x1ac6c7['signal'],()=>_0x1ef5b9[a241_0x5a01d1(0x1ae)](_0x1ac6c7)),..._0x1ef5b9[a241_0x5a01d1(0x1af)]?{'dryRun':_0x102617=>withKbManagementSession(_0x102617[a241_0x5a01d1(0x1b3)],()=>_0x1ef5b9[a241_0x5a01d1(0x1af)](_0x102617))}:{}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a242_0x4da0da=a242_0x2212;function a242_0x4ab4(){const _0xf2973a=['rule','cookie','762081EbgumW','16wsHHcs','read','6137256mEDREe','list','all','59717kLNfTd','Loaded\x20app\x20rule\x20configuration\x20for\x20','877108wstNGr','882wFzhsP','length','14319891obioPd','1162554EONIMR','appCode','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','map','1883885xqMzML'];a242_0x4ab4=function(){return _0xf2973a;};return a242_0x4ab4();}function a242_0x2212(_0x57e359,_0x54666a){_0x57e359=_0x57e359-0x1ca;const _0x4ab433=a242_0x4ab4();let _0x221253=_0x4ab433[_0x57e359];return _0x221253;}(function(_0x3dd2fa,_0x1b2ee4){const _0x326477=a242_0x2212,_0x251242=_0x3dd2fa();while(!![]){try{const _0x2496fc=parseInt(_0x326477(0x1cb))/0x1+-parseInt(_0x326477(0x1da))/0x2+parseInt(_0x326477(0x1d2))/0x3+parseInt(_0x326477(0x1d5))/0x4+parseInt(_0x326477(0x1cf))/0x5+-parseInt(_0x326477(0x1db))/0x6*(-parseInt(_0x326477(0x1d8))/0x7)+parseInt(_0x326477(0x1d3))/0x8*(-parseInt(_0x326477(0x1ca))/0x9);if(_0x2496fc===_0x1b2ee4)break;else _0x251242['push'](_0x251242['shift']());}catch(_0x4c2547){_0x251242['push'](_0x251242['shift']());}}}(a242_0x4ab4,0xea9d1));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a242_0x4da0da(0x1d0),'command':a242_0x4da0da(0x1d6),'description':a242_0x4da0da(0x1cd),'risk':a242_0x4da0da(0x1d4),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x3e02db){const _0x41e2fb=a242_0x4da0da,_0x58e48a=await Promise[_0x41e2fb(0x1d7)](APP_RULE_TYPES[_0x41e2fb(0x1ce)](_0x1aa2bd=>getAppRule(_0x3e02db[_0x41e2fb(0x1d1)],{'appCode':_0x3e02db['appCode'],'type':_0x1aa2bd}))),_0x3907af=APP_RULE_TYPES['map']((_0x26c9b6,_0x5183cb)=>projectAppRule(_0x26c9b6,_0x58e48a[_0x5183cb]??null));return{'ok':!![],'data':{'total':_0x3907af[_0x41e2fb(0x1dc)],'rules':_0x3907af},'message':_0x41e2fb(0x1d9)+_0x3e02db[_0x41e2fb(0x1cc)]};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a243_0x428e(){const _0x48d1ea=['1eWwShJ',';\x20current\x20version\x20is\x20','\x20for\x20','length','unconfigured','planned','str','app_rule_set_outcome_unknown','set','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','app_rule_verification_failed','content','beforeRecord','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','DATABASE','defineProperty','rabetbase\x20rule\x20get\x20--type\x20','before','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','write','222zxTLNY','app_rule_verification_unavailable','rules','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','Set\x20','10coBiup','type','isSafeInteger','cookie','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','1112duvxZi','87UEUgpx','verified','\x20version\x20changed\x20before\x20write.','expected-version','195979kgTbmS','6793776BAGGTe','app_rule_content_too_large','\x20--format\x20compress','appCode','update','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','contentHash','8409807XarnAO','app_rule_expected_version_invalid','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','9972457YwwmKc','create','replacement','push','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','input','byteSize','version','The\x20set\x20request\x20was\x20sent,\x20but\x20','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','2617298oeMOsC','757115TRTHiW','rule','POST','string','expectedVersion','RULES','app_rule_file_required','Expected\x20','file'];a243_0x428e=function(){return _0x48d1ea;};return a243_0x428e();}const a243_0x1dffdb=a243_0xd82a;(function(_0x2961d0,_0x403472){const _0x32c3af=a243_0xd82a,_0x48b68e=_0x2961d0();while(!![]){try{const _0x51ad04=parseInt(_0x32c3af(0x14e))/0x1*(parseInt(_0x32c3af(0x144))/0x2)+-parseInt(_0x32c3af(0x12b))/0x3*(-parseInt(_0x32c3af(0x12a))/0x4)+-parseInt(_0x32c3af(0x145))/0x5+parseInt(_0x32c3af(0x162))/0x6*(-parseInt(_0x32c3af(0x12f))/0x7)+parseInt(_0x32c3af(0x130))/0x8+-parseInt(_0x32c3af(0x137))/0x9+parseInt(_0x32c3af(0x125))/0xa*(parseInt(_0x32c3af(0x13a))/0xb);if(_0x51ad04===_0x403472)break;else _0x48b68e['push'](_0x48b68e['shift']());}catch(_0x583c9a){_0x48b68e['push'](_0x48b68e['shift']());}}}(a243_0x428e,0xe8201));import{knowledgeDocumentsPath}from'../../core/api-client.js';function a243_0xd82a(_0x2b02ef,_0x29f0fb){_0x2b02ef=_0x2b02ef-0x123;const _0x428e71=a243_0x428e();let _0xd82a83=_0x428e71[_0x2b02ef];return _0xd82a83;}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(_0x359c22){const _0x1c8f2d=a243_0xd82a,_0x1e4d84=readAppRuleType(_0x359c22),_0x56d49a=_0x359c22[_0x1c8f2d(0x154)](_0x1c8f2d(0x14d))['trim']();if(!_0x56d49a)throw appRuleError(_0x1c8f2d(0x14b),'--file\x20is\x20required.','Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x3b2457=_0x359c22['flag'](_0x1c8f2d(0x12e));let _0x5e87b6;if(_0x3b2457!==undefined){_0x5e87b6=Number(_0x3b2457);if(!Number[_0x1c8f2d(0x127)](_0x5e87b6)||_0x5e87b6<0x0)throw appRuleError(_0x1c8f2d(0x138),_0x1c8f2d(0x135));}return{'type':_0x1e4d84,'file':_0x56d49a,'expectedVersion':_0x5e87b6};}async function prepareSet(_0x4282cc){const _0x40682d=a243_0xd82a,_0x1459db=readSetInput(_0x4282cc),_0x5a2bd1=await readAppRuleFile(_0x1459db[_0x40682d(0x14d)]);if(_0x1459db['type']===_0x40682d(0x164)&&_0x5a2bd1[_0x40682d(0x159)][_0x40682d(0x151)]>0x7d0)throw appRuleError(_0x40682d(0x131),_0x40682d(0x13e));const _0x5c02c8=await getAppRule(_0x4282cc['cookie'],{'appCode':_0x4282cc[_0x40682d(0x133)],'type':_0x1459db[_0x40682d(0x126)]});if(_0x1459db[_0x40682d(0x149)]!==undefined&&(_0x5c02c8?.[_0x40682d(0x141)]??0x0)!==_0x1459db[_0x40682d(0x149)])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x1459db[_0x40682d(0x126)])+_0x40682d(0x12d),_0x40682d(0x14c)+_0x1459db[_0x40682d(0x149)]+_0x40682d(0x14f)+(_0x5c02c8?.['version']??_0x40682d(0x152))+_0x40682d(0x157));return{'input':_0x1459db,'replacement':_0x5a2bd1,'beforeRecord':_0x5c02c8,'before':projectAppRule(_0x1459db['type'],_0x5c02c8),'planned':{'type':_0x1459db[_0x40682d(0x126)],'fileName':appRuleFileName(_0x1459db[_0x40682d(0x126)]),'contextScope':appRuleContextScope(_0x1459db['type']),'enabled':!![],'appCode':_0x4282cc[_0x40682d(0x133)],'scope':_0x40682d(0x164),'contentByteSize':_0x5a2bd1[_0x40682d(0x140)],'contentHash':_0x5a2bd1['contentHash']}};}function warningsFor(_0x2ff0c6){return[];}export const ruleSet={'service':a243_0x1dffdb(0x146),'command':a243_0x1dffdb(0x156),'description':a243_0x1dffdb(0x139),'risk':a243_0x1dffdb(0x161),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x1dffdb(0x14d),'type':a243_0x1dffdb(0x148),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)'},{'name':a243_0x1dffdb(0x12e),'type':'number','required':![],'description':'Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set'}],async 'validate'(_0x33f649){readSetInput(_0x33f649);},async 'dryRun'(_0x5d889c){const _0x8be733=a243_0x1dffdb,_0x387549=await prepareSet(_0x5d889c);return asDryRunResult({'operation':_0x8be733(0x156),'selector':{'appCode':_0x5d889c['appCode'],'scope':_0x8be733(0x164),'type':_0x387549[_0x8be733(0x13f)][_0x8be733(0x126)]},'before':_0x387549[_0x8be733(0x15f)],'after':_0x387549[_0x8be733(0x153)],'dryRun':!![],'backend':{'method':'POST','path':knowledgeDocumentsPath('rules',_0x387549[_0x8be733(0x15a)]?'update':_0x8be733(0x13b)),'body':{'appCode':_0x5d889c[_0x8be733(0x133)],..._0x387549[_0x8be733(0x15a)]?{'id':_0x387549[_0x8be733(0x15a)]['id']}:{},'title':_0x387549[_0x8be733(0x13f)]['type']===_0x8be733(0x164)?_0x8be733(0x14a):_0x8be733(0x15c),'contentHash':_0x387549[_0x8be733(0x13c)][_0x8be733(0x136)],'contentByteSize':_0x387549[_0x8be733(0x13c)][_0x8be733(0x140)],..._0x387549[_0x8be733(0x15a)]?{'expectedVersion':_0x387549[_0x8be733(0x15a)]['version']}:{}}},'warnings':warningsFor(_0x387549[_0x8be733(0x13f)][_0x8be733(0x149)]),'verification':{'expectedVersion':_0x387549['beforeRecord']?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x387549['input']['type']+_0x8be733(0x132)}},{'method':_0x8be733(0x147),'url':knowledgeDocumentsPath(_0x8be733(0x164),_0x387549[_0x8be733(0x15a)]?_0x8be733(0x134):'create')});},async 'execute'(_0x296c7a){const _0xf29bae=a243_0x1dffdb,_0x3abdcb=await prepareSet(_0x296c7a),_0x46316a=_0x3abdcb[_0xf29bae(0x15a)]===null?0x1:_0x3abdcb[_0xf29bae(0x15a)][_0xf29bae(0x141)]+(_0x3abdcb[_0xf29bae(0x15a)][_0xf29bae(0x159)]===_0x3abdcb[_0xf29bae(0x13c)]['content']?0x0:0x1);let _0x354017,_0x1c57dd=![];try{_0x354017=await saveAppRule(_0x296c7a[_0xf29bae(0x128)],{'appCode':_0x296c7a[_0xf29bae(0x133)],'type':_0x3abdcb[_0xf29bae(0x13f)][_0xf29bae(0x126)],'content':_0x3abdcb[_0xf29bae(0x13c)][_0xf29bae(0x159)],'expectedVersion':_0x3abdcb[_0xf29bae(0x15a)]?.[_0xf29bae(0x141)]??0x0,..._0x3abdcb[_0xf29bae(0x15a)]?{'id':_0x3abdcb['beforeRecord']['id']}:{}});if(_0x354017[_0xf29bae(0x141)]!==_0x46316a||_0x354017[_0xf29bae(0x159)]!==_0x3abdcb[_0xf29bae(0x13c)][_0xf29bae(0x159)]||_0x3abdcb[_0xf29bae(0x15a)]!==null&&_0x354017['id']!==_0x3abdcb['beforeRecord']['id'])throw appRuleError(_0xf29bae(0x158),_0xf29bae(0x143),'Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.');}catch(_0x554edf){if(!isPlatformTransportFailure(_0x554edf))throw _0x554edf;_0x1c57dd=!![];}let _0x34833e;try{_0x34833e=await getAppRule(_0x296c7a['cookie'],{'appCode':_0x296c7a[_0xf29bae(0x133)],'type':_0x3abdcb[_0xf29bae(0x13f)][_0xf29bae(0x126)]});}catch(_0x460cdb){const _0x1d6ce0=appRuleError(_0x1c57dd?_0xf29bae(0x155):_0xf29bae(0x163),_0xf29bae(0x142)+appRuleFileName(_0x3abdcb[_0xf29bae(0x13f)]['type'])+'\x20could\x20not\x20be\x20verified.',_0xf29bae(0x15b));Object[_0xf29bae(0x15d)](_0x1d6ce0,'cause',{'value':_0x460cdb,'enumerable':![]});throw _0x1d6ce0;}const _0x1bcbbc=_0x34833e&&inspectAppRuleContent(_0x34833e[_0xf29bae(0x159)])[_0xf29bae(0x136)]===_0x3abdcb[_0xf29bae(0x13c)][_0xf29bae(0x136)],_0xe8f9eb=_0x34833e&&_0x34833e['version']===_0x46316a&&(!_0x354017||_0x34833e['id']===_0x354017['id']&&_0x34833e[_0xf29bae(0x141)]===_0x354017[_0xf29bae(0x141)]);if(!_0x34833e||!_0x1bcbbc||!_0xe8f9eb||_0x3abdcb[_0xf29bae(0x15a)]!==null&&_0x34833e['id']!==_0x3abdcb[_0xf29bae(0x15a)]['id'])throw appRuleError(_0x1c57dd?_0xf29bae(0x155):_0xf29bae(0x158),appRuleFileName(_0x3abdcb[_0xf29bae(0x13f)][_0xf29bae(0x126)])+_0xf29bae(0x123),'Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20'+_0x3abdcb[_0xf29bae(0x13f)][_0xf29bae(0x126)]+_0xf29bae(0x129));const _0x2bf700=warningsFor(_0x3abdcb[_0xf29bae(0x13f)]['expectedVersion']);_0x1c57dd&&_0x2bf700[_0xf29bae(0x13d)](_0xf29bae(0x160));const _0x4bb6fd=projectAppRule(_0x3abdcb[_0xf29bae(0x13f)][_0xf29bae(0x126)],_0x34833e);return{'ok':!![],'data':{'operation':'set','selector':{'appCode':_0x296c7a['appCode'],'scope':'rules','type':_0x3abdcb['input']['type']},'before':_0x3abdcb[_0xf29bae(0x15f)],'after':_0x4bb6fd,'dryRun':![],'backend':{'method':'POST','path':knowledgeDocumentsPath(_0xf29bae(0x164),_0x3abdcb[_0xf29bae(0x15a)]?_0xf29bae(0x134):_0xf29bae(0x13b))},'warnings':_0x2bf700,'verification':{'status':_0xf29bae(0x12c),'recoveredAfterUnknownResponse':_0x1c57dd,'expectedVersion':_0x3abdcb[_0xf29bae(0x15a)]?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0xf29bae(0x15e)+_0x3abdcb['input']['type']+_0xf29bae(0x132)}},'message':_0xf29bae(0x124)+appRuleFileName(_0x3abdcb[_0xf29bae(0x13f)][_0xf29bae(0x126)])+_0xf29bae(0x150)+_0x296c7a[_0xf29bae(0x133)]};}};
|
|
1
|
+
const a243_0x3f3639=a243_0x3d3c;(function(_0x456dd0,_0x19fcf9){const _0x5d082f=a243_0x3d3c,_0x468181=_0x456dd0();while(!![]){try{const _0x448c86=parseInt(_0x5d082f(0x142))/0x1*(-parseInt(_0x5d082f(0x145))/0x2)+-parseInt(_0x5d082f(0x11a))/0x3+parseInt(_0x5d082f(0x129))/0x4+-parseInt(_0x5d082f(0x148))/0x5*(-parseInt(_0x5d082f(0x14c))/0x6)+-parseInt(_0x5d082f(0x127))/0x7+parseInt(_0x5d082f(0x115))/0x8*(-parseInt(_0x5d082f(0x12c))/0x9)+parseInt(_0x5d082f(0x125))/0xa;if(_0x448c86===_0x19fcf9)break;else _0x468181['push'](_0x468181['shift']());}catch(_0x4ce1bb){_0x468181['push'](_0x468181['shift']());}}}(a243_0x4119,0x43e5b));function a243_0x4119(){const _0x196a3b=['\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','file','string',';\x20current\x20version\x20is\x20','\x20for\x20','number','Expected\x20','cookie','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.','app_rule_expected_version_invalid','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','content','app_rule_verification_failed','rules','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','str','push','2399DEZOYn','unconfigured','planned','88XGLTOP','appCode','expectedVersion','11945drfVfF','\x20--format\x20compress','type','before','1050xMzSEO','replacement','contentHash','trim','beforeRecord','version','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','2592536VtmQTN','UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','POST','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','rule','1525797zwnzqe','expected-version','The\x20set\x20request\x20was\x20sent,\x20but\x20','create','\x20version\x20changed\x20before\x20write.','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','byteSize','--file\x20is\x20required.','app_rule_set_outcome_unknown','flag','input','8533170SAElHG','rabetbase\x20rule\x20get\x20--type\x20','1518076OxJBMX','isSafeInteger','647220rgEhFh','Set\x20','update','9CvmZqO','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','DATABASE'];a243_0x4119=function(){return _0x196a3b;};return a243_0x4119();}import{knowledgeDocumentsPath}from'../../core/api-client.js';function a243_0x3d3c(_0x58f1d5,_0xed2b65){_0x58f1d5=_0x58f1d5-0x112;const _0x411923=a243_0x4119();let _0x3d3cfb=_0x411923[_0x58f1d5];return _0x3d3cfb;}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(_0x34d28a){const _0x23088a=a243_0x3d3c,_0x3d35f6=readAppRuleType(_0x34d28a),_0x53f610=_0x34d28a[_0x23088a(0x140)](_0x23088a(0x130))[_0x23088a(0x14f)]();if(!_0x53f610)throw appRuleError('app_rule_file_required',_0x23088a(0x121),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x43f723=_0x34d28a[_0x23088a(0x123)](_0x23088a(0x11b));let _0x4c171d;if(_0x43f723!==undefined){_0x4c171d=Number(_0x43f723);if(!Number[_0x23088a(0x128)](_0x4c171d)||_0x4c171d<0x0)throw appRuleError(_0x23088a(0x139),_0x23088a(0x12d));}return{'type':_0x3d35f6,'file':_0x53f610,'expectedVersion':_0x4c171d};}async function prepareSet(_0x30fa3e){const _0x591296=a243_0x3d3c,_0x283801=readSetInput(_0x30fa3e),_0x22f8b7=await readAppRuleFile(_0x283801[_0x591296(0x130)]);if(_0x283801[_0x591296(0x14a)]===_0x591296(0x13e)&&_0x22f8b7[_0x591296(0x13c)]['length']>0x7d0)throw appRuleError('app_rule_content_too_large',_0x591296(0x137));const _0x458f09=await getAppRule(_0x30fa3e[_0x591296(0x136)],{'appCode':_0x30fa3e[_0x591296(0x146)],'type':_0x283801[_0x591296(0x14a)]});if(_0x283801['expectedVersion']!==undefined&&(_0x458f09?.[_0x591296(0x113)]??0x0)!==_0x283801[_0x591296(0x147)])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x283801[_0x591296(0x14a)])+_0x591296(0x11e),_0x591296(0x135)+_0x283801[_0x591296(0x147)]+_0x591296(0x132)+(_0x458f09?.[_0x591296(0x113)]??_0x591296(0x143))+_0x591296(0x11f));return{'input':_0x283801,'replacement':_0x22f8b7,'beforeRecord':_0x458f09,'before':projectAppRule(_0x283801['type'],_0x458f09),'planned':{'type':_0x283801[_0x591296(0x14a)],'fileName':appRuleFileName(_0x283801[_0x591296(0x14a)]),'contextScope':appRuleContextScope(_0x283801[_0x591296(0x14a)]),'enabled':!![],'appCode':_0x30fa3e[_0x591296(0x146)],'scope':'rules','contentByteSize':_0x22f8b7[_0x591296(0x120)],'contentHash':_0x22f8b7[_0x591296(0x14e)]}};}function warningsFor(_0x37a4ea){return[];}export const ruleSet={'service':a243_0x3f3639(0x119),'command':'set','description':a243_0x3f3639(0x118),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x3f3639(0x130),'type':a243_0x3f3639(0x131),'required':!![],'description':a243_0x3f3639(0x116)},{'name':a243_0x3f3639(0x11b),'type':a243_0x3f3639(0x134),'required':![],'description':'Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set'}],async 'validate'(_0x41defa){readSetInput(_0x41defa);},async 'dryRun'(_0x1bc78c){const _0x4a515e=a243_0x3f3639,_0x486958=await prepareSet(_0x1bc78c);return asDryRunResult({'operation':'set','selector':{'appCode':_0x1bc78c[_0x4a515e(0x146)],'scope':'rules','type':_0x486958[_0x4a515e(0x124)][_0x4a515e(0x14a)]},'before':_0x486958[_0x4a515e(0x14b)],'after':_0x486958[_0x4a515e(0x144)],'dryRun':!![],'backend':{'method':_0x4a515e(0x117),'path':knowledgeDocumentsPath('rules',_0x486958[_0x4a515e(0x112)]?_0x4a515e(0x12b):_0x4a515e(0x11d)),'body':{'appCode':_0x1bc78c[_0x4a515e(0x146)],..._0x486958['beforeRecord']?{'id':_0x486958[_0x4a515e(0x112)]['id']}:{},'title':_0x486958[_0x4a515e(0x124)][_0x4a515e(0x14a)]===_0x4a515e(0x13e)?'RULES':_0x4a515e(0x12e),'contentHash':_0x486958['replacement'][_0x4a515e(0x14e)],'contentByteSize':_0x486958['replacement'][_0x4a515e(0x120)],..._0x486958['beforeRecord']?{'expectedVersion':_0x486958[_0x4a515e(0x112)][_0x4a515e(0x113)]}:{}}},'warnings':warningsFor(_0x486958[_0x4a515e(0x124)][_0x4a515e(0x147)]),'verification':{'expectedVersion':_0x486958[_0x4a515e(0x112)]?.[_0x4a515e(0x113)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x4a515e(0x126)+_0x486958[_0x4a515e(0x124)]['type']+_0x4a515e(0x149)}},{'method':'POST','url':knowledgeDocumentsPath(_0x4a515e(0x13e),_0x486958[_0x4a515e(0x112)]?_0x4a515e(0x12b):_0x4a515e(0x11d))});},async 'execute'(_0x37293a){const _0x29652c=a243_0x3f3639,_0x18e20a=await prepareSet(_0x37293a),_0x5e0335=_0x18e20a[_0x29652c(0x112)]===null?0x1:_0x18e20a[_0x29652c(0x112)][_0x29652c(0x113)]+(_0x18e20a[_0x29652c(0x112)][_0x29652c(0x13c)]===_0x18e20a['replacement']['content']?0x0:0x1);let _0x718a8e,_0x3fe441=![];try{_0x718a8e=await saveAppRule(_0x37293a[_0x29652c(0x136)],{'appCode':_0x37293a[_0x29652c(0x146)],'type':_0x18e20a['input'][_0x29652c(0x14a)],'content':_0x18e20a[_0x29652c(0x14d)][_0x29652c(0x13c)],'expectedVersion':_0x18e20a['beforeRecord']?.['version']??0x0,..._0x18e20a[_0x29652c(0x112)]?{'id':_0x18e20a[_0x29652c(0x112)]['id']}:{}});if(_0x718a8e[_0x29652c(0x113)]!==_0x5e0335||_0x718a8e['content']!==_0x18e20a[_0x29652c(0x14d)][_0x29652c(0x13c)]||_0x18e20a[_0x29652c(0x112)]!==null&&_0x718a8e['id']!==_0x18e20a[_0x29652c(0x112)]['id'])throw appRuleError(_0x29652c(0x13d),'The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.',_0x29652c(0x138));}catch(_0x3f4804){if(!isPlatformTransportFailure(_0x3f4804))throw _0x3f4804;_0x3fe441=!![];}let _0x1e18e0;try{_0x1e18e0=await getAppRule(_0x37293a[_0x29652c(0x136)],{'appCode':_0x37293a[_0x29652c(0x146)],'type':_0x18e20a[_0x29652c(0x124)][_0x29652c(0x14a)]});}catch(_0x1ac9bc){const _0xe7d65e=appRuleError(_0x3fe441?_0x29652c(0x122):'app_rule_verification_unavailable',_0x29652c(0x11c)+appRuleFileName(_0x18e20a[_0x29652c(0x124)][_0x29652c(0x14a)])+'\x20could\x20not\x20be\x20verified.',_0x29652c(0x13b));Object['defineProperty'](_0xe7d65e,'cause',{'value':_0x1ac9bc,'enumerable':![]});throw _0xe7d65e;}const _0x1d0c9a=_0x1e18e0&&inspectAppRuleContent(_0x1e18e0[_0x29652c(0x13c)])[_0x29652c(0x14e)]===_0x18e20a[_0x29652c(0x14d)][_0x29652c(0x14e)],_0x73c373=_0x1e18e0&&_0x1e18e0[_0x29652c(0x113)]===_0x5e0335&&(!_0x718a8e||_0x1e18e0['id']===_0x718a8e['id']&&_0x1e18e0[_0x29652c(0x113)]===_0x718a8e[_0x29652c(0x113)]);if(!_0x1e18e0||!_0x1d0c9a||!_0x73c373||_0x18e20a[_0x29652c(0x112)]!==null&&_0x1e18e0['id']!==_0x18e20a['beforeRecord']['id'])throw appRuleError(_0x3fe441?_0x29652c(0x122):'app_rule_verification_failed',appRuleFileName(_0x18e20a[_0x29652c(0x124)][_0x29652c(0x14a)])+_0x29652c(0x12f),_0x29652c(0x13a)+_0x18e20a[_0x29652c(0x124)]['type']+_0x29652c(0x114));const _0x42fa75=warningsFor(_0x18e20a['input'][_0x29652c(0x147)]);_0x3fe441&&_0x42fa75[_0x29652c(0x141)](_0x29652c(0x13f));const _0x46218e=projectAppRule(_0x18e20a[_0x29652c(0x124)][_0x29652c(0x14a)],_0x1e18e0);return{'ok':!![],'data':{'operation':'set','selector':{'appCode':_0x37293a[_0x29652c(0x146)],'scope':_0x29652c(0x13e),'type':_0x18e20a[_0x29652c(0x124)][_0x29652c(0x14a)]},'before':_0x18e20a[_0x29652c(0x14b)],'after':_0x46218e,'dryRun':![],'backend':{'method':'POST','path':knowledgeDocumentsPath(_0x29652c(0x13e),_0x18e20a[_0x29652c(0x112)]?_0x29652c(0x12b):_0x29652c(0x11d))},'warnings':_0x42fa75,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0x3fe441,'expectedVersion':_0x18e20a[_0x29652c(0x112)]?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x29652c(0x126)+_0x18e20a[_0x29652c(0x124)][_0x29652c(0x14a)]+'\x20--format\x20compress'}},'message':_0x29652c(0x12a)+appRuleFileName(_0x18e20a[_0x29652c(0x124)][_0x29652c(0x14a)])+_0x29652c(0x133)+_0x37293a[_0x29652c(0x146)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x3d4fe3=a244_0x8735;(function(_0x5b8359,_0x40172d){const _0x111fd2=a244_0x8735,_0x146c8c=_0x5b8359();while(!![]){try{const _0x58dbd0=-parseInt(_0x111fd2(0xd8))/0x1*(-parseInt(_0x111fd2(0xed))/0x2)+parseInt(_0x111fd2(0xd9))/0x3+parseInt(_0x111fd2(0xf2))/0x4*(parseInt(_0x111fd2(0xe0))/0x5)+parseInt(_0x111fd2(0xcd))/0x6+parseInt(_0x111fd2(0xf6))/0x7*(-parseInt(_0x111fd2(0xde))/0x8)+parseInt(_0x111fd2(0xce))/0x9*(-parseInt(_0x111fd2(0xf3))/0xa)+parseInt(_0x111fd2(0xe2))/0xb*(parseInt(_0x111fd2(0xeb))/0xc);if(_0x58dbd0===_0x40172d)break;else _0x146c8c['push'](_0x146c8c['shift']());}catch(_0x295f51){_0x146c8c['push'](_0x146c8c['shift']());}}}(a244_0x59d7,0x71805));function a244_0x8735(_0x4f31ae,_0x1712e8){_0x4f31ae=_0x4f31ae-0xc7;const _0x59d7f3=a244_0x59d7();let _0x8735aa=_0x59d7f3[_0x4f31ae];return _0x8735aa;}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_0x3d4fe3(0xcb),a244_0x3d4fe3(0xf0)];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':a244_0x3d4fe3(0xcf),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x3d4fe3(0xe9),'database':a244_0x3d4fe3(0xd1)};function a244_0x59d7(){const _0x16d24b=['653986frFeia','string','indexStatus','database','hex','533164HgVEJU','540490GbubMc','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','str','1082291BEeDav','app_rule_content_invalid','createTime','utf8','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','app_rule_content_too_large','toLowerCase','updateTime','sha256','update','rules','utf-8','794958NUgEYI','135sRAinO','RULES.md','appCode','database-analysis','App\x20rule\x20file\x20is\x20blank:\x20','length','app_rule_file_unreadable','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','app_rule_type_invalid','1Rgdqwj','402330qUcaeB','decode','byteLength','contentHash','--file\x20is\x20required.','8VhNvjH','message','10QyfArK','byteSize','11BRGRxL','type','sha256:','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','digest','scope','trim','page-api-development','size','6840852CkHVCk','version'];a244_0x59d7=function(){return _0x16d24b;};return a244_0x59d7();}export function appRuleError(_0x2c8b0a,_0x37482c,_0x59d9f4){return new CliError(_0x2c8b0a,0x1,_0x37482c,_0x59d9f4);}export function readAppRuleType(_0x500071){const _0x168d3b=a244_0x3d4fe3,_0x7bc338=_0x500071[_0x168d3b(0xf5)]('type')[_0x168d3b(0xe8)]()[_0x168d3b(0xc7)]();if(_0x7bc338!==_0x168d3b(0xcb)&&_0x7bc338!==_0x168d3b(0xf0))throw appRuleError(_0x168d3b(0xd7),_0x168d3b(0xe5));return _0x7bc338;}export function appRuleFileName(_0x3bb6fa){return APP_RULE_FILES[_0x3bb6fa];}export function appRuleContextScope(_0x5b0f32){return APP_RULE_CONTEXT_SCOPES[_0x5b0f32];}export function inspectAppRuleContent(_0x59172c){const _0x37f576=a244_0x3d4fe3,_0x3d1c79=Buffer['from'](_0x59172c,_0x37f576(0xf9));return{'content':_0x59172c,'byteSize':_0x3d1c79[_0x37f576(0xdb)],'contentHash':_0x37f576(0xe4)+createHash(_0x37f576(0xc9))[_0x37f576(0xca)](_0x3d1c79)[_0x37f576(0xe6)](_0x37f576(0xf1))};}export async function readAppRuleFile(_0x5de938){const _0x1c1231=a244_0x3d4fe3,_0x338e08=_0x5de938[_0x1c1231(0xe8)]();if(!_0x338e08)throw appRuleError('app_rule_file_required',_0x1c1231(0xdd),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x396773=resolve(_0x338e08);let _0x115795;try{_0x115795=await stat(_0x396773);}catch(_0x54d22d){throw appRuleError(_0x1c1231(0xd4),'Cannot\x20access\x20app\x20rule\x20file:\x20'+_0x338e08,_0x54d22d instanceof Error?_0x54d22d[_0x1c1231(0xdf)]:String(_0x54d22d));}if(!_0x115795['isFile']())throw appRuleError('app_rule_file_invalid',_0x1c1231(0xd6)+_0x338e08);if(_0x115795[_0x1c1231(0xea)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1c1231(0xfb),'App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.');let _0x3343ba;try{_0x3343ba=await readFile(_0x396773);}catch(_0x12cb19){throw appRuleError(_0x1c1231(0xd4),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x338e08,_0x12cb19 instanceof Error?_0x12cb19[_0x1c1231(0xdf)]:String(_0x12cb19));}if(_0x3343ba['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x1c1231(0xfb),_0x1c1231(0xfa));let _0x5c1abd;try{_0x5c1abd=new TextDecoder(_0x1c1231(0xcc),{'fatal':!![],'ignoreBOM':!![]})[_0x1c1231(0xda)](_0x3343ba);}catch{throw appRuleError(_0x1c1231(0xf7),_0x1c1231(0xd5)+_0x338e08);}if(_0x5c1abd[_0x1c1231(0xd3)]>MAX_APP_RULE_UNITS)throw appRuleError(_0x1c1231(0xfb),_0x1c1231(0xf4));if(!_0x5c1abd[_0x1c1231(0xe8)]())throw appRuleError('app_rule_content_invalid',_0x1c1231(0xd2)+_0x338e08);return inspectAppRuleContent(_0x5c1abd);}export function projectAppRule(_0x4179b7,_0x50d91e){const _0x246246=a244_0x3d4fe3;if(!_0x50d91e)return{'type':_0x4179b7,'fileName':appRuleFileName(_0x4179b7),'contextScope':appRuleContextScope(_0x4179b7),'enabled':![]};const _0x2d72d4=inspectAppRuleContent(_0x50d91e['content']);return{'type':_0x4179b7,'fileName':appRuleFileName(_0x4179b7),'contextScope':appRuleContextScope(_0x4179b7),'enabled':!![],'id':_0x50d91e['id'],'scope':_0x50d91e[_0x246246(0xe7)],'appCode':_0x50d91e[_0x246246(0xd0)],'version':_0x50d91e[_0x246246(0xec)],..._0x50d91e['indexStatus']!==undefined?{'indexStatus':_0x50d91e[_0x246246(0xef)]}:{},'contentByteSize':_0x2d72d4[_0x246246(0xe1)],'contentHash':_0x2d72d4[_0x246246(0xdc)],..._0x50d91e[_0x246246(0xf8)]!==undefined&&_0x50d91e['createTime']!==null?{'createTime':_0x50d91e[_0x246246(0xf8)]}:{},..._0x50d91e[_0x246246(0xc8)]!==undefined&&_0x50d91e[_0x246246(0xc8)]!==null?{'updateTime':_0x50d91e[_0x246246(0xc8)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x3d4fe3(0xe3),'type':a244_0x3d4fe3(0xee),'required':!![],'description':'Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a245_0x19ec(_0x459ab9,_0x33298c){_0x459ab9=_0x459ab9-0x15b;const _0x518ac5=a245_0x518a();let _0x19ec5a=_0x518ac5[_0x459ab9];return _0x19ec5a;}const a245_0x517c89=a245_0x19ec;(function(_0xb681e0,_0x1f8a97){const _0x41bf5c=a245_0x19ec,_0x51e0b7=_0xb681e0();while(!![]){try{const _0x5e0dc7=-parseInt(_0x41bf5c(0x197))/0x1+-parseInt(_0x41bf5c(0x18c))/0x2+parseInt(_0x41bf5c(0x191))/0x3*(-parseInt(_0x41bf5c(0x18b))/0x4)+-parseInt(_0x41bf5c(0x176))/0x5+-parseInt(_0x41bf5c(0x193))/0x6+parseInt(_0x41bf5c(0x18d))/0x7*(parseInt(_0x41bf5c(0x18a))/0x8)+parseInt(_0x41bf5c(0x188))/0x9*(parseInt(_0x41bf5c(0x181))/0xa);if(_0x5e0dc7===_0x1f8a97)break;else _0x51e0b7['push'](_0x51e0b7['shift']());}catch(_0x4df994){_0x51e0b7['push'](_0x51e0b7['shift']());}}}(a245_0x518a,0x350f8));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x517c89(0x19c),'dev']),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x517c89(0x19c),'dev',a245_0x517c89(0x172),'preview']);export function syncProjectDomainRoutingBeforeScript(_0x63ff05,_0xb1e2f4){const _0x2fffad=a245_0x517c89;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0xb1e2f4))return null;const _0x518ba3=findProjectRootDirectory(_0x63ff05);if(!resolveConfigPath(_0x518ba3))return null;const _0x58d5c4=writeProjectDomainRoutingManifest(_0x518ba3);return{'path':_0x58d5c4[_0x2fffad(0x16c)],'changed':_0x58d5c4[_0x2fffad(0x16d)]};}function readPackageScripts(_0x3327af){const _0x432092=a245_0x517c89,_0x1e5d2e=resolve(_0x3327af,_0x432092(0x15d));if(!existsSync(_0x1e5d2e))return null;try{const _0x20ac76=JSON[_0x432092(0x195)](readFileSync(_0x1e5d2e,_0x432092(0x19f)));return _0x20ac76[_0x432092(0x179)]??{};}catch{return null;}}function detectPackageManager(_0x105ec4){const _0x480bd9=a245_0x517c89;if(existsSync(resolve(_0x105ec4,_0x480bd9(0x17c)))||existsSync(resolve(_0x105ec4,_0x480bd9(0x17d))))return _0x480bd9(0x185);if(existsSync(resolve(_0x105ec4,_0x480bd9(0x167))))return'pnpm';if(existsSync(resolve(_0x105ec4,_0x480bd9(0x199))))return _0x480bd9(0x17f);return _0x480bd9(0x19a);}async function versionCheck(_0x2b273a){const _0x2ba757=a245_0x517c89,_0x2673ea=await checkCliVersion();(_0x2673ea['needsUpgrade']||_0x2673ea[_0x2ba757(0x15e)])&&(printCliUpgradeWarning(_0x2673ea),assertCliVersionSupported(_0x2673ea));const _0x39085d=await checkSdkVersion(_0x2b273a);if(_0x39085d[_0x2ba757(0x16e)])printSdkUpgradeWarning(_0x39085d);}function spawnScript(_0x15e656,_0x5127bc,_0x4e7f76,_0xd24219){return new Promise((_0x1ff958,_0x20851a)=>{const _0x2b0236=a245_0x19ec,_0x3131e1=[_0x2b0236(0x18e),_0x5127bc,..._0x4e7f76],_0xd78585=spawn(_0x15e656,_0x3131e1,{'cwd':_0xd24219,'stdio':_0x2b0236(0x183),'shell':!![],'env':{...process.env,'PATH':''+join(_0xd24219,_0x2b0236(0x164),'.bin')+delimiter+process.env.PATH}});_0xd78585['on'](_0x2b0236(0x19e),_0x103e0b=>{const _0x1aafcf=_0x2b0236;if(_0x103e0b===0x0||_0x103e0b===null)_0x1ff958();else _0x20851a(new Error(_0x15e656+_0x1aafcf(0x171)+_0x5127bc+'\x20exited\x20with\x20code\x20'+_0x103e0b));}),_0xd78585['on'](_0x2b0236(0x173),_0x20851a);});}function spawnViteBuildWatch(_0x34b9ac){return new Promise((_0x11d18b,_0x166b23)=>{const _0x5ca0a7=a245_0x19ec,_0x14a6ea=spawn(_0x5ca0a7(0x168),[_0x5ca0a7(0x172),_0x5ca0a7(0x190)],{'cwd':_0x34b9ac,'stdio':_0x5ca0a7(0x183),'shell':!![],'env':{...process.env,'PATH':''+join(_0x34b9ac,_0x5ca0a7(0x164),_0x5ca0a7(0x18f))+delimiter+process.env.PATH}});_0x14a6ea['on'](_0x5ca0a7(0x19e),_0x7b7496=>{const _0x361653=_0x5ca0a7;if(_0x7b7496===0x0||_0x7b7496===null)_0x11d18b();else _0x166b23(new Error(_0x361653(0x19b)+_0x7b7496));}),_0x14a6ea['on'](_0x5ca0a7(0x173),_0x166b23);});}function spawnVitePreview(_0x4e3d04){return new Promise((_0x1562ec,_0x2e625a)=>{const _0x1ca6f7=a245_0x19ec,_0x558450=spawn(_0x1ca6f7(0x168),[_0x1ca6f7(0x163)],{'cwd':_0x4e3d04,'stdio':_0x1ca6f7(0x183),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4e3d04,_0x1ca6f7(0x164),_0x1ca6f7(0x18f))+delimiter+process.env.PATH}});_0x558450['on'](_0x1ca6f7(0x19e),_0x2bd7f0=>{const _0x256668=_0x1ca6f7;if(_0x2bd7f0===0x0||_0x2bd7f0===null)_0x1562ec();else _0x2e625a(new Error(_0x256668(0x174)+_0x2bd7f0));}),_0x558450['on'](_0x1ca6f7(0x173),_0x2e625a);});}const runFlags=[{'name':a245_0x517c89(0x17e),'type':a245_0x517c89(0x162),'description':a245_0x517c89(0x16a),'default':![]}];export const runDefinition={'service':a245_0x517c89(0x18e),'command':a245_0x517c89(0x18e),'description':a245_0x517c89(0x196),'risk':a245_0x517c89(0x186),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x517c89(0x182),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x8b90fa=a245_0x517c89,_0x394de5=[];return _0x394de5[_0x8b90fa(0x194)](_0x8b90fa(0x198)),_0x394de5[_0x8b90fa(0x194)](_0x8b90fa(0x161)+CLI_BIN_NAME+_0x8b90fa(0x189)),_0x394de5[_0x8b90fa(0x194)](_0x8b90fa(0x161)+CLI_BIN_NAME+_0x8b90fa(0x170)),_0x394de5[_0x8b90fa(0x194)](_0x8b90fa(0x161)+CLI_BIN_NAME+_0x8b90fa(0x169)),_0x394de5['push'](_0x8b90fa(0x161)+CLI_BIN_NAME+_0x8b90fa(0x19d)),_0x394de5[_0x8b90fa(0x17b)]('\x0a');},async 'execute'(_0x1ce304){const _0x45cdd7=a245_0x517c89,_0x4e5a97=process[_0x45cdd7(0x175)](),_0x2fb32d=_0x1ce304[_0x45cdd7(0x178)][0x0],_0x554550=_0x1ce304[_0x45cdd7(0x178)]['slice'](0x1),_0x58be1b=readPackageScripts(_0x4e5a97);if(!_0x58be1b)throw CliErrors[_0x45cdd7(0x165)](_0x45cdd7(0x16b));if(!_0x2fb32d){const _0x5b3f8b=Object['keys'](_0x58be1b);if(_0x5b3f8b[_0x45cdd7(0x15b)]===0x0)console[_0x45cdd7(0x166)](_0x45cdd7(0x177));else{console[_0x45cdd7(0x166)](_0x45cdd7(0x16f));for(const _0x2ee6df of _0x5b3f8b){console[_0x45cdd7(0x166)](_0x45cdd7(0x161)+_0x2ee6df);}console[_0x45cdd7(0x166)](_0x45cdd7(0x160)+CLI_BIN_NAME+_0x45cdd7(0x187));}return{'ok':!![]};}if(!_0x58be1b[_0x2fb32d])throw CliErrors[_0x45cdd7(0x165)](_0x45cdd7(0x17a)+_0x2fb32d+_0x45cdd7(0x180),_0x45cdd7(0x184)+(Object[_0x45cdd7(0x15f)](_0x58be1b)[_0x45cdd7(0x17b)](',\x20')||'(none)'));const _0x112386=detectPackageManager(_0x4e5a97),_0x498b2f=syncProjectDomainRoutingBeforeScript(_0x4e5a97,_0x2fb32d);_0x498b2f?.[_0x45cdd7(0x16d)]&&console['error']('Domain\x20routing\x20synchronized:\x20'+_0x498b2f[_0x45cdd7(0x16c)]);VERSION_CHECK_SCRIPTS['has'](_0x2fb32d)&&await versionCheck(_0x4e5a97);if(_0x2fb32d===_0x45cdd7(0x163)&&_0x1ce304[_0x45cdd7(0x15c)](_0x45cdd7(0x17e)))return await Promise[_0x45cdd7(0x192)]([spawnViteBuildWatch(_0x4e5a97),spawnVitePreview(_0x4e5a97)]),{'ok':!![]};return await spawnScript(_0x112386,_0x2fb32d,_0x554550,_0x4e5a97),{'ok':!![]};}};function a245_0x518a(){const _0x379553=['utf-8','length','bool','package.json','belowMinimum','keys','\x0a\x20\x20Usage:\x20','\x20\x20\x20\x20','boolean','preview','node_modules','validation','log','pnpm-lock.yaml','vite','\x20run\x20preview','Enable\x20watch\x20mode\x20for\x20preview','No\x20package.json\x20found\x20in\x20current\x20directory.','path','changed','needsUpgrade','\x0a\x20\x20Available\x20scripts:\x0a','\x20run\x20build','\x20run\x20','build','error','vite\x20preview\x20exited\x20with\x20code\x20','cwd','2080090KWFpCD','No\x20scripts\x20defined\x20in\x20package.json.','args','scripts','Script\x20\x22','join','bun.lockb','bun.lock','watch','yarn','\x22\x20not\x20found\x20in\x20package.json.','280LuNSJO','script','inherit','Available:\x20','bun','write','\x20run\x20<script>\x0a','348363IrZbzO','\x20run\x20start','264lCeBWZ','20kDNhkb','482926qrgivn','79464djNnfW','run','.bin','--watch','209037gAbcXA','all','373368OllDPw','push','parse','Run\x20a\x20package.json\x20script','172972toSnkN','\x20\x20EXAMPLES','yarn.lock','npm','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','start','\x20run\x20preview\x20--watch','close'];a245_0x518a=function(){return _0x379553;};return a245_0x518a();}
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x3caf3d=a246_0x39e7;function a246_0x2591(){const _0x1326c9=['4509603vLiViO','6101809jGeehq','1578EiWhXk','8DTyIIc','read','36NHALOG','915920WBvgwY','schema','export','36790zumsLX','187uINyJV','190131FibaCD','json','3023rdncnk','5529927tVnumC','438xEtdmT','84KtaWIv'];a246_0x2591=function(){return _0x1326c9;};return a246_0x2591();}(function(_0x3253c8,_0x463b7d){const _0xfc726b=a246_0x39e7,_0x4b1cce=_0x3253c8();while(!![]){try{const _0x15c375=-parseInt(_0xfc726b(0xbf))/0x1*(-parseInt(_0xfc726b(0xb0))/0x2)+-parseInt(_0xfc726b(0xbd))/0x3*(parseInt(_0xfc726b(0xb7))/0x4)+-parseInt(_0xfc726b(0xbb))/0x5*(-parseInt(_0xfc726b(0xb4))/0x6)+parseInt(_0xfc726b(0xb3))/0x7+parseInt(_0xfc726b(0xb5))/0x8*(-parseInt(_0xfc726b(0xb2))/0x9)+-parseInt(_0xfc726b(0xb8))/0xa*(-parseInt(_0xfc726b(0xbc))/0xb)+-parseInt(_0xfc726b(0xb1))/0xc*(parseInt(_0xfc726b(0xaf))/0xd);if(_0x15c375===_0x463b7d)break;else _0x4b1cce['push'](_0x4b1cce['shift']());}catch(_0x48947c){_0x4b1cce['push'](_0x4b1cce['shift']());}}}(a246_0x2591,0xee7bd));import{buildSchemaPayload}from'../framework/schema-export.js';function a246_0x39e7(_0x208a16,_0x8da7c2){_0x208a16=_0x208a16-0xaf;const _0x2591d0=a246_0x2591();let _0x39e75c=_0x2591d0[_0x208a16];return _0x39e75c;}async function execute(_0x114725){const _0x119d6d=await buildSchemaPayload();return{'ok':!![],'data':_0x119d6d};}export const schemaDefinition={'service':a246_0x3caf3d(0xb9),'command':a246_0x3caf3d(0xba),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a246_0x3caf3d(0xb6),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a246_0x3caf3d(0xbe),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a247_0x3eb7e4=a247_0x40f4;(function(_0x302020,_0x5f3841){const _0x3604d4=a247_0x40f4,_0x283970=_0x302020();while(!![]){try{const _0x4c07bb=-parseInt(_0x3604d4(0x1a7))/0x1+parseInt(_0x3604d4(0x1bf))/0x2*(parseInt(_0x3604d4(0x19b))/0x3)+parseInt(_0x3604d4(0x1d2))/0x4*(parseInt(_0x3604d4(0x196))/0x5)+parseInt(_0x3604d4(0x1c5))/0x6+parseInt(_0x3604d4(0x1b1))/0x7*(-parseInt(_0x3604d4(0x1ad))/0x8)+parseInt(_0x3604d4(0x1c0))/0x9+-parseInt(_0x3604d4(0x1b9))/0xa;if(_0x4c07bb===_0x5f3841)break;else _0x283970['push'](_0x283970['shift']());}catch(_0x25e9c2){_0x283970['push'](_0x283970['shift']());}}}(a247_0x165c,0x8b60e));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a247_0x165c(){const _0x411d8e=['SQL\x20name:','sqlRootDir','join','mybatisXml','</select>','flagMissing','213484FOwEaO','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','number','isInteger','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','string','30DvfzhG','lockFilePath','sql','SQL\x20name\x20cannot\x20be\x20empty','toISOString','158511BszgHl','trim','dbId\x20must\x20be\x20a\x20positive\x20integer','nonInteractive','stringify','Select\x20the\x20local\x20SQL\x20mode:','<server-generated-sqlCode>','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Plain\x20SQL\x20(sql)','map','utf8','dbName','614608GwqwrT','validation','Select\x20the\x20target\x20database:','sqlName','description','str','138536cXQAaC','__manual__','flag','Local\x20SQL\x20file\x20mode','84tXpAfn','length','catch','new','File\x20already\x20exists:\x20','SELECT\x201\x20AS\x20id;','dbId\x20cannot\x20be\x20empty','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','5336250GkLBpu','create','sqls','name','Created\x20SQL\x20query\x20','/smartapi/custom/saveUserCustomSql','26XjnJGb','1794303LWdFQd','appCode','db-id','isFinite','write','4322742POKezn','mode','Target\x20database\x20dbId:','sqlCode','parse','Invalid\x20database\x20selection\x20payload:\x20','dbId'];a247_0x165c=function(){return _0x411d8e;};return a247_0x165c();}function generateSqlTemplate(_0x376681){const _0x1cdbaf=a247_0x40f4;if(_0x376681===_0x1cdbaf(0x1cf))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id',_0x1cdbaf(0x1d0),''][_0x1cdbaf(0x1ce)]('\x0a');return[_0x1cdbaf(0x1b6),'']['join']('\x0a');}export const sqlCreate={'service':'sql','command':a247_0x3eb7e4(0x1ba),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a247_0x3eb7e4(0x1c4),'flags':[{'name':a247_0x3eb7e4(0x1bc),'type':a247_0x3eb7e4(0x195),'description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':'number','description':'Target\x20database\x20ID'},{'name':a247_0x3eb7e4(0x1c6),'type':a247_0x3eb7e4(0x195),'enum':[a247_0x3eb7e4(0x198),a247_0x3eb7e4(0x1cf)],'description':a247_0x3eb7e4(0x1b0)}],async 'validate'(_0x3ada23){const _0x2c225e=a247_0x3eb7e4;if(!_0x3ada23[_0x2c225e(0x19e)])return;if(!_0x3ada23[_0x2c225e(0x1ac)](_0x2c225e(0x1bc))[_0x2c225e(0x19c)]())throw CliErrors['flagMissing'](_0x2c225e(0x1bc),_0x2c225e(0x194));const _0x56223b=resolveProvidedDbId(_0x3ada23);if(typeof _0x56223b!==_0x2c225e(0x192)||!Number['isFinite'](_0x56223b)||_0x56223b<=0x0)throw CliErrors['flagMissing'](_0x2c225e(0x1c2),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x3ada23[_0x2c225e(0x1ac)](_0x2c225e(0x1c6))[_0x2c225e(0x19c)]())throw CliErrors[_0x2c225e(0x1d1)](_0x2c225e(0x1c6),_0x2c225e(0x1b8));},async 'dryRun'(_0x244e8c){const _0x5f252c=a247_0x3eb7e4,_0x2fd121=loadSqlProjectConfig(_0x244e8c[_0x5f252c(0x1c1)]),{sqlName:_0x4738ef,dbId:_0x2bee5e,dbName:_0x5b40b7,mode:_0x1ef672}=await resolveSqlNewInputs(_0x244e8c),_0x599757=buildSqlRelativePath(_0x5f252c(0x1a1),_0x4738ef,_0x5b40b7,_0x1ef672,_0x2bee5e),_0x432f52=_0x2fd121[_0x5f252c(0x1cd)]+'/'+_0x599757;return{'method':'POST','url':_0x5f252c(0x1be),'body':{'appCode':_0x244e8c[_0x5f252c(0x1c1)],'sqlName':_0x4738ef,'dbId':_0x2bee5e,'mode':_0x1ef672,'localPath':_0x432f52},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x2fd121[_0x5f252c(0x1cd)]};},async 'execute'(_0x501e7b){const _0x2d8704=a247_0x3eb7e4,_0xb95c7f=loadSqlProjectConfig(_0x501e7b[_0x2d8704(0x1c1)]),{sqlName:_0x44bdae,dbId:_0x3dab7d,dbName:_0x7bba24,mode:_0x412a70}=await resolveSqlNewInputs(_0x501e7b),_0xd2781a=generateSqlTemplate(_0x412a70),_0x2d2284=await createSqlQuery({'appCode':_0x501e7b[_0x2d8704(0x1c1)],'sqlName':_0x44bdae,'dbId':_0x3dab7d,'sqlContent':_0xd2781a}),_0x261523=ensureRemoteSqlContent(_0x2d2284),_0x36dac0=_0x7bba24||await getDbName(_0x501e7b[_0x2d8704(0x1c1)],_0x3dab7d)['catch'](()=>undefined),_0x2b821e=buildSqlRelativePath(_0x2d2284[_0x2d8704(0x1c8)],_0x2d2284[_0x2d8704(0x1aa)],_0x36dac0,_0x412a70,_0x3dab7d),_0x731e59=_0xb95c7f['sqlRootDir']+'/'+_0x2b821e,_0x4c3512=buildLocalSqlFileContent({'sqlCode':_0x2d2284[_0x2d8704(0x1c8)],'sqlName':_0x2d2284[_0x2d8704(0x1aa)],'dbId':_0x2d2284[_0x2d8704(0x1cb)]},_0x261523,{'dbName':_0x36dac0,'mode':_0x412a70,'syncedAt':new Date()[_0x2d8704(0x19a)](),'description':_0x2d2284[_0x2d8704(0x1ab)]});if(await fileExists(_0x731e59))throw CliErrors[_0x2d8704(0x1a8)](_0x2d8704(0x1b5)+_0x731e59);await ensureParentDirectory(_0x731e59),await writeFile(_0x731e59,_0x4c3512,_0x2d8704(0x1a5));const _0x3febbc=await readSqlLockFile(_0xb95c7f[_0x2d8704(0x197)]),{lockData:_0x3a116e,appLock:_0x24ee2f}=ensureSqlLockScope(_0x3febbc??createEmptySqlLock(),_0xb95c7f[_0x2d8704(0x1c1)],_0xb95c7f['sqlRoot'],_0x2d8704(0x1b4));return _0x24ee2f[_0x2d8704(0x1bb)][_0x2d2284['sqlCode']]={...buildSqlLockEntry(_0x2d2284,_0x261523,computeSqlContentHash(_0x4c3512),{'dbName':_0x36dac0}),'path':_0x2b821e,'mode':_0x412a70},_0x24ee2f['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xb95c7f[_0x2d8704(0x197)],_0x3a116e),{'ok':!![],'data':{'id':_0x2d2284['id'],'sqlCode':_0x2d2284[_0x2d8704(0x1c8)],'sqlName':_0x2d2284[_0x2d8704(0x1aa)],'dbId':_0x2d2284[_0x2d8704(0x1cb)],'path':_0x731e59,'mode':_0x412a70},'message':_0x2d8704(0x1bd)+_0x2d2284[_0x2d8704(0x1c8)]};}};async function resolveSqlNewInputs(_0x4800f6){const _0x1e94ca=await resolveSqlNameInput(_0x4800f6),{dbId:_0x27d286,dbName:_0x4d0493}=await resolveDbSelection(_0x4800f6),_0x25376b=await resolveSqlModeInput(_0x4800f6);return{'sqlName':_0x1e94ca,'dbId':_0x27d286,'dbName':_0x4d0493,'mode':_0x25376b};}async function resolveSqlNameInput(_0x59d65e){const _0x4977cc=a247_0x3eb7e4,_0x1fe493=_0x59d65e[_0x4977cc(0x1ac)](_0x4977cc(0x1bc))[_0x4977cc(0x19c)]();if(_0x1fe493)return _0x1fe493;if(_0x59d65e['nonInteractive'])throw CliErrors['flagMissing']('name',_0x4977cc(0x194));return(await input({'message':_0x4977cc(0x1cc),'validate':_0x11fb30=>_0x11fb30[_0x4977cc(0x19c)]()?!![]:_0x4977cc(0x199)}))[_0x4977cc(0x19c)]();}async function resolveDbSelection(_0x4e2bc6){const _0x2b2715=a247_0x3eb7e4,_0xb40d06=resolveProvidedDbId(_0x4e2bc6);if(typeof _0xb40d06===_0x2b2715(0x192)&&Number[_0x2b2715(0x1c3)](_0xb40d06)&&_0xb40d06>0x0)return{'dbId':_0xb40d06,'dbName':await getDbName(_0x4e2bc6[_0x2b2715(0x1c1)],_0xb40d06)[_0x2b2715(0x1b3)](()=>undefined)};if(_0x4e2bc6[_0x2b2715(0x19e)])throw CliErrors[_0x2b2715(0x1d1)]('db-id',_0x2b2715(0x1a2));const _0x13ed55=await listDatabases(_0x4e2bc6[_0x2b2715(0x1c1)])[_0x2b2715(0x1b3)](()=>[]);if(_0x13ed55[_0x2b2715(0x1b2)]===0x1)return{'dbId':_0x13ed55[0x0][_0x2b2715(0x1cb)],'dbName':_0x13ed55[0x0]['dbName']};if(_0x13ed55[_0x2b2715(0x1b2)]>0x1){const _0x3b785c=await select({'message':_0x2b2715(0x1a9),'choices':[..._0x13ed55[_0x2b2715(0x1a4)](_0x12d19d=>({'name':_0x12d19d[_0x2b2715(0x1a6)]+'\x20('+_0x12d19d['dbId']+')','value':serializeDbSelection(_0x12d19d)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x2b2715(0x1ae)}]});if(_0x3b785c!==_0x2b2715(0x1ae))return deserializeDbSelection(_0x3b785c);}const _0x17ff91=await input({'message':_0x2b2715(0x1c7),'validate':_0x1ede53=>{const _0x28a30d=_0x2b2715,_0xe804e=_0x1ede53[_0x28a30d(0x19c)]();if(!_0xe804e)return _0x28a30d(0x1b7);const _0x1d7d0d=Number(_0xe804e);if(!Number[_0x28a30d(0x193)](_0x1d7d0d)||_0x1d7d0d<=0x0)return _0x28a30d(0x19d);return!![];}});return{'dbId':Number(_0x17ff91[_0x2b2715(0x19c)]())};}async function resolveSqlModeInput(_0x495d84){const _0x570ab0=a247_0x3eb7e4,_0xee67be=_0x495d84[_0x570ab0(0x1ac)](_0x570ab0(0x1c6))[_0x570ab0(0x19c)]();if(_0xee67be==='sql'||_0xee67be===_0x570ab0(0x1cf))return _0xee67be;if(_0x495d84[_0x570ab0(0x19e)])throw CliErrors[_0x570ab0(0x1d1)](_0x570ab0(0x1c6),_0x570ab0(0x1b8));return await select({'message':_0x570ab0(0x1a0),'choices':[{'name':_0x570ab0(0x1a3),'value':_0x570ab0(0x198),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x570ab0(0x1cf),'description':_0x570ab0(0x191)}]});}function a247_0x40f4(_0x47c5ff,_0x4cfaee){_0x47c5ff=_0x47c5ff-0x191;const _0x165c5f=a247_0x165c();let _0x40f40f=_0x165c5f[_0x47c5ff];return _0x40f40f;}function serializeDbSelection(_0x3df7f0){const _0xfcd255=a247_0x3eb7e4;return JSON[_0xfcd255(0x19f)]({'dbId':_0x3df7f0[_0xfcd255(0x1cb)],'dbName':_0x3df7f0[_0xfcd255(0x1a6)]});}function deserializeDbSelection(_0xf69d10){const _0x3a2bc0=a247_0x3eb7e4;try{const _0x523796=JSON[_0x3a2bc0(0x1c9)](_0xf69d10);if(typeof _0x523796['dbId']==='number'&&Number[_0x3a2bc0(0x1c3)](_0x523796[_0x3a2bc0(0x1cb)]))return{'dbId':_0x523796[_0x3a2bc0(0x1cb)],'dbName':_0x523796[_0x3a2bc0(0x1a6)]};}catch{}throw CliErrors[_0x3a2bc0(0x1a8)](_0x3a2bc0(0x1ca)+_0xf69d10);}function resolveProvidedDbId(_0x1e669d){const _0x13c028=a247_0x3eb7e4,_0x22b0b4=_0x1e669d[_0x13c028(0x1af)](_0x13c028(0x1c2));if(typeof _0x22b0b4===_0x13c028(0x192)&&Number[_0x13c028(0x1c3)](_0x22b0b4))return _0x22b0b4;return undefined;}
|
|
1
|
+
const a247_0x50deb8=a247_0x57ab;(function(_0x1cc1ce,_0x3f9d72){const _0x3a078d=a247_0x57ab,_0x43cd9e=_0x1cc1ce();while(!![]){try{const _0x4fd928=parseInt(_0x3a078d(0x89))/0x1*(-parseInt(_0x3a078d(0xa4))/0x2)+-parseInt(_0x3a078d(0xa8))/0x3*(parseInt(_0x3a078d(0x96))/0x4)+parseInt(_0x3a078d(0x98))/0x5*(-parseInt(_0x3a078d(0xb2))/0x6)+parseInt(_0x3a078d(0xa0))/0x7*(parseInt(_0x3a078d(0x82))/0x8)+parseInt(_0x3a078d(0xb0))/0x9*(-parseInt(_0x3a078d(0x9b))/0xa)+-parseInt(_0x3a078d(0x83))/0xb*(parseInt(_0x3a078d(0xb1))/0xc)+parseInt(_0x3a078d(0xb7))/0xd;if(_0x4fd928===_0x3f9d72)break;else _0x43cd9e['push'](_0x43cd9e['shift']());}catch(_0x5a2c10){_0x43cd9e['push'](_0x43cd9e['shift']());}}}(a247_0x33cd,0x4252c));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_0x57ab(_0x482910,_0x4b5e72){_0x482910=_0x482910-0x7e;const _0x33cd47=a247_0x33cd();let _0x57ab4d=_0x33cd47[_0x482910];return _0x57ab4d;}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(_0x1f15d3){const _0x30a9a9=a247_0x57ab;if(_0x1f15d3==='mybatisXml')return[_0x30a9a9(0x97),_0x30a9a9(0x88),_0x30a9a9(0xb8),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}export const sqlCreate={'service':a247_0x50deb8(0xaa),'command':'create','description':a247_0x50deb8(0x9e),'risk':a247_0x50deb8(0xb4),'flags':[{'name':'name','type':a247_0x50deb8(0x8f),'description':a247_0x50deb8(0x7e)},{'name':a247_0x50deb8(0xb5),'type':a247_0x50deb8(0xba),'description':a247_0x50deb8(0xac)},{'name':a247_0x50deb8(0xb3),'type':a247_0x50deb8(0x8f),'enum':['sql','mybatisXml'],'description':a247_0x50deb8(0x87)}],async 'validate'(_0x2663ff){const _0x40f39e=a247_0x50deb8;if(!_0x2663ff['nonInteractive'])return;if(!_0x2663ff['str'](_0x40f39e(0xc1))[_0x40f39e(0x9c)]())throw CliErrors[_0x40f39e(0x80)](_0x40f39e(0xc1),_0x40f39e(0x94));const _0x5cc4ad=resolveProvidedDbId(_0x2663ff);if(typeof _0x5cc4ad!==_0x40f39e(0xba)||!Number[_0x40f39e(0xa6)](_0x5cc4ad)||_0x5cc4ad<=0x0)throw CliErrors[_0x40f39e(0x80)](_0x40f39e(0xb5),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x2663ff[_0x40f39e(0xaf)]('mode')[_0x40f39e(0x9c)]())throw CliErrors['flagMissing'](_0x40f39e(0xb3),_0x40f39e(0xbb));},async 'dryRun'(_0x14acc1){const _0x5879c8=a247_0x50deb8,_0x316ffb=loadSqlProjectConfig(_0x14acc1[_0x5879c8(0x9a)]),{sqlName:_0x5864fd,dbId:_0x1ae6a4,dbName:_0x1a2610,mode:_0x1440cb}=await resolveSqlNewInputs(_0x14acc1),_0x4079da=buildSqlRelativePath('<server-generated-sqlCode>',_0x5864fd,_0x1a2610,_0x1440cb,_0x1ae6a4),_0x263307=_0x316ffb['sqlRootDir']+'/'+_0x4079da;return{'method':_0x5879c8(0xa7),'url':_0x5879c8(0x99),'body':{'appCode':_0x14acc1[_0x5879c8(0x9a)],'sqlName':_0x5864fd,'dbId':_0x1ae6a4,'mode':_0x1440cb,'localPath':_0x263307},'description':_0x5879c8(0x8c)+_0x316ffb[_0x5879c8(0x85)]};},async 'execute'(_0x4bd8eb){const _0x158ff8=a247_0x50deb8,_0x2891b3=loadSqlProjectConfig(_0x4bd8eb[_0x158ff8(0x9a)]),{sqlName:_0x3b21f2,dbId:_0x55115f,dbName:_0x4521e8,mode:_0x1607bc}=await resolveSqlNewInputs(_0x4bd8eb),_0x2ffce3=generateSqlTemplate(_0x1607bc),_0x17f424=await createSqlQuery({'appCode':_0x4bd8eb['appCode'],'sqlName':_0x3b21f2,'dbId':_0x55115f,'sqlContent':_0x2ffce3}),_0xc26afe=ensureRemoteSqlContent(_0x17f424),_0xbd05a8=_0x4521e8||await getDbName(_0x4bd8eb[_0x158ff8(0x9a)],_0x55115f)[_0x158ff8(0xa5)](()=>undefined),_0x36d5c5=buildSqlRelativePath(_0x17f424[_0x158ff8(0xae)],_0x17f424['sqlName'],_0xbd05a8,_0x1607bc,_0x55115f),_0x5aa20f=_0x2891b3[_0x158ff8(0x85)]+'/'+_0x36d5c5,_0x45773d=buildLocalSqlFileContent({'sqlCode':_0x17f424[_0x158ff8(0xae)],'sqlName':_0x17f424[_0x158ff8(0xad)],'dbId':_0x17f424['dbId']},_0xc26afe,{'dbName':_0xbd05a8,'mode':_0x1607bc,'syncedAt':new Date()['toISOString'](),'description':_0x17f424[_0x158ff8(0xbc)]});if(await fileExists(_0x5aa20f))throw CliErrors[_0x158ff8(0xb6)](_0x158ff8(0x84)+_0x5aa20f);await ensureParentDirectory(_0x5aa20f),await writeFile(_0x5aa20f,_0x45773d,_0x158ff8(0xa3));const _0x464fae=await readSqlLockFile(_0x2891b3[_0x158ff8(0x9f)]),{lockData:_0x383014,appLock:_0x1778c4}=ensureSqlLockScope(_0x464fae??createEmptySqlLock(),_0x2891b3[_0x158ff8(0x9a)],_0x2891b3[_0x158ff8(0x93)],_0x158ff8(0x86));return _0x1778c4[_0x158ff8(0xab)][_0x17f424['sqlCode']]={...buildSqlLockEntry(_0x17f424,_0xc26afe,computeSqlContentHash(_0x45773d),{'dbName':_0xbd05a8}),'path':_0x36d5c5,'mode':_0x1607bc},_0x1778c4[_0x158ff8(0x92)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2891b3[_0x158ff8(0x9f)],_0x383014),{'ok':!![],'data':{'id':_0x17f424['id'],'sqlCode':_0x17f424['sqlCode'],'sqlName':_0x17f424['sqlName'],'dbId':_0x17f424['dbId'],'path':_0x5aa20f,'mode':_0x1607bc},'message':'Created\x20SQL\x20query\x20'+_0x17f424[_0x158ff8(0xae)]};}};async function resolveSqlNewInputs(_0x111bd6){const _0x5d6252=await resolveSqlNameInput(_0x111bd6),{dbId:_0x571989,dbName:_0x27fc0d}=await resolveDbSelection(_0x111bd6),_0x59a460=await resolveSqlModeInput(_0x111bd6);return{'sqlName':_0x5d6252,'dbId':_0x571989,'dbName':_0x27fc0d,'mode':_0x59a460};}async function resolveSqlNameInput(_0x2aa4a2){const _0x5ebaa9=a247_0x50deb8,_0x560cb3=_0x2aa4a2['str'](_0x5ebaa9(0xc1))[_0x5ebaa9(0x9c)]();if(_0x560cb3)return _0x560cb3;if(_0x2aa4a2[_0x5ebaa9(0xc0)])throw CliErrors[_0x5ebaa9(0x80)](_0x5ebaa9(0xc1),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x48d740=>_0x48d740[_0x5ebaa9(0x9c)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))['trim']();}function a247_0x33cd(){const _0x171b32=['flagMissing','length','242936NbFYhF','57629Ytokao','File\x20already\x20exists:\x20','sqlRootDir','new','Local\x20SQL\x20file\x20mode','\x20\x20SELECT\x201\x20AS\x20id','10753iYahYo','parse','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','stringify','Select\x20the\x20target\x20database:','string','dbId\x20must\x20be\x20a\x20positive\x20integer','✎\x20Enter\x20dbId\x20manually','lastSync','sqlRoot','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Invalid\x20database\x20selection\x20payload:\x20','74996FEecFA','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','83565jFhdTM','/smartapi/custom/saveUserCustomSql','appCode','1266620BFIeOq','trim','dbName','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','lockFilePath','28bwVeto','Plain\x20SQL\x20(sql)','isInteger','utf8','62RrVPhK','catch','isFinite','POST','12VGRCSu','__manual__','sql','sqls','Target\x20database\x20ID','sqlName','sqlCode','str','27BGiUen','660TxsNWS','12zOodbV','mode','write','db-id','validation','16381144loHCnw','</select>','mybatisXml','number','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','description','dbId','Target\x20database\x20dbId:','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','nonInteractive','name','SQL\x20query\x20display\x20name','dbId\x20cannot\x20be\x20empty'];a247_0x33cd=function(){return _0x171b32;};return a247_0x33cd();}async function resolveDbSelection(_0x49eca8){const _0x2e541f=a247_0x50deb8,_0x657eb=resolveProvidedDbId(_0x49eca8);if(typeof _0x657eb==='number'&&Number[_0x2e541f(0xa6)](_0x657eb)&&_0x657eb>0x0)return{'dbId':_0x657eb,'dbName':await getDbName(_0x49eca8[_0x2e541f(0x9a)],_0x657eb)[_0x2e541f(0xa5)](()=>undefined)};if(_0x49eca8[_0x2e541f(0xc0)])throw CliErrors[_0x2e541f(0x80)](_0x2e541f(0xb5),_0x2e541f(0x8b));const _0x1326f0=await listDatabases(_0x49eca8[_0x2e541f(0x9a)])['catch'](()=>[]);if(_0x1326f0[_0x2e541f(0x81)]===0x1)return{'dbId':_0x1326f0[0x0]['dbId'],'dbName':_0x1326f0[0x0]['dbName']};if(_0x1326f0['length']>0x1){const _0x3011fb=await select({'message':_0x2e541f(0x8e),'choices':[..._0x1326f0['map'](_0x42a9f8=>({'name':_0x42a9f8[_0x2e541f(0x9d)]+'\x20('+_0x42a9f8[_0x2e541f(0xbd)]+')','value':serializeDbSelection(_0x42a9f8)})),{'name':_0x2e541f(0x91),'value':_0x2e541f(0xa9)}]});if(_0x3011fb!==_0x2e541f(0xa9))return deserializeDbSelection(_0x3011fb);}const _0x458471=await input({'message':_0x2e541f(0xbe),'validate':_0x4851ec=>{const _0x36daa2=_0x2e541f,_0x2abadc=_0x4851ec[_0x36daa2(0x9c)]();if(!_0x2abadc)return _0x36daa2(0x7f);const _0x39b7f1=Number(_0x2abadc);if(!Number[_0x36daa2(0xa2)](_0x39b7f1)||_0x39b7f1<=0x0)return _0x36daa2(0x90);return!![];}});return{'dbId':Number(_0x458471[_0x2e541f(0x9c)]())};}async function resolveSqlModeInput(_0x77ec06){const _0x15e2cb=a247_0x50deb8,_0x51342f=_0x77ec06[_0x15e2cb(0xaf)]('mode')[_0x15e2cb(0x9c)]();if(_0x51342f==='sql'||_0x51342f===_0x15e2cb(0xb9))return _0x51342f;if(_0x77ec06[_0x15e2cb(0xc0)])throw CliErrors[_0x15e2cb(0x80)](_0x15e2cb(0xb3),_0x15e2cb(0xbb));return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':_0x15e2cb(0xa1),'value':'sql','description':_0x15e2cb(0xbf)},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':'mybatisXml','description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x5adae){const _0x4ddcb4=a247_0x50deb8;return JSON[_0x4ddcb4(0x8d)]({'dbId':_0x5adae[_0x4ddcb4(0xbd)],'dbName':_0x5adae[_0x4ddcb4(0x9d)]});}function deserializeDbSelection(_0x270cf4){const _0x26af36=a247_0x50deb8;try{const _0x1b1442=JSON[_0x26af36(0x8a)](_0x270cf4);if(typeof _0x1b1442['dbId']==='number'&&Number[_0x26af36(0xa6)](_0x1b1442[_0x26af36(0xbd)]))return{'dbId':_0x1b1442[_0x26af36(0xbd)],'dbName':_0x1b1442[_0x26af36(0x9d)]};}catch{}throw CliErrors[_0x26af36(0xb6)](_0x26af36(0x95)+_0x270cf4);}function resolveProvidedDbId(_0x727b5){const _0x3787bf=a247_0x50deb8,_0x4c6dd8=_0x727b5['flag'](_0x3787bf(0xb5));if(typeof _0x4c6dd8==='number'&&Number[_0x3787bf(0xa6)](_0x4c6dd8))return _0x4c6dd8;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x2ff981=a248_0x213a;(function(_0x3bac75,_0x4f2fb1){const _0x4e40ab=a248_0x213a,_0x57d398=_0x3bac75();while(!![]){try{const _0x487d92=parseInt(_0x4e40ab(0x130))/0x1*(-parseInt(_0x4e40ab(0x145))/0x2)+parseInt(_0x4e40ab(0x122))/0x3+-parseInt(_0x4e40ab(0x138))/0x4+-parseInt(_0x4e40ab(0x127))/0x5+-parseInt(_0x4e40ab(0x12e))/0x6*(parseInt(_0x4e40ab(0x142))/0x7)+-parseInt(_0x4e40ab(0x13b))/0x8+parseInt(_0x4e40ab(0x133))/0x9;if(_0x487d92===_0x4f2fb1)break;else _0x57d398['push'](_0x57d398['shift']());}catch(_0x24975d){_0x57d398['push'](_0x57d398['shift']());}}}(a248_0x4214,0x9d307));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a248_0x213a(_0x2a7b72,_0x5374d4){_0x2a7b72=_0x2a7b72-0x122;const _0x42145d=a248_0x4214();let _0x213a64=_0x42145d[_0x2a7b72];return _0x213a64;}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';function a248_0x4214(){const _0x306ca7=['str','lockFilePath','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','36uSyVvt','toISOString','1VPDolG','remoteId','SQL\x20lock\x20file\x20not\x20found.','47166318BsPlDj','replace','/smartapi/custom/deleteUserCustomSql','POST','filter','4404304mgqQkX','trashDir','\x20(local\x20file\x20moved\x20to\x20trash)','10025968DhEPjk','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','sqlRoot','Would\x20delete\x20SQL\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','fromEntries','lastSync','1437072BSlJSy','sql','delete','2138302EbiqKz','1286547cjbpso','appCode','length','high-risk-write','sqlcode','1852275mknQoz','validation','sqls'];a248_0x4214=function(){return _0x306ca7;};return a248_0x4214();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a248_0x2ff981(0x143),'command':a248_0x2ff981(0x144),'description':a248_0x2ff981(0x13c),'risk':a248_0x2ff981(0x125),'flags':[SQLCODE_FLAG],async 'validate'(_0x5d8f78){const _0x510a23=a248_0x2ff981,_0x4d25a4=loadSqlProjectConfig(_0x5d8f78['appCode']),_0x4d50b9=await readSqlLockFile(_0x4d25a4[_0x510a23(0x12b)]);if(!_0x4d50b9)throw CliErrors['validation'](_0x510a23(0x12c));},async 'dryRun'(_0x20c53b){const _0x39bf06=a248_0x2ff981,_0x398f9d=loadSqlProjectConfig(_0x20c53b[_0x39bf06(0x123)]),_0x4c62cc=await readSqlLockFile(_0x398f9d[_0x39bf06(0x12b)]);if(!_0x4c62cc)throw CliErrors['validation'](_0x39bf06(0x12c));const {appLock:_0x1be026}=ensureSqlLockScope(_0x4c62cc,_0x20c53b[_0x39bf06(0x123)],_0x398f9d[_0x39bf06(0x13d)],_0x39bf06(0x144)),_0x461c99=_0x20c53b[_0x39bf06(0x12a)](_0x39bf06(0x126)),_0x248d06=_0x1be026[_0x39bf06(0x129)][_0x461c99];if(!_0x248d06)throw CliErrors[_0x39bf06(0x128)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x461c99+'\x22.');return{'method':_0x39bf06(0x136),'url':_0x39bf06(0x135),'body':{'sqlCode':_0x461c99,'id':_0x248d06[_0x39bf06(0x131)],'localPath':resolveLocalSqlFilePath(_0x398f9d,_0x461c99,_0x248d06)},'description':_0x39bf06(0x13e)+_0x461c99+_0x39bf06(0x12d)+_0x398f9d[_0x39bf06(0x139)]};},async 'execute'(_0x39edec){const _0x56c41e=a248_0x2ff981,_0x62d509=loadSqlProjectConfig(_0x39edec[_0x56c41e(0x123)]),_0x537860=await readSqlLockFile(_0x62d509[_0x56c41e(0x12b)]);if(!_0x537860)throw CliErrors[_0x56c41e(0x128)](_0x56c41e(0x132));const {lockData:_0x5d2718,appLock:_0x29a872}=ensureSqlLockScope(_0x537860,_0x39edec['appCode'],_0x62d509['sqlRoot'],'delete'),_0x7b79f4=_0x39edec['str'](_0x56c41e(0x126)),_0x174e2b=_0x29a872[_0x56c41e(0x129)][_0x7b79f4];if(!_0x174e2b)throw CliErrors[_0x56c41e(0x128)](_0x56c41e(0x13f)+_0x7b79f4+'\x22.');await deleteSqlQuery({'id':_0x174e2b[_0x56c41e(0x131)],'sqlCode':_0x7b79f4}),_0x29a872['sqls']=Object[_0x56c41e(0x140)](Object['entries'](_0x29a872[_0x56c41e(0x129)])[_0x56c41e(0x137)](([_0x3493ff])=>_0x3493ff!==_0x7b79f4)),_0x29a872[_0x56c41e(0x141)]=new Date()[_0x56c41e(0x12f)](),await writeSqlLockFile(_0x62d509[_0x56c41e(0x12b)],_0x5d2718);const _0x5393c5=resolveLocalSqlFilePath(_0x62d509,_0x7b79f4,_0x174e2b);let _0x54c03e;await fileExists(_0x5393c5)&&(_0x54c03e=await moveToTrash(_0x62d509['projectRoot'],_0x62d509[_0x56c41e(0x139)],_0x5393c5),await cleanupEmptyDirectories(dirname(_0x5393c5),_0x62d509['sqlRootDir']));const _0x1f48ef={'deleted':_0x7b79f4,'remoteId':_0x174e2b[_0x56c41e(0x131)]};if(_0x54c03e)_0x1f48ef['trashedTo']=_0x54c03e;return{'ok':!![],'data':_0x1f48ef,'message':'Deleted\x20'+_0x7b79f4+(_0x54c03e?_0x56c41e(0x13a):'')};}};async function moveToTrash(_0x3d86c7,_0x3b3fab,_0x360459){const _0x42a5c5=a248_0x2ff981,_0x1fc346=new Date()['toISOString']()[_0x42a5c5(0x134)](/[:.]/g,'-'),_0x55d45b=relative(_0x3d86c7,_0x360459),_0x1536e6=join(_0x3b3fab,_0x1fc346,_0x55d45b);return await mkdir(dirname(_0x1536e6),{'recursive':!![]}),await rename(_0x360459,_0x1536e6),_0x1536e6;}async function cleanupEmptyDirectories(_0x3428cf,_0x34bfbd){const _0x24f571=a248_0x2ff981;let _0x3a0e5a=resolve(_0x3428cf);const _0x1b23f9=resolve(_0x34bfbd);while(_0x3a0e5a['startsWith'](''+_0x1b23f9+sep)||_0x3a0e5a===_0x1b23f9){if(_0x3a0e5a===_0x1b23f9)return;try{const _0x59cac1=await readdir(_0x3a0e5a);if(_0x59cac1[_0x24f571(0x124)]>0x0)return;await rmdir(_0x3a0e5a);}catch{return;}_0x3a0e5a=dirname(_0x3a0e5a);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a249_0x1fccb6=a249_0x1e78;(function(_0x538163,_0xacc5c2){const _0x1b25b9=a249_0x1e78,_0x4b196d=_0x538163();while(!![]){try{const _0x230e4e=parseInt(_0x1b25b9(0x1e0))/0x1+-parseInt(_0x1b25b9(0x1d4))/0x2+parseInt(_0x1b25b9(0x1c9))/0x3*(-parseInt(_0x1b25b9(0x1d0))/0x4)+-parseInt(_0x1b25b9(0x1da))/0x5*(-parseInt(_0x1b25b9(0x1cc))/0x6)+-parseInt(_0x1b25b9(0x1dd))/0x7*(-parseInt(_0x1b25b9(0x1db))/0x8)+parseInt(_0x1b25b9(0x1d2))/0x9*(parseInt(_0x1b25b9(0x1d5))/0xa)+-parseInt(_0x1b25b9(0x1cb))/0xb*(parseInt(_0x1b25b9(0x1d3))/0xc);if(_0x230e4e===_0xacc5c2)break;else _0x4b196d['push'](_0x4b196d['shift']());}catch(_0x5183d0){_0x4b196d['push'](_0x4b196d['shift']());}}}(a249_0x283f,0xc2b76));import{getSqlQueryInfo}from'../../core/api-client.js';function a249_0x283f(){const _0x55444c=['dbId','detail','742612BwIlSY','27pThuFJ','Return\x20full\x20raw\x20SQL\x20query\x20object','22QNPLLz','462XClkLh','boolean','verbose','appCode','611692aPiiFh','sql','9XyReXP','5334636Vxdcss','1701874FyFDeK','12746980ALSIPj','str','sqlcode','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlContent','78515GeFhib','8qVklWC','description','4812269lQZOAa'];a249_0x283f=function(){return _0x55444c;};return a249_0x283f();}import{getDbName}from'../../core/db-resolver.js';function a249_0x1e78(_0x1c0be9,_0x5930bd){_0x1c0be9=_0x1c0be9-0x1c9;const _0x283fa9=a249_0x283f();let _0x1e7871=_0x283fa9[_0x1c0be9];return _0x1e7871;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x1fccb6(0x1d1),'command':a249_0x1fccb6(0x1df),'description':a249_0x1fccb6(0x1d8),'risk':'read','flags':[SQLCODE_FLAG,{'name':a249_0x1fccb6(0x1ce),'type':a249_0x1fccb6(0x1cd),'description':a249_0x1fccb6(0x1ca)}],async 'execute'(_0xa45ae5){const _0x41e01c=a249_0x1fccb6,_0x27b01b=await getSqlQueryInfo(_0xa45ae5[_0x41e01c(0x1cf)],_0xa45ae5[_0x41e01c(0x1d6)](_0x41e01c(0x1d7))),_0x3b79db=_0xa45ae5['bool']('verbose');if(_0x3b79db)return{'ok':!![],'data':_0x27b01b};const _0x23536e=_0x27b01b[_0x41e01c(0x1de)]?await getDbName(_0xa45ae5[_0x41e01c(0x1cf)],_0x27b01b[_0x41e01c(0x1de)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x27b01b['sqlCode'],'sqlName':_0x27b01b['sqlName'],'db':_0x23536e?_0x23536e+'\x20('+_0x27b01b[_0x41e01c(0x1de)]+')':_0x27b01b[_0x41e01c(0x1de)]??'','description':_0x27b01b[_0x41e01c(0x1dc)]??'','sqlContent':_0x27b01b[_0x41e01c(0x1d9)]??''}};}};
|