@lovrabet/rabetbase-cli 2.5.4 → 2.5.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.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-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +39 -0
- package/skills/rabetbase-page-generation/references/component-baseline.md +18 -0
- package/skills/rabetbase-page-generation/references/generation.md +126 -0
- package/skills/rabetbase-page-generation/templates/onepage/build.mjs +48 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/index.jsx +4 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/index.jsx +194 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/index.jsx +721 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/editor.jsx +395 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/model.js +141 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/page.css +377 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/record-layout.jsx +90 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/responsive.jsx +70 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/README.md +21 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/index.jsx +4 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/preview.png +0 -0
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a224_0x13a989=a224_0x3862;(function(_0x3d750c,_0x3eeaf8){const _0x1ec2ad=a224_0x3862,_0x1278ef=_0x3d750c();while(!![]){try{const _0x3b27a7=parseInt(_0x1ec2ad(0xb8))/0x1+-parseInt(_0x1ec2ad(0xc7))/0x2+-parseInt(_0x1ec2ad(0xeb))/0x3+parseInt(_0x1ec2ad(0xd2))/0x4*(-parseInt(_0x1ec2ad(0xc5))/0x5)+parseInt(_0x1ec2ad(0xba))/0x6+-parseInt(_0x1ec2ad(0xd1))/0x7*(parseInt(_0x1ec2ad(0xea))/0x8)+parseInt(_0x1ec2ad(0xd3))/0x9;if(_0x3b27a7===_0x3eeaf8)break;else _0x1278ef['push'](_0x1278ef['shift']());}catch(_0x5df6ab){_0x1278ef['push'](_0x1278ef['shift']());}}}(a224_0x10bc,0x3e6ca));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';function a224_0x10bc(){const _0x3491d8=['flagMissing','Role\x20name','string','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','expectUserCount','No\x20tenant\x20member\x20matches\x20\x22','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','Disambiguate\x20with\x20--role\x20<id>.','nickname','push','Missing\x20user\x20reference.','Pass\x20--role\x20<id|name>.','Role\x20id\x20or\x20exact\x20role\x20name','Anti-drift\x20check\x20failed:\x20expected\x20','Pass\x20--user\x20<id|name>.','Cannot\x20',';\x20no\x20change.','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','ADMIN','user','510258dDlwqm','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','2081046pQSyMt','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','includes','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','dryRun','OWNER','role','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','\x20duplicate\x20memberships\x20for\x20user\x20','validation','\x20is\x20already\x20a\x20member\x20of\x20role\x20','720740HxFwQT','remark','391520doLJaB','/smartapi/permit/user-role/create','dev','totalCount','appCode','user-add','expect-user-count','test','DEV','\x20members\x20of\x20the\x20OWNER\x20role.','8218IwaZoF','12gDrkHQ','5955597rMrNMk','filter','name','trim','map','userId','\x20built-in\x20role\x20','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Multiple\x20tenant\x20members\x20match\x20\x22','\x22:\x20','tenant_code','str','Role\x20name\x20\x22','Role\x20id\x20','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','username','CUSTOM','toLowerCase','roleType','number','roleName','Check\x20the\x20nickname/username.\x20','User\x20','1552zXDLQT','1221546EpSTxM','length','join','\x20is\x20not\x20a\x20member\x20of\x20role\x20'];a224_0x10bc=function(){return _0x3491d8;};return a224_0x10bc();}export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a224_0x13a989(0xc0),'type':a224_0x13a989(0xf1),'required':!![],'description':a224_0x13a989(0xfb)};export const USER_REF_FLAG={'name':'user','type':a224_0x13a989(0xf1),'required':!![],'description':a224_0x13a989(0xda)};export const NAME_FLAG={'name':a224_0x13a989(0xd5),'type':a224_0x13a989(0xf1),'required':!![],'description':a224_0x13a989(0xf0)};export const USER_NAME_FLAG={'name':a224_0x13a989(0xd5),'type':a224_0x13a989(0xf1),'required':!![],'description':a224_0x13a989(0xc1)};export const REMARK_FLAG={'name':a224_0x13a989(0xc6),'type':'string','required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a224_0x13a989(0xcd),'type':a224_0x13a989(0xe6),'required':![],'description':a224_0x13a989(0xbd)};export const BUILTIN_ROLE_TYPES=[a224_0x13a989(0x101),a224_0x13a989(0xcf),a224_0x13a989(0xbf)];export function isBuiltinRole(_0x34331b){return BUILTIN_ROLE_TYPES['includes'](_0x34331b);}export function assertCustomRole(_0x558208,_0x1058e0){const _0x20f4e4=a224_0x13a989;if(_0x558208[_0x20f4e4(0xe5)]!==_0x20f4e4(0xe3))throw CliErrors[_0x20f4e4(0xc3)](_0x20f4e4(0xfe)+_0x1058e0+_0x20f4e4(0xd9)+_0x558208['roleName']+'\x20('+_0x558208[_0x20f4e4(0xe5)]+').',_0x20f4e4(0xbb));}export function projectRole(_0x552e1e){const _0x32f6c7=a224_0x13a989;return{'id':_0x552e1e['id'],'roleName':_0x552e1e['roleName'],'roleType':_0x552e1e[_0x32f6c7(0xe5)],'remark':_0x552e1e[_0x32f6c7(0xc6)],'userCount':_0x552e1e['userCount'],'permitCount':_0x552e1e['permitCount'],'builtin':isBuiltinRole(_0x552e1e[_0x32f6c7(0xe5)])};}export async function resolveRoleRef(_0x4fbf47,_0x38a803){const _0x246ddc=a224_0x13a989,_0x2f5085=_0x38a803[_0x246ddc(0xd6)]();if(!_0x2f5085)throw CliErrors[_0x246ddc(0xc3)]('Missing\x20role\x20reference.',_0x246ddc(0xfa));if(/^\d+$/[_0x246ddc(0xce)](_0x2f5085))return getRoleById(_0x4fbf47,Number(_0x2f5085));const _0xe52568=await listAllAppRoles(_0x4fbf47),_0x215c81=_0xe52568['filter'](_0x4ba6ed=>_0x4ba6ed[_0x246ddc(0xe7)]===_0x2f5085);if(_0x215c81[_0x246ddc(0xec)]===0x0)throw CliErrors[_0x246ddc(0xc3)](_0x246ddc(0xdf)+_0x2f5085+'\x22\x20not\x20found\x20in\x20app\x20'+_0x4fbf47+'.',_0x246ddc(0xf2));if(_0x215c81['length']>0x1){const _0x10da1f=_0x215c81[_0x246ddc(0xd7)](_0x8f35f9=>_0x8f35f9['id'])[_0x246ddc(0xed)](',\x20');throw CliErrors[_0x246ddc(0xc3)](_0x246ddc(0xdf)+_0x2f5085+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x10da1f+').',_0x246ddc(0xf6));}return _0x215c81[0x0];}export async function getRoleById(_0x89ead5,_0x385935){const _0x5164b2=a224_0x13a989,_0x29527c=await listAllAppRoles(_0x89ead5),_0x5ed7ae=_0x29527c['filter'](_0x1ae5b6=>_0x1ae5b6['id']===_0x385935&&(!_0x1ae5b6[_0x5164b2(0xcb)]||_0x1ae5b6[_0x5164b2(0xcb)]===_0x89ead5));if(_0x5ed7ae['length']!==0x1)throw CliErrors[_0x5164b2(0xc3)](_0x5164b2(0xe0)+_0x385935+'\x20not\x20found\x20in\x20app\x20'+_0x89ead5+'.',_0x5164b2(0xb9));return _0x5ed7ae[0x0];}async function listAllAppRoles(_0x11b06a){const _0x3e5722=a224_0x13a989,_0x4b3298=0x64,_0x1844b1=[];for(let _0x5dddd8=0x1;;_0x5dddd8+=0x1){const {items:_0x233a77,paging:_0x5588b6}=await listAppRoles(_0x11b06a,{'currentPage':_0x5dddd8,'pageSize':_0x4b3298});_0x1844b1[_0x3e5722(0xf8)](..._0x233a77);if(_0x233a77['length']<_0x4b3298||_0x5588b6&&_0x1844b1[_0x3e5722(0xec)]>=_0x5588b6[_0x3e5722(0xca)])return _0x1844b1;}}export async function resolveTenantCode(){const _0xd467eb=a224_0x13a989,_0x183c70=await getSessionUserInfo(),_0x49a378=_0x183c70?.[_0xd467eb(0x102)]?.['tenant']?.[_0xd467eb(0xdd)];if(!_0x49a378)throw CliErrors['authRequired'](_0xd467eb(0xe1));return _0x49a378;}function matchMember(_0x177ee8,_0x284817){const _0x43e3ff=a224_0x13a989,_0x3ad84b=_0x284817['trim']()[_0x43e3ff(0xe4)]();return(_0x177ee8[_0x43e3ff(0xf7)]??'')[_0x43e3ff(0xe4)]()===_0x3ad84b||(_0x177ee8['username']??'')[_0x43e3ff(0xe4)]()===_0x3ad84b;}export async function resolveUserRef(_0x282482,_0x229115='Pass\x20--user\x20<id>.'){const _0x25187c=a224_0x13a989,_0x47f415=_0x282482[_0x25187c(0xd6)]();if(!_0x47f415)throw CliErrors['validation'](_0x25187c(0xf9),'Pass\x20--user\x20<id|name>.');const _0xf39834=await resolveTenantCode(),_0x47811e=await getTenantMembers(_0xf39834);if(/^\d+$/['test'](_0x47f415)){const _0x4a59ad=Number(_0x47f415),_0x5c1567=_0x47811e['find'](_0x80ec02=>_0x80ec02[_0x25187c(0xd8)]===_0x4a59ad);return{'userId':_0x4a59ad,'username':_0x5c1567?.[_0x25187c(0xe2)]??String(_0x4a59ad),'nickname':_0x5c1567?.[_0x25187c(0xf7)],'matchedBy':'id'};}const _0x38d031=_0x47811e[_0x25187c(0xd4)](_0x448984=>matchMember(_0x448984,_0x47f415));if(_0x38d031['length']===0x0)throw CliErrors[_0x25187c(0xc3)](_0x25187c(0xf4)+_0x47f415+'\x22.',_0x25187c(0xe8)+_0x229115);if(_0x38d031[_0x25187c(0xec)]>0x1){const _0x243847=_0x38d031[_0x25187c(0xd7)](_0x2b63dd=>(_0x2b63dd[_0x25187c(0xf7)]??_0x2b63dd[_0x25187c(0xe2)]??'?')+'('+_0x2b63dd[_0x25187c(0xd8)]+')')[_0x25187c(0xed)](',\x20');throw CliErrors['validation'](_0x25187c(0xdb)+_0x47f415+_0x25187c(0xdc)+_0x243847+'.',_0x229115);}const _0x4b3668=_0x38d031[0x0];return{'userId':_0x4b3668[_0x25187c(0xd8)],'username':_0x4b3668[_0x25187c(0xe2)]??String(_0x4b3668['userId']),'nickname':_0x4b3668['nickname'],'matchedBy':_0x25187c(0xd5)};}export const CREATE_USER_ROLE_PATH=a224_0x13a989(0xc8);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';function a224_0x3862(_0x560146,_0x5a7f4e){_0x560146=_0x560146-0xb8;const _0x10bce1=a224_0x10bc();let _0x3862b4=_0x10bce1[_0x560146];return _0x3862b4;}export function computeRoleUserMutation(_0x7c936f){const _0x4bd4fc=a224_0x13a989,{operation:_0x3dc7e7,appCode:_0x4a19fd,role:_0x2a4949,relations:_0x5bf429,user:_0x103820}=_0x7c936f,_0x4003c2=[...new Set(_0x5bf429[_0x4bd4fc(0xd7)](_0x402a16=>_0x402a16['userId']))],_0x21c3d2=[];if(_0x7c936f[_0x4bd4fc(0xf3)]!==undefined&&_0x7c936f[_0x4bd4fc(0xf3)]!==_0x4003c2['length'])throw CliErrors[_0x4bd4fc(0xc3)](_0x4bd4fc(0xfc)+_0x7c936f[_0x4bd4fc(0xf3)]+'\x20member(s)\x20but\x20role\x20has\x20'+_0x4003c2[_0x4bd4fc(0xec)]+'.',_0x4bd4fc(0xf5));const _0x405259=_0x4003c2[_0x4bd4fc(0xbc)](_0x103820[_0x4bd4fc(0xd8)]),_0x42fdaa=_0x5bf429[_0x4bd4fc(0xd4)](_0x4252bb=>_0x4252bb[_0x4bd4fc(0xd8)]===_0x103820[_0x4bd4fc(0xd8)])[_0x4bd4fc(0xd7)](_0x5a5718=>_0x5a5718['id']),_0x14cc8f=_0x3dc7e7===_0x4bd4fc(0xcc)?!_0x405259:_0x405259;let _0xdef93c=_0x4003c2;_0x3dc7e7==='user-add'?_0x405259?_0x21c3d2[_0x4bd4fc(0xf8)](_0x4bd4fc(0xe9)+_0x103820['userId']+_0x4bd4fc(0xc4)+_0x2a4949[_0x4bd4fc(0xe7)]+_0x4bd4fc(0xff)):_0xdef93c=[..._0x4003c2,_0x103820[_0x4bd4fc(0xd8)]]:!_0x405259?_0x21c3d2['push'](_0x4bd4fc(0xe9)+_0x103820[_0x4bd4fc(0xd8)]+_0x4bd4fc(0xee)+_0x2a4949[_0x4bd4fc(0xe7)]+';\x20no\x20change.'):(_0xdef93c=_0x4003c2[_0x4bd4fc(0xd4)](_0x2fde82=>_0x2fde82!==_0x103820[_0x4bd4fc(0xd8)]),_0x42fdaa[_0x4bd4fc(0xec)]>0x1&&_0x21c3d2['push']('Removed\x20'+_0x42fdaa['length']+_0x4bd4fc(0xc2)+_0x103820[_0x4bd4fc(0xd8)]+'.'));const _0xfef06d={'scope':_0x4bd4fc(0xc9),'operation':_0x3dc7e7,'selector':{'appCode':_0x4a19fd,'roleId':_0x2a4949['id'],'roleName':_0x2a4949[_0x4bd4fc(0xe7)],'userId':_0x103820[_0x4bd4fc(0xd8)]},'before':{'userIds':_0x4003c2},'after':{'userIds':_0xdef93c},'dryRun':_0x7c936f[_0x4bd4fc(0xbe)],'backend':{'method':'POST','path':_0x3dc7e7===_0x4bd4fc(0xcc)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x21c3d2};return{'mutation':_0xfef06d,'changed':_0x14cc8f,'matchingRelationIds':_0x42fdaa};}export async function loadDevRoleRelations(_0x346e4a,_0x484887){const _0x2cafde=a224_0x13a989,_0x4f479f=0x64,_0x197634=[];for(let _0xd44399=0x1;;_0xd44399+=0x1){const {items:_0x102670,paging:_0x461099}=await listDevUserRoleRelations(_0x346e4a,{'roleId':_0x484887,'currentPage':_0xd44399,'pageSize':_0x4f479f});_0x197634['push'](..._0x102670);if(_0x102670[_0x2cafde(0xec)]<_0x4f479f||_0x461099&&_0x197634[_0x2cafde(0xec)]>=_0x461099[_0x2cafde(0xca)])return _0x197634;}}export function readRoleRef(_0xfd6f83){const _0x1ebec6=a224_0x13a989,_0x14c8da=_0xfd6f83[_0x1ebec6(0xde)](_0x1ebec6(0xc0))[_0x1ebec6(0xd6)]();if(!_0x14c8da)throw CliErrors[_0x1ebec6(0xef)](_0x1ebec6(0xc0),_0x1ebec6(0xfa));return _0x14c8da;}export async function prepareUserMutation(_0x1110c4,_0x42870c,_0x5aebe9){const _0x2e52e6=a224_0x13a989,_0x29adf8=readRoleRef(_0x1110c4),_0x4cc5c3=_0x1110c4[_0x2e52e6(0xde)](_0x2e52e6(0x102))[_0x2e52e6(0xd6)]();if(!_0x4cc5c3)throw CliErrors[_0x2e52e6(0xef)](_0x2e52e6(0x102),_0x2e52e6(0xfd));const _0x488be6=_0x1110c4['flag'](_0x2e52e6(0xcd)),_0x15cd91=_0x488be6===undefined||_0x488be6===null?undefined:Number(_0x488be6),_0xe39348=await resolveRoleRef(_0x1110c4[_0x2e52e6(0xcb)],_0x29adf8);if(_0xe39348['roleType']===_0x2e52e6(0xbf))throw CliErrors['validation'](_0x2e52e6(0xfe)+_0x42870c+_0x2e52e6(0xd0),_0x2e52e6(0x100));const _0x161078=await resolveUserRef(_0x4cc5c3),_0x33f0ae=await loadDevRoleRelations(_0x1110c4['appCode'],_0xe39348['id']);return{...computeRoleUserMutation({'operation':_0x42870c,'appCode':_0x1110c4[_0x2e52e6(0xcb)],'role':_0xe39348,'relations':_0x33f0ae,'user':{'userId':_0x161078[_0x2e52e6(0xd8)],'username':_0x161078[_0x2e52e6(0xe2)],'nickname':_0x161078['nickname']},'dryRun':_0x5aebe9,..._0x15cd91!==undefined?{'expectUserCount':_0x15cd91}:{}}),'role':_0xe39348,'user':_0x161078};}
|
|
1
|
+
const a224_0x50c7b6=a224_0x19d9;(function(_0x3b37b4,_0x55986a){const _0x4f3e7f=a224_0x19d9,_0x431276=_0x3b37b4();while(!![]){try{const _0x11eac2=-parseInt(_0x4f3e7f(0xce))/0x1+parseInt(_0x4f3e7f(0xf9))/0x2*(-parseInt(_0x4f3e7f(0xd4))/0x3)+parseInt(_0x4f3e7f(0xcd))/0x4*(parseInt(_0x4f3e7f(0xfb))/0x5)+parseInt(_0x4f3e7f(0xf3))/0x6+parseInt(_0x4f3e7f(0xdd))/0x7+-parseInt(_0x4f3e7f(0xb1))/0x8+parseInt(_0x4f3e7f(0xf1))/0x9*(parseInt(_0x4f3e7f(0xdb))/0xa);if(_0x11eac2===_0x55986a)break;else _0x431276['push'](_0x431276['shift']());}catch(_0x42d487){_0x431276['push'](_0x431276['shift']());}}}(a224_0x446f,0x9c87e));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a224_0x50c7b6(0xf8),'required':!![],'description':a224_0x50c7b6(0xf7)};export const ROLE_REF_FLAG={'name':a224_0x50c7b6(0xbb),'type':a224_0x50c7b6(0xd1),'required':!![],'description':a224_0x50c7b6(0xf6)};export const USER_REF_FLAG={'name':a224_0x50c7b6(0xd3),'type':'string','required':!![],'description':a224_0x50c7b6(0xf5)};function a224_0x19d9(_0x2d8918,_0x3de1de){_0x2d8918=_0x2d8918-0xb1;const _0x446f79=a224_0x446f();let _0x19d9ec=_0x446f79[_0x2d8918];return _0x19d9ec;}export const NAME_FLAG={'name':a224_0x50c7b6(0xc8),'type':a224_0x50c7b6(0xd1),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a224_0x50c7b6(0xc8),'type':a224_0x50c7b6(0xd1),'required':!![],'description':a224_0x50c7b6(0xc0)};export const REMARK_FLAG={'name':a224_0x50c7b6(0xed),'type':a224_0x50c7b6(0xd1),'required':![],'description':a224_0x50c7b6(0xd5)};export const EXPECT_USER_COUNT_FLAG={'name':a224_0x50c7b6(0xb7),'type':a224_0x50c7b6(0xf8),'required':![],'description':a224_0x50c7b6(0xfa)};export const BUILTIN_ROLE_TYPES=[a224_0x50c7b6(0xfd),'DEV',a224_0x50c7b6(0xe2)];export function isBuiltinRole(_0x1a379c){return BUILTIN_ROLE_TYPES['includes'](_0x1a379c);}export function assertCustomRole(_0x2c488e,_0x42b27e){const _0x4c5258=a224_0x50c7b6;if(_0x2c488e['roleType']!=='CUSTOM')throw CliErrors[_0x4c5258(0xe5)](_0x4c5258(0xdc)+_0x42b27e+_0x4c5258(0xd9)+_0x2c488e[_0x4c5258(0xb3)]+'\x20('+_0x2c488e['roleType']+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x22f2a2){const _0x3dbd60=a224_0x50c7b6;return{'id':_0x22f2a2['id'],'roleName':_0x22f2a2['roleName'],'roleType':_0x22f2a2[_0x3dbd60(0xea)],'remark':_0x22f2a2[_0x3dbd60(0xed)],'userCount':_0x22f2a2['userCount'],'permitCount':_0x22f2a2[_0x3dbd60(0xc2)],'builtin':isBuiltinRole(_0x22f2a2[_0x3dbd60(0xea)])};}export async function resolveRoleRef(_0x241567,_0x473bfa){const _0x4077b6=a224_0x50c7b6,_0xdcaf59=_0x473bfa[_0x4077b6(0xc5)]();if(!_0xdcaf59)throw CliErrors[_0x4077b6(0xe5)]('Missing\x20role\x20reference.',_0x4077b6(0xf4));if(/^\d+$/[_0x4077b6(0xd8)](_0xdcaf59))return getRoleById(_0x241567,Number(_0xdcaf59));const _0x512a37=await listAllAppRoles(_0x241567),_0x2f906e=_0x512a37['filter'](_0x8be6aa=>_0x8be6aa['roleName']===_0xdcaf59);if(_0x2f906e[_0x4077b6(0xbc)]===0x0)throw CliErrors[_0x4077b6(0xe5)](_0x4077b6(0xe7)+_0xdcaf59+_0x4077b6(0xee)+_0x241567+'.',_0x4077b6(0xb4));if(_0x2f906e[_0x4077b6(0xbc)]>0x1){const _0x438f09=_0x2f906e[_0x4077b6(0xdf)](_0x7fc79f=>_0x7fc79f['id'])[_0x4077b6(0xf2)](',\x20');throw CliErrors['validation'](_0x4077b6(0xe7)+_0xdcaf59+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x438f09+').',_0x4077b6(0xcc));}return _0x2f906e[0x0];}export async function getRoleById(_0x36c622,_0x3a4961){const _0x507605=a224_0x50c7b6,_0x2dd75c=await listAllAppRoles(_0x36c622),_0x27f641=_0x2dd75c[_0x507605(0xef)](_0x3039ce=>_0x3039ce['id']===_0x3a4961&&(!_0x3039ce[_0x507605(0xda)]||_0x3039ce['appCode']===_0x36c622));if(_0x27f641[_0x507605(0xbc)]!==0x1)throw CliErrors['validation']('Role\x20id\x20'+_0x3a4961+_0x507605(0xd0)+_0x36c622+'.',_0x507605(0xe1));return _0x27f641[0x0];}async function listAllAppRoles(_0x54da40){const _0x5ee92d=a224_0x50c7b6,_0x1c78ac=0x64,_0x171c98=[];for(let _0x686489=0x1;;_0x686489+=0x1){const {items:_0x2f761c,paging:_0x548ede}=await listAppRoles(_0x54da40,{'currentPage':_0x686489,'pageSize':_0x1c78ac});_0x171c98[_0x5ee92d(0xf0)](..._0x2f761c);if(_0x2f761c[_0x5ee92d(0xbc)]<_0x1c78ac||_0x548ede&&_0x171c98['length']>=_0x548ede[_0x5ee92d(0xc4)])return _0x171c98;}}export async function resolveTenantCode(){const _0x43faed=a224_0x50c7b6,_0x25362e=await getSessionUserInfo(),_0xec094b=_0x25362e?.['user']?.['tenant']?.[_0x43faed(0xb6)];if(!_0xec094b)throw CliErrors[_0x43faed(0xbf)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0xec094b;}function matchMember(_0x2fcde6,_0x394b89){const _0x5ba77b=a224_0x50c7b6,_0x5d20bd=_0x394b89[_0x5ba77b(0xc5)]()[_0x5ba77b(0xe6)]();return(_0x2fcde6[_0x5ba77b(0xb9)]??'')['toLowerCase']()===_0x5d20bd||(_0x2fcde6[_0x5ba77b(0xc3)]??'')[_0x5ba77b(0xe6)]()===_0x5d20bd;}export async function resolveUserRef(_0x2cd59d,_0x58a366=a224_0x50c7b6(0xe8)){const _0x254365=a224_0x50c7b6,_0xd8fcd6=_0x2cd59d['trim']();if(!_0xd8fcd6)throw CliErrors[_0x254365(0xe5)]('Missing\x20user\x20reference.',_0x254365(0xba));const _0x5f121b=await resolveTenantCode(),_0x514b01=await getTenantMembers(_0x5f121b);if(/^\d+$/[_0x254365(0xd8)](_0xd8fcd6)){const _0x31439b=Number(_0xd8fcd6),_0x54acea=_0x514b01[_0x254365(0xde)](_0xb3d89e=>_0xb3d89e[_0x254365(0xfe)]===_0x31439b);return{'userId':_0x31439b,'username':_0x54acea?.[_0x254365(0xc3)]??String(_0x31439b),'nickname':_0x54acea?.['nickname'],'matchedBy':'id'};}const _0x2c115f=_0x514b01[_0x254365(0xef)](_0x5e680c=>matchMember(_0x5e680c,_0xd8fcd6));if(_0x2c115f[_0x254365(0xbc)]===0x0)throw CliErrors[_0x254365(0xe5)](_0x254365(0xe9)+_0xd8fcd6+'\x22.',_0x254365(0xb8)+_0x58a366);if(_0x2c115f['length']>0x1){const _0x148a32=_0x2c115f['map'](_0x16bb50=>(_0x16bb50[_0x254365(0xb9)]??_0x16bb50[_0x254365(0xc3)]??'?')+'('+_0x16bb50[_0x254365(0xfe)]+')')[_0x254365(0xf2)](',\x20');throw CliErrors[_0x254365(0xe5)](_0x254365(0xe4)+_0xd8fcd6+_0x254365(0xbe)+_0x148a32+'.',_0x58a366);}const _0x74d0a4=_0x2c115f[0x0];return{'userId':_0x74d0a4[_0x254365(0xfe)],'username':_0x74d0a4[_0x254365(0xc3)]??String(_0x74d0a4[_0x254365(0xfe)]),'nickname':_0x74d0a4[_0x254365(0xb9)],'matchedBy':_0x254365(0xc8)};}export const CREATE_USER_ROLE_PATH=a224_0x50c7b6(0xc6);export const DELETE_USER_ROLE_PATH=a224_0x50c7b6(0xc7);export function computeRoleUserMutation(_0x4e074f){const _0x2458c9=a224_0x50c7b6,{operation:_0x9eb2df,appCode:_0x178813,role:_0x4598f6,relations:_0x860bf7,user:_0x5c7db3}=_0x4e074f,_0x261115=[...new Set(_0x860bf7['map'](_0x3516b4=>_0x3516b4[_0x2458c9(0xfe)]))],_0x248813=[];if(_0x4e074f[_0x2458c9(0xe0)]!==undefined&&_0x4e074f['expectUserCount']!==_0x261115[_0x2458c9(0xbc)])throw CliErrors[_0x2458c9(0xe5)](_0x2458c9(0xd6)+_0x4e074f['expectUserCount']+_0x2458c9(0xcb)+_0x261115['length']+'.',_0x2458c9(0xcf));const _0x278e08=_0x261115[_0x2458c9(0xff)](_0x5c7db3[_0x2458c9(0xfe)]),_0x33aafe=_0x860bf7[_0x2458c9(0xef)](_0x5dc532=>_0x5dc532[_0x2458c9(0xfe)]===_0x5c7db3[_0x2458c9(0xfe)])[_0x2458c9(0xdf)](_0x1d67c5=>_0x1d67c5['id']),_0x1a0af2=_0x9eb2df===_0x2458c9(0xec)?!_0x278e08:_0x278e08;let _0x3be15e=_0x261115;_0x9eb2df===_0x2458c9(0xec)?_0x278e08?_0x248813[_0x2458c9(0xf0)](_0x2458c9(0xeb)+_0x5c7db3[_0x2458c9(0xfe)]+_0x2458c9(0xb5)+_0x4598f6[_0x2458c9(0xb3)]+_0x2458c9(0xfc)):_0x3be15e=[..._0x261115,_0x5c7db3['userId']]:!_0x278e08?_0x248813[_0x2458c9(0xf0)](_0x2458c9(0xeb)+_0x5c7db3[_0x2458c9(0xfe)]+_0x2458c9(0xd2)+_0x4598f6[_0x2458c9(0xb3)]+_0x2458c9(0xfc)):(_0x3be15e=_0x261115[_0x2458c9(0xef)](_0x3abd36=>_0x3abd36!==_0x5c7db3[_0x2458c9(0xfe)]),_0x33aafe['length']>0x1&&_0x248813[_0x2458c9(0xf0)](_0x2458c9(0xc1)+_0x33aafe['length']+_0x2458c9(0xb2)+_0x5c7db3[_0x2458c9(0xfe)]+'.'));const _0x299897={'scope':_0x2458c9(0xca),'operation':_0x9eb2df,'selector':{'appCode':_0x178813,'roleId':_0x4598f6['id'],'roleName':_0x4598f6[_0x2458c9(0xb3)],'userId':_0x5c7db3[_0x2458c9(0xfe)]},'before':{'userIds':_0x261115},'after':{'userIds':_0x3be15e},'dryRun':_0x4e074f['dryRun'],'backend':{'method':'POST','path':_0x9eb2df===_0x2458c9(0xec)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x248813};return{'mutation':_0x299897,'changed':_0x1a0af2,'matchingRelationIds':_0x33aafe};}export async function loadDevRoleRelations(_0x1e8db5,_0x16c89a){const _0x1f31e1=a224_0x50c7b6,_0x155fbc=0x64,_0x579678=[];for(let _0x3ad49d=0x1;;_0x3ad49d+=0x1){const {items:_0x371ff7,paging:_0x2c9be5}=await listDevUserRoleRelations(_0x1e8db5,{'roleId':_0x16c89a,'currentPage':_0x3ad49d,'pageSize':_0x155fbc});_0x579678['push'](..._0x371ff7);if(_0x371ff7[_0x1f31e1(0xbc)]<_0x155fbc||_0x2c9be5&&_0x579678[_0x1f31e1(0xbc)]>=_0x2c9be5[_0x1f31e1(0xc4)])return _0x579678;}}export function readRoleRef(_0x547f5f){const _0xbf1ed=a224_0x50c7b6,_0x535b0d=_0x547f5f['str'](_0xbf1ed(0xbb))['trim']();if(!_0x535b0d)throw CliErrors[_0xbf1ed(0xc9)](_0xbf1ed(0xbb),_0xbf1ed(0xf4));return _0x535b0d;}export async function prepareUserMutation(_0x1613bb,_0x50b3ad,_0x175534){const _0x4640b7=a224_0x50c7b6,_0x302f6a=readRoleRef(_0x1613bb),_0x50c945=_0x1613bb[_0x4640b7(0xbd)](_0x4640b7(0xd3))[_0x4640b7(0xc5)]();if(!_0x50c945)throw CliErrors[_0x4640b7(0xc9)]('user',_0x4640b7(0xba));const _0x20e083=_0x1613bb[_0x4640b7(0xe3)](_0x4640b7(0xb7)),_0x16bbdb=_0x20e083===undefined||_0x20e083===null?undefined:Number(_0x20e083),_0x616991=await resolveRoleRef(_0x1613bb[_0x4640b7(0xda)],_0x302f6a);if(_0x616991['roleType']==='OWNER')throw CliErrors['validation'](_0x4640b7(0xdc)+_0x50b3ad+_0x4640b7(0xd7),'Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x572cf3=await resolveUserRef(_0x50c945),_0x3acc53=await loadDevRoleRelations(_0x1613bb[_0x4640b7(0xda)],_0x616991['id']);return{...computeRoleUserMutation({'operation':_0x50b3ad,'appCode':_0x1613bb['appCode'],'role':_0x616991,'relations':_0x3acc53,'user':{'userId':_0x572cf3['userId'],'username':_0x572cf3[_0x4640b7(0xc3)],'nickname':_0x572cf3[_0x4640b7(0xb9)]},'dryRun':_0x175534,..._0x16bbdb!==undefined?{'expectUserCount':_0x16bbdb}:{}}),'role':_0x616991,'user':_0x572cf3};}function a224_0x446f(){const _0x4debe4=['nickname','Pass\x20--user\x20<id|name>.','role','length','str','\x22:\x20','authRequired','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Removed\x20','permitCount','username','totalCount','trim','/smartapi/permit/user-role/create','/smartapi/permit/user-role/delete','name','flagMissing','dev','\x20member(s)\x20but\x20role\x20has\x20','Disambiguate\x20with\x20--role\x20<id>.','14756JXFpuS','349327DtOTJt','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','\x20not\x20found\x20in\x20app\x20','string','\x20is\x20not\x20a\x20member\x20of\x20role\x20','user','3807267MURSrd','Optional\x20role\x20remark/description','Anti-drift\x20check\x20failed:\x20expected\x20','\x20members\x20of\x20the\x20OWNER\x20role.','test','\x20built-in\x20role\x20','appCode','13862170KwgHdQ','Cannot\x20','3619658KXTzXj','find','map','expectUserCount','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','OWNER','flag','Multiple\x20tenant\x20members\x20match\x20\x22','validation','toLowerCase','Role\x20name\x20\x22','Pass\x20--user\x20<id>.','No\x20tenant\x20member\x20matches\x20\x22','roleType','User\x20','user-add','remark','\x22\x20not\x20found\x20in\x20app\x20','filter','push','9cFBykf','join','377262fLRKwY','Pass\x20--role\x20<id|name>.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Role\x20id\x20or\x20exact\x20role\x20name','Role\x20id\x20(from\x20`role\x20list`)','number','2kKwnUd','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','1270SbFNwR',';\x20no\x20change.','ADMIN','userId','includes','5149024hEdqzH','\x20duplicate\x20memberships\x20for\x20user\x20','roleName','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','\x20is\x20already\x20a\x20member\x20of\x20role\x20','tenant_code','expect-user-count','Check\x20the\x20nickname/username.\x20'];a224_0x446f=function(){return _0x4debe4;};return a224_0x446f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a225_0x3c695b=a225_0x357c;(function(_0x5eaec8,_0xf3583f){const _0x4dcc57=a225_0x357c,_0x2719c1=_0x5eaec8();while(!![]){try{const _0x4b16bc=-parseInt(_0x4dcc57(0xeb))/0x1*(parseInt(_0x4dcc57(0xef))/0x2)+-parseInt(_0x4dcc57(0xe4))/0x3*(parseInt(_0x4dcc57(0xe8))/0x4)+parseInt(_0x4dcc57(0xe6))/0x5*(parseInt(_0x4dcc57(0xf4))/0x6)+-parseInt(_0x4dcc57(0xf1))/0x7+-parseInt(_0x4dcc57(0xea))/0x8+parseInt(_0x4dcc57(0xee))/0x9+parseInt(_0x4dcc57(0xdd))/0xa;if(_0x4b16bc===_0xf3583f)break;else _0x2719c1['push'](_0x2719c1['shift']());}catch(_0x3f4a08){_0x2719c1['push'](_0x2719c1['shift']());}}}(a225_0x4793,0xb35b4));import{updateAppRole}from'../../core/api-client.js';function a225_0x4793(){const _0x324fef=['New\x20role\x20name','dev','1139973JJbNpn','num','537545cynnKu','string','12xMMtPw','/smartapi/permit/role/update','6391424kIBAZf','87898HSfwVo','write','POST','6762807VFBAIt','26AqlCOH','trim','10091361bKwadn','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','name','30AHrEZX','remark','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','validation','update','flag','39688740zZwDgE','roleName','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','appCode','length'];a225_0x4793=function(){return _0x324fef;};return a225_0x4793();}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a225_0x3c695b(0xe9);function a225_0x357c(_0x51c109,_0x513f25){_0x51c109=_0x51c109-0xda;const _0x4793f2=a225_0x4793();let _0x357cab=_0x4793f2[_0x51c109];return _0x357cab;}function readPatch(_0x52439f){const _0x27600f=a225_0x3c695b,_0x157f6e=_0x52439f[_0x27600f(0xdc)](_0x27600f(0xf3)),_0x54684a=_0x52439f[_0x27600f(0xdc)](_0x27600f(0xf5)),_0x55a031={};if(_0x157f6e!==undefined&&_0x157f6e!==null){const _0x5d3727=String(_0x157f6e)[_0x27600f(0xf0)]();if(!_0x5d3727)throw CliErrors[_0x27600f(0xda)]('--name\x20cannot\x20be\x20empty.');if(_0x5d3727[_0x27600f(0xe1)]>0x40)throw CliErrors[_0x27600f(0xda)](_0x27600f(0xf2));_0x55a031['roleName']=_0x5d3727;}_0x54684a!==undefined&&_0x54684a!==null&&(_0x55a031[_0x27600f(0xf5)]=String(_0x54684a));if(_0x55a031['roleName']===undefined&&_0x55a031[_0x27600f(0xf5)]===undefined)throw CliErrors['validation']('Nothing\x20to\x20update.',_0x27600f(0xf6));return _0x55a031;}export const roleUpdate={'service':'role','command':'update','description':a225_0x3c695b(0xdf),'risk':a225_0x3c695b(0xec),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a225_0x3c695b(0xe7),'required':![],'description':a225_0x3c695b(0xe2)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x310930){readPatch(_0x310930);},async 'dryRun'(_0x1a8463){const _0x5c6717=a225_0x3c695b,_0x4c81cd=_0x1a8463[_0x5c6717(0xe5)]('id'),_0x5dac2e=readPatch(_0x1a8463),_0x2df0a8=await getRoleById(_0x1a8463['appCode'],_0x4c81cd);return assertCustomRole(_0x2df0a8,_0x5c6717(0xdb)),asDryRunResult({'scope':_0x5c6717(0xe3),'operation':_0x5c6717(0xdb),'selector':{'appCode':_0x1a8463[_0x5c6717(0xe0)],'roleId':_0x4c81cd,'roleName':_0x2df0a8[_0x5c6717(0xde)]},'before':projectRole(_0x2df0a8),'after':projectRole({..._0x2df0a8,..._0x5dac2e[_0x5c6717(0xde)]!==undefined?{'roleName':_0x5dac2e[_0x5c6717(0xde)]}:{},..._0x5dac2e[_0x5c6717(0xf5)]!==undefined?{'remark':_0x5dac2e['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x5c6717(0xed),'path':UPDATE_PATH},'warnings':[]},{'method':_0x5c6717(0xed),'url':UPDATE_PATH});},async 'execute'(_0x4cf630){const _0x184020=a225_0x3c695b,_0x372afc=_0x4cf630[_0x184020(0xe5)]('id'),_0x4a2347=readPatch(_0x4cf630),_0x4108ce=await getRoleById(_0x4cf630[_0x184020(0xe0)],_0x372afc);assertCustomRole(_0x4108ce,_0x184020(0xdb)),await updateAppRole({'id':_0x372afc,'appCode':_0x4cf630[_0x184020(0xe0)],..._0x4a2347[_0x184020(0xde)]!==undefined?{'roleName':_0x4a2347[_0x184020(0xde)]}:{},..._0x4a2347['remark']!==undefined?{'remark':_0x4a2347[_0x184020(0xf5)]}:{}});const _0x24f88f=await getRoleById(_0x4cf630[_0x184020(0xe0)],_0x372afc);return{'ok':!![],'data':{'scope':_0x184020(0xe3),'operation':_0x184020(0xdb),'selector':{'appCode':_0x4cf630['appCode'],'roleId':_0x372afc,'roleName':_0x24f88f[_0x184020(0xde)]},'before':projectRole(_0x4108ce),'after':projectRole(_0x24f88f),'dryRun':![],'backend':{'method':_0x184020(0xed),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x24f88f['roleName']+'\x20(id='+_0x372afc+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a226_0x4c7438=a226_0x6446;(function(_0x2fc919,_0x163a99){const _0x138ba9=a226_0x6446,_0x75b1eb=_0x2fc919();while(!![]){try{const _0x483570=parseInt(_0x138ba9(0x1c4))/0x1*(parseInt(_0x138ba9(0x1d0))/0x2)+parseInt(_0x138ba9(0x1d7))/0x3+parseInt(_0x138ba9(0x1c6))/0x4*(parseInt(_0x138ba9(0x1c8))/0x5)+parseInt(_0x138ba9(0x1d4))/0x6*(-parseInt(_0x138ba9(0x1cb))/0x7)+-parseInt(_0x138ba9(0x1d2))/0x8+-parseInt(_0x138ba9(0x1ce))/0x9*(-parseInt(_0x138ba9(0x1c5))/0xa)+-parseInt(_0x138ba9(0x1c3))/0xb;if(_0x483570===_0x163a99)break;else _0x75b1eb['push'](_0x75b1eb['shift']());}catch(_0x542a71){_0x75b1eb['push'](_0x75b1eb['shift']());}}}(a226_0x5292,0x46573));import{createDevUserRole}from'../../core/api-client.js';function a226_0x5292(){const _0x540b8b=['91KxWRMH','username','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','232866MBemRg','appCode','6xjbNxk','roleName','2956776oaFfgT','role','152916NDHqdg','roleType','user-add','1586496QGGysx','userId','No\x20change:\x20user\x20','7547034uLFmNH','76062cfHuCf','210YixNoo','3136POPNhn','selector','2390adydhD','\x20already\x20in\x20role\x20','\x20to\x20role\x20'];a226_0x5292=function(){return _0x540b8b;};return a226_0x5292();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';function a226_0x6446(_0x32dd7e,_0x209fbc){_0x32dd7e=_0x32dd7e-0x1c3;const _0x52920f=a226_0x5292();let _0x6446b0=_0x52920f[_0x32dd7e];return _0x6446b0;}export const roleUserAdd={'service':a226_0x4c7438(0x1d3),'command':a226_0x4c7438(0x1d6),'description':a226_0x4c7438(0x1cd),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5af91c){const _0x1e58a7=a226_0x4c7438,{mutation:_0x53bdef}=await prepareUserMutation(_0x5af91c,_0x1e58a7(0x1d6),!![]);return asDryRunResult(_0x53bdef,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x338e91){const _0x2ecff8=a226_0x4c7438,{mutation:_0x23154d,changed:_0x575614,role:_0xc32b25,user:_0x423239}=await prepareUserMutation(_0x338e91,_0x2ecff8(0x1d6),![]);return _0x575614&&await createDevUserRole({'appCode':_0x338e91[_0x2ecff8(0x1cf)],'userId':_0x423239[_0x2ecff8(0x1d8)],'username':_0x423239[_0x2ecff8(0x1cc)],'roleType':_0xc32b25[_0x2ecff8(0x1d5)],'roleId':_0x23154d['selector']['roleId']}),{'ok':!![],'data':_0x23154d,'message':_0x575614?'Added\x20user\x20'+_0x23154d[_0x2ecff8(0x1c7)][_0x2ecff8(0x1d8)]+_0x2ecff8(0x1ca)+_0x23154d[_0x2ecff8(0x1c7)][_0x2ecff8(0x1d1)]:_0x2ecff8(0x1d9)+_0x23154d[_0x2ecff8(0x1c7)][_0x2ecff8(0x1d8)]+_0x2ecff8(0x1c9)+_0x23154d[_0x2ecff8(0x1c7)][_0x2ecff8(0x1d1)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a227_0x40120a=a227_0x1506;(function(_0x7e2a82,_0x5ef23f){const _0x5aec15=a227_0x1506,_0x589205=_0x7e2a82();while(!![]){try{const _0xfccdd5=-parseInt(_0x5aec15(0x1e4))/0x1*(-parseInt(_0x5aec15(0x1ed))/0x2)+-parseInt(_0x5aec15(0x1e3))/0x3+-parseInt(_0x5aec15(0x1f3))/0x4*(-parseInt(_0x5aec15(0x1e6))/0x5)+-parseInt(_0x5aec15(0x1eb))/0x6*(parseInt(_0x5aec15(0x1e5))/0x7)+-parseInt(_0x5aec15(0x1f1))/0x8*(-parseInt(_0x5aec15(0x1ef))/0x9)+-parseInt(_0x5aec15(0x1ea))/0xa+-parseInt(_0x5aec15(0x1f5))/0xb;if(_0xfccdd5===_0x5ef23f)break;else _0x589205['push'](_0x589205['shift']());}catch(_0x5548e4){_0x589205['push'](_0x589205['shift']());}}}(a227_0x4d7a,0x72832));function a227_0x1506(_0x14afd2,_0x4c6033){_0x14afd2=_0x14afd2-0x1e1;const _0x4d7a0f=a227_0x4d7a();let _0x15066b=_0x4d7a0f[_0x14afd2];return _0x15066b;}import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a227_0x4d7a(){const _0x514a03=['2099086IhdhIb','\x20not\x20in\x20role\x20','selector','Removed\x20user\x20','2463708TuvpeI','3YElzwo','1143842MZWzsh','40OsnRji','roleName','userId','POST','616400gcPagn','12krJzUX','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','394416hWXHVG','high-risk-write','36WvOvFK','role','1057576YubFet','user-remove','374572FtGWYo','\x20from\x20role\x20'];a227_0x4d7a=function(){return _0x514a03;};return a227_0x4d7a();}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':a227_0x40120a(0x1f0),'command':a227_0x40120a(0x1f2),'description':a227_0x40120a(0x1ec),'risk':a227_0x40120a(0x1ee),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x1a2b54){const _0x50a8c0=a227_0x40120a,{mutation:_0x1d9ef0}=await prepareUserMutation(_0x1a2b54,_0x50a8c0(0x1f2),!![]);return asDryRunResult(_0x1d9ef0,{'method':_0x50a8c0(0x1e9),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x401839){const _0x20a259=a227_0x40120a,{matchingRelationIds:_0x2bf23f,mutation:_0xdd87f4,changed:_0x247834}=await prepareUserMutation(_0x401839,_0x20a259(0x1f2),![]);if(_0x247834)for(const _0x1d5553 of _0x2bf23f){await deleteDevUserRole(_0x1d5553);}return{'ok':!![],'data':_0xdd87f4,'message':_0x247834?_0x20a259(0x1e2)+_0xdd87f4[_0x20a259(0x1e1)]['userId']+_0x20a259(0x1f4)+_0xdd87f4[_0x20a259(0x1e1)][_0x20a259(0x1e7)]:'No\x20change:\x20user\x20'+_0xdd87f4[_0x20a259(0x1e1)][_0x20a259(0x1e8)]+_0x20a259(0x1f6)+_0xdd87f4['selector'][_0x20a259(0x1e7)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a228_0x4547fc=a228_0x4f45;(function(_0x4add68,_0xc7102e){const _0x5c8268=a228_0x4f45,_0x2280e5=_0x4add68();while(!![]){try{const _0x161e95=-parseInt(_0x5c8268(0x87))/0x1+parseInt(_0x5c8268(0x86))/0x2*(parseInt(_0x5c8268(0x79))/0x3)+-parseInt(_0x5c8268(0x85))/0x4*(-parseInt(_0x5c8268(0x7e))/0x5)+parseInt(_0x5c8268(0x78))/0x6+parseInt(_0x5c8268(0x7d))/0x7+-parseInt(_0x5c8268(0x7f))/0x8+parseInt(_0x5c8268(0x7b))/0x9*(-parseInt(_0x5c8268(0x75))/0xa);if(_0x161e95===_0xc7102e)break;else _0x2280e5['push'](_0x2280e5['shift']());}catch(_0x3b5102){_0x2280e5['push'](_0x2280e5['shift']());}}}(a228_0x3e4e,0xba7a8));import{CliErrors}from'../../errors.js';function a228_0x3e4e(){const _0x1c7411=['824FhReYQ','38RFVdhq','268754iqczpF','str','10195280PjcAFv','flagMissing','userId','8219976GcuOrW','21963VUTbBo','nickname','9cGeiDv','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','5389342XfnaHm','30665dAycMk','11922408sPumVg','read','name','trim','role','matchedBy'];a228_0x3e4e=function(){return _0x1c7411;};return a228_0x3e4e();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';function a228_0x4f45(_0x5c41e9,_0x419c58){_0x5c41e9=_0x5c41e9-0x75;const _0x3e4ee1=a228_0x3e4e();let _0x4f4542=_0x3e4ee1[_0x5c41e9];return _0x4f4542;}export const roleUserResolve={'service':a228_0x4547fc(0x83),'command':'user-resolve','description':a228_0x4547fc(0x7c),'risk':a228_0x4547fc(0x80),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x46dceb){const _0x688d1f=a228_0x4547fc;if(!_0x46dceb[_0x688d1f(0x88)]('name')['trim']())throw CliErrors[_0x688d1f(0x76)](_0x688d1f(0x81),'Pass\x20--name\x20<nickname|username>.');},async 'execute'(_0x1bbefe){const _0x2cc67c=a228_0x4547fc,_0x564582=_0x1bbefe[_0x2cc67c(0x88)](_0x2cc67c(0x81))[_0x2cc67c(0x82)](),_0x272d3d=await resolveUserRef(_0x564582,'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':_0x272d3d[_0x2cc67c(0x77)],'username':_0x272d3d['username'],'nickname':_0x272d3d[_0x2cc67c(0x7a)],'matchedBy':_0x272d3d[_0x2cc67c(0x84)]}},'message':'Resolved\x20\x22'+_0x564582+'\x22\x20→\x20userId\x20'+_0x272d3d[_0x2cc67c(0x77)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a229_0x4d6edc=a229_0x56ed;function a229_0x56ed(_0x36f087,_0x309729){_0x36f087=_0x36f087-0x1b8;const _0x37a51b=a229_0x37a5();let _0x56ed3e=_0x37a51b[_0x36f087];return _0x56ed3e;}(function(_0x574c8e,_0x21ef74){const _0x2a23f5=a229_0x56ed,_0x5f3c84=_0x574c8e();while(!![]){try{const _0x44fcbf=-parseInt(_0x2a23f5(0x1cc))/0x1*(parseInt(_0x2a23f5(0x1c1))/0x2)+-parseInt(_0x2a23f5(0x1c6))/0x3*(parseInt(_0x2a23f5(0x1c8))/0x4)+parseInt(_0x2a23f5(0x1b8))/0x5*(parseInt(_0x2a23f5(0x1c7))/0x6)+-parseInt(_0x2a23f5(0x1bc))/0x7+-parseInt(_0x2a23f5(0x1ba))/0x8*(parseInt(_0x2a23f5(0x1bf))/0x9)+-parseInt(_0x2a23f5(0x1c5))/0xa+parseInt(_0x2a23f5(0x1cd))/0xb;if(_0x44fcbf===_0x21ef74)break;else _0x5f3c84['push'](_0x5f3c84['shift']());}catch(_0x4c8c35){_0x5f3c84['push'](_0x5f3c84['shift']());}}}(a229_0x37a5,0x9eb07));import{getAppRule}from'../../core/api-client.js';function a229_0x37a5(){const _0x1b41c2=['appCode','680yYuiSu','content','1970752BHqNOF','\x20is\x20not\x20configured\x20for\x20app\x20','read','59463HpwBfK','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','785870BlGeKl','cookie','rule','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','15180xnRSgz','21lnsBAp','1428GwMyiC','351692GWgZJW','Loaded\x20','app_rule_not_found','get','2xlisbJ','25810719kPOOoT','\x20--file\x20<path>\x20--dry-run`.','11545gEFHeL'];a229_0x37a5=function(){return _0x1b41c2;};return a229_0x37a5();}import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a229_0x4d6edc(0x1c3),'command':a229_0x4d6edc(0x1cb),'description':a229_0x4d6edc(0x1c4),'risk':a229_0x4d6edc(0x1be),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x83d8e){readAppRuleType(_0x83d8e);},async 'execute'(_0x510df9){const _0x4ff776=a229_0x4d6edc,_0x6170eb=readAppRuleType(_0x510df9),_0x4196b8=await getAppRule(_0x510df9[_0x4ff776(0x1c2)],{'appCode':_0x510df9['appCode'],'type':_0x6170eb});if(!_0x4196b8)throw appRuleError(_0x4ff776(0x1ca),appRuleFileName(_0x6170eb)+_0x4ff776(0x1bd)+_0x510df9[_0x4ff776(0x1b9)]+'.',_0x4ff776(0x1c0)+_0x6170eb+_0x4ff776(0x1ce));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x6170eb,_0x4196b8),'content':_0x4196b8[_0x4ff776(0x1bb)]}},'message':_0x4ff776(0x1c9)+appRuleFileName(_0x6170eb)+'\x20for\x20'+_0x510df9['appCode']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x29868b,_0x37e60b){const _0x7278e4=a230_0x51ec,_0x152bbb=_0x29868b();while(!![]){try{const _0x173357=-parseInt(_0x7278e4(0xac))/0x1*(-parseInt(_0x7278e4(0xab))/0x2)+parseInt(_0x7278e4(0xb1))/0x3*(-parseInt(_0x7278e4(0xa9))/0x4)+parseInt(_0x7278e4(0xae))/0x5+-parseInt(_0x7278e4(0xb2))/0x6*(parseInt(_0x7278e4(0xa8))/0x7)+parseInt(_0x7278e4(0xa6))/0x8*(-parseInt(_0x7278e4(0xb0))/0x9)+-parseInt(_0x7278e4(0xa7))/0xa*(parseInt(_0x7278e4(0xad))/0xb)+parseInt(_0x7278e4(0xaa))/0xc*(parseInt(_0x7278e4(0xaf))/0xd);if(_0x173357===_0x37e60b)break;else _0x152bbb['push'](_0x152bbb['shift']());}catch(_0x318b2e){_0x152bbb['push'](_0x152bbb['shift']());}}}(a230_0x6c91,0xe5b84));import{ruleGet}from'../../commands/rule/get.js';function a230_0x51ec(_0x10eaed,_0x449758){_0x10eaed=_0x10eaed-0xa6;const _0x6c916=a230_0x6c91();let _0x51ece1=_0x6c916[_0x10eaed];return _0x51ece1;}import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';function a230_0x6c91(){const _0x3ab0b2=['8cADTyC','10hmMpLT','20363yIWOIf','11612BDfQYc','2720052ZoAuzn','2WjpEcm','1597870IJzCLW','16109412WOipIY','8246235rexdQl','169aZywDm','12247623BYyArn','723erDSQA','3564NXioYW'];a230_0x6c91=function(){return _0x3ab0b2;};return a230_0x6c91();}export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a231_0x2c76(_0x5e3617,_0x397c7a){_0x5e3617=_0x5e3617-0x13c;const _0x2005af=a231_0x2005();let _0x2c76a3=_0x2005af[_0x5e3617];return _0x2c76a3;}const a231_0x56ba95=a231_0x2c76;(function(_0x21383a,_0x3250f5){const _0x224f7c=a231_0x2c76,_0x55de81=_0x21383a();while(!![]){try{const _0x1a5944=-parseInt(_0x224f7c(0x13c))/0x1+-parseInt(_0x224f7c(0x13f))/0x2*(-parseInt(_0x224f7c(0x13d))/0x3)+-parseInt(_0x224f7c(0x148))/0x4*(parseInt(_0x224f7c(0x14f))/0x5)+-parseInt(_0x224f7c(0x147))/0x6+parseInt(_0x224f7c(0x149))/0x7*(-parseInt(_0x224f7c(0x141))/0x8)+-parseInt(_0x224f7c(0x143))/0x9*(-parseInt(_0x224f7c(0x14a))/0xa)+parseInt(_0x224f7c(0x14e))/0xb*(parseInt(_0x224f7c(0x140))/0xc);if(_0x1a5944===_0x3250f5)break;else _0x55de81['push'](_0x55de81['shift']());}catch(_0x59272f){_0x55de81['push'](_0x55de81['shift']());}}}(a231_0x2005,0x9c840));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a231_0x2005(){const _0x599645=['9896uWOJuR','all','2745126yZScPg','map','Loaded\x20app\x20rule\x20configuration\x20for\x20','cookie','6183942UEeDIG','42376ovAdUS','2058wxIKvh','40HjkIUJ','read','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','rule','11VQfdQB','40jhnSoF','appCode','395415hlkQUW','78ZTeOvZ','list','54956UnOjyq','6973272melUyl'];a231_0x2005=function(){return _0x599645;};return a231_0x2005();}export const ruleList={'service':a231_0x56ba95(0x14d),'command':a231_0x56ba95(0x13e),'description':a231_0x56ba95(0x14c),'risk':a231_0x56ba95(0x14b),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x203917){const _0x9d45ca=a231_0x56ba95,_0x3bcffb=await Promise[_0x9d45ca(0x142)](APP_RULE_TYPES[_0x9d45ca(0x144)](_0x1728f3=>getAppRule(_0x203917[_0x9d45ca(0x146)],{'appCode':_0x203917[_0x9d45ca(0x150)],'type':_0x1728f3}))),_0x3b6d9a=APP_RULE_TYPES[_0x9d45ca(0x144)]((_0x35a908,_0xb03843)=>projectAppRule(_0x35a908,_0x3bcffb[_0xb03843]??null));return{'ok':!![],'data':{'total':_0x3b6d9a['length'],'rules':_0x3b6d9a},'message':_0x9d45ca(0x145)+_0x203917['appCode']};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a232_0x5e068d=a232_0x5b4b;(function(_0x2f84e8,_0x15a51a){const _0x2e3b1a=a232_0x5b4b,_0x3abee8=_0x2f84e8();while(!![]){try{const _0x298d49=-parseInt(_0x2e3b1a(0xbf))/0x1*(-parseInt(_0x2e3b1a(0xd5))/0x2)+-parseInt(_0x2e3b1a(0xc7))/0x3+-parseInt(_0x2e3b1a(0xb9))/0x4+parseInt(_0x2e3b1a(0xbd))/0x5*(parseInt(_0x2e3b1a(0xb2))/0x6)+parseInt(_0x2e3b1a(0xe2))/0x7*(parseInt(_0x2e3b1a(0xd0))/0x8)+parseInt(_0x2e3b1a(0xcd))/0x9*(parseInt(_0x2e3b1a(0xdd))/0xa)+-parseInt(_0x2e3b1a(0xbc))/0xb*(parseInt(_0x2e3b1a(0xb7))/0xc);if(_0x298d49===_0x15a51a)break;else _0x3abee8['push'](_0x3abee8['shift']());}catch(_0xf8e072){_0x3abee8['push'](_0x3abee8['shift']());}}}(a232_0x2222,0x92487));function a232_0x5b4b(_0x507771,_0x152c16){_0x507771=_0x507771-0xa6;const _0x22225a=a232_0x2222();let _0x5b4b1c=_0x22225a[_0x507771];return _0x5b4b1c;}import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';const SAVE_PATH=a232_0x5e068d(0xd7),NON_ATOMIC_WARNING='--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.';function a232_0x2222(){const _0x1f5b30=[';\x20current\x20version\x20is\x20','cause','verified','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','520532MUCvhl','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','/smartapi/knowledge-base/save','flag','expectedVersion','string','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','before','10axTsUm','\x20--format\x20compress','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','set','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','35WVmwAC','type','\x20version\x20changed\x20before\x20write.','\x20could\x20not\x20be\x20verified.','app_rule_verification_failed','POST','Expected\x20','rabetbase\x20rule\x20get\x20--type\x20','contentHash','write','input','content','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','isSafeInteger','3378NdvEmO','beforeRecord','app_rule_file_required','replacement','Set\x20','48ODjeoy','version','1085884VIQqkx','push','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','6959018tMyuCA','9785poMDjR','app_rule_expected_version_invalid','4Aueoro','app_rule_set_outcome_unknown','str','defineProperty','appCode','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','Pass\x20a\x20UTF-8\x20Markdown\x20file.','rule','436440AsJJJq','app_rule_verification_unavailable','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','cookie','number','file','9973602KyOrRK','rules','expected-version','473032BNUZhc'];a232_0x2222=function(){return _0x1f5b30;};return a232_0x2222();}function readSetInput(_0x400acd){const _0x4034be=a232_0x5e068d,_0x1cb0f4=readAppRuleType(_0x400acd),_0x5e2c4b=_0x400acd[_0x4034be(0xc1)](_0x4034be(0xcc))['trim']();if(!_0x5e2c4b)throw appRuleError(_0x4034be(0xb4),'--file\x20is\x20required.',_0x4034be(0xc5));const _0x2ee15b=_0x400acd[_0x4034be(0xd8)](_0x4034be(0xcf));let _0x4d7569;if(_0x2ee15b!==undefined){_0x4d7569=Number(_0x2ee15b);if(!Number[_0x4034be(0xb1)](_0x4d7569)||_0x4d7569<0x0)throw appRuleError(_0x4034be(0xbe),'--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x1cb0f4,'file':_0x5e2c4b,'expectedVersion':_0x4d7569};}async function prepareSet(_0x2ea3fc){const _0x22499d=a232_0x5e068d,_0x5e3dd5=readSetInput(_0x2ea3fc),_0x27401a=await readAppRuleFile(_0x5e3dd5[_0x22499d(0xcc)]),_0x525092=await getAppRule(_0x2ea3fc['cookie'],{'appCode':_0x2ea3fc[_0x22499d(0xc3)],'type':_0x5e3dd5['type']});if(_0x5e3dd5[_0x22499d(0xd9)]!==undefined&&_0x525092?.[_0x22499d(0xb8)]!==_0x5e3dd5['expectedVersion'])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x5e3dd5[_0x22499d(0xe3)])+_0x22499d(0xa6),_0x22499d(0xaa)+_0x5e3dd5['expectedVersion']+_0x22499d(0xd1)+(_0x525092?.[_0x22499d(0xb8)]??'unconfigured')+_0x22499d(0xc9));return{'input':_0x5e3dd5,'replacement':_0x27401a,'beforeRecord':_0x525092,'before':projectAppRule(_0x5e3dd5[_0x22499d(0xe3)],_0x525092),'planned':{'type':_0x5e3dd5[_0x22499d(0xe3)],'fileName':appRuleFileName(_0x5e3dd5[_0x22499d(0xe3)]),'contextScope':appRuleContextScope(_0x5e3dd5['type']),'enabled':!![],'appCode':_0x2ea3fc[_0x22499d(0xc3)],'scope':_0x22499d(0xce),'contentByteSize':_0x27401a['byteSize'],'contentHash':_0x27401a[_0x22499d(0xac)]}};}function warningsFor(_0xcdfd7b){return _0xcdfd7b===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a232_0x5e068d(0xc6),'command':'set','description':a232_0x5e068d(0xdf),'risk':a232_0x5e068d(0xad),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a232_0x5e068d(0xcc),'type':a232_0x5e068d(0xda),'required':!![],'description':a232_0x5e068d(0xc4)},{'name':a232_0x5e068d(0xcf),'type':a232_0x5e068d(0xcb),'required':![],'description':a232_0x5e068d(0xe1)}],async 'validate'(_0x7b4479){readSetInput(_0x7b4479);},async 'dryRun'(_0x22b5fc){const _0x15dd2f=a232_0x5e068d,_0x4581cc=await prepareSet(_0x22b5fc);return asDryRunResult({'operation':_0x15dd2f(0xe0),'selector':{'appCode':_0x22b5fc[_0x15dd2f(0xc3)],'scope':_0x15dd2f(0xce),'type':_0x4581cc[_0x15dd2f(0xae)]['type']},'before':_0x4581cc[_0x15dd2f(0xdc)],'after':_0x4581cc['planned'],'dryRun':!![],'backend':{'method':_0x15dd2f(0xa9),'path':SAVE_PATH},'warnings':warningsFor(_0x4581cc[_0x15dd2f(0xae)][_0x15dd2f(0xd9)]),'verification':{'expectedVersion':_0x4581cc['input'][_0x15dd2f(0xd9)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x15dd2f(0xab)+_0x4581cc[_0x15dd2f(0xae)][_0x15dd2f(0xe3)]+_0x15dd2f(0xde)}},{'method':_0x15dd2f(0xa9),'url':SAVE_PATH});},async 'execute'(_0x3ca844){const _0x4ce2d1=a232_0x5e068d,_0x43e74b=await prepareSet(_0x3ca844);let _0xe506bc=![];try{await saveAppRule(_0x3ca844[_0x4ce2d1(0xca)],{'appCode':_0x3ca844['appCode'],'type':_0x43e74b[_0x4ce2d1(0xae)][_0x4ce2d1(0xe3)],'content':_0x43e74b[_0x4ce2d1(0xb5)][_0x4ce2d1(0xaf)]});}catch(_0x432afe){if(!isPlatformTransportFailure(_0x432afe))throw _0x432afe;_0xe506bc=!![];}let _0x1cc2f9;try{_0x1cc2f9=await getAppRule(_0x3ca844[_0x4ce2d1(0xca)],{'appCode':_0x3ca844['appCode'],'type':_0x43e74b[_0x4ce2d1(0xae)][_0x4ce2d1(0xe3)]});}catch(_0x151ebb){const _0x565179=appRuleError(_0xe506bc?_0x4ce2d1(0xc0):_0x4ce2d1(0xc8),'The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x43e74b[_0x4ce2d1(0xae)][_0x4ce2d1(0xe3)])+_0x4ce2d1(0xa7),_0x4ce2d1(0xb0));Object[_0x4ce2d1(0xc2)](_0x565179,_0x4ce2d1(0xd2),{'value':_0x151ebb,'enumerable':![]});throw _0x565179;}const _0xc32698=_0x1cc2f9&&inspectAppRuleContent(_0x1cc2f9['content'])[_0x4ce2d1(0xac)]===_0x43e74b['replacement']['contentHash'],_0x4020ef=_0x1cc2f9&&(_0x43e74b[_0x4ce2d1(0xb3)]===null||_0x1cc2f9[_0x4ce2d1(0xb8)]>_0x43e74b[_0x4ce2d1(0xb3)][_0x4ce2d1(0xb8)]);if(!_0x1cc2f9||!_0xc32698||!_0x4020ef)throw appRuleError(_0xe506bc?_0x4ce2d1(0xc0):_0x4ce2d1(0xa8),appRuleFileName(_0x43e74b['input']['type'])+_0x4ce2d1(0xd6),_0x4ce2d1(0xbb)+_0x43e74b[_0x4ce2d1(0xae)][_0x4ce2d1(0xe3)]+_0x4ce2d1(0xd4));const _0x4ce198=warningsFor(_0x43e74b[_0x4ce2d1(0xae)][_0x4ce2d1(0xd9)]);_0xe506bc&&_0x4ce198[_0x4ce2d1(0xba)](_0x4ce2d1(0xdb));const _0xbdf648=projectAppRule(_0x43e74b['input']['type'],_0x1cc2f9);return{'ok':!![],'data':{'operation':_0x4ce2d1(0xe0),'selector':{'appCode':_0x3ca844[_0x4ce2d1(0xc3)],'scope':_0x4ce2d1(0xce),'type':_0x43e74b[_0x4ce2d1(0xae)]['type']},'before':_0x43e74b[_0x4ce2d1(0xdc)],'after':_0xbdf648,'dryRun':![],'backend':{'method':_0x4ce2d1(0xa9),'path':SAVE_PATH},'warnings':_0x4ce198,'verification':{'status':_0x4ce2d1(0xd3),'recoveredAfterUnknownResponse':_0xe506bc,'expectedVersion':_0x43e74b[_0x4ce2d1(0xae)][_0x4ce2d1(0xd9)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x4ce2d1(0xab)+_0x43e74b[_0x4ce2d1(0xae)][_0x4ce2d1(0xe3)]+_0x4ce2d1(0xde)}},'message':_0x4ce2d1(0xb6)+appRuleFileName(_0x43e74b['input'][_0x4ce2d1(0xe3)])+'\x20for\x20'+_0x3ca844[_0x4ce2d1(0xc3)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a233_0x57d975=a233_0x265f;(function(_0x289b37,_0x285114){const _0x4a970a=a233_0x265f,_0x15ff3d=_0x289b37();while(!![]){try{const _0x3b1230=parseInt(_0x4a970a(0xad))/0x1*(-parseInt(_0x4a970a(0xd2))/0x2)+-parseInt(_0x4a970a(0xa4))/0x3*(parseInt(_0x4a970a(0xd5))/0x4)+-parseInt(_0x4a970a(0xbc))/0x5+parseInt(_0x4a970a(0xaa))/0x6*(parseInt(_0x4a970a(0xce))/0x7)+-parseInt(_0x4a970a(0xb7))/0x8*(parseInt(_0x4a970a(0xc0))/0x9)+parseInt(_0x4a970a(0xd6))/0xa*(parseInt(_0x4a970a(0xcd))/0xb)+parseInt(_0x4a970a(0xb1))/0xc*(parseInt(_0x4a970a(0xa5))/0xd);if(_0x3b1230===_0x285114)break;else _0x15ff3d['push'](_0x15ff3d['shift']());}catch(_0x22ec72){_0x15ff3d['push'](_0x15ff3d['shift']());}}}(a233_0x5c49,0x49626));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';function a233_0x5c49(){const _0x17abf1=['database-analysis','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','string','byteSize','996oBPImn','contentHash','digest','29266DIfhAo','app_rule_file_unreadable','utf8','hex','132badMnt','rules','app_rule_file_invalid','str','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','sha256:','792048aQzDOr','App\x20rule\x20file\x20is\x20blank:\x20','sha256','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','app_rule_content_too_large','2320855COjdWy','message','trim','updateTime','18efSJFk','byteLength','toLowerCase','app_rule_content_invalid','app_rule_file_required','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','--file\x20is\x20required.','database','decode','version','app_rule_type_invalid','Cannot\x20read\x20app\x20rule\x20file:\x20','scope','11GjKQtE','20146NNfiWx','type','RULES.md','createTime','6fgIQac','content','DATABASE.md','1104324gNgDwj','4746100PgjzUw','update','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','utf-8','Pass\x20a\x20UTF-8\x20Markdown\x20file.','3dGxkOd','442338XOaxMB'];a233_0x5c49=function(){return _0x17abf1;};return a233_0x5c49();}import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a233_0x57d975(0xb2),a233_0x57d975(0xc7)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a233_0x57d975(0xd0),'database':a233_0x57d975(0xd4)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a233_0x57d975(0xa6)};export function appRuleError(_0x825d10,_0x3b4929,_0xe4d4a5){return new CliError(_0x825d10,0x1,_0x3b4929,_0xe4d4a5);}export function readAppRuleType(_0x4e1a25){const _0x453e97=a233_0x57d975,_0x46f260=_0x4e1a25[_0x453e97(0xb4)](_0x453e97(0xcf))[_0x453e97(0xbe)]()[_0x453e97(0xc2)]();if(_0x46f260!==_0x453e97(0xb2)&&_0x46f260!==_0x453e97(0xc7))throw appRuleError(_0x453e97(0xca),_0x453e97(0xb5));return _0x46f260;}export function appRuleFileName(_0x56ccc6){return APP_RULE_FILES[_0x56ccc6];}function a233_0x265f(_0x40b8c0,_0x30140e){_0x40b8c0=_0x40b8c0-0xa3;const _0x5c4975=a233_0x5c49();let _0x265f67=_0x5c4975[_0x40b8c0];return _0x265f67;}export function appRuleContextScope(_0xaa775a){return APP_RULE_CONTEXT_SCOPES[_0xaa775a];}export function inspectAppRuleContent(_0x11a578){const _0x4be4f0=a233_0x57d975,_0x7bd2d5=Buffer['from'](_0x11a578,_0x4be4f0(0xaf));return{'content':_0x11a578,'byteSize':_0x7bd2d5[_0x4be4f0(0xc1)],'contentHash':_0x4be4f0(0xb6)+createHash(_0x4be4f0(0xb9))[_0x4be4f0(0xd7)](_0x7bd2d5)[_0x4be4f0(0xac)](_0x4be4f0(0xb0))};}export async function readAppRuleFile(_0x12ccc9){const _0x41260b=a233_0x57d975,_0x5b437d=_0x12ccc9['trim']();if(!_0x5b437d)throw appRuleError(_0x41260b(0xc4),_0x41260b(0xc6),_0x41260b(0xa3));const _0x217528=resolve(_0x5b437d);let _0x4b8609;try{_0x4b8609=await stat(_0x217528);}catch(_0x437b2a){throw appRuleError(_0x41260b(0xae),'Cannot\x20access\x20app\x20rule\x20file:\x20'+_0x5b437d,_0x437b2a instanceof Error?_0x437b2a[_0x41260b(0xbd)]:String(_0x437b2a));}if(!_0x4b8609['isFile']())throw appRuleError(_0x41260b(0xb3),_0x41260b(0xa7)+_0x5b437d);if(_0x4b8609['size']>MAX_APP_RULE_BYTES)throw appRuleError(_0x41260b(0xbb),_0x41260b(0xba));let _0x7740f;try{_0x7740f=await readFile(_0x217528);}catch(_0x55ebc7){throw appRuleError(_0x41260b(0xae),_0x41260b(0xcb)+_0x5b437d,_0x55ebc7 instanceof Error?_0x55ebc7[_0x41260b(0xbd)]:String(_0x55ebc7));}if(_0x7740f['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x41260b(0xbb),_0x41260b(0xba));let _0x58400e;try{_0x58400e=new TextDecoder(_0x41260b(0xd9),{'fatal':!![],'ignoreBOM':!![]})[_0x41260b(0xc8)](_0x7740f);}catch{throw appRuleError(_0x41260b(0xc3),_0x41260b(0xd8)+_0x5b437d);}if(!_0x58400e['trim']())throw appRuleError(_0x41260b(0xc3),_0x41260b(0xb8)+_0x5b437d);return inspectAppRuleContent(_0x58400e);}export function projectAppRule(_0x18485e,_0x5d65fb){const _0x36a837=a233_0x57d975;if(!_0x5d65fb)return{'type':_0x18485e,'fileName':appRuleFileName(_0x18485e),'contextScope':appRuleContextScope(_0x18485e),'enabled':![]};const _0x2d6137=inspectAppRuleContent(_0x5d65fb[_0x36a837(0xd3)]);return{'type':_0x18485e,'fileName':appRuleFileName(_0x18485e),'contextScope':appRuleContextScope(_0x18485e),'enabled':!![],'id':_0x5d65fb['id'],'scope':_0x5d65fb[_0x36a837(0xcc)],'appCode':_0x5d65fb['appCode'],'version':_0x5d65fb[_0x36a837(0xc9)],'contentByteSize':_0x2d6137[_0x36a837(0xa9)],'contentHash':_0x2d6137[_0x36a837(0xab)],..._0x5d65fb['createTime']!==undefined&&_0x5d65fb[_0x36a837(0xd1)]!==null?{'createTime':_0x5d65fb[_0x36a837(0xd1)]}:{},..._0x5d65fb[_0x36a837(0xbf)]!==undefined&&_0x5d65fb[_0x36a837(0xbf)]!==null?{'updateTime':_0x5d65fb['updateTime']}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':a233_0x57d975(0xa8),'required':!![],'description':a233_0x57d975(0xc5),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a234_0x5805ef=a234_0x5c27;(function(_0x19817b,_0x47159a){const _0x2f76d7=a234_0x5c27,_0x3b00e1=_0x19817b();while(!![]){try{const _0x15e37a=-parseInt(_0x2f76d7(0x1e3))/0x1+parseInt(_0x2f76d7(0x1dc))/0x2+-parseInt(_0x2f76d7(0x1d0))/0x3+-parseInt(_0x2f76d7(0x1d3))/0x4*(-parseInt(_0x2f76d7(0x1e7))/0x5)+-parseInt(_0x2f76d7(0x1b7))/0x6+-parseInt(_0x2f76d7(0x1ab))/0x7+parseInt(_0x2f76d7(0x1b2))/0x8*(parseInt(_0x2f76d7(0x1ce))/0x9);if(_0x15e37a===_0x47159a)break;else _0x3b00e1['push'](_0x3b00e1['shift']());}catch(_0x37c021){_0x3b00e1['push'](_0x3b00e1['shift']());}}}(a234_0x34bc,0xd9166));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a234_0x34bc(){const _0x34adaf=['4zWRyIC','keys','\x20run\x20build','changed','vite\x20preview\x20exited\x20with\x20code\x20','validation','push','error','log','3461976vjbdHu','\x22\x20not\x20found\x20in\x20package.json.','Script\x20\x22','yarn','bun','build','node_modules','1648381pIbHsP','args','--watch','boolean','4292935IiFrkZ','join','close','6208538lGZvhD','watch','scripts','dev','\x20run\x20preview\x20--watch','Domain\x20routing\x20synchronized:\x20','Script\x20name\x20defined\x20in\x20package.json','1453920zpQZEC','bun.lockb','\x0a\x20\x20Available\x20scripts:\x0a','\x20run\x20preview','.bin','4538220YmWTmp','\x0a\x20\x20Usage:\x20','package.json','parse','inherit','No\x20package.json\x20found\x20in\x20current\x20directory.','script','path','yarn.lock','No\x20scripts\x20defined\x20in\x20package.json.','write','\x20run\x20start','preview','\x20run\x20<script>\x0a','needsUpgrade','pnpm','vite','npm','\x20exited\x20with\x20code\x20','belowMinimum','\x20\x20\x20\x20','start','cwd','81iHEZxx','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','133080JLsBiw','run','length'];a234_0x34bc=function(){return _0x34adaf;};return a234_0x34bc();}const VERSION_CHECK_SCRIPTS=new Set([a234_0x5805ef(0x1cc),'dev']),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a234_0x5805ef(0x1cc),a234_0x5805ef(0x1ae),a234_0x5805ef(0x1e1),a234_0x5805ef(0x1c3)]);export function syncProjectDomainRoutingBeforeScript(_0x3cf55c,_0x47401e){const _0x2a07bc=a234_0x5805ef;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x47401e))return null;const _0x33ef34=findProjectRootDirectory(_0x3cf55c);if(!resolveConfigPath(_0x33ef34))return null;const _0x593ba5=writeProjectDomainRoutingManifest(_0x33ef34);return{'path':_0x593ba5[_0x2a07bc(0x1be)],'changed':_0x593ba5[_0x2a07bc(0x1d6)]};}function readPackageScripts(_0x1e4f31){const _0x2a0940=a234_0x5805ef,_0x375e87=resolve(_0x1e4f31,_0x2a0940(0x1b9));if(!existsSync(_0x375e87))return null;try{const _0x1a71f3=JSON[_0x2a0940(0x1ba)](readFileSync(_0x375e87,'utf-8'));return _0x1a71f3[_0x2a0940(0x1ad)]??{};}catch{return null;}}function detectPackageManager(_0xf6256e){const _0x147415=a234_0x5805ef;if(existsSync(resolve(_0xf6256e,_0x147415(0x1b3)))||existsSync(resolve(_0xf6256e,'bun.lock')))return _0x147415(0x1e0);if(existsSync(resolve(_0xf6256e,'pnpm-lock.yaml')))return _0x147415(0x1c6);if(existsSync(resolve(_0xf6256e,_0x147415(0x1bf))))return _0x147415(0x1df);return _0x147415(0x1c8);}async function versionCheck(_0x12fba6){const _0x95e3d4=a234_0x5805ef,_0x3d55ab=await checkCliVersion();(_0x3d55ab[_0x95e3d4(0x1c5)]||_0x3d55ab[_0x95e3d4(0x1ca)])&&(printCliUpgradeWarning(_0x3d55ab),assertCliVersionSupported(_0x3d55ab));const _0x4f2af5=await checkSdkVersion(_0x12fba6);if(_0x4f2af5[_0x95e3d4(0x1c5)])printSdkUpgradeWarning(_0x4f2af5);}function spawnScript(_0x34b042,_0x159a6b,_0x25840d,_0x1fe410){return new Promise((_0x2d571a,_0x37de0f)=>{const _0x23a510=a234_0x5c27,_0x2c6987=[_0x23a510(0x1d1),_0x159a6b,..._0x25840d],_0x1f276f=spawn(_0x34b042,_0x2c6987,{'cwd':_0x1fe410,'stdio':_0x23a510(0x1bb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1fe410,_0x23a510(0x1e2),_0x23a510(0x1b6))+delimiter+process.env.PATH}});_0x1f276f['on'](_0x23a510(0x1aa),_0x5834e1=>{const _0xaa4d56=_0x23a510;if(_0x5834e1===0x0||_0x5834e1===null)_0x2d571a();else _0x37de0f(new Error(_0x34b042+'\x20run\x20'+_0x159a6b+_0xaa4d56(0x1c9)+_0x5834e1));}),_0x1f276f['on'](_0x23a510(0x1da),_0x37de0f);});}function spawnViteBuildWatch(_0x18c985){return new Promise((_0xfd967,_0x3510e1)=>{const _0x45fca2=a234_0x5c27,_0x57a33e=spawn('vite',['build',_0x45fca2(0x1e5)],{'cwd':_0x18c985,'stdio':_0x45fca2(0x1bb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x18c985,_0x45fca2(0x1e2),_0x45fca2(0x1b6))+delimiter+process.env.PATH}});_0x57a33e['on']('close',_0x5ad7fd=>{const _0x16cabc=_0x45fca2;if(_0x5ad7fd===0x0||_0x5ad7fd===null)_0xfd967();else _0x3510e1(new Error(_0x16cabc(0x1cf)+_0x5ad7fd));}),_0x57a33e['on']('error',_0x3510e1);});}function spawnVitePreview(_0x232628){return new Promise((_0x7f184f,_0x1c72a9)=>{const _0x36f194=a234_0x5c27,_0x1437f8=spawn(_0x36f194(0x1c7),[_0x36f194(0x1c3)],{'cwd':_0x232628,'stdio':_0x36f194(0x1bb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x232628,_0x36f194(0x1e2),'.bin')+delimiter+process.env.PATH}});_0x1437f8['on']('close',_0x61c42c=>{const _0x4fa20a=_0x36f194;if(_0x61c42c===0x0||_0x61c42c===null)_0x7f184f();else _0x1c72a9(new Error(_0x4fa20a(0x1d7)+_0x61c42c));}),_0x1437f8['on']('error',_0x1c72a9);});}const runFlags=[{'name':a234_0x5805ef(0x1ac),'type':a234_0x5805ef(0x1e6),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];function a234_0x5c27(_0x145251,_0x4ec8e7){_0x145251=_0x145251-0x1aa;const _0x34bc52=a234_0x34bc();let _0x5c275d=_0x34bc52[_0x145251];return _0x5c275d;}export const runDefinition={'service':a234_0x5805ef(0x1d1),'command':'run','description':'Run\x20a\x20package.json\x20script','risk':a234_0x5805ef(0x1c1),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a234_0x5805ef(0x1bd),'description':a234_0x5805ef(0x1b1),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x55c733=a234_0x5805ef,_0x25a3ab=[];return _0x25a3ab[_0x55c733(0x1d9)]('\x20\x20EXAMPLES'),_0x25a3ab[_0x55c733(0x1d9)](_0x55c733(0x1cb)+CLI_BIN_NAME+_0x55c733(0x1c2)),_0x25a3ab[_0x55c733(0x1d9)](_0x55c733(0x1cb)+CLI_BIN_NAME+_0x55c733(0x1d5)),_0x25a3ab['push'](_0x55c733(0x1cb)+CLI_BIN_NAME+_0x55c733(0x1b5)),_0x25a3ab[_0x55c733(0x1d9)](_0x55c733(0x1cb)+CLI_BIN_NAME+_0x55c733(0x1af)),_0x25a3ab[_0x55c733(0x1e8)]('\x0a');},async 'execute'(_0x1b1a04){const _0x1fa720=a234_0x5805ef,_0x268959=process[_0x1fa720(0x1cd)](),_0x4f2488=_0x1b1a04[_0x1fa720(0x1e4)][0x0],_0x1dc3a9=_0x1b1a04['args']['slice'](0x1),_0x17edc2=readPackageScripts(_0x268959);if(!_0x17edc2)throw CliErrors['validation'](_0x1fa720(0x1bc));if(!_0x4f2488){const _0x4c35cd=Object[_0x1fa720(0x1d4)](_0x17edc2);if(_0x4c35cd[_0x1fa720(0x1d2)]===0x0)console['log'](_0x1fa720(0x1c0));else{console[_0x1fa720(0x1db)](_0x1fa720(0x1b4));for(const _0x111ba2 of _0x4c35cd){console['log'](_0x1fa720(0x1cb)+_0x111ba2);}console['log'](_0x1fa720(0x1b8)+CLI_BIN_NAME+_0x1fa720(0x1c4));}return{'ok':!![]};}if(!_0x17edc2[_0x4f2488])throw CliErrors[_0x1fa720(0x1d8)](_0x1fa720(0x1de)+_0x4f2488+_0x1fa720(0x1dd),'Available:\x20'+(Object[_0x1fa720(0x1d4)](_0x17edc2)[_0x1fa720(0x1e8)](',\x20')||'(none)'));const _0x2b3b3e=detectPackageManager(_0x268959),_0x56c352=syncProjectDomainRoutingBeforeScript(_0x268959,_0x4f2488);_0x56c352?.[_0x1fa720(0x1d6)]&&console[_0x1fa720(0x1da)](_0x1fa720(0x1b0)+_0x56c352[_0x1fa720(0x1be)]);VERSION_CHECK_SCRIPTS['has'](_0x4f2488)&&await versionCheck(_0x268959);if(_0x4f2488==='preview'&&_0x1b1a04['bool'](_0x1fa720(0x1ac)))return await Promise['all']([spawnViteBuildWatch(_0x268959),spawnVitePreview(_0x268959)]),{'ok':!![]};return await spawnScript(_0x2b3b3e,_0x4f2488,_0x1dc3a9,_0x268959),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a235_0x5830(){const _0x41cbec=['822220DMBBwr','5502uDEHBD','8cilCjc','17330QbNwcR','54kSLbFT','33597XWtQfq','schema','1855701MsdWss','735JRejXA','95389vynWIv','Export\x20machine-readable\x20command\x20schema\x20(JSON)','json','305651tgBUpi','2519TrySwL'];a235_0x5830=function(){return _0x41cbec;};return a235_0x5830();}const a235_0xcec9d3=a235_0x436e;(function(_0x2bff85,_0x2dc540){const _0x371dc9=a235_0x436e,_0x1c9598=_0x2bff85();while(!![]){try{const _0x179ccf=parseInt(_0x371dc9(0x12a))/0x1+-parseInt(_0x371dc9(0x130))/0x2*(parseInt(_0x371dc9(0x131))/0x3)+parseInt(_0x371dc9(0x12c))/0x4+parseInt(_0x371dc9(0x126))/0x5*(parseInt(_0x371dc9(0x12d))/0x6)+-parseInt(_0x371dc9(0x127))/0x7*(-parseInt(_0x371dc9(0x12e))/0x8)+parseInt(_0x371dc9(0x125))/0x9+-parseInt(_0x371dc9(0x12f))/0xa*(parseInt(_0x371dc9(0x12b))/0xb);if(_0x179ccf===_0x2dc540)break;else _0x1c9598['push'](_0x1c9598['shift']());}catch(_0x69c4a6){_0x1c9598['push'](_0x1c9598['shift']());}}}(a235_0x5830,0x28abf));import{buildSchemaPayload}from'../framework/schema-export.js';function a235_0x436e(_0x55f84f,_0x1d2fd5){_0x55f84f=_0x55f84f-0x124;const _0x58306e=a235_0x5830();let _0x436e8f=_0x58306e[_0x55f84f];return _0x436e8f;}async function execute(_0x9fb20c){const _0x314b38=await buildSchemaPayload();return{'ok':!![],'data':_0x314b38};}export const schemaDefinition={'service':a235_0xcec9d3(0x124),'command':'export','description':a235_0xcec9d3(0x128),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a235_0xcec9d3(0x129),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a236_0x56c34f=a236_0x4b53;(function(_0xf85d38,_0x523f7f){const _0x3a56b0=a236_0x4b53,_0x4a1d70=_0xf85d38();while(!![]){try{const _0xa91b85=-parseInt(_0x3a56b0(0x145))/0x1*(-parseInt(_0x3a56b0(0x16d))/0x2)+parseInt(_0x3a56b0(0x12d))/0x3*(-parseInt(_0x3a56b0(0x15b))/0x4)+-parseInt(_0x3a56b0(0x16e))/0x5*(-parseInt(_0x3a56b0(0x15c))/0x6)+parseInt(_0x3a56b0(0x157))/0x7+parseInt(_0x3a56b0(0x151))/0x8*(parseInt(_0x3a56b0(0x168))/0x9)+-parseInt(_0x3a56b0(0x130))/0xa*(parseInt(_0x3a56b0(0x15a))/0xb)+parseInt(_0x3a56b0(0x139))/0xc*(-parseInt(_0x3a56b0(0x138))/0xd);if(_0xa91b85===_0x523f7f)break;else _0x4a1d70['push'](_0x4a1d70['shift']());}catch(_0x14b55a){_0x4a1d70['push'](_0x4a1d70['shift']());}}}(a236_0x33ae,0x71127));import{writeFile}from'node:fs/promises';function a236_0x33ae(){const _0xf659e3=['dbId\x20must\x20be\x20a\x20positive\x20integer','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name:','Invalid\x20database\x20selection\x20payload:\x20','flagMissing','description','Select\x20the\x20local\x20SQL\x20mode:','</select>','isFinite','2AJowOu','sqlCode','number','str','lockFilePath','SQL\x20name\x20cannot\x20be\x20empty','Target\x20database\x20dbId:','length','✎\x20Enter\x20dbId\x20manually','join','toISOString','mode','5961688xnUwKs','\x20\x20SELECT\x201\x20AS\x20id','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','sqlRootDir','mybatisXml','appCode','1652889NQqNnk','sqlName','dbId\x20cannot\x20be\x20empty','1639957VnJkdm','156KyESce','102eBriRr','dbName','utf8','isInteger','Target\x20database\x20ID','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sqls','trim','dbId','validation','POST','File\x20already\x20exists:\x20','9WxHAkL','string','new','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','MyBatis\x20XML\x20(mybatisXml)','529798diTJcF','157615GIAzoR','db-id','name','catch','Select\x20the\x20target\x20database:','nonInteractive','46356LVYxSZ','<server-generated-sqlCode>','parse','60LSeTJI','Created\x20SQL\x20query\x20','Local\x20SQL\x20file\x20mode','lastSync','__manual__','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','sqlRoot','sql','1127542GIBArK','12rBWqTe','/smartapi/custom/saveUserCustomSql','create'];a236_0x33ae=function(){return _0xf659e3;};return a236_0x33ae();}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x5386f9){const _0x22d0c6=a236_0x4b53;if(_0x5386f9===_0x22d0c6(0x155))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x22d0c6(0x152),_0x22d0c6(0x143),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x22d0c6(0x14e)]('\x0a');}export const sqlCreate={'service':'sql','command':a236_0x56c34f(0x13b),'description':a236_0x56c34f(0x135),'risk':'write','flags':[{'name':a236_0x56c34f(0x170),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a236_0x56c34f(0x16f),'type':a236_0x56c34f(0x147),'description':a236_0x56c34f(0x160)},{'name':a236_0x56c34f(0x150),'type':a236_0x56c34f(0x169),'enum':[a236_0x56c34f(0x137),a236_0x56c34f(0x155)],'description':a236_0x56c34f(0x132)}],async 'validate'(_0x38e9de){const _0x2baa77=a236_0x56c34f;if(!_0x38e9de[_0x2baa77(0x12c)])return;if(!_0x38e9de[_0x2baa77(0x148)](_0x2baa77(0x170))[_0x2baa77(0x163)]())throw CliErrors['flagMissing'](_0x2baa77(0x170),_0x2baa77(0x161));const _0x1e18cf=resolveProvidedDbId(_0x38e9de);if(typeof _0x1e18cf!==_0x2baa77(0x147)||!Number['isFinite'](_0x1e18cf)||_0x1e18cf<=0x0)throw CliErrors['flagMissing'](_0x2baa77(0x16f),_0x2baa77(0x16b));if(!_0x38e9de[_0x2baa77(0x148)](_0x2baa77(0x150))[_0x2baa77(0x163)]())throw CliErrors[_0x2baa77(0x140)](_0x2baa77(0x150),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x517ee4){const _0x5ae061=a236_0x56c34f,_0x2af7da=loadSqlProjectConfig(_0x517ee4[_0x5ae061(0x156)]),{sqlName:_0xfe88e5,dbId:_0x40d473,dbName:_0x165cdd,mode:_0x14cb41}=await resolveSqlNewInputs(_0x517ee4),_0x455d0d=buildSqlRelativePath(_0x5ae061(0x12e),_0xfe88e5,_0x165cdd,_0x14cb41,_0x40d473),_0x2b7f40=_0x2af7da[_0x5ae061(0x154)]+'/'+_0x455d0d;return{'method':_0x5ae061(0x166),'url':_0x5ae061(0x13a),'body':{'appCode':_0x517ee4[_0x5ae061(0x156)],'sqlName':_0xfe88e5,'dbId':_0x40d473,'mode':_0x14cb41,'localPath':_0x2b7f40},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x2af7da[_0x5ae061(0x154)]};},async 'execute'(_0xd33b3b){const _0x235f5a=a236_0x56c34f,_0x5c7687=loadSqlProjectConfig(_0xd33b3b[_0x235f5a(0x156)]),{sqlName:_0x1deb48,dbId:_0x3f3e9e,dbName:_0x249b92,mode:_0x57269f}=await resolveSqlNewInputs(_0xd33b3b),_0xc9c76=generateSqlTemplate(_0x57269f),_0x1485ce=await createSqlQuery({'appCode':_0xd33b3b[_0x235f5a(0x156)],'sqlName':_0x1deb48,'dbId':_0x3f3e9e,'sqlContent':_0xc9c76}),_0x577225=ensureRemoteSqlContent(_0x1485ce),_0x2c14de=_0x249b92||await getDbName(_0xd33b3b['appCode'],_0x3f3e9e)[_0x235f5a(0x171)](()=>undefined),_0x15a23c=buildSqlRelativePath(_0x1485ce[_0x235f5a(0x146)],_0x1485ce[_0x235f5a(0x158)],_0x2c14de,_0x57269f,_0x3f3e9e),_0x4a03b7=_0x5c7687[_0x235f5a(0x154)]+'/'+_0x15a23c,_0x25df59=buildLocalSqlFileContent({'sqlCode':_0x1485ce['sqlCode'],'sqlName':_0x1485ce['sqlName'],'dbId':_0x1485ce['dbId']},_0x577225,{'dbName':_0x2c14de,'mode':_0x57269f,'syncedAt':new Date()[_0x235f5a(0x14f)](),'description':_0x1485ce[_0x235f5a(0x141)]});if(await fileExists(_0x4a03b7))throw CliErrors[_0x235f5a(0x165)](_0x235f5a(0x167)+_0x4a03b7);await ensureParentDirectory(_0x4a03b7),await writeFile(_0x4a03b7,_0x25df59,_0x235f5a(0x15e));const _0x14c0af=await readSqlLockFile(_0x5c7687[_0x235f5a(0x149)]),{lockData:_0x20b8d3,appLock:_0x42c8af}=ensureSqlLockScope(_0x14c0af??createEmptySqlLock(),_0x5c7687[_0x235f5a(0x156)],_0x5c7687[_0x235f5a(0x136)],_0x235f5a(0x16a));return _0x42c8af[_0x235f5a(0x162)][_0x1485ce[_0x235f5a(0x146)]]={...buildSqlLockEntry(_0x1485ce,_0x577225,computeSqlContentHash(_0x25df59),{'dbName':_0x2c14de}),'path':_0x15a23c,'mode':_0x57269f},_0x42c8af[_0x235f5a(0x133)]=new Date()[_0x235f5a(0x14f)](),await writeSqlLockFile(_0x5c7687[_0x235f5a(0x149)],_0x20b8d3),{'ok':!![],'data':{'id':_0x1485ce['id'],'sqlCode':_0x1485ce[_0x235f5a(0x146)],'sqlName':_0x1485ce[_0x235f5a(0x158)],'dbId':_0x1485ce[_0x235f5a(0x164)],'path':_0x4a03b7,'mode':_0x57269f},'message':_0x235f5a(0x131)+_0x1485ce[_0x235f5a(0x146)]};}};function a236_0x4b53(_0x28f032,_0x47125d){_0x28f032=_0x28f032-0x12c;const _0x33ae65=a236_0x33ae();let _0x4b5386=_0x33ae65[_0x28f032];return _0x4b5386;}async function resolveSqlNewInputs(_0x5324b4){const _0x227703=await resolveSqlNameInput(_0x5324b4),{dbId:_0x4f7e85,dbName:_0x576658}=await resolveDbSelection(_0x5324b4),_0xb2c645=await resolveSqlModeInput(_0x5324b4);return{'sqlName':_0x227703,'dbId':_0x4f7e85,'dbName':_0x576658,'mode':_0xb2c645};}async function resolveSqlNameInput(_0x350dc7){const _0x586407=a236_0x56c34f,_0x20f9f5=_0x350dc7[_0x586407(0x148)](_0x586407(0x170))[_0x586407(0x163)]();if(_0x20f9f5)return _0x20f9f5;if(_0x350dc7[_0x586407(0x12c)])throw CliErrors['flagMissing'](_0x586407(0x170),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x586407(0x13e),'validate':_0x1f20f9=>_0x1f20f9['trim']()?!![]:_0x586407(0x14a)}))[_0x586407(0x163)]();}async function resolveDbSelection(_0x1e5dd1){const _0x54191d=a236_0x56c34f,_0x3124f7=resolveProvidedDbId(_0x1e5dd1);if(typeof _0x3124f7===_0x54191d(0x147)&&Number[_0x54191d(0x144)](_0x3124f7)&&_0x3124f7>0x0)return{'dbId':_0x3124f7,'dbName':await getDbName(_0x1e5dd1['appCode'],_0x3124f7)[_0x54191d(0x171)](()=>undefined)};if(_0x1e5dd1[_0x54191d(0x12c)])throw CliErrors[_0x54191d(0x140)](_0x54191d(0x16f),_0x54191d(0x16b));const _0x186d01=await listDatabases(_0x1e5dd1[_0x54191d(0x156)])[_0x54191d(0x171)](()=>[]);if(_0x186d01[_0x54191d(0x14c)]===0x1)return{'dbId':_0x186d01[0x0]['dbId'],'dbName':_0x186d01[0x0][_0x54191d(0x15d)]};if(_0x186d01[_0x54191d(0x14c)]>0x1){const _0x4167d0=await select({'message':_0x54191d(0x172),'choices':[..._0x186d01['map'](_0x4dc9f1=>({'name':_0x4dc9f1[_0x54191d(0x15d)]+'\x20('+_0x4dc9f1['dbId']+')','value':serializeDbSelection(_0x4dc9f1)})),{'name':_0x54191d(0x14d),'value':_0x54191d(0x134)}]});if(_0x4167d0!==_0x54191d(0x134))return deserializeDbSelection(_0x4167d0);}const _0x3a3bc5=await input({'message':_0x54191d(0x14b),'validate':_0x46028c=>{const _0x671f5e=_0x54191d,_0x3cf2e2=_0x46028c[_0x671f5e(0x163)]();if(!_0x3cf2e2)return _0x671f5e(0x159);const _0x59bf67=Number(_0x3cf2e2);if(!Number[_0x671f5e(0x15f)](_0x59bf67)||_0x59bf67<=0x0)return _0x671f5e(0x13c);return!![];}});return{'dbId':Number(_0x3a3bc5['trim']())};}async function resolveSqlModeInput(_0xe9a7fd){const _0x223ea1=a236_0x56c34f,_0x7e14a5=_0xe9a7fd[_0x223ea1(0x148)](_0x223ea1(0x150))[_0x223ea1(0x163)]();if(_0x7e14a5==='sql'||_0x7e14a5===_0x223ea1(0x155))return _0x7e14a5;if(_0xe9a7fd['nonInteractive'])throw CliErrors['flagMissing'](_0x223ea1(0x150),_0x223ea1(0x13d));return await select({'message':_0x223ea1(0x142),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x223ea1(0x16c),'value':_0x223ea1(0x155),'description':_0x223ea1(0x153)}]});}function serializeDbSelection(_0x195fd0){const _0x18d6c3=a236_0x56c34f;return JSON['stringify']({'dbId':_0x195fd0[_0x18d6c3(0x164)],'dbName':_0x195fd0[_0x18d6c3(0x15d)]});}function deserializeDbSelection(_0x29a9df){const _0x22f87b=a236_0x56c34f;try{const _0x3e4cc8=JSON[_0x22f87b(0x12f)](_0x29a9df);if(typeof _0x3e4cc8[_0x22f87b(0x164)]===_0x22f87b(0x147)&&Number['isFinite'](_0x3e4cc8['dbId']))return{'dbId':_0x3e4cc8[_0x22f87b(0x164)],'dbName':_0x3e4cc8[_0x22f87b(0x15d)]};}catch{}throw CliErrors[_0x22f87b(0x165)](_0x22f87b(0x13f)+_0x29a9df);}function resolveProvidedDbId(_0x4de77c){const _0x1b5308=a236_0x56c34f,_0x53439d=_0x4de77c['flag'](_0x1b5308(0x16f));if(typeof _0x53439d===_0x1b5308(0x147)&&Number[_0x1b5308(0x144)](_0x53439d))return _0x53439d;return undefined;}
|
|
1
|
+
const a236_0x1694fe=a236_0x1916;(function(_0x13fca4,_0x2f2f18){const _0x19a12f=a236_0x1916,_0x7d9ed6=_0x13fca4();while(!![]){try{const _0x3d7022=-parseInt(_0x19a12f(0x199))/0x1+parseInt(_0x19a12f(0x1a2))/0x2*(parseInt(_0x19a12f(0x193))/0x3)+parseInt(_0x19a12f(0x192))/0x4+parseInt(_0x19a12f(0x189))/0x5*(parseInt(_0x19a12f(0x1b0))/0x6)+parseInt(_0x19a12f(0x194))/0x7*(-parseInt(_0x19a12f(0x18b))/0x8)+parseInt(_0x19a12f(0x178))/0x9+parseInt(_0x19a12f(0x176))/0xa*(-parseInt(_0x19a12f(0x19e))/0xb);if(_0x3d7022===_0x2f2f18)break;else _0x7d9ed6['push'](_0x7d9ed6['shift']());}catch(_0x2c8972){_0x7d9ed6['push'](_0x7d9ed6['shift']());}}}(a236_0x2b3e,0xae64e));import{writeFile}from'node:fs/promises';function a236_0x1916(_0x45285a,_0x1c7009){_0x45285a=_0x45285a-0x174;const _0x2b3e44=a236_0x2b3e();let _0x19169c=_0x2b3e44[_0x45285a];return _0x19169c;}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';function a236_0x2b3e(){const _0x432ef2=['sql','SQL\x20name:','dbName','lockFilePath','110mIpotk','Local\x20SQL\x20file\x20mode','create','lastSync','99050KedlmJ','mode','POST','str','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','sqlName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sqlRoot','Invalid\x20database\x20selection\x20payload:\x20','length','validation','SQL\x20query\x20display\x20name','MyBatis\x20XML\x20(mybatisXml)','18WASxuI','sqlCode','join','name','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Select\x20the\x20local\x20SQL\x20mode:','__manual__','sqlRootDir','740710OXPvfT','parse','10282977zsJHPS','map','nonInteractive','catch','dbId','SQL\x20name\x20cannot\x20be\x20empty','/smartapi/custom/saveUserCustomSql','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','appCode','Target\x20database\x20dbId:','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id','description','SELECT\x201\x20AS\x20id;','number','string','isFinite','1025170MPAFrE','trim','8ESiJMs','toISOString','mybatisXml','flag','utf8','Plain\x20SQL\x20(sql)','flagMissing','938496NtQpRS','27OaerGC','2126418lwqpqI','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','db-id','</select>','679202wLGKij'];a236_0x2b3e=function(){return _0x432ef2;};return a236_0x2b3e();}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x55055c){const _0x3f3e04=a236_0x1916;if(_0x55055c===_0x3f3e04(0x18d))return[_0x3f3e04(0x182),_0x3f3e04(0x183),_0x3f3e04(0x198),''][_0x3f3e04(0x1b2)]('\x0a');return[_0x3f3e04(0x185),''][_0x3f3e04(0x1b2)]('\x0a');}export const sqlCreate={'service':'sql','command':a236_0x1694fe(0x1a0),'description':a236_0x1694fe(0x195),'risk':'write','flags':[{'name':'name','type':a236_0x1694fe(0x187),'description':a236_0x1694fe(0x1ae)},{'name':'db-id','type':a236_0x1694fe(0x186),'description':'Target\x20database\x20ID'},{'name':'mode','type':a236_0x1694fe(0x187),'enum':[a236_0x1694fe(0x19a),a236_0x1694fe(0x18d)],'description':a236_0x1694fe(0x19f)}],async 'validate'(_0x545bb7){const _0x5aaab6=a236_0x1694fe;if(!_0x545bb7[_0x5aaab6(0x17a)])return;if(!_0x545bb7[_0x5aaab6(0x1a5)]('name')[_0x5aaab6(0x18a)]())throw CliErrors['flagMissing'](_0x5aaab6(0x1b3),_0x5aaab6(0x1a6));const _0x2a4985=resolveProvidedDbId(_0x545bb7);if(typeof _0x2a4985!=='number'||!Number['isFinite'](_0x2a4985)||_0x2a4985<=0x0)throw CliErrors['flagMissing'](_0x5aaab6(0x197),_0x5aaab6(0x196));if(!_0x545bb7[_0x5aaab6(0x1a5)](_0x5aaab6(0x1a3))[_0x5aaab6(0x18a)]())throw CliErrors[_0x5aaab6(0x191)](_0x5aaab6(0x1a3),_0x5aaab6(0x1b4));},async 'dryRun'(_0x4cebf4){const _0x39727c=a236_0x1694fe,_0x187934=loadSqlProjectConfig(_0x4cebf4['appCode']),{sqlName:_0x5f2da6,dbId:_0x5a9f49,dbName:_0x4c9810,mode:_0x93c48a}=await resolveSqlNewInputs(_0x4cebf4),_0x3e8dac=buildSqlRelativePath('<server-generated-sqlCode>',_0x5f2da6,_0x4c9810,_0x93c48a,_0x5a9f49),_0xed7e4e=_0x187934[_0x39727c(0x175)]+'/'+_0x3e8dac;return{'method':_0x39727c(0x1a4),'url':_0x39727c(0x17e),'body':{'appCode':_0x4cebf4[_0x39727c(0x180)],'sqlName':_0x5f2da6,'dbId':_0x5a9f49,'mode':_0x93c48a,'localPath':_0xed7e4e},'description':_0x39727c(0x1a9)+_0x187934['sqlRootDir']};},async 'execute'(_0x422b4d){const _0x3299fc=a236_0x1694fe,_0x4e431e=loadSqlProjectConfig(_0x422b4d[_0x3299fc(0x180)]),{sqlName:_0x276d54,dbId:_0x5f464d,dbName:_0x1df5ed,mode:_0x526ca9}=await resolveSqlNewInputs(_0x422b4d),_0x58e6f3=generateSqlTemplate(_0x526ca9),_0x2f58ac=await createSqlQuery({'appCode':_0x422b4d['appCode'],'sqlName':_0x276d54,'dbId':_0x5f464d,'sqlContent':_0x58e6f3}),_0x5249f2=ensureRemoteSqlContent(_0x2f58ac),_0x2a7221=_0x1df5ed||await getDbName(_0x422b4d['appCode'],_0x5f464d)[_0x3299fc(0x17b)](()=>undefined),_0x543d85=buildSqlRelativePath(_0x2f58ac[_0x3299fc(0x1b1)],_0x2f58ac['sqlName'],_0x2a7221,_0x526ca9,_0x5f464d),_0x20c3f2=_0x4e431e[_0x3299fc(0x175)]+'/'+_0x543d85,_0x549b68=buildLocalSqlFileContent({'sqlCode':_0x2f58ac['sqlCode'],'sqlName':_0x2f58ac[_0x3299fc(0x1a8)],'dbId':_0x2f58ac['dbId']},_0x5249f2,{'dbName':_0x2a7221,'mode':_0x526ca9,'syncedAt':new Date()['toISOString'](),'description':_0x2f58ac[_0x3299fc(0x184)]});if(await fileExists(_0x20c3f2))throw CliErrors[_0x3299fc(0x1ad)]('File\x20already\x20exists:\x20'+_0x20c3f2);await ensureParentDirectory(_0x20c3f2),await writeFile(_0x20c3f2,_0x549b68,_0x3299fc(0x18f));const _0x23c931=await readSqlLockFile(_0x4e431e[_0x3299fc(0x19d)]),{lockData:_0x2f3cbb,appLock:_0x1fa5eb}=ensureSqlLockScope(_0x23c931??createEmptySqlLock(),_0x4e431e[_0x3299fc(0x180)],_0x4e431e[_0x3299fc(0x1aa)],'new');return _0x1fa5eb['sqls'][_0x2f58ac[_0x3299fc(0x1b1)]]={...buildSqlLockEntry(_0x2f58ac,_0x5249f2,computeSqlContentHash(_0x549b68),{'dbName':_0x2a7221}),'path':_0x543d85,'mode':_0x526ca9},_0x1fa5eb[_0x3299fc(0x1a1)]=new Date()[_0x3299fc(0x18c)](),await writeSqlLockFile(_0x4e431e[_0x3299fc(0x19d)],_0x2f3cbb),{'ok':!![],'data':{'id':_0x2f58ac['id'],'sqlCode':_0x2f58ac[_0x3299fc(0x1b1)],'sqlName':_0x2f58ac['sqlName'],'dbId':_0x2f58ac[_0x3299fc(0x17c)],'path':_0x20c3f2,'mode':_0x526ca9},'message':_0x3299fc(0x1a7)+_0x2f58ac[_0x3299fc(0x1b1)]};}};async function resolveSqlNewInputs(_0x3a1a57){const _0x58a7c3=await resolveSqlNameInput(_0x3a1a57),{dbId:_0x3569ae,dbName:_0x329274}=await resolveDbSelection(_0x3a1a57),_0xee71d0=await resolveSqlModeInput(_0x3a1a57);return{'sqlName':_0x58a7c3,'dbId':_0x3569ae,'dbName':_0x329274,'mode':_0xee71d0};}async function resolveSqlNameInput(_0x2c332a){const _0x5b61a4=a236_0x1694fe,_0x9a714a=_0x2c332a[_0x5b61a4(0x1a5)](_0x5b61a4(0x1b3))['trim']();if(_0x9a714a)return _0x9a714a;if(_0x2c332a[_0x5b61a4(0x17a)])throw CliErrors[_0x5b61a4(0x191)](_0x5b61a4(0x1b3),_0x5b61a4(0x1a6));return(await input({'message':_0x5b61a4(0x19b),'validate':_0x170d1b=>_0x170d1b['trim']()?!![]:_0x5b61a4(0x17d)}))['trim']();}async function resolveDbSelection(_0x589a65){const _0x5bc9e7=a236_0x1694fe,_0x575987=resolveProvidedDbId(_0x589a65);if(typeof _0x575987===_0x5bc9e7(0x186)&&Number[_0x5bc9e7(0x188)](_0x575987)&&_0x575987>0x0)return{'dbId':_0x575987,'dbName':await getDbName(_0x589a65['appCode'],_0x575987)['catch'](()=>undefined)};if(_0x589a65[_0x5bc9e7(0x17a)])throw CliErrors[_0x5bc9e7(0x191)](_0x5bc9e7(0x197),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0xeef8d1=await listDatabases(_0x589a65[_0x5bc9e7(0x180)])[_0x5bc9e7(0x17b)](()=>[]);if(_0xeef8d1[_0x5bc9e7(0x1ac)]===0x1)return{'dbId':_0xeef8d1[0x0]['dbId'],'dbName':_0xeef8d1[0x0][_0x5bc9e7(0x19c)]};if(_0xeef8d1['length']>0x1){const _0xeda06a=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0xeef8d1[_0x5bc9e7(0x179)](_0x1c4652=>({'name':_0x1c4652[_0x5bc9e7(0x19c)]+'\x20('+_0x1c4652[_0x5bc9e7(0x17c)]+')','value':serializeDbSelection(_0x1c4652)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x5bc9e7(0x174)}]});if(_0xeda06a!=='__manual__')return deserializeDbSelection(_0xeda06a);}const _0xf074a=await input({'message':_0x5bc9e7(0x181),'validate':_0x54f78f=>{const _0x1b2fa2=_0x54f78f['trim']();if(!_0x1b2fa2)return'dbId\x20cannot\x20be\x20empty';const _0x435d99=Number(_0x1b2fa2);if(!Number['isInteger'](_0x435d99)||_0x435d99<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0xf074a['trim']())};}async function resolveSqlModeInput(_0x3d88ca){const _0x229edc=a236_0x1694fe,_0x314471=_0x3d88ca['str']('mode')[_0x229edc(0x18a)]();if(_0x314471===_0x229edc(0x19a)||_0x314471===_0x229edc(0x18d))return _0x314471;if(_0x3d88ca[_0x229edc(0x17a)])throw CliErrors[_0x229edc(0x191)](_0x229edc(0x1a3),_0x229edc(0x1b4));return await select({'message':_0x229edc(0x1b5),'choices':[{'name':_0x229edc(0x190),'value':_0x229edc(0x19a),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x229edc(0x1af),'value':_0x229edc(0x18d),'description':_0x229edc(0x17f)}]});}function serializeDbSelection(_0x50378d){const _0x2f3bdb=a236_0x1694fe;return JSON['stringify']({'dbId':_0x50378d[_0x2f3bdb(0x17c)],'dbName':_0x50378d['dbName']});}function deserializeDbSelection(_0x3ae1b9){const _0x4d76eb=a236_0x1694fe;try{const _0x17918d=JSON[_0x4d76eb(0x177)](_0x3ae1b9);if(typeof _0x17918d[_0x4d76eb(0x17c)]===_0x4d76eb(0x186)&&Number['isFinite'](_0x17918d[_0x4d76eb(0x17c)]))return{'dbId':_0x17918d[_0x4d76eb(0x17c)],'dbName':_0x17918d['dbName']};}catch{}throw CliErrors[_0x4d76eb(0x1ad)](_0x4d76eb(0x1ab)+_0x3ae1b9);}function resolveProvidedDbId(_0x48e622){const _0x38d721=a236_0x1694fe,_0x42c393=_0x48e622[_0x38d721(0x18e)](_0x38d721(0x197));if(typeof _0x42c393===_0x38d721(0x186)&&Number[_0x38d721(0x188)](_0x42c393))return _0x42c393;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a237_0x5013a4=a237_0x5a04;(function(_0x57d5a6,_0x36b8aa){const _0x528613=a237_0x5a04,_0x243b84=_0x57d5a6();while(!![]){try{const _0x3b14d4=-parseInt(_0x528613(0x182))/0x1+-parseInt(_0x528613(0x18c))/0x2*(parseInt(_0x528613(0x19f))/0x3)+parseInt(_0x528613(0x180))/0x4+parseInt(_0x528613(0x188))/0x5*(parseInt(_0x528613(0x17f))/0x6)+-parseInt(_0x528613(0x19b))/0x7+-parseInt(_0x528613(0x181))/0x8+-parseInt(_0x528613(0x196))/0x9*(-parseInt(_0x528613(0x191))/0xa);if(_0x3b14d4===_0x36b8aa)break;else _0x243b84['push'](_0x243b84['shift']());}catch(_0x1a3d3d){_0x243b84['push'](_0x243b84['shift']());}}}(a237_0x4723,0xb3a31));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a237_0x5a04(_0x306c3d,_0x4ec063){_0x306c3d=_0x306c3d-0x17c;const _0x4723f0=a237_0x4723();let _0x5a04ac=_0x4723f0[_0x306c3d];return _0x5a04ac;}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':a237_0x5013a4(0x18e),'command':a237_0x5013a4(0x19d),'description':a237_0x5013a4(0x192),'risk':a237_0x5013a4(0x189),'flags':[SQLCODE_FLAG],async 'validate'(_0xbe243){const _0x54990f=a237_0x5013a4,_0x472348=loadSqlProjectConfig(_0xbe243[_0x54990f(0x198)]),_0x2da788=await readSqlLockFile(_0x472348[_0x54990f(0x19e)]);if(!_0x2da788)throw CliErrors[_0x54990f(0x183)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x20997e){const _0x56aa81=a237_0x5013a4,_0x42820c=loadSqlProjectConfig(_0x20997e['appCode']),_0x2e7f68=await readSqlLockFile(_0x42820c[_0x56aa81(0x19e)]);if(!_0x2e7f68)throw CliErrors['validation'](_0x56aa81(0x17d));const {appLock:_0x5e9ee6}=ensureSqlLockScope(_0x2e7f68,_0x20997e[_0x56aa81(0x198)],_0x42820c['sqlRoot'],_0x56aa81(0x19d)),_0x3f8cf0=_0x20997e['str']('sqlcode'),_0x3d138a=_0x5e9ee6[_0x56aa81(0x187)][_0x3f8cf0];if(!_0x3d138a)throw CliErrors[_0x56aa81(0x183)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3f8cf0+'\x22.');return{'method':'POST','url':_0x56aa81(0x1a1),'body':{'sqlCode':_0x3f8cf0,'id':_0x3d138a['remoteId'],'localPath':resolveLocalSqlFilePath(_0x42820c,_0x3f8cf0,_0x3d138a)},'description':_0x56aa81(0x19a)+_0x3f8cf0+_0x56aa81(0x190)+_0x42820c['trashDir']};},async 'execute'(_0x4643a9){const _0x49bb11=a237_0x5013a4,_0x29da47=loadSqlProjectConfig(_0x4643a9['appCode']),_0x6d9fb6=await readSqlLockFile(_0x29da47['lockFilePath']);if(!_0x6d9fb6)throw CliErrors[_0x49bb11(0x183)](_0x49bb11(0x18f));const {lockData:_0x599d99,appLock:_0x551d4e}=ensureSqlLockScope(_0x6d9fb6,_0x4643a9[_0x49bb11(0x198)],_0x29da47['sqlRoot'],'delete'),_0x12fc6a=_0x4643a9[_0x49bb11(0x197)](_0x49bb11(0x199)),_0x114dc7=_0x551d4e[_0x49bb11(0x187)][_0x12fc6a];if(!_0x114dc7)throw CliErrors[_0x49bb11(0x183)](_0x49bb11(0x193)+_0x12fc6a+'\x22.');await deleteSqlQuery({'id':_0x114dc7['remoteId'],'sqlCode':_0x12fc6a}),_0x551d4e[_0x49bb11(0x187)]=Object[_0x49bb11(0x195)](Object[_0x49bb11(0x19c)](_0x551d4e[_0x49bb11(0x187)])[_0x49bb11(0x18b)](([_0x3e0673])=>_0x3e0673!==_0x12fc6a)),_0x551d4e[_0x49bb11(0x185)]=new Date()[_0x49bb11(0x184)](),await writeSqlLockFile(_0x29da47[_0x49bb11(0x19e)],_0x599d99);const _0x2d33f1=resolveLocalSqlFilePath(_0x29da47,_0x12fc6a,_0x114dc7);let _0x4ef8df;await fileExists(_0x2d33f1)&&(_0x4ef8df=await moveToTrash(_0x29da47['projectRoot'],_0x29da47[_0x49bb11(0x1a0)],_0x2d33f1),await cleanupEmptyDirectories(dirname(_0x2d33f1),_0x29da47[_0x49bb11(0x1a2)]));const _0x29d857={'deleted':_0x12fc6a,'remoteId':_0x114dc7[_0x49bb11(0x17e)]};if(_0x4ef8df)_0x29d857[_0x49bb11(0x17c)]=_0x4ef8df;return{'ok':!![],'data':_0x29d857,'message':_0x49bb11(0x186)+_0x12fc6a+(_0x4ef8df?_0x49bb11(0x18d):'')};}};async function moveToTrash(_0x1effe1,_0x1e6d75,_0x345688){const _0x2b0917=a237_0x5013a4,_0x4ee693=new Date()[_0x2b0917(0x184)]()[_0x2b0917(0x18a)](/[:.]/g,'-'),_0x1240ae=relative(_0x1effe1,_0x345688),_0x2565f1=join(_0x1e6d75,_0x4ee693,_0x1240ae);return await mkdir(dirname(_0x2565f1),{'recursive':!![]}),await rename(_0x345688,_0x2565f1),_0x2565f1;}function a237_0x4723(){const _0x4852c7=['Deleted\x20','sqls','5RDwARm','high-risk-write','replace','filter','769764IjuWDA','\x20(local\x20file\x20moved\x20to\x20trash)','sql','SQL\x20lock\x20file\x20not\x20found.','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','3264830rwtyjS','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','length','fromEntries','9afFbYm','str','appCode','sqlcode','Would\x20delete\x20SQL\x20','5576865Hhlayk','entries','delete','lockFilePath','3haDkbI','trashDir','/smartapi/custom/deleteUserCustomSql','sqlRootDir','trashedTo','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','remoteId','7784298KMlqEc','3650080ypiaTh','2142952nFpaQD','351147wxvRPI','validation','toISOString','lastSync'];a237_0x4723=function(){return _0x4852c7;};return a237_0x4723();}async function cleanupEmptyDirectories(_0x400c27,_0x27ab2d){const _0x4b637f=a237_0x5013a4;let _0x1cf913=resolve(_0x400c27);const _0x3c55b1=resolve(_0x27ab2d);while(_0x1cf913['startsWith'](''+_0x3c55b1+sep)||_0x1cf913===_0x3c55b1){if(_0x1cf913===_0x3c55b1)return;try{const _0x1ce731=await readdir(_0x1cf913);if(_0x1ce731[_0x4b637f(0x194)]>0x0)return;await rmdir(_0x1cf913);}catch{return;}_0x1cf913=dirname(_0x1cf913);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a238_0x10cf(_0x2378c8,_0x5982cd){_0x2378c8=_0x2378c8-0xc3;const _0x528d78=a238_0x528d();let _0x10cf52=_0x528d78[_0x2378c8];return _0x10cf52;}const a238_0xaec629=a238_0x10cf;(function(_0x30ba6a,_0x1ed356){const _0xd51dd4=a238_0x10cf,_0x3c1187=_0x30ba6a();while(!![]){try{const _0x15f48e=parseInt(_0xd51dd4(0xd8))/0x1*(parseInt(_0xd51dd4(0xc6))/0x2)+-parseInt(_0xd51dd4(0xd0))/0x3*(-parseInt(_0xd51dd4(0xcd))/0x4)+parseInt(_0xd51dd4(0xcc))/0x5*(-parseInt(_0xd51dd4(0xc9))/0x6)+-parseInt(_0xd51dd4(0xd7))/0x7+parseInt(_0xd51dd4(0xc8))/0x8+parseInt(_0xd51dd4(0xc3))/0x9*(-parseInt(_0xd51dd4(0xd5))/0xa)+parseInt(_0xd51dd4(0xc5))/0xb;if(_0x15f48e===_0x1ed356)break;else _0x3c1187['push'](_0x3c1187['shift']());}catch(_0x165294){_0x3c1187['push'](_0x3c1187['shift']());}}}(a238_0x528d,0x6e8a0));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':'sql','command':a238_0xaec629(0xd2),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a238_0xaec629(0xd4),'flags':[SQLCODE_FLAG,{'name':a238_0xaec629(0xda),'type':a238_0xaec629(0xc7),'description':a238_0xaec629(0xd1)}],async 'execute'(_0x5a684d){const _0x50d613=a238_0xaec629,_0x5bec76=await getSqlQueryInfo(_0x5a684d['appCode'],_0x5a684d[_0x50d613(0xd9)](_0x50d613(0xdb))),_0x427b0e=_0x5a684d[_0x50d613(0xd6)]('verbose');if(_0x427b0e)return{'ok':!![],'data':_0x5bec76};const _0x3edc61=_0x5bec76[_0x50d613(0xd3)]?await getDbName(_0x5a684d[_0x50d613(0xca)],_0x5bec76[_0x50d613(0xd3)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x5bec76[_0x50d613(0xcf)],'sqlName':_0x5bec76[_0x50d613(0xc4)],'db':_0x3edc61?_0x3edc61+'\x20('+_0x5bec76[_0x50d613(0xd3)]+')':_0x5bec76[_0x50d613(0xd3)]??'','description':_0x5bec76[_0x50d613(0xce)]??'','sqlContent':_0x5bec76[_0x50d613(0xcb)]??''}};}};function a238_0x528d(){const _0x4b9639=['5702iXUMYo','boolean','7061488SnvYSL','3618ZVPkih','appCode','sqlContent','7015npyYbu','748GSBkSZ','description','sqlCode','8121zSwYlU','Return\x20full\x20raw\x20SQL\x20query\x20object','detail','dbId','read','70kUEMCv','bool','3613918MiQNOW','293xUlWQE','str','verbose','sqlcode','1015425fGxoNP','sqlName','4186468wkSpqt'];a238_0x528d=function(){return _0x4b9639;};return a238_0x528d();}
|