@lovrabet/rabetbase-cli 2.5.0-beta.5 → 2.5.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +2 -2
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a174_0x5cc1(){const _0x49e74d=['\x20member(s);\x20they\x20will\x20lose\x20this\x20group.','Deleted\x20role\x20','328675wAfpvV','delete','116634jdYvUV','num','5IAQVjx','POST','appCode','10097857ClMKiC','201elBgGX','1298388MblmVF','userCount','Role\x20still\x20has\x20','8hDEAqa','roleName','916506NvlOnZ','35QrSKpi','\x20(id=','2146260OUmGgC','high-risk-write','/smartapi/permit/role/delete','dev','4008HAZMks'];a174_0x5cc1=function(){return _0x49e74d;};return a174_0x5cc1();}const a174_0x2c90f4=a174_0x110f;(function(_0x20b21c,_0x2c357e){const _0x1702b2=a174_0x110f,_0x18c359=_0x20b21c();while(!![]){try{const _0x2078a4=-parseInt(_0x1702b2(0x18b))/0x1+parseInt(_0x1702b2(0x188))/0x2*(parseInt(_0x1702b2(0x193))/0x3)+parseInt(_0x1702b2(0x194))/0x4*(-parseInt(_0x1702b2(0x18f))/0x5)+parseInt(_0x1702b2(0x18d))/0x6*(-parseInt(_0x1702b2(0x19a))/0x7)+-parseInt(_0x1702b2(0x197))/0x8*(-parseInt(_0x1702b2(0x199))/0x9)+-parseInt(_0x1702b2(0x19c))/0xa+parseInt(_0x1702b2(0x192))/0xb;if(_0x2078a4===_0x2c357e)break;else _0x18c359['push'](_0x18c359['shift']());}catch(_0x7c168b){_0x18c359['push'](_0x18c359['shift']());}}}(a174_0x5cc1,0x2e244));import{deleteAppRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a174_0x110f(_0x104304,_0x524f16){_0x104304=_0x104304-0x187;const _0x5cc12f=a174_0x5cc1();let _0x110ff7=_0x5cc12f[_0x104304];return _0x110ff7;}import{assertCustomRole,getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';const DELETE_PATH=a174_0x2c90f4(0x19e);export const roleDelete={'service':'role','command':a174_0x2c90f4(0x18c),'description':'Delete\x20a\x20CUSTOM\x20role\x20(built-in\x20roles\x20rejected);\x20requires\x20--yes','risk':a174_0x2c90f4(0x19d),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x47c4de){const _0x2972bd=a174_0x2c90f4,_0x22e19f=_0x47c4de['num']('id'),_0x18ebff=await getRoleById(_0x47c4de[_0x2972bd(0x191)],_0x22e19f);return assertCustomRole(_0x18ebff,'delete'),asDryRunResult({'scope':'dev','operation':_0x2972bd(0x18c),'selector':{'appCode':_0x47c4de[_0x2972bd(0x191)],'roleId':_0x22e19f,'roleName':_0x18ebff[_0x2972bd(0x198)]},'before':projectRole(_0x18ebff),'after':null,'dryRun':!![],'backend':{'method':_0x2972bd(0x190),'path':DELETE_PATH},'warnings':_0x18ebff[_0x2972bd(0x195)]>0x0?[_0x2972bd(0x196)+_0x18ebff[_0x2972bd(0x195)]+_0x2972bd(0x189)]:[]},{'method':'POST','url':DELETE_PATH});},async 'execute'(_0x1d49a4){const _0x22932a=a174_0x2c90f4,_0x4c9b55=_0x1d49a4[_0x22932a(0x18e)]('id'),_0x2f0dff=await getRoleById(_0x1d49a4['appCode'],_0x4c9b55);return assertCustomRole(_0x2f0dff,_0x22932a(0x18c)),await deleteAppRole(_0x4c9b55),{'ok':!![],'data':{'scope':_0x22932a(0x187),'operation':'delete','selector':{'appCode':_0x1d49a4[_0x22932a(0x191)],'roleId':_0x4c9b55,'roleName':_0x2f0dff[_0x22932a(0x198)]},'before':projectRole(_0x2f0dff),'after':null,'dryRun':![],'backend':{'method':_0x22932a(0x190),'path':DELETE_PATH},'warnings':[]},'message':_0x22932a(0x18a)+_0x2f0dff[_0x22932a(0x198)]+_0x22932a(0x19b)+_0x4c9b55+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a175_0xb38f3=a175_0x15c8;function a175_0x15c8(_0x265e39,_0x219e4a){_0x265e39=_0x265e39-0x14e;const _0x43f3f9=a175_0x43f3();let _0x15c8c1=_0x43f3f9[_0x265e39];return _0x15c8c1;}(function(_0x2f5094,_0x4fa85b){const _0x580972=a175_0x15c8,_0x5d9178=_0x2f5094();while(!![]){try{const _0x254615=-parseInt(_0x580972(0x159))/0x1*(parseInt(_0x580972(0x150))/0x2)+-parseInt(_0x580972(0x154))/0x3+-parseInt(_0x580972(0x160))/0x4+parseInt(_0x580972(0x14e))/0x5*(-parseInt(_0x580972(0x153))/0x6)+-parseInt(_0x580972(0x15d))/0x7+parseInt(_0x580972(0x15a))/0x8*(-parseInt(_0x580972(0x157))/0x9)+parseInt(_0x580972(0x15e))/0xa;if(_0x254615===_0x4fa85b)break;else _0x5d9178['push'](_0x5d9178['shift']());}catch(_0x376b5e){_0x5d9178['push'](_0x5d9178['shift']());}}}(a175_0x43f3,0xeb6f6));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';function a175_0x43f3(){const _0x7e6fcd=['Role\x20','detail','23742RWWvUx','roleType','373kAQYsa','3048MeSGcz','roleName','appCode','5432378pbjQig','60298080HYgmHP','role','5995584NeZLqW','35HlMMWZ','dev','1678DwbLmG','read','num','1069962gIMzcu','672606WIdrqo'];a175_0x43f3=function(){return _0x7e6fcd;};return a175_0x43f3();}export const roleDetail={'service':a175_0xb38f3(0x15f),'command':a175_0xb38f3(0x156),'description':'Show\x20a\x20single\x20role\x27s\x20detail','risk':a175_0xb38f3(0x151),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x29115f){const _0x58452c=a175_0xb38f3,_0x1b562c=_0x29115f[_0x58452c(0x152)]('id'),_0x1c8ce5=await getRoleById(_0x29115f[_0x58452c(0x15c)],_0x1b562c);return{'ok':!![],'data':{'scope':_0x58452c(0x14f),'role':projectRole(_0x1c8ce5)},'message':_0x58452c(0x155)+_0x1c8ce5[_0x58452c(0x15b)]+'\x20('+_0x1c8ce5[_0x58452c(0x158)]+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xcecf7e,_0x916a8){const _0x3e27b2=a176_0x3aa9,_0x44b953=_0xcecf7e();while(!![]){try{const _0x2db7d7=-parseInt(_0x3e27b2(0x1b5))/0x1*(-parseInt(_0x3e27b2(0x1ae))/0x2)+parseInt(_0x3e27b2(0x1b2))/0x3*(parseInt(_0x3e27b2(0x1af))/0x4)+-parseInt(_0x3e27b2(0x1b3))/0x5*(-parseInt(_0x3e27b2(0x1ad))/0x6)+-parseInt(_0x3e27b2(0x1b6))/0x7*(parseInt(_0x3e27b2(0x1b4))/0x8)+-parseInt(_0x3e27b2(0x1b7))/0x9+parseInt(_0x3e27b2(0x1b0))/0xa+-parseInt(_0x3e27b2(0x1b1))/0xb;if(_0x2db7d7===_0x916a8)break;else _0x44b953['push'](_0x44b953['shift']());}catch(_0x448c03){_0x44b953['push'](_0x44b953['shift']());}}}(a176_0x8df5,0x3921f));function a176_0x8df5(){const _0x162391=['3833208QHxvly','6fEMJAu','10iRASvQ','76372uKEnUv','4675060ZERRSG','3593491eMdFgw','69wSHVrx','398685eZbIUU','238808ZNmLzt','53777UMSDYE','63PMAxcx'];a176_0x8df5=function(){return _0x162391;};return a176_0x8df5();}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';import{roleUserAdd}from'../../commands/role/user-add.js';function a176_0x3aa9(_0x1889ff,_0x45cc67){_0x1889ff=_0x1889ff-0x1ad;const _0x8df56f=a176_0x8df5();let _0x3aa9ba=_0x8df56f[_0x1889ff];return _0x3aa9ba;}import{roleUserRemove}from'../../commands/role/user-remove.js';export const roleDefinitions=[roleList,roleDetail,roleUpdate,roleDelete,roleUserResolve,roleUserAdd,roleUserRemove];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a177_0x38fdee=a177_0x3a32;(function(_0x25f683,_0x148477){const _0x54de98=a177_0x3a32,_0xdbe513=_0x25f683();while(!![]){try{const _0x57cad9=parseInt(_0x54de98(0x116))/0x1+parseInt(_0x54de98(0x121))/0x2*(-parseInt(_0x54de98(0x10f))/0x3)+parseInt(_0x54de98(0x100))/0x4+parseInt(_0x54de98(0x112))/0x5*(parseInt(_0x54de98(0x104))/0x6)+-parseInt(_0x54de98(0x117))/0x7+-parseInt(_0x54de98(0x113))/0x8*(-parseInt(_0x54de98(0x11d))/0x9)+parseInt(_0x54de98(0xfe))/0xa;if(_0x57cad9===_0x148477)break;else _0xdbe513['push'](_0xdbe513['shift']());}catch(_0x20bd21){_0xdbe513['push'](_0xdbe513['shift']());}}}(a177_0x2315,0x9de2f));import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{projectRole}from'../../commands/role/shared.js';function a177_0x3a32(_0x19f7e4,_0x1e0347){_0x19f7e4=_0x19f7e4-0xfc;const _0x231573=a177_0x2315();let _0x3a320d=_0x231573[_0x19f7e4];return _0x3a320d;}const ROLE_TYPES=['ADMIN',a177_0x38fdee(0x11b),a177_0x38fdee(0x107),'CUSTOM'];export const roleList={'service':a177_0x38fdee(0x115),'command':a177_0x38fdee(0xfd),'description':a177_0x38fdee(0x103),'risk':'read','flags':[APPCODE_FLAG_OPTIONAL,{'name':a177_0x38fdee(0xfc),'type':a177_0x38fdee(0x11c),'required':![],'description':a177_0x38fdee(0x111),'enum':ROLE_TYPES},{'name':a177_0x38fdee(0x119),'type':a177_0x38fdee(0x114),'description':a177_0x38fdee(0x109),'default':0x1},{'name':'pagesize','type':a177_0x38fdee(0x114),'description':a177_0x38fdee(0x10d),'default':0x64}],async 'validate'(_0x32a8d2){const _0x1d9382=a177_0x38fdee,_0xb52b81=_0x32a8d2['str']('type')[_0x1d9382(0x110)]();if(_0xb52b81&&!ROLE_TYPES[_0x1d9382(0x10e)](_0xb52b81['toUpperCase']()))throw CliErrors[_0x1d9382(0x118)](_0x1d9382(0x10b)+_0xb52b81+'\x22.',_0x1d9382(0x10c)+ROLE_TYPES[_0x1d9382(0x11a)](',\x20')+'.');const _0x3b164c=_0x32a8d2[_0x1d9382(0x105)](_0x1d9382(0x119),0x1),_0x146cd8=_0x32a8d2[_0x1d9382(0x105)]('pagesize',0x64);if(_0x3b164c<0x1)throw CliErrors[_0x1d9382(0x118)](_0x1d9382(0x106));if(_0x146cd8<0x1||_0x146cd8>0x64)throw CliErrors['validation'](_0x1d9382(0xff));},async 'execute'(_0x23bed0){const _0x24edfb=a177_0x38fdee,_0x146a14=_0x23bed0['num'](_0x24edfb(0x119),0x1)||0x1,_0x6b516e=_0x23bed0[_0x24edfb(0x105)](_0x24edfb(0x102),0x64)||0x64,_0x36323a=_0x23bed0[_0x24edfb(0x108)]('type')['trim']()[_0x24edfb(0x11f)](),{items:_0x350c7a,paging:_0x589178}=await listAppRoles(_0x23bed0[_0x24edfb(0x101)],{'currentPage':_0x146a14,'pageSize':_0x6b516e}),_0x47896f=_0x36323a?_0x350c7a[_0x24edfb(0x11e)](_0x4cb6c6=>_0x4cb6c6['roleType']===_0x36323a):_0x350c7a,_0x50adc7=_0x47896f['map'](projectRole);return{'ok':!![],'data':{'scope':'dev','roles':_0x50adc7,'paging':_0x589178},'message':'Found\x20'+_0x50adc7[_0x24edfb(0x10a)]+_0x24edfb(0x120)};}};function a177_0x2315(){const _0x351e50=['appCode','pagesize','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','4425054cuXPJn','num','--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.','OWNER','str','Page\x20index\x20(1-based)','length','Invalid\x20--type\x20\x22','Use\x20one\x20of:\x20','Page\x20size\x20(1-100)','includes','3804423eqJuCZ','trim','Filter\x20by\x20role\x20type','5maCakt','303592sEZgJD','number','role','830398zwRfqO','7243467tfOzQE','validation','page','join','DEV','string','117vCSjHE','filter','toUpperCase','\x20role(s)','2MGdibo','type','list','8422340JMkxTN','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','184588FsNKrT'];a177_0x2315=function(){return _0x351e50;};return a177_0x2315();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a178_0x19e903=a178_0x355e;(function(_0xf37989,_0x2fd630){const _0x5c76e2=a178_0x355e,_0x5a3f30=_0xf37989();while(!![]){try{const _0x119cab=-parseInt(_0x5c76e2(0x1cf))/0x1*(-parseInt(_0x5c76e2(0x1d1))/0x2)+parseInt(_0x5c76e2(0x1ad))/0x3+parseInt(_0x5c76e2(0x1ac))/0x4*(-parseInt(_0x5c76e2(0x1ce))/0x5)+parseInt(_0x5c76e2(0x1b5))/0x6*(-parseInt(_0x5c76e2(0x198))/0x7)+parseInt(_0x5c76e2(0x1a5))/0x8+-parseInt(_0x5c76e2(0x1a1))/0x9*(-parseInt(_0x5c76e2(0x1b1))/0xa)+parseInt(_0x5c76e2(0x196))/0xb*(-parseInt(_0x5c76e2(0x18a))/0xc);if(_0x119cab===_0x2fd630)break;else _0x5a3f30['push'](_0x5a3f30['shift']());}catch(_0x341dea){_0x5a3f30['push'](_0x5a3f30['shift']());}}}(a178_0x55da,0x2e257));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_0x19e903(0x1c4),'required':!![],'description':a178_0x19e903(0x1a0)};export const ROLE_REF_FLAG={'name':a178_0x19e903(0x1b9),'type':'string','required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a178_0x19e903(0x189),'type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a178_0x19e903(0x188),'type':a178_0x19e903(0x1c2),'required':!![],'description':a178_0x19e903(0x1a2)};export const USER_NAME_FLAG={'name':a178_0x19e903(0x188),'type':'string','required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a178_0x19e903(0x186),'type':'string','required':![],'description':'Optional\x20role\x20remark/description'};function a178_0x55da(){const _0x6dd09a=['Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','\x20is\x20already\x20a\x20member\x20of\x20role\x20','36256phcywd','Pass\x20--user\x20<id|name>.','1387946BFNkNK','validation','nickname','Pass\x20--role\x20<id|name>.','username','push','dryRun','/smartapi/permit/user-role/delete','Role\x20id\x20(from\x20`role\x20list`)','284499ViHcLD','Role\x20name','roleType','\x20is\x20not\x20a\x20member\x20of\x20role\x20','1943992exMNrX','ADMIN','\x20duplicate\x20memberships\x20for\x20user\x20','tenant_code','Role\x20name\x20\x22','\x22:\x20','Check\x20the\x20nickname/username.\x20','8ptGTTF','18957pIJSQg','\x20members\x20of\x20the\x20OWNER\x20role.','user-add','trim','50BKWoCc','userCount','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.',';\x20no\x20change.','6jCNBuK','test','join','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','role','expectUserCount','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','toLowerCase','filter','roleName','totalCount','userId','map','string','str','number','Missing\x20user\x20reference.','flagMissing','length','Role\x20id\x20','\x20built-in\x20role\x20','tenant','includes','\x22\x20is\x20ambiguous\x20(ids:\x20','flag','277775vppcZO','15721xVzyYC','Multiple\x20tenant\x20members\x20match\x20\x22','12ZdLSpg','Pass\x20--user\x20<id>.','No\x20tenant\x20member\x20matches\x20\x22','remark','appCode','name','user','12GMAJHJ','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','find','/smartapi/permit/user-role/create','dev','DEV','\x20not\x20found\x20in\x20app\x20','\x20member(s)\x20but\x20role\x20has\x20','\x22\x20not\x20found\x20in\x20app\x20','permitCount'];a178_0x55da=function(){return _0x6dd09a;};return a178_0x55da();}export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a178_0x19e903(0x1c4),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a178_0x19e903(0x1a6),a178_0x19e903(0x18f),'OWNER'];export function isBuiltinRole(_0x49e8a5){const _0x3d863f=a178_0x19e903;return BUILTIN_ROLE_TYPES[_0x3d863f(0x1cb)](_0x49e8a5);}export function assertCustomRole(_0x870e7d,_0x225b41){const _0xe5f7a0=a178_0x19e903;if(_0x870e7d[_0xe5f7a0(0x1a3)]!=='CUSTOM')throw CliErrors['validation']('Cannot\x20'+_0x225b41+_0xe5f7a0(0x1c9)+_0x870e7d[_0xe5f7a0(0x1be)]+'\x20('+_0x870e7d[_0xe5f7a0(0x1a3)]+').',_0xe5f7a0(0x1bb));}export function projectRole(_0x537951){const _0x395319=a178_0x19e903;return{'id':_0x537951['id'],'roleName':_0x537951[_0x395319(0x1be)],'roleType':_0x537951[_0x395319(0x1a3)],'remark':_0x537951[_0x395319(0x186)],'userCount':_0x537951[_0x395319(0x1b2)],'permitCount':_0x537951[_0x395319(0x193)],'builtin':isBuiltinRole(_0x537951[_0x395319(0x1a3)])};}export async function resolveRoleRef(_0x41846e,_0x29a86a){const _0x13713d=a178_0x19e903,_0x122129=_0x29a86a[_0x13713d(0x1b0)]();if(!_0x122129)throw CliErrors['validation']('Missing\x20role\x20reference.',_0x13713d(0x19b));if(/^\d+$/[_0x13713d(0x1b6)](_0x122129))return getRoleById(_0x41846e,Number(_0x122129));const _0x11465=await listAllAppRoles(_0x41846e),_0xdddaf6=_0x11465[_0x13713d(0x1bd)](_0x2813ed=>_0x2813ed['roleName']===_0x122129);if(_0xdddaf6['length']===0x0)throw CliErrors[_0x13713d(0x199)](_0x13713d(0x1a9)+_0x122129+_0x13713d(0x192)+_0x41846e+'.',_0x13713d(0x1b3));if(_0xdddaf6['length']>0x1){const _0x356d8f=_0xdddaf6[_0x13713d(0x1c1)](_0x4f3d58=>_0x4f3d58['id'])[_0x13713d(0x1b7)](',\x20');throw CliErrors['validation'](_0x13713d(0x1a9)+_0x122129+_0x13713d(0x1cc)+_0x356d8f+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0xdddaf6[0x0];}export async function getRoleById(_0x2e384a,_0x29ee3b){const _0x7a555=a178_0x19e903,_0x581774=await listAllAppRoles(_0x2e384a),_0x564e5b=_0x581774[_0x7a555(0x1bd)](_0x3a1a18=>_0x3a1a18['id']===_0x29ee3b&&(!_0x3a1a18[_0x7a555(0x187)]||_0x3a1a18[_0x7a555(0x187)]===_0x2e384a));if(_0x564e5b[_0x7a555(0x1c7)]!==0x1)throw CliErrors[_0x7a555(0x199)](_0x7a555(0x1c8)+_0x29ee3b+_0x7a555(0x190)+_0x2e384a+'.',_0x7a555(0x194));return _0x564e5b[0x0];}async function listAllAppRoles(_0x85e207){const _0x4ff196=a178_0x19e903,_0x37a36c=0x64,_0x55155e=[];for(let _0x586ab6=0x1;;_0x586ab6+=0x1){const {items:_0x2de4b3,paging:_0x51a7e8}=await listAppRoles(_0x85e207,{'currentPage':_0x586ab6,'pageSize':_0x37a36c});_0x55155e['push'](..._0x2de4b3);if(_0x2de4b3[_0x4ff196(0x1c7)]<_0x37a36c||_0x51a7e8&&_0x55155e[_0x4ff196(0x1c7)]>=_0x51a7e8[_0x4ff196(0x1bf)])return _0x55155e;}}export async function resolveTenantCode(){const _0x256e72=a178_0x19e903,_0x15dba9=await getSessionUserInfo(),_0x15e8bc=_0x15dba9?.[_0x256e72(0x189)]?.[_0x256e72(0x1ca)]?.[_0x256e72(0x1a8)];if(!_0x15e8bc)throw CliErrors['authRequired'](_0x256e72(0x1b8));return _0x15e8bc;}function matchMember(_0x453b4d,_0x376673){const _0x42a002=a178_0x19e903,_0x3cbfa2=_0x376673[_0x42a002(0x1b0)]()[_0x42a002(0x1bc)]();return(_0x453b4d[_0x42a002(0x19a)]??'')['toLowerCase']()===_0x3cbfa2||(_0x453b4d[_0x42a002(0x19c)]??'')[_0x42a002(0x1bc)]()===_0x3cbfa2;}function a178_0x355e(_0x3cf0a1,_0x20f0a2){_0x3cf0a1=_0x3cf0a1-0x186;const _0x55da6f=a178_0x55da();let _0x355e91=_0x55da6f[_0x3cf0a1];return _0x355e91;}export async function resolveUserRef(_0x17acc1,_0x576931=a178_0x19e903(0x1d2)){const _0x1314eb=a178_0x19e903,_0x2e2541=_0x17acc1[_0x1314eb(0x1b0)]();if(!_0x2e2541)throw CliErrors[_0x1314eb(0x199)](_0x1314eb(0x1c5),_0x1314eb(0x197));const _0x1e58e8=await resolveTenantCode(),_0xe70493=await getTenantMembers(_0x1e58e8);if(/^\d+$/[_0x1314eb(0x1b6)](_0x2e2541)){const _0xd6eadb=Number(_0x2e2541),_0x1e9bfd=_0xe70493[_0x1314eb(0x18c)](_0x4f3c36=>_0x4f3c36[_0x1314eb(0x1c0)]===_0xd6eadb);return{'userId':_0xd6eadb,'username':_0x1e9bfd?.['username']??String(_0xd6eadb),'nickname':_0x1e9bfd?.['nickname'],'matchedBy':'id'};}const _0x5ed2f6=_0xe70493[_0x1314eb(0x1bd)](_0x45d488=>matchMember(_0x45d488,_0x2e2541));if(_0x5ed2f6[_0x1314eb(0x1c7)]===0x0)throw CliErrors[_0x1314eb(0x199)](_0x1314eb(0x1d3)+_0x2e2541+'\x22.',_0x1314eb(0x1ab)+_0x576931);if(_0x5ed2f6['length']>0x1){const _0x2ef22c=_0x5ed2f6[_0x1314eb(0x1c1)](_0x371f43=>(_0x371f43[_0x1314eb(0x19a)]??_0x371f43[_0x1314eb(0x19c)]??'?')+'('+_0x371f43[_0x1314eb(0x1c0)]+')')[_0x1314eb(0x1b7)](',\x20');throw CliErrors[_0x1314eb(0x199)](_0x1314eb(0x1d0)+_0x2e2541+_0x1314eb(0x1aa)+_0x2ef22c+'.',_0x576931);}const _0x210f69=_0x5ed2f6[0x0];return{'userId':_0x210f69['userId'],'username':_0x210f69[_0x1314eb(0x19c)]??String(_0x210f69[_0x1314eb(0x1c0)]),'nickname':_0x210f69['nickname'],'matchedBy':_0x1314eb(0x188)};}export const CREATE_USER_ROLE_PATH=a178_0x19e903(0x18d);export const DELETE_USER_ROLE_PATH=a178_0x19e903(0x19f);export function computeRoleUserMutation(_0x5dd141){const _0x20c905=a178_0x19e903,{operation:_0x131bda,appCode:_0x18ca11,role:_0x101e02,relations:_0x441bc2,user:_0x12a03c}=_0x5dd141,_0x455e8f=[...new Set(_0x441bc2[_0x20c905(0x1c1)](_0x35038e=>_0x35038e[_0x20c905(0x1c0)]))],_0x266e94=[];if(_0x5dd141[_0x20c905(0x1ba)]!==undefined&&_0x5dd141[_0x20c905(0x1ba)]!==_0x455e8f[_0x20c905(0x1c7)])throw CliErrors['validation']('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x5dd141['expectUserCount']+_0x20c905(0x191)+_0x455e8f[_0x20c905(0x1c7)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x56f1c4=_0x455e8f[_0x20c905(0x1cb)](_0x12a03c[_0x20c905(0x1c0)]),_0x62b055=_0x441bc2['filter'](_0x18cdcd=>_0x18cdcd[_0x20c905(0x1c0)]===_0x12a03c['userId'])[_0x20c905(0x1c1)](_0x22d5a6=>_0x22d5a6['id']),_0x4f4e0b=_0x131bda===_0x20c905(0x1af)?!_0x56f1c4:_0x56f1c4;let _0x23b63d=_0x455e8f;_0x131bda===_0x20c905(0x1af)?_0x56f1c4?_0x266e94['push']('User\x20'+_0x12a03c['userId']+_0x20c905(0x195)+_0x101e02[_0x20c905(0x1be)]+_0x20c905(0x1b4)):_0x23b63d=[..._0x455e8f,_0x12a03c['userId']]:!_0x56f1c4?_0x266e94[_0x20c905(0x19d)]('User\x20'+_0x12a03c['userId']+_0x20c905(0x1a4)+_0x101e02['roleName']+_0x20c905(0x1b4)):(_0x23b63d=_0x455e8f[_0x20c905(0x1bd)](_0x4c48e6=>_0x4c48e6!==_0x12a03c['userId']),_0x62b055[_0x20c905(0x1c7)]>0x1&&_0x266e94[_0x20c905(0x19d)]('Removed\x20'+_0x62b055[_0x20c905(0x1c7)]+_0x20c905(0x1a7)+_0x12a03c[_0x20c905(0x1c0)]+'.'));const _0x5d910d={'scope':_0x20c905(0x18e),'operation':_0x131bda,'selector':{'appCode':_0x18ca11,'roleId':_0x101e02['id'],'roleName':_0x101e02[_0x20c905(0x1be)],'userId':_0x12a03c[_0x20c905(0x1c0)]},'before':{'userIds':_0x455e8f},'after':{'userIds':_0x23b63d},'dryRun':_0x5dd141[_0x20c905(0x19e)],'backend':{'method':'POST','path':_0x131bda==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x266e94};return{'mutation':_0x5d910d,'changed':_0x4f4e0b,'matchingRelationIds':_0x62b055};}export async function loadDevRoleRelations(_0x42d653,_0x33e29c){const _0x57bc55=a178_0x19e903,_0x2cb412=0x64,_0x5b1b21=[];for(let _0x22fb65=0x1;;_0x22fb65+=0x1){const {items:_0x4a25d0,paging:_0x4e3278}=await listDevUserRoleRelations(_0x42d653,{'roleId':_0x33e29c,'currentPage':_0x22fb65,'pageSize':_0x2cb412});_0x5b1b21['push'](..._0x4a25d0);if(_0x4a25d0[_0x57bc55(0x1c7)]<_0x2cb412||_0x4e3278&&_0x5b1b21['length']>=_0x4e3278['totalCount'])return _0x5b1b21;}}export function readRoleRef(_0x2082c9){const _0x380bdd=a178_0x19e903,_0x2001a9=_0x2082c9[_0x380bdd(0x1c3)](_0x380bdd(0x1b9))[_0x380bdd(0x1b0)]();if(!_0x2001a9)throw CliErrors[_0x380bdd(0x1c6)](_0x380bdd(0x1b9),'Pass\x20--role\x20<id|name>.');return _0x2001a9;}export async function prepareUserMutation(_0x22e066,_0x561f86,_0x54ab2e){const _0x258e5a=a178_0x19e903,_0x1e462b=readRoleRef(_0x22e066),_0x704c9e=_0x22e066[_0x258e5a(0x1c3)]('user')[_0x258e5a(0x1b0)]();if(!_0x704c9e)throw CliErrors[_0x258e5a(0x1c6)](_0x258e5a(0x189),'Pass\x20--user\x20<id|name>.');const _0x5edddd=_0x22e066[_0x258e5a(0x1cd)]('expect-user-count'),_0x17d688=_0x5edddd===undefined||_0x5edddd===null?undefined:Number(_0x5edddd),_0x5b6aec=await resolveRoleRef(_0x22e066[_0x258e5a(0x187)],_0x1e462b);if(_0x5b6aec['roleType']==='OWNER')throw CliErrors[_0x258e5a(0x199)]('Cannot\x20'+_0x561f86+_0x258e5a(0x1ae),_0x258e5a(0x18b));const _0x184fef=await resolveUserRef(_0x704c9e),_0x4bc4d7=await loadDevRoleRelations(_0x22e066[_0x258e5a(0x187)],_0x5b6aec['id']);return{...computeRoleUserMutation({'operation':_0x561f86,'appCode':_0x22e066[_0x258e5a(0x187)],'role':_0x5b6aec,'relations':_0x4bc4d7,'user':{'userId':_0x184fef[_0x258e5a(0x1c0)],'username':_0x184fef[_0x258e5a(0x19c)],'nickname':_0x184fef[_0x258e5a(0x19a)]},'dryRun':_0x54ab2e,..._0x17d688!==undefined?{'expectUserCount':_0x17d688}:{}}),'role':_0x5b6aec,'user':_0x184fef};}
|
|
1
|
+
const a178_0x2245a4=a178_0x53e1;function a178_0x5a31(){const _0x30b702=['4AdvGun','totalCount','dryRun','tenant_code','1033012zjkhOs','push','permitCount','\x20not\x20found\x20in\x20app\x20','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','string','user','Role\x20id\x20or\x20exact\x20role\x20name','toLowerCase','DEV','tenant','\x20built-in\x20role\x20','\x22\x20not\x20found\x20in\x20app\x20','number','name','Check\x20the\x20nickname/username.\x20','test','Missing\x20user\x20reference.','\x20members\x20of\x20the\x20OWNER\x20role.','Optional\x20role\x20remark/description','join','map','Role\x20id\x20','dev','11490984RdUcjB','Multiple\x20tenant\x20members\x20match\x20\x22','8XfbqQM','Cannot\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Pass\x20--user\x20<id|name>.','Pass\x20--role\x20<id|name>.','roleName','username','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','role','remark','flagMissing','Role\x20name\x20\x22','\x20duplicate\x20memberships\x20for\x20user\x20','filter','authRequired','User\x20','includes','143WyCOpC','ADMIN','Role\x20name','13466243SPoLWS','\x22\x20is\x20ambiguous\x20(ids:\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.',';\x20no\x20change.','/smartapi/permit/user-role/create','1254030DKGzSr','\x20member(s)\x20but\x20role\x20has\x20','userId','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','length','str','find','userCount','Anti-drift\x20check\x20failed:\x20expected\x20','CUSTOM','3amVYSy','9025715idsAqI','flag','roleType','validation','expect-user-count','OWNER','POST','expectUserCount','1713456hShFsX','nickname','appCode','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','trim','4991097zVMszN','user-add','Pass\x20--user\x20<id>.','Role\x20id\x20(from\x20`role\x20list`)'];a178_0x5a31=function(){return _0x30b702;};return a178_0x5a31();}(function(_0x31d315,_0x5d98fa){const _0x558024=a178_0x53e1,_0x4b08a8=_0x31d315();while(!![]){try{const _0x575042=parseInt(_0x558024(0xce))/0x1*(-parseInt(_0x558024(0xe5))/0x2)+-parseInt(_0x558024(0xdd))/0x3+-parseInt(_0x558024(0xe1))/0x4*(-parseInt(_0x558024(0xcf))/0x5)+parseInt(_0x558024(0xfd))/0x6+parseInt(_0x558024(0xbf))/0x7*(parseInt(_0x558024(0xff))/0x8)+parseInt(_0x558024(0xd7))/0x9+parseInt(_0x558024(0xc4))/0xa*(-parseInt(_0x558024(0xbc))/0xb);if(_0x575042===_0x5d98fa)break;else _0x4b08a8['push'](_0x4b08a8['shift']());}catch(_0x327add){_0x4b08a8['push'](_0x4b08a8['shift']());}}}(a178_0x5a31,0xf1f08));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_0x2245a4(0xf2),'required':!![],'description':a178_0x2245a4(0xe0)};export const ROLE_REF_FLAG={'name':a178_0x2245a4(0x107),'type':a178_0x2245a4(0xea),'required':!![],'description':a178_0x2245a4(0xec)};export const USER_REF_FLAG={'name':a178_0x2245a4(0xeb),'type':'string','required':!![],'description':a178_0x2245a4(0x106)};export const NAME_FLAG={'name':a178_0x2245a4(0xf3),'type':a178_0x2245a4(0xea),'required':!![],'description':a178_0x2245a4(0xbe)};export const USER_NAME_FLAG={'name':a178_0x2245a4(0xf3),'type':a178_0x2245a4(0xea),'required':!![],'description':a178_0x2245a4(0xda)};export const REMARK_FLAG={'name':a178_0x2245a4(0x108),'type':a178_0x2245a4(0xea),'required':![],'description':a178_0x2245a4(0xf8)};export const EXPECT_USER_COUNT_FLAG={'name':a178_0x2245a4(0xd3),'type':'number','required':![],'description':a178_0x2245a4(0xc7)};export const BUILTIN_ROLE_TYPES=[a178_0x2245a4(0xbd),a178_0x2245a4(0xee),a178_0x2245a4(0xd4)];export function isBuiltinRole(_0x4cbc79){const _0x13b477=a178_0x2245a4;return BUILTIN_ROLE_TYPES[_0x13b477(0xbb)](_0x4cbc79);}export function assertCustomRole(_0x250e7c,_0x37e7ae){const _0x10a901=a178_0x2245a4;if(_0x250e7c[_0x10a901(0xd1)]!==_0x10a901(0xcd))throw CliErrors[_0x10a901(0xd2)](_0x10a901(0x100)+_0x37e7ae+_0x10a901(0xf0)+_0x250e7c[_0x10a901(0x104)]+'\x20('+_0x250e7c[_0x10a901(0xd1)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x59617d){const _0x1ece3f=a178_0x2245a4;return{'id':_0x59617d['id'],'roleName':_0x59617d[_0x1ece3f(0x104)],'roleType':_0x59617d['roleType'],'remark':_0x59617d[_0x1ece3f(0x108)],'userCount':_0x59617d[_0x1ece3f(0xcb)],'permitCount':_0x59617d[_0x1ece3f(0xe7)],'builtin':isBuiltinRole(_0x59617d['roleType'])};}export async function resolveRoleRef(_0x25f4b5,_0xaa2baf){const _0x1cd7cf=a178_0x2245a4,_0xc6a977=_0xaa2baf['trim']();if(!_0xc6a977)throw CliErrors[_0x1cd7cf(0xd2)]('Missing\x20role\x20reference.',_0x1cd7cf(0x103));if(/^\d+$/[_0x1cd7cf(0xf5)](_0xc6a977))return getRoleById(_0x25f4b5,Number(_0xc6a977));const _0x10b647=await listAllAppRoles(_0x25f4b5),_0x3ac98b=_0x10b647[_0x1cd7cf(0xb8)](_0x355658=>_0x355658[_0x1cd7cf(0x104)]===_0xc6a977);if(_0x3ac98b[_0x1cd7cf(0xc8)]===0x0)throw CliErrors[_0x1cd7cf(0xd2)](_0x1cd7cf(0xb6)+_0xc6a977+_0x1cd7cf(0xf1)+_0x25f4b5+'.',_0x1cd7cf(0x101));if(_0x3ac98b[_0x1cd7cf(0xc8)]>0x1){const _0x795451=_0x3ac98b['map'](_0x29eee4=>_0x29eee4['id'])[_0x1cd7cf(0xf9)](',\x20');throw CliErrors[_0x1cd7cf(0xd2)]('Role\x20name\x20\x22'+_0xc6a977+_0x1cd7cf(0xc0)+_0x795451+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x3ac98b[0x0];}export async function getRoleById(_0x7a98e0,_0x54cc49){const _0x50eb89=a178_0x2245a4,_0x2e38b5=await listAllAppRoles(_0x7a98e0),_0x2edb7d=_0x2e38b5[_0x50eb89(0xb8)](_0x154b2c=>_0x154b2c['id']===_0x54cc49&&(!_0x154b2c[_0x50eb89(0xd9)]||_0x154b2c[_0x50eb89(0xd9)]===_0x7a98e0));if(_0x2edb7d[_0x50eb89(0xc8)]!==0x1)throw CliErrors[_0x50eb89(0xd2)](_0x50eb89(0xfb)+_0x54cc49+_0x50eb89(0xe8)+_0x7a98e0+'.',_0x50eb89(0xc1));return _0x2edb7d[0x0];}async function listAllAppRoles(_0x206fd0){const _0x371b8f=a178_0x2245a4,_0x155cc7=0x64,_0x21766a=[];for(let _0x260698=0x1;;_0x260698+=0x1){const {items:_0x107c72,paging:_0x5a4ba0}=await listAppRoles(_0x206fd0,{'currentPage':_0x260698,'pageSize':_0x155cc7});_0x21766a[_0x371b8f(0xe6)](..._0x107c72);if(_0x107c72[_0x371b8f(0xc8)]<_0x155cc7||_0x5a4ba0&&_0x21766a['length']>=_0x5a4ba0[_0x371b8f(0xe2)])return _0x21766a;}}export async function resolveTenantCode(){const _0xb5bb83=a178_0x2245a4,_0x1b878d=await getSessionUserInfo(),_0x4ef568=_0x1b878d?.['user']?.[_0xb5bb83(0xef)]?.[_0xb5bb83(0xe4)];if(!_0x4ef568)throw CliErrors[_0xb5bb83(0xb9)](_0xb5bb83(0xdb));return _0x4ef568;}function matchMember(_0x45106e,_0x3fbfe1){const _0x4bbae9=a178_0x2245a4,_0x24dc39=_0x3fbfe1['trim']()['toLowerCase']();return(_0x45106e[_0x4bbae9(0xd8)]??'')[_0x4bbae9(0xed)]()===_0x24dc39||(_0x45106e[_0x4bbae9(0x105)]??'')[_0x4bbae9(0xed)]()===_0x24dc39;}export async function resolveUserRef(_0x4da721,_0x4332d5=a178_0x2245a4(0xdf)){const _0x6ec11b=a178_0x2245a4,_0x29a028=_0x4da721[_0x6ec11b(0xdc)]();if(!_0x29a028)throw CliErrors[_0x6ec11b(0xd2)](_0x6ec11b(0xf6),_0x6ec11b(0x102));const _0x250031=await resolveTenantCode(),_0x2629b0=await getTenantMembers(_0x250031);if(/^\d+$/['test'](_0x29a028)){const _0x49063d=Number(_0x29a028),_0x56eee6=_0x2629b0[_0x6ec11b(0xca)](_0x44b79f=>_0x44b79f[_0x6ec11b(0xc6)]===_0x49063d);return{'userId':_0x49063d,'username':_0x56eee6?.[_0x6ec11b(0x105)]??String(_0x49063d),'nickname':_0x56eee6?.['nickname'],'matchedBy':'id'};}const _0xaa0f8f=_0x2629b0[_0x6ec11b(0xb8)](_0x16cb43=>matchMember(_0x16cb43,_0x29a028));if(_0xaa0f8f[_0x6ec11b(0xc8)]===0x0)throw CliErrors['validation']('No\x20tenant\x20member\x20matches\x20\x22'+_0x29a028+'\x22.',_0x6ec11b(0xf4)+_0x4332d5);if(_0xaa0f8f[_0x6ec11b(0xc8)]>0x1){const _0x2d43b4=_0xaa0f8f[_0x6ec11b(0xfa)](_0x585ad1=>(_0x585ad1[_0x6ec11b(0xd8)]??_0x585ad1[_0x6ec11b(0x105)]??'?')+'('+_0x585ad1[_0x6ec11b(0xc6)]+')')[_0x6ec11b(0xf9)](',\x20');throw CliErrors[_0x6ec11b(0xd2)](_0x6ec11b(0xfe)+_0x29a028+'\x22:\x20'+_0x2d43b4+'.',_0x4332d5);}const _0x2c2689=_0xaa0f8f[0x0];return{'userId':_0x2c2689[_0x6ec11b(0xc6)],'username':_0x2c2689['username']??String(_0x2c2689['userId']),'nickname':_0x2c2689[_0x6ec11b(0xd8)],'matchedBy':_0x6ec11b(0xf3)};}export const CREATE_USER_ROLE_PATH=a178_0x2245a4(0xc3);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';export function computeRoleUserMutation(_0x26b519){const _0x49c4a7=a178_0x2245a4,{operation:_0x2e0b5a,appCode:_0x27a344,role:_0x25fdb1,relations:_0xaa9a12,user:_0x10092f}=_0x26b519,_0x146762=[...new Set(_0xaa9a12[_0x49c4a7(0xfa)](_0x2982ed=>_0x2982ed[_0x49c4a7(0xc6)]))],_0x1806bd=[];if(_0x26b519['expectUserCount']!==undefined&&_0x26b519[_0x49c4a7(0xd6)]!==_0x146762[_0x49c4a7(0xc8)])throw CliErrors['validation'](_0x49c4a7(0xcc)+_0x26b519[_0x49c4a7(0xd6)]+_0x49c4a7(0xc5)+_0x146762[_0x49c4a7(0xc8)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x45882f=_0x146762['includes'](_0x10092f[_0x49c4a7(0xc6)]),_0x50f497=_0xaa9a12[_0x49c4a7(0xb8)](_0x12b155=>_0x12b155[_0x49c4a7(0xc6)]===_0x10092f[_0x49c4a7(0xc6)])['map'](_0x5c9598=>_0x5c9598['id']),_0x4a645d=_0x2e0b5a===_0x49c4a7(0xde)?!_0x45882f:_0x45882f;let _0x550833=_0x146762;_0x2e0b5a===_0x49c4a7(0xde)?_0x45882f?_0x1806bd[_0x49c4a7(0xe6)]('User\x20'+_0x10092f['userId']+'\x20is\x20already\x20a\x20member\x20of\x20role\x20'+_0x25fdb1['roleName']+_0x49c4a7(0xc2)):_0x550833=[..._0x146762,_0x10092f[_0x49c4a7(0xc6)]]:!_0x45882f?_0x1806bd['push'](_0x49c4a7(0xba)+_0x10092f[_0x49c4a7(0xc6)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x25fdb1[_0x49c4a7(0x104)]+';\x20no\x20change.'):(_0x550833=_0x146762[_0x49c4a7(0xb8)](_0x42e21f=>_0x42e21f!==_0x10092f['userId']),_0x50f497['length']>0x1&&_0x1806bd['push']('Removed\x20'+_0x50f497[_0x49c4a7(0xc8)]+_0x49c4a7(0xb7)+_0x10092f[_0x49c4a7(0xc6)]+'.'));const _0x5b712b={'scope':_0x49c4a7(0xfc),'operation':_0x2e0b5a,'selector':{'appCode':_0x27a344,'roleId':_0x25fdb1['id'],'roleName':_0x25fdb1[_0x49c4a7(0x104)],'userId':_0x10092f[_0x49c4a7(0xc6)]},'before':{'userIds':_0x146762},'after':{'userIds':_0x550833},'dryRun':_0x26b519[_0x49c4a7(0xe3)],'backend':{'method':_0x49c4a7(0xd5),'path':_0x2e0b5a===_0x49c4a7(0xde)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x1806bd};return{'mutation':_0x5b712b,'changed':_0x4a645d,'matchingRelationIds':_0x50f497};}export async function loadDevRoleRelations(_0x524cad,_0x306480){const _0x503fcb=a178_0x2245a4,_0x5ae35a=0x64,_0x2cc7ce=[];for(let _0x2b8627=0x1;;_0x2b8627+=0x1){const {items:_0x51f44c,paging:_0x545cf2}=await listDevUserRoleRelations(_0x524cad,{'roleId':_0x306480,'currentPage':_0x2b8627,'pageSize':_0x5ae35a});_0x2cc7ce['push'](..._0x51f44c);if(_0x51f44c['length']<_0x5ae35a||_0x545cf2&&_0x2cc7ce[_0x503fcb(0xc8)]>=_0x545cf2[_0x503fcb(0xe2)])return _0x2cc7ce;}}function a178_0x53e1(_0xbdb43d,_0x22b739){_0xbdb43d=_0xbdb43d-0xb5;const _0x5a318a=a178_0x5a31();let _0x53e1ad=_0x5a318a[_0xbdb43d];return _0x53e1ad;}export function readRoleRef(_0x25d18f){const _0x3a60d0=a178_0x2245a4,_0x377914=_0x25d18f[_0x3a60d0(0xc9)](_0x3a60d0(0x107))[_0x3a60d0(0xdc)]();if(!_0x377914)throw CliErrors[_0x3a60d0(0xb5)](_0x3a60d0(0x107),_0x3a60d0(0x103));return _0x377914;}export async function prepareUserMutation(_0x3bd98d,_0x3429ff,_0x1f7cbc){const _0x2289d5=a178_0x2245a4,_0x57500a=readRoleRef(_0x3bd98d),_0x2b6284=_0x3bd98d[_0x2289d5(0xc9)](_0x2289d5(0xeb))[_0x2289d5(0xdc)]();if(!_0x2b6284)throw CliErrors[_0x2289d5(0xb5)]('user','Pass\x20--user\x20<id|name>.');const _0x14f532=_0x3bd98d[_0x2289d5(0xd0)]('expect-user-count'),_0xd47555=_0x14f532===undefined||_0x14f532===null?undefined:Number(_0x14f532),_0x4ef455=await resolveRoleRef(_0x3bd98d[_0x2289d5(0xd9)],_0x57500a);if(_0x4ef455['roleType']==='OWNER')throw CliErrors[_0x2289d5(0xd2)](_0x2289d5(0x100)+_0x3429ff+_0x2289d5(0xf7),_0x2289d5(0xe9));const _0x391be5=await resolveUserRef(_0x2b6284),_0x514186=await loadDevRoleRelations(_0x3bd98d[_0x2289d5(0xd9)],_0x4ef455['id']);return{...computeRoleUserMutation({'operation':_0x3429ff,'appCode':_0x3bd98d[_0x2289d5(0xd9)],'role':_0x4ef455,'relations':_0x514186,'user':{'userId':_0x391be5['userId'],'username':_0x391be5[_0x2289d5(0x105)],'nickname':_0x391be5[_0x2289d5(0xd8)]},'dryRun':_0x1f7cbc,..._0xd47555!==undefined?{'expectUserCount':_0xd47555}:{}}),'role':_0x4ef455,'user':_0x391be5};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x48bdaa=a179_0x133f;(function(_0x5c1587,_0x52755f){const _0x10dfbe=a179_0x133f,_0x3adf7b=_0x5c1587();while(!![]){try{const _0x22f5f5=-parseInt(_0x10dfbe(0xb9))/0x1*(-parseInt(_0x10dfbe(0xca))/0x2)+parseInt(_0x10dfbe(0xb6))/0x3+parseInt(_0x10dfbe(0xbe))/0x4+parseInt(_0x10dfbe(0xc2))/0x5*(parseInt(_0x10dfbe(0xcc))/0x6)+-parseInt(_0x10dfbe(0xc7))/0x7*(-parseInt(_0x10dfbe(0xc4))/0x8)+parseInt(_0x10dfbe(0xbf))/0x9+-parseInt(_0x10dfbe(0xbc))/0xa;if(_0x22f5f5===_0x52755f)break;else _0x3adf7b['push'](_0x3adf7b['shift']());}catch(_0x1b946a){_0x3adf7b['push'](_0x3adf7b['shift']());}}}(a179_0xa85b,0x4e953));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a179_0x133f(_0x15706c,_0xaba341){_0x15706c=_0x15706c-0xb2;const _0xa85b21=a179_0xa85b();let _0x133fdd=_0xa85b21[_0x15706c];return _0x133fdd;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a179_0xa85b(){const _0x2dd181=['15498530ZBDvUG','string','224080aRBZqT','4930029hENaln','appCode','--name\x20cannot\x20be\x20empty.','1093930YVYwHI','dev','6568gkzTIE','POST','flag','651OCcPWN','role','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','229434snsiyR','New\x20role\x20name','6snMsYk','write','update','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','/smartapi/permit/role/update','name','roleName','1197609kYbnKF','num','remark','5maeThU','\x20(id=','length'];a179_0xa85b=function(){return _0x2dd181;};return a179_0xa85b();}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a179_0x48bdaa(0xb3);function readPatch(_0x4c0244){const _0x3d405a=a179_0x48bdaa,_0xc84c80=_0x4c0244[_0x3d405a(0xc6)](_0x3d405a(0xb4)),_0x15ff4d=_0x4c0244[_0x3d405a(0xc6)](_0x3d405a(0xb8)),_0x4be87f={};if(_0xc84c80!==undefined&&_0xc84c80!==null){const _0x4bdc7a=String(_0xc84c80)['trim']();if(!_0x4bdc7a)throw CliErrors['validation'](_0x3d405a(0xc1));if(_0x4bdc7a[_0x3d405a(0xbb)]>0x40)throw CliErrors['validation']('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x4be87f[_0x3d405a(0xb5)]=_0x4bdc7a;}_0x15ff4d!==undefined&&_0x15ff4d!==null&&(_0x4be87f[_0x3d405a(0xb8)]=String(_0x15ff4d));if(_0x4be87f['roleName']===undefined&&_0x4be87f[_0x3d405a(0xb8)]===undefined)throw CliErrors['validation']('Nothing\x20to\x20update.',_0x3d405a(0xb2));return _0x4be87f;}export const roleUpdate={'service':a179_0x48bdaa(0xc8),'command':'update','description':a179_0x48bdaa(0xc9),'risk':a179_0x48bdaa(0xcd),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a179_0x48bdaa(0xbd),'required':![],'description':a179_0x48bdaa(0xcb)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x51f8c2){readPatch(_0x51f8c2);},async 'dryRun'(_0x369c79){const _0x26e09a=a179_0x48bdaa,_0xe66d6=_0x369c79['num']('id'),_0x419455=readPatch(_0x369c79),_0x4109a1=await getRoleById(_0x369c79['appCode'],_0xe66d6);return assertCustomRole(_0x4109a1,_0x26e09a(0xce)),asDryRunResult({'scope':_0x26e09a(0xc3),'operation':_0x26e09a(0xce),'selector':{'appCode':_0x369c79[_0x26e09a(0xc0)],'roleId':_0xe66d6,'roleName':_0x4109a1[_0x26e09a(0xb5)]},'before':projectRole(_0x4109a1),'after':projectRole({..._0x4109a1,..._0x419455[_0x26e09a(0xb5)]!==undefined?{'roleName':_0x419455['roleName']}:{},..._0x419455[_0x26e09a(0xb8)]!==undefined?{'remark':_0x419455[_0x26e09a(0xb8)]}:{}}),'dryRun':!![],'backend':{'method':_0x26e09a(0xc5),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0xb74ac0){const _0x5143d4=a179_0x48bdaa,_0x3c0f78=_0xb74ac0[_0x5143d4(0xb7)]('id'),_0x438074=readPatch(_0xb74ac0),_0x2fc95f=await getRoleById(_0xb74ac0['appCode'],_0x3c0f78);assertCustomRole(_0x2fc95f,_0x5143d4(0xce)),await updateAppRole({'id':_0x3c0f78,'appCode':_0xb74ac0[_0x5143d4(0xc0)],..._0x438074[_0x5143d4(0xb5)]!==undefined?{'roleName':_0x438074[_0x5143d4(0xb5)]}:{},..._0x438074['remark']!==undefined?{'remark':_0x438074['remark']}:{}});const _0x1e0b71=await getRoleById(_0xb74ac0[_0x5143d4(0xc0)],_0x3c0f78);return{'ok':!![],'data':{'scope':'dev','operation':_0x5143d4(0xce),'selector':{'appCode':_0xb74ac0[_0x5143d4(0xc0)],'roleId':_0x3c0f78,'roleName':_0x1e0b71[_0x5143d4(0xb5)]},'before':projectRole(_0x2fc95f),'after':projectRole(_0x1e0b71),'dryRun':![],'backend':{'method':_0x5143d4(0xc5),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x1e0b71['roleName']+_0x5143d4(0xba)+_0x3c0f78+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a180_0x2d9842=a180_0x2b77;(function(_0x1243fe,_0x1e1037){const _0x5199d7=a180_0x2b77,_0x4445d2=_0x1243fe();while(!![]){try{const _0x4e92b4=-parseInt(_0x5199d7(0xa4))/0x1*(parseInt(_0x5199d7(0xa2))/0x2)+-parseInt(_0x5199d7(0xab))/0x3*(-parseInt(_0x5199d7(0xa8))/0x4)+-parseInt(_0x5199d7(0xaa))/0x5+parseInt(_0x5199d7(0xa6))/0x6+-parseInt(_0x5199d7(0x9a))/0x7*(parseInt(_0x5199d7(0xa3))/0x8)+-parseInt(_0x5199d7(0x9b))/0x9+parseInt(_0x5199d7(0xa9))/0xa;if(_0x4e92b4===_0x1e1037)break;else _0x4445d2['push'](_0x4445d2['shift']());}catch(_0x4e4dba){_0x4445d2['push'](_0x4445d2['shift']());}}}(a180_0x15dc,0x6a031));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a180_0x2b77(_0x354f89,_0x529313){_0x354f89=_0x354f89-0x97;const _0x15dc13=a180_0x15dc();let _0x2b7779=_0x15dc13[_0x354f89];return _0x2b7779;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a180_0x2d9842(0x9f),'command':a180_0x2d9842(0x98),'description':a180_0x2d9842(0x9d),'risk':a180_0x2d9842(0xa7),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x430100){const _0x208d90=a180_0x2d9842,{mutation:_0x3ad15d}=await prepareUserMutation(_0x430100,'user-add',!![]);return asDryRunResult(_0x3ad15d,{'method':_0x208d90(0x9e),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x58d8b5){const _0x39f858=a180_0x2d9842,{mutation:_0x2ba787,changed:_0x5462cf,role:_0x2c72c0,user:_0x517d1e}=await prepareUserMutation(_0x58d8b5,_0x39f858(0x98),![]);return _0x5462cf&&await createDevUserRole({'appCode':_0x58d8b5[_0x39f858(0xa5)],'userId':_0x517d1e[_0x39f858(0x97)],'username':_0x517d1e['username'],'roleType':_0x2c72c0[_0x39f858(0xac)],'roleId':_0x2ba787['selector']['roleId']}),{'ok':!![],'data':_0x2ba787,'message':_0x5462cf?_0x39f858(0xa0)+_0x2ba787['selector']['userId']+'\x20to\x20role\x20'+_0x2ba787[_0x39f858(0x9c)][_0x39f858(0x99)]:_0x39f858(0xa1)+_0x2ba787[_0x39f858(0x9c)][_0x39f858(0x97)]+'\x20already\x20in\x20role\x20'+_0x2ba787[_0x39f858(0x9c)]['roleName']};}};function a180_0x15dc(){const _0x5393ef=['5126652rBLDRq','selector','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','POST','role','Added\x20user\x20','No\x20change:\x20user\x20','8250gYTdwU','8qwJSJg','109auoPTF','appCode','1744638xHgvll','high-risk-write','120728AMPXnQ','15600620rFubox','3334370EBGkGR','54LNMbod','roleType','userId','user-add','roleName','1916313KGRIuz'];a180_0x15dc=function(){return _0x5393ef;};return a180_0x15dc();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a181_0x20056e=a181_0x2b5c;function a181_0x2b5c(_0x3eeeee,_0x1b21a1){_0x3eeeee=_0x3eeeee-0x74;const _0x426166=a181_0x4261();let _0x2b5c8c=_0x426166[_0x3eeeee];return _0x2b5c8c;}(function(_0x3e9930,_0x5a1487){const _0x48a997=a181_0x2b5c,_0xb1bb8a=_0x3e9930();while(!![]){try{const _0x9a4370=parseInt(_0x48a997(0x75))/0x1*(-parseInt(_0x48a997(0x87))/0x2)+-parseInt(_0x48a997(0x82))/0x3+parseInt(_0x48a997(0x79))/0x4+parseInt(_0x48a997(0x7e))/0x5*(parseInt(_0x48a997(0x86))/0x6)+parseInt(_0x48a997(0x76))/0x7+parseInt(_0x48a997(0x84))/0x8*(parseInt(_0x48a997(0x78))/0x9)+parseInt(_0x48a997(0x85))/0xa;if(_0x9a4370===_0x5a1487)break;else _0xb1bb8a['push'](_0xb1bb8a['shift']());}catch(_0x43bf3a){_0xb1bb8a['push'](_0xb1bb8a['shift']());}}}(a181_0x4261,0xb49de));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';function a181_0x4261(){const _0x1e9dbe=['9yVTUbL','3186044JaPzUB','role','\x20from\x20role\x20','user-remove','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','1150VAvfIU','userId','Removed\x20user\x20','No\x20change:\x20user\x20','3474126yXSaMq','POST','6890608MFfena','171600ugrygP','14844buSpyE','21598EnZlCm','roleName','46yfeZmS','1054095TvlPNn','selector'];a181_0x4261=function(){return _0x1e9dbe;};return a181_0x4261();}export const roleUserRemove={'service':a181_0x20056e(0x7a),'command':'user-remove','description':a181_0x20056e(0x7d),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x3ec039){const _0xacac13=a181_0x20056e,{mutation:_0x46852b}=await prepareUserMutation(_0x3ec039,'user-remove',!![]);return asDryRunResult(_0x46852b,{'method':_0xacac13(0x83),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x5ed844){const _0x5770bf=a181_0x20056e,{matchingRelationIds:_0x5a4438,mutation:_0x2ca872,changed:_0x5f5d83}=await prepareUserMutation(_0x5ed844,_0x5770bf(0x7c),![]);if(_0x5f5d83)for(const _0x4520fb of _0x5a4438){await deleteDevUserRole(_0x4520fb);}return{'ok':!![],'data':_0x2ca872,'message':_0x5f5d83?_0x5770bf(0x80)+_0x2ca872[_0x5770bf(0x77)][_0x5770bf(0x7f)]+_0x5770bf(0x7b)+_0x2ca872['selector'][_0x5770bf(0x74)]:_0x5770bf(0x81)+_0x2ca872['selector'][_0x5770bf(0x7f)]+'\x20not\x20in\x20role\x20'+_0x2ca872[_0x5770bf(0x77)][_0x5770bf(0x74)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a182_0x322e0c=a182_0x2517;(function(_0x1c268c,_0x2c980f){const _0x1245c1=a182_0x2517,_0x2df777=_0x1c268c();while(!![]){try{const _0x103ecc=parseInt(_0x1245c1(0x140))/0x1+-parseInt(_0x1245c1(0x13f))/0x2*(parseInt(_0x1245c1(0x138))/0x3)+-parseInt(_0x1245c1(0x136))/0x4*(parseInt(_0x1245c1(0x132))/0x5)+-parseInt(_0x1245c1(0x137))/0x6*(parseInt(_0x1245c1(0x133))/0x7)+parseInt(_0x1245c1(0x13b))/0x8+parseInt(_0x1245c1(0x13d))/0x9*(-parseInt(_0x1245c1(0x147))/0xa)+-parseInt(_0x1245c1(0x142))/0xb*(-parseInt(_0x1245c1(0x144))/0xc);if(_0x103ecc===_0x2c980f)break;else _0x2df777['push'](_0x2df777['shift']());}catch(_0x50a938){_0x2df777['push'](_0x2df777['shift']());}}}(a182_0x48c1,0x3fd46));function a182_0x48c1(){const _0x54ca14=['3480akgOMX','user-resolve','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','20CANjIN','read','name','flagMissing','10yFpRTk','1877729nfLaMU','matchedBy','Pass\x20--name\x20<nickname|username>.','69668kRZZfA','6nWUCig','23583LZLiel','username','userId','1008496xxoGZx','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','1666179fRtfQz','role','44byYkya','22639QpiGqJ','trim','36377amYkaN','str'];a182_0x48c1=function(){return _0x54ca14;};return a182_0x48c1();}function a182_0x2517(_0x3b8413,_0x186662){_0x3b8413=_0x3b8413-0x130;const _0x48c1b0=a182_0x48c1();let _0x25175a=_0x48c1b0[_0x3b8413];return _0x25175a;}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a182_0x322e0c(0x13e),'command':a182_0x322e0c(0x145),'description':a182_0x322e0c(0x13c),'risk':a182_0x322e0c(0x148),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1f73da){const _0x463d92=a182_0x322e0c;if(!_0x1f73da[_0x463d92(0x143)](_0x463d92(0x130))[_0x463d92(0x141)]())throw CliErrors[_0x463d92(0x131)](_0x463d92(0x130),_0x463d92(0x135));},async 'execute'(_0x47d61b){const _0x11af97=a182_0x322e0c,_0x1d729e=_0x47d61b[_0x11af97(0x143)](_0x11af97(0x130))[_0x11af97(0x141)](),_0x191c53=await resolveUserRef(_0x1d729e,_0x11af97(0x146));return{'ok':!![],'data':{'user':{'userId':_0x191c53['userId'],'username':_0x191c53[_0x11af97(0x139)],'nickname':_0x191c53['nickname'],'matchedBy':_0x191c53[_0x11af97(0x134)]}},'message':'Resolved\x20\x22'+_0x1d729e+'\x22\x20→\x20userId\x20'+_0x191c53[_0x11af97(0x13a)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a183_0x25b150=a183_0x55aa;function a183_0x55aa(_0x4542f7,_0x4b632b){_0x4542f7=_0x4542f7-0x179;const _0x2d80a4=a183_0x2d80();let _0x55aa3e=_0x2d80a4[_0x4542f7];return _0x55aa3e;}function a183_0x2d80(){const _0x31d47b=['write','No\x20package.json\x20found\x20in\x20current\x20directory.','\x20\x20EXAMPLES','boolean','scripts','470xaNhkc','\x20run\x20','build','start','6366980aXIsqG','args','keys','belowMinimum','preview','error','yarn','Run\x20a\x20package.json\x20script','length','Script\x20\x22','\x20\x20\x20\x20','bun.lock','7426170GxLGdY','dev','bun','283952mAKLzJ','\x20run\x20start','needsUpgrade','pnpm','Enable\x20watch\x20mode\x20for\x20preview','all','Script\x20name\x20defined\x20in\x20package.json','join','inherit','\x0a\x20\x20Usage:\x20','script','close','\x20run\x20build','vite\x20preview\x20exited\x20with\x20code\x20','--watch','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','run','npm','\x0a\x20\x20Available\x20scripts:\x0a','\x20run\x20<script>\x0a','3gamZzY','15400wZGifH','\x20exited\x20with\x20code\x20','has','33678623ymZCDI','utf-8','bun.lockb','watch','pnpm-lock.yaml','log','12SUtfNz','.bin','\x20run\x20preview\x20--watch','node_modules','validation','276370mmGixW','\x22\x20not\x20found\x20in\x20package.json.','144mrCPam','No\x20scripts\x20defined\x20in\x20package.json.','48462WYiDwr','2xRziMe','cwd','push'];a183_0x2d80=function(){return _0x31d47b;};return a183_0x2d80();}(function(_0x41b5e2,_0x3d36da){const _0x2af4a1=a183_0x55aa,_0x5073c2=_0x41b5e2();while(!![]){try{const _0x3f65fb=-parseInt(_0x2af4a1(0x193))/0x1*(parseInt(_0x2af4a1(0x198))/0x2)+parseInt(_0x2af4a1(0x184))/0x3*(-parseInt(_0x2af4a1(0x1b3))/0x4)+-parseInt(_0x2af4a1(0x1a0))/0x5*(parseInt(_0x2af4a1(0x197))/0x6)+parseInt(_0x2af4a1(0x185))/0x7*(-parseInt(_0x2af4a1(0x195))/0x8)+-parseInt(_0x2af4a1(0x1b0))/0x9+-parseInt(_0x2af4a1(0x1a4))/0xa+parseInt(_0x2af4a1(0x188))/0xb*(parseInt(_0x2af4a1(0x18e))/0xc);if(_0x3f65fb===_0x3d36da)break;else _0x5073c2['push'](_0x5073c2['shift']());}catch(_0x1ef80e){_0x5073c2['push'](_0x5073c2['shift']());}}}(a183_0x2d80,0x6ec25));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a183_0x25b150(0x1a3),a183_0x25b150(0x1b1)]);function readPackageScripts(_0x4816bf){const _0x1da561=a183_0x25b150,_0x406661=resolve(_0x4816bf,'package.json');if(!existsSync(_0x406661))return null;try{const _0x5e8acf=JSON['parse'](readFileSync(_0x406661,_0x1da561(0x189)));return _0x5e8acf[_0x1da561(0x19f)]??{};}catch{return null;}}function detectPackageManager(_0x11333a){const _0x4d346c=a183_0x25b150;if(existsSync(resolve(_0x11333a,_0x4d346c(0x18a)))||existsSync(resolve(_0x11333a,_0x4d346c(0x1af))))return _0x4d346c(0x1b2);if(existsSync(resolve(_0x11333a,_0x4d346c(0x18c))))return _0x4d346c(0x1b6);if(existsSync(resolve(_0x11333a,'yarn.lock')))return _0x4d346c(0x1aa);return _0x4d346c(0x181);}async function versionCheck(_0x4b9f37){const _0x392a7a=a183_0x25b150,_0x2a00ae=await checkCliVersion();(_0x2a00ae[_0x392a7a(0x1b5)]||_0x2a00ae[_0x392a7a(0x1a7)])&&(printCliUpgradeWarning(_0x2a00ae),assertCliVersionSupported(_0x2a00ae));const _0x378a65=await checkSdkVersion(_0x4b9f37);if(_0x378a65['needsUpgrade'])printSdkUpgradeWarning(_0x378a65);}function spawnScript(_0x598786,_0x184c98,_0x398ae1,_0x3c770c){return new Promise((_0x17102b,_0x3b8718)=>{const _0x4c291d=a183_0x55aa,_0x26589c=[_0x4c291d(0x180),_0x184c98,..._0x398ae1],_0x5c35a4=spawn(_0x598786,_0x26589c,{'cwd':_0x3c770c,'stdio':_0x4c291d(0x1bb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3c770c,_0x4c291d(0x191),'.bin')+delimiter+process.env.PATH}});_0x5c35a4['on'](_0x4c291d(0x17b),_0x823992=>{const _0x411df4=_0x4c291d;if(_0x823992===0x0||_0x823992===null)_0x17102b();else _0x3b8718(new Error(_0x598786+_0x411df4(0x1a1)+_0x184c98+_0x411df4(0x186)+_0x823992));}),_0x5c35a4['on'](_0x4c291d(0x1a9),_0x3b8718);});}function spawnViteBuildWatch(_0x5a497b){return new Promise((_0x2b5a24,_0x551cfb)=>{const _0x20e5e6=a183_0x55aa,_0x45bd8e=spawn('vite',[_0x20e5e6(0x1a2),_0x20e5e6(0x17e)],{'cwd':_0x5a497b,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5a497b,'node_modules',_0x20e5e6(0x18f))+delimiter+process.env.PATH}});_0x45bd8e['on']('close',_0xff9af8=>{const _0x4a1280=_0x20e5e6;if(_0xff9af8===0x0||_0xff9af8===null)_0x2b5a24();else _0x551cfb(new Error(_0x4a1280(0x17f)+_0xff9af8));}),_0x45bd8e['on'](_0x20e5e6(0x1a9),_0x551cfb);});}function spawnVitePreview(_0x5dc85a){return new Promise((_0x2ad7ad,_0x27b9cf)=>{const _0x5b043e=a183_0x55aa,_0x38cdd7=spawn('vite',[_0x5b043e(0x1a8)],{'cwd':_0x5dc85a,'stdio':_0x5b043e(0x1bb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5dc85a,_0x5b043e(0x191),_0x5b043e(0x18f))+delimiter+process.env.PATH}});_0x38cdd7['on'](_0x5b043e(0x17b),_0x335301=>{const _0x6fbcc1=_0x5b043e;if(_0x335301===0x0||_0x335301===null)_0x2ad7ad();else _0x27b9cf(new Error(_0x6fbcc1(0x17d)+_0x335301));}),_0x38cdd7['on'](_0x5b043e(0x1a9),_0x27b9cf);});}const runFlags=[{'name':a183_0x25b150(0x18b),'type':a183_0x25b150(0x19e),'description':a183_0x25b150(0x1b7),'default':![]}];export const runDefinition={'service':a183_0x25b150(0x180),'command':'run','description':a183_0x25b150(0x1ab),'risk':a183_0x25b150(0x19b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a183_0x25b150(0x17a),'description':a183_0x25b150(0x1b9),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x28ffdc=a183_0x25b150,_0x2be4bf=[];return _0x2be4bf[_0x28ffdc(0x19a)](_0x28ffdc(0x19d)),_0x2be4bf[_0x28ffdc(0x19a)](_0x28ffdc(0x1ae)+CLI_BIN_NAME+_0x28ffdc(0x1b4)),_0x2be4bf['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x28ffdc(0x17c)),_0x2be4bf[_0x28ffdc(0x19a)](_0x28ffdc(0x1ae)+CLI_BIN_NAME+'\x20run\x20preview'),_0x2be4bf[_0x28ffdc(0x19a)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x28ffdc(0x190)),_0x2be4bf[_0x28ffdc(0x1ba)]('\x0a');},async 'execute'(_0x56097c){const _0x2b23ab=a183_0x25b150,_0x2d3e02=process[_0x2b23ab(0x199)](),_0x45ce22=_0x56097c[_0x2b23ab(0x1a5)][0x0],_0x54eacb=_0x56097c[_0x2b23ab(0x1a5)]['slice'](0x1),_0x55cad2=readPackageScripts(_0x2d3e02);if(!_0x55cad2)throw CliErrors[_0x2b23ab(0x192)](_0x2b23ab(0x19c));if(!_0x45ce22){const _0x23e13a=Object[_0x2b23ab(0x1a6)](_0x55cad2);if(_0x23e13a[_0x2b23ab(0x1ac)]===0x0)console[_0x2b23ab(0x18d)](_0x2b23ab(0x196));else{console[_0x2b23ab(0x18d)](_0x2b23ab(0x182));for(const _0x4660f9 of _0x23e13a){console[_0x2b23ab(0x18d)](_0x2b23ab(0x1ae)+_0x4660f9);}console[_0x2b23ab(0x18d)](_0x2b23ab(0x179)+CLI_BIN_NAME+_0x2b23ab(0x183));}return{'ok':!![]};}if(!_0x55cad2[_0x45ce22])throw CliErrors[_0x2b23ab(0x192)](_0x2b23ab(0x1ad)+_0x45ce22+_0x2b23ab(0x194),'Available:\x20'+(Object['keys'](_0x55cad2)[_0x2b23ab(0x1ba)](',\x20')||'(none)'));const _0x2f6799=detectPackageManager(_0x2d3e02);VERSION_CHECK_SCRIPTS[_0x2b23ab(0x187)](_0x45ce22)&&await versionCheck(_0x2d3e02);if(_0x45ce22===_0x2b23ab(0x1a8)&&_0x56097c['bool']('watch'))return await Promise[_0x2b23ab(0x1b8)]([spawnViteBuildWatch(_0x2d3e02),spawnVitePreview(_0x2d3e02)]),{'ok':!![]};return await spawnScript(_0x2f6799,_0x45ce22,_0x54eacb,_0x2d3e02),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a184_0x4a4ab2=a184_0x1b21;(function(_0x243832,_0x58a2c9){const _0x3fc0f7=a184_0x1b21,_0xe8cc6a=_0x243832();while(!![]){try{const _0x54a741=parseInt(_0x3fc0f7(0xfe))/0x1*(-parseInt(_0x3fc0f7(0xf4))/0x2)+-parseInt(_0x3fc0f7(0xf6))/0x3*(-parseInt(_0x3fc0f7(0xf8))/0x4)+parseInt(_0x3fc0f7(0xf3))/0x5+parseInt(_0x3fc0f7(0xfb))/0x6*(parseInt(_0x3fc0f7(0xf2))/0x7)+parseInt(_0x3fc0f7(0xff))/0x8+parseInt(_0x3fc0f7(0xf7))/0x9+-parseInt(_0x3fc0f7(0xf5))/0xa;if(_0x54a741===_0x58a2c9)break;else _0xe8cc6a['push'](_0xe8cc6a['shift']());}catch(_0x1311ae){_0xe8cc6a['push'](_0xe8cc6a['shift']());}}}(a184_0x6b58,0x3f384));function a184_0x6b58(){const _0x52f8f1=['4279392tSfySP','2014476zkclUZ','read','export','618NldwyA','json','schema','18znKKlK','1952456lvGgbz','8337yzMmHb','1342590gWrZNO','20818GchzaP','11680450smPUYI','3thQMWm'];a184_0x6b58=function(){return _0x52f8f1;};return a184_0x6b58();}import{buildSchemaPayload}from'../framework/schema-export.js';function a184_0x1b21(_0x5355fb,_0x29c35e){_0x5355fb=_0x5355fb-0xf2;const _0x6b589=a184_0x6b58();let _0x1b21fb=_0x6b589[_0x5355fb];return _0x1b21fb;}async function execute(_0x44ff29){const _0x115a96=await buildSchemaPayload();return{'ok':!![],'data':_0x115a96};}export const schemaDefinition={'service':a184_0x4a4ab2(0xfd),'command':a184_0x4a4ab2(0xfa),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a184_0x4a4ab2(0xf9),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a184_0x4a4ab2(0xfc),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a185_0x549dc7=a185_0x5265;(function(_0x46a6a8,_0x34b2a3){const _0x48bae7=a185_0x5265,_0x575eed=_0x46a6a8();while(!![]){try{const _0x15ff3e=parseInt(_0x48bae7(0x13b))/0x1*(-parseInt(_0x48bae7(0x102))/0x2)+-parseInt(_0x48bae7(0x12d))/0x3*(parseInt(_0x48bae7(0x13e))/0x4)+parseInt(_0x48bae7(0x12b))/0x5*(parseInt(_0x48bae7(0x109))/0x6)+parseInt(_0x48bae7(0xf8))/0x7+-parseInt(_0x48bae7(0x10d))/0x8*(-parseInt(_0x48bae7(0x12e))/0x9)+parseInt(_0x48bae7(0xf7))/0xa*(parseInt(_0x48bae7(0x11c))/0xb)+-parseInt(_0x48bae7(0x119))/0xc*(parseInt(_0x48bae7(0x10f))/0xd);if(_0x15ff3e===_0x34b2a3)break;else _0x575eed['push'](_0x575eed['shift']());}catch(_0x478276){_0x575eed['push'](_0x575eed['shift']());}}}(a185_0x4cb3,0x7a015));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(_0x3c7c2b){const _0x195d97=a185_0x5265;if(_0x3c7c2b==='mybatisXml')return[_0x195d97(0x117),_0x195d97(0xfb),_0x195d97(0x131),''][_0x195d97(0x12f)]('\x0a');return[_0x195d97(0x121),''][_0x195d97(0x12f)]('\x0a');}export const sqlCreate={'service':a185_0x549dc7(0x137),'command':a185_0x549dc7(0x128),'description':a185_0x549dc7(0x113),'risk':a185_0x549dc7(0x130),'flags':[{'name':'name','type':'string','description':a185_0x549dc7(0x122)},{'name':a185_0x549dc7(0x115),'type':a185_0x549dc7(0x118),'description':a185_0x549dc7(0x124)},{'name':a185_0x549dc7(0x103),'type':a185_0x549dc7(0x135),'enum':['sql',a185_0x549dc7(0x105)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x5245a5){const _0xea3f13=a185_0x549dc7;if(!_0x5245a5[_0xea3f13(0x13a)])return;if(!_0x5245a5[_0xea3f13(0x125)](_0xea3f13(0xfd))['trim']())throw CliErrors[_0xea3f13(0x129)]('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x46ebf4=resolveProvidedDbId(_0x5245a5);if(typeof _0x46ebf4!=='number'||!Number[_0xea3f13(0x139)](_0x46ebf4)||_0x46ebf4<=0x0)throw CliErrors[_0xea3f13(0x129)]('db-id',_0xea3f13(0x126));if(!_0x5245a5[_0xea3f13(0x125)](_0xea3f13(0x103))[_0xea3f13(0x114)]())throw CliErrors[_0xea3f13(0x129)](_0xea3f13(0x103),_0xea3f13(0x100));},async 'dryRun'(_0x18fb11){const _0x16a2b3=a185_0x549dc7,_0xd4e307=loadSqlProjectConfig(_0x18fb11['appCode']),{sqlName:_0x52f1d6,dbId:_0x5160ce,dbName:_0x51b5ad,mode:_0x12d2aa}=await resolveSqlNewInputs(_0x18fb11),_0x21250a=buildSqlRelativePath(_0x16a2b3(0xf9),_0x52f1d6,_0x51b5ad,_0x12d2aa,_0x5160ce),_0x2b9d1d=_0xd4e307[_0x16a2b3(0x11f)]+'/'+_0x21250a;return{'method':_0x16a2b3(0xfc),'url':_0x16a2b3(0xff),'body':{'appCode':_0x18fb11[_0x16a2b3(0x112)],'sqlName':_0x52f1d6,'dbId':_0x5160ce,'mode':_0x12d2aa,'localPath':_0x2b9d1d},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0xd4e307[_0x16a2b3(0x11f)]};},async 'execute'(_0x468ebb){const _0x316043=a185_0x549dc7,_0x24081c=loadSqlProjectConfig(_0x468ebb[_0x316043(0x112)]),{sqlName:_0x3b8bc7,dbId:_0x3c94ab,dbName:_0x5732ff,mode:_0xfe1c4d}=await resolveSqlNewInputs(_0x468ebb),_0xd93ca4=generateSqlTemplate(_0xfe1c4d),_0x53abf0=await createSqlQuery({'appCode':_0x468ebb[_0x316043(0x112)],'sqlName':_0x3b8bc7,'dbId':_0x3c94ab,'sqlContent':_0xd93ca4}),_0x12b0f4=ensureRemoteSqlContent(_0x53abf0),_0x1e5e40=_0x5732ff||await getDbName(_0x468ebb['appCode'],_0x3c94ab)[_0x316043(0x111)](()=>undefined),_0x344604=buildSqlRelativePath(_0x53abf0[_0x316043(0x138)],_0x53abf0[_0x316043(0x10a)],_0x1e5e40,_0xfe1c4d,_0x3c94ab),_0x596045=_0x24081c[_0x316043(0x11f)]+'/'+_0x344604,_0xb52678=buildLocalSqlFileContent({'sqlCode':_0x53abf0[_0x316043(0x138)],'sqlName':_0x53abf0['sqlName'],'dbId':_0x53abf0[_0x316043(0x11b)]},_0x12b0f4,{'dbName':_0x1e5e40,'mode':_0xfe1c4d,'syncedAt':new Date()[_0x316043(0x106)](),'description':_0x53abf0[_0x316043(0xfe)]});if(await fileExists(_0x596045))throw CliErrors[_0x316043(0x13c)](_0x316043(0x101)+_0x596045);await ensureParentDirectory(_0x596045),await writeFile(_0x596045,_0xb52678,_0x316043(0x12c));const _0x238feb=await readSqlLockFile(_0x24081c[_0x316043(0x107)]),{lockData:_0xb57c4,appLock:_0x5490a6}=ensureSqlLockScope(_0x238feb??createEmptySqlLock(),_0x24081c['appCode'],_0x24081c[_0x316043(0x127)],'new');return _0x5490a6[_0x316043(0x116)][_0x53abf0[_0x316043(0x138)]]={...buildSqlLockEntry(_0x53abf0,_0x12b0f4,computeSqlContentHash(_0xb52678),{'dbName':_0x1e5e40}),'path':_0x344604,'mode':_0xfe1c4d},_0x5490a6[_0x316043(0x120)]=new Date()[_0x316043(0x106)](),await writeSqlLockFile(_0x24081c['lockFilePath'],_0xb57c4),{'ok':!![],'data':{'id':_0x53abf0['id'],'sqlCode':_0x53abf0[_0x316043(0x138)],'sqlName':_0x53abf0[_0x316043(0x10a)],'dbId':_0x53abf0[_0x316043(0x11b)],'path':_0x596045,'mode':_0xfe1c4d},'message':_0x316043(0x104)+_0x53abf0[_0x316043(0x138)]};}};async function resolveSqlNewInputs(_0x148574){const _0x1a3b99=await resolveSqlNameInput(_0x148574),{dbId:_0x4dd2a1,dbName:_0x528a7c}=await resolveDbSelection(_0x148574),_0x93eb40=await resolveSqlModeInput(_0x148574);return{'sqlName':_0x1a3b99,'dbId':_0x4dd2a1,'dbName':_0x528a7c,'mode':_0x93eb40};}async function resolveSqlNameInput(_0xc18e11){const _0x3af86d=a185_0x549dc7,_0x2a850d=_0xc18e11[_0x3af86d(0x125)]('name')['trim']();if(_0x2a850d)return _0x2a850d;if(_0xc18e11['nonInteractive'])throw CliErrors[_0x3af86d(0x129)](_0x3af86d(0xfd),_0x3af86d(0x13f));return(await input({'message':_0x3af86d(0x10b),'validate':_0x5d5025=>_0x5d5025[_0x3af86d(0x114)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x3af86d(0x114)]();}async function resolveDbSelection(_0x5c9b44){const _0x1a8b97=a185_0x549dc7,_0x154874=resolveProvidedDbId(_0x5c9b44);if(typeof _0x154874==='number'&&Number[_0x1a8b97(0x139)](_0x154874)&&_0x154874>0x0)return{'dbId':_0x154874,'dbName':await getDbName(_0x5c9b44[_0x1a8b97(0x112)],_0x154874)[_0x1a8b97(0x111)](()=>undefined)};if(_0x5c9b44['nonInteractive'])throw CliErrors['flagMissing'](_0x1a8b97(0x115),_0x1a8b97(0x126));const _0x566612=await listDatabases(_0x5c9b44['appCode'])[_0x1a8b97(0x111)](()=>[]);if(_0x566612['length']===0x1)return{'dbId':_0x566612[0x0][_0x1a8b97(0x11b)],'dbName':_0x566612[0x0][_0x1a8b97(0x10c)]};if(_0x566612[_0x1a8b97(0x108)]>0x1){const _0x47c601=await select({'message':_0x1a8b97(0x133),'choices':[..._0x566612[_0x1a8b97(0x136)](_0x1b8529=>({'name':_0x1b8529['dbName']+'\x20('+_0x1b8529[_0x1a8b97(0x11b)]+')','value':serializeDbSelection(_0x1b8529)})),{'name':_0x1a8b97(0x110),'value':_0x1a8b97(0x10e)}]});if(_0x47c601!==_0x1a8b97(0x10e))return deserializeDbSelection(_0x47c601);}const _0x415847=await input({'message':_0x1a8b97(0x134),'validate':_0x5e3bf5=>{const _0x32c645=_0x1a8b97,_0x26d873=_0x5e3bf5[_0x32c645(0x114)]();if(!_0x26d873)return'dbId\x20cannot\x20be\x20empty';const _0x2fd624=Number(_0x26d873);if(!Number['isInteger'](_0x2fd624)||_0x2fd624<=0x0)return _0x32c645(0x123);return!![];}});return{'dbId':Number(_0x415847[_0x1a8b97(0x114)]())};}function a185_0x5265(_0x2b4556,_0x5a1e5d){_0x2b4556=_0x2b4556-0xf7;const _0x4cb30f=a185_0x4cb3();let _0x52656b=_0x4cb30f[_0x2b4556];return _0x52656b;}function a185_0x4cb3(){const _0x31abe3=['create','flagMissing','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','115BWyLbd','utf8','12210RarwGx','2979afeVLR','join','write','</select>','Select\x20the\x20local\x20SQL\x20mode:','Select\x20the\x20target\x20database:','Target\x20database\x20dbId:','string','map','sql','sqlCode','isFinite','nonInteractive','244PuZJYs','validation','MyBatis\x20XML\x20(mybatisXml)','8pMSACw','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','1402510RNIMMS','5570397DdKDgz','<server-generated-sqlCode>','Invalid\x20database\x20selection\x20payload:\x20','\x20\x20SELECT\x201\x20AS\x20id','POST','name','description','/smartapi/custom/saveUserCustomSql','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','File\x20already\x20exists:\x20','3212ObFifs','mode','Created\x20SQL\x20query\x20','mybatisXml','toISOString','lockFilePath','length','115302QndGXs','sqlName','SQL\x20name:','dbName','14712qqxBZb','__manual__','14130805keqQzI','✎\x20Enter\x20dbId\x20manually','catch','appCode','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','trim','db-id','sqls','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','number','12kLOTDs','parse','dbId','11vuHslQ','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','Plain\x20SQL\x20(sql)','sqlRootDir','lastSync','SELECT\x201\x20AS\x20id;','SQL\x20query\x20display\x20name','dbId\x20must\x20be\x20a\x20positive\x20integer','Target\x20database\x20ID','str','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRoot'];a185_0x4cb3=function(){return _0x31abe3;};return a185_0x4cb3();}async function resolveSqlModeInput(_0x2f20b3){const _0x56a770=a185_0x549dc7,_0x228dc9=_0x2f20b3[_0x56a770(0x125)]('mode')[_0x56a770(0x114)]();if(_0x228dc9===_0x56a770(0x137)||_0x228dc9===_0x56a770(0x105))return _0x228dc9;if(_0x2f20b3['nonInteractive'])throw CliErrors['flagMissing'](_0x56a770(0x103),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x56a770(0x132),'choices':[{'name':_0x56a770(0x11e),'value':'sql','description':_0x56a770(0x11d)},{'name':_0x56a770(0x13d),'value':'mybatisXml','description':_0x56a770(0x12a)}]});}function serializeDbSelection(_0x27902a){const _0x2a257f=a185_0x549dc7;return JSON['stringify']({'dbId':_0x27902a[_0x2a257f(0x11b)],'dbName':_0x27902a[_0x2a257f(0x10c)]});}function deserializeDbSelection(_0x3ce428){const _0x3c7fcd=a185_0x549dc7;try{const _0x2b5493=JSON[_0x3c7fcd(0x11a)](_0x3ce428);if(typeof _0x2b5493['dbId']==='number'&&Number['isFinite'](_0x2b5493[_0x3c7fcd(0x11b)]))return{'dbId':_0x2b5493[_0x3c7fcd(0x11b)],'dbName':_0x2b5493[_0x3c7fcd(0x10c)]};}catch{}throw CliErrors[_0x3c7fcd(0x13c)](_0x3c7fcd(0xfa)+_0x3ce428);}function resolveProvidedDbId(_0x4c3cd8){const _0x1b4e9b=a185_0x549dc7,_0x30f258=_0x4c3cd8['flag'](_0x1b4e9b(0x115));if(typeof _0x30f258===_0x1b4e9b(0x118)&&Number[_0x1b4e9b(0x139)](_0x30f258))return _0x30f258;return undefined;}
|
|
1
|
+
const a185_0x4c194e=a185_0x3135;(function(_0x290318,_0x139e07){const _0x1a20bb=a185_0x3135,_0x4fc720=_0x290318();while(!![]){try{const _0x3a3f6f=parseInt(_0x1a20bb(0xf7))/0x1*(parseInt(_0x1a20bb(0x104))/0x2)+-parseInt(_0x1a20bb(0x10b))/0x3*(parseInt(_0x1a20bb(0x10a))/0x4)+-parseInt(_0x1a20bb(0x11b))/0x5*(-parseInt(_0x1a20bb(0xe4))/0x6)+parseInt(_0x1a20bb(0x110))/0x7+parseInt(_0x1a20bb(0xe9))/0x8+-parseInt(_0x1a20bb(0x111))/0x9+parseInt(_0x1a20bb(0xe3))/0xa;if(_0x3a3f6f===_0x139e07)break;else _0x4fc720['push'](_0x4fc720['shift']());}catch(_0x13a468){_0x4fc720['push'](_0x4fc720['shift']());}}}(a185_0x2683,0x58b37));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';function a185_0x2683(){const _0x4bef14=['<server-generated-sqlCode>','10733CcmHKB','mybatisXml','SELECT\x201\x20AS\x20id;','stringify','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','length','new','Select\x20the\x20local\x20SQL\x20mode:','/smartapi/custom/saveUserCustomSql','create','dbId\x20cannot\x20be\x20empty','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','</select>','10ZDIQFt','Created\x20SQL\x20query\x20','sqlRootDir','isInteger','description','catch','724cbgCnr','11847vaVWsL','__manual__','dbName','number','sqlCode','3973438nzxxXh','4232853SKlJZH','string','Target\x20database\x20dbId:','sqlName','toISOString','sql','SQL\x20name\x20cannot\x20be\x20empty','File\x20already\x20exists:\x20','utf8','isFinite','170RxnobN','SQL\x20query\x20display\x20name','lockFilePath','str','Target\x20database\x20ID','appCode','nonInteractive','dbId\x20must\x20be\x20a\x20positive\x20integer','parse','1787990UKOTwd','35934bouLhq','sqls','mode','trim','Local\x20SQL\x20file\x20mode','4357448wSvGMf','Select\x20the\x20target\x20database:','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','join','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','lastSync','dbId','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','flagMissing','db-id','MyBatis\x20XML\x20(mybatisXml)','name','validation'];a185_0x2683=function(){return _0x4bef14;};return a185_0x2683();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a185_0x3135(_0x20a79a,_0x169896){_0x20a79a=_0x20a79a-0xe3;const _0x26835b=a185_0x2683();let _0x313516=_0x26835b[_0x20a79a];return _0x313516;}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(_0x134102){const _0x1cd155=a185_0x3135;if(_0x134102==='mybatisXml')return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id',_0x1cd155(0x103),''][_0x1cd155(0xec)]('\x0a');return[_0x1cd155(0xf9),''][_0x1cd155(0xec)]('\x0a');}export const sqlCreate={'service':a185_0x4c194e(0x116),'command':a185_0x4c194e(0x100),'description':a185_0x4c194e(0xeb),'risk':'write','flags':[{'name':a185_0x4c194e(0xf4),'type':a185_0x4c194e(0x112),'description':a185_0x4c194e(0x11c)},{'name':a185_0x4c194e(0xf2),'type':'number','description':a185_0x4c194e(0x11f)},{'name':a185_0x4c194e(0xe6),'type':a185_0x4c194e(0x112),'enum':[a185_0x4c194e(0x116),a185_0x4c194e(0xf8)],'description':a185_0x4c194e(0xe8)}],async 'validate'(_0x24cbb){const _0x146292=a185_0x4c194e;if(!_0x24cbb[_0x146292(0x121)])return;if(!_0x24cbb['str'](_0x146292(0xf4))[_0x146292(0xe7)]())throw CliErrors[_0x146292(0xf1)](_0x146292(0xf4),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x395861=resolveProvidedDbId(_0x24cbb);if(typeof _0x395861!=='number'||!Number[_0x146292(0x11a)](_0x395861)||_0x395861<=0x0)throw CliErrors[_0x146292(0xf1)](_0x146292(0xf2),_0x146292(0xfb));if(!_0x24cbb[_0x146292(0x11e)](_0x146292(0xe6))['trim']())throw CliErrors[_0x146292(0xf1)](_0x146292(0xe6),_0x146292(0xf0));},async 'dryRun'(_0x5c2701){const _0x12b7d8=a185_0x4c194e,_0xb20e=loadSqlProjectConfig(_0x5c2701[_0x12b7d8(0x120)]),{sqlName:_0x958599,dbId:_0x3af1f9,dbName:_0x5710d4,mode:_0x538bde}=await resolveSqlNewInputs(_0x5c2701),_0x16ab80=buildSqlRelativePath(_0x12b7d8(0xf6),_0x958599,_0x5710d4,_0x538bde,_0x3af1f9),_0x27d268=_0xb20e[_0x12b7d8(0x106)]+'/'+_0x16ab80;return{'method':'POST','url':_0x12b7d8(0xff),'body':{'appCode':_0x5c2701[_0x12b7d8(0x120)],'sqlName':_0x958599,'dbId':_0x3af1f9,'mode':_0x538bde,'localPath':_0x27d268},'description':_0x12b7d8(0xed)+_0xb20e[_0x12b7d8(0x106)]};},async 'execute'(_0x86e8e1){const _0x13ba4d=a185_0x4c194e,_0x11fa6e=loadSqlProjectConfig(_0x86e8e1['appCode']),{sqlName:_0x20ad94,dbId:_0x3c735b,dbName:_0x1971ff,mode:_0x1b3f0c}=await resolveSqlNewInputs(_0x86e8e1),_0x1131f4=generateSqlTemplate(_0x1b3f0c),_0x39917d=await createSqlQuery({'appCode':_0x86e8e1[_0x13ba4d(0x120)],'sqlName':_0x20ad94,'dbId':_0x3c735b,'sqlContent':_0x1131f4}),_0x27b4c7=ensureRemoteSqlContent(_0x39917d),_0x25cd2b=_0x1971ff||await getDbName(_0x86e8e1['appCode'],_0x3c735b)[_0x13ba4d(0x109)](()=>undefined),_0x12d5ae=buildSqlRelativePath(_0x39917d['sqlCode'],_0x39917d[_0x13ba4d(0x114)],_0x25cd2b,_0x1b3f0c,_0x3c735b),_0x198715=_0x11fa6e['sqlRootDir']+'/'+_0x12d5ae,_0x3e5049=buildLocalSqlFileContent({'sqlCode':_0x39917d[_0x13ba4d(0x10f)],'sqlName':_0x39917d[_0x13ba4d(0x114)],'dbId':_0x39917d['dbId']},_0x27b4c7,{'dbName':_0x25cd2b,'mode':_0x1b3f0c,'syncedAt':new Date()[_0x13ba4d(0x115)](),'description':_0x39917d[_0x13ba4d(0x108)]});if(await fileExists(_0x198715))throw CliErrors[_0x13ba4d(0xf5)](_0x13ba4d(0x118)+_0x198715);await ensureParentDirectory(_0x198715),await writeFile(_0x198715,_0x3e5049,_0x13ba4d(0x119));const _0x39d6be=await readSqlLockFile(_0x11fa6e[_0x13ba4d(0x11d)]),{lockData:_0x393baf,appLock:_0x34845f}=ensureSqlLockScope(_0x39d6be??createEmptySqlLock(),_0x11fa6e[_0x13ba4d(0x120)],_0x11fa6e['sqlRoot'],_0x13ba4d(0xfd));return _0x34845f[_0x13ba4d(0xe5)][_0x39917d[_0x13ba4d(0x10f)]]={...buildSqlLockEntry(_0x39917d,_0x27b4c7,computeSqlContentHash(_0x3e5049),{'dbName':_0x25cd2b}),'path':_0x12d5ae,'mode':_0x1b3f0c},_0x34845f[_0x13ba4d(0xee)]=new Date()[_0x13ba4d(0x115)](),await writeSqlLockFile(_0x11fa6e[_0x13ba4d(0x11d)],_0x393baf),{'ok':!![],'data':{'id':_0x39917d['id'],'sqlCode':_0x39917d[_0x13ba4d(0x10f)],'sqlName':_0x39917d['sqlName'],'dbId':_0x39917d['dbId'],'path':_0x198715,'mode':_0x1b3f0c},'message':_0x13ba4d(0x105)+_0x39917d[_0x13ba4d(0x10f)]};}};async function resolveSqlNewInputs(_0x101613){const _0x2d8313=await resolveSqlNameInput(_0x101613),{dbId:_0x3872b3,dbName:_0xfcfdf}=await resolveDbSelection(_0x101613),_0x552e67=await resolveSqlModeInput(_0x101613);return{'sqlName':_0x2d8313,'dbId':_0x3872b3,'dbName':_0xfcfdf,'mode':_0x552e67};}async function resolveSqlNameInput(_0x5b7b8c){const _0x499329=a185_0x4c194e,_0x18aa52=_0x5b7b8c[_0x499329(0x11e)](_0x499329(0xf4))['trim']();if(_0x18aa52)return _0x18aa52;if(_0x5b7b8c['nonInteractive'])throw CliErrors['flagMissing'](_0x499329(0xf4),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x3c6d78=>_0x3c6d78[_0x499329(0xe7)]()?!![]:_0x499329(0x117)}))[_0x499329(0xe7)]();}async function resolveDbSelection(_0x2a9dc0){const _0x5595fd=a185_0x4c194e,_0x45eed8=resolveProvidedDbId(_0x2a9dc0);if(typeof _0x45eed8===_0x5595fd(0x10e)&&Number['isFinite'](_0x45eed8)&&_0x45eed8>0x0)return{'dbId':_0x45eed8,'dbName':await getDbName(_0x2a9dc0[_0x5595fd(0x120)],_0x45eed8)[_0x5595fd(0x109)](()=>undefined)};if(_0x2a9dc0['nonInteractive'])throw CliErrors[_0x5595fd(0xf1)](_0x5595fd(0xf2),_0x5595fd(0xfb));const _0xe8ed5b=await listDatabases(_0x2a9dc0[_0x5595fd(0x120)])['catch'](()=>[]);if(_0xe8ed5b[_0x5595fd(0xfc)]===0x1)return{'dbId':_0xe8ed5b[0x0][_0x5595fd(0xef)],'dbName':_0xe8ed5b[0x0][_0x5595fd(0x10d)]};if(_0xe8ed5b[_0x5595fd(0xfc)]>0x1){const _0x226e67=await select({'message':_0x5595fd(0xea),'choices':[..._0xe8ed5b['map'](_0x25f823=>({'name':_0x25f823[_0x5595fd(0x10d)]+'\x20('+_0x25f823[_0x5595fd(0xef)]+')','value':serializeDbSelection(_0x25f823)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x5595fd(0x10c)}]});if(_0x226e67!==_0x5595fd(0x10c))return deserializeDbSelection(_0x226e67);}const _0x3b3f81=await input({'message':_0x5595fd(0x113),'validate':_0x4277cb=>{const _0x1af4b5=_0x5595fd,_0x365258=_0x4277cb[_0x1af4b5(0xe7)]();if(!_0x365258)return _0x1af4b5(0x101);const _0x4d5d24=Number(_0x365258);if(!Number[_0x1af4b5(0x107)](_0x4d5d24)||_0x4d5d24<=0x0)return _0x1af4b5(0x122);return!![];}});return{'dbId':Number(_0x3b3f81['trim']())};}async function resolveSqlModeInput(_0x187481){const _0x37045c=a185_0x4c194e,_0x439ac0=_0x187481[_0x37045c(0x11e)](_0x37045c(0xe6))['trim']();if(_0x439ac0===_0x37045c(0x116)||_0x439ac0===_0x37045c(0xf8))return _0x439ac0;if(_0x187481[_0x37045c(0x121)])throw CliErrors[_0x37045c(0xf1)](_0x37045c(0xe6),_0x37045c(0xf0));return await select({'message':_0x37045c(0xfe),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x37045c(0x116),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x37045c(0xf3),'value':_0x37045c(0xf8),'description':_0x37045c(0x102)}]});}function serializeDbSelection(_0x4f692c){const _0x55c168=a185_0x4c194e;return JSON[_0x55c168(0xfa)]({'dbId':_0x4f692c[_0x55c168(0xef)],'dbName':_0x4f692c['dbName']});}function deserializeDbSelection(_0x4d8cc9){const _0x9913d7=a185_0x4c194e;try{const _0x5756ac=JSON[_0x9913d7(0x123)](_0x4d8cc9);if(typeof _0x5756ac['dbId']===_0x9913d7(0x10e)&&Number[_0x9913d7(0x11a)](_0x5756ac[_0x9913d7(0xef)]))return{'dbId':_0x5756ac['dbId'],'dbName':_0x5756ac[_0x9913d7(0x10d)]};}catch{}throw CliErrors[_0x9913d7(0xf5)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x4d8cc9);}function resolveProvidedDbId(_0x1da503){const _0x374a70=a185_0x4c194e,_0x3dcb31=_0x1da503['flag'](_0x374a70(0xf2));if(typeof _0x3dcb31===_0x374a70(0x10e)&&Number[_0x374a70(0x11a)](_0x3dcb31))return _0x3dcb31;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a186_0x569b8a=a186_0xfac1;(function(_0xf66fd4,_0xd2764d){const _0x896c93=a186_0xfac1,_0x50e036=_0xf66fd4();while(!![]){try{const _0x3da566=parseInt(_0x896c93(0x103))/0x1*(parseInt(_0x896c93(0x107))/0x2)+parseInt(_0x896c93(0xfe))/0x3*(-parseInt(_0x896c93(0x115))/0x4)+parseInt(_0x896c93(0x119))/0x5*(-parseInt(_0x896c93(0x11e))/0x6)+parseInt(_0x896c93(0x116))/0x7+-parseInt(_0x896c93(0xf9))/0x8*(-parseInt(_0x896c93(0x11c))/0x9)+-parseInt(_0x896c93(0x102))/0xa+-parseInt(_0x896c93(0x10d))/0xb*(parseInt(_0x896c93(0x108))/0xc);if(_0x3da566===_0xd2764d)break;else _0x50e036['push'](_0x50e036['shift']());}catch(_0x1a46df){_0x50e036['push'](_0x50e036['shift']());}}}(a186_0xaac8,0x39de0));function a186_0xfac1(_0x28097b,_0x54d49e){_0x28097b=_0x28097b-0xf9;const _0xaac8e8=a186_0xaac8();let _0xfac1d7=_0xaac8e8[_0x28097b];return _0xfac1d7;}import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a186_0xaac8(){const _0x21f7c2=['3574360AsjYUH','201211WewjnU','replace','filter','sqlcode','2NznaXT','156lgvhwt','length','delete','trashDir','startsWith','74437VyazLP','\x20(local\x20file\x20moved\x20to\x20trash)','projectRoot','high-risk-write','SQL\x20lock\x20file\x20not\x20found.','sqlRoot','str','POST','96XhtHWq','2059771GxwkHW','lockFilePath','fromEntries','217015PmwYPK','Deleted\x20','remoteId','114318GEWInh','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','6BzIrzD','sqlRootDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','152iLfTVi','lastSync','entries','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','sqls','1371AGHCnz','appCode','toISOString','validation'];a186_0xaac8=function(){return _0x21f7c2;};return a186_0xaac8();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a186_0x569b8a(0x10a),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a186_0x569b8a(0x110),'flags':[SQLCODE_FLAG],async 'validate'(_0x1e7049){const _0x2e2874=a186_0x569b8a,_0xb5c29=loadSqlProjectConfig(_0x1e7049[_0x2e2874(0xff)]),_0x52a788=await readSqlLockFile(_0xb5c29['lockFilePath']);if(!_0x52a788)throw CliErrors[_0x2e2874(0x101)](_0x2e2874(0x120));},async 'dryRun'(_0x5201b7){const _0x2e2c7c=a186_0x569b8a,_0xd65c8f=loadSqlProjectConfig(_0x5201b7[_0x2e2c7c(0xff)]),_0x32a351=await readSqlLockFile(_0xd65c8f[_0x2e2c7c(0x117)]);if(!_0x32a351)throw CliErrors[_0x2e2c7c(0x101)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x7773e4}=ensureSqlLockScope(_0x32a351,_0x5201b7['appCode'],_0xd65c8f[_0x2e2c7c(0x112)],_0x2e2c7c(0x10a)),_0x1cde72=_0x5201b7['str']('sqlcode'),_0x4fd4d2=_0x7773e4['sqls'][_0x1cde72];if(!_0x4fd4d2)throw CliErrors[_0x2e2c7c(0x101)](_0x2e2c7c(0x11d)+_0x1cde72+'\x22.');return{'method':_0x2e2c7c(0x114),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x1cde72,'id':_0x4fd4d2[_0x2e2c7c(0x11b)],'localPath':resolveLocalSqlFilePath(_0xd65c8f,_0x1cde72,_0x4fd4d2)},'description':'Would\x20delete\x20SQL\x20'+_0x1cde72+_0x2e2c7c(0xfc)+_0xd65c8f['trashDir']};},async 'execute'(_0x23dc22){const _0x59a65a=a186_0x569b8a,_0x45e452=loadSqlProjectConfig(_0x23dc22[_0x59a65a(0xff)]),_0x19276c=await readSqlLockFile(_0x45e452[_0x59a65a(0x117)]);if(!_0x19276c)throw CliErrors['validation'](_0x59a65a(0x111));const {lockData:_0x3e41da,appLock:_0x50a006}=ensureSqlLockScope(_0x19276c,_0x23dc22[_0x59a65a(0xff)],_0x45e452[_0x59a65a(0x112)],'delete'),_0x36cda5=_0x23dc22[_0x59a65a(0x113)](_0x59a65a(0x106)),_0x53d2f8=_0x50a006['sqls'][_0x36cda5];if(!_0x53d2f8)throw CliErrors['validation'](_0x59a65a(0x11d)+_0x36cda5+'\x22.');await deleteSqlQuery({'id':_0x53d2f8[_0x59a65a(0x11b)],'sqlCode':_0x36cda5}),_0x50a006[_0x59a65a(0xfd)]=Object[_0x59a65a(0x118)](Object[_0x59a65a(0xfb)](_0x50a006['sqls'])[_0x59a65a(0x105)](([_0x1b1fc7])=>_0x1b1fc7!==_0x36cda5)),_0x50a006[_0x59a65a(0xfa)]=new Date()[_0x59a65a(0x100)](),await writeSqlLockFile(_0x45e452[_0x59a65a(0x117)],_0x3e41da);const _0x6c40a7=resolveLocalSqlFilePath(_0x45e452,_0x36cda5,_0x53d2f8);let _0x41024c;await fileExists(_0x6c40a7)&&(_0x41024c=await moveToTrash(_0x45e452[_0x59a65a(0x10f)],_0x45e452[_0x59a65a(0x10b)],_0x6c40a7),await cleanupEmptyDirectories(dirname(_0x6c40a7),_0x45e452[_0x59a65a(0x11f)]));const _0x43667d={'deleted':_0x36cda5,'remoteId':_0x53d2f8[_0x59a65a(0x11b)]};if(_0x41024c)_0x43667d['trashedTo']=_0x41024c;return{'ok':!![],'data':_0x43667d,'message':_0x59a65a(0x11a)+_0x36cda5+(_0x41024c?_0x59a65a(0x10e):'')};}};async function moveToTrash(_0x5601ce,_0x10f736,_0x516e53){const _0x24f5df=a186_0x569b8a,_0x4de2f4=new Date()[_0x24f5df(0x100)]()[_0x24f5df(0x104)](/[:.]/g,'-'),_0x886279=relative(_0x5601ce,_0x516e53),_0x38bc57=join(_0x10f736,_0x4de2f4,_0x886279);return await mkdir(dirname(_0x38bc57),{'recursive':!![]}),await rename(_0x516e53,_0x38bc57),_0x38bc57;}async function cleanupEmptyDirectories(_0x13037c,_0x161fe1){const _0x19ed79=a186_0x569b8a;let _0x3c4df8=resolve(_0x13037c);const _0x17d792=resolve(_0x161fe1);while(_0x3c4df8[_0x19ed79(0x10c)](''+_0x17d792+sep)||_0x3c4df8===_0x17d792){if(_0x3c4df8===_0x17d792)return;try{const _0x225a87=await readdir(_0x3c4df8);if(_0x225a87[_0x19ed79(0x109)]>0x0)return;await rmdir(_0x3c4df8);}catch{return;}_0x3c4df8=dirname(_0x3c4df8);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a187_0x4952e9=a187_0x3476;function a187_0x3476(_0x1e0b8f,_0x41e93a){_0x1e0b8f=_0x1e0b8f-0x1cb;const _0xf5b9b4=a187_0xf5b9();let _0x34769d=_0xf5b9b4[_0x1e0b8f];return _0x34769d;}function a187_0xf5b9(){const _0x174e84=['1312NRjjoI','dbId','description','161565NExMtf','4228248JDWrOt','190775hFMCiz','sqlcode','sqlContent','verbose','appCode','str','798398UzgUPP','4781187qnILUG','read','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','60sReaSO','sql','238646iwpNek','sqlName','boolean','Return\x20full\x20raw\x20SQL\x20query\x20object','98wBwOwi','bool'];a187_0xf5b9=function(){return _0x174e84;};return a187_0xf5b9();}(function(_0x1f6d45,_0x511db3){const _0x30c734=a187_0x3476,_0x12e96d=_0x1f6d45();while(!![]){try{const _0x53051f=parseInt(_0x30c734(0x1cd))/0x1+-parseInt(_0x30c734(0x1de))/0x2+parseInt(_0x30c734(0x1d6))/0x3*(parseInt(_0x30c734(0x1cb))/0x4)+-parseInt(_0x30c734(0x1d8))/0x5+-parseInt(_0x30c734(0x1d7))/0x6+-parseInt(_0x30c734(0x1d1))/0x7*(-parseInt(_0x30c734(0x1d3))/0x8)+parseInt(_0x30c734(0x1df))/0x9;if(_0x53051f===_0x511db3)break;else _0x12e96d['push'](_0x12e96d['shift']());}catch(_0x10eee2){_0x12e96d['push'](_0x12e96d['shift']());}}}(a187_0xf5b9,0x6aebc));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a187_0x4952e9(0x1cc),'command':'detail','description':a187_0x4952e9(0x1e1),'risk':a187_0x4952e9(0x1e0),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a187_0x4952e9(0x1cf),'description':a187_0x4952e9(0x1d0)}],async 'execute'(_0x1d65aa){const _0x211a27=a187_0x4952e9,_0x4e141=await getSqlQueryInfo(_0x1d65aa[_0x211a27(0x1dc)],_0x1d65aa[_0x211a27(0x1dd)](_0x211a27(0x1d9))),_0x19cb4f=_0x1d65aa[_0x211a27(0x1d2)](_0x211a27(0x1db));if(_0x19cb4f)return{'ok':!![],'data':_0x4e141};const _0x4e7745=_0x4e141[_0x211a27(0x1d4)]?await getDbName(_0x1d65aa['appCode'],_0x4e141[_0x211a27(0x1d4)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4e141['sqlCode'],'sqlName':_0x4e141[_0x211a27(0x1ce)],'db':_0x4e7745?_0x4e7745+'\x20('+_0x4e141[_0x211a27(0x1d4)]+')':_0x4e141[_0x211a27(0x1d4)]??'','description':_0x4e141[_0x211a27(0x1d5)]??'','sqlContent':_0x4e141[_0x211a27(0x1da)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a188_0x288217=a188_0x1838;(function(_0x264916,_0x5d3d4a){const _0x4cdd69=a188_0x1838,_0x24e202=_0x264916();while(!![]){try{const _0x1e1300=-parseInt(_0x4cdd69(0x1a9))/0x1+-parseInt(_0x4cdd69(0x1b0))/0x2+parseInt(_0x4cdd69(0x1ad))/0x3*(parseInt(_0x4cdd69(0x1a4))/0x4)+parseInt(_0x4cdd69(0x1a1))/0x5*(-parseInt(_0x4cdd69(0x1b4))/0x6)+-parseInt(_0x4cdd69(0x1a8))/0x7+-parseInt(_0x4cdd69(0x19e))/0x8*(-parseInt(_0x4cdd69(0x1ac))/0x9)+parseInt(_0x4cdd69(0x1a3))/0xa;if(_0x1e1300===_0x5d3d4a)break;else _0x24e202['push'](_0x24e202['shift']());}catch(_0x4bd7d1){_0x24e202['push'](_0x24e202['shift']());}}}(a188_0x38e6,0x5ba52));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a188_0x1838(_0x49bca0,_0x555d11){_0x49bca0=_0x49bca0-0x19d;const _0x38e6b0=a188_0x38e6();let _0x183816=_0x38e6b0[_0x49bca0];return _0x183816;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a188_0x288217(0x1a7),'command':a188_0x288217(0x1af),'description':a188_0x288217(0x1b1),'risk':a188_0x288217(0x1b6),'flags':[SQLCODE_FLAG,{'name':a188_0x288217(0x1b5),'type':a188_0x288217(0x1aa),'description':a188_0x288217(0x1ae)}],async 'execute'(_0x570b96){const _0x15f858=a188_0x288217,_0x210905=parseJsonParams(_0x570b96[_0x15f858(0x1a5)](_0x15f858(0x1b5))),_0x35bd87=Date[_0x15f858(0x1a2)](),_0x45d0cf=await executeSql(_0x570b96[_0x15f858(0x1a6)],_0x570b96['str']('sqlcode'),_0x210905),_0x5f44cd=Date['now']()-_0x35bd87,_0x574dca=_0x45d0cf?.[_0x15f858(0x1a0)]??_0x45d0cf,_0x16912b=_0x45d0cf?.[_0x15f858(0x1b2)]??!![];if(!_0x16912b)return{'ok':![],'data':{'error':_0x45d0cf?.['execError']||_0x15f858(0x1ab),'elapsed':_0x5f44cd},'message':'SQL\x20execution\x20failed'};const _0x378e49=Array[_0x15f858(0x19f)](_0x574dca)?_0x574dca:[];return{'ok':!![],'data':{'rows':_0x378e49,'rowCount':_0x378e49[_0x15f858(0x1b3)],'elapsed':_0x5f44cd},'message':_0x15f858(0x19d)+_0x378e49['length']+'\x20row(s)\x20in\x20'+_0x5f44cd+'ms'};}};function a188_0x38e6(){const _0x8a3489=['129729lCOgDK','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','exec','294358GhzHmZ','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execSuccess','length','2720760hhCTeL','params','read','Returned\x20','1208968SfAqbx','isArray','execResult','5CyaLsg','now','15947610ZfQAsd','4otzYxz','str','appCode','sql','537691JopjNt','736295GGqsHI','string','SQL\x20execution\x20failed','9rDzBhq'];a188_0x38e6=function(){return _0x8a3489;};return a188_0x38e6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a189_0x198f(){const _0x1f556a=['2351682CbJgDd','31246780pmETFR','5100ZZnlYe','2141385NKHckK','6825ifDaQy','9htiUuM','3317564jAcjEW','3130360iqFZtL','172902zBCwNm','2ZdmHma'];a189_0x198f=function(){return _0x1f556a;};return a189_0x198f();}(function(_0x32e1b1,_0x5201b9){const _0xfd8c9a=a189_0x4de6,_0x35d496=_0x32e1b1();while(!![]){try{const _0x42f51c=-parseInt(_0xfd8c9a(0x1aa))/0x1*(parseInt(_0xfd8c9a(0x1a9))/0x2)+-parseInt(_0xfd8c9a(0x1ab))/0x3+-parseInt(_0xfd8c9a(0x1a7))/0x4+-parseInt(_0xfd8c9a(0x1ae))/0x5+-parseInt(_0xfd8c9a(0x1ad))/0x6*(parseInt(_0xfd8c9a(0x1af))/0x7)+-parseInt(_0xfd8c9a(0x1a8))/0x8*(-parseInt(_0xfd8c9a(0x1a6))/0x9)+parseInt(_0xfd8c9a(0x1ac))/0xa;if(_0x42f51c===_0x5201b9)break;else _0x35d496['push'](_0x35d496['shift']());}catch(_0x3f3b91){_0x35d496['push'](_0x35d496['shift']());}}}(a189_0x198f,0x736b7));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a189_0x4de6(_0x1795bd,_0x1df4b6){_0x1795bd=_0x1795bd-0x1a6;const _0x198f6b=a189_0x198f();let _0x4de614=_0x198f6b[_0x1795bd];return _0x4de614;}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 a190_0xff3f32=a190_0x41e4;(function(_0x27878e,_0x75aafc){const _0x417d6a=a190_0x41e4,_0x55affa=_0x27878e();while(!![]){try{const _0x1b495b=-parseInt(_0x417d6a(0x1b0))/0x1*(-parseInt(_0x417d6a(0x1b4))/0x2)+parseInt(_0x417d6a(0x1c5))/0x3+parseInt(_0x417d6a(0x1aa))/0x4*(parseInt(_0x417d6a(0x1ad))/0x5)+-parseInt(_0x417d6a(0x1c1))/0x6*(parseInt(_0x417d6a(0x1a9))/0x7)+-parseInt(_0x417d6a(0x1a6))/0x8+parseInt(_0x417d6a(0x1a5))/0x9+-parseInt(_0x417d6a(0x1ae))/0xa;if(_0x1b495b===_0x75aafc)break;else _0x55affa['push'](_0x55affa['shift']());}catch(_0x1b5214){_0x55affa['push'](_0x55affa['shift']());}}}(a190_0x5be5,0x6c9ca));function a190_0x5be5(){const _0x5be4b3=['bool','totalCount','list','sql','string','read','18fMJfYh','str','page','\x20SQL\x20queries\x20(total:\x20','1358805CciKny','verbose','Page\x20size','List\x20custom\x20SQL\x20queries','sqlName','boolean','3615084ZjDNph','2086824WyQHVp','paging','Found\x20','1492498bqsPfk','4AxuIOj','length','tableData','2026175jtGnLA','7686490sDMhDZ','sqlcode','3KwcJES','num','sqlCode','appCode','569448wGdKws','number','pagesize','name','map','dbId','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'];a190_0x5be5=function(){return _0x5be4b3;};return a190_0x5be5();}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a190_0x41e4(_0x48942b,_0x390ba3){_0x48942b=_0x48942b-0x1a5;const _0x5be56b=a190_0x5be5();let _0x41e422=_0x5be56b[_0x48942b];return _0x41e422;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a190_0xff3f32(0x1be),'command':a190_0xff3f32(0x1bd),'description':a190_0xff3f32(0x1c8),'risk':a190_0xff3f32(0x1c0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0xff3f32(0x1b7),'type':a190_0xff3f32(0x1bf),'description':'Filter\x20by\x20SQL\x20name'},{'name':a190_0xff3f32(0x1c3),'type':a190_0xff3f32(0x1b5),'description':'Page\x20number','default':0x1},{'name':a190_0xff3f32(0x1b6),'type':a190_0xff3f32(0x1b5),'description':a190_0xff3f32(0x1c7)},{'name':a190_0xff3f32(0x1c6),'type':a190_0xff3f32(0x1ca),'description':a190_0xff3f32(0x1ba)}],async 'execute'(_0x4d8f57){const _0x230673=a190_0xff3f32,_0x3d93b6=await listSqlQueries(_0x4d8f57[_0x230673(0x1b3)],{'sqlCode':_0x4d8f57['str'](_0x230673(0x1af))||undefined,'sqlName':_0x4d8f57[_0x230673(0x1c2)]('name')||undefined,'currentPage':_0x4d8f57[_0x230673(0x1b1)](_0x230673(0x1c3)),'pageSize':_0x4d8f57[_0x230673(0x1b1)]('pagesize',0x32)}),_0x365fa9=_0x4d8f57[_0x230673(0x1bb)]('verbose'),_0x5934bb=_0x3d93b6[_0x230673(0x1ac)]??[],_0x149c70=_0x3d93b6[_0x230673(0x1a7)]?.[_0x230673(0x1bc)]??_0x5934bb['length'];let _0x4f2fbc;return _0x365fa9?_0x4f2fbc=_0x5934bb:_0x4f2fbc=await Promise['all'](_0x5934bb[_0x230673(0x1b8)](async _0x5221d3=>{const _0x36cc11=_0x230673;let _0x4e887a;try{_0x4e887a=_0x5221d3[_0x36cc11(0x1b9)]?await getDbName(_0x4d8f57[_0x36cc11(0x1b3)],_0x5221d3['dbId']):undefined;}catch{}return{'sqlCode':_0x5221d3[_0x36cc11(0x1b2)],'sqlName':_0x5221d3[_0x36cc11(0x1c9)],'description':_0x5221d3['description']??'','db':_0x4e887a?_0x4e887a+'\x20('+_0x5221d3['dbId']+')':_0x5221d3['dbId']??''};})),{'ok':!![],'data':_0x4f2fbc,'message':_0x5934bb[_0x230673(0x1ab)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x230673(0x1a8)+_0x5934bb['length']+_0x230673(0x1c4)+_0x149c70+').'};}};
|