@lovrabet/rabetbase-cli 2.3.11 → 2.3.12-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/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/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.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/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/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.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.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/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/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/update.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.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/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.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/non-interactive.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/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.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/save.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/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.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.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.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/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a155_0x53809c=a155_0x14ca;(function(_0x160573,_0x140f7c){const _0x58d85e=a155_0x14ca,_0x283a32=_0x160573();while(!![]){try{const _0x1b425e=parseInt(_0x58d85e(0x14f))/0x1+parseInt(_0x58d85e(0x14e))/0x2+-parseInt(_0x58d85e(0x148))/0x3*(-parseInt(_0x58d85e(0x142))/0x4)+parseInt(_0x58d85e(0x156))/0x5*(parseInt(_0x58d85e(0x14a))/0x6)+-parseInt(_0x58d85e(0x144))/0x7+-parseInt(_0x58d85e(0x14d))/0x8*(parseInt(_0x58d85e(0x153))/0x9)+parseInt(_0x58d85e(0x149))/0xa*(parseInt(_0x58d85e(0x14b))/0xb);if(_0x1b425e===_0x140f7c)break;else _0x283a32['push'](_0x283a32['shift']());}catch(_0x1b4a2c){_0x283a32['push'](_0x283a32['shift']());}}}(a155_0x3802,0x68fa0));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 a155_0x14ca(_0x16c79a,_0x4b914c){_0x16c79a=_0x16c79a-0x142;const _0x3802e8=a155_0x3802();let _0x14ca84=_0x3802e8[_0x16c79a];return _0x14ca84;}import{assertCustomRole,getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';const DELETE_PATH='/smartapi/permit/role/delete';export const roleDelete={'service':a155_0x53809c(0x147),'command':'delete','description':a155_0x53809c(0x150),'risk':'high-risk-write','flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x3e8f5f){const _0x198d9d=a155_0x53809c,_0xb3ce71=_0x3e8f5f[_0x198d9d(0x146)]('id'),_0x511b36=await getRoleById(_0x3e8f5f[_0x198d9d(0x155)],_0xb3ce71);return assertCustomRole(_0x511b36,_0x198d9d(0x143)),asDryRunResult({'operation':'delete','selector':{'appCode':_0x3e8f5f[_0x198d9d(0x155)],'roleId':_0xb3ce71,'roleName':_0x511b36['roleName']},'before':projectRole(_0x511b36),'after':null,'dryRun':!![],'backend':{'method':_0x198d9d(0x151),'path':DELETE_PATH},'warnings':_0x511b36[_0x198d9d(0x157)]>0x0?[_0x198d9d(0x152)+_0x511b36[_0x198d9d(0x157)]+_0x198d9d(0x154)]:[]},{'method':_0x198d9d(0x151),'url':DELETE_PATH});},async 'execute'(_0x3e607d){const _0x12273b=a155_0x53809c,_0x4811de=_0x3e607d[_0x12273b(0x146)]('id'),_0x40d205=await getRoleById(_0x3e607d[_0x12273b(0x155)],_0x4811de);return assertCustomRole(_0x40d205,_0x12273b(0x143)),await deleteAppRole(_0x4811de),{'ok':!![],'data':{'operation':_0x12273b(0x143),'selector':{'appCode':_0x3e607d[_0x12273b(0x155)],'roleId':_0x4811de,'roleName':_0x40d205['roleName']},'before':projectRole(_0x40d205),'after':null,'dryRun':![],'backend':{'method':'POST','path':DELETE_PATH},'warnings':[]},'message':_0x12273b(0x14c)+_0x40d205[_0x12273b(0x145)]+_0x12273b(0x158)+_0x4811de+')'};}};function a155_0x3802(){const _0x1a4fb9=['6202089ZApJMO','\x20member(s);\x20they\x20will\x20lose\x20this\x20group.','appCode','15NQrXTs','userCount','\x20(id=','48144NUgIxD','delete','155512QpJCyf','roleName','num','role','15ovpsCH','363470uPoAKF','520716NrVJPU','11CoUAtr','Deleted\x20role\x20','8XjAnFK','574918eBVHxr','496977JTBsOD','Delete\x20a\x20CUSTOM\x20role\x20(DEV/ADMIN\x20rejected);\x20requires\x20--yes','POST','Role\x20still\x20has\x20'];a155_0x3802=function(){return _0x1a4fb9;};return a155_0x3802();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a156_0x5a0e9d=a156_0x43cd;(function(_0x7d4b2e,_0x24f833){const _0x1aa944=a156_0x43cd,_0x247c58=_0x7d4b2e();while(!![]){try{const _0x423d16=parseInt(_0x1aa944(0xdd))/0x1+parseInt(_0x1aa944(0xe0))/0x2*(-parseInt(_0x1aa944(0xd5))/0x3)+parseInt(_0x1aa944(0xde))/0x4*(parseInt(_0x1aa944(0xdb))/0x5)+parseInt(_0x1aa944(0xd6))/0x6+-parseInt(_0x1aa944(0xd8))/0x7+-parseInt(_0x1aa944(0xd9))/0x8+parseInt(_0x1aa944(0xe2))/0x9;if(_0x423d16===_0x24f833)break;else _0x247c58['push'](_0x247c58['shift']());}catch(_0x4bdc3b){_0x247c58['push'](_0x247c58['shift']());}}}(a156_0x2b90,0xe730d));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a156_0x43cd(_0x324a60,_0x30d286){_0x324a60=_0x324a60-0xd5;const _0x2b9022=a156_0x2b90();let _0x43cd12=_0x2b9022[_0x324a60];return _0x43cd12;}import{getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';export const roleDetail={'service':a156_0x5a0e9d(0xe1),'command':a156_0x5a0e9d(0xdf),'description':a156_0x5a0e9d(0xd7),'risk':'read','flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x29797e){const _0x98351a=a156_0x5a0e9d,_0x5e5233=_0x29797e[_0x98351a(0xdc)]('id'),_0x28f428=await getRoleById(_0x29797e['appCode'],_0x5e5233);return{'ok':!![],'data':{'role':projectRole(_0x28f428)},'message':_0x98351a(0xda)+_0x28f428['roleName']+'\x20('+_0x28f428['roleType']+')'};}};function a156_0x2b90(){const _0x3e6c96=['1521066eIRhfv','3071496CShHGs','Show\x20a\x20single\x20role\x27s\x20detail','6585411FFYezT','13095096xxTVkW','Role\x20','30ERhRPh','num','643132oxrUjy','178896zGaxdp','detail','4vliNkw','role','28037421EdcqRA'];a156_0x2b90=function(){return _0x3e6c96;};return a156_0x2b90();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5f31dc,_0x462621){const _0xe24d4b=a157_0x46cb,_0x538504=_0x5f31dc();while(!![]){try{const _0x193c95=parseInt(_0xe24d4b(0xef))/0x1+-parseInt(_0xe24d4b(0xee))/0x2*(-parseInt(_0xe24d4b(0xeb))/0x3)+-parseInt(_0xe24d4b(0xe8))/0x4+-parseInt(_0xe24d4b(0xec))/0x5*(parseInt(_0xe24d4b(0xf1))/0x6)+parseInt(_0xe24d4b(0xed))/0x7+-parseInt(_0xe24d4b(0xe9))/0x8*(-parseInt(_0xe24d4b(0xf0))/0x9)+-parseInt(_0xe24d4b(0xea))/0xa;if(_0x193c95===_0x462621)break;else _0x538504['push'](_0x538504['shift']());}catch(_0x2b1fc0){_0x538504['push'](_0x538504['shift']());}}}(a157_0x2299,0x63366));import{roleList}from'../../commands/role/list.js';import{roleDetail}from'../../commands/role/detail.js';import{roleCreate}from'../../commands/role/create.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';import{roleUserRemove}from'../../commands/role/user-remove.js';export const roleDefinitions=[roleList,roleDetail,roleCreate,roleUpdate,roleDelete,roleUserResolve,roleUserAdd,roleUserRemove];function a157_0x46cb(_0x4abbb3,_0x3ec35f){_0x4abbb3=_0x4abbb3-0xe8;const _0x2299f7=a157_0x2299();let _0x46cb86=_0x2299f7[_0x4abbb3];return _0x46cb86;}function a157_0x2299(){const _0x46e8b2=['2dgKUtq','627269yhRtOT','9Orzibf','1274874NjdgtY','290280zMAPaS','497144QKJJKT','7208530BpVqiJ','699186MKzBXf','10omqDtn','4915967bYgigu'];a157_0x2299=function(){return _0x46e8b2;};return a157_0x2299();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a158_0x1ad2(){const _0x4d089d=['Found\x20','pagesize','Invalid\x20--type\x20\x22','25zkSKqt','678792EPveyn','20hHyPHO','type','Use\x20one\x20of:\x20','num','toUpperCase','appCode','string','42RoRwwN','includes','4292100LMnUEM','Page\x20index\x20(1-based)','1404006cJBqIo','DEV','Filter\x20by\x20role\x20type','number','map','join','48630PrktXA','page','CUSTOM','read','filter','5792DZVpAt','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','290xdKdjr','validation','str','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','4941lUggbH','150931GGAmIn','USER','trim','387093MycGzX'];a158_0x1ad2=function(){return _0x4d089d;};return a158_0x1ad2();}function a158_0x3deb(_0x5cebf9,_0x3d392b){_0x5cebf9=_0x5cebf9-0x176;const _0x1ad20c=a158_0x1ad2();let _0x3deb19=_0x1ad20c[_0x5cebf9];return _0x3deb19;}const a158_0x4076a3=a158_0x3deb;(function(_0x1bfcf6,_0x222520){const _0x26dfbb=a158_0x3deb,_0x42c0c6=_0x1bfcf6();while(!![]){try{const _0x1c53f9=-parseInt(_0x26dfbb(0x19a))/0x1*(parseInt(_0x26dfbb(0x189))/0x2)+-parseInt(_0x26dfbb(0x194))/0x3+parseInt(_0x26dfbb(0x188))/0x4*(parseInt(_0x26dfbb(0x187))/0x5)+parseInt(_0x26dfbb(0x190))/0x6*(parseInt(_0x26dfbb(0x183))/0x7)+parseInt(_0x26dfbb(0x179))/0x8*(-parseInt(_0x26dfbb(0x17f))/0x9)+-parseInt(_0x26dfbb(0x17b))/0xa*(-parseInt(_0x26dfbb(0x180))/0xb)+parseInt(_0x26dfbb(0x192))/0xc;if(_0x1c53f9===_0x222520)break;else _0x42c0c6['push'](_0x42c0c6['shift']());}catch(_0x274baa){_0x42c0c6['push'](_0x42c0c6['shift']());}}}(a158_0x1ad2,0x9c19d));import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=['ADMIN',a158_0x4076a3(0x195),a158_0x4076a3(0x181),a158_0x4076a3(0x176)];export const roleList={'service':'role','command':'list','description':a158_0x4076a3(0x17a),'risk':a158_0x4076a3(0x177),'flags':[APPCODE_FLAG_OPTIONAL,{'name':'type','type':a158_0x4076a3(0x18f),'required':![],'description':a158_0x4076a3(0x196),'enum':ROLE_TYPES},{'name':a158_0x4076a3(0x19b),'type':a158_0x4076a3(0x197),'description':a158_0x4076a3(0x193),'default':0x1},{'name':a158_0x4076a3(0x185),'type':a158_0x4076a3(0x197),'description':'Page\x20size\x20(1-100)','default':0x64}],async 'validate'(_0x66759e){const _0x96c529=a158_0x4076a3,_0x276ece=_0x66759e[_0x96c529(0x17d)]('type')['trim']();if(_0x276ece&&!ROLE_TYPES[_0x96c529(0x191)](_0x276ece['toUpperCase']()))throw CliErrors[_0x96c529(0x17c)](_0x96c529(0x186)+_0x276ece+'\x22.',_0x96c529(0x18b)+ROLE_TYPES[_0x96c529(0x199)](',\x20')+'.');const _0x34c74a=_0x66759e[_0x96c529(0x18c)](_0x96c529(0x19b),0x1),_0x131263=_0x66759e[_0x96c529(0x18c)](_0x96c529(0x185),0x64);if(_0x34c74a<0x1)throw CliErrors[_0x96c529(0x17c)]('--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.');if(_0x131263<0x1||_0x131263>0x64)throw CliErrors[_0x96c529(0x17c)](_0x96c529(0x17e));},async 'execute'(_0x38764a){const _0x3d67f1=a158_0x4076a3,_0x503dc5=_0x38764a[_0x3d67f1(0x18c)]('page',0x1)||0x1,_0x1fe4f7=_0x38764a[_0x3d67f1(0x18c)](_0x3d67f1(0x185),0x64)||0x64,_0x12833e=_0x38764a[_0x3d67f1(0x17d)](_0x3d67f1(0x18a))[_0x3d67f1(0x182)]()[_0x3d67f1(0x18d)](),{items:_0x5a0141,paging:_0xd2281}=await listAppRoles(_0x38764a[_0x3d67f1(0x18e)],{'currentPage':_0x503dc5,'pageSize':_0x1fe4f7}),_0x2da4d9=_0x12833e?_0x5a0141[_0x3d67f1(0x178)](_0x3044d8=>_0x3044d8['roleType']===_0x12833e):_0x5a0141,_0x1924bb=_0x2da4d9[_0x3d67f1(0x198)](projectRole);return{'ok':!![],'data':{'roles':_0x1924bb,'paging':_0xd2281},'message':_0x3d67f1(0x184)+_0x1924bb['length']+'\x20role(s)'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a159_0x368088=a159_0x1417;(function(_0xd9d646,_0x43c5cb){const _0x3c48f5=a159_0x1417,_0x134106=_0xd9d646();while(!![]){try{const _0x508a54=-parseInt(_0x3c48f5(0x239))/0x1*(parseInt(_0x3c48f5(0x1f6))/0x2)+parseInt(_0x3c48f5(0x1fa))/0x3+parseInt(_0x3c48f5(0x21c))/0x4+-parseInt(_0x3c48f5(0x20f))/0x5+-parseInt(_0x3c48f5(0x235))/0x6+parseInt(_0x3c48f5(0x22c))/0x7+parseInt(_0x3c48f5(0x22d))/0x8*(parseInt(_0x3c48f5(0x1f0))/0x9);if(_0x508a54===_0x43c5cb)break;else _0x134106['push'](_0x134106['shift']());}catch(_0x45e62f){_0x134106['push'](_0x134106['shift']());}}}(a159_0x3c05,0x818d5));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':a159_0x368088(0x21f)};export const ROLE_REF_FLAG={'name':a159_0x368088(0x22a),'type':a159_0x368088(0x21e),'required':!![],'description':a159_0x368088(0x214)};function a159_0x1417(_0x4b2ef8,_0x58e2a6){_0x4b2ef8=_0x4b2ef8-0x1eb;const _0x3c053d=a159_0x3c05();let _0x1417c8=_0x3c053d[_0x4b2ef8];return _0x1417c8;}export const USER_REF_FLAG={'name':a159_0x368088(0x238),'type':a159_0x368088(0x21e),'required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a159_0x368088(0x1f9),'type':a159_0x368088(0x21e),'required':!![],'description':a159_0x368088(0x1fc)};export const USER_NAME_FLAG={'name':a159_0x368088(0x1f9),'type':a159_0x368088(0x21e),'required':!![],'description':a159_0x368088(0x236)};export const REMARK_FLAG={'name':a159_0x368088(0x232),'type':a159_0x368088(0x21e),'required':![],'description':a159_0x368088(0x23a)};export const EXPECT_USER_COUNT_FLAG={'name':a159_0x368088(0x200),'type':a159_0x368088(0x215),'required':![],'description':a159_0x368088(0x221)};export const BUILTIN_ROLE_TYPES=[a159_0x368088(0x1ff),a159_0x368088(0x1f4),a159_0x368088(0x20d)];function a159_0x3c05(){const _0x1ce5d4=['\x22\x20not\x20found\x20in\x20app\x20','userList','8361vCBXkp','Pass\x20--role\x20<id|name>.','No\x20tenant\x20member\x20matches\x20\x22','username','DEV','\x20is\x20already\x20a\x20member\x20of\x20role\x20','1320SRvtMX','/smartapi/permit/user-role/update-user-list','nickname','name','1602201DSEDuX','Cannot\x20','Role\x20name','Role\x20name\x20\x22','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','ADMIN','expect-user-count','\x20member(s)\x20but\x20role\x20has\x20','appCode','roleType','trim','validation','POST','toLowerCase','tenant_code','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','test','\x20not\x20found\x20in\x20app\x20','USER','user-add','2475645OwyqwF','CUSTOM','Role\x20id\x20','Disambiguate\x20with\x20--role\x20<id>.','includes','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','number','tenant','filter','map','flagMissing','str','User\x20','2493956qaKASo','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','string','Role\x20id\x20(from\x20`role\x20list`)','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','dryRun','findIndex','\x22:\x20','Missing\x20user\x20reference.','\x22\x20is\x20ambiguous\x20(ids:\x20','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','flag',';\x20no\x20change.','role','push','5041498nXrBFn','2600nWoItK','expectUserCount','\x20built-in\x20role\x20','length','roleName','remark','Anti-drift\x20check\x20failed:\x20expected\x20','authRequired','5660286iFXErJ','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','user','319pphVfG','Optional\x20role\x20remark/description','userId','Disambiguate\x20with\x20--user\x20<id>.','totalCount','splice'];a159_0x3c05=function(){return _0x1ce5d4;};return a159_0x3c05();}export function isBuiltinRole(_0x59a667){const _0x4cf0c2=a159_0x368088;return BUILTIN_ROLE_TYPES[_0x4cf0c2(0x213)](_0x59a667);}export function assertCustomRole(_0x5f0687,_0x2da087){const _0x64db26=a159_0x368088;if(_0x5f0687[_0x64db26(0x203)]!==_0x64db26(0x210))throw CliErrors['validation'](_0x64db26(0x1fb)+_0x2da087+_0x64db26(0x22f)+_0x5f0687[_0x64db26(0x231)]+'\x20('+_0x5f0687['roleType']+').',_0x64db26(0x209));}export function assertPermConfigurable(_0x395bd9){const _0x559119=a159_0x368088;if(_0x395bd9[_0x559119(0x203)]===_0x559119(0x1f4)||_0x395bd9[_0x559119(0x203)]===_0x559119(0x1ff))throw CliErrors[_0x559119(0x205)](_0x559119(0x227)+_0x395bd9[_0x559119(0x231)]+'\x20('+_0x395bd9[_0x559119(0x203)]+').',_0x559119(0x1fe));}export function projectRole(_0x14212e){const _0x34b171=a159_0x368088;return{'id':_0x14212e['id'],'roleName':_0x14212e[_0x34b171(0x231)],'roleType':_0x14212e[_0x34b171(0x203)],'remark':_0x14212e['remark'],'userCount':_0x14212e['userCount'],'permitCount':_0x14212e['permitCount'],'builtin':isBuiltinRole(_0x14212e[_0x34b171(0x203)])};}export async function resolveRoleRef(_0x151121,_0x148e70){const _0x57bc73=a159_0x368088,_0x4f6a6c=_0x148e70[_0x57bc73(0x204)]();if(!_0x4f6a6c)throw CliErrors[_0x57bc73(0x205)]('Missing\x20role\x20reference.',_0x57bc73(0x1f1));if(/^\d+$/[_0x57bc73(0x20b)](_0x4f6a6c))return getRoleById(_0x151121,Number(_0x4f6a6c));const _0x3247ea=await listAllAppRoles(_0x151121),_0x598de3=_0x3247ea[_0x57bc73(0x217)](_0x189878=>_0x189878[_0x57bc73(0x231)]===_0x4f6a6c);if(_0x598de3[_0x57bc73(0x230)]===0x0)throw CliErrors[_0x57bc73(0x205)]('Role\x20name\x20\x22'+_0x4f6a6c+_0x57bc73(0x1ee)+_0x151121+'.',_0x57bc73(0x220));if(_0x598de3[_0x57bc73(0x230)]>0x1){const _0x188e3e=_0x598de3['map'](_0x458db6=>_0x458db6['id'])['join'](',\x20');throw CliErrors[_0x57bc73(0x205)](_0x57bc73(0x1fd)+_0x4f6a6c+_0x57bc73(0x226)+_0x188e3e+').',_0x57bc73(0x212));}return _0x598de3[0x0];}export async function getRoleById(_0x46c796,_0x1a1a17){const _0x36bd98=a159_0x368088,_0x48b531=await getAppRole(_0x1a1a17);if(!_0x48b531)throw CliErrors['validation'](_0x36bd98(0x211)+_0x1a1a17+_0x36bd98(0x20c)+_0x46c796+'.',_0x36bd98(0x20a));return _0x48b531;}async function listAllAppRoles(_0x4bb37c){const _0x4b6f34=a159_0x368088,_0x101bca=0x64,_0x44e39e=[];for(let _0x5a1812=0x1;;_0x5a1812+=0x1){const {items:_0x2de48d,paging:_0x5ae265}=await listAppRoles(_0x4bb37c,{'currentPage':_0x5a1812,'pageSize':_0x101bca});_0x44e39e['push'](..._0x2de48d);if(_0x2de48d[_0x4b6f34(0x230)]<_0x101bca||_0x5ae265&&_0x44e39e[_0x4b6f34(0x230)]>=_0x5ae265[_0x4b6f34(0x1ec)])return _0x44e39e;}}export async function resolveTenantCode(){const _0xdf02ee=a159_0x368088,_0x1dc1d3=await getSessionUserInfo(),_0x3cf3e7=_0x1dc1d3?.[_0xdf02ee(0x238)]?.[_0xdf02ee(0x216)]?.[_0xdf02ee(0x208)];if(!_0x3cf3e7)throw CliErrors[_0xdf02ee(0x234)](_0xdf02ee(0x237));return _0x3cf3e7;}function matchMember(_0x717537,_0xe5409c){const _0x1d93a9=a159_0x368088,_0x21a3db=_0xe5409c[_0x1d93a9(0x204)]()[_0x1d93a9(0x207)]();return(_0x717537['nickname']??'')['toLowerCase']()===_0x21a3db||(_0x717537[_0x1d93a9(0x1f3)]??'')[_0x1d93a9(0x207)]()===_0x21a3db;}export async function resolveUserRef(_0x27a7d7){const _0x5b7211=a159_0x368088,_0xa32c70=_0x27a7d7['trim']();if(!_0xa32c70)throw CliErrors[_0x5b7211(0x205)](_0x5b7211(0x225),'Pass\x20--user\x20<id|name>.');const _0x8a26ca=await resolveTenantCode(),_0x40d978=await getTenantMembers(_0x8a26ca);if(/^\d+$/[_0x5b7211(0x20b)](_0xa32c70)){const _0x5a59b1=Number(_0xa32c70),_0x5dc9ad=_0x40d978['find'](_0x2c4445=>_0x2c4445[_0x5b7211(0x23b)]===_0x5a59b1);return{'userId':_0x5a59b1,'username':_0x5dc9ad?.[_0x5b7211(0x1f3)]??String(_0x5a59b1),'nickname':_0x5dc9ad?.[_0x5b7211(0x1f8)],'matchedBy':'id'};}const _0x271308=_0x40d978[_0x5b7211(0x217)](_0x24b922=>matchMember(_0x24b922,_0xa32c70));if(_0x271308['length']===0x0)throw CliErrors[_0x5b7211(0x205)](_0x5b7211(0x1f2)+_0xa32c70+'\x22.',_0x5b7211(0x21d));if(_0x271308[_0x5b7211(0x230)]>0x1){const _0x37f9bd=_0x271308['map'](_0x67d9ba=>(_0x67d9ba[_0x5b7211(0x1f8)]??_0x67d9ba[_0x5b7211(0x1f3)]??'?')+'('+_0x67d9ba[_0x5b7211(0x23b)]+')')['join'](',\x20');throw CliErrors[_0x5b7211(0x205)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0xa32c70+_0x5b7211(0x224)+_0x37f9bd+'.',_0x5b7211(0x1eb));}const _0x514cd0=_0x271308[0x0];return{'userId':_0x514cd0[_0x5b7211(0x23b)],'username':_0x514cd0[_0x5b7211(0x1f3)]??String(_0x514cd0['userId']),'nickname':_0x514cd0[_0x5b7211(0x1f8)],'matchedBy':_0x5b7211(0x1f9)};}export const UPDATE_USER_LIST_PATH=a159_0x368088(0x1f7);function userIdsOf(_0x2430b8){const _0x1c57e9=a159_0x368088;return(_0x2430b8?.[_0x1c57e9(0x1ef)]??[])[_0x1c57e9(0x218)](_0x1417c9=>_0x1417c9[_0x1c57e9(0x23b)]);}export function computeRoleUserMutation(_0xd878fe){const _0x2db412=a159_0x368088,{operation:_0x56914a,appCode:_0x591ba5,roleUsers:_0x2f7ad2,targetRoleId:_0x434862,user:_0x409229}=_0xd878fe,_0x284fcf=_0x2f7ad2['find'](_0x1341be=>_0x1341be['id']===_0x434862);if(!_0x284fcf)throw CliErrors[_0x2db412(0x205)](_0x2db412(0x211)+_0x434862+'\x20not\x20found\x20in\x20the\x20user-role\x20list.',_0x2db412(0x20a));const _0x1decc9=userIdsOf(_0x284fcf),_0x240989=[];if(_0xd878fe[_0x2db412(0x22e)]!==undefined&&_0xd878fe[_0x2db412(0x22e)]!==_0x1decc9[_0x2db412(0x230)])throw CliErrors[_0x2db412(0x205)](_0x2db412(0x233)+_0xd878fe[_0x2db412(0x22e)]+_0x2db412(0x201)+_0x1decc9[_0x2db412(0x230)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x3a4c4d=_0x1decc9['includes'](_0x409229[_0x2db412(0x23b)]);let _0xd385af=![];const _0x2fc8f5=[..._0x284fcf[_0x2db412(0x1ef)]];if(_0x56914a===_0x2db412(0x20e))_0x3a4c4d?_0x240989[_0x2db412(0x22b)]('User\x20'+_0x409229[_0x2db412(0x23b)]+_0x2db412(0x1f5)+_0x284fcf[_0x2db412(0x231)]+_0x2db412(0x229)):(_0x2fc8f5[_0x2db412(0x22b)]({'userId':_0x409229[_0x2db412(0x23b)],'username':_0x409229['username'],..._0x409229[_0x2db412(0x1f8)]?{'nickname':_0x409229['nickname']}:{}}),_0xd385af=!![]);else{if(!_0x3a4c4d)_0x240989[_0x2db412(0x22b)](_0x2db412(0x21b)+_0x409229[_0x2db412(0x23b)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x284fcf[_0x2db412(0x231)]+_0x2db412(0x229));else{const _0x44d0ae=_0x2fc8f5[_0x2db412(0x223)](_0x4e9bca=>_0x4e9bca['userId']===_0x409229[_0x2db412(0x23b)]);if(_0x44d0ae>=0x0)_0x2fc8f5[_0x2db412(0x1ed)](_0x44d0ae,0x1);_0xd385af=!![];}}const _0xb8321b=_0x2f7ad2[_0x2db412(0x218)](_0x2dea43=>_0x2dea43['id']===_0x434862?{..._0x2dea43,'userList':_0x2fc8f5}:_0x2dea43),_0x3f248b=_0x2fc8f5[_0x2db412(0x218)](_0x13e87d=>_0x13e87d[_0x2db412(0x23b)]),_0x1b6783={'operation':_0x56914a,'selector':{'appCode':_0x591ba5,'roleId':_0x434862,'roleName':_0x284fcf[_0x2db412(0x231)],'userId':_0x409229[_0x2db412(0x23b)]},'before':{'userIds':_0x1decc9},'after':{'userIds':_0x3f248b},'dryRun':_0xd878fe[_0x2db412(0x222)],'backend':{'method':_0x2db412(0x206),'path':UPDATE_USER_LIST_PATH},'warnings':_0x240989};return{'roleList':_0xb8321b,'mutation':_0x1b6783,'changed':_0xd385af};}export async function loadRoleUsers(_0x52dfa4){return listRoleUsers(_0x52dfa4);}export function readRoleRef(_0x385f88){const _0x388efc=a159_0x368088,_0x55709d=_0x385f88[_0x388efc(0x21a)]('role')['trim']();if(!_0x55709d)throw CliErrors[_0x388efc(0x219)](_0x388efc(0x22a),_0x388efc(0x1f1));return _0x55709d;}export async function prepareUserMutation(_0x587a44,_0x2facbb,_0xfef0b2){const _0x12b46d=a159_0x368088,_0x257501=readRoleRef(_0x587a44),_0xab5c11=_0x587a44[_0x12b46d(0x21a)](_0x12b46d(0x238))[_0x12b46d(0x204)]();if(!_0xab5c11)throw CliErrors[_0x12b46d(0x219)]('user','Pass\x20--user\x20<id|name>.');const _0x7fcf79=_0x587a44[_0x12b46d(0x228)](_0x12b46d(0x200)),_0x4e7f0d=_0x7fcf79===undefined||_0x7fcf79===null?undefined:Number(_0x7fcf79),_0x680f1a=await resolveRoleRef(_0x587a44[_0x12b46d(0x202)],_0x257501),_0x4ec160=await resolveUserRef(_0xab5c11),_0x37294d=await loadRoleUsers(_0x587a44[_0x12b46d(0x202)]);return computeRoleUserMutation({'operation':_0x2facbb,'appCode':_0x587a44[_0x12b46d(0x202)],'roleUsers':_0x37294d,'targetRoleId':_0x680f1a['id'],'user':{'userId':_0x4ec160[_0x12b46d(0x23b)],'username':_0x4ec160[_0x12b46d(0x1f3)],'nickname':_0x4ec160['nickname']},'dryRun':_0xfef0b2,..._0x4e7f0d!==undefined?{'expectUserCount':_0x4e7f0d}:{}});}
|
|
1
|
+
const a159_0x491fc5=a159_0x51e7;(function(_0x4572c4,_0x32d0cc){const _0x356877=a159_0x51e7,_0x48e070=_0x4572c4();while(!![]){try{const _0x463fbe=parseInt(_0x356877(0x12b))/0x1+parseInt(_0x356877(0x160))/0x2+parseInt(_0x356877(0x152))/0x3*(parseInt(_0x356877(0x12c))/0x4)+-parseInt(_0x356877(0x134))/0x5+-parseInt(_0x356877(0x155))/0x6*(parseInt(_0x356877(0x12a))/0x7)+parseInt(_0x356877(0x154))/0x8*(-parseInt(_0x356877(0x16d))/0x9)+parseInt(_0x356877(0x146))/0xa;if(_0x463fbe===_0x32d0cc)break;else _0x48e070['push'](_0x48e070['shift']());}catch(_0x58b2ab){_0x48e070['push'](_0x48e070['shift']());}}}(a159_0x23d2,0x78f5c));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a159_0x491fc5(0x164),'type':a159_0x491fc5(0x145),'required':!![],'description':'Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)'};export const USER_REF_FLAG={'name':a159_0x491fc5(0x13e),'type':a159_0x491fc5(0x145),'required':!![],'description':a159_0x491fc5(0x15b)};export const NAME_FLAG={'name':a159_0x491fc5(0x15e),'type':'string','required':!![],'description':a159_0x491fc5(0x173)};export const USER_NAME_FLAG={'name':a159_0x491fc5(0x15e),'type':a159_0x491fc5(0x145),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a159_0x491fc5(0x138),'type':a159_0x491fc5(0x145),'required':![],'description':a159_0x491fc5(0x169)};function a159_0x51e7(_0x35a7d8,_0x92e5e1){_0x35a7d8=_0x35a7d8-0x126;const _0x23d2de=a159_0x23d2();let _0x51e716=_0x23d2de[_0x35a7d8];return _0x51e716;}export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a159_0x491fc5(0x132),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a159_0x491fc5(0x149),a159_0x491fc5(0x13f),a159_0x491fc5(0x16e)];export function isBuiltinRole(_0x166189){return BUILTIN_ROLE_TYPES['includes'](_0x166189);}export function assertCustomRole(_0x3128ef,_0x2b4b0a){const _0x5e6fd2=a159_0x491fc5;if(_0x3128ef[_0x5e6fd2(0x16f)]!==_0x5e6fd2(0x137))throw CliErrors[_0x5e6fd2(0x168)](_0x5e6fd2(0x14b)+_0x2b4b0a+_0x5e6fd2(0x13c)+_0x3128ef[_0x5e6fd2(0x167)]+'\x20('+_0x3128ef['roleType']+').',_0x5e6fd2(0x14f));}export function assertPermConfigurable(_0x3b8243){const _0x485aac=a159_0x491fc5;if(_0x3b8243[_0x485aac(0x16f)]==='DEV'||_0x3b8243[_0x485aac(0x16f)]===_0x485aac(0x149))throw CliErrors[_0x485aac(0x168)](_0x485aac(0x13a)+_0x3b8243['roleName']+'\x20('+_0x3b8243[_0x485aac(0x16f)]+').','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.');}export function projectRole(_0xc45af9){const _0x3f6d13=a159_0x491fc5;return{'id':_0xc45af9['id'],'roleName':_0xc45af9[_0x3f6d13(0x167)],'roleType':_0xc45af9['roleType'],'remark':_0xc45af9[_0x3f6d13(0x138)],'userCount':_0xc45af9[_0x3f6d13(0x172)],'permitCount':_0xc45af9[_0x3f6d13(0x174)],'builtin':isBuiltinRole(_0xc45af9[_0x3f6d13(0x16f)])};}export async function resolveRoleRef(_0x29acfb,_0x36e81e){const _0x596077=a159_0x491fc5,_0x3ad6b8=_0x36e81e[_0x596077(0x139)]();if(!_0x3ad6b8)throw CliErrors['validation']('Missing\x20role\x20reference.',_0x596077(0x147));if(/^\d+$/[_0x596077(0x16b)](_0x3ad6b8))return getRoleById(_0x29acfb,Number(_0x3ad6b8));const _0x37ff18=await listAllAppRoles(_0x29acfb),_0x32fb3b=_0x37ff18[_0x596077(0x153)](_0x5beae4=>_0x5beae4[_0x596077(0x167)]===_0x3ad6b8);if(_0x32fb3b['length']===0x0)throw CliErrors['validation']('Role\x20name\x20\x22'+_0x3ad6b8+_0x596077(0x128)+_0x29acfb+'.',_0x596077(0x158));if(_0x32fb3b[_0x596077(0x159)]>0x1){const _0x25d342=_0x32fb3b[_0x596077(0x130)](_0x1b8c55=>_0x1b8c55['id'])[_0x596077(0x151)](',\x20');throw CliErrors[_0x596077(0x168)](_0x596077(0x14c)+_0x3ad6b8+_0x596077(0x171)+_0x25d342+').',_0x596077(0x15d));}return _0x32fb3b[0x0];}export async function getRoleById(_0x31ba85,_0xf2d1aa){const _0x4829e3=a159_0x491fc5,_0x5ef091=await getAppRole(_0xf2d1aa);if(!_0x5ef091)throw CliErrors[_0x4829e3(0x168)](_0x4829e3(0x12f)+_0xf2d1aa+_0x4829e3(0x16c)+_0x31ba85+'.',_0x4829e3(0x162));return _0x5ef091;}async function listAllAppRoles(_0x169839){const _0x2d88bf=a159_0x491fc5,_0x2734d7=0x64,_0x5d126a=[];for(let _0x208b3f=0x1;;_0x208b3f+=0x1){const {items:_0x59167e,paging:_0x488dce}=await listAppRoles(_0x169839,{'currentPage':_0x208b3f,'pageSize':_0x2734d7});_0x5d126a[_0x2d88bf(0x12d)](..._0x59167e);if(_0x59167e['length']<_0x2734d7||_0x488dce&&_0x5d126a[_0x2d88bf(0x159)]>=_0x488dce[_0x2d88bf(0x170)])return _0x5d126a;}}export async function resolveTenantCode(){const _0x3b7982=a159_0x491fc5,_0x562ba5=await getSessionUserInfo(),_0x3ac0c0=_0x562ba5?.['user']?.[_0x3b7982(0x14d)]?.[_0x3b7982(0x157)];if(!_0x3ac0c0)throw CliErrors['authRequired']('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x3ac0c0;}function matchMember(_0x1b7e0f,_0x13bec7){const _0x1e5978=a159_0x491fc5,_0x195679=_0x13bec7[_0x1e5978(0x139)]()[_0x1e5978(0x15f)]();return(_0x1b7e0f[_0x1e5978(0x126)]??'')[_0x1e5978(0x15f)]()===_0x195679||(_0x1b7e0f[_0x1e5978(0x127)]??'')[_0x1e5978(0x15f)]()===_0x195679;}export async function resolveUserRef(_0x51f27e){const _0x542ac9=a159_0x491fc5,_0x285d29=_0x51f27e[_0x542ac9(0x139)]();if(!_0x285d29)throw CliErrors[_0x542ac9(0x168)](_0x542ac9(0x131),'Pass\x20--user\x20<id|name>.');const _0xed5a1a=await resolveTenantCode(),_0x1b4812=await getTenantMembers(_0xed5a1a);if(/^\d+$/[_0x542ac9(0x16b)](_0x285d29)){const _0x31580a=Number(_0x285d29),_0x37332b=_0x1b4812[_0x542ac9(0x142)](_0x126d65=>_0x126d65[_0x542ac9(0x156)]===_0x31580a);return{'userId':_0x31580a,'username':_0x37332b?.[_0x542ac9(0x127)]??String(_0x31580a),'nickname':_0x37332b?.[_0x542ac9(0x126)],'matchedBy':'id'};}const _0x34aa62=_0x1b4812[_0x542ac9(0x153)](_0x4be98a=>matchMember(_0x4be98a,_0x285d29));if(_0x34aa62[_0x542ac9(0x159)]===0x0)throw CliErrors[_0x542ac9(0x168)](_0x542ac9(0x143)+_0x285d29+'\x22.',_0x542ac9(0x161));if(_0x34aa62['length']>0x1){const _0x448cdd=_0x34aa62['map'](_0xb880fd=>(_0xb880fd[_0x542ac9(0x126)]??_0xb880fd['username']??'?')+'('+_0xb880fd[_0x542ac9(0x156)]+')')[_0x542ac9(0x151)](',\x20');throw CliErrors[_0x542ac9(0x168)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x285d29+_0x542ac9(0x12e)+_0x448cdd+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x2fbdfb=_0x34aa62[0x0];return{'userId':_0x2fbdfb['userId'],'username':_0x2fbdfb['username']??String(_0x2fbdfb[_0x542ac9(0x156)]),'nickname':_0x2fbdfb[_0x542ac9(0x126)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a159_0x491fc5(0x148);function a159_0x23d2(){const _0x5f5a51=['Disambiguate\x20with\x20--role\x20<id>.','name','toLowerCase','634976jNZOVx','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','\x20is\x20already\x20a\x20member\x20of\x20role\x20','role','findIndex','POST','roleName','validation','Optional\x20role\x20remark/description','\x20not\x20found\x20in\x20the\x20user-role\x20list.','test','\x20not\x20found\x20in\x20app\x20','46854SHkpzn','USER','roleType','totalCount','\x22\x20is\x20ambiguous\x20(ids:\x20','userCount','Role\x20name','permitCount','Pass\x20--user\x20<id|name>.','nickname','username','\x22\x20not\x20found\x20in\x20app\x20','\x20member(s)\x20but\x20role\x20has\x20','217xEmlKd','777224tGECty','3789472mNWJQk','push','\x22:\x20','Role\x20id\x20','map','Missing\x20user\x20reference.','number','flag','4649885hcMdRL','expectUserCount','appCode','CUSTOM','remark','trim','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','userList','\x20built-in\x20role\x20','user-add','user','DEV',';\x20no\x20change.','User\x20','find','No\x20tenant\x20member\x20matches\x20\x22','dryRun','string','1357210eTMSBs','Pass\x20--role\x20<id|name>.','/smartapi/permit/user-role/update-user-list','ADMIN','str','Cannot\x20','Role\x20name\x20\x22','tenant','flagMissing','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','\x20is\x20not\x20a\x20member\x20of\x20role\x20','join','3WSTEFu','filter','488mcpnVt','84156guWdcZ','userId','tenant_code','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','length','expect-user-count','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','splice'];a159_0x23d2=function(){return _0x5f5a51;};return a159_0x23d2();}function userIdsOf(_0x3ecfe0){const _0x26e821=a159_0x491fc5;return(_0x3ecfe0?.['userList']??[])[_0x26e821(0x130)](_0x20f62c=>_0x20f62c[_0x26e821(0x156)]);}export function computeRoleUserMutation(_0x38bacb){const _0x12423b=a159_0x491fc5,{operation:_0x26f703,appCode:_0x2b3666,roleUsers:_0x21a2bf,targetRoleId:_0x3acd41,user:_0x5e774c}=_0x38bacb,_0x1cca14=_0x21a2bf[_0x12423b(0x142)](_0x40efab=>_0x40efab['id']===_0x3acd41);if(!_0x1cca14)throw CliErrors[_0x12423b(0x168)](_0x12423b(0x12f)+_0x3acd41+_0x12423b(0x16a),_0x12423b(0x162));const _0x1dfdf8=userIdsOf(_0x1cca14),_0x10af43=[];if(_0x38bacb[_0x12423b(0x135)]!==undefined&&_0x38bacb['expectUserCount']!==_0x1dfdf8[_0x12423b(0x159)])throw CliErrors[_0x12423b(0x168)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x38bacb[_0x12423b(0x135)]+_0x12423b(0x129)+_0x1dfdf8[_0x12423b(0x159)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x1a710c=_0x1dfdf8['includes'](_0x5e774c[_0x12423b(0x156)]);let _0x29c8fa=![];const _0x591897=[..._0x1cca14[_0x12423b(0x13b)]];if(_0x26f703===_0x12423b(0x13d))_0x1a710c?_0x10af43['push'](_0x12423b(0x141)+_0x5e774c['userId']+_0x12423b(0x163)+_0x1cca14[_0x12423b(0x167)]+_0x12423b(0x140)):(_0x591897[_0x12423b(0x12d)]({'userId':_0x5e774c[_0x12423b(0x156)],'username':_0x5e774c[_0x12423b(0x127)],..._0x5e774c[_0x12423b(0x126)]?{'nickname':_0x5e774c['nickname']}:{}}),_0x29c8fa=!![]);else{if(!_0x1a710c)_0x10af43[_0x12423b(0x12d)](_0x12423b(0x141)+_0x5e774c[_0x12423b(0x156)]+_0x12423b(0x150)+_0x1cca14[_0x12423b(0x167)]+';\x20no\x20change.');else{const _0x45f601=_0x591897[_0x12423b(0x165)](_0x18ecf2=>_0x18ecf2[_0x12423b(0x156)]===_0x5e774c[_0x12423b(0x156)]);if(_0x45f601>=0x0)_0x591897[_0x12423b(0x15c)](_0x45f601,0x1);_0x29c8fa=!![];}}const _0x27f689=_0x21a2bf[_0x12423b(0x130)](_0x43367e=>_0x43367e['id']===_0x3acd41?{..._0x43367e,'userList':_0x591897}:_0x43367e),_0xc6d90f=_0x591897[_0x12423b(0x130)](_0x326845=>_0x326845[_0x12423b(0x156)]),_0x5199fd={'operation':_0x26f703,'selector':{'appCode':_0x2b3666,'roleId':_0x3acd41,'roleName':_0x1cca14[_0x12423b(0x167)],'userId':_0x5e774c[_0x12423b(0x156)]},'before':{'userIds':_0x1dfdf8},'after':{'userIds':_0xc6d90f},'dryRun':_0x38bacb[_0x12423b(0x144)],'backend':{'method':_0x12423b(0x166),'path':UPDATE_USER_LIST_PATH},'warnings':_0x10af43};return{'roleList':_0x27f689,'mutation':_0x5199fd,'changed':_0x29c8fa};}export async function loadRoleUsers(_0x2b2a7b){return listRoleUsers(_0x2b2a7b);}export function readRoleRef(_0x5dd307){const _0x4f1e08=a159_0x491fc5,_0x3b4ee4=_0x5dd307[_0x4f1e08(0x14a)](_0x4f1e08(0x164))['trim']();if(!_0x3b4ee4)throw CliErrors['flagMissing']('role',_0x4f1e08(0x147));return _0x3b4ee4;}export async function prepareUserMutation(_0x17b19f,_0x56b5dd,_0x5eb7c7){const _0x5421f7=a159_0x491fc5,_0x922c73=readRoleRef(_0x17b19f),_0x1ffca2=_0x17b19f[_0x5421f7(0x14a)](_0x5421f7(0x13e))[_0x5421f7(0x139)]();if(!_0x1ffca2)throw CliErrors[_0x5421f7(0x14e)](_0x5421f7(0x13e),_0x5421f7(0x175));const _0x125c80=_0x17b19f[_0x5421f7(0x133)](_0x5421f7(0x15a)),_0x3659b8=_0x125c80===undefined||_0x125c80===null?undefined:Number(_0x125c80),_0x2322a5=await resolveRoleRef(_0x17b19f[_0x5421f7(0x136)],_0x922c73),_0x3fa817=await resolveUserRef(_0x1ffca2),_0x2b800c=await loadRoleUsers(_0x17b19f[_0x5421f7(0x136)]);return computeRoleUserMutation({'operation':_0x56b5dd,'appCode':_0x17b19f[_0x5421f7(0x136)],'roleUsers':_0x2b800c,'targetRoleId':_0x2322a5['id'],'user':{'userId':_0x3fa817[_0x5421f7(0x156)],'username':_0x3fa817[_0x5421f7(0x127)],'nickname':_0x3fa817[_0x5421f7(0x126)]},'dryRun':_0x5eb7c7,..._0x3659b8!==undefined?{'expectUserCount':_0x3659b8}:{}});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a160_0xb453ce=a160_0x5f0a;(function(_0x31b4ef,_0x3f1150){const _0x4c7880=a160_0x5f0a,_0x29e26b=_0x31b4ef();while(!![]){try{const _0x24e402=parseInt(_0x4c7880(0x176))/0x1*(-parseInt(_0x4c7880(0x169))/0x2)+-parseInt(_0x4c7880(0x171))/0x3*(-parseInt(_0x4c7880(0x17b))/0x4)+parseInt(_0x4c7880(0x16c))/0x5+parseInt(_0x4c7880(0x175))/0x6+-parseInt(_0x4c7880(0x17c))/0x7+parseInt(_0x4c7880(0x17a))/0x8*(parseInt(_0x4c7880(0x179))/0x9)+-parseInt(_0x4c7880(0x165))/0xa;if(_0x24e402===_0x3f1150)break;else _0x29e26b['push'](_0x29e26b['shift']());}catch(_0x438dee){_0x29e26b['push'](_0x29e26b['shift']());}}}(a160_0x4514,0xa047c));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a160_0x4514(){const _0x1fac64=['flag','2075490aOVfTu','validation','\x20(id=','remark','write','2157HhIiJU','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','/smartapi/permit/role/update','trim','4382580YSMvUG','771Eohshs','update','name','1974807KgelEU','24BuClyK','1780eJctTF','996030KAgcUV','Nothing\x20to\x20update.','POST','string','1198810JWhIId','Updated\x20role\x20','roleName','appCode','3126KzMXJt','length'];a160_0x4514=function(){return _0x1fac64;};return a160_0x4514();}function a160_0x5f0a(_0x43ff85,_0x48fb7e){_0x43ff85=_0x43ff85-0x162;const _0x45143b=a160_0x4514();let _0x5f0ae1=_0x45143b[_0x43ff85];return _0x5f0ae1;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a160_0xb453ce(0x173);function readPatch(_0x396eda){const _0x4fd4ec=a160_0xb453ce,_0x2297dd=_0x396eda['flag']('name'),_0x2ef991=_0x396eda[_0x4fd4ec(0x16b)]('remark'),_0x283ab4={};if(_0x2297dd!==undefined&&_0x2297dd!==null){const _0x2e2c76=String(_0x2297dd)[_0x4fd4ec(0x174)]();if(!_0x2e2c76)throw CliErrors[_0x4fd4ec(0x16d)]('--name\x20cannot\x20be\x20empty.');if(_0x2e2c76[_0x4fd4ec(0x16a)]>0x40)throw CliErrors[_0x4fd4ec(0x16d)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x283ab4[_0x4fd4ec(0x167)]=_0x2e2c76;}_0x2ef991!==undefined&&_0x2ef991!==null&&(_0x283ab4[_0x4fd4ec(0x16f)]=String(_0x2ef991));if(_0x283ab4['roleName']===undefined&&_0x283ab4[_0x4fd4ec(0x16f)]===undefined)throw CliErrors[_0x4fd4ec(0x16d)](_0x4fd4ec(0x162),_0x4fd4ec(0x172));return _0x283ab4;}export const roleUpdate={'service':'role','command':a160_0xb453ce(0x177),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':a160_0xb453ce(0x170),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a160_0xb453ce(0x178),'type':a160_0xb453ce(0x164),'required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x21f1e1){readPatch(_0x21f1e1);},async 'dryRun'(_0x15c4a1){const _0x1a6818=a160_0xb453ce,_0x47fc95=_0x15c4a1['num']('id'),_0x26c440=readPatch(_0x15c4a1),_0x10734a=await getRoleById(_0x15c4a1[_0x1a6818(0x168)],_0x47fc95);return assertCustomRole(_0x10734a,_0x1a6818(0x177)),asDryRunResult({'operation':'update','selector':{'appCode':_0x15c4a1['appCode'],'roleId':_0x47fc95,'roleName':_0x10734a['roleName']},'before':projectRole(_0x10734a),'after':projectRole({..._0x10734a,..._0x26c440['roleName']!==undefined?{'roleName':_0x26c440[_0x1a6818(0x167)]}:{},..._0x26c440[_0x1a6818(0x16f)]!==undefined?{'remark':_0x26c440['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x1a6818(0x163),'path':UPDATE_PATH},'warnings':[]},{'method':_0x1a6818(0x163),'url':UPDATE_PATH});},async 'execute'(_0x82f4ba){const _0x440bd7=a160_0xb453ce,_0x4e2058=_0x82f4ba['num']('id'),_0x3f6505=readPatch(_0x82f4ba),_0x5c1637=await getRoleById(_0x82f4ba[_0x440bd7(0x168)],_0x4e2058);assertCustomRole(_0x5c1637,_0x440bd7(0x177)),await updateAppRole({'id':_0x4e2058,'appCode':_0x82f4ba[_0x440bd7(0x168)],..._0x3f6505[_0x440bd7(0x167)]!==undefined?{'roleName':_0x3f6505[_0x440bd7(0x167)]}:{},..._0x3f6505['remark']!==undefined?{'remark':_0x3f6505[_0x440bd7(0x16f)]}:{}});const _0x38b109=await getRoleById(_0x82f4ba[_0x440bd7(0x168)],_0x4e2058);return{'ok':!![],'data':{'operation':_0x440bd7(0x177),'selector':{'appCode':_0x82f4ba[_0x440bd7(0x168)],'roleId':_0x4e2058,'roleName':_0x38b109[_0x440bd7(0x167)]},'before':projectRole(_0x5c1637),'after':projectRole(_0x38b109),'dryRun':![],'backend':{'method':_0x440bd7(0x163),'path':UPDATE_PATH},'warnings':[]},'message':_0x440bd7(0x166)+_0x38b109['roleName']+_0x440bd7(0x16e)+_0x4e2058+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x22f74f=a161_0x38cd;function a161_0x38cd(_0x2c1139,_0x265a2a){_0x2c1139=_0x2c1139-0x13f;const _0xdaa9a=a161_0xdaa9();let _0x38cd20=_0xdaa9a[_0x2c1139];return _0x38cd20;}(function(_0x28b3cf,_0x30f0e7){const _0x2cae2a=a161_0x38cd,_0x3d0164=_0x28b3cf();while(!![]){try{const _0x1dd64e=parseInt(_0x2cae2a(0x144))/0x1*(-parseInt(_0x2cae2a(0x14e))/0x2)+parseInt(_0x2cae2a(0x14b))/0x3*(-parseInt(_0x2cae2a(0x140))/0x4)+parseInt(_0x2cae2a(0x141))/0x5*(-parseInt(_0x2cae2a(0x13f))/0x6)+-parseInt(_0x2cae2a(0x145))/0x7+-parseInt(_0x2cae2a(0x151))/0x8+parseInt(_0x2cae2a(0x148))/0x9*(-parseInt(_0x2cae2a(0x149))/0xa)+parseInt(_0x2cae2a(0x147))/0xb;if(_0x1dd64e===_0x30f0e7)break;else _0x3d0164['push'](_0x3d0164['shift']());}catch(_0x23a66f){_0x3d0164['push'](_0x3d0164['shift']());}}}(a161_0xdaa9,0x48530));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a161_0xdaa9(){const _0x11f6c1=['\x20to\x20role\x20','selector','1NVApos','2070005PJTjre','POST','23951884LMLVlF','36711hDTiax','1100yiZHEN','Added\x20user\x20','177501GlxZGm','roleName','userId','823726QbraiE','user-add','role','1914328lTjwvD','high-risk-write','\x20already\x20in\x20role\x20','564fTZXcR','4RZPaNj','22685onzgSW'];a161_0xdaa9=function(){return _0x11f6c1;};return a161_0xdaa9();}import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a161_0x22f74f(0x150),'command':a161_0x22f74f(0x14f),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a161_0x22f74f(0x152),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x3f89ad){const _0x471bc2=a161_0x22f74f,{mutation:_0x42c3a8}=await prepareUserMutation(_0x3f89ad,_0x471bc2(0x14f),!![]);return asDryRunResult(_0x42c3a8,{'method':_0x471bc2(0x146),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x3d6f04){const _0x2400fa=a161_0x22f74f,{roleList:_0x17bdd7,mutation:_0x5c1c2e,changed:_0x6da215}=await prepareUserMutation(_0x3d6f04,_0x2400fa(0x14f),![]);return _0x6da215&&await updateRoleUsers(_0x3d6f04['appCode'],_0x17bdd7),{'ok':!![],'data':_0x5c1c2e,'message':_0x6da215?_0x2400fa(0x14a)+_0x5c1c2e['selector'][_0x2400fa(0x14d)]+_0x2400fa(0x142)+_0x5c1c2e[_0x2400fa(0x143)]['roleName']:'No\x20change:\x20user\x20'+_0x5c1c2e[_0x2400fa(0x143)][_0x2400fa(0x14d)]+_0x2400fa(0x153)+_0x5c1c2e[_0x2400fa(0x143)][_0x2400fa(0x14c)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a162_0x8dba92=a162_0xea33;(function(_0x392578,_0x39d022){const _0x5eb81a=a162_0xea33,_0x47bb06=_0x392578();while(!![]){try{const _0x2e0ea1=-parseInt(_0x5eb81a(0x80))/0x1+parseInt(_0x5eb81a(0x86))/0x2*(-parseInt(_0x5eb81a(0x85))/0x3)+-parseInt(_0x5eb81a(0x87))/0x4*(-parseInt(_0x5eb81a(0x7a))/0x5)+-parseInt(_0x5eb81a(0x84))/0x6+-parseInt(_0x5eb81a(0x76))/0x7*(-parseInt(_0x5eb81a(0x75))/0x8)+-parseInt(_0x5eb81a(0x7d))/0x9+-parseInt(_0x5eb81a(0x88))/0xa*(-parseInt(_0x5eb81a(0x7c))/0xb);if(_0x2e0ea1===_0x39d022)break;else _0x47bb06['push'](_0x47bb06['shift']());}catch(_0x2b3350){_0x47bb06['push'](_0x47bb06['shift']());}}}(a162_0x4fbb,0x4d6ef));import{updateRoleUsers}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,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':'role','command':a162_0x8dba92(0x77),'description':a162_0x8dba92(0x78),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x39b5d7){const _0xc210b0=a162_0x8dba92,{mutation:_0x47300d}=await prepareUserMutation(_0x39b5d7,'user-remove',!![]);return asDryRunResult(_0x47300d,{'method':_0xc210b0(0x7e),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x588a0a){const _0x36c2ed=a162_0x8dba92,{roleList:_0x576bac,mutation:_0x199132,changed:_0x260b24}=await prepareUserMutation(_0x588a0a,_0x36c2ed(0x77),![]);return _0x260b24&&await updateRoleUsers(_0x588a0a[_0x36c2ed(0x7b)],_0x576bac),{'ok':!![],'data':_0x199132,'message':_0x260b24?_0x36c2ed(0x83)+_0x199132['selector'][_0x36c2ed(0x81)]+'\x20from\x20role\x20'+_0x199132[_0x36c2ed(0x79)]['roleName']:_0x36c2ed(0x82)+_0x199132['selector'][_0x36c2ed(0x81)]+'\x20not\x20in\x20role\x20'+_0x199132[_0x36c2ed(0x79)][_0x36c2ed(0x7f)]};}};function a162_0xea33(_0x4c7356,_0x4a079c){_0x4c7356=_0x4c7356-0x75;const _0x4fbb0a=a162_0x4fbb();let _0xea3300=_0x4fbb0a[_0x4c7356];return _0xea3300;}function a162_0x4fbb(){const _0x1e9ab6=['selector','218510tUkkCW','appCode','4690213YkwPfC','5708403aHnNKR','POST','roleName','496704VhdgXr','userId','No\x20change:\x20user\x20','Removed\x20user\x20','3697002HHzGQS','6SoQabL','403288pJXiXQ','56aAAbIh','30TSLIzS','1153232BMxkiL','28ooQGCH','user-remove','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes'];a162_0x4fbb=function(){return _0x1e9ab6;};return a162_0x4fbb();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a163_0x1ceb(){const _0x3db705=['Resolved\x20\x22','str','8325pWwlaR','name','4186SpxHwJ','userId','matchedBy','1796604bpYSxP','flagMissing','23830LhUUAF','1262678CEOaNS','2146640Dyzxki','role','1IkwBEO','username','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','read','nickname','389416IWqvPR','4496FTuhbf','trim','1365798bjYFCW','Pass\x20--name\x20<nickname|username>.'];a163_0x1ceb=function(){return _0x3db705;};return a163_0x1ceb();}const a163_0x508523=a163_0x57a5;(function(_0x551c4d,_0x115775){const _0x15283c=a163_0x57a5,_0x3d41bc=_0x551c4d();while(!![]){try{const _0x1d330c=parseInt(_0x15283c(0x1d4))/0x1*(-parseInt(_0x15283c(0x1d1))/0x2)+-parseInt(_0x15283c(0x1ce))/0x3+-parseInt(_0x15283c(0x1d9))/0x4+-parseInt(_0x15283c(0x1d2))/0x5+parseInt(_0x15283c(0x1dc))/0x6+parseInt(_0x15283c(0x1cb))/0x7*(-parseInt(_0x15283c(0x1da))/0x8)+parseInt(_0x15283c(0x1e0))/0x9*(parseInt(_0x15283c(0x1d0))/0xa);if(_0x1d330c===_0x115775)break;else _0x3d41bc['push'](_0x3d41bc['shift']());}catch(_0x37c5b8){_0x3d41bc['push'](_0x3d41bc['shift']());}}}(a163_0x1ceb,0x52bff));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a163_0x57a5(_0x58a183,_0x41e8e4){_0x58a183=_0x58a183-0x1ca;const _0x1cebbb=a163_0x1ceb();let _0x57a547=_0x1cebbb[_0x58a183];return _0x57a547;}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a163_0x508523(0x1d3),'command':'user-resolve','description':a163_0x508523(0x1d6),'risk':a163_0x508523(0x1d7),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x40394b){const _0x3eebf0=a163_0x508523;if(!_0x40394b['str'](_0x3eebf0(0x1ca))[_0x3eebf0(0x1db)]())throw CliErrors[_0x3eebf0(0x1cf)](_0x3eebf0(0x1ca),_0x3eebf0(0x1dd));},async 'execute'(_0xd99ee8){const _0x40c124=a163_0x508523,_0x5ef8d6=_0xd99ee8[_0x40c124(0x1df)](_0x40c124(0x1ca))[_0x40c124(0x1db)](),_0x2ddd7e=await resolveUserRef(_0x5ef8d6);return{'ok':!![],'data':{'user':{'userId':_0x2ddd7e[_0x40c124(0x1cc)],'username':_0x2ddd7e[_0x40c124(0x1d5)],'nickname':_0x2ddd7e[_0x40c124(0x1d8)],'matchedBy':_0x2ddd7e[_0x40c124(0x1cd)]}},'message':_0x40c124(0x1de)+_0x5ef8d6+'\x22\x20→\x20userId\x20'+_0x2ddd7e[_0x40c124(0x1cc)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x2715bd=a164_0x5cca;(function(_0x4b660d,_0x177eda){const _0x5a7242=a164_0x5cca,_0x19710d=_0x4b660d();while(!![]){try{const _0x5af1e7=parseInt(_0x5a7242(0x1f8))/0x1*(parseInt(_0x5a7242(0x215))/0x2)+parseInt(_0x5a7242(0x211))/0x3+parseInt(_0x5a7242(0x219))/0x4+parseInt(_0x5a7242(0x22d))/0x5*(-parseInt(_0x5a7242(0x214))/0x6)+parseInt(_0x5a7242(0x20c))/0x7+-parseInt(_0x5a7242(0x208))/0x8*(-parseInt(_0x5a7242(0x212))/0x9)+parseInt(_0x5a7242(0x220))/0xa*(-parseInt(_0x5a7242(0x1fa))/0xb);if(_0x5af1e7===_0x177eda)break;else _0x19710d['push'](_0x19710d['shift']());}catch(_0x417b4c){_0x19710d['push'](_0x19710d['shift']());}}}(a164_0x1212,0xd497e));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';function a164_0x1212(){const _0x19fb1d=['watch','npm','7665785yPvdgp','read','bun.lockb','run','\x20run\x20','Script\x20\x22','yarn','vite','package.json','\x20run\x20preview\x20--watch','start','\x20\x20\x20\x20','2zfrsPU','log','3839xDCOdr','.bin','validation','No\x20package.json\x20found\x20in\x20current\x20directory.','boolean','Script\x20name\x20defined\x20in\x20package.json','all','bool','cwd','\x20run\x20<script>\x0a','inherit','\x20\x20EXAMPLES','has','script','818952LzZkIX','error','vite\x20preview\x20exited\x20with\x20code\x20','join','3035480XxxlOO','slice','pnpm','utf-8','bun.lock','2331828HEqUyu','135AfDWjQ','\x22\x20not\x20found\x20in\x20package.json.','6IkQaSD','135654oLQDUy','bun','node_modules','keys','4778364lOxWZx','needsUpgrade','yarn.lock','scripts','close','\x20run\x20build','No\x20scripts\x20defined\x20in\x20package.json.','47930VHIdvi','args','push','parse','Run\x20a\x20package.json\x20script','\x20run\x20preview','--watch','preview','length','build','\x0a\x20\x20Usage:\x20'];a164_0x1212=function(){return _0x19fb1d;};return a164_0x1212();}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([a164_0x2715bd(0x1f6),'dev']);function readPackageScripts(_0x2c96ae){const _0x5a005f=a164_0x2715bd,_0x9297d5=resolve(_0x2c96ae,_0x5a005f(0x1f4));if(!existsSync(_0x9297d5))return null;try{const _0x5523f6=JSON[_0x5a005f(0x223)](readFileSync(_0x9297d5,_0x5a005f(0x20f)));return _0x5523f6[_0x5a005f(0x21c)]??{};}catch{return null;}}function detectPackageManager(_0x3e4225){const _0xbb6aaa=a164_0x2715bd;if(existsSync(resolve(_0x3e4225,_0xbb6aaa(0x22f)))||existsSync(resolve(_0x3e4225,_0xbb6aaa(0x210))))return _0xbb6aaa(0x216);if(existsSync(resolve(_0x3e4225,'pnpm-lock.yaml')))return _0xbb6aaa(0x20e);if(existsSync(resolve(_0x3e4225,_0xbb6aaa(0x21b))))return _0xbb6aaa(0x1f2);return _0xbb6aaa(0x22c);}async function versionCheck(_0xdd0a5d){const _0x430a93=a164_0x2715bd,_0x14fa0c=await checkCliVersion();(_0x14fa0c[_0x430a93(0x21a)]||_0x14fa0c['belowMinimum'])&&(printCliUpgradeWarning(_0x14fa0c),assertCliVersionSupported(_0x14fa0c));const _0x277e3b=await checkSdkVersion(_0xdd0a5d);if(_0x277e3b[_0x430a93(0x21a)])printSdkUpgradeWarning(_0x277e3b);}function spawnScript(_0x5b3ba5,_0x520939,_0x48855a,_0x211087){return new Promise((_0x3a44e,_0x4eb2fd)=>{const _0x4c5a28=a164_0x5cca,_0x284b9e=[_0x4c5a28(0x230),_0x520939,..._0x48855a],_0x507cc6=spawn(_0x5b3ba5,_0x284b9e,{'cwd':_0x211087,'stdio':_0x4c5a28(0x204),'shell':!![],'env':{...process.env,'PATH':''+join(_0x211087,_0x4c5a28(0x217),_0x4c5a28(0x1fb))+delimiter+process.env.PATH}});_0x507cc6['on'](_0x4c5a28(0x21d),_0x4feacd=>{const _0x1d0248=_0x4c5a28;if(_0x4feacd===0x0||_0x4feacd===null)_0x3a44e();else _0x4eb2fd(new Error(_0x5b3ba5+_0x1d0248(0x1f0)+_0x520939+'\x20exited\x20with\x20code\x20'+_0x4feacd));}),_0x507cc6['on'](_0x4c5a28(0x209),_0x4eb2fd);});}function spawnViteBuildWatch(_0x2343f8){return new Promise((_0x177915,_0x56d906)=>{const _0x4cef84=a164_0x5cca,_0x49a3c9=spawn(_0x4cef84(0x1f3),[_0x4cef84(0x229),_0x4cef84(0x226)],{'cwd':_0x2343f8,'stdio':_0x4cef84(0x204),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2343f8,_0x4cef84(0x217),_0x4cef84(0x1fb))+delimiter+process.env.PATH}});_0x49a3c9['on']('close',_0x5bcb78=>{if(_0x5bcb78===0x0||_0x5bcb78===null)_0x177915();else _0x56d906(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x5bcb78));}),_0x49a3c9['on'](_0x4cef84(0x209),_0x56d906);});}function spawnVitePreview(_0xcc8f88){return new Promise((_0x105d6b,_0x528420)=>{const _0x4fd40d=a164_0x5cca,_0x2dca3f=spawn(_0x4fd40d(0x1f3),[_0x4fd40d(0x227)],{'cwd':_0xcc8f88,'stdio':_0x4fd40d(0x204),'shell':!![],'env':{...process.env,'PATH':''+join(_0xcc8f88,_0x4fd40d(0x217),_0x4fd40d(0x1fb))+delimiter+process.env.PATH}});_0x2dca3f['on'](_0x4fd40d(0x21d),_0x3a78a4=>{const _0x42b55d=_0x4fd40d;if(_0x3a78a4===0x0||_0x3a78a4===null)_0x105d6b();else _0x528420(new Error(_0x42b55d(0x20a)+_0x3a78a4));}),_0x2dca3f['on'](_0x4fd40d(0x209),_0x528420);});}function a164_0x5cca(_0x19bbb4,_0x4649b1){_0x19bbb4=_0x19bbb4-0x1f0;const _0x12127b=a164_0x1212();let _0x5ccaea=_0x12127b[_0x19bbb4];return _0x5ccaea;}const runFlags=[{'name':a164_0x2715bd(0x22b),'type':a164_0x2715bd(0x1fe),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a164_0x2715bd(0x230),'command':a164_0x2715bd(0x230),'description':a164_0x2715bd(0x224),'risk':a164_0x2715bd(0x22e),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a164_0x2715bd(0x207),'description':a164_0x2715bd(0x1ff),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x5db40d=a164_0x2715bd,_0x3ab513=[];return _0x3ab513[_0x5db40d(0x222)](_0x5db40d(0x205)),_0x3ab513[_0x5db40d(0x222)](_0x5db40d(0x1f7)+CLI_BIN_NAME+'\x20run\x20start'),_0x3ab513[_0x5db40d(0x222)](_0x5db40d(0x1f7)+CLI_BIN_NAME+_0x5db40d(0x21e)),_0x3ab513['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x5db40d(0x225)),_0x3ab513['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x5db40d(0x1f5)),_0x3ab513[_0x5db40d(0x20b)]('\x0a');},async 'execute'(_0x3ba6ae){const _0x431eb8=a164_0x2715bd,_0x2b8a17=process[_0x431eb8(0x202)](),_0x39bbc8=_0x3ba6ae[_0x431eb8(0x221)][0x0],_0x16d09b=_0x3ba6ae[_0x431eb8(0x221)][_0x431eb8(0x20d)](0x1),_0x3626b1=readPackageScripts(_0x2b8a17);if(!_0x3626b1)throw CliErrors[_0x431eb8(0x1fc)](_0x431eb8(0x1fd));if(!_0x39bbc8){const _0x302885=Object[_0x431eb8(0x218)](_0x3626b1);if(_0x302885[_0x431eb8(0x228)]===0x0)console[_0x431eb8(0x1f9)](_0x431eb8(0x21f));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x127016 of _0x302885){console[_0x431eb8(0x1f9)](_0x431eb8(0x1f7)+_0x127016);}console['log'](_0x431eb8(0x22a)+CLI_BIN_NAME+_0x431eb8(0x203));}return{'ok':!![]};}if(!_0x3626b1[_0x39bbc8])throw CliErrors[_0x431eb8(0x1fc)](_0x431eb8(0x1f1)+_0x39bbc8+_0x431eb8(0x213),'Available:\x20'+(Object[_0x431eb8(0x218)](_0x3626b1)[_0x431eb8(0x20b)](',\x20')||'(none)'));const _0x324d7a=detectPackageManager(_0x2b8a17);VERSION_CHECK_SCRIPTS[_0x431eb8(0x206)](_0x39bbc8)&&await versionCheck(_0x2b8a17);if(_0x39bbc8===_0x431eb8(0x227)&&_0x3ba6ae[_0x431eb8(0x201)](_0x431eb8(0x22b)))return await Promise[_0x431eb8(0x200)]([spawnViteBuildWatch(_0x2b8a17),spawnVitePreview(_0x2b8a17)]),{'ok':!![]};return await spawnScript(_0x324d7a,_0x39bbc8,_0x16d09b,_0x2b8a17),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a165_0x45e2(){const _0x251ef8=['1203MicRXw','6JFjDTH','3020SKKgcr','2348BFrKRR','93311DyFcEm','export','50GvFOPc','799371RgROQx','432idoPpU','8393XojbEU','4542wooWra','1608xERxYe','read','json','4174874YYhDNY','151645yNvJZC','schema'];a165_0x45e2=function(){return _0x251ef8;};return a165_0x45e2();}const a165_0xbbc06a=a165_0x20c0;(function(_0x147ed2,_0x44e8ae){const _0x53979e=a165_0x20c0,_0x54b7e7=_0x147ed2();while(!![]){try{const _0x4a38cf=parseInt(_0x53979e(0x92))/0x1*(parseInt(_0x53979e(0x8f))/0x2)+-parseInt(_0x53979e(0x8e))/0x3*(-parseInt(_0x53979e(0x91))/0x4)+parseInt(_0x53979e(0x90))/0x5*(parseInt(_0x53979e(0x98))/0x6)+parseInt(_0x53979e(0x97))/0x7*(-parseInt(_0x53979e(0x99))/0x8)+-parseInt(_0x53979e(0x95))/0x9*(parseInt(_0x53979e(0x94))/0xa)+parseInt(_0x53979e(0x9c))/0xb+parseInt(_0x53979e(0x96))/0xc*(-parseInt(_0x53979e(0x9d))/0xd);if(_0x4a38cf===_0x44e8ae)break;else _0x54b7e7['push'](_0x54b7e7['shift']());}catch(_0x3bd5eb){_0x54b7e7['push'](_0x54b7e7['shift']());}}}(a165_0x45e2,0x3c508));import{buildSchemaPayload}from'../framework/schema-export.js';function a165_0x20c0(_0x2f9197,_0x36e225){_0x2f9197=_0x2f9197-0x8e;const _0x45e23f=a165_0x45e2();let _0x20c065=_0x45e23f[_0x2f9197];return _0x20c065;}async function execute(_0x1b9e2d){const _0x45c9ad=await buildSchemaPayload();return{'ok':!![],'data':_0x45c9ad};}export const schemaDefinition={'service':a165_0xbbc06a(0x9e),'command':a165_0xbbc06a(0x93),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a165_0xbbc06a(0x9a),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a165_0xbbc06a(0x9b),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a166_0x2f9a5d=a166_0x4af8;(function(_0x42b0b1,_0x59c406){const _0x291c15=a166_0x4af8,_0x508d49=_0x42b0b1();while(!![]){try{const _0x20ceee=parseInt(_0x291c15(0x1d7))/0x1+-parseInt(_0x291c15(0x1df))/0x2+parseInt(_0x291c15(0x1eb))/0x3*(parseInt(_0x291c15(0x1dd))/0x4)+-parseInt(_0x291c15(0x1cc))/0x5*(-parseInt(_0x291c15(0x1de))/0x6)+parseInt(_0x291c15(0x1e2))/0x7*(-parseInt(_0x291c15(0x1c5))/0x8)+-parseInt(_0x291c15(0x1c6))/0x9*(parseInt(_0x291c15(0x1d1))/0xa)+parseInt(_0x291c15(0x1ef))/0xb;if(_0x20ceee===_0x59c406)break;else _0x508d49['push'](_0x508d49['shift']());}catch(_0x350aae){_0x508d49['push'](_0x508d49['shift']());}}}(a166_0xce5c,0x3ec03));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';function a166_0xce5c(){const _0x5050e8=['dbId\x20不能为空','137187hUAMLJ','sqlCode','length','stringify','2010305mkaoXI','catch','appCode','lockFilePath','number','Invalid\x20database\x20selection\x20payload:\x20','mybatisXml','✎\x20手动输入\x20dbId','sql','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbId','Local\x20SQL\x20file\x20mode','string','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20必须为正整数','flagMissing','high-risk-write','Target\x20database\x20ID','parse','name','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','new','lastSync','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','sqlRoot','263832cTSFAT','36OEQhxK','utf8','isFinite','sqlRootDir','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','map','25WSMsZI','/smartapi/custom/saveUserCustomSql','toISOString','适合带动态标签的\x20MyBatis\x20XML\x20SQL','sqls','669890quevjM','POST','join','请选择目标数据库:','sqlName','mode','189711ARXvQc','create','trim','请选择本地\x20SQL\x20模式:','dbName','Created\x20SQL\x20query\x20','8fshPfN','121776FrndCm','14884pNuSSS','MyBatis\x20XML(mybatisXml)','isInteger','7dyFwWK','db-id','SQL\x20query\x20display\x20name','普通\x20SQL(sql)','SQL\x20名称不能为空','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','nonInteractive','请输入目标数据库\x20dbId:'];a166_0xce5c=function(){return _0x5050e8;};return a166_0xce5c();}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2885b2){const _0x2c12af=a166_0x4af8;if(_0x2885b2==='mybatisXml')return[_0x2c12af(0x1c0),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x2c12af(0x1d3)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x2c12af(0x1d3)]('\x0a');}export const sqlCreate={'service':a166_0x2f9a5d(0x1b2),'command':a166_0x2f9a5d(0x1d8),'description':a166_0x2f9a5d(0x1e7),'risk':a166_0x2f9a5d(0x1bc),'flags':[{'name':a166_0x2f9a5d(0x1bf),'type':a166_0x2f9a5d(0x1b6),'description':a166_0x2f9a5d(0x1e4)},{'name':a166_0x2f9a5d(0x1e3),'type':a166_0x2f9a5d(0x1ae),'description':a166_0x2f9a5d(0x1bd)},{'name':a166_0x2f9a5d(0x1d6),'type':a166_0x2f9a5d(0x1b6),'enum':[a166_0x2f9a5d(0x1b2),a166_0x2f9a5d(0x1b0)],'description':a166_0x2f9a5d(0x1b5)}],async 'validate'(_0xaffaf8){const _0x55f90a=a166_0x2f9a5d;if(!_0xaffaf8[_0x55f90a(0x1e8)])return;if(!_0xaffaf8['str']('name')[_0x55f90a(0x1d9)]())throw CliErrors[_0x55f90a(0x1bb)](_0x55f90a(0x1bf),_0x55f90a(0x1b9));const _0x4b0294=resolveProvidedDbId(_0xaffaf8);if(typeof _0x4b0294!==_0x55f90a(0x1ae)||!Number[_0x55f90a(0x1c8)](_0x4b0294)||_0x4b0294<=0x0)throw CliErrors['flagMissing'](_0x55f90a(0x1e3),_0x55f90a(0x1ca));if(!_0xaffaf8[_0x55f90a(0x1b7)](_0x55f90a(0x1d6))['trim']())throw CliErrors[_0x55f90a(0x1bb)](_0x55f90a(0x1d6),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x3e4484){const _0xf9549f=a166_0x2f9a5d,_0x7f63db=loadSqlProjectConfig(_0x3e4484[_0xf9549f(0x1f1)]),{sqlName:_0x394d52,dbId:_0x2f9ab8,dbName:_0x4dab4e,mode:_0x3cad3a}=await resolveSqlNewInputs(_0x3e4484),_0xcbf286=buildSqlRelativePath('<server-generated-sqlCode>',_0x394d52,_0x4dab4e,_0x3cad3a,_0x2f9ab8),_0xb2ea99=_0x7f63db[_0xf9549f(0x1c9)]+'/'+_0xcbf286;return{'method':_0xf9549f(0x1d2),'url':_0xf9549f(0x1cd),'body':{'appCode':_0x3e4484['appCode'],'sqlName':_0x394d52,'dbId':_0x2f9ab8,'mode':_0x3cad3a,'localPath':_0xb2ea99},'description':_0xf9549f(0x1b3)+_0x7f63db['sqlRootDir']};},async 'execute'(_0x3b18b8){const _0x34e1ef=a166_0x2f9a5d,_0x4d2ab9=loadSqlProjectConfig(_0x3b18b8['appCode']),{sqlName:_0x34a6a5,dbId:_0x451410,dbName:_0x2b814f,mode:_0x49b21b}=await resolveSqlNewInputs(_0x3b18b8),_0x3d4e71=generateSqlTemplate(_0x49b21b),_0x2ee68d=await createSqlQuery({'appCode':_0x3b18b8[_0x34e1ef(0x1f1)],'sqlName':_0x34a6a5,'dbId':_0x451410,'sqlContent':_0x3d4e71}),_0x29fd60=ensureRemoteSqlContent(_0x2ee68d),_0xfb791b=_0x2b814f||await getDbName(_0x3b18b8[_0x34e1ef(0x1f1)],_0x451410)[_0x34e1ef(0x1f0)](()=>undefined),_0x5cd25b=buildSqlRelativePath(_0x2ee68d[_0x34e1ef(0x1ec)],_0x2ee68d[_0x34e1ef(0x1d5)],_0xfb791b,_0x49b21b,_0x451410),_0x53d85e=_0x4d2ab9[_0x34e1ef(0x1c9)]+'/'+_0x5cd25b,_0x441930=buildLocalSqlFileContent({'sqlCode':_0x2ee68d['sqlCode'],'sqlName':_0x2ee68d['sqlName'],'dbId':_0x2ee68d[_0x34e1ef(0x1b4)]},_0x29fd60,{'dbName':_0xfb791b,'mode':_0x49b21b,'syncedAt':new Date()[_0x34e1ef(0x1ce)](),'description':_0x2ee68d['description']});if(await fileExists(_0x53d85e))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x53d85e);await ensureParentDirectory(_0x53d85e),await writeFile(_0x53d85e,_0x441930,_0x34e1ef(0x1c7));const _0x11d5c5=await readSqlLockFile(_0x4d2ab9[_0x34e1ef(0x1ad)]),{lockData:_0x5bc5b3,appLock:_0x5dbc93}=ensureSqlLockScope(_0x11d5c5??createEmptySqlLock(),_0x4d2ab9[_0x34e1ef(0x1f1)],_0x4d2ab9[_0x34e1ef(0x1c4)],_0x34e1ef(0x1c1));return _0x5dbc93[_0x34e1ef(0x1d0)][_0x2ee68d[_0x34e1ef(0x1ec)]]={...buildSqlLockEntry(_0x2ee68d,_0x29fd60,computeSqlContentHash(_0x441930),{'dbName':_0xfb791b}),'path':_0x5cd25b,'mode':_0x49b21b},_0x5dbc93[_0x34e1ef(0x1c2)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4d2ab9[_0x34e1ef(0x1ad)],_0x5bc5b3),{'ok':!![],'data':{'id':_0x2ee68d['id'],'sqlCode':_0x2ee68d[_0x34e1ef(0x1ec)],'sqlName':_0x2ee68d[_0x34e1ef(0x1d5)],'dbId':_0x2ee68d[_0x34e1ef(0x1b4)],'path':_0x53d85e,'mode':_0x49b21b},'message':_0x34e1ef(0x1dc)+_0x2ee68d[_0x34e1ef(0x1ec)]};}};async function resolveSqlNewInputs(_0x3f4f7b){const _0x1a8910=await resolveSqlNameInput(_0x3f4f7b),{dbId:_0x5510f2,dbName:_0x1eeddf}=await resolveDbSelection(_0x3f4f7b),_0x1aab62=await resolveSqlModeInput(_0x3f4f7b);return{'sqlName':_0x1a8910,'dbId':_0x5510f2,'dbName':_0x1eeddf,'mode':_0x1aab62};}function a166_0x4af8(_0x230288,_0x5d76cc){_0x230288=_0x230288-0x1ad;const _0xce5c5a=a166_0xce5c();let _0x4af862=_0xce5c5a[_0x230288];return _0x4af862;}async function resolveSqlNameInput(_0x92cffd){const _0x56ca18=a166_0x2f9a5d,_0x26f80a=_0x92cffd[_0x56ca18(0x1b7)](_0x56ca18(0x1bf))[_0x56ca18(0x1d9)]();if(_0x26f80a)return _0x26f80a;if(_0x92cffd[_0x56ca18(0x1e8)])throw CliErrors[_0x56ca18(0x1bb)](_0x56ca18(0x1bf),_0x56ca18(0x1b9));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x115d04=>_0x115d04[_0x56ca18(0x1d9)]()?!![]:_0x56ca18(0x1e6)}))['trim']();}async function resolveDbSelection(_0x2a4312){const _0x2b8fc5=a166_0x2f9a5d,_0x3422f8=resolveProvidedDbId(_0x2a4312);if(typeof _0x3422f8==='number'&&Number['isFinite'](_0x3422f8)&&_0x3422f8>0x0)return{'dbId':_0x3422f8,'dbName':await getDbName(_0x2a4312['appCode'],_0x3422f8)[_0x2b8fc5(0x1f0)](()=>undefined)};if(_0x2a4312[_0x2b8fc5(0x1e8)])throw CliErrors[_0x2b8fc5(0x1bb)]('db-id',_0x2b8fc5(0x1ca));const _0x11d18a=await listDatabases(_0x2a4312[_0x2b8fc5(0x1f1)])[_0x2b8fc5(0x1f0)](()=>[]);if(_0x11d18a['length']===0x1)return{'dbId':_0x11d18a[0x0]['dbId'],'dbName':_0x11d18a[0x0]['dbName']};if(_0x11d18a[_0x2b8fc5(0x1ed)]>0x1){const _0x489d99=await select({'message':_0x2b8fc5(0x1d4),'choices':[..._0x11d18a[_0x2b8fc5(0x1cb)](_0x10cc5f=>({'name':_0x10cc5f[_0x2b8fc5(0x1db)]+'\x20('+_0x10cc5f[_0x2b8fc5(0x1b4)]+')','value':serializeDbSelection(_0x10cc5f)})),{'name':_0x2b8fc5(0x1b1),'value':'__manual__'}]});if(_0x489d99!=='__manual__')return deserializeDbSelection(_0x489d99);}const _0x281155=await input({'message':_0x2b8fc5(0x1e9),'validate':_0x3a04ba=>{const _0x5491b5=_0x2b8fc5,_0x2def22=_0x3a04ba[_0x5491b5(0x1d9)]();if(!_0x2def22)return _0x5491b5(0x1ea);const _0x532984=Number(_0x2def22);if(!Number[_0x5491b5(0x1e1)](_0x532984)||_0x532984<=0x0)return _0x5491b5(0x1ba);return!![];}});return{'dbId':Number(_0x281155[_0x2b8fc5(0x1d9)]())};}async function resolveSqlModeInput(_0xbcf81c){const _0x4d8106=a166_0x2f9a5d,_0x1af10e=_0xbcf81c['str'](_0x4d8106(0x1d6))['trim']();if(_0x1af10e===_0x4d8106(0x1b2)||_0x1af10e==='mybatisXml')return _0x1af10e;if(_0xbcf81c['nonInteractive'])throw CliErrors[_0x4d8106(0x1bb)]('mode',_0x4d8106(0x1b8));return await select({'message':_0x4d8106(0x1da),'choices':[{'name':_0x4d8106(0x1e5),'value':_0x4d8106(0x1b2),'description':_0x4d8106(0x1c3)},{'name':_0x4d8106(0x1e0),'value':'mybatisXml','description':_0x4d8106(0x1cf)}]});}function serializeDbSelection(_0x4bbd88){const _0xd90419=a166_0x2f9a5d;return JSON[_0xd90419(0x1ee)]({'dbId':_0x4bbd88[_0xd90419(0x1b4)],'dbName':_0x4bbd88[_0xd90419(0x1db)]});}function deserializeDbSelection(_0xfd6823){const _0xb38fcf=a166_0x2f9a5d;try{const _0x3e523b=JSON[_0xb38fcf(0x1be)](_0xfd6823);if(typeof _0x3e523b[_0xb38fcf(0x1b4)]==='number'&&Number[_0xb38fcf(0x1c8)](_0x3e523b['dbId']))return{'dbId':_0x3e523b[_0xb38fcf(0x1b4)],'dbName':_0x3e523b[_0xb38fcf(0x1db)]};}catch{}throw CliErrors['validation'](_0xb38fcf(0x1af)+_0xfd6823);}function resolveProvidedDbId(_0xa87c12){const _0x47140f=a166_0x2f9a5d,_0x2e496f=_0xa87c12['flag'](_0x47140f(0x1e3));if(typeof _0x2e496f===_0x47140f(0x1ae)&&Number[_0x47140f(0x1c8)](_0x2e496f))return _0x2e496f;return undefined;}
|
|
1
|
+
const a166_0x23d486=a166_0x4105;(function(_0x455a02,_0x446fc8){const _0x36a101=a166_0x4105,_0x3b47ee=_0x455a02();while(!![]){try{const _0x2cc04d=parseInt(_0x36a101(0x1fb))/0x1+-parseInt(_0x36a101(0x1e9))/0x2+-parseInt(_0x36a101(0x1f7))/0x3+parseInt(_0x36a101(0x1fa))/0x4*(parseInt(_0x36a101(0x211))/0x5)+-parseInt(_0x36a101(0x1e7))/0x6+-parseInt(_0x36a101(0x1e1))/0x7+-parseInt(_0x36a101(0x204))/0x8*(-parseInt(_0x36a101(0x1de))/0x9);if(_0x2cc04d===_0x446fc8)break;else _0x3b47ee['push'](_0x3b47ee['shift']());}catch(_0x27f1f0){_0x3b47ee['push'](_0x3b47ee['shift']());}}}(a166_0x2a7e,0x71ab2));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 a166_0x2a7e(){const _0x41ea6a=['--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','trim','SQL\x20query\x20display\x20name','dbName','Invalid\x20database\x20selection\x20payload:\x20','24718743DzdKYm','description','请选择本地\x20SQL\x20模式:','3650780gYqFVl','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','appCode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20不能为空','number','5137662TdDrPT','sqlRoot','1720700rbmHns','mode','validation','catch','str','POST','flag','isFinite','new','SQL\x20名称不能为空','/smartapi/custom/saveUserCustomSql','sql','sqlRootDir','isInteger','2132379LecfPW','flagMissing','</select>','4viZeVs','505557hcEcir','db-id','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','sqls','适合带动态标签的\x20MyBatis\x20XML\x20SQL','lastSync','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','length','MyBatis\x20XML(mybatisXml)','8SdioTY','utf8','__manual__','name','sqlCode','Target\x20database\x20ID','stringify','请输入\x20SQL\x20名称:','\x20\x20SELECT\x201\x20AS\x20id','string','Created\x20SQL\x20query\x20','请输入目标数据库\x20dbId:','lockFilePath','812310OtQQvb','mybatisXml','join','nonInteractive','sqlName','SELECT\x201\x20AS\x20id;','<server-generated-sqlCode>','toISOString','dbId'];a166_0x2a7e=function(){return _0x41ea6a;};return a166_0x2a7e();}function a166_0x4105(_0x12eef2,_0x306d00){_0x12eef2=_0x12eef2-0x1db;const _0x2a7e61=a166_0x2a7e();let _0x410524=_0x2a7e61[_0x12eef2];return _0x410524;}function generateSqlTemplate(_0x48d132){const _0x4d8331=a166_0x4105;if(_0x48d132===_0x4d8331(0x212))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x4d8331(0x20c),_0x4d8331(0x1f9),'']['join']('\x0a');return[_0x4d8331(0x216),''][_0x4d8331(0x213)]('\x0a');}export const sqlCreate={'service':'sql','command':'create','description':a166_0x23d486(0x1e2),'risk':'high-risk-write','flags':[{'name':a166_0x23d486(0x207),'type':a166_0x23d486(0x20d),'description':a166_0x23d486(0x1db)},{'name':a166_0x23d486(0x1fc),'type':a166_0x23d486(0x1e6),'description':a166_0x23d486(0x209)},{'name':a166_0x23d486(0x1ea),'type':a166_0x23d486(0x20d),'enum':[a166_0x23d486(0x1f4),a166_0x23d486(0x212)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x5d9e8d){const _0x13023c=a166_0x23d486;if(!_0x5d9e8d[_0x13023c(0x214)])return;if(!_0x5d9e8d['str'](_0x13023c(0x207))[_0x13023c(0x21b)]())throw CliErrors['flagMissing']('name',_0x13023c(0x201));const _0x27bcee=resolveProvidedDbId(_0x5d9e8d);if(typeof _0x27bcee!=='number'||!Number[_0x13023c(0x1f0)](_0x27bcee)||_0x27bcee<=0x0)throw CliErrors[_0x13023c(0x1f8)](_0x13023c(0x1fc),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x5d9e8d[_0x13023c(0x1ed)](_0x13023c(0x1ea))[_0x13023c(0x21b)]())throw CliErrors[_0x13023c(0x1f8)](_0x13023c(0x1ea),_0x13023c(0x1e4));},async 'dryRun'(_0x40d2bc){const _0x3fc550=a166_0x23d486,_0x171b29=loadSqlProjectConfig(_0x40d2bc[_0x3fc550(0x1e3)]),{sqlName:_0x1790e4,dbId:_0x45bd5f,dbName:_0x2037b6,mode:_0x350728}=await resolveSqlNewInputs(_0x40d2bc),_0x54ae31=buildSqlRelativePath(_0x3fc550(0x217),_0x1790e4,_0x2037b6,_0x350728,_0x45bd5f),_0x1c05a5=_0x171b29[_0x3fc550(0x1f5)]+'/'+_0x54ae31;return{'method':_0x3fc550(0x1ee),'url':_0x3fc550(0x1f3),'body':{'appCode':_0x40d2bc[_0x3fc550(0x1e3)],'sqlName':_0x1790e4,'dbId':_0x45bd5f,'mode':_0x350728,'localPath':_0x1c05a5},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x171b29[_0x3fc550(0x1f5)]};},async 'execute'(_0x41c191){const _0x4a3dff=a166_0x23d486,_0x2e7bac=loadSqlProjectConfig(_0x41c191[_0x4a3dff(0x1e3)]),{sqlName:_0xf571a7,dbId:_0x76761f,dbName:_0x3b5acf,mode:_0x24f56e}=await resolveSqlNewInputs(_0x41c191),_0x1a9d25=generateSqlTemplate(_0x24f56e),_0x4a64ea=await createSqlQuery({'appCode':_0x41c191[_0x4a3dff(0x1e3)],'sqlName':_0xf571a7,'dbId':_0x76761f,'sqlContent':_0x1a9d25}),_0x424d8d=ensureRemoteSqlContent(_0x4a64ea),_0x330ed4=_0x3b5acf||await getDbName(_0x41c191[_0x4a3dff(0x1e3)],_0x76761f)[_0x4a3dff(0x1ec)](()=>undefined),_0x5cf504=buildSqlRelativePath(_0x4a64ea[_0x4a3dff(0x208)],_0x4a64ea['sqlName'],_0x330ed4,_0x24f56e,_0x76761f),_0x1f741e=_0x2e7bac[_0x4a3dff(0x1f5)]+'/'+_0x5cf504,_0x1f4a36=buildLocalSqlFileContent({'sqlCode':_0x4a64ea[_0x4a3dff(0x208)],'sqlName':_0x4a64ea[_0x4a3dff(0x215)],'dbId':_0x4a64ea[_0x4a3dff(0x219)]},_0x424d8d,{'dbName':_0x330ed4,'mode':_0x24f56e,'syncedAt':new Date()[_0x4a3dff(0x218)](),'description':_0x4a64ea[_0x4a3dff(0x1df)]});if(await fileExists(_0x1f741e))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x1f741e);await ensureParentDirectory(_0x1f741e),await writeFile(_0x1f741e,_0x1f4a36,_0x4a3dff(0x205));const _0x1ad186=await readSqlLockFile(_0x2e7bac['lockFilePath']),{lockData:_0x580d22,appLock:_0x126099}=ensureSqlLockScope(_0x1ad186??createEmptySqlLock(),_0x2e7bac[_0x4a3dff(0x1e3)],_0x2e7bac[_0x4a3dff(0x1e8)],_0x4a3dff(0x1f1));return _0x126099[_0x4a3dff(0x1fe)][_0x4a64ea['sqlCode']]={...buildSqlLockEntry(_0x4a64ea,_0x424d8d,computeSqlContentHash(_0x1f4a36),{'dbName':_0x330ed4}),'path':_0x5cf504,'mode':_0x24f56e},_0x126099[_0x4a3dff(0x200)]=new Date()[_0x4a3dff(0x218)](),await writeSqlLockFile(_0x2e7bac[_0x4a3dff(0x210)],_0x580d22),{'ok':!![],'data':{'id':_0x4a64ea['id'],'sqlCode':_0x4a64ea[_0x4a3dff(0x208)],'sqlName':_0x4a64ea['sqlName'],'dbId':_0x4a64ea['dbId'],'path':_0x1f741e,'mode':_0x24f56e},'message':_0x4a3dff(0x20e)+_0x4a64ea[_0x4a3dff(0x208)]};}};async function resolveSqlNewInputs(_0x4645c2){const _0x57f053=await resolveSqlNameInput(_0x4645c2),{dbId:_0xf4f642,dbName:_0x36f70f}=await resolveDbSelection(_0x4645c2),_0x16a97a=await resolveSqlModeInput(_0x4645c2);return{'sqlName':_0x57f053,'dbId':_0xf4f642,'dbName':_0x36f70f,'mode':_0x16a97a};}async function resolveSqlNameInput(_0x436ab0){const _0x4908c8=a166_0x23d486,_0x2fdda1=_0x436ab0[_0x4908c8(0x1ed)](_0x4908c8(0x207))[_0x4908c8(0x21b)]();if(_0x2fdda1)return _0x2fdda1;if(_0x436ab0['nonInteractive'])throw CliErrors[_0x4908c8(0x1f8)]('name',_0x4908c8(0x201));return(await input({'message':_0x4908c8(0x20b),'validate':_0x3d97a0=>_0x3d97a0[_0x4908c8(0x21b)]()?!![]:_0x4908c8(0x1f2)}))[_0x4908c8(0x21b)]();}async function resolveDbSelection(_0xb01376){const _0x52c07c=a166_0x23d486,_0x247bc7=resolveProvidedDbId(_0xb01376);if(typeof _0x247bc7===_0x52c07c(0x1e6)&&Number[_0x52c07c(0x1f0)](_0x247bc7)&&_0x247bc7>0x0)return{'dbId':_0x247bc7,'dbName':await getDbName(_0xb01376[_0x52c07c(0x1e3)],_0x247bc7)[_0x52c07c(0x1ec)](()=>undefined)};if(_0xb01376['nonInteractive'])throw CliErrors[_0x52c07c(0x1f8)](_0x52c07c(0x1fc),_0x52c07c(0x21a));const _0x499f2e=await listDatabases(_0xb01376[_0x52c07c(0x1e3)])[_0x52c07c(0x1ec)](()=>[]);if(_0x499f2e[_0x52c07c(0x202)]===0x1)return{'dbId':_0x499f2e[0x0][_0x52c07c(0x219)],'dbName':_0x499f2e[0x0][_0x52c07c(0x1dc)]};if(_0x499f2e['length']>0x1){const _0x4c5a28=await select({'message':'请选择目标数据库:','choices':[..._0x499f2e['map'](_0x43f96e=>({'name':_0x43f96e[_0x52c07c(0x1dc)]+'\x20('+_0x43f96e['dbId']+')','value':serializeDbSelection(_0x43f96e)})),{'name':'✎\x20手动输入\x20dbId','value':_0x52c07c(0x206)}]});if(_0x4c5a28!==_0x52c07c(0x206))return deserializeDbSelection(_0x4c5a28);}const _0x21f16=await input({'message':_0x52c07c(0x20f),'validate':_0x2cd028=>{const _0xfa328a=_0x52c07c,_0x3e5036=_0x2cd028[_0xfa328a(0x21b)]();if(!_0x3e5036)return _0xfa328a(0x1e5);const _0x17f03b=Number(_0x3e5036);if(!Number[_0xfa328a(0x1f6)](_0x17f03b)||_0x17f03b<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x21f16['trim']())};}async function resolveSqlModeInput(_0x5e0675){const _0x487899=a166_0x23d486,_0x339961=_0x5e0675[_0x487899(0x1ed)](_0x487899(0x1ea))[_0x487899(0x21b)]();if(_0x339961===_0x487899(0x1f4)||_0x339961===_0x487899(0x212))return _0x339961;if(_0x5e0675[_0x487899(0x214)])throw CliErrors[_0x487899(0x1f8)](_0x487899(0x1ea),_0x487899(0x1e4));return await select({'message':_0x487899(0x1e0),'choices':[{'name':'普通\x20SQL(sql)','value':_0x487899(0x1f4),'description':_0x487899(0x1fd)},{'name':_0x487899(0x203),'value':_0x487899(0x212),'description':_0x487899(0x1ff)}]});}function serializeDbSelection(_0x338b74){const _0x5266a0=a166_0x23d486;return JSON[_0x5266a0(0x20a)]({'dbId':_0x338b74['dbId'],'dbName':_0x338b74[_0x5266a0(0x1dc)]});}function deserializeDbSelection(_0x21d40e){const _0xfceb8b=a166_0x23d486;try{const _0x2a2917=JSON['parse'](_0x21d40e);if(typeof _0x2a2917[_0xfceb8b(0x219)]===_0xfceb8b(0x1e6)&&Number[_0xfceb8b(0x1f0)](_0x2a2917[_0xfceb8b(0x219)]))return{'dbId':_0x2a2917[_0xfceb8b(0x219)],'dbName':_0x2a2917[_0xfceb8b(0x1dc)]};}catch{}throw CliErrors[_0xfceb8b(0x1eb)](_0xfceb8b(0x1dd)+_0x21d40e);}function resolveProvidedDbId(_0x2936ee){const _0x26ee34=a166_0x23d486,_0x50e43f=_0x2936ee[_0x26ee34(0x1ef)](_0x26ee34(0x1fc));if(typeof _0x50e43f===_0x26ee34(0x1e6)&&Number[_0x26ee34(0x1f0)](_0x50e43f))return _0x50e43f;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x801513=a167_0x4d95;(function(_0x3e5658,_0x5f2833){const _0x48d966=a167_0x4d95,_0x27e398=_0x3e5658();while(!![]){try{const _0x141263=parseInt(_0x48d966(0xe6))/0x1*(-parseInt(_0x48d966(0xf6))/0x2)+parseInt(_0x48d966(0xee))/0x3+-parseInt(_0x48d966(0x107))/0x4*(-parseInt(_0x48d966(0xe7))/0x5)+parseInt(_0x48d966(0xf2))/0x6+-parseInt(_0x48d966(0x109))/0x7+parseInt(_0x48d966(0xfe))/0x8+parseInt(_0x48d966(0x108))/0x9*(-parseInt(_0x48d966(0xfb))/0xa);if(_0x141263===_0x5f2833)break;else _0x27e398['push'](_0x27e398['shift']());}catch(_0x3ba193){_0x27e398['push'](_0x27e398['shift']());}}}(a167_0x5197,0x7e3b7));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';import{CliErrors}from'../../errors.js';function a167_0x4d95(_0x5e9862,_0x25dcc9){_0x5e9862=_0x5e9862-0xe6;const _0x519744=a167_0x5197();let _0x4d951e=_0x519744[_0x5e9862];return _0x4d951e;}function a167_0x5197(){const _0x13345e=['validation','filter','49147gQpmxm','5735ATLvFG','lastSync','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','lockFilePath','remoteId','/smartapi/custom/deleteUserCustomSql','trashedTo','2478471RVKBdM','delete','length','appCode','1919484ClbLLE','startsWith','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','sqlRootDir','20yLuuQz','trashDir','sqlRoot','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','high-risk-write','429810fqejqP','replace','str','1705912aPvQBS','sqlcode','Deleted\x20','sqls','Would\x20delete\x20SQL\x20','\x20(local\x20file\x20moved\x20to\x20trash)','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','entries','toISOString','420xmHddJ','27mRlmqn','2395995cXuhLQ','sql'];a167_0x5197=function(){return _0x13345e;};return a167_0x5197();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a167_0x801513(0x10a),'command':a167_0x801513(0xef),'description':a167_0x801513(0xf4),'risk':a167_0x801513(0xfa),'flags':[SQLCODE_FLAG],async 'validate'(_0x234353){const _0x39c108=a167_0x801513,_0x408a10=loadSqlProjectConfig(_0x234353[_0x39c108(0xf1)]),_0x369cac=await readSqlLockFile(_0x408a10[_0x39c108(0xea)]);if(!_0x369cac)throw CliErrors[_0x39c108(0x10b)](_0x39c108(0xf9));},async 'dryRun'(_0x352338){const _0x1ef42d=a167_0x801513,_0x243090=loadSqlProjectConfig(_0x352338[_0x1ef42d(0xf1)]),_0x429154=await readSqlLockFile(_0x243090[_0x1ef42d(0xea)]);if(!_0x429154)throw CliErrors[_0x1ef42d(0x10b)](_0x1ef42d(0xf9));const {appLock:_0x330c7e}=ensureSqlLockScope(_0x429154,_0x352338[_0x1ef42d(0xf1)],_0x243090['sqlRoot'],_0x1ef42d(0xef)),_0x3e0ac5=_0x352338['str'](_0x1ef42d(0xff)),_0x1b02f9=_0x330c7e[_0x1ef42d(0x101)][_0x3e0ac5];if(!_0x1b02f9)throw CliErrors[_0x1ef42d(0x10b)](_0x1ef42d(0xe9)+_0x3e0ac5+'\x22.');return{'method':'POST','url':_0x1ef42d(0xec),'body':{'sqlCode':_0x3e0ac5,'id':_0x1b02f9['remoteId'],'localPath':resolveLocalSqlFilePath(_0x243090,_0x3e0ac5,_0x1b02f9)},'description':_0x1ef42d(0x102)+_0x3e0ac5+_0x1ef42d(0x104)+_0x243090[_0x1ef42d(0xf7)]};},async 'execute'(_0xbdaac5){const _0x10c524=a167_0x801513,_0x316deb=loadSqlProjectConfig(_0xbdaac5[_0x10c524(0xf1)]),_0x717c6a=await readSqlLockFile(_0x316deb[_0x10c524(0xea)]);if(!_0x717c6a)throw CliErrors[_0x10c524(0x10b)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x5b6518,appLock:_0x2560f8}=ensureSqlLockScope(_0x717c6a,_0xbdaac5[_0x10c524(0xf1)],_0x316deb[_0x10c524(0xf8)],'delete'),_0x136af5=_0xbdaac5[_0x10c524(0xfd)](_0x10c524(0xff)),_0x12ae4b=_0x2560f8[_0x10c524(0x101)][_0x136af5];if(!_0x12ae4b)throw CliErrors[_0x10c524(0x10b)](_0x10c524(0xe9)+_0x136af5+'\x22.');await deleteSqlQuery({'id':_0x12ae4b['remoteId'],'sqlCode':_0x136af5}),_0x2560f8[_0x10c524(0x101)]=Object['fromEntries'](Object[_0x10c524(0x105)](_0x2560f8[_0x10c524(0x101)])[_0x10c524(0x10c)](([_0x6253fb])=>_0x6253fb!==_0x136af5)),_0x2560f8[_0x10c524(0xe8)]=new Date()[_0x10c524(0x106)](),await writeSqlLockFile(_0x316deb['lockFilePath'],_0x5b6518);const _0x35499f=resolveLocalSqlFilePath(_0x316deb,_0x136af5,_0x12ae4b);let _0x56b1e3;await fileExists(_0x35499f)&&(_0x56b1e3=await moveToTrash(_0x316deb['projectRoot'],_0x316deb['trashDir'],_0x35499f),await cleanupEmptyDirectories(dirname(_0x35499f),_0x316deb[_0x10c524(0xf5)]));const _0x105600={'deleted':_0x136af5,'remoteId':_0x12ae4b[_0x10c524(0xeb)]};if(_0x56b1e3)_0x105600[_0x10c524(0xed)]=_0x56b1e3;return{'ok':!![],'data':_0x105600,'message':_0x10c524(0x100)+_0x136af5+(_0x56b1e3?_0x10c524(0x103):'')};}};async function moveToTrash(_0x118b2a,_0x170311,_0x39d054){const _0x58213c=a167_0x801513,_0x163fb2=new Date()['toISOString']()[_0x58213c(0xfc)](/[:.]/g,'-'),_0x2b2ec7=relative(_0x118b2a,_0x39d054),_0x3d8ec8=join(_0x170311,_0x163fb2,_0x2b2ec7);return await mkdir(dirname(_0x3d8ec8),{'recursive':!![]}),await rename(_0x39d054,_0x3d8ec8),_0x3d8ec8;}async function cleanupEmptyDirectories(_0x20cb50,_0x40fc5d){const _0x3dfaab=a167_0x801513;let _0x305f99=resolve(_0x20cb50);const _0x1728f6=resolve(_0x40fc5d);while(_0x305f99[_0x3dfaab(0xf3)](''+_0x1728f6+sep)||_0x305f99===_0x1728f6){if(_0x305f99===_0x1728f6)return;try{const _0x406b51=await readdir(_0x305f99);if(_0x406b51[_0x3dfaab(0xf0)]>0x0)return;await rmdir(_0x305f99);}catch{return;}_0x305f99=dirname(_0x305f99);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a168_0x30d188=a168_0x5581;(function(_0x2d6bd6,_0x2f119b){const _0x5e38a6=a168_0x5581,_0x199a83=_0x2d6bd6();while(!![]){try{const _0x16ef54=-parseInt(_0x5e38a6(0xdf))/0x1+parseInt(_0x5e38a6(0xda))/0x2+-parseInt(_0x5e38a6(0xe7))/0x3*(-parseInt(_0x5e38a6(0xdb))/0x4)+parseInt(_0x5e38a6(0xe2))/0x5*(-parseInt(_0x5e38a6(0xe1))/0x6)+parseInt(_0x5e38a6(0xe8))/0x7+-parseInt(_0x5e38a6(0xdd))/0x8*(-parseInt(_0x5e38a6(0xeb))/0x9)+parseInt(_0x5e38a6(0xd8))/0xa*(-parseInt(_0x5e38a6(0xd9))/0xb);if(_0x16ef54===_0x2f119b)break;else _0x199a83['push'](_0x199a83['shift']());}catch(_0x1bc8eb){_0x199a83['push'](_0x199a83['shift']());}}}(a168_0xdcb6,0x791e0));import{getSqlQueryInfo}from'../../core/api-client.js';function a168_0xdcb6(){const _0x4a0cfc=['1731576HmEDDW','1889824uflEYF','sqlName','8VfcrVT','dbId','808302IEMUHB','sql','5298mjUpTn','1465AgXEvL','appCode','detail','verbose','description','3wLMHpF','4097534ENeDgv','read','sqlcode','4927428vQSWKN','boolean','Return\x20full\x20raw\x20SQL\x20query\x20object','str','bool','10aChbGo','9987791RYnkND'];a168_0xdcb6=function(){return _0x4a0cfc;};return a168_0xdcb6();}function a168_0x5581(_0x5bab25,_0x30b703){_0x5bab25=_0x5bab25-0xd8;const _0xdcb68a=a168_0xdcb6();let _0x55816b=_0xdcb68a[_0x5bab25];return _0x55816b;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a168_0x30d188(0xe0),'command':a168_0x30d188(0xe4),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a168_0x30d188(0xe9),'flags':[SQLCODE_FLAG,{'name':a168_0x30d188(0xe5),'type':a168_0x30d188(0xec),'description':a168_0x30d188(0xed)}],async 'execute'(_0xebeef2){const _0x31b37f=a168_0x30d188,_0x4081d3=await getSqlQueryInfo(_0xebeef2['appCode'],_0xebeef2[_0x31b37f(0xee)](_0x31b37f(0xea))),_0x57a348=_0xebeef2[_0x31b37f(0xef)](_0x31b37f(0xe5));if(_0x57a348)return{'ok':!![],'data':_0x4081d3};const _0x19c1a8=_0x4081d3[_0x31b37f(0xde)]?await getDbName(_0xebeef2[_0x31b37f(0xe3)],_0x4081d3[_0x31b37f(0xde)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4081d3['sqlCode'],'sqlName':_0x4081d3[_0x31b37f(0xdc)],'db':_0x19c1a8?_0x19c1a8+'\x20('+_0x4081d3[_0x31b37f(0xde)]+')':_0x4081d3[_0x31b37f(0xde)]??'','description':_0x4081d3[_0x31b37f(0xe6)]??'','sqlContent':_0x4081d3['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a169_0x1985(){const _0x406446=['execSuccess','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','3088jUSAcn','length','exec','sql','read','\x20row(s)\x20in\x20','36268erChYQ','750520Sfjpvj','270380quLsFS','4878wbvVxm','27369324glTref','6009vtgowO','341zvhKJO','350CwuqqU','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','SQL\x20execution\x20failed','isArray','Returned\x20','13UaXKTm','6531kRXjKa','params','598xiJFeP','execResult','19548vyhrXo','str','appCode','string','now'];a169_0x1985=function(){return _0x406446;};return a169_0x1985();}const a169_0x1f99a5=a169_0x4aa3;(function(_0x3457e1,_0x40dcc5){const _0x11c561=a169_0x4aa3,_0x35d7c9=_0x3457e1();while(!![]){try{const _0x30046e=parseInt(_0x11c561(0xcd))/0x1+parseInt(_0x11c561(0xdb))/0x2*(parseInt(_0x11c561(0xd1))/0x3)+-parseInt(_0x11c561(0xcc))/0x4*(-parseInt(_0x11c561(0xd3))/0x5)+parseInt(_0x11c561(0xcf))/0x6*(parseInt(_0x11c561(0xd9))/0x7)+parseInt(_0x11c561(0xc6))/0x8*(parseInt(_0x11c561(0xdd))/0x9)+parseInt(_0x11c561(0xce))/0xa*(-parseInt(_0x11c561(0xd2))/0xb)+-parseInt(_0x11c561(0xd0))/0xc*(parseInt(_0x11c561(0xd8))/0xd);if(_0x30046e===_0x40dcc5)break;else _0x35d7c9['push'](_0x35d7c9['shift']());}catch(_0x44abf1){_0x35d7c9['push'](_0x35d7c9['shift']());}}}(a169_0x1985,0x70cf9));function a169_0x4aa3(_0x5081f0,_0x2e8e7d){_0x5081f0=_0x5081f0-0xc5;const _0x198531=a169_0x1985();let _0x4aa3b2=_0x198531[_0x5081f0];return _0x4aa3b2;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a169_0x1f99a5(0xc9),'command':a169_0x1f99a5(0xc8),'description':a169_0x1f99a5(0xc5),'risk':a169_0x1f99a5(0xca),'flags':[SQLCODE_FLAG,{'name':a169_0x1f99a5(0xda),'type':a169_0x1f99a5(0xe0),'description':a169_0x1f99a5(0xd4)}],async 'execute'(_0x592edf){const _0x18a131=a169_0x1f99a5,_0x4e0b00=parseJsonParams(_0x592edf[_0x18a131(0xde)](_0x18a131(0xda))),_0x3e1a4d=Date[_0x18a131(0xe1)](),_0x591398=await executeSql(_0x592edf[_0x18a131(0xdf)],_0x592edf['str']('sqlcode'),_0x4e0b00),_0x4fce69=Date[_0x18a131(0xe1)]()-_0x3e1a4d,_0x541ab0=_0x591398?.[_0x18a131(0xdc)]??_0x591398,_0x5e07e4=_0x591398?.[_0x18a131(0xe2)]??!![];if(!_0x5e07e4)return{'ok':![],'data':{'error':_0x591398?.['execError']||_0x18a131(0xd5),'elapsed':_0x4fce69},'message':'SQL\x20execution\x20failed'};const _0x1e13d4=Array[_0x18a131(0xd6)](_0x541ab0)?_0x541ab0:[];return{'ok':!![],'data':{'rows':_0x1e13d4,'rowCount':_0x1e13d4[_0x18a131(0xc7)],'elapsed':_0x4fce69},'message':_0x18a131(0xd7)+_0x1e13d4['length']+_0x18a131(0xcb)+_0x4fce69+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x54f464,_0x1c2285){const _0x2c49d7=a170_0x17dc,_0x250861=_0x54f464();while(!![]){try{const _0x550f6e=-parseInt(_0x2c49d7(0x15e))/0x1+-parseInt(_0x2c49d7(0x15d))/0x2*(-parseInt(_0x2c49d7(0x157))/0x3)+parseInt(_0x2c49d7(0x15f))/0x4+parseInt(_0x2c49d7(0x15c))/0x5+parseInt(_0x2c49d7(0x160))/0x6+parseInt(_0x2c49d7(0x158))/0x7*(parseInt(_0x2c49d7(0x15b))/0x8)+parseInt(_0x2c49d7(0x15a))/0x9*(-parseInt(_0x2c49d7(0x159))/0xa);if(_0x550f6e===_0x1c2285)break;else _0x250861['push'](_0x250861['shift']());}catch(_0x485045){_0x250861['push'](_0x250861['shift']());}}}(a170_0x4647,0x1e130));import{sqlList}from'../../commands/sql/list.js';function a170_0x4647(){const _0x1a2735=['1173440cIkved','180cGHfZJ','113236JwbWYP','415436XgUiiq','617370vFKFYO','6687BPRtfC','28SfkgEL','1360pQkflj','27558RGqNFN','21600EucQXR'];a170_0x4647=function(){return _0x1a2735;};return a170_0x4647();}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a170_0x17dc(_0x491f47,_0x443a96){_0x491f47=_0x491f47-0x157;const _0x4647a7=a170_0x4647();let _0x17dcff=_0x4647a7[_0x491f47];return _0x17dcff;}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a171_0x1ecb17=a171_0x1856;(function(_0x2d0eb2,_0x711ce8){const _0x23dc96=a171_0x1856,_0xd997bc=_0x2d0eb2();while(!![]){try{const _0x138f72=parseInt(_0x23dc96(0x1cb))/0x1*(-parseInt(_0x23dc96(0x1c2))/0x2)+-parseInt(_0x23dc96(0x1be))/0x3*(-parseInt(_0x23dc96(0x1b5))/0x4)+parseInt(_0x23dc96(0x1c4))/0x5*(parseInt(_0x23dc96(0x1cd))/0x6)+parseInt(_0x23dc96(0x1ab))/0x7*(-parseInt(_0x23dc96(0x1b2))/0x8)+parseInt(_0x23dc96(0x1bf))/0x9+-parseInt(_0x23dc96(0x1c0))/0xa+-parseInt(_0x23dc96(0x1c9))/0xb*(-parseInt(_0x23dc96(0x1b3))/0xc);if(_0x138f72===_0x711ce8)break;else _0xd997bc['push'](_0xd997bc['shift']());}catch(_0x1cb192){_0xd997bc['push'](_0xd997bc['shift']());}}}(a171_0x3af6,0xd7abe));import{listSqlQueries}from'../../core/api-client.js';function a171_0x1856(_0x4995af,_0x1a7c2d){_0x4995af=_0x4995af-0x1aa;const _0x3af6d1=a171_0x3af6();let _0x185638=_0x3af6d1[_0x4995af];return _0x185638;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a171_0x3af6(){const _0x1a4ee1=['page','description','Page\x20size','str','number','list','30kgCDBu','11808522DDTSSo','13988910UobaCV','pagesize','204778jmxEDM','Page\x20number','5yjPSgo','totalCount','dbId','paging','string','141988NjLzaq','bool','11FxtboA','read','346044xVITzc','appCode','77266VmeFBe','No\x20custom\x20SQL\x20queries\x20found.','sqlCode','num','length','Found\x20','sql','872MUKuMH','2520ilKyNW','Filter\x20by\x20SQL\x20name','212516YFRibr','tableData','name'];a171_0x3af6=function(){return _0x1a4ee1;};return a171_0x3af6();}export const sqlList={'service':a171_0x1ecb17(0x1b1),'command':a171_0x1ecb17(0x1bd),'description':'List\x20custom\x20SQL\x20queries','risk':a171_0x1ecb17(0x1cc),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a171_0x1ecb17(0x1c8),'description':a171_0x1ecb17(0x1b4)},{'name':a171_0x1ecb17(0x1b8),'type':a171_0x1ecb17(0x1bc),'description':a171_0x1ecb17(0x1c3),'default':0x1},{'name':a171_0x1ecb17(0x1c1),'type':a171_0x1ecb17(0x1bc),'description':a171_0x1ecb17(0x1ba)},{'name':'verbose','type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x4fb41c){const _0x1d0186=a171_0x1ecb17,_0x445f13=await listSqlQueries(_0x4fb41c[_0x1d0186(0x1aa)],{'sqlCode':_0x4fb41c[_0x1d0186(0x1bb)]('sqlcode')||undefined,'sqlName':_0x4fb41c['str'](_0x1d0186(0x1b7))||undefined,'currentPage':_0x4fb41c['num']('page'),'pageSize':_0x4fb41c[_0x1d0186(0x1ae)](_0x1d0186(0x1c1),0x32)}),_0x2bdd81=_0x4fb41c[_0x1d0186(0x1ca)]('verbose'),_0x1e0862=_0x445f13[_0x1d0186(0x1b6)]??[],_0x3806e4=_0x445f13[_0x1d0186(0x1c7)]?.[_0x1d0186(0x1c5)]??_0x1e0862[_0x1d0186(0x1af)];let _0x4e4a59;return _0x2bdd81?_0x4e4a59=_0x1e0862:_0x4e4a59=await Promise['all'](_0x1e0862['map'](async _0x432aea=>{const _0x443d99=_0x1d0186;let _0x59e296;try{_0x59e296=_0x432aea[_0x443d99(0x1c6)]?await getDbName(_0x4fb41c[_0x443d99(0x1aa)],_0x432aea[_0x443d99(0x1c6)]):undefined;}catch{}return{'sqlCode':_0x432aea[_0x443d99(0x1ad)],'sqlName':_0x432aea['sqlName'],'description':_0x432aea[_0x443d99(0x1b9)]??'','db':_0x59e296?_0x59e296+'\x20('+_0x432aea[_0x443d99(0x1c6)]+')':_0x432aea['dbId']??''};})),{'ok':!![],'data':_0x4e4a59,'message':_0x1e0862['length']===0x0?_0x1d0186(0x1ac):_0x1d0186(0x1b0)+_0x1e0862[_0x1d0186(0x1af)]+'\x20SQL\x20queries\x20(total:\x20'+_0x3806e4+').'};}};
|