@lovrabet/rabetbase-cli 2.4.6 → 2.4.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- 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/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/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.d.ts +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/get.js +1 -1
- package/lib/commands/config/index.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/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/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/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/init/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.d.ts +2 -0
- package/lib/commands/kb/search.js +1 -0
- 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/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +17 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.d.ts +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.d.ts +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.d.ts +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.d.ts +2 -2
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/types.d.ts +1 -1
- package/lib/core/bff/utils.d.ts +2 -2
- 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/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -2
- package/sidecar/flags.json +1 -1
- package/skills/rabetbase/SKILL.md +30 -30
- package/skills/rabetbase/guides/backend-function.md +30 -30
- package/skills/rabetbase/guides/best-practices.md +8 -8
- package/skills/rabetbase/guides/bff-creation-workflow.md +16 -16
- package/skills/rabetbase/guides/conflict-detection.md +3 -3
- package/skills/rabetbase/guides/custom-page-workflow.md +8 -8
- package/skills/rabetbase/guides/data-api-guidelines.md +6 -6
- package/skills/rabetbase/guides/legacy-application-blueprint-workflow.md +8 -8
- package/skills/rabetbase/guides/sql-creation-workflow.md +2 -2
- package/skills/rabetbase/guides/troubleshooting.md +6 -6
- package/skills/rabetbase/guides/typescript-sdk.md +10 -10
- package/skills/rabetbase/knowledge/page-schema/LrSmartTable.md +1 -1
- package/skills/rabetbase/knowledge/page-schema/external-resources-usage.md +10 -10
- package/skills/rabetbase/references/rabetbase-app-config.md +2 -2
- package/skills/rabetbase/references/rabetbase-bff-create.md +3 -3
- package/skills/rabetbase/references/rabetbase-bff-delete.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-detail.md +4 -4
- package/skills/rabetbase/references/rabetbase-bff-list.md +8 -8
- package/skills/rabetbase/references/rabetbase-bff-pull.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-push.md +3 -3
- package/skills/rabetbase/references/rabetbase-bff-status.md +1 -1
- package/skills/rabetbase/references/rabetbase-codegen-sql.md +3 -3
- package/skills/rabetbase/references/rabetbase-dataset-detail.md +1 -1
- package/skills/rabetbase/references/rabetbase-kb.md +13 -3
- package/skills/rabetbase/references/rabetbase-notification-config-list.md +3 -3
- package/skills/rabetbase.manifest.json +3 -3
- package/templates/rules/lovrabet_rules.mdc.tpl +7 -7
- package/templates/skill/SKILL.md.tpl +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a175_0x3c56(){const _0x57ca3d=['1314044gFhiDs','32108427bFCTKl','roleName','3102232GsjpTH','high-risk-write','role','\x20(id=','Deleted\x20role\x20','appCode','userCount','4412429TPVmCI','3TuqvfS','9605580TJnqBr','POST','num','dev','Role\x20still\x20has\x20','5376565QRuShq','238087FSMnVI','\x20member(s);\x20they\x20will\x20lose\x20this\x20group.','Delete\x20a\x20CUSTOM\x20role\x20(built-in\x20roles\x20rejected);\x20requires\x20--yes','delete','10yurNpD'];a175_0x3c56=function(){return _0x57ca3d;};return a175_0x3c56();}function a175_0x2e89(_0x32d338,_0x2f2112){_0x32d338=_0x32d338-0x148;const _0x3c56a9=a175_0x3c56();let _0x2e89f2=_0x3c56a9[_0x32d338];return _0x2e89f2;}const a175_0x4e6c82=a175_0x2e89;(function(_0x50efe6,_0x5bb2ef){const _0x4238e6=a175_0x2e89,_0x4c807a=_0x50efe6();while(!![]){try{const _0x1fc232=parseInt(_0x4238e6(0x15c))/0x1*(parseInt(_0x4238e6(0x149))/0x2)+-parseInt(_0x4238e6(0x155))/0x3*(-parseInt(_0x4238e6(0x14a))/0x4)+parseInt(_0x4238e6(0x15b))/0x5+parseInt(_0x4238e6(0x156))/0x6+parseInt(_0x4238e6(0x154))/0x7+-parseInt(_0x4238e6(0x14d))/0x8+-parseInt(_0x4238e6(0x14b))/0x9;if(_0x1fc232===_0x5bb2ef)break;else _0x4c807a['push'](_0x4c807a['shift']());}catch(_0x225230){_0x4c807a['push'](_0x4c807a['shift']());}}}(a175_0x3c56,0xd470a));import{deleteAppRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';const DELETE_PATH='/smartapi/permit/role/delete';export const roleDelete={'service':a175_0x4e6c82(0x14f),'command':'delete','description':a175_0x4e6c82(0x15e),'risk':a175_0x4e6c82(0x14e),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x535e79){const _0x199a40=a175_0x4e6c82,_0x299d6c=_0x535e79[_0x199a40(0x158)]('id'),_0x394a6d=await getRoleById(_0x535e79['appCode'],_0x299d6c);return assertCustomRole(_0x394a6d,'delete'),asDryRunResult({'scope':'dev','operation':_0x199a40(0x148),'selector':{'appCode':_0x535e79[_0x199a40(0x152)],'roleId':_0x299d6c,'roleName':_0x394a6d[_0x199a40(0x14c)]},'before':projectRole(_0x394a6d),'after':null,'dryRun':!![],'backend':{'method':_0x199a40(0x157),'path':DELETE_PATH},'warnings':_0x394a6d[_0x199a40(0x153)]>0x0?[_0x199a40(0x15a)+_0x394a6d['userCount']+_0x199a40(0x15d)]:[]},{'method':_0x199a40(0x157),'url':DELETE_PATH});},async 'execute'(_0x2544d5){const _0x5496e4=a175_0x4e6c82,_0x3f5272=_0x2544d5['num']('id'),_0x39bbb7=await getRoleById(_0x2544d5['appCode'],_0x3f5272);return assertCustomRole(_0x39bbb7,_0x5496e4(0x148)),await deleteAppRole(_0x3f5272),{'ok':!![],'data':{'scope':_0x5496e4(0x159),'operation':_0x5496e4(0x148),'selector':{'appCode':_0x2544d5[_0x5496e4(0x152)],'roleId':_0x3f5272,'roleName':_0x39bbb7[_0x5496e4(0x14c)]},'before':projectRole(_0x39bbb7),'after':null,'dryRun':![],'backend':{'method':_0x5496e4(0x157),'path':DELETE_PATH},'warnings':[]},'message':_0x5496e4(0x151)+_0x39bbb7[_0x5496e4(0x14c)]+_0x5496e4(0x150)+_0x3f5272+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a176_0x354443=a176_0x548f;function a176_0xf6cc(){const _0x3cdb67=['1017573DhLTvS','num','16tJFAtY','Role\x20','2sIZATK','337450ytgRuw','detail','roleType','45XNKAcE','1407183iTorkW','roleName','313964FDMMJs','dev','2115981KXaLpl','9304872hpgQdr','1434391fyrnih'];a176_0xf6cc=function(){return _0x3cdb67;};return a176_0xf6cc();}(function(_0xd1c3f3,_0x3630d6){const _0x2ad9d9=a176_0x548f,_0x258938=_0xd1c3f3();while(!![]){try{const _0xa0756c=-parseInt(_0x2ad9d9(0x143))/0x1+-parseInt(_0x2ad9d9(0x147))/0x2*(parseInt(_0x2ad9d9(0x13c))/0x3)+-parseInt(_0x2ad9d9(0x13e))/0x4*(-parseInt(_0x2ad9d9(0x13b))/0x5)+parseInt(_0x2ad9d9(0x141))/0x6+-parseInt(_0x2ad9d9(0x142))/0x7*(-parseInt(_0x2ad9d9(0x145))/0x8)+-parseInt(_0x2ad9d9(0x140))/0x9+-parseInt(_0x2ad9d9(0x148))/0xa;if(_0xa0756c===_0x3630d6)break;else _0x258938['push'](_0x258938['shift']());}catch(_0x22e53b){_0x258938['push'](_0x258938['shift']());}}}(a176_0xf6cc,0xde8d1));function a176_0x548f(_0x446e55,_0x45df21){_0x446e55=_0x446e55-0x13b;const _0xf6ccde=a176_0xf6cc();let _0x548f30=_0xf6ccde[_0x446e55];return _0x548f30;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';export const roleDetail={'service':'role','command':a176_0x354443(0x149),'description':'Show\x20a\x20single\x20role\x27s\x20detail','risk':'read','flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0xd24364){const _0x5e1852=a176_0x354443,_0x5d38c9=_0xd24364[_0x5e1852(0x144)]('id'),_0x25c300=await getRoleById(_0xd24364['appCode'],_0x5d38c9);return{'ok':!![],'data':{'scope':_0x5e1852(0x13f),'role':projectRole(_0x25c300)},'message':_0x5e1852(0x146)+_0x25c300[_0x5e1852(0x13d)]+'\x20('+_0x25c300[_0x5e1852(0x14a)]+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1b9de5,_0x425747){const _0x2012dd=a177_0x1735,_0x15e597=_0x1b9de5();while(!![]){try{const _0x3aea13=-parseInt(_0x2012dd(0xe2))/0x1+-parseInt(_0x2012dd(0xea))/0x2*(-parseInt(_0x2012dd(0xe6))/0x3)+-parseInt(_0x2012dd(0xe5))/0x4*(-parseInt(_0x2012dd(0xe4))/0x5)+-parseInt(_0x2012dd(0xe9))/0x6+parseInt(_0x2012dd(0xe7))/0x7*(-parseInt(_0x2012dd(0xdf))/0x8)+parseInt(_0x2012dd(0xe8))/0x9*(parseInt(_0x2012dd(0xe3))/0xa)+parseInt(_0x2012dd(0xe0))/0xb*(parseInt(_0x2012dd(0xe1))/0xc);if(_0x3aea13===_0x425747)break;else _0x15e597['push'](_0x15e597['shift']());}catch(_0x3fb85a){_0x15e597['push'](_0x15e597['shift']());}}}(a177_0x1ce9,0xb11aa));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 a177_0x1ce9(){const _0x250a5f=['8foYOVP','998833osCAoI','156HtSePB','1028518fLZPXL','10JKkvvm','5371720lnNdYq','4VYTiGV','165elUTdv','3824891qhTlwd','3444723CEuGCu','3712356lzXMjz','10238eLKrBC'];a177_0x1ce9=function(){return _0x250a5f;};return a177_0x1ce9();}function a177_0x1735(_0x4b2cc2,_0x558230){_0x4b2cc2=_0x4b2cc2-0xdf;const _0x1ce979=a177_0x1ce9();let _0x173523=_0x1ce979[_0x4b2cc2];return _0x173523;}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 a178_0xa37468=a178_0x1396;(function(_0x3667f5,_0x4392c2){const _0x3d6600=a178_0x1396,_0x10b306=_0x3667f5();while(!![]){try{const _0x17c62c=parseInt(_0x3d6600(0x94))/0x1+-parseInt(_0x3d6600(0x7f))/0x2*(parseInt(_0x3d6600(0x8f))/0x3)+parseInt(_0x3d6600(0x92))/0x4*(-parseInt(_0x3d6600(0x72))/0x5)+parseInt(_0x3d6600(0x90))/0x6+-parseInt(_0x3d6600(0x7c))/0x7*(parseInt(_0x3d6600(0x78))/0x8)+-parseInt(_0x3d6600(0x80))/0x9+parseInt(_0x3d6600(0x7e))/0xa*(parseInt(_0x3d6600(0x82))/0xb);if(_0x17c62c===_0x4392c2)break;else _0x10b306['push'](_0x10b306['shift']());}catch(_0x198666){_0x10b306['push'](_0x10b306['shift']());}}}(a178_0x769a,0x4973c));import{listAppRoles}from'../../core/api-client.js';function a178_0x769a(){const _0x493f49=['pagesize','Filter\x20by\x20role\x20type','40JyQper','DEV','type','string','467222TrSKLh','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','50YIIKlu','449698WaRtvp','5293854IFyIvX','\x20role(s)','2715207JRJDhL','role','number','filter','includes','num','Page\x20index\x20(1-based)','trim','validation','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','toUpperCase','dev','Invalid\x20--type\x20\x22','6lIGsxw','2243352gWIBMw','roleType','475140UfxWue','--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.','301987jRMAvu','list','ADMIN','CUSTOM','10kYJrIG','str','map','page'];a178_0x769a=function(){return _0x493f49;};return a178_0x769a();}function a178_0x1396(_0x464121,_0x2f1dcd){_0x464121=_0x464121-0x6f;const _0x769ac2=a178_0x769a();let _0x1396a8=_0x769ac2[_0x464121];return _0x1396a8;}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=[a178_0xa37468(0x70),a178_0xa37468(0x79),'OWNER',a178_0xa37468(0x71)];export const roleList={'service':a178_0xa37468(0x83),'command':a178_0xa37468(0x6f),'description':a178_0xa37468(0x7d),'risk':'read','flags':[APPCODE_FLAG_OPTIONAL,{'name':'type','type':a178_0xa37468(0x7b),'required':![],'description':a178_0xa37468(0x77),'enum':ROLE_TYPES},{'name':a178_0xa37468(0x75),'type':a178_0xa37468(0x84),'description':a178_0xa37468(0x88),'default':0x1},{'name':'pagesize','type':a178_0xa37468(0x84),'description':'Page\x20size\x20(1-100)','default':0x64}],async 'validate'(_0x28d687){const _0x1aef02=a178_0xa37468,_0x334ad4=_0x28d687[_0x1aef02(0x73)]('type')[_0x1aef02(0x89)]();if(_0x334ad4&&!ROLE_TYPES[_0x1aef02(0x86)](_0x334ad4[_0x1aef02(0x8c)]()))throw CliErrors[_0x1aef02(0x8a)](_0x1aef02(0x8e)+_0x334ad4+'\x22.','Use\x20one\x20of:\x20'+ROLE_TYPES['join'](',\x20')+'.');const _0x4ae87c=_0x28d687['num']('page',0x1),_0x228164=_0x28d687[_0x1aef02(0x87)](_0x1aef02(0x76),0x64);if(_0x4ae87c<0x1)throw CliErrors[_0x1aef02(0x8a)](_0x1aef02(0x93));if(_0x228164<0x1||_0x228164>0x64)throw CliErrors['validation'](_0x1aef02(0x8b));},async 'execute'(_0x3e904d){const _0x7ff71c=a178_0xa37468,_0x160a57=_0x3e904d[_0x7ff71c(0x87)](_0x7ff71c(0x75),0x1)||0x1,_0x2ee743=_0x3e904d[_0x7ff71c(0x87)](_0x7ff71c(0x76),0x64)||0x64,_0x39ccfe=_0x3e904d['str'](_0x7ff71c(0x7a))[_0x7ff71c(0x89)]()[_0x7ff71c(0x8c)](),{items:_0x37c62b,paging:_0x31660a}=await listAppRoles(_0x3e904d['appCode'],{'currentPage':_0x160a57,'pageSize':_0x2ee743}),_0x5afd4d=_0x39ccfe?_0x37c62b[_0x7ff71c(0x85)](_0x4426c6=>_0x4426c6[_0x7ff71c(0x91)]===_0x39ccfe):_0x37c62b,_0x55d484=_0x5afd4d[_0x7ff71c(0x74)](projectRole);return{'ok':!![],'data':{'scope':_0x7ff71c(0x8d),'roles':_0x55d484,'paging':_0x31660a},'message':'Found\x20'+_0x55d484['length']+_0x7ff71c(0x81)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a178_0x5add86=a178_0x35d5;(function(_0x3d0a51,_0x32826a){const _0x1ad506=a178_0x35d5,_0x10532c=_0x3d0a51();while(!![]){try{const _0x2d5949=parseInt(_0x1ad506(0x180))/0x1+-parseInt(_0x1ad506(0x17b))/0x2*(-parseInt(_0x1ad506(0x179))/0x3)+parseInt(_0x1ad506(0x1a9))/0x4*(parseInt(_0x1ad506(0x191))/0x5)+-parseInt(_0x1ad506(0x1a6))/0x6+-parseInt(_0x1ad506(0x1ae))/0x7+parseInt(_0x1ad506(0x19f))/0x8*(parseInt(_0x1ad506(0x1a4))/0x9)+parseInt(_0x1ad506(0x1c3))/0xa;if(_0x2d5949===_0x32826a)break;else _0x10532c['push'](_0x10532c['shift']());}catch(_0x34acdf){_0x10532c['push'](_0x10532c['shift']());}}}(a178_0x4e6d,0x75073));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_0x5add86(0x1bf),'required':!![],'description':a178_0x5add86(0x177)};export const ROLE_REF_FLAG={'name':a178_0x5add86(0x193),'type':a178_0x5add86(0x1a0),'required':!![],'description':a178_0x5add86(0x18b)};function a178_0x35d5(_0x47b2b6,_0x5d7083){_0x47b2b6=_0x47b2b6-0x171;const _0x4e6d5d=a178_0x4e6d();let _0x35d557=_0x4e6d5d[_0x47b2b6];return _0x35d557;}export const USER_REF_FLAG={'name':a178_0x5add86(0x192),'type':'string','required':!![],'description':a178_0x5add86(0x18e)};export const NAME_FLAG={'name':a178_0x5add86(0x1bd),'type':a178_0x5add86(0x1a0),'required':!![],'description':a178_0x5add86(0x183)};export const USER_NAME_FLAG={'name':a178_0x5add86(0x1bd),'type':a178_0x5add86(0x1a0),'required':!![],'description':a178_0x5add86(0x173)};export const REMARK_FLAG={'name':a178_0x5add86(0x17d),'type':a178_0x5add86(0x1a0),'required':![],'description':a178_0x5add86(0x1b0)};export const EXPECT_USER_COUNT_FLAG={'name':a178_0x5add86(0x189),'type':a178_0x5add86(0x1bf),'required':![],'description':a178_0x5add86(0x1af)};export const BUILTIN_ROLE_TYPES=[a178_0x5add86(0x18f),a178_0x5add86(0x194),a178_0x5add86(0x1a1)];export function isBuiltinRole(_0x5188fe){const _0x91973a=a178_0x5add86;return BUILTIN_ROLE_TYPES[_0x91973a(0x1b8)](_0x5188fe);}export function assertCustomRole(_0xe25aa0,_0xf83177){const _0x33c801=a178_0x5add86;if(_0xe25aa0['roleType']!==_0x33c801(0x184))throw CliErrors[_0x33c801(0x190)]('Cannot\x20'+_0xf83177+_0x33c801(0x1b5)+_0xe25aa0[_0x33c801(0x1ad)]+'\x20('+_0xe25aa0[_0x33c801(0x19c)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x581f14){const _0x56dda0=a178_0x5add86;return{'id':_0x581f14['id'],'roleName':_0x581f14[_0x56dda0(0x1ad)],'roleType':_0x581f14[_0x56dda0(0x19c)],'remark':_0x581f14[_0x56dda0(0x17d)],'userCount':_0x581f14[_0x56dda0(0x186)],'permitCount':_0x581f14[_0x56dda0(0x1bc)],'builtin':isBuiltinRole(_0x581f14[_0x56dda0(0x19c)])};}export async function resolveRoleRef(_0x3b9dfc,_0x4f8e69){const _0x557021=a178_0x5add86,_0x1edd42=_0x4f8e69['trim']();if(!_0x1edd42)throw CliErrors[_0x557021(0x190)]('Missing\x20role\x20reference.',_0x557021(0x19e));if(/^\d+$/[_0x557021(0x197)](_0x1edd42))return getRoleById(_0x3b9dfc,Number(_0x1edd42));const _0x5eaf00=await listAllAppRoles(_0x3b9dfc),_0x4bb9fb=_0x5eaf00[_0x557021(0x1a5)](_0x1a7917=>_0x1a7917['roleName']===_0x1edd42);if(_0x4bb9fb[_0x557021(0x1be)]===0x0)throw CliErrors[_0x557021(0x190)](_0x557021(0x1ac)+_0x1edd42+_0x557021(0x1c7)+_0x3b9dfc+'.',_0x557021(0x19d));if(_0x4bb9fb['length']>0x1){const _0x77b2ab=_0x4bb9fb['map'](_0xfd832a=>_0xfd832a['id'])[_0x557021(0x1aa)](',\x20');throw CliErrors[_0x557021(0x190)](_0x557021(0x1ac)+_0x1edd42+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x77b2ab+').',_0x557021(0x1b2));}return _0x4bb9fb[0x0];}export async function getRoleById(_0x3c869c,_0x4a1e68){const _0xd64ab9=a178_0x5add86,_0x25488a=await listAllAppRoles(_0x3c869c),_0x1e7c92=_0x25488a[_0xd64ab9(0x1a5)](_0x141b47=>_0x141b47['id']===_0x4a1e68&&(!_0x141b47[_0xd64ab9(0x1ab)]||_0x141b47[_0xd64ab9(0x1ab)]===_0x3c869c));if(_0x1e7c92[_0xd64ab9(0x1be)]!==0x1)throw CliErrors[_0xd64ab9(0x190)](_0xd64ab9(0x185)+_0x4a1e68+_0xd64ab9(0x172)+_0x3c869c+'.',_0xd64ab9(0x1b6));return _0x1e7c92[0x0];}async function listAllAppRoles(_0x4089e3){const _0x5a1c39=a178_0x5add86,_0x4acf90=0x64,_0x5b45df=[];for(let _0x2bf425=0x1;;_0x2bf425+=0x1){const {items:_0x202d7a,paging:_0x543433}=await listAppRoles(_0x4089e3,{'currentPage':_0x2bf425,'pageSize':_0x4acf90});_0x5b45df[_0x5a1c39(0x18d)](..._0x202d7a);if(_0x202d7a[_0x5a1c39(0x1be)]<_0x4acf90||_0x543433&&_0x5b45df[_0x5a1c39(0x1be)]>=_0x543433[_0x5a1c39(0x174)])return _0x5b45df;}}function a178_0x4e6d(){const _0x781954=['ADMIN','validation','2100UAFyfk','user','role','DEV','dev','Multiple\x20tenant\x20members\x20match\x20\x22','test','\x20member(s)\x20but\x20role\x20has\x20','tenant','\x20is\x20already\x20a\x20member\x20of\x20role\x20','find','roleType','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Pass\x20--role\x20<id|name>.','24mmUDmw','string','OWNER','nickname',';\x20no\x20change.','909693bmwuoe','filter','3770664tGcZYQ','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','flagMissing','320sItlAy','join','appCode','Role\x20name\x20\x22','roleName','1744638tQjYfa','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Optional\x20role\x20remark/description','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','Disambiguate\x20with\x20--role\x20<id>.','tenant_code','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','\x20built-in\x20role\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','authRequired','includes','/smartapi/permit/user-role/create','POST','Pass\x20--user\x20<id|name>.','permitCount','name','length','number','\x20duplicate\x20memberships\x20for\x20user\x20','User\x20','\x20members\x20of\x20the\x20OWNER\x20role.','4534380bQWAhg','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','userId','username','\x22\x20not\x20found\x20in\x20app\x20','Missing\x20user\x20reference.','\x20not\x20found\x20in\x20app\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','totalCount','expectUserCount','trim','Role\x20id\x20(from\x20`role\x20list`)','No\x20tenant\x20member\x20matches\x20\x22','82743qDDSaG','\x20is\x20not\x20a\x20member\x20of\x20role\x20','26neIxZg','dryRun','remark','\x22:\x20','toLowerCase','208203MWeHJU','str','map','Role\x20name','CUSTOM','Role\x20id\x20','userCount','Removed\x20','Anti-drift\x20check\x20failed:\x20expected\x20','expect-user-count','user-add','Role\x20id\x20or\x20exact\x20role\x20name','Disambiguate\x20with\x20--user\x20<id>.','push','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'];a178_0x4e6d=function(){return _0x781954;};return a178_0x4e6d();}export async function resolveTenantCode(){const _0x539069=a178_0x5add86,_0x129612=await getSessionUserInfo(),_0xbe9d63=_0x129612?.[_0x539069(0x192)]?.[_0x539069(0x199)]?.[_0x539069(0x1b3)];if(!_0xbe9d63)throw CliErrors[_0x539069(0x1b7)](_0x539069(0x1a7));return _0xbe9d63;}function matchMember(_0x4dbf87,_0x161a07){const _0x5af721=a178_0x5add86,_0x39e83a=_0x161a07['trim']()[_0x5af721(0x17f)]();return(_0x4dbf87[_0x5af721(0x1a2)]??'')[_0x5af721(0x17f)]()===_0x39e83a||(_0x4dbf87[_0x5af721(0x1c6)]??'')['toLowerCase']()===_0x39e83a;}export async function resolveUserRef(_0x114c8e){const _0x5e35a9=a178_0x5add86,_0x2fc438=_0x114c8e['trim']();if(!_0x2fc438)throw CliErrors[_0x5e35a9(0x190)](_0x5e35a9(0x171),_0x5e35a9(0x1bb));const _0x122902=await resolveTenantCode(),_0x38d1e9=await getTenantMembers(_0x122902);if(/^\d+$/[_0x5e35a9(0x197)](_0x2fc438)){const _0x35d47f=Number(_0x2fc438),_0xa8fca8=_0x38d1e9[_0x5e35a9(0x19b)](_0x46eb23=>_0x46eb23[_0x5e35a9(0x1c5)]===_0x35d47f);return{'userId':_0x35d47f,'username':_0xa8fca8?.['username']??String(_0x35d47f),'nickname':_0xa8fca8?.[_0x5e35a9(0x1a2)],'matchedBy':'id'};}const _0x51b65e=_0x38d1e9[_0x5e35a9(0x1a5)](_0x2c9eb9=>matchMember(_0x2c9eb9,_0x2fc438));if(_0x51b65e[_0x5e35a9(0x1be)]===0x0)throw CliErrors['validation'](_0x5e35a9(0x178)+_0x2fc438+'\x22.',_0x5e35a9(0x1b4));if(_0x51b65e[_0x5e35a9(0x1be)]>0x1){const _0x272288=_0x51b65e[_0x5e35a9(0x182)](_0x27747b=>(_0x27747b[_0x5e35a9(0x1a2)]??_0x27747b[_0x5e35a9(0x1c6)]??'?')+'('+_0x27747b[_0x5e35a9(0x1c5)]+')')[_0x5e35a9(0x1aa)](',\x20');throw CliErrors[_0x5e35a9(0x190)](_0x5e35a9(0x196)+_0x2fc438+_0x5e35a9(0x17e)+_0x272288+'.',_0x5e35a9(0x18c));}const _0x5ddc12=_0x51b65e[0x0];return{'userId':_0x5ddc12[_0x5e35a9(0x1c5)],'username':_0x5ddc12['username']??String(_0x5ddc12[_0x5e35a9(0x1c5)]),'nickname':_0x5ddc12[_0x5e35a9(0x1a2)],'matchedBy':'name'};}export const CREATE_USER_ROLE_PATH=a178_0x5add86(0x1b9);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';export function computeRoleUserMutation(_0x574eb4){const _0x54bc05=a178_0x5add86,{operation:_0x4bafbb,appCode:_0x4f324f,role:_0x36b0e7,relations:_0x4f264f,user:_0x129d9f}=_0x574eb4,_0x44468d=[...new Set(_0x4f264f[_0x54bc05(0x182)](_0x3310da=>_0x3310da['userId']))],_0x40ca17=[];if(_0x574eb4[_0x54bc05(0x175)]!==undefined&&_0x574eb4[_0x54bc05(0x175)]!==_0x44468d[_0x54bc05(0x1be)])throw CliErrors[_0x54bc05(0x190)](_0x54bc05(0x188)+_0x574eb4[_0x54bc05(0x175)]+_0x54bc05(0x198)+_0x44468d[_0x54bc05(0x1be)]+'.',_0x54bc05(0x1b1));const _0x5363ca=_0x44468d[_0x54bc05(0x1b8)](_0x129d9f['userId']),_0x6ac78e=_0x4f264f['filter'](_0x32ec47=>_0x32ec47[_0x54bc05(0x1c5)]===_0x129d9f[_0x54bc05(0x1c5)])[_0x54bc05(0x182)](_0x1409a5=>_0x1409a5['id']),_0x1745b5=_0x4bafbb===_0x54bc05(0x18a)?!_0x5363ca:_0x5363ca;let _0x34edef=_0x44468d;_0x4bafbb===_0x54bc05(0x18a)?_0x5363ca?_0x40ca17[_0x54bc05(0x18d)]('User\x20'+_0x129d9f[_0x54bc05(0x1c5)]+_0x54bc05(0x19a)+_0x36b0e7[_0x54bc05(0x1ad)]+_0x54bc05(0x1a3)):_0x34edef=[..._0x44468d,_0x129d9f['userId']]:!_0x5363ca?_0x40ca17[_0x54bc05(0x18d)](_0x54bc05(0x1c1)+_0x129d9f['userId']+_0x54bc05(0x17a)+_0x36b0e7['roleName']+_0x54bc05(0x1a3)):(_0x34edef=_0x44468d['filter'](_0x3dce3c=>_0x3dce3c!==_0x129d9f[_0x54bc05(0x1c5)]),_0x6ac78e[_0x54bc05(0x1be)]>0x1&&_0x40ca17[_0x54bc05(0x18d)](_0x54bc05(0x187)+_0x6ac78e[_0x54bc05(0x1be)]+_0x54bc05(0x1c0)+_0x129d9f['userId']+'.'));const _0xf7b143={'scope':_0x54bc05(0x195),'operation':_0x4bafbb,'selector':{'appCode':_0x4f324f,'roleId':_0x36b0e7['id'],'roleName':_0x36b0e7[_0x54bc05(0x1ad)],'userId':_0x129d9f[_0x54bc05(0x1c5)]},'before':{'userIds':_0x44468d},'after':{'userIds':_0x34edef},'dryRun':_0x574eb4[_0x54bc05(0x17c)],'backend':{'method':_0x54bc05(0x1ba),'path':_0x4bafbb===_0x54bc05(0x18a)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x40ca17};return{'mutation':_0xf7b143,'changed':_0x1745b5,'matchingRelationIds':_0x6ac78e};}export async function loadDevRoleRelations(_0x21c72a,_0x983d49){const _0x1fe9fa=a178_0x5add86,_0x5cc542=0x64,_0x24d0c6=[];for(let _0x2ee3d3=0x1;;_0x2ee3d3+=0x1){const {items:_0x42ae16,paging:_0x46de36}=await listDevUserRoleRelations(_0x21c72a,{'roleId':_0x983d49,'currentPage':_0x2ee3d3,'pageSize':_0x5cc542});_0x24d0c6[_0x1fe9fa(0x18d)](..._0x42ae16);if(_0x42ae16[_0x1fe9fa(0x1be)]<_0x5cc542||_0x46de36&&_0x24d0c6[_0x1fe9fa(0x1be)]>=_0x46de36['totalCount'])return _0x24d0c6;}}export function readRoleRef(_0x210d42){const _0x38cb29=a178_0x5add86,_0x293d72=_0x210d42[_0x38cb29(0x181)](_0x38cb29(0x193))[_0x38cb29(0x176)]();if(!_0x293d72)throw CliErrors[_0x38cb29(0x1a8)](_0x38cb29(0x193),'Pass\x20--role\x20<id|name>.');return _0x293d72;}export async function prepareUserMutation(_0x323720,_0x2d9330,_0x9746ed){const _0x11823c=a178_0x5add86,_0x51ae02=readRoleRef(_0x323720),_0x5de1b7=_0x323720['str'](_0x11823c(0x192))[_0x11823c(0x176)]();if(!_0x5de1b7)throw CliErrors[_0x11823c(0x1a8)](_0x11823c(0x192),'Pass\x20--user\x20<id|name>.');const _0x23723d=_0x323720['flag']('expect-user-count'),_0x37d033=_0x23723d===undefined||_0x23723d===null?undefined:Number(_0x23723d),_0x5aec11=await resolveRoleRef(_0x323720[_0x11823c(0x1ab)],_0x51ae02);if(_0x5aec11[_0x11823c(0x19c)]===_0x11823c(0x1a1))throw CliErrors[_0x11823c(0x190)]('Cannot\x20'+_0x2d9330+_0x11823c(0x1c2),_0x11823c(0x1c4));const _0x46f930=await resolveUserRef(_0x5de1b7),_0x5a1ba7=await loadDevRoleRelations(_0x323720[_0x11823c(0x1ab)],_0x5aec11['id']);return{...computeRoleUserMutation({'operation':_0x2d9330,'appCode':_0x323720[_0x11823c(0x1ab)],'role':_0x5aec11,'relations':_0x5a1ba7,'user':{'userId':_0x46f930[_0x11823c(0x1c5)],'username':_0x46f930[_0x11823c(0x1c6)],'nickname':_0x46f930['nickname']},'dryRun':_0x9746ed,..._0x37d033!==undefined?{'expectUserCount':_0x37d033}:{}}),'role':_0x5aec11,'user':_0x46f930};}
|
|
1
|
+
const a179_0x57dc71=a179_0x47ac;(function(_0x356c2f,_0x3bd5b4){const _0x1b9498=a179_0x47ac,_0x41c237=_0x356c2f();while(!![]){try{const _0x2d8ddc=-parseInt(_0x1b9498(0x1d6))/0x1*(-parseInt(_0x1b9498(0x1c4))/0x2)+-parseInt(_0x1b9498(0x1dd))/0x3*(parseInt(_0x1b9498(0x202))/0x4)+-parseInt(_0x1b9498(0x1fb))/0x5+-parseInt(_0x1b9498(0x1ef))/0x6+-parseInt(_0x1b9498(0x1f0))/0x7*(parseInt(_0x1b9498(0x1e2))/0x8)+parseInt(_0x1b9498(0x1c7))/0x9*(parseInt(_0x1b9498(0x1ba))/0xa)+parseInt(_0x1b9498(0x1ca))/0xb*(parseInt(_0x1b9498(0x1fc))/0xc);if(_0x2d8ddc===_0x3bd5b4)break;else _0x41c237['push'](_0x41c237['shift']());}catch(_0x86e2d7){_0x41c237['push'](_0x41c237['shift']());}}}(a179_0x41e5,0x8bae9));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':a179_0x57dc71(0x1f9),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a179_0x57dc71(0x1fa),'type':'string','required':!![],'description':a179_0x57dc71(0x1d9)};export const USER_REF_FLAG={'name':a179_0x57dc71(0x1e0),'type':a179_0x57dc71(0x1c2),'required':!![],'description':a179_0x57dc71(0x1cc)};export const NAME_FLAG={'name':a179_0x57dc71(0x1b8),'type':a179_0x57dc71(0x1c2),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':'name','type':'string','required':!![],'description':a179_0x57dc71(0x1e7)};export const REMARK_FLAG={'name':a179_0x57dc71(0x1ff),'type':a179_0x57dc71(0x1c2),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a179_0x57dc71(0x1df),'type':a179_0x57dc71(0x1f9),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=['ADMIN',a179_0x57dc71(0x1d8),a179_0x57dc71(0x1e3)];export function isBuiltinRole(_0x52af1a){const _0x2865e1=a179_0x57dc71;return BUILTIN_ROLE_TYPES[_0x2865e1(0x1e4)](_0x52af1a);}export function assertCustomRole(_0x2d0a7c,_0x198e8d){const _0x58202d=a179_0x57dc71;if(_0x2d0a7c['roleType']!==_0x58202d(0x1b9))throw CliErrors[_0x58202d(0x1cf)](_0x58202d(0x1d5)+_0x198e8d+_0x58202d(0x1dc)+_0x2d0a7c[_0x58202d(0x1cb)]+'\x20('+_0x2d0a7c[_0x58202d(0x1f3)]+').',_0x58202d(0x200));}export function projectRole(_0x339d16){const _0x11993c=a179_0x57dc71;return{'id':_0x339d16['id'],'roleName':_0x339d16[_0x11993c(0x1cb)],'roleType':_0x339d16[_0x11993c(0x1f3)],'remark':_0x339d16[_0x11993c(0x1ff)],'userCount':_0x339d16['userCount'],'permitCount':_0x339d16[_0x11993c(0x1eb)],'builtin':isBuiltinRole(_0x339d16[_0x11993c(0x1f3)])};}export async function resolveRoleRef(_0x52f1f5,_0x27f252){const _0x2af1a5=a179_0x57dc71,_0x464c63=_0x27f252['trim']();if(!_0x464c63)throw CliErrors[_0x2af1a5(0x1cf)](_0x2af1a5(0x207),_0x2af1a5(0x1d7));if(/^\d+$/[_0x2af1a5(0x1be)](_0x464c63))return getRoleById(_0x52f1f5,Number(_0x464c63));const _0x2f8f48=await listAllAppRoles(_0x52f1f5),_0xf95bf1=_0x2f8f48[_0x2af1a5(0x1d4)](_0x38d622=>_0x38d622[_0x2af1a5(0x1cb)]===_0x464c63);if(_0xf95bf1['length']===0x0)throw CliErrors[_0x2af1a5(0x1cf)](_0x2af1a5(0x203)+_0x464c63+_0x2af1a5(0x1c1)+_0x52f1f5+'.',_0x2af1a5(0x1e9));if(_0xf95bf1[_0x2af1a5(0x1c3)]>0x1){const _0xf8840e=_0xf95bf1[_0x2af1a5(0x1bd)](_0x1be20f=>_0x1be20f['id'])[_0x2af1a5(0x1de)](',\x20');throw CliErrors[_0x2af1a5(0x1cf)](_0x2af1a5(0x203)+_0x464c63+_0x2af1a5(0x1f6)+_0xf8840e+').',_0x2af1a5(0x1ce));}return _0xf95bf1[0x0];}export async function getRoleById(_0x45fd92,_0xed7e77){const _0x35be8f=a179_0x57dc71,_0x59b2db=await listAllAppRoles(_0x45fd92),_0x3c6bb4=_0x59b2db[_0x35be8f(0x1d4)](_0x3d4c32=>_0x3d4c32['id']===_0xed7e77&&(!_0x3d4c32[_0x35be8f(0x1f1)]||_0x3d4c32[_0x35be8f(0x1f1)]===_0x45fd92));if(_0x3c6bb4[_0x35be8f(0x1c3)]!==0x1)throw CliErrors[_0x35be8f(0x1cf)]('Role\x20id\x20'+_0xed7e77+_0x35be8f(0x1bc)+_0x45fd92+'.',_0x35be8f(0x1f4));return _0x3c6bb4[0x0];}function a179_0x41e5(){const _0x3e0392=['\x22\x20not\x20found\x20in\x20app\x20','string','length','10NfkWRU','/smartapi/permit/user-role/create','\x20duplicate\x20memberships\x20for\x20user\x20','9RZRKkP','User\x20',';\x20no\x20change.','25817kmNCqp','roleName','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','dryRun','Disambiguate\x20with\x20--role\x20<id>.','validation','user-add','find','authRequired','toLowerCase','filter','Cannot\x20','95315dUpfCE','Pass\x20--role\x20<id|name>.','DEV','Role\x20id\x20or\x20exact\x20role\x20name','username','tenant_code','\x20built-in\x20role\x20','3XrufNA','join','expect-user-count','user','Pass\x20--user\x20<id|name>.','334336YRdsaA','OWNER','includes','/smartapi/permit/user-role/delete','totalCount','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Disambiguate\x20with\x20--user\x20<id>.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','nickname','permitCount','Multiple\x20tenant\x20members\x20match\x20\x22','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','No\x20tenant\x20member\x20matches\x20\x22','6024096pChGZJ','84XrKUBZ','appCode','str','roleType','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','flag','\x22\x20is\x20ambiguous\x20(ids:\x20','userId','trim','number','role','4900855AaZxfG','10872fQCOER','tenant','Removed\x20','remark','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','\x20member(s)\x20but\x20role\x20has\x20','2228648FrmQhQ','Role\x20name\x20\x22','\x20is\x20already\x20a\x20member\x20of\x20role\x20','\x22:\x20','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','Missing\x20role\x20reference.','expectUserCount','name','CUSTOM','10120330CWrczi','Missing\x20user\x20reference.','\x20not\x20found\x20in\x20app\x20','map','test','flagMissing','push'];a179_0x41e5=function(){return _0x3e0392;};return a179_0x41e5();}async function listAllAppRoles(_0x574916){const _0x1f393d=a179_0x57dc71,_0x25f160=0x64,_0x791328=[];for(let _0x3175cd=0x1;;_0x3175cd+=0x1){const {items:_0x56883e,paging:_0x54252c}=await listAppRoles(_0x574916,{'currentPage':_0x3175cd,'pageSize':_0x25f160});_0x791328[_0x1f393d(0x1c0)](..._0x56883e);if(_0x56883e[_0x1f393d(0x1c3)]<_0x25f160||_0x54252c&&_0x791328[_0x1f393d(0x1c3)]>=_0x54252c[_0x1f393d(0x1e6)])return _0x791328;}}export async function resolveTenantCode(){const _0x5bdb8b=a179_0x57dc71,_0x755da4=await getSessionUserInfo(),_0x2417b7=_0x755da4?.[_0x5bdb8b(0x1e0)]?.[_0x5bdb8b(0x1fd)]?.[_0x5bdb8b(0x1db)];if(!_0x2417b7)throw CliErrors[_0x5bdb8b(0x1d2)](_0x5bdb8b(0x1ed));return _0x2417b7;}function matchMember(_0x420c05,_0x45777b){const _0x485726=a179_0x57dc71,_0x30afcf=_0x45777b['trim']()[_0x485726(0x1d3)]();return(_0x420c05[_0x485726(0x1ea)]??'')[_0x485726(0x1d3)]()===_0x30afcf||(_0x420c05[_0x485726(0x1da)]??'')[_0x485726(0x1d3)]()===_0x30afcf;}export async function resolveUserRef(_0x51d79e){const _0x339c81=a179_0x57dc71,_0x1481a8=_0x51d79e[_0x339c81(0x1f8)]();if(!_0x1481a8)throw CliErrors['validation'](_0x339c81(0x1bb),_0x339c81(0x1e1));const _0x233fb8=await resolveTenantCode(),_0x5c6347=await getTenantMembers(_0x233fb8);if(/^\d+$/[_0x339c81(0x1be)](_0x1481a8)){const _0x510245=Number(_0x1481a8),_0x16843f=_0x5c6347[_0x339c81(0x1d1)](_0x5081a5=>_0x5081a5[_0x339c81(0x1f7)]===_0x510245);return{'userId':_0x510245,'username':_0x16843f?.[_0x339c81(0x1da)]??String(_0x510245),'nickname':_0x16843f?.[_0x339c81(0x1ea)],'matchedBy':'id'};}const _0xf86a7f=_0x5c6347[_0x339c81(0x1d4)](_0x922a4a=>matchMember(_0x922a4a,_0x1481a8));if(_0xf86a7f['length']===0x0)throw CliErrors[_0x339c81(0x1cf)](_0x339c81(0x1ee)+_0x1481a8+'\x22.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.');if(_0xf86a7f[_0x339c81(0x1c3)]>0x1){const _0x53a27d=_0xf86a7f['map'](_0x49020d=>(_0x49020d['nickname']??_0x49020d[_0x339c81(0x1da)]??'?')+'('+_0x49020d[_0x339c81(0x1f7)]+')')[_0x339c81(0x1de)](',\x20');throw CliErrors[_0x339c81(0x1cf)](_0x339c81(0x1ec)+_0x1481a8+_0x339c81(0x205)+_0x53a27d+'.',_0x339c81(0x1e8));}const _0x30ec5e=_0xf86a7f[0x0];return{'userId':_0x30ec5e[_0x339c81(0x1f7)],'username':_0x30ec5e[_0x339c81(0x1da)]??String(_0x30ec5e[_0x339c81(0x1f7)]),'nickname':_0x30ec5e[_0x339c81(0x1ea)],'matchedBy':_0x339c81(0x1b8)};}function a179_0x47ac(_0x371882,_0xe8d0d4){_0x371882=_0x371882-0x1b8;const _0x41e50c=a179_0x41e5();let _0x47acc2=_0x41e50c[_0x371882];return _0x47acc2;}export const CREATE_USER_ROLE_PATH=a179_0x57dc71(0x1c5);export const DELETE_USER_ROLE_PATH=a179_0x57dc71(0x1e5);export function computeRoleUserMutation(_0x26c587){const _0x21d5b9=a179_0x57dc71,{operation:_0x4baf02,appCode:_0x3a8fa2,role:_0x2b0c38,relations:_0x5d7157,user:_0x46d22d}=_0x26c587,_0x311130=[...new Set(_0x5d7157[_0x21d5b9(0x1bd)](_0x38d5f2=>_0x38d5f2[_0x21d5b9(0x1f7)]))],_0x416d3e=[];if(_0x26c587[_0x21d5b9(0x208)]!==undefined&&_0x26c587[_0x21d5b9(0x208)]!==_0x311130['length'])throw CliErrors[_0x21d5b9(0x1cf)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x26c587[_0x21d5b9(0x208)]+_0x21d5b9(0x201)+_0x311130[_0x21d5b9(0x1c3)]+'.',_0x21d5b9(0x206));const _0x1eb0ec=_0x311130['includes'](_0x46d22d[_0x21d5b9(0x1f7)]),_0x2c5b38=_0x5d7157['filter'](_0x9b102c=>_0x9b102c[_0x21d5b9(0x1f7)]===_0x46d22d[_0x21d5b9(0x1f7)])[_0x21d5b9(0x1bd)](_0x392dec=>_0x392dec['id']),_0x550a17=_0x4baf02===_0x21d5b9(0x1d0)?!_0x1eb0ec:_0x1eb0ec;let _0x4cd9bf=_0x311130;_0x4baf02===_0x21d5b9(0x1d0)?_0x1eb0ec?_0x416d3e[_0x21d5b9(0x1c0)](_0x21d5b9(0x1c8)+_0x46d22d[_0x21d5b9(0x1f7)]+_0x21d5b9(0x204)+_0x2b0c38[_0x21d5b9(0x1cb)]+';\x20no\x20change.'):_0x4cd9bf=[..._0x311130,_0x46d22d[_0x21d5b9(0x1f7)]]:!_0x1eb0ec?_0x416d3e[_0x21d5b9(0x1c0)](_0x21d5b9(0x1c8)+_0x46d22d[_0x21d5b9(0x1f7)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x2b0c38['roleName']+_0x21d5b9(0x1c9)):(_0x4cd9bf=_0x311130[_0x21d5b9(0x1d4)](_0x4f92b3=>_0x4f92b3!==_0x46d22d[_0x21d5b9(0x1f7)]),_0x2c5b38[_0x21d5b9(0x1c3)]>0x1&&_0x416d3e[_0x21d5b9(0x1c0)](_0x21d5b9(0x1fe)+_0x2c5b38[_0x21d5b9(0x1c3)]+_0x21d5b9(0x1c6)+_0x46d22d[_0x21d5b9(0x1f7)]+'.'));const _0x3d4411={'scope':'dev','operation':_0x4baf02,'selector':{'appCode':_0x3a8fa2,'roleId':_0x2b0c38['id'],'roleName':_0x2b0c38['roleName'],'userId':_0x46d22d[_0x21d5b9(0x1f7)]},'before':{'userIds':_0x311130},'after':{'userIds':_0x4cd9bf},'dryRun':_0x26c587[_0x21d5b9(0x1cd)],'backend':{'method':'POST','path':_0x4baf02===_0x21d5b9(0x1d0)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x416d3e};return{'mutation':_0x3d4411,'changed':_0x550a17,'matchingRelationIds':_0x2c5b38};}export async function loadDevRoleRelations(_0x3ea44a,_0x339520){const _0x2fb7a3=a179_0x57dc71,_0x1722ef=0x64,_0xb84d8f=[];for(let _0x5abaca=0x1;;_0x5abaca+=0x1){const {items:_0x1ac012,paging:_0xd6b824}=await listDevUserRoleRelations(_0x3ea44a,{'roleId':_0x339520,'currentPage':_0x5abaca,'pageSize':_0x1722ef});_0xb84d8f['push'](..._0x1ac012);if(_0x1ac012[_0x2fb7a3(0x1c3)]<_0x1722ef||_0xd6b824&&_0xb84d8f[_0x2fb7a3(0x1c3)]>=_0xd6b824[_0x2fb7a3(0x1e6)])return _0xb84d8f;}}export function readRoleRef(_0x4a126e){const _0x23ec9b=a179_0x57dc71,_0xe75a8c=_0x4a126e[_0x23ec9b(0x1f2)](_0x23ec9b(0x1fa))[_0x23ec9b(0x1f8)]();if(!_0xe75a8c)throw CliErrors[_0x23ec9b(0x1bf)](_0x23ec9b(0x1fa),_0x23ec9b(0x1d7));return _0xe75a8c;}export async function prepareUserMutation(_0x2a7546,_0x1e7c1e,_0x550186){const _0x339f11=a179_0x57dc71,_0x4a7b94=readRoleRef(_0x2a7546),_0x3d3002=_0x2a7546[_0x339f11(0x1f2)]('user')['trim']();if(!_0x3d3002)throw CliErrors[_0x339f11(0x1bf)](_0x339f11(0x1e0),_0x339f11(0x1e1));const _0x6d637=_0x2a7546[_0x339f11(0x1f5)](_0x339f11(0x1df)),_0x3ae031=_0x6d637===undefined||_0x6d637===null?undefined:Number(_0x6d637),_0x30ff6e=await resolveRoleRef(_0x2a7546[_0x339f11(0x1f1)],_0x4a7b94);if(_0x30ff6e['roleType']===_0x339f11(0x1e3))throw CliErrors[_0x339f11(0x1cf)](_0x339f11(0x1d5)+_0x1e7c1e+'\x20members\x20of\x20the\x20OWNER\x20role.','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x3f5cd0=await resolveUserRef(_0x3d3002),_0x3ae88e=await loadDevRoleRelations(_0x2a7546[_0x339f11(0x1f1)],_0x30ff6e['id']);return{...computeRoleUserMutation({'operation':_0x1e7c1e,'appCode':_0x2a7546[_0x339f11(0x1f1)],'role':_0x30ff6e,'relations':_0x3ae88e,'user':{'userId':_0x3f5cd0['userId'],'username':_0x3f5cd0[_0x339f11(0x1da)],'nickname':_0x3f5cd0['nickname']},'dryRun':_0x550186,..._0x3ae031!==undefined?{'expectUserCount':_0x3ae031}:{}}),'role':_0x30ff6e,'user':_0x3f5cd0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a180_0xaccc(_0x5a4882,_0x3cf7a6){_0x5a4882=_0x5a4882-0x1b2;const _0x2e13bd=a180_0x2e13();let _0xaccc55=_0x2e13bd[_0x5a4882];return _0xaccc55;}const a180_0x105b39=a180_0xaccc;(function(_0x1689d2,_0x451e88){const _0x8b4047=a180_0xaccc,_0x107766=_0x1689d2();while(!![]){try{const _0x3fd85c=-parseInt(_0x8b4047(0x1ca))/0x1*(-parseInt(_0x8b4047(0x1b3))/0x2)+-parseInt(_0x8b4047(0x1c8))/0x3*(-parseInt(_0x8b4047(0x1c4))/0x4)+parseInt(_0x8b4047(0x1ce))/0x5*(-parseInt(_0x8b4047(0x1bc))/0x6)+parseInt(_0x8b4047(0x1b7))/0x7+parseInt(_0x8b4047(0x1c1))/0x8+-parseInt(_0x8b4047(0x1cd))/0x9+parseInt(_0x8b4047(0x1bf))/0xa*(-parseInt(_0x8b4047(0x1d1))/0xb);if(_0x3fd85c===_0x451e88)break;else _0x107766['push'](_0x107766['shift']());}catch(_0x2303bb){_0x107766['push'](_0x107766['shift']());}}}(a180_0x2e13,0xcbc08));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a180_0x105b39(0x1cb);function readPatch(_0x222d68){const _0x43279a=a180_0x105b39,_0x2a8f51=_0x222d68['flag']('name'),_0x364c85=_0x222d68[_0x43279a(0x1c7)]('remark'),_0x3757a9={};if(_0x2a8f51!==undefined&&_0x2a8f51!==null){const _0x205929=String(_0x2a8f51)[_0x43279a(0x1b9)]();if(!_0x205929)throw CliErrors[_0x43279a(0x1b4)](_0x43279a(0x1c0));if(_0x205929[_0x43279a(0x1cf)]>0x40)throw CliErrors[_0x43279a(0x1b4)](_0x43279a(0x1b8));_0x3757a9[_0x43279a(0x1ba)]=_0x205929;}_0x364c85!==undefined&&_0x364c85!==null&&(_0x3757a9[_0x43279a(0x1b5)]=String(_0x364c85));if(_0x3757a9['roleName']===undefined&&_0x3757a9['remark']===undefined)throw CliErrors[_0x43279a(0x1b4)]('Nothing\x20to\x20update.',_0x43279a(0x1b2));return _0x3757a9;}function a180_0x2e13(){const _0x1aa67f=['flag','45KiIcSG','New\x20role\x20name','967FdsHZW','/smartapi/permit/role/update','string','1298178MWBNeU','35355LedANR','length','POST','33WfrdHO','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','3438jbJcjE','validation','remark','Updated\x20role\x20','2804704kzjQkC','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','trim','roleName','\x20(id=','1182uwvTwK','dev','appCode','2077430PnDoQd','--name\x20cannot\x20be\x20empty.','5346928tmbBRz','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','role','70324QhXLyY','name','update'];a180_0x2e13=function(){return _0x1aa67f;};return a180_0x2e13();}export const roleUpdate={'service':a180_0x105b39(0x1c3),'command':a180_0x105b39(0x1c6),'description':a180_0x105b39(0x1c2),'risk':'write','flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a180_0x105b39(0x1c5),'type':a180_0x105b39(0x1cc),'required':![],'description':a180_0x105b39(0x1c9)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3569e3){readPatch(_0x3569e3);},async 'dryRun'(_0x248367){const _0x3a537a=a180_0x105b39,_0x219406=_0x248367['num']('id'),_0x39de37=readPatch(_0x248367),_0x26e39d=await getRoleById(_0x248367[_0x3a537a(0x1be)],_0x219406);return assertCustomRole(_0x26e39d,_0x3a537a(0x1c6)),asDryRunResult({'scope':_0x3a537a(0x1bd),'operation':'update','selector':{'appCode':_0x248367[_0x3a537a(0x1be)],'roleId':_0x219406,'roleName':_0x26e39d[_0x3a537a(0x1ba)]},'before':projectRole(_0x26e39d),'after':projectRole({..._0x26e39d,..._0x39de37[_0x3a537a(0x1ba)]!==undefined?{'roleName':_0x39de37[_0x3a537a(0x1ba)]}:{},..._0x39de37['remark']!==undefined?{'remark':_0x39de37[_0x3a537a(0x1b5)]}:{}}),'dryRun':!![],'backend':{'method':_0x3a537a(0x1d0),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x5691c9){const _0x5ef5c7=a180_0x105b39,_0xbed68f=_0x5691c9['num']('id'),_0x2a8a75=readPatch(_0x5691c9),_0x25c608=await getRoleById(_0x5691c9['appCode'],_0xbed68f);assertCustomRole(_0x25c608,_0x5ef5c7(0x1c6)),await updateAppRole({'id':_0xbed68f,'appCode':_0x5691c9['appCode'],..._0x2a8a75['roleName']!==undefined?{'roleName':_0x2a8a75[_0x5ef5c7(0x1ba)]}:{},..._0x2a8a75[_0x5ef5c7(0x1b5)]!==undefined?{'remark':_0x2a8a75[_0x5ef5c7(0x1b5)]}:{}});const _0x3114c7=await getRoleById(_0x5691c9['appCode'],_0xbed68f);return{'ok':!![],'data':{'scope':_0x5ef5c7(0x1bd),'operation':_0x5ef5c7(0x1c6),'selector':{'appCode':_0x5691c9['appCode'],'roleId':_0xbed68f,'roleName':_0x3114c7[_0x5ef5c7(0x1ba)]},'before':projectRole(_0x25c608),'after':projectRole(_0x3114c7),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x5ef5c7(0x1b6)+_0x3114c7[_0x5ef5c7(0x1ba)]+_0x5ef5c7(0x1bb)+_0xbed68f+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a181_0x3625(_0x37aaf6,_0x526c9a){_0x37aaf6=_0x37aaf6-0xae;const _0xc65a5=a181_0xc65a();let _0x3625e8=_0xc65a5[_0x37aaf6];return _0x3625e8;}const a181_0x1a9f7c=a181_0x3625;function a181_0xc65a(){const _0x1399a7=['3piGkxu','selector','user-add','189752EOjiqi','241160UQnxzQ','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','roleId','roleType','userId','roleName','\x20already\x20in\x20role\x20','2xVuUsb','role','4946535pfOsSo','POST','high-risk-write','6HatOsG','9LrAJFl','240287IctmxZ','68390aaNMbB','No\x20change:\x20user\x20','729595gqPjLI','76363SoGRWy'];a181_0xc65a=function(){return _0x1399a7;};return a181_0xc65a();}(function(_0x3dcff1,_0x2d798d){const _0x23a9cf=a181_0x3625,_0xfbd4be=_0x3dcff1();while(!![]){try{const _0x2a44a3=parseInt(_0x23a9cf(0xb7))/0x1*(-parseInt(_0x23a9cf(0xb0))/0x2)+-parseInt(_0x23a9cf(0xbc))/0x3*(-parseInt(_0x23a9cf(0xbf))/0x4)+-parseInt(_0x23a9cf(0xba))/0x5+parseInt(_0x23a9cf(0xb5))/0x6*(-parseInt(_0x23a9cf(0xbb))/0x7)+parseInt(_0x23a9cf(0xc0))/0x8+-parseInt(_0x23a9cf(0xb6))/0x9*(-parseInt(_0x23a9cf(0xb8))/0xa)+parseInt(_0x23a9cf(0xb2))/0xb;if(_0x2a44a3===_0x2d798d)break;else _0xfbd4be['push'](_0xfbd4be['shift']());}catch(_0x31a88d){_0xfbd4be['push'](_0xfbd4be['shift']());}}}(a181_0xc65a,0x21720));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a181_0x1a9f7c(0xb1),'command':a181_0x1a9f7c(0xbe),'description':a181_0x1a9f7c(0xc1),'risk':a181_0x1a9f7c(0xb4),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5936c4){const _0x550914=a181_0x1a9f7c,{mutation:_0x485d3b}=await prepareUserMutation(_0x5936c4,'user-add',!![]);return asDryRunResult(_0x485d3b,{'method':_0x550914(0xb3),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x2bd9a6){const _0x144b27=a181_0x1a9f7c,{mutation:_0x2210c0,changed:_0x5db6de,role:_0x31bdfc,user:_0x2f346d}=await prepareUserMutation(_0x2bd9a6,_0x144b27(0xbe),![]);return _0x5db6de&&await createDevUserRole({'appCode':_0x2bd9a6['appCode'],'userId':_0x2f346d[_0x144b27(0xc4)],'username':_0x2f346d['username'],'roleType':_0x31bdfc[_0x144b27(0xc3)],'roleId':_0x2210c0[_0x144b27(0xbd)][_0x144b27(0xc2)]}),{'ok':!![],'data':_0x2210c0,'message':_0x5db6de?'Added\x20user\x20'+_0x2210c0[_0x144b27(0xbd)][_0x144b27(0xc4)]+'\x20to\x20role\x20'+_0x2210c0[_0x144b27(0xbd)][_0x144b27(0xae)]:_0x144b27(0xb9)+_0x2210c0[_0x144b27(0xbd)][_0x144b27(0xc4)]+_0x144b27(0xaf)+_0x2210c0[_0x144b27(0xbd)][_0x144b27(0xae)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a182_0x42ae(_0x47c180,_0x3e7e7a){_0x47c180=_0x47c180-0x138;const _0x47ec43=a182_0x47ec();let _0x42ae6c=_0x47ec43[_0x47c180];return _0x42ae6c;}const a182_0x104c45=a182_0x42ae;function a182_0x47ec(){const _0x449ec5=['117OrsIgX','596WeJRVh','No\x20change:\x20user\x20','high-risk-write','roleName','3369300KnKeTG','710815FiSHPb','18282GuccVO','2300580rlcSqa','3701400frmWGh','1395222sFwqOq','192008hiPVZh','Removed\x20user\x20','\x20from\x20role\x20','1FiJfiQ','POST','userId','\x20not\x20in\x20role\x20','selector','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','user-remove'];a182_0x47ec=function(){return _0x449ec5;};return a182_0x47ec();}(function(_0x7dc7a3,_0x59773d){const _0x3987c7=a182_0x42ae,_0x3c8389=_0x7dc7a3();while(!![]){try{const _0x3f1bd3=parseInt(_0x3987c7(0x146))/0x1*(parseInt(_0x3987c7(0x142))/0x2)+-parseInt(_0x3987c7(0x13f))/0x3*(-parseInt(_0x3987c7(0x139))/0x4)+-parseInt(_0x3987c7(0x141))/0x5+-parseInt(_0x3987c7(0x140))/0x6+parseInt(_0x3987c7(0x13e))/0x7+parseInt(_0x3987c7(0x143))/0x8*(parseInt(_0x3987c7(0x138))/0x9)+-parseInt(_0x3987c7(0x13d))/0xa;if(_0x3f1bd3===_0x59773d)break;else _0x3c8389['push'](_0x3c8389['shift']());}catch(_0x2a6361){_0x3c8389['push'](_0x3c8389['shift']());}}}(a182_0x47ec,0x885c7));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':'role','command':a182_0x104c45(0x14c),'description':a182_0x104c45(0x14b),'risk':a182_0x104c45(0x13b),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x237abc){const _0x8e9741=a182_0x104c45,{mutation:_0xc2d193}=await prepareUserMutation(_0x237abc,'user-remove',!![]);return asDryRunResult(_0xc2d193,{'method':_0x8e9741(0x147),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0xb1dbca){const _0x1d8f55=a182_0x104c45,{matchingRelationIds:_0xfa8cb8,mutation:_0x58553b,changed:_0x11ed80}=await prepareUserMutation(_0xb1dbca,'user-remove',![]);if(_0x11ed80)for(const _0xdb6223 of _0xfa8cb8){await deleteDevUserRole(_0xdb6223);}return{'ok':!![],'data':_0x58553b,'message':_0x11ed80?_0x1d8f55(0x144)+_0x58553b['selector'][_0x1d8f55(0x148)]+_0x1d8f55(0x145)+_0x58553b[_0x1d8f55(0x14a)][_0x1d8f55(0x13c)]:_0x1d8f55(0x13a)+_0x58553b[_0x1d8f55(0x14a)][_0x1d8f55(0x148)]+_0x1d8f55(0x149)+_0x58553b[_0x1d8f55(0x14a)][_0x1d8f55(0x13c)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x17bf52,_0x493737){const _0x3afc56=a183_0x330e,_0x23a0b3=_0x17bf52();while(!![]){try{const _0x4a4be2=-parseInt(_0x3afc56(0xca))/0x1*(-parseInt(_0x3afc56(0xc5))/0x2)+-parseInt(_0x3afc56(0xd5))/0x3*(-parseInt(_0x3afc56(0xd6))/0x4)+parseInt(_0x3afc56(0xd9))/0x5+parseInt(_0x3afc56(0xc7))/0x6*(parseInt(_0x3afc56(0xd4))/0x7)+parseInt(_0x3afc56(0xd8))/0x8*(parseInt(_0x3afc56(0xce))/0x9)+-parseInt(_0x3afc56(0xd3))/0xa+-parseInt(_0x3afc56(0xc8))/0xb*(parseInt(_0x3afc56(0xd7))/0xc);if(_0x4a4be2===_0x493737)break;else _0x23a0b3['push'](_0x23a0b3['shift']());}catch(_0x13a061){_0x23a0b3['push'](_0x23a0b3['shift']());}}}(a183_0xa69c,0x216d8));import{CliErrors}from'../../errors.js';function a183_0x330e(_0x8fadd4,_0x41b566){_0x8fadd4=_0x8fadd4-0xc4;const _0xa69c38=a183_0xa69c();let _0x330e0a=_0xa69c38[_0x8fadd4];return _0x330e0a;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a183_0xa69c(){const _0x537b58=['3dJfpHi','59672nAYtFT','24WnCqEC','438032SRJvCc','714835LYXKqM','\x22\x20→\x20userId\x20','trim','4umyWmN','str','202056uUtvpK','1871089ousUvD','nickname','40105BksGrM','name','Resolved\x20\x22','Pass\x20--name\x20<nickname|username>.','36mkzjyT','userId','username','flagMissing','matchedBy','1483730bWmtQM','35EMdytP'];a183_0xa69c=function(){return _0x537b58;};return a183_0xa69c();}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':'role','command':'user-resolve','description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':'read','flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1ef283){const _0x326ef6=a183_0x330e;if(!_0x1ef283[_0x326ef6(0xc6)](_0x326ef6(0xcb))['trim']())throw CliErrors[_0x326ef6(0xd1)](_0x326ef6(0xcb),_0x326ef6(0xcd));},async 'execute'(_0x41c1e4){const _0x1a1a72=a183_0x330e,_0x4955a9=_0x41c1e4[_0x1a1a72(0xc6)](_0x1a1a72(0xcb))[_0x1a1a72(0xc4)](),_0x40f42f=await resolveUserRef(_0x4955a9);return{'ok':!![],'data':{'user':{'userId':_0x40f42f[_0x1a1a72(0xcf)],'username':_0x40f42f[_0x1a1a72(0xd0)],'nickname':_0x40f42f[_0x1a1a72(0xc9)],'matchedBy':_0x40f42f[_0x1a1a72(0xd2)]}},'message':_0x1a1a72(0xcc)+_0x4955a9+_0x1a1a72(0xda)+_0x40f42f[_0x1a1a72(0xcf)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a184_0x285993=a184_0x55ba;function a184_0x57ad(){const _0x5c0aba=['join','\x20run\x20build','preview','3428668rzAhac','bun','Script\x20name\x20defined\x20in\x20package.json','yarn','563073mwdcOU','close','log','Available:\x20','validation','6wdIqcC','\x20exited\x20with\x20code\x20','dev','pnpm-lock.yaml','bun.lockb','vite\x20preview\x20exited\x20with\x20code\x20','npm','\x20\x20\x20\x20','vite','Run\x20a\x20package.json\x20script','write','needsUpgrade','belowMinimum','.bin','No\x20scripts\x20defined\x20in\x20package.json.','slice','watch','194215ukgYcV','bool','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','3926510MwHBpN','36TbSIVU','\x22\x20not\x20found\x20in\x20package.json.','\x0a\x20\x20Available\x20scripts:\x0a','2079710tfPMsD','inherit','3702470agmoqC','14ZJogIY','--watch','error','bun.lock','push','keys','\x0a\x20\x20Usage:\x20','\x20run\x20preview\x20--watch','length','\x20run\x20start','parse','(none)','has','Enable\x20watch\x20mode\x20for\x20preview','4805080EsDrCo','package.json','yarn.lock','\x20run\x20<script>\x0a','node_modules','run','utf-8','args','cwd','No\x20package.json\x20found\x20in\x20current\x20directory.'];a184_0x57ad=function(){return _0x5c0aba;};return a184_0x57ad();}(function(_0x1d6a3a,_0x58a86b){const _0x3b323d=a184_0x55ba,_0x5bb013=_0x1d6a3a();while(!![]){try{const _0x596526=parseInt(_0x3b323d(0x212))/0x1+parseInt(_0x3b323d(0x21c))/0x2*(parseInt(_0x3b323d(0x1fc))/0x3)+-parseInt(_0x3b323d(0x1f8))/0x4+parseInt(_0x3b323d(0x21b))/0x5*(-parseInt(_0x3b323d(0x201))/0x6)+parseInt(_0x3b323d(0x215))/0x7+-parseInt(_0x3b323d(0x22a))/0x8+-parseInt(_0x3b323d(0x216))/0x9*(-parseInt(_0x3b323d(0x219))/0xa);if(_0x596526===_0x58a86b)break;else _0x5bb013['push'](_0x5bb013['shift']());}catch(_0x2ffb99){_0x5bb013['push'](_0x5bb013['shift']());}}}(a184_0x57ad,0xab86a));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';function a184_0x55ba(_0x53eb0c,_0x313117){_0x53eb0c=_0x53eb0c-0x1f0;const _0x57adda=a184_0x57ad();let _0x55ba68=_0x57adda[_0x53eb0c];return _0x55ba68;}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',a184_0x285993(0x203)]);function readPackageScripts(_0xfd6a9c){const _0x2ed938=a184_0x285993,_0x36c8f6=resolve(_0xfd6a9c,_0x2ed938(0x22b));if(!existsSync(_0x36c8f6))return null;try{const _0x12b6a6=JSON[_0x2ed938(0x226)](readFileSync(_0x36c8f6,_0x2ed938(0x1f1)));return _0x12b6a6['scripts']??{};}catch{return null;}}function detectPackageManager(_0x290283){const _0x4f38a9=a184_0x285993;if(existsSync(resolve(_0x290283,_0x4f38a9(0x205)))||existsSync(resolve(_0x290283,_0x4f38a9(0x21f))))return _0x4f38a9(0x1f9);if(existsSync(resolve(_0x290283,_0x4f38a9(0x204))))return'pnpm';if(existsSync(resolve(_0x290283,_0x4f38a9(0x22c))))return _0x4f38a9(0x1fb);return _0x4f38a9(0x207);}async function versionCheck(_0x3e91b2){const _0x306406=a184_0x285993,_0x45ad7c=await checkCliVersion();(_0x45ad7c[_0x306406(0x20c)]||_0x45ad7c[_0x306406(0x20d)])&&(printCliUpgradeWarning(_0x45ad7c),assertCliVersionSupported(_0x45ad7c));const _0xe55648=await checkSdkVersion(_0x3e91b2);if(_0xe55648[_0x306406(0x20c)])printSdkUpgradeWarning(_0xe55648);}function spawnScript(_0xd8964,_0x58c1ab,_0x9a71d6,_0x560052){return new Promise((_0x34f00c,_0x5e6e48)=>{const _0xc4de97=a184_0x55ba,_0x39d5b3=['run',_0x58c1ab,..._0x9a71d6],_0x25231a=spawn(_0xd8964,_0x39d5b3,{'cwd':_0x560052,'stdio':_0xc4de97(0x21a),'shell':!![],'env':{...process.env,'PATH':''+join(_0x560052,_0xc4de97(0x22e),_0xc4de97(0x20e))+delimiter+process.env.PATH}});_0x25231a['on'](_0xc4de97(0x1fd),_0xa3ab47=>{const _0x4af007=_0xc4de97;if(_0xa3ab47===0x0||_0xa3ab47===null)_0x34f00c();else _0x5e6e48(new Error(_0xd8964+'\x20run\x20'+_0x58c1ab+_0x4af007(0x202)+_0xa3ab47));}),_0x25231a['on'](_0xc4de97(0x21e),_0x5e6e48);});}function spawnViteBuildWatch(_0x48fae5){return new Promise((_0x379590,_0x4484d8)=>{const _0x3d03dc=a184_0x55ba,_0x4333a3=spawn('vite',['build',_0x3d03dc(0x21d)],{'cwd':_0x48fae5,'stdio':_0x3d03dc(0x21a),'shell':!![],'env':{...process.env,'PATH':''+join(_0x48fae5,'node_modules',_0x3d03dc(0x20e))+delimiter+process.env.PATH}});_0x4333a3['on'](_0x3d03dc(0x1fd),_0x4aa9fb=>{const _0x14e8ed=_0x3d03dc;if(_0x4aa9fb===0x0||_0x4aa9fb===null)_0x379590();else _0x4484d8(new Error(_0x14e8ed(0x214)+_0x4aa9fb));}),_0x4333a3['on']('error',_0x4484d8);});}function spawnVitePreview(_0x28a496){return new Promise((_0x2dce5f,_0x21fafc)=>{const _0x540ba9=a184_0x55ba,_0x1baece=spawn(_0x540ba9(0x209),[_0x540ba9(0x1f7)],{'cwd':_0x28a496,'stdio':_0x540ba9(0x21a),'shell':!![],'env':{...process.env,'PATH':''+join(_0x28a496,_0x540ba9(0x22e),'.bin')+delimiter+process.env.PATH}});_0x1baece['on'](_0x540ba9(0x1fd),_0x468a26=>{const _0x37e0c0=_0x540ba9;if(_0x468a26===0x0||_0x468a26===null)_0x2dce5f();else _0x21fafc(new Error(_0x37e0c0(0x206)+_0x468a26));}),_0x1baece['on'](_0x540ba9(0x21e),_0x21fafc);});}const runFlags=[{'name':'watch','type':'boolean','description':a184_0x285993(0x229),'default':![]}];export const runDefinition={'service':'run','command':a184_0x285993(0x1f0),'description':a184_0x285993(0x20a),'risk':a184_0x285993(0x20b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a184_0x285993(0x1fa),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x11de5e=a184_0x285993,_0x144ffc=[];return _0x144ffc[_0x11de5e(0x220)]('\x20\x20EXAMPLES'),_0x144ffc[_0x11de5e(0x220)](_0x11de5e(0x208)+CLI_BIN_NAME+_0x11de5e(0x225)),_0x144ffc[_0x11de5e(0x220)](_0x11de5e(0x208)+CLI_BIN_NAME+_0x11de5e(0x1f6)),_0x144ffc['push'](_0x11de5e(0x208)+CLI_BIN_NAME+'\x20run\x20preview'),_0x144ffc[_0x11de5e(0x220)](_0x11de5e(0x208)+CLI_BIN_NAME+_0x11de5e(0x223)),_0x144ffc[_0x11de5e(0x1f5)]('\x0a');},async 'execute'(_0x2c775a){const _0xb9917d=a184_0x285993,_0x3ada01=process[_0xb9917d(0x1f3)](),_0x21910f=_0x2c775a[_0xb9917d(0x1f2)][0x0],_0x3f3bec=_0x2c775a[_0xb9917d(0x1f2)][_0xb9917d(0x210)](0x1),_0x483b58=readPackageScripts(_0x3ada01);if(!_0x483b58)throw CliErrors[_0xb9917d(0x200)](_0xb9917d(0x1f4));if(!_0x21910f){const _0xef6c7c=Object['keys'](_0x483b58);if(_0xef6c7c[_0xb9917d(0x224)]===0x0)console[_0xb9917d(0x1fe)](_0xb9917d(0x20f));else{console[_0xb9917d(0x1fe)](_0xb9917d(0x218));for(const _0x1494db of _0xef6c7c){console[_0xb9917d(0x1fe)](_0xb9917d(0x208)+_0x1494db);}console[_0xb9917d(0x1fe)](_0xb9917d(0x222)+CLI_BIN_NAME+_0xb9917d(0x22d));}return{'ok':!![]};}if(!_0x483b58[_0x21910f])throw CliErrors[_0xb9917d(0x200)]('Script\x20\x22'+_0x21910f+_0xb9917d(0x217),_0xb9917d(0x1ff)+(Object[_0xb9917d(0x221)](_0x483b58)[_0xb9917d(0x1f5)](',\x20')||_0xb9917d(0x227)));const _0x386d21=detectPackageManager(_0x3ada01);VERSION_CHECK_SCRIPTS[_0xb9917d(0x228)](_0x21910f)&&await versionCheck(_0x3ada01);if(_0x21910f===_0xb9917d(0x1f7)&&_0x2c775a[_0xb9917d(0x213)](_0xb9917d(0x211)))return await Promise['all']([spawnViteBuildWatch(_0x3ada01),spawnVitePreview(_0x3ada01)]),{'ok':!![]};return await spawnScript(_0x386d21,_0x21910f,_0x3f3bec,_0x3ada01),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a185_0x18f0cc=a185_0x33a1;function a185_0x33a1(_0x36b86b,_0x211ea2){_0x36b86b=_0x36b86b-0x70;const _0x104b17=a185_0x104b();let _0x33a120=_0x104b17[_0x36b86b];return _0x33a120;}function a185_0x104b(){const _0x20ebbd=['251499iMOMAc','10zYnyVn','3717927chSnbt','json','312710EcxaCh','3326508OIemoD','schema','2SNlqSh','1604792UTuReV','export','3263598oELFfK','read','7bVAgti','668Ukzrqd','33NGlDOS','6411hjlvrx'];a185_0x104b=function(){return _0x20ebbd;};return a185_0x104b();}(function(_0x5e26a9,_0x3dd10f){const _0xd87c=a185_0x33a1,_0x3f705f=_0x5e26a9();while(!![]){try{const _0x136ea0=parseInt(_0xd87c(0x70))/0x1*(parseInt(_0xd87c(0x77))/0x2)+-parseInt(_0xd87c(0x7f))/0x3*(parseInt(_0xd87c(0x7d))/0x4)+parseInt(_0xd87c(0x74))/0x5+parseInt(_0xd87c(0x7a))/0x6+-parseInt(_0xd87c(0x7c))/0x7*(-parseInt(_0xd87c(0x78))/0x8)+parseInt(_0xd87c(0x72))/0x9*(parseInt(_0xd87c(0x71))/0xa)+-parseInt(_0xd87c(0x7e))/0xb*(parseInt(_0xd87c(0x75))/0xc);if(_0x136ea0===_0x3dd10f)break;else _0x3f705f['push'](_0x3f705f['shift']());}catch(_0xb5865c){_0x3f705f['push'](_0x3f705f['shift']());}}}(a185_0x104b,0x45222));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0xd9e412){const _0x479cb5=await buildSchemaPayload();return{'ok':!![],'data':_0x479cb5};}export const schemaDefinition={'service':a185_0x18f0cc(0x76),'command':a185_0x18f0cc(0x79),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a185_0x18f0cc(0x7b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a185_0x18f0cc(0x73),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a185_0x149a8b=a185_0x2c45;(function(_0x37019b,_0x5bcf17){const _0x21958f=a185_0x2c45,_0x58a1b8=_0x37019b();while(!![]){try{const _0x5302db=-parseInt(_0x21958f(0x18f))/0x1+-parseInt(_0x21958f(0x1c8))/0x2+parseInt(_0x21958f(0x1c3))/0x3+-parseInt(_0x21958f(0x1be))/0x4*(-parseInt(_0x21958f(0x1b4))/0x5)+parseInt(_0x21958f(0x19c))/0x6*(parseInt(_0x21958f(0x1a5))/0x7)+parseInt(_0x21958f(0x1c6))/0x8+parseInt(_0x21958f(0x1c7))/0x9*(-parseInt(_0x21958f(0x1cc))/0xa);if(_0x5302db===_0x5bcf17)break;else _0x58a1b8['push'](_0x58a1b8['shift']());}catch(_0x413b17){_0x58a1b8['push'](_0x58a1b8['shift']());}}}(a185_0xaf19,0xa16cd));function a185_0xaf19(){const _0x155994=['lockFilePath','string','description','Invalid\x20database\x20selection\x20payload:\x20','SELECT\x201\x20AS\x20id;','sqlName','<server-generated-sqlCode>','</select>','number','db-id','str','join','10UpXULg','write','sql','sqlCode','nonInteractive','SQL\x20query\x20display\x20name','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','map','stringify','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','1574036yXekGK','sqlRootDir','appCode','请输入目标数据库\x20dbId:','mode','3818751INBouO','请选择目标数据库:','POST','4096352VHybIz','694395ztAFSa','1021234ijpmqH','toISOString','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','260NEFwtM','validation','isInteger','dbName','name','123324ougrlJ','请输入\x20SQL\x20名称:','dbId\x20必须为正整数','length','MyBatis\x20XML(mybatisXml)','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','isFinite','flagMissing','utf8','适合带动态标签的\x20MyBatis\x20XML\x20SQL','mybatisXml','lastSync','✎\x20手动输入\x20dbId','1458378JsVEFw','trim','Local\x20SQL\x20file\x20mode','new','catch','create','sqlRoot','__manual__','普通\x20SQL(sql)','21eABcDm','\x20\x20SELECT\x201\x20AS\x20id','dbId'];a185_0xaf19=function(){return _0x155994;};return a185_0xaf19();}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(_0x1baa76){const _0xb6981c=a185_0x2c45;if(_0x1baa76===_0xb6981c(0x199))return[_0xb6981c(0x194),_0xb6981c(0x1a6),_0xb6981c(0x1af),''][_0xb6981c(0x1b3)]('\x0a');return[_0xb6981c(0x1ac),''][_0xb6981c(0x1b3)]('\x0a');}export const sqlCreate={'service':a185_0x149a8b(0x1b6),'command':a185_0x149a8b(0x1a1),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a185_0x149a8b(0x1b5),'flags':[{'name':a185_0x149a8b(0x1d0),'type':a185_0x149a8b(0x1a9),'description':a185_0x149a8b(0x1b9)},{'name':a185_0x149a8b(0x1b1),'type':'number','description':'Target\x20database\x20ID'},{'name':a185_0x149a8b(0x1c2),'type':a185_0x149a8b(0x1a9),'enum':['sql',a185_0x149a8b(0x199)],'description':a185_0x149a8b(0x19e)}],async 'validate'(_0x107b25){const _0x784498=a185_0x149a8b;if(!_0x107b25[_0x784498(0x1b8)])return;if(!_0x107b25['str'](_0x784498(0x1d0))[_0x784498(0x19d)]())throw CliErrors[_0x784498(0x196)]('name',_0x784498(0x1ca));const _0x2c70b7=resolveProvidedDbId(_0x107b25);if(typeof _0x2c70b7!=='number'||!Number[_0x784498(0x195)](_0x2c70b7)||_0x2c70b7<=0x0)throw CliErrors[_0x784498(0x196)](_0x784498(0x1b1),_0x784498(0x1cb));if(!_0x107b25[_0x784498(0x1b2)]('mode')[_0x784498(0x19d)]())throw CliErrors[_0x784498(0x196)]('mode',_0x784498(0x1ba));},async 'dryRun'(_0x318be5){const _0x168dab=a185_0x149a8b,_0x423770=loadSqlProjectConfig(_0x318be5['appCode']),{sqlName:_0x299db,dbId:_0x5f17fe,dbName:_0x19dd14,mode:_0x35d169}=await resolveSqlNewInputs(_0x318be5),_0x1e37c3=buildSqlRelativePath(_0x168dab(0x1ae),_0x299db,_0x19dd14,_0x35d169,_0x5f17fe),_0x446838=_0x423770[_0x168dab(0x1bf)]+'/'+_0x1e37c3;return{'method':_0x168dab(0x1c5),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x318be5[_0x168dab(0x1c0)],'sqlName':_0x299db,'dbId':_0x5f17fe,'mode':_0x35d169,'localPath':_0x446838},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x423770['sqlRootDir']};},async 'execute'(_0x44138b){const _0x18b80d=a185_0x149a8b,_0x2d97e8=loadSqlProjectConfig(_0x44138b['appCode']),{sqlName:_0x4e8cb0,dbId:_0x1150e5,dbName:_0x4cdfa4,mode:_0x58bdb3}=await resolveSqlNewInputs(_0x44138b),_0x529ac9=generateSqlTemplate(_0x58bdb3),_0xa86a9d=await createSqlQuery({'appCode':_0x44138b[_0x18b80d(0x1c0)],'sqlName':_0x4e8cb0,'dbId':_0x1150e5,'sqlContent':_0x529ac9}),_0x177a5e=ensureRemoteSqlContent(_0xa86a9d),_0x1f9895=_0x4cdfa4||await getDbName(_0x44138b[_0x18b80d(0x1c0)],_0x1150e5)[_0x18b80d(0x1a0)](()=>undefined),_0x20d0cd=buildSqlRelativePath(_0xa86a9d[_0x18b80d(0x1b7)],_0xa86a9d[_0x18b80d(0x1ad)],_0x1f9895,_0x58bdb3,_0x1150e5),_0x47107f=_0x2d97e8['sqlRootDir']+'/'+_0x20d0cd,_0x46657a=buildLocalSqlFileContent({'sqlCode':_0xa86a9d[_0x18b80d(0x1b7)],'sqlName':_0xa86a9d[_0x18b80d(0x1ad)],'dbId':_0xa86a9d[_0x18b80d(0x1a7)]},_0x177a5e,{'dbName':_0x1f9895,'mode':_0x58bdb3,'syncedAt':new Date()['toISOString'](),'description':_0xa86a9d[_0x18b80d(0x1aa)]});if(await fileExists(_0x47107f))throw CliErrors[_0x18b80d(0x1cd)]('File\x20already\x20exists:\x20'+_0x47107f);await ensureParentDirectory(_0x47107f),await writeFile(_0x47107f,_0x46657a,_0x18b80d(0x197));const _0x18cfbb=await readSqlLockFile(_0x2d97e8[_0x18b80d(0x1a8)]),{lockData:_0x1ecf8a,appLock:_0x2d298a}=ensureSqlLockScope(_0x18cfbb??createEmptySqlLock(),_0x2d97e8['appCode'],_0x2d97e8[_0x18b80d(0x1a2)],_0x18b80d(0x19f));return _0x2d298a['sqls'][_0xa86a9d[_0x18b80d(0x1b7)]]={...buildSqlLockEntry(_0xa86a9d,_0x177a5e,computeSqlContentHash(_0x46657a),{'dbName':_0x1f9895}),'path':_0x20d0cd,'mode':_0x58bdb3},_0x2d298a[_0x18b80d(0x19a)]=new Date()[_0x18b80d(0x1c9)](),await writeSqlLockFile(_0x2d97e8['lockFilePath'],_0x1ecf8a),{'ok':!![],'data':{'id':_0xa86a9d['id'],'sqlCode':_0xa86a9d[_0x18b80d(0x1b7)],'sqlName':_0xa86a9d['sqlName'],'dbId':_0xa86a9d['dbId'],'path':_0x47107f,'mode':_0x58bdb3},'message':'Created\x20SQL\x20query\x20'+_0xa86a9d[_0x18b80d(0x1b7)]};}};async function resolveSqlNewInputs(_0x24a146){const _0x2fdc9a=await resolveSqlNameInput(_0x24a146),{dbId:_0x443133,dbName:_0x222215}=await resolveDbSelection(_0x24a146),_0x41f4c2=await resolveSqlModeInput(_0x24a146);return{'sqlName':_0x2fdc9a,'dbId':_0x443133,'dbName':_0x222215,'mode':_0x41f4c2};}async function resolveSqlNameInput(_0x476f17){const _0xd3eda7=a185_0x149a8b,_0x2d15e3=_0x476f17[_0xd3eda7(0x1b2)](_0xd3eda7(0x1d0))['trim']();if(_0x2d15e3)return _0x2d15e3;if(_0x476f17[_0xd3eda7(0x1b8)])throw CliErrors['flagMissing'](_0xd3eda7(0x1d0),_0xd3eda7(0x1ca));return(await input({'message':_0xd3eda7(0x190),'validate':_0x4e39e8=>_0x4e39e8[_0xd3eda7(0x19d)]()?!![]:'SQL\x20名称不能为空'}))['trim']();}async function resolveDbSelection(_0x2e1520){const _0x4f3b30=a185_0x149a8b,_0x4560d3=resolveProvidedDbId(_0x2e1520);if(typeof _0x4560d3==='number'&&Number[_0x4f3b30(0x195)](_0x4560d3)&&_0x4560d3>0x0)return{'dbId':_0x4560d3,'dbName':await getDbName(_0x2e1520[_0x4f3b30(0x1c0)],_0x4560d3)[_0x4f3b30(0x1a0)](()=>undefined)};if(_0x2e1520[_0x4f3b30(0x1b8)])throw CliErrors['flagMissing'](_0x4f3b30(0x1b1),_0x4f3b30(0x1cb));const _0x4fe2da=await listDatabases(_0x2e1520[_0x4f3b30(0x1c0)])[_0x4f3b30(0x1a0)](()=>[]);if(_0x4fe2da['length']===0x1)return{'dbId':_0x4fe2da[0x0][_0x4f3b30(0x1a7)],'dbName':_0x4fe2da[0x0][_0x4f3b30(0x1cf)]};if(_0x4fe2da[_0x4f3b30(0x192)]>0x1){const _0x21236b=await select({'message':_0x4f3b30(0x1c4),'choices':[..._0x4fe2da[_0x4f3b30(0x1bb)](_0x38f315=>({'name':_0x38f315[_0x4f3b30(0x1cf)]+'\x20('+_0x38f315[_0x4f3b30(0x1a7)]+')','value':serializeDbSelection(_0x38f315)})),{'name':_0x4f3b30(0x19b),'value':_0x4f3b30(0x1a3)}]});if(_0x21236b!==_0x4f3b30(0x1a3))return deserializeDbSelection(_0x21236b);}const _0x449555=await input({'message':_0x4f3b30(0x1c1),'validate':_0x754d3e=>{const _0x4c85a0=_0x4f3b30,_0x96f6c6=_0x754d3e[_0x4c85a0(0x19d)]();if(!_0x96f6c6)return'dbId\x20不能为空';const _0x162fe5=Number(_0x96f6c6);if(!Number[_0x4c85a0(0x1ce)](_0x162fe5)||_0x162fe5<=0x0)return _0x4c85a0(0x191);return!![];}});return{'dbId':Number(_0x449555['trim']())};}async function resolveSqlModeInput(_0x4f95bc){const _0x5709c0=a185_0x149a8b,_0x26822b=_0x4f95bc[_0x5709c0(0x1b2)]('mode')[_0x5709c0(0x19d)]();if(_0x26822b==='sql'||_0x26822b===_0x5709c0(0x199))return _0x26822b;if(_0x4f95bc[_0x5709c0(0x1b8)])throw CliErrors[_0x5709c0(0x196)]('mode',_0x5709c0(0x1ba));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x5709c0(0x1a4),'value':_0x5709c0(0x1b6),'description':_0x5709c0(0x1bd)},{'name':_0x5709c0(0x193),'value':_0x5709c0(0x199),'description':_0x5709c0(0x198)}]});}function serializeDbSelection(_0x25cca5){const _0x4363f3=a185_0x149a8b;return JSON[_0x4363f3(0x1bc)]({'dbId':_0x25cca5[_0x4363f3(0x1a7)],'dbName':_0x25cca5[_0x4363f3(0x1cf)]});}function a185_0x2c45(_0x44f3e1,_0x4535b3){_0x44f3e1=_0x44f3e1-0x18f;const _0xaf197e=a185_0xaf19();let _0x2c4514=_0xaf197e[_0x44f3e1];return _0x2c4514;}function deserializeDbSelection(_0x27adbc){const _0x42f5c8=a185_0x149a8b;try{const _0x5d1fc5=JSON['parse'](_0x27adbc);if(typeof _0x5d1fc5[_0x42f5c8(0x1a7)]==='number'&&Number[_0x42f5c8(0x195)](_0x5d1fc5[_0x42f5c8(0x1a7)]))return{'dbId':_0x5d1fc5['dbId'],'dbName':_0x5d1fc5[_0x42f5c8(0x1cf)]};}catch{}throw CliErrors[_0x42f5c8(0x1cd)](_0x42f5c8(0x1ab)+_0x27adbc);}function resolveProvidedDbId(_0x433c5a){const _0x53913d=a185_0x149a8b,_0x2ee14b=_0x433c5a['flag'](_0x53913d(0x1b1));if(typeof _0x2ee14b===_0x53913d(0x1b0)&&Number['isFinite'](_0x2ee14b))return _0x2ee14b;return undefined;}
|
|
1
|
+
function a186_0xd59f(_0x540e44,_0x383dc0){_0x540e44=_0x540e44-0x1e7;const _0x2f2c0d=a186_0x2f2c();let _0xd59f1=_0x2f2c0d[_0x540e44];return _0xd59f1;}const a186_0x24fb39=a186_0xd59f;(function(_0x429752,_0x362ff){const _0x5e9f21=a186_0xd59f,_0x55a8ef=_0x429752();while(!![]){try{const _0x566f94=parseInt(_0x5e9f21(0x1ed))/0x1+parseInt(_0x5e9f21(0x226))/0x2+parseInt(_0x5e9f21(0x210))/0x3+-parseInt(_0x5e9f21(0x20e))/0x4+parseInt(_0x5e9f21(0x219))/0x5*(-parseInt(_0x5e9f21(0x1f4))/0x6)+parseInt(_0x5e9f21(0x223))/0x7*(parseInt(_0x5e9f21(0x203))/0x8)+parseInt(_0x5e9f21(0x1e9))/0x9*(-parseInt(_0x5e9f21(0x1f1))/0xa);if(_0x566f94===_0x362ff)break;else _0x55a8ef['push'](_0x55a8ef['shift']());}catch(_0x53738e){_0x55a8ef['push'](_0x55a8ef['shift']());}}}(a186_0x2f2c,0xbddef));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(_0x482d0e){const _0x19ec29=a186_0xd59f;if(_0x482d0e===_0x19ec29(0x1f0))return[_0x19ec29(0x228),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x19ec29(0x202)]('\x0a');return[_0x19ec29(0x21f),'']['join']('\x0a');}export const sqlCreate={'service':a186_0x24fb39(0x212),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a186_0x24fb39(0x1ff),'flags':[{'name':a186_0x24fb39(0x1fd),'type':a186_0x24fb39(0x1ef),'description':a186_0x24fb39(0x209)},{'name':a186_0x24fb39(0x20a),'type':'number','description':a186_0x24fb39(0x222)},{'name':'mode','type':a186_0x24fb39(0x1ef),'enum':['sql',a186_0x24fb39(0x1f0)],'description':a186_0x24fb39(0x227)}],async 'validate'(_0x2c4006){const _0x3f3e4f=a186_0x24fb39;if(!_0x2c4006[_0x3f3e4f(0x21b)])return;if(!_0x2c4006[_0x3f3e4f(0x206)](_0x3f3e4f(0x1fd))[_0x3f3e4f(0x1ea)]())throw CliErrors[_0x3f3e4f(0x1ec)](_0x3f3e4f(0x1fd),_0x3f3e4f(0x21e));const _0x26b281=resolveProvidedDbId(_0x2c4006);if(typeof _0x26b281!==_0x3f3e4f(0x216)||!Number[_0x3f3e4f(0x1ee)](_0x26b281)||_0x26b281<=0x0)throw CliErrors[_0x3f3e4f(0x1ec)]('db-id',_0x3f3e4f(0x1f3));if(!_0x2c4006[_0x3f3e4f(0x206)](_0x3f3e4f(0x215))['trim']())throw CliErrors[_0x3f3e4f(0x1ec)]('mode',_0x3f3e4f(0x1f6));},async 'dryRun'(_0xc116b8){const _0x5a51d6=a186_0x24fb39,_0x1fa091=loadSqlProjectConfig(_0xc116b8[_0x5a51d6(0x229)]),{sqlName:_0x78f677,dbId:_0x5f1d5c,dbName:_0x168af9,mode:_0x5d056f}=await resolveSqlNewInputs(_0xc116b8),_0x145e75=buildSqlRelativePath(_0x5a51d6(0x1f8),_0x78f677,_0x168af9,_0x5d056f,_0x5f1d5c),_0x4fbdc0=_0x1fa091[_0x5a51d6(0x207)]+'/'+_0x145e75;return{'method':'POST','url':_0x5a51d6(0x201),'body':{'appCode':_0xc116b8[_0x5a51d6(0x229)],'sqlName':_0x78f677,'dbId':_0x5f1d5c,'mode':_0x5d056f,'localPath':_0x4fbdc0},'description':_0x5a51d6(0x20c)+_0x1fa091[_0x5a51d6(0x207)]};},async 'execute'(_0x1536e9){const _0x145eb0=a186_0x24fb39,_0x1a061e=loadSqlProjectConfig(_0x1536e9['appCode']),{sqlName:_0x54a54a,dbId:_0x3c156e,dbName:_0xde4c6f,mode:_0xa850c3}=await resolveSqlNewInputs(_0x1536e9),_0x24d1c4=generateSqlTemplate(_0xa850c3),_0x1aac88=await createSqlQuery({'appCode':_0x1536e9[_0x145eb0(0x229)],'sqlName':_0x54a54a,'dbId':_0x3c156e,'sqlContent':_0x24d1c4}),_0x2919dc=ensureRemoteSqlContent(_0x1aac88),_0x37d413=_0xde4c6f||await getDbName(_0x1536e9[_0x145eb0(0x229)],_0x3c156e)['catch'](()=>undefined),_0xbd6271=buildSqlRelativePath(_0x1aac88[_0x145eb0(0x225)],_0x1aac88['sqlName'],_0x37d413,_0xa850c3,_0x3c156e),_0x5d0743=_0x1a061e[_0x145eb0(0x207)]+'/'+_0xbd6271,_0x22d4c6=buildLocalSqlFileContent({'sqlCode':_0x1aac88['sqlCode'],'sqlName':_0x1aac88[_0x145eb0(0x1fa)],'dbId':_0x1aac88[_0x145eb0(0x21a)]},_0x2919dc,{'dbName':_0x37d413,'mode':_0xa850c3,'syncedAt':new Date()['toISOString'](),'description':_0x1aac88[_0x145eb0(0x21d)]});if(await fileExists(_0x5d0743))throw CliErrors[_0x145eb0(0x221)](_0x145eb0(0x211)+_0x5d0743);await ensureParentDirectory(_0x5d0743),await writeFile(_0x5d0743,_0x22d4c6,_0x145eb0(0x208));const _0x1c72f7=await readSqlLockFile(_0x1a061e['lockFilePath']),{lockData:_0x10e2dd,appLock:_0x50d2b3}=ensureSqlLockScope(_0x1c72f7??createEmptySqlLock(),_0x1a061e[_0x145eb0(0x229)],_0x1a061e[_0x145eb0(0x200)],_0x145eb0(0x214));return _0x50d2b3[_0x145eb0(0x217)][_0x1aac88[_0x145eb0(0x225)]]={...buildSqlLockEntry(_0x1aac88,_0x2919dc,computeSqlContentHash(_0x22d4c6),{'dbName':_0x37d413}),'path':_0xbd6271,'mode':_0xa850c3},_0x50d2b3[_0x145eb0(0x1fe)]=new Date()[_0x145eb0(0x20b)](),await writeSqlLockFile(_0x1a061e[_0x145eb0(0x224)],_0x10e2dd),{'ok':!![],'data':{'id':_0x1aac88['id'],'sqlCode':_0x1aac88[_0x145eb0(0x225)],'sqlName':_0x1aac88[_0x145eb0(0x1fa)],'dbId':_0x1aac88[_0x145eb0(0x21a)],'path':_0x5d0743,'mode':_0xa850c3},'message':_0x145eb0(0x1f9)+_0x1aac88[_0x145eb0(0x225)]};}};async function resolveSqlNewInputs(_0x536443){const _0x5666b3=await resolveSqlNameInput(_0x536443),{dbId:_0x1d5034,dbName:_0xe50edd}=await resolveDbSelection(_0x536443),_0x2e7ff9=await resolveSqlModeInput(_0x536443);return{'sqlName':_0x5666b3,'dbId':_0x1d5034,'dbName':_0xe50edd,'mode':_0x2e7ff9};}async function resolveSqlNameInput(_0x2b94c4){const _0xa5cd2e=a186_0x24fb39,_0x3c7588=_0x2b94c4[_0xa5cd2e(0x206)]('name')[_0xa5cd2e(0x1ea)]();if(_0x3c7588)return _0x3c7588;if(_0x2b94c4[_0xa5cd2e(0x21b)])throw CliErrors[_0xa5cd2e(0x1ec)](_0xa5cd2e(0x1fd),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x39c930=>_0x39c930[_0xa5cd2e(0x1ea)]()?!![]:'SQL\x20名称不能为空'}))[_0xa5cd2e(0x1ea)]();}async function resolveDbSelection(_0x7f3ea0){const _0x5796e0=a186_0x24fb39,_0x208bb2=resolveProvidedDbId(_0x7f3ea0);if(typeof _0x208bb2===_0x5796e0(0x216)&&Number['isFinite'](_0x208bb2)&&_0x208bb2>0x0)return{'dbId':_0x208bb2,'dbName':await getDbName(_0x7f3ea0['appCode'],_0x208bb2)[_0x5796e0(0x20f)](()=>undefined)};if(_0x7f3ea0[_0x5796e0(0x21b)])throw CliErrors[_0x5796e0(0x1ec)](_0x5796e0(0x20a),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x976f1d=await listDatabases(_0x7f3ea0[_0x5796e0(0x229)])[_0x5796e0(0x20f)](()=>[]);if(_0x976f1d[_0x5796e0(0x20d)]===0x1)return{'dbId':_0x976f1d[0x0][_0x5796e0(0x21a)],'dbName':_0x976f1d[0x0][_0x5796e0(0x1eb)]};if(_0x976f1d[_0x5796e0(0x20d)]>0x1){const _0x3cf4de=await select({'message':_0x5796e0(0x1e7),'choices':[..._0x976f1d[_0x5796e0(0x1f2)](_0x8a60c5=>({'name':_0x8a60c5[_0x5796e0(0x1eb)]+'\x20('+_0x8a60c5[_0x5796e0(0x21a)]+')','value':serializeDbSelection(_0x8a60c5)})),{'name':'✎\x20手动输入\x20dbId','value':_0x5796e0(0x1f5)}]});if(_0x3cf4de!==_0x5796e0(0x1f5))return deserializeDbSelection(_0x3cf4de);}const _0x15bf8e=await input({'message':_0x5796e0(0x1e8),'validate':_0x4653b1=>{const _0x326932=_0x5796e0,_0x138b52=_0x4653b1['trim']();if(!_0x138b52)return _0x326932(0x220);const _0x4cb9fe=Number(_0x138b52);if(!Number[_0x326932(0x218)](_0x4cb9fe)||_0x4cb9fe<=0x0)return _0x326932(0x205);return!![];}});return{'dbId':Number(_0x15bf8e[_0x5796e0(0x1ea)]())};}async function resolveSqlModeInput(_0x2ae7b9){const _0x2e9cdb=a186_0x24fb39,_0x5dfe9d=_0x2ae7b9[_0x2e9cdb(0x206)](_0x2e9cdb(0x215))[_0x2e9cdb(0x1ea)]();if(_0x5dfe9d==='sql'||_0x5dfe9d===_0x2e9cdb(0x1f0))return _0x5dfe9d;if(_0x2ae7b9[_0x2e9cdb(0x21b)])throw CliErrors[_0x2e9cdb(0x1ec)]('mode',_0x2e9cdb(0x1f6));return await select({'message':_0x2e9cdb(0x213),'choices':[{'name':'普通\x20SQL(sql)','value':_0x2e9cdb(0x212),'description':_0x2e9cdb(0x204)},{'name':'MyBatis\x20XML(mybatisXml)','value':'mybatisXml','description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function a186_0x2f2c(){const _0x217f60=['length','2356196WJrXhH','catch','1662870xqIqox','File\x20already\x20exists:\x20','sql','请选择本地\x20SQL\x20模式:','new','mode','number','sqls','isInteger','1240zekpwx','dbId','nonInteractive','stringify','description','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','SELECT\x201\x20AS\x20id;','dbId\x20不能为空','validation','Target\x20database\x20ID','9664760GKIsvH','lockFilePath','sqlCode','1297878BbqpPg','Local\x20SQL\x20file\x20mode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','appCode','请选择目标数据库:','请输入目标数据库\x20dbId:','153JIqceF','trim','dbName','flagMissing','419086MVHGaB','isFinite','string','mybatisXml','465470IPpTVx','map','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','20442ajNEck','__manual__','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','flag','<server-generated-sqlCode>','Created\x20SQL\x20query\x20','sqlName','Invalid\x20database\x20selection\x20payload:\x20','parse','name','lastSync','write','sqlRoot','/smartapi/custom/saveUserCustomSql','join','8rTbwuI','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','dbId\x20必须为正整数','str','sqlRootDir','utf8','SQL\x20query\x20display\x20name','db-id','toISOString','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a186_0x2f2c=function(){return _0x217f60;};return a186_0x2f2c();}function serializeDbSelection(_0x1f35d2){const _0x8518b6=a186_0x24fb39;return JSON[_0x8518b6(0x21c)]({'dbId':_0x1f35d2[_0x8518b6(0x21a)],'dbName':_0x1f35d2[_0x8518b6(0x1eb)]});}function deserializeDbSelection(_0x256759){const _0x5ecf98=a186_0x24fb39;try{const _0x3d2346=JSON[_0x5ecf98(0x1fc)](_0x256759);if(typeof _0x3d2346[_0x5ecf98(0x21a)]==='number'&&Number[_0x5ecf98(0x1ee)](_0x3d2346['dbId']))return{'dbId':_0x3d2346[_0x5ecf98(0x21a)],'dbName':_0x3d2346[_0x5ecf98(0x1eb)]};}catch{}throw CliErrors[_0x5ecf98(0x221)](_0x5ecf98(0x1fb)+_0x256759);}function resolveProvidedDbId(_0x52a9f0){const _0x1a18c8=a186_0x24fb39,_0x1b719d=_0x52a9f0[_0x1a18c8(0x1f7)]('db-id');if(typeof _0x1b719d===_0x1a18c8(0x216)&&Number[_0x1a18c8(0x1ee)](_0x1b719d))return _0x1b719d;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a187_0x810628=a187_0xcc6a;(function(_0x125eee,_0x5edabf){const _0x318358=a187_0xcc6a,_0x5591e=_0x125eee();while(!![]){try{const _0x402467=-parseInt(_0x318358(0x1b2))/0x1*(parseInt(_0x318358(0x1bb))/0x2)+-parseInt(_0x318358(0x1b7))/0x3*(parseInt(_0x318358(0x1cd))/0x4)+-parseInt(_0x318358(0x1b6))/0x5*(parseInt(_0x318358(0x1b9))/0x6)+parseInt(_0x318358(0x1d1))/0x7*(parseInt(_0x318358(0x1d6))/0x8)+parseInt(_0x318358(0x1cf))/0x9*(-parseInt(_0x318358(0x1ba))/0xa)+parseInt(_0x318358(0x1ca))/0xb*(parseInt(_0x318358(0x1b1))/0xc)+parseInt(_0x318358(0x1bf))/0xd*(parseInt(_0x318358(0x1b4))/0xe);if(_0x402467===_0x5edabf)break;else _0x5591e['push'](_0x5591e['shift']());}catch(_0x55ee56){_0x5591e['push'](_0x5591e['shift']());}}}(a187_0x2bf1,0xca0f2));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a187_0x2bf1(){const _0x51814f=['34146ldaQKV','sqlcode','5NOfVMr','3mVihNe','appCode','34278RaFXvb','10edlxxt','24000tGisJS','str','fromEntries','projectRoot','16601SptbXW','validation','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','trashedTo','replace','trashDir','sqls','/smartapi/custom/deleteUserCustomSql','sqlRootDir','toISOString','sql','33bSxoVS','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','SQL\x20lock\x20file\x20not\x20found.','4242292XwhgcJ','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','11446209IjkcQA','lockFilePath','7fxaRnI','length','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlRoot','\x20(local\x20file\x20moved\x20to\x20trash)','476552JUnBkJ','Would\x20delete\x20SQL\x20','remoteId','filter','POST','startsWith','5534196xWDYyJ','116jYNATy','high-risk-write'];a187_0x2bf1=function(){return _0x51814f;};return a187_0x2bf1();}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a187_0xcc6a(_0x590671,_0xa07d79){_0x590671=_0x590671-0x1b0;const _0x2bf173=a187_0x2bf1();let _0xcc6ac2=_0x2bf173[_0x590671];return _0xcc6ac2;}export const sqlDelete={'service':a187_0x810628(0x1c9),'command':'delete','description':a187_0x810628(0x1c1),'risk':a187_0x810628(0x1b3),'flags':[SQLCODE_FLAG],async 'validate'(_0x2a7827){const _0x4ce40a=a187_0x810628,_0x40177e=loadSqlProjectConfig(_0x2a7827[_0x4ce40a(0x1b8)]),_0x1fa696=await readSqlLockFile(_0x40177e[_0x4ce40a(0x1d0)]);if(!_0x1fa696)throw CliErrors[_0x4ce40a(0x1c0)](_0x4ce40a(0x1ce));},async 'dryRun'(_0x1a1e7d){const _0x4978b7=a187_0x810628,_0x26c31d=loadSqlProjectConfig(_0x1a1e7d[_0x4978b7(0x1b8)]),_0x250880=await readSqlLockFile(_0x26c31d[_0x4978b7(0x1d0)]);if(!_0x250880)throw CliErrors[_0x4978b7(0x1c0)](_0x4978b7(0x1ce));const {appLock:_0xf974c5}=ensureSqlLockScope(_0x250880,_0x1a1e7d[_0x4978b7(0x1b8)],_0x26c31d['sqlRoot'],'delete'),_0x4e673d=_0x1a1e7d[_0x4978b7(0x1bc)](_0x4978b7(0x1b5)),_0x4fc75c=_0xf974c5['sqls'][_0x4e673d];if(!_0x4fc75c)throw CliErrors[_0x4978b7(0x1c0)](_0x4978b7(0x1d3)+_0x4e673d+'\x22.');return{'method':_0x4978b7(0x1da),'url':_0x4978b7(0x1c6),'body':{'sqlCode':_0x4e673d,'id':_0x4fc75c[_0x4978b7(0x1d8)],'localPath':resolveLocalSqlFilePath(_0x26c31d,_0x4e673d,_0x4fc75c)},'description':_0x4978b7(0x1d7)+_0x4e673d+_0x4978b7(0x1cb)+_0x26c31d[_0x4978b7(0x1c4)]};},async 'execute'(_0x433341){const _0x5e66de=a187_0x810628,_0x469b1c=loadSqlProjectConfig(_0x433341['appCode']),_0x50791f=await readSqlLockFile(_0x469b1c[_0x5e66de(0x1d0)]);if(!_0x50791f)throw CliErrors['validation'](_0x5e66de(0x1cc));const {lockData:_0x472e3f,appLock:_0x37b7f4}=ensureSqlLockScope(_0x50791f,_0x433341['appCode'],_0x469b1c[_0x5e66de(0x1d4)],'delete'),_0x3bedf8=_0x433341[_0x5e66de(0x1bc)](_0x5e66de(0x1b5)),_0x212394=_0x37b7f4[_0x5e66de(0x1c5)][_0x3bedf8];if(!_0x212394)throw CliErrors[_0x5e66de(0x1c0)](_0x5e66de(0x1d3)+_0x3bedf8+'\x22.');await deleteSqlQuery({'id':_0x212394['remoteId'],'sqlCode':_0x3bedf8}),_0x37b7f4[_0x5e66de(0x1c5)]=Object[_0x5e66de(0x1bd)](Object['entries'](_0x37b7f4[_0x5e66de(0x1c5)])[_0x5e66de(0x1d9)](([_0x54e3c8])=>_0x54e3c8!==_0x3bedf8)),_0x37b7f4['lastSync']=new Date()[_0x5e66de(0x1c8)](),await writeSqlLockFile(_0x469b1c['lockFilePath'],_0x472e3f);const _0x186a6f=resolveLocalSqlFilePath(_0x469b1c,_0x3bedf8,_0x212394);let _0xfb54d7;await fileExists(_0x186a6f)&&(_0xfb54d7=await moveToTrash(_0x469b1c[_0x5e66de(0x1be)],_0x469b1c['trashDir'],_0x186a6f),await cleanupEmptyDirectories(dirname(_0x186a6f),_0x469b1c[_0x5e66de(0x1c7)]));const _0x323eab={'deleted':_0x3bedf8,'remoteId':_0x212394[_0x5e66de(0x1d8)]};if(_0xfb54d7)_0x323eab[_0x5e66de(0x1c2)]=_0xfb54d7;return{'ok':!![],'data':_0x323eab,'message':'Deleted\x20'+_0x3bedf8+(_0xfb54d7?_0x5e66de(0x1d5):'')};}};async function moveToTrash(_0x4a1cd3,_0x4c8f49,_0x33e305){const _0x46468=a187_0x810628,_0x3f5006=new Date()[_0x46468(0x1c8)]()[_0x46468(0x1c3)](/[:.]/g,'-'),_0x25a02c=relative(_0x4a1cd3,_0x33e305),_0x5512e5=join(_0x4c8f49,_0x3f5006,_0x25a02c);return await mkdir(dirname(_0x5512e5),{'recursive':!![]}),await rename(_0x33e305,_0x5512e5),_0x5512e5;}async function cleanupEmptyDirectories(_0x345d0c,_0x32e644){const _0x4f03db=a187_0x810628;let _0x144b15=resolve(_0x345d0c);const _0xb3477a=resolve(_0x32e644);while(_0x144b15[_0x4f03db(0x1b0)](''+_0xb3477a+sep)||_0x144b15===_0xb3477a){if(_0x144b15===_0xb3477a)return;try{const _0xbcbb62=await readdir(_0x144b15);if(_0xbcbb62[_0x4f03db(0x1d2)]>0x0)return;await rmdir(_0x144b15);}catch{return;}_0x144b15=dirname(_0x144b15);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a188_0x159be5=a188_0x1a08;(function(_0x3482b6,_0x23f90e){const _0x4fdecb=a188_0x1a08,_0x232a42=_0x3482b6();while(!![]){try{const _0x623fa8=parseInt(_0x4fdecb(0x18f))/0x1+-parseInt(_0x4fdecb(0x185))/0x2+-parseInt(_0x4fdecb(0x180))/0x3+parseInt(_0x4fdecb(0x191))/0x4+-parseInt(_0x4fdecb(0x182))/0x5*(parseInt(_0x4fdecb(0x18c))/0x6)+-parseInt(_0x4fdecb(0x181))/0x7*(parseInt(_0x4fdecb(0x189))/0x8)+parseInt(_0x4fdecb(0x18b))/0x9;if(_0x623fa8===_0x23f90e)break;else _0x232a42['push'](_0x232a42['shift']());}catch(_0x3feec7){_0x232a42['push'](_0x232a42['shift']());}}}(a188_0x4213,0xdffa6));import{getSqlQueryInfo}from'../../core/api-client.js';function a188_0x1a08(_0x32bc15,_0x91c30d){_0x32bc15=_0x32bc15-0x17e;const _0x42134a=a188_0x4213();let _0x1a08b2=_0x42134a[_0x32bc15];return _0x1a08b2;}import{getDbName}from'../../core/db-resolver.js';function a188_0x4213(){const _0x5ac729=['sqlName','verbose','760195pFVCKE','sqlContent','732760JDiqzZ','boolean','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','3093669TwGicy','697942SBKvso','1549150jePvGb','description','appCode','163128EdzbXW','bool','sqlcode','detail','56APqQpX','dbId','30005172PsdQqr','30lnpPUr'];a188_0x4213=function(){return _0x5ac729;};return a188_0x4213();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a188_0x159be5(0x188),'description':a188_0x159be5(0x17f),'risk':'read','flags':[SQLCODE_FLAG,{'name':a188_0x159be5(0x18e),'type':a188_0x159be5(0x17e),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x13333e){const _0x37e96e=a188_0x159be5,_0x848bfa=await getSqlQueryInfo(_0x13333e['appCode'],_0x13333e['str'](_0x37e96e(0x187))),_0x226777=_0x13333e[_0x37e96e(0x186)](_0x37e96e(0x18e));if(_0x226777)return{'ok':!![],'data':_0x848bfa};const _0x31f6d0=_0x848bfa[_0x37e96e(0x18a)]?await getDbName(_0x13333e[_0x37e96e(0x184)],_0x848bfa[_0x37e96e(0x18a)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x848bfa['sqlCode'],'sqlName':_0x848bfa[_0x37e96e(0x18d)],'db':_0x31f6d0?_0x31f6d0+'\x20('+_0x848bfa[_0x37e96e(0x18a)]+')':_0x848bfa[_0x37e96e(0x18a)]??'','description':_0x848bfa[_0x37e96e(0x183)]??'','sqlContent':_0x848bfa[_0x37e96e(0x190)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a189_0x2255b6=a189_0x25c7;function a189_0x25c7(_0x253e5a,_0x2d1e07){_0x253e5a=_0x253e5a-0x80;const _0x1f98b8=a189_0x1f98();let _0x25c7be=_0x1f98b8[_0x253e5a];return _0x25c7be;}(function(_0x1402fc,_0x2c2c82){const _0x58272c=a189_0x25c7,_0x97b4e1=_0x1402fc();while(!![]){try{const _0x2083bf=parseInt(_0x58272c(0x80))/0x1+-parseInt(_0x58272c(0x97))/0x2*(-parseInt(_0x58272c(0x84))/0x3)+-parseInt(_0x58272c(0x8d))/0x4*(parseInt(_0x58272c(0x83))/0x5)+-parseInt(_0x58272c(0x8c))/0x6+-parseInt(_0x58272c(0x90))/0x7+parseInt(_0x58272c(0x8f))/0x8+parseInt(_0x58272c(0x82))/0x9;if(_0x2083bf===_0x2c2c82)break;else _0x97b4e1['push'](_0x97b4e1['shift']());}catch(_0xbab3ac){_0x97b4e1['push'](_0x97b4e1['shift']());}}}(a189_0x1f98,0x3d9b7));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a189_0x1f98(){const _0x41bb7b=['12HldQak','length','sqlcode','447556owkpqW','SQL\x20execution\x20failed','2191761VwcOBR','297355INDYqm','2169jFdhJa','execSuccess','\x20row(s)\x20in\x20','now','params','read','execError','string','2896260UjzCaB','20GxkZdB','Returned\x20','3310064aJGQnQ','537411KZCVYj','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','str','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','isArray','exec','appCode'];a189_0x1f98=function(){return _0x41bb7b;};return a189_0x1f98();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a189_0x2255b6(0x95),'description':a189_0x2255b6(0x91),'risk':a189_0x2255b6(0x89),'flags':[SQLCODE_FLAG,{'name':a189_0x2255b6(0x88),'type':a189_0x2255b6(0x8b),'description':a189_0x2255b6(0x93)}],async 'execute'(_0x3df07b){const _0x1560ea=a189_0x2255b6,_0x451427=parseJsonParams(_0x3df07b[_0x1560ea(0x92)](_0x1560ea(0x88))),_0x438f43=Date[_0x1560ea(0x87)](),_0x1d1878=await executeSql(_0x3df07b[_0x1560ea(0x96)],_0x3df07b[_0x1560ea(0x92)](_0x1560ea(0x99)),_0x451427),_0x11ab2a=Date[_0x1560ea(0x87)]()-_0x438f43,_0x3c22c2=_0x1d1878?.['execResult']??_0x1d1878,_0x19824f=_0x1d1878?.[_0x1560ea(0x85)]??!![];if(!_0x19824f)return{'ok':![],'data':{'error':_0x1d1878?.[_0x1560ea(0x8a)]||_0x1560ea(0x81),'elapsed':_0x11ab2a},'message':_0x1560ea(0x81)};const _0x377130=Array[_0x1560ea(0x94)](_0x3c22c2)?_0x3c22c2:[];return{'ok':!![],'data':{'rows':_0x377130,'rowCount':_0x377130['length'],'elapsed':_0x11ab2a},'message':_0x1560ea(0x8e)+_0x377130[_0x1560ea(0x98)]+_0x1560ea(0x86)+_0x11ab2a+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x484ced,_0x5c5ea0){const _0x15e712=a190_0x1f49,_0x39321c=_0x484ced();while(!![]){try{const _0x50906f=parseInt(_0x15e712(0x7e))/0x1*(parseInt(_0x15e712(0x7a))/0x2)+-parseInt(_0x15e712(0x81))/0x3+parseInt(_0x15e712(0x80))/0x4+-parseInt(_0x15e712(0x7f))/0x5+-parseInt(_0x15e712(0x7b))/0x6*(-parseInt(_0x15e712(0x82))/0x7)+-parseInt(_0x15e712(0x7c))/0x8*(-parseInt(_0x15e712(0x83))/0x9)+parseInt(_0x15e712(0x84))/0xa*(-parseInt(_0x15e712(0x7d))/0xb);if(_0x50906f===_0x5c5ea0)break;else _0x39321c['push'](_0x39321c['shift']());}catch(_0x3b6bba){_0x39321c['push'](_0x39321c['shift']());}}}(a190_0x594a,0x92462));import{sqlList}from'../../commands/sql/list.js';function a190_0x1f49(_0x129af8,_0x160786){_0x129af8=_0x129af8-0x7a;const _0x594a11=a190_0x594a();let _0x1f49b5=_0x594a11[_0x129af8];return _0x1f49b5;}import{sqlDetail}from'../../commands/sql/detail.js';function a190_0x594a(){const _0x92d19f=['239091sEwwUm','3016085rdZtRv','1289748BPTJrg','1680939gkFyHJ','1967BSKENI','9zXedVB','800VqfvIu','4RfPlvH','15864rKymcH','7391720qOtZqp','96921OYJPur'];a190_0x594a=function(){return _0x92d19f;};return a190_0x594a();}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';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a191_0x328210=a191_0x569f;(function(_0x504579,_0x3e9a5a){const _0xed6aca=a191_0x569f,_0x2426a6=_0x504579();while(!![]){try{const _0x5b6869=parseInt(_0xed6aca(0xa4))/0x1*(-parseInt(_0xed6aca(0xa3))/0x2)+parseInt(_0xed6aca(0x8c))/0x3+-parseInt(_0xed6aca(0x8f))/0x4*(parseInt(_0xed6aca(0x8e))/0x5)+-parseInt(_0xed6aca(0xa0))/0x6*(parseInt(_0xed6aca(0x9f))/0x7)+-parseInt(_0xed6aca(0xa1))/0x8+parseInt(_0xed6aca(0xac))/0x9+-parseInt(_0xed6aca(0x97))/0xa*(-parseInt(_0xed6aca(0xa5))/0xb);if(_0x5b6869===_0x3e9a5a)break;else _0x2426a6['push'](_0x2426a6['shift']());}catch(_0x58fdf7){_0x2426a6['push'](_0x2426a6['shift']());}}}(a191_0x4e69,0x89658));function a191_0x4e69(){const _0x169b5a=['32548FWjTRl','pagesize','totalCount','name','string','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','description','num','10dyAKPD','map','dbId','sqlName','boolean','page','appCode','all','287EiTsqJ','140040lwqkai','5424760YYuYtH','Page\x20size','8NpcLgj','262583aUFeHy','34139611WYHnRx','\x20SQL\x20queries\x20(total:\x20','Page\x20number','sql','tableData','list','bool','8396730LrYjik','paging','number','length','verbose','No\x20custom\x20SQL\x20queries\x20found.','sqlCode','637269bZxvWt','read','615LaOaqE'];a191_0x4e69=function(){return _0x169b5a;};return a191_0x4e69();}import{listSqlQueries}from'../../core/api-client.js';function a191_0x569f(_0x13f486,_0x4aa343){_0x13f486=_0x13f486-0x8b;const _0x4e6976=a191_0x4e69();let _0x569f54=_0x4e6976[_0x13f486];return _0x569f54;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a191_0x328210(0xa8),'command':a191_0x328210(0xaa),'description':'List\x20custom\x20SQL\x20queries','risk':a191_0x328210(0x8d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x328210(0x92),'type':a191_0x328210(0x93),'description':'Filter\x20by\x20SQL\x20name'},{'name':a191_0x328210(0x9c),'type':a191_0x328210(0xae),'description':a191_0x328210(0xa7),'default':0x1},{'name':a191_0x328210(0x90),'type':a191_0x328210(0xae),'description':a191_0x328210(0xa2)},{'name':a191_0x328210(0xb0),'type':a191_0x328210(0x9b),'description':a191_0x328210(0x94)}],async 'execute'(_0x2d5738){const _0x3f25f5=a191_0x328210,_0xaaa87=await listSqlQueries(_0x2d5738[_0x3f25f5(0x9d)],{'sqlCode':_0x2d5738['str']('sqlcode')||undefined,'sqlName':_0x2d5738['str'](_0x3f25f5(0x92))||undefined,'currentPage':_0x2d5738[_0x3f25f5(0x96)](_0x3f25f5(0x9c)),'pageSize':_0x2d5738[_0x3f25f5(0x96)](_0x3f25f5(0x90),0x32)}),_0x6645db=_0x2d5738[_0x3f25f5(0xab)](_0x3f25f5(0xb0)),_0x212f8c=_0xaaa87[_0x3f25f5(0xa9)]??[],_0x592ace=_0xaaa87[_0x3f25f5(0xad)]?.[_0x3f25f5(0x91)]??_0x212f8c[_0x3f25f5(0xaf)];let _0x4a6266;return _0x6645db?_0x4a6266=_0x212f8c:_0x4a6266=await Promise[_0x3f25f5(0x9e)](_0x212f8c[_0x3f25f5(0x98)](async _0x5c83a4=>{const _0x54d0df=_0x3f25f5;let _0x327844;try{_0x327844=_0x5c83a4['dbId']?await getDbName(_0x2d5738['appCode'],_0x5c83a4[_0x54d0df(0x99)]):undefined;}catch{}return{'sqlCode':_0x5c83a4[_0x54d0df(0x8b)],'sqlName':_0x5c83a4[_0x54d0df(0x9a)],'description':_0x5c83a4[_0x54d0df(0x95)]??'','db':_0x327844?_0x327844+'\x20('+_0x5c83a4[_0x54d0df(0x99)]+')':_0x5c83a4[_0x54d0df(0x99)]??''};})),{'ok':!![],'data':_0x4a6266,'message':_0x212f8c[_0x3f25f5(0xaf)]===0x0?_0x3f25f5(0xb1):'Found\x20'+_0x212f8c['length']+_0x3f25f5(0xa6)+_0x592ace+').'};}};
|