@lovrabet/rabetbase-cli 2.5.0 → 2.5.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/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/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.d.ts +7 -0
- 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/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/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.d.ts +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/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/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-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/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/doctor.js +1 -1
- package/lib/commands/file/index.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/service.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/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/template.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/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/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/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/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.d.ts +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-routing.d.ts +30 -0
- package/lib/config/project-routing.js +1 -0
- package/lib/config/schema.d.ts +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.d.ts +7 -2
- 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.d.ts +2 -2
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.d.ts +115 -0
- package/lib/constant/routing-profile.js +1 -0
- 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/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.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/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/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.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 -2
- package/skills/rabetbase/SKILL.md +10 -5
- package/skills/rabetbase/guides/frontend-development.md +2 -0
- package/skills/rabetbase/guides/sdk-client-generation.md +3 -2
- package/skills/rabetbase/guides/typescript-sdk.md +42 -0
- package/skills/rabetbase/references/rabetbase-api-pull.md +5 -3
- package/skills/rabetbase/references/rabetbase-config.md +9 -5
- package/skills/rabetbase/references/rabetbase-init.md +11 -5
- package/skills/rabetbase/references/rabetbase-project-create.md +6 -5
- package/skills/rabetbase.manifest.json +3 -3
- package/templates/README.md +13 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a174_0x3e71c6=a174_0x44d8;(function(_0x81752a,_0x4af760){const _0x229be5=a174_0x44d8,_0x397f9a=_0x81752a();while(!![]){try{const _0x1072a0=parseInt(_0x229be5(0x1b7))/0x1+parseInt(_0x229be5(0x1b3))/0x2+parseInt(_0x229be5(0x1b5))/0x3+-parseInt(_0x229be5(0x1bb))/0x4*(-parseInt(_0x229be5(0x1b4))/0x5)+parseInt(_0x229be5(0x1c6))/0x6*(-parseInt(_0x229be5(0x1c7))/0x7)+-parseInt(_0x229be5(0x1c9))/0x8*(-parseInt(_0x229be5(0x1ba))/0x9)+-parseInt(_0x229be5(0x1bf))/0xa;if(_0x1072a0===_0x4af760)break;else _0x397f9a['push'](_0x397f9a['shift']());}catch(_0xd6d130){_0x397f9a['push'](_0x397f9a['shift']());}}}(a174_0x5bdf,0x40d73));import{deleteAppRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a174_0x5bdf(){const _0x29ef6d=['24LGQzkR','43967Fxthdp','high-risk-write','143176rhxhkf','Role\x20still\x20has\x20','994456UiYxxP','105XIjmKM','959268cmGrJz','POST','213410FlwfTo','\x20(id=','role','180TXoXvn','55464VHrMgY','delete','Deleted\x20role\x20','roleName','13888090oRKYIz','num','dev','userCount','\x20member(s);\x20they\x20will\x20lose\x20this\x20group.','appCode','/smartapi/permit/role/delete'];a174_0x5bdf=function(){return _0x29ef6d;};return a174_0x5bdf();}import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';const DELETE_PATH=a174_0x3e71c6(0x1c5);function a174_0x44d8(_0x158d0e,_0x43be1f){_0x158d0e=_0x158d0e-0x1b2;const _0x5bdf16=a174_0x5bdf();let _0x44d807=_0x5bdf16[_0x158d0e];return _0x44d807;}export const roleDelete={'service':a174_0x3e71c6(0x1b9),'command':a174_0x3e71c6(0x1bc),'description':'Delete\x20a\x20CUSTOM\x20role\x20(built-in\x20roles\x20rejected);\x20requires\x20--yes','risk':a174_0x3e71c6(0x1c8),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x10589b){const _0x4aa50e=a174_0x3e71c6,_0x1231a6=_0x10589b[_0x4aa50e(0x1c0)]('id'),_0x169086=await getRoleById(_0x10589b[_0x4aa50e(0x1c4)],_0x1231a6);return assertCustomRole(_0x169086,_0x4aa50e(0x1bc)),asDryRunResult({'scope':'dev','operation':_0x4aa50e(0x1bc),'selector':{'appCode':_0x10589b[_0x4aa50e(0x1c4)],'roleId':_0x1231a6,'roleName':_0x169086[_0x4aa50e(0x1be)]},'before':projectRole(_0x169086),'after':null,'dryRun':!![],'backend':{'method':_0x4aa50e(0x1b6),'path':DELETE_PATH},'warnings':_0x169086[_0x4aa50e(0x1c2)]>0x0?[_0x4aa50e(0x1b2)+_0x169086[_0x4aa50e(0x1c2)]+_0x4aa50e(0x1c3)]:[]},{'method':'POST','url':DELETE_PATH});},async 'execute'(_0x4a5c55){const _0x56b17a=a174_0x3e71c6,_0x585129=_0x4a5c55[_0x56b17a(0x1c0)]('id'),_0x1d7f28=await getRoleById(_0x4a5c55[_0x56b17a(0x1c4)],_0x585129);return assertCustomRole(_0x1d7f28,'delete'),await deleteAppRole(_0x585129),{'ok':!![],'data':{'scope':_0x56b17a(0x1c1),'operation':_0x56b17a(0x1bc),'selector':{'appCode':_0x4a5c55[_0x56b17a(0x1c4)],'roleId':_0x585129,'roleName':_0x1d7f28[_0x56b17a(0x1be)]},'before':projectRole(_0x1d7f28),'after':null,'dryRun':![],'backend':{'method':_0x56b17a(0x1b6),'path':DELETE_PATH},'warnings':[]},'message':_0x56b17a(0x1bd)+_0x1d7f28[_0x56b17a(0x1be)]+_0x56b17a(0x1b8)+_0x585129+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a175_0x59647d=a175_0x5797;function a175_0x5797(_0x538d1d,_0x556bee){_0x538d1d=_0x538d1d-0xe4;const _0x54b98c=a175_0x54b9();let _0x579720=_0x54b98c[_0x538d1d];return _0x579720;}(function(_0xd746d8,_0xde539d){const _0x37d781=a175_0x5797,_0x2e25ae=_0xd746d8();while(!![]){try{const _0x4a2aad=-parseInt(_0x37d781(0xeb))/0x1*(-parseInt(_0x37d781(0xee))/0x2)+parseInt(_0x37d781(0xf0))/0x3+-parseInt(_0x37d781(0xf2))/0x4+-parseInt(_0x37d781(0xe6))/0x5+-parseInt(_0x37d781(0xe9))/0x6*(parseInt(_0x37d781(0xec))/0x7)+-parseInt(_0x37d781(0xe7))/0x8+parseInt(_0x37d781(0xed))/0x9;if(_0x4a2aad===_0xde539d)break;else _0x2e25ae['push'](_0x2e25ae['shift']());}catch(_0x1a4868){_0x2e25ae['push'](_0x2e25ae['shift']());}}}(a175_0x54b9,0x4d330));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';function a175_0x54b9(){const _0x425da6=['Role\x20','1028478zJuxvP','role','60502LTfPzF','7GkfeNi','12085920oDVTOJ','4mgPeXD','detail','979398WasWHw','Show\x20a\x20single\x20role\x27s\x20detail','1987624mznVvL','roleName','read','roleType','2551965mSQfwJ','2363440OSqKCR'];a175_0x54b9=function(){return _0x425da6;};return a175_0x54b9();}export const roleDetail={'service':a175_0x59647d(0xea),'command':a175_0x59647d(0xef),'description':a175_0x59647d(0xf1),'risk':a175_0x59647d(0xe4),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x9458b0){const _0x35f662=a175_0x59647d,_0x5aec30=_0x9458b0['num']('id'),_0x2109e4=await getRoleById(_0x9458b0['appCode'],_0x5aec30);return{'ok':!![],'data':{'scope':'dev','role':projectRole(_0x2109e4)},'message':_0x35f662(0xe8)+_0x2109e4[_0x35f662(0xf3)]+'\x20('+_0x2109e4[_0x35f662(0xe5)]+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x51537f,_0x102e0e){const _0x31ffdd=a176_0x40fb,_0xd3ea49=_0x51537f();while(!![]){try{const _0x314445=parseInt(_0x31ffdd(0xb1))/0x1+-parseInt(_0x31ffdd(0xb3))/0x2+parseInt(_0x31ffdd(0xb2))/0x3+-parseInt(_0x31ffdd(0xb4))/0x4*(parseInt(_0x31ffdd(0xb5))/0x5)+parseInt(_0x31ffdd(0xb7))/0x6+-parseInt(_0x31ffdd(0xb8))/0x7+-parseInt(_0x31ffdd(0xb6))/0x8;if(_0x314445===_0x102e0e)break;else _0xd3ea49['push'](_0xd3ea49['shift']());}catch(_0x462566){_0xd3ea49['push'](_0xd3ea49['shift']());}}}(a176_0x1a4f,0x7e0d6));function a176_0x1a4f(){const _0x4c8c91=['1579504xidanB','4yGhpii','580205BUyOvy','6933080hGoeTD','3061044ZAPVGV','134918flntaM','958767pRaIYC','2517213LjhUYP'];a176_0x1a4f=function(){return _0x4c8c91;};return a176_0x1a4f();}import{roleList}from'../../commands/role/list.js';import{roleDetail}from'../../commands/role/detail.js';import{roleUpdate}from'../../commands/role/update.js';import{roleDelete}from'../../commands/role/delete.js';import{roleUserResolve}from'../../commands/role/user-resolve.js';function a176_0x40fb(_0x492932,_0x3d1863){_0x492932=_0x492932-0xb1;const _0x1a4f48=a176_0x1a4f();let _0x40fb27=_0x1a4f48[_0x492932];return _0x40fb27;}import{roleUserAdd}from'../../commands/role/user-add.js';import{roleUserRemove}from'../../commands/role/user-remove.js';export const roleDefinitions=[roleList,roleDetail,roleUpdate,roleDelete,roleUserResolve,roleUserAdd,roleUserRemove];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a177_0x18e284=a177_0x4cdc;function a177_0x4cdc(_0xf7afeb,_0x50667b){_0xf7afeb=_0xf7afeb-0x142;const _0x4160af=a177_0x4160();let _0x4cdc1e=_0x4160af[_0xf7afeb];return _0x4cdc1e;}(function(_0x5ceb03,_0x566e60){const _0x544c15=a177_0x4cdc,_0x5ec117=_0x5ceb03();while(!![]){try{const _0x36ad73=parseInt(_0x544c15(0x162))/0x1*(parseInt(_0x544c15(0x15e))/0x2)+-parseInt(_0x544c15(0x144))/0x3+parseInt(_0x544c15(0x142))/0x4+parseInt(_0x544c15(0x163))/0x5+parseInt(_0x544c15(0x155))/0x6+parseInt(_0x544c15(0x146))/0x7+-parseInt(_0x544c15(0x157))/0x8*(parseInt(_0x544c15(0x151))/0x9);if(_0x36ad73===_0x566e60)break;else _0x5ec117['push'](_0x5ec117['shift']());}catch(_0x14b2c9){_0x5ec117['push'](_0x5ec117['shift']());}}}(a177_0x4160,0x28043));function a177_0x4160(){const _0x479cb8=['226962qRPuQT','num','19144ReORPj','number','string','map','trim','Filter\x20by\x20role\x20type','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','2FWoIym','--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.','\x20role(s)','length','164207rfqHzf','1485385sEBdbs','roleType','toUpperCase','Page\x20size\x20(1-100)','type','852376HPIwUP','includes','821271Ubzihb','appCode','373100oovkxz','Found\x20','join','validation','dev','str','page','role','Invalid\x20--type\x20\x22','pagesize','Page\x20index\x20(1-based)','1233NCDHxX','filter','list','Use\x20one\x20of:\x20'];a177_0x4160=function(){return _0x479cb8;};return a177_0x4160();}import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=['ADMIN','DEV','OWNER','CUSTOM'];export const roleList={'service':a177_0x18e284(0x14d),'command':a177_0x18e284(0x153),'description':a177_0x18e284(0x15d),'risk':'read','flags':[APPCODE_FLAG_OPTIONAL,{'name':a177_0x18e284(0x167),'type':a177_0x18e284(0x159),'required':![],'description':a177_0x18e284(0x15c),'enum':ROLE_TYPES},{'name':a177_0x18e284(0x14c),'type':'number','description':a177_0x18e284(0x150),'default':0x1},{'name':'pagesize','type':a177_0x18e284(0x158),'description':a177_0x18e284(0x166),'default':0x64}],async 'validate'(_0xabcd09){const _0x44ee5a=a177_0x18e284,_0x422c2f=_0xabcd09['str'](_0x44ee5a(0x167))[_0x44ee5a(0x15b)]();if(_0x422c2f&&!ROLE_TYPES[_0x44ee5a(0x143)](_0x422c2f['toUpperCase']()))throw CliErrors[_0x44ee5a(0x149)](_0x44ee5a(0x14e)+_0x422c2f+'\x22.',_0x44ee5a(0x154)+ROLE_TYPES[_0x44ee5a(0x148)](',\x20')+'.');const _0x407d99=_0xabcd09[_0x44ee5a(0x156)](_0x44ee5a(0x14c),0x1),_0x26f880=_0xabcd09['num'](_0x44ee5a(0x14f),0x64);if(_0x407d99<0x1)throw CliErrors['validation'](_0x44ee5a(0x15f));if(_0x26f880<0x1||_0x26f880>0x64)throw CliErrors[_0x44ee5a(0x149)]('--pagesize\x20must\x20be\x20between\x201\x20and\x20100.');},async 'execute'(_0x40de5e){const _0x18cc11=a177_0x18e284,_0x12f487=_0x40de5e[_0x18cc11(0x156)](_0x18cc11(0x14c),0x1)||0x1,_0x54d534=_0x40de5e[_0x18cc11(0x156)]('pagesize',0x64)||0x64,_0x47c5fa=_0x40de5e[_0x18cc11(0x14b)]('type')[_0x18cc11(0x15b)]()[_0x18cc11(0x165)](),{items:_0x56b929,paging:_0x21abcc}=await listAppRoles(_0x40de5e[_0x18cc11(0x145)],{'currentPage':_0x12f487,'pageSize':_0x54d534}),_0x34ed78=_0x47c5fa?_0x56b929[_0x18cc11(0x152)](_0x40c8b1=>_0x40c8b1[_0x18cc11(0x164)]===_0x47c5fa):_0x56b929,_0x388be4=_0x34ed78[_0x18cc11(0x15a)](projectRole);return{'ok':!![],'data':{'scope':_0x18cc11(0x14a),'roles':_0x388be4,'paging':_0x21abcc},'message':_0x18cc11(0x147)+_0x388be4[_0x18cc11(0x161)]+_0x18cc11(0x160)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a178_0x1bf84c=a178_0x1c5d;(function(_0x555d14,_0x3e5b74){const _0x4f744b=a178_0x1c5d,_0x377e63=_0x555d14();while(!![]){try{const _0x30da00=parseInt(_0x4f744b(0x188))/0x1*(-parseInt(_0x4f744b(0x160))/0x2)+parseInt(_0x4f744b(0x185))/0x3+parseInt(_0x4f744b(0x17d))/0x4+parseInt(_0x4f744b(0x15c))/0x5*(parseInt(_0x4f744b(0x16b))/0x6)+parseInt(_0x4f744b(0x157))/0x7+parseInt(_0x4f744b(0x167))/0x8+-parseInt(_0x4f744b(0x178))/0x9;if(_0x30da00===_0x3e5b74)break;else _0x377e63['push'](_0x377e63['shift']());}catch(_0x4afdd0){_0x377e63['push'](_0x377e63['shift']());}}}(a178_0x5236,0xde3dd));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';function a178_0x5236(){const _0x155656=['Role\x20id\x20','\x20members\x20of\x20the\x20OWNER\x20role.','Optional\x20role\x20remark/description','flagMissing','User\x20','number','Missing\x20role\x20reference.','Anti-drift\x20check\x20failed:\x20expected\x20','str','trim','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','totalCount',';\x20no\x20change.','filter','\x20is\x20not\x20a\x20member\x20of\x20role\x20','592172SbRnjs','\x20not\x20found\x20in\x20app\x20','\x22\x20is\x20ambiguous\x20(ids:\x20','toLowerCase','expect-user-count','4110515JJQOgP','validation','nickname','CUSTOM','1532956meFUTj','Missing\x20user\x20reference.','find','Check\x20the\x20nickname/username.\x20','user-add','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','13785584DGDUIL','ADMIN','roleType','\x20duplicate\x20memberships\x20for\x20user\x20','12mRqyGf','name','push','Cannot\x20','Disambiguate\x20with\x20--role\x20<id>.','tenant_code','Role\x20id\x20(from\x20`role\x20list`)','\x20member(s)\x20but\x20role\x20has\x20','string','role','/smartapi/permit/user-role/create','permitCount','Pass\x20--role\x20<id|name>.','24434721yTHXBb','expectUserCount','Role\x20id\x20or\x20exact\x20role\x20name','userId','Pass\x20--user\x20<id|name>.','3660656JYqbsU','authRequired','user','OWNER','includes','dryRun','map','flag','2373186SVgcgr','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Pass\x20--user\x20<id>.','2DHrQNC','userCount','tenant','username','appCode','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Role\x20name\x20\x22','roleName','remark','test','length','/smartapi/permit/user-role/delete'];a178_0x5236=function(){return _0x155656;};return a178_0x5236();}export const ROLE_ID_FLAG={'name':'id','type':a178_0x1bf84c(0x14c),'required':!![],'description':a178_0x1bf84c(0x171)};export const ROLE_REF_FLAG={'name':'role','type':'string','required':!![],'description':a178_0x1bf84c(0x17a)};export const USER_REF_FLAG={'name':'user','type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a178_0x1bf84c(0x16c),'type':a178_0x1bf84c(0x173),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a178_0x1bf84c(0x16c),'type':a178_0x1bf84c(0x173),'required':!![],'description':a178_0x1bf84c(0x186)};export const REMARK_FLAG={'name':a178_0x1bf84c(0x143),'type':'string','required':![],'description':a178_0x1bf84c(0x149)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a178_0x1bf84c(0x14c),'required':![],'description':a178_0x1bf84c(0x165)};export const BUILTIN_ROLE_TYPES=[a178_0x1bf84c(0x168),'DEV','OWNER'];export function isBuiltinRole(_0x3d5fe2){const _0x516e9b=a178_0x1bf84c;return BUILTIN_ROLE_TYPES[_0x516e9b(0x181)](_0x3d5fe2);}export function assertCustomRole(_0x749aa7,_0x2c2b29){const _0xcf551f=a178_0x1bf84c;if(_0x749aa7[_0xcf551f(0x169)]!==_0xcf551f(0x15f))throw CliErrors[_0xcf551f(0x15d)]('Cannot\x20'+_0x2c2b29+'\x20built-in\x20role\x20'+_0x749aa7['roleName']+'\x20('+_0x749aa7['roleType']+').',_0xcf551f(0x18d));}export function projectRole(_0x1b0b34){const _0x3f5373=a178_0x1bf84c;return{'id':_0x1b0b34['id'],'roleName':_0x1b0b34[_0x3f5373(0x142)],'roleType':_0x1b0b34['roleType'],'remark':_0x1b0b34[_0x3f5373(0x143)],'userCount':_0x1b0b34[_0x3f5373(0x189)],'permitCount':_0x1b0b34[_0x3f5373(0x176)],'builtin':isBuiltinRole(_0x1b0b34[_0x3f5373(0x169)])};}export async function resolveRoleRef(_0x348cd8,_0x51190b){const _0x1f613a=a178_0x1bf84c,_0xeb4715=_0x51190b[_0x1f613a(0x150)]();if(!_0xeb4715)throw CliErrors['validation'](_0x1f613a(0x14d),_0x1f613a(0x177));if(/^\d+$/[_0x1f613a(0x144)](_0xeb4715))return getRoleById(_0x348cd8,Number(_0xeb4715));const _0x3ec2d7=await listAllAppRoles(_0x348cd8),_0x1086fb=_0x3ec2d7[_0x1f613a(0x155)](_0x5196d2=>_0x5196d2[_0x1f613a(0x142)]===_0xeb4715);if(_0x1086fb['length']===0x0)throw CliErrors[_0x1f613a(0x15d)](_0x1f613a(0x141)+_0xeb4715+'\x22\x20not\x20found\x20in\x20app\x20'+_0x348cd8+'.',_0x1f613a(0x152));if(_0x1086fb[_0x1f613a(0x145)]>0x1){const _0x10af14=_0x1086fb[_0x1f613a(0x183)](_0x2f8573=>_0x2f8573['id'])['join'](',\x20');throw CliErrors[_0x1f613a(0x15d)]('Role\x20name\x20\x22'+_0xeb4715+_0x1f613a(0x159)+_0x10af14+').',_0x1f613a(0x16f));}return _0x1086fb[0x0];}export async function getRoleById(_0x4704ac,_0x4ef812){const _0x49c92a=a178_0x1bf84c,_0x1b94bd=await listAllAppRoles(_0x4704ac),_0x1d9128=_0x1b94bd['filter'](_0xcd5507=>_0xcd5507['id']===_0x4ef812&&(!_0xcd5507[_0x49c92a(0x18c)]||_0xcd5507[_0x49c92a(0x18c)]===_0x4704ac));if(_0x1d9128[_0x49c92a(0x145)]!==0x1)throw CliErrors[_0x49c92a(0x15d)](_0x49c92a(0x147)+_0x4ef812+_0x49c92a(0x158)+_0x4704ac+'.',_0x49c92a(0x166));return _0x1d9128[0x0];}async function listAllAppRoles(_0x57151f){const _0x3deaf6=a178_0x1bf84c,_0x2bfc2e=0x64,_0x2b667f=[];for(let _0x9f84fb=0x1;;_0x9f84fb+=0x1){const {items:_0x5d1af2,paging:_0x5924a2}=await listAppRoles(_0x57151f,{'currentPage':_0x9f84fb,'pageSize':_0x2bfc2e});_0x2b667f[_0x3deaf6(0x16d)](..._0x5d1af2);if(_0x5d1af2[_0x3deaf6(0x145)]<_0x2bfc2e||_0x5924a2&&_0x2b667f[_0x3deaf6(0x145)]>=_0x5924a2[_0x3deaf6(0x153)])return _0x2b667f;}}export async function resolveTenantCode(){const _0x2c9566=a178_0x1bf84c,_0x38e360=await getSessionUserInfo(),_0x443903=_0x38e360?.[_0x2c9566(0x17f)]?.[_0x2c9566(0x18a)]?.[_0x2c9566(0x170)];if(!_0x443903)throw CliErrors[_0x2c9566(0x17e)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x443903;}function a178_0x1c5d(_0x497bd2,_0x6f48fe){_0x497bd2=_0x497bd2-0x141;const _0x5236cc=a178_0x5236();let _0x1c5db1=_0x5236cc[_0x497bd2];return _0x1c5db1;}function matchMember(_0x4e176c,_0x300b28){const _0x41e5ba=a178_0x1bf84c,_0x7c3098=_0x300b28['trim']()[_0x41e5ba(0x15a)]();return(_0x4e176c[_0x41e5ba(0x15e)]??'')[_0x41e5ba(0x15a)]()===_0x7c3098||(_0x4e176c[_0x41e5ba(0x18b)]??'')['toLowerCase']()===_0x7c3098;}export async function resolveUserRef(_0x2eab44,_0x3474c5=a178_0x1bf84c(0x187)){const _0x1eb35b=a178_0x1bf84c,_0x1bfd4f=_0x2eab44['trim']();if(!_0x1bfd4f)throw CliErrors['validation'](_0x1eb35b(0x161),'Pass\x20--user\x20<id|name>.');const _0x3a0ee4=await resolveTenantCode(),_0x2272c6=await getTenantMembers(_0x3a0ee4);if(/^\d+$/[_0x1eb35b(0x144)](_0x1bfd4f)){const _0x36d6b5=Number(_0x1bfd4f),_0x1d05a7=_0x2272c6[_0x1eb35b(0x162)](_0x15ae4b=>_0x15ae4b[_0x1eb35b(0x17b)]===_0x36d6b5);return{'userId':_0x36d6b5,'username':_0x1d05a7?.[_0x1eb35b(0x18b)]??String(_0x36d6b5),'nickname':_0x1d05a7?.[_0x1eb35b(0x15e)],'matchedBy':'id'};}const _0x1357eb=_0x2272c6[_0x1eb35b(0x155)](_0x2333b2=>matchMember(_0x2333b2,_0x1bfd4f));if(_0x1357eb[_0x1eb35b(0x145)]===0x0)throw CliErrors[_0x1eb35b(0x15d)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x1bfd4f+'\x22.',_0x1eb35b(0x163)+_0x3474c5);if(_0x1357eb[_0x1eb35b(0x145)]>0x1){const _0x26d64e=_0x1357eb[_0x1eb35b(0x183)](_0x388ef1=>(_0x388ef1[_0x1eb35b(0x15e)]??_0x388ef1[_0x1eb35b(0x18b)]??'?')+'('+_0x388ef1['userId']+')')['join'](',\x20');throw CliErrors[_0x1eb35b(0x15d)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x1bfd4f+'\x22:\x20'+_0x26d64e+'.',_0x3474c5);}const _0x216489=_0x1357eb[0x0];return{'userId':_0x216489['userId'],'username':_0x216489[_0x1eb35b(0x18b)]??String(_0x216489[_0x1eb35b(0x17b)]),'nickname':_0x216489[_0x1eb35b(0x15e)],'matchedBy':_0x1eb35b(0x16c)};}export const CREATE_USER_ROLE_PATH=a178_0x1bf84c(0x175);export const DELETE_USER_ROLE_PATH=a178_0x1bf84c(0x146);export function computeRoleUserMutation(_0x3300ed){const _0x1d090b=a178_0x1bf84c,{operation:_0x4d977b,appCode:_0x2d6b92,role:_0x112f95,relations:_0x237d4b,user:_0x2c697a}=_0x3300ed,_0x4598c5=[...new Set(_0x237d4b[_0x1d090b(0x183)](_0x419afe=>_0x419afe[_0x1d090b(0x17b)]))],_0x36192d=[];if(_0x3300ed[_0x1d090b(0x179)]!==undefined&&_0x3300ed[_0x1d090b(0x179)]!==_0x4598c5['length'])throw CliErrors[_0x1d090b(0x15d)](_0x1d090b(0x14e)+_0x3300ed[_0x1d090b(0x179)]+_0x1d090b(0x172)+_0x4598c5[_0x1d090b(0x145)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x9cbea=_0x4598c5[_0x1d090b(0x181)](_0x2c697a[_0x1d090b(0x17b)]),_0x3b7c75=_0x237d4b[_0x1d090b(0x155)](_0x3992c9=>_0x3992c9[_0x1d090b(0x17b)]===_0x2c697a[_0x1d090b(0x17b)])['map'](_0xea21f3=>_0xea21f3['id']),_0x5b2ee0=_0x4d977b===_0x1d090b(0x164)?!_0x9cbea:_0x9cbea;let _0x164d4c=_0x4598c5;_0x4d977b===_0x1d090b(0x164)?_0x9cbea?_0x36192d[_0x1d090b(0x16d)]('User\x20'+_0x2c697a['userId']+_0x1d090b(0x151)+_0x112f95[_0x1d090b(0x142)]+_0x1d090b(0x154)):_0x164d4c=[..._0x4598c5,_0x2c697a[_0x1d090b(0x17b)]]:!_0x9cbea?_0x36192d[_0x1d090b(0x16d)](_0x1d090b(0x14b)+_0x2c697a[_0x1d090b(0x17b)]+_0x1d090b(0x156)+_0x112f95[_0x1d090b(0x142)]+_0x1d090b(0x154)):(_0x164d4c=_0x4598c5['filter'](_0x41b886=>_0x41b886!==_0x2c697a[_0x1d090b(0x17b)]),_0x3b7c75[_0x1d090b(0x145)]>0x1&&_0x36192d[_0x1d090b(0x16d)]('Removed\x20'+_0x3b7c75[_0x1d090b(0x145)]+_0x1d090b(0x16a)+_0x2c697a['userId']+'.'));const _0x5436ef={'scope':'dev','operation':_0x4d977b,'selector':{'appCode':_0x2d6b92,'roleId':_0x112f95['id'],'roleName':_0x112f95['roleName'],'userId':_0x2c697a[_0x1d090b(0x17b)]},'before':{'userIds':_0x4598c5},'after':{'userIds':_0x164d4c},'dryRun':_0x3300ed[_0x1d090b(0x182)],'backend':{'method':'POST','path':_0x4d977b===_0x1d090b(0x164)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x36192d};return{'mutation':_0x5436ef,'changed':_0x5b2ee0,'matchingRelationIds':_0x3b7c75};}export async function loadDevRoleRelations(_0x4af39a,_0x549706){const _0x48696b=a178_0x1bf84c,_0x523797=0x64,_0x25c6ed=[];for(let _0x648f0e=0x1;;_0x648f0e+=0x1){const {items:_0x1df40b,paging:_0x537c45}=await listDevUserRoleRelations(_0x4af39a,{'roleId':_0x549706,'currentPage':_0x648f0e,'pageSize':_0x523797});_0x25c6ed[_0x48696b(0x16d)](..._0x1df40b);if(_0x1df40b[_0x48696b(0x145)]<_0x523797||_0x537c45&&_0x25c6ed['length']>=_0x537c45[_0x48696b(0x153)])return _0x25c6ed;}}export function readRoleRef(_0x683bcb){const _0x556505=a178_0x1bf84c,_0x847bfe=_0x683bcb[_0x556505(0x14f)](_0x556505(0x174))[_0x556505(0x150)]();if(!_0x847bfe)throw CliErrors[_0x556505(0x14a)](_0x556505(0x174),_0x556505(0x177));return _0x847bfe;}export async function prepareUserMutation(_0x292442,_0x261321,_0x26f083){const _0x53bf73=a178_0x1bf84c,_0x474bad=readRoleRef(_0x292442),_0x1c8d70=_0x292442[_0x53bf73(0x14f)](_0x53bf73(0x17f))[_0x53bf73(0x150)]();if(!_0x1c8d70)throw CliErrors[_0x53bf73(0x14a)]('user',_0x53bf73(0x17c));const _0x1d4645=_0x292442[_0x53bf73(0x184)](_0x53bf73(0x15b)),_0xf2d283=_0x1d4645===undefined||_0x1d4645===null?undefined:Number(_0x1d4645),_0x132f81=await resolveRoleRef(_0x292442[_0x53bf73(0x18c)],_0x474bad);if(_0x132f81['roleType']===_0x53bf73(0x180))throw CliErrors[_0x53bf73(0x15d)](_0x53bf73(0x16e)+_0x261321+_0x53bf73(0x148),'Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x4df3c2=await resolveUserRef(_0x1c8d70),_0x4569d1=await loadDevRoleRelations(_0x292442[_0x53bf73(0x18c)],_0x132f81['id']);return{...computeRoleUserMutation({'operation':_0x261321,'appCode':_0x292442[_0x53bf73(0x18c)],'role':_0x132f81,'relations':_0x4569d1,'user':{'userId':_0x4df3c2['userId'],'username':_0x4df3c2[_0x53bf73(0x18b)],'nickname':_0x4df3c2[_0x53bf73(0x15e)]},'dryRun':_0x26f083,..._0xf2d283!==undefined?{'expectUserCount':_0xf2d283}:{}}),'role':_0x132f81,'user':_0x4df3c2};}
|
|
1
|
+
const a178_0x44357d=a178_0x2a25;function a178_0x30ab(){const _0x1869db=['Role\x20id\x20or\x20exact\x20role\x20name','join','Pass\x20--user\x20<id|name>.','\x20members\x20of\x20the\x20OWNER\x20role.','str','push','flagMissing','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Optional\x20role\x20remark/description','nickname','/smartapi/permit/user-role/delete','username','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','dryRun','OWNER','expect-user-count','length','4WpKgFI','2905413QUsJns','\x22\x20is\x20ambiguous\x20(ids:\x20','Pass\x20--user\x20<id>.','tenant_code','\x22:\x20','trim','61CNvnoE','roleName','authRequired','\x20not\x20found\x20in\x20app\x20','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','ADMIN','number','role','expectUserCount','permitCount','roleType','3703740WHcpgA','flag','Role\x20name\x20\x22','totalCount','Check\x20the\x20nickname/username.\x20','POST','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','3569330HtIUro','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','1927096DkvNrR','User\x20','filter','Missing\x20role\x20reference.','validation','tenant','map','11XdAvFy','user-add','\x20member(s)\x20but\x20role\x20has\x20','includes','\x22\x20not\x20found\x20in\x20app\x20','Role\x20id\x20','9bztWJw','\x20is\x20not\x20a\x20member\x20of\x20role\x20','find','toLowerCase','dev','18586jBFsyL','\x20built-in\x20role\x20','user','appCode','string','2038794MFBeBn','Role\x20id\x20(from\x20`role\x20list`)','CUSTOM','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Disambiguate\x20with\x20--role\x20<id>.','test','Pass\x20--role\x20<id|name>.','No\x20tenant\x20member\x20matches\x20\x22','Removed\x20','4348125LtXsfp','Cannot\x20','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Multiple\x20tenant\x20members\x20match\x20\x22','/smartapi/permit/user-role/create',';\x20no\x20change.','name','userId','remark'];a178_0x30ab=function(){return _0x1869db;};return a178_0x30ab();}(function(_0x57f174,_0xbab1dc){const _0x316054=a178_0x2a25,_0x49db7d=_0x57f174();while(!![]){try{const _0x3ed1cf=parseInt(_0x316054(0x1fa))/0x1*(parseInt(_0x316054(0x1ca))/0x2)+parseInt(_0x316054(0x1cf))/0x3*(-parseInt(_0x316054(0x1f3))/0x4)+parseInt(_0x316054(0x1d9))/0x5+-parseInt(_0x316054(0x205))/0x6+parseInt(_0x316054(0x1f4))/0x7+-parseInt(_0x316054(0x20e))/0x8*(-parseInt(_0x316054(0x1c5))/0x9)+-parseInt(_0x316054(0x20c))/0xa*(parseInt(_0x316054(0x215))/0xb);if(_0x3ed1cf===_0xbab1dc)break;else _0x49db7d['push'](_0x49db7d['shift']());}catch(_0x5cf290){_0x49db7d['push'](_0x49db7d['shift']());}}}(a178_0x30ab,0x6b15f));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':a178_0x44357d(0x200),'required':!![],'description':a178_0x44357d(0x1d0)};export const ROLE_REF_FLAG={'name':a178_0x44357d(0x201),'type':a178_0x44357d(0x1ce),'required':!![],'description':a178_0x44357d(0x1e2)};export const USER_REF_FLAG={'name':a178_0x44357d(0x1cc),'type':a178_0x44357d(0x1ce),'required':!![],'description':a178_0x44357d(0x1ee)};export const NAME_FLAG={'name':'name','type':a178_0x44357d(0x1ce),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a178_0x44357d(0x1df),'type':a178_0x44357d(0x1ce),'required':!![],'description':a178_0x44357d(0x20d)};export const REMARK_FLAG={'name':a178_0x44357d(0x1e1),'type':a178_0x44357d(0x1ce),'required':![],'description':a178_0x44357d(0x1ea)};function a178_0x2a25(_0x28314c,_0x292062){_0x28314c=_0x28314c-0x1c0;const _0x30ab2a=a178_0x30ab();let _0x2a256a=_0x30ab2a[_0x28314c];return _0x2a256a;}export const EXPECT_USER_COUNT_FLAG={'name':a178_0x44357d(0x1f1),'type':a178_0x44357d(0x200),'required':![],'description':a178_0x44357d(0x1d2)};export const BUILTIN_ROLE_TYPES=[a178_0x44357d(0x1ff),'DEV',a178_0x44357d(0x1f0)];export function isBuiltinRole(_0x3b4a13){const _0xbce2bd=a178_0x44357d;return BUILTIN_ROLE_TYPES[_0xbce2bd(0x1c2)](_0x3b4a13);}export function assertCustomRole(_0x666b25,_0x40b89d){const _0x3d0636=a178_0x44357d;if(_0x666b25['roleType']!==_0x3d0636(0x1d1))throw CliErrors[_0x3d0636(0x212)](_0x3d0636(0x1da)+_0x40b89d+_0x3d0636(0x1cb)+_0x666b25[_0x3d0636(0x1fb)]+'\x20('+_0x666b25['roleType']+').',_0x3d0636(0x1e9));}export function projectRole(_0x5c3ed2){const _0x5bb258=a178_0x44357d;return{'id':_0x5c3ed2['id'],'roleName':_0x5c3ed2[_0x5bb258(0x1fb)],'roleType':_0x5c3ed2[_0x5bb258(0x204)],'remark':_0x5c3ed2['remark'],'userCount':_0x5c3ed2['userCount'],'permitCount':_0x5c3ed2[_0x5bb258(0x203)],'builtin':isBuiltinRole(_0x5c3ed2['roleType'])};}export async function resolveRoleRef(_0x292290,_0x2c0b2e){const _0x702157=a178_0x44357d,_0x46bd2d=_0x2c0b2e[_0x702157(0x1f9)]();if(!_0x46bd2d)throw CliErrors['validation'](_0x702157(0x211),_0x702157(0x1d6));if(/^\d+$/[_0x702157(0x1d5)](_0x46bd2d))return getRoleById(_0x292290,Number(_0x46bd2d));const _0x2349a4=await listAllAppRoles(_0x292290),_0x46dbc6=_0x2349a4['filter'](_0x357ae1=>_0x357ae1[_0x702157(0x1fb)]===_0x46bd2d);if(_0x46dbc6['length']===0x0)throw CliErrors[_0x702157(0x212)](_0x702157(0x207)+_0x46bd2d+_0x702157(0x1c3)+_0x292290+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x46dbc6[_0x702157(0x1f2)]>0x1){const _0x1b8d69=_0x46dbc6[_0x702157(0x214)](_0x28c99e=>_0x28c99e['id'])[_0x702157(0x1e3)](',\x20');throw CliErrors[_0x702157(0x212)](_0x702157(0x207)+_0x46bd2d+_0x702157(0x1f5)+_0x1b8d69+').',_0x702157(0x1d4));}return _0x46dbc6[0x0];}export async function getRoleById(_0x35e389,_0xa8feda){const _0xa95bf1=a178_0x44357d,_0x4380fe=await listAllAppRoles(_0x35e389),_0x5d29ef=_0x4380fe[_0xa95bf1(0x210)](_0x9d9fc2=>_0x9d9fc2['id']===_0xa8feda&&(!_0x9d9fc2[_0xa95bf1(0x1cd)]||_0x9d9fc2['appCode']===_0x35e389));if(_0x5d29ef[_0xa95bf1(0x1f2)]!==0x1)throw CliErrors[_0xa95bf1(0x212)](_0xa95bf1(0x1c4)+_0xa8feda+_0xa95bf1(0x1fd)+_0x35e389+'.',_0xa95bf1(0x1d3));return _0x5d29ef[0x0];}async function listAllAppRoles(_0x200d85){const _0xff6949=a178_0x44357d,_0x34a034=0x64,_0x25ad33=[];for(let _0x36bef5=0x1;;_0x36bef5+=0x1){const {items:_0x1402d3,paging:_0x38bfd1}=await listAppRoles(_0x200d85,{'currentPage':_0x36bef5,'pageSize':_0x34a034});_0x25ad33[_0xff6949(0x1e7)](..._0x1402d3);if(_0x1402d3[_0xff6949(0x1f2)]<_0x34a034||_0x38bfd1&&_0x25ad33[_0xff6949(0x1f2)]>=_0x38bfd1[_0xff6949(0x208)])return _0x25ad33;}}export async function resolveTenantCode(){const _0x10d549=a178_0x44357d,_0x3deed7=await getSessionUserInfo(),_0x51f455=_0x3deed7?.[_0x10d549(0x1cc)]?.[_0x10d549(0x213)]?.[_0x10d549(0x1f7)];if(!_0x51f455)throw CliErrors[_0x10d549(0x1fc)](_0x10d549(0x20b));return _0x51f455;}function matchMember(_0x162f4d,_0x3aef72){const _0x51fd10=a178_0x44357d,_0x357580=_0x3aef72[_0x51fd10(0x1f9)]()[_0x51fd10(0x1c8)]();return(_0x162f4d['nickname']??'')[_0x51fd10(0x1c8)]()===_0x357580||(_0x162f4d[_0x51fd10(0x1ed)]??'')[_0x51fd10(0x1c8)]()===_0x357580;}export async function resolveUserRef(_0x2e92bf,_0x21cbba=a178_0x44357d(0x1f6)){const _0x5e7952=a178_0x44357d,_0x1b0f0d=_0x2e92bf[_0x5e7952(0x1f9)]();if(!_0x1b0f0d)throw CliErrors[_0x5e7952(0x212)]('Missing\x20user\x20reference.',_0x5e7952(0x1e4));const _0x3ed743=await resolveTenantCode(),_0x52320c=await getTenantMembers(_0x3ed743);if(/^\d+$/[_0x5e7952(0x1d5)](_0x1b0f0d)){const _0x2425ca=Number(_0x1b0f0d),_0x528991=_0x52320c[_0x5e7952(0x1c7)](_0x306be8=>_0x306be8['userId']===_0x2425ca);return{'userId':_0x2425ca,'username':_0x528991?.[_0x5e7952(0x1ed)]??String(_0x2425ca),'nickname':_0x528991?.[_0x5e7952(0x1eb)],'matchedBy':'id'};}const _0x2b5a0f=_0x52320c[_0x5e7952(0x210)](_0x5b3502=>matchMember(_0x5b3502,_0x1b0f0d));if(_0x2b5a0f[_0x5e7952(0x1f2)]===0x0)throw CliErrors[_0x5e7952(0x212)](_0x5e7952(0x1d7)+_0x1b0f0d+'\x22.',_0x5e7952(0x209)+_0x21cbba);if(_0x2b5a0f[_0x5e7952(0x1f2)]>0x1){const _0x1cfae1=_0x2b5a0f['map'](_0x403a0c=>(_0x403a0c[_0x5e7952(0x1eb)]??_0x403a0c['username']??'?')+'('+_0x403a0c[_0x5e7952(0x1e0)]+')')[_0x5e7952(0x1e3)](',\x20');throw CliErrors['validation'](_0x5e7952(0x1dc)+_0x1b0f0d+_0x5e7952(0x1f8)+_0x1cfae1+'.',_0x21cbba);}const _0x5b184b=_0x2b5a0f[0x0];return{'userId':_0x5b184b[_0x5e7952(0x1e0)],'username':_0x5b184b['username']??String(_0x5b184b[_0x5e7952(0x1e0)]),'nickname':_0x5b184b[_0x5e7952(0x1eb)],'matchedBy':_0x5e7952(0x1df)};}export const CREATE_USER_ROLE_PATH=a178_0x44357d(0x1dd);export const DELETE_USER_ROLE_PATH=a178_0x44357d(0x1ec);export function computeRoleUserMutation(_0x4b4b96){const _0x13134c=a178_0x44357d,{operation:_0x167d73,appCode:_0x508611,role:_0x164ce0,relations:_0x28ef88,user:_0x463894}=_0x4b4b96,_0x2236df=[...new Set(_0x28ef88['map'](_0x2ef87f=>_0x2ef87f['userId']))],_0xec95c=[];if(_0x4b4b96['expectUserCount']!==undefined&&_0x4b4b96[_0x13134c(0x202)]!==_0x2236df[_0x13134c(0x1f2)])throw CliErrors['validation']('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x4b4b96[_0x13134c(0x202)]+_0x13134c(0x1c1)+_0x2236df[_0x13134c(0x1f2)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x37286=_0x2236df[_0x13134c(0x1c2)](_0x463894[_0x13134c(0x1e0)]),_0x3b5f29=_0x28ef88[_0x13134c(0x210)](_0x3e3049=>_0x3e3049[_0x13134c(0x1e0)]===_0x463894[_0x13134c(0x1e0)])[_0x13134c(0x214)](_0x2dac95=>_0x2dac95['id']),_0x1dc3c3=_0x167d73===_0x13134c(0x1c0)?!_0x37286:_0x37286;let _0x4403e2=_0x2236df;_0x167d73===_0x13134c(0x1c0)?_0x37286?_0xec95c[_0x13134c(0x1e7)]('User\x20'+_0x463894[_0x13134c(0x1e0)]+_0x13134c(0x1db)+_0x164ce0[_0x13134c(0x1fb)]+_0x13134c(0x1de)):_0x4403e2=[..._0x2236df,_0x463894['userId']]:!_0x37286?_0xec95c[_0x13134c(0x1e7)](_0x13134c(0x20f)+_0x463894[_0x13134c(0x1e0)]+_0x13134c(0x1c6)+_0x164ce0[_0x13134c(0x1fb)]+_0x13134c(0x1de)):(_0x4403e2=_0x2236df['filter'](_0x4a76ad=>_0x4a76ad!==_0x463894[_0x13134c(0x1e0)]),_0x3b5f29[_0x13134c(0x1f2)]>0x1&&_0xec95c[_0x13134c(0x1e7)](_0x13134c(0x1d8)+_0x3b5f29[_0x13134c(0x1f2)]+'\x20duplicate\x20memberships\x20for\x20user\x20'+_0x463894[_0x13134c(0x1e0)]+'.'));const _0x54d374={'scope':_0x13134c(0x1c9),'operation':_0x167d73,'selector':{'appCode':_0x508611,'roleId':_0x164ce0['id'],'roleName':_0x164ce0[_0x13134c(0x1fb)],'userId':_0x463894[_0x13134c(0x1e0)]},'before':{'userIds':_0x2236df},'after':{'userIds':_0x4403e2},'dryRun':_0x4b4b96[_0x13134c(0x1ef)],'backend':{'method':_0x13134c(0x20a),'path':_0x167d73===_0x13134c(0x1c0)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0xec95c};return{'mutation':_0x54d374,'changed':_0x1dc3c3,'matchingRelationIds':_0x3b5f29};}export async function loadDevRoleRelations(_0x22824e,_0x532cde){const _0x42c5fd=a178_0x44357d,_0x2519bc=0x64,_0x1d8a32=[];for(let _0x1572bc=0x1;;_0x1572bc+=0x1){const {items:_0x5a7140,paging:_0x4d25b5}=await listDevUserRoleRelations(_0x22824e,{'roleId':_0x532cde,'currentPage':_0x1572bc,'pageSize':_0x2519bc});_0x1d8a32[_0x42c5fd(0x1e7)](..._0x5a7140);if(_0x5a7140[_0x42c5fd(0x1f2)]<_0x2519bc||_0x4d25b5&&_0x1d8a32[_0x42c5fd(0x1f2)]>=_0x4d25b5[_0x42c5fd(0x208)])return _0x1d8a32;}}export function readRoleRef(_0x39d2df){const _0x42e9ce=a178_0x44357d,_0xed0b65=_0x39d2df[_0x42e9ce(0x1e6)]('role')[_0x42e9ce(0x1f9)]();if(!_0xed0b65)throw CliErrors['flagMissing'](_0x42e9ce(0x201),'Pass\x20--role\x20<id|name>.');return _0xed0b65;}export async function prepareUserMutation(_0x2aa4cc,_0x17b4ca,_0x402794){const _0x5850f6=a178_0x44357d,_0x250208=readRoleRef(_0x2aa4cc),_0x3589f8=_0x2aa4cc[_0x5850f6(0x1e6)](_0x5850f6(0x1cc))[_0x5850f6(0x1f9)]();if(!_0x3589f8)throw CliErrors[_0x5850f6(0x1e8)](_0x5850f6(0x1cc),_0x5850f6(0x1e4));const _0x1b6d75=_0x2aa4cc[_0x5850f6(0x206)](_0x5850f6(0x1f1)),_0x28edc9=_0x1b6d75===undefined||_0x1b6d75===null?undefined:Number(_0x1b6d75),_0x43a9d9=await resolveRoleRef(_0x2aa4cc[_0x5850f6(0x1cd)],_0x250208);if(_0x43a9d9[_0x5850f6(0x204)]===_0x5850f6(0x1f0))throw CliErrors[_0x5850f6(0x212)]('Cannot\x20'+_0x17b4ca+_0x5850f6(0x1e5),_0x5850f6(0x1fe));const _0x5b95b9=await resolveUserRef(_0x3589f8),_0x77028=await loadDevRoleRelations(_0x2aa4cc[_0x5850f6(0x1cd)],_0x43a9d9['id']);return{...computeRoleUserMutation({'operation':_0x17b4ca,'appCode':_0x2aa4cc[_0x5850f6(0x1cd)],'role':_0x43a9d9,'relations':_0x77028,'user':{'userId':_0x5b95b9[_0x5850f6(0x1e0)],'username':_0x5b95b9['username'],'nickname':_0x5b95b9['nickname']},'dryRun':_0x402794,..._0x28edc9!==undefined?{'expectUserCount':_0x28edc9}:{}}),'role':_0x43a9d9,'user':_0x5b95b9};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x367c41=a179_0x2c6c;(function(_0x3a3fe7,_0x218d03){const _0x42fb9d=a179_0x2c6c,_0x2e8ee1=_0x3a3fe7();while(!![]){try{const _0x55887f=parseInt(_0x42fb9d(0x164))/0x1+parseInt(_0x42fb9d(0x171))/0x2+parseInt(_0x42fb9d(0x165))/0x3+parseInt(_0x42fb9d(0x170))/0x4*(-parseInt(_0x42fb9d(0x159))/0x5)+parseInt(_0x42fb9d(0x176))/0x6*(-parseInt(_0x42fb9d(0x169))/0x7)+parseInt(_0x42fb9d(0x177))/0x8*(-parseInt(_0x42fb9d(0x15f))/0x9)+-parseInt(_0x42fb9d(0x15c))/0xa*(parseInt(_0x42fb9d(0x160))/0xb);if(_0x55887f===_0x218d03)break;else _0x2e8ee1['push'](_0x2e8ee1['shift']());}catch(_0x690c79){_0x2e8ee1['push'](_0x2e8ee1['shift']());}}}(a179_0x5d18,0x2c571));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a179_0x5d18(){const _0x3695ed=['update','44ZNCzPn','600366VhKOzK','Nothing\x20to\x20update.','remark','appCode','/smartapi/permit/role/update','6JwjcZE','891224YtuoNb','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','role','138045ZtWFHr','New\x20role\x20name','validation','8580zLkNRk','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','\x20(id=','9fjurSP','2563SsAadT','write','roleName','length','360683ekxNOR','807156xShSkG','name','POST','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','932995xeymGR','trim','num','flag','dev','string'];a179_0x5d18=function(){return _0x3695ed;};return a179_0x5d18();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a179_0x2c6c(_0x3f2750,_0x36129c){_0x3f2750=_0x3f2750-0x158;const _0x5d1851=a179_0x5d18();let _0x2c6c7e=_0x5d1851[_0x3f2750];return _0x2c6c7e;}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=a179_0x367c41(0x175);function readPatch(_0x3825c6){const _0xd4b890=a179_0x367c41,_0x41968d=_0x3825c6[_0xd4b890(0x16c)](_0xd4b890(0x166)),_0x44963d=_0x3825c6[_0xd4b890(0x16c)](_0xd4b890(0x173)),_0x4b61c0={};if(_0x41968d!==undefined&&_0x41968d!==null){const _0x5e36ba=String(_0x41968d)[_0xd4b890(0x16a)]();if(!_0x5e36ba)throw CliErrors[_0xd4b890(0x15b)]('--name\x20cannot\x20be\x20empty.');if(_0x5e36ba[_0xd4b890(0x163)]>0x40)throw CliErrors[_0xd4b890(0x15b)](_0xd4b890(0x168));_0x4b61c0['roleName']=_0x5e36ba;}_0x44963d!==undefined&&_0x44963d!==null&&(_0x4b61c0['remark']=String(_0x44963d));if(_0x4b61c0[_0xd4b890(0x162)]===undefined&&_0x4b61c0[_0xd4b890(0x173)]===undefined)throw CliErrors[_0xd4b890(0x15b)](_0xd4b890(0x172),_0xd4b890(0x178));return _0x4b61c0;}export const roleUpdate={'service':a179_0x367c41(0x158),'command':a179_0x367c41(0x16f),'description':a179_0x367c41(0x15d),'risk':a179_0x367c41(0x161),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a179_0x367c41(0x166),'type':a179_0x367c41(0x16e),'required':![],'description':a179_0x367c41(0x15a)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x522d0a){readPatch(_0x522d0a);},async 'dryRun'(_0x55430c){const _0x130369=a179_0x367c41,_0x1a3af3=_0x55430c['num']('id'),_0x54cddd=readPatch(_0x55430c),_0x537de3=await getRoleById(_0x55430c['appCode'],_0x1a3af3);return assertCustomRole(_0x537de3,_0x130369(0x16f)),asDryRunResult({'scope':'dev','operation':_0x130369(0x16f),'selector':{'appCode':_0x55430c[_0x130369(0x174)],'roleId':_0x1a3af3,'roleName':_0x537de3['roleName']},'before':projectRole(_0x537de3),'after':projectRole({..._0x537de3,..._0x54cddd[_0x130369(0x162)]!==undefined?{'roleName':_0x54cddd[_0x130369(0x162)]}:{},..._0x54cddd[_0x130369(0x173)]!==undefined?{'remark':_0x54cddd[_0x130369(0x173)]}:{}}),'dryRun':!![],'backend':{'method':_0x130369(0x167),'path':UPDATE_PATH},'warnings':[]},{'method':_0x130369(0x167),'url':UPDATE_PATH});},async 'execute'(_0x764aa0){const _0x2e92c2=a179_0x367c41,_0x152de5=_0x764aa0[_0x2e92c2(0x16b)]('id'),_0x15205d=readPatch(_0x764aa0),_0x13e3a2=await getRoleById(_0x764aa0[_0x2e92c2(0x174)],_0x152de5);assertCustomRole(_0x13e3a2,_0x2e92c2(0x16f)),await updateAppRole({'id':_0x152de5,'appCode':_0x764aa0['appCode'],..._0x15205d[_0x2e92c2(0x162)]!==undefined?{'roleName':_0x15205d[_0x2e92c2(0x162)]}:{},..._0x15205d['remark']!==undefined?{'remark':_0x15205d[_0x2e92c2(0x173)]}:{}});const _0x3d1fb6=await getRoleById(_0x764aa0[_0x2e92c2(0x174)],_0x152de5);return{'ok':!![],'data':{'scope':_0x2e92c2(0x16d),'operation':'update','selector':{'appCode':_0x764aa0[_0x2e92c2(0x174)],'roleId':_0x152de5,'roleName':_0x3d1fb6[_0x2e92c2(0x162)]},'before':projectRole(_0x13e3a2),'after':projectRole(_0x3d1fb6),'dryRun':![],'backend':{'method':_0x2e92c2(0x167),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x3d1fb6[_0x2e92c2(0x162)]+_0x2e92c2(0x15e)+_0x152de5+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a180_0x3f95ab=a180_0x503c;(function(_0x3790a2,_0x2c0e75){const _0x1cc56e=a180_0x503c,_0x4799a4=_0x3790a2();while(!![]){try{const _0x2246f0=-parseInt(_0x1cc56e(0x1b7))/0x1+-parseInt(_0x1cc56e(0x1bf))/0x2+parseInt(_0x1cc56e(0x1b3))/0x3+parseInt(_0x1cc56e(0x1bc))/0x4+parseInt(_0x1cc56e(0x1b4))/0x5+-parseInt(_0x1cc56e(0x1c1))/0x6*(parseInt(_0x1cc56e(0x1b0))/0x7)+parseInt(_0x1cc56e(0x1b5))/0x8*(parseInt(_0x1cc56e(0x1ad))/0x9);if(_0x2246f0===_0x2c0e75)break;else _0x4799a4['push'](_0x4799a4['shift']());}catch(_0x2c9c79){_0x4799a4['push'](_0x4799a4['shift']());}}}(a180_0x53a0,0x796c3));function a180_0x503c(_0x453a35,_0x27139d){_0x453a35=_0x453a35-0x1ad;const _0x53a01b=a180_0x53a0();let _0x503ca5=_0x53a01b[_0x453a35];return _0x503ca5;}import{createDevUserRole}from'../../core/api-client.js';function a180_0x53a0(){const _0x3532d9=['username','roleId','1546100nbatEI','user-add','294AfMKlW','3645567rzMHun','No\x20change:\x20user\x20','POST','3199vUUUej','\x20already\x20in\x20role\x20','high-risk-write','762870jwocXY','3994185lxKVAs','8RtYJxD','userId','896288YDpthT','roleType','role','selector','roleName','2923552pHkcBg'];a180_0x53a0=function(){return _0x3532d9;};return a180_0x53a0();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a180_0x3f95ab(0x1b9),'command':a180_0x3f95ab(0x1c0),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a180_0x3f95ab(0x1b2),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2fae80){const _0x2c56e6=a180_0x3f95ab,{mutation:_0x2073b9}=await prepareUserMutation(_0x2fae80,_0x2c56e6(0x1c0),!![]);return asDryRunResult(_0x2073b9,{'method':_0x2c56e6(0x1af),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x38aa79){const _0x5b195c=a180_0x3f95ab,{mutation:_0x15383e,changed:_0x3a49d4,role:_0x50d9c0,user:_0x3b2ae2}=await prepareUserMutation(_0x38aa79,_0x5b195c(0x1c0),![]);return _0x3a49d4&&await createDevUserRole({'appCode':_0x38aa79['appCode'],'userId':_0x3b2ae2[_0x5b195c(0x1b6)],'username':_0x3b2ae2[_0x5b195c(0x1bd)],'roleType':_0x50d9c0[_0x5b195c(0x1b8)],'roleId':_0x15383e[_0x5b195c(0x1ba)][_0x5b195c(0x1be)]}),{'ok':!![],'data':_0x15383e,'message':_0x3a49d4?'Added\x20user\x20'+_0x15383e[_0x5b195c(0x1ba)][_0x5b195c(0x1b6)]+'\x20to\x20role\x20'+_0x15383e[_0x5b195c(0x1ba)][_0x5b195c(0x1bb)]:_0x5b195c(0x1ae)+_0x15383e[_0x5b195c(0x1ba)][_0x5b195c(0x1b6)]+_0x5b195c(0x1b1)+_0x15383e['selector'][_0x5b195c(0x1bb)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a181_0x1c0bd5=a181_0x4ab5;(function(_0x4170a4,_0x546916){const _0x1a5056=a181_0x4ab5,_0x2b0962=_0x4170a4();while(!![]){try{const _0xded976=-parseInt(_0x1a5056(0x13c))/0x1+-parseInt(_0x1a5056(0x141))/0x2*(-parseInt(_0x1a5056(0x13b))/0x3)+-parseInt(_0x1a5056(0x12f))/0x4+-parseInt(_0x1a5056(0x136))/0x5+parseInt(_0x1a5056(0x138))/0x6+-parseInt(_0x1a5056(0x13e))/0x7*(parseInt(_0x1a5056(0x13d))/0x8)+parseInt(_0x1a5056(0x131))/0x9*(parseInt(_0x1a5056(0x130))/0xa);if(_0xded976===_0x546916)break;else _0x2b0962['push'](_0x2b0962['shift']());}catch(_0x2ed85c){_0x2b0962['push'](_0x2b0962['shift']());}}}(a181_0x4a0f,0x2d952));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a181_0x4a0f(){const _0x447d46=['No\x20change:\x20user\x20','41439oijORt','269968RJWSxO','824HzFTDG','14791gyEIHS','\x20from\x20role\x20','user-remove','2jGMwOA','636832xhPCtp','10XAPAaZ','8212599HyFyDp','selector','POST','high-risk-write','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','1215770RPhbPh','userId','902106IASxSE','roleName'];a181_0x4a0f=function(){return _0x447d46;};return a181_0x4a0f();}import{asDryRunResult}from'../../commands/common/dry-run.js';function a181_0x4ab5(_0x24a693,_0x4f1db2){_0x24a693=_0x24a693-0x12f;const _0x4a0f82=a181_0x4a0f();let _0x4ab5e5=_0x4a0f82[_0x24a693];return _0x4ab5e5;}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':'role','command':a181_0x1c0bd5(0x140),'description':a181_0x1c0bd5(0x135),'risk':a181_0x1c0bd5(0x134),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x41c864){const _0x2d41ae=a181_0x1c0bd5,{mutation:_0x717ae2}=await prepareUserMutation(_0x41c864,_0x2d41ae(0x140),!![]);return asDryRunResult(_0x717ae2,{'method':_0x2d41ae(0x133),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x5e8dbf){const _0x446c83=a181_0x1c0bd5,{matchingRelationIds:_0x121618,mutation:_0x12caf6,changed:_0x46f9e0}=await prepareUserMutation(_0x5e8dbf,'user-remove',![]);if(_0x46f9e0)for(const _0x1e1914 of _0x121618){await deleteDevUserRole(_0x1e1914);}return{'ok':!![],'data':_0x12caf6,'message':_0x46f9e0?'Removed\x20user\x20'+_0x12caf6[_0x446c83(0x132)][_0x446c83(0x137)]+_0x446c83(0x13f)+_0x12caf6['selector']['roleName']:_0x446c83(0x13a)+_0x12caf6[_0x446c83(0x132)]['userId']+'\x20not\x20in\x20role\x20'+_0x12caf6[_0x446c83(0x132)][_0x446c83(0x139)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a182_0x4bb0(_0x4960df,_0x586de9){_0x4960df=_0x4960df-0x12d;const _0x34dda5=a182_0x34dd();let _0x4bb060=_0x34dda5[_0x4960df];return _0x4bb060;}const a182_0x1a095a=a182_0x4bb0;(function(_0x2688f,_0x47e32e){const _0x34223f=a182_0x4bb0,_0x43da32=_0x2688f();while(!![]){try{const _0x169bb0=-parseInt(_0x34223f(0x142))/0x1+-parseInt(_0x34223f(0x133))/0x2+parseInt(_0x34223f(0x132))/0x3*(parseInt(_0x34223f(0x139))/0x4)+parseInt(_0x34223f(0x143))/0x5+-parseInt(_0x34223f(0x12e))/0x6*(-parseInt(_0x34223f(0x13a))/0x7)+parseInt(_0x34223f(0x13d))/0x8*(-parseInt(_0x34223f(0x13b))/0x9)+-parseInt(_0x34223f(0x136))/0xa*(parseInt(_0x34223f(0x13e))/0xb);if(_0x169bb0===_0x47e32e)break;else _0x43da32['push'](_0x43da32['shift']());}catch(_0x51bd86){_0x43da32['push'](_0x43da32['shift']());}}}(a182_0x34dd,0x9f422));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a182_0x1a095a(0x134),'command':'user-resolve','description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a182_0x1a095a(0x12d),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1fa4ea){const _0x3e105a=a182_0x1a095a;if(!_0x1fa4ea[_0x3e105a(0x140)](_0x3e105a(0x131))[_0x3e105a(0x144)]())throw CliErrors[_0x3e105a(0x13c)](_0x3e105a(0x131),'Pass\x20--name\x20<nickname|username>.');},async 'execute'(_0xc97628){const _0x43ad48=a182_0x1a095a,_0x22e10d=_0xc97628[_0x43ad48(0x140)]('name')[_0x43ad48(0x144)](),_0x33d107=await resolveUserRef(_0x22e10d,_0x43ad48(0x137));return{'ok':!![],'data':{'user':{'userId':_0x33d107[_0x43ad48(0x141)],'username':_0x33d107[_0x43ad48(0x135)],'nickname':_0x33d107[_0x43ad48(0x130)],'matchedBy':_0x33d107[_0x43ad48(0x12f)]}},'message':_0x43ad48(0x138)+_0x22e10d+_0x43ad48(0x13f)+_0x33d107[_0x43ad48(0x141)]};}};function a182_0x34dd(){const _0x4b7545=['Resolved\x20\x22','143268qHMYNi','211652YeJwIP','36aVIZec','flagMissing','2195888fsjUvF','3800049RbRgYw','\x22\x20→\x20userId\x20','str','userId','594861rqnGSW','4792760foMGzX','trim','read','258IVSYrf','matchedBy','nickname','name','51RwQuFY','354006iPGCUo','role','username','10egqpGn','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.'];a182_0x34dd=function(){return _0x4b7545;};return a182_0x34dd();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a183_0xc6e504=a183_0x2f97;(function(_0x32b7bd,_0x758808){const _0x33bd78=a183_0x2f97,_0xd2e5aa=_0x32b7bd();while(!![]){try{const _0x38bd66=parseInt(_0x33bd78(0x8e))/0x1+-parseInt(_0x33bd78(0x7e))/0x2+parseInt(_0x33bd78(0x86))/0x3+-parseInt(_0x33bd78(0x94))/0x4+parseInt(_0x33bd78(0x76))/0x5*(parseInt(_0x33bd78(0x6a))/0x6)+-parseInt(_0x33bd78(0x93))/0x7+parseInt(_0x33bd78(0x73))/0x8;if(_0x38bd66===_0x758808)break;else _0xd2e5aa['push'](_0xd2e5aa['shift']());}catch(_0x176827){_0xd2e5aa['push'](_0xd2e5aa['shift']());}}}(a183_0x1eaf,0x88b81));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{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',a183_0xc6e504(0x88)]);function readPackageScripts(_0x20df31){const _0x18b9e2=a183_0xc6e504,_0x161463=resolve(_0x20df31,'package.json');if(!existsSync(_0x161463))return null;try{const _0x5e532c=JSON[_0x18b9e2(0x84)](readFileSync(_0x161463,_0x18b9e2(0x92)));return _0x5e532c['scripts']??{};}catch{return null;}}function detectPackageManager(_0x2535a8){const _0x31145a=a183_0xc6e504;if(existsSync(resolve(_0x2535a8,_0x31145a(0x95)))||existsSync(resolve(_0x2535a8,_0x31145a(0x79))))return'bun';if(existsSync(resolve(_0x2535a8,_0x31145a(0x98))))return _0x31145a(0x91);if(existsSync(resolve(_0x2535a8,'yarn.lock')))return _0x31145a(0x9b);return'npm';}function a183_0x2f97(_0x140b65,_0x37db04){_0x140b65=_0x140b65-0x67;const _0x1eafd9=a183_0x1eaf();let _0x2f97cf=_0x1eafd9[_0x140b65];return _0x2f97cf;}async function versionCheck(_0x36b170){const _0x1bf301=a183_0xc6e504,_0xe50323=await checkCliVersion();(_0xe50323[_0x1bf301(0x75)]||_0xe50323['belowMinimum'])&&(printCliUpgradeWarning(_0xe50323),assertCliVersionSupported(_0xe50323));const _0x4e3666=await checkSdkVersion(_0x36b170);if(_0x4e3666[_0x1bf301(0x75)])printSdkUpgradeWarning(_0x4e3666);}function spawnScript(_0x5c07f6,_0x32a4ea,_0x5b93f0,_0xa470af){return new Promise((_0x4a53af,_0x508b9c)=>{const _0x171693=a183_0x2f97,_0x2899e4=[_0x171693(0x7c),_0x32a4ea,..._0x5b93f0],_0x297f14=spawn(_0x5c07f6,_0x2899e4,{'cwd':_0xa470af,'stdio':_0x171693(0x7d),'shell':!![],'env':{...process.env,'PATH':''+join(_0xa470af,_0x171693(0x9a),_0x171693(0x69))+delimiter+process.env.PATH}});_0x297f14['on'](_0x171693(0x70),_0x4b297c=>{const _0x3d6f90=_0x171693;if(_0x4b297c===0x0||_0x4b297c===null)_0x4a53af();else _0x508b9c(new Error(_0x5c07f6+_0x3d6f90(0x85)+_0x32a4ea+'\x20exited\x20with\x20code\x20'+_0x4b297c));}),_0x297f14['on']('error',_0x508b9c);});}function a183_0x1eaf(){const _0x20c9e9=['Available:\x20','length','write','\x20run\x20start','parse','\x20run\x20','1315203vGMYVP','bool','dev','push','Script\x20\x22','\x0a\x20\x20Usage:\x20','\x22\x20not\x20found\x20in\x20package.json.','log','38180BywiNc','has','all','pnpm','utf-8','542885RYbaCb','3299212mxrtVI','bun.lockb','vite','\x20\x20\x20\x20','pnpm-lock.yaml','args','node_modules','yarn','watch','keys','\x20run\x20<script>\x0a','.bin','100662aynQvr','\x0a\x20\x20Available\x20scripts:\x0a','Run\x20a\x20package.json\x20script','validation','Script\x20name\x20defined\x20in\x20package.json','build','close','join','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','3717664sWgCnz','preview','needsUpgrade','235zCmOic','error','\x20run\x20build','bun.lock','\x20\x20EXAMPLES','\x20run\x20preview\x20--watch','run','inherit','534898nRcLSK','boolean'];a183_0x1eaf=function(){return _0x20c9e9;};return a183_0x1eaf();}function spawnViteBuildWatch(_0x395f7b){return new Promise((_0x838b4d,_0x50f5b5)=>{const _0x59595e=a183_0x2f97,_0x56b278=spawn('vite',[_0x59595e(0x6f),'--watch'],{'cwd':_0x395f7b,'stdio':_0x59595e(0x7d),'shell':!![],'env':{...process.env,'PATH':''+join(_0x395f7b,_0x59595e(0x9a),_0x59595e(0x69))+delimiter+process.env.PATH}});_0x56b278['on']('close',_0xd3d13c=>{const _0x45325e=_0x59595e;if(_0xd3d13c===0x0||_0xd3d13c===null)_0x838b4d();else _0x50f5b5(new Error(_0x45325e(0x72)+_0xd3d13c));}),_0x56b278['on'](_0x59595e(0x77),_0x50f5b5);});}function spawnVitePreview(_0x4bf365){return new Promise((_0x1981d9,_0xe45901)=>{const _0x3bef5f=a183_0x2f97,_0x4831cc=spawn(_0x3bef5f(0x96),['preview'],{'cwd':_0x4bf365,'stdio':_0x3bef5f(0x7d),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4bf365,_0x3bef5f(0x9a),_0x3bef5f(0x69))+delimiter+process.env.PATH}});_0x4831cc['on'](_0x3bef5f(0x70),_0x210771=>{if(_0x210771===0x0||_0x210771===null)_0x1981d9();else _0xe45901(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x210771));}),_0x4831cc['on'](_0x3bef5f(0x77),_0xe45901);});}const runFlags=[{'name':a183_0xc6e504(0x9c),'type':a183_0xc6e504(0x7f),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a183_0xc6e504(0x7c),'command':a183_0xc6e504(0x7c),'description':a183_0xc6e504(0x6c),'risk':a183_0xc6e504(0x82),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a183_0xc6e504(0x6e),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x1c2f95=a183_0xc6e504,_0x20fddb=[];return _0x20fddb[_0x1c2f95(0x89)](_0x1c2f95(0x7a)),_0x20fddb[_0x1c2f95(0x89)](_0x1c2f95(0x97)+CLI_BIN_NAME+_0x1c2f95(0x83)),_0x20fddb['push'](_0x1c2f95(0x97)+CLI_BIN_NAME+_0x1c2f95(0x78)),_0x20fddb[_0x1c2f95(0x89)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview'),_0x20fddb['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1c2f95(0x7b)),_0x20fddb['join']('\x0a');},async 'execute'(_0x242b06){const _0x517433=a183_0xc6e504,_0x11087a=process['cwd'](),_0x1166eb=_0x242b06[_0x517433(0x99)][0x0],_0x5644f3=_0x242b06[_0x517433(0x99)]['slice'](0x1),_0x5696a2=readPackageScripts(_0x11087a);if(!_0x5696a2)throw CliErrors[_0x517433(0x6d)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x1166eb){const _0x40f0f6=Object[_0x517433(0x67)](_0x5696a2);if(_0x40f0f6[_0x517433(0x81)]===0x0)console[_0x517433(0x8d)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x517433(0x8d)](_0x517433(0x6b));for(const _0x4c2513 of _0x40f0f6){console['log'](_0x517433(0x97)+_0x4c2513);}console['log'](_0x517433(0x8b)+CLI_BIN_NAME+_0x517433(0x68));}return{'ok':!![]};}if(!_0x5696a2[_0x1166eb])throw CliErrors['validation'](_0x517433(0x8a)+_0x1166eb+_0x517433(0x8c),_0x517433(0x80)+(Object[_0x517433(0x67)](_0x5696a2)[_0x517433(0x71)](',\x20')||'(none)'));const _0x5ca143=detectPackageManager(_0x11087a);VERSION_CHECK_SCRIPTS[_0x517433(0x8f)](_0x1166eb)&&await versionCheck(_0x11087a);if(_0x1166eb===_0x517433(0x74)&&_0x242b06[_0x517433(0x87)](_0x517433(0x9c)))return await Promise[_0x517433(0x90)]([spawnViteBuildWatch(_0x11087a),spawnVitePreview(_0x11087a)]),{'ok':!![]};return await spawnScript(_0x5ca143,_0x1166eb,_0x5644f3,_0x11087a),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a184_0x20f3(_0x2f247d,_0x494bc9){_0x2f247d=_0x2f247d-0x1db;const _0x4de31a=a184_0x4de3();let _0x20f3c1=_0x4de31a[_0x2f247d];return _0x20f3c1;}const a184_0x5d8f32=a184_0x20f3;function a184_0x4de3(){const _0x5b92d3=['Export\x20machine-readable\x20command\x20schema\x20(JSON)','read','3572569kIVihE','11235qTDtOp','6zBuioG','617335isTpBE','3118908wdfjFt','1007634MfTNJr','7131160eZkCJl','9ybkYCo','1001PIUcjg','export','70456ncdJHA','1868FagXHr'];a184_0x4de3=function(){return _0x5b92d3;};return a184_0x4de3();}(function(_0x489d3c,_0x827657){const _0x169464=a184_0x20f3,_0x2018be=_0x489d3c();while(!![]){try{const _0x136c58=-parseInt(_0x169464(0x1e0))/0x1+-parseInt(_0x169464(0x1df))/0x2+-parseInt(_0x169464(0x1dc))/0x3*(-parseInt(_0x169464(0x1e6))/0x4)+parseInt(_0x169464(0x1de))/0x5*(parseInt(_0x169464(0x1dd))/0x6)+-parseInt(_0x169464(0x1e3))/0x7*(-parseInt(_0x169464(0x1e5))/0x8)+-parseInt(_0x169464(0x1e2))/0x9*(-parseInt(_0x169464(0x1e1))/0xa)+-parseInt(_0x169464(0x1db))/0xb;if(_0x136c58===_0x827657)break;else _0x2018be['push'](_0x2018be['shift']());}catch(_0x2a050e){_0x2018be['push'](_0x2018be['shift']());}}}(a184_0x4de3,0xe8ac8));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5cfb01){const _0x5589b5=await buildSchemaPayload();return{'ok':!![],'data':_0x5589b5};}export const schemaDefinition={'service':'schema','command':a184_0x5d8f32(0x1e4),'description':a184_0x5d8f32(0x1e7),'risk':a184_0x5d8f32(0x1e8),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a185_0xe38f20=a185_0x48ff;(function(_0x2e396d,_0x686bce){const _0x58e6d6=a185_0x48ff,_0x47517f=_0x2e396d();while(!![]){try{const _0x1a3eea=parseInt(_0x58e6d6(0x200))/0x1+-parseInt(_0x58e6d6(0x1d8))/0x2*(-parseInt(_0x58e6d6(0x1e2))/0x3)+parseInt(_0x58e6d6(0x201))/0x4*(parseInt(_0x58e6d6(0x207))/0x5)+parseInt(_0x58e6d6(0x1fd))/0x6*(parseInt(_0x58e6d6(0x1cb))/0x7)+parseInt(_0x58e6d6(0x1fa))/0x8*(parseInt(_0x58e6d6(0x1de))/0x9)+-parseInt(_0x58e6d6(0x1f4))/0xa+-parseInt(_0x58e6d6(0x210))/0xb*(parseInt(_0x58e6d6(0x206))/0xc);if(_0x1a3eea===_0x686bce)break;else _0x47517f['push'](_0x47517f['shift']());}catch(_0x5ee7f9){_0x47517f['push'](_0x47517f['shift']());}}}(a185_0x2124,0x5d12e));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';function a185_0x2124(){const _0x3819e7=['\x20\x20SELECT\x201\x20AS\x20id','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','77rhpLxk','appCode','MyBatis\x20XML\x20(mybatisXml)','7qIpFIA','Select\x20the\x20local\x20SQL\x20mode:','flag','dbId','description','Local\x20SQL\x20file\x20mode','File\x20already\x20exists:\x20','utf8','toISOString','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','</select>','lastSync','validation','54654bSeqVD','POST','isInteger','sqlRootDir','str','trim','9243tMrGcV','SELECT\x201\x20AS\x20id;','name','length','66fvJHIJ','map','sqlName','flagMissing','nonInteractive','number','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20must\x20be\x20a\x20positive\x20integer','Invalid\x20database\x20selection\x20payload:\x20','dbName','join','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','lockFilePath','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','write','Target\x20database\x20ID','Plain\x20SQL\x20(sql)','sqlRoot','3031430OGzZHX','db-id','stringify','mybatisXml','parse','__manual__','4360rQRhxj','SQL\x20name\x20cannot\x20be\x20empty','SQL\x20name:','2173854ICcZAe','isFinite','✎\x20Enter\x20dbId\x20manually','514804LcfFHs','270212KgfgJh','Select\x20the\x20target\x20database:','sql','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','mode','3015372MwRRRH','30cVTurU','Target\x20database\x20dbId:','catch','create','/smartapi/custom/saveUserCustomSql','sqlCode','string'];a185_0x2124=function(){return _0x3819e7;};return a185_0x2124();}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';function a185_0x48ff(_0x4ed106,_0x5d0f38){_0x4ed106=_0x4ed106-0x1c9;const _0x2124fe=a185_0x2124();let _0x48ff72=_0x2124fe[_0x4ed106];return _0x48ff72;}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(_0x276263){const _0x436d55=a185_0x48ff;if(_0x276263==='mybatisXml')return[_0x436d55(0x1ed),_0x436d55(0x20e),_0x436d55(0x1d5),''][_0x436d55(0x1ec)]('\x0a');return[_0x436d55(0x1df),''][_0x436d55(0x1ec)]('\x0a');}export const sqlCreate={'service':'sql','command':a185_0xe38f20(0x20a),'description':a185_0xe38f20(0x20f),'risk':a185_0xe38f20(0x1f0),'flags':[{'name':'name','type':a185_0xe38f20(0x20d),'description':'SQL\x20query\x20display\x20name'},{'name':a185_0xe38f20(0x1f5),'type':'number','description':a185_0xe38f20(0x1f1)},{'name':'mode','type':a185_0xe38f20(0x20d),'enum':[a185_0xe38f20(0x203),a185_0xe38f20(0x1f7)],'description':a185_0xe38f20(0x1d0)}],async 'validate'(_0x98bf6b){const _0x5514ac=a185_0xe38f20;if(!_0x98bf6b[_0x5514ac(0x1e6)])return;if(!_0x98bf6b[_0x5514ac(0x1dc)]('name')[_0x5514ac(0x1dd)]())throw CliErrors[_0x5514ac(0x1e5)](_0x5514ac(0x1e0),_0x5514ac(0x1e8));const _0x3561ba=resolveProvidedDbId(_0x98bf6b);if(typeof _0x3561ba!==_0x5514ac(0x1e7)||!Number['isFinite'](_0x3561ba)||_0x3561ba<=0x0)throw CliErrors[_0x5514ac(0x1e5)]('db-id',_0x5514ac(0x1d4));if(!_0x98bf6b[_0x5514ac(0x1dc)](_0x5514ac(0x205))['trim']())throw CliErrors[_0x5514ac(0x1e5)](_0x5514ac(0x205),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x1d028d){const _0x97619a=a185_0xe38f20,_0x267bd4=loadSqlProjectConfig(_0x1d028d['appCode']),{sqlName:_0x2223b9,dbId:_0x42c569,dbName:_0x2540dc,mode:_0x449e85}=await resolveSqlNewInputs(_0x1d028d),_0x9743b7=buildSqlRelativePath('<server-generated-sqlCode>',_0x2223b9,_0x2540dc,_0x449e85,_0x42c569),_0x29c732=_0x267bd4[_0x97619a(0x1db)]+'/'+_0x9743b7;return{'method':_0x97619a(0x1d9),'url':_0x97619a(0x20b),'body':{'appCode':_0x1d028d[_0x97619a(0x1c9)],'sqlName':_0x2223b9,'dbId':_0x42c569,'mode':_0x449e85,'localPath':_0x29c732},'description':_0x97619a(0x1ef)+_0x267bd4[_0x97619a(0x1db)]};},async 'execute'(_0x392f28){const _0x3b2b4f=a185_0xe38f20,_0x29ec56=loadSqlProjectConfig(_0x392f28[_0x3b2b4f(0x1c9)]),{sqlName:_0x4b0b71,dbId:_0x3dbb32,dbName:_0xe6de3d,mode:_0x3d2ef7}=await resolveSqlNewInputs(_0x392f28),_0x4276f7=generateSqlTemplate(_0x3d2ef7),_0x4bb2ec=await createSqlQuery({'appCode':_0x392f28[_0x3b2b4f(0x1c9)],'sqlName':_0x4b0b71,'dbId':_0x3dbb32,'sqlContent':_0x4276f7}),_0x164547=ensureRemoteSqlContent(_0x4bb2ec),_0x1b1be3=_0xe6de3d||await getDbName(_0x392f28['appCode'],_0x3dbb32)[_0x3b2b4f(0x209)](()=>undefined),_0x5a595b=buildSqlRelativePath(_0x4bb2ec[_0x3b2b4f(0x20c)],_0x4bb2ec[_0x3b2b4f(0x1e4)],_0x1b1be3,_0x3d2ef7,_0x3dbb32),_0x496438=_0x29ec56[_0x3b2b4f(0x1db)]+'/'+_0x5a595b,_0x36ab7c=buildLocalSqlFileContent({'sqlCode':_0x4bb2ec[_0x3b2b4f(0x20c)],'sqlName':_0x4bb2ec[_0x3b2b4f(0x1e4)],'dbId':_0x4bb2ec[_0x3b2b4f(0x1ce)]},_0x164547,{'dbName':_0x1b1be3,'mode':_0x3d2ef7,'syncedAt':new Date()[_0x3b2b4f(0x1d3)](),'description':_0x4bb2ec[_0x3b2b4f(0x1cf)]});if(await fileExists(_0x496438))throw CliErrors['validation'](_0x3b2b4f(0x1d1)+_0x496438);await ensureParentDirectory(_0x496438),await writeFile(_0x496438,_0x36ab7c,_0x3b2b4f(0x1d2));const _0x218f1e=await readSqlLockFile(_0x29ec56['lockFilePath']),{lockData:_0x1ccf9f,appLock:_0x3a018d}=ensureSqlLockScope(_0x218f1e??createEmptySqlLock(),_0x29ec56[_0x3b2b4f(0x1c9)],_0x29ec56[_0x3b2b4f(0x1f3)],'new');return _0x3a018d['sqls'][_0x4bb2ec[_0x3b2b4f(0x20c)]]={...buildSqlLockEntry(_0x4bb2ec,_0x164547,computeSqlContentHash(_0x36ab7c),{'dbName':_0x1b1be3}),'path':_0x5a595b,'mode':_0x3d2ef7},_0x3a018d[_0x3b2b4f(0x1d6)]=new Date()[_0x3b2b4f(0x1d3)](),await writeSqlLockFile(_0x29ec56[_0x3b2b4f(0x1ee)],_0x1ccf9f),{'ok':!![],'data':{'id':_0x4bb2ec['id'],'sqlCode':_0x4bb2ec[_0x3b2b4f(0x20c)],'sqlName':_0x4bb2ec['sqlName'],'dbId':_0x4bb2ec['dbId'],'path':_0x496438,'mode':_0x3d2ef7},'message':'Created\x20SQL\x20query\x20'+_0x4bb2ec['sqlCode']};}};async function resolveSqlNewInputs(_0xd90520){const _0x49916d=await resolveSqlNameInput(_0xd90520),{dbId:_0x6270ca,dbName:_0x3d62b4}=await resolveDbSelection(_0xd90520),_0x3a6ce2=await resolveSqlModeInput(_0xd90520);return{'sqlName':_0x49916d,'dbId':_0x6270ca,'dbName':_0x3d62b4,'mode':_0x3a6ce2};}async function resolveSqlNameInput(_0x27954c){const _0x21e6de=a185_0xe38f20,_0x4465df=_0x27954c[_0x21e6de(0x1dc)](_0x21e6de(0x1e0))['trim']();if(_0x4465df)return _0x4465df;if(_0x27954c[_0x21e6de(0x1e6)])throw CliErrors[_0x21e6de(0x1e5)](_0x21e6de(0x1e0),_0x21e6de(0x1e8));return(await input({'message':_0x21e6de(0x1fc),'validate':_0x9fa908=>_0x9fa908[_0x21e6de(0x1dd)]()?!![]:_0x21e6de(0x1fb)}))[_0x21e6de(0x1dd)]();}async function resolveDbSelection(_0xf75c86){const _0x429d6b=a185_0xe38f20,_0x1c967d=resolveProvidedDbId(_0xf75c86);if(typeof _0x1c967d==='number'&&Number[_0x429d6b(0x1fe)](_0x1c967d)&&_0x1c967d>0x0)return{'dbId':_0x1c967d,'dbName':await getDbName(_0xf75c86[_0x429d6b(0x1c9)],_0x1c967d)['catch'](()=>undefined)};if(_0xf75c86[_0x429d6b(0x1e6)])throw CliErrors[_0x429d6b(0x1e5)](_0x429d6b(0x1f5),_0x429d6b(0x1d4));const _0x5183a8=await listDatabases(_0xf75c86[_0x429d6b(0x1c9)])['catch'](()=>[]);if(_0x5183a8[_0x429d6b(0x1e1)]===0x1)return{'dbId':_0x5183a8[0x0][_0x429d6b(0x1ce)],'dbName':_0x5183a8[0x0][_0x429d6b(0x1eb)]};if(_0x5183a8[_0x429d6b(0x1e1)]>0x1){const _0x26c50d=await select({'message':_0x429d6b(0x202),'choices':[..._0x5183a8[_0x429d6b(0x1e3)](_0x407fb6=>({'name':_0x407fb6[_0x429d6b(0x1eb)]+'\x20('+_0x407fb6['dbId']+')','value':serializeDbSelection(_0x407fb6)})),{'name':_0x429d6b(0x1ff),'value':_0x429d6b(0x1f9)}]});if(_0x26c50d!==_0x429d6b(0x1f9))return deserializeDbSelection(_0x26c50d);}const _0x3d8f1f=await input({'message':_0x429d6b(0x208),'validate':_0x5ac167=>{const _0x36e74e=_0x429d6b,_0xd651e4=_0x5ac167[_0x36e74e(0x1dd)]();if(!_0xd651e4)return'dbId\x20cannot\x20be\x20empty';const _0xa71210=Number(_0xd651e4);if(!Number[_0x36e74e(0x1da)](_0xa71210)||_0xa71210<=0x0)return _0x36e74e(0x1e9);return!![];}});return{'dbId':Number(_0x3d8f1f['trim']())};}async function resolveSqlModeInput(_0x3d0a8d){const _0x2ffde0=a185_0xe38f20,_0x48cbf0=_0x3d0a8d[_0x2ffde0(0x1dc)]('mode')[_0x2ffde0(0x1dd)]();if(_0x48cbf0===_0x2ffde0(0x203)||_0x48cbf0===_0x2ffde0(0x1f7))return _0x48cbf0;if(_0x3d0a8d[_0x2ffde0(0x1e6)])throw CliErrors[_0x2ffde0(0x1e5)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x2ffde0(0x1cc),'choices':[{'name':_0x2ffde0(0x1f2),'value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x2ffde0(0x1ca),'value':_0x2ffde0(0x1f7),'description':_0x2ffde0(0x204)}]});}function serializeDbSelection(_0x44f9a4){const _0x1deefd=a185_0xe38f20;return JSON[_0x1deefd(0x1f6)]({'dbId':_0x44f9a4['dbId'],'dbName':_0x44f9a4[_0x1deefd(0x1eb)]});}function deserializeDbSelection(_0x58a555){const _0x3544a3=a185_0xe38f20;try{const _0x426fd5=JSON[_0x3544a3(0x1f8)](_0x58a555);if(typeof _0x426fd5[_0x3544a3(0x1ce)]===_0x3544a3(0x1e7)&&Number[_0x3544a3(0x1fe)](_0x426fd5[_0x3544a3(0x1ce)]))return{'dbId':_0x426fd5[_0x3544a3(0x1ce)],'dbName':_0x426fd5[_0x3544a3(0x1eb)]};}catch{}throw CliErrors[_0x3544a3(0x1d7)](_0x3544a3(0x1ea)+_0x58a555);}function resolveProvidedDbId(_0x3f6770){const _0x4a0113=a185_0xe38f20,_0x23434b=_0x3f6770[_0x4a0113(0x1cd)](_0x4a0113(0x1f5));if(typeof _0x23434b===_0x4a0113(0x1e7)&&Number[_0x4a0113(0x1fe)](_0x23434b))return _0x23434b;return undefined;}
|
|
1
|
+
const a185_0x457397=a185_0x1823;(function(_0x330867,_0x3a8e84){const _0x15db39=a185_0x1823,_0x5dbd72=_0x330867();while(!![]){try{const _0x591371=-parseInt(_0x15db39(0x15e))/0x1+-parseInt(_0x15db39(0x158))/0x2+-parseInt(_0x15db39(0x17e))/0x3*(-parseInt(_0x15db39(0x163))/0x4)+-parseInt(_0x15db39(0x16a))/0x5*(-parseInt(_0x15db39(0x14f))/0x6)+parseInt(_0x15db39(0x167))/0x7*(-parseInt(_0x15db39(0x181))/0x8)+parseInt(_0x15db39(0x146))/0x9*(parseInt(_0x15db39(0x164))/0xa)+-parseInt(_0x15db39(0x17f))/0xb;if(_0x591371===_0x3a8e84)break;else _0x5dbd72['push'](_0x5dbd72['shift']());}catch(_0x4ec90f){_0x5dbd72['push'](_0x5dbd72['shift']());}}}(a185_0x2d78,0x4787e));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(_0x2413ad){const _0xdb2d5a=a185_0x1823;if(_0x2413ad==='mybatisXml')return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0xdb2d5a(0x15c),_0xdb2d5a(0x147),'']['join']('\x0a');return[_0xdb2d5a(0x170),''][_0xdb2d5a(0x16f)]('\x0a');}export const sqlCreate={'service':a185_0x457397(0x149),'command':a185_0x457397(0x17a),'description':a185_0x457397(0x15a),'risk':a185_0x457397(0x165),'flags':[{'name':a185_0x457397(0x157),'type':a185_0x457397(0x169),'description':a185_0x457397(0x140)},{'name':a185_0x457397(0x176),'type':'number','description':a185_0x457397(0x171)},{'name':'mode','type':a185_0x457397(0x169),'enum':[a185_0x457397(0x149),'mybatisXml'],'description':a185_0x457397(0x17b)}],async 'validate'(_0x5d9b55){const _0x4fe34c=a185_0x457397;if(!_0x5d9b55[_0x4fe34c(0x150)])return;if(!_0x5d9b55['str']('name')[_0x4fe34c(0x16b)]())throw CliErrors[_0x4fe34c(0x16d)]('name',_0x4fe34c(0x178));const _0x1879bc=resolveProvidedDbId(_0x5d9b55);if(typeof _0x1879bc!==_0x4fe34c(0x161)||!Number[_0x4fe34c(0x148)](_0x1879bc)||_0x1879bc<=0x0)throw CliErrors['flagMissing'](_0x4fe34c(0x176),_0x4fe34c(0x14b));if(!_0x5d9b55[_0x4fe34c(0x159)]('mode')[_0x4fe34c(0x16b)]())throw CliErrors[_0x4fe34c(0x16d)](_0x4fe34c(0x180),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x40c745){const _0x5134de=a185_0x457397,_0x128a98=loadSqlProjectConfig(_0x40c745['appCode']),{sqlName:_0x38dad2,dbId:_0x2dcdde,dbName:_0x442028,mode:_0x2d345e}=await resolveSqlNewInputs(_0x40c745),_0x25e35a=buildSqlRelativePath('<server-generated-sqlCode>',_0x38dad2,_0x442028,_0x2d345e,_0x2dcdde),_0x1cd1c0=_0x128a98[_0x5134de(0x15f)]+'/'+_0x25e35a;return{'method':'POST','url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x40c745[_0x5134de(0x174)],'sqlName':_0x38dad2,'dbId':_0x2dcdde,'mode':_0x2d345e,'localPath':_0x1cd1c0},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x128a98[_0x5134de(0x15f)]};},async 'execute'(_0x1ae5f6){const _0x15bd31=a185_0x457397,_0x150bc6=loadSqlProjectConfig(_0x1ae5f6[_0x15bd31(0x174)]),{sqlName:_0x3043d5,dbId:_0x225040,dbName:_0x455f00,mode:_0x2f4f23}=await resolveSqlNewInputs(_0x1ae5f6),_0x703e80=generateSqlTemplate(_0x2f4f23),_0x5c085c=await createSqlQuery({'appCode':_0x1ae5f6[_0x15bd31(0x174)],'sqlName':_0x3043d5,'dbId':_0x225040,'sqlContent':_0x703e80}),_0x13d7ac=ensureRemoteSqlContent(_0x5c085c),_0x2044db=_0x455f00||await getDbName(_0x1ae5f6[_0x15bd31(0x174)],_0x225040)[_0x15bd31(0x145)](()=>undefined),_0x5db2b4=buildSqlRelativePath(_0x5c085c[_0x15bd31(0x141)],_0x5c085c[_0x15bd31(0x172)],_0x2044db,_0x2f4f23,_0x225040),_0x18f5be=_0x150bc6[_0x15bd31(0x15f)]+'/'+_0x5db2b4,_0x12641e=buildLocalSqlFileContent({'sqlCode':_0x5c085c[_0x15bd31(0x141)],'sqlName':_0x5c085c[_0x15bd31(0x172)],'dbId':_0x5c085c['dbId']},_0x13d7ac,{'dbName':_0x2044db,'mode':_0x2f4f23,'syncedAt':new Date()[_0x15bd31(0x16e)](),'description':_0x5c085c[_0x15bd31(0x144)]});if(await fileExists(_0x18f5be))throw CliErrors[_0x15bd31(0x182)](_0x15bd31(0x15d)+_0x18f5be);await ensureParentDirectory(_0x18f5be),await writeFile(_0x18f5be,_0x12641e,_0x15bd31(0x154));const _0x10f77a=await readSqlLockFile(_0x150bc6[_0x15bd31(0x17c)]),{lockData:_0x19416a,appLock:_0x2b11ea}=ensureSqlLockScope(_0x10f77a??createEmptySqlLock(),_0x150bc6['appCode'],_0x150bc6[_0x15bd31(0x142)],_0x15bd31(0x14c));return _0x2b11ea[_0x15bd31(0x14e)][_0x5c085c[_0x15bd31(0x141)]]={...buildSqlLockEntry(_0x5c085c,_0x13d7ac,computeSqlContentHash(_0x12641e),{'dbName':_0x2044db}),'path':_0x5db2b4,'mode':_0x2f4f23},_0x2b11ea[_0x15bd31(0x143)]=new Date()[_0x15bd31(0x16e)](),await writeSqlLockFile(_0x150bc6[_0x15bd31(0x17c)],_0x19416a),{'ok':!![],'data':{'id':_0x5c085c['id'],'sqlCode':_0x5c085c['sqlCode'],'sqlName':_0x5c085c[_0x15bd31(0x172)],'dbId':_0x5c085c[_0x15bd31(0x175)],'path':_0x18f5be,'mode':_0x2f4f23},'message':_0x15bd31(0x168)+_0x5c085c[_0x15bd31(0x141)]};}};async function resolveSqlNewInputs(_0x290592){const _0x1d399d=await resolveSqlNameInput(_0x290592),{dbId:_0x293ace,dbName:_0x133675}=await resolveDbSelection(_0x290592),_0x34ef92=await resolveSqlModeInput(_0x290592);return{'sqlName':_0x1d399d,'dbId':_0x293ace,'dbName':_0x133675,'mode':_0x34ef92};}async function resolveSqlNameInput(_0x43c169){const _0x3799bb=a185_0x457397,_0x593ef0=_0x43c169[_0x3799bb(0x159)](_0x3799bb(0x157))[_0x3799bb(0x16b)]();if(_0x593ef0)return _0x593ef0;if(_0x43c169['nonInteractive'])throw CliErrors[_0x3799bb(0x16d)](_0x3799bb(0x157),_0x3799bb(0x178));return(await input({'message':_0x3799bb(0x166),'validate':_0x5dc076=>_0x5dc076[_0x3799bb(0x16b)]()?!![]:_0x3799bb(0x160)}))['trim']();}async function resolveDbSelection(_0x58befc){const _0x9f8ca6=a185_0x457397,_0x530cd7=resolveProvidedDbId(_0x58befc);if(typeof _0x530cd7===_0x9f8ca6(0x161)&&Number[_0x9f8ca6(0x148)](_0x530cd7)&&_0x530cd7>0x0)return{'dbId':_0x530cd7,'dbName':await getDbName(_0x58befc[_0x9f8ca6(0x174)],_0x530cd7)[_0x9f8ca6(0x145)](()=>undefined)};if(_0x58befc[_0x9f8ca6(0x150)])throw CliErrors[_0x9f8ca6(0x16d)](_0x9f8ca6(0x176),_0x9f8ca6(0x14b));const _0x3775a4=await listDatabases(_0x58befc[_0x9f8ca6(0x174)])[_0x9f8ca6(0x145)](()=>[]);if(_0x3775a4[_0x9f8ca6(0x14d)]===0x1)return{'dbId':_0x3775a4[0x0][_0x9f8ca6(0x175)],'dbName':_0x3775a4[0x0]['dbName']};if(_0x3775a4[_0x9f8ca6(0x14d)]>0x1){const _0x48cd3e=await select({'message':_0x9f8ca6(0x15b),'choices':[..._0x3775a4[_0x9f8ca6(0x16c)](_0x44f265=>({'name':_0x44f265[_0x9f8ca6(0x179)]+'\x20('+_0x44f265['dbId']+')','value':serializeDbSelection(_0x44f265)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x9f8ca6(0x152)}]});if(_0x48cd3e!=='__manual__')return deserializeDbSelection(_0x48cd3e);}const _0x3b0cac=await input({'message':'Target\x20database\x20dbId:','validate':_0x2c1d4c=>{const _0xdbbbe9=_0x9f8ca6,_0x2df917=_0x2c1d4c[_0xdbbbe9(0x16b)]();if(!_0x2df917)return _0xdbbbe9(0x173);const _0x52b5bf=Number(_0x2df917);if(!Number['isInteger'](_0x52b5bf)||_0x52b5bf<=0x0)return _0xdbbbe9(0x14a);return!![];}});return{'dbId':Number(_0x3b0cac[_0x9f8ca6(0x16b)]())};}async function resolveSqlModeInput(_0x5273df){const _0x13d386=a185_0x457397,_0x2aa072=_0x5273df[_0x13d386(0x159)](_0x13d386(0x180))[_0x13d386(0x16b)]();if(_0x2aa072===_0x13d386(0x149)||_0x2aa072===_0x13d386(0x153))return _0x2aa072;if(_0x5273df['nonInteractive'])throw CliErrors[_0x13d386(0x16d)](_0x13d386(0x180),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x13d386(0x177),'choices':[{'name':_0x13d386(0x13e),'value':_0x13d386(0x149),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x13d386(0x156),'value':'mybatisXml','description':_0x13d386(0x155)}]});}function serializeDbSelection(_0x1870cc){const _0x4df4a1=a185_0x457397;return JSON[_0x4df4a1(0x151)]({'dbId':_0x1870cc[_0x4df4a1(0x175)],'dbName':_0x1870cc['dbName']});}function a185_0x2d78(){const _0x559090=['SQL\x20query\x20display\x20name','sqlCode','sqlRoot','lastSync','description','catch','261693CkUnVs','</select>','isFinite','sql','dbId\x20must\x20be\x20a\x20positive\x20integer','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','new','length','sqls','18762DIyZul','nonInteractive','stringify','__manual__','mybatisXml','utf8','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','MyBatis\x20XML\x20(mybatisXml)','name','482978StMMix','str','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Select\x20the\x20target\x20database:','\x20\x20SELECT\x201\x20AS\x20id','File\x20already\x20exists:\x20','320915vKTQqR','sqlRootDir','SQL\x20name\x20cannot\x20be\x20empty','number','flag','304mjXrsD','170SwuASI','write','SQL\x20name:','35077iIzNPz','Created\x20SQL\x20query\x20','string','935cQQmdJ','trim','map','flagMissing','toISOString','join','SELECT\x201\x20AS\x20id;','Target\x20database\x20ID','sqlName','dbId\x20cannot\x20be\x20empty','appCode','dbId','db-id','Select\x20the\x20local\x20SQL\x20mode:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','create','Local\x20SQL\x20file\x20mode','lockFilePath','Invalid\x20database\x20selection\x20payload:\x20','8013KnBIVk','2323057PqZlwl','mode','344bjtkKO','validation','Plain\x20SQL\x20(sql)','parse'];a185_0x2d78=function(){return _0x559090;};return a185_0x2d78();}function a185_0x1823(_0x2cafd5,_0x375de1){_0x2cafd5=_0x2cafd5-0x13e;const _0x2d78e1=a185_0x2d78();let _0x1823e7=_0x2d78e1[_0x2cafd5];return _0x1823e7;}function deserializeDbSelection(_0x4b0ae1){const _0x3e15a0=a185_0x457397;try{const _0x5296ba=JSON[_0x3e15a0(0x13f)](_0x4b0ae1);if(typeof _0x5296ba[_0x3e15a0(0x175)]===_0x3e15a0(0x161)&&Number[_0x3e15a0(0x148)](_0x5296ba[_0x3e15a0(0x175)]))return{'dbId':_0x5296ba['dbId'],'dbName':_0x5296ba[_0x3e15a0(0x179)]};}catch{}throw CliErrors[_0x3e15a0(0x182)](_0x3e15a0(0x17d)+_0x4b0ae1);}function resolveProvidedDbId(_0x1960c4){const _0x154ce0=a185_0x457397,_0x259c95=_0x1960c4[_0x154ce0(0x162)](_0x154ce0(0x176));if(typeof _0x259c95==='number'&&Number[_0x154ce0(0x148)](_0x259c95))return _0x259c95;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a186_0x37de(_0x2566ce,_0x6e314a){_0x2566ce=_0x2566ce-0x96;const _0x17bbe1=a186_0x17bb();let _0x37de20=_0x17bbe1[_0x2566ce];return _0x37de20;}const a186_0x26778f=a186_0x37de;(function(_0x575aba,_0x3f123f){const _0x4b2c30=a186_0x37de,_0x208100=_0x575aba();while(!![]){try{const _0x3fd963=parseInt(_0x4b2c30(0xb1))/0x1+parseInt(_0x4b2c30(0x96))/0x2+parseInt(_0x4b2c30(0xa5))/0x3*(-parseInt(_0x4b2c30(0x9b))/0x4)+-parseInt(_0x4b2c30(0x98))/0x5+-parseInt(_0x4b2c30(0xa4))/0x6+parseInt(_0x4b2c30(0xaa))/0x7*(parseInt(_0x4b2c30(0xb4))/0x8)+parseInt(_0x4b2c30(0xb3))/0x9*(-parseInt(_0x4b2c30(0xa3))/0xa);if(_0x3fd963===_0x3f123f)break;else _0x208100['push'](_0x208100['shift']());}catch(_0x2e0423){_0x208100['push'](_0x208100['shift']());}}}(a186_0x17bb,0x6fa79));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a186_0x17bb(){const _0x383df7=['sql','str','toISOString','322373UYlUui','validation','3179871fHNirC','6516248PCEJmW','filter','length','remoteId','trashedTo','472094OqzRXU','entries','1464200adOuUf','replace','sqlRoot','8mhYauY','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','Deleted\x20','POST','sqlRootDir','sqlcode','lockFilePath','appCode','10xDgtiV','1470798QzGAhr','36483BsRreJ','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','projectRoot','delete','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','7ERIyxW','startsWith','sqls','trashDir'];a186_0x17bb=function(){return _0x383df7;};return a186_0x17bb();}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':a186_0x26778f(0xae),'command':a186_0x26778f(0xa8),'description':a186_0x26778f(0xa9),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x93c4b7){const _0x1ba423=a186_0x26778f,_0xf610de=loadSqlProjectConfig(_0x93c4b7[_0x1ba423(0xa2)]),_0x59f04a=await readSqlLockFile(_0xf610de[_0x1ba423(0xa1)]);if(!_0x59f04a)throw CliErrors['validation'](_0x1ba423(0xa6));},async 'dryRun'(_0x2169bb){const _0x355f9a=a186_0x26778f,_0x52814d=loadSqlProjectConfig(_0x2169bb[_0x355f9a(0xa2)]),_0x45b89e=await readSqlLockFile(_0x52814d[_0x355f9a(0xa1)]);if(!_0x45b89e)throw CliErrors[_0x355f9a(0xb2)](_0x355f9a(0xa6));const {appLock:_0x5bd1e0}=ensureSqlLockScope(_0x45b89e,_0x2169bb[_0x355f9a(0xa2)],_0x52814d[_0x355f9a(0x9a)],_0x355f9a(0xa8)),_0x32317f=_0x2169bb[_0x355f9a(0xaf)](_0x355f9a(0xa0)),_0x35bc67=_0x5bd1e0[_0x355f9a(0xac)][_0x32317f];if(!_0x35bc67)throw CliErrors[_0x355f9a(0xb2)](_0x355f9a(0x9c)+_0x32317f+'\x22.');return{'method':_0x355f9a(0x9e),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x32317f,'id':_0x35bc67['remoteId'],'localPath':resolveLocalSqlFilePath(_0x52814d,_0x32317f,_0x35bc67)},'description':'Would\x20delete\x20SQL\x20'+_0x32317f+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x52814d[_0x355f9a(0xad)]};},async 'execute'(_0x23834d){const _0x580758=a186_0x26778f,_0x1f5268=loadSqlProjectConfig(_0x23834d[_0x580758(0xa2)]),_0x5da37a=await readSqlLockFile(_0x1f5268[_0x580758(0xa1)]);if(!_0x5da37a)throw CliErrors[_0x580758(0xb2)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x2cafb0,appLock:_0x2f2345}=ensureSqlLockScope(_0x5da37a,_0x23834d[_0x580758(0xa2)],_0x1f5268['sqlRoot'],'delete'),_0x3c868e=_0x23834d[_0x580758(0xaf)]('sqlcode'),_0x2440a2=_0x2f2345[_0x580758(0xac)][_0x3c868e];if(!_0x2440a2)throw CliErrors['validation'](_0x580758(0x9c)+_0x3c868e+'\x22.');await deleteSqlQuery({'id':_0x2440a2[_0x580758(0xb7)],'sqlCode':_0x3c868e}),_0x2f2345['sqls']=Object['fromEntries'](Object[_0x580758(0x97)](_0x2f2345[_0x580758(0xac)])[_0x580758(0xb5)](([_0x22e129])=>_0x22e129!==_0x3c868e)),_0x2f2345['lastSync']=new Date()[_0x580758(0xb0)](),await writeSqlLockFile(_0x1f5268[_0x580758(0xa1)],_0x2cafb0);const _0x55674c=resolveLocalSqlFilePath(_0x1f5268,_0x3c868e,_0x2440a2);let _0x271572;await fileExists(_0x55674c)&&(_0x271572=await moveToTrash(_0x1f5268[_0x580758(0xa7)],_0x1f5268['trashDir'],_0x55674c),await cleanupEmptyDirectories(dirname(_0x55674c),_0x1f5268[_0x580758(0x9f)]));const _0x50e955={'deleted':_0x3c868e,'remoteId':_0x2440a2[_0x580758(0xb7)]};if(_0x271572)_0x50e955[_0x580758(0xb8)]=_0x271572;return{'ok':!![],'data':_0x50e955,'message':_0x580758(0x9d)+_0x3c868e+(_0x271572?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x1fb8cc,_0x43caa8,_0x3ca563){const _0x25b7d1=a186_0x26778f,_0x30e504=new Date()[_0x25b7d1(0xb0)]()[_0x25b7d1(0x99)](/[:.]/g,'-'),_0x6c099=relative(_0x1fb8cc,_0x3ca563),_0x3e79e4=join(_0x43caa8,_0x30e504,_0x6c099);return await mkdir(dirname(_0x3e79e4),{'recursive':!![]}),await rename(_0x3ca563,_0x3e79e4),_0x3e79e4;}async function cleanupEmptyDirectories(_0x1c7da5,_0x3bae9b){const _0x2b2c70=a186_0x26778f;let _0x7474d8=resolve(_0x1c7da5);const _0x55dfd3=resolve(_0x3bae9b);while(_0x7474d8[_0x2b2c70(0xab)](''+_0x55dfd3+sep)||_0x7474d8===_0x55dfd3){if(_0x7474d8===_0x55dfd3)return;try{const _0xe5e9a2=await readdir(_0x7474d8);if(_0xe5e9a2[_0x2b2c70(0xb6)]>0x0)return;await rmdir(_0x7474d8);}catch{return;}_0x7474d8=dirname(_0x7474d8);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a187_0x424a89=a187_0x5629;function a187_0x5629(_0x278ab5,_0xb87336){_0x278ab5=_0x278ab5-0x8f;const _0x540e8d=a187_0x540e();let _0x5629d5=_0x540e8d[_0x278ab5];return _0x5629d5;}function a187_0x540e(){const _0x1697a9=['Return\x20full\x20raw\x20SQL\x20query\x20object','detail','sqlName','59474fbwsry','169593bJGxDM','sql','str','sqlcode','346040whNDmi','appCode','boolean','dbId','verbose','198lMOioO','9416oYZnUo','4977JWpUuH','3489110Mkwhby','795463xGOlBn','bool','12qZTTWP','sqlCode','4598760XYsCHc'];a187_0x540e=function(){return _0x1697a9;};return a187_0x540e();}(function(_0x28776f,_0x554fc9){const _0xaa07ec=a187_0x5629,_0x2628ee=_0x28776f();while(!![]){try{const _0x527632=parseInt(_0xaa07ec(0xa0))/0x1+-parseInt(_0xaa07ec(0x92))/0x2+-parseInt(_0xaa07ec(0x93))/0x3*(parseInt(_0xaa07ec(0xa2))/0x4)+parseInt(_0xaa07ec(0x9f))/0x5+-parseInt(_0xaa07ec(0xa4))/0x6+-parseInt(_0xaa07ec(0x9e))/0x7*(parseInt(_0xaa07ec(0x9d))/0x8)+-parseInt(_0xaa07ec(0x9c))/0x9*(-parseInt(_0xaa07ec(0x97))/0xa);if(_0x527632===_0x554fc9)break;else _0x2628ee['push'](_0x2628ee['shift']());}catch(_0x26c609){_0x2628ee['push'](_0x2628ee['shift']());}}}(a187_0x540e,0x6e560));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a187_0x424a89(0x94),'command':a187_0x424a89(0x90),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a187_0x424a89(0x9b),'type':a187_0x424a89(0x99),'description':a187_0x424a89(0x8f)}],async 'execute'(_0x37584f){const _0x4f058b=a187_0x424a89,_0x3e1d46=await getSqlQueryInfo(_0x37584f[_0x4f058b(0x98)],_0x37584f[_0x4f058b(0x95)](_0x4f058b(0x96))),_0x574e21=_0x37584f[_0x4f058b(0xa1)](_0x4f058b(0x9b));if(_0x574e21)return{'ok':!![],'data':_0x3e1d46};const _0x51d680=_0x3e1d46[_0x4f058b(0x9a)]?await getDbName(_0x37584f[_0x4f058b(0x98)],_0x3e1d46[_0x4f058b(0x9a)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3e1d46[_0x4f058b(0xa3)],'sqlName':_0x3e1d46[_0x4f058b(0x91)],'db':_0x51d680?_0x51d680+'\x20('+_0x3e1d46[_0x4f058b(0x9a)]+')':_0x3e1d46[_0x4f058b(0x9a)]??'','description':_0x3e1d46['description']??'','sqlContent':_0x3e1d46['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a188_0x4e226d=a188_0x3b50;(function(_0x2ae646,_0x2ddf73){const _0x1fe714=a188_0x3b50,_0x4570ab=_0x2ae646();while(!![]){try{const _0x53ce5b=-parseInt(_0x1fe714(0x196))/0x1*(parseInt(_0x1fe714(0x1a1))/0x2)+parseInt(_0x1fe714(0x18e))/0x3+-parseInt(_0x1fe714(0x18c))/0x4*(parseInt(_0x1fe714(0x192))/0x5)+-parseInt(_0x1fe714(0x194))/0x6*(parseInt(_0x1fe714(0x189))/0x7)+-parseInt(_0x1fe714(0x195))/0x8*(parseInt(_0x1fe714(0x19d))/0x9)+parseInt(_0x1fe714(0x197))/0xa+parseInt(_0x1fe714(0x190))/0xb;if(_0x53ce5b===_0x2ddf73)break;else _0x4570ab['push'](_0x4570ab['shift']());}catch(_0x14dd73){_0x4570ab['push'](_0x4570ab['shift']());}}}(a188_0x5d37,0xe6bfd));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a188_0x5d37(){const _0x3f20a2=['SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','isArray','10720881EAZVfi','SQL\x20execution\x20failed','\x20row(s)\x20in\x20','Returned\x20','12418iRKBnw','execSuccess','sqlcode','11948153SHEtSA','params','appCode','143492mAdPQg','string','5013228vlBVzU','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','34573407PzMpFL','execResult','145dinTBE','sql','6euNbsh','8iFzjKD','151ZMpNWl','10070000sqccBp','str','length','execError'];a188_0x5d37=function(){return _0x3f20a2;};return a188_0x5d37();}function a188_0x3b50(_0x29bec6,_0xa956e1){_0x29bec6=_0x29bec6-0x187;const _0x5d3748=a188_0x5d37();let _0x3b5038=_0x5d3748[_0x29bec6];return _0x3b5038;}export const sqlExec={'service':a188_0x4e226d(0x193),'command':'exec','description':a188_0x4e226d(0x18f),'risk':'read','flags':[SQLCODE_FLAG,{'name':a188_0x4e226d(0x18a),'type':a188_0x4e226d(0x18d),'description':a188_0x4e226d(0x19b)}],async 'execute'(_0x17a6a8){const _0x2e947e=a188_0x4e226d,_0x529e00=parseJsonParams(_0x17a6a8[_0x2e947e(0x198)](_0x2e947e(0x18a))),_0x43b206=Date['now'](),_0x49e40f=await executeSql(_0x17a6a8[_0x2e947e(0x18b)],_0x17a6a8[_0x2e947e(0x198)](_0x2e947e(0x188)),_0x529e00),_0x8cd90d=Date['now']()-_0x43b206,_0x445e82=_0x49e40f?.[_0x2e947e(0x191)]??_0x49e40f,_0x149ec5=_0x49e40f?.[_0x2e947e(0x187)]??!![];if(!_0x149ec5)return{'ok':![],'data':{'error':_0x49e40f?.[_0x2e947e(0x19a)]||_0x2e947e(0x19e),'elapsed':_0x8cd90d},'message':_0x2e947e(0x19e)};const _0x1128f3=Array[_0x2e947e(0x19c)](_0x445e82)?_0x445e82:[];return{'ok':!![],'data':{'rows':_0x1128f3,'rowCount':_0x1128f3[_0x2e947e(0x199)],'elapsed':_0x8cd90d},'message':_0x2e947e(0x1a0)+_0x1128f3[_0x2e947e(0x199)]+_0x2e947e(0x19f)+_0x8cd90d+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a189_0x5832(){const _0x5a69a2=['48IvSKZQ','316PwjrMq','161544bRKfUD','2058110oPGXux','72401QEnybY','1149ATVsDd','398142uOFBEF','365PiXzvy','3352CSkPJK','51121PqmFAq'];a189_0x5832=function(){return _0x5a69a2;};return a189_0x5832();}(function(_0x57d52f,_0x357db8){const _0x34ad15=a189_0x578f,_0x5db901=_0x57d52f();while(!![]){try{const _0x1d2b45=parseInt(_0x34ad15(0x1d2))/0x1+-parseInt(_0x34ad15(0x1d4))/0x2*(parseInt(_0x34ad15(0x1ce))/0x3)+-parseInt(_0x34ad15(0x1d1))/0x4*(parseInt(_0x34ad15(0x1d0))/0x5)+-parseInt(_0x34ad15(0x1d3))/0x6*(-parseInt(_0x34ad15(0x1d7))/0x7)+-parseInt(_0x34ad15(0x1d5))/0x8+-parseInt(_0x34ad15(0x1cf))/0x9+parseInt(_0x34ad15(0x1d6))/0xa;if(_0x1d2b45===_0x357db8)break;else _0x5db901['push'](_0x5db901['shift']());}catch(_0x3fef89){_0x5db901['push'](_0x5db901['shift']());}}}(a189_0x5832,0x257d5));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a189_0x578f(_0x44097e,_0x4b38e5){_0x44097e=_0x44097e-0x1ce;const _0x5832f6=a189_0x5832();let _0x578fd9=_0x5832f6[_0x44097e];return _0x578fd9;}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a190_0x5410(_0x3b5eeb,_0xd12afc){_0x3b5eeb=_0x3b5eeb-0x147;const _0x4ed60d=a190_0x4ed6();let _0x5410f6=_0x4ed60d[_0x3b5eeb];return _0x5410f6;}const a190_0x4e970f=a190_0x5410;(function(_0x15d14d,_0x51a72f){const _0x5bc308=a190_0x5410,_0x161761=_0x15d14d();while(!![]){try{const _0x222374=parseInt(_0x5bc308(0x163))/0x1+parseInt(_0x5bc308(0x153))/0x2+parseInt(_0x5bc308(0x14f))/0x3*(-parseInt(_0x5bc308(0x15d))/0x4)+parseInt(_0x5bc308(0x156))/0x5+-parseInt(_0x5bc308(0x155))/0x6+-parseInt(_0x5bc308(0x162))/0x7+parseInt(_0x5bc308(0x152))/0x8*(-parseInt(_0x5bc308(0x15e))/0x9);if(_0x222374===_0x51a72f)break;else _0x161761['push'](_0x161761['shift']());}catch(_0x4008e){_0x161761['push'](_0x161761['shift']());}}}(a190_0x4ed6,0xc52b7));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a190_0x4ed6(){const _0x504155=['name','Page\x20number','paging','List\x20custom\x20SQL\x20queries','read','136Njpzpu','4191939gTESCc','appCode','Filter\x20by\x20SQL\x20name','map','489615hicEXT','478335PsKHvV','pagesize','string','num','number','bool','sqlName','sqlcode','page','tableData','all','length','123666FJwYdy','\x20SQL\x20queries\x20(total:\x20','dbId','8TIRyqE','2654136BkidUD','boolean','996030TuKDjJ','5527365xTMNTA','verbose'];a190_0x4ed6=function(){return _0x504155;};return a190_0x4ed6();}export const sqlList={'service':'sql','command':'list','description':a190_0x4e970f(0x15b),'risk':a190_0x4e970f(0x15c),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x4e970f(0x158),'type':a190_0x4e970f(0x165),'description':a190_0x4e970f(0x160)},{'name':a190_0x4e970f(0x14b),'type':a190_0x4e970f(0x147),'description':a190_0x4e970f(0x159),'default':0x1},{'name':a190_0x4e970f(0x164),'type':a190_0x4e970f(0x147),'description':'Page\x20size'},{'name':a190_0x4e970f(0x157),'type':a190_0x4e970f(0x154),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x46b992){const _0x44b0b1=a190_0x4e970f,_0x174707=await listSqlQueries(_0x46b992[_0x44b0b1(0x15f)],{'sqlCode':_0x46b992['str'](_0x44b0b1(0x14a))||undefined,'sqlName':_0x46b992['str'](_0x44b0b1(0x158))||undefined,'currentPage':_0x46b992['num'](_0x44b0b1(0x14b)),'pageSize':_0x46b992[_0x44b0b1(0x166)](_0x44b0b1(0x164),0x32)}),_0x2eacaf=_0x46b992[_0x44b0b1(0x148)]('verbose'),_0x14a906=_0x174707[_0x44b0b1(0x14c)]??[],_0x3be15c=_0x174707[_0x44b0b1(0x15a)]?.['totalCount']??_0x14a906['length'];let _0x2bebb8;return _0x2eacaf?_0x2bebb8=_0x14a906:_0x2bebb8=await Promise[_0x44b0b1(0x14d)](_0x14a906[_0x44b0b1(0x161)](async _0x172397=>{const _0x53c662=_0x44b0b1;let _0x578689;try{_0x578689=_0x172397[_0x53c662(0x151)]?await getDbName(_0x46b992['appCode'],_0x172397['dbId']):undefined;}catch{}return{'sqlCode':_0x172397['sqlCode'],'sqlName':_0x172397[_0x53c662(0x149)],'description':_0x172397['description']??'','db':_0x578689?_0x578689+'\x20('+_0x172397['dbId']+')':_0x172397[_0x53c662(0x151)]??''};})),{'ok':!![],'data':_0x2bebb8,'message':_0x14a906[_0x44b0b1(0x14e)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x14a906[_0x44b0b1(0x14e)]+_0x44b0b1(0x150)+_0x3be15c+').'};}};
|