@lovrabet/rabetbase-cli 2.5.10-beta.5 → 2.5.11-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/context.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
function a235_0x7479(_0x13b43c,_0x4176fd){_0x13b43c=_0x13b43c-0xb7;const _0x22c641=a235_0x22c6();let _0x74796d=_0x22c641[_0x13b43c];return _0x74796d;}const a235_0x341aaf=a235_0x7479;(function(_0xa8c8bc,_0x4c22af){const _0x3faec2=a235_0x7479,_0x253ccf=_0xa8c8bc();while(!![]){try{const _0x5a914e=-parseInt(_0x3faec2(0xf6))/0x1+-parseInt(_0x3faec2(0xcd))/0x2*(parseInt(_0x3faec2(0xba))/0x3)+-parseInt(_0x3faec2(0xf9))/0x4*(-parseInt(_0x3faec2(0xce))/0x5)+parseInt(_0x3faec2(0xc5))/0x6+-parseInt(_0x3faec2(0xe2))/0x7+-parseInt(_0x3faec2(0xc4))/0x8*(-parseInt(_0x3faec2(0xef))/0x9)+parseInt(_0x3faec2(0xf7))/0xa;if(_0x5a914e===_0x4c22af)break;else _0x253ccf['push'](_0x253ccf['shift']());}catch(_0x4170cc){_0x253ccf['push'](_0x253ccf['shift']());}}}(a235_0x22c6,0x68fb8));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':a235_0x341aaf(0xc1)};export const ROLE_REF_FLAG={'name':a235_0x341aaf(0xdb),'type':'string','required':!![],'description':a235_0x341aaf(0xff)};export const USER_REF_FLAG={'name':a235_0x341aaf(0xca),'type':a235_0x341aaf(0xd7),'required':!![],'description':a235_0x341aaf(0xec)};export const NAME_FLAG={'name':'name','type':'string','required':!![],'description':a235_0x341aaf(0xd9)};export const USER_NAME_FLAG={'name':'name','type':a235_0x341aaf(0xd7),'required':!![],'description':a235_0x341aaf(0xf3)};export const REMARK_FLAG={'name':a235_0x341aaf(0xe4),'type':a235_0x341aaf(0xd7),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a235_0x341aaf(0xfb),'type':'number','required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};function a235_0x22c6(){const _0x3bf5c2=['Check\x20the\x20nickname/username.\x20','Pass\x20--user\x20<id|name>.','validation','\x20member(s)\x20but\x20role\x20has\x20','Role\x20name\x20\x22','\x22\x20not\x20found\x20in\x20app\x20','filter','userId','string','find','Role\x20name','nickname','role','toLowerCase','trim','CUSTOM','user-add','OWNER','totalCount','5584488KajItS','Cannot\x20','remark','tenant_code','\x22:\x20','tenant','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Anti-drift\x20check\x20failed:\x20expected\x20','\x20built-in\x20role\x20','test','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','str','roleType','594gUuLsl','join','appCode','Role\x20id\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','dev','/smartapi/permit/user-role/delete','325044reDWRR','5066890GuVdAF','permitCount','693580ezacLa','flag','expect-user-count','name','length','username','Role\x20id\x20or\x20exact\x20role\x20name','Missing\x20user\x20reference.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Pass\x20--role\x20<id|name>.','dryRun','DEV','Removed\x20','POST','ADMIN','134571VHOwbY','includes','expectUserCount','map','flagMissing','User\x20','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Role\x20id\x20(from\x20`role\x20list`)','push','No\x20tenant\x20member\x20matches\x20\x22','84616WbySCi','80046wpSkyK','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','Pass\x20--user\x20<id>.',';\x20no\x20change.','user','roleName','Multiple\x20tenant\x20members\x20match\x20\x22','16jGdsGO','20qsyNsj'];a235_0x22c6=function(){return _0x3bf5c2;};return a235_0x22c6();}export const BUILTIN_ROLE_TYPES=[a235_0x341aaf(0xb9),a235_0x341aaf(0x104),a235_0x341aaf(0xe0)];export function isBuiltinRole(_0xb34b22){const _0x158b65=a235_0x341aaf;return BUILTIN_ROLE_TYPES[_0x158b65(0xbb)](_0xb34b22);}export function assertCustomRole(_0x55ae41,_0xc7b1e){const _0x3d1982=a235_0x341aaf;if(_0x55ae41[_0x3d1982(0xee)]!==_0x3d1982(0xde))throw CliErrors[_0x3d1982(0xd1)](_0x3d1982(0xe3)+_0xc7b1e+_0x3d1982(0xea)+_0x55ae41['roleName']+'\x20('+_0x55ae41[_0x3d1982(0xee)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x677094){const _0x526e3f=a235_0x341aaf;return{'id':_0x677094['id'],'roleName':_0x677094['roleName'],'roleType':_0x677094[_0x526e3f(0xee)],'remark':_0x677094[_0x526e3f(0xe4)],'userCount':_0x677094['userCount'],'permitCount':_0x677094[_0x526e3f(0xf8)],'builtin':isBuiltinRole(_0x677094[_0x526e3f(0xee)])};}export async function resolveRoleRef(_0x250b4c,_0x13abf5){const _0x49873b=a235_0x341aaf,_0x3a69ab=_0x13abf5[_0x49873b(0xdd)]();if(!_0x3a69ab)throw CliErrors[_0x49873b(0xd1)]('Missing\x20role\x20reference.',_0x49873b(0x102));if(/^\d+$/[_0x49873b(0xeb)](_0x3a69ab))return getRoleById(_0x250b4c,Number(_0x3a69ab));const _0x55df59=await listAllAppRoles(_0x250b4c),_0x55eafd=_0x55df59[_0x49873b(0xd5)](_0x2c3f7c=>_0x2c3f7c[_0x49873b(0xcb)]===_0x3a69ab);if(_0x55eafd[_0x49873b(0xfd)]===0x0)throw CliErrors[_0x49873b(0xd1)](_0x49873b(0xd3)+_0x3a69ab+_0x49873b(0xd4)+_0x250b4c+'.',_0x49873b(0x101));if(_0x55eafd[_0x49873b(0xfd)]>0x1){const _0x228e41=_0x55eafd[_0x49873b(0xbd)](_0x3337aa=>_0x3337aa['id'])[_0x49873b(0xf0)](',\x20');throw CliErrors[_0x49873b(0xd1)](_0x49873b(0xd3)+_0x3a69ab+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x228e41+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x55eafd[0x0];}export async function getRoleById(_0x1a3723,_0xf0b31f){const _0x546671=a235_0x341aaf,_0x1b2148=await listAllAppRoles(_0x1a3723),_0x4ff432=_0x1b2148[_0x546671(0xd5)](_0x1c07dc=>_0x1c07dc['id']===_0xf0b31f&&(!_0x1c07dc[_0x546671(0xf1)]||_0x1c07dc[_0x546671(0xf1)]===_0x1a3723));if(_0x4ff432[_0x546671(0xfd)]!==0x1)throw CliErrors[_0x546671(0xd1)](_0x546671(0xf2)+_0xf0b31f+'\x20not\x20found\x20in\x20app\x20'+_0x1a3723+'.',_0x546671(0xe8));return _0x4ff432[0x0];}async function listAllAppRoles(_0x12cdc4){const _0x108bdb=a235_0x341aaf,_0xda289c=0x64,_0x93e449=[];for(let _0x1b0a2e=0x1;;_0x1b0a2e+=0x1){const {items:_0x8f6a4d,paging:_0x22f4bc}=await listAppRoles(_0x12cdc4,{'currentPage':_0x1b0a2e,'pageSize':_0xda289c});_0x93e449[_0x108bdb(0xc2)](..._0x8f6a4d);if(_0x8f6a4d[_0x108bdb(0xfd)]<_0xda289c||_0x22f4bc&&_0x93e449[_0x108bdb(0xfd)]>=_0x22f4bc[_0x108bdb(0xe1)])return _0x93e449;}}export async function resolveTenantCode(){const _0x30b9a9=a235_0x341aaf,_0x826ebb=await getSessionUserInfo(),_0x269ca7=_0x826ebb?.[_0x30b9a9(0xca)]?.[_0x30b9a9(0xe7)]?.[_0x30b9a9(0xe5)];if(!_0x269ca7)throw CliErrors['authRequired'](_0x30b9a9(0xc7));return _0x269ca7;}function matchMember(_0x4542d4,_0x1a0bb6){const _0x8f3406=a235_0x341aaf,_0x19eba0=_0x1a0bb6[_0x8f3406(0xdd)]()[_0x8f3406(0xdc)]();return(_0x4542d4['nickname']??'')[_0x8f3406(0xdc)]()===_0x19eba0||(_0x4542d4[_0x8f3406(0xfe)]??'')['toLowerCase']()===_0x19eba0;}export async function resolveUserRef(_0x5cac08,_0x42f662=a235_0x341aaf(0xc8)){const _0x44a007=a235_0x341aaf,_0x546ffa=_0x5cac08['trim']();if(!_0x546ffa)throw CliErrors['validation'](_0x44a007(0x100),_0x44a007(0xd0));const _0x454cc1=await resolveTenantCode(),_0xb9cc9e=await getTenantMembers(_0x454cc1);if(/^\d+$/['test'](_0x546ffa)){const _0x2d73a1=Number(_0x546ffa),_0x4b7c1b=_0xb9cc9e[_0x44a007(0xd8)](_0x3529ff=>_0x3529ff[_0x44a007(0xd6)]===_0x2d73a1);return{'userId':_0x2d73a1,'username':_0x4b7c1b?.[_0x44a007(0xfe)]??String(_0x2d73a1),'nickname':_0x4b7c1b?.[_0x44a007(0xda)],'matchedBy':'id'};}const _0x58b9e2=_0xb9cc9e[_0x44a007(0xd5)](_0x1bc181=>matchMember(_0x1bc181,_0x546ffa));if(_0x58b9e2['length']===0x0)throw CliErrors[_0x44a007(0xd1)](_0x44a007(0xc3)+_0x546ffa+'\x22.',_0x44a007(0xcf)+_0x42f662);if(_0x58b9e2[_0x44a007(0xfd)]>0x1){const _0x32b3a7=_0x58b9e2['map'](_0x4d96cc=>(_0x4d96cc[_0x44a007(0xda)]??_0x4d96cc[_0x44a007(0xfe)]??'?')+'('+_0x4d96cc[_0x44a007(0xd6)]+')')['join'](',\x20');throw CliErrors['validation'](_0x44a007(0xcc)+_0x546ffa+_0x44a007(0xe6)+_0x32b3a7+'.',_0x42f662);}const _0x1ea73d=_0x58b9e2[0x0];return{'userId':_0x1ea73d[_0x44a007(0xd6)],'username':_0x1ea73d['username']??String(_0x1ea73d[_0x44a007(0xd6)]),'nickname':_0x1ea73d[_0x44a007(0xda)],'matchedBy':_0x44a007(0xfc)};}export const CREATE_USER_ROLE_PATH='/smartapi/permit/user-role/create';export const DELETE_USER_ROLE_PATH=a235_0x341aaf(0xf5);export function computeRoleUserMutation(_0x435df8){const _0x5b8409=a235_0x341aaf,{operation:_0x5a10ae,appCode:_0x4bb0ab,role:_0x366064,relations:_0xdf7af,user:_0x42902b}=_0x435df8,_0xd6b2b2=[...new Set(_0xdf7af['map'](_0x229cc9=>_0x229cc9['userId']))],_0x31b3d9=[];if(_0x435df8[_0x5b8409(0xbc)]!==undefined&&_0x435df8[_0x5b8409(0xbc)]!==_0xd6b2b2[_0x5b8409(0xfd)])throw CliErrors[_0x5b8409(0xd1)](_0x5b8409(0xe9)+_0x435df8[_0x5b8409(0xbc)]+_0x5b8409(0xd2)+_0xd6b2b2['length']+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x9a1c9e=_0xd6b2b2[_0x5b8409(0xbb)](_0x42902b[_0x5b8409(0xd6)]),_0x2f4e71=_0xdf7af['filter'](_0x31ed85=>_0x31ed85['userId']===_0x42902b['userId'])[_0x5b8409(0xbd)](_0x41fffb=>_0x41fffb['id']),_0x6eabdb=_0x5a10ae===_0x5b8409(0xdf)?!_0x9a1c9e:_0x9a1c9e;let _0xa75a26=_0xd6b2b2;_0x5a10ae==='user-add'?_0x9a1c9e?_0x31b3d9[_0x5b8409(0xc2)]('User\x20'+_0x42902b[_0x5b8409(0xd6)]+_0x5b8409(0xc6)+_0x366064[_0x5b8409(0xcb)]+';\x20no\x20change.'):_0xa75a26=[..._0xd6b2b2,_0x42902b[_0x5b8409(0xd6)]]:!_0x9a1c9e?_0x31b3d9[_0x5b8409(0xc2)](_0x5b8409(0xbf)+_0x42902b['userId']+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x366064['roleName']+_0x5b8409(0xc9)):(_0xa75a26=_0xd6b2b2[_0x5b8409(0xd5)](_0x48d310=>_0x48d310!==_0x42902b['userId']),_0x2f4e71[_0x5b8409(0xfd)]>0x1&&_0x31b3d9[_0x5b8409(0xc2)](_0x5b8409(0xb7)+_0x2f4e71[_0x5b8409(0xfd)]+'\x20duplicate\x20memberships\x20for\x20user\x20'+_0x42902b['userId']+'.'));const _0x1dd22c={'scope':_0x5b8409(0xf4),'operation':_0x5a10ae,'selector':{'appCode':_0x4bb0ab,'roleId':_0x366064['id'],'roleName':_0x366064['roleName'],'userId':_0x42902b[_0x5b8409(0xd6)]},'before':{'userIds':_0xd6b2b2},'after':{'userIds':_0xa75a26},'dryRun':_0x435df8[_0x5b8409(0x103)],'backend':{'method':_0x5b8409(0xb8),'path':_0x5a10ae==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x31b3d9};return{'mutation':_0x1dd22c,'changed':_0x6eabdb,'matchingRelationIds':_0x2f4e71};}export async function loadDevRoleRelations(_0x4c3780,_0x265c87){const _0x6d192a=a235_0x341aaf,_0x373e3f=0x64,_0x1036d8=[];for(let _0x15c5b4=0x1;;_0x15c5b4+=0x1){const {items:_0x213733,paging:_0x5a8dc3}=await listDevUserRoleRelations(_0x4c3780,{'roleId':_0x265c87,'currentPage':_0x15c5b4,'pageSize':_0x373e3f});_0x1036d8[_0x6d192a(0xc2)](..._0x213733);if(_0x213733[_0x6d192a(0xfd)]<_0x373e3f||_0x5a8dc3&&_0x1036d8[_0x6d192a(0xfd)]>=_0x5a8dc3[_0x6d192a(0xe1)])return _0x1036d8;}}export function readRoleRef(_0x880e78){const _0x4a047b=a235_0x341aaf,_0x2e098b=_0x880e78[_0x4a047b(0xed)](_0x4a047b(0xdb))[_0x4a047b(0xdd)]();if(!_0x2e098b)throw CliErrors[_0x4a047b(0xbe)](_0x4a047b(0xdb),_0x4a047b(0x102));return _0x2e098b;}export async function prepareUserMutation(_0x2509fc,_0x244e84,_0x247963){const _0x2e4c51=a235_0x341aaf,_0x5c0d16=readRoleRef(_0x2509fc),_0xf956a2=_0x2509fc[_0x2e4c51(0xed)](_0x2e4c51(0xca))[_0x2e4c51(0xdd)]();if(!_0xf956a2)throw CliErrors[_0x2e4c51(0xbe)](_0x2e4c51(0xca),'Pass\x20--user\x20<id|name>.');const _0x4259ca=_0x2509fc[_0x2e4c51(0xfa)]('expect-user-count'),_0x31da9a=_0x4259ca===undefined||_0x4259ca===null?undefined:Number(_0x4259ca),_0x3b38d1=await resolveRoleRef(_0x2509fc[_0x2e4c51(0xf1)],_0x5c0d16);if(_0x3b38d1[_0x2e4c51(0xee)]===_0x2e4c51(0xe0))throw CliErrors[_0x2e4c51(0xd1)](_0x2e4c51(0xe3)+_0x244e84+'\x20members\x20of\x20the\x20OWNER\x20role.',_0x2e4c51(0xc0));const _0x12b068=await resolveUserRef(_0xf956a2),_0x10a353=await loadDevRoleRelations(_0x2509fc['appCode'],_0x3b38d1['id']);return{...computeRoleUserMutation({'operation':_0x244e84,'appCode':_0x2509fc[_0x2e4c51(0xf1)],'role':_0x3b38d1,'relations':_0x10a353,'user':{'userId':_0x12b068['userId'],'username':_0x12b068[_0x2e4c51(0xfe)],'nickname':_0x12b068['nickname']},'dryRun':_0x247963,..._0x31da9a!==undefined?{'expectUserCount':_0x31da9a}:{}}),'role':_0x3b38d1,'user':_0x12b068};}
|
|
1
|
+
const a235_0x1f828e=a235_0x5389;(function(_0x248671,_0x4c890a){const _0xf10414=a235_0x5389,_0x25f5c2=_0x248671();while(!![]){try{const _0x3ea8fe=parseInt(_0xf10414(0x121))/0x1*(-parseInt(_0xf10414(0xe1))/0x2)+parseInt(_0xf10414(0xe0))/0x3*(parseInt(_0xf10414(0xeb))/0x4)+parseInt(_0xf10414(0xf6))/0x5+parseInt(_0xf10414(0xf0))/0x6*(parseInt(_0xf10414(0x107))/0x7)+-parseInt(_0xf10414(0xdb))/0x8*(parseInt(_0xf10414(0x119))/0x9)+-parseInt(_0xf10414(0x11c))/0xa*(-parseInt(_0xf10414(0xe2))/0xb)+-parseInt(_0xf10414(0xf7))/0xc;if(_0x3ea8fe===_0x4c890a)break;else _0x25f5c2['push'](_0x25f5c2['shift']());}catch(_0x5a2bc5){_0x25f5c2['push'](_0x25f5c2['shift']());}}}(a235_0x1673,0x5f37d));function a235_0x5389(_0x2b0605,_0x1ac3cb){_0x2b0605=_0x2b0605-0xda;const _0x167315=a235_0x1673();let _0x5389cf=_0x167315[_0x2b0605];return _0x5389cf;}import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a235_0x1f828e(0xf5),'required':!![],'description':a235_0x1f828e(0x105)};export const ROLE_REF_FLAG={'name':'role','type':a235_0x1f828e(0x10c),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a235_0x1f828e(0xfe),'type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};function a235_0x1673(){const _0x3a60d9=['expect-user-count','user-add','\x20not\x20found\x20in\x20app\x20','dev','map','Cannot\x20','No\x20tenant\x20member\x20matches\x20\x22','push','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','5802471IneMyg','username','nickname','408230EFDjCv','Role\x20id\x20','\x20member(s)\x20but\x20role\x20has\x20','appCode','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','15CCHPjj','\x22\x20not\x20found\x20in\x20app\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','userCount','flagMissing','POST','\x20members\x20of\x20the\x20OWNER\x20role.','Pass\x20--user\x20<id|name>.','Role\x20name','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','join','8ePQeZH','remark','Pass\x20--role\x20<id|name>.','length','totalCount','1023kwfAia','2144kGRBHR','88KyNiLO','flag','\x20built-in\x20role\x20','authRequired','tenant_code','Missing\x20user\x20reference.','roleType','test','\x20duplicate\x20memberships\x20for\x20user\x20','12xnLEpz','validation','tenant','permitCount','userId','6uwjjen','toLowerCase',';\x20no\x20change.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','\x22:\x20','number','1410770CDogHL','1021200PCfTFh','roleName','role','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Anti-drift\x20check\x20failed:\x20expected\x20','trim','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','user','includes','Role\x20name\x20\x22','Pass\x20--user\x20<id>.','Removed\x20','filter','User\x20','Role\x20id\x20(from\x20`role\x20list`)','str','3683057hGnmDQ','\x20is\x20already\x20a\x20member\x20of\x20role\x20','name','find','DEV','string','OWNER','/smartapi/permit/user-role/create','expectUserCount'];a235_0x1673=function(){return _0x3a60d9;};return a235_0x1673();}export const NAME_FLAG={'name':a235_0x1f828e(0x109),'type':a235_0x1f828e(0x10c),'required':!![],'description':a235_0x1f828e(0x129)};export const USER_NAME_FLAG={'name':a235_0x1f828e(0x109),'type':a235_0x1f828e(0x10c),'required':!![],'description':a235_0x1f828e(0x123)};export const REMARK_FLAG={'name':a235_0x1f828e(0xdc),'type':a235_0x1f828e(0x10c),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a235_0x1f828e(0x110),'type':a235_0x1f828e(0xf5),'required':![],'description':a235_0x1f828e(0x12a)};export const BUILTIN_ROLE_TYPES=['ADMIN',a235_0x1f828e(0x10b),a235_0x1f828e(0x10d)];export function isBuiltinRole(_0x537c25){return BUILTIN_ROLE_TYPES['includes'](_0x537c25);}export function assertCustomRole(_0x2063e8,_0x5cf8ef){const _0x4d1fb8=a235_0x1f828e;if(_0x2063e8['roleType']!=='CUSTOM')throw CliErrors[_0x4d1fb8(0xec)](_0x4d1fb8(0x115)+_0x5cf8ef+_0x4d1fb8(0xe4)+_0x2063e8[_0x4d1fb8(0xf8)]+'\x20('+_0x2063e8[_0x4d1fb8(0xe8)]+').',_0x4d1fb8(0x120));}export function projectRole(_0x287d2f){const _0x24838c=a235_0x1f828e;return{'id':_0x287d2f['id'],'roleName':_0x287d2f[_0x24838c(0xf8)],'roleType':_0x287d2f['roleType'],'remark':_0x287d2f[_0x24838c(0xdc)],'userCount':_0x287d2f[_0x24838c(0x124)],'permitCount':_0x287d2f[_0x24838c(0xee)],'builtin':isBuiltinRole(_0x287d2f[_0x24838c(0xe8)])};}export async function resolveRoleRef(_0x519f76,_0x515f3b){const _0x22c3f6=a235_0x1f828e,_0x4a932c=_0x515f3b['trim']();if(!_0x4a932c)throw CliErrors[_0x22c3f6(0xec)]('Missing\x20role\x20reference.',_0x22c3f6(0xdd));if(/^\d+$/[_0x22c3f6(0xe9)](_0x4a932c))return getRoleById(_0x519f76,Number(_0x4a932c));const _0x2974f8=await listAllAppRoles(_0x519f76),_0x297102=_0x2974f8[_0x22c3f6(0x103)](_0x5e0bb0=>_0x5e0bb0[_0x22c3f6(0xf8)]===_0x4a932c);if(_0x297102[_0x22c3f6(0xde)]===0x0)throw CliErrors[_0x22c3f6(0xec)](_0x22c3f6(0x100)+_0x4a932c+_0x22c3f6(0x122)+_0x519f76+'.',_0x22c3f6(0xfd));if(_0x297102[_0x22c3f6(0xde)]>0x1){const _0x28e6bb=_0x297102[_0x22c3f6(0x114)](_0x366612=>_0x366612['id'])[_0x22c3f6(0xda)](',\x20');throw CliErrors[_0x22c3f6(0xec)](_0x22c3f6(0x100)+_0x4a932c+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x28e6bb+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x297102[0x0];}export async function getRoleById(_0x53be9a,_0x30ccf1){const _0x26deb3=a235_0x1f828e,_0x427820=await listAllAppRoles(_0x53be9a),_0x2e775a=_0x427820[_0x26deb3(0x103)](_0xa490c4=>_0xa490c4['id']===_0x30ccf1&&(!_0xa490c4[_0x26deb3(0x11f)]||_0xa490c4['appCode']===_0x53be9a));if(_0x2e775a[_0x26deb3(0xde)]!==0x1)throw CliErrors[_0x26deb3(0xec)](_0x26deb3(0x11d)+_0x30ccf1+_0x26deb3(0x112)+_0x53be9a+'.',_0x26deb3(0x118));return _0x2e775a[0x0];}async function listAllAppRoles(_0x5507d0){const _0x21659f=a235_0x1f828e,_0x4b92e5=0x64,_0x2aa18c=[];for(let _0x5b4bbb=0x1;;_0x5b4bbb+=0x1){const {items:_0x34d9d8,paging:_0xd9078}=await listAppRoles(_0x5507d0,{'currentPage':_0x5b4bbb,'pageSize':_0x4b92e5});_0x2aa18c[_0x21659f(0x117)](..._0x34d9d8);if(_0x34d9d8['length']<_0x4b92e5||_0xd9078&&_0x2aa18c[_0x21659f(0xde)]>=_0xd9078['totalCount'])return _0x2aa18c;}}export async function resolveTenantCode(){const _0x142f1d=a235_0x1f828e,_0x12df2c=await getSessionUserInfo(),_0x5778ce=_0x12df2c?.[_0x142f1d(0xfe)]?.[_0x142f1d(0xed)]?.[_0x142f1d(0xe6)];if(!_0x5778ce)throw CliErrors[_0x142f1d(0xe5)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x5778ce;}function matchMember(_0x2e15b4,_0x43a7d4){const _0x3a4be8=a235_0x1f828e,_0x3b9532=_0x43a7d4[_0x3a4be8(0xfc)]()[_0x3a4be8(0xf1)]();return(_0x2e15b4[_0x3a4be8(0x11b)]??'')['toLowerCase']()===_0x3b9532||(_0x2e15b4['username']??'')[_0x3a4be8(0xf1)]()===_0x3b9532;}export async function resolveUserRef(_0xb05d9f,_0x546318=a235_0x1f828e(0x101)){const _0x5072de=a235_0x1f828e,_0x4d7b4d=_0xb05d9f[_0x5072de(0xfc)]();if(!_0x4d7b4d)throw CliErrors[_0x5072de(0xec)](_0x5072de(0xe7),_0x5072de(0x128));const _0x1514e9=await resolveTenantCode(),_0x438aea=await getTenantMembers(_0x1514e9);if(/^\d+$/[_0x5072de(0xe9)](_0x4d7b4d)){const _0x385ec9=Number(_0x4d7b4d),_0x21ffca=_0x438aea[_0x5072de(0x10a)](_0x1a26d0=>_0x1a26d0[_0x5072de(0xef)]===_0x385ec9);return{'userId':_0x385ec9,'username':_0x21ffca?.[_0x5072de(0x11a)]??String(_0x385ec9),'nickname':_0x21ffca?.[_0x5072de(0x11b)],'matchedBy':'id'};}const _0x2274f7=_0x438aea['filter'](_0x47b0ac=>matchMember(_0x47b0ac,_0x4d7b4d));if(_0x2274f7[_0x5072de(0xde)]===0x0)throw CliErrors[_0x5072de(0xec)](_0x5072de(0x116)+_0x4d7b4d+'\x22.','Check\x20the\x20nickname/username.\x20'+_0x546318);if(_0x2274f7['length']>0x1){const _0x5c02c5=_0x2274f7['map'](_0x57ab2e=>(_0x57ab2e[_0x5072de(0x11b)]??_0x57ab2e['username']??'?')+'('+_0x57ab2e[_0x5072de(0xef)]+')')[_0x5072de(0xda)](',\x20');throw CliErrors[_0x5072de(0xec)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x4d7b4d+_0x5072de(0xf4)+_0x5c02c5+'.',_0x546318);}const _0x1790f5=_0x2274f7[0x0];return{'userId':_0x1790f5[_0x5072de(0xef)],'username':_0x1790f5['username']??String(_0x1790f5[_0x5072de(0xef)]),'nickname':_0x1790f5[_0x5072de(0x11b)],'matchedBy':_0x5072de(0x109)};}export const CREATE_USER_ROLE_PATH=a235_0x1f828e(0x10e);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';export function computeRoleUserMutation(_0x15357c){const _0x346d91=a235_0x1f828e,{operation:_0x175f59,appCode:_0x3027cf,role:_0x372426,relations:_0x11512c,user:_0x154f3e}=_0x15357c,_0x36aa30=[...new Set(_0x11512c[_0x346d91(0x114)](_0x186435=>_0x186435[_0x346d91(0xef)]))],_0xe8b05f=[];if(_0x15357c[_0x346d91(0x10f)]!==undefined&&_0x15357c['expectUserCount']!==_0x36aa30[_0x346d91(0xde)])throw CliErrors[_0x346d91(0xec)](_0x346d91(0xfb)+_0x15357c[_0x346d91(0x10f)]+_0x346d91(0x11e)+_0x36aa30[_0x346d91(0xde)]+'.',_0x346d91(0xf3));const _0x5067d6=_0x36aa30[_0x346d91(0xff)](_0x154f3e[_0x346d91(0xef)]),_0x1b464d=_0x11512c[_0x346d91(0x103)](_0x2cef16=>_0x2cef16[_0x346d91(0xef)]===_0x154f3e['userId'])[_0x346d91(0x114)](_0x18f5e6=>_0x18f5e6['id']),_0x536811=_0x175f59===_0x346d91(0x111)?!_0x5067d6:_0x5067d6;let _0x48fed3=_0x36aa30;_0x175f59===_0x346d91(0x111)?_0x5067d6?_0xe8b05f['push'](_0x346d91(0x104)+_0x154f3e[_0x346d91(0xef)]+_0x346d91(0x108)+_0x372426[_0x346d91(0xf8)]+';\x20no\x20change.'):_0x48fed3=[..._0x36aa30,_0x154f3e['userId']]:!_0x5067d6?_0xe8b05f[_0x346d91(0x117)](_0x346d91(0x104)+_0x154f3e['userId']+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x372426[_0x346d91(0xf8)]+_0x346d91(0xf2)):(_0x48fed3=_0x36aa30[_0x346d91(0x103)](_0x143b22=>_0x143b22!==_0x154f3e[_0x346d91(0xef)]),_0x1b464d[_0x346d91(0xde)]>0x1&&_0xe8b05f['push'](_0x346d91(0x102)+_0x1b464d[_0x346d91(0xde)]+_0x346d91(0xea)+_0x154f3e[_0x346d91(0xef)]+'.'));const _0x34d665={'scope':_0x346d91(0x113),'operation':_0x175f59,'selector':{'appCode':_0x3027cf,'roleId':_0x372426['id'],'roleName':_0x372426[_0x346d91(0xf8)],'userId':_0x154f3e[_0x346d91(0xef)]},'before':{'userIds':_0x36aa30},'after':{'userIds':_0x48fed3},'dryRun':_0x15357c['dryRun'],'backend':{'method':_0x346d91(0x126),'path':_0x175f59===_0x346d91(0x111)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0xe8b05f};return{'mutation':_0x34d665,'changed':_0x536811,'matchingRelationIds':_0x1b464d};}export async function loadDevRoleRelations(_0x3dcb03,_0x542d17){const _0x3edf12=a235_0x1f828e,_0xdf43c=0x64,_0x29d6f5=[];for(let _0xee1322=0x1;;_0xee1322+=0x1){const {items:_0x13a8c0,paging:_0x1b4332}=await listDevUserRoleRelations(_0x3dcb03,{'roleId':_0x542d17,'currentPage':_0xee1322,'pageSize':_0xdf43c});_0x29d6f5[_0x3edf12(0x117)](..._0x13a8c0);if(_0x13a8c0[_0x3edf12(0xde)]<_0xdf43c||_0x1b4332&&_0x29d6f5[_0x3edf12(0xde)]>=_0x1b4332[_0x3edf12(0xdf)])return _0x29d6f5;}}export function readRoleRef(_0x405ea4){const _0x130e3b=a235_0x1f828e,_0x10caef=_0x405ea4[_0x130e3b(0x106)](_0x130e3b(0xf9))['trim']();if(!_0x10caef)throw CliErrors[_0x130e3b(0x125)](_0x130e3b(0xf9),_0x130e3b(0xdd));return _0x10caef;}export async function prepareUserMutation(_0x15e913,_0x4ddb0b,_0x3cd7dd){const _0x1466aa=a235_0x1f828e,_0x10917b=readRoleRef(_0x15e913),_0x5df929=_0x15e913[_0x1466aa(0x106)]('user')[_0x1466aa(0xfc)]();if(!_0x5df929)throw CliErrors['flagMissing'](_0x1466aa(0xfe),'Pass\x20--user\x20<id|name>.');const _0x271966=_0x15e913[_0x1466aa(0xe3)](_0x1466aa(0x110)),_0x45ab81=_0x271966===undefined||_0x271966===null?undefined:Number(_0x271966),_0x3290bf=await resolveRoleRef(_0x15e913[_0x1466aa(0x11f)],_0x10917b);if(_0x3290bf['roleType']===_0x1466aa(0x10d))throw CliErrors[_0x1466aa(0xec)](_0x1466aa(0x115)+_0x4ddb0b+_0x1466aa(0x127),_0x1466aa(0xfa));const _0x5a73a1=await resolveUserRef(_0x5df929),_0x1ab54a=await loadDevRoleRelations(_0x15e913[_0x1466aa(0x11f)],_0x3290bf['id']);return{...computeRoleUserMutation({'operation':_0x4ddb0b,'appCode':_0x15e913[_0x1466aa(0x11f)],'role':_0x3290bf,'relations':_0x1ab54a,'user':{'userId':_0x5a73a1['userId'],'username':_0x5a73a1[_0x1466aa(0x11a)],'nickname':_0x5a73a1[_0x1466aa(0x11b)]},'dryRun':_0x3cd7dd,..._0x45ab81!==undefined?{'expectUserCount':_0x45ab81}:{}}),'role':_0x3290bf,'user':_0x5a73a1};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a236_0x5b9f41=a236_0x4cef;(function(_0x19689d,_0x2fc6fd){const _0x16af85=a236_0x4cef,_0x411b9c=_0x19689d();while(!![]){try{const _0xa8685d=-parseInt(_0x16af85(0x20e))/0x1*(-parseInt(_0x16af85(0x206))/0x2)+-parseInt(_0x16af85(0x1f3))/0x3+parseInt(_0x16af85(0x1fd))/0x4*(parseInt(_0x16af85(0x1f6))/0x5)+parseInt(_0x16af85(0x212))/0x6*(-parseInt(_0x16af85(0x1fb))/0x7)+parseInt(_0x16af85(0x214))/0x8*(parseInt(_0x16af85(0x210))/0x9)+-parseInt(_0x16af85(0x20b))/0xa*(parseInt(_0x16af85(0x213))/0xb)+parseInt(_0x16af85(0x1f7))/0xc;if(_0xa8685d===_0x2fc6fd)break;else _0x411b9c['push'](_0x411b9c['shift']());}catch(_0x2f6493){_0x411b9c['push'](_0x411b9c['shift']());}}}(a236_0x5b57,0xe895d));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a236_0x4cef(_0x358f71,_0x3f1f0c){_0x358f71=_0x358f71-0x1f3;const _0x5b57e4=a236_0x5b57();let _0x4cefa0=_0x5b57e4[_0x358f71];return _0x4cefa0;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a236_0x5b9f41(0x1fa);function readPatch(_0x1fe088){const _0xeaec2a=a236_0x5b9f41,_0x1a7e4f=_0x1fe088[_0xeaec2a(0x207)](_0xeaec2a(0x1ff)),_0xa7f62a=_0x1fe088[_0xeaec2a(0x207)](_0xeaec2a(0x200)),_0x1eb0dc={};if(_0x1a7e4f!==undefined&&_0x1a7e4f!==null){const _0x3f183f=String(_0x1a7e4f)[_0xeaec2a(0x20c)]();if(!_0x3f183f)throw CliErrors['validation'](_0xeaec2a(0x1f5));if(_0x3f183f[_0xeaec2a(0x205)]>0x40)throw CliErrors[_0xeaec2a(0x211)](_0xeaec2a(0x208));_0x1eb0dc[_0xeaec2a(0x1fc)]=_0x3f183f;}_0xa7f62a!==undefined&&_0xa7f62a!==null&&(_0x1eb0dc['remark']=String(_0xa7f62a));if(_0x1eb0dc['roleName']===undefined&&_0x1eb0dc[_0xeaec2a(0x200)]===undefined)throw CliErrors[_0xeaec2a(0x211)]('Nothing\x20to\x20update.',_0xeaec2a(0x209));return _0x1eb0dc;}export const roleUpdate={'service':'role','command':a236_0x5b9f41(0x204),'description':a236_0x5b9f41(0x20a),'risk':a236_0x5b9f41(0x1fe),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a236_0x5b9f41(0x1ff),'type':a236_0x5b9f41(0x1f4),'required':![],'description':a236_0x5b9f41(0x20d)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3a0023){readPatch(_0x3a0023);},async 'dryRun'(_0x1ab135){const _0x3751d1=a236_0x5b9f41,_0x422d15=_0x1ab135['num']('id'),_0x18d90c=readPatch(_0x1ab135),_0x10207d=await getRoleById(_0x1ab135[_0x3751d1(0x20f)],_0x422d15);return assertCustomRole(_0x10207d,'update'),asDryRunResult({'scope':'dev','operation':_0x3751d1(0x204),'selector':{'appCode':_0x1ab135[_0x3751d1(0x20f)],'roleId':_0x422d15,'roleName':_0x10207d[_0x3751d1(0x1fc)]},'before':projectRole(_0x10207d),'after':projectRole({..._0x10207d,..._0x18d90c[_0x3751d1(0x1fc)]!==undefined?{'roleName':_0x18d90c[_0x3751d1(0x1fc)]}:{},..._0x18d90c[_0x3751d1(0x200)]!==undefined?{'remark':_0x18d90c[_0x3751d1(0x200)]}:{}}),'dryRun':!![],'backend':{'method':_0x3751d1(0x201),'path':UPDATE_PATH},'warnings':[]},{'method':_0x3751d1(0x201),'url':UPDATE_PATH});},async 'execute'(_0xc09f92){const _0x4badb5=a236_0x5b9f41,_0x32dba8=_0xc09f92[_0x4badb5(0x202)]('id'),_0x35b936=readPatch(_0xc09f92),_0x31387f=await getRoleById(_0xc09f92[_0x4badb5(0x20f)],_0x32dba8);assertCustomRole(_0x31387f,'update'),await updateAppRole({'id':_0x32dba8,'appCode':_0xc09f92[_0x4badb5(0x20f)],..._0x35b936[_0x4badb5(0x1fc)]!==undefined?{'roleName':_0x35b936['roleName']}:{},..._0x35b936[_0x4badb5(0x200)]!==undefined?{'remark':_0x35b936[_0x4badb5(0x200)]}:{}});const _0x2cf8f3=await getRoleById(_0xc09f92[_0x4badb5(0x20f)],_0x32dba8);return{'ok':!![],'data':{'scope':_0x4badb5(0x203),'operation':_0x4badb5(0x204),'selector':{'appCode':_0xc09f92[_0x4badb5(0x20f)],'roleId':_0x32dba8,'roleName':_0x2cf8f3[_0x4badb5(0x1fc)]},'before':projectRole(_0x31387f),'after':projectRole(_0x2cf8f3),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x4badb5(0x1f8)+_0x2cf8f3[_0x4badb5(0x1fc)]+_0x4badb5(0x1f9)+_0x32dba8+')'};}};function a236_0x5b57(){const _0x21c255=['POST','num','dev','update','length','10adxgOu','flag','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','18328270CGwUHl','trim','New\x20role\x20name','11453EgbRcq','appCode','13649247RjIhIA','validation','222KlpeFX','11kFgtol','8bbtbMk','631398akEmre','string','--name\x20cannot\x20be\x20empty.','565IgvXXj','17077032hmnmbf','Updated\x20role\x20','\x20(id=','/smartapi/permit/role/update','156695bpExVj','roleName','29284WLiKIV','write','name','remark'];a236_0x5b57=function(){return _0x21c255;};return a236_0x5b57();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a237_0x5af3(_0x40ca4a,_0x3391a6){_0x40ca4a=_0x40ca4a-0xfe;const _0x53b300=a237_0x53b3();let _0x5af383=_0x53b300[_0x40ca4a];return _0x5af383;}function a237_0x53b3(){const _0x275276=['user-add','userId','No\x20change:\x20user\x20','9068983RoWScm','20208NEkiLQ','79043BlyUzg','4zqIdoh','410XPKXhq','high-risk-write','16938hLUelN','4135312OHZjuM','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','roleName','130TTOSud','\x20already\x20in\x20role\x20','59742dQVkUa','appCode','296856KbyQBT','username','selector','role','roleType','1057WQwFNR'];a237_0x53b3=function(){return _0x275276;};return a237_0x53b3();}const a237_0x2ba698=a237_0x5af3;(function(_0x192943,_0x3abf00){const _0x2b5336=a237_0x5af3,_0x3ee46a=_0x192943();while(!![]){try{const _0x304ca2=parseInt(_0x2b5336(0x112))/0x1*(-parseInt(_0x2b5336(0x113))/0x2)+parseInt(_0x2b5336(0x107))/0x3+-parseInt(_0x2b5336(0x111))/0x4*(-parseInt(_0x2b5336(0x114))/0x5)+-parseInt(_0x2b5336(0xff))/0x6*(-parseInt(_0x2b5336(0x10c))/0x7)+parseInt(_0x2b5336(0x100))/0x8+parseInt(_0x2b5336(0x105))/0x9*(-parseInt(_0x2b5336(0x103))/0xa)+-parseInt(_0x2b5336(0x110))/0xb;if(_0x304ca2===_0x3abf00)break;else _0x3ee46a['push'](_0x3ee46a['shift']());}catch(_0x474b25){_0x3ee46a['push'](_0x3ee46a['shift']());}}}(a237_0x53b3,0x5e9f2));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a237_0x2ba698(0x10a),'command':'user-add','description':a237_0x2ba698(0x101),'risk':a237_0x2ba698(0xfe),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2b3637){const _0x220844=a237_0x2ba698,{mutation:_0x5a1c24}=await prepareUserMutation(_0x2b3637,_0x220844(0x10d),!![]);return asDryRunResult(_0x5a1c24,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x11a3e3){const _0x577841=a237_0x2ba698,{mutation:_0x36b127,changed:_0x94a97e,role:_0x4bef95,user:_0x343f7e}=await prepareUserMutation(_0x11a3e3,'user-add',![]);return _0x94a97e&&await createDevUserRole({'appCode':_0x11a3e3[_0x577841(0x106)],'userId':_0x343f7e['userId'],'username':_0x343f7e[_0x577841(0x108)],'roleType':_0x4bef95[_0x577841(0x10b)],'roleId':_0x36b127[_0x577841(0x109)]['roleId']}),{'ok':!![],'data':_0x36b127,'message':_0x94a97e?'Added\x20user\x20'+_0x36b127['selector'][_0x577841(0x10e)]+'\x20to\x20role\x20'+_0x36b127[_0x577841(0x109)][_0x577841(0x102)]:_0x577841(0x10f)+_0x36b127[_0x577841(0x109)][_0x577841(0x10e)]+_0x577841(0x104)+_0x36b127[_0x577841(0x109)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a238_0x4d7b56=a238_0x14b0;(function(_0x3edc87,_0xac560e){const _0x2dd2d9=a238_0x14b0,_0x1847d9=_0x3edc87();while(!![]){try{const _0x5ceeed=parseInt(_0x2dd2d9(0x109))/0x1+-parseInt(_0x2dd2d9(0x11a))/0x2+parseInt(_0x2dd2d9(0x110))/0x3+parseInt(_0x2dd2d9(0x119))/0x4*(parseInt(_0x2dd2d9(0x111))/0x5)+-parseInt(_0x2dd2d9(0x112))/0x6+-parseInt(_0x2dd2d9(0x10e))/0x7*(-parseInt(_0x2dd2d9(0x113))/0x8)+parseInt(_0x2dd2d9(0x118))/0x9*(-parseInt(_0x2dd2d9(0x10b))/0xa);if(_0x5ceeed===_0xac560e)break;else _0x1847d9['push'](_0x1847d9['shift']());}catch(_0xf1c415){_0x1847d9['push'](_0x1847d9['shift']());}}}(a238_0x2dc7,0x4ed94));import{deleteDevUserRole}from'../../core/api-client.js';function a238_0x2dc7(){const _0x3a04aa=['roleName','814854vBBiAA','459065QVIVNu','793602YykGBB','877408yZxrmB','Removed\x20user\x20','userId','role','high-risk-write','97938PiovhE','8pFyfPL','730286MyuoEI','253742hkJoKo','POST','200sZxOZl','user-remove','selector','21vkFNrO'];a238_0x2dc7=function(){return _0x3a04aa;};return a238_0x2dc7();}function a238_0x14b0(_0x50a26f,_0x513b53){_0x50a26f=_0x50a26f-0x109;const _0x2dc7e8=a238_0x2dc7();let _0x14b0b0=_0x2dc7e8[_0x50a26f];return _0x14b0b0;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a238_0x4d7b56(0x116),'command':a238_0x4d7b56(0x10c),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a238_0x4d7b56(0x117),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5cbcfa){const _0x4474f6=a238_0x4d7b56,{mutation:_0x5954e5}=await prepareUserMutation(_0x5cbcfa,_0x4474f6(0x10c),!![]);return asDryRunResult(_0x5954e5,{'method':_0x4474f6(0x10a),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x1a1f8e){const _0x51144f=a238_0x4d7b56,{matchingRelationIds:_0x20a1fa,mutation:_0x20250b,changed:_0x26ff03}=await prepareUserMutation(_0x1a1f8e,_0x51144f(0x10c),![]);if(_0x26ff03)for(const _0x3bf667 of _0x20a1fa){await deleteDevUserRole(_0x3bf667);}return{'ok':!![],'data':_0x20250b,'message':_0x26ff03?_0x51144f(0x114)+_0x20250b[_0x51144f(0x10d)]['userId']+'\x20from\x20role\x20'+_0x20250b[_0x51144f(0x10d)][_0x51144f(0x10f)]:'No\x20change:\x20user\x20'+_0x20250b[_0x51144f(0x10d)][_0x51144f(0x115)]+'\x20not\x20in\x20role\x20'+_0x20250b[_0x51144f(0x10d)][_0x51144f(0x10f)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a239_0xfacab3=a239_0x4037;function a239_0x4037(_0x2ce07f,_0x1c1502){_0x2ce07f=_0x2ce07f-0x19d;const _0x78d83d=a239_0x78d8();let _0x403771=_0x78d83d[_0x2ce07f];return _0x403771;}(function(_0x140fc2,_0x3a46f2){const _0x3ec675=a239_0x4037,_0x3d708c=_0x140fc2();while(!![]){try{const _0x4b09a=-parseInt(_0x3ec675(0x1aa))/0x1+-parseInt(_0x3ec675(0x1b1))/0x2*(-parseInt(_0x3ec675(0x1ae))/0x3)+parseInt(_0x3ec675(0x19f))/0x4+-parseInt(_0x3ec675(0x1ad))/0x5*(parseInt(_0x3ec675(0x1a8))/0x6)+-parseInt(_0x3ec675(0x1a1))/0x7+parseInt(_0x3ec675(0x19e))/0x8*(parseInt(_0x3ec675(0x1b4))/0x9)+parseInt(_0x3ec675(0x1a4))/0xa;if(_0x4b09a===_0x3a46f2)break;else _0x3d708c['push'](_0x3d708c['shift']());}catch(_0xe33980){_0x3d708c['push'](_0x3d708c['shift']());}}}(a239_0x78d8,0x588e2));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a239_0x78d8(){const _0x1580bc=['user-resolve','username','3472260oAQOdU','str','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','userId','3243918YwOCQz','\x22\x20→\x20userId\x20','3386jKcAKN','Pass\x20--name\x20<nickname|username>.','nickname','5mJZAyQ','3ODcGlW','matchedBy','Resolved\x20\x22','457954MJtUFf','role','name','942255UnNTbX','trim','32tfdflw','939888Glousu','read','2262358kcdhxH'];a239_0x78d8=function(){return _0x1580bc;};return a239_0x78d8();}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a239_0xfacab3(0x1b2),'command':a239_0xfacab3(0x1a2),'description':a239_0xfacab3(0x1a6),'risk':a239_0xfacab3(0x1a0),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x5a6575){const _0x232ccb=a239_0xfacab3;if(!_0x5a6575[_0x232ccb(0x1a5)](_0x232ccb(0x1b3))[_0x232ccb(0x19d)]())throw CliErrors['flagMissing'](_0x232ccb(0x1b3),_0x232ccb(0x1ab));},async 'execute'(_0x14ae23){const _0x2c4815=a239_0xfacab3,_0x3cca27=_0x14ae23[_0x2c4815(0x1a5)](_0x2c4815(0x1b3))[_0x2c4815(0x19d)](),_0x4de02c=await resolveUserRef(_0x3cca27,'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':_0x4de02c['userId'],'username':_0x4de02c[_0x2c4815(0x1a3)],'nickname':_0x4de02c[_0x2c4815(0x1ac)],'matchedBy':_0x4de02c[_0x2c4815(0x1af)]}},'message':_0x2c4815(0x1b0)+_0x3cca27+_0x2c4815(0x1a9)+_0x4de02c[_0x2c4815(0x1a7)]};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a240_0x3a059c=a240_0x2732;(function(_0x508e81,_0x68697a){const _0x261ac8=a240_0x2732,_0x28225d=_0x508e81();while(!![]){try{const _0x2f8c57=-parseInt(_0x261ac8(0x122))/0x1*(parseInt(_0x261ac8(0x12a))/0x2)+-parseInt(_0x261ac8(0x131))/0x3*(-parseInt(_0x261ac8(0x123))/0x4)+-parseInt(_0x261ac8(0x129))/0x5*(parseInt(_0x261ac8(0x12c))/0x6)+-parseInt(_0x261ac8(0x126))/0x7*(-parseInt(_0x261ac8(0x121))/0x8)+parseInt(_0x261ac8(0x12b))/0x9*(parseInt(_0x261ac8(0x12d))/0xa)+-parseInt(_0x261ac8(0x124))/0xb+-parseInt(_0x261ac8(0x11c))/0xc*(parseInt(_0x261ac8(0x130))/0xd);if(_0x2f8c57===_0x68697a)break;else _0x28225d['push'](_0x28225d['shift']());}catch(_0x9920d1){_0x28225d['push'](_0x28225d['shift']());}}}(a240_0x18e2,0x22648));import{getAppRule}from'../../core/api-client.js';function a240_0x2732(_0x22f09e,_0xdae7e3){_0x22f09e=_0x22f09e-0x11c;const _0x18e2d8=a240_0x18e2();let _0x27324f=_0x18e2d8[_0x22f09e];return _0x27324f;}import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a240_0x3a059c(0x127),'command':'get','description':'Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','risk':a240_0x3a059c(0x12f),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x53c73b){readAppRuleType(_0x53c73b);},async 'execute'(_0x29077f){const _0x5840ef=a240_0x3a059c,_0x5934d9=readAppRuleType(_0x29077f),_0x28fe6c=await getAppRule(_0x29077f[_0x5840ef(0x11f)],{'appCode':_0x29077f[_0x5840ef(0x132)],'type':_0x5934d9});if(!_0x28fe6c)throw appRuleError(_0x5840ef(0x11e),appRuleFileName(_0x5934d9)+_0x5840ef(0x125)+_0x29077f[_0x5840ef(0x132)]+'.',_0x5840ef(0x128)+_0x5934d9+_0x5840ef(0x11d));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x5934d9,_0x28fe6c),'content':_0x28fe6c[_0x5840ef(0x12e)]}},'message':'Loaded\x20'+appRuleFileName(_0x5934d9)+_0x5840ef(0x120)+_0x29077f['appCode']};}};function a240_0x18e2(){const _0x16dd1d=['112qYnClf','459HplGDD','186rIpSwB','53190vkANyc','content','read','377416cBenpZ','829659xoOmja','appCode','24yqVsOF','\x20--file\x20<path>\x20--dry-run`.','app_rule_not_found','cookie','\x20for\x20','12632oxgazr','3379YYqHyw','4GNTtWX','670560srnLkA','\x20is\x20not\x20configured\x20for\x20app\x20','427erqcoY','rule','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','31455MVMXoZ'];a240_0x18e2=function(){return _0x16dd1d;};return a240_0x18e2();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a241_0x3b1d39=a241_0x2915;function a241_0x25d0(){const _0xe1932a=['16aZBAsF','2852055nGdSSP','991368AxSupN','dryRun','330743qfPZCw','execute','2949RksERO','639238nGiCeo','4990968OHYxQg','3288rJkpxV','map','signal','529555fwTWeM'];a241_0x25d0=function(){return _0xe1932a;};return a241_0x25d0();}(function(_0xddcffa,_0x4fdd31){const _0x4636f7=a241_0x2915,_0x2c8940=_0xddcffa();while(!![]){try{const _0x53426f=parseInt(_0x4636f7(0x113))/0x1+-parseInt(_0x4636f7(0x10e))/0x2+-parseInt(_0x4636f7(0x112))/0x3*(parseInt(_0x4636f7(0x115))/0x4)+parseInt(_0x4636f7(0x10b))/0x5+parseInt(_0x4636f7(0x114))/0x6+parseInt(_0x4636f7(0x110))/0x7*(parseInt(_0x4636f7(0x10c))/0x8)+parseInt(_0x4636f7(0x10d))/0x9;if(_0x53426f===_0x4fdd31)break;else _0x2c8940['push'](_0x2c8940['shift']());}catch(_0xe231ed){_0x2c8940['push'](_0x2c8940['shift']());}}}(a241_0x25d0,0xa7274));import{withKbManagementSession}from'../../core/kb-management-client.js';function a241_0x2915(_0xec1034,_0x2a6331){_0xec1034=_0xec1034-0x10a;const _0x25d056=a241_0x25d0();let _0x2915ab=_0x25d056[_0xec1034];return _0x2915ab;}import{ruleGet}from'../../commands/rule/get.js';import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet][a241_0x3b1d39(0x116)](_0x4b995e=>({..._0x4b995e,'execute':_0x490c2d=>withKbManagementSession(_0x490c2d[a241_0x3b1d39(0x10a)],()=>_0x4b995e[a241_0x3b1d39(0x111)](_0x490c2d)),..._0x4b995e[a241_0x3b1d39(0x10f)]?{'dryRun':_0x26783a=>withKbManagementSession(_0x26783a[a241_0x3b1d39(0x10a)],()=>_0x4b995e[a241_0x3b1d39(0x10f)](_0x26783a))}:{}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a242_0x5e3137=a242_0x1603;function a242_0x4b26(){const _0xd85fa7=['79472WyFoth','69ekAvtP','read','3352761xgrtWs','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','2470000BQZpps','243506tSxQSl','Loaded\x20app\x20rule\x20configuration\x20for\x20','5823640uSAogq','4190538wYvDaL','2017736gpRkXT','2bmQiSu','8qbSPZv','cookie','length','map','appCode'];a242_0x4b26=function(){return _0xd85fa7;};return a242_0x4b26();}(function(_0x1226eb,_0xb5b071){const _0x457e30=a242_0x1603,_0x201695=_0x1226eb();while(!![]){try{const _0x5be033=-parseInt(_0x457e30(0x1db))/0x1*(-parseInt(_0x457e30(0x1e7))/0x2)+-parseInt(_0x457e30(0x1e2))/0x3*(-parseInt(_0x457e30(0x1e1))/0x4)+parseInt(_0x457e30(0x1d8))/0x5+-parseInt(_0x457e30(0x1d9))/0x6+parseInt(_0x457e30(0x1da))/0x7+-parseInt(_0x457e30(0x1dc))/0x8*(parseInt(_0x457e30(0x1e4))/0x9)+-parseInt(_0x457e30(0x1e6))/0xa;if(_0x5be033===_0xb5b071)break;else _0x201695['push'](_0x201695['shift']());}catch(_0x400ad3){_0x201695['push'](_0x201695['shift']());}}}(a242_0x4b26,0xcbfa6));import{getAppRule}from'../../core/api-client.js';function a242_0x1603(_0x2044d2,_0x3eaa6d){_0x2044d2=_0x2044d2-0x1d8;const _0x4b2616=a242_0x4b26();let _0x1603cf=_0x4b2616[_0x2044d2];return _0x1603cf;}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':'rule','command':'list','description':a242_0x5e3137(0x1e5),'risk':a242_0x5e3137(0x1e3),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x5cea91){const _0x1f5ce0=a242_0x5e3137,_0x27a3fd=await Promise['all'](APP_RULE_TYPES[_0x1f5ce0(0x1df)](_0x35b9fa=>getAppRule(_0x5cea91[_0x1f5ce0(0x1dd)],{'appCode':_0x5cea91[_0x1f5ce0(0x1e0)],'type':_0x35b9fa}))),_0x2ef084=APP_RULE_TYPES['map']((_0x98df8f,_0xa544bf)=>projectAppRule(_0x98df8f,_0x27a3fd[_0xa544bf]??null));return{'ok':!![],'data':{'total':_0x2ef084[_0x1f5ce0(0x1de)],'rules':_0x2ef084},'message':_0x1f5ce0(0x1e8)+_0x5cea91[_0x1f5ce0(0x1e0)]};}};
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a243_0x52a21b=a243_0x3e7e;(function(_0x2f1cb5,_0x16837d){const _0x21e7ec=a243_0x3e7e,_0x2af9e9=_0x2f1cb5();while(!![]){try{const _0x193c1e=parseInt(_0x21e7ec(0x104))/0x1+-parseInt(_0x21e7ec(0x124))/0x2+parseInt(_0x21e7ec(0x128))/0x3+parseInt(_0x21e7ec(0x133))/0x4+parseInt(_0x21e7ec(0x132))/0x5*(-parseInt(_0x21e7ec(0x117))/0x6)+-parseInt(_0x21e7ec(0x111))/0x7*(-parseInt(_0x21e7ec(0x11c))/0x8)+-parseInt(_0x21e7ec(0x11a))/0x9;if(_0x193c1e===_0x16837d)break;else _0x2af9e9['push'](_0x2af9e9['shift']());}catch(_0x72c850){_0x2af9e9['push'](_0x2af9e9['shift']());}}}(a243_0x3cf0,0xdf979));import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function readSetInput(_0xa4c766){const _0x474f8d=a243_0x3e7e,_0x48cc30=readAppRuleType(_0xa4c766),_0x1c2be6=_0xa4c766['str'](_0x474f8d(0x127))[_0x474f8d(0x12b)]();if(!_0x1c2be6)throw appRuleError(_0x474f8d(0x114),'--file\x20is\x20required.',_0x474f8d(0x129));const _0x4d465f=_0xa4c766[_0x474f8d(0x11e)](_0x474f8d(0x11d));let _0x5a6f10;if(_0x4d465f!==undefined){_0x5a6f10=Number(_0x4d465f);if(!Number[_0x474f8d(0x134)](_0x5a6f10)||_0x5a6f10<0x0)throw appRuleError(_0x474f8d(0x106),_0x474f8d(0x11b));}return{'type':_0x48cc30,'file':_0x1c2be6,'expectedVersion':_0x5a6f10};}function a243_0x3cf0(){const _0x263bd2=['rule','app_rule_file_required','update','set','89988NFDTxz','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','contentHash','12134655rfNzNM','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','27584AQwpHD','expected-version','flag','unconfigured','POST','replacement','\x20version\x20changed\x20before\x20write.','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','902454MBkDol','defineProperty','beforeRecord','file','3935031iyINgX','Pass\x20a\x20UTF-8\x20Markdown\x20file.','length','trim','appCode','planned','RULES','app_rule_verification_failed','write','The\x20set\x20request\x20was\x20sent,\x20but\x20','205ouYxEV','4114768pEZzXw','isSafeInteger','content','rabetbase\x20rule\x20get\x20--type\x20','string','app_rule_verification_unavailable','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','cookie','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','DATABASE','create','\x20could\x20not\x20be\x20verified.','Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set','expectedVersion','Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.','version','934736YjWPNq','before','app_rule_expected_version_invalid','app_rule_set_outcome_unknown','rules','input','\x20--format\x20compress',';\x20current\x20version\x20is\x20','Expected\x20','type','number','verified','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','112ATUSjc','push'];a243_0x3cf0=function(){return _0x263bd2;};return a243_0x3cf0();}async function prepareSet(_0xcd3c67){const _0x46d30e=a243_0x3e7e,_0x5b6c5c=readSetInput(_0xcd3c67),_0x121383=await readAppRuleFile(_0x5b6c5c[_0x46d30e(0x127)]);if(_0x5b6c5c[_0x46d30e(0x10d)]===_0x46d30e(0x108)&&_0x121383[_0x46d30e(0x135)][_0x46d30e(0x12a)]>0x7d0)throw appRuleError('app_rule_content_too_large','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.');const _0x9af2d8=await getAppRule(_0xcd3c67[_0x46d30e(0x13a)],{'appCode':_0xcd3c67[_0x46d30e(0x12c)],'type':_0x5b6c5c['type']});if(_0x5b6c5c['expectedVersion']!==undefined&&(_0x9af2d8?.['version']??0x0)!==_0x5b6c5c[_0x46d30e(0x101)])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x5b6c5c[_0x46d30e(0x10d)])+_0x46d30e(0x122),_0x46d30e(0x10c)+_0x5b6c5c[_0x46d30e(0x101)]+_0x46d30e(0x10b)+(_0x9af2d8?.[_0x46d30e(0x103)]??_0x46d30e(0x11f))+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x5b6c5c,'replacement':_0x121383,'beforeRecord':_0x9af2d8,'before':projectAppRule(_0x5b6c5c['type'],_0x9af2d8),'planned':{'type':_0x5b6c5c['type'],'fileName':appRuleFileName(_0x5b6c5c[_0x46d30e(0x10d)]),'contextScope':appRuleContextScope(_0x5b6c5c[_0x46d30e(0x10d)]),'enabled':!![],'appCode':_0xcd3c67[_0x46d30e(0x12c)],'scope':_0x46d30e(0x108),'contentByteSize':_0x121383['byteSize'],'contentHash':_0x121383[_0x46d30e(0x119)]}};}function warningsFor(_0x587844){return[];}function a243_0x3e7e(_0x1ddd15,_0x335aaf){_0x1ddd15=_0x1ddd15-0x100;const _0x3cf095=a243_0x3cf0();let _0x3e7ee0=_0x3cf095[_0x1ddd15];return _0x3e7ee0;}export const ruleSet={'service':a243_0x52a21b(0x113),'command':a243_0x52a21b(0x116),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a243_0x52a21b(0x130),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x52a21b(0x127),'type':a243_0x52a21b(0x137),'required':!![],'description':a243_0x52a21b(0x13c)},{'name':a243_0x52a21b(0x11d),'type':a243_0x52a21b(0x10e),'required':![],'description':a243_0x52a21b(0x100)}],async 'validate'(_0x20a897){readSetInput(_0x20a897);},async 'dryRun'(_0x4d7637){const _0x100b6b=a243_0x52a21b,_0x463531=await prepareSet(_0x4d7637);return asDryRunResult({'operation':'set','selector':{'appCode':_0x4d7637[_0x100b6b(0x12c)],'scope':_0x100b6b(0x108),'type':_0x463531[_0x100b6b(0x109)][_0x100b6b(0x10d)]},'before':_0x463531[_0x100b6b(0x105)],'after':_0x463531[_0x100b6b(0x12d)],'dryRun':!![],'backend':{'method':_0x100b6b(0x120),'path':knowledgeDocumentsPath('rules',_0x463531[_0x100b6b(0x126)]?_0x100b6b(0x115):_0x100b6b(0x13e)),'body':{'appCode':_0x4d7637[_0x100b6b(0x12c)],..._0x463531[_0x100b6b(0x126)]?{'id':_0x463531[_0x100b6b(0x126)]['id']}:{},'title':_0x463531[_0x100b6b(0x109)][_0x100b6b(0x10d)]===_0x100b6b(0x108)?_0x100b6b(0x12e):_0x100b6b(0x13d),'contentHash':_0x463531[_0x100b6b(0x121)][_0x100b6b(0x119)],'contentByteSize':_0x463531['replacement']['byteSize'],..._0x463531[_0x100b6b(0x126)]?{'expectedVersion':_0x463531[_0x100b6b(0x126)]['version']}:{}}},'warnings':warningsFor(_0x463531[_0x100b6b(0x109)][_0x100b6b(0x101)]),'verification':{'expectedVersion':_0x463531[_0x100b6b(0x126)]?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x100b6b(0x136)+_0x463531['input'][_0x100b6b(0x10d)]+_0x100b6b(0x10a)}},{'method':_0x100b6b(0x120),'url':knowledgeDocumentsPath(_0x100b6b(0x108),_0x463531[_0x100b6b(0x126)]?'update':_0x100b6b(0x13e))});},async 'execute'(_0x3a8625){const _0x9284f2=a243_0x52a21b,_0x3b8377=await prepareSet(_0x3a8625),_0x398b16=_0x3b8377[_0x9284f2(0x126)]===null?0x1:_0x3b8377[_0x9284f2(0x126)]['version']+(_0x3b8377[_0x9284f2(0x126)][_0x9284f2(0x135)]===_0x3b8377[_0x9284f2(0x121)]['content']?0x0:0x1);let _0x1b3c96,_0x2ce320=![];try{_0x1b3c96=await saveAppRule(_0x3a8625[_0x9284f2(0x13a)],{'appCode':_0x3a8625[_0x9284f2(0x12c)],'type':_0x3b8377[_0x9284f2(0x109)][_0x9284f2(0x10d)],'content':_0x3b8377[_0x9284f2(0x121)][_0x9284f2(0x135)],'expectedVersion':_0x3b8377[_0x9284f2(0x126)]?.[_0x9284f2(0x103)]??0x0,..._0x3b8377['beforeRecord']?{'id':_0x3b8377[_0x9284f2(0x126)]['id']}:{}});if(_0x1b3c96[_0x9284f2(0x103)]!==_0x398b16||_0x1b3c96[_0x9284f2(0x135)]!==_0x3b8377[_0x9284f2(0x121)][_0x9284f2(0x135)]||_0x3b8377[_0x9284f2(0x126)]!==null&&_0x1b3c96['id']!==_0x3b8377['beforeRecord']['id'])throw appRuleError('app_rule_verification_failed',_0x9284f2(0x118),_0x9284f2(0x102));}catch(_0x215a0d){if(!isPlatformTransportFailure(_0x215a0d))throw _0x215a0d;_0x2ce320=!![];}let _0x1f4bc4;try{_0x1f4bc4=await getAppRule(_0x3a8625[_0x9284f2(0x13a)],{'appCode':_0x3a8625[_0x9284f2(0x12c)],'type':_0x3b8377[_0x9284f2(0x109)][_0x9284f2(0x10d)]});}catch(_0x1243d0){const _0x61dcf3=appRuleError(_0x2ce320?_0x9284f2(0x107):_0x9284f2(0x138),_0x9284f2(0x131)+appRuleFileName(_0x3b8377['input'][_0x9284f2(0x10d)])+_0x9284f2(0x13f),_0x9284f2(0x110));Object[_0x9284f2(0x125)](_0x61dcf3,'cause',{'value':_0x1243d0,'enumerable':![]});throw _0x61dcf3;}const _0x54947a=_0x1f4bc4&&inspectAppRuleContent(_0x1f4bc4[_0x9284f2(0x135)])[_0x9284f2(0x119)]===_0x3b8377[_0x9284f2(0x121)][_0x9284f2(0x119)],_0x488ed9=_0x1f4bc4&&_0x1f4bc4[_0x9284f2(0x103)]===_0x398b16&&(!_0x1b3c96||_0x1f4bc4['id']===_0x1b3c96['id']&&_0x1f4bc4[_0x9284f2(0x103)]===_0x1b3c96[_0x9284f2(0x103)]);if(!_0x1f4bc4||!_0x54947a||!_0x488ed9||_0x3b8377['beforeRecord']!==null&&_0x1f4bc4['id']!==_0x3b8377[_0x9284f2(0x126)]['id'])throw appRuleError(_0x2ce320?_0x9284f2(0x107):_0x9284f2(0x12f),appRuleFileName(_0x3b8377['input'][_0x9284f2(0x10d)])+_0x9284f2(0x123),'Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20'+_0x3b8377[_0x9284f2(0x109)][_0x9284f2(0x10d)]+_0x9284f2(0x139));const _0x8a4820=warningsFor(_0x3b8377['input'][_0x9284f2(0x101)]);_0x2ce320&&_0x8a4820[_0x9284f2(0x112)](_0x9284f2(0x13b));const _0x29c728=projectAppRule(_0x3b8377[_0x9284f2(0x109)][_0x9284f2(0x10d)],_0x1f4bc4);return{'ok':!![],'data':{'operation':'set','selector':{'appCode':_0x3a8625[_0x9284f2(0x12c)],'scope':_0x9284f2(0x108),'type':_0x3b8377[_0x9284f2(0x109)][_0x9284f2(0x10d)]},'before':_0x3b8377[_0x9284f2(0x105)],'after':_0x29c728,'dryRun':![],'backend':{'method':'POST','path':knowledgeDocumentsPath(_0x9284f2(0x108),_0x3b8377[_0x9284f2(0x126)]?_0x9284f2(0x115):_0x9284f2(0x13e))},'warnings':_0x8a4820,'verification':{'status':_0x9284f2(0x10f),'recoveredAfterUnknownResponse':_0x2ce320,'expectedVersion':_0x3b8377[_0x9284f2(0x126)]?.[_0x9284f2(0x103)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x9284f2(0x136)+_0x3b8377[_0x9284f2(0x109)][_0x9284f2(0x10d)]+_0x9284f2(0x10a)}},'message':'Set\x20'+appRuleFileName(_0x3b8377[_0x9284f2(0x109)][_0x9284f2(0x10d)])+'\x20for\x20'+_0x3a8625[_0x9284f2(0x12c)]};}};
|
|
1
|
+
const a243_0x3a4a87=a243_0x457a;(function(_0x5307f8,_0x1676fe){const _0x2e32f3=a243_0x457a,_0x525b34=_0x5307f8();while(!![]){try{const _0x528312=-parseInt(_0x2e32f3(0xc2))/0x1+-parseInt(_0x2e32f3(0xd4))/0x2+-parseInt(_0x2e32f3(0xec))/0x3*(-parseInt(_0x2e32f3(0xcf))/0x4)+-parseInt(_0x2e32f3(0xf5))/0x5*(-parseInt(_0x2e32f3(0xf4))/0x6)+parseInt(_0x2e32f3(0xd7))/0x7*(-parseInt(_0x2e32f3(0xde))/0x8)+parseInt(_0x2e32f3(0xf1))/0x9+parseInt(_0x2e32f3(0xea))/0xa*(parseInt(_0x2e32f3(0xd6))/0xb);if(_0x528312===_0x1676fe)break;else _0x525b34['push'](_0x525b34['shift']());}catch(_0x13ac74){_0x525b34['push'](_0x525b34['shift']());}}}(a243_0x25e2,0x3c434));function a243_0x457a(_0x481ab8,_0x16d318){_0x481ab8=_0x481ab8-0xc1;const _0x25e220=a243_0x25e2();let _0x457a08=_0x25e220[_0x481ab8];return _0x457a08;}import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';function a243_0x25e2(){const _0x3945c2=['Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set','6egYoKl','1842890hzxHxQ','app_rule_content_too_large','DATABASE','isSafeInteger','input','length','unconfigured','beforeRecord','Pass\x20a\x20UTF-8\x20Markdown\x20file.','appCode','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','31864tfawxe','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','rules','app_rule_verification_unavailable','\x20for\x20','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','file','type','replacement','expected-version','string','Expected\x20','byteSize','20XFVjHe','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','--file\x20is\x20required.','app_rule_set_outcome_unknown',';\x20current\x20version\x20is\x20','818984NpIOpz','\x20--format\x20compress','1211947QihOix','2480086IoViji','cookie','RULES','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','POST','flag','The\x20set\x20request\x20was\x20sent,\x20but\x20','8sEfSHV','update','verified','push','number','before','contentHash','planned','content','set','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','app_rule_verification_failed','10tfYFsK','\x20could\x20not\x20be\x20verified.','100797wzvKcT','rabetbase\x20rule\x20get\x20--type\x20','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','expectedVersion','version','3561660hANhoc','create'];a243_0x25e2=function(){return _0x3945c2;};return a243_0x25e2();}import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function readSetInput(_0x7e0133){const _0x1073f6=a243_0x457a,_0x3f6d7d=readAppRuleType(_0x7e0133),_0x4815d3=_0x7e0133['str'](_0x1073f6(0xc8))['trim']();if(!_0x4815d3)throw appRuleError('app_rule_file_required',_0x1073f6(0xd1),_0x1073f6(0xfd));const _0x2520cb=_0x7e0133[_0x1073f6(0xdc)](_0x1073f6(0xcb));let _0x15e25a;if(_0x2520cb!==undefined){_0x15e25a=Number(_0x2520cb);if(!Number[_0x1073f6(0xf8)](_0x15e25a)||_0x15e25a<0x0)throw appRuleError('app_rule_expected_version_invalid','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x3f6d7d,'file':_0x4815d3,'expectedVersion':_0x15e25a};}async function prepareSet(_0x1cf1ca){const _0x400dfb=a243_0x457a,_0x1ba3ad=readSetInput(_0x1cf1ca),_0x4cca26=await readAppRuleFile(_0x1ba3ad[_0x400dfb(0xc8)]);if(_0x1ba3ad['type']===_0x400dfb(0xc4)&&_0x4cca26[_0x400dfb(0xe6)][_0x400dfb(0xfa)]>0x7d0)throw appRuleError(_0x400dfb(0xf6),_0x400dfb(0xee));const _0x2adbaa=await getAppRule(_0x1cf1ca[_0x400dfb(0xd8)],{'appCode':_0x1cf1ca[_0x400dfb(0xfe)],'type':_0x1ba3ad[_0x400dfb(0xc9)]});if(_0x1ba3ad['expectedVersion']!==undefined&&(_0x2adbaa?.['version']??0x0)!==_0x1ba3ad[_0x400dfb(0xef)])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x1ba3ad[_0x400dfb(0xc9)])+'\x20version\x20changed\x20before\x20write.',_0x400dfb(0xcd)+_0x1ba3ad[_0x400dfb(0xef)]+_0x400dfb(0xd3)+(_0x2adbaa?.[_0x400dfb(0xf0)]??_0x400dfb(0xfb))+_0x400dfb(0xe8));return{'input':_0x1ba3ad,'replacement':_0x4cca26,'beforeRecord':_0x2adbaa,'before':projectAppRule(_0x1ba3ad[_0x400dfb(0xc9)],_0x2adbaa),'planned':{'type':_0x1ba3ad[_0x400dfb(0xc9)],'fileName':appRuleFileName(_0x1ba3ad['type']),'contextScope':appRuleContextScope(_0x1ba3ad[_0x400dfb(0xc9)]),'enabled':!![],'appCode':_0x1cf1ca[_0x400dfb(0xfe)],'scope':'rules','contentByteSize':_0x4cca26['byteSize'],'contentHash':_0x4cca26[_0x400dfb(0xe4)]}};}function warningsFor(_0x32ecbe){return[];}export const ruleSet={'service':'rule','command':a243_0x3a4a87(0xe7),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x3a4a87(0xc8),'type':a243_0x3a4a87(0xcc),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)'},{'name':'expected-version','type':a243_0x3a4a87(0xe2),'required':![],'description':a243_0x3a4a87(0xf3)}],async 'validate'(_0x4dd49b){readSetInput(_0x4dd49b);},async 'dryRun'(_0x15df51){const _0x1b2760=a243_0x3a4a87,_0x482f62=await prepareSet(_0x15df51);return asDryRunResult({'operation':_0x1b2760(0xe7),'selector':{'appCode':_0x15df51[_0x1b2760(0xfe)],'scope':'rules','type':_0x482f62[_0x1b2760(0xf9)][_0x1b2760(0xc9)]},'before':_0x482f62[_0x1b2760(0xe3)],'after':_0x482f62[_0x1b2760(0xe5)],'dryRun':!![],'backend':{'method':_0x1b2760(0xdb),'path':knowledgeDocumentsPath('rules',_0x482f62[_0x1b2760(0xfc)]?_0x1b2760(0xdf):_0x1b2760(0xf2)),'body':{'appCode':_0x15df51['appCode'],..._0x482f62[_0x1b2760(0xfc)]?{'id':_0x482f62[_0x1b2760(0xfc)]['id']}:{},'title':_0x482f62[_0x1b2760(0xf9)][_0x1b2760(0xc9)]===_0x1b2760(0xc4)?_0x1b2760(0xd9):_0x1b2760(0xf7),'contentHash':_0x482f62[_0x1b2760(0xca)][_0x1b2760(0xe4)],'contentByteSize':_0x482f62[_0x1b2760(0xca)][_0x1b2760(0xce)],..._0x482f62[_0x1b2760(0xfc)]?{'expectedVersion':_0x482f62['beforeRecord'][_0x1b2760(0xf0)]}:{}}},'warnings':warningsFor(_0x482f62[_0x1b2760(0xf9)]['expectedVersion']),'verification':{'expectedVersion':_0x482f62['beforeRecord']?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x1b2760(0xed)+_0x482f62['input'][_0x1b2760(0xc9)]+_0x1b2760(0xd5)}},{'method':_0x1b2760(0xdb),'url':knowledgeDocumentsPath(_0x1b2760(0xc4),_0x482f62[_0x1b2760(0xfc)]?'update':_0x1b2760(0xf2))});},async 'execute'(_0x542289){const _0x4b71c7=a243_0x3a4a87,_0x463058=await prepareSet(_0x542289),_0x47b545=_0x463058[_0x4b71c7(0xfc)]===null?0x1:_0x463058[_0x4b71c7(0xfc)][_0x4b71c7(0xf0)]+(_0x463058[_0x4b71c7(0xfc)][_0x4b71c7(0xe6)]===_0x463058[_0x4b71c7(0xca)][_0x4b71c7(0xe6)]?0x0:0x1);let _0x190d8e,_0x5501cf=![];try{_0x190d8e=await saveAppRule(_0x542289[_0x4b71c7(0xd8)],{'appCode':_0x542289['appCode'],'type':_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)],'content':_0x463058[_0x4b71c7(0xca)][_0x4b71c7(0xe6)],'expectedVersion':_0x463058[_0x4b71c7(0xfc)]?.[_0x4b71c7(0xf0)]??0x0,..._0x463058[_0x4b71c7(0xfc)]?{'id':_0x463058[_0x4b71c7(0xfc)]['id']}:{}});if(_0x190d8e[_0x4b71c7(0xf0)]!==_0x47b545||_0x190d8e[_0x4b71c7(0xe6)]!==_0x463058['replacement']['content']||_0x463058[_0x4b71c7(0xfc)]!==null&&_0x190d8e['id']!==_0x463058[_0x4b71c7(0xfc)]['id'])throw appRuleError('app_rule_verification_failed',_0x4b71c7(0xd0),'Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.');}catch(_0x476125){if(!isPlatformTransportFailure(_0x476125))throw _0x476125;_0x5501cf=!![];}let _0x213f60;try{_0x213f60=await getAppRule(_0x542289[_0x4b71c7(0xd8)],{'appCode':_0x542289[_0x4b71c7(0xfe)],'type':_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)]});}catch(_0x38b4cb){const _0x15fa46=appRuleError(_0x5501cf?_0x4b71c7(0xd2):_0x4b71c7(0xc5),_0x4b71c7(0xdd)+appRuleFileName(_0x463058['input'][_0x4b71c7(0xc9)])+_0x4b71c7(0xeb),_0x4b71c7(0xda));Object['defineProperty'](_0x15fa46,'cause',{'value':_0x38b4cb,'enumerable':![]});throw _0x15fa46;}const _0x4ab1a7=_0x213f60&&inspectAppRuleContent(_0x213f60['content'])[_0x4b71c7(0xe4)]===_0x463058[_0x4b71c7(0xca)][_0x4b71c7(0xe4)],_0x4346b7=_0x213f60&&_0x213f60[_0x4b71c7(0xf0)]===_0x47b545&&(!_0x190d8e||_0x213f60['id']===_0x190d8e['id']&&_0x213f60[_0x4b71c7(0xf0)]===_0x190d8e['version']);if(!_0x213f60||!_0x4ab1a7||!_0x4346b7||_0x463058[_0x4b71c7(0xfc)]!==null&&_0x213f60['id']!==_0x463058[_0x4b71c7(0xfc)]['id'])throw appRuleError(_0x5501cf?_0x4b71c7(0xd2):_0x4b71c7(0xe9),appRuleFileName(_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)])+_0x4b71c7(0xc7),_0x4b71c7(0xc1)+_0x463058['input'][_0x4b71c7(0xc9)]+_0x4b71c7(0xc3));const _0x1c7a48=warningsFor(_0x463058['input'][_0x4b71c7(0xef)]);_0x5501cf&&_0x1c7a48[_0x4b71c7(0xe1)]('Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.');const _0x4bf8e5=projectAppRule(_0x463058['input'][_0x4b71c7(0xc9)],_0x213f60);return{'ok':!![],'data':{'operation':_0x4b71c7(0xe7),'selector':{'appCode':_0x542289[_0x4b71c7(0xfe)],'scope':_0x4b71c7(0xc4),'type':_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)]},'before':_0x463058[_0x4b71c7(0xe3)],'after':_0x4bf8e5,'dryRun':![],'backend':{'method':_0x4b71c7(0xdb),'path':knowledgeDocumentsPath(_0x4b71c7(0xc4),_0x463058[_0x4b71c7(0xfc)]?_0x4b71c7(0xdf):_0x4b71c7(0xf2))},'warnings':_0x1c7a48,'verification':{'status':_0x4b71c7(0xe0),'recoveredAfterUnknownResponse':_0x5501cf,'expectedVersion':_0x463058[_0x4b71c7(0xfc)]?.[_0x4b71c7(0xf0)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x4b71c7(0xed)+_0x463058['input'][_0x4b71c7(0xc9)]+_0x4b71c7(0xd5)}},'message':'Set\x20'+appRuleFileName(_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)])+_0x4b71c7(0xc6)+_0x542289[_0x4b71c7(0xfe)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x4d9b6d=a244_0x8d69;(function(_0x29e328,_0x38dc03){const _0x21a69c=a244_0x8d69,_0x2290fd=_0x29e328();while(!![]){try{const _0x3d93fa=parseInt(_0x21a69c(0x1ab))/0x1*(-parseInt(_0x21a69c(0x1a2))/0x2)+parseInt(_0x21a69c(0x1b4))/0x3+parseInt(_0x21a69c(0x1ae))/0x4*(parseInt(_0x21a69c(0x19a))/0x5)+-parseInt(_0x21a69c(0x1a4))/0x6+-parseInt(_0x21a69c(0x1ba))/0x7+parseInt(_0x21a69c(0x1bf))/0x8*(parseInt(_0x21a69c(0x197))/0x9)+parseInt(_0x21a69c(0x1a6))/0xa;if(_0x3d93fa===_0x38dc03)break;else _0x2290fd['push'](_0x2290fd['shift']());}catch(_0x2ec1a8){_0x2290fd['push'](_0x2290fd['shift']());}}}(a244_0x31a9,0x342de));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x4d9b6d(0x1b5),'database'];export const MAX_APP_RULE_UNITS=0x5*0x400*0x400;export const MAX_APP_RULE_BYTES=MAX_APP_RULE_UNITS*0x4;const APP_RULE_FILES={'rules':a244_0x4d9b6d(0x1c0),'database':a244_0x4d9b6d(0x1a8)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':'database-analysis'};function a244_0x8d69(_0x41f4b9,_0x4bd798){_0x41f4b9=_0x41f4b9-0x192;const _0x31a916=a244_0x31a9();let _0x8d69e3=_0x31a916[_0x41f4b9];return _0x8d69e3;}function a244_0x31a9(){const _0xea8c29=['8xCVsoL','RULES.md','App\x20rule\x20file\x20is\x20blank:\x20','updateTime','appCode','message','Pass\x20a\x20UTF-8\x20Markdown\x20file.','byteLength','createTime','size','app_rule_content_invalid','isFile','213309sYGdkH','app_rule_file_invalid','indexStatus','95lbjQpm','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','content','hex','utf8','app_rule_type_invalid','decode','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','13388hjEsbc','byteSize','2339778BZXoCs','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','6891290WJPaNS','str','DATABASE.md','Cannot\x20access\x20app\x20rule\x20file:\x20','contentHash','11zoqmkv','update','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','3268atAhzV','length','app_rule_file_unreadable','--file\x20is\x20required.','type','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','457464kLqgvA','rules','digest','string','app_rule_content_too_large','database','1424626zGaaeT','app_rule_file_required','Cannot\x20read\x20app\x20rule\x20file:\x20','trim','from'];a244_0x31a9=function(){return _0xea8c29;};return a244_0x31a9();}export function appRuleError(_0x22c938,_0x314636,_0x241c5c){return new CliError(_0x22c938,0x1,_0x314636,_0x241c5c);}export function readAppRuleType(_0x198825){const _0x40a5b0=a244_0x4d9b6d,_0x2ba2b7=_0x198825[_0x40a5b0(0x1a7)](_0x40a5b0(0x1b2))[_0x40a5b0(0x1bd)]()['toLowerCase']();if(_0x2ba2b7!==_0x40a5b0(0x1b5)&&_0x2ba2b7!==_0x40a5b0(0x1b9))throw appRuleError(_0x40a5b0(0x19f),_0x40a5b0(0x1a5));return _0x2ba2b7;}export function appRuleFileName(_0x54ea0b){return APP_RULE_FILES[_0x54ea0b];}export function appRuleContextScope(_0x3733a4){return APP_RULE_CONTEXT_SCOPES[_0x3733a4];}export function inspectAppRuleContent(_0x25559f){const _0xdb166b=a244_0x4d9b6d,_0x60e866=Buffer[_0xdb166b(0x1be)](_0x25559f,_0xdb166b(0x19e));return{'content':_0x25559f,'byteSize':_0x60e866['byteLength'],'contentHash':'sha256:'+createHash('sha256')[_0xdb166b(0x1ac)](_0x60e866)[_0xdb166b(0x1b6)](_0xdb166b(0x19d))};}export async function readAppRuleFile(_0x1df64f){const _0x1e1b9d=a244_0x4d9b6d,_0x5e5579=_0x1df64f[_0x1e1b9d(0x1bd)]();if(!_0x5e5579)throw appRuleError(_0x1e1b9d(0x1bb),_0x1e1b9d(0x1b1),_0x1e1b9d(0x1c5));const _0xec515a=resolve(_0x5e5579);let _0x2c4dc2;try{_0x2c4dc2=await stat(_0xec515a);}catch(_0x2d8d26){throw appRuleError(_0x1e1b9d(0x1b0),_0x1e1b9d(0x1a9)+_0x5e5579,_0x2d8d26 instanceof Error?_0x2d8d26[_0x1e1b9d(0x1c4)]:String(_0x2d8d26));}if(!_0x2c4dc2[_0x1e1b9d(0x196)]())throw appRuleError(_0x1e1b9d(0x198),'App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x5e5579);if(_0x2c4dc2[_0x1e1b9d(0x194)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e1b9d(0x1b8),_0x1e1b9d(0x19b));let _0x5c9e5f;try{_0x5c9e5f=await readFile(_0xec515a);}catch(_0x2f3d9a){throw appRuleError('app_rule_file_unreadable',_0x1e1b9d(0x1bc)+_0x5e5579,_0x2f3d9a instanceof Error?_0x2f3d9a[_0x1e1b9d(0x1c4)]:String(_0x2f3d9a));}if(_0x5c9e5f[_0x1e1b9d(0x192)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e1b9d(0x1b8),_0x1e1b9d(0x19b));let _0x3e9f34;try{_0x3e9f34=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x1e1b9d(0x1a0)](_0x5c9e5f);}catch{throw appRuleError(_0x1e1b9d(0x195),_0x1e1b9d(0x1a1)+_0x5e5579);}if(_0x3e9f34[_0x1e1b9d(0x1af)]>MAX_APP_RULE_UNITS)throw appRuleError(_0x1e1b9d(0x1b8),_0x1e1b9d(0x1b3));if(!_0x3e9f34[_0x1e1b9d(0x1bd)]())throw appRuleError(_0x1e1b9d(0x195),_0x1e1b9d(0x1c1)+_0x5e5579);return inspectAppRuleContent(_0x3e9f34);}export function projectAppRule(_0x478422,_0x28fea3){const _0x24931c=a244_0x4d9b6d;if(!_0x28fea3)return{'type':_0x478422,'fileName':appRuleFileName(_0x478422),'contextScope':appRuleContextScope(_0x478422),'enabled':![]};const _0x34fc5d=inspectAppRuleContent(_0x28fea3[_0x24931c(0x19c)]);return{'type':_0x478422,'fileName':appRuleFileName(_0x478422),'contextScope':appRuleContextScope(_0x478422),'enabled':!![],'id':_0x28fea3['id'],'scope':_0x28fea3['scope'],'appCode':_0x28fea3[_0x24931c(0x1c3)],'version':_0x28fea3['version'],..._0x28fea3[_0x24931c(0x199)]!==undefined?{'indexStatus':_0x28fea3[_0x24931c(0x199)]}:{},'contentByteSize':_0x34fc5d[_0x24931c(0x1a3)],'contentHash':_0x34fc5d[_0x24931c(0x1aa)],..._0x28fea3[_0x24931c(0x193)]!==undefined&&_0x28fea3[_0x24931c(0x193)]!==null?{'createTime':_0x28fea3[_0x24931c(0x193)]}:{},..._0x28fea3['updateTime']!==undefined&&_0x28fea3[_0x24931c(0x1c2)]!==null?{'updateTime':_0x28fea3[_0x24931c(0x1c2)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x4d9b6d(0x1b2),'type':a244_0x4d9b6d(0x1b7),'required':!![],'description':a244_0x4d9b6d(0x1ad),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a245_0x1d51dc=a245_0x35d2;(function(_0x1733ef,_0x3d9b48){const _0xdf22f4=a245_0x35d2,_0x2bcec1=_0x1733ef();while(!![]){try{const _0x394928=-parseInt(_0xdf22f4(0x1dc))/0x1+parseInt(_0xdf22f4(0x1df))/0x2+parseInt(_0xdf22f4(0x1f7))/0x3+parseInt(_0xdf22f4(0x20a))/0x4+parseInt(_0xdf22f4(0x1d3))/0x5+-parseInt(_0xdf22f4(0x20d))/0x6+-parseInt(_0xdf22f4(0x1ed))/0x7;if(_0x394928===_0x3d9b48)break;else _0x2bcec1['push'](_0x2bcec1['shift']());}catch(_0x515de8){_0x2bcec1['push'](_0x2bcec1['shift']());}}}(a245_0x3f23,0xeaefa));function a245_0x3f23(){const _0x5471b5=['node_modules','\x20\x20EXAMPLES','needsUpgrade','\x20run\x20preview\x20--watch','slice','run','start','(none)','inherit','dev','4730026QgpQEH','close','length','npm','log','watch','Script\x20name\x20defined\x20in\x20package.json','pnpm','yarn.lock','\x20run\x20','881385scCNWb','bool','Available:\x20','\x20run\x20start','bun.lockb','.bin','args','--watch','scripts','preview','\x20\x20\x20\x20','bun','path','No\x20package.json\x20found\x20in\x20current\x20directory.','\x0a\x20\x20Available\x20scripts:\x0a','vite\x20preview\x20exited\x20with\x20code\x20','bun.lock','build','write','5399528rwyXpV','cwd','parse','10054344hkqccO','6568390RgqcIi','belowMinimum','has','Enable\x20watch\x20mode\x20for\x20preview','pnpm-lock.yaml','push','error','Domain\x20routing\x20synchronized:\x20','changed','1211828aHzXvf','script','validation','3136426oGDquB','Script\x20\x22','vite','vite\x20build\x20--watch\x20exited\x20with\x20code\x20'];a245_0x3f23=function(){return _0x5471b5;};return a245_0x3f23();}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';function a245_0x35d2(_0x11ed10,_0x15cbdb){_0x11ed10=_0x11ed10-0x1d3;const _0x3f237b=a245_0x3f23();let _0x35d289=_0x3f237b[_0x11ed10];return _0x35d289;}import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x1d51dc(0x1e9),a245_0x1d51dc(0x1ec)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x1d51dc(0x1e9),a245_0x1d51dc(0x1ec),a245_0x1d51dc(0x208),a245_0x1d51dc(0x200)]);export function syncProjectDomainRoutingBeforeScript(_0x31c3ab,_0x5bb64c){const _0x2590e6=a245_0x1d51dc;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x5bb64c))return null;const _0x1a3c3d=findProjectRootDirectory(_0x31c3ab);if(!resolveConfigPath(_0x1a3c3d))return null;const _0xcd0090=writeProjectDomainRoutingManifest(_0x1a3c3d);return{'path':_0xcd0090['path'],'changed':_0xcd0090[_0x2590e6(0x1db)]};}function readPackageScripts(_0x2ca0db){const _0x358fa7=a245_0x1d51dc,_0x54c697=resolve(_0x2ca0db,'package.json');if(!existsSync(_0x54c697))return null;try{const _0x18dd8b=JSON[_0x358fa7(0x20c)](readFileSync(_0x54c697,'utf-8'));return _0x18dd8b[_0x358fa7(0x1ff)]??{};}catch{return null;}}function detectPackageManager(_0x5bccec){const _0x5c5745=a245_0x1d51dc;if(existsSync(resolve(_0x5bccec,_0x5c5745(0x1fb)))||existsSync(resolve(_0x5bccec,_0x5c5745(0x207))))return _0x5c5745(0x202);if(existsSync(resolve(_0x5bccec,_0x5c5745(0x1d7))))return _0x5c5745(0x1f4);if(existsSync(resolve(_0x5bccec,_0x5c5745(0x1f5))))return'yarn';return _0x5c5745(0x1f0);}async function versionCheck(_0x459206){const _0x2f0892=a245_0x1d51dc,_0x3aab20=await checkCliVersion();(_0x3aab20[_0x2f0892(0x1e5)]||_0x3aab20[_0x2f0892(0x1d4)])&&(printCliUpgradeWarning(_0x3aab20),assertCliVersionSupported(_0x3aab20));const _0x57c5c1=await checkSdkVersion(_0x459206);if(_0x57c5c1[_0x2f0892(0x1e5)])printSdkUpgradeWarning(_0x57c5c1);}function spawnScript(_0x6f292a,_0x26ace4,_0x282e2e,_0xe75507){return new Promise((_0x672ca5,_0x48d093)=>{const _0x26c104=a245_0x35d2,_0x358cf5=[_0x26c104(0x1e8),_0x26ace4,..._0x282e2e],_0x43176a=spawn(_0x6f292a,_0x358cf5,{'cwd':_0xe75507,'stdio':_0x26c104(0x1eb),'shell':!![],'env':{...process.env,'PATH':''+join(_0xe75507,_0x26c104(0x1e3),_0x26c104(0x1fc))+delimiter+process.env.PATH}});_0x43176a['on'](_0x26c104(0x1ee),_0x1d1058=>{const _0x16b97c=_0x26c104;if(_0x1d1058===0x0||_0x1d1058===null)_0x672ca5();else _0x48d093(new Error(_0x6f292a+_0x16b97c(0x1f6)+_0x26ace4+'\x20exited\x20with\x20code\x20'+_0x1d1058));}),_0x43176a['on'](_0x26c104(0x1d9),_0x48d093);});}function spawnViteBuildWatch(_0x355a76){return new Promise((_0x220283,_0x8eccd1)=>{const _0x4cdc9a=a245_0x35d2,_0x385b77=spawn(_0x4cdc9a(0x1e1),[_0x4cdc9a(0x208),_0x4cdc9a(0x1fe)],{'cwd':_0x355a76,'stdio':_0x4cdc9a(0x1eb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x355a76,'node_modules',_0x4cdc9a(0x1fc))+delimiter+process.env.PATH}});_0x385b77['on'](_0x4cdc9a(0x1ee),_0x1a8619=>{const _0x1483bf=_0x4cdc9a;if(_0x1a8619===0x0||_0x1a8619===null)_0x220283();else _0x8eccd1(new Error(_0x1483bf(0x1e2)+_0x1a8619));}),_0x385b77['on']('error',_0x8eccd1);});}function spawnVitePreview(_0x1656f8){return new Promise((_0x4cb262,_0x1d668d)=>{const _0x396cb2=a245_0x35d2,_0x3d1436=spawn('vite',[_0x396cb2(0x200)],{'cwd':_0x1656f8,'stdio':_0x396cb2(0x1eb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1656f8,_0x396cb2(0x1e3),_0x396cb2(0x1fc))+delimiter+process.env.PATH}});_0x3d1436['on'](_0x396cb2(0x1ee),_0x1a4e8c=>{const _0x3740c9=_0x396cb2;if(_0x1a4e8c===0x0||_0x1a4e8c===null)_0x4cb262();else _0x1d668d(new Error(_0x3740c9(0x206)+_0x1a4e8c));}),_0x3d1436['on']('error',_0x1d668d);});}const runFlags=[{'name':a245_0x1d51dc(0x1f2),'type':'boolean','description':a245_0x1d51dc(0x1d6),'default':![]}];export const runDefinition={'service':a245_0x1d51dc(0x1e8),'command':'run','description':'Run\x20a\x20package.json\x20script','risk':a245_0x1d51dc(0x209),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x1d51dc(0x1dd),'description':a245_0x1d51dc(0x1f3),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3bd86a=a245_0x1d51dc,_0x470235=[];return _0x470235[_0x3bd86a(0x1d8)](_0x3bd86a(0x1e4)),_0x470235[_0x3bd86a(0x1d8)](_0x3bd86a(0x201)+CLI_BIN_NAME+_0x3bd86a(0x1fa)),_0x470235['push'](_0x3bd86a(0x201)+CLI_BIN_NAME+'\x20run\x20build'),_0x470235[_0x3bd86a(0x1d8)](_0x3bd86a(0x201)+CLI_BIN_NAME+'\x20run\x20preview'),_0x470235[_0x3bd86a(0x1d8)](_0x3bd86a(0x201)+CLI_BIN_NAME+_0x3bd86a(0x1e6)),_0x470235['join']('\x0a');},async 'execute'(_0x15e8e5){const _0x571dd2=a245_0x1d51dc,_0x5ea0d1=process[_0x571dd2(0x20b)](),_0x546839=_0x15e8e5[_0x571dd2(0x1fd)][0x0],_0x5b6fba=_0x15e8e5[_0x571dd2(0x1fd)][_0x571dd2(0x1e7)](0x1),_0x2bffa4=readPackageScripts(_0x5ea0d1);if(!_0x2bffa4)throw CliErrors['validation'](_0x571dd2(0x204));if(!_0x546839){const _0x4c5165=Object['keys'](_0x2bffa4);if(_0x4c5165[_0x571dd2(0x1ef)]===0x0)console[_0x571dd2(0x1f1)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x571dd2(0x1f1)](_0x571dd2(0x205));for(const _0xdf48cd of _0x4c5165){console[_0x571dd2(0x1f1)](_0x571dd2(0x201)+_0xdf48cd);}console[_0x571dd2(0x1f1)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x2bffa4[_0x546839])throw CliErrors[_0x571dd2(0x1de)](_0x571dd2(0x1e0)+_0x546839+'\x22\x20not\x20found\x20in\x20package.json.',_0x571dd2(0x1f9)+(Object['keys'](_0x2bffa4)['join'](',\x20')||_0x571dd2(0x1ea)));const _0x5d9e36=detectPackageManager(_0x5ea0d1),_0x3df0ae=syncProjectDomainRoutingBeforeScript(_0x5ea0d1,_0x546839);_0x3df0ae?.[_0x571dd2(0x1db)]&&console[_0x571dd2(0x1d9)](_0x571dd2(0x1da)+_0x3df0ae[_0x571dd2(0x203)]);VERSION_CHECK_SCRIPTS[_0x571dd2(0x1d5)](_0x546839)&&await versionCheck(_0x5ea0d1);if(_0x546839===_0x571dd2(0x200)&&_0x15e8e5[_0x571dd2(0x1f8)](_0x571dd2(0x1f2)))return await Promise['all']([spawnViteBuildWatch(_0x5ea0d1),spawnVitePreview(_0x5ea0d1)]),{'ok':!![]};return await spawnScript(_0x5d9e36,_0x546839,_0x5b6fba,_0x5ea0d1),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a246_0x53e3b5=a246_0xfc5a;function a246_0x2667(){const _0x88114a=['260ftUywh','98412QkWroQ','818044xPEOXY','642342pVAhUh','schema','11FVbbyJ','1626639RhQruI','999122xXpDRb','read','4261914PfGeZD','15294910QHSqtV','json','8PEUJFn','8zaHuqB'];a246_0x2667=function(){return _0x88114a;};return a246_0x2667();}function a246_0xfc5a(_0xd98708,_0x1b223a){_0xd98708=_0xd98708-0x139;const _0x2667f4=a246_0x2667();let _0xfc5ae3=_0x2667f4[_0xd98708];return _0xfc5ae3;}(function(_0x1d847d,_0x41fa46){const _0x24a8d2=a246_0xfc5a,_0x3f9314=_0x1d847d();while(!![]){try{const _0x493d64=-parseInt(_0x24a8d2(0x13d))/0x1+parseInt(_0x24a8d2(0x142))/0x2+-parseInt(_0x24a8d2(0x13e))/0x3*(parseInt(_0x24a8d2(0x139))/0x4)+parseInt(_0x24a8d2(0x13b))/0x5*(-parseInt(_0x24a8d2(0x13c))/0x6)+parseInt(_0x24a8d2(0x141))/0x7+-parseInt(_0x24a8d2(0x13a))/0x8*(-parseInt(_0x24a8d2(0x144))/0x9)+-parseInt(_0x24a8d2(0x145))/0xa*(-parseInt(_0x24a8d2(0x140))/0xb);if(_0x493d64===_0x41fa46)break;else _0x3f9314['push'](_0x3f9314['shift']());}catch(_0x19cf2b){_0x3f9314['push'](_0x3f9314['shift']());}}}(a246_0x2667,0x9b397));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x123b18){const _0x1886f3=await buildSchemaPayload();return{'ok':!![],'data':_0x1886f3};}export const schemaDefinition={'service':a246_0x53e3b5(0x13f),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a246_0x53e3b5(0x143),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a246_0x53e3b5(0x146),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a247_0x2ed3f2=a247_0x2c78;(function(_0x4263fb,_0x242193){const _0x44eb6e=a247_0x2c78,_0x3d133a=_0x4263fb();while(!![]){try{const _0x1dc8b4=parseInt(_0x44eb6e(0x1e2))/0x1*(parseInt(_0x44eb6e(0x200))/0x2)+parseInt(_0x44eb6e(0x207))/0x3*(-parseInt(_0x44eb6e(0x1f1))/0x4)+parseInt(_0x44eb6e(0x204))/0x5+-parseInt(_0x44eb6e(0x206))/0x6*(-parseInt(_0x44eb6e(0x1da))/0x7)+-parseInt(_0x44eb6e(0x1f4))/0x8+-parseInt(_0x44eb6e(0x1f5))/0x9+parseInt(_0x44eb6e(0x1f3))/0xa;if(_0x1dc8b4===_0x242193)break;else _0x3d133a['push'](_0x3d133a['shift']());}catch(_0x2773ae){_0x3d133a['push'](_0x3d133a['shift']());}}}(a247_0x4ad0,0xe3068));import{writeFile}from'node:fs/promises';function a247_0x4ad0(){const _0x5bcec0=['appCode','map','length','Invalid\x20database\x20selection\x20payload:\x20','mode','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Local\x20SQL\x20file\x20mode','23485YsGoCZ','sqlCode','sqlRoot','catch','description','dbId','db-id','isInteger','343481uEaIDL','lockFilePath','SQL\x20name:','__manual__','SQL\x20name\x20cannot\x20be\x20empty','✎\x20Enter\x20dbId\x20manually','Target\x20database\x20dbId:','write','Plain\x20SQL\x20(sql)','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','File\x20already\x20exists:\x20','mybatisXml','sql','new','8vtKdPa','\x20\x20SELECT\x201\x20AS\x20id','42087680aIHqev','10085456kBlkwO','12560445clRIrr','str','name','POST','utf8','<server-generated-sqlCode>','trim','SQL\x20query\x20display\x20name','MyBatis\x20XML\x20(mybatisXml)','number','sqlRootDir','6IUkHxS','sqls','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','isFinite','152565nMZUyL','Created\x20SQL\x20query\x20','18MdDpYK','2540409VavjAA','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','parse','nonInteractive','flagMissing','string','toISOString','sqlName','dbId\x20cannot\x20be\x20empty','/smartapi/custom/saveUserCustomSql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','join','dbName'];a247_0x4ad0=function(){return _0x5bcec0;};return a247_0x4ad0();}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a247_0x2c78(_0x39575b,_0x53c1d1){_0x39575b=_0x39575b-0x1d9;const _0x4ad0c4=a247_0x4ad0();let _0x2c783a=_0x4ad0c4[_0x39575b];return _0x2c783a;}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(_0x1f0f26){const _0x45d43f=a247_0x2c78;if(_0x1f0f26==='mybatisXml')return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x45d43f(0x1f2),'</select>','']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x45d43f(0x212)]('\x0a');}export const sqlCreate={'service':a247_0x2ed3f2(0x1ef),'command':'create','description':a247_0x2ed3f2(0x219),'risk':a247_0x2ed3f2(0x1e9),'flags':[{'name':a247_0x2ed3f2(0x1f7),'type':a247_0x2ed3f2(0x20c),'description':a247_0x2ed3f2(0x1fc)},{'name':a247_0x2ed3f2(0x1e0),'type':a247_0x2ed3f2(0x1fe),'description':'Target\x20database\x20ID'},{'name':'mode','type':a247_0x2ed3f2(0x20c),'enum':[a247_0x2ed3f2(0x1ef),a247_0x2ed3f2(0x1ee)],'description':a247_0x2ed3f2(0x1d9)}],async 'validate'(_0x1c5a28){const _0x1ef209=a247_0x2ed3f2;if(!_0x1c5a28[_0x1ef209(0x20a)])return;if(!_0x1c5a28['str'](_0x1ef209(0x1f7))[_0x1ef209(0x1fb)]())throw CliErrors[_0x1ef209(0x20b)](_0x1ef209(0x1f7),_0x1ef209(0x208));const _0x350372=resolveProvidedDbId(_0x1c5a28);if(typeof _0x350372!==_0x1ef209(0x1fe)||!Number[_0x1ef209(0x203)](_0x350372)||_0x350372<=0x0)throw CliErrors[_0x1ef209(0x20b)](_0x1ef209(0x1e0),_0x1ef209(0x211));if(!_0x1c5a28['str'](_0x1ef209(0x218))[_0x1ef209(0x1fb)]())throw CliErrors[_0x1ef209(0x20b)](_0x1ef209(0x218),_0x1ef209(0x1ec));},async 'dryRun'(_0x3bae48){const _0xf5ce52=a247_0x2ed3f2,_0x4d2072=loadSqlProjectConfig(_0x3bae48['appCode']),{sqlName:_0x467295,dbId:_0xf59b70,dbName:_0x1c48a2,mode:_0x135adf}=await resolveSqlNewInputs(_0x3bae48),_0x261965=buildSqlRelativePath(_0xf5ce52(0x1fa),_0x467295,_0x1c48a2,_0x135adf,_0xf59b70),_0x3d84e7=_0x4d2072[_0xf5ce52(0x1ff)]+'/'+_0x261965;return{'method':_0xf5ce52(0x1f8),'url':_0xf5ce52(0x210),'body':{'appCode':_0x3bae48['appCode'],'sqlName':_0x467295,'dbId':_0xf59b70,'mode':_0x135adf,'localPath':_0x3d84e7},'description':_0xf5ce52(0x202)+_0x4d2072[_0xf5ce52(0x1ff)]};},async 'execute'(_0x57f9da){const _0x15d88=a247_0x2ed3f2,_0x304fc7=loadSqlProjectConfig(_0x57f9da[_0x15d88(0x214)]),{sqlName:_0x661a47,dbId:_0x99c219,dbName:_0x5b9902,mode:_0x40abea}=await resolveSqlNewInputs(_0x57f9da),_0x4befa4=generateSqlTemplate(_0x40abea),_0x3e3338=await createSqlQuery({'appCode':_0x57f9da[_0x15d88(0x214)],'sqlName':_0x661a47,'dbId':_0x99c219,'sqlContent':_0x4befa4}),_0x117a38=ensureRemoteSqlContent(_0x3e3338),_0x4d36bf=_0x5b9902||await getDbName(_0x57f9da[_0x15d88(0x214)],_0x99c219)[_0x15d88(0x1dd)](()=>undefined),_0x1d58c2=buildSqlRelativePath(_0x3e3338[_0x15d88(0x1db)],_0x3e3338[_0x15d88(0x20e)],_0x4d36bf,_0x40abea,_0x99c219),_0x5f1c2e=_0x304fc7[_0x15d88(0x1ff)]+'/'+_0x1d58c2,_0x40e464=buildLocalSqlFileContent({'sqlCode':_0x3e3338['sqlCode'],'sqlName':_0x3e3338[_0x15d88(0x20e)],'dbId':_0x3e3338['dbId']},_0x117a38,{'dbName':_0x4d36bf,'mode':_0x40abea,'syncedAt':new Date()[_0x15d88(0x20d)](),'description':_0x3e3338[_0x15d88(0x1de)]});if(await fileExists(_0x5f1c2e))throw CliErrors['validation'](_0x15d88(0x1ed)+_0x5f1c2e);await ensureParentDirectory(_0x5f1c2e),await writeFile(_0x5f1c2e,_0x40e464,_0x15d88(0x1f9));const _0x39f4df=await readSqlLockFile(_0x304fc7['lockFilePath']),{lockData:_0x182e04,appLock:_0x471c05}=ensureSqlLockScope(_0x39f4df??createEmptySqlLock(),_0x304fc7['appCode'],_0x304fc7[_0x15d88(0x1dc)],_0x15d88(0x1f0));return _0x471c05[_0x15d88(0x201)][_0x3e3338[_0x15d88(0x1db)]]={...buildSqlLockEntry(_0x3e3338,_0x117a38,computeSqlContentHash(_0x40e464),{'dbName':_0x4d36bf}),'path':_0x1d58c2,'mode':_0x40abea},_0x471c05['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x304fc7[_0x15d88(0x1e3)],_0x182e04),{'ok':!![],'data':{'id':_0x3e3338['id'],'sqlCode':_0x3e3338[_0x15d88(0x1db)],'sqlName':_0x3e3338[_0x15d88(0x20e)],'dbId':_0x3e3338[_0x15d88(0x1df)],'path':_0x5f1c2e,'mode':_0x40abea},'message':_0x15d88(0x205)+_0x3e3338[_0x15d88(0x1db)]};}};async function resolveSqlNewInputs(_0x4f107d){const _0x3a7c9f=await resolveSqlNameInput(_0x4f107d),{dbId:_0x5261bf,dbName:_0x1269cf}=await resolveDbSelection(_0x4f107d),_0x58a4db=await resolveSqlModeInput(_0x4f107d);return{'sqlName':_0x3a7c9f,'dbId':_0x5261bf,'dbName':_0x1269cf,'mode':_0x58a4db};}async function resolveSqlNameInput(_0x57b545){const _0x2e4e23=a247_0x2ed3f2,_0x4c6903=_0x57b545[_0x2e4e23(0x1f6)](_0x2e4e23(0x1f7))[_0x2e4e23(0x1fb)]();if(_0x4c6903)return _0x4c6903;if(_0x57b545['nonInteractive'])throw CliErrors[_0x2e4e23(0x20b)](_0x2e4e23(0x1f7),_0x2e4e23(0x208));return(await input({'message':_0x2e4e23(0x1e4),'validate':_0x49b37f=>_0x49b37f['trim']()?!![]:_0x2e4e23(0x1e6)}))[_0x2e4e23(0x1fb)]();}async function resolveDbSelection(_0x194bbe){const _0x5b1b71=a247_0x2ed3f2,_0x39df54=resolveProvidedDbId(_0x194bbe);if(typeof _0x39df54===_0x5b1b71(0x1fe)&&Number['isFinite'](_0x39df54)&&_0x39df54>0x0)return{'dbId':_0x39df54,'dbName':await getDbName(_0x194bbe[_0x5b1b71(0x214)],_0x39df54)[_0x5b1b71(0x1dd)](()=>undefined)};if(_0x194bbe[_0x5b1b71(0x20a)])throw CliErrors[_0x5b1b71(0x20b)](_0x5b1b71(0x1e0),_0x5b1b71(0x211));const _0x3327df=await listDatabases(_0x194bbe['appCode'])[_0x5b1b71(0x1dd)](()=>[]);if(_0x3327df[_0x5b1b71(0x216)]===0x1)return{'dbId':_0x3327df[0x0]['dbId'],'dbName':_0x3327df[0x0][_0x5b1b71(0x213)]};if(_0x3327df[_0x5b1b71(0x216)]>0x1){const _0x316c32=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x3327df[_0x5b1b71(0x215)](_0x180d4f=>({'name':_0x180d4f[_0x5b1b71(0x213)]+'\x20('+_0x180d4f['dbId']+')','value':serializeDbSelection(_0x180d4f)})),{'name':_0x5b1b71(0x1e7),'value':_0x5b1b71(0x1e5)}]});if(_0x316c32!==_0x5b1b71(0x1e5))return deserializeDbSelection(_0x316c32);}const _0xc59731=await input({'message':_0x5b1b71(0x1e8),'validate':_0xb2dbd5=>{const _0x1d71b1=_0x5b1b71,_0x24ea46=_0xb2dbd5['trim']();if(!_0x24ea46)return _0x1d71b1(0x20f);const _0x59c4f0=Number(_0x24ea46);if(!Number[_0x1d71b1(0x1e1)](_0x59c4f0)||_0x59c4f0<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0xc59731['trim']())};}async function resolveSqlModeInput(_0x376980){const _0x385646=a247_0x2ed3f2,_0x319f3b=_0x376980[_0x385646(0x1f6)](_0x385646(0x218))[_0x385646(0x1fb)]();if(_0x319f3b===_0x385646(0x1ef)||_0x319f3b===_0x385646(0x1ee))return _0x319f3b;if(_0x376980['nonInteractive'])throw CliErrors[_0x385646(0x20b)](_0x385646(0x218),_0x385646(0x1ec));return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':_0x385646(0x1ea),'value':_0x385646(0x1ef),'description':_0x385646(0x1eb)},{'name':_0x385646(0x1fd),'value':'mybatisXml','description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x1e3935){const _0x315443=a247_0x2ed3f2;return JSON['stringify']({'dbId':_0x1e3935[_0x315443(0x1df)],'dbName':_0x1e3935[_0x315443(0x213)]});}function deserializeDbSelection(_0x11d7df){const _0x594e50=a247_0x2ed3f2;try{const _0x3a07b3=JSON[_0x594e50(0x209)](_0x11d7df);if(typeof _0x3a07b3[_0x594e50(0x1df)]===_0x594e50(0x1fe)&&Number[_0x594e50(0x203)](_0x3a07b3[_0x594e50(0x1df)]))return{'dbId':_0x3a07b3['dbId'],'dbName':_0x3a07b3['dbName']};}catch{}throw CliErrors['validation'](_0x594e50(0x217)+_0x11d7df);}function resolveProvidedDbId(_0x582a20){const _0x1a8fbe=a247_0x2ed3f2,_0x553076=_0x582a20['flag']('db-id');if(typeof _0x553076===_0x1a8fbe(0x1fe)&&Number[_0x1a8fbe(0x203)](_0x553076))return _0x553076;return undefined;}
|
|
1
|
+
const a247_0x2ee645=a247_0x51f5;(function(_0x3b3638,_0x1f9d7a){const _0xdb2c7e=a247_0x51f5,_0xadf74c=_0x3b3638();while(!![]){try{const _0x42ec41=parseInt(_0xdb2c7e(0x123))/0x1+parseInt(_0xdb2c7e(0x157))/0x2*(parseInt(_0xdb2c7e(0x14f))/0x3)+parseInt(_0xdb2c7e(0x14e))/0x4*(-parseInt(_0xdb2c7e(0x117))/0x5)+parseInt(_0xdb2c7e(0x129))/0x6*(parseInt(_0xdb2c7e(0x124))/0x7)+parseInt(_0xdb2c7e(0x13d))/0x8*(-parseInt(_0xdb2c7e(0x13e))/0x9)+-parseInt(_0xdb2c7e(0x12b))/0xa+-parseInt(_0xdb2c7e(0x15d))/0xb*(-parseInt(_0xdb2c7e(0x135))/0xc);if(_0x42ec41===_0x1f9d7a)break;else _0xadf74c['push'](_0xadf74c['shift']());}catch(_0x5c5245){_0xadf74c['push'](_0xadf74c['shift']());}}}(a247_0x5213,0xd5b0e));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a247_0x51f5(_0x5b0c99,_0xcc300b){_0x5b0c99=_0x5b0c99-0x117;const _0x5213ef=a247_0x5213();let _0x51f51c=_0x5213ef[_0x5b0c99];return _0x51f51c;}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a247_0x5213(){const _0x212a81=['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','db-id','create','new','toISOString','sqls','sqlRootDir','description','179418FrjtkX','11241587UWsLss','SELECT\x201\x20AS\x20id;','str','sqlCode','isInteger','6gqvRyW','Target\x20database\x20ID','15469440THOTOg','dbId','string','catch','sqlRoot','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','dbId\x20must\x20be\x20a\x20positive\x20integer','map','SQL\x20query\x20display\x20name','36fKPgBJ','join','Select\x20the\x20local\x20SQL\x20mode:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','length','lastSync','POST','parse','2328xPzdxs','5589LLAWxH','/smartapi/custom/saveUserCustomSql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name\x20cannot\x20be\x20empty','nonInteractive','lockFilePath','dbId\x20cannot\x20be\x20empty','number','__manual__','trim','write','Select\x20the\x20target\x20database:','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbName','sql','48tMDvJE','105MZmrEq','flagMissing','mybatisXml','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','\x20\x20SELECT\x201\x20AS\x20id','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','appCode','49190tTzgbY','validation','✎\x20Enter\x20dbId\x20manually','mode','MyBatis\x20XML\x20(mybatisXml)','name','3718649bNAsBX','440595yUKdXo','isFinite','sqlName','Invalid\x20database\x20selection\x20payload:\x20'];a247_0x5213=function(){return _0x212a81;};return a247_0x5213();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2fa646){const _0x3b42e4=a247_0x51f5;if(_0x2fa646===_0x3b42e4(0x151))return[_0x3b42e4(0x11b),_0x3b42e4(0x154),'</select>',''][_0x3b42e4(0x136)]('\x0a');return[_0x3b42e4(0x125),'']['join']('\x0a');}export const sqlCreate={'service':a247_0x2ee645(0x14d),'command':a247_0x2ee645(0x11d),'description':a247_0x2ee645(0x130),'risk':a247_0x2ee645(0x148),'flags':[{'name':'name','type':a247_0x2ee645(0x12d),'description':a247_0x2ee645(0x134)},{'name':a247_0x2ee645(0x11c),'type':a247_0x2ee645(0x145),'description':a247_0x2ee645(0x12a)},{'name':a247_0x2ee645(0x15a),'type':a247_0x2ee645(0x12d),'enum':[a247_0x2ee645(0x14d),a247_0x2ee645(0x151)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x358a3e){const _0x380627=a247_0x2ee645;if(!_0x358a3e[_0x380627(0x142)])return;if(!_0x358a3e[_0x380627(0x126)](_0x380627(0x15c))[_0x380627(0x147)]())throw CliErrors['flagMissing'](_0x380627(0x15c),_0x380627(0x138));const _0x3d2928=resolveProvidedDbId(_0x358a3e);if(typeof _0x3d2928!==_0x380627(0x145)||!Number[_0x380627(0x118)](_0x3d2928)||_0x3d2928<=0x0)throw CliErrors[_0x380627(0x150)](_0x380627(0x11c),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x358a3e[_0x380627(0x126)](_0x380627(0x15a))['trim']())throw CliErrors[_0x380627(0x150)](_0x380627(0x15a),_0x380627(0x152));},async 'dryRun'(_0x206882){const _0x1a978e=a247_0x2ee645,_0x568aaa=loadSqlProjectConfig(_0x206882['appCode']),{sqlName:_0x13af2c,dbId:_0x3e8a15,dbName:_0x45a7c9,mode:_0x9b8441}=await resolveSqlNewInputs(_0x206882),_0x597127=buildSqlRelativePath('<server-generated-sqlCode>',_0x13af2c,_0x45a7c9,_0x9b8441,_0x3e8a15),_0x41c465=_0x568aaa['sqlRootDir']+'/'+_0x597127;return{'method':_0x1a978e(0x13b),'url':_0x1a978e(0x13f),'body':{'appCode':_0x206882[_0x1a978e(0x156)],'sqlName':_0x13af2c,'dbId':_0x3e8a15,'mode':_0x9b8441,'localPath':_0x41c465},'description':_0x1a978e(0x14b)+_0x568aaa[_0x1a978e(0x121)]};},async 'execute'(_0x20abb3){const _0x357500=a247_0x2ee645,_0x2ce8e5=loadSqlProjectConfig(_0x20abb3[_0x357500(0x156)]),{sqlName:_0x56fdcb,dbId:_0x258966,dbName:_0x417189,mode:_0x3d8932}=await resolveSqlNewInputs(_0x20abb3),_0x3b00aa=generateSqlTemplate(_0x3d8932),_0x6d2040=await createSqlQuery({'appCode':_0x20abb3[_0x357500(0x156)],'sqlName':_0x56fdcb,'dbId':_0x258966,'sqlContent':_0x3b00aa}),_0x320cf8=ensureRemoteSqlContent(_0x6d2040),_0x319eb2=_0x417189||await getDbName(_0x20abb3[_0x357500(0x156)],_0x258966)[_0x357500(0x12e)](()=>undefined),_0x2b8a43=buildSqlRelativePath(_0x6d2040[_0x357500(0x127)],_0x6d2040[_0x357500(0x119)],_0x319eb2,_0x3d8932,_0x258966),_0x798366=_0x2ce8e5['sqlRootDir']+'/'+_0x2b8a43,_0x266dbf=buildLocalSqlFileContent({'sqlCode':_0x6d2040[_0x357500(0x127)],'sqlName':_0x6d2040[_0x357500(0x119)],'dbId':_0x6d2040[_0x357500(0x12c)]},_0x320cf8,{'dbName':_0x319eb2,'mode':_0x3d8932,'syncedAt':new Date()[_0x357500(0x11f)](),'description':_0x6d2040[_0x357500(0x122)]});if(await fileExists(_0x798366))throw CliErrors[_0x357500(0x158)]('File\x20already\x20exists:\x20'+_0x798366);await ensureParentDirectory(_0x798366),await writeFile(_0x798366,_0x266dbf,'utf8');const _0x472cf3=await readSqlLockFile(_0x2ce8e5[_0x357500(0x143)]),{lockData:_0x25eb6d,appLock:_0x4aef70}=ensureSqlLockScope(_0x472cf3??createEmptySqlLock(),_0x2ce8e5['appCode'],_0x2ce8e5[_0x357500(0x12f)],_0x357500(0x11e));return _0x4aef70[_0x357500(0x120)][_0x6d2040[_0x357500(0x127)]]={...buildSqlLockEntry(_0x6d2040,_0x320cf8,computeSqlContentHash(_0x266dbf),{'dbName':_0x319eb2}),'path':_0x2b8a43,'mode':_0x3d8932},_0x4aef70[_0x357500(0x13a)]=new Date()[_0x357500(0x11f)](),await writeSqlLockFile(_0x2ce8e5[_0x357500(0x143)],_0x25eb6d),{'ok':!![],'data':{'id':_0x6d2040['id'],'sqlCode':_0x6d2040[_0x357500(0x127)],'sqlName':_0x6d2040[_0x357500(0x119)],'dbId':_0x6d2040[_0x357500(0x12c)],'path':_0x798366,'mode':_0x3d8932},'message':_0x357500(0x153)+_0x6d2040[_0x357500(0x127)]};}};async function resolveSqlNewInputs(_0x479911){const _0xcdbdf1=await resolveSqlNameInput(_0x479911),{dbId:_0xbcccc6,dbName:_0x2413fe}=await resolveDbSelection(_0x479911),_0x3d678d=await resolveSqlModeInput(_0x479911);return{'sqlName':_0xcdbdf1,'dbId':_0xbcccc6,'dbName':_0x2413fe,'mode':_0x3d678d};}async function resolveSqlNameInput(_0x31015e){const _0x2e03f3=a247_0x2ee645,_0x4f3308=_0x31015e[_0x2e03f3(0x126)](_0x2e03f3(0x15c))[_0x2e03f3(0x147)]();if(_0x4f3308)return _0x4f3308;if(_0x31015e[_0x2e03f3(0x142)])throw CliErrors[_0x2e03f3(0x150)](_0x2e03f3(0x15c),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x1c4bb1=>_0x1c4bb1[_0x2e03f3(0x147)]()?!![]:_0x2e03f3(0x141)}))[_0x2e03f3(0x147)]();}async function resolveDbSelection(_0x5be8d9){const _0x19e46e=a247_0x2ee645,_0x6230c4=resolveProvidedDbId(_0x5be8d9);if(typeof _0x6230c4===_0x19e46e(0x145)&&Number[_0x19e46e(0x118)](_0x6230c4)&&_0x6230c4>0x0)return{'dbId':_0x6230c4,'dbName':await getDbName(_0x5be8d9[_0x19e46e(0x156)],_0x6230c4)[_0x19e46e(0x12e)](()=>undefined)};if(_0x5be8d9[_0x19e46e(0x142)])throw CliErrors[_0x19e46e(0x150)](_0x19e46e(0x11c),_0x19e46e(0x140));const _0x12650c=await listDatabases(_0x5be8d9[_0x19e46e(0x156)])['catch'](()=>[]);if(_0x12650c[_0x19e46e(0x139)]===0x1)return{'dbId':_0x12650c[0x0][_0x19e46e(0x12c)],'dbName':_0x12650c[0x0]['dbName']};if(_0x12650c[_0x19e46e(0x139)]>0x1){const _0x3af36c=await select({'message':_0x19e46e(0x149),'choices':[..._0x12650c[_0x19e46e(0x133)](_0x1d2c52=>({'name':_0x1d2c52[_0x19e46e(0x14c)]+'\x20('+_0x1d2c52[_0x19e46e(0x12c)]+')','value':serializeDbSelection(_0x1d2c52)})),{'name':_0x19e46e(0x159),'value':_0x19e46e(0x146)}]});if(_0x3af36c!==_0x19e46e(0x146))return deserializeDbSelection(_0x3af36c);}const _0x3c53d=await input({'message':'Target\x20database\x20dbId:','validate':_0x126e1d=>{const _0x1937ac=_0x19e46e,_0x1282f7=_0x126e1d[_0x1937ac(0x147)]();if(!_0x1282f7)return _0x1937ac(0x144);const _0x421421=Number(_0x1282f7);if(!Number[_0x1937ac(0x128)](_0x421421)||_0x421421<=0x0)return _0x1937ac(0x132);return!![];}});return{'dbId':Number(_0x3c53d[_0x19e46e(0x147)]())};}async function resolveSqlModeInput(_0x11cc5b){const _0x5a6ed6=a247_0x2ee645,_0x573647=_0x11cc5b[_0x5a6ed6(0x126)](_0x5a6ed6(0x15a))[_0x5a6ed6(0x147)]();if(_0x573647===_0x5a6ed6(0x14d)||_0x573647===_0x5a6ed6(0x151))return _0x573647;if(_0x11cc5b[_0x5a6ed6(0x142)])throw CliErrors[_0x5a6ed6(0x150)](_0x5a6ed6(0x15a),_0x5a6ed6(0x152));return await select({'message':_0x5a6ed6(0x137),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x5a6ed6(0x14d),'description':_0x5a6ed6(0x155)},{'name':_0x5a6ed6(0x15b),'value':_0x5a6ed6(0x151),'description':_0x5a6ed6(0x14a)}]});}function serializeDbSelection(_0x53ae49){const _0x20b54c=a247_0x2ee645;return JSON[_0x20b54c(0x131)]({'dbId':_0x53ae49['dbId'],'dbName':_0x53ae49[_0x20b54c(0x14c)]});}function deserializeDbSelection(_0x1e734d){const _0x3b3636=a247_0x2ee645;try{const _0x25e50b=JSON[_0x3b3636(0x13c)](_0x1e734d);if(typeof _0x25e50b['dbId']===_0x3b3636(0x145)&&Number['isFinite'](_0x25e50b[_0x3b3636(0x12c)]))return{'dbId':_0x25e50b['dbId'],'dbName':_0x25e50b[_0x3b3636(0x14c)]};}catch{}throw CliErrors[_0x3b3636(0x158)](_0x3b3636(0x11a)+_0x1e734d);}function resolveProvidedDbId(_0x39d80e){const _0xb3cbf0=a247_0x2ee645,_0x230a02=_0x39d80e['flag'](_0xb3cbf0(0x11c));if(typeof _0x230a02===_0xb3cbf0(0x145)&&Number[_0xb3cbf0(0x118)](_0x230a02))return _0x230a02;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a248_0x3cc8dd=a248_0x36be;(function(_0xa41f16,_0x2297b2){const _0xc1427a=a248_0x36be,_0x24eb75=_0xa41f16();while(!![]){try{const _0x1a74fa=-parseInt(_0xc1427a(0x7b))/0x1*(parseInt(_0xc1427a(0x81))/0x2)+parseInt(_0xc1427a(0x74))/0x3*(-parseInt(_0xc1427a(0x83))/0x4)+-parseInt(_0xc1427a(0x7d))/0x5+parseInt(_0xc1427a(0x6f))/0x6*(parseInt(_0xc1427a(0x79))/0x7)+parseInt(_0xc1427a(0x67))/0x8*(parseInt(_0xc1427a(0x7f))/0x9)+parseInt(_0xc1427a(0x87))/0xa+parseInt(_0xc1427a(0x78))/0xb*(parseInt(_0xc1427a(0x77))/0xc);if(_0x1a74fa===_0x2297b2)break;else _0x24eb75['push'](_0x24eb75['shift']());}catch(_0xda93b6){_0x24eb75['push'](_0x24eb75['shift']());}}}(a248_0x16ca,0x54726));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a248_0x16ca(){const _0x559c77=['sqlcode','sqls','314859HAoKdU','toISOString','trashDir','4591752BjVmBK','11GDZCMK','1156932kDVmlg','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','608nSdQTP','trashedTo','1321130cLAbeB','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','1246473NFEIMr','lockFilePath','2182ilKvXt','fromEntries','12ySYKiN','high-risk-write','projectRoot','Would\x20delete\x20SQL\x20','4328390iRoytS','Deleted\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlRootDir','filter','16ihePpu','delete','startsWith','validation','POST','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRoot','appCode','18uhsQrZ','sql','str'];a248_0x16ca=function(){return _0x559c77;};return a248_0x16ca();}function a248_0x36be(_0x316271,_0x49ed00){_0x316271=_0x316271-0x66;const _0x16ca35=a248_0x16ca();let _0x36be45=_0x16ca35[_0x316271];return _0x36be45;}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':a248_0x3cc8dd(0x70),'command':'delete','description':a248_0x3cc8dd(0x7a),'risk':a248_0x3cc8dd(0x84),'flags':[SQLCODE_FLAG],async 'validate'(_0x552dd1){const _0x536002=a248_0x3cc8dd,_0x1d6f31=loadSqlProjectConfig(_0x552dd1['appCode']),_0x162918=await readSqlLockFile(_0x1d6f31[_0x536002(0x80)]);if(!_0x162918)throw CliErrors[_0x536002(0x6a)](_0x536002(0x7e));},async 'dryRun'(_0x28b444){const _0x4f09d0=a248_0x3cc8dd,_0x732023=loadSqlProjectConfig(_0x28b444['appCode']),_0x4e82c0=await readSqlLockFile(_0x732023['lockFilePath']);if(!_0x4e82c0)throw CliErrors[_0x4f09d0(0x6a)](_0x4f09d0(0x7e));const {appLock:_0x1c147e}=ensureSqlLockScope(_0x4e82c0,_0x28b444[_0x4f09d0(0x6e)],_0x732023['sqlRoot'],_0x4f09d0(0x68)),_0x53db5e=_0x28b444[_0x4f09d0(0x71)](_0x4f09d0(0x72)),_0x10e5ad=_0x1c147e['sqls'][_0x53db5e];if(!_0x10e5ad)throw CliErrors[_0x4f09d0(0x6a)](_0x4f09d0(0x89)+_0x53db5e+'\x22.');return{'method':_0x4f09d0(0x6b),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x53db5e,'id':_0x10e5ad['remoteId'],'localPath':resolveLocalSqlFilePath(_0x732023,_0x53db5e,_0x10e5ad)},'description':_0x4f09d0(0x86)+_0x53db5e+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x732023['trashDir']};},async 'execute'(_0x4eb3df){const _0xe13078=a248_0x3cc8dd,_0x9c9df9=loadSqlProjectConfig(_0x4eb3df[_0xe13078(0x6e)]),_0x3c80c2=await readSqlLockFile(_0x9c9df9[_0xe13078(0x80)]);if(!_0x3c80c2)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x3254b3,appLock:_0x1e962d}=ensureSqlLockScope(_0x3c80c2,_0x4eb3df['appCode'],_0x9c9df9[_0xe13078(0x6d)],_0xe13078(0x68)),_0x2d13e0=_0x4eb3df[_0xe13078(0x71)](_0xe13078(0x72)),_0x4d2194=_0x1e962d['sqls'][_0x2d13e0];if(!_0x4d2194)throw CliErrors[_0xe13078(0x6a)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2d13e0+'\x22.');await deleteSqlQuery({'id':_0x4d2194['remoteId'],'sqlCode':_0x2d13e0}),_0x1e962d[_0xe13078(0x73)]=Object[_0xe13078(0x82)](Object['entries'](_0x1e962d[_0xe13078(0x73)])[_0xe13078(0x66)](([_0x54cbf6])=>_0x54cbf6!==_0x2d13e0)),_0x1e962d['lastSync']=new Date()[_0xe13078(0x75)](),await writeSqlLockFile(_0x9c9df9[_0xe13078(0x80)],_0x3254b3);const _0xbaa2f8=resolveLocalSqlFilePath(_0x9c9df9,_0x2d13e0,_0x4d2194);let _0x575b63;await fileExists(_0xbaa2f8)&&(_0x575b63=await moveToTrash(_0x9c9df9[_0xe13078(0x85)],_0x9c9df9[_0xe13078(0x76)],_0xbaa2f8),await cleanupEmptyDirectories(dirname(_0xbaa2f8),_0x9c9df9[_0xe13078(0x8a)]));const _0x5c45fd={'deleted':_0x2d13e0,'remoteId':_0x4d2194['remoteId']};if(_0x575b63)_0x5c45fd[_0xe13078(0x7c)]=_0x575b63;return{'ok':!![],'data':_0x5c45fd,'message':_0xe13078(0x88)+_0x2d13e0+(_0x575b63?_0xe13078(0x6c):'')};}};async function moveToTrash(_0x8f1203,_0x358488,_0x42005f){const _0x1d4255=a248_0x3cc8dd,_0x90f61b=new Date()[_0x1d4255(0x75)]()['replace'](/[:.]/g,'-'),_0x5982e3=relative(_0x8f1203,_0x42005f),_0x3866c4=join(_0x358488,_0x90f61b,_0x5982e3);return await mkdir(dirname(_0x3866c4),{'recursive':!![]}),await rename(_0x42005f,_0x3866c4),_0x3866c4;}async function cleanupEmptyDirectories(_0x45f982,_0x1730c){const _0x568ba7=a248_0x3cc8dd;let _0x6cc443=resolve(_0x45f982);const _0x135b79=resolve(_0x1730c);while(_0x6cc443[_0x568ba7(0x69)](''+_0x135b79+sep)||_0x6cc443===_0x135b79){if(_0x6cc443===_0x135b79)return;try{const _0x113699=await readdir(_0x6cc443);if(_0x113699['length']>0x0)return;await rmdir(_0x6cc443);}catch{return;}_0x6cc443=dirname(_0x6cc443);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a249_0x5889(){const _0x4d6466=['361867HnbKYc','verbose','Return\x20full\x20raw\x20SQL\x20query\x20object','detail','1453368OrVkbc','22075LAKalz','sqlName','read','36PINjXb','sqlCode','2156355lXkPjT','54668SlRMHi','319325zzLewj','appCode','152TcWUoC','sqlcode','1592521cMKrhN','10fKcfQJ','str','dbId','boolean','9kYQleL','sqlContent','6MyFUxh'];a249_0x5889=function(){return _0x4d6466;};return a249_0x5889();}const a249_0x4002e8=a249_0x21d5;function a249_0x21d5(_0x2cd7b1,_0x84346b){_0x2cd7b1=_0x2cd7b1-0x129;const _0x5889cb=a249_0x5889();let _0x21d58b=_0x5889cb[_0x2cd7b1];return _0x21d58b;}(function(_0x34496c,_0x48db78){const _0x525551=a249_0x21d5,_0x115ecd=_0x34496c();while(!![]){try{const _0xf2670=-parseInt(_0x525551(0x137))/0x1+-parseInt(_0x525551(0x136))/0x2*(-parseInt(_0x525551(0x140))/0x3)+parseInt(_0x525551(0x139))/0x4*(parseInt(_0x525551(0x130))/0x5)+parseInt(_0x525551(0x12a))/0x6*(-parseInt(_0x525551(0x13b))/0x7)+parseInt(_0x525551(0x12f))/0x8+-parseInt(_0x525551(0x135))/0x9*(-parseInt(_0x525551(0x13c))/0xa)+-parseInt(_0x525551(0x12b))/0xb*(-parseInt(_0x525551(0x133))/0xc);if(_0xf2670===_0x48db78)break;else _0x115ecd['push'](_0x115ecd['shift']());}catch(_0x4a9bd4){_0x115ecd['push'](_0x115ecd['shift']());}}}(a249_0x5889,0x366b5));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':a249_0x4002e8(0x12e),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a249_0x4002e8(0x132),'flags':[SQLCODE_FLAG,{'name':a249_0x4002e8(0x12c),'type':a249_0x4002e8(0x13f),'description':a249_0x4002e8(0x12d)}],async 'execute'(_0x22e8c2){const _0x2b492c=a249_0x4002e8,_0x4f722a=await getSqlQueryInfo(_0x22e8c2[_0x2b492c(0x138)],_0x22e8c2[_0x2b492c(0x13d)](_0x2b492c(0x13a))),_0x4d7a91=_0x22e8c2['bool'](_0x2b492c(0x12c));if(_0x4d7a91)return{'ok':!![],'data':_0x4f722a};const _0xcac02=_0x4f722a[_0x2b492c(0x13e)]?await getDbName(_0x22e8c2['appCode'],_0x4f722a[_0x2b492c(0x13e)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4f722a[_0x2b492c(0x134)],'sqlName':_0x4f722a[_0x2b492c(0x131)],'db':_0xcac02?_0xcac02+'\x20('+_0x4f722a['dbId']+')':_0x4f722a[_0x2b492c(0x13e)]??'','description':_0x4f722a['description']??'','sqlContent':_0x4f722a[_0x2b492c(0x129)]??''}};}};
|