@lovrabet/rabetbase-cli 2.5.5-beta.2 → 2.5.5-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +3 -3
- package/skills/rabetbase/guides/independent-deployment.md +11 -1
- package/skills/rabetbase/references/rabetbase-config.md +16 -19
- package/skills/rabetbase/references/rabetbase-menu-visibility-update.md +5 -4
- package/skills/rabetbase/references/rabetbase-workspace.md +3 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a224_0x50c7b6=a224_0x19d9;(function(_0x3b37b4,_0x55986a){const _0x4f3e7f=a224_0x19d9,_0x431276=_0x3b37b4();while(!![]){try{const _0x11eac2=-parseInt(_0x4f3e7f(0xce))/0x1+parseInt(_0x4f3e7f(0xf9))/0x2*(-parseInt(_0x4f3e7f(0xd4))/0x3)+parseInt(_0x4f3e7f(0xcd))/0x4*(parseInt(_0x4f3e7f(0xfb))/0x5)+parseInt(_0x4f3e7f(0xf3))/0x6+parseInt(_0x4f3e7f(0xdd))/0x7+-parseInt(_0x4f3e7f(0xb1))/0x8+parseInt(_0x4f3e7f(0xf1))/0x9*(parseInt(_0x4f3e7f(0xdb))/0xa);if(_0x11eac2===_0x55986a)break;else _0x431276['push'](_0x431276['shift']());}catch(_0x42d487){_0x431276['push'](_0x431276['shift']());}}}(a224_0x446f,0x9c87e));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a224_0x50c7b6(0xf8),'required':!![],'description':a224_0x50c7b6(0xf7)};export const ROLE_REF_FLAG={'name':a224_0x50c7b6(0xbb),'type':a224_0x50c7b6(0xd1),'required':!![],'description':a224_0x50c7b6(0xf6)};export const USER_REF_FLAG={'name':a224_0x50c7b6(0xd3),'type':'string','required':!![],'description':a224_0x50c7b6(0xf5)};function a224_0x19d9(_0x2d8918,_0x3de1de){_0x2d8918=_0x2d8918-0xb1;const _0x446f79=a224_0x446f();let _0x19d9ec=_0x446f79[_0x2d8918];return _0x19d9ec;}export const NAME_FLAG={'name':a224_0x50c7b6(0xc8),'type':a224_0x50c7b6(0xd1),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a224_0x50c7b6(0xc8),'type':a224_0x50c7b6(0xd1),'required':!![],'description':a224_0x50c7b6(0xc0)};export const REMARK_FLAG={'name':a224_0x50c7b6(0xed),'type':a224_0x50c7b6(0xd1),'required':![],'description':a224_0x50c7b6(0xd5)};export const EXPECT_USER_COUNT_FLAG={'name':a224_0x50c7b6(0xb7),'type':a224_0x50c7b6(0xf8),'required':![],'description':a224_0x50c7b6(0xfa)};export const BUILTIN_ROLE_TYPES=[a224_0x50c7b6(0xfd),'DEV',a224_0x50c7b6(0xe2)];export function isBuiltinRole(_0x1a379c){return BUILTIN_ROLE_TYPES['includes'](_0x1a379c);}export function assertCustomRole(_0x2c488e,_0x42b27e){const _0x4c5258=a224_0x50c7b6;if(_0x2c488e['roleType']!=='CUSTOM')throw CliErrors[_0x4c5258(0xe5)](_0x4c5258(0xdc)+_0x42b27e+_0x4c5258(0xd9)+_0x2c488e[_0x4c5258(0xb3)]+'\x20('+_0x2c488e['roleType']+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x22f2a2){const _0x3dbd60=a224_0x50c7b6;return{'id':_0x22f2a2['id'],'roleName':_0x22f2a2['roleName'],'roleType':_0x22f2a2[_0x3dbd60(0xea)],'remark':_0x22f2a2[_0x3dbd60(0xed)],'userCount':_0x22f2a2['userCount'],'permitCount':_0x22f2a2[_0x3dbd60(0xc2)],'builtin':isBuiltinRole(_0x22f2a2[_0x3dbd60(0xea)])};}export async function resolveRoleRef(_0x241567,_0x473bfa){const _0x4077b6=a224_0x50c7b6,_0xdcaf59=_0x473bfa[_0x4077b6(0xc5)]();if(!_0xdcaf59)throw CliErrors[_0x4077b6(0xe5)]('Missing\x20role\x20reference.',_0x4077b6(0xf4));if(/^\d+$/[_0x4077b6(0xd8)](_0xdcaf59))return getRoleById(_0x241567,Number(_0xdcaf59));const _0x512a37=await listAllAppRoles(_0x241567),_0x2f906e=_0x512a37['filter'](_0x8be6aa=>_0x8be6aa['roleName']===_0xdcaf59);if(_0x2f906e[_0x4077b6(0xbc)]===0x0)throw CliErrors[_0x4077b6(0xe5)](_0x4077b6(0xe7)+_0xdcaf59+_0x4077b6(0xee)+_0x241567+'.',_0x4077b6(0xb4));if(_0x2f906e[_0x4077b6(0xbc)]>0x1){const _0x438f09=_0x2f906e[_0x4077b6(0xdf)](_0x7fc79f=>_0x7fc79f['id'])[_0x4077b6(0xf2)](',\x20');throw CliErrors['validation'](_0x4077b6(0xe7)+_0xdcaf59+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x438f09+').',_0x4077b6(0xcc));}return _0x2f906e[0x0];}export async function getRoleById(_0x36c622,_0x3a4961){const _0x507605=a224_0x50c7b6,_0x2dd75c=await listAllAppRoles(_0x36c622),_0x27f641=_0x2dd75c[_0x507605(0xef)](_0x3039ce=>_0x3039ce['id']===_0x3a4961&&(!_0x3039ce[_0x507605(0xda)]||_0x3039ce['appCode']===_0x36c622));if(_0x27f641[_0x507605(0xbc)]!==0x1)throw CliErrors['validation']('Role\x20id\x20'+_0x3a4961+_0x507605(0xd0)+_0x36c622+'.',_0x507605(0xe1));return _0x27f641[0x0];}async function listAllAppRoles(_0x54da40){const _0x5ee92d=a224_0x50c7b6,_0x1c78ac=0x64,_0x171c98=[];for(let _0x686489=0x1;;_0x686489+=0x1){const {items:_0x2f761c,paging:_0x548ede}=await listAppRoles(_0x54da40,{'currentPage':_0x686489,'pageSize':_0x1c78ac});_0x171c98[_0x5ee92d(0xf0)](..._0x2f761c);if(_0x2f761c[_0x5ee92d(0xbc)]<_0x1c78ac||_0x548ede&&_0x171c98['length']>=_0x548ede[_0x5ee92d(0xc4)])return _0x171c98;}}export async function resolveTenantCode(){const _0x43faed=a224_0x50c7b6,_0x25362e=await getSessionUserInfo(),_0xec094b=_0x25362e?.['user']?.['tenant']?.[_0x43faed(0xb6)];if(!_0xec094b)throw CliErrors[_0x43faed(0xbf)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0xec094b;}function matchMember(_0x2fcde6,_0x394b89){const _0x5ba77b=a224_0x50c7b6,_0x5d20bd=_0x394b89[_0x5ba77b(0xc5)]()[_0x5ba77b(0xe6)]();return(_0x2fcde6[_0x5ba77b(0xb9)]??'')['toLowerCase']()===_0x5d20bd||(_0x2fcde6[_0x5ba77b(0xc3)]??'')[_0x5ba77b(0xe6)]()===_0x5d20bd;}export async function resolveUserRef(_0x2cd59d,_0x58a366=a224_0x50c7b6(0xe8)){const _0x254365=a224_0x50c7b6,_0xd8fcd6=_0x2cd59d['trim']();if(!_0xd8fcd6)throw CliErrors[_0x254365(0xe5)]('Missing\x20user\x20reference.',_0x254365(0xba));const _0x5f121b=await resolveTenantCode(),_0x514b01=await getTenantMembers(_0x5f121b);if(/^\d+$/[_0x254365(0xd8)](_0xd8fcd6)){const _0x31439b=Number(_0xd8fcd6),_0x54acea=_0x514b01[_0x254365(0xde)](_0xb3d89e=>_0xb3d89e[_0x254365(0xfe)]===_0x31439b);return{'userId':_0x31439b,'username':_0x54acea?.[_0x254365(0xc3)]??String(_0x31439b),'nickname':_0x54acea?.['nickname'],'matchedBy':'id'};}const _0x2c115f=_0x514b01[_0x254365(0xef)](_0x5e680c=>matchMember(_0x5e680c,_0xd8fcd6));if(_0x2c115f[_0x254365(0xbc)]===0x0)throw CliErrors[_0x254365(0xe5)](_0x254365(0xe9)+_0xd8fcd6+'\x22.',_0x254365(0xb8)+_0x58a366);if(_0x2c115f['length']>0x1){const _0x148a32=_0x2c115f['map'](_0x16bb50=>(_0x16bb50[_0x254365(0xb9)]??_0x16bb50[_0x254365(0xc3)]??'?')+'('+_0x16bb50[_0x254365(0xfe)]+')')[_0x254365(0xf2)](',\x20');throw CliErrors[_0x254365(0xe5)](_0x254365(0xe4)+_0xd8fcd6+_0x254365(0xbe)+_0x148a32+'.',_0x58a366);}const _0x74d0a4=_0x2c115f[0x0];return{'userId':_0x74d0a4[_0x254365(0xfe)],'username':_0x74d0a4[_0x254365(0xc3)]??String(_0x74d0a4[_0x254365(0xfe)]),'nickname':_0x74d0a4[_0x254365(0xb9)],'matchedBy':_0x254365(0xc8)};}export const CREATE_USER_ROLE_PATH=a224_0x50c7b6(0xc6);export const DELETE_USER_ROLE_PATH=a224_0x50c7b6(0xc7);export function computeRoleUserMutation(_0x4e074f){const _0x2458c9=a224_0x50c7b6,{operation:_0x9eb2df,appCode:_0x178813,role:_0x4598f6,relations:_0x860bf7,user:_0x5c7db3}=_0x4e074f,_0x261115=[...new Set(_0x860bf7['map'](_0x3516b4=>_0x3516b4[_0x2458c9(0xfe)]))],_0x248813=[];if(_0x4e074f[_0x2458c9(0xe0)]!==undefined&&_0x4e074f['expectUserCount']!==_0x261115[_0x2458c9(0xbc)])throw CliErrors[_0x2458c9(0xe5)](_0x2458c9(0xd6)+_0x4e074f['expectUserCount']+_0x2458c9(0xcb)+_0x261115['length']+'.',_0x2458c9(0xcf));const _0x278e08=_0x261115[_0x2458c9(0xff)](_0x5c7db3[_0x2458c9(0xfe)]),_0x33aafe=_0x860bf7[_0x2458c9(0xef)](_0x5dc532=>_0x5dc532[_0x2458c9(0xfe)]===_0x5c7db3[_0x2458c9(0xfe)])[_0x2458c9(0xdf)](_0x1d67c5=>_0x1d67c5['id']),_0x1a0af2=_0x9eb2df===_0x2458c9(0xec)?!_0x278e08:_0x278e08;let _0x3be15e=_0x261115;_0x9eb2df===_0x2458c9(0xec)?_0x278e08?_0x248813[_0x2458c9(0xf0)](_0x2458c9(0xeb)+_0x5c7db3[_0x2458c9(0xfe)]+_0x2458c9(0xb5)+_0x4598f6[_0x2458c9(0xb3)]+_0x2458c9(0xfc)):_0x3be15e=[..._0x261115,_0x5c7db3['userId']]:!_0x278e08?_0x248813[_0x2458c9(0xf0)](_0x2458c9(0xeb)+_0x5c7db3[_0x2458c9(0xfe)]+_0x2458c9(0xd2)+_0x4598f6[_0x2458c9(0xb3)]+_0x2458c9(0xfc)):(_0x3be15e=_0x261115[_0x2458c9(0xef)](_0x3abd36=>_0x3abd36!==_0x5c7db3[_0x2458c9(0xfe)]),_0x33aafe['length']>0x1&&_0x248813[_0x2458c9(0xf0)](_0x2458c9(0xc1)+_0x33aafe['length']+_0x2458c9(0xb2)+_0x5c7db3[_0x2458c9(0xfe)]+'.'));const _0x299897={'scope':_0x2458c9(0xca),'operation':_0x9eb2df,'selector':{'appCode':_0x178813,'roleId':_0x4598f6['id'],'roleName':_0x4598f6[_0x2458c9(0xb3)],'userId':_0x5c7db3[_0x2458c9(0xfe)]},'before':{'userIds':_0x261115},'after':{'userIds':_0x3be15e},'dryRun':_0x4e074f['dryRun'],'backend':{'method':'POST','path':_0x9eb2df===_0x2458c9(0xec)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x248813};return{'mutation':_0x299897,'changed':_0x1a0af2,'matchingRelationIds':_0x33aafe};}export async function loadDevRoleRelations(_0x1e8db5,_0x16c89a){const _0x1f31e1=a224_0x50c7b6,_0x155fbc=0x64,_0x579678=[];for(let _0x3ad49d=0x1;;_0x3ad49d+=0x1){const {items:_0x371ff7,paging:_0x2c9be5}=await listDevUserRoleRelations(_0x1e8db5,{'roleId':_0x16c89a,'currentPage':_0x3ad49d,'pageSize':_0x155fbc});_0x579678['push'](..._0x371ff7);if(_0x371ff7[_0x1f31e1(0xbc)]<_0x155fbc||_0x2c9be5&&_0x579678[_0x1f31e1(0xbc)]>=_0x2c9be5[_0x1f31e1(0xc4)])return _0x579678;}}export function readRoleRef(_0x547f5f){const _0xbf1ed=a224_0x50c7b6,_0x535b0d=_0x547f5f['str'](_0xbf1ed(0xbb))['trim']();if(!_0x535b0d)throw CliErrors[_0xbf1ed(0xc9)](_0xbf1ed(0xbb),_0xbf1ed(0xf4));return _0x535b0d;}export async function prepareUserMutation(_0x1613bb,_0x50b3ad,_0x175534){const _0x4640b7=a224_0x50c7b6,_0x302f6a=readRoleRef(_0x1613bb),_0x50c945=_0x1613bb[_0x4640b7(0xbd)](_0x4640b7(0xd3))[_0x4640b7(0xc5)]();if(!_0x50c945)throw CliErrors[_0x4640b7(0xc9)]('user',_0x4640b7(0xba));const _0x20e083=_0x1613bb[_0x4640b7(0xe3)](_0x4640b7(0xb7)),_0x16bbdb=_0x20e083===undefined||_0x20e083===null?undefined:Number(_0x20e083),_0x616991=await resolveRoleRef(_0x1613bb[_0x4640b7(0xda)],_0x302f6a);if(_0x616991['roleType']==='OWNER')throw CliErrors['validation'](_0x4640b7(0xdc)+_0x50b3ad+_0x4640b7(0xd7),'Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x572cf3=await resolveUserRef(_0x50c945),_0x3acc53=await loadDevRoleRelations(_0x1613bb[_0x4640b7(0xda)],_0x616991['id']);return{...computeRoleUserMutation({'operation':_0x50b3ad,'appCode':_0x1613bb['appCode'],'role':_0x616991,'relations':_0x3acc53,'user':{'userId':_0x572cf3['userId'],'username':_0x572cf3[_0x4640b7(0xc3)],'nickname':_0x572cf3[_0x4640b7(0xb9)]},'dryRun':_0x175534,..._0x16bbdb!==undefined?{'expectUserCount':_0x16bbdb}:{}}),'role':_0x616991,'user':_0x572cf3};}function a224_0x446f(){const _0x4debe4=['nickname','Pass\x20--user\x20<id|name>.','role','length','str','\x22:\x20','authRequired','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Removed\x20','permitCount','username','totalCount','trim','/smartapi/permit/user-role/create','/smartapi/permit/user-role/delete','name','flagMissing','dev','\x20member(s)\x20but\x20role\x20has\x20','Disambiguate\x20with\x20--role\x20<id>.','14756JXFpuS','349327DtOTJt','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','\x20not\x20found\x20in\x20app\x20','string','\x20is\x20not\x20a\x20member\x20of\x20role\x20','user','3807267MURSrd','Optional\x20role\x20remark/description','Anti-drift\x20check\x20failed:\x20expected\x20','\x20members\x20of\x20the\x20OWNER\x20role.','test','\x20built-in\x20role\x20','appCode','13862170KwgHdQ','Cannot\x20','3619658KXTzXj','find','map','expectUserCount','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','OWNER','flag','Multiple\x20tenant\x20members\x20match\x20\x22','validation','toLowerCase','Role\x20name\x20\x22','Pass\x20--user\x20<id>.','No\x20tenant\x20member\x20matches\x20\x22','roleType','User\x20','user-add','remark','\x22\x20not\x20found\x20in\x20app\x20','filter','push','9cFBykf','join','377262fLRKwY','Pass\x20--role\x20<id|name>.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Role\x20id\x20or\x20exact\x20role\x20name','Role\x20id\x20(from\x20`role\x20list`)','number','2kKwnUd','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','1270SbFNwR',';\x20no\x20change.','ADMIN','userId','includes','5149024hEdqzH','\x20duplicate\x20memberships\x20for\x20user\x20','roleName','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','\x20is\x20already\x20a\x20member\x20of\x20role\x20','tenant_code','expect-user-count','Check\x20the\x20nickname/username.\x20'];a224_0x446f=function(){return _0x4debe4;};return a224_0x446f();}
|
|
1
|
+
const a224_0x12ab6b=a224_0x3ca9;(function(_0x135b8a,_0x26795e){const _0x21fe5c=a224_0x3ca9,_0x46f082=_0x135b8a();while(!![]){try{const _0x927952=parseInt(_0x21fe5c(0xe9))/0x1+-parseInt(_0x21fe5c(0xf0))/0x2*(parseInt(_0x21fe5c(0xd1))/0x3)+parseInt(_0x21fe5c(0x117))/0x4*(parseInt(_0x21fe5c(0xed))/0x5)+-parseInt(_0x21fe5c(0x10b))/0x6*(-parseInt(_0x21fe5c(0xcb))/0x7)+parseInt(_0x21fe5c(0xde))/0x8+-parseInt(_0x21fe5c(0x10d))/0x9*(parseInt(_0x21fe5c(0x116))/0xa)+parseInt(_0x21fe5c(0xd5))/0xb;if(_0x927952===_0x26795e)break;else _0x46f082['push'](_0x46f082['shift']());}catch(_0xb2b886){_0x46f082['push'](_0x46f082['shift']());}}}(a224_0x3d07,0x6c64b));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';function a224_0x3d07(){const _0xde25ac=['4lQWezQ','Cannot\x20','tenant','expectUserCount','1308370wCljYh','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','\x20is\x20already\x20a\x20member\x20of\x20role\x20','\x22\x20is\x20ambiguous\x20(ids:\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','appCode','6WfLSfw','Pass\x20--user\x20<id>.','permitCount','username','7260979PpKZKz','str','No\x20tenant\x20member\x20matches\x20\x22','\x20members\x20of\x20the\x20OWNER\x20role.','validation','\x22\x20not\x20found\x20in\x20app\x20','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','totalCount','find','1355360OZZvFR','Pass\x20--role\x20<id|name>.','CUSTOM','OWNER','user-add','push','filter','\x20duplicate\x20memberships\x20for\x20user\x20','user','map','trim','381722BWvaVo','number','userCount','nickname','36610xGtDHk','dev','ADMIN','794678yOUoVf','roleType','\x20built-in\x20role\x20','test','includes','remark','authRequired','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','flag','User\x20','userId','Pass\x20--user\x20<id|name>.','roleName','join','toLowerCase','length','Missing\x20user\x20reference.','string','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Role\x20name','\x20member(s)\x20but\x20role\x20has\x20','/smartapi/permit/user-role/create','name','Optional\x20role\x20remark/description','/smartapi/permit/user-role/delete','role','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','24ESyWiV','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','1656EuXkaL','Role\x20id\x20or\x20exact\x20role\x20name','Check\x20the\x20nickname/username.\x20',';\x20no\x20change.','tenant_code','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','\x20is\x20not\x20a\x20member\x20of\x20role\x20','DEV','expect-user-count','39540wmRwvg'];a224_0x3d07=function(){return _0xde25ac;};return a224_0x3d07();}function a224_0x3ca9(_0x536ef8,_0x43ac3d){_0x536ef8=_0x536ef8-0xc9;const _0x3d07c1=a224_0x3d07();let _0x3ca93d=_0x3d07c1[_0x536ef8];return _0x3ca93d;}import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a224_0x12ab6b(0xea),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a224_0x12ab6b(0x109),'type':a224_0x12ab6b(0x101),'required':!![],'description':a224_0x12ab6b(0x10e)};export const USER_REF_FLAG={'name':a224_0x12ab6b(0xe6),'type':a224_0x12ab6b(0x101),'required':!![],'description':a224_0x12ab6b(0x112)};export const NAME_FLAG={'name':a224_0x12ab6b(0x106),'type':'string','required':!![],'description':a224_0x12ab6b(0x103)};export const USER_NAME_FLAG={'name':a224_0x12ab6b(0x106),'type':a224_0x12ab6b(0x101),'required':!![],'description':a224_0x12ab6b(0xcf)};export const REMARK_FLAG={'name':'remark','type':a224_0x12ab6b(0x101),'required':![],'description':a224_0x12ab6b(0x107)};export const EXPECT_USER_COUNT_FLAG={'name':a224_0x12ab6b(0x115),'type':a224_0x12ab6b(0xea),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a224_0x12ab6b(0xef),a224_0x12ab6b(0x114),a224_0x12ab6b(0xe1)];export function isBuiltinRole(_0x5beb24){const _0x3daa12=a224_0x12ab6b;return BUILTIN_ROLE_TYPES[_0x3daa12(0xf4)](_0x5beb24);}export function assertCustomRole(_0x40b460,_0x2674c4){const _0x3ce946=a224_0x12ab6b;if(_0x40b460[_0x3ce946(0xf1)]!==_0x3ce946(0xe0))throw CliErrors[_0x3ce946(0xd9)](_0x3ce946(0x118)+_0x2674c4+_0x3ce946(0xf2)+_0x40b460[_0x3ce946(0xfc)]+'\x20('+_0x40b460['roleType']+').',_0x3ce946(0xf7));}export function projectRole(_0x17cb58){const _0x3ed497=a224_0x12ab6b;return{'id':_0x17cb58['id'],'roleName':_0x17cb58[_0x3ed497(0xfc)],'roleType':_0x17cb58[_0x3ed497(0xf1)],'remark':_0x17cb58[_0x3ed497(0xf5)],'userCount':_0x17cb58[_0x3ed497(0xeb)],'permitCount':_0x17cb58[_0x3ed497(0xd3)],'builtin':isBuiltinRole(_0x17cb58[_0x3ed497(0xf1)])};}export async function resolveRoleRef(_0x29e086,_0x420a58){const _0x2588f7=a224_0x12ab6b,_0x1cdef8=_0x420a58['trim']();if(!_0x1cdef8)throw CliErrors[_0x2588f7(0xd9)]('Missing\x20role\x20reference.',_0x2588f7(0xdf));if(/^\d+$/[_0x2588f7(0xf3)](_0x1cdef8))return getRoleById(_0x29e086,Number(_0x1cdef8));const _0x20f25e=await listAllAppRoles(_0x29e086),_0x454837=_0x20f25e[_0x2588f7(0xe4)](_0x446fc7=>_0x446fc7[_0x2588f7(0xfc)]===_0x1cdef8);if(_0x454837[_0x2588f7(0xff)]===0x0)throw CliErrors[_0x2588f7(0xd9)]('Role\x20name\x20\x22'+_0x1cdef8+_0x2588f7(0xda)+_0x29e086+'.',_0x2588f7(0x10a));if(_0x454837[_0x2588f7(0xff)]>0x1){const _0x317f51=_0x454837[_0x2588f7(0xe7)](_0x2a0154=>_0x2a0154['id'])['join'](',\x20');throw CliErrors[_0x2588f7(0xd9)]('Role\x20name\x20\x22'+_0x1cdef8+_0x2588f7(0xce)+_0x317f51+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x454837[0x0];}export async function getRoleById(_0x551302,_0x481835){const _0x5d377c=a224_0x12ab6b,_0x5070f0=await listAllAppRoles(_0x551302),_0x1e2abd=_0x5070f0['filter'](_0x2190f6=>_0x2190f6['id']===_0x481835&&(!_0x2190f6[_0x5d377c(0xd0)]||_0x2190f6[_0x5d377c(0xd0)]===_0x551302));if(_0x1e2abd[_0x5d377c(0xff)]!==0x1)throw CliErrors['validation']('Role\x20id\x20'+_0x481835+'\x20not\x20found\x20in\x20app\x20'+_0x551302+'.',_0x5d377c(0x10c));return _0x1e2abd[0x0];}async function listAllAppRoles(_0x103e37){const _0x21f7e1=a224_0x12ab6b,_0x318f8a=0x64,_0x337e03=[];for(let _0x1cdf0a=0x1;;_0x1cdf0a+=0x1){const {items:_0x35f437,paging:_0x57b585}=await listAppRoles(_0x103e37,{'currentPage':_0x1cdf0a,'pageSize':_0x318f8a});_0x337e03['push'](..._0x35f437);if(_0x35f437[_0x21f7e1(0xff)]<_0x318f8a||_0x57b585&&_0x337e03['length']>=_0x57b585['totalCount'])return _0x337e03;}}export async function resolveTenantCode(){const _0x21a17f=a224_0x12ab6b,_0x59de74=await getSessionUserInfo(),_0x4b0fd6=_0x59de74?.['user']?.[_0x21a17f(0xc9)]?.[_0x21a17f(0x111)];if(!_0x4b0fd6)throw CliErrors[_0x21a17f(0xf6)](_0x21a17f(0xdb));return _0x4b0fd6;}function matchMember(_0x3a8b22,_0x4e2956){const _0x27af64=a224_0x12ab6b,_0x592873=_0x4e2956[_0x27af64(0xe8)]()[_0x27af64(0xfe)]();return(_0x3a8b22[_0x27af64(0xec)]??'')[_0x27af64(0xfe)]()===_0x592873||(_0x3a8b22['username']??'')[_0x27af64(0xfe)]()===_0x592873;}export async function resolveUserRef(_0x45b8f7,_0x5df6d6=a224_0x12ab6b(0xd2)){const _0x1da9a2=a224_0x12ab6b,_0x514e2d=_0x45b8f7[_0x1da9a2(0xe8)]();if(!_0x514e2d)throw CliErrors[_0x1da9a2(0xd9)](_0x1da9a2(0x100),_0x1da9a2(0xfb));const _0x3a7c35=await resolveTenantCode(),_0x3ce5f5=await getTenantMembers(_0x3a7c35);if(/^\d+$/[_0x1da9a2(0xf3)](_0x514e2d)){const _0x28d6a6=Number(_0x514e2d),_0x23fb3b=_0x3ce5f5[_0x1da9a2(0xdd)](_0xcbe0cc=>_0xcbe0cc[_0x1da9a2(0xfa)]===_0x28d6a6);return{'userId':_0x28d6a6,'username':_0x23fb3b?.[_0x1da9a2(0xd4)]??String(_0x28d6a6),'nickname':_0x23fb3b?.[_0x1da9a2(0xec)],'matchedBy':'id'};}const _0x1d9783=_0x3ce5f5[_0x1da9a2(0xe4)](_0x3521ef=>matchMember(_0x3521ef,_0x514e2d));if(_0x1d9783[_0x1da9a2(0xff)]===0x0)throw CliErrors['validation'](_0x1da9a2(0xd7)+_0x514e2d+'\x22.',_0x1da9a2(0x10f)+_0x5df6d6);if(_0x1d9783[_0x1da9a2(0xff)]>0x1){const _0x6241fd=_0x1d9783['map'](_0x4a534c=>(_0x4a534c['nickname']??_0x4a534c[_0x1da9a2(0xd4)]??'?')+'('+_0x4a534c['userId']+')')[_0x1da9a2(0xfd)](',\x20');throw CliErrors[_0x1da9a2(0xd9)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x514e2d+'\x22:\x20'+_0x6241fd+'.',_0x5df6d6);}const _0x2449f7=_0x1d9783[0x0];return{'userId':_0x2449f7[_0x1da9a2(0xfa)],'username':_0x2449f7['username']??String(_0x2449f7[_0x1da9a2(0xfa)]),'nickname':_0x2449f7[_0x1da9a2(0xec)],'matchedBy':'name'};}export const CREATE_USER_ROLE_PATH=a224_0x12ab6b(0x105);export const DELETE_USER_ROLE_PATH=a224_0x12ab6b(0x108);export function computeRoleUserMutation(_0x5d7ba0){const _0x466064=a224_0x12ab6b,{operation:_0x366249,appCode:_0x584a92,role:_0x5c76a0,relations:_0x20fc01,user:_0x459525}=_0x5d7ba0,_0x5efc86=[...new Set(_0x20fc01[_0x466064(0xe7)](_0x1d7945=>_0x1d7945[_0x466064(0xfa)]))],_0x59491d=[];if(_0x5d7ba0[_0x466064(0xca)]!==undefined&&_0x5d7ba0[_0x466064(0xca)]!==_0x5efc86['length'])throw CliErrors[_0x466064(0xd9)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x5d7ba0[_0x466064(0xca)]+_0x466064(0x104)+_0x5efc86['length']+'.',_0x466064(0xcc));const _0x314401=_0x5efc86[_0x466064(0xf4)](_0x459525[_0x466064(0xfa)]),_0x3e1bb7=_0x20fc01['filter'](_0x49180b=>_0x49180b['userId']===_0x459525['userId'])[_0x466064(0xe7)](_0x1b5f5f=>_0x1b5f5f['id']),_0x4e93af=_0x366249===_0x466064(0xe2)?!_0x314401:_0x314401;let _0x415f7a=_0x5efc86;_0x366249===_0x466064(0xe2)?_0x314401?_0x59491d[_0x466064(0xe3)](_0x466064(0xf9)+_0x459525[_0x466064(0xfa)]+_0x466064(0xcd)+_0x5c76a0[_0x466064(0xfc)]+_0x466064(0x110)):_0x415f7a=[..._0x5efc86,_0x459525[_0x466064(0xfa)]]:!_0x314401?_0x59491d[_0x466064(0xe3)](_0x466064(0xf9)+_0x459525[_0x466064(0xfa)]+_0x466064(0x113)+_0x5c76a0['roleName']+_0x466064(0x110)):(_0x415f7a=_0x5efc86[_0x466064(0xe4)](_0x404e8d=>_0x404e8d!==_0x459525[_0x466064(0xfa)]),_0x3e1bb7[_0x466064(0xff)]>0x1&&_0x59491d[_0x466064(0xe3)]('Removed\x20'+_0x3e1bb7[_0x466064(0xff)]+_0x466064(0xe5)+_0x459525[_0x466064(0xfa)]+'.'));const _0x47a635={'scope':_0x466064(0xee),'operation':_0x366249,'selector':{'appCode':_0x584a92,'roleId':_0x5c76a0['id'],'roleName':_0x5c76a0[_0x466064(0xfc)],'userId':_0x459525['userId']},'before':{'userIds':_0x5efc86},'after':{'userIds':_0x415f7a},'dryRun':_0x5d7ba0['dryRun'],'backend':{'method':'POST','path':_0x366249===_0x466064(0xe2)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x59491d};return{'mutation':_0x47a635,'changed':_0x4e93af,'matchingRelationIds':_0x3e1bb7};}export async function loadDevRoleRelations(_0x317a5a,_0x1c9d3a){const _0x538681=a224_0x12ab6b,_0x1b3f51=0x64,_0x506ec2=[];for(let _0x54c921=0x1;;_0x54c921+=0x1){const {items:_0x2b8403,paging:_0x2ab340}=await listDevUserRoleRelations(_0x317a5a,{'roleId':_0x1c9d3a,'currentPage':_0x54c921,'pageSize':_0x1b3f51});_0x506ec2[_0x538681(0xe3)](..._0x2b8403);if(_0x2b8403['length']<_0x1b3f51||_0x2ab340&&_0x506ec2['length']>=_0x2ab340[_0x538681(0xdc)])return _0x506ec2;}}export function readRoleRef(_0xd6650d){const _0x39d5b3=a224_0x12ab6b,_0x5857dd=_0xd6650d['str'](_0x39d5b3(0x109))[_0x39d5b3(0xe8)]();if(!_0x5857dd)throw CliErrors['flagMissing']('role',_0x39d5b3(0xdf));return _0x5857dd;}export async function prepareUserMutation(_0x3b56aa,_0x32548d,_0x2702a0){const _0x161fbe=a224_0x12ab6b,_0x2e1700=readRoleRef(_0x3b56aa),_0x4dc15c=_0x3b56aa[_0x161fbe(0xd6)]('user')[_0x161fbe(0xe8)]();if(!_0x4dc15c)throw CliErrors['flagMissing'](_0x161fbe(0xe6),_0x161fbe(0xfb));const _0x4c600b=_0x3b56aa[_0x161fbe(0xf8)](_0x161fbe(0x115)),_0x46ee70=_0x4c600b===undefined||_0x4c600b===null?undefined:Number(_0x4c600b),_0x3df0c7=await resolveRoleRef(_0x3b56aa['appCode'],_0x2e1700);if(_0x3df0c7['roleType']===_0x161fbe(0xe1))throw CliErrors[_0x161fbe(0xd9)](_0x161fbe(0x118)+_0x32548d+_0x161fbe(0xd8),_0x161fbe(0x102));const _0x35bc9b=await resolveUserRef(_0x4dc15c),_0x24210f=await loadDevRoleRelations(_0x3b56aa[_0x161fbe(0xd0)],_0x3df0c7['id']);return{...computeRoleUserMutation({'operation':_0x32548d,'appCode':_0x3b56aa['appCode'],'role':_0x3df0c7,'relations':_0x24210f,'user':{'userId':_0x35bc9b[_0x161fbe(0xfa)],'username':_0x35bc9b['username'],'nickname':_0x35bc9b[_0x161fbe(0xec)]},'dryRun':_0x2702a0,..._0x46ee70!==undefined?{'expectUserCount':_0x46ee70}:{}}),'role':_0x3df0c7,'user':_0x35bc9b};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a225_0x160a81=a225_0x31ef;(function(_0x50c4e3,_0x1e17d6){const _0x967c2=a225_0x31ef,_0x112ce7=_0x50c4e3();while(!![]){try{const _0x12c2d6=parseInt(_0x967c2(0xfc))/0x1*(-parseInt(_0x967c2(0x103))/0x2)+parseInt(_0x967c2(0x106))/0x3+-parseInt(_0x967c2(0x10b))/0x4*(parseInt(_0x967c2(0xf6))/0x5)+-parseInt(_0x967c2(0xea))/0x6*(-parseInt(_0x967c2(0x10a))/0x7)+-parseInt(_0x967c2(0x101))/0x8*(-parseInt(_0x967c2(0xf2))/0x9)+parseInt(_0x967c2(0x105))/0xa*(-parseInt(_0x967c2(0xf5))/0xb)+-parseInt(_0x967c2(0xed))/0xc*(parseInt(_0x967c2(0xf3))/0xd);if(_0x12c2d6===_0x1e17d6)break;else _0x112ce7['push'](_0x112ce7['shift']());}catch(_0x15871f){_0x112ce7['push'](_0x112ce7['shift']());}}}(a225_0x1c48,0xd4391));function a225_0x31ef(_0x229a77,_0x1f1332){_0x229a77=_0x229a77-0xea;const _0x1c48a6=a225_0x1c48();let _0x31efbd=_0x1c48a6[_0x229a77];return _0x31efbd;}import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a225_0x160a81(0xf0);function readPatch(_0x5e8741){const _0x18b0e0=a225_0x160a81,_0x431ff8=_0x5e8741['flag'](_0x18b0e0(0xf1)),_0x3bc0bf=_0x5e8741[_0x18b0e0(0xfb)]('remark'),_0x3c43b9={};if(_0x431ff8!==undefined&&_0x431ff8!==null){const _0x455d24=String(_0x431ff8)[_0x18b0e0(0xf7)]();if(!_0x455d24)throw CliErrors[_0x18b0e0(0x104)](_0x18b0e0(0xf8));if(_0x455d24[_0x18b0e0(0xfe)]>0x40)throw CliErrors['validation'](_0x18b0e0(0xff));_0x3c43b9[_0x18b0e0(0x10c)]=_0x455d24;}_0x3bc0bf!==undefined&&_0x3bc0bf!==null&&(_0x3c43b9[_0x18b0e0(0xef)]=String(_0x3bc0bf));if(_0x3c43b9[_0x18b0e0(0x10c)]===undefined&&_0x3c43b9[_0x18b0e0(0xef)]===undefined)throw CliErrors[_0x18b0e0(0x104)](_0x18b0e0(0xec),_0x18b0e0(0x109));return _0x3c43b9;}export const roleUpdate={'service':'role','command':a225_0x160a81(0xf4),'description':a225_0x160a81(0xfa),'risk':a225_0x160a81(0x107),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':'string','required':![],'description':a225_0x160a81(0x100)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x27f481){readPatch(_0x27f481);},async 'dryRun'(_0x29f6d9){const _0x26f957=a225_0x160a81,_0x3a68e8=_0x29f6d9[_0x26f957(0x102)]('id'),_0x1fbadf=readPatch(_0x29f6d9),_0x31b152=await getRoleById(_0x29f6d9[_0x26f957(0xfd)],_0x3a68e8);return assertCustomRole(_0x31b152,'update'),asDryRunResult({'scope':_0x26f957(0xee),'operation':_0x26f957(0xf4),'selector':{'appCode':_0x29f6d9[_0x26f957(0xfd)],'roleId':_0x3a68e8,'roleName':_0x31b152[_0x26f957(0x10c)]},'before':projectRole(_0x31b152),'after':projectRole({..._0x31b152,..._0x1fbadf[_0x26f957(0x10c)]!==undefined?{'roleName':_0x1fbadf[_0x26f957(0x10c)]}:{},..._0x1fbadf[_0x26f957(0xef)]!==undefined?{'remark':_0x1fbadf[_0x26f957(0xef)]}:{}}),'dryRun':!![],'backend':{'method':_0x26f957(0xeb),'path':UPDATE_PATH},'warnings':[]},{'method':_0x26f957(0xeb),'url':UPDATE_PATH});},async 'execute'(_0x368872){const _0x459874=a225_0x160a81,_0x289524=_0x368872['num']('id'),_0x21a691=readPatch(_0x368872),_0x54af73=await getRoleById(_0x368872[_0x459874(0xfd)],_0x289524);assertCustomRole(_0x54af73,'update'),await updateAppRole({'id':_0x289524,'appCode':_0x368872[_0x459874(0xfd)],..._0x21a691[_0x459874(0x10c)]!==undefined?{'roleName':_0x21a691[_0x459874(0x10c)]}:{},..._0x21a691['remark']!==undefined?{'remark':_0x21a691[_0x459874(0xef)]}:{}});const _0x476efa=await getRoleById(_0x368872['appCode'],_0x289524);return{'ok':!![],'data':{'scope':'dev','operation':_0x459874(0xf4),'selector':{'appCode':_0x368872[_0x459874(0xfd)],'roleId':_0x289524,'roleName':_0x476efa[_0x459874(0x10c)]},'before':projectRole(_0x54af73),'after':projectRole(_0x476efa),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x459874(0x108)+_0x476efa[_0x459874(0x10c)]+_0x459874(0xf9)+_0x289524+')'};}};function a225_0x1c48(){const _0x36829a=['Updated\x20role\x20','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','9187472ZgBNHW','5444548VSvQHx','roleName','6UHzBWk','POST','Nothing\x20to\x20update.','12ADNizD','dev','remark','/smartapi/permit/role/update','name','333468tVcihD','7538479nKssOE','update','88SLFuRQ','5AMxiAH','trim','--name\x20cannot\x20be\x20empty.','\x20(id=','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','flag','3GjOSNT','appCode','length','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','New\x20role\x20name','56gFoMhE','num','178874EsboDM','validation','6520bQjSrb','4535856KAcUXI','write'];a225_0x1c48=function(){return _0x36829a;};return a225_0x1c48();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a226_0x38a6(){const _0x38fadb=['Added\x20user\x20','\x20already\x20in\x20role\x20','3sKkpcr','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','15nHrRNf','selector','userId','505664pFriPU','649ijTNLZ','136156MbzxIG','11418ODtdqL','roleType','high-risk-write','user-add','1917888AjdQmZ','role','2107440fyPgTb','No\x20change:\x20user\x20','appCode','266qyYpCd','900006bEDddK','9elaSqe','31240jIUKQN'];a226_0x38a6=function(){return _0x38fadb;};return a226_0x38a6();}const a226_0x5ec782=a226_0x3ced;(function(_0x31da82,_0x31f62d){const _0x5365c8=a226_0x3ced,_0x107ced=_0x31da82();while(!![]){try{const _0x5b3635=-parseInt(_0x5365c8(0x85))/0x1+-parseInt(_0x5365c8(0x90))/0x2*(parseInt(_0x5365c8(0x95))/0x3)+parseInt(_0x5365c8(0x83))/0x4*(parseInt(_0x5365c8(0x97))/0x5)+-parseInt(_0x5365c8(0x86))/0x6*(parseInt(_0x5365c8(0x8f))/0x7)+-parseInt(_0x5365c8(0x8a))/0x8*(-parseInt(_0x5365c8(0x91))/0x9)+-parseInt(_0x5365c8(0x92))/0xa*(-parseInt(_0x5365c8(0x84))/0xb)+parseInt(_0x5365c8(0x8c))/0xc;if(_0x5b3635===_0x31f62d)break;else _0x107ced['push'](_0x107ced['shift']());}catch(_0x5d1348){_0x107ced['push'](_0x107ced['shift']());}}}(a226_0x38a6,0x4e3bf));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a226_0x3ced(_0x117c13,_0x518d82){_0x117c13=_0x117c13-0x83;const _0x38a68a=a226_0x38a6();let _0x3cedbe=_0x38a68a[_0x117c13];return _0x3cedbe;}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':a226_0x5ec782(0x8b),'command':'user-add','description':a226_0x5ec782(0x96),'risk':a226_0x5ec782(0x88),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0xe2a2b3){const _0x521ea1=a226_0x5ec782,{mutation:_0x37670a}=await prepareUserMutation(_0xe2a2b3,_0x521ea1(0x89),!![]);return asDryRunResult(_0x37670a,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0xfe7e88){const _0x3ecbab=a226_0x5ec782,{mutation:_0x2dc4a9,changed:_0x5798d8,role:_0x2556ad,user:_0x1e741e}=await prepareUserMutation(_0xfe7e88,_0x3ecbab(0x89),![]);return _0x5798d8&&await createDevUserRole({'appCode':_0xfe7e88[_0x3ecbab(0x8e)],'userId':_0x1e741e[_0x3ecbab(0x99)],'username':_0x1e741e['username'],'roleType':_0x2556ad[_0x3ecbab(0x87)],'roleId':_0x2dc4a9['selector']['roleId']}),{'ok':!![],'data':_0x2dc4a9,'message':_0x5798d8?_0x3ecbab(0x93)+_0x2dc4a9[_0x3ecbab(0x98)][_0x3ecbab(0x99)]+'\x20to\x20role\x20'+_0x2dc4a9[_0x3ecbab(0x98)]['roleName']:_0x3ecbab(0x8d)+_0x2dc4a9[_0x3ecbab(0x98)][_0x3ecbab(0x99)]+_0x3ecbab(0x94)+_0x2dc4a9[_0x3ecbab(0x98)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a227_0x313630=a227_0x205a;(function(_0xe2b5cb,_0x121b54){const _0x5eb409=a227_0x205a,_0x1b5c57=_0xe2b5cb();while(!![]){try{const _0x4d7fb7=parseInt(_0x5eb409(0x75))/0x1+-parseInt(_0x5eb409(0x80))/0x2*(-parseInt(_0x5eb409(0x7b))/0x3)+-parseInt(_0x5eb409(0x7e))/0x4*(parseInt(_0x5eb409(0x7f))/0x5)+parseInt(_0x5eb409(0x74))/0x6*(-parseInt(_0x5eb409(0x79))/0x7)+-parseInt(_0x5eb409(0x7a))/0x8+parseInt(_0x5eb409(0x72))/0x9+parseInt(_0x5eb409(0x77))/0xa;if(_0x4d7fb7===_0x121b54)break;else _0x1b5c57['push'](_0x1b5c57['shift']());}catch(_0xe4cc0b){_0x1b5c57['push'](_0x1b5c57['shift']());}}}(a227_0x2fb5,0x9a072));function a227_0x205a(_0xb08e30,_0x3d7f28){_0xb08e30=_0xb08e30-0x72;const _0x2fb521=a227_0x2fb5();let _0x205a60=_0x2fb521[_0xb08e30];return _0x205a60;}import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a227_0x313630(0x81),'command':a227_0x313630(0x7c),'description':a227_0x313630(0x73),'risk':a227_0x313630(0x76),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x368781){const _0x3b8a91=a227_0x313630,{mutation:_0x15e173}=await prepareUserMutation(_0x368781,_0x3b8a91(0x7c),!![]);return asDryRunResult(_0x15e173,{'method':_0x3b8a91(0x82),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x46cdc0){const _0x242e64=a227_0x313630,{matchingRelationIds:_0x45a8a8,mutation:_0x427a0b,changed:_0x1a98ae}=await prepareUserMutation(_0x46cdc0,_0x242e64(0x7c),![]);if(_0x1a98ae)for(const _0x17dc00 of _0x45a8a8){await deleteDevUserRole(_0x17dc00);}return{'ok':!![],'data':_0x427a0b,'message':_0x1a98ae?'Removed\x20user\x20'+_0x427a0b[_0x242e64(0x78)][_0x242e64(0x7d)]+'\x20from\x20role\x20'+_0x427a0b[_0x242e64(0x78)][_0x242e64(0x83)]:'No\x20change:\x20user\x20'+_0x427a0b[_0x242e64(0x78)][_0x242e64(0x7d)]+'\x20not\x20in\x20role\x20'+_0x427a0b[_0x242e64(0x78)]['roleName']};}};function a227_0x2fb5(){const _0x26772b=['8uNSYNa','role','POST','roleName','9356049KNESvV','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','7149858mtubPs','116675GPfuzM','high-risk-write','9051290DbosCy','selector','7vOFEsn','7500040qWfIVs','897486HiZLDY','user-remove','userId','15684TjoTIj','635gODcDp'];a227_0x2fb5=function(){return _0x26772b;};return a227_0x2fb5();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a228_0x505c64=a228_0x4bd7;function a228_0x1a36(){const _0x14aba4=['Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','userId','Pass\x20--name\x20<nickname|username>.','trim','157876eesLjM','63512fGLaBt','205254jADKEI','role','33rSPLfS','286531XtDNjk','Resolved\x20\x22','name','username','479496HjrAWT','matchedBy','str','5JAwvbW','\x22\x20→\x20userId\x20','133510sXVoDR','read','21292wopoBZ','flagMissing'];a228_0x1a36=function(){return _0x14aba4;};return a228_0x1a36();}(function(_0xc28046,_0x5daced){const _0x599c09=a228_0x4bd7,_0x29084e=_0xc28046();while(!![]){try{const _0xddcedb=parseInt(_0x599c09(0x1d8))/0x1+parseInt(_0x599c09(0x1da))/0x2*(parseInt(_0x599c09(0x1e4))/0x3)+parseInt(_0x599c09(0x1e0))/0x4+parseInt(_0x599c09(0x1ec))/0x5*(-parseInt(_0x599c09(0x1e9))/0x6)+-parseInt(_0x599c09(0x1e5))/0x7+-parseInt(_0x599c09(0x1e1))/0x8+parseInt(_0x599c09(0x1e2))/0x9;if(_0xddcedb===_0x5daced)break;else _0x29084e['push'](_0x29084e['shift']());}catch(_0x131048){_0x29084e['push'](_0x29084e['shift']());}}}(a228_0x1a36,0x2cf27));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';function a228_0x4bd7(_0x38d54e,_0x2971f2){_0x38d54e=_0x38d54e-0x1d8;const _0x1a3635=a228_0x1a36();let _0x4bd7ff=_0x1a3635[_0x38d54e];return _0x4bd7ff;}export const roleUserResolve={'service':a228_0x505c64(0x1e3),'command':'user-resolve','description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a228_0x505c64(0x1d9),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2d84f6){const _0x272624=a228_0x505c64;if(!_0x2d84f6[_0x272624(0x1eb)](_0x272624(0x1e7))[_0x272624(0x1df)]())throw CliErrors[_0x272624(0x1db)](_0x272624(0x1e7),_0x272624(0x1de));},async 'execute'(_0x215907){const _0x5511a0=a228_0x505c64,_0x556b24=_0x215907[_0x5511a0(0x1eb)]('name')[_0x5511a0(0x1df)](),_0x4c107e=await resolveUserRef(_0x556b24,_0x5511a0(0x1dc));return{'ok':!![],'data':{'user':{'userId':_0x4c107e[_0x5511a0(0x1dd)],'username':_0x4c107e[_0x5511a0(0x1e8)],'nickname':_0x4c107e['nickname'],'matchedBy':_0x4c107e[_0x5511a0(0x1ea)]}},'message':_0x5511a0(0x1e6)+_0x556b24+_0x5511a0(0x1ed)+_0x4c107e['userId']};}};
|
package/lib/commands/rule/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a229_0xc35c22=a229_0x3545;(function(_0x77014b,_0x51537c){const _0x299a4a=a229_0x3545,_0x115f06=_0x77014b();while(!![]){try{const _0x19bb46=-parseInt(_0x299a4a(0x151))/0x1+-parseInt(_0x299a4a(0x15c))/0x2+-parseInt(_0x299a4a(0x160))/0x3*(parseInt(_0x299a4a(0x15d))/0x4)+parseInt(_0x299a4a(0x15e))/0x5+-parseInt(_0x299a4a(0x15b))/0x6*(-parseInt(_0x299a4a(0x152))/0x7)+-parseInt(_0x299a4a(0x161))/0x8+-parseInt(_0x299a4a(0x158))/0x9*(-parseInt(_0x299a4a(0x157))/0xa);if(_0x19bb46===_0x51537c)break;else _0x115f06['push'](_0x115f06['shift']());}catch(_0x780764){_0x115f06['push'](_0x115f06['shift']());}}}(a229_0x12d7,0x3b502));function a229_0x3545(_0x52a802,_0x30f272){_0x52a802=_0x52a802-0x14e;const _0x12d72c=a229_0x12d7();let _0x3545f0=_0x12d72c[_0x52a802];return _0x3545f0;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';function a229_0x12d7(){const _0x26ec37=['cookie','app_rule_not_found','read','\x20for\x20','451586ZYzOMQ','21WKQLbF','get','Loaded\x20','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','appCode','10697560DiWhGZ','9saJmkG','rule','content','200958AVdqrD','563700tiVcIc','4RRmYOl','498920NVXAAR','\x20is\x20not\x20configured\x20for\x20app\x20','75876CQFCma','2146760aGjnxo'];a229_0x12d7=function(){return _0x26ec37;};return a229_0x12d7();}export const ruleGet={'service':a229_0xc35c22(0x159),'command':a229_0xc35c22(0x153),'description':a229_0xc35c22(0x155),'risk':a229_0xc35c22(0x14f),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x5f3092){readAppRuleType(_0x5f3092);},async 'execute'(_0x5cfe74){const _0x411bd1=a229_0xc35c22,_0x50a14b=readAppRuleType(_0x5cfe74),_0x5ee728=await getAppRule(_0x5cfe74[_0x411bd1(0x162)],{'appCode':_0x5cfe74['appCode'],'type':_0x50a14b});if(!_0x5ee728)throw appRuleError(_0x411bd1(0x14e),appRuleFileName(_0x50a14b)+_0x411bd1(0x15f)+_0x5cfe74[_0x411bd1(0x156)]+'.','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20'+_0x50a14b+'\x20--file\x20<path>\x20--dry-run`.');return{'ok':!![],'data':{'rule':{...projectAppRule(_0x50a14b,_0x5ee728),'content':_0x5ee728[_0x411bd1(0x15a)]}},'message':_0x411bd1(0x154)+appRuleFileName(_0x50a14b)+_0x411bd1(0x150)+_0x5cfe74['appCode']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x298048,_0x5f5a52){const _0x55e3c6=a230_0x8f01,_0x52d210=_0x298048();while(!![]){try{const _0x28d6b3=-parseInt(_0x55e3c6(0xc9))/0x1+-parseInt(_0x55e3c6(0xc2))/0x2+parseInt(_0x55e3c6(0xc4))/0x3*(-parseInt(_0x55e3c6(0xc6))/0x4)+-parseInt(_0x55e3c6(0xc7))/0x5+parseInt(_0x55e3c6(0xc5))/0x6+parseInt(_0x55e3c6(0xca))/0x7*(parseInt(_0x55e3c6(0xc8))/0x8)+parseInt(_0x55e3c6(0xc3))/0x9;if(_0x28d6b3===_0x5f5a52)break;else _0x52d210['push'](_0x52d210['shift']());}catch(_0x34652e){_0x52d210['push'](_0x52d210['shift']());}}}(a230_0x3089,0xaa652));function a230_0x3089(){const _0x1422b9=['317480euCXXK','5642495TtOAxv','33688fOwlbQ','641354vDgXNW','322mrhApw','1807550rcLFns','37010781ssuCoh','39tAxXmo','584166uOtFMs'];a230_0x3089=function(){return _0x1422b9;};return a230_0x3089();}import{ruleGet}from'../../commands/rule/get.js';import{ruleList}from'../../commands/rule/list.js';function a230_0x8f01(_0x5e2105,_0x1e5096){_0x5e2105=_0x5e2105-0xc2;const _0x308922=a230_0x3089();let _0x8f0151=_0x308922[_0x5e2105];return _0x8f0151;}import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a231_0x3e02a2=a231_0x551c;(function(_0x558dd5,_0x570c62){const _0x8aa3b5=a231_0x551c,_0x5d2879=_0x558dd5();while(!![]){try{const _0x5895fd=-parseInt(_0x8aa3b5(0x86))/0x1+-parseInt(_0x8aa3b5(0x92))/0x2+-parseInt(_0x8aa3b5(0x91))/0x3+parseInt(_0x8aa3b5(0x88))/0x4*(-parseInt(_0x8aa3b5(0x94))/0x5)+parseInt(_0x8aa3b5(0x90))/0x6*(-parseInt(_0x8aa3b5(0x8d))/0x7)+-parseInt(_0x8aa3b5(0x8f))/0x8+parseInt(_0x8aa3b5(0x8c))/0x9;if(_0x5895fd===_0x570c62)break;else _0x5d2879['push'](_0x5d2879['shift']());}catch(_0x3b513b){_0x5d2879['push'](_0x5d2879['shift']());}}}(a231_0x515c,0x44820));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a231_0x551c(_0x5c640d,_0x4c9f12){_0x5c640d=_0x5c640d-0x83;const _0x515c64=a231_0x515c();let _0x551cee=_0x515c64[_0x5c640d];return _0x551cee;}export const ruleList={'service':a231_0x3e02a2(0x8b),'command':a231_0x3e02a2(0x93),'description':a231_0x3e02a2(0x8a),'risk':a231_0x3e02a2(0x85),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x268dea){const _0x1baa1d=a231_0x3e02a2,_0x2d7b26=await Promise[_0x1baa1d(0x84)](APP_RULE_TYPES['map'](_0x270920=>getAppRule(_0x268dea[_0x1baa1d(0x89)],{'appCode':_0x268dea[_0x1baa1d(0x8e)],'type':_0x270920}))),_0x5d7afe=APP_RULE_TYPES[_0x1baa1d(0x83)]((_0x287b24,_0x2d21d0)=>projectAppRule(_0x287b24,_0x2d7b26[_0x2d21d0]??null));return{'ok':!![],'data':{'total':_0x5d7afe[_0x1baa1d(0x87)],'rules':_0x5d7afe},'message':'Loaded\x20app\x20rule\x20configuration\x20for\x20'+_0x268dea[_0x1baa1d(0x8e)]};}};function a231_0x515c(){const _0x3fb8e7=['rule','17946486cnUKvF','25459TijsIV','appCode','3161744IvPNoT','78SSREeB','534105kjOqSh','689436icVEFx','list','1377615GpIDTV','map','all','read','197148xISYEx','length','8deoejb','cookie','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app'];a231_0x515c=function(){return _0x3fb8e7;};return a231_0x515c();}
|
package/lib/commands/rule/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a232_0x3965e1=a232_0x4628;(function(_0x5dd247,_0x4ceeb0){const _0x230cbd=a232_0x4628,_0x497554=_0x5dd247();while(!![]){try{const _0x28b116=parseInt(_0x230cbd(0xfb))/0x1+parseInt(_0x230cbd(0xf3))/0x2+-parseInt(_0x230cbd(0x10a))/0x3+-parseInt(_0x230cbd(0xe3))/0x4*(parseInt(_0x230cbd(0xef))/0x5)+-parseInt(_0x230cbd(0xdc))/0x6+-parseInt(_0x230cbd(0xe7))/0x7+-parseInt(_0x230cbd(0xed))/0x8*(-parseInt(_0x230cbd(0x102))/0x9);if(_0x28b116===_0x4ceeb0)break;else _0x497554['push'](_0x497554['shift']());}catch(_0x2ad795){_0x497554['push'](_0x497554['shift']());}}}(a232_0x359d,0x394df));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 a232_0x4628(_0x27ea7,_0x2c45fe){_0x27ea7=_0x27ea7-0xd9;const _0x359de8=a232_0x359d();let _0x46284a=_0x359de8[_0x27ea7];return _0x46284a;}const SAVE_PATH=a232_0x3965e1(0xe4),NON_ATOMIC_WARNING=a232_0x3965e1(0x106);function a232_0x359d(){const _0x5b26ed=['Set\x20','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','Expected\x20','planned','cookie','rabetbase\x20rule\x20get\x20--type\x20','879108psgssG','string','rule','content','expectedVersion','app_rule_verification_unavailable','flag','129708lYMzjp','/smartapi/knowledge-base/save','\x20--format\x20compress','\x20could\x20not\x20be\x20verified.','1361591aJoMkm','str','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','POST','app_rule_file_required','contentHash','9624392cznqVf','set','45iXZIGA','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','Pass\x20a\x20UTF-8\x20Markdown\x20file.','replacement','33446NGeCXE','app_rule_verification_failed','version','\x20for\x20','before','unconfigured','type','beforeRecord','25018GRUhsc','expected-version','input','trim','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','appCode','app_rule_expected_version_invalid','9bDgrTL','push','app_rule_set_outcome_unknown','The\x20set\x20request\x20was\x20sent,\x20but\x20','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','file','1131591iFiHht','rules','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'];a232_0x359d=function(){return _0x5b26ed;};return a232_0x359d();}function readSetInput(_0x44f98b){const _0x26b442=a232_0x3965e1,_0x4c92df=readAppRuleType(_0x44f98b),_0x553932=_0x44f98b[_0x26b442(0xe8)](_0x26b442(0x109))[_0x26b442(0xfe)]();if(!_0x553932)throw appRuleError(_0x26b442(0xeb),'--file\x20is\x20required.',_0x26b442(0xf1));const _0x446b05=_0x44f98b[_0x26b442(0xe2)](_0x26b442(0xfc));let _0x239189;if(_0x446b05!==undefined){_0x239189=Number(_0x446b05);if(!Number['isSafeInteger'](_0x239189)||_0x239189<0x0)throw appRuleError(_0x26b442(0x101),_0x26b442(0xf0));}return{'type':_0x4c92df,'file':_0x553932,'expectedVersion':_0x239189};}async function prepareSet(_0x42edbd){const _0x34e536=a232_0x3965e1,_0x78c6fc=readSetInput(_0x42edbd),_0x42caa6=await readAppRuleFile(_0x78c6fc[_0x34e536(0x109)]),_0x2a3c09=await getAppRule(_0x42edbd[_0x34e536(0xda)],{'appCode':_0x42edbd['appCode'],'type':_0x78c6fc['type']});if(_0x78c6fc[_0x34e536(0xe0)]!==undefined&&_0x2a3c09?.['version']!==_0x78c6fc[_0x34e536(0xe0)])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x78c6fc[_0x34e536(0xf9)])+'\x20version\x20changed\x20before\x20write.',_0x34e536(0x10f)+_0x78c6fc[_0x34e536(0xe0)]+';\x20current\x20version\x20is\x20'+(_0x2a3c09?.['version']??_0x34e536(0xf8))+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x78c6fc,'replacement':_0x42caa6,'beforeRecord':_0x2a3c09,'before':projectAppRule(_0x78c6fc[_0x34e536(0xf9)],_0x2a3c09),'planned':{'type':_0x78c6fc[_0x34e536(0xf9)],'fileName':appRuleFileName(_0x78c6fc[_0x34e536(0xf9)]),'contextScope':appRuleContextScope(_0x78c6fc[_0x34e536(0xf9)]),'enabled':!![],'appCode':_0x42edbd[_0x34e536(0x100)],'scope':'rules','contentByteSize':_0x42caa6['byteSize'],'contentHash':_0x42caa6[_0x34e536(0xec)]}};}function warningsFor(_0x4bb48c){return _0x4bb48c===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a232_0x3965e1(0xde),'command':'set','description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a232_0x3965e1(0x109),'type':a232_0x3965e1(0xdd),'required':!![],'description':a232_0x3965e1(0x10c)},{'name':'expected-version','type':'number','required':![],'description':a232_0x3965e1(0xe9)}],async 'validate'(_0x4f4655){readSetInput(_0x4f4655);},async 'dryRun'(_0x5dd951){const _0x343480=a232_0x3965e1,_0x317140=await prepareSet(_0x5dd951);return asDryRunResult({'operation':_0x343480(0xee),'selector':{'appCode':_0x5dd951[_0x343480(0x100)],'scope':'rules','type':_0x317140[_0x343480(0xfd)]['type']},'before':_0x317140[_0x343480(0xf7)],'after':_0x317140[_0x343480(0xd9)],'dryRun':!![],'backend':{'method':_0x343480(0xea),'path':SAVE_PATH},'warnings':warningsFor(_0x317140['input'][_0x343480(0xe0)]),'verification':{'expectedVersion':_0x317140['input'][_0x343480(0xe0)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x317140[_0x343480(0xfd)][_0x343480(0xf9)]+_0x343480(0xe5)}},{'method':_0x343480(0xea),'url':SAVE_PATH});},async 'execute'(_0x8f9241){const _0x58cb28=a232_0x3965e1,_0x5907f5=await prepareSet(_0x8f9241);let _0xfb960=![];try{await saveAppRule(_0x8f9241[_0x58cb28(0xda)],{'appCode':_0x8f9241[_0x58cb28(0x100)],'type':_0x5907f5[_0x58cb28(0xfd)]['type'],'content':_0x5907f5[_0x58cb28(0xf2)][_0x58cb28(0xdf)]});}catch(_0x542964){if(!isPlatformTransportFailure(_0x542964))throw _0x542964;_0xfb960=!![];}let _0xfc8667;try{_0xfc8667=await getAppRule(_0x8f9241['cookie'],{'appCode':_0x8f9241[_0x58cb28(0x100)],'type':_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)]});}catch(_0x3bd68a){const _0x3716a2=appRuleError(_0xfb960?'app_rule_set_outcome_unknown':_0x58cb28(0xe1),_0x58cb28(0x105)+appRuleFileName(_0x5907f5['input']['type'])+_0x58cb28(0xe6),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object['defineProperty'](_0x3716a2,'cause',{'value':_0x3bd68a,'enumerable':![]});throw _0x3716a2;}const _0x14c169=_0xfc8667&&inspectAppRuleContent(_0xfc8667[_0x58cb28(0xdf)])['contentHash']===_0x5907f5[_0x58cb28(0xf2)]['contentHash'],_0x532369=_0xfc8667&&(_0x5907f5[_0x58cb28(0xfa)]===null||_0xfc8667[_0x58cb28(0xf5)]>_0x5907f5[_0x58cb28(0xfa)]['version']);if(!_0xfc8667||!_0x14c169||!_0x532369)throw appRuleError(_0xfb960?_0x58cb28(0x104):_0x58cb28(0xf4),appRuleFileName(_0x5907f5['input'][_0x58cb28(0xf9)])+_0x58cb28(0x107),_0x58cb28(0x10e)+_0x5907f5['input'][_0x58cb28(0xf9)]+_0x58cb28(0xff));const _0xe8f6cb=warningsFor(_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xe0)]);_0xfb960&&_0xe8f6cb[_0x58cb28(0x103)](_0x58cb28(0x108));const _0x5f335f=projectAppRule(_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)],_0xfc8667);return{'ok':!![],'data':{'operation':'set','selector':{'appCode':_0x8f9241[_0x58cb28(0x100)],'scope':_0x58cb28(0x10b),'type':_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)]},'before':_0x5907f5[_0x58cb28(0xf7)],'after':_0x5f335f,'dryRun':![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':_0xe8f6cb,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0xfb960,'expectedVersion':_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xe0)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x58cb28(0xdb)+_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)]+_0x58cb28(0xe5)}},'message':_0x58cb28(0x10d)+appRuleFileName(_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)])+_0x58cb28(0xf6)+_0x8f9241[_0x58cb28(0x100)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a233_0x13cc01=a233_0x3006;(function(_0x2faf7e,_0x10b84a){const _0x313219=a233_0x3006,_0x1cb70e=_0x2faf7e();while(!![]){try{const _0x127995=parseInt(_0x313219(0x1aa))/0x1*(-parseInt(_0x313219(0x196))/0x2)+parseInt(_0x313219(0x1af))/0x3*(-parseInt(_0x313219(0x1c0))/0x4)+parseInt(_0x313219(0x1a3))/0x5*(parseInt(_0x313219(0x1b1))/0x6)+-parseInt(_0x313219(0x1b0))/0x7*(parseInt(_0x313219(0x1a0))/0x8)+parseInt(_0x313219(0x1b2))/0x9*(parseInt(_0x313219(0x1a7))/0xa)+-parseInt(_0x313219(0x1ab))/0xb*(parseInt(_0x313219(0x19d))/0xc)+parseInt(_0x313219(0x1bf))/0xd;if(_0x127995===_0x10b84a)break;else _0x1cb70e['push'](_0x1cb70e['shift']());}catch(_0x53fabd){_0x1cb70e['push'](_0x1cb70e['shift']());}}}(a233_0x1a39,0x9b168));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=[a233_0x13cc01(0x1a8),'database'];function a233_0x1a39(){const _0x56c222=['Pass\x20a\x20UTF-8\x20Markdown\x20file.','RULES.md','isFile','sha256','decode','page-api-development','10968EZguhc','version','app_rule_file_unreadable','24dEXQpQ','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','utf8','10JGXkIy','database','byteLength','content','10WkwYxk','rules','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','1KhJleN','5093INepHy','appCode','str','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','423kZgOzO','190407RxkaKK','1243722gWDtno','6594813PZfURF','app_rule_content_too_large','--file\x20is\x20required.','trim','createTime','Cannot\x20access\x20app\x20rule\x20file:\x20','update','contentHash','database-analysis','message','utf-8','app_rule_file_invalid','digest','4487158hcSxEV','6644eUOdsv','updateTime','string','app_rule_content_invalid','sha256:','toLowerCase','236542iebZKT'];a233_0x1a39=function(){return _0x56c222;};return a233_0x1a39();}function a233_0x3006(_0x3f0c81,_0x3602a2){_0x3f0c81=_0x3f0c81-0x194;const _0x1a39c5=a233_0x1a39();let _0x3006a9=_0x1a39c5[_0x3f0c81];return _0x3006a9;}export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a233_0x13cc01(0x198),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a233_0x13cc01(0x19c),'database':a233_0x13cc01(0x1ba)};export function appRuleError(_0x274301,_0x2e4055,_0x2eeef3){return new CliError(_0x274301,0x1,_0x2e4055,_0x2eeef3);}export function readAppRuleType(_0x2d6adb){const _0x30cb9e=a233_0x13cc01,_0x304a3a=_0x2d6adb[_0x30cb9e(0x1ad)]('type')[_0x30cb9e(0x1b5)]()[_0x30cb9e(0x195)]();if(_0x304a3a!==_0x30cb9e(0x1a8)&&_0x304a3a!==_0x30cb9e(0x1a4))throw appRuleError('app_rule_type_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x304a3a;}export function appRuleFileName(_0x14a1c3){return APP_RULE_FILES[_0x14a1c3];}export function appRuleContextScope(_0x44f242){return APP_RULE_CONTEXT_SCOPES[_0x44f242];}export function inspectAppRuleContent(_0x2a8820){const _0xd4d806=a233_0x13cc01,_0xe3bf1b=Buffer['from'](_0x2a8820,_0xd4d806(0x1a2));return{'content':_0x2a8820,'byteSize':_0xe3bf1b[_0xd4d806(0x1a5)],'contentHash':_0xd4d806(0x194)+createHash(_0xd4d806(0x19a))[_0xd4d806(0x1b8)](_0xe3bf1b)[_0xd4d806(0x1be)]('hex')};}export async function readAppRuleFile(_0x436900){const _0x5f2f1d=a233_0x13cc01,_0x2ad766=_0x436900[_0x5f2f1d(0x1b5)]();if(!_0x2ad766)throw appRuleError('app_rule_file_required',_0x5f2f1d(0x1b4),_0x5f2f1d(0x197));const _0x1771c5=resolve(_0x2ad766);let _0x3931b3;try{_0x3931b3=await stat(_0x1771c5);}catch(_0x262184){throw appRuleError(_0x5f2f1d(0x19f),_0x5f2f1d(0x1b7)+_0x2ad766,_0x262184 instanceof Error?_0x262184[_0x5f2f1d(0x1bb)]:String(_0x262184));}if(!_0x3931b3[_0x5f2f1d(0x199)]())throw appRuleError(_0x5f2f1d(0x1bd),_0x5f2f1d(0x1a1)+_0x2ad766);if(_0x3931b3['size']>MAX_APP_RULE_BYTES)throw appRuleError(_0x5f2f1d(0x1b3),_0x5f2f1d(0x1ae));let _0x223fcc;try{_0x223fcc=await readFile(_0x1771c5);}catch(_0x57baa9){throw appRuleError(_0x5f2f1d(0x19f),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x2ad766,_0x57baa9 instanceof Error?_0x57baa9[_0x5f2f1d(0x1bb)]:String(_0x57baa9));}if(_0x223fcc['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x5f2f1d(0x1b3),'App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x216143;try{_0x216143=new TextDecoder(_0x5f2f1d(0x1bc),{'fatal':!![],'ignoreBOM':!![]})[_0x5f2f1d(0x19b)](_0x223fcc);}catch{throw appRuleError(_0x5f2f1d(0x1c3),'App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20'+_0x2ad766);}if(!_0x216143['trim']())throw appRuleError(_0x5f2f1d(0x1c3),'App\x20rule\x20file\x20is\x20blank:\x20'+_0x2ad766);return inspectAppRuleContent(_0x216143);}export function projectAppRule(_0xb7805b,_0x30f4d7){const _0x1317ea=a233_0x13cc01;if(!_0x30f4d7)return{'type':_0xb7805b,'fileName':appRuleFileName(_0xb7805b),'contextScope':appRuleContextScope(_0xb7805b),'enabled':![]};const _0x59f450=inspectAppRuleContent(_0x30f4d7[_0x1317ea(0x1a6)]);return{'type':_0xb7805b,'fileName':appRuleFileName(_0xb7805b),'contextScope':appRuleContextScope(_0xb7805b),'enabled':!![],'id':_0x30f4d7['id'],'scope':_0x30f4d7['scope'],'appCode':_0x30f4d7[_0x1317ea(0x1ac)],'version':_0x30f4d7[_0x1317ea(0x19e)],'contentByteSize':_0x59f450['byteSize'],'contentHash':_0x59f450[_0x1317ea(0x1b9)],..._0x30f4d7[_0x1317ea(0x1b6)]!==undefined&&_0x30f4d7[_0x1317ea(0x1b6)]!==null?{'createTime':_0x30f4d7[_0x1317ea(0x1b6)]}:{},..._0x30f4d7['updateTime']!==undefined&&_0x30f4d7[_0x1317ea(0x1c1)]!==null?{'updateTime':_0x30f4d7['updateTime']}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':a233_0x13cc01(0x1c2),'required':!![],'description':a233_0x13cc01(0x1a9),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a234_0x12af2a=a234_0x197d;(function(_0x150780,_0x22aae1){const _0x4fc15e=a234_0x197d,_0x2fe1ff=_0x150780();while(!![]){try{const _0x1ee6c8=-parseInt(_0x4fc15e(0xf1))/0x1*(-parseInt(_0x4fc15e(0x10b))/0x2)+parseInt(_0x4fc15e(0x105))/0x3*(-parseInt(_0x4fc15e(0xdf))/0x4)+-parseInt(_0x4fc15e(0xea))/0x5+parseInt(_0x4fc15e(0x109))/0x6+-parseInt(_0x4fc15e(0x100))/0x7*(-parseInt(_0x4fc15e(0xcf))/0x8)+-parseInt(_0x4fc15e(0xd5))/0x9*(parseInt(_0x4fc15e(0xe8))/0xa)+parseInt(_0x4fc15e(0x107))/0xb;if(_0x1ee6c8===_0x22aae1)break;else _0x2fe1ff['push'](_0x2fe1ff['shift']());}catch(_0x3d37c8){_0x2fe1ff['push'](_0x2fe1ff['shift']());}}}(a234_0x1458,0xe67a0));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a234_0x12af2a(0xe1)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a234_0x12af2a(0xd2),a234_0x12af2a(0xe1),a234_0x12af2a(0xfa),'preview']);export function syncProjectDomainRoutingBeforeScript(_0x3b3d13,_0x5bdad4){const _0x489e7c=a234_0x12af2a;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x489e7c(0xd8)](_0x5bdad4))return null;const _0x430c3b=findProjectRootDirectory(_0x3b3d13);if(!resolveConfigPath(_0x430c3b))return null;const _0x944011=writeProjectDomainRoutingManifest(_0x430c3b);return{'path':_0x944011['path'],'changed':_0x944011[_0x489e7c(0xe6)]};}function readPackageScripts(_0x426dd8){const _0x3d3cd7=a234_0x12af2a,_0x59bc9d=resolve(_0x426dd8,_0x3d3cd7(0xda));if(!existsSync(_0x59bc9d))return null;try{const _0x35d960=JSON['parse'](readFileSync(_0x59bc9d,_0x3d3cd7(0xf9)));return _0x35d960['scripts']??{};}catch{return null;}}function detectPackageManager(_0x472d44){const _0x96a2a9=a234_0x12af2a;if(existsSync(resolve(_0x472d44,'bun.lockb'))||existsSync(resolve(_0x472d44,_0x96a2a9(0x106))))return _0x96a2a9(0xdd);if(existsSync(resolve(_0x472d44,'pnpm-lock.yaml')))return _0x96a2a9(0x104);if(existsSync(resolve(_0x472d44,'yarn.lock')))return _0x96a2a9(0xd1);return _0x96a2a9(0xfc);}async function versionCheck(_0xa008ee){const _0x583473=a234_0x12af2a,_0x1eeadf=await checkCliVersion();(_0x1eeadf[_0x583473(0xe2)]||_0x1eeadf[_0x583473(0xe9)])&&(printCliUpgradeWarning(_0x1eeadf),assertCliVersionSupported(_0x1eeadf));const _0x2032a5=await checkSdkVersion(_0xa008ee);if(_0x2032a5[_0x583473(0xe2)])printSdkUpgradeWarning(_0x2032a5);}function spawnScript(_0x238b75,_0x15a68b,_0x11fcd6,_0x13b066){return new Promise((_0x23be30,_0x505f89)=>{const _0x545084=a234_0x197d,_0x13fde7=[_0x545084(0xfe),_0x15a68b,..._0x11fcd6],_0x1eb0e5=spawn(_0x238b75,_0x13fde7,{'cwd':_0x13b066,'stdio':_0x545084(0xf4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x13b066,_0x545084(0xdc),'.bin')+delimiter+process.env.PATH}});_0x1eb0e5['on'](_0x545084(0xf8),_0x4caa33=>{const _0x4c12dc=_0x545084;if(_0x4caa33===0x0||_0x4caa33===null)_0x23be30();else _0x505f89(new Error(_0x238b75+_0x4c12dc(0x103)+_0x15a68b+_0x4c12dc(0xed)+_0x4caa33));}),_0x1eb0e5['on'](_0x545084(0xd6),_0x505f89);});}function spawnViteBuildWatch(_0x1d30ac){return new Promise((_0x1e86cf,_0x1a01b5)=>{const _0x47637b=a234_0x197d,_0x117436=spawn(_0x47637b(0xfd),[_0x47637b(0xfa),_0x47637b(0xd7)],{'cwd':_0x1d30ac,'stdio':_0x47637b(0xf4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1d30ac,_0x47637b(0xdc),'.bin')+delimiter+process.env.PATH}});_0x117436['on'](_0x47637b(0xf8),_0x50ca71=>{const _0x20f685=_0x47637b;if(_0x50ca71===0x0||_0x50ca71===null)_0x1e86cf();else _0x1a01b5(new Error(_0x20f685(0x10c)+_0x50ca71));}),_0x117436['on']('error',_0x1a01b5);});}function spawnVitePreview(_0x1f472e){return new Promise((_0x46e34d,_0xdd28d2)=>{const _0x45da50=a234_0x197d,_0x101736=spawn(_0x45da50(0xfd),[_0x45da50(0x10a)],{'cwd':_0x1f472e,'stdio':_0x45da50(0xf4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1f472e,_0x45da50(0xdc),_0x45da50(0xd0))+delimiter+process.env.PATH}});_0x101736['on'](_0x45da50(0xf8),_0x467b37=>{const _0x15d2f1=_0x45da50;if(_0x467b37===0x0||_0x467b37===null)_0x46e34d();else _0xdd28d2(new Error(_0x15d2f1(0xd9)+_0x467b37));}),_0x101736['on'](_0x45da50(0xd6),_0xdd28d2);});}function a234_0x197d(_0x2dba8e,_0x531407){_0x2dba8e=_0x2dba8e-0xcf;const _0x1458e3=a234_0x1458();let _0x197dae=_0x1458e3[_0x2dba8e];return _0x197dae;}const runFlags=[{'name':'watch','type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];function a234_0x1458(){const _0x5c746c=['vite','run','\x22\x20not\x20found\x20in\x20package.json.','178507LhdXsV','cwd','validation','\x20run\x20','pnpm','71943GToVUl','bun.lock','24797190esTKzK','Script\x20\x22','742014dxyIjN','preview','142226DHbJhx','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','No\x20scripts\x20defined\x20in\x20package.json.','Domain\x20routing\x20synchronized:\x20','408VwJNgR','.bin','yarn','start','\x20\x20EXAMPLES','No\x20package.json\x20found\x20in\x20current\x20directory.','12237921cqlkAM','error','--watch','has','vite\x20preview\x20exited\x20with\x20code\x20','package.json','Script\x20name\x20defined\x20in\x20package.json','node_modules','bun','push','172SPvYRm','length','dev','needsUpgrade','log','keys','(none)','changed','\x0a\x20\x20Usage:\x20','10HfOpOa','belowMinimum','9184495FVCNMo','\x20run\x20start','path','\x20exited\x20with\x20code\x20','\x20\x20\x20\x20','write','script','21JuMsrw','join','all','inherit','args','\x20run\x20<script>\x0a','\x20run\x20preview','close','utf-8','build','Available:\x20','npm'];a234_0x1458=function(){return _0x5c746c;};return a234_0x1458();}export const runDefinition={'service':'run','command':'run','description':'Run\x20a\x20package.json\x20script','risk':a234_0x12af2a(0xef),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a234_0x12af2a(0xf0),'description':a234_0x12af2a(0xdb),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x4f8ddf=a234_0x12af2a,_0x4d35de=[];return _0x4d35de[_0x4f8ddf(0xde)](_0x4f8ddf(0xd3)),_0x4d35de[_0x4f8ddf(0xde)](_0x4f8ddf(0xee)+CLI_BIN_NAME+_0x4f8ddf(0xeb)),_0x4d35de['push'](_0x4f8ddf(0xee)+CLI_BIN_NAME+'\x20run\x20build'),_0x4d35de[_0x4f8ddf(0xde)](_0x4f8ddf(0xee)+CLI_BIN_NAME+_0x4f8ddf(0xf7)),_0x4d35de[_0x4f8ddf(0xde)](_0x4f8ddf(0xee)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x4d35de['join']('\x0a');},async 'execute'(_0x3d17e6){const _0x35c881=a234_0x12af2a,_0x42d6be=process[_0x35c881(0x101)](),_0x4017d7=_0x3d17e6[_0x35c881(0xf5)][0x0],_0xe1251e=_0x3d17e6[_0x35c881(0xf5)]['slice'](0x1),_0x4e598d=readPackageScripts(_0x42d6be);if(!_0x4e598d)throw CliErrors[_0x35c881(0x102)](_0x35c881(0xd4));if(!_0x4017d7){const _0x5a58f7=Object[_0x35c881(0xe4)](_0x4e598d);if(_0x5a58f7[_0x35c881(0xe0)]===0x0)console[_0x35c881(0xe3)](_0x35c881(0x10d));else{console[_0x35c881(0xe3)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x4bbd4d of _0x5a58f7){console[_0x35c881(0xe3)]('\x20\x20\x20\x20'+_0x4bbd4d);}console[_0x35c881(0xe3)](_0x35c881(0xe7)+CLI_BIN_NAME+_0x35c881(0xf6));}return{'ok':!![]};}if(!_0x4e598d[_0x4017d7])throw CliErrors[_0x35c881(0x102)](_0x35c881(0x108)+_0x4017d7+_0x35c881(0xff),_0x35c881(0xfb)+(Object[_0x35c881(0xe4)](_0x4e598d)[_0x35c881(0xf2)](',\x20')||_0x35c881(0xe5)));const _0x257104=detectPackageManager(_0x42d6be),_0x17b3c8=syncProjectDomainRoutingBeforeScript(_0x42d6be,_0x4017d7);_0x17b3c8?.[_0x35c881(0xe6)]&&console[_0x35c881(0xd6)](_0x35c881(0x10e)+_0x17b3c8[_0x35c881(0xec)]);VERSION_CHECK_SCRIPTS[_0x35c881(0xd8)](_0x4017d7)&&await versionCheck(_0x42d6be);if(_0x4017d7===_0x35c881(0x10a)&&_0x3d17e6['bool']('watch'))return await Promise[_0x35c881(0xf3)]([spawnViteBuildWatch(_0x42d6be),spawnVitePreview(_0x42d6be)]),{'ok':!![]};return await spawnScript(_0x257104,_0x4017d7,_0xe1251e,_0x42d6be),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a235_0x14fc67=a235_0x4608;(function(_0x5f0a3e,_0x4ffdba){const _0x3e89cf=a235_0x4608,_0x2910f9=_0x5f0a3e();while(!![]){try{const _0xb02c9d=-parseInt(_0x3e89cf(0xc4))/0x1+parseInt(_0x3e89cf(0xc7))/0x2+-parseInt(_0x3e89cf(0xc5))/0x3+parseInt(_0x3e89cf(0xc2))/0x4*(-parseInt(_0x3e89cf(0xbf))/0x5)+-parseInt(_0x3e89cf(0xc8))/0x6+-parseInt(_0x3e89cf(0xc3))/0x7+-parseInt(_0x3e89cf(0xc9))/0x8*(-parseInt(_0x3e89cf(0xc0))/0x9);if(_0xb02c9d===_0x4ffdba)break;else _0x2910f9['push'](_0x2910f9['shift']());}catch(_0x17ffba){_0x2910f9['push'](_0x2910f9['shift']());}}}(a235_0x271a,0xd2de7));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x3f62af){const _0x520b07=await buildSchemaPayload();return{'ok':!![],'data':_0x520b07};}function a235_0x4608(_0x2824c8,_0x24ba72){_0x2824c8=_0x2824c8-0xbf;const _0x271a78=a235_0x271a();let _0x4608c0=_0x271a78[_0x2824c8];return _0x4608c0;}function a235_0x271a(){const _0x1d9020=['json','2943320oONycv','1494720aRwfpg','224ybgBtA','1866190qHpeYz','257571piCpvU','export','4CGspEi','3412465JlOFoa','162148ihlcVm','411816EcKRKX'];a235_0x271a=function(){return _0x1d9020;};return a235_0x271a();}export const schemaDefinition={'service':'schema','command':a235_0x14fc67(0xc1),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a235_0x14fc67(0xc6),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a236_0x1694fe=a236_0x1916;(function(_0x13fca4,_0x2f2f18){const _0x19a12f=a236_0x1916,_0x7d9ed6=_0x13fca4();while(!![]){try{const _0x3d7022=-parseInt(_0x19a12f(0x199))/0x1+parseInt(_0x19a12f(0x1a2))/0x2*(parseInt(_0x19a12f(0x193))/0x3)+parseInt(_0x19a12f(0x192))/0x4+parseInt(_0x19a12f(0x189))/0x5*(parseInt(_0x19a12f(0x1b0))/0x6)+parseInt(_0x19a12f(0x194))/0x7*(-parseInt(_0x19a12f(0x18b))/0x8)+parseInt(_0x19a12f(0x178))/0x9+parseInt(_0x19a12f(0x176))/0xa*(-parseInt(_0x19a12f(0x19e))/0xb);if(_0x3d7022===_0x2f2f18)break;else _0x7d9ed6['push'](_0x7d9ed6['shift']());}catch(_0x2c8972){_0x7d9ed6['push'](_0x7d9ed6['shift']());}}}(a236_0x2b3e,0xae64e));import{writeFile}from'node:fs/promises';function a236_0x1916(_0x45285a,_0x1c7009){_0x45285a=_0x45285a-0x174;const _0x2b3e44=a236_0x2b3e();let _0x19169c=_0x2b3e44[_0x45285a];return _0x19169c;}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';function a236_0x2b3e(){const _0x432ef2=['sql','SQL\x20name:','dbName','lockFilePath','110mIpotk','Local\x20SQL\x20file\x20mode','create','lastSync','99050KedlmJ','mode','POST','str','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','sqlName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sqlRoot','Invalid\x20database\x20selection\x20payload:\x20','length','validation','SQL\x20query\x20display\x20name','MyBatis\x20XML\x20(mybatisXml)','18WASxuI','sqlCode','join','name','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Select\x20the\x20local\x20SQL\x20mode:','__manual__','sqlRootDir','740710OXPvfT','parse','10282977zsJHPS','map','nonInteractive','catch','dbId','SQL\x20name\x20cannot\x20be\x20empty','/smartapi/custom/saveUserCustomSql','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','appCode','Target\x20database\x20dbId:','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id','description','SELECT\x201\x20AS\x20id;','number','string','isFinite','1025170MPAFrE','trim','8ESiJMs','toISOString','mybatisXml','flag','utf8','Plain\x20SQL\x20(sql)','flagMissing','938496NtQpRS','27OaerGC','2126418lwqpqI','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','db-id','</select>','679202wLGKij'];a236_0x2b3e=function(){return _0x432ef2;};return a236_0x2b3e();}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x55055c){const _0x3f3e04=a236_0x1916;if(_0x55055c===_0x3f3e04(0x18d))return[_0x3f3e04(0x182),_0x3f3e04(0x183),_0x3f3e04(0x198),''][_0x3f3e04(0x1b2)]('\x0a');return[_0x3f3e04(0x185),''][_0x3f3e04(0x1b2)]('\x0a');}export const sqlCreate={'service':'sql','command':a236_0x1694fe(0x1a0),'description':a236_0x1694fe(0x195),'risk':'write','flags':[{'name':'name','type':a236_0x1694fe(0x187),'description':a236_0x1694fe(0x1ae)},{'name':'db-id','type':a236_0x1694fe(0x186),'description':'Target\x20database\x20ID'},{'name':'mode','type':a236_0x1694fe(0x187),'enum':[a236_0x1694fe(0x19a),a236_0x1694fe(0x18d)],'description':a236_0x1694fe(0x19f)}],async 'validate'(_0x545bb7){const _0x5aaab6=a236_0x1694fe;if(!_0x545bb7[_0x5aaab6(0x17a)])return;if(!_0x545bb7[_0x5aaab6(0x1a5)]('name')[_0x5aaab6(0x18a)]())throw CliErrors['flagMissing'](_0x5aaab6(0x1b3),_0x5aaab6(0x1a6));const _0x2a4985=resolveProvidedDbId(_0x545bb7);if(typeof _0x2a4985!=='number'||!Number['isFinite'](_0x2a4985)||_0x2a4985<=0x0)throw CliErrors['flagMissing'](_0x5aaab6(0x197),_0x5aaab6(0x196));if(!_0x545bb7[_0x5aaab6(0x1a5)](_0x5aaab6(0x1a3))[_0x5aaab6(0x18a)]())throw CliErrors[_0x5aaab6(0x191)](_0x5aaab6(0x1a3),_0x5aaab6(0x1b4));},async 'dryRun'(_0x4cebf4){const _0x39727c=a236_0x1694fe,_0x187934=loadSqlProjectConfig(_0x4cebf4['appCode']),{sqlName:_0x5f2da6,dbId:_0x5a9f49,dbName:_0x4c9810,mode:_0x93c48a}=await resolveSqlNewInputs(_0x4cebf4),_0x3e8dac=buildSqlRelativePath('<server-generated-sqlCode>',_0x5f2da6,_0x4c9810,_0x93c48a,_0x5a9f49),_0xed7e4e=_0x187934[_0x39727c(0x175)]+'/'+_0x3e8dac;return{'method':_0x39727c(0x1a4),'url':_0x39727c(0x17e),'body':{'appCode':_0x4cebf4[_0x39727c(0x180)],'sqlName':_0x5f2da6,'dbId':_0x5a9f49,'mode':_0x93c48a,'localPath':_0xed7e4e},'description':_0x39727c(0x1a9)+_0x187934['sqlRootDir']};},async 'execute'(_0x422b4d){const _0x3299fc=a236_0x1694fe,_0x4e431e=loadSqlProjectConfig(_0x422b4d[_0x3299fc(0x180)]),{sqlName:_0x276d54,dbId:_0x5f464d,dbName:_0x1df5ed,mode:_0x526ca9}=await resolveSqlNewInputs(_0x422b4d),_0x58e6f3=generateSqlTemplate(_0x526ca9),_0x2f58ac=await createSqlQuery({'appCode':_0x422b4d['appCode'],'sqlName':_0x276d54,'dbId':_0x5f464d,'sqlContent':_0x58e6f3}),_0x5249f2=ensureRemoteSqlContent(_0x2f58ac),_0x2a7221=_0x1df5ed||await getDbName(_0x422b4d['appCode'],_0x5f464d)[_0x3299fc(0x17b)](()=>undefined),_0x543d85=buildSqlRelativePath(_0x2f58ac[_0x3299fc(0x1b1)],_0x2f58ac['sqlName'],_0x2a7221,_0x526ca9,_0x5f464d),_0x20c3f2=_0x4e431e[_0x3299fc(0x175)]+'/'+_0x543d85,_0x549b68=buildLocalSqlFileContent({'sqlCode':_0x2f58ac['sqlCode'],'sqlName':_0x2f58ac[_0x3299fc(0x1a8)],'dbId':_0x2f58ac['dbId']},_0x5249f2,{'dbName':_0x2a7221,'mode':_0x526ca9,'syncedAt':new Date()['toISOString'](),'description':_0x2f58ac[_0x3299fc(0x184)]});if(await fileExists(_0x20c3f2))throw CliErrors[_0x3299fc(0x1ad)]('File\x20already\x20exists:\x20'+_0x20c3f2);await ensureParentDirectory(_0x20c3f2),await writeFile(_0x20c3f2,_0x549b68,_0x3299fc(0x18f));const _0x23c931=await readSqlLockFile(_0x4e431e[_0x3299fc(0x19d)]),{lockData:_0x2f3cbb,appLock:_0x1fa5eb}=ensureSqlLockScope(_0x23c931??createEmptySqlLock(),_0x4e431e[_0x3299fc(0x180)],_0x4e431e[_0x3299fc(0x1aa)],'new');return _0x1fa5eb['sqls'][_0x2f58ac[_0x3299fc(0x1b1)]]={...buildSqlLockEntry(_0x2f58ac,_0x5249f2,computeSqlContentHash(_0x549b68),{'dbName':_0x2a7221}),'path':_0x543d85,'mode':_0x526ca9},_0x1fa5eb[_0x3299fc(0x1a1)]=new Date()[_0x3299fc(0x18c)](),await writeSqlLockFile(_0x4e431e[_0x3299fc(0x19d)],_0x2f3cbb),{'ok':!![],'data':{'id':_0x2f58ac['id'],'sqlCode':_0x2f58ac[_0x3299fc(0x1b1)],'sqlName':_0x2f58ac['sqlName'],'dbId':_0x2f58ac[_0x3299fc(0x17c)],'path':_0x20c3f2,'mode':_0x526ca9},'message':_0x3299fc(0x1a7)+_0x2f58ac[_0x3299fc(0x1b1)]};}};async function resolveSqlNewInputs(_0x3a1a57){const _0x58a7c3=await resolveSqlNameInput(_0x3a1a57),{dbId:_0x3569ae,dbName:_0x329274}=await resolveDbSelection(_0x3a1a57),_0xee71d0=await resolveSqlModeInput(_0x3a1a57);return{'sqlName':_0x58a7c3,'dbId':_0x3569ae,'dbName':_0x329274,'mode':_0xee71d0};}async function resolveSqlNameInput(_0x2c332a){const _0x5b61a4=a236_0x1694fe,_0x9a714a=_0x2c332a[_0x5b61a4(0x1a5)](_0x5b61a4(0x1b3))['trim']();if(_0x9a714a)return _0x9a714a;if(_0x2c332a[_0x5b61a4(0x17a)])throw CliErrors[_0x5b61a4(0x191)](_0x5b61a4(0x1b3),_0x5b61a4(0x1a6));return(await input({'message':_0x5b61a4(0x19b),'validate':_0x170d1b=>_0x170d1b['trim']()?!![]:_0x5b61a4(0x17d)}))['trim']();}async function resolveDbSelection(_0x589a65){const _0x5bc9e7=a236_0x1694fe,_0x575987=resolveProvidedDbId(_0x589a65);if(typeof _0x575987===_0x5bc9e7(0x186)&&Number[_0x5bc9e7(0x188)](_0x575987)&&_0x575987>0x0)return{'dbId':_0x575987,'dbName':await getDbName(_0x589a65['appCode'],_0x575987)['catch'](()=>undefined)};if(_0x589a65[_0x5bc9e7(0x17a)])throw CliErrors[_0x5bc9e7(0x191)](_0x5bc9e7(0x197),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0xeef8d1=await listDatabases(_0x589a65[_0x5bc9e7(0x180)])[_0x5bc9e7(0x17b)](()=>[]);if(_0xeef8d1[_0x5bc9e7(0x1ac)]===0x1)return{'dbId':_0xeef8d1[0x0]['dbId'],'dbName':_0xeef8d1[0x0][_0x5bc9e7(0x19c)]};if(_0xeef8d1['length']>0x1){const _0xeda06a=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0xeef8d1[_0x5bc9e7(0x179)](_0x1c4652=>({'name':_0x1c4652[_0x5bc9e7(0x19c)]+'\x20('+_0x1c4652[_0x5bc9e7(0x17c)]+')','value':serializeDbSelection(_0x1c4652)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x5bc9e7(0x174)}]});if(_0xeda06a!=='__manual__')return deserializeDbSelection(_0xeda06a);}const _0xf074a=await input({'message':_0x5bc9e7(0x181),'validate':_0x54f78f=>{const _0x1b2fa2=_0x54f78f['trim']();if(!_0x1b2fa2)return'dbId\x20cannot\x20be\x20empty';const _0x435d99=Number(_0x1b2fa2);if(!Number['isInteger'](_0x435d99)||_0x435d99<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0xf074a['trim']())};}async function resolveSqlModeInput(_0x3d88ca){const _0x229edc=a236_0x1694fe,_0x314471=_0x3d88ca['str']('mode')[_0x229edc(0x18a)]();if(_0x314471===_0x229edc(0x19a)||_0x314471===_0x229edc(0x18d))return _0x314471;if(_0x3d88ca[_0x229edc(0x17a)])throw CliErrors[_0x229edc(0x191)](_0x229edc(0x1a3),_0x229edc(0x1b4));return await select({'message':_0x229edc(0x1b5),'choices':[{'name':_0x229edc(0x190),'value':_0x229edc(0x19a),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x229edc(0x1af),'value':_0x229edc(0x18d),'description':_0x229edc(0x17f)}]});}function serializeDbSelection(_0x50378d){const _0x2f3bdb=a236_0x1694fe;return JSON['stringify']({'dbId':_0x50378d[_0x2f3bdb(0x17c)],'dbName':_0x50378d['dbName']});}function deserializeDbSelection(_0x3ae1b9){const _0x4d76eb=a236_0x1694fe;try{const _0x17918d=JSON[_0x4d76eb(0x177)](_0x3ae1b9);if(typeof _0x17918d[_0x4d76eb(0x17c)]===_0x4d76eb(0x186)&&Number['isFinite'](_0x17918d[_0x4d76eb(0x17c)]))return{'dbId':_0x17918d[_0x4d76eb(0x17c)],'dbName':_0x17918d['dbName']};}catch{}throw CliErrors[_0x4d76eb(0x1ad)](_0x4d76eb(0x1ab)+_0x3ae1b9);}function resolveProvidedDbId(_0x48e622){const _0x38d721=a236_0x1694fe,_0x42c393=_0x48e622[_0x38d721(0x18e)](_0x38d721(0x197));if(typeof _0x42c393===_0x38d721(0x186)&&Number[_0x38d721(0x188)](_0x42c393))return _0x42c393;return undefined;}
|
|
1
|
+
const a236_0xbe0304=a236_0x4904;(function(_0x3ca1db,_0x22e400){const _0x22869b=a236_0x4904,_0x3e7286=_0x3ca1db();while(!![]){try{const _0x4da797=-parseInt(_0x22869b(0xf7))/0x1*(-parseInt(_0x22869b(0xe7))/0x2)+parseInt(_0x22869b(0xea))/0x3+-parseInt(_0x22869b(0xf8))/0x4*(-parseInt(_0x22869b(0x113))/0x5)+-parseInt(_0x22869b(0x104))/0x6*(parseInt(_0x22869b(0x112))/0x7)+-parseInt(_0x22869b(0x102))/0x8+-parseInt(_0x22869b(0xd4))/0x9+parseInt(_0x22869b(0xdc))/0xa*(parseInt(_0x22869b(0x111))/0xb);if(_0x4da797===_0x22e400)break;else _0x3e7286['push'](_0x3e7286['shift']());}catch(_0x2c8652){_0x3e7286['push'](_0x3e7286['shift']());}}}(a236_0x546f,0xe2f98));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x5ae01c){const _0x399c2b=a236_0x4904;if(_0x5ae01c===_0x399c2b(0xd7))return[_0x399c2b(0xf6),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x399c2b(0x103)]('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}export const sqlCreate={'service':'sql','command':a236_0xbe0304(0xd9),'description':a236_0xbe0304(0xe2),'risk':a236_0xbe0304(0x10c),'flags':[{'name':a236_0xbe0304(0xf1),'type':a236_0xbe0304(0xdd),'description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':a236_0xbe0304(0xe1),'description':a236_0xbe0304(0xfd)},{'name':a236_0xbe0304(0xdf),'type':a236_0xbe0304(0xdd),'enum':[a236_0xbe0304(0x101),a236_0xbe0304(0xd7)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x53de0a){const _0x2c92a7=a236_0xbe0304;if(!_0x53de0a[_0x2c92a7(0xe4)])return;if(!_0x53de0a[_0x2c92a7(0x10d)](_0x2c92a7(0xf1))[_0x2c92a7(0x105)]())throw CliErrors[_0x2c92a7(0xf9)]('name',_0x2c92a7(0xeb));const _0x5657f5=resolveProvidedDbId(_0x53de0a);if(typeof _0x5657f5!=='number'||!Number[_0x2c92a7(0xed)](_0x5657f5)||_0x5657f5<=0x0)throw CliErrors[_0x2c92a7(0xf9)]('db-id',_0x2c92a7(0xdb));if(!_0x53de0a[_0x2c92a7(0x10d)](_0x2c92a7(0xdf))[_0x2c92a7(0x105)]())throw CliErrors[_0x2c92a7(0xf9)](_0x2c92a7(0xdf),_0x2c92a7(0xf3));},async 'dryRun'(_0x2cb8d6){const _0x3d9cdc=a236_0xbe0304,_0x114b3f=loadSqlProjectConfig(_0x2cb8d6[_0x3d9cdc(0xe3)]),{sqlName:_0x3bb0c4,dbId:_0x9c06b0,dbName:_0x11b783,mode:_0x28320d}=await resolveSqlNewInputs(_0x2cb8d6),_0x3331a3=buildSqlRelativePath('<server-generated-sqlCode>',_0x3bb0c4,_0x11b783,_0x28320d,_0x9c06b0),_0x56b340=_0x114b3f['sqlRootDir']+'/'+_0x3331a3;return{'method':_0x3d9cdc(0xfe),'url':_0x3d9cdc(0xef),'body':{'appCode':_0x2cb8d6[_0x3d9cdc(0xe3)],'sqlName':_0x3bb0c4,'dbId':_0x9c06b0,'mode':_0x28320d,'localPath':_0x56b340},'description':_0x3d9cdc(0xf0)+_0x114b3f[_0x3d9cdc(0xd8)]};},async 'execute'(_0x3eef7b){const _0x537c42=a236_0xbe0304,_0x377be8=loadSqlProjectConfig(_0x3eef7b[_0x537c42(0xe3)]),{sqlName:_0x303896,dbId:_0x9ff366,dbName:_0x1a878e,mode:_0x2d355a}=await resolveSqlNewInputs(_0x3eef7b),_0x4abcd1=generateSqlTemplate(_0x2d355a),_0x3a904a=await createSqlQuery({'appCode':_0x3eef7b[_0x537c42(0xe3)],'sqlName':_0x303896,'dbId':_0x9ff366,'sqlContent':_0x4abcd1}),_0x218a61=ensureRemoteSqlContent(_0x3a904a),_0x30364a=_0x1a878e||await getDbName(_0x3eef7b[_0x537c42(0xe3)],_0x9ff366)[_0x537c42(0xe6)](()=>undefined),_0x5854db=buildSqlRelativePath(_0x3a904a[_0x537c42(0xde)],_0x3a904a['sqlName'],_0x30364a,_0x2d355a,_0x9ff366),_0x28c1f4=_0x377be8[_0x537c42(0xd8)]+'/'+_0x5854db,_0x11abe8=buildLocalSqlFileContent({'sqlCode':_0x3a904a[_0x537c42(0xde)],'sqlName':_0x3a904a[_0x537c42(0xec)],'dbId':_0x3a904a[_0x537c42(0x10b)]},_0x218a61,{'dbName':_0x30364a,'mode':_0x2d355a,'syncedAt':new Date()[_0x537c42(0xd3)](),'description':_0x3a904a[_0x537c42(0xf2)]});if(await fileExists(_0x28c1f4))throw CliErrors[_0x537c42(0x10e)](_0x537c42(0x108)+_0x28c1f4);await ensureParentDirectory(_0x28c1f4),await writeFile(_0x28c1f4,_0x11abe8,'utf8');const _0x2df069=await readSqlLockFile(_0x377be8['lockFilePath']),{lockData:_0x57c49a,appLock:_0x27d1db}=ensureSqlLockScope(_0x2df069??createEmptySqlLock(),_0x377be8[_0x537c42(0xe3)],_0x377be8['sqlRoot'],_0x537c42(0xe0));return _0x27d1db['sqls'][_0x3a904a[_0x537c42(0xde)]]={...buildSqlLockEntry(_0x3a904a,_0x218a61,computeSqlContentHash(_0x11abe8),{'dbName':_0x30364a}),'path':_0x5854db,'mode':_0x2d355a},_0x27d1db[_0x537c42(0xff)]=new Date()[_0x537c42(0xd3)](),await writeSqlLockFile(_0x377be8[_0x537c42(0xfa)],_0x57c49a),{'ok':!![],'data':{'id':_0x3a904a['id'],'sqlCode':_0x3a904a[_0x537c42(0xde)],'sqlName':_0x3a904a[_0x537c42(0xec)],'dbId':_0x3a904a[_0x537c42(0x10b)],'path':_0x28c1f4,'mode':_0x2d355a},'message':_0x537c42(0xd5)+_0x3a904a[_0x537c42(0xde)]};}};async function resolveSqlNewInputs(_0x5964b8){const _0x20b7bb=await resolveSqlNameInput(_0x5964b8),{dbId:_0xce089d,dbName:_0x3c639f}=await resolveDbSelection(_0x5964b8),_0x439482=await resolveSqlModeInput(_0x5964b8);return{'sqlName':_0x20b7bb,'dbId':_0xce089d,'dbName':_0x3c639f,'mode':_0x439482};}async function resolveSqlNameInput(_0x56a2de){const _0x5354fb=a236_0xbe0304,_0x2d4172=_0x56a2de['str'](_0x5354fb(0xf1))['trim']();if(_0x2d4172)return _0x2d4172;if(_0x56a2de[_0x5354fb(0xe4)])throw CliErrors[_0x5354fb(0xf9)](_0x5354fb(0xf1),_0x5354fb(0xeb));return(await input({'message':_0x5354fb(0xd2),'validate':_0x270b8b=>_0x270b8b[_0x5354fb(0x105)]()?!![]:_0x5354fb(0xd6)}))[_0x5354fb(0x105)]();}async function resolveDbSelection(_0x36b4f9){const _0x2764cc=a236_0xbe0304,_0x37d355=resolveProvidedDbId(_0x36b4f9);if(typeof _0x37d355===_0x2764cc(0xe1)&&Number['isFinite'](_0x37d355)&&_0x37d355>0x0)return{'dbId':_0x37d355,'dbName':await getDbName(_0x36b4f9[_0x2764cc(0xe3)],_0x37d355)[_0x2764cc(0xe6)](()=>undefined)};if(_0x36b4f9[_0x2764cc(0xe4)])throw CliErrors[_0x2764cc(0xf9)]('db-id',_0x2764cc(0xdb));const _0xfb53=await listDatabases(_0x36b4f9[_0x2764cc(0xe3)])[_0x2764cc(0xe6)](()=>[]);if(_0xfb53[_0x2764cc(0xee)]===0x1)return{'dbId':_0xfb53[0x0]['dbId'],'dbName':_0xfb53[0x0][_0x2764cc(0xf4)]};if(_0xfb53[_0x2764cc(0xee)]>0x1){const _0x5b8059=await select({'message':_0x2764cc(0xe8),'choices':[..._0xfb53[_0x2764cc(0xfc)](_0x1f165a=>({'name':_0x1f165a[_0x2764cc(0xf4)]+'\x20('+_0x1f165a[_0x2764cc(0x10b)]+')','value':serializeDbSelection(_0x1f165a)})),{'name':_0x2764cc(0xe5),'value':_0x2764cc(0xda)}]});if(_0x5b8059!==_0x2764cc(0xda))return deserializeDbSelection(_0x5b8059);}const _0x1c4cbb=await input({'message':'Target\x20database\x20dbId:','validate':_0x756a7=>{const _0x5f2a17=_0x2764cc,_0x2ac5a5=_0x756a7['trim']();if(!_0x2ac5a5)return _0x5f2a17(0xf5);const _0x4c6728=Number(_0x2ac5a5);if(!Number[_0x5f2a17(0x110)](_0x4c6728)||_0x4c6728<=0x0)return _0x5f2a17(0x10a);return!![];}});return{'dbId':Number(_0x1c4cbb[_0x2764cc(0x105)]())};}async function resolveSqlModeInput(_0x49301e){const _0x5c70a4=a236_0xbe0304,_0x10c6e5=_0x49301e['str'](_0x5c70a4(0xdf))[_0x5c70a4(0x105)]();if(_0x10c6e5===_0x5c70a4(0x101)||_0x10c6e5===_0x5c70a4(0xd7))return _0x10c6e5;if(_0x49301e[_0x5c70a4(0xe4)])throw CliErrors[_0x5c70a4(0xf9)](_0x5c70a4(0xdf),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x5c70a4(0xe9),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x5c70a4(0x101),'description':_0x5c70a4(0x10f)},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':'mybatisXml','description':_0x5c70a4(0x106)}]});}function serializeDbSelection(_0x20998e){const _0x24d986=a236_0xbe0304;return JSON[_0x24d986(0x107)]({'dbId':_0x20998e[_0x24d986(0x10b)],'dbName':_0x20998e[_0x24d986(0xf4)]});}function deserializeDbSelection(_0x5d032f){const _0xefc3e7=a236_0xbe0304;try{const _0x1cce2c=JSON[_0xefc3e7(0x109)](_0x5d032f);if(typeof _0x1cce2c[_0xefc3e7(0x10b)]===_0xefc3e7(0xe1)&&Number['isFinite'](_0x1cce2c['dbId']))return{'dbId':_0x1cce2c['dbId'],'dbName':_0x1cce2c[_0xefc3e7(0xf4)]};}catch{}throw CliErrors['validation'](_0xefc3e7(0xfb)+_0x5d032f);}function a236_0x4904(_0x4c6955,_0x251214){_0x4c6955=_0x4c6955-0xd2;const _0x546f2c=a236_0x546f();let _0x490472=_0x546f2c[_0x4c6955];return _0x490472;}function a236_0x546f(){const _0x692054=['dbId\x20must\x20be\x20a\x20positive\x20integer','dbId','write','str','validation','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','isInteger','1494966ozVAgx','536032OSIROi','5TqTdVe','SQL\x20name:','toISOString','7030755SUdese','Created\x20SQL\x20query\x20','SQL\x20name\x20cannot\x20be\x20empty','mybatisXml','sqlRootDir','create','__manual__','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','40kLQWDd','string','sqlCode','mode','new','number','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','appCode','nonInteractive','✎\x20Enter\x20dbId\x20manually','catch','3663634sMpNXK','Select\x20the\x20target\x20database:','Select\x20the\x20local\x20SQL\x20mode:','3618984flPyph','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlName','isFinite','length','/smartapi/custom/saveUserCustomSql','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','name','description','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','dbId\x20cannot\x20be\x20empty','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','1XrUqnn','3760492aWoSlK','flagMissing','lockFilePath','Invalid\x20database\x20selection\x20payload:\x20','map','Target\x20database\x20ID','POST','lastSync','flag','sql','10235912CeMwxd','join','120JVMglA','trim','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','stringify','File\x20already\x20exists:\x20','parse'];a236_0x546f=function(){return _0x692054;};return a236_0x546f();}function resolveProvidedDbId(_0x485fee){const _0x12c451=a236_0xbe0304,_0x1ce3f1=_0x485fee[_0x12c451(0x100)]('db-id');if(typeof _0x1ce3f1===_0x12c451(0xe1)&&Number[_0x12c451(0xed)](_0x1ce3f1))return _0x1ce3f1;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a237_0x176acf=a237_0x3aaa;(function(_0x15d7c9,_0x2e4352){const _0x148938=a237_0x3aaa,_0x5b362c=_0x15d7c9();while(!![]){try{const _0x5d5bc1=-parseInt(_0x148938(0x1f1))/0x1*(parseInt(_0x148938(0x1f2))/0x2)+parseInt(_0x148938(0x205))/0x3+-parseInt(_0x148938(0x1fe))/0x4+parseInt(_0x148938(0x1e6))/0x5+-parseInt(_0x148938(0x1e5))/0x6+-parseInt(_0x148938(0x1f7))/0x7*(-parseInt(_0x148938(0x202))/0x8)+-parseInt(_0x148938(0x1e3))/0x9*(-parseInt(_0x148938(0x1e1))/0xa);if(_0x5d5bc1===_0x2e4352)break;else _0x5b362c['push'](_0x5b362c['shift']());}catch(_0x1ad63d){_0x5b362c['push'](_0x5b362c['shift']());}}}(a237_0x5687,0xe34bf));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a237_0x3aaa(_0xa70f83,_0x41217b){_0xa70f83=_0xa70f83-0x1e0;const _0x5687eb=a237_0x5687();let _0x3aaa82=_0x5687eb[_0xa70f83];return _0x3aaa82;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a237_0x176acf(0x1f8),'command':a237_0x176acf(0x1ee),'description':a237_0x176acf(0x1eb),'risk':a237_0x176acf(0x1f4),'flags':[SQLCODE_FLAG],async 'validate'(_0x5bdec9){const _0x1cb36e=a237_0x176acf,_0x7efe61=loadSqlProjectConfig(_0x5bdec9[_0x1cb36e(0x207)]),_0x55cdd4=await readSqlLockFile(_0x7efe61[_0x1cb36e(0x1ef)]);if(!_0x55cdd4)throw CliErrors[_0x1cb36e(0x1f3)](_0x1cb36e(0x206));},async 'dryRun'(_0x4033eb){const _0x531cc3=a237_0x176acf,_0x534852=loadSqlProjectConfig(_0x4033eb[_0x531cc3(0x207)]),_0x292048=await readSqlLockFile(_0x534852[_0x531cc3(0x1ef)]);if(!_0x292048)throw CliErrors[_0x531cc3(0x1f3)](_0x531cc3(0x206));const {appLock:_0x385ffc}=ensureSqlLockScope(_0x292048,_0x4033eb[_0x531cc3(0x207)],_0x534852[_0x531cc3(0x1ea)],_0x531cc3(0x1ee)),_0x47d511=_0x4033eb[_0x531cc3(0x1e2)](_0x531cc3(0x1f6)),_0x299291=_0x385ffc['sqls'][_0x47d511];if(!_0x299291)throw CliErrors[_0x531cc3(0x1f3)](_0x531cc3(0x200)+_0x47d511+'\x22.');return{'method':_0x531cc3(0x1ff),'url':_0x531cc3(0x1e7),'body':{'sqlCode':_0x47d511,'id':_0x299291[_0x531cc3(0x1e4)],'localPath':resolveLocalSqlFilePath(_0x534852,_0x47d511,_0x299291)},'description':_0x531cc3(0x1fc)+_0x47d511+_0x531cc3(0x1ed)+_0x534852['trashDir']};},async 'execute'(_0x228293){const _0x529ec1=a237_0x176acf,_0x9d8ab6=loadSqlProjectConfig(_0x228293['appCode']),_0x2a7e34=await readSqlLockFile(_0x9d8ab6[_0x529ec1(0x1ef)]);if(!_0x2a7e34)throw CliErrors['validation'](_0x529ec1(0x203));const {lockData:_0x42f5d3,appLock:_0x178ad4}=ensureSqlLockScope(_0x2a7e34,_0x228293['appCode'],_0x9d8ab6[_0x529ec1(0x1ea)],'delete'),_0x1b6973=_0x228293[_0x529ec1(0x1e2)]('sqlcode'),_0x5c892a=_0x178ad4['sqls'][_0x1b6973];if(!_0x5c892a)throw CliErrors[_0x529ec1(0x1f3)](_0x529ec1(0x200)+_0x1b6973+'\x22.');await deleteSqlQuery({'id':_0x5c892a[_0x529ec1(0x1e4)],'sqlCode':_0x1b6973}),_0x178ad4[_0x529ec1(0x1fb)]=Object[_0x529ec1(0x1e9)](Object['entries'](_0x178ad4[_0x529ec1(0x1fb)])[_0x529ec1(0x1fd)](([_0x88995a])=>_0x88995a!==_0x1b6973)),_0x178ad4[_0x529ec1(0x1e8)]=new Date()['toISOString'](),await writeSqlLockFile(_0x9d8ab6[_0x529ec1(0x1ef)],_0x42f5d3);const _0xe4b894=resolveLocalSqlFilePath(_0x9d8ab6,_0x1b6973,_0x5c892a);let _0x15ecfe;await fileExists(_0xe4b894)&&(_0x15ecfe=await moveToTrash(_0x9d8ab6[_0x529ec1(0x1ec)],_0x9d8ab6[_0x529ec1(0x208)],_0xe4b894),await cleanupEmptyDirectories(dirname(_0xe4b894),_0x9d8ab6[_0x529ec1(0x201)]));const _0x2bae36={'deleted':_0x1b6973,'remoteId':_0x5c892a['remoteId']};if(_0x15ecfe)_0x2bae36[_0x529ec1(0x1f0)]=_0x15ecfe;return{'ok':!![],'data':_0x2bae36,'message':_0x529ec1(0x204)+_0x1b6973+(_0x15ecfe?_0x529ec1(0x1e0):'')};}};function a237_0x5687(){const _0x29b6e5=['toISOString','sqls','Would\x20delete\x20SQL\x20','filter','402260vWggfq','POST','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlRootDir','13684808AdNbiz','SQL\x20lock\x20file\x20not\x20found.','Deleted\x20','2524104Hnytgx','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','appCode','trashDir','\x20(local\x20file\x20moved\x20to\x20trash)','1590IJGpOU','str','34722BpHKjJ','remoteId','10945890UJMvHT','7610325CLGbpy','/smartapi/custom/deleteUserCustomSql','lastSync','fromEntries','sqlRoot','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','projectRoot','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','delete','lockFilePath','trashedTo','1OODzHM','3663138kqBtrH','validation','high-risk-write','replace','sqlcode','7lEJXWM','sql','length'];a237_0x5687=function(){return _0x29b6e5;};return a237_0x5687();}async function moveToTrash(_0x186a43,_0x561c93,_0xe84677){const _0x4ed2a1=a237_0x176acf,_0x2d2f6c=new Date()[_0x4ed2a1(0x1fa)]()[_0x4ed2a1(0x1f5)](/[:.]/g,'-'),_0x7e9903=relative(_0x186a43,_0xe84677),_0x3661f4=join(_0x561c93,_0x2d2f6c,_0x7e9903);return await mkdir(dirname(_0x3661f4),{'recursive':!![]}),await rename(_0xe84677,_0x3661f4),_0x3661f4;}async function cleanupEmptyDirectories(_0x1a5374,_0xa437d6){const _0x20e30d=a237_0x176acf;let _0x2e3911=resolve(_0x1a5374);const _0x21eff0=resolve(_0xa437d6);while(_0x2e3911['startsWith'](''+_0x21eff0+sep)||_0x2e3911===_0x21eff0){if(_0x2e3911===_0x21eff0)return;try{const _0x49aa7e=await readdir(_0x2e3911);if(_0x49aa7e[_0x20e30d(0x1f9)]>0x0)return;await rmdir(_0x2e3911);}catch{return;}_0x2e3911=dirname(_0x2e3911);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a238_0x1bcdcd=a238_0x15c8;(function(_0xd6a944,_0x410c4f){const _0x25d1d2=a238_0x15c8,_0x369386=_0xd6a944();while(!![]){try{const _0xad8467=parseInt(_0x25d1d2(0xa9))/0x1+-parseInt(_0x25d1d2(0xb5))/0x2+-parseInt(_0x25d1d2(0xb7))/0x3*(-parseInt(_0x25d1d2(0xaa))/0x4)+-parseInt(_0x25d1d2(0xac))/0x5+-parseInt(_0x25d1d2(0xab))/0x6+parseInt(_0x25d1d2(0xb2))/0x7+parseInt(_0x25d1d2(0xb9))/0x8*(parseInt(_0x25d1d2(0xba))/0x9);if(_0xad8467===_0x410c4f)break;else _0x369386['push'](_0x369386['shift']());}catch(_0x5123a6){_0x369386['push'](_0x369386['shift']());}}}(a238_0x287e,0x53e6f));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a238_0x15c8(_0x519523,_0x55a469){_0x519523=_0x519523-0xa9;const _0x287e3c=a238_0x287e();let _0x15c82b=_0x287e3c[_0x519523];return _0x15c82b;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a238_0x287e(){const _0x1309c0=['verbose','269947KMOGcs','1451332PXcpsE','1588680Mhtrvo','1132875uKPvdw','sqlContent','sql','description','detail','appCode','2922514XRMYBf','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','dbId','543060xrerrD','sqlCode','3dbkiRE','read','32152okOYij','126XjSOTb','boolean'];a238_0x287e=function(){return _0x1309c0;};return a238_0x287e();}export const sqlDetail={'service':a238_0x1bcdcd(0xae),'command':a238_0x1bcdcd(0xb0),'description':a238_0x1bcdcd(0xb3),'risk':a238_0x1bcdcd(0xb8),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a238_0x1bcdcd(0xbb),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x45ca98){const _0x55929d=a238_0x1bcdcd,_0x41315a=await getSqlQueryInfo(_0x45ca98[_0x55929d(0xb1)],_0x45ca98['str']('sqlcode')),_0x2e4abf=_0x45ca98['bool'](_0x55929d(0xbc));if(_0x2e4abf)return{'ok':!![],'data':_0x41315a};const _0x29cdca=_0x41315a[_0x55929d(0xb4)]?await getDbName(_0x45ca98['appCode'],_0x41315a[_0x55929d(0xb4)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x41315a[_0x55929d(0xb6)],'sqlName':_0x41315a['sqlName'],'db':_0x29cdca?_0x29cdca+'\x20('+_0x41315a[_0x55929d(0xb4)]+')':_0x41315a[_0x55929d(0xb4)]??'','description':_0x41315a[_0x55929d(0xaf)]??'','sqlContent':_0x41315a[_0x55929d(0xad)]??''}};}};
|