@lovrabet/rabetbase-cli 2.5.10-beta.3 → 2.5.10-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/context.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a235_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
|
+
const a235_0x1446c5=a235_0x2529;(function(_0x5ab451,_0x78a6cf){const _0x223b8d=a235_0x2529,_0x4d065a=_0x5ab451();while(!![]){try{const _0x35eeed=parseInt(_0x223b8d(0x9f))/0x1*(-parseInt(_0x223b8d(0xc6))/0x2)+-parseInt(_0x223b8d(0xc1))/0x3*(parseInt(_0x223b8d(0x97))/0x4)+-parseInt(_0x223b8d(0xa5))/0x5*(-parseInt(_0x223b8d(0xba))/0x6)+parseInt(_0x223b8d(0x8c))/0x7+parseInt(_0x223b8d(0x81))/0x8+parseInt(_0x223b8d(0xa6))/0x9+parseInt(_0x223b8d(0xca))/0xa;if(_0x35eeed===_0x78a6cf)break;else _0x4d065a['push'](_0x4d065a['shift']());}catch(_0x43639a){_0x4d065a['push'](_0x4d065a['shift']());}}}(a235_0x5132,0xd0206));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_0x1446c5(0x9d),'required':!![],'description':a235_0x1446c5(0xae)};export const ROLE_REF_FLAG={'name':a235_0x1446c5(0xc9),'type':a235_0x1446c5(0xb8),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a235_0x1446c5(0x7f),'type':'string','required':!![],'description':a235_0x1446c5(0x93)};function a235_0x5132(){const _0x34d7a8=['validation','Cannot\x20','flag','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','filter','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','appCode','4501424pevLEl','userId','/smartapi/permit/user-role/create','\x20is\x20not\x20a\x20member\x20of\x20role\x20','\x20is\x20already\x20a\x20member\x20of\x20role\x20','tenant','number','\x20members\x20of\x20the\x20OWNER\x20role.','141593MycGUJ','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','\x22\x20is\x20ambiguous\x20(ids:\x20','Disambiguate\x20with\x20--role\x20<id>.','\x20built-in\x20role\x20','remark','505ZoTGPI','5002704vontyK',';\x20no\x20change.','Role\x20id\x20','map','Multiple\x20tenant\x20members\x20match\x20\x22','roleType','test','Role\x20name\x20\x22','Role\x20id\x20(from\x20`role\x20list`)','totalCount','\x20duplicate\x20memberships\x20for\x20user\x20','\x22:\x20','str','/smartapi/permit/user-role/delete','\x20member(s)\x20but\x20role\x20has\x20','Missing\x20role\x20reference.','name','Missing\x20user\x20reference.','string','join','8754wFcLVV','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Check\x20the\x20nickname/username.\x20','\x20not\x20found\x20in\x20app\x20','nickname','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Pass\x20--user\x20<id|name>.','3CRRbCN','POST','find','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','trim','12rwocWE','Pass\x20--role\x20<id|name>.','tenant_code','role','3786430nwFUoE','ADMIN','push','dev','username','User\x20','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','user','expectUserCount','3579000RKsODX','Removed\x20','includes','flagMissing','OWNER','length','Pass\x20--user\x20<id>.','toLowerCase','userCount','Role\x20name','CUSTOM','9087169pNUIQI','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','user-add','roleName'];a235_0x5132=function(){return _0x34d7a8;};return a235_0x5132();}export const NAME_FLAG={'name':a235_0x1446c5(0xb6),'type':a235_0x1446c5(0xb8),'required':!![],'description':a235_0x1446c5(0x8a)};export const USER_NAME_FLAG={'name':a235_0x1446c5(0xb6),'type':a235_0x1446c5(0xb8),'required':!![],'description':a235_0x1446c5(0x95)};export const REMARK_FLAG={'name':'remark','type':a235_0x1446c5(0xb8),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a235_0x1446c5(0x9d),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a235_0x1446c5(0x79),'DEV','OWNER'];export function isBuiltinRole(_0x1fde32){return BUILTIN_ROLE_TYPES['includes'](_0x1fde32);}export function assertCustomRole(_0x4f4d3f,_0x296503){const _0x537327=a235_0x1446c5;if(_0x4f4d3f[_0x537327(0xab)]!==_0x537327(0x8b))throw CliErrors[_0x537327(0x90)](_0x537327(0x91)+_0x296503+_0x537327(0xa3)+_0x4f4d3f[_0x537327(0x8f)]+'\x20('+_0x4f4d3f[_0x537327(0xab)]+').',_0x537327(0x7e));}export function projectRole(_0x3ecdea){const _0x802293=a235_0x1446c5;return{'id':_0x3ecdea['id'],'roleName':_0x3ecdea['roleName'],'roleType':_0x3ecdea[_0x802293(0xab)],'remark':_0x3ecdea[_0x802293(0xa4)],'userCount':_0x3ecdea[_0x802293(0x89)],'permitCount':_0x3ecdea['permitCount'],'builtin':isBuiltinRole(_0x3ecdea[_0x802293(0xab)])};}function a235_0x2529(_0x4271ac,_0x211d51){_0x4271ac=_0x4271ac-0x79;const _0x513288=a235_0x5132();let _0x25291b=_0x513288[_0x4271ac];return _0x25291b;}export async function resolveRoleRef(_0x1ec2d5,_0x23d10c){const _0x265e86=a235_0x1446c5,_0x4d1a89=_0x23d10c['trim']();if(!_0x4d1a89)throw CliErrors[_0x265e86(0x90)](_0x265e86(0xb5),_0x265e86(0xc7));if(/^\d+$/[_0x265e86(0xac)](_0x4d1a89))return getRoleById(_0x1ec2d5,Number(_0x4d1a89));const _0x33c1e4=await listAllAppRoles(_0x1ec2d5),_0x3fd91d=_0x33c1e4[_0x265e86(0x94)](_0x49ee13=>_0x49ee13['roleName']===_0x4d1a89);if(_0x3fd91d[_0x265e86(0x86)]===0x0)throw CliErrors[_0x265e86(0x90)](_0x265e86(0xad)+_0x4d1a89+'\x22\x20not\x20found\x20in\x20app\x20'+_0x1ec2d5+'.',_0x265e86(0x8d));if(_0x3fd91d['length']>0x1){const _0x1f63d5=_0x3fd91d[_0x265e86(0xa9)](_0x476300=>_0x476300['id'])[_0x265e86(0xb9)](',\x20');throw CliErrors[_0x265e86(0x90)](_0x265e86(0xad)+_0x4d1a89+_0x265e86(0xa1)+_0x1f63d5+').',_0x265e86(0xa2));}return _0x3fd91d[0x0];}export async function getRoleById(_0x367f19,_0x4246fd){const _0x2a60bb=a235_0x1446c5,_0x561a34=await listAllAppRoles(_0x367f19),_0x76e97c=_0x561a34[_0x2a60bb(0x94)](_0x3e0872=>_0x3e0872['id']===_0x4246fd&&(!_0x3e0872[_0x2a60bb(0x96)]||_0x3e0872['appCode']===_0x367f19));if(_0x76e97c[_0x2a60bb(0x86)]!==0x1)throw CliErrors[_0x2a60bb(0x90)](_0x2a60bb(0xa8)+_0x4246fd+_0x2a60bb(0xbd)+_0x367f19+'.',_0x2a60bb(0xbb));return _0x76e97c[0x0];}async function listAllAppRoles(_0x8b8609){const _0x45f606=a235_0x1446c5,_0x54b684=0x64,_0x18c853=[];for(let _0x4187e0=0x1;;_0x4187e0+=0x1){const {items:_0x42b065,paging:_0x3d5ea2}=await listAppRoles(_0x8b8609,{'currentPage':_0x4187e0,'pageSize':_0x54b684});_0x18c853[_0x45f606(0x7a)](..._0x42b065);if(_0x42b065[_0x45f606(0x86)]<_0x54b684||_0x3d5ea2&&_0x18c853['length']>=_0x3d5ea2[_0x45f606(0xaf)])return _0x18c853;}}export async function resolveTenantCode(){const _0x742e8d=a235_0x1446c5,_0x55083a=await getSessionUserInfo(),_0x5ce7ae=_0x55083a?.[_0x742e8d(0x7f)]?.[_0x742e8d(0x9c)]?.[_0x742e8d(0xc8)];if(!_0x5ce7ae)throw CliErrors['authRequired'](_0x742e8d(0xc4));return _0x5ce7ae;}function matchMember(_0x22e12b,_0x160dc6){const _0x35cc21=a235_0x1446c5,_0x5cfd26=_0x160dc6['trim']()[_0x35cc21(0x88)]();return(_0x22e12b['nickname']??'')['toLowerCase']()===_0x5cfd26||(_0x22e12b[_0x35cc21(0x7c)]??'')[_0x35cc21(0x88)]()===_0x5cfd26;}export async function resolveUserRef(_0x18cc04,_0x55d692=a235_0x1446c5(0x87)){const _0x56c32f=a235_0x1446c5,_0x30f62c=_0x18cc04['trim']();if(!_0x30f62c)throw CliErrors[_0x56c32f(0x90)](_0x56c32f(0xb7),_0x56c32f(0xc0));const _0x38a718=await resolveTenantCode(),_0x508bf0=await getTenantMembers(_0x38a718);if(/^\d+$/['test'](_0x30f62c)){const _0xa540e5=Number(_0x30f62c),_0x2f6115=_0x508bf0[_0x56c32f(0xc3)](_0x31a5ea=>_0x31a5ea['userId']===_0xa540e5);return{'userId':_0xa540e5,'username':_0x2f6115?.[_0x56c32f(0x7c)]??String(_0xa540e5),'nickname':_0x2f6115?.[_0x56c32f(0xbe)],'matchedBy':'id'};}const _0xc4490d=_0x508bf0['filter'](_0x3f7202=>matchMember(_0x3f7202,_0x30f62c));if(_0xc4490d[_0x56c32f(0x86)]===0x0)throw CliErrors[_0x56c32f(0x90)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x30f62c+'\x22.',_0x56c32f(0xbc)+_0x55d692);if(_0xc4490d[_0x56c32f(0x86)]>0x1){const _0x3c6c63=_0xc4490d[_0x56c32f(0xa9)](_0x3c9625=>(_0x3c9625[_0x56c32f(0xbe)]??_0x3c9625['username']??'?')+'('+_0x3c9625[_0x56c32f(0x98)]+')')[_0x56c32f(0xb9)](',\x20');throw CliErrors[_0x56c32f(0x90)](_0x56c32f(0xaa)+_0x30f62c+_0x56c32f(0xb1)+_0x3c6c63+'.',_0x55d692);}const _0x139381=_0xc4490d[0x0];return{'userId':_0x139381[_0x56c32f(0x98)],'username':_0x139381[_0x56c32f(0x7c)]??String(_0x139381['userId']),'nickname':_0x139381[_0x56c32f(0xbe)],'matchedBy':'name'};}export const CREATE_USER_ROLE_PATH=a235_0x1446c5(0x99);export const DELETE_USER_ROLE_PATH=a235_0x1446c5(0xb3);export function computeRoleUserMutation(_0x47c654){const _0x5b6cfc=a235_0x1446c5,{operation:_0x2289f2,appCode:_0x533262,role:_0x422678,relations:_0x19da78,user:_0x4cfb70}=_0x47c654,_0x2a16bd=[...new Set(_0x19da78['map'](_0x5e5e05=>_0x5e5e05[_0x5b6cfc(0x98)]))],_0x1f0423=[];if(_0x47c654[_0x5b6cfc(0x80)]!==undefined&&_0x47c654[_0x5b6cfc(0x80)]!==_0x2a16bd['length'])throw CliErrors[_0x5b6cfc(0x90)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x47c654[_0x5b6cfc(0x80)]+_0x5b6cfc(0xb4)+_0x2a16bd[_0x5b6cfc(0x86)]+'.',_0x5b6cfc(0xa0));const _0x27b866=_0x2a16bd[_0x5b6cfc(0x83)](_0x4cfb70[_0x5b6cfc(0x98)]),_0xb0efe6=_0x19da78['filter'](_0x458ec6=>_0x458ec6[_0x5b6cfc(0x98)]===_0x4cfb70[_0x5b6cfc(0x98)])['map'](_0x2279ae=>_0x2279ae['id']),_0xc79e0b=_0x2289f2===_0x5b6cfc(0x8e)?!_0x27b866:_0x27b866;let _0x2d067e=_0x2a16bd;_0x2289f2==='user-add'?_0x27b866?_0x1f0423[_0x5b6cfc(0x7a)](_0x5b6cfc(0x7d)+_0x4cfb70[_0x5b6cfc(0x98)]+_0x5b6cfc(0x9b)+_0x422678[_0x5b6cfc(0x8f)]+_0x5b6cfc(0xa7)):_0x2d067e=[..._0x2a16bd,_0x4cfb70['userId']]:!_0x27b866?_0x1f0423[_0x5b6cfc(0x7a)](_0x5b6cfc(0x7d)+_0x4cfb70[_0x5b6cfc(0x98)]+_0x5b6cfc(0x9a)+_0x422678[_0x5b6cfc(0x8f)]+_0x5b6cfc(0xa7)):(_0x2d067e=_0x2a16bd['filter'](_0x3f0c6e=>_0x3f0c6e!==_0x4cfb70['userId']),_0xb0efe6[_0x5b6cfc(0x86)]>0x1&&_0x1f0423['push'](_0x5b6cfc(0x82)+_0xb0efe6[_0x5b6cfc(0x86)]+_0x5b6cfc(0xb0)+_0x4cfb70[_0x5b6cfc(0x98)]+'.'));const _0x4ad5c3={'scope':_0x5b6cfc(0x7b),'operation':_0x2289f2,'selector':{'appCode':_0x533262,'roleId':_0x422678['id'],'roleName':_0x422678[_0x5b6cfc(0x8f)],'userId':_0x4cfb70[_0x5b6cfc(0x98)]},'before':{'userIds':_0x2a16bd},'after':{'userIds':_0x2d067e},'dryRun':_0x47c654['dryRun'],'backend':{'method':_0x5b6cfc(0xc2),'path':_0x2289f2===_0x5b6cfc(0x8e)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x1f0423};return{'mutation':_0x4ad5c3,'changed':_0xc79e0b,'matchingRelationIds':_0xb0efe6};}export async function loadDevRoleRelations(_0xff7f32,_0x5cec9e){const _0x97f22b=a235_0x1446c5,_0x839798=0x64,_0x927835=[];for(let _0x1a6cfd=0x1;;_0x1a6cfd+=0x1){const {items:_0x333af8,paging:_0x14b711}=await listDevUserRoleRelations(_0xff7f32,{'roleId':_0x5cec9e,'currentPage':_0x1a6cfd,'pageSize':_0x839798});_0x927835['push'](..._0x333af8);if(_0x333af8[_0x97f22b(0x86)]<_0x839798||_0x14b711&&_0x927835[_0x97f22b(0x86)]>=_0x14b711[_0x97f22b(0xaf)])return _0x927835;}}export function readRoleRef(_0xdb7d1d){const _0x1fc5b1=a235_0x1446c5,_0x53208e=_0xdb7d1d[_0x1fc5b1(0xb2)](_0x1fc5b1(0xc9))[_0x1fc5b1(0xc5)]();if(!_0x53208e)throw CliErrors['flagMissing']('role',_0x1fc5b1(0xc7));return _0x53208e;}export async function prepareUserMutation(_0x272ba6,_0x703ffd,_0xba954c){const _0x3b4132=a235_0x1446c5,_0x524276=readRoleRef(_0x272ba6),_0x52fb6d=_0x272ba6[_0x3b4132(0xb2)](_0x3b4132(0x7f))['trim']();if(!_0x52fb6d)throw CliErrors[_0x3b4132(0x84)](_0x3b4132(0x7f),_0x3b4132(0xc0));const _0x471ea8=_0x272ba6[_0x3b4132(0x92)]('expect-user-count'),_0x408618=_0x471ea8===undefined||_0x471ea8===null?undefined:Number(_0x471ea8),_0x5cf2a2=await resolveRoleRef(_0x272ba6[_0x3b4132(0x96)],_0x524276);if(_0x5cf2a2['roleType']===_0x3b4132(0x85))throw CliErrors['validation'](_0x3b4132(0x91)+_0x703ffd+_0x3b4132(0x9e),_0x3b4132(0xbf));const _0xc982f7=await resolveUserRef(_0x52fb6d),_0x4426c8=await loadDevRoleRelations(_0x272ba6[_0x3b4132(0x96)],_0x5cf2a2['id']);return{...computeRoleUserMutation({'operation':_0x703ffd,'appCode':_0x272ba6[_0x3b4132(0x96)],'role':_0x5cf2a2,'relations':_0x4426c8,'user':{'userId':_0xc982f7[_0x3b4132(0x98)],'username':_0xc982f7['username'],'nickname':_0xc982f7[_0x3b4132(0xbe)]},'dryRun':_0xba954c,..._0x408618!==undefined?{'expectUserCount':_0x408618}:{}}),'role':_0x5cf2a2,'user':_0xc982f7};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a236_0x505347=a236_0x3c2c;(function(_0x2ccc14,_0x13130d){const _0x56ba6f=a236_0x3c2c,_0x16668a=_0x2ccc14();while(!![]){try{const _0x4ccce5=parseInt(_0x56ba6f(0x10d))/0x1+parseInt(_0x56ba6f(0x107))/0x2*(parseInt(_0x56ba6f(0x10c))/0x3)+parseInt(_0x56ba6f(0x121))/0x4*(-parseInt(_0x56ba6f(0x104))/0x5)+-parseInt(_0x56ba6f(0x11d))/0x6+parseInt(_0x56ba6f(0x113))/0x7+-parseInt(_0x56ba6f(0x116))/0x8+parseInt(_0x56ba6f(0x11e))/0x9;if(_0x4ccce5===_0x13130d)break;else _0x16668a['push'](_0x16668a['shift']());}catch(_0x19158c){_0x16668a['push'](_0x16668a['shift']());}}}(a236_0x5783,0x722bb));function a236_0x5783(){const _0x3dbcd1=['write','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','13284oSkPFx','num','105IpIhcV','--name\x20cannot\x20be\x20empty.','\x20(id=','412usORdf','POST','validation','flag','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','9HJShSr','323783eTMFIN','Updated\x20role\x20','trim','remark','role','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','6056491QpORwW','name','New\x20role\x20name','5297704ITMRbo','appCode','length','roleName','dev','update','string','1995204xRcQGo','3082653kMawjo'];a236_0x5783=function(){return _0x3dbcd1;};return a236_0x5783();}import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a236_0x3c2c(_0x12201f,_0x1e2af4){_0x12201f=_0x12201f-0x104;const _0x5783d5=a236_0x5783();let _0x3c2c73=_0x5783d5[_0x12201f];return _0x3c2c73;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH='/smartapi/permit/role/update';function readPatch(_0x5a5b0a){const _0x5efe7e=a236_0x3c2c,_0x1d2d74=_0x5a5b0a[_0x5efe7e(0x10a)](_0x5efe7e(0x114)),_0x5bba28=_0x5a5b0a[_0x5efe7e(0x10a)](_0x5efe7e(0x110)),_0x2e112d={};if(_0x1d2d74!==undefined&&_0x1d2d74!==null){const _0x2d386d=String(_0x1d2d74)[_0x5efe7e(0x10f)]();if(!_0x2d386d)throw CliErrors[_0x5efe7e(0x109)](_0x5efe7e(0x105));if(_0x2d386d[_0x5efe7e(0x118)]>0x40)throw CliErrors[_0x5efe7e(0x109)](_0x5efe7e(0x120));_0x2e112d['roleName']=_0x2d386d;}_0x5bba28!==undefined&&_0x5bba28!==null&&(_0x2e112d[_0x5efe7e(0x110)]=String(_0x5bba28));if(_0x2e112d[_0x5efe7e(0x119)]===undefined&&_0x2e112d[_0x5efe7e(0x110)]===undefined)throw CliErrors[_0x5efe7e(0x109)]('Nothing\x20to\x20update.',_0x5efe7e(0x10b));return _0x2e112d;}export const roleUpdate={'service':a236_0x505347(0x111),'command':a236_0x505347(0x11b),'description':a236_0x505347(0x112),'risk':a236_0x505347(0x11f),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a236_0x505347(0x114),'type':a236_0x505347(0x11c),'required':![],'description':a236_0x505347(0x115)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3dca5a){readPatch(_0x3dca5a);},async 'dryRun'(_0x4f682d){const _0x16745a=a236_0x505347,_0x289c5e=_0x4f682d[_0x16745a(0x122)]('id'),_0x279118=readPatch(_0x4f682d),_0x5eaec0=await getRoleById(_0x4f682d[_0x16745a(0x117)],_0x289c5e);return assertCustomRole(_0x5eaec0,'update'),asDryRunResult({'scope':_0x16745a(0x11a),'operation':_0x16745a(0x11b),'selector':{'appCode':_0x4f682d[_0x16745a(0x117)],'roleId':_0x289c5e,'roleName':_0x5eaec0[_0x16745a(0x119)]},'before':projectRole(_0x5eaec0),'after':projectRole({..._0x5eaec0,..._0x279118[_0x16745a(0x119)]!==undefined?{'roleName':_0x279118[_0x16745a(0x119)]}:{},..._0x279118[_0x16745a(0x110)]!==undefined?{'remark':_0x279118[_0x16745a(0x110)]}:{}}),'dryRun':!![],'backend':{'method':_0x16745a(0x108),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x29d6ca){const _0x32c302=a236_0x505347,_0x1d2392=_0x29d6ca['num']('id'),_0x11224f=readPatch(_0x29d6ca),_0x6e165a=await getRoleById(_0x29d6ca['appCode'],_0x1d2392);assertCustomRole(_0x6e165a,_0x32c302(0x11b)),await updateAppRole({'id':_0x1d2392,'appCode':_0x29d6ca[_0x32c302(0x117)],..._0x11224f[_0x32c302(0x119)]!==undefined?{'roleName':_0x11224f[_0x32c302(0x119)]}:{},..._0x11224f['remark']!==undefined?{'remark':_0x11224f['remark']}:{}});const _0x1b8d37=await getRoleById(_0x29d6ca[_0x32c302(0x117)],_0x1d2392);return{'ok':!![],'data':{'scope':_0x32c302(0x11a),'operation':_0x32c302(0x11b),'selector':{'appCode':_0x29d6ca['appCode'],'roleId':_0x1d2392,'roleName':_0x1b8d37[_0x32c302(0x119)]},'before':projectRole(_0x6e165a),'after':projectRole(_0x1b8d37),'dryRun':![],'backend':{'method':_0x32c302(0x108),'path':UPDATE_PATH},'warnings':[]},'message':_0x32c302(0x10e)+_0x1b8d37[_0x32c302(0x119)]+_0x32c302(0x106)+_0x1d2392+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a237_0x8081(){const _0xca8ba6=['15BGfsPH','No\x20change:\x20user\x20','4174570GVUUUb','appCode','POST','Added\x20user\x20','roleType','119308qfmyoQ','roleId','12259872lPmYqP','4195758WUYfeO','high-risk-write','3497NCPrGl','selector','\x20to\x20role\x20','1354566pfwyZr','5923400BEeeWD','46tDZvfw','userId'];a237_0x8081=function(){return _0xca8ba6;};return a237_0x8081();}const a237_0x1b67de=a237_0x1925;(function(_0xc40466,_0x51789c){const _0x503272=a237_0x1925,_0x3551f0=_0xc40466();while(!![]){try{const _0x25e115=-parseInt(_0x503272(0x1d2))/0x1*(parseInt(_0x503272(0x1d7))/0x2)+parseInt(_0x503272(0x1d9))/0x3*(parseInt(_0x503272(0x1cd))/0x4)+-parseInt(_0x503272(0x1db))/0x5+-parseInt(_0x503272(0x1d5))/0x6+-parseInt(_0x503272(0x1d0))/0x7+parseInt(_0x503272(0x1d6))/0x8+parseInt(_0x503272(0x1cf))/0x9;if(_0x25e115===_0x51789c)break;else _0x3551f0['push'](_0x3551f0['shift']());}catch(_0x11f960){_0x3551f0['push'](_0x3551f0['shift']());}}}(a237_0x8081,0x7cd24));import{createDevUserRole}from'../../core/api-client.js';function a237_0x1925(_0x3addfd,_0x4306f2){_0x3addfd=_0x3addfd-0x1cd;const _0x808195=a237_0x8081();let _0x1925ed=_0x808195[_0x3addfd];return _0x1925ed;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':'role','command':'user-add','description':'Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a237_0x1b67de(0x1d1),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x1ec930){const _0x5cbe7d=a237_0x1b67de,{mutation:_0x59dc64}=await prepareUserMutation(_0x1ec930,'user-add',!![]);return asDryRunResult(_0x59dc64,{'method':_0x5cbe7d(0x1dd),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x2b4db5){const _0xacc1a9=a237_0x1b67de,{mutation:_0xb124a9,changed:_0x48665d,role:_0x17dde2,user:_0x1fb5d4}=await prepareUserMutation(_0x2b4db5,'user-add',![]);return _0x48665d&&await createDevUserRole({'appCode':_0x2b4db5[_0xacc1a9(0x1dc)],'userId':_0x1fb5d4[_0xacc1a9(0x1d8)],'username':_0x1fb5d4['username'],'roleType':_0x17dde2[_0xacc1a9(0x1df)],'roleId':_0xb124a9[_0xacc1a9(0x1d3)][_0xacc1a9(0x1ce)]}),{'ok':!![],'data':_0xb124a9,'message':_0x48665d?_0xacc1a9(0x1de)+_0xb124a9['selector'][_0xacc1a9(0x1d8)]+_0xacc1a9(0x1d4)+_0xb124a9['selector']['roleName']:_0xacc1a9(0x1da)+_0xb124a9['selector'][_0xacc1a9(0x1d8)]+'\x20already\x20in\x20role\x20'+_0xb124a9[_0xacc1a9(0x1d3)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a238_0x29ad(_0xd1d6d3,_0x190df6){_0xd1d6d3=_0xd1d6d3-0x176;const _0x4d791b=a238_0x4d79();let _0x29ad16=_0x4d791b[_0xd1d6d3];return _0x29ad16;}const a238_0xa7a319=a238_0x29ad;(function(_0x536613,_0x3aea93){const _0x45053c=a238_0x29ad,_0x418465=_0x536613();while(!![]){try{const _0x158efe=-parseInt(_0x45053c(0x17e))/0x1+parseInt(_0x45053c(0x18a))/0x2*(parseInt(_0x45053c(0x17a))/0x3)+-parseInt(_0x45053c(0x17c))/0x4+-parseInt(_0x45053c(0x17f))/0x5+-parseInt(_0x45053c(0x17b))/0x6+parseInt(_0x45053c(0x181))/0x7*(parseInt(_0x45053c(0x182))/0x8)+parseInt(_0x45053c(0x17d))/0x9;if(_0x158efe===_0x3aea93)break;else _0x418465['push'](_0x418465['shift']());}catch(_0x224ad5){_0x418465['push'](_0x418465['shift']());}}}(a238_0x4d79,0x1d774));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a238_0xa7a319(0x189),'command':a238_0xa7a319(0x185),'description':a238_0xa7a319(0x188),'risk':a238_0xa7a319(0x180),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x25aa0b){const _0x2230a8=a238_0xa7a319,{mutation:_0x280ac4}=await prepareUserMutation(_0x25aa0b,'user-remove',!![]);return asDryRunResult(_0x280ac4,{'method':_0x2230a8(0x186),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x5189e6){const _0x3f2e60=a238_0xa7a319,{matchingRelationIds:_0x4ecc2d,mutation:_0x36196e,changed:_0x36733b}=await prepareUserMutation(_0x5189e6,'user-remove',![]);if(_0x36733b)for(const _0x1e84cd of _0x4ecc2d){await deleteDevUserRole(_0x1e84cd);}return{'ok':!![],'data':_0x36196e,'message':_0x36733b?_0x3f2e60(0x176)+_0x36196e[_0x3f2e60(0x179)][_0x3f2e60(0x183)]+_0x3f2e60(0x187)+_0x36196e['selector'][_0x3f2e60(0x184)]:_0x3f2e60(0x177)+_0x36196e[_0x3f2e60(0x179)][_0x3f2e60(0x183)]+_0x3f2e60(0x178)+_0x36196e[_0x3f2e60(0x179)]['roleName']};}};function a238_0x4d79(){const _0x3809cc=['9728btVabk','1382508lKCJZO','142783fvSsfP','336000dBNYIB','high-risk-write','240590hCBmNA','8cJbyFS','userId','roleName','user-remove','POST','\x20from\x20role\x20','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','role','339928WwYgvU','Removed\x20user\x20','No\x20change:\x20user\x20','\x20not\x20in\x20role\x20','selector','3XJybze','149034BtUMZk'];a238_0x4d79=function(){return _0x3809cc;};return a238_0x4d79();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a239_0x5e9c(_0x3bb868,_0x2f99e5){_0x3bb868=_0x3bb868-0xfb;const _0x3b15af=a239_0x3b15();let _0x5e9c38=_0x3b15af[_0x3bb868];return _0x5e9c38;}const a239_0x1edc7f=a239_0x5e9c;(function(_0x4fb4cf,_0x2feb01){const _0x539050=a239_0x5e9c,_0x267676=_0x4fb4cf();while(!![]){try{const _0x377655=parseInt(_0x539050(0x106))/0x1+-parseInt(_0x539050(0xff))/0x2+parseInt(_0x539050(0x101))/0x3+-parseInt(_0x539050(0xfb))/0x4*(-parseInt(_0x539050(0x103))/0x5)+parseInt(_0x539050(0x107))/0x6+parseInt(_0x539050(0xfd))/0x7+-parseInt(_0x539050(0xfc))/0x8;if(_0x377655===_0x2feb01)break;else _0x267676['push'](_0x267676['shift']());}catch(_0x40064c){_0x267676['push'](_0x267676['shift']());}}}(a239_0x3b15,0xaaecf));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a239_0x3b15(){const _0x15fe88=['name','userId','nickname','username','1645468msqAxS','12063984IPoKAg','7121121ibXhlT','role','2248704WizyOz','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','839880yCHicg','Pass\x20--name\x20<nickname|username>.','5kKAFCT','read','trim','997290hSkctc','3759246OTFclr'];a239_0x3b15=function(){return _0x15fe88;};return a239_0x3b15();}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a239_0x1edc7f(0xfe),'command':'user-resolve','description':a239_0x1edc7f(0x100),'risk':a239_0x1edc7f(0x104),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x17eae9){const _0x26382a=a239_0x1edc7f;if(!_0x17eae9['str'](_0x26382a(0x108))[_0x26382a(0x105)]())throw CliErrors['flagMissing'](_0x26382a(0x108),_0x26382a(0x102));},async 'execute'(_0x4bf0e3){const _0x4f9f76=a239_0x1edc7f,_0x393838=_0x4bf0e3['str']('name')[_0x4f9f76(0x105)](),_0xa8165a=await resolveUserRef(_0x393838,'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':_0xa8165a[_0x4f9f76(0x109)],'username':_0xa8165a[_0x4f9f76(0x10b)],'nickname':_0xa8165a[_0x4f9f76(0x10a)],'matchedBy':_0xa8165a['matchedBy']}},'message':'Resolved\x20\x22'+_0x393838+'\x22\x20→\x20userId\x20'+_0xa8165a[_0x4f9f76(0x109)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a240_0x5cadfa=a240_0x48eb;(function(_0x1550a2,_0x1f9eb9){const _0x1ce151=a240_0x48eb,_0x4637e5=_0x1550a2();while(!![]){try{const _0x180485=-parseInt(_0x1ce151(0xca))/0x1+parseInt(_0x1ce151(0xd7))/0x2*(-parseInt(_0x1ce151(0xd5))/0x3)+-parseInt(_0x1ce151(0xc9))/0x4*(parseInt(_0x1ce151(0xdc))/0x5)+-parseInt(_0x1ce151(0xcc))/0x6*(-parseInt(_0x1ce151(0xd1))/0x7)+parseInt(_0x1ce151(0xd4))/0x8+parseInt(_0x1ce151(0xcb))/0x9*(-parseInt(_0x1ce151(0xd0))/0xa)+parseInt(_0x1ce151(0xd9))/0xb;if(_0x180485===_0x1f9eb9)break;else _0x4637e5['push'](_0x4637e5['shift']());}catch(_0x2276e0){_0x4637e5['push'](_0x4637e5['shift']());}}}(a240_0x1433,0x2eb12));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';function a240_0x48eb(_0x1b949a,_0x1e9b98){_0x1b949a=_0x1b949a-0xc8;const _0x1433df=a240_0x1433();let _0x48eb45=_0x1433df[_0x1b949a];return _0x48eb45;}export const ruleGet={'service':a240_0x5cadfa(0xdd),'command':a240_0x5cadfa(0xc8),'description':'Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','risk':a240_0x5cadfa(0xdb),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x5a5782){readAppRuleType(_0x5a5782);},async 'execute'(_0x3f791b){const _0x106620=a240_0x5cadfa,_0x8aff02=readAppRuleType(_0x3f791b),_0x562e10=await getAppRule(_0x3f791b[_0x106620(0xda)],{'appCode':_0x3f791b[_0x106620(0xd6)],'type':_0x8aff02});if(!_0x562e10)throw appRuleError('app_rule_not_found',appRuleFileName(_0x8aff02)+_0x106620(0xcd)+_0x3f791b[_0x106620(0xd6)]+'.',_0x106620(0xd2)+_0x8aff02+_0x106620(0xd8));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x8aff02,_0x562e10),'content':_0x562e10[_0x106620(0xd3)]}},'message':_0x106620(0xcf)+appRuleFileName(_0x8aff02)+_0x106620(0xce)+_0x3f791b[_0x106620(0xd6)]};}};function a240_0x1433(){const _0x4be2af=['rule','get','387716PBDRZj','186872yjEwso','47943CvjBCz','6JtHZsv','\x20is\x20not\x20configured\x20for\x20app\x20','\x20for\x20','Loaded\x20','430ZlQTgP','2340709DvmKas','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','content','742296UZGMik','243pvrIjl','appCode','4298ztXlaR','\x20--file\x20<path>\x20--dry-run`.','4961077aomjAb','cookie','read','5rMHLtH'];a240_0x1433=function(){return _0x4be2af;};return a240_0x1433();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a241_0x5adc(){const _0xcde255=['123519pDkvam','dryRun','990465TmuvJf','8iQluMO','2393046GpnxCB','379088UZOeCO','execute','150602coJvbz','696857LgMkIT','map','6XyOLTl','signal','11ZbJhnr','4rDKJGY','238860pBNbJL'];a241_0x5adc=function(){return _0xcde255;};return a241_0x5adc();}const a241_0x4ce8ae=a241_0x483c;(function(_0x1589f8,_0x329617){const _0x341316=a241_0x483c,_0x61baa9=_0x1589f8();while(!![]){try{const _0x289345=-parseInt(_0x341316(0x1f5))/0x1+parseInt(_0x341316(0x1f7))/0x2+parseInt(_0x341316(0x1f0))/0x3*(-parseInt(_0x341316(0x1ee))/0x4)+parseInt(_0x341316(0x1f2))/0x5+-parseInt(_0x341316(0x1fa))/0x6*(-parseInt(_0x341316(0x1f8))/0x7)+parseInt(_0x341316(0x1f3))/0x8*(parseInt(_0x341316(0x1f4))/0x9)+-parseInt(_0x341316(0x1ef))/0xa*(parseInt(_0x341316(0x1fc))/0xb);if(_0x289345===_0x329617)break;else _0x61baa9['push'](_0x61baa9['shift']());}catch(_0x42f69c){_0x61baa9['push'](_0x61baa9['shift']());}}}(a241_0x5adc,0x2f884));import{withKbManagementSession}from'../../core/kb-management-client.js';import{ruleGet}from'../../commands/rule/get.js';function a241_0x483c(_0x348730,_0x5ab5b9){_0x348730=_0x348730-0x1ee;const _0x5adce4=a241_0x5adc();let _0x483ca2=_0x5adce4[_0x348730];return _0x483ca2;}import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet][a241_0x4ce8ae(0x1f9)](_0x144f1c=>({..._0x144f1c,'execute':_0x18da17=>withKbManagementSession(_0x18da17[a241_0x4ce8ae(0x1fb)],()=>_0x144f1c[a241_0x4ce8ae(0x1f6)](_0x18da17)),..._0x144f1c['dryRun']?{'dryRun':_0x32fc0e=>withKbManagementSession(_0x32fc0e[a241_0x4ce8ae(0x1fb)],()=>_0x144f1c[a241_0x4ce8ae(0x1f1)](_0x32fc0e))}:{}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a242_0x911f55=a242_0x23f0;(function(_0xc780d0,_0x5e43c0){const _0x34edfd=a242_0x23f0,_0x34478c=_0xc780d0();while(!![]){try{const _0x96a9b7=-parseInt(_0x34edfd(0x107))/0x1*(-parseInt(_0x34edfd(0x10f))/0x2)+-parseInt(_0x34edfd(0x115))/0x3*(parseInt(_0x34edfd(0x106))/0x4)+-parseInt(_0x34edfd(0x111))/0x5*(parseInt(_0x34edfd(0x110))/0x6)+parseInt(_0x34edfd(0x10b))/0x7*(parseInt(_0x34edfd(0x117))/0x8)+parseInt(_0x34edfd(0x108))/0x9+-parseInt(_0x34edfd(0x114))/0xa+parseInt(_0x34edfd(0x116))/0xb;if(_0x96a9b7===_0x5e43c0)break;else _0x34478c['push'](_0x34478c['shift']());}catch(_0x331b8c){_0x34478c['push'](_0x34478c['shift']());}}}(a242_0x28ad,0xea86e));function a242_0x28ad(){const _0x59d57d=['Loaded\x20app\x20rule\x20configuration\x20for\x20','4stmRWB','1EOSVFg','3040452NoOClx','cookie','appCode','7WBBMmq','list','read','all','3023174TvCVky','930MrHcMc','895Vbedpr','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','length','9206160osqXoa','3756093FbhGuT','12075294YrMcpW','1710760tIEDPR'];a242_0x28ad=function(){return _0x59d57d;};return a242_0x28ad();}function a242_0x23f0(_0x5649df,_0x347e18){_0x5649df=_0x5649df-0x106;const _0x28ad1c=a242_0x28ad();let _0x23f070=_0x28ad1c[_0x5649df];return _0x23f070;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':'rule','command':a242_0x911f55(0x10c),'description':a242_0x911f55(0x112),'risk':a242_0x911f55(0x10d),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0xc61db8){const _0x55ed74=a242_0x911f55,_0x2404fe=await Promise[_0x55ed74(0x10e)](APP_RULE_TYPES['map'](_0x393b9a=>getAppRule(_0xc61db8[_0x55ed74(0x109)],{'appCode':_0xc61db8[_0x55ed74(0x10a)],'type':_0x393b9a}))),_0x284cfd=APP_RULE_TYPES['map']((_0x13d624,_0x1e33d9)=>projectAppRule(_0x13d624,_0x2404fe[_0x1e33d9]??null));return{'ok':!![],'data':{'total':_0x284cfd[_0x55ed74(0x113)],'rules':_0x284cfd},'message':_0x55ed74(0x118)+_0xc61db8['appCode']};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
+
const a243_0x1185c5=a243_0x14f6;(function(_0x25549e,_0x260528){const _0x517b60=a243_0x14f6,_0x215300=_0x25549e();while(!![]){try{const _0x3a9cfe=-parseInt(_0x517b60(0x13e))/0x1+-parseInt(_0x517b60(0x170))/0x2*(parseInt(_0x517b60(0x16b))/0x3)+-parseInt(_0x517b60(0x15f))/0x4+-parseInt(_0x517b60(0x178))/0x5+-parseInt(_0x517b60(0x172))/0x6+parseInt(_0x517b60(0x153))/0x7*(-parseInt(_0x517b60(0x156))/0x8)+parseInt(_0x517b60(0x159))/0x9;if(_0x3a9cfe===_0x260528)break;else _0x215300['push'](_0x215300['shift']());}catch(_0x2c96d9){_0x215300['push'](_0x215300['shift']());}}}(a243_0x4343,0xb0567));import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';function a243_0x4343(){const _0x1760aa=['1571095soXeFQ','app_rule_verification_failed','unconfigured','\x20for\x20','rule','\x20version\x20changed\x20before\x20write.','app_rule_expected_version_invalid','app_rule_content_too_large','byteSize','417289APErou','trim','app_rule_version_mismatch','rabetbase\x20rule\x20get\x20--type\x20','Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set','--file\x20is\x20required.','write','content','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','verified','planned','Expected\x20','number','input','version','replacement','UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','defineProperty','isSafeInteger','RULES','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','91BvAQdU','contentHash','flag','230856hgQuTY','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','beforeRecord','27155205GaXAtO','POST','create','type','\x20could\x20not\x20be\x20verified.','cause','95732vQBtRH','rules','\x20--format\x20compress','cookie','Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.','The\x20set\x20request\x20was\x20sent,\x20but\x20','expected-version','appCode','before','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','string','file','28011VDtovG','update',';\x20current\x20version\x20is\x20','set','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','142Ahoxjp','expectedVersion','3008742gfgqXP','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','DATABASE','Set\x20','str','Pass\x20a\x20UTF-8\x20Markdown\x20file.'];a243_0x4343=function(){return _0x1760aa;};return a243_0x4343();}import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function a243_0x14f6(_0x47f191,_0x476cd6){_0x47f191=_0x47f191-0x13c;const _0x434398=a243_0x4343();let _0x14f6c5=_0x434398[_0x47f191];return _0x14f6c5;}function readSetInput(_0x164170){const _0x5cd121=a243_0x14f6,_0x1bd0df=readAppRuleType(_0x164170),_0x77527b=_0x164170[_0x5cd121(0x176)](_0x5cd121(0x16a))[_0x5cd121(0x13f)]();if(!_0x77527b)throw appRuleError('app_rule_file_required',_0x5cd121(0x143),_0x5cd121(0x177));const _0x2abc6e=_0x164170[_0x5cd121(0x155)](_0x5cd121(0x165));let _0x417558;if(_0x2abc6e!==undefined){_0x417558=Number(_0x2abc6e);if(!Number[_0x5cd121(0x150)](_0x417558)||_0x417558<0x0)throw appRuleError(_0x5cd121(0x17e),'--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x1bd0df,'file':_0x77527b,'expectedVersion':_0x417558};}async function prepareSet(_0x10ac2e){const _0x239a61=a243_0x14f6,_0x392952=readSetInput(_0x10ac2e),_0x418829=await readAppRuleFile(_0x392952[_0x239a61(0x16a)]);if(_0x392952[_0x239a61(0x15c)]===_0x239a61(0x160)&&_0x418829[_0x239a61(0x145)]['length']>0x7d0)throw appRuleError(_0x239a61(0x13c),_0x239a61(0x16f));const _0x3aad16=await getAppRule(_0x10ac2e['cookie'],{'appCode':_0x10ac2e[_0x239a61(0x166)],'type':_0x392952[_0x239a61(0x15c)]});if(_0x392952['expectedVersion']!==undefined&&(_0x3aad16?.[_0x239a61(0x14c)]??0x0)!==_0x392952[_0x239a61(0x171)])throw appRuleError(_0x239a61(0x140),appRuleFileName(_0x392952[_0x239a61(0x15c)])+_0x239a61(0x17d),_0x239a61(0x149)+_0x392952[_0x239a61(0x171)]+_0x239a61(0x16d)+(_0x3aad16?.[_0x239a61(0x14c)]??_0x239a61(0x17a))+_0x239a61(0x168));return{'input':_0x392952,'replacement':_0x418829,'beforeRecord':_0x3aad16,'before':projectAppRule(_0x392952[_0x239a61(0x15c)],_0x3aad16),'planned':{'type':_0x392952[_0x239a61(0x15c)],'fileName':appRuleFileName(_0x392952['type']),'contextScope':appRuleContextScope(_0x392952['type']),'enabled':!![],'appCode':_0x10ac2e[_0x239a61(0x166)],'scope':_0x239a61(0x160),'contentByteSize':_0x418829[_0x239a61(0x13d)],'contentHash':_0x418829[_0x239a61(0x154)]}};}function warningsFor(_0xe29dde){return[];}export const ruleSet={'service':a243_0x1185c5(0x17c),'command':a243_0x1185c5(0x16e),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a243_0x1185c5(0x144),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':'file','type':a243_0x1185c5(0x169),'required':!![],'description':a243_0x1185c5(0x14e)},{'name':'expected-version','type':a243_0x1185c5(0x14a),'required':![],'description':a243_0x1185c5(0x142)}],async 'validate'(_0x405bad){readSetInput(_0x405bad);},async 'dryRun'(_0x53127d){const _0xdf161d=a243_0x1185c5,_0x41d556=await prepareSet(_0x53127d);return asDryRunResult({'operation':'set','selector':{'appCode':_0x53127d[_0xdf161d(0x166)],'scope':_0xdf161d(0x160),'type':_0x41d556[_0xdf161d(0x14b)][_0xdf161d(0x15c)]},'before':_0x41d556[_0xdf161d(0x167)],'after':_0x41d556[_0xdf161d(0x148)],'dryRun':!![],'backend':{'method':_0xdf161d(0x15a),'path':knowledgeDocumentsPath(_0xdf161d(0x160),_0x41d556[_0xdf161d(0x158)]?_0xdf161d(0x16c):_0xdf161d(0x15b)),'body':{'appCode':_0x53127d[_0xdf161d(0x166)],..._0x41d556[_0xdf161d(0x158)]?{'id':_0x41d556[_0xdf161d(0x158)]['id']}:{},'title':_0x41d556[_0xdf161d(0x14b)][_0xdf161d(0x15c)]===_0xdf161d(0x160)?_0xdf161d(0x151):_0xdf161d(0x174),'contentHash':_0x41d556['replacement'][_0xdf161d(0x154)],'contentByteSize':_0x41d556[_0xdf161d(0x14d)][_0xdf161d(0x13d)],..._0x41d556[_0xdf161d(0x158)]?{'expectedVersion':_0x41d556[_0xdf161d(0x158)][_0xdf161d(0x14c)]}:{}}},'warnings':warningsFor(_0x41d556[_0xdf161d(0x14b)][_0xdf161d(0x171)]),'verification':{'expectedVersion':_0x41d556[_0xdf161d(0x158)]?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0xdf161d(0x141)+_0x41d556[_0xdf161d(0x14b)][_0xdf161d(0x15c)]+_0xdf161d(0x161)}},{'method':'POST','url':knowledgeDocumentsPath(_0xdf161d(0x160),_0x41d556[_0xdf161d(0x158)]?_0xdf161d(0x16c):_0xdf161d(0x15b))});},async 'execute'(_0x59bdc2){const _0x219581=a243_0x1185c5,_0x1289bd=await prepareSet(_0x59bdc2),_0x21c1d8=_0x1289bd['beforeRecord']===null?0x1:_0x1289bd[_0x219581(0x158)][_0x219581(0x14c)]+(_0x1289bd[_0x219581(0x158)][_0x219581(0x145)]===_0x1289bd[_0x219581(0x14d)][_0x219581(0x145)]?0x0:0x1);let _0x43bfd1,_0x2d7c20=![];try{_0x43bfd1=await saveAppRule(_0x59bdc2['cookie'],{'appCode':_0x59bdc2['appCode'],'type':_0x1289bd[_0x219581(0x14b)][_0x219581(0x15c)],'content':_0x1289bd[_0x219581(0x14d)][_0x219581(0x145)],'expectedVersion':_0x1289bd[_0x219581(0x158)]?.[_0x219581(0x14c)]??0x0,..._0x1289bd[_0x219581(0x158)]?{'id':_0x1289bd[_0x219581(0x158)]['id']}:{}});if(_0x43bfd1['version']!==_0x21c1d8||_0x43bfd1[_0x219581(0x145)]!==_0x1289bd[_0x219581(0x14d)]['content']||_0x1289bd['beforeRecord']!==null&&_0x43bfd1['id']!==_0x1289bd[_0x219581(0x158)]['id'])throw appRuleError(_0x219581(0x179),_0x219581(0x146),_0x219581(0x163));}catch(_0x2ac210){if(!isPlatformTransportFailure(_0x2ac210))throw _0x2ac210;_0x2d7c20=!![];}let _0x734a44;try{_0x734a44=await getAppRule(_0x59bdc2[_0x219581(0x162)],{'appCode':_0x59bdc2[_0x219581(0x166)],'type':_0x1289bd[_0x219581(0x14b)][_0x219581(0x15c)]});}catch(_0xc12a2b){const _0x17ad51=appRuleError(_0x2d7c20?'app_rule_set_outcome_unknown':'app_rule_verification_unavailable',_0x219581(0x164)+appRuleFileName(_0x1289bd[_0x219581(0x14b)]['type'])+_0x219581(0x15d),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object[_0x219581(0x14f)](_0x17ad51,_0x219581(0x15e),{'value':_0xc12a2b,'enumerable':![]});throw _0x17ad51;}const _0x175e40=_0x734a44&&inspectAppRuleContent(_0x734a44[_0x219581(0x145)])[_0x219581(0x154)]===_0x1289bd['replacement'][_0x219581(0x154)],_0x3b1427=_0x734a44&&_0x734a44[_0x219581(0x14c)]===_0x21c1d8&&(!_0x43bfd1||_0x734a44['id']===_0x43bfd1['id']&&_0x734a44[_0x219581(0x14c)]===_0x43bfd1[_0x219581(0x14c)]);if(!_0x734a44||!_0x175e40||!_0x3b1427||_0x1289bd[_0x219581(0x158)]!==null&&_0x734a44['id']!==_0x1289bd[_0x219581(0x158)]['id'])throw appRuleError(_0x2d7c20?'app_rule_set_outcome_unknown':_0x219581(0x179),appRuleFileName(_0x1289bd[_0x219581(0x14b)][_0x219581(0x15c)])+_0x219581(0x173),_0x219581(0x157)+_0x1289bd[_0x219581(0x14b)]['type']+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x4d95f4=warningsFor(_0x1289bd[_0x219581(0x14b)]['expectedVersion']);_0x2d7c20&&_0x4d95f4['push'](_0x219581(0x152));const _0x42c8f4=projectAppRule(_0x1289bd[_0x219581(0x14b)][_0x219581(0x15c)],_0x734a44);return{'ok':!![],'data':{'operation':_0x219581(0x16e),'selector':{'appCode':_0x59bdc2[_0x219581(0x166)],'scope':_0x219581(0x160),'type':_0x1289bd['input'][_0x219581(0x15c)]},'before':_0x1289bd[_0x219581(0x167)],'after':_0x42c8f4,'dryRun':![],'backend':{'method':_0x219581(0x15a),'path':knowledgeDocumentsPath(_0x219581(0x160),_0x1289bd[_0x219581(0x158)]?_0x219581(0x16c):_0x219581(0x15b))},'warnings':_0x4d95f4,'verification':{'status':_0x219581(0x147),'recoveredAfterUnknownResponse':_0x2d7c20,'expectedVersion':_0x1289bd['beforeRecord']?.[_0x219581(0x14c)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x219581(0x141)+_0x1289bd[_0x219581(0x14b)]['type']+_0x219581(0x161)}},'message':_0x219581(0x175)+appRuleFileName(_0x1289bd[_0x219581(0x14b)]['type'])+_0x219581(0x17b)+_0x59bdc2['appCode']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x22b0c3=a244_0x3b40;(function(_0x395138,_0xaadeb){const _0x5c777f=a244_0x3b40,_0xcb132e=_0x395138();while(!![]){try{const _0x541f86=parseInt(_0x5c777f(0x208))/0x1+-parseInt(_0x5c777f(0x20e))/0x2*(parseInt(_0x5c777f(0x203))/0x3)+-parseInt(_0x5c777f(0x1ec))/0x4*(-parseInt(_0x5c777f(0x1eb))/0x5)+-parseInt(_0x5c777f(0x1e0))/0x6+parseInt(_0x5c777f(0x204))/0x7*(parseInt(_0x5c777f(0x20a))/0x8)+-parseInt(_0x5c777f(0x1f4))/0x9*(-parseInt(_0x5c777f(0x201))/0xa)+-parseInt(_0x5c777f(0x1ed))/0xb;if(_0x541f86===_0xaadeb)break;else _0xcb132e['push'](_0xcb132e['shift']());}catch(_0xc59466){_0xcb132e['push'](_0xcb132e['shift']());}}}(a244_0x3792,0xac2c2));function a244_0x3792(){const _0x2a2ff2=['hex','10WZxJbl','474256WOwnjv','11678524pRGSEj','Pass\x20a\x20UTF-8\x20Markdown\x20file.','digest','decode','page-api-development','updateTime','content','9BGszHa','database','App\x20rule\x20file\x20is\x20blank:\x20','contentHash','str','app_rule_file_required','app_rule_content_too_large','appCode','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','length','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','size','isFile','5427480VhhIbk','app_rule_file_invalid','819KAznTf','2872226nCIPWR','--file\x20is\x20required.','RULES.md','from','1338435gsjeeR','version','16SnUWPX','rules','Cannot\x20access\x20app\x20rule\x20file:\x20','byteSize','3236dBpUEb','trim','app_rule_file_unreadable','createTime','byteLength','message','4381986oWVJxs','app_rule_content_invalid','update','indexStatus','utf8','string','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','type','sha256','sha256:'];a244_0x3792=function(){return _0x2a2ff2;};return a244_0x3792();}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_0x22b0c3(0x20b),a244_0x22b0c3(0x1f5)];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_0x22b0c3(0x206),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x22b0c3(0x1f1),'database':'database-analysis'};export function appRuleError(_0x5404b1,_0x5a499d,_0x382d5a){return new CliError(_0x5404b1,0x1,_0x5a499d,_0x382d5a);}function a244_0x3b40(_0x407062,_0x1227f2){_0x407062=_0x407062-0x1de;const _0x37922c=a244_0x3792();let _0x3b4073=_0x37922c[_0x407062];return _0x3b4073;}export function readAppRuleType(_0x44108e){const _0x40e69f=a244_0x22b0c3,_0x5e5591=_0x44108e[_0x40e69f(0x1f8)](_0x40e69f(0x1e7))['trim']()['toLowerCase']();if(_0x5e5591!==_0x40e69f(0x20b)&&_0x5e5591!=='database')throw appRuleError('app_rule_type_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x5e5591;}export function appRuleFileName(_0x4aa014){return APP_RULE_FILES[_0x4aa014];}export function appRuleContextScope(_0x1183ac){return APP_RULE_CONTEXT_SCOPES[_0x1183ac];}export function inspectAppRuleContent(_0x3f726f){const _0x4be4a0=a244_0x22b0c3,_0x44db4f=Buffer[_0x4be4a0(0x207)](_0x3f726f,_0x4be4a0(0x1e4));return{'content':_0x3f726f,'byteSize':_0x44db4f[_0x4be4a0(0x1de)],'contentHash':_0x4be4a0(0x1e9)+createHash(_0x4be4a0(0x1e8))[_0x4be4a0(0x1e2)](_0x44db4f)[_0x4be4a0(0x1ef)](_0x4be4a0(0x1ea))};}export async function readAppRuleFile(_0x5df32d){const _0x123f56=a244_0x22b0c3,_0x2bbbfe=_0x5df32d[_0x123f56(0x20f)]();if(!_0x2bbbfe)throw appRuleError(_0x123f56(0x1f9),_0x123f56(0x205),_0x123f56(0x1ee));const _0x11d347=resolve(_0x2bbbfe);let _0x2d35f7;try{_0x2d35f7=await stat(_0x11d347);}catch(_0x1b82e3){throw appRuleError('app_rule_file_unreadable',_0x123f56(0x20c)+_0x2bbbfe,_0x1b82e3 instanceof Error?_0x1b82e3[_0x123f56(0x1df)]:String(_0x1b82e3));}if(!_0x2d35f7[_0x123f56(0x200)]())throw appRuleError(_0x123f56(0x202),_0x123f56(0x1e6)+_0x2bbbfe);if(_0x2d35f7[_0x123f56(0x1ff)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x123f56(0x1fa),'App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.');let _0x278d94;try{_0x278d94=await readFile(_0x11d347);}catch(_0x4db0c8){throw appRuleError(_0x123f56(0x210),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x2bbbfe,_0x4db0c8 instanceof Error?_0x4db0c8[_0x123f56(0x1df)]:String(_0x4db0c8));}if(_0x278d94[_0x123f56(0x1de)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.');let _0x3f7a87;try{_0x3f7a87=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x123f56(0x1f0)](_0x278d94);}catch{throw appRuleError(_0x123f56(0x1e1),'App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20'+_0x2bbbfe);}if(_0x3f7a87[_0x123f56(0x1fd)]>MAX_APP_RULE_UNITS)throw appRuleError(_0x123f56(0x1fa),_0x123f56(0x1fc));if(!_0x3f7a87['trim']())throw appRuleError('app_rule_content_invalid',_0x123f56(0x1f6)+_0x2bbbfe);return inspectAppRuleContent(_0x3f7a87);}export function projectAppRule(_0xa0f201,_0xcdab46){const _0x4bb778=a244_0x22b0c3;if(!_0xcdab46)return{'type':_0xa0f201,'fileName':appRuleFileName(_0xa0f201),'contextScope':appRuleContextScope(_0xa0f201),'enabled':![]};const _0x3904e1=inspectAppRuleContent(_0xcdab46[_0x4bb778(0x1f3)]);return{'type':_0xa0f201,'fileName':appRuleFileName(_0xa0f201),'contextScope':appRuleContextScope(_0xa0f201),'enabled':!![],'id':_0xcdab46['id'],'scope':_0xcdab46['scope'],'appCode':_0xcdab46[_0x4bb778(0x1fb)],'version':_0xcdab46[_0x4bb778(0x209)],..._0xcdab46[_0x4bb778(0x1e3)]!==undefined?{'indexStatus':_0xcdab46[_0x4bb778(0x1e3)]}:{},'contentByteSize':_0x3904e1[_0x4bb778(0x20d)],'contentHash':_0x3904e1[_0x4bb778(0x1f7)],..._0xcdab46[_0x4bb778(0x211)]!==undefined&&_0xcdab46[_0x4bb778(0x211)]!==null?{'createTime':_0xcdab46[_0x4bb778(0x211)]}:{},..._0xcdab46['updateTime']!==undefined&&_0xcdab46[_0x4bb778(0x1f2)]!==null?{'updateTime':_0xcdab46[_0x4bb778(0x1f2)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x22b0c3(0x1e7),'type':a244_0x22b0c3(0x1e5),'required':!![],'description':a244_0x22b0c3(0x1fe),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a245_0x4fb4ff=a245_0x35a6;(function(_0x348bbc,_0x14eb71){const _0x15aedb=a245_0x35a6,_0x5905c1=_0x348bbc();while(!![]){try{const _0x1662d5=parseInt(_0x15aedb(0xe7))/0x1*(parseInt(_0x15aedb(0xe8))/0x2)+-parseInt(_0x15aedb(0xe2))/0x3+-parseInt(_0x15aedb(0xe4))/0x4+-parseInt(_0x15aedb(0xf4))/0x5+parseInt(_0x15aedb(0x106))/0x6+-parseInt(_0x15aedb(0xe5))/0x7+parseInt(_0x15aedb(0x117))/0x8;if(_0x1662d5===_0x14eb71)break;else _0x5905c1['push'](_0x5905c1['shift']());}catch(_0x2a1425){_0x5905c1['push'](_0x5905c1['shift']());}}}(a245_0x2acb,0x19543));function a245_0x2acb(){const _0x4d33cf=['dev','error','parse','npm','join','write','\x20exited\x20with\x20code\x20','script','keys','245028heqZWM','package.json','204128UNAPjy','417221rJpSGH','boolean','297ukNyLJ','906amlojw','scripts','pnpm-lock.yaml','validation','path','No\x20package.json\x20found\x20in\x20current\x20directory.','args','.bin','push','\x22\x20not\x20found\x20in\x20package.json.','close','--watch','724550jbCQnU','(none)','Script\x20\x22','length','\x0a\x20\x20Available\x20scripts:\x0a','log','run','\x0a\x20\x20Usage:\x20','cwd','vite','preview','Available:\x20','bun.lock','inherit','No\x20scripts\x20defined\x20in\x20package.json.','start','\x20run\x20build','\x20\x20EXAMPLES','572244TKDXcs','\x20\x20\x20\x20','\x20run\x20preview\x20--watch','bun','changed','has','\x20run\x20<script>\x0a','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','utf-8','\x20run\x20start','node_modules','\x20run\x20','needsUpgrade','Script\x20name\x20defined\x20in\x20package.json','bool','watch','yarn.lock','1688424CEqwEl'];a245_0x2acb=function(){return _0x4d33cf;};return a245_0x2acb();}import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';function a245_0x35a6(_0x18066b,_0x2996b7){_0x18066b=_0x18066b-0xd9;const _0x2acbc7=a245_0x2acb();let _0x35a64f=_0x2acbc7[_0x18066b];return _0x35a64f;}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_0x4fb4ff(0x103),'dev']),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x4fb4ff(0x103),a245_0x4fb4ff(0xd9),'build',a245_0x4fb4ff(0xfe)]);export function syncProjectDomainRoutingBeforeScript(_0x23e1bc,_0x4640d8){const _0x2df660=a245_0x4fb4ff;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x2df660(0x10b)](_0x4640d8))return null;const _0x49cccc=findProjectRootDirectory(_0x23e1bc);if(!resolveConfigPath(_0x49cccc))return null;const _0x5c1feb=writeProjectDomainRoutingManifest(_0x49cccc);return{'path':_0x5c1feb[_0x2df660(0xec)],'changed':_0x5c1feb[_0x2df660(0x10a)]};}function readPackageScripts(_0x5208c8){const _0x5046e1=a245_0x4fb4ff,_0x35e2ba=resolve(_0x5208c8,_0x5046e1(0xe3));if(!existsSync(_0x35e2ba))return null;try{const _0x43e5b9=JSON[_0x5046e1(0xdb)](readFileSync(_0x35e2ba,_0x5046e1(0x10e)));return _0x43e5b9[_0x5046e1(0xe9)]??{};}catch{return null;}}function detectPackageManager(_0x3100f1){const _0x301c65=a245_0x4fb4ff;if(existsSync(resolve(_0x3100f1,'bun.lockb'))||existsSync(resolve(_0x3100f1,_0x301c65(0x100))))return _0x301c65(0x109);if(existsSync(resolve(_0x3100f1,_0x301c65(0xea))))return'pnpm';if(existsSync(resolve(_0x3100f1,_0x301c65(0x116))))return'yarn';return _0x301c65(0xdc);}async function versionCheck(_0x205ade){const _0x2591d4=a245_0x4fb4ff,_0x467a17=await checkCliVersion();(_0x467a17[_0x2591d4(0x112)]||_0x467a17['belowMinimum'])&&(printCliUpgradeWarning(_0x467a17),assertCliVersionSupported(_0x467a17));const _0xe7d1a6=await checkSdkVersion(_0x205ade);if(_0xe7d1a6[_0x2591d4(0x112)])printSdkUpgradeWarning(_0xe7d1a6);}function spawnScript(_0x490873,_0x47caf3,_0x36fc86,_0x3779d5){return new Promise((_0x304f65,_0x290b64)=>{const _0x4feb7d=a245_0x35a6,_0x56427e=[_0x4feb7d(0xfa),_0x47caf3,..._0x36fc86],_0x14538e=spawn(_0x490873,_0x56427e,{'cwd':_0x3779d5,'stdio':_0x4feb7d(0x101),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3779d5,_0x4feb7d(0x110),_0x4feb7d(0xef))+delimiter+process.env.PATH}});_0x14538e['on'](_0x4feb7d(0xf2),_0x9513e7=>{const _0x4d293a=_0x4feb7d;if(_0x9513e7===0x0||_0x9513e7===null)_0x304f65();else _0x290b64(new Error(_0x490873+_0x4d293a(0x111)+_0x47caf3+_0x4d293a(0xdf)+_0x9513e7));}),_0x14538e['on'](_0x4feb7d(0xda),_0x290b64);});}function spawnViteBuildWatch(_0x3907f6){return new Promise((_0x25f8ad,_0x1ebacf)=>{const _0x49a6dd=a245_0x35a6,_0x44b882=spawn(_0x49a6dd(0xfd),['build',_0x49a6dd(0xf3)],{'cwd':_0x3907f6,'stdio':_0x49a6dd(0x101),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3907f6,_0x49a6dd(0x110),_0x49a6dd(0xef))+delimiter+process.env.PATH}});_0x44b882['on']('close',_0x100fb4=>{const _0x1b8de7=_0x49a6dd;if(_0x100fb4===0x0||_0x100fb4===null)_0x25f8ad();else _0x1ebacf(new Error(_0x1b8de7(0x10d)+_0x100fb4));}),_0x44b882['on'](_0x49a6dd(0xda),_0x1ebacf);});}function spawnVitePreview(_0x453408){return new Promise((_0x3b083d,_0x4c0f59)=>{const _0x55d68e=a245_0x35a6,_0x3df2cc=spawn('vite',[_0x55d68e(0xfe)],{'cwd':_0x453408,'stdio':_0x55d68e(0x101),'shell':!![],'env':{...process.env,'PATH':''+join(_0x453408,_0x55d68e(0x110),'.bin')+delimiter+process.env.PATH}});_0x3df2cc['on'](_0x55d68e(0xf2),_0x5bbdfa=>{if(_0x5bbdfa===0x0||_0x5bbdfa===null)_0x3b083d();else _0x4c0f59(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x5bbdfa));}),_0x3df2cc['on'](_0x55d68e(0xda),_0x4c0f59);});}const runFlags=[{'name':'watch','type':a245_0x4fb4ff(0xe6),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a245_0x4fb4ff(0xfa),'command':a245_0x4fb4ff(0xfa),'description':'Run\x20a\x20package.json\x20script','risk':a245_0x4fb4ff(0xde),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x4fb4ff(0xe0),'description':a245_0x4fb4ff(0x113),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x2fa9d6=a245_0x4fb4ff,_0x229e45=[];return _0x229e45[_0x2fa9d6(0xf0)](_0x2fa9d6(0x105)),_0x229e45['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x2fa9d6(0x10f)),_0x229e45[_0x2fa9d6(0xf0)](_0x2fa9d6(0x107)+CLI_BIN_NAME+_0x2fa9d6(0x104)),_0x229e45[_0x2fa9d6(0xf0)](_0x2fa9d6(0x107)+CLI_BIN_NAME+'\x20run\x20preview'),_0x229e45[_0x2fa9d6(0xf0)](_0x2fa9d6(0x107)+CLI_BIN_NAME+_0x2fa9d6(0x108)),_0x229e45[_0x2fa9d6(0xdd)]('\x0a');},async 'execute'(_0x43e494){const _0x4b690c=a245_0x4fb4ff,_0x3623bf=process[_0x4b690c(0xfc)](),_0x3766e6=_0x43e494[_0x4b690c(0xee)][0x0],_0x24710d=_0x43e494[_0x4b690c(0xee)]['slice'](0x1),_0x2a1715=readPackageScripts(_0x3623bf);if(!_0x2a1715)throw CliErrors[_0x4b690c(0xeb)](_0x4b690c(0xed));if(!_0x3766e6){const _0x430756=Object[_0x4b690c(0xe1)](_0x2a1715);if(_0x430756[_0x4b690c(0xf7)]===0x0)console[_0x4b690c(0xf9)](_0x4b690c(0x102));else{console[_0x4b690c(0xf9)](_0x4b690c(0xf8));for(const _0x2f9f23 of _0x430756){console['log'](_0x4b690c(0x107)+_0x2f9f23);}console[_0x4b690c(0xf9)](_0x4b690c(0xfb)+CLI_BIN_NAME+_0x4b690c(0x10c));}return{'ok':!![]};}if(!_0x2a1715[_0x3766e6])throw CliErrors[_0x4b690c(0xeb)](_0x4b690c(0xf6)+_0x3766e6+_0x4b690c(0xf1),_0x4b690c(0xff)+(Object[_0x4b690c(0xe1)](_0x2a1715)['join'](',\x20')||_0x4b690c(0xf5)));const _0x73ea50=detectPackageManager(_0x3623bf),_0x2dbdce=syncProjectDomainRoutingBeforeScript(_0x3623bf,_0x3766e6);_0x2dbdce?.['changed']&&console['error']('Domain\x20routing\x20synchronized:\x20'+_0x2dbdce['path']);VERSION_CHECK_SCRIPTS[_0x4b690c(0x10b)](_0x3766e6)&&await versionCheck(_0x3623bf);if(_0x3766e6===_0x4b690c(0xfe)&&_0x43e494[_0x4b690c(0x114)](_0x4b690c(0x115)))return await Promise['all']([spawnViteBuildWatch(_0x3623bf),spawnVitePreview(_0x3623bf)]),{'ok':!![]};return await spawnScript(_0x73ea50,_0x3766e6,_0x24710d,_0x3623bf),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x24d8a3=a246_0x49d8;function a246_0x49d8(_0x246604,_0x5affea){_0x246604=_0x246604-0x1f3;const _0x304dd4=a246_0x304d();let _0x49d825=_0x304dd4[_0x246604];return _0x49d825;}(function(_0x3bbb86,_0x2a1587){const _0x27fb48=a246_0x49d8,_0xad5b92=_0x3bbb86();while(!![]){try{const _0x2c7024=parseInt(_0x27fb48(0x1fa))/0x1*(-parseInt(_0x27fb48(0x1f3))/0x2)+parseInt(_0x27fb48(0x1fc))/0x3*(parseInt(_0x27fb48(0x1ff))/0x4)+parseInt(_0x27fb48(0x1fb))/0x5+parseInt(_0x27fb48(0x1f9))/0x6*(parseInt(_0x27fb48(0x201))/0x7)+parseInt(_0x27fb48(0x1fd))/0x8*(-parseInt(_0x27fb48(0x1f6))/0x9)+parseInt(_0x27fb48(0x1f4))/0xa+-parseInt(_0x27fb48(0x1f5))/0xb;if(_0x2c7024===_0x2a1587)break;else _0xad5b92['push'](_0xad5b92['shift']());}catch(_0x1c3b31){_0xad5b92['push'](_0xad5b92['shift']());}}}(a246_0x304d,0xd6953));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x2b854e){const _0x17b07d=await buildSchemaPayload();return{'ok':!![],'data':_0x17b07d};}function a246_0x304d(){const _0xdbc8e0=['718035pmITXw','3gIFxAh','6896XbHzKN','json','2599276PoJvgu','export','251552pLfFGQ','2RySMnP','9562010CDytYl','14920147NMucBR','2304ZzaaHe','schema','Export\x20machine-readable\x20command\x20schema\x20(JSON)','264aROQlt','874831fZYbEv'];a246_0x304d=function(){return _0xdbc8e0;};return a246_0x304d();}export const schemaDefinition={'service':a246_0x24d8a3(0x1f7),'command':a246_0x24d8a3(0x200),'description':a246_0x24d8a3(0x1f8),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a246_0x24d8a3(0x1fe),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
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
|
+
const a247_0x517cef=a247_0x145c;(function(_0x1c486f,_0x3654cd){const _0x26746b=a247_0x145c,_0x180be2=_0x1c486f();while(!![]){try{const _0x1a0c39=-parseInt(_0x26746b(0xa6))/0x1*(-parseInt(_0x26746b(0x9c))/0x2)+parseInt(_0x26746b(0x80))/0x3*(parseInt(_0x26746b(0x91))/0x4)+-parseInt(_0x26746b(0x93))/0x5+parseInt(_0x26746b(0x89))/0x6*(-parseInt(_0x26746b(0xae))/0x7)+-parseInt(_0x26746b(0x86))/0x8+parseInt(_0x26746b(0xb6))/0x9+parseInt(_0x26746b(0x81))/0xa*(parseInt(_0x26746b(0xb2))/0xb);if(_0x1a0c39===_0x3654cd)break;else _0x180be2['push'](_0x180be2['shift']());}catch(_0x4fc8d5){_0x180be2['push'](_0x180be2['shift']());}}}(a247_0x26b3,0x585fd));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a247_0x145c(_0x47e1eb,_0x1bfb45){_0x47e1eb=_0x47e1eb-0x7d;const _0x26b305=a247_0x26b3();let _0x145cf6=_0x26b305[_0x47e1eb];return _0x145cf6;}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x150abe){const _0x467aae=a247_0x145c;if(_0x150abe===_0x467aae(0x87))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x467aae(0xa9),_0x467aae(0x90),'']['join']('\x0a');return[_0x467aae(0x97),''][_0x467aae(0x82)]('\x0a');}export const sqlCreate={'service':a247_0x517cef(0x9d),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a247_0x517cef(0x94),'flags':[{'name':a247_0x517cef(0xb0),'type':a247_0x517cef(0x9e),'description':'SQL\x20query\x20display\x20name'},{'name':a247_0x517cef(0x9f),'type':a247_0x517cef(0x84),'description':'Target\x20database\x20ID'},{'name':a247_0x517cef(0xac),'type':'string','enum':[a247_0x517cef(0x9d),a247_0x517cef(0x87)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x5723db){const _0x598ebc=a247_0x517cef;if(!_0x5723db[_0x598ebc(0xad)])return;if(!_0x5723db[_0x598ebc(0x83)]('name')[_0x598ebc(0xb5)]())throw CliErrors[_0x598ebc(0x9b)](_0x598ebc(0xb0),_0x598ebc(0x8d));const _0xeb409c=resolveProvidedDbId(_0x5723db);if(typeof _0xeb409c!==_0x598ebc(0x84)||!Number['isFinite'](_0xeb409c)||_0xeb409c<=0x0)throw CliErrors[_0x598ebc(0x9b)](_0x598ebc(0x9f),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x5723db[_0x598ebc(0x83)](_0x598ebc(0xac))['trim']())throw CliErrors[_0x598ebc(0x9b)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0xd5b485){const _0x2b548d=a247_0x517cef,_0x21426a=loadSqlProjectConfig(_0xd5b485[_0x2b548d(0xaf)]),{sqlName:_0x23738d,dbId:_0x4b13cd,dbName:_0x215be7,mode:_0x544d1e}=await resolveSqlNewInputs(_0xd5b485),_0x4ee230=buildSqlRelativePath(_0x2b548d(0xa7),_0x23738d,_0x215be7,_0x544d1e,_0x4b13cd),_0x1c5b7f=_0x21426a[_0x2b548d(0x8f)]+'/'+_0x4ee230;return{'method':_0x2b548d(0x96),'url':_0x2b548d(0xa3),'body':{'appCode':_0xd5b485[_0x2b548d(0xaf)],'sqlName':_0x23738d,'dbId':_0x4b13cd,'mode':_0x544d1e,'localPath':_0x1c5b7f},'description':_0x2b548d(0xa1)+_0x21426a[_0x2b548d(0x8f)]};},async 'execute'(_0x31298b){const _0x331ef8=a247_0x517cef,_0x3778c7=loadSqlProjectConfig(_0x31298b['appCode']),{sqlName:_0x237123,dbId:_0x55e2eb,dbName:_0x308027,mode:_0x4508f3}=await resolveSqlNewInputs(_0x31298b),_0x34e837=generateSqlTemplate(_0x4508f3),_0x106b18=await createSqlQuery({'appCode':_0x31298b[_0x331ef8(0xaf)],'sqlName':_0x237123,'dbId':_0x55e2eb,'sqlContent':_0x34e837}),_0x29c7f4=ensureRemoteSqlContent(_0x106b18),_0xf24741=_0x308027||await getDbName(_0x31298b[_0x331ef8(0xaf)],_0x55e2eb)[_0x331ef8(0x85)](()=>undefined),_0xdfc6b8=buildSqlRelativePath(_0x106b18[_0x331ef8(0x8a)],_0x106b18[_0x331ef8(0x95)],_0xf24741,_0x4508f3,_0x55e2eb),_0x4c181=_0x3778c7[_0x331ef8(0x8f)]+'/'+_0xdfc6b8,_0x166ec0=buildLocalSqlFileContent({'sqlCode':_0x106b18['sqlCode'],'sqlName':_0x106b18[_0x331ef8(0x95)],'dbId':_0x106b18[_0x331ef8(0xb1)]},_0x29c7f4,{'dbName':_0xf24741,'mode':_0x4508f3,'syncedAt':new Date()[_0x331ef8(0xb7)](),'description':_0x106b18['description']});if(await fileExists(_0x4c181))throw CliErrors['validation'](_0x331ef8(0xa0)+_0x4c181);await ensureParentDirectory(_0x4c181),await writeFile(_0x4c181,_0x166ec0,_0x331ef8(0xa4));const _0x4280f6=await readSqlLockFile(_0x3778c7['lockFilePath']),{lockData:_0x5f3495,appLock:_0x4cd4fb}=ensureSqlLockScope(_0x4280f6??createEmptySqlLock(),_0x3778c7[_0x331ef8(0xaf)],_0x3778c7[_0x331ef8(0xa8)],'new');return _0x4cd4fb['sqls'][_0x106b18[_0x331ef8(0x8a)]]={...buildSqlLockEntry(_0x106b18,_0x29c7f4,computeSqlContentHash(_0x166ec0),{'dbName':_0xf24741}),'path':_0xdfc6b8,'mode':_0x4508f3},_0x4cd4fb[_0x331ef8(0x98)]=new Date()[_0x331ef8(0xb7)](),await writeSqlLockFile(_0x3778c7['lockFilePath'],_0x5f3495),{'ok':!![],'data':{'id':_0x106b18['id'],'sqlCode':_0x106b18[_0x331ef8(0x8a)],'sqlName':_0x106b18['sqlName'],'dbId':_0x106b18['dbId'],'path':_0x4c181,'mode':_0x4508f3},'message':'Created\x20SQL\x20query\x20'+_0x106b18[_0x331ef8(0x8a)]};}};async function resolveSqlNewInputs(_0x12398e){const _0x33510c=await resolveSqlNameInput(_0x12398e),{dbId:_0x4de2fd,dbName:_0x17b9e4}=await resolveDbSelection(_0x12398e),_0x431d4e=await resolveSqlModeInput(_0x12398e);return{'sqlName':_0x33510c,'dbId':_0x4de2fd,'dbName':_0x17b9e4,'mode':_0x431d4e};}function a247_0x26b3(){const _0x5ccf4e=['write','sqlName','POST','SELECT\x201\x20AS\x20id;','lastSync','length','Target\x20database\x20dbId:','flagMissing','4698aVRgok','sql','string','db-id','File\x20already\x20exists:\x20','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','__manual__','/smartapi/custom/saveUserCustomSql','utf8','dbId\x20must\x20be\x20a\x20positive\x20integer','131JpBZtG','<server-generated-sqlCode>','sqlRoot','\x20\x20SELECT\x201\x20AS\x20id','SQL\x20name:','Plain\x20SQL\x20(sql)','mode','nonInteractive','975107hYewkU','appCode','name','dbId','4446959PPgCoM','SQL\x20name\x20cannot\x20be\x20empty','dbId\x20cannot\x20be\x20empty','trim','4602816ryvvgr','toISOString','isInteger','MyBatis\x20XML\x20(mybatisXml)','validation','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','stringify','dbName','171471TzrgDQ','10keOjHU','join','str','number','catch','3682656joxYUp','mybatisXml','isFinite','6EaVdDz','sqlCode','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','✎\x20Enter\x20dbId\x20manually','sqlRootDir','</select>','4POSdKs','Select\x20the\x20target\x20database:','1594775JTjQTD'];a247_0x26b3=function(){return _0x5ccf4e;};return a247_0x26b3();}async function resolveSqlNameInput(_0x58e2c3){const _0x302be0=a247_0x517cef,_0x2166e3=_0x58e2c3['str'](_0x302be0(0xb0))[_0x302be0(0xb5)]();if(_0x2166e3)return _0x2166e3;if(_0x58e2c3['nonInteractive'])throw CliErrors[_0x302be0(0x9b)](_0x302be0(0xb0),_0x302be0(0x8d));return(await input({'message':_0x302be0(0xaa),'validate':_0x52233a=>_0x52233a[_0x302be0(0xb5)]()?!![]:_0x302be0(0xb3)}))['trim']();}async function resolveDbSelection(_0x156a84){const _0x8e88de=a247_0x517cef,_0x5694d6=resolveProvidedDbId(_0x156a84);if(typeof _0x5694d6===_0x8e88de(0x84)&&Number[_0x8e88de(0x88)](_0x5694d6)&&_0x5694d6>0x0)return{'dbId':_0x5694d6,'dbName':await getDbName(_0x156a84[_0x8e88de(0xaf)],_0x5694d6)[_0x8e88de(0x85)](()=>undefined)};if(_0x156a84[_0x8e88de(0xad)])throw CliErrors[_0x8e88de(0x9b)](_0x8e88de(0x9f),_0x8e88de(0x8b));const _0x32064b=await listDatabases(_0x156a84[_0x8e88de(0xaf)])[_0x8e88de(0x85)](()=>[]);if(_0x32064b[_0x8e88de(0x99)]===0x1)return{'dbId':_0x32064b[0x0][_0x8e88de(0xb1)],'dbName':_0x32064b[0x0][_0x8e88de(0x7f)]};if(_0x32064b[_0x8e88de(0x99)]>0x1){const _0x44b7b0=await select({'message':_0x8e88de(0x92),'choices':[..._0x32064b['map'](_0x74d856=>({'name':_0x74d856[_0x8e88de(0x7f)]+'\x20('+_0x74d856[_0x8e88de(0xb1)]+')','value':serializeDbSelection(_0x74d856)})),{'name':_0x8e88de(0x8e),'value':'__manual__'}]});if(_0x44b7b0!==_0x8e88de(0xa2))return deserializeDbSelection(_0x44b7b0);}const _0xa7c522=await input({'message':_0x8e88de(0x9a),'validate':_0x27d20a=>{const _0x1b3f17=_0x8e88de,_0x13e07d=_0x27d20a[_0x1b3f17(0xb5)]();if(!_0x13e07d)return _0x1b3f17(0xb4);const _0x8716b=Number(_0x13e07d);if(!Number[_0x1b3f17(0xb8)](_0x8716b)||_0x8716b<=0x0)return _0x1b3f17(0xa5);return!![];}});return{'dbId':Number(_0xa7c522[_0x8e88de(0xb5)]())};}async function resolveSqlModeInput(_0x117647){const _0x1921a6=a247_0x517cef,_0xdce764=_0x117647['str'](_0x1921a6(0xac))['trim']();if(_0xdce764===_0x1921a6(0x9d)||_0xdce764===_0x1921a6(0x87))return _0xdce764;if(_0x117647[_0x1921a6(0xad)])throw CliErrors[_0x1921a6(0x9b)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':_0x1921a6(0xab),'value':_0x1921a6(0x9d),'description':_0x1921a6(0x8c)},{'name':_0x1921a6(0xb9),'value':_0x1921a6(0x87),'description':_0x1921a6(0x7d)}]});}function serializeDbSelection(_0x54c3e5){const _0x459ff4=a247_0x517cef;return JSON[_0x459ff4(0x7e)]({'dbId':_0x54c3e5[_0x459ff4(0xb1)],'dbName':_0x54c3e5[_0x459ff4(0x7f)]});}function deserializeDbSelection(_0x132099){const _0x359386=a247_0x517cef;try{const _0x4c5554=JSON['parse'](_0x132099);if(typeof _0x4c5554['dbId']==='number'&&Number['isFinite'](_0x4c5554[_0x359386(0xb1)]))return{'dbId':_0x4c5554[_0x359386(0xb1)],'dbName':_0x4c5554[_0x359386(0x7f)]};}catch{}throw CliErrors[_0x359386(0xba)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x132099);}function resolveProvidedDbId(_0x572ffc){const _0x384728=a247_0x517cef,_0x237b5d=_0x572ffc['flag'](_0x384728(0x9f));if(typeof _0x237b5d===_0x384728(0x84)&&Number[_0x384728(0x88)](_0x237b5d))return _0x237b5d;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a248_0x3e17ad=a248_0x46dc;(function(_0x4e578f,_0xd187f7){const _0x45991e=a248_0x46dc,_0x4450a4=_0x4e578f();while(!![]){try{const _0x431283=parseInt(_0x45991e(0x187))/0x1*(parseInt(_0x45991e(0x19b))/0x2)+-parseInt(_0x45991e(0x18f))/0x3+-parseInt(_0x45991e(0x191))/0x4+-parseInt(_0x45991e(0x192))/0x5*(parseInt(_0x45991e(0x199))/0x6)+-parseInt(_0x45991e(0x176))/0x7*(parseInt(_0x45991e(0x181))/0x8)+parseInt(_0x45991e(0x182))/0x9*(-parseInt(_0x45991e(0x19a))/0xa)+parseInt(_0x45991e(0x183))/0xb*(parseInt(_0x45991e(0x18a))/0xc);if(_0x431283===_0xd187f7)break;else _0x4450a4['push'](_0x4450a4['shift']());}catch(_0x503fa3){_0x4450a4['push'](_0x4450a4['shift']());}}}(a248_0x1900,0x364f3));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a248_0x3e17ad(0x17e),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a248_0x3e17ad(0x178),'flags':[SQLCODE_FLAG],async 'validate'(_0x37fb5b){const _0x14f740=a248_0x3e17ad,_0x16d612=loadSqlProjectConfig(_0x37fb5b[_0x14f740(0x18d)]),_0x1be8d7=await readSqlLockFile(_0x16d612[_0x14f740(0x177)]);if(!_0x1be8d7)throw CliErrors[_0x14f740(0x17f)](_0x14f740(0x175));},async 'dryRun'(_0x3fad43){const _0x2a3d83=a248_0x3e17ad,_0x316602=loadSqlProjectConfig(_0x3fad43[_0x2a3d83(0x18d)]),_0xdd83ef=await readSqlLockFile(_0x316602[_0x2a3d83(0x177)]);if(!_0xdd83ef)throw CliErrors[_0x2a3d83(0x17f)](_0x2a3d83(0x175));const {appLock:_0x27a740}=ensureSqlLockScope(_0xdd83ef,_0x3fad43[_0x2a3d83(0x18d)],_0x316602['sqlRoot'],_0x2a3d83(0x17e)),_0x4930d2=_0x3fad43[_0x2a3d83(0x17d)](_0x2a3d83(0x190)),_0x41b62f=_0x27a740[_0x2a3d83(0x194)][_0x4930d2];if(!_0x41b62f)throw CliErrors[_0x2a3d83(0x17f)](_0x2a3d83(0x196)+_0x4930d2+'\x22.');return{'method':_0x2a3d83(0x17b),'url':_0x2a3d83(0x179),'body':{'sqlCode':_0x4930d2,'id':_0x41b62f[_0x2a3d83(0x193)],'localPath':resolveLocalSqlFilePath(_0x316602,_0x4930d2,_0x41b62f)},'description':_0x2a3d83(0x18c)+_0x4930d2+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x316602[_0x2a3d83(0x184)]};},async 'execute'(_0x5a7be3){const _0x506de5=a248_0x3e17ad,_0x51eba1=loadSqlProjectConfig(_0x5a7be3[_0x506de5(0x18d)]),_0x1655c3=await readSqlLockFile(_0x51eba1[_0x506de5(0x177)]);if(!_0x1655c3)throw CliErrors[_0x506de5(0x17f)](_0x506de5(0x197));const {lockData:_0x1aa23c,appLock:_0x3635ce}=ensureSqlLockScope(_0x1655c3,_0x5a7be3[_0x506de5(0x18d)],_0x51eba1[_0x506de5(0x17a)],_0x506de5(0x17e)),_0x2739f4=_0x5a7be3['str'](_0x506de5(0x190)),_0x39e5c6=_0x3635ce[_0x506de5(0x194)][_0x2739f4];if(!_0x39e5c6)throw CliErrors[_0x506de5(0x17f)](_0x506de5(0x196)+_0x2739f4+'\x22.');await deleteSqlQuery({'id':_0x39e5c6[_0x506de5(0x193)],'sqlCode':_0x2739f4}),_0x3635ce[_0x506de5(0x194)]=Object[_0x506de5(0x189)](Object['entries'](_0x3635ce[_0x506de5(0x194)])[_0x506de5(0x180)](([_0x4a29aa])=>_0x4a29aa!==_0x2739f4)),_0x3635ce[_0x506de5(0x18e)]=new Date()[_0x506de5(0x17c)](),await writeSqlLockFile(_0x51eba1['lockFilePath'],_0x1aa23c);const _0x2c24ed=resolveLocalSqlFilePath(_0x51eba1,_0x2739f4,_0x39e5c6);let _0x4fdcaa;await fileExists(_0x2c24ed)&&(_0x4fdcaa=await moveToTrash(_0x51eba1[_0x506de5(0x185)],_0x51eba1[_0x506de5(0x184)],_0x2c24ed),await cleanupEmptyDirectories(dirname(_0x2c24ed),_0x51eba1[_0x506de5(0x18b)]));const _0x5bb2bd={'deleted':_0x2739f4,'remoteId':_0x39e5c6['remoteId']};if(_0x4fdcaa)_0x5bb2bd[_0x506de5(0x188)]=_0x4fdcaa;return{'ok':!![],'data':_0x5bb2bd,'message':_0x506de5(0x198)+_0x2739f4+(_0x4fdcaa?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a248_0x46dc(_0x1bd0d3,_0x40fb53){_0x1bd0d3=_0x1bd0d3-0x175;const _0x1900a0=a248_0x1900();let _0x46dcda=_0x1900a0[_0x1bd0d3];return _0x46dcda;}function a248_0x1900(){const _0x44113e=['trashDir','projectRoot','replace','21xCrWBY','trashedTo','fromEntries','12XNKUCj','sqlRootDir','Would\x20delete\x20SQL\x20','appCode','lastSync','756150NoUJId','sqlcode','461908AkJvAb','3115eUnJuQ','remoteId','sqls','length','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','SQL\x20lock\x20file\x20not\x20found.','Deleted\x20','2226rsafkZ','10nLsjfS','34250JxJNZV','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','28SiWXiu','lockFilePath','high-risk-write','/smartapi/custom/deleteUserCustomSql','sqlRoot','POST','toISOString','str','delete','validation','filter','653928RemxGO','1184823deFHWU','10121067dzEUcV'];a248_0x1900=function(){return _0x44113e;};return a248_0x1900();}async function moveToTrash(_0x456c81,_0x47d42,_0x5311aa){const _0x133b54=a248_0x3e17ad,_0x51baf1=new Date()['toISOString']()[_0x133b54(0x186)](/[:.]/g,'-'),_0x563e96=relative(_0x456c81,_0x5311aa),_0x2a5ffa=join(_0x47d42,_0x51baf1,_0x563e96);return await mkdir(dirname(_0x2a5ffa),{'recursive':!![]}),await rename(_0x5311aa,_0x2a5ffa),_0x2a5ffa;}async function cleanupEmptyDirectories(_0x4a4f0d,_0x1572e5){const _0x10ea41=a248_0x3e17ad;let _0x39b7d1=resolve(_0x4a4f0d);const _0x563d35=resolve(_0x1572e5);while(_0x39b7d1['startsWith'](''+_0x563d35+sep)||_0x39b7d1===_0x563d35){if(_0x39b7d1===_0x563d35)return;try{const _0x5556d0=await readdir(_0x39b7d1);if(_0x5556d0[_0x10ea41(0x195)]>0x0)return;await rmdir(_0x39b7d1);}catch{return;}_0x39b7d1=dirname(_0x39b7d1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a249_0x275c11=a249_0x8d5f;(function(_0x41667d,_0x31412f){const _0x5cea19=a249_0x8d5f,_0x4de49a=_0x41667d();while(!![]){try{const _0x132cba=-parseInt(_0x5cea19(0x124))/0x1+-parseInt(_0x5cea19(0x11f))/0x2*(-parseInt(_0x5cea19(0x12a))/0x3)+-parseInt(_0x5cea19(0x127))/0x4*(-parseInt(_0x5cea19(0x12c))/0x5)+-parseInt(_0x5cea19(0x125))/0x6+-parseInt(_0x5cea19(0x12b))/0x7+parseInt(_0x5cea19(0x131))/0x8+-parseInt(_0x5cea19(0x126))/0x9;if(_0x132cba===_0x31412f)break;else _0x4de49a['push'](_0x4de49a['shift']());}catch(_0x2563eb){_0x4de49a['push'](_0x4de49a['shift']());}}}(a249_0xf3ff,0xa73d9));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x275c11(0x123),'command':'detail','description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a249_0x275c11(0x128),'type':a249_0x275c11(0x11e),'description':a249_0x275c11(0x12d)}],async 'execute'(_0x2427b5){const _0x5dc767=a249_0x275c11,_0x3cfba4=await getSqlQueryInfo(_0x2427b5['appCode'],_0x2427b5[_0x5dc767(0x122)]('sqlcode')),_0x406283=_0x2427b5[_0x5dc767(0x129)](_0x5dc767(0x128));if(_0x406283)return{'ok':!![],'data':_0x3cfba4};const _0x177096=_0x3cfba4['dbId']?await getDbName(_0x2427b5[_0x5dc767(0x120)],_0x3cfba4[_0x5dc767(0x12e)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3cfba4[_0x5dc767(0x130)],'sqlName':_0x3cfba4['sqlName'],'db':_0x177096?_0x177096+'\x20('+_0x3cfba4[_0x5dc767(0x12e)]+')':_0x3cfba4['dbId']??'','description':_0x3cfba4[_0x5dc767(0x12f)]??'','sqlContent':_0x3cfba4[_0x5dc767(0x121)]??''}};}};function a249_0x8d5f(_0x242ba9,_0x10b6d5){_0x242ba9=_0x242ba9-0x11e;const _0xf3ff5d=a249_0xf3ff();let _0x8d5f4e=_0xf3ff5d[_0x242ba9];return _0x8d5f4e;}function a249_0xf3ff(){const _0x2c08bd=['appCode','sqlContent','str','sql','65192JUiLLO','1302228lJRKLz','7219026zCsSma','621872sjRhXN','verbose','bool','822828yTcpFT','1135652obNxgU','40XOBteJ','Return\x20full\x20raw\x20SQL\x20query\x20object','dbId','description','sqlCode','1114408LTHfcH','boolean','4FRYgeQ'];a249_0xf3ff=function(){return _0x2c08bd;};return a249_0xf3ff();}
|