@lovrabet/rabetbase-cli 2.5.0-beta.1 → 2.5.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase/references/rabetbase-config.md +1 -1
- package/skills/rabetbase/references/rabetbase-dataset-business-group-update.md +17 -6
- package/skills/rabetbase/references/rabetbase-kb.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a173_0x2dbc70=a173_0x4060;(function(_0x3f5353,_0x1eda5e){const _0x33d9cc=a173_0x4060,_0x2b017c=_0x3f5353();while(!![]){try{const _0x396661=parseInt(_0x33d9cc(0xe6))/0x1*(parseInt(_0x33d9cc(0xe2))/0x2)+-parseInt(_0x33d9cc(0xe8))/0x3*(parseInt(_0x33d9cc(0xef))/0x4)+-parseInt(_0x33d9cc(0xf1))/0x5*(-parseInt(_0x33d9cc(0xe9))/0x6)+-parseInt(_0x33d9cc(0xdd))/0x7*(parseInt(_0x33d9cc(0xed))/0x8)+parseInt(_0x33d9cc(0xe7))/0x9*(parseInt(_0x33d9cc(0xda))/0xa)+-parseInt(_0x33d9cc(0xec))/0xb+parseInt(_0x33d9cc(0xdc))/0xc*(parseInt(_0x33d9cc(0xe1))/0xd);if(_0x396661===_0x1eda5e)break;else _0x2b017c['push'](_0x2b017c['shift']());}catch(_0x464ca7){_0x2b017c['push'](_0x2b017c['shift']());}}}(a173_0x5e41,0xf3a44));import{deleteAppRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';const DELETE_PATH='/smartapi/permit/role/delete';function a173_0x4060(_0x5992bf,_0x5d7794){_0x5992bf=_0x5992bf-0xda;const _0x5e411c=a173_0x5e41();let _0x40608b=_0x5e411c[_0x5992bf];return _0x40608b;}export const roleDelete={'service':a173_0x2dbc70(0xe4),'command':a173_0x2dbc70(0xf0),'description':a173_0x2dbc70(0xdf),'risk':a173_0x2dbc70(0xee),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x269f94){const _0x2bf7e8=a173_0x2dbc70,_0x55e2b9=_0x269f94[_0x2bf7e8(0xea)]('id'),_0xdbf076=await getRoleById(_0x269f94[_0x2bf7e8(0xe5)],_0x55e2b9);return assertCustomRole(_0xdbf076,_0x2bf7e8(0xf0)),asDryRunResult({'scope':_0x2bf7e8(0xe3),'operation':'delete','selector':{'appCode':_0x269f94[_0x2bf7e8(0xe5)],'roleId':_0x55e2b9,'roleName':_0xdbf076[_0x2bf7e8(0xf2)]},'before':projectRole(_0xdbf076),'after':null,'dryRun':!![],'backend':{'method':_0x2bf7e8(0xde),'path':DELETE_PATH},'warnings':_0xdbf076[_0x2bf7e8(0xe0)]>0x0?['Role\x20still\x20has\x20'+_0xdbf076[_0x2bf7e8(0xe0)]+_0x2bf7e8(0xeb)]:[]},{'method':_0x2bf7e8(0xde),'url':DELETE_PATH});},async 'execute'(_0x49a88c){const _0x254e9e=a173_0x2dbc70,_0x72295c=_0x49a88c[_0x254e9e(0xea)]('id'),_0x5737f3=await getRoleById(_0x49a88c['appCode'],_0x72295c);return assertCustomRole(_0x5737f3,_0x254e9e(0xf0)),await deleteAppRole(_0x72295c),{'ok':!![],'data':{'scope':'dev','operation':_0x254e9e(0xf0),'selector':{'appCode':_0x49a88c[_0x254e9e(0xe5)],'roleId':_0x72295c,'roleName':_0x5737f3['roleName']},'before':projectRole(_0x5737f3),'after':null,'dryRun':![],'backend':{'method':'POST','path':DELETE_PATH},'warnings':[]},'message':'Deleted\x20role\x20'+_0x5737f3[_0x254e9e(0xf2)]+_0x254e9e(0xdb)+_0x72295c+')'};}};function a173_0x5e41(){const _0x5821a4=['high-risk-write','4JpkbJF','delete','5YXpZfk','roleName','10683670ikYZLC','\x20(id=','56244ymGWgW','322aEmwMp','POST','Delete\x20a\x20CUSTOM\x20role\x20(built-in\x20roles\x20rejected);\x20requires\x20--yes','userCount','4043RVBCVd','23810oHWaqF','dev','role','appCode','97wbFJob','9eUGdhW','1106268IFkljf','1964154DYEzOU','num','\x20member(s);\x20they\x20will\x20lose\x20this\x20group.','7431094RxXvLQ','341896HXUiME'];a173_0x5e41=function(){return _0x5821a4;};return a173_0x5e41();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a174_0x5e1716=a174_0x59bb;(function(_0x5801c8,_0x596c8f){const _0x38b82b=a174_0x59bb,_0x2e35ce=_0x5801c8();while(!![]){try{const _0x1b9cde=parseInt(_0x38b82b(0xea))/0x1+-parseInt(_0x38b82b(0xef))/0x2*(parseInt(_0x38b82b(0xe3))/0x3)+-parseInt(_0x38b82b(0xe8))/0x4+parseInt(_0x38b82b(0xf5))/0x5*(parseInt(_0x38b82b(0xe4))/0x6)+parseInt(_0x38b82b(0xe9))/0x7+-parseInt(_0x38b82b(0xf2))/0x8*(-parseInt(_0x38b82b(0xec))/0x9)+-parseInt(_0x38b82b(0xe5))/0xa;if(_0x1b9cde===_0x596c8f)break;else _0x2e35ce['push'](_0x2e35ce['shift']());}catch(_0x3454ab){_0x2e35ce['push'](_0x2e35ce['shift']());}}}(a174_0x28e8,0xb0c42));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a174_0x59bb(_0x550c4e,_0x4b881e){_0x550c4e=_0x550c4e-0xe2;const _0x28e82=a174_0x28e8();let _0x59bb20=_0x28e82[_0x550c4e];return _0x59bb20;}import{getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';function a174_0x28e8(){const _0x5933b1=['roleType','33926SbkWNO','detail','dev','24EAMpxU','Role\x20','num','432455CjsWUs','appCode','177PufJBP','78dazgdb','4071920JhosGG','roleName','Show\x20a\x20single\x20role\x27s\x20detail','4222720GPAFWn','2459471RQdlSc','599824LnqrmO','role','3336489tyUddl','read'];a174_0x28e8=function(){return _0x5933b1;};return a174_0x28e8();}export const roleDetail={'service':a174_0x5e1716(0xeb),'command':a174_0x5e1716(0xf0),'description':a174_0x5e1716(0xe7),'risk':a174_0x5e1716(0xed),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x2f85e4){const _0x218e2e=a174_0x5e1716,_0x8cd7b7=_0x2f85e4[_0x218e2e(0xf4)]('id'),_0x150545=await getRoleById(_0x2f85e4[_0x218e2e(0xe2)],_0x8cd7b7);return{'ok':!![],'data':{'scope':_0x218e2e(0xf1),'role':projectRole(_0x150545)},'message':_0x218e2e(0xf3)+_0x150545[_0x218e2e(0xe6)]+'\x20('+_0x150545[_0x218e2e(0xee)]+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a175_0x572f(){const _0xc3ae61=['754026Fbcnpx','1557fLDIFe','885276KqALdY','39594PvCLLB','150rUuEgB','2NGrRHt','183053GfwOZD','703680nuGMWQ','15367ZtORNV','13584nTPkAO','5880WciqlP'];a175_0x572f=function(){return _0xc3ae61;};return a175_0x572f();}(function(_0x1bb762,_0x5dc779){const _0x245b55=a175_0x5016,_0x573d6f=_0x1bb762();while(!![]){try{const _0x43ce19=-parseInt(_0x245b55(0x156))/0x1*(-parseInt(_0x245b55(0x155))/0x2)+parseInt(_0x245b55(0x150))/0x3+parseInt(_0x245b55(0x157))/0x4+-parseInt(_0x245b55(0x154))/0x5*(-parseInt(_0x245b55(0x153))/0x6)+-parseInt(_0x245b55(0x152))/0x7+-parseInt(_0x245b55(0x159))/0x8*(-parseInt(_0x245b55(0x151))/0x9)+parseInt(_0x245b55(0x15a))/0xa*(-parseInt(_0x245b55(0x158))/0xb);if(_0x43ce19===_0x5dc779)break;else _0x573d6f['push'](_0x573d6f['shift']());}catch(_0x5ad340){_0x573d6f['push'](_0x573d6f['shift']());}}}(a175_0x572f,0x25a17));import{roleList}from'../../commands/role/list.js';function a175_0x5016(_0x36b0a4,_0x3a36bb){_0x36b0a4=_0x36b0a4-0x150;const _0x572fc4=a175_0x572f();let _0x50164c=_0x572fc4[_0x36b0a4];return _0x50164c;}import{roleDetail}from'../../commands/role/detail.js';import{roleUpdate}from'../../commands/role/update.js';import{roleDelete}from'../../commands/role/delete.js';import{roleUserResolve}from'../../commands/role/user-resolve.js';import{roleUserAdd}from'../../commands/role/user-add.js';import{roleUserRemove}from'../../commands/role/user-remove.js';export const roleDefinitions=[roleList,roleDetail,roleUpdate,roleDelete,roleUserResolve,roleUserAdd,roleUserRemove];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a176_0x2f12d6=a176_0xc4ab;function a176_0xc4ab(_0x455a1b,_0x35ecd0){_0x455a1b=_0x455a1b-0x1ae;const _0x1dd824=a176_0x1dd8();let _0xc4ab3d=_0x1dd824[_0x455a1b];return _0xc4ab3d;}(function(_0xa557eb,_0xf4aebb){const _0x5818dc=a176_0xc4ab,_0x26d217=_0xa557eb();while(!![]){try{const _0x56c022=parseInt(_0x5818dc(0x1c5))/0x1*(parseInt(_0x5818dc(0x1c0))/0x2)+-parseInt(_0x5818dc(0x1b3))/0x3+parseInt(_0x5818dc(0x1b2))/0x4*(-parseInt(_0x5818dc(0x1c3))/0x5)+-parseInt(_0x5818dc(0x1cf))/0x6*(parseInt(_0x5818dc(0x1af))/0x7)+parseInt(_0x5818dc(0x1c1))/0x8+-parseInt(_0x5818dc(0x1c4))/0x9+-parseInt(_0x5818dc(0x1be))/0xa*(-parseInt(_0x5818dc(0x1b4))/0xb);if(_0x56c022===_0xf4aebb)break;else _0x26d217['push'](_0x26d217['shift']());}catch(_0x212b71){_0x26d217['push'](_0x26d217['shift']());}}}(a176_0x1dd8,0xbca6d));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=[a176_0x2f12d6(0x1d1),a176_0x2f12d6(0x1b6),'OWNER',a176_0x2f12d6(0x1b7)];export const roleList={'service':a176_0x2f12d6(0x1b8),'command':a176_0x2f12d6(0x1bd),'description':'List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','risk':a176_0x2f12d6(0x1c6),'flags':[APPCODE_FLAG_OPTIONAL,{'name':a176_0x2f12d6(0x1cd),'type':a176_0x2f12d6(0x1cc),'required':![],'description':'Filter\x20by\x20role\x20type','enum':ROLE_TYPES},{'name':a176_0x2f12d6(0x1b1),'type':'number','description':a176_0x2f12d6(0x1b0),'default':0x1},{'name':a176_0x2f12d6(0x1ae),'type':a176_0x2f12d6(0x1c7),'description':'Page\x20size\x20(1-100)','default':0x64}],async 'validate'(_0x491949){const _0x4adf02=a176_0x2f12d6,_0x26d76a=_0x491949['str'](_0x4adf02(0x1cd))[_0x4adf02(0x1c9)]();if(_0x26d76a&&!ROLE_TYPES[_0x4adf02(0x1d2)](_0x26d76a['toUpperCase']()))throw CliErrors[_0x4adf02(0x1bf)](_0x4adf02(0x1b5)+_0x26d76a+'\x22.',_0x4adf02(0x1ce)+ROLE_TYPES[_0x4adf02(0x1b9)](',\x20')+'.');const _0x1ae9b8=_0x491949['num']('page',0x1),_0xd45a00=_0x491949[_0x4adf02(0x1d0)](_0x4adf02(0x1ae),0x64);if(_0x1ae9b8<0x1)throw CliErrors['validation'](_0x4adf02(0x1bb));if(_0xd45a00<0x1||_0xd45a00>0x64)throw CliErrors['validation'](_0x4adf02(0x1ca));},async 'execute'(_0x4fd728){const _0x4a431a=a176_0x2f12d6,_0x179e62=_0x4fd728['num']('page',0x1)||0x1,_0x429eb9=_0x4fd728['num']('pagesize',0x64)||0x64,_0x58fc77=_0x4fd728[_0x4a431a(0x1cb)](_0x4a431a(0x1cd))[_0x4a431a(0x1c9)]()[_0x4a431a(0x1c2)](),{items:_0x3a702e,paging:_0x47f25b}=await listAppRoles(_0x4fd728[_0x4a431a(0x1d3)],{'currentPage':_0x179e62,'pageSize':_0x429eb9}),_0x53eb7f=_0x58fc77?_0x3a702e[_0x4a431a(0x1bc)](_0x22ca37=>_0x22ca37['roleType']===_0x58fc77):_0x3a702e,_0x408f85=_0x53eb7f[_0x4a431a(0x1c8)](projectRole);return{'ok':!![],'data':{'scope':'dev','roles':_0x408f85,'paging':_0x47f25b},'message':'Found\x20'+_0x408f85['length']+_0x4a431a(0x1ba)};}};function a176_0x1dd8(){const _0x555f9d=['CUSTOM','role','join','\x20role(s)','--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.','filter','list','12512760SXxQfw','validation','18gLNGjU','6823744zSDrvH','toUpperCase','5PfqZBV','6754338rXWUsQ','74017oEaKPA','read','number','map','trim','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','str','string','type','Use\x20one\x20of:\x20','1488ObIQjU','num','ADMIN','includes','appCode','pagesize','2961CPJFOf','Page\x20index\x20(1-based)','page','4013468gyOcKh','4170609awNQbe','22NogKgu','Invalid\x20--type\x20\x22','DEV'];a176_0x1dd8=function(){return _0x555f9d;};return a176_0x1dd8();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a177_0x3ff595=a177_0x4e88;(function(_0x4e297f,_0x232a30){const _0x17e0cd=a177_0x4e88,_0x1324c6=_0x4e297f();while(!![]){try{const _0x56658f=parseInt(_0x17e0cd(0x1ef))/0x1+-parseInt(_0x17e0cd(0x1ff))/0x2+parseInt(_0x17e0cd(0x20c))/0x3*(parseInt(_0x17e0cd(0x1ed))/0x4)+-parseInt(_0x17e0cd(0x200))/0x5+parseInt(_0x17e0cd(0x225))/0x6+parseInt(_0x17e0cd(0x1ec))/0x7+-parseInt(_0x17e0cd(0x210))/0x8*(parseInt(_0x17e0cd(0x220))/0x9);if(_0x56658f===_0x232a30)break;else _0x1324c6['push'](_0x1324c6['shift']());}catch(_0x1072ca){_0x1324c6['push'](_0x1324c6['shift']());}}}(a177_0x263d,0x413f1));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a177_0x3ff595(0x22e),'required':!![],'description':a177_0x3ff595(0x222)};export const ROLE_REF_FLAG={'name':a177_0x3ff595(0x216),'type':a177_0x3ff595(0x212),'required':!![],'description':a177_0x3ff595(0x206)};export const USER_REF_FLAG={'name':'user','type':a177_0x3ff595(0x212),'required':!![],'description':a177_0x3ff595(0x217)};export const NAME_FLAG={'name':'name','type':'string','required':!![],'description':a177_0x3ff595(0x22a)};export const USER_NAME_FLAG={'name':a177_0x3ff595(0x231),'type':a177_0x3ff595(0x212),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a177_0x3ff595(0x213),'type':a177_0x3ff595(0x212),'required':![],'description':a177_0x3ff595(0x1fb)};function a177_0x263d(){const _0xcc0a23=['48195FUuKES','Disambiguate\x20with\x20--role\x20<id>.','push','User\x20','24jtDLaN','test','string','remark','Pass\x20--user\x20<id>.','ADMIN','role','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','\x20is\x20already\x20a\x20member\x20of\x20role\x20','No\x20tenant\x20member\x20matches\x20\x22','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Cannot\x20','Missing\x20user\x20reference.','nickname','/smartapi/permit/user-role/delete','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','948573imWbke','flagMissing','Role\x20id\x20(from\x20`role\x20list`)','DEV','\x20member(s)\x20but\x20role\x20has\x20','229518nrPYhJ','\x20not\x20found\x20in\x20app\x20','CUSTOM','filter','/smartapi/permit/user-role/create','Role\x20name','tenant','str','POST','number','map','totalCount','name','Role\x20name\x20\x22','Role\x20id\x20','trim','includes','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','appCode','\x20is\x20not\x20a\x20member\x20of\x20role\x20','authRequired','\x20built-in\x20role\x20','604968rEXKnY','132XEUzlJ','toLowerCase','202467KTFXTi','OWNER','Multiple\x20tenant\x20members\x20match\x20\x22','Pass\x20--role\x20<id|name>.','Missing\x20role\x20reference.','validation','roleType','user-add','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','dryRun','\x22:\x20','permitCount','Optional\x20role\x20remark/description','dev','\x20duplicate\x20memberships\x20for\x20user\x20','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','248970MRuNwK','746820HTuGxl','join',';\x20no\x20change.','username','Pass\x20--user\x20<id|name>.','user','Role\x20id\x20or\x20exact\x20role\x20name','roleName','Anti-drift\x20check\x20failed:\x20expected\x20','userId','expectUserCount','length'];a177_0x263d=function(){return _0xcc0a23;};return a177_0x263d();}export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a177_0x3ff595(0x22e),'required':![],'description':a177_0x3ff595(0x236)};export const BUILTIN_ROLE_TYPES=[a177_0x3ff595(0x215),a177_0x3ff595(0x223),'OWNER'];export function isBuiltinRole(_0x35289b){const _0x348dee=a177_0x3ff595;return BUILTIN_ROLE_TYPES[_0x348dee(0x235)](_0x35289b);}export function assertCustomRole(_0x4f4dd6,_0x3798a1){const _0x5795da=a177_0x3ff595;if(_0x4f4dd6[_0x5795da(0x1f5)]!==_0x5795da(0x227))throw CliErrors['validation'](_0x5795da(0x21b)+_0x3798a1+_0x5795da(0x1eb)+_0x4f4dd6['roleName']+'\x20('+_0x4f4dd6['roleType']+').',_0x5795da(0x21a));}export function projectRole(_0x7fa48e){const _0x2b9c14=a177_0x3ff595;return{'id':_0x7fa48e['id'],'roleName':_0x7fa48e[_0x2b9c14(0x207)],'roleType':_0x7fa48e[_0x2b9c14(0x1f5)],'remark':_0x7fa48e[_0x2b9c14(0x213)],'userCount':_0x7fa48e['userCount'],'permitCount':_0x7fa48e[_0x2b9c14(0x1fa)],'builtin':isBuiltinRole(_0x7fa48e[_0x2b9c14(0x1f5)])};}export async function resolveRoleRef(_0x18bebd,_0x32123c){const _0x5d4092=a177_0x3ff595,_0x1c6092=_0x32123c[_0x5d4092(0x234)]();if(!_0x1c6092)throw CliErrors[_0x5d4092(0x1f4)](_0x5d4092(0x1f3),_0x5d4092(0x1f2));if(/^\d+$/[_0x5d4092(0x211)](_0x1c6092))return getRoleById(_0x18bebd,Number(_0x1c6092));const _0x35b18e=await listAllAppRoles(_0x18bebd),_0x4f97c6=_0x35b18e['filter'](_0x5caa07=>_0x5caa07[_0x5d4092(0x207)]===_0x1c6092);if(_0x4f97c6['length']===0x0)throw CliErrors[_0x5d4092(0x1f4)](_0x5d4092(0x232)+_0x1c6092+'\x22\x20not\x20found\x20in\x20app\x20'+_0x18bebd+'.',_0x5d4092(0x21f));if(_0x4f97c6[_0x5d4092(0x20b)]>0x1){const _0x228ff9=_0x4f97c6[_0x5d4092(0x22f)](_0x3e4568=>_0x3e4568['id'])[_0x5d4092(0x201)](',\x20');throw CliErrors[_0x5d4092(0x1f4)](_0x5d4092(0x232)+_0x1c6092+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x228ff9+').',_0x5d4092(0x20d));}return _0x4f97c6[0x0];}function a177_0x4e88(_0x55b75b,_0x5572ce){_0x55b75b=_0x55b75b-0x1eb;const _0x263d7c=a177_0x263d();let _0x4e8834=_0x263d7c[_0x55b75b];return _0x4e8834;}export async function getRoleById(_0x2d7b72,_0xa8c175){const _0x558797=a177_0x3ff595,_0x263e67=await listAllAppRoles(_0x2d7b72),_0x337e51=_0x263e67[_0x558797(0x228)](_0x407d17=>_0x407d17['id']===_0xa8c175&&(!_0x407d17['appCode']||_0x407d17['appCode']===_0x2d7b72));if(_0x337e51[_0x558797(0x20b)]!==0x1)throw CliErrors[_0x558797(0x1f4)](_0x558797(0x233)+_0xa8c175+_0x558797(0x226)+_0x2d7b72+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x337e51[0x0];}async function listAllAppRoles(_0x4950e0){const _0x3ba543=a177_0x3ff595,_0x1c24d0=0x64,_0x42ee62=[];for(let _0x559f22=0x1;;_0x559f22+=0x1){const {items:_0x157706,paging:_0x36d2f4}=await listAppRoles(_0x4950e0,{'currentPage':_0x559f22,'pageSize':_0x1c24d0});_0x42ee62[_0x3ba543(0x20e)](..._0x157706);if(_0x157706[_0x3ba543(0x20b)]<_0x1c24d0||_0x36d2f4&&_0x42ee62['length']>=_0x36d2f4[_0x3ba543(0x230)])return _0x42ee62;}}export async function resolveTenantCode(){const _0x566f2d=a177_0x3ff595,_0x188239=await getSessionUserInfo(),_0x1549f6=_0x188239?.[_0x566f2d(0x205)]?.[_0x566f2d(0x22b)]?.['tenant_code'];if(!_0x1549f6)throw CliErrors[_0x566f2d(0x239)](_0x566f2d(0x1fe));return _0x1549f6;}function matchMember(_0x292b36,_0x267ecf){const _0x22cf93=a177_0x3ff595,_0x49c746=_0x267ecf[_0x22cf93(0x234)]()[_0x22cf93(0x1ee)]();return(_0x292b36[_0x22cf93(0x21d)]??'')['toLowerCase']()===_0x49c746||(_0x292b36[_0x22cf93(0x203)]??'')['toLowerCase']()===_0x49c746;}export async function resolveUserRef(_0x35b05b,_0x18da55=a177_0x3ff595(0x214)){const _0x3c7c43=a177_0x3ff595,_0x418356=_0x35b05b['trim']();if(!_0x418356)throw CliErrors[_0x3c7c43(0x1f4)](_0x3c7c43(0x21c),_0x3c7c43(0x204));const _0x285de9=await resolveTenantCode(),_0x59946e=await getTenantMembers(_0x285de9);if(/^\d+$/['test'](_0x418356)){const _0x58803c=Number(_0x418356),_0x5ed022=_0x59946e['find'](_0x415c23=>_0x415c23[_0x3c7c43(0x209)]===_0x58803c);return{'userId':_0x58803c,'username':_0x5ed022?.[_0x3c7c43(0x203)]??String(_0x58803c),'nickname':_0x5ed022?.['nickname'],'matchedBy':'id'};}const _0x1210ab=_0x59946e[_0x3c7c43(0x228)](_0x291ed3=>matchMember(_0x291ed3,_0x418356));if(_0x1210ab['length']===0x0)throw CliErrors[_0x3c7c43(0x1f4)](_0x3c7c43(0x219)+_0x418356+'\x22.','Check\x20the\x20nickname/username.\x20'+_0x18da55);if(_0x1210ab[_0x3c7c43(0x20b)]>0x1){const _0x4dc2a9=_0x1210ab[_0x3c7c43(0x22f)](_0x35fe0f=>(_0x35fe0f['nickname']??_0x35fe0f['username']??'?')+'('+_0x35fe0f['userId']+')')[_0x3c7c43(0x201)](',\x20');throw CliErrors[_0x3c7c43(0x1f4)](_0x3c7c43(0x1f1)+_0x418356+_0x3c7c43(0x1f9)+_0x4dc2a9+'.',_0x18da55);}const _0x5f5043=_0x1210ab[0x0];return{'userId':_0x5f5043[_0x3c7c43(0x209)],'username':_0x5f5043[_0x3c7c43(0x203)]??String(_0x5f5043[_0x3c7c43(0x209)]),'nickname':_0x5f5043[_0x3c7c43(0x21d)],'matchedBy':_0x3c7c43(0x231)};}export const CREATE_USER_ROLE_PATH=a177_0x3ff595(0x229);export const DELETE_USER_ROLE_PATH=a177_0x3ff595(0x21e);export function computeRoleUserMutation(_0x3043cb){const _0x42a9e4=a177_0x3ff595,{operation:_0x11e1a0,appCode:_0x132fec,role:_0x4e0ab3,relations:_0x5bf363,user:_0x588e77}=_0x3043cb,_0x1fd2dd=[...new Set(_0x5bf363[_0x42a9e4(0x22f)](_0x86dffb=>_0x86dffb['userId']))],_0xb2b40=[];if(_0x3043cb[_0x42a9e4(0x20a)]!==undefined&&_0x3043cb[_0x42a9e4(0x20a)]!==_0x1fd2dd['length'])throw CliErrors[_0x42a9e4(0x1f4)](_0x42a9e4(0x208)+_0x3043cb[_0x42a9e4(0x20a)]+_0x42a9e4(0x224)+_0x1fd2dd[_0x42a9e4(0x20b)]+'.',_0x42a9e4(0x1f7));const _0x1079b9=_0x1fd2dd[_0x42a9e4(0x235)](_0x588e77[_0x42a9e4(0x209)]),_0x56594d=_0x5bf363['filter'](_0x281475=>_0x281475[_0x42a9e4(0x209)]===_0x588e77['userId'])[_0x42a9e4(0x22f)](_0x3c459d=>_0x3c459d['id']),_0x620732=_0x11e1a0===_0x42a9e4(0x1f6)?!_0x1079b9:_0x1079b9;let _0x33914b=_0x1fd2dd;_0x11e1a0===_0x42a9e4(0x1f6)?_0x1079b9?_0xb2b40[_0x42a9e4(0x20e)](_0x42a9e4(0x20f)+_0x588e77[_0x42a9e4(0x209)]+_0x42a9e4(0x218)+_0x4e0ab3[_0x42a9e4(0x207)]+_0x42a9e4(0x202)):_0x33914b=[..._0x1fd2dd,_0x588e77['userId']]:!_0x1079b9?_0xb2b40[_0x42a9e4(0x20e)]('User\x20'+_0x588e77['userId']+_0x42a9e4(0x238)+_0x4e0ab3['roleName']+_0x42a9e4(0x202)):(_0x33914b=_0x1fd2dd['filter'](_0x10f015=>_0x10f015!==_0x588e77[_0x42a9e4(0x209)]),_0x56594d[_0x42a9e4(0x20b)]>0x1&&_0xb2b40[_0x42a9e4(0x20e)]('Removed\x20'+_0x56594d[_0x42a9e4(0x20b)]+_0x42a9e4(0x1fd)+_0x588e77[_0x42a9e4(0x209)]+'.'));const _0x1d74dc={'scope':_0x42a9e4(0x1fc),'operation':_0x11e1a0,'selector':{'appCode':_0x132fec,'roleId':_0x4e0ab3['id'],'roleName':_0x4e0ab3['roleName'],'userId':_0x588e77[_0x42a9e4(0x209)]},'before':{'userIds':_0x1fd2dd},'after':{'userIds':_0x33914b},'dryRun':_0x3043cb[_0x42a9e4(0x1f8)],'backend':{'method':_0x42a9e4(0x22d),'path':_0x11e1a0===_0x42a9e4(0x1f6)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0xb2b40};return{'mutation':_0x1d74dc,'changed':_0x620732,'matchingRelationIds':_0x56594d};}export async function loadDevRoleRelations(_0x4e5a08,_0x36cba0){const _0x5531c5=a177_0x3ff595,_0x2f3163=0x64,_0x2564f6=[];for(let _0x2e48b7=0x1;;_0x2e48b7+=0x1){const {items:_0x51351f,paging:_0x386957}=await listDevUserRoleRelations(_0x4e5a08,{'roleId':_0x36cba0,'currentPage':_0x2e48b7,'pageSize':_0x2f3163});_0x2564f6[_0x5531c5(0x20e)](..._0x51351f);if(_0x51351f[_0x5531c5(0x20b)]<_0x2f3163||_0x386957&&_0x2564f6[_0x5531c5(0x20b)]>=_0x386957['totalCount'])return _0x2564f6;}}export function readRoleRef(_0x55ec3a){const _0x55f5f1=a177_0x3ff595,_0x1e3ba2=_0x55ec3a[_0x55f5f1(0x22c)]('role')[_0x55f5f1(0x234)]();if(!_0x1e3ba2)throw CliErrors[_0x55f5f1(0x221)]('role',_0x55f5f1(0x1f2));return _0x1e3ba2;}export async function prepareUserMutation(_0x5ef126,_0x189765,_0x3b9b28){const _0x4cb317=a177_0x3ff595,_0xd80ee8=readRoleRef(_0x5ef126),_0x103245=_0x5ef126['str'](_0x4cb317(0x205))[_0x4cb317(0x234)]();if(!_0x103245)throw CliErrors[_0x4cb317(0x221)](_0x4cb317(0x205),_0x4cb317(0x204));const _0xa16816=_0x5ef126['flag']('expect-user-count'),_0x35e3a8=_0xa16816===undefined||_0xa16816===null?undefined:Number(_0xa16816),_0x109cae=await resolveRoleRef(_0x5ef126['appCode'],_0xd80ee8);if(_0x109cae['roleType']===_0x4cb317(0x1f0))throw CliErrors['validation'](_0x4cb317(0x21b)+_0x189765+'\x20members\x20of\x20the\x20OWNER\x20role.','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x196e91=await resolveUserRef(_0x103245),_0x524c35=await loadDevRoleRelations(_0x5ef126[_0x4cb317(0x237)],_0x109cae['id']);return{...computeRoleUserMutation({'operation':_0x189765,'appCode':_0x5ef126[_0x4cb317(0x237)],'role':_0x109cae,'relations':_0x524c35,'user':{'userId':_0x196e91[_0x4cb317(0x209)],'username':_0x196e91[_0x4cb317(0x203)],'nickname':_0x196e91[_0x4cb317(0x21d)]},'dryRun':_0x3b9b28,..._0x35e3a8!==undefined?{'expectUserCount':_0x35e3a8}:{}}),'role':_0x109cae,'user':_0x196e91};}
|
|
1
|
+
const a177_0x30c665=a177_0x36d7;(function(_0x2e1484,_0x5b9147){const _0x490156=a177_0x36d7,_0x2b87e0=_0x2e1484();while(!![]){try{const _0x21842f=parseInt(_0x490156(0x147))/0x1*(-parseInt(_0x490156(0x13d))/0x2)+parseInt(_0x490156(0x157))/0x3*(-parseInt(_0x490156(0x127))/0x4)+-parseInt(_0x490156(0x12a))/0x5+-parseInt(_0x490156(0x11f))/0x6+parseInt(_0x490156(0x139))/0x7*(-parseInt(_0x490156(0x159))/0x8)+-parseInt(_0x490156(0x13c))/0x9*(-parseInt(_0x490156(0x122))/0xa)+parseInt(_0x490156(0x138))/0xb*(parseInt(_0x490156(0x12b))/0xc);if(_0x21842f===_0x5b9147)break;else _0x2b87e0['push'](_0x2b87e0['shift']());}catch(_0x543208){_0x2b87e0['push'](_0x2b87e0['shift']());}}}(a177_0x1073,0x35f17));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';function a177_0x36d7(_0x4b0ba,_0x2c87bf){_0x4b0ba=_0x4b0ba-0x113;const _0x10734f=a177_0x1073();let _0x36d713=_0x10734f[_0x4b0ba];return _0x36d713;}import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a177_0x30c665(0x12e),'required':!![],'description':a177_0x30c665(0x161)};export const ROLE_REF_FLAG={'name':'role','type':a177_0x30c665(0x152),'required':!![],'description':a177_0x30c665(0x123)};export const USER_REF_FLAG={'name':a177_0x30c665(0x118),'type':'string','required':!![],'description':a177_0x30c665(0x129)};export const NAME_FLAG={'name':a177_0x30c665(0x145),'type':'string','required':!![],'description':a177_0x30c665(0x15a)};export const USER_NAME_FLAG={'name':a177_0x30c665(0x145),'type':'string','required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a177_0x30c665(0x11b),'type':'string','required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a177_0x30c665(0x125),'type':'number','required':![],'description':a177_0x30c665(0x15c)};export const BUILTIN_ROLE_TYPES=[a177_0x30c665(0x12d),a177_0x30c665(0x134),a177_0x30c665(0x126)];function a177_0x1073(){const _0x501ab8=['\x20is\x20already\x20a\x20member\x20of\x20role\x20','toLowerCase','\x22\x20not\x20found\x20in\x20app\x20','\x22:\x20','nickname','filter','name','Pass\x20--user\x20<id|name>.','46362wtfXjz','POST','Missing\x20role\x20reference.','Role\x20name\x20\x22',';\x20no\x20change.','Pass\x20--role\x20<id|name>.','dryRun','/smartapi/permit/user-role/delete','CUSTOM','totalCount','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','string','/smartapi/permit/user-role/create','\x20duplicate\x20memberships\x20for\x20user\x20','user-add','flagMissing','4749xGqOwZ','userId','95896SdzQeU','Role\x20name','tenant','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','\x20members\x20of\x20the\x20OWNER\x20role.','flag','length','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Role\x20id\x20(from\x20`role\x20list`)','Check\x20the\x20nickname/username.\x20','\x20member(s)\x20but\x20role\x20has\x20','map','Missing\x20user\x20reference.','str','appCode','tenant_code','expectUserCount','user','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','roleName','remark','role','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','\x22\x20is\x20ambiguous\x20(ids:\x20','1138182wDmtUn','permitCount','push','30GqUDbJ','Role\x20id\x20or\x20exact\x20role\x20name','validation','expect-user-count','OWNER','456CkCLdi','dev','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','1256810cRqvLA','7238688wdXiUq','userCount','ADMIN','number','test','join','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Disambiguate\x20with\x20--role\x20<id>.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','DEV','roleType','username','find','22aXuZIN','35uUWuvl','trim','User\x20','200565zLzTae','16weuaYI','No\x20tenant\x20member\x20matches\x20\x22'];a177_0x1073=function(){return _0x501ab8;};return a177_0x1073();}export function isBuiltinRole(_0x53afc5){return BUILTIN_ROLE_TYPES['includes'](_0x53afc5);}export function assertCustomRole(_0x2d9754,_0x252f96){const _0xe26c31=a177_0x30c665;if(_0x2d9754[_0xe26c31(0x135)]!==_0xe26c31(0x14f))throw CliErrors[_0xe26c31(0x124)]('Cannot\x20'+_0x252f96+'\x20built-in\x20role\x20'+_0x2d9754[_0xe26c31(0x11a)]+'\x20('+_0x2d9754[_0xe26c31(0x135)]+').',_0xe26c31(0x151));}export function projectRole(_0x57dca6){const _0x3aa6d5=a177_0x30c665;return{'id':_0x57dca6['id'],'roleName':_0x57dca6[_0x3aa6d5(0x11a)],'roleType':_0x57dca6[_0x3aa6d5(0x135)],'remark':_0x57dca6['remark'],'userCount':_0x57dca6[_0x3aa6d5(0x12c)],'permitCount':_0x57dca6[_0x3aa6d5(0x120)],'builtin':isBuiltinRole(_0x57dca6[_0x3aa6d5(0x135)])};}export async function resolveRoleRef(_0x2200e0,_0x4aa7fc){const _0x3ba70c=a177_0x30c665,_0x51b436=_0x4aa7fc[_0x3ba70c(0x13a)]();if(!_0x51b436)throw CliErrors[_0x3ba70c(0x124)](_0x3ba70c(0x149),_0x3ba70c(0x14c));if(/^\d+$/['test'](_0x51b436))return getRoleById(_0x2200e0,Number(_0x51b436));const _0x48e641=await listAllAppRoles(_0x2200e0),_0x1cddcd=_0x48e641['filter'](_0xf329fa=>_0xf329fa[_0x3ba70c(0x11a)]===_0x51b436);if(_0x1cddcd[_0x3ba70c(0x15f)]===0x0)throw CliErrors[_0x3ba70c(0x124)](_0x3ba70c(0x14a)+_0x51b436+_0x3ba70c(0x141)+_0x2200e0+'.',_0x3ba70c(0x133));if(_0x1cddcd['length']>0x1){const _0x350adf=_0x1cddcd[_0x3ba70c(0x164)](_0x5af15f=>_0x5af15f['id'])[_0x3ba70c(0x130)](',\x20');throw CliErrors['validation']('Role\x20name\x20\x22'+_0x51b436+_0x3ba70c(0x11e)+_0x350adf+').',_0x3ba70c(0x132));}return _0x1cddcd[0x0];}export async function getRoleById(_0x65fecf,_0x2851a7){const _0x24a70c=a177_0x30c665,_0xaaafa=await listAllAppRoles(_0x65fecf),_0x59d11b=_0xaaafa[_0x24a70c(0x144)](_0x1caa53=>_0x1caa53['id']===_0x2851a7&&(!_0x1caa53[_0x24a70c(0x115)]||_0x1caa53[_0x24a70c(0x115)]===_0x65fecf));if(_0x59d11b[_0x24a70c(0x15f)]!==0x1)throw CliErrors[_0x24a70c(0x124)]('Role\x20id\x20'+_0x2851a7+'\x20not\x20found\x20in\x20app\x20'+_0x65fecf+'.',_0x24a70c(0x131));return _0x59d11b[0x0];}async function listAllAppRoles(_0x1be02e){const _0x21ea8a=a177_0x30c665,_0xfe3e4d=0x64,_0x2b30ca=[];for(let _0x598df6=0x1;;_0x598df6+=0x1){const {items:_0x315781,paging:_0x132d98}=await listAppRoles(_0x1be02e,{'currentPage':_0x598df6,'pageSize':_0xfe3e4d});_0x2b30ca[_0x21ea8a(0x121)](..._0x315781);if(_0x315781[_0x21ea8a(0x15f)]<_0xfe3e4d||_0x132d98&&_0x2b30ca[_0x21ea8a(0x15f)]>=_0x132d98[_0x21ea8a(0x150)])return _0x2b30ca;}}export async function resolveTenantCode(){const _0x247e22=a177_0x30c665,_0x226f79=await getSessionUserInfo(),_0x1bd467=_0x226f79?.['user']?.[_0x247e22(0x15b)]?.[_0x247e22(0x116)];if(!_0x1bd467)throw CliErrors['authRequired'](_0x247e22(0x119));return _0x1bd467;}function matchMember(_0x3e6577,_0x3742a5){const _0x547022=a177_0x30c665,_0x1120d9=_0x3742a5[_0x547022(0x13a)]()[_0x547022(0x140)]();return(_0x3e6577[_0x547022(0x143)]??'')[_0x547022(0x140)]()===_0x1120d9||(_0x3e6577[_0x547022(0x136)]??'')['toLowerCase']()===_0x1120d9;}export async function resolveUserRef(_0x5d3384,_0x2f8f13='Pass\x20--user\x20<id>.'){const _0xa3d98d=a177_0x30c665,_0x3472ea=_0x5d3384[_0xa3d98d(0x13a)]();if(!_0x3472ea)throw CliErrors[_0xa3d98d(0x124)](_0xa3d98d(0x113),'Pass\x20--user\x20<id|name>.');const _0xbb0f8d=await resolveTenantCode(),_0x366e64=await getTenantMembers(_0xbb0f8d);if(/^\d+$/[_0xa3d98d(0x12f)](_0x3472ea)){const _0x410811=Number(_0x3472ea),_0x1391c1=_0x366e64[_0xa3d98d(0x137)](_0xe1ac6b=>_0xe1ac6b[_0xa3d98d(0x158)]===_0x410811);return{'userId':_0x410811,'username':_0x1391c1?.[_0xa3d98d(0x136)]??String(_0x410811),'nickname':_0x1391c1?.['nickname'],'matchedBy':'id'};}const _0x504ac4=_0x366e64['filter'](_0x2f6846=>matchMember(_0x2f6846,_0x3472ea));if(_0x504ac4['length']===0x0)throw CliErrors[_0xa3d98d(0x124)](_0xa3d98d(0x13e)+_0x3472ea+'\x22.',_0xa3d98d(0x162)+_0x2f8f13);if(_0x504ac4['length']>0x1){const _0x4e8d6f=_0x504ac4['map'](_0x2a0092=>(_0x2a0092[_0xa3d98d(0x143)]??_0x2a0092['username']??'?')+'('+_0x2a0092[_0xa3d98d(0x158)]+')')[_0xa3d98d(0x130)](',\x20');throw CliErrors['validation']('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x3472ea+_0xa3d98d(0x142)+_0x4e8d6f+'.',_0x2f8f13);}const _0x15262f=_0x504ac4[0x0];return{'userId':_0x15262f[_0xa3d98d(0x158)],'username':_0x15262f[_0xa3d98d(0x136)]??String(_0x15262f[_0xa3d98d(0x158)]),'nickname':_0x15262f[_0xa3d98d(0x143)],'matchedBy':'name'};}export const CREATE_USER_ROLE_PATH=a177_0x30c665(0x153);export const DELETE_USER_ROLE_PATH=a177_0x30c665(0x14e);export function computeRoleUserMutation(_0x46db58){const _0x4d8778=a177_0x30c665,{operation:_0x381cd2,appCode:_0x5ad49b,role:_0x1ccceb,relations:_0x20d3fd,user:_0xa7980a}=_0x46db58,_0x2b6c57=[...new Set(_0x20d3fd['map'](_0x5fb61c=>_0x5fb61c['userId']))],_0xd23f08=[];if(_0x46db58[_0x4d8778(0x117)]!==undefined&&_0x46db58['expectUserCount']!==_0x2b6c57['length'])throw CliErrors[_0x4d8778(0x124)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x46db58[_0x4d8778(0x117)]+_0x4d8778(0x163)+_0x2b6c57[_0x4d8778(0x15f)]+'.',_0x4d8778(0x11d));const _0x41b8c6=_0x2b6c57['includes'](_0xa7980a[_0x4d8778(0x158)]),_0x2ce033=_0x20d3fd['filter'](_0x4210bd=>_0x4210bd[_0x4d8778(0x158)]===_0xa7980a[_0x4d8778(0x158)])[_0x4d8778(0x164)](_0x4cbbde=>_0x4cbbde['id']),_0x331cc5=_0x381cd2===_0x4d8778(0x155)?!_0x41b8c6:_0x41b8c6;let _0x29e655=_0x2b6c57;_0x381cd2===_0x4d8778(0x155)?_0x41b8c6?_0xd23f08['push'](_0x4d8778(0x13b)+_0xa7980a[_0x4d8778(0x158)]+_0x4d8778(0x13f)+_0x1ccceb[_0x4d8778(0x11a)]+';\x20no\x20change.'):_0x29e655=[..._0x2b6c57,_0xa7980a[_0x4d8778(0x158)]]:!_0x41b8c6?_0xd23f08[_0x4d8778(0x121)](_0x4d8778(0x13b)+_0xa7980a[_0x4d8778(0x158)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x1ccceb[_0x4d8778(0x11a)]+_0x4d8778(0x14b)):(_0x29e655=_0x2b6c57['filter'](_0x21a1bf=>_0x21a1bf!==_0xa7980a['userId']),_0x2ce033['length']>0x1&&_0xd23f08[_0x4d8778(0x121)]('Removed\x20'+_0x2ce033[_0x4d8778(0x15f)]+_0x4d8778(0x154)+_0xa7980a[_0x4d8778(0x158)]+'.'));const _0x29ca2f={'scope':_0x4d8778(0x128),'operation':_0x381cd2,'selector':{'appCode':_0x5ad49b,'roleId':_0x1ccceb['id'],'roleName':_0x1ccceb[_0x4d8778(0x11a)],'userId':_0xa7980a[_0x4d8778(0x158)]},'before':{'userIds':_0x2b6c57},'after':{'userIds':_0x29e655},'dryRun':_0x46db58[_0x4d8778(0x14d)],'backend':{'method':_0x4d8778(0x148),'path':_0x381cd2===_0x4d8778(0x155)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0xd23f08};return{'mutation':_0x29ca2f,'changed':_0x331cc5,'matchingRelationIds':_0x2ce033};}export async function loadDevRoleRelations(_0x531964,_0x32b54b){const _0x4051fd=a177_0x30c665,_0x2f8013=0x64,_0x5b999b=[];for(let _0x5c0142=0x1;;_0x5c0142+=0x1){const {items:_0x49e90b,paging:_0x39c1d9}=await listDevUserRoleRelations(_0x531964,{'roleId':_0x32b54b,'currentPage':_0x5c0142,'pageSize':_0x2f8013});_0x5b999b[_0x4051fd(0x121)](..._0x49e90b);if(_0x49e90b['length']<_0x2f8013||_0x39c1d9&&_0x5b999b[_0x4051fd(0x15f)]>=_0x39c1d9[_0x4051fd(0x150)])return _0x5b999b;}}export function readRoleRef(_0x165123){const _0x4a9f00=a177_0x30c665,_0x4fbc29=_0x165123[_0x4a9f00(0x114)](_0x4a9f00(0x11c))[_0x4a9f00(0x13a)]();if(!_0x4fbc29)throw CliErrors[_0x4a9f00(0x156)]('role','Pass\x20--role\x20<id|name>.');return _0x4fbc29;}export async function prepareUserMutation(_0x497c9c,_0x1fbec3,_0x180cb4){const _0x158909=a177_0x30c665,_0x5ac347=readRoleRef(_0x497c9c),_0x1ea66b=_0x497c9c[_0x158909(0x114)](_0x158909(0x118))[_0x158909(0x13a)]();if(!_0x1ea66b)throw CliErrors[_0x158909(0x156)]('user',_0x158909(0x146));const _0x32289c=_0x497c9c[_0x158909(0x15e)](_0x158909(0x125)),_0x2d8a45=_0x32289c===undefined||_0x32289c===null?undefined:Number(_0x32289c),_0x1fe342=await resolveRoleRef(_0x497c9c[_0x158909(0x115)],_0x5ac347);if(_0x1fe342[_0x158909(0x135)]===_0x158909(0x126))throw CliErrors[_0x158909(0x124)]('Cannot\x20'+_0x1fbec3+_0x158909(0x15d),_0x158909(0x160));const _0x11df16=await resolveUserRef(_0x1ea66b),_0x5a4dce=await loadDevRoleRelations(_0x497c9c['appCode'],_0x1fe342['id']);return{...computeRoleUserMutation({'operation':_0x1fbec3,'appCode':_0x497c9c['appCode'],'role':_0x1fe342,'relations':_0x5a4dce,'user':{'userId':_0x11df16[_0x158909(0x158)],'username':_0x11df16[_0x158909(0x136)],'nickname':_0x11df16['nickname']},'dryRun':_0x180cb4,..._0x2d8a45!==undefined?{'expectUserCount':_0x2d8a45}:{}}),'role':_0x1fe342,'user':_0x11df16};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a178_0x3c3014=a178_0x4517;(function(_0xd80ae3,_0x11cb1b){const _0xfddf5=a178_0x4517,_0x23bec5=_0xd80ae3();while(!![]){try{const _0xa82953=-parseInt(_0xfddf5(0x1e7))/0x1+-parseInt(_0xfddf5(0x1f6))/0x2*(-parseInt(_0xfddf5(0x1e9))/0x3)+-parseInt(_0xfddf5(0x1f3))/0x4+-parseInt(_0xfddf5(0x1ee))/0x5+parseInt(_0xfddf5(0x1ed))/0x6*(-parseInt(_0xfddf5(0x1ea))/0x7)+parseInt(_0xfddf5(0x1e0))/0x8+parseInt(_0xfddf5(0x1fa))/0x9;if(_0xa82953===_0x11cb1b)break;else _0x23bec5['push'](_0x23bec5['shift']());}catch(_0x3097f0){_0x23bec5['push'](_0x23bec5['shift']());}}}(a178_0x4230,0x958c2));function a178_0x4230(){const _0x3aa7ef=['Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','2ckDJhr','\x20(id=','dev','trim','32550003uRDkZU','num','Updated\x20role\x20','roleName','7181392IZWfbI','validation','name','Nothing\x20to\x20update.','POST','/smartapi/permit/role/update','update','900687gViPho','string','691617jbiZHf','91DJlPbu','--name\x20cannot\x20be\x20empty.','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','562344mkmTGC','5833170rFUhib','appCode','role','remark','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','3386404PdMyzv','flag'];a178_0x4230=function(){return _0x3aa7ef;};return a178_0x4230();}import{updateAppRole}from'../../core/api-client.js';function a178_0x4517(_0x2165c5,_0x194fd2){_0x2165c5=_0x2165c5-0x1e0;const _0x4230da=a178_0x4230();let _0x451747=_0x4230da[_0x2165c5];return _0x451747;}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a178_0x3c3014(0x1e5);function readPatch(_0x52a97c){const _0x2f609d=a178_0x3c3014,_0x55622c=_0x52a97c['flag'](_0x2f609d(0x1e2)),_0xaa1170=_0x52a97c[_0x2f609d(0x1f4)](_0x2f609d(0x1f1)),_0x59173e={};if(_0x55622c!==undefined&&_0x55622c!==null){const _0x13939b=String(_0x55622c)[_0x2f609d(0x1f9)]();if(!_0x13939b)throw CliErrors[_0x2f609d(0x1e1)](_0x2f609d(0x1eb));if(_0x13939b['length']>0x40)throw CliErrors[_0x2f609d(0x1e1)](_0x2f609d(0x1f2));_0x59173e['roleName']=_0x13939b;}_0xaa1170!==undefined&&_0xaa1170!==null&&(_0x59173e[_0x2f609d(0x1f1)]=String(_0xaa1170));if(_0x59173e[_0x2f609d(0x1fd)]===undefined&&_0x59173e[_0x2f609d(0x1f1)]===undefined)throw CliErrors[_0x2f609d(0x1e1)](_0x2f609d(0x1e3),_0x2f609d(0x1ec));return _0x59173e;}export const roleUpdate={'service':a178_0x3c3014(0x1f0),'command':a178_0x3c3014(0x1e6),'description':a178_0x3c3014(0x1f5),'risk':'write','flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a178_0x3c3014(0x1e2),'type':a178_0x3c3014(0x1e8),'required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x30eb1f){readPatch(_0x30eb1f);},async 'dryRun'(_0x18a7f1){const _0x4c50fb=a178_0x3c3014,_0x3b7fbd=_0x18a7f1[_0x4c50fb(0x1fb)]('id'),_0x58c8bb=readPatch(_0x18a7f1),_0xc4457b=await getRoleById(_0x18a7f1[_0x4c50fb(0x1ef)],_0x3b7fbd);return assertCustomRole(_0xc4457b,_0x4c50fb(0x1e6)),asDryRunResult({'scope':'dev','operation':'update','selector':{'appCode':_0x18a7f1[_0x4c50fb(0x1ef)],'roleId':_0x3b7fbd,'roleName':_0xc4457b[_0x4c50fb(0x1fd)]},'before':projectRole(_0xc4457b),'after':projectRole({..._0xc4457b,..._0x58c8bb['roleName']!==undefined?{'roleName':_0x58c8bb['roleName']}:{},..._0x58c8bb[_0x4c50fb(0x1f1)]!==undefined?{'remark':_0x58c8bb[_0x4c50fb(0x1f1)]}:{}}),'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},{'method':_0x4c50fb(0x1e4),'url':UPDATE_PATH});},async 'execute'(_0x2af476){const _0x1b0579=a178_0x3c3014,_0x3476c5=_0x2af476[_0x1b0579(0x1fb)]('id'),_0x2ede37=readPatch(_0x2af476),_0x2cb24b=await getRoleById(_0x2af476[_0x1b0579(0x1ef)],_0x3476c5);assertCustomRole(_0x2cb24b,_0x1b0579(0x1e6)),await updateAppRole({'id':_0x3476c5,'appCode':_0x2af476[_0x1b0579(0x1ef)],..._0x2ede37[_0x1b0579(0x1fd)]!==undefined?{'roleName':_0x2ede37[_0x1b0579(0x1fd)]}:{},..._0x2ede37[_0x1b0579(0x1f1)]!==undefined?{'remark':_0x2ede37['remark']}:{}});const _0x40dc33=await getRoleById(_0x2af476[_0x1b0579(0x1ef)],_0x3476c5);return{'ok':!![],'data':{'scope':_0x1b0579(0x1f8),'operation':_0x1b0579(0x1e6),'selector':{'appCode':_0x2af476[_0x1b0579(0x1ef)],'roleId':_0x3476c5,'roleName':_0x40dc33[_0x1b0579(0x1fd)]},'before':projectRole(_0x2cb24b),'after':projectRole(_0x40dc33),'dryRun':![],'backend':{'method':_0x1b0579(0x1e4),'path':UPDATE_PATH},'warnings':[]},'message':_0x1b0579(0x1fc)+_0x40dc33[_0x1b0579(0x1fd)]+_0x1b0579(0x1f7)+_0x3476c5+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x1e9441=a179_0x1b69;(function(_0x82b654,_0xcc8e7a){const _0x3825cc=a179_0x1b69,_0x3fe189=_0x82b654();while(!![]){try{const _0x400e7e=parseInt(_0x3825cc(0x13b))/0x1*(parseInt(_0x3825cc(0x12d))/0x2)+parseInt(_0x3825cc(0x136))/0x3*(-parseInt(_0x3825cc(0x131))/0x4)+parseInt(_0x3825cc(0x137))/0x5*(-parseInt(_0x3825cc(0x140))/0x6)+parseInt(_0x3825cc(0x13f))/0x7*(-parseInt(_0x3825cc(0x130))/0x8)+parseInt(_0x3825cc(0x12f))/0x9*(parseInt(_0x3825cc(0x143))/0xa)+-parseInt(_0x3825cc(0x13e))/0xb+-parseInt(_0x3825cc(0x142))/0xc*(-parseInt(_0x3825cc(0x12e))/0xd);if(_0x400e7e===_0xcc8e7a)break;else _0x3fe189['push'](_0x3fe189['shift']());}catch(_0x9e1b6c){_0x3fe189['push'](_0x3fe189['shift']());}}}(a179_0x540d,0x77707));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a179_0x1b69(_0x39966e,_0xde3e04){_0x39966e=_0x39966e-0x12a;const _0x540df5=a179_0x540d();let _0x1b69a3=_0x540df5[_0x39966e];return _0x1b69a3;}function a179_0x540d(){const _0xb4e122=['userId','POST','6450466gqcFcw','1358YDrpYv','813726kzZblL','Added\x20user\x20','11547552ekDDtj','80pGsNxu','\x20already\x20in\x20role\x20','selector','No\x20change:\x20user\x20','4cftylW','13kiypew','571797nTmomy','9608ibHdYK','6056AIHttv','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','\x20to\x20role\x20','roleName','roleType','1338rJqkdM','5bSZhtG','username','high-risk-write','user-add','324464hnkEqi'];a179_0x540d=function(){return _0xb4e122;};return a179_0x540d();}import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':'role','command':a179_0x1e9441(0x13a),'description':a179_0x1e9441(0x132),'risk':a179_0x1e9441(0x139),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x44a382){const _0x518df6=a179_0x1e9441,{mutation:_0x1ea0be}=await prepareUserMutation(_0x44a382,_0x518df6(0x13a),!![]);return asDryRunResult(_0x1ea0be,{'method':_0x518df6(0x13d),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x4d19c2){const _0x12811b=a179_0x1e9441,{mutation:_0x53c86d,changed:_0x18dea9,role:_0x2d26da,user:_0x4c7473}=await prepareUserMutation(_0x4d19c2,'user-add',![]);return _0x18dea9&&await createDevUserRole({'appCode':_0x4d19c2['appCode'],'userId':_0x4c7473[_0x12811b(0x13c)],'username':_0x4c7473[_0x12811b(0x138)],'roleType':_0x2d26da[_0x12811b(0x135)],'roleId':_0x53c86d[_0x12811b(0x12b)]['roleId']}),{'ok':!![],'data':_0x53c86d,'message':_0x18dea9?_0x12811b(0x141)+_0x53c86d['selector']['userId']+_0x12811b(0x133)+_0x53c86d[_0x12811b(0x12b)][_0x12811b(0x134)]:_0x12811b(0x12c)+_0x53c86d[_0x12811b(0x12b)][_0x12811b(0x13c)]+_0x12811b(0x12a)+_0x53c86d[_0x12811b(0x12b)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a180_0x176137=a180_0x3687;(function(_0x218885,_0xdc806d){const _0x19f146=a180_0x3687,_0x58f139=_0x218885();while(!![]){try{const _0x3b9ab2=-parseInt(_0x19f146(0x8c))/0x1*(parseInt(_0x19f146(0x80))/0x2)+parseInt(_0x19f146(0x8a))/0x3*(-parseInt(_0x19f146(0x84))/0x4)+-parseInt(_0x19f146(0x8d))/0x5+-parseInt(_0x19f146(0x7f))/0x6+-parseInt(_0x19f146(0x7c))/0x7*(parseInt(_0x19f146(0x88))/0x8)+parseInt(_0x19f146(0x86))/0x9+parseInt(_0x19f146(0x82))/0xa*(parseInt(_0x19f146(0x81))/0xb);if(_0x3b9ab2===_0xdc806d)break;else _0x58f139['push'](_0x58f139['shift']());}catch(_0x1c4d41){_0x58f139['push'](_0x58f139['shift']());}}}(a180_0x5e62,0x242af));function a180_0x3687(_0x4645dd,_0xcae26d){_0x4645dd=_0x4645dd-0x7a;const _0x5e6273=a180_0x5e62();let _0x3687b6=_0x5e6273[_0x4645dd];return _0x3687b6;}import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':'role','command':a180_0x176137(0x8b),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a180_0x176137(0x7e),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x578096){const _0x437bb2=a180_0x176137,{mutation:_0x4187f5}=await prepareUserMutation(_0x578096,'user-remove',!![]);return asDryRunResult(_0x4187f5,{'method':_0x437bb2(0x8e),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x15c508){const _0x516086=a180_0x176137,{matchingRelationIds:_0xb038c7,mutation:_0x20e7ca,changed:_0x5f1e08}=await prepareUserMutation(_0x15c508,_0x516086(0x8b),![]);if(_0x5f1e08)for(const _0x1a8136 of _0xb038c7){await deleteDevUserRole(_0x1a8136);}return{'ok':!![],'data':_0x20e7ca,'message':_0x5f1e08?_0x516086(0x89)+_0x20e7ca[_0x516086(0x85)][_0x516086(0x7b)]+_0x516086(0x83)+_0x20e7ca[_0x516086(0x85)][_0x516086(0x87)]:_0x516086(0x7a)+_0x20e7ca[_0x516086(0x85)]['userId']+_0x516086(0x7d)+_0x20e7ca[_0x516086(0x85)][_0x516086(0x87)]};}};function a180_0x5e62(){const _0x56591f=['1315458hbGaUi','roleName','600bHXeYm','Removed\x20user\x20','3wmczWn','user-remove','21LoZZHr','617995dkjhPu','POST','No\x20change:\x20user\x20','userId','16289JRYoKT','\x20not\x20in\x20role\x20','high-risk-write','358776SsHKXz','9602sbfvof','77jJNYrG','700830MakGuu','\x20from\x20role\x20','119436pQpkNL','selector'];a180_0x5e62=function(){return _0x56591f;};return a180_0x5e62();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a181_0x463809=a181_0x23c0;(function(_0x21994c,_0x2d2b22){const _0x315d42=a181_0x23c0,_0x20aa9c=_0x21994c();while(!![]){try{const _0x93058d=-parseInt(_0x315d42(0x1ce))/0x1*(-parseInt(_0x315d42(0x1c6))/0x2)+parseInt(_0x315d42(0x1c3))/0x3*(parseInt(_0x315d42(0x1c5))/0x4)+-parseInt(_0x315d42(0x1d8))/0x5+parseInt(_0x315d42(0x1c2))/0x6*(parseInt(_0x315d42(0x1d4))/0x7)+-parseInt(_0x315d42(0x1cc))/0x8*(-parseInt(_0x315d42(0x1cb))/0x9)+parseInt(_0x315d42(0x1c7))/0xa+-parseInt(_0x315d42(0x1c0))/0xb*(parseInt(_0x315d42(0x1c4))/0xc);if(_0x93058d===_0x2d2b22)break;else _0x20aa9c['push'](_0x20aa9c['shift']());}catch(_0x423152){_0x20aa9c['push'](_0x20aa9c['shift']());}}}(a181_0x4779,0x6e045));import{CliErrors}from'../../errors.js';function a181_0x4779(){const _0x486bcf=['24932bnqIok','flagMissing','\x22\x20→\x20userId\x20','name','Pass\x20--name\x20<nickname|username>.','Resolved\x20\x22','182wKwfCA','username','trim','userId','3174330kgnhyH','11PbzBtI','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','3456hGVoxJ','1899507nhBUvH','6551976SyIKuA','4VGoiBE','26xRzsGy','106800sXfnYL','read','nickname','str','15948GqrtXP','2928KqozQm','user-resolve'];a181_0x4779=function(){return _0x486bcf;};return a181_0x4779();}function a181_0x23c0(_0x2b6283,_0x45626e){_0x2b6283=_0x2b6283-0x1c0;const _0x47799d=a181_0x4779();let _0x23c03b=_0x47799d[_0x2b6283];return _0x23c03b;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':'role','command':a181_0x463809(0x1cd),'description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a181_0x463809(0x1c8),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2a89cb){const _0xea2190=a181_0x463809;if(!_0x2a89cb[_0xea2190(0x1ca)](_0xea2190(0x1d1))[_0xea2190(0x1d6)]())throw CliErrors[_0xea2190(0x1cf)](_0xea2190(0x1d1),_0xea2190(0x1d2));},async 'execute'(_0x112ba6){const _0x503bf4=a181_0x463809,_0x38b17e=_0x112ba6['str'](_0x503bf4(0x1d1))['trim'](),_0x5f105a=await resolveUserRef(_0x38b17e,_0x503bf4(0x1c1));return{'ok':!![],'data':{'user':{'userId':_0x5f105a[_0x503bf4(0x1d7)],'username':_0x5f105a[_0x503bf4(0x1d5)],'nickname':_0x5f105a[_0x503bf4(0x1c9)],'matchedBy':_0x5f105a['matchedBy']}},'message':_0x503bf4(0x1d3)+_0x38b17e+_0x503bf4(0x1d0)+_0x5f105a['userId']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a182_0x5ad14a=a182_0x15e2;function a182_0x15e2(_0x3f05a2,_0x387af0){_0x3f05a2=_0x3f05a2-0x173;const _0x3b521d=a182_0x3b52();let _0x15e2a2=_0x3b521d[_0x3f05a2];return _0x15e2a2;}(function(_0x236e2d,_0x1b56ba){const _0x1bfdf3=a182_0x15e2,_0x60e152=_0x236e2d();while(!![]){try{const _0x92fe52=parseInt(_0x1bfdf3(0x1a3))/0x1+parseInt(_0x1bfdf3(0x199))/0x2*(parseInt(_0x1bfdf3(0x17d))/0x3)+-parseInt(_0x1bfdf3(0x1a1))/0x4+parseInt(_0x1bfdf3(0x17f))/0x5*(parseInt(_0x1bfdf3(0x184))/0x6)+parseInt(_0x1bfdf3(0x176))/0x7+parseInt(_0x1bfdf3(0x1a7))/0x8+-parseInt(_0x1bfdf3(0x1b0))/0x9;if(_0x92fe52===_0x1b56ba)break;else _0x60e152['push'](_0x60e152['shift']());}catch(_0x36ff64){_0x60e152['push'](_0x60e152['shift']());}}}(a182_0x3b52,0xb4bd1));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';function a182_0x3b52(){const _0x3be995=['has','cwd','boolean','build','bun','yarn','inherit','No\x20scripts\x20defined\x20in\x20package.json.','needsUpgrade','Script\x20\x22','write','Enable\x20watch\x20mode\x20for\x20preview','\x0a\x20\x20Available\x20scripts:\x0a','package.json','15188jzLAYh','utf-8','pnpm-lock.yaml','watch','vite','run','\x20\x20\x20\x20','length','3806672oMJRMp','bool','685414RmAmgj','push','Available:\x20','\x20exited\x20with\x20code\x20','6392800USSxdK','\x20run\x20<script>\x0a','bun.lockb','yarn.lock','close','\x20run\x20','\x22\x20not\x20found\x20in\x20package.json.','Script\x20name\x20defined\x20in\x20package.json','keys','18996795ctiGlE','\x0a\x20\x20Usage:\x20','vite\x20preview\x20exited\x20with\x20code\x20','all','\x20run\x20preview\x20--watch','node_modules','4901666OtueFM','log','slice','join','No\x20package.json\x20found\x20in\x20current\x20directory.','start','scripts','159JgMrtd','.bin','62015MTFxZr','parse','\x20run\x20preview','(none)','\x20run\x20start','588OTlvzD','dev','--watch','error','validation','preview','bun.lock'];a182_0x3b52=function(){return _0x3be995;};return a182_0x3b52();}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([a182_0x5ad14a(0x17b),a182_0x5ad14a(0x185)]);function readPackageScripts(_0x478b70){const _0x555dde=a182_0x5ad14a,_0x56149d=resolve(_0x478b70,_0x555dde(0x198));if(!existsSync(_0x56149d))return null;try{const _0x1daaf0=JSON[_0x555dde(0x180)](readFileSync(_0x56149d,_0x555dde(0x19a)));return _0x1daaf0[_0x555dde(0x17c)]??{};}catch{return null;}}function detectPackageManager(_0x1f50ec){const _0x5c8c2b=a182_0x5ad14a;if(existsSync(resolve(_0x1f50ec,_0x5c8c2b(0x1a9)))||existsSync(resolve(_0x1f50ec,_0x5c8c2b(0x18a))))return _0x5c8c2b(0x18f);if(existsSync(resolve(_0x1f50ec,_0x5c8c2b(0x19b))))return'pnpm';if(existsSync(resolve(_0x1f50ec,_0x5c8c2b(0x1aa))))return _0x5c8c2b(0x190);return'npm';}async function versionCheck(_0x5a65be){const _0x3f2058=a182_0x5ad14a,_0x4450c4=await checkCliVersion();(_0x4450c4[_0x3f2058(0x193)]||_0x4450c4['belowMinimum'])&&(printCliUpgradeWarning(_0x4450c4),assertCliVersionSupported(_0x4450c4));const _0x356c0e=await checkSdkVersion(_0x5a65be);if(_0x356c0e[_0x3f2058(0x193)])printSdkUpgradeWarning(_0x356c0e);}function spawnScript(_0x336413,_0x30c1e8,_0x59d267,_0x376add){return new Promise((_0x3ab8ac,_0x4000ac)=>{const _0xccaa33=a182_0x15e2,_0x59edcb=[_0xccaa33(0x19e),_0x30c1e8,..._0x59d267],_0x1399f6=spawn(_0x336413,_0x59edcb,{'cwd':_0x376add,'stdio':_0xccaa33(0x191),'shell':!![],'env':{...process.env,'PATH':''+join(_0x376add,_0xccaa33(0x175),_0xccaa33(0x17e))+delimiter+process.env.PATH}});_0x1399f6['on'](_0xccaa33(0x1ab),_0x4d1f15=>{const _0x2e75b1=_0xccaa33;if(_0x4d1f15===0x0||_0x4d1f15===null)_0x3ab8ac();else _0x4000ac(new Error(_0x336413+_0x2e75b1(0x1ac)+_0x30c1e8+_0x2e75b1(0x1a6)+_0x4d1f15));}),_0x1399f6['on'](_0xccaa33(0x187),_0x4000ac);});}function spawnViteBuildWatch(_0x56c1da){return new Promise((_0x114546,_0x5eab9e)=>{const _0x5503d8=a182_0x15e2,_0x2b432c=spawn('vite',[_0x5503d8(0x18e),_0x5503d8(0x186)],{'cwd':_0x56c1da,'stdio':_0x5503d8(0x191),'shell':!![],'env':{...process.env,'PATH':''+join(_0x56c1da,_0x5503d8(0x175),_0x5503d8(0x17e))+delimiter+process.env.PATH}});_0x2b432c['on']('close',_0x5785d1=>{if(_0x5785d1===0x0||_0x5785d1===null)_0x114546();else _0x5eab9e(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x5785d1));}),_0x2b432c['on']('error',_0x5eab9e);});}function spawnVitePreview(_0x43f7ae){return new Promise((_0x2b73c5,_0x16aecd)=>{const _0x39070f=a182_0x15e2,_0x13be73=spawn(_0x39070f(0x19d),[_0x39070f(0x189)],{'cwd':_0x43f7ae,'stdio':_0x39070f(0x191),'shell':!![],'env':{...process.env,'PATH':''+join(_0x43f7ae,_0x39070f(0x175),_0x39070f(0x17e))+delimiter+process.env.PATH}});_0x13be73['on'](_0x39070f(0x1ab),_0x16359a=>{const _0x30f5ad=_0x39070f;if(_0x16359a===0x0||_0x16359a===null)_0x2b73c5();else _0x16aecd(new Error(_0x30f5ad(0x1b2)+_0x16359a));}),_0x13be73['on']('error',_0x16aecd);});}const runFlags=[{'name':'watch','type':a182_0x5ad14a(0x18d),'description':a182_0x5ad14a(0x196),'default':![]}];export const runDefinition={'service':a182_0x5ad14a(0x19e),'command':a182_0x5ad14a(0x19e),'description':'Run\x20a\x20package.json\x20script','risk':a182_0x5ad14a(0x195),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a182_0x5ad14a(0x1ae),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x542351=a182_0x5ad14a,_0x2c3a0c=[];return _0x2c3a0c['push']('\x20\x20EXAMPLES'),_0x2c3a0c[_0x542351(0x1a4)](_0x542351(0x19f)+CLI_BIN_NAME+_0x542351(0x183)),_0x2c3a0c[_0x542351(0x1a4)](_0x542351(0x19f)+CLI_BIN_NAME+'\x20run\x20build'),_0x2c3a0c[_0x542351(0x1a4)](_0x542351(0x19f)+CLI_BIN_NAME+_0x542351(0x181)),_0x2c3a0c['push'](_0x542351(0x19f)+CLI_BIN_NAME+_0x542351(0x174)),_0x2c3a0c[_0x542351(0x179)]('\x0a');},async 'execute'(_0x42c5c2){const _0x3f0dc5=a182_0x5ad14a,_0x37a0c7=process[_0x3f0dc5(0x18c)](),_0x36ae6c=_0x42c5c2['args'][0x0],_0x262b5d=_0x42c5c2['args'][_0x3f0dc5(0x178)](0x1),_0x3e8f70=readPackageScripts(_0x37a0c7);if(!_0x3e8f70)throw CliErrors[_0x3f0dc5(0x188)](_0x3f0dc5(0x17a));if(!_0x36ae6c){const _0x416533=Object[_0x3f0dc5(0x1af)](_0x3e8f70);if(_0x416533[_0x3f0dc5(0x1a0)]===0x0)console[_0x3f0dc5(0x177)](_0x3f0dc5(0x192));else{console['log'](_0x3f0dc5(0x197));for(const _0x6e71a5 of _0x416533){console[_0x3f0dc5(0x177)]('\x20\x20\x20\x20'+_0x6e71a5);}console[_0x3f0dc5(0x177)](_0x3f0dc5(0x1b1)+CLI_BIN_NAME+_0x3f0dc5(0x1a8));}return{'ok':!![]};}if(!_0x3e8f70[_0x36ae6c])throw CliErrors['validation'](_0x3f0dc5(0x194)+_0x36ae6c+_0x3f0dc5(0x1ad),_0x3f0dc5(0x1a5)+(Object[_0x3f0dc5(0x1af)](_0x3e8f70)['join'](',\x20')||_0x3f0dc5(0x182)));const _0x29d1f7=detectPackageManager(_0x37a0c7);VERSION_CHECK_SCRIPTS[_0x3f0dc5(0x18b)](_0x36ae6c)&&await versionCheck(_0x37a0c7);if(_0x36ae6c===_0x3f0dc5(0x189)&&_0x42c5c2[_0x3f0dc5(0x1a2)](_0x3f0dc5(0x19c)))return await Promise[_0x3f0dc5(0x173)]([spawnViteBuildWatch(_0x37a0c7),spawnVitePreview(_0x37a0c7)]),{'ok':!![]};return await spawnScript(_0x29d1f7,_0x36ae6c,_0x262b5d,_0x37a0c7),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a183_0x4edf(_0x1df2b9,_0xe5952d){_0x1df2b9=_0x1df2b9-0x17d;const _0x590db7=a183_0x590d();let _0x4edfdb=_0x590db7[_0x1df2b9];return _0x4edfdb;}function a183_0x590d(){const _0xb238e8=['json','2081970tQMmVR','schema','export','read','226604cMmdWa','343317sMvkNF','2OzcoiK','565HhmwRA','4113uiDytD','172446JrWFOw','4088dezZKs','1073730TLTwbn','8310uutXfU'];a183_0x590d=function(){return _0xb238e8;};return a183_0x590d();}const a183_0x2405ff=a183_0x4edf;(function(_0x485fd9,_0x154315){const _0x3d511a=a183_0x4edf,_0x9fb4fa=_0x485fd9();while(!![]){try{const _0x1bc094=parseInt(_0x3d511a(0x189))/0x1+parseInt(_0x3d511a(0x186))/0x2*(parseInt(_0x3d511a(0x185))/0x3)+-parseInt(_0x3d511a(0x184))/0x4+parseInt(_0x3d511a(0x187))/0x5*(parseInt(_0x3d511a(0x17e))/0x6)+-parseInt(_0x3d511a(0x17d))/0x7+-parseInt(_0x3d511a(0x18a))/0x8*(-parseInt(_0x3d511a(0x188))/0x9)+-parseInt(_0x3d511a(0x180))/0xa;if(_0x1bc094===_0x154315)break;else _0x9fb4fa['push'](_0x9fb4fa['shift']());}catch(_0x963083){_0x9fb4fa['push'](_0x9fb4fa['shift']());}}}(a183_0x590d,0x3f277));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x2654b2){const _0x2ec945=await buildSchemaPayload();return{'ok':!![],'data':_0x2ec945};}export const schemaDefinition={'service':a183_0x2405ff(0x181),'command':a183_0x2405ff(0x182),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a183_0x2405ff(0x183),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a183_0x2405ff(0x17f),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a184_0x5c8d18=a184_0x5be2;(function(_0x58a7a5,_0x27613b){const _0x412922=a184_0x5be2,_0x1f03cc=_0x58a7a5();while(!![]){try{const _0xb117d2=parseInt(_0x412922(0xfa))/0x1+parseInt(_0x412922(0x110))/0x2*(-parseInt(_0x412922(0x10a))/0x3)+parseInt(_0x412922(0x116))/0x4+-parseInt(_0x412922(0x125))/0x5*(-parseInt(_0x412922(0x11e))/0x6)+parseInt(_0x412922(0x11d))/0x7*(-parseInt(_0x412922(0x119))/0x8)+parseInt(_0x412922(0x104))/0x9+-parseInt(_0x412922(0x127))/0xa;if(_0xb117d2===_0x27613b)break;else _0x1f03cc['push'](_0x1f03cc['shift']());}catch(_0x507c99){_0x1f03cc['push'](_0x1f03cc['shift']());}}}(a184_0x7615,0xc6587));function a184_0x7615(){const _0x23569f=['toISOString','stringify','Local\x20SQL\x20file\x20mode','join','number','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','isFinite','lockFilePath','10447965wjyfaE','mode','SELECT\x201\x20AS\x20id;','mybatisXml','str','MyBatis\x20XML\x20(mybatisXml)','30VbkMYJ','dbId\x20cannot\x20be\x20empty','__manual__','Created\x20SQL\x20query\x20','nonInteractive','length','65368ZEJuSy','string','flag','Invalid\x20database\x20selection\x20payload:\x20','description','Target\x20database\x20dbId:','820572YGeTwk','SQL\x20name\x20cannot\x20be\x20empty','new','1208yxkOwf','sql','trim','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','26579sZFnWS','66SRCmzZ','sqlRootDir','</select>','sqlName','dbId','SQL\x20query\x20display\x20name','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','244295esBVNy','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','13526460dYLyhw','flagMissing','dbId\x20must\x20be\x20a\x20positive\x20integer','db-id','Plain\x20SQL\x20(sql)','appCode','utf8','sqlCode','name','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','catch','lastSync','Select\x20the\x20local\x20SQL\x20mode:','isInteger','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','create','validation','✎\x20Enter\x20dbId\x20manually','1161779KtJtfm'];a184_0x7615=function(){return _0x23569f;};return a184_0x7615();}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 a184_0x5be2(_0x189079,_0x38f801){_0x189079=_0x189079-0xf2;const _0x76156a=a184_0x7615();let _0x5be208=_0x76156a[_0x189079];return _0x5be208;}function generateSqlTemplate(_0x236ae9){const _0x299fa7=a184_0x5be2;if(_0x236ae9===_0x299fa7(0x107))return[_0x299fa7(0x124),'\x20\x20SELECT\x201\x20AS\x20id',_0x299fa7(0x120),''][_0x299fa7(0xfe)]('\x0a');return[_0x299fa7(0x106),''][_0x299fa7(0xfe)]('\x0a');}export const sqlCreate={'service':'sql','command':a184_0x5c8d18(0xf7),'description':a184_0x5c8d18(0x126),'risk':'write','flags':[{'name':a184_0x5c8d18(0x12f),'type':a184_0x5c8d18(0x111),'description':a184_0x5c8d18(0x123)},{'name':a184_0x5c8d18(0x12a),'type':a184_0x5c8d18(0xff),'description':'Target\x20database\x20ID'},{'name':a184_0x5c8d18(0x105),'type':a184_0x5c8d18(0x111),'enum':[a184_0x5c8d18(0x11a),a184_0x5c8d18(0x107)],'description':a184_0x5c8d18(0xfd)}],async 'validate'(_0x2d64b2){const _0x22e0e4=a184_0x5c8d18;if(!_0x2d64b2[_0x22e0e4(0x10e)])return;if(!_0x2d64b2[_0x22e0e4(0x108)](_0x22e0e4(0x12f))[_0x22e0e4(0x11b)]())throw CliErrors[_0x22e0e4(0x128)](_0x22e0e4(0x12f),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x10b308=resolveProvidedDbId(_0x2d64b2);if(typeof _0x10b308!==_0x22e0e4(0xff)||!Number[_0x22e0e4(0x102)](_0x10b308)||_0x10b308<=0x0)throw CliErrors[_0x22e0e4(0x128)](_0x22e0e4(0x12a),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x2d64b2[_0x22e0e4(0x108)](_0x22e0e4(0x105))[_0x22e0e4(0x11b)]())throw CliErrors[_0x22e0e4(0x128)](_0x22e0e4(0x105),_0x22e0e4(0x130));},async 'dryRun'(_0x5ad1c1){const _0x1a80cb=a184_0x5c8d18,_0x163052=loadSqlProjectConfig(_0x5ad1c1[_0x1a80cb(0x12c)]),{sqlName:_0x3ddae8,dbId:_0x152112,dbName:_0xd4172e,mode:_0x3d2f69}=await resolveSqlNewInputs(_0x5ad1c1),_0x9270ed=buildSqlRelativePath('<server-generated-sqlCode>',_0x3ddae8,_0xd4172e,_0x3d2f69,_0x152112),_0x10ff03=_0x163052['sqlRootDir']+'/'+_0x9270ed;return{'method':'POST','url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x5ad1c1[_0x1a80cb(0x12c)],'sqlName':_0x3ddae8,'dbId':_0x152112,'mode':_0x3d2f69,'localPath':_0x10ff03},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x163052[_0x1a80cb(0x11f)]};},async 'execute'(_0x4acd66){const _0x2f329a=a184_0x5c8d18,_0x88b897=loadSqlProjectConfig(_0x4acd66[_0x2f329a(0x12c)]),{sqlName:_0x15c7c9,dbId:_0x478617,dbName:_0x3c8108,mode:_0x483bd}=await resolveSqlNewInputs(_0x4acd66),_0x2f33ad=generateSqlTemplate(_0x483bd),_0x345527=await createSqlQuery({'appCode':_0x4acd66[_0x2f329a(0x12c)],'sqlName':_0x15c7c9,'dbId':_0x478617,'sqlContent':_0x2f33ad}),_0xa80dd9=ensureRemoteSqlContent(_0x345527),_0x2d541b=_0x3c8108||await getDbName(_0x4acd66[_0x2f329a(0x12c)],_0x478617)[_0x2f329a(0xf2)](()=>undefined),_0x19cd6d=buildSqlRelativePath(_0x345527[_0x2f329a(0x12e)],_0x345527[_0x2f329a(0x121)],_0x2d541b,_0x483bd,_0x478617),_0x47d6e1=_0x88b897['sqlRootDir']+'/'+_0x19cd6d,_0x37f39e=buildLocalSqlFileContent({'sqlCode':_0x345527[_0x2f329a(0x12e)],'sqlName':_0x345527[_0x2f329a(0x121)],'dbId':_0x345527[_0x2f329a(0x122)]},_0xa80dd9,{'dbName':_0x2d541b,'mode':_0x483bd,'syncedAt':new Date()['toISOString'](),'description':_0x345527[_0x2f329a(0x114)]});if(await fileExists(_0x47d6e1))throw CliErrors[_0x2f329a(0xf8)]('File\x20already\x20exists:\x20'+_0x47d6e1);await ensureParentDirectory(_0x47d6e1),await writeFile(_0x47d6e1,_0x37f39e,_0x2f329a(0x12d));const _0x392323=await readSqlLockFile(_0x88b897[_0x2f329a(0x103)]),{lockData:_0x2a7c3e,appLock:_0x12029f}=ensureSqlLockScope(_0x392323??createEmptySqlLock(),_0x88b897['appCode'],_0x88b897['sqlRoot'],_0x2f329a(0x118));return _0x12029f['sqls'][_0x345527[_0x2f329a(0x12e)]]={...buildSqlLockEntry(_0x345527,_0xa80dd9,computeSqlContentHash(_0x37f39e),{'dbName':_0x2d541b}),'path':_0x19cd6d,'mode':_0x483bd},_0x12029f[_0x2f329a(0xf3)]=new Date()[_0x2f329a(0xfb)](),await writeSqlLockFile(_0x88b897[_0x2f329a(0x103)],_0x2a7c3e),{'ok':!![],'data':{'id':_0x345527['id'],'sqlCode':_0x345527[_0x2f329a(0x12e)],'sqlName':_0x345527[_0x2f329a(0x121)],'dbId':_0x345527[_0x2f329a(0x122)],'path':_0x47d6e1,'mode':_0x483bd},'message':_0x2f329a(0x10d)+_0x345527['sqlCode']};}};async function resolveSqlNewInputs(_0x34e68d){const _0x4f5188=await resolveSqlNameInput(_0x34e68d),{dbId:_0x45d6d9,dbName:_0x5edc64}=await resolveDbSelection(_0x34e68d),_0x56511f=await resolveSqlModeInput(_0x34e68d);return{'sqlName':_0x4f5188,'dbId':_0x45d6d9,'dbName':_0x5edc64,'mode':_0x56511f};}async function resolveSqlNameInput(_0x213f4d){const _0x4c3498=a184_0x5c8d18,_0x4486b2=_0x213f4d[_0x4c3498(0x108)]('name')['trim']();if(_0x4486b2)return _0x4486b2;if(_0x213f4d[_0x4c3498(0x10e)])throw CliErrors[_0x4c3498(0x128)](_0x4c3498(0x12f),_0x4c3498(0x100));return(await input({'message':'SQL\x20name:','validate':_0x3aa057=>_0x3aa057[_0x4c3498(0x11b)]()?!![]:_0x4c3498(0x117)}))[_0x4c3498(0x11b)]();}async function resolveDbSelection(_0x1d5837){const _0x24d15f=a184_0x5c8d18,_0x43aa38=resolveProvidedDbId(_0x1d5837);if(typeof _0x43aa38===_0x24d15f(0xff)&&Number[_0x24d15f(0x102)](_0x43aa38)&&_0x43aa38>0x0)return{'dbId':_0x43aa38,'dbName':await getDbName(_0x1d5837[_0x24d15f(0x12c)],_0x43aa38)['catch'](()=>undefined)};if(_0x1d5837[_0x24d15f(0x10e)])throw CliErrors[_0x24d15f(0x128)](_0x24d15f(0x12a),_0x24d15f(0x11c));const _0x43e5c7=await listDatabases(_0x1d5837[_0x24d15f(0x12c)])[_0x24d15f(0xf2)](()=>[]);if(_0x43e5c7[_0x24d15f(0x10f)]===0x1)return{'dbId':_0x43e5c7[0x0][_0x24d15f(0x122)],'dbName':_0x43e5c7[0x0][_0x24d15f(0x101)]};if(_0x43e5c7[_0x24d15f(0x10f)]>0x1){const _0x2ca3b8=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x43e5c7['map'](_0x17952d=>({'name':_0x17952d[_0x24d15f(0x101)]+'\x20('+_0x17952d[_0x24d15f(0x122)]+')','value':serializeDbSelection(_0x17952d)})),{'name':_0x24d15f(0xf9),'value':_0x24d15f(0x10c)}]});if(_0x2ca3b8!==_0x24d15f(0x10c))return deserializeDbSelection(_0x2ca3b8);}const _0x5a278b=await input({'message':_0x24d15f(0x115),'validate':_0x501ff7=>{const _0x155ab1=_0x24d15f,_0x2c0e31=_0x501ff7[_0x155ab1(0x11b)]();if(!_0x2c0e31)return _0x155ab1(0x10b);const _0x14d69d=Number(_0x2c0e31);if(!Number[_0x155ab1(0xf5)](_0x14d69d)||_0x14d69d<=0x0)return _0x155ab1(0x129);return!![];}});return{'dbId':Number(_0x5a278b[_0x24d15f(0x11b)]())};}async function resolveSqlModeInput(_0x21f2d5){const _0x3ab853=a184_0x5c8d18,_0x34c712=_0x21f2d5[_0x3ab853(0x108)](_0x3ab853(0x105))['trim']();if(_0x34c712===_0x3ab853(0x11a)||_0x34c712===_0x3ab853(0x107))return _0x34c712;if(_0x21f2d5['nonInteractive'])throw CliErrors['flagMissing'](_0x3ab853(0x105),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x3ab853(0xf4),'choices':[{'name':_0x3ab853(0x12b),'value':_0x3ab853(0x11a),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x3ab853(0x109),'value':'mybatisXml','description':_0x3ab853(0xf6)}]});}function serializeDbSelection(_0x577b98){const _0x16bbc0=a184_0x5c8d18;return JSON[_0x16bbc0(0xfc)]({'dbId':_0x577b98['dbId'],'dbName':_0x577b98[_0x16bbc0(0x101)]});}function deserializeDbSelection(_0x56ae6d){const _0x33c03a=a184_0x5c8d18;try{const _0xd857c7=JSON['parse'](_0x56ae6d);if(typeof _0xd857c7[_0x33c03a(0x122)]===_0x33c03a(0xff)&&Number[_0x33c03a(0x102)](_0xd857c7[_0x33c03a(0x122)]))return{'dbId':_0xd857c7['dbId'],'dbName':_0xd857c7['dbName']};}catch{}throw CliErrors[_0x33c03a(0xf8)](_0x33c03a(0x113)+_0x56ae6d);}function resolveProvidedDbId(_0x85b08c){const _0xdaa60e=a184_0x5c8d18,_0x56a269=_0x85b08c[_0xdaa60e(0x112)]('db-id');if(typeof _0x56a269==='number'&&Number[_0xdaa60e(0x102)](_0x56a269))return _0x56a269;return undefined;}
|
|
1
|
+
function a184_0x13fa(){const _0x51fdf7=['132IPMbZC','utf8','✎\x20Enter\x20dbId\x20manually','trim','validation','MyBatis\x20XML\x20(mybatisXml)','sqlCode','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','lockFilePath','sqlName','mode','dbId\x20cannot\x20be\x20empty','name','write','mybatisXml','File\x20already\x20exists:\x20','SQL\x20query\x20display\x20name','dbId\x20must\x20be\x20a\x20positive\x20integer','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','9JbEGiB','join','Local\x20SQL\x20file\x20mode','POST','</select>','appCode','toISOString','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','nonInteractive','17935YJBnUA','890028nFlmDw','Target\x20database\x20ID','flagMissing','7ydvhvr','Select\x20the\x20local\x20SQL\x20mode:','SELECT\x201\x20AS\x20id;','sql','sqlRoot','db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Target\x20database\x20dbId:','create','dbId','new','string','37130PtQsyi','sqlRootDir','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','/smartapi/custom/saveUserCustomSql','length','\x20\x20SELECT\x201\x20AS\x20id','SQL\x20name:','Created\x20SQL\x20query\x20','number','flag','598899nxDnQy','SQL\x20name\x20cannot\x20be\x20empty','5644740aShzjW','isInteger','Select\x20the\x20target\x20database:','__manual__','description','150960YppQNv','145204EjmrzK','parse','catch','dbName','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Invalid\x20database\x20selection\x20payload:\x20','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','isFinite'];a184_0x13fa=function(){return _0x51fdf7;};return a184_0x13fa();}const a184_0x698090=a184_0x4380;function a184_0x4380(_0x1a5907,_0xda1138){_0x1a5907=_0x1a5907-0x1ad;const _0x13fa7b=a184_0x13fa();let _0x4380c0=_0x13fa7b[_0x1a5907];return _0x4380c0;}(function(_0x45c37b,_0x5afdd5){const _0x5d540a=a184_0x4380,_0x656a91=_0x45c37b();while(!![]){try{const _0x33c701=-parseInt(_0x5d540a(0x1be))/0x1+parseInt(_0x5d540a(0x1d1))/0x2+-parseInt(_0x5d540a(0x1c9))/0x3+parseInt(_0x5d540a(0x1d9))/0x4*(-parseInt(_0x5d540a(0x1ae))/0x5)+-parseInt(_0x5d540a(0x1af))/0x6+parseInt(_0x5d540a(0x1b2))/0x7*(-parseInt(_0x5d540a(0x1d0))/0x8)+-parseInt(_0x5d540a(0x1ec))/0x9*(-parseInt(_0x5d540a(0x1cb))/0xa);if(_0x33c701===_0x5afdd5)break;else _0x656a91['push'](_0x656a91['shift']());}catch(_0x5a96f0){_0x656a91['push'](_0x656a91['shift']());}}}(a184_0x13fa,0x1c02e));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x46c07a){const _0xe1052f=a184_0x4380;if(_0x46c07a===_0xe1052f(0x1e7))return[_0xe1052f(0x1f3),_0xe1052f(0x1c4),_0xe1052f(0x1f0),'']['join']('\x0a');return[_0xe1052f(0x1b4),''][_0xe1052f(0x1ed)]('\x0a');}export const sqlCreate={'service':a184_0x698090(0x1b5),'command':a184_0x698090(0x1ba),'description':a184_0x698090(0x1d5),'risk':a184_0x698090(0x1e6),'flags':[{'name':a184_0x698090(0x1e5),'type':a184_0x698090(0x1bd),'description':a184_0x698090(0x1e9)},{'name':a184_0x698090(0x1b7),'type':a184_0x698090(0x1c7),'description':a184_0x698090(0x1b0)},{'name':a184_0x698090(0x1e3),'type':a184_0x698090(0x1bd),'enum':['sql',a184_0x698090(0x1e7)],'description':a184_0x698090(0x1ee)}],async 'validate'(_0x415025){const _0x3bfe75=a184_0x698090;if(!_0x415025[_0x3bfe75(0x1ad)])return;if(!_0x415025['str'](_0x3bfe75(0x1e5))[_0x3bfe75(0x1dc)]())throw CliErrors['flagMissing'](_0x3bfe75(0x1e5),_0x3bfe75(0x1d7));const _0x47ae1e=resolveProvidedDbId(_0x415025);if(typeof _0x47ae1e!==_0x3bfe75(0x1c7)||!Number[_0x3bfe75(0x1d8)](_0x47ae1e)||_0x47ae1e<=0x0)throw CliErrors[_0x3bfe75(0x1b1)](_0x3bfe75(0x1b7),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x415025[_0x3bfe75(0x1c0)](_0x3bfe75(0x1e3))[_0x3bfe75(0x1dc)]())throw CliErrors['flagMissing']('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x4b283d){const _0x110d14=a184_0x698090,_0x5b9df8=loadSqlProjectConfig(_0x4b283d[_0x110d14(0x1f1)]),{sqlName:_0x2a4d6d,dbId:_0x4008e1,dbName:_0x3cc21b,mode:_0x1391f1}=await resolveSqlNewInputs(_0x4b283d),_0x2b59c1=buildSqlRelativePath('<server-generated-sqlCode>',_0x2a4d6d,_0x3cc21b,_0x1391f1,_0x4008e1),_0x45ddd=_0x5b9df8[_0x110d14(0x1bf)]+'/'+_0x2b59c1;return{'method':_0x110d14(0x1ef),'url':_0x110d14(0x1c2),'body':{'appCode':_0x4b283d[_0x110d14(0x1f1)],'sqlName':_0x2a4d6d,'dbId':_0x4008e1,'mode':_0x1391f1,'localPath':_0x45ddd},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x5b9df8[_0x110d14(0x1bf)]};},async 'execute'(_0x2a9a45){const _0x58cc3c=a184_0x698090,_0x5f40e6=loadSqlProjectConfig(_0x2a9a45[_0x58cc3c(0x1f1)]),{sqlName:_0x31cb44,dbId:_0x2975b8,dbName:_0xf56a6c,mode:_0x1d1cc0}=await resolveSqlNewInputs(_0x2a9a45),_0x4db404=generateSqlTemplate(_0x1d1cc0),_0x5410c=await createSqlQuery({'appCode':_0x2a9a45[_0x58cc3c(0x1f1)],'sqlName':_0x31cb44,'dbId':_0x2975b8,'sqlContent':_0x4db404}),_0x306a99=ensureRemoteSqlContent(_0x5410c),_0x2bfa4d=_0xf56a6c||await getDbName(_0x2a9a45[_0x58cc3c(0x1f1)],_0x2975b8)[_0x58cc3c(0x1d3)](()=>undefined),_0x3607c1=buildSqlRelativePath(_0x5410c[_0x58cc3c(0x1df)],_0x5410c[_0x58cc3c(0x1e2)],_0x2bfa4d,_0x1d1cc0,_0x2975b8),_0x17b426=_0x5f40e6[_0x58cc3c(0x1bf)]+'/'+_0x3607c1,_0x16e8a3=buildLocalSqlFileContent({'sqlCode':_0x5410c[_0x58cc3c(0x1df)],'sqlName':_0x5410c[_0x58cc3c(0x1e2)],'dbId':_0x5410c[_0x58cc3c(0x1bb)]},_0x306a99,{'dbName':_0x2bfa4d,'mode':_0x1d1cc0,'syncedAt':new Date()[_0x58cc3c(0x1f2)](),'description':_0x5410c[_0x58cc3c(0x1cf)]});if(await fileExists(_0x17b426))throw CliErrors['validation'](_0x58cc3c(0x1e8)+_0x17b426);await ensureParentDirectory(_0x17b426),await writeFile(_0x17b426,_0x16e8a3,_0x58cc3c(0x1da));const _0x5918ef=await readSqlLockFile(_0x5f40e6[_0x58cc3c(0x1e1)]),{lockData:_0x410bdf,appLock:_0x2fe973}=ensureSqlLockScope(_0x5918ef??createEmptySqlLock(),_0x5f40e6['appCode'],_0x5f40e6[_0x58cc3c(0x1b6)],_0x58cc3c(0x1bc));return _0x2fe973['sqls'][_0x5410c[_0x58cc3c(0x1df)]]={...buildSqlLockEntry(_0x5410c,_0x306a99,computeSqlContentHash(_0x16e8a3),{'dbName':_0x2bfa4d}),'path':_0x3607c1,'mode':_0x1d1cc0},_0x2fe973['lastSync']=new Date()[_0x58cc3c(0x1f2)](),await writeSqlLockFile(_0x5f40e6[_0x58cc3c(0x1e1)],_0x410bdf),{'ok':!![],'data':{'id':_0x5410c['id'],'sqlCode':_0x5410c[_0x58cc3c(0x1df)],'sqlName':_0x5410c['sqlName'],'dbId':_0x5410c[_0x58cc3c(0x1bb)],'path':_0x17b426,'mode':_0x1d1cc0},'message':_0x58cc3c(0x1c6)+_0x5410c['sqlCode']};}};async function resolveSqlNewInputs(_0x5c4887){const _0x3fe2ad=await resolveSqlNameInput(_0x5c4887),{dbId:_0x42e2b6,dbName:_0x5ab92e}=await resolveDbSelection(_0x5c4887),_0x31742d=await resolveSqlModeInput(_0x5c4887);return{'sqlName':_0x3fe2ad,'dbId':_0x42e2b6,'dbName':_0x5ab92e,'mode':_0x31742d};}async function resolveSqlNameInput(_0x5b764d){const _0x3986c6=a184_0x698090,_0x98b215=_0x5b764d['str'](_0x3986c6(0x1e5))[_0x3986c6(0x1dc)]();if(_0x98b215)return _0x98b215;if(_0x5b764d['nonInteractive'])throw CliErrors[_0x3986c6(0x1b1)]('name',_0x3986c6(0x1d7));return(await input({'message':_0x3986c6(0x1c5),'validate':_0x2734bb=>_0x2734bb[_0x3986c6(0x1dc)]()?!![]:_0x3986c6(0x1ca)}))[_0x3986c6(0x1dc)]();}async function resolveDbSelection(_0x19d4f3){const _0x4b3651=a184_0x698090,_0x4c45bf=resolveProvidedDbId(_0x19d4f3);if(typeof _0x4c45bf==='number'&&Number[_0x4b3651(0x1d8)](_0x4c45bf)&&_0x4c45bf>0x0)return{'dbId':_0x4c45bf,'dbName':await getDbName(_0x19d4f3[_0x4b3651(0x1f1)],_0x4c45bf)[_0x4b3651(0x1d3)](()=>undefined)};if(_0x19d4f3[_0x4b3651(0x1ad)])throw CliErrors[_0x4b3651(0x1b1)](_0x4b3651(0x1b7),_0x4b3651(0x1b8));const _0x6a1f2a=await listDatabases(_0x19d4f3[_0x4b3651(0x1f1)])['catch'](()=>[]);if(_0x6a1f2a[_0x4b3651(0x1c3)]===0x1)return{'dbId':_0x6a1f2a[0x0][_0x4b3651(0x1bb)],'dbName':_0x6a1f2a[0x0][_0x4b3651(0x1d4)]};if(_0x6a1f2a['length']>0x1){const _0x4f2e32=await select({'message':_0x4b3651(0x1cd),'choices':[..._0x6a1f2a['map'](_0x3eae75=>({'name':_0x3eae75[_0x4b3651(0x1d4)]+'\x20('+_0x3eae75[_0x4b3651(0x1bb)]+')','value':serializeDbSelection(_0x3eae75)})),{'name':_0x4b3651(0x1db),'value':_0x4b3651(0x1ce)}]});if(_0x4f2e32!==_0x4b3651(0x1ce))return deserializeDbSelection(_0x4f2e32);}const _0x4020ea=await input({'message':_0x4b3651(0x1b9),'validate':_0x432ff5=>{const _0x2c1c22=_0x4b3651,_0x1dd7cd=_0x432ff5[_0x2c1c22(0x1dc)]();if(!_0x1dd7cd)return _0x2c1c22(0x1e4);const _0x352034=Number(_0x1dd7cd);if(!Number[_0x2c1c22(0x1cc)](_0x352034)||_0x352034<=0x0)return _0x2c1c22(0x1ea);return!![];}});return{'dbId':Number(_0x4020ea[_0x4b3651(0x1dc)]())};}async function resolveSqlModeInput(_0x3448a0){const _0x39c0f9=a184_0x698090,_0xfafe2a=_0x3448a0[_0x39c0f9(0x1c0)]('mode')['trim']();if(_0xfafe2a===_0x39c0f9(0x1b5)||_0xfafe2a===_0x39c0f9(0x1e7))return _0xfafe2a;if(_0x3448a0[_0x39c0f9(0x1ad)])throw CliErrors[_0x39c0f9(0x1b1)]('mode',_0x39c0f9(0x1c1));return await select({'message':_0x39c0f9(0x1b3),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x39c0f9(0x1b5),'description':_0x39c0f9(0x1e0)},{'name':_0x39c0f9(0x1de),'value':_0x39c0f9(0x1e7),'description':_0x39c0f9(0x1eb)}]});}function serializeDbSelection(_0x3faa06){return JSON['stringify']({'dbId':_0x3faa06['dbId'],'dbName':_0x3faa06['dbName']});}function deserializeDbSelection(_0xd9dc63){const _0x596054=a184_0x698090;try{const _0x1af83a=JSON[_0x596054(0x1d2)](_0xd9dc63);if(typeof _0x1af83a['dbId']===_0x596054(0x1c7)&&Number[_0x596054(0x1d8)](_0x1af83a[_0x596054(0x1bb)]))return{'dbId':_0x1af83a['dbId'],'dbName':_0x1af83a[_0x596054(0x1d4)]};}catch{}throw CliErrors[_0x596054(0x1dd)](_0x596054(0x1d6)+_0xd9dc63);}function resolveProvidedDbId(_0x1bd261){const _0x31bda0=a184_0x698090,_0x113931=_0x1bd261[_0x31bda0(0x1c8)](_0x31bda0(0x1b7));if(typeof _0x113931===_0x31bda0(0x1c7)&&Number[_0x31bda0(0x1d8)](_0x113931))return _0x113931;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a185_0x1eead5=a185_0x3ce6;(function(_0x32550d,_0x861079){const _0x27f741=a185_0x3ce6,_0x43d517=_0x32550d();while(!![]){try{const _0x361a19=parseInt(_0x27f741(0x1b1))/0x1*(-parseInt(_0x27f741(0x1a1))/0x2)+parseInt(_0x27f741(0x1ad))/0x3+-parseInt(_0x27f741(0x1b3))/0x4+-parseInt(_0x27f741(0x192))/0x5+-parseInt(_0x27f741(0x1a6))/0x6*(-parseInt(_0x27f741(0x1a7))/0x7)+parseInt(_0x27f741(0x194))/0x8+parseInt(_0x27f741(0x19e))/0x9*(parseInt(_0x27f741(0x1a9))/0xa);if(_0x361a19===_0x861079)break;else _0x43d517['push'](_0x43d517['shift']());}catch(_0x5ed5a4){_0x43d517['push'](_0x43d517['shift']());}}}(a185_0xe4ef,0x3d96d));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a185_0x3ce6(_0x5a2d53,_0x4f3f45){_0x5a2d53=_0x5a2d53-0x190;const _0xe4efa8=a185_0xe4ef();let _0x3ce669=_0xe4efa8[_0x5a2d53];return _0x3ce669;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a185_0x1eead5(0x1a0),'command':a185_0x1eead5(0x19c),'description':a185_0x1eead5(0x1a3),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x564594){const _0x58c340=a185_0x1eead5,_0x5d4fac=loadSqlProjectConfig(_0x564594[_0x58c340(0x199)]),_0xc41558=await readSqlLockFile(_0x5d4fac['lockFilePath']);if(!_0xc41558)throw CliErrors[_0x58c340(0x19b)](_0x58c340(0x191));},async 'dryRun'(_0x89a062){const _0x5e4584=a185_0x1eead5,_0x8e2ca9=loadSqlProjectConfig(_0x89a062[_0x5e4584(0x199)]),_0x1ac521=await readSqlLockFile(_0x8e2ca9[_0x5e4584(0x1b0)]);if(!_0x1ac521)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x3115fd}=ensureSqlLockScope(_0x1ac521,_0x89a062['appCode'],_0x8e2ca9[_0x5e4584(0x1ac)],_0x5e4584(0x19c)),_0x17503e=_0x89a062[_0x5e4584(0x1a8)](_0x5e4584(0x196)),_0x4df838=_0x3115fd['sqls'][_0x17503e];if(!_0x4df838)throw CliErrors['validation'](_0x5e4584(0x1aa)+_0x17503e+'\x22.');return{'method':_0x5e4584(0x1b4),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x17503e,'id':_0x4df838['remoteId'],'localPath':resolveLocalSqlFilePath(_0x8e2ca9,_0x17503e,_0x4df838)},'description':_0x5e4584(0x1af)+_0x17503e+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x8e2ca9[_0x5e4584(0x1a4)]};},async 'execute'(_0x1e0d86){const _0xa94e20=a185_0x1eead5,_0x434816=loadSqlProjectConfig(_0x1e0d86[_0xa94e20(0x199)]),_0x2724b1=await readSqlLockFile(_0x434816[_0xa94e20(0x1b0)]);if(!_0x2724b1)throw CliErrors[_0xa94e20(0x19b)](_0xa94e20(0x1a5));const {lockData:_0x195d1c,appLock:_0x249c93}=ensureSqlLockScope(_0x2724b1,_0x1e0d86['appCode'],_0x434816[_0xa94e20(0x1ac)],_0xa94e20(0x19c)),_0x4cff19=_0x1e0d86[_0xa94e20(0x1a8)](_0xa94e20(0x196)),_0x5708b6=_0x249c93['sqls'][_0x4cff19];if(!_0x5708b6)throw CliErrors[_0xa94e20(0x19b)](_0xa94e20(0x1aa)+_0x4cff19+'\x22.');await deleteSqlQuery({'id':_0x5708b6[_0xa94e20(0x190)],'sqlCode':_0x4cff19}),_0x249c93[_0xa94e20(0x19f)]=Object[_0xa94e20(0x19a)](Object[_0xa94e20(0x19d)](_0x249c93['sqls'])[_0xa94e20(0x195)](([_0x2abb9])=>_0x2abb9!==_0x4cff19)),_0x249c93['lastSync']=new Date()[_0xa94e20(0x1a2)](),await writeSqlLockFile(_0x434816[_0xa94e20(0x1b0)],_0x195d1c);const _0x9164f1=resolveLocalSqlFilePath(_0x434816,_0x4cff19,_0x5708b6);let _0x33c385;await fileExists(_0x9164f1)&&(_0x33c385=await moveToTrash(_0x434816[_0xa94e20(0x1ab)],_0x434816[_0xa94e20(0x1a4)],_0x9164f1),await cleanupEmptyDirectories(dirname(_0x9164f1),_0x434816[_0xa94e20(0x1b2)]));const _0x42f74e={'deleted':_0x4cff19,'remoteId':_0x5708b6[_0xa94e20(0x190)]};if(_0x33c385)_0x42f74e[_0xa94e20(0x1ae)]=_0x33c385;return{'ok':!![],'data':_0x42f74e,'message':_0xa94e20(0x193)+_0x4cff19+(_0x33c385?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x564370,_0x5eb9fb,_0x5a35f0){const _0x4e3e63=a185_0x1eead5,_0x2486f5=new Date()[_0x4e3e63(0x1a2)]()['replace'](/[:.]/g,'-'),_0xf72f88=relative(_0x564370,_0x5a35f0),_0x31c741=join(_0x5eb9fb,_0x2486f5,_0xf72f88);return await mkdir(dirname(_0x31c741),{'recursive':!![]}),await rename(_0x5a35f0,_0x31c741),_0x31c741;}function a185_0xe4ef(){const _0x1178cd=['sqlRootDir','78420JdzccS','POST','remoteId','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','1901625aepKib','Deleted\x20','131512lbvAmi','filter','sqlcode','startsWith','length','appCode','fromEntries','validation','delete','entries','27eiGYCS','sqls','sql','21354NsJonb','toISOString','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','trashDir','SQL\x20lock\x20file\x20not\x20found.','2544vpCgsQ','581MZrBID','str','1427730crmKiS','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','projectRoot','sqlRoot','676902CCighy','trashedTo','Would\x20delete\x20SQL\x20','lockFilePath','5krOVEv'];a185_0xe4ef=function(){return _0x1178cd;};return a185_0xe4ef();}async function cleanupEmptyDirectories(_0x2b1702,_0x13e1fd){const _0x489d71=a185_0x1eead5;let _0x4e9c60=resolve(_0x2b1702);const _0x594130=resolve(_0x13e1fd);while(_0x4e9c60[_0x489d71(0x197)](''+_0x594130+sep)||_0x4e9c60===_0x594130){if(_0x4e9c60===_0x594130)return;try{const _0x5f379c=await readdir(_0x4e9c60);if(_0x5f379c[_0x489d71(0x198)]>0x0)return;await rmdir(_0x4e9c60);}catch{return;}_0x4e9c60=dirname(_0x4e9c60);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a186_0x1d52(_0x37d525,_0x5d8cb){_0x37d525=_0x37d525-0x1bd;const _0x154fc3=a186_0x154f();let _0x1d52da=_0x154fc3[_0x37d525];return _0x1d52da;}const a186_0x3816d6=a186_0x1d52;(function(_0xf9f74a,_0x260411){const _0xd5949c=a186_0x1d52,_0x275942=_0xf9f74a();while(!![]){try{const _0x13a41b=parseInt(_0xd5949c(0x1cd))/0x1+-parseInt(_0xd5949c(0x1c5))/0x2*(parseInt(_0xd5949c(0x1d1))/0x3)+-parseInt(_0xd5949c(0x1ce))/0x4+-parseInt(_0xd5949c(0x1cf))/0x5*(parseInt(_0xd5949c(0x1c1))/0x6)+-parseInt(_0xd5949c(0x1be))/0x7+-parseInt(_0xd5949c(0x1c4))/0x8*(-parseInt(_0xd5949c(0x1ca))/0x9)+parseInt(_0xd5949c(0x1c8))/0xa*(-parseInt(_0xd5949c(0x1d4))/0xb);if(_0x13a41b===_0x260411)break;else _0x275942['push'](_0x275942['shift']());}catch(_0x59bf94){_0x275942['push'](_0x275942['shift']());}}}(a186_0x154f,0xc47a7));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a186_0x154f(){const _0x5683ef=['sqlCode','872llebhQ','24406plaHVP','str','Return\x20full\x20raw\x20SQL\x20query\x20object','1961330oVIHNE','sqlContent','103689GEQRWA','appCode','read','1266869ZlaDRk','383264xyHUMr','40855CimQFD','dbId','108PpkNFF','boolean','bool','22ANrucV','verbose','271327FwKObL','sqlcode','sqlName','552UfHYPW','detail'];a186_0x154f=function(){return _0x5683ef;};return a186_0x154f();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a186_0x3816d6(0x1c2),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a186_0x3816d6(0x1cc),'flags':[SQLCODE_FLAG,{'name':a186_0x3816d6(0x1bd),'type':a186_0x3816d6(0x1d2),'description':a186_0x3816d6(0x1c7)}],async 'execute'(_0x1533ac){const _0x5d3679=a186_0x3816d6,_0x45ebd3=await getSqlQueryInfo(_0x1533ac[_0x5d3679(0x1cb)],_0x1533ac[_0x5d3679(0x1c6)](_0x5d3679(0x1bf))),_0x24cecf=_0x1533ac[_0x5d3679(0x1d3)]('verbose');if(_0x24cecf)return{'ok':!![],'data':_0x45ebd3};const _0x552db9=_0x45ebd3[_0x5d3679(0x1d0)]?await getDbName(_0x1533ac[_0x5d3679(0x1cb)],_0x45ebd3[_0x5d3679(0x1d0)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x45ebd3[_0x5d3679(0x1c3)],'sqlName':_0x45ebd3[_0x5d3679(0x1c0)],'db':_0x552db9?_0x552db9+'\x20('+_0x45ebd3['dbId']+')':_0x45ebd3[_0x5d3679(0x1d0)]??'','description':_0x45ebd3['description']??'','sqlContent':_0x45ebd3[_0x5d3679(0x1c9)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a187_0x2f4a(_0x587e1a,_0x40eed0){_0x587e1a=_0x587e1a-0xbf;const _0x5f0d47=a187_0x5f0d();let _0x2f4ab1=_0x5f0d47[_0x587e1a];return _0x2f4ab1;}const a187_0x5d37dd=a187_0x2f4a;(function(_0x34f477,_0x5e152c){const _0x280338=a187_0x2f4a,_0x2a154b=_0x34f477();while(!![]){try{const _0x303614=parseInt(_0x280338(0xcd))/0x1*(parseInt(_0x280338(0xbf))/0x2)+-parseInt(_0x280338(0xc8))/0x3*(parseInt(_0x280338(0xc4))/0x4)+parseInt(_0x280338(0xd2))/0x5+-parseInt(_0x280338(0xd6))/0x6+-parseInt(_0x280338(0xd7))/0x7*(-parseInt(_0x280338(0xc7))/0x8)+-parseInt(_0x280338(0xd4))/0x9+parseInt(_0x280338(0xc5))/0xa;if(_0x303614===_0x5e152c)break;else _0x2a154b['push'](_0x2a154b['shift']());}catch(_0x25da99){_0x2a154b['push'](_0x2a154b['shift']());}}}(a187_0x5f0d,0x8adbe));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a187_0x5f0d(){const _0x1a62b1=['69825PtdyxR','SQL\x20execution\x20failed','exec','301222QLhyJU','length','execError','now','isArray','4hZPlLJ','13919530oaPypc','str','320xOhEEm','652551YyNAxJ','\x20row(s)\x20in\x20','appCode','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','sqlcode','1uKbDdg','string','execResult','Returned\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','710350Gdmirf','execSuccess','8133984VzXxQQ','params','2361450nsicMz'];a187_0x5f0d=function(){return _0x1a62b1;};return a187_0x5f0d();}export const sqlExec={'service':'sql','command':a187_0x5d37dd(0xd9),'description':a187_0x5d37dd(0xcb),'risk':'read','flags':[SQLCODE_FLAG,{'name':a187_0x5d37dd(0xd5),'type':a187_0x5d37dd(0xce),'description':a187_0x5d37dd(0xd1)}],async 'execute'(_0x52d17e){const _0x28038c=a187_0x5d37dd,_0x1e36f0=parseJsonParams(_0x52d17e[_0x28038c(0xc6)]('params')),_0x40bc9b=Date[_0x28038c(0xc2)](),_0x596444=await executeSql(_0x52d17e[_0x28038c(0xca)],_0x52d17e[_0x28038c(0xc6)](_0x28038c(0xcc)),_0x1e36f0),_0x6bcc91=Date['now']()-_0x40bc9b,_0xe743b=_0x596444?.[_0x28038c(0xcf)]??_0x596444,_0x6b8222=_0x596444?.[_0x28038c(0xd3)]??!![];if(!_0x6b8222)return{'ok':![],'data':{'error':_0x596444?.[_0x28038c(0xc1)]||_0x28038c(0xd8),'elapsed':_0x6bcc91},'message':_0x28038c(0xd8)};const _0x1736a7=Array[_0x28038c(0xc3)](_0xe743b)?_0xe743b:[];return{'ok':!![],'data':{'rows':_0x1736a7,'rowCount':_0x1736a7['length'],'elapsed':_0x6bcc91},'message':_0x28038c(0xd0)+_0x1736a7[_0x28038c(0xc0)]+_0x28038c(0xc9)+_0x6bcc91+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x285cd5,_0x41c087){const _0x1e7e31=a188_0x48bc,_0x1a3d88=_0x285cd5();while(!![]){try{const _0x4162f1=-parseInt(_0x1e7e31(0x18c))/0x1+parseInt(_0x1e7e31(0x187))/0x2+-parseInt(_0x1e7e31(0x189))/0x3*(parseInt(_0x1e7e31(0x183))/0x4)+parseInt(_0x1e7e31(0x18d))/0x5*(parseInt(_0x1e7e31(0x186))/0x6)+-parseInt(_0x1e7e31(0x185))/0x7+parseInt(_0x1e7e31(0x18b))/0x8*(-parseInt(_0x1e7e31(0x184))/0x9)+parseInt(_0x1e7e31(0x18a))/0xa*(parseInt(_0x1e7e31(0x188))/0xb);if(_0x4162f1===_0x41c087)break;else _0x1a3d88['push'](_0x1a3d88['shift']());}catch(_0x3f5600){_0x1a3d88['push'](_0x1a3d88['shift']());}}}(a188_0x225e,0xa6b18));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a188_0x225e(){const _0x3956cf=['1638396kATDbW','7407603nRwEdZ','23778PKkdmY','622972yZqdAk','4235253QRPNxX','791676NbAVBD','100GlvaLV','56POpmzd','189910GbOYJg','125SJEgtF','16XwtxCB'];a188_0x225e=function(){return _0x3956cf;};return a188_0x225e();}function a188_0x48bc(_0x2324c7,_0x523dde){_0x2324c7=_0x2324c7-0x183;const _0x225e73=a188_0x225e();let _0x48bcad=_0x225e73[_0x2324c7];return _0x48bcad;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a189_0x39cd9d=a189_0x39f7;function a189_0x4e10(){const _0x452e83=['length','2543814FaAKTQ','70969CNnRrT','sqlCode','Page\x20number','Page\x20size','4578080VaNxAJ','appCode','read','1296240SpGJzF','string','boolean','pagesize','1225049lijsgD','\x20SQL\x20queries\x20(total:\x20','sqlcode','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','dbId','verbose','number','19013013Jrijek','description','2356XXFGOj','name','list','num','5379stXpeY','map','Found\x20','22rFrcPb','all','bool','List\x20custom\x20SQL\x20queries'];a189_0x4e10=function(){return _0x452e83;};return a189_0x4e10();}(function(_0x52dfa8,_0x310651){const _0x5c2b23=a189_0x39f7,_0x542347=_0x52dfa8();while(!![]){try{const _0x2af983=-parseInt(_0x5c2b23(0x1ac))/0x1*(-parseInt(_0x5c2b23(0x1a6))/0x2)+-parseInt(_0x5c2b23(0x1a3))/0x3*(-parseInt(_0x5c2b23(0x19f))/0x4)+parseInt(_0x5c2b23(0x1b0))/0x5+-parseInt(_0x5c2b23(0x1ab))/0x6+parseInt(_0x5c2b23(0x1b7))/0x7+parseInt(_0x5c2b23(0x1b3))/0x8+-parseInt(_0x5c2b23(0x1be))/0x9;if(_0x2af983===_0x310651)break;else _0x542347['push'](_0x542347['shift']());}catch(_0xa10232){_0x542347['push'](_0x542347['shift']());}}}(a189_0x4e10,0x86f9f));import{listSqlQueries}from'../../core/api-client.js';function a189_0x39f7(_0x41da30,_0x3896d7){_0x41da30=_0x41da30-0x19e;const _0x4e106c=a189_0x4e10();let _0x39f7df=_0x4e106c[_0x41da30];return _0x39f7df;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a189_0x39cd9d(0x1a1),'description':a189_0x39cd9d(0x1a9),'risk':a189_0x39cd9d(0x1b2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0x39cd9d(0x1a0),'type':a189_0x39cd9d(0x1b4),'description':'Filter\x20by\x20SQL\x20name'},{'name':'page','type':a189_0x39cd9d(0x1bd),'description':a189_0x39cd9d(0x1ae),'default':0x1},{'name':a189_0x39cd9d(0x1b6),'type':a189_0x39cd9d(0x1bd),'description':a189_0x39cd9d(0x1af)},{'name':a189_0x39cd9d(0x1bc),'type':a189_0x39cd9d(0x1b5),'description':a189_0x39cd9d(0x1ba)}],async 'execute'(_0x206011){const _0x50f5c2=a189_0x39cd9d,_0x4e1631=await listSqlQueries(_0x206011[_0x50f5c2(0x1b1)],{'sqlCode':_0x206011['str'](_0x50f5c2(0x1b9))||undefined,'sqlName':_0x206011['str'](_0x50f5c2(0x1a0))||undefined,'currentPage':_0x206011[_0x50f5c2(0x1a2)]('page'),'pageSize':_0x206011[_0x50f5c2(0x1a2)](_0x50f5c2(0x1b6),0x32)}),_0x4cfc7a=_0x206011[_0x50f5c2(0x1a8)](_0x50f5c2(0x1bc)),_0xfde8c3=_0x4e1631['tableData']??[],_0xcd0fb7=_0x4e1631['paging']?.['totalCount']??_0xfde8c3[_0x50f5c2(0x1aa)];let _0x346b56;return _0x4cfc7a?_0x346b56=_0xfde8c3:_0x346b56=await Promise[_0x50f5c2(0x1a7)](_0xfde8c3[_0x50f5c2(0x1a4)](async _0x42c044=>{const _0x30b69a=_0x50f5c2;let _0x1f759f;try{_0x1f759f=_0x42c044[_0x30b69a(0x1bb)]?await getDbName(_0x206011[_0x30b69a(0x1b1)],_0x42c044[_0x30b69a(0x1bb)]):undefined;}catch{}return{'sqlCode':_0x42c044[_0x30b69a(0x1ad)],'sqlName':_0x42c044['sqlName'],'description':_0x42c044[_0x30b69a(0x19e)]??'','db':_0x1f759f?_0x1f759f+'\x20('+_0x42c044[_0x30b69a(0x1bb)]+')':_0x42c044['dbId']??''};})),{'ok':!![],'data':_0x346b56,'message':_0xfde8c3[_0x50f5c2(0x1aa)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x50f5c2(0x1a5)+_0xfde8c3[_0x50f5c2(0x1aa)]+_0x50f5c2(0x1b8)+_0xcd0fb7+').'};}};
|